From: Andrea Amorese Date: Wed, 8 Sep 2021 08:24:10 +0000 (+0200) Subject: Built motion from commit 614202e9.|2.5.345 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;/%22card-image.png//%27?a=commitdiff_plain;h=d931bbbee9c82a8148c4a828e69c601b52e40335;p=motion2.git Built motion from commit 614202e9.|2.5.345 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 28626fe..f50588e 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-07T15:18:32.870Z", + "time": "2021-09-08T08:18:04.787Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index a4cb7ce..343655e 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-07T15:18:32.870Z", + "time": "2021-09-08T08:18:04.787Z", "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 df57120..df0992e 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 _0x4745=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[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]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','bot','script'];(function(_0xcc8082,_0x1d1098){var _0x67a1d7=function(_0x50512e){while(--_0x50512e){_0xcc8082['push'](_0xcc8082['shift']());}};_0x67a1d7(++_0x1d1098);}(_0x4745,0x1e7));var _0x5474=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x4745[_0x3635ce];return _0x97ecd0;};'use strict';var Sequelize=require(_0x5474('0x0'));module[_0x5474('0x1')]={'name':{'type':Sequelize[_0x5474('0x2')],'get':function(_0x16ee4c){return this[_0x5474('0x3')](_0x5474('0x4'));}},'action':{'type':Sequelize[_0x5474('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x5474('0x6'),_0x5474('0x7'),_0x5474('0x8'),_0x5474('0x9'),_0x5474('0xa'),'browser',_0x5474('0xb'),_0x5474('0xc')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x5474('0xd')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x5474('0xe')},'data2':{'type':Sequelize[_0x5474('0x5')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x5474('0x5')](0x1000),'comment':_0x5474('0xf')},'data4':{'type':Sequelize[_0x5474('0x5')](0x1000),'comments':_0x5474('0x10')},'data5':{'type':Sequelize[_0x5474('0x5')](0x1000),'comments':_0x5474('0x11')},'data6':{'type':Sequelize[_0x5474('0x5')],'comments':_0x5474('0x12')},'data7':{'type':Sequelize['TEXT'],'comments':_0x5474('0x13')}}; \ No newline at end of file +var _0x90b1=['contactManager','integration','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[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]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','action','STRING'];(function(_0x1584ad,_0x218442){var _0x5524a8=function(_0x5c3833){while(--_0x5c3833){_0x1584ad['push'](_0x1584ad['shift']());}};_0x5524a8(++_0x218442);}(_0x90b1,0x1bb));var _0x190b=function(_0x53e787,_0x4298e6){_0x53e787=_0x53e787-0x0;var _0x2781a0=_0x90b1[_0x53e787];return _0x2781a0;};'use strict';var Sequelize=require(_0x190b('0x0'));module[_0x190b('0x1')]={'name':{'type':Sequelize[_0x190b('0x2')],'get':function(_0x55cd11){return this['getDataValue'](_0x190b('0x3'));}},'action':{'type':Sequelize[_0x190b('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x190b('0x5'),_0x190b('0x6'),'motionbar','jscripty','urlForward','browser',_0x190b('0x7'),_0x190b('0x8')]],'msg':_0x190b('0x9')}},'comment':_0x190b('0x9')},'data1':{'type':Sequelize[_0x190b('0x4')](0x1000),'comment':_0x190b('0xa')},'data2':{'type':Sequelize[_0x190b('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x190b('0x4')](0x1000),'comment':_0x190b('0xb')},'data4':{'type':Sequelize[_0x190b('0x4')](0x1000),'comments':_0x190b('0xc')},'data5':{'type':Sequelize[_0x190b('0x4')](0x1000),'comments':_0x190b('0xd')},'data6':{'type':Sequelize[_0x190b('0x4')],'comments':_0x190b('0xe')},'data7':{'type':Sequelize['TEXT'],'comments':_0x190b('0xf')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 10a185c..b7d55ab 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 _0x5dac=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x59ab09,_0x32f327){var _0x5ab970=function(_0x561fa2){while(--_0x561fa2){_0x59ab09['push'](_0x59ab09['shift']());}};_0x5ab970(++_0x32f327);}(_0x5dac,0xaf));var _0xc5da=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5dac[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0xc5da('0x0'));var rimraf=require(_0xc5da('0x1'));var zipdir=require(_0xc5da('0x2'));var jsonpatch=require(_0xc5da('0x3'));var rp=require(_0xc5da('0x4'));var moment=require(_0xc5da('0x5'));var BPromise=require(_0xc5da('0x6'));var Mustache=require(_0xc5da('0x7'));var util=require('util');var path=require('path');var sox=require(_0xc5da('0x8'));var csv=require('to-csv');var ejs=require(_0xc5da('0x9'));var fs=require('fs');var fs_extra=require(_0xc5da('0xa'));var _=require(_0xc5da('0xb'));var squel=require(_0xc5da('0xc'));var crypto=require(_0xc5da('0xd'));var jsforce=require(_0xc5da('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc5da('0xf'));var querystring=require('querystring');var Papa=require(_0xc5da('0x10'));var Redis=require('ioredis');var authService=require(_0xc5da('0x11'));var qs=require(_0xc5da('0x12'));var as=require(_0xc5da('0x13'));var hardwareService=require(_0xc5da('0x14'));var logger=require(_0xc5da('0x15'))(_0xc5da('0x16'));var utils=require(_0xc5da('0x17'));var config=require(_0xc5da('0x18'));var licenseUtil=require(_0xc5da('0x19'));var db=require(_0xc5da('0x1a'))['db'];function respondWithStatusCode(_0x3de1a6,_0x4df139){_0x4df139=_0x4df139||0xcc;return function(_0x5c96ee){if(_0x5c96ee){return _0x3de1a6[_0xc5da('0x1b')](_0x4df139);}return _0x3de1a6['status'](_0x4df139)['end']();};}function respondWithResult(_0x1e5de9,_0x370a0e){_0x370a0e=_0x370a0e||0xc8;return function(_0x5ed9f7){if(_0x5ed9f7){return _0x1e5de9[_0xc5da('0x1c')](_0x370a0e)[_0xc5da('0x1d')](_0x5ed9f7);}};}function respondWithFilteredResult(_0xdf5b9a,_0x57bda9){return function(_0x5bf4c2){if(_0x5bf4c2){var _0x27d5d9=typeof _0x57bda9[_0xc5da('0x1e')]===_0xc5da('0x1f')&&typeof _0x57bda9[_0xc5da('0x20')]==='undefined';var _0x2314ee=_0x5bf4c2[_0xc5da('0x21')];var _0x160e72=_0x27d5d9?0x0:_0x57bda9[_0xc5da('0x1e')];var _0x4a57f5=_0x27d5d9?_0x5bf4c2[_0xc5da('0x21')]:_0x57bda9[_0xc5da('0x1e')]+_0x57bda9[_0xc5da('0x20')];var _0x36d583;if(_0x4a57f5>=_0x2314ee){_0x4a57f5=_0x2314ee;_0x36d583=0xc8;}else{_0x36d583=0xce;}_0xdf5b9a['status'](_0x36d583);return _0xdf5b9a[_0xc5da('0x22')](_0xc5da('0x23'),_0x160e72+'-'+_0x4a57f5+'/'+_0x2314ee)[_0xc5da('0x1d')](_0x5bf4c2);}return null;};}function patchUpdates(_0x317d52){return function(_0x469704){try{jsonpatch[_0xc5da('0x24')](_0x469704,_0x317d52,!![]);}catch(_0x44186a){return BPromise[_0xc5da('0x25')](_0x44186a);}return _0x469704[_0xc5da('0x26')]();};}function saveUpdates(_0x2e5906,_0x12dd10){return function(_0x16b78c){if(_0x16b78c){return _0x16b78c[_0xc5da('0x27')](_0x2e5906)[_0xc5da('0x28')](function(_0x1d367c){return _0x1d367c;});}return null;};}function removeEntity(_0x5d560f,_0x4d3fb5){return function(_0x52f0cc){if(_0x52f0cc){return _0x52f0cc[_0xc5da('0x29')]()[_0xc5da('0x28')](function(){_0x5d560f[_0xc5da('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50a925,_0x3aa0ca){return function(_0x10e483){if(!_0x10e483){_0x50a925[_0xc5da('0x1b')](0x194);}return _0x10e483;};}function handleError(_0x5170e4,_0x3132c8){_0x3132c8=_0x3132c8||0x1f4;return function(_0x31d04a){logger[_0xc5da('0x2a')](_0x31d04a['stack']);if(_0x31d04a[_0xc5da('0x2b')]){delete _0x31d04a['name'];}_0x5170e4[_0xc5da('0x1c')](_0x3132c8)[_0xc5da('0x2c')](_0x31d04a);};}exports[_0xc5da('0x27')]=function(_0x39d6a0,_0x14d003){if(_0x39d6a0['body']['id']){delete _0x39d6a0[_0xc5da('0x2d')]['id'];}return db[_0xc5da('0x2e')][_0xc5da('0x2f')]({'where':{'id':_0x39d6a0[_0xc5da('0x30')]['id']}})[_0xc5da('0x28')](handleEntityNotFound(_0x14d003,null))[_0xc5da('0x28')](saveUpdates(_0x39d6a0[_0xc5da('0x2d')],null))[_0xc5da('0x28')](respondWithResult(_0x14d003,null))['catch'](handleError(_0x14d003,null));};exports[_0xc5da('0x29')]=function(_0x2fc7f5,_0x56d4a0){return db[_0xc5da('0x2e')][_0xc5da('0x2f')]({'where':{'id':_0x2fc7f5['params']['id']}})['then'](handleEntityNotFound(_0x56d4a0,null))[_0xc5da('0x28')](removeEntity(_0x56d4a0,null))[_0xc5da('0x31')](handleError(_0x56d4a0,null));}; \ No newline at end of file +var _0x5912=['set','Content-Range','apply','reject','save','update','destroy','error','name','send','body','find','Action','then','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset'];(function(_0x23eb8c,_0x5618e8){var _0x4978ba=function(_0x1512ed){while(--_0x1512ed){_0x23eb8c['push'](_0x23eb8c['shift']());}};_0x4978ba(++_0x5618e8);}(_0x5912,0x9e));var _0x2591=function(_0x1fd6fa,_0x1128fd){_0x1fd6fa=_0x1fd6fa-0x0;var _0x31cc4c=_0x5912[_0x1fd6fa];return _0x31cc4c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2591('0x0'));var zipdir=require(_0x2591('0x1'));var jsonpatch=require(_0x2591('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2591('0x3'));var Mustache=require(_0x2591('0x4'));var util=require(_0x2591('0x5'));var path=require('path');var sox=require(_0x2591('0x6'));var csv=require('to-csv');var ejs=require(_0x2591('0x7'));var fs=require('fs');var fs_extra=require(_0x2591('0x8'));var _=require('lodash');var squel=require(_0x2591('0x9'));var crypto=require(_0x2591('0xa'));var jsforce=require(_0x2591('0xb'));var deskjs=require(_0x2591('0xc'));var toCsv=require(_0x2591('0xd'));var querystring=require(_0x2591('0xe'));var Papa=require(_0x2591('0xf'));var Redis=require(_0x2591('0x10'));var authService=require(_0x2591('0x11'));var qs=require(_0x2591('0x12'));var as=require(_0x2591('0x13'));var hardwareService=require(_0x2591('0x14'));var logger=require(_0x2591('0x15'))(_0x2591('0x16'));var utils=require(_0x2591('0x17'));var config=require(_0x2591('0x18'));var licenseUtil=require(_0x2591('0x19'));var db=require(_0x2591('0x1a'))['db'];function respondWithStatusCode(_0x162358,_0x139739){_0x139739=_0x139739||0xcc;return function(_0xd9a4c0){if(_0xd9a4c0){return _0x162358[_0x2591('0x1b')](_0x139739);}return _0x162358[_0x2591('0x1c')](_0x139739)[_0x2591('0x1d')]();};}function respondWithResult(_0xa77e56,_0x394f7a){_0x394f7a=_0x394f7a||0xc8;return function(_0x31553d){if(_0x31553d){return _0xa77e56[_0x2591('0x1c')](_0x394f7a)['json'](_0x31553d);}};}function respondWithFilteredResult(_0xeaf9fb,_0x56c1e9){return function(_0x65c8de){if(_0x65c8de){var _0x14f9b0=typeof _0x56c1e9['offset']===_0x2591('0x1e')&&typeof _0x56c1e9[_0x2591('0x1f')]===_0x2591('0x1e');var _0x3ccfe2=_0x65c8de[_0x2591('0x20')];var _0xd08b81=_0x14f9b0?0x0:_0x56c1e9[_0x2591('0x21')];var _0x370c28=_0x14f9b0?_0x65c8de[_0x2591('0x20')]:_0x56c1e9[_0x2591('0x21')]+_0x56c1e9[_0x2591('0x1f')];var _0x2d4bce;if(_0x370c28>=_0x3ccfe2){_0x370c28=_0x3ccfe2;_0x2d4bce=0xc8;}else{_0x2d4bce=0xce;}_0xeaf9fb['status'](_0x2d4bce);return _0xeaf9fb[_0x2591('0x22')](_0x2591('0x23'),_0xd08b81+'-'+_0x370c28+'/'+_0x3ccfe2)['json'](_0x65c8de);}return null;};}function patchUpdates(_0x5b17d1){return function(_0x7f62fc){try{jsonpatch[_0x2591('0x24')](_0x7f62fc,_0x5b17d1,!![]);}catch(_0x25eacf){return BPromise[_0x2591('0x25')](_0x25eacf);}return _0x7f62fc[_0x2591('0x26')]();};}function saveUpdates(_0x5bb717,_0xd4cbc5){return function(_0x25fea1){if(_0x25fea1){return _0x25fea1[_0x2591('0x27')](_0x5bb717)['then'](function(_0x4a6837){return _0x4a6837;});}return null;};}function removeEntity(_0x302491,_0x4b31c7){return function(_0x55bbfa){if(_0x55bbfa){return _0x55bbfa[_0x2591('0x28')]()['then'](function(){_0x302491[_0x2591('0x1c')](0xcc)[_0x2591('0x1d')]();});}};}function handleEntityNotFound(_0x480ddd,_0x17b862){return function(_0x167a34){if(!_0x167a34){_0x480ddd['sendStatus'](0x194);}return _0x167a34;};}function handleError(_0x5dc1a4,_0x27635c){_0x27635c=_0x27635c||0x1f4;return function(_0x294f54){logger[_0x2591('0x29')](_0x294f54['stack']);if(_0x294f54['name']){delete _0x294f54[_0x2591('0x2a')];}_0x5dc1a4[_0x2591('0x1c')](_0x27635c)[_0x2591('0x2b')](_0x294f54);};}exports[_0x2591('0x27')]=function(_0x4510a0,_0x46470c){if(_0x4510a0[_0x2591('0x2c')]['id']){delete _0x4510a0[_0x2591('0x2c')]['id'];}return db['Action'][_0x2591('0x2d')]({'where':{'id':_0x4510a0['params']['id']}})['then'](handleEntityNotFound(_0x46470c,null))['then'](saveUpdates(_0x4510a0[_0x2591('0x2c')],null))['then'](respondWithResult(_0x46470c,null))['catch'](handleError(_0x46470c,null));};exports[_0x2591('0x28')]=function(_0x4f8ad2,_0x1af139){return db[_0x2591('0x2e')][_0x2591('0x2d')]({'where':{'id':_0x4f8ad2['params']['id']}})['then'](handleEntityNotFound(_0x1af139,null))[_0x2591('0x2f')](removeEntity(_0x1af139,null))['catch'](handleError(_0x1af139,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index c002149..c497803 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 _0x9017=['rimraf','./action.attributes','exports','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x8a76d,_0x5af376){var _0x47038e=function(_0x3a1eb0){while(--_0x3a1eb0){_0x8a76d['push'](_0x8a76d['shift']());}};_0x47038e(++_0x5af376);}(_0x9017,0x149));var _0x7901=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9017[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7901('0x0'));var util=require(_0x7901('0x1'));var logger=require(_0x7901('0x2'))(_0x7901('0x3'));var moment=require(_0x7901('0x4'));var BPromise=require(_0x7901('0x5'));var rp=require(_0x7901('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7901('0x7'));var config=require('../../config/environment');var attributes=require(_0x7901('0x8'));module[_0x7901('0x9')]=function(_0x260f1f,_0x50f80c){return _0x260f1f['define'](_0x7901('0xa'),attributes,{'tableName':_0x7901('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2868=['path','../../config/environment','./action.attributes','define','Action','lodash','../../config/logger','api','bluebird'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x2868,0x191));var _0x8286=function(_0x50be91,_0x35ae41){_0x50be91=_0x50be91-0x0;var _0x559974=_0x2868[_0x50be91];return _0x559974;};'use strict';var _=require(_0x8286('0x0'));var util=require('util');var logger=require(_0x8286('0x1'))(_0x8286('0x2'));var moment=require('moment');var BPromise=require(_0x8286('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8286('0x4'));var rimraf=require('rimraf');var config=require(_0x8286('0x5'));var attributes=require(_0x8286('0x6'));module['exports']=function(_0xa1b0f9,_0x9a8dcd){return _0xa1b0f9[_0x8286('0x7')](_0x8286('0x8'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 1da56dd..e4890c9 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x298e3b,_0x350638){var _0xfab5cf=function(_0x170026){while(--_0x170026){_0x298e3b['push'](_0x298e3b['shift']());}};_0xfab5cf(++_0x350638);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xc4aa[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x53ec,0x192));var _0xc53e=function(_0x41cf29,_0x216a99){_0x41cf29=_0x41cf29-0x0;var _0x566462=_0x53ec[_0x41cf29];return _0x566462;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 82d9470..83b9918 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 _0x5e1d=['../../config/environment','./action.controller','put','isAuthenticated','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1120c7,_0x18f931){var _0x436f8a=function(_0x19f1dd){while(--_0x19f1dd){_0x1120c7['push'](_0x1120c7['shift']());}};_0x436f8a(++_0x18f931);}(_0x5e1d,0x1b2));var _0xd5e1=function(_0x222ac2,_0x57ec8c){_0x222ac2=_0x222ac2-0x0;var _0x4b6f35=_0x5e1d[_0x222ac2];return _0x4b6f35;};'use strict';var multer=require(_0xd5e1('0x0'));var util=require('util');var path=require(_0xd5e1('0x1'));var timeout=require(_0xd5e1('0x2'));var express=require(_0xd5e1('0x3'));var router=express[_0xd5e1('0x4')]();var fs_extra=require(_0xd5e1('0x5'));var auth=require(_0xd5e1('0x6'));var interaction=require(_0xd5e1('0x7'));var config=require(_0xd5e1('0x8'));var controller=require(_0xd5e1('0x9'));router[_0xd5e1('0xa')]('/:id',auth[_0xd5e1('0xb')](),controller[_0xd5e1('0xc')]);router[_0xd5e1('0xd')](_0xd5e1('0xe'),auth[_0xd5e1('0xb')](),controller[_0xd5e1('0xf')]);module[_0xd5e1('0x10')]=router; \ No newline at end of file +var _0xa21b=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x3cb656,_0xaa47b4){var _0x290763=function(_0x7aa613){while(--_0x7aa613){_0x3cb656['push'](_0x3cb656['shift']());}};_0x290763(++_0xaa47b4);}(_0xa21b,0xd2));var _0xba21=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0xa21b[_0x38b14f];return _0x22a324;};'use strict';var multer=require(_0xba21('0x0'));var util=require(_0xba21('0x1'));var path=require(_0xba21('0x2'));var timeout=require('connect-timeout');var express=require(_0xba21('0x3'));var router=express[_0xba21('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xba21('0x5'));var interaction=require(_0xba21('0x6'));var config=require(_0xba21('0x7'));var controller=require('./action.controller');router[_0xba21('0x8')](_0xba21('0x9'),auth[_0xba21('0xa')](),controller[_0xba21('0xb')]);router[_0xba21('0xc')](_0xba21('0x9'),auth[_0xba21('0xa')](),controller[_0xba21('0xd')]);module[_0xba21('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 8a08447..9bf5f1a 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 _0xdbf5=['exports','STRING','TEXT'];(function(_0x1277ef,_0x7f4ab8){var _0x77fafc=function(_0x313337){while(--_0x313337){_0x1277ef['push'](_0x1277ef['shift']());}};_0x77fafc(++_0x7f4ab8);}(_0xdbf5,0x18c));var _0x5dbf=function(_0xe317ab,_0x2b2730){_0xe317ab=_0xe317ab-0x0;var _0x1b5a8c=_0xdbf5[_0xe317ab];return _0x1b5a8c;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5dbf('0x1')]},'table':{'type':Sequelize[_0x5dbf('0x1')]},'conditions':{'type':Sequelize[_0x5dbf('0x2')]},'joins':{'type':Sequelize[_0x5dbf('0x2')]}}; \ No newline at end of file +var _0x7da7=['TEXT','sequelize','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7da7,0x10d));var _0x77da=function(_0x4ee9cd,_0xd375b0){_0x4ee9cd=_0x4ee9cd-0x0;var _0x328a5b=_0x7da7[_0x4ee9cd];return _0x328a5b;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'name':{'type':Sequelize[_0x77da('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x77da('0x2')]},'conditions':{'type':Sequelize[_0x77da('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index d1c233f..1b9dd75 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 _0xad29=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','table','MetricId','field','function','replace','orderBy','DESC','joins','parse','parentKey','foreignTable','format','conditions','Limited\x20Query:','toString','sequelize','join','MIN(%s)','IS\x20NOT\x20NULL','operator','from','metric','groupBy','foreignKey','%s.%s\x20=\x20%s.%s','clone','output','web','randomstring','generate','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','fork','../../components/export/','savename','countTable','COUNT(*)','QueryTypes','SELECT','runReport','alias','debug','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','error','name','send','map','AnalyticCustomReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort'];(function(_0x4df04b,_0x52b8cb){var _0x5ce10e=function(_0x1dd148){while(--_0x1dd148){_0x4df04b['push'](_0x4df04b['shift']());}};_0x5ce10e(++_0x52b8cb);}(_0xad29,0x1b2));var _0x9ad2=function(_0x489c95,_0x53159c){_0x489c95=_0x489c95-0x0;var _0x10e7a7=_0xad29[_0x489c95];return _0x10e7a7;};'use strict';var emlformat=require(_0x9ad2('0x0'));var rimraf=require(_0x9ad2('0x1'));var zipdir=require(_0x9ad2('0x2'));var jsonpatch=require(_0x9ad2('0x3'));var rp=require(_0x9ad2('0x4'));var moment=require(_0x9ad2('0x5'));var BPromise=require(_0x9ad2('0x6'));var Mustache=require(_0x9ad2('0x7'));var util=require(_0x9ad2('0x8'));var path=require(_0x9ad2('0x9'));var sox=require(_0x9ad2('0xa'));var csv=require(_0x9ad2('0xb'));var ejs=require(_0x9ad2('0xc'));var fs=require('fs');var fs_extra=require(_0x9ad2('0xd'));var _=require(_0x9ad2('0xe'));var squel=require('squel');var crypto=require(_0x9ad2('0xf'));var jsforce=require(_0x9ad2('0x10'));var deskjs=require(_0x9ad2('0x11'));var toCsv=require(_0x9ad2('0xb'));var querystring=require('querystring');var Papa=require(_0x9ad2('0x12'));var Redis=require(_0x9ad2('0x13'));var authService=require(_0x9ad2('0x14'));var qs=require(_0x9ad2('0x15'));var as=require(_0x9ad2('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9ad2('0x17'));var utils=require(_0x9ad2('0x18'));var config=require(_0x9ad2('0x19'));var licenseUtil=require(_0x9ad2('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require(_0x9ad2('0x1b'))[_0x9ad2('0x1c')];function respondWithStatusCode(_0x145f12,_0x39248b){_0x39248b=_0x39248b||0xcc;return function(_0x4fd272){if(_0x4fd272){return _0x145f12['sendStatus'](_0x39248b);}return _0x145f12[_0x9ad2('0x1d')](_0x39248b)['end']();};}function respondWithResult(_0x196baf,_0x1a0118){_0x1a0118=_0x1a0118||0xc8;return function(_0xa4638f){if(_0xa4638f){return _0x196baf[_0x9ad2('0x1d')](_0x1a0118)['json'](_0xa4638f);}};}function respondWithFilteredResult(_0x5cac22,_0x562a35){return function(_0x338e0e){if(_0x338e0e){var _0x1ec242=typeof _0x562a35[_0x9ad2('0x1e')]==='undefined'&&typeof _0x562a35['limit']===_0x9ad2('0x1f');var _0x1fc7a0=_0x338e0e['count'];var _0x4f99b5=_0x1ec242?0x0:_0x562a35['offset'];var _0x3fdc86=_0x1ec242?_0x338e0e[_0x9ad2('0x20')]:_0x562a35['offset']+_0x562a35[_0x9ad2('0x21')];var _0x6ff3ee;if(_0x3fdc86>=_0x1fc7a0){_0x3fdc86=_0x1fc7a0;_0x6ff3ee=0xc8;}else{_0x6ff3ee=0xce;}_0x5cac22['status'](_0x6ff3ee);return _0x5cac22['set'](_0x9ad2('0x22'),_0x4f99b5+'-'+_0x3fdc86+'/'+_0x1fc7a0)[_0x9ad2('0x23')](_0x338e0e);}return null;};}function patchUpdates(_0x5cde93){return function(_0x404650){try{jsonpatch[_0x9ad2('0x24')](_0x404650,_0x5cde93,!![]);}catch(_0x578612){return BPromise[_0x9ad2('0x25')](_0x578612);}return _0x404650[_0x9ad2('0x26')]();};}function saveUpdates(_0x4d2224,_0x2a523){return function(_0x58a4b2){if(_0x58a4b2){return _0x58a4b2[_0x9ad2('0x27')](_0x4d2224)[_0x9ad2('0x28')](function(_0x543b90){return _0x543b90;});}return null;};}function removeEntity(_0x221359,_0x5cf3fa){return function(_0x5969e0){if(_0x5969e0){return _0x5969e0[_0x9ad2('0x29')]()['then'](function(){var _0x103c10=_0x5969e0[_0x9ad2('0x2a')]({'plain':!![]});var _0x29e907='CustomReports';return db[_0x9ad2('0x2b')][_0x9ad2('0x29')]({'where':{'type':_0x29e907,'resourceId':_0x103c10['id']}})[_0x9ad2('0x28')](function(){return _0x5969e0;});})['then'](function(){_0x221359[_0x9ad2('0x1d')](0xcc)[_0x9ad2('0x2c')]();});}};}function handleEntityNotFound(_0x2b3519,_0x1817dc){return function(_0x543ffe){if(!_0x543ffe){_0x2b3519[_0x9ad2('0x2d')](0x194);}return _0x543ffe;};}function handleError(_0x59d22d,_0x22a20c){_0x22a20c=_0x22a20c||0x1f4;return function(_0x4a46ec){logger[_0x9ad2('0x2e')](_0x4a46ec['stack']);if(_0x4a46ec[_0x9ad2('0x2f')]){delete _0x4a46ec[_0x9ad2('0x2f')];}_0x59d22d['status'](_0x22a20c)[_0x9ad2('0x30')](_0x4a46ec);};}exports['index']=function(_0x4d4b3a,_0x56d942){var _0x4c33f6={},_0x13bc97={},_0x1ae32f={'count':0x0,'rows':[]};var _0x54bee4=_[_0x9ad2('0x31')](db[_0x9ad2('0x32')][_0x9ad2('0x33')],function(_0x5ea60a){return{'name':_0x5ea60a['fieldName'],'type':_0x5ea60a[_0x9ad2('0x34')][_0x9ad2('0x35')]};});_0x13bc97[_0x9ad2('0x36')]=_[_0x9ad2('0x31')](_0x54bee4,_0x9ad2('0x2f'));_0x13bc97[_0x9ad2('0x37')]=_[_0x9ad2('0x38')](_0x4d4b3a['query']);_0x13bc97[_0x9ad2('0x39')]=_[_0x9ad2('0x3a')](_0x13bc97[_0x9ad2('0x36')],_0x13bc97['query']);_0x4c33f6[_0x9ad2('0x3b')]=_[_0x9ad2('0x3a')](_0x13bc97[_0x9ad2('0x36')],qs[_0x9ad2('0x3c')](_0x4d4b3a[_0x9ad2('0x37')][_0x9ad2('0x3c')]));_0x4c33f6[_0x9ad2('0x3b')]=_0x4c33f6[_0x9ad2('0x3b')]['length']?_0x4c33f6[_0x9ad2('0x3b')]:_0x13bc97[_0x9ad2('0x36')];if(!_0x4d4b3a[_0x9ad2('0x37')][_0x9ad2('0x3d')]('nolimit')){_0x4c33f6[_0x9ad2('0x21')]=qs[_0x9ad2('0x21')](_0x4d4b3a[_0x9ad2('0x37')]['limit']);_0x4c33f6[_0x9ad2('0x1e')]=qs[_0x9ad2('0x1e')](_0x4d4b3a[_0x9ad2('0x37')][_0x9ad2('0x1e')]);}_0x4c33f6[_0x9ad2('0x3e')]=qs[_0x9ad2('0x3f')](_0x4d4b3a['query'][_0x9ad2('0x3f')]);_0x4c33f6[_0x9ad2('0x40')]=qs[_0x9ad2('0x39')](_[_0x9ad2('0x41')](_0x4d4b3a['query'],_0x13bc97[_0x9ad2('0x39')]),_0x54bee4);if(_0x4d4b3a[_0x9ad2('0x37')][_0x9ad2('0x42')]){_0x4c33f6[_0x9ad2('0x40')]=_[_0x9ad2('0x43')](_0x4c33f6[_0x9ad2('0x40')],{'$or':_['map'](_0x54bee4,function(_0x2861e2){if(_0x2861e2['type']!==_0x9ad2('0x44')){var _0x42f79f={};_0x42f79f[_0x2861e2[_0x9ad2('0x2f')]]={'$like':'%'+_0x4d4b3a[_0x9ad2('0x37')]['filter']+'%'};return _0x42f79f;}})});}_0x4c33f6=_[_0x9ad2('0x43')]({},_0x4c33f6,_0x4d4b3a[_0x9ad2('0x45')]);var _0x12de40={'where':_0x4c33f6[_0x9ad2('0x40')]};return db[_0x9ad2('0x32')][_0x9ad2('0x20')](_0x12de40)[_0x9ad2('0x28')](function(_0x3d5ba2){_0x1ae32f[_0x9ad2('0x20')]=_0x3d5ba2;if(_0x4d4b3a[_0x9ad2('0x37')][_0x9ad2('0x46')]){_0x4c33f6[_0x9ad2('0x47')]=[{'all':!![]}];}return db[_0x9ad2('0x32')]['findAll'](_0x4c33f6);})['then'](function(_0x2114ea){_0x1ae32f[_0x9ad2('0x48')]=_0x2114ea;return _0x1ae32f;})[_0x9ad2('0x28')](respondWithFilteredResult(_0x56d942,_0x4c33f6))[_0x9ad2('0x49')](handleError(_0x56d942,null));};exports[_0x9ad2('0x4a')]=function(_0x177574,_0x227277){var _0x2e998a={'raw':![],'where':{'id':_0x177574[_0x9ad2('0x4b')]['id']}},_0x3bbe31={};_0x3bbe31[_0x9ad2('0x36')]=_[_0x9ad2('0x38')](db['AnalyticCustomReport']['rawAttributes']);_0x3bbe31[_0x9ad2('0x37')]=_[_0x9ad2('0x38')](_0x177574[_0x9ad2('0x37')]);_0x3bbe31[_0x9ad2('0x39')]=_['intersection'](_0x3bbe31['model'],_0x3bbe31['query']);_0x2e998a[_0x9ad2('0x3b')]=_[_0x9ad2('0x3a')](_0x3bbe31[_0x9ad2('0x36')],qs[_0x9ad2('0x3c')](_0x177574[_0x9ad2('0x37')][_0x9ad2('0x3c')]));_0x2e998a[_0x9ad2('0x3b')]=_0x2e998a['attributes'][_0x9ad2('0x4c')]?_0x2e998a['attributes']:_0x3bbe31['model'];if(_0x177574[_0x9ad2('0x37')][_0x9ad2('0x46')]){_0x2e998a[_0x9ad2('0x47')]=[{'all':!![]}];}_0x2e998a=_[_0x9ad2('0x43')]({},_0x2e998a,_0x177574[_0x9ad2('0x45')]);return db[_0x9ad2('0x32')][_0x9ad2('0x4d')](_0x2e998a)[_0x9ad2('0x28')](handleEntityNotFound(_0x227277,null))[_0x9ad2('0x28')](respondWithResult(_0x227277,null))['catch'](handleError(_0x227277,null));};exports[_0x9ad2('0x4e')]=function(_0x54fcd5,_0x496195){return db[_0x9ad2('0x32')][_0x9ad2('0x4e')](_0x54fcd5['body'],{})['then'](function(_0x2ba9b4){var _0x50d60e=_0x54fcd5['user'][_0x9ad2('0x2a')]({'plain':!![]});if(!_0x50d60e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50d60e[_0x9ad2('0x4f')]===_0x9ad2('0x50')){var _0x369eb6=_0x2ba9b4[_0x9ad2('0x2a')]({'plain':!![]});var _0xf56a79='Reports';return db['UserProfileSection'][_0x9ad2('0x4d')]({'where':{'name':_0xf56a79,'userProfileId':_0x50d60e[_0x9ad2('0x51')]},'raw':!![]})[_0x9ad2('0x28')](function(_0x100268){if(_0x100268&&_0x100268[_0x9ad2('0x52')]===0x0){return db[_0x9ad2('0x2b')][_0x9ad2('0x4e')]({'name':_0x369eb6[_0x9ad2('0x2f')],'resourceId':_0x369eb6['id'],'type':'CustomReports','sectionId':_0x100268['id']},{})[_0x9ad2('0x28')](function(){return _0x2ba9b4;});}else{return _0x2ba9b4;}})[_0x9ad2('0x49')](function(_0x2d2e7e){logger['error'](_0x9ad2('0x53'),_0x2d2e7e);throw _0x2d2e7e;});}return _0x2ba9b4;})[_0x9ad2('0x28')](respondWithResult(_0x496195,0xc9))['catch'](handleError(_0x496195,null));};exports[_0x9ad2('0x27')]=function(_0xbf7c67,_0x1fe9df){if(_0xbf7c67[_0x9ad2('0x54')]['id']){delete _0xbf7c67['body']['id'];}return db[_0x9ad2('0x32')]['find']({'where':{'id':_0xbf7c67[_0x9ad2('0x4b')]['id']}})[_0x9ad2('0x28')](handleEntityNotFound(_0x1fe9df,null))['then'](saveUpdates(_0xbf7c67[_0x9ad2('0x54')],null))[_0x9ad2('0x28')](respondWithResult(_0x1fe9df,null))['catch'](handleError(_0x1fe9df,null));};exports[_0x9ad2('0x29')]=function(_0x4b34fc,_0x50ef77){return db['AnalyticCustomReport']['find']({'where':{'id':_0x4b34fc[_0x9ad2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x50ef77,null))['then'](removeEntity(_0x50ef77,null))[_0x9ad2('0x49')](handleError(_0x50ef77,null));};exports[_0x9ad2('0x55')]=function(_0x56e475,_0x1caa39){var _0x291751=0xa;var _0x5317f1=['join',_0x9ad2('0x56'),_0x9ad2('0x57'),_0x9ad2('0x58')];var _0x586644={'SUM':_0x9ad2('0x59'),'COUNT':_0x9ad2('0x5a'),'COUNT DISTINCT':_0x9ad2('0x5b'),'MAX':_0x9ad2('0x5c'),'MIN':'MIN(%s)','AVG':_0x9ad2('0x5d'),'GROUP_CONCAT':_0x9ad2('0x5e'),'GROUP_CONCAT ASC':_0x9ad2('0x5f'),'GROUP_CONCAT DESC':_0x9ad2('0x60')};var _0x591f57={'SEC_TO_TIME':_0x9ad2('0x61'),'DATE':_0x9ad2('0x62'),'HOUR':_0x9ad2('0x63'),'ROUND':_0x9ad2('0x64'),'UNIX_TIMESTAMP':_0x9ad2('0x65')};var _0x348cf5=function(_0x5c0592){return!_[_0x9ad2('0x66')]([_0x9ad2('0x67'),'IS\x20NOT\x20NULL',_0x9ad2('0x68'),_0x9ad2('0x69')],_0x5c0592);};var _0x29d986=function(_0xfdbf5d){if(!_0xfdbf5d||!_0xfdbf5d[_0x9ad2('0x6a')][_0x9ad2('0x4c')]){return'';}for(var _0x49ae0f='(',_0x5eec8c=0x0;_0x5eec8c<_0xfdbf5d['rules'][_0x9ad2('0x4c')];_0x5eec8c+=0x1){_0x5eec8c>0x0&&(_0x49ae0f+='\x20'+_0xfdbf5d['operator']+'\x20');_0x49ae0f+=_0xfdbf5d[_0x9ad2('0x6a')][_0x5eec8c][_0x9ad2('0x6b')]?_0x29d986(_0xfdbf5d[_0x9ad2('0x6a')][_0x5eec8c][_0x9ad2('0x6b')]):_0xfdbf5d[_0x9ad2('0x6a')][_0x5eec8c]['field']+'\x20'+_0xfdbf5d[_0x9ad2('0x6a')][_0x5eec8c][_0x9ad2('0x6c')]+(_0x348cf5(_0xfdbf5d['rules'][_0x5eec8c][_0x9ad2('0x6c')])?'\x20'+_0xfdbf5d['rules'][_0x5eec8c][_0x9ad2('0x6d')]:'');}return _0x49ae0f+')';};var _0x1fef2a={'where':{'id':_0x56e475[_0x9ad2('0x4b')]['id']}},_0x1dd7ea,_0x577f75,_0x47cb97,_0x4931b4,_0xc836d6;_0x1fef2a=_[_0x9ad2('0x43')]({},_0x1fef2a,_0x56e475['options']);return db['AnalyticCustomReport'][_0x9ad2('0x4d')](_0x1fef2a)[_0x9ad2('0x28')](function(_0x17d3e1){if(_0x17d3e1){_0x1dd7ea=_0x17d3e1;return _0x17d3e1[_0x9ad2('0x6e')]();}return null;})[_0x9ad2('0x28')](function(_0x6eac2c){if(_0x6eac2c){if(!_0x6eac2c['length']){throw new db[(_0x9ad2('0x6f'))][(_0x9ad2('0x70'))](_0x9ad2('0x71'),0x193);}_0x577f75=_0x6eac2c;return db[_0x9ad2('0x72')][_0x9ad2('0x73')]({'raw':!![]});}return null;})[_0x9ad2('0x28')](function(_0x3e7c17){if(_0x3e7c17){_0x47cb97=_[_0x9ad2('0x74')](_0x3e7c17,'id');var _0x30aa7b;var _0x461fec=squel[_0x9ad2('0x75')]();_0x461fec['from'](_0x1dd7ea[_0x9ad2('0x76')]);for(var _0x3520a7=0x0;_0x3520a7<_0x577f75[_0x9ad2('0x4c')];_0x3520a7+=0x1){_0x30aa7b=_0x577f75[_0x3520a7][_0x9ad2('0x77')]?_0x47cb97[_0x577f75[_0x3520a7][_0x9ad2('0x77')]]['metric']:_0x577f75[_0x3520a7][_0x9ad2('0x78')];_0x30aa7b=_0x577f75[_0x3520a7][_0x9ad2('0x79')]?_[_0x9ad2('0x7a')](_0x586644[_0x577f75[_0x3520a7][_0x9ad2('0x79')]],'%s',_0x30aa7b):_0x30aa7b;_0x30aa7b=_0x577f75[_0x3520a7]['format']?_[_0x9ad2('0x7a')](_0x591f57[_0x577f75[_0x3520a7]['format']],'%s',_0x30aa7b):_0x30aa7b;if(_0x577f75[_0x3520a7]['groupBy']){_0x461fec[_0x9ad2('0x6b')](_0x30aa7b);}_0x577f75[_0x3520a7][_0x9ad2('0x7b')]&&_0x461fec['order'](_0x30aa7b,_0x577f75[_0x3520a7][_0x9ad2('0x7b')]===_0x9ad2('0x7c')?![]:!![]);_0x461fec[_0x9ad2('0x78')](_0x30aa7b,_0x577f75[_0x3520a7]['alias']||_0x30aa7b);}if(_0x1dd7ea[_0x9ad2('0x7d')]){_0x1dd7ea[_0x9ad2('0x7d')]=JSON[_0x9ad2('0x7e')](_0x1dd7ea[_0x9ad2('0x7d')]);for(var _0x31057f=0x0;_0x31057f<_0x1dd7ea['joins']['length'];_0x31057f+=0x1){if(_0x1dd7ea[_0x9ad2('0x7d')][_0x31057f][_0x9ad2('0x34')]&&_[_0x9ad2('0x66')](_0x5317f1,_0x1dd7ea[_0x9ad2('0x7d')][_0x31057f]['type'])&&_0x1dd7ea['joins'][_0x31057f][_0x9ad2('0x7f')]&&_0x1dd7ea['joins'][_0x31057f][_0x9ad2('0x80')]&&_0x1dd7ea[_0x9ad2('0x7d')][_0x31057f]['foreignKey']){_0x461fec[_0x1dd7ea[_0x9ad2('0x7d')][_0x31057f][_0x9ad2('0x34')]](_0x1dd7ea[_0x9ad2('0x7d')][_0x31057f][_0x9ad2('0x80')],null,util[_0x9ad2('0x81')]('%s.%s\x20=\x20%s.%s',_0x1dd7ea[_0x9ad2('0x76')],_0x1dd7ea['joins'][_0x31057f][_0x9ad2('0x7f')],_0x1dd7ea['joins'][_0x31057f][_0x9ad2('0x80')],_0x1dd7ea[_0x9ad2('0x7d')][_0x31057f]['foreignKey']));}}}if(_0x1dd7ea[_0x9ad2('0x82')]){_0x1dd7ea['conditions']=JSON[_0x9ad2('0x7e')](_0x1dd7ea[_0x9ad2('0x82')]);_0x461fec['where'](_0x29d986(_0x1dd7ea['conditions'][_0x9ad2('0x6b')]));}_0xc836d6=_0x461fec['clone']();_0x461fec['limit'](_0x291751);_0x461fec[_0x9ad2('0x1e')](0x0);logger['debug'](_0x9ad2('0x83'),_0x461fec[_0x9ad2('0x84')]());return dbH['sequelize']['query'](_0x461fec[_0x9ad2('0x84')](),{'type':dbH[_0x9ad2('0x85')]['QueryTypes']['SELECT']});}})[_0x9ad2('0x28')](respondWithResult(_0x1caa39,null))[_0x9ad2('0x49')](handleError(_0x1caa39,null));};function runReport(_0xa5d9da,_0x3d3eba,_0x5ac139){var _0x1824fc=_0x3d3eba[_0x9ad2('0x2f')];var _0xba7ecd=0xa;var _0x5cc2c7=[_0x9ad2('0x86'),_0x9ad2('0x56'),_0x9ad2('0x57'),_0x9ad2('0x58')];var _0x30bdb9={'SUM':_0x9ad2('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9ad2('0x5b'),'MAX':_0x9ad2('0x5c'),'MIN':_0x9ad2('0x87'),'AVG':_0x9ad2('0x5d'),'GROUP_CONCAT':_0x9ad2('0x5e'),'GROUP_CONCAT ASC':_0x9ad2('0x5f'),'GROUP_CONCAT DESC':_0x9ad2('0x60')};var _0x5cc9fa={'SEC_TO_TIME':_0x9ad2('0x61'),'DATE':_0x9ad2('0x62'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x273b54=function(_0x39838a){return!_[_0x9ad2('0x66')]([_0x9ad2('0x67'),_0x9ad2('0x88'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x39838a);};var _0xe83c93=function(_0x3f7021){if(!_0x3f7021||!_0x3f7021[_0x9ad2('0x6a')][_0x9ad2('0x4c')]){return'';}for(var _0x4b88b2='(',_0x42f1cc=0x0;_0x42f1cc<_0x3f7021['rules'][_0x9ad2('0x4c')];_0x42f1cc+=0x1){_0x42f1cc>0x0&&(_0x4b88b2+='\x20'+_0x3f7021[_0x9ad2('0x89')]+'\x20');_0x4b88b2+=_0x3f7021['rules'][_0x42f1cc][_0x9ad2('0x6b')]?_0xe83c93(_0x3f7021[_0x9ad2('0x6a')][_0x42f1cc][_0x9ad2('0x6b')]):_0x3f7021[_0x9ad2('0x6a')][_0x42f1cc][_0x9ad2('0x78')]+'\x20'+_0x3f7021[_0x9ad2('0x6a')][_0x42f1cc][_0x9ad2('0x6c')]+(_0x273b54(_0x3f7021[_0x9ad2('0x6a')][_0x42f1cc][_0x9ad2('0x6c')])?'\x20'+_0x3f7021[_0x9ad2('0x6a')][_0x42f1cc]['value']:'');}return _0x4b88b2+')';};var _0x452830={'where':{'id':_0xa5d9da['id']}},_0x5aa3f2,_0x525bfd,_0x37f0ae,_0x1a66f9,_0x34d254;_0x452830=_[_0x9ad2('0x43')]({},_0x452830,_0x5ac139);return db['AnalyticCustomReport'][_0x9ad2('0x4d')](_0x452830)['then'](function(_0x14f85f){if(_0x14f85f){_0x5aa3f2=_0x14f85f;return _0x14f85f[_0x9ad2('0x6e')]();}return null;})[_0x9ad2('0x28')](function(_0x4cfc9f){if(_0x4cfc9f){if(!_0x4cfc9f[_0x9ad2('0x4c')]){throw new db[(_0x9ad2('0x6f'))][(_0x9ad2('0x70'))](_0x9ad2('0x71'),0x193);}_0x525bfd=_0x4cfc9f;return db[_0x9ad2('0x72')][_0x9ad2('0x73')]({'raw':!![]});}return null;})[_0x9ad2('0x28')](function(_0x3fb1bb){if(_0x3fb1bb){_0x37f0ae=_[_0x9ad2('0x74')](_0x3fb1bb,'id');var _0x2f3a59;var _0x51deab=squel[_0x9ad2('0x75')]();_0x51deab[_0x9ad2('0x8a')](_0x5aa3f2[_0x9ad2('0x76')]);for(var _0x391fe9=0x0;_0x391fe9<_0x525bfd[_0x9ad2('0x4c')];_0x391fe9+=0x1){_0x2f3a59=_0x525bfd[_0x391fe9][_0x9ad2('0x77')]?_0x37f0ae[_0x525bfd[_0x391fe9][_0x9ad2('0x77')]][_0x9ad2('0x8b')]:_0x525bfd[_0x391fe9][_0x9ad2('0x78')];_0x2f3a59=_0x525bfd[_0x391fe9][_0x9ad2('0x79')]?_[_0x9ad2('0x7a')](_0x30bdb9[_0x525bfd[_0x391fe9][_0x9ad2('0x79')]],'%s',_0x2f3a59):_0x2f3a59;_0x2f3a59=_0x525bfd[_0x391fe9][_0x9ad2('0x81')]?_[_0x9ad2('0x7a')](_0x5cc9fa[_0x525bfd[_0x391fe9][_0x9ad2('0x81')]],'%s',_0x2f3a59):_0x2f3a59;if(_0x525bfd[_0x391fe9][_0x9ad2('0x8c')]){_0x51deab[_0x9ad2('0x6b')](_0x2f3a59);}_0x525bfd[_0x391fe9][_0x9ad2('0x7b')]&&_0x51deab[_0x9ad2('0x3e')](_0x2f3a59,_0x525bfd[_0x391fe9][_0x9ad2('0x7b')]==='DESC'?![]:!![]);_0x51deab[_0x9ad2('0x78')](_0x2f3a59,_0x525bfd[_0x391fe9]['alias']||_0x2f3a59);}if(_0x5aa3f2[_0x9ad2('0x7d')]){_0x5aa3f2[_0x9ad2('0x7d')]=JSON[_0x9ad2('0x7e')](_0x5aa3f2[_0x9ad2('0x7d')]);for(var _0xb5f6ac=0x0;_0xb5f6ac<_0x5aa3f2['joins'][_0x9ad2('0x4c')];_0xb5f6ac+=0x1){if(_0x5aa3f2[_0x9ad2('0x7d')][_0xb5f6ac][_0x9ad2('0x34')]&&_[_0x9ad2('0x66')](_0x5cc2c7,_0x5aa3f2[_0x9ad2('0x7d')][_0xb5f6ac][_0x9ad2('0x34')])&&_0x5aa3f2[_0x9ad2('0x7d')][_0xb5f6ac][_0x9ad2('0x7f')]&&_0x5aa3f2[_0x9ad2('0x7d')][_0xb5f6ac]['foreignTable']&&_0x5aa3f2[_0x9ad2('0x7d')][_0xb5f6ac][_0x9ad2('0x8d')]){_0x51deab[_0x5aa3f2[_0x9ad2('0x7d')][_0xb5f6ac][_0x9ad2('0x34')]](_0x5aa3f2['joins'][_0xb5f6ac]['foreignTable'],null,util['format'](_0x9ad2('0x8e'),_0x5aa3f2[_0x9ad2('0x76')],_0x5aa3f2['joins'][_0xb5f6ac][_0x9ad2('0x7f')],_0x5aa3f2[_0x9ad2('0x7d')][_0xb5f6ac][_0x9ad2('0x80')],_0x5aa3f2[_0x9ad2('0x7d')][_0xb5f6ac][_0x9ad2('0x8d')]));}}}if(_0x5aa3f2[_0x9ad2('0x82')]){_0x5aa3f2['conditions']=JSON['parse'](_0x5aa3f2[_0x9ad2('0x82')]);_0x51deab[_0x9ad2('0x40')](_0xe83c93(_0x5aa3f2[_0x9ad2('0x82')][_0x9ad2('0x6b')]));}_0x34d254=_0x51deab[_0x9ad2('0x8f')]();_0x51deab[_0x9ad2('0x21')](_0xba7ecd);_0x51deab['offset'](0x0);return;}})[_0x9ad2('0x28')](function(){if(_0x3d3eba[_0x9ad2('0x90')]===_0x9ad2('0x91')){return null;}var _0x13df48=_[_0x9ad2('0x43')](_0x3d3eba,{'name':_0x3d3eba['fullPath']||_0x3d3eba[_0x9ad2('0x2f')]||_0x5aa3f2[_0x9ad2('0x2f')],'basename':_0x1824fc,'savename':util[_0x9ad2('0x81')]('%s-%s.%s',_0x3d3eba['name']||_0x5aa3f2['name'],require(_0x9ad2('0x92'))[_0x9ad2('0x93')](0x4),_0x3d3eba['output']||_0x9ad2('0x94')),'reportId':_0x5aa3f2['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x9ad2('0x4e')](_0x13df48,{'raw':!![]});})[_0x9ad2('0x28')](function(_0x1c1069){if(_0x5aa3f2[_0x9ad2('0x76')]===_0x9ad2('0x95')){_0x34d254[_0x9ad2('0x40')](_0x5aa3f2[_0x9ad2('0x76')]+_0x9ad2('0x96'),_0x3d3eba['startDate'],_0x3d3eba[_0x9ad2('0x97')]);}else{_0x34d254[_0x9ad2('0x40')](_0x5aa3f2[_0x9ad2('0x76')]+_0x9ad2('0x98'),_0x3d3eba[_0x9ad2('0x99')],_0x3d3eba[_0x9ad2('0x97')]);}if(_0x1c1069){logger[_0x9ad2('0x9a')](_0x9ad2('0x9b'),_0x34d254[_0x9ad2('0x84')]());require('child_process')[_0x9ad2('0x9c')](path[_0x9ad2('0x86')](__dirname,_0x9ad2('0x9d'),_0x1c1069[_0x9ad2('0x90')]),[_0x1c1069['id'],_0x34d254['toString'](),path[_0x9ad2('0x86')](__dirname,'../../files/reports',_0x1c1069[_0x9ad2('0x9e')]),_0x1824fc]);return _0x1c1069;}else{var _0x5d2ba0=squel[_0x9ad2('0x75')]();_0x5d2ba0[_0x9ad2('0x8a')]('('+_0x34d254['toString']()+')',_0x9ad2('0x9f'));_0x5d2ba0['field'](_0x9ad2('0xa0'),_0x9ad2('0x20'));_0x34d254[_0x9ad2('0x21')](_0x3d3eba['limit']||_0xba7ecd);_0x34d254[_0x9ad2('0x1e')](_0x3d3eba[_0x9ad2('0x1e')]||0x0);return dbH[_0x9ad2('0x85')][_0x9ad2('0x37')](_0x5d2ba0[_0x9ad2('0x84')](),{'type':dbH[_0x9ad2('0x85')][_0x9ad2('0xa1')][_0x9ad2('0xa2')]})[_0x9ad2('0x28')](function(_0x3bc117){if(!_0x3bc117[_0x9ad2('0x4c')]){_0x1a66f9=0x0;}else{_0x1a66f9=_0x3bc117[0x0]['count']||0x0;}return dbH[_0x9ad2('0x85')][_0x9ad2('0x37')](_0x34d254['toString'](),{'type':dbH[_0x9ad2('0x85')][_0x9ad2('0xa1')][_0x9ad2('0xa2')]});})[_0x9ad2('0x28')](function(_0x2a92b9){return{'rows':_0x2a92b9||[],'count':_0x1a66f9};});}});}exports['run']=function(_0x21a8a7,_0x12ef0a){return runReport(_0x21a8a7[_0x9ad2('0x4b')],_0x21a8a7['query'],_0x21a8a7[_0x9ad2('0x45')])['then'](respondWithResult(_0x12ef0a,null))['catch'](handleError(_0x12ef0a,null));};exports[_0x9ad2('0xa3')]=runReport;exports[_0x9ad2('0x37')]=function(_0x5cc133,_0x4b6b44){var _0x109a09=0xa;var _0x491e59=['join',_0x9ad2('0x56'),_0x9ad2('0x57'),_0x9ad2('0x58')];var _0x17b660={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9ad2('0x5b'),'MAX':_0x9ad2('0x5c'),'MIN':_0x9ad2('0x87'),'AVG':_0x9ad2('0x5d'),'GROUP_CONCAT':_0x9ad2('0x5e'),'GROUP_CONCAT ASC':_0x9ad2('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2d612b={'SEC_TO_TIME':_0x9ad2('0x61'),'DATE':_0x9ad2('0x62'),'HOUR':_0x9ad2('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9ad2('0x65')};var _0x59c25e=function(_0x73ca1c){return!_[_0x9ad2('0x66')]([_0x9ad2('0x67'),_0x9ad2('0x88'),_0x9ad2('0x68'),'IS\x20NOT\x20EMPTY'],_0x73ca1c);};var _0x510fd4=function(_0x570f95){if(!_0x570f95||!_0x570f95[_0x9ad2('0x6a')][_0x9ad2('0x4c')]){return'';}for(var _0x456385='(',_0x4a6507=0x0;_0x4a6507<_0x570f95[_0x9ad2('0x6a')]['length'];_0x4a6507+=0x1){_0x4a6507>0x0&&(_0x456385+='\x20'+_0x570f95[_0x9ad2('0x89')]+'\x20');_0x456385+=_0x570f95[_0x9ad2('0x6a')][_0x4a6507]['group']?_0x510fd4(_0x570f95[_0x9ad2('0x6a')][_0x4a6507][_0x9ad2('0x6b')]):_0x570f95[_0x9ad2('0x6a')][_0x4a6507][_0x9ad2('0x78')]+'\x20'+_0x570f95[_0x9ad2('0x6a')][_0x4a6507][_0x9ad2('0x6c')]+(_0x59c25e(_0x570f95[_0x9ad2('0x6a')][_0x4a6507][_0x9ad2('0x6c')])?'\x20'+_0x570f95[_0x9ad2('0x6a')][_0x4a6507][_0x9ad2('0x6d')]:'');}return _0x456385+')';};var _0x3408a1={'where':{'id':_0x5cc133[_0x9ad2('0x4b')]['id']}},_0x23e48e,_0x118923,_0x38137d,_0x5c237f,_0x5baff0;_0x3408a1=_[_0x9ad2('0x43')]({},_0x3408a1,_0x5cc133['options']);return db[_0x9ad2('0x32')][_0x9ad2('0x4d')](_0x3408a1)[_0x9ad2('0x28')](function(_0xeda0b6){if(_0xeda0b6){_0x23e48e=_0xeda0b6;return _0xeda0b6[_0x9ad2('0x6e')]();}return null;})[_0x9ad2('0x28')](function(_0x435f68){if(_0x435f68){if(!_0x435f68[_0x9ad2('0x4c')]){throw new db[(_0x9ad2('0x6f'))][(_0x9ad2('0x70'))](_0x9ad2('0x71'),0x193);}_0x118923=_0x435f68;return db[_0x9ad2('0x72')][_0x9ad2('0x73')]({'raw':!![]});}return null;})[_0x9ad2('0x28')](function(_0x4321a0){if(_0x4321a0){_0x38137d=_[_0x9ad2('0x74')](_0x4321a0,'id');var _0x206d11;var _0x2d5535=squel[_0x9ad2('0x75')]();_0x2d5535[_0x9ad2('0x8a')](_0x23e48e[_0x9ad2('0x76')]);for(var _0x3ab70a=0x0;_0x3ab70a<_0x118923[_0x9ad2('0x4c')];_0x3ab70a+=0x1){_0x206d11=_0x118923[_0x3ab70a][_0x9ad2('0x77')]?_0x38137d[_0x118923[_0x3ab70a][_0x9ad2('0x77')]][_0x9ad2('0x8b')]:_0x118923[_0x3ab70a][_0x9ad2('0x78')];_0x206d11=_0x118923[_0x3ab70a][_0x9ad2('0x79')]?_['replace'](_0x17b660[_0x118923[_0x3ab70a][_0x9ad2('0x79')]],'%s',_0x206d11):_0x206d11;_0x206d11=_0x118923[_0x3ab70a][_0x9ad2('0x81')]?_[_0x9ad2('0x7a')](_0x2d612b[_0x118923[_0x3ab70a][_0x9ad2('0x81')]],'%s',_0x206d11):_0x206d11;if(_0x118923[_0x3ab70a][_0x9ad2('0x8c')]){_0x2d5535[_0x9ad2('0x6b')](_0x206d11);}_0x118923[_0x3ab70a][_0x9ad2('0x7b')]&&_0x2d5535['order'](_0x206d11,_0x118923[_0x3ab70a][_0x9ad2('0x7b')]===_0x9ad2('0x7c')?![]:!![]);_0x2d5535['field'](_0x206d11,_0x118923[_0x3ab70a][_0x9ad2('0xa4')]||_0x206d11);}if(_0x23e48e[_0x9ad2('0x7d')]){_0x23e48e[_0x9ad2('0x7d')]=JSON[_0x9ad2('0x7e')](_0x23e48e[_0x9ad2('0x7d')]);for(var _0x25093a=0x0;_0x25093a<_0x23e48e[_0x9ad2('0x7d')][_0x9ad2('0x4c')];_0x25093a+=0x1){if(_0x23e48e[_0x9ad2('0x7d')][_0x25093a][_0x9ad2('0x34')]&&_[_0x9ad2('0x66')](_0x491e59,_0x23e48e[_0x9ad2('0x7d')][_0x25093a][_0x9ad2('0x34')])&&_0x23e48e[_0x9ad2('0x7d')][_0x25093a][_0x9ad2('0x7f')]&&_0x23e48e[_0x9ad2('0x7d')][_0x25093a][_0x9ad2('0x80')]&&_0x23e48e['joins'][_0x25093a][_0x9ad2('0x8d')]){_0x2d5535[_0x23e48e[_0x9ad2('0x7d')][_0x25093a][_0x9ad2('0x34')]](_0x23e48e[_0x9ad2('0x7d')][_0x25093a][_0x9ad2('0x80')],null,util[_0x9ad2('0x81')](_0x9ad2('0x8e'),_0x23e48e[_0x9ad2('0x76')],_0x23e48e[_0x9ad2('0x7d')][_0x25093a][_0x9ad2('0x7f')],_0x23e48e[_0x9ad2('0x7d')][_0x25093a]['foreignTable'],_0x23e48e[_0x9ad2('0x7d')][_0x25093a]['foreignKey']));}}}if(_0x23e48e[_0x9ad2('0x82')]){_0x23e48e[_0x9ad2('0x82')]=JSON[_0x9ad2('0x7e')](_0x23e48e[_0x9ad2('0x82')]);_0x2d5535[_0x9ad2('0x40')](_0x510fd4(_0x23e48e[_0x9ad2('0x82')][_0x9ad2('0x6b')]));}_0x5baff0=_0x2d5535['clone']();_0x2d5535['limit'](_0x109a09);_0x2d5535['offset'](0x0);logger[_0x9ad2('0xa5')](_0x9ad2('0x83'),_0x2d5535[_0x9ad2('0x84')]());return dbH[_0x9ad2('0x85')][_0x9ad2('0x37')](_0x2d5535[_0x9ad2('0x84')](),{'type':dbH[_0x9ad2('0x85')][_0x9ad2('0xa1')][_0x9ad2('0xa2')]});}})[_0x9ad2('0x28')](function(){return{'sql':_0x5baff0[_0x9ad2('0x84')]()};})['then'](respondWithResult(_0x4b6b44,null))['catch'](handleError(_0x4b6b44,null));}; \ No newline at end of file +var _0xfc89=['UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','operator','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','clone','output','fullPath','%s-%s.%s','randomstring','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','savename','COUNT(*)','count','run','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','debug','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','dbH','sendStatus','status','undefined','offset','apply','reject','save','update','destroy','then','get','CustomReports','UserProfileResource','end','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','catch','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)'];(function(_0x156fa6,_0x5253ae){var _0x41e823=function(_0x467419){while(--_0x467419){_0x156fa6['push'](_0x156fa6['shift']());}};_0x41e823(++_0x5253ae);}(_0xfc89,0xe7));var _0x9fc8=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xfc89[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x9fc8('0x0'));var rimraf=require(_0x9fc8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fc8('0x2'));var rp=require(_0x9fc8('0x3'));var moment=require(_0x9fc8('0x4'));var BPromise=require(_0x9fc8('0x5'));var Mustache=require(_0x9fc8('0x6'));var util=require(_0x9fc8('0x7'));var path=require('path');var sox=require(_0x9fc8('0x8'));var csv=require(_0x9fc8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9fc8('0xa'));var _=require(_0x9fc8('0xb'));var squel=require('squel');var crypto=require(_0x9fc8('0xc'));var jsforce=require(_0x9fc8('0xd'));var deskjs=require(_0x9fc8('0xe'));var toCsv=require(_0x9fc8('0x9'));var querystring=require(_0x9fc8('0xf'));var Papa=require(_0x9fc8('0x10'));var Redis=require(_0x9fc8('0x11'));var authService=require(_0x9fc8('0x12'));var qs=require(_0x9fc8('0x13'));var as=require(_0x9fc8('0x14'));var hardwareService=require(_0x9fc8('0x15'));var logger=require(_0x9fc8('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9fc8('0x17'))['db'];var dbH=require('../../mysqldb')[_0x9fc8('0x18')];function respondWithStatusCode(_0x4a12e9,_0x57180e){_0x57180e=_0x57180e||0xcc;return function(_0x539c77){if(_0x539c77){return _0x4a12e9[_0x9fc8('0x19')](_0x57180e);}return _0x4a12e9['status'](_0x57180e)['end']();};}function respondWithResult(_0x4fcb20,_0x4f61c5){_0x4f61c5=_0x4f61c5||0xc8;return function(_0x21e53b){if(_0x21e53b){return _0x4fcb20[_0x9fc8('0x1a')](_0x4f61c5)['json'](_0x21e53b);}};}function respondWithFilteredResult(_0x2e8edf,_0x3aab13){return function(_0x43651d){if(_0x43651d){var _0x379f55=typeof _0x3aab13['offset']===_0x9fc8('0x1b')&&typeof _0x3aab13['limit']===_0x9fc8('0x1b');var _0x5acc48=_0x43651d['count'];var _0x1dbc85=_0x379f55?0x0:_0x3aab13['offset'];var _0x41081a=_0x379f55?_0x43651d['count']:_0x3aab13[_0x9fc8('0x1c')]+_0x3aab13['limit'];var _0xe103da;if(_0x41081a>=_0x5acc48){_0x41081a=_0x5acc48;_0xe103da=0xc8;}else{_0xe103da=0xce;}_0x2e8edf[_0x9fc8('0x1a')](_0xe103da);return _0x2e8edf['set']('Content-Range',_0x1dbc85+'-'+_0x41081a+'/'+_0x5acc48)['json'](_0x43651d);}return null;};}function patchUpdates(_0x3172aa){return function(_0x11da49){try{jsonpatch[_0x9fc8('0x1d')](_0x11da49,_0x3172aa,!![]);}catch(_0x4687b6){return BPromise[_0x9fc8('0x1e')](_0x4687b6);}return _0x11da49[_0x9fc8('0x1f')]();};}function saveUpdates(_0x82622b,_0x49fd2b){return function(_0x2e4487){if(_0x2e4487){return _0x2e4487[_0x9fc8('0x20')](_0x82622b)['then'](function(_0x29747f){return _0x29747f;});}return null;};}function removeEntity(_0x2d2880,_0x138335){return function(_0x41763b){if(_0x41763b){return _0x41763b[_0x9fc8('0x21')]()[_0x9fc8('0x22')](function(){var _0x4d5195=_0x41763b[_0x9fc8('0x23')]({'plain':!![]});var _0xc14861=_0x9fc8('0x24');return db[_0x9fc8('0x25')][_0x9fc8('0x21')]({'where':{'type':_0xc14861,'resourceId':_0x4d5195['id']}})['then'](function(){return _0x41763b;});})[_0x9fc8('0x22')](function(){_0x2d2880['status'](0xcc)[_0x9fc8('0x26')]();});}};}function handleEntityNotFound(_0x134c91,_0x354ea6){return function(_0x446ade){if(!_0x446ade){_0x134c91[_0x9fc8('0x19')](0x194);}return _0x446ade;};}function handleError(_0x5ee2f1,_0x24470d){_0x24470d=_0x24470d||0x1f4;return function(_0x1506b6){logger[_0x9fc8('0x27')](_0x1506b6[_0x9fc8('0x28')]);if(_0x1506b6[_0x9fc8('0x29')]){delete _0x1506b6[_0x9fc8('0x29')];}_0x5ee2f1['status'](_0x24470d)[_0x9fc8('0x2a')](_0x1506b6);};}exports[_0x9fc8('0x2b')]=function(_0xfe2d84,_0x8cf59b){var _0x20319e={},_0x1c51f9={},_0x4dedda={'count':0x0,'rows':[]};var _0x81acaa=_[_0x9fc8('0x2c')](db[_0x9fc8('0x2d')][_0x9fc8('0x2e')],function(_0x14fdb1){return{'name':_0x14fdb1['fieldName'],'type':_0x14fdb1[_0x9fc8('0x2f')][_0x9fc8('0x30')]};});_0x1c51f9['model']=_['map'](_0x81acaa,_0x9fc8('0x29'));_0x1c51f9['query']=_[_0x9fc8('0x31')](_0xfe2d84[_0x9fc8('0x32')]);_0x1c51f9[_0x9fc8('0x33')]=_['intersection'](_0x1c51f9[_0x9fc8('0x34')],_0x1c51f9['query']);_0x20319e[_0x9fc8('0x35')]=_[_0x9fc8('0x36')](_0x1c51f9[_0x9fc8('0x34')],qs[_0x9fc8('0x37')](_0xfe2d84[_0x9fc8('0x32')][_0x9fc8('0x37')]));_0x20319e[_0x9fc8('0x35')]=_0x20319e['attributes'][_0x9fc8('0x38')]?_0x20319e[_0x9fc8('0x35')]:_0x1c51f9['model'];if(!_0xfe2d84[_0x9fc8('0x32')][_0x9fc8('0x39')](_0x9fc8('0x3a'))){_0x20319e[_0x9fc8('0x3b')]=qs[_0x9fc8('0x3b')](_0xfe2d84['query']['limit']);_0x20319e[_0x9fc8('0x1c')]=qs[_0x9fc8('0x1c')](_0xfe2d84[_0x9fc8('0x32')][_0x9fc8('0x1c')]);}_0x20319e[_0x9fc8('0x3c')]=qs[_0x9fc8('0x3d')](_0xfe2d84[_0x9fc8('0x32')][_0x9fc8('0x3d')]);_0x20319e[_0x9fc8('0x3e')]=qs[_0x9fc8('0x33')](_[_0x9fc8('0x3f')](_0xfe2d84[_0x9fc8('0x32')],_0x1c51f9[_0x9fc8('0x33')]),_0x81acaa);if(_0xfe2d84[_0x9fc8('0x32')][_0x9fc8('0x40')]){_0x20319e[_0x9fc8('0x3e')]=_[_0x9fc8('0x41')](_0x20319e[_0x9fc8('0x3e')],{'$or':_[_0x9fc8('0x2c')](_0x81acaa,function(_0x1e6ff2){if(_0x1e6ff2[_0x9fc8('0x2f')]!==_0x9fc8('0x42')){var _0x171e45={};_0x171e45[_0x1e6ff2[_0x9fc8('0x29')]]={'$like':'%'+_0xfe2d84[_0x9fc8('0x32')][_0x9fc8('0x40')]+'%'};return _0x171e45;}})});}_0x20319e=_[_0x9fc8('0x41')]({},_0x20319e,_0xfe2d84['options']);var _0x34c2aa={'where':_0x20319e[_0x9fc8('0x3e')]};return db[_0x9fc8('0x2d')]['count'](_0x34c2aa)[_0x9fc8('0x22')](function(_0x39364c){_0x4dedda['count']=_0x39364c;if(_0xfe2d84[_0x9fc8('0x32')][_0x9fc8('0x43')]){_0x20319e[_0x9fc8('0x44')]=[{'all':!![]}];}return db[_0x9fc8('0x2d')][_0x9fc8('0x45')](_0x20319e);})[_0x9fc8('0x22')](function(_0x26b3ed){_0x4dedda[_0x9fc8('0x46')]=_0x26b3ed;return _0x4dedda;})['then'](respondWithFilteredResult(_0x8cf59b,_0x20319e))['catch'](handleError(_0x8cf59b,null));};exports[_0x9fc8('0x47')]=function(_0x16289d,_0x5654a8){var _0x7b85c3={'raw':![],'where':{'id':_0x16289d['params']['id']}},_0x10d89e={};_0x10d89e[_0x9fc8('0x34')]=_['keys'](db[_0x9fc8('0x2d')][_0x9fc8('0x2e')]);_0x10d89e['query']=_[_0x9fc8('0x31')](_0x16289d[_0x9fc8('0x32')]);_0x10d89e[_0x9fc8('0x33')]=_[_0x9fc8('0x36')](_0x10d89e[_0x9fc8('0x34')],_0x10d89e[_0x9fc8('0x32')]);_0x7b85c3[_0x9fc8('0x35')]=_['intersection'](_0x10d89e[_0x9fc8('0x34')],qs[_0x9fc8('0x37')](_0x16289d[_0x9fc8('0x32')][_0x9fc8('0x37')]));_0x7b85c3[_0x9fc8('0x35')]=_0x7b85c3[_0x9fc8('0x35')][_0x9fc8('0x38')]?_0x7b85c3[_0x9fc8('0x35')]:_0x10d89e[_0x9fc8('0x34')];if(_0x16289d[_0x9fc8('0x32')][_0x9fc8('0x43')]){_0x7b85c3[_0x9fc8('0x44')]=[{'all':!![]}];}_0x7b85c3=_[_0x9fc8('0x41')]({},_0x7b85c3,_0x16289d[_0x9fc8('0x48')]);return db[_0x9fc8('0x2d')][_0x9fc8('0x49')](_0x7b85c3)[_0x9fc8('0x22')](handleEntityNotFound(_0x5654a8,null))['then'](respondWithResult(_0x5654a8,null))['catch'](handleError(_0x5654a8,null));};exports[_0x9fc8('0x4a')]=function(_0x48b6ba,_0x102544){return db[_0x9fc8('0x2d')][_0x9fc8('0x4a')](_0x48b6ba['body'],{})[_0x9fc8('0x22')](function(_0x3819bf){var _0x135b5d=_0x48b6ba['user']['get']({'plain':!![]});if(!_0x135b5d)throw new Error(_0x9fc8('0x4b'));if(_0x135b5d[_0x9fc8('0x4c')]===_0x9fc8('0x4d')){var _0x1cc0d2=_0x3819bf[_0x9fc8('0x23')]({'plain':!![]});var _0x4e60a3=_0x9fc8('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x4e60a3,'userProfileId':_0x135b5d[_0x9fc8('0x4f')]},'raw':!![]})['then'](function(_0x101139){if(_0x101139&&_0x101139[_0x9fc8('0x50')]===0x0){return db[_0x9fc8('0x25')]['create']({'name':_0x1cc0d2[_0x9fc8('0x29')],'resourceId':_0x1cc0d2['id'],'type':_0x9fc8('0x24'),'sectionId':_0x101139['id']},{})[_0x9fc8('0x22')](function(){return _0x3819bf;});}else{return _0x3819bf;}})['catch'](function(_0x34589e){logger['error'](_0x9fc8('0x51'),_0x34589e);throw _0x34589e;});}return _0x3819bf;})['then'](respondWithResult(_0x102544,0xc9))['catch'](handleError(_0x102544,null));};exports[_0x9fc8('0x20')]=function(_0x5269be,_0x581476){if(_0x5269be[_0x9fc8('0x52')]['id']){delete _0x5269be[_0x9fc8('0x52')]['id'];}return db[_0x9fc8('0x2d')][_0x9fc8('0x49')]({'where':{'id':_0x5269be[_0x9fc8('0x53')]['id']}})[_0x9fc8('0x22')](handleEntityNotFound(_0x581476,null))[_0x9fc8('0x22')](saveUpdates(_0x5269be[_0x9fc8('0x52')],null))[_0x9fc8('0x22')](respondWithResult(_0x581476,null))[_0x9fc8('0x54')](handleError(_0x581476,null));};exports[_0x9fc8('0x21')]=function(_0x1b3add,_0x423843){return db[_0x9fc8('0x2d')][_0x9fc8('0x49')]({'where':{'id':_0x1b3add[_0x9fc8('0x53')]['id']}})[_0x9fc8('0x22')](handleEntityNotFound(_0x423843,null))['then'](removeEntity(_0x423843,null))['catch'](handleError(_0x423843,null));};exports['preview']=function(_0x164f9d,_0x125c7b){var _0x516fec=0xa;var _0x3a5940=[_0x9fc8('0x55'),_0x9fc8('0x56'),_0x9fc8('0x57'),_0x9fc8('0x58')];var _0x2c7354={'SUM':_0x9fc8('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9fc8('0x5a'),'MAX':_0x9fc8('0x5b'),'MIN':_0x9fc8('0x5c'),'AVG':_0x9fc8('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9fc8('0x5e')};var _0x5f3c00={'SEC_TO_TIME':_0x9fc8('0x5f'),'DATE':_0x9fc8('0x60'),'HOUR':_0x9fc8('0x61'),'ROUND':_0x9fc8('0x62'),'UNIX_TIMESTAMP':_0x9fc8('0x63')};var _0x4196ce=function(_0x413c00){return!_[_0x9fc8('0x64')]([_0x9fc8('0x65'),_0x9fc8('0x66'),_0x9fc8('0x67'),_0x9fc8('0x68')],_0x413c00);};var _0x2002b1=function(_0x6c1437){if(!_0x6c1437||!_0x6c1437[_0x9fc8('0x69')][_0x9fc8('0x38')]){return'';}for(var _0x54d21b='(',_0x7c6127=0x0;_0x7c6127<_0x6c1437[_0x9fc8('0x69')]['length'];_0x7c6127+=0x1){_0x7c6127>0x0&&(_0x54d21b+='\x20'+_0x6c1437['operator']+'\x20');_0x54d21b+=_0x6c1437[_0x9fc8('0x69')][_0x7c6127][_0x9fc8('0x6a')]?_0x2002b1(_0x6c1437[_0x9fc8('0x69')][_0x7c6127][_0x9fc8('0x6a')]):_0x6c1437[_0x9fc8('0x69')][_0x7c6127][_0x9fc8('0x6b')]+'\x20'+_0x6c1437[_0x9fc8('0x69')][_0x7c6127][_0x9fc8('0x6c')]+(_0x4196ce(_0x6c1437[_0x9fc8('0x69')][_0x7c6127][_0x9fc8('0x6c')])?'\x20'+_0x6c1437[_0x9fc8('0x69')][_0x7c6127][_0x9fc8('0x6d')]:'');}return _0x54d21b+')';};var _0x420de8={'where':{'id':_0x164f9d[_0x9fc8('0x53')]['id']}},_0x1800c2,_0x54678a,_0x49dc9f,_0x1899ce,_0x3b3168;_0x420de8=_[_0x9fc8('0x41')]({},_0x420de8,_0x164f9d['options']);return db['AnalyticCustomReport'][_0x9fc8('0x49')](_0x420de8)[_0x9fc8('0x22')](function(_0x101723){if(_0x101723){_0x1800c2=_0x101723;return _0x101723[_0x9fc8('0x6e')]();}return null;})[_0x9fc8('0x22')](function(_0x45cc61){if(_0x45cc61){if(!_0x45cc61[_0x9fc8('0x38')]){throw new db[(_0x9fc8('0x6f'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x54678a=_0x45cc61;return db[_0x9fc8('0x70')][_0x9fc8('0x45')]({'raw':!![]});}return null;})[_0x9fc8('0x22')](function(_0x513153){if(_0x513153){_0x49dc9f=_[_0x9fc8('0x71')](_0x513153,'id');var _0x5abe24;var _0xc08dc1=squel[_0x9fc8('0x72')]();_0xc08dc1[_0x9fc8('0x73')](_0x1800c2[_0x9fc8('0x74')]);for(var _0x228612=0x0;_0x228612<_0x54678a[_0x9fc8('0x38')];_0x228612+=0x1){_0x5abe24=_0x54678a[_0x228612][_0x9fc8('0x75')]?_0x49dc9f[_0x54678a[_0x228612][_0x9fc8('0x75')]][_0x9fc8('0x76')]:_0x54678a[_0x228612][_0x9fc8('0x6b')];_0x5abe24=_0x54678a[_0x228612][_0x9fc8('0x77')]?_[_0x9fc8('0x78')](_0x2c7354[_0x54678a[_0x228612]['function']],'%s',_0x5abe24):_0x5abe24;_0x5abe24=_0x54678a[_0x228612][_0x9fc8('0x79')]?_[_0x9fc8('0x78')](_0x5f3c00[_0x54678a[_0x228612][_0x9fc8('0x79')]],'%s',_0x5abe24):_0x5abe24;if(_0x54678a[_0x228612]['groupBy']){_0xc08dc1['group'](_0x5abe24);}_0x54678a[_0x228612][_0x9fc8('0x7a')]&&_0xc08dc1[_0x9fc8('0x3c')](_0x5abe24,_0x54678a[_0x228612][_0x9fc8('0x7a')]===_0x9fc8('0x7b')?![]:!![]);_0xc08dc1[_0x9fc8('0x6b')](_0x5abe24,_0x54678a[_0x228612][_0x9fc8('0x7c')]||_0x5abe24);}if(_0x1800c2['joins']){_0x1800c2[_0x9fc8('0x7d')]=JSON[_0x9fc8('0x7e')](_0x1800c2[_0x9fc8('0x7d')]);for(var _0x301a40=0x0;_0x301a40<_0x1800c2[_0x9fc8('0x7d')][_0x9fc8('0x38')];_0x301a40+=0x1){if(_0x1800c2[_0x9fc8('0x7d')][_0x301a40][_0x9fc8('0x2f')]&&_['includes'](_0x3a5940,_0x1800c2[_0x9fc8('0x7d')][_0x301a40][_0x9fc8('0x2f')])&&_0x1800c2[_0x9fc8('0x7d')][_0x301a40][_0x9fc8('0x7f')]&&_0x1800c2['joins'][_0x301a40]['foreignTable']&&_0x1800c2[_0x9fc8('0x7d')][_0x301a40][_0x9fc8('0x80')]){_0xc08dc1[_0x1800c2[_0x9fc8('0x7d')][_0x301a40][_0x9fc8('0x2f')]](_0x1800c2[_0x9fc8('0x7d')][_0x301a40][_0x9fc8('0x81')],null,util[_0x9fc8('0x79')](_0x9fc8('0x82'),_0x1800c2[_0x9fc8('0x74')],_0x1800c2[_0x9fc8('0x7d')][_0x301a40][_0x9fc8('0x7f')],_0x1800c2['joins'][_0x301a40]['foreignTable'],_0x1800c2[_0x9fc8('0x7d')][_0x301a40][_0x9fc8('0x80')]));}}}if(_0x1800c2[_0x9fc8('0x83')]){_0x1800c2[_0x9fc8('0x83')]=JSON['parse'](_0x1800c2[_0x9fc8('0x83')]);_0xc08dc1[_0x9fc8('0x3e')](_0x2002b1(_0x1800c2[_0x9fc8('0x83')][_0x9fc8('0x6a')]));}_0x3b3168=_0xc08dc1['clone']();_0xc08dc1[_0x9fc8('0x3b')](_0x516fec);_0xc08dc1[_0x9fc8('0x1c')](0x0);logger['debug']('Limited\x20Query:',_0xc08dc1[_0x9fc8('0x84')]());return dbH[_0x9fc8('0x85')][_0x9fc8('0x32')](_0xc08dc1[_0x9fc8('0x84')](),{'type':dbH[_0x9fc8('0x85')][_0x9fc8('0x86')][_0x9fc8('0x87')]});}})[_0x9fc8('0x22')](respondWithResult(_0x125c7b,null))[_0x9fc8('0x54')](handleError(_0x125c7b,null));};function runReport(_0x283240,_0x2d32ec,_0x29053f){var _0x5414f9=_0x2d32ec['name'];var _0x4ec5bb=0xa;var _0x2ded60=[_0x9fc8('0x55'),_0x9fc8('0x56'),'right_join',_0x9fc8('0x58')];var _0x59372f={'SUM':_0x9fc8('0x59'),'COUNT':_0x9fc8('0x88'),'COUNT DISTINCT':_0x9fc8('0x5a'),'MAX':_0x9fc8('0x5b'),'MIN':_0x9fc8('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9fc8('0x5e')};var _0x22c381={'SEC_TO_TIME':_0x9fc8('0x5f'),'DATE':_0x9fc8('0x60'),'HOUR':'HOUR(%s)','ROUND':_0x9fc8('0x62'),'UNIX_TIMESTAMP':_0x9fc8('0x63')};var _0x1325e8=function(_0x1762c4){return!_['includes']([_0x9fc8('0x65'),_0x9fc8('0x66'),_0x9fc8('0x67'),_0x9fc8('0x68')],_0x1762c4);};var _0x4aa5c1=function(_0x45b1bd){if(!_0x45b1bd||!_0x45b1bd[_0x9fc8('0x69')][_0x9fc8('0x38')]){return'';}for(var _0x4b89d3='(',_0xb610b9=0x0;_0xb610b9<_0x45b1bd[_0x9fc8('0x69')]['length'];_0xb610b9+=0x1){_0xb610b9>0x0&&(_0x4b89d3+='\x20'+_0x45b1bd[_0x9fc8('0x89')]+'\x20');_0x4b89d3+=_0x45b1bd[_0x9fc8('0x69')][_0xb610b9]['group']?_0x4aa5c1(_0x45b1bd['rules'][_0xb610b9][_0x9fc8('0x6a')]):_0x45b1bd[_0x9fc8('0x69')][_0xb610b9][_0x9fc8('0x6b')]+'\x20'+_0x45b1bd['rules'][_0xb610b9][_0x9fc8('0x6c')]+(_0x1325e8(_0x45b1bd[_0x9fc8('0x69')][_0xb610b9][_0x9fc8('0x6c')])?'\x20'+_0x45b1bd[_0x9fc8('0x69')][_0xb610b9][_0x9fc8('0x6d')]:'');}return _0x4b89d3+')';};var _0xc62699={'where':{'id':_0x283240['id']}},_0x405549,_0x4514fb,_0x20d270,_0x2f2bd5,_0x565d7a;_0xc62699=_['merge']({},_0xc62699,_0x29053f);return db[_0x9fc8('0x2d')][_0x9fc8('0x49')](_0xc62699)[_0x9fc8('0x22')](function(_0x163f00){if(_0x163f00){_0x405549=_0x163f00;return _0x163f00[_0x9fc8('0x6e')]();}return null;})[_0x9fc8('0x22')](function(_0x52b552){if(_0x52b552){if(!_0x52b552['length']){throw new db[(_0x9fc8('0x6f'))][(_0x9fc8('0x8a'))](_0x9fc8('0x8b'),0x193);}_0x4514fb=_0x52b552;return db[_0x9fc8('0x70')][_0x9fc8('0x45')]({'raw':!![]});}return null;})[_0x9fc8('0x22')](function(_0x46d62c){if(_0x46d62c){_0x20d270=_[_0x9fc8('0x71')](_0x46d62c,'id');var _0x13dfe1;var _0xa79398=squel[_0x9fc8('0x72')]();_0xa79398[_0x9fc8('0x73')](_0x405549[_0x9fc8('0x74')]);for(var _0x1bf3a6=0x0;_0x1bf3a6<_0x4514fb[_0x9fc8('0x38')];_0x1bf3a6+=0x1){_0x13dfe1=_0x4514fb[_0x1bf3a6][_0x9fc8('0x75')]?_0x20d270[_0x4514fb[_0x1bf3a6]['MetricId']][_0x9fc8('0x76')]:_0x4514fb[_0x1bf3a6][_0x9fc8('0x6b')];_0x13dfe1=_0x4514fb[_0x1bf3a6][_0x9fc8('0x77')]?_[_0x9fc8('0x78')](_0x59372f[_0x4514fb[_0x1bf3a6]['function']],'%s',_0x13dfe1):_0x13dfe1;_0x13dfe1=_0x4514fb[_0x1bf3a6][_0x9fc8('0x79')]?_[_0x9fc8('0x78')](_0x22c381[_0x4514fb[_0x1bf3a6][_0x9fc8('0x79')]],'%s',_0x13dfe1):_0x13dfe1;if(_0x4514fb[_0x1bf3a6][_0x9fc8('0x8c')]){_0xa79398['group'](_0x13dfe1);}_0x4514fb[_0x1bf3a6][_0x9fc8('0x7a')]&&_0xa79398['order'](_0x13dfe1,_0x4514fb[_0x1bf3a6][_0x9fc8('0x7a')]===_0x9fc8('0x7b')?![]:!![]);_0xa79398['field'](_0x13dfe1,_0x4514fb[_0x1bf3a6][_0x9fc8('0x7c')]||_0x13dfe1);}if(_0x405549['joins']){_0x405549[_0x9fc8('0x7d')]=JSON['parse'](_0x405549[_0x9fc8('0x7d')]);for(var _0x5d2146=0x0;_0x5d2146<_0x405549['joins']['length'];_0x5d2146+=0x1){if(_0x405549[_0x9fc8('0x7d')][_0x5d2146][_0x9fc8('0x2f')]&&_[_0x9fc8('0x64')](_0x2ded60,_0x405549[_0x9fc8('0x7d')][_0x5d2146][_0x9fc8('0x2f')])&&_0x405549['joins'][_0x5d2146][_0x9fc8('0x7f')]&&_0x405549[_0x9fc8('0x7d')][_0x5d2146][_0x9fc8('0x81')]&&_0x405549['joins'][_0x5d2146]['foreignKey']){_0xa79398[_0x405549[_0x9fc8('0x7d')][_0x5d2146]['type']](_0x405549[_0x9fc8('0x7d')][_0x5d2146][_0x9fc8('0x81')],null,util[_0x9fc8('0x79')](_0x9fc8('0x82'),_0x405549[_0x9fc8('0x74')],_0x405549[_0x9fc8('0x7d')][_0x5d2146][_0x9fc8('0x7f')],_0x405549[_0x9fc8('0x7d')][_0x5d2146]['foreignTable'],_0x405549[_0x9fc8('0x7d')][_0x5d2146]['foreignKey']));}}}if(_0x405549[_0x9fc8('0x83')]){_0x405549['conditions']=JSON[_0x9fc8('0x7e')](_0x405549[_0x9fc8('0x83')]);_0xa79398[_0x9fc8('0x3e')](_0x4aa5c1(_0x405549[_0x9fc8('0x83')][_0x9fc8('0x6a')]));}_0x565d7a=_0xa79398[_0x9fc8('0x8d')]();_0xa79398['limit'](_0x4ec5bb);_0xa79398[_0x9fc8('0x1c')](0x0);return;}})[_0x9fc8('0x22')](function(){if(_0x2d32ec[_0x9fc8('0x8e')]==='web'){return null;}var _0x23bc8e=_[_0x9fc8('0x41')](_0x2d32ec,{'name':_0x2d32ec[_0x9fc8('0x8f')]||_0x2d32ec[_0x9fc8('0x29')]||_0x405549[_0x9fc8('0x29')],'basename':_0x5414f9,'savename':util[_0x9fc8('0x79')](_0x9fc8('0x90'),_0x2d32ec[_0x9fc8('0x29')]||_0x405549[_0x9fc8('0x29')],require(_0x9fc8('0x91'))['generate'](0x4),_0x2d32ec[_0x9fc8('0x8e')]||_0x9fc8('0x92')),'reportId':_0x405549['id'],'reportType':'custom'});return db[_0x9fc8('0x93')][_0x9fc8('0x4a')](_0x23bc8e,{'raw':!![]});})[_0x9fc8('0x22')](function(_0x5cfc35){if(_0x405549[_0x9fc8('0x74')]===_0x9fc8('0x94')){_0x565d7a[_0x9fc8('0x3e')](_0x405549['table']+_0x9fc8('0x95'),_0x2d32ec['startDate'],_0x2d32ec[_0x9fc8('0x96')]);}else{_0x565d7a[_0x9fc8('0x3e')](_0x405549[_0x9fc8('0x74')]+_0x9fc8('0x97'),_0x2d32ec['startDate'],_0x2d32ec[_0x9fc8('0x96')]);}if(_0x5cfc35){logger[_0x9fc8('0x98')](_0x9fc8('0x99'),_0x565d7a['toString']());require(_0x9fc8('0x9a'))[_0x9fc8('0x9b')](path[_0x9fc8('0x55')](__dirname,_0x9fc8('0x9c'),_0x5cfc35['output']),[_0x5cfc35['id'],_0x565d7a[_0x9fc8('0x84')](),path[_0x9fc8('0x55')](__dirname,'../../files/reports',_0x5cfc35[_0x9fc8('0x9d')]),_0x5414f9]);return _0x5cfc35;}else{var _0x2c55b6=squel[_0x9fc8('0x72')]();_0x2c55b6[_0x9fc8('0x73')]('('+_0x565d7a[_0x9fc8('0x84')]()+')','countTable');_0x2c55b6[_0x9fc8('0x6b')](_0x9fc8('0x9e'),_0x9fc8('0x9f'));_0x565d7a[_0x9fc8('0x3b')](_0x2d32ec[_0x9fc8('0x3b')]||_0x4ec5bb);_0x565d7a['offset'](_0x2d32ec['offset']||0x0);return dbH['sequelize']['query'](_0x2c55b6[_0x9fc8('0x84')](),{'type':dbH[_0x9fc8('0x85')][_0x9fc8('0x86')]['SELECT']})['then'](function(_0x58c801){if(!_0x58c801['length']){_0x2f2bd5=0x0;}else{_0x2f2bd5=_0x58c801[0x0][_0x9fc8('0x9f')]||0x0;}return dbH[_0x9fc8('0x85')]['query'](_0x565d7a[_0x9fc8('0x84')](),{'type':dbH[_0x9fc8('0x85')][_0x9fc8('0x86')][_0x9fc8('0x87')]});})[_0x9fc8('0x22')](function(_0xfbdf51){return{'rows':_0xfbdf51||[],'count':_0x2f2bd5};});}});}exports[_0x9fc8('0xa0')]=function(_0xaa38d6,_0x1e6e63){return runReport(_0xaa38d6['params'],_0xaa38d6[_0x9fc8('0x32')],_0xaa38d6[_0x9fc8('0x48')])[_0x9fc8('0x22')](respondWithResult(_0x1e6e63,null))[_0x9fc8('0x54')](handleError(_0x1e6e63,null));};exports['runReport']=runReport;exports[_0x9fc8('0x32')]=function(_0x9b8da4,_0x5407f2){var _0x1f711e=0xa;var _0x38e630=[_0x9fc8('0x55'),'left_join',_0x9fc8('0x57'),_0x9fc8('0x58')];var _0x877466={'SUM':'SUM(%s)','COUNT':_0x9fc8('0x88'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x9fc8('0xa1'),'GROUP_CONCAT ASC':_0x9fc8('0xa2'),'GROUP_CONCAT DESC':_0x9fc8('0x5e')};var _0x644d75={'SEC_TO_TIME':_0x9fc8('0x5f'),'DATE':'DATE(%s)','HOUR':_0x9fc8('0x61'),'ROUND':_0x9fc8('0x62'),'UNIX_TIMESTAMP':_0x9fc8('0x63')};var _0x5683fe=function(_0x3afb5a){return!_['includes']([_0x9fc8('0x65'),_0x9fc8('0x66'),'IS\x20EMPTY',_0x9fc8('0x68')],_0x3afb5a);};var _0x330d18=function(_0x3aeca6){if(!_0x3aeca6||!_0x3aeca6[_0x9fc8('0x69')][_0x9fc8('0x38')]){return'';}for(var _0x506c44='(',_0x54d35e=0x0;_0x54d35e<_0x3aeca6[_0x9fc8('0x69')][_0x9fc8('0x38')];_0x54d35e+=0x1){_0x54d35e>0x0&&(_0x506c44+='\x20'+_0x3aeca6[_0x9fc8('0x89')]+'\x20');_0x506c44+=_0x3aeca6[_0x9fc8('0x69')][_0x54d35e]['group']?_0x330d18(_0x3aeca6['rules'][_0x54d35e]['group']):_0x3aeca6['rules'][_0x54d35e]['field']+'\x20'+_0x3aeca6[_0x9fc8('0x69')][_0x54d35e][_0x9fc8('0x6c')]+(_0x5683fe(_0x3aeca6['rules'][_0x54d35e][_0x9fc8('0x6c')])?'\x20'+_0x3aeca6['rules'][_0x54d35e][_0x9fc8('0x6d')]:'');}return _0x506c44+')';};var _0x3395a5={'where':{'id':_0x9b8da4['params']['id']}},_0x419bab,_0x5d6cee,_0x13406d,_0x453a8a,_0x16a2fd;_0x3395a5=_['merge']({},_0x3395a5,_0x9b8da4[_0x9fc8('0x48')]);return db['AnalyticCustomReport'][_0x9fc8('0x49')](_0x3395a5)[_0x9fc8('0x22')](function(_0x5a8cc4){if(_0x5a8cc4){_0x419bab=_0x5a8cc4;return _0x5a8cc4[_0x9fc8('0x6e')]();}return null;})[_0x9fc8('0x22')](function(_0x1d1556){if(_0x1d1556){if(!_0x1d1556[_0x9fc8('0x38')]){throw new db[(_0x9fc8('0x6f'))][(_0x9fc8('0x8a'))](_0x9fc8('0x8b'),0x193);}_0x5d6cee=_0x1d1556;return db[_0x9fc8('0x70')]['findAll']({'raw':!![]});}return null;})[_0x9fc8('0x22')](function(_0x3f5792){if(_0x3f5792){_0x13406d=_[_0x9fc8('0x71')](_0x3f5792,'id');var _0x45364d;var _0x466c7e=squel[_0x9fc8('0x72')]();_0x466c7e['from'](_0x419bab[_0x9fc8('0x74')]);for(var _0x2c7cfb=0x0;_0x2c7cfb<_0x5d6cee[_0x9fc8('0x38')];_0x2c7cfb+=0x1){_0x45364d=_0x5d6cee[_0x2c7cfb][_0x9fc8('0x75')]?_0x13406d[_0x5d6cee[_0x2c7cfb][_0x9fc8('0x75')]][_0x9fc8('0x76')]:_0x5d6cee[_0x2c7cfb][_0x9fc8('0x6b')];_0x45364d=_0x5d6cee[_0x2c7cfb][_0x9fc8('0x77')]?_[_0x9fc8('0x78')](_0x877466[_0x5d6cee[_0x2c7cfb][_0x9fc8('0x77')]],'%s',_0x45364d):_0x45364d;_0x45364d=_0x5d6cee[_0x2c7cfb]['format']?_[_0x9fc8('0x78')](_0x644d75[_0x5d6cee[_0x2c7cfb][_0x9fc8('0x79')]],'%s',_0x45364d):_0x45364d;if(_0x5d6cee[_0x2c7cfb][_0x9fc8('0x8c')]){_0x466c7e[_0x9fc8('0x6a')](_0x45364d);}_0x5d6cee[_0x2c7cfb][_0x9fc8('0x7a')]&&_0x466c7e[_0x9fc8('0x3c')](_0x45364d,_0x5d6cee[_0x2c7cfb][_0x9fc8('0x7a')]===_0x9fc8('0x7b')?![]:!![]);_0x466c7e[_0x9fc8('0x6b')](_0x45364d,_0x5d6cee[_0x2c7cfb]['alias']||_0x45364d);}if(_0x419bab['joins']){_0x419bab[_0x9fc8('0x7d')]=JSON[_0x9fc8('0x7e')](_0x419bab[_0x9fc8('0x7d')]);for(var _0x261629=0x0;_0x261629<_0x419bab[_0x9fc8('0x7d')][_0x9fc8('0x38')];_0x261629+=0x1){if(_0x419bab[_0x9fc8('0x7d')][_0x261629][_0x9fc8('0x2f')]&&_[_0x9fc8('0x64')](_0x38e630,_0x419bab['joins'][_0x261629][_0x9fc8('0x2f')])&&_0x419bab[_0x9fc8('0x7d')][_0x261629][_0x9fc8('0x7f')]&&_0x419bab[_0x9fc8('0x7d')][_0x261629]['foreignTable']&&_0x419bab['joins'][_0x261629][_0x9fc8('0x80')]){_0x466c7e[_0x419bab[_0x9fc8('0x7d')][_0x261629][_0x9fc8('0x2f')]](_0x419bab[_0x9fc8('0x7d')][_0x261629][_0x9fc8('0x81')],null,util[_0x9fc8('0x79')](_0x9fc8('0x82'),_0x419bab[_0x9fc8('0x74')],_0x419bab[_0x9fc8('0x7d')][_0x261629][_0x9fc8('0x7f')],_0x419bab['joins'][_0x261629][_0x9fc8('0x81')],_0x419bab[_0x9fc8('0x7d')][_0x261629][_0x9fc8('0x80')]));}}}if(_0x419bab[_0x9fc8('0x83')]){_0x419bab[_0x9fc8('0x83')]=JSON['parse'](_0x419bab['conditions']);_0x466c7e[_0x9fc8('0x3e')](_0x330d18(_0x419bab[_0x9fc8('0x83')][_0x9fc8('0x6a')]));}_0x16a2fd=_0x466c7e[_0x9fc8('0x8d')]();_0x466c7e['limit'](_0x1f711e);_0x466c7e[_0x9fc8('0x1c')](0x0);logger[_0x9fc8('0xa3')](_0x9fc8('0xa4'),_0x466c7e[_0x9fc8('0x84')]());return dbH[_0x9fc8('0x85')][_0x9fc8('0x32')](_0x466c7e[_0x9fc8('0x84')](),{'type':dbH[_0x9fc8('0x85')]['QueryTypes'][_0x9fc8('0x87')]});}})[_0x9fc8('0x22')](function(){return{'sql':_0x16a2fd[_0x9fc8('0x84')]()};})['then'](respondWithResult(_0x5407f2,null))[_0x9fc8('0x54')](handleError(_0x5407f2,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 03d80e5..75af13f 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 _0xb414=['AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x5a1e37,_0x1df809){var _0x550c90=function(_0x2cd3de){while(--_0x2cd3de){_0x5a1e37['push'](_0x5a1e37['shift']());}};_0x550c90(++_0x1df809);}(_0xb414,0x86));var _0x4b41=function(_0x513cd9,_0x1e9486){_0x513cd9=_0x513cd9-0x0;var _0x4a9b8f=_0xb414[_0x513cd9];return _0x4a9b8f;};'use strict';var _=require(_0x4b41('0x0'));var util=require(_0x4b41('0x1'));var logger=require(_0x4b41('0x2'))('api');var moment=require(_0x4b41('0x3'));var BPromise=require(_0x4b41('0x4'));var rp=require(_0x4b41('0x5'));var fs=require('fs');var path=require(_0x4b41('0x6'));var rimraf=require('rimraf');var config=require(_0x4b41('0x7'));var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x194fbc,_0x4bc9b6){return _0x194fbc[_0x4b41('0x8')](_0x4b41('0x9'),attributes,{'tableName':_0x4b41('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef1a=['AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./analyticCustomReport.attributes','exports','define'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xef1a,0x146));var _0xaef1=function(_0x16e459,_0x48e6f3){_0x16e459=_0x16e459-0x0;var _0x5e80ad=_0xef1a[_0x16e459];return _0x5e80ad;};'use strict';var _=require('lodash');var util=require(_0xaef1('0x0'));var logger=require(_0xaef1('0x1'))(_0xaef1('0x2'));var moment=require(_0xaef1('0x3'));var BPromise=require(_0xaef1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaef1('0x5'));var rimraf=require('rimraf');var config=require(_0xaef1('0x6'));var attributes=require(_0xaef1('0x7'));module[_0xaef1('0x8')]=function(_0x1e2d6e,_0x4991cd){return _0x1e2d6e[_0xaef1('0x9')](_0xaef1('0xa'),attributes,{'tableName':_0xaef1('0xb'),'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 f7746f0..25548f1 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 _0x1b68=['info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x4598b8,_0x281ead){var _0x707a88=function(_0xd7b194){while(--_0xd7b194){_0x4598b8['push'](_0x4598b8['shift']());}};_0x707a88(++_0x281ead);}(_0x1b68,0x195));var _0x81b6=function(_0xb8bec7,_0x2a72b4){_0xb8bec7=_0xb8bec7-0x0;var _0x7dc5ad=_0x1b68[_0xb8bec7];return _0x7dc5ad;};'use strict';var _=require(_0x81b6('0x0'));var util=require(_0x81b6('0x1'));var moment=require(_0x81b6('0x2'));var BPromise=require(_0x81b6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81b6('0x4'));var db=require(_0x81b6('0x5'))['db'];var utils=require(_0x81b6('0x6'));var logger=require(_0x81b6('0x7'))(_0x81b6('0x8'));var config=require(_0x81b6('0x9'));var jayson=require(_0x81b6('0xa'));var client=jayson['client'][_0x81b6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x557d42,_0x1ca4dc,_0x2d1945){return new BPromise(function(_0x2e6f60,_0x3e3084){return client['request'](_0x557d42,_0x2d1945)[_0x81b6('0xc')](function(_0x30347d){logger[_0x81b6('0xd')](_0x81b6('0xe'),_0x1ca4dc,_0x81b6('0xf'));logger[_0x81b6('0x10')](_0x81b6('0x11'),_0x1ca4dc,_0x81b6('0xf'),JSON['stringify'](_0x30347d));if(_0x30347d[_0x81b6('0x12')]){if(_0x30347d[_0x81b6('0x12')][_0x81b6('0x13')]===0x1f4){logger['error'](_0x81b6('0xe'),_0x1ca4dc,_0x30347d[_0x81b6('0x12')][_0x81b6('0x14')]);return _0x3e3084(_0x30347d['error']['message']);}logger[_0x81b6('0x12')](_0x81b6('0xe'),_0x1ca4dc,_0x30347d[_0x81b6('0x12')]['message']);return _0x2e6f60(_0x30347d[_0x81b6('0x12')][_0x81b6('0x14')]);}else{logger[_0x81b6('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1ca4dc,_0x81b6('0xf'));_0x2e6f60(_0x30347d[_0x81b6('0x15')][_0x81b6('0x14')]);}})['catch'](function(_0x251ee9){logger[_0x81b6('0x12')](_0x81b6('0xe'),_0x1ca4dc,_0x251ee9);_0x3e3084(_0x251ee9);});});} \ No newline at end of file +var _0x650c=['http','request','then','info','request\x20sent','debug','stringify','error','AnalyticCustomReport,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise'];(function(_0x10f0a5,_0x45ff64){var _0x563a85=function(_0x7b7bd2){while(--_0x7b7bd2){_0x10f0a5['push'](_0x10f0a5['shift']());}};_0x563a85(++_0x45ff64);}(_0x650c,0x1df));var _0xc650=function(_0x22875e,_0xb601fb){_0x22875e=_0x22875e-0x0;var _0x934224=_0x650c[_0x22875e];return _0x934224;};'use strict';var _=require(_0xc650('0x0'));var util=require('util');var moment=require(_0xc650('0x1'));var BPromise=require(_0xc650('0x2'));var rs=require(_0xc650('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc650('0x4'));var config=require(_0xc650('0x5'));var jayson=require(_0xc650('0x6'));var client=jayson['client'][_0xc650('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x48d968,_0x4e6182,_0x41d0e4){return new BPromise(function(_0x5db9d3,_0x4c9d3b){return client[_0xc650('0x8')](_0x48d968,_0x41d0e4)[_0xc650('0x9')](function(_0x5436ad){logger[_0xc650('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4e6182,_0xc650('0xb'));logger[_0xc650('0xc')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4e6182,_0xc650('0xb'),JSON[_0xc650('0xd')](_0x5436ad));if(_0x5436ad[_0xc650('0xe')]){if(_0x5436ad[_0xc650('0xe')]['code']===0x1f4){logger[_0xc650('0xe')](_0xc650('0xf'),_0x4e6182,_0x5436ad[_0xc650('0xe')][_0xc650('0x10')]);return _0x4c9d3b(_0x5436ad[_0xc650('0xe')][_0xc650('0x10')]);}logger[_0xc650('0xe')](_0xc650('0xf'),_0x4e6182,_0x5436ad[_0xc650('0xe')][_0xc650('0x10')]);return _0x5db9d3(_0x5436ad['error']['message']);}else{logger[_0xc650('0xa')](_0xc650('0xf'),_0x4e6182,'request\x20sent');_0x5db9d3(_0x5436ad['result'][_0xc650('0x10')]);}})[_0xc650('0x11')](function(_0x3d9624){logger[_0xc650('0xe')](_0xc650('0xf'),_0x4e6182,_0x3d9624);_0x4c9d3b(_0x3d9624);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 6b43ecf..35c4c36 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 _0x6336=['update','delete','path','connect-timeout','express','fs-extra','../../config/environment','./analyticCustomReport.controller','get','index','isAuthenticated','show','/:id/preview','preview','run','create','put','/:id'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6336,0xa4));var _0x6633=function(_0x373290,_0x5cbb92){_0x373290=_0x373290-0x0;var _0x185b6a=_0x6336[_0x373290];return _0x185b6a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6633('0x0'));var timeout=require(_0x6633('0x1'));var express=require(_0x6633('0x2'));var router=express['Router']();var fs_extra=require(_0x6633('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6633('0x4'));var controller=require(_0x6633('0x5'));router[_0x6633('0x6')]('/',auth['isAuthenticated'](),controller[_0x6633('0x7')]);router[_0x6633('0x6')]('/:id',auth[_0x6633('0x8')](),controller[_0x6633('0x9')]);router[_0x6633('0x6')](_0x6633('0xa'),auth[_0x6633('0x8')](),controller[_0x6633('0xb')]);router[_0x6633('0x6')]('/:id/run',auth['isAuthenticated'](),controller[_0x6633('0xc')]);router['get']('/:id/query',auth[_0x6633('0x8')](),controller['query']);router['post']('/',auth['isAuthenticated'](),controller[_0x6633('0xd')]);router[_0x6633('0xe')](_0x6633('0xf'),auth[_0x6633('0x8')](),controller[_0x6633('0x10')]);router[_0x6633('0x11')](_0x6633('0xf'),auth[_0x6633('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb6fa=['/:id/preview','run','/:id/query','query','post','create','put','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id'];(function(_0x50bee7,_0x60c9e){var _0x2c60f9=function(_0x394ff2){while(--_0x394ff2){_0x50bee7['push'](_0x50bee7['shift']());}};_0x2c60f9(++_0x60c9e);}(_0xb6fa,0x185));var _0xab6f=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0xb6fa[_0x1ebce2];return _0x4a330c;};'use strict';var multer=require(_0xab6f('0x0'));var util=require(_0xab6f('0x1'));var path=require('path');var timeout=require(_0xab6f('0x2'));var express=require('express');var router=express[_0xab6f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xab6f('0x4'));var interaction=require(_0xab6f('0x5'));var config=require('../../config/environment');var controller=require(_0xab6f('0x6'));router[_0xab6f('0x7')]('/',auth[_0xab6f('0x8')](),controller[_0xab6f('0x9')]);router['get'](_0xab6f('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xab6f('0xb'),auth[_0xab6f('0x8')](),controller['preview']);router['get']('/:id/run',auth[_0xab6f('0x8')](),controller[_0xab6f('0xc')]);router[_0xab6f('0x7')](_0xab6f('0xd'),auth[_0xab6f('0x8')](),controller[_0xab6f('0xe')]);router[_0xab6f('0xf')]('/',auth[_0xab6f('0x8')](),controller[_0xab6f('0x10')]);router[_0xab6f('0x11')](_0xab6f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xab6f('0x12')](_0xab6f('0xa'),auth[_0xab6f('0x8')](),controller[_0xab6f('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index d66e9d7..555b133 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 _0x5fab=['exports','STRING','TEXT','sequelize'];(function(_0x2c73c6,_0x28332b){var _0x2e203c=function(_0x181ffa){while(--_0x181ffa){_0x2c73c6['push'](_0x2c73c6['shift']());}};_0x2e203c(++_0x28332b);}(_0x5fab,0x177));var _0xb5fa=function(_0x10b317,_0x2adf32){_0x10b317=_0x10b317-0x0;var _0x1e3054=_0x5fab[_0x10b317];return _0x1e3054;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb5fa('0x2')]},'parent':{'type':Sequelize[_0xb5fa('0x2')]},'table':{'type':Sequelize[_0xb5fa('0x2')]},'conditions':{'type':Sequelize[_0xb5fa('0x3')]},'joins':{'type':Sequelize[_0xb5fa('0x3')]}}; \ No newline at end of file +var _0x71ab=['TEXT','exports','STRING'];(function(_0x17cc54,_0xfeeb29){var _0x10b93e=function(_0x57b1b3){while(--_0x57b1b3){_0x17cc54['push'](_0x17cc54['shift']());}};_0x10b93e(++_0xfeeb29);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb71a('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb71a('0x1')]},'conditions':{'type':Sequelize[_0xb71a('0x2')]},'joins':{'type':Sequelize[_0xb71a('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 836029a..079c727 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 _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(_0x23bc5b,_0x339e40){var _0x550a73=function(_0x40b22b){while(--_0x40b22b){_0x23bc5b['push'](_0x23bc5b['shift']());}};_0x550a73(++_0x339e40);}(_0x4975,0x86));var _0x5497=function(_0x13a3d6,_0x1a4f16){_0x13a3d6=_0x13a3d6-0x0;var _0x6e2620=_0x4975[_0x13a3d6];return _0x6e2620;};'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 +var _0x46ed=['SEC_TO_TIME(%s)','value','AnalyticMetric','select','DESC','output','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','sequelize','runReport','left_join','COUNT(%s)','MIN(%s)','AVG(%s)','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','QueryTypes','SELECT'];(function(_0x2a87fc,_0x30a039){var _0x32d9f5=function(_0x2e157c){while(--_0x2e157c){_0x2a87fc['push'](_0x2a87fc['shift']());}};_0x32d9f5(++_0x30a039);}(_0x46ed,0x168));var _0xd46e=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x46ed[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xf3048c,_0x27dbfb){_0x27dbfb=_0x27dbfb||0xcc;return function(_0x53b309){if(_0x53b309){return _0xf3048c['sendStatus'](_0x27dbfb);}return _0xf3048c[_0xd46e('0x1a')](_0x27dbfb)[_0xd46e('0x1b')]();};}function respondWithResult(_0x1e9aae,_0x3fdf88){_0x3fdf88=_0x3fdf88||0xc8;return function(_0x50c7c3){if(_0x50c7c3){return _0x1e9aae[_0xd46e('0x1a')](_0x3fdf88)[_0xd46e('0x1c')](_0x50c7c3);}};}function respondWithFilteredResult(_0x417402,_0x3d72ce){return function(_0x36a317){if(_0x36a317){var _0x47fa8f=typeof _0x3d72ce[_0xd46e('0x1d')]===_0xd46e('0x1e')&&typeof _0x3d72ce[_0xd46e('0x1f')]==='undefined';var _0x5ddd04=_0x36a317[_0xd46e('0x20')];var _0x1bd574=_0x47fa8f?0x0:_0x3d72ce['offset'];var _0x4fd1f2=_0x47fa8f?_0x36a317[_0xd46e('0x20')]:_0x3d72ce[_0xd46e('0x1d')]+_0x3d72ce[_0xd46e('0x1f')];var _0x2273c5;if(_0x4fd1f2>=_0x5ddd04){_0x4fd1f2=_0x5ddd04;_0x2273c5=0xc8;}else{_0x2273c5=0xce;}_0x417402[_0xd46e('0x1a')](_0x2273c5);return _0x417402[_0xd46e('0x21')](_0xd46e('0x22'),_0x1bd574+'-'+_0x4fd1f2+'/'+_0x5ddd04)[_0xd46e('0x1c')](_0x36a317);}return null;};}function patchUpdates(_0xb4940){return function(_0x3c7e91){try{jsonpatch[_0xd46e('0x23')](_0x3c7e91,_0xb4940,!![]);}catch(_0x5ba94d){return BPromise[_0xd46e('0x24')](_0x5ba94d);}return _0x3c7e91[_0xd46e('0x25')]();};}function saveUpdates(_0x79aa51,_0x45ce0b){return function(_0x128246){if(_0x128246){return _0x128246[_0xd46e('0x26')](_0x79aa51)[_0xd46e('0x27')](function(_0x8a1be){return _0x8a1be;});}return null;};}function removeEntity(_0x62dea5,_0x4cf899){return function(_0x314570){if(_0x314570){return _0x314570['destroy']()['then'](function(){var _0x371054=_0x314570[_0xd46e('0x28')]({'plain':!![]});var _0x21135f=_0xd46e('0x29');return db[_0xd46e('0x2a')][_0xd46e('0x2b')]({'where':{'type':_0x21135f,'resourceId':_0x371054['id']}})[_0xd46e('0x27')](function(){return _0x314570;});})['then'](function(){_0x62dea5[_0xd46e('0x1a')](0xcc)[_0xd46e('0x1b')]();});}};}function handleEntityNotFound(_0xddbce9,_0x17db79){return function(_0x96f15c){if(!_0x96f15c){_0xddbce9[_0xd46e('0x2c')](0x194);}return _0x96f15c;};}function handleError(_0x58aeef,_0x465d54){_0x465d54=_0x465d54||0x1f4;return function(_0x3a1ced){logger[_0xd46e('0x2d')](_0x3a1ced[_0xd46e('0x2e')]);if(_0x3a1ced[_0xd46e('0x2f')]){delete _0x3a1ced[_0xd46e('0x2f')];}_0x58aeef[_0xd46e('0x1a')](_0x465d54)[_0xd46e('0x30')](_0x3a1ced);};}exports[_0xd46e('0x31')]=function(_0x45ea47,_0x2ff785){var _0x504324={},_0x2f4a1b={},_0x5ed8dc={'count':0x0,'rows':[]};var _0x1248ce=_[_0xd46e('0x32')](db[_0xd46e('0x33')][_0xd46e('0x34')],function(_0x5ef248){return{'name':_0x5ef248[_0xd46e('0x35')],'type':_0x5ef248[_0xd46e('0x36')]['key']};});_0x2f4a1b[_0xd46e('0x37')]=_[_0xd46e('0x32')](_0x1248ce,'name');_0x2f4a1b[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x45ea47[_0xd46e('0x38')]);_0x2f4a1b['filters']=_['intersection'](_0x2f4a1b[_0xd46e('0x37')],_0x2f4a1b[_0xd46e('0x38')]);_0x504324[_0xd46e('0x3a')]=_[_0xd46e('0x3b')](_0x2f4a1b[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x504324['attributes']=_0x504324[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x504324[_0xd46e('0x3a')]:_0x2f4a1b[_0xd46e('0x37')];if(!_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3e')](_0xd46e('0x3f'))){_0x504324['limit']=qs[_0xd46e('0x1f')](_0x45ea47[_0xd46e('0x38')]['limit']);_0x504324[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x1d')]);}_0x504324['order']=qs[_0xd46e('0x40')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x40')]);_0x504324[_0xd46e('0x41')]=qs[_0xd46e('0x42')](_[_0xd46e('0x43')](_0x45ea47[_0xd46e('0x38')],_0x2f4a1b[_0xd46e('0x42')]),_0x1248ce);if(_0x45ea47['query'][_0xd46e('0x44')]){_0x504324[_0xd46e('0x41')]=_[_0xd46e('0x45')](_0x504324[_0xd46e('0x41')],{'$or':_[_0xd46e('0x32')](_0x1248ce,function(_0x56f99c){if(_0x56f99c[_0xd46e('0x36')]!=='VIRTUAL'){var _0x55230d={};_0x55230d[_0x56f99c['name']]={'$like':'%'+_0x45ea47['query'][_0xd46e('0x44')]+'%'};return _0x55230d;}})});}_0x504324=_['merge']({},_0x504324,_0x45ea47[_0xd46e('0x46')]);var _0x40720e={'where':_0x504324['where']};return db[_0xd46e('0x33')][_0xd46e('0x20')](_0x40720e)[_0xd46e('0x27')](function(_0x31ba12){_0x5ed8dc[_0xd46e('0x20')]=_0x31ba12;if(_0x45ea47[_0xd46e('0x38')][_0xd46e('0x47')]){_0x504324[_0xd46e('0x48')]=[{'all':!![]}];}return db[_0xd46e('0x33')][_0xd46e('0x49')](_0x504324);})[_0xd46e('0x27')](function(_0x5ea048){_0x5ed8dc['rows']=_0x5ea048;return _0x5ed8dc;})['then'](respondWithFilteredResult(_0x2ff785,_0x504324))[_0xd46e('0x4a')](handleError(_0x2ff785,null));};exports['show']=function(_0x168d35,_0x272f5f){var _0x3fdf67={'raw':!![],'where':{'id':_0x168d35[_0xd46e('0x4b')]['id']}},_0x416505={};_0x416505[_0xd46e('0x37')]=_[_0xd46e('0x39')](db[_0xd46e('0x33')]['rawAttributes']);_0x416505[_0xd46e('0x38')]=_['keys'](_0x168d35[_0xd46e('0x38')]);_0x416505[_0xd46e('0x42')]=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],_0x416505[_0xd46e('0x38')]);_0x3fdf67['attributes']=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x168d35[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x3fdf67['attributes']=_0x3fdf67[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x3fdf67[_0xd46e('0x3a')]:_0x416505[_0xd46e('0x37')];if(_0x168d35[_0xd46e('0x38')]['includeAll']){_0x3fdf67[_0xd46e('0x48')]=[{'all':!![]}];}_0x3fdf67=_[_0xd46e('0x45')]({},_0x3fdf67,_0x168d35[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fdf67)[_0xd46e('0x27')](handleEntityNotFound(_0x272f5f,null))[_0xd46e('0x27')](respondWithResult(_0x272f5f,null))[_0xd46e('0x4a')](handleError(_0x272f5f,null));};exports['create']=function(_0xf9dab,_0x71a8dc){return db[_0xd46e('0x33')][_0xd46e('0x4d')](_0xf9dab[_0xd46e('0x4e')],{})['then'](function(_0x4ae314){var _0x3a94cf=_0xf9dab[_0xd46e('0x4f')][_0xd46e('0x28')]({'plain':!![]});if(!_0x3a94cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a94cf['role']===_0xd46e('0x4f')){var _0x9d8638=_0x4ae314['get']({'plain':!![]});var _0x2eee92=_0xd46e('0x50');return db[_0xd46e('0x51')][_0xd46e('0x4c')]({'where':{'name':_0x2eee92,'userProfileId':_0x3a94cf[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x27')](function(_0x80ed51){if(_0x80ed51&&_0x80ed51[_0xd46e('0x53')]===0x0){return db['UserProfileResource'][_0xd46e('0x4d')]({'name':_0x9d8638[_0xd46e('0x2f')],'resourceId':_0x9d8638['id'],'type':_0xd46e('0x29'),'sectionId':_0x80ed51['id']},{})[_0xd46e('0x27')](function(){return _0x4ae314;});}else{return _0x4ae314;}})['catch'](function(_0x56dd9a){logger[_0xd46e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56dd9a);throw _0x56dd9a;});}return _0x4ae314;})[_0xd46e('0x27')](respondWithResult(_0x71a8dc,0xc9))[_0xd46e('0x4a')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x26')]=function(_0x31f7eb,_0x5a7870){if(_0x31f7eb[_0xd46e('0x4e')]['id']){delete _0x31f7eb['body']['id'];}return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x31f7eb[_0xd46e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7870,null))[_0xd46e('0x27')](saveUpdates(_0x31f7eb[_0xd46e('0x4e')],null))[_0xd46e('0x27')](respondWithResult(_0x5a7870,null))[_0xd46e('0x4a')](handleError(_0x5a7870,null));};exports[_0xd46e('0x2b')]=function(_0x2cc676,_0x2760ef){return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x2cc676[_0xd46e('0x4b')]['id']}})[_0xd46e('0x27')](handleEntityNotFound(_0x2760ef,null))[_0xd46e('0x27')](removeEntity(_0x2760ef,null))[_0xd46e('0x4a')](handleError(_0x2760ef,null));};exports[_0xd46e('0x54')]=function(_0x47a86c,_0x3ec709){var _0x37a22f=0xa;var _0xe0cd61=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0xaf9641={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x481dce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x2dacb4=function(_0x2f9fcb){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x2f9fcb);};var _0x1aaa99=function(_0x272514){if(!_0x272514||!_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x476f09='(',_0x5067b7=0x0;_0x5067b7<_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')];_0x5067b7+=0x1){_0x5067b7>0x0&&(_0x476f09+='\x20'+_0x272514[_0xd46e('0x68')]+'\x20');_0x476f09+=_0x272514['rules'][_0x5067b7][_0xd46e('0x69')]?_0x1aaa99(_0x272514[_0xd46e('0x67')][_0x5067b7]['group']):_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6a')]+'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['condition']+(_0x2dacb4(_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6b')])?'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['value']:'');}return _0x476f09+')';};var _0xe5f8cd={'where':{'id':_0x47a86c[_0xd46e('0x4b')]['id']}},_0x516e7d,_0x32eed0,_0x148187,_0x35db1b,_0x4f3ba0;_0xe5f8cd=_[_0xd46e('0x45')]({},_0xe5f8cd,_0x47a86c[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0xe5f8cd)[_0xd46e('0x27')](function(_0x16f906){if(_0x16f906){_0x516e7d=_0x16f906;return _0x16f906[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0x3e55a3){if(_0x3e55a3){if(!_0x3e55a3[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))](_0xd46e('0x6f'),0x193);}_0x32eed0=_0x3e55a3;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3e0ed5){if(_0x3e0ed5){_0x148187=_[_0xd46e('0x70')](_0x3e0ed5,'id');var _0x2fff69;var _0x249938=squel['select']();_0x249938[_0xd46e('0x71')](_0x516e7d[_0xd46e('0x72')]);for(var _0xfb4073=0x0;_0xfb4073<_0x32eed0[_0xd46e('0x3d')];_0xfb4073+=0x1){_0x2fff69=_0x32eed0[_0xfb4073]['MetricId']?_0x148187[_0x32eed0[_0xfb4073][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x32eed0[_0xfb4073]['field'];_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0xaf9641[_0x32eed0[_0xfb4073]['function']],'%s',_0x2fff69):_0x2fff69;_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x481dce[_0x32eed0[_0xfb4073]['format']],'%s',_0x2fff69):_0x2fff69;if(_0x32eed0[_0xfb4073][_0xd46e('0x78')]){_0x249938['group'](_0x2fff69);}_0x32eed0[_0xfb4073][_0xd46e('0x79')]&&_0x249938[_0xd46e('0x7a')](_0x2fff69,_0x32eed0[_0xfb4073]['orderBy']==='DESC'?![]:!![]);_0x249938[_0xd46e('0x6a')](_0x2fff69,_0x32eed0[_0xfb4073][_0xd46e('0x7b')]||_0x2fff69);}if(_0x516e7d[_0xd46e('0x7c')]){_0x516e7d[_0xd46e('0x7c')]=JSON['parse'](_0x516e7d[_0xd46e('0x7c')]);for(var _0x372509=0x0;_0x372509<_0x516e7d['joins'][_0xd46e('0x3d')];_0x372509+=0x1){if(_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0xe0cd61,_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')])&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7d')]&&_0x516e7d[_0xd46e('0x7c')][_0x372509]['foreignTable']&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7e')]){_0x249938[_0x516e7d['joins'][_0x372509][_0xd46e('0x36')]](_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0x516e7d[_0xd46e('0x72')],_0x516e7d['joins'][_0x372509]['parentKey'],_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],_0x516e7d['joins'][_0x372509]['foreignKey']));}}}if(_0x516e7d['conditions']){_0x516e7d[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x516e7d[_0xd46e('0x81')]);_0x249938['where'](_0x1aaa99(_0x516e7d[_0xd46e('0x81')][_0xd46e('0x69')]));}_0x4f3ba0=_0x249938[_0xd46e('0x83')]();_0x249938['limit'](_0x37a22f);_0x249938['offset'](0x0);logger['debug']('Limited\x20Query:',_0x249938[_0xd46e('0x84')]());return dbH['sequelize'][_0xd46e('0x38')](_0x249938['toString'](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](respondWithResult(_0x3ec709,null))[_0xd46e('0x4a')](handleError(_0x3ec709,null));};function runReport(_0xf16d87,_0x99872a,_0x57a7cc){var _0x586024=_0x99872a[_0xd46e('0x2f')];var _0x383919=0xa;var _0x114f2c=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0x4ca21f={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x5ef4cc={'SEC_TO_TIME':_0xd46e('0x87'),'DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x88460a=function(_0x3a3744){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x3a3744);};var _0x3c476d=function(_0x1b2a6d){if(!_0x1b2a6d||!_0x1b2a6d[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x441f73='(',_0x1d2738=0x0;_0x1d2738<_0x1b2a6d['rules'][_0xd46e('0x3d')];_0x1d2738+=0x1){_0x1d2738>0x0&&(_0x441f73+='\x20'+_0x1b2a6d['operator']+'\x20');_0x441f73+=_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x69')]?_0x3c476d(_0x1b2a6d['rules'][_0x1d2738][_0xd46e('0x69')]):_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6a')]+'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')]+(_0x88460a(_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')])?'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x88')]:'');}return _0x441f73+')';};var _0x3fa34d={'where':{'id':_0xf16d87['id']}},_0xc098c9,_0x5f5ba7,_0x493df5,_0x18e140,_0x459a0c;_0x3fa34d=_[_0xd46e('0x45')]({},_0x3fa34d,_0x57a7cc);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fa34d)[_0xd46e('0x27')](function(_0x5b554e){if(_0x5b554e){_0xc098c9=_0x5b554e;return _0x5b554e[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0xa254f5){if(_0xa254f5){if(!_0xa254f5[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5f5ba7=_0xa254f5;return db[_0xd46e('0x89')][_0xd46e('0x49')]({'raw':!![]});}return null;})['then'](function(_0x3c8d68){if(_0x3c8d68){_0x493df5=_[_0xd46e('0x70')](_0x3c8d68,'id');var _0x9e222d;var _0x3da17e=squel[_0xd46e('0x8a')]();_0x3da17e[_0xd46e('0x71')](_0xc098c9[_0xd46e('0x72')]);for(var _0x282f71=0x0;_0x282f71<_0x5f5ba7[_0xd46e('0x3d')];_0x282f71+=0x1){_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x73')]?_0x493df5[_0x5f5ba7[_0x282f71][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x5f5ba7[_0x282f71][_0xd46e('0x6a')];_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x75')]?_['replace'](_0x4ca21f[_0x5f5ba7[_0x282f71]['function']],'%s',_0x9e222d):_0x9e222d;_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x5ef4cc[_0x5f5ba7[_0x282f71][_0xd46e('0x77')]],'%s',_0x9e222d):_0x9e222d;if(_0x5f5ba7[_0x282f71][_0xd46e('0x78')]){_0x3da17e[_0xd46e('0x69')](_0x9e222d);}_0x5f5ba7[_0x282f71][_0xd46e('0x79')]&&_0x3da17e['order'](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x3da17e[_0xd46e('0x6a')](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x7b')]||_0x9e222d);}if(_0xc098c9['joins']){_0xc098c9[_0xd46e('0x7c')]=JSON[_0xd46e('0x82')](_0xc098c9['joins']);for(var _0xdf967c=0x0;_0xdf967c<_0xc098c9['joins']['length'];_0xdf967c+=0x1){if(_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x114f2c,_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['type'])&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7d')]&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7f')]&&_0xc098c9['joins'][_0xdf967c]['foreignKey']){_0x3da17e[_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]](_0xc098c9['joins'][_0xdf967c]['foreignTable'],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0xc098c9[_0xd46e('0x72')],_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['parentKey'],_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x7f')],_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7e')]));}}}if(_0xc098c9[_0xd46e('0x81')]){_0xc098c9[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0xc098c9[_0xd46e('0x81')]);_0x3da17e[_0xd46e('0x41')](_0x3c476d(_0xc098c9['conditions'][_0xd46e('0x69')]));}_0x459a0c=_0x3da17e[_0xd46e('0x83')]();_0x3da17e['limit'](_0x383919);_0x3da17e['offset'](0x0);return;}})[_0xd46e('0x27')](function(){if(_0x99872a[_0xd46e('0x8c')]==='web'){return null;}var _0x5e637d=_[_0xd46e('0x45')](_0x99872a,{'name':_0x99872a[_0xd46e('0x8d')]||_0x99872a['name']||_0xc098c9[_0xd46e('0x2f')],'basename':_0x586024,'savename':util[_0xd46e('0x77')](_0xd46e('0x8e'),_0x99872a[_0xd46e('0x2f')]||_0xc098c9[_0xd46e('0x2f')],require(_0xd46e('0x8f'))['generate'](0x4),_0x99872a[_0xd46e('0x8c')]||_0xd46e('0x90')),'reportId':_0xc098c9['id'],'reportType':_0xd46e('0x91')});return db[_0xd46e('0x92')][_0xd46e('0x4d')](_0x5e637d,{'raw':!![]});})[_0xd46e('0x27')](function(_0x3311a6){if(_0xc098c9[_0xd46e('0x72')]===_0xd46e('0x93')){_0x459a0c[_0xd46e('0x41')](_0xc098c9[_0xd46e('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x99872a[_0xd46e('0x94')],_0x99872a['endDate']);}else{_0x459a0c['where'](_0xc098c9[_0xd46e('0x72')]+_0xd46e('0x95'),_0x99872a[_0xd46e('0x94')],_0x99872a[_0xd46e('0x96')]);}if(_0x3311a6){logger[_0xd46e('0x97')](_0xd46e('0x98'),_0x459a0c[_0xd46e('0x84')]());require(_0xd46e('0x99'))['fork'](path[_0xd46e('0x55')](__dirname,'../../components/export/',_0x3311a6[_0xd46e('0x8c')]),[_0x3311a6['id'],_0x459a0c[_0xd46e('0x84')](),path[_0xd46e('0x55')](__dirname,_0xd46e('0x9a'),_0x3311a6[_0xd46e('0x9b')]),_0x586024]);return _0x3311a6;}else{var _0x399918=squel[_0xd46e('0x8a')]();_0x399918[_0xd46e('0x71')]('('+_0x459a0c['toString']()+')',_0xd46e('0x9c'));_0x399918[_0xd46e('0x6a')](_0xd46e('0x9d'),'count');_0x459a0c[_0xd46e('0x1f')](_0x99872a[_0xd46e('0x1f')]||_0x383919);_0x459a0c[_0xd46e('0x1d')](_0x99872a['offset']||0x0);return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x399918[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]})['then'](function(_0x4967ff){if(!_0x4967ff[_0xd46e('0x3d')]){_0x18e140=0x0;}else{_0x18e140=_0x4967ff[0x0][_0xd46e('0x20')]||0x0;}return dbH['sequelize'][_0xd46e('0x38')](_0x459a0c[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]});})[_0xd46e('0x27')](function(_0x4bb76b){return{'rows':_0x4bb76b||[],'count':_0x18e140};});}});}exports['run']=function(_0x204a9f,_0x52ca5a){return runReport(_0x204a9f[_0xd46e('0x4b')],_0x204a9f[_0xd46e('0x38')],_0x204a9f['options'])[_0xd46e('0x27')](respondWithResult(_0x52ca5a,null))[_0xd46e('0x4a')](handleError(_0x52ca5a,null));};exports[_0xd46e('0x9f')]=runReport;exports[_0xd46e('0x38')]=function(_0x786ae,_0x537c73){var _0x1610bd=0xa;var _0x20cc4c=[_0xd46e('0x55'),_0xd46e('0xa0'),_0xd46e('0x56'),_0xd46e('0x57')];var _0x368742={'SUM':_0xd46e('0x58'),'COUNT':_0xd46e('0xa1'),'COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':_0xd46e('0xa2'),'AVG':_0xd46e('0xa3'),'GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x285cf8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc87da2=function(_0x195f02){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),'IS\x20NOT\x20NULL',_0xd46e('0x65'),_0xd46e('0x66')],_0x195f02);};var _0x44322f=function(_0x49959f){if(!_0x49959f||!_0x49959f['rules'][_0xd46e('0x3d')]){return'';}for(var _0x2094e5='(',_0x85aac1=0x0;_0x85aac1<_0x49959f[_0xd46e('0x67')][_0xd46e('0x3d')];_0x85aac1+=0x1){_0x85aac1>0x0&&(_0x2094e5+='\x20'+_0x49959f[_0xd46e('0x68')]+'\x20');_0x2094e5+=_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]?_0x44322f(_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]):_0x49959f['rules'][_0x85aac1][_0xd46e('0x6a')]+'\x20'+_0x49959f['rules'][_0x85aac1]['condition']+(_0xc87da2(_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x6b')])?'\x20'+_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x88')]:'');}return _0x2094e5+')';};var _0x101a29={'where':{'id':_0x786ae[_0xd46e('0x4b')]['id']}},_0x3a44da,_0x417068,_0x52e73e,_0x206077,_0xe729b6;_0x101a29=_[_0xd46e('0x45')]({},_0x101a29,_0x786ae[_0xd46e('0x46')]);return db['AnalyticDefaultReport'][_0xd46e('0x4c')](_0x101a29)[_0xd46e('0x27')](function(_0x1d08bb){if(_0x1d08bb){_0x3a44da=_0x1d08bb;return _0x1d08bb['getFields']();}return null;})[_0xd46e('0x27')](function(_0x8c6ed1){if(_0x8c6ed1){if(!_0x8c6ed1['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xd46e('0x6f'),0x193);}_0x417068=_0x8c6ed1;return db[_0xd46e('0x89')]['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3a13f8){if(_0x3a13f8){_0x52e73e=_['keyBy'](_0x3a13f8,'id');var _0x5a8661;var _0x157fb0=squel[_0xd46e('0x8a')]();_0x157fb0[_0xd46e('0x71')](_0x3a44da[_0xd46e('0x72')]);for(var _0x50750f=0x0;_0x50750f<_0x417068['length'];_0x50750f+=0x1){_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x73')]?_0x52e73e[_0x417068[_0x50750f][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x417068[_0x50750f][_0xd46e('0x6a')];_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0x368742[_0x417068[_0x50750f][_0xd46e('0x75')]],'%s',_0x5a8661):_0x5a8661;_0x5a8661=_0x417068[_0x50750f]['format']?_[_0xd46e('0x76')](_0x285cf8[_0x417068[_0x50750f][_0xd46e('0x77')]],'%s',_0x5a8661):_0x5a8661;if(_0x417068[_0x50750f]['groupBy']){_0x157fb0[_0xd46e('0x69')](_0x5a8661);}_0x417068[_0x50750f][_0xd46e('0x79')]&&_0x157fb0[_0xd46e('0x7a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x157fb0[_0xd46e('0x6a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x7b')]||_0x5a8661);}if(_0x3a44da[_0xd46e('0x7c')]){_0x3a44da['joins']=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x7c')]);for(var _0x3c819b=0x0;_0x3c819b<_0x3a44da[_0xd46e('0x7c')][_0xd46e('0x3d')];_0x3c819b+=0x1){if(_0x3a44da['joins'][_0x3c819b][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x20cc4c,_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')])&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7d')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']){_0x157fb0[_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')]](_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3a44da[_0xd46e('0x72')],_0x3a44da['joins'][_0x3c819b][_0xd46e('0x7d')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']));}}}if(_0x3a44da[_0xd46e('0x81')]){_0x3a44da[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x81')]);_0x157fb0[_0xd46e('0x41')](_0x44322f(_0x3a44da[_0xd46e('0x81')][_0xd46e('0x69')]));}_0xe729b6=_0x157fb0[_0xd46e('0x83')]();_0x157fb0[_0xd46e('0x1f')](_0x1610bd);_0x157fb0['offset'](0x0);logger['debug'](_0xd46e('0xa4'),_0x157fb0['toString']());return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x157fb0[_0xd46e('0x84')](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](function(){return{'sql':_0xe729b6['toString']()};})['then'](respondWithResult(_0x537c73,null))[_0xd46e('0x4a')](handleError(_0x537c73,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index e877e05..2557505 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 _0x898e=['request-promise','rimraf','exports','define','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api','moment','bluebird'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x898e,0x171));var _0xe898=function(_0x41790c,_0x553b88){_0x41790c=_0x41790c-0x0;var _0x5c2f35=_0x898e[_0x41790c];return _0x5c2f35;};'use strict';var _=require('lodash');var util=require(_0xe898('0x0'));var logger=require(_0xe898('0x1'))(_0xe898('0x2'));var moment=require(_0xe898('0x3'));var BPromise=require(_0xe898('0x4'));var rp=require(_0xe898('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe898('0x6'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0xe898('0x7')]=function(_0x3371f7,_0x2f6c07){return _0x3371f7[_0xe898('0x8')](_0xe898('0x9'),attributes,{'tableName':_0xe898('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f8e=['analytics_default_reports','lodash','api','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x211bc3,_0x5860c8){var _0x34c9a2=function(_0x4bfa37){while(--_0x4bfa37){_0x211bc3['push'](_0x211bc3['shift']());}};_0x34c9a2(++_0x5860c8);}(_0x1f8e,0x177));var _0xe1f8=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1f8e[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xe1f8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe1f8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe1f8('0x2'));var fs=require('fs');var path=require(_0xe1f8('0x3'));var rimraf=require(_0xe1f8('0x4'));var config=require(_0xe1f8('0x5'));var attributes=require(_0xe1f8('0x6'));module[_0xe1f8('0x7')]=function(_0x4c77f3,_0x1a7d67){return _0x4c77f3[_0xe1f8('0x8')](_0xe1f8('0x9'),attributes,{'tableName':_0xe1f8('0xa'),'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 79a301d..40067c1 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 _0xb3ba=['request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x282f96,_0x2be4be){var _0x12d02b=function(_0x51cc9d){while(--_0x51cc9d){_0x282f96['push'](_0x282f96['shift']());}};_0x12d02b(++_0x2be4be);}(_0xb3ba,0xcf));var _0xab3b=function(_0x26228a,_0xd64290){_0x26228a=_0x26228a-0x0;var _0x49e9ca=_0xb3ba[_0x26228a];return _0x49e9ca;};'use strict';var _=require(_0xab3b('0x0'));var util=require(_0xab3b('0x1'));var moment=require(_0xab3b('0x2'));var BPromise=require(_0xab3b('0x3'));var rs=require(_0xab3b('0x4'));var fs=require('fs');var Redis=require(_0xab3b('0x5'));var db=require(_0xab3b('0x6'))['db'];var utils=require(_0xab3b('0x7'));var logger=require(_0xab3b('0x8'))(_0xab3b('0x9'));var config=require('../../config/environment');var jayson=require(_0xab3b('0xa'));var client=jayson[_0xab3b('0xb')][_0xab3b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2db861,_0x47f26a,_0x32f5d4){return new BPromise(function(_0x1e44c3,_0x3e6f45){return client[_0xab3b('0xd')](_0x2db861,_0x32f5d4)['then'](function(_0x1fd6dd){logger[_0xab3b('0xe')](_0xab3b('0xf'),_0x47f26a,_0xab3b('0x10'));logger[_0xab3b('0x11')](_0xab3b('0x12'),_0x47f26a,_0xab3b('0x10'),JSON['stringify'](_0x1fd6dd));if(_0x1fd6dd[_0xab3b('0x13')]){if(_0x1fd6dd[_0xab3b('0x13')]['code']===0x1f4){logger[_0xab3b('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x47f26a,_0x1fd6dd[_0xab3b('0x13')][_0xab3b('0x14')]);return _0x3e6f45(_0x1fd6dd[_0xab3b('0x13')][_0xab3b('0x14')]);}logger[_0xab3b('0x13')](_0xab3b('0xf'),_0x47f26a,_0x1fd6dd[_0xab3b('0x13')][_0xab3b('0x14')]);return _0x1e44c3(_0x1fd6dd[_0xab3b('0x13')][_0xab3b('0x14')]);}else{logger['info'](_0xab3b('0xf'),_0x47f26a,_0xab3b('0x10'));_0x1e44c3(_0x1fd6dd[_0xab3b('0x15')][_0xab3b('0x14')]);}})['catch'](function(_0x21a720){logger[_0xab3b('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x47f26a,_0x21a720);_0x3e6f45(_0x21a720);});});} \ No newline at end of file +var _0xb810=['debug','request\x20sent','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xb810,0x159));var _0x0b81=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb810[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x0b81('0x0'));var util=require('util');var moment=require(_0x0b81('0x1'));var BPromise=require(_0x0b81('0x2'));var rs=require(_0x0b81('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b81('0x4'))['db'];var utils=require(_0x0b81('0x5'));var logger=require('../../config/logger')(_0x0b81('0x6'));var config=require('../../config/environment');var jayson=require(_0x0b81('0x7'));var client=jayson[_0x0b81('0x8')][_0x0b81('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b5557,_0x50ea44,_0x57b1ae){return new BPromise(function(_0x31e003,_0x5aa643){return client['request'](_0x1b5557,_0x57b1ae)['then'](function(_0x18d359){logger[_0x0b81('0xa')](_0x0b81('0xb'),_0x50ea44,'request\x20sent');logger[_0x0b81('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x50ea44,_0x0b81('0xd'),JSON['stringify'](_0x18d359));if(_0x18d359[_0x0b81('0xe')]){if(_0x18d359[_0x0b81('0xe')]['code']===0x1f4){logger['error'](_0x0b81('0xb'),_0x50ea44,_0x18d359[_0x0b81('0xe')][_0x0b81('0xf')]);return _0x5aa643(_0x18d359[_0x0b81('0xe')]['message']);}logger[_0x0b81('0xe')](_0x0b81('0xb'),_0x50ea44,_0x18d359[_0x0b81('0xe')][_0x0b81('0xf')]);return _0x31e003(_0x18d359[_0x0b81('0xe')]['message']);}else{logger[_0x0b81('0xa')](_0x0b81('0xb'),_0x50ea44,_0x0b81('0xd'));_0x31e003(_0x18d359[_0x0b81('0x10')][_0x0b81('0xf')]);}})['catch'](function(_0xd01926){logger[_0x0b81('0xe')](_0x0b81('0xb'),_0x50ea44,_0xd01926);_0x5aa643(_0xd01926);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index eee8d33..039e179 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 _0x1794=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','show','/:id/preview','/:id/run','run','query','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x4b2041,_0x32eb5f){var _0x49a7db=function(_0x421c9f){while(--_0x421c9f){_0x4b2041['push'](_0x4b2041['shift']());}};_0x49a7db(++_0x32eb5f);}(_0x1794,0x1f3));var _0x4179=function(_0xf2894c,_0x404d68){_0xf2894c=_0xf2894c-0x0;var _0xe47562=_0x1794[_0xf2894c];return _0xe47562;};'use strict';var multer=require(_0x4179('0x0'));var util=require(_0x4179('0x1'));var path=require(_0x4179('0x2'));var timeout=require(_0x4179('0x3'));var express=require(_0x4179('0x4'));var router=express[_0x4179('0x5')]();var fs_extra=require(_0x4179('0x6'));var auth=require(_0x4179('0x7'));var interaction=require(_0x4179('0x8'));var config=require(_0x4179('0x9'));var controller=require(_0x4179('0xa'));router['get']('/',auth[_0x4179('0xb')](),controller[_0x4179('0xc')]);router[_0x4179('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x4179('0xe')]);router['get'](_0x4179('0xf'),auth[_0x4179('0xb')](),controller['preview']);router[_0x4179('0xd')](_0x4179('0x10'),auth[_0x4179('0xb')](),controller[_0x4179('0x11')]);router[_0x4179('0xd')]('/:id/query',auth[_0x4179('0xb')](),controller[_0x4179('0x12')]);router['post']('/',auth[_0x4179('0xb')](),controller[_0x4179('0x13')]);router[_0x4179('0x14')](_0x4179('0x15'),auth[_0x4179('0xb')](),controller[_0x4179('0x16')]);router['delete'](_0x4179('0x15'),auth[_0x4179('0xb')](),controller[_0x4179('0x17')]);module['exports']=router; \ No newline at end of file +var _0x8e34=['/:id/query','query','create','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/run','run'];(function(_0x1192f3,_0x69e7a0){var _0x1ae852=function(_0x253784){while(--_0x253784){_0x1192f3['push'](_0x1192f3['shift']());}};_0x1ae852(++_0x69e7a0);}(_0x8e34,0x1bf));var _0x48e3=function(_0x48d249,_0x41c005){_0x48d249=_0x48d249-0x0;var _0x341cc4=_0x8e34[_0x48d249];return _0x341cc4;};'use strict';var multer=require(_0x48e3('0x0'));var util=require('util');var path=require(_0x48e3('0x1'));var timeout=require('connect-timeout');var express=require(_0x48e3('0x2'));var router=express[_0x48e3('0x3')]();var fs_extra=require(_0x48e3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x48e3('0x5'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x48e3('0x6')]('/',auth[_0x48e3('0x7')](),controller[_0x48e3('0x8')]);router[_0x48e3('0x6')](_0x48e3('0x9'),auth['isAuthenticated'](),controller[_0x48e3('0xa')]);router[_0x48e3('0x6')]('/:id/preview',auth[_0x48e3('0x7')](),controller['preview']);router['get'](_0x48e3('0xb'),auth[_0x48e3('0x7')](),controller[_0x48e3('0xc')]);router[_0x48e3('0x6')](_0x48e3('0xd'),auth[_0x48e3('0x7')](),controller[_0x48e3('0xe')]);router['post']('/',auth[_0x48e3('0x7')](),controller[_0x48e3('0xf')]);router['put'](_0x48e3('0x9'),auth['isAuthenticated'](),controller[_0x48e3('0x10')]);router[_0x48e3('0x11')](_0x48e3('0x9'),auth[_0x48e3('0x7')](),controller[_0x48e3('0x12')]);module[_0x48e3('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 1ee10b9..6af04b5 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 _0x5173=['ENUM','scheduled','manual','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','csv','pdf','DATE','Loading'];(function(_0x19115e,_0x507bab){var _0x45bbd4=function(_0x1308bf){while(--_0x1308bf){_0x19115e['push'](_0x19115e['shift']());}};_0x45bbd4(++_0x507bab);}(_0x5173,0x130));var _0x3517=function(_0x1981d4,_0x428004){_0x1981d4=_0x1981d4-0x0;var _0x4ee399=_0x5173[_0x1981d4];return _0x4ee399;};'use strict';var Sequelize=require(_0x3517('0x0'));var moment=require(_0x3517('0x1'));module[_0x3517('0x2')]={'name':{'type':Sequelize[_0x3517('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x3517('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x3517('0x4'),_0x3517('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x3517('0x4')},'savename':{'type':Sequelize[_0x3517('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x3517('0x6')]},'status':{'type':Sequelize[_0x3517('0x3')],'defaultValue':_0x3517('0x7')},'type':{'type':Sequelize[_0x3517('0x8')]('manual',_0x3517('0x9')),'allowNull':![],'defaultValue':_0x3517('0xa')},'reportId':{'type':Sequelize[_0x3517('0xb')](0xb)[_0x3517('0xc')]},'reportType':{'type':Sequelize[_0x3517('0x3')]}}; \ No newline at end of file +var _0x1111=['pdf','xlsx','DATE','Loading','ENUM','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING','csv'];(function(_0x2d25d1,_0x1f634d){var _0x5be9e5=function(_0x422beb){while(--_0x422beb){_0x2d25d1['push'](_0x2d25d1['shift']());}};_0x5be9e5(++_0x1f634d);}(_0x1111,0x19b));var _0x1111=function(_0x22a783,_0x43e533){_0x22a783=_0x22a783-0x0;var _0x4cfac9=_0x1111[_0x22a783];return _0x4cfac9;};'use strict';var Sequelize=require(_0x1111('0x0'));var moment=require(_0x1111('0x1'));module[_0x1111('0x2')]={'name':{'type':Sequelize[_0x1111('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x1111('0x4'),_0x1111('0x5'),_0x1111('0x6')),'allowNull':![],'defaultValue':_0x1111('0x4')},'savename':{'type':Sequelize[_0x1111('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x1111('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x1111('0x8')},'type':{'type':Sequelize[_0x1111('0x9')](_0x1111('0xa'),_0x1111('0xb')),'allowNull':![],'defaultValue':_0x1111('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x1111('0xc')]},'reportType':{'type':Sequelize[_0x1111('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 37fe939..f6f671b 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 _0xd87f=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','server/files/reports','Sequelize','root','%s.%s','toLowerCase','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','ExtractedReports','UserProfileResource','sendStatus','error','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes'];(function(_0x32eb2b,_0xf64764){var _0x3ed75f=function(_0x38e737){while(--_0x38e737){_0x32eb2b['push'](_0x32eb2b['shift']());}};_0x3ed75f(++_0xf64764);}(_0xd87f,0x86));var _0xfd87=function(_0x25aed7,_0x2536e6){_0x25aed7=_0x25aed7-0x0;var _0x395b1b=_0xd87f[_0x25aed7];return _0x395b1b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfd87('0x0'));var jsonpatch=require(_0xfd87('0x1'));var rp=require(_0xfd87('0x2'));var moment=require(_0xfd87('0x3'));var BPromise=require(_0xfd87('0x4'));var Mustache=require(_0xfd87('0x5'));var util=require(_0xfd87('0x6'));var path=require(_0xfd87('0x7'));var sox=require('sox');var csv=require(_0xfd87('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfd87('0x9'));var _=require(_0xfd87('0xa'));var squel=require(_0xfd87('0xb'));var crypto=require(_0xfd87('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfd87('0xd'));var toCsv=require(_0xfd87('0x8'));var querystring=require(_0xfd87('0xe'));var Papa=require(_0xfd87('0xf'));var Redis=require(_0xfd87('0x10'));var authService=require(_0xfd87('0x11'));var qs=require(_0xfd87('0x12'));var as=require(_0xfd87('0x13'));var hardwareService=require(_0xfd87('0x14'));var logger=require(_0xfd87('0x15'))(_0xfd87('0x16'));var utils=require(_0xfd87('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfd87('0x18'));var db=require(_0xfd87('0x19'))['db'];function respondWithStatusCode(_0x1e808f,_0x27a82f){_0x27a82f=_0x27a82f||0xcc;return function(_0x51f492){if(_0x51f492){return _0x1e808f['sendStatus'](_0x27a82f);}return _0x1e808f[_0xfd87('0x1a')](_0x27a82f)[_0xfd87('0x1b')]();};}function respondWithResult(_0x569d39,_0x5489ac){_0x5489ac=_0x5489ac||0xc8;return function(_0x5c24b2){if(_0x5c24b2){return _0x569d39[_0xfd87('0x1a')](_0x5489ac)[_0xfd87('0x1c')](_0x5c24b2);}};}function respondWithFilteredResult(_0x2dd3e8,_0x3e7c9){return function(_0x429c45){if(_0x429c45){var _0x13f74e=typeof _0x3e7c9[_0xfd87('0x1d')]===_0xfd87('0x1e')&&typeof _0x3e7c9[_0xfd87('0x1f')]===_0xfd87('0x1e');var _0x248f65=_0x429c45['count'];var _0x398fcf=_0x13f74e?0x0:_0x3e7c9[_0xfd87('0x1d')];var _0x5b1c84=_0x13f74e?_0x429c45[_0xfd87('0x20')]:_0x3e7c9[_0xfd87('0x1d')]+_0x3e7c9['limit'];var _0x75c60a;if(_0x5b1c84>=_0x248f65){_0x5b1c84=_0x248f65;_0x75c60a=0xc8;}else{_0x75c60a=0xce;}_0x2dd3e8[_0xfd87('0x1a')](_0x75c60a);return _0x2dd3e8['set'](_0xfd87('0x21'),_0x398fcf+'-'+_0x5b1c84+'/'+_0x248f65)[_0xfd87('0x1c')](_0x429c45);}return null;};}function patchUpdates(_0x1302fc){return function(_0x22bf29){try{jsonpatch[_0xfd87('0x22')](_0x22bf29,_0x1302fc,!![]);}catch(_0x33b95d){return BPromise[_0xfd87('0x23')](_0x33b95d);}return _0x22bf29[_0xfd87('0x24')]();};}function saveUpdates(_0x3c4453,_0x1a000b){return function(_0x3ca663){if(_0x3ca663){return _0x3ca663[_0xfd87('0x25')](_0x3c4453)['then'](function(_0x50a2f7){return _0x50a2f7;});}return null;};}function removeEntity(_0x3035fd,_0x392378){return function(_0x18fa5a){if(_0x18fa5a){return _0x18fa5a[_0xfd87('0x26')]()[_0xfd87('0x27')](function(){var _0x1a1f1a=_0x18fa5a[_0xfd87('0x28')]({'plain':!![]});var _0x3175df=_0xfd87('0x29');return db[_0xfd87('0x2a')][_0xfd87('0x26')]({'where':{'type':_0x3175df,'resourceId':_0x1a1f1a['id']}})['then'](function(){return _0x18fa5a;});})['then'](function(){_0x3035fd['status'](0xcc)[_0xfd87('0x1b')]();});}};}function handleEntityNotFound(_0x220b60,_0x4f99ad){return function(_0x4da17d){if(!_0x4da17d){_0x220b60[_0xfd87('0x2b')](0x194);}return _0x4da17d;};}function handleError(_0x1b3ecf,_0x397417){_0x397417=_0x397417||0x1f4;return function(_0x71aea4){logger[_0xfd87('0x2c')](_0x71aea4['stack']);if(_0x71aea4['name']){delete _0x71aea4[_0xfd87('0x2d')];}_0x1b3ecf[_0xfd87('0x1a')](_0x397417)[_0xfd87('0x2e')](_0x71aea4);};}exports[_0xfd87('0x2f')]=function(_0x5eaa04,_0x562b31){var _0x555a9a={},_0x42d9b7={},_0x2801cf={'count':0x0,'rows':[]};var _0x57188d=_['map'](db[_0xfd87('0x30')][_0xfd87('0x31')],function(_0x4422ff){return{'name':_0x4422ff[_0xfd87('0x32')],'type':_0x4422ff[_0xfd87('0x33')][_0xfd87('0x34')]};});_0x42d9b7['model']=_['map'](_0x57188d,'name');_0x42d9b7[_0xfd87('0x35')]=_[_0xfd87('0x36')](_0x5eaa04['query']);_0x42d9b7[_0xfd87('0x37')]=_[_0xfd87('0x38')](_0x42d9b7['model'],_0x42d9b7[_0xfd87('0x35')]);_0x555a9a['attributes']=_['intersection'](_0x42d9b7[_0xfd87('0x39')],qs[_0xfd87('0x3a')](_0x5eaa04['query']['fields']));_0x555a9a['attributes']=_0x555a9a[_0xfd87('0x3b')]['length']?_0x555a9a[_0xfd87('0x3b')]:_0x42d9b7[_0xfd87('0x39')];if(!_0x5eaa04['query'][_0xfd87('0x3c')](_0xfd87('0x3d'))){_0x555a9a['limit']=qs['limit'](_0x5eaa04['query']['limit']);_0x555a9a[_0xfd87('0x1d')]=qs['offset'](_0x5eaa04[_0xfd87('0x35')]['offset']);}_0x555a9a[_0xfd87('0x3e')]=qs[_0xfd87('0x3f')](_0x5eaa04['query'][_0xfd87('0x3f')]);_0x555a9a[_0xfd87('0x40')]=qs[_0xfd87('0x37')](_[_0xfd87('0x41')](_0x5eaa04['query'],_0x42d9b7['filters']),_0x57188d);if(_0x5eaa04[_0xfd87('0x35')][_0xfd87('0x42')]){_0x555a9a['where']=_[_0xfd87('0x43')](_0x555a9a[_0xfd87('0x40')],{'$or':_[_0xfd87('0x44')](_0x57188d,function(_0x3fc3c2){if(_0x3fc3c2[_0xfd87('0x33')]!==_0xfd87('0x45')){var _0x3ceb04={};_0x3ceb04[_0x3fc3c2[_0xfd87('0x2d')]]={'$like':'%'+_0x5eaa04[_0xfd87('0x35')][_0xfd87('0x42')]+'%'};return _0x3ceb04;}})});}_0x555a9a=_[_0xfd87('0x43')]({},_0x555a9a,_0x5eaa04[_0xfd87('0x46')]);var _0x4b05bd={'where':_0x555a9a[_0xfd87('0x40')]};return db[_0xfd87('0x30')][_0xfd87('0x20')](_0x4b05bd)[_0xfd87('0x27')](function(_0x5eaae4){_0x2801cf[_0xfd87('0x20')]=_0x5eaae4;if(_0x5eaa04[_0xfd87('0x35')][_0xfd87('0x47')]){_0x555a9a[_0xfd87('0x48')]=[{'all':!![]}];}return db[_0xfd87('0x30')]['findAll'](_0x555a9a);})[_0xfd87('0x27')](function(_0x3e6d6b){_0x2801cf['rows']=_0x3e6d6b;return _0x2801cf;})[_0xfd87('0x27')](respondWithFilteredResult(_0x562b31,_0x555a9a))[_0xfd87('0x49')](handleError(_0x562b31,null));};exports[_0xfd87('0x4a')]=function(_0x32cc6a,_0x1778cd){var _0xd2fb3c={'raw':!![],'where':{'id':_0x32cc6a[_0xfd87('0x4b')]['id']}},_0x1928e8={};_0x1928e8[_0xfd87('0x39')]=_['keys'](db[_0xfd87('0x30')][_0xfd87('0x31')]);_0x1928e8['query']=_['keys'](_0x32cc6a[_0xfd87('0x35')]);_0x1928e8['filters']=_[_0xfd87('0x38')](_0x1928e8[_0xfd87('0x39')],_0x1928e8['query']);_0xd2fb3c['attributes']=_[_0xfd87('0x38')](_0x1928e8['model'],qs[_0xfd87('0x3a')](_0x32cc6a[_0xfd87('0x35')][_0xfd87('0x3a')]));_0xd2fb3c[_0xfd87('0x3b')]=_0xd2fb3c[_0xfd87('0x3b')][_0xfd87('0x4c')]?_0xd2fb3c[_0xfd87('0x3b')]:_0x1928e8[_0xfd87('0x39')];if(_0x32cc6a['query']['includeAll']){_0xd2fb3c[_0xfd87('0x48')]=[{'all':!![]}];}_0xd2fb3c=_['merge']({},_0xd2fb3c,_0x32cc6a[_0xfd87('0x46')]);return db[_0xfd87('0x30')][_0xfd87('0x4d')](_0xd2fb3c)[_0xfd87('0x27')](handleEntityNotFound(_0x1778cd,null))[_0xfd87('0x27')](respondWithResult(_0x1778cd,null))[_0xfd87('0x49')](handleError(_0x1778cd,null));};exports['create']=function(_0x134b56,_0x30b8ab){return db['AnalyticExtractedReport'][_0xfd87('0x4e')](_0x134b56[_0xfd87('0x4f')],{})[_0xfd87('0x27')](function(_0x366f0e){var _0x116a18=_0x134b56[_0xfd87('0x50')][_0xfd87('0x28')]({'plain':!![]});if(!_0x116a18)throw new Error(_0xfd87('0x51'));if(_0x116a18[_0xfd87('0x52')]==='user'){var _0x1e5adb=_0x366f0e[_0xfd87('0x28')]({'plain':!![]});var _0x1d2084=_0xfd87('0x29');return db['UserProfileSection'][_0xfd87('0x4d')]({'where':{'name':_0x1d2084,'userProfileId':_0x116a18[_0xfd87('0x53')]},'raw':!![]})[_0xfd87('0x27')](function(_0x2d65ca){if(_0x2d65ca&&_0x2d65ca[_0xfd87('0x54')]===0x0){return db[_0xfd87('0x2a')]['create']({'name':_0x1e5adb[_0xfd87('0x2d')],'resourceId':_0x1e5adb['id'],'type':_0x2d65ca['name'],'sectionId':_0x2d65ca['id']},{})['then'](function(){return _0x366f0e;});}else{return _0x366f0e;}})[_0xfd87('0x49')](function(_0x450acb){logger[_0xfd87('0x2c')](_0xfd87('0x55'),_0x450acb);throw _0x450acb;});}return _0x366f0e;})['then'](respondWithResult(_0x30b8ab,0xc9))[_0xfd87('0x49')](handleError(_0x30b8ab,null));};exports[_0xfd87('0x25')]=function(_0xbf101f,_0x388491){if(_0xbf101f['body']['id']){delete _0xbf101f[_0xfd87('0x4f')]['id'];}return db['AnalyticExtractedReport'][_0xfd87('0x4d')]({'where':{'id':_0xbf101f['params']['id']}})[_0xfd87('0x27')](handleEntityNotFound(_0x388491,null))['then'](saveUpdates(_0xbf101f[_0xfd87('0x4f')],null))[_0xfd87('0x27')](respondWithResult(_0x388491,null))[_0xfd87('0x49')](handleError(_0x388491,null));};exports[_0xfd87('0x26')]=function(_0x11352a,_0x1af9b8){return db['AnalyticExtractedReport'][_0xfd87('0x4d')]({'where':{'id':_0x11352a[_0xfd87('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1af9b8,null))[_0xfd87('0x27')](removeEntity(_0x1af9b8,null))[_0xfd87('0x49')](handleError(_0x1af9b8,null));};exports[_0xfd87('0x56')]=function(_0x1bb62f,_0xee8541,_0x497088){return db['AnalyticExtractedReport'][_0xfd87('0x4d')]({'where':{'id':_0x1bb62f[_0xfd87('0x4b')]['id']},'attributes':[_0xfd87('0x2d'),_0xfd87('0x57'),_0xfd87('0x58'),_0xfd87('0x59')],'raw':!![]})[_0xfd87('0x27')](handleEntityNotFound(_0xee8541,null))[_0xfd87('0x27')](function(_0x4ea0b4){if(_0x4ea0b4){if(!fs[_0xfd87('0x5a')](path[_0xfd87('0x5b')](config['root'],_0xfd87('0x5c'),_0x4ea0b4[_0xfd87('0x58')]))){throw new db[(_0xfd87('0x5d'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x1bb62f['query']['exists']){return _0xee8541[_0xfd87('0x2b')](0xc8);}return _0xee8541[_0xfd87('0x56')](path[_0xfd87('0x5b')](config[_0xfd87('0x5e')],_0xfd87('0x5c'),_0x4ea0b4[_0xfd87('0x58')]),util['format'](_0xfd87('0x5f'),_0x4ea0b4['basename']||_0x4ea0b4[_0xfd87('0x2d')],_0x4ea0b4[_0xfd87('0x59')][_0xfd87('0x60')]()));}})['catch'](handleError(_0xee8541,null));}; \ No newline at end of file +var _0x8779=['eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','get','ExtractedReports','UserProfileResource','stack','name','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','params','output','existsSync','join','root','server/files/reports','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','format','%s.%s','basename','toLowerCase'];(function(_0x4207c3,_0x1278a2){var _0x4845c9=function(_0x4a1365){while(--_0x4a1365){_0x4207c3['push'](_0x4207c3['shift']());}};_0x4845c9(++_0x1278a2);}(_0x8779,0xc0));var _0x9877=function(_0x35aae8,_0xab007a){_0x35aae8=_0x35aae8-0x0;var _0xd9f10c=_0x8779[_0x35aae8];return _0xd9f10c;};'use strict';var emlformat=require(_0x9877('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9877('0x1'));var jsonpatch=require(_0x9877('0x2'));var rp=require('request-promise');var moment=require(_0x9877('0x3'));var BPromise=require(_0x9877('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9877('0x5'));var sox=require(_0x9877('0x6'));var csv=require(_0x9877('0x7'));var ejs=require(_0x9877('0x8'));var fs=require('fs');var fs_extra=require(_0x9877('0x9'));var _=require(_0x9877('0xa'));var squel=require(_0x9877('0xb'));var crypto=require(_0x9877('0xc'));var jsforce=require(_0x9877('0xd'));var deskjs=require(_0x9877('0xe'));var toCsv=require(_0x9877('0x7'));var querystring=require('querystring');var Papa=require(_0x9877('0xf'));var Redis=require('ioredis');var authService=require(_0x9877('0x10'));var qs=require(_0x9877('0x11'));var as=require(_0x9877('0x12'));var hardwareService=require(_0x9877('0x13'));var logger=require(_0x9877('0x14'))(_0x9877('0x15'));var utils=require(_0x9877('0x16'));var config=require(_0x9877('0x17'));var licenseUtil=require(_0x9877('0x18'));var db=require(_0x9877('0x19'))['db'];function respondWithStatusCode(_0xb9a8aa,_0x1c1bfb){_0x1c1bfb=_0x1c1bfb||0xcc;return function(_0x51bc21){if(_0x51bc21){return _0xb9a8aa[_0x9877('0x1a')](_0x1c1bfb);}return _0xb9a8aa[_0x9877('0x1b')](_0x1c1bfb)[_0x9877('0x1c')]();};}function respondWithResult(_0x332f62,_0x2cbe07){_0x2cbe07=_0x2cbe07||0xc8;return function(_0xe81b28){if(_0xe81b28){return _0x332f62[_0x9877('0x1b')](_0x2cbe07)[_0x9877('0x1d')](_0xe81b28);}};}function respondWithFilteredResult(_0xa013d7,_0x2061d7){return function(_0x1cd9a8){if(_0x1cd9a8){var _0x560e67=typeof _0x2061d7[_0x9877('0x1e')]===_0x9877('0x1f')&&typeof _0x2061d7[_0x9877('0x20')]==='undefined';var _0x22b5fd=_0x1cd9a8[_0x9877('0x21')];var _0x2cb7fa=_0x560e67?0x0:_0x2061d7[_0x9877('0x1e')];var _0x3765dc=_0x560e67?_0x1cd9a8[_0x9877('0x21')]:_0x2061d7[_0x9877('0x1e')]+_0x2061d7[_0x9877('0x20')];var _0x3d0cd3;if(_0x3765dc>=_0x22b5fd){_0x3765dc=_0x22b5fd;_0x3d0cd3=0xc8;}else{_0x3d0cd3=0xce;}_0xa013d7[_0x9877('0x1b')](_0x3d0cd3);return _0xa013d7[_0x9877('0x22')](_0x9877('0x23'),_0x2cb7fa+'-'+_0x3765dc+'/'+_0x22b5fd)['json'](_0x1cd9a8);}return null;};}function patchUpdates(_0x339630){return function(_0x17ed32){try{jsonpatch[_0x9877('0x24')](_0x17ed32,_0x339630,!![]);}catch(_0x5e2b67){return BPromise['reject'](_0x5e2b67);}return _0x17ed32['save']();};}function saveUpdates(_0xecd2d8,_0x239e9d){return function(_0x4f0d95){if(_0x4f0d95){return _0x4f0d95[_0x9877('0x25')](_0xecd2d8)['then'](function(_0x1be3c3){return _0x1be3c3;});}return null;};}function removeEntity(_0x168e68,_0x26515e){return function(_0x5127f6){if(_0x5127f6){return _0x5127f6[_0x9877('0x26')]()[_0x9877('0x27')](function(){var _0x39a812=_0x5127f6[_0x9877('0x28')]({'plain':!![]});var _0x137e60=_0x9877('0x29');return db[_0x9877('0x2a')][_0x9877('0x26')]({'where':{'type':_0x137e60,'resourceId':_0x39a812['id']}})[_0x9877('0x27')](function(){return _0x5127f6;});})[_0x9877('0x27')](function(){_0x168e68[_0x9877('0x1b')](0xcc)[_0x9877('0x1c')]();});}};}function handleEntityNotFound(_0x4c2a34,_0x28583f){return function(_0x536918){if(!_0x536918){_0x4c2a34[_0x9877('0x1a')](0x194);}return _0x536918;};}function handleError(_0x31f51b,_0x4467f9){_0x4467f9=_0x4467f9||0x1f4;return function(_0x2e1d78){logger['error'](_0x2e1d78[_0x9877('0x2b')]);if(_0x2e1d78[_0x9877('0x2c')]){delete _0x2e1d78['name'];}_0x31f51b[_0x9877('0x1b')](_0x4467f9)['send'](_0x2e1d78);};}exports[_0x9877('0x2d')]=function(_0x20fbae,_0x49c3e4){var _0x13fe75={},_0x462929={},_0x22510b={'count':0x0,'rows':[]};var _0x1bdaae=_[_0x9877('0x2e')](db[_0x9877('0x2f')][_0x9877('0x30')],function(_0x330ba3){return{'name':_0x330ba3['fieldName'],'type':_0x330ba3[_0x9877('0x31')][_0x9877('0x32')]};});_0x462929[_0x9877('0x33')]=_[_0x9877('0x2e')](_0x1bdaae,'name');_0x462929[_0x9877('0x34')]=_[_0x9877('0x35')](_0x20fbae[_0x9877('0x34')]);_0x462929[_0x9877('0x36')]=_[_0x9877('0x37')](_0x462929[_0x9877('0x33')],_0x462929[_0x9877('0x34')]);_0x13fe75[_0x9877('0x38')]=_['intersection'](_0x462929[_0x9877('0x33')],qs[_0x9877('0x39')](_0x20fbae[_0x9877('0x34')]['fields']));_0x13fe75[_0x9877('0x38')]=_0x13fe75[_0x9877('0x38')][_0x9877('0x3a')]?_0x13fe75[_0x9877('0x38')]:_0x462929[_0x9877('0x33')];if(!_0x20fbae['query'][_0x9877('0x3b')](_0x9877('0x3c'))){_0x13fe75[_0x9877('0x20')]=qs[_0x9877('0x20')](_0x20fbae[_0x9877('0x34')][_0x9877('0x20')]);_0x13fe75['offset']=qs[_0x9877('0x1e')](_0x20fbae['query'][_0x9877('0x1e')]);}_0x13fe75[_0x9877('0x3d')]=qs[_0x9877('0x3e')](_0x20fbae[_0x9877('0x34')][_0x9877('0x3e')]);_0x13fe75[_0x9877('0x3f')]=qs['filters'](_[_0x9877('0x40')](_0x20fbae[_0x9877('0x34')],_0x462929['filters']),_0x1bdaae);if(_0x20fbae[_0x9877('0x34')][_0x9877('0x41')]){_0x13fe75[_0x9877('0x3f')]=_[_0x9877('0x42')](_0x13fe75['where'],{'$or':_[_0x9877('0x2e')](_0x1bdaae,function(_0x349834){if(_0x349834[_0x9877('0x31')]!==_0x9877('0x43')){var _0x369235={};_0x369235[_0x349834[_0x9877('0x2c')]]={'$like':'%'+_0x20fbae[_0x9877('0x34')]['filter']+'%'};return _0x369235;}})});}_0x13fe75=_[_0x9877('0x42')]({},_0x13fe75,_0x20fbae['options']);var _0x19b685={'where':_0x13fe75[_0x9877('0x3f')]};return db['AnalyticExtractedReport'][_0x9877('0x21')](_0x19b685)[_0x9877('0x27')](function(_0x2b6df4){_0x22510b[_0x9877('0x21')]=_0x2b6df4;if(_0x20fbae[_0x9877('0x34')][_0x9877('0x44')]){_0x13fe75[_0x9877('0x45')]=[{'all':!![]}];}return db[_0x9877('0x2f')]['findAll'](_0x13fe75);})['then'](function(_0x39d866){_0x22510b[_0x9877('0x46')]=_0x39d866;return _0x22510b;})[_0x9877('0x27')](respondWithFilteredResult(_0x49c3e4,_0x13fe75))['catch'](handleError(_0x49c3e4,null));};exports[_0x9877('0x47')]=function(_0x3f8b19,_0x7abeb8){var _0x13fe4e={'raw':!![],'where':{'id':_0x3f8b19['params']['id']}},_0xd3b411={};_0xd3b411[_0x9877('0x33')]=_[_0x9877('0x35')](db[_0x9877('0x2f')]['rawAttributes']);_0xd3b411[_0x9877('0x34')]=_[_0x9877('0x35')](_0x3f8b19[_0x9877('0x34')]);_0xd3b411[_0x9877('0x36')]=_[_0x9877('0x37')](_0xd3b411[_0x9877('0x33')],_0xd3b411['query']);_0x13fe4e[_0x9877('0x38')]=_[_0x9877('0x37')](_0xd3b411['model'],qs[_0x9877('0x39')](_0x3f8b19[_0x9877('0x34')][_0x9877('0x39')]));_0x13fe4e[_0x9877('0x38')]=_0x13fe4e[_0x9877('0x38')][_0x9877('0x3a')]?_0x13fe4e['attributes']:_0xd3b411['model'];if(_0x3f8b19[_0x9877('0x34')][_0x9877('0x44')]){_0x13fe4e[_0x9877('0x45')]=[{'all':!![]}];}_0x13fe4e=_[_0x9877('0x42')]({},_0x13fe4e,_0x3f8b19[_0x9877('0x48')]);return db[_0x9877('0x2f')][_0x9877('0x49')](_0x13fe4e)[_0x9877('0x27')](handleEntityNotFound(_0x7abeb8,null))['then'](respondWithResult(_0x7abeb8,null))[_0x9877('0x4a')](handleError(_0x7abeb8,null));};exports[_0x9877('0x4b')]=function(_0xbce761,_0x5cd24f){return db[_0x9877('0x2f')][_0x9877('0x4b')](_0xbce761[_0x9877('0x4c')],{})[_0x9877('0x27')](function(_0x2b38d4){var _0x2be24f=_0xbce761[_0x9877('0x4d')]['get']({'plain':!![]});if(!_0x2be24f)throw new Error(_0x9877('0x4e'));if(_0x2be24f['role']==='user'){var _0x48f5c3=_0x2b38d4['get']({'plain':!![]});var _0x459ea2=_0x9877('0x29');return db['UserProfileSection'][_0x9877('0x49')]({'where':{'name':_0x459ea2,'userProfileId':_0x2be24f['userProfileId']},'raw':!![]})[_0x9877('0x27')](function(_0x3ab0bb){if(_0x3ab0bb&&_0x3ab0bb[_0x9877('0x4f')]===0x0){return db[_0x9877('0x2a')][_0x9877('0x4b')]({'name':_0x48f5c3[_0x9877('0x2c')],'resourceId':_0x48f5c3['id'],'type':_0x3ab0bb[_0x9877('0x2c')],'sectionId':_0x3ab0bb['id']},{})['then'](function(){return _0x2b38d4;});}else{return _0x2b38d4;}})['catch'](function(_0x29963a){logger[_0x9877('0x50')](_0x9877('0x51'),_0x29963a);throw _0x29963a;});}return _0x2b38d4;})[_0x9877('0x27')](respondWithResult(_0x5cd24f,0xc9))[_0x9877('0x4a')](handleError(_0x5cd24f,null));};exports[_0x9877('0x25')]=function(_0x83bcdf,_0x5aa38a){if(_0x83bcdf['body']['id']){delete _0x83bcdf[_0x9877('0x4c')]['id'];}return db['AnalyticExtractedReport'][_0x9877('0x49')]({'where':{'id':_0x83bcdf['params']['id']}})[_0x9877('0x27')](handleEntityNotFound(_0x5aa38a,null))['then'](saveUpdates(_0x83bcdf[_0x9877('0x4c')],null))['then'](respondWithResult(_0x5aa38a,null))[_0x9877('0x4a')](handleError(_0x5aa38a,null));};exports['destroy']=function(_0x242b51,_0x2709e6){return db['AnalyticExtractedReport'][_0x9877('0x49')]({'where':{'id':_0x242b51['params']['id']}})[_0x9877('0x27')](handleEntityNotFound(_0x2709e6,null))[_0x9877('0x27')](removeEntity(_0x2709e6,null))[_0x9877('0x4a')](handleError(_0x2709e6,null));};exports[_0x9877('0x52')]=function(_0x3bb0dc,_0x4830c3,_0x4061ae){return db[_0x9877('0x2f')]['find']({'where':{'id':_0x3bb0dc[_0x9877('0x53')]['id']},'attributes':[_0x9877('0x2c'),'basename','savename',_0x9877('0x54')],'raw':!![]})[_0x9877('0x27')](handleEntityNotFound(_0x4830c3,null))[_0x9877('0x27')](function(_0x20cccb){if(_0x20cccb){if(!fs[_0x9877('0x55')](path[_0x9877('0x56')](config[_0x9877('0x57')],_0x9877('0x58'),_0x20cccb[_0x9877('0x59')]))){throw new db[(_0x9877('0x5a'))]['ValidationError'](_0x9877('0x5b'));}if(_0x3bb0dc[_0x9877('0x34')]['exists']){return _0x4830c3[_0x9877('0x1a')](0xc8);}return _0x4830c3[_0x9877('0x52')](path['join'](config['root'],_0x9877('0x58'),_0x20cccb[_0x9877('0x59')]),util[_0x9877('0x5c')](_0x9877('0x5d'),_0x20cccb[_0x9877('0x5e')]||_0x20cccb[_0x9877('0x2c')],_0x20cccb[_0x9877('0x54')][_0x9877('0x5f')]()));}})[_0x9877('0x4a')](handleError(_0x4830c3,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 3d07d1f..f53bf01 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 _0x93a3=['AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define'];(function(_0x1ac15c,_0x273d6e){var _0x5bfd19=function(_0x35a88f){while(--_0x35a88f){_0x1ac15c['push'](_0x1ac15c['shift']());}};_0x5bfd19(++_0x273d6e);}(_0x93a3,0xe6));var _0x393a=function(_0x52dce5,_0x981491){_0x52dce5=_0x52dce5-0x0;var _0x2431cf=_0x93a3[_0x52dce5];return _0x2431cf;};'use strict';var _=require(_0x393a('0x0'));var util=require('util');var logger=require(_0x393a('0x1'))('api');var moment=require(_0x393a('0x2'));var BPromise=require(_0x393a('0x3'));var rp=require(_0x393a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x393a('0x5'));var config=require(_0x393a('0x6'));var attributes=require(_0x393a('0x7'));module[_0x393a('0x8')]=function(_0x2fd87d,_0x3c2bbf){return _0x2fd87d[_0x393a('0x9')](_0x393a('0xa'),attributes,{'tableName':_0x393a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52f8=['request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','../../config/logger','bluebird'];(function(_0x436202,_0x57c276){var _0x1a3027=function(_0x1d7d4c){while(--_0x1d7d4c){_0x436202['push'](_0x436202['shift']());}};_0x1a3027(++_0x57c276);}(_0x52f8,0x152));var _0x852f=function(_0x2a4977,_0x47691c){_0x2a4977=_0x2a4977-0x0;var _0x3a453f=_0x52f8[_0x2a4977];return _0x3a453f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x852f('0x0'))('api');var moment=require('moment');var BPromise=require(_0x852f('0x1'));var rp=require(_0x852f('0x2'));var fs=require('fs');var path=require(_0x852f('0x3'));var rimraf=require(_0x852f('0x4'));var config=require(_0x852f('0x5'));var attributes=require(_0x852f('0x6'));module[_0x852f('0x7')]=function(_0x5a2853,_0x149ac1){return _0x5a2853[_0x852f('0x8')](_0x852f('0x9'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index ca0d9dc..3d767e5 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 _0x9656=['request\x20sent','error','code','message','info','AnalyticExtractedReport,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','ioredis','rpc','jayson/promise','http','request','then','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x9656,0x15e));var _0x6965=function(_0x1608fa,_0x2d7557){_0x1608fa=_0x1608fa-0x0;var _0x2cb435=_0x9656[_0x1608fa];return _0x2cb435;};'use strict';var _=require(_0x6965('0x0'));var util=require('util');var moment=require(_0x6965('0x1'));var BPromise=require(_0x6965('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6965('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6965('0x4'));var config=require('../../config/environment');var jayson=require(_0x6965('0x5'));var client=jayson['client'][_0x6965('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5312fb,_0x9a46c7,_0x1a4e13){return new BPromise(function(_0x55a024,_0x5ae918){return client[_0x6965('0x7')](_0x5312fb,_0x1a4e13)[_0x6965('0x8')](function(_0x34a8f8){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x9a46c7,'request\x20sent');logger[_0x6965('0x9')](_0x6965('0xa'),_0x9a46c7,_0x6965('0xb'),JSON['stringify'](_0x34a8f8));if(_0x34a8f8[_0x6965('0xc')]){if(_0x34a8f8[_0x6965('0xc')][_0x6965('0xd')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x9a46c7,_0x34a8f8[_0x6965('0xc')]['message']);return _0x5ae918(_0x34a8f8[_0x6965('0xc')][_0x6965('0xe')]);}logger[_0x6965('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x9a46c7,_0x34a8f8[_0x6965('0xc')][_0x6965('0xe')]);return _0x55a024(_0x34a8f8[_0x6965('0xc')][_0x6965('0xe')]);}else{logger[_0x6965('0xf')](_0x6965('0x10'),_0x9a46c7,_0x6965('0xb'));_0x55a024(_0x34a8f8[_0x6965('0x11')][_0x6965('0xe')]);}})[_0x6965('0x12')](function(_0x40b316){logger['error'](_0x6965('0x10'),_0x9a46c7,_0x40b316);_0x5ae918(_0x40b316);});});} \ No newline at end of file +var _0x8301=['result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message'];(function(_0x292e0e,_0x4478da){var _0x304003=function(_0x1488b9){while(--_0x1488b9){_0x292e0e['push'](_0x292e0e['shift']());}};_0x304003(++_0x4478da);}(_0x8301,0x169));var _0x1830=function(_0x456a4b,_0x51df8){_0x456a4b=_0x456a4b-0x0;var _0x42957c=_0x8301[_0x456a4b];return _0x42957c;};'use strict';var _=require('lodash');var util=require(_0x1830('0x0'));var moment=require(_0x1830('0x1'));var BPromise=require('bluebird');var rs=require(_0x1830('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1830('0x3'))['db'];var utils=require(_0x1830('0x4'));var logger=require(_0x1830('0x5'))('rpc');var config=require(_0x1830('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1830('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3ed5e1,_0x4e79ab,_0x103ddd){return new BPromise(function(_0x27452a,_0x27664c){return client[_0x1830('0x8')](_0x3ed5e1,_0x103ddd)[_0x1830('0x9')](function(_0x396094){logger[_0x1830('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4e79ab,'request\x20sent');logger[_0x1830('0xb')](_0x1830('0xc'),_0x4e79ab,_0x1830('0xd'),JSON[_0x1830('0xe')](_0x396094));if(_0x396094[_0x1830('0xf')]){if(_0x396094['error'][_0x1830('0x10')]===0x1f4){logger['error'](_0x1830('0x11'),_0x4e79ab,_0x396094[_0x1830('0xf')][_0x1830('0x12')]);return _0x27664c(_0x396094[_0x1830('0xf')]['message']);}logger[_0x1830('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4e79ab,_0x396094[_0x1830('0xf')][_0x1830('0x12')]);return _0x27452a(_0x396094[_0x1830('0xf')][_0x1830('0x12')]);}else{logger['info'](_0x1830('0x11'),_0x4e79ab,_0x1830('0xd'));_0x27452a(_0x396094[_0x1830('0x13')][_0x1830('0x12')]);}})['catch'](function(_0xf1e928){logger[_0x1830('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4e79ab,_0xf1e928);_0x27664c(_0xf1e928);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index af14bf3..f9a2b79 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 _0x399f=['show','/:id/download','download','update','delete','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id'];(function(_0x2d4261,_0x28d8b5){var _0x425282=function(_0x4eb26f){while(--_0x4eb26f){_0x2d4261['push'](_0x2d4261['shift']());}};_0x425282(++_0x28d8b5);}(_0x399f,0x138));var _0xf399=function(_0x5e3c4b,_0x27ff03){_0x5e3c4b=_0x5e3c4b-0x0;var _0xdb47c2=_0x399f[_0x5e3c4b];return _0xdb47c2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf399('0x0'));var timeout=require(_0xf399('0x1'));var express=require('express');var router=express[_0xf399('0x2')]();var fs_extra=require(_0xf399('0x3'));var auth=require(_0xf399('0x4'));var interaction=require(_0xf399('0x5'));var config=require(_0xf399('0x6'));var controller=require(_0xf399('0x7'));router[_0xf399('0x8')]('/',auth[_0xf399('0x9')](),controller[_0xf399('0xa')]);router[_0xf399('0x8')](_0xf399('0xb'),auth[_0xf399('0x9')](),controller[_0xf399('0xc')]);router[_0xf399('0x8')](_0xf399('0xd'),auth[_0xf399('0x9')](),controller[_0xf399('0xe')]);router['post']('/',auth[_0xf399('0x9')](),controller['create']);router['put'](_0xf399('0xb'),auth[_0xf399('0x9')](),controller[_0xf399('0xf')]);router[_0xf399('0x10')](_0xf399('0xb'),auth[_0xf399('0x9')](),controller['destroy']);module[_0xf399('0x11')]=router; \ No newline at end of file +var _0x721b=['delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','create','update'];(function(_0x3cdb4a,_0x233b8e){var _0x5d3c4f=function(_0x7cef23){while(--_0x7cef23){_0x3cdb4a['push'](_0x3cdb4a['shift']());}};_0x5d3c4f(++_0x233b8e);}(_0x721b,0x157));var _0xb721=function(_0x293f41,_0x5317c5){_0x293f41=_0x293f41-0x0;var _0x47c5a9=_0x721b[_0x293f41];return _0x47c5a9;};'use strict';var multer=require('multer');var util=require(_0xb721('0x0'));var path=require(_0xb721('0x1'));var timeout=require(_0xb721('0x2'));var express=require('express');var router=express[_0xb721('0x3')]();var fs_extra=require(_0xb721('0x4'));var auth=require(_0xb721('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb721('0x6'));var controller=require(_0xb721('0x7'));router[_0xb721('0x8')]('/',auth[_0xb721('0x9')](),controller[_0xb721('0xa')]);router['get'](_0xb721('0xb'),auth[_0xb721('0x9')](),controller[_0xb721('0xc')]);router[_0xb721('0x8')](_0xb721('0xd'),auth['isAuthenticated'](),controller['download']);router[_0xb721('0xe')]('/',auth['isAuthenticated'](),controller[_0xb721('0xf')]);router['put'](_0xb721('0xb'),auth[_0xb721('0x9')](),controller[_0xb721('0x10')]);router[_0xb721('0x11')](_0xb721('0xb'),auth[_0xb721('0x9')](),controller[_0xb721('0x12')]);module[_0xb721('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 69b8b7e..1d87e25 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 _0x8dc9=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0x5c91c9,_0x33008b){var _0x24eb98=function(_0x3295c9){while(--_0x3295c9){_0x5c91c9['push'](_0x5c91c9['shift']());}};_0x24eb98(++_0x33008b);}(_0x8dc9,0x13d));var _0x98dc=function(_0x5a908c,_0x116f4c){_0x5a908c=_0x5a908c-0x0;var _0x29384c=_0x8dc9[_0x5a908c];return _0x29384c;};'use strict';var Sequelize=require(_0x98dc('0x0'));module['exports']={'field':{'type':Sequelize[_0x98dc('0x1')]},'alias':{'type':Sequelize[_0x98dc('0x2')]},'function':{'type':Sequelize[_0x98dc('0x2')]},'format':{'type':Sequelize[_0x98dc('0x2')]},'groupBy':{'type':Sequelize[_0x98dc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x98dc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8e93=['exports','TEXT','STRING','sequelize'];(function(_0x2e6c75,_0x47eb58){var _0x576ff1=function(_0x1b7125){while(--_0x1b7125){_0x2e6c75['push'](_0x2e6c75['shift']());}};_0x576ff1(++_0x47eb58);}(_0x8e93,0x1c7));var _0x38e9=function(_0x193f43,_0xa490c6){_0x193f43=_0x193f43-0x0;var _0x2e978e=_0x8e93[_0x193f43];return _0x2e978e;};'use strict';var Sequelize=require(_0x38e9('0x0'));module[_0x38e9('0x1')]={'field':{'type':Sequelize[_0x38e9('0x2')]},'alias':{'type':Sequelize[_0x38e9('0x3')]},'function':{'type':Sequelize[_0x38e9('0x3')]},'format':{'type':Sequelize[_0x38e9('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x38e9('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index f8874c7..ed701b8 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 _0xf818=['findAll','rows','catch','show','params','find','create','body','bulkCreate','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x336471,_0x4313e8){var _0x35c7a9=function(_0x55e06c){while(--_0x55e06c){_0x336471['push'](_0x336471['shift']());}};_0x35c7a9(++_0x4313e8);}(_0xf818,0x199));var _0x8f81=function(_0x300b38,_0x395cbf){_0x300b38=_0x300b38-0x0;var _0xf84b70=_0xf818[_0x300b38];return _0xf84b70;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8f81('0x0'));var jsonpatch=require(_0x8f81('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8f81('0x2'));var path=require(_0x8f81('0x3'));var sox=require(_0x8f81('0x4'));var csv=require(_0x8f81('0x5'));var ejs=require(_0x8f81('0x6'));var fs=require('fs');var fs_extra=require(_0x8f81('0x7'));var _=require(_0x8f81('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8f81('0x9'));var toCsv=require(_0x8f81('0x5'));var querystring=require(_0x8f81('0xa'));var Papa=require(_0x8f81('0xb'));var Redis=require(_0x8f81('0xc'));var authService=require(_0x8f81('0xd'));var qs=require(_0x8f81('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f81('0xf'));var logger=require(_0x8f81('0x10'))(_0x8f81('0x11'));var utils=require(_0x8f81('0x12'));var config=require(_0x8f81('0x13'));var licenseUtil=require(_0x8f81('0x14'));var db=require(_0x8f81('0x15'))['db'];function respondWithStatusCode(_0x58a260,_0x4796ed){_0x4796ed=_0x4796ed||0xcc;return function(_0xa5b229){if(_0xa5b229){return _0x58a260[_0x8f81('0x16')](_0x4796ed);}return _0x58a260[_0x8f81('0x17')](_0x4796ed)[_0x8f81('0x18')]();};}function respondWithResult(_0xa70e41,_0xf58729){_0xf58729=_0xf58729||0xc8;return function(_0x3d001c){if(_0x3d001c){return _0xa70e41[_0x8f81('0x17')](_0xf58729)[_0x8f81('0x19')](_0x3d001c);}};}function respondWithFilteredResult(_0x1ae55a,_0x5065aa){return function(_0x278502){if(_0x278502){var _0x3bd08c=typeof _0x5065aa[_0x8f81('0x1a')]===_0x8f81('0x1b')&&typeof _0x5065aa['limit']===_0x8f81('0x1b');var _0x4e5620=_0x278502[_0x8f81('0x1c')];var _0x440beb=_0x3bd08c?0x0:_0x5065aa[_0x8f81('0x1a')];var _0x47c208=_0x3bd08c?_0x278502[_0x8f81('0x1c')]:_0x5065aa[_0x8f81('0x1a')]+_0x5065aa[_0x8f81('0x1d')];var _0x36e8a1;if(_0x47c208>=_0x4e5620){_0x47c208=_0x4e5620;_0x36e8a1=0xc8;}else{_0x36e8a1=0xce;}_0x1ae55a[_0x8f81('0x17')](_0x36e8a1);return _0x1ae55a[_0x8f81('0x1e')](_0x8f81('0x1f'),_0x440beb+'-'+_0x47c208+'/'+_0x4e5620)[_0x8f81('0x19')](_0x278502);}return null;};}function patchUpdates(_0x218b1a){return function(_0x28eae5){try{jsonpatch[_0x8f81('0x20')](_0x28eae5,_0x218b1a,!![]);}catch(_0x5a6d8c){return BPromise['reject'](_0x5a6d8c);}return _0x28eae5[_0x8f81('0x21')]();};}function saveUpdates(_0x24136a,_0x5228f5){return function(_0x10fc4a){if(_0x10fc4a){return _0x10fc4a[_0x8f81('0x22')](_0x24136a)['then'](function(_0x193157){return _0x193157;});}return null;};}function removeEntity(_0x17ff36,_0x3307bc){return function(_0x45f499){if(_0x45f499){return _0x45f499[_0x8f81('0x23')]()[_0x8f81('0x24')](function(){_0x17ff36[_0x8f81('0x17')](0xcc)[_0x8f81('0x18')]();});}};}function handleEntityNotFound(_0x2dc617,_0x2dea7f){return function(_0x3671f5){if(!_0x3671f5){_0x2dc617[_0x8f81('0x16')](0x194);}return _0x3671f5;};}function handleError(_0x24919f,_0x2e7401){_0x2e7401=_0x2e7401||0x1f4;return function(_0x1402d2){logger[_0x8f81('0x25')](_0x1402d2[_0x8f81('0x26')]);if(_0x1402d2[_0x8f81('0x27')]){delete _0x1402d2[_0x8f81('0x27')];}_0x24919f['status'](_0x2e7401)[_0x8f81('0x28')](_0x1402d2);};}exports[_0x8f81('0x29')]=function(_0x322f36,_0x40e73b){var _0x4e9e74={},_0x38b109={},_0x3c7f17={'count':0x0,'rows':[]};var _0x427baf=_[_0x8f81('0x2a')](db[_0x8f81('0x2b')][_0x8f81('0x2c')],function(_0x2f5c86){return{'name':_0x2f5c86['fieldName'],'type':_0x2f5c86[_0x8f81('0x2d')]['key']};});_0x38b109[_0x8f81('0x2e')]=_[_0x8f81('0x2a')](_0x427baf,_0x8f81('0x27'));_0x38b109[_0x8f81('0x2f')]=_[_0x8f81('0x30')](_0x322f36[_0x8f81('0x2f')]);_0x38b109['filters']=_[_0x8f81('0x31')](_0x38b109[_0x8f81('0x2e')],_0x38b109[_0x8f81('0x2f')]);_0x4e9e74[_0x8f81('0x32')]=_[_0x8f81('0x31')](_0x38b109[_0x8f81('0x2e')],qs[_0x8f81('0x33')](_0x322f36[_0x8f81('0x2f')][_0x8f81('0x33')]));_0x4e9e74[_0x8f81('0x32')]=_0x4e9e74[_0x8f81('0x32')]['length']?_0x4e9e74[_0x8f81('0x32')]:_0x38b109['model'];if(!_0x322f36[_0x8f81('0x2f')][_0x8f81('0x34')](_0x8f81('0x35'))){_0x4e9e74[_0x8f81('0x1d')]=qs[_0x8f81('0x1d')](_0x322f36[_0x8f81('0x2f')][_0x8f81('0x1d')]);_0x4e9e74[_0x8f81('0x1a')]=qs[_0x8f81('0x1a')](_0x322f36['query'][_0x8f81('0x1a')]);}_0x4e9e74[_0x8f81('0x36')]=qs[_0x8f81('0x37')](_0x322f36[_0x8f81('0x2f')][_0x8f81('0x37')]);_0x4e9e74[_0x8f81('0x38')]=qs[_0x8f81('0x39')](_[_0x8f81('0x3a')](_0x322f36[_0x8f81('0x2f')],_0x38b109[_0x8f81('0x39')]),_0x427baf);if(_0x322f36['query'][_0x8f81('0x3b')]){_0x4e9e74['where']=_[_0x8f81('0x3c')](_0x4e9e74[_0x8f81('0x38')],{'$or':_[_0x8f81('0x2a')](_0x427baf,function(_0x3060e3){if(_0x3060e3[_0x8f81('0x2d')]!==_0x8f81('0x3d')){var _0x58d0ff={};_0x58d0ff[_0x3060e3[_0x8f81('0x27')]]={'$like':'%'+_0x322f36[_0x8f81('0x2f')][_0x8f81('0x3b')]+'%'};return _0x58d0ff;}})});}_0x4e9e74=_[_0x8f81('0x3c')]({},_0x4e9e74,_0x322f36[_0x8f81('0x3e')]);var _0x2570c0={'where':_0x4e9e74['where']};return db[_0x8f81('0x2b')][_0x8f81('0x1c')](_0x2570c0)[_0x8f81('0x24')](function(_0x5c6a79){_0x3c7f17[_0x8f81('0x1c')]=_0x5c6a79;if(_0x322f36[_0x8f81('0x2f')][_0x8f81('0x3f')]){_0x4e9e74[_0x8f81('0x40')]=[{'all':!![]}];}return db[_0x8f81('0x2b')][_0x8f81('0x41')](_0x4e9e74);})[_0x8f81('0x24')](function(_0x3e07f7){_0x3c7f17[_0x8f81('0x42')]=_0x3e07f7;return _0x3c7f17;})['then'](respondWithFilteredResult(_0x40e73b,_0x4e9e74))[_0x8f81('0x43')](handleError(_0x40e73b,null));};exports[_0x8f81('0x44')]=function(_0x1cc2bb,_0x240cb3){var _0x172205={'raw':![],'where':{'id':_0x1cc2bb[_0x8f81('0x45')]['id']}},_0x5ff2ab={};_0x5ff2ab[_0x8f81('0x2e')]=_['keys'](db[_0x8f81('0x2b')][_0x8f81('0x2c')]);_0x5ff2ab['query']=_[_0x8f81('0x30')](_0x1cc2bb[_0x8f81('0x2f')]);_0x5ff2ab[_0x8f81('0x39')]=_[_0x8f81('0x31')](_0x5ff2ab[_0x8f81('0x2e')],_0x5ff2ab[_0x8f81('0x2f')]);_0x172205[_0x8f81('0x32')]=_[_0x8f81('0x31')](_0x5ff2ab[_0x8f81('0x2e')],qs['fields'](_0x1cc2bb[_0x8f81('0x2f')][_0x8f81('0x33')]));_0x172205[_0x8f81('0x32')]=_0x172205['attributes']['length']?_0x172205[_0x8f81('0x32')]:_0x5ff2ab[_0x8f81('0x2e')];if(_0x1cc2bb['query'][_0x8f81('0x3f')]){_0x172205[_0x8f81('0x40')]=[{'all':!![]}];}_0x172205=_[_0x8f81('0x3c')]({},_0x172205,_0x1cc2bb[_0x8f81('0x3e')]);return db['AnalyticFieldReport'][_0x8f81('0x46')](_0x172205)['then'](handleEntityNotFound(_0x240cb3,null))[_0x8f81('0x24')](respondWithResult(_0x240cb3,null))['catch'](handleError(_0x240cb3,null));};exports['create']=function(_0xb36ccf,_0x4c5e5a){return db['AnalyticFieldReport'][_0x8f81('0x47')](_0xb36ccf[_0x8f81('0x48')],{})[_0x8f81('0x24')](respondWithResult(_0x4c5e5a,0xc9))['catch'](handleError(_0x4c5e5a,null));};exports[_0x8f81('0x49')]=function(_0x8ebe5b,_0x1b165a){return db['AnalyticFieldReport'][_0x8f81('0x49')](_0x8ebe5b['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1b165a,0xc9))[_0x8f81('0x43')](handleError(_0x1b165a,null));};exports['update']=function(_0x43a5c4,_0x41124a){if(_0x43a5c4[_0x8f81('0x48')]['id']){delete _0x43a5c4[_0x8f81('0x48')]['id'];}return db[_0x8f81('0x2b')][_0x8f81('0x46')]({'where':{'id':_0x43a5c4[_0x8f81('0x45')]['id']}})[_0x8f81('0x24')](handleEntityNotFound(_0x41124a,null))[_0x8f81('0x24')](saveUpdates(_0x43a5c4['body'],null))[_0x8f81('0x24')](respondWithResult(_0x41124a,null))[_0x8f81('0x43')](handleError(_0x41124a,null));};exports[_0x8f81('0x23')]=function(_0x365ba1,_0x1aa703){return db[_0x8f81('0x2b')]['find']({'where':{'id':_0x365ba1[_0x8f81('0x45')]['id']}})['then'](handleEntityNotFound(_0x1aa703,null))['then'](removeEntity(_0x1aa703,null))[_0x8f81('0x43')](handleError(_0x1aa703,null));};exports['bulkDestroy']=function(_0x3d97e1,_0x8fb93c){return db[_0x8f81('0x2b')][_0x8f81('0x23')]({'where':{'id':_0x3d97e1[_0x8f81('0x2f')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x8f81('0x24')](respondWithResult(_0x8fb93c,0xcc))[_0x8f81('0x43')](handleError(_0x8fb93c,null));};exports[_0x8f81('0x4a')]=function(_0x16a31b,_0x261776,_0x435bb9){return db[_0x8f81('0x4b')]['findOne']({'where':{'id':_0x16a31b['params']['id']}})[_0x8f81('0x24')](handleEntityNotFound(_0x261776,null))[_0x8f81('0x24')](function(_0x180b25){if(_0x180b25){return db[_0x8f81('0x4c')][_0x8f81('0x4d')](function(_0x426551){return db[_0x8f81('0x2b')]['destroy']({'where':{'CustomReportId':_0x16a31b[_0x8f81('0x45')]['id']},'transaction':_0x426551})[_0x8f81('0x24')](function(_0xbbf1c8){var _0x5bec0f=_[_0x8f81('0x2a')](_0x16a31b[_0x8f81('0x48')],function(_0x2feb57){delete _0x2feb57['id'];_0x2feb57[_0x8f81('0x4e')]=_0x16a31b[_0x8f81('0x45')]['id'];return _0x2feb57;});return db[_0x8f81('0x2b')][_0x8f81('0x49')](_0x5bec0f,{'transaction':_0x426551});});})[_0x8f81('0x24')](function(){return db[_0x8f81('0x2b')][_0x8f81('0x41')]({'where':{'CustomReportId':_0x16a31b['params']['id']}});});}})[_0x8f81('0x24')](respondWithResult(_0x261776,null))[_0x8f81('0x43')](handleError(_0x261776,null));}; \ No newline at end of file +var _0x5f26=['order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','rawAttributes','find','create','bulkCreate','body','update','bulkDestroy','ids','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','fieldName','type','model','query','filters','intersection','attributes','fields','length'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x5f26,0xc3));var _0x65f2=function(_0x57f785,_0x1b4f18){_0x57f785=_0x57f785-0x0;var _0x5a5eb4=_0x5f26[_0x57f785];return _0x5a5eb4;};'use strict';var emlformat=require(_0x65f2('0x0'));var rimraf=require(_0x65f2('0x1'));var zipdir=require(_0x65f2('0x2'));var jsonpatch=require(_0x65f2('0x3'));var rp=require(_0x65f2('0x4'));var moment=require(_0x65f2('0x5'));var BPromise=require(_0x65f2('0x6'));var Mustache=require(_0x65f2('0x7'));var util=require(_0x65f2('0x8'));var path=require(_0x65f2('0x9'));var sox=require(_0x65f2('0xa'));var csv=require(_0x65f2('0xb'));var ejs=require(_0x65f2('0xc'));var fs=require('fs');var fs_extra=require(_0x65f2('0xd'));var _=require(_0x65f2('0xe'));var squel=require(_0x65f2('0xf'));var crypto=require(_0x65f2('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x65f2('0x11'));var toCsv=require(_0x65f2('0xb'));var querystring=require(_0x65f2('0x12'));var Papa=require('papaparse');var Redis=require(_0x65f2('0x13'));var authService=require(_0x65f2('0x14'));var qs=require(_0x65f2('0x15'));var as=require(_0x65f2('0x16'));var hardwareService=require(_0x65f2('0x17'));var logger=require(_0x65f2('0x18'))(_0x65f2('0x19'));var utils=require(_0x65f2('0x1a'));var config=require(_0x65f2('0x1b'));var licenseUtil=require(_0x65f2('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x227201,_0x4096b2){_0x4096b2=_0x4096b2||0xcc;return function(_0x2e86bc){if(_0x2e86bc){return _0x227201[_0x65f2('0x1d')](_0x4096b2);}return _0x227201[_0x65f2('0x1e')](_0x4096b2)[_0x65f2('0x1f')]();};}function respondWithResult(_0xbee882,_0x2006ac){_0x2006ac=_0x2006ac||0xc8;return function(_0x12cfa9){if(_0x12cfa9){return _0xbee882[_0x65f2('0x1e')](_0x2006ac)[_0x65f2('0x20')](_0x12cfa9);}};}function respondWithFilteredResult(_0x5791b0,_0x2c5ad5){return function(_0xbc1418){if(_0xbc1418){var _0x30c040=typeof _0x2c5ad5[_0x65f2('0x21')]===_0x65f2('0x22')&&typeof _0x2c5ad5['limit']===_0x65f2('0x22');var _0x3e8f73=_0xbc1418[_0x65f2('0x23')];var _0x247717=_0x30c040?0x0:_0x2c5ad5[_0x65f2('0x21')];var _0x1e90ce=_0x30c040?_0xbc1418[_0x65f2('0x23')]:_0x2c5ad5[_0x65f2('0x21')]+_0x2c5ad5[_0x65f2('0x24')];var _0x57b267;if(_0x1e90ce>=_0x3e8f73){_0x1e90ce=_0x3e8f73;_0x57b267=0xc8;}else{_0x57b267=0xce;}_0x5791b0['status'](_0x57b267);return _0x5791b0[_0x65f2('0x25')](_0x65f2('0x26'),_0x247717+'-'+_0x1e90ce+'/'+_0x3e8f73)[_0x65f2('0x20')](_0xbc1418);}return null;};}function patchUpdates(_0x5292a8){return function(_0x4de82e){try{jsonpatch[_0x65f2('0x27')](_0x4de82e,_0x5292a8,!![]);}catch(_0x53c770){return BPromise[_0x65f2('0x28')](_0x53c770);}return _0x4de82e[_0x65f2('0x29')]();};}function saveUpdates(_0x3df755,_0x264f82){return function(_0x45e449){if(_0x45e449){return _0x45e449['update'](_0x3df755)[_0x65f2('0x2a')](function(_0xb4865b){return _0xb4865b;});}return null;};}function removeEntity(_0x158a4e,_0x415955){return function(_0x32e7a2){if(_0x32e7a2){return _0x32e7a2[_0x65f2('0x2b')]()[_0x65f2('0x2a')](function(){_0x158a4e[_0x65f2('0x1e')](0xcc)[_0x65f2('0x1f')]();});}};}function handleEntityNotFound(_0x2317d8,_0x2d4284){return function(_0x43d40d){if(!_0x43d40d){_0x2317d8[_0x65f2('0x1d')](0x194);}return _0x43d40d;};}function handleError(_0x317e15,_0x44a5e0){_0x44a5e0=_0x44a5e0||0x1f4;return function(_0x2673b1){logger[_0x65f2('0x2c')](_0x2673b1[_0x65f2('0x2d')]);if(_0x2673b1[_0x65f2('0x2e')]){delete _0x2673b1[_0x65f2('0x2e')];}_0x317e15[_0x65f2('0x1e')](_0x44a5e0)[_0x65f2('0x2f')](_0x2673b1);};}exports[_0x65f2('0x30')]=function(_0x215d01,_0x2ea228){var _0x418e07={},_0x178061={},_0x38fd4c={'count':0x0,'rows':[]};var _0x2f9016=_[_0x65f2('0x31')](db[_0x65f2('0x32')]['rawAttributes'],function(_0x1ae431){return{'name':_0x1ae431[_0x65f2('0x33')],'type':_0x1ae431[_0x65f2('0x34')]['key']};});_0x178061[_0x65f2('0x35')]=_['map'](_0x2f9016,_0x65f2('0x2e'));_0x178061[_0x65f2('0x36')]=_['keys'](_0x215d01['query']);_0x178061[_0x65f2('0x37')]=_[_0x65f2('0x38')](_0x178061['model'],_0x178061[_0x65f2('0x36')]);_0x418e07[_0x65f2('0x39')]=_[_0x65f2('0x38')](_0x178061[_0x65f2('0x35')],qs[_0x65f2('0x3a')](_0x215d01[_0x65f2('0x36')][_0x65f2('0x3a')]));_0x418e07[_0x65f2('0x39')]=_0x418e07[_0x65f2('0x39')][_0x65f2('0x3b')]?_0x418e07[_0x65f2('0x39')]:_0x178061['model'];if(!_0x215d01[_0x65f2('0x36')]['hasOwnProperty']('nolimit')){_0x418e07[_0x65f2('0x24')]=qs[_0x65f2('0x24')](_0x215d01[_0x65f2('0x36')][_0x65f2('0x24')]);_0x418e07[_0x65f2('0x21')]=qs[_0x65f2('0x21')](_0x215d01[_0x65f2('0x36')][_0x65f2('0x21')]);}_0x418e07[_0x65f2('0x3c')]=qs[_0x65f2('0x3d')](_0x215d01[_0x65f2('0x36')][_0x65f2('0x3d')]);_0x418e07['where']=qs['filters'](_[_0x65f2('0x3e')](_0x215d01['query'],_0x178061[_0x65f2('0x37')]),_0x2f9016);if(_0x215d01[_0x65f2('0x36')][_0x65f2('0x3f')]){_0x418e07[_0x65f2('0x40')]=_[_0x65f2('0x41')](_0x418e07['where'],{'$or':_[_0x65f2('0x31')](_0x2f9016,function(_0xd72116){if(_0xd72116['type']!==_0x65f2('0x42')){var _0x47e8f3={};_0x47e8f3[_0xd72116[_0x65f2('0x2e')]]={'$like':'%'+_0x215d01[_0x65f2('0x36')][_0x65f2('0x3f')]+'%'};return _0x47e8f3;}})});}_0x418e07=_[_0x65f2('0x41')]({},_0x418e07,_0x215d01[_0x65f2('0x43')]);var _0x354a23={'where':_0x418e07[_0x65f2('0x40')]};return db[_0x65f2('0x32')]['count'](_0x354a23)[_0x65f2('0x2a')](function(_0x49f9e4){_0x38fd4c['count']=_0x49f9e4;if(_0x215d01[_0x65f2('0x36')][_0x65f2('0x44')]){_0x418e07['include']=[{'all':!![]}];}return db[_0x65f2('0x32')][_0x65f2('0x45')](_0x418e07);})[_0x65f2('0x2a')](function(_0x4c2d93){_0x38fd4c['rows']=_0x4c2d93;return _0x38fd4c;})[_0x65f2('0x2a')](respondWithFilteredResult(_0x2ea228,_0x418e07))[_0x65f2('0x46')](handleError(_0x2ea228,null));};exports[_0x65f2('0x47')]=function(_0x43f00d,_0x51b205){var _0x5b3640={'raw':![],'where':{'id':_0x43f00d[_0x65f2('0x48')]['id']}},_0x17be54={};_0x17be54[_0x65f2('0x35')]=_[_0x65f2('0x49')](db['AnalyticFieldReport'][_0x65f2('0x4a')]);_0x17be54[_0x65f2('0x36')]=_[_0x65f2('0x49')](_0x43f00d[_0x65f2('0x36')]);_0x17be54['filters']=_['intersection'](_0x17be54[_0x65f2('0x35')],_0x17be54[_0x65f2('0x36')]);_0x5b3640[_0x65f2('0x39')]=_[_0x65f2('0x38')](_0x17be54[_0x65f2('0x35')],qs[_0x65f2('0x3a')](_0x43f00d['query'][_0x65f2('0x3a')]));_0x5b3640['attributes']=_0x5b3640['attributes'][_0x65f2('0x3b')]?_0x5b3640[_0x65f2('0x39')]:_0x17be54[_0x65f2('0x35')];if(_0x43f00d[_0x65f2('0x36')][_0x65f2('0x44')]){_0x5b3640['include']=[{'all':!![]}];}_0x5b3640=_[_0x65f2('0x41')]({},_0x5b3640,_0x43f00d[_0x65f2('0x43')]);return db[_0x65f2('0x32')][_0x65f2('0x4b')](_0x5b3640)['then'](handleEntityNotFound(_0x51b205,null))['then'](respondWithResult(_0x51b205,null))[_0x65f2('0x46')](handleError(_0x51b205,null));};exports['create']=function(_0x4ffa6d,_0xd5150f){return db[_0x65f2('0x32')][_0x65f2('0x4c')](_0x4ffa6d['body'],{})[_0x65f2('0x2a')](respondWithResult(_0xd5150f,0xc9))['catch'](handleError(_0xd5150f,null));};exports[_0x65f2('0x4d')]=function(_0x2f5f9a,_0x31d18c){return db['AnalyticFieldReport']['bulkCreate'](_0x2f5f9a[_0x65f2('0x4e')],{'raw':![],'individualHooks':!![]})[_0x65f2('0x2a')](respondWithResult(_0x31d18c,0xc9))[_0x65f2('0x46')](handleError(_0x31d18c,null));};exports[_0x65f2('0x4f')]=function(_0x5a744b,_0x3ba56e){if(_0x5a744b['body']['id']){delete _0x5a744b[_0x65f2('0x4e')]['id'];}return db[_0x65f2('0x32')][_0x65f2('0x4b')]({'where':{'id':_0x5a744b[_0x65f2('0x48')]['id']}})[_0x65f2('0x2a')](handleEntityNotFound(_0x3ba56e,null))['then'](saveUpdates(_0x5a744b[_0x65f2('0x4e')],null))[_0x65f2('0x2a')](respondWithResult(_0x3ba56e,null))[_0x65f2('0x46')](handleError(_0x3ba56e,null));};exports['destroy']=function(_0x100cd0,_0x20cd0d){return db[_0x65f2('0x32')][_0x65f2('0x4b')]({'where':{'id':_0x100cd0[_0x65f2('0x48')]['id']}})[_0x65f2('0x2a')](handleEntityNotFound(_0x20cd0d,null))[_0x65f2('0x2a')](removeEntity(_0x20cd0d,null))[_0x65f2('0x46')](handleError(_0x20cd0d,null));};exports[_0x65f2('0x50')]=function(_0x4bfb95,_0x2c7438){return db[_0x65f2('0x32')][_0x65f2('0x2b')]({'where':{'id':_0x4bfb95['query'][_0x65f2('0x51')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2c7438,0xcc))[_0x65f2('0x46')](handleError(_0x2c7438,null));};exports['addFields']=function(_0x179510,_0x47a396,_0x13ec4d){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x179510[_0x65f2('0x48')]['id']}})['then'](handleEntityNotFound(_0x47a396,null))[_0x65f2('0x2a')](function(_0x5c12e7){if(_0x5c12e7){return db[_0x65f2('0x52')][_0x65f2('0x53')](function(_0x57b266){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x179510['params']['id']},'transaction':_0x57b266})[_0x65f2('0x2a')](function(_0x559dff){var _0x4de4c1=_[_0x65f2('0x31')](_0x179510['body'],function(_0x12d0af){delete _0x12d0af['id'];_0x12d0af[_0x65f2('0x54')]=_0x179510[_0x65f2('0x48')]['id'];return _0x12d0af;});return db[_0x65f2('0x32')][_0x65f2('0x4d')](_0x4de4c1,{'transaction':_0x57b266});});})[_0x65f2('0x2a')](function(){return db[_0x65f2('0x32')][_0x65f2('0x45')]({'where':{'CustomReportId':_0x179510[_0x65f2('0x48')]['id']}});});}})[_0x65f2('0x2a')](respondWithResult(_0x47a396,null))[_0x65f2('0x46')](handleError(_0x47a396,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 2f05f66..663233d 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 _0x2544=['./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2544,0x1d3));var _0x4254=function(_0xb12583,_0x79ed34){_0xb12583=_0xb12583-0x0;var _0x5b4abb=_0x2544[_0xb12583];return _0x5b4abb;};'use strict';var _=require('lodash');var util=require(_0x4254('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4254('0x1'));var rp=require(_0x4254('0x2'));var fs=require('fs');var path=require(_0x4254('0x3'));var rimraf=require(_0x4254('0x4'));var config=require(_0x4254('0x5'));var attributes=require(_0x4254('0x6'));module[_0x4254('0x7')]=function(_0x1337fc,_0x1059d0){return _0x1337fc[_0x4254('0x8')](_0x4254('0x9'),attributes,{'tableName':_0x4254('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6850=['moment','path','../../config/environment','exports','define','AnalyticFieldReport','analytics_report_fields','util','api'];(function(_0x5493d2,_0x654b97){var _0x1bec36=function(_0x1cacde){while(--_0x1cacde){_0x5493d2['push'](_0x5493d2['shift']());}};_0x1bec36(++_0x654b97);}(_0x6850,0x1a5));var _0x0685=function(_0x55b591,_0x105016){_0x55b591=_0x55b591-0x0;var _0x3a0a1f=_0x6850[_0x55b591];return _0x3a0a1f;};'use strict';var _=require('lodash');var util=require(_0x0685('0x0'));var logger=require('../../config/logger')(_0x0685('0x1'));var moment=require(_0x0685('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0685('0x3'));var rimraf=require('rimraf');var config=require(_0x0685('0x4'));var attributes=require('./analyticFieldReport.attributes');module[_0x0685('0x5')]=function(_0x1cc80a,_0x58c297){return _0x1cc80a[_0x0685('0x6')](_0x0685('0x7'),attributes,{'tableName':_0x0685('0x8'),'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 79bb8b5..7cfdeaf 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 _0xf625=['catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result'];(function(_0x3ed1c1,_0x45fe0a){var _0x11797d=function(_0x26bad3){while(--_0x26bad3){_0x3ed1c1['push'](_0x3ed1c1['shift']());}};_0x11797d(++_0x45fe0a);}(_0xf625,0x1b6));var _0x5f62=function(_0x440237,_0x403080){_0x440237=_0x440237-0x0;var _0x59c5b8=_0xf625[_0x440237];return _0x59c5b8;};'use strict';var _=require(_0x5f62('0x0'));var util=require(_0x5f62('0x1'));var moment=require(_0x5f62('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f62('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f62('0x4'));var logger=require(_0x5f62('0x5'))(_0x5f62('0x6'));var config=require(_0x5f62('0x7'));var jayson=require(_0x5f62('0x8'));var client=jayson['client'][_0x5f62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d50e9,_0x46d8d4,_0x452fc8){return new BPromise(function(_0x240dda,_0x25b2e9){return client[_0x5f62('0xa')](_0x4d50e9,_0x452fc8)[_0x5f62('0xb')](function(_0x540424){logger[_0x5f62('0xc')](_0x5f62('0xd'),_0x46d8d4,'request\x20sent');logger[_0x5f62('0xe')](_0x5f62('0xf'),_0x46d8d4,_0x5f62('0x10'),JSON[_0x5f62('0x11')](_0x540424));if(_0x540424['error']){if(_0x540424['error'][_0x5f62('0x12')]===0x1f4){logger[_0x5f62('0x13')](_0x5f62('0xd'),_0x46d8d4,_0x540424[_0x5f62('0x13')][_0x5f62('0x14')]);return _0x25b2e9(_0x540424[_0x5f62('0x13')]['message']);}logger[_0x5f62('0x13')](_0x5f62('0xd'),_0x46d8d4,_0x540424[_0x5f62('0x13')]['message']);return _0x240dda(_0x540424[_0x5f62('0x13')][_0x5f62('0x14')]);}else{logger[_0x5f62('0xc')](_0x5f62('0xd'),_0x46d8d4,'request\x20sent');_0x240dda(_0x540424[_0x5f62('0x15')][_0x5f62('0x14')]);}})[_0x5f62('0x16')](function(_0x2fa969){logger[_0x5f62('0x13')](_0x5f62('0xd'),_0x46d8d4,_0x2fa969);_0x25b2e9(_0x2fa969);});});} \ No newline at end of file +var _0x0c59=['then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x0c59,0x1b4));var _0x90c5=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x0c59[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0x90c5('0x0'));var util=require(_0x90c5('0x1'));var moment=require(_0x90c5('0x2'));var BPromise=require(_0x90c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x90c5('0x4'));var db=require(_0x90c5('0x5'))['db'];var utils=require(_0x90c5('0x6'));var logger=require(_0x90c5('0x7'))(_0x90c5('0x8'));var config=require(_0x90c5('0x9'));var jayson=require(_0x90c5('0xa'));var client=jayson[_0x90c5('0xb')][_0x90c5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a4e84,_0x577a60,_0x3976d5){return new BPromise(function(_0x5f53e8,_0x388b7a){return client[_0x90c5('0xd')](_0x3a4e84,_0x3976d5)[_0x90c5('0xe')](function(_0x21cd74){logger[_0x90c5('0xf')](_0x90c5('0x10'),_0x577a60,'request\x20sent');logger[_0x90c5('0x11')](_0x90c5('0x12'),_0x577a60,_0x90c5('0x13'),JSON[_0x90c5('0x14')](_0x21cd74));if(_0x21cd74[_0x90c5('0x15')]){if(_0x21cd74[_0x90c5('0x15')]['code']===0x1f4){logger[_0x90c5('0x15')](_0x90c5('0x10'),_0x577a60,_0x21cd74['error'][_0x90c5('0x16')]);return _0x388b7a(_0x21cd74['error'][_0x90c5('0x16')]);}logger[_0x90c5('0x15')](_0x90c5('0x10'),_0x577a60,_0x21cd74[_0x90c5('0x15')][_0x90c5('0x16')]);return _0x5f53e8(_0x21cd74['error'][_0x90c5('0x16')]);}else{logger[_0x90c5('0xf')](_0x90c5('0x10'),_0x577a60,_0x90c5('0x13'));_0x5f53e8(_0x21cd74[_0x90c5('0x17')][_0x90c5('0x16')]);}})[_0x90c5('0x18')](function(_0x31807f){logger[_0x90c5('0x15')]('AnalyticFieldReport,\x20%s,\x20%s',_0x577a60,_0x31807f);_0x388b7a(_0x31807f);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 381a291..79f0a23 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(_0x11c221,_0x65c6a5){var _0x26deef=function(_0x2fa41a){while(--_0x2fa41a){_0x11c221['push'](_0x11c221['shift']());}};_0x26deef(++_0x65c6a5);}(_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['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(_0x14a8f3,_0x15c749){var _0x267924=function(_0xaa3d78){while(--_0xaa3d78){_0x14a8f3['push'](_0x14a8f3['shift']());}};_0x267924(++_0x15c749);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 48cc5c2..7fb1aab 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 _0x235a=['sequelize','exports','STRING'];(function(_0x4b8dc8,_0x285658){var _0x4384c6=function(_0x44686c){while(--_0x44686c){_0x4b8dc8['push'](_0x4b8dc8['shift']());}};_0x4384c6(++_0x285658);}(_0x235a,0x1ef));var _0xa235=function(_0x43f322,_0x56bbc3){_0x43f322=_0x43f322-0x0;var _0x4d66e5=_0x235a[_0x43f322];return _0x4d66e5;};'use strict';var Sequelize=require(_0xa235('0x0'));module[_0xa235('0x1')]={'name':{'type':Sequelize[_0xa235('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xa235('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xa235('0x2')]}}; \ No newline at end of file +var _0x8b1a=['STRING','TEXT','sequelize','exports'];(function(_0x2d06bf,_0x114b2d){var _0x3fa0c7=function(_0x5d31b9){while(--_0x5d31b9){_0x2d06bf['push'](_0x2d06bf['shift']());}};_0x3fa0c7(++_0x114b2d);}(_0x8b1a,0x152));var _0xa8b1=function(_0x42ee0d,_0x4a9d2d){_0x42ee0d=_0x42ee0d-0x0;var _0x5183fe=_0x8b1a[_0x42ee0d];return _0x5183fe;};'use strict';var Sequelize=require(_0xa8b1('0x0'));module[_0xa8b1('0x1')]={'name':{'type':Sequelize[_0xa8b1('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xa8b1('0x2')]},'metric':{'type':Sequelize[_0xa8b1('0x3')]},'description':{'type':Sequelize[_0xa8b1('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 11a82aa..570f16c 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 _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x483be1,_0x5ce2c5){var _0x383309=function(_0x1e1e08){while(--_0x1e1e08){_0x483be1['push'](_0x483be1['shift']());}};_0x383309(++_0x5ce2c5);}(_0xe5b3,0x133));var _0x3e5b=function(_0xbe5401,_0x2433d9){_0xbe5401=_0xbe5401-0x0;var _0x4cff04=_0xe5b3[_0xbe5401];return _0x4cff04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file +var _0x6aa7=['json','apply','reject','save','update','then','destroy','get','Metrics','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','catch','error','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range'];(function(_0x58cb21,_0x4737cc){var _0x37e679=function(_0x154326){while(--_0x154326){_0x58cb21['push'](_0x58cb21['shift']());}};_0x37e679(++_0x4737cc);}(_0x6aa7,0x178));var _0x76aa=function(_0x1c8a6d,_0x4569d){_0x1c8a6d=_0x1c8a6d-0x0;var _0x1a7cd3=_0x6aa7[_0x1c8a6d];return _0x1a7cd3;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){var _0x2cba6d=_0x3cd039[_0x76aa('0x29')]({'plain':!![]});var _0x26b75e=_0x76aa('0x2a');return db['UserProfileResource'][_0x76aa('0x28')]({'where':{'type':_0x26b75e,'resourceId':_0x2cba6d['id']}})[_0x76aa('0x27')](function(){return _0x3cd039;});})[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x2f9316,_0x25a803){return function(_0x282d0a){if(!_0x282d0a){_0x2f9316[_0x76aa('0x19')](0x194);}return _0x282d0a;};}function handleError(_0x1bdc3d,_0x545b06){_0x545b06=_0x545b06||0x1f4;return function(_0x3fcb7f){logger['error'](_0x3fcb7f[_0x76aa('0x2b')]);if(_0x3fcb7f[_0x76aa('0x2c')]){delete _0x3fcb7f[_0x76aa('0x2c')];}_0x1bdc3d[_0x76aa('0x1a')](_0x545b06)[_0x76aa('0x2d')](_0x3fcb7f);};}exports[_0x76aa('0x2e')]=function(_0x2ee0f9,_0x3827ec){var _0x19fd4f={},_0x3ea05a={},_0x5edcd8={'count':0x0,'rows':[]};var _0x430ad6=_[_0x76aa('0x2f')](db[_0x76aa('0x30')][_0x76aa('0x31')],function(_0x458ac3){return{'name':_0x458ac3[_0x76aa('0x32')],'type':_0x458ac3[_0x76aa('0x33')]['key']};});_0x3ea05a[_0x76aa('0x34')]=_[_0x76aa('0x2f')](_0x430ad6,'name');_0x3ea05a[_0x76aa('0x35')]=_['keys'](_0x2ee0f9[_0x76aa('0x35')]);_0x3ea05a['filters']=_[_0x76aa('0x36')](_0x3ea05a['model'],_0x3ea05a['query']);_0x19fd4f[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x3ea05a[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x2ee0f9['query']['fields']));_0x19fd4f[_0x76aa('0x37')]=_0x19fd4f[_0x76aa('0x37')][_0x76aa('0x39')]?_0x19fd4f[_0x76aa('0x37')]:_0x3ea05a[_0x76aa('0x34')];if(!_0x2ee0f9['query'][_0x76aa('0x3a')]('nolimit')){_0x19fd4f['limit']=qs[_0x76aa('0x1f')](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1f')]);_0x19fd4f[_0x76aa('0x1e')]=qs['offset'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1e')]);}_0x19fd4f[_0x76aa('0x3b')]=qs['sort'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x3c')]);_0x19fd4f[_0x76aa('0x3d')]=qs[_0x76aa('0x3e')](_[_0x76aa('0x3f')](_0x2ee0f9[_0x76aa('0x35')],_0x3ea05a[_0x76aa('0x3e')]),_0x430ad6);if(_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]){_0x19fd4f['where']=_[_0x76aa('0x41')](_0x19fd4f[_0x76aa('0x3d')],{'$or':_[_0x76aa('0x2f')](_0x430ad6,function(_0xa824e8){if(_0xa824e8[_0x76aa('0x33')]!==_0x76aa('0x42')){var _0x572fdb={};_0x572fdb[_0xa824e8['name']]={'$like':'%'+_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]+'%'};return _0x572fdb;}})});}_0x19fd4f=_[_0x76aa('0x41')]({},_0x19fd4f,_0x2ee0f9[_0x76aa('0x43')]);var _0x50599f={'where':_0x19fd4f[_0x76aa('0x3d')]};return db[_0x76aa('0x30')][_0x76aa('0x1d')](_0x50599f)[_0x76aa('0x27')](function(_0x1138b5){_0x5edcd8['count']=_0x1138b5;if(_0x2ee0f9[_0x76aa('0x35')]['includeAll']){_0x19fd4f[_0x76aa('0x44')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x19fd4f);})['then'](function(_0x144f0a){_0x5edcd8['rows']=_0x144f0a;return _0x5edcd8;})['then'](respondWithFilteredResult(_0x3827ec,_0x19fd4f))['catch'](handleError(_0x3827ec,null));};exports[_0x76aa('0x45')]=function(_0x3fd153,_0x116dc5){var _0x2c0744={'raw':!![],'where':{'id':_0x3fd153['params']['id']}},_0x27a52e={};_0x27a52e[_0x76aa('0x34')]=_[_0x76aa('0x46')](db[_0x76aa('0x30')][_0x76aa('0x31')]);_0x27a52e[_0x76aa('0x35')]=_['keys'](_0x3fd153[_0x76aa('0x35')]);_0x27a52e[_0x76aa('0x3e')]=_['intersection'](_0x27a52e[_0x76aa('0x34')],_0x27a52e['query']);_0x2c0744[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x27a52e[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x3fd153[_0x76aa('0x35')][_0x76aa('0x38')]));_0x2c0744[_0x76aa('0x37')]=_0x2c0744[_0x76aa('0x37')][_0x76aa('0x39')]?_0x2c0744[_0x76aa('0x37')]:_0x27a52e['model'];if(_0x3fd153[_0x76aa('0x35')]['includeAll']){_0x2c0744[_0x76aa('0x44')]=[{'all':!![]}];}_0x2c0744=_[_0x76aa('0x41')]({},_0x2c0744,_0x3fd153[_0x76aa('0x43')]);return db[_0x76aa('0x30')]['find'](_0x2c0744)['then'](handleEntityNotFound(_0x116dc5,null))[_0x76aa('0x27')](respondWithResult(_0x116dc5,null))['catch'](handleError(_0x116dc5,null));};exports[_0x76aa('0x47')]=function(_0x302a0c,_0x4315b3){return db[_0x76aa('0x30')][_0x76aa('0x47')](_0x302a0c[_0x76aa('0x48')],{})['then'](function(_0x564546){var _0x2fcf8f=_0x302a0c[_0x76aa('0x49')][_0x76aa('0x29')]({'plain':!![]});if(!_0x2fcf8f)throw new Error(_0x76aa('0x4a'));if(_0x2fcf8f[_0x76aa('0x4b')]===_0x76aa('0x49')){var _0x4c52d5=_0x564546[_0x76aa('0x29')]({'plain':!![]});var _0x2d631e=_0x76aa('0x2a');return db['UserProfileSection'][_0x76aa('0x4c')]({'where':{'name':_0x2d631e,'userProfileId':_0x2fcf8f['userProfileId']},'raw':!![]})[_0x76aa('0x27')](function(_0x5e1d84){if(_0x5e1d84&&_0x5e1d84[_0x76aa('0x4d')]===0x0){return db[_0x76aa('0x4e')][_0x76aa('0x47')]({'name':_0x4c52d5[_0x76aa('0x2c')],'resourceId':_0x4c52d5['id'],'type':_0x5e1d84[_0x76aa('0x2c')],'sectionId':_0x5e1d84['id']},{})[_0x76aa('0x27')](function(){return _0x564546;});}else{return _0x564546;}})[_0x76aa('0x4f')](function(_0x4f2c2b){logger[_0x76aa('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f2c2b);throw _0x4f2c2b;});}return _0x564546;})[_0x76aa('0x27')](respondWithResult(_0x4315b3,0xc9))[_0x76aa('0x4f')](handleError(_0x4315b3,null));};exports[_0x76aa('0x26')]=function(_0x53be10,_0x3fa7ec){if(_0x53be10[_0x76aa('0x48')]['id']){delete _0x53be10[_0x76aa('0x48')]['id'];}return db['AnalyticMetric'][_0x76aa('0x4c')]({'where':{'id':_0x53be10[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x3fa7ec,null))[_0x76aa('0x27')](saveUpdates(_0x53be10['body'],null))[_0x76aa('0x27')](respondWithResult(_0x3fa7ec,null))[_0x76aa('0x4f')](handleError(_0x3fa7ec,null));};exports[_0x76aa('0x28')]=function(_0x410933,_0x2027f8){return db[_0x76aa('0x30')]['find']({'where':{'id':_0x410933[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x2027f8,null))[_0x76aa('0x27')](removeEntity(_0x2027f8,null))[_0x76aa('0x4f')](handleError(_0x2027f8,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 7c36a0e..63e8d8b 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 _0xe14a=['exports','define','AnalyticMetric','analytics_metrics','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes'];(function(_0xe15c8f,_0xc520e8){var _0x6fffcf=function(_0xfdfa99){while(--_0xfdfa99){_0xe15c8f['push'](_0xe15c8f['shift']());}};_0x6fffcf(++_0xc520e8);}(_0xe14a,0x94));var _0xae14=function(_0x356119,_0x275fb9){_0x356119=_0x356119-0x0;var _0x47e46f=_0xe14a[_0x356119];return _0x47e46f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xae14('0x0'));var rp=require(_0xae14('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae14('0x2'));var config=require(_0xae14('0x3'));var attributes=require(_0xae14('0x4'));module[_0xae14('0x5')]=function(_0x2b5138,_0x3a6279){return _0x2b5138[_0xae14('0x6')](_0xae14('0x7'),attributes,{'tableName':_0xae14('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c24=['moment','bluebird','request-promise','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api'];(function(_0x59250d,_0x2119d5){var _0x1e686a=function(_0x133b84){while(--_0x133b84){_0x59250d['push'](_0x59250d['shift']());}};_0x1e686a(++_0x2119d5);}(_0x2c24,0x1e6));var _0x42c2=function(_0x5e06f8,_0x2b62df){_0x5e06f8=_0x5e06f8-0x0;var _0x476c69=_0x2c24[_0x5e06f8];return _0x476c69;};'use strict';var _=require(_0x42c2('0x0'));var util=require(_0x42c2('0x1'));var logger=require(_0x42c2('0x2'))(_0x42c2('0x3'));var moment=require(_0x42c2('0x4'));var BPromise=require(_0x42c2('0x5'));var rp=require(_0x42c2('0x6'));var fs=require('fs');var path=require(_0x42c2('0x7'));var rimraf=require(_0x42c2('0x8'));var config=require('../../config/environment');var attributes=require(_0x42c2('0x9'));module[_0x42c2('0xa')]=function(_0x4950c1,_0x20d310){return _0x4950c1[_0x42c2('0xb')](_0x42c2('0xc'),attributes,{'tableName':_0x42c2('0xd'),'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 570f484..95a8d67 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 _0x89a3=['stringify','error','code','message','AnalyticMetric,\x20%s,\x20%s','result','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x50ebf0,_0x1969b2){var _0x57cb8d=function(_0x8cf923){while(--_0x8cf923){_0x50ebf0['push'](_0x50ebf0['shift']());}};_0x57cb8d(++_0x1969b2);}(_0x89a3,0x1e6));var _0x389a=function(_0xe5052,_0x53b9e5){_0xe5052=_0xe5052-0x0;var _0x874d7d=_0x89a3[_0xe5052];return _0x874d7d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x389a('0x0'));var BPromise=require(_0x389a('0x1'));var rs=require(_0x389a('0x2'));var fs=require('fs');var Redis=require(_0x389a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x389a('0x4'))('rpc');var config=require(_0x389a('0x5'));var jayson=require(_0x389a('0x6'));var client=jayson[_0x389a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5caea7,_0x2d1f5d,_0x2aa424){return new BPromise(function(_0x415b98,_0x55807f){return client[_0x389a('0x8')](_0x5caea7,_0x2aa424)[_0x389a('0x9')](function(_0xc87927){logger[_0x389a('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x2d1f5d,_0x389a('0xb'));logger[_0x389a('0xc')](_0x389a('0xd'),_0x2d1f5d,_0x389a('0xb'),JSON[_0x389a('0xe')](_0xc87927));if(_0xc87927[_0x389a('0xf')]){if(_0xc87927['error'][_0x389a('0x10')]===0x1f4){logger[_0x389a('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x2d1f5d,_0xc87927[_0x389a('0xf')][_0x389a('0x11')]);return _0x55807f(_0xc87927['error']['message']);}logger[_0x389a('0xf')](_0x389a('0x12'),_0x2d1f5d,_0xc87927[_0x389a('0xf')][_0x389a('0x11')]);return _0x415b98(_0xc87927['error'][_0x389a('0x11')]);}else{logger[_0x389a('0xa')](_0x389a('0x12'),_0x2d1f5d,_0x389a('0xb'));_0x415b98(_0xc87927[_0x389a('0x13')][_0x389a('0x11')]);}})['catch'](function(_0x5ce8f0){logger['error'](_0x389a('0x12'),_0x2d1f5d,_0x5ce8f0);_0x55807f(_0x5ce8f0);});});} \ No newline at end of file +var _0xf7b2=['stringify','error','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf7b2,0xfc));var _0x2f7b=function(_0x5a3ebe,_0xde9bae){_0x5a3ebe=_0x5a3ebe-0x0;var _0x1fda3c=_0xf7b2[_0x5a3ebe];return _0x1fda3c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2f7b('0x0'));var rs=require(_0x2f7b('0x1'));var fs=require('fs');var Redis=require(_0x2f7b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f7b('0x3'));var logger=require(_0x2f7b('0x4'))(_0x2f7b('0x5'));var config=require(_0x2f7b('0x6'));var jayson=require(_0x2f7b('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24a9a3,_0x29cef6,_0x5f651){return new BPromise(function(_0x46da24,_0x32775a){return client['request'](_0x24a9a3,_0x5f651)[_0x2f7b('0x8')](function(_0x51ff66){logger[_0x2f7b('0x9')](_0x2f7b('0xa'),_0x29cef6,_0x2f7b('0xb'));logger[_0x2f7b('0xc')](_0x2f7b('0xd'),_0x29cef6,_0x2f7b('0xb'),JSON[_0x2f7b('0xe')](_0x51ff66));if(_0x51ff66[_0x2f7b('0xf')]){if(_0x51ff66['error']['code']===0x1f4){logger['error'](_0x2f7b('0xa'),_0x29cef6,_0x51ff66['error']['message']);return _0x32775a(_0x51ff66[_0x2f7b('0xf')]['message']);}logger[_0x2f7b('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x29cef6,_0x51ff66[_0x2f7b('0xf')][_0x2f7b('0x10')]);return _0x46da24(_0x51ff66[_0x2f7b('0xf')][_0x2f7b('0x10')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x29cef6,'request\x20sent');_0x46da24(_0x51ff66[_0x2f7b('0x11')][_0x2f7b('0x10')]);}})[_0x2f7b('0x12')](function(_0x4f26ff){logger[_0x2f7b('0xf')](_0x2f7b('0xa'),_0x29cef6,_0x4f26ff);_0x32775a(_0x4f26ff);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index fe642af..4943218 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 _0x41d9=['../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x540e73,_0x42461d){var _0x3b3b12=function(_0x5dbeaa){while(--_0x5dbeaa){_0x540e73['push'](_0x540e73['shift']());}};_0x3b3b12(++_0x42461d);}(_0x41d9,0x13c));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x941d('0x0'));var util=require(_0x941d('0x1'));var path=require(_0x941d('0x2'));var timeout=require(_0x941d('0x3'));var express=require(_0x941d('0x4'));var router=express[_0x941d('0x5')]();var fs_extra=require(_0x941d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x941d('0x7'));var config=require(_0x941d('0x8'));var controller=require('./analyticMetric.controller');router[_0x941d('0x9')]('/',auth[_0x941d('0xa')](),controller['index']);router[_0x941d('0x9')]('/:id',auth[_0x941d('0xa')](),controller[_0x941d('0xb')]);router[_0x941d('0xc')]('/',auth[_0x941d('0xa')](),controller[_0x941d('0xd')]);router['put'](_0x941d('0xe'),auth[_0x941d('0xa')](),controller[_0x941d('0xf')]);router[_0x941d('0x10')]('/:id',auth[_0x941d('0xa')](),controller[_0x941d('0x11')]);module[_0x941d('0x12')]=router; \ No newline at end of file +var _0x6a83=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x6a83,0xd2));var _0x36a8=function(_0x4e118a,_0x2f81e1){_0x4e118a=_0x4e118a-0x0;var _0xee834a=_0x6a83[_0x4e118a];return _0xee834a;};'use strict';var multer=require(_0x36a8('0x0'));var util=require(_0x36a8('0x1'));var path=require(_0x36a8('0x2'));var timeout=require(_0x36a8('0x3'));var express=require(_0x36a8('0x4'));var router=express[_0x36a8('0x5')]();var fs_extra=require(_0x36a8('0x6'));var auth=require(_0x36a8('0x7'));var interaction=require(_0x36a8('0x8'));var config=require(_0x36a8('0x9'));var controller=require(_0x36a8('0xa'));router[_0x36a8('0xb')]('/',auth[_0x36a8('0xc')](),controller[_0x36a8('0xd')]);router[_0x36a8('0xb')](_0x36a8('0xe'),auth[_0x36a8('0xc')](),controller[_0x36a8('0xf')]);router[_0x36a8('0x10')]('/',auth['isAuthenticated'](),controller[_0x36a8('0x11')]);router['put'](_0x36a8('0xe'),auth[_0x36a8('0xc')](),controller['update']);router[_0x36a8('0x12')](_0x36a8('0xe'),auth['isAuthenticated'](),controller[_0x36a8('0x13')]);module[_0x36a8('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index a6bfdf5..20360fe 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 _0x0f72=['sequelize','TEXT'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x0f72,0x7a));var _0x20f7=function(_0x438d4b,_0x59eb56){_0x438d4b=_0x438d4b-0x0;var _0x1ccb6a=_0x0f72[_0x438d4b];return _0x1ccb6a;};'use strict';var Sequelize=require(_0x20f7('0x0'));module['exports']={'tree':{'type':Sequelize[_0x20f7('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xe79a=['TEXT'];(function(_0x477cb9,_0x1f151b){var _0x59f8ec=function(_0x231c54){while(--_0x231c54){_0x477cb9['push'](_0x477cb9['shift']());}};_0x59f8ec(++_0x1f151b);}(_0xe79a,0x70));var _0xae79=function(_0x23cc76,_0x9c756b){_0x23cc76=_0x23cc76-0x0;var _0x2f5c13=_0xe79a[_0x23cc76];return _0x2f5c13;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0xae79('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index e5ce22c..221b951 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 _0xab6d=['find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','findAll','rows','show','params','keys','include'];(function(_0x361011,_0x9f7415){var _0x543ab5=function(_0x221523){while(--_0x221523){_0x361011['push'](_0x361011['shift']());}};_0x543ab5(++_0x9f7415);}(_0xab6d,0x12d));var _0xdab6=function(_0x2e35ee,_0x28f2e2){_0x2e35ee=_0x2e35ee-0x0;var _0x49ad79=_0xab6d[_0x2e35ee];return _0x49ad79;};'use strict';var emlformat=require(_0xdab6('0x0'));var rimraf=require(_0xdab6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdab6('0x2'));var rp=require('request-promise');var moment=require(_0xdab6('0x3'));var BPromise=require(_0xdab6('0x4'));var Mustache=require(_0xdab6('0x5'));var util=require('util');var path=require(_0xdab6('0x6'));var sox=require(_0xdab6('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdab6('0x8'));var _=require(_0xdab6('0x9'));var squel=require(_0xdab6('0xa'));var crypto=require('crypto');var jsforce=require(_0xdab6('0xb'));var deskjs=require(_0xdab6('0xc'));var toCsv=require('to-csv');var querystring=require(_0xdab6('0xd'));var Papa=require(_0xdab6('0xe'));var Redis=require(_0xdab6('0xf'));var authService=require(_0xdab6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdab6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdab6('0x12'))('api');var utils=require(_0xdab6('0x13'));var config=require(_0xdab6('0x14'));var licenseUtil=require(_0xdab6('0x15'));var db=require(_0xdab6('0x16'))['db'];function respondWithStatusCode(_0x3947a8,_0x6be426){_0x6be426=_0x6be426||0xcc;return function(_0x20a248){if(_0x20a248){return _0x3947a8[_0xdab6('0x17')](_0x6be426);}return _0x3947a8[_0xdab6('0x18')](_0x6be426)[_0xdab6('0x19')]();};}function respondWithResult(_0x632289,_0x5f1cdb){_0x5f1cdb=_0x5f1cdb||0xc8;return function(_0x323715){if(_0x323715){return _0x632289[_0xdab6('0x18')](_0x5f1cdb)[_0xdab6('0x1a')](_0x323715);}};}function respondWithFilteredResult(_0x5b0a7b,_0x42a76a){return function(_0x18b4bd){if(_0x18b4bd){var _0xa4ef53=typeof _0x42a76a['offset']===_0xdab6('0x1b')&&typeof _0x42a76a[_0xdab6('0x1c')]===_0xdab6('0x1b');var _0x4b7784=_0x18b4bd[_0xdab6('0x1d')];var _0x43bf97=_0xa4ef53?0x0:_0x42a76a[_0xdab6('0x1e')];var _0x2b5065=_0xa4ef53?_0x18b4bd[_0xdab6('0x1d')]:_0x42a76a['offset']+_0x42a76a[_0xdab6('0x1c')];var _0x23699b;if(_0x2b5065>=_0x4b7784){_0x2b5065=_0x4b7784;_0x23699b=0xc8;}else{_0x23699b=0xce;}_0x5b0a7b['status'](_0x23699b);return _0x5b0a7b[_0xdab6('0x1f')](_0xdab6('0x20'),_0x43bf97+'-'+_0x2b5065+'/'+_0x4b7784)[_0xdab6('0x1a')](_0x18b4bd);}return null;};}function patchUpdates(_0xa5dc21){return function(_0x3ef3c1){try{jsonpatch[_0xdab6('0x21')](_0x3ef3c1,_0xa5dc21,!![]);}catch(_0x5f4683){return BPromise[_0xdab6('0x22')](_0x5f4683);}return _0x3ef3c1[_0xdab6('0x23')]();};}function saveUpdates(_0x4850fe,_0x38cad2){return function(_0x45d922){if(_0x45d922){return _0x45d922[_0xdab6('0x24')](_0x4850fe)[_0xdab6('0x25')](function(_0x25eae7){return _0x25eae7;});}return null;};}function removeEntity(_0x5d8f4b,_0x5c5f55){return function(_0x18c874){if(_0x18c874){return _0x18c874['destroy']()[_0xdab6('0x25')](function(){_0x5d8f4b[_0xdab6('0x18')](0xcc)[_0xdab6('0x19')]();});}};}function handleEntityNotFound(_0x2de7e5,_0x5d1008){return function(_0x17fd67){if(!_0x17fd67){_0x2de7e5[_0xdab6('0x17')](0x194);}return _0x17fd67;};}function handleError(_0x78a880,_0x4bb5a3){_0x4bb5a3=_0x4bb5a3||0x1f4;return function(_0x1f6a1c){logger[_0xdab6('0x26')](_0x1f6a1c[_0xdab6('0x27')]);if(_0x1f6a1c[_0xdab6('0x28')]){delete _0x1f6a1c[_0xdab6('0x28')];}_0x78a880[_0xdab6('0x18')](_0x4bb5a3)['send'](_0x1f6a1c);};}exports['index']=function(_0x475c77,_0x31aa7d){var _0x3e145f={},_0x41a8e4={},_0x5d1f6a={'count':0x0,'rows':[]};var _0x2e9c22=_[_0xdab6('0x29')](db['AnalyticTreeReport']['rawAttributes'],function(_0x53ab8e){return{'name':_0x53ab8e['fieldName'],'type':_0x53ab8e[_0xdab6('0x2a')][_0xdab6('0x2b')]};});_0x41a8e4[_0xdab6('0x2c')]=_['map'](_0x2e9c22,_0xdab6('0x28'));_0x41a8e4['query']=_['keys'](_0x475c77[_0xdab6('0x2d')]);_0x41a8e4[_0xdab6('0x2e')]=_[_0xdab6('0x2f')](_0x41a8e4[_0xdab6('0x2c')],_0x41a8e4['query']);_0x3e145f[_0xdab6('0x30')]=_[_0xdab6('0x2f')](_0x41a8e4[_0xdab6('0x2c')],qs[_0xdab6('0x31')](_0x475c77[_0xdab6('0x2d')][_0xdab6('0x31')]));_0x3e145f['attributes']=_0x3e145f['attributes'][_0xdab6('0x32')]?_0x3e145f['attributes']:_0x41a8e4[_0xdab6('0x2c')];if(!_0x475c77[_0xdab6('0x2d')][_0xdab6('0x33')](_0xdab6('0x34'))){_0x3e145f[_0xdab6('0x1c')]=qs['limit'](_0x475c77[_0xdab6('0x2d')][_0xdab6('0x1c')]);_0x3e145f[_0xdab6('0x1e')]=qs[_0xdab6('0x1e')](_0x475c77[_0xdab6('0x2d')]['offset']);}_0x3e145f[_0xdab6('0x35')]=qs['sort'](_0x475c77[_0xdab6('0x2d')][_0xdab6('0x36')]);_0x3e145f[_0xdab6('0x37')]=qs[_0xdab6('0x2e')](_[_0xdab6('0x38')](_0x475c77['query'],_0x41a8e4[_0xdab6('0x2e')]),_0x2e9c22);if(_0x475c77['query'][_0xdab6('0x39')]){_0x3e145f[_0xdab6('0x37')]=_[_0xdab6('0x3a')](_0x3e145f[_0xdab6('0x37')],{'$or':_[_0xdab6('0x29')](_0x2e9c22,function(_0x10dd19){if(_0x10dd19[_0xdab6('0x2a')]!==_0xdab6('0x3b')){var _0x3521c2={};_0x3521c2[_0x10dd19[_0xdab6('0x28')]]={'$like':'%'+_0x475c77[_0xdab6('0x2d')][_0xdab6('0x39')]+'%'};return _0x3521c2;}})});}_0x3e145f=_[_0xdab6('0x3a')]({},_0x3e145f,_0x475c77[_0xdab6('0x3c')]);var _0x1a9844={'where':_0x3e145f[_0xdab6('0x37')]};return db[_0xdab6('0x3d')]['count'](_0x1a9844)[_0xdab6('0x25')](function(_0x22cb16){_0x5d1f6a['count']=_0x22cb16;if(_0x475c77[_0xdab6('0x2d')][_0xdab6('0x3e')]){_0x3e145f['include']=[{'all':!![]}];}return db[_0xdab6('0x3d')][_0xdab6('0x3f')](_0x3e145f);})[_0xdab6('0x25')](function(_0x250bbb){_0x5d1f6a[_0xdab6('0x40')]=_0x250bbb;return _0x5d1f6a;})[_0xdab6('0x25')](respondWithFilteredResult(_0x31aa7d,_0x3e145f))['catch'](handleError(_0x31aa7d,null));};exports[_0xdab6('0x41')]=function(_0x630f21,_0x4d4278){var _0x573df8={'raw':!![],'where':{'id':_0x630f21[_0xdab6('0x42')]['id']}},_0x32a068={};_0x32a068[_0xdab6('0x2c')]=_[_0xdab6('0x43')](db[_0xdab6('0x3d')]['rawAttributes']);_0x32a068[_0xdab6('0x2d')]=_[_0xdab6('0x43')](_0x630f21['query']);_0x32a068[_0xdab6('0x2e')]=_[_0xdab6('0x2f')](_0x32a068[_0xdab6('0x2c')],_0x32a068[_0xdab6('0x2d')]);_0x573df8['attributes']=_['intersection'](_0x32a068[_0xdab6('0x2c')],qs[_0xdab6('0x31')](_0x630f21[_0xdab6('0x2d')][_0xdab6('0x31')]));_0x573df8[_0xdab6('0x30')]=_0x573df8['attributes'][_0xdab6('0x32')]?_0x573df8[_0xdab6('0x30')]:_0x32a068['model'];if(_0x630f21[_0xdab6('0x2d')][_0xdab6('0x3e')]){_0x573df8[_0xdab6('0x44')]=[{'all':!![]}];}_0x573df8=_[_0xdab6('0x3a')]({},_0x573df8,_0x630f21['options']);return db[_0xdab6('0x3d')][_0xdab6('0x45')](_0x573df8)[_0xdab6('0x25')](handleEntityNotFound(_0x4d4278,null))[_0xdab6('0x25')](respondWithResult(_0x4d4278,null))[_0xdab6('0x46')](handleError(_0x4d4278,null));};exports[_0xdab6('0x47')]=function(_0x2a26c0,_0x182dc9){return db[_0xdab6('0x3d')]['create'](_0x2a26c0[_0xdab6('0x48')],{})[_0xdab6('0x25')](respondWithResult(_0x182dc9,0xc9))['catch'](handleError(_0x182dc9,null));};exports[_0xdab6('0x24')]=function(_0x1f9f6e,_0x2a0878){if(_0x1f9f6e[_0xdab6('0x48')]['id']){delete _0x1f9f6e[_0xdab6('0x48')]['id'];}return db[_0xdab6('0x3d')][_0xdab6('0x45')]({'where':{'id':_0x1f9f6e[_0xdab6('0x42')]['id']}})[_0xdab6('0x25')](handleEntityNotFound(_0x2a0878,null))['then'](saveUpdates(_0x1f9f6e[_0xdab6('0x48')],null))[_0xdab6('0x25')](respondWithResult(_0x2a0878,null))[_0xdab6('0x46')](handleError(_0x2a0878,null));};exports[_0xdab6('0x49')]=function(_0x591d04,_0x4a1120){return db['AnalyticTreeReport'][_0xdab6('0x45')]({'where':{'id':_0x591d04['params']['id']}})['then'](handleEntityNotFound(_0x4a1120,null))[_0xdab6('0x25')](removeEntity(_0x4a1120,null))[_0xdab6('0x46')](handleError(_0x4a1120,null));}; \ No newline at end of file +var _0x3d05=['nolimit','limit','order','sort','where','filters','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name','index','map','AnalyticTreeReport','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0xc304dc,_0xa53659){var _0x38b100=function(_0x4217c1){while(--_0x4217c1){_0xc304dc['push'](_0xc304dc['shift']());}};_0x38b100(++_0xa53659);}(_0x3d05,0x104));var _0x53d0=function(_0x929c7e,_0x38c4cc){_0x929c7e=_0x929c7e-0x0;var _0x5de099=_0x3d05[_0x929c7e];return _0x5de099;};'use strict';var emlformat=require(_0x53d0('0x0'));var rimraf=require(_0x53d0('0x1'));var zipdir=require(_0x53d0('0x2'));var jsonpatch=require(_0x53d0('0x3'));var rp=require(_0x53d0('0x4'));var moment=require(_0x53d0('0x5'));var BPromise=require(_0x53d0('0x6'));var Mustache=require(_0x53d0('0x7'));var util=require(_0x53d0('0x8'));var path=require(_0x53d0('0x9'));var sox=require(_0x53d0('0xa'));var csv=require(_0x53d0('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53d0('0xc'));var _=require(_0x53d0('0xd'));var squel=require(_0x53d0('0xe'));var crypto=require(_0x53d0('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x53d0('0xb'));var querystring=require(_0x53d0('0x10'));var Papa=require(_0x53d0('0x11'));var Redis=require(_0x53d0('0x12'));var authService=require(_0x53d0('0x13'));var qs=require(_0x53d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x53d0('0x15'));var logger=require(_0x53d0('0x16'))(_0x53d0('0x17'));var utils=require(_0x53d0('0x18'));var config=require(_0x53d0('0x19'));var licenseUtil=require(_0x53d0('0x1a'));var db=require(_0x53d0('0x1b'))['db'];function respondWithStatusCode(_0xc96359,_0x326d1b){_0x326d1b=_0x326d1b||0xcc;return function(_0x3d0ed9){if(_0x3d0ed9){return _0xc96359[_0x53d0('0x1c')](_0x326d1b);}return _0xc96359[_0x53d0('0x1d')](_0x326d1b)[_0x53d0('0x1e')]();};}function respondWithResult(_0x5c2cdc,_0x13f2fb){_0x13f2fb=_0x13f2fb||0xc8;return function(_0x57257e){if(_0x57257e){return _0x5c2cdc['status'](_0x13f2fb)[_0x53d0('0x1f')](_0x57257e);}};}function respondWithFilteredResult(_0x107ba6,_0x58cc09){return function(_0x2c4707){if(_0x2c4707){var _0x214d4f=typeof _0x58cc09[_0x53d0('0x20')]===_0x53d0('0x21')&&typeof _0x58cc09['limit']===_0x53d0('0x21');var _0x4507df=_0x2c4707[_0x53d0('0x22')];var _0x2254de=_0x214d4f?0x0:_0x58cc09['offset'];var _0x5b97b2=_0x214d4f?_0x2c4707[_0x53d0('0x22')]:_0x58cc09[_0x53d0('0x20')]+_0x58cc09['limit'];var _0x23f15b;if(_0x5b97b2>=_0x4507df){_0x5b97b2=_0x4507df;_0x23f15b=0xc8;}else{_0x23f15b=0xce;}_0x107ba6[_0x53d0('0x1d')](_0x23f15b);return _0x107ba6[_0x53d0('0x23')](_0x53d0('0x24'),_0x2254de+'-'+_0x5b97b2+'/'+_0x4507df)[_0x53d0('0x1f')](_0x2c4707);}return null;};}function patchUpdates(_0x184621){return function(_0x1b2d07){try{jsonpatch[_0x53d0('0x25')](_0x1b2d07,_0x184621,!![]);}catch(_0x1d79c2){return BPromise[_0x53d0('0x26')](_0x1d79c2);}return _0x1b2d07[_0x53d0('0x27')]();};}function saveUpdates(_0x156a2a,_0x3462b6){return function(_0x4dc205){if(_0x4dc205){return _0x4dc205['update'](_0x156a2a)[_0x53d0('0x28')](function(_0x29c245){return _0x29c245;});}return null;};}function removeEntity(_0x5d2e77,_0x19f13b){return function(_0x55b5d9){if(_0x55b5d9){return _0x55b5d9[_0x53d0('0x29')]()[_0x53d0('0x28')](function(){_0x5d2e77[_0x53d0('0x1d')](0xcc)[_0x53d0('0x1e')]();});}};}function handleEntityNotFound(_0x192b5e,_0x18be4c){return function(_0xde0013){if(!_0xde0013){_0x192b5e[_0x53d0('0x1c')](0x194);}return _0xde0013;};}function handleError(_0x281cba,_0x946d4c){_0x946d4c=_0x946d4c||0x1f4;return function(_0x1ca453){logger[_0x53d0('0x2a')](_0x1ca453['stack']);if(_0x1ca453[_0x53d0('0x2b')]){delete _0x1ca453[_0x53d0('0x2b')];}_0x281cba[_0x53d0('0x1d')](_0x946d4c)['send'](_0x1ca453);};}exports[_0x53d0('0x2c')]=function(_0x6068b3,_0x1002f0){var _0xdb333a={},_0x3e2198={},_0x4ea7fc={'count':0x0,'rows':[]};var _0x5ca541=_[_0x53d0('0x2d')](db[_0x53d0('0x2e')]['rawAttributes'],function(_0x318c2a){return{'name':_0x318c2a[_0x53d0('0x2f')],'type':_0x318c2a['type'][_0x53d0('0x30')]};});_0x3e2198[_0x53d0('0x31')]=_[_0x53d0('0x2d')](_0x5ca541,_0x53d0('0x2b'));_0x3e2198[_0x53d0('0x32')]=_['keys'](_0x6068b3[_0x53d0('0x32')]);_0x3e2198['filters']=_[_0x53d0('0x33')](_0x3e2198[_0x53d0('0x31')],_0x3e2198[_0x53d0('0x32')]);_0xdb333a[_0x53d0('0x34')]=_[_0x53d0('0x33')](_0x3e2198[_0x53d0('0x31')],qs['fields'](_0x6068b3[_0x53d0('0x32')][_0x53d0('0x35')]));_0xdb333a[_0x53d0('0x34')]=_0xdb333a[_0x53d0('0x34')][_0x53d0('0x36')]?_0xdb333a['attributes']:_0x3e2198['model'];if(!_0x6068b3[_0x53d0('0x32')][_0x53d0('0x37')](_0x53d0('0x38'))){_0xdb333a['limit']=qs[_0x53d0('0x39')](_0x6068b3[_0x53d0('0x32')][_0x53d0('0x39')]);_0xdb333a[_0x53d0('0x20')]=qs[_0x53d0('0x20')](_0x6068b3[_0x53d0('0x32')]['offset']);}_0xdb333a[_0x53d0('0x3a')]=qs[_0x53d0('0x3b')](_0x6068b3['query']['sort']);_0xdb333a[_0x53d0('0x3c')]=qs[_0x53d0('0x3d')](_[_0x53d0('0x3e')](_0x6068b3[_0x53d0('0x32')],_0x3e2198[_0x53d0('0x3d')]),_0x5ca541);if(_0x6068b3[_0x53d0('0x32')][_0x53d0('0x3f')]){_0xdb333a[_0x53d0('0x3c')]=_['merge'](_0xdb333a[_0x53d0('0x3c')],{'$or':_['map'](_0x5ca541,function(_0x22113c){if(_0x22113c[_0x53d0('0x40')]!=='VIRTUAL'){var _0x57c75c={};_0x57c75c[_0x22113c[_0x53d0('0x2b')]]={'$like':'%'+_0x6068b3[_0x53d0('0x32')][_0x53d0('0x3f')]+'%'};return _0x57c75c;}})});}_0xdb333a=_[_0x53d0('0x41')]({},_0xdb333a,_0x6068b3[_0x53d0('0x42')]);var _0x141225={'where':_0xdb333a[_0x53d0('0x3c')]};return db[_0x53d0('0x2e')][_0x53d0('0x22')](_0x141225)[_0x53d0('0x28')](function(_0x194441){_0x4ea7fc[_0x53d0('0x22')]=_0x194441;if(_0x6068b3[_0x53d0('0x32')][_0x53d0('0x43')]){_0xdb333a[_0x53d0('0x44')]=[{'all':!![]}];}return db[_0x53d0('0x2e')][_0x53d0('0x45')](_0xdb333a);})[_0x53d0('0x28')](function(_0x494842){_0x4ea7fc[_0x53d0('0x46')]=_0x494842;return _0x4ea7fc;})[_0x53d0('0x28')](respondWithFilteredResult(_0x1002f0,_0xdb333a))[_0x53d0('0x47')](handleError(_0x1002f0,null));};exports[_0x53d0('0x48')]=function(_0x297f7b,_0x2bd07b){var _0x326525={'raw':!![],'where':{'id':_0x297f7b['params']['id']}},_0x1000cd={};_0x1000cd['model']=_['keys'](db[_0x53d0('0x2e')][_0x53d0('0x49')]);_0x1000cd[_0x53d0('0x32')]=_['keys'](_0x297f7b[_0x53d0('0x32')]);_0x1000cd[_0x53d0('0x3d')]=_['intersection'](_0x1000cd['model'],_0x1000cd['query']);_0x326525['attributes']=_[_0x53d0('0x33')](_0x1000cd[_0x53d0('0x31')],qs[_0x53d0('0x35')](_0x297f7b[_0x53d0('0x32')][_0x53d0('0x35')]));_0x326525['attributes']=_0x326525['attributes']['length']?_0x326525[_0x53d0('0x34')]:_0x1000cd[_0x53d0('0x31')];if(_0x297f7b[_0x53d0('0x32')][_0x53d0('0x43')]){_0x326525[_0x53d0('0x44')]=[{'all':!![]}];}_0x326525=_[_0x53d0('0x41')]({},_0x326525,_0x297f7b[_0x53d0('0x42')]);return db[_0x53d0('0x2e')][_0x53d0('0x4a')](_0x326525)[_0x53d0('0x28')](handleEntityNotFound(_0x2bd07b,null))[_0x53d0('0x28')](respondWithResult(_0x2bd07b,null))['catch'](handleError(_0x2bd07b,null));};exports[_0x53d0('0x4b')]=function(_0xa583f3,_0x3b6e12){return db[_0x53d0('0x2e')][_0x53d0('0x4b')](_0xa583f3[_0x53d0('0x4c')],{})['then'](respondWithResult(_0x3b6e12,0xc9))['catch'](handleError(_0x3b6e12,null));};exports[_0x53d0('0x4d')]=function(_0x552305,_0x39034d){if(_0x552305[_0x53d0('0x4c')]['id']){delete _0x552305[_0x53d0('0x4c')]['id'];}return db[_0x53d0('0x2e')][_0x53d0('0x4a')]({'where':{'id':_0x552305[_0x53d0('0x4e')]['id']}})[_0x53d0('0x28')](handleEntityNotFound(_0x39034d,null))['then'](saveUpdates(_0x552305[_0x53d0('0x4c')],null))[_0x53d0('0x28')](respondWithResult(_0x39034d,null))[_0x53d0('0x47')](handleError(_0x39034d,null));};exports['destroy']=function(_0x2973b4,_0x42f49d){return db[_0x53d0('0x2e')]['find']({'where':{'id':_0x2973b4['params']['id']}})['then'](handleEntityNotFound(_0x42f49d,null))[_0x53d0('0x28')](removeEntity(_0x42f49d,null))[_0x53d0('0x47')](handleError(_0x42f49d,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 7a07d30..837d6a5 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 _0x987a=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash','util','api','bluebird','request-promise','path'];(function(_0x69b37e,_0x2cbec6){var _0x5cfc1b=function(_0x2c2c15){while(--_0x2c2c15){_0x69b37e['push'](_0x69b37e['shift']());}};_0x5cfc1b(++_0x2cbec6);}(_0x987a,0xde));var _0xa987=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x987a[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xa987('0x0'));var util=require(_0xa987('0x1'));var logger=require('../../config/logger')(_0xa987('0x2'));var moment=require('moment');var BPromise=require(_0xa987('0x3'));var rp=require(_0xa987('0x4'));var fs=require('fs');var path=require(_0xa987('0x5'));var rimraf=require(_0xa987('0x6'));var config=require(_0xa987('0x7'));var attributes=require(_0xa987('0x8'));module[_0xa987('0x9')]=function(_0x12b884,_0x4c4143){return _0x12b884[_0xa987('0xa')](_0xa987('0xb'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0adb=['define','analytics_report_trees','lodash','util','../../config/logger','moment','request-promise','rimraf','./analyticTreeReport.attributes'];(function(_0x2cf568,_0x19e000){var _0x5ea874=function(_0x44b46c){while(--_0x44b46c){_0x2cf568['push'](_0x2cf568['shift']());}};_0x5ea874(++_0x19e000);}(_0x0adb,0x14f));var _0xb0ad=function(_0x543960,_0x271658){_0x543960=_0x543960-0x0;var _0x640a49=_0x0adb[_0x543960];return _0x640a49;};'use strict';var _=require(_0xb0ad('0x0'));var util=require(_0xb0ad('0x1'));var logger=require(_0xb0ad('0x2'))('api');var moment=require(_0xb0ad('0x3'));var BPromise=require('bluebird');var rp=require(_0xb0ad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb0ad('0x5'));var config=require('../../config/environment');var attributes=require(_0xb0ad('0x6'));module['exports']=function(_0x3627ec,_0x2328f3){return _0x3627ec[_0xb0ad('0x7')]('AnalyticTreeReport',attributes,{'tableName':_0xb0ad('0x8'),'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 54c169d..d8344d8 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 _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x50629f,_0x41b3f7){_0x50629f=_0x50629f-0x0;var _0xdd2fc1=_0x7a54[_0x50629f];return _0xdd2fc1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +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(_0x14f2dd,_0x5cc742){var _0x5d071c=function(_0x2d63e8){while(--_0x2d63e8){_0x14f2dd['push'](_0x14f2dd['shift']());}};_0x5d071c(++_0x5cc742);}(_0xdb28,0x106));var _0x8db2=function(_0x41bc66,_0x30a09e){_0x41bc66=_0x41bc66-0x0;var _0x50f121=_0xdb28[_0x41bc66];return _0x50f121;};'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 diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index bfc04ba..679499b 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 _0x34d2=['multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','show','post','create','put','delete','/:id','destroy','exports'];(function(_0x211b9c,_0x3e4a38){var _0x5be03d=function(_0x512424){while(--_0x512424){_0x211b9c['push'](_0x211b9c['shift']());}};_0x5be03d(++_0x3e4a38);}(_0x34d2,0xa0));var _0x234d=function(_0x2d7b71,_0x289baf){_0x2d7b71=_0x2d7b71-0x0;var _0x37aa54=_0x34d2[_0x2d7b71];return _0x37aa54;};'use strict';var multer=require(_0x234d('0x0'));var util=require('util');var path=require(_0x234d('0x1'));var timeout=require(_0x234d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x234d('0x3'));var config=require(_0x234d('0x4'));var controller=require(_0x234d('0x5'));router[_0x234d('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x234d('0x7')](),controller[_0x234d('0x8')]);router[_0x234d('0x9')]('/',auth[_0x234d('0x7')](),controller[_0x234d('0xa')]);router[_0x234d('0xb')]('/:id',auth[_0x234d('0x7')](),controller['update']);router[_0x234d('0xc')](_0x234d('0xd'),auth[_0x234d('0x7')](),controller[_0x234d('0xe')]);module[_0x234d('0xf')]=router; \ No newline at end of file +var _0x8772=['index','get','/:id','show','post','create','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x8772,0x184));var _0x2877=function(_0x5c1eaf,_0x2d7243){_0x5c1eaf=_0x5c1eaf-0x0;var _0x5d1455=_0x8772[_0x5c1eaf];return _0x5d1455;};'use strict';var multer=require(_0x2877('0x0'));var util=require(_0x2877('0x1'));var path=require(_0x2877('0x2'));var timeout=require('connect-timeout');var express=require(_0x2877('0x3'));var router=express[_0x2877('0x4')]();var fs_extra=require(_0x2877('0x5'));var auth=require(_0x2877('0x6'));var interaction=require(_0x2877('0x7'));var config=require(_0x2877('0x8'));var controller=require(_0x2877('0x9'));router['get']('/',auth[_0x2877('0xa')](),controller[_0x2877('0xb')]);router[_0x2877('0xc')](_0x2877('0xd'),auth['isAuthenticated'](),controller[_0x2877('0xe')]);router[_0x2877('0xf')]('/',auth['isAuthenticated'](),controller[_0x2877('0x10')]);router['put'](_0x2877('0xd'),auth[_0x2877('0xa')](),controller['update']);router[_0x2877('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x2877('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 8d360a2..9f47e21 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 _0xa22a=['sequelize','exports','STRING'];(function(_0x4c4930,_0x368171){var _0x1aad77=function(_0x4c1f0f){while(--_0x4c1f0f){_0x4c4930['push'](_0x4c4930['shift']());}};_0x1aad77(++_0x368171);}(_0xa22a,0x153));var _0xaa22=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa22a[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xaa22('0x0'));module[_0xaa22('0x1')]={'name':{'type':Sequelize[_0xaa22('0x2')]},'basename':{'type':Sequelize[_0xaa22('0x2')]},'type':{'type':Sequelize[_0xaa22('0x2')]}}; \ No newline at end of file +var _0x7f90=['STRING','sequelize','exports'];(function(_0x574a99,_0xc41992){var _0x124e4b=function(_0x1ddd97){while(--_0x1ddd97){_0x574a99['push'](_0x574a99['shift']());}};_0x124e4b(++_0xc41992);}(_0x7f90,0xf4));var _0x07f9=function(_0x246c1d,_0x48668f){_0x246c1d=_0x246c1d-0x0;var _0x2f5975=_0x7f90[_0x246c1d];return _0x2f5975;};'use strict';var Sequelize=require(_0x07f9('0x0'));module[_0x07f9('0x1')]={'name':{'type':Sequelize[_0x07f9('0x2')]},'basename':{'type':Sequelize[_0x07f9('0x2')]},'type':{'type':Sequelize[_0x07f9('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index c5e9df9..f40e7a6 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 _0xfd5a=['omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','lodash','squel','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','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','merge','options','includeAll','rows','catch','params','include','find','clone','get'];(function(_0x10d8a1,_0x326868){var _0x5b9f20=function(_0x24173c){while(--_0x24173c){_0x10d8a1['push'](_0x10d8a1['shift']());}};_0x5b9f20(++_0x326868);}(_0xfd5a,0x1dc));var _0xafd5=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xfd5a[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xafd5('0x0'));var zipdir=require(_0xafd5('0x1'));var jsonpatch=require(_0xafd5('0x2'));var rp=require('request-promise');var moment=require(_0xafd5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xafd5('0x4'));var util=require(_0xafd5('0x5'));var path=require(_0xafd5('0x6'));var sox=require(_0xafd5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xafd5('0x8'));var squel=require(_0xafd5('0x9'));var crypto=require(_0xafd5('0xa'));var jsforce=require(_0xafd5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xafd5('0xc'));var querystring=require(_0xafd5('0xd'));var Papa=require(_0xafd5('0xe'));var Redis=require(_0xafd5('0xf'));var authService=require(_0xafd5('0x10'));var qs=require(_0xafd5('0x11'));var as=require(_0xafd5('0x12'));var hardwareService=require(_0xafd5('0x13'));var logger=require(_0xafd5('0x14'))(_0xafd5('0x15'));var utils=require(_0xafd5('0x16'));var config=require(_0xafd5('0x17'));var licenseUtil=require(_0xafd5('0x18'));var db=require(_0xafd5('0x19'))['db'];function respondWithStatusCode(_0x53f69b,_0x27d330){_0x27d330=_0x27d330||0xcc;return function(_0x5c669d){if(_0x5c669d){return _0x53f69b[_0xafd5('0x1a')](_0x27d330);}return _0x53f69b[_0xafd5('0x1b')](_0x27d330)['end']();};}function respondWithResult(_0x1b3d83,_0x39824b){_0x39824b=_0x39824b||0xc8;return function(_0x3ccbbc){if(_0x3ccbbc){return _0x1b3d83[_0xafd5('0x1b')](_0x39824b)[_0xafd5('0x1c')](_0x3ccbbc);}};}function respondWithFilteredResult(_0x1b35e7,_0x487100){return function(_0x4fa9e8){if(_0x4fa9e8){var _0x10e06e=typeof _0x487100[_0xafd5('0x1d')]==='undefined'&&typeof _0x487100[_0xafd5('0x1e')]===_0xafd5('0x1f');var _0x2210db=_0x4fa9e8[_0xafd5('0x20')];var _0x256f3b=_0x10e06e?0x0:_0x487100['offset'];var _0x380f6e=_0x10e06e?_0x4fa9e8[_0xafd5('0x20')]:_0x487100['offset']+_0x487100[_0xafd5('0x1e')];var _0x5cc995;if(_0x380f6e>=_0x2210db){_0x380f6e=_0x2210db;_0x5cc995=0xc8;}else{_0x5cc995=0xce;}_0x1b35e7[_0xafd5('0x1b')](_0x5cc995);return _0x1b35e7[_0xafd5('0x21')](_0xafd5('0x22'),_0x256f3b+'-'+_0x380f6e+'/'+_0x2210db)[_0xafd5('0x1c')](_0x4fa9e8);}return null;};}function patchUpdates(_0x11d364){return function(_0xd03e1a){try{jsonpatch['apply'](_0xd03e1a,_0x11d364,!![]);}catch(_0x1d3803){return BPromise[_0xafd5('0x23')](_0x1d3803);}return _0xd03e1a[_0xafd5('0x24')]();};}function saveUpdates(_0x5e0321,_0x3f72fc){return function(_0x4e5216){if(_0x4e5216){return _0x4e5216[_0xafd5('0x25')](_0x5e0321)[_0xafd5('0x26')](function(_0x3c930c){return _0x3c930c;});}return null;};}function removeEntity(_0x475195,_0x55baa5){return function(_0x392f6b){if(_0x392f6b){return _0x392f6b[_0xafd5('0x27')]()[_0xafd5('0x26')](function(){_0x475195['status'](0xcc)[_0xafd5('0x28')]();});}};}function handleEntityNotFound(_0x318216,_0x2eaba5){return function(_0x493d4a){if(!_0x493d4a){_0x318216[_0xafd5('0x1a')](0x194);}return _0x493d4a;};}function handleError(_0x17f322,_0x472f13){_0x472f13=_0x472f13||0x1f4;return function(_0x10c3eb){logger['error'](_0x10c3eb[_0xafd5('0x29')]);if(_0x10c3eb[_0xafd5('0x2a')]){delete _0x10c3eb[_0xafd5('0x2a')];}_0x17f322[_0xafd5('0x1b')](_0x472f13)[_0xafd5('0x2b')](_0x10c3eb);};}exports[_0xafd5('0x2c')]=function(_0x3ae907,_0x10008a){var _0x39d624={},_0x2c1fab={},_0x254a17={'count':0x0,'rows':[]};var _0x168308=_['map'](db[_0xafd5('0x2d')][_0xafd5('0x2e')],function(_0x19eaeb){return{'name':_0x19eaeb[_0xafd5('0x2f')],'type':_0x19eaeb[_0xafd5('0x30')][_0xafd5('0x31')]};});_0x2c1fab[_0xafd5('0x32')]=_['map'](_0x168308,_0xafd5('0x2a'));_0x2c1fab[_0xafd5('0x33')]=_[_0xafd5('0x34')](_0x3ae907[_0xafd5('0x33')]);_0x2c1fab[_0xafd5('0x35')]=_[_0xafd5('0x36')](_0x2c1fab[_0xafd5('0x32')],_0x2c1fab[_0xafd5('0x33')]);_0x39d624[_0xafd5('0x37')]=_['intersection'](_0x2c1fab['model'],qs[_0xafd5('0x38')](_0x3ae907[_0xafd5('0x33')][_0xafd5('0x38')]));_0x39d624['attributes']=_0x39d624['attributes'][_0xafd5('0x39')]?_0x39d624[_0xafd5('0x37')]:_0x2c1fab['model'];if(!_0x3ae907[_0xafd5('0x33')][_0xafd5('0x3a')](_0xafd5('0x3b'))){_0x39d624[_0xafd5('0x1e')]=qs[_0xafd5('0x1e')](_0x3ae907[_0xafd5('0x33')][_0xafd5('0x1e')]);_0x39d624[_0xafd5('0x1d')]=qs[_0xafd5('0x1d')](_0x3ae907[_0xafd5('0x33')][_0xafd5('0x1d')]);}_0x39d624[_0xafd5('0x3c')]=qs[_0xafd5('0x3d')](_0x3ae907['query'][_0xafd5('0x3d')]);_0x39d624[_0xafd5('0x3e')]=qs[_0xafd5('0x35')](_['pick'](_0x3ae907[_0xafd5('0x33')],_0x2c1fab[_0xafd5('0x35')]),_0x168308);if(_0x3ae907[_0xafd5('0x33')][_0xafd5('0x3f')]){_0x39d624['where']=_['merge'](_0x39d624[_0xafd5('0x3e')],{'$or':_[_0xafd5('0x40')](_0x168308,function(_0x16e422){if(_0x16e422[_0xafd5('0x30')]!==_0xafd5('0x41')){var _0x55eaa3={};_0x55eaa3[_0x16e422[_0xafd5('0x2a')]]={'$like':'%'+_0x3ae907['query']['filter']+'%'};return _0x55eaa3;}})});}_0x39d624=_[_0xafd5('0x42')]({},_0x39d624,_0x3ae907[_0xafd5('0x43')]);var _0x41464f={'where':_0x39d624[_0xafd5('0x3e')]};return db[_0xafd5('0x2d')][_0xafd5('0x20')](_0x41464f)[_0xafd5('0x26')](function(_0x411926){_0x254a17['count']=_0x411926;if(_0x3ae907['query'][_0xafd5('0x44')]){_0x39d624['include']=[{'all':!![]}];}return db[_0xafd5('0x2d')]['findAll'](_0x39d624);})['then'](function(_0xc66841){_0x254a17[_0xafd5('0x45')]=_0xc66841;return _0x254a17;})[_0xafd5('0x26')](respondWithFilteredResult(_0x10008a,_0x39d624))[_0xafd5('0x46')](handleError(_0x10008a,null));};exports['show']=function(_0x45df94,_0x4edb5f){var _0xdf1e49={'raw':!![],'where':{'id':_0x45df94[_0xafd5('0x47')]['id']}},_0x5b3823={};_0x5b3823[_0xafd5('0x32')]=_[_0xafd5('0x34')](db[_0xafd5('0x2d')][_0xafd5('0x2e')]);_0x5b3823[_0xafd5('0x33')]=_[_0xafd5('0x34')](_0x45df94[_0xafd5('0x33')]);_0x5b3823[_0xafd5('0x35')]=_['intersection'](_0x5b3823['model'],_0x5b3823[_0xafd5('0x33')]);_0xdf1e49[_0xafd5('0x37')]=_[_0xafd5('0x36')](_0x5b3823[_0xafd5('0x32')],qs[_0xafd5('0x38')](_0x45df94[_0xafd5('0x33')][_0xafd5('0x38')]));_0xdf1e49['attributes']=_0xdf1e49['attributes'][_0xafd5('0x39')]?_0xdf1e49[_0xafd5('0x37')]:_0x5b3823[_0xafd5('0x32')];if(_0x45df94[_0xafd5('0x33')][_0xafd5('0x44')]){_0xdf1e49[_0xafd5('0x48')]=[{'all':!![]}];}_0xdf1e49=_['merge']({},_0xdf1e49,_0x45df94[_0xafd5('0x43')]);return db[_0xafd5('0x2d')][_0xafd5('0x49')](_0xdf1e49)[_0xafd5('0x26')](handleEntityNotFound(_0x4edb5f,null))[_0xafd5('0x26')](respondWithResult(_0x4edb5f,null))['catch'](handleError(_0x4edb5f,null));};exports[_0xafd5('0x4a')]=function(_0x836718,_0x37d56b){var _0x5838be={'where':{'id':_0x836718[_0xafd5('0x47')]['id']}},_0x6db3f7={};_0x6db3f7['model']=_[_0xafd5('0x34')](db[_0xafd5('0x2d')][_0xafd5('0x2e')]);_0x5838be[_0xafd5('0x37')]=_['intersection'](_0x6db3f7[_0xafd5('0x32')],qs['fields'](_0x836718[_0xafd5('0x33')][_0xafd5('0x38')]));_0x5838be[_0xafd5('0x37')]=_0x5838be[_0xafd5('0x37')]['length']?_0x5838be['attributes']:_0x6db3f7[_0xafd5('0x32')];if(_0x836718[_0xafd5('0x33')][_0xafd5('0x44')]){_0x5838be[_0xafd5('0x48')]=[{'all':!![]}];}_0x5838be=_[_0xafd5('0x42')]({},_0x5838be,_0x836718[_0xafd5('0x43')]);return db['Attachment'][_0xafd5('0x49')](_0x5838be)['then'](handleEntityNotFound(_0x37d56b,null))[_0xafd5('0x26')](function(_0x2fdca6){if(_0x2fdca6){var _0x3d87a9=_0x2fdca6[_0xafd5('0x4b')]({'plain':!![]});_0x3d87a9=qs[_0xafd5('0x4c')](_0x3d87a9,['id',_0xafd5('0x4d'),_0xafd5('0x4e')]);_0x836718[_0xafd5('0x4f')]=_['omit'](_0x836718[_0xafd5('0x4f')],['id','createdAt',_0xafd5('0x4e')]);return db[_0xafd5('0x2d')]['create'](_[_0xafd5('0x42')](_0x3d87a9,_0x836718[_0xafd5('0x4f')]),{'include':_0x836718[_0xafd5('0x33')][_0xafd5('0x44')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x37d56b,0xc9))[_0xafd5('0x46')](handleError(_0x37d56b,null));};exports['update']=function(_0x3aecdc,_0x2350ca){if(_0x3aecdc[_0xafd5('0x4f')]['id']){delete _0x3aecdc[_0xafd5('0x4f')]['id'];}return db[_0xafd5('0x2d')][_0xafd5('0x49')]({'where':{'id':_0x3aecdc['params']['id']}})[_0xafd5('0x26')](handleEntityNotFound(_0x2350ca,null))[_0xafd5('0x26')](saveUpdates(_0x3aecdc[_0xafd5('0x4f')],null))[_0xafd5('0x26')](respondWithResult(_0x2350ca,null))['catch'](handleError(_0x2350ca,null));};exports[_0xafd5('0x27')]=function(_0x532abb,_0x2ee0df){return db[_0xafd5('0x2d')]['find']({'where':{'id':_0x532abb[_0xafd5('0x47')]['id']}})[_0xafd5('0x26')](handleEntityNotFound(_0x2ee0df,null))[_0xafd5('0x26')](removeEntity(_0x2ee0df,null))[_0xafd5('0x46')](handleError(_0x2ee0df,null));};exports[_0xafd5('0x50')]=function(_0xc1b263,_0x23ffca,_0x159e16){_0xc1b263['body'][_0xafd5('0x2a')]=_0xc1b263[_0xafd5('0x51')][_0xafd5('0x52')];_0xc1b263['body'][_0xafd5('0x53')]=_0xc1b263[_0xafd5('0x51')][_0xafd5('0x54')];_0xc1b263[_0xafd5('0x4f')][_0xafd5('0x30')]=_0xc1b263['file']['mimetype'];return db[_0xafd5('0x2d')][_0xafd5('0x50')](_0xc1b263['body'])[_0xafd5('0x26')](respondWithResult(_0x23ffca,0xc9))['catch'](handleError(_0x23ffca,null));};exports[_0xafd5('0x55')]=function(_0x32ca79,_0x340a01,_0x4c0ba5){return db[_0xafd5('0x2d')][_0xafd5('0x56')]({'where':{'id':_0x32ca79['params']['id']},'raw':!![]})[_0xafd5('0x26')](handleEntityNotFound(_0x340a01,null))[_0xafd5('0x26')](function(_0x38b678){if(_0x38b678){var _0x31225e=_0x38b678[_0xafd5('0x57')]!==null;var _0x1fb2b7=path[_0xafd5('0x58')](config[_0xafd5('0x59')],_0xafd5('0x5a'));if(_0x31225e){_0x1fb2b7=path[_0xafd5('0x58')](_0x1fb2b7,_0xafd5('0x5b'));}var _0x4f8121=path['join'](_0x1fb2b7,_0x38b678[_0xafd5('0x53')]);return _0x340a01['download'](_0x4f8121);}})[_0xafd5('0x46')](handleError(_0x340a01,null));}; \ No newline at end of file +var _0xbeea=['fs-extra','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','set','Content-Range','reject','update','then','destroy','end','error','stack','send','index','map','Attachment','rawAttributes','type','key','name','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','rows','show','params','include','find','clone','omit','createdAt','updatedAt','body','catch','file','basename','create','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbeea,0x146));var _0xabee=function(_0x1d65d1,_0x34fbd1){_0x1d65d1=_0x1d65d1-0x0;var _0x4bf796=_0xbeea[_0x1d65d1];return _0x4bf796;};'use strict';var emlformat=require(_0xabee('0x0'));var rimraf=require(_0xabee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xabee('0x2'));var rp=require('request-promise');var moment=require(_0xabee('0x3'));var BPromise=require(_0xabee('0x4'));var Mustache=require(_0xabee('0x5'));var util=require(_0xabee('0x6'));var path=require(_0xabee('0x7'));var sox=require(_0xabee('0x8'));var csv=require(_0xabee('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xabee('0xa'));var _=require('lodash');var squel=require(_0xabee('0xb'));var crypto=require(_0xabee('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xabee('0x9'));var querystring=require(_0xabee('0xd'));var Papa=require(_0xabee('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xabee('0xf'));var as=require(_0xabee('0x10'));var hardwareService=require(_0xabee('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xabee('0x12'));var db=require(_0xabee('0x13'))['db'];function respondWithStatusCode(_0x5c5627,_0x3b87af){_0x3b87af=_0x3b87af||0xcc;return function(_0x5261dd){if(_0x5261dd){return _0x5c5627['sendStatus'](_0x3b87af);}return _0x5c5627[_0xabee('0x14')](_0x3b87af)['end']();};}function respondWithResult(_0x26650d,_0x429d13){_0x429d13=_0x429d13||0xc8;return function(_0x3e4323){if(_0x3e4323){return _0x26650d[_0xabee('0x14')](_0x429d13)[_0xabee('0x15')](_0x3e4323);}};}function respondWithFilteredResult(_0x53f873,_0x816bcb){return function(_0x413ab6){if(_0x413ab6){var _0x19eaf7=typeof _0x816bcb[_0xabee('0x16')]===_0xabee('0x17')&&typeof _0x816bcb[_0xabee('0x18')]===_0xabee('0x17');var _0x365a37=_0x413ab6['count'];var _0x263dba=_0x19eaf7?0x0:_0x816bcb[_0xabee('0x16')];var _0x37646a=_0x19eaf7?_0x413ab6['count']:_0x816bcb['offset']+_0x816bcb[_0xabee('0x18')];var _0x30996b;if(_0x37646a>=_0x365a37){_0x37646a=_0x365a37;_0x30996b=0xc8;}else{_0x30996b=0xce;}_0x53f873['status'](_0x30996b);return _0x53f873[_0xabee('0x19')](_0xabee('0x1a'),_0x263dba+'-'+_0x37646a+'/'+_0x365a37)['json'](_0x413ab6);}return null;};}function patchUpdates(_0xa84260){return function(_0x46780b){try{jsonpatch['apply'](_0x46780b,_0xa84260,!![]);}catch(_0xdf3771){return BPromise[_0xabee('0x1b')](_0xdf3771);}return _0x46780b['save']();};}function saveUpdates(_0x32b028,_0xd7f00){return function(_0xb9fa7){if(_0xb9fa7){return _0xb9fa7[_0xabee('0x1c')](_0x32b028)[_0xabee('0x1d')](function(_0x57ed8a){return _0x57ed8a;});}return null;};}function removeEntity(_0x537d33,_0x27f2c7){return function(_0x59397c){if(_0x59397c){return _0x59397c[_0xabee('0x1e')]()[_0xabee('0x1d')](function(){_0x537d33[_0xabee('0x14')](0xcc)[_0xabee('0x1f')]();});}};}function handleEntityNotFound(_0x59a941,_0x5a3f26){return function(_0x4cc0a6){if(!_0x4cc0a6){_0x59a941['sendStatus'](0x194);}return _0x4cc0a6;};}function handleError(_0x12c822,_0x2d4c24){_0x2d4c24=_0x2d4c24||0x1f4;return function(_0x55a4b1){logger[_0xabee('0x20')](_0x55a4b1[_0xabee('0x21')]);if(_0x55a4b1['name']){delete _0x55a4b1['name'];}_0x12c822[_0xabee('0x14')](_0x2d4c24)[_0xabee('0x22')](_0x55a4b1);};}exports[_0xabee('0x23')]=function(_0x426b5b,_0x52b545){var _0x32db0a={},_0x2f084e={},_0x28fc5f={'count':0x0,'rows':[]};var _0x2b01a6=_[_0xabee('0x24')](db[_0xabee('0x25')][_0xabee('0x26')],function(_0x2abb8d){return{'name':_0x2abb8d['fieldName'],'type':_0x2abb8d[_0xabee('0x27')][_0xabee('0x28')]};});_0x2f084e['model']=_[_0xabee('0x24')](_0x2b01a6,_0xabee('0x29'));_0x2f084e['query']=_[_0xabee('0x2a')](_0x426b5b[_0xabee('0x2b')]);_0x2f084e[_0xabee('0x2c')]=_[_0xabee('0x2d')](_0x2f084e[_0xabee('0x2e')],_0x2f084e['query']);_0x32db0a[_0xabee('0x2f')]=_['intersection'](_0x2f084e[_0xabee('0x2e')],qs[_0xabee('0x30')](_0x426b5b[_0xabee('0x2b')]['fields']));_0x32db0a[_0xabee('0x2f')]=_0x32db0a[_0xabee('0x2f')][_0xabee('0x31')]?_0x32db0a['attributes']:_0x2f084e[_0xabee('0x2e')];if(!_0x426b5b['query'][_0xabee('0x32')](_0xabee('0x33'))){_0x32db0a[_0xabee('0x18')]=qs[_0xabee('0x18')](_0x426b5b[_0xabee('0x2b')][_0xabee('0x18')]);_0x32db0a[_0xabee('0x16')]=qs['offset'](_0x426b5b['query'][_0xabee('0x16')]);}_0x32db0a[_0xabee('0x34')]=qs[_0xabee('0x35')](_0x426b5b[_0xabee('0x2b')][_0xabee('0x35')]);_0x32db0a[_0xabee('0x36')]=qs[_0xabee('0x2c')](_[_0xabee('0x37')](_0x426b5b[_0xabee('0x2b')],_0x2f084e['filters']),_0x2b01a6);if(_0x426b5b[_0xabee('0x2b')][_0xabee('0x38')]){_0x32db0a[_0xabee('0x36')]=_['merge'](_0x32db0a[_0xabee('0x36')],{'$or':_[_0xabee('0x24')](_0x2b01a6,function(_0x1a3e60){if(_0x1a3e60[_0xabee('0x27')]!==_0xabee('0x39')){var _0xb4bcf3={};_0xb4bcf3[_0x1a3e60[_0xabee('0x29')]]={'$like':'%'+_0x426b5b[_0xabee('0x2b')][_0xabee('0x38')]+'%'};return _0xb4bcf3;}})});}_0x32db0a=_[_0xabee('0x3a')]({},_0x32db0a,_0x426b5b[_0xabee('0x3b')]);var _0x4f3f9b={'where':_0x32db0a[_0xabee('0x36')]};return db[_0xabee('0x25')][_0xabee('0x3c')](_0x4f3f9b)[_0xabee('0x1d')](function(_0x490d17){_0x28fc5f[_0xabee('0x3c')]=_0x490d17;if(_0x426b5b['query'][_0xabee('0x3d')]){_0x32db0a['include']=[{'all':!![]}];}return db[_0xabee('0x25')][_0xabee('0x3e')](_0x32db0a);})[_0xabee('0x1d')](function(_0x117d2d){_0x28fc5f[_0xabee('0x3f')]=_0x117d2d;return _0x28fc5f;})['then'](respondWithFilteredResult(_0x52b545,_0x32db0a))['catch'](handleError(_0x52b545,null));};exports[_0xabee('0x40')]=function(_0x241beb,_0x56f83b){var _0x48ecc7={'raw':!![],'where':{'id':_0x241beb[_0xabee('0x41')]['id']}},_0x2a4208={};_0x2a4208[_0xabee('0x2e')]=_[_0xabee('0x2a')](db[_0xabee('0x25')][_0xabee('0x26')]);_0x2a4208[_0xabee('0x2b')]=_[_0xabee('0x2a')](_0x241beb['query']);_0x2a4208[_0xabee('0x2c')]=_[_0xabee('0x2d')](_0x2a4208[_0xabee('0x2e')],_0x2a4208[_0xabee('0x2b')]);_0x48ecc7[_0xabee('0x2f')]=_[_0xabee('0x2d')](_0x2a4208[_0xabee('0x2e')],qs[_0xabee('0x30')](_0x241beb[_0xabee('0x2b')]['fields']));_0x48ecc7[_0xabee('0x2f')]=_0x48ecc7[_0xabee('0x2f')][_0xabee('0x31')]?_0x48ecc7['attributes']:_0x2a4208[_0xabee('0x2e')];if(_0x241beb[_0xabee('0x2b')][_0xabee('0x3d')]){_0x48ecc7[_0xabee('0x42')]=[{'all':!![]}];}_0x48ecc7=_[_0xabee('0x3a')]({},_0x48ecc7,_0x241beb[_0xabee('0x3b')]);return db[_0xabee('0x25')][_0xabee('0x43')](_0x48ecc7)['then'](handleEntityNotFound(_0x56f83b,null))[_0xabee('0x1d')](respondWithResult(_0x56f83b,null))['catch'](handleError(_0x56f83b,null));};exports[_0xabee('0x44')]=function(_0x295a3b,_0x183d6e){var _0x2785e6={'where':{'id':_0x295a3b[_0xabee('0x41')]['id']}},_0x567fbf={};_0x567fbf[_0xabee('0x2e')]=_[_0xabee('0x2a')](db[_0xabee('0x25')][_0xabee('0x26')]);_0x2785e6[_0xabee('0x2f')]=_[_0xabee('0x2d')](_0x567fbf[_0xabee('0x2e')],qs['fields'](_0x295a3b['query']['fields']));_0x2785e6['attributes']=_0x2785e6[_0xabee('0x2f')][_0xabee('0x31')]?_0x2785e6['attributes']:_0x567fbf[_0xabee('0x2e')];if(_0x295a3b[_0xabee('0x2b')][_0xabee('0x3d')]){_0x2785e6[_0xabee('0x42')]=[{'all':!![]}];}_0x2785e6=_['merge']({},_0x2785e6,_0x295a3b[_0xabee('0x3b')]);return db[_0xabee('0x25')][_0xabee('0x43')](_0x2785e6)[_0xabee('0x1d')](handleEntityNotFound(_0x183d6e,null))[_0xabee('0x1d')](function(_0x58ec75){if(_0x58ec75){var _0x590341=_0x58ec75['get']({'plain':!![]});_0x590341=qs[_0xabee('0x45')](_0x590341,['id',_0xabee('0x46'),_0xabee('0x47')]);_0x295a3b[_0xabee('0x48')]=_[_0xabee('0x45')](_0x295a3b[_0xabee('0x48')],['id',_0xabee('0x46'),_0xabee('0x47')]);return db['Attachment']['create'](_[_0xabee('0x3a')](_0x590341,_0x295a3b[_0xabee('0x48')]),{'include':_0x295a3b[_0xabee('0x2b')][_0xabee('0x3d')]?[{'all':!![]}]:undefined});}})[_0xabee('0x1d')](respondWithResult(_0x183d6e,0xc9))[_0xabee('0x49')](handleError(_0x183d6e,null));};exports[_0xabee('0x1c')]=function(_0xa8fa1a,_0x46adc9){if(_0xa8fa1a[_0xabee('0x48')]['id']){delete _0xa8fa1a[_0xabee('0x48')]['id'];}return db[_0xabee('0x25')][_0xabee('0x43')]({'where':{'id':_0xa8fa1a[_0xabee('0x41')]['id']}})[_0xabee('0x1d')](handleEntityNotFound(_0x46adc9,null))[_0xabee('0x1d')](saveUpdates(_0xa8fa1a[_0xabee('0x48')],null))[_0xabee('0x1d')](respondWithResult(_0x46adc9,null))[_0xabee('0x49')](handleError(_0x46adc9,null));};exports[_0xabee('0x1e')]=function(_0x2ac140,_0xb4b666){return db[_0xabee('0x25')]['find']({'where':{'id':_0x2ac140[_0xabee('0x41')]['id']}})[_0xabee('0x1d')](handleEntityNotFound(_0xb4b666,null))['then'](removeEntity(_0xb4b666,null))['catch'](handleError(_0xb4b666,null));};exports['create']=function(_0x40eedf,_0x563fd3,_0x14a44d){_0x40eedf[_0xabee('0x48')]['name']=_0x40eedf[_0xabee('0x4a')]['originalname'];_0x40eedf[_0xabee('0x48')][_0xabee('0x4b')]=_0x40eedf['file']['filename'];_0x40eedf[_0xabee('0x48')]['type']=_0x40eedf[_0xabee('0x4a')]['mimetype'];return db[_0xabee('0x25')][_0xabee('0x4c')](_0x40eedf[_0xabee('0x48')])['then'](respondWithResult(_0x563fd3,0xc9))[_0xabee('0x49')](handleError(_0x563fd3,null));};exports[_0xabee('0x4d')]=function(_0x1656a5,_0x2fbbbd,_0x10cccf){return db[_0xabee('0x25')][_0xabee('0x4e')]({'where':{'id':_0x1656a5[_0xabee('0x41')]['id']},'raw':!![]})[_0xabee('0x1d')](handleEntityNotFound(_0x2fbbbd,null))[_0xabee('0x1d')](function(_0x5c534d){if(_0x5c534d){var _0x52e7ac=_0x5c534d[_0xabee('0x4f')]!==null;var _0x22e7a1=path[_0xabee('0x50')](config[_0xabee('0x51')],_0xabee('0x52'));if(_0x52e7ac){_0x22e7a1=path[_0xabee('0x50')](_0x22e7a1,_0xabee('0x53'));}var _0x57d7ac=path[_0xabee('0x50')](_0x22e7a1,_0x5c534d[_0xabee('0x4b')]);return _0x2fbbbd[_0xabee('0x4d')](_0x57d7ac);}})[_0xabee('0x49')](handleError(_0x2fbbbd,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index f9ba00e..66a4204 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 _0x7fcd=['lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7fcd,0x1b8));var _0xd7fc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7fcd[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xd7fc('0x0'));var util=require('util');var logger=require(_0xd7fc('0x1'))(_0xd7fc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd7fc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd7fc('0x4'));var config=require(_0xd7fc('0x5'));var attributes=require(_0xd7fc('0x6'));module[_0xd7fc('0x7')]=function(_0x1e2d40,_0x184432){return _0x1e2d40[_0xd7fc('0x8')](_0xd7fc('0x9'),attributes,{'tableName':_0xd7fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e28=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','attachments','lodash'];(function(_0x3d7022,_0x59dfd5){var _0x40870b=function(_0x20c643){while(--_0x20c643){_0x3d7022['push'](_0x3d7022['shift']());}};_0x40870b(++_0x59dfd5);}(_0x0e28,0x8e));var _0x80e2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0e28[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x80e2('0x0'));var util=require(_0x80e2('0x1'));var logger=require(_0x80e2('0x2'))(_0x80e2('0x3'));var moment=require('moment');var BPromise=require(_0x80e2('0x4'));var rp=require(_0x80e2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x80e2('0x6'));var config=require(_0x80e2('0x7'));var attributes=require('./attachment.attributes');module[_0x80e2('0x8')]=function(_0x4a49b2,_0x386d4e){return _0x4a49b2[_0x80e2('0x9')]('Attachment',attributes,{'tableName':_0x80e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 0469dec..07bfdd8 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 _0xa25c=['message','Attachment,\x20%s,\x20%s','result','catch','CreateAttachment','Attachment','create','body','options','then','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x40673a,_0x4821ea){var _0x3fa7d1=function(_0x3e00eb){while(--_0x3e00eb){_0x40673a['push'](_0x40673a['shift']());}};_0x3fa7d1(++_0x4821ea);}(_0xa25c,0x13f));var _0xca25=function(_0x19bd0d,_0x2ee583){_0x19bd0d=_0x19bd0d-0x0;var _0x3d7189=_0xa25c[_0x19bd0d];return _0x3d7189;};'use strict';var _=require('lodash');var util=require(_0xca25('0x0'));var moment=require(_0xca25('0x1'));var BPromise=require(_0xca25('0x2'));var rs=require(_0xca25('0x3'));var fs=require('fs');var Redis=require(_0xca25('0x4'));var db=require(_0xca25('0x5'))['db'];var utils=require(_0xca25('0x6'));var logger=require(_0xca25('0x7'))('rpc');var config=require(_0xca25('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xca25('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e9352,_0xb2fc94,_0x3cee89){return new BPromise(function(_0x2c0b8c,_0x42a97a){return client[_0xca25('0xa')](_0x4e9352,_0x3cee89)['then'](function(_0x5d820c){logger[_0xca25('0xb')]('Attachment,\x20%s,\x20%s',_0xb2fc94,_0xca25('0xc'));logger[_0xca25('0xd')](_0xca25('0xe'),_0xb2fc94,'request\x20sent',JSON['stringify'](_0x5d820c));if(_0x5d820c['error']){if(_0x5d820c[_0xca25('0xf')][_0xca25('0x10')]===0x1f4){logger[_0xca25('0xf')]('Attachment,\x20%s,\x20%s',_0xb2fc94,_0x5d820c['error'][_0xca25('0x11')]);return _0x42a97a(_0x5d820c['error'][_0xca25('0x11')]);}logger[_0xca25('0xf')](_0xca25('0x12'),_0xb2fc94,_0x5d820c[_0xca25('0xf')][_0xca25('0x11')]);return _0x2c0b8c(_0x5d820c[_0xca25('0xf')][_0xca25('0x11')]);}else{logger[_0xca25('0xb')](_0xca25('0x12'),_0xb2fc94,_0xca25('0xc'));_0x2c0b8c(_0x5d820c[_0xca25('0x13')]['message']);}})[_0xca25('0x14')](function(_0x340c9b){logger['error'](_0xca25('0x12'),_0xb2fc94,_0x340c9b);_0x42a97a(_0x340c9b);});});}exports[_0xca25('0x15')]=function(_0x3705a0){var _0x18ec6f=this;return new Promise(function(_0x155cf2,_0x59997b){return db[_0xca25('0x16')][_0xca25('0x17')](_0x3705a0[_0xca25('0x18')],{'raw':_0x3705a0[_0xca25('0x19')]?_0x3705a0[_0xca25('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xca25('0x1a')](function(_0x3598c7){logger[_0xca25('0xb')](_0xca25('0x15'),_0x3705a0);logger[_0xca25('0xd')](_0xca25('0x15'),_0x3705a0,JSON[_0xca25('0x1b')](_0x3598c7));_0x155cf2(_0x3598c7);})['catch'](function(_0x48fdf5){logger[_0xca25('0xf')](_0xca25('0x15'),_0x48fdf5[_0xca25('0x11')],_0x3705a0);_0x59997b(_0x18ec6f[_0xca25('0xf')](0x1f4,_0x48fdf5[_0xca25('0x11')]));});});}; \ No newline at end of file +var _0x3036=['request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateAttachment','Attachment','create','body','options','raw','catch','moment','bluebird','randomstring','../../mysqldb','../../config/environment','client','http'];(function(_0x1953e9,_0x58b5bb){var _0x485ae4=function(_0x568c96){while(--_0x568c96){_0x1953e9['push'](_0x1953e9['shift']());}};_0x485ae4(++_0x58b5bb);}(_0x3036,0x1a9));var _0x6303=function(_0x5f016a,_0x2c829f){_0x5f016a=_0x5f016a-0x0;var _0xf108d8=_0x3036[_0x5f016a];return _0xf108d8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6303('0x0'));var BPromise=require(_0x6303('0x1'));var rs=require(_0x6303('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6303('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6303('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x6303('0x5')][_0x6303('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x25a0ce,_0x48c936,_0x8a0038){return new BPromise(function(_0x420da8,_0x2e2be8){return client[_0x6303('0x7')](_0x25a0ce,_0x8a0038)[_0x6303('0x8')](function(_0x2684ac){logger[_0x6303('0x9')](_0x6303('0xa'),_0x48c936,_0x6303('0xb'));logger['debug'](_0x6303('0xc'),_0x48c936,_0x6303('0xb'),JSON[_0x6303('0xd')](_0x2684ac));if(_0x2684ac[_0x6303('0xe')]){if(_0x2684ac[_0x6303('0xe')]['code']===0x1f4){logger[_0x6303('0xe')](_0x6303('0xa'),_0x48c936,_0x2684ac[_0x6303('0xe')][_0x6303('0xf')]);return _0x2e2be8(_0x2684ac[_0x6303('0xe')]['message']);}logger['error']('Attachment,\x20%s,\x20%s',_0x48c936,_0x2684ac[_0x6303('0xe')][_0x6303('0xf')]);return _0x420da8(_0x2684ac[_0x6303('0xe')][_0x6303('0xf')]);}else{logger[_0x6303('0x9')](_0x6303('0xa'),_0x48c936,_0x6303('0xb'));_0x420da8(_0x2684ac[_0x6303('0x10')][_0x6303('0xf')]);}})['catch'](function(_0x50a19c){logger[_0x6303('0xe')](_0x6303('0xa'),_0x48c936,_0x50a19c);_0x2e2be8(_0x50a19c);});});}exports[_0x6303('0x11')]=function(_0x748520){var _0x36a6af=this;return new Promise(function(_0x4fe5cf,_0x30dcd2){return db[_0x6303('0x12')][_0x6303('0x13')](_0x748520[_0x6303('0x14')],{'raw':_0x748520[_0x6303('0x15')]?_0x748520[_0x6303('0x15')][_0x6303('0x16')]===undefined?!![]:![]:!![]})[_0x6303('0x8')](function(_0x223d91){logger[_0x6303('0x9')](_0x6303('0x11'),_0x748520);logger['debug']('CreateAttachment',_0x748520,JSON[_0x6303('0xd')](_0x223d91));_0x4fe5cf(_0x223d91);})[_0x6303('0x17')](function(_0x24c7c5){logger[_0x6303('0xe')]('CreateAttachment',_0x24c7c5[_0x6303('0xf')],_0x748520);_0x30dcd2(_0x36a6af[_0x6303('0xe')](0x1f4,_0x24c7c5[_0x6303('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 576c22e..4209305 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x4ca7fd,_0x3fb50b){var _0x2caaa3=function(_0x47875f){while(--_0x47875f){_0x4ca7fd['push'](_0x4ca7fd['shift']());}};_0x2caaa3(++_0x3fb50b);}(_0xadb5,0xad));var _0x5adb=function(_0x446987,_0x56451e){_0x446987=_0x446987-0x0;var _0x16b73b=_0xadb5[_0x446987];return _0x16b73b;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x0b0e[_0x2642cb];return _0xe6e41;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index db74043..0144245 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 _0x1521=['use','clientID','clientSecret','secret','callbackURL','Setting','User','find','value','admin','agent','then','disabled','blockDuration','blocked','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','google','/login','profile','callback','authenticate'];(function(_0x51ce51,_0x2dddd0){var _0x1bcc8f=function(_0x4f04f3){while(--_0x4f04f3){_0x51ce51['push'](_0x51ce51['shift']());}};_0x1bcc8f(++_0x2dddd0);}(_0x1521,0x173));var _0x1152=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x1521[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0x1152('0x0'));var passport=require(_0x1152('0x1'));var GoogleStrategy=require(_0x1152('0x2'))['Strategy'];var moment=require(_0x1152('0x3'));var db=require(_0x1152('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0x1152('0x5'))[_0x1152('0x6')];var utils=require(_0x1152('0x7'));exports[_0x1152('0x8')]=passport['authenticate'](_0x1152('0x9'),{'failureRedirect':_0x1152('0xa'),'scope':[_0x1152('0xb'),'email'],'session':![]});exports[_0x1152('0xc')]=passport[_0x1152('0xd')](_0x1152('0x9'),{'failureRedirect':_0x1152('0xa'),'session':![]});passport[_0x1152('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x1152('0x9')][_0x1152('0xf')]:'id','clientSecret':config[_0x1152('0x9')]?config['google'][_0x1152('0x10')]:_0x1152('0x11'),'callbackURL':config[_0x1152('0x9')]?config[_0x1152('0x9')][_0x1152('0x12')]:''},function(_0x510054,_0x360971,_0x4af2c1,_0x49df7b){var _0x1e31d6,_0xf9d4bf;return db[_0x1152('0x13')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0xc71d37){_0x1e31d6=_0xc71d37;return db[_0x1152('0x14')][_0x1152('0x15')]({'where':{'email':_['map'](_0x4af2c1['emails'],_0x1152('0x16')),'role':{'$or':[_0x1152('0x17'),'user',_0x1152('0x18')]}}});})[_0x1152('0x19')](function(_0x2047b3){_0xf9d4bf=_0x2047b3;if(_0xf9d4bf){if(_0xf9d4bf[_0x1152('0x1a')]){return _0x49df7b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x1e31d6[_0x1152('0x1b')]>0x0){if(_0xf9d4bf[_0x1152('0x1c')]){if(moment(_0xf9d4bf[_0x1152('0x1d')])[_0x1152('0x1e')](_0x1e31d6[_0x1152('0x1b')],_0x1152('0x1f'))>moment()){return _0x49df7b(_0x1152('0x20'));}else{return utils[_0x1152('0x21')](_0xf9d4bf,0x0,![],null)[_0x1152('0x19')](function(){return utils[_0x1152('0x22')](_0xf9d4bf);})[_0x1152('0x19')](function(){return _0x49df7b(null,_0xf9d4bf);});}}else{return utils[_0x1152('0x22')](_0xf9d4bf)[_0x1152('0x19')](function(){return _0x49df7b(null,_0xf9d4bf);});}}else{return utils[_0x1152('0x22')](_0xf9d4bf)[_0x1152('0x19')](function(){return _0x49df7b(null,_0xf9d4bf);});}}return _0x49df7b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})['catch'](function(_0xe56cf5){_0x49df7b(_0xe56cf5);});})); \ No newline at end of file +var _0xddab=['blockDuration','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','login','google','profile','email','callback','authenticate','/login','use','clientID','clientSecret','secret','callbackURL','Setting','allowedLoginAttempts'];(function(_0x258e53,_0x5ce840){var _0x51d3a6=function(_0x1c0827){while(--_0x1c0827){_0x258e53['push'](_0x258e53['shift']());}};_0x51d3a6(++_0x5ce840);}(_0xddab,0x86));var _0xbdda=function(_0x149974,_0x2aa3f9){_0x149974=_0x149974-0x0;var _0x26d903=_0xddab[_0x149974];return _0x26d903;};'use strict';var _=require(_0xbdda('0x0'));var passport=require('passport');var GoogleStrategy=require(_0xbdda('0x1'))[_0xbdda('0x2')];var moment=require(_0xbdda('0x3'));var db=require(_0xbdda('0x4'))['db'];var config=require(_0xbdda('0x5'));var signToken=require(_0xbdda('0x6'))['signToken'];var utils=require(_0xbdda('0x7'));exports[_0xbdda('0x8')]=passport['authenticate'](_0xbdda('0x9'),{'failureRedirect':'/login','scope':[_0xbdda('0xa'),_0xbdda('0xb')],'session':![]});exports[_0xbdda('0xc')]=passport[_0xbdda('0xd')]('google',{'failureRedirect':_0xbdda('0xe'),'session':![]});passport[_0xbdda('0xf')](new GoogleStrategy({'clientID':config[_0xbdda('0x9')]?config[_0xbdda('0x9')][_0xbdda('0x10')]:'id','clientSecret':config[_0xbdda('0x9')]?config[_0xbdda('0x9')][_0xbdda('0x11')]:_0xbdda('0x12'),'callbackURL':config[_0xbdda('0x9')]?config[_0xbdda('0x9')][_0xbdda('0x13')]:''},function(_0x4a5709,_0x42123c,_0xf3ae55,_0xe00927){var _0x38adfc,_0x1557f5;return db[_0xbdda('0x14')]['findOne']({'where':{'id':0x1},'attributes':[_0xbdda('0x15'),_0xbdda('0x16')],'raw':!![]})['then'](function(_0x3ccab8){_0x38adfc=_0x3ccab8;return db[_0xbdda('0x17')][_0xbdda('0x18')]({'where':{'email':_[_0xbdda('0x19')](_0xf3ae55[_0xbdda('0x1a')],_0xbdda('0x1b')),'role':{'$or':[_0xbdda('0x1c'),_0xbdda('0x1d'),'agent']}}});})[_0xbdda('0x1e')](function(_0x163eea){_0x1557f5=_0x163eea;if(_0x1557f5){if(_0x1557f5[_0xbdda('0x1f')]){return _0xe00927(_0xbdda('0x20'));}else if(_0x38adfc[_0xbdda('0x16')]>0x0){if(_0x1557f5['blocked']){if(moment(_0x1557f5[_0xbdda('0x21')])[_0xbdda('0x22')](_0x38adfc[_0xbdda('0x16')],_0xbdda('0x23'))>moment()){return _0xe00927(_0xbdda('0x20'));}else{return utils[_0xbdda('0x24')](_0x1557f5,0x0,![],null)[_0xbdda('0x1e')](function(){return utils[_0xbdda('0x25')](_0x1557f5);})[_0xbdda('0x1e')](function(){return _0xe00927(null,_0x1557f5);});}}else{return utils[_0xbdda('0x25')](_0x1557f5)[_0xbdda('0x1e')](function(){return _0xe00927(null,_0x1557f5);});}}else{return utils[_0xbdda('0x25')](_0x1557f5)[_0xbdda('0x1e')](function(){return _0xe00927(null,_0x1557f5);});}}return _0xe00927(_0xbdda('0x20'));})[_0xbdda('0x26')](function(_0x4c7c49){_0xe00927(_0x4c7c49);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 5955489..fd2443d 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 _0x31be=['callback','setTokenCookie','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get'];(function(_0x2605ad,_0x933978){var _0x5abf81=function(_0x53af41){while(--_0x53af41){_0x2605ad['push'](_0x2605ad['shift']());}};_0x5abf81(++_0x933978);}(_0x31be,0xd4));var _0xe31b=function(_0x12eead,_0x5163e7){_0x12eead=_0x12eead-0x0;var _0x5150e6=_0x31be[_0x12eead];return _0x5150e6;};'use strict';var express=require(_0xe31b('0x0'));var passport=require(_0xe31b('0x1'));var router=express[_0xe31b('0x2')]();var controller=require(_0xe31b('0x3'));var userController=require(_0xe31b('0x4'));var authService=require(_0xe31b('0x5'));router['get']('/',controller[_0xe31b('0x6')]);router[_0xe31b('0x7')]('/callback',controller[_0xe31b('0x8')],authService['isMiddleware'],userController['login'],authService[_0xe31b('0x9')]);module['exports']=router; \ No newline at end of file +var _0x6b7b=['isMiddleware','setTokenCookie','exports','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','callback'];(function(_0xab0016,_0x3f7fbe){var _0x307da7=function(_0x4fab84){while(--_0x4fab84){_0xab0016['push'](_0xab0016['shift']());}};_0x307da7(++_0x3f7fbe);}(_0x6b7b,0x93));var _0xb6b7=function(_0x4d6121,_0x76a281){_0x4d6121=_0x4d6121-0x0;var _0xbe22fa=_0x6b7b[_0x4d6121];return _0xbe22fa;};'use strict';var express=require('express');var passport=require(_0xb6b7('0x0'));var router=express[_0xb6b7('0x1')]();var controller=require(_0xb6b7('0x2'));var userController=require(_0xb6b7('0x3'));var authService=require(_0xb6b7('0x4'));router['get']('/',controller[_0xb6b7('0x5')]);router[_0xb6b7('0x6')](_0xb6b7('0x7'),controller[_0xb6b7('0x8')],authService[_0xb6b7('0x9')],userController[_0xb6b7('0x5')],authService[_0xb6b7('0xa')]);module[_0xb6b7('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index fd36456..42ca70b 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 _0x1575=['service','host','port','secure','authentication','auth','pass','merge','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','allowedLoginAttempts','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','catch','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','previousPasswords','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../config/utils','client','Setting','findOne','blockDuration','then','name','password','salt','role','disabled','blocked','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockedAt','add','minutes','clearBlockUser','getLicense','find','email','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp'];(function(_0x3edeba,_0x389569){var _0x4e269e=function(_0x1e149b){while(--_0x1e149b){_0x3edeba['push'](_0x3edeba['shift']());}};_0x4e269e(++_0x389569);}(_0x1575,0x190));var _0x5157=function(_0x5d1ae8,_0x1cfb7b){_0x5d1ae8=_0x5d1ae8-0x0;var _0x2e3995=_0x1575[_0x5d1ae8];return _0x2e3995;};'use strict';var util=require(_0x5157('0x0'));var passport=require(_0x5157('0x1'));var LocalStrategy=require(_0x5157('0x2'))[_0x5157('0x3')];var jayson=require(_0x5157('0x4'));var _=require(_0x5157('0x5'));var rs=require(_0x5157('0x6'));var moment=require('moment');var db=require(_0x5157('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x5157('0x8'));var client=jayson[_0x5157('0x9')]['http']({'port':0x232b});function localAuthenticate(_0xdd370b,_0x321a4b,_0x4670d5,_0x10d01f){var _0x1aa7f4,_0x29ae19;return db[_0x5157('0xa')][_0x5157('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x5157('0xc')],'raw':!![]})[_0x5157('0xd')](function(_0x2081c2){_0x1aa7f4=_0x2081c2;return _0xdd370b['findOne']({'attributes':['id',_0x5157('0xe'),_0x5157('0xf'),_0x5157('0x10'),_0x5157('0x11'),_0x5157('0x12'),_0x5157('0x13'),'blockedAt',_0x5157('0x14')],'where':{'name':_0x321a4b,'role':{'$or':[_0x5157('0x15'),_0x5157('0x16'),_0x5157('0x17')]}}});})[_0x5157('0xd')](function(_0x1d4bfc){if(!_0x1d4bfc||_0x1d4bfc&&_0x1d4bfc[_0x5157('0xe')]!==_0x321a4b){throw new Error(_0x5157('0x18'));}else{_0x29ae19=_0x1d4bfc;return _0x29ae19;}})[_0x5157('0xd')](function(){_0x29ae19[_0x5157('0x19')](_0x4670d5,function(_0x40a027,_0x29236a){var _0x18fa03=_0x29ae19[_0x5157('0x14')]+0x1;if(_0x40a027){return _0x10d01f(_0x40a027);}else if(!_0x29236a){if(_0x29ae19[_0x5157('0x12')]){return _0x10d01f(null,![],{'message':_0x5157('0x18')});}else if(_0x1aa7f4['allowedLoginAttempts']>0x0){if(_0x29ae19[_0x5157('0x13')]){if(_0x1aa7f4[_0x5157('0xc')]>0x0){if(moment(_0x29ae19[_0x5157('0x1a')])[_0x5157('0x1b')](_0x1aa7f4[_0x5157('0xc')],_0x5157('0x1c'))>moment()){return _0x10d01f(null,![],{'message':_0x5157('0x18')});}else{return utils[_0x5157('0x1d')](_0x29ae19,_0x18fa03,![],null)[_0x5157('0xd')](function(){return _0x10d01f(null,![],{'message':_0x5157('0x18')});});}}else{return _0x10d01f(null,![],{'message':_0x5157('0x18')});}}else{if(_0x18fa03>=_0x1aa7f4['allowedLoginAttempts']){return utils['clearBlockUser'](_0x29ae19,0x0,!![],moment())[_0x5157('0xd')](function(){return _0x10d01f(null,![],{'message':_0x5157('0x18')});});}else{return utils[_0x5157('0x1d')](_0x29ae19,_0x18fa03,![],null)[_0x5157('0xd')](function(){return _0x10d01f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x10d01f(null,![],{'message':_0x5157('0x18')});}}else{if(_0x29ae19[_0x5157('0x12')]){return _0x10d01f(null,![],{'message':_0x5157('0x18')});}else if(_0x1aa7f4['allowedLoginAttempts']>0x0){if(_0x29ae19[_0x5157('0x13')]){if(_0x1aa7f4[_0x5157('0xc')]>0x0){if(moment(_0x29ae19[_0x5157('0x1a')])['add'](_0x1aa7f4['blockDuration'],'minutes')>moment()){return _0x10d01f(null,![],{'message':_0x5157('0x18')});}else{return utils['clearBlockUser'](_0x29ae19,0x0,![],null)[_0x5157('0xd')](function(){return utils[_0x5157('0x1e')](_0x29ae19);})['then'](function(){return _0x10d01f(null,_0x29ae19);});}}else{return _0x10d01f(null,![],{'message':_0x5157('0x18')});}}else{return utils[_0x5157('0x1d')](_0x29ae19,0x0,![],null)['then'](function(){return utils[_0x5157('0x1e')](_0x29ae19);})['then'](function(){return _0x10d01f(null,_0x29ae19);})['catch'](function(_0x170dfe){return _0x10d01f(null,![],_0x170dfe);});}}else{if(_0x29ae19[_0x5157('0x13')]){return _0x10d01f(null,![],{'message':_0x5157('0x18')});}else{return utils[_0x5157('0x1e')](_0x29ae19)[_0x5157('0xd')](function(){return _0x10d01f(null,_0x29ae19);});}}}});})['catch'](function(_0x15dd4a){return _0x10d01f(null,![],_0x15dd4a);});}function sendServiceMail(_0x45f4f5){return db['MailAccount'][_0x5157('0x1f')]({'where':{'service':!![]},'attributes':['id','name',_0x5157('0x20')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]})[_0x5157('0xd')](function(_0x4214fd){if(!_0x4214fd){throw new Error(_0x5157('0x21'));}var _0x9a6a89={'tls':{'rejectUnauthorized':![]}};if(_0x4214fd[_0x5157('0x22')][_0x5157('0x23')]){_0x9a6a89[_0x5157('0x23')]=_0x4214fd['Smtp'][_0x5157('0x23')];}else{_0x9a6a89[_0x5157('0x24')]=_0x4214fd[_0x5157('0x22')][_0x5157('0x24')];_0x9a6a89['port']=_0x4214fd[_0x5157('0x22')][_0x5157('0x25')];_0x9a6a89[_0x5157('0x26')]=_0x4214fd[_0x5157('0x22')]['secure'];}if(_0x4214fd[_0x5157('0x22')][_0x5157('0x27')]){_0x9a6a89[_0x5157('0x28')]={'user':_0x4214fd[_0x5157('0x22')]['user'],'pass':_0x4214fd['Smtp'][_0x5157('0x29')]};}var _0xca7413={'account':_0x9a6a89,'message':_[_0x5157('0x2a')]({'from':util[_0x5157('0x2b')]('\x22%s\x22\x20<%s>',_0x4214fd[_0x5157('0xe')],_0x4214fd[_0x5157('0x20')]||_0x4214fd['Smtp'][_0x5157('0x16')])},_0x45f4f5)};return client[_0x5157('0x2c')](_0x5157('0x2d'),_0xca7413);})['then'](function(_0x4b5ce6){if(_0x4b5ce6[_0x5157('0x2e')]){throw new Error(util['format'](_0x5157('0x2f'),_0x4b5ce6[_0x5157('0x2e')][_0x5157('0x30')]||JSON[_0x5157('0x31')](_0x4b5ce6[_0x5157('0x2e')])));}return!![];});}function handleError(_0x188ef5,_0xc429d3,_0x14a4bd){return _0x188ef5[_0x5157('0x32')](_0xc429d3||0x1f4)[_0x5157('0x33')]({'message':_0x14a4bd?_0x14a4bd[_0x5157('0x30')]||_0x14a4bd:''});}exports['login']=function(_0x3cc69f,_0x1950fc,_0x39fc2a){passport['authenticate'](_0x5157('0x34'),function(_0x33f6c2,_0x1aa506,_0x91339d){var _0x3d53fe=_0x33f6c2||_0x91339d;if(_0x3d53fe){return handleError(_0x1950fc,0x191,_0x3d53fe);}if(!_0x1aa506){return handleError(_0x1950fc,0x194,{'message':_0x5157('0x35')});}else{var _0x17d752={'payload':{'id':_0x1aa506['id'],'role':_0x1aa506['role']},'options':{'expiresIn':0x15180}};return authService[_0x5157('0x36')](_0x17d752)[_0x5157('0xd')](function(_0x35bfb7){_0x1950fc['json']({'id':_0x1aa506['id'],'token':_0x35bfb7,'statusCall':'','isAlreadyLogged':_0x1aa506[_0x5157('0x37')]});});}})(_0x3cc69f,_0x1950fc,_0x39fc2a);};exports[_0x5157('0x38')]=function(_0xc8792a,_0x87e1df,_0x27378a){if(!_0xc8792a[_0x5157('0x39')][_0x5157('0x20')]){return handleError(_0x87e1df,0x1f4,{'message':_0x5157('0x3a')});}var _0x360504=rs[_0x5157('0x3b')]();_0xc8792a[_0x5157('0x39')]['email']=_0xc8792a['body'][_0x5157('0x20')][_0x5157('0x3c')]()['toLowerCase']();var _0x15fe8f;return db[_0x5157('0xa')][_0x5157('0xb')]({'where':{'id':0x1},'attributes':[_0x5157('0x3d'),_0x5157('0xc')],'raw':!![]})[_0x5157('0xd')](function(_0x4d8ffe){_0x15fe8f=_0x4d8ffe;return db['User'][_0x5157('0x1f')]({'where':{'email':_0xc8792a['body'][_0x5157('0x20')]}});})[_0x5157('0xd')](function(_0x210560){if(!_0x210560){throw new Error(_0x5157('0x3e'));}if(_0x210560['disabled']){throw new Error(_0x5157('0x3f'));}if(_0x210560['blocked']){if(moment(_0x210560['blockedAt'])[_0x5157('0x1b')](_0x15fe8f[_0x5157('0xc')],_0x5157('0x1c'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x210560[_0x5157('0x13')]=![];_0x210560[_0x5157('0x1a')]=null;}}_0x210560[_0x5157('0x40')]=_0x360504;_0x210560[_0x5157('0x41')]=Date[_0x5157('0x42')]()+0x36ee80;return _0x210560[_0x5157('0x43')]();})['then'](function(){return sendServiceMail({'to':_0xc8792a[_0x5157('0x39')][_0x5157('0x20')],'subject':_0x5157('0x44'),'text':_0x5157('0x45')+_0x5157('0x46')+'https://'+_0xc8792a[_0x5157('0x47')][_0x5157('0x24')]+_0x5157('0x48')+_0x360504+'\x0a\x0a'+_0x5157('0x49')});})[_0x5157('0xd')](function(){_0x87e1df[_0x5157('0x32')](0xc8)[_0x5157('0x33')]({'message':_0x5157('0x4a')});})[_0x5157('0x4b')](function(_0x1c2ded){return handleError(_0x87e1df,0x1f4,_0x1c2ded);});};exports['reset']=function(_0x5558e3,_0x1f6535,_0x519db5){return db[_0x5157('0x4c')][_0x5157('0x1f')]({'where':{'resetPasswordToken':_0x5558e3[_0x5157('0x4d')][_0x5157('0x4e')],'resetPasswordExpires':{'$gt':Date[_0x5157('0x42')]()}}})[_0x5157('0xd')](function(_0x50c768){if(!_0x50c768){throw new Error(_0x5157('0x4f'));}return db[_0x5157('0xa')][_0x5157('0xb')]({'attributes':['id',_0x5157('0x50'),'enforcePasswordHistory',_0x5157('0x51')]})[_0x5157('0xd')](function(_0x4ea9de){if(_0x4ea9de[_0x5157('0x50')])authService[_0x5157('0x52')](_0x5558e3[_0x5157('0x39')][_0x5157('0xf')]);if(!_0x4ea9de[_0x5157('0x53')]||!_0x50c768['previousPasswords'])return _0x50c768;authService[_0x5157('0x54')](_0x5558e3[_0x5157('0x39')]['password'],_0x50c768[_0x5157('0x55')],_0x4ea9de[_0x5157('0x51')]);return _0x50c768;})['then'](function(){_0x50c768[_0x5157('0xf')]=_0x5558e3[_0x5157('0x39')][_0x5157('0xf')];_0x50c768[_0x5157('0x40')]=null;_0x50c768[_0x5157('0x41')]=null;return _0x50c768[_0x5157('0x43')]();});})[_0x5157('0xd')](function(){_0x1f6535[_0x5157('0x32')](0xc8)[_0x5157('0x33')]({'message':'Password\x20reset!'});})[_0x5157('0x4b')](function(_0x45193b){return handleError(_0x1f6535,0x1f4,_0x45193b);});};passport[_0x5157('0x56')](new LocalStrategy({'usernameField':'name','passwordField':_0x5157('0xf')},function(_0x18015d,_0x14243d,_0xb60e20){return localAuthenticate(db[_0x5157('0x4c')],_0x18015d,_0x14243d,_0xb60e20);})); \ No newline at end of file +var _0xbe79=['password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','then','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','MailAccount','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','pass','merge','format','\x22%s\x22\x20<%s>','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','find','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','previousPasswords','status','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0xbe79,0x169));var _0x9be7=function(_0x2f02b5,_0x577559){_0x2f02b5=_0x2f02b5-0x0;var _0x287202=_0xbe79[_0x2f02b5];return _0x287202;};'use strict';var util=require(_0x9be7('0x0'));var passport=require(_0x9be7('0x1'));var LocalStrategy=require(_0x9be7('0x2'))[_0x9be7('0x3')];var jayson=require(_0x9be7('0x4'));var _=require('lodash');var rs=require(_0x9be7('0x5'));var moment=require(_0x9be7('0x6'));var db=require(_0x9be7('0x7'))['db'];var authService=require(_0x9be7('0x8'));var utils=require(_0x9be7('0x9'));var client=jayson[_0x9be7('0xa')]['http']({'port':0x232b});function localAuthenticate(_0x2ddcb5,_0x1b5892,_0x4b4efe,_0x4f4088){var _0x372445,_0x48e09a;return db[_0x9be7('0xb')][_0x9be7('0xc')]({'where':{'id':0x1},'attributes':[_0x9be7('0xd'),_0x9be7('0xe')],'raw':!![]})['then'](function(_0x270451){_0x372445=_0x270451;return _0x2ddcb5[_0x9be7('0xc')]({'attributes':['id','name',_0x9be7('0xf'),_0x9be7('0x10'),_0x9be7('0x11'),_0x9be7('0x12'),_0x9be7('0x13'),_0x9be7('0x14'),_0x9be7('0x15')],'where':{'name':_0x1b5892,'role':{'$or':[_0x9be7('0x16'),_0x9be7('0x17'),_0x9be7('0x18')]}}});})[_0x9be7('0x19')](function(_0x3695f5){if(!_0x3695f5||_0x3695f5&&_0x3695f5[_0x9be7('0x1a')]!==_0x1b5892){throw new Error(_0x9be7('0x1b'));}else{_0x48e09a=_0x3695f5;return _0x48e09a;}})[_0x9be7('0x19')](function(){_0x48e09a[_0x9be7('0x1c')](_0x4b4efe,function(_0x4f89d6,_0x2d3fc6){var _0x314496=_0x48e09a[_0x9be7('0x15')]+0x1;if(_0x4f89d6){return _0x4f4088(_0x4f89d6);}else if(!_0x2d3fc6){if(_0x48e09a[_0x9be7('0x12')]){return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});}else if(_0x372445[_0x9be7('0xd')]>0x0){if(_0x48e09a[_0x9be7('0x13')]){if(_0x372445[_0x9be7('0xe')]>0x0){if(moment(_0x48e09a[_0x9be7('0x14')])[_0x9be7('0x1d')](_0x372445[_0x9be7('0xe')],_0x9be7('0x1e'))>moment()){return _0x4f4088(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x9be7('0x1f')](_0x48e09a,_0x314496,![],null)[_0x9be7('0x19')](function(){return _0x4f4088(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});}}else{if(_0x314496>=_0x372445['allowedLoginAttempts']){return utils[_0x9be7('0x1f')](_0x48e09a,0x0,!![],moment())[_0x9be7('0x19')](function(){return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});});}else{return utils[_0x9be7('0x1f')](_0x48e09a,_0x314496,![],null)[_0x9be7('0x19')](function(){return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});});}}}else{return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});}}else{if(_0x48e09a[_0x9be7('0x12')]){return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});}else if(_0x372445[_0x9be7('0xd')]>0x0){if(_0x48e09a[_0x9be7('0x13')]){if(_0x372445[_0x9be7('0xe')]>0x0){if(moment(_0x48e09a[_0x9be7('0x14')])['add'](_0x372445[_0x9be7('0xe')],_0x9be7('0x1e'))>moment()){return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});}else{return utils['clearBlockUser'](_0x48e09a,0x0,![],null)[_0x9be7('0x19')](function(){return utils[_0x9be7('0x20')](_0x48e09a);})['then'](function(){return _0x4f4088(null,_0x48e09a);});}}else{return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});}}else{return utils[_0x9be7('0x1f')](_0x48e09a,0x0,![],null)['then'](function(){return utils[_0x9be7('0x20')](_0x48e09a);})[_0x9be7('0x19')](function(){return _0x4f4088(null,_0x48e09a);})[_0x9be7('0x21')](function(_0x59a5f5){return _0x4f4088(null,![],_0x59a5f5);});}}else{if(_0x48e09a[_0x9be7('0x13')]){return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});}else{return utils['getLicense'](_0x48e09a)[_0x9be7('0x19')](function(){return _0x4f4088(null,_0x48e09a);});}}}});})[_0x9be7('0x21')](function(_0x53b475){return _0x4f4088(null,![],_0x53b475);});}function sendServiceMail(_0x119f9e){return db[_0x9be7('0x22')]['find']({'where':{'service':!![]},'attributes':['id',_0x9be7('0x1a'),_0x9be7('0x23')],'include':[{'model':db['MailServerOut'],'as':_0x9be7('0x24')}]})['then'](function(_0x3e5b37){if(!_0x3e5b37){throw new Error(_0x9be7('0x25'));}var _0x80a6e0={'tls':{'rejectUnauthorized':![]}};if(_0x3e5b37[_0x9be7('0x24')]['service']){_0x80a6e0[_0x9be7('0x26')]=_0x3e5b37[_0x9be7('0x24')][_0x9be7('0x26')];}else{_0x80a6e0[_0x9be7('0x27')]=_0x3e5b37['Smtp']['host'];_0x80a6e0[_0x9be7('0x28')]=_0x3e5b37[_0x9be7('0x24')][_0x9be7('0x28')];_0x80a6e0[_0x9be7('0x29')]=_0x3e5b37[_0x9be7('0x24')]['secure'];}if(_0x3e5b37['Smtp'][_0x9be7('0x2a')]){_0x80a6e0['auth']={'user':_0x3e5b37[_0x9be7('0x24')][_0x9be7('0x17')],'pass':_0x3e5b37[_0x9be7('0x24')][_0x9be7('0x2b')]};}var _0x25d115={'account':_0x80a6e0,'message':_[_0x9be7('0x2c')]({'from':util[_0x9be7('0x2d')](_0x9be7('0x2e'),_0x3e5b37['name'],_0x3e5b37[_0x9be7('0x23')]||_0x3e5b37[_0x9be7('0x24')][_0x9be7('0x17')])},_0x119f9e)};return client['request'](_0x9be7('0x2f'),_0x25d115);})[_0x9be7('0x19')](function(_0x498bcd){if(_0x498bcd['error']){throw new Error(util[_0x9be7('0x2d')](_0x9be7('0x30'),_0x498bcd[_0x9be7('0x31')][_0x9be7('0x32')]||JSON[_0x9be7('0x33')](_0x498bcd['error'])));}return!![];});}function handleError(_0xb8701b,_0x196580,_0xa861dd){return _0xb8701b['status'](_0x196580||0x1f4)[_0x9be7('0x34')]({'message':_0xa861dd?_0xa861dd[_0x9be7('0x32')]||_0xa861dd:''});}exports[_0x9be7('0x35')]=function(_0x5aaaf4,_0x33722f,_0xe8f8b1){passport[_0x9be7('0x1c')](_0x9be7('0x36'),function(_0x7e3bfc,_0x2545d5,_0x883337){var _0x25d505=_0x7e3bfc||_0x883337;if(_0x25d505){return handleError(_0x33722f,0x191,_0x25d505);}if(!_0x2545d5){return handleError(_0x33722f,0x194,{'message':_0x9be7('0x37')});}else{var _0x3bae1d={'payload':{'id':_0x2545d5['id'],'role':_0x2545d5[_0x9be7('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x9be7('0x38')](_0x3bae1d)['then'](function(_0x58290a){_0x33722f[_0x9be7('0x39')]({'id':_0x2545d5['id'],'token':_0x58290a,'statusCall':'','isAlreadyLogged':_0x2545d5[_0x9be7('0x3a')]});});}})(_0x5aaaf4,_0x33722f,_0xe8f8b1);};exports[_0x9be7('0x3b')]=function(_0x5c0559,_0x2aa760,_0x44834c){if(!_0x5c0559[_0x9be7('0x3c')][_0x9be7('0x23')]){return handleError(_0x2aa760,0x1f4,{'message':_0x9be7('0x3d')});}var _0x5d876a=rs[_0x9be7('0x3e')]();_0x5c0559[_0x9be7('0x3c')][_0x9be7('0x23')]=_0x5c0559[_0x9be7('0x3c')]['email'][_0x9be7('0x3f')]()[_0x9be7('0x40')]();var _0x4a89c0;return db[_0x9be7('0xb')][_0x9be7('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9be7('0xe')],'raw':!![]})[_0x9be7('0x19')](function(_0xb7c712){_0x4a89c0=_0xb7c712;return db[_0x9be7('0x41')]['find']({'where':{'email':_0x5c0559['body'][_0x9be7('0x23')]}});})[_0x9be7('0x19')](function(_0x4eb74b){if(!_0x4eb74b){throw new Error(_0x9be7('0x42'));}if(_0x4eb74b[_0x9be7('0x12')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x4eb74b[_0x9be7('0x13')]){if(moment(_0x4eb74b[_0x9be7('0x14')])[_0x9be7('0x1d')](_0x4a89c0[_0x9be7('0xe')],_0x9be7('0x1e'))>moment()){throw new Error(_0x9be7('0x43'));}else{_0x4eb74b[_0x9be7('0x13')]=![];_0x4eb74b[_0x9be7('0x14')]=null;}}_0x4eb74b[_0x9be7('0x44')]=_0x5d876a;_0x4eb74b[_0x9be7('0x45')]=Date[_0x9be7('0x46')]()+0x36ee80;return _0x4eb74b[_0x9be7('0x47')]();})[_0x9be7('0x19')](function(){return sendServiceMail({'to':_0x5c0559['body'][_0x9be7('0x23')],'subject':_0x9be7('0x48'),'text':_0x9be7('0x49')+_0x9be7('0x4a')+_0x9be7('0x4b')+_0x5c0559[_0x9be7('0x4c')]['host']+_0x9be7('0x4d')+_0x5d876a+'\x0a\x0a'+_0x9be7('0x4e')});})[_0x9be7('0x19')](function(){_0x2aa760['status'](0xc8)['send']({'message':_0x9be7('0x4f')});})['catch'](function(_0x4a43cd){return handleError(_0x2aa760,0x1f4,_0x4a43cd);});};exports[_0x9be7('0x50')]=function(_0x84d731,_0x4f08e9,_0x2ed1b7){return db['User'][_0x9be7('0x51')]({'where':{'resetPasswordToken':_0x84d731[_0x9be7('0x52')][_0x9be7('0x53')],'resetPasswordExpires':{'$gt':Date[_0x9be7('0x46')]()}}})['then'](function(_0x471cec){if(!_0x471cec){throw new Error(_0x9be7('0x54'));}return db[_0x9be7('0xb')][_0x9be7('0xc')]({'attributes':['id',_0x9be7('0x55'),'enforcePasswordHistory',_0x9be7('0x56')]})[_0x9be7('0x19')](function(_0x2d5082){if(_0x2d5082[_0x9be7('0x55')])authService[_0x9be7('0x57')](_0x84d731[_0x9be7('0x3c')][_0x9be7('0xf')]);if(!_0x2d5082[_0x9be7('0x58')]||!_0x471cec['previousPasswords'])return _0x471cec;authService[_0x9be7('0x59')](_0x84d731[_0x9be7('0x3c')][_0x9be7('0xf')],_0x471cec[_0x9be7('0x5a')],_0x2d5082['passwordHistoryLimit']);return _0x471cec;})['then'](function(){_0x471cec['password']=_0x84d731[_0x9be7('0x3c')][_0x9be7('0xf')];_0x471cec[_0x9be7('0x44')]=null;_0x471cec[_0x9be7('0x45')]=null;return _0x471cec[_0x9be7('0x47')]();});})[_0x9be7('0x19')](function(){_0x4f08e9[_0x9be7('0x5b')](0xc8)[_0x9be7('0x34')]({'message':_0x9be7('0x5c')});})[_0x9be7('0x21')](function(_0x531f07){return handleError(_0x4f08e9,0x1f4,_0x531f07);});};passport[_0x9be7('0x5d')](new LocalStrategy({'usernameField':_0x9be7('0x1a'),'passwordField':_0x9be7('0xf')},function(_0x24fcba,_0x2810dd,_0x29b683){return localAuthenticate(db[_0x9be7('0x41')],_0x24fcba,_0x2810dd,_0x29b683);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index e767a1b..5ffa333 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 _0xcb82=['/reset/:token','reset','exports','./authLocal.controller','login','post','/forgot','forgot'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0xcb82,0xe3));var _0x2cb8=function(_0x3e41a6,_0xe86451){_0x3e41a6=_0x3e41a6-0x0;var _0x221e4e=_0xcb82[_0x3e41a6];return _0x221e4e;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x2cb8('0x0'));router['post']('/',controller[_0x2cb8('0x1')]);router[_0x2cb8('0x2')](_0x2cb8('0x3'),controller[_0x2cb8('0x4')]);router['post'](_0x2cb8('0x5'),controller[_0x2cb8('0x6')]);module[_0x2cb8('0x7')]=router; \ No newline at end of file +var _0xbe17=['/forgot','forgot','reset','exports','express','Router','./authLocal.controller','login','post'];(function(_0x4f9c8a,_0x16d095){var _0x295b7c=function(_0x120bb8){while(--_0x120bb8){_0x4f9c8a['push'](_0x4f9c8a['shift']());}};_0x295b7c(++_0x16d095);}(_0xbe17,0x16c));var _0x7be1=function(_0x3ee52e,_0x15f364){_0x3ee52e=_0x3ee52e-0x0;var _0x53b240=_0xbe17[_0x3ee52e];return _0x53b240;};'use strict';var express=require(_0x7be1('0x0'));var router=express[_0x7be1('0x1')]();var controller=require(_0x7be1('0x2'));router['post']('/',controller[_0x7be1('0x3')]);router[_0x7be1('0x4')](_0x7be1('0x5'),controller[_0x7be1('0x6')]);router['post']('/reset/:token',controller[_0x7be1('0x7')]);module[_0x7be1('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 1ad59e3..6ef35ab 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 _0xf4e5=['exports','STRING','BOOLEAN','sequelize'];(function(_0x90e575,_0x48c2ec){var _0x1aae60=function(_0x4e40cf){while(--_0x4e40cf){_0x90e575['push'](_0x90e575['shift']());}};_0x1aae60(++_0x48c2ec);}(_0xf4e5,0xc7));var _0x5f4e=function(_0x4596ca,_0x45667e){_0x4596ca=_0x4596ca-0x0;var _0x43e119=_0xf4e5[_0x4596ca];return _0x43e119;};'use strict';var Sequelize=require(_0x5f4e('0x0'));module[_0x5f4e('0x1')]={'name':{'type':Sequelize[_0x5f4e('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x5f4e('0x2')]},'description':{'type':Sequelize[_0x5f4e('0x2')]},'status':{'type':Sequelize[_0x5f4e('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0xd7e2=['BOOLEAN','sequelize','exports','STRING'];(function(_0x54ecff,_0x37ce75){var _0x150c26=function(_0x2bc3ea){while(--_0x2bc3ea){_0x54ecff['push'](_0x54ecff['shift']());}};_0x150c26(++_0x37ce75);}(_0xd7e2,0x155));var _0x2d7e=function(_0x34ce2d,_0x4d3c90){_0x34ce2d=_0x34ce2d-0x0;var _0x496aca=_0xd7e2[_0x34ce2d];return _0x496aca;};'use strict';var Sequelize=require(_0x2d7e('0x0'));module[_0x2d7e('0x1')]={'name':{'type':Sequelize[_0x2d7e('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x2d7e('0x2')]},'description':{'type':Sequelize[_0x2d7e('0x2')]},'status':{'type':Sequelize[_0x2d7e('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index dbc3cf6..7859e09 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 _0xc715=['params','create','body','update','find','addConditions','ids','omit','getConditions','findOne','Condition','nolimit','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','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','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','save','then','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','rows','catch'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc715,0x15f));var _0x5c71=function(_0x56a3ff,_0x7b6a4f){_0x56a3ff=_0x56a3ff-0x0;var _0x27fc14=_0xc715[_0x56a3ff];return _0x27fc14;};'use strict';var emlformat=require(_0x5c71('0x0'));var rimraf=require(_0x5c71('0x1'));var zipdir=require(_0x5c71('0x2'));var jsonpatch=require(_0x5c71('0x3'));var rp=require(_0x5c71('0x4'));var moment=require(_0x5c71('0x5'));var BPromise=require(_0x5c71('0x6'));var Mustache=require(_0x5c71('0x7'));var util=require('util');var path=require(_0x5c71('0x8'));var sox=require(_0x5c71('0x9'));var csv=require(_0x5c71('0xa'));var ejs=require(_0x5c71('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c71('0xc'));var squel=require(_0x5c71('0xd'));var crypto=require(_0x5c71('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5c71('0xf'));var toCsv=require(_0x5c71('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5c71('0x10'));var qs=require(_0x5c71('0x11'));var as=require(_0x5c71('0x12'));var hardwareService=require(_0x5c71('0x13'));var logger=require(_0x5c71('0x14'))(_0x5c71('0x15'));var utils=require(_0x5c71('0x16'));var config=require(_0x5c71('0x17'));var licenseUtil=require(_0x5c71('0x18'));var db=require(_0x5c71('0x19'))['db'];function respondWithStatusCode(_0x547667,_0x2857d2){_0x2857d2=_0x2857d2||0xcc;return function(_0x3d0f24){if(_0x3d0f24){return _0x547667[_0x5c71('0x1a')](_0x2857d2);}return _0x547667[_0x5c71('0x1b')](_0x2857d2)[_0x5c71('0x1c')]();};}function respondWithResult(_0x3e407d,_0x20fe43){_0x20fe43=_0x20fe43||0xc8;return function(_0x3fe8b3){if(_0x3fe8b3){return _0x3e407d[_0x5c71('0x1b')](_0x20fe43)['json'](_0x3fe8b3);}};}function respondWithFilteredResult(_0x4dcdda,_0x1449dc){return function(_0x4f6cdf){if(_0x4f6cdf){var _0x10b8f6=typeof _0x1449dc[_0x5c71('0x1d')]==='undefined'&&typeof _0x1449dc[_0x5c71('0x1e')]===_0x5c71('0x1f');var _0x51cccc=_0x4f6cdf[_0x5c71('0x20')];var _0x26b47c=_0x10b8f6?0x0:_0x1449dc[_0x5c71('0x1d')];var _0x5276be=_0x10b8f6?_0x4f6cdf[_0x5c71('0x20')]:_0x1449dc[_0x5c71('0x1d')]+_0x1449dc['limit'];var _0x343317;if(_0x5276be>=_0x51cccc){_0x5276be=_0x51cccc;_0x343317=0xc8;}else{_0x343317=0xce;}_0x4dcdda[_0x5c71('0x1b')](_0x343317);return _0x4dcdda[_0x5c71('0x21')](_0x5c71('0x22'),_0x26b47c+'-'+_0x5276be+'/'+_0x51cccc)[_0x5c71('0x23')](_0x4f6cdf);}return null;};}function patchUpdates(_0x5c9174){return function(_0xec29e9){try{jsonpatch['apply'](_0xec29e9,_0x5c9174,!![]);}catch(_0x5a806b){return BPromise['reject'](_0x5a806b);}return _0xec29e9[_0x5c71('0x24')]();};}function saveUpdates(_0x5d5ebe,_0x15cb0c){return function(_0x52e39f){if(_0x52e39f){return _0x52e39f['update'](_0x5d5ebe)[_0x5c71('0x25')](function(_0x1e8ff3){return _0x1e8ff3;});}return null;};}function removeEntity(_0x169d5b,_0x4f435a){return function(_0x200c4a){if(_0x200c4a){return _0x200c4a['destroy']()[_0x5c71('0x25')](function(){_0x169d5b['status'](0xcc)[_0x5c71('0x1c')]();});}};}function handleEntityNotFound(_0x3f12b8,_0x43ce86){return function(_0x4532fb){if(!_0x4532fb){_0x3f12b8[_0x5c71('0x1a')](0x194);}return _0x4532fb;};}function handleError(_0x3b943a,_0x36ed53){_0x36ed53=_0x36ed53||0x1f4;return function(_0x52e0f8){logger[_0x5c71('0x26')](_0x52e0f8[_0x5c71('0x27')]);if(_0x52e0f8[_0x5c71('0x28')]){delete _0x52e0f8[_0x5c71('0x28')];}_0x3b943a['status'](_0x36ed53)[_0x5c71('0x29')](_0x52e0f8);};}exports[_0x5c71('0x2a')]=function(_0x5c480a,_0x3f366f){var _0x2cf16b={},_0x389328={},_0x318bf8={'count':0x0,'rows':[]};var _0x46f72f=_[_0x5c71('0x2b')](db[_0x5c71('0x2c')][_0x5c71('0x2d')],function(_0x487b5a){return{'name':_0x487b5a[_0x5c71('0x2e')],'type':_0x487b5a['type'][_0x5c71('0x2f')]};});_0x389328[_0x5c71('0x30')]=_[_0x5c71('0x2b')](_0x46f72f,_0x5c71('0x28'));_0x389328[_0x5c71('0x31')]=_[_0x5c71('0x32')](_0x5c480a[_0x5c71('0x31')]);_0x389328[_0x5c71('0x33')]=_['intersection'](_0x389328[_0x5c71('0x30')],_0x389328['query']);_0x2cf16b['attributes']=_[_0x5c71('0x34')](_0x389328[_0x5c71('0x30')],qs[_0x5c71('0x35')](_0x5c480a['query'][_0x5c71('0x35')]));_0x2cf16b['attributes']=_0x2cf16b[_0x5c71('0x36')][_0x5c71('0x37')]?_0x2cf16b[_0x5c71('0x36')]:_0x389328[_0x5c71('0x30')];if(!_0x5c480a[_0x5c71('0x31')][_0x5c71('0x38')]('nolimit')){_0x2cf16b[_0x5c71('0x1e')]=qs['limit'](_0x5c480a[_0x5c71('0x31')][_0x5c71('0x1e')]);_0x2cf16b['offset']=qs[_0x5c71('0x1d')](_0x5c480a['query']['offset']);}_0x2cf16b[_0x5c71('0x39')]=qs[_0x5c71('0x3a')](_0x5c480a['query']['sort']);_0x2cf16b[_0x5c71('0x3b')]=qs[_0x5c71('0x33')](_[_0x5c71('0x3c')](_0x5c480a[_0x5c71('0x31')],_0x389328['filters']),_0x46f72f);if(_0x5c480a['query']['filter']){_0x2cf16b[_0x5c71('0x3b')]=_['merge'](_0x2cf16b[_0x5c71('0x3b')],{'$or':_[_0x5c71('0x2b')](_0x46f72f,function(_0x18c280){if(_0x18c280[_0x5c71('0x3d')]!==_0x5c71('0x3e')){var _0x468fbd={};_0x468fbd[_0x18c280[_0x5c71('0x28')]]={'$like':'%'+_0x5c480a[_0x5c71('0x31')][_0x5c71('0x3f')]+'%'};return _0x468fbd;}})});}_0x2cf16b=_[_0x5c71('0x40')]({},_0x2cf16b,_0x5c480a[_0x5c71('0x41')]);var _0x37af1d={'where':_0x2cf16b[_0x5c71('0x3b')]};return db[_0x5c71('0x2c')][_0x5c71('0x20')](_0x37af1d)[_0x5c71('0x25')](function(_0x512f09){_0x318bf8[_0x5c71('0x20')]=_0x512f09;if(_0x5c480a['query'][_0x5c71('0x42')]){_0x2cf16b['include']=[{'all':!![]}];}return db[_0x5c71('0x2c')]['findAll'](_0x2cf16b);})[_0x5c71('0x25')](function(_0x3bf249){_0x318bf8[_0x5c71('0x43')]=_0x3bf249;return _0x318bf8;})[_0x5c71('0x25')](respondWithFilteredResult(_0x3f366f,_0x2cf16b))[_0x5c71('0x44')](handleError(_0x3f366f,null));};exports['show']=function(_0x476401,_0x4d9a8e){var _0x3d276c={'raw':![],'where':{'id':_0x476401[_0x5c71('0x45')]['id']}},_0x5d783e={};_0x5d783e[_0x5c71('0x30')]=_[_0x5c71('0x32')](db[_0x5c71('0x2c')][_0x5c71('0x2d')]);_0x5d783e['query']=_[_0x5c71('0x32')](_0x476401[_0x5c71('0x31')]);_0x5d783e[_0x5c71('0x33')]=_['intersection'](_0x5d783e['model'],_0x5d783e[_0x5c71('0x31')]);_0x3d276c[_0x5c71('0x36')]=_[_0x5c71('0x34')](_0x5d783e['model'],qs[_0x5c71('0x35')](_0x476401[_0x5c71('0x31')][_0x5c71('0x35')]));_0x3d276c[_0x5c71('0x36')]=_0x3d276c[_0x5c71('0x36')]['length']?_0x3d276c[_0x5c71('0x36')]:_0x5d783e[_0x5c71('0x30')];if(_0x476401[_0x5c71('0x31')][_0x5c71('0x42')]){_0x3d276c['include']=[{'all':!![]}];}_0x3d276c=_[_0x5c71('0x40')]({},_0x3d276c,_0x476401[_0x5c71('0x41')]);return db[_0x5c71('0x2c')]['find'](_0x3d276c)[_0x5c71('0x25')](handleEntityNotFound(_0x4d9a8e,null))['then'](respondWithResult(_0x4d9a8e,null))[_0x5c71('0x44')](handleError(_0x4d9a8e,null));};exports[_0x5c71('0x46')]=function(_0x280aff,_0x48c8e2){return db[_0x5c71('0x2c')][_0x5c71('0x46')](_0x280aff[_0x5c71('0x47')],{})[_0x5c71('0x25')](respondWithResult(_0x48c8e2,0xc9))[_0x5c71('0x44')](handleError(_0x48c8e2,null));};exports[_0x5c71('0x48')]=function(_0x404f44,_0x3d7456){if(_0x404f44['body']['id']){delete _0x404f44['body']['id'];}return db[_0x5c71('0x2c')]['find']({'where':{'id':_0x404f44['params']['id']}})[_0x5c71('0x25')](handleEntityNotFound(_0x3d7456,null))[_0x5c71('0x25')](saveUpdates(_0x404f44[_0x5c71('0x47')],null))[_0x5c71('0x25')](respondWithResult(_0x3d7456,null))[_0x5c71('0x44')](handleError(_0x3d7456,null));};exports['destroy']=function(_0x16c4f2,_0x2c9bff){return db[_0x5c71('0x2c')][_0x5c71('0x49')]({'where':{'id':_0x16c4f2[_0x5c71('0x45')]['id']}})[_0x5c71('0x25')](handleEntityNotFound(_0x2c9bff,null))[_0x5c71('0x25')](removeEntity(_0x2c9bff,null))[_0x5c71('0x44')](handleError(_0x2c9bff,null));};exports[_0x5c71('0x4a')]=function(_0x1e5186,_0x107470,_0x36ae6d){return db['Condition'][_0x5c71('0x49')]({'where':{'id':_0x1e5186[_0x5c71('0x45')]['id']}})[_0x5c71('0x25')](handleEntityNotFound(_0x107470,null))[_0x5c71('0x25')](function(_0x244987){if(_0x244987){return _0x244987['addConditions'](_0x1e5186['body'][_0x5c71('0x4b')],_[_0x5c71('0x4c')](_0x1e5186['body'],[_0x5c71('0x4b'),'id'])||{});}})[_0x5c71('0x25')](respondWithResult(_0x107470,null))[_0x5c71('0x44')](handleError(_0x107470,null));};exports[_0x5c71('0x4d')]=function(_0x4b2b86,_0x46abb6,_0x243b07){var _0x2d829a={};var _0x41742d={};var _0x476cae;var _0x206c6a;return db[_0x5c71('0x2c')][_0x5c71('0x4e')]({'where':{'id':_0x4b2b86[_0x5c71('0x45')]['id']}})['then'](handleEntityNotFound(_0x46abb6,null))[_0x5c71('0x25')](function(_0x48b8f1){if(_0x48b8f1){_0x476cae=_0x48b8f1;_0x41742d['model']=_['keys'](db[_0x5c71('0x4f')][_0x5c71('0x2d')]);_0x41742d[_0x5c71('0x31')]=_['keys'](_0x4b2b86[_0x5c71('0x31')]);_0x41742d[_0x5c71('0x33')]=_[_0x5c71('0x34')](_0x41742d['model'],_0x41742d[_0x5c71('0x31')]);_0x2d829a[_0x5c71('0x36')]=_[_0x5c71('0x34')](_0x41742d['model'],qs[_0x5c71('0x35')](_0x4b2b86['query'][_0x5c71('0x35')]));_0x2d829a['attributes']=_0x2d829a[_0x5c71('0x36')][_0x5c71('0x37')]?_0x2d829a['attributes']:_0x41742d[_0x5c71('0x30')];_0x2d829a[_0x5c71('0x39')]=qs[_0x5c71('0x3a')](_0x4b2b86[_0x5c71('0x31')]['sort']);_0x2d829a[_0x5c71('0x3b')]=qs[_0x5c71('0x33')](_['pick'](_0x4b2b86[_0x5c71('0x31')],_0x41742d[_0x5c71('0x33')]));if(_0x4b2b86[_0x5c71('0x31')][_0x5c71('0x3f')]){_0x2d829a[_0x5c71('0x3b')]=_[_0x5c71('0x40')](_0x2d829a[_0x5c71('0x3b')],{'$or':_['map'](_0x2d829a[_0x5c71('0x36')],function(_0x3c63e1){var _0x10f4c7={};_0x10f4c7[_0x3c63e1]={'$like':'%'+_0x4b2b86[_0x5c71('0x31')][_0x5c71('0x3f')]+'%'};return _0x10f4c7;})});}_0x2d829a=_[_0x5c71('0x40')]({},_0x2d829a,_0x4b2b86['options']);return _0x476cae[_0x5c71('0x4d')](_0x2d829a);}})[_0x5c71('0x25')](function(_0x4ddae9){if(_0x4ddae9){_0x206c6a=_0x4ddae9['length'];if(!_0x4b2b86['query'][_0x5c71('0x38')](_0x5c71('0x50'))){_0x2d829a[_0x5c71('0x1e')]=qs[_0x5c71('0x1e')](_0x4b2b86[_0x5c71('0x31')][_0x5c71('0x1e')]);_0x2d829a[_0x5c71('0x1d')]=qs['offset'](_0x4b2b86[_0x5c71('0x31')][_0x5c71('0x1d')]);}return _0x476cae[_0x5c71('0x4d')](_0x2d829a);}})[_0x5c71('0x25')](function(_0x393bcf){if(_0x393bcf){return _0x393bcf?{'count':_0x206c6a,'rows':_0x393bcf}:null;}})[_0x5c71('0x25')](respondWithResult(_0x46abb6,null))['catch'](handleError(_0x46abb6,null));};exports[_0x5c71('0x51')]=function(_0x380ed8,_0x5dc7e3,_0x3b45c8){return db['Action']['find']({'where':{'id':_0x380ed8[_0x5c71('0x45')]['id']}})[_0x5c71('0x25')](handleEntityNotFound(_0x5dc7e3,null))[_0x5c71('0x25')](function(_0x1290fe){if(_0x1290fe){return _0x1290fe[_0x5c71('0x51')](_0x380ed8[_0x5c71('0x47')]['ids'],_[_0x5c71('0x4c')](_0x380ed8[_0x5c71('0x47')],[_0x5c71('0x4b'),'id'])||{});}})[_0x5c71('0x25')](respondWithResult(_0x5dc7e3,null))[_0x5c71('0x44')](handleError(_0x5dc7e3,null));};exports['getActions']=function(_0x501878,_0x34d374,_0x12d9e7){var _0x40cb02={};var _0x27803c={};var _0x1e51b2;var _0x465009;return db['Automation'][_0x5c71('0x4e')]({'where':{'id':_0x501878[_0x5c71('0x45')]['id']}})[_0x5c71('0x25')](handleEntityNotFound(_0x34d374,null))[_0x5c71('0x25')](function(_0x54f9ef){if(_0x54f9ef){_0x1e51b2=_0x54f9ef;_0x27803c[_0x5c71('0x30')]=_[_0x5c71('0x32')](db[_0x5c71('0x52')][_0x5c71('0x2d')]);_0x27803c[_0x5c71('0x31')]=_['keys'](_0x501878[_0x5c71('0x31')]);_0x27803c['filters']=_[_0x5c71('0x34')](_0x27803c[_0x5c71('0x30')],_0x27803c[_0x5c71('0x31')]);_0x40cb02[_0x5c71('0x36')]=_['intersection'](_0x27803c[_0x5c71('0x30')],qs[_0x5c71('0x35')](_0x501878['query'][_0x5c71('0x35')]));_0x40cb02[_0x5c71('0x36')]=_0x40cb02['attributes'][_0x5c71('0x37')]?_0x40cb02['attributes']:_0x27803c[_0x5c71('0x30')];_0x40cb02['order']=qs[_0x5c71('0x3a')](_0x501878['query']['sort']);_0x40cb02['where']=qs[_0x5c71('0x33')](_['pick'](_0x501878[_0x5c71('0x31')],_0x27803c[_0x5c71('0x33')]));if(_0x501878['query'][_0x5c71('0x3f')]){_0x40cb02['where']=_[_0x5c71('0x40')](_0x40cb02[_0x5c71('0x3b')],{'$or':_[_0x5c71('0x2b')](_0x40cb02['attributes'],function(_0x38e207){var _0x42d442={};_0x42d442[_0x38e207]={'$like':'%'+_0x501878['query'][_0x5c71('0x3f')]+'%'};return _0x42d442;})});}_0x40cb02=_[_0x5c71('0x40')]({},_0x40cb02,_0x501878[_0x5c71('0x41')]);return _0x1e51b2[_0x5c71('0x53')](_0x40cb02);}})['then'](function(_0x46b822){if(_0x46b822){_0x465009=_0x46b822[_0x5c71('0x37')];if(!_0x501878[_0x5c71('0x31')][_0x5c71('0x38')]('nolimit')){_0x40cb02['limit']=qs['limit'](_0x501878[_0x5c71('0x31')][_0x5c71('0x1e')]);_0x40cb02[_0x5c71('0x1d')]=qs[_0x5c71('0x1d')](_0x501878[_0x5c71('0x31')][_0x5c71('0x1d')]);}return _0x1e51b2[_0x5c71('0x53')](_0x40cb02);}})[_0x5c71('0x25')](function(_0x5c001e){if(_0x5c001e){return _0x5c001e?{'count':_0x465009,'rows':_0x5c001e}:null;}})[_0x5c71('0x25')](respondWithResult(_0x34d374,null))[_0x5c71('0x44')](handleError(_0x34d374,null));}; \ No newline at end of file +var _0x5b29=['params','length','find','catch','create','body','addConditions','Condition','ids','omit','getConditions','findOne','order','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','Automation','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x497bba,_0x2e54ae){var _0xb79cdd=function(_0xcdfaf1){while(--_0xcdfaf1){_0x497bba['push'](_0x497bba['shift']());}};_0xb79cdd(++_0x2e54ae);}(_0x5b29,0x160));var _0x95b2=function(_0x168d0c,_0x226ff8){_0x168d0c=_0x168d0c-0x0;var _0x59a4ea=_0x5b29[_0x168d0c];return _0x59a4ea;};'use strict';var emlformat=require(_0x95b2('0x0'));var rimraf=require(_0x95b2('0x1'));var zipdir=require(_0x95b2('0x2'));var jsonpatch=require(_0x95b2('0x3'));var rp=require(_0x95b2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x95b2('0x5'));var util=require(_0x95b2('0x6'));var path=require(_0x95b2('0x7'));var sox=require(_0x95b2('0x8'));var csv=require(_0x95b2('0x9'));var ejs=require(_0x95b2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x95b2('0xb'));var crypto=require(_0x95b2('0xc'));var jsforce=require(_0x95b2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x95b2('0x9'));var querystring=require(_0x95b2('0xe'));var Papa=require('papaparse');var Redis=require(_0x95b2('0xf'));var authService=require(_0x95b2('0x10'));var qs=require(_0x95b2('0x11'));var as=require(_0x95b2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x95b2('0x13'))('api');var utils=require(_0x95b2('0x14'));var config=require(_0x95b2('0x15'));var licenseUtil=require(_0x95b2('0x16'));var db=require(_0x95b2('0x17'))['db'];function respondWithStatusCode(_0x323786,_0x7599ac){_0x7599ac=_0x7599ac||0xcc;return function(_0x2f760c){if(_0x2f760c){return _0x323786[_0x95b2('0x18')](_0x7599ac);}return _0x323786['status'](_0x7599ac)[_0x95b2('0x19')]();};}function respondWithResult(_0x53893c,_0x328486){_0x328486=_0x328486||0xc8;return function(_0x180aab){if(_0x180aab){return _0x53893c[_0x95b2('0x1a')](_0x328486)[_0x95b2('0x1b')](_0x180aab);}};}function respondWithFilteredResult(_0x19a029,_0xd8e43){return function(_0x550f97){if(_0x550f97){var _0x4f4b20=typeof _0xd8e43['offset']==='undefined'&&typeof _0xd8e43[_0x95b2('0x1c')]===_0x95b2('0x1d');var _0x16437c=_0x550f97['count'];var _0x1f3bad=_0x4f4b20?0x0:_0xd8e43[_0x95b2('0x1e')];var _0x2b4bd3=_0x4f4b20?_0x550f97[_0x95b2('0x1f')]:_0xd8e43[_0x95b2('0x1e')]+_0xd8e43[_0x95b2('0x1c')];var _0x2b553d;if(_0x2b4bd3>=_0x16437c){_0x2b4bd3=_0x16437c;_0x2b553d=0xc8;}else{_0x2b553d=0xce;}_0x19a029[_0x95b2('0x1a')](_0x2b553d);return _0x19a029[_0x95b2('0x20')](_0x95b2('0x21'),_0x1f3bad+'-'+_0x2b4bd3+'/'+_0x16437c)[_0x95b2('0x1b')](_0x550f97);}return null;};}function patchUpdates(_0x4c8cbf){return function(_0x468c10){try{jsonpatch[_0x95b2('0x22')](_0x468c10,_0x4c8cbf,!![]);}catch(_0x1e1ba5){return BPromise[_0x95b2('0x23')](_0x1e1ba5);}return _0x468c10[_0x95b2('0x24')]();};}function saveUpdates(_0x187c5c,_0x45d1fb){return function(_0x20f779){if(_0x20f779){return _0x20f779[_0x95b2('0x25')](_0x187c5c)[_0x95b2('0x26')](function(_0x3acb2c){return _0x3acb2c;});}return null;};}function removeEntity(_0x35af0e,_0x471a1f){return function(_0x2ab123){if(_0x2ab123){return _0x2ab123[_0x95b2('0x27')]()['then'](function(){_0x35af0e['status'](0xcc)[_0x95b2('0x19')]();});}};}function handleEntityNotFound(_0x4813b3,_0x501a7d){return function(_0x11f3a2){if(!_0x11f3a2){_0x4813b3[_0x95b2('0x18')](0x194);}return _0x11f3a2;};}function handleError(_0x28131c,_0x106033){_0x106033=_0x106033||0x1f4;return function(_0x19d5ad){logger[_0x95b2('0x28')](_0x19d5ad[_0x95b2('0x29')]);if(_0x19d5ad[_0x95b2('0x2a')]){delete _0x19d5ad[_0x95b2('0x2a')];}_0x28131c[_0x95b2('0x1a')](_0x106033)['send'](_0x19d5ad);};}exports[_0x95b2('0x2b')]=function(_0x5ddbd5,_0x1de965){var _0x3b2449={},_0x324ad5={},_0x41e150={'count':0x0,'rows':[]};var _0x289351=_[_0x95b2('0x2c')](db[_0x95b2('0x2d')][_0x95b2('0x2e')],function(_0x4650c4){return{'name':_0x4650c4[_0x95b2('0x2f')],'type':_0x4650c4[_0x95b2('0x30')]['key']};});_0x324ad5[_0x95b2('0x31')]=_[_0x95b2('0x2c')](_0x289351,'name');_0x324ad5[_0x95b2('0x32')]=_[_0x95b2('0x33')](_0x5ddbd5['query']);_0x324ad5['filters']=_[_0x95b2('0x34')](_0x324ad5['model'],_0x324ad5[_0x95b2('0x32')]);_0x3b2449[_0x95b2('0x35')]=_[_0x95b2('0x34')](_0x324ad5[_0x95b2('0x31')],qs[_0x95b2('0x36')](_0x5ddbd5['query']['fields']));_0x3b2449[_0x95b2('0x35')]=_0x3b2449['attributes']['length']?_0x3b2449['attributes']:_0x324ad5[_0x95b2('0x31')];if(!_0x5ddbd5[_0x95b2('0x32')][_0x95b2('0x37')](_0x95b2('0x38'))){_0x3b2449['limit']=qs['limit'](_0x5ddbd5[_0x95b2('0x32')][_0x95b2('0x1c')]);_0x3b2449[_0x95b2('0x1e')]=qs[_0x95b2('0x1e')](_0x5ddbd5[_0x95b2('0x32')][_0x95b2('0x1e')]);}_0x3b2449['order']=qs['sort'](_0x5ddbd5[_0x95b2('0x32')][_0x95b2('0x39')]);_0x3b2449[_0x95b2('0x3a')]=qs['filters'](_[_0x95b2('0x3b')](_0x5ddbd5[_0x95b2('0x32')],_0x324ad5[_0x95b2('0x3c')]),_0x289351);if(_0x5ddbd5[_0x95b2('0x32')][_0x95b2('0x3d')]){_0x3b2449[_0x95b2('0x3a')]=_['merge'](_0x3b2449['where'],{'$or':_[_0x95b2('0x2c')](_0x289351,function(_0x1e133c){if(_0x1e133c['type']!==_0x95b2('0x3e')){var _0x118486={};_0x118486[_0x1e133c[_0x95b2('0x2a')]]={'$like':'%'+_0x5ddbd5[_0x95b2('0x32')][_0x95b2('0x3d')]+'%'};return _0x118486;}})});}_0x3b2449=_[_0x95b2('0x3f')]({},_0x3b2449,_0x5ddbd5[_0x95b2('0x40')]);var _0xf0e834={'where':_0x3b2449[_0x95b2('0x3a')]};return db[_0x95b2('0x2d')][_0x95b2('0x1f')](_0xf0e834)['then'](function(_0x516c77){_0x41e150[_0x95b2('0x1f')]=_0x516c77;if(_0x5ddbd5['query'][_0x95b2('0x41')]){_0x3b2449[_0x95b2('0x42')]=[{'all':!![]}];}return db[_0x95b2('0x2d')][_0x95b2('0x43')](_0x3b2449);})['then'](function(_0x2f32fd){_0x41e150['rows']=_0x2f32fd;return _0x41e150;})[_0x95b2('0x26')](respondWithFilteredResult(_0x1de965,_0x3b2449))['catch'](handleError(_0x1de965,null));};exports['show']=function(_0x2d4053,_0x2eb011){var _0x5183a1={'raw':![],'where':{'id':_0x2d4053[_0x95b2('0x44')]['id']}},_0x4acbbe={};_0x4acbbe[_0x95b2('0x31')]=_[_0x95b2('0x33')](db[_0x95b2('0x2d')][_0x95b2('0x2e')]);_0x4acbbe['query']=_[_0x95b2('0x33')](_0x2d4053[_0x95b2('0x32')]);_0x4acbbe[_0x95b2('0x3c')]=_[_0x95b2('0x34')](_0x4acbbe[_0x95b2('0x31')],_0x4acbbe['query']);_0x5183a1[_0x95b2('0x35')]=_['intersection'](_0x4acbbe['model'],qs[_0x95b2('0x36')](_0x2d4053[_0x95b2('0x32')]['fields']));_0x5183a1[_0x95b2('0x35')]=_0x5183a1[_0x95b2('0x35')][_0x95b2('0x45')]?_0x5183a1[_0x95b2('0x35')]:_0x4acbbe['model'];if(_0x2d4053[_0x95b2('0x32')][_0x95b2('0x41')]){_0x5183a1[_0x95b2('0x42')]=[{'all':!![]}];}_0x5183a1=_[_0x95b2('0x3f')]({},_0x5183a1,_0x2d4053[_0x95b2('0x40')]);return db[_0x95b2('0x2d')][_0x95b2('0x46')](_0x5183a1)['then'](handleEntityNotFound(_0x2eb011,null))['then'](respondWithResult(_0x2eb011,null))[_0x95b2('0x47')](handleError(_0x2eb011,null));};exports[_0x95b2('0x48')]=function(_0x2a5ee0,_0x19b53c){return db[_0x95b2('0x2d')][_0x95b2('0x48')](_0x2a5ee0[_0x95b2('0x49')],{})['then'](respondWithResult(_0x19b53c,0xc9))[_0x95b2('0x47')](handleError(_0x19b53c,null));};exports['update']=function(_0x1fc51b,_0x7c0665){if(_0x1fc51b['body']['id']){delete _0x1fc51b[_0x95b2('0x49')]['id'];}return db[_0x95b2('0x2d')][_0x95b2('0x46')]({'where':{'id':_0x1fc51b['params']['id']}})[_0x95b2('0x26')](handleEntityNotFound(_0x7c0665,null))[_0x95b2('0x26')](saveUpdates(_0x1fc51b[_0x95b2('0x49')],null))['then'](respondWithResult(_0x7c0665,null))[_0x95b2('0x47')](handleError(_0x7c0665,null));};exports[_0x95b2('0x27')]=function(_0x37a18c,_0x1be130){return db[_0x95b2('0x2d')][_0x95b2('0x46')]({'where':{'id':_0x37a18c[_0x95b2('0x44')]['id']}})['then'](handleEntityNotFound(_0x1be130,null))[_0x95b2('0x26')](removeEntity(_0x1be130,null))[_0x95b2('0x47')](handleError(_0x1be130,null));};exports[_0x95b2('0x4a')]=function(_0x2ed529,_0x153bf1,_0x5c6456){return db[_0x95b2('0x4b')]['find']({'where':{'id':_0x2ed529[_0x95b2('0x44')]['id']}})['then'](handleEntityNotFound(_0x153bf1,null))[_0x95b2('0x26')](function(_0x5829d9){if(_0x5829d9){return _0x5829d9[_0x95b2('0x4a')](_0x2ed529[_0x95b2('0x49')][_0x95b2('0x4c')],_[_0x95b2('0x4d')](_0x2ed529[_0x95b2('0x49')],[_0x95b2('0x4c'),'id'])||{});}})[_0x95b2('0x26')](respondWithResult(_0x153bf1,null))[_0x95b2('0x47')](handleError(_0x153bf1,null));};exports[_0x95b2('0x4e')]=function(_0x2dbe91,_0x3d8812,_0x1fc6cd){var _0x1d9ebe={};var _0x5e8bb0={};var _0x3e259b;var _0x41a13d;return db['Automation'][_0x95b2('0x4f')]({'where':{'id':_0x2dbe91['params']['id']}})['then'](handleEntityNotFound(_0x3d8812,null))[_0x95b2('0x26')](function(_0x36b1e3){if(_0x36b1e3){_0x3e259b=_0x36b1e3;_0x5e8bb0['model']=_['keys'](db[_0x95b2('0x4b')][_0x95b2('0x2e')]);_0x5e8bb0[_0x95b2('0x32')]=_['keys'](_0x2dbe91['query']);_0x5e8bb0[_0x95b2('0x3c')]=_[_0x95b2('0x34')](_0x5e8bb0[_0x95b2('0x31')],_0x5e8bb0[_0x95b2('0x32')]);_0x1d9ebe[_0x95b2('0x35')]=_[_0x95b2('0x34')](_0x5e8bb0[_0x95b2('0x31')],qs[_0x95b2('0x36')](_0x2dbe91[_0x95b2('0x32')]['fields']));_0x1d9ebe[_0x95b2('0x35')]=_0x1d9ebe[_0x95b2('0x35')]['length']?_0x1d9ebe['attributes']:_0x5e8bb0[_0x95b2('0x31')];_0x1d9ebe[_0x95b2('0x50')]=qs[_0x95b2('0x39')](_0x2dbe91[_0x95b2('0x32')][_0x95b2('0x39')]);_0x1d9ebe[_0x95b2('0x3a')]=qs['filters'](_['pick'](_0x2dbe91[_0x95b2('0x32')],_0x5e8bb0['filters']));if(_0x2dbe91[_0x95b2('0x32')][_0x95b2('0x3d')]){_0x1d9ebe['where']=_[_0x95b2('0x3f')](_0x1d9ebe[_0x95b2('0x3a')],{'$or':_['map'](_0x1d9ebe[_0x95b2('0x35')],function(_0x1f0910){var _0x1ca14e={};_0x1ca14e[_0x1f0910]={'$like':'%'+_0x2dbe91[_0x95b2('0x32')]['filter']+'%'};return _0x1ca14e;})});}_0x1d9ebe=_[_0x95b2('0x3f')]({},_0x1d9ebe,_0x2dbe91[_0x95b2('0x40')]);return _0x3e259b[_0x95b2('0x4e')](_0x1d9ebe);}})['then'](function(_0x14e778){if(_0x14e778){_0x41a13d=_0x14e778[_0x95b2('0x45')];if(!_0x2dbe91['query']['hasOwnProperty']('nolimit')){_0x1d9ebe[_0x95b2('0x1c')]=qs[_0x95b2('0x1c')](_0x2dbe91[_0x95b2('0x32')][_0x95b2('0x1c')]);_0x1d9ebe['offset']=qs[_0x95b2('0x1e')](_0x2dbe91[_0x95b2('0x32')][_0x95b2('0x1e')]);}return _0x3e259b[_0x95b2('0x4e')](_0x1d9ebe);}})[_0x95b2('0x26')](function(_0x50774a){if(_0x50774a){return _0x50774a?{'count':_0x41a13d,'rows':_0x50774a}:null;}})[_0x95b2('0x26')](respondWithResult(_0x3d8812,null))[_0x95b2('0x47')](handleError(_0x3d8812,null));};exports[_0x95b2('0x51')]=function(_0x35f23a,_0x18920f,_0x394415){return db['Action'][_0x95b2('0x46')]({'where':{'id':_0x35f23a[_0x95b2('0x44')]['id']}})['then'](handleEntityNotFound(_0x18920f,null))[_0x95b2('0x26')](function(_0x5ea447){if(_0x5ea447){return _0x5ea447['addActions'](_0x35f23a[_0x95b2('0x49')][_0x95b2('0x4c')],_[_0x95b2('0x4d')](_0x35f23a[_0x95b2('0x49')],['ids','id'])||{});}})[_0x95b2('0x26')](respondWithResult(_0x18920f,null))[_0x95b2('0x47')](handleError(_0x18920f,null));};exports['getActions']=function(_0x35fdd6,_0x3745fc,_0x2a9e7c){var _0x34b1e0={};var _0x4f11a3={};var _0x5c335a;var _0x15a401;return db[_0x95b2('0x2d')]['findOne']({'where':{'id':_0x35fdd6[_0x95b2('0x44')]['id']}})[_0x95b2('0x26')](handleEntityNotFound(_0x3745fc,null))[_0x95b2('0x26')](function(_0x3946a6){if(_0x3946a6){_0x5c335a=_0x3946a6;_0x4f11a3[_0x95b2('0x31')]=_['keys'](db[_0x95b2('0x52')]['rawAttributes']);_0x4f11a3[_0x95b2('0x32')]=_[_0x95b2('0x33')](_0x35fdd6[_0x95b2('0x32')]);_0x4f11a3['filters']=_[_0x95b2('0x34')](_0x4f11a3['model'],_0x4f11a3[_0x95b2('0x32')]);_0x34b1e0['attributes']=_['intersection'](_0x4f11a3[_0x95b2('0x31')],qs['fields'](_0x35fdd6[_0x95b2('0x32')]['fields']));_0x34b1e0[_0x95b2('0x35')]=_0x34b1e0[_0x95b2('0x35')][_0x95b2('0x45')]?_0x34b1e0[_0x95b2('0x35')]:_0x4f11a3['model'];_0x34b1e0[_0x95b2('0x50')]=qs[_0x95b2('0x39')](_0x35fdd6[_0x95b2('0x32')][_0x95b2('0x39')]);_0x34b1e0[_0x95b2('0x3a')]=qs[_0x95b2('0x3c')](_[_0x95b2('0x3b')](_0x35fdd6[_0x95b2('0x32')],_0x4f11a3[_0x95b2('0x3c')]));if(_0x35fdd6['query'][_0x95b2('0x3d')]){_0x34b1e0[_0x95b2('0x3a')]=_['merge'](_0x34b1e0[_0x95b2('0x3a')],{'$or':_['map'](_0x34b1e0[_0x95b2('0x35')],function(_0x56244b){var _0x46a3e8={};_0x46a3e8[_0x56244b]={'$like':'%'+_0x35fdd6[_0x95b2('0x32')][_0x95b2('0x3d')]+'%'};return _0x46a3e8;})});}_0x34b1e0=_[_0x95b2('0x3f')]({},_0x34b1e0,_0x35fdd6['options']);return _0x5c335a[_0x95b2('0x53')](_0x34b1e0);}})[_0x95b2('0x26')](function(_0x52a8a5){if(_0x52a8a5){_0x15a401=_0x52a8a5['length'];if(!_0x35fdd6['query'][_0x95b2('0x37')](_0x95b2('0x38'))){_0x34b1e0[_0x95b2('0x1c')]=qs['limit'](_0x35fdd6[_0x95b2('0x32')][_0x95b2('0x1c')]);_0x34b1e0[_0x95b2('0x1e')]=qs['offset'](_0x35fdd6['query'][_0x95b2('0x1e')]);}return _0x5c335a['getActions'](_0x34b1e0);}})[_0x95b2('0x26')](function(_0x27a8ae){if(_0x27a8ae){return _0x27a8ae?{'count':_0x15a401,'rows':_0x27a8ae}:null;}})[_0x95b2('0x26')](respondWithResult(_0x3745fc,null))[_0x95b2('0x47')](handleError(_0x3745fc,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2ebdd34..0e7be73 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 _0x83b0=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','tools_automations','lodash','../../config/logger','api','moment'];(function(_0x2c6810,_0x23c079){var _0x213881=function(_0x528021){while(--_0x528021){_0x2c6810['push'](_0x2c6810['shift']());}};_0x213881(++_0x23c079);}(_0x83b0,0x170));var _0x083b=function(_0x109a84,_0x47d943){_0x109a84=_0x109a84-0x0;var _0x557f11=_0x83b0[_0x109a84];return _0x557f11;};'use strict';var _=require(_0x083b('0x0'));var util=require('util');var logger=require(_0x083b('0x1'))(_0x083b('0x2'));var moment=require(_0x083b('0x3'));var BPromise=require(_0x083b('0x4'));var rp=require(_0x083b('0x5'));var fs=require('fs');var path=require(_0x083b('0x6'));var rimraf=require(_0x083b('0x7'));var config=require(_0x083b('0x8'));var attributes=require('./automation.attributes');module[_0x083b('0x9')]=function(_0x5855d3,_0x4cf7c1){return _0x5855d3[_0x083b('0xa')]('Automation',attributes,{'tableName':_0x083b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb50=['path','../../config/environment','./automation.attributes','exports','define','Automation','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4fbaf9,_0x3b8190){var _0x1d89a0=function(_0x3b650b){while(--_0x3b650b){_0x4fbaf9['push'](_0x4fbaf9['shift']());}};_0x1d89a0(++_0x3b8190);}(_0xbb50,0xae));var _0x0bb5=function(_0x2923b8,_0x1dba92){_0x2923b8=_0x2923b8-0x0;var _0x25659a=_0xbb50[_0x2923b8];return _0x25659a;};'use strict';var _=require(_0x0bb5('0x0'));var util=require(_0x0bb5('0x1'));var logger=require('../../config/logger')(_0x0bb5('0x2'));var moment=require(_0x0bb5('0x3'));var BPromise=require(_0x0bb5('0x4'));var rp=require(_0x0bb5('0x5'));var fs=require('fs');var path=require(_0x0bb5('0x6'));var rimraf=require('rimraf');var config=require(_0x0bb5('0x7'));var attributes=require(_0x0bb5('0x8'));module[_0x0bb5('0x9')]=function(_0x6eb345,_0x38e3ec){return _0x6eb345[_0x0bb5('0xa')](_0x0bb5('0xb'),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 a3538b6..e72aa35 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 _0x508a=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x508a,0x1aa));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa508('0x0'));var util=require('util');var moment=require(_0xa508('0x1'));var BPromise=require(_0xa508('0x2'));var rs=require(_0xa508('0x3'));var fs=require('fs');var Redis=require(_0xa508('0x4'));var db=require(_0xa508('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa508('0x6'))(_0xa508('0x7'));var config=require(_0xa508('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa508('0x9')][_0xa508('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x406df0,_0x4ddfec,_0x284fb1){return new BPromise(function(_0x6f201c,_0x4f6c23){return client[_0xa508('0xb')](_0x406df0,_0x284fb1)[_0xa508('0xc')](function(_0x577617){logger[_0xa508('0xd')](_0xa508('0xe'),_0x4ddfec,_0xa508('0xf'));logger[_0xa508('0x10')](_0xa508('0x11'),_0x4ddfec,'request\x20sent',JSON[_0xa508('0x12')](_0x577617));if(_0x577617[_0xa508('0x13')]){if(_0x577617['error'][_0xa508('0x14')]===0x1f4){logger[_0xa508('0x13')](_0xa508('0xe'),_0x4ddfec,_0x577617['error'][_0xa508('0x15')]);return _0x4f6c23(_0x577617['error'][_0xa508('0x15')]);}logger[_0xa508('0x13')](_0xa508('0xe'),_0x4ddfec,_0x577617[_0xa508('0x13')]['message']);return _0x6f201c(_0x577617[_0xa508('0x13')][_0xa508('0x15')]);}else{logger[_0xa508('0xd')](_0xa508('0xe'),_0x4ddfec,'request\x20sent');_0x6f201c(_0x577617[_0xa508('0x16')][_0xa508('0x15')]);}})[_0xa508('0x17')](function(_0xb76bf){logger['error'](_0xa508('0xe'),_0x4ddfec,_0xb76bf);_0x4f6c23(_0xb76bf);});});} \ No newline at end of file +var _0x3d3d=['info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','result','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x231ed8,_0x4dfd8a){var _0x14a210=function(_0x11b4a4){while(--_0x11b4a4){_0x231ed8['push'](_0x231ed8['shift']());}};_0x14a210(++_0x4dfd8a);}(_0x3d3d,0xab));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd3d3('0x0'));var moment=require(_0xd3d3('0x1'));var BPromise=require('bluebird');var rs=require(_0xd3d3('0x2'));var fs=require('fs');var Redis=require(_0xd3d3('0x3'));var db=require(_0xd3d3('0x4'))['db'];var utils=require(_0xd3d3('0x5'));var logger=require(_0xd3d3('0x6'))(_0xd3d3('0x7'));var config=require(_0xd3d3('0x8'));var jayson=require(_0xd3d3('0x9'));var client=jayson[_0xd3d3('0xa')][_0xd3d3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4aa421,_0x1f47fe,_0x263940){return new BPromise(function(_0x3fe58e,_0x2ed96f){return client['request'](_0x4aa421,_0x263940)[_0xd3d3('0xc')](function(_0x412054){logger[_0xd3d3('0xd')](_0xd3d3('0xe'),_0x1f47fe,'request\x20sent');logger[_0xd3d3('0xf')](_0xd3d3('0x10'),_0x1f47fe,_0xd3d3('0x11'),JSON[_0xd3d3('0x12')](_0x412054));if(_0x412054[_0xd3d3('0x13')]){if(_0x412054[_0xd3d3('0x13')]['code']===0x1f4){logger[_0xd3d3('0x13')]('Automation,\x20%s,\x20%s',_0x1f47fe,_0x412054['error']['message']);return _0x2ed96f(_0x412054[_0xd3d3('0x13')]['message']);}logger['error'](_0xd3d3('0xe'),_0x1f47fe,_0x412054[_0xd3d3('0x13')]['message']);return _0x3fe58e(_0x412054[_0xd3d3('0x13')]['message']);}else{logger['info'](_0xd3d3('0xe'),_0x1f47fe,_0xd3d3('0x11'));_0x3fe58e(_0x412054[_0xd3d3('0x14')][_0xd3d3('0x15')]);}})[_0xd3d3('0x16')](function(_0x5c3462){logger[_0xd3d3('0x13')](_0xd3d3('0xe'),_0x1f47fe,_0x5c3462);_0x2ed96f(_0x5c3462);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 627b5e3..f8678b3 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 _0xc737=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./automation.controller','index','get','isAuthenticated','show','getConditions','getActions','post','/:id/conditions','/:id/actions','addActions','/:id'];(function(_0x56312f,_0x685233){var _0x8b273d=function(_0x569a1a){while(--_0x569a1a){_0x56312f['push'](_0x56312f['shift']());}};_0x8b273d(++_0x685233);}(_0xc737,0x154));var _0x7c73=function(_0x522df5,_0x3364ae){_0x522df5=_0x522df5-0x0;var _0x3fffd4=_0xc737[_0x522df5];return _0x3fffd4;};'use strict';var multer=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var path=require(_0x7c73('0x2'));var timeout=require(_0x7c73('0x3'));var express=require('express');var router=express[_0x7c73('0x4')]();var fs_extra=require(_0x7c73('0x5'));var auth=require(_0x7c73('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7c73('0x7'));var controller=require(_0x7c73('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7c73('0x9')]);router[_0x7c73('0xa')]('/:id',auth[_0x7c73('0xb')](),controller[_0x7c73('0xc')]);router['get']('/:id/conditions',auth[_0x7c73('0xb')](),controller[_0x7c73('0xd')]);router[_0x7c73('0xa')]('/:id/actions',auth[_0x7c73('0xb')](),controller[_0x7c73('0xe')]);router['post']('/',auth[_0x7c73('0xb')](),controller['create']);router[_0x7c73('0xf')](_0x7c73('0x10'),auth[_0x7c73('0xb')](),controller['addConditions']);router[_0x7c73('0xf')](_0x7c73('0x11'),auth[_0x7c73('0xb')](),controller[_0x7c73('0x12')]);router['put'](_0x7c73('0x13'),auth['isAuthenticated'](),controller[_0x7c73('0x14')]);router[_0x7c73('0x15')](_0x7c73('0x13'),auth[_0x7c73('0xb')](),controller[_0x7c73('0x16')]);module[_0x7c73('0x17')]=router; \ No newline at end of file +var _0x3351=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','delete','exports','multer'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x3351,0x1b4));var _0x1335=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x3351[_0x2df507];return _0x1f7167;};'use strict';var multer=require(_0x1335('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1335('0x1'));var express=require(_0x1335('0x2'));var router=express[_0x1335('0x3')]();var fs_extra=require(_0x1335('0x4'));var auth=require(_0x1335('0x5'));var interaction=require(_0x1335('0x6'));var config=require(_0x1335('0x7'));var controller=require('./automation.controller');router[_0x1335('0x8')]('/',auth[_0x1335('0x9')](),controller[_0x1335('0xa')]);router[_0x1335('0x8')](_0x1335('0xb'),auth[_0x1335('0x9')](),controller[_0x1335('0xc')]);router[_0x1335('0x8')](_0x1335('0xd'),auth[_0x1335('0x9')](),controller[_0x1335('0xe')]);router['get'](_0x1335('0xf'),auth['isAuthenticated'](),controller[_0x1335('0x10')]);router[_0x1335('0x11')]('/',auth[_0x1335('0x9')](),controller[_0x1335('0x12')]);router[_0x1335('0x11')](_0x1335('0xd'),auth['isAuthenticated'](),controller[_0x1335('0x13')]);router['post'](_0x1335('0xf'),auth['isAuthenticated'](),controller[_0x1335('0x14')]);router['put'](_0x1335('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1335('0x15')](_0x1335('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1335('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index ad8887e..e387046 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 _0x8bec=['DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','name','ENUM','ivr','STRING','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','BOOLEAN','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'];(function(_0x1e0cac,_0x569f42){var _0x478e12=function(_0x20ccef){while(--_0x20ccef){_0x1e0cac['push'](_0x1e0cac['shift']());}};_0x478e12(++_0x569f42);}(_0x8bec,0xdd));var _0xc8be=function(_0x15a1f9,_0x189f40){_0x15a1f9=_0x15a1f9-0x0;var _0x22542b=_0x8bec[_0x15a1f9];return _0x22542b;};'use strict';var Sequelize=require('sequelize');module[_0xc8be('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xc8be('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc8be('0x2')](_0xc8be('0x3')),'allowNull':![],'defaultValue':_0xc8be('0x3')},'description':{'type':Sequelize[_0xc8be('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc8be('0x5')},'limitCalls':{'type':Sequelize[_0xc8be('0x6')](0x4)[_0xc8be('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc8be('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0xc8be('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8be('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc8be('0x6')](0x3)[_0xc8be('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8be('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc8be('0x6')](0x5)[_0xc8be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8be('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xc8be('0x6')](0x3)[_0xc8be('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8be('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc8be('0x6')](0x5)[_0xc8be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc8be('0x6')](0x3)[_0xc8be('0x7')],'defaultValue':0x3,'comment':_0xc8be('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc8be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xc8be('0x6')](0x3)[_0xc8be('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc8be('0xd')},'dialTimezone':{'type':Sequelize[_0xc8be('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xc8be('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xc8be('0x2')]('always',_0xc8be('0xf'),_0xc8be('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xc8be('0x11')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xc8be('0x6')](0x9)[_0xc8be('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc8be('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc8be('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc8be('0x6')](0x9)[_0xc8be('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc8be('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0xc8be('0x6')](0x9)[_0xc8be('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc8be('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc8be('0x6')](0x9)[_0xc8be('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc8be('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xc8be('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc8be('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc8be('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc8be('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc8be('0x6')](0x9)[_0xc8be('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xc8be('0x2')](_0xc8be('0x18'),_0xc8be('0x19')),'defaultValue':_0xc8be('0x18')},'dialPrefix':{'type':Sequelize[_0xc8be('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xc8be('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xc8be('0x6')](0x3)[_0xc8be('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc8be('0x6')](0x3)[_0xc8be('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8be('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc8be('0x6')](0x5)[_0xc8be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8be('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0xc8be('0x6')](0x3)[_0xc8be('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8be('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0xc8be('0x6')](0x5)[_0xc8be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8be('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc8be('0x6')](0x3)[_0xc8be('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8be('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc8be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8be('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0xc8be('0x6')](0x3)[_0xc8be('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc8be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8be('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc8be('0x6')](0x3)[_0xc8be('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8be('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc8be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8be('0x22')}}; \ No newline at end of file +var _0x5525=['#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0x6e4107,_0x450818){var _0xa74c9f=function(_0x453218){while(--_0x453218){_0x6e4107['push'](_0x6e4107['shift']());}};_0xa74c9f(++_0x450818);}(_0x5525,0xd1));var _0x5552=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5525[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x5552('0x0'));module[_0x5552('0x1')]={'name':{'type':Sequelize[_0x5552('0x2')],'unique':_0x5552('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5552('0x4')](_0x5552('0x5')),'allowNull':![],'defaultValue':_0x5552('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5552('0x6')],'defaultValue':0x0,'comment':_0x5552('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x5552('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5552('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5552('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5552('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x5552('0xa')](0x3)[_0x5552('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5552('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5552('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5552('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5552('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x5552('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x5552('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5552('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5552('0xa')](0x3)[_0x5552('0x8')],'defaultValue':0x3,'comment':_0x5552('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5552('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5552('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5552('0x10')},'dialTimezone':{'type':Sequelize[_0x5552('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x5552('0x4')](_0x5552('0x11'),_0x5552('0x12'),_0x5552('0x13')),'defaultValue':_0x5552('0x11')},'dialAMDActive':{'type':Sequelize[_0x5552('0x6')],'defaultValue':0x0,'comment':_0x5552('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x5552('0xa')](0x9)[_0x5552('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x5552('0xa')](0x9)[_0x5552('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5552('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5552('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x5552('0xa')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5552('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5552('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5552('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5552('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5552('0xa')](0x5)[_0x5552('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5552('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5552('0xa')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5552('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5552('0x4')](_0x5552('0x1c'),_0x5552('0x1d')),'defaultValue':_0x5552('0x1c')},'dialPrefix':{'type':Sequelize[_0x5552('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5552('0xa')](0x3)[_0x5552('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5552('0x1e')},'dialCutDigit':{'type':Sequelize[_0x5552('0xa')](0x3)[_0x5552('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5552('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5552('0xa')](0x3)[_0x5552('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5552('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5552('0xa')](0x5)[_0x5552('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5552('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5552('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x5552('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5552('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5552('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5552('0xa')](0x5)[_0x5552('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5552('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x5552('0xa')](0x3)[_0x5552('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5552('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5552('0xa')](0x5)[_0x5552('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5552('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5552('0xa')](0x3)[_0x5552('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5552('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5552('0xa')](0x5)[_0x5552('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 88aed12..2db1c2f 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 _0x64bc=['rawAttributes','omit','createdAt','updatedAt','user','find','getHoppers','findOne','CmHopper','nolimit','CampaignId','findAll','getHopperHistories','CmHopperHistory','hasOwnProperty','pick','options','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ListId','select','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','ContactId','push','sequelize','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','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','end','status','json','offset','undefined','limit','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','Campaign','count','includeAll','include','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x4d995d,_0x5e81f2){var _0x45f44d=function(_0x2670a4){while(--_0x2670a4){_0x4d995d['push'](_0x4d995d['shift']());}};_0x45f44d(++_0x5e81f2);}(_0x64bc,0xc0));var _0xc64b=function(_0xc05bf9,_0x262dbc){_0xc05bf9=_0xc05bf9-0x0;var _0x26a5d2=_0x64bc[_0xc05bf9];return _0x26a5d2;};'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(_0xc64b('0x0'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc64b('0x1'));var path=require(_0xc64b('0x2'));var sox=require(_0xc64b('0x3'));var csv=require(_0xc64b('0x4'));var ejs=require(_0xc64b('0x5'));var fs=require('fs');var fs_extra=require(_0xc64b('0x6'));var _=require(_0xc64b('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc64b('0x8'));var deskjs=require(_0xc64b('0x9'));var toCsv=require(_0xc64b('0x4'));var querystring=require(_0xc64b('0xa'));var Papa=require(_0xc64b('0xb'));var Redis=require(_0xc64b('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xc64b('0xd'));var as=require(_0xc64b('0xe'));var hardwareService=require(_0xc64b('0xf'));var logger=require(_0xc64b('0x10'))(_0xc64b('0x11'));var utils=require('../../config/utils');var config=require(_0xc64b('0x12'));var licenseUtil=require(_0xc64b('0x13'));var db=require(_0xc64b('0x14'))['db'];function respondWithStatusCode(_0x5381bc,_0x124ccc){_0x124ccc=_0x124ccc||0xcc;return function(_0x445f76){if(_0x445f76){return _0x5381bc[_0xc64b('0x15')](_0x124ccc);}return _0x5381bc['status'](_0x124ccc)[_0xc64b('0x16')]();};}function respondWithResult(_0x1ed557,_0x31cdc0){_0x31cdc0=_0x31cdc0||0xc8;return function(_0x5a36e9){if(_0x5a36e9){return _0x1ed557[_0xc64b('0x17')](_0x31cdc0)[_0xc64b('0x18')](_0x5a36e9);}};}function respondWithFilteredResult(_0xa68b34,_0x29ec3b){return function(_0x2139c4){if(_0x2139c4){var _0x3b8d46=typeof _0x29ec3b[_0xc64b('0x19')]===_0xc64b('0x1a')&&typeof _0x29ec3b['limit']===_0xc64b('0x1a');var _0x3f35fd=_0x2139c4['count'];var _0x34cbc1=_0x3b8d46?0x0:_0x29ec3b[_0xc64b('0x19')];var _0x2e345d=_0x3b8d46?_0x2139c4['count']:_0x29ec3b[_0xc64b('0x19')]+_0x29ec3b[_0xc64b('0x1b')];var _0x18e8df;if(_0x2e345d>=_0x3f35fd){_0x2e345d=_0x3f35fd;_0x18e8df=0xc8;}else{_0x18e8df=0xce;}_0xa68b34[_0xc64b('0x17')](_0x18e8df);return _0xa68b34['set'](_0xc64b('0x1c'),_0x34cbc1+'-'+_0x2e345d+'/'+_0x3f35fd)[_0xc64b('0x18')](_0x2139c4);}return null;};}function patchUpdates(_0x2af13e){return function(_0x2a657a){try{jsonpatch['apply'](_0x2a657a,_0x2af13e,!![]);}catch(_0x37fac7){return BPromise[_0xc64b('0x1d')](_0x37fac7);}return _0x2a657a[_0xc64b('0x1e')]();};}function saveUpdates(_0x6873db,_0x36d41e){return function(_0x4d26a0){if(_0x4d26a0){return _0x4d26a0[_0xc64b('0x1f')](_0x6873db)[_0xc64b('0x20')](function(_0x250683){return _0x250683;});}return null;};}function removeEntity(_0x52d7cc,_0x398f94){return function(_0x3a91fd){if(_0x3a91fd){return _0x3a91fd[_0xc64b('0x21')]()[_0xc64b('0x20')](function(){var _0x445a7d=_0x3a91fd[_0xc64b('0x22')]({'plain':!![]});var _0x784a31=_0xc64b('0x23');return db[_0xc64b('0x24')][_0xc64b('0x21')]({'where':{'type':_0x784a31,'resourceId':_0x445a7d['id']}})[_0xc64b('0x20')](function(){return _0x3a91fd;});})[_0xc64b('0x20')](function(){_0x52d7cc[_0xc64b('0x17')](0xcc)[_0xc64b('0x16')]();});}};}function handleEntityNotFound(_0x2f4757,_0xdc180c){return function(_0x461279){if(!_0x461279){_0x2f4757[_0xc64b('0x15')](0x194);}return _0x461279;};}function handleError(_0x49d012,_0x17b588){_0x17b588=_0x17b588||0x1f4;return function(_0x10ccad){logger[_0xc64b('0x25')](_0x10ccad[_0xc64b('0x26')]);if(_0x10ccad[_0xc64b('0x27')]){delete _0x10ccad[_0xc64b('0x27')];}_0x49d012[_0xc64b('0x17')](_0x17b588)['send'](_0x10ccad);};}exports[_0xc64b('0x28')]=function(_0x323073,_0x377123){var _0x38ca88={},_0x52e173={},_0x58e36b={'count':0x0,'rows':[]};var _0x3db2b8=_[_0xc64b('0x29')](db['Campaign']['rawAttributes'],function(_0x4345b3){return{'name':_0x4345b3[_0xc64b('0x2a')],'type':_0x4345b3[_0xc64b('0x2b')][_0xc64b('0x2c')]};});_0x52e173[_0xc64b('0x2d')]=_[_0xc64b('0x29')](_0x3db2b8,'name');_0x52e173[_0xc64b('0x2e')]=_[_0xc64b('0x2f')](_0x323073[_0xc64b('0x2e')]);_0x52e173[_0xc64b('0x30')]=_[_0xc64b('0x31')](_0x52e173[_0xc64b('0x2d')],_0x52e173['query']);_0x38ca88[_0xc64b('0x32')]=_['intersection'](_0x52e173['model'],qs[_0xc64b('0x33')](_0x323073[_0xc64b('0x2e')][_0xc64b('0x33')]));_0x38ca88[_0xc64b('0x32')]=_0x38ca88['attributes'][_0xc64b('0x34')]?_0x38ca88[_0xc64b('0x32')]:_0x52e173['model'];if(!_0x323073[_0xc64b('0x2e')]['hasOwnProperty']('nolimit')){_0x38ca88[_0xc64b('0x1b')]=qs[_0xc64b('0x1b')](_0x323073[_0xc64b('0x2e')][_0xc64b('0x1b')]);_0x38ca88['offset']=qs[_0xc64b('0x19')](_0x323073['query']['offset']);}_0x38ca88[_0xc64b('0x35')]=qs[_0xc64b('0x36')](_0x323073[_0xc64b('0x2e')][_0xc64b('0x36')]);_0x38ca88[_0xc64b('0x37')]=qs['filters'](_['pick'](_0x323073[_0xc64b('0x2e')],_0x52e173[_0xc64b('0x30')]),_0x3db2b8);if(_0x323073[_0xc64b('0x2e')][_0xc64b('0x38')]){_0x38ca88[_0xc64b('0x37')]=_[_0xc64b('0x39')](_0x38ca88[_0xc64b('0x37')],{'$or':_[_0xc64b('0x29')](_0x3db2b8,function(_0x42f9c9){if(_0x42f9c9[_0xc64b('0x2b')]!==_0xc64b('0x3a')){var _0x1ab0de={};_0x1ab0de[_0x42f9c9['name']]={'$like':'%'+_0x323073['query'][_0xc64b('0x38')]+'%'};return _0x1ab0de;}})});}_0x38ca88=_[_0xc64b('0x39')]({},_0x38ca88,_0x323073['options']);var _0x257634={'where':_0x38ca88['where']};return db[_0xc64b('0x3b')][_0xc64b('0x3c')](_0x257634)[_0xc64b('0x20')](function(_0x3c655e){_0x58e36b['count']=_0x3c655e;if(_0x323073[_0xc64b('0x2e')][_0xc64b('0x3d')]){_0x38ca88[_0xc64b('0x3e')]=[{'all':!![]}];}return db[_0xc64b('0x3b')]['findAll'](_0x38ca88);})[_0xc64b('0x20')](function(_0xb21518){_0x58e36b[_0xc64b('0x3f')]=_0xb21518;return _0x58e36b;})[_0xc64b('0x20')](respondWithFilteredResult(_0x377123,_0x38ca88))[_0xc64b('0x40')](handleError(_0x377123,null));};exports[_0xc64b('0x41')]=function(_0x3bfb32,_0x1ff676){var _0x43589c={'raw':![],'where':{'id':_0x3bfb32[_0xc64b('0x42')]['id']}},_0x43603c={};_0x43603c['model']=_[_0xc64b('0x2f')](db[_0xc64b('0x3b')]['rawAttributes']);_0x43603c[_0xc64b('0x2e')]=_[_0xc64b('0x2f')](_0x3bfb32[_0xc64b('0x2e')]);_0x43603c['filters']=_['intersection'](_0x43603c[_0xc64b('0x2d')],_0x43603c['query']);_0x43589c['attributes']=_['intersection'](_0x43603c['model'],qs[_0xc64b('0x33')](_0x3bfb32[_0xc64b('0x2e')][_0xc64b('0x33')]));_0x43589c[_0xc64b('0x32')]=_0x43589c[_0xc64b('0x32')][_0xc64b('0x34')]?_0x43589c[_0xc64b('0x32')]:_0x43603c[_0xc64b('0x2d')];if(_0x3bfb32[_0xc64b('0x2e')]['includeAll']){_0x43589c[_0xc64b('0x3e')]=[{'all':!![]}];}_0x43589c=_[_0xc64b('0x39')]({},_0x43589c,_0x3bfb32['options']);return db[_0xc64b('0x3b')]['find'](_0x43589c)['then'](handleEntityNotFound(_0x1ff676,null))['then'](respondWithResult(_0x1ff676,null))[_0xc64b('0x40')](handleError(_0x1ff676,null));};exports[_0xc64b('0x43')]=function(_0x23b944,_0x46d630){return db['Campaign'][_0xc64b('0x43')](_0x23b944[_0xc64b('0x44')],{})[_0xc64b('0x20')](function(_0x1837fe){var _0x49fbc4=_0x23b944['user'][_0xc64b('0x22')]({'plain':!![]});if(!_0x49fbc4)throw new Error(_0xc64b('0x45'));if(_0x49fbc4[_0xc64b('0x46')]==='user'){var _0x64ad2=_0x1837fe[_0xc64b('0x22')]({'plain':!![]});var _0x29215e=_0xc64b('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x29215e,'userProfileId':_0x49fbc4[_0xc64b('0x47')]},'raw':!![]})[_0xc64b('0x20')](function(_0x85a5ab){if(_0x85a5ab&&_0x85a5ab[_0xc64b('0x48')]===0x0){return db[_0xc64b('0x24')][_0xc64b('0x43')]({'name':_0x64ad2[_0xc64b('0x27')],'resourceId':_0x64ad2['id'],'type':_0x85a5ab[_0xc64b('0x27')],'sectionId':_0x85a5ab['id']},{})[_0xc64b('0x20')](function(){return _0x1837fe;});}else{return _0x1837fe;}})[_0xc64b('0x40')](function(_0x45045f){logger[_0xc64b('0x25')](_0xc64b('0x49'),_0x45045f);throw _0x45045f;});}return _0x1837fe;})[_0xc64b('0x20')](respondWithResult(_0x46d630,0xc9))[_0xc64b('0x40')](handleError(_0x46d630,null));};exports['clone']=function(_0x17e014,_0x3031bc){var _0x1af905={'where':{'id':_0x17e014['params']['id']}},_0x458045={};_0x458045['model']=_['keys'](db[_0xc64b('0x3b')][_0xc64b('0x4a')]);_0x1af905['attributes']=_[_0xc64b('0x31')](_0x458045[_0xc64b('0x2d')],qs['fields'](_0x17e014[_0xc64b('0x2e')][_0xc64b('0x33')]));_0x1af905[_0xc64b('0x32')]=_0x1af905[_0xc64b('0x32')]['length']?_0x1af905[_0xc64b('0x32')]:_0x458045[_0xc64b('0x2d')];if(_0x17e014[_0xc64b('0x2e')][_0xc64b('0x3d')]){_0x1af905[_0xc64b('0x3e')]=[{'all':!![]}];}_0x1af905=_[_0xc64b('0x39')]({},_0x1af905,_0x17e014['options']);return db['Campaign']['find'](_0x1af905)[_0xc64b('0x20')](handleEntityNotFound(_0x3031bc,null))[_0xc64b('0x20')](function(_0xdd1eb9){if(_0xdd1eb9){var _0x172333=_0xdd1eb9[_0xc64b('0x22')]({'plain':!![]});_0x172333=qs[_0xc64b('0x4b')](_0x172333,['id','createdAt','updatedAt']);_0x17e014[_0xc64b('0x44')]=_[_0xc64b('0x4b')](_0x17e014[_0xc64b('0x44')],['id',_0xc64b('0x4c'),_0xc64b('0x4d')]);return db[_0xc64b('0x3b')][_0xc64b('0x43')](_[_0xc64b('0x39')](_0x172333,_0x17e014[_0xc64b('0x44')]),{'include':_0x17e014[_0xc64b('0x2e')]['includeAll']?[{'all':!![]}]:undefined})[_0xc64b('0x20')](function(_0x1ad175){var _0x373c79=_0x17e014[_0xc64b('0x4e')][_0xc64b('0x22')]({'plain':!![]});if(!_0x373c79)throw new Error(_0xc64b('0x45'));if(_0x373c79[_0xc64b('0x46')]===_0xc64b('0x4e')){var _0x3f86c3=_0x1ad175[_0xc64b('0x22')]({'plain':!![]});var _0x138bac=_0xc64b('0x23');return db['UserProfileSection'][_0xc64b('0x4f')]({'where':{'name':_0x138bac,'userProfileId':_0x373c79[_0xc64b('0x47')]},'raw':!![]})['then'](function(_0x2afd5a){if(_0x2afd5a&&_0x2afd5a[_0xc64b('0x48')]===0x0){return db[_0xc64b('0x24')]['create']({'name':_0x3f86c3[_0xc64b('0x27')],'resourceId':_0x3f86c3['id'],'type':_0x2afd5a['name'],'sectionId':_0x2afd5a['id']},{})[_0xc64b('0x20')](function(){return _0x1ad175;});}else{return _0x1ad175;}})['catch'](function(_0xc529a){logger[_0xc64b('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc529a);throw _0xc529a;});}return _0x1ad175;});}})[_0xc64b('0x20')](respondWithResult(_0x3031bc,0xc9))[_0xc64b('0x40')](handleError(_0x3031bc,null));};exports[_0xc64b('0x1f')]=function(_0x3de225,_0x41cbf0){if(_0x3de225[_0xc64b('0x44')]['id']){delete _0x3de225[_0xc64b('0x44')]['id'];}return db['Campaign'][_0xc64b('0x4f')]({'where':{'id':_0x3de225[_0xc64b('0x42')]['id']}})['then'](handleEntityNotFound(_0x41cbf0,null))[_0xc64b('0x20')](saveUpdates(_0x3de225[_0xc64b('0x44')],null))[_0xc64b('0x20')](respondWithResult(_0x41cbf0,null))[_0xc64b('0x40')](handleError(_0x41cbf0,null));};exports[_0xc64b('0x21')]=function(_0x85f0e,_0x152795){return db[_0xc64b('0x3b')]['find']({'where':{'id':_0x85f0e[_0xc64b('0x42')]['id']}})['then'](handleEntityNotFound(_0x152795,null))[_0xc64b('0x20')](removeEntity(_0x152795,null))[_0xc64b('0x40')](handleError(_0x152795,null));};exports[_0xc64b('0x50')]=function(_0x3841ac,_0x192b91,_0x465d62){var _0x51e27c={'raw':!![],'where':{}};var _0x40a9f7={};var _0x382cdd={'count':0x0,'rows':[]};return db[_0xc64b('0x3b')][_0xc64b('0x51')]({'where':{'id':_0x3841ac['params']['id']}})[_0xc64b('0x20')](handleEntityNotFound(_0x192b91,null))[_0xc64b('0x20')](function(_0x16191c){if(_0x16191c){_0x40a9f7[_0xc64b('0x2d')]=_[_0xc64b('0x2f')](db[_0xc64b('0x52')][_0xc64b('0x4a')]);_0x40a9f7[_0xc64b('0x2e')]=_[_0xc64b('0x2f')](_0x3841ac[_0xc64b('0x2e')]);_0x40a9f7[_0xc64b('0x30')]=_[_0xc64b('0x31')](_0x40a9f7[_0xc64b('0x2d')],_0x40a9f7[_0xc64b('0x2e')]);_0x51e27c['attributes']=_[_0xc64b('0x31')](_0x40a9f7['model'],qs[_0xc64b('0x33')](_0x3841ac[_0xc64b('0x2e')][_0xc64b('0x33')]));_0x51e27c[_0xc64b('0x32')]=_0x51e27c['attributes'][_0xc64b('0x34')]?_0x51e27c[_0xc64b('0x32')]:_0x40a9f7[_0xc64b('0x2d')];if(!_0x3841ac[_0xc64b('0x2e')]['hasOwnProperty'](_0xc64b('0x53'))){_0x51e27c[_0xc64b('0x1b')]=qs[_0xc64b('0x1b')](_0x3841ac[_0xc64b('0x2e')][_0xc64b('0x1b')]);_0x51e27c[_0xc64b('0x19')]=qs[_0xc64b('0x19')](_0x3841ac['query'][_0xc64b('0x19')]);}_0x51e27c[_0xc64b('0x35')]=qs['sort'](_0x3841ac[_0xc64b('0x2e')]['sort']);_0x51e27c[_0xc64b('0x37')]=qs['filters'](_['pick'](_0x3841ac[_0xc64b('0x2e')],_0x40a9f7[_0xc64b('0x30')]));_0x51e27c['where'][_0xc64b('0x54')]=_0x16191c['id'];if(_0x3841ac['query'][_0xc64b('0x38')]){_0x51e27c[_0xc64b('0x37')]=_['merge'](_0x51e27c[_0xc64b('0x37')],{'$or':_[_0xc64b('0x29')](_0x51e27c[_0xc64b('0x32')],function(_0x1f4293){var _0x553d2f={};_0x553d2f[_0x1f4293]={'$like':'%'+_0x3841ac[_0xc64b('0x2e')][_0xc64b('0x38')]+'%'};return _0x553d2f;})});}_0x51e27c=_[_0xc64b('0x39')]({},_0x51e27c,_0x3841ac['options']);return db[_0xc64b('0x52')][_0xc64b('0x3c')]({'where':_0x51e27c[_0xc64b('0x37')]})[_0xc64b('0x20')](function(_0xe5b525){_0x382cdd['count']=_0xe5b525;if(_0x3841ac[_0xc64b('0x2e')][_0xc64b('0x3d')]){_0x51e27c['include']=[{'all':!![]}];}return db['CmHopper'][_0xc64b('0x55')](_0x51e27c);})['then'](function(_0x514e4d){_0x382cdd[_0xc64b('0x3f')]=_0x514e4d;return _0x382cdd;});}})[_0xc64b('0x20')](respondWithFilteredResult(_0x192b91,_0x51e27c))[_0xc64b('0x40')](handleError(_0x192b91,null));};exports[_0xc64b('0x56')]=function(_0x118452,_0x1b6dc4,_0x37bef6){var _0x5e31e4={'raw':!![],'where':{}};var _0x4f0dc8={};var _0x7daa67={'count':0x0,'rows':[]};return db[_0xc64b('0x3b')]['findOne']({'where':{'id':_0x118452[_0xc64b('0x42')]['id']}})['then'](handleEntityNotFound(_0x1b6dc4,null))[_0xc64b('0x20')](function(_0x3948b4){if(_0x3948b4){_0x4f0dc8['model']=_[_0xc64b('0x2f')](db[_0xc64b('0x57')][_0xc64b('0x4a')]);_0x4f0dc8[_0xc64b('0x2e')]=_['keys'](_0x118452[_0xc64b('0x2e')]);_0x4f0dc8[_0xc64b('0x30')]=_[_0xc64b('0x31')](_0x4f0dc8[_0xc64b('0x2d')],_0x4f0dc8['query']);_0x5e31e4[_0xc64b('0x32')]=_['intersection'](_0x4f0dc8[_0xc64b('0x2d')],qs[_0xc64b('0x33')](_0x118452[_0xc64b('0x2e')][_0xc64b('0x33')]));_0x5e31e4[_0xc64b('0x32')]=_0x5e31e4['attributes'][_0xc64b('0x34')]?_0x5e31e4[_0xc64b('0x32')]:_0x4f0dc8[_0xc64b('0x2d')];if(!_0x118452[_0xc64b('0x2e')][_0xc64b('0x58')](_0xc64b('0x53'))){_0x5e31e4[_0xc64b('0x1b')]=qs['limit'](_0x118452[_0xc64b('0x2e')]['limit']);_0x5e31e4['offset']=qs[_0xc64b('0x19')](_0x118452['query']['offset']);}_0x5e31e4['order']=qs[_0xc64b('0x36')](_0x118452[_0xc64b('0x2e')][_0xc64b('0x36')]);_0x5e31e4[_0xc64b('0x37')]=qs['filters'](_[_0xc64b('0x59')](_0x118452['query'],_0x4f0dc8['filters']));_0x5e31e4[_0xc64b('0x37')][_0xc64b('0x54')]=_0x3948b4['id'];if(_0x118452[_0xc64b('0x2e')][_0xc64b('0x38')]){_0x5e31e4[_0xc64b('0x37')]=_[_0xc64b('0x39')](_0x5e31e4[_0xc64b('0x37')],{'$or':_[_0xc64b('0x29')](_0x5e31e4[_0xc64b('0x32')],function(_0x3c4e01){var _0x4999e8={};_0x4999e8[_0x3c4e01]={'$like':'%'+_0x118452[_0xc64b('0x2e')][_0xc64b('0x38')]+'%'};return _0x4999e8;})});}_0x5e31e4=_[_0xc64b('0x39')]({},_0x5e31e4,_0x118452[_0xc64b('0x5a')]);return db[_0xc64b('0x57')]['count']({'where':_0x5e31e4[_0xc64b('0x37')]})[_0xc64b('0x20')](function(_0x39b9e3){_0x7daa67[_0xc64b('0x3c')]=_0x39b9e3;if(_0x118452[_0xc64b('0x2e')][_0xc64b('0x3d')]){_0x5e31e4['include']=[{'all':!![]}];}return db[_0xc64b('0x57')]['findAll'](_0x5e31e4);})[_0xc64b('0x20')](function(_0x55842f){_0x7daa67[_0xc64b('0x3f')]=_0x55842f;return _0x7daa67;});}})[_0xc64b('0x20')](respondWithFilteredResult(_0x1b6dc4,_0x5e31e4))[_0xc64b('0x40')](handleError(_0x1b6dc4,null));};exports[_0xc64b('0x5b')]=function(_0x2f19fb,_0x494098,_0x4dd8ac){var _0x319bb1={'raw':!![],'where':{}};var _0x2676fc={};var _0x204f23={'count':0x0,'rows':[]};return db[_0xc64b('0x3b')][_0xc64b('0x51')]({'where':{'id':_0x2f19fb['params']['id']}})[_0xc64b('0x20')](handleEntityNotFound(_0x494098,null))['then'](function(_0x345f9b){if(_0x345f9b){_0x2676fc[_0xc64b('0x2d')]=_[_0xc64b('0x2f')](db[_0xc64b('0x5c')][_0xc64b('0x4a')]);_0x2676fc['query']=_['keys'](_0x2f19fb[_0xc64b('0x2e')]);_0x2676fc[_0xc64b('0x30')]=_[_0xc64b('0x31')](_0x2676fc[_0xc64b('0x2d')],_0x2676fc[_0xc64b('0x2e')]);_0x319bb1[_0xc64b('0x32')]=_[_0xc64b('0x31')](_0x2676fc['model'],qs[_0xc64b('0x33')](_0x2f19fb[_0xc64b('0x2e')][_0xc64b('0x33')]));_0x319bb1['attributes']=_0x319bb1[_0xc64b('0x32')][_0xc64b('0x34')]?_0x319bb1[_0xc64b('0x32')]:_0x2676fc['model'];if(!_0x2f19fb[_0xc64b('0x2e')]['hasOwnProperty']('nolimit')){_0x319bb1[_0xc64b('0x1b')]=qs[_0xc64b('0x1b')](_0x2f19fb[_0xc64b('0x2e')][_0xc64b('0x1b')]);_0x319bb1[_0xc64b('0x19')]=qs[_0xc64b('0x19')](_0x2f19fb['query']['offset']);}_0x319bb1[_0xc64b('0x35')]=qs[_0xc64b('0x36')](_0x2f19fb[_0xc64b('0x2e')]['sort']);_0x319bb1['where']=qs['filters'](_[_0xc64b('0x59')](_0x2f19fb['query'],_0x2676fc['filters']));_0x319bb1['where']['CampaignId']=_0x345f9b['id'];if(_0x2f19fb[_0xc64b('0x2e')][_0xc64b('0x38')]){_0x319bb1[_0xc64b('0x37')]=_['merge'](_0x319bb1[_0xc64b('0x37')],{'$or':_[_0xc64b('0x29')](_0x319bb1[_0xc64b('0x32')],function(_0xf014df){var _0x5834a0={};_0x5834a0[_0xf014df]={'$like':'%'+_0x2f19fb[_0xc64b('0x2e')][_0xc64b('0x38')]+'%'};return _0x5834a0;})});}_0x319bb1=_[_0xc64b('0x39')]({},_0x319bb1,_0x2f19fb['options']);return db[_0xc64b('0x5c')][_0xc64b('0x3c')]({'where':_0x319bb1[_0xc64b('0x37')]})[_0xc64b('0x20')](function(_0x4358fa){_0x204f23[_0xc64b('0x3c')]=_0x4358fa;if(_0x2f19fb[_0xc64b('0x2e')][_0xc64b('0x3d')]){_0x319bb1[_0xc64b('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xc64b('0x55')](_0x319bb1);})[_0xc64b('0x20')](function(_0x26a5ed){_0x204f23[_0xc64b('0x3f')]=_0x26a5ed;return _0x204f23;});}})[_0xc64b('0x20')](respondWithFilteredResult(_0x494098,_0x319bb1))[_0xc64b('0x40')](handleError(_0x494098,null));};exports[_0xc64b('0x5d')]=function(_0x101a35,_0x5c62bf,_0x3f2082){var _0x1e5c7f={'raw':!![],'where':{}};var _0x25923d={};var _0x4acbfd={'count':0x0,'rows':[]};return db[_0xc64b('0x3b')]['findOne']({'where':{'id':_0x101a35[_0xc64b('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c62bf,null))[_0xc64b('0x20')](function(_0x24daa4){if(_0x24daa4){_0x25923d['model']=_[_0xc64b('0x2f')](db[_0xc64b('0x5e')][_0xc64b('0x4a')]);_0x25923d['query']=_['keys'](_0x101a35[_0xc64b('0x2e')]);_0x25923d[_0xc64b('0x30')]=_[_0xc64b('0x31')](_0x25923d[_0xc64b('0x2d')],_0x25923d[_0xc64b('0x2e')]);_0x1e5c7f[_0xc64b('0x32')]=_[_0xc64b('0x31')](_0x25923d[_0xc64b('0x2d')],qs[_0xc64b('0x33')](_0x101a35[_0xc64b('0x2e')][_0xc64b('0x33')]));_0x1e5c7f[_0xc64b('0x32')]=_0x1e5c7f[_0xc64b('0x32')][_0xc64b('0x34')]?_0x1e5c7f[_0xc64b('0x32')]:_0x25923d['model'];if(!_0x101a35[_0xc64b('0x2e')][_0xc64b('0x58')](_0xc64b('0x53'))){_0x1e5c7f[_0xc64b('0x1b')]=qs[_0xc64b('0x1b')](_0x101a35[_0xc64b('0x2e')][_0xc64b('0x1b')]);_0x1e5c7f[_0xc64b('0x19')]=qs[_0xc64b('0x19')](_0x101a35[_0xc64b('0x2e')]['offset']);}_0x1e5c7f[_0xc64b('0x35')]=qs[_0xc64b('0x36')](_0x101a35[_0xc64b('0x2e')][_0xc64b('0x36')]);_0x1e5c7f[_0xc64b('0x37')]=qs[_0xc64b('0x30')](_[_0xc64b('0x59')](_0x101a35[_0xc64b('0x2e')],_0x25923d['filters']));_0x1e5c7f[_0xc64b('0x37')][_0xc64b('0x54')]=_0x24daa4['id'];if(_0x101a35[_0xc64b('0x2e')]['filter']){_0x1e5c7f[_0xc64b('0x37')]=_[_0xc64b('0x39')](_0x1e5c7f[_0xc64b('0x37')],{'$or':_['map'](_0x1e5c7f[_0xc64b('0x32')],function(_0x23886c){var _0x2de33e={};_0x2de33e[_0x23886c]={'$like':'%'+_0x101a35[_0xc64b('0x2e')][_0xc64b('0x38')]+'%'};return _0x2de33e;})});}_0x1e5c7f=_[_0xc64b('0x39')]({},_0x1e5c7f,_0x101a35[_0xc64b('0x5a')]);return db[_0xc64b('0x5e')][_0xc64b('0x3c')]({'where':_0x1e5c7f[_0xc64b('0x37')]})[_0xc64b('0x20')](function(_0x3e8a0b){_0x4acbfd[_0xc64b('0x3c')]=_0x3e8a0b;if(_0x101a35[_0xc64b('0x2e')]['includeAll']){_0x1e5c7f[_0xc64b('0x3e')]=[{'all':!![]}];}return db[_0xc64b('0x5e')]['findAll'](_0x1e5c7f);})[_0xc64b('0x20')](function(_0x20706c){_0x4acbfd[_0xc64b('0x3f')]=_0x20706c;return _0x4acbfd;});}})[_0xc64b('0x20')](respondWithFilteredResult(_0x5c62bf,_0x1e5c7f))[_0xc64b('0x40')](handleError(_0x5c62bf,null));};exports['getLists']=function(_0x2287ad,_0x3c250e,_0x4e277f){var _0x3e70ed={};var _0x4e1e21={};var _0x3d4d90;var _0xce71ef;return db[_0xc64b('0x3b')][_0xc64b('0x51')]({'where':{'id':_0x2287ad[_0xc64b('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c250e,null))[_0xc64b('0x20')](function(_0x595fa2){if(_0x595fa2){_0x3d4d90=_0x595fa2;_0x4e1e21['model']=_[_0xc64b('0x2f')](db['CmList'][_0xc64b('0x4a')]);_0x4e1e21['query']=_[_0xc64b('0x2f')](_0x2287ad[_0xc64b('0x2e')]);_0x4e1e21[_0xc64b('0x30')]=_[_0xc64b('0x31')](_0x4e1e21[_0xc64b('0x2d')],_0x4e1e21['query']);_0x3e70ed[_0xc64b('0x32')]=_[_0xc64b('0x31')](_0x4e1e21[_0xc64b('0x2d')],qs[_0xc64b('0x33')](_0x2287ad[_0xc64b('0x2e')][_0xc64b('0x33')]));_0x3e70ed[_0xc64b('0x32')]=_0x3e70ed[_0xc64b('0x32')]['length']?_0x3e70ed[_0xc64b('0x32')]:_0x4e1e21[_0xc64b('0x2d')];_0x3e70ed[_0xc64b('0x35')]=qs['sort'](_0x2287ad['query']['sort']);_0x3e70ed[_0xc64b('0x37')]=qs[_0xc64b('0x30')](_['pick'](_0x2287ad['query'],_0x4e1e21[_0xc64b('0x30')]));if(_0x2287ad['query'][_0xc64b('0x38')]){_0x3e70ed[_0xc64b('0x37')]=_[_0xc64b('0x39')](_0x3e70ed[_0xc64b('0x37')],{'$or':_['map'](_0x3e70ed[_0xc64b('0x32')],function(_0x25de89){var _0x7eec02={};_0x7eec02[_0x25de89]={'$like':'%'+_0x2287ad[_0xc64b('0x2e')]['filter']+'%'};return _0x7eec02;})});}_0x3e70ed=_['merge']({},_0x3e70ed,_0x2287ad[_0xc64b('0x5a')]);return _0x3d4d90['getLists'](_0x3e70ed);}})['then'](function(_0x86c03){if(_0x86c03){_0xce71ef=_0x86c03[_0xc64b('0x34')];if(!_0x2287ad['query']['hasOwnProperty'](_0xc64b('0x53'))){_0x3e70ed['limit']=qs[_0xc64b('0x1b')](_0x2287ad[_0xc64b('0x2e')][_0xc64b('0x1b')]);_0x3e70ed[_0xc64b('0x19')]=qs[_0xc64b('0x19')](_0x2287ad[_0xc64b('0x2e')][_0xc64b('0x19')]);}return _0x3d4d90[_0xc64b('0x5f')](_0x3e70ed);}})[_0xc64b('0x20')](function(_0x5c86f6){if(_0x5c86f6){return _0x5c86f6?{'count':_0xce71ef,'rows':_0x5c86f6}:null;}})[_0xc64b('0x20')](respondWithResult(_0x3c250e,null))['catch'](handleError(_0x3c250e,null));};exports[_0xc64b('0x60')]=function(_0x50b02a,_0x21a336,_0x2e2c0b){var _0x4fc490,_0x7ddb24;return db[_0xc64b('0x3b')][_0xc64b('0x4f')]({'where':{'id':_0x50b02a['params']['id']}})['then'](handleEntityNotFound(_0x21a336,null))[_0xc64b('0x20')](function(_0x587d48){if(_0x587d48){_0x7ddb24=_0x587d48;return _0x587d48[_0xc64b('0x60')](_0x50b02a[_0xc64b('0x44')][_0xc64b('0x61')],_[_0xc64b('0x4b')](_0x50b02a[_0xc64b('0x44')],[_0xc64b('0x61'),'id'])||{});}return null;})[_0xc64b('0x62')](function(_0x13790a){var _0x39d858;_0x4fc490=_0x13790a||[];var _0x5ef098=[];if(_0x13790a){for(var _0x594419=0x0;_0x594419<_0x13790a[_0xc64b('0x34')];_0x594419+=0x1){var _0x28b39b=_0x13790a[_0x594419][_0xc64b('0x22')]({'plain':!![]});_0x7ddb24['dialCheckDuplicateType']=_0x50b02a[_0xc64b('0x44')][_0xc64b('0x63')]?_0x50b02a[_0xc64b('0x44')][_0xc64b('0x63')]:_0x7ddb24[_0xc64b('0x63')];switch(_0x7ddb24[_0xc64b('0x63')]){case _0xc64b('0x64'):_0x39d858=squel[_0xc64b('0x65')]()[_0xc64b('0x66')]('cm_hopper')[_0xc64b('0x67')]([_0xc64b('0x68'),'scheduledAt','ContactId',_0xc64b('0x69'),'CampaignId','createdAt',_0xc64b('0x4d')],squel[_0xc64b('0x6a')]()[_0xc64b('0x6b')]('phone',_0xc64b('0x68'))[_0xc64b('0x6b')](_0xc64b('0x6c'),_0xc64b('0x6d'))['field']('id','ContactId')[_0xc64b('0x6b')](_0x28b39b[_0xc64b('0x6e')]['toString'](),'ListId')[_0xc64b('0x6b')](_0x50b02a[_0xc64b('0x42')]['id'][_0xc64b('0x6f')](),_0xc64b('0x54'))['field'](_0xc64b('0x6c'),_0xc64b('0x4c'))[_0xc64b('0x6b')](_0xc64b('0x6c'),_0xc64b('0x4d'))[_0xc64b('0x70')](_0xc64b('0x71'))['where'](_0xc64b('0x72'))[_0xc64b('0x37')](_0xc64b('0x73'),_0x28b39b[_0xc64b('0x6e')][_0xc64b('0x6f')]())[_0xc64b('0x37')](_0xc64b('0x74'))[_0xc64b('0x37')](_0xc64b('0x75'),squel[_0xc64b('0x6a')]()[_0xc64b('0x6b')]('COALESCE(calleridnum,\x27\x27)')[_0xc64b('0x70')](_0xc64b('0x76'))['where'](_0xc64b('0x77'),_0x50b02a['params']['id']['toString']()))[_0xc64b('0x37')](_0xc64b('0x75'),squel[_0xc64b('0x6a')]()['field'](_0xc64b('0x78'))[_0xc64b('0x70')](_0xc64b('0x79'))[_0xc64b('0x37')]('CampaignId\x20=\x20?',_0x50b02a[_0xc64b('0x42')]['id'][_0xc64b('0x6f')]())))['toString']();break;case _0xc64b('0x7a'):_0x39d858=squel[_0xc64b('0x65')]()['into'](_0xc64b('0x79'))[_0xc64b('0x67')]([_0xc64b('0x68'),_0xc64b('0x6d'),_0xc64b('0x7b'),_0xc64b('0x69'),'CampaignId',_0xc64b('0x4c'),_0xc64b('0x4d')],squel[_0xc64b('0x6a')]()[_0xc64b('0x6b')](_0xc64b('0x68'),_0xc64b('0x68'))[_0xc64b('0x6b')](_0xc64b('0x6c'),'scheduledAt')[_0xc64b('0x6b')]('id',_0xc64b('0x7b'))[_0xc64b('0x6b')](_0x28b39b['CmListId'][_0xc64b('0x6f')](),_0xc64b('0x69'))[_0xc64b('0x6b')](_0x50b02a[_0xc64b('0x42')]['id'][_0xc64b('0x6f')](),_0xc64b('0x54'))['field'](_0xc64b('0x6c'),_0xc64b('0x4c'))['field'](_0xc64b('0x6c'),_0xc64b('0x4d'))[_0xc64b('0x70')](_0xc64b('0x71'))[_0xc64b('0x37')](_0xc64b('0x72'))['where'](_0xc64b('0x73'),_0x28b39b[_0xc64b('0x6e')]['toString']())[_0xc64b('0x37')](_0xc64b('0x74'))[_0xc64b('0x37')](_0xc64b('0x75'),squel[_0xc64b('0x6a')]()['field'](_0xc64b('0x78'))['from'](_0xc64b('0x79'))[_0xc64b('0x37')]('CampaignId\x20=\x20?',_0x50b02a[_0xc64b('0x42')]['id'][_0xc64b('0x6f')]())))[_0xc64b('0x6f')]();break;default:_0x39d858=squel['insert']()[_0xc64b('0x66')](_0xc64b('0x79'))['fromQuery'](['phone','scheduledAt',_0xc64b('0x7b'),_0xc64b('0x69'),_0xc64b('0x54'),_0xc64b('0x4c'),'updatedAt'],squel[_0xc64b('0x6a')]()[_0xc64b('0x6b')](_0xc64b('0x68'),'phone')[_0xc64b('0x6b')](_0xc64b('0x6c'),_0xc64b('0x6d'))[_0xc64b('0x6b')]('id','ContactId')[_0xc64b('0x6b')](_0x28b39b[_0xc64b('0x6e')][_0xc64b('0x6f')](),_0xc64b('0x69'))[_0xc64b('0x6b')](_0x50b02a['params']['id'][_0xc64b('0x6f')](),_0xc64b('0x54'))[_0xc64b('0x6b')](_0xc64b('0x6c'),_0xc64b('0x4c'))[_0xc64b('0x6b')](_0xc64b('0x6c'),_0xc64b('0x4d'))[_0xc64b('0x70')](_0xc64b('0x71'))['where'](_0xc64b('0x72'))[_0xc64b('0x37')](_0xc64b('0x73'),_0x28b39b[_0xc64b('0x6e')][_0xc64b('0x6f')]())[_0xc64b('0x37')]('phone\x20IS\x20NOT\x20NULL'))[_0xc64b('0x6f')]();}_0x5ef098[_0xc64b('0x7c')](db[_0xc64b('0x7d')][_0xc64b('0x2e')](_0x39d858));}return BPromise['all'](_0x5ef098);}})['then'](function(){return _0x4fc490;})[_0xc64b('0x20')](respondWithResult(_0x21a336,null))[_0xc64b('0x40')](handleError(_0x21a336,null));};exports[_0xc64b('0x7e')]=function(_0x1596b3,_0x53e6a9,_0x51226d){return db[_0xc64b('0x3b')][_0xc64b('0x4f')]({'where':{'id':_0x1596b3[_0xc64b('0x42')]['id']}})[_0xc64b('0x20')](handleEntityNotFound(_0x53e6a9,null))[_0xc64b('0x20')](function(_0x2d8a00){if(_0x2d8a00){return _0x2d8a00[_0xc64b('0x7e')](_0x1596b3[_0xc64b('0x2e')][_0xc64b('0x61')]);}})[_0xc64b('0x20')](function(_0x1bff7a){if(_0x1bff7a){return db[_0xc64b('0x52')][_0xc64b('0x21')]({'where':{'ListId':_0x1596b3[_0xc64b('0x2e')][_0xc64b('0x61')],'CampaignId':_0x1596b3['params']['id']}})[_0xc64b('0x20')](function(){return _0x1bff7a;});}})[_0xc64b('0x20')](respondWithStatusCode(_0x53e6a9,null))[_0xc64b('0x40')](handleError(_0x53e6a9,null));};exports['getBlackLists']=function(_0x186c08,_0x18f771,_0x14ee9d){var _0x101f21={};var _0x3246ad={};var _0x4da85a;var _0x32b8dd;return db[_0xc64b('0x3b')][_0xc64b('0x51')]({'where':{'id':_0x186c08[_0xc64b('0x42')]['id']}})[_0xc64b('0x20')](handleEntityNotFound(_0x18f771,null))['then'](function(_0x53cbb0){if(_0x53cbb0){_0x4da85a=_0x53cbb0;_0x3246ad['model']=_[_0xc64b('0x2f')](db[_0xc64b('0x7f')][_0xc64b('0x4a')]);_0x3246ad[_0xc64b('0x2e')]=_['keys'](_0x186c08[_0xc64b('0x2e')]);_0x3246ad[_0xc64b('0x30')]=_[_0xc64b('0x31')](_0x3246ad['model'],_0x3246ad[_0xc64b('0x2e')]);_0x101f21[_0xc64b('0x32')]=_[_0xc64b('0x31')](_0x3246ad[_0xc64b('0x2d')],qs['fields'](_0x186c08['query'][_0xc64b('0x33')]));_0x101f21[_0xc64b('0x32')]=_0x101f21[_0xc64b('0x32')][_0xc64b('0x34')]?_0x101f21[_0xc64b('0x32')]:_0x3246ad['model'];_0x101f21['order']=qs[_0xc64b('0x36')](_0x186c08[_0xc64b('0x2e')][_0xc64b('0x36')]);_0x101f21[_0xc64b('0x37')]=qs['filters'](_[_0xc64b('0x59')](_0x186c08['query'],_0x3246ad[_0xc64b('0x30')]));if(_0x186c08['query'][_0xc64b('0x38')]){_0x101f21[_0xc64b('0x37')]=_[_0xc64b('0x39')](_0x101f21[_0xc64b('0x37')],{'$or':_['map'](_0x101f21['attributes'],function(_0x4b1a1c){var _0xb3536a={};_0xb3536a[_0x4b1a1c]={'$like':'%'+_0x186c08['query'][_0xc64b('0x38')]+'%'};return _0xb3536a;})});}_0x101f21=_[_0xc64b('0x39')]({},_0x101f21,_0x186c08['options']);return _0x4da85a[_0xc64b('0x80')](_0x101f21);}})['then'](function(_0x302d02){if(_0x302d02){_0x32b8dd=_0x302d02[_0xc64b('0x34')];if(!_0x186c08['query']['hasOwnProperty']('nolimit')){_0x101f21[_0xc64b('0x1b')]=qs[_0xc64b('0x1b')](_0x186c08['query'][_0xc64b('0x1b')]);_0x101f21[_0xc64b('0x19')]=qs['offset'](_0x186c08['query'][_0xc64b('0x19')]);}return _0x4da85a[_0xc64b('0x80')](_0x101f21);}})[_0xc64b('0x20')](function(_0x3f0a57){if(_0x3f0a57){return _0x3f0a57?{'count':_0x32b8dd,'rows':_0x3f0a57}:null;}})['then'](respondWithResult(_0x18f771,null))[_0xc64b('0x40')](handleError(_0x18f771,null));};exports[_0xc64b('0x81')]=function(_0x1e0b10,_0x50e292,_0x352d89){var _0x38cd46,_0x20fab9;return db[_0xc64b('0x3b')]['find']({'where':{'id':_0x1e0b10['params']['id']}})[_0xc64b('0x20')](handleEntityNotFound(_0x50e292,null))['then'](function(_0x298f73){if(_0x298f73){_0x20fab9=_0x298f73;return _0x298f73[_0xc64b('0x81')](_0x1e0b10[_0xc64b('0x44')]['ids'],_[_0xc64b('0x4b')](_0x1e0b10[_0xc64b('0x44')],[_0xc64b('0x61'),'id'])||{});}return null;})[_0xc64b('0x62')](function(_0x1464e1){var _0x4ebf62;_0x38cd46=_0x1464e1||[];var _0x30ef09=[];if(_0x1464e1){for(var _0x219c85=0x0;_0x219c85<_0x1464e1[_0xc64b('0x34')];_0x219c85+=0x1){var _0x57ec6b=_0x1464e1[_0x219c85][_0xc64b('0x22')]({'plain':!![]});_0x4ebf62=squel[_0xc64b('0x65')]()[_0xc64b('0x66')](_0xc64b('0x82'))[_0xc64b('0x67')](['phone',_0xc64b('0x7b'),'ListId','CampaignId',_0xc64b('0x4c'),_0xc64b('0x4d')],squel['select']()['field'](_0xc64b('0x68'),_0xc64b('0x68'))[_0xc64b('0x6b')]('id',_0xc64b('0x7b'))[_0xc64b('0x6b')](_0x57ec6b[_0xc64b('0x6e')][_0xc64b('0x6f')](),_0xc64b('0x69'))['field'](_0x1e0b10[_0xc64b('0x42')]['id']['toString'](),_0xc64b('0x54'))[_0xc64b('0x6b')]('NOW()',_0xc64b('0x4c'))[_0xc64b('0x6b')]('NOW()','updatedAt')[_0xc64b('0x70')](_0xc64b('0x71'))[_0xc64b('0x37')](_0xc64b('0x72'))['where'](_0xc64b('0x73'),_0x57ec6b[_0xc64b('0x6e')]['toString']())[_0xc64b('0x37')](_0xc64b('0x74')))['toString']();_0x30ef09[_0xc64b('0x7c')](db['sequelize'][_0xc64b('0x2e')](_0x4ebf62));}return BPromise[_0xc64b('0x83')](_0x30ef09);}})['then'](function(){return _0x38cd46;})[_0xc64b('0x20')](respondWithResult(_0x50e292,null))[_0xc64b('0x40')](handleError(_0x50e292,null));};exports[_0xc64b('0x84')]=function(_0xcc8c23,_0x513594,_0x52829f){return db['Campaign'][_0xc64b('0x4f')]({'where':{'id':_0xcc8c23[_0xc64b('0x42')]['id']}})[_0xc64b('0x20')](handleEntityNotFound(_0x513594,null))[_0xc64b('0x20')](function(_0xe4d340){if(_0xe4d340){return _0xe4d340['removeBlackLists'](_0xcc8c23[_0xc64b('0x2e')][_0xc64b('0x61')]);}})['then'](function(_0x468586){if(_0x468586){return db['CmHopperBlack'][_0xc64b('0x21')]({'where':{'ListId':_0xcc8c23['query'][_0xc64b('0x61')],'CampaignId':_0xcc8c23[_0xc64b('0x42')]['id']}})[_0xc64b('0x20')](function(){return _0x468586;});}})[_0xc64b('0x20')](respondWithStatusCode(_0x513594,null))[_0xc64b('0x40')](handleError(_0x513594,null));}; \ No newline at end of file +var _0xc2b6=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','error','stack','name','send','index','map','rawAttributes','fieldName','query','keys','filters','model','attributes','fields','length','order','sort','where','pick','filter','type','VIRTUAL','merge','options','Campaign','includeAll','findAll','rows','catch','show','params','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','body','findOne','CmHopper','hasOwnProperty','nolimit','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ContactId','select','field','NOW()','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','scheduledAt','CmListId','ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','fs-extra'];(function(_0x28752d,_0x2283ee){var _0x49bf3b=function(_0x321ea1){while(--_0x321ea1){_0x28752d['push'](_0x28752d['shift']());}};_0x49bf3b(++_0x2283ee);}(_0xc2b6,0x186));var _0x6c2b=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xc2b6[_0x38a7ac];return _0x53061a;};'use strict';var emlformat=require(_0x6c2b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6c2b('0x1'));var jsonpatch=require(_0x6c2b('0x2'));var rp=require(_0x6c2b('0x3'));var moment=require(_0x6c2b('0x4'));var BPromise=require(_0x6c2b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6c2b('0x6'));var sox=require('sox');var csv=require(_0x6c2b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c2b('0x8'));var _=require(_0x6c2b('0x9'));var squel=require(_0x6c2b('0xa'));var crypto=require(_0x6c2b('0xb'));var jsforce=require(_0x6c2b('0xc'));var deskjs=require(_0x6c2b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6c2b('0xe'));var Papa=require(_0x6c2b('0xf'));var Redis=require(_0x6c2b('0x10'));var authService=require(_0x6c2b('0x11'));var qs=require(_0x6c2b('0x12'));var as=require(_0x6c2b('0x13'));var hardwareService=require(_0x6c2b('0x14'));var logger=require(_0x6c2b('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6c2b('0x16'));var db=require(_0x6c2b('0x17'))['db'];function respondWithStatusCode(_0x97f8d5,_0x1e5472){_0x1e5472=_0x1e5472||0xcc;return function(_0x515236){if(_0x515236){return _0x97f8d5[_0x6c2b('0x18')](_0x1e5472);}return _0x97f8d5[_0x6c2b('0x19')](_0x1e5472)[_0x6c2b('0x1a')]();};}function respondWithResult(_0x2c60cf,_0x3d551d){_0x3d551d=_0x3d551d||0xc8;return function(_0x575e7b){if(_0x575e7b){return _0x2c60cf['status'](_0x3d551d)[_0x6c2b('0x1b')](_0x575e7b);}};}function respondWithFilteredResult(_0x48da41,_0x268be2){return function(_0x6fbbea){if(_0x6fbbea){var _0x4e93de=typeof _0x268be2[_0x6c2b('0x1c')]===_0x6c2b('0x1d')&&typeof _0x268be2[_0x6c2b('0x1e')]===_0x6c2b('0x1d');var _0x2b5999=_0x6fbbea[_0x6c2b('0x1f')];var _0x5040a8=_0x4e93de?0x0:_0x268be2[_0x6c2b('0x1c')];var _0x5da44a=_0x4e93de?_0x6fbbea['count']:_0x268be2[_0x6c2b('0x1c')]+_0x268be2['limit'];var _0x171f23;if(_0x5da44a>=_0x2b5999){_0x5da44a=_0x2b5999;_0x171f23=0xc8;}else{_0x171f23=0xce;}_0x48da41[_0x6c2b('0x19')](_0x171f23);return _0x48da41[_0x6c2b('0x20')](_0x6c2b('0x21'),_0x5040a8+'-'+_0x5da44a+'/'+_0x2b5999)[_0x6c2b('0x1b')](_0x6fbbea);}return null;};}function patchUpdates(_0x2efd52){return function(_0x355627){try{jsonpatch['apply'](_0x355627,_0x2efd52,!![]);}catch(_0x2ebf93){return BPromise['reject'](_0x2ebf93);}return _0x355627['save']();};}function saveUpdates(_0x336275,_0x401788){return function(_0x4ea7c6){if(_0x4ea7c6){return _0x4ea7c6[_0x6c2b('0x22')](_0x336275)[_0x6c2b('0x23')](function(_0x372225){return _0x372225;});}return null;};}function removeEntity(_0x5c9885,_0x380da0){return function(_0x44379c){if(_0x44379c){return _0x44379c[_0x6c2b('0x24')]()[_0x6c2b('0x23')](function(){var _0x3225f7=_0x44379c[_0x6c2b('0x25')]({'plain':!![]});var _0x372165='IvrCampaigns';return db['UserProfileResource'][_0x6c2b('0x24')]({'where':{'type':_0x372165,'resourceId':_0x3225f7['id']}})[_0x6c2b('0x23')](function(){return _0x44379c;});})[_0x6c2b('0x23')](function(){_0x5c9885['status'](0xcc)[_0x6c2b('0x1a')]();});}};}function handleEntityNotFound(_0x4d5ca6,_0x144544){return function(_0x42f4a6){if(!_0x42f4a6){_0x4d5ca6[_0x6c2b('0x18')](0x194);}return _0x42f4a6;};}function handleError(_0x239810,_0xb8eedd){_0xb8eedd=_0xb8eedd||0x1f4;return function(_0x1a4e55){logger[_0x6c2b('0x26')](_0x1a4e55[_0x6c2b('0x27')]);if(_0x1a4e55[_0x6c2b('0x28')]){delete _0x1a4e55['name'];}_0x239810[_0x6c2b('0x19')](_0xb8eedd)[_0x6c2b('0x29')](_0x1a4e55);};}exports[_0x6c2b('0x2a')]=function(_0x5be6f5,_0x31573e){var _0x270fee={},_0xd13b60={},_0x2c26eb={'count':0x0,'rows':[]};var _0x11ab0b=_[_0x6c2b('0x2b')](db['Campaign'][_0x6c2b('0x2c')],function(_0x436ef5){return{'name':_0x436ef5[_0x6c2b('0x2d')],'type':_0x436ef5['type']['key']};});_0xd13b60['model']=_[_0x6c2b('0x2b')](_0x11ab0b,_0x6c2b('0x28'));_0xd13b60[_0x6c2b('0x2e')]=_[_0x6c2b('0x2f')](_0x5be6f5[_0x6c2b('0x2e')]);_0xd13b60[_0x6c2b('0x30')]=_['intersection'](_0xd13b60[_0x6c2b('0x31')],_0xd13b60[_0x6c2b('0x2e')]);_0x270fee[_0x6c2b('0x32')]=_['intersection'](_0xd13b60[_0x6c2b('0x31')],qs['fields'](_0x5be6f5[_0x6c2b('0x2e')][_0x6c2b('0x33')]));_0x270fee[_0x6c2b('0x32')]=_0x270fee['attributes'][_0x6c2b('0x34')]?_0x270fee[_0x6c2b('0x32')]:_0xd13b60[_0x6c2b('0x31')];if(!_0x5be6f5['query']['hasOwnProperty']('nolimit')){_0x270fee[_0x6c2b('0x1e')]=qs['limit'](_0x5be6f5[_0x6c2b('0x2e')][_0x6c2b('0x1e')]);_0x270fee[_0x6c2b('0x1c')]=qs[_0x6c2b('0x1c')](_0x5be6f5[_0x6c2b('0x2e')][_0x6c2b('0x1c')]);}_0x270fee[_0x6c2b('0x35')]=qs['sort'](_0x5be6f5[_0x6c2b('0x2e')][_0x6c2b('0x36')]);_0x270fee[_0x6c2b('0x37')]=qs[_0x6c2b('0x30')](_[_0x6c2b('0x38')](_0x5be6f5[_0x6c2b('0x2e')],_0xd13b60[_0x6c2b('0x30')]),_0x11ab0b);if(_0x5be6f5['query'][_0x6c2b('0x39')]){_0x270fee[_0x6c2b('0x37')]=_['merge'](_0x270fee[_0x6c2b('0x37')],{'$or':_[_0x6c2b('0x2b')](_0x11ab0b,function(_0x4dd0c1){if(_0x4dd0c1[_0x6c2b('0x3a')]!==_0x6c2b('0x3b')){var _0x2e8791={};_0x2e8791[_0x4dd0c1[_0x6c2b('0x28')]]={'$like':'%'+_0x5be6f5[_0x6c2b('0x2e')][_0x6c2b('0x39')]+'%'};return _0x2e8791;}})});}_0x270fee=_[_0x6c2b('0x3c')]({},_0x270fee,_0x5be6f5[_0x6c2b('0x3d')]);var _0xa7bf2b={'where':_0x270fee[_0x6c2b('0x37')]};return db[_0x6c2b('0x3e')]['count'](_0xa7bf2b)[_0x6c2b('0x23')](function(_0x2eafa8){_0x2c26eb[_0x6c2b('0x1f')]=_0x2eafa8;if(_0x5be6f5[_0x6c2b('0x2e')][_0x6c2b('0x3f')]){_0x270fee['include']=[{'all':!![]}];}return db[_0x6c2b('0x3e')][_0x6c2b('0x40')](_0x270fee);})['then'](function(_0xc9a6dc){_0x2c26eb[_0x6c2b('0x41')]=_0xc9a6dc;return _0x2c26eb;})[_0x6c2b('0x23')](respondWithFilteredResult(_0x31573e,_0x270fee))[_0x6c2b('0x42')](handleError(_0x31573e,null));};exports[_0x6c2b('0x43')]=function(_0x4138b9,_0x1eb15a){var _0x5a05d6={'raw':![],'where':{'id':_0x4138b9[_0x6c2b('0x44')]['id']}},_0x7e1fb0={};_0x7e1fb0['model']=_['keys'](db['Campaign'][_0x6c2b('0x2c')]);_0x7e1fb0[_0x6c2b('0x2e')]=_[_0x6c2b('0x2f')](_0x4138b9[_0x6c2b('0x2e')]);_0x7e1fb0[_0x6c2b('0x30')]=_[_0x6c2b('0x45')](_0x7e1fb0[_0x6c2b('0x31')],_0x7e1fb0[_0x6c2b('0x2e')]);_0x5a05d6[_0x6c2b('0x32')]=_['intersection'](_0x7e1fb0['model'],qs[_0x6c2b('0x33')](_0x4138b9[_0x6c2b('0x2e')][_0x6c2b('0x33')]));_0x5a05d6[_0x6c2b('0x32')]=_0x5a05d6['attributes']['length']?_0x5a05d6[_0x6c2b('0x32')]:_0x7e1fb0[_0x6c2b('0x31')];if(_0x4138b9['query'][_0x6c2b('0x3f')]){_0x5a05d6['include']=[{'all':!![]}];}_0x5a05d6=_['merge']({},_0x5a05d6,_0x4138b9[_0x6c2b('0x3d')]);return db[_0x6c2b('0x3e')][_0x6c2b('0x46')](_0x5a05d6)['then'](handleEntityNotFound(_0x1eb15a,null))[_0x6c2b('0x23')](respondWithResult(_0x1eb15a,null))[_0x6c2b('0x42')](handleError(_0x1eb15a,null));};exports[_0x6c2b('0x47')]=function(_0x2b6fdd,_0x323f54){return db[_0x6c2b('0x3e')][_0x6c2b('0x47')](_0x2b6fdd['body'],{})[_0x6c2b('0x23')](function(_0x3500a1){var _0x217430=_0x2b6fdd[_0x6c2b('0x48')][_0x6c2b('0x25')]({'plain':!![]});if(!_0x217430)throw new Error(_0x6c2b('0x49'));if(_0x217430[_0x6c2b('0x4a')]===_0x6c2b('0x48')){var _0x1ed517=_0x3500a1['get']({'plain':!![]});var _0x191deb=_0x6c2b('0x4b');return db[_0x6c2b('0x4c')][_0x6c2b('0x46')]({'where':{'name':_0x191deb,'userProfileId':_0x217430[_0x6c2b('0x4d')]},'raw':!![]})[_0x6c2b('0x23')](function(_0x404a81){if(_0x404a81&&_0x404a81[_0x6c2b('0x4e')]===0x0){return db[_0x6c2b('0x4f')]['create']({'name':_0x1ed517['name'],'resourceId':_0x1ed517['id'],'type':_0x404a81[_0x6c2b('0x28')],'sectionId':_0x404a81['id']},{})[_0x6c2b('0x23')](function(){return _0x3500a1;});}else{return _0x3500a1;}})[_0x6c2b('0x42')](function(_0x4ab33d){logger[_0x6c2b('0x26')](_0x6c2b('0x50'),_0x4ab33d);throw _0x4ab33d;});}return _0x3500a1;})['then'](respondWithResult(_0x323f54,0xc9))[_0x6c2b('0x42')](handleError(_0x323f54,null));};exports[_0x6c2b('0x51')]=function(_0x3c56b0,_0x9fa9aa){var _0x92a9ff={'where':{'id':_0x3c56b0[_0x6c2b('0x44')]['id']}},_0x5ef37f={};_0x5ef37f['model']=_['keys'](db['Campaign'][_0x6c2b('0x2c')]);_0x92a9ff[_0x6c2b('0x32')]=_['intersection'](_0x5ef37f['model'],qs[_0x6c2b('0x33')](_0x3c56b0[_0x6c2b('0x2e')][_0x6c2b('0x33')]));_0x92a9ff[_0x6c2b('0x32')]=_0x92a9ff[_0x6c2b('0x32')][_0x6c2b('0x34')]?_0x92a9ff['attributes']:_0x5ef37f[_0x6c2b('0x31')];if(_0x3c56b0[_0x6c2b('0x2e')][_0x6c2b('0x3f')]){_0x92a9ff[_0x6c2b('0x52')]=[{'all':!![]}];}_0x92a9ff=_['merge']({},_0x92a9ff,_0x3c56b0[_0x6c2b('0x3d')]);return db['Campaign'][_0x6c2b('0x46')](_0x92a9ff)[_0x6c2b('0x23')](handleEntityNotFound(_0x9fa9aa,null))['then'](function(_0x288ff7){if(_0x288ff7){var _0x51330d=_0x288ff7[_0x6c2b('0x25')]({'plain':!![]});_0x51330d=qs[_0x6c2b('0x53')](_0x51330d,['id',_0x6c2b('0x54'),_0x6c2b('0x55')]);_0x3c56b0[_0x6c2b('0x56')]=_[_0x6c2b('0x53')](_0x3c56b0[_0x6c2b('0x56')],['id',_0x6c2b('0x54'),_0x6c2b('0x55')]);return db['Campaign'][_0x6c2b('0x47')](_[_0x6c2b('0x3c')](_0x51330d,_0x3c56b0['body']),{'include':_0x3c56b0['query']['includeAll']?[{'all':!![]}]:undefined})[_0x6c2b('0x23')](function(_0x41b742){var _0x520753=_0x3c56b0[_0x6c2b('0x48')][_0x6c2b('0x25')]({'plain':!![]});if(!_0x520753)throw new Error(_0x6c2b('0x49'));if(_0x520753[_0x6c2b('0x4a')]===_0x6c2b('0x48')){var _0x838678=_0x41b742['get']({'plain':!![]});var _0x235d2a=_0x6c2b('0x4b');return db[_0x6c2b('0x4c')][_0x6c2b('0x46')]({'where':{'name':_0x235d2a,'userProfileId':_0x520753[_0x6c2b('0x4d')]},'raw':!![]})[_0x6c2b('0x23')](function(_0x474efa){if(_0x474efa&&_0x474efa[_0x6c2b('0x4e')]===0x0){return db[_0x6c2b('0x4f')]['create']({'name':_0x838678[_0x6c2b('0x28')],'resourceId':_0x838678['id'],'type':_0x474efa[_0x6c2b('0x28')],'sectionId':_0x474efa['id']},{})[_0x6c2b('0x23')](function(){return _0x41b742;});}else{return _0x41b742;}})[_0x6c2b('0x42')](function(_0x55100b){logger[_0x6c2b('0x26')](_0x6c2b('0x50'),_0x55100b);throw _0x55100b;});}return _0x41b742;});}})['then'](respondWithResult(_0x9fa9aa,0xc9))[_0x6c2b('0x42')](handleError(_0x9fa9aa,null));};exports[_0x6c2b('0x22')]=function(_0x39bc7c,_0x282aca){if(_0x39bc7c['body']['id']){delete _0x39bc7c['body']['id'];}return db[_0x6c2b('0x3e')][_0x6c2b('0x46')]({'where':{'id':_0x39bc7c[_0x6c2b('0x44')]['id']}})[_0x6c2b('0x23')](handleEntityNotFound(_0x282aca,null))['then'](saveUpdates(_0x39bc7c['body'],null))[_0x6c2b('0x23')](respondWithResult(_0x282aca,null))[_0x6c2b('0x42')](handleError(_0x282aca,null));};exports[_0x6c2b('0x24')]=function(_0x5e4f2a,_0x59ca61){return db[_0x6c2b('0x3e')][_0x6c2b('0x46')]({'where':{'id':_0x5e4f2a['params']['id']}})['then'](handleEntityNotFound(_0x59ca61,null))[_0x6c2b('0x23')](removeEntity(_0x59ca61,null))[_0x6c2b('0x42')](handleError(_0x59ca61,null));};exports['getHoppers']=function(_0x1d5ecf,_0x4ffca3,_0x12435c){var _0x4fb2e1={'raw':!![],'where':{}};var _0x176b03={};var _0x1797bb={'count':0x0,'rows':[]};return db[_0x6c2b('0x3e')][_0x6c2b('0x57')]({'where':{'id':_0x1d5ecf[_0x6c2b('0x44')]['id']}})[_0x6c2b('0x23')](handleEntityNotFound(_0x4ffca3,null))['then'](function(_0x4936b7){if(_0x4936b7){_0x176b03[_0x6c2b('0x31')]=_[_0x6c2b('0x2f')](db[_0x6c2b('0x58')][_0x6c2b('0x2c')]);_0x176b03[_0x6c2b('0x2e')]=_[_0x6c2b('0x2f')](_0x1d5ecf[_0x6c2b('0x2e')]);_0x176b03[_0x6c2b('0x30')]=_['intersection'](_0x176b03[_0x6c2b('0x31')],_0x176b03[_0x6c2b('0x2e')]);_0x4fb2e1[_0x6c2b('0x32')]=_['intersection'](_0x176b03['model'],qs[_0x6c2b('0x33')](_0x1d5ecf['query'][_0x6c2b('0x33')]));_0x4fb2e1[_0x6c2b('0x32')]=_0x4fb2e1[_0x6c2b('0x32')][_0x6c2b('0x34')]?_0x4fb2e1[_0x6c2b('0x32')]:_0x176b03['model'];if(!_0x1d5ecf[_0x6c2b('0x2e')][_0x6c2b('0x59')](_0x6c2b('0x5a'))){_0x4fb2e1[_0x6c2b('0x1e')]=qs['limit'](_0x1d5ecf[_0x6c2b('0x2e')]['limit']);_0x4fb2e1[_0x6c2b('0x1c')]=qs[_0x6c2b('0x1c')](_0x1d5ecf[_0x6c2b('0x2e')]['offset']);}_0x4fb2e1['order']=qs[_0x6c2b('0x36')](_0x1d5ecf['query'][_0x6c2b('0x36')]);_0x4fb2e1[_0x6c2b('0x37')]=qs[_0x6c2b('0x30')](_[_0x6c2b('0x38')](_0x1d5ecf[_0x6c2b('0x2e')],_0x176b03[_0x6c2b('0x30')]));_0x4fb2e1[_0x6c2b('0x37')]['CampaignId']=_0x4936b7['id'];if(_0x1d5ecf['query']['filter']){_0x4fb2e1[_0x6c2b('0x37')]=_['merge'](_0x4fb2e1[_0x6c2b('0x37')],{'$or':_['map'](_0x4fb2e1[_0x6c2b('0x32')],function(_0x4058be){var _0x5cf3a6={};_0x5cf3a6[_0x4058be]={'$like':'%'+_0x1d5ecf[_0x6c2b('0x2e')][_0x6c2b('0x39')]+'%'};return _0x5cf3a6;})});}_0x4fb2e1=_[_0x6c2b('0x3c')]({},_0x4fb2e1,_0x1d5ecf[_0x6c2b('0x3d')]);return db[_0x6c2b('0x58')][_0x6c2b('0x1f')]({'where':_0x4fb2e1['where']})[_0x6c2b('0x23')](function(_0x19d8cb){_0x1797bb[_0x6c2b('0x1f')]=_0x19d8cb;if(_0x1d5ecf[_0x6c2b('0x2e')][_0x6c2b('0x3f')]){_0x4fb2e1['include']=[{'all':!![]}];}return db[_0x6c2b('0x58')][_0x6c2b('0x40')](_0x4fb2e1);})[_0x6c2b('0x23')](function(_0xaeeeae){_0x1797bb[_0x6c2b('0x41')]=_0xaeeeae;return _0x1797bb;});}})[_0x6c2b('0x23')](respondWithFilteredResult(_0x4ffca3,_0x4fb2e1))[_0x6c2b('0x42')](handleError(_0x4ffca3,null));};exports['getHopperHistories']=function(_0x53f35e,_0x5b9f91,_0xbf9549){var _0x4b5441={'raw':!![],'where':{}};var _0x3e0935={};var _0x52fffe={'count':0x0,'rows':[]};return db[_0x6c2b('0x3e')]['findOne']({'where':{'id':_0x53f35e[_0x6c2b('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b9f91,null))['then'](function(_0x2fa202){if(_0x2fa202){_0x3e0935['model']=_['keys'](db[_0x6c2b('0x5b')][_0x6c2b('0x2c')]);_0x3e0935[_0x6c2b('0x2e')]=_[_0x6c2b('0x2f')](_0x53f35e['query']);_0x3e0935[_0x6c2b('0x30')]=_[_0x6c2b('0x45')](_0x3e0935[_0x6c2b('0x31')],_0x3e0935[_0x6c2b('0x2e')]);_0x4b5441[_0x6c2b('0x32')]=_[_0x6c2b('0x45')](_0x3e0935[_0x6c2b('0x31')],qs['fields'](_0x53f35e['query'][_0x6c2b('0x33')]));_0x4b5441[_0x6c2b('0x32')]=_0x4b5441[_0x6c2b('0x32')][_0x6c2b('0x34')]?_0x4b5441[_0x6c2b('0x32')]:_0x3e0935[_0x6c2b('0x31')];if(!_0x53f35e['query'][_0x6c2b('0x59')](_0x6c2b('0x5a'))){_0x4b5441['limit']=qs[_0x6c2b('0x1e')](_0x53f35e[_0x6c2b('0x2e')]['limit']);_0x4b5441[_0x6c2b('0x1c')]=qs[_0x6c2b('0x1c')](_0x53f35e[_0x6c2b('0x2e')][_0x6c2b('0x1c')]);}_0x4b5441[_0x6c2b('0x35')]=qs['sort'](_0x53f35e[_0x6c2b('0x2e')][_0x6c2b('0x36')]);_0x4b5441[_0x6c2b('0x37')]=qs[_0x6c2b('0x30')](_[_0x6c2b('0x38')](_0x53f35e[_0x6c2b('0x2e')],_0x3e0935[_0x6c2b('0x30')]));_0x4b5441[_0x6c2b('0x37')][_0x6c2b('0x5c')]=_0x2fa202['id'];if(_0x53f35e['query']['filter']){_0x4b5441['where']=_[_0x6c2b('0x3c')](_0x4b5441[_0x6c2b('0x37')],{'$or':_[_0x6c2b('0x2b')](_0x4b5441[_0x6c2b('0x32')],function(_0x14c630){var _0x5d45f0={};_0x5d45f0[_0x14c630]={'$like':'%'+_0x53f35e[_0x6c2b('0x2e')][_0x6c2b('0x39')]+'%'};return _0x5d45f0;})});}_0x4b5441=_[_0x6c2b('0x3c')]({},_0x4b5441,_0x53f35e[_0x6c2b('0x3d')]);return db[_0x6c2b('0x5b')][_0x6c2b('0x1f')]({'where':_0x4b5441[_0x6c2b('0x37')]})[_0x6c2b('0x23')](function(_0x4e50ee){_0x52fffe[_0x6c2b('0x1f')]=_0x4e50ee;if(_0x53f35e[_0x6c2b('0x2e')][_0x6c2b('0x3f')]){_0x4b5441[_0x6c2b('0x52')]=[{'all':!![]}];}return db[_0x6c2b('0x5b')][_0x6c2b('0x40')](_0x4b5441);})[_0x6c2b('0x23')](function(_0x217249){_0x52fffe[_0x6c2b('0x41')]=_0x217249;return _0x52fffe;});}})[_0x6c2b('0x23')](respondWithFilteredResult(_0x5b9f91,_0x4b5441))[_0x6c2b('0x42')](handleError(_0x5b9f91,null));};exports[_0x6c2b('0x5d')]=function(_0x3d5b36,_0x3978a0,_0x15e68b){var _0x3e5d8b={'raw':!![],'where':{}};var _0x353a28={};var _0x4f2e89={'count':0x0,'rows':[]};return db['Campaign'][_0x6c2b('0x57')]({'where':{'id':_0x3d5b36[_0x6c2b('0x44')]['id']}})[_0x6c2b('0x23')](handleEntityNotFound(_0x3978a0,null))[_0x6c2b('0x23')](function(_0x5d235b){if(_0x5d235b){_0x353a28[_0x6c2b('0x31')]=_[_0x6c2b('0x2f')](db[_0x6c2b('0x5e')][_0x6c2b('0x2c')]);_0x353a28[_0x6c2b('0x2e')]=_['keys'](_0x3d5b36[_0x6c2b('0x2e')]);_0x353a28[_0x6c2b('0x30')]=_['intersection'](_0x353a28[_0x6c2b('0x31')],_0x353a28['query']);_0x3e5d8b[_0x6c2b('0x32')]=_['intersection'](_0x353a28[_0x6c2b('0x31')],qs[_0x6c2b('0x33')](_0x3d5b36['query']['fields']));_0x3e5d8b[_0x6c2b('0x32')]=_0x3e5d8b[_0x6c2b('0x32')]['length']?_0x3e5d8b[_0x6c2b('0x32')]:_0x353a28[_0x6c2b('0x31')];if(!_0x3d5b36['query'][_0x6c2b('0x59')](_0x6c2b('0x5a'))){_0x3e5d8b[_0x6c2b('0x1e')]=qs['limit'](_0x3d5b36['query']['limit']);_0x3e5d8b[_0x6c2b('0x1c')]=qs[_0x6c2b('0x1c')](_0x3d5b36['query'][_0x6c2b('0x1c')]);}_0x3e5d8b[_0x6c2b('0x35')]=qs[_0x6c2b('0x36')](_0x3d5b36['query'][_0x6c2b('0x36')]);_0x3e5d8b[_0x6c2b('0x37')]=qs['filters'](_['pick'](_0x3d5b36[_0x6c2b('0x2e')],_0x353a28[_0x6c2b('0x30')]));_0x3e5d8b[_0x6c2b('0x37')][_0x6c2b('0x5c')]=_0x5d235b['id'];if(_0x3d5b36[_0x6c2b('0x2e')][_0x6c2b('0x39')]){_0x3e5d8b['where']=_[_0x6c2b('0x3c')](_0x3e5d8b[_0x6c2b('0x37')],{'$or':_[_0x6c2b('0x2b')](_0x3e5d8b['attributes'],function(_0x3dc6f0){var _0x59f9a7={};_0x59f9a7[_0x3dc6f0]={'$like':'%'+_0x3d5b36[_0x6c2b('0x2e')][_0x6c2b('0x39')]+'%'};return _0x59f9a7;})});}_0x3e5d8b=_[_0x6c2b('0x3c')]({},_0x3e5d8b,_0x3d5b36[_0x6c2b('0x3d')]);return db[_0x6c2b('0x5e')][_0x6c2b('0x1f')]({'where':_0x3e5d8b['where']})[_0x6c2b('0x23')](function(_0xab9d50){_0x4f2e89[_0x6c2b('0x1f')]=_0xab9d50;if(_0x3d5b36['query'][_0x6c2b('0x3f')]){_0x3e5d8b[_0x6c2b('0x52')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x3e5d8b);})[_0x6c2b('0x23')](function(_0x29192e){_0x4f2e89[_0x6c2b('0x41')]=_0x29192e;return _0x4f2e89;});}})[_0x6c2b('0x23')](respondWithFilteredResult(_0x3978a0,_0x3e5d8b))[_0x6c2b('0x42')](handleError(_0x3978a0,null));};exports[_0x6c2b('0x5f')]=function(_0x5d43a7,_0x29828f,_0x44df2b){var _0x4e8cd9={'raw':!![],'where':{}};var _0x3c7569={};var _0x81aa62={'count':0x0,'rows':[]};return db['Campaign'][_0x6c2b('0x57')]({'where':{'id':_0x5d43a7[_0x6c2b('0x44')]['id']}})['then'](handleEntityNotFound(_0x29828f,null))[_0x6c2b('0x23')](function(_0x1ab6c2){if(_0x1ab6c2){_0x3c7569[_0x6c2b('0x31')]=_[_0x6c2b('0x2f')](db[_0x6c2b('0x60')][_0x6c2b('0x2c')]);_0x3c7569[_0x6c2b('0x2e')]=_['keys'](_0x5d43a7[_0x6c2b('0x2e')]);_0x3c7569[_0x6c2b('0x30')]=_[_0x6c2b('0x45')](_0x3c7569[_0x6c2b('0x31')],_0x3c7569[_0x6c2b('0x2e')]);_0x4e8cd9[_0x6c2b('0x32')]=_[_0x6c2b('0x45')](_0x3c7569['model'],qs[_0x6c2b('0x33')](_0x5d43a7[_0x6c2b('0x2e')][_0x6c2b('0x33')]));_0x4e8cd9[_0x6c2b('0x32')]=_0x4e8cd9[_0x6c2b('0x32')][_0x6c2b('0x34')]?_0x4e8cd9[_0x6c2b('0x32')]:_0x3c7569['model'];if(!_0x5d43a7[_0x6c2b('0x2e')][_0x6c2b('0x59')]('nolimit')){_0x4e8cd9[_0x6c2b('0x1e')]=qs[_0x6c2b('0x1e')](_0x5d43a7['query'][_0x6c2b('0x1e')]);_0x4e8cd9['offset']=qs[_0x6c2b('0x1c')](_0x5d43a7[_0x6c2b('0x2e')][_0x6c2b('0x1c')]);}_0x4e8cd9[_0x6c2b('0x35')]=qs[_0x6c2b('0x36')](_0x5d43a7[_0x6c2b('0x2e')][_0x6c2b('0x36')]);_0x4e8cd9[_0x6c2b('0x37')]=qs['filters'](_[_0x6c2b('0x38')](_0x5d43a7[_0x6c2b('0x2e')],_0x3c7569[_0x6c2b('0x30')]));_0x4e8cd9[_0x6c2b('0x37')][_0x6c2b('0x5c')]=_0x1ab6c2['id'];if(_0x5d43a7['query'][_0x6c2b('0x39')]){_0x4e8cd9[_0x6c2b('0x37')]=_[_0x6c2b('0x3c')](_0x4e8cd9[_0x6c2b('0x37')],{'$or':_[_0x6c2b('0x2b')](_0x4e8cd9['attributes'],function(_0x20b9b1){var _0x373199={};_0x373199[_0x20b9b1]={'$like':'%'+_0x5d43a7[_0x6c2b('0x2e')][_0x6c2b('0x39')]+'%'};return _0x373199;})});}_0x4e8cd9=_[_0x6c2b('0x3c')]({},_0x4e8cd9,_0x5d43a7[_0x6c2b('0x3d')]);return db[_0x6c2b('0x60')]['count']({'where':_0x4e8cd9[_0x6c2b('0x37')]})[_0x6c2b('0x23')](function(_0x19c54d){_0x81aa62['count']=_0x19c54d;if(_0x5d43a7[_0x6c2b('0x2e')]['includeAll']){_0x4e8cd9[_0x6c2b('0x52')]=[{'all':!![]}];}return db[_0x6c2b('0x60')][_0x6c2b('0x40')](_0x4e8cd9);})[_0x6c2b('0x23')](function(_0x5bf5bd){_0x81aa62[_0x6c2b('0x41')]=_0x5bf5bd;return _0x81aa62;});}})['then'](respondWithFilteredResult(_0x29828f,_0x4e8cd9))[_0x6c2b('0x42')](handleError(_0x29828f,null));};exports[_0x6c2b('0x61')]=function(_0x53f630,_0x5ae45b,_0x58039c){var _0x1eaf17={};var _0x5eb852={};var _0x4e6373;var _0x56bd9f;return db['Campaign'][_0x6c2b('0x57')]({'where':{'id':_0x53f630[_0x6c2b('0x44')]['id']}})[_0x6c2b('0x23')](handleEntityNotFound(_0x5ae45b,null))['then'](function(_0x1a0fd1){if(_0x1a0fd1){_0x4e6373=_0x1a0fd1;_0x5eb852[_0x6c2b('0x31')]=_[_0x6c2b('0x2f')](db[_0x6c2b('0x62')][_0x6c2b('0x2c')]);_0x5eb852[_0x6c2b('0x2e')]=_[_0x6c2b('0x2f')](_0x53f630['query']);_0x5eb852[_0x6c2b('0x30')]=_[_0x6c2b('0x45')](_0x5eb852['model'],_0x5eb852[_0x6c2b('0x2e')]);_0x1eaf17[_0x6c2b('0x32')]=_[_0x6c2b('0x45')](_0x5eb852['model'],qs['fields'](_0x53f630[_0x6c2b('0x2e')][_0x6c2b('0x33')]));_0x1eaf17[_0x6c2b('0x32')]=_0x1eaf17['attributes'][_0x6c2b('0x34')]?_0x1eaf17[_0x6c2b('0x32')]:_0x5eb852['model'];_0x1eaf17['order']=qs[_0x6c2b('0x36')](_0x53f630[_0x6c2b('0x2e')][_0x6c2b('0x36')]);_0x1eaf17[_0x6c2b('0x37')]=qs[_0x6c2b('0x30')](_[_0x6c2b('0x38')](_0x53f630[_0x6c2b('0x2e')],_0x5eb852[_0x6c2b('0x30')]));if(_0x53f630[_0x6c2b('0x2e')][_0x6c2b('0x39')]){_0x1eaf17['where']=_[_0x6c2b('0x3c')](_0x1eaf17[_0x6c2b('0x37')],{'$or':_[_0x6c2b('0x2b')](_0x1eaf17[_0x6c2b('0x32')],function(_0x5b1635){var _0x447532={};_0x447532[_0x5b1635]={'$like':'%'+_0x53f630[_0x6c2b('0x2e')]['filter']+'%'};return _0x447532;})});}_0x1eaf17=_[_0x6c2b('0x3c')]({},_0x1eaf17,_0x53f630[_0x6c2b('0x3d')]);return _0x4e6373[_0x6c2b('0x61')](_0x1eaf17);}})[_0x6c2b('0x23')](function(_0x379c4a){if(_0x379c4a){_0x56bd9f=_0x379c4a[_0x6c2b('0x34')];if(!_0x53f630[_0x6c2b('0x2e')][_0x6c2b('0x59')]('nolimit')){_0x1eaf17['limit']=qs[_0x6c2b('0x1e')](_0x53f630[_0x6c2b('0x2e')][_0x6c2b('0x1e')]);_0x1eaf17[_0x6c2b('0x1c')]=qs[_0x6c2b('0x1c')](_0x53f630[_0x6c2b('0x2e')][_0x6c2b('0x1c')]);}return _0x4e6373['getLists'](_0x1eaf17);}})[_0x6c2b('0x23')](function(_0x2fc3e6){if(_0x2fc3e6){return _0x2fc3e6?{'count':_0x56bd9f,'rows':_0x2fc3e6}:null;}})[_0x6c2b('0x23')](respondWithResult(_0x5ae45b,null))[_0x6c2b('0x42')](handleError(_0x5ae45b,null));};exports[_0x6c2b('0x63')]=function(_0x24b05b,_0x19fb68,_0xe02ebc){var _0x289611,_0x5b6689;return db[_0x6c2b('0x3e')][_0x6c2b('0x46')]({'where':{'id':_0x24b05b['params']['id']}})[_0x6c2b('0x23')](handleEntityNotFound(_0x19fb68,null))[_0x6c2b('0x23')](function(_0x2bd3fa){if(_0x2bd3fa){_0x5b6689=_0x2bd3fa;return _0x2bd3fa[_0x6c2b('0x63')](_0x24b05b[_0x6c2b('0x56')][_0x6c2b('0x64')],_[_0x6c2b('0x53')](_0x24b05b[_0x6c2b('0x56')],[_0x6c2b('0x64'),'id'])||{});}return null;})[_0x6c2b('0x65')](function(_0x4083af){var _0x258bfa;_0x289611=_0x4083af||[];var _0x11f298=[];if(_0x4083af){for(var _0x21bb68=0x0;_0x21bb68<_0x4083af[_0x6c2b('0x34')];_0x21bb68+=0x1){var _0x14bbb0=_0x4083af[_0x21bb68][_0x6c2b('0x25')]({'plain':!![]});_0x5b6689['dialCheckDuplicateType']=_0x24b05b['body']['dialCheckDuplicateType']?_0x24b05b['body'][_0x6c2b('0x66')]:_0x5b6689[_0x6c2b('0x66')];switch(_0x5b6689[_0x6c2b('0x66')]){case _0x6c2b('0x67'):_0x258bfa=squel[_0x6c2b('0x68')]()[_0x6c2b('0x69')]('cm_hopper')[_0x6c2b('0x6a')]([_0x6c2b('0x6b'),'scheduledAt',_0x6c2b('0x6c'),'ListId',_0x6c2b('0x5c'),'createdAt',_0x6c2b('0x55')],squel[_0x6c2b('0x6d')]()[_0x6c2b('0x6e')]('phone',_0x6c2b('0x6b'))[_0x6c2b('0x6e')](_0x6c2b('0x6f'),'scheduledAt')['field']('id',_0x6c2b('0x6c'))['field'](_0x14bbb0['CmListId'][_0x6c2b('0x70')](),_0x6c2b('0x71'))[_0x6c2b('0x6e')](_0x24b05b[_0x6c2b('0x44')]['id'][_0x6c2b('0x70')](),_0x6c2b('0x5c'))[_0x6c2b('0x6e')]('NOW()','createdAt')['field'](_0x6c2b('0x6f'),_0x6c2b('0x55'))[_0x6c2b('0x72')](_0x6c2b('0x73'))[_0x6c2b('0x37')](_0x6c2b('0x74'))[_0x6c2b('0x37')]('ListId\x20=\x20?',_0x14bbb0['CmListId'][_0x6c2b('0x70')]())[_0x6c2b('0x37')](_0x6c2b('0x75'))[_0x6c2b('0x37')](_0x6c2b('0x76'),squel[_0x6c2b('0x6d')]()[_0x6c2b('0x6e')]('COALESCE(calleridnum,\x27\x27)')[_0x6c2b('0x72')](_0x6c2b('0x77'))[_0x6c2b('0x37')](_0x6c2b('0x78'),_0x24b05b[_0x6c2b('0x44')]['id'][_0x6c2b('0x70')]()))['where'](_0x6c2b('0x76'),squel[_0x6c2b('0x6d')]()[_0x6c2b('0x6e')](_0x6c2b('0x79'))[_0x6c2b('0x72')](_0x6c2b('0x7a'))['where']('CampaignId\x20=\x20?',_0x24b05b[_0x6c2b('0x44')]['id'][_0x6c2b('0x70')]())))[_0x6c2b('0x70')]();break;case'onlyIfOpen':_0x258bfa=squel[_0x6c2b('0x68')]()['into'](_0x6c2b('0x7a'))['fromQuery'](['phone','scheduledAt',_0x6c2b('0x6c'),'ListId',_0x6c2b('0x5c'),'createdAt',_0x6c2b('0x55')],squel[_0x6c2b('0x6d')]()[_0x6c2b('0x6e')](_0x6c2b('0x6b'),'phone')[_0x6c2b('0x6e')]('NOW()',_0x6c2b('0x7b'))[_0x6c2b('0x6e')]('id',_0x6c2b('0x6c'))[_0x6c2b('0x6e')](_0x14bbb0[_0x6c2b('0x7c')][_0x6c2b('0x70')](),_0x6c2b('0x71'))[_0x6c2b('0x6e')](_0x24b05b[_0x6c2b('0x44')]['id'][_0x6c2b('0x70')](),_0x6c2b('0x5c'))['field'](_0x6c2b('0x6f'),_0x6c2b('0x54'))[_0x6c2b('0x6e')](_0x6c2b('0x6f'),_0x6c2b('0x55'))[_0x6c2b('0x72')](_0x6c2b('0x73'))[_0x6c2b('0x37')](_0x6c2b('0x74'))[_0x6c2b('0x37')](_0x6c2b('0x7d'),_0x14bbb0[_0x6c2b('0x7c')]['toString']())[_0x6c2b('0x37')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x6c2b('0x76'),squel[_0x6c2b('0x6d')]()[_0x6c2b('0x6e')](_0x6c2b('0x79'))[_0x6c2b('0x72')]('cm_hopper')['where'](_0x6c2b('0x78'),_0x24b05b[_0x6c2b('0x44')]['id'][_0x6c2b('0x70')]())))[_0x6c2b('0x70')]();break;default:_0x258bfa=squel[_0x6c2b('0x68')]()['into'](_0x6c2b('0x7a'))[_0x6c2b('0x6a')]([_0x6c2b('0x6b'),_0x6c2b('0x7b'),'ContactId',_0x6c2b('0x71'),_0x6c2b('0x5c'),_0x6c2b('0x54'),_0x6c2b('0x55')],squel[_0x6c2b('0x6d')]()[_0x6c2b('0x6e')](_0x6c2b('0x6b'),_0x6c2b('0x6b'))[_0x6c2b('0x6e')](_0x6c2b('0x6f'),_0x6c2b('0x7b'))[_0x6c2b('0x6e')]('id','ContactId')['field'](_0x14bbb0['CmListId']['toString'](),_0x6c2b('0x71'))['field'](_0x24b05b[_0x6c2b('0x44')]['id']['toString'](),_0x6c2b('0x5c'))[_0x6c2b('0x6e')]('NOW()',_0x6c2b('0x54'))[_0x6c2b('0x6e')]('NOW()',_0x6c2b('0x55'))[_0x6c2b('0x72')](_0x6c2b('0x73'))[_0x6c2b('0x37')]('deletedAt\x20IS\x20NULL')[_0x6c2b('0x37')](_0x6c2b('0x7d'),_0x14bbb0[_0x6c2b('0x7c')][_0x6c2b('0x70')]())[_0x6c2b('0x37')](_0x6c2b('0x75')))[_0x6c2b('0x70')]();}_0x11f298[_0x6c2b('0x7e')](db[_0x6c2b('0x7f')]['query'](_0x258bfa));}return BPromise[_0x6c2b('0x80')](_0x11f298);}})[_0x6c2b('0x23')](function(){return _0x289611;})[_0x6c2b('0x23')](respondWithResult(_0x19fb68,null))[_0x6c2b('0x42')](handleError(_0x19fb68,null));};exports['removeLists']=function(_0x3264a3,_0x340b66,_0x580b73){return db[_0x6c2b('0x3e')][_0x6c2b('0x46')]({'where':{'id':_0x3264a3[_0x6c2b('0x44')]['id']}})[_0x6c2b('0x23')](handleEntityNotFound(_0x340b66,null))[_0x6c2b('0x23')](function(_0x52fd50){if(_0x52fd50){return _0x52fd50[_0x6c2b('0x81')](_0x3264a3[_0x6c2b('0x2e')][_0x6c2b('0x64')]);}})[_0x6c2b('0x23')](function(_0x52defa){if(_0x52defa){return db[_0x6c2b('0x58')][_0x6c2b('0x24')]({'where':{'ListId':_0x3264a3[_0x6c2b('0x2e')][_0x6c2b('0x64')],'CampaignId':_0x3264a3[_0x6c2b('0x44')]['id']}})[_0x6c2b('0x23')](function(){return _0x52defa;});}})[_0x6c2b('0x23')](respondWithStatusCode(_0x340b66,null))[_0x6c2b('0x42')](handleError(_0x340b66,null));};exports['getBlackLists']=function(_0x567150,_0x1fb9ba,_0x36c0af){var _0x394087={};var _0x5c5d8e={};var _0x322062;var _0x16ae58;return db[_0x6c2b('0x3e')][_0x6c2b('0x57')]({'where':{'id':_0x567150[_0x6c2b('0x44')]['id']}})[_0x6c2b('0x23')](handleEntityNotFound(_0x1fb9ba,null))[_0x6c2b('0x23')](function(_0x1de477){if(_0x1de477){_0x322062=_0x1de477;_0x5c5d8e[_0x6c2b('0x31')]=_[_0x6c2b('0x2f')](db[_0x6c2b('0x62')][_0x6c2b('0x2c')]);_0x5c5d8e['query']=_[_0x6c2b('0x2f')](_0x567150['query']);_0x5c5d8e['filters']=_[_0x6c2b('0x45')](_0x5c5d8e[_0x6c2b('0x31')],_0x5c5d8e[_0x6c2b('0x2e')]);_0x394087[_0x6c2b('0x32')]=_[_0x6c2b('0x45')](_0x5c5d8e['model'],qs['fields'](_0x567150[_0x6c2b('0x2e')][_0x6c2b('0x33')]));_0x394087['attributes']=_0x394087[_0x6c2b('0x32')][_0x6c2b('0x34')]?_0x394087[_0x6c2b('0x32')]:_0x5c5d8e[_0x6c2b('0x31')];_0x394087['order']=qs[_0x6c2b('0x36')](_0x567150[_0x6c2b('0x2e')]['sort']);_0x394087[_0x6c2b('0x37')]=qs[_0x6c2b('0x30')](_[_0x6c2b('0x38')](_0x567150[_0x6c2b('0x2e')],_0x5c5d8e['filters']));if(_0x567150[_0x6c2b('0x2e')][_0x6c2b('0x39')]){_0x394087[_0x6c2b('0x37')]=_[_0x6c2b('0x3c')](_0x394087[_0x6c2b('0x37')],{'$or':_['map'](_0x394087[_0x6c2b('0x32')],function(_0x184ca1){var _0x3353ac={};_0x3353ac[_0x184ca1]={'$like':'%'+_0x567150[_0x6c2b('0x2e')][_0x6c2b('0x39')]+'%'};return _0x3353ac;})});}_0x394087=_['merge']({},_0x394087,_0x567150['options']);return _0x322062[_0x6c2b('0x82')](_0x394087);}})['then'](function(_0x2f9287){if(_0x2f9287){_0x16ae58=_0x2f9287['length'];if(!_0x567150[_0x6c2b('0x2e')][_0x6c2b('0x59')](_0x6c2b('0x5a'))){_0x394087[_0x6c2b('0x1e')]=qs['limit'](_0x567150[_0x6c2b('0x2e')][_0x6c2b('0x1e')]);_0x394087[_0x6c2b('0x1c')]=qs[_0x6c2b('0x1c')](_0x567150[_0x6c2b('0x2e')][_0x6c2b('0x1c')]);}return _0x322062['getBlackLists'](_0x394087);}})['then'](function(_0x3292f9){if(_0x3292f9){return _0x3292f9?{'count':_0x16ae58,'rows':_0x3292f9}:null;}})[_0x6c2b('0x23')](respondWithResult(_0x1fb9ba,null))[_0x6c2b('0x42')](handleError(_0x1fb9ba,null));};exports['addBlackLists']=function(_0x525329,_0x29e17c,_0x531bc2){var _0xa82f7d,_0x1e0a82;return db[_0x6c2b('0x3e')][_0x6c2b('0x46')]({'where':{'id':_0x525329['params']['id']}})[_0x6c2b('0x23')](handleEntityNotFound(_0x29e17c,null))[_0x6c2b('0x23')](function(_0x53a354){if(_0x53a354){_0x1e0a82=_0x53a354;return _0x53a354[_0x6c2b('0x83')](_0x525329[_0x6c2b('0x56')][_0x6c2b('0x64')],_['omit'](_0x525329[_0x6c2b('0x56')],['ids','id'])||{});}return null;})[_0x6c2b('0x65')](function(_0x576871){var _0x37e988;_0xa82f7d=_0x576871||[];var _0x204e3a=[];if(_0x576871){for(var _0x33a747=0x0;_0x33a747<_0x576871[_0x6c2b('0x34')];_0x33a747+=0x1){var _0x21562d=_0x576871[_0x33a747][_0x6c2b('0x25')]({'plain':!![]});_0x37e988=squel['insert']()[_0x6c2b('0x69')]('cm_hopper_black')['fromQuery']([_0x6c2b('0x6b'),'ContactId',_0x6c2b('0x71'),_0x6c2b('0x5c'),'createdAt',_0x6c2b('0x55')],squel[_0x6c2b('0x6d')]()[_0x6c2b('0x6e')](_0x6c2b('0x6b'),_0x6c2b('0x6b'))[_0x6c2b('0x6e')]('id',_0x6c2b('0x6c'))[_0x6c2b('0x6e')](_0x21562d[_0x6c2b('0x7c')][_0x6c2b('0x70')](),_0x6c2b('0x71'))[_0x6c2b('0x6e')](_0x525329[_0x6c2b('0x44')]['id'][_0x6c2b('0x70')](),_0x6c2b('0x5c'))[_0x6c2b('0x6e')]('NOW()',_0x6c2b('0x54'))[_0x6c2b('0x6e')](_0x6c2b('0x6f'),_0x6c2b('0x55'))[_0x6c2b('0x72')](_0x6c2b('0x73'))[_0x6c2b('0x37')]('deletedAt\x20IS\x20NULL')[_0x6c2b('0x37')](_0x6c2b('0x7d'),_0x21562d[_0x6c2b('0x7c')][_0x6c2b('0x70')]())[_0x6c2b('0x37')](_0x6c2b('0x75')))['toString']();_0x204e3a[_0x6c2b('0x7e')](db['sequelize'][_0x6c2b('0x2e')](_0x37e988));}return BPromise['all'](_0x204e3a);}})[_0x6c2b('0x23')](function(){return _0xa82f7d;})[_0x6c2b('0x23')](respondWithResult(_0x29e17c,null))[_0x6c2b('0x42')](handleError(_0x29e17c,null));};exports[_0x6c2b('0x84')]=function(_0x5ee964,_0x572f74,_0x5e4089){return db[_0x6c2b('0x3e')][_0x6c2b('0x46')]({'where':{'id':_0x5ee964['params']['id']}})['then'](handleEntityNotFound(_0x572f74,null))[_0x6c2b('0x23')](function(_0x536f78){if(_0x536f78){return _0x536f78[_0x6c2b('0x84')](_0x5ee964[_0x6c2b('0x2e')]['ids']);}})['then'](function(_0x59000d){if(_0x59000d){return db[_0x6c2b('0x60')][_0x6c2b('0x24')]({'where':{'ListId':_0x5ee964[_0x6c2b('0x2e')]['ids'],'CampaignId':_0x5ee964[_0x6c2b('0x44')]['id']}})[_0x6c2b('0x23')](function(){return _0x59000d;});}})[_0x6c2b('0x23')](respondWithStatusCode(_0x572f74,null))[_0x6c2b('0x42')](handleError(_0x572f74,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 20afdc7..6e936d1 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(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 15f154d..4953dc0 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 _0x136c=['include','map','model','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetCampaign','Campaign','options','raw','where','attributes','limit'];(function(_0x2262bb,_0x4d516c){var _0x13d2a5=function(_0x16056f){while(--_0x16056f){_0x2262bb['push'](_0x2262bb['shift']());}};_0x13d2a5(++_0x4d516c);}(_0x136c,0x1d2));var _0xc136=function(_0x28cf5e,_0x4b49dc){_0x28cf5e=_0x28cf5e-0x0;var _0x47e2de=_0x136c[_0x28cf5e];return _0x47e2de;};'use strict';var _=require(_0xc136('0x0'));var util=require(_0xc136('0x1'));var moment=require('moment');var BPromise=require(_0xc136('0x2'));var rs=require(_0xc136('0x3'));var fs=require('fs');var Redis=require(_0xc136('0x4'));var db=require(_0xc136('0x5'))['db'];var utils=require(_0xc136('0x6'));var logger=require(_0xc136('0x7'))(_0xc136('0x8'));var config=require(_0xc136('0x9'));var jayson=require(_0xc136('0xa'));var client=jayson['client'][_0xc136('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x594112,_0x361a52,_0x3993f2){return new BPromise(function(_0x1804c1,_0x500376){return client[_0xc136('0xc')](_0x594112,_0x3993f2)['then'](function(_0x1ea07d){logger[_0xc136('0xd')](_0xc136('0xe'),_0x361a52,_0xc136('0xf'));logger[_0xc136('0x10')](_0xc136('0x11'),_0x361a52,_0xc136('0xf'),JSON[_0xc136('0x12')](_0x1ea07d));if(_0x1ea07d[_0xc136('0x13')]){if(_0x1ea07d['error']['code']===0x1f4){logger[_0xc136('0x13')]('Campaign,\x20%s,\x20%s',_0x361a52,_0x1ea07d[_0xc136('0x13')][_0xc136('0x14')]);return _0x500376(_0x1ea07d[_0xc136('0x13')]['message']);}logger['error'](_0xc136('0xe'),_0x361a52,_0x1ea07d[_0xc136('0x13')][_0xc136('0x14')]);return _0x1804c1(_0x1ea07d['error']['message']);}else{logger[_0xc136('0xd')](_0xc136('0xe'),_0x361a52,'request\x20sent');_0x1804c1(_0x1ea07d['result']['message']);}})[_0xc136('0x15')](function(_0x3daf55){logger[_0xc136('0x13')](_0xc136('0xe'),_0x361a52,_0x3daf55);_0x500376(_0x3daf55);});});}exports[_0xc136('0x16')]=function(_0x1ccf5f){var _0x59503b=this;return new Promise(function(_0x5df9b7,_0x4d56cb){return db[_0xc136('0x17')]['findAll']({'raw':_0x1ccf5f[_0xc136('0x18')]?_0x1ccf5f[_0xc136('0x18')][_0xc136('0x19')]===undefined?!![]:![]:!![],'where':_0x1ccf5f[_0xc136('0x18')]?_0x1ccf5f['options'][_0xc136('0x1a')]||null:null,'attributes':_0x1ccf5f[_0xc136('0x18')]?_0x1ccf5f['options'][_0xc136('0x1b')]||null:null,'limit':_0x1ccf5f['options']?_0x1ccf5f['options'][_0xc136('0x1c')]||null:null,'include':_0x1ccf5f[_0xc136('0x18')]?_0x1ccf5f['options'][_0xc136('0x1d')]?_[_0xc136('0x1e')](_0x1ccf5f[_0xc136('0x18')][_0xc136('0x1d')],function(_0x5d8300){return{'model':db[_0x5d8300[_0xc136('0x1f')]],'as':_0x5d8300['as'],'attributes':_0x5d8300[_0xc136('0x1b')],'include':_0x5d8300['include']?_[_0xc136('0x1e')](_0x5d8300['include'],function(_0x21a163){return{'model':db[_0x21a163[_0xc136('0x1f')]],'as':_0x21a163['as'],'attributes':_0x21a163['attributes'],'include':_0x21a163['include']?_[_0xc136('0x1e')](_0x21a163[_0xc136('0x1d')],function(_0x549a60){return{'model':db[_0x549a60[_0xc136('0x1f')]],'as':_0x549a60['as'],'attributes':_0x549a60[_0xc136('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc136('0x20')](function(_0x2608b8){logger[_0xc136('0xd')](_0xc136('0x16'),_0x1ccf5f);logger[_0xc136('0x10')]('GetCampaign',_0x1ccf5f,JSON[_0xc136('0x12')](_0x2608b8));_0x5df9b7(_0x2608b8);})[_0xc136('0x15')](function(_0x1ad50f){logger[_0xc136('0x13')](_0xc136('0x16'),_0x1ad50f[_0xc136('0x14')],_0x1ccf5f);_0x4d56cb(_0x59503b[_0xc136('0x13')](0x1f4,_0x1ad50f[_0xc136('0x14')]));});});}; \ No newline at end of file +var _0x544a=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result','GetCampaign','Campaign','findAll','raw','options','limit','model','attributes','include','map','then','debug','catch','lodash','util','moment'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0x544a,0xbd));var _0xa544=function(_0x173512,_0x532bf1){_0x173512=_0x173512-0x0;var _0x1e7ae0=_0x544a[_0x173512];return _0x1e7ae0;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var moment=require(_0xa544('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa544('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa544('0x4'));var logger=require(_0xa544('0x5'))('rpc');var config=require(_0xa544('0x6'));var jayson=require(_0xa544('0x7'));var client=jayson[_0xa544('0x8')][_0xa544('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39caac,_0x543cd1,_0x407443){return new BPromise(function(_0x495819,_0x39bcd7){return client[_0xa544('0xa')](_0x39caac,_0x407443)['then'](function(_0x2e9a6a){logger[_0xa544('0xb')](_0xa544('0xc'),_0x543cd1,_0xa544('0xd'));logger['debug'](_0xa544('0xe'),_0x543cd1,_0xa544('0xd'),JSON['stringify'](_0x2e9a6a));if(_0x2e9a6a[_0xa544('0xf')]){if(_0x2e9a6a['error'][_0xa544('0x10')]===0x1f4){logger[_0xa544('0xf')]('Campaign,\x20%s,\x20%s',_0x543cd1,_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);return _0x39bcd7(_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);}logger[_0xa544('0xf')](_0xa544('0xc'),_0x543cd1,_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);return _0x495819(_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);}else{logger[_0xa544('0xb')](_0xa544('0xc'),_0x543cd1,'request\x20sent');_0x495819(_0x2e9a6a[_0xa544('0x12')][_0xa544('0x11')]);}})['catch'](function(_0x9093bd){logger[_0xa544('0xf')](_0xa544('0xc'),_0x543cd1,_0x9093bd);_0x39bcd7(_0x9093bd);});});}exports[_0xa544('0x13')]=function(_0x2c5ae8){var _0x297298=this;return new Promise(function(_0x1f3fcc,_0x44ccd3){return db[_0xa544('0x14')][_0xa544('0x15')]({'raw':_0x2c5ae8['options']?_0x2c5ae8['options'][_0xa544('0x16')]===undefined?!![]:![]:!![],'where':_0x2c5ae8[_0xa544('0x17')]?_0x2c5ae8[_0xa544('0x17')]['where']||null:null,'attributes':_0x2c5ae8[_0xa544('0x17')]?_0x2c5ae8[_0xa544('0x17')]['attributes']||null:null,'limit':_0x2c5ae8[_0xa544('0x17')]?_0x2c5ae8[_0xa544('0x17')][_0xa544('0x18')]||null:null,'include':_0x2c5ae8[_0xa544('0x17')]?_0x2c5ae8[_0xa544('0x17')]['include']?_['map'](_0x2c5ae8[_0xa544('0x17')]['include'],function(_0x407a61){return{'model':db[_0x407a61[_0xa544('0x19')]],'as':_0x407a61['as'],'attributes':_0x407a61[_0xa544('0x1a')],'include':_0x407a61[_0xa544('0x1b')]?_[_0xa544('0x1c')](_0x407a61[_0xa544('0x1b')],function(_0xcd7bfa){return{'model':db[_0xcd7bfa[_0xa544('0x19')]],'as':_0xcd7bfa['as'],'attributes':_0xcd7bfa[_0xa544('0x1a')],'include':_0xcd7bfa['include']?_[_0xa544('0x1c')](_0xcd7bfa[_0xa544('0x1b')],function(_0x578483){return{'model':db[_0x578483[_0xa544('0x19')]],'as':_0x578483['as'],'attributes':_0x578483[_0xa544('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa544('0x1d')](function(_0x4fdf9e){logger[_0xa544('0xb')](_0xa544('0x13'),_0x2c5ae8);logger[_0xa544('0x1e')](_0xa544('0x13'),_0x2c5ae8,JSON['stringify'](_0x4fdf9e));_0x1f3fcc(_0x4fdf9e);})[_0xa544('0x1f')](function(_0x290c45){logger[_0xa544('0xf')]('GetCampaign',_0x290c45[_0xa544('0x11')],_0x2c5ae8);_0x44ccd3(_0x297298[_0xa544('0xf')](0x1f4,_0x290c45['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index c6f8871..42044d3 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 _0x8b9a=['/:id/lists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','update','/:id','destroy','delete','removeLists','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x8b9a,0x179));var _0xa8b9=function(_0x4afc33,_0x5088fd){_0x4afc33=_0x4afc33-0x0;var _0x448b1c=_0x8b9a[_0x4afc33];return _0x448b1c;};'use strict';var multer=require(_0xa8b9('0x0'));var util=require(_0xa8b9('0x1'));var path=require(_0xa8b9('0x2'));var timeout=require(_0xa8b9('0x3'));var express=require(_0xa8b9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa8b9('0x5'));var interaction=require(_0xa8b9('0x6'));var config=require('../../config/environment');var controller=require(_0xa8b9('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa8b9('0x8')]('/:id',auth[_0xa8b9('0x9')](),controller[_0xa8b9('0xa')]);router['get'](_0xa8b9('0xb'),auth[_0xa8b9('0x9')](),controller[_0xa8b9('0xc')]);router['get'](_0xa8b9('0xd'),auth[_0xa8b9('0x9')](),controller[_0xa8b9('0xe')]);router[_0xa8b9('0x8')](_0xa8b9('0xf'),auth['isAuthenticated'](),controller[_0xa8b9('0x10')]);router[_0xa8b9('0x8')](_0xa8b9('0x11'),auth['isAuthenticated'](),controller[_0xa8b9('0x12')]);router[_0xa8b9('0x8')](_0xa8b9('0x13'),auth['isAuthenticated'](),controller['getLists']);router[_0xa8b9('0x8')]('/:id/blacklists',auth[_0xa8b9('0x9')](),controller[_0xa8b9('0x14')]);router[_0xa8b9('0x15')]('/',auth[_0xa8b9('0x9')](),controller[_0xa8b9('0x16')]);router[_0xa8b9('0x15')](_0xa8b9('0x17'),auth[_0xa8b9('0x9')](),controller[_0xa8b9('0x18')]);router[_0xa8b9('0x15')]('/:id/lists',auth[_0xa8b9('0x9')](),controller[_0xa8b9('0x19')]);router[_0xa8b9('0x15')](_0xa8b9('0x1a'),auth[_0xa8b9('0x9')](),controller['addBlackLists']);router['put']('/:id',auth[_0xa8b9('0x9')](),controller[_0xa8b9('0x1b')]);router['delete'](_0xa8b9('0x1c'),auth['isAuthenticated'](),controller[_0xa8b9('0x1d')]);router[_0xa8b9('0x1e')](_0xa8b9('0x13'),auth['isAuthenticated'](),controller[_0xa8b9('0x1f')]);router[_0xa8b9('0x1e')](_0xa8b9('0x1a'),auth[_0xa8b9('0x9')](),controller['removeBlackLists']);module[_0xa8b9('0x20')]=router; \ No newline at end of file +var _0xf44c=['addLists','addBlackLists','put','delete','destroy','removeBlackLists','exports','multer','path','connect-timeout','express','Router','fs-extra','isAuthenticated','index','get','/:id','show','getHoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0xf44c,0x163));var _0xcf44=function(_0x4c8403,_0x1bfb0b){_0x4c8403=_0x4c8403-0x0;var _0x4fc19e=_0xf44c[_0x4c8403];return _0x4fc19e;};'use strict';var multer=require(_0xcf44('0x0'));var util=require('util');var path=require(_0xcf44('0x1'));var timeout=require(_0xcf44('0x2'));var express=require(_0xcf44('0x3'));var router=express[_0xcf44('0x4')]();var fs_extra=require(_0xcf44('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./campaign.controller');router['get']('/',auth[_0xcf44('0x6')](),controller[_0xcf44('0x7')]);router[_0xcf44('0x8')](_0xcf44('0x9'),auth[_0xcf44('0x6')](),controller[_0xcf44('0xa')]);router[_0xcf44('0x8')]('/:id/hoppers',auth[_0xcf44('0x6')](),controller[_0xcf44('0xb')]);router[_0xcf44('0x8')]('/:id/hopper_histories',auth[_0xcf44('0x6')](),controller[_0xcf44('0xc')]);router[_0xcf44('0x8')](_0xcf44('0xd'),auth[_0xcf44('0x6')](),controller['getHopperFinals']);router['get'](_0xcf44('0xe'),auth[_0xcf44('0x6')](),controller[_0xcf44('0xf')]);router['get'](_0xcf44('0x10'),auth['isAuthenticated'](),controller['getLists']);router[_0xcf44('0x8')](_0xcf44('0x11'),auth[_0xcf44('0x6')](),controller[_0xcf44('0x12')]);router[_0xcf44('0x13')]('/',auth[_0xcf44('0x6')](),controller[_0xcf44('0x14')]);router[_0xcf44('0x13')](_0xcf44('0x15'),auth['isAuthenticated'](),controller['clone']);router[_0xcf44('0x13')]('/:id/lists',auth[_0xcf44('0x6')](),controller[_0xcf44('0x16')]);router[_0xcf44('0x13')]('/:id/blacklists',auth[_0xcf44('0x6')](),controller[_0xcf44('0x17')]);router[_0xcf44('0x18')](_0xcf44('0x9'),auth[_0xcf44('0x6')](),controller['update']);router[_0xcf44('0x19')](_0xcf44('0x9'),auth[_0xcf44('0x6')](),controller[_0xcf44('0x1a')]);router[_0xcf44('0x19')]('/:id/lists',auth[_0xcf44('0x6')](),controller['removeLists']);router[_0xcf44('0x19')](_0xcf44('0x11'),auth[_0xcf44('0x6')](),controller[_0xcf44('0x1b')]);module[_0xcf44('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 60ee0d3..d6ba345 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 _0x9cdf=['VIRTUAL','getDataValue','key','exports','STRING'];(function(_0x2c636a,_0x56323d){var _0x5b357f=function(_0x4e07fa){while(--_0x4e07fa){_0x2c636a['push'](_0x2c636a['shift']());}};_0x5b357f(++_0x56323d);}(_0x9cdf,0xe9));var _0xf9cd=function(_0x8e6606,_0x5e23ec){_0x8e6606=_0x8e6606-0x0;var _0x4fce43=_0x9cdf[_0x8e6606];return _0x4fce43;};'use strict';var Sequelize=require('sequelize');module[_0xf9cd('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xf9cd('0x1')]},'name':{'type':Sequelize[_0xf9cd('0x2')],'get':function(){return this[_0xf9cd('0x3')](_0xf9cd('0x4'));}}}; \ No newline at end of file +var _0x8596=['getDataValue','key','sequelize','exports','STRING','VIRTUAL'];(function(_0x3edec5,_0x41c2ff){var _0x21d1ab=function(_0x4cc96b){while(--_0x4cc96b){_0x3edec5['push'](_0x3edec5['shift']());}};_0x21d1ab(++_0x41c2ff);}(_0x8596,0x1be));var _0x6859=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x8596[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x6859('0x0'));module[_0x6859('0x1')]={'key':{'type':Sequelize[_0x6859('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x6859('0x2')]},'name':{'type':Sequelize[_0x6859('0x3')],'get':function(){return this[_0x6859('0x4')](_0x6859('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 489b47a..8b54704 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 _0x8d51=['filters','merge','filter','include','findAll','rows','catch','params','includeAll','options','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','stack','name','index','map','CannedAnswer','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x8d51,0x6e));var _0x18d5=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x8d51[_0x521929];return _0x632436;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x18d5('0x0'));var rp=require('request-promise');var moment=require(_0x18d5('0x1'));var BPromise=require(_0x18d5('0x2'));var Mustache=require('mustache');var util=require(_0x18d5('0x3'));var path=require('path');var sox=require(_0x18d5('0x4'));var csv=require(_0x18d5('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x18d5('0x6'));var _=require('lodash');var squel=require(_0x18d5('0x7'));var crypto=require(_0x18d5('0x8'));var jsforce=require(_0x18d5('0x9'));var deskjs=require(_0x18d5('0xa'));var toCsv=require(_0x18d5('0x5'));var querystring=require(_0x18d5('0xb'));var Papa=require(_0x18d5('0xc'));var Redis=require('ioredis');var authService=require(_0x18d5('0xd'));var qs=require(_0x18d5('0xe'));var as=require(_0x18d5('0xf'));var hardwareService=require(_0x18d5('0x10'));var logger=require(_0x18d5('0x11'))(_0x18d5('0x12'));var utils=require(_0x18d5('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x18d5('0x14'));var db=require(_0x18d5('0x15'))['db'];function respondWithStatusCode(_0x591045,_0x3acfd1){_0x3acfd1=_0x3acfd1||0xcc;return function(_0x28f894){if(_0x28f894){return _0x591045[_0x18d5('0x16')](_0x3acfd1);}return _0x591045[_0x18d5('0x17')](_0x3acfd1)[_0x18d5('0x18')]();};}function respondWithResult(_0x53dd94,_0x3a7637){_0x3a7637=_0x3a7637||0xc8;return function(_0x196794){if(_0x196794){return _0x53dd94[_0x18d5('0x17')](_0x3a7637)['json'](_0x196794);}};}function respondWithFilteredResult(_0x3788d7,_0x47f352){return function(_0x45d95b){if(_0x45d95b){var _0x10b41e=typeof _0x47f352[_0x18d5('0x19')]===_0x18d5('0x1a')&&typeof _0x47f352[_0x18d5('0x1b')]===_0x18d5('0x1a');var _0x59a8ec=_0x45d95b[_0x18d5('0x1c')];var _0x594bcc=_0x10b41e?0x0:_0x47f352[_0x18d5('0x19')];var _0x116f03=_0x10b41e?_0x45d95b[_0x18d5('0x1c')]:_0x47f352[_0x18d5('0x19')]+_0x47f352[_0x18d5('0x1b')];var _0x577311;if(_0x116f03>=_0x59a8ec){_0x116f03=_0x59a8ec;_0x577311=0xc8;}else{_0x577311=0xce;}_0x3788d7[_0x18d5('0x17')](_0x577311);return _0x3788d7[_0x18d5('0x1d')](_0x18d5('0x1e'),_0x594bcc+'-'+_0x116f03+'/'+_0x59a8ec)[_0x18d5('0x1f')](_0x45d95b);}return null;};}function patchUpdates(_0x1f350e){return function(_0x5b7e3b){try{jsonpatch['apply'](_0x5b7e3b,_0x1f350e,!![]);}catch(_0x171538){return BPromise[_0x18d5('0x20')](_0x171538);}return _0x5b7e3b['save']();};}function saveUpdates(_0x458145,_0x215b80){return function(_0x41eeb4){if(_0x41eeb4){return _0x41eeb4[_0x18d5('0x21')](_0x458145)[_0x18d5('0x22')](function(_0x2e7d6b){return _0x2e7d6b;});}return null;};}function removeEntity(_0x4d37a5,_0x45bfc9){return function(_0x20f59c){if(_0x20f59c){return _0x20f59c['destroy']()[_0x18d5('0x22')](function(){var _0x37b9ab=_0x20f59c[_0x18d5('0x23')]({'plain':!![]});var _0x34cab9=_0x18d5('0x24');return db[_0x18d5('0x25')][_0x18d5('0x26')]({'where':{'type':_0x34cab9,'resourceId':_0x37b9ab['id']}})[_0x18d5('0x22')](function(){return _0x20f59c;});})[_0x18d5('0x22')](function(){_0x4d37a5[_0x18d5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x166f29,_0x3cb48b){return function(_0x45efb9){if(!_0x45efb9){_0x166f29['sendStatus'](0x194);}return _0x45efb9;};}function handleError(_0x1194be,_0x1e7954){_0x1e7954=_0x1e7954||0x1f4;return function(_0x109bc4){logger['error'](_0x109bc4[_0x18d5('0x27')]);if(_0x109bc4[_0x18d5('0x28')]){delete _0x109bc4[_0x18d5('0x28')];}_0x1194be[_0x18d5('0x17')](_0x1e7954)['send'](_0x109bc4);};}exports[_0x18d5('0x29')]=function(_0x429b3f,_0x4021fb){var _0x2fd446={},_0x1c5ae9={},_0x3eb25d={'count':0x0,'rows':[]};var _0x53bd76=_[_0x18d5('0x2a')](db[_0x18d5('0x2b')][_0x18d5('0x2c')],function(_0x2a0750){return{'name':_0x2a0750['fieldName'],'type':_0x2a0750[_0x18d5('0x2d')][_0x18d5('0x2e')]};});_0x1c5ae9[_0x18d5('0x2f')]=_[_0x18d5('0x2a')](_0x53bd76,_0x18d5('0x28'));_0x1c5ae9[_0x18d5('0x30')]=_[_0x18d5('0x31')](_0x429b3f[_0x18d5('0x30')]);_0x1c5ae9['filters']=_['intersection'](_0x1c5ae9[_0x18d5('0x2f')],_0x1c5ae9[_0x18d5('0x30')]);_0x2fd446['attributes']=_[_0x18d5('0x32')](_0x1c5ae9[_0x18d5('0x2f')],qs[_0x18d5('0x33')](_0x429b3f[_0x18d5('0x30')][_0x18d5('0x33')]));_0x2fd446['attributes']=_0x2fd446[_0x18d5('0x34')][_0x18d5('0x35')]?_0x2fd446[_0x18d5('0x34')]:_0x1c5ae9['model'];if(!_0x429b3f[_0x18d5('0x30')][_0x18d5('0x36')]('nolimit')){_0x2fd446[_0x18d5('0x1b')]=qs[_0x18d5('0x1b')](_0x429b3f[_0x18d5('0x30')][_0x18d5('0x1b')]);_0x2fd446[_0x18d5('0x19')]=qs[_0x18d5('0x19')](_0x429b3f[_0x18d5('0x30')][_0x18d5('0x19')]);}_0x2fd446[_0x18d5('0x37')]=qs[_0x18d5('0x38')](_0x429b3f[_0x18d5('0x30')][_0x18d5('0x38')]);_0x2fd446[_0x18d5('0x39')]=qs[_0x18d5('0x3a')](_['pick'](_0x429b3f[_0x18d5('0x30')],_0x1c5ae9[_0x18d5('0x3a')]),_0x53bd76);if(_0x429b3f[_0x18d5('0x30')]['filter']){_0x2fd446[_0x18d5('0x39')]=_[_0x18d5('0x3b')](_0x2fd446['where'],{'$or':[{'key':{'$like':'%'+_0x429b3f[_0x18d5('0x30')][_0x18d5('0x3c')]+'%'}},{'value':{'$like':'%'+_0x429b3f[_0x18d5('0x30')][_0x18d5('0x3c')]+'%'}}]});}_0x2fd446=_['merge']({},_0x2fd446,_0x429b3f['options']);var _0x3b68e5={'where':_0x2fd446[_0x18d5('0x39')]};return db[_0x18d5('0x2b')]['count'](_0x3b68e5)[_0x18d5('0x22')](function(_0x28fb4c){_0x3eb25d[_0x18d5('0x1c')]=_0x28fb4c;if(_0x429b3f[_0x18d5('0x30')]['includeAll']){_0x2fd446[_0x18d5('0x3d')]=[{'all':!![]}];}return db[_0x18d5('0x2b')][_0x18d5('0x3e')](_0x2fd446);})[_0x18d5('0x22')](function(_0x8812ed){_0x3eb25d[_0x18d5('0x3f')]=_0x8812ed;return _0x3eb25d;})[_0x18d5('0x22')](respondWithFilteredResult(_0x4021fb,_0x2fd446))[_0x18d5('0x40')](handleError(_0x4021fb,null));};exports['show']=function(_0x552fed,_0x2ef488){var _0x5da88f={'raw':!![],'where':{'id':_0x552fed[_0x18d5('0x41')]['id']}},_0x2f1943={};_0x2f1943[_0x18d5('0x2f')]=_['keys'](db[_0x18d5('0x2b')][_0x18d5('0x2c')]);_0x2f1943[_0x18d5('0x30')]=_[_0x18d5('0x31')](_0x552fed[_0x18d5('0x30')]);_0x2f1943['filters']=_[_0x18d5('0x32')](_0x2f1943[_0x18d5('0x2f')],_0x2f1943[_0x18d5('0x30')]);_0x5da88f[_0x18d5('0x34')]=_[_0x18d5('0x32')](_0x2f1943['model'],qs[_0x18d5('0x33')](_0x552fed[_0x18d5('0x30')]['fields']));_0x5da88f['attributes']=_0x5da88f[_0x18d5('0x34')][_0x18d5('0x35')]?_0x5da88f['attributes']:_0x2f1943[_0x18d5('0x2f')];if(_0x552fed[_0x18d5('0x30')][_0x18d5('0x42')]){_0x5da88f[_0x18d5('0x3d')]=[{'all':!![]}];}_0x5da88f=_[_0x18d5('0x3b')]({},_0x5da88f,_0x552fed[_0x18d5('0x43')]);return db['CannedAnswer'][_0x18d5('0x44')](_0x5da88f)[_0x18d5('0x22')](handleEntityNotFound(_0x2ef488,null))['then'](respondWithResult(_0x2ef488,null))[_0x18d5('0x40')](handleError(_0x2ef488,null));};exports['update']=function(_0x523971,_0x3fbbf6){if(_0x523971[_0x18d5('0x45')]['id']){delete _0x523971[_0x18d5('0x45')]['id'];}return db[_0x18d5('0x2b')][_0x18d5('0x44')]({'where':{'id':_0x523971['params']['id']}})[_0x18d5('0x22')](handleEntityNotFound(_0x3fbbf6,null))[_0x18d5('0x22')](saveUpdates(_0x523971[_0x18d5('0x45')],null))['then'](respondWithResult(_0x3fbbf6,null))[_0x18d5('0x40')](handleError(_0x3fbbf6,null));};exports[_0x18d5('0x26')]=function(_0x2da2c2,_0x2d10c8){return db[_0x18d5('0x2b')]['find']({'where':{'id':_0x2da2c2['params']['id']}})[_0x18d5('0x22')](handleEntityNotFound(_0x2d10c8,null))[_0x18d5('0x22')](removeEntity(_0x2d10c8,null))[_0x18d5('0x40')](handleError(_0x2d10c8,null));};exports[_0x18d5('0x46')]=function(_0x1a1942,_0x52ec84){var _0x474d47={'key':_0x1a1942[_0x18d5('0x45')]['key']};if(_0x1a1942[_0x18d5('0x45')][_0x18d5('0x47')]){_0x474d47[_0x18d5('0x47')]=_0x1a1942[_0x18d5('0x45')][_0x18d5('0x47')];}else if(_0x1a1942[_0x18d5('0x45')]['SmsAccountId']){_0x474d47['SmsAccountId']=_0x1a1942[_0x18d5('0x45')][_0x18d5('0x48')];}else if(_0x1a1942[_0x18d5('0x45')][_0x18d5('0x49')]){_0x474d47['OpenchannelAccountId']=_0x1a1942[_0x18d5('0x45')][_0x18d5('0x49')];}else if(_0x1a1942[_0x18d5('0x45')][_0x18d5('0x4a')]){_0x474d47['ChatWebsiteId']=_0x1a1942[_0x18d5('0x45')][_0x18d5('0x4a')];}return db[_0x18d5('0x2b')][_0x18d5('0x44')]({'where':_0x474d47})[_0x18d5('0x22')](function(_0x1c5d64){if(_0x1c5d64){throw new db[(_0x18d5('0x4b'))][(_0x18d5('0x4c'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x18d5('0x2b')][_0x18d5('0x46')](_0x1a1942[_0x18d5('0x45')]);})[_0x18d5('0x22')](function(_0x62f078){var _0x16b9ce=_0x1a1942[_0x18d5('0x4d')]['get']({'plain':!![]});if(!_0x16b9ce)throw new Error(_0x18d5('0x4e'));if(_0x16b9ce[_0x18d5('0x4f')]==='user'){var _0x177ec7=_0x62f078[_0x18d5('0x23')]({'plain':!![]});return db[_0x18d5('0x50')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x16b9ce['userProfileId']},'raw':!![]})[_0x18d5('0x22')](function(_0x5e186d){if(_0x5e186d&&_0x5e186d[_0x18d5('0x51')]===0x0){return db['UserProfileResource'][_0x18d5('0x46')]({'name':_0x177ec7[_0x18d5('0x28')],'resourceId':_0x177ec7['id'],'type':_0x5e186d[_0x18d5('0x28')],'sectionId':_0x5e186d['id']},{})[_0x18d5('0x22')](function(){return _0x62f078;});}else{return _0x62f078;}})[_0x18d5('0x40')](function(_0x145588){logger[_0x18d5('0x52')](_0x18d5('0x53'),_0x145588);throw _0x145588;});}return _0x62f078;})[_0x18d5('0x22')](respondWithResult(_0x52ec84,0xc9))[_0x18d5('0x40')](handleError(_0x52ec84,null));}; \ No newline at end of file +var _0xcf9d=['SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','crypto','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','CannedAnswers','UserProfileResource','end','error','name','send','map','CannedAnswer','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','update','body','create','key','MailAccountId'];(function(_0x5c38d6,_0xd8577){var _0x1fa864=function(_0x39c33d){while(--_0x39c33d){_0x5c38d6['push'](_0x5c38d6['shift']());}};_0x1fa864(++_0xd8577);}(_0xcf9d,0x105));var _0xdcf9=function(_0x27e147,_0x4ce2c5){_0x27e147=_0x27e147-0x0;var _0x3a3b5f=_0xcf9d[_0x27e147];return _0x3a3b5f;};'use strict';var emlformat=require(_0xdcf9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdcf9('0x1'));var jsonpatch=require(_0xdcf9('0x2'));var rp=require(_0xdcf9('0x3'));var moment=require(_0xdcf9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdcf9('0x5'));var path=require(_0xdcf9('0x6'));var sox=require(_0xdcf9('0x7'));var csv=require('to-csv');var ejs=require(_0xdcf9('0x8'));var fs=require('fs');var fs_extra=require(_0xdcf9('0x9'));var _=require(_0xdcf9('0xa'));var squel=require('squel');var crypto=require(_0xdcf9('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdcf9('0xc'));var authService=require(_0xdcf9('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xdcf9('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdcf9('0xf'))(_0xdcf9('0x10'));var utils=require(_0xdcf9('0x11'));var config=require(_0xdcf9('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xdcf9('0x13'))['db'];function respondWithStatusCode(_0x420e28,_0x2dff90){_0x2dff90=_0x2dff90||0xcc;return function(_0x4dc666){if(_0x4dc666){return _0x420e28[_0xdcf9('0x14')](_0x2dff90);}return _0x420e28[_0xdcf9('0x15')](_0x2dff90)['end']();};}function respondWithResult(_0x224d9f,_0x499260){_0x499260=_0x499260||0xc8;return function(_0xe8fbfd){if(_0xe8fbfd){return _0x224d9f[_0xdcf9('0x15')](_0x499260)[_0xdcf9('0x16')](_0xe8fbfd);}};}function respondWithFilteredResult(_0x151ed8,_0x52222a){return function(_0x123a41){if(_0x123a41){var _0xaa6d18=typeof _0x52222a[_0xdcf9('0x17')]===_0xdcf9('0x18')&&typeof _0x52222a[_0xdcf9('0x19')]==='undefined';var _0x4995bb=_0x123a41[_0xdcf9('0x1a')];var _0x1a14a6=_0xaa6d18?0x0:_0x52222a[_0xdcf9('0x17')];var _0x1b46e9=_0xaa6d18?_0x123a41['count']:_0x52222a[_0xdcf9('0x17')]+_0x52222a['limit'];var _0x4cc062;if(_0x1b46e9>=_0x4995bb){_0x1b46e9=_0x4995bb;_0x4cc062=0xc8;}else{_0x4cc062=0xce;}_0x151ed8[_0xdcf9('0x15')](_0x4cc062);return _0x151ed8[_0xdcf9('0x1b')](_0xdcf9('0x1c'),_0x1a14a6+'-'+_0x1b46e9+'/'+_0x4995bb)[_0xdcf9('0x16')](_0x123a41);}return null;};}function patchUpdates(_0x594258){return function(_0x40f8c6){try{jsonpatch[_0xdcf9('0x1d')](_0x40f8c6,_0x594258,!![]);}catch(_0xd98226){return BPromise['reject'](_0xd98226);}return _0x40f8c6[_0xdcf9('0x1e')]();};}function saveUpdates(_0x17d701,_0x9a7dc8){return function(_0x542c06){if(_0x542c06){return _0x542c06['update'](_0x17d701)[_0xdcf9('0x1f')](function(_0x13d818){return _0x13d818;});}return null;};}function removeEntity(_0x2e5199,_0x112a33){return function(_0x30ce20){if(_0x30ce20){return _0x30ce20[_0xdcf9('0x20')]()[_0xdcf9('0x1f')](function(){var _0x1ac563=_0x30ce20[_0xdcf9('0x21')]({'plain':!![]});var _0x92acc3=_0xdcf9('0x22');return db[_0xdcf9('0x23')][_0xdcf9('0x20')]({'where':{'type':_0x92acc3,'resourceId':_0x1ac563['id']}})[_0xdcf9('0x1f')](function(){return _0x30ce20;});})['then'](function(){_0x2e5199[_0xdcf9('0x15')](0xcc)[_0xdcf9('0x24')]();});}};}function handleEntityNotFound(_0x38d5c2,_0x8b070){return function(_0x23fcf4){if(!_0x23fcf4){_0x38d5c2[_0xdcf9('0x14')](0x194);}return _0x23fcf4;};}function handleError(_0x4ad97a,_0x1b5ef5){_0x1b5ef5=_0x1b5ef5||0x1f4;return function(_0x1c29af){logger[_0xdcf9('0x25')](_0x1c29af['stack']);if(_0x1c29af[_0xdcf9('0x26')]){delete _0x1c29af['name'];}_0x4ad97a[_0xdcf9('0x15')](_0x1b5ef5)[_0xdcf9('0x27')](_0x1c29af);};}exports['index']=function(_0x46d93f,_0x173b20){var _0x4407b1={},_0xc402c8={},_0x39c985={'count':0x0,'rows':[]};var _0x3c05ca=_[_0xdcf9('0x28')](db[_0xdcf9('0x29')][_0xdcf9('0x2a')],function(_0x502b99){return{'name':_0x502b99[_0xdcf9('0x2b')],'type':_0x502b99[_0xdcf9('0x2c')]['key']};});_0xc402c8[_0xdcf9('0x2d')]=_[_0xdcf9('0x28')](_0x3c05ca,'name');_0xc402c8[_0xdcf9('0x2e')]=_[_0xdcf9('0x2f')](_0x46d93f[_0xdcf9('0x2e')]);_0xc402c8[_0xdcf9('0x30')]=_[_0xdcf9('0x31')](_0xc402c8['model'],_0xc402c8['query']);_0x4407b1['attributes']=_[_0xdcf9('0x31')](_0xc402c8['model'],qs[_0xdcf9('0x32')](_0x46d93f[_0xdcf9('0x2e')][_0xdcf9('0x32')]));_0x4407b1['attributes']=_0x4407b1[_0xdcf9('0x33')][_0xdcf9('0x34')]?_0x4407b1[_0xdcf9('0x33')]:_0xc402c8['model'];if(!_0x46d93f[_0xdcf9('0x2e')][_0xdcf9('0x35')]('nolimit')){_0x4407b1[_0xdcf9('0x19')]=qs[_0xdcf9('0x19')](_0x46d93f['query'][_0xdcf9('0x19')]);_0x4407b1[_0xdcf9('0x17')]=qs[_0xdcf9('0x17')](_0x46d93f[_0xdcf9('0x2e')]['offset']);}_0x4407b1['order']=qs['sort'](_0x46d93f[_0xdcf9('0x2e')]['sort']);_0x4407b1['where']=qs[_0xdcf9('0x30')](_[_0xdcf9('0x36')](_0x46d93f[_0xdcf9('0x2e')],_0xc402c8[_0xdcf9('0x30')]),_0x3c05ca);if(_0x46d93f[_0xdcf9('0x2e')][_0xdcf9('0x37')]){_0x4407b1[_0xdcf9('0x38')]=_[_0xdcf9('0x39')](_0x4407b1['where'],{'$or':[{'key':{'$like':'%'+_0x46d93f[_0xdcf9('0x2e')][_0xdcf9('0x37')]+'%'}},{'value':{'$like':'%'+_0x46d93f[_0xdcf9('0x2e')][_0xdcf9('0x37')]+'%'}}]});}_0x4407b1=_[_0xdcf9('0x39')]({},_0x4407b1,_0x46d93f[_0xdcf9('0x3a')]);var _0x32ecff={'where':_0x4407b1['where']};return db[_0xdcf9('0x29')][_0xdcf9('0x1a')](_0x32ecff)[_0xdcf9('0x1f')](function(_0x57a9bf){_0x39c985[_0xdcf9('0x1a')]=_0x57a9bf;if(_0x46d93f[_0xdcf9('0x2e')][_0xdcf9('0x3b')]){_0x4407b1[_0xdcf9('0x3c')]=[{'all':!![]}];}return db['CannedAnswer'][_0xdcf9('0x3d')](_0x4407b1);})[_0xdcf9('0x1f')](function(_0x1de701){_0x39c985[_0xdcf9('0x3e')]=_0x1de701;return _0x39c985;})['then'](respondWithFilteredResult(_0x173b20,_0x4407b1))[_0xdcf9('0x3f')](handleError(_0x173b20,null));};exports['show']=function(_0x5c1360,_0x1310d5){var _0x2bdcd6={'raw':!![],'where':{'id':_0x5c1360[_0xdcf9('0x40')]['id']}},_0x41cbd8={};_0x41cbd8[_0xdcf9('0x2d')]=_[_0xdcf9('0x2f')](db[_0xdcf9('0x29')][_0xdcf9('0x2a')]);_0x41cbd8[_0xdcf9('0x2e')]=_['keys'](_0x5c1360[_0xdcf9('0x2e')]);_0x41cbd8[_0xdcf9('0x30')]=_[_0xdcf9('0x31')](_0x41cbd8[_0xdcf9('0x2d')],_0x41cbd8['query']);_0x2bdcd6['attributes']=_[_0xdcf9('0x31')](_0x41cbd8[_0xdcf9('0x2d')],qs[_0xdcf9('0x32')](_0x5c1360[_0xdcf9('0x2e')][_0xdcf9('0x32')]));_0x2bdcd6[_0xdcf9('0x33')]=_0x2bdcd6[_0xdcf9('0x33')][_0xdcf9('0x34')]?_0x2bdcd6['attributes']:_0x41cbd8['model'];if(_0x5c1360[_0xdcf9('0x2e')][_0xdcf9('0x3b')]){_0x2bdcd6[_0xdcf9('0x3c')]=[{'all':!![]}];}_0x2bdcd6=_[_0xdcf9('0x39')]({},_0x2bdcd6,_0x5c1360[_0xdcf9('0x3a')]);return db[_0xdcf9('0x29')][_0xdcf9('0x41')](_0x2bdcd6)[_0xdcf9('0x1f')](handleEntityNotFound(_0x1310d5,null))[_0xdcf9('0x1f')](respondWithResult(_0x1310d5,null))[_0xdcf9('0x3f')](handleError(_0x1310d5,null));};exports[_0xdcf9('0x42')]=function(_0x4fc71d,_0x354b85){if(_0x4fc71d[_0xdcf9('0x43')]['id']){delete _0x4fc71d[_0xdcf9('0x43')]['id'];}return db[_0xdcf9('0x29')][_0xdcf9('0x41')]({'where':{'id':_0x4fc71d['params']['id']}})[_0xdcf9('0x1f')](handleEntityNotFound(_0x354b85,null))['then'](saveUpdates(_0x4fc71d[_0xdcf9('0x43')],null))['then'](respondWithResult(_0x354b85,null))[_0xdcf9('0x3f')](handleError(_0x354b85,null));};exports[_0xdcf9('0x20')]=function(_0x2da8f9,_0x2165bc){return db[_0xdcf9('0x29')]['find']({'where':{'id':_0x2da8f9[_0xdcf9('0x40')]['id']}})[_0xdcf9('0x1f')](handleEntityNotFound(_0x2165bc,null))[_0xdcf9('0x1f')](removeEntity(_0x2165bc,null))[_0xdcf9('0x3f')](handleError(_0x2165bc,null));};exports[_0xdcf9('0x44')]=function(_0x42d356,_0x19663c){var _0x4e8154={'key':_0x42d356[_0xdcf9('0x43')][_0xdcf9('0x45')]};if(_0x42d356[_0xdcf9('0x43')][_0xdcf9('0x46')]){_0x4e8154['MailAccountId']=_0x42d356[_0xdcf9('0x43')][_0xdcf9('0x46')];}else if(_0x42d356[_0xdcf9('0x43')]['SmsAccountId']){_0x4e8154[_0xdcf9('0x47')]=_0x42d356[_0xdcf9('0x43')][_0xdcf9('0x47')];}else if(_0x42d356[_0xdcf9('0x43')]['OpenchannelAccountId']){_0x4e8154['OpenchannelAccountId']=_0x42d356[_0xdcf9('0x43')][_0xdcf9('0x48')];}else if(_0x42d356[_0xdcf9('0x43')][_0xdcf9('0x49')]){_0x4e8154[_0xdcf9('0x49')]=_0x42d356['body'][_0xdcf9('0x49')];}return db['CannedAnswer'][_0xdcf9('0x41')]({'where':_0x4e8154})[_0xdcf9('0x1f')](function(_0x215bd5){if(_0x215bd5){throw new db[(_0xdcf9('0x4a'))][(_0xdcf9('0x4b'))](_0xdcf9('0x4c'));}return db[_0xdcf9('0x29')]['create'](_0x42d356[_0xdcf9('0x43')]);})['then'](function(_0x27cc24){var _0xbbfaed=_0x42d356[_0xdcf9('0x4d')]['get']({'plain':!![]});if(!_0xbbfaed)throw new Error(_0xdcf9('0x4e'));if(_0xbbfaed[_0xdcf9('0x4f')]===_0xdcf9('0x4d')){var _0x2378c8=_0x27cc24[_0xdcf9('0x21')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xdcf9('0x22'),'userProfileId':_0xbbfaed[_0xdcf9('0x50')]},'raw':!![]})[_0xdcf9('0x1f')](function(_0x422498){if(_0x422498&&_0x422498[_0xdcf9('0x51')]===0x0){return db[_0xdcf9('0x23')][_0xdcf9('0x44')]({'name':_0x2378c8[_0xdcf9('0x26')],'resourceId':_0x2378c8['id'],'type':_0x422498['name'],'sectionId':_0x422498['id']},{})[_0xdcf9('0x1f')](function(){return _0x27cc24;});}else{return _0x27cc24;}})[_0xdcf9('0x3f')](function(_0x34398c){logger[_0xdcf9('0x25')](_0xdcf9('0x52'),_0x34398c);throw _0x34398c;});}return _0x27cc24;})[_0xdcf9('0x1f')](respondWithResult(_0x19663c,0xc9))[_0xdcf9('0x3f')](handleError(_0x19663c,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 0907b2e..4a6efed 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 _0x145d=['moment','request-promise','path','rimraf','./cannedAnswer.attributes','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x2014a6,_0x192c31){var _0x148b0e=function(_0x47a110){while(--_0x47a110){_0x2014a6['push'](_0x2014a6['shift']());}};_0x148b0e(++_0x192c31);}(_0x145d,0xc9));var _0xd145=function(_0x233d90,_0x34cf27){_0x233d90=_0x233d90-0x0;var _0x39d8ab=_0x145d[_0x233d90];return _0x39d8ab;};'use strict';var _=require('lodash');var util=require(_0xd145('0x0'));var logger=require(_0xd145('0x1'))(_0xd145('0x2'));var moment=require(_0xd145('0x3'));var BPromise=require('bluebird');var rp=require(_0xd145('0x4'));var fs=require('fs');var path=require(_0xd145('0x5'));var rimraf=require(_0xd145('0x6'));var config=require('../../config/environment');var attributes=require(_0xd145('0x7'));module['exports']=function(_0x3f5289,_0x36eb43){return _0x3f5289[_0xd145('0x8')](_0xd145('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd145('0xa'),'collate':_0xd145('0xb')});}; \ No newline at end of file +var _0x8921=['rimraf','../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8921,0x70));var _0x1892=function(_0x6478ba,_0x61342){_0x6478ba=_0x6478ba-0x0;var _0x2786c5=_0x8921[_0x6478ba];return _0x2786c5;};'use strict';var _=require('lodash');var util=require(_0x1892('0x0'));var logger=require('../../config/logger')(_0x1892('0x1'));var moment=require(_0x1892('0x2'));var BPromise=require(_0x1892('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1892('0x4'));var rimraf=require(_0x1892('0x5'));var config=require(_0x1892('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x1892('0x7')]=function(_0x1076c6,_0x3ce039){return _0x1076c6[_0x1892('0x8')](_0x1892('0x9'),attributes,{'tableName':_0x1892('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1892('0xb'),'collate':_0x1892('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 7f5fa8a..fd4d514 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(_0x3fdc43,_0x647d9c){var _0x4618d1=function(_0x943a94){while(--_0x943a94){_0x3fdc43['push'](_0x3fdc43['shift']());}};_0x4618d1(++_0x647d9c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x26cbb7,_0x3e0c3c){var _0x2b2f6e=function(_0x3b0c8f){while(--_0x3b0c8f){_0x26cbb7['push'](_0x26cbb7['shift']());}};_0x2b2f6e(++_0x3e0c3c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 e3d195a..4dc0844 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 _0x7be6=['express','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','get','/:id','put','update','delete','multer','connect-timeout'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x7be6,0xd0));var _0x67be=function(_0x7c8471,_0x17ee5b){_0x7c8471=_0x7c8471-0x0;var _0x2c3b2f=_0x7be6[_0x7c8471];return _0x2c3b2f;};'use strict';var multer=require(_0x67be('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x67be('0x1'));var express=require(_0x67be('0x2'));var router=express[_0x67be('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x67be('0x4'));var config=require(_0x67be('0x5'));var controller=require(_0x67be('0x6'));router['get']('/',auth[_0x67be('0x7')](),controller[_0x67be('0x8')]);router[_0x67be('0x9')](_0x67be('0xa'),auth[_0x67be('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x67be('0xb')](_0x67be('0xa'),auth[_0x67be('0x7')](),controller[_0x67be('0xc')]);router[_0x67be('0xd')](_0x67be('0xa'),auth[_0x67be('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x86eb=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./cannedAnswer.controller','get','isAuthenticated','index','show','post','create'];(function(_0x200d27,_0x1fe65f){var _0x4eda33=function(_0x171859){while(--_0x171859){_0x200d27['push'](_0x200d27['shift']());}};_0x4eda33(++_0x1fe65f);}(_0x86eb,0x92));var _0xb86e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x86eb[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb86e('0x0'));var util=require(_0xb86e('0x1'));var path=require(_0xb86e('0x2'));var timeout=require(_0xb86e('0x3'));var express=require(_0xb86e('0x4'));var router=express[_0xb86e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb86e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb86e('0x7'));router[_0xb86e('0x8')]('/',auth[_0xb86e('0x9')](),controller[_0xb86e('0xa')]);router['get']('/:id',auth[_0xb86e('0x9')](),controller[_0xb86e('0xb')]);router[_0xb86e('0xc')]('/',auth[_0xb86e('0x9')](),controller[_0xb86e('0xd')]);router[_0xb86e('0xe')](_0xb86e('0xf'),auth[_0xb86e('0x9')](),controller[_0xb86e('0x10')]);router[_0xb86e('0x11')](_0xb86e('0xf'),auth[_0xb86e('0x9')](),controller[_0xb86e('0x12')]);module[_0xb86e('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index f3366cc..4a82cc9 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 _0x275d=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x5260d4,_0x368a72){var _0x154880=function(_0x1f43df){while(--_0x1f43df){_0x5260d4['push'](_0x5260d4['shift']());}};_0x154880(++_0x368a72);}(_0x275d,0x1a6));var _0xd275=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x275d[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require(_0xd275('0x0'));module[_0xd275('0x1')]={'calldate':{'type':Sequelize[_0xd275('0x2')],'allowNull':![],'defaultValue':_0xd275('0x3')},'clid':{'type':Sequelize[_0xd275('0x4')]},'src':{'type':Sequelize[_0xd275('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xd275('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xd275('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xd275('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd275('0x4')]},'amaflags':{'type':Sequelize[_0xd275('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xd275('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xd275('0x4')]},'sequence':{'type':Sequelize[_0xd275('0x4')]},'peeraccount':{'type':Sequelize[_0xd275('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xef92=['STRING','INTEGER','sequelize','exports','DATE'];(function(_0x50e071,_0x5e7266){var _0x16fe58=function(_0x3a37e8){while(--_0x3a37e8){_0x50e071['push'](_0x50e071['shift']());}};_0x16fe58(++_0x5e7266);}(_0xef92,0xf2));var _0x2ef9=function(_0x1a74c3,_0x1a2ed9){_0x1a74c3=_0x1a74c3-0x0;var _0x42c213=_0xef92[_0x1a74c3];return _0x42c213;};'use strict';var Sequelize=require(_0x2ef9('0x0'));module[_0x2ef9('0x1')]={'calldate':{'type':Sequelize[_0x2ef9('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x2ef9('0x3')]},'dst':{'type':Sequelize[_0x2ef9('0x3')]},'dcontext':{'type':Sequelize[_0x2ef9('0x3')]},'channel':{'type':Sequelize[_0x2ef9('0x3')]},'dstchannel':{'type':Sequelize[_0x2ef9('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x2ef9('0x3')]},'duration':{'type':Sequelize[_0x2ef9('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2ef9('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2ef9('0x3')]},'amaflags':{'type':Sequelize[_0x2ef9('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x2ef9('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x2ef9('0x3')]},'peeraccount':{'type':Sequelize[_0x2ef9('0x3')]},'type':{'type':Sequelize[_0x2ef9('0x3')]},'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 b116342..7afaef7 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 _0x8819=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','zip-dir','fast-json-patch'];(function(_0x1d35ac,_0x1cf0fe){var _0x1857a1=function(_0x416faa){while(--_0x416faa){_0x1d35ac['push'](_0x1d35ac['shift']());}};_0x1857a1(++_0x1cf0fe);}(_0x8819,0x94));var _0x9881=function(_0x5718f6,_0x19ff8a){_0x5718f6=_0x5718f6-0x0;var _0x3dc4bd=_0x8819[_0x5718f6];return _0x3dc4bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9881('0x0'));var jsonpatch=require(_0x9881('0x1'));var rp=require(_0x9881('0x2'));var moment=require(_0x9881('0x3'));var BPromise=require(_0x9881('0x4'));var Mustache=require('mustache');var util=require(_0x9881('0x5'));var path=require(_0x9881('0x6'));var sox=require(_0x9881('0x7'));var csv=require(_0x9881('0x8'));var ejs=require(_0x9881('0x9'));var fs=require('fs');var fs_extra=require(_0x9881('0xa'));var _=require('lodash');var squel=require(_0x9881('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9881('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9881('0xd'));var Redis=require('ioredis');var authService=require(_0x9881('0xe'));var qs=require(_0x9881('0xf'));var as=require(_0x9881('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9881('0x11'))(_0x9881('0x12'));var utils=require(_0x9881('0x13'));var config=require(_0x9881('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9881('0x15'))['db'];function respondWithStatusCode(_0x26ee3f,_0x5c6d2d){_0x5c6d2d=_0x5c6d2d||0xcc;return function(_0x42850e){if(_0x42850e){return _0x26ee3f['sendStatus'](_0x5c6d2d);}return _0x26ee3f['status'](_0x5c6d2d)['end']();};}function respondWithResult(_0x58f526,_0x12794f){_0x12794f=_0x12794f||0xc8;return function(_0x3178d7){if(_0x3178d7){return _0x58f526[_0x9881('0x16')](_0x12794f)[_0x9881('0x17')](_0x3178d7);}};}function respondWithFilteredResult(_0x39d127,_0x1d57ea){return function(_0x4b9d1b){if(_0x4b9d1b){var _0x411513=typeof _0x1d57ea[_0x9881('0x18')]===_0x9881('0x19')&&typeof _0x1d57ea['limit']==='undefined';var _0x4c92c9=_0x4b9d1b[_0x9881('0x1a')];var _0x4c3493=_0x411513?0x0:_0x1d57ea[_0x9881('0x18')];var _0x5a9848=_0x411513?_0x4b9d1b['count']:_0x1d57ea[_0x9881('0x18')]+_0x1d57ea[_0x9881('0x1b')];var _0x1cbac3;if(_0x5a9848>=_0x4c92c9){_0x5a9848=_0x4c92c9;_0x1cbac3=0xc8;}else{_0x1cbac3=0xce;}_0x39d127[_0x9881('0x16')](_0x1cbac3);return _0x39d127[_0x9881('0x1c')](_0x9881('0x1d'),_0x4c3493+'-'+_0x5a9848+'/'+_0x4c92c9)[_0x9881('0x17')](_0x4b9d1b);}return null;};}function patchUpdates(_0x1243cc){return function(_0x1ee450){try{jsonpatch[_0x9881('0x1e')](_0x1ee450,_0x1243cc,!![]);}catch(_0x32ca84){return BPromise[_0x9881('0x1f')](_0x32ca84);}return _0x1ee450[_0x9881('0x20')]();};}function saveUpdates(_0x300fa6,_0x174b39){return function(_0x58485d){if(_0x58485d){return _0x58485d['update'](_0x300fa6)[_0x9881('0x21')](function(_0x513545){return _0x513545;});}return null;};}function removeEntity(_0x499461,_0x1ba558){return function(_0x30ed15){if(_0x30ed15){return _0x30ed15['destroy']()['then'](function(){_0x499461[_0x9881('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bddc1,_0x161f8d){return function(_0x16eeca){if(!_0x16eeca){_0x2bddc1[_0x9881('0x22')](0x194);}return _0x16eeca;};}function handleError(_0x2c3cd1,_0x14e6f9){_0x14e6f9=_0x14e6f9||0x1f4;return function(_0x2f6b7c){logger[_0x9881('0x23')](_0x2f6b7c[_0x9881('0x24')]);if(_0x2f6b7c[_0x9881('0x25')]){delete _0x2f6b7c[_0x9881('0x25')];}_0x2c3cd1[_0x9881('0x16')](_0x14e6f9)[_0x9881('0x26')](_0x2f6b7c);};}exports['index']=function(_0x31956e,_0x41fe0d){var _0x5c2815={},_0x236979={},_0x3d7120={'count':0x0,'rows':[]};var _0x4970be=_[_0x9881('0x27')](db[_0x9881('0x28')][_0x9881('0x29')],function(_0x204f2b){return{'name':_0x204f2b[_0x9881('0x2a')],'type':_0x204f2b[_0x9881('0x2b')][_0x9881('0x2c')]};});_0x236979[_0x9881('0x2d')]=_['map'](_0x4970be,_0x9881('0x25'));_0x236979[_0x9881('0x2e')]=_[_0x9881('0x2f')](_0x31956e[_0x9881('0x2e')]);_0x236979[_0x9881('0x30')]=_[_0x9881('0x31')](_0x236979['model'],_0x236979[_0x9881('0x2e')]);_0x5c2815[_0x9881('0x32')]=_['intersection'](_0x236979[_0x9881('0x2d')],qs[_0x9881('0x33')](_0x31956e[_0x9881('0x2e')][_0x9881('0x33')]));_0x5c2815[_0x9881('0x32')]=_0x5c2815['attributes'][_0x9881('0x34')]?_0x5c2815[_0x9881('0x32')]:_0x236979[_0x9881('0x2d')];if(!_0x31956e[_0x9881('0x2e')][_0x9881('0x35')](_0x9881('0x36'))){_0x5c2815[_0x9881('0x1b')]=qs[_0x9881('0x1b')](_0x31956e[_0x9881('0x2e')][_0x9881('0x1b')]);_0x5c2815[_0x9881('0x18')]=qs[_0x9881('0x18')](_0x31956e[_0x9881('0x2e')][_0x9881('0x18')]);}_0x5c2815[_0x9881('0x37')]=qs[_0x9881('0x38')](_0x31956e['query'][_0x9881('0x38')]);_0x5c2815['where']=qs[_0x9881('0x30')](_['pick'](_0x31956e[_0x9881('0x2e')],_0x236979[_0x9881('0x30')]),_0x4970be);if(_0x31956e['query'][_0x9881('0x39')]){_0x5c2815['where']=_[_0x9881('0x3a')](_0x5c2815[_0x9881('0x3b')],{'$or':_[_0x9881('0x27')](_0x4970be,function(_0x204fc3){if(_0x204fc3['type']!==_0x9881('0x3c')){var _0x3d183e={};_0x3d183e[_0x204fc3[_0x9881('0x25')]]={'$like':'%'+_0x31956e[_0x9881('0x2e')][_0x9881('0x39')]+'%'};return _0x3d183e;}})});}_0x5c2815=_[_0x9881('0x3a')]({},_0x5c2815,_0x31956e[_0x9881('0x3d')]);var _0x4feb70={'where':_0x5c2815[_0x9881('0x3b')]};return db['Cdr'][_0x9881('0x1a')](_0x4feb70)[_0x9881('0x21')](function(_0x1c0396){_0x3d7120['count']=_0x1c0396;if(_0x31956e[_0x9881('0x2e')][_0x9881('0x3e')]){_0x5c2815[_0x9881('0x3f')]=[{'all':!![]}];}return db['Cdr'][_0x9881('0x40')](_0x5c2815);})[_0x9881('0x21')](function(_0x4fe13d){_0x3d7120[_0x9881('0x41')]=_0x4fe13d;return _0x3d7120;})[_0x9881('0x21')](respondWithFilteredResult(_0x41fe0d,_0x5c2815))[_0x9881('0x42')](handleError(_0x41fe0d,null));};exports[_0x9881('0x43')]=function(_0x424ed1,_0x1eae2f){var _0x2ac606={'raw':!![],'where':{'id':_0x424ed1[_0x9881('0x44')]['id']}},_0x4421bc={};_0x4421bc[_0x9881('0x2d')]=_['keys'](db[_0x9881('0x28')][_0x9881('0x29')]);_0x4421bc[_0x9881('0x2e')]=_[_0x9881('0x2f')](_0x424ed1[_0x9881('0x2e')]);_0x4421bc['filters']=_[_0x9881('0x31')](_0x4421bc[_0x9881('0x2d')],_0x4421bc[_0x9881('0x2e')]);_0x2ac606[_0x9881('0x32')]=_['intersection'](_0x4421bc[_0x9881('0x2d')],qs[_0x9881('0x33')](_0x424ed1[_0x9881('0x2e')]['fields']));_0x2ac606[_0x9881('0x32')]=_0x2ac606[_0x9881('0x32')][_0x9881('0x34')]?_0x2ac606[_0x9881('0x32')]:_0x4421bc[_0x9881('0x2d')];if(_0x424ed1[_0x9881('0x2e')][_0x9881('0x3e')]){_0x2ac606[_0x9881('0x3f')]=[{'all':!![]}];}_0x2ac606=_[_0x9881('0x3a')]({},_0x2ac606,_0x424ed1[_0x9881('0x3d')]);return db['Cdr'][_0x9881('0x45')](_0x2ac606)[_0x9881('0x21')](handleEntityNotFound(_0x1eae2f,null))[_0x9881('0x21')](respondWithResult(_0x1eae2f,null))['catch'](handleError(_0x1eae2f,null));};exports[_0x9881('0x46')]=function(_0x24a52b,_0x1e1f0f){return db['Cdr']['create'](_0x24a52b[_0x9881('0x47')],{})[_0x9881('0x21')](respondWithResult(_0x1e1f0f,0xc9))[_0x9881('0x42')](handleError(_0x1e1f0f,null));};exports[_0x9881('0x48')]=function(_0x49c478,_0x514263){if(_0x49c478[_0x9881('0x47')]['id']){delete _0x49c478[_0x9881('0x47')]['id'];}return db[_0x9881('0x28')]['find']({'where':{'id':_0x49c478[_0x9881('0x44')]['id']}})[_0x9881('0x21')](handleEntityNotFound(_0x514263,null))['then'](saveUpdates(_0x49c478[_0x9881('0x47')],null))[_0x9881('0x21')](respondWithResult(_0x514263,null))[_0x9881('0x42')](handleError(_0x514263,null));};exports[_0x9881('0x49')]=function(_0x21720a,_0x32cb89){return db[_0x9881('0x28')]['find']({'where':{'id':_0x21720a[_0x9881('0x44')]['id']}})['then'](handleEntityNotFound(_0x32cb89,null))[_0x9881('0x21')](removeEntity(_0x32cb89,null))[_0x9881('0x42')](handleError(_0x32cb89,null));};exports[_0x9881('0x4a')]=function(_0x16ca26,_0x590acc){return db['Cdr'][_0x9881('0x4a')]()[_0x9881('0x21')](respondWithResult(_0x590acc,null))[_0x9881('0x42')](handleError(_0x590acc,null));}; \ No newline at end of file +var _0x8a28=['filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','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','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','Cdr','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick'];(function(_0x2c8df0,_0x32e64b){var _0x5753b1=function(_0x279686){while(--_0x279686){_0x2c8df0['push'](_0x2c8df0['shift']());}};_0x5753b1(++_0x32e64b);}(_0x8a28,0xfd));var _0x88a2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8a28[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x88a2('0x0'));var rimraf=require(_0x88a2('0x1'));var zipdir=require(_0x88a2('0x2'));var jsonpatch=require(_0x88a2('0x3'));var rp=require(_0x88a2('0x4'));var moment=require(_0x88a2('0x5'));var BPromise=require(_0x88a2('0x6'));var Mustache=require(_0x88a2('0x7'));var util=require('util');var path=require(_0x88a2('0x8'));var sox=require(_0x88a2('0x9'));var csv=require(_0x88a2('0xa'));var ejs=require(_0x88a2('0xb'));var fs=require('fs');var fs_extra=require(_0x88a2('0xc'));var _=require('lodash');var squel=require(_0x88a2('0xd'));var crypto=require('crypto');var jsforce=require(_0x88a2('0xe'));var deskjs=require(_0x88a2('0xf'));var toCsv=require(_0x88a2('0xa'));var querystring=require(_0x88a2('0x10'));var Papa=require(_0x88a2('0x11'));var Redis=require(_0x88a2('0x12'));var authService=require(_0x88a2('0x13'));var qs=require(_0x88a2('0x14'));var as=require(_0x88a2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x88a2('0x16'));var utils=require(_0x88a2('0x17'));var config=require(_0x88a2('0x18'));var licenseUtil=require(_0x88a2('0x19'));var db=require(_0x88a2('0x1a'))['db'];function respondWithStatusCode(_0x4887fc,_0x210a52){_0x210a52=_0x210a52||0xcc;return function(_0x1a4056){if(_0x1a4056){return _0x4887fc[_0x88a2('0x1b')](_0x210a52);}return _0x4887fc[_0x88a2('0x1c')](_0x210a52)['end']();};}function respondWithResult(_0x923706,_0x407ef0){_0x407ef0=_0x407ef0||0xc8;return function(_0x3b83ce){if(_0x3b83ce){return _0x923706['status'](_0x407ef0)[_0x88a2('0x1d')](_0x3b83ce);}};}function respondWithFilteredResult(_0x207b12,_0x462b7b){return function(_0x42facc){if(_0x42facc){var _0x1beccd=typeof _0x462b7b[_0x88a2('0x1e')]===_0x88a2('0x1f')&&typeof _0x462b7b[_0x88a2('0x20')]===_0x88a2('0x1f');var _0x417bf8=_0x42facc[_0x88a2('0x21')];var _0x3c030e=_0x1beccd?0x0:_0x462b7b[_0x88a2('0x1e')];var _0x29dc1b=_0x1beccd?_0x42facc[_0x88a2('0x21')]:_0x462b7b[_0x88a2('0x1e')]+_0x462b7b[_0x88a2('0x20')];var _0x46ed82;if(_0x29dc1b>=_0x417bf8){_0x29dc1b=_0x417bf8;_0x46ed82=0xc8;}else{_0x46ed82=0xce;}_0x207b12['status'](_0x46ed82);return _0x207b12[_0x88a2('0x22')](_0x88a2('0x23'),_0x3c030e+'-'+_0x29dc1b+'/'+_0x417bf8)['json'](_0x42facc);}return null;};}function patchUpdates(_0x499891){return function(_0x7a054c){try{jsonpatch[_0x88a2('0x24')](_0x7a054c,_0x499891,!![]);}catch(_0x102139){return BPromise[_0x88a2('0x25')](_0x102139);}return _0x7a054c[_0x88a2('0x26')]();};}function saveUpdates(_0x54c6ed,_0x3b6401){return function(_0xda54c4){if(_0xda54c4){return _0xda54c4[_0x88a2('0x27')](_0x54c6ed)[_0x88a2('0x28')](function(_0x4be832){return _0x4be832;});}return null;};}function removeEntity(_0x1f104c,_0x527744){return function(_0x5bbd79){if(_0x5bbd79){return _0x5bbd79[_0x88a2('0x29')]()[_0x88a2('0x28')](function(){_0x1f104c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1343fc,_0xac4afe){return function(_0x5be767){if(!_0x5be767){_0x1343fc[_0x88a2('0x1b')](0x194);}return _0x5be767;};}function handleError(_0x4427a1,_0x2ba881){_0x2ba881=_0x2ba881||0x1f4;return function(_0x2474fc){logger['error'](_0x2474fc[_0x88a2('0x2a')]);if(_0x2474fc['name']){delete _0x2474fc[_0x88a2('0x2b')];}_0x4427a1[_0x88a2('0x1c')](_0x2ba881)[_0x88a2('0x2c')](_0x2474fc);};}exports['index']=function(_0x165259,_0x3eca1a){var _0x4c441a={},_0x21bd1b={},_0x537a8f={'count':0x0,'rows':[]};var _0x541cd0=_['map'](db[_0x88a2('0x2d')][_0x88a2('0x2e')],function(_0x1ceaab){return{'name':_0x1ceaab[_0x88a2('0x2f')],'type':_0x1ceaab[_0x88a2('0x30')][_0x88a2('0x31')]};});_0x21bd1b['model']=_[_0x88a2('0x32')](_0x541cd0,_0x88a2('0x2b'));_0x21bd1b[_0x88a2('0x33')]=_[_0x88a2('0x34')](_0x165259[_0x88a2('0x33')]);_0x21bd1b[_0x88a2('0x35')]=_[_0x88a2('0x36')](_0x21bd1b[_0x88a2('0x37')],_0x21bd1b[_0x88a2('0x33')]);_0x4c441a[_0x88a2('0x38')]=_['intersection'](_0x21bd1b['model'],qs[_0x88a2('0x39')](_0x165259[_0x88a2('0x33')][_0x88a2('0x39')]));_0x4c441a['attributes']=_0x4c441a[_0x88a2('0x38')][_0x88a2('0x3a')]?_0x4c441a['attributes']:_0x21bd1b[_0x88a2('0x37')];if(!_0x165259[_0x88a2('0x33')][_0x88a2('0x3b')]('nolimit')){_0x4c441a['limit']=qs[_0x88a2('0x20')](_0x165259[_0x88a2('0x33')]['limit']);_0x4c441a[_0x88a2('0x1e')]=qs[_0x88a2('0x1e')](_0x165259[_0x88a2('0x33')][_0x88a2('0x1e')]);}_0x4c441a[_0x88a2('0x3c')]=qs[_0x88a2('0x3d')](_0x165259[_0x88a2('0x33')][_0x88a2('0x3d')]);_0x4c441a['where']=qs[_0x88a2('0x35')](_[_0x88a2('0x3e')](_0x165259['query'],_0x21bd1b[_0x88a2('0x35')]),_0x541cd0);if(_0x165259[_0x88a2('0x33')][_0x88a2('0x3f')]){_0x4c441a[_0x88a2('0x40')]=_[_0x88a2('0x41')](_0x4c441a[_0x88a2('0x40')],{'$or':_[_0x88a2('0x32')](_0x541cd0,function(_0x21828b){if(_0x21828b[_0x88a2('0x30')]!==_0x88a2('0x42')){var _0x120e17={};_0x120e17[_0x21828b[_0x88a2('0x2b')]]={'$like':'%'+_0x165259[_0x88a2('0x33')][_0x88a2('0x3f')]+'%'};return _0x120e17;}})});}_0x4c441a=_[_0x88a2('0x41')]({},_0x4c441a,_0x165259[_0x88a2('0x43')]);var _0x1496d9={'where':_0x4c441a[_0x88a2('0x40')]};return db[_0x88a2('0x2d')][_0x88a2('0x21')](_0x1496d9)[_0x88a2('0x28')](function(_0x201591){_0x537a8f[_0x88a2('0x21')]=_0x201591;if(_0x165259[_0x88a2('0x33')][_0x88a2('0x44')]){_0x4c441a['include']=[{'all':!![]}];}return db['Cdr'][_0x88a2('0x45')](_0x4c441a);})[_0x88a2('0x28')](function(_0x555415){_0x537a8f[_0x88a2('0x46')]=_0x555415;return _0x537a8f;})[_0x88a2('0x28')](respondWithFilteredResult(_0x3eca1a,_0x4c441a))[_0x88a2('0x47')](handleError(_0x3eca1a,null));};exports[_0x88a2('0x48')]=function(_0x339648,_0x33a5c7){var _0x4d9726={'raw':!![],'where':{'id':_0x339648[_0x88a2('0x49')]['id']}},_0x23f8c8={};_0x23f8c8[_0x88a2('0x37')]=_['keys'](db[_0x88a2('0x2d')][_0x88a2('0x2e')]);_0x23f8c8[_0x88a2('0x33')]=_[_0x88a2('0x34')](_0x339648['query']);_0x23f8c8[_0x88a2('0x35')]=_[_0x88a2('0x36')](_0x23f8c8[_0x88a2('0x37')],_0x23f8c8[_0x88a2('0x33')]);_0x4d9726[_0x88a2('0x38')]=_[_0x88a2('0x36')](_0x23f8c8[_0x88a2('0x37')],qs[_0x88a2('0x39')](_0x339648[_0x88a2('0x33')][_0x88a2('0x39')]));_0x4d9726[_0x88a2('0x38')]=_0x4d9726[_0x88a2('0x38')][_0x88a2('0x3a')]?_0x4d9726[_0x88a2('0x38')]:_0x23f8c8[_0x88a2('0x37')];if(_0x339648[_0x88a2('0x33')][_0x88a2('0x44')]){_0x4d9726[_0x88a2('0x4a')]=[{'all':!![]}];}_0x4d9726=_[_0x88a2('0x41')]({},_0x4d9726,_0x339648[_0x88a2('0x43')]);return db['Cdr'][_0x88a2('0x4b')](_0x4d9726)['then'](handleEntityNotFound(_0x33a5c7,null))[_0x88a2('0x28')](respondWithResult(_0x33a5c7,null))['catch'](handleError(_0x33a5c7,null));};exports[_0x88a2('0x4c')]=function(_0x25dad5,_0x1c5e6b){return db[_0x88a2('0x2d')][_0x88a2('0x4c')](_0x25dad5[_0x88a2('0x4d')],{})[_0x88a2('0x28')](respondWithResult(_0x1c5e6b,0xc9))[_0x88a2('0x47')](handleError(_0x1c5e6b,null));};exports['update']=function(_0x1d773c,_0x1cc256){if(_0x1d773c['body']['id']){delete _0x1d773c[_0x88a2('0x4d')]['id'];}return db['Cdr'][_0x88a2('0x4b')]({'where':{'id':_0x1d773c['params']['id']}})[_0x88a2('0x28')](handleEntityNotFound(_0x1cc256,null))[_0x88a2('0x28')](saveUpdates(_0x1d773c[_0x88a2('0x4d')],null))[_0x88a2('0x28')](respondWithResult(_0x1cc256,null))[_0x88a2('0x47')](handleError(_0x1cc256,null));};exports[_0x88a2('0x29')]=function(_0x39bffe,_0x2fbdf4){return db[_0x88a2('0x2d')][_0x88a2('0x4b')]({'where':{'id':_0x39bffe[_0x88a2('0x49')]['id']}})[_0x88a2('0x28')](handleEntityNotFound(_0x2fbdf4,null))['then'](removeEntity(_0x2fbdf4,null))['catch'](handleError(_0x2fbdf4,null));};exports[_0x88a2('0x4e')]=function(_0x889d30,_0x20f198){return db[_0x88a2('0x2d')][_0x88a2('0x4e')]()['then'](respondWithResult(_0x20f198,null))[_0x88a2('0x47')](handleError(_0x20f198,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index c789cde..2d5bc3a 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x151815,_0x4de8f8){var _0x453d93=function(_0x29f7f5){while(--_0x29f7f5){_0x151815['push'](_0x151815['shift']());}};_0x453d93(++_0x4de8f8);}(_0x7a54,0x106));var _0x47a5=function(_0x3be185,_0x5b4cee){_0x3be185=_0x3be185-0x0;var _0x361cda=_0x7a54[_0x3be185];return _0x361cda;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x4a50d5,_0x56c238){var _0xe29c91=function(_0x3719e6){while(--_0x3719e6){_0x4a50d5['push'](_0x4a50d5['shift']());}};_0xe29c91(++_0x56c238);}(_0x7a54,0x106));var _0x47a5=function(_0x215d2a,_0x57402b){_0x215d2a=_0x215d2a-0x0;var _0x1c3572=_0x7a54[_0x215d2a];return _0x1c3572;};'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 1923f31..a237f7f 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 _0xb490=['info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb490,0x163));var _0x0b49=function(_0x2ec9b7,_0x4d8be6){_0x2ec9b7=_0x2ec9b7-0x0;var _0x57c6fe=_0xb490[_0x2ec9b7];return _0x57c6fe;};'use strict';var _=require(_0x0b49('0x0'));var util=require('util');var moment=require(_0x0b49('0x1'));var BPromise=require(_0x0b49('0x2'));var rs=require(_0x0b49('0x3'));var fs=require('fs');var Redis=require(_0x0b49('0x4'));var db=require(_0x0b49('0x5'))['db'];var utils=require(_0x0b49('0x6'));var logger=require('../../config/logger')(_0x0b49('0x7'));var config=require(_0x0b49('0x8'));var jayson=require(_0x0b49('0x9'));var client=jayson[_0x0b49('0xa')][_0x0b49('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17c9a4,_0x3db610,_0x161e8e){return new BPromise(function(_0x5f026d,_0xcf82d6){return client['request'](_0x17c9a4,_0x161e8e)[_0x0b49('0xc')](function(_0x2a793e){logger[_0x0b49('0xd')](_0x0b49('0xe'),_0x3db610,_0x0b49('0xf'));logger[_0x0b49('0x10')](_0x0b49('0x11'),_0x3db610,_0x0b49('0xf'),JSON[_0x0b49('0x12')](_0x2a793e));if(_0x2a793e[_0x0b49('0x13')]){if(_0x2a793e[_0x0b49('0x13')][_0x0b49('0x14')]===0x1f4){logger['error'](_0x0b49('0xe'),_0x3db610,_0x2a793e[_0x0b49('0x13')]['message']);return _0xcf82d6(_0x2a793e[_0x0b49('0x13')][_0x0b49('0x15')]);}logger[_0x0b49('0x13')](_0x0b49('0xe'),_0x3db610,_0x2a793e[_0x0b49('0x13')][_0x0b49('0x15')]);return _0x5f026d(_0x2a793e[_0x0b49('0x13')]['message']);}else{logger[_0x0b49('0xd')](_0x0b49('0xe'),_0x3db610,_0x0b49('0xf'));_0x5f026d(_0x2a793e['result'][_0x0b49('0x15')]);}})[_0x0b49('0x16')](function(_0x1983bb){logger[_0x0b49('0x13')](_0x0b49('0xe'),_0x3db610,_0x1983bb);_0xcf82d6(_0x1983bb);});});} \ No newline at end of file +var _0x301b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x135166,_0x4094d8){var _0x1b6677=function(_0xb3eae0){while(--_0xb3eae0){_0x135166['push'](_0x135166['shift']());}};_0x1b6677(++_0x4094d8);}(_0x301b,0xa4));var _0xb301=function(_0x20270e,_0x172076){_0x20270e=_0x20270e-0x0;var _0x22e10a=_0x301b[_0x20270e];return _0x22e10a;};'use strict';var _=require(_0xb301('0x0'));var util=require(_0xb301('0x1'));var moment=require(_0xb301('0x2'));var BPromise=require(_0xb301('0x3'));var rs=require(_0xb301('0x4'));var fs=require('fs');var Redis=require(_0xb301('0x5'));var db=require(_0xb301('0x6'))['db'];var utils=require(_0xb301('0x7'));var logger=require(_0xb301('0x8'))(_0xb301('0x9'));var config=require('../../config/environment');var jayson=require(_0xb301('0xa'));var client=jayson[_0xb301('0xb')][_0xb301('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e29f8,_0x125b49,_0x15ef9a){return new BPromise(function(_0x250adb,_0x52a22f){return client['request'](_0x4e29f8,_0x15ef9a)['then'](function(_0xb887e0){logger[_0xb301('0xd')](_0xb301('0xe'),_0x125b49,_0xb301('0xf'));logger[_0xb301('0x10')](_0xb301('0x11'),_0x125b49,_0xb301('0xf'),JSON[_0xb301('0x12')](_0xb887e0));if(_0xb887e0[_0xb301('0x13')]){if(_0xb887e0[_0xb301('0x13')][_0xb301('0x14')]===0x1f4){logger[_0xb301('0x13')](_0xb301('0xe'),_0x125b49,_0xb887e0['error']['message']);return _0x52a22f(_0xb887e0[_0xb301('0x13')][_0xb301('0x15')]);}logger[_0xb301('0x13')]('Cdr,\x20%s,\x20%s',_0x125b49,_0xb887e0[_0xb301('0x13')][_0xb301('0x15')]);return _0x250adb(_0xb887e0[_0xb301('0x13')][_0xb301('0x15')]);}else{logger[_0xb301('0xd')](_0xb301('0xe'),_0x125b49,_0xb301('0xf'));_0x250adb(_0xb887e0[_0xb301('0x16')][_0xb301('0x15')]);}})[_0xb301('0x17')](function(_0x2ecd53){logger[_0xb301('0x13')](_0xb301('0xe'),_0x125b49,_0x2ecd53);_0x52a22f(_0x2ecd53);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 9126705..d07b632 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x49429e,_0x457393){var _0x1a42eb=function(_0x525d78){while(--_0x525d78){_0x49429e['push'](_0x49429e['shift']());}};_0x1a42eb(++_0x457393);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c60bd,_0x207c9b){_0x1c60bd=_0x1c60bd-0x0;var _0xc46ef9=_0xb10b[_0x1c60bd];return _0xc46ef9;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x43faf3,_0x579bbe){var _0x404b76=function(_0x459dbd){while(--_0x459dbd){_0x43faf3['push'](_0x43faf3['shift']());}};_0x404b76(++_0x579bbe);}(_0xb10b,0x12a));var _0xbb10=function(_0x2bb452,_0x2dbbc0){_0x2bb452=_0x2bb452-0x0;var _0x5f50a6=_0xb10b[_0x2bb452];return _0x5f50a6;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 41afc6e..fde9086 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 _0xeb9e=['STRING','TEXT','*,*,*,*','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xeb9e,0x17b));var _0xeeb9=function(_0xd83d62,_0x30b3c6){_0xd83d62=_0xd83d62-0x0;var _0xec58f3=_0xeb9e[_0xd83d62];return _0xec58f3;};'use strict';var Sequelize=require('sequelize');module[_0xeeb9('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xeeb9('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xeeb9('0x2')]()},'description':{'type':Sequelize[_0xeeb9('0x1')]},'interval':{'type':Sequelize[_0xeeb9('0x1')],'defaultValue':_0xeeb9('0x3')}}; \ No newline at end of file +var _0x9a52=['exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9a52,0x145));var _0x29a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a52[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x29a5('0x0')]={'priority':{'type':Sequelize[_0x29a5('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x29a5('0x2')],'allowNull':![],'defaultValue':_0x29a5('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x29a5('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x29a5('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 43f23d0..994bb3e 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 _0xab3a=['find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','status','end','undefined','count','offset','limit','Content-Range','json','apply','update','then','destroy','sendStatus','stack','name','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include'];(function(_0x176d14,_0x3984ea){var _0x89522c=function(_0x3aba48){while(--_0x3aba48){_0x176d14['push'](_0x176d14['shift']());}};_0x89522c(++_0x3984ea);}(_0xab3a,0x1d3));var _0xaab3=function(_0x2c61a2,_0x40fe37){_0x2c61a2=_0x2c61a2-0x0;var _0x28bf7c=_0xab3a[_0x2c61a2];return _0x28bf7c;};'use strict';var emlformat=require(_0xaab3('0x0'));var rimraf=require(_0xaab3('0x1'));var zipdir=require(_0xaab3('0x2'));var jsonpatch=require(_0xaab3('0x3'));var rp=require(_0xaab3('0x4'));var moment=require(_0xaab3('0x5'));var BPromise=require(_0xaab3('0x6'));var Mustache=require(_0xaab3('0x7'));var util=require(_0xaab3('0x8'));var path=require(_0xaab3('0x9'));var sox=require(_0xaab3('0xa'));var csv=require(_0xaab3('0xb'));var ejs=require(_0xaab3('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaab3('0xd'));var crypto=require(_0xaab3('0xe'));var jsforce=require(_0xaab3('0xf'));var deskjs=require(_0xaab3('0x10'));var toCsv=require(_0xaab3('0xb'));var querystring=require(_0xaab3('0x11'));var Papa=require(_0xaab3('0x12'));var Redis=require(_0xaab3('0x13'));var authService=require(_0xaab3('0x14'));var qs=require(_0xaab3('0x15'));var as=require(_0xaab3('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaab3('0x17'));var utils=require(_0xaab3('0x18'));var config=require(_0xaab3('0x19'));var licenseUtil=require(_0xaab3('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c9bab,_0x536fd2){_0x536fd2=_0x536fd2||0xcc;return function(_0x1be7b2){if(_0x1be7b2){return _0x2c9bab['sendStatus'](_0x536fd2);}return _0x2c9bab[_0xaab3('0x1b')](_0x536fd2)[_0xaab3('0x1c')]();};}function respondWithResult(_0x4ccbf5,_0x553449){_0x553449=_0x553449||0xc8;return function(_0x43ca09){if(_0x43ca09){return _0x4ccbf5[_0xaab3('0x1b')](_0x553449)['json'](_0x43ca09);}};}function respondWithFilteredResult(_0x2d215e,_0xcc28ed){return function(_0x2aea7a){if(_0x2aea7a){var _0x5dbe3e=typeof _0xcc28ed['offset']==='undefined'&&typeof _0xcc28ed['limit']===_0xaab3('0x1d');var _0x3c5d63=_0x2aea7a[_0xaab3('0x1e')];var _0x5a3ecc=_0x5dbe3e?0x0:_0xcc28ed[_0xaab3('0x1f')];var _0x46aefc=_0x5dbe3e?_0x2aea7a[_0xaab3('0x1e')]:_0xcc28ed[_0xaab3('0x1f')]+_0xcc28ed[_0xaab3('0x20')];var _0x4c0d11;if(_0x46aefc>=_0x3c5d63){_0x46aefc=_0x3c5d63;_0x4c0d11=0xc8;}else{_0x4c0d11=0xce;}_0x2d215e[_0xaab3('0x1b')](_0x4c0d11);return _0x2d215e['set'](_0xaab3('0x21'),_0x5a3ecc+'-'+_0x46aefc+'/'+_0x3c5d63)[_0xaab3('0x22')](_0x2aea7a);}return null;};}function patchUpdates(_0x43a8d4){return function(_0x3588a9){try{jsonpatch[_0xaab3('0x23')](_0x3588a9,_0x43a8d4,!![]);}catch(_0x537701){return BPromise['reject'](_0x537701);}return _0x3588a9['save']();};}function saveUpdates(_0x5c5d8b,_0x5d7bf6){return function(_0x1fa934){if(_0x1fa934){return _0x1fa934[_0xaab3('0x24')](_0x5c5d8b)[_0xaab3('0x25')](function(_0x3a3000){return _0x3a3000;});}return null;};}function removeEntity(_0xaebe3e,_0x1816ab){return function(_0x3c552f){if(_0x3c552f){return _0x3c552f[_0xaab3('0x26')]()[_0xaab3('0x25')](function(){_0xaebe3e[_0xaab3('0x1b')](0xcc)[_0xaab3('0x1c')]();});}};}function handleEntityNotFound(_0x3097ec,_0x1199c1){return function(_0x4dd8fe){if(!_0x4dd8fe){_0x3097ec[_0xaab3('0x27')](0x194);}return _0x4dd8fe;};}function handleError(_0x599316,_0x28eaff){_0x28eaff=_0x28eaff||0x1f4;return function(_0x2904f8){logger['error'](_0x2904f8[_0xaab3('0x28')]);if(_0x2904f8[_0xaab3('0x29')]){delete _0x2904f8[_0xaab3('0x29')];}_0x599316['status'](_0x28eaff)['send'](_0x2904f8);};}exports[_0xaab3('0x2a')]=function(_0x205996,_0x2738ea){var _0x4a7558={'raw':!![],'where':{'id':_0x205996[_0xaab3('0x2b')]['id']}},_0x168eb0={};_0x168eb0[_0xaab3('0x2c')]=_[_0xaab3('0x2d')](db[_0xaab3('0x2e')][_0xaab3('0x2f')]);_0x168eb0[_0xaab3('0x30')]=_[_0xaab3('0x2d')](_0x205996[_0xaab3('0x30')]);_0x168eb0[_0xaab3('0x31')]=_[_0xaab3('0x32')](_0x168eb0[_0xaab3('0x2c')],_0x168eb0[_0xaab3('0x30')]);_0x4a7558[_0xaab3('0x33')]=_['intersection'](_0x168eb0[_0xaab3('0x2c')],qs[_0xaab3('0x34')](_0x205996[_0xaab3('0x30')][_0xaab3('0x34')]));_0x4a7558[_0xaab3('0x33')]=_0x4a7558[_0xaab3('0x33')]['length']?_0x4a7558[_0xaab3('0x33')]:_0x168eb0['model'];if(_0x205996['query'][_0xaab3('0x35')]){_0x4a7558[_0xaab3('0x36')]=[{'all':!![]}];}_0x4a7558=_['merge']({},_0x4a7558,_0x205996['options']);return db[_0xaab3('0x2e')][_0xaab3('0x37')](_0x4a7558)[_0xaab3('0x25')](handleEntityNotFound(_0x2738ea,null))['then'](respondWithResult(_0x2738ea,null))[_0xaab3('0x38')](handleError(_0x2738ea,null));};exports[_0xaab3('0x24')]=function(_0x1092b0,_0x5a7f3f){if(_0x1092b0['body']['id']){delete _0x1092b0[_0xaab3('0x39')]['id'];}return db[_0xaab3('0x2e')][_0xaab3('0x37')]({'where':{'id':_0x1092b0[_0xaab3('0x2b')]['id']}})[_0xaab3('0x25')](handleEntityNotFound(_0x5a7f3f,null))[_0xaab3('0x25')](saveUpdates(_0x1092b0['body'],null))[_0xaab3('0x25')](respondWithResult(_0x5a7f3f,null))[_0xaab3('0x38')](handleError(_0x5a7f3f,null));};exports[_0xaab3('0x26')]=function(_0x4f0aa3,_0x2fa351){return db[_0xaab3('0x2e')][_0xaab3('0x37')]({'where':{'id':_0x4f0aa3[_0xaab3('0x2b')]['id']}})[_0xaab3('0x25')](handleEntityNotFound(_0x2fa351,null))[_0xaab3('0x25')](removeEntity(_0x2fa351,null))['catch'](handleError(_0x2fa351,null));}; \ No newline at end of file +var _0x83e1=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','show','model','ChatApplication','rawAttributes','keys','intersection','attributes','fields','query','length','include','merge','find','catch','body','params','eml-format','rimraf','fast-json-patch','moment','util','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x540277,_0xfd2105){var _0x584fda=function(_0xea4e77){while(--_0xea4e77){_0x540277['push'](_0x540277['shift']());}};_0x584fda(++_0xfd2105);}(_0x83e1,0x1ad));var _0x183e=function(_0x28942a,_0x454774){_0x28942a=_0x28942a-0x0;var _0x5f1b09=_0x83e1[_0x28942a];return _0x5f1b09;};'use strict';var emlformat=require(_0x183e('0x0'));var rimraf=require(_0x183e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x183e('0x2'));var rp=require('request-promise');var moment=require(_0x183e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x183e('0x4'));var path=require(_0x183e('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x183e('0x6'));var _=require(_0x183e('0x7'));var squel=require(_0x183e('0x8'));var crypto=require('crypto');var jsforce=require(_0x183e('0x9'));var deskjs=require(_0x183e('0xa'));var toCsv=require(_0x183e('0xb'));var querystring=require('querystring');var Papa=require(_0x183e('0xc'));var Redis=require(_0x183e('0xd'));var authService=require(_0x183e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x183e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x183e('0x10'))(_0x183e('0x11'));var utils=require(_0x183e('0x12'));var config=require(_0x183e('0x13'));var licenseUtil=require(_0x183e('0x14'));var db=require(_0x183e('0x15'))['db'];function respondWithStatusCode(_0x192605,_0x5b86b3){_0x5b86b3=_0x5b86b3||0xcc;return function(_0x53e576){if(_0x53e576){return _0x192605['sendStatus'](_0x5b86b3);}return _0x192605[_0x183e('0x16')](_0x5b86b3)[_0x183e('0x17')]();};}function respondWithResult(_0x1aae2f,_0x5d4941){_0x5d4941=_0x5d4941||0xc8;return function(_0x140a70){if(_0x140a70){return _0x1aae2f[_0x183e('0x16')](_0x5d4941)[_0x183e('0x18')](_0x140a70);}};}function respondWithFilteredResult(_0x51b258,_0x8f4af8){return function(_0x35badd){if(_0x35badd){var _0x3faadf=typeof _0x8f4af8[_0x183e('0x19')]===_0x183e('0x1a')&&typeof _0x8f4af8[_0x183e('0x1b')]===_0x183e('0x1a');var _0x271d11=_0x35badd['count'];var _0x27d487=_0x3faadf?0x0:_0x8f4af8[_0x183e('0x19')];var _0x322f56=_0x3faadf?_0x35badd[_0x183e('0x1c')]:_0x8f4af8[_0x183e('0x19')]+_0x8f4af8[_0x183e('0x1b')];var _0x5d3de1;if(_0x322f56>=_0x271d11){_0x322f56=_0x271d11;_0x5d3de1=0xc8;}else{_0x5d3de1=0xce;}_0x51b258[_0x183e('0x16')](_0x5d3de1);return _0x51b258[_0x183e('0x1d')](_0x183e('0x1e'),_0x27d487+'-'+_0x322f56+'/'+_0x271d11)[_0x183e('0x18')](_0x35badd);}return null;};}function patchUpdates(_0x4cf0da){return function(_0x4d8102){try{jsonpatch['apply'](_0x4d8102,_0x4cf0da,!![]);}catch(_0x4dc915){return BPromise[_0x183e('0x1f')](_0x4dc915);}return _0x4d8102['save']();};}function saveUpdates(_0x553fee,_0xc96e61){return function(_0x34a128){if(_0x34a128){return _0x34a128[_0x183e('0x20')](_0x553fee)[_0x183e('0x21')](function(_0x4031d8){return _0x4031d8;});}return null;};}function removeEntity(_0x4ea291,_0x223351){return function(_0x5d6b29){if(_0x5d6b29){return _0x5d6b29[_0x183e('0x22')]()[_0x183e('0x21')](function(){_0x4ea291[_0x183e('0x16')](0xcc)[_0x183e('0x17')]();});}};}function handleEntityNotFound(_0x5a0d1d,_0x5eda06){return function(_0x7b9a98){if(!_0x7b9a98){_0x5a0d1d[_0x183e('0x23')](0x194);}return _0x7b9a98;};}function handleError(_0x4b5467,_0x5457ed){_0x5457ed=_0x5457ed||0x1f4;return function(_0x14522f){logger[_0x183e('0x24')](_0x14522f[_0x183e('0x25')]);if(_0x14522f['name']){delete _0x14522f[_0x183e('0x26')];}_0x4b5467[_0x183e('0x16')](_0x5457ed)[_0x183e('0x27')](_0x14522f);};}exports[_0x183e('0x28')]=function(_0x26de99,_0x1f8603){var _0x2f9657={'raw':!![],'where':{'id':_0x26de99['params']['id']}},_0x1bc636={};_0x1bc636[_0x183e('0x29')]=_['keys'](db[_0x183e('0x2a')][_0x183e('0x2b')]);_0x1bc636['query']=_[_0x183e('0x2c')](_0x26de99['query']);_0x1bc636['filters']=_[_0x183e('0x2d')](_0x1bc636['model'],_0x1bc636['query']);_0x2f9657[_0x183e('0x2e')]=_[_0x183e('0x2d')](_0x1bc636[_0x183e('0x29')],qs[_0x183e('0x2f')](_0x26de99[_0x183e('0x30')][_0x183e('0x2f')]));_0x2f9657[_0x183e('0x2e')]=_0x2f9657['attributes'][_0x183e('0x31')]?_0x2f9657['attributes']:_0x1bc636[_0x183e('0x29')];if(_0x26de99[_0x183e('0x30')]['includeAll']){_0x2f9657[_0x183e('0x32')]=[{'all':!![]}];}_0x2f9657=_[_0x183e('0x33')]({},_0x2f9657,_0x26de99['options']);return db['ChatApplication'][_0x183e('0x34')](_0x2f9657)[_0x183e('0x21')](handleEntityNotFound(_0x1f8603,null))[_0x183e('0x21')](respondWithResult(_0x1f8603,null))[_0x183e('0x35')](handleError(_0x1f8603,null));};exports[_0x183e('0x20')]=function(_0x3f2ddb,_0x4fbaff){if(_0x3f2ddb[_0x183e('0x36')]['id']){delete _0x3f2ddb['body']['id'];}return db['ChatApplication'][_0x183e('0x34')]({'where':{'id':_0x3f2ddb[_0x183e('0x37')]['id']}})[_0x183e('0x21')](handleEntityNotFound(_0x4fbaff,null))['then'](saveUpdates(_0x3f2ddb['body'],null))[_0x183e('0x21')](respondWithResult(_0x4fbaff,null))['catch'](handleError(_0x4fbaff,null));};exports[_0x183e('0x22')]=function(_0x3efe07,_0x52f113){return db[_0x183e('0x2a')][_0x183e('0x34')]({'where':{'id':_0x3efe07[_0x183e('0x37')]['id']}})[_0x183e('0x21')](handleEntityNotFound(_0x52f113,null))[_0x183e('0x21')](removeEntity(_0x52f113,null))[_0x183e('0x35')](handleError(_0x52f113,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index df50f4f..f4c2199 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 _0x85d3=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4'];(function(_0x47518e,_0x37ffec){var _0x3d520a=function(_0x4791b1){while(--_0x4791b1){_0x47518e['push'](_0x47518e['shift']());}};_0x3d520a(++_0x37ffec);}(_0x85d3,0x141));var _0x385d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x85d3[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x385d('0x0'));var util=require(_0x385d('0x1'));var logger=require(_0x385d('0x2'))(_0x385d('0x3'));var moment=require(_0x385d('0x4'));var BPromise=require(_0x385d('0x5'));var rp=require(_0x385d('0x6'));var fs=require('fs');var path=require(_0x385d('0x7'));var rimraf=require(_0x385d('0x8'));var config=require('../../config/environment');var attributes=require(_0x385d('0x9'));module[_0x385d('0xa')]=function(_0x457177,_0x16405d){return _0x457177[_0x385d('0xb')](_0x385d('0xc'),attributes,{'tableName':_0x385d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x385d('0xe'),'collate':_0x385d('0xf')});}; \ No newline at end of file +var _0xba6c=['request-promise','path','rimraf','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba6c,0x113));var _0xcba6=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xba6c[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0xcba6('0x0'));var util=require('util');var logger=require(_0xcba6('0x1'))(_0xcba6('0x2'));var moment=require(_0xcba6('0x3'));var BPromise=require(_0xcba6('0x4'));var rp=require(_0xcba6('0x5'));var fs=require('fs');var path=require(_0xcba6('0x6'));var rimraf=require(_0xcba6('0x7'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0xcba6('0x8')]=function(_0x1fd901,_0x34d35d){return _0x1fd901[_0xcba6('0x9')](_0xcba6('0xa'),attributes,{'tableName':_0xcba6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcba6('0xc'),'collate':_0xcba6('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index ef97774..2ed751f 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 _0x23a7=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x23a7,0x1e2));var _0x723a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x23a7[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x723a('0x0'));var moment=require(_0x723a('0x1'));var BPromise=require('bluebird');var rs=require(_0x723a('0x2'));var fs=require('fs');var Redis=require(_0x723a('0x3'));var db=require(_0x723a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x723a('0x5'))(_0x723a('0x6'));var config=require(_0x723a('0x7'));var jayson=require(_0x723a('0x8'));var client=jayson[_0x723a('0x9')][_0x723a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc4f377,_0x1ace6b,_0x4994f7){return new BPromise(function(_0x500f14,_0x2e3dc0){return client[_0x723a('0xb')](_0xc4f377,_0x4994f7)['then'](function(_0x991c17){logger[_0x723a('0xc')](_0x723a('0xd'),_0x1ace6b,_0x723a('0xe'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x1ace6b,'request\x20sent',JSON[_0x723a('0xf')](_0x991c17));if(_0x991c17[_0x723a('0x10')]){if(_0x991c17[_0x723a('0x10')]['code']===0x1f4){logger[_0x723a('0x10')]('ChatApplication,\x20%s,\x20%s',_0x1ace6b,_0x991c17[_0x723a('0x10')]['message']);return _0x2e3dc0(_0x991c17[_0x723a('0x10')][_0x723a('0x11')]);}logger['error'](_0x723a('0xd'),_0x1ace6b,_0x991c17[_0x723a('0x10')]['message']);return _0x500f14(_0x991c17[_0x723a('0x10')][_0x723a('0x11')]);}else{logger[_0x723a('0xc')](_0x723a('0xd'),_0x1ace6b,_0x723a('0xe'));_0x500f14(_0x991c17[_0x723a('0x12')]['message']);}})[_0x723a('0x13')](function(_0x4d83b4){logger[_0x723a('0x10')](_0x723a('0xd'),_0x1ace6b,_0x4d83b4);_0x2e3dc0(_0x4d83b4);});});} \ No newline at end of file +var _0x93d1=['client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x93d1,0x12e));var _0x193d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x93d1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x193d('0x0'));var util=require(_0x193d('0x1'));var moment=require(_0x193d('0x2'));var BPromise=require(_0x193d('0x3'));var rs=require(_0x193d('0x4'));var fs=require('fs');var Redis=require(_0x193d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x193d('0x6'));var logger=require(_0x193d('0x7'))(_0x193d('0x8'));var config=require(_0x193d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x193d('0xa')][_0x193d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17e022,_0x303c52,_0x5f1756){return new BPromise(function(_0x24b5b5,_0x1feade){return client[_0x193d('0xc')](_0x17e022,_0x5f1756)['then'](function(_0x5c1efe){logger[_0x193d('0xd')](_0x193d('0xe'),_0x303c52,_0x193d('0xf'));logger[_0x193d('0x10')](_0x193d('0x11'),_0x303c52,'request\x20sent',JSON[_0x193d('0x12')](_0x5c1efe));if(_0x5c1efe[_0x193d('0x13')]){if(_0x5c1efe[_0x193d('0x13')][_0x193d('0x14')]===0x1f4){logger[_0x193d('0x13')](_0x193d('0xe'),_0x303c52,_0x5c1efe['error'][_0x193d('0x15')]);return _0x1feade(_0x5c1efe['error'][_0x193d('0x15')]);}logger[_0x193d('0x13')](_0x193d('0xe'),_0x303c52,_0x5c1efe[_0x193d('0x13')][_0x193d('0x15')]);return _0x24b5b5(_0x5c1efe[_0x193d('0x13')][_0x193d('0x15')]);}else{logger[_0x193d('0xd')]('ChatApplication,\x20%s,\x20%s',_0x303c52,'request\x20sent');_0x24b5b5(_0x5c1efe[_0x193d('0x16')][_0x193d('0x15')]);}})[_0x193d('0x17')](function(_0x3f874b){logger[_0x193d('0x13')]('ChatApplication,\x20%s,\x20%s',_0x303c52,_0x3f874b);_0x1feade(_0x3f874b);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 033e0e7..19b01aa 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 _0xb4ec=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','show','put','delete','isAuthenticated','destroy','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb4ec,0x121));var _0xcb4e=function(_0x5603eb,_0x522d04){_0x5603eb=_0x5603eb-0x0;var _0x999d7e=_0xb4ec[_0x5603eb];return _0x999d7e;};'use strict';var multer=require(_0xcb4e('0x0'));var util=require(_0xcb4e('0x1'));var path=require(_0xcb4e('0x2'));var timeout=require(_0xcb4e('0x3'));var express=require(_0xcb4e('0x4'));var router=express[_0xcb4e('0x5')]();var fs_extra=require(_0xcb4e('0x6'));var auth=require(_0xcb4e('0x7'));var interaction=require(_0xcb4e('0x8'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0xcb4e('0x9')](_0xcb4e('0xa'),auth['isAuthenticated'](),controller[_0xcb4e('0xb')]);router[_0xcb4e('0xc')](_0xcb4e('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xcb4e('0xd')](_0xcb4e('0xa'),auth[_0xcb4e('0xe')](),controller[_0xcb4e('0xf')]);module[_0xcb4e('0x10')]=router; \ No newline at end of file +var _0xff51=['./chatApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x427731,_0x298994){var _0x1f7ffe=function(_0x26cb5d){while(--_0x26cb5d){_0x427731['push'](_0x427731['shift']());}};_0x1f7ffe(++_0x298994);}(_0xff51,0xb9));var _0x1ff5=function(_0x12daa3,_0x5725c8){_0x12daa3=_0x12daa3-0x0;var _0x219113=_0xff51[_0x12daa3];return _0x219113;};'use strict';var multer=require(_0x1ff5('0x0'));var util=require(_0x1ff5('0x1'));var path=require(_0x1ff5('0x2'));var timeout=require(_0x1ff5('0x3'));var express=require('express');var router=express[_0x1ff5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1ff5('0x5'));var config=require(_0x1ff5('0x6'));var controller=require(_0x1ff5('0x7'));router[_0x1ff5('0x8')](_0x1ff5('0x9'),auth[_0x1ff5('0xa')](),controller[_0x1ff5('0xb')]);router[_0x1ff5('0xc')]('/:id',auth[_0x1ff5('0xa')](),controller['update']);router[_0x1ff5('0xd')](_0x1ff5('0x9'),auth[_0x1ff5('0xa')](),controller[_0x1ff5('0xe')]);module[_0x1ff5('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index c9c6883..4200964 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 _0x7f59=['exports','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f59,0x156));var _0x97f5=function(_0x5e9fa9,_0x856855){_0x5e9fa9=_0x5e9fa9-0x0;var _0x51ae72=_0x7f59[_0x5e9fa9];return _0x51ae72;};'use strict';var Sequelize=require('sequelize');module[_0x97f5('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x97f5('0x1')]},'write':{'type':Sequelize[_0x97f5('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc5a2=['STRING','BOOLEAN','sequelize'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0xc5a2,0x149));var _0x2c5a=function(_0x4cfab7,_0x1a8211){_0x4cfab7=_0x4cfab7-0x0;var _0x5498be=_0xc5a2[_0x4cfab7];return _0x5498be;};'use strict';var Sequelize=require(_0x2c5a('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c5a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x2c5a('0x1')]},'write':{'type':Sequelize[_0x2c5a('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index c2d7b1a..90d3435 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 _0x7511=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','ChatGroup','rawAttributes','fieldName','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','map','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','fields','create','body','find','describe','ChatInternalMessage','user','toInteger','addMembers','ids','findOne','User','filter','getMembers','removeMembers','ChatGroupId','getMessages','$gte','split','eml-format','rimraf','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','end','status','json','offset'];(function(_0x4958ac,_0x194594){var _0x42a030=function(_0x2f5b6b){while(--_0x2f5b6b){_0x4958ac['push'](_0x4958ac['shift']());}};_0x42a030(++_0x194594);}(_0x7511,0x1b5));var _0x1751=function(_0x37be36,_0x18fe03){_0x37be36=_0x37be36-0x0;var _0x47108e=_0x7511[_0x37be36];return _0x47108e;};'use strict';var emlformat=require(_0x1751('0x0'));var rimraf=require(_0x1751('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1751('0x2'));var rp=require(_0x1751('0x3'));var moment=require(_0x1751('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1751('0x5'));var sox=require('sox');var csv=require(_0x1751('0x6'));var ejs=require(_0x1751('0x7'));var fs=require('fs');var fs_extra=require(_0x1751('0x8'));var _=require(_0x1751('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1751('0xa'));var deskjs=require(_0x1751('0xb'));var toCsv=require(_0x1751('0x6'));var querystring=require(_0x1751('0xc'));var Papa=require(_0x1751('0xd'));var Redis=require('ioredis');var authService=require(_0x1751('0xe'));var qs=require(_0x1751('0xf'));var as=require(_0x1751('0x10'));var hardwareService=require(_0x1751('0x11'));var logger=require(_0x1751('0x12'))(_0x1751('0x13'));var utils=require(_0x1751('0x14'));var config=require(_0x1751('0x15'));var licenseUtil=require(_0x1751('0x16'));var db=require(_0x1751('0x17'))['db'];config[_0x1751('0x18')]=_[_0x1751('0x19')](config[_0x1751('0x18')],{'host':_0x1751('0x1a'),'port':0x18eb});var socket=require(_0x1751('0x1b'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x1751('0x1c')](socket);function respondWithStatusCode(_0x38a637,_0x2f44ec){_0x2f44ec=_0x2f44ec||0xcc;return function(_0x586484){if(_0x586484){return _0x38a637['sendStatus'](_0x2f44ec);}return _0x38a637['status'](_0x2f44ec)[_0x1751('0x1d')]();};}function respondWithResult(_0xb2d39b,_0x27fd58){_0x27fd58=_0x27fd58||0xc8;return function(_0x19b387){if(_0x19b387){return _0xb2d39b[_0x1751('0x1e')](_0x27fd58)[_0x1751('0x1f')](_0x19b387);}};}function respondWithFilteredResult(_0x521270,_0x3fc39a){return function(_0x2e0865){if(_0x2e0865){var _0x51e27e=typeof _0x3fc39a[_0x1751('0x20')]===_0x1751('0x21')&&typeof _0x3fc39a[_0x1751('0x22')]===_0x1751('0x21');var _0x5140b1=_0x2e0865[_0x1751('0x23')];var _0x13d33d=_0x51e27e?0x0:_0x3fc39a[_0x1751('0x20')];var _0x3ce95b=_0x51e27e?_0x2e0865[_0x1751('0x23')]:_0x3fc39a[_0x1751('0x20')]+_0x3fc39a[_0x1751('0x22')];var _0x34839c;if(_0x3ce95b>=_0x5140b1){_0x3ce95b=_0x5140b1;_0x34839c=0xc8;}else{_0x34839c=0xce;}_0x521270[_0x1751('0x1e')](_0x34839c);return _0x521270[_0x1751('0x24')](_0x1751('0x25'),_0x13d33d+'-'+_0x3ce95b+'/'+_0x5140b1)[_0x1751('0x1f')](_0x2e0865);}return null;};}function patchUpdates(_0x496123){return function(_0x2fd323){try{jsonpatch[_0x1751('0x26')](_0x2fd323,_0x496123,!![]);}catch(_0x531a92){return BPromise[_0x1751('0x27')](_0x531a92);}return _0x2fd323[_0x1751('0x28')]();};}function saveUpdates(_0x60cb10,_0xbb0993){return function(_0x21a238){if(_0x21a238){return _0x21a238[_0x1751('0x29')](_0x60cb10)[_0x1751('0x2a')](function(_0x1c34aa){return _0x1c34aa;});}return null;};}function removeEntity(_0x42f40b,_0x16083e){return function(_0x2449eb){if(_0x2449eb){return _0x2449eb[_0x1751('0x2b')]()[_0x1751('0x2a')](function(){_0x42f40b[_0x1751('0x1e')](0xcc)[_0x1751('0x1d')]();});}};}function handleEntityNotFound(_0x55da48,_0x6a22ca){return function(_0x6f1b34){if(!_0x6f1b34){_0x55da48[_0x1751('0x2c')](0x194);}return _0x6f1b34;};}function handleError(_0x5a2dd0,_0x329cb6){_0x329cb6=_0x329cb6||0x1f4;return function(_0x2ca54d){logger['error'](_0x2ca54d['stack']);if(_0x2ca54d[_0x1751('0x2d')]){delete _0x2ca54d[_0x1751('0x2d')];}_0x5a2dd0[_0x1751('0x1e')](_0x329cb6)[_0x1751('0x2e')](_0x2ca54d);};}exports[_0x1751('0x2f')]=function(_0x807946,_0x682eb7){var _0x288c4a={},_0x2fd1ba={},_0x57fcc7={'count':0x0,'rows':[]};var _0x476898=_['map'](db[_0x1751('0x30')][_0x1751('0x31')],function(_0x4baaa8){return{'name':_0x4baaa8[_0x1751('0x32')],'type':_0x4baaa8['type'][_0x1751('0x33')]};});_0x2fd1ba[_0x1751('0x34')]=_['map'](_0x476898,_0x1751('0x2d'));_0x2fd1ba[_0x1751('0x35')]=_['keys'](_0x807946[_0x1751('0x35')]);_0x2fd1ba['filters']=_['intersection'](_0x2fd1ba[_0x1751('0x34')],_0x2fd1ba[_0x1751('0x35')]);_0x288c4a['attributes']=_[_0x1751('0x36')](_0x2fd1ba[_0x1751('0x34')],qs['fields'](_0x807946['query']['fields']));_0x288c4a[_0x1751('0x37')]=_0x288c4a[_0x1751('0x37')][_0x1751('0x38')]?_0x288c4a['attributes']:_0x2fd1ba['model'];if(!_0x807946['query'][_0x1751('0x39')](_0x1751('0x3a'))){_0x288c4a['limit']=qs[_0x1751('0x22')](_0x807946[_0x1751('0x35')][_0x1751('0x22')]);_0x288c4a[_0x1751('0x20')]=qs[_0x1751('0x20')](_0x807946['query'][_0x1751('0x20')]);}_0x288c4a[_0x1751('0x3b')]=qs['sort'](_0x807946[_0x1751('0x35')][_0x1751('0x3c')]);_0x288c4a['where']=qs[_0x1751('0x3d')](_[_0x1751('0x3e')](_0x807946[_0x1751('0x35')],_0x2fd1ba[_0x1751('0x3d')]),_0x476898);if(_0x807946[_0x1751('0x35')]['filter']){_0x288c4a['where']=_[_0x1751('0x3f')](_0x288c4a[_0x1751('0x40')],{'$or':_[_0x1751('0x41')](_0x476898,function(_0x22ce6a){if(_0x22ce6a['type']!==_0x1751('0x42')){var _0x57b031={};_0x57b031[_0x22ce6a[_0x1751('0x2d')]]={'$like':'%'+_0x807946['query']['filter']+'%'};return _0x57b031;}})});}_0x288c4a=_[_0x1751('0x3f')]({},_0x288c4a,_0x807946[_0x1751('0x43')]);var _0x21f736={'where':_0x288c4a['where']};return db['ChatGroup']['count'](_0x21f736)['then'](function(_0x5210f5){_0x57fcc7[_0x1751('0x23')]=_0x5210f5;if(_0x807946[_0x1751('0x35')][_0x1751('0x44')]){_0x288c4a[_0x1751('0x45')]=[{'all':!![]}];}return db[_0x1751('0x30')]['findAll'](_0x288c4a);})['then'](function(_0x1bbbc2){_0x57fcc7[_0x1751('0x46')]=_0x1bbbc2;return _0x57fcc7;})['then'](respondWithFilteredResult(_0x682eb7,_0x288c4a))[_0x1751('0x47')](handleError(_0x682eb7,null));};exports[_0x1751('0x48')]=function(_0x32e6a7,_0x46f86f){var _0x1ad843={'raw':!![],'where':{'id':_0x32e6a7[_0x1751('0x49')]['id']}},_0x17ad3b={};_0x17ad3b['model']=_[_0x1751('0x4a')](db[_0x1751('0x30')][_0x1751('0x31')]);_0x17ad3b['query']=_[_0x1751('0x4a')](_0x32e6a7['query']);_0x17ad3b[_0x1751('0x3d')]=_['intersection'](_0x17ad3b[_0x1751('0x34')],_0x17ad3b['query']);_0x1ad843[_0x1751('0x37')]=_['intersection'](_0x17ad3b[_0x1751('0x34')],qs[_0x1751('0x4b')](_0x32e6a7['query'][_0x1751('0x4b')]));_0x1ad843[_0x1751('0x37')]=_0x1ad843[_0x1751('0x37')][_0x1751('0x38')]?_0x1ad843['attributes']:_0x17ad3b['model'];if(_0x32e6a7[_0x1751('0x35')][_0x1751('0x44')]){_0x1ad843[_0x1751('0x45')]=[{'all':!![]}];}_0x1ad843=_[_0x1751('0x3f')]({},_0x1ad843,_0x32e6a7[_0x1751('0x43')]);return db['ChatGroup']['find'](_0x1ad843)[_0x1751('0x2a')](handleEntityNotFound(_0x46f86f,null))[_0x1751('0x2a')](respondWithResult(_0x46f86f,null))['catch'](handleError(_0x46f86f,null));};exports[_0x1751('0x4c')]=function(_0x39958e,_0x1b5641){return db[_0x1751('0x30')]['create'](_0x39958e[_0x1751('0x4d')],{})['then'](respondWithResult(_0x1b5641,0xc9))['catch'](handleError(_0x1b5641,null));};exports[_0x1751('0x29')]=function(_0x3e789e,_0x313eb3){if(_0x3e789e[_0x1751('0x4d')]['id']){delete _0x3e789e[_0x1751('0x4d')]['id'];}return db['ChatGroup'][_0x1751('0x4e')]({'where':{'id':_0x3e789e[_0x1751('0x49')]['id']}})[_0x1751('0x2a')](handleEntityNotFound(_0x313eb3,null))['then'](saveUpdates(_0x3e789e[_0x1751('0x4d')],null))['then'](respondWithResult(_0x313eb3,null))[_0x1751('0x47')](handleError(_0x313eb3,null));};exports['destroy']=function(_0x3f046f,_0x24a1fb){return db[_0x1751('0x30')][_0x1751('0x4e')]({'where':{'id':_0x3f046f['params']['id']}})['then'](handleEntityNotFound(_0x24a1fb,null))[_0x1751('0x2a')](removeEntity(_0x24a1fb,null))[_0x1751('0x47')](handleError(_0x24a1fb,null));};exports[_0x1751('0x4f')]=function(_0x132212,_0x5ebc0f){return db[_0x1751('0x30')]['describe']()[_0x1751('0x2a')](respondWithResult(_0x5ebc0f,null))[_0x1751('0x47')](handleError(_0x5ebc0f,null));};exports['getUnread']=function(_0x3dd26d,_0x2a215c,_0x5f375b){return db[_0x1751('0x50')][_0x1751('0x23')]({'where':{'ChatGroupId':_0x3dd26d[_0x1751('0x49')]['id'],'ToId':_0x3dd26d[_0x1751('0x51')]['id'],'read':![]}})['then'](function(_0x1f68ba){return{'id':_[_0x1751('0x52')](_0x3dd26d[_0x1751('0x49')]['id']),'count':_0x1f68ba};})[_0x1751('0x2a')](respondWithResult(_0x2a215c,null))['catch'](handleError(_0x2a215c,null));};exports[_0x1751('0x53')]=function(_0x392106,_0x3ae6f9,_0x3cca32){return db[_0x1751('0x30')][_0x1751('0x4e')]({'where':{'id':_0x392106[_0x1751('0x49')]['id']}})['then'](handleEntityNotFound(_0x3ae6f9,null))[_0x1751('0x2a')](function(_0x22960c){if(_0x22960c){return _0x22960c[_0x1751('0x53')](_0x392106[_0x1751('0x4d')][_0x1751('0x54')],_['omit'](_0x392106[_0x1751('0x4d')],['ids','id'])||{});}})[_0x1751('0x2a')](respondWithResult(_0x3ae6f9,null))[_0x1751('0x47')](handleError(_0x3ae6f9,null));};exports['getMembers']=function(_0x4699ca,_0x3dbca0,_0x593fe5){var _0xb51b54={};var _0x39bd77={};var _0x59cc11;var _0x9276b1;return db[_0x1751('0x30')][_0x1751('0x55')]({'where':{'id':_0x4699ca['params']['id']}})[_0x1751('0x2a')](handleEntityNotFound(_0x3dbca0,null))[_0x1751('0x2a')](function(_0x1af04f){if(_0x1af04f){_0x59cc11=_0x1af04f;_0x39bd77[_0x1751('0x34')]=_[_0x1751('0x4a')](db[_0x1751('0x56')][_0x1751('0x31')]);_0x39bd77[_0x1751('0x35')]=_[_0x1751('0x4a')](_0x4699ca['query']);_0x39bd77[_0x1751('0x3d')]=_[_0x1751('0x36')](_0x39bd77[_0x1751('0x34')],_0x39bd77[_0x1751('0x35')]);_0xb51b54[_0x1751('0x37')]=_['intersection'](_0x39bd77[_0x1751('0x34')],qs[_0x1751('0x4b')](_0x4699ca['query'][_0x1751('0x4b')]));_0xb51b54[_0x1751('0x37')]=_0xb51b54[_0x1751('0x37')][_0x1751('0x38')]?_0xb51b54[_0x1751('0x37')]:_0x39bd77[_0x1751('0x34')];_0xb51b54[_0x1751('0x3b')]=qs['sort'](_0x4699ca[_0x1751('0x35')][_0x1751('0x3c')]);_0xb51b54[_0x1751('0x40')]=qs['filters'](_[_0x1751('0x3e')](_0x4699ca[_0x1751('0x35')],_0x39bd77[_0x1751('0x3d')]));if(_0x4699ca['query'][_0x1751('0x57')]){_0xb51b54[_0x1751('0x40')]=_[_0x1751('0x3f')](_0xb51b54[_0x1751('0x40')],{'$or':_[_0x1751('0x41')](_0xb51b54[_0x1751('0x37')],function(_0x3297f9){var _0x7e5e1f={};_0x7e5e1f[_0x3297f9]={'$like':'%'+_0x4699ca[_0x1751('0x35')][_0x1751('0x57')]+'%'};return _0x7e5e1f;})});}_0xb51b54=_[_0x1751('0x3f')]({},_0xb51b54,_0x4699ca['options']);return _0x59cc11[_0x1751('0x58')](_0xb51b54);}})[_0x1751('0x2a')](function(_0x3cc1ce){if(_0x3cc1ce){_0x9276b1=_0x3cc1ce[_0x1751('0x38')];if(!_0x4699ca[_0x1751('0x35')][_0x1751('0x39')](_0x1751('0x3a'))){_0xb51b54['limit']=qs[_0x1751('0x22')](_0x4699ca[_0x1751('0x35')][_0x1751('0x22')]);_0xb51b54['offset']=qs[_0x1751('0x20')](_0x4699ca[_0x1751('0x35')][_0x1751('0x20')]);}return _0x59cc11[_0x1751('0x58')](_0xb51b54);}})[_0x1751('0x2a')](function(_0x43a715){if(_0x43a715){return _0x43a715?{'count':_0x9276b1,'rows':_0x43a715}:null;}})[_0x1751('0x2a')](respondWithResult(_0x3dbca0,null))[_0x1751('0x47')](handleError(_0x3dbca0,null));};exports[_0x1751('0x59')]=function(_0x1c32fa,_0x1bb4be,_0x189133){return db[_0x1751('0x30')][_0x1751('0x4e')]({'where':{'id':_0x1c32fa['params']['id']}})[_0x1751('0x2a')](handleEntityNotFound(_0x1bb4be,null))[_0x1751('0x2a')](function(_0x3bd4b5){if(_0x3bd4b5){return _0x3bd4b5[_0x1751('0x59')](_0x1c32fa[_0x1751('0x35')][_0x1751('0x54')]);}})[_0x1751('0x2a')](respondWithStatusCode(_0x1bb4be,null))[_0x1751('0x47')](handleError(_0x1bb4be,null));};exports['addMessage']=function(_0x379040,_0x203019,_0x393574){if(_0x379040[_0x1751('0x4d')]['id']){delete _0x379040[_0x1751('0x4d')]['id'];}return db[_0x1751('0x30')][_0x1751('0x4e')]({'where':{'id':_0x379040['params']['id']}})['then'](handleEntityNotFound(_0x203019,null))[_0x1751('0x2a')](function(_0xf5f5da){if(_0xf5f5da){_0x379040[_0x1751('0x4d')][_0x1751('0x5a')]=_0xf5f5da['id'];return db['ChatInternalMessage'][_0x1751('0x4c')](_0x379040['body']);}})[_0x1751('0x2a')](respondWithResult(_0x203019,null))['catch'](handleError(_0x203019,null));};exports[_0x1751('0x5b')]=function(_0x4cfe24,_0x17a7cc,_0x4ea887){var _0x6b4a55={};var _0x594e90={};var _0x1a0698;var _0x47c6e2;return db['ChatGroup'][_0x1751('0x55')]({'where':{'id':_0x4cfe24[_0x1751('0x49')]['id']}})[_0x1751('0x2a')](handleEntityNotFound(_0x17a7cc,null))[_0x1751('0x2a')](function(_0x1a48ae){if(_0x1a48ae){_0x1a0698=_0x1a48ae;_0x594e90[_0x1751('0x34')]=_[_0x1751('0x4a')](db[_0x1751('0x50')][_0x1751('0x31')]);_0x594e90['query']=_[_0x1751('0x4a')](_0x4cfe24[_0x1751('0x35')]);_0x594e90[_0x1751('0x3d')]=_['intersection'](_0x594e90[_0x1751('0x34')],_0x594e90[_0x1751('0x35')]);_0x6b4a55['attributes']=_[_0x1751('0x36')](_0x594e90[_0x1751('0x34')],qs['fields'](_0x4cfe24[_0x1751('0x35')][_0x1751('0x4b')]));_0x6b4a55[_0x1751('0x37')]=_0x6b4a55[_0x1751('0x37')][_0x1751('0x38')]?_0x6b4a55[_0x1751('0x37')]:_0x594e90[_0x1751('0x34')];_0x6b4a55[_0x1751('0x3b')]=qs[_0x1751('0x3c')](_0x4cfe24[_0x1751('0x35')][_0x1751('0x3c')]);_0x6b4a55[_0x1751('0x40')]=qs[_0x1751('0x3d')](_[_0x1751('0x3e')](_0x4cfe24['query'],_0x594e90['filters']));if(_0x4cfe24[_0x1751('0x35')][_0x1751('0x57')]){_0x6b4a55[_0x1751('0x40')]=_[_0x1751('0x3f')](_0x6b4a55['where'],{'$or':_[_0x1751('0x41')](_0x6b4a55[_0x1751('0x37')],function(_0x32fe44){var _0x4e263e={};_0x4e263e[_0x32fe44]={'$like':'%'+_0x4cfe24[_0x1751('0x35')]['filter']+'%'};return _0x4e263e;})});}if(_0x4cfe24[_0x1751('0x35')][_0x1751('0x5c')]){var _0x130327=_0x4cfe24['query'][_0x1751('0x5c')][_0x1751('0x5d')](',');var _0x3405ef={};_0x3405ef[_0x130327[0x0]]={'$gte':moment(_0x130327[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x6b4a55[_0x1751('0x40')]=_[_0x1751('0x3f')](_0x6b4a55[_0x1751('0x40')],_0x3405ef);}_0x6b4a55=_[_0x1751('0x3f')]({},_0x6b4a55,_0x4cfe24[_0x1751('0x43')]);return _0x1a0698[_0x1751('0x5b')](_0x6b4a55);}})[_0x1751('0x2a')](function(_0x368de5){if(_0x368de5){_0x47c6e2=_0x368de5[_0x1751('0x38')];if(!_0x4cfe24['query'][_0x1751('0x39')](_0x1751('0x3a'))){_0x6b4a55[_0x1751('0x22')]=qs[_0x1751('0x22')](_0x4cfe24['query'][_0x1751('0x22')]);_0x6b4a55[_0x1751('0x20')]=qs['offset'](_0x4cfe24[_0x1751('0x35')][_0x1751('0x20')]);}return _0x1a0698['getMessages'](_0x6b4a55);}})[_0x1751('0x2a')](function(_0x3b55a8){if(_0x3b55a8){return _0x3b55a8?{'count':_0x47c6e2,'rows':_0x3b55a8}:null;}})[_0x1751('0x2a')](respondWithResult(_0x17a7cc,null))['catch'](handleError(_0x17a7cc,null));}; \ No newline at end of file +var _0xb805=['pick','filter','merge','options','ChatGroup','includeAll','include','findAll','rows','show','params','length','create','body','catch','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','addMessage','ChatGroupId','$gte','getMessages','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2dbfb5,_0x621e9a){var _0x3ae10a=function(_0x2fbe51){while(--_0x2fbe51){_0x2dbfb5['push'](_0x2dbfb5['shift']());}};_0x3ae10a(++_0x621e9a);}(_0xb805,0x83));var _0x5b80=function(_0x13b2e5,_0x148e0d){_0x13b2e5=_0x13b2e5-0x0;var _0xc6e78c=_0xb805[_0x13b2e5];return _0xc6e78c;};'use strict';var emlformat=require(_0x5b80('0x0'));var rimraf=require(_0x5b80('0x1'));var zipdir=require(_0x5b80('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5b80('0x3'));var moment=require(_0x5b80('0x4'));var BPromise=require(_0x5b80('0x5'));var Mustache=require(_0x5b80('0x6'));var util=require(_0x5b80('0x7'));var path=require(_0x5b80('0x8'));var sox=require(_0x5b80('0x9'));var csv=require('to-csv');var ejs=require(_0x5b80('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b80('0xb'));var squel=require(_0x5b80('0xc'));var crypto=require(_0x5b80('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5b80('0xe'));var querystring=require(_0x5b80('0xf'));var Papa=require(_0x5b80('0x10'));var Redis=require(_0x5b80('0x11'));var authService=require(_0x5b80('0x12'));var qs=require(_0x5b80('0x13'));var as=require(_0x5b80('0x14'));var hardwareService=require(_0x5b80('0x15'));var logger=require(_0x5b80('0x16'))(_0x5b80('0x17'));var utils=require(_0x5b80('0x18'));var config=require(_0x5b80('0x19'));var licenseUtil=require(_0x5b80('0x1a'));var db=require(_0x5b80('0x1b'))['db'];config[_0x5b80('0x1c')]=_['defaults'](config[_0x5b80('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x5b80('0x1d'))(new Redis(config['redis']));require(_0x5b80('0x1e'))[_0x5b80('0x1f')](socket);function respondWithStatusCode(_0x2a9a59,_0x5264fa){_0x5264fa=_0x5264fa||0xcc;return function(_0x439805){if(_0x439805){return _0x2a9a59[_0x5b80('0x20')](_0x5264fa);}return _0x2a9a59[_0x5b80('0x21')](_0x5264fa)[_0x5b80('0x22')]();};}function respondWithResult(_0x1f881d,_0x2793cb){_0x2793cb=_0x2793cb||0xc8;return function(_0x14c29d){if(_0x14c29d){return _0x1f881d[_0x5b80('0x21')](_0x2793cb)[_0x5b80('0x23')](_0x14c29d);}};}function respondWithFilteredResult(_0x2b88a8,_0x4028ee){return function(_0x1bd60e){if(_0x1bd60e){var _0x1cc8b9=typeof _0x4028ee[_0x5b80('0x24')]===_0x5b80('0x25')&&typeof _0x4028ee[_0x5b80('0x26')]==='undefined';var _0x5f1442=_0x1bd60e[_0x5b80('0x27')];var _0xfbe2e7=_0x1cc8b9?0x0:_0x4028ee[_0x5b80('0x24')];var _0x300bc8=_0x1cc8b9?_0x1bd60e['count']:_0x4028ee[_0x5b80('0x24')]+_0x4028ee[_0x5b80('0x26')];var _0x28f77e;if(_0x300bc8>=_0x5f1442){_0x300bc8=_0x5f1442;_0x28f77e=0xc8;}else{_0x28f77e=0xce;}_0x2b88a8[_0x5b80('0x21')](_0x28f77e);return _0x2b88a8[_0x5b80('0x28')](_0x5b80('0x29'),_0xfbe2e7+'-'+_0x300bc8+'/'+_0x5f1442)[_0x5b80('0x23')](_0x1bd60e);}return null;};}function patchUpdates(_0x54c115){return function(_0x3c07ba){try{jsonpatch[_0x5b80('0x2a')](_0x3c07ba,_0x54c115,!![]);}catch(_0x323fbe){return BPromise[_0x5b80('0x2b')](_0x323fbe);}return _0x3c07ba['save']();};}function saveUpdates(_0xed32a6,_0x263782){return function(_0x39afb3){if(_0x39afb3){return _0x39afb3[_0x5b80('0x2c')](_0xed32a6)[_0x5b80('0x2d')](function(_0x564607){return _0x564607;});}return null;};}function removeEntity(_0x4bffb5,_0x401284){return function(_0x164af4){if(_0x164af4){return _0x164af4[_0x5b80('0x2e')]()['then'](function(){_0x4bffb5[_0x5b80('0x21')](0xcc)[_0x5b80('0x22')]();});}};}function handleEntityNotFound(_0x29ebb4,_0x145b82){return function(_0x428eae){if(!_0x428eae){_0x29ebb4[_0x5b80('0x20')](0x194);}return _0x428eae;};}function handleError(_0x3bf415,_0x3e0219){_0x3e0219=_0x3e0219||0x1f4;return function(_0x340ca5){logger[_0x5b80('0x2f')](_0x340ca5[_0x5b80('0x30')]);if(_0x340ca5[_0x5b80('0x31')]){delete _0x340ca5[_0x5b80('0x31')];}_0x3bf415['status'](_0x3e0219)[_0x5b80('0x32')](_0x340ca5);};}exports[_0x5b80('0x33')]=function(_0x2ae8da,_0x2b1698){var _0x565c51={},_0x1d9799={},_0x13201c={'count':0x0,'rows':[]};var _0x1a8264=_[_0x5b80('0x34')](db['ChatGroup'][_0x5b80('0x35')],function(_0x2b53e7){return{'name':_0x2b53e7[_0x5b80('0x36')],'type':_0x2b53e7[_0x5b80('0x37')][_0x5b80('0x38')]};});_0x1d9799['model']=_[_0x5b80('0x34')](_0x1a8264,_0x5b80('0x31'));_0x1d9799['query']=_[_0x5b80('0x39')](_0x2ae8da[_0x5b80('0x3a')]);_0x1d9799[_0x5b80('0x3b')]=_[_0x5b80('0x3c')](_0x1d9799[_0x5b80('0x3d')],_0x1d9799[_0x5b80('0x3a')]);_0x565c51[_0x5b80('0x3e')]=_[_0x5b80('0x3c')](_0x1d9799[_0x5b80('0x3d')],qs[_0x5b80('0x3f')](_0x2ae8da[_0x5b80('0x3a')]['fields']));_0x565c51[_0x5b80('0x3e')]=_0x565c51['attributes']['length']?_0x565c51['attributes']:_0x1d9799['model'];if(!_0x2ae8da[_0x5b80('0x3a')][_0x5b80('0x40')](_0x5b80('0x41'))){_0x565c51[_0x5b80('0x26')]=qs['limit'](_0x2ae8da['query']['limit']);_0x565c51[_0x5b80('0x24')]=qs[_0x5b80('0x24')](_0x2ae8da[_0x5b80('0x3a')][_0x5b80('0x24')]);}_0x565c51[_0x5b80('0x42')]=qs['sort'](_0x2ae8da[_0x5b80('0x3a')][_0x5b80('0x43')]);_0x565c51[_0x5b80('0x44')]=qs['filters'](_[_0x5b80('0x45')](_0x2ae8da[_0x5b80('0x3a')],_0x1d9799[_0x5b80('0x3b')]),_0x1a8264);if(_0x2ae8da['query'][_0x5b80('0x46')]){_0x565c51[_0x5b80('0x44')]=_[_0x5b80('0x47')](_0x565c51[_0x5b80('0x44')],{'$or':_[_0x5b80('0x34')](_0x1a8264,function(_0x56ec0e){if(_0x56ec0e[_0x5b80('0x37')]!=='VIRTUAL'){var _0x4289c0={};_0x4289c0[_0x56ec0e[_0x5b80('0x31')]]={'$like':'%'+_0x2ae8da[_0x5b80('0x3a')][_0x5b80('0x46')]+'%'};return _0x4289c0;}})});}_0x565c51=_['merge']({},_0x565c51,_0x2ae8da[_0x5b80('0x48')]);var _0x38e22b={'where':_0x565c51[_0x5b80('0x44')]};return db[_0x5b80('0x49')][_0x5b80('0x27')](_0x38e22b)[_0x5b80('0x2d')](function(_0x47acbd){_0x13201c[_0x5b80('0x27')]=_0x47acbd;if(_0x2ae8da[_0x5b80('0x3a')][_0x5b80('0x4a')]){_0x565c51[_0x5b80('0x4b')]=[{'all':!![]}];}return db['ChatGroup'][_0x5b80('0x4c')](_0x565c51);})[_0x5b80('0x2d')](function(_0x42bc48){_0x13201c[_0x5b80('0x4d')]=_0x42bc48;return _0x13201c;})[_0x5b80('0x2d')](respondWithFilteredResult(_0x2b1698,_0x565c51))['catch'](handleError(_0x2b1698,null));};exports[_0x5b80('0x4e')]=function(_0x133ebd,_0x5823d8){var _0x593d42={'raw':!![],'where':{'id':_0x133ebd[_0x5b80('0x4f')]['id']}},_0x233bda={};_0x233bda[_0x5b80('0x3d')]=_[_0x5b80('0x39')](db['ChatGroup'][_0x5b80('0x35')]);_0x233bda[_0x5b80('0x3a')]=_['keys'](_0x133ebd[_0x5b80('0x3a')]);_0x233bda['filters']=_[_0x5b80('0x3c')](_0x233bda[_0x5b80('0x3d')],_0x233bda['query']);_0x593d42[_0x5b80('0x3e')]=_['intersection'](_0x233bda[_0x5b80('0x3d')],qs['fields'](_0x133ebd['query'][_0x5b80('0x3f')]));_0x593d42[_0x5b80('0x3e')]=_0x593d42[_0x5b80('0x3e')][_0x5b80('0x50')]?_0x593d42[_0x5b80('0x3e')]:_0x233bda['model'];if(_0x133ebd[_0x5b80('0x3a')][_0x5b80('0x4a')]){_0x593d42[_0x5b80('0x4b')]=[{'all':!![]}];}_0x593d42=_[_0x5b80('0x47')]({},_0x593d42,_0x133ebd[_0x5b80('0x48')]);return db[_0x5b80('0x49')]['find'](_0x593d42)[_0x5b80('0x2d')](handleEntityNotFound(_0x5823d8,null))[_0x5b80('0x2d')](respondWithResult(_0x5823d8,null))['catch'](handleError(_0x5823d8,null));};exports[_0x5b80('0x51')]=function(_0x406418,_0x17e8d6){return db[_0x5b80('0x49')][_0x5b80('0x51')](_0x406418[_0x5b80('0x52')],{})[_0x5b80('0x2d')](respondWithResult(_0x17e8d6,0xc9))[_0x5b80('0x53')](handleError(_0x17e8d6,null));};exports['update']=function(_0x2feaa4,_0x4a2148){if(_0x2feaa4[_0x5b80('0x52')]['id']){delete _0x2feaa4[_0x5b80('0x52')]['id'];}return db[_0x5b80('0x49')]['find']({'where':{'id':_0x2feaa4['params']['id']}})[_0x5b80('0x2d')](handleEntityNotFound(_0x4a2148,null))[_0x5b80('0x2d')](saveUpdates(_0x2feaa4[_0x5b80('0x52')],null))['then'](respondWithResult(_0x4a2148,null))['catch'](handleError(_0x4a2148,null));};exports[_0x5b80('0x2e')]=function(_0x1bbe9f,_0x284e4d){return db[_0x5b80('0x49')][_0x5b80('0x54')]({'where':{'id':_0x1bbe9f[_0x5b80('0x4f')]['id']}})[_0x5b80('0x2d')](handleEntityNotFound(_0x284e4d,null))['then'](removeEntity(_0x284e4d,null))[_0x5b80('0x53')](handleError(_0x284e4d,null));};exports[_0x5b80('0x55')]=function(_0x536ad8,_0x4013b7){return db[_0x5b80('0x49')]['describe']()[_0x5b80('0x2d')](respondWithResult(_0x4013b7,null))[_0x5b80('0x53')](handleError(_0x4013b7,null));};exports[_0x5b80('0x56')]=function(_0x2f30e8,_0x3c3d09,_0x5573e8){return db[_0x5b80('0x57')][_0x5b80('0x27')]({'where':{'ChatGroupId':_0x2f30e8[_0x5b80('0x4f')]['id'],'ToId':_0x2f30e8[_0x5b80('0x58')]['id'],'read':![]}})[_0x5b80('0x2d')](function(_0x5e3639){return{'id':_[_0x5b80('0x59')](_0x2f30e8[_0x5b80('0x4f')]['id']),'count':_0x5e3639};})['then'](respondWithResult(_0x3c3d09,null))[_0x5b80('0x53')](handleError(_0x3c3d09,null));};exports[_0x5b80('0x5a')]=function(_0x24b6cf,_0x46049a,_0x35d0d7){return db[_0x5b80('0x49')][_0x5b80('0x54')]({'where':{'id':_0x24b6cf[_0x5b80('0x4f')]['id']}})['then'](handleEntityNotFound(_0x46049a,null))['then'](function(_0x57fde1){if(_0x57fde1){return _0x57fde1[_0x5b80('0x5a')](_0x24b6cf[_0x5b80('0x52')][_0x5b80('0x5b')],_[_0x5b80('0x5c')](_0x24b6cf['body'],[_0x5b80('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x46049a,null))[_0x5b80('0x53')](handleError(_0x46049a,null));};exports[_0x5b80('0x5d')]=function(_0x14ba7c,_0x174761,_0x469692){var _0x5d1a88={};var _0x36172e={};var _0x5a73fa;var _0x339ddc;return db['ChatGroup'][_0x5b80('0x5e')]({'where':{'id':_0x14ba7c[_0x5b80('0x4f')]['id']}})['then'](handleEntityNotFound(_0x174761,null))[_0x5b80('0x2d')](function(_0x3345c2){if(_0x3345c2){_0x5a73fa=_0x3345c2;_0x36172e[_0x5b80('0x3d')]=_[_0x5b80('0x39')](db[_0x5b80('0x5f')][_0x5b80('0x35')]);_0x36172e['query']=_[_0x5b80('0x39')](_0x14ba7c['query']);_0x36172e['filters']=_[_0x5b80('0x3c')](_0x36172e[_0x5b80('0x3d')],_0x36172e[_0x5b80('0x3a')]);_0x5d1a88[_0x5b80('0x3e')]=_[_0x5b80('0x3c')](_0x36172e[_0x5b80('0x3d')],qs[_0x5b80('0x3f')](_0x14ba7c['query']['fields']));_0x5d1a88[_0x5b80('0x3e')]=_0x5d1a88[_0x5b80('0x3e')]['length']?_0x5d1a88[_0x5b80('0x3e')]:_0x36172e[_0x5b80('0x3d')];_0x5d1a88[_0x5b80('0x42')]=qs['sort'](_0x14ba7c[_0x5b80('0x3a')]['sort']);_0x5d1a88[_0x5b80('0x44')]=qs['filters'](_[_0x5b80('0x45')](_0x14ba7c[_0x5b80('0x3a')],_0x36172e[_0x5b80('0x3b')]));if(_0x14ba7c[_0x5b80('0x3a')][_0x5b80('0x46')]){_0x5d1a88[_0x5b80('0x44')]=_[_0x5b80('0x47')](_0x5d1a88[_0x5b80('0x44')],{'$or':_[_0x5b80('0x34')](_0x5d1a88[_0x5b80('0x3e')],function(_0x1c96d5){var _0x2e394b={};_0x2e394b[_0x1c96d5]={'$like':'%'+_0x14ba7c[_0x5b80('0x3a')][_0x5b80('0x46')]+'%'};return _0x2e394b;})});}_0x5d1a88=_[_0x5b80('0x47')]({},_0x5d1a88,_0x14ba7c['options']);return _0x5a73fa['getMembers'](_0x5d1a88);}})[_0x5b80('0x2d')](function(_0x186a34){if(_0x186a34){_0x339ddc=_0x186a34[_0x5b80('0x50')];if(!_0x14ba7c[_0x5b80('0x3a')]['hasOwnProperty'](_0x5b80('0x41'))){_0x5d1a88[_0x5b80('0x26')]=qs[_0x5b80('0x26')](_0x14ba7c[_0x5b80('0x3a')][_0x5b80('0x26')]);_0x5d1a88[_0x5b80('0x24')]=qs['offset'](_0x14ba7c[_0x5b80('0x3a')][_0x5b80('0x24')]);}return _0x5a73fa['getMembers'](_0x5d1a88);}})[_0x5b80('0x2d')](function(_0x3352f8){if(_0x3352f8){return _0x3352f8?{'count':_0x339ddc,'rows':_0x3352f8}:null;}})['then'](respondWithResult(_0x174761,null))['catch'](handleError(_0x174761,null));};exports['removeMembers']=function(_0x2357d0,_0x1621f9,_0x362602){return db[_0x5b80('0x49')]['find']({'where':{'id':_0x2357d0[_0x5b80('0x4f')]['id']}})[_0x5b80('0x2d')](handleEntityNotFound(_0x1621f9,null))[_0x5b80('0x2d')](function(_0x231687){if(_0x231687){return _0x231687['removeMembers'](_0x2357d0[_0x5b80('0x3a')][_0x5b80('0x5b')]);}})[_0x5b80('0x2d')](respondWithStatusCode(_0x1621f9,null))['catch'](handleError(_0x1621f9,null));};exports[_0x5b80('0x60')]=function(_0x4f2f00,_0x5c4def,_0x16602e){if(_0x4f2f00[_0x5b80('0x52')]['id']){delete _0x4f2f00[_0x5b80('0x52')]['id'];}return db[_0x5b80('0x49')]['find']({'where':{'id':_0x4f2f00[_0x5b80('0x4f')]['id']}})[_0x5b80('0x2d')](handleEntityNotFound(_0x5c4def,null))[_0x5b80('0x2d')](function(_0x188db9){if(_0x188db9){_0x4f2f00['body'][_0x5b80('0x61')]=_0x188db9['id'];return db[_0x5b80('0x57')][_0x5b80('0x51')](_0x4f2f00['body']);}})[_0x5b80('0x2d')](respondWithResult(_0x5c4def,null))[_0x5b80('0x53')](handleError(_0x5c4def,null));};exports['getMessages']=function(_0x4bc7a6,_0x216dbe,_0x11076a){var _0x2f78b8={};var _0xfba637={};var _0x3996ce;var _0x38ba51;return db['ChatGroup'][_0x5b80('0x5e')]({'where':{'id':_0x4bc7a6[_0x5b80('0x4f')]['id']}})[_0x5b80('0x2d')](handleEntityNotFound(_0x216dbe,null))[_0x5b80('0x2d')](function(_0xb3bacb){if(_0xb3bacb){_0x3996ce=_0xb3bacb;_0xfba637[_0x5b80('0x3d')]=_[_0x5b80('0x39')](db[_0x5b80('0x57')]['rawAttributes']);_0xfba637[_0x5b80('0x3a')]=_[_0x5b80('0x39')](_0x4bc7a6[_0x5b80('0x3a')]);_0xfba637[_0x5b80('0x3b')]=_[_0x5b80('0x3c')](_0xfba637[_0x5b80('0x3d')],_0xfba637[_0x5b80('0x3a')]);_0x2f78b8[_0x5b80('0x3e')]=_[_0x5b80('0x3c')](_0xfba637[_0x5b80('0x3d')],qs[_0x5b80('0x3f')](_0x4bc7a6[_0x5b80('0x3a')][_0x5b80('0x3f')]));_0x2f78b8[_0x5b80('0x3e')]=_0x2f78b8[_0x5b80('0x3e')][_0x5b80('0x50')]?_0x2f78b8[_0x5b80('0x3e')]:_0xfba637[_0x5b80('0x3d')];_0x2f78b8[_0x5b80('0x42')]=qs['sort'](_0x4bc7a6['query'][_0x5b80('0x43')]);_0x2f78b8[_0x5b80('0x44')]=qs[_0x5b80('0x3b')](_[_0x5b80('0x45')](_0x4bc7a6[_0x5b80('0x3a')],_0xfba637[_0x5b80('0x3b')]));if(_0x4bc7a6[_0x5b80('0x3a')][_0x5b80('0x46')]){_0x2f78b8[_0x5b80('0x44')]=_['merge'](_0x2f78b8['where'],{'$or':_[_0x5b80('0x34')](_0x2f78b8[_0x5b80('0x3e')],function(_0xb131db){var _0x274012={};_0x274012[_0xb131db]={'$like':'%'+_0x4bc7a6[_0x5b80('0x3a')][_0x5b80('0x46')]+'%'};return _0x274012;})});}if(_0x4bc7a6[_0x5b80('0x3a')][_0x5b80('0x62')]){var _0x16a94e=_0x4bc7a6[_0x5b80('0x3a')][_0x5b80('0x62')]['split'](',');var _0x1a845c={};_0x1a845c[_0x16a94e[0x0]]={'$gte':moment(_0x16a94e[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2f78b8[_0x5b80('0x44')]=_[_0x5b80('0x47')](_0x2f78b8['where'],_0x1a845c);}_0x2f78b8=_[_0x5b80('0x47')]({},_0x2f78b8,_0x4bc7a6[_0x5b80('0x48')]);return _0x3996ce['getMessages'](_0x2f78b8);}})[_0x5b80('0x2d')](function(_0x4c565b){if(_0x4c565b){_0x38ba51=_0x4c565b['length'];if(!_0x4bc7a6[_0x5b80('0x3a')][_0x5b80('0x40')]('nolimit')){_0x2f78b8['limit']=qs['limit'](_0x4bc7a6[_0x5b80('0x3a')][_0x5b80('0x26')]);_0x2f78b8[_0x5b80('0x24')]=qs[_0x5b80('0x24')](_0x4bc7a6[_0x5b80('0x3a')]['offset']);}return _0x3996ce[_0x5b80('0x63')](_0x2f78b8);}})['then'](function(_0x1921e8){if(_0x1921e8){return _0x1921e8?{'count':_0x38ba51,'rows':_0x1921e8}:null;}})[_0x5b80('0x2d')](respondWithResult(_0x216dbe,null))['catch'](handleError(_0x216dbe,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 14324fa..8ed3c64 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 _0x0324=['../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x31f890,_0x30750b){var _0x1bc09a=function(_0x48ea97){while(--_0x48ea97){_0x31f890['push'](_0x31f890['shift']());}};_0x1bc09a(++_0x30750b);}(_0x0324,0x90));var _0x4032=function(_0x4197d1,_0x578c14){_0x4197d1=_0x4197d1-0x0;var _0x2900a1=_0x0324[_0x4197d1];return _0x2900a1;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x4032('0x0'))['db'][_0x4032('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x4032('0x2')](0x0);var events={'afterCreate':_0x4032('0x3'),'afterUpdate':_0x4032('0x4'),'afterDestroy':_0x4032('0x5')};function emitEvent(_0x4fbc08){return function(_0x17e87f,_0x23bfd7,_0x297bc9){ChatGroupEvents[_0x4032('0x6')](_0x4fbc08+':'+_0x17e87f['id'],_0x17e87f);ChatGroupEvents[_0x4032('0x6')](_0x4fbc08,_0x17e87f);_0x297bc9(null);};}for(var e in events){if(events[_0x4032('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x4032('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xd115=['update','emit','hasOwnProperty','events','../../mysqldb','ChatGroup','save'];(function(_0x3bf036,_0x412beb){var _0x201fe7=function(_0x1580c7){while(--_0x1580c7){_0x3bf036['push'](_0x3bf036['shift']());}};_0x201fe7(++_0x412beb);}(_0xd115,0x192));var _0x5d11=function(_0x39f877,_0x2d0aa2){_0x39f877=_0x39f877-0x0;var _0x3ab7fa=_0xd115[_0x39f877];return _0x3ab7fa;};'use strict';var EventEmitter=require(_0x5d11('0x0'));var ChatGroup=require(_0x5d11('0x1'))['db'][_0x5d11('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5d11('0x3'),'afterUpdate':_0x5d11('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4c4d66){return function(_0x46af40,_0x3ec5c8,_0x5a0d4e){ChatGroupEvents[_0x5d11('0x5')](_0x4c4d66+':'+_0x46af40['id'],_0x46af40);ChatGroupEvents[_0x5d11('0x5')](_0x4c4d66,_0x46af40);_0x5a0d4e(null);};}for(var e in events){if(events[_0x5d11('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 314e04b..2e41ec0 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 _0x2b00=['util','../../config/logger','bluebird','request-promise','path','rimraf','./chatGroup.attributes','define','ChatGroup','chat_groups'];(function(_0x32ba88,_0x17e5e9){var _0x568a41=function(_0x184f0f){while(--_0x184f0f){_0x32ba88['push'](_0x32ba88['shift']());}};_0x568a41(++_0x17e5e9);}(_0x2b00,0x1ae));var _0x02b0=function(_0x2998db,_0x3424f1){_0x2998db=_0x2998db-0x0;var _0x115fea=_0x2b00[_0x2998db];return _0x115fea;};'use strict';var _=require('lodash');var util=require(_0x02b0('0x0'));var logger=require(_0x02b0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x02b0('0x2'));var rp=require(_0x02b0('0x3'));var fs=require('fs');var path=require(_0x02b0('0x4'));var rimraf=require(_0x02b0('0x5'));var config=require('../../config/environment');var attributes=require(_0x02b0('0x6'));module['exports']=function(_0x148ed7,_0x73e46){return _0x148ed7[_0x02b0('0x7')](_0x02b0('0x8'),attributes,{'tableName':_0x02b0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc95c=['./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','moment','request-promise','path','rimraf'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc95c,0x127));var _0xcc95=function(_0x18d22b,_0x2bf0e6){_0x18d22b=_0x18d22b-0x0;var _0x3e97a6=_0xc95c[_0x18d22b];return _0x3e97a6;};'use strict';var _=require('lodash');var util=require(_0xcc95('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xcc95('0x1'));var BPromise=require('bluebird');var rp=require(_0xcc95('0x2'));var fs=require('fs');var path=require(_0xcc95('0x3'));var rimraf=require(_0xcc95('0x4'));var config=require('../../config/environment');var attributes=require(_0xcc95('0x5'));module[_0xcc95('0x6')]=function(_0x26cddb,_0x4b451b){return _0x26cddb[_0xcc95('0x7')](_0xcc95('0x8'),attributes,{'tableName':_0xcc95('0x9'),'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 3e317fe..866a6ff 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 _0x2a9a=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','./chatGroup.socket','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatGroup,\x20%s,\x20%s','result','catch','lodash','moment','ioredis','../../mysqldb'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x2a9a,0x64));var _0xa2a9=function(_0x3ea203,_0x14e36e){_0x3ea203=_0x3ea203-0x0;var _0x14eade=_0x2a9a[_0x3ea203];return _0x14eade;};'use strict';var _=require(_0xa2a9('0x0'));var util=require('util');var moment=require(_0xa2a9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa2a9('0x2'));var db=require(_0xa2a9('0x3'))['db'];var utils=require(_0xa2a9('0x4'));var logger=require(_0xa2a9('0x5'))(_0xa2a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa2a9('0x7'));var client=jayson[_0xa2a9('0x8')][_0xa2a9('0x9')]({'port':0x232a});config[_0xa2a9('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa2a9('0xa')]));require(_0xa2a9('0xb'))[_0xa2a9('0xc')](socket);function respondWithRpcPromise(_0x710040,_0x47a690,_0x2daf1c){return new BPromise(function(_0x375682,_0x5e9222){return client[_0xa2a9('0xd')](_0x710040,_0x2daf1c)[_0xa2a9('0xe')](function(_0x312aa9){logger[_0xa2a9('0xf')]('ChatGroup,\x20%s,\x20%s',_0x47a690,_0xa2a9('0x10'));logger[_0xa2a9('0x11')](_0xa2a9('0x12'),_0x47a690,_0xa2a9('0x10'),JSON[_0xa2a9('0x13')](_0x312aa9));if(_0x312aa9[_0xa2a9('0x14')]){if(_0x312aa9['error'][_0xa2a9('0x15')]===0x1f4){logger[_0xa2a9('0x14')]('ChatGroup,\x20%s,\x20%s',_0x47a690,_0x312aa9['error']['message']);return _0x5e9222(_0x312aa9[_0xa2a9('0x14')]['message']);}logger[_0xa2a9('0x14')]('ChatGroup,\x20%s,\x20%s',_0x47a690,_0x312aa9[_0xa2a9('0x14')][_0xa2a9('0x16')]);return _0x375682(_0x312aa9[_0xa2a9('0x14')][_0xa2a9('0x16')]);}else{logger['info'](_0xa2a9('0x17'),_0x47a690,'request\x20sent');_0x375682(_0x312aa9[_0xa2a9('0x18')]['message']);}})[_0xa2a9('0x19')](function(_0x4c857d){logger[_0xa2a9('0x14')](_0xa2a9('0x17'),_0x47a690,_0x4c857d);_0x5e9222(_0x4c857d);});});} \ No newline at end of file +var _0x9589=['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','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x5f21d3,_0x28b05c){var _0x342ed2=function(_0x529b26){while(--_0x529b26){_0x5f21d3['push'](_0x5f21d3['shift']());}};_0x342ed2(++_0x28b05c);}(_0x9589,0xbc));var _0x9958=function(_0x45e0fc,_0x7dbe4){_0x45e0fc=_0x45e0fc-0x0;var _0x549c12=_0x9589[_0x45e0fc];return _0x549c12;};'use strict';var _=require(_0x9958('0x0'));var util=require(_0x9958('0x1'));var moment=require(_0x9958('0x2'));var BPromise=require(_0x9958('0x3'));var rs=require(_0x9958('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9958('0x5'))['db'];var utils=require(_0x9958('0x6'));var logger=require(_0x9958('0x7'))('rpc');var config=require(_0x9958('0x8'));var jayson=require(_0x9958('0x9'));var client=jayson[_0x9958('0xa')][_0x9958('0xb')]({'port':0x232a});config[_0x9958('0xc')]=_[_0x9958('0xd')](config['redis'],{'host':_0x9958('0xe'),'port':0x18eb});var socket=require(_0x9958('0xf'))(new Redis(config[_0x9958('0xc')]));require(_0x9958('0x10'))[_0x9958('0x11')](socket);function respondWithRpcPromise(_0x185b6b,_0x1e2647,_0x1e5c25){return new BPromise(function(_0x3369b3,_0x68907){return client[_0x9958('0x12')](_0x185b6b,_0x1e5c25)[_0x9958('0x13')](function(_0x242f1b){logger[_0x9958('0x14')](_0x9958('0x15'),_0x1e2647,_0x9958('0x16'));logger[_0x9958('0x17')](_0x9958('0x18'),_0x1e2647,'request\x20sent',JSON[_0x9958('0x19')](_0x242f1b));if(_0x242f1b['error']){if(_0x242f1b[_0x9958('0x1a')]['code']===0x1f4){logger[_0x9958('0x1a')](_0x9958('0x15'),_0x1e2647,_0x242f1b[_0x9958('0x1a')][_0x9958('0x1b')]);return _0x68907(_0x242f1b['error'][_0x9958('0x1b')]);}logger[_0x9958('0x1a')]('ChatGroup,\x20%s,\x20%s',_0x1e2647,_0x242f1b['error'][_0x9958('0x1b')]);return _0x3369b3(_0x242f1b['error'][_0x9958('0x1b')]);}else{logger[_0x9958('0x14')](_0x9958('0x15'),_0x1e2647,_0x9958('0x16'));_0x3369b3(_0x242f1b[_0x9958('0x1c')][_0x9958('0x1b')]);}})['catch'](function(_0x54a10d){logger[_0x9958('0x1a')]('ChatGroup,\x20%s,\x20%s',_0x1e2647,_0x54a10d);_0x68907(_0x54a10d);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 8858790..2691480 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 _0xd3a8=['save','remove','emit','removeListener','register','length','./chatGroup.events'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xd3a8,0x76));var _0x8d3a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd3a8[_0x2641f9];return _0x585741;};'use strict';var ChatGroupEvents=require(_0x8d3a('0x0'));var events=[_0x8d3a('0x1'),_0x8d3a('0x2'),'update'];function createListener(_0x30ef61,_0x43fb51){return function(_0x2d9947){_0x43fb51[_0x8d3a('0x3')](_0x30ef61,_0x2d9947);};}function removeListener(_0x56d9ee,_0x5e75c2){return function(){ChatGroupEvents[_0x8d3a('0x4')](_0x56d9ee,_0x5e75c2);};}exports[_0x8d3a('0x5')]=function(_0x58e844){for(var _0xeabe76=0x0,_0x54c40a=events[_0x8d3a('0x6')];_0xeabe76<_0x54c40a;_0xeabe76++){var _0x340bf3=events[_0xeabe76];var _0x2a486f=createListener('chatGroup:'+_0x340bf3,_0x58e844);ChatGroupEvents['on'](_0x340bf3,_0x2a486f);}}; \ No newline at end of file +var _0x65e0=['remove','removeListener','register','length','chatGroup:','./chatGroup.events','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x65e0,0x171));var _0x065e=function(_0x3beb4e,_0x2d1a69){_0x3beb4e=_0x3beb4e-0x0;var _0xd40198=_0x65e0[_0x3beb4e];return _0xd40198;};'use strict';var ChatGroupEvents=require(_0x065e('0x0'));var events=[_0x065e('0x1'),_0x065e('0x2'),'update'];function createListener(_0x428636,_0xf5c434){return function(_0x3dde79){_0xf5c434['emit'](_0x428636,_0x3dde79);};}function removeListener(_0x50f10a,_0x53e805){return function(){ChatGroupEvents[_0x065e('0x3')](_0x50f10a,_0x53e805);};}exports[_0x065e('0x4')]=function(_0xe0c1e8){for(var _0x368bf1=0x0,_0x531618=events[_0x065e('0x5')];_0x368bf1<_0x531618;_0x368bf1++){var _0x385cd7=events[_0x368bf1];var _0x1c9f38=createListener(_0x065e('0x6')+_0x385cd7,_0xe0c1e8);ChatGroupEvents['on'](_0x385cd7,_0x1c9f38);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index f0adc14..628d9eb 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 _0xab6a=['express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage','delete','destroy','removeMembers','exports','util','path','connect-timeout'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0xab6a,0x192));var _0xaab6=function(_0x321f59,_0x2ce757){_0x321f59=_0x321f59-0x0;var _0x23d70c=_0xab6a[_0x321f59];return _0x23d70c;};'use strict';var multer=require('multer');var util=require(_0xaab6('0x0'));var path=require(_0xaab6('0x1'));var timeout=require(_0xaab6('0x2'));var express=require(_0xaab6('0x3'));var router=express[_0xaab6('0x4')]();var fs_extra=require(_0xaab6('0x5'));var auth=require(_0xaab6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatGroup.controller');router[_0xaab6('0x7')]('/',auth[_0xaab6('0x8')](),controller[_0xaab6('0x9')]);router[_0xaab6('0x7')](_0xaab6('0xa'),auth[_0xaab6('0x8')](),controller[_0xaab6('0xb')]);router[_0xaab6('0x7')](_0xaab6('0xc'),auth[_0xaab6('0x8')](),controller[_0xaab6('0xd')]);router[_0xaab6('0x7')](_0xaab6('0xe'),auth['isAuthenticated'](),controller[_0xaab6('0xf')]);router[_0xaab6('0x7')](_0xaab6('0x10'),auth['isAuthenticated'](),controller['getMembers']);router[_0xaab6('0x7')](_0xaab6('0x11'),auth[_0xaab6('0x8')](),controller[_0xaab6('0x12')]);router[_0xaab6('0x13')]('/',auth[_0xaab6('0x8')](),controller[_0xaab6('0x14')]);router[_0xaab6('0x13')](_0xaab6('0x10'),auth[_0xaab6('0x8')](),controller[_0xaab6('0x15')]);router[_0xaab6('0x13')](_0xaab6('0x11'),auth['isAuthenticated'](),controller[_0xaab6('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xaab6('0x17')](_0xaab6('0xc'),auth[_0xaab6('0x8')](),controller[_0xaab6('0x18')]);router[_0xaab6('0x17')](_0xaab6('0x10'),auth[_0xaab6('0x8')](),controller[_0xaab6('0x19')]);module[_0xaab6('0x1a')]=router; \ No newline at end of file +var _0xd800=['/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','update','delete','removeMembers','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/unread','getUnread'];(function(_0x48d86c,_0x3ce765){var _0xea02f1=function(_0x59f0be){while(--_0x59f0be){_0x48d86c['push'](_0x48d86c['shift']());}};_0xea02f1(++_0x3ce765);}(_0xd800,0x16b));var _0x0d80=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xd800[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0d80('0x0'));var util=require('util');var path=require(_0x0d80('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d80('0x2')]();var fs_extra=require(_0x0d80('0x3'));var auth=require(_0x0d80('0x4'));var interaction=require(_0x0d80('0x5'));var config=require(_0x0d80('0x6'));var controller=require('./chatGroup.controller');router[_0x0d80('0x7')]('/',auth[_0x0d80('0x8')](),controller[_0x0d80('0x9')]);router[_0x0d80('0x7')](_0x0d80('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0d80('0x7')](_0x0d80('0xb'),auth[_0x0d80('0x8')](),controller[_0x0d80('0xc')]);router[_0x0d80('0x7')](_0x0d80('0xd'),auth[_0x0d80('0x8')](),controller[_0x0d80('0xe')]);router[_0x0d80('0x7')](_0x0d80('0xf'),auth[_0x0d80('0x8')](),controller[_0x0d80('0x10')]);router[_0x0d80('0x7')](_0x0d80('0x11'),auth[_0x0d80('0x8')](),controller[_0x0d80('0x12')]);router[_0x0d80('0x13')]('/',auth[_0x0d80('0x8')](),controller[_0x0d80('0x14')]);router[_0x0d80('0x13')](_0x0d80('0xf'),auth[_0x0d80('0x8')](),controller[_0x0d80('0x15')]);router[_0x0d80('0x13')](_0x0d80('0x11'),auth[_0x0d80('0x8')](),controller[_0x0d80('0x16')]);router['put']('/:id',auth[_0x0d80('0x8')](),controller[_0x0d80('0x17')]);router[_0x0d80('0x18')](_0x0d80('0xb'),auth[_0x0d80('0x8')](),controller['destroy']);router[_0x0d80('0x18')]('/:id/members',auth[_0x0d80('0x8')](),controller[_0x0d80('0x19')]);module[_0x0d80('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index bfaa01a..34cce44 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 _0x6c50=['STRING','DATE','long','out','sequelize','exports','BOOLEAN','INTEGER','star','TEXT'];(function(_0x277292,_0xfe43e1){var _0x86d807=function(_0xc7b6a5){while(--_0xc7b6a5){_0x277292['push'](_0x277292['shift']());}};_0x86d807(++_0xfe43e1);}(_0x6c50,0xa4));var _0x06c5=function(_0x489db8,_0x1b0fe4){_0x489db8=_0x489db8-0x0;var _0x28b70d=_0x6c50[_0x489db8];return _0x28b70d;};'use strict';var Sequelize=require(_0x06c5('0x0'));module[_0x06c5('0x1')]={'closed':{'type':Sequelize[_0x06c5('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x06c5('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x06c5('0x4'),'thumb'),'defaultValue':_0x06c5('0x4')},'ratingMessage':{'type':Sequelize[_0x06c5('0x5')]},'pathTranscript':{'type':Sequelize[_0x06c5('0x5')]},'mailTranscript':{'type':Sequelize[_0x06c5('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x06c5('0x7')]},'disposition':{'type':Sequelize[_0x06c5('0x6')]},'secondDisposition':{'type':Sequelize[_0x06c5('0x6')]},'thirdDisposition':{'type':Sequelize[_0x06c5('0x6')]},'note':{'type':Sequelize[_0x06c5('0x6')]},'browserName':{'type':Sequelize[_0x06c5('0x6')]},'browserVersion':{'type':Sequelize[_0x06c5('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x06c5('0x6')]},'deviceModel':{'type':Sequelize[_0x06c5('0x6')]},'deviceVendor':{'type':Sequelize[_0x06c5('0x6')]},'deviceType':{'type':Sequelize[_0x06c5('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x06c5('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x06c5('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x06c5('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x06c5('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x06c5('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x8caf=['INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out','exports','BOOLEAN'];(function(_0x44e196,_0x50d0fd){var _0x370a79=function(_0x5341a2){while(--_0x5341a2){_0x44e196['push'](_0x44e196['shift']());}};_0x370a79(++_0x50d0fd);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x2e1051,_0x58b01d){_0x2e1051=_0x2e1051-0x0;var _0x5aa734=_0x8caf[_0x2e1051];return _0x5aa734;};'use strict';var Sequelize=require('sequelize');module[_0xf8ca('0x0')]={'closed':{'type':Sequelize[_0xf8ca('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xf8ca('0x2')]},'ratingType':{'type':Sequelize[_0xf8ca('0x3')](_0xf8ca('0x4'),_0xf8ca('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xf8ca('0x6')]},'pathTranscript':{'type':Sequelize[_0xf8ca('0x6')]},'mailTranscript':{'type':Sequelize[_0xf8ca('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xf8ca('0x8')]},'disposition':{'type':Sequelize[_0xf8ca('0x7')]},'secondDisposition':{'type':Sequelize[_0xf8ca('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf8ca('0x7')]},'browserName':{'type':Sequelize[_0xf8ca('0x7')]},'browserVersion':{'type':Sequelize[_0xf8ca('0x7')]},'osName':{'type':Sequelize[_0xf8ca('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xf8ca('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xf8ca('0x6')]},'customerIp':{'type':Sequelize[_0xf8ca('0x7')]},'formData':{'type':Sequelize[_0xf8ca('0x6')](_0xf8ca('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xf8ca('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xf8ca('0x3')]('in',_0xf8ca('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf8ca('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xf8ca('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xf8ca('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index b313d37..7299bd5 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 _0xd7d1=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','ChatInteractionId','all','rows','show','params','includeAll','include','create','destroy','describe','createVidaooSession','findOne','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','Interaction\x20already\x20assigned','update','disposition','file','basename','filename','Attachment','attachmentDownload','closed','json','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','close','mailTranscript','root','transcript-%s.txt','now','pathTranscript','Messages','format','agentAlias','System','customer','%s%d','Visitor','agentIdentifier','website_alias','agent_fullname','direction','secret','appendFileSync','MailAccount','Smtp','service','host','secure','auth','pass','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','alias','findAll','addTags','setTags','ids','omit','spread','emit','chatInteractionTags:save','removeTags','download','unix','tmp','server','files','attachments','transcript-%d-%s.zip','lastName','ChatWebsite','get','mkdirSync','Chat','Account','Owner','N.A.','browserName','osName','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','unlinkSync','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','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatInteraction.socket','register','jayson/promise','client','http','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','limit','undefined','count','offset','set','apply','reject','save','stack','name','send','contact','agent','interaction','account','map','fullname','TagIds','forEach','Tags','push','index','ChatInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','select','field','color','tools_tags','u.fullname','from','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','buildExpression','body','some','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','contactName','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','c.email'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0xa4acc4,_0xc5e7b1){_0xa4acc4=_0xa4acc4-0x0;var _0x16ad6b=_0xd7d1[_0xa4acc4];return _0x16ad6b;};'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 pdf=require(_0x1d7d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d7d('0x18'))(_0x1d7d('0x19'));var utils=require(_0x1d7d('0x1a'));var config=require(_0x1d7d('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x1d7d('0x1c'))['db'];config['redis']=_['defaults'](config[_0x1d7d('0x1d')],{'host':_0x1d7d('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1d7d('0x1f'))[_0x1d7d('0x20')](socket);var jayson=require(_0x1d7d('0x21'));var client=jayson[_0x1d7d('0x22')][_0x1d7d('0x23')]({'port':0x232b});var client9004=jayson['client'][_0x1d7d('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x1de6cc,_0x51cbca,_0xb90a8c,_0x162c3a){return new BPromise(function(_0x3c3417,_0x47826a){var _0x40db4d=_0x162c3a||client;return _0x40db4d['request'](_0x1de6cc,_0xb90a8c)[_0x1d7d('0x24')](function(_0x191024){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x51cbca,_0x1d7d('0x25'));logger[_0x1d7d('0x26')](_0x1d7d('0x27'),_0x51cbca,_0x1d7d('0x25'),JSON[_0x1d7d('0x28')](_0x191024));if(_0x191024[_0x1d7d('0x29')]){if(_0x191024['error'][_0x1d7d('0x2a')]===0x1f4){logger[_0x1d7d('0x29')](_0x1d7d('0x2b'),_0x51cbca,_0x191024['error'][_0x1d7d('0x2c')]);return _0x47826a(_0x191024[_0x1d7d('0x29')]['message']);}logger['error'](_0x1d7d('0x2b'),_0x51cbca,_0x191024[_0x1d7d('0x29')][_0x1d7d('0x2c')]);return _0x3c3417(_0x191024['error'][_0x1d7d('0x2c')]);}else{logger[_0x1d7d('0x2d')](_0x1d7d('0x2b'),_0x51cbca,_0x1d7d('0x25'));_0x3c3417(_0x191024['result'][_0x1d7d('0x2c')]);}})[_0x1d7d('0x2e')](function(_0x5c8257){logger['error'](_0x1d7d('0x2b'),_0x51cbca,_0x5c8257);_0x47826a(_0x5c8257);});});}function respondWithStatusCode(_0x52c618,_0x38c323){_0x38c323=_0x38c323||0xcc;return function(_0x2d4de4){if(_0x2d4de4){return _0x52c618[_0x1d7d('0x2f')](_0x38c323);}return _0x52c618[_0x1d7d('0x30')](_0x38c323)[_0x1d7d('0x31')]();};}function respondWithResult(_0x59f827,_0x1c2616){_0x1c2616=_0x1c2616||0xc8;return function(_0x98c1ad){if(_0x98c1ad){return _0x59f827[_0x1d7d('0x30')](_0x1c2616)['json'](_0x98c1ad);}};}function respondWithFilteredResult(_0x78adbe,_0x1a935a){return function(_0x23ad85){if(_0x23ad85){var _0x482367=typeof _0x1a935a['offset']==='undefined'&&typeof _0x1a935a[_0x1d7d('0x32')]===_0x1d7d('0x33');var _0x559f19=_0x23ad85[_0x1d7d('0x34')];var _0x3e4136=_0x482367?0x0:_0x1a935a[_0x1d7d('0x35')];var _0x3336ab=_0x482367?_0x23ad85[_0x1d7d('0x34')]:_0x1a935a[_0x1d7d('0x35')]+_0x1a935a[_0x1d7d('0x32')];var _0x803dc9;if(_0x3336ab>=_0x559f19){_0x3336ab=_0x559f19;_0x803dc9=0xc8;}else{_0x803dc9=0xce;}_0x78adbe[_0x1d7d('0x30')](_0x803dc9);return _0x78adbe[_0x1d7d('0x36')]('Content-Range',_0x3e4136+'-'+_0x3336ab+'/'+_0x559f19)['json'](_0x23ad85);}return null;};}function patchUpdates(_0x2e4402){return function(_0x2266a6){try{jsonpatch[_0x1d7d('0x37')](_0x2266a6,_0x2e4402,!![]);}catch(_0x40318f){return BPromise[_0x1d7d('0x38')](_0x40318f);}return _0x2266a6[_0x1d7d('0x39')]();};}function saveUpdates(_0x1aee3c,_0x40aca9){return function(_0x2fa3f4){if(_0x2fa3f4){return _0x2fa3f4['update'](_0x1aee3c)[_0x1d7d('0x24')](function(_0xf9d3e4){return _0xf9d3e4;});}return null;};}function removeEntity(_0x13a974,_0x30fb9a){return function(_0x4cc364){if(_0x4cc364){return _0x4cc364['destroy']()[_0x1d7d('0x24')](function(){_0x13a974[_0x1d7d('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x103c77,_0x3fea2e){return function(_0x568092){if(!_0x568092){_0x103c77['sendStatus'](0x194);}return _0x568092;};}function handleError(_0x26f81c,_0xc77f24){_0xc77f24=_0xc77f24||0x1f4;return function(_0x406f57){logger[_0x1d7d('0x29')](_0x406f57[_0x1d7d('0x3a')]);if(_0x406f57[_0x1d7d('0x3b')]){delete _0x406f57[_0x1d7d('0x3b')];}_0x26f81c[_0x1d7d('0x30')](_0xc77f24)[_0x1d7d('0x3c')](_0x406f57);};}function getMustacheRender(_0x318b9a,_0x4fcdcc){return Mustache['render'](_0x318b9a,_['merge'](_0x4fcdcc['body'],{'contact':_0x4fcdcc[_0x1d7d('0x3d')],'message':_0x4fcdcc['message'],'agent':_0x4fcdcc[_0x1d7d('0x3e')],'interaction':_0x4fcdcc[_0x1d7d('0x3f')],'account':_0x4fcdcc[_0x1d7d('0x40')]}))||'';}function getInteractionUsers(_0x515199,_0x5a4052){return new BPromise(function(_0x16a4e0,_0x153979){try{if(_0x5a4052[_0x515199['id']]){_0x515199['Users']=_[_0x1d7d('0x41')](_0x5a4052[_0x515199['id']],function(_0xa53806){return{'id':_0xa53806['id'],'fullname':_0xa53806[_0x1d7d('0x42')]};});}}catch(_0x2100f6){_0x153979(_0x2100f6);}_0x16a4e0(_0x515199);});}function getInteractionTags(_0x5eef0a,_0x1db8e8){return new BPromise(function(_0x42c229,_0x4239fa){try{if(_0x5eef0a[_0x1d7d('0x43')]){_0x5eef0a['Tags']=[];_0x5eef0a[_0x1d7d('0x43')]['split'](',')[_0x1d7d('0x44')](function(_0x31b850){_0x5eef0a[_0x1d7d('0x45')][_0x1d7d('0x46')](_0x1db8e8[_0x31b850]);});}delete _0x5eef0a[_0x1d7d('0x43')];}catch(_0x4becec){_0x4239fa(_0x4becec);}_0x42c229(_0x5eef0a);});}function updateChatInteraction(_0x59b8e7,_0x33582a,_0xe57fa5){return new BPromise(function(_0x1637fc,_0x4bed84){return getInteractionUsers(_0x59b8e7,_0xe57fa5)['then'](function(_0x12f397){return getInteractionTags(_0x12f397,_0x33582a);})['then'](function(_0x86e7bc){_0x1637fc(_0x86e7bc);})[_0x1d7d('0x2e')](function(_0x1d1064){_0x4bed84(_0x1d1064);});});}exports[_0x1d7d('0x47')]=function(_0x1e2ea8,_0x370e8d){var _0x72f5d7={},_0x51cb15={},_0x3ccd44={'count':0x0,'rows':[]};var _0x8b0c22=_['map'](db[_0x1d7d('0x48')][_0x1d7d('0x49')],function(_0x40599b){return{'name':_0x40599b[_0x1d7d('0x4a')],'type':_0x40599b[_0x1d7d('0x4b')][_0x1d7d('0x4c')]};});_0x51cb15[_0x1d7d('0x4d')]=_[_0x1d7d('0x41')](_0x8b0c22,_0x1d7d('0x3b'));_0x51cb15[_0x1d7d('0x4e')]=_[_0x1d7d('0x4f')](_0x1e2ea8[_0x1d7d('0x4e')]);_0x51cb15['filters']=_[_0x1d7d('0x50')](_0x51cb15['model'],_0x51cb15[_0x1d7d('0x4e')]);_0x72f5d7['attributes']=_[_0x1d7d('0x50')](_0x51cb15[_0x1d7d('0x4d')],qs[_0x1d7d('0x51')](_0x1e2ea8[_0x1d7d('0x4e')]['fields']));_0x72f5d7[_0x1d7d('0x52')]=_0x72f5d7['attributes']['length']?_0x72f5d7[_0x1d7d('0x52')]:_0x51cb15['model'];if(!_0x1e2ea8['query'][_0x1d7d('0x53')](_0x1d7d('0x54'))){_0x72f5d7['limit']=qs[_0x1d7d('0x32')](_0x1e2ea8[_0x1d7d('0x4e')]['limit']);_0x72f5d7[_0x1d7d('0x35')]=qs[_0x1d7d('0x35')](_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x35')]);}_0x72f5d7['order']=qs['sort'](_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x55')]);_0x72f5d7[_0x1d7d('0x56')]=qs[_0x1d7d('0x57')](_[_0x1d7d('0x58')](_0x1e2ea8['query'],_0x51cb15[_0x1d7d('0x57')]),_0x8b0c22);var _0x24e0b7=[];var _0x344b66=squel[_0x1d7d('0x59')]()[_0x1d7d('0x5a')]('id')[_0x1d7d('0x5a')](_0x1d7d('0x3b'))[_0x1d7d('0x5a')](_0x1d7d('0x5b'))['from'](_0x1d7d('0x5c'));var _0x41ad41=squel[_0x1d7d('0x59')]()['field']('u.id')[_0x1d7d('0x5a')](_0x1d7d('0x5d'))[_0x1d7d('0x5a')]('ui.ChatInteractionId')[_0x1d7d('0x5e')](_0x1d7d('0x5f'),'ui')['left_join'](_0x1d7d('0x60'),'u',_0x1d7d('0x61'));var _0x3fc216=squel[_0x1d7d('0x59')]()['from'](_0x1d7d('0x62'),'i')[_0x1d7d('0x63')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x1d7d('0x63')](_0x1d7d('0x60'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x1d7d('0x64'),'a',_0x1d7d('0x65'))[_0x1d7d('0x63')](_0x1d7d('0x66'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x1d7d('0x63')]('chat_interaction_has_tags','it',_0x1d7d('0x67'))[_0x1d7d('0x63')](_0x1d7d('0x5c'),'t',_0x1d7d('0x68'));var _0x5a4bd7=squel[_0x1d7d('0x69')]();var _0x1ea966=[];var _0x193135=squel[_0x1d7d('0x69')]();var _0x28ec14;if(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x6a')]){_0x28ec14=as[_0x1d7d('0x6b')](_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x6a')]);var _0x44a187=_0x28ec14[_0x1d7d('0x6c')];for(var _0x301a67=0x0;_0x301a67<_0x28ec14[_0x1d7d('0x6d')][_0x1d7d('0x6e')];_0x301a67++){var _0x520d3c=_0x28ec14[_0x1d7d('0x6d')][_0x301a67];var _0x566d27='i';var _0x1c9fe7=_[_0x1d7d('0x6f')](_0x8b0c22,[_0x1d7d('0x3b'),_0x520d3c[_0x1d7d('0x5a')]]);if(!_0x1c9fe7){switch(_0x520d3c[_0x1d7d('0x5a')]){case _0x1d7d('0x70'):if(_0x520d3c['value']==0x1){_0x3fc216[_0x1d7d('0x71')]('`'+_0x520d3c[_0x1d7d('0x5a')]+'`\x20=\x200');}else{_0x3fc216[_0x1d7d('0x71')]('`'+_0x520d3c['field']+_0x1d7d('0x72'));}break;case _0x1d7d('0x73'):if(_0x520d3c[_0x1d7d('0x74')]===_0x1d7d('0x75')){if(_0x520d3c[_0x1d7d('0x76')][_0x1d7d('0x77')]('\x20')['length']>0x1){_0x5a4bd7[_0x44a187](_0x1d7d('0x78'),qs[_0x1d7d('0x79')](_0x520d3c['value']),null);}else{var _0x3289c2='%'+_0x520d3c[_0x1d7d('0x76')]+'%';_0x5a4bd7[_0x44a187](_0x1d7d('0x7a'),_0x3289c2,_0x3289c2,_0x3289c2);}}else{_0x1c9fe7=_['find'](_0x8b0c22,[_0x1d7d('0x3b'),_0x1d7d('0x7b')]);_0x520d3c[_0x1d7d('0x5a')]=_0x1d7d('0x7b');_0x2e26d4=as['buildExpression'](_0x566d27,_0x1c9fe7[_0x1d7d('0x4b')],_0x520d3c);_0x5a4bd7[_0x44a187](_0x2e26d4[_0x1d7d('0x7c')],_0x2e26d4[_0x1d7d('0x76')][_0x1d7d('0x7d')],_0x2e26d4[_0x1d7d('0x76')]['end']);}break;case _0x1d7d('0x7e'):var _0x10dea3=_0x520d3c['value'][_0x1d7d('0x77')](',')[_0x1d7d('0x41')](function(_0x17c174){return Number(_0x17c174);});_0x10dea3[_0x1d7d('0x44')](function(_0x47d27e){_0x193135['or'](_0x1d7d('0x7f'),'%,'+_0x47d27e+',%');});_0x1ea966=_['union'](_0x1ea966,_0x10dea3);break;case _0x1d7d('0x80'):if(_0x520d3c[_0x1d7d('0x74')]===_0x1d7d('0x75')){_0x5a4bd7[_0x44a187]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x520d3c[_0x1d7d('0x76')]+'%',null);}else{_0x1c9fe7=_[_0x1d7d('0x6f')](_0x8b0c22,[_0x1d7d('0x3b'),'UserId']);_0x520d3c[_0x1d7d('0x5a')]='UserId';_0x2e26d4=as[_0x1d7d('0x81')](_0x566d27,_0x1c9fe7[_0x1d7d('0x4b')],_0x520d3c);_0x5a4bd7[_0x44a187](_0x2e26d4[_0x1d7d('0x7c')],_0x2e26d4[_0x1d7d('0x76')][_0x1d7d('0x7d')],_0x2e26d4[_0x1d7d('0x76')][_0x1d7d('0x31')]);}break;case _0x1d7d('0x82'):_0x2e26d4=as[_0x1d7d('0x81')]('me',null,_0x520d3c);_0x5a4bd7[_0x44a187](_0x2e26d4[_0x1d7d('0x7c')],_0x2e26d4[_0x1d7d('0x76')]['start'],_0x2e26d4['value'][_0x1d7d('0x31')]);break;}}else{var _0x2e26d4=as[_0x1d7d('0x81')](_0x566d27,_0x1c9fe7['type'],_0x520d3c);_0x5a4bd7[_0x44a187](_0x2e26d4[_0x1d7d('0x7c')],_0x2e26d4['value'][_0x1d7d('0x7d')],_0x2e26d4[_0x1d7d('0x76')]['end']);}}}else{var _0x1f55a2=_(_0x1e2ea8[_0x1d7d('0x4e')])['keys']()[_0x1d7d('0x41')](function(_0x40ee1f){return _[_0x1d7d('0x83')](_0x8b0c22,['name',_0x40ee1f])?_0x40ee1f:undefined;})['compact']()[_0x1d7d('0x76')]();if(!_[_0x1d7d('0x84')](_0x1f55a2)){_0x1f55a2['forEach'](function(_0x33430c){if(_0x33430c===_0x1d7d('0x85')){_0x3fc216[_0x1d7d('0x56')](_0x1d7d('0x86'),[]['concat'](_0x1e2ea8[_0x1d7d('0x4e')][_0x33430c]));}else if(_0x33430c===_0x1d7d('0x87')){var _0x22cdd1=JSON[_0x1d7d('0x88')](_0x1e2ea8[_0x1d7d('0x4e')][_0x33430c])[_0x1d7d('0x89')];var _0x42a83c=JSON[_0x1d7d('0x88')](_0x1e2ea8[_0x1d7d('0x4e')][_0x33430c])[_0x1d7d('0x8a')];_0x3fc216[_0x1d7d('0x56')](_0x1d7d('0x8b'),_0x22cdd1,_0x42a83c);}else{if(_0x1e2ea8[_0x1d7d('0x4e')][_0x33430c]==='null'){_0x3fc216[_0x1d7d('0x56')]('i.'+_0x33430c+_0x1d7d('0x8c'));}else{_0x3fc216['where']('i.'+_0x33430c+_0x1d7d('0x8d'),_0x1e2ea8[_0x1d7d('0x4e')][_0x33430c]);}}});}if(_0x1e2ea8['query']['read']){if(_0x1e2ea8['query'][_0x1d7d('0x8e')]==0x1){_0x3fc216[_0x1d7d('0x71')](_0x1d7d('0x8f'));}else{_0x3fc216[_0x1d7d('0x71')]('`unreadMessages`\x20>\x200');}}if(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x90')]){_0x1ea966=_[_0x1d7d('0x91')](_0x1e2ea8[_0x1d7d('0x4e')]['tag'])?_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x90')]:new Array(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x90')]);_0x1ea966[_0x1d7d('0x44')](function(_0x2a7229){_0x193135['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2a7229+',%');});}if(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x92')]){var _0x57aba7=_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x92')][_0x1d7d('0x93')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x1d7d('0x94')](_0x57aba7)){_0x5a4bd7['or']('i.id\x20LIKE\x20?',_0x57aba7+'%');}else{_0x5a4bd7['or'](_0x1d7d('0x95'),qs[_0x1d7d('0x79')](_0x57aba7))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x57aba7+'%');}}}_0x3fc216[_0x1d7d('0x56')](_0x5a4bd7);_0x3fc216[_0x1d7d('0x96')](_0x1d7d('0x97'));var _0xc3c42f={'type':db[_0x1d7d('0x98')][_0x1d7d('0x99')][_0x1d7d('0x9a')],'raw':!![]};var _0x155e88=_0x3fc216[_0x1d7d('0x9b')]();_0x155e88[_0x1d7d('0x5a')](_0x1d7d('0x97'));_0x155e88[_0x1d7d('0x5a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x72f5d7[_0x1d7d('0x9c')]){_0x72f5d7[_0x1d7d('0x9c')][_0x1d7d('0x44')](function(_0x395818){var _0x247289=_0x395818[0x0]===_0x1d7d('0x9d')?_0x395818[0x0]:'i.'+_0x395818[0x0];_0x3fc216[_0x1d7d('0x9c')](_0x247289,_0x395818[0x1]===_0x1d7d('0x9e')?![]:!![]);});}if(!_[_0x1d7d('0x84')](_0x1ea966)){_0x3fc216[_0x1d7d('0x71')](_0x193135);_0x155e88[_0x1d7d('0x56')](_0x1d7d('0x9f'),_0x1ea966);}BPromise['resolve']()[_0x1d7d('0x24')](function(){if(!_0x28ec14){if(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x85')])return;_0x155e88[_0x1d7d('0x56')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x3fc216[_0x1d7d('0x56')](_0x1d7d('0xa0'));return;}if(_0x1e2ea8[_0x1d7d('0xa1')][_0x1d7d('0xa2')]!=='agent')return;return _0x1e2ea8['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0x10925b){if(_[_0x1d7d('0x84')](_0x10925b)){_0x155e88['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x3fc216[_0x1d7d('0x56')](_0x1d7d('0xa3'));}else{_0x155e88[_0x1d7d('0x56')](_0x1d7d('0x86'),_[_0x1d7d('0x41')](_0x10925b,'id'));_0x3fc216[_0x1d7d('0x56')](_0x1d7d('0x86'),_[_0x1d7d('0x41')](_0x10925b,'id'));}});})[_0x1d7d('0x24')](function(){if(_0x1e2ea8[_0x1d7d('0xa1')]['role']===_0x1d7d('0x3e')&&!_0x28ec14&&!_0x1e2ea8['query'][_0x1d7d('0x85')])return[];return db[_0x1d7d('0xa4')][_0x1d7d('0x4e')](_0x155e88['toString'](),_0xc3c42f);})[_0x1d7d('0x24')](function(_0x40464c){_0x3ccd44[_0x1d7d('0x34')]=_0x40464c[_0x1d7d('0x6e')];if(_0x3ccd44[_0x1d7d('0x34')]===0x0)return[];return db[_0x1d7d('0xa4')][_0x1d7d('0x4e')](_0x344b66[_0x1d7d('0xa5')](),_0xc3c42f)[_0x1d7d('0x24')](function(_0x74e3fe){_0x24e0b7=_[_0x1d7d('0xa6')](_0x74e3fe,'id');_0xc3c42f=_[_0x1d7d('0xa7')](_0xc3c42f,{'model':db[_0x1d7d('0x48')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x51')]){_0x72f5d7[_0x1d7d('0x52')][_0x1d7d('0x44')](function(_0x2aac19){_0x3fc216[_0x1d7d('0x5a')]('i.'+_0x2aac19);});}else{_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xa8'),_0x1d7d('0x70'));_0x3fc216[_0x1d7d('0x5a')]('a.key',_0x1d7d('0xa9'));_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xaa'),'Account.mandatoryDisposition');_0x3fc216[_0x1d7d('0x5a')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x3fc216['field']('i.*');_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xab'),_0x1d7d('0xac'));_0x3fc216['field'](_0x1d7d('0xad'),'Contact.lastName');_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xae'),_0x1d7d('0xaf'));_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xb0'),_0x1d7d('0xb1'));_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xb2'),_0x1d7d('0xb3'));_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xb4'),'Contact.fax');_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xb5'),_0x1d7d('0xb6'));_0x3fc216['field'](_0x1d7d('0xb7'),_0x1d7d('0xb8'));_0x3fc216[_0x1d7d('0x5a')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x72f5d7[_0x1d7d('0x32')])_0x3fc216['limit'](_0x72f5d7[_0x1d7d('0x32')]);if(_0x72f5d7[_0x1d7d('0x35')])_0x3fc216['offset'](_0x72f5d7[_0x1d7d('0x35')]);return db[_0x1d7d('0xa4')]['query'](_0x3fc216[_0x1d7d('0xa5')](),_0xc3c42f);})[_0x1d7d('0x24')](function(_0x45b5e2){if(_0x45b5e2[_0x1d7d('0x6e')]>0x0)_0x41ad41['where']('ui.ChatInteractionId\x20IN\x20?',_[_0x1d7d('0x41')](_0x45b5e2,'id'));return db[_0x1d7d('0xa4')][_0x1d7d('0x4e')](_0x41ad41[_0x1d7d('0xa5')](),_0xc3c42f)[_0x1d7d('0x24')](function(_0xa5c005){var _0x1af86a=_[_0x1d7d('0xb9')](_0xa5c005,_0x1d7d('0xba'));var _0x434500=[];_0x45b5e2[_0x1d7d('0x44')](function(_0x26781c){_0x434500[_0x1d7d('0x46')](updateChatInteraction(_0x26781c,_0x24e0b7,_0x1af86a));});return BPromise[_0x1d7d('0xbb')](_0x434500);});});})[_0x1d7d('0x24')](function(_0x39924a){_0x3ccd44[_0x1d7d('0xbc')]=_0x39924a;return _0x3ccd44;})[_0x1d7d('0x24')](respondWithFilteredResult(_0x370e8d,_0x72f5d7))['catch'](handleError(_0x370e8d,null));};exports[_0x1d7d('0xbd')]=function(_0x45e83d,_0x16ce51){var _0x20b99d={'raw':![],'where':{'id':_0x45e83d[_0x1d7d('0xbe')]['id']}},_0x5ca824={};_0x5ca824[_0x1d7d('0x4d')]=_[_0x1d7d('0x4f')](db[_0x1d7d('0x48')]['rawAttributes']);_0x5ca824[_0x1d7d('0x4e')]=_['keys'](_0x45e83d[_0x1d7d('0x4e')]);_0x5ca824[_0x1d7d('0x57')]=_[_0x1d7d('0x50')](_0x5ca824['model'],_0x5ca824[_0x1d7d('0x4e')]);_0x20b99d['attributes']=_[_0x1d7d('0x50')](_0x5ca824[_0x1d7d('0x4d')],qs[_0x1d7d('0x51')](_0x45e83d[_0x1d7d('0x4e')]['fields']));_0x20b99d[_0x1d7d('0x52')]=_0x20b99d['attributes'][_0x1d7d('0x6e')]?_0x20b99d[_0x1d7d('0x52')]:_0x5ca824['model'];if(_0x45e83d[_0x1d7d('0x4e')][_0x1d7d('0xbf')]){_0x20b99d[_0x1d7d('0xc0')]=[{'all':!![]}];}_0x20b99d=_[_0x1d7d('0xa7')]({},_0x20b99d,_0x45e83d['options']);return db['ChatInteraction']['find'](_0x20b99d)[_0x1d7d('0x24')](handleEntityNotFound(_0x16ce51,null))[_0x1d7d('0x24')](respondWithResult(_0x16ce51,null))[_0x1d7d('0x2e')](handleError(_0x16ce51,null));};exports[_0x1d7d('0xc1')]=function(_0x458f92,_0x55ea3b){return db[_0x1d7d('0x48')][_0x1d7d('0xc1')](_0x458f92[_0x1d7d('0x82')],{})[_0x1d7d('0x24')](respondWithResult(_0x55ea3b,0xc9))['catch'](handleError(_0x55ea3b,null));};exports['update']=function(_0xbde512,_0x21995f){if(_0xbde512[_0x1d7d('0x82')]['id']){delete _0xbde512[_0x1d7d('0x82')]['id'];}return db[_0x1d7d('0x48')][_0x1d7d('0x6f')]({'where':{'id':_0xbde512['params']['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x21995f,null))['then'](saveUpdates(_0xbde512[_0x1d7d('0x82')],null))[_0x1d7d('0x24')](respondWithResult(_0x21995f,null))['catch'](handleError(_0x21995f,null));};exports[_0x1d7d('0xc2')]=function(_0x5a754a,_0x13566e){return db[_0x1d7d('0x48')][_0x1d7d('0x6f')]({'where':{'id':_0x5a754a[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x13566e,null))['then'](removeEntity(_0x13566e,null))[_0x1d7d('0x2e')](handleError(_0x13566e,null));};exports['describe']=function(_0x303d6f,_0x5bf0de){return db['ChatInteraction'][_0x1d7d('0xc3')]()[_0x1d7d('0x24')](respondWithResult(_0x5bf0de,null))[_0x1d7d('0x2e')](handleError(_0x5bf0de,null));};exports[_0x1d7d('0xc4')]=function(_0x8ce169,_0x3f119f){var _0x14d3fb=_0x8ce169[_0x1d7d('0xbe')]['id'];var _0x3d5fff;var _0x3b7543;var _0x3e94d6;return db[_0x1d7d('0x48')]['findOne']({'where':{'id':_0x14d3fb}})['then'](function(_0x1f2d68){_0x3d5fff=_0x1f2d68;return db['ChatWebsite'][_0x1d7d('0xc5')]({'where':{'id':_0x1f2d68['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0x1d7d('0xc6'),_0x1d7d('0xc7'),_0x1d7d('0xc8'),_0x1d7d('0xc9')],'raw':!![]});})[_0x1d7d('0x24')](function(_0xd919b1){if(_0xd919b1&&_0xd919b1[_0x1d7d('0xca')]&&_0xd919b1[_0x1d7d('0xc6')]){_0x3b7543=_0xd919b1;var _0x5690c={'interaction':{'id':_0x14d3fb},'agent':{'id':_0x8ce169['user']['id'],'name':_0x8ce169['user'][_0x1d7d('0x3b')],'fullname':_0x8ce169['user'][_0x1d7d('0x42')],'email':_0x8ce169[_0x1d7d('0xa1')][_0x1d7d('0xcb')]},'contact':_0x8ce169[_0x1d7d('0x82')][_0x1d7d('0x3d')],'account':_0x8ce169[_0x1d7d('0x82')][_0x1d7d('0x40')]};var _0x3774f8={'rejectUnauthorized':![],'method':_0x1d7d('0xcc'),'url':_0x1d7d('0xcd'),'headers':{'X-APIKEY':_0xd919b1[_0x1d7d('0xca')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x8ce169[_0x1d7d('0xa1')]['email']],'buttons':null,'topic':_0x3b7543['vidaooTopic'],'note':_[_0x1d7d('0xce')](_0x3b7543[_0x1d7d('0xc8')])?null:getMustacheRender(_0x3b7543[_0x1d7d('0xc8')],_0x5690c),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x3b7543[_0x1d7d('0xc9')])){var _0x470f5e=getMustacheRender(_0x3b7543['vidaooMetadata'],_0x5690c);var _0x1f0d9f=JSON['parse'](_0x470f5e);_0x3774f8[_0x1d7d('0x82')]['metadata']=_0x1f0d9f;}}catch(_0x1f50d4){throw new db[(_0x1d7d('0x98'))][(_0x1d7d('0xcf'))](_0x1d7d('0xd0'));}return rp(_0x3774f8);}else{throw new db[(_0x1d7d('0x98'))][(_0x1d7d('0xcf'))](_0x1d7d('0xd1'));}})[_0x1d7d('0x24')](function(_0x4f1602){_0x3e94d6=_0x4f1602;if(_0x3e94d6['id']){var _0x202d85={'body':_0x3e94d6[_0x1d7d('0xd2')],'ChatWebsiteId':_0x3b7543['id'],'ChatInteractionId':_0x3d5fff['id'],'direction':_0x1d7d('0xd3'),'UserId':_0x8ce169[_0x1d7d('0xa1')]['id']};return db[_0x1d7d('0xd4')][_0x1d7d('0xc1')](_0x202d85,{});}else{throw new db['Sequelize'][(_0x1d7d('0xcf'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x1d7d('0x24')](function(){return _0x3d5fff[_0x1d7d('0xd5')]({'vidaooSessionId':_0x3e94d6['id']});})['then'](respondWithResult(_0x3f119f,null))[_0x1d7d('0x2e')](handleError(_0x3f119f,null));};exports[_0x1d7d('0xd6')]=function(_0x3e7f3c,_0x454679){if(_0x3e7f3c['body']['id']){delete _0x3e7f3c[_0x1d7d('0x82')]['id'];}return db[_0x1d7d('0x48')]['find']({'where':{'id':_0x3e7f3c['params']['id']},'include':[{'model':db[_0x1d7d('0xd7')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x454679,null))['then'](saveUpdates(_0x3e7f3c[_0x1d7d('0x82')],null))['then'](respondWithResult(_0x454679,null))[_0x1d7d('0x2e')](handleError(_0x454679,null));};exports[_0x1d7d('0xd8')]=function(_0x4abfb1,_0x4caa84,_0x561f33){if(_0x4abfb1[_0x1d7d('0x82')]['id']){delete _0x4abfb1[_0x1d7d('0x82')]['id'];}return db[_0x1d7d('0x48')]['find']({'where':{'id':_0x4abfb1[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](function(_0x54616b){if(!_0x54616b){logger['error'](_0x1d7d('0xd9'),'abandon',0x194,'entity\x20not\x20found');_0x4caa84[_0x1d7d('0x2f')](0x194);}else{if(_0x54616b[_0x1d7d('0xda')]){throw new db[(_0x1d7d('0x98'))][(_0x1d7d('0xcf'))](_0x1d7d('0xdb'));}}return _0x54616b;})[_0x1d7d('0x24')](function(_0x19427f){if(_0x19427f){return _0x19427f[_0x1d7d('0xdc')]({'closed':_0x4abfb1['body']['closed'],'disposition':_0x4abfb1[_0x1d7d('0x82')][_0x1d7d('0xdd')]})[_0x1d7d('0x24')](function(_0x4d8a36){return _0x4d8a36;});}})[_0x1d7d('0x24')](function(_0x216585){return respondWithRpcPromise('AbandonInteraction',_0x1d7d('0xd8'),_0x4abfb1[_0x1d7d('0x82')],client9004);})[_0x1d7d('0x24')](respondWithResult(_0x4caa84,null))['catch'](handleError(_0x4caa84,null));};exports['attachmentUpload']=function(_0x854f68,_0x205d6f,_0x149415){_0x854f68[_0x1d7d('0x82')][_0x1d7d('0x3b')]=_0x854f68[_0x1d7d('0xde')]['originalname'];_0x854f68[_0x1d7d('0x82')][_0x1d7d('0xdf')]=_0x854f68['file'][_0x1d7d('0xe0')];_0x854f68[_0x1d7d('0x82')]['type']=_0x854f68['file']['mimetype'];return db[_0x1d7d('0xe1')][_0x1d7d('0xc1')](_0x854f68[_0x1d7d('0x82')])[_0x1d7d('0x24')](respondWithResult(_0x205d6f,0xc9))[_0x1d7d('0x2e')](handleError(_0x205d6f,null));};exports[_0x1d7d('0xe2')]=function(_0x3e358c,_0x2eae3c,_0x3838ef){return db[_0x1d7d('0x48')][_0x1d7d('0xc5')]({'where':{'id':_0x3e358c[_0x1d7d('0xbe')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2eae3c,null))['then'](function(_0x545b09){if(_0x545b09){if(_0x545b09[_0x1d7d('0xe3')]){return _0x2eae3c[_0x1d7d('0x30')](0x193)[_0x1d7d('0xe4')]({'status':0x193,'message':_0x1d7d('0xe5')});}return db[_0x1d7d('0xe1')][_0x1d7d('0xc5')]({'where':{'id':_0x3e358c[_0x1d7d('0x4e')][_0x1d7d('0xe6')]},'raw':!![]})['then'](handleEntityNotFound(_0x2eae3c,null));}})['then'](function(_0x549144){if(_0x549144){var _0x2a4feb=_0x549144[_0x1d7d('0xe7')]!==null;var _0x4df896=path[_0x1d7d('0xe8')](config['root'],_0x1d7d('0xe9'));if(_0x2a4feb){_0x4df896=path[_0x1d7d('0xe8')](_0x4df896,_0x1d7d('0xea'));}var _0x37eb97=path[_0x1d7d('0xe8')](_0x4df896,_0x549144[_0x1d7d('0xdf')]);return _0x2eae3c['download'](_0x37eb97);}})[_0x1d7d('0x2e')](handleError(_0x2eae3c,null));};exports[_0x1d7d('0xeb')]=function(_0x185697,_0x4d5753){var _0x55929b=null;var _0x43ce7f=null;var _0x2b0486=null;var _0x337c32=null;if(_0x185697['body']['id']){delete _0x185697[_0x1d7d('0x82')]['id'];}if(_0x185697['body'][_0x1d7d('0xec')]){_0x337c32=path[_0x1d7d('0xe8')](config[_0x1d7d('0xed')],'server/files/chat/upload/',util['format'](_0x1d7d('0xee'),Date[_0x1d7d('0xef')]()));_0x185697[_0x1d7d('0x82')][_0x1d7d('0xf0')]=_0x337c32;}return db[_0x1d7d('0x48')][_0x1d7d('0x6f')]({'where':{'id':_0x185697[_0x1d7d('0xbe')]['id']},'include':[{'model':db[_0x1d7d('0xd4')],'as':_0x1d7d('0xf1'),'include':[{'model':db[_0x1d7d('0x80')],'as':_0x1d7d('0x80')}]}]})['then'](handleEntityNotFound(_0x4d5753,null))[_0x1d7d('0x24')](saveUpdates(_0x185697[_0x1d7d('0x82')],null))[_0x1d7d('0x24')](function(_0x551a56){if(_0x551a56){_0x55929b=_0x551a56;return db['ChatWebsite'][_0x1d7d('0x6f')]({'where':{'id':_0x55929b['ChatWebsiteId']}});}})[_0x1d7d('0x24')](function(_0x1d47d9){if(_0x1d47d9){_0x2b0486=_0x1d47d9;return db[_0x1d7d('0xd7')]['find']({'where':{'id':_0x55929b[_0x1d7d('0x7b')]}});}})['then'](function(_0x5c0be4){if(_0x5c0be4){_0x43ce7f=_0x5c0be4;if(_0x337c32){var _0x46b9e5=null;for(var _0x385e15=0x1;_0x385e15<_0x55929b['Messages'][_0x1d7d('0x6e')];++_0x385e15){_0x46b9e5=_0x55929b[_0x1d7d('0xf1')][_0x385e15];var _0x20543c=_0x46b9e5[_0x1d7d('0xda')]?util[_0x1d7d('0xf2')]('%s%d',_0x2b0486[_0x1d7d('0xf3')],_0x46b9e5['UserId']):_0x1d7d('0xf4');var _0x474f68=_0x185697['body'][_0x1d7d('0xf5')]||util[_0x1d7d('0xf2')](_0x1d7d('0xf6'),_0x1d7d('0xf7'),_0x46b9e5[_0x1d7d('0x7b')]);switch(_0x2b0486[_0x1d7d('0xf8')]){case _0x1d7d('0xf9'):_0x20543c=_0x46b9e5[_0x1d7d('0xda')]?util[_0x1d7d('0xf2')](_0x1d7d('0xf6'),_0x2b0486[_0x1d7d('0xf3')],_0x46b9e5[_0x1d7d('0xda')]):_0x1d7d('0xf4');break;case'agent_alias':_0x20543c=_0x46b9e5['UserId']?_0x46b9e5[_0x1d7d('0x80')]['alias']||_0x46b9e5['User'][_0x1d7d('0x42')]:'System';break;case _0x1d7d('0xfa'):_0x20543c=_0x46b9e5[_0x1d7d('0xda')]?_0x46b9e5[_0x1d7d('0x80')]['fullname']:_0x1d7d('0xf4');break;default:_0x20543c=_0x46b9e5[_0x1d7d('0xda')]?util[_0x1d7d('0xf2')](_0x1d7d('0xf6'),_0x2b0486[_0x1d7d('0xf3')],_0x46b9e5[_0x1d7d('0xda')]):_0x1d7d('0xf4');}var _0x353bb1=util[_0x1d7d('0xf2')]('[%s]\x20%s:\x20%s\x0a',moment(_0x46b9e5[_0x1d7d('0x87')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x46b9e5[_0x1d7d('0xfb')]==='in'?_0x474f68:_0x20543c,_0x46b9e5['body']);if(!_0x46b9e5[_0x1d7d('0xfc')]){fs[_0x1d7d('0xfd')](_0x337c32,_0x353bb1);}}return db[_0x1d7d('0xfe')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x1d7d('0xff'),'raw':!![]}]});}}})[_0x1d7d('0x24')](function(_0x5c2113){if(_0x5c2113&&_0x5c2113[_0x1d7d('0xff')]&&_0x185697[_0x1d7d('0x82')]){var _0x129d4b={'tls':{'rejectUnauthorized':![]}};if(_0x5c2113['Smtp']['service']){_0x129d4b[_0x1d7d('0x100')]=_0x5c2113[_0x1d7d('0xff')][_0x1d7d('0x100')];}else{_0x129d4b['host']=_0x5c2113[_0x1d7d('0xff')][_0x1d7d('0x101')];_0x129d4b['port']=_0x5c2113['Smtp']['port'];_0x129d4b[_0x1d7d('0x102')]=_0x5c2113[_0x1d7d('0xff')][_0x1d7d('0x102')];}if(_0x5c2113['Smtp']['authentication']){_0x129d4b[_0x1d7d('0x103')]={'user':_0x5c2113[_0x1d7d('0xff')]['user'],'pass':_0x5c2113['Smtp'][_0x1d7d('0x104')]};}return respondWithRpcPromise(_0x1d7d('0x105'),'sendMail',{'account':_0x129d4b,'message':{'from':util[_0x1d7d('0xf2')]('\x22%s\x22\x20<%s>',_0x5c2113[_0x1d7d('0x3b')],_0x5c2113[_0x1d7d('0xcb')]||_0x5c2113[_0x1d7d('0xff')][_0x1d7d('0xa1')]),'to':_0x185697[_0x1d7d('0x82')][_0x1d7d('0xec')],'subject':_0x1d7d('0x106'),'text':util[_0x1d7d('0xf2')](_0x1d7d('0x107'),_0x185697[_0x1d7d('0x82')][_0x1d7d('0xec')]),'attachments':[{'path':_0x337c32}]}})['then'](function(){return _0x55929b;})[_0x1d7d('0x2e')](function(_0x18c505){console[_0x1d7d('0x29')](_0x18c505);});}else{return _0x55929b;}})['then'](respondWithStatusCode(_0x4d5753,0xc8))['catch'](handleError(_0x4d5753,null));};exports[_0x1d7d('0x108')]=function(_0x1b41b5,_0x5b79bd,_0xb87340){return db[_0x1d7d('0xd4')][_0x1d7d('0x6f')]({'where':{'id':_0x1b41b5[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x5b79bd,null))[_0x1d7d('0x24')](function(_0x537520){if(_0x537520){return _0x537520[_0x1d7d('0x108')](_0x1b41b5['body']['ids'],_['omit'](_0x1b41b5[_0x1d7d('0x82')],['ids','id'])||{});}})[_0x1d7d('0x24')](respondWithResult(_0x5b79bd,null))[_0x1d7d('0x2e')](handleError(_0x5b79bd,null));};exports['getMessages']=function(_0x1ce79d,_0x7dbbc9,_0x286ddd){var _0x1484b1={'raw':![],'where':{}};var _0x5be0c4={};var _0x50be17={'count':0x0,'rows':[]};return db[_0x1d7d('0x48')][_0x1d7d('0xc5')]({'where':{'id':_0x1ce79d[_0x1d7d('0xbe')]['id']}})['then'](handleEntityNotFound(_0x7dbbc9,null))['then'](function(_0x81fadf){if(_0x81fadf){_0x5be0c4['model']=_[_0x1d7d('0x4f')](db[_0x1d7d('0xd4')][_0x1d7d('0x49')]);_0x5be0c4[_0x1d7d('0x4e')]=_['keys'](_0x1ce79d[_0x1d7d('0x4e')]);_0x5be0c4['filters']=_[_0x1d7d('0x50')](_0x5be0c4[_0x1d7d('0x4d')],_0x5be0c4[_0x1d7d('0x4e')]);_0x1484b1['attributes']=_[_0x1d7d('0x50')](_0x5be0c4[_0x1d7d('0x4d')],qs['fields'](_0x1ce79d[_0x1d7d('0x4e')][_0x1d7d('0x51')]));_0x1484b1[_0x1d7d('0x52')]=_0x1484b1[_0x1d7d('0x52')]['length']?_0x1484b1[_0x1d7d('0x52')]:_0x5be0c4[_0x1d7d('0x4d')];if(!_0x1ce79d[_0x1d7d('0x4e')]['hasOwnProperty']('nolimit')){_0x1484b1[_0x1d7d('0x32')]=qs['limit'](_0x1ce79d[_0x1d7d('0x4e')][_0x1d7d('0x32')]);_0x1484b1[_0x1d7d('0x35')]=qs['offset'](_0x1ce79d[_0x1d7d('0x4e')]['offset']);}_0x1484b1[_0x1d7d('0x9c')]=qs['sort'](_0x1ce79d[_0x1d7d('0x4e')]['sort']);_0x1484b1['where']=qs[_0x1d7d('0x57')](_[_0x1d7d('0x58')](_0x1ce79d[_0x1d7d('0x4e')],_0x5be0c4[_0x1d7d('0x57')]));_0x1484b1[_0x1d7d('0x56')]['ChatInteractionId']=_0x81fadf['id'];if(_0x1ce79d[_0x1d7d('0x4e')][_0x1d7d('0x92')]){_0x1484b1[_0x1d7d('0x56')]=_['merge'](_0x1484b1[_0x1d7d('0x56')],{'$or':_['map'](_0x1484b1['attributes'],function(_0x19ee24){var _0x3cdad2={};_0x3cdad2[_0x19ee24]={'$like':'%'+_0x1ce79d['query'][_0x1d7d('0x92')]+'%'};return _0x3cdad2;})});}if(_0x1ce79d[_0x1d7d('0x4e')][_0x1d7d('0x89')]){var _0x24984d=_0x1ce79d[_0x1d7d('0x4e')]['$gte'][_0x1d7d('0x77')](',');var _0x5a2144={};_0x5a2144[_0x24984d[0x0]]={'$gte':moment(_0x24984d[0x1])[_0x1d7d('0xf2')](_0x1d7d('0x109'))};_0x1484b1[_0x1d7d('0x56')]=_['merge'](_0x1484b1['where'],_0x5a2144);}_0x1484b1=_['merge']({},_0x1484b1,_0x1ce79d['options']);return db['ChatMessage'][_0x1d7d('0x34')]({'where':_0x1484b1[_0x1d7d('0x56')]})[_0x1d7d('0x24')](function(_0x1e83dc){_0x50be17[_0x1d7d('0x34')]=_0x1e83dc;if(_0x1ce79d['query']['includeAll']){_0x1484b1[_0x1d7d('0xc0')]=[{'all':!![]}];}return db[_0x1d7d('0xd4')]['findAll'](_0x1484b1);})[_0x1d7d('0x24')](function(_0x2d0232){_0x50be17[_0x1d7d('0xbc')]=_0x2d0232;return _0x50be17;});}})['then'](respondWithFilteredResult(_0x7dbbc9,_0x1484b1))[_0x1d7d('0x2e')](handleError(_0x7dbbc9,null));};exports[_0x1d7d('0x10a')]=function(_0xb42210,_0x3844b6,_0x1181b6){var _0x530493={'where':{}},_0x53cdb8={},_0x960917={'count':0x0,'rows':[]};return db[_0x1d7d('0x48')][_0x1d7d('0xc5')]({'where':{'id':_0xb42210[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x3844b6,null))['then'](function(_0x339603){if(_0x339603){_0x53cdb8[_0x1d7d('0x4d')]=_['keys'](db['ChatMessage'][_0x1d7d('0x49')]);_0x53cdb8['query']=_[_0x1d7d('0x4f')](_0xb42210[_0x1d7d('0x4e')]);_0x53cdb8[_0x1d7d('0x57')]=_[_0x1d7d('0x50')](_0x53cdb8[_0x1d7d('0x4d')],_0x53cdb8[_0x1d7d('0x4e')]);_0x530493[_0x1d7d('0x52')]=_['intersection'](_0x53cdb8[_0x1d7d('0x4d')],qs[_0x1d7d('0x51')](_0xb42210[_0x1d7d('0x4e')]['fields']));_0x530493[_0x1d7d('0x52')]=_0x530493[_0x1d7d('0x52')]['length']?_0x530493[_0x1d7d('0x52')]:_0x53cdb8['model'];if(!_0xb42210[_0x1d7d('0x4e')][_0x1d7d('0x53')](_0x1d7d('0x54'))){_0x530493[_0x1d7d('0x32')]=qs[_0x1d7d('0x32')](_0xb42210['query'][_0x1d7d('0x32')]);_0x530493[_0x1d7d('0x35')]=qs['offset'](_0xb42210['query'][_0x1d7d('0x35')]);}_0x530493[_0x1d7d('0x9c')]=qs['sort'](_0xb42210[_0x1d7d('0x4e')][_0x1d7d('0x55')]);_0x530493[_0x1d7d('0x56')]=qs[_0x1d7d('0x57')](_['pick'](_0xb42210['query'],_0x53cdb8[_0x1d7d('0x57')]));_0x530493[_0x1d7d('0x56')][_0x1d7d('0xba')]=_0x339603['id'];if(_0xb42210[_0x1d7d('0x4e')][_0x1d7d('0x92')]){_0x530493[_0x1d7d('0x56')]=_[_0x1d7d('0xa7')](_0x530493[_0x1d7d('0x56')],{'$or':_[_0x1d7d('0x41')](_0x530493[_0x1d7d('0x52')],function(_0x3dfeb8){var _0x4726cb={};_0x4726cb[_0x3dfeb8]={'$like':'%'+_0xb42210[_0x1d7d('0x4e')][_0x1d7d('0x92')]+'%'};return _0x4726cb;})});}_0x530493[_0x1d7d('0x56')][_0x1d7d('0xfc')]=![];if(_0xb42210[_0x1d7d('0x4e')]['id']){_0x530493['where']['id']={'$gt':_0xb42210[_0x1d7d('0x4e')]['id']};}_0x530493=_['merge']({},_0x530493,_0xb42210['options']);return db[_0x1d7d('0xd4')][_0x1d7d('0x34')]({'where':_0x530493[_0x1d7d('0x56')]})[_0x1d7d('0x24')](function(_0x1e2b03){_0x960917['count']=_0x1e2b03;_0x530493[_0x1d7d('0xc0')]=[];if(_0xb42210[_0x1d7d('0x4e')]['includeAgent']){_0x530493[_0x1d7d('0xc0')]['push']({'model':db[_0x1d7d('0x80')],'as':_0x1d7d('0x80'),'attributes':['id',_0x1d7d('0x42'),_0x1d7d('0x10b')]});}if(_0xb42210[_0x1d7d('0x4e')]['includeAll']){_0x530493[_0x1d7d('0xc0')]=[{'all':!![]}];}return db[_0x1d7d('0xd4')][_0x1d7d('0x10c')](_0x530493);})[_0x1d7d('0x24')](function(_0x2d1258){_0x960917[_0x1d7d('0xbc')]=_0x2d1258;return _0x960917;});}})[_0x1d7d('0x24')](respondWithFilteredResult(_0x3844b6,_0x530493))[_0x1d7d('0x2e')](handleError(_0x3844b6,null));};exports[_0x1d7d('0x10d')]=function(_0x34b43f,_0x14a937,_0x291f26){return db['ChatInteraction'][_0x1d7d('0x6f')]({'where':{'id':_0x34b43f[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x14a937,null))['then'](function(_0x59b044){if(_0x59b044){return _0x59b044[_0x1d7d('0x10e')](_0x34b43f['body'][_0x1d7d('0x10f')],_[_0x1d7d('0x110')](_0x34b43f[_0x1d7d('0x82')],[_0x1d7d('0x10f'),'id'])||{})[_0x1d7d('0x111')](function(){return db[_0x1d7d('0x7e')]['findAll']({'attributes':['id',_0x1d7d('0x3b'),'color'],'where':{'id':_0x34b43f['body'][_0x1d7d('0x10f')]}});})[_0x1d7d('0x24')](function(_0x5b1ae1){socket[_0x1d7d('0x112')](_0x1d7d('0x113'),{'id':Number(_0x34b43f['params']['id']),'tags':_0x5b1ae1||[]});return{'id':Number(_0x34b43f[_0x1d7d('0xbe')]['id']),'tags':_0x5b1ae1||[]};});}})['then'](respondWithResult(_0x14a937,null))[_0x1d7d('0x2e')](handleError(_0x14a937,null));};exports[_0x1d7d('0x114')]=function(_0x7c3bd8,_0x552481,_0x2c91d5){return db['ChatInteraction'][_0x1d7d('0x6f')]({'where':{'id':_0x7c3bd8[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x552481,null))[_0x1d7d('0x24')](function(_0xf5e9f8){if(_0xf5e9f8){return _0xf5e9f8['removeTags'](_0x7c3bd8['query'][_0x1d7d('0x10f')]);}})[_0x1d7d('0x24')](respondWithStatusCode(_0x552481,null))['catch'](handleError(_0x552481,null));};exports[_0x1d7d('0x115')]=function(_0x210be0,_0x5f1b69){var _0x44c5ac=moment()[_0x1d7d('0x116')]()['toString']();var _0x39cae3=path[_0x1d7d('0xe8')](config[_0x1d7d('0xed')],'server','files',_0x1d7d('0x117'));var _0x1eec70=path[_0x1d7d('0xe8')](config[_0x1d7d('0xed')],_0x1d7d('0x118'),_0x1d7d('0x119'),_0x1d7d('0x11a'));var _0x3ded4b=path['join'](_0x39cae3,_0x44c5ac);var _0xe65d48=util[_0x1d7d('0xf2')](_0x1d7d('0x11b'),_0x210be0[_0x1d7d('0xbe')]['id'],_0x44c5ac);var _0x3b440c=path['join'](_0x39cae3,_0xe65d48);var _0x473472=[];_0x473472[_0x1d7d('0x46')]({'model':db[_0x1d7d('0x80')],'as':_0x1d7d('0x80'),'attributes':['id',_0x1d7d('0x42')],'raw':!![]});_0x473472[_0x1d7d('0x46')]({'model':db[_0x1d7d('0xd7')],'as':_0x1d7d('0x73'),'attributes':['id','firstName',_0x1d7d('0x11c')],'raw':!![]});if(_0x210be0[_0x1d7d('0x4e')][_0x1d7d('0x11a')]){_0x473472[_0x1d7d('0x46')]({'model':db['Attachment'],'as':_0x1d7d('0xe1'),'raw':!![]});}var _0x2aab28=[{'model':db[_0x1d7d('0xd4')],'as':_0x1d7d('0xf1'),'attributes':['id','body',_0x1d7d('0x87'),_0x1d7d('0xfb'),'secret',_0x1d7d('0x8e')],'include':_0x473472}];_0x2aab28['push']({'model':db[_0x1d7d('0x11d')],'as':'Account','attributes':['id','name']});_0x2aab28[_0x1d7d('0x46')]({'model':db[_0x1d7d('0x80')],'as':'Owner','attributes':['id','fullname']});return db[_0x1d7d('0x48')]['find']({'where':{'id':_0x210be0[_0x1d7d('0xbe')]['id']},'include':_0x2aab28})[_0x1d7d('0x24')](handleEntityNotFound(_0x5f1b69,null))[_0x1d7d('0x24')](function(_0x4e8473){if(_0x4e8473){var _0x194822=_0x4e8473[_0x1d7d('0x11e')]({'plain':!![]});fs[_0x1d7d('0x11f')](_0x3ded4b);var _0x3e93bb={'channel':_0x1d7d('0x120'),'account':_0x194822[_0x1d7d('0x121')]['name'],'agent':_0x194822['Owner']?_0x194822[_0x1d7d('0x122')][_0x1d7d('0x42')]:_0x1d7d('0x123'),'createdAt':moment(_0x194822[_0x1d7d('0x87')])[_0x1d7d('0xf2')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x194822[_0x1d7d('0xe3')]?moment(_0x194822['closedAt'])['format'](_0x1d7d('0x109'))[_0x1d7d('0xa5')]():'','disposition':_0x194822[_0x1d7d('0xdd')],'chatInfo':{'browser':_0x194822[_0x1d7d('0x124')],'os':_0x194822[_0x1d7d('0x125')],'referer':_0x194822['referer'],'customerIp':_0x194822[_0x1d7d('0x126')],'customerPort':_0x194822[_0x1d7d('0x127')]?_0x194822[_0x1d7d('0x127')]:_0x1d7d('0x123')},'messages':_(_0x194822[_0x1d7d('0xf1')])[_0x1d7d('0x128')]()['filter']({'secret':![]})[_0x1d7d('0x41')](function(_0x6ea91f){if(_0x6ea91f[_0x1d7d('0xe1')]){var _0x2b3cbd=path[_0x1d7d('0xe8')](_0x1eec70,_0x6ea91f[_0x1d7d('0xe1')][_0x1d7d('0xdf')]);if(fs['existsSync'](_0x2b3cbd)){fs[_0x1d7d('0x129')](_0x2b3cbd)[_0x1d7d('0x12a')](fs[_0x1d7d('0x12b')](path[_0x1d7d('0xe8')](_0x3ded4b,_0x6ea91f[_0x1d7d('0xe1')]['basename'])));}}return{'date':moment(_0x6ea91f[_0x1d7d('0x87')])[_0x1d7d('0xf2')](_0x1d7d('0x109'))[_0x1d7d('0xa5')](),'sender':_0x6ea91f['direction']==='out'?_0x6ea91f[_0x1d7d('0x80')]?_0x6ea91f[_0x1d7d('0x80')][_0x1d7d('0x42')]:_0x1d7d('0xf4'):_0x6ea91f[_0x1d7d('0x73')]['firstName']+(_0x6ea91f[_0x1d7d('0x73')][_0x1d7d('0x11c')]?'\x20'+_0x6ea91f[_0x1d7d('0x73')]['lastName']:''),'body':_0x6ea91f[_0x1d7d('0xe1')]?_0x6ea91f[_0x1d7d('0xe1')][_0x1d7d('0xdf')]:_0x6ea91f[_0x1d7d('0x82')],'direction':_0x6ea91f['direction']===_0x1d7d('0xd3')?'A':'C','secret':_0x6ea91f[_0x1d7d('0xfc')],'read':_0x6ea91f[_0x1d7d('0x8e')],'attachment':_0x6ea91f['Attachment']};})[_0x1d7d('0x76')]()};return ejs[_0x1d7d('0x12c')](path[_0x1d7d('0xe8')](config[_0x1d7d('0xed')],'server','views',_0x1d7d('0x12d')),{'interaction':_0x3e93bb})[_0x1d7d('0x24')](function(_0x43f4cb){var _0x21d65a=path[_0x1d7d('0xe8')](_0x3ded4b,'transcript-'+_0x194822['id']+'-'+_0x44c5ac+_0x1d7d('0x12e'));var _0x4d0682={'path':_0x21d65a,'channel':_0x1d7d('0x120'),'interactionId':_0x194822['id']};return pdf[_0x1d7d('0x12f')](_0x43f4cb,_0x4d0682);})['then'](function(){return new BPromise(function(_0x29f93c,_0x582183){zipdir(_0x3ded4b,{'saveTo':_0x3b440c},function(_0x12250e,_0x19127b){if(_0x12250e)return _0x582183(_0x12250e);return _0x29f93c(_0x19127b);});})['then'](function(){return new BPromise(function(_0x35f2d1,_0x588610){rimraf(_0x3ded4b,function(_0x35f18d){if(_0x35f18d)_0x588610(_0x35f18d);return _0x35f2d1();});});})[_0x1d7d('0x24')](function(){return _0x5f1b69[_0x1d7d('0x115')](_0x3b440c,_0xe65d48,function(_0x10263c){if(_0x10263c){console['log']('err',_0x10263c);}else{fs[_0x1d7d('0x130')](_0x3b440c);}});});});}else{return _0x5f1b69[_0x1d7d('0x2f')](0xc8);}})[_0x1d7d('0x2e')](handleError(_0x5f1b69,null));}; \ No newline at end of file +var _0x36ee=['filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','User','UserId','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20=\x20?','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','show','params','includeAll','options','create','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','POST','email','vidaooNote','isNull','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','closed','Unauthorized','attachId','ChatOfflineMessageId','root','server/files/attachments/','offline-chat/','join','download','close','mailTranscript','transcript-%s.txt','Messages','format','customer','%s%d','Visitor','agentIdentifier','website_alias','agentAlias','System','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','addMessage','omit','ids','getMessages','include','findAll','rows','getMyMessages','includeAgent','spread','emit','chatInteractionTags:save','removeTags','unix','files','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','direction','secret','read','Owner','get','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','osName','referer','customerIp','createReadStream','pipe','createWriteStream','out','server','views','downloadInteraction.ejs','log','err','unlinkSync','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','jayson/promise','client','http','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','json','limit','undefined','offset','count','set','apply','reject','save','update','then','end','sendStatus','stack','name','send','render','merge','body','contact','agent','interaction','account','Users','fullname','TagIds','Tags','split','forEach','push','index','map','ChatInteraction','rawAttributes','type','key','model','query','keys'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var pdf=require(_0xe36e('0x12'));var hardwareService=require(_0xe36e('0x13'));var logger=require(_0xe36e('0x14'))(_0xe36e('0x15'));var utils=require(_0xe36e('0x16'));var config=require(_0xe36e('0x17'));var licenseUtil=require(_0xe36e('0x18'));var db=require('../../mysqldb')['db'];config[_0xe36e('0x19')]=_[_0xe36e('0x1a')](config[_0xe36e('0x19')],{'host':_0xe36e('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe36e('0x19')]));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0xe36e('0x1c'));var client=jayson[_0xe36e('0x1d')][_0xe36e('0x1e')]({'port':0x232b});var client9004=jayson[_0xe36e('0x1d')][_0xe36e('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x924cd5,_0x2096f6,_0x39bae8,_0x387c37){return new BPromise(function(_0x428d34,_0x5792e8){var _0x333554=_0x387c37||client;return _0x333554[_0xe36e('0x1f')](_0x924cd5,_0x39bae8)['then'](function(_0x21d9a3){logger['info'](_0xe36e('0x20'),_0x2096f6,_0xe36e('0x21'));logger['debug'](_0xe36e('0x22'),_0x2096f6,_0xe36e('0x21'),JSON[_0xe36e('0x23')](_0x21d9a3));if(_0x21d9a3['error']){if(_0x21d9a3[_0xe36e('0x24')][_0xe36e('0x25')]===0x1f4){logger[_0xe36e('0x24')](_0xe36e('0x20'),_0x2096f6,_0x21d9a3[_0xe36e('0x24')][_0xe36e('0x26')]);return _0x5792e8(_0x21d9a3['error'][_0xe36e('0x26')]);}logger[_0xe36e('0x24')](_0xe36e('0x20'),_0x2096f6,_0x21d9a3[_0xe36e('0x24')][_0xe36e('0x26')]);return _0x428d34(_0x21d9a3['error']['message']);}else{logger[_0xe36e('0x27')](_0xe36e('0x20'),_0x2096f6,_0xe36e('0x21'));_0x428d34(_0x21d9a3[_0xe36e('0x28')][_0xe36e('0x26')]);}})[_0xe36e('0x29')](function(_0x1a045c){logger['error'](_0xe36e('0x20'),_0x2096f6,_0x1a045c);_0x5792e8(_0x1a045c);});});}function respondWithStatusCode(_0x35f9e7,_0x10597f){_0x10597f=_0x10597f||0xcc;return function(_0x262caa){if(_0x262caa){return _0x35f9e7['sendStatus'](_0x10597f);}return _0x35f9e7[_0xe36e('0x2a')](_0x10597f)['end']();};}function respondWithResult(_0xf7b02e,_0x5993de){_0x5993de=_0x5993de||0xc8;return function(_0x19f001){if(_0x19f001){return _0xf7b02e['status'](_0x5993de)[_0xe36e('0x2b')](_0x19f001);}};}function respondWithFilteredResult(_0x4c5d98,_0x3b1045){return function(_0x59548b){if(_0x59548b){var _0x4bb75b=typeof _0x3b1045['offset']==='undefined'&&typeof _0x3b1045[_0xe36e('0x2c')]===_0xe36e('0x2d');var _0x4cf185=_0x59548b['count'];var _0x1fa1ec=_0x4bb75b?0x0:_0x3b1045[_0xe36e('0x2e')];var _0x259e19=_0x4bb75b?_0x59548b[_0xe36e('0x2f')]:_0x3b1045[_0xe36e('0x2e')]+_0x3b1045[_0xe36e('0x2c')];var _0x57bb9b;if(_0x259e19>=_0x4cf185){_0x259e19=_0x4cf185;_0x57bb9b=0xc8;}else{_0x57bb9b=0xce;}_0x4c5d98[_0xe36e('0x2a')](_0x57bb9b);return _0x4c5d98[_0xe36e('0x30')]('Content-Range',_0x1fa1ec+'-'+_0x259e19+'/'+_0x4cf185)[_0xe36e('0x2b')](_0x59548b);}return null;};}function patchUpdates(_0xa06f61){return function(_0xba4869){try{jsonpatch[_0xe36e('0x31')](_0xba4869,_0xa06f61,!![]);}catch(_0x21623e){return BPromise[_0xe36e('0x32')](_0x21623e);}return _0xba4869[_0xe36e('0x33')]();};}function saveUpdates(_0x127807,_0x36cee2){return function(_0x1cc329){if(_0x1cc329){return _0x1cc329[_0xe36e('0x34')](_0x127807)['then'](function(_0x4507b9){return _0x4507b9;});}return null;};}function removeEntity(_0x59231e,_0x4a717e){return function(_0x81cf9a){if(_0x81cf9a){return _0x81cf9a['destroy']()[_0xe36e('0x35')](function(){_0x59231e[_0xe36e('0x2a')](0xcc)[_0xe36e('0x36')]();});}};}function handleEntityNotFound(_0x235437,_0x4a6a2b){return function(_0x56135c){if(!_0x56135c){_0x235437[_0xe36e('0x37')](0x194);}return _0x56135c;};}function handleError(_0x222c65,_0x19a53f){_0x19a53f=_0x19a53f||0x1f4;return function(_0x243338){logger['error'](_0x243338[_0xe36e('0x38')]);if(_0x243338[_0xe36e('0x39')]){delete _0x243338[_0xe36e('0x39')];}_0x222c65['status'](_0x19a53f)[_0xe36e('0x3a')](_0x243338);};}function getMustacheRender(_0x2ff8f4,_0x5d9f64){return Mustache[_0xe36e('0x3b')](_0x2ff8f4,_[_0xe36e('0x3c')](_0x5d9f64[_0xe36e('0x3d')],{'contact':_0x5d9f64[_0xe36e('0x3e')],'message':_0x5d9f64[_0xe36e('0x26')],'agent':_0x5d9f64[_0xe36e('0x3f')],'interaction':_0x5d9f64[_0xe36e('0x40')],'account':_0x5d9f64[_0xe36e('0x41')]}))||'';}function getInteractionUsers(_0x458a4e,_0x23da09){return new BPromise(function(_0x2f1933,_0x39dd9b){try{if(_0x23da09[_0x458a4e['id']]){_0x458a4e[_0xe36e('0x42')]=_['map'](_0x23da09[_0x458a4e['id']],function(_0x23d36e){return{'id':_0x23d36e['id'],'fullname':_0x23d36e[_0xe36e('0x43')]};});}}catch(_0xd45bb3){_0x39dd9b(_0xd45bb3);}_0x2f1933(_0x458a4e);});}function getInteractionTags(_0x11ee1d,_0x295feb){return new BPromise(function(_0x4d133b,_0x591e33){try{if(_0x11ee1d[_0xe36e('0x44')]){_0x11ee1d[_0xe36e('0x45')]=[];_0x11ee1d[_0xe36e('0x44')][_0xe36e('0x46')](',')[_0xe36e('0x47')](function(_0x34a1ba){_0x11ee1d[_0xe36e('0x45')][_0xe36e('0x48')](_0x295feb[_0x34a1ba]);});}delete _0x11ee1d['TagIds'];}catch(_0x198a40){_0x591e33(_0x198a40);}_0x4d133b(_0x11ee1d);});}function updateChatInteraction(_0x2d392c,_0x4788a0,_0x21dc35){return new BPromise(function(_0x5ef3e4,_0x23e344){return getInteractionUsers(_0x2d392c,_0x21dc35)[_0xe36e('0x35')](function(_0x1d45a4){return getInteractionTags(_0x1d45a4,_0x4788a0);})[_0xe36e('0x35')](function(_0x3b1269){_0x5ef3e4(_0x3b1269);})['catch'](function(_0x2ffc34){_0x23e344(_0x2ffc34);});});}exports[_0xe36e('0x49')]=function(_0x2265c4,_0x1dddfe){var _0x2e57f4={},_0x31760e={},_0x569809={'count':0x0,'rows':[]};var _0x122704=_[_0xe36e('0x4a')](db[_0xe36e('0x4b')][_0xe36e('0x4c')],function(_0x1cbb7d){return{'name':_0x1cbb7d['fieldName'],'type':_0x1cbb7d[_0xe36e('0x4d')][_0xe36e('0x4e')]};});_0x31760e[_0xe36e('0x4f')]=_[_0xe36e('0x4a')](_0x122704,_0xe36e('0x39'));_0x31760e[_0xe36e('0x50')]=_[_0xe36e('0x51')](_0x2265c4[_0xe36e('0x50')]);_0x31760e[_0xe36e('0x52')]=_['intersection'](_0x31760e['model'],_0x31760e[_0xe36e('0x50')]);_0x2e57f4['attributes']=_[_0xe36e('0x53')](_0x31760e[_0xe36e('0x4f')],qs[_0xe36e('0x54')](_0x2265c4[_0xe36e('0x50')]['fields']));_0x2e57f4[_0xe36e('0x55')]=_0x2e57f4[_0xe36e('0x55')]['length']?_0x2e57f4[_0xe36e('0x55')]:_0x31760e[_0xe36e('0x4f')];if(!_0x2265c4[_0xe36e('0x50')][_0xe36e('0x56')](_0xe36e('0x57'))){_0x2e57f4[_0xe36e('0x2c')]=qs[_0xe36e('0x2c')](_0x2265c4[_0xe36e('0x50')][_0xe36e('0x2c')]);_0x2e57f4[_0xe36e('0x2e')]=qs[_0xe36e('0x2e')](_0x2265c4[_0xe36e('0x50')][_0xe36e('0x2e')]);}_0x2e57f4[_0xe36e('0x58')]=qs[_0xe36e('0x59')](_0x2265c4['query'][_0xe36e('0x59')]);_0x2e57f4['where']=qs['filters'](_[_0xe36e('0x5a')](_0x2265c4[_0xe36e('0x50')],_0x31760e['filters']),_0x122704);var _0x3ec864=[];var _0x3814eb=squel[_0xe36e('0x5b')]()[_0xe36e('0x5c')]('id')[_0xe36e('0x5c')](_0xe36e('0x39'))[_0xe36e('0x5c')](_0xe36e('0x5d'))[_0xe36e('0x5e')]('tools_tags');var _0x22117e=squel[_0xe36e('0x5b')]()['field'](_0xe36e('0x5f'))[_0xe36e('0x5c')](_0xe36e('0x60'))[_0xe36e('0x5c')](_0xe36e('0x61'))['from']('user_has_chat_interactions','ui')['left_join']('users','u',_0xe36e('0x62'));var _0x2fab4c=squel[_0xe36e('0x5b')]()[_0xe36e('0x5e')](_0xe36e('0x63'),'i')[_0xe36e('0x64')](_0xe36e('0x65'),'c',_0xe36e('0x66'))[_0xe36e('0x64')]('users','o',_0xe36e('0x67'))[_0xe36e('0x64')]('chat_websites','a',_0xe36e('0x68'))[_0xe36e('0x64')](_0xe36e('0x69'),'me',_0xe36e('0x6a'))[_0xe36e('0x64')](_0xe36e('0x6b'),'it',_0xe36e('0x6c'))[_0xe36e('0x64')](_0xe36e('0x6d'),'t',_0xe36e('0x6e'));var _0x56718a=squel[_0xe36e('0x6f')]();var _0x389e91=[];var _0x6f979f=squel[_0xe36e('0x6f')]();var _0x3e4860;if(_0x2265c4[_0xe36e('0x50')][_0xe36e('0x70')]){_0x3e4860=as[_0xe36e('0x71')](_0x2265c4[_0xe36e('0x50')][_0xe36e('0x70')]);var _0x432584=_0x3e4860[_0xe36e('0x72')];for(var _0x434d88=0x0;_0x434d88<_0x3e4860[_0xe36e('0x73')]['length'];_0x434d88++){var _0x429a01=_0x3e4860[_0xe36e('0x73')][_0x434d88];var _0x49336b='i';var _0xce5583=_[_0xe36e('0x74')](_0x122704,[_0xe36e('0x39'),_0x429a01[_0xe36e('0x5c')]]);if(!_0xce5583){switch(_0x429a01[_0xe36e('0x5c')]){case _0xe36e('0x75'):if(_0x429a01['value']==0x1){_0x2fab4c[_0xe36e('0x76')]('`'+_0x429a01['field']+_0xe36e('0x77'));}else{_0x2fab4c[_0xe36e('0x76')]('`'+_0x429a01[_0xe36e('0x5c')]+_0xe36e('0x78'));}break;case _0xe36e('0x79'):if(_0x429a01[_0xe36e('0x7a')]===_0xe36e('0x7b')){if(_0x429a01[_0xe36e('0x7c')]['split']('\x20')[_0xe36e('0x7d')]>0x1){_0x56718a[_0x432584](_0xe36e('0x7e'),qs['getFullTextValue'](_0x429a01[_0xe36e('0x7c')]),null);}else{var _0x2bf9ac='%'+_0x429a01[_0xe36e('0x7c')]+'%';_0x56718a[_0x432584](_0xe36e('0x7f'),_0x2bf9ac,_0x2bf9ac,_0x2bf9ac);}}else{_0xce5583=_[_0xe36e('0x74')](_0x122704,[_0xe36e('0x39'),_0xe36e('0x80')]);_0x429a01['field']=_0xe36e('0x80');_0x483e06=as[_0xe36e('0x81')](_0x49336b,_0xce5583[_0xe36e('0x4d')],_0x429a01);_0x56718a[_0x432584](_0x483e06[_0xe36e('0x82')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x83')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x36')]);}break;case _0xe36e('0x84'):var _0xeab452=_0x429a01[_0xe36e('0x7c')]['split'](',')[_0xe36e('0x4a')](function(_0x9a77de){return Number(_0x9a77de);});_0xeab452[_0xe36e('0x47')](function(_0x2f05f5){_0x6f979f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2f05f5+',%');});_0x389e91=_['union'](_0x389e91,_0xeab452);break;case _0xe36e('0x85'):if(_0x429a01['operator']==='$substring'){_0x56718a[_0x432584]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x429a01[_0xe36e('0x7c')]+'%',null);}else{_0xce5583=_['find'](_0x122704,[_0xe36e('0x39'),_0xe36e('0x86')]);_0x429a01[_0xe36e('0x5c')]=_0xe36e('0x86');_0x483e06=as[_0xe36e('0x81')](_0x49336b,_0xce5583[_0xe36e('0x4d')],_0x429a01);_0x56718a[_0x432584](_0x483e06[_0xe36e('0x82')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x83')],_0x483e06['value'][_0xe36e('0x36')]);}break;case'body':_0x483e06=as[_0xe36e('0x81')]('me',null,_0x429a01);_0x56718a[_0x432584](_0x483e06['text'],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x83')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x36')]);break;}}else{var _0x483e06=as['buildExpression'](_0x49336b,_0xce5583[_0xe36e('0x4d')],_0x429a01);_0x56718a[_0x432584](_0x483e06[_0xe36e('0x82')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x83')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x36')]);}}}else{var _0x57ae0d=_(_0x2265c4[_0xe36e('0x50')])[_0xe36e('0x51')]()['map'](function(_0xb83ea7){return _['some'](_0x122704,[_0xe36e('0x39'),_0xb83ea7])?_0xb83ea7:undefined;})[_0xe36e('0x87')]()[_0xe36e('0x7c')]();if(!_[_0xe36e('0x88')](_0x57ae0d)){_0x57ae0d['forEach'](function(_0x2d920e){if(_0x2d920e==='ChatWebsiteId'){_0x2fab4c['where'](_0xe36e('0x89'),[][_0xe36e('0x8a')](_0x2265c4['query'][_0x2d920e]));}else if(_0x2d920e==='createdAt'){var _0x460cc9=JSON['parse'](_0x2265c4[_0xe36e('0x50')][_0x2d920e])[_0xe36e('0x8b')];var _0x2c0ed5=JSON[_0xe36e('0x8c')](_0x2265c4[_0xe36e('0x50')][_0x2d920e])[_0xe36e('0x8d')];_0x2fab4c['where'](_0xe36e('0x8e'),_0x460cc9,_0x2c0ed5);}else{if(_0x2265c4[_0xe36e('0x50')][_0x2d920e]===_0xe36e('0x8f')){_0x2fab4c[_0xe36e('0x90')]('i.'+_0x2d920e+'\x20IS\x20NULL');}else{_0x2fab4c[_0xe36e('0x90')]('i.'+_0x2d920e+_0xe36e('0x91'),_0x2265c4[_0xe36e('0x50')][_0x2d920e]);}}});}if(_0x2265c4[_0xe36e('0x50')]['read']){if(_0x2265c4[_0xe36e('0x50')]['read']==0x1){_0x2fab4c[_0xe36e('0x76')]('`unreadMessages`\x20=\x200');}else{_0x2fab4c[_0xe36e('0x76')]('`unreadMessages`\x20>\x200');}}if(_0x2265c4['query'][_0xe36e('0x92')]){_0x389e91=_[_0xe36e('0x93')](_0x2265c4[_0xe36e('0x50')]['tag'])?_0x2265c4[_0xe36e('0x50')][_0xe36e('0x92')]:new Array(_0x2265c4['query'][_0xe36e('0x92')]);_0x389e91[_0xe36e('0x47')](function(_0x156e7f){_0x6f979f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x156e7f+',%');});}if(_0x2265c4['query'][_0xe36e('0x94')]){var _0x2ba37a=_0x2265c4[_0xe36e('0x50')][_0xe36e('0x94')][_0xe36e('0x95')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xe36e('0x96')](_0x2ba37a)){_0x56718a['or'](_0xe36e('0x97'),_0x2ba37a+'%');}else{_0x56718a['or'](_0xe36e('0x98'),qs[_0xe36e('0x99')](_0x2ba37a))['or'](_0xe36e('0x9a'),_0x2ba37a+'%');}}}_0x2fab4c['where'](_0x56718a);_0x2fab4c[_0xe36e('0x9b')](_0xe36e('0x9c'));var _0x188dc9={'type':db['Sequelize'][_0xe36e('0x9d')]['SELECT'],'raw':!![]};var _0x2ee394=_0x2fab4c['clone']();_0x2ee394[_0xe36e('0x5c')](_0xe36e('0x9c'));_0x2ee394['field'](_0xe36e('0x9e'),'unreadMessages');if(_0x2e57f4[_0xe36e('0x58')]){_0x2e57f4[_0xe36e('0x58')][_0xe36e('0x47')](function(_0x201212){var _0x431aac=_0x201212[0x0]==='contactName'?_0x201212[0x0]:'i.'+_0x201212[0x0];_0x2fab4c[_0xe36e('0x58')](_0x431aac,_0x201212[0x1]==='DESC'?![]:!![]);});}if(!_[_0xe36e('0x88')](_0x389e91)){_0x2fab4c[_0xe36e('0x76')](_0x6f979f);_0x2ee394[_0xe36e('0x90')](_0xe36e('0x9f'),_0x389e91);}BPromise[_0xe36e('0xa0')]()[_0xe36e('0x35')](function(){if(!_0x3e4860){if(_0x2265c4['query'][_0xe36e('0xa1')])return;_0x2ee394[_0xe36e('0x90')](_0xe36e('0xa2'));_0x2fab4c['where'](_0xe36e('0xa2'));return;}if(_0x2265c4[_0xe36e('0xa3')][_0xe36e('0xa4')]!==_0xe36e('0x3f'))return;return _0x2265c4['user'][_0xe36e('0xa5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x11ebdd){if(_['isEmpty'](_0x11ebdd)){_0x2ee394[_0xe36e('0x90')](_0xe36e('0xa6'));_0x2fab4c[_0xe36e('0x90')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x2ee394[_0xe36e('0x90')](_0xe36e('0x89'),_['map'](_0x11ebdd,'id'));_0x2fab4c[_0xe36e('0x90')](_0xe36e('0x89'),_[_0xe36e('0x4a')](_0x11ebdd,'id'));}});})['then'](function(){if(_0x2265c4['user'][_0xe36e('0xa4')]===_0xe36e('0x3f')&&!_0x3e4860&&!_0x2265c4[_0xe36e('0x50')][_0xe36e('0xa1')])return[];return db[_0xe36e('0xa7')]['query'](_0x2ee394[_0xe36e('0xa8')](),_0x188dc9);})[_0xe36e('0x35')](function(_0x2c923b){_0x569809[_0xe36e('0x2f')]=_0x2c923b['length'];if(_0x569809[_0xe36e('0x2f')]===0x0)return[];return db[_0xe36e('0xa7')]['query'](_0x3814eb['toString'](),_0x188dc9)['then'](function(_0x1acffb){_0x3ec864=_['keyBy'](_0x1acffb,'id');_0x188dc9=_['merge'](_0x188dc9,{'model':db[_0xe36e('0x4b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2265c4[_0xe36e('0x50')][_0xe36e('0x54')]){_0x2e57f4[_0xe36e('0x55')][_0xe36e('0x47')](function(_0x378126){_0x2fab4c['field']('i.'+_0x378126);});}else{_0x2fab4c[_0xe36e('0x5c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xa9'),_0xe36e('0xaa'));_0x2fab4c[_0xe36e('0x5c')]('a.mandatoryDisposition',_0xe36e('0xab'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xac'),_0xe36e('0xad'));_0x2fab4c['field'](_0xe36e('0xae'));_0x2fab4c['field'](_0xe36e('0xaf'),_0xe36e('0xb0'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xb1'),_0xe36e('0xb2'));_0x2fab4c['field'](_0xe36e('0xb3'),_0xe36e('0xb4'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xb5'),_0xe36e('0xb6'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xb7'),_0xe36e('0xb8'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xb9'),_0xe36e('0xba'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xbb'),'Owner.fullname');_0x2fab4c['field']('o.internal',_0xe36e('0xbc'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xbd'),_0xe36e('0x44'));}if(_0x2e57f4['limit'])_0x2fab4c[_0xe36e('0x2c')](_0x2e57f4[_0xe36e('0x2c')]);if(_0x2e57f4[_0xe36e('0x2e')])_0x2fab4c[_0xe36e('0x2e')](_0x2e57f4['offset']);return db[_0xe36e('0xa7')][_0xe36e('0x50')](_0x2fab4c[_0xe36e('0xa8')](),_0x188dc9);})[_0xe36e('0x35')](function(_0x515a79){if(_0x515a79['length']>0x0)_0x22117e[_0xe36e('0x90')](_0xe36e('0xbe'),_['map'](_0x515a79,'id'));return db['sequelize']['query'](_0x22117e[_0xe36e('0xa8')](),_0x188dc9)[_0xe36e('0x35')](function(_0xd57a9e){var _0x4d7f1a=_[_0xe36e('0xbf')](_0xd57a9e,_0xe36e('0xc0'));var _0x280812=[];_0x515a79[_0xe36e('0x47')](function(_0x5250c9){_0x280812[_0xe36e('0x48')](updateChatInteraction(_0x5250c9,_0x3ec864,_0x4d7f1a));});return BPromise[_0xe36e('0xc1')](_0x280812);});});})[_0xe36e('0x35')](function(_0x3b4152){_0x569809['rows']=_0x3b4152;return _0x569809;})[_0xe36e('0x35')](respondWithFilteredResult(_0x1dddfe,_0x2e57f4))['catch'](handleError(_0x1dddfe,null));};exports[_0xe36e('0xc2')]=function(_0x4c169c,_0x1c95cd){var _0x2b3e81={'raw':![],'where':{'id':_0x4c169c[_0xe36e('0xc3')]['id']}},_0x498822={};_0x498822[_0xe36e('0x4f')]=_['keys'](db[_0xe36e('0x4b')][_0xe36e('0x4c')]);_0x498822[_0xe36e('0x50')]=_[_0xe36e('0x51')](_0x4c169c[_0xe36e('0x50')]);_0x498822[_0xe36e('0x52')]=_['intersection'](_0x498822[_0xe36e('0x4f')],_0x498822[_0xe36e('0x50')]);_0x2b3e81['attributes']=_[_0xe36e('0x53')](_0x498822['model'],qs[_0xe36e('0x54')](_0x4c169c[_0xe36e('0x50')][_0xe36e('0x54')]));_0x2b3e81[_0xe36e('0x55')]=_0x2b3e81['attributes'][_0xe36e('0x7d')]?_0x2b3e81[_0xe36e('0x55')]:_0x498822[_0xe36e('0x4f')];if(_0x4c169c[_0xe36e('0x50')][_0xe36e('0xc4')]){_0x2b3e81['include']=[{'all':!![]}];}_0x2b3e81=_[_0xe36e('0x3c')]({},_0x2b3e81,_0x4c169c[_0xe36e('0xc5')]);return db['ChatInteraction']['find'](_0x2b3e81)[_0xe36e('0x35')](handleEntityNotFound(_0x1c95cd,null))['then'](respondWithResult(_0x1c95cd,null))[_0xe36e('0x29')](handleError(_0x1c95cd,null));};exports[_0xe36e('0xc6')]=function(_0x23dfd7,_0x3f9c84){return db[_0xe36e('0x4b')][_0xe36e('0xc6')](_0x23dfd7[_0xe36e('0x3d')],{})[_0xe36e('0x35')](respondWithResult(_0x3f9c84,0xc9))[_0xe36e('0x29')](handleError(_0x3f9c84,null));};exports[_0xe36e('0x34')]=function(_0x4ca2cc,_0xab0e50){if(_0x4ca2cc['body']['id']){delete _0x4ca2cc[_0xe36e('0x3d')]['id'];}return db[_0xe36e('0x4b')][_0xe36e('0x74')]({'where':{'id':_0x4ca2cc['params']['id']}})[_0xe36e('0x35')](handleEntityNotFound(_0xab0e50,null))[_0xe36e('0x35')](saveUpdates(_0x4ca2cc['body'],null))[_0xe36e('0x35')](respondWithResult(_0xab0e50,null))['catch'](handleError(_0xab0e50,null));};exports[_0xe36e('0xc7')]=function(_0x3d14b1,_0x3246c6){return db[_0xe36e('0x4b')][_0xe36e('0x74')]({'where':{'id':_0x3d14b1[_0xe36e('0xc3')]['id']}})[_0xe36e('0x35')](handleEntityNotFound(_0x3246c6,null))[_0xe36e('0x35')](removeEntity(_0x3246c6,null))[_0xe36e('0x29')](handleError(_0x3246c6,null));};exports[_0xe36e('0xc8')]=function(_0x166c22,_0x47b082){return db['ChatInteraction'][_0xe36e('0xc8')]()[_0xe36e('0x35')](respondWithResult(_0x47b082,null))[_0xe36e('0x29')](handleError(_0x47b082,null));};exports[_0xe36e('0xc9')]=function(_0x5b3f98,_0xf38a08){var _0x24a0f6=_0x5b3f98['params']['id'];var _0x281519;var _0x4d12f6;var _0x260fff;return db[_0xe36e('0x4b')][_0xe36e('0xca')]({'where':{'id':_0x24a0f6}})['then'](function(_0x142caa){_0x281519=_0x142caa;return db[_0xe36e('0xcb')][_0xe36e('0xca')]({'where':{'id':_0x142caa[_0xe36e('0xa1')]},'attributes':['id',_0xe36e('0xcc'),_0xe36e('0xcd'),_0xe36e('0xce'),'vidaooNote',_0xe36e('0xcf')],'raw':!![]});})[_0xe36e('0x35')](function(_0x2d890a){if(_0x2d890a&&_0x2d890a[_0xe36e('0xcc')]&&_0x2d890a[_0xe36e('0xcd')]){_0x4d12f6=_0x2d890a;var _0x165372={'interaction':{'id':_0x24a0f6},'agent':{'id':_0x5b3f98[_0xe36e('0xa3')]['id'],'name':_0x5b3f98[_0xe36e('0xa3')][_0xe36e('0x39')],'fullname':_0x5b3f98['user'][_0xe36e('0x43')],'email':_0x5b3f98[_0xe36e('0xa3')]['email']},'contact':_0x5b3f98['body']['contact'],'account':_0x5b3f98[_0xe36e('0x3d')][_0xe36e('0x41')]};var _0x4ed60e={'rejectUnauthorized':![],'method':_0xe36e('0xd0'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x2d890a['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5b3f98['user'][_0xe36e('0xd1')]],'buttons':null,'topic':_0x4d12f6[_0xe36e('0xce')],'note':_['isNull'](_0x4d12f6[_0xe36e('0xd2')])?null:getMustacheRender(_0x4d12f6[_0xe36e('0xd2')],_0x165372),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xe36e('0xd3')](_0x4d12f6[_0xe36e('0xcf')])){var _0x493407=getMustacheRender(_0x4d12f6[_0xe36e('0xcf')],_0x165372);var _0x3d451f=JSON['parse'](_0x493407);_0x4ed60e['body'][_0xe36e('0xd4')]=_0x3d451f;}}catch(_0x1e018b){throw new db[(_0xe36e('0xd5'))][(_0xe36e('0xd6'))](_0xe36e('0xd7'));}return rp(_0x4ed60e);}else{throw new db[(_0xe36e('0xd5'))][(_0xe36e('0xd6'))](_0xe36e('0xd8'));}})['then'](function(_0x44cf3d){_0x260fff=_0x44cf3d;if(_0x260fff['id']){var _0x7b1e8f={'body':_0x260fff[_0xe36e('0xd9')],'ChatWebsiteId':_0x4d12f6['id'],'ChatInteractionId':_0x281519['id'],'direction':'out','UserId':_0x5b3f98[_0xe36e('0xa3')]['id']};return db[_0xe36e('0xda')][_0xe36e('0xc6')](_0x7b1e8f,{});}else{throw new db[(_0xe36e('0xd5'))][(_0xe36e('0xd6'))](_0xe36e('0xdb'));}})['then'](function(){return _0x281519[_0xe36e('0xdc')]({'vidaooSessionId':_0x260fff['id']});})[_0xe36e('0x35')](respondWithResult(_0xf38a08,null))['catch'](handleError(_0xf38a08,null));};exports['customUpdate']=function(_0x33f382,_0x4a6986){if(_0x33f382[_0xe36e('0x3d')]['id']){delete _0x33f382[_0xe36e('0x3d')]['id'];}return db['ChatInteraction'][_0xe36e('0x74')]({'where':{'id':_0x33f382[_0xe36e('0xc3')]['id']},'include':[{'model':db[_0xe36e('0xdd')],'as':_0xe36e('0x79')}]})['then'](handleEntityNotFound(_0x4a6986,null))['then'](saveUpdates(_0x33f382[_0xe36e('0x3d')],null))[_0xe36e('0x35')](respondWithResult(_0x4a6986,null))[_0xe36e('0x29')](handleError(_0x4a6986,null));};exports[_0xe36e('0xde')]=function(_0x15bf65,_0x2c2f12,_0x1ec6c5){if(_0x15bf65['body']['id']){delete _0x15bf65[_0xe36e('0x3d')]['id'];}return db[_0xe36e('0x4b')][_0xe36e('0x74')]({'where':{'id':_0x15bf65[_0xe36e('0xc3')]['id']}})[_0xe36e('0x35')](function(_0x322fc4){if(!_0x322fc4){logger[_0xe36e('0x24')](_0xe36e('0xdf'),_0xe36e('0xde'),0x194,_0xe36e('0xe0'));_0x2c2f12[_0xe36e('0x37')](0x194);}else{if(_0x322fc4['UserId']){throw new db[(_0xe36e('0xd5'))][(_0xe36e('0xd6'))](_0xe36e('0xe1'));}}return _0x322fc4;})[_0xe36e('0x35')](function(_0x478cc9){if(_0x478cc9){return _0x478cc9['update']({'closed':_0x15bf65[_0xe36e('0x3d')]['closed'],'disposition':_0x15bf65[_0xe36e('0x3d')]['disposition']})[_0xe36e('0x35')](function(_0x52de0f){return _0x52de0f;});}})[_0xe36e('0x35')](function(_0x30928a){return respondWithRpcPromise(_0xe36e('0xe2'),_0xe36e('0xde'),_0x15bf65[_0xe36e('0x3d')],client9004);})['then'](respondWithResult(_0x2c2f12,null))[_0xe36e('0x29')](handleError(_0x2c2f12,null));};exports[_0xe36e('0xe3')]=function(_0x3b8631,_0x5bf046,_0x4fc846){_0x3b8631[_0xe36e('0x3d')][_0xe36e('0x39')]=_0x3b8631['file'][_0xe36e('0xe4')];_0x3b8631['body'][_0xe36e('0xe5')]=_0x3b8631[_0xe36e('0xe6')][_0xe36e('0xe7')];_0x3b8631[_0xe36e('0x3d')][_0xe36e('0x4d')]=_0x3b8631[_0xe36e('0xe6')][_0xe36e('0xe8')];return db[_0xe36e('0xe9')][_0xe36e('0xc6')](_0x3b8631[_0xe36e('0x3d')])[_0xe36e('0x35')](respondWithResult(_0x5bf046,0xc9))[_0xe36e('0x29')](handleError(_0x5bf046,null));};exports[_0xe36e('0xea')]=function(_0x50cc85,_0x2ad011,_0x5466b8){return db[_0xe36e('0x4b')][_0xe36e('0xca')]({'where':{'id':_0x50cc85[_0xe36e('0xc3')]['id']},'raw':!![]})[_0xe36e('0x35')](handleEntityNotFound(_0x2ad011,null))[_0xe36e('0x35')](function(_0x57456d){if(_0x57456d){if(_0x57456d[_0xe36e('0xeb')]){return _0x2ad011[_0xe36e('0x2a')](0x193)[_0xe36e('0x2b')]({'status':0x193,'message':_0xe36e('0xec')});}return db[_0xe36e('0xe9')][_0xe36e('0xca')]({'where':{'id':_0x50cc85[_0xe36e('0x50')][_0xe36e('0xed')]},'raw':!![]})[_0xe36e('0x35')](handleEntityNotFound(_0x2ad011,null));}})[_0xe36e('0x35')](function(_0x1a380e){if(_0x1a380e){var _0xd786b8=_0x1a380e[_0xe36e('0xee')]!==null;var _0x38d16c=path['join'](config[_0xe36e('0xef')],_0xe36e('0xf0'));if(_0xd786b8){_0x38d16c=path['join'](_0x38d16c,_0xe36e('0xf1'));}var _0x512a19=path[_0xe36e('0xf2')](_0x38d16c,_0x1a380e['basename']);return _0x2ad011[_0xe36e('0xf3')](_0x512a19);}})[_0xe36e('0x29')](handleError(_0x2ad011,null));};exports[_0xe36e('0xf4')]=function(_0x153b4f,_0x5d2afc){var _0xeb0eb3=null;var _0x67afa3=null;var _0x2e0f59=null;var _0x2644c7=null;if(_0x153b4f[_0xe36e('0x3d')]['id']){delete _0x153b4f[_0xe36e('0x3d')]['id'];}if(_0x153b4f['body'][_0xe36e('0xf5')]){_0x2644c7=path[_0xe36e('0xf2')](config[_0xe36e('0xef')],'server/files/chat/upload/',util['format'](_0xe36e('0xf6'),Date['now']()));_0x153b4f[_0xe36e('0x3d')]['pathTranscript']=_0x2644c7;}return db[_0xe36e('0x4b')]['find']({'where':{'id':_0x153b4f[_0xe36e('0xc3')]['id']},'include':[{'model':db[_0xe36e('0xda')],'as':_0xe36e('0xf7'),'include':[{'model':db[_0xe36e('0x85')],'as':_0xe36e('0x85')}]}]})[_0xe36e('0x35')](handleEntityNotFound(_0x5d2afc,null))['then'](saveUpdates(_0x153b4f['body'],null))[_0xe36e('0x35')](function(_0x26031e){if(_0x26031e){_0xeb0eb3=_0x26031e;return db[_0xe36e('0xcb')]['find']({'where':{'id':_0xeb0eb3[_0xe36e('0xa1')]}});}})[_0xe36e('0x35')](function(_0xc1d0bd){if(_0xc1d0bd){_0x2e0f59=_0xc1d0bd;return db[_0xe36e('0xdd')][_0xe36e('0x74')]({'where':{'id':_0xeb0eb3[_0xe36e('0x80')]}});}})[_0xe36e('0x35')](function(_0x518d30){if(_0x518d30){_0x67afa3=_0x518d30;if(_0x2644c7){var _0xfb015e=null;for(var _0xd2176=0x1;_0xd2176<_0xeb0eb3[_0xe36e('0xf7')]['length'];++_0xd2176){_0xfb015e=_0xeb0eb3[_0xe36e('0xf7')][_0xd2176];var _0x4727cd=_0xfb015e['UserId']?util[_0xe36e('0xf8')]('%s%d',_0x2e0f59['agentAlias'],_0xfb015e[_0xe36e('0x86')]):'System';var _0x3ac919=_0x153b4f[_0xe36e('0x3d')][_0xe36e('0xf9')]||util['format'](_0xe36e('0xfa'),_0xe36e('0xfb'),_0xfb015e[_0xe36e('0x80')]);switch(_0x2e0f59[_0xe36e('0xfc')]){case _0xe36e('0xfd'):_0x4727cd=_0xfb015e[_0xe36e('0x86')]?util[_0xe36e('0xf8')](_0xe36e('0xfa'),_0x2e0f59[_0xe36e('0xfe')],_0xfb015e[_0xe36e('0x86')]):_0xe36e('0xff');break;case _0xe36e('0x100'):_0x4727cd=_0xfb015e['UserId']?_0xfb015e[_0xe36e('0x85')][_0xe36e('0x101')]||_0xfb015e['User'][_0xe36e('0x43')]:_0xe36e('0xff');break;case'agent_fullname':_0x4727cd=_0xfb015e[_0xe36e('0x86')]?_0xfb015e[_0xe36e('0x85')]['fullname']:_0xe36e('0xff');break;default:_0x4727cd=_0xfb015e[_0xe36e('0x86')]?util[_0xe36e('0xf8')](_0xe36e('0xfa'),_0x2e0f59[_0xe36e('0xfe')],_0xfb015e[_0xe36e('0x86')]):_0xe36e('0xff');}var _0x332cd8=util[_0xe36e('0xf8')](_0xe36e('0x102'),moment(_0xfb015e['createdAt'])[_0xe36e('0xf8')](_0xe36e('0x103')),_0xfb015e['direction']==='in'?_0x3ac919:_0x4727cd,_0xfb015e[_0xe36e('0x3d')]);if(!_0xfb015e['secret']){fs['appendFileSync'](_0x2644c7,_0x332cd8);}}return db['MailAccount'][_0xe36e('0xca')]({'where':{'service':!![]},'include':[{'model':db[_0xe36e('0x104')],'as':_0xe36e('0x105'),'raw':!![]}]});}}})[_0xe36e('0x35')](function(_0x154f52){if(_0x154f52&&_0x154f52['Smtp']&&_0x153b4f[_0xe36e('0x3d')]){var _0x34523d={'tls':{'rejectUnauthorized':![]}};if(_0x154f52['Smtp']['service']){_0x34523d[_0xe36e('0x106')]=_0x154f52[_0xe36e('0x105')][_0xe36e('0x106')];}else{_0x34523d[_0xe36e('0x107')]=_0x154f52['Smtp'][_0xe36e('0x107')];_0x34523d['port']=_0x154f52[_0xe36e('0x105')][_0xe36e('0x108')];_0x34523d[_0xe36e('0x109')]=_0x154f52['Smtp'][_0xe36e('0x109')];}if(_0x154f52['Smtp'][_0xe36e('0x10a')]){_0x34523d[_0xe36e('0x10b')]={'user':_0x154f52[_0xe36e('0x105')][_0xe36e('0xa3')],'pass':_0x154f52[_0xe36e('0x105')][_0xe36e('0x10c')]};}return respondWithRpcPromise(_0xe36e('0x10d'),'sendMail',{'account':_0x34523d,'message':{'from':util[_0xe36e('0xf8')](_0xe36e('0x10e'),_0x154f52['name'],_0x154f52[_0xe36e('0xd1')]||_0x154f52['Smtp'][_0xe36e('0xa3')]),'to':_0x153b4f['body'][_0xe36e('0xf5')],'subject':'Mail\x20Transcript','text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x153b4f[_0xe36e('0x3d')][_0xe36e('0xf5')]),'attachments':[{'path':_0x2644c7}]}})[_0xe36e('0x35')](function(){return _0xeb0eb3;})[_0xe36e('0x29')](function(_0x65e8ae){console[_0xe36e('0x24')](_0x65e8ae);});}else{return _0xeb0eb3;}})[_0xe36e('0x35')](respondWithStatusCode(_0x5d2afc,0xc8))[_0xe36e('0x29')](handleError(_0x5d2afc,null));};exports[_0xe36e('0x10f')]=function(_0x49225b,_0x214f23,_0x29883e){return db[_0xe36e('0xda')][_0xe36e('0x74')]({'where':{'id':_0x49225b[_0xe36e('0xc3')]['id']}})[_0xe36e('0x35')](handleEntityNotFound(_0x214f23,null))[_0xe36e('0x35')](function(_0xeb88eb){if(_0xeb88eb){return _0xeb88eb[_0xe36e('0x10f')](_0x49225b[_0xe36e('0x3d')]['ids'],_[_0xe36e('0x110')](_0x49225b['body'],[_0xe36e('0x111'),'id'])||{});}})[_0xe36e('0x35')](respondWithResult(_0x214f23,null))[_0xe36e('0x29')](handleError(_0x214f23,null));};exports[_0xe36e('0x112')]=function(_0x37282a,_0x5e7360,_0x4b4e4f){var _0x5583d8={'raw':![],'where':{}};var _0x542ae6={};var _0x2291e7={'count':0x0,'rows':[]};return db[_0xe36e('0x4b')]['findOne']({'where':{'id':_0x37282a[_0xe36e('0xc3')]['id']}})['then'](handleEntityNotFound(_0x5e7360,null))['then'](function(_0x12e580){if(_0x12e580){_0x542ae6['model']=_[_0xe36e('0x51')](db[_0xe36e('0xda')]['rawAttributes']);_0x542ae6[_0xe36e('0x50')]=_[_0xe36e('0x51')](_0x37282a['query']);_0x542ae6[_0xe36e('0x52')]=_[_0xe36e('0x53')](_0x542ae6[_0xe36e('0x4f')],_0x542ae6[_0xe36e('0x50')]);_0x5583d8[_0xe36e('0x55')]=_[_0xe36e('0x53')](_0x542ae6[_0xe36e('0x4f')],qs['fields'](_0x37282a[_0xe36e('0x50')][_0xe36e('0x54')]));_0x5583d8['attributes']=_0x5583d8['attributes'][_0xe36e('0x7d')]?_0x5583d8[_0xe36e('0x55')]:_0x542ae6['model'];if(!_0x37282a[_0xe36e('0x50')][_0xe36e('0x56')](_0xe36e('0x57'))){_0x5583d8[_0xe36e('0x2c')]=qs[_0xe36e('0x2c')](_0x37282a[_0xe36e('0x50')]['limit']);_0x5583d8['offset']=qs['offset'](_0x37282a[_0xe36e('0x50')][_0xe36e('0x2e')]);}_0x5583d8['order']=qs[_0xe36e('0x59')](_0x37282a['query'][_0xe36e('0x59')]);_0x5583d8[_0xe36e('0x90')]=qs['filters'](_[_0xe36e('0x5a')](_0x37282a[_0xe36e('0x50')],_0x542ae6[_0xe36e('0x52')]));_0x5583d8[_0xe36e('0x90')]['ChatInteractionId']=_0x12e580['id'];if(_0x37282a[_0xe36e('0x50')][_0xe36e('0x94')]){_0x5583d8[_0xe36e('0x90')]=_[_0xe36e('0x3c')](_0x5583d8[_0xe36e('0x90')],{'$or':_['map'](_0x5583d8['attributes'],function(_0xb40daf){var _0x584f19={};_0x584f19[_0xb40daf]={'$like':'%'+_0x37282a['query'][_0xe36e('0x94')]+'%'};return _0x584f19;})});}if(_0x37282a[_0xe36e('0x50')][_0xe36e('0x8b')]){var _0x2ee22b=_0x37282a[_0xe36e('0x50')][_0xe36e('0x8b')][_0xe36e('0x46')](',');var _0x2cfaee={};_0x2cfaee[_0x2ee22b[0x0]]={'$gte':moment(_0x2ee22b[0x1])[_0xe36e('0xf8')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5583d8[_0xe36e('0x90')]=_[_0xe36e('0x3c')](_0x5583d8[_0xe36e('0x90')],_0x2cfaee);}_0x5583d8=_[_0xe36e('0x3c')]({},_0x5583d8,_0x37282a[_0xe36e('0xc5')]);return db[_0xe36e('0xda')][_0xe36e('0x2f')]({'where':_0x5583d8['where']})[_0xe36e('0x35')](function(_0x3f0fd2){_0x2291e7[_0xe36e('0x2f')]=_0x3f0fd2;if(_0x37282a[_0xe36e('0x50')][_0xe36e('0xc4')]){_0x5583d8[_0xe36e('0x113')]=[{'all':!![]}];}return db[_0xe36e('0xda')][_0xe36e('0x114')](_0x5583d8);})[_0xe36e('0x35')](function(_0x2c85c5){_0x2291e7[_0xe36e('0x115')]=_0x2c85c5;return _0x2291e7;});}})[_0xe36e('0x35')](respondWithFilteredResult(_0x5e7360,_0x5583d8))[_0xe36e('0x29')](handleError(_0x5e7360,null));};exports[_0xe36e('0x116')]=function(_0x545f90,_0x2291d1,_0x3ccaa5){var _0x19f952={'where':{}},_0x3e706e={},_0x51cea0={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xe36e('0xca')]({'where':{'id':_0x545f90['params']['id']}})[_0xe36e('0x35')](handleEntityNotFound(_0x2291d1,null))['then'](function(_0x21ffc7){if(_0x21ffc7){_0x3e706e[_0xe36e('0x4f')]=_['keys'](db[_0xe36e('0xda')][_0xe36e('0x4c')]);_0x3e706e[_0xe36e('0x50')]=_['keys'](_0x545f90[_0xe36e('0x50')]);_0x3e706e[_0xe36e('0x52')]=_[_0xe36e('0x53')](_0x3e706e[_0xe36e('0x4f')],_0x3e706e[_0xe36e('0x50')]);_0x19f952['attributes']=_[_0xe36e('0x53')](_0x3e706e[_0xe36e('0x4f')],qs[_0xe36e('0x54')](_0x545f90[_0xe36e('0x50')][_0xe36e('0x54')]));_0x19f952['attributes']=_0x19f952[_0xe36e('0x55')][_0xe36e('0x7d')]?_0x19f952[_0xe36e('0x55')]:_0x3e706e[_0xe36e('0x4f')];if(!_0x545f90[_0xe36e('0x50')]['hasOwnProperty'](_0xe36e('0x57'))){_0x19f952['limit']=qs[_0xe36e('0x2c')](_0x545f90['query'][_0xe36e('0x2c')]);_0x19f952[_0xe36e('0x2e')]=qs[_0xe36e('0x2e')](_0x545f90[_0xe36e('0x50')][_0xe36e('0x2e')]);}_0x19f952[_0xe36e('0x58')]=qs[_0xe36e('0x59')](_0x545f90[_0xe36e('0x50')][_0xe36e('0x59')]);_0x19f952[_0xe36e('0x90')]=qs[_0xe36e('0x52')](_[_0xe36e('0x5a')](_0x545f90[_0xe36e('0x50')],_0x3e706e['filters']));_0x19f952['where'][_0xe36e('0xc0')]=_0x21ffc7['id'];if(_0x545f90[_0xe36e('0x50')][_0xe36e('0x94')]){_0x19f952[_0xe36e('0x90')]=_[_0xe36e('0x3c')](_0x19f952[_0xe36e('0x90')],{'$or':_[_0xe36e('0x4a')](_0x19f952[_0xe36e('0x55')],function(_0x82c1ae){var _0x5f22b7={};_0x5f22b7[_0x82c1ae]={'$like':'%'+_0x545f90[_0xe36e('0x50')][_0xe36e('0x94')]+'%'};return _0x5f22b7;})});}_0x19f952['where']['secret']=![];if(_0x545f90[_0xe36e('0x50')]['id']){_0x19f952[_0xe36e('0x90')]['id']={'$gt':_0x545f90[_0xe36e('0x50')]['id']};}_0x19f952=_[_0xe36e('0x3c')]({},_0x19f952,_0x545f90['options']);return db[_0xe36e('0xda')]['count']({'where':_0x19f952[_0xe36e('0x90')]})[_0xe36e('0x35')](function(_0x150c17){_0x51cea0[_0xe36e('0x2f')]=_0x150c17;_0x19f952[_0xe36e('0x113')]=[];if(_0x545f90[_0xe36e('0x50')][_0xe36e('0x117')]){_0x19f952['include'][_0xe36e('0x48')]({'model':db[_0xe36e('0x85')],'as':'User','attributes':['id',_0xe36e('0x43'),_0xe36e('0x101')]});}if(_0x545f90[_0xe36e('0x50')]['includeAll']){_0x19f952[_0xe36e('0x113')]=[{'all':!![]}];}return db[_0xe36e('0xda')][_0xe36e('0x114')](_0x19f952);})['then'](function(_0x4553ac){_0x51cea0[_0xe36e('0x115')]=_0x4553ac;return _0x51cea0;});}})['then'](respondWithFilteredResult(_0x2291d1,_0x19f952))[_0xe36e('0x29')](handleError(_0x2291d1,null));};exports['addTags']=function(_0x2cba34,_0x1e7118,_0x4b8d01){return db[_0xe36e('0x4b')][_0xe36e('0x74')]({'where':{'id':_0x2cba34['params']['id']}})['then'](handleEntityNotFound(_0x1e7118,null))[_0xe36e('0x35')](function(_0x4284aa){if(_0x4284aa){return _0x4284aa['setTags'](_0x2cba34['body'][_0xe36e('0x111')],_[_0xe36e('0x110')](_0x2cba34[_0xe36e('0x3d')],[_0xe36e('0x111'),'id'])||{})[_0xe36e('0x118')](function(){return db[_0xe36e('0x84')][_0xe36e('0x114')]({'attributes':['id','name',_0xe36e('0x5d')],'where':{'id':_0x2cba34[_0xe36e('0x3d')][_0xe36e('0x111')]}});})[_0xe36e('0x35')](function(_0x464128){socket[_0xe36e('0x119')](_0xe36e('0x11a'),{'id':Number(_0x2cba34[_0xe36e('0xc3')]['id']),'tags':_0x464128||[]});return{'id':Number(_0x2cba34['params']['id']),'tags':_0x464128||[]};});}})['then'](respondWithResult(_0x1e7118,null))[_0xe36e('0x29')](handleError(_0x1e7118,null));};exports[_0xe36e('0x11b')]=function(_0x262797,_0x40f9f1,_0x457c8e){return db[_0xe36e('0x4b')]['find']({'where':{'id':_0x262797[_0xe36e('0xc3')]['id']}})['then'](handleEntityNotFound(_0x40f9f1,null))['then'](function(_0x31fb7a){if(_0x31fb7a){return _0x31fb7a['removeTags'](_0x262797[_0xe36e('0x50')][_0xe36e('0x111')]);}})[_0xe36e('0x35')](respondWithStatusCode(_0x40f9f1,null))[_0xe36e('0x29')](handleError(_0x40f9f1,null));};exports[_0xe36e('0xf3')]=function(_0x20a347,_0x2c1324){var _0xa7ef59=moment()[_0xe36e('0x11c')]()[_0xe36e('0xa8')]();var _0x3a4701=path[_0xe36e('0xf2')](config[_0xe36e('0xef')],'server',_0xe36e('0x11d'),'tmp');var _0x1cab01=path[_0xe36e('0xf2')](config[_0xe36e('0xef')],'server',_0xe36e('0x11d'),_0xe36e('0x11e'));var _0x6c8c82=path[_0xe36e('0xf2')](_0x3a4701,_0xa7ef59);var _0x71c885=util['format'](_0xe36e('0x11f'),_0x20a347[_0xe36e('0xc3')]['id'],_0xa7ef59);var _0x29393a=path[_0xe36e('0xf2')](_0x3a4701,_0x71c885);var _0x4e7b14=[];_0x4e7b14[_0xe36e('0x48')]({'model':db[_0xe36e('0x85')],'as':_0xe36e('0x85'),'attributes':['id',_0xe36e('0x43')],'raw':!![]});_0x4e7b14[_0xe36e('0x48')]({'model':db[_0xe36e('0xdd')],'as':_0xe36e('0x79'),'attributes':['id',_0xe36e('0x120'),_0xe36e('0x121')],'raw':!![]});if(_0x20a347[_0xe36e('0x50')]['attachments']){_0x4e7b14[_0xe36e('0x48')]({'model':db[_0xe36e('0xe9')],'as':'Attachment','raw':!![]});}var _0xecb02b=[{'model':db[_0xe36e('0xda')],'as':_0xe36e('0xf7'),'attributes':['id',_0xe36e('0x3d'),_0xe36e('0x122'),_0xe36e('0x123'),_0xe36e('0x124'),_0xe36e('0x125')],'include':_0x4e7b14}];_0xecb02b[_0xe36e('0x48')]({'model':db[_0xe36e('0xcb')],'as':'Account','attributes':['id',_0xe36e('0x39')]});_0xecb02b[_0xe36e('0x48')]({'model':db[_0xe36e('0x85')],'as':_0xe36e('0x126'),'attributes':['id',_0xe36e('0x43')]});return db[_0xe36e('0x4b')][_0xe36e('0x74')]({'where':{'id':_0x20a347[_0xe36e('0xc3')]['id']},'include':_0xecb02b})[_0xe36e('0x35')](handleEntityNotFound(_0x2c1324,null))[_0xe36e('0x35')](function(_0x4197e9){if(_0x4197e9){var _0x35c442=_0x4197e9[_0xe36e('0x127')]({'plain':!![]});fs['mkdirSync'](_0x6c8c82);var _0x343ad8={'channel':'Chat','account':_0x35c442[_0xe36e('0x128')][_0xe36e('0x39')],'agent':_0x35c442[_0xe36e('0x126')]?_0x35c442[_0xe36e('0x126')]['fullname']:_0xe36e('0x129'),'createdAt':moment(_0x35c442[_0xe36e('0x122')])['format'](_0xe36e('0x12a'))[_0xe36e('0xa8')](),'closedAt':_0x35c442[_0xe36e('0xeb')]?moment(_0x35c442[_0xe36e('0x12b')])[_0xe36e('0xf8')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe36e('0xa8')]():'','disposition':_0x35c442[_0xe36e('0x12c')],'chatInfo':{'browser':_0x35c442['browserName'],'os':_0x35c442[_0xe36e('0x12d')],'referer':_0x35c442[_0xe36e('0x12e')],'customerIp':_0x35c442[_0xe36e('0x12f')],'customerPort':_0x35c442['customerPort']?_0x35c442['customerPort']:'N.A.'},'messages':_(_0x35c442[_0xe36e('0xf7')])['tail']()[_0xe36e('0x94')]({'secret':![]})['map'](function(_0x59156b){if(_0x59156b[_0xe36e('0xe9')]){var _0x52719b=path[_0xe36e('0xf2')](_0x1cab01,_0x59156b['Attachment'][_0xe36e('0xe5')]);if(fs['existsSync'](_0x52719b)){fs[_0xe36e('0x130')](_0x52719b)[_0xe36e('0x131')](fs[_0xe36e('0x132')](path[_0xe36e('0xf2')](_0x6c8c82,_0x59156b[_0xe36e('0xe9')][_0xe36e('0xe5')])));}}return{'date':moment(_0x59156b[_0xe36e('0x122')])[_0xe36e('0xf8')](_0xe36e('0x12a'))[_0xe36e('0xa8')](),'sender':_0x59156b[_0xe36e('0x123')]===_0xe36e('0x133')?_0x59156b['User']?_0x59156b[_0xe36e('0x85')][_0xe36e('0x43')]:_0xe36e('0xff'):_0x59156b[_0xe36e('0x79')]['firstName']+(_0x59156b[_0xe36e('0x79')][_0xe36e('0x121')]?'\x20'+_0x59156b[_0xe36e('0x79')]['lastName']:''),'body':_0x59156b['Attachment']?_0x59156b[_0xe36e('0xe9')][_0xe36e('0xe5')]:_0x59156b['body'],'direction':_0x59156b[_0xe36e('0x123')]===_0xe36e('0x133')?'A':'C','secret':_0x59156b['secret'],'read':_0x59156b[_0xe36e('0x125')],'attachment':_0x59156b[_0xe36e('0xe9')]};})['value']()};return ejs['renderFile'](path[_0xe36e('0xf2')](config[_0xe36e('0xef')],_0xe36e('0x134'),_0xe36e('0x135'),_0xe36e('0x136')),{'interaction':_0x343ad8})[_0xe36e('0x35')](function(_0x340915){var _0x5370b9=path['join'](_0x6c8c82,'transcript-'+_0x35c442['id']+'-'+_0xa7ef59+'.pdf');var _0x16b769={'path':_0x5370b9,'channel':'Chat','interactionId':_0x35c442['id']};return pdf['createPdfFromHTML'](_0x340915,_0x16b769);})[_0xe36e('0x35')](function(){return new BPromise(function(_0x36706c,_0x5e7f24){zipdir(_0x6c8c82,{'saveTo':_0x29393a},function(_0x5e19e2,_0x2a89b0){if(_0x5e19e2)return _0x5e7f24(_0x5e19e2);return _0x36706c(_0x2a89b0);});})[_0xe36e('0x35')](function(){return new BPromise(function(_0xf70d66,_0x2c0371){rimraf(_0x6c8c82,function(_0x59de53){if(_0x59de53)_0x2c0371(_0x59de53);return _0xf70d66();});});})[_0xe36e('0x35')](function(){return _0x2c1324['download'](_0x29393a,_0x71c885,function(_0x47e24c){if(_0x47e24c){console[_0xe36e('0x137')](_0xe36e('0x138'),_0x47e24c);}else{fs[_0xe36e('0x139')](_0x29393a);}});});});}else{return _0x2c1324[_0xe36e('0x37')](0xc8);}})[_0xe36e('0x29')](handleError(_0x2c1324,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 59bf8d1..46c1752 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 _0xa213=['hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','length','emit','catch'];(function(_0xe50e1,_0x30bf72){var _0x441f9a=function(_0x40ac92){while(--_0x40ac92){_0xe50e1['push'](_0xe50e1['shift']());}};_0x441f9a(++_0x30bf72);}(_0xa213,0x122));var _0x3a21=function(_0x36d3e4,_0x1c06a2){_0x36d3e4=_0x36d3e4-0x0;var _0x39fcb0=_0xa213[_0x36d3e4];return _0x39fcb0;};'use strict';var EventEmitter=require(_0x3a21('0x0'));var ChatInteraction=require(_0x3a21('0x1'))['db'][_0x3a21('0x2')];var ChatMessage=require(_0x3a21('0x1'))['db'][_0x3a21('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3a21('0x4')](0x0);var events={'afterCreate':_0x3a21('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x216c05){return function(_0x38ee62,_0xb24a72,_0x4bf378){_0x38ee62[_0x3a21('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x32e202){_0x38ee62['setDataValue'](_0x3a21('0x7'),_0x32e202[_0x3a21('0x8')](function(_0x502a3b){return{'id':_0x502a3b['id']};}));return ChatMessage[_0x3a21('0x9')]({'where':{'ChatInteractionId':_0x38ee62['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3a21('0xa')](function(_0xa0a72e){_0x38ee62[_0x3a21('0xb')](_0x3a21('0xc'),_0xa0a72e[_0x3a21('0xd')]);ChatInteractionEvents['emit'](_0x216c05+':'+_0x38ee62['id'],_0x38ee62);ChatInteractionEvents[_0x3a21('0xe')](_0x216c05,_0x38ee62);_0x4bf378(null);})[_0x3a21('0xf')](_0x4bf378(null));};}for(var e in events){if(events[_0x3a21('0x10')](e)){var event=events[e];ChatInteraction[_0x3a21('0x11')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xe741=['length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatMessage','save','update','remove','getUsers','setDataValue','Users','findAll','then','unreadMessages'];(function(_0xc589cb,_0x3ad86b){var _0x26fbd7=function(_0x1816a3){while(--_0x1816a3){_0xc589cb['push'](_0xc589cb['shift']());}};_0x26fbd7(++_0x3ad86b);}(_0xe741,0xe2));var _0x1e74=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xe741[_0x36c5b0];return _0xf19333;};'use strict';var EventEmitter=require(_0x1e74('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x1e74('0x1'))['db'][_0x1e74('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1e74('0x3'),'afterUpdate':_0x1e74('0x4'),'afterDestroy':_0x1e74('0x5')};function emitEvent(_0x2ad813){return function(_0x168572,_0x4d17b5,_0x3dce8c){_0x168572[_0x1e74('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2d7000){_0x168572[_0x1e74('0x7')](_0x1e74('0x8'),_0x2d7000['map'](function(_0x43efdc){return{'id':_0x43efdc['id']};}));return ChatMessage[_0x1e74('0x9')]({'where':{'ChatInteractionId':_0x168572['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1e74('0xa')](function(_0x5bb326){_0x168572[_0x1e74('0x7')](_0x1e74('0xb'),_0x5bb326[_0x1e74('0xc')]);ChatInteractionEvents['emit'](_0x2ad813+':'+_0x168572['id'],_0x168572);ChatInteractionEvents[_0x1e74('0xd')](_0x2ad813,_0x168572);_0x3dce8c(null);})[_0x1e74('0xe')](_0x3dce8c(null));};}for(var e in events){if(events[_0x1e74('0xf')](e)){var event=events[e];ChatInteraction[_0x1e74('0x10')](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 8bf5cc7..c50e2f8 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 _0x64b5=['define','ChatInteraction','chat_interactions','changed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','./chatInteraction.attributes'];(function(_0x45fdb6,_0x309152){var _0x9ecb71=function(_0x280604){while(--_0x280604){_0x45fdb6['push'](_0x45fdb6['shift']());}};_0x9ecb71(++_0x309152);}(_0x64b5,0x86));var _0x564b=function(_0x4a9964,_0x3d6842){_0x4a9964=_0x4a9964-0x0;var _0x10a3e4=_0x64b5[_0x4a9964];return _0x10a3e4;};'use strict';var _=require(_0x564b('0x0'));var util=require('util');var logger=require(_0x564b('0x1'))(_0x564b('0x2'));var moment=require(_0x564b('0x3'));var BPromise=require(_0x564b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x564b('0x5'));module['exports']=function(_0x507ec3,_0x4f7787){return _0x507ec3[_0x564b('0x6')](_0x564b('0x7'),attributes,{'tableName':_0x564b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40acc7,_0xf13432,_0x49665e){if(_0x40acc7[_0x564b('0x9')]('closed')){_0x40acc7[_0x564b('0xa')]=moment()[_0x564b('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x49665e(null,_0x40acc7);}},'charset':_0x564b('0xc'),'collate':_0x564b('0xd')});}; \ No newline at end of file +var _0x1aad=['exports','define','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes'];(function(_0x59cb45,_0x29f0b2){var _0x2c97d3=function(_0x328a70){while(--_0x328a70){_0x59cb45['push'](_0x59cb45['shift']());}};_0x2c97d3(++_0x29f0b2);}(_0x1aad,0x14c));var _0xd1aa=function(_0x2e767e,_0x591c30){_0x2e767e=_0x2e767e-0x0;var _0x539d6c=_0x1aad[_0x2e767e];return _0x539d6c;};'use strict';var _=require(_0xd1aa('0x0'));var util=require(_0xd1aa('0x1'));var logger=require(_0xd1aa('0x2'))(_0xd1aa('0x3'));var moment=require(_0xd1aa('0x4'));var BPromise=require(_0xd1aa('0x5'));var rp=require(_0xd1aa('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd1aa('0x7'));var config=require(_0xd1aa('0x8'));var attributes=require(_0xd1aa('0x9'));module[_0xd1aa('0xa')]=function(_0x1c665a,_0x5b35dd){return _0x1c665a[_0xd1aa('0xb')]('ChatInteraction',attributes,{'tableName':_0xd1aa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x29ee05,_0x3658a8,_0x3c506a){if(_0x29ee05[_0xd1aa('0xd')](_0xd1aa('0xe'))){_0x29ee05['closedAt']=moment()[_0xd1aa('0xf')](_0xd1aa('0x10'));}_0x3c506a(null,_0x29ee05);}},'charset':'utf8mb4','collate':_0xd1aa('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 85ff2ab..133eca3 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 _0x15e4=['stringify','error','message','info','result','catch','UpdateChatInteraction','update','options','raw','attributes','limit','ChatInteraction','find','where','addTags','body','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x15e4,0xaf));var _0x415e=function(_0x324b03,_0x55c639){_0x324b03=_0x324b03-0x0;var _0x2d2975=_0x15e4[_0x324b03];return _0x2d2975;};'use strict';var _=require(_0x415e('0x0'));var util=require(_0x415e('0x1'));var moment=require(_0x415e('0x2'));var BPromise=require(_0x415e('0x3'));var rs=require(_0x415e('0x4'));var fs=require('fs');var Redis=require(_0x415e('0x5'));var db=require(_0x415e('0x6'))['db'];var utils=require(_0x415e('0x7'));var logger=require(_0x415e('0x8'))('rpc');var config=require(_0x415e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x415e('0xa')]({'port':0x232a});config[_0x415e('0xb')]=_[_0x415e('0xc')](config[_0x415e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x415e('0xd'))(new Redis(config[_0x415e('0xb')]));require(_0x415e('0xe'))['register'](socket);function respondWithRpcPromise(_0x2531bb,_0x5265ac,_0x3afda8){return new BPromise(function(_0x842e80,_0x23f88e){return client['request'](_0x2531bb,_0x3afda8)[_0x415e('0xf')](function(_0x4036cf){logger['info'](_0x415e('0x10'),_0x5265ac,_0x415e('0x11'));logger[_0x415e('0x12')](_0x415e('0x13'),_0x5265ac,_0x415e('0x11'),JSON[_0x415e('0x14')](_0x4036cf));if(_0x4036cf[_0x415e('0x15')]){if(_0x4036cf[_0x415e('0x15')]['code']===0x1f4){logger[_0x415e('0x15')](_0x415e('0x10'),_0x5265ac,_0x4036cf[_0x415e('0x15')][_0x415e('0x16')]);return _0x23f88e(_0x4036cf[_0x415e('0x15')][_0x415e('0x16')]);}logger[_0x415e('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x5265ac,_0x4036cf[_0x415e('0x15')][_0x415e('0x16')]);return _0x842e80(_0x4036cf[_0x415e('0x15')][_0x415e('0x16')]);}else{logger[_0x415e('0x17')](_0x415e('0x10'),_0x5265ac,'request\x20sent');_0x842e80(_0x4036cf[_0x415e('0x18')]['message']);}})[_0x415e('0x19')](function(_0x46fdbe){logger[_0x415e('0x15')](_0x415e('0x10'),_0x5265ac,_0x46fdbe);_0x23f88e(_0x46fdbe);});});}exports[_0x415e('0x1a')]=function(_0x29a5c8){var _0xdd7a1f=this;return new Promise(function(_0x195075,_0x3d7a83){return db['ChatInteraction'][_0x415e('0x1b')](_0x29a5c8['body'],{'raw':_0x29a5c8[_0x415e('0x1c')]?_0x29a5c8[_0x415e('0x1c')][_0x415e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29a5c8[_0x415e('0x1c')]?_0x29a5c8[_0x415e('0x1c')]['where']||null:null,'attributes':_0x29a5c8[_0x415e('0x1c')]?_0x29a5c8[_0x415e('0x1c')][_0x415e('0x1e')]||null:null,'limit':_0x29a5c8[_0x415e('0x1c')]?_0x29a5c8['options'][_0x415e('0x1f')]||null:null})[_0x415e('0xf')](function(_0x4dc404){logger[_0x415e('0x17')](_0x415e('0x1a'),_0x29a5c8);logger[_0x415e('0x12')](_0x415e('0x1a'),_0x29a5c8,JSON[_0x415e('0x14')](_0x4dc404));_0x195075(_0x4dc404);})[_0x415e('0x19')](function(_0x5f308c){logger[_0x415e('0x15')](_0x415e('0x1a'),_0x5f308c['message'],_0x29a5c8);_0x3d7a83(_0xdd7a1f[_0x415e('0x15')](0x1f4,_0x5f308c[_0x415e('0x16')]));});});};exports['AddTagsToChatInteraction']=function(_0x4f77bc){return new Promise(function(_0x42c321,_0x53f9ff){return db[_0x415e('0x20')][_0x415e('0x21')]({'where':_0x4f77bc[_0x415e('0x1c')]?_0x4f77bc[_0x415e('0x1c')][_0x415e('0x22')]||null:null})['then'](function(_0x3ae87a){if(_0x3ae87a){return _0x3ae87a[_0x415e('0x23')](_0x4f77bc[_0x415e('0x24')]['ids'],_['omit'](_0x4f77bc[_0x415e('0x24')],[_0x415e('0x25'),'id'])||{});}})['spread'](function(_0x38c40b){logger['info'](_0x415e('0x26'),_0x4f77bc);logger['debug']('AddTags',_0x4f77bc,JSON[_0x415e('0x14')](_0x38c40b));_0x42c321(_0x38c40b);})[_0x415e('0x19')](function(_0x317392){logger[_0x415e('0x15')](_0x415e('0x26'),_0x317392[_0x415e('0x16')],_0x4f77bc);_0x53f9ff(_this['error'](0x1f4,_0x317392[_0x415e('0x16')]));});});}; \ No newline at end of file +var _0x602d=['code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','AddTagsToChatInteraction','where','addTags','ids','omit','spread','AddTags','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x104799,_0x865033){var _0x1021a6=function(_0x30bb7a){while(--_0x30bb7a){_0x104799['push'](_0x104799['shift']());}};_0x1021a6(++_0x865033);}(_0x602d,0x1e0));var _0xd602=function(_0x1e2b3e,_0xafbf55){_0x1e2b3e=_0x1e2b3e-0x0;var _0x4830dd=_0x602d[_0x1e2b3e];return _0x4830dd;};'use strict';var _=require(_0xd602('0x0'));var util=require(_0xd602('0x1'));var moment=require(_0xd602('0x2'));var BPromise=require('bluebird');var rs=require(_0xd602('0x3'));var fs=require('fs');var Redis=require(_0xd602('0x4'));var db=require(_0xd602('0x5'))['db'];var utils=require(_0xd602('0x6'));var logger=require(_0xd602('0x7'))(_0xd602('0x8'));var config=require(_0xd602('0x9'));var jayson=require(_0xd602('0xa'));var client=jayson[_0xd602('0xb')][_0xd602('0xc')]({'port':0x232a});config[_0xd602('0xd')]=_[_0xd602('0xe')](config['redis'],{'host':_0xd602('0xf'),'port':0x18eb});var socket=require(_0xd602('0x10'))(new Redis(config[_0xd602('0xd')]));require(_0xd602('0x11'))[_0xd602('0x12')](socket);function respondWithRpcPromise(_0x1e4f2c,_0x46e748,_0x12a0b1){return new BPromise(function(_0x42218f,_0x22b58b){return client[_0xd602('0x13')](_0x1e4f2c,_0x12a0b1)[_0xd602('0x14')](function(_0x2d54c5){logger[_0xd602('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x46e748,_0xd602('0x16'));logger['debug'](_0xd602('0x17'),_0x46e748,_0xd602('0x16'),JSON[_0xd602('0x18')](_0x2d54c5));if(_0x2d54c5[_0xd602('0x19')]){if(_0x2d54c5[_0xd602('0x19')][_0xd602('0x1a')]===0x1f4){logger['error'](_0xd602('0x1b'),_0x46e748,_0x2d54c5[_0xd602('0x19')][_0xd602('0x1c')]);return _0x22b58b(_0x2d54c5['error'][_0xd602('0x1c')]);}logger[_0xd602('0x19')](_0xd602('0x1b'),_0x46e748,_0x2d54c5[_0xd602('0x19')][_0xd602('0x1c')]);return _0x42218f(_0x2d54c5[_0xd602('0x19')]['message']);}else{logger['info'](_0xd602('0x1b'),_0x46e748,_0xd602('0x16'));_0x42218f(_0x2d54c5[_0xd602('0x1d')][_0xd602('0x1c')]);}})[_0xd602('0x1e')](function(_0x4568ee){logger[_0xd602('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x46e748,_0x4568ee);_0x22b58b(_0x4568ee);});});}exports[_0xd602('0x1f')]=function(_0x3d86ed){var _0x182dae=this;return new Promise(function(_0x37e945,_0x8217f2){return db[_0xd602('0x20')][_0xd602('0x21')](_0x3d86ed[_0xd602('0x22')],{'raw':_0x3d86ed[_0xd602('0x23')]?_0x3d86ed['options'][_0xd602('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d86ed[_0xd602('0x23')]?_0x3d86ed[_0xd602('0x23')]['where']||null:null,'attributes':_0x3d86ed[_0xd602('0x23')]?_0x3d86ed[_0xd602('0x23')][_0xd602('0x25')]||null:null,'limit':_0x3d86ed[_0xd602('0x23')]?_0x3d86ed[_0xd602('0x23')]['limit']||null:null})['then'](function(_0x565cce){logger['info'](_0xd602('0x1f'),_0x3d86ed);logger['debug']('UpdateChatInteraction',_0x3d86ed,JSON['stringify'](_0x565cce));_0x37e945(_0x565cce);})[_0xd602('0x1e')](function(_0x211973){logger[_0xd602('0x19')](_0xd602('0x1f'),_0x211973[_0xd602('0x1c')],_0x3d86ed);_0x8217f2(_0x182dae[_0xd602('0x19')](0x1f4,_0x211973['message']));});});};exports[_0xd602('0x26')]=function(_0xff605f){return new Promise(function(_0xb7c897,_0x293f17){return db[_0xd602('0x20')]['find']({'where':_0xff605f[_0xd602('0x23')]?_0xff605f[_0xd602('0x23')][_0xd602('0x27')]||null:null})['then'](function(_0x566f3c){if(_0x566f3c){return _0x566f3c[_0xd602('0x28')](_0xff605f[_0xd602('0x22')][_0xd602('0x29')],_[_0xd602('0x2a')](_0xff605f['body'],[_0xd602('0x29'),'id'])||{});}})[_0xd602('0x2b')](function(_0x2f15ec){logger[_0xd602('0x15')](_0xd602('0x2c'),_0xff605f);logger[_0xd602('0x2d')]('AddTags',_0xff605f,JSON[_0xd602('0x18')](_0x2f15ec));_0xb7c897(_0x2f15ec);})[_0xd602('0x1e')](function(_0x292243){logger[_0xd602('0x19')]('AddTags',_0x292243[_0xd602('0x1c')],_0xff605f);_0x293f17(_this['error'](0x1f4,_0x292243[_0xd602('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 4998797..da9c1b3 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 _0xe444=['./chatInteraction.events','save','emit','removeListener','register','length','chatInteraction:'];(function(_0x47d9ee,_0x3adfed){var _0x8e0f8=function(_0x5e16ce){while(--_0x5e16ce){_0x47d9ee['push'](_0x47d9ee['shift']());}};_0x8e0f8(++_0x3adfed);}(_0xe444,0xe0));var _0x4e44=function(_0x1079a4,_0x410668){_0x1079a4=_0x1079a4-0x0;var _0x10e53c=_0xe444[_0x1079a4];return _0x10e53c;};'use strict';var ChatInteractionEvents=require(_0x4e44('0x0'));var events=[_0x4e44('0x1'),'remove','update'];function createListener(_0x234992,_0x31b323){return function(_0x33fde8){_0x31b323[_0x4e44('0x2')](_0x234992,_0x33fde8);};}function removeListener(_0x5aa738,_0x4c8454){return function(){ChatInteractionEvents[_0x4e44('0x3')](_0x5aa738,_0x4c8454);};}exports[_0x4e44('0x4')]=function(_0x31b783){for(var _0x59c7d1=0x0,_0x276d09=events[_0x4e44('0x5')];_0x59c7d1<_0x276d09;_0x59c7d1++){var _0x1af927=events[_0x59c7d1];var _0x5c021f=createListener(_0x4e44('0x6')+_0x1af927,_0x31b783);ChatInteractionEvents['on'](_0x1af927,_0x5c021f);}}; \ No newline at end of file +var _0xa8a8=['update','removeListener','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x4882cc,_0x599451){var _0x573354=function(_0x117433){while(--_0x117433){_0x4882cc['push'](_0x4882cc['shift']());}};_0x573354(++_0x599451);}(_0xa8a8,0x1ef));var _0x8a8a=function(_0x5d4507,_0x4fcbd5){_0x5d4507=_0x5d4507-0x0;var _0x482c9b=_0xa8a8[_0x5d4507];return _0x482c9b;};'use strict';var ChatInteractionEvents=require(_0x8a8a('0x0'));var events=[_0x8a8a('0x1'),'remove',_0x8a8a('0x2')];function createListener(_0x1cb4ff,_0x31918b){return function(_0x445f72){_0x31918b['emit'](_0x1cb4ff,_0x445f72);};}function removeListener(_0x14c905,_0x440ca6){return function(){ChatInteractionEvents[_0x8a8a('0x3')](_0x14c905,_0x440ca6);};}exports[_0x8a8a('0x4')]=function(_0x3c3ac3){for(var _0x335d1a=0x0,_0x16a5bc=events[_0x8a8a('0x5')];_0x335d1a<_0x16a5bc;_0x335d1a++){var _0x37b3f9=events[_0x335d1a];var _0x49d9b1=createListener(_0x8a8a('0x6')+_0x37b3f9,_0x3c3ac3);ChatInteractionEvents['on'](_0x37b3f9,_0x49d9b1);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 3d5d2c3..4beda9e 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 _0x0e74=['put','/:id','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','replace','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags'];(function(_0x5d98c8,_0x299fb4){var _0x35f7fb=function(_0x39a953){while(--_0x39a953){_0x5d98c8['push'](_0x5d98c8['shift']());}};_0x35f7fb(++_0x299fb4);}(_0x0e74,0x10d));var _0x40e7=function(_0x4787e0,_0x323efb){_0x4787e0=_0x4787e0-0x0;var _0x25c306=_0x0e74[_0x4787e0];return _0x25c306;};'use strict';var multer=require(_0x40e7('0x0'));var util=require(_0x40e7('0x1'));var path=require(_0x40e7('0x2'));var timeout=require(_0x40e7('0x3'));var express=require('express');var router=express[_0x40e7('0x4')]();var fs_extra=require(_0x40e7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x40e7('0x6'));var config=require('../../config/environment');var controller=require(_0x40e7('0x7'));router[_0x40e7('0x8')]('/',auth[_0x40e7('0x9')](),controller[_0x40e7('0xa')]);router[_0x40e7('0x8')](_0x40e7('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x40e7('0xc')](),controller['show']);router[_0x40e7('0x8')]('/:id/attachment_download',auth[_0x40e7('0xc')](),controller[_0x40e7('0xd')]);router['get'](_0x40e7('0xe'),auth[_0x40e7('0x9')](),controller['getMessages']);router[_0x40e7('0x8')](_0x40e7('0xf'),auth[_0x40e7('0xc')](),controller['getMyMessages']);router[_0x40e7('0x8')]('/:id/download',auth[_0x40e7('0x9')](),controller[_0x40e7('0x10')]);router[_0x40e7('0x11')]('/',auth[_0x40e7('0x9')](),controller[_0x40e7('0x12')]);router[_0x40e7('0x11')](_0x40e7('0x13'),auth[_0x40e7('0x9')](),controller[_0x40e7('0x14')]);var upload=multer({'storage':multer[_0x40e7('0x15')]({'destination':function(_0x2049a7,_0x3034a4,_0x26c626){_0x26c626(null,path[_0x40e7('0x16')](config[_0x40e7('0x17')],_0x40e7('0x18')));},'filename':function(_0x579a22,_0x536f96,_0x500fc5){_0x500fc5(null,util[_0x40e7('0x19')](_0x40e7('0x1a'),Date['now'](),_0x536f96['originalname'][_0x40e7('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x40e7('0x11')]('/:id/attachment_upload',upload[_0x40e7('0x1c')](_0x40e7('0x1d')),controller[_0x40e7('0x1e')]);router[_0x40e7('0x11')](_0x40e7('0xe'),auth[_0x40e7('0xc')](),controller[_0x40e7('0x1f')]);router['post'](_0x40e7('0x20'),auth['isAuthenticated'](),interaction[_0x40e7('0x21')](_0x40e7('0x22'),_0x40e7('0x23')),controller[_0x40e7('0x24')]);router[_0x40e7('0x25')](_0x40e7('0x26'),auth[_0x40e7('0x9')](),interaction[_0x40e7('0x21')](_0x40e7('0x22'),'chatinteraction:update'),controller[_0x40e7('0x27')]);router['put'](_0x40e7('0x28'),controller[_0x40e7('0x29')]);router['put'](_0x40e7('0x2a'),auth[_0x40e7('0xc')](),controller[_0x40e7('0x2b')]);router['put'](_0x40e7('0x2c'),controller[_0x40e7('0x2d')]);router[_0x40e7('0x2e')](_0x40e7('0x26'),auth['isAuthenticated'](),interaction['tracked'](_0x40e7('0x22'),_0x40e7('0x2f')),controller[_0x40e7('0x30')]);router[_0x40e7('0x2e')](_0x40e7('0x20'),auth['isAuthenticated'](),controller[_0x40e7('0x31')]);module[_0x40e7('0x32')]=router; \ No newline at end of file +var _0xd3dc=['/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','tracked','chatinteraction:destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','post','create','createVidaooSession','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','/:id/tags','chatinteraction:addtags','addTags','put','chat','chatinteraction:update'];(function(_0x24f8af,_0x2eb8db){var _0x3f5702=function(_0x2a397e){while(--_0x2a397e){_0x24f8af['push'](_0x24f8af['shift']());}};_0x3f5702(++_0x2eb8db);}(_0xd3dc,0x107));var _0xcd3d=function(_0x948cad,_0x3172b0){_0x948cad=_0x948cad-0x0;var _0x519ecd=_0xd3dc[_0x948cad];return _0x519ecd;};'use strict';var multer=require(_0xcd3d('0x0'));var util=require(_0xcd3d('0x1'));var path=require(_0xcd3d('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd3d('0x3'));var router=express[_0xcd3d('0x4')]();var fs_extra=require(_0xcd3d('0x5'));var auth=require(_0xcd3d('0x6'));var interaction=require(_0xcd3d('0x7'));var config=require(_0xcd3d('0x8'));var controller=require(_0xcd3d('0x9'));router[_0xcd3d('0xa')]('/',auth[_0xcd3d('0xb')](),controller[_0xcd3d('0xc')]);router[_0xcd3d('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xcd3d('0xd')]);router[_0xcd3d('0xa')](_0xcd3d('0xe'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0xcd3d('0xa')](_0xcd3d('0xf'),auth[_0xcd3d('0x10')](),controller[_0xcd3d('0x11')]);router[_0xcd3d('0xa')](_0xcd3d('0x12'),auth['isAuthenticated'](),controller[_0xcd3d('0x13')]);router[_0xcd3d('0xa')]('/:id/my_messages',auth[_0xcd3d('0x10')](),controller[_0xcd3d('0x14')]);router[_0xcd3d('0xa')](_0xcd3d('0x15'),auth[_0xcd3d('0xb')](),controller['download']);router[_0xcd3d('0x16')]('/',auth[_0xcd3d('0xb')](),controller[_0xcd3d('0x17')]);router['post']('/:id/vidaoo',auth[_0xcd3d('0xb')](),controller[_0xcd3d('0x18')]);var upload=multer({'storage':multer[_0xcd3d('0x19')]({'destination':function(_0x6bb361,_0x24cf86,_0x4f680d){_0x4f680d(null,path[_0xcd3d('0x1a')](config['root'],_0xcd3d('0x1b')));},'filename':function(_0x5c0f8c,_0x30cb58,_0x458532){_0x458532(null,util[_0xcd3d('0x1c')](_0xcd3d('0x1d'),Date[_0xcd3d('0x1e')](),_0x30cb58[_0xcd3d('0x1f')][_0xcd3d('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xcd3d('0x21'),upload['single'](_0xcd3d('0x22')),controller[_0xcd3d('0x23')]);router[_0xcd3d('0x16')](_0xcd3d('0x12'),auth[_0xcd3d('0x10')](),controller[_0xcd3d('0x24')]);router['post'](_0xcd3d('0x25'),auth['isAuthenticated'](),interaction['tracked']('chat',_0xcd3d('0x26')),controller[_0xcd3d('0x27')]);router[_0xcd3d('0x28')](_0xcd3d('0xe'),auth[_0xcd3d('0xb')](),interaction['tracked'](_0xcd3d('0x29'),_0xcd3d('0x2a')),controller['update']);router[_0xcd3d('0x28')](_0xcd3d('0x2b'),controller[_0xcd3d('0x2c')]);router[_0xcd3d('0x28')]('/:id/abandon',auth[_0xcd3d('0x10')](),controller[_0xcd3d('0x2d')]);router[_0xcd3d('0x28')](_0xcd3d('0x2e'),controller[_0xcd3d('0x2f')]);router[_0xcd3d('0x30')](_0xcd3d('0xe'),auth[_0xcd3d('0xb')](),interaction[_0xcd3d('0x31')](_0xcd3d('0x29'),_0xcd3d('0x32')),controller['destroy']);router[_0xcd3d('0x30')](_0xcd3d('0x25'),auth[_0xcd3d('0xb')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 995470d..5b8168e 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 _0x81b0=['medium','INTEGER','sequelize','exports','TEXT'];(function(_0x5dafd0,_0x3bcbb6){var _0x364354=function(_0x5da31c){while(--_0x5da31c){_0x5dafd0['push'](_0x5dafd0['shift']());}};_0x364354(++_0x3bcbb6);}(_0x81b0,0x151));var _0x081b=function(_0x4adeb9,_0x251666){_0x4adeb9=_0x4adeb9-0x0;var _0x2bba5a=_0x81b0[_0x4adeb9];return _0x2bba5a;};'use strict';var Sequelize=require(_0x081b('0x0'));module[_0x081b('0x1')]={'body':{'type':Sequelize[_0x081b('0x2')](_0x081b('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x081b('0x4')]}}; \ No newline at end of file +var _0xd4db=['INTEGER','exports','TEXT','medium'];(function(_0x358123,_0x4356af){var _0x4c51cd=function(_0x5a882a){while(--_0x5a882a){_0x358123['push'](_0x358123['shift']());}};_0x4c51cd(++_0x4356af);}(_0xd4db,0x71));var _0xbd4d=function(_0x3d67d1,_0x3579b8){_0x3d67d1=_0x3d67d1-0x0;var _0x490bd0=_0xd4db[_0x3d67d1];return _0x490bd0;};'use strict';var Sequelize=require('sequelize');module[_0xbd4d('0x0')]={'body':{'type':Sequelize[_0xbd4d('0x1')](_0xbd4d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xbd4d('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f1cd9a4..90ec209 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 _0xb114=['fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','error','name','send','index','ChatInternalMessage','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','params','length','find','create','body','catch','update','destroy','describe','get','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','fullname','userpic','internal','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','role','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','agent','resourceId','push','FromId','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x57b236,_0x30614e){var _0x4feb29=function(_0x26d3e6){while(--_0x26d3e6){_0x57b236['push'](_0x57b236['shift']());}};_0x4feb29(++_0x30614e);}(_0xb114,0x1a1));var _0x4b11=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xb114[_0xef8146];return _0x5a6cb0;};'use strict';var emlformat=require(_0x4b11('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b11('0x1'));var jsonpatch=require(_0x4b11('0x2'));var rp=require(_0x4b11('0x3'));var moment=require(_0x4b11('0x4'));var BPromise=require(_0x4b11('0x5'));var Mustache=require(_0x4b11('0x6'));var util=require(_0x4b11('0x7'));var path=require(_0x4b11('0x8'));var sox=require('sox');var csv=require(_0x4b11('0x9'));var ejs=require(_0x4b11('0xa'));var fs=require('fs');var fs_extra=require(_0x4b11('0xb'));var _=require('lodash');var squel=require(_0x4b11('0xc'));var crypto=require(_0x4b11('0xd'));var jsforce=require(_0x4b11('0xe'));var deskjs=require(_0x4b11('0xf'));var toCsv=require(_0x4b11('0x9'));var querystring=require(_0x4b11('0x10'));var Papa=require(_0x4b11('0x11'));var Redis=require(_0x4b11('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4b11('0x13'));var hardwareService=require(_0x4b11('0x14'));var logger=require(_0x4b11('0x15'))(_0x4b11('0x16'));var utils=require(_0x4b11('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4b11('0x18')]=_[_0x4b11('0x19')](config[_0x4b11('0x18')],{'host':_0x4b11('0x1a'),'port':0x18eb});var socket=require(_0x4b11('0x1b'))(new Redis(config[_0x4b11('0x18')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x3ddc80,_0x51b9cb){_0x51b9cb=_0x51b9cb||0xcc;return function(_0x4a9451){if(_0x4a9451){return _0x3ddc80[_0x4b11('0x1c')](_0x51b9cb);}return _0x3ddc80['status'](_0x51b9cb)[_0x4b11('0x1d')]();};}function respondWithResult(_0x5ad73a,_0x34d866){_0x34d866=_0x34d866||0xc8;return function(_0x1246e4){if(_0x1246e4){return _0x5ad73a[_0x4b11('0x1e')](_0x34d866)[_0x4b11('0x1f')](_0x1246e4);}};}function respondWithFilteredResult(_0x5a2d79,_0x1ae02b){return function(_0x3cb345){if(_0x3cb345){var _0xb9b6c0=typeof _0x1ae02b['offset']===_0x4b11('0x20')&&typeof _0x1ae02b[_0x4b11('0x21')]===_0x4b11('0x20');var _0x23e534=_0x3cb345[_0x4b11('0x22')];var _0x1095dc=_0xb9b6c0?0x0:_0x1ae02b[_0x4b11('0x23')];var _0x3059df=_0xb9b6c0?_0x3cb345['count']:_0x1ae02b['offset']+_0x1ae02b[_0x4b11('0x21')];var _0x12026b;if(_0x3059df>=_0x23e534){_0x3059df=_0x23e534;_0x12026b=0xc8;}else{_0x12026b=0xce;}_0x5a2d79[_0x4b11('0x1e')](_0x12026b);return _0x5a2d79[_0x4b11('0x24')](_0x4b11('0x25'),_0x1095dc+'-'+_0x3059df+'/'+_0x23e534)[_0x4b11('0x1f')](_0x3cb345);}return null;};}function patchUpdates(_0x282ace){return function(_0x4546ed){try{jsonpatch['apply'](_0x4546ed,_0x282ace,!![]);}catch(_0x1db022){return BPromise[_0x4b11('0x26')](_0x1db022);}return _0x4546ed[_0x4b11('0x27')]();};}function saveUpdates(_0x181780,_0x2a1180){return function(_0x37a00d){if(_0x37a00d){return _0x37a00d['update'](_0x181780)[_0x4b11('0x28')](function(_0x33543f){return _0x33543f;});}return null;};}function removeEntity(_0x2c1629,_0x264ac0){return function(_0x21fdf1){if(_0x21fdf1){return _0x21fdf1['destroy']()[_0x4b11('0x28')](function(){_0x2c1629[_0x4b11('0x1e')](0xcc)[_0x4b11('0x1d')]();});}};}function handleEntityNotFound(_0x3fb499,_0x108445){return function(_0x58b4bf){if(!_0x58b4bf){_0x3fb499['sendStatus'](0x194);}return _0x58b4bf;};}function handleError(_0x3f4c9f,_0x54a852){_0x54a852=_0x54a852||0x1f4;return function(_0x22b6bb){logger[_0x4b11('0x29')](_0x22b6bb['stack']);if(_0x22b6bb[_0x4b11('0x2a')]){delete _0x22b6bb[_0x4b11('0x2a')];}_0x3f4c9f['status'](_0x54a852)[_0x4b11('0x2b')](_0x22b6bb);};}exports[_0x4b11('0x2c')]=function(_0x236a19,_0x457b00){var _0x3a44d9={},_0x240a94={},_0x32a7a={'count':0x0,'rows':[]};var _0x4b1a56=_['map'](db[_0x4b11('0x2d')][_0x4b11('0x2e')],function(_0x44f01a){return{'name':_0x44f01a[_0x4b11('0x2f')],'type':_0x44f01a['type'][_0x4b11('0x30')]};});_0x240a94[_0x4b11('0x31')]=_[_0x4b11('0x32')](_0x4b1a56,_0x4b11('0x2a'));_0x240a94[_0x4b11('0x33')]=_[_0x4b11('0x34')](_0x236a19[_0x4b11('0x33')]);_0x240a94[_0x4b11('0x35')]=_[_0x4b11('0x36')](_0x240a94[_0x4b11('0x31')],_0x240a94[_0x4b11('0x33')]);_0x3a44d9[_0x4b11('0x37')]=_[_0x4b11('0x36')](_0x240a94[_0x4b11('0x31')],qs[_0x4b11('0x38')](_0x236a19[_0x4b11('0x33')][_0x4b11('0x38')]));_0x3a44d9[_0x4b11('0x37')]=_0x3a44d9[_0x4b11('0x37')]['length']?_0x3a44d9['attributes']:_0x240a94[_0x4b11('0x31')];if(!_0x236a19[_0x4b11('0x33')][_0x4b11('0x39')](_0x4b11('0x3a'))){_0x3a44d9[_0x4b11('0x21')]=qs[_0x4b11('0x21')](_0x236a19['query'][_0x4b11('0x21')]);_0x3a44d9['offset']=qs['offset'](_0x236a19[_0x4b11('0x33')]['offset']);}_0x3a44d9['order']=qs[_0x4b11('0x3b')](_0x236a19[_0x4b11('0x33')][_0x4b11('0x3b')]);_0x3a44d9[_0x4b11('0x3c')]=qs[_0x4b11('0x35')](_[_0x4b11('0x3d')](_0x236a19[_0x4b11('0x33')],_0x240a94['filters']),_0x4b1a56);if(_0x236a19[_0x4b11('0x33')][_0x4b11('0x3e')]){_0x3a44d9[_0x4b11('0x3c')]=_['merge'](_0x3a44d9[_0x4b11('0x3c')],{'$or':_[_0x4b11('0x32')](_0x4b1a56,function(_0x94e9aa){if(_0x94e9aa['type']!==_0x4b11('0x3f')){var _0x427741={};_0x427741[_0x94e9aa[_0x4b11('0x2a')]]={'$like':'%'+_0x236a19[_0x4b11('0x33')][_0x4b11('0x3e')]+'%'};return _0x427741;}})});}_0x3a44d9=_[_0x4b11('0x40')]({},_0x3a44d9,_0x236a19[_0x4b11('0x41')]);var _0x48f8a3={'where':_0x3a44d9[_0x4b11('0x3c')]};return db['ChatInternalMessage'][_0x4b11('0x22')](_0x48f8a3)[_0x4b11('0x28')](function(_0x58cdf7){_0x32a7a[_0x4b11('0x22')]=_0x58cdf7;if(_0x236a19[_0x4b11('0x33')][_0x4b11('0x42')]){_0x3a44d9[_0x4b11('0x43')]=[{'all':!![]}];}return db[_0x4b11('0x2d')][_0x4b11('0x44')](_0x3a44d9);})[_0x4b11('0x28')](function(_0x24bf48){_0x32a7a['rows']=_0x24bf48;return _0x32a7a;})[_0x4b11('0x28')](respondWithFilteredResult(_0x457b00,_0x3a44d9))['catch'](handleError(_0x457b00,null));};exports['show']=function(_0xd792ab,_0x57c687){var _0x63d37a={'raw':!![],'where':{'id':_0xd792ab[_0x4b11('0x45')]['id']}},_0x5433e1={};_0x5433e1[_0x4b11('0x31')]=_[_0x4b11('0x34')](db[_0x4b11('0x2d')][_0x4b11('0x2e')]);_0x5433e1['query']=_['keys'](_0xd792ab[_0x4b11('0x33')]);_0x5433e1[_0x4b11('0x35')]=_[_0x4b11('0x36')](_0x5433e1[_0x4b11('0x31')],_0x5433e1[_0x4b11('0x33')]);_0x63d37a['attributes']=_['intersection'](_0x5433e1[_0x4b11('0x31')],qs[_0x4b11('0x38')](_0xd792ab[_0x4b11('0x33')]['fields']));_0x63d37a[_0x4b11('0x37')]=_0x63d37a[_0x4b11('0x37')][_0x4b11('0x46')]?_0x63d37a[_0x4b11('0x37')]:_0x5433e1[_0x4b11('0x31')];if(_0xd792ab['query']['includeAll']){_0x63d37a['include']=[{'all':!![]}];}_0x63d37a=_['merge']({},_0x63d37a,_0xd792ab['options']);return db['ChatInternalMessage'][_0x4b11('0x47')](_0x63d37a)['then'](handleEntityNotFound(_0x57c687,null))[_0x4b11('0x28')](respondWithResult(_0x57c687,null))['catch'](handleError(_0x57c687,null));};exports[_0x4b11('0x48')]=function(_0x2124b8,_0x36d243){return db[_0x4b11('0x2d')][_0x4b11('0x48')](_0x2124b8[_0x4b11('0x49')],{})[_0x4b11('0x28')](respondWithResult(_0x36d243,0xc9))[_0x4b11('0x4a')](handleError(_0x36d243,null));};exports[_0x4b11('0x4b')]=function(_0x254133,_0x512e1d){if(_0x254133[_0x4b11('0x49')]['id']){delete _0x254133['body']['id'];}return db[_0x4b11('0x2d')]['find']({'where':{'id':_0x254133[_0x4b11('0x45')]['id']}})['then'](handleEntityNotFound(_0x512e1d,null))[_0x4b11('0x28')](saveUpdates(_0x254133[_0x4b11('0x49')],null))[_0x4b11('0x28')](respondWithResult(_0x512e1d,null))[_0x4b11('0x4a')](handleError(_0x512e1d,null));};exports[_0x4b11('0x4c')]=function(_0xb30b90,_0x136197){return db[_0x4b11('0x2d')][_0x4b11('0x47')]({'where':{'id':_0xb30b90[_0x4b11('0x45')]['id']}})[_0x4b11('0x28')](handleEntityNotFound(_0x136197,null))['then'](removeEntity(_0x136197,null))[_0x4b11('0x4a')](handleError(_0x136197,null));};exports['describe']=function(_0x5a8893,_0x2fd8bb){return db[_0x4b11('0x2d')][_0x4b11('0x4d')]()[_0x4b11('0x28')](respondWithResult(_0x2fd8bb,null))[_0x4b11('0x4a')](handleError(_0x2fd8bb,null));};function wrapUser(_0x19b49e){return function(_0x176178){var _0xbf17fc=_0x19b49e[_0x4b11('0x4e')]({'plain':!![]});_0xbf17fc['messages']=[];if(_0x176178){_0xbf17fc[_0x4b11('0x4f')]=_0x176178[_0x4b11('0x50')];_0xbf17fc['lastMessage']=_0x176178;}else{_0xbf17fc[_0x4b11('0x4f')]=moment(0x0)[_0x4b11('0x51')](_0x4b11('0x52'));_0xbf17fc['lastMessage']={};}return _0xbf17fc;};}exports[_0x4b11('0x53')]=function(_0x59e291,_0x36dd8b,_0x3a6464){var _0x5600bf=[];return db[_0x4b11('0x54')][_0x4b11('0x44')]({'where':{'role':['agent',_0x4b11('0x55'),_0x4b11('0x56')]},'attributes':['id',_0x4b11('0x57'),_0x4b11('0x2a'),'role',_0x4b11('0x58'),_0x4b11('0x59'),'online',_0x4b11('0x5a'),_0x4b11('0x5b'),'showWebBar'],'order':qs[_0x4b11('0x3b')](_0x4b11('0x5c')),'include':[{'model':db[_0x4b11('0x5d')],'as':_0x4b11('0x5e'),'attributes':['id',_0x4b11('0x2a'),'type'],'through':{'attributes':[]}}]})[_0x4b11('0x28')](function(_0x116e96){if(_0x116e96){var _0x3bd5fd=_0x59e291['user']['get']({'plain':!![]});if(!_0x3bd5fd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3bd5fd[_0x4b11('0x5f')]===_0x4b11('0x56')){return db[_0x4b11('0x60')][_0x4b11('0x47')]({'where':{'name':_0x4b11('0x61'),'userProfileId':_0x3bd5fd[_0x4b11('0x62')]},'raw':!![]})[_0x4b11('0x28')](function(_0x197599){if(_0x197599){if(_0x197599['autoAssociation']===0x0){return db[_0x4b11('0x63')][_0x4b11('0x44')]({'where':{'sectionId':_0x197599['id']},'raw':!![]})[_0x4b11('0x28')](function(_0x35a7b4){var _0xe4cadf=[];if(_[_0x4b11('0x64')](_0x35a7b4)){_0xe4cadf=_[_0x4b11('0x3e')](_0x116e96,function(_0x5156ee){if(_0x5156ee[_0x4b11('0x5f')]!=='agent'){return _0x5156ee;}});return _0xe4cadf;}else{for(var _0x1f7320=0x0;_0x1f7320<_0x116e96['length'];_0x1f7320++){var _0x1e2663=_0x116e96[_0x1f7320];if(_0x1e2663['role']===_0x4b11('0x65')){var _0x9b1f58=_[_0x4b11('0x47')](_0x35a7b4,function(_0x514e64){return _0x514e64[_0x4b11('0x66')]===_0x1e2663['id'];});if(_0x9b1f58)_0xe4cadf[_0x4b11('0x67')](_0x1e2663);}else{_0xe4cadf[_0x4b11('0x67')](_0x1e2663);}}return _0xe4cadf;}});}else{return _0x116e96;}}else{var _0x1f094b=_[_0x4b11('0x3e')](_0x116e96,function(_0x2cf63e){if(_0x2cf63e[_0x4b11('0x5f')]!==_0x4b11('0x65')){return _0x2cf63e;}});return _0x1f094b;}});}else{return _0x116e96;}}})[_0x4b11('0x28')](function(_0x2ce27a){var _0x4f5dd5=[];if(_0x2ce27a){_0x5600bf=_0x2ce27a;for(var _0x317794=0x0;_0x317794<_0x2ce27a[_0x4b11('0x46')];_0x317794+=0x1){_0x5600bf[_0x317794]['messages']=[];_0x4f5dd5[_0x4b11('0x67')](db[_0x4b11('0x2d')][_0x4b11('0x47')]({'where':{'FromId':[_0x59e291[_0x4b11('0x56')]['id'],_0x2ce27a[_0x317794]['id']],'ToId':[_0x59e291[_0x4b11('0x56')]['id'],_0x2ce27a[_0x317794]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x4b11('0x68'),'ToId','read',_0x4b11('0x49')],'order':qs['sort'](_0x4b11('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x2ce27a[_0x317794])));}return BPromise[_0x4b11('0x6a')](_0x4f5dd5);}return[];})['then'](function(_0x1960f3){return{'rows':_0x1960f3,'count':_0x1960f3[_0x4b11('0x46')]};})[_0x4b11('0x28')](respondWithResult(_0x36dd8b,null))[_0x4b11('0x4a')](handleError(_0x36dd8b,null));}; \ No newline at end of file +var _0x2b79=['VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','sort','VoiceQueues','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','filter','resourceId','push','createdAt','FromId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','order','merge','where'];(function(_0x39bc5a,_0x32ad38){var _0xcc2510=function(_0x1bae13){while(--_0x1bae13){_0x39bc5a['push'](_0x39bc5a['shift']());}};_0xcc2510(++_0x32ad38);}(_0x2b79,0x10a));var _0x92b7=function(_0x1b91c7,_0x539acd){_0x1b91c7=_0x1b91c7-0x0;var _0xbbe014=_0x2b79[_0x1b91c7];return _0xbbe014;};'use strict';var emlformat=require(_0x92b7('0x0'));var rimraf=require(_0x92b7('0x1'));var zipdir=require(_0x92b7('0x2'));var jsonpatch=require(_0x92b7('0x3'));var rp=require(_0x92b7('0x4'));var moment=require(_0x92b7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x92b7('0x6'));var util=require(_0x92b7('0x7'));var path=require('path');var sox=require(_0x92b7('0x8'));var csv=require(_0x92b7('0x9'));var ejs=require(_0x92b7('0xa'));var fs=require('fs');var fs_extra=require(_0x92b7('0xb'));var _=require('lodash');var squel=require(_0x92b7('0xc'));var crypto=require(_0x92b7('0xd'));var jsforce=require(_0x92b7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x92b7('0x9'));var querystring=require(_0x92b7('0xf'));var Papa=require(_0x92b7('0x10'));var Redis=require(_0x92b7('0x11'));var authService=require(_0x92b7('0x12'));var qs=require(_0x92b7('0x13'));var as=require(_0x92b7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92b7('0x15'))(_0x92b7('0x16'));var utils=require('../../config/utils');var config=require(_0x92b7('0x17'));var licenseUtil=require(_0x92b7('0x18'));var db=require(_0x92b7('0x19'))['db'];config[_0x92b7('0x1a')]=_[_0x92b7('0x1b')](config[_0x92b7('0x1a')],{'host':_0x92b7('0x1c'),'port':0x18eb});var socket=require(_0x92b7('0x1d'))(new Redis(config[_0x92b7('0x1a')]));require(_0x92b7('0x1e'))[_0x92b7('0x1f')](socket);function respondWithStatusCode(_0x19b610,_0x14a778){_0x14a778=_0x14a778||0xcc;return function(_0x1d46a2){if(_0x1d46a2){return _0x19b610[_0x92b7('0x20')](_0x14a778);}return _0x19b610[_0x92b7('0x21')](_0x14a778)['end']();};}function respondWithResult(_0x38dca7,_0x2de953){_0x2de953=_0x2de953||0xc8;return function(_0x18cc15){if(_0x18cc15){return _0x38dca7['status'](_0x2de953)['json'](_0x18cc15);}};}function respondWithFilteredResult(_0x51db30,_0x3fb9bf){return function(_0x570328){if(_0x570328){var _0x23c9b3=typeof _0x3fb9bf[_0x92b7('0x22')]===_0x92b7('0x23')&&typeof _0x3fb9bf['limit']===_0x92b7('0x23');var _0x11fa3a=_0x570328[_0x92b7('0x24')];var _0xd1d401=_0x23c9b3?0x0:_0x3fb9bf['offset'];var _0x4a9559=_0x23c9b3?_0x570328[_0x92b7('0x24')]:_0x3fb9bf[_0x92b7('0x22')]+_0x3fb9bf[_0x92b7('0x25')];var _0x30faed;if(_0x4a9559>=_0x11fa3a){_0x4a9559=_0x11fa3a;_0x30faed=0xc8;}else{_0x30faed=0xce;}_0x51db30[_0x92b7('0x21')](_0x30faed);return _0x51db30[_0x92b7('0x26')](_0x92b7('0x27'),_0xd1d401+'-'+_0x4a9559+'/'+_0x11fa3a)[_0x92b7('0x28')](_0x570328);}return null;};}function patchUpdates(_0x47913d){return function(_0x19f978){try{jsonpatch['apply'](_0x19f978,_0x47913d,!![]);}catch(_0x541174){return BPromise[_0x92b7('0x29')](_0x541174);}return _0x19f978['save']();};}function saveUpdates(_0x3ffbc8,_0x5accb6){return function(_0x51a8d1){if(_0x51a8d1){return _0x51a8d1[_0x92b7('0x2a')](_0x3ffbc8)[_0x92b7('0x2b')](function(_0x35df7a){return _0x35df7a;});}return null;};}function removeEntity(_0x4e01f9,_0x341071){return function(_0xd6c4e5){if(_0xd6c4e5){return _0xd6c4e5[_0x92b7('0x2c')]()[_0x92b7('0x2b')](function(){_0x4e01f9[_0x92b7('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d008f,_0x53426a){return function(_0x18ae50){if(!_0x18ae50){_0x1d008f['sendStatus'](0x194);}return _0x18ae50;};}function handleError(_0x3e8a23,_0x5d6b84){_0x5d6b84=_0x5d6b84||0x1f4;return function(_0xd56791){logger[_0x92b7('0x2d')](_0xd56791[_0x92b7('0x2e')]);if(_0xd56791[_0x92b7('0x2f')]){delete _0xd56791[_0x92b7('0x2f')];}_0x3e8a23['status'](_0x5d6b84)[_0x92b7('0x30')](_0xd56791);};}exports[_0x92b7('0x31')]=function(_0x9f1917,_0x44bc05){var _0x5c0a53={},_0x4c0439={},_0x4d39fe={'count':0x0,'rows':[]};var _0x1c341e=_[_0x92b7('0x32')](db[_0x92b7('0x33')][_0x92b7('0x34')],function(_0x37e1ed){return{'name':_0x37e1ed[_0x92b7('0x35')],'type':_0x37e1ed[_0x92b7('0x36')][_0x92b7('0x37')]};});_0x4c0439['model']=_[_0x92b7('0x32')](_0x1c341e,_0x92b7('0x2f'));_0x4c0439['query']=_[_0x92b7('0x38')](_0x9f1917[_0x92b7('0x39')]);_0x4c0439[_0x92b7('0x3a')]=_[_0x92b7('0x3b')](_0x4c0439[_0x92b7('0x3c')],_0x4c0439[_0x92b7('0x39')]);_0x5c0a53[_0x92b7('0x3d')]=_[_0x92b7('0x3b')](_0x4c0439['model'],qs[_0x92b7('0x3e')](_0x9f1917[_0x92b7('0x39')][_0x92b7('0x3e')]));_0x5c0a53[_0x92b7('0x3d')]=_0x5c0a53[_0x92b7('0x3d')][_0x92b7('0x3f')]?_0x5c0a53[_0x92b7('0x3d')]:_0x4c0439['model'];if(!_0x9f1917[_0x92b7('0x39')]['hasOwnProperty']('nolimit')){_0x5c0a53[_0x92b7('0x25')]=qs[_0x92b7('0x25')](_0x9f1917[_0x92b7('0x39')][_0x92b7('0x25')]);_0x5c0a53[_0x92b7('0x22')]=qs[_0x92b7('0x22')](_0x9f1917[_0x92b7('0x39')][_0x92b7('0x22')]);}_0x5c0a53[_0x92b7('0x40')]=qs['sort'](_0x9f1917['query']['sort']);_0x5c0a53['where']=qs[_0x92b7('0x3a')](_['pick'](_0x9f1917[_0x92b7('0x39')],_0x4c0439[_0x92b7('0x3a')]),_0x1c341e);if(_0x9f1917[_0x92b7('0x39')]['filter']){_0x5c0a53['where']=_[_0x92b7('0x41')](_0x5c0a53[_0x92b7('0x42')],{'$or':_['map'](_0x1c341e,function(_0x346093){if(_0x346093[_0x92b7('0x36')]!==_0x92b7('0x43')){var _0x1ffb7e={};_0x1ffb7e[_0x346093[_0x92b7('0x2f')]]={'$like':'%'+_0x9f1917[_0x92b7('0x39')]['filter']+'%'};return _0x1ffb7e;}})});}_0x5c0a53=_[_0x92b7('0x41')]({},_0x5c0a53,_0x9f1917['options']);var _0x4ac934={'where':_0x5c0a53['where']};return db[_0x92b7('0x33')]['count'](_0x4ac934)['then'](function(_0x1a88f0){_0x4d39fe[_0x92b7('0x24')]=_0x1a88f0;if(_0x9f1917[_0x92b7('0x39')][_0x92b7('0x44')]){_0x5c0a53[_0x92b7('0x45')]=[{'all':!![]}];}return db[_0x92b7('0x33')][_0x92b7('0x46')](_0x5c0a53);})[_0x92b7('0x2b')](function(_0x289c2e){_0x4d39fe[_0x92b7('0x47')]=_0x289c2e;return _0x4d39fe;})[_0x92b7('0x2b')](respondWithFilteredResult(_0x44bc05,_0x5c0a53))['catch'](handleError(_0x44bc05,null));};exports[_0x92b7('0x48')]=function(_0x3b0c0a,_0x36c291){var _0x39e004={'raw':!![],'where':{'id':_0x3b0c0a[_0x92b7('0x49')]['id']}},_0x1c7042={};_0x1c7042[_0x92b7('0x3c')]=_['keys'](db['ChatInternalMessage']['rawAttributes']);_0x1c7042[_0x92b7('0x39')]=_['keys'](_0x3b0c0a[_0x92b7('0x39')]);_0x1c7042[_0x92b7('0x3a')]=_[_0x92b7('0x3b')](_0x1c7042[_0x92b7('0x3c')],_0x1c7042['query']);_0x39e004[_0x92b7('0x3d')]=_[_0x92b7('0x3b')](_0x1c7042[_0x92b7('0x3c')],qs[_0x92b7('0x3e')](_0x3b0c0a[_0x92b7('0x39')]['fields']));_0x39e004[_0x92b7('0x3d')]=_0x39e004[_0x92b7('0x3d')]['length']?_0x39e004[_0x92b7('0x3d')]:_0x1c7042[_0x92b7('0x3c')];if(_0x3b0c0a[_0x92b7('0x39')][_0x92b7('0x44')]){_0x39e004[_0x92b7('0x45')]=[{'all':!![]}];}_0x39e004=_['merge']({},_0x39e004,_0x3b0c0a[_0x92b7('0x4a')]);return db[_0x92b7('0x33')][_0x92b7('0x4b')](_0x39e004)[_0x92b7('0x2b')](handleEntityNotFound(_0x36c291,null))[_0x92b7('0x2b')](respondWithResult(_0x36c291,null))[_0x92b7('0x4c')](handleError(_0x36c291,null));};exports[_0x92b7('0x4d')]=function(_0x45045f,_0x10d860){return db[_0x92b7('0x33')][_0x92b7('0x4d')](_0x45045f[_0x92b7('0x4e')],{})[_0x92b7('0x2b')](respondWithResult(_0x10d860,0xc9))[_0x92b7('0x4c')](handleError(_0x10d860,null));};exports[_0x92b7('0x2a')]=function(_0x23c89b,_0x519f5b){if(_0x23c89b['body']['id']){delete _0x23c89b[_0x92b7('0x4e')]['id'];}return db[_0x92b7('0x33')][_0x92b7('0x4b')]({'where':{'id':_0x23c89b['params']['id']}})[_0x92b7('0x2b')](handleEntityNotFound(_0x519f5b,null))[_0x92b7('0x2b')](saveUpdates(_0x23c89b['body'],null))[_0x92b7('0x2b')](respondWithResult(_0x519f5b,null))['catch'](handleError(_0x519f5b,null));};exports[_0x92b7('0x2c')]=function(_0x588c81,_0x201a3c){return db[_0x92b7('0x33')][_0x92b7('0x4b')]({'where':{'id':_0x588c81[_0x92b7('0x49')]['id']}})[_0x92b7('0x2b')](handleEntityNotFound(_0x201a3c,null))[_0x92b7('0x2b')](removeEntity(_0x201a3c,null))[_0x92b7('0x4c')](handleError(_0x201a3c,null));};exports['describe']=function(_0x5276bc,_0x120736){return db[_0x92b7('0x33')][_0x92b7('0x4f')]()[_0x92b7('0x2b')](respondWithResult(_0x120736,null))['catch'](handleError(_0x120736,null));};function wrapUser(_0x545db){return function(_0x36b7e7){var _0x329249=_0x545db[_0x92b7('0x50')]({'plain':!![]});_0x329249[_0x92b7('0x51')]=[];if(_0x36b7e7){_0x329249[_0x92b7('0x52')]=_0x36b7e7['createdAt'];_0x329249[_0x92b7('0x53')]=_0x36b7e7;}else{_0x329249[_0x92b7('0x52')]=moment(0x0)[_0x92b7('0x54')](_0x92b7('0x55'));_0x329249[_0x92b7('0x53')]={};}return _0x329249;};}exports[_0x92b7('0x56')]=function(_0x509284,_0x59bbbf,_0x50306f){var _0x23676a=[];return db['User'][_0x92b7('0x46')]({'where':{'role':[_0x92b7('0x57'),'admin',_0x92b7('0x58')]},'attributes':['id',_0x92b7('0x59'),_0x92b7('0x2f'),_0x92b7('0x5a'),_0x92b7('0x5b'),_0x92b7('0x5c'),_0x92b7('0x5d'),_0x92b7('0x5e'),_0x92b7('0x5f'),_0x92b7('0x60')],'order':qs[_0x92b7('0x61')]('-online'),'include':[{'model':db['VoiceQueue'],'as':_0x92b7('0x62'),'attributes':['id',_0x92b7('0x2f'),_0x92b7('0x36')],'through':{'attributes':[]}}]})[_0x92b7('0x2b')](function(_0xc0b50e){if(_0xc0b50e){var _0x13cbb7=_0x509284[_0x92b7('0x58')]['get']({'plain':!![]});if(!_0x13cbb7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13cbb7['role']===_0x92b7('0x58')){return db[_0x92b7('0x63')]['find']({'where':{'name':_0x92b7('0x64'),'userProfileId':_0x13cbb7[_0x92b7('0x65')]},'raw':!![]})[_0x92b7('0x2b')](function(_0x625dc4){if(_0x625dc4){if(_0x625dc4['autoAssociation']===0x0){return db[_0x92b7('0x66')][_0x92b7('0x46')]({'where':{'sectionId':_0x625dc4['id']},'raw':!![]})[_0x92b7('0x2b')](function(_0x25688f){var _0x2705b1=[];if(_[_0x92b7('0x67')](_0x25688f)){_0x2705b1=_[_0x92b7('0x68')](_0xc0b50e,function(_0x421517){if(_0x421517['role']!==_0x92b7('0x57')){return _0x421517;}});return _0x2705b1;}else{for(var _0x2937a1=0x0;_0x2937a1<_0xc0b50e[_0x92b7('0x3f')];_0x2937a1++){var _0x59c5ca=_0xc0b50e[_0x2937a1];if(_0x59c5ca[_0x92b7('0x5a')]==='agent'){var _0x10cc49=_[_0x92b7('0x4b')](_0x25688f,function(_0xa804c6){return _0xa804c6[_0x92b7('0x69')]===_0x59c5ca['id'];});if(_0x10cc49)_0x2705b1['push'](_0x59c5ca);}else{_0x2705b1[_0x92b7('0x6a')](_0x59c5ca);}}return _0x2705b1;}});}else{return _0xc0b50e;}}else{var _0x428559=_['filter'](_0xc0b50e,function(_0xe920c1){if(_0xe920c1['role']!=='agent'){return _0xe920c1;}});return _0x428559;}});}else{return _0xc0b50e;}}})[_0x92b7('0x2b')](function(_0x13ac66){var _0x547c36=[];if(_0x13ac66){_0x23676a=_0x13ac66;for(var _0x1f3d74=0x0;_0x1f3d74<_0x13ac66[_0x92b7('0x3f')];_0x1f3d74+=0x1){_0x23676a[_0x1f3d74][_0x92b7('0x51')]=[];_0x547c36['push'](db['ChatInternalMessage'][_0x92b7('0x4b')]({'where':{'FromId':[_0x509284['user']['id'],_0x13ac66[_0x1f3d74]['id']],'ToId':[_0x509284[_0x92b7('0x58')]['id'],_0x13ac66[_0x1f3d74]['id']],'ChatGroupId':null},'attributes':['id',_0x92b7('0x6b'),_0x92b7('0x6c'),'ToId',_0x92b7('0x6d'),_0x92b7('0x4e')],'order':qs[_0x92b7('0x61')](_0x92b7('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x92b7('0x2b')](wrapUser(_0x13ac66[_0x1f3d74])));}return BPromise['all'](_0x547c36);}return[];})[_0x92b7('0x2b')](function(_0x27875c){return{'rows':_0x27875c,'count':_0x27875c[_0x92b7('0x3f')]};})[_0x92b7('0x2b')](respondWithResult(_0x59bbbf,null))[_0x92b7('0x4c')](handleError(_0x59bbbf,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 7a285cb..bcfaa74 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 _0x1d0d=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0x1d0d,0x8e));var _0xd1d0=function(_0x3efb62,_0x521e4b){_0x3efb62=_0x3efb62-0x0;var _0x852069=_0x1d0d[_0x3efb62];return _0x852069;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xd1d0('0x0'))['db'][_0xd1d0('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd1d0('0x2'),'afterUpdate':_0xd1d0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x48be5c){return function(_0x2d96e8,_0x5f51da,_0x3f2b95){ChatInternalMessageEvents['emit'](_0x48be5c+':'+_0x2d96e8['id'],_0x2d96e8);ChatInternalMessageEvents[_0xd1d0('0x4')](_0x48be5c,_0x2d96e8);_0x3f2b95(null);};}for(var e in events){if(events[_0xd1d0('0x5')](e)){var event=events[e];ChatInternalMessage[_0xd1d0('0x6')](e,emitEvent(event));}}module[_0xd1d0('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xcb03=['emit','hasOwnProperty','hook','setMaxListeners'];(function(_0x6d405,_0x1f6174){var _0x5ea766=function(_0xe819b9){while(--_0xe819b9){_0x6d405['push'](_0x6d405['shift']());}};_0x5ea766(++_0x1f6174);}(_0xcb03,0x19f));var _0x3cb0=function(_0x198c6b,_0x49edab){_0x198c6b=_0x198c6b-0x0;var _0xcd8e32=_0xcb03[_0x198c6b];return _0xcd8e32;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3cb0('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1e4d75){return function(_0x572b9b,_0x172d31,_0x568f8a){ChatInternalMessageEvents[_0x3cb0('0x1')](_0x1e4d75+':'+_0x572b9b['id'],_0x572b9b);ChatInternalMessageEvents[_0x3cb0('0x1')](_0x1e4d75,_0x572b9b);_0x568f8a(null);};}for(var e in events){if(events[_0x3cb0('0x2')](e)){var event=events[e];ChatInternalMessage[_0x3cb0('0x3')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 1bf0c30..c25fbd5 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 _0x8a88=['../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x8a88,0x124));var _0x88a8=function(_0x366378,_0x33a2fa){_0x366378=_0x366378-0x0;var _0x19bbf0=_0x8a88[_0x366378];return _0x19bbf0;};'use strict';var _=require(_0x88a8('0x0'));var util=require(_0x88a8('0x1'));var logger=require('../../config/logger')(_0x88a8('0x2'));var moment=require('moment');var BPromise=require(_0x88a8('0x3'));var rp=require(_0x88a8('0x4'));var fs=require('fs');var path=require(_0x88a8('0x5'));var rimraf=require(_0x88a8('0x6'));var config=require(_0x88a8('0x7'));var attributes=require(_0x88a8('0x8'));module[_0x88a8('0x9')]=function(_0x541cd8,_0x251c77){return _0x541cd8['define'](_0x88a8('0xa'),attributes,{'tableName':_0x88a8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x88a8('0xc')});}; \ No newline at end of file +var _0xc3fb=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0xc3fb,0x81));var _0xbc3f=function(_0x53e924,_0x35643e){_0x53e924=_0x53e924-0x0;var _0x1864ef=_0xc3fb[_0x53e924];return _0x1864ef;};'use strict';var _=require(_0xbc3f('0x0'));var util=require(_0xbc3f('0x1'));var logger=require(_0xbc3f('0x2'))(_0xbc3f('0x3'));var moment=require(_0xbc3f('0x4'));var BPromise=require(_0xbc3f('0x5'));var rp=require(_0xbc3f('0x6'));var fs=require('fs');var path=require(_0xbc3f('0x7'));var rimraf=require(_0xbc3f('0x8'));var config=require(_0xbc3f('0x9'));var attributes=require(_0xbc3f('0xa'));module[_0xbc3f('0xb')]=function(_0xab72b0,_0x433442){return _0xab72b0[_0xbc3f('0xc')]('ChatInternalMessage',attributes,{'tableName':_0xbc3f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbc3f('0xe'),'collate':_0xbc3f('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index d75adc6..b59b34c 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 _0x054c=['ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xa2ec74,_0x3c88a6){var _0x3a0f0d=function(_0x522338){while(--_0x522338){_0xa2ec74['push'](_0xa2ec74['shift']());}};_0x3a0f0d(++_0x3c88a6);}(_0x054c,0x18a));var _0xc054=function(_0x291c46,_0x5cdf1d){_0x291c46=_0x291c46-0x0;var _0x2ca8dd=_0x054c[_0x291c46];return _0x2ca8dd;};'use strict';var _=require(_0xc054('0x0'));var util=require(_0xc054('0x1'));var moment=require(_0xc054('0x2'));var BPromise=require(_0xc054('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc054('0x4'));var db=require(_0xc054('0x5'))['db'];var utils=require(_0xc054('0x6'));var logger=require('../../config/logger')(_0xc054('0x7'));var config=require(_0xc054('0x8'));var jayson=require(_0xc054('0x9'));var client=jayson['client'][_0xc054('0xa')]({'port':0x232a});config[_0xc054('0xb')]=_[_0xc054('0xc')](config['redis'],{'host':_0xc054('0xd'),'port':0x18eb});var socket=require(_0xc054('0xe'))(new Redis(config[_0xc054('0xb')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x49eebf,_0x4125cb,_0x4673c9){return new BPromise(function(_0x2ad433,_0x24c88f){return client[_0xc054('0xf')](_0x49eebf,_0x4673c9)[_0xc054('0x10')](function(_0x318111){logger[_0xc054('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x4125cb,'request\x20sent');logger[_0xc054('0x12')](_0xc054('0x13'),_0x4125cb,'request\x20sent',JSON[_0xc054('0x14')](_0x318111));if(_0x318111['error']){if(_0x318111['error']['code']===0x1f4){logger[_0xc054('0x15')](_0xc054('0x16'),_0x4125cb,_0x318111[_0xc054('0x15')]['message']);return _0x24c88f(_0x318111[_0xc054('0x15')]['message']);}logger['error'](_0xc054('0x16'),_0x4125cb,_0x318111[_0xc054('0x15')][_0xc054('0x17')]);return _0x2ad433(_0x318111[_0xc054('0x15')][_0xc054('0x17')]);}else{logger[_0xc054('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x4125cb,'request\x20sent');_0x2ad433(_0x318111[_0xc054('0x18')][_0xc054('0x17')]);}})[_0xc054('0x19')](function(_0x1f8ff8){logger[_0xc054('0x15')](_0xc054('0x16'),_0x4125cb,_0x1f8ff8);_0x24c88f(_0x1f8ff8);});});} \ No newline at end of file +var _0x731d=['jayson/promise','client','http','redis','localhost','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x20b2f2,_0x49ce53){var _0x16d50c=function(_0x129667){while(--_0x129667){_0x20b2f2['push'](_0x20b2f2['shift']());}};_0x16d50c(++_0x49ce53);}(_0x731d,0x123));var _0xd731=function(_0x1887a0,_0x3ffe57){_0x1887a0=_0x1887a0-0x0;var _0x5d31e4=_0x731d[_0x1887a0];return _0x5d31e4;};'use strict';var _=require(_0xd731('0x0'));var util=require(_0xd731('0x1'));var moment=require('moment');var BPromise=require(_0xd731('0x2'));var rs=require(_0xd731('0x3'));var fs=require('fs');var Redis=require(_0xd731('0x4'));var db=require(_0xd731('0x5'))['db'];var utils=require(_0xd731('0x6'));var logger=require(_0xd731('0x7'))('rpc');var config=require(_0xd731('0x8'));var jayson=require(_0xd731('0x9'));var client=jayson[_0xd731('0xa')][_0xd731('0xb')]({'port':0x232a});config[_0xd731('0xc')]=_['defaults'](config[_0xd731('0xc')],{'host':_0xd731('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd731('0xc')]));require(_0xd731('0xe'))[_0xd731('0xf')](socket);function respondWithRpcPromise(_0x56eb9b,_0x3c115f,_0x5c288b){return new BPromise(function(_0x2908c4,_0x3cba6e){return client[_0xd731('0x10')](_0x56eb9b,_0x5c288b)[_0xd731('0x11')](function(_0x5ce05d){logger[_0xd731('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x3c115f,_0xd731('0x13'));logger[_0xd731('0x14')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x3c115f,_0xd731('0x13'),JSON['stringify'](_0x5ce05d));if(_0x5ce05d['error']){if(_0x5ce05d['error']['code']===0x1f4){logger['error'](_0xd731('0x15'),_0x3c115f,_0x5ce05d[_0xd731('0x16')]['message']);return _0x3cba6e(_0x5ce05d['error'][_0xd731('0x17')]);}logger[_0xd731('0x16')](_0xd731('0x15'),_0x3c115f,_0x5ce05d['error'][_0xd731('0x17')]);return _0x2908c4(_0x5ce05d[_0xd731('0x16')]['message']);}else{logger['info'](_0xd731('0x15'),_0x3c115f,'request\x20sent');_0x2908c4(_0x5ce05d['result']['message']);}})[_0xd731('0x18')](function(_0x5c3716){logger[_0xd731('0x16')](_0xd731('0x15'),_0x3c115f,_0x5c3716);_0x3cba6e(_0x5c3716);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 88d4afe..f90b1db 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 _0x17a2=['update','emit','removeListener','register','length','./chatInternalMessage.events','save','remove'];(function(_0x803ae0,_0x5c5f30){var _0x3c38b1=function(_0x59b091){while(--_0x59b091){_0x803ae0['push'](_0x803ae0['shift']());}};_0x3c38b1(++_0x5c5f30);}(_0x17a2,0xed));var _0x217a=function(_0x34a516,_0x22e448){_0x34a516=_0x34a516-0x0;var _0x4f51cf=_0x17a2[_0x34a516];return _0x4f51cf;};'use strict';var ChatInternalMessageEvents=require(_0x217a('0x0'));var events=[_0x217a('0x1'),_0x217a('0x2'),_0x217a('0x3')];function createListener(_0x1751f6,_0x390fbe){return function(_0x30deaa){_0x390fbe[_0x217a('0x4')](_0x1751f6,_0x30deaa);};}function removeListener(_0x321640,_0x37f8a8){return function(){ChatInternalMessageEvents[_0x217a('0x5')](_0x321640,_0x37f8a8);};}exports[_0x217a('0x6')]=function(_0x50c377){for(var _0x4daece=0x0,_0x38acee=events[_0x217a('0x7')];_0x4daece<_0x38acee;_0x4daece++){var _0x99f011=events[_0x4daece];var _0x126776=createListener('chatInternalMessage:'+_0x99f011,_0x50c377);ChatInternalMessageEvents['on'](_0x99f011,_0x126776);}}; \ No newline at end of file +var _0x7d80=['./chatInternalMessage.events','remove','emit','register','length'];(function(_0x2a0300,_0x1510a2){var _0x279524=function(_0x46ff81){while(--_0x46ff81){_0x2a0300['push'](_0x2a0300['shift']());}};_0x279524(++_0x1510a2);}(_0x7d80,0x186));var _0x07d8=function(_0x2ca7a3,_0x4d908d){_0x2ca7a3=_0x2ca7a3-0x0;var _0x318cb2=_0x7d80[_0x2ca7a3];return _0x318cb2;};'use strict';var ChatInternalMessageEvents=require(_0x07d8('0x0'));var events=['save',_0x07d8('0x1'),'update'];function createListener(_0xc14632,_0x46b35b){return function(_0x385460){_0x46b35b[_0x07d8('0x2')](_0xc14632,_0x385460);};}function removeListener(_0x7c2e60,_0x41961e){return function(){ChatInternalMessageEvents['removeListener'](_0x7c2e60,_0x41961e);};}exports[_0x07d8('0x3')]=function(_0x13ff9a){for(var _0x5f5d6e=0x0,_0x4b2608=events[_0x07d8('0x4')];_0x5f5d6e<_0x4b2608;_0x5f5d6e++){var _0x5c2f29=events[_0x5f5d6e];var _0x3203d2=createListener('chatInternalMessage:'+_0x5c2f29,_0x13ff9a);ChatInternalMessageEvents['on'](_0x5c2f29,_0x3203d2);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 100e3e8..a4883b8 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 _0xad71=['../../config/environment','get','/describe','isAuthenticated','describe','getUsers','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xad71,0x13b));var _0x1ad7=function(_0x3c614c,_0x31142b){_0x3c614c=_0x3c614c-0x0;var _0x4e4ac6=_0xad71[_0x3c614c];return _0x4e4ac6;};'use strict';var multer=require(_0x1ad7('0x0'));var util=require(_0x1ad7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1ad7('0x2'));var router=express[_0x1ad7('0x3')]();var fs_extra=require(_0x1ad7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1ad7('0x5'));var controller=require('./chatInternalMessage.controller');router[_0x1ad7('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1ad7('0x6')](_0x1ad7('0x7'),auth[_0x1ad7('0x8')](),controller[_0x1ad7('0x9')]);router[_0x1ad7('0x6')]('/users',auth[_0x1ad7('0x8')](),controller[_0x1ad7('0xa')]);router['get'](_0x1ad7('0xb'),auth[_0x1ad7('0x8')](),controller[_0x1ad7('0xc')]);router[_0x1ad7('0xd')]('/',auth[_0x1ad7('0x8')](),controller[_0x1ad7('0xe')]);router[_0x1ad7('0xf')]('/:id',controller[_0x1ad7('0x10')]);router[_0x1ad7('0x11')](_0x1ad7('0xb'),auth[_0x1ad7('0x8')](),controller[_0x1ad7('0x12')]);module[_0x1ad7('0x13')]=router; \ No newline at end of file +var _0xdf52=['update','delete','/:id','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','getUsers','post','create'];(function(_0x30fbbd,_0x4156e7){var _0xf62d43=function(_0x13af44){while(--_0x13af44){_0x30fbbd['push'](_0x30fbbd['shift']());}};_0xf62d43(++_0x4156e7);}(_0xdf52,0x8b));var _0x2df5=function(_0x2f9c35,_0x15abfc){_0x2f9c35=_0x2f9c35-0x0;var _0x1129e1=_0xdf52[_0x2f9c35];return _0x1129e1;};'use strict';var multer=require(_0x2df5('0x0'));var util=require(_0x2df5('0x1'));var path=require('path');var timeout=require(_0x2df5('0x2'));var express=require(_0x2df5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2df5('0x4'));var config=require(_0x2df5('0x5'));var controller=require(_0x2df5('0x6'));router[_0x2df5('0x7')]('/',auth[_0x2df5('0x8')](),controller['index']);router[_0x2df5('0x7')](_0x2df5('0x9'),auth[_0x2df5('0x8')](),controller[_0x2df5('0xa')]);router['get']('/users',auth[_0x2df5('0x8')](),controller[_0x2df5('0xb')]);router['get']('/:id',auth[_0x2df5('0x8')](),controller['show']);router[_0x2df5('0xc')]('/',auth[_0x2df5('0x8')](),controller[_0x2df5('0xd')]);router['put']('/:id',controller[_0x2df5('0xe')]);router[_0x2df5('0xf')](_0x2df5('0x10'),auth[_0x2df5('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index aa649c9..9749502 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 _0x55f1=['TEXT','medium','BOOLEAN','ENUM','out','sequelize'];(function(_0x5ad73a,_0x1d0198){var _0xbd4e1b=function(_0x512569){while(--_0x512569){_0x5ad73a['push'](_0x5ad73a['shift']());}};_0xbd4e1b(++_0x1d0198);}(_0x55f1,0x9b));var _0x155f=function(_0xfa2c1a,_0x2f87da){_0xfa2c1a=_0xfa2c1a-0x0;var _0x51778d=_0x55f1[_0xfa2c1a];return _0x51778d;};'use strict';var Sequelize=require(_0x155f('0x0'));module['exports']={'body':{'type':Sequelize[_0x155f('0x1')](_0x155f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x155f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x155f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x155f('0x4')]('in',_0x155f('0x5')),'defaultValue':_0x155f('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x155f('0x1')]}}; \ No newline at end of file +var _0xf4f4=['out','DATE','TEXT','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x23f7d9,_0x2977e8){var _0x546070=function(_0x592614){while(--_0x592614){_0x23f7d9['push'](_0x23f7d9['shift']());}};_0x546070(++_0x2977e8);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x3db639,_0x59d613){_0x3db639=_0x3db639-0x0;var _0x337446=_0xf4f4[_0x3db639];return _0x337446;};'use strict';var Sequelize=require(_0x4f4f('0x0'));module[_0x4f4f('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4f4f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4f4f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4f4f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4f4f('0x4')]('in',_0x4f4f('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x4f4f('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4f4f('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 589f733..8fc6762 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 _0xcbb3=['Sequelize','QueryTypes','SELECT','User','fullname','email','internal','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','motionChannel','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','fieldName','type','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','ChatMessage','findAll','rows','show','params','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize'];(function(_0x5c4cc8,_0x1c13a6){var _0x55e246=function(_0x2606b1){while(--_0x2606b1){_0x5c4cc8['push'](_0x5c4cc8['shift']());}};_0x55e246(++_0x1c13a6);}(_0xcbb3,0x1b1));var _0x3cbb=function(_0x5b57a6,_0x3164dc){_0x5b57a6=_0x5b57a6-0x0;var _0x180bd9=_0xcbb3[_0x5b57a6];return _0x180bd9;};'use strict';var emlformat=require(_0x3cbb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3cbb('0x1'));var jsonpatch=require(_0x3cbb('0x2'));var rp=require(_0x3cbb('0x3'));var moment=require(_0x3cbb('0x4'));var BPromise=require(_0x3cbb('0x5'));var Mustache=require(_0x3cbb('0x6'));var util=require(_0x3cbb('0x7'));var path=require(_0x3cbb('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3cbb('0x9'));var fs=require('fs');var fs_extra=require(_0x3cbb('0xa'));var _=require('lodash');var squel=require(_0x3cbb('0xb'));var crypto=require('crypto');var jsforce=require(_0x3cbb('0xc'));var deskjs=require(_0x3cbb('0xd'));var toCsv=require(_0x3cbb('0xe'));var querystring=require('querystring');var Papa=require(_0x3cbb('0xf'));var Redis=require(_0x3cbb('0x10'));var authService=require(_0x3cbb('0x11'));var qs=require(_0x3cbb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3cbb('0x13'));var logger=require(_0x3cbb('0x14'))(_0x3cbb('0x15'));var utils=require(_0x3cbb('0x16'));var config=require(_0x3cbb('0x17'));var licenseUtil=require(_0x3cbb('0x18'));var db=require('../../mysqldb')['db'];config[_0x3cbb('0x19')]=_[_0x3cbb('0x1a')](config[_0x3cbb('0x19')],{'host':_0x3cbb('0x1b'),'port':0x18eb});var socket=require(_0x3cbb('0x1c'))(new Redis(config[_0x3cbb('0x19')]));require(_0x3cbb('0x1d'))[_0x3cbb('0x1e')](socket);var jayson=require(_0x3cbb('0x1f'));var client=jayson[_0x3cbb('0x20')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc19917,_0x546a9a,_0x23a4f0,_0x492d3c){return new BPromise(function(_0xd2329,_0x9f28f0){var _0x5c7d29=_0x492d3c||client;return _0x5c7d29[_0x3cbb('0x21')](_0xc19917,_0x23a4f0)[_0x3cbb('0x22')](function(_0x4291bf){logger[_0x3cbb('0x23')](_0x3cbb('0x24'),_0x546a9a,_0x3cbb('0x25'));logger[_0x3cbb('0x26')](_0x3cbb('0x27'),_0x546a9a,_0x3cbb('0x25'),JSON['stringify'](_0x4291bf));if(_0x4291bf[_0x3cbb('0x28')]){if(_0x4291bf[_0x3cbb('0x28')]['code']===0x1f4){logger[_0x3cbb('0x28')](_0x3cbb('0x24'),_0x546a9a,_0x4291bf[_0x3cbb('0x28')][_0x3cbb('0x29')]);return _0x9f28f0(_0x4291bf[_0x3cbb('0x28')][_0x3cbb('0x29')]);}logger[_0x3cbb('0x28')](_0x3cbb('0x24'),_0x546a9a,_0x4291bf[_0x3cbb('0x28')][_0x3cbb('0x29')]);return _0xd2329(_0x4291bf['error']['message']);}else{logger['info'](_0x3cbb('0x24'),_0x546a9a,_0x3cbb('0x25'));_0xd2329(_0x4291bf[_0x3cbb('0x2a')][_0x3cbb('0x29')]);}})[_0x3cbb('0x2b')](function(_0x4cb967){logger[_0x3cbb('0x28')](_0x3cbb('0x24'),_0x546a9a,_0x4cb967);_0x9f28f0(_0x4cb967);});});}function respondWithStatusCode(_0x5c78a0,_0x19f9c6){_0x19f9c6=_0x19f9c6||0xcc;return function(_0x4a4943){if(_0x4a4943){return _0x5c78a0['sendStatus'](_0x19f9c6);}return _0x5c78a0['status'](_0x19f9c6)[_0x3cbb('0x2c')]();};}function respondWithResult(_0x1c3df9,_0x49b1c0){_0x49b1c0=_0x49b1c0||0xc8;return function(_0x56efc0){if(_0x56efc0){return _0x1c3df9[_0x3cbb('0x2d')](_0x49b1c0)[_0x3cbb('0x2e')](_0x56efc0);}};}function respondWithFilteredResult(_0x3e2343,_0x5f96e1){return function(_0x5de2a6){if(_0x5de2a6){var _0x432fe8=typeof _0x5f96e1[_0x3cbb('0x2f')]===_0x3cbb('0x30')&&typeof _0x5f96e1[_0x3cbb('0x31')]==='undefined';var _0x22b8e5=_0x5de2a6[_0x3cbb('0x32')];var _0x2a383c=_0x432fe8?0x0:_0x5f96e1[_0x3cbb('0x2f')];var _0x1f68c7=_0x432fe8?_0x5de2a6[_0x3cbb('0x32')]:_0x5f96e1[_0x3cbb('0x2f')]+_0x5f96e1['limit'];var _0x1525dc;if(_0x1f68c7>=_0x22b8e5){_0x1f68c7=_0x22b8e5;_0x1525dc=0xc8;}else{_0x1525dc=0xce;}_0x3e2343[_0x3cbb('0x2d')](_0x1525dc);return _0x3e2343[_0x3cbb('0x33')]('Content-Range',_0x2a383c+'-'+_0x1f68c7+'/'+_0x22b8e5)[_0x3cbb('0x2e')](_0x5de2a6);}return null;};}function patchUpdates(_0x387517){return function(_0x1e36dd){try{jsonpatch[_0x3cbb('0x34')](_0x1e36dd,_0x387517,!![]);}catch(_0x388910){return BPromise[_0x3cbb('0x35')](_0x388910);}return _0x1e36dd[_0x3cbb('0x36')]();};}function saveUpdates(_0x1c9432,_0x20b380){return function(_0x4590db){if(_0x4590db){return _0x4590db[_0x3cbb('0x37')](_0x1c9432)[_0x3cbb('0x22')](function(_0x1d57ac){return _0x1d57ac;});}return null;};}function removeEntity(_0x1f7727,_0x4abd7c){return function(_0x3daae7){if(_0x3daae7){return _0x3daae7[_0x3cbb('0x38')]()[_0x3cbb('0x22')](function(){_0x1f7727['status'](0xcc)[_0x3cbb('0x2c')]();});}};}function handleEntityNotFound(_0x1e172e,_0x2015c5){return function(_0x29d556){if(!_0x29d556){_0x1e172e[_0x3cbb('0x39')](0x194);}return _0x29d556;};}function handleError(_0x12f59e,_0x15b0d0){_0x15b0d0=_0x15b0d0||0x1f4;return function(_0x4910b5){logger[_0x3cbb('0x28')](_0x4910b5[_0x3cbb('0x3a')]);if(_0x4910b5[_0x3cbb('0x3b')]){delete _0x4910b5[_0x3cbb('0x3b')];}_0x12f59e['status'](_0x15b0d0)['send'](_0x4910b5);};}exports[_0x3cbb('0x3c')]=function(_0x34f92a,_0x4141db){var _0x1a3f17={},_0x2185da={},_0x53958c={'count':0x0,'rows':[]};var _0x64fb48=_[_0x3cbb('0x3d')](db['ChatMessage']['rawAttributes'],function(_0x4bd19e){return{'name':_0x4bd19e[_0x3cbb('0x3e')],'type':_0x4bd19e[_0x3cbb('0x3f')]['key']};});_0x2185da[_0x3cbb('0x40')]=_[_0x3cbb('0x3d')](_0x64fb48,_0x3cbb('0x3b'));_0x2185da['query']=_[_0x3cbb('0x41')](_0x34f92a['query']);_0x2185da['filters']=_[_0x3cbb('0x42')](_0x2185da['model'],_0x2185da[_0x3cbb('0x43')]);_0x1a3f17[_0x3cbb('0x44')]=_[_0x3cbb('0x42')](_0x2185da[_0x3cbb('0x40')],qs[_0x3cbb('0x45')](_0x34f92a[_0x3cbb('0x43')][_0x3cbb('0x45')]));_0x1a3f17[_0x3cbb('0x44')]=_0x1a3f17[_0x3cbb('0x44')][_0x3cbb('0x46')]?_0x1a3f17[_0x3cbb('0x44')]:_0x2185da['model'];if(!_0x34f92a[_0x3cbb('0x43')][_0x3cbb('0x47')](_0x3cbb('0x48'))){_0x1a3f17[_0x3cbb('0x31')]=qs[_0x3cbb('0x31')](_0x34f92a[_0x3cbb('0x43')][_0x3cbb('0x31')]);_0x1a3f17['offset']=qs[_0x3cbb('0x2f')](_0x34f92a[_0x3cbb('0x43')][_0x3cbb('0x2f')]);}_0x1a3f17[_0x3cbb('0x49')]=qs[_0x3cbb('0x4a')](_0x34f92a[_0x3cbb('0x43')][_0x3cbb('0x4a')]);_0x1a3f17[_0x3cbb('0x4b')]=qs[_0x3cbb('0x4c')](_[_0x3cbb('0x4d')](_0x34f92a['query'],_0x2185da['filters']),_0x64fb48);if(_0x34f92a[_0x3cbb('0x43')][_0x3cbb('0x4e')]){_0x1a3f17[_0x3cbb('0x4b')]=_[_0x3cbb('0x4f')](_0x1a3f17[_0x3cbb('0x4b')],{'$or':_[_0x3cbb('0x3d')](_0x64fb48,function(_0x25e4b0){if(_0x25e4b0[_0x3cbb('0x3f')]!=='VIRTUAL'){var _0x2dd254={};_0x2dd254[_0x25e4b0[_0x3cbb('0x3b')]]={'$like':'%'+_0x34f92a[_0x3cbb('0x43')][_0x3cbb('0x4e')]+'%'};return _0x2dd254;}})});}_0x1a3f17=_[_0x3cbb('0x4f')]({},_0x1a3f17,_0x34f92a[_0x3cbb('0x50')]);var _0x2e55cd={'where':_0x1a3f17[_0x3cbb('0x4b')]};return db['ChatMessage'][_0x3cbb('0x32')](_0x2e55cd)[_0x3cbb('0x22')](function(_0x2ced13){_0x53958c['count']=_0x2ced13;if(_0x34f92a[_0x3cbb('0x43')][_0x3cbb('0x51')]){_0x1a3f17[_0x3cbb('0x52')]=[{'all':!![]}];}return db[_0x3cbb('0x53')][_0x3cbb('0x54')](_0x1a3f17);})[_0x3cbb('0x22')](function(_0x45cac1){_0x53958c[_0x3cbb('0x55')]=_0x45cac1;return _0x53958c;})[_0x3cbb('0x22')](respondWithFilteredResult(_0x4141db,_0x1a3f17))['catch'](handleError(_0x4141db,null));};exports[_0x3cbb('0x56')]=function(_0x3cfb2e,_0x5b6134){var _0x495af8={'raw':!![],'where':{'id':_0x3cfb2e[_0x3cbb('0x57')]['id']}},_0x1ee9da={};_0x1ee9da[_0x3cbb('0x40')]=_[_0x3cbb('0x41')](db['ChatMessage']['rawAttributes']);_0x1ee9da[_0x3cbb('0x43')]=_[_0x3cbb('0x41')](_0x3cfb2e[_0x3cbb('0x43')]);_0x1ee9da[_0x3cbb('0x4c')]=_[_0x3cbb('0x42')](_0x1ee9da[_0x3cbb('0x40')],_0x1ee9da[_0x3cbb('0x43')]);_0x495af8['attributes']=_[_0x3cbb('0x42')](_0x1ee9da[_0x3cbb('0x40')],qs[_0x3cbb('0x45')](_0x3cfb2e[_0x3cbb('0x43')][_0x3cbb('0x45')]));_0x495af8[_0x3cbb('0x44')]=_0x495af8[_0x3cbb('0x44')][_0x3cbb('0x46')]?_0x495af8[_0x3cbb('0x44')]:_0x1ee9da[_0x3cbb('0x40')];if(_0x3cfb2e[_0x3cbb('0x43')][_0x3cbb('0x51')]){_0x495af8['include']=[{'all':!![]}];}_0x495af8=_[_0x3cbb('0x4f')]({},_0x495af8,_0x3cfb2e[_0x3cbb('0x50')]);return db[_0x3cbb('0x53')][_0x3cbb('0x58')](_0x495af8)[_0x3cbb('0x22')](handleEntityNotFound(_0x5b6134,null))[_0x3cbb('0x22')](respondWithResult(_0x5b6134,null))[_0x3cbb('0x2b')](handleError(_0x5b6134,null));};exports['create']=function(_0x12c7eb,_0x54d827){return db['ChatMessage'][_0x3cbb('0x59')](_0x12c7eb[_0x3cbb('0x5a')],{})[_0x3cbb('0x22')](respondWithResult(_0x54d827,0xc9))[_0x3cbb('0x2b')](handleError(_0x54d827,null));};exports[_0x3cbb('0x37')]=function(_0x129df9,_0x52d722){if(_0x129df9[_0x3cbb('0x5a')]['id']){delete _0x129df9[_0x3cbb('0x5a')]['id'];}return db[_0x3cbb('0x53')]['find']({'where':{'id':_0x129df9[_0x3cbb('0x57')]['id']}})['then'](handleEntityNotFound(_0x52d722,null))[_0x3cbb('0x22')](saveUpdates(_0x129df9[_0x3cbb('0x5a')],null))[_0x3cbb('0x22')](respondWithResult(_0x52d722,null))[_0x3cbb('0x2b')](handleError(_0x52d722,null));};exports[_0x3cbb('0x38')]=function(_0x4b4529,_0x2cf62d){return db[_0x3cbb('0x53')]['find']({'where':{'id':_0x4b4529['params']['id']}})[_0x3cbb('0x22')](handleEntityNotFound(_0x2cf62d,null))[_0x3cbb('0x22')](removeEntity(_0x2cf62d,null))[_0x3cbb('0x2b')](handleError(_0x2cf62d,null));};exports[_0x3cbb('0x5b')]=function(_0x28d7f0,_0x4fc6e6){return db[_0x3cbb('0x53')][_0x3cbb('0x5b')]()['then'](respondWithResult(_0x4fc6e6,null))[_0x3cbb('0x2b')](handleError(_0x4fc6e6,null));};var interaction_log=require('../../config/logger')(_0x3cbb('0x5c'));exports[_0x3cbb('0x5d')]=function(_0x349b41,_0x4bdbbe,_0x27addc){var _0x1a3568={'agent':{},'channel':_0x3cbb('0x5e')};if(_0x349b41[_0x3cbb('0x5a')]['id']){delete _0x349b41[_0x3cbb('0x5a')]['id'];}_0x349b41[_0x3cbb('0x5a')][_0x3cbb('0x5f')]=!![];_0x349b41[_0x3cbb('0x5a')][_0x3cbb('0x60')]=moment()[_0x3cbb('0x61')](_0x3cbb('0x62'));_0x349b41[_0x3cbb('0x5a')][_0x3cbb('0x63')]=_0x349b41[_0x3cbb('0x5a')]['UserId']||_0x349b41[_0x3cbb('0x64')]['id'];_0x1a3568[_0x3cbb('0x65')]['id']=_0x349b41[_0x3cbb('0x5a')]['UserId'];return db['ChatMessage']['find']({'where':{'id':_0x349b41[_0x3cbb('0x57')]['id'],'UserId':null}})[_0x3cbb('0x22')](handleEntityNotFound(_0x4bdbbe,null))[_0x3cbb('0x22')](saveUpdates(_0x349b41[_0x3cbb('0x5a')],null))[_0x3cbb('0x22')](function(_0x4b8d7c){if(_0x4b8d7c){_0x1a3568[_0x3cbb('0x29')]=_0x4b8d7c[_0x3cbb('0x66')]({'plain':!![]});return db[_0x3cbb('0x67')][_0x3cbb('0x58')]({'where':{'id':_0x4b8d7c[_0x3cbb('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x4bdbbe,null))[_0x3cbb('0x22')](function(_0x1d0c80){if(_0x1d0c80){return _0x1d0c80[_0x3cbb('0x37')]({'UserId':_0x349b41[_0x3cbb('0x5a')][_0x3cbb('0x63')],'read1stAt':_[_0x3cbb('0x69')](_0x1d0c80[_0x3cbb('0x6a')])?moment()[_0x3cbb('0x61')](_0x3cbb('0x62')):undefined});}return null;})[_0x3cbb('0x22')](function(_0x266b51){if(_0x266b51){_0x1a3568[_0x3cbb('0x6b')]=_0x266b51[_0x3cbb('0x66')]({'plain':!![]});interaction_log[_0x3cbb('0x23')](_0x3cbb('0x6c'),_0x349b41[_0x3cbb('0x64')]['id'],_0x349b41[_0x3cbb('0x64')][_0x3cbb('0x3b')],_0x349b41[_0x3cbb('0x64')][_0x3cbb('0x6d')],_0x1a3568[_0x3cbb('0x6b')]['id'],_0x349b41[_0x3cbb('0x5a')]?JSON[_0x3cbb('0x6e')](_0x349b41[_0x3cbb('0x5a')]):'null');return respondWithRpcPromise(_0x3cbb('0x6f'),_0x3cbb('0x70'),_0x1a3568);}return null;})[_0x3cbb('0x22')](function(_0x3e0758){var _0xa7f81=_0x3cbb('0x71')+_0x3e0758[_0x3cbb('0x29')]['ContactId'];return db[_0x3cbb('0x72')][_0x3cbb('0x43')](_0xa7f81,{'type':db[_0x3cbb('0x73')][_0x3cbb('0x74')][_0x3cbb('0x75')],'raw':!![]})[_0x3cbb('0x22')](function(_0xb3d03){return _0xb3d03;});})[_0x3cbb('0x22')](function(_0x4773b9){if(_0x4773b9){_0x1a3568[_0x3cbb('0x29')]['contact']=_0x4773b9[0x0];if(!_0x349b41[_0x3cbb('0x5a')]['UserId'])return;return db[_0x3cbb('0x76')][_0x3cbb('0x58')]({'where':{'id':_0x349b41[_0x3cbb('0x5a')][_0x3cbb('0x63')],'role':_0x3cbb('0x65')},'attributes':['id',_0x3cbb('0x3b'),_0x3cbb('0x77'),_0x3cbb('0x78'),_0x3cbb('0x79')],'raw':!![]});}return null;})[_0x3cbb('0x22')](function(_0x13acbe){if(!_0x13acbe)return null;_0x1a3568[_0x3cbb('0x29')][_0x3cbb('0x65')]=_0x13acbe;return _0x1a3568;})[_0x3cbb('0x22')](function(_0xd92604){if(_0xd92604){if(_0x349b41[_0x3cbb('0x5a')]['manual']){_0x1a3568[_0x3cbb('0x29')][_0x3cbb('0x7a')]=util[_0x3cbb('0x61')](_0x3cbb('0x7b'),_0x349b41[_0x3cbb('0x64')]['name']);_0x1a3568['message'][_0x3cbb('0x7c')]=_0x1a3568['channel'];_0x1a3568[_0x3cbb('0x29')]['motionChannel']=_0x1a3568[_0x3cbb('0x7c')];_0x1a3568[_0x3cbb('0x29')][_0x3cbb('0x7d')]=_0x3cbb('0x5d');return respondWithRpcPromise(_0x3cbb('0x7e'),_0x3cbb('0x7e'),{'event':_0x3cbb('0x7f'),'message':_['merge'](_0x1a3568[_0x3cbb('0x29')],JSON[_0x3cbb('0x80')](_0x1a3568['interaction'][_0x3cbb('0x81')]))},client9002)['then'](function(){return _0x1a3568;});}return _0x1a3568;}return null;})['then'](respondWithResult(_0x4bdbbe,null))['catch'](handleError(_0x4bdbbe,null));};var interaction_log=require(_0x3cbb('0x14'))(_0x3cbb('0x5c'));exports[_0x3cbb('0x35')]=function(_0x51ccf6,_0x1fdcc3,_0x35f757){var _0x38b382={'agent':{},'channel':_0x3cbb('0x5e')};if(_0x51ccf6[_0x3cbb('0x5a')]['id']){delete _0x51ccf6[_0x3cbb('0x5a')]['id'];}_0x51ccf6[_0x3cbb('0x5a')][_0x3cbb('0x63')]=_0x51ccf6['body']['UserId']||_0x51ccf6['user']['id'];_0x38b382[_0x3cbb('0x65')]['id']=_0x51ccf6[_0x3cbb('0x5a')][_0x3cbb('0x63')];return db[_0x3cbb('0x53')][_0x3cbb('0x58')]({'where':{'id':_0x51ccf6['params']['id'],'UserId':null}})[_0x3cbb('0x22')](handleEntityNotFound(_0x1fdcc3,null))[_0x3cbb('0x22')](function(_0x49945b){if(_0x49945b){_0x38b382['message']=_0x49945b[_0x3cbb('0x66')]({'plain':!![]});return db[_0x3cbb('0x67')][_0x3cbb('0x58')]({'where':{'id':_0x49945b['ChatInteractionId']}});}return null;})[_0x3cbb('0x22')](handleEntityNotFound(_0x1fdcc3,null))[_0x3cbb('0x22')](function(_0x94418b){if(_0x94418b){_0x38b382[_0x3cbb('0x6b')]=_0x94418b[_0x3cbb('0x66')]({'plain':!![]});interaction_log[_0x3cbb('0x23')](_0x3cbb('0x82'),_0x51ccf6['user']['id'],_0x51ccf6['user']['name'],_0x51ccf6[_0x3cbb('0x64')]['role'],_0x38b382[_0x3cbb('0x6b')]['id'],_0x51ccf6[_0x3cbb('0x5a')]?JSON[_0x3cbb('0x6e')](_0x51ccf6[_0x3cbb('0x5a')]):_0x3cbb('0x83'));return respondWithRpcPromise(_0x3cbb('0x84'),_0x3cbb('0x85'),_0x38b382);}return null;})[_0x3cbb('0x22')](function(_0x262a4d){var _0xa4f256=_0x3cbb('0x71')+_0x262a4d['message'][_0x3cbb('0x86')];return db['sequelize'][_0x3cbb('0x43')](_0xa4f256,{'type':db['Sequelize'][_0x3cbb('0x74')]['SELECT'],'raw':!![]})[_0x3cbb('0x22')](function(_0x341060){return _0x341060;});})[_0x3cbb('0x22')](function(_0x4f5863){if(_0x4f5863){_0x38b382[_0x3cbb('0x29')]['contact']=_0x4f5863[0x0];if(!_0x51ccf6[_0x3cbb('0x5a')][_0x3cbb('0x63')])return;return db[_0x3cbb('0x76')][_0x3cbb('0x58')]({'where':{'id':_0x51ccf6['body'][_0x3cbb('0x63')],'role':'agent'},'attributes':['id',_0x3cbb('0x3b'),_0x3cbb('0x77'),_0x3cbb('0x78'),_0x3cbb('0x79')],'raw':!![]});}return null;})[_0x3cbb('0x22')](function(_0x57fa8d){if(!_0x57fa8d)return null;_0x38b382[_0x3cbb('0x29')][_0x3cbb('0x65')]=_0x57fa8d;return _0x38b382;})[_0x3cbb('0x22')](function(_0x3ee14f){if(_0x3ee14f){_0x3ee14f[_0x3cbb('0x29')][_0x3cbb('0x7a')]=util[_0x3cbb('0x61')](_0x3cbb('0x7b'),_0x51ccf6[_0x3cbb('0x64')][_0x3cbb('0x3b')]);_0x3ee14f[_0x3cbb('0x29')]['channel']=_0x38b382[_0x3cbb('0x7c')];_0x3ee14f['message'][_0x3cbb('0x87')]=_0x38b382[_0x3cbb('0x7c')];_0x3ee14f[_0x3cbb('0x29')][_0x3cbb('0x7d')]=_0x3cbb('0x35');respondWithRpcPromise('EventManager',_0x3cbb('0x7e'),{'event':_0x3cbb('0x88'),'message':_['merge'](_0x38b382['message'],JSON[_0x3cbb('0x80')](_0x38b382[_0x3cbb('0x6b')][_0x3cbb('0x81')]))},client9002);return _0x38b382;}return null;})[_0x3cbb('0x22')](respondWithResult(_0x1fdcc3,null))['catch'](handleError(_0x1fdcc3,null));}; \ No newline at end of file +var _0x4d58=['name','send','index','map','ChatMessage','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create','body','params','describe','chat-interactions','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','internal','agent','manual','channel','event','accept','EventManager','acceptmessage','parse','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','QueryTypes','interface','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatMessage.socket','register','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','destroy','stack'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4d58,0xd3));var _0x84d5=function(_0x14b800,_0x522988){_0x14b800=_0x14b800-0x0;var _0xf1f84d=_0x4d58[_0x14b800];return _0xf1f84d;};'use strict';var emlformat=require(_0x84d5('0x0'));var rimraf=require(_0x84d5('0x1'));var zipdir=require(_0x84d5('0x2'));var jsonpatch=require(_0x84d5('0x3'));var rp=require(_0x84d5('0x4'));var moment=require(_0x84d5('0x5'));var BPromise=require(_0x84d5('0x6'));var Mustache=require(_0x84d5('0x7'));var util=require(_0x84d5('0x8'));var path=require(_0x84d5('0x9'));var sox=require(_0x84d5('0xa'));var csv=require(_0x84d5('0xb'));var ejs=require(_0x84d5('0xc'));var fs=require('fs');var fs_extra=require(_0x84d5('0xd'));var _=require(_0x84d5('0xe'));var squel=require(_0x84d5('0xf'));var crypto=require('crypto');var jsforce=require(_0x84d5('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x84d5('0x11'));var Papa=require(_0x84d5('0x12'));var Redis=require(_0x84d5('0x13'));var authService=require(_0x84d5('0x14'));var qs=require(_0x84d5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84d5('0x16'));var logger=require(_0x84d5('0x17'))('api');var utils=require(_0x84d5('0x18'));var config=require(_0x84d5('0x19'));var licenseUtil=require(_0x84d5('0x1a'));var db=require(_0x84d5('0x1b'))['db'];config[_0x84d5('0x1c')]=_['defaults'](config[_0x84d5('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x84d5('0x1d'))(new Redis(config[_0x84d5('0x1c')]));require(_0x84d5('0x1e'))[_0x84d5('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x84d5('0x20')][_0x84d5('0x21')]({'port':0x232c});var client9002=jayson[_0x84d5('0x20')][_0x84d5('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xaab564,_0x360b8c,_0x1544d0,_0xfd91ca){return new BPromise(function(_0x1c8bf4,_0x12253a){var _0x585d36=_0xfd91ca||client;return _0x585d36[_0x84d5('0x22')](_0xaab564,_0x1544d0)[_0x84d5('0x23')](function(_0x5dda21){logger[_0x84d5('0x24')](_0x84d5('0x25'),_0x360b8c,_0x84d5('0x26'));logger['debug'](_0x84d5('0x27'),_0x360b8c,'request\x20sent',JSON[_0x84d5('0x28')](_0x5dda21));if(_0x5dda21[_0x84d5('0x29')]){if(_0x5dda21[_0x84d5('0x29')]['code']===0x1f4){logger['error'](_0x84d5('0x25'),_0x360b8c,_0x5dda21[_0x84d5('0x29')][_0x84d5('0x2a')]);return _0x12253a(_0x5dda21['error'][_0x84d5('0x2a')]);}logger[_0x84d5('0x29')]('ChatMessage,\x20%s,\x20%s',_0x360b8c,_0x5dda21['error'][_0x84d5('0x2a')]);return _0x1c8bf4(_0x5dda21['error']['message']);}else{logger[_0x84d5('0x24')]('ChatMessage,\x20%s,\x20%s',_0x360b8c,_0x84d5('0x26'));_0x1c8bf4(_0x5dda21['result'][_0x84d5('0x2a')]);}})['catch'](function(_0x4fe5aa){logger['error'](_0x84d5('0x25'),_0x360b8c,_0x4fe5aa);_0x12253a(_0x4fe5aa);});});}function respondWithStatusCode(_0x53d8ef,_0x2daf74){_0x2daf74=_0x2daf74||0xcc;return function(_0x1d1188){if(_0x1d1188){return _0x53d8ef[_0x84d5('0x2b')](_0x2daf74);}return _0x53d8ef[_0x84d5('0x2c')](_0x2daf74)[_0x84d5('0x2d')]();};}function respondWithResult(_0xa309d3,_0x12d0e7){_0x12d0e7=_0x12d0e7||0xc8;return function(_0x14256f){if(_0x14256f){return _0xa309d3[_0x84d5('0x2c')](_0x12d0e7)[_0x84d5('0x2e')](_0x14256f);}};}function respondWithFilteredResult(_0x194e15,_0x52f74b){return function(_0x1b8634){if(_0x1b8634){var _0x5e3e6b=typeof _0x52f74b[_0x84d5('0x2f')]===_0x84d5('0x30')&&typeof _0x52f74b['limit']===_0x84d5('0x30');var _0x3978dd=_0x1b8634[_0x84d5('0x31')];var _0x1dd5cc=_0x5e3e6b?0x0:_0x52f74b[_0x84d5('0x2f')];var _0x2c6314=_0x5e3e6b?_0x1b8634['count']:_0x52f74b[_0x84d5('0x2f')]+_0x52f74b['limit'];var _0x27dc94;if(_0x2c6314>=_0x3978dd){_0x2c6314=_0x3978dd;_0x27dc94=0xc8;}else{_0x27dc94=0xce;}_0x194e15[_0x84d5('0x2c')](_0x27dc94);return _0x194e15[_0x84d5('0x32')](_0x84d5('0x33'),_0x1dd5cc+'-'+_0x2c6314+'/'+_0x3978dd)['json'](_0x1b8634);}return null;};}function patchUpdates(_0x481f2a){return function(_0x329b34){try{jsonpatch[_0x84d5('0x34')](_0x329b34,_0x481f2a,!![]);}catch(_0x3f27a4){return BPromise['reject'](_0x3f27a4);}return _0x329b34[_0x84d5('0x35')]();};}function saveUpdates(_0x3a3608,_0x3d9643){return function(_0x4c0cf5){if(_0x4c0cf5){return _0x4c0cf5[_0x84d5('0x36')](_0x3a3608)[_0x84d5('0x23')](function(_0xbd9296){return _0xbd9296;});}return null;};}function removeEntity(_0x59d916,_0x190bd9){return function(_0x21a2ef){if(_0x21a2ef){return _0x21a2ef[_0x84d5('0x37')]()['then'](function(){_0x59d916[_0x84d5('0x2c')](0xcc)[_0x84d5('0x2d')]();});}};}function handleEntityNotFound(_0x3afe2f,_0x3363ae){return function(_0x3e0b31){if(!_0x3e0b31){_0x3afe2f[_0x84d5('0x2b')](0x194);}return _0x3e0b31;};}function handleError(_0x1945e4,_0x48dabf){_0x48dabf=_0x48dabf||0x1f4;return function(_0x55112f){logger['error'](_0x55112f[_0x84d5('0x38')]);if(_0x55112f[_0x84d5('0x39')]){delete _0x55112f['name'];}_0x1945e4[_0x84d5('0x2c')](_0x48dabf)[_0x84d5('0x3a')](_0x55112f);};}exports[_0x84d5('0x3b')]=function(_0x33cbbd,_0x30b1d4){var _0x41c0ba={},_0x20b28c={},_0x4afd0b={'count':0x0,'rows':[]};var _0x59dcfd=_[_0x84d5('0x3c')](db[_0x84d5('0x3d')][_0x84d5('0x3e')],function(_0x5853d4){return{'name':_0x5853d4[_0x84d5('0x3f')],'type':_0x5853d4['type']['key']};});_0x20b28c['model']=_[_0x84d5('0x3c')](_0x59dcfd,_0x84d5('0x39'));_0x20b28c[_0x84d5('0x40')]=_[_0x84d5('0x41')](_0x33cbbd['query']);_0x20b28c[_0x84d5('0x42')]=_[_0x84d5('0x43')](_0x20b28c[_0x84d5('0x44')],_0x20b28c[_0x84d5('0x40')]);_0x41c0ba[_0x84d5('0x45')]=_[_0x84d5('0x43')](_0x20b28c[_0x84d5('0x44')],qs[_0x84d5('0x46')](_0x33cbbd[_0x84d5('0x40')][_0x84d5('0x46')]));_0x41c0ba[_0x84d5('0x45')]=_0x41c0ba['attributes']['length']?_0x41c0ba[_0x84d5('0x45')]:_0x20b28c[_0x84d5('0x44')];if(!_0x33cbbd[_0x84d5('0x40')][_0x84d5('0x47')](_0x84d5('0x48'))){_0x41c0ba[_0x84d5('0x49')]=qs[_0x84d5('0x49')](_0x33cbbd[_0x84d5('0x40')][_0x84d5('0x49')]);_0x41c0ba[_0x84d5('0x2f')]=qs[_0x84d5('0x2f')](_0x33cbbd[_0x84d5('0x40')][_0x84d5('0x2f')]);}_0x41c0ba['order']=qs[_0x84d5('0x4a')](_0x33cbbd[_0x84d5('0x40')][_0x84d5('0x4a')]);_0x41c0ba[_0x84d5('0x4b')]=qs[_0x84d5('0x42')](_[_0x84d5('0x4c')](_0x33cbbd[_0x84d5('0x40')],_0x20b28c['filters']),_0x59dcfd);if(_0x33cbbd[_0x84d5('0x40')][_0x84d5('0x4d')]){_0x41c0ba[_0x84d5('0x4b')]=_[_0x84d5('0x4e')](_0x41c0ba[_0x84d5('0x4b')],{'$or':_['map'](_0x59dcfd,function(_0x56c3e3){if(_0x56c3e3[_0x84d5('0x4f')]!==_0x84d5('0x50')){var _0x22b335={};_0x22b335[_0x56c3e3['name']]={'$like':'%'+_0x33cbbd['query'][_0x84d5('0x4d')]+'%'};return _0x22b335;}})});}_0x41c0ba=_[_0x84d5('0x4e')]({},_0x41c0ba,_0x33cbbd[_0x84d5('0x51')]);var _0x3e0cec={'where':_0x41c0ba['where']};return db[_0x84d5('0x3d')][_0x84d5('0x31')](_0x3e0cec)[_0x84d5('0x23')](function(_0x5875a7){_0x4afd0b['count']=_0x5875a7;if(_0x33cbbd[_0x84d5('0x40')][_0x84d5('0x52')]){_0x41c0ba[_0x84d5('0x53')]=[{'all':!![]}];}return db[_0x84d5('0x3d')][_0x84d5('0x54')](_0x41c0ba);})[_0x84d5('0x23')](function(_0x19d7e9){_0x4afd0b['rows']=_0x19d7e9;return _0x4afd0b;})[_0x84d5('0x23')](respondWithFilteredResult(_0x30b1d4,_0x41c0ba))[_0x84d5('0x55')](handleError(_0x30b1d4,null));};exports[_0x84d5('0x56')]=function(_0x6ee391,_0x32b159){var _0x11381f={'raw':!![],'where':{'id':_0x6ee391['params']['id']}},_0x53dfa5={};_0x53dfa5[_0x84d5('0x44')]=_[_0x84d5('0x41')](db[_0x84d5('0x3d')][_0x84d5('0x3e')]);_0x53dfa5[_0x84d5('0x40')]=_['keys'](_0x6ee391[_0x84d5('0x40')]);_0x53dfa5['filters']=_[_0x84d5('0x43')](_0x53dfa5['model'],_0x53dfa5[_0x84d5('0x40')]);_0x11381f[_0x84d5('0x45')]=_[_0x84d5('0x43')](_0x53dfa5[_0x84d5('0x44')],qs['fields'](_0x6ee391[_0x84d5('0x40')][_0x84d5('0x46')]));_0x11381f[_0x84d5('0x45')]=_0x11381f[_0x84d5('0x45')][_0x84d5('0x57')]?_0x11381f[_0x84d5('0x45')]:_0x53dfa5[_0x84d5('0x44')];if(_0x6ee391['query'][_0x84d5('0x52')]){_0x11381f[_0x84d5('0x53')]=[{'all':!![]}];}_0x11381f=_[_0x84d5('0x4e')]({},_0x11381f,_0x6ee391[_0x84d5('0x51')]);return db[_0x84d5('0x3d')][_0x84d5('0x58')](_0x11381f)['then'](handleEntityNotFound(_0x32b159,null))[_0x84d5('0x23')](respondWithResult(_0x32b159,null))['catch'](handleError(_0x32b159,null));};exports[_0x84d5('0x59')]=function(_0x40d62e,_0x2a2d1b){return db[_0x84d5('0x3d')][_0x84d5('0x59')](_0x40d62e[_0x84d5('0x5a')],{})[_0x84d5('0x23')](respondWithResult(_0x2a2d1b,0xc9))['catch'](handleError(_0x2a2d1b,null));};exports['update']=function(_0x162559,_0x3881bf){if(_0x162559[_0x84d5('0x5a')]['id']){delete _0x162559['body']['id'];}return db[_0x84d5('0x3d')][_0x84d5('0x58')]({'where':{'id':_0x162559[_0x84d5('0x5b')]['id']}})[_0x84d5('0x23')](handleEntityNotFound(_0x3881bf,null))['then'](saveUpdates(_0x162559[_0x84d5('0x5a')],null))[_0x84d5('0x23')](respondWithResult(_0x3881bf,null))[_0x84d5('0x55')](handleError(_0x3881bf,null));};exports['destroy']=function(_0x18e621,_0x4ca644){return db[_0x84d5('0x3d')][_0x84d5('0x58')]({'where':{'id':_0x18e621[_0x84d5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4ca644,null))[_0x84d5('0x23')](removeEntity(_0x4ca644,null))['catch'](handleError(_0x4ca644,null));};exports[_0x84d5('0x5c')]=function(_0x2a0375,_0x3a905f){return db[_0x84d5('0x3d')][_0x84d5('0x5c')]()[_0x84d5('0x23')](respondWithResult(_0x3a905f,null))[_0x84d5('0x55')](handleError(_0x3a905f,null));};var interaction_log=require(_0x84d5('0x17'))(_0x84d5('0x5d'));exports['accept']=function(_0x2bf115,_0x1ace16,_0x1941cf){var _0x39cb32={'agent':{},'channel':_0x84d5('0x5e')};if(_0x2bf115[_0x84d5('0x5a')]['id']){delete _0x2bf115[_0x84d5('0x5a')]['id'];}_0x2bf115[_0x84d5('0x5a')]['read']=!![];_0x2bf115[_0x84d5('0x5a')][_0x84d5('0x5f')]=moment()[_0x84d5('0x60')](_0x84d5('0x61'));_0x2bf115[_0x84d5('0x5a')][_0x84d5('0x62')]=_0x2bf115[_0x84d5('0x5a')][_0x84d5('0x62')]||_0x2bf115[_0x84d5('0x63')]['id'];_0x39cb32['agent']['id']=_0x2bf115[_0x84d5('0x5a')]['UserId'];return db[_0x84d5('0x3d')][_0x84d5('0x58')]({'where':{'id':_0x2bf115[_0x84d5('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1ace16,null))[_0x84d5('0x23')](saveUpdates(_0x2bf115['body'],null))['then'](function(_0x1c2691){if(_0x1c2691){_0x39cb32[_0x84d5('0x2a')]=_0x1c2691[_0x84d5('0x64')]({'plain':!![]});return db[_0x84d5('0x65')][_0x84d5('0x58')]({'where':{'id':_0x1c2691['ChatInteractionId']}});}return null;})[_0x84d5('0x23')](handleEntityNotFound(_0x1ace16,null))[_0x84d5('0x23')](function(_0x4b7679){if(_0x4b7679){return _0x4b7679[_0x84d5('0x36')]({'UserId':_0x2bf115[_0x84d5('0x5a')][_0x84d5('0x62')],'read1stAt':_['isNil'](_0x4b7679['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x84d5('0x23')](function(_0x455f9a){if(_0x455f9a){_0x39cb32['interaction']=_0x455f9a[_0x84d5('0x64')]({'plain':!![]});interaction_log[_0x84d5('0x24')](_0x84d5('0x66'),_0x2bf115[_0x84d5('0x63')]['id'],_0x2bf115[_0x84d5('0x63')]['name'],_0x2bf115[_0x84d5('0x63')][_0x84d5('0x67')],_0x39cb32[_0x84d5('0x68')]['id'],_0x2bf115[_0x84d5('0x5a')]?JSON[_0x84d5('0x28')](_0x2bf115[_0x84d5('0x5a')]):_0x84d5('0x69'));return respondWithRpcPromise(_0x84d5('0x6a'),'acceptMessage',_0x39cb32);}return null;})[_0x84d5('0x23')](function(_0x973795){var _0x5e1212=_0x84d5('0x6b')+_0x973795[_0x84d5('0x2a')][_0x84d5('0x6c')];return db['sequelize'][_0x84d5('0x40')](_0x5e1212,{'type':db[_0x84d5('0x6d')]['QueryTypes'][_0x84d5('0x6e')],'raw':!![]})[_0x84d5('0x23')](function(_0x21d2d9){return _0x21d2d9;});})[_0x84d5('0x23')](function(_0x5b17c2){if(_0x5b17c2){_0x39cb32[_0x84d5('0x2a')][_0x84d5('0x6f')]=_0x5b17c2[0x0];if(!_0x2bf115[_0x84d5('0x5a')][_0x84d5('0x62')])return;return db[_0x84d5('0x70')][_0x84d5('0x58')]({'where':{'id':_0x2bf115[_0x84d5('0x5a')][_0x84d5('0x62')],'role':'agent'},'attributes':['id',_0x84d5('0x39'),_0x84d5('0x71'),_0x84d5('0x72'),_0x84d5('0x73')],'raw':!![]});}return null;})['then'](function(_0x379190){if(!_0x379190)return null;_0x39cb32['message'][_0x84d5('0x74')]=_0x379190;return _0x39cb32;})[_0x84d5('0x23')](function(_0x507bee){if(_0x507bee){if(_0x2bf115['body'][_0x84d5('0x75')]){_0x39cb32['message']['interface']=util[_0x84d5('0x60')]('SIP/%s',_0x2bf115[_0x84d5('0x63')]['name']);_0x39cb32['message'][_0x84d5('0x76')]=_0x39cb32[_0x84d5('0x76')];_0x39cb32[_0x84d5('0x2a')]['motionChannel']=_0x39cb32['channel'];_0x39cb32[_0x84d5('0x2a')][_0x84d5('0x77')]=_0x84d5('0x78');return respondWithRpcPromise(_0x84d5('0x79'),'EventManager',{'event':_0x84d5('0x7a'),'message':_['merge'](_0x39cb32[_0x84d5('0x2a')],JSON[_0x84d5('0x7b')](_0x39cb32['interaction'][_0x84d5('0x7c')]))},client9002)[_0x84d5('0x23')](function(){return _0x39cb32;});}return _0x39cb32;}return null;})[_0x84d5('0x23')](respondWithResult(_0x1ace16,null))[_0x84d5('0x55')](handleError(_0x1ace16,null));};var interaction_log=require(_0x84d5('0x17'))(_0x84d5('0x5d'));exports[_0x84d5('0x7d')]=function(_0x1e9843,_0x283e96,_0x2a56d2){var _0xc515d5={'agent':{},'channel':'chat'};if(_0x1e9843[_0x84d5('0x5a')]['id']){delete _0x1e9843['body']['id'];}_0x1e9843[_0x84d5('0x5a')][_0x84d5('0x62')]=_0x1e9843[_0x84d5('0x5a')][_0x84d5('0x62')]||_0x1e9843[_0x84d5('0x63')]['id'];_0xc515d5[_0x84d5('0x74')]['id']=_0x1e9843[_0x84d5('0x5a')][_0x84d5('0x62')];return db[_0x84d5('0x3d')][_0x84d5('0x58')]({'where':{'id':_0x1e9843[_0x84d5('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x283e96,null))['then'](function(_0x48d481){if(_0x48d481){_0xc515d5['message']=_0x48d481[_0x84d5('0x64')]({'plain':!![]});return db[_0x84d5('0x65')][_0x84d5('0x58')]({'where':{'id':_0x48d481['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x283e96,null))['then'](function(_0xe22449){if(_0xe22449){_0xc515d5[_0x84d5('0x68')]=_0xe22449['get']({'plain':!![]});interaction_log[_0x84d5('0x24')](_0x84d5('0x7e'),_0x1e9843[_0x84d5('0x63')]['id'],_0x1e9843[_0x84d5('0x63')][_0x84d5('0x39')],_0x1e9843[_0x84d5('0x63')]['role'],_0xc515d5[_0x84d5('0x68')]['id'],_0x1e9843[_0x84d5('0x5a')]?JSON[_0x84d5('0x28')](_0x1e9843[_0x84d5('0x5a')]):_0x84d5('0x69'));return respondWithRpcPromise(_0x84d5('0x7f'),_0x84d5('0x80'),_0xc515d5);}return null;})[_0x84d5('0x23')](function(_0x572005){var _0x244d87=_0x84d5('0x6b')+_0x572005[_0x84d5('0x2a')][_0x84d5('0x6c')];return db[_0x84d5('0x81')][_0x84d5('0x40')](_0x244d87,{'type':db['Sequelize'][_0x84d5('0x82')][_0x84d5('0x6e')],'raw':!![]})[_0x84d5('0x23')](function(_0x15b1c0){return _0x15b1c0;});})['then'](function(_0x95416c){if(_0x95416c){_0xc515d5[_0x84d5('0x2a')][_0x84d5('0x6f')]=_0x95416c[0x0];if(!_0x1e9843['body'][_0x84d5('0x62')])return;return db[_0x84d5('0x70')][_0x84d5('0x58')]({'where':{'id':_0x1e9843['body']['UserId'],'role':_0x84d5('0x74')},'attributes':['id',_0x84d5('0x39'),_0x84d5('0x71'),_0x84d5('0x72'),_0x84d5('0x73')],'raw':!![]});}return null;})[_0x84d5('0x23')](function(_0x536fbb){if(!_0x536fbb)return null;_0xc515d5['message'][_0x84d5('0x74')]=_0x536fbb;return _0xc515d5;})[_0x84d5('0x23')](function(_0x16dacd){if(_0x16dacd){_0x16dacd[_0x84d5('0x2a')][_0x84d5('0x83')]=util[_0x84d5('0x60')](_0x84d5('0x84'),_0x1e9843[_0x84d5('0x63')][_0x84d5('0x39')]);_0x16dacd[_0x84d5('0x2a')][_0x84d5('0x76')]=_0xc515d5[_0x84d5('0x76')];_0x16dacd[_0x84d5('0x2a')]['motionChannel']=_0xc515d5[_0x84d5('0x76')];_0x16dacd[_0x84d5('0x2a')][_0x84d5('0x77')]='reject';respondWithRpcPromise(_0x84d5('0x79'),'EventManager',{'event':_0x84d5('0x85'),'message':_['merge'](_0xc515d5[_0x84d5('0x2a')],JSON[_0x84d5('0x7b')](_0xc515d5[_0x84d5('0x68')]['formData']))},client9002);return _0xc515d5;}return null;})[_0x84d5('0x23')](respondWithResult(_0x283e96,null))['catch'](handleError(_0x283e96,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 559d1d5..c5c1ed7 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 _0x8eb4=['save','emit','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x2f47f1,_0x17f6a7){var _0x1e2329=function(_0x8f5900){while(--_0x8f5900){_0x2f47f1['push'](_0x2f47f1['shift']());}};_0x1e2329(++_0x17f6a7);}(_0x8eb4,0x1bc));var _0x48eb=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x8eb4[_0x21aec3];return _0x288bbc;};'use strict';var EventEmitter=require(_0x48eb('0x0'));var ChatMessage=require(_0x48eb('0x1'))['db'][_0x48eb('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x48eb('0x3')](0x0);var events={'afterCreate':_0x48eb('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x555680){return function(_0x19dd06,_0x36a80d,_0x2693be){ChatMessageEvents['emit'](_0x555680+':'+_0x19dd06['id'],_0x19dd06);ChatMessageEvents[_0x48eb('0x5')](_0x555680,_0x19dd06);_0x2693be(null);};}for(var e in events){if(events[_0x48eb('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x48eb('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x4508=['update','remove','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x386525,_0xefae6){var _0x14d015=function(_0x4a45c1){while(--_0x4a45c1){_0x386525['push'](_0x386525['shift']());}};_0x14d015(++_0xefae6);}(_0x4508,0x1bb));var _0x8450=function(_0x265e12,_0x3fd9ff){_0x265e12=_0x265e12-0x0;var _0x54ae44=_0x4508[_0x265e12];return _0x54ae44;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x8450('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8450('0x1'),'afterDestroy':_0x8450('0x2')};function emitEvent(_0x23e5db){return function(_0x1cb0fc,_0x2c1c5a,_0x4fec01){ChatMessageEvents['emit'](_0x23e5db+':'+_0x1cb0fc['id'],_0x1cb0fc);ChatMessageEvents['emit'](_0x23e5db,_0x1cb0fc);_0x4fec01(null);};}for(var e in events){if(events[_0x8450('0x3')](e)){var event=events[e];ChatMessage[_0x8450('0x4')](e,emitEvent(event));}}module[_0x8450('0x5')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 9ec8e4a..b24f1ac 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 _0xaccd=['exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes'];(function(_0x3856e7,_0x26e5dc){var _0x3337b6=function(_0x28c03e){while(--_0x28c03e){_0x3856e7['push'](_0x3856e7['shift']());}};_0x3337b6(++_0x26e5dc);}(_0xaccd,0x1e6));var _0xdacc=function(_0x3da56f,_0x24aab6){_0x3da56f=_0x3da56f-0x0;var _0x5068c8=_0xaccd[_0x3da56f];return _0x5068c8;};'use strict';var _=require('lodash');var util=require(_0xdacc('0x0'));var logger=require(_0xdacc('0x1'))(_0xdacc('0x2'));var moment=require(_0xdacc('0x3'));var BPromise=require(_0xdacc('0x4'));var rp=require(_0xdacc('0x5'));var fs=require('fs');var path=require(_0xdacc('0x6'));var rimraf=require(_0xdacc('0x7'));var config=require(_0xdacc('0x8'));var attributes=require(_0xdacc('0x9'));module[_0xdacc('0xa')]=function(_0x47fab0,_0x292950){return _0x47fab0[_0xdacc('0xb')](_0xdacc('0xc'),attributes,{'tableName':_0xdacc('0xd'),'paranoid':![],'indexes':[{'name':_0xdacc('0xe'),'fields':[_0xdacc('0xf')],'type':_0xdacc('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12a2c6,_0x6d1f66,_0x3398cc){var _0xfb06f0=_0x47fab0['models'];var _0x4c37a2=_0x12a2c6['get']({'plain':!![]});if(_0x4c37a2[_0xdacc('0x11')][_0xdacc('0x12')]()==='in'||_0x4c37a2['direction'][_0xdacc('0x12')]()===_0xdacc('0x13')&&!_0x4c37a2[_0xdacc('0x14')]&&!_['isNil'](_0x4c37a2[_0xdacc('0x15')])){_0xfb06f0[_0xdacc('0x16')][_0xdacc('0x17')]({'where':{'id':_0x4c37a2[_0xdacc('0x18')]}})[_0xdacc('0x19')](function(_0x14d4c5){if(_0x14d4c5){_0x14d4c5[_0xdacc('0x1a')]({'lastMsgAt':_0x4c37a2[_0xdacc('0x1b')],'lastMsgDirection':_0x4c37a2[_0xdacc('0x11')][_0xdacc('0x12')]()});}})[_0xdacc('0x1c')](function(_0x325d77){console[_0xdacc('0x1d')](_0x325d77);});}_0x3398cc();}},'charset':_0xdacc('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xedd9=['exports','ChatMessage','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xedd9,0xfc));var _0x9edd=function(_0x167e31,_0x56fa39){_0x167e31=_0x167e31-0x0;var _0x2ba47c=_0xedd9[_0x167e31];return _0x2ba47c;};'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':'chat_messages','paranoid':![],'indexes':[{'name':_0x9edd('0xb'),'fields':[_0x9edd('0xc')],'type':_0x9edd('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3280fd,_0x49d5e3,_0x494a24){var _0x5d2f90=_0x268f9e[_0x9edd('0xe')];var _0x138767=_0x3280fd['get']({'plain':!![]});if(_0x138767[_0x9edd('0xf')][_0x9edd('0x10')]()==='in'||_0x138767['direction'][_0x9edd('0x10')]()===_0x9edd('0x11')&&!_0x138767[_0x9edd('0x12')]&&!_[_0x9edd('0x13')](_0x138767[_0x9edd('0x14')])){_0x5d2f90[_0x9edd('0x15')][_0x9edd('0x16')]({'where':{'id':_0x138767[_0x9edd('0x17')]}})['then'](function(_0x176bfa){if(_0x176bfa){_0x176bfa[_0x9edd('0x18')]({'lastMsgAt':_0x138767[_0x9edd('0x19')],'lastMsgDirection':_0x138767[_0x9edd('0xf')][_0x9edd('0x10')]()});}})[_0x9edd('0x1a')](function(_0x1042aa){console[_0x9edd('0x1b')](_0x1042aa);});}_0x494a24();}},'charset':'utf8mb4','collate':_0x9edd('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index af14352..2822186 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 _0x2f9b=['defaults','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateChatMessage','create','body','options','raw','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x1221e8,_0x2e7229){var _0x3f3041=function(_0x2042c){while(--_0x2042c){_0x1221e8['push'](_0x1221e8['shift']());}};_0x3f3041(++_0x2e7229);}(_0x2f9b,0x1b8));var _0xb2f9=function(_0x4431d5,_0x43ab0c){_0x4431d5=_0x4431d5-0x0;var _0x41a956=_0x2f9b[_0x4431d5];return _0x41a956;};'use strict';var _=require(_0xb2f9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb2f9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2f9('0x2'))['db'];var utils=require(_0xb2f9('0x3'));var logger=require(_0xb2f9('0x4'))(_0xb2f9('0x5'));var config=require(_0xb2f9('0x6'));var jayson=require(_0xb2f9('0x7'));var client=jayson[_0xb2f9('0x8')]['http']({'port':0x232a});config[_0xb2f9('0x9')]=_[_0xb2f9('0xa')](config[_0xb2f9('0x9')],{'host':_0xb2f9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb2f9('0xc'))[_0xb2f9('0xd')](socket);function respondWithRpcPromise(_0x42eaff,_0x5a2604,_0x11af68){return new BPromise(function(_0x589b2c,_0x9bad5a){return client[_0xb2f9('0xe')](_0x42eaff,_0x11af68)[_0xb2f9('0xf')](function(_0x454206){logger[_0xb2f9('0x10')](_0xb2f9('0x11'),_0x5a2604,_0xb2f9('0x12'));logger[_0xb2f9('0x13')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5a2604,'request\x20sent',JSON[_0xb2f9('0x14')](_0x454206));if(_0x454206[_0xb2f9('0x15')]){if(_0x454206[_0xb2f9('0x15')]['code']===0x1f4){logger[_0xb2f9('0x15')](_0xb2f9('0x11'),_0x5a2604,_0x454206[_0xb2f9('0x15')][_0xb2f9('0x16')]);return _0x9bad5a(_0x454206[_0xb2f9('0x15')]['message']);}logger[_0xb2f9('0x15')](_0xb2f9('0x11'),_0x5a2604,_0x454206['error'][_0xb2f9('0x16')]);return _0x589b2c(_0x454206[_0xb2f9('0x15')][_0xb2f9('0x16')]);}else{logger['info'](_0xb2f9('0x11'),_0x5a2604,_0xb2f9('0x12'));_0x589b2c(_0x454206[_0xb2f9('0x17')][_0xb2f9('0x16')]);}})[_0xb2f9('0x18')](function(_0x14c46e){logger[_0xb2f9('0x15')]('ChatMessage,\x20%s,\x20%s',_0x5a2604,_0x14c46e);_0x9bad5a(_0x14c46e);});});}exports[_0xb2f9('0x19')]=function(_0x25630a){var _0x52084f=this;return new Promise(function(_0x42cd7c,_0x112853){return db['ChatMessage'][_0xb2f9('0x1a')](_0x25630a[_0xb2f9('0x1b')],{'raw':_0x25630a[_0xb2f9('0x1c')]?_0x25630a['options'][_0xb2f9('0x1d')]===undefined?!![]:![]:!![]})[_0xb2f9('0xf')](function(_0x28de41){logger[_0xb2f9('0x10')](_0xb2f9('0x19'),_0x25630a);logger['debug']('CreateChatMessage',_0x25630a,JSON[_0xb2f9('0x14')](_0x28de41));_0x42cd7c(_0x28de41);})['catch'](function(_0x1808e3){logger[_0xb2f9('0x15')](_0xb2f9('0x19'),_0x1808e3[_0xb2f9('0x16')],_0x25630a);_0x112853(_0x52084f[_0xb2f9('0x15')](0x1f4,_0x1808e3[_0xb2f9('0x16')]));});});}; \ No newline at end of file +var _0xf4de=['../../config/environment','client','http','redis','defaults','localhost','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ChatMessage','options','raw','CreateChatMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2a37ed,_0x57174f){var _0x536fdc=function(_0x47b8e1){while(--_0x47b8e1){_0x2a37ed['push'](_0x2a37ed['shift']());}};_0x536fdc(++_0x57174f);}(_0xf4de,0x160));var _0xef4d=function(_0x4e5298,_0x3cbf79){_0x4e5298=_0x4e5298-0x0;var _0x40184d=_0xf4de[_0x4e5298];return _0x40184d;};'use strict';var _=require(_0xef4d('0x0'));var util=require('util');var moment=require(_0xef4d('0x1'));var BPromise=require(_0xef4d('0x2'));var rs=require(_0xef4d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef4d('0x4'))['db'];var utils=require(_0xef4d('0x5'));var logger=require(_0xef4d('0x6'))(_0xef4d('0x7'));var config=require(_0xef4d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xef4d('0x9')][_0xef4d('0xa')]({'port':0x232a});config[_0xef4d('0xb')]=_[_0xef4d('0xc')](config['redis'],{'host':_0xef4d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef4d('0xb')]));require(_0xef4d('0xe'))['register'](socket);function respondWithRpcPromise(_0x3d883a,_0x2f382d,_0x30f61f){return new BPromise(function(_0x2c70c3,_0x1a8243){return client[_0xef4d('0xf')](_0x3d883a,_0x30f61f)[_0xef4d('0x10')](function(_0x42e37a){logger[_0xef4d('0x11')](_0xef4d('0x12'),_0x2f382d,_0xef4d('0x13'));logger[_0xef4d('0x14')](_0xef4d('0x15'),_0x2f382d,_0xef4d('0x13'),JSON[_0xef4d('0x16')](_0x42e37a));if(_0x42e37a[_0xef4d('0x17')]){if(_0x42e37a[_0xef4d('0x17')]['code']===0x1f4){logger[_0xef4d('0x17')](_0xef4d('0x12'),_0x2f382d,_0x42e37a[_0xef4d('0x17')][_0xef4d('0x18')]);return _0x1a8243(_0x42e37a[_0xef4d('0x17')][_0xef4d('0x18')]);}logger[_0xef4d('0x17')](_0xef4d('0x12'),_0x2f382d,_0x42e37a[_0xef4d('0x17')][_0xef4d('0x18')]);return _0x2c70c3(_0x42e37a[_0xef4d('0x17')]['message']);}else{logger['info'](_0xef4d('0x12'),_0x2f382d,_0xef4d('0x13'));_0x2c70c3(_0x42e37a['result'][_0xef4d('0x18')]);}})[_0xef4d('0x19')](function(_0x32ae38){logger[_0xef4d('0x17')](_0xef4d('0x12'),_0x2f382d,_0x32ae38);_0x1a8243(_0x32ae38);});});}exports['CreateChatMessage']=function(_0x2dc5b2){var _0x11c2ff=this;return new Promise(function(_0xc87aa8,_0x11e6e8){return db[_0xef4d('0x1a')]['create'](_0x2dc5b2['body'],{'raw':_0x2dc5b2[_0xef4d('0x1b')]?_0x2dc5b2[_0xef4d('0x1b')][_0xef4d('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x1c0878){logger[_0xef4d('0x11')](_0xef4d('0x1d'),_0x2dc5b2);logger['debug'](_0xef4d('0x1d'),_0x2dc5b2,JSON[_0xef4d('0x16')](_0x1c0878));_0xc87aa8(_0x1c0878);})[_0xef4d('0x19')](function(_0x567206){logger[_0xef4d('0x17')]('CreateChatMessage',_0x567206['message'],_0x2dc5b2);_0x11e6e8(_0x11c2ff[_0xef4d('0x17')](0x1f4,_0x567206[_0xef4d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 4fc8675..27534cb 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 _0xcd59=['remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x19417c,_0x1ed898){var _0x326045=function(_0x2d7caa){while(--_0x2d7caa){_0x19417c['push'](_0x19417c['shift']());}};_0x326045(++_0x1ed898);}(_0xcd59,0x14b));var _0x9cd5=function(_0x261062,_0x4145b9){_0x261062=_0x261062-0x0;var _0x38ef4f=_0xcd59[_0x261062];return _0x38ef4f;};'use strict';var ChatMessageEvents=require(_0x9cd5('0x0'));var events=[_0x9cd5('0x1'),_0x9cd5('0x2'),_0x9cd5('0x3')];function createListener(_0x271070,_0x302b21){return function(_0x4b93b9){_0x302b21[_0x9cd5('0x4')](_0x271070,_0x4b93b9);};}function removeListener(_0x191236,_0xf96efa){return function(){ChatMessageEvents[_0x9cd5('0x5')](_0x191236,_0xf96efa);};}exports[_0x9cd5('0x6')]=function(_0x2db192){for(var _0x46277c=0x0,_0x2cd19a=events[_0x9cd5('0x7')];_0x46277c<_0x2cd19a;_0x46277c++){var _0x3f888f=events[_0x46277c];var _0x545407=createListener(_0x9cd5('0x8')+_0x3f888f,_0x2db192);ChatMessageEvents['on'](_0x3f888f,_0x545407);}}; \ No newline at end of file +var _0x3645=['emit','removeListener','register','length','save','remove','update'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x3645,0x154));var _0x5364=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x3645[_0x3fb030];return _0xd6899b;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x5364('0x0'),_0x5364('0x1'),_0x5364('0x2')];function createListener(_0x28eafb,_0x2d71d7){return function(_0x2f629b){_0x2d71d7[_0x5364('0x3')](_0x28eafb,_0x2f629b);};}function removeListener(_0x5a63bf,_0x334a16){return function(){ChatMessageEvents[_0x5364('0x4')](_0x5a63bf,_0x334a16);};}exports[_0x5364('0x5')]=function(_0x1f9c6b){for(var _0x417c44=0x0,_0x7933a5=events[_0x5364('0x6')];_0x417c44<_0x7933a5;_0x417c44++){var _0x43fb3f=events[_0x417c44];var _0x3c1b21=createListener('chatMessage:'+_0x43fb3f,_0x1f9c6b);ChatMessageEvents['on'](_0x43fb3f,_0x3c1b21);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 2dd49a5..6e454c8 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 _0x1402=['accept','reject','delete','destroy','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','describe','/:id','show','post','tracked','chat','create','put','update','/:id/accept'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1402,0x16c));var _0x2140=function(_0x2e861c,_0x504895){_0x2e861c=_0x2e861c-0x0;var _0x33caba=_0x1402[_0x2e861c];return _0x33caba;};'use strict';var multer=require(_0x2140('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2140('0x1'));var router=express[_0x2140('0x2')]();var fs_extra=require(_0x2140('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2140('0x4'));var config=require(_0x2140('0x5'));var controller=require(_0x2140('0x6'));router['get']('/',auth[_0x2140('0x7')](),controller[_0x2140('0x8')]);router[_0x2140('0x9')]('/describe',auth[_0x2140('0x7')](),controller[_0x2140('0xa')]);router['get'](_0x2140('0xb'),auth[_0x2140('0x7')](),controller[_0x2140('0xc')]);router[_0x2140('0xd')]('/',auth['isAuthenticated'](),interaction[_0x2140('0xe')](_0x2140('0xf'),'chatmessage:create'),controller[_0x2140('0x10')]);router[_0x2140('0x11')](_0x2140('0xb'),controller[_0x2140('0x12')]);router[_0x2140('0x11')](_0x2140('0x13'),auth[_0x2140('0x7')](),controller[_0x2140('0x14')]);router[_0x2140('0x11')]('/:id/reject',auth['isAuthenticated'](),controller[_0x2140('0x15')]);router[_0x2140('0x16')](_0x2140('0xb'),auth[_0x2140('0x7')](),controller[_0x2140('0x17')]);module['exports']=router; \ No newline at end of file +var _0x4782=['reject','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x822282,_0x56c940){var _0x5b982f=function(_0x2b2fe7){while(--_0x2b2fe7){_0x822282['push'](_0x822282['shift']());}};_0x5b982f(++_0x56c940);}(_0x4782,0x1e9));var _0x2478=function(_0x1c3166,_0x25a4b){_0x1c3166=_0x1c3166-0x0;var _0x13a19f=_0x4782[_0x1c3166];return _0x13a19f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2478('0x0'));var timeout=require(_0x2478('0x1'));var express=require(_0x2478('0x2'));var router=express[_0x2478('0x3')]();var fs_extra=require(_0x2478('0x4'));var auth=require(_0x2478('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2478('0x6'));var controller=require(_0x2478('0x7'));router[_0x2478('0x8')]('/',auth[_0x2478('0x9')](),controller[_0x2478('0xa')]);router[_0x2478('0x8')](_0x2478('0xb'),auth[_0x2478('0x9')](),controller[_0x2478('0xc')]);router[_0x2478('0x8')](_0x2478('0xd'),auth[_0x2478('0x9')](),controller['show']);router[_0x2478('0xe')]('/',auth[_0x2478('0x9')](),interaction[_0x2478('0xf')](_0x2478('0x10'),_0x2478('0x11')),controller[_0x2478('0x12')]);router[_0x2478('0x13')](_0x2478('0xd'),controller[_0x2478('0x14')]);router[_0x2478('0x13')](_0x2478('0x15'),auth[_0x2478('0x9')](),controller[_0x2478('0x16')]);router['put'](_0x2478('0x17'),auth[_0x2478('0x9')](),controller[_0x2478('0x18')]);router[_0x2478('0x19')](_0x2478('0xd'),auth[_0x2478('0x9')](),controller['destroy']);module[_0x2478('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 459f122..756025c 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 _0xbe6b=['exports'];(function(_0x528bba,_0x761b10){var _0x5a7c4c=function(_0x11c620){while(--_0x11c620){_0x528bba['push'](_0x528bba['shift']());}};_0x5a7c4c(++_0x761b10);}(_0xbe6b,0x16a));var _0xbbe6=function(_0x113315,_0x18562a){_0x113315=_0x113315-0x0;var _0x3a3ada=_0xbe6b[_0x113315];return _0x3a3ada;};'use strict';var Sequelize=require('sequelize');module[_0xbbe6('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x7d3d=['sequelize','exports'];(function(_0x3e2292,_0x54f827){var _0x26da7c=function(_0x3ff754){while(--_0x3ff754){_0x3e2292['push'](_0x3e2292['shift']());}};_0x26da7c(++_0x54f827);}(_0x7d3d,0x1aa));var _0xd7d3=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0x7d3d[_0x25fa5c];return _0x1bade2;};'use strict';var Sequelize=require(_0xd7d3('0x0'));module[_0xd7d3('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index c4cfdce..1bd05da 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(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x7a54,0x106));var _0x47a5=function(_0x5f045c,_0x264ead){_0x5f045c=_0x5f045c-0x0;var _0x3eea86=_0x7a54[_0x5f045c];return _0x3eea86;};'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(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x7a54,0x106));var _0x47a5=function(_0x446c4e,_0x11eb91){_0x446c4e=_0x446c4e-0x0;var _0x5cbdfb=_0x7a54[_0x446c4e];return _0x5cbdfb;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index b236c1a..a012566 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 _0x8ec1=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x909abb,_0x49bef3){var _0x421e71=function(_0x4d445c){while(--_0x4d445c){_0x909abb['push'](_0x909abb['shift']());}};_0x421e71(++_0x49bef3);}(_0x8ec1,0x13d));var _0x18ec=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0x8ec1[_0x334599];return _0x4cdff2;};'use strict';var _=require(_0x18ec('0x0'));var util=require(_0x18ec('0x1'));var logger=require(_0x18ec('0x2'))(_0x18ec('0x3'));var moment=require('moment');var BPromise=require(_0x18ec('0x4'));var rp=require(_0x18ec('0x5'));var fs=require('fs');var path=require(_0x18ec('0x6'));var rimraf=require(_0x18ec('0x7'));var config=require(_0x18ec('0x8'));var attributes=require(_0x18ec('0x9'));module['exports']=function(_0x45a671,_0x58a92b){return _0x45a671[_0x18ec('0xa')](_0x18ec('0xb'),attributes,{'tableName':_0x18ec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x18ec('0xd'),'collate':_0x18ec('0xe')});}; \ No newline at end of file +var _0x600a=['../../config/environment','utf8mb4','utf8mb4_unicode_ci','util','moment','request-promise'];(function(_0x39fa89,_0x51c384){var _0x24bc06=function(_0x1ee395){while(--_0x1ee395){_0x39fa89['push'](_0x39fa89['shift']());}};_0x24bc06(++_0x51c384);}(_0x600a,0x177));var _0xa600=function(_0x29a29f,_0x155ce7){_0x29a29f=_0x29a29f-0x0;var _0x443ea3=_0x600a[_0x29a29f];return _0x443ea3;};'use strict';var _=require('lodash');var util=require(_0xa600('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa600('0x1'));var BPromise=require('bluebird');var rp=require(_0xa600('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa600('0x3'));var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x478e63,_0x7518d4){return _0x478e63['define']('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa600('0x4'),'collate':_0xa600('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 4d74613..ed7656f 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 _0x2624=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x2624,0x75));var _0x4262=function(_0x2559e0,_0x3f303c){_0x2559e0=_0x2559e0-0x0;var _0x364261=_0x2624[_0x2559e0];return _0x364261;};'use strict';var _=require(_0x4262('0x0'));var util=require(_0x4262('0x1'));var moment=require('moment');var BPromise=require(_0x4262('0x2'));var rs=require(_0x4262('0x3'));var fs=require('fs');var Redis=require(_0x4262('0x4'));var db=require(_0x4262('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4262('0x6'))(_0x4262('0x7'));var config=require(_0x4262('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4262('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bc80c,_0x33765f,_0x414a21){return new BPromise(function(_0x4f35cb,_0x590268){return client[_0x4262('0xa')](_0x3bc80c,_0x414a21)[_0x4262('0xb')](function(_0x221be9){logger[_0x4262('0xc')](_0x4262('0xd'),_0x33765f,_0x4262('0xe'));logger[_0x4262('0xf')](_0x4262('0x10'),_0x33765f,_0x4262('0xe'),JSON[_0x4262('0x11')](_0x221be9));if(_0x221be9['error']){if(_0x221be9['error'][_0x4262('0x12')]===0x1f4){logger[_0x4262('0x13')](_0x4262('0xd'),_0x33765f,_0x221be9['error'][_0x4262('0x14')]);return _0x590268(_0x221be9[_0x4262('0x13')][_0x4262('0x14')]);}logger[_0x4262('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x33765f,_0x221be9[_0x4262('0x13')][_0x4262('0x14')]);return _0x4f35cb(_0x221be9[_0x4262('0x13')]['message']);}else{logger[_0x4262('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x33765f,'request\x20sent');_0x4f35cb(_0x221be9[_0x4262('0x15')][_0x4262('0x14')]);}})[_0x4262('0x16')](function(_0x12e0e6){logger[_0x4262('0x13')](_0x4262('0xd'),_0x33765f,_0x12e0e6);_0x590268(_0x12e0e6);});});} \ No newline at end of file +var _0xb000=['message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xb000,0x1a7));var _0x0b00=function(_0x21205e,_0x7eb8e7){_0x21205e=_0x21205e-0x0;var _0x136ebb=_0xb000[_0x21205e];return _0x136ebb;};'use strict';var _=require(_0x0b00('0x0'));var util=require('util');var moment=require(_0x0b00('0x1'));var BPromise=require(_0x0b00('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b00('0x3'));var db=require(_0x0b00('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0b00('0x5'));var config=require(_0x0b00('0x6'));var jayson=require(_0x0b00('0x7'));var client=jayson[_0x0b00('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24f76b,_0x37bd48,_0x1b4523){return new BPromise(function(_0x34fabe,_0x5145af){return client['request'](_0x24f76b,_0x1b4523)[_0x0b00('0x9')](function(_0x19d76b){logger[_0x0b00('0xa')](_0x0b00('0xb'),_0x37bd48,'request\x20sent');logger[_0x0b00('0xc')](_0x0b00('0xd'),_0x37bd48,_0x0b00('0xe'),JSON[_0x0b00('0xf')](_0x19d76b));if(_0x19d76b[_0x0b00('0x10')]){if(_0x19d76b[_0x0b00('0x10')][_0x0b00('0x11')]===0x1f4){logger['error'](_0x0b00('0xb'),_0x37bd48,_0x19d76b[_0x0b00('0x10')][_0x0b00('0x12')]);return _0x5145af(_0x19d76b['error'][_0x0b00('0x12')]);}logger[_0x0b00('0x10')](_0x0b00('0xb'),_0x37bd48,_0x19d76b[_0x0b00('0x10')][_0x0b00('0x12')]);return _0x34fabe(_0x19d76b[_0x0b00('0x10')][_0x0b00('0x12')]);}else{logger[_0x0b00('0xa')](_0x0b00('0xb'),_0x37bd48,_0x0b00('0xe'));_0x34fabe(_0x19d76b[_0x0b00('0x13')][_0x0b00('0x12')]);}})[_0x0b00('0x14')](function(_0x1aca85){logger[_0x0b00('0x10')](_0x0b00('0xb'),_0x37bd48,_0x1aca85);_0x5145af(_0x1aca85);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 4a67cc0..0830a67 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 _0x4567=['../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x30fb73,_0x3cab1c){var _0x4b6058=function(_0x24226b){while(--_0x24226b){_0x30fb73['push'](_0x30fb73['shift']());}};_0x4b6058(++_0x3cab1c);}(_0x4567,0x152));var _0x7456=function(_0x89132,_0x48bdae){_0x89132=_0x89132-0x0;var _0x11918a=_0x4567[_0x89132];return _0x11918a;};'use strict';var multer=require(_0x7456('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7456('0x1'));var express=require(_0x7456('0x2'));var router=express[_0x7456('0x3')]();var fs_extra=require(_0x7456('0x4'));var auth=require(_0x7456('0x5'));var interaction=require(_0x7456('0x6'));var config=require(_0x7456('0x7'));var controller=require(_0x7456('0x8'));router[_0x7456('0x9')]('/',auth[_0x7456('0xa')](),controller[_0x7456('0xb')]);router[_0x7456('0x9')](_0x7456('0xc'),auth[_0x7456('0xa')](),controller[_0x7456('0xd')]);router[_0x7456('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7456('0xe')]);router[_0x7456('0xf')]('/',auth[_0x7456('0xa')](),controller[_0x7456('0x10')]);router[_0x7456('0x11')](_0x7456('0x12'),auth[_0x7456('0xa')](),controller[_0x7456('0x13')]);router[_0x7456('0x14')](_0x7456('0x12'),auth['isAuthenticated'](),controller[_0x7456('0x15')]);module[_0x7456('0x16')]=router; \ No newline at end of file +var _0xc435=['index','/describe','describe','get','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated'];(function(_0x4e6141,_0x2f1516){var _0x398b49=function(_0x356727){while(--_0x356727){_0x4e6141['push'](_0x4e6141['shift']());}};_0x398b49(++_0x2f1516);}(_0xc435,0x1da));var _0x5c43=function(_0x4ed8bf,_0x53a94f){_0x4ed8bf=_0x4ed8bf-0x0;var _0x130e32=_0xc435[_0x4ed8bf];return _0x130e32;};'use strict';var multer=require(_0x5c43('0x0'));var util=require('util');var path=require(_0x5c43('0x1'));var timeout=require(_0x5c43('0x2'));var express=require('express');var router=express[_0x5c43('0x3')]();var fs_extra=require(_0x5c43('0x4'));var auth=require(_0x5c43('0x5'));var interaction=require(_0x5c43('0x6'));var config=require(_0x5c43('0x7'));var controller=require(_0x5c43('0x8'));router['get']('/',auth[_0x5c43('0x9')](),controller[_0x5c43('0xa')]);router['get'](_0x5c43('0xb'),auth['isAuthenticated'](),controller[_0x5c43('0xc')]);router[_0x5c43('0xd')](_0x5c43('0xe'),auth[_0x5c43('0x9')](),controller[_0x5c43('0xf')]);router[_0x5c43('0x10')]('/',auth['isAuthenticated'](),controller[_0x5c43('0x11')]);router[_0x5c43('0x12')]('/:id',auth[_0x5c43('0x9')](),controller[_0x5c43('0x13')]);router['delete']('/:id',auth[_0x5c43('0x9')](),controller[_0x5c43('0x14')]);module[_0x5c43('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 8101dd2..f062c98 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 _0xa5a4=['exports','mouseOver','STRING','sequelize'];(function(_0x4b3d10,_0x3da823){var _0x3f62cc=function(_0x366e9a){while(--_0x366e9a){_0x4b3d10['push'](_0x4b3d10['shift']());}};_0x3f62cc(++_0x3da823);}(_0xa5a4,0x127));var _0x4a5a=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xa5a4[_0x40a825];return _0x273a54;};'use strict';var Sequelize=require(_0x4a5a('0x0'));module[_0x4a5a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4a5a('0x2'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x4a5a('0x3')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x58c6=['sequelize','ENUM','mouseOver','timeout','INTEGER'];(function(_0x4968bc,_0x73ac39){var _0x1bb23f=function(_0x514490){while(--_0x514490){_0x4968bc['push'](_0x4968bc['shift']());}};_0x1bb23f(++_0x73ac39);}(_0x58c6,0xd7));var _0x658c=function(_0x21c130,_0x225833){_0x21c130=_0x21c130-0x0;var _0x58f574=_0x58c6[_0x21c130];return _0x58f574;};'use strict';var Sequelize=require(_0x658c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x658c('0x1')](_0x658c('0x2'),_0x658c('0x3')),'defaultValue':_0x658c('0x2')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x658c('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 59aefdd..a06639f 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 _0x5a2a=['undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','include','merge','find','create','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x475c23,_0x3a094d){var _0x1ff566=function(_0x3c3c24){while(--_0x3c3c24){_0x475c23['push'](_0x475c23['shift']());}};_0x1ff566(++_0x3a094d);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x14ebbf,_0x2228d6){_0x14ebbf=_0x14ebbf-0x0;var _0x236edd=_0x5a2a[_0x14ebbf];return _0x236edd;};'use strict';var emlformat=require(_0xa5a2('0x0'));var rimraf=require(_0xa5a2('0x1'));var zipdir=require(_0xa5a2('0x2'));var jsonpatch=require(_0xa5a2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa5a2('0x4'));var util=require(_0xa5a2('0x5'));var path=require('path');var sox=require(_0xa5a2('0x6'));var csv=require(_0xa5a2('0x7'));var ejs=require(_0xa5a2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa5a2('0x9'));var squel=require('squel');var crypto=require(_0xa5a2('0xa'));var jsforce=require(_0xa5a2('0xb'));var deskjs=require(_0xa5a2('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa5a2('0xd'));var Redis=require(_0xa5a2('0xe'));var authService=require(_0xa5a2('0xf'));var qs=require(_0xa5a2('0x10'));var as=require(_0xa5a2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5a2('0x12'))(_0xa5a2('0x13'));var utils=require(_0xa5a2('0x14'));var config=require(_0xa5a2('0x15'));var licenseUtil=require(_0xa5a2('0x16'));var db=require(_0xa5a2('0x17'))['db'];function respondWithStatusCode(_0x501e3c,_0x5e71a8){_0x5e71a8=_0x5e71a8||0xcc;return function(_0x4a6a35){if(_0x4a6a35){return _0x501e3c[_0xa5a2('0x18')](_0x5e71a8);}return _0x501e3c[_0xa5a2('0x19')](_0x5e71a8)[_0xa5a2('0x1a')]();};}function respondWithResult(_0x29174b,_0x39d6a6){_0x39d6a6=_0x39d6a6||0xc8;return function(_0x488b10){if(_0x488b10){return _0x29174b[_0xa5a2('0x19')](_0x39d6a6)[_0xa5a2('0x1b')](_0x488b10);}};}function respondWithFilteredResult(_0x570d87,_0x20ae7c){return function(_0x1bdcd2){if(_0x1bdcd2){var _0x5e1b56=typeof _0x20ae7c[_0xa5a2('0x1c')]===_0xa5a2('0x1d')&&typeof _0x20ae7c['limit']===_0xa5a2('0x1d');var _0x996384=_0x1bdcd2[_0xa5a2('0x1e')];var _0xf874c0=_0x5e1b56?0x0:_0x20ae7c[_0xa5a2('0x1c')];var _0xe4b688=_0x5e1b56?_0x1bdcd2['count']:_0x20ae7c[_0xa5a2('0x1c')]+_0x20ae7c[_0xa5a2('0x1f')];var _0x21712b;if(_0xe4b688>=_0x996384){_0xe4b688=_0x996384;_0x21712b=0xc8;}else{_0x21712b=0xce;}_0x570d87[_0xa5a2('0x19')](_0x21712b);return _0x570d87[_0xa5a2('0x20')](_0xa5a2('0x21'),_0xf874c0+'-'+_0xe4b688+'/'+_0x996384)['json'](_0x1bdcd2);}return null;};}function patchUpdates(_0x299208){return function(_0x2fa65d){try{jsonpatch[_0xa5a2('0x22')](_0x2fa65d,_0x299208,!![]);}catch(_0x1116f8){return BPromise[_0xa5a2('0x23')](_0x1116f8);}return _0x2fa65d[_0xa5a2('0x24')]();};}function saveUpdates(_0x134877,_0x27f3bf){return function(_0x3a7a6a){if(_0x3a7a6a){return _0x3a7a6a[_0xa5a2('0x25')](_0x134877)[_0xa5a2('0x26')](function(_0x2adce9){return _0x2adce9;});}return null;};}function removeEntity(_0x9a6e53,_0x349f94){return function(_0x4c8faf){if(_0x4c8faf){return _0x4c8faf['destroy']()['then'](function(){_0x9a6e53[_0xa5a2('0x19')](0xcc)[_0xa5a2('0x1a')]();});}};}function handleEntityNotFound(_0x2f0317,_0x445aee){return function(_0x43d74d){if(!_0x43d74d){_0x2f0317[_0xa5a2('0x18')](0x194);}return _0x43d74d;};}function handleError(_0x29556e,_0x1ad00c){_0x1ad00c=_0x1ad00c||0x1f4;return function(_0x50722e){logger[_0xa5a2('0x27')](_0x50722e[_0xa5a2('0x28')]);if(_0x50722e['name']){delete _0x50722e[_0xa5a2('0x29')];}_0x29556e[_0xa5a2('0x19')](_0x1ad00c)['send'](_0x50722e);};}exports[_0xa5a2('0x2a')]=function(_0x406f3d,_0x38bd1b){var _0x180b8a={'raw':!![],'where':{'id':_0x406f3d[_0xa5a2('0x2b')]['id']}},_0x5284a9={};_0x5284a9[_0xa5a2('0x2c')]=_[_0xa5a2('0x2d')](db[_0xa5a2('0x2e')][_0xa5a2('0x2f')]);_0x5284a9[_0xa5a2('0x30')]=_[_0xa5a2('0x2d')](_0x406f3d[_0xa5a2('0x30')]);_0x5284a9[_0xa5a2('0x31')]=_[_0xa5a2('0x32')](_0x5284a9[_0xa5a2('0x2c')],_0x5284a9[_0xa5a2('0x30')]);_0x180b8a[_0xa5a2('0x33')]=_['intersection'](_0x5284a9[_0xa5a2('0x2c')],qs['fields'](_0x406f3d[_0xa5a2('0x30')][_0xa5a2('0x34')]));_0x180b8a[_0xa5a2('0x33')]=_0x180b8a[_0xa5a2('0x33')]['length']?_0x180b8a['attributes']:_0x5284a9[_0xa5a2('0x2c')];if(_0x406f3d['query']['includeAll']){_0x180b8a[_0xa5a2('0x35')]=[{'all':!![]}];}_0x180b8a=_[_0xa5a2('0x36')]({},_0x180b8a,_0x406f3d['options']);return db[_0xa5a2('0x2e')][_0xa5a2('0x37')](_0x180b8a)[_0xa5a2('0x26')](handleEntityNotFound(_0x38bd1b,null))['then'](respondWithResult(_0x38bd1b,null))['catch'](handleError(_0x38bd1b,null));};exports[_0xa5a2('0x38')]=function(_0x3a5b91,_0x243b2f){return db[_0xa5a2('0x2e')][_0xa5a2('0x38')](_0x3a5b91[_0xa5a2('0x39')],{})[_0xa5a2('0x26')](respondWithResult(_0x243b2f,0xc9))['catch'](handleError(_0x243b2f,null));};exports[_0xa5a2('0x25')]=function(_0x17c5e7,_0x42c76c){if(_0x17c5e7[_0xa5a2('0x39')]['id']){delete _0x17c5e7['body']['id'];}return db[_0xa5a2('0x2e')][_0xa5a2('0x37')]({'where':{'id':_0x17c5e7['params']['id']}})[_0xa5a2('0x26')](handleEntityNotFound(_0x42c76c,null))[_0xa5a2('0x26')](saveUpdates(_0x17c5e7[_0xa5a2('0x39')],null))[_0xa5a2('0x26')](respondWithResult(_0x42c76c,null))[_0xa5a2('0x3a')](handleError(_0x42c76c,null));};exports[_0xa5a2('0x3b')]=function(_0x93e6da,_0x2e31c1){return db[_0xa5a2('0x2e')][_0xa5a2('0x37')]({'where':{'id':_0x93e6da[_0xa5a2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2e31c1,null))['then'](removeEntity(_0x2e31c1,null))['catch'](handleError(_0x2e31c1,null));}; \ No newline at end of file +var _0xa1aa=['ChatProactiveAction','find','create','body','catch','destroy','zip-dir','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options'];(function(_0x128d68,_0x555a32){var _0x24ad4d=function(_0x101a3a){while(--_0x101a3a){_0x128d68['push'](_0x128d68['shift']());}};_0x24ad4d(++_0x555a32);}(_0xa1aa,0x88));var _0xaa1a=function(_0xd1c706,_0x16139a){_0xd1c706=_0xd1c706-0x0;var _0x3872b6=_0xa1aa[_0xd1c706];return _0x3872b6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaa1a('0x0'));var jsonpatch=require(_0xaa1a('0x1'));var rp=require(_0xaa1a('0x2'));var moment=require(_0xaa1a('0x3'));var BPromise=require(_0xaa1a('0x4'));var Mustache=require(_0xaa1a('0x5'));var util=require(_0xaa1a('0x6'));var path=require('path');var sox=require(_0xaa1a('0x7'));var csv=require(_0xaa1a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa1a('0x9'));var _=require(_0xaa1a('0xa'));var squel=require(_0xaa1a('0xb'));var crypto=require(_0xaa1a('0xc'));var jsforce=require(_0xaa1a('0xd'));var deskjs=require(_0xaa1a('0xe'));var toCsv=require(_0xaa1a('0x8'));var querystring=require(_0xaa1a('0xf'));var Papa=require(_0xaa1a('0x10'));var Redis=require('ioredis');var authService=require(_0xaa1a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaa1a('0x12'));var hardwareService=require(_0xaa1a('0x13'));var logger=require(_0xaa1a('0x14'))(_0xaa1a('0x15'));var utils=require(_0xaa1a('0x16'));var config=require(_0xaa1a('0x17'));var licenseUtil=require(_0xaa1a('0x18'));var db=require(_0xaa1a('0x19'))['db'];function respondWithStatusCode(_0x41640e,_0x136e90){_0x136e90=_0x136e90||0xcc;return function(_0x3feb49){if(_0x3feb49){return _0x41640e['sendStatus'](_0x136e90);}return _0x41640e['status'](_0x136e90)[_0xaa1a('0x1a')]();};}function respondWithResult(_0x3b211d,_0x30afd5){_0x30afd5=_0x30afd5||0xc8;return function(_0xa6e170){if(_0xa6e170){return _0x3b211d[_0xaa1a('0x1b')](_0x30afd5)[_0xaa1a('0x1c')](_0xa6e170);}};}function respondWithFilteredResult(_0x5ea190,_0x332733){return function(_0x2db211){if(_0x2db211){var _0x4c2720=typeof _0x332733[_0xaa1a('0x1d')]==='undefined'&&typeof _0x332733['limit']===_0xaa1a('0x1e');var _0x3bb7c9=_0x2db211[_0xaa1a('0x1f')];var _0x123ab4=_0x4c2720?0x0:_0x332733[_0xaa1a('0x1d')];var _0x35e9d5=_0x4c2720?_0x2db211[_0xaa1a('0x1f')]:_0x332733[_0xaa1a('0x1d')]+_0x332733[_0xaa1a('0x20')];var _0x8f7377;if(_0x35e9d5>=_0x3bb7c9){_0x35e9d5=_0x3bb7c9;_0x8f7377=0xc8;}else{_0x8f7377=0xce;}_0x5ea190['status'](_0x8f7377);return _0x5ea190[_0xaa1a('0x21')](_0xaa1a('0x22'),_0x123ab4+'-'+_0x35e9d5+'/'+_0x3bb7c9)[_0xaa1a('0x1c')](_0x2db211);}return null;};}function patchUpdates(_0x2558a8){return function(_0x436551){try{jsonpatch[_0xaa1a('0x23')](_0x436551,_0x2558a8,!![]);}catch(_0x299b10){return BPromise[_0xaa1a('0x24')](_0x299b10);}return _0x436551['save']();};}function saveUpdates(_0x45570b,_0x412e4f){return function(_0x2a362c){if(_0x2a362c){return _0x2a362c[_0xaa1a('0x25')](_0x45570b)[_0xaa1a('0x26')](function(_0xff4914){return _0xff4914;});}return null;};}function removeEntity(_0x11a0f6,_0x221409){return function(_0x4629c1){if(_0x4629c1){return _0x4629c1['destroy']()[_0xaa1a('0x26')](function(){_0x11a0f6['status'](0xcc)[_0xaa1a('0x1a')]();});}};}function handleEntityNotFound(_0x408773,_0xac2c7d){return function(_0x15fb61){if(!_0x15fb61){_0x408773[_0xaa1a('0x27')](0x194);}return _0x15fb61;};}function handleError(_0xf45b27,_0x16b90c){_0x16b90c=_0x16b90c||0x1f4;return function(_0x5523fa){logger[_0xaa1a('0x28')](_0x5523fa[_0xaa1a('0x29')]);if(_0x5523fa['name']){delete _0x5523fa[_0xaa1a('0x2a')];}_0xf45b27['status'](_0x16b90c)[_0xaa1a('0x2b')](_0x5523fa);};}exports[_0xaa1a('0x2c')]=function(_0xd2360d,_0x572eef){var _0x20d5c0={'raw':!![],'where':{'id':_0xd2360d[_0xaa1a('0x2d')]['id']}},_0x2de205={};_0x2de205[_0xaa1a('0x2e')]=_['keys'](db['ChatProactiveAction'][_0xaa1a('0x2f')]);_0x2de205[_0xaa1a('0x30')]=_[_0xaa1a('0x31')](_0xd2360d[_0xaa1a('0x30')]);_0x2de205[_0xaa1a('0x32')]=_[_0xaa1a('0x33')](_0x2de205['model'],_0x2de205['query']);_0x20d5c0[_0xaa1a('0x34')]=_[_0xaa1a('0x33')](_0x2de205[_0xaa1a('0x2e')],qs[_0xaa1a('0x35')](_0xd2360d[_0xaa1a('0x30')][_0xaa1a('0x35')]));_0x20d5c0['attributes']=_0x20d5c0[_0xaa1a('0x34')][_0xaa1a('0x36')]?_0x20d5c0[_0xaa1a('0x34')]:_0x2de205[_0xaa1a('0x2e')];if(_0xd2360d[_0xaa1a('0x30')][_0xaa1a('0x37')]){_0x20d5c0[_0xaa1a('0x38')]=[{'all':!![]}];}_0x20d5c0=_[_0xaa1a('0x39')]({},_0x20d5c0,_0xd2360d[_0xaa1a('0x3a')]);return db[_0xaa1a('0x3b')][_0xaa1a('0x3c')](_0x20d5c0)['then'](handleEntityNotFound(_0x572eef,null))[_0xaa1a('0x26')](respondWithResult(_0x572eef,null))['catch'](handleError(_0x572eef,null));};exports[_0xaa1a('0x3d')]=function(_0x1231f6,_0x56dcb6){return db[_0xaa1a('0x3b')][_0xaa1a('0x3d')](_0x1231f6[_0xaa1a('0x3e')],{})['then'](respondWithResult(_0x56dcb6,0xc9))[_0xaa1a('0x3f')](handleError(_0x56dcb6,null));};exports[_0xaa1a('0x25')]=function(_0x340ce5,_0x251637){if(_0x340ce5[_0xaa1a('0x3e')]['id']){delete _0x340ce5[_0xaa1a('0x3e')]['id'];}return db[_0xaa1a('0x3b')]['find']({'where':{'id':_0x340ce5[_0xaa1a('0x2d')]['id']}})['then'](handleEntityNotFound(_0x251637,null))[_0xaa1a('0x26')](saveUpdates(_0x340ce5[_0xaa1a('0x3e')],null))['then'](respondWithResult(_0x251637,null))[_0xaa1a('0x3f')](handleError(_0x251637,null));};exports[_0xaa1a('0x40')]=function(_0x39e871,_0xe52233){return db[_0xaa1a('0x3b')][_0xaa1a('0x3c')]({'where':{'id':_0x39e871[_0xaa1a('0x2d')]['id']}})[_0xaa1a('0x26')](handleEntityNotFound(_0xe52233,null))[_0xaa1a('0x26')](removeEntity(_0xe52233,null))[_0xaa1a('0x3f')](handleError(_0xe52233,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 318aab3..7cd6e67 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 _0xa187=['../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3d7fb5,_0x16eb5c){var _0x3a9642=function(_0x3f5b2a){while(--_0x3f5b2a){_0x3d7fb5['push'](_0x3d7fb5['shift']());}};_0x3a9642(++_0x16eb5c);}(_0xa187,0x95));var _0x7a18=function(_0x207114,_0x25902e){_0x207114=_0x207114-0x0;var _0x14d3b4=_0xa187[_0x207114];return _0x14d3b4;};'use strict';var _=require(_0x7a18('0x0'));var util=require('util');var logger=require(_0x7a18('0x1'))(_0x7a18('0x2'));var moment=require(_0x7a18('0x3'));var BPromise=require(_0x7a18('0x4'));var rp=require(_0x7a18('0x5'));var fs=require('fs');var path=require(_0x7a18('0x6'));var rimraf=require('rimraf');var config=require(_0x7a18('0x7'));var attributes=require(_0x7a18('0x8'));module[_0x7a18('0x9')]=function(_0x462968,_0x780f87){return _0x462968[_0x7a18('0xa')](_0x7a18('0xb'),attributes,{'tableName':_0x7a18('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabda=['bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment'];(function(_0x7d66f2,_0x55a83e){var _0x30bf39=function(_0x2e5e5e){while(--_0x2e5e5e){_0x7d66f2['push'](_0x7d66f2['shift']());}};_0x30bf39(++_0x55a83e);}(_0xabda,0xce));var _0xaabd=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xabda[_0x2ca9d4];return _0x258956;};'use strict';var _=require(_0xaabd('0x0'));var util=require(_0xaabd('0x1'));var logger=require(_0xaabd('0x2'))('api');var moment=require(_0xaabd('0x3'));var BPromise=require(_0xaabd('0x4'));var rp=require(_0xaabd('0x5'));var fs=require('fs');var path=require(_0xaabd('0x6'));var rimraf=require(_0xaabd('0x7'));var config=require(_0xaabd('0x8'));var attributes=require(_0xaabd('0x9'));module[_0xaabd('0xa')]=function(_0x537924,_0x1631ac){return _0x537924[_0xaabd('0xb')](_0xaabd('0xc'),attributes,{'tableName':_0xaabd('0xd'),'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 00878c7..cbb69ee 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 _0x6755=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x361024,_0x501d3d){var _0x3dd505=function(_0x3be156){while(--_0x3be156){_0x361024['push'](_0x361024['shift']());}};_0x3dd505(++_0x501d3d);}(_0x6755,0x147));var _0x5675=function(_0x37e8af,_0x3eaff3){_0x37e8af=_0x37e8af-0x0;var _0x2351f9=_0x6755[_0x37e8af];return _0x2351f9;};'use strict';var _=require(_0x5675('0x0'));var util=require(_0x5675('0x1'));var moment=require('moment');var BPromise=require(_0x5675('0x2'));var rs=require(_0x5675('0x3'));var fs=require('fs');var Redis=require(_0x5675('0x4'));var db=require(_0x5675('0x5'))['db'];var utils=require(_0x5675('0x6'));var logger=require(_0x5675('0x7'))(_0x5675('0x8'));var config=require(_0x5675('0x9'));var jayson=require(_0x5675('0xa'));var client=jayson[_0x5675('0xb')][_0x5675('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x187db9,_0x4ddd61,_0x6e5762){return new BPromise(function(_0x2efb46,_0xbaae8){return client['request'](_0x187db9,_0x6e5762)[_0x5675('0xd')](function(_0x56524e){logger[_0x5675('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x4ddd61,_0x5675('0xf'));logger[_0x5675('0x10')](_0x5675('0x11'),_0x4ddd61,_0x5675('0xf'),JSON[_0x5675('0x12')](_0x56524e));if(_0x56524e['error']){if(_0x56524e[_0x5675('0x13')]['code']===0x1f4){logger['error'](_0x5675('0x14'),_0x4ddd61,_0x56524e['error'][_0x5675('0x15')]);return _0xbaae8(_0x56524e[_0x5675('0x13')][_0x5675('0x15')]);}logger[_0x5675('0x13')](_0x5675('0x14'),_0x4ddd61,_0x56524e[_0x5675('0x13')][_0x5675('0x15')]);return _0x2efb46(_0x56524e['error'][_0x5675('0x15')]);}else{logger[_0x5675('0xe')](_0x5675('0x14'),_0x4ddd61,_0x5675('0xf'));_0x2efb46(_0x56524e[_0x5675('0x16')][_0x5675('0x15')]);}})[_0x5675('0x17')](function(_0x385f53){logger[_0x5675('0x13')](_0x5675('0x14'),_0x4ddd61,_0x385f53);_0xbaae8(_0x385f53);});});} \ No newline at end of file +var _0x096a=['ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','then'];(function(_0x53135c,_0x10a974){var _0x503026=function(_0x488fb9){while(--_0x488fb9){_0x53135c['push'](_0x53135c['shift']());}};_0x503026(++_0x10a974);}(_0x096a,0x121));var _0xa096=function(_0x5b44dc,_0x348d84){_0x5b44dc=_0x5b44dc-0x0;var _0x22aefd=_0x096a[_0x5b44dc];return _0x22aefd;};'use strict';var _=require(_0xa096('0x0'));var util=require('util');var moment=require(_0xa096('0x1'));var BPromise=require(_0xa096('0x2'));var rs=require(_0xa096('0x3'));var fs=require('fs');var Redis=require(_0xa096('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa096('0x5'));var logger=require('../../config/logger')(_0xa096('0x6'));var config=require('../../config/environment');var jayson=require(_0xa096('0x7'));var client=jayson[_0xa096('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d58ff,_0x586103,_0x230366){return new BPromise(function(_0xf1c3e0,_0x23bfe7){return client[_0xa096('0x9')](_0x2d58ff,_0x230366)[_0xa096('0xa')](function(_0x120058){logger['info'](_0xa096('0xb'),_0x586103,_0xa096('0xc'));logger[_0xa096('0xd')](_0xa096('0xe'),_0x586103,_0xa096('0xc'),JSON['stringify'](_0x120058));if(_0x120058[_0xa096('0xf')]){if(_0x120058[_0xa096('0xf')][_0xa096('0x10')]===0x1f4){logger['error'](_0xa096('0xb'),_0x586103,_0x120058[_0xa096('0xf')][_0xa096('0x11')]);return _0x23bfe7(_0x120058[_0xa096('0xf')][_0xa096('0x11')]);}logger[_0xa096('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x586103,_0x120058[_0xa096('0xf')][_0xa096('0x11')]);return _0xf1c3e0(_0x120058[_0xa096('0xf')]['message']);}else{logger[_0xa096('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x586103,'request\x20sent');_0xf1c3e0(_0x120058[_0xa096('0x13')][_0xa096('0x11')]);}})['catch'](function(_0x41e0e0){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x586103,_0x41e0e0);_0x23bfe7(_0x41e0e0);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 5fda594..6b07c77 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 _0xeff8=['isAuthenticated','show','post','create','put','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xeff8,0x186));var _0x8eff=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0xeff8[_0x2a56ad];return _0x425175;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xb')]);router[_0x8eff('0xc')]('/',auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xe')](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller['update']);router['delete'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xf')]);module['exports']=router; \ No newline at end of file +var _0x55ca=['multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','destroy','exports'];(function(_0x5217cc,_0x3fd394){var _0x192de5=function(_0xc99e49){while(--_0xc99e49){_0x5217cc['push'](_0x5217cc['shift']());}};_0x192de5(++_0x3fd394);}(_0x55ca,0x126));var _0xa55c=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x55ca[_0x4aba15];return _0x1c8122;};'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')](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x9')](),controller[_0xa55c('0xb')]);router['put'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller['update']);router['delete'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xc')]);module[_0xa55c('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index c41d4d7..a7176c1 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 _0x6154=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x5becd6,_0x13e651){var _0x3b7b78=function(_0x2193b3){while(--_0x2193b3){_0x5becd6['push'](_0x5becd6['shift']());}};_0x3b7b78(++_0x13e651);}(_0x6154,0xcf));var _0x4615=function(_0x2c4df9,_0x8b2b76){_0x2c4df9=_0x2c4df9-0x0;var _0x21d18a=_0x6154[_0x2c4df9];return _0x21d18a;};'use strict';var Sequelize=require('sequelize');module[_0x4615('0x0')]={'name':{'type':Sequelize[_0x4615('0x1')],'unique':_0x4615('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4615('0x1')]},'timeout':{'type':Sequelize[_0x4615('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4615('0x4')](_0x4615('0x5'),_0x4615('0x6'),_0x4615('0x7'))}}; \ No newline at end of file +var _0x8f66=['roundrobin','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x50a732,_0x1eab82){var _0x2047a1=function(_0x277e50){while(--_0x277e50){_0x50a732['push'](_0x50a732['shift']());}};_0x2047a1(++_0x1eab82);}(_0x8f66,0x14a));var _0x68f6=function(_0x39a3f4,_0x7f4ae8){_0x39a3f4=_0x39a3f4-0x0;var _0x4a894d=_0x8f66[_0x39a3f4];return _0x4a894d;};'use strict';var Sequelize=require('sequelize');module[_0x68f6('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x68f6('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x68f6('0x2')]},'timeout':{'type':Sequelize[_0x68f6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x68f6('0x4')](_0x68f6('0x5'),'beepall',_0x68f6('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 16bd19b..8c47152 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 _0x1b85=['map','ChatQueue','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','includeAll','include','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','nolimit','ChatQueueId','findAll','User','UserId','updatedAt','createdAt','rows','format','SIP','chatPause','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','value','isEmpty','addAgents','omit','removeAgents','userChatQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','ChatQueues','UserProfileResource','stack','name','send','index'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x1b85,0xfc));var _0x51b8=function(_0x1d27a8,_0x2f5d59){_0x1d27a8=_0x1d27a8-0x0;var _0x37adc5=_0x1b85[_0x1d27a8];return _0x37adc5;};'use strict';var emlformat=require(_0x51b8('0x0'));var rimraf=require(_0x51b8('0x1'));var zipdir=require(_0x51b8('0x2'));var jsonpatch=require(_0x51b8('0x3'));var rp=require(_0x51b8('0x4'));var moment=require(_0x51b8('0x5'));var BPromise=require(_0x51b8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x51b8('0x7'));var sox=require(_0x51b8('0x8'));var csv=require(_0x51b8('0x9'));var ejs=require(_0x51b8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x51b8('0xb'));var squel=require(_0x51b8('0xc'));var crypto=require(_0x51b8('0xd'));var jsforce=require(_0x51b8('0xe'));var deskjs=require(_0x51b8('0xf'));var toCsv=require(_0x51b8('0x9'));var querystring=require(_0x51b8('0x10'));var Papa=require('papaparse');var Redis=require(_0x51b8('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x51b8('0x12'));var hardwareService=require(_0x51b8('0x13'));var logger=require(_0x51b8('0x14'))(_0x51b8('0x15'));var utils=require(_0x51b8('0x16'));var config=require(_0x51b8('0x17'));var licenseUtil=require(_0x51b8('0x18'));var db=require(_0x51b8('0x19'))['db'];config[_0x51b8('0x1a')]=_[_0x51b8('0x1b')](config[_0x51b8('0x1a')],{'host':_0x51b8('0x1c'),'port':0x18eb});var socket=require(_0x51b8('0x1d'))(new Redis(config[_0x51b8('0x1a')]));require(_0x51b8('0x1e'))[_0x51b8('0x1f')](socket);var jayson=require(_0x51b8('0x20'));var client=jayson['client'][_0x51b8('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xc8dfb7,_0x3e0d78,_0x581567,_0x3bbc8b){return new BPromise(function(_0x307721,_0x57168c){var _0x604600=_0x3bbc8b||client;return _0x604600[_0x51b8('0x22')](_0xc8dfb7,_0x581567)['then'](function(_0x4f6676){logger[_0x51b8('0x23')](_0x51b8('0x24'),_0x3e0d78,'request\x20sent');logger[_0x51b8('0x25')](_0x51b8('0x26'),_0x3e0d78,_0x51b8('0x27'),JSON[_0x51b8('0x28')](_0x4f6676));if(_0x4f6676[_0x51b8('0x29')]){if(_0x4f6676['error'][_0x51b8('0x2a')]===0x1f4){logger[_0x51b8('0x29')](_0x51b8('0x24'),_0x3e0d78,_0x4f6676[_0x51b8('0x29')][_0x51b8('0x2b')]);return _0x57168c(_0x4f6676['error'][_0x51b8('0x2b')]);}logger['error'](_0x51b8('0x24'),_0x3e0d78,_0x4f6676[_0x51b8('0x29')][_0x51b8('0x2b')]);return _0x307721(_0x4f6676[_0x51b8('0x29')][_0x51b8('0x2b')]);}else{logger[_0x51b8('0x23')](_0x51b8('0x24'),_0x3e0d78,_0x51b8('0x27'));_0x307721(_0x4f6676[_0x51b8('0x2c')][_0x51b8('0x2b')]);}})[_0x51b8('0x2d')](function(_0xe922e8){logger[_0x51b8('0x29')](_0x51b8('0x24'),_0x3e0d78,_0xe922e8);_0x57168c(_0xe922e8);});});}function respondWithStatusCode(_0x33d1e4,_0x23502d){_0x23502d=_0x23502d||0xcc;return function(_0x38c3fc){if(_0x38c3fc){return _0x33d1e4[_0x51b8('0x2e')](_0x23502d);}return _0x33d1e4[_0x51b8('0x2f')](_0x23502d)[_0x51b8('0x30')]();};}function respondWithResult(_0x31b61a,_0x42fd43){_0x42fd43=_0x42fd43||0xc8;return function(_0x5a3e01){if(_0x5a3e01){return _0x31b61a[_0x51b8('0x2f')](_0x42fd43)[_0x51b8('0x31')](_0x5a3e01);}};}function respondWithFilteredResult(_0x141fd3,_0x2cf456){return function(_0x3c401c){if(_0x3c401c){var _0x63e6d2=typeof _0x2cf456[_0x51b8('0x32')]===_0x51b8('0x33')&&typeof _0x2cf456[_0x51b8('0x34')]===_0x51b8('0x33');var _0x1bcce9=_0x3c401c[_0x51b8('0x35')];var _0x28350a=_0x63e6d2?0x0:_0x2cf456[_0x51b8('0x32')];var _0x216299=_0x63e6d2?_0x3c401c[_0x51b8('0x35')]:_0x2cf456[_0x51b8('0x32')]+_0x2cf456['limit'];var _0xce34b;if(_0x216299>=_0x1bcce9){_0x216299=_0x1bcce9;_0xce34b=0xc8;}else{_0xce34b=0xce;}_0x141fd3[_0x51b8('0x2f')](_0xce34b);return _0x141fd3[_0x51b8('0x36')](_0x51b8('0x37'),_0x28350a+'-'+_0x216299+'/'+_0x1bcce9)[_0x51b8('0x31')](_0x3c401c);}return null;};}function patchUpdates(_0x25c6da){return function(_0x4da276){try{jsonpatch[_0x51b8('0x38')](_0x4da276,_0x25c6da,!![]);}catch(_0x573d10){return BPromise[_0x51b8('0x39')](_0x573d10);}return _0x4da276[_0x51b8('0x3a')]();};}function saveUpdates(_0x31cb53,_0x494aa1){return function(_0x33a989){if(_0x33a989){return _0x33a989[_0x51b8('0x3b')](_0x31cb53)[_0x51b8('0x3c')](function(_0x1e6178){return _0x1e6178;});}return null;};}function removeEntity(_0x236329,_0x32d20b){return function(_0x5a7c6d){if(_0x5a7c6d){return _0x5a7c6d[_0x51b8('0x3d')]()[_0x51b8('0x3c')](function(){var _0xcac7dd=_0x5a7c6d['get']({'plain':!![]});var _0x4fcdb6=_0x51b8('0x3e');return db[_0x51b8('0x3f')][_0x51b8('0x3d')]({'where':{'type':_0x4fcdb6,'resourceId':_0xcac7dd['id']}})['then'](function(){return _0x5a7c6d;});})[_0x51b8('0x3c')](function(){_0x236329[_0x51b8('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c91b9,_0xcb0bd0){return function(_0x3e0a2f){if(!_0x3e0a2f){_0x4c91b9[_0x51b8('0x2e')](0x194);}return _0x3e0a2f;};}function handleError(_0x57bb01,_0x4beee0){_0x4beee0=_0x4beee0||0x1f4;return function(_0x42ac4f){logger[_0x51b8('0x29')](_0x42ac4f[_0x51b8('0x40')]);if(_0x42ac4f['name']){delete _0x42ac4f[_0x51b8('0x41')];}_0x57bb01['status'](_0x4beee0)[_0x51b8('0x42')](_0x42ac4f);};}exports[_0x51b8('0x43')]=function(_0x46f2c4,_0xe8ce0e){var _0x287257={},_0x2a29a9={},_0x4c5d92={'count':0x0,'rows':[]};var _0xaed7d1=_[_0x51b8('0x44')](db[_0x51b8('0x45')][_0x51b8('0x46')],function(_0x15d409){return{'name':_0x15d409[_0x51b8('0x47')],'type':_0x15d409[_0x51b8('0x48')][_0x51b8('0x49')]};});_0x2a29a9[_0x51b8('0x4a')]=_[_0x51b8('0x44')](_0xaed7d1,_0x51b8('0x41'));_0x2a29a9['query']=_[_0x51b8('0x4b')](_0x46f2c4[_0x51b8('0x4c')]);_0x2a29a9['filters']=_[_0x51b8('0x4d')](_0x2a29a9[_0x51b8('0x4a')],_0x2a29a9['query']);_0x287257[_0x51b8('0x4e')]=_['intersection'](_0x2a29a9[_0x51b8('0x4a')],qs[_0x51b8('0x4f')](_0x46f2c4[_0x51b8('0x4c')][_0x51b8('0x4f')]));_0x287257[_0x51b8('0x4e')]=_0x287257['attributes'][_0x51b8('0x50')]?_0x287257[_0x51b8('0x4e')]:_0x2a29a9[_0x51b8('0x4a')];if(!_0x46f2c4[_0x51b8('0x4c')][_0x51b8('0x51')]('nolimit')){_0x287257[_0x51b8('0x34')]=qs[_0x51b8('0x34')](_0x46f2c4[_0x51b8('0x4c')]['limit']);_0x287257[_0x51b8('0x32')]=qs[_0x51b8('0x32')](_0x46f2c4[_0x51b8('0x4c')]['offset']);}_0x287257[_0x51b8('0x52')]=qs[_0x51b8('0x53')](_0x46f2c4[_0x51b8('0x4c')][_0x51b8('0x53')]);_0x287257['where']=qs[_0x51b8('0x54')](_[_0x51b8('0x55')](_0x46f2c4['query'],_0x2a29a9[_0x51b8('0x54')]),_0xaed7d1);if(_0x46f2c4[_0x51b8('0x4c')][_0x51b8('0x56')]){_0x287257[_0x51b8('0x57')]=_[_0x51b8('0x58')](_0x287257[_0x51b8('0x57')],{'$or':_[_0x51b8('0x44')](_0xaed7d1,function(_0x3c00e7){if(_0x3c00e7[_0x51b8('0x48')]!=='VIRTUAL'){var _0x25efa8={};_0x25efa8[_0x3c00e7['name']]={'$like':'%'+_0x46f2c4[_0x51b8('0x4c')][_0x51b8('0x56')]+'%'};return _0x25efa8;}})});}_0x287257=_['merge']({},_0x287257,_0x46f2c4[_0x51b8('0x59')]);var _0x330448={'where':_0x287257[_0x51b8('0x57')]};return db[_0x51b8('0x45')]['count'](_0x330448)[_0x51b8('0x3c')](function(_0x37b23b){_0x4c5d92['count']=_0x37b23b;if(_0x46f2c4['query'][_0x51b8('0x5a')]){_0x287257[_0x51b8('0x5b')]=[{'all':!![]}];}return db[_0x51b8('0x45')]['findAll'](_0x287257);})[_0x51b8('0x3c')](function(_0xb92520){_0x4c5d92['rows']=_0xb92520;return _0x4c5d92;})[_0x51b8('0x3c')](respondWithFilteredResult(_0xe8ce0e,_0x287257))[_0x51b8('0x2d')](handleError(_0xe8ce0e,null));};exports['show']=function(_0x489c86,_0x3c8816){var _0x38f351={'raw':!![],'where':{'id':_0x489c86[_0x51b8('0x5c')]['id']}},_0x1112cb={};_0x1112cb['model']=_[_0x51b8('0x4b')](db['ChatQueue'][_0x51b8('0x46')]);_0x1112cb[_0x51b8('0x4c')]=_['keys'](_0x489c86['query']);_0x1112cb[_0x51b8('0x54')]=_[_0x51b8('0x4d')](_0x1112cb['model'],_0x1112cb[_0x51b8('0x4c')]);_0x38f351[_0x51b8('0x4e')]=_[_0x51b8('0x4d')](_0x1112cb[_0x51b8('0x4a')],qs[_0x51b8('0x4f')](_0x489c86[_0x51b8('0x4c')]['fields']));_0x38f351['attributes']=_0x38f351[_0x51b8('0x4e')][_0x51b8('0x50')]?_0x38f351['attributes']:_0x1112cb[_0x51b8('0x4a')];if(_0x489c86[_0x51b8('0x4c')][_0x51b8('0x5a')]){_0x38f351[_0x51b8('0x5b')]=[{'all':!![]}];}_0x38f351=_['merge']({},_0x38f351,_0x489c86[_0x51b8('0x59')]);return db['ChatQueue'][_0x51b8('0x5d')](_0x38f351)['then'](handleEntityNotFound(_0x3c8816,null))[_0x51b8('0x3c')](respondWithResult(_0x3c8816,null))[_0x51b8('0x2d')](handleError(_0x3c8816,null));};exports[_0x51b8('0x5e')]=function(_0x1b0c06,_0x42d2c7){return db[_0x51b8('0x45')][_0x51b8('0x5e')](_0x1b0c06['body'],{})[_0x51b8('0x3c')](function(_0x5071a8){var _0x33238b=_0x1b0c06[_0x51b8('0x5f')]['get']({'plain':!![]});if(!_0x33238b)throw new Error(_0x51b8('0x60'));if(_0x33238b[_0x51b8('0x61')]===_0x51b8('0x5f')){var _0x124832=_0x5071a8[_0x51b8('0x62')]({'plain':!![]});var _0x3babe2='ChatQueues';return db[_0x51b8('0x63')][_0x51b8('0x5d')]({'where':{'name':_0x3babe2,'userProfileId':_0x33238b[_0x51b8('0x64')]},'raw':!![]})['then'](function(_0x5e484f){if(_0x5e484f&&_0x5e484f['autoAssociation']===0x0){return db[_0x51b8('0x3f')][_0x51b8('0x5e')]({'name':_0x124832[_0x51b8('0x41')],'resourceId':_0x124832['id'],'type':_0x5e484f['name'],'sectionId':_0x5e484f['id']},{})[_0x51b8('0x3c')](function(){return _0x5071a8;});}else{return _0x5071a8;}})[_0x51b8('0x2d')](function(_0x1c84a7){logger[_0x51b8('0x29')](_0x51b8('0x65'),_0x1c84a7);throw _0x1c84a7;});}return _0x5071a8;})[_0x51b8('0x3c')](respondWithResult(_0x42d2c7,0xc9))['catch'](handleError(_0x42d2c7,null));};exports[_0x51b8('0x3b')]=function(_0x51d1f8,_0x256af3){if(_0x51d1f8[_0x51b8('0x66')]['id']){delete _0x51d1f8['body']['id'];}return db[_0x51b8('0x45')][_0x51b8('0x5d')]({'where':{'id':_0x51d1f8[_0x51b8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x256af3,null))[_0x51b8('0x3c')](saveUpdates(_0x51d1f8[_0x51b8('0x66')],null))[_0x51b8('0x3c')](respondWithResult(_0x256af3,null))[_0x51b8('0x2d')](handleError(_0x256af3,null));};exports['destroy']=function(_0x4db403,_0x12a462){return db[_0x51b8('0x45')][_0x51b8('0x5d')]({'where':{'id':_0x4db403['params']['id']}})[_0x51b8('0x3c')](handleEntityNotFound(_0x12a462,null))[_0x51b8('0x3c')](removeEntity(_0x12a462,null))[_0x51b8('0x2d')](handleError(_0x12a462,null));};exports['describe']=function(_0x24b02e,_0xd682ef){return db[_0x51b8('0x45')][_0x51b8('0x67')]()[_0x51b8('0x3c')](respondWithResult(_0xd682ef,null))[_0x51b8('0x2d')](handleError(_0xd682ef,null));};exports[_0x51b8('0x68')]=function(_0x4630bd,_0x3bbac5,_0x2c7489){var _0x40a62f={'raw':!![],'where':{}},_0x476822={},_0x1ce24e;return db['ChatQueue'][_0x51b8('0x69')]({'where':{'id':_0x4630bd[_0x51b8('0x5c')]['id']}})[_0x51b8('0x3c')](handleEntityNotFound(_0x3bbac5,null))[_0x51b8('0x3c')](function(_0x1bb71d){if(_0x1bb71d){_0x1ce24e=_0x1bb71d[_0x51b8('0x62')]({'plain':!![]});_0x476822[_0x51b8('0x4a')]=_[_0x51b8('0x4b')](db[_0x51b8('0x6a')][_0x51b8('0x46')]);_0x476822['query']=_[_0x51b8('0x4b')](_0x4630bd[_0x51b8('0x4c')]);_0x476822[_0x51b8('0x54')]=_[_0x51b8('0x4d')](_0x476822[_0x51b8('0x4a')],_0x476822['query']);_0x40a62f[_0x51b8('0x4e')]=_[_0x51b8('0x4d')](_0x476822[_0x51b8('0x4a')],qs[_0x51b8('0x4f')](_0x4630bd[_0x51b8('0x4c')][_0x51b8('0x4f')]));_0x40a62f[_0x51b8('0x4e')]=_0x40a62f[_0x51b8('0x4e')][_0x51b8('0x50')]?_0x40a62f[_0x51b8('0x4e')]:_0x476822[_0x51b8('0x4a')];if(!_0x4630bd[_0x51b8('0x4c')][_0x51b8('0x51')](_0x51b8('0x6b'))){_0x40a62f['limit']=qs[_0x51b8('0x34')](_0x4630bd[_0x51b8('0x4c')][_0x51b8('0x34')]);_0x40a62f[_0x51b8('0x32')]=qs[_0x51b8('0x32')](_0x4630bd['query']['offset']);}_0x40a62f[_0x51b8('0x52')]=qs[_0x51b8('0x53')](_0x4630bd['query'][_0x51b8('0x53')]);_0x40a62f[_0x51b8('0x57')]=qs[_0x51b8('0x54')](_[_0x51b8('0x55')](_0x4630bd[_0x51b8('0x4c')],_0x476822[_0x51b8('0x54')]));_0x40a62f['where'][_0x51b8('0x6c')]=_0x1bb71d['id'];if(_0x4630bd[_0x51b8('0x4c')]['filter']){_0x40a62f[_0x51b8('0x57')]=_[_0x51b8('0x58')](_0x40a62f[_0x51b8('0x57')],{'$or':_[_0x51b8('0x44')](_0x40a62f[_0x51b8('0x4e')],function(_0x159fc8){var _0x1eca89={};_0x1eca89[_0x159fc8]={'$like':'%'+_0x4630bd[_0x51b8('0x4c')]['filter']+'%'};return _0x1eca89;})});}_0x40a62f=_['merge']({},_0x40a62f,_0x4630bd[_0x51b8('0x59')]);return db[_0x51b8('0x6a')][_0x51b8('0x6d')](_0x40a62f);}})[_0x51b8('0x3c')](function(_0x39afb6){if(_0x39afb6){return db[_0x51b8('0x6e')]['findAndCountAll']({'where':{'id':_[_0x51b8('0x44')](_0x39afb6,_0x51b8('0x6f')),'role':'agent'},'attributes':['id',_0x51b8('0x41'),'chatPause',_0x51b8('0x70'),_0x51b8('0x71')]});}})[_0x51b8('0x3c')](function(_0x48a950){if(_0x48a950){return{'count':_0x48a950[_0x51b8('0x35')],'rows':_[_0x51b8('0x44')](_0x48a950[_0x51b8('0x72')],function(_0x420c22){return{'membername':_0x420c22[_0x51b8('0x41')],'UserId':_0x420c22['id'],'queue_name':_0x1ce24e[_0x51b8('0x41')],'ChatQueueId':_0x1ce24e['id'],'interface':util[_0x51b8('0x73')]('%s/%s',_0x51b8('0x74'),_0x420c22[_0x51b8('0x41')]),'penalty':0x0,'paused':_0x420c22[_0x51b8('0x75')],'createdAt':_0x420c22[_0x51b8('0x71')],'updatedAt':_0x420c22['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x51b8('0x3c')](respondWithFilteredResult(_0x3bbac5,_0x40a62f))[_0x51b8('0x2d')](handleError(_0x3bbac5,null));};exports[_0x51b8('0x76')]=function(_0x938b8e,_0x5384f5,_0x51dd74){var _0x2788c6={};var _0x44d9cd={};var _0x10eab5;var _0x31d71a;return db[_0x51b8('0x45')][_0x51b8('0x69')]({'where':{'id':_0x938b8e[_0x51b8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5384f5,null))[_0x51b8('0x3c')](function(_0x48717f){if(_0x48717f){_0x10eab5=_0x48717f;_0x44d9cd[_0x51b8('0x4a')]=_[_0x51b8('0x4b')](db[_0x51b8('0x77')][_0x51b8('0x46')]);_0x44d9cd[_0x51b8('0x4c')]=_[_0x51b8('0x4b')](_0x938b8e[_0x51b8('0x4c')]);_0x44d9cd[_0x51b8('0x54')]=_[_0x51b8('0x4d')](_0x44d9cd['model'],_0x44d9cd[_0x51b8('0x4c')]);_0x2788c6[_0x51b8('0x4e')]=_[_0x51b8('0x4d')](_0x44d9cd[_0x51b8('0x4a')],qs[_0x51b8('0x4f')](_0x938b8e[_0x51b8('0x4c')][_0x51b8('0x4f')]));_0x2788c6['attributes']=_0x2788c6['attributes']['length']?_0x2788c6[_0x51b8('0x4e')]:_0x44d9cd['model'];_0x2788c6[_0x51b8('0x52')]=qs[_0x51b8('0x53')](_0x938b8e[_0x51b8('0x4c')][_0x51b8('0x53')]);_0x2788c6[_0x51b8('0x57')]=qs['filters'](_['pick'](_0x938b8e[_0x51b8('0x4c')],_0x44d9cd['filters']));if(_0x938b8e['query'][_0x51b8('0x56')]){_0x2788c6[_0x51b8('0x57')]=_[_0x51b8('0x58')](_0x2788c6[_0x51b8('0x57')],{'$or':_['map'](_0x2788c6[_0x51b8('0x4e')],function(_0x479fac){var _0x2dcb2f={};_0x2dcb2f[_0x479fac]={'$like':'%'+_0x938b8e[_0x51b8('0x4c')][_0x51b8('0x56')]+'%'};return _0x2dcb2f;})});}_0x2788c6=_['merge']({},_0x2788c6,_0x938b8e[_0x51b8('0x59')]);return _0x10eab5[_0x51b8('0x76')](_0x2788c6);}})['then'](function(_0x373785){if(_0x373785){_0x31d71a=_0x373785['length'];if(!_0x938b8e['query'][_0x51b8('0x51')](_0x51b8('0x6b'))){_0x2788c6['limit']=qs[_0x51b8('0x34')](_0x938b8e[_0x51b8('0x4c')][_0x51b8('0x34')]);_0x2788c6[_0x51b8('0x32')]=qs[_0x51b8('0x32')](_0x938b8e[_0x51b8('0x4c')][_0x51b8('0x32')]);}return _0x10eab5[_0x51b8('0x76')](_0x2788c6);}})['then'](function(_0x58769a){if(_0x58769a){return _0x58769a?{'count':_0x31d71a,'rows':_0x58769a}:null;}})[_0x51b8('0x3c')](respondWithResult(_0x5384f5,null))[_0x51b8('0x2d')](handleError(_0x5384f5,null));};exports['addTeams']=function(_0x522f6e,_0xdce85c,_0xa50b26){var _0xc2d9e9=_0x522f6e[_0x51b8('0x66')]['ids'];return db[_0x51b8('0x77')][_0x51b8('0x6d')]({'where':{'id':_0xc2d9e9},'attributes':['id'],'include':[{'model':db[_0x51b8('0x6e')],'as':_0x51b8('0x78'),'attributes':['id',_0x51b8('0x41'),_0x51b8('0x79'),_0x51b8('0x7a'),_0x51b8('0x7b')],'raw':!![]}]})[_0x51b8('0x3c')](function(_0x9364f6){if(_0x9364f6){var _0x56f6c5=_[_0x51b8('0x7c')](_0x9364f6,function(_0x5ee78f){var _0x4d529e=_0x5ee78f['get']({'plain':!![]});return _0x4d529e['Agents'];});return db[_0x51b8('0x45')][_0x51b8('0x5d')]({'where':{'id':_0x522f6e[_0x51b8('0x5c')]['id']}})[_0x51b8('0x3c')](function(_0x34199e){return db[_0x51b8('0x7d')][_0x51b8('0x7e')](function(_0x2205ab){return _0x34199e[_0x51b8('0x7f')](_0xc2d9e9,{'transaction':_0x2205ab})[_0x51b8('0x3c')](function(){return BPromise[_0x51b8('0x80')](_0x56f6c5,function(_0x505636){return db[_0x51b8('0x6a')][_0x51b8('0x81')]({'where':{'UserId':_0x505636['id'],'ChatQueueId':_0x522f6e[_0x51b8('0x5c')]['id']},'transaction':_0x2205ab});});})[_0x51b8('0x3c')](function(){_0x56f6c5[_0x51b8('0x82')](function(_0xa08824){socket[_0x51b8('0x83')](_0x51b8('0x84'),{'UserId':_0xa08824['id'],'ChatQueueId':_0x34199e['id']});});});});});}})['then'](respondWithStatusCode(_0xdce85c,null))['catch'](handleError(_0xdce85c,null));};exports[_0x51b8('0x85')]=function(_0x26183e,_0x22be28,_0x370d03){return db[_0x51b8('0x77')][_0x51b8('0x6d')]({'where':{'id':_0x26183e[_0x51b8('0x4c')][_0x51b8('0x86')]},'attributes':['id'],'include':[{'model':db[_0x51b8('0x6e')],'as':_0x51b8('0x78'),'attributes':['id'],'raw':!![]}]})[_0x51b8('0x3c')](handleEntityNotFound(_0x22be28,null))[_0x51b8('0x3c')](function(_0x36c7b8){var _0x17abfd=_[_0x51b8('0x44')](_0x36c7b8,'id');var _0x1aa617=[];var _0x325e49=[];var _0x4b7f25=squel['select']();_0x4b7f25[_0x51b8('0x87')](_0x51b8('0x88'))[_0x51b8('0x89')](_0x51b8('0x8a'),'tq')[_0x51b8('0x8b')](_0x51b8('0x8c'),'ut',_0x51b8('0x8d'))[_0x51b8('0x57')](_0x51b8('0x8e'),_0x26183e[_0x51b8('0x5c')]['id']);for(var _0x3f2ece=0x0;_0x3f2ece<_0x36c7b8[_0x51b8('0x50')];_0x3f2ece+=0x1){let _0x3eaf01=_0x36c7b8[_0x3f2ece];for(var _0x4ece71=0x0;_0x4ece71<_0x3eaf01[_0x51b8('0x78')][_0x51b8('0x50')];_0x4ece71+=0x1){let _0x14d785=_0x3eaf01[_0x51b8('0x78')][_0x4ece71];var _0x876a61=_0x4b7f25[_0x51b8('0x8f')]();_0x876a61[_0x51b8('0x57')](_0x51b8('0x90'),_0x14d785['id']);_0x325e49[_0x51b8('0x91')](db[_0x51b8('0x7d')][_0x51b8('0x4c')](_0x876a61[_0x51b8('0x92')](),{'type':db[_0x51b8('0x7d')][_0x51b8('0x93')][_0x51b8('0x94')]})['then'](function(_0x4a0f24){if(_0x4a0f24['length']===0x1){return _0x14d785['id'];}else{var _0x11a1d0=_[_0x51b8('0x95')](_[_0x51b8('0x44')](_0x4a0f24,'TeamId'),function(_0x4e7795){return _[_0x51b8('0x96')](_0x17abfd,_0x4e7795);});if(_0x11a1d0){return _0x14d785['id'];}}}));}}return BPromise[_0x51b8('0x97')](_0x325e49)['then'](function(_0x131faa){_0x1aa617=_(_0x1aa617)[_0x51b8('0x98')](_0x131faa)['compact']()[_0x51b8('0x99')]();return db['ChatQueue'][_0x51b8('0x5d')]({'where':{'id':_0x26183e[_0x51b8('0x5c')]['id']}})[_0x51b8('0x3c')](function(_0x11b2de){return db[_0x51b8('0x7d')][_0x51b8('0x7e')](function(_0x5efd7a){return _0x11b2de[_0x51b8('0x85')](_0x26183e['query'][_0x51b8('0x86')],{'transaction':_0x5efd7a})[_0x51b8('0x3c')](function(){if(!_[_0x51b8('0x9a')](_0x1aa617)){return _0x11b2de['removeAgents'](_0x1aa617,{'transaction':_0x5efd7a});}})['then'](function(){_0x1aa617[_0x51b8('0x82')](function(_0x15f855){socket[_0x51b8('0x83')]('userChatQueue:remove',{'UserId':_0x15f855,'ChatQueueId':_0x11b2de['id']});});});});});});})[_0x51b8('0x3c')](respondWithStatusCode(_0x22be28,null))[_0x51b8('0x2d')](handleError(_0x22be28,null));};exports[_0x51b8('0x9b')]=function(_0x4f60c7,_0xc1ff0d,_0x3478bb){return db['ChatQueue'][_0x51b8('0x5d')]({'where':{'id':_0x4f60c7['params']['id']}})[_0x51b8('0x3c')](handleEntityNotFound(_0xc1ff0d,null))[_0x51b8('0x3c')](function(_0x37838b){if(_0x37838b){return _0x37838b[_0x51b8('0x9b')](_0x4f60c7[_0x51b8('0x66')][_0x51b8('0x86')],_[_0x51b8('0x9c')](_0x4f60c7[_0x51b8('0x66')],[_0x51b8('0x86'),'id'])||{})['spread'](function(_0x52f565){for(var _0xaf072d=0x0;_0xaf072d<_0x4f60c7[_0x51b8('0x66')][_0x51b8('0x86')][_0x51b8('0x50')];_0xaf072d+=0x1){socket[_0x51b8('0x83')]('userChatQueue:save',{'UserId':Number(_0x4f60c7[_0x51b8('0x66')]['ids'][_0xaf072d]),'ChatQueueId':Number(_0x4f60c7[_0x51b8('0x5c')]['id'])});}return _0x52f565;});}})['then'](respondWithResult(_0xc1ff0d,null))[_0x51b8('0x2d')](handleError(_0xc1ff0d,null));};exports[_0x51b8('0x9d')]=function(_0x494a03,_0x252d55,_0x26aef0){return db[_0x51b8('0x45')][_0x51b8('0x5d')]({'where':{'id':_0x494a03[_0x51b8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x252d55,null))['then'](function(_0x3842f5){if(_0x3842f5){return _0x3842f5[_0x51b8('0x9d')](_0x494a03[_0x51b8('0x4c')]['ids'])[_0x51b8('0x3c')](function(){if(_['isArray'](_0x494a03['query'][_0x51b8('0x86')])){for(var _0x46c807=0x0;_0x46c807<_0x494a03['query'][_0x51b8('0x86')][_0x51b8('0x50')];_0x46c807+=0x1){socket[_0x51b8('0x83')](_0x51b8('0x9e'),{'UserId':Number(_0x494a03[_0x51b8('0x4c')][_0x51b8('0x86')][_0x46c807]),'ChatQueueId':Number(_0x494a03[_0x51b8('0x5c')]['id'])});}}else{socket[_0x51b8('0x83')](_0x51b8('0x9e'),{'UserId':Number(_0x494a03[_0x51b8('0x4c')][_0x51b8('0x86')]),'ChatQueueId':Number(_0x494a03[_0x51b8('0x5c')]['id'])});}});}})[_0x51b8('0x3c')](respondWithStatusCode(_0x252d55,null))['catch'](handleError(_0x252d55,null));};exports[_0x51b8('0x9f')]=function(_0x3c9203,_0x3d5e88,_0x45c061){var _0x489791={};var _0x29d0c8={};var _0x416fde;var _0x42f3ac;return db[_0x51b8('0x45')][_0x51b8('0x69')]({'where':{'id':_0x3c9203[_0x51b8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3d5e88,null))[_0x51b8('0x3c')](function(_0x13f32b){if(_0x13f32b){_0x416fde=_0x13f32b;_0x29d0c8[_0x51b8('0x4a')]=_[_0x51b8('0x4b')](db[_0x51b8('0x6e')]['rawAttributes']);_0x29d0c8[_0x51b8('0x4c')]=_['keys'](_0x3c9203['query']);_0x29d0c8[_0x51b8('0x54')]=_[_0x51b8('0x4d')](_0x29d0c8[_0x51b8('0x4a')],_0x29d0c8[_0x51b8('0x4c')]);_0x489791['attributes']=_[_0x51b8('0x4d')](_0x29d0c8[_0x51b8('0x4a')],qs[_0x51b8('0x4f')](_0x3c9203['query']['fields']));_0x489791[_0x51b8('0x4e')]=_0x489791['attributes'][_0x51b8('0x50')]?_0x489791['attributes']:_0x29d0c8[_0x51b8('0x4a')];_0x489791[_0x51b8('0x52')]=qs[_0x51b8('0x53')](_0x3c9203['query']['sort']);_0x489791[_0x51b8('0x57')]=qs[_0x51b8('0x54')](_['pick'](_0x3c9203['query'],_0x29d0c8[_0x51b8('0x54')]));if(_0x3c9203[_0x51b8('0x4c')][_0x51b8('0x56')]){_0x489791['where']=_['merge'](_0x489791['where'],{'$or':_[_0x51b8('0x44')](_0x489791[_0x51b8('0x4e')],function(_0x4c2fbe){var _0x2f3026={};_0x2f3026[_0x4c2fbe]={'$like':'%'+_0x3c9203[_0x51b8('0x4c')][_0x51b8('0x56')]+'%'};return _0x2f3026;})});}_0x489791=_[_0x51b8('0x58')]({},_0x489791,_0x3c9203['options']);return _0x416fde[_0x51b8('0x9f')](_0x489791);}})[_0x51b8('0x3c')](function(_0x56d896){if(_0x56d896){_0x42f3ac=_0x56d896['length'];if(!_0x3c9203[_0x51b8('0x4c')][_0x51b8('0x51')]('nolimit')){_0x489791[_0x51b8('0x34')]=qs[_0x51b8('0x34')](_0x3c9203[_0x51b8('0x4c')][_0x51b8('0x34')]);_0x489791[_0x51b8('0x32')]=qs[_0x51b8('0x32')](_0x3c9203[_0x51b8('0x4c')]['offset']);}return _0x416fde['getAgents'](_0x489791);}})[_0x51b8('0x3c')](function(_0x420889){if(_0x420889){return _0x420889?{'count':_0x42f3ac,'rows':_0x420889}:null;}})[_0x51b8('0x3c')](respondWithResult(_0x3d5e88,null))[_0x51b8('0x2d')](handleError(_0x3d5e88,null));}; \ No newline at end of file +var _0x3e3e=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','get','ChatQueues','UserProfileResource','destroy','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','count','includeAll','include','findAll','rows','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserChatQueue','ChatQueueId','User','findAndCountAll','UserId','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','userChatQueue:save','select','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','every','TeamId','all','union','compact','removeTeams','ids','isEmpty','forEach','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','emit','getAgents','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x118afa,_0x4bf0c1){var _0x167d76=function(_0x2c529b){while(--_0x2c529b){_0x118afa['push'](_0x118afa['shift']());}};_0x167d76(++_0x4bf0c1);}(_0x3e3e,0x1bc));var _0xe3e3=function(_0x463da4,_0x1a4968){_0x463da4=_0x463da4-0x0;var _0x433887=_0x3e3e[_0x463da4];return _0x433887;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe3e3('0x0'));var zipdir=require(_0xe3e3('0x1'));var jsonpatch=require(_0xe3e3('0x2'));var rp=require(_0xe3e3('0x3'));var moment=require(_0xe3e3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe3e3('0x5'));var util=require(_0xe3e3('0x6'));var path=require(_0xe3e3('0x7'));var sox=require(_0xe3e3('0x8'));var csv=require('to-csv');var ejs=require(_0xe3e3('0x9'));var fs=require('fs');var fs_extra=require(_0xe3e3('0xa'));var _=require('lodash');var squel=require(_0xe3e3('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe3e3('0xc'));var Papa=require(_0xe3e3('0xd'));var Redis=require(_0xe3e3('0xe'));var authService=require(_0xe3e3('0xf'));var qs=require(_0xe3e3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3e3('0x11'));var logger=require(_0xe3e3('0x12'))(_0xe3e3('0x13'));var utils=require(_0xe3e3('0x14'));var config=require(_0xe3e3('0x15'));var licenseUtil=require(_0xe3e3('0x16'));var db=require(_0xe3e3('0x17'))['db'];config[_0xe3e3('0x18')]=_[_0xe3e3('0x19')](config[_0xe3e3('0x18')],{'host':_0xe3e3('0x1a'),'port':0x18eb});var socket=require(_0xe3e3('0x1b'))(new Redis(config[_0xe3e3('0x18')]));require(_0xe3e3('0x1c'))[_0xe3e3('0x1d')](socket);var jayson=require(_0xe3e3('0x1e'));var client=jayson['client'][_0xe3e3('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x608c54,_0x3454ec,_0xcf0b8b,_0x5a76df){return new BPromise(function(_0x1f8af4,_0x52be7e){var _0x1c96b7=_0x5a76df||client;return _0x1c96b7[_0xe3e3('0x20')](_0x608c54,_0xcf0b8b)[_0xe3e3('0x21')](function(_0x1a794c){logger[_0xe3e3('0x22')](_0xe3e3('0x23'),_0x3454ec,_0xe3e3('0x24'));logger[_0xe3e3('0x25')](_0xe3e3('0x26'),_0x3454ec,_0xe3e3('0x24'),JSON[_0xe3e3('0x27')](_0x1a794c));if(_0x1a794c[_0xe3e3('0x28')]){if(_0x1a794c[_0xe3e3('0x28')][_0xe3e3('0x29')]===0x1f4){logger[_0xe3e3('0x28')](_0xe3e3('0x23'),_0x3454ec,_0x1a794c[_0xe3e3('0x28')][_0xe3e3('0x2a')]);return _0x52be7e(_0x1a794c['error'][_0xe3e3('0x2a')]);}logger[_0xe3e3('0x28')](_0xe3e3('0x23'),_0x3454ec,_0x1a794c['error'][_0xe3e3('0x2a')]);return _0x1f8af4(_0x1a794c[_0xe3e3('0x28')][_0xe3e3('0x2a')]);}else{logger[_0xe3e3('0x22')](_0xe3e3('0x23'),_0x3454ec,_0xe3e3('0x24'));_0x1f8af4(_0x1a794c[_0xe3e3('0x2b')][_0xe3e3('0x2a')]);}})[_0xe3e3('0x2c')](function(_0x8234db){logger['error']('ChatQueue,\x20%s,\x20%s',_0x3454ec,_0x8234db);_0x52be7e(_0x8234db);});});}function respondWithStatusCode(_0x7b8dad,_0x41d07e){_0x41d07e=_0x41d07e||0xcc;return function(_0xcd94c6){if(_0xcd94c6){return _0x7b8dad[_0xe3e3('0x2d')](_0x41d07e);}return _0x7b8dad[_0xe3e3('0x2e')](_0x41d07e)[_0xe3e3('0x2f')]();};}function respondWithResult(_0x22e36e,_0x6ee75b){_0x6ee75b=_0x6ee75b||0xc8;return function(_0x2e7e1a){if(_0x2e7e1a){return _0x22e36e[_0xe3e3('0x2e')](_0x6ee75b)['json'](_0x2e7e1a);}};}function respondWithFilteredResult(_0x53d945,_0x432ec2){return function(_0x59c0ff){if(_0x59c0ff){var _0x3b64c9=typeof _0x432ec2[_0xe3e3('0x30')]===_0xe3e3('0x31')&&typeof _0x432ec2[_0xe3e3('0x32')]==='undefined';var _0x45c213=_0x59c0ff['count'];var _0x58e5bf=_0x3b64c9?0x0:_0x432ec2[_0xe3e3('0x30')];var _0x368d46=_0x3b64c9?_0x59c0ff['count']:_0x432ec2['offset']+_0x432ec2[_0xe3e3('0x32')];var _0xa93410;if(_0x368d46>=_0x45c213){_0x368d46=_0x45c213;_0xa93410=0xc8;}else{_0xa93410=0xce;}_0x53d945[_0xe3e3('0x2e')](_0xa93410);return _0x53d945[_0xe3e3('0x33')](_0xe3e3('0x34'),_0x58e5bf+'-'+_0x368d46+'/'+_0x45c213)[_0xe3e3('0x35')](_0x59c0ff);}return null;};}function patchUpdates(_0x1d0594){return function(_0x32b434){try{jsonpatch[_0xe3e3('0x36')](_0x32b434,_0x1d0594,!![]);}catch(_0xf4615a){return BPromise[_0xe3e3('0x37')](_0xf4615a);}return _0x32b434[_0xe3e3('0x38')]();};}function saveUpdates(_0x2d06ee,_0xd4bc39){return function(_0x2e5647){if(_0x2e5647){return _0x2e5647[_0xe3e3('0x39')](_0x2d06ee)[_0xe3e3('0x21')](function(_0x47c1b8){return _0x47c1b8;});}return null;};}function removeEntity(_0x366412,_0x515c56){return function(_0x4f4894){if(_0x4f4894){return _0x4f4894['destroy']()[_0xe3e3('0x21')](function(){var _0x21ed9c=_0x4f4894[_0xe3e3('0x3a')]({'plain':!![]});var _0x3400ac=_0xe3e3('0x3b');return db[_0xe3e3('0x3c')][_0xe3e3('0x3d')]({'where':{'type':_0x3400ac,'resourceId':_0x21ed9c['id']}})[_0xe3e3('0x21')](function(){return _0x4f4894;});})[_0xe3e3('0x21')](function(){_0x366412[_0xe3e3('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47bfa9,_0x844f01){return function(_0x4014f4){if(!_0x4014f4){_0x47bfa9[_0xe3e3('0x2d')](0x194);}return _0x4014f4;};}function handleError(_0x3afef6,_0x417c6f){_0x417c6f=_0x417c6f||0x1f4;return function(_0x448f45){logger[_0xe3e3('0x28')](_0x448f45[_0xe3e3('0x3e')]);if(_0x448f45[_0xe3e3('0x3f')]){delete _0x448f45[_0xe3e3('0x3f')];}_0x3afef6[_0xe3e3('0x2e')](_0x417c6f)[_0xe3e3('0x40')](_0x448f45);};}exports[_0xe3e3('0x41')]=function(_0x4beadd,_0x488bc5){var _0xf0bf28={},_0x41c5c7={},_0x497dc2={'count':0x0,'rows':[]};var _0x45ed19=_[_0xe3e3('0x42')](db[_0xe3e3('0x43')][_0xe3e3('0x44')],function(_0x2b994e){return{'name':_0x2b994e[_0xe3e3('0x45')],'type':_0x2b994e[_0xe3e3('0x46')][_0xe3e3('0x47')]};});_0x41c5c7[_0xe3e3('0x48')]=_[_0xe3e3('0x42')](_0x45ed19,'name');_0x41c5c7['query']=_[_0xe3e3('0x49')](_0x4beadd[_0xe3e3('0x4a')]);_0x41c5c7[_0xe3e3('0x4b')]=_[_0xe3e3('0x4c')](_0x41c5c7['model'],_0x41c5c7[_0xe3e3('0x4a')]);_0xf0bf28[_0xe3e3('0x4d')]=_['intersection'](_0x41c5c7[_0xe3e3('0x48')],qs[_0xe3e3('0x4e')](_0x4beadd[_0xe3e3('0x4a')][_0xe3e3('0x4e')]));_0xf0bf28[_0xe3e3('0x4d')]=_0xf0bf28[_0xe3e3('0x4d')][_0xe3e3('0x4f')]?_0xf0bf28[_0xe3e3('0x4d')]:_0x41c5c7[_0xe3e3('0x48')];if(!_0x4beadd[_0xe3e3('0x4a')][_0xe3e3('0x50')](_0xe3e3('0x51'))){_0xf0bf28[_0xe3e3('0x32')]=qs[_0xe3e3('0x32')](_0x4beadd[_0xe3e3('0x4a')]['limit']);_0xf0bf28[_0xe3e3('0x30')]=qs['offset'](_0x4beadd[_0xe3e3('0x4a')][_0xe3e3('0x30')]);}_0xf0bf28[_0xe3e3('0x52')]=qs[_0xe3e3('0x53')](_0x4beadd[_0xe3e3('0x4a')]['sort']);_0xf0bf28['where']=qs[_0xe3e3('0x4b')](_[_0xe3e3('0x54')](_0x4beadd[_0xe3e3('0x4a')],_0x41c5c7[_0xe3e3('0x4b')]),_0x45ed19);if(_0x4beadd['query'][_0xe3e3('0x55')]){_0xf0bf28[_0xe3e3('0x56')]=_[_0xe3e3('0x57')](_0xf0bf28['where'],{'$or':_[_0xe3e3('0x42')](_0x45ed19,function(_0x17f20d){if(_0x17f20d[_0xe3e3('0x46')]!=='VIRTUAL'){var _0x2f74c={};_0x2f74c[_0x17f20d[_0xe3e3('0x3f')]]={'$like':'%'+_0x4beadd[_0xe3e3('0x4a')][_0xe3e3('0x55')]+'%'};return _0x2f74c;}})});}_0xf0bf28=_[_0xe3e3('0x57')]({},_0xf0bf28,_0x4beadd['options']);var _0x516e85={'where':_0xf0bf28[_0xe3e3('0x56')]};return db[_0xe3e3('0x43')][_0xe3e3('0x58')](_0x516e85)[_0xe3e3('0x21')](function(_0x35b3d8){_0x497dc2['count']=_0x35b3d8;if(_0x4beadd['query'][_0xe3e3('0x59')]){_0xf0bf28[_0xe3e3('0x5a')]=[{'all':!![]}];}return db[_0xe3e3('0x43')][_0xe3e3('0x5b')](_0xf0bf28);})[_0xe3e3('0x21')](function(_0x397eb0){_0x497dc2[_0xe3e3('0x5c')]=_0x397eb0;return _0x497dc2;})['then'](respondWithFilteredResult(_0x488bc5,_0xf0bf28))[_0xe3e3('0x2c')](handleError(_0x488bc5,null));};exports[_0xe3e3('0x5d')]=function(_0x19fd98,_0x3270c1){var _0x2af0c8={'raw':!![],'where':{'id':_0x19fd98[_0xe3e3('0x5e')]['id']}},_0x338af8={};_0x338af8[_0xe3e3('0x48')]=_[_0xe3e3('0x49')](db[_0xe3e3('0x43')][_0xe3e3('0x44')]);_0x338af8[_0xe3e3('0x4a')]=_[_0xe3e3('0x49')](_0x19fd98[_0xe3e3('0x4a')]);_0x338af8['filters']=_[_0xe3e3('0x4c')](_0x338af8[_0xe3e3('0x48')],_0x338af8[_0xe3e3('0x4a')]);_0x2af0c8[_0xe3e3('0x4d')]=_['intersection'](_0x338af8[_0xe3e3('0x48')],qs[_0xe3e3('0x4e')](_0x19fd98[_0xe3e3('0x4a')][_0xe3e3('0x4e')]));_0x2af0c8[_0xe3e3('0x4d')]=_0x2af0c8[_0xe3e3('0x4d')][_0xe3e3('0x4f')]?_0x2af0c8['attributes']:_0x338af8[_0xe3e3('0x48')];if(_0x19fd98['query'][_0xe3e3('0x59')]){_0x2af0c8[_0xe3e3('0x5a')]=[{'all':!![]}];}_0x2af0c8=_['merge']({},_0x2af0c8,_0x19fd98[_0xe3e3('0x5f')]);return db[_0xe3e3('0x43')][_0xe3e3('0x60')](_0x2af0c8)[_0xe3e3('0x21')](handleEntityNotFound(_0x3270c1,null))[_0xe3e3('0x21')](respondWithResult(_0x3270c1,null))[_0xe3e3('0x2c')](handleError(_0x3270c1,null));};exports['create']=function(_0x3fff25,_0x5379b5){return db[_0xe3e3('0x43')][_0xe3e3('0x61')](_0x3fff25[_0xe3e3('0x62')],{})[_0xe3e3('0x21')](function(_0x2fa13f){var _0x26fd76=_0x3fff25['user'][_0xe3e3('0x3a')]({'plain':!![]});if(!_0x26fd76)throw new Error(_0xe3e3('0x63'));if(_0x26fd76[_0xe3e3('0x64')]===_0xe3e3('0x65')){var _0x3aac1f=_0x2fa13f[_0xe3e3('0x3a')]({'plain':!![]});var _0x44879f=_0xe3e3('0x3b');return db['UserProfileSection'][_0xe3e3('0x60')]({'where':{'name':_0x44879f,'userProfileId':_0x26fd76['userProfileId']},'raw':!![]})[_0xe3e3('0x21')](function(_0x57f273){if(_0x57f273&&_0x57f273[_0xe3e3('0x66')]===0x0){return db[_0xe3e3('0x3c')][_0xe3e3('0x61')]({'name':_0x3aac1f[_0xe3e3('0x3f')],'resourceId':_0x3aac1f['id'],'type':_0x57f273[_0xe3e3('0x3f')],'sectionId':_0x57f273['id']},{})['then'](function(){return _0x2fa13f;});}else{return _0x2fa13f;}})[_0xe3e3('0x2c')](function(_0x30707a){logger[_0xe3e3('0x28')](_0xe3e3('0x67'),_0x30707a);throw _0x30707a;});}return _0x2fa13f;})[_0xe3e3('0x21')](respondWithResult(_0x5379b5,0xc9))[_0xe3e3('0x2c')](handleError(_0x5379b5,null));};exports[_0xe3e3('0x39')]=function(_0x2b5bbd,_0x4181ed){if(_0x2b5bbd[_0xe3e3('0x62')]['id']){delete _0x2b5bbd['body']['id'];}return db[_0xe3e3('0x43')][_0xe3e3('0x60')]({'where':{'id':_0x2b5bbd['params']['id']}})['then'](handleEntityNotFound(_0x4181ed,null))[_0xe3e3('0x21')](saveUpdates(_0x2b5bbd[_0xe3e3('0x62')],null))[_0xe3e3('0x21')](respondWithResult(_0x4181ed,null))[_0xe3e3('0x2c')](handleError(_0x4181ed,null));};exports[_0xe3e3('0x3d')]=function(_0x3bfd21,_0xf75993){return db['ChatQueue']['find']({'where':{'id':_0x3bfd21[_0xe3e3('0x5e')]['id']}})[_0xe3e3('0x21')](handleEntityNotFound(_0xf75993,null))[_0xe3e3('0x21')](removeEntity(_0xf75993,null))[_0xe3e3('0x2c')](handleError(_0xf75993,null));};exports[_0xe3e3('0x68')]=function(_0x50c810,_0x544361){return db[_0xe3e3('0x43')][_0xe3e3('0x68')]()['then'](respondWithResult(_0x544361,null))[_0xe3e3('0x2c')](handleError(_0x544361,null));};exports['getMembers']=function(_0x37d2f7,_0x4bcbe2,_0x3878c6){var _0x970f8e={'raw':!![],'where':{}},_0x146206={},_0x3c6c62;return db[_0xe3e3('0x43')]['findOne']({'where':{'id':_0x37d2f7['params']['id']}})[_0xe3e3('0x21')](handleEntityNotFound(_0x4bcbe2,null))[_0xe3e3('0x21')](function(_0x5a1c98){if(_0x5a1c98){_0x3c6c62=_0x5a1c98[_0xe3e3('0x3a')]({'plain':!![]});_0x146206['model']=_[_0xe3e3('0x49')](db[_0xe3e3('0x69')][_0xe3e3('0x44')]);_0x146206[_0xe3e3('0x4a')]=_[_0xe3e3('0x49')](_0x37d2f7[_0xe3e3('0x4a')]);_0x146206[_0xe3e3('0x4b')]=_['intersection'](_0x146206[_0xe3e3('0x48')],_0x146206[_0xe3e3('0x4a')]);_0x970f8e[_0xe3e3('0x4d')]=_['intersection'](_0x146206[_0xe3e3('0x48')],qs[_0xe3e3('0x4e')](_0x37d2f7[_0xe3e3('0x4a')][_0xe3e3('0x4e')]));_0x970f8e['attributes']=_0x970f8e[_0xe3e3('0x4d')][_0xe3e3('0x4f')]?_0x970f8e['attributes']:_0x146206['model'];if(!_0x37d2f7[_0xe3e3('0x4a')][_0xe3e3('0x50')]('nolimit')){_0x970f8e[_0xe3e3('0x32')]=qs['limit'](_0x37d2f7[_0xe3e3('0x4a')][_0xe3e3('0x32')]);_0x970f8e[_0xe3e3('0x30')]=qs[_0xe3e3('0x30')](_0x37d2f7[_0xe3e3('0x4a')][_0xe3e3('0x30')]);}_0x970f8e[_0xe3e3('0x52')]=qs[_0xe3e3('0x53')](_0x37d2f7[_0xe3e3('0x4a')][_0xe3e3('0x53')]);_0x970f8e[_0xe3e3('0x56')]=qs[_0xe3e3('0x4b')](_[_0xe3e3('0x54')](_0x37d2f7[_0xe3e3('0x4a')],_0x146206['filters']));_0x970f8e['where'][_0xe3e3('0x6a')]=_0x5a1c98['id'];if(_0x37d2f7[_0xe3e3('0x4a')][_0xe3e3('0x55')]){_0x970f8e[_0xe3e3('0x56')]=_[_0xe3e3('0x57')](_0x970f8e['where'],{'$or':_[_0xe3e3('0x42')](_0x970f8e[_0xe3e3('0x4d')],function(_0x33b49d){var _0x57b312={};_0x57b312[_0x33b49d]={'$like':'%'+_0x37d2f7[_0xe3e3('0x4a')][_0xe3e3('0x55')]+'%'};return _0x57b312;})});}_0x970f8e=_['merge']({},_0x970f8e,_0x37d2f7[_0xe3e3('0x5f')]);return db[_0xe3e3('0x69')][_0xe3e3('0x5b')](_0x970f8e);}})[_0xe3e3('0x21')](function(_0xa17ee7){if(_0xa17ee7){return db[_0xe3e3('0x6b')][_0xe3e3('0x6c')]({'where':{'id':_[_0xe3e3('0x42')](_0xa17ee7,_0xe3e3('0x6d')),'role':'agent'},'attributes':['id','name',_0xe3e3('0x6e'),_0xe3e3('0x6f'),_0xe3e3('0x70')]});}})[_0xe3e3('0x21')](function(_0x245f00){if(_0x245f00){return{'count':_0x245f00[_0xe3e3('0x58')],'rows':_[_0xe3e3('0x42')](_0x245f00[_0xe3e3('0x5c')],function(_0x1885bb){return{'membername':_0x1885bb[_0xe3e3('0x3f')],'UserId':_0x1885bb['id'],'queue_name':_0x3c6c62['name'],'ChatQueueId':_0x3c6c62['id'],'interface':util[_0xe3e3('0x71')](_0xe3e3('0x72'),_0xe3e3('0x73'),_0x1885bb['name']),'penalty':0x0,'paused':_0x1885bb['chatPause'],'createdAt':_0x1885bb[_0xe3e3('0x70')],'updatedAt':_0x1885bb[_0xe3e3('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe3e3('0x21')](respondWithFilteredResult(_0x4bcbe2,_0x970f8e))['catch'](handleError(_0x4bcbe2,null));};exports['getTeams']=function(_0x1be925,_0x29273d,_0x2b827f){var _0x45f020={};var _0x4dd82d={};var _0x86cb8;var _0x533815;return db[_0xe3e3('0x43')]['findOne']({'where':{'id':_0x1be925['params']['id']}})[_0xe3e3('0x21')](handleEntityNotFound(_0x29273d,null))[_0xe3e3('0x21')](function(_0x18b9f7){if(_0x18b9f7){_0x86cb8=_0x18b9f7;_0x4dd82d[_0xe3e3('0x48')]=_[_0xe3e3('0x49')](db['Team'][_0xe3e3('0x44')]);_0x4dd82d['query']=_[_0xe3e3('0x49')](_0x1be925[_0xe3e3('0x4a')]);_0x4dd82d[_0xe3e3('0x4b')]=_['intersection'](_0x4dd82d[_0xe3e3('0x48')],_0x4dd82d[_0xe3e3('0x4a')]);_0x45f020[_0xe3e3('0x4d')]=_[_0xe3e3('0x4c')](_0x4dd82d[_0xe3e3('0x48')],qs[_0xe3e3('0x4e')](_0x1be925[_0xe3e3('0x4a')][_0xe3e3('0x4e')]));_0x45f020[_0xe3e3('0x4d')]=_0x45f020[_0xe3e3('0x4d')]['length']?_0x45f020['attributes']:_0x4dd82d[_0xe3e3('0x48')];_0x45f020[_0xe3e3('0x52')]=qs['sort'](_0x1be925['query'][_0xe3e3('0x53')]);_0x45f020[_0xe3e3('0x56')]=qs[_0xe3e3('0x4b')](_['pick'](_0x1be925['query'],_0x4dd82d[_0xe3e3('0x4b')]));if(_0x1be925[_0xe3e3('0x4a')][_0xe3e3('0x55')]){_0x45f020[_0xe3e3('0x56')]=_['merge'](_0x45f020[_0xe3e3('0x56')],{'$or':_[_0xe3e3('0x42')](_0x45f020[_0xe3e3('0x4d')],function(_0x1ce5fa){var _0x25686e={};_0x25686e[_0x1ce5fa]={'$like':'%'+_0x1be925[_0xe3e3('0x4a')][_0xe3e3('0x55')]+'%'};return _0x25686e;})});}_0x45f020=_[_0xe3e3('0x57')]({},_0x45f020,_0x1be925[_0xe3e3('0x5f')]);return _0x86cb8['getTeams'](_0x45f020);}})[_0xe3e3('0x21')](function(_0x5c0fd3){if(_0x5c0fd3){_0x533815=_0x5c0fd3['length'];if(!_0x1be925[_0xe3e3('0x4a')][_0xe3e3('0x50')](_0xe3e3('0x51'))){_0x45f020['limit']=qs[_0xe3e3('0x32')](_0x1be925[_0xe3e3('0x4a')][_0xe3e3('0x32')]);_0x45f020[_0xe3e3('0x30')]=qs[_0xe3e3('0x30')](_0x1be925['query'][_0xe3e3('0x30')]);}return _0x86cb8[_0xe3e3('0x74')](_0x45f020);}})['then'](function(_0x74ae41){if(_0x74ae41){return _0x74ae41?{'count':_0x533815,'rows':_0x74ae41}:null;}})[_0xe3e3('0x21')](respondWithResult(_0x29273d,null))['catch'](handleError(_0x29273d,null));};exports[_0xe3e3('0x75')]=function(_0x131a3d,_0x18759d,_0x538b35){var _0x1d1ecb=_0x131a3d[_0xe3e3('0x62')]['ids'];return db[_0xe3e3('0x76')][_0xe3e3('0x5b')]({'where':{'id':_0x1d1ecb},'attributes':['id'],'include':[{'model':db[_0xe3e3('0x6b')],'as':_0xe3e3('0x77'),'attributes':['id',_0xe3e3('0x3f'),'online',_0xe3e3('0x78'),_0xe3e3('0x79')],'raw':!![]}]})[_0xe3e3('0x21')](function(_0x572af1){if(_0x572af1){var _0x561228=_[_0xe3e3('0x7a')](_0x572af1,function(_0x35cd0c){var _0x40ef99=_0x35cd0c[_0xe3e3('0x3a')]({'plain':!![]});return _0x40ef99[_0xe3e3('0x77')];});return db[_0xe3e3('0x43')][_0xe3e3('0x60')]({'where':{'id':_0x131a3d[_0xe3e3('0x5e')]['id']}})[_0xe3e3('0x21')](function(_0x36e314){return db[_0xe3e3('0x7b')][_0xe3e3('0x7c')](function(_0x215748){return _0x36e314[_0xe3e3('0x75')](_0x1d1ecb,{'transaction':_0x215748})[_0xe3e3('0x21')](function(){return BPromise[_0xe3e3('0x7d')](_0x561228,function(_0x3fe199){return db['UserChatQueue'][_0xe3e3('0x7e')]({'where':{'UserId':_0x3fe199['id'],'ChatQueueId':_0x131a3d['params']['id']},'transaction':_0x215748});});})[_0xe3e3('0x21')](function(){_0x561228['forEach'](function(_0x4feff7){socket['emit'](_0xe3e3('0x7f'),{'UserId':_0x4feff7['id'],'ChatQueueId':_0x36e314['id']});});});});});}})['then'](respondWithStatusCode(_0x18759d,null))[_0xe3e3('0x2c')](handleError(_0x18759d,null));};exports['removeTeams']=function(_0x3991b2,_0xdda48e,_0xa2ddc1){return db[_0xe3e3('0x76')][_0xe3e3('0x5b')]({'where':{'id':_0x3991b2['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe3e3('0x77'),'attributes':['id'],'raw':!![]}]})[_0xe3e3('0x21')](handleEntityNotFound(_0xdda48e,null))[_0xe3e3('0x21')](function(_0x2d1ab8){var _0x1f776e=_[_0xe3e3('0x42')](_0x2d1ab8,'id');var _0xf6c2c2=[];var _0xd7f33c=[];var _0x4345cd=squel[_0xe3e3('0x80')]();_0x4345cd[_0xe3e3('0x81')](_0xe3e3('0x82'))['from']('team_has_chat_queues','tq')[_0xe3e3('0x83')]('user_has_teams','ut',_0xe3e3('0x84'))[_0xe3e3('0x56')](_0xe3e3('0x85'),_0x3991b2['params']['id']);for(var _0x53f7e6=0x0;_0x53f7e6<_0x2d1ab8[_0xe3e3('0x4f')];_0x53f7e6+=0x1){let _0x51a1ee=_0x2d1ab8[_0x53f7e6];for(var _0x2d0915=0x0;_0x2d0915<_0x51a1ee[_0xe3e3('0x77')][_0xe3e3('0x4f')];_0x2d0915+=0x1){let _0x2ae9f4=_0x51a1ee[_0xe3e3('0x77')][_0x2d0915];var _0x55c1b8=_0x4345cd[_0xe3e3('0x86')]();_0x55c1b8[_0xe3e3('0x56')](_0xe3e3('0x87'),_0x2ae9f4['id']);_0xd7f33c[_0xe3e3('0x88')](db['sequelize'][_0xe3e3('0x4a')](_0x55c1b8['toString'](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0xe3e3('0x21')](function(_0x513044){if(_0x513044[_0xe3e3('0x4f')]===0x1){return _0x2ae9f4['id'];}else{var _0x1e45f=_[_0xe3e3('0x89')](_['map'](_0x513044,_0xe3e3('0x8a')),function(_0x14fd67){return _['includes'](_0x1f776e,_0x14fd67);});if(_0x1e45f){return _0x2ae9f4['id'];}}}));}}return BPromise[_0xe3e3('0x8b')](_0xd7f33c)[_0xe3e3('0x21')](function(_0x18b113){_0xf6c2c2=_(_0xf6c2c2)[_0xe3e3('0x8c')](_0x18b113)[_0xe3e3('0x8d')]()['value']();return db[_0xe3e3('0x43')][_0xe3e3('0x60')]({'where':{'id':_0x3991b2['params']['id']}})['then'](function(_0x1f9003){return db[_0xe3e3('0x7b')][_0xe3e3('0x7c')](function(_0x5712ca){return _0x1f9003[_0xe3e3('0x8e')](_0x3991b2['query'][_0xe3e3('0x8f')],{'transaction':_0x5712ca})[_0xe3e3('0x21')](function(){if(!_[_0xe3e3('0x90')](_0xf6c2c2)){return _0x1f9003['removeAgents'](_0xf6c2c2,{'transaction':_0x5712ca});}})[_0xe3e3('0x21')](function(){_0xf6c2c2[_0xe3e3('0x91')](function(_0x1f99b6){socket['emit'](_0xe3e3('0x92'),{'UserId':_0x1f99b6,'ChatQueueId':_0x1f9003['id']});});});});});});})[_0xe3e3('0x21')](respondWithStatusCode(_0xdda48e,null))['catch'](handleError(_0xdda48e,null));};exports[_0xe3e3('0x93')]=function(_0x3df0e5,_0x4d8d87,_0xdaebc3){return db[_0xe3e3('0x43')][_0xe3e3('0x60')]({'where':{'id':_0x3df0e5[_0xe3e3('0x5e')]['id']}})[_0xe3e3('0x21')](handleEntityNotFound(_0x4d8d87,null))[_0xe3e3('0x21')](function(_0x2014b1){if(_0x2014b1){return _0x2014b1[_0xe3e3('0x93')](_0x3df0e5[_0xe3e3('0x62')][_0xe3e3('0x8f')],_[_0xe3e3('0x94')](_0x3df0e5[_0xe3e3('0x62')],[_0xe3e3('0x8f'),'id'])||{})[_0xe3e3('0x95')](function(_0x376584){for(var _0x465df2=0x0;_0x465df2<_0x3df0e5[_0xe3e3('0x62')][_0xe3e3('0x8f')][_0xe3e3('0x4f')];_0x465df2+=0x1){socket['emit'](_0xe3e3('0x7f'),{'UserId':Number(_0x3df0e5[_0xe3e3('0x62')]['ids'][_0x465df2]),'ChatQueueId':Number(_0x3df0e5[_0xe3e3('0x5e')]['id'])});}return _0x376584;});}})[_0xe3e3('0x21')](respondWithResult(_0x4d8d87,null))[_0xe3e3('0x2c')](handleError(_0x4d8d87,null));};exports[_0xe3e3('0x96')]=function(_0x3bf778,_0x467e54,_0x18538c){return db[_0xe3e3('0x43')]['find']({'where':{'id':_0x3bf778[_0xe3e3('0x5e')]['id']}})['then'](handleEntityNotFound(_0x467e54,null))['then'](function(_0x1eaf65){if(_0x1eaf65){return _0x1eaf65[_0xe3e3('0x96')](_0x3bf778[_0xe3e3('0x4a')][_0xe3e3('0x8f')])[_0xe3e3('0x21')](function(){if(_[_0xe3e3('0x97')](_0x3bf778['query']['ids'])){for(var _0x231200=0x0;_0x231200<_0x3bf778[_0xe3e3('0x4a')][_0xe3e3('0x8f')][_0xe3e3('0x4f')];_0x231200+=0x1){socket[_0xe3e3('0x98')](_0xe3e3('0x92'),{'UserId':Number(_0x3bf778[_0xe3e3('0x4a')][_0xe3e3('0x8f')][_0x231200]),'ChatQueueId':Number(_0x3bf778['params']['id'])});}}else{socket[_0xe3e3('0x98')](_0xe3e3('0x92'),{'UserId':Number(_0x3bf778[_0xe3e3('0x4a')][_0xe3e3('0x8f')]),'ChatQueueId':Number(_0x3bf778[_0xe3e3('0x5e')]['id'])});}});}})[_0xe3e3('0x21')](respondWithStatusCode(_0x467e54,null))[_0xe3e3('0x2c')](handleError(_0x467e54,null));};exports[_0xe3e3('0x99')]=function(_0x50fe0f,_0x5bdebf,_0x579b4c){var _0x57cec1={};var _0x4b78b7={};var _0x54e9ad;var _0x824b70;return db[_0xe3e3('0x43')][_0xe3e3('0x9a')]({'where':{'id':_0x50fe0f[_0xe3e3('0x5e')]['id']}})[_0xe3e3('0x21')](handleEntityNotFound(_0x5bdebf,null))[_0xe3e3('0x21')](function(_0x23b5cd){if(_0x23b5cd){_0x54e9ad=_0x23b5cd;_0x4b78b7['model']=_[_0xe3e3('0x49')](db[_0xe3e3('0x6b')]['rawAttributes']);_0x4b78b7['query']=_[_0xe3e3('0x49')](_0x50fe0f[_0xe3e3('0x4a')]);_0x4b78b7[_0xe3e3('0x4b')]=_[_0xe3e3('0x4c')](_0x4b78b7['model'],_0x4b78b7[_0xe3e3('0x4a')]);_0x57cec1[_0xe3e3('0x4d')]=_[_0xe3e3('0x4c')](_0x4b78b7['model'],qs['fields'](_0x50fe0f['query'][_0xe3e3('0x4e')]));_0x57cec1['attributes']=_0x57cec1[_0xe3e3('0x4d')][_0xe3e3('0x4f')]?_0x57cec1[_0xe3e3('0x4d')]:_0x4b78b7['model'];_0x57cec1[_0xe3e3('0x52')]=qs[_0xe3e3('0x53')](_0x50fe0f[_0xe3e3('0x4a')][_0xe3e3('0x53')]);_0x57cec1[_0xe3e3('0x56')]=qs[_0xe3e3('0x4b')](_[_0xe3e3('0x54')](_0x50fe0f['query'],_0x4b78b7[_0xe3e3('0x4b')]));if(_0x50fe0f['query']['filter']){_0x57cec1[_0xe3e3('0x56')]=_['merge'](_0x57cec1[_0xe3e3('0x56')],{'$or':_[_0xe3e3('0x42')](_0x57cec1[_0xe3e3('0x4d')],function(_0x21e06b){var _0x52d28b={};_0x52d28b[_0x21e06b]={'$like':'%'+_0x50fe0f[_0xe3e3('0x4a')][_0xe3e3('0x55')]+'%'};return _0x52d28b;})});}_0x57cec1=_[_0xe3e3('0x57')]({},_0x57cec1,_0x50fe0f[_0xe3e3('0x5f')]);return _0x54e9ad[_0xe3e3('0x99')](_0x57cec1);}})[_0xe3e3('0x21')](function(_0x47773c){if(_0x47773c){_0x824b70=_0x47773c['length'];if(!_0x50fe0f[_0xe3e3('0x4a')][_0xe3e3('0x50')](_0xe3e3('0x51'))){_0x57cec1[_0xe3e3('0x32')]=qs[_0xe3e3('0x32')](_0x50fe0f[_0xe3e3('0x4a')][_0xe3e3('0x32')]);_0x57cec1[_0xe3e3('0x30')]=qs[_0xe3e3('0x30')](_0x50fe0f[_0xe3e3('0x4a')][_0xe3e3('0x30')]);}return _0x54e9ad[_0xe3e3('0x99')](_0x57cec1);}})[_0xe3e3('0x21')](function(_0x2c1aae){if(_0x2c1aae){return _0x2c1aae?{'count':_0x824b70,'rows':_0x2c1aae}:null;}})[_0xe3e3('0x21')](respondWithResult(_0x5bdebf,null))[_0xe3e3('0x2c')](handleError(_0x5bdebf,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 541a9b2..37f558e 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 _0x201c=['emit','hasOwnProperty','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x385d29,_0x143eb9){var _0x11b9dc=function(_0x2d2895){while(--_0x2d2895){_0x385d29['push'](_0x385d29['shift']());}};_0x11b9dc(++_0x143eb9);}(_0x201c,0x17a));var _0xc201=function(_0x366dca,_0x49cd02){_0x366dca=_0x366dca-0x0;var _0xa0eb0a=_0x201c[_0x366dca];return _0xa0eb0a;};'use strict';var EventEmitter=require(_0xc201('0x0'));var ChatQueue=require(_0xc201('0x1'))['db'][_0xc201('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xc201('0x3')](0x0);var events={'afterCreate':_0xc201('0x4'),'afterUpdate':_0xc201('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1a1392){return function(_0x530e0e,_0x14949e,_0x26c1d7){ChatQueueEvents['emit'](_0x1a1392+':'+_0x530e0e['id'],_0x530e0e);ChatQueueEvents[_0xc201('0x6')](_0x1a1392,_0x530e0e);_0x26c1d7(null);};}for(var e in events){if(events[_0xc201('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x6246=['hasOwnProperty','hook','../../mysqldb','ChatQueue','save','remove','emit'];(function(_0x3aa370,_0x49c3de){var _0x3d1860=function(_0x3382e8){while(--_0x3382e8){_0x3aa370['push'](_0x3aa370['shift']());}};_0x3d1860(++_0x49c3de);}(_0x6246,0x1c2));var _0x6624=function(_0x2fca3c,_0xbe8fa5){_0x2fca3c=_0x2fca3c-0x0;var _0x1d8d95=_0x6246[_0x2fca3c];return _0x1d8d95;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x6624('0x0'))['db'][_0x6624('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6624('0x2'),'afterUpdate':'update','afterDestroy':_0x6624('0x3')};function emitEvent(_0x39a434){return function(_0x218e2d,_0x3cd53f,_0x8736c6){ChatQueueEvents[_0x6624('0x4')](_0x39a434+':'+_0x218e2d['id'],_0x218e2d);ChatQueueEvents[_0x6624('0x4')](_0x39a434,_0x218e2d);_0x8736c6(null);};}for(var e in events){if(events[_0x6624('0x5')](e)){var event=events[e];ChatQueue[_0x6624('0x6')](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 1108afb..1ad952d 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 _0xa88d=['request-promise','rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue','chat_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x36c04d,_0x3c1d2d){var _0x2b3f59=function(_0x115213){while(--_0x115213){_0x36c04d['push'](_0x36c04d['shift']());}};_0x2b3f59(++_0x3c1d2d);}(_0xa88d,0x14b));var _0xda88=function(_0x47ccac,_0x1cfa69){_0x47ccac=_0x47ccac-0x0;var _0x78ea28=_0xa88d[_0x47ccac];return _0x78ea28;};'use strict';var _=require(_0xda88('0x0'));var util=require(_0xda88('0x1'));var logger=require(_0xda88('0x2'))('api');var moment=require(_0xda88('0x3'));var BPromise=require(_0xda88('0x4'));var rp=require(_0xda88('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda88('0x6'));var config=require(_0xda88('0x7'));var attributes=require(_0xda88('0x8'));module['exports']=function(_0x207dd1,_0x3b2116){return _0x207dd1[_0xda88('0x9')](_0xda88('0xa'),attributes,{'tableName':_0xda88('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a25=['../../config/logger','moment','request-promise','path','../../config/environment','exports','define','ChatQueue','lodash','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8a25,0x94));var _0x58a2=function(_0x265b08,_0x505063){_0x265b08=_0x265b08-0x0;var _0xb60ab=_0x8a25[_0x265b08];return _0xb60ab;};'use strict';var _=require(_0x58a2('0x0'));var util=require(_0x58a2('0x1'));var logger=require(_0x58a2('0x2'))('api');var moment=require(_0x58a2('0x3'));var BPromise=require('bluebird');var rp=require(_0x58a2('0x4'));var fs=require('fs');var path=require(_0x58a2('0x5'));var rimraf=require('rimraf');var config=require(_0x58a2('0x6'));var attributes=require('./chatQueue.attributes');module[_0x58a2('0x7')]=function(_0x426334,_0x297f14){return _0x426334[_0x58a2('0x8')](_0x58a2('0x9'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 5f19399..a74fb5d 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 _0x7275=['./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','include','model','map','then','find','ShowChatQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','socket.io-emitter'];(function(_0x204eb7,_0x4974c3){var _0x37e444=function(_0x390613){while(--_0x390613){_0x204eb7['push'](_0x204eb7['shift']());}};_0x37e444(++_0x4974c3);}(_0x7275,0x143));var _0x5727=function(_0x54c0cf,_0x2f6929){_0x54c0cf=_0x54c0cf-0x0;var _0x26ace7=_0x7275[_0x54c0cf];return _0x26ace7;};'use strict';var _=require(_0x5727('0x0'));var util=require(_0x5727('0x1'));var moment=require(_0x5727('0x2'));var BPromise=require('bluebird');var rs=require(_0x5727('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5727('0x4'))['db'];var utils=require(_0x5727('0x5'));var logger=require('../../config/logger')(_0x5727('0x6'));var config=require(_0x5727('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x5727('0x8')]=_['defaults'](config[_0x5727('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x5727('0x9'))(new Redis(config['redis']));require(_0x5727('0xa'))[_0x5727('0xb')](socket);function respondWithRpcPromise(_0x4f73cd,_0x1b1258,_0x423fc0){return new BPromise(function(_0x4f30e1,_0x274678){return client[_0x5727('0xc')](_0x4f73cd,_0x423fc0)['then'](function(_0x9ee7f4){logger[_0x5727('0xd')](_0x5727('0xe'),_0x1b1258,_0x5727('0xf'));logger[_0x5727('0x10')](_0x5727('0x11'),_0x1b1258,'request\x20sent',JSON[_0x5727('0x12')](_0x9ee7f4));if(_0x9ee7f4[_0x5727('0x13')]){if(_0x9ee7f4[_0x5727('0x13')][_0x5727('0x14')]===0x1f4){logger[_0x5727('0x13')](_0x5727('0xe'),_0x1b1258,_0x9ee7f4[_0x5727('0x13')]['message']);return _0x274678(_0x9ee7f4[_0x5727('0x13')][_0x5727('0x15')]);}logger[_0x5727('0x13')](_0x5727('0xe'),_0x1b1258,_0x9ee7f4[_0x5727('0x13')][_0x5727('0x15')]);return _0x4f30e1(_0x9ee7f4[_0x5727('0x13')]['message']);}else{logger[_0x5727('0xd')]('ChatQueue,\x20%s,\x20%s',_0x1b1258,_0x5727('0xf'));_0x4f30e1(_0x9ee7f4[_0x5727('0x16')]['message']);}})[_0x5727('0x17')](function(_0x142551){logger[_0x5727('0x13')](_0x5727('0xe'),_0x1b1258,_0x142551);_0x274678(_0x142551);});});}exports[_0x5727('0x18')]=function(_0x497f94){var _0x5af1df=this;return new Promise(function(_0x2a8359,_0xb99c6e){return db[_0x5727('0x19')][_0x5727('0x1a')]({'raw':_0x497f94[_0x5727('0x1b')]?_0x497f94[_0x5727('0x1b')][_0x5727('0x1c')]===undefined?!![]:![]:!![],'where':_0x497f94['options']?_0x497f94[_0x5727('0x1b')][_0x5727('0x1d')]||null:null,'attributes':_0x497f94[_0x5727('0x1b')]?_0x497f94['options'][_0x5727('0x1e')]||null:null,'limit':_0x497f94[_0x5727('0x1b')]?_0x497f94[_0x5727('0x1b')]['limit']||null:null,'include':_0x497f94['options']?_0x497f94[_0x5727('0x1b')][_0x5727('0x1f')]?_['map'](_0x497f94[_0x5727('0x1b')]['include'],function(_0x1c656f){return{'model':db[_0x1c656f[_0x5727('0x20')]],'as':_0x1c656f['as'],'attributes':_0x1c656f['attributes'],'include':_0x1c656f['include']?_[_0x5727('0x21')](_0x1c656f['include'],function(_0x4c5305){return{'model':db[_0x4c5305[_0x5727('0x20')]],'as':_0x4c5305['as'],'attributes':_0x4c5305[_0x5727('0x1e')],'include':_0x4c5305[_0x5727('0x1f')]?_[_0x5727('0x21')](_0x4c5305[_0x5727('0x1f')],function(_0x56e93d){return{'model':db[_0x56e93d['model']],'as':_0x56e93d['as'],'attributes':_0x56e93d[_0x5727('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5727('0x22')](function(_0x1b2cc7){logger[_0x5727('0xd')]('GetChatQueue',_0x497f94);logger[_0x5727('0x10')]('GetChatQueue',_0x497f94,JSON[_0x5727('0x12')](_0x1b2cc7));_0x2a8359(_0x1b2cc7);})['catch'](function(_0x19636b){logger['error'](_0x5727('0x18'),_0x19636b[_0x5727('0x15')],_0x497f94);_0xb99c6e(_0x5af1df[_0x5727('0x13')](0x1f4,_0x19636b[_0x5727('0x15')]));});});};exports['ShowChatQueue']=function(_0x36a517){var _0x1cfa2c=this;return new Promise(function(_0x5760a7,_0x59fece){return db[_0x5727('0x19')][_0x5727('0x23')]({'raw':_0x36a517[_0x5727('0x1b')]?_0x36a517[_0x5727('0x1b')][_0x5727('0x1c')]===undefined?!![]:![]:!![],'where':_0x36a517['options']?_0x36a517[_0x5727('0x1b')][_0x5727('0x1d')]||null:null,'attributes':_0x36a517[_0x5727('0x1b')]?_0x36a517[_0x5727('0x1b')][_0x5727('0x1e')]||null:null,'include':_0x36a517[_0x5727('0x1b')]?_0x36a517[_0x5727('0x1b')][_0x5727('0x1f')]?_[_0x5727('0x21')](_0x36a517[_0x5727('0x1b')][_0x5727('0x1f')],function(_0x41e149){return{'model':db[_0x41e149[_0x5727('0x20')]],'as':_0x41e149['as'],'attributes':_0x41e149[_0x5727('0x1e')],'include':_0x41e149['include']?_[_0x5727('0x21')](_0x41e149[_0x5727('0x1f')],function(_0x7fd23e){return{'model':db[_0x7fd23e[_0x5727('0x20')]],'as':_0x7fd23e['as'],'attributes':_0x7fd23e[_0x5727('0x1e')],'include':_0x7fd23e['include']?_[_0x5727('0x21')](_0x7fd23e[_0x5727('0x1f')],function(_0x26cac4){return{'model':db[_0x26cac4['model']],'as':_0x26cac4['as'],'attributes':_0x26cac4['attributes']};}):[]};}):[]};}):[]:[]})[_0x5727('0x22')](function(_0x4978a7){logger['info']('ShowChatQueue',_0x36a517);logger['debug'](_0x5727('0x24'),_0x36a517,JSON[_0x5727('0x12')](_0x4978a7));_0x5760a7(_0x4978a7);})[_0x5727('0x17')](function(_0x58ef88){logger[_0x5727('0x13')](_0x5727('0x24'),_0x58ef88[_0x5727('0x15')],_0x36a517);_0x59fece(_0x1cfa2c['error'](0x1f4,_0x58ef88[_0x5727('0x15')]));});});}; \ No newline at end of file +var _0x5b0f=['ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','find','ShowChatQueue','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','info'];(function(_0x127155,_0x25c0be){var _0x1aac6a=function(_0x352c31){while(--_0x352c31){_0x127155['push'](_0x127155['shift']());}};_0x1aac6a(++_0x25c0be);}(_0x5b0f,0xde));var _0xf5b0=function(_0x43c6fa,_0x2744f5){_0x43c6fa=_0x43c6fa-0x0;var _0x2f08d7=_0x5b0f[_0x43c6fa];return _0x2f08d7;};'use strict';var _=require('lodash');var util=require(_0xf5b0('0x0'));var moment=require('moment');var BPromise=require(_0xf5b0('0x1'));var rs=require(_0xf5b0('0x2'));var fs=require('fs');var Redis=require(_0xf5b0('0x3'));var db=require(_0xf5b0('0x4'))['db'];var utils=require(_0xf5b0('0x5'));var logger=require(_0xf5b0('0x6'))(_0xf5b0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf5b0('0x8')][_0xf5b0('0x9')]({'port':0x232a});config[_0xf5b0('0xa')]=_[_0xf5b0('0xb')](config['redis'],{'host':_0xf5b0('0xc'),'port':0x18eb});var socket=require(_0xf5b0('0xd'))(new Redis(config['redis']));require(_0xf5b0('0xe'))[_0xf5b0('0xf')](socket);function respondWithRpcPromise(_0x238d58,_0x4a79e5,_0xa981a7){return new BPromise(function(_0xaee4ce,_0x1fbe22){return client[_0xf5b0('0x10')](_0x238d58,_0xa981a7)['then'](function(_0x11e678){logger[_0xf5b0('0x11')](_0xf5b0('0x12'),_0x4a79e5,_0xf5b0('0x13'));logger[_0xf5b0('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x4a79e5,_0xf5b0('0x13'),JSON[_0xf5b0('0x15')](_0x11e678));if(_0x11e678[_0xf5b0('0x16')]){if(_0x11e678['error']['code']===0x1f4){logger[_0xf5b0('0x16')](_0xf5b0('0x12'),_0x4a79e5,_0x11e678[_0xf5b0('0x16')]['message']);return _0x1fbe22(_0x11e678[_0xf5b0('0x16')][_0xf5b0('0x17')]);}logger[_0xf5b0('0x16')](_0xf5b0('0x12'),_0x4a79e5,_0x11e678[_0xf5b0('0x16')][_0xf5b0('0x17')]);return _0xaee4ce(_0x11e678[_0xf5b0('0x16')][_0xf5b0('0x17')]);}else{logger[_0xf5b0('0x11')]('ChatQueue,\x20%s,\x20%s',_0x4a79e5,_0xf5b0('0x13'));_0xaee4ce(_0x11e678[_0xf5b0('0x18')][_0xf5b0('0x17')]);}})[_0xf5b0('0x19')](function(_0x2b55b3){logger[_0xf5b0('0x16')](_0xf5b0('0x12'),_0x4a79e5,_0x2b55b3);_0x1fbe22(_0x2b55b3);});});}exports[_0xf5b0('0x1a')]=function(_0x1ecd3d){var _0x4f46d8=this;return new Promise(function(_0x4f58ea,_0x1ec5a9){return db[_0xf5b0('0x1b')][_0xf5b0('0x1c')]({'raw':_0x1ecd3d[_0xf5b0('0x1d')]?_0x1ecd3d[_0xf5b0('0x1d')][_0xf5b0('0x1e')]===undefined?!![]:![]:!![],'where':_0x1ecd3d[_0xf5b0('0x1d')]?_0x1ecd3d[_0xf5b0('0x1d')][_0xf5b0('0x1f')]||null:null,'attributes':_0x1ecd3d[_0xf5b0('0x1d')]?_0x1ecd3d[_0xf5b0('0x1d')][_0xf5b0('0x20')]||null:null,'limit':_0x1ecd3d[_0xf5b0('0x1d')]?_0x1ecd3d[_0xf5b0('0x1d')][_0xf5b0('0x21')]||null:null,'include':_0x1ecd3d[_0xf5b0('0x1d')]?_0x1ecd3d[_0xf5b0('0x1d')][_0xf5b0('0x22')]?_[_0xf5b0('0x23')](_0x1ecd3d[_0xf5b0('0x1d')][_0xf5b0('0x22')],function(_0x54c678){return{'model':db[_0x54c678[_0xf5b0('0x24')]],'as':_0x54c678['as'],'attributes':_0x54c678[_0xf5b0('0x20')],'include':_0x54c678[_0xf5b0('0x22')]?_[_0xf5b0('0x23')](_0x54c678[_0xf5b0('0x22')],function(_0x367ceb){return{'model':db[_0x367ceb['model']],'as':_0x367ceb['as'],'attributes':_0x367ceb['attributes'],'include':_0x367ceb[_0xf5b0('0x22')]?_[_0xf5b0('0x23')](_0x367ceb[_0xf5b0('0x22')],function(_0x541503){return{'model':db[_0x541503[_0xf5b0('0x24')]],'as':_0x541503['as'],'attributes':_0x541503[_0xf5b0('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5b0('0x25')](function(_0x2abdfc){logger[_0xf5b0('0x11')]('GetChatQueue',_0x1ecd3d);logger[_0xf5b0('0x14')](_0xf5b0('0x1a'),_0x1ecd3d,JSON[_0xf5b0('0x15')](_0x2abdfc));_0x4f58ea(_0x2abdfc);})[_0xf5b0('0x19')](function(_0x3b7649){logger[_0xf5b0('0x16')](_0xf5b0('0x1a'),_0x3b7649[_0xf5b0('0x17')],_0x1ecd3d);_0x1ec5a9(_0x4f46d8[_0xf5b0('0x16')](0x1f4,_0x3b7649['message']));});});};exports['ShowChatQueue']=function(_0x1546c6){var _0x41b948=this;return new Promise(function(_0x25e97c,_0x3bcaa9){return db[_0xf5b0('0x1b')][_0xf5b0('0x26')]({'raw':_0x1546c6[_0xf5b0('0x1d')]?_0x1546c6[_0xf5b0('0x1d')][_0xf5b0('0x1e')]===undefined?!![]:![]:!![],'where':_0x1546c6[_0xf5b0('0x1d')]?_0x1546c6[_0xf5b0('0x1d')][_0xf5b0('0x1f')]||null:null,'attributes':_0x1546c6[_0xf5b0('0x1d')]?_0x1546c6[_0xf5b0('0x1d')][_0xf5b0('0x20')]||null:null,'include':_0x1546c6[_0xf5b0('0x1d')]?_0x1546c6[_0xf5b0('0x1d')][_0xf5b0('0x22')]?_[_0xf5b0('0x23')](_0x1546c6[_0xf5b0('0x1d')][_0xf5b0('0x22')],function(_0x461a50){return{'model':db[_0x461a50[_0xf5b0('0x24')]],'as':_0x461a50['as'],'attributes':_0x461a50[_0xf5b0('0x20')],'include':_0x461a50[_0xf5b0('0x22')]?_[_0xf5b0('0x23')](_0x461a50['include'],function(_0x5d9ce3){return{'model':db[_0x5d9ce3[_0xf5b0('0x24')]],'as':_0x5d9ce3['as'],'attributes':_0x5d9ce3['attributes'],'include':_0x5d9ce3['include']?_[_0xf5b0('0x23')](_0x5d9ce3['include'],function(_0x5cf0c0){return{'model':db[_0x5cf0c0['model']],'as':_0x5cf0c0['as'],'attributes':_0x5cf0c0[_0xf5b0('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5b0('0x25')](function(_0x4636a5){logger['info'](_0xf5b0('0x27'),_0x1546c6);logger['debug'](_0xf5b0('0x27'),_0x1546c6,JSON['stringify'](_0x4636a5));_0x25e97c(_0x4636a5);})[_0xf5b0('0x19')](function(_0x321bc9){logger[_0xf5b0('0x16')]('ShowChatQueue',_0x321bc9[_0xf5b0('0x17')],_0x1546c6);_0x3bcaa9(_0x41b948[_0xf5b0('0x16')](0x1f4,_0x321bc9[_0xf5b0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index c767a3d..43bfe8b 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 _0x2bc6=['length','./chatQueue.events','save','remove','emit','removeListener'];(function(_0x491ed3,_0x2eb2e8){var _0x329b50=function(_0x46ca66){while(--_0x46ca66){_0x491ed3['push'](_0x491ed3['shift']());}};_0x329b50(++_0x2eb2e8);}(_0x2bc6,0x163));var _0x62bc=function(_0x337c0e,_0x3d6c30){_0x337c0e=_0x337c0e-0x0;var _0x5de333=_0x2bc6[_0x337c0e];return _0x5de333;};'use strict';var ChatQueueEvents=require(_0x62bc('0x0'));var events=[_0x62bc('0x1'),_0x62bc('0x2'),'update'];function createListener(_0x4b4e73,_0x5a2676){return function(_0x5c5a2a){_0x5a2676[_0x62bc('0x3')](_0x4b4e73,_0x5c5a2a);};}function removeListener(_0x576608,_0x2a1959){return function(){ChatQueueEvents[_0x62bc('0x4')](_0x576608,_0x2a1959);};}exports['register']=function(_0x3cce26){for(var _0x450cb6=0x0,_0x40af10=events[_0x62bc('0x5')];_0x450cb6<_0x40af10;_0x450cb6++){var _0x3ed6ad=events[_0x450cb6];var _0x3f625c=createListener('chatQueue:'+_0x3ed6ad,_0x3cce26);ChatQueueEvents['on'](_0x3ed6ad,_0x3f625c);}}; \ No newline at end of file +var _0x702d=['remove','update','emit','register','length','./chatQueue.events','save'];(function(_0x3b4a16,_0x45444a){var _0x4a86ca=function(_0x5193a7){while(--_0x5193a7){_0x3b4a16['push'](_0x3b4a16['shift']());}};_0x4a86ca(++_0x45444a);}(_0x702d,0x147));var _0xd702=function(_0x3ebdfb,_0x26783b){_0x3ebdfb=_0x3ebdfb-0x0;var _0x47b42b=_0x702d[_0x3ebdfb];return _0x47b42b;};'use strict';var ChatQueueEvents=require(_0xd702('0x0'));var events=[_0xd702('0x1'),_0xd702('0x2'),_0xd702('0x3')];function createListener(_0x37ed5c,_0x5c2b9e){return function(_0x20c11a){_0x5c2b9e[_0xd702('0x4')](_0x37ed5c,_0x20c11a);};}function removeListener(_0x27b260,_0x1c5a32){return function(){ChatQueueEvents['removeListener'](_0x27b260,_0x1c5a32);};}exports[_0xd702('0x5')]=function(_0x544e94){for(var _0x1aecfc=0x0,_0x3a2c03=events[_0xd702('0x6')];_0x1aecfc<_0x3a2c03;_0x1aecfc++){var _0x5af246=events[_0x1aecfc];var _0x12bb75=createListener('chatQueue:'+_0x5af246,_0x544e94);ChatQueueEvents['on'](_0x5af246,_0x12bb75);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index e3365c8..3d45396 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x4eb7fd,_0x4f1a6f){var _0x3cfc2c=function(_0x18afb4){while(--_0x18afb4){_0x4eb7fd['push'](_0x4eb7fd['shift']());}};_0x3cfc2c(++_0x4f1a6f);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3e74,0x175));var _0x43e7=function(_0x5797af,_0x56b5c9){_0x5797af=_0x5797af-0x0;var _0x18bd3e=_0x3e74[_0x5797af];return _0x18bd3e;};'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/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 14ede78..045a611 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 _0x64d4=['exports','DATE','STRING','moment','sequelize'];(function(_0xc06eda,_0x48bc87){var _0xf34f2d=function(_0xc4ae3f){while(--_0xc4ae3f){_0xc06eda['push'](_0xc06eda['shift']());}};_0xf34f2d(++_0x48bc87);}(_0x64d4,0x94));var _0x464d=function(_0x387973,_0x369e60){_0x387973=_0x387973-0x0;var _0x13cc25=_0x64d4[_0x387973];return _0x13cc25;};'use strict';var moment=require(_0x464d('0x0'));var Sequelize=require(_0x464d('0x1'));module[_0x464d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x464d('0x3')]},'leaveAt':{'type':Sequelize[_0x464d('0x3')]},'acceptAt':{'type':Sequelize[_0x464d('0x3')]},'exitAt':{'type':Sequelize[_0x464d('0x3')]},'reason':{'type':Sequelize[_0x464d('0x4')]}}; \ No newline at end of file +var _0x5aae=['DATE','moment','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5aae,0xe5));var _0xe5aa=function(_0x405a1f,_0x446aa3){_0x405a1f=_0x405a1f-0x0;var _0x4fd010=_0x5aae[_0x405a1f];return _0x4fd010;};'use strict';var moment=require(_0xe5aa('0x0'));var Sequelize=require(_0xe5aa('0x1'));module[_0xe5aa('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xe5aa('0x3')]},'acceptAt':{'type':Sequelize[_0xe5aa('0x3')]},'exitAt':{'type':Sequelize[_0xe5aa('0x3')]},'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 a2e9023..53c373b 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 _0xc029=['includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x559a67,_0x357c5c){var _0x1c70ba=function(_0x14e145){while(--_0x14e145){_0x559a67['push'](_0x559a67['shift']());}};_0x1c70ba(++_0x357c5c);}(_0xc029,0x1df));var _0x9c02=function(_0x4589fd,_0x4c6f26){_0x4589fd=_0x4589fd-0x0;var _0x44084b=_0xc029[_0x4589fd];return _0x44084b;};'use strict';var emlformat=require(_0x9c02('0x0'));var rimraf=require(_0x9c02('0x1'));var zipdir=require(_0x9c02('0x2'));var jsonpatch=require(_0x9c02('0x3'));var rp=require(_0x9c02('0x4'));var moment=require(_0x9c02('0x5'));var BPromise=require(_0x9c02('0x6'));var Mustache=require(_0x9c02('0x7'));var util=require(_0x9c02('0x8'));var path=require(_0x9c02('0x9'));var sox=require(_0x9c02('0xa'));var csv=require(_0x9c02('0xb'));var ejs=require(_0x9c02('0xc'));var fs=require('fs');var fs_extra=require(_0x9c02('0xd'));var _=require(_0x9c02('0xe'));var squel=require(_0x9c02('0xf'));var crypto=require(_0x9c02('0x10'));var jsforce=require(_0x9c02('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x9c02('0xb'));var querystring=require('querystring');var Papa=require(_0x9c02('0x12'));var Redis=require(_0x9c02('0x13'));var authService=require(_0x9c02('0x14'));var qs=require(_0x9c02('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c02('0x16'));var logger=require('../../config/logger')(_0x9c02('0x17'));var utils=require('../../config/utils');var config=require(_0x9c02('0x18'));var licenseUtil=require(_0x9c02('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x90d45,_0x2190d9){_0x2190d9=_0x2190d9||0xcc;return function(_0x5f57b5){if(_0x5f57b5){return _0x90d45[_0x9c02('0x1a')](_0x2190d9);}return _0x90d45[_0x9c02('0x1b')](_0x2190d9)[_0x9c02('0x1c')]();};}function respondWithResult(_0x531e65,_0x56bf05){_0x56bf05=_0x56bf05||0xc8;return function(_0x38ee82){if(_0x38ee82){return _0x531e65[_0x9c02('0x1b')](_0x56bf05)[_0x9c02('0x1d')](_0x38ee82);}};}function respondWithFilteredResult(_0xcb970a,_0x52b812){return function(_0x456f4e){if(_0x456f4e){var _0x38602c=typeof _0x52b812[_0x9c02('0x1e')]===_0x9c02('0x1f')&&typeof _0x52b812[_0x9c02('0x20')]==='undefined';var _0x3cc747=_0x456f4e[_0x9c02('0x21')];var _0xc66e1f=_0x38602c?0x0:_0x52b812[_0x9c02('0x1e')];var _0x195315=_0x38602c?_0x456f4e[_0x9c02('0x21')]:_0x52b812['offset']+_0x52b812[_0x9c02('0x20')];var _0x7cd598;if(_0x195315>=_0x3cc747){_0x195315=_0x3cc747;_0x7cd598=0xc8;}else{_0x7cd598=0xce;}_0xcb970a[_0x9c02('0x1b')](_0x7cd598);return _0xcb970a[_0x9c02('0x22')](_0x9c02('0x23'),_0xc66e1f+'-'+_0x195315+'/'+_0x3cc747)[_0x9c02('0x1d')](_0x456f4e);}return null;};}function patchUpdates(_0x402d26){return function(_0x3f91f0){try{jsonpatch[_0x9c02('0x24')](_0x3f91f0,_0x402d26,!![]);}catch(_0x5a2097){return BPromise['reject'](_0x5a2097);}return _0x3f91f0['save']();};}function saveUpdates(_0x2c5a9c,_0x4f8456){return function(_0x38d437){if(_0x38d437){return _0x38d437[_0x9c02('0x25')](_0x2c5a9c)[_0x9c02('0x26')](function(_0x1c1984){return _0x1c1984;});}return null;};}function removeEntity(_0x12fd92,_0x37a9da){return function(_0x26cfdb){if(_0x26cfdb){return _0x26cfdb[_0x9c02('0x27')]()['then'](function(){_0x12fd92[_0x9c02('0x1b')](0xcc)[_0x9c02('0x1c')]();});}};}function handleEntityNotFound(_0xc154f2,_0x597b3a){return function(_0x5509a3){if(!_0x5509a3){_0xc154f2['sendStatus'](0x194);}return _0x5509a3;};}function handleError(_0x5a9976,_0x27e898){_0x27e898=_0x27e898||0x1f4;return function(_0x2d6ba4){logger[_0x9c02('0x28')](_0x2d6ba4[_0x9c02('0x29')]);if(_0x2d6ba4[_0x9c02('0x2a')]){delete _0x2d6ba4[_0x9c02('0x2a')];}_0x5a9976[_0x9c02('0x1b')](_0x27e898)[_0x9c02('0x2b')](_0x2d6ba4);};}exports[_0x9c02('0x2c')]=function(_0x9a692,_0x4d6487){var _0x157a7f={},_0x4af77e={},_0x4cfd00={'count':0x0,'rows':[]};var _0x304462=_['map'](db[_0x9c02('0x2d')][_0x9c02('0x2e')],function(_0x43f946){return{'name':_0x43f946[_0x9c02('0x2f')],'type':_0x43f946[_0x9c02('0x30')]['key']};});_0x4af77e[_0x9c02('0x31')]=_[_0x9c02('0x32')](_0x304462,_0x9c02('0x2a'));_0x4af77e[_0x9c02('0x33')]=_[_0x9c02('0x34')](_0x9a692[_0x9c02('0x33')]);_0x4af77e[_0x9c02('0x35')]=_[_0x9c02('0x36')](_0x4af77e[_0x9c02('0x31')],_0x4af77e[_0x9c02('0x33')]);_0x157a7f[_0x9c02('0x37')]=_[_0x9c02('0x36')](_0x4af77e[_0x9c02('0x31')],qs[_0x9c02('0x38')](_0x9a692[_0x9c02('0x33')]['fields']));_0x157a7f['attributes']=_0x157a7f['attributes'][_0x9c02('0x39')]?_0x157a7f[_0x9c02('0x37')]:_0x4af77e[_0x9c02('0x31')];if(!_0x9a692[_0x9c02('0x33')][_0x9c02('0x3a')]('nolimit')){_0x157a7f[_0x9c02('0x20')]=qs[_0x9c02('0x20')](_0x9a692[_0x9c02('0x33')][_0x9c02('0x20')]);_0x157a7f[_0x9c02('0x1e')]=qs[_0x9c02('0x1e')](_0x9a692[_0x9c02('0x33')]['offset']);}_0x157a7f[_0x9c02('0x3b')]=qs[_0x9c02('0x3c')](_0x9a692[_0x9c02('0x33')][_0x9c02('0x3c')]);_0x157a7f[_0x9c02('0x3d')]=qs[_0x9c02('0x35')](_[_0x9c02('0x3e')](_0x9a692[_0x9c02('0x33')],_0x4af77e[_0x9c02('0x35')]),_0x304462);if(_0x9a692[_0x9c02('0x33')][_0x9c02('0x3f')]){_0x157a7f[_0x9c02('0x3d')]=_[_0x9c02('0x40')](_0x157a7f[_0x9c02('0x3d')],{'$or':_[_0x9c02('0x32')](_0x304462,function(_0x2f22cf){if(_0x2f22cf['type']!==_0x9c02('0x41')){var _0xac6c83={};_0xac6c83[_0x2f22cf[_0x9c02('0x2a')]]={'$like':'%'+_0x9a692[_0x9c02('0x33')][_0x9c02('0x3f')]+'%'};return _0xac6c83;}})});}_0x157a7f=_[_0x9c02('0x40')]({},_0x157a7f,_0x9a692[_0x9c02('0x42')]);var _0x4c4f2f={'where':_0x157a7f[_0x9c02('0x3d')]};return db[_0x9c02('0x2d')][_0x9c02('0x21')](_0x4c4f2f)[_0x9c02('0x26')](function(_0x1f7da5){_0x4cfd00['count']=_0x1f7da5;if(_0x9a692[_0x9c02('0x33')][_0x9c02('0x43')]){_0x157a7f[_0x9c02('0x44')]=[{'all':!![]}];}return db[_0x9c02('0x2d')][_0x9c02('0x45')](_0x157a7f);})[_0x9c02('0x26')](function(_0x16c6c6){_0x4cfd00[_0x9c02('0x46')]=_0x16c6c6;return _0x4cfd00;})[_0x9c02('0x26')](respondWithFilteredResult(_0x4d6487,_0x157a7f))[_0x9c02('0x47')](handleError(_0x4d6487,null));};exports[_0x9c02('0x48')]=function(_0x1e1a31,_0x582ef2){var _0x4f0d85={'raw':!![],'where':{'id':_0x1e1a31[_0x9c02('0x49')]['id']}},_0x10356b={};_0x10356b['model']=_['keys'](db[_0x9c02('0x2d')][_0x9c02('0x2e')]);_0x10356b['query']=_['keys'](_0x1e1a31[_0x9c02('0x33')]);_0x10356b[_0x9c02('0x35')]=_['intersection'](_0x10356b['model'],_0x10356b['query']);_0x4f0d85[_0x9c02('0x37')]=_[_0x9c02('0x36')](_0x10356b[_0x9c02('0x31')],qs['fields'](_0x1e1a31[_0x9c02('0x33')][_0x9c02('0x38')]));_0x4f0d85['attributes']=_0x4f0d85[_0x9c02('0x37')]['length']?_0x4f0d85[_0x9c02('0x37')]:_0x10356b[_0x9c02('0x31')];if(_0x1e1a31[_0x9c02('0x33')]['includeAll']){_0x4f0d85[_0x9c02('0x44')]=[{'all':!![]}];}_0x4f0d85=_['merge']({},_0x4f0d85,_0x1e1a31[_0x9c02('0x42')]);return db['ChatQueueReport']['find'](_0x4f0d85)[_0x9c02('0x26')](handleEntityNotFound(_0x582ef2,null))[_0x9c02('0x26')](respondWithResult(_0x582ef2,null))[_0x9c02('0x47')](handleError(_0x582ef2,null));};exports[_0x9c02('0x4a')]=function(_0x883136,_0x4185d7){return db['ChatQueueReport']['create'](_0x883136[_0x9c02('0x4b')],{})[_0x9c02('0x26')](respondWithResult(_0x4185d7,0xc9))['catch'](handleError(_0x4185d7,null));};exports[_0x9c02('0x25')]=function(_0x4f4cfa,_0x222190){if(_0x4f4cfa[_0x9c02('0x4b')]['id']){delete _0x4f4cfa['body']['id'];}return db[_0x9c02('0x2d')]['find']({'where':{'id':_0x4f4cfa[_0x9c02('0x49')]['id']}})['then'](handleEntityNotFound(_0x222190,null))[_0x9c02('0x26')](saveUpdates(_0x4f4cfa[_0x9c02('0x4b')],null))[_0x9c02('0x26')](respondWithResult(_0x222190,null))[_0x9c02('0x47')](handleError(_0x222190,null));};exports[_0x9c02('0x27')]=function(_0x1a12cd,_0x30b447){return db[_0x9c02('0x2d')][_0x9c02('0x4c')]({'where':{'id':_0x1a12cd['params']['id']}})[_0x9c02('0x26')](handleEntityNotFound(_0x30b447,null))[_0x9c02('0x26')](removeEntity(_0x30b447,null))[_0x9c02('0x47')](handleError(_0x30b447,null));};exports[_0x9c02('0x4d')]=function(_0x1e8cae,_0x317257){return db[_0x9c02('0x2d')][_0x9c02('0x4d')]()[_0x9c02('0x26')](respondWithResult(_0x317257,null))[_0x9c02('0x47')](handleError(_0x317257,null));}; \ No newline at end of file +var _0x644f=['fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatQueueReport','includeAll','findAll','rows','catch','show','keys','include','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs'];(function(_0x3b7756,_0x5704df){var _0x241321=function(_0x15d285){while(--_0x15d285){_0x3b7756['push'](_0x3b7756['shift']());}};_0x241321(++_0x5704df);}(_0x644f,0x177));var _0xf644=function(_0x33c637,_0x597c26){_0x33c637=_0x33c637-0x0;var _0x14aa20=_0x644f[_0x33c637];return _0x14aa20;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf644('0x0'));var zipdir=require(_0xf644('0x1'));var jsonpatch=require(_0xf644('0x2'));var rp=require(_0xf644('0x3'));var moment=require(_0xf644('0x4'));var BPromise=require(_0xf644('0x5'));var Mustache=require(_0xf644('0x6'));var util=require(_0xf644('0x7'));var path=require(_0xf644('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf644('0x9'));var fs=require('fs');var fs_extra=require(_0xf644('0xa'));var _=require(_0xf644('0xb'));var squel=require('squel');var crypto=require(_0xf644('0xc'));var jsforce=require(_0xf644('0xd'));var deskjs=require(_0xf644('0xe'));var toCsv=require(_0xf644('0xf'));var querystring=require(_0xf644('0x10'));var Papa=require('papaparse');var Redis=require(_0xf644('0x11'));var authService=require(_0xf644('0x12'));var qs=require(_0xf644('0x13'));var as=require(_0xf644('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf644('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf644('0x16'));var db=require(_0xf644('0x17'))['db'];function respondWithStatusCode(_0x2e7a91,_0x5c103f){_0x5c103f=_0x5c103f||0xcc;return function(_0x3f6a40){if(_0x3f6a40){return _0x2e7a91[_0xf644('0x18')](_0x5c103f);}return _0x2e7a91[_0xf644('0x19')](_0x5c103f)[_0xf644('0x1a')]();};}function respondWithResult(_0x2df351,_0x4ddae2){_0x4ddae2=_0x4ddae2||0xc8;return function(_0x5dd82b){if(_0x5dd82b){return _0x2df351['status'](_0x4ddae2)['json'](_0x5dd82b);}};}function respondWithFilteredResult(_0x4f996c,_0x1a18f2){return function(_0x50e68b){if(_0x50e68b){var _0x46610a=typeof _0x1a18f2[_0xf644('0x1b')]===_0xf644('0x1c')&&typeof _0x1a18f2[_0xf644('0x1d')]===_0xf644('0x1c');var _0x50df3a=_0x50e68b['count'];var _0x10f61d=_0x46610a?0x0:_0x1a18f2[_0xf644('0x1b')];var _0x12ee4d=_0x46610a?_0x50e68b[_0xf644('0x1e')]:_0x1a18f2[_0xf644('0x1b')]+_0x1a18f2[_0xf644('0x1d')];var _0x43b430;if(_0x12ee4d>=_0x50df3a){_0x12ee4d=_0x50df3a;_0x43b430=0xc8;}else{_0x43b430=0xce;}_0x4f996c[_0xf644('0x19')](_0x43b430);return _0x4f996c[_0xf644('0x1f')](_0xf644('0x20'),_0x10f61d+'-'+_0x12ee4d+'/'+_0x50df3a)[_0xf644('0x21')](_0x50e68b);}return null;};}function patchUpdates(_0x567c1d){return function(_0x10aaba){try{jsonpatch[_0xf644('0x22')](_0x10aaba,_0x567c1d,!![]);}catch(_0xa7f8a2){return BPromise[_0xf644('0x23')](_0xa7f8a2);}return _0x10aaba[_0xf644('0x24')]();};}function saveUpdates(_0x5be5e5,_0x440314){return function(_0x1aa245){if(_0x1aa245){return _0x1aa245[_0xf644('0x25')](_0x5be5e5)[_0xf644('0x26')](function(_0x201c89){return _0x201c89;});}return null;};}function removeEntity(_0x560033,_0x72bd1e){return function(_0x2fe394){if(_0x2fe394){return _0x2fe394[_0xf644('0x27')]()[_0xf644('0x26')](function(){_0x560033['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9adbfb,_0x112606){return function(_0x372f30){if(!_0x372f30){_0x9adbfb['sendStatus'](0x194);}return _0x372f30;};}function handleError(_0x5dd1b5,_0x3a6c70){_0x3a6c70=_0x3a6c70||0x1f4;return function(_0x354cce){logger[_0xf644('0x28')](_0x354cce['stack']);if(_0x354cce[_0xf644('0x29')]){delete _0x354cce['name'];}_0x5dd1b5[_0xf644('0x19')](_0x3a6c70)[_0xf644('0x2a')](_0x354cce);};}exports[_0xf644('0x2b')]=function(_0x295c04,_0x424316){var _0x585133={},_0x5cbbf5={},_0x44366a={'count':0x0,'rows':[]};var _0x1cd792=_[_0xf644('0x2c')](db['ChatQueueReport'][_0xf644('0x2d')],function(_0xd49736){return{'name':_0xd49736[_0xf644('0x2e')],'type':_0xd49736[_0xf644('0x2f')][_0xf644('0x30')]};});_0x5cbbf5['model']=_[_0xf644('0x2c')](_0x1cd792,_0xf644('0x29'));_0x5cbbf5[_0xf644('0x31')]=_['keys'](_0x295c04['query']);_0x5cbbf5[_0xf644('0x32')]=_['intersection'](_0x5cbbf5[_0xf644('0x33')],_0x5cbbf5[_0xf644('0x31')]);_0x585133[_0xf644('0x34')]=_[_0xf644('0x35')](_0x5cbbf5[_0xf644('0x33')],qs[_0xf644('0x36')](_0x295c04[_0xf644('0x31')][_0xf644('0x36')]));_0x585133['attributes']=_0x585133['attributes'][_0xf644('0x37')]?_0x585133['attributes']:_0x5cbbf5[_0xf644('0x33')];if(!_0x295c04[_0xf644('0x31')]['hasOwnProperty'](_0xf644('0x38'))){_0x585133['limit']=qs[_0xf644('0x1d')](_0x295c04[_0xf644('0x31')][_0xf644('0x1d')]);_0x585133[_0xf644('0x1b')]=qs[_0xf644('0x1b')](_0x295c04[_0xf644('0x31')][_0xf644('0x1b')]);}_0x585133[_0xf644('0x39')]=qs[_0xf644('0x3a')](_0x295c04[_0xf644('0x31')][_0xf644('0x3a')]);_0x585133[_0xf644('0x3b')]=qs['filters'](_[_0xf644('0x3c')](_0x295c04[_0xf644('0x31')],_0x5cbbf5[_0xf644('0x32')]),_0x1cd792);if(_0x295c04[_0xf644('0x31')][_0xf644('0x3d')]){_0x585133[_0xf644('0x3b')]=_[_0xf644('0x3e')](_0x585133[_0xf644('0x3b')],{'$or':_['map'](_0x1cd792,function(_0x255506){if(_0x255506['type']!==_0xf644('0x3f')){var _0x37dcc9={};_0x37dcc9[_0x255506[_0xf644('0x29')]]={'$like':'%'+_0x295c04[_0xf644('0x31')][_0xf644('0x3d')]+'%'};return _0x37dcc9;}})});}_0x585133=_['merge']({},_0x585133,_0x295c04[_0xf644('0x40')]);var _0x414d74={'where':_0x585133['where']};return db[_0xf644('0x41')][_0xf644('0x1e')](_0x414d74)[_0xf644('0x26')](function(_0x4bcddc){_0x44366a[_0xf644('0x1e')]=_0x4bcddc;if(_0x295c04['query'][_0xf644('0x42')]){_0x585133['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0xf644('0x43')](_0x585133);})[_0xf644('0x26')](function(_0x270e7f){_0x44366a[_0xf644('0x44')]=_0x270e7f;return _0x44366a;})['then'](respondWithFilteredResult(_0x424316,_0x585133))[_0xf644('0x45')](handleError(_0x424316,null));};exports[_0xf644('0x46')]=function(_0x1ea8fd,_0x41dedf){var _0x124c63={'raw':!![],'where':{'id':_0x1ea8fd['params']['id']}},_0x2c8716={};_0x2c8716['model']=_[_0xf644('0x47')](db[_0xf644('0x41')]['rawAttributes']);_0x2c8716[_0xf644('0x31')]=_[_0xf644('0x47')](_0x1ea8fd[_0xf644('0x31')]);_0x2c8716[_0xf644('0x32')]=_[_0xf644('0x35')](_0x2c8716[_0xf644('0x33')],_0x2c8716[_0xf644('0x31')]);_0x124c63['attributes']=_[_0xf644('0x35')](_0x2c8716['model'],qs['fields'](_0x1ea8fd[_0xf644('0x31')][_0xf644('0x36')]));_0x124c63[_0xf644('0x34')]=_0x124c63['attributes']['length']?_0x124c63['attributes']:_0x2c8716['model'];if(_0x1ea8fd[_0xf644('0x31')][_0xf644('0x42')]){_0x124c63[_0xf644('0x48')]=[{'all':!![]}];}_0x124c63=_['merge']({},_0x124c63,_0x1ea8fd[_0xf644('0x40')]);return db[_0xf644('0x41')][_0xf644('0x49')](_0x124c63)[_0xf644('0x26')](handleEntityNotFound(_0x41dedf,null))[_0xf644('0x26')](respondWithResult(_0x41dedf,null))[_0xf644('0x45')](handleError(_0x41dedf,null));};exports[_0xf644('0x4a')]=function(_0x2b9617,_0x1074f7){return db[_0xf644('0x41')]['create'](_0x2b9617[_0xf644('0x4b')],{})[_0xf644('0x26')](respondWithResult(_0x1074f7,0xc9))[_0xf644('0x45')](handleError(_0x1074f7,null));};exports[_0xf644('0x25')]=function(_0x2893d8,_0x28acb6){if(_0x2893d8[_0xf644('0x4b')]['id']){delete _0x2893d8[_0xf644('0x4b')]['id'];}return db['ChatQueueReport'][_0xf644('0x49')]({'where':{'id':_0x2893d8[_0xf644('0x4c')]['id']}})['then'](handleEntityNotFound(_0x28acb6,null))[_0xf644('0x26')](saveUpdates(_0x2893d8[_0xf644('0x4b')],null))['then'](respondWithResult(_0x28acb6,null))[_0xf644('0x45')](handleError(_0x28acb6,null));};exports[_0xf644('0x27')]=function(_0x232853,_0x42b872){return db[_0xf644('0x41')]['find']({'where':{'id':_0x232853['params']['id']}})[_0xf644('0x26')](handleEntityNotFound(_0x42b872,null))[_0xf644('0x26')](removeEntity(_0x42b872,null))['catch'](handleError(_0x42b872,null));};exports['describe']=function(_0x3a7e5d,_0x436497){return db[_0xf644('0x41')]['describe']()['then'](respondWithResult(_0x436497,null))[_0xf644('0x45')](handleError(_0x436497,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 145182d..40bd286 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x3e36e0,_0x3456ef){var _0x543e69=function(_0x48e61a){while(--_0x48e61a){_0x3e36e0['push'](_0x3e36e0['shift']());}};_0x543e69(++_0x3456ef);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xb7e7[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x3f99a8,_0x160bf7){var _0x25c907=function(_0x4f5dd0){while(--_0x4f5dd0){_0x3f99a8['push'](_0x3f99a8['shift']());}};_0x25c907(++_0x160bf7);}(_0xe706,0xa3));var _0x6e70=function(_0x6d7f08,_0x9e8c3b){_0x6d7f08=_0x6d7f08-0x0;var _0x35e5e1=_0xe706[_0x6d7f08];return _0x35e5e1;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 1d6900c..7f9401d 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 _0x1e87=['client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatQueueReport','create','options','raw','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','limit','debug','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3321c3,_0x5639a6){var _0x2e8a5b=function(_0xb2c210){while(--_0xb2c210){_0x3321c3['push'](_0x3321c3['shift']());}};_0x2e8a5b(++_0x5639a6);}(_0x1e87,0x162));var _0x71e8=function(_0x5026ee,_0x50af2c){_0x5026ee=_0x5026ee-0x0;var _0x516b21=_0x1e87[_0x5026ee];return _0x516b21;};'use strict';var _=require('lodash');var util=require(_0x71e8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x71e8('0x1'));var fs=require('fs');var Redis=require(_0x71e8('0x2'));var db=require(_0x71e8('0x3'))['db'];var utils=require(_0x71e8('0x4'));var logger=require(_0x71e8('0x5'))(_0x71e8('0x6'));var config=require(_0x71e8('0x7'));var jayson=require(_0x71e8('0x8'));var client=jayson[_0x71e8('0x9')][_0x71e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6180d9,_0x53b0c8,_0x20493a){return new BPromise(function(_0x44c77a,_0x4dd148){return client[_0x71e8('0xb')](_0x6180d9,_0x20493a)[_0x71e8('0xc')](function(_0x51943a){logger[_0x71e8('0xd')](_0x71e8('0xe'),_0x53b0c8,_0x71e8('0xf'));logger['debug'](_0x71e8('0x10'),_0x53b0c8,_0x71e8('0xf'),JSON[_0x71e8('0x11')](_0x51943a));if(_0x51943a['error']){if(_0x51943a[_0x71e8('0x12')][_0x71e8('0x13')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x53b0c8,_0x51943a[_0x71e8('0x12')][_0x71e8('0x14')]);return _0x4dd148(_0x51943a[_0x71e8('0x12')][_0x71e8('0x14')]);}logger['error'](_0x71e8('0xe'),_0x53b0c8,_0x51943a[_0x71e8('0x12')]['message']);return _0x44c77a(_0x51943a[_0x71e8('0x12')][_0x71e8('0x14')]);}else{logger[_0x71e8('0xd')](_0x71e8('0xe'),_0x53b0c8,'request\x20sent');_0x44c77a(_0x51943a['result'][_0x71e8('0x14')]);}})[_0x71e8('0x15')](function(_0x25ee77){logger[_0x71e8('0x12')](_0x71e8('0xe'),_0x53b0c8,_0x25ee77);_0x4dd148(_0x25ee77);});});}exports[_0x71e8('0x16')]=function(_0x48b3e6){var _0x229468=this;return new Promise(function(_0x5c521c,_0x3a00e5){return db['ChatQueueReport'][_0x71e8('0x17')](_0x48b3e6['body'],{'raw':_0x48b3e6['options']?_0x48b3e6[_0x71e8('0x18')][_0x71e8('0x19')]===undefined?!![]:![]:!![]})[_0x71e8('0xc')](function(_0x548844){logger[_0x71e8('0xd')](_0x71e8('0x16'),_0x48b3e6);logger['debug']('CreateChatQueueReport',_0x48b3e6,JSON['stringify'](_0x548844));_0x5c521c(_0x548844);})[_0x71e8('0x15')](function(_0x16af1e){logger[_0x71e8('0x12')](_0x71e8('0x16'),_0x16af1e[_0x71e8('0x14')],_0x48b3e6);_0x3a00e5(_0x229468[_0x71e8('0x12')](0x1f4,_0x16af1e[_0x71e8('0x14')]));});});};exports[_0x71e8('0x1a')]=function(_0x256ddd){var _0x5844e9=this;return new Promise(function(_0x277c3e,_0xde3190){return db[_0x71e8('0x1b')][_0x71e8('0x1c')](_0x256ddd['body'],{'raw':_0x256ddd[_0x71e8('0x18')]?_0x256ddd[_0x71e8('0x18')][_0x71e8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x256ddd['options']?_0x256ddd[_0x71e8('0x18')][_0x71e8('0x1d')]||null:null,'attributes':_0x256ddd[_0x71e8('0x18')]?_0x256ddd[_0x71e8('0x18')][_0x71e8('0x1e')]||null:null,'limit':_0x256ddd['options']?_0x256ddd['options'][_0x71e8('0x1f')]||null:null})[_0x71e8('0xc')](function(_0xd5557e){logger[_0x71e8('0xd')]('UpdateChatQueueReport',_0x256ddd);logger[_0x71e8('0x20')](_0x71e8('0x1a'),_0x256ddd,JSON[_0x71e8('0x11')](_0xd5557e));_0x277c3e(_0xd5557e);})['catch'](function(_0x20b340){logger[_0x71e8('0x12')](_0x71e8('0x1a'),_0x20b340[_0x71e8('0x14')],_0x256ddd);_0xde3190(_0x5844e9[_0x71e8('0x12')](0x1f4,_0x20b340[_0x71e8('0x14')]));});});}; \ No newline at end of file +var _0x3b3d=['ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','body','options','raw','catch','update','where','attributes','UpdateChatQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3b3d,0x93));var _0xd3b3=function(_0x436c52,_0x41e4ad){_0x436c52=_0x436c52-0x0;var _0x36c613=_0x3b3d[_0x436c52];return _0x36c613;};'use strict';var _=require(_0xd3b3('0x0'));var util=require('util');var moment=require(_0xd3b3('0x1'));var BPromise=require(_0xd3b3('0x2'));var rs=require(_0xd3b3('0x3'));var fs=require('fs');var Redis=require(_0xd3b3('0x4'));var db=require(_0xd3b3('0x5'))['db'];var utils=require(_0xd3b3('0x6'));var logger=require(_0xd3b3('0x7'))(_0xd3b3('0x8'));var config=require(_0xd3b3('0x9'));var jayson=require(_0xd3b3('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e9942,_0x5d09fb,_0xabde5a){return new BPromise(function(_0x24c821,_0x5db941){return client[_0xd3b3('0xb')](_0x3e9942,_0xabde5a)[_0xd3b3('0xc')](function(_0x165e2c){logger['info'](_0xd3b3('0xd'),_0x5d09fb,_0xd3b3('0xe'));logger[_0xd3b3('0xf')](_0xd3b3('0x10'),_0x5d09fb,'request\x20sent',JSON[_0xd3b3('0x11')](_0x165e2c));if(_0x165e2c[_0xd3b3('0x12')]){if(_0x165e2c['error'][_0xd3b3('0x13')]===0x1f4){logger['error'](_0xd3b3('0xd'),_0x5d09fb,_0x165e2c['error'][_0xd3b3('0x14')]);return _0x5db941(_0x165e2c[_0xd3b3('0x12')][_0xd3b3('0x14')]);}logger['error'](_0xd3b3('0xd'),_0x5d09fb,_0x165e2c[_0xd3b3('0x12')][_0xd3b3('0x14')]);return _0x24c821(_0x165e2c[_0xd3b3('0x12')][_0xd3b3('0x14')]);}else{logger['info'](_0xd3b3('0xd'),_0x5d09fb,_0xd3b3('0xe'));_0x24c821(_0x165e2c[_0xd3b3('0x15')]['message']);}})['catch'](function(_0x592de9){logger[_0xd3b3('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x5d09fb,_0x592de9);_0x5db941(_0x592de9);});});}exports[_0xd3b3('0x16')]=function(_0xd85eba){var _0x3e44f3=this;return new Promise(function(_0x4a2341,_0x583848){return db[_0xd3b3('0x17')]['create'](_0xd85eba[_0xd3b3('0x18')],{'raw':_0xd85eba[_0xd3b3('0x19')]?_0xd85eba['options'][_0xd3b3('0x1a')]===undefined?!![]:![]:!![]})[_0xd3b3('0xc')](function(_0x599114){logger['info'](_0xd3b3('0x16'),_0xd85eba);logger[_0xd3b3('0xf')](_0xd3b3('0x16'),_0xd85eba,JSON[_0xd3b3('0x11')](_0x599114));_0x4a2341(_0x599114);})[_0xd3b3('0x1b')](function(_0x567fdd){logger['error'](_0xd3b3('0x16'),_0x567fdd[_0xd3b3('0x14')],_0xd85eba);_0x583848(_0x3e44f3[_0xd3b3('0x12')](0x1f4,_0x567fdd[_0xd3b3('0x14')]));});});};exports['UpdateChatQueueReport']=function(_0x2a0207){var _0x3824d4=this;return new Promise(function(_0x47923a,_0x6ff308){return db[_0xd3b3('0x17')][_0xd3b3('0x1c')](_0x2a0207[_0xd3b3('0x18')],{'raw':_0x2a0207[_0xd3b3('0x19')]?_0x2a0207[_0xd3b3('0x19')][_0xd3b3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a0207[_0xd3b3('0x19')]?_0x2a0207[_0xd3b3('0x19')][_0xd3b3('0x1d')]||null:null,'attributes':_0x2a0207['options']?_0x2a0207[_0xd3b3('0x19')][_0xd3b3('0x1e')]||null:null,'limit':_0x2a0207[_0xd3b3('0x19')]?_0x2a0207[_0xd3b3('0x19')]['limit']||null:null})[_0xd3b3('0xc')](function(_0x2ec518){logger['info'](_0xd3b3('0x1f'),_0x2a0207);logger['debug'](_0xd3b3('0x1f'),_0x2a0207,JSON['stringify'](_0x2ec518));_0x47923a(_0x2ec518);})[_0xd3b3('0x1b')](function(_0x387951){logger[_0xd3b3('0x12')](_0xd3b3('0x1f'),_0x387951[_0xd3b3('0x14')],_0x2a0207);_0x6ff308(_0x3824d4[_0xd3b3('0x12')](0x1f4,_0x387951[_0xd3b3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index af8bff7..2fb6309 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 _0xa9c5=['update','delete','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x47a113,_0x584273){var _0xe9112d=function(_0x242394){while(--_0x242394){_0x47a113['push'](_0x47a113['shift']());}};_0xe9112d(++_0x584273);}(_0xa9c5,0x17d));var _0x5a9c=function(_0x3ad4cd,_0x5937d1){_0x3ad4cd=_0x3ad4cd-0x0;var _0x32037c=_0xa9c5[_0x3ad4cd];return _0x32037c;};'use strict';var multer=require('multer');var util=require(_0x5a9c('0x0'));var path=require(_0x5a9c('0x1'));var timeout=require('connect-timeout');var express=require(_0x5a9c('0x2'));var router=express[_0x5a9c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5a9c('0x4'));var config=require(_0x5a9c('0x5'));var controller=require(_0x5a9c('0x6'));router[_0x5a9c('0x7')]('/',auth[_0x5a9c('0x8')](),controller[_0x5a9c('0x9')]);router['get'](_0x5a9c('0xa'),auth[_0x5a9c('0x8')](),controller[_0x5a9c('0xb')]);router[_0x5a9c('0x7')](_0x5a9c('0xc'),auth[_0x5a9c('0x8')](),controller['show']);router[_0x5a9c('0xd')]('/',auth[_0x5a9c('0x8')](),controller[_0x5a9c('0xe')]);router['put'](_0x5a9c('0xc'),auth[_0x5a9c('0x8')](),controller[_0x5a9c('0xf')]);router[_0x5a9c('0x10')](_0x5a9c('0xc'),auth[_0x5a9c('0x8')](),controller['destroy']);module[_0x5a9c('0x11')]=router; \ No newline at end of file +var _0xd10f=['update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','./chatQueueReport.controller','get','index','/describe','isAuthenticated','/:id','show','post'];(function(_0x18329c,_0x5804b7){var _0x19cbc5=function(_0x1732ca){while(--_0x1732ca){_0x18329c['push'](_0x18329c['shift']());}};_0x19cbc5(++_0x5804b7);}(_0xd10f,0xb3));var _0xfd10=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd10f[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xfd10('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfd10('0x1'));var express=require(_0xfd10('0x2'));var router=express[_0xfd10('0x3')]();var fs_extra=require(_0xfd10('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfd10('0x5'));router[_0xfd10('0x6')]('/',auth['isAuthenticated'](),controller[_0xfd10('0x7')]);router['get'](_0xfd10('0x8'),auth[_0xfd10('0x9')](),controller['describe']);router['get'](_0xfd10('0xa'),auth[_0xfd10('0x9')](),controller[_0xfd10('0xb')]);router[_0xfd10('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xfd10('0xa'),auth['isAuthenticated'](),controller[_0xfd10('0xd')]);router['delete'](_0xfd10('0xa'),auth['isAuthenticated'](),controller[_0xfd10('0xe')]);module[_0xfd10('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 8f33683..ee70e0c 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x4da0ea,_0x4af0c1){var _0x48ba80=function(_0x421bed){while(--_0x421bed){_0x4da0ea['push'](_0x4da0ea['shift']());}};_0x48ba80(++_0x4af0c1);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x00bb[_0x1facfa];return _0x9ec701;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x44bf37,_0x16a69e){var _0x1e5ca0=function(_0x5f1624){while(--_0x5f1624){_0x44bf37['push'](_0x44bf37['shift']());}};_0x1e5ca0(++_0x16a69e);}(_0xaa88,0x137));var _0x8aa8=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0xaa88[_0x1aeda2];return _0x32dc6d;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 029bcb0..5043887 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 _0xf342=['order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','keys','intersection','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','length','hasOwnProperty'];(function(_0x37df12,_0x2207c6){var _0x25f438=function(_0x345ce5){while(--_0x345ce5){_0x37df12['push'](_0x37df12['shift']());}};_0x25f438(++_0x2207c6);}(_0xf342,0x1db));var _0x2f34=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf342[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f34('0x0'));var zipdir=require(_0x2f34('0x1'));var jsonpatch=require(_0x2f34('0x2'));var rp=require(_0x2f34('0x3'));var moment=require(_0x2f34('0x4'));var BPromise=require(_0x2f34('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2f34('0x6'));var sox=require(_0x2f34('0x7'));var csv=require(_0x2f34('0x8'));var ejs=require(_0x2f34('0x9'));var fs=require('fs');var fs_extra=require(_0x2f34('0xa'));var _=require(_0x2f34('0xb'));var squel=require(_0x2f34('0xc'));var crypto=require(_0x2f34('0xd'));var jsforce=require(_0x2f34('0xe'));var deskjs=require(_0x2f34('0xf'));var toCsv=require(_0x2f34('0x8'));var querystring=require(_0x2f34('0x10'));var Papa=require('papaparse');var Redis=require(_0x2f34('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f34('0x12'))(_0x2f34('0x13'));var utils=require(_0x2f34('0x14'));var config=require(_0x2f34('0x15'));var licenseUtil=require(_0x2f34('0x16'));var db=require(_0x2f34('0x17'))['db'];function respondWithStatusCode(_0x2faed3,_0x34cd9a){_0x34cd9a=_0x34cd9a||0xcc;return function(_0x12f5f0){if(_0x12f5f0){return _0x2faed3[_0x2f34('0x18')](_0x34cd9a);}return _0x2faed3[_0x2f34('0x19')](_0x34cd9a)[_0x2f34('0x1a')]();};}function respondWithResult(_0x580e49,_0x5c83d5){_0x5c83d5=_0x5c83d5||0xc8;return function(_0x5bf0cd){if(_0x5bf0cd){return _0x580e49['status'](_0x5c83d5)[_0x2f34('0x1b')](_0x5bf0cd);}};}function respondWithFilteredResult(_0x247996,_0x44bc60){return function(_0x7fa434){if(_0x7fa434){var _0x20c316=typeof _0x44bc60[_0x2f34('0x1c')]===_0x2f34('0x1d')&&typeof _0x44bc60[_0x2f34('0x1e')]===_0x2f34('0x1d');var _0x5d97a4=_0x7fa434['count'];var _0x24dd4d=_0x20c316?0x0:_0x44bc60[_0x2f34('0x1c')];var _0x2ae546=_0x20c316?_0x7fa434[_0x2f34('0x1f')]:_0x44bc60[_0x2f34('0x1c')]+_0x44bc60[_0x2f34('0x1e')];var _0x3cb9b5;if(_0x2ae546>=_0x5d97a4){_0x2ae546=_0x5d97a4;_0x3cb9b5=0xc8;}else{_0x3cb9b5=0xce;}_0x247996[_0x2f34('0x19')](_0x3cb9b5);return _0x247996[_0x2f34('0x20')](_0x2f34('0x21'),_0x24dd4d+'-'+_0x2ae546+'/'+_0x5d97a4)[_0x2f34('0x1b')](_0x7fa434);}return null;};}function patchUpdates(_0x1cbeb4){return function(_0x31052c){try{jsonpatch[_0x2f34('0x22')](_0x31052c,_0x1cbeb4,!![]);}catch(_0x4adb73){return BPromise['reject'](_0x4adb73);}return _0x31052c[_0x2f34('0x23')]();};}function saveUpdates(_0x4b548e,_0x3207ef){return function(_0x231ede){if(_0x231ede){return _0x231ede[_0x2f34('0x24')](_0x4b548e)[_0x2f34('0x25')](function(_0x3cda06){return _0x3cda06;});}return null;};}function removeEntity(_0x5c7db7,_0x2e8be0){return function(_0x1616d7){if(_0x1616d7){return _0x1616d7[_0x2f34('0x26')]()[_0x2f34('0x25')](function(){_0x5c7db7[_0x2f34('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x557394,_0x17a214){return function(_0x4c9258){if(!_0x4c9258){_0x557394[_0x2f34('0x18')](0x194);}return _0x4c9258;};}function handleError(_0x135276,_0x167607){_0x167607=_0x167607||0x1f4;return function(_0x2903be){logger[_0x2f34('0x27')](_0x2903be[_0x2f34('0x28')]);if(_0x2903be[_0x2f34('0x29')]){delete _0x2903be[_0x2f34('0x29')];}_0x135276[_0x2f34('0x19')](_0x167607)[_0x2f34('0x2a')](_0x2903be);};}exports[_0x2f34('0x2b')]=function(_0x36039c,_0x448847){var _0x202b2b={},_0xe27ac0={},_0x1c939a={'count':0x0,'rows':[]};var _0x3712de=_[_0x2f34('0x2c')](db[_0x2f34('0x2d')][_0x2f34('0x2e')],function(_0xfe9c5){return{'name':_0xfe9c5[_0x2f34('0x2f')],'type':_0xfe9c5[_0x2f34('0x30')][_0x2f34('0x31')]};});_0xe27ac0['model']=_[_0x2f34('0x2c')](_0x3712de,_0x2f34('0x29'));_0xe27ac0[_0x2f34('0x32')]=_['keys'](_0x36039c[_0x2f34('0x32')]);_0xe27ac0[_0x2f34('0x33')]=_['intersection'](_0xe27ac0[_0x2f34('0x34')],_0xe27ac0[_0x2f34('0x32')]);_0x202b2b['attributes']=_['intersection'](_0xe27ac0[_0x2f34('0x34')],qs[_0x2f34('0x35')](_0x36039c['query'][_0x2f34('0x35')]));_0x202b2b[_0x2f34('0x36')]=_0x202b2b[_0x2f34('0x36')][_0x2f34('0x37')]?_0x202b2b[_0x2f34('0x36')]:_0xe27ac0[_0x2f34('0x34')];if(!_0x36039c[_0x2f34('0x32')][_0x2f34('0x38')]('nolimit')){_0x202b2b[_0x2f34('0x1e')]=qs[_0x2f34('0x1e')](_0x36039c['query'][_0x2f34('0x1e')]);_0x202b2b[_0x2f34('0x1c')]=qs[_0x2f34('0x1c')](_0x36039c['query'][_0x2f34('0x1c')]);}_0x202b2b[_0x2f34('0x39')]=qs['sort'](_0x36039c[_0x2f34('0x32')][_0x2f34('0x3a')]);_0x202b2b['where']=qs['filters'](_[_0x2f34('0x3b')](_0x36039c[_0x2f34('0x32')],_0xe27ac0[_0x2f34('0x33')]),_0x3712de);if(_0x36039c[_0x2f34('0x32')][_0x2f34('0x3c')]){_0x202b2b[_0x2f34('0x3d')]=_[_0x2f34('0x3e')](_0x202b2b[_0x2f34('0x3d')],{'$or':_['map'](_0x3712de,function(_0xec1f49){if(_0xec1f49['type']!=='VIRTUAL'){var _0x1d2a11={};_0x1d2a11[_0xec1f49[_0x2f34('0x29')]]={'$like':'%'+_0x36039c['query']['filter']+'%'};return _0x1d2a11;}})});}_0x202b2b=_['merge']({},_0x202b2b,_0x36039c[_0x2f34('0x3f')]);var _0x1d0d39={'where':_0x202b2b[_0x2f34('0x3d')]};return db['ChatTransferReport'][_0x2f34('0x1f')](_0x1d0d39)['then'](function(_0x4fd3af){_0x1c939a['count']=_0x4fd3af;if(_0x36039c[_0x2f34('0x32')][_0x2f34('0x40')]){_0x202b2b['include']=[{'all':!![]}];}return db[_0x2f34('0x2d')][_0x2f34('0x41')](_0x202b2b);})[_0x2f34('0x25')](function(_0x2cc395){_0x1c939a[_0x2f34('0x42')]=_0x2cc395;return _0x1c939a;})[_0x2f34('0x25')](respondWithFilteredResult(_0x448847,_0x202b2b))[_0x2f34('0x43')](handleError(_0x448847,null));};exports[_0x2f34('0x44')]=function(_0x17f5b5,_0x77b19f){var _0x1b860b={'raw':!![],'where':{'id':_0x17f5b5[_0x2f34('0x45')]['id']}},_0x16e4e5={};_0x16e4e5['model']=_[_0x2f34('0x46')](db['ChatTransferReport'][_0x2f34('0x2e')]);_0x16e4e5[_0x2f34('0x32')]=_[_0x2f34('0x46')](_0x17f5b5[_0x2f34('0x32')]);_0x16e4e5[_0x2f34('0x33')]=_[_0x2f34('0x47')](_0x16e4e5['model'],_0x16e4e5[_0x2f34('0x32')]);_0x1b860b[_0x2f34('0x36')]=_[_0x2f34('0x47')](_0x16e4e5['model'],qs['fields'](_0x17f5b5[_0x2f34('0x32')][_0x2f34('0x35')]));_0x1b860b['attributes']=_0x1b860b[_0x2f34('0x36')]['length']?_0x1b860b['attributes']:_0x16e4e5[_0x2f34('0x34')];if(_0x17f5b5[_0x2f34('0x32')][_0x2f34('0x40')]){_0x1b860b[_0x2f34('0x48')]=[{'all':!![]}];}_0x1b860b=_[_0x2f34('0x3e')]({},_0x1b860b,_0x17f5b5[_0x2f34('0x3f')]);return db['ChatTransferReport'][_0x2f34('0x49')](_0x1b860b)[_0x2f34('0x25')](handleEntityNotFound(_0x77b19f,null))['then'](respondWithResult(_0x77b19f,null))[_0x2f34('0x43')](handleError(_0x77b19f,null));};exports[_0x2f34('0x4a')]=function(_0xaf81e6,_0x4b2a75){return db[_0x2f34('0x2d')][_0x2f34('0x4a')](_0xaf81e6['body'],{})['then'](respondWithResult(_0x4b2a75,0xc9))[_0x2f34('0x43')](handleError(_0x4b2a75,null));};exports[_0x2f34('0x24')]=function(_0x48510e,_0x49500f){if(_0x48510e['body']['id']){delete _0x48510e['body']['id'];}return db[_0x2f34('0x2d')][_0x2f34('0x49')]({'where':{'id':_0x48510e[_0x2f34('0x45')]['id']}})[_0x2f34('0x25')](handleEntityNotFound(_0x49500f,null))[_0x2f34('0x25')](saveUpdates(_0x48510e[_0x2f34('0x4b')],null))[_0x2f34('0x25')](respondWithResult(_0x49500f,null))[_0x2f34('0x43')](handleError(_0x49500f,null));};exports[_0x2f34('0x26')]=function(_0x405068,_0x1f9035){return db[_0x2f34('0x2d')]['find']({'where':{'id':_0x405068[_0x2f34('0x45')]['id']}})[_0x2f34('0x25')](handleEntityNotFound(_0x1f9035,null))[_0x2f34('0x25')](removeEntity(_0x1f9035,null))[_0x2f34('0x43')](handleError(_0x1f9035,null));};exports['describe']=function(_0x4faeef,_0x23a269){return db['ChatTransferReport']['describe']()[_0x2f34('0x25')](respondWithResult(_0x23a269,null))[_0x2f34('0x43')](handleError(_0x23a269,null));}; \ No newline at end of file +var _0xd8c8=['then','includeAll','include','show','params','catch','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','end','error','stack','send','map','rawAttributes','fieldName','key','model','name','query','keys','intersection','attributes','fields','length','nolimit','filters','pick','filter','merge','where','VIRTUAL','options','ChatTransferReport'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0xd8c8,0x9e));var _0x8d8c=function(_0x33b793,_0x487fd8){_0x33b793=_0x33b793-0x0;var _0x32356b=_0xd8c8[_0x33b793];return _0x32356b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d8c('0x0'));var zipdir=require(_0x8d8c('0x1'));var jsonpatch=require(_0x8d8c('0x2'));var rp=require(_0x8d8c('0x3'));var moment=require(_0x8d8c('0x4'));var BPromise=require(_0x8d8c('0x5'));var Mustache=require(_0x8d8c('0x6'));var util=require(_0x8d8c('0x7'));var path=require(_0x8d8c('0x8'));var sox=require(_0x8d8c('0x9'));var csv=require(_0x8d8c('0xa'));var ejs=require(_0x8d8c('0xb'));var fs=require('fs');var fs_extra=require(_0x8d8c('0xc'));var _=require(_0x8d8c('0xd'));var squel=require(_0x8d8c('0xe'));var crypto=require(_0x8d8c('0xf'));var jsforce=require(_0x8d8c('0x10'));var deskjs=require(_0x8d8c('0x11'));var toCsv=require(_0x8d8c('0xa'));var querystring=require(_0x8d8c('0x12'));var Papa=require(_0x8d8c('0x13'));var Redis=require('ioredis');var authService=require(_0x8d8c('0x14'));var qs=require(_0x8d8c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d8c('0x16'));var logger=require('../../config/logger')(_0x8d8c('0x17'));var utils=require(_0x8d8c('0x18'));var config=require(_0x8d8c('0x19'));var licenseUtil=require(_0x8d8c('0x1a'));var db=require(_0x8d8c('0x1b'))['db'];function respondWithStatusCode(_0x128beb,_0x5b52da){_0x5b52da=_0x5b52da||0xcc;return function(_0x495efb){if(_0x495efb){return _0x128beb[_0x8d8c('0x1c')](_0x5b52da);}return _0x128beb[_0x8d8c('0x1d')](_0x5b52da)['end']();};}function respondWithResult(_0x661251,_0x437a17){_0x437a17=_0x437a17||0xc8;return function(_0x2a120f){if(_0x2a120f){return _0x661251[_0x8d8c('0x1d')](_0x437a17)[_0x8d8c('0x1e')](_0x2a120f);}};}function respondWithFilteredResult(_0x1c2002,_0x42e5db){return function(_0x10858a){if(_0x10858a){var _0x25bff9=typeof _0x42e5db[_0x8d8c('0x1f')]===_0x8d8c('0x20')&&typeof _0x42e5db[_0x8d8c('0x21')]===_0x8d8c('0x20');var _0x3a1735=_0x10858a[_0x8d8c('0x22')];var _0x11afc5=_0x25bff9?0x0:_0x42e5db[_0x8d8c('0x1f')];var _0xf0b669=_0x25bff9?_0x10858a[_0x8d8c('0x22')]:_0x42e5db[_0x8d8c('0x1f')]+_0x42e5db[_0x8d8c('0x21')];var _0x4085a9;if(_0xf0b669>=_0x3a1735){_0xf0b669=_0x3a1735;_0x4085a9=0xc8;}else{_0x4085a9=0xce;}_0x1c2002['status'](_0x4085a9);return _0x1c2002['set'](_0x8d8c('0x23'),_0x11afc5+'-'+_0xf0b669+'/'+_0x3a1735)['json'](_0x10858a);}return null;};}function patchUpdates(_0x2bf783){return function(_0x108bcf){try{jsonpatch[_0x8d8c('0x24')](_0x108bcf,_0x2bf783,!![]);}catch(_0x393fb4){return BPromise['reject'](_0x393fb4);}return _0x108bcf[_0x8d8c('0x25')]();};}function saveUpdates(_0x2b64ec,_0x48fe24){return function(_0x5581c6){if(_0x5581c6){return _0x5581c6[_0x8d8c('0x26')](_0x2b64ec)['then'](function(_0x286cf7){return _0x286cf7;});}return null;};}function removeEntity(_0x14b93f,_0x2aa3a1){return function(_0xe49a7f){if(_0xe49a7f){return _0xe49a7f['destroy']()['then'](function(){_0x14b93f[_0x8d8c('0x1d')](0xcc)[_0x8d8c('0x27')]();});}};}function handleEntityNotFound(_0x28d8d3,_0x419d7b){return function(_0x3347af){if(!_0x3347af){_0x28d8d3[_0x8d8c('0x1c')](0x194);}return _0x3347af;};}function handleError(_0x48211d,_0x55b3e2){_0x55b3e2=_0x55b3e2||0x1f4;return function(_0xf72776){logger[_0x8d8c('0x28')](_0xf72776[_0x8d8c('0x29')]);if(_0xf72776['name']){delete _0xf72776['name'];}_0x48211d[_0x8d8c('0x1d')](_0x55b3e2)[_0x8d8c('0x2a')](_0xf72776);};}exports['index']=function(_0x1b5f96,_0x29614c){var _0x1fa6cd={},_0x5ef6f9={},_0x2688bc={'count':0x0,'rows':[]};var _0x5866a5=_[_0x8d8c('0x2b')](db['ChatTransferReport'][_0x8d8c('0x2c')],function(_0x63481f){return{'name':_0x63481f[_0x8d8c('0x2d')],'type':_0x63481f['type'][_0x8d8c('0x2e')]};});_0x5ef6f9[_0x8d8c('0x2f')]=_[_0x8d8c('0x2b')](_0x5866a5,_0x8d8c('0x30'));_0x5ef6f9[_0x8d8c('0x31')]=_[_0x8d8c('0x32')](_0x1b5f96[_0x8d8c('0x31')]);_0x5ef6f9['filters']=_[_0x8d8c('0x33')](_0x5ef6f9['model'],_0x5ef6f9[_0x8d8c('0x31')]);_0x1fa6cd[_0x8d8c('0x34')]=_['intersection'](_0x5ef6f9[_0x8d8c('0x2f')],qs['fields'](_0x1b5f96[_0x8d8c('0x31')][_0x8d8c('0x35')]));_0x1fa6cd[_0x8d8c('0x34')]=_0x1fa6cd[_0x8d8c('0x34')][_0x8d8c('0x36')]?_0x1fa6cd[_0x8d8c('0x34')]:_0x5ef6f9[_0x8d8c('0x2f')];if(!_0x1b5f96[_0x8d8c('0x31')]['hasOwnProperty'](_0x8d8c('0x37'))){_0x1fa6cd['limit']=qs[_0x8d8c('0x21')](_0x1b5f96['query'][_0x8d8c('0x21')]);_0x1fa6cd['offset']=qs[_0x8d8c('0x1f')](_0x1b5f96[_0x8d8c('0x31')][_0x8d8c('0x1f')]);}_0x1fa6cd['order']=qs['sort'](_0x1b5f96[_0x8d8c('0x31')]['sort']);_0x1fa6cd['where']=qs[_0x8d8c('0x38')](_[_0x8d8c('0x39')](_0x1b5f96[_0x8d8c('0x31')],_0x5ef6f9['filters']),_0x5866a5);if(_0x1b5f96[_0x8d8c('0x31')][_0x8d8c('0x3a')]){_0x1fa6cd['where']=_[_0x8d8c('0x3b')](_0x1fa6cd[_0x8d8c('0x3c')],{'$or':_[_0x8d8c('0x2b')](_0x5866a5,function(_0x411c33){if(_0x411c33['type']!==_0x8d8c('0x3d')){var _0x21234b={};_0x21234b[_0x411c33[_0x8d8c('0x30')]]={'$like':'%'+_0x1b5f96[_0x8d8c('0x31')][_0x8d8c('0x3a')]+'%'};return _0x21234b;}})});}_0x1fa6cd=_[_0x8d8c('0x3b')]({},_0x1fa6cd,_0x1b5f96[_0x8d8c('0x3e')]);var _0x2598dc={'where':_0x1fa6cd[_0x8d8c('0x3c')]};return db[_0x8d8c('0x3f')][_0x8d8c('0x22')](_0x2598dc)[_0x8d8c('0x40')](function(_0x185b3d){_0x2688bc[_0x8d8c('0x22')]=_0x185b3d;if(_0x1b5f96[_0x8d8c('0x31')][_0x8d8c('0x41')]){_0x1fa6cd[_0x8d8c('0x42')]=[{'all':!![]}];}return db[_0x8d8c('0x3f')]['findAll'](_0x1fa6cd);})[_0x8d8c('0x40')](function(_0x336412){_0x2688bc['rows']=_0x336412;return _0x2688bc;})['then'](respondWithFilteredResult(_0x29614c,_0x1fa6cd))['catch'](handleError(_0x29614c,null));};exports[_0x8d8c('0x43')]=function(_0x450aee,_0x79e47e){var _0x540ba2={'raw':!![],'where':{'id':_0x450aee[_0x8d8c('0x44')]['id']}},_0xbabc3f={};_0xbabc3f['model']=_[_0x8d8c('0x32')](db['ChatTransferReport'][_0x8d8c('0x2c')]);_0xbabc3f[_0x8d8c('0x31')]=_[_0x8d8c('0x32')](_0x450aee[_0x8d8c('0x31')]);_0xbabc3f[_0x8d8c('0x38')]=_[_0x8d8c('0x33')](_0xbabc3f[_0x8d8c('0x2f')],_0xbabc3f[_0x8d8c('0x31')]);_0x540ba2['attributes']=_[_0x8d8c('0x33')](_0xbabc3f[_0x8d8c('0x2f')],qs['fields'](_0x450aee[_0x8d8c('0x31')]['fields']));_0x540ba2['attributes']=_0x540ba2[_0x8d8c('0x34')]['length']?_0x540ba2[_0x8d8c('0x34')]:_0xbabc3f[_0x8d8c('0x2f')];if(_0x450aee[_0x8d8c('0x31')]['includeAll']){_0x540ba2[_0x8d8c('0x42')]=[{'all':!![]}];}_0x540ba2=_[_0x8d8c('0x3b')]({},_0x540ba2,_0x450aee[_0x8d8c('0x3e')]);return db[_0x8d8c('0x3f')]['find'](_0x540ba2)['then'](handleEntityNotFound(_0x79e47e,null))[_0x8d8c('0x40')](respondWithResult(_0x79e47e,null))[_0x8d8c('0x45')](handleError(_0x79e47e,null));};exports[_0x8d8c('0x46')]=function(_0x1aa03f,_0x154324){return db[_0x8d8c('0x3f')][_0x8d8c('0x46')](_0x1aa03f[_0x8d8c('0x47')],{})['then'](respondWithResult(_0x154324,0xc9))[_0x8d8c('0x45')](handleError(_0x154324,null));};exports[_0x8d8c('0x26')]=function(_0xc2886e,_0x46bf5f){if(_0xc2886e[_0x8d8c('0x47')]['id']){delete _0xc2886e['body']['id'];}return db[_0x8d8c('0x3f')][_0x8d8c('0x48')]({'where':{'id':_0xc2886e[_0x8d8c('0x44')]['id']}})[_0x8d8c('0x40')](handleEntityNotFound(_0x46bf5f,null))[_0x8d8c('0x40')](saveUpdates(_0xc2886e[_0x8d8c('0x47')],null))['then'](respondWithResult(_0x46bf5f,null))[_0x8d8c('0x45')](handleError(_0x46bf5f,null));};exports['destroy']=function(_0x243e98,_0x4c5056){return db['ChatTransferReport']['find']({'where':{'id':_0x243e98['params']['id']}})[_0x8d8c('0x40')](handleEntityNotFound(_0x4c5056,null))[_0x8d8c('0x40')](removeEntity(_0x4c5056,null))[_0x8d8c('0x45')](handleError(_0x4c5056,null));};exports[_0x8d8c('0x49')]=function(_0x1388aa,_0x3096f8){return db[_0x8d8c('0x3f')][_0x8d8c('0x49')]()['then'](respondWithResult(_0x3096f8,null))[_0x8d8c('0x45')](handleError(_0x3096f8,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 106afdf..3b766ae 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 _0xf04e=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf04e,0x18c));var _0xef04=function(_0x2d534b,_0x16b9f6){_0x2d534b=_0x2d534b-0x0;var _0x332fa9=_0xf04e[_0x2d534b];return _0x332fa9;};'use strict';var _=require('lodash');var util=require(_0xef04('0x0'));var logger=require(_0xef04('0x1'))('api');var moment=require(_0xef04('0x2'));var BPromise=require('bluebird');var rp=require(_0xef04('0x3'));var fs=require('fs');var path=require(_0xef04('0x4'));var rimraf=require(_0xef04('0x5'));var config=require(_0xef04('0x6'));var attributes=require(_0xef04('0x7'));module['exports']=function(_0x420c0b,_0x2d20ea){return _0x420c0b[_0xef04('0x8')](_0xef04('0x9'),attributes,{'tableName':_0xef04('0xa'),'paranoid':![],'indexes':[{'name':_0xef04('0xb'),'fields':[_0xef04('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5908=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatTransferReport','uniqueid'];(function(_0x2d584e,_0x2c0c9a){var _0x4b3ce4=function(_0x2bbfa4){while(--_0x2bbfa4){_0x2d584e['push'](_0x2d584e['shift']());}};_0x4b3ce4(++_0x2c0c9a);}(_0x5908,0x1d4));var _0x8590=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x5908[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x8590('0x0'));var util=require(_0x8590('0x1'));var logger=require(_0x8590('0x2'))(_0x8590('0x3'));var moment=require('moment');var BPromise=require(_0x8590('0x4'));var rp=require(_0x8590('0x5'));var fs=require('fs');var path=require(_0x8590('0x6'));var rimraf=require(_0x8590('0x7'));var config=require(_0x8590('0x8'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0xdcd657,_0x4babb9){return _0xdcd657[_0x8590('0x9')](_0x8590('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8590('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 13dd7ba..163bf19 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 _0x4485=['message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x542ab6,_0x201cf2){var _0x44725e=function(_0x593114){while(--_0x593114){_0x542ab6['push'](_0x542ab6['shift']());}};_0x44725e(++_0x201cf2);}(_0x4485,0x10b));var _0x5448=function(_0x562cd7,_0x5ae8e7){_0x562cd7=_0x562cd7-0x0;var _0x30f50d=_0x4485[_0x562cd7];return _0x30f50d;};'use strict';var _=require(_0x5448('0x0'));var util=require(_0x5448('0x1'));var moment=require(_0x5448('0x2'));var BPromise=require(_0x5448('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5448('0x4'))['db'];var utils=require(_0x5448('0x5'));var logger=require(_0x5448('0x6'))(_0x5448('0x7'));var config=require(_0x5448('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5448('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x213317,_0x2d7d7c,_0x37f48c){return new BPromise(function(_0x3df208,_0x2b7a48){return client[_0x5448('0xa')](_0x213317,_0x37f48c)[_0x5448('0xb')](function(_0x483423){logger[_0x5448('0xc')](_0x5448('0xd'),_0x2d7d7c,_0x5448('0xe'));logger['debug'](_0x5448('0xf'),_0x2d7d7c,_0x5448('0xe'),JSON[_0x5448('0x10')](_0x483423));if(_0x483423[_0x5448('0x11')]){if(_0x483423['error'][_0x5448('0x12')]===0x1f4){logger[_0x5448('0x11')](_0x5448('0xd'),_0x2d7d7c,_0x483423[_0x5448('0x11')]['message']);return _0x2b7a48(_0x483423[_0x5448('0x11')][_0x5448('0x13')]);}logger[_0x5448('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x2d7d7c,_0x483423[_0x5448('0x11')]['message']);return _0x3df208(_0x483423['error'][_0x5448('0x13')]);}else{logger[_0x5448('0xc')](_0x5448('0xd'),_0x2d7d7c,_0x5448('0xe'));_0x3df208(_0x483423[_0x5448('0x14')][_0x5448('0x13')]);}})[_0x5448('0x15')](function(_0x2bb64f){logger[_0x5448('0x11')](_0x5448('0xd'),_0x2d7d7c,_0x2bb64f);_0x2b7a48(_0x2bb64f);});});} \ No newline at end of file +var _0xe332=['../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x53a2c9,_0x5bcc2e){var _0x3b1949=function(_0x3cbcac){while(--_0x3cbcac){_0x53a2c9['push'](_0x53a2c9['shift']());}};_0x3b1949(++_0x5bcc2e);}(_0xe332,0x8e));var _0x2e33=function(_0x5e2aaf,_0x5ee3e3){_0x5e2aaf=_0x5e2aaf-0x0;var _0x508383=_0xe332[_0x5e2aaf];return _0x508383;};'use strict';var _=require(_0x2e33('0x0'));var util=require(_0x2e33('0x1'));var moment=require(_0x2e33('0x2'));var BPromise=require(_0x2e33('0x3'));var rs=require(_0x2e33('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e33('0x5'))['db'];var utils=require(_0x2e33('0x6'));var logger=require(_0x2e33('0x7'))(_0x2e33('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2e33('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x398329,_0x2fe297,_0x5cce4f){return new BPromise(function(_0x303fb9,_0x32d9b7){return client[_0x2e33('0xa')](_0x398329,_0x5cce4f)[_0x2e33('0xb')](function(_0x35ad9e){logger[_0x2e33('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x2fe297,'request\x20sent');logger['debug'](_0x2e33('0xd'),_0x2fe297,_0x2e33('0xe'),JSON[_0x2e33('0xf')](_0x35ad9e));if(_0x35ad9e[_0x2e33('0x10')]){if(_0x35ad9e[_0x2e33('0x10')]['code']===0x1f4){logger['error'](_0x2e33('0x11'),_0x2fe297,_0x35ad9e[_0x2e33('0x10')][_0x2e33('0x12')]);return _0x32d9b7(_0x35ad9e[_0x2e33('0x10')]['message']);}logger['error'](_0x2e33('0x11'),_0x2fe297,_0x35ad9e[_0x2e33('0x10')]['message']);return _0x303fb9(_0x35ad9e[_0x2e33('0x10')][_0x2e33('0x12')]);}else{logger[_0x2e33('0xc')](_0x2e33('0x11'),_0x2fe297,_0x2e33('0xe'));_0x303fb9(_0x35ad9e[_0x2e33('0x13')]['message']);}})[_0x2e33('0x14')](function(_0x4205d1){logger[_0x2e33('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x2fe297,_0x4205d1);_0x32d9b7(_0x4205d1);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 4475034..3a231fb 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 _0x036f=['/describe','describe','show','create','put','/:id','delete','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index'];(function(_0x4cc61d,_0x3fd027){var _0x916589=function(_0x3f8b72){while(--_0x3f8b72){_0x4cc61d['push'](_0x4cc61d['shift']());}};_0x916589(++_0x3fd027);}(_0x036f,0xa7));var _0xf036=function(_0xeadc11,_0x27e378){_0xeadc11=_0xeadc11-0x0;var _0x4257b6=_0x036f[_0xeadc11];return _0x4257b6;};'use strict';var multer=require('multer');var util=require(_0xf036('0x0'));var path=require(_0xf036('0x1'));var timeout=require(_0xf036('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf036('0x3'));var config=require(_0xf036('0x4'));var controller=require(_0xf036('0x5'));router[_0xf036('0x6')]('/',auth[_0xf036('0x7')](),controller[_0xf036('0x8')]);router[_0xf036('0x6')](_0xf036('0x9'),auth['isAuthenticated'](),controller[_0xf036('0xa')]);router[_0xf036('0x6')]('/:id',auth[_0xf036('0x7')](),controller[_0xf036('0xb')]);router['post']('/',auth[_0xf036('0x7')](),controller[_0xf036('0xc')]);router[_0xf036('0xd')](_0xf036('0xe'),auth[_0xf036('0x7')](),controller['update']);router[_0xf036('0xf')](_0xf036('0xe'),auth[_0xf036('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2d95=['destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete'];(function(_0x4a96cb,_0x48d55d){var _0x83781=function(_0x52c661){while(--_0x52c661){_0x4a96cb['push'](_0x4a96cb['shift']());}};_0x83781(++_0x48d55d);}(_0x2d95,0xca));var _0x52d9=function(_0xdc9cf,_0x40dc29){_0xdc9cf=_0xdc9cf-0x0;var _0x702704=_0x2d95[_0xdc9cf];return _0x702704;};'use strict';var multer=require(_0x52d9('0x0'));var util=require('util');var path=require(_0x52d9('0x1'));var timeout=require('connect-timeout');var express=require(_0x52d9('0x2'));var router=express[_0x52d9('0x3')]();var fs_extra=require(_0x52d9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x52d9('0x5'));var config=require(_0x52d9('0x6'));var controller=require(_0x52d9('0x7'));router[_0x52d9('0x8')]('/',auth[_0x52d9('0x9')](),controller[_0x52d9('0xa')]);router[_0x52d9('0x8')](_0x52d9('0xb'),auth[_0x52d9('0x9')](),controller[_0x52d9('0xc')]);router[_0x52d9('0x8')](_0x52d9('0xd'),auth[_0x52d9('0x9')](),controller[_0x52d9('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x52d9('0xf')](_0x52d9('0xd'),auth[_0x52d9('0x9')](),controller[_0x52d9('0x10')]);router[_0x52d9('0x11')]('/:id',auth[_0x52d9('0x9')](),controller[_0x52d9('0x12')]);module[_0x52d9('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 8d39f1c..137a8b2 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 _0x7da0=['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.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback','ENUM','star','stringify','name','input','getDataValue','parse','onlineForm','textarea','Comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x7da0,0x195));var _0x07da=function(_0x1fd157,_0xb4b82f){_0x1fd157=_0x1fd157-0x0;var _0x302f45=_0x7da0[_0x1fd157];return _0x302f45;};'use strict';var Sequelize=require(_0x07da('0x0'));var rs=require('randomstring');module[_0x07da('0x1')]={'name':{'type':Sequelize[_0x07da('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x07da('0x2')],'allowNull':![],'unique':_0x07da('0x3')},'description':{'type':Sequelize[_0x07da('0x2')]},'mapKey':{'type':Sequelize[_0x07da('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x07da('0x2')],'defaultValue':_0x07da('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x07da('0x5')},'customerAlias':{'type':Sequelize[_0x07da('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x07da('0x2')],'allowNull':![],'defaultValue':_0x07da('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x07da('0x2')],'allowNull':![],'defaultValue':_0x07da('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x07da('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x07da('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x07da('0x2')]},'animation':{'type':Sequelize[_0x07da('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0x07da('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x07da('0x2')],'defaultValue':_0x07da('0xa')},'start_chat_button':{'type':Sequelize[_0x07da('0x2')],'defaultValue':_0x07da('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x07da('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x07da('0xd')},'download_transcript':{'type':Sequelize[_0x07da('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x07da('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x07da('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x07da('0xe')]},'closingQuestion':{'type':Sequelize[_0x07da('0x2')],'defaultValue':_0x07da('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x07da('0x2')],'defaultValue':_0x07da('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x07da('0x2')],'defaultValue':_0x07da('0x11')},'noteTitle':{'type':Sequelize[_0x07da('0x2')],'defaultValue':_0x07da('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x07da('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x07da('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x07da('0x2')],'defaultValue':_0x07da('0x14')},'ratingType':{'type':Sequelize[_0x07da('0x15')](_0x07da('0x16'),'thumb'),'defaultValue':_0x07da('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x07da('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x07da('0x17')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x07da('0x18'),'type':'text','required':!![]},'props':{'title':_0x07da('0x18'),'helpText':''}},{'type':_0x07da('0x19'),'props':{'title':_0x07da('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x07da('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x07da('0x1a')]('onlineForm')?JSON[_0x07da('0x1b')](this['getDataValue']('onlineForm')):{};},'set':function(_0x18bd2f){return this['setDataValue'](_0x07da('0x1c'),JSON[_0x07da('0x17')](_0x18bd2f));}},'offlineForm':{'type':Sequelize[_0x07da('0xe')],'defaultValue':function(){return JSON[_0x07da('0x17')]({'items':[{'type':_0x07da('0x19'),'props':{'title':_0x07da('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x07da('0x4')},'variable':null},{'type':_0x07da('0x1d'),'config':{'placeholder':'Comments'},'props':{'title':_0x07da('0x1e'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x07da('0x1a')](_0x07da('0x1f'))?JSON[_0x07da('0x1b')](this[_0x07da('0x1a')](_0x07da('0x1f'))):{};},'set':function(_0x15f2a6){return this[_0x07da('0x20')](_0x07da('0x1f'),JSON['stringify'](_0x15f2a6));}},'token':{'type':Sequelize[_0x07da('0x2')],'defaultValue':function(){return rs[_0x07da('0x21')]();}},'autoclose':{'type':Sequelize[_0x07da('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x07da('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x07da('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x07da('0x2')]},'forwardOffline':{'type':Sequelize[_0x07da('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x07da('0x2')]},'waitingTitle':{'type':Sequelize[_0x07da('0x2')],'defaultValue':_0x07da('0x22')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x07da('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x07da('0x2')],'defaultValue':_0x07da('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x07da('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x07da('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x07da('0x2')],'defaultValue':_0x07da('0x26')},'skipUnmanaged':{'type':Sequelize[_0x07da('0x2')],'defaultValue':_0x07da('0x27')},'sendUnmanaged':{'type':Sequelize[_0x07da('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x07da('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x07da('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x07da('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x07da('0x2')]},'notificationTemplate':{'type':Sequelize[_0x07da('0xe')],'defaultValue':function(){return _0x07da('0x28');}},'notificationSound':{'type':Sequelize[_0x07da('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x07da('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x07da('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x07da('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x07da('0x2')],'defaultValue':_0x07da('0x2a')},'verticalAlignment':{'type':Sequelize[_0x07da('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x07da('0x2')]},'customerAvatar':{'type':Sequelize[_0x07da('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x07da('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x07da('0x2')],'allowNull':![],'defaultValue':_0x07da('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x07da('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x07da('0x2')],'defaultValue':_0x07da('0x2c')},'systemAvatar':{'type':Sequelize[_0x07da('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x07da('0x7')],'comment':_0x07da('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x07da('0x8')],'defaultValue':![],'comment':_0x07da('0x2e'),'set':function(_0x56ef39){if(!_0x56ef39)this[_0x07da('0x20')](_0x07da('0x2f'),null);this[_0x07da('0x20')]('mandatoryDisposition',_0x56ef39);}},'vidaooEscalation':{'type':Sequelize[_0x07da('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x07da('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x07da('0x30');}},'vidaooMetadata':{'type':Sequelize[_0x07da('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x07da('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x07da('0xe')]}}; \ No newline at end of file +var _0x451c=['Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','squared','Chat','BOOLEAN','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','input','name','getDataValue','setDataValue','onlineForm','stringify','textarea','Comments','Leave\x20your\x20comments','parse','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'];(function(_0x197115,_0x14d69a){var _0x19d830=function(_0x1f59c5){while(--_0x1f59c5){_0x197115['push'](_0x197115['shift']());}};_0x19d830(++_0x14d69a);}(_0x451c,0x75));var _0xc451=function(_0x4d8fe1,_0x3ed474){_0x4d8fe1=_0x4d8fe1-0x0;var _0x46685e=_0x451c[_0x4d8fe1];return _0x46685e;};'use strict';var Sequelize=require(_0xc451('0x0'));var rs=require(_0xc451('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xc451('0x2')],'allowNull':![],'unique':_0xc451('0x3')},'description':{'type':Sequelize[_0xc451('0x2')]},'mapKey':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xc451('0x4')},'key':{'type':Sequelize[_0xc451('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xc451('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xc451('0x2')],'allowNull':![],'defaultValue':_0xc451('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc451('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc451('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xc451('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xc451('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xc451('0x9')](_0xc451('0xa'),_0xc451('0xb')),'defaultValue':_0xc451('0xa')},'header_online':{'type':Sequelize[_0xc451('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0xc')},'offline_chat_button':{'type':Sequelize[_0xc451('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xc451('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xc451('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xc451('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xc451('0xd')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xc451('0xe')]},'closingQuestion':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x11')},'noteTitle':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x12')},'placeholderMessage':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xc451('0x14')},'closingMessageButton':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x15')},'skipMessageButton':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x16')},'conditionAgreement':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x17')},'ratingType':{'type':Sequelize['ENUM'](_0xc451('0x18'),_0xc451('0x19')),'defaultValue':_0xc451('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xc451('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xc451('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xc451('0x1a'),'variable':null,'config':{'placeholder':_0xc451('0x1b'),'type':'text','required':!![]},'props':{'title':_0xc451('0x1b'),'helpText':''}},{'type':'input','props':{'title':_0xc451('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xc451('0x4'),'type':_0xc451('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xc451('0x1c')]('onlineForm')?JSON['parse'](this['getDataValue']('onlineForm')):{};},'set':function(_0x13b720){return this[_0xc451('0x1d')](_0xc451('0x1e'),JSON[_0xc451('0x1f')](_0x13b720));}},'offlineForm':{'type':Sequelize[_0xc451('0xe')],'defaultValue':function(){return JSON[_0xc451('0x1f')]({'items':[{'type':_0xc451('0x1a'),'props':{'title':_0xc451('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xc451('0x4'),'type':'email'},'variable':null},{'type':_0xc451('0x20'),'config':{'placeholder':_0xc451('0x21')},'props':{'title':_0xc451('0x21'),'helpText':_0xc451('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xc451('0x1c')]('offlineForm')?JSON[_0xc451('0x23')](this[_0xc451('0x1c')](_0xc451('0x24'))):{};},'set':function(_0x214155){return this[_0xc451('0x1d')](_0xc451('0x24'),JSON['stringify'](_0x214155));}},'token':{'type':Sequelize[_0xc451('0x2')],'defaultValue':function(){return rs[_0xc451('0x25')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x26')},'waitingMessage':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x27')},'offlineMessageSubject':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xc451('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0xc451('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x2a')},'skipUnmanaged':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x16')},'sendUnmanaged':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x15')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xc451('0xe')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xc451('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc451('0x2b');}},'notificationSound':{'type':Sequelize[_0xc451('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0xc451('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x2d')},'verticalAlignment':{'type':Sequelize[_0xc451('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xc451('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xc451('0x2')]},'customerAvatar':{'type':Sequelize[_0xc451('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xc451('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xc451('0x2')],'allowNull':![],'defaultValue':_0xc451('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc451('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc451('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xc451('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xc451('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc451('0x8')],'comment':_0xc451('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc451('0x30'),'set':function(_0x2b138e){if(!_0x2b138e)this[_0xc451('0x1d')](_0xc451('0x31'),null);this[_0xc451('0x1d')](_0xc451('0x32'),_0x2b138e);}},'vidaooEscalation':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xc451('0x2')]},'vidaooTopic':{'type':Sequelize[_0xc451('0x2')],'allowNull':![],'defaultValue':_0xc451('0x33')},'vidaooNote':{'type':Sequelize[_0xc451('0x2')],'defaultValue':function(){return _0xc451('0x34');}},'vidaooMetadata':{'type':Sequelize[_0xc451('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xc451('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 4270496..6c4bdd5 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 _0xe5de=['externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','files','no\x20available\x20attributes','send','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','mimetype','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','sendMail','email','offlineMessageSubject','MailAccountId','originalname','subjectOffline','toPairsIn','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','tag','getSnippet','timezone','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','getLicense','virtual','increment','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','replace','verticalAlignment','color','textColor','color_button','backgroundColor','ChatApplication','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','eml-format','request-promise','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','ChatWebsites','UserProfileResource','stack','name','index','Pause','map','ChatWebsite','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','params','mandatoryDispositionPause','fields','includeAll','find','create','body','user','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','getDispositions','Disposition','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','showCustomerAvatar','getSystemAvatar','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','from','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','List','Contacts','DESC','Applications','account','applications','list','priority','defaults','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','referer','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction'];(function(_0x1e02a7,_0x4d8558){var _0x5db9f6=function(_0x571bf9){while(--_0x571bf9){_0x1e02a7['push'](_0x1e02a7['shift']());}};_0x5db9f6(++_0x4d8558);}(_0xe5de,0x73));var _0xee5d=function(_0x336785,_0xcca361){_0x336785=_0x336785-0x0;var _0x217ee5=_0xe5de[_0x336785];return _0x217ee5;};'use strict';var emlformat=require(_0xee5d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xee5d('0x1'));var moment=require(_0xee5d('0x2'));var BPromise=require(_0xee5d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xee5d('0x4'));var sox=require('sox');var csv=require(_0xee5d('0x5'));var ejs=require(_0xee5d('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xee5d('0x7'));var crypto=require(_0xee5d('0x8'));var jsforce=require(_0xee5d('0x9'));var deskjs=require(_0xee5d('0xa'));var toCsv=require('to-csv');var querystring=require(_0xee5d('0xb'));var Papa=require(_0xee5d('0xc'));var Redis=require(_0xee5d('0xd'));var authService=require(_0xee5d('0xe'));var qs=require(_0xee5d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee5d('0x10'));var logger=require(_0xee5d('0x11'))(_0xee5d('0x12'));var utils=require(_0xee5d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xee5d('0x14'));var db=require(_0xee5d('0x15'))['db'];config[_0xee5d('0x16')]=_['defaults'](config[_0xee5d('0x16')],{'host':_0xee5d('0x17'),'port':0x18eb});var socket=require(_0xee5d('0x18'))(new Redis(config['redis']));require(_0xee5d('0x19'))[_0xee5d('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xee5d('0x1b')][_0xee5d('0x1c')]({'port':0x232c});var client9002=jayson[_0xee5d('0x1b')]['http']({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0xee5d('0x1b')][_0xee5d('0x1c')]({'port':0x2329});function respondWithRpcPromise(_0x22168b,_0x26583e,_0x1a593d,_0x25f104){return new BPromise(function(_0x1fbd4e,_0x3e4733){var _0x1259b4=_0x25f104||client;return _0x1259b4[_0xee5d('0x1d')](_0x22168b,_0x1a593d)[_0xee5d('0x1e')](function(_0x564699){logger[_0xee5d('0x1f')](_0xee5d('0x20'),_0x26583e,'request\x20sent');logger[_0xee5d('0x21')](_0xee5d('0x22'),_0x26583e,'request\x20sent',JSON[_0xee5d('0x23')](_0x564699));if(_0x564699[_0xee5d('0x24')]){if(_0x564699[_0xee5d('0x24')][_0xee5d('0x25')]===0x1f4){logger[_0xee5d('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x26583e,_0x564699[_0xee5d('0x24')][_0xee5d('0x26')]);return _0x3e4733(_0x564699['error'][_0xee5d('0x26')]);}logger[_0xee5d('0x24')](_0xee5d('0x20'),_0x26583e,_0x564699[_0xee5d('0x24')][_0xee5d('0x26')]);return _0x1fbd4e(_0x564699[_0xee5d('0x24')]['message']);}else{logger['info'](_0xee5d('0x20'),_0x26583e,'request\x20sent');_0x1fbd4e(_0x564699[_0xee5d('0x27')][_0xee5d('0x26')]);}})[_0xee5d('0x28')](function(_0xaa0d08){logger[_0xee5d('0x24')](_0xee5d('0x20'),_0x26583e,_0xaa0d08);_0x3e4733(_0xaa0d08);});});}function respondWithStatusCode(_0x98b49d,_0x503c83){_0x503c83=_0x503c83||0xcc;return function(_0x577597){if(_0x577597){return _0x98b49d[_0xee5d('0x29')](_0x503c83);}return _0x98b49d['status'](_0x503c83)['end']();};}function respondWithResult(_0x46e94c,_0xf3d4ef){_0xf3d4ef=_0xf3d4ef||0xc8;return function(_0xda927b){if(_0xda927b){return _0x46e94c[_0xee5d('0x2a')](_0xf3d4ef)[_0xee5d('0x2b')](_0xda927b);}};}function respondWithFilteredResult(_0x4a9c98,_0x4e8f0b){return function(_0x5a8bd5){if(_0x5a8bd5){var _0x589714=typeof _0x4e8f0b[_0xee5d('0x2c')]==='undefined'&&typeof _0x4e8f0b[_0xee5d('0x2d')]===_0xee5d('0x2e');var _0x4c20f8=_0x5a8bd5[_0xee5d('0x2f')];var _0x1608dd=_0x589714?0x0:_0x4e8f0b[_0xee5d('0x2c')];var _0x1237c7=_0x589714?_0x5a8bd5[_0xee5d('0x2f')]:_0x4e8f0b[_0xee5d('0x2c')]+_0x4e8f0b[_0xee5d('0x2d')];var _0x5f18b8;if(_0x1237c7>=_0x4c20f8){_0x1237c7=_0x4c20f8;_0x5f18b8=0xc8;}else{_0x5f18b8=0xce;}_0x4a9c98[_0xee5d('0x2a')](_0x5f18b8);return _0x4a9c98[_0xee5d('0x30')](_0xee5d('0x31'),_0x1608dd+'-'+_0x1237c7+'/'+_0x4c20f8)['json'](_0x5a8bd5);}return null;};}function patchUpdates(_0x18b889){return function(_0x5e2ba2){try{jsonpatch[_0xee5d('0x32')](_0x5e2ba2,_0x18b889,!![]);}catch(_0x39bde6){return BPromise[_0xee5d('0x33')](_0x39bde6);}return _0x5e2ba2[_0xee5d('0x34')]();};}function saveUpdates(_0x481db4,_0x543204){return function(_0x3e55bc){if(_0x3e55bc){return _0x3e55bc['update'](_0x481db4)[_0xee5d('0x1e')](function(_0x1135df){return _0x1135df;});}return null;};}function removeEntity(_0xa49e4,_0x47912a){return function(_0x17f56b){if(_0x17f56b){return _0x17f56b[_0xee5d('0x35')]()[_0xee5d('0x1e')](function(){var _0x38cd45=_0x17f56b['get']({'plain':!![]});var _0x3d35c1=_0xee5d('0x36');return db[_0xee5d('0x37')][_0xee5d('0x35')]({'where':{'type':_0x3d35c1,'resourceId':_0x38cd45['id']}})[_0xee5d('0x1e')](function(){return _0x17f56b;});})[_0xee5d('0x1e')](function(){_0xa49e4[_0xee5d('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x539a09,_0x265043){return function(_0x433d01){if(!_0x433d01){_0x539a09[_0xee5d('0x29')](0x194);}return _0x433d01;};}function handleError(_0x3a2f9e,_0x2911da){_0x2911da=_0x2911da||0x1f4;return function(_0x1742b4){logger[_0xee5d('0x24')](_0x1742b4[_0xee5d('0x38')]);if(_0x1742b4[_0xee5d('0x39')]){delete _0x1742b4[_0xee5d('0x39')];}_0x3a2f9e[_0xee5d('0x2a')](_0x2911da)['send'](_0x1742b4);};}exports[_0xee5d('0x3a')]=function(_0x54d06e,_0x90f75d){var _0x2c7e91={'include':[{'model':db[_0xee5d('0x3b')],'as':'mandatoryDispositionPause'}]},_0x3b14a1={},_0xd08b3a={'count':0x0,'rows':[]};var _0x5dfff5=_[_0xee5d('0x3c')](db[_0xee5d('0x3d')][_0xee5d('0x3e')],function(_0x50cbb5){return{'name':_0x50cbb5[_0xee5d('0x3f')],'type':_0x50cbb5[_0xee5d('0x40')]['key']};});_0x3b14a1[_0xee5d('0x41')]=_[_0xee5d('0x3c')](_0x5dfff5,'name');_0x3b14a1[_0xee5d('0x42')]=_[_0xee5d('0x43')](_0x54d06e['query']);_0x3b14a1[_0xee5d('0x44')]=_[_0xee5d('0x45')](_0x3b14a1[_0xee5d('0x41')],_0x3b14a1[_0xee5d('0x42')]);_0x2c7e91[_0xee5d('0x46')]=_[_0xee5d('0x45')](_0x3b14a1[_0xee5d('0x41')],qs['fields'](_0x54d06e[_0xee5d('0x42')]['fields']));_0x2c7e91[_0xee5d('0x46')]=_0x2c7e91[_0xee5d('0x46')][_0xee5d('0x47')]?_0x2c7e91['attributes']:_0x3b14a1[_0xee5d('0x41')];if(!_0x54d06e[_0xee5d('0x42')][_0xee5d('0x48')](_0xee5d('0x49'))){_0x2c7e91[_0xee5d('0x2d')]=qs[_0xee5d('0x2d')](_0x54d06e['query'][_0xee5d('0x2d')]);_0x2c7e91['offset']=qs['offset'](_0x54d06e[_0xee5d('0x42')]['offset']);}_0x2c7e91[_0xee5d('0x4a')]=qs[_0xee5d('0x4b')](_0x54d06e[_0xee5d('0x42')]['sort']);_0x2c7e91[_0xee5d('0x4c')]=qs['filters'](_[_0xee5d('0x4d')](_0x54d06e[_0xee5d('0x42')],_0x3b14a1[_0xee5d('0x44')]),_0x5dfff5);if(_0x54d06e[_0xee5d('0x42')]['filter']){_0x2c7e91[_0xee5d('0x4c')]=_[_0xee5d('0x4e')](_0x2c7e91[_0xee5d('0x4c')],{'$or':_[_0xee5d('0x3c')](_0x5dfff5,function(_0x461a74){if(_0x461a74[_0xee5d('0x40')]!==_0xee5d('0x4f')){var _0x25942f={};_0x25942f[_0x461a74[_0xee5d('0x39')]]={'$like':'%'+_0x54d06e['query'][_0xee5d('0x50')]+'%'};return _0x25942f;}})});}_0x2c7e91=_['merge']({},_0x2c7e91,_0x54d06e[_0xee5d('0x51')]);var _0x12a4c3={'where':_0x2c7e91[_0xee5d('0x4c')]};return db[_0xee5d('0x3d')][_0xee5d('0x2f')](_0x12a4c3)[_0xee5d('0x1e')](function(_0x371907){_0xd08b3a['count']=_0x371907;if(_0x54d06e['query']['includeAll']){_0x2c7e91[_0xee5d('0x52')]=[{'all':!![]}];}return db['ChatWebsite'][_0xee5d('0x53')](_0x2c7e91);})[_0xee5d('0x1e')](function(_0x465613){_0xd08b3a['rows']=_0x465613;return _0xd08b3a;})['then'](respondWithFilteredResult(_0x90f75d,_0x2c7e91))[_0xee5d('0x28')](handleError(_0x90f75d,null));};exports['show']=function(_0x1801dc,_0x567a58){var _0x33f77c={'raw':![],'where':{'id':_0x1801dc[_0xee5d('0x54')]['id']},'include':[{'model':db[_0xee5d('0x3b')],'as':_0xee5d('0x55')}]},_0x25c15b={};_0x25c15b[_0xee5d('0x41')]=_[_0xee5d('0x43')](db[_0xee5d('0x3d')][_0xee5d('0x3e')]);_0x25c15b[_0xee5d('0x42')]=_[_0xee5d('0x43')](_0x1801dc['query']);_0x25c15b[_0xee5d('0x44')]=_[_0xee5d('0x45')](_0x25c15b[_0xee5d('0x41')],_0x25c15b[_0xee5d('0x42')]);_0x33f77c[_0xee5d('0x46')]=_[_0xee5d('0x45')](_0x25c15b[_0xee5d('0x41')],qs[_0xee5d('0x56')](_0x1801dc[_0xee5d('0x42')]['fields']));_0x33f77c[_0xee5d('0x46')]=_0x33f77c[_0xee5d('0x46')][_0xee5d('0x47')]?_0x33f77c[_0xee5d('0x46')]:_0x25c15b[_0xee5d('0x41')];if(_0x1801dc[_0xee5d('0x42')][_0xee5d('0x57')]){_0x33f77c['include']=[{'all':!![]}];}_0x33f77c=_[_0xee5d('0x4e')]({},_0x33f77c,_0x1801dc[_0xee5d('0x51')]);return db[_0xee5d('0x3d')][_0xee5d('0x58')](_0x33f77c)[_0xee5d('0x1e')](handleEntityNotFound(_0x567a58,null))[_0xee5d('0x1e')](respondWithResult(_0x567a58,null))[_0xee5d('0x28')](handleError(_0x567a58,null));};exports['create']=function(_0x5b527d,_0x36a21e){return db[_0xee5d('0x3d')][_0xee5d('0x59')](_0x5b527d[_0xee5d('0x5a')],{})[_0xee5d('0x1e')](function(_0x521585){var _0x2ce4bc=_0x5b527d[_0xee5d('0x5b')][_0xee5d('0x5c')]({'plain':!![]});if(!_0x2ce4bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ce4bc[_0xee5d('0x5d')]===_0xee5d('0x5b')){var _0x5cddd4=_0x521585[_0xee5d('0x5c')]({'plain':!![]});var _0x5eeec7=_0xee5d('0x36');return db[_0xee5d('0x5e')][_0xee5d('0x58')]({'where':{'name':_0x5eeec7,'userProfileId':_0x2ce4bc['userProfileId']},'raw':!![]})[_0xee5d('0x1e')](function(_0x11e40a){if(_0x11e40a&&_0x11e40a[_0xee5d('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0x5cddd4[_0xee5d('0x39')],'resourceId':_0x5cddd4['id'],'type':_0x11e40a['name'],'sectionId':_0x11e40a['id']},{})['then'](function(){return _0x521585;});}else{return _0x521585;}})['catch'](function(_0x38777b){logger[_0xee5d('0x24')](_0xee5d('0x60'),_0x38777b);throw _0x38777b;});}return _0x521585;})[_0xee5d('0x1e')](respondWithResult(_0x36a21e,0xc9))[_0xee5d('0x28')](handleError(_0x36a21e,null));};exports[_0xee5d('0x61')]=function(_0x5c848e,_0x3c7eca){if(_0x5c848e[_0xee5d('0x5a')]['id']){delete _0x5c848e[_0xee5d('0x5a')]['id'];}return db['ChatWebsite'][_0xee5d('0x58')]({'where':{'id':_0x5c848e[_0xee5d('0x54')]['id']},'include':[{'model':db[_0xee5d('0x3b')],'as':_0xee5d('0x55')}]})[_0xee5d('0x1e')](handleEntityNotFound(_0x3c7eca,null))[_0xee5d('0x1e')](saveUpdates(_0x5c848e[_0xee5d('0x5a')],null))[_0xee5d('0x1e')](respondWithResult(_0x3c7eca,null))[_0xee5d('0x28')](handleError(_0x3c7eca,null));};exports[_0xee5d('0x35')]=function(_0x7c98cf,_0x34e962){return db['ChatWebsite'][_0xee5d('0x58')]({'where':{'id':_0x7c98cf[_0xee5d('0x54')]['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x34e962,null))[_0xee5d('0x1e')](removeEntity(_0x34e962,null))[_0xee5d('0x28')](handleError(_0x34e962,null));};exports[_0xee5d('0x62')]=function(_0x2e893e,_0x1ee969){return db['ChatWebsite'][_0xee5d('0x62')]()['then'](respondWithResult(_0x1ee969,null))['catch'](handleError(_0x1ee969,null));};exports[_0xee5d('0x63')]=function(_0x104657,_0x26bb16,_0x5a7aa6){if(_0x104657[_0xee5d('0x5a')]['id']){delete _0x104657[_0xee5d('0x5a')]['id'];}return db[_0xee5d('0x3d')][_0xee5d('0x58')]({'where':{'id':_0x104657['params']['id']}})['then'](handleEntityNotFound(_0x26bb16,null))[_0xee5d('0x1e')](function(_0x1c7eb7){if(_0x1c7eb7){_0x104657[_0xee5d('0x5a')][_0xee5d('0x64')]=_0x1c7eb7['id'];return db['Disposition'][_0xee5d('0x59')](_0x104657[_0xee5d('0x5a')]);}})['then'](respondWithResult(_0x26bb16,null))[_0xee5d('0x28')](handleError(_0x26bb16,null));};exports[_0xee5d('0x65')]=function(_0x198e7b,_0x365807,_0x2126bc){var _0x4ad525={'raw':![],'where':{}};var _0x2cd0ba={};var _0x181533={'count':0x0,'rows':[]};return db[_0xee5d('0x3d')]['findOne']({'where':{'id':_0x198e7b['params']['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x365807,null))['then'](function(_0x1e5778){if(_0x1e5778){_0x2cd0ba[_0xee5d('0x41')]=_[_0xee5d('0x43')](db[_0xee5d('0x66')][_0xee5d('0x3e')]);_0x2cd0ba[_0xee5d('0x42')]=_[_0xee5d('0x43')](_0x198e7b['query']);_0x2cd0ba[_0xee5d('0x44')]=_[_0xee5d('0x45')](_0x2cd0ba['model'],_0x2cd0ba[_0xee5d('0x42')]);_0x4ad525['attributes']=_[_0xee5d('0x45')](_0x2cd0ba[_0xee5d('0x41')],qs[_0xee5d('0x56')](_0x198e7b['query'][_0xee5d('0x56')]));_0x4ad525[_0xee5d('0x46')]=_0x4ad525[_0xee5d('0x46')][_0xee5d('0x47')]?_0x4ad525['attributes']:_0x2cd0ba[_0xee5d('0x41')];if(!_0x198e7b[_0xee5d('0x42')][_0xee5d('0x48')](_0xee5d('0x49'))){_0x4ad525['limit']=qs[_0xee5d('0x2d')](_0x198e7b[_0xee5d('0x42')][_0xee5d('0x2d')]);_0x4ad525['offset']=qs[_0xee5d('0x2c')](_0x198e7b[_0xee5d('0x42')][_0xee5d('0x2c')]);}_0x4ad525['order']=qs[_0xee5d('0x4b')](_0x198e7b[_0xee5d('0x42')][_0xee5d('0x4b')]);_0x4ad525[_0xee5d('0x4c')]=qs[_0xee5d('0x44')](_[_0xee5d('0x4d')](_0x198e7b[_0xee5d('0x42')],_0x2cd0ba[_0xee5d('0x44')]));_0x4ad525[_0xee5d('0x4c')]['ChatWebsiteId']=_0x1e5778['id'];if(_0x198e7b['query'][_0xee5d('0x50')]){_0x4ad525[_0xee5d('0x4c')]=_[_0xee5d('0x4e')](_0x4ad525['where'],{'$or':_[_0xee5d('0x3c')](_0x4ad525[_0xee5d('0x46')],function(_0x3cd27e){var _0x5ab057={};_0x5ab057[_0x3cd27e]={'$like':'%'+_0x198e7b[_0xee5d('0x42')][_0xee5d('0x50')]+'%'};return _0x5ab057;})});}_0x4ad525=_['merge']({},_0x4ad525,_0x198e7b[_0xee5d('0x51')]);return db[_0xee5d('0x66')][_0xee5d('0x2f')]({'where':_0x4ad525['where']})[_0xee5d('0x1e')](function(_0x47243e){_0x181533[_0xee5d('0x2f')]=_0x47243e;if(_0x198e7b['query'][_0xee5d('0x57')]){_0x4ad525['include']=[{'all':!![]}];}return db[_0xee5d('0x66')][_0xee5d('0x53')](_0x4ad525);})[_0xee5d('0x1e')](function(_0x18601d){_0x181533[_0xee5d('0x67')]=_0x18601d;return _0x181533;});}})[_0xee5d('0x1e')](respondWithFilteredResult(_0x365807,_0x4ad525))[_0xee5d('0x28')](handleError(_0x365807,null));};exports[_0xee5d('0x68')]=function(_0xd93f25,_0x25579a,_0x413e92){return db[_0xee5d('0x3d')][_0xee5d('0x58')]({'where':{'id':_0xd93f25[_0xee5d('0x54')]['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x25579a,null))[_0xee5d('0x1e')](function(_0x447514){if(_0x447514){return _0x447514[_0xee5d('0x68')](_0xd93f25[_0xee5d('0x42')][_0xee5d('0x69')]);}})[_0xee5d('0x1e')](respondWithStatusCode(_0x25579a,null))[_0xee5d('0x28')](handleError(_0x25579a,null));};exports[_0xee5d('0x6a')]=function(_0x4e4bbd,_0x4aa49a,_0x3b0d7b){if(_0x4e4bbd[_0xee5d('0x5a')]['id']){delete _0x4e4bbd['body']['id'];}return db[_0xee5d('0x3d')]['find']({'where':{'id':_0x4e4bbd[_0xee5d('0x54')]['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x4aa49a,null))[_0xee5d('0x1e')](function(_0x258d0f){if(_0x258d0f){_0x4e4bbd[_0xee5d('0x5a')][_0xee5d('0x64')]=_0x258d0f['id'];return db[_0xee5d('0x6b')][_0xee5d('0x59')](_0x4e4bbd[_0xee5d('0x5a')]);}})[_0xee5d('0x1e')](respondWithResult(_0x4aa49a,null))['catch'](handleError(_0x4aa49a,null));};exports[_0xee5d('0x6c')]=function(_0x20c3f4,_0x4da316,_0x1702dd){var _0x1d0c3a={'raw':![],'where':{}};var _0x120c6e={};var _0x3b378e={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xee5d('0x6d')]({'where':{'id':_0x20c3f4['params']['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x4da316,null))['then'](function(_0x33af59){if(_0x33af59){_0x120c6e['model']=_[_0xee5d('0x43')](db[_0xee5d('0x6b')]['rawAttributes']);_0x120c6e['query']=_[_0xee5d('0x43')](_0x20c3f4[_0xee5d('0x42')]);_0x120c6e[_0xee5d('0x44')]=_[_0xee5d('0x45')](_0x120c6e[_0xee5d('0x41')],_0x120c6e[_0xee5d('0x42')]);_0x1d0c3a[_0xee5d('0x46')]=_[_0xee5d('0x45')](_0x120c6e[_0xee5d('0x41')],qs[_0xee5d('0x56')](_0x20c3f4['query'][_0xee5d('0x56')]));_0x1d0c3a[_0xee5d('0x46')]=_0x1d0c3a[_0xee5d('0x46')][_0xee5d('0x47')]?_0x1d0c3a[_0xee5d('0x46')]:_0x120c6e[_0xee5d('0x41')];if(!_0x20c3f4['query'][_0xee5d('0x48')](_0xee5d('0x49'))){_0x1d0c3a[_0xee5d('0x2d')]=qs[_0xee5d('0x2d')](_0x20c3f4['query']['limit']);_0x1d0c3a['offset']=qs[_0xee5d('0x2c')](_0x20c3f4['query'][_0xee5d('0x2c')]);}_0x1d0c3a['order']=qs['sort'](_0x20c3f4['query']['sort']);_0x1d0c3a[_0xee5d('0x4c')]=qs[_0xee5d('0x44')](_['pick'](_0x20c3f4[_0xee5d('0x42')],_0x120c6e[_0xee5d('0x44')]));_0x1d0c3a[_0xee5d('0x4c')][_0xee5d('0x64')]=_0x33af59['id'];if(_0x20c3f4[_0xee5d('0x42')][_0xee5d('0x50')]){_0x1d0c3a[_0xee5d('0x4c')]=_[_0xee5d('0x4e')](_0x1d0c3a[_0xee5d('0x4c')],{'$or':_[_0xee5d('0x3c')](_0x1d0c3a['attributes'],function(_0x2989a9){var _0x4e1ead={};_0x4e1ead[_0x2989a9]={'$like':'%'+_0x20c3f4[_0xee5d('0x42')]['filter']+'%'};return _0x4e1ead;})});}_0x1d0c3a=_[_0xee5d('0x4e')]({},_0x1d0c3a,_0x20c3f4[_0xee5d('0x51')]);return db[_0xee5d('0x6b')][_0xee5d('0x2f')]({'where':_0x1d0c3a[_0xee5d('0x4c')]})['then'](function(_0x5c41cf){_0x3b378e[_0xee5d('0x2f')]=_0x5c41cf;if(_0x20c3f4[_0xee5d('0x42')][_0xee5d('0x57')]){_0x1d0c3a[_0xee5d('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0xee5d('0x53')](_0x1d0c3a);})['then'](function(_0x31e7fc){_0x3b378e[_0xee5d('0x67')]=_0x31e7fc;return _0x3b378e;});}})[_0xee5d('0x1e')](respondWithFilteredResult(_0x4da316,_0x1d0c3a))[_0xee5d('0x28')](handleError(_0x4da316,null));};exports[_0xee5d('0x6e')]=function(_0x19bebd,_0x2c21ed,_0x183b87){return db['ChatWebsite'][_0xee5d('0x58')]({'where':{'id':_0x19bebd[_0xee5d('0x54')]['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x2c21ed,null))[_0xee5d('0x1e')](function(_0xd0fe0){if(_0xd0fe0){return _0xd0fe0[_0xee5d('0x6e')](_0x19bebd[_0xee5d('0x42')][_0xee5d('0x69')]);}})[_0xee5d('0x1e')](respondWithStatusCode(_0x2c21ed,null))[_0xee5d('0x28')](handleError(_0x2c21ed,null));};exports[_0xee5d('0x6f')]=function(_0xc88821,_0x196900,_0x357764){_0xc88821['body'][_0xee5d('0x70')]=_0xc88821[_0xee5d('0x71')][_0xee5d('0x72')];return db[_0xee5d('0x3d')][_0xee5d('0x58')]({'where':{'id':_0xc88821[_0xee5d('0x54')]['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x196900,null))[_0xee5d('0x1e')](saveUpdates(_0xc88821[_0xee5d('0x5a')],null))[_0xee5d('0x1e')](respondWithResult(_0x196900,null))[_0xee5d('0x28')](handleError(_0x196900,null));};exports[_0xee5d('0x73')]=function(_0x19067e,_0x2c3135,_0x20d3df){_0x19067e['body'][_0xee5d('0x74')]=_0x19067e[_0xee5d('0x71')][_0xee5d('0x72')];return db[_0xee5d('0x3d')][_0xee5d('0x58')]({'where':{'id':_0x19067e[_0xee5d('0x54')]['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x2c3135,null))[_0xee5d('0x1e')](saveUpdates(_0x19067e[_0xee5d('0x5a')],null))[_0xee5d('0x1e')](respondWithResult(_0x2c3135,null))[_0xee5d('0x28')](handleError(_0x2c3135,null));};exports[_0xee5d('0x75')]=function(_0x220f02,_0x569ff9,_0x439e57){_0x220f02[_0xee5d('0x5a')][_0xee5d('0x76')]=_0x220f02['file'][_0xee5d('0x72')];return db[_0xee5d('0x3d')][_0xee5d('0x58')]({'where':{'id':_0x220f02[_0xee5d('0x54')]['id']}})['then'](handleEntityNotFound(_0x569ff9,null))['then'](saveUpdates(_0x220f02[_0xee5d('0x5a')],null))[_0xee5d('0x1e')](respondWithResult(_0x569ff9,null))[_0xee5d('0x28')](handleError(_0x569ff9,null));};exports[_0xee5d('0x77')]=function(_0x5cb1a1,_0x340a8d,_0x52569c){_0x5cb1a1[_0xee5d('0x5a')][_0xee5d('0x78')]=_0x5cb1a1[_0xee5d('0x71')]['filename'];return db[_0xee5d('0x3d')][_0xee5d('0x58')]({'where':{'id':_0x5cb1a1['params']['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x340a8d,null))[_0xee5d('0x1e')](saveUpdates(_0x5cb1a1[_0xee5d('0x5a')],null))[_0xee5d('0x1e')](respondWithResult(_0x340a8d,null))[_0xee5d('0x28')](handleError(_0x340a8d,null));};exports[_0xee5d('0x79')]=function(_0x42c30c,_0x17b87d,_0x5044ca){var _0x49190b=path[_0xee5d('0x7a')](config[_0xee5d('0x7b')],_0xee5d('0x7c'));var _0x2c1cd4={'where':{'id':_0x42c30c[_0xee5d('0x54')]['id']},'attributes':['id',_0xee5d('0x70')],'raw':!![]};var _0x57ed88=![];return require(_0xee5d('0x14'))['getLicense']()['then'](function(_0x5e6214){if(_0x5e6214){_0x57ed88=_0x5e6214[_0xee5d('0x7d')];}})[_0xee5d('0x1e')](function(){return db[_0xee5d('0x3d')][_0xee5d('0x58')](_0x2c1cd4);})[_0xee5d('0x1e')](handleEntityNotFound(_0x17b87d,null))[_0xee5d('0x1e')](function(_0x28649f){if(_0x28649f){if(!_[_0xee5d('0x7e')](_0x28649f[_0xee5d('0x70')])){if(fs[_0xee5d('0x7f')](path[_0xee5d('0x7a')](config[_0xee5d('0x7b')],_0xee5d('0x80'),_0x28649f[_0xee5d('0x70')]))&&_0x57ed88){_0x49190b=path['join'](config['root'],'server/files/images/logos/',_0x28649f['sitepic']);}}return _0x17b87d['download'](_0x49190b);}})[_0xee5d('0x28')](handleError(_0x17b87d,null));};exports[_0xee5d('0x81')]=function(_0x5c7fbb,_0x4b304c,_0x1269ea){var _0x5038bc=path['join'](config['root'],_0xee5d('0x82'));var _0x53c4df={'where':{'id':_0x5c7fbb[_0xee5d('0x54')]['id']},'attributes':['id',_0xee5d('0x74')],'raw':!![]};return db[_0xee5d('0x3d')]['find'](_0x53c4df)[_0xee5d('0x1e')](handleEntityNotFound(_0x4b304c,null))['then'](function(_0x44110c){if(_0x44110c){if(!_[_0xee5d('0x7e')](_0x44110c[_0xee5d('0x74')])){if(fs[_0xee5d('0x7f')](path[_0xee5d('0x7a')](config[_0xee5d('0x7b')],_0xee5d('0x83'),_0x44110c[_0xee5d('0x74')]))){_0x5038bc=path[_0xee5d('0x7a')](config[_0xee5d('0x7b')],_0xee5d('0x83'),_0x44110c[_0xee5d('0x74')]);}}return _0x4b304c[_0xee5d('0x84')](_0x5038bc);}})[_0xee5d('0x28')](handleError(_0x4b304c,null));};exports['getCustomerAvatar']=function(_0x341396,_0x5674c0,_0x262072){var _0x4d017b=path[_0xee5d('0x7a')](config[_0xee5d('0x7b')],'server/files/images/avatars/customer_avatar.png');var _0x441189={'where':{'id':_0x341396[_0xee5d('0x54')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0xee5d('0x58')](_0x441189)['then'](handleEntityNotFound(_0x5674c0,null))['then'](function(_0x3e4eca){if(_0x3e4eca){if(!_[_0xee5d('0x7e')](_0x3e4eca[_0xee5d('0x76')])){if(fs[_0xee5d('0x7f')](path[_0xee5d('0x7a')](config[_0xee5d('0x7b')],_0xee5d('0x83'),_0x3e4eca[_0xee5d('0x76')]))&&_0x3e4eca[_0xee5d('0x85')]){_0x4d017b=path[_0xee5d('0x7a')](config[_0xee5d('0x7b')],_0xee5d('0x83'),_0x3e4eca['customerAvatar']);}}return _0x5674c0[_0xee5d('0x84')](_0x4d017b);}})[_0xee5d('0x28')](handleError(_0x5674c0,null));};exports[_0xee5d('0x86')]=function(_0x2920be,_0x38eaca,_0x2fa309){var _0x19c83d=path[_0xee5d('0x7a')](config[_0xee5d('0x7b')],'server/files/images/avatars/system_avatar.png');var _0x4efefe={'where':{'id':_0x2920be[_0xee5d('0x54')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xee5d('0x3d')][_0xee5d('0x58')](_0x4efefe)[_0xee5d('0x1e')](handleEntityNotFound(_0x38eaca,null))[_0xee5d('0x1e')](function(_0x103d10){if(_0x103d10){if(!_[_0xee5d('0x7e')](_0x103d10['systemAvatar'])){if(fs[_0xee5d('0x7f')](path['join'](config['root'],'server/files/images/avatars/',_0x103d10[_0xee5d('0x78')]))){_0x19c83d=path[_0xee5d('0x7a')](config['root'],_0xee5d('0x83'),_0x103d10['systemAvatar']);}}return _0x38eaca['download'](_0x19c83d);}})[_0xee5d('0x28')](handleError(_0x38eaca,null));};exports[_0xee5d('0x87')]=function(_0x340ac5,_0x5aca07,_0x1c9cf5){var _0x27d933=require(_0xee5d('0x88'));var _0x556252=new _0x27d933();var _0x1ad8f1=_0x556252[_0xee5d('0x89')](_0x340ac5['headers'][_0xee5d('0x8a')])[_0xee5d('0x8b')]();var _0x12fd20={'body':_0x340ac5[_0xee5d('0x5a')],'channel':_0xee5d('0x8c')};var _0x15e3d4=[];var _0x5a7f0c=[];var _0x42f0e4={};var _0x5c7ab2=![];return db[_0xee5d('0x8d')][_0xee5d('0x62')]()['then'](function(_0x48dabe){if(!_0x48dabe){throw new db[(_0xee5d('0x8e'))][(_0xee5d('0x8f'))]('no\x20available\x20attributes');}_0x15e3d4=_['difference'](_[_0xee5d('0x43')](_0x48dabe),[_0xee5d('0x90'),_0xee5d('0x91')]);_0x5a7f0c=_[_0xee5d('0x92')](_[_0xee5d('0x43')](_0x48dabe),[_0xee5d('0x90'),'updatedAt',_0xee5d('0x93'),_0xee5d('0x94')]);if(_0x340ac5['body']['id']){delete _0x340ac5[_0xee5d('0x5a')]['id'];}if(_[_0xee5d('0x7e')](_0x340ac5[_0xee5d('0x5a')][_0xee5d('0x95')])){throw new db[(_0xee5d('0x8e'))][(_0xee5d('0x8f'))](_0xee5d('0x96'));}if(_['isNil'](_0x340ac5[_0xee5d('0x5a')][_0xee5d('0x5a')])||_0x340ac5[_0xee5d('0x5a')][_0xee5d('0x5a')]===''){throw new db['Sequelize'][(_0xee5d('0x8f'))](_0xee5d('0x97'));}if(_[_0xee5d('0x7e')](_0x340ac5[_0xee5d('0x5a')]['mapKey'])){throw new db[(_0xee5d('0x8e'))][(_0xee5d('0x8f'))](_0xee5d('0x98')+_0x5a7f0c);}if(!_[_0xee5d('0x99')](_0x5a7f0c,_0x340ac5['body']['mapKey'])){throw new db[(_0xee5d('0x8e'))][(_0xee5d('0x8f'))](_0xee5d('0x9a')+_0x5a7f0c);}_0x42f0e4[_0x340ac5['body'][_0xee5d('0x9b')]]=_0x340ac5[_0xee5d('0x5a')][_0xee5d('0x95')];})[_0xee5d('0x1e')](function(){return db[_0xee5d('0x3d')][_0xee5d('0x58')]({'where':{'id':_0x340ac5[_0xee5d('0x54')]['id']},'include':[{'model':db[_0xee5d('0x9c')],'as':_0xee5d('0x9d'),'include':[{'model':db[_0xee5d('0x8d')],'as':_0xee5d('0x9e'),'where':_0x42f0e4,'limit':0x1,'order':[[_0xee5d('0x91'),_0xee5d('0x9f')]]}]},{'model':db['ChatApplication'],'as':_0xee5d('0xa0')}]});})[_0xee5d('0x1e')](handleEntityNotFound(_0x5aca07,null))['then'](function(_0x58ce63){if(_0x58ce63&&_0x58ce63[_0xee5d('0x9d')]){_0x12fd20[_0xee5d('0xa1')]=_0x58ce63;_0x12fd20[_0xee5d('0xa2')]=_0x58ce63[_0xee5d('0xa0')];_0x12fd20[_0xee5d('0xa3')]=_0x58ce63['List'];_0x12fd20[_0xee5d('0xa2')]=_['orderBy'](_0x12fd20[_0xee5d('0xa2')],[_0xee5d('0xa4')],['asc']);if(_0x12fd20[_0xee5d('0xa1')][_0xee5d('0xa0')]){delete _0x12fd20['account'][_0xee5d('0xa0')];}if(_0x12fd20[_0xee5d('0xa1')][_0xee5d('0x9d')]&&_0x12fd20['account'][_0xee5d('0x9d')][_0xee5d('0x9e')][_0xee5d('0x47')]){return _0x12fd20['account'][_0xee5d('0x9d')][_0xee5d('0x9e')][0x0];}var _0x5d75c1=_[_0xee5d('0xa5')](_0x340ac5[_0xee5d('0x5a')],{'firstName':_0x340ac5[_0xee5d('0x5a')][_0xee5d('0x95')],'ListId':_0x58ce63[_0xee5d('0x94')]});_0x5d75c1[_0x340ac5[_0xee5d('0x5a')][_0xee5d('0x9b')]]=_0x340ac5[_0xee5d('0x5a')]['from'];return db[_0xee5d('0x8d')][_0xee5d('0x59')](_0x5d75c1,{'fields':_0x15e3d4,'raw':!![]});}})[_0xee5d('0x1e')](handleEntityNotFound(_0x5aca07,null))[_0xee5d('0x1e')](function(_0x11df43){_0x12fd20[_0xee5d('0xa6')]=_0x11df43;var _0x51ba4a=_0x340ac5[_0xee5d('0x5a')][_0xee5d('0xa7')];if(_0x340ac5[_0xee5d('0xa8')][_0xee5d('0xa9')]){_0x51ba4a=_0x340ac5[_0xee5d('0xa8')]['cf-connecting-ip'];}else if(_0x340ac5[_0xee5d('0xa8')][_0xee5d('0xaa')]){_0x51ba4a=_[_0xee5d('0xab')](_0x340ac5['headers'][_0xee5d('0xaa')]['split'](','));}if(_0x11df43){var _0x3a843b={'ContactId':_0x11df43['id'],'ChatWebsiteId':_0x340ac5[_0xee5d('0x54')]['id'],'from':(_0x11df43[_0xee5d('0xac')]||'')+'\x20'+(_0x11df43[_0xee5d('0xad')]||''),'customerIp':_0x51ba4a,'customerPort':_0x340ac5[_0xee5d('0xa8')]['x-real-port']?_0x340ac5[_0xee5d('0xa8')]['x-real-port']:null,'referer':_0x340ac5[_0xee5d('0x5a')][_0xee5d('0xae')],'browserName':_0x1ad8f1['browser'][_0xee5d('0x39')]&&_0x1ad8f1[_0xee5d('0xaf')]['version']?util[_0xee5d('0xb0')](_0xee5d('0xb1'),_0x1ad8f1[_0xee5d('0xaf')]['name'],_0x1ad8f1[_0xee5d('0xaf')][_0xee5d('0xb2')]):_0xee5d('0xb3'),'browserVersion':_0x1ad8f1[_0xee5d('0xaf')][_0xee5d('0xb2')]||_0xee5d('0xb3'),'osName':util['format'](_0xee5d('0xb1'),_0x1ad8f1['os']['name'],_0x1ad8f1['os'][_0xee5d('0xb2')]),'osVersion':_0x1ad8f1['os'][_0xee5d('0xb2')],'deviceModel':_0x1ad8f1[_0xee5d('0xb4')]['model']&&_0x1ad8f1[_0xee5d('0xb4')][_0xee5d('0xb5')]?util[_0xee5d('0xb0')](_0xee5d('0xb6'),_0x1ad8f1[_0xee5d('0xb4')][_0xee5d('0x41')],_0x1ad8f1['device'][_0xee5d('0xb5')],_0x1ad8f1[_0xee5d('0xb4')]['type']):null,'deviceVendor':_0x1ad8f1[_0xee5d('0xb4')][_0xee5d('0xb5')],'deviceType':_0x1ad8f1[_0xee5d('0xb4')]['type'],'formData':JSON[_0xee5d('0x23')](_0x340ac5[_0xee5d('0x5a')])};var _0x53abb9={'ChatWebsiteId':_0x340ac5[_0xee5d('0x54')]['id'],'closed':![]};if(_0x340ac5[_0xee5d('0x5a')]['threadId']){_0x53abb9[_0xee5d('0xb7')]=_0x340ac5[_0xee5d('0x5a')][_0xee5d('0xb7')];return db[_0xee5d('0xb8')][_0xee5d('0x58')]({'where':_0x53abb9})[_0xee5d('0x1e')](function(_0x451984){if(_0x451984){return[_0x451984,![]];}_0x3a843b[_0xee5d('0xb7')]=_0x340ac5[_0xee5d('0x5a')][_0xee5d('0xb7')];_0x3a843b['externalUrl']=_0x340ac5[_0xee5d('0x5a')][_0xee5d('0xb9')];return db['ChatInteraction'][_0xee5d('0x59')](_0x3a843b)[_0xee5d('0x1e')](function(_0xe5f1d7){return[_0xe5f1d7,!![]];});});}_0x53abb9[_0xee5d('0xba')]=_0x11df43['id'];if(_0x340ac5[_0xee5d('0x5a')]['interaction']&&_0x340ac5['body'][_0xee5d('0xbb')]['id']){_0x53abb9['id']=_0x340ac5['body'][_0xee5d('0xbb')]['id'];return db[_0xee5d('0xb8')][_0xee5d('0x58')]({'where':_0x53abb9})[_0xee5d('0x1e')](function(_0x4b82ac){if(_0x4b82ac){return[_0x4b82ac,![]];}return db[_0xee5d('0xb8')][_0xee5d('0x59')](_0x3a843b)['then'](function(_0x17f153){return[_0x17f153,!![]];});});}return db[_0xee5d('0xb8')][_0xee5d('0x59')](_0x3a843b)[_0xee5d('0x1e')](function(_0x573e31){return[_0x573e31,!![]];});}})[_0xee5d('0xbc')](function(_0x127b29,_0x52ecfb){if(_0x127b29){_0x5c7ab2=_0x52ecfb;if(!_0x52ecfb){var _0x104bcd={'from':(_0x12fd20[_0xee5d('0xa6')]['firstName']||'')+'\x20'+(_0x12fd20[_0xee5d('0xa6')][_0xee5d('0xad')]||'')};if(_0x340ac5[_0xee5d('0x5a')][_0xee5d('0xb7')]&&_0x340ac5['body'][_0xee5d('0xbd')]&&_0x340ac5[_0xee5d('0x5a')][_0xee5d('0xb7')]!=_0x340ac5['body'][_0xee5d('0xbd')]){_0x104bcd[_0xee5d('0xb7')]=_0x340ac5[_0xee5d('0x5a')]['messageId'];}return _0x127b29[_0xee5d('0x61')](_0x104bcd);}else{return _0x127b29;}}})[_0xee5d('0x1e')](function(_0x33559b){_0x12fd20[_0xee5d('0xbb')]=_0x33559b[_0xee5d('0x5c')]({'plain':!![]});_0x12fd20['interaction'][_0xee5d('0xbe')]=_0x5c7ab2;if(_0x12fd20[_0xee5d('0xbb')][_0xee5d('0xbe')]){if(_0x12fd20[_0xee5d('0xa1')][_0xee5d('0xbf')]){_0x12fd20['applications'][_0xee5d('0xc0')]({'id':0x0,'priority':_0x12fd20[_0xee5d('0xa2')][_0xee5d('0x47')]+0x1,'app':'close','appdata':_0xee5d('0xc1'),'interval':_0xee5d('0xc2')});}}return db[_0xee5d('0xc3')][_0xee5d('0x59')]({'body':_0x340ac5[_0xee5d('0x5a')]['body'],'ChatWebsiteId':_0x340ac5[_0xee5d('0x54')]['id'],'ChatInteractionId':_0x33559b['id'],'direction':'in','ContactId':_0x12fd20[_0xee5d('0xa6')]['id'],'AttachmentId':_0x340ac5[_0xee5d('0x5a')]['AttachmentId']});})[_0xee5d('0x1e')](function(_0x5aee6c){_0x12fd20[_0xee5d('0x26')]=_0x5aee6c;if(_0x12fd20['interaction'][_0xee5d('0xc4')]){return db[_0xee5d('0xc5')]['find']({'attributes':['id','name'],'where':{'id':_0x12fd20[_0xee5d('0xbb')]['UserId']}})['then'](function(_0x53dab0){if(_0x53dab0){_0x12fd20[_0xee5d('0xa2')][_0xee5d('0xc6')]({'id':0x0,'priority':0x0,'app':_0xee5d('0xc7'),'appdata':_0x53dab0['name']+','+(_0x12fd20[_0xee5d('0xa1')][_0xee5d('0xc8')]||0xa),'interval':_0xee5d('0xc2')});_0x12fd20[_0xee5d('0xc9')]=!![];}return respondWithRpcPromise(_0xee5d('0xca'),'startRouting',_0x12fd20);});}return respondWithRpcPromise(_0xee5d('0xca'),_0xee5d('0xcb'),_0x12fd20);})[_0xee5d('0x1e')](function(_0x13a27e){respondWithRpcPromise(_0xee5d('0xcc'),_0xee5d('0xcc'),{'event':'notify','message':_0x13a27e},client9002);return _0x13a27e;})[_0xee5d('0x1e')](respondWithResult(_0x5aca07,null))[_0xee5d('0x28')](handleError(_0x5aca07,null));};exports['offline']=function(_0x1607eb,_0x30ab58,_0xd51d3f){var _0x2492c6,_0x4db5f5,_0x9b9467;var _0x3d31ae=[];var _0x260d52=[];var _0x2ee4d0={};var _0x3f0a49=_0x1607eb[_0xee5d('0xcd')]||[];var _0x12735a=[];var _0x58564a;return db[_0xee5d('0x8d')][_0xee5d('0x62')]()[_0xee5d('0x1e')](function(_0x5d2039){if(!_0x5d2039){throw new db['Sequelize'][(_0xee5d('0x8f'))](_0xee5d('0xce'));}_0x260d52=_[_0xee5d('0x92')](_[_0xee5d('0x43')](_0x5d2039),[_0xee5d('0x90'),_0xee5d('0x91')]);_0x3d31ae=_[_0xee5d('0x92')](_[_0xee5d('0x43')](_0x5d2039),[_0xee5d('0x90'),_0xee5d('0x91'),_0xee5d('0x93'),_0xee5d('0x94')]);if(_0x1607eb['body']['id']){delete _0x1607eb[_0xee5d('0x5a')]['id'];}if(_[_0xee5d('0x7e')](_0x1607eb['body']['from'])){throw _0x30ab58[_0xee5d('0x2a')](0x1f4)[_0xee5d('0xcf')](new db[(_0xee5d('0x8e'))]['ValidationError'](_0xee5d('0x96')));}if(_[_0xee5d('0x7e')](_0x1607eb[_0xee5d('0x5a')]['body'])||_0x1607eb[_0xee5d('0x5a')][_0xee5d('0x5a')]===''){throw _0x30ab58['status'](0x1f4)['send'](new db[(_0xee5d('0x8e'))][(_0xee5d('0x8f'))](_0xee5d('0x97')));}if(_['isNil'](_0x1607eb[_0xee5d('0x5a')][_0xee5d('0xd0')])){throw _0x30ab58[_0xee5d('0x2a')](0x1f4)[_0xee5d('0xcf')](new db[(_0xee5d('0x8e'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3d31ae));}if(!_[_0xee5d('0x99')](_0x3d31ae,_0x1607eb['body'][_0xee5d('0xd0')])){throw _0x30ab58[_0xee5d('0x2a')](0x1f4)[_0xee5d('0xcf')](new db[(_0xee5d('0x8e'))][(_0xee5d('0x8f'))](_0xee5d('0xd1')+_0x3d31ae));}_0x2ee4d0[_0x1607eb[_0xee5d('0x5a')][_0xee5d('0xd0')]]=_0x1607eb[_0xee5d('0x5a')]['from'];})[_0xee5d('0x1e')](function(){return db[_0xee5d('0x3d')][_0xee5d('0x58')]({'where':{'id':_0x1607eb[_0xee5d('0x54')]['id']},'include':[{'model':db[_0xee5d('0x9c')],'as':'List'},{'model':db[_0xee5d('0xd2')],'as':_0xee5d('0xd2')}]});})[_0xee5d('0x1e')](handleEntityNotFound(_0x30ab58,null))[_0xee5d('0x1e')](function(_0x27b024){if(_0x27b024&&_0x27b024[_0xee5d('0x9d')]){_0x4db5f5=_0x27b024;var _0x84ff3a=_[_0xee5d('0xa5')](_0x1607eb['body'],{'firstName':_0x1607eb[_0xee5d('0x5a')]['from'],'phone':_0x1607eb[_0xee5d('0x5a')]['from'],'ListId':_0x27b024['ListId']});_0x84ff3a[_0x1607eb[_0xee5d('0x5a')][_0xee5d('0xd0')]]=_0x1607eb[_0xee5d('0x5a')]['from'];return db[_0xee5d('0x8d')]['findOrCreate']({'where':_0x2ee4d0,'defaults':_0x84ff3a});}})['spread'](function(_0x5ec8b4){if(_0x5ec8b4){_0x9b9467=_0x5ec8b4;var _0x1da9bd=fs[_0xee5d('0xd3')](path[_0xee5d('0x7a')](config[_0xee5d('0x7b')],_0xee5d('0xd4')),_0xee5d('0xd5'));var _0x3d57cf=ejs[_0xee5d('0xd6')](_0x1da9bd,{'body':_[_0xee5d('0xd7')](_0x1607eb[_0xee5d('0x5a')]['body']),'bodyTitle':_0x4db5f5[_0xee5d('0xd8')]});return db[_0xee5d('0xd9')][_0xee5d('0x59')]({'body':_0x3d57cf,'ContactId':_0x5ec8b4['id'],'ChatWebsiteId':_0x4db5f5['id']});}})[_0xee5d('0x1e')](function(_0xc07a60){_0x58564a=_0xc07a60;if(_0x3f0a49[_0xee5d('0x47')]){var _0x3c330a=_0x3f0a49[_0xee5d('0x3c')](function(_0x21f6b9){return{'name':_0x21f6b9['originalname'],'basename':_0x21f6b9[_0xee5d('0x72')],'type':_0x21f6b9[_0xee5d('0xda')],'ChatOfflineMessageId':_0xc07a60['id']};});_0x12735a=_0x3c330a[_0xee5d('0x3c')](_0x245354=>{var _0x233c07={'filename':_0x245354[_0xee5d('0x39')],'path':path[_0xee5d('0x7a')](config['root'],'server',_0xee5d('0xcd'),_0xee5d('0xdb'),_0xee5d('0xdc'),_0x245354[_0xee5d('0xdd')])};return _0x233c07;});if(!_0x4db5f5[_0xee5d('0xde')]){return db[_0xee5d('0xdf')][_0xee5d('0xe0')](function(_0xd81cc8){return db['Attachment'][_0xee5d('0xe1')](_0x3c330a,{'transaction':_0xd81cc8});});}}})[_0xee5d('0x1e')](function(){if(_0x58564a){_0x2492c6=_0x58564a;return db[_0xee5d('0xd2')][_0xee5d('0x6d')]({'where':{'active':!![]},'include':[{'model':db[_0xee5d('0xe2')],'as':_0xee5d('0xe3'),'raw':!![]}]});}})['then'](function(_0x2ca1b1){if(_0x2ca1b1&&_0x2ca1b1[_0xee5d('0xe3')]&&_0x4db5f5[_0xee5d('0xe4')]&&_0x4db5f5[_0xee5d('0xe5')]){var _0x4b6221={'tls':{'rejectUnauthorized':![]}};if(_0x2ca1b1[_0xee5d('0xe3')]['service']){_0x4b6221[_0xee5d('0xe6')]=_0x2ca1b1[_0xee5d('0xe3')][_0xee5d('0xe6')];}else{_0x4b6221[_0xee5d('0xe7')]=_0x2ca1b1[_0xee5d('0xe3')][_0xee5d('0xe7')];_0x4b6221[_0xee5d('0xe8')]=_0x2ca1b1['Smtp'][_0xee5d('0xe8')];_0x4b6221['secure']=_0x2ca1b1[_0xee5d('0xe3')][_0xee5d('0xe9')];}if(_0x2ca1b1[_0xee5d('0xe3')]['authentication']){_0x4b6221['auth']={'user':_0x2ca1b1[_0xee5d('0xe3')][_0xee5d('0x5b')],'pass':_0x2ca1b1['Smtp']['pass']};}return respondWithRpcPromise('SendMail',_0xee5d('0xea'),{'account':_0x4b6221,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2ca1b1[_0xee5d('0x39')],_0x2ca1b1[_0xee5d('0xeb')]||_0x2ca1b1[_0xee5d('0xe3')][_0xee5d('0x5b')]),'to':_0x4db5f5[_0xee5d('0xe5')],'subject':_0x4db5f5[_0xee5d('0xec')],'html':_0x2492c6['body'],'attachments':_0x12735a}},client9003)['then'](function(){return _0x2492c6;})['catch'](function(_0x3b67af){console['error'](_0x3b67af);});}})[_0xee5d('0x1e')](function(){if(_0x4db5f5&&_0x4db5f5[_0xee5d('0xde')]&&_0x4db5f5[_0xee5d('0xed')]){var _0x303d25=[];if(_0x3f0a49[_0xee5d('0x47')]){_0x303d25=_0x3f0a49['map'](function(_0x3e49dd){return{'name':_0x3e49dd[_0xee5d('0xee')],'basename':_0x3e49dd[_0xee5d('0x72')],'type':_0x3e49dd[_0xee5d('0xda')],'ChatOfflineMessageId':_0x58564a['id']};});}var _0x1328c9;if(!_['isNil'](_0x4db5f5[_0xee5d('0xef')])){var _0x4fd28f=_['map'](_0x1607eb[_0xee5d('0x5a')],function(_0x53ff9f){return _0x53ff9f;});var _0x287446=_[_0xee5d('0xf0')](_0x4fd28f)[0x0];var _0x11fad4=_['mapValues'](_0x287446,function(_0x94b722){return _0x94b722;});_0x1328c9=_0x11fad4[0x1][_0x4db5f5[_0xee5d('0xef')]];}var _0x39ddd2={'from':_0x9b9467[_0xee5d('0xeb')],'firstName':_0x9b9467['firstName'],'lastName':_0x9b9467[_0xee5d('0xad')],'mapKey':'email','message':{'from':_0x9b9467['email'],'to':_0x4db5f5[_0xee5d('0xd2')][_0xee5d('0xeb')],'cc':'','subject':_[_0xee5d('0x7e')](_0x1328c9)?_0x4db5f5['offlineMessageSubject']:_0x1328c9,'messageId':'','sentAt':new Date(),'attach':_0x303d25[_0xee5d('0x47')],'attachments':_0x303d25,'originChannel':'Chat','ChatWebsiteId':_0x4db5f5['id'],'ChatOfflineMessageId':_0x2492c6['id'],'originTo':_0x4db5f5[_0xee5d('0xd2')][_0xee5d('0xeb')]},'body':_0x2492c6[_0xee5d('0x5a')]};var _0x23fd3b={'account':{'id':_0x4db5f5[_0xee5d('0xed')]},'body':_0x39ddd2,'log':_0xee5d('0xf1')};return respondWithRpcPromise(_0xee5d('0xf1'),_0xee5d('0xf2'),_0x23fd3b,client9001)[_0xee5d('0x1e')](function(){return _0x2492c6;})[_0xee5d('0x28')](function(_0x1d78f6){console['error'](_0x1d78f6);});}return;})[_0xee5d('0x1e')](function(){if(_0x2492c6){return _0x2492c6;}})['then'](respondWithResult(_0x30ab58,null))['catch'](function(_0x1bc77c){console[_0xee5d('0x24')]('catch',_0x1bc77c);for(var _0x4c5441 of _0x3f0a49){var _0x563f7f=path[_0xee5d('0x7a')](config[_0xee5d('0x7b')],'server',_0xee5d('0xcd'),'attachments',_0xee5d('0xdc'),_0x4c5441['filename']);fs_extra[_0xee5d('0xf3')](_0x563f7f)[_0xee5d('0x28')](function(_0x251594){console[_0xee5d('0x24')](_0xee5d('0xf4'),_0x563f7f,_0x251594);});}});};exports[_0xee5d('0xf5')]=function(_0x230cad,_0x1b410c,_0x22c7cc){return db['ChatInteraction'][_0xee5d('0x58')]({'where':{'id':_0x230cad[_0xee5d('0x54')]['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x1b410c,null))[_0xee5d('0x1e')](function(_0x2713e9){if(_0x2713e9){return _0x2713e9[_0xee5d('0xf5')](_0x230cad['body'][_0xee5d('0x69')],_[_0xee5d('0xf6')](_0x230cad['body'],['ids','id'])||{});}})[_0xee5d('0x1e')](respondWithResult(_0x1b410c,null))[_0xee5d('0x28')](handleError(_0x1b410c,null));};exports[_0xee5d('0xf7')]=function(_0x768955,_0x32f4de,_0x310ad6){var _0x1b0e8c={'raw':![],'where':{}};var _0x92cc5d={};var _0x1ae9df={'count':0x0,'rows':[]};return db[_0xee5d('0x3d')][_0xee5d('0x6d')]({'where':{'id':_0x768955[_0xee5d('0x54')]['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x32f4de,null))[_0xee5d('0x1e')](function(_0x1a3041){if(_0x1a3041){_0x92cc5d[_0xee5d('0x41')]=_[_0xee5d('0x43')](db[_0xee5d('0xb8')]['rawAttributes']);_0x92cc5d[_0xee5d('0x42')]=_[_0xee5d('0x43')](_0x768955['query']);_0x92cc5d[_0xee5d('0x44')]=_[_0xee5d('0x45')](_0x92cc5d[_0xee5d('0x41')],_0x92cc5d[_0xee5d('0x42')]);_0x1b0e8c['attributes']=_[_0xee5d('0x45')](_0x92cc5d['model'],qs[_0xee5d('0x56')](_0x768955[_0xee5d('0x42')]['fields']));_0x1b0e8c[_0xee5d('0x46')]=_0x1b0e8c[_0xee5d('0x46')][_0xee5d('0x47')]?_0x1b0e8c[_0xee5d('0x46')]:_0x92cc5d[_0xee5d('0x41')];if(!_0x768955[_0xee5d('0x42')][_0xee5d('0x48')](_0xee5d('0x49'))){_0x1b0e8c[_0xee5d('0x2d')]=qs['limit'](_0x768955[_0xee5d('0x42')][_0xee5d('0x2d')]);_0x1b0e8c[_0xee5d('0x2c')]=qs['offset'](_0x768955[_0xee5d('0x42')][_0xee5d('0x2c')]);}_0x1b0e8c['order']=qs[_0xee5d('0x4b')](_0x768955[_0xee5d('0x42')][_0xee5d('0x4b')]);_0x1b0e8c[_0xee5d('0x4c')]=qs['filters'](_[_0xee5d('0x4d')](_0x768955[_0xee5d('0x42')],_0x92cc5d[_0xee5d('0x44')]));_0x1b0e8c[_0xee5d('0x4c')][_0xee5d('0x64')]=_0x1a3041['id'];if(_0x768955[_0xee5d('0x42')]['filter']){_0x1b0e8c[_0xee5d('0x4c')]=_['merge'](_0x1b0e8c['where'],{'$or':_[_0xee5d('0x3c')](_0x1b0e8c['attributes'],function(_0x2df1c5){var _0x57c913={};_0x57c913[_0x2df1c5]={'$like':'%'+_0x768955[_0xee5d('0x42')][_0xee5d('0x50')]+'%'};return _0x57c913;})});}_0x1b0e8c=_[_0xee5d('0x4e')]({},_0x1b0e8c,_0x768955[_0xee5d('0x51')]);return db[_0xee5d('0xb8')]['count']({'where':_0x1b0e8c[_0xee5d('0x4c')]})[_0xee5d('0x1e')](function(_0x298a68){_0x1ae9df[_0xee5d('0x2f')]=_0x298a68;if(_0x768955[_0xee5d('0x42')][_0xee5d('0x57')]){_0x1b0e8c['include']=[{'model':db[_0xee5d('0x8d')],'as':_0xee5d('0xf8'),'required':![]},{'model':db[_0xee5d('0xc5')],'as':_0xee5d('0xf9'),'attributes':[_0xee5d('0x39'),_0xee5d('0xfa'),_0xee5d('0xfb')],'required':![]},{'model':db[_0xee5d('0xfc')],'as':'Tags','attributes':['id',_0xee5d('0x39'),'color'],'where':_0x768955[_0xee5d('0x42')]['tag']?{'id':_0x768955['query'][_0xee5d('0xfd')]}:undefined,'required':_0x768955[_0xee5d('0x42')]['tag']?!![]:![]}];}return db[_0xee5d('0xb8')][_0xee5d('0x53')](_0x1b0e8c);})[_0xee5d('0x1e')](function(_0x5640c9){_0x1ae9df[_0xee5d('0x67')]=_0x5640c9;return _0x1ae9df;});}})[_0xee5d('0x1e')](respondWithFilteredResult(_0x32f4de,_0x1b0e8c))[_0xee5d('0x28')](handleError(_0x32f4de,null));};function iftimePromise(_0x907dec,_0x424665){return respondWithRpcPromise('Command',_0xee5d('0xfe'),{'command':_0x424665[_0xee5d('0xff')]?util['format']('iftime\x20%s,%s',_0x907dec[_0xee5d('0x100')],_0x424665[_0xee5d('0xff')]):util[_0xee5d('0xb0')]('iftime\x20%s',_0x907dec[_0xee5d('0x100')])},client9002)['then'](function(_0x5b8b94){var _0x5884b3=_0x5b8b94&&_0x5b8b94[_0xee5d('0x101')](_0xee5d('0x102'))>=0x0?!![]:![];logger['info'](_0xee5d('0x103'),_0x424665['id'],_0x907dec['id'],_0x907dec[_0xee5d('0x100')],_0x5884b3?_0xee5d('0x104'):'OFFLINE',_0x424665['timezone']?_0x424665[_0xee5d('0xff')]:_0xee5d('0x105'));return _0x5884b3;})['catch'](function(_0x56273b){logger[_0xee5d('0x24')](_0xee5d('0x103'),_0x424665['id'],_0x907dec['id'],_0x907dec['interval'],util[_0xee5d('0x106')](_0x56273b,{'showHidden':![],'depth':null}),_0x424665[_0xee5d('0xff')]?_0x424665['timezone']:_0xee5d('0x105'));return![];});}exports[_0xee5d('0xfe')]=function(_0x13b0c7,_0x11ce27,_0x39d497){var _0x470514=0x0;var _0x56cc73=0x0;var _0x1bbc39=![];var _0x2b39be;var _0xf97e7e;return db['ChatWebsite'][_0xee5d('0x58')]({'where':{'id':_0x13b0c7['params']['id']},'include':[{'model':db[_0xee5d('0x107')],'as':_0xee5d('0x107'),'include':[{'model':db[_0xee5d('0x107')],'as':_0xee5d('0x108'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xee5d('0x1e')](handleEntityNotFound(_0x11ce27,null))[_0xee5d('0x1e')](function(_0x5c2b75){if(_0x5c2b75){_0x2b39be=_0x5c2b75;return _0x5c2b75[_0xee5d('0x109')]({'raw':!![]});}})[_0xee5d('0x1e')](function(_0x4faf6e){if(_0x2b39be){if(_0x4faf6e){_0xf97e7e=_0x4faf6e;}}return require('../../config/license/util')[_0xee5d('0x10a')]();})['then'](function(_0x54926a){if(_0x54926a){_0x56cc73=_0x54926a[_0xee5d('0x10b')];_0x1bbc39=_0x54926a[_0xee5d('0x7d')];}})[_0xee5d('0x1e')](function(){return db[_0xee5d('0xb8')]['count']({'where':{'closed':![]}});})[_0xee5d('0x1e')](function(_0x4c2691){_0x470514=_0x4c2691;if(_0x56cc73&&_0x4c2691>_0x56cc73){return db['License'][_0xee5d('0x6d')]({'where':{'id':0x1}})['then'](function(_0x36cf82){if(_0x36cf82){_0x36cf82[_0xee5d('0x10c')]('chatLicenseExceeded');}});}})[_0xee5d('0x1e')](function(){if(_0x2b39be['Interval']&&_0x2b39be[_0xee5d('0x107')]['Intervals']){var _0x5cf563=[];for(var _0x38ee67=0x0;_0x38ee67<_0x2b39be[_0xee5d('0x107')][_0xee5d('0x108')][_0xee5d('0x47')];_0x38ee67++){var _0x1166b9=_0x2b39be[_0xee5d('0x107')][_0xee5d('0x108')][_0x38ee67][_0xee5d('0x5c')]({'plain':!![]});_0x5cf563[_0xee5d('0xc0')](iftimePromise(_0x1166b9,_0x2b39be));}return BPromise[_0xee5d('0x10d')](_0x5cf563)['then'](function(_0x278b89){return _[_0xee5d('0x10e')](_0x278b89);});}else{return!![];}})[_0xee5d('0x1e')](function(_0x451dbb){var _0x162094=fs[_0xee5d('0xd3')](path[_0xee5d('0x7a')](config['root'],_0xee5d('0x10f')),_0xee5d('0xd5'));var _0x5631ac={'remote':_0x2b39be[_0xee5d('0x110')],'query':querystring[_0xee5d('0x23')](_[_0xee5d('0x4e')](_0x2b39be[_0xee5d('0x5c')]({'plain':!![]}),{'customerIp':_0x13b0c7[_0xee5d('0xa8')]['x-forwarded-for']||_0x13b0c7[_0xee5d('0xa8')][_0xee5d('0x111')]||_0x13b0c7[_0xee5d('0x112')]['remoteAddress']||_0x13b0c7['ip'],'referer':_0x13b0c7[_0xee5d('0xa8')]['referer'],'openedInteractions':_0x470514,'maxInteractions':_0x56cc73,'virtual':_0x1bbc39[_0xee5d('0x10b')],'online':_0x451dbb,'custom':_0x1bbc39}))[_0xee5d('0x113')](/'/g,'\x5c\x27')};_0x11ce27[_0xee5d('0xcf')](ejs['render'](Mustache['render'](_0x162094,_0x5631ac),{'proactiveActions':_0xf97e7e,'alignment':_0x2b39be['alignment'],'verticalAlignment':_0x2b39be[_0xee5d('0x114')],'div_color':_0x2b39be[_0xee5d('0x115')],'text_color':_0x2b39be[_0xee5d('0x116')],'button_color':_0x2b39be[_0xee5d('0x117')],'background_color':_0x2b39be[_0xee5d('0x118')]}));})[_0xee5d('0x28')](handleError(_0x11ce27,null));};exports['addApplications']=function(_0x50bcb4,_0x3daae9,_0x53d45e){return db[_0xee5d('0x3d')][_0xee5d('0x6d')]({'where':{'id':_0x50bcb4['params']['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x3daae9,null))[_0xee5d('0x1e')](function(_0x4e89d8){if(_0x4e89d8){return db[_0xee5d('0xdf')][_0xee5d('0xe0')](function(_0x15538b){return db['ChatApplication'][_0xee5d('0x35')]({'where':{'ChatWebsiteId':_0x50bcb4[_0xee5d('0x54')]['id']},'transaction':_0x15538b})[_0xee5d('0x1e')](function(_0x18f79d){var _0x989d7d=_['map'](_0x50bcb4[_0xee5d('0x5a')],function(_0x295c70){_0x295c70[_0xee5d('0x64')]=_0x50bcb4[_0xee5d('0x54')]['id'];return _0x295c70;});return db['ChatApplication'][_0xee5d('0xe1')](_0x989d7d,{'transaction':_0x15538b});});})[_0xee5d('0x1e')](function(){return db[_0xee5d('0x119')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x50bcb4[_0xee5d('0x54')]['id']},'order':_0xee5d('0xa4')});});}})[_0xee5d('0x1e')](respondWithResult(_0x3daae9,null))[_0xee5d('0x28')](handleError(_0x3daae9,null));};exports['getApplications']=function(_0x1c51f1,_0x478ee2,_0xaea334){var _0x48ed18={};var _0x43ec34={};var _0x144f9e;var _0x510063;return db[_0xee5d('0x3d')][_0xee5d('0x6d')]({'where':{'id':_0x1c51f1[_0xee5d('0x54')]['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x478ee2,null))['then'](function(_0x2a0084){if(_0x2a0084){_0x144f9e=_0x2a0084;_0x43ec34[_0xee5d('0x41')]=_['keys'](db['ChatApplication'][_0xee5d('0x3e')]);_0x43ec34[_0xee5d('0x42')]=_[_0xee5d('0x43')](_0x1c51f1['query']);_0x43ec34[_0xee5d('0x44')]=_[_0xee5d('0x45')](_0x43ec34[_0xee5d('0x41')],_0x43ec34['query']);_0x48ed18[_0xee5d('0x46')]=_[_0xee5d('0x45')](_0x43ec34[_0xee5d('0x41')],qs[_0xee5d('0x56')](_0x1c51f1[_0xee5d('0x42')][_0xee5d('0x56')]));_0x48ed18[_0xee5d('0x46')]=_0x48ed18['attributes']['length']?_0x48ed18[_0xee5d('0x46')]:_0x43ec34['model'];_0x48ed18[_0xee5d('0x4a')]=qs[_0xee5d('0x4b')](_0x1c51f1['query']['sort']);_0x48ed18[_0xee5d('0x4c')]=qs['filters'](_[_0xee5d('0x4d')](_0x1c51f1['query'],_0x43ec34[_0xee5d('0x44')]));if(_0x1c51f1[_0xee5d('0x42')][_0xee5d('0x50')]){_0x48ed18[_0xee5d('0x4c')]=_[_0xee5d('0x4e')](_0x48ed18[_0xee5d('0x4c')],{'$or':_['map'](_0x48ed18[_0xee5d('0x46')],function(_0x22cdb4){var _0x33be30={};_0x33be30[_0x22cdb4]={'$like':'%'+_0x1c51f1[_0xee5d('0x42')]['filter']+'%'};return _0x33be30;})});}_0x48ed18=_[_0xee5d('0x4e')]({},_0x48ed18,_0x1c51f1['options']);return _0x144f9e[_0xee5d('0x11a')](_0x48ed18);}})['then'](function(_0x57ded0){if(_0x57ded0){_0x510063=_0x57ded0[_0xee5d('0x47')];if(!_0x1c51f1[_0xee5d('0x42')][_0xee5d('0x48')]('nolimit')){_0x48ed18[_0xee5d('0x2d')]=qs[_0xee5d('0x2d')](_0x1c51f1[_0xee5d('0x42')]['limit']);_0x48ed18['offset']=qs['offset'](_0x1c51f1['query'][_0xee5d('0x2c')]);}return _0x144f9e['getApplications'](_0x48ed18);}})[_0xee5d('0x1e')](function(_0x1848a0){if(_0x1848a0){return _0x1848a0?{'count':_0x510063,'rows':_0x1848a0}:null;}})[_0xee5d('0x1e')](respondWithResult(_0x478ee2,null))[_0xee5d('0x28')](handleError(_0x478ee2,null));};exports[_0xee5d('0x11b')]=function(_0x64ab41,_0x5abcef,_0x20a708){return db[_0xee5d('0x11c')][_0xee5d('0x58')]({'where':{'id':_0x64ab41['params']['id']}})['then'](handleEntityNotFound(_0x5abcef,null))[_0xee5d('0x1e')](function(_0x26ef3f){if(_0x26ef3f){return _0x26ef3f['addProactiveActions'](_0x64ab41[_0xee5d('0x5a')][_0xee5d('0x69')],_[_0xee5d('0xf6')](_0x64ab41[_0xee5d('0x5a')],[_0xee5d('0x69'),'id'])||{});}})[_0xee5d('0x1e')](respondWithResult(_0x5abcef,null))[_0xee5d('0x28')](handleError(_0x5abcef,null));};exports[_0xee5d('0x109')]=function(_0x2553bd,_0x5762b2,_0x354ab9){var _0xa9b505={};var _0x335ded={};var _0x35c409;var _0x287e60;return db[_0xee5d('0x3d')]['findOne']({'where':{'id':_0x2553bd[_0xee5d('0x54')]['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x5762b2,null))[_0xee5d('0x1e')](function(_0x44d29d){if(_0x44d29d){_0x35c409=_0x44d29d;_0x335ded[_0xee5d('0x41')]=_['keys'](db[_0xee5d('0x11d')][_0xee5d('0x3e')]);_0x335ded[_0xee5d('0x42')]=_['keys'](_0x2553bd['query']);_0x335ded['filters']=_['intersection'](_0x335ded['model'],_0x335ded[_0xee5d('0x42')]);_0xa9b505['attributes']=_[_0xee5d('0x45')](_0x335ded[_0xee5d('0x41')],qs[_0xee5d('0x56')](_0x2553bd[_0xee5d('0x42')][_0xee5d('0x56')]));_0xa9b505[_0xee5d('0x46')]=_0xa9b505[_0xee5d('0x46')][_0xee5d('0x47')]?_0xa9b505['attributes']:_0x335ded[_0xee5d('0x41')];_0xa9b505[_0xee5d('0x4a')]=qs[_0xee5d('0x4b')](_0x2553bd[_0xee5d('0x42')]['sort']);_0xa9b505[_0xee5d('0x4c')]=qs[_0xee5d('0x44')](_['pick'](_0x2553bd[_0xee5d('0x42')],_0x335ded[_0xee5d('0x44')]));if(_0x2553bd[_0xee5d('0x42')][_0xee5d('0x50')]){_0xa9b505[_0xee5d('0x4c')]=_[_0xee5d('0x4e')](_0xa9b505[_0xee5d('0x4c')],{'$or':_[_0xee5d('0x3c')](_0xa9b505[_0xee5d('0x46')],function(_0x10087f){var _0x159217={};_0x159217[_0x10087f]={'$like':'%'+_0x2553bd[_0xee5d('0x42')][_0xee5d('0x50')]+'%'};return _0x159217;})});}_0xa9b505=_['merge']({},_0xa9b505,_0x2553bd[_0xee5d('0x51')]);return _0x35c409[_0xee5d('0x109')](_0xa9b505);}})[_0xee5d('0x1e')](function(_0x5c7e0f){if(_0x5c7e0f){_0x287e60=_0x5c7e0f[_0xee5d('0x47')];if(!_0x2553bd['query'][_0xee5d('0x48')](_0xee5d('0x49'))){_0xa9b505['limit']=qs[_0xee5d('0x2d')](_0x2553bd[_0xee5d('0x42')][_0xee5d('0x2d')]);_0xa9b505[_0xee5d('0x2c')]=qs[_0xee5d('0x2c')](_0x2553bd[_0xee5d('0x42')][_0xee5d('0x2c')]);}return _0x35c409[_0xee5d('0x109')](_0xa9b505);}})[_0xee5d('0x1e')](function(_0x4c065c){if(_0x4c065c){return _0x4c065c?{'count':_0x287e60,'rows':_0x4c065c}:null;}})[_0xee5d('0x1e')](respondWithResult(_0x5762b2,null))[_0xee5d('0x28')](handleError(_0x5762b2,null));};exports[_0xee5d('0x11e')]=function(_0x3e8f90,_0x1b8934,_0x3ecd01){var _0x23fa07=_0x3e8f90[_0xee5d('0x42')]['online']===_0xee5d('0x11f')?_0xee5d('0x120'):_0xee5d('0x121');return db[_0xee5d('0x3d')][_0xee5d('0x58')]({'attributes':['id',_0x23fa07],'where':{'id':_0x3e8f90['params']['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x1b8934,null))['then'](function(_0x32c34f){if(_0x32c34f){var _0x1439d3=_0x32c34f[_0x23fa07];var _0x3dd802=_0x1439d3&&_0x1439d3[_0xee5d('0x122')]?_0x1439d3['items']:[];_0x1b8934[_0xee5d('0xcf')]({'fromKey':_[_0xee5d('0x7e')](_0x1439d3[_0xee5d('0x123')])?undefined:_0x1439d3[_0xee5d('0x123')],'count':_0x3dd802[_0xee5d('0x47')],'rows':_0x3dd802});}})[_0xee5d('0x28')](handleError(_0x1b8934,null));};exports['getOfflineMessages']=function(_0x260f37,_0x3066d8,_0x3439e1){var _0x438fd4={'raw':![],'where':{}};var _0x2375c0={};var _0x513b3b={'count':0x0,'rows':[]};return db[_0xee5d('0x3d')]['findOne']({'where':{'id':_0x260f37['params']['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x3066d8,null))[_0xee5d('0x1e')](function(_0x3d894a){if(_0x3d894a){_0x2375c0[_0xee5d('0x41')]=_[_0xee5d('0x43')](db[_0xee5d('0xd9')]['rawAttributes']);_0x2375c0[_0xee5d('0x42')]=_['keys'](_0x260f37['query']);_0x2375c0[_0xee5d('0x44')]=_['intersection'](_0x2375c0['model'],_0x2375c0[_0xee5d('0x42')]);_0x438fd4['attributes']=_[_0xee5d('0x45')](_0x2375c0[_0xee5d('0x41')],qs[_0xee5d('0x56')](_0x260f37[_0xee5d('0x42')][_0xee5d('0x56')]));_0x438fd4[_0xee5d('0x46')]=_0x438fd4[_0xee5d('0x46')][_0xee5d('0x47')]?_0x438fd4['attributes']:_0x2375c0[_0xee5d('0x41')];if(!_0x260f37[_0xee5d('0x42')][_0xee5d('0x48')](_0xee5d('0x49'))){_0x438fd4[_0xee5d('0x2d')]=qs['limit'](_0x260f37['query'][_0xee5d('0x2d')]);_0x438fd4[_0xee5d('0x2c')]=qs[_0xee5d('0x2c')](_0x260f37[_0xee5d('0x42')][_0xee5d('0x2c')]);}_0x438fd4['order']=qs[_0xee5d('0x4b')](_0x260f37[_0xee5d('0x42')][_0xee5d('0x4b')]);_0x438fd4[_0xee5d('0x4c')]=qs[_0xee5d('0x44')](_[_0xee5d('0x4d')](_0x260f37[_0xee5d('0x42')],_0x2375c0[_0xee5d('0x44')]));_0x438fd4[_0xee5d('0x4c')]['ChatWebsiteId']=_0x3d894a['id'];if(_0x260f37[_0xee5d('0x42')][_0xee5d('0x50')]){_0x438fd4[_0xee5d('0x4c')]=_[_0xee5d('0x4e')](_0x438fd4[_0xee5d('0x4c')],{'$or':_[_0xee5d('0x3c')](_0x438fd4[_0xee5d('0x46')],function(_0x253d7a){var _0x27b0fa={};_0x27b0fa[_0x253d7a]={'$like':'%'+_0x260f37['query'][_0xee5d('0x50')]+'%'};return _0x27b0fa;})});}_0x438fd4=_[_0xee5d('0x4e')]({},_0x438fd4,_0x260f37['options']);return db[_0xee5d('0xd9')][_0xee5d('0x2f')]({'where':_0x438fd4[_0xee5d('0x4c')]})['then'](function(_0x57b957){_0x513b3b['count']=_0x57b957;if(_0x260f37[_0xee5d('0x42')][_0xee5d('0x57')]){_0x438fd4[_0xee5d('0x52')]=[{'all':!![]}];}else{_0x438fd4[_0xee5d('0x52')]=[{'model':db[_0xee5d('0x8d')],'as':_0xee5d('0xf8'),'required':![]},{'model':db[_0xee5d('0x124')],'as':_0xee5d('0x125'),'required':![]}];}return db[_0xee5d('0xd9')][_0xee5d('0x53')](_0x438fd4);})[_0xee5d('0x1e')](function(_0x38884a){_0x513b3b[_0xee5d('0x67')]=_0x38884a;return _0x513b3b;});}})[_0xee5d('0x1e')](respondWithFilteredResult(_0x3066d8,_0x438fd4))['catch'](handleError(_0x3066d8,null));};exports[_0xee5d('0x126')]=function(_0x2e1e40,_0x1ce22e,_0x3c4120){return db[_0xee5d('0x3d')][_0xee5d('0x58')]({'where':{'id':_0x2e1e40[_0xee5d('0x54')]['id']}})['then'](handleEntityNotFound(_0x1ce22e,null))[_0xee5d('0x1e')](function(_0x3fc70c){if(_0x3fc70c){return _0x3fc70c[_0xee5d('0x126')](_0x2e1e40[_0xee5d('0x5a')][_0xee5d('0x69')],_[_0xee5d('0xf6')](_0x2e1e40[_0xee5d('0x5a')],['ids','id'])||{})[_0xee5d('0xbc')](function(_0x15fc89){for(var _0x2296d5=0x0;_0x2296d5<_0x2e1e40[_0xee5d('0x5a')][_0xee5d('0x69')]['length'];_0x2296d5+=0x1){socket[_0xee5d('0x127')](_0xee5d('0x128'),{'UserId':Number(_0x2e1e40[_0xee5d('0x5a')][_0xee5d('0x69')][_0x2296d5]),'ChatWebsiteId':Number(_0x2e1e40['params']['id'])});}return _0x15fc89;});}})[_0xee5d('0x1e')](respondWithResult(_0x1ce22e,null))[_0xee5d('0x28')](handleError(_0x1ce22e,null));};exports[_0xee5d('0x129')]=function(_0x17577e,_0x17cccb,_0x2e2547){return db['ChatWebsite'][_0xee5d('0x58')]({'where':{'id':_0x17577e['params']['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x17cccb,null))[_0xee5d('0x1e')](function(_0x22cc4c){if(_0x22cc4c){return _0x22cc4c[_0xee5d('0x129')](_0x17577e[_0xee5d('0x42')]['ids'])[_0xee5d('0x1e')](function(){if(_['isArray'](_0x17577e[_0xee5d('0x42')][_0xee5d('0x69')])){for(var _0x2310d6=0x0;_0x2310d6<_0x17577e[_0xee5d('0x42')]['ids'][_0xee5d('0x47')];_0x2310d6+=0x1){socket['emit'](_0xee5d('0x12a'),{'UserId':Number(_0x17577e[_0xee5d('0x42')]['ids'][_0x2310d6]),'ChatWebsiteId':Number(_0x17577e[_0xee5d('0x54')]['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x17577e[_0xee5d('0x42')][_0xee5d('0x69')]),'ChatWebsiteId':Number(_0x17577e[_0xee5d('0x54')]['id'])});}});}})[_0xee5d('0x1e')](respondWithStatusCode(_0x17cccb,null))[_0xee5d('0x28')](handleError(_0x17cccb,null));};exports[_0xee5d('0x12b')]=function(_0x15e9a0,_0x149131,_0x3ecc3b){var _0x4a26e4={};var _0x23d89d={};var _0x14da1a;var _0x2e0ba6;return db[_0xee5d('0x3d')][_0xee5d('0x6d')]({'where':{'id':_0x15e9a0[_0xee5d('0x54')]['id']}})[_0xee5d('0x1e')](handleEntityNotFound(_0x149131,null))[_0xee5d('0x1e')](function(_0x28043a){if(_0x28043a){_0x14da1a=_0x28043a;_0x23d89d[_0xee5d('0x41')]=_[_0xee5d('0x43')](db[_0xee5d('0xc5')][_0xee5d('0x3e')]);_0x23d89d[_0xee5d('0x42')]=_[_0xee5d('0x43')](_0x15e9a0[_0xee5d('0x42')]);_0x23d89d[_0xee5d('0x44')]=_[_0xee5d('0x45')](_0x23d89d[_0xee5d('0x41')],_0x23d89d[_0xee5d('0x42')]);_0x4a26e4['attributes']=_[_0xee5d('0x45')](_0x23d89d[_0xee5d('0x41')],qs[_0xee5d('0x56')](_0x15e9a0[_0xee5d('0x42')][_0xee5d('0x56')]));_0x4a26e4[_0xee5d('0x46')]=_0x4a26e4['attributes']['length']?_0x4a26e4[_0xee5d('0x46')]:_0x23d89d[_0xee5d('0x41')];_0x4a26e4['order']=qs[_0xee5d('0x4b')](_0x15e9a0[_0xee5d('0x42')]['sort']);_0x4a26e4[_0xee5d('0x4c')]=qs[_0xee5d('0x44')](_[_0xee5d('0x4d')](_0x15e9a0[_0xee5d('0x42')],_0x23d89d[_0xee5d('0x44')]));if(_0x15e9a0[_0xee5d('0x42')][_0xee5d('0x50')]){_0x4a26e4['where']=_[_0xee5d('0x4e')](_0x4a26e4[_0xee5d('0x4c')],{'$or':_[_0xee5d('0x3c')](_0x4a26e4[_0xee5d('0x46')],function(_0x26ca76){var _0x251cc8={};_0x251cc8[_0x26ca76]={'$like':'%'+_0x15e9a0[_0xee5d('0x42')][_0xee5d('0x50')]+'%'};return _0x251cc8;})});}_0x4a26e4=_[_0xee5d('0x4e')]({},_0x4a26e4,_0x15e9a0[_0xee5d('0x51')]);return _0x14da1a[_0xee5d('0x12b')](_0x4a26e4);}})[_0xee5d('0x1e')](function(_0x4f093e){if(_0x4f093e){_0x2e0ba6=_0x4f093e[_0xee5d('0x47')];if(!_0x15e9a0[_0xee5d('0x42')]['hasOwnProperty'](_0xee5d('0x49'))){_0x4a26e4[_0xee5d('0x2d')]=qs['limit'](_0x15e9a0[_0xee5d('0x42')]['limit']);_0x4a26e4[_0xee5d('0x2c')]=qs[_0xee5d('0x2c')](_0x15e9a0['query']['offset']);}return _0x14da1a[_0xee5d('0x12b')](_0x4a26e4);}})['then'](function(_0x4607d8){if(_0x4607d8){return _0x4607d8?{'count':_0x2e0ba6,'rows':_0x4607d8}:null;}})[_0xee5d('0x1e')](respondWithResult(_0x149131,null))['catch'](handleError(_0x149131,null));}; \ No newline at end of file +var _0xaa4e=['fields','query','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','show','params','intersection','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','findAll','rows','removeDispositions','getAnswers','CannedAnswer','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','root','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmContact','Contacts','DESC','ChatApplication','Applications','List','applications','list','orderBy','asc','account','contact','headers','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','update','created','autoclose','close','unmanaged','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','files','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','subjectOffline','toPairsIn','mapValues','email','offlineMessageSubject','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','User','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','color_button','backgroundColor','addApplications','transaction','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','offlineForm','items','fromKey','getOfflineMessages','addAgents','omit','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatWebsite.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','save','get','ChatWebsites','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','model','keys'];(function(_0x4d5350,_0x41305b){var _0x4b2651=function(_0x2e88d3){while(--_0x2e88d3){_0x4d5350['push'](_0x4d5350['shift']());}};_0x4b2651(++_0x41305b);}(_0xaa4e,0xf3));var _0xeaa4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xaa4e[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xeaa4('0x0'));var rimraf=require(_0xeaa4('0x1'));var zipdir=require(_0xeaa4('0x2'));var jsonpatch=require(_0xeaa4('0x3'));var rp=require(_0xeaa4('0x4'));var moment=require(_0xeaa4('0x5'));var BPromise=require(_0xeaa4('0x6'));var Mustache=require(_0xeaa4('0x7'));var util=require(_0xeaa4('0x8'));var path=require('path');var sox=require(_0xeaa4('0x9'));var csv=require('to-csv');var ejs=require(_0xeaa4('0xa'));var fs=require('fs');var fs_extra=require(_0xeaa4('0xb'));var _=require(_0xeaa4('0xc'));var squel=require(_0xeaa4('0xd'));var crypto=require('crypto');var jsforce=require(_0xeaa4('0xe'));var deskjs=require(_0xeaa4('0xf'));var toCsv=require(_0xeaa4('0x10'));var querystring=require(_0xeaa4('0x11'));var Papa=require(_0xeaa4('0x12'));var Redis=require(_0xeaa4('0x13'));var authService=require(_0xeaa4('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xeaa4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeaa4('0x16'))('api');var utils=require(_0xeaa4('0x17'));var config=require(_0xeaa4('0x18'));var licenseUtil=require(_0xeaa4('0x19'));var db=require('../../mysqldb')['db'];config[_0xeaa4('0x1a')]=_[_0xeaa4('0x1b')](config[_0xeaa4('0x1a')],{'host':_0xeaa4('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeaa4('0x1a')]));require(_0xeaa4('0x1d'))[_0xeaa4('0x1e')](socket);var jayson=require(_0xeaa4('0x1f'));var client=jayson[_0xeaa4('0x20')][_0xeaa4('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xeaa4('0x21')]({'port':0x232a});var client9003=jayson[_0xeaa4('0x20')][_0xeaa4('0x21')]({'port':0x232b});var client9001=jayson['client'][_0xeaa4('0x21')]({'port':0x2329});function respondWithRpcPromise(_0x18c372,_0x5101ba,_0x3e2ee0,_0x362625){return new BPromise(function(_0x497668,_0xa16223){var _0x968de5=_0x362625||client;return _0x968de5['request'](_0x18c372,_0x3e2ee0)[_0xeaa4('0x22')](function(_0xa7ba75){logger[_0xeaa4('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x5101ba,_0xeaa4('0x24'));logger[_0xeaa4('0x25')](_0xeaa4('0x26'),_0x5101ba,'request\x20sent',JSON[_0xeaa4('0x27')](_0xa7ba75));if(_0xa7ba75[_0xeaa4('0x28')]){if(_0xa7ba75[_0xeaa4('0x28')][_0xeaa4('0x29')]===0x1f4){logger[_0xeaa4('0x28')]('ChatWebsite,\x20%s,\x20%s',_0x5101ba,_0xa7ba75[_0xeaa4('0x28')][_0xeaa4('0x2a')]);return _0xa16223(_0xa7ba75[_0xeaa4('0x28')][_0xeaa4('0x2a')]);}logger[_0xeaa4('0x28')](_0xeaa4('0x2b'),_0x5101ba,_0xa7ba75[_0xeaa4('0x28')]['message']);return _0x497668(_0xa7ba75[_0xeaa4('0x28')][_0xeaa4('0x2a')]);}else{logger['info'](_0xeaa4('0x2b'),_0x5101ba,'request\x20sent');_0x497668(_0xa7ba75[_0xeaa4('0x2c')][_0xeaa4('0x2a')]);}})[_0xeaa4('0x2d')](function(_0x325158){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x5101ba,_0x325158);_0xa16223(_0x325158);});});}function respondWithStatusCode(_0x5e1eeb,_0x3c8df4){_0x3c8df4=_0x3c8df4||0xcc;return function(_0x18103e){if(_0x18103e){return _0x5e1eeb[_0xeaa4('0x2e')](_0x3c8df4);}return _0x5e1eeb['status'](_0x3c8df4)[_0xeaa4('0x2f')]();};}function respondWithResult(_0x2ef7ba,_0x2c2b84){_0x2c2b84=_0x2c2b84||0xc8;return function(_0x58c7df){if(_0x58c7df){return _0x2ef7ba['status'](_0x2c2b84)[_0xeaa4('0x30')](_0x58c7df);}};}function respondWithFilteredResult(_0x1ea81f,_0x25f01c){return function(_0x7ba4c1){if(_0x7ba4c1){var _0x39a147=typeof _0x25f01c[_0xeaa4('0x31')]===_0xeaa4('0x32')&&typeof _0x25f01c[_0xeaa4('0x33')]===_0xeaa4('0x32');var _0x19d6a8=_0x7ba4c1[_0xeaa4('0x34')];var _0x13c150=_0x39a147?0x0:_0x25f01c['offset'];var _0x4dcc22=_0x39a147?_0x7ba4c1[_0xeaa4('0x34')]:_0x25f01c[_0xeaa4('0x31')]+_0x25f01c[_0xeaa4('0x33')];var _0x468d1a;if(_0x4dcc22>=_0x19d6a8){_0x4dcc22=_0x19d6a8;_0x468d1a=0xc8;}else{_0x468d1a=0xce;}_0x1ea81f[_0xeaa4('0x35')](_0x468d1a);return _0x1ea81f[_0xeaa4('0x36')]('Content-Range',_0x13c150+'-'+_0x4dcc22+'/'+_0x19d6a8)[_0xeaa4('0x30')](_0x7ba4c1);}return null;};}function patchUpdates(_0x3d586e){return function(_0xf417e2){try{jsonpatch[_0xeaa4('0x37')](_0xf417e2,_0x3d586e,!![]);}catch(_0x2e8bec){return BPromise['reject'](_0x2e8bec);}return _0xf417e2[_0xeaa4('0x38')]();};}function saveUpdates(_0x56f3c2,_0x22fec5){return function(_0x5088f5){if(_0x5088f5){return _0x5088f5['update'](_0x56f3c2)[_0xeaa4('0x22')](function(_0x59dacb){return _0x59dacb;});}return null;};}function removeEntity(_0x3f90d4,_0x443274){return function(_0x42009f){if(_0x42009f){return _0x42009f['destroy']()[_0xeaa4('0x22')](function(){var _0x342366=_0x42009f[_0xeaa4('0x39')]({'plain':!![]});var _0x2b0c42=_0xeaa4('0x3a');return db['UserProfileResource']['destroy']({'where':{'type':_0x2b0c42,'resourceId':_0x342366['id']}})[_0xeaa4('0x22')](function(){return _0x42009f;});})[_0xeaa4('0x22')](function(){_0x3f90d4[_0xeaa4('0x35')](0xcc)[_0xeaa4('0x2f')]();});}};}function handleEntityNotFound(_0x58feb0,_0x17e019){return function(_0x2c6be0){if(!_0x2c6be0){_0x58feb0[_0xeaa4('0x2e')](0x194);}return _0x2c6be0;};}function handleError(_0x12c525,_0xea7fb8){_0xea7fb8=_0xea7fb8||0x1f4;return function(_0xc09b6c){logger[_0xeaa4('0x28')](_0xc09b6c[_0xeaa4('0x3b')]);if(_0xc09b6c[_0xeaa4('0x3c')]){delete _0xc09b6c[_0xeaa4('0x3c')];}_0x12c525['status'](_0xea7fb8)[_0xeaa4('0x3d')](_0xc09b6c);};}exports[_0xeaa4('0x3e')]=function(_0x339955,_0x2ede5a){var _0x5d88a3={'include':[{'model':db[_0xeaa4('0x3f')],'as':_0xeaa4('0x40')}]},_0x1aede7={},_0x5445f6={'count':0x0,'rows':[]};var _0x3ad7b0=_[_0xeaa4('0x41')](db[_0xeaa4('0x42')][_0xeaa4('0x43')],function(_0x15dee3){return{'name':_0x15dee3[_0xeaa4('0x44')],'type':_0x15dee3[_0xeaa4('0x45')]['key']};});_0x1aede7[_0xeaa4('0x46')]=_[_0xeaa4('0x41')](_0x3ad7b0,_0xeaa4('0x3c'));_0x1aede7['query']=_[_0xeaa4('0x47')](_0x339955['query']);_0x1aede7['filters']=_['intersection'](_0x1aede7['model'],_0x1aede7['query']);_0x5d88a3['attributes']=_['intersection'](_0x1aede7[_0xeaa4('0x46')],qs[_0xeaa4('0x48')](_0x339955[_0xeaa4('0x49')][_0xeaa4('0x48')]));_0x5d88a3[_0xeaa4('0x4a')]=_0x5d88a3[_0xeaa4('0x4a')]['length']?_0x5d88a3['attributes']:_0x1aede7[_0xeaa4('0x46')];if(!_0x339955['query'][_0xeaa4('0x4b')](_0xeaa4('0x4c'))){_0x5d88a3[_0xeaa4('0x33')]=qs[_0xeaa4('0x33')](_0x339955['query'][_0xeaa4('0x33')]);_0x5d88a3['offset']=qs[_0xeaa4('0x31')](_0x339955[_0xeaa4('0x49')][_0xeaa4('0x31')]);}_0x5d88a3['order']=qs['sort'](_0x339955['query'][_0xeaa4('0x4d')]);_0x5d88a3[_0xeaa4('0x4e')]=qs[_0xeaa4('0x4f')](_[_0xeaa4('0x50')](_0x339955['query'],_0x1aede7[_0xeaa4('0x4f')]),_0x3ad7b0);if(_0x339955[_0xeaa4('0x49')]['filter']){_0x5d88a3[_0xeaa4('0x4e')]=_['merge'](_0x5d88a3[_0xeaa4('0x4e')],{'$or':_[_0xeaa4('0x41')](_0x3ad7b0,function(_0x412f43){if(_0x412f43[_0xeaa4('0x45')]!=='VIRTUAL'){var _0x54eca5={};_0x54eca5[_0x412f43['name']]={'$like':'%'+_0x339955[_0xeaa4('0x49')][_0xeaa4('0x51')]+'%'};return _0x54eca5;}})});}_0x5d88a3=_[_0xeaa4('0x52')]({},_0x5d88a3,_0x339955[_0xeaa4('0x53')]);var _0x692d33={'where':_0x5d88a3['where']};return db['ChatWebsite']['count'](_0x692d33)['then'](function(_0x39b4e1){_0x5445f6[_0xeaa4('0x34')]=_0x39b4e1;if(_0x339955[_0xeaa4('0x49')][_0xeaa4('0x54')]){_0x5d88a3[_0xeaa4('0x55')]=[{'all':!![]}];}return db[_0xeaa4('0x42')]['findAll'](_0x5d88a3);})[_0xeaa4('0x22')](function(_0x5e5082){_0x5445f6['rows']=_0x5e5082;return _0x5445f6;})[_0xeaa4('0x22')](respondWithFilteredResult(_0x2ede5a,_0x5d88a3))[_0xeaa4('0x2d')](handleError(_0x2ede5a,null));};exports[_0xeaa4('0x56')]=function(_0x5564c0,_0x5b1e3d){var _0x11fc08={'raw':![],'where':{'id':_0x5564c0[_0xeaa4('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xeaa4('0x40')}]},_0x28265c={};_0x28265c[_0xeaa4('0x46')]=_['keys'](db[_0xeaa4('0x42')][_0xeaa4('0x43')]);_0x28265c[_0xeaa4('0x49')]=_[_0xeaa4('0x47')](_0x5564c0[_0xeaa4('0x49')]);_0x28265c[_0xeaa4('0x4f')]=_[_0xeaa4('0x58')](_0x28265c[_0xeaa4('0x46')],_0x28265c[_0xeaa4('0x49')]);_0x11fc08[_0xeaa4('0x4a')]=_['intersection'](_0x28265c['model'],qs[_0xeaa4('0x48')](_0x5564c0[_0xeaa4('0x49')][_0xeaa4('0x48')]));_0x11fc08[_0xeaa4('0x4a')]=_0x11fc08[_0xeaa4('0x4a')][_0xeaa4('0x59')]?_0x11fc08[_0xeaa4('0x4a')]:_0x28265c['model'];if(_0x5564c0['query'][_0xeaa4('0x54')]){_0x11fc08[_0xeaa4('0x55')]=[{'all':!![]}];}_0x11fc08=_[_0xeaa4('0x52')]({},_0x11fc08,_0x5564c0['options']);return db[_0xeaa4('0x42')][_0xeaa4('0x5a')](_0x11fc08)[_0xeaa4('0x22')](handleEntityNotFound(_0x5b1e3d,null))[_0xeaa4('0x22')](respondWithResult(_0x5b1e3d,null))[_0xeaa4('0x2d')](handleError(_0x5b1e3d,null));};exports[_0xeaa4('0x5b')]=function(_0x5de187,_0xe80252){return db[_0xeaa4('0x42')][_0xeaa4('0x5b')](_0x5de187[_0xeaa4('0x5c')],{})[_0xeaa4('0x22')](function(_0xc24937){var _0x30416e=_0x5de187[_0xeaa4('0x5d')]['get']({'plain':!![]});if(!_0x30416e)throw new Error(_0xeaa4('0x5e'));if(_0x30416e['role']===_0xeaa4('0x5d')){var _0x51bd93=_0xc24937[_0xeaa4('0x39')]({'plain':!![]});var _0x1b9bf5='ChatWebsites';return db[_0xeaa4('0x5f')][_0xeaa4('0x5a')]({'where':{'name':_0x1b9bf5,'userProfileId':_0x30416e[_0xeaa4('0x60')]},'raw':!![]})[_0xeaa4('0x22')](function(_0x2995df){if(_0x2995df&&_0x2995df[_0xeaa4('0x61')]===0x0){return db[_0xeaa4('0x62')][_0xeaa4('0x5b')]({'name':_0x51bd93[_0xeaa4('0x3c')],'resourceId':_0x51bd93['id'],'type':_0x2995df[_0xeaa4('0x3c')],'sectionId':_0x2995df['id']},{})[_0xeaa4('0x22')](function(){return _0xc24937;});}else{return _0xc24937;}})[_0xeaa4('0x2d')](function(_0x3ed757){logger[_0xeaa4('0x28')](_0xeaa4('0x63'),_0x3ed757);throw _0x3ed757;});}return _0xc24937;})['then'](respondWithResult(_0xe80252,0xc9))[_0xeaa4('0x2d')](handleError(_0xe80252,null));};exports['update']=function(_0x43a431,_0x4d090d){if(_0x43a431['body']['id']){delete _0x43a431['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x43a431[_0xeaa4('0x57')]['id']},'include':[{'model':db[_0xeaa4('0x3f')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4d090d,null))['then'](saveUpdates(_0x43a431[_0xeaa4('0x5c')],null))['then'](respondWithResult(_0x4d090d,null))[_0xeaa4('0x2d')](handleError(_0x4d090d,null));};exports[_0xeaa4('0x64')]=function(_0x1610d4,_0x438373){return db['ChatWebsite'][_0xeaa4('0x5a')]({'where':{'id':_0x1610d4[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x438373,null))[_0xeaa4('0x22')](removeEntity(_0x438373,null))['catch'](handleError(_0x438373,null));};exports['describe']=function(_0x36a206,_0x8429b6){return db[_0xeaa4('0x42')][_0xeaa4('0x65')]()[_0xeaa4('0x22')](respondWithResult(_0x8429b6,null))[_0xeaa4('0x2d')](handleError(_0x8429b6,null));};exports[_0xeaa4('0x66')]=function(_0x2f83f4,_0x12d348,_0x4dfa5a){if(_0x2f83f4[_0xeaa4('0x5c')]['id']){delete _0x2f83f4[_0xeaa4('0x5c')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x2f83f4[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x12d348,null))[_0xeaa4('0x22')](function(_0x1a5bc9){if(_0x1a5bc9){_0x2f83f4[_0xeaa4('0x5c')][_0xeaa4('0x67')]=_0x1a5bc9['id'];return db[_0xeaa4('0x68')]['create'](_0x2f83f4[_0xeaa4('0x5c')]);}})[_0xeaa4('0x22')](respondWithResult(_0x12d348,null))[_0xeaa4('0x2d')](handleError(_0x12d348,null));};exports[_0xeaa4('0x69')]=function(_0x5412f5,_0x4d7bc6,_0x394538){var _0x5a5c02={'raw':![],'where':{}};var _0x9215ab={};var _0x230c85={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xeaa4('0x6a')]({'where':{'id':_0x5412f5[_0xeaa4('0x57')]['id']}})['then'](handleEntityNotFound(_0x4d7bc6,null))[_0xeaa4('0x22')](function(_0x279718){if(_0x279718){_0x9215ab[_0xeaa4('0x46')]=_[_0xeaa4('0x47')](db['Disposition'][_0xeaa4('0x43')]);_0x9215ab[_0xeaa4('0x49')]=_[_0xeaa4('0x47')](_0x5412f5[_0xeaa4('0x49')]);_0x9215ab[_0xeaa4('0x4f')]=_[_0xeaa4('0x58')](_0x9215ab[_0xeaa4('0x46')],_0x9215ab[_0xeaa4('0x49')]);_0x5a5c02[_0xeaa4('0x4a')]=_[_0xeaa4('0x58')](_0x9215ab[_0xeaa4('0x46')],qs[_0xeaa4('0x48')](_0x5412f5['query'][_0xeaa4('0x48')]));_0x5a5c02[_0xeaa4('0x4a')]=_0x5a5c02[_0xeaa4('0x4a')][_0xeaa4('0x59')]?_0x5a5c02[_0xeaa4('0x4a')]:_0x9215ab[_0xeaa4('0x46')];if(!_0x5412f5[_0xeaa4('0x49')][_0xeaa4('0x4b')](_0xeaa4('0x4c'))){_0x5a5c02['limit']=qs['limit'](_0x5412f5['query'][_0xeaa4('0x33')]);_0x5a5c02[_0xeaa4('0x31')]=qs[_0xeaa4('0x31')](_0x5412f5[_0xeaa4('0x49')][_0xeaa4('0x31')]);}_0x5a5c02[_0xeaa4('0x6b')]=qs[_0xeaa4('0x4d')](_0x5412f5['query'][_0xeaa4('0x4d')]);_0x5a5c02['where']=qs['filters'](_[_0xeaa4('0x50')](_0x5412f5['query'],_0x9215ab[_0xeaa4('0x4f')]));_0x5a5c02[_0xeaa4('0x4e')][_0xeaa4('0x67')]=_0x279718['id'];if(_0x5412f5[_0xeaa4('0x49')][_0xeaa4('0x51')]){_0x5a5c02[_0xeaa4('0x4e')]=_[_0xeaa4('0x52')](_0x5a5c02[_0xeaa4('0x4e')],{'$or':_[_0xeaa4('0x41')](_0x5a5c02[_0xeaa4('0x4a')],function(_0x5b99ee){var _0x4ded59={};_0x4ded59[_0x5b99ee]={'$like':'%'+_0x5412f5[_0xeaa4('0x49')][_0xeaa4('0x51')]+'%'};return _0x4ded59;})});}_0x5a5c02=_[_0xeaa4('0x52')]({},_0x5a5c02,_0x5412f5[_0xeaa4('0x53')]);return db[_0xeaa4('0x68')][_0xeaa4('0x34')]({'where':_0x5a5c02[_0xeaa4('0x4e')]})[_0xeaa4('0x22')](function(_0x5ad980){_0x230c85[_0xeaa4('0x34')]=_0x5ad980;if(_0x5412f5[_0xeaa4('0x49')][_0xeaa4('0x54')]){_0x5a5c02[_0xeaa4('0x55')]=[{'all':!![]}];}return db[_0xeaa4('0x68')][_0xeaa4('0x6c')](_0x5a5c02);})['then'](function(_0x27b0b7){_0x230c85[_0xeaa4('0x6d')]=_0x27b0b7;return _0x230c85;});}})[_0xeaa4('0x22')](respondWithFilteredResult(_0x4d7bc6,_0x5a5c02))[_0xeaa4('0x2d')](handleError(_0x4d7bc6,null));};exports[_0xeaa4('0x6e')]=function(_0x574808,_0x21c3d5,_0x1f6de1){return db['ChatWebsite']['find']({'where':{'id':_0x574808[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x21c3d5,null))[_0xeaa4('0x22')](function(_0x2e0dec){if(_0x2e0dec){return _0x2e0dec[_0xeaa4('0x6e')](_0x574808[_0xeaa4('0x49')]['ids']);}})[_0xeaa4('0x22')](respondWithStatusCode(_0x21c3d5,null))[_0xeaa4('0x2d')](handleError(_0x21c3d5,null));};exports['addAnswer']=function(_0x5715b6,_0x35c3d5,_0x202421){if(_0x5715b6[_0xeaa4('0x5c')]['id']){delete _0x5715b6[_0xeaa4('0x5c')]['id'];}return db[_0xeaa4('0x42')][_0xeaa4('0x5a')]({'where':{'id':_0x5715b6[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x35c3d5,null))[_0xeaa4('0x22')](function(_0x5d9072){if(_0x5d9072){_0x5715b6['body'][_0xeaa4('0x67')]=_0x5d9072['id'];return db['CannedAnswer'][_0xeaa4('0x5b')](_0x5715b6['body']);}})[_0xeaa4('0x22')](respondWithResult(_0x35c3d5,null))['catch'](handleError(_0x35c3d5,null));};exports[_0xeaa4('0x6f')]=function(_0x22d546,_0x37e07c,_0x2e1ce5){var _0x254cc3={'raw':![],'where':{}};var _0x2c24ca={};var _0x3eae4b={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xeaa4('0x6a')]({'where':{'id':_0x22d546[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x37e07c,null))[_0xeaa4('0x22')](function(_0x341ee2){if(_0x341ee2){_0x2c24ca['model']=_[_0xeaa4('0x47')](db[_0xeaa4('0x70')][_0xeaa4('0x43')]);_0x2c24ca[_0xeaa4('0x49')]=_[_0xeaa4('0x47')](_0x22d546['query']);_0x2c24ca[_0xeaa4('0x4f')]=_['intersection'](_0x2c24ca[_0xeaa4('0x46')],_0x2c24ca[_0xeaa4('0x49')]);_0x254cc3[_0xeaa4('0x4a')]=_['intersection'](_0x2c24ca['model'],qs[_0xeaa4('0x48')](_0x22d546[_0xeaa4('0x49')]['fields']));_0x254cc3['attributes']=_0x254cc3[_0xeaa4('0x4a')][_0xeaa4('0x59')]?_0x254cc3['attributes']:_0x2c24ca[_0xeaa4('0x46')];if(!_0x22d546[_0xeaa4('0x49')][_0xeaa4('0x4b')](_0xeaa4('0x4c'))){_0x254cc3['limit']=qs[_0xeaa4('0x33')](_0x22d546['query'][_0xeaa4('0x33')]);_0x254cc3[_0xeaa4('0x31')]=qs[_0xeaa4('0x31')](_0x22d546[_0xeaa4('0x49')][_0xeaa4('0x31')]);}_0x254cc3[_0xeaa4('0x6b')]=qs[_0xeaa4('0x4d')](_0x22d546[_0xeaa4('0x49')][_0xeaa4('0x4d')]);_0x254cc3[_0xeaa4('0x4e')]=qs[_0xeaa4('0x4f')](_[_0xeaa4('0x50')](_0x22d546[_0xeaa4('0x49')],_0x2c24ca[_0xeaa4('0x4f')]));_0x254cc3[_0xeaa4('0x4e')][_0xeaa4('0x67')]=_0x341ee2['id'];if(_0x22d546[_0xeaa4('0x49')][_0xeaa4('0x51')]){_0x254cc3[_0xeaa4('0x4e')]=_[_0xeaa4('0x52')](_0x254cc3[_0xeaa4('0x4e')],{'$or':_['map'](_0x254cc3['attributes'],function(_0x141c69){var _0x31b9c7={};_0x31b9c7[_0x141c69]={'$like':'%'+_0x22d546[_0xeaa4('0x49')][_0xeaa4('0x51')]+'%'};return _0x31b9c7;})});}_0x254cc3=_['merge']({},_0x254cc3,_0x22d546[_0xeaa4('0x53')]);return db[_0xeaa4('0x70')][_0xeaa4('0x34')]({'where':_0x254cc3[_0xeaa4('0x4e')]})[_0xeaa4('0x22')](function(_0x15154d){_0x3eae4b[_0xeaa4('0x34')]=_0x15154d;if(_0x22d546['query'][_0xeaa4('0x54')]){_0x254cc3[_0xeaa4('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xeaa4('0x6c')](_0x254cc3);})[_0xeaa4('0x22')](function(_0x2f9f70){_0x3eae4b[_0xeaa4('0x6d')]=_0x2f9f70;return _0x3eae4b;});}})['then'](respondWithFilteredResult(_0x37e07c,_0x254cc3))[_0xeaa4('0x2d')](handleError(_0x37e07c,null));};exports['removeAnswers']=function(_0x5db873,_0x450c72,_0x17d27b){return db['ChatWebsite'][_0xeaa4('0x5a')]({'where':{'id':_0x5db873[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x450c72,null))[_0xeaa4('0x22')](function(_0x11e79b){if(_0x11e79b){return _0x11e79b[_0xeaa4('0x71')](_0x5db873['query'][_0xeaa4('0x72')]);}})['then'](respondWithStatusCode(_0x450c72,null))[_0xeaa4('0x2d')](handleError(_0x450c72,null));};exports[_0xeaa4('0x73')]=function(_0x59cf38,_0x126f5d,_0x2937ae){_0x59cf38['body'][_0xeaa4('0x74')]=_0x59cf38[_0xeaa4('0x75')][_0xeaa4('0x76')];return db[_0xeaa4('0x42')][_0xeaa4('0x5a')]({'where':{'id':_0x59cf38['params']['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x126f5d,null))[_0xeaa4('0x22')](saveUpdates(_0x59cf38[_0xeaa4('0x5c')],null))[_0xeaa4('0x22')](respondWithResult(_0x126f5d,null))[_0xeaa4('0x2d')](handleError(_0x126f5d,null));};exports[_0xeaa4('0x77')]=function(_0x574802,_0x3fce29,_0x57d312){_0x574802[_0xeaa4('0x5c')][_0xeaa4('0x78')]=_0x574802[_0xeaa4('0x75')][_0xeaa4('0x76')];return db[_0xeaa4('0x42')][_0xeaa4('0x5a')]({'where':{'id':_0x574802[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x3fce29,null))['then'](saveUpdates(_0x574802['body'],null))['then'](respondWithResult(_0x3fce29,null))['catch'](handleError(_0x3fce29,null));};exports[_0xeaa4('0x79')]=function(_0x14391f,_0x59e64d,_0x323252){_0x14391f['body']['customerAvatar']=_0x14391f[_0xeaa4('0x75')][_0xeaa4('0x76')];return db[_0xeaa4('0x42')][_0xeaa4('0x5a')]({'where':{'id':_0x14391f[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x59e64d,null))[_0xeaa4('0x22')](saveUpdates(_0x14391f['body'],null))[_0xeaa4('0x22')](respondWithResult(_0x59e64d,null))[_0xeaa4('0x2d')](handleError(_0x59e64d,null));};exports[_0xeaa4('0x7a')]=function(_0x19e953,_0x104226,_0x47e1ed){_0x19e953[_0xeaa4('0x5c')][_0xeaa4('0x7b')]=_0x19e953[_0xeaa4('0x75')][_0xeaa4('0x76')];return db[_0xeaa4('0x42')][_0xeaa4('0x5a')]({'where':{'id':_0x19e953[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x104226,null))[_0xeaa4('0x22')](saveUpdates(_0x19e953[_0xeaa4('0x5c')],null))[_0xeaa4('0x22')](respondWithResult(_0x104226,null))[_0xeaa4('0x2d')](handleError(_0x104226,null));};exports[_0xeaa4('0x7c')]=function(_0x4ead93,_0x270438,_0x4f9e78){var _0x55c5cd=path['join'](config[_0xeaa4('0x7d')],'server/files/images/logos/default_logo.svg');var _0x3894ac={'where':{'id':_0x4ead93[_0xeaa4('0x57')]['id']},'attributes':['id',_0xeaa4('0x74')],'raw':!![]};var _0x9d59d=![];return require('../../config/license/util')[_0xeaa4('0x7e')]()[_0xeaa4('0x22')](function(_0x2ca59e){if(_0x2ca59e){_0x9d59d=_0x2ca59e[_0xeaa4('0x7f')];}})[_0xeaa4('0x22')](function(){return db[_0xeaa4('0x42')][_0xeaa4('0x5a')](_0x3894ac);})[_0xeaa4('0x22')](handleEntityNotFound(_0x270438,null))[_0xeaa4('0x22')](function(_0x57fc48){if(_0x57fc48){if(!_[_0xeaa4('0x80')](_0x57fc48[_0xeaa4('0x74')])){if(fs[_0xeaa4('0x81')](path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0x83'),_0x57fc48[_0xeaa4('0x74')]))&&_0x9d59d){_0x55c5cd=path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0x83'),_0x57fc48[_0xeaa4('0x74')]);}}return _0x270438[_0xeaa4('0x84')](_0x55c5cd);}})['catch'](handleError(_0x270438,null));};exports[_0xeaa4('0x85')]=function(_0x36fc75,_0x31d087,_0x2a764d){var _0x3fb361=path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],'server/files/images/avatars/default_avatar.png');var _0x51cc71={'where':{'id':_0x36fc75[_0xeaa4('0x57')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0xeaa4('0x5a')](_0x51cc71)['then'](handleEntityNotFound(_0x31d087,null))['then'](function(_0x3b27dd){if(_0x3b27dd){if(!_[_0xeaa4('0x80')](_0x3b27dd['agentAvatar'])){if(fs[_0xeaa4('0x81')](path['join'](config['root'],_0xeaa4('0x86'),_0x3b27dd[_0xeaa4('0x78')]))){_0x3fb361=path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0x86'),_0x3b27dd['agentAvatar']);}}return _0x31d087['download'](_0x3fb361);}})[_0xeaa4('0x2d')](handleError(_0x31d087,null));};exports[_0xeaa4('0x87')]=function(_0x28aff8,_0x59635b,_0x3ed897){var _0x2c299c=path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0x88'));var _0x4b8044={'where':{'id':_0x28aff8[_0xeaa4('0x57')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0xeaa4('0x5a')](_0x4b8044)['then'](handleEntityNotFound(_0x59635b,null))['then'](function(_0xedcbc7){if(_0xedcbc7){if(!_[_0xeaa4('0x80')](_0xedcbc7['customerAvatar'])){if(fs[_0xeaa4('0x81')](path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0x86'),_0xedcbc7[_0xeaa4('0x89')]))&&_0xedcbc7[_0xeaa4('0x8a')]){_0x2c299c=path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],'server/files/images/avatars/',_0xedcbc7[_0xeaa4('0x89')]);}}return _0x59635b['download'](_0x2c299c);}})['catch'](handleError(_0x59635b,null));};exports[_0xeaa4('0x8b')]=function(_0x5c7082,_0x4a7fa6,_0x1eb73d){var _0x242423=path[_0xeaa4('0x82')](config['root'],_0xeaa4('0x8c'));var _0x3198f6={'where':{'id':_0x5c7082[_0xeaa4('0x57')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xeaa4('0x42')][_0xeaa4('0x5a')](_0x3198f6)[_0xeaa4('0x22')](handleEntityNotFound(_0x4a7fa6,null))[_0xeaa4('0x22')](function(_0x1409b6){if(_0x1409b6){if(!_[_0xeaa4('0x80')](_0x1409b6[_0xeaa4('0x7b')])){if(fs[_0xeaa4('0x81')](path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0x86'),_0x1409b6['systemAvatar']))){_0x242423=path['join'](config[_0xeaa4('0x7d')],'server/files/images/avatars/',_0x1409b6[_0xeaa4('0x7b')]);}}return _0x4a7fa6[_0xeaa4('0x84')](_0x242423);}})['catch'](handleError(_0x4a7fa6,null));};exports[_0xeaa4('0x8d')]=function(_0x1fda69,_0x5304c5,_0xc337f1){var _0x4ca0cb=require(_0xeaa4('0x8e'));var _0x354fcf=new _0x4ca0cb();var _0x362fd1=_0x354fcf[_0xeaa4('0x8f')](_0x1fda69['headers'][_0xeaa4('0x90')])[_0xeaa4('0x91')]();var _0x446220={'body':_0x1fda69[_0xeaa4('0x5c')],'channel':_0xeaa4('0x92')};var _0x43843e=[];var _0x36a305=[];var _0x3c2989={};var _0x8a58b5=![];return db['CmContact']['describe']()['then'](function(_0x172af9){if(!_0x172af9){throw new db[(_0xeaa4('0x93'))][(_0xeaa4('0x94'))](_0xeaa4('0x95'));}_0x43843e=_[_0xeaa4('0x96')](_[_0xeaa4('0x47')](_0x172af9),[_0xeaa4('0x97'),'updatedAt']);_0x36a305=_[_0xeaa4('0x96')](_[_0xeaa4('0x47')](_0x172af9),[_0xeaa4('0x97'),_0xeaa4('0x98'),_0xeaa4('0x99'),_0xeaa4('0x9a')]);if(_0x1fda69[_0xeaa4('0x5c')]['id']){delete _0x1fda69[_0xeaa4('0x5c')]['id'];}if(_[_0xeaa4('0x80')](_0x1fda69['body'][_0xeaa4('0x9b')])){throw new db[(_0xeaa4('0x93'))][(_0xeaa4('0x94'))](_0xeaa4('0x9c'));}if(_[_0xeaa4('0x80')](_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0x5c')])||_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0x5c')]===''){throw new db[(_0xeaa4('0x93'))][(_0xeaa4('0x94'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0x9d')])){throw new db[(_0xeaa4('0x93'))][(_0xeaa4('0x94'))](_0xeaa4('0x9e')+_0x36a305);}if(!_[_0xeaa4('0x9f')](_0x36a305,_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0x9d')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x36a305);}_0x3c2989[_0x1fda69['body'][_0xeaa4('0x9d')]]=_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0x9b')];})[_0xeaa4('0x22')](function(){return db[_0xeaa4('0x42')][_0xeaa4('0x5a')]({'where':{'id':_0x1fda69[_0xeaa4('0x57')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xeaa4('0xa0')],'as':_0xeaa4('0xa1'),'where':_0x3c2989,'limit':0x1,'order':[['updatedAt',_0xeaa4('0xa2')]]}]},{'model':db[_0xeaa4('0xa3')],'as':_0xeaa4('0xa4')}]});})[_0xeaa4('0x22')](handleEntityNotFound(_0x5304c5,null))['then'](function(_0x1bbc02){if(_0x1bbc02&&_0x1bbc02[_0xeaa4('0xa5')]){_0x446220['account']=_0x1bbc02;_0x446220[_0xeaa4('0xa6')]=_0x1bbc02['Applications'];_0x446220[_0xeaa4('0xa7')]=_0x1bbc02[_0xeaa4('0xa5')];_0x446220['applications']=_[_0xeaa4('0xa8')](_0x446220[_0xeaa4('0xa6')],['priority'],[_0xeaa4('0xa9')]);if(_0x446220[_0xeaa4('0xaa')][_0xeaa4('0xa4')]){delete _0x446220[_0xeaa4('0xaa')]['Applications'];}if(_0x446220[_0xeaa4('0xaa')]['List']&&_0x446220[_0xeaa4('0xaa')][_0xeaa4('0xa5')]['Contacts'][_0xeaa4('0x59')]){return _0x446220[_0xeaa4('0xaa')][_0xeaa4('0xa5')][_0xeaa4('0xa1')][0x0];}var _0xefeddb=_['defaults'](_0x1fda69[_0xeaa4('0x5c')],{'firstName':_0x1fda69['body'][_0xeaa4('0x9b')],'ListId':_0x1bbc02[_0xeaa4('0x9a')]});_0xefeddb[_0x1fda69['body'][_0xeaa4('0x9d')]]=_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0x9b')];return db[_0xeaa4('0xa0')][_0xeaa4('0x5b')](_0xefeddb,{'fields':_0x43843e,'raw':!![]});}})[_0xeaa4('0x22')](handleEntityNotFound(_0x5304c5,null))[_0xeaa4('0x22')](function(_0x72933e){_0x446220[_0xeaa4('0xab')]=_0x72933e;var _0xf31f75=_0x1fda69[_0xeaa4('0x5c')]['customerIp'];if(_0x1fda69[_0xeaa4('0xac')][_0xeaa4('0xad')]){_0xf31f75=_0x1fda69['headers']['cf-connecting-ip'];}else if(_0x1fda69[_0xeaa4('0xac')]['x-forwarded-for']){_0xf31f75=_['first'](_0x1fda69[_0xeaa4('0xac')][_0xeaa4('0xae')][_0xeaa4('0xaf')](','));}if(_0x72933e){var _0x2f7089={'ContactId':_0x72933e['id'],'ChatWebsiteId':_0x1fda69[_0xeaa4('0x57')]['id'],'from':(_0x72933e[_0xeaa4('0xb0')]||'')+'\x20'+(_0x72933e[_0xeaa4('0xb1')]||''),'customerIp':_0xf31f75,'customerPort':_0x1fda69['headers'][_0xeaa4('0xb2')]?_0x1fda69['headers']['x-real-port']:null,'referer':_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0xb3')],'browserName':_0x362fd1[_0xeaa4('0xb4')][_0xeaa4('0x3c')]&&_0x362fd1[_0xeaa4('0xb4')]['version']?util[_0xeaa4('0xb5')](_0xeaa4('0xb6'),_0x362fd1['browser']['name'],_0x362fd1[_0xeaa4('0xb4')][_0xeaa4('0xb7')]):'unknown','browserVersion':_0x362fd1[_0xeaa4('0xb4')]['version']||'unknown','osName':util[_0xeaa4('0xb5')](_0xeaa4('0xb6'),_0x362fd1['os'][_0xeaa4('0x3c')],_0x362fd1['os'][_0xeaa4('0xb7')]),'osVersion':_0x362fd1['os'][_0xeaa4('0xb7')],'deviceModel':_0x362fd1[_0xeaa4('0xb8')][_0xeaa4('0x46')]&&_0x362fd1[_0xeaa4('0xb8')][_0xeaa4('0xb9')]?util[_0xeaa4('0xb5')](_0xeaa4('0xba'),_0x362fd1[_0xeaa4('0xb8')][_0xeaa4('0x46')],_0x362fd1[_0xeaa4('0xb8')][_0xeaa4('0xb9')],_0x362fd1['device'][_0xeaa4('0x45')]):null,'deviceVendor':_0x362fd1[_0xeaa4('0xb8')]['vendor'],'deviceType':_0x362fd1[_0xeaa4('0xb8')][_0xeaa4('0x45')],'formData':JSON[_0xeaa4('0x27')](_0x1fda69[_0xeaa4('0x5c')])};var _0x29323c={'ChatWebsiteId':_0x1fda69['params']['id'],'closed':![]};if(_0x1fda69['body'][_0xeaa4('0xbb')]){_0x29323c['threadId']=_0x1fda69[_0xeaa4('0x5c')]['threadId'];return db[_0xeaa4('0xbc')][_0xeaa4('0x5a')]({'where':_0x29323c})['then'](function(_0x21ca27){if(_0x21ca27){return[_0x21ca27,![]];}_0x2f7089[_0xeaa4('0xbb')]=_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0xbb')];_0x2f7089['externalUrl']=_0x1fda69['body'][_0xeaa4('0xbd')];return db['ChatInteraction'][_0xeaa4('0x5b')](_0x2f7089)['then'](function(_0x55e56a){return[_0x55e56a,!![]];});});}_0x29323c[_0xeaa4('0xbe')]=_0x72933e['id'];if(_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0xbf')]&&_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0xbf')]['id']){_0x29323c['id']=_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0xbf')]['id'];return db[_0xeaa4('0xbc')][_0xeaa4('0x5a')]({'where':_0x29323c})[_0xeaa4('0x22')](function(_0x93314a){if(_0x93314a){return[_0x93314a,![]];}return db[_0xeaa4('0xbc')][_0xeaa4('0x5b')](_0x2f7089)[_0xeaa4('0x22')](function(_0x22d097){return[_0x22d097,!![]];});});}return db[_0xeaa4('0xbc')]['create'](_0x2f7089)[_0xeaa4('0x22')](function(_0x3fe781){return[_0x3fe781,!![]];});}})['spread'](function(_0x46607f,_0x4f8b92){if(_0x46607f){_0x8a58b5=_0x4f8b92;if(!_0x4f8b92){var _0x157434={'from':(_0x446220['contact'][_0xeaa4('0xb0')]||'')+'\x20'+(_0x446220[_0xeaa4('0xab')][_0xeaa4('0xb1')]||'')};if(_0x1fda69['body'][_0xeaa4('0xbb')]&&_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0xc0')]&&_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0xbb')]!=_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0xc0')]){_0x157434[_0xeaa4('0xbb')]=_0x1fda69['body'][_0xeaa4('0xc0')];}return _0x46607f[_0xeaa4('0xc1')](_0x157434);}else{return _0x46607f;}}})['then'](function(_0x2a698e){_0x446220['interaction']=_0x2a698e['get']({'plain':!![]});_0x446220[_0xeaa4('0xbf')][_0xeaa4('0xc2')]=_0x8a58b5;if(_0x446220[_0xeaa4('0xbf')][_0xeaa4('0xc2')]){if(_0x446220['account'][_0xeaa4('0xc3')]){_0x446220[_0xeaa4('0xa6')]['push']({'id':0x0,'priority':_0x446220[_0xeaa4('0xa6')][_0xeaa4('0x59')]+0x1,'app':_0xeaa4('0xc4'),'appdata':_0xeaa4('0xc5'),'interval':'*,*,*,*'});}}return db['ChatMessage']['create']({'body':_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0x5c')],'ChatWebsiteId':_0x1fda69['params']['id'],'ChatInteractionId':_0x2a698e['id'],'direction':'in','ContactId':_0x446220[_0xeaa4('0xab')]['id'],'AttachmentId':_0x1fda69['body']['AttachmentId']});})[_0xeaa4('0x22')](function(_0x58a5b9){_0x446220[_0xeaa4('0x2a')]=_0x58a5b9;if(_0x446220[_0xeaa4('0xbf')]['UserId']){return db['User'][_0xeaa4('0x5a')]({'attributes':['id','name'],'where':{'id':_0x446220[_0xeaa4('0xbf')]['UserId']}})[_0xeaa4('0x22')](function(_0x1d8897){if(_0x1d8897){_0x446220[_0xeaa4('0xa6')][_0xeaa4('0xc6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1d8897[_0xeaa4('0x3c')]+','+(_0x446220[_0xeaa4('0xaa')][_0xeaa4('0xc7')]||0xa),'interval':_0xeaa4('0xc8')});_0x446220[_0xeaa4('0xc9')]=!![];}return respondWithRpcPromise(_0xeaa4('0xca'),_0xeaa4('0xcb'),_0x446220);});}return respondWithRpcPromise(_0xeaa4('0xca'),_0xeaa4('0xcb'),_0x446220);})[_0xeaa4('0x22')](function(_0x26a109){respondWithRpcPromise(_0xeaa4('0xcc'),'EventManager',{'event':_0xeaa4('0x8d'),'message':_0x26a109},client9002);return _0x26a109;})[_0xeaa4('0x22')](respondWithResult(_0x5304c5,null))[_0xeaa4('0x2d')](handleError(_0x5304c5,null));};exports[_0xeaa4('0xcd')]=function(_0x34ad76,_0x5d117b,_0x3718aa){var _0x39ce79,_0xb5f7d9,_0x1af742;var _0x2c34ba=[];var _0x7b9096=[];var _0x48b87e={};var _0x54790f=_0x34ad76[_0xeaa4('0xce')]||[];var _0xd668f3=[];var _0x4b8ace;return db['CmContact'][_0xeaa4('0x65')]()[_0xeaa4('0x22')](function(_0x456c2f){if(!_0x456c2f){throw new db[(_0xeaa4('0x93'))][(_0xeaa4('0x94'))](_0xeaa4('0x95'));}_0x7b9096=_[_0xeaa4('0x96')](_[_0xeaa4('0x47')](_0x456c2f),[_0xeaa4('0x97'),'updatedAt']);_0x2c34ba=_[_0xeaa4('0x96')](_[_0xeaa4('0x47')](_0x456c2f),[_0xeaa4('0x97'),'updatedAt','CompanyId',_0xeaa4('0x9a')]);if(_0x34ad76[_0xeaa4('0x5c')]['id']){delete _0x34ad76[_0xeaa4('0x5c')]['id'];}if(_[_0xeaa4('0x80')](_0x34ad76['body'][_0xeaa4('0x9b')])){throw _0x5d117b['status'](0x1f4)[_0xeaa4('0x3d')](new db[(_0xeaa4('0x93'))]['ValidationError'](_0xeaa4('0x9c')));}if(_[_0xeaa4('0x80')](_0x34ad76['body'][_0xeaa4('0x5c')])||_0x34ad76[_0xeaa4('0x5c')][_0xeaa4('0x5c')]===''){throw _0x5d117b[_0xeaa4('0x35')](0x1f4)[_0xeaa4('0x3d')](new db[(_0xeaa4('0x93'))]['ValidationError'](_0xeaa4('0xcf')));}if(_['isNil'](_0x34ad76[_0xeaa4('0x5c')][_0xeaa4('0xd0')])){throw _0x5d117b[_0xeaa4('0x35')](0x1f4)[_0xeaa4('0x3d')](new db[(_0xeaa4('0x93'))][(_0xeaa4('0x94'))](_0xeaa4('0xd1')+_0x2c34ba));}if(!_[_0xeaa4('0x9f')](_0x2c34ba,_0x34ad76[_0xeaa4('0x5c')][_0xeaa4('0xd0')])){throw _0x5d117b[_0xeaa4('0x35')](0x1f4)[_0xeaa4('0x3d')](new db['Sequelize'][(_0xeaa4('0x94'))](_0xeaa4('0xd2')+_0x2c34ba));}_0x48b87e[_0x34ad76[_0xeaa4('0x5c')]['mapKeyOffline']]=_0x34ad76[_0xeaa4('0x5c')][_0xeaa4('0x9b')];})[_0xeaa4('0x22')](function(){return db[_0xeaa4('0x42')][_0xeaa4('0x5a')]({'where':{'id':_0x34ad76['params']['id']},'include':[{'model':db[_0xeaa4('0xd3')],'as':_0xeaa4('0xa5')},{'model':db[_0xeaa4('0xd4')],'as':'MailAccount'}]});})[_0xeaa4('0x22')](handleEntityNotFound(_0x5d117b,null))[_0xeaa4('0x22')](function(_0x128946){if(_0x128946&&_0x128946['List']){_0xb5f7d9=_0x128946;var _0x307e0d=_[_0xeaa4('0x1b')](_0x34ad76[_0xeaa4('0x5c')],{'firstName':_0x34ad76[_0xeaa4('0x5c')][_0xeaa4('0x9b')],'phone':_0x34ad76[_0xeaa4('0x5c')][_0xeaa4('0x9b')],'ListId':_0x128946[_0xeaa4('0x9a')]});_0x307e0d[_0x34ad76['body'][_0xeaa4('0xd0')]]=_0x34ad76['body'][_0xeaa4('0x9b')];return db[_0xeaa4('0xa0')][_0xeaa4('0xd5')]({'where':_0x48b87e,'defaults':_0x307e0d});}})[_0xeaa4('0xd6')](function(_0xb3e7c0){if(_0xb3e7c0){_0x1af742=_0xb3e7c0;var _0x5bacea=fs[_0xeaa4('0xd7')](path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0xd8')),_0xeaa4('0xd9'));var _0x113d3c=ejs[_0xeaa4('0xda')](_0x5bacea,{'body':_[_0xeaa4('0xdb')](_0x34ad76['body']['body']),'bodyTitle':_0xb5f7d9[_0xeaa4('0xdc')]});return db[_0xeaa4('0xdd')][_0xeaa4('0x5b')]({'body':_0x113d3c,'ContactId':_0xb3e7c0['id'],'ChatWebsiteId':_0xb5f7d9['id']});}})[_0xeaa4('0x22')](function(_0x4e16b1){_0x4b8ace=_0x4e16b1;if(_0x54790f[_0xeaa4('0x59')]){var _0x9ccc81=_0x54790f[_0xeaa4('0x41')](function(_0x5adb83){return{'name':_0x5adb83[_0xeaa4('0xde')],'basename':_0x5adb83[_0xeaa4('0x76')],'type':_0x5adb83[_0xeaa4('0xdf')],'ChatOfflineMessageId':_0x4e16b1['id']};});_0xd668f3=_0x9ccc81[_0xeaa4('0x41')](_0x37f4c2=>{var _0x8727c3={'filename':_0x37f4c2[_0xeaa4('0x3c')],'path':path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0xe0'),_0xeaa4('0xce'),_0xeaa4('0xe1'),_0xeaa4('0xe2'),_0x37f4c2[_0xeaa4('0xe3')])};return _0x8727c3;});if(!_0xb5f7d9[_0xeaa4('0xe4')]){return db[_0xeaa4('0xe5')]['transaction'](function(_0x49fe70){return db[_0xeaa4('0xe6')][_0xeaa4('0xe7')](_0x9ccc81,{'transaction':_0x49fe70});});}}})[_0xeaa4('0x22')](function(){if(_0x4b8ace){_0x39ce79=_0x4b8ace;return db[_0xeaa4('0xd4')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0xeaa4('0xe8')],'as':'Smtp','raw':!![]}]});}})[_0xeaa4('0x22')](function(_0x31d667){if(_0x31d667&&_0x31d667[_0xeaa4('0xe9')]&&_0xb5f7d9[_0xeaa4('0xea')]&&_0xb5f7d9[_0xeaa4('0xeb')]){var _0x133e08={'tls':{'rejectUnauthorized':![]}};if(_0x31d667['Smtp'][_0xeaa4('0xec')]){_0x133e08['service']=_0x31d667[_0xeaa4('0xe9')][_0xeaa4('0xec')];}else{_0x133e08[_0xeaa4('0xed')]=_0x31d667['Smtp']['host'];_0x133e08[_0xeaa4('0xee')]=_0x31d667[_0xeaa4('0xe9')][_0xeaa4('0xee')];_0x133e08['secure']=_0x31d667[_0xeaa4('0xe9')][_0xeaa4('0xef')];}if(_0x31d667[_0xeaa4('0xe9')][_0xeaa4('0xf0')]){_0x133e08[_0xeaa4('0xf1')]={'user':_0x31d667['Smtp']['user'],'pass':_0x31d667[_0xeaa4('0xe9')][_0xeaa4('0xf2')]};}return respondWithRpcPromise('SendMail',_0xeaa4('0xf3'),{'account':_0x133e08,'message':{'from':util['format'](_0xeaa4('0xf4'),_0x31d667[_0xeaa4('0x3c')],_0x31d667['email']||_0x31d667[_0xeaa4('0xe9')][_0xeaa4('0x5d')]),'to':_0xb5f7d9[_0xeaa4('0xeb')],'subject':_0xb5f7d9['offlineMessageSubject'],'html':_0x39ce79['body'],'attachments':_0xd668f3}},client9003)['then'](function(){return _0x39ce79;})['catch'](function(_0x5fa51f){console[_0xeaa4('0x28')](_0x5fa51f);});}})[_0xeaa4('0x22')](function(){if(_0xb5f7d9&&_0xb5f7d9['openNewInteraction']&&_0xb5f7d9['MailAccountId']){var _0x539217=[];if(_0x54790f['length']){_0x539217=_0x54790f[_0xeaa4('0x41')](function(_0x5e6d85){return{'name':_0x5e6d85[_0xeaa4('0xde')],'basename':_0x5e6d85[_0xeaa4('0x76')],'type':_0x5e6d85[_0xeaa4('0xdf')],'ChatOfflineMessageId':_0x4b8ace['id']};});}var _0x2f0b8d;if(!_[_0xeaa4('0x80')](_0xb5f7d9[_0xeaa4('0xf5')])){var _0x42983a=_[_0xeaa4('0x41')](_0x34ad76['body'],function(_0x3c7de9){return _0x3c7de9;});var _0x1b4467=_[_0xeaa4('0xf6')](_0x42983a)[0x0];var _0x49cad9=_[_0xeaa4('0xf7')](_0x1b4467,function(_0xc97a66){return _0xc97a66;});_0x2f0b8d=_0x49cad9[0x1][_0xb5f7d9[_0xeaa4('0xf5')]];}var _0x2497e4={'from':_0x1af742[_0xeaa4('0xf8')],'firstName':_0x1af742[_0xeaa4('0xb0')],'lastName':_0x1af742[_0xeaa4('0xb1')],'mapKey':_0xeaa4('0xf8'),'message':{'from':_0x1af742['email'],'to':_0xb5f7d9['MailAccount']['email'],'cc':'','subject':_[_0xeaa4('0x80')](_0x2f0b8d)?_0xb5f7d9[_0xeaa4('0xf9')]:_0x2f0b8d,'messageId':'','sentAt':new Date(),'attach':_0x539217[_0xeaa4('0x59')],'attachments':_0x539217,'originChannel':_0xeaa4('0xfa'),'ChatWebsiteId':_0xb5f7d9['id'],'ChatOfflineMessageId':_0x39ce79['id'],'originTo':_0xb5f7d9[_0xeaa4('0xd4')][_0xeaa4('0xf8')]},'body':_0x39ce79['body']};var _0x313324={'account':{'id':_0xb5f7d9[_0xeaa4('0xfb')]},'body':_0x2497e4,'log':_0xeaa4('0xfc')};return respondWithRpcPromise(_0xeaa4('0xfc'),_0xeaa4('0xfd'),_0x313324,client9001)[_0xeaa4('0x22')](function(){return _0x39ce79;})['catch'](function(_0x3fa00e){console[_0xeaa4('0x28')](_0x3fa00e);});}return;})[_0xeaa4('0x22')](function(){if(_0x39ce79){return _0x39ce79;}})[_0xeaa4('0x22')](respondWithResult(_0x5d117b,null))[_0xeaa4('0x2d')](function(_0x176bca){console[_0xeaa4('0x28')](_0xeaa4('0x2d'),_0x176bca);for(var _0x3b2d83 of _0x54790f){var _0xbea88b=path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],'server','files',_0xeaa4('0xe1'),'offline-chat',_0x3b2d83[_0xeaa4('0x76')]);fs_extra[_0xeaa4('0xfe')](_0xbea88b)[_0xeaa4('0x2d')](function(_0x1e082f){console['error'](_0xeaa4('0xff'),_0xbea88b,_0x1e082f);});}});};exports['addInteraction']=function(_0x544849,_0x2a4fd8,_0x27f863){return db[_0xeaa4('0xbc')]['find']({'where':{'id':_0x544849[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x2a4fd8,null))[_0xeaa4('0x22')](function(_0x4aa37b){if(_0x4aa37b){return _0x4aa37b['addInteraction'](_0x544849[_0xeaa4('0x5c')]['ids'],_['omit'](_0x544849['body'],[_0xeaa4('0x72'),'id'])||{});}})[_0xeaa4('0x22')](respondWithResult(_0x2a4fd8,null))[_0xeaa4('0x2d')](handleError(_0x2a4fd8,null));};exports['getInteractions']=function(_0x4da05f,_0x529acb,_0x4ccb70){var _0x15b55b={'raw':![],'where':{}};var _0x1bdebb={};var _0x28ad1d={'count':0x0,'rows':[]};return db[_0xeaa4('0x42')][_0xeaa4('0x6a')]({'where':{'id':_0x4da05f[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x529acb,null))[_0xeaa4('0x22')](function(_0x1b072e){if(_0x1b072e){_0x1bdebb[_0xeaa4('0x46')]=_[_0xeaa4('0x47')](db[_0xeaa4('0xbc')][_0xeaa4('0x43')]);_0x1bdebb[_0xeaa4('0x49')]=_[_0xeaa4('0x47')](_0x4da05f[_0xeaa4('0x49')]);_0x1bdebb[_0xeaa4('0x4f')]=_[_0xeaa4('0x58')](_0x1bdebb[_0xeaa4('0x46')],_0x1bdebb[_0xeaa4('0x49')]);_0x15b55b['attributes']=_[_0xeaa4('0x58')](_0x1bdebb[_0xeaa4('0x46')],qs[_0xeaa4('0x48')](_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x48')]));_0x15b55b[_0xeaa4('0x4a')]=_0x15b55b[_0xeaa4('0x4a')]['length']?_0x15b55b[_0xeaa4('0x4a')]:_0x1bdebb['model'];if(!_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x4b')](_0xeaa4('0x4c'))){_0x15b55b['limit']=qs[_0xeaa4('0x33')](_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x33')]);_0x15b55b[_0xeaa4('0x31')]=qs[_0xeaa4('0x31')](_0x4da05f[_0xeaa4('0x49')]['offset']);}_0x15b55b['order']=qs[_0xeaa4('0x4d')](_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x4d')]);_0x15b55b[_0xeaa4('0x4e')]=qs[_0xeaa4('0x4f')](_[_0xeaa4('0x50')](_0x4da05f[_0xeaa4('0x49')],_0x1bdebb[_0xeaa4('0x4f')]));_0x15b55b['where'][_0xeaa4('0x67')]=_0x1b072e['id'];if(_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x51')]){_0x15b55b['where']=_[_0xeaa4('0x52')](_0x15b55b[_0xeaa4('0x4e')],{'$or':_[_0xeaa4('0x41')](_0x15b55b[_0xeaa4('0x4a')],function(_0xfce8f0){var _0x205044={};_0x205044[_0xfce8f0]={'$like':'%'+_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x51')]+'%'};return _0x205044;})});}_0x15b55b=_[_0xeaa4('0x52')]({},_0x15b55b,_0x4da05f[_0xeaa4('0x53')]);return db[_0xeaa4('0xbc')][_0xeaa4('0x34')]({'where':_0x15b55b[_0xeaa4('0x4e')]})[_0xeaa4('0x22')](function(_0x2ec23a){_0x28ad1d['count']=_0x2ec23a;if(_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x54')]){_0x15b55b['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xeaa4('0x100')],'as':_0xeaa4('0x101'),'attributes':[_0xeaa4('0x3c'),_0xeaa4('0x102'),_0xeaa4('0x103')],'required':![]},{'model':db[_0xeaa4('0x104')],'as':_0xeaa4('0x105'),'attributes':['id',_0xeaa4('0x3c'),_0xeaa4('0x106')],'where':_0x4da05f[_0xeaa4('0x49')]['tag']?{'id':_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x107')]}:undefined,'required':_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x107')]?!![]:![]}];}return db[_0xeaa4('0xbc')][_0xeaa4('0x6c')](_0x15b55b);})[_0xeaa4('0x22')](function(_0x1c0491){_0x28ad1d[_0xeaa4('0x6d')]=_0x1c0491;return _0x28ad1d;});}})['then'](respondWithFilteredResult(_0x529acb,_0x15b55b))[_0xeaa4('0x2d')](handleError(_0x529acb,null));};function iftimePromise(_0x1b1084,_0x54826e){return respondWithRpcPromise(_0xeaa4('0x108'),_0xeaa4('0x109'),{'command':_0x54826e[_0xeaa4('0x10a')]?util[_0xeaa4('0xb5')](_0xeaa4('0x10b'),_0x1b1084[_0xeaa4('0x10c')],_0x54826e[_0xeaa4('0x10a')]):util['format'](_0xeaa4('0x10d'),_0x1b1084[_0xeaa4('0x10c')])},client9002)['then'](function(_0x249aa0){var _0x34ef99=_0x249aa0&&_0x249aa0[_0xeaa4('0x10e')](_0xeaa4('0x10f'))>=0x0?!![]:![];logger[_0xeaa4('0x23')](_0xeaa4('0x110'),_0x54826e['id'],_0x1b1084['id'],_0x1b1084[_0xeaa4('0x10c')],_0x34ef99?_0xeaa4('0x111'):'OFFLINE',_0x54826e[_0xeaa4('0x10a')]?_0x54826e['timezone']:_0xeaa4('0x112'));return _0x34ef99;})['catch'](function(_0x376cfd){logger['error'](_0xeaa4('0x110'),_0x54826e['id'],_0x1b1084['id'],_0x1b1084[_0xeaa4('0x10c')],util['inspect'](_0x376cfd,{'showHidden':![],'depth':null}),_0x54826e[_0xeaa4('0x10a')]?_0x54826e[_0xeaa4('0x10a')]:_0xeaa4('0x112'));return![];});}exports['getSnippet']=function(_0x4b1235,_0x12de96,_0x374ba4){var _0x34a262=0x0;var _0x3828cb=0x0;var _0x59ae26=![];var _0x5d6591;var _0x57394a;return db['ChatWebsite']['find']({'where':{'id':_0x4b1235[_0xeaa4('0x57')]['id']},'include':[{'model':db[_0xeaa4('0x113')],'as':_0xeaa4('0x113'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x12de96,null))[_0xeaa4('0x22')](function(_0x5af336){if(_0x5af336){_0x5d6591=_0x5af336;return _0x5af336[_0xeaa4('0x114')]({'raw':!![]});}})[_0xeaa4('0x22')](function(_0x48e7fd){if(_0x5d6591){if(_0x48e7fd){_0x57394a=_0x48e7fd;}}return require('../../config/license/util')[_0xeaa4('0x7e')]();})[_0xeaa4('0x22')](function(_0xdea6a8){if(_0xdea6a8){_0x3828cb=_0xdea6a8[_0xeaa4('0x115')];_0x59ae26=_0xdea6a8[_0xeaa4('0x7f')];}})[_0xeaa4('0x22')](function(){return db[_0xeaa4('0xbc')][_0xeaa4('0x34')]({'where':{'closed':![]}});})['then'](function(_0x26f1b5){_0x34a262=_0x26f1b5;if(_0x3828cb&&_0x26f1b5>_0x3828cb){return db[_0xeaa4('0x116')]['findOne']({'where':{'id':0x1}})['then'](function(_0x15e23a){if(_0x15e23a){_0x15e23a[_0xeaa4('0x117')](_0xeaa4('0x118'));}});}})[_0xeaa4('0x22')](function(){if(_0x5d6591[_0xeaa4('0x113')]&&_0x5d6591['Interval']['Intervals']){var _0x20c38d=[];for(var _0x596879=0x0;_0x596879<_0x5d6591[_0xeaa4('0x113')][_0xeaa4('0x119')]['length'];_0x596879++){var _0x1af6ad=_0x5d6591[_0xeaa4('0x113')][_0xeaa4('0x119')][_0x596879]['get']({'plain':!![]});_0x20c38d['push'](iftimePromise(_0x1af6ad,_0x5d6591));}return BPromise[_0xeaa4('0x11a')](_0x20c38d)['then'](function(_0xab04e4){return _[_0xeaa4('0x11b')](_0xab04e4);});}else{return!![];}})[_0xeaa4('0x22')](function(_0x1d7d36){var _0x9bca5a=fs[_0xeaa4('0xd7')](path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0x11c')),_0xeaa4('0xd9'));var _0x52883c={'remote':_0x5d6591[_0xeaa4('0x11d')],'query':querystring['stringify'](_['merge'](_0x5d6591['get']({'plain':!![]}),{'customerIp':_0x4b1235[_0xeaa4('0xac')]['x-forwarded-for']||_0x4b1235['headers'][_0xeaa4('0x11e')]||_0x4b1235[_0xeaa4('0x11f')][_0xeaa4('0x120')]||_0x4b1235['ip'],'referer':_0x4b1235[_0xeaa4('0xac')]['referer'],'openedInteractions':_0x34a262,'maxInteractions':_0x3828cb,'virtual':_0x59ae26[_0xeaa4('0x115')],'online':_0x1d7d36,'custom':_0x59ae26}))[_0xeaa4('0x121')](/'/g,'\x5c\x27')};_0x12de96[_0xeaa4('0x3d')](ejs[_0xeaa4('0xda')](Mustache[_0xeaa4('0xda')](_0x9bca5a,_0x52883c),{'proactiveActions':_0x57394a,'alignment':_0x5d6591[_0xeaa4('0x122')],'verticalAlignment':_0x5d6591[_0xeaa4('0x123')],'div_color':_0x5d6591[_0xeaa4('0x106')],'text_color':_0x5d6591['textColor'],'button_color':_0x5d6591[_0xeaa4('0x124')],'background_color':_0x5d6591[_0xeaa4('0x125')]}));})[_0xeaa4('0x2d')](handleError(_0x12de96,null));};exports[_0xeaa4('0x126')]=function(_0x34506b,_0x18ee59,_0x4f0e96){return db[_0xeaa4('0x42')]['findOne']({'where':{'id':_0x34506b[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x18ee59,null))[_0xeaa4('0x22')](function(_0x57f22b){if(_0x57f22b){return db[_0xeaa4('0xe5')][_0xeaa4('0x127')](function(_0x5ab3d0){return db[_0xeaa4('0xa3')][_0xeaa4('0x64')]({'where':{'ChatWebsiteId':_0x34506b['params']['id']},'transaction':_0x5ab3d0})[_0xeaa4('0x22')](function(_0x4fcf01){var _0x5ee671=_[_0xeaa4('0x41')](_0x34506b[_0xeaa4('0x5c')],function(_0x389350){_0x389350[_0xeaa4('0x67')]=_0x34506b['params']['id'];return _0x389350;});return db['ChatApplication'][_0xeaa4('0xe7')](_0x5ee671,{'transaction':_0x5ab3d0});});})[_0xeaa4('0x22')](function(){return db['ChatApplication'][_0xeaa4('0x128')]({'where':{'ChatWebsiteId':_0x34506b[_0xeaa4('0x57')]['id']},'order':_0xeaa4('0x129')});});}})[_0xeaa4('0x22')](respondWithResult(_0x18ee59,null))['catch'](handleError(_0x18ee59,null));};exports['getApplications']=function(_0xff7f5d,_0xec94b3,_0x57be24){var _0x179a05={};var _0x449825={};var _0x5446a7;var _0xb816d5;return db[_0xeaa4('0x42')][_0xeaa4('0x6a')]({'where':{'id':_0xff7f5d[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0xec94b3,null))['then'](function(_0x7d3698){if(_0x7d3698){_0x5446a7=_0x7d3698;_0x449825[_0xeaa4('0x46')]=_[_0xeaa4('0x47')](db['ChatApplication'][_0xeaa4('0x43')]);_0x449825['query']=_[_0xeaa4('0x47')](_0xff7f5d[_0xeaa4('0x49')]);_0x449825[_0xeaa4('0x4f')]=_[_0xeaa4('0x58')](_0x449825[_0xeaa4('0x46')],_0x449825[_0xeaa4('0x49')]);_0x179a05[_0xeaa4('0x4a')]=_[_0xeaa4('0x58')](_0x449825[_0xeaa4('0x46')],qs['fields'](_0xff7f5d[_0xeaa4('0x49')][_0xeaa4('0x48')]));_0x179a05[_0xeaa4('0x4a')]=_0x179a05['attributes'][_0xeaa4('0x59')]?_0x179a05[_0xeaa4('0x4a')]:_0x449825[_0xeaa4('0x46')];_0x179a05[_0xeaa4('0x6b')]=qs[_0xeaa4('0x4d')](_0xff7f5d[_0xeaa4('0x49')][_0xeaa4('0x4d')]);_0x179a05[_0xeaa4('0x4e')]=qs['filters'](_['pick'](_0xff7f5d[_0xeaa4('0x49')],_0x449825['filters']));if(_0xff7f5d[_0xeaa4('0x49')][_0xeaa4('0x51')]){_0x179a05[_0xeaa4('0x4e')]=_[_0xeaa4('0x52')](_0x179a05[_0xeaa4('0x4e')],{'$or':_[_0xeaa4('0x41')](_0x179a05[_0xeaa4('0x4a')],function(_0x494362){var _0x22c2b6={};_0x22c2b6[_0x494362]={'$like':'%'+_0xff7f5d[_0xeaa4('0x49')]['filter']+'%'};return _0x22c2b6;})});}_0x179a05=_[_0xeaa4('0x52')]({},_0x179a05,_0xff7f5d[_0xeaa4('0x53')]);return _0x5446a7[_0xeaa4('0x12a')](_0x179a05);}})[_0xeaa4('0x22')](function(_0x10a648){if(_0x10a648){_0xb816d5=_0x10a648[_0xeaa4('0x59')];if(!_0xff7f5d[_0xeaa4('0x49')]['hasOwnProperty'](_0xeaa4('0x4c'))){_0x179a05[_0xeaa4('0x33')]=qs[_0xeaa4('0x33')](_0xff7f5d[_0xeaa4('0x49')][_0xeaa4('0x33')]);_0x179a05[_0xeaa4('0x31')]=qs['offset'](_0xff7f5d[_0xeaa4('0x49')][_0xeaa4('0x31')]);}return _0x5446a7[_0xeaa4('0x12a')](_0x179a05);}})[_0xeaa4('0x22')](function(_0x33765e){if(_0x33765e){return _0x33765e?{'count':_0xb816d5,'rows':_0x33765e}:null;}})[_0xeaa4('0x22')](respondWithResult(_0xec94b3,null))[_0xeaa4('0x2d')](handleError(_0xec94b3,null));};exports[_0xeaa4('0x12b')]=function(_0x2bf917,_0x5ee026,_0x49c247){return db[_0xeaa4('0x12c')]['find']({'where':{'id':_0x2bf917[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x5ee026,null))['then'](function(_0x507735){if(_0x507735){return _0x507735[_0xeaa4('0x12b')](_0x2bf917[_0xeaa4('0x5c')][_0xeaa4('0x72')],_['omit'](_0x2bf917[_0xeaa4('0x5c')],[_0xeaa4('0x72'),'id'])||{});}})['then'](respondWithResult(_0x5ee026,null))[_0xeaa4('0x2d')](handleError(_0x5ee026,null));};exports[_0xeaa4('0x114')]=function(_0x1381bc,_0x10bb6d,_0x524d0d){var _0x2a2dcd={};var _0x36a382={};var _0x5bbb0a;var _0x17cc2f;return db[_0xeaa4('0x42')][_0xeaa4('0x6a')]({'where':{'id':_0x1381bc[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x10bb6d,null))[_0xeaa4('0x22')](function(_0x3405d6){if(_0x3405d6){_0x5bbb0a=_0x3405d6;_0x36a382[_0xeaa4('0x46')]=_['keys'](db[_0xeaa4('0x12d')][_0xeaa4('0x43')]);_0x36a382[_0xeaa4('0x49')]=_[_0xeaa4('0x47')](_0x1381bc[_0xeaa4('0x49')]);_0x36a382[_0xeaa4('0x4f')]=_['intersection'](_0x36a382[_0xeaa4('0x46')],_0x36a382[_0xeaa4('0x49')]);_0x2a2dcd[_0xeaa4('0x4a')]=_[_0xeaa4('0x58')](_0x36a382['model'],qs['fields'](_0x1381bc['query'][_0xeaa4('0x48')]));_0x2a2dcd[_0xeaa4('0x4a')]=_0x2a2dcd[_0xeaa4('0x4a')][_0xeaa4('0x59')]?_0x2a2dcd[_0xeaa4('0x4a')]:_0x36a382['model'];_0x2a2dcd[_0xeaa4('0x6b')]=qs['sort'](_0x1381bc[_0xeaa4('0x49')]['sort']);_0x2a2dcd[_0xeaa4('0x4e')]=qs[_0xeaa4('0x4f')](_[_0xeaa4('0x50')](_0x1381bc[_0xeaa4('0x49')],_0x36a382[_0xeaa4('0x4f')]));if(_0x1381bc['query']['filter']){_0x2a2dcd[_0xeaa4('0x4e')]=_[_0xeaa4('0x52')](_0x2a2dcd[_0xeaa4('0x4e')],{'$or':_[_0xeaa4('0x41')](_0x2a2dcd['attributes'],function(_0x51a3ad){var _0x5e47c2={};_0x5e47c2[_0x51a3ad]={'$like':'%'+_0x1381bc[_0xeaa4('0x49')][_0xeaa4('0x51')]+'%'};return _0x5e47c2;})});}_0x2a2dcd=_['merge']({},_0x2a2dcd,_0x1381bc[_0xeaa4('0x53')]);return _0x5bbb0a[_0xeaa4('0x114')](_0x2a2dcd);}})[_0xeaa4('0x22')](function(_0x27feaa){if(_0x27feaa){_0x17cc2f=_0x27feaa[_0xeaa4('0x59')];if(!_0x1381bc['query'][_0xeaa4('0x4b')](_0xeaa4('0x4c'))){_0x2a2dcd[_0xeaa4('0x33')]=qs[_0xeaa4('0x33')](_0x1381bc[_0xeaa4('0x49')][_0xeaa4('0x33')]);_0x2a2dcd[_0xeaa4('0x31')]=qs[_0xeaa4('0x31')](_0x1381bc[_0xeaa4('0x49')][_0xeaa4('0x31')]);}return _0x5bbb0a[_0xeaa4('0x114')](_0x2a2dcd);}})[_0xeaa4('0x22')](function(_0x5145e5){if(_0x5145e5){return _0x5145e5?{'count':_0x17cc2f,'rows':_0x5145e5}:null;}})[_0xeaa4('0x22')](respondWithResult(_0x10bb6d,null))[_0xeaa4('0x2d')](handleError(_0x10bb6d,null));};exports[_0xeaa4('0x12e')]=function(_0x3d3c64,_0x269966,_0xc63d2d){var _0x2c440d=_0x3d3c64['query']['online']==='false'?_0xeaa4('0x12f'):'onlineForm';return db['ChatWebsite'][_0xeaa4('0x5a')]({'attributes':['id',_0x2c440d],'where':{'id':_0x3d3c64[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x269966,null))[_0xeaa4('0x22')](function(_0x768e38){if(_0x768e38){var _0x4f0de1=_0x768e38[_0x2c440d];var _0x589490=_0x4f0de1&&_0x4f0de1[_0xeaa4('0x130')]?_0x4f0de1[_0xeaa4('0x130')]:[];_0x269966[_0xeaa4('0x3d')]({'fromKey':_[_0xeaa4('0x80')](_0x4f0de1[_0xeaa4('0x131')])?undefined:_0x4f0de1[_0xeaa4('0x131')],'count':_0x589490[_0xeaa4('0x59')],'rows':_0x589490});}})['catch'](handleError(_0x269966,null));};exports[_0xeaa4('0x132')]=function(_0x527768,_0xf54bcd,_0x429170){var _0x4bec96={'raw':![],'where':{}};var _0x282b35={};var _0x3bc0c9={'count':0x0,'rows':[]};return db[_0xeaa4('0x42')][_0xeaa4('0x6a')]({'where':{'id':_0x527768[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0xf54bcd,null))[_0xeaa4('0x22')](function(_0x5b539a){if(_0x5b539a){_0x282b35[_0xeaa4('0x46')]=_[_0xeaa4('0x47')](db[_0xeaa4('0xdd')]['rawAttributes']);_0x282b35[_0xeaa4('0x49')]=_[_0xeaa4('0x47')](_0x527768['query']);_0x282b35[_0xeaa4('0x4f')]=_[_0xeaa4('0x58')](_0x282b35[_0xeaa4('0x46')],_0x282b35['query']);_0x4bec96[_0xeaa4('0x4a')]=_['intersection'](_0x282b35[_0xeaa4('0x46')],qs[_0xeaa4('0x48')](_0x527768[_0xeaa4('0x49')][_0xeaa4('0x48')]));_0x4bec96[_0xeaa4('0x4a')]=_0x4bec96[_0xeaa4('0x4a')][_0xeaa4('0x59')]?_0x4bec96[_0xeaa4('0x4a')]:_0x282b35[_0xeaa4('0x46')];if(!_0x527768[_0xeaa4('0x49')][_0xeaa4('0x4b')](_0xeaa4('0x4c'))){_0x4bec96[_0xeaa4('0x33')]=qs[_0xeaa4('0x33')](_0x527768[_0xeaa4('0x49')][_0xeaa4('0x33')]);_0x4bec96[_0xeaa4('0x31')]=qs[_0xeaa4('0x31')](_0x527768['query'][_0xeaa4('0x31')]);}_0x4bec96[_0xeaa4('0x6b')]=qs[_0xeaa4('0x4d')](_0x527768[_0xeaa4('0x49')][_0xeaa4('0x4d')]);_0x4bec96[_0xeaa4('0x4e')]=qs['filters'](_[_0xeaa4('0x50')](_0x527768[_0xeaa4('0x49')],_0x282b35[_0xeaa4('0x4f')]));_0x4bec96[_0xeaa4('0x4e')][_0xeaa4('0x67')]=_0x5b539a['id'];if(_0x527768[_0xeaa4('0x49')]['filter']){_0x4bec96['where']=_[_0xeaa4('0x52')](_0x4bec96[_0xeaa4('0x4e')],{'$or':_['map'](_0x4bec96[_0xeaa4('0x4a')],function(_0x39aae9){var _0x9dd339={};_0x9dd339[_0x39aae9]={'$like':'%'+_0x527768['query']['filter']+'%'};return _0x9dd339;})});}_0x4bec96=_[_0xeaa4('0x52')]({},_0x4bec96,_0x527768[_0xeaa4('0x53')]);return db[_0xeaa4('0xdd')][_0xeaa4('0x34')]({'where':_0x4bec96[_0xeaa4('0x4e')]})[_0xeaa4('0x22')](function(_0x752e01){_0x3bc0c9['count']=_0x752e01;if(_0x527768[_0xeaa4('0x49')][_0xeaa4('0x54')]){_0x4bec96[_0xeaa4('0x55')]=[{'all':!![]}];}else{_0x4bec96[_0xeaa4('0x55')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage'][_0xeaa4('0x6c')](_0x4bec96);})[_0xeaa4('0x22')](function(_0x22d723){_0x3bc0c9[_0xeaa4('0x6d')]=_0x22d723;return _0x3bc0c9;});}})[_0xeaa4('0x22')](respondWithFilteredResult(_0xf54bcd,_0x4bec96))[_0xeaa4('0x2d')](handleError(_0xf54bcd,null));};exports[_0xeaa4('0x133')]=function(_0x129213,_0x28005e,_0x24d313){return db['ChatWebsite'][_0xeaa4('0x5a')]({'where':{'id':_0x129213['params']['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x28005e,null))[_0xeaa4('0x22')](function(_0x46df61){if(_0x46df61){return _0x46df61[_0xeaa4('0x133')](_0x129213['body']['ids'],_[_0xeaa4('0x134')](_0x129213['body'],[_0xeaa4('0x72'),'id'])||{})[_0xeaa4('0xd6')](function(_0x355e71){for(var _0x1a0818=0x0;_0x1a0818<_0x129213[_0xeaa4('0x5c')][_0xeaa4('0x72')][_0xeaa4('0x59')];_0x1a0818+=0x1){socket[_0xeaa4('0x135')](_0xeaa4('0x136'),{'UserId':Number(_0x129213['body'][_0xeaa4('0x72')][_0x1a0818]),'ChatWebsiteId':Number(_0x129213[_0xeaa4('0x57')]['id'])});}return _0x355e71;});}})[_0xeaa4('0x22')](respondWithResult(_0x28005e,null))[_0xeaa4('0x2d')](handleError(_0x28005e,null));};exports[_0xeaa4('0x137')]=function(_0x5a3e45,_0xd21621,_0x3a00d8){return db['ChatWebsite'][_0xeaa4('0x5a')]({'where':{'id':_0x5a3e45[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0xd21621,null))['then'](function(_0x5e0a5a){if(_0x5e0a5a){return _0x5e0a5a[_0xeaa4('0x137')](_0x5a3e45[_0xeaa4('0x49')][_0xeaa4('0x72')])['then'](function(){if(_[_0xeaa4('0x138')](_0x5a3e45[_0xeaa4('0x49')][_0xeaa4('0x72')])){for(var _0x277cc8=0x0;_0x277cc8<_0x5a3e45[_0xeaa4('0x49')][_0xeaa4('0x72')][_0xeaa4('0x59')];_0x277cc8+=0x1){socket['emit'](_0xeaa4('0x139'),{'UserId':Number(_0x5a3e45[_0xeaa4('0x49')]['ids'][_0x277cc8]),'ChatWebsiteId':Number(_0x5a3e45[_0xeaa4('0x57')]['id'])});}}else{socket['emit'](_0xeaa4('0x139'),{'UserId':Number(_0x5a3e45[_0xeaa4('0x49')]['ids']),'ChatWebsiteId':Number(_0x5a3e45[_0xeaa4('0x57')]['id'])});}});}})[_0xeaa4('0x22')](respondWithStatusCode(_0xd21621,null))[_0xeaa4('0x2d')](handleError(_0xd21621,null));};exports[_0xeaa4('0x13a')]=function(_0x757598,_0x5f3b30,_0x515642){var _0x11f9dc={};var _0x386e7e={};var _0x827d7b;var _0x65fafa;return db[_0xeaa4('0x42')][_0xeaa4('0x6a')]({'where':{'id':_0x757598['params']['id']}})['then'](handleEntityNotFound(_0x5f3b30,null))[_0xeaa4('0x22')](function(_0x3de015){if(_0x3de015){_0x827d7b=_0x3de015;_0x386e7e[_0xeaa4('0x46')]=_[_0xeaa4('0x47')](db[_0xeaa4('0x100')][_0xeaa4('0x43')]);_0x386e7e[_0xeaa4('0x49')]=_[_0xeaa4('0x47')](_0x757598[_0xeaa4('0x49')]);_0x386e7e[_0xeaa4('0x4f')]=_[_0xeaa4('0x58')](_0x386e7e[_0xeaa4('0x46')],_0x386e7e['query']);_0x11f9dc['attributes']=_[_0xeaa4('0x58')](_0x386e7e[_0xeaa4('0x46')],qs[_0xeaa4('0x48')](_0x757598[_0xeaa4('0x49')][_0xeaa4('0x48')]));_0x11f9dc['attributes']=_0x11f9dc[_0xeaa4('0x4a')][_0xeaa4('0x59')]?_0x11f9dc[_0xeaa4('0x4a')]:_0x386e7e[_0xeaa4('0x46')];_0x11f9dc['order']=qs[_0xeaa4('0x4d')](_0x757598[_0xeaa4('0x49')][_0xeaa4('0x4d')]);_0x11f9dc[_0xeaa4('0x4e')]=qs[_0xeaa4('0x4f')](_[_0xeaa4('0x50')](_0x757598['query'],_0x386e7e[_0xeaa4('0x4f')]));if(_0x757598[_0xeaa4('0x49')][_0xeaa4('0x51')]){_0x11f9dc['where']=_[_0xeaa4('0x52')](_0x11f9dc['where'],{'$or':_[_0xeaa4('0x41')](_0x11f9dc[_0xeaa4('0x4a')],function(_0x42b301){var _0x3437ac={};_0x3437ac[_0x42b301]={'$like':'%'+_0x757598[_0xeaa4('0x49')][_0xeaa4('0x51')]+'%'};return _0x3437ac;})});}_0x11f9dc=_[_0xeaa4('0x52')]({},_0x11f9dc,_0x757598[_0xeaa4('0x53')]);return _0x827d7b['getAgents'](_0x11f9dc);}})[_0xeaa4('0x22')](function(_0x2a840d){if(_0x2a840d){_0x65fafa=_0x2a840d[_0xeaa4('0x59')];if(!_0x757598['query']['hasOwnProperty'](_0xeaa4('0x4c'))){_0x11f9dc[_0xeaa4('0x33')]=qs[_0xeaa4('0x33')](_0x757598[_0xeaa4('0x49')][_0xeaa4('0x33')]);_0x11f9dc[_0xeaa4('0x31')]=qs[_0xeaa4('0x31')](_0x757598[_0xeaa4('0x49')][_0xeaa4('0x31')]);}return _0x827d7b[_0xeaa4('0x13a')](_0x11f9dc);}})[_0xeaa4('0x22')](function(_0x57c31a){if(_0x57c31a){return _0x57c31a?{'count':_0x65fafa,'rows':_0x57c31a}:null;}})[_0xeaa4('0x22')](respondWithResult(_0x5f3b30,null))[_0xeaa4('0x2d')](handleError(_0x5f3b30,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index e19273a..9d7ca66 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 _0x3645=['../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x503cd5,_0x57774a){var _0x1fdf1e=function(_0x5222cc){while(--_0x5222cc){_0x503cd5['push'](_0x503cd5['shift']());}};_0x1fdf1e(++_0x57774a);}(_0x3645,0x154));var _0x5364=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x3645[_0x37ffea];return _0x2e2615;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x5364('0x0'))['db'][_0x5364('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x5364('0x2')](0x0);var events={'afterCreate':_0x5364('0x3'),'afterUpdate':_0x5364('0x4'),'afterDestroy':_0x5364('0x5')};function emitEvent(_0x3c0f77){return function(_0x5a63bf,_0x334a16,_0xea3e95){ChatWebsiteEvents[_0x5364('0x6')](_0x3c0f77+':'+_0x5a63bf['id'],_0x5a63bf);ChatWebsiteEvents[_0x5364('0x6')](_0x3c0f77,_0x5a63bf);_0xea3e95(null);};}for(var e in events){if(events[_0x5364('0x7')](e)){var event=events[e];ChatWebsite[_0x5364('0x8')](e,emitEvent(event));}}module[_0x5364('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x3148=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x19f28e,_0x479808){var _0x5b609a=function(_0x48e422){while(--_0x48e422){_0x19f28e['push'](_0x19f28e['shift']());}};_0x5b609a(++_0x479808);}(_0x3148,0x1d3));var _0x8314=function(_0x461f41,_0x405481){_0x461f41=_0x461f41-0x0;var _0x22c772=_0x3148[_0x461f41];return _0x22c772;};'use strict';var EventEmitter=require(_0x8314('0x0'));var ChatWebsite=require(_0x8314('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8314('0x2')](0x0);var events={'afterCreate':_0x8314('0x3'),'afterUpdate':_0x8314('0x4'),'afterDestroy':_0x8314('0x5')};function emitEvent(_0x58f818){return function(_0x35ee55,_0x41e9fd,_0x62c506){ChatWebsiteEvents[_0x8314('0x6')](_0x58f818+':'+_0x35ee55['id'],_0x35ee55);ChatWebsiteEvents[_0x8314('0x6')](_0x58f818,_0x35ee55);_0x62c506(null);};}for(var e in events){if(events[_0x8314('0x7')](e)){var event=events[e];ChatWebsite[_0x8314('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 2317437..5354ae8 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 _0xaaf1=['exports','define','ChatWebsite','chat_websites','lodash','util','api','moment','bluebird','../../config/environment'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0xaaf1,0x19e));var _0x1aaf=function(_0xee0bf2,_0x5437c3){_0xee0bf2=_0xee0bf2-0x0;var _0x5c1e16=_0xaaf1[_0xee0bf2];return _0x5c1e16;};'use strict';var _=require(_0x1aaf('0x0'));var util=require(_0x1aaf('0x1'));var logger=require('../../config/logger')(_0x1aaf('0x2'));var moment=require(_0x1aaf('0x3'));var BPromise=require(_0x1aaf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1aaf('0x5'));var attributes=require('./chatWebsite.attributes');module[_0x1aaf('0x6')]=function(_0x4e0d60,_0x5ceada){return _0x4e0d60[_0x1aaf('0x7')](_0x1aaf('0x8'),attributes,{'tableName':_0x1aaf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e6a=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash'];(function(_0x4e889b,_0x12dcb2){var _0x1ab442=function(_0x107a9f){while(--_0x107a9f){_0x4e889b['push'](_0x4e889b['shift']());}};_0x1ab442(++_0x12dcb2);}(_0x8e6a,0xcb));var _0xa8e6=function(_0x57ac07,_0x2a94d1){_0x57ac07=_0x57ac07-0x0;var _0x467816=_0x8e6a[_0x57ac07];return _0x467816;};'use strict';var _=require(_0xa8e6('0x0'));var util=require(_0xa8e6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa8e6('0x2'));var BPromise=require(_0xa8e6('0x3'));var rp=require(_0xa8e6('0x4'));var fs=require('fs');var path=require(_0xa8e6('0x5'));var rimraf=require(_0xa8e6('0x6'));var config=require(_0xa8e6('0x7'));var attributes=require(_0xa8e6('0x8'));module['exports']=function(_0x17e959,_0x235aaf){return _0x17e959[_0xa8e6('0x9')](_0xa8e6('0xa'),attributes,{'tableName':_0xa8e6('0xb'),'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 893d77e..cb37dc7 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 _0x3413=['./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x3413,0x16c));var _0x3341=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3413[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3341('0x0'));var util=require(_0x3341('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3341('0x2'));var fs=require('fs');var Redis=require(_0x3341('0x3'));var db=require(_0x3341('0x4'))['db'];var utils=require(_0x3341('0x5'));var logger=require(_0x3341('0x6'))(_0x3341('0x7'));var config=require('../../config/environment');var jayson=require(_0x3341('0x8'));var client=jayson[_0x3341('0x9')][_0x3341('0xa')]({'port':0x232a});config[_0x3341('0xb')]=_[_0x3341('0xc')](config[_0x3341('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3341('0xd'))(new Redis(config[_0x3341('0xb')]));require(_0x3341('0xe'))[_0x3341('0xf')](socket);function respondWithRpcPromise(_0xd92bbb,_0x4c6497,_0xa2219b){return new BPromise(function(_0x44d9c7,_0x3660d5){return client[_0x3341('0x10')](_0xd92bbb,_0xa2219b)[_0x3341('0x11')](function(_0x5850e6){logger[_0x3341('0x12')](_0x3341('0x13'),_0x4c6497,_0x3341('0x14'));logger[_0x3341('0x15')](_0x3341('0x16'),_0x4c6497,_0x3341('0x14'),JSON['stringify'](_0x5850e6));if(_0x5850e6[_0x3341('0x17')]){if(_0x5850e6['error'][_0x3341('0x18')]===0x1f4){logger['error'](_0x3341('0x13'),_0x4c6497,_0x5850e6[_0x3341('0x17')][_0x3341('0x19')]);return _0x3660d5(_0x5850e6[_0x3341('0x17')][_0x3341('0x19')]);}logger[_0x3341('0x17')](_0x3341('0x13'),_0x4c6497,_0x5850e6[_0x3341('0x17')][_0x3341('0x19')]);return _0x44d9c7(_0x5850e6['error'][_0x3341('0x19')]);}else{logger[_0x3341('0x12')](_0x3341('0x13'),_0x4c6497,_0x3341('0x14'));_0x44d9c7(_0x5850e6[_0x3341('0x1a')][_0x3341('0x19')]);}})['catch'](function(_0x40853e){logger[_0x3341('0x17')](_0x3341('0x13'),_0x4c6497,_0x40853e);_0x3660d5(_0x40853e);});});} \ No newline at end of file +var _0x5b0d=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5b0d,0x14c));var _0xd5b0=function(_0x361190,_0x4da5cd){_0x361190=_0x361190-0x0;var _0xc4c00c=_0x5b0d[_0x361190];return _0xc4c00c;};'use strict';var _=require(_0xd5b0('0x0'));var util=require('util');var moment=require(_0xd5b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xd5b0('0x2'));var fs=require('fs');var Redis=require(_0xd5b0('0x3'));var db=require(_0xd5b0('0x4'))['db'];var utils=require(_0xd5b0('0x5'));var logger=require('../../config/logger')(_0xd5b0('0x6'));var config=require(_0xd5b0('0x7'));var jayson=require(_0xd5b0('0x8'));var client=jayson[_0xd5b0('0x9')][_0xd5b0('0xa')]({'port':0x232a});config[_0xd5b0('0xb')]=_[_0xd5b0('0xc')](config['redis'],{'host':_0xd5b0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd5b0('0xb')]));require(_0xd5b0('0xe'))['register'](socket);function respondWithRpcPromise(_0x4febe1,_0x5bf744,_0x462797){return new BPromise(function(_0x235580,_0x2d7b34){return client[_0xd5b0('0xf')](_0x4febe1,_0x462797)[_0xd5b0('0x10')](function(_0x2ce541){logger[_0xd5b0('0x11')](_0xd5b0('0x12'),_0x5bf744,_0xd5b0('0x13'));logger['debug'](_0xd5b0('0x14'),_0x5bf744,_0xd5b0('0x13'),JSON[_0xd5b0('0x15')](_0x2ce541));if(_0x2ce541[_0xd5b0('0x16')]){if(_0x2ce541[_0xd5b0('0x16')][_0xd5b0('0x17')]===0x1f4){logger['error'](_0xd5b0('0x12'),_0x5bf744,_0x2ce541[_0xd5b0('0x16')][_0xd5b0('0x18')]);return _0x2d7b34(_0x2ce541[_0xd5b0('0x16')][_0xd5b0('0x18')]);}logger[_0xd5b0('0x16')](_0xd5b0('0x12'),_0x5bf744,_0x2ce541[_0xd5b0('0x16')][_0xd5b0('0x18')]);return _0x235580(_0x2ce541['error'][_0xd5b0('0x18')]);}else{logger['info'](_0xd5b0('0x12'),_0x5bf744,'request\x20sent');_0x235580(_0x2ce541['result'][_0xd5b0('0x18')]);}})[_0xd5b0('0x19')](function(_0x3fa9fc){logger['error'](_0xd5b0('0x12'),_0x5bf744,_0x3fa9fc);_0x2d7b34(_0x3fa9fc);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index dbf6559..02b11de 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 _0x4bc5=['length','chatWebsite:','remove','emit','removeListener','register'];(function(_0x33103a,_0x11c65c){var _0x30e316=function(_0x40612c){while(--_0x40612c){_0x33103a['push'](_0x33103a['shift']());}};_0x30e316(++_0x11c65c);}(_0x4bc5,0x98));var _0x54bc=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x4bc5[_0x176329];return _0x31997c;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save',_0x54bc('0x0'),'update'];function createListener(_0x4a5e5d,_0x2cd6c5){return function(_0x30816f){_0x2cd6c5[_0x54bc('0x1')](_0x4a5e5d,_0x30816f);};}function removeListener(_0x43a2b2,_0x426819){return function(){ChatWebsiteEvents[_0x54bc('0x2')](_0x43a2b2,_0x426819);};}exports[_0x54bc('0x3')]=function(_0x3dc022){for(var _0x310022=0x0,_0x2cfcd1=events[_0x54bc('0x4')];_0x310022<_0x2cfcd1;_0x310022++){var _0x2b7d95=events[_0x310022];var _0x55a1d2=createListener(_0x54bc('0x5')+_0x2b7d95,_0x3dc022);ChatWebsiteEvents['on'](_0x2b7d95,_0x55a1d2);}}; \ No newline at end of file +var _0x5248=['emit','register','length','chatWebsite:','./chatWebsite.events','remove'];(function(_0x200fc2,_0x3560d5){var _0x462bdd=function(_0x50c746){while(--_0x50c746){_0x200fc2['push'](_0x200fc2['shift']());}};_0x462bdd(++_0x3560d5);}(_0x5248,0xf4));var _0x8524=function(_0x4a882d,_0x563b7e){_0x4a882d=_0x4a882d-0x0;var _0x1cf18c=_0x5248[_0x4a882d];return _0x1cf18c;};'use strict';var ChatWebsiteEvents=require(_0x8524('0x0'));var events=['save',_0x8524('0x1'),'update'];function createListener(_0x1bcf6c,_0x571bb8){return function(_0x13cfc8){_0x571bb8[_0x8524('0x2')](_0x1bcf6c,_0x13cfc8);};}function removeListener(_0x3bffa6,_0x307f89){return function(){ChatWebsiteEvents['removeListener'](_0x3bffa6,_0x307f89);};}exports[_0x8524('0x3')]=function(_0x3cc6c9){for(var _0x2821dd=0x0,_0x2f0f1c=events[_0x8524('0x4')];_0x2821dd<_0x2f0f1c;_0x2821dd++){var _0x3d28be=events[_0x2821dd];var _0x855337=createListener(_0x8524('0x5')+_0x3d28be,_0x3cc6c9);ChatWebsiteEvents['on'](_0x3d28be,_0x855337);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index e52dad7..813c945 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 _0x801a=['/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/canned_answers','addAnswer','diskStorage','root','format','%s-%s','now','originalname','/:id/logo','single','file','join','server/files/images/avatars/','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','offline','addInteraction','addProactiveActions','addAgents','update','destroy','delete','removeAnswers','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/avatar','getAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields'];(function(_0x295e3e,_0x30b417){var _0x4c8a9c=function(_0x2f4ef1){while(--_0x2f4ef1){_0x295e3e['push'](_0x295e3e['shift']());}};_0x4c8a9c(++_0x30b417);}(_0x801a,0xaa));var _0xa801=function(_0x2b155c,_0x5f4b0e){_0x2b155c=_0x2b155c-0x0;var _0x54127a=_0x801a[_0x2b155c];return _0x54127a;};'use strict';var multer=require(_0xa801('0x0'));var util=require(_0xa801('0x1'));var path=require(_0xa801('0x2'));var timeout=require('connect-timeout');var express=require(_0xa801('0x3'));var router=express[_0xa801('0x4')]();var fs_extra=require(_0xa801('0x5'));var auth=require(_0xa801('0x6'));var interaction=require(_0xa801('0x7'));var config=require('../../config/environment');var controller=require(_0xa801('0x8'));router[_0xa801('0x9')]('/',auth['isAuthenticated'](),controller[_0xa801('0xa')]);router['get']('/describe',auth[_0xa801('0xb')](),controller[_0xa801('0xc')]);router['get'](_0xa801('0xd'),auth['isAuthenticated'](),controller[_0xa801('0xe')]);router['get'](_0xa801('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0xa801('0xb')](),controller['getAnswers']);router[_0xa801('0x9')]('/:id/logo',controller['getLogo']);router['get'](_0xa801('0x10'),controller[_0xa801('0x11')]);router['get']('/:id/customer_avatar',controller['getCustomerAvatar']);router['get'](_0xa801('0x12'),controller[_0xa801('0x13')]);router['get'](_0xa801('0x14'),auth[_0xa801('0xb')](),controller[_0xa801('0x15')]);router[_0xa801('0x9')](_0xa801('0x16'),controller['getSnippet']);router[_0xa801('0x9')](_0xa801('0x17'),auth[_0xa801('0xb')](),controller[_0xa801('0x18')]);router[_0xa801('0x9')](_0xa801('0x19'),auth[_0xa801('0xb')](),controller[_0xa801('0x1a')]);router['get'](_0xa801('0x1b'),controller['getFields']);router[_0xa801('0x9')](_0xa801('0x1c'),auth[_0xa801('0xb')](),controller[_0xa801('0x1d')]);router[_0xa801('0x9')](_0xa801('0x1e'),auth[_0xa801('0xb')](),controller[_0xa801('0x1f')]);router[_0xa801('0x20')]('/',auth[_0xa801('0xb')](),controller[_0xa801('0x21')]);router[_0xa801('0x20')](_0xa801('0xf'),auth[_0xa801('0xb')](),controller['addDisposition']);router['post'](_0xa801('0x22'),auth[_0xa801('0xb')](),controller[_0xa801('0x23')]);var upload=multer({'storage':multer[_0xa801('0x24')]({'destination':function(_0x29e9ae,_0x3c994b,_0x28c11a){_0x28c11a(null,path['join'](config[_0xa801('0x25')],'server/files/images/logos/'));},'filename':function(_0x369f08,_0xef7fad,_0x2901c4){_0x2901c4(null,util[_0xa801('0x26')](_0xa801('0x27'),Date[_0xa801('0x28')](),_0xef7fad[_0xa801('0x29')]));}})});router['post'](_0xa801('0x2a'),upload[_0xa801('0x2b')](_0xa801('0x2c')),controller['addLogo']);var upload=multer({'storage':multer[_0xa801('0x24')]({'destination':function(_0x556339,_0x7d8ab4,_0x3890f1){_0x3890f1(null,path[_0xa801('0x2d')](config[_0xa801('0x25')],_0xa801('0x2e')));},'filename':function(_0x5b960f,_0x35c0a4,_0x22b629){_0x22b629(null,util[_0xa801('0x26')](_0xa801('0x27'),Date['now'](),_0x35c0a4['originalname']));}})});router[_0xa801('0x20')](_0xa801('0x10'),upload[_0xa801('0x2b')]('file'),controller[_0xa801('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb81e34,_0x159e46,_0x1d715c){_0x1d715c(null,path[_0xa801('0x2d')](config[_0xa801('0x25')],_0xa801('0x2e')));},'filename':function(_0x4c34b7,_0x1d0f89,_0xce5471){_0xce5471(null,util[_0xa801('0x26')]('%s-%s',Date[_0xa801('0x28')](),_0x1d0f89[_0xa801('0x29')]));}})});router[_0xa801('0x20')]('/:id/customer_avatar',upload['single'](_0xa801('0x2c')),controller[_0xa801('0x30')]);var upload=multer({'storage':multer[_0xa801('0x24')]({'destination':function(_0x40a547,_0x49f46b,_0x3e2883){_0x3e2883(null,path[_0xa801('0x2d')](config[_0xa801('0x25')],_0xa801('0x2e')));},'filename':function(_0x49ddec,_0x141887,_0xf9ed9){_0xf9ed9(null,util[_0xa801('0x26')](_0xa801('0x27'),Date[_0xa801('0x28')](),_0x141887[_0xa801('0x29')]));}})});router['post'](_0xa801('0x12'),upload[_0xa801('0x2b')](_0xa801('0x2c')),controller[_0xa801('0x31')]);router['post'](_0xa801('0x32'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x110eb9,_0x1c64f1,_0x15d049){const _0x22753c=path[_0xa801('0x2d')](config['root'],_0xa801('0x33'),_0xa801('0x34'),_0xa801('0x35'));fs_extra['ensureDir'](_0x22753c,function(){_0x15d049(null,_0x22753c);});},'filename':function(_0x49f7e5,_0x1ab9cf,_0x4e2f08){const _0x682862=_0x1ab9cf[_0xa801('0x29')][_0xa801('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1c754e=path[_0xa801('0x37')](_0x682862);const _0x26b326=Date[_0xa801('0x28')]()+'-'+_0x682862[_0xa801('0x36')](_0x1c754e,'')+_0x1c754e;_0x4e2f08(null,_0x26b326);}})});router['post'](_0xa801('0x38'),offlineUploadMulter['any'](),controller[_0xa801('0x39')]);router[_0xa801('0x20')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xa801('0x3a')]);router[_0xa801('0x20')](_0xa801('0x17'),auth[_0xa801('0xb')](),controller['addApplications']);router[_0xa801('0x20')](_0xa801('0x19'),auth[_0xa801('0xb')](),controller[_0xa801('0x3b')]);router[_0xa801('0x20')](_0xa801('0x1e'),auth['isAuthenticated'](),controller[_0xa801('0x3c')]);router['put'](_0xa801('0xd'),auth[_0xa801('0xb')](),controller[_0xa801('0x3d')]);router['delete'](_0xa801('0xd'),auth[_0xa801('0xb')](),controller[_0xa801('0x3e')]);router[_0xa801('0x3f')](_0xa801('0xf'),auth[_0xa801('0xb')](),controller['removeDispositions']);router[_0xa801('0x3f')](_0xa801('0x22'),auth['isAuthenticated'](),controller[_0xa801('0x40')]);router[_0xa801('0x3f')]('/:id/users',auth[_0xa801('0xb')](),controller['removeAgents']);module[_0xa801('0x41')]=router; \ No newline at end of file +var _0x2f29=['put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','getOfflineMessages','/:id/users','create','post','addAnswer','diskStorage','join','root','server/files/images/logos/','%s-%s','originalname','/:id/logo','file','addLogo','server/files/images/avatars/','format','now','single','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','addAgents'];(function(_0x5953d9,_0x1e903c){var _0x50a511=function(_0x5613d4){while(--_0x5613d4){_0x5953d9['push'](_0x5953d9['shift']());}};_0x50a511(++_0x1e903c);}(_0x2f29,0x1ca));var _0x92f2=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x2f29[_0x4fbfd9];return _0x31dc94;};'use strict';var multer=require('multer');var util=require(_0x92f2('0x0'));var path=require(_0x92f2('0x1'));var timeout=require('connect-timeout');var express=require(_0x92f2('0x2'));var router=express[_0x92f2('0x3')]();var fs_extra=require(_0x92f2('0x4'));var auth=require(_0x92f2('0x5'));var interaction=require(_0x92f2('0x6'));var config=require(_0x92f2('0x7'));var controller=require('./chatWebsite.controller');router[_0x92f2('0x8')]('/',auth[_0x92f2('0x9')](),controller[_0x92f2('0xa')]);router[_0x92f2('0x8')](_0x92f2('0xb'),auth['isAuthenticated'](),controller[_0x92f2('0xc')]);router['get']('/:id',auth[_0x92f2('0x9')](),controller['show']);router[_0x92f2('0x8')](_0x92f2('0xd'),auth[_0x92f2('0x9')](),controller[_0x92f2('0xe')]);router['get'](_0x92f2('0xf'),auth[_0x92f2('0x9')](),controller[_0x92f2('0x10')]);router[_0x92f2('0x8')]('/:id/logo',controller[_0x92f2('0x11')]);router[_0x92f2('0x8')](_0x92f2('0x12'),controller[_0x92f2('0x13')]);router[_0x92f2('0x8')](_0x92f2('0x14'),controller[_0x92f2('0x15')]);router[_0x92f2('0x8')](_0x92f2('0x16'),controller['getSystemAvatar']);router[_0x92f2('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x92f2('0x17')]);router[_0x92f2('0x8')](_0x92f2('0x18'),controller[_0x92f2('0x19')]);router[_0x92f2('0x8')](_0x92f2('0x1a'),auth[_0x92f2('0x9')](),controller[_0x92f2('0x1b')]);router['get'](_0x92f2('0x1c'),auth[_0x92f2('0x9')](),controller['getProactiveActions']);router[_0x92f2('0x8')](_0x92f2('0x1d'),controller[_0x92f2('0x1e')]);router[_0x92f2('0x8')]('/:id/offline_messages',auth[_0x92f2('0x9')](),controller[_0x92f2('0x1f')]);router[_0x92f2('0x8')](_0x92f2('0x20'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x92f2('0x21')]);router[_0x92f2('0x22')](_0x92f2('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x92f2('0xf'),auth[_0x92f2('0x9')](),controller[_0x92f2('0x23')]);var upload=multer({'storage':multer[_0x92f2('0x24')]({'destination':function(_0x345402,_0x251d5f,_0x59c754){_0x59c754(null,path[_0x92f2('0x25')](config[_0x92f2('0x26')],_0x92f2('0x27')));},'filename':function(_0x50dc19,_0x2e48c3,_0x2b2837){_0x2b2837(null,util['format'](_0x92f2('0x28'),Date['now'](),_0x2e48c3[_0x92f2('0x29')]));}})});router['post'](_0x92f2('0x2a'),upload['single'](_0x92f2('0x2b')),controller[_0x92f2('0x2c')]);var upload=multer({'storage':multer[_0x92f2('0x24')]({'destination':function(_0x134e9f,_0xcbb56c,_0xe6db7b){_0xe6db7b(null,path['join'](config['root'],_0x92f2('0x2d')));},'filename':function(_0x3484f9,_0x16af94,_0x33372f){_0x33372f(null,util[_0x92f2('0x2e')](_0x92f2('0x28'),Date[_0x92f2('0x2f')](),_0x16af94[_0x92f2('0x29')]));}})});router[_0x92f2('0x22')]('/:id/avatar',upload[_0x92f2('0x30')](_0x92f2('0x2b')),controller[_0x92f2('0x31')]);var upload=multer({'storage':multer[_0x92f2('0x24')]({'destination':function(_0x3211c1,_0x1f32f9,_0x17109a){_0x17109a(null,path[_0x92f2('0x25')](config[_0x92f2('0x26')],_0x92f2('0x2d')));},'filename':function(_0x2004d7,_0x3ea398,_0xa38d0b){_0xa38d0b(null,util[_0x92f2('0x2e')](_0x92f2('0x28'),Date['now'](),_0x3ea398['originalname']));}})});router[_0x92f2('0x22')]('/:id/customer_avatar',upload[_0x92f2('0x30')]('file'),controller[_0x92f2('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5c1d4d,_0x29ff95,_0xf69435){_0xf69435(null,path[_0x92f2('0x25')](config['root'],_0x92f2('0x2d')));},'filename':function(_0x4c112d,_0x597b77,_0x2d4aa1){_0x2d4aa1(null,util[_0x92f2('0x2e')]('%s-%s',Date[_0x92f2('0x2f')](),_0x597b77['originalname']));}})});router['post'](_0x92f2('0x16'),upload[_0x92f2('0x30')](_0x92f2('0x2b')),controller[_0x92f2('0x33')]);router[_0x92f2('0x22')](_0x92f2('0x34'),controller[_0x92f2('0x35')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x506d70,_0x3d3ed7,_0x10e3a3){const _0x134408=path[_0x92f2('0x25')](config[_0x92f2('0x26')],_0x92f2('0x36'),_0x92f2('0x37'),_0x92f2('0x38'));fs_extra[_0x92f2('0x39')](_0x134408,function(){_0x10e3a3(null,_0x134408);});},'filename':function(_0x1cd706,_0x498322,_0x3a30ef){const _0x2df6b5=_0x498322[_0x92f2('0x29')][_0x92f2('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x142490=path[_0x92f2('0x3b')](_0x2df6b5);const _0x5fd8b1=Date[_0x92f2('0x2f')]()+'-'+_0x2df6b5['replace'](_0x142490,'')+_0x142490;_0x3a30ef(null,_0x5fd8b1);}})});router[_0x92f2('0x22')](_0x92f2('0x3c'),offlineUploadMulter[_0x92f2('0x3d')](),controller[_0x92f2('0x3e')]);router['post'](_0x92f2('0x3f'),auth[_0x92f2('0x9')](),controller[_0x92f2('0x40')]);router[_0x92f2('0x22')]('/:id/applications',auth[_0x92f2('0x9')](),controller[_0x92f2('0x41')]);router[_0x92f2('0x22')]('/:id/proactive_actions',auth[_0x92f2('0x9')](),controller['addProactiveActions']);router[_0x92f2('0x22')](_0x92f2('0x20'),auth['isAuthenticated'](),controller[_0x92f2('0x42')]);router[_0x92f2('0x43')]('/:id',auth[_0x92f2('0x9')](),controller[_0x92f2('0x44')]);router[_0x92f2('0x45')]('/:id',auth[_0x92f2('0x9')](),controller[_0x92f2('0x46')]);router[_0x92f2('0x45')]('/:id/dispositions',auth[_0x92f2('0x9')](),controller[_0x92f2('0x47')]);router[_0x92f2('0x45')](_0x92f2('0xf'),auth[_0x92f2('0x9')](),controller[_0x92f2('0x48')]);router[_0x92f2('0x45')](_0x92f2('0x20'),auth[_0x92f2('0x9')](),controller[_0x92f2('0x49')]);module[_0x92f2('0x4a')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index e3d8408..f0ac7ad 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 _0x4975=['STRING','ENUM','AmazonAWS','Google','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4975,0x86));var _0x5497=function(_0x2d8c58,_0xe827f1){_0x2d8c58=_0x2d8c58-0x0;var _0x301072=_0x4975[_0x2d8c58];return _0x301072;};'use strict';var Sequelize=require(_0x5497('0x0'));module['exports']={'name':{'type':Sequelize[_0x5497('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5497('0x2')](_0x5497('0x3'),_0x5497('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x5497('0x1')]},'data2':{'type':Sequelize[_0x5497('0x1')]}}; \ No newline at end of file +var _0xfd2e=['STRING','AmazonAWS','sequelize'];(function(_0x775324,_0x4bae4a){var _0x3c05db=function(_0x5cbe25){while(--_0x5cbe25){_0x775324['push'](_0x775324['shift']());}};_0x3c05db(++_0x4bae4a);}(_0xfd2e,0x6e));var _0xefd2=function(_0x43c8eb,_0xf76efe){_0x43c8eb=_0x43c8eb-0x0;var _0x3b1c3b=_0xfd2e[_0x43c8eb];return _0x3b1c3b;};'use strict';var Sequelize=require(_0xefd2('0x0'));module['exports']={'name':{'type':Sequelize[_0xefd2('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xefd2('0x2'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xefd2('0x1')]},'data2':{'type':Sequelize[_0xefd2('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index c49a96b..eb9ac42 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 _0xdb28=['error','stack','name','send','index','CloudProvider','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus'];(function(_0x40701a,_0x170aec){var _0x351e72=function(_0x4f666d){while(--_0x4f666d){_0x40701a['push'](_0x40701a['shift']());}};_0x351e72(++_0x170aec);}(_0xdb28,0x106));var _0x8db2=function(_0x41bc80,_0x49f40b){_0x41bc80=_0x41bc80-0x0;var _0x358e1a=_0xdb28[_0x41bc80];return _0x358e1a;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':!![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));}; \ No newline at end of file +var _0x0b0e=['hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','CloudProvider','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length'];(function(_0x2b3248,_0x4681c3){var _0x4c273=function(_0xd66761){while(--_0xd66761){_0x2b3248['push'](_0x2b3248['shift']());}};_0x4c273(++_0x4681c3);}(_0x0b0e,0x187));var _0xe0b0=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x0b0e[_0x35885a];return _0xe86249;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['CloudProvider'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'all':!![]}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x41')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x402a0e){_0x36d137[_0xe0b0('0x42')]=_0x402a0e;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x43')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x44')]=function(_0x52ffe4,_0x2aad80){var _0x309bbf={'raw':!![],'where':{'id':_0x52ffe4['params']['id']}},_0x528818={};_0x528818[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db['CloudProvider'][_0xe0b0('0x2b')]);_0x528818[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x52ffe4[_0xe0b0('0x2e')]);_0x528818[_0xe0b0('0x39')]=_['intersection'](_0x528818['model'],_0x528818['query']);_0x309bbf[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x528818['model'],qs[_0xe0b0('0x33')](_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x309bbf[_0xe0b0('0x32')]=_0x309bbf[_0xe0b0('0x32')]['length']?_0x309bbf['attributes']:_0x528818[_0xe0b0('0x31')];if(_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x309bbf[_0xe0b0('0x45')]=[{'all':!![]}];}_0x309bbf=_[_0xe0b0('0x3b')]({},_0x309bbf,_0x52ffe4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x46')](_0x309bbf)['then'](handleEntityNotFound(_0x2aad80,null))['then'](respondWithResult(_0x2aad80,null))['catch'](handleError(_0x2aad80,null));};exports[_0xe0b0('0x47')]=function(_0x2184d3,_0x2419ce){return db[_0xe0b0('0x2a')]['create'](_0x2184d3[_0xe0b0('0x48')],{})[_0xe0b0('0x23')](respondWithResult(_0x2419ce,0xc9))['catch'](handleError(_0x2419ce,null));};exports['update']=function(_0x2365be,_0x1bc6e0){if(_0x2365be['body']['id']){delete _0x2365be[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x2365be['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1bc6e0,null))['then'](saveUpdates(_0x2365be[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,null))[_0xe0b0('0x43')](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x24')]=function(_0x19ee71,_0xf9e694){return db['CloudProvider']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 6cdef3e..c15278c 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 _0xf74a=['cloud_providers','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define'];(function(_0x1277cf,_0x565e09){var _0x41fc07=function(_0x127704){while(--_0x127704){_0x1277cf['push'](_0x1277cf['shift']());}};_0x41fc07(++_0x565e09);}(_0xf74a,0x146));var _0xaf74=function(_0x5435f6,_0x5f207e){_0x5435f6=_0x5435f6-0x0;var _0x21ee0f=_0xf74a[_0x5435f6];return _0x21ee0f;};'use strict';var _=require(_0xaf74('0x0'));var util=require(_0xaf74('0x1'));var logger=require('../../config/logger')(_0xaf74('0x2'));var moment=require(_0xaf74('0x3'));var BPromise=require(_0xaf74('0x4'));var rp=require(_0xaf74('0x5'));var fs=require('fs');var path=require(_0xaf74('0x6'));var rimraf=require(_0xaf74('0x7'));var config=require(_0xaf74('0x8'));var attributes=require(_0xaf74('0x9'));module[_0xaf74('0xa')]=function(_0x2bac3b,_0xbf5ecc){return _0x2bac3b[_0xaf74('0xb')]('CloudProvider',attributes,{'tableName':_0xaf74('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76d1=['moment','bluebird','request-promise','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','api'];(function(_0x80544e,_0x37a3f3){var _0x4f9b90=function(_0x4f95d6){while(--_0x4f95d6){_0x80544e['push'](_0x80544e['shift']());}};_0x4f9b90(++_0x37a3f3);}(_0x76d1,0x99));var _0x176d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x76d1[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x176d('0x0'));var util=require(_0x176d('0x1'));var logger=require('../../config/logger')(_0x176d('0x2'));var moment=require(_0x176d('0x3'));var BPromise=require(_0x176d('0x4'));var rp=require(_0x176d('0x5'));var fs=require('fs');var path=require(_0x176d('0x6'));var rimraf=require(_0x176d('0x7'));var config=require('../../config/environment');var attributes=require(_0x176d('0x8'));module[_0x176d('0x9')]=function(_0x12b4f5,_0x74ba99){return _0x12b4f5[_0x176d('0xa')](_0x176d('0xb'),attributes,{'tableName':_0x176d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 5be3f60..3958751 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 _0x3646=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','info','result'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x3646,0x15f));var _0x6364=function(_0x765879,_0x4597b7){_0x765879=_0x765879-0x0;var _0x5f2cd4=_0x3646[_0x765879];return _0x5f2cd4;};'use strict';var _=require(_0x6364('0x0'));var util=require(_0x6364('0x1'));var moment=require(_0x6364('0x2'));var BPromise=require(_0x6364('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6364('0x4'));var db=require(_0x6364('0x5'))['db'];var utils=require(_0x6364('0x6'));var logger=require(_0x6364('0x7'))(_0x6364('0x8'));var config=require(_0x6364('0x9'));var jayson=require(_0x6364('0xa'));var client=jayson[_0x6364('0xb')][_0x6364('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x681d9c,_0x256949,_0x520a3d){return new BPromise(function(_0x1be238,_0x24706f){return client[_0x6364('0xd')](_0x681d9c,_0x520a3d)[_0x6364('0xe')](function(_0x4945cd){logger['info']('CloudProvider,\x20%s,\x20%s',_0x256949,_0x6364('0xf'));logger[_0x6364('0x10')](_0x6364('0x11'),_0x256949,_0x6364('0xf'),JSON[_0x6364('0x12')](_0x4945cd));if(_0x4945cd[_0x6364('0x13')]){if(_0x4945cd[_0x6364('0x13')]['code']===0x1f4){logger[_0x6364('0x13')](_0x6364('0x14'),_0x256949,_0x4945cd[_0x6364('0x13')]['message']);return _0x24706f(_0x4945cd[_0x6364('0x13')][_0x6364('0x15')]);}logger[_0x6364('0x13')](_0x6364('0x14'),_0x256949,_0x4945cd['error'][_0x6364('0x15')]);return _0x1be238(_0x4945cd['error'][_0x6364('0x15')]);}else{logger[_0x6364('0x16')](_0x6364('0x14'),_0x256949,'request\x20sent');_0x1be238(_0x4945cd[_0x6364('0x17')][_0x6364('0x15')]);}})[_0x6364('0x18')](function(_0x363fd7){logger[_0x6364('0x13')](_0x6364('0x14'),_0x256949,_0x363fd7);_0x24706f(_0x363fd7);});});} \ No newline at end of file +var _0xe797=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xe797,0x12a));var _0x7e79=function(_0x517bc0,_0x302e15){_0x517bc0=_0x517bc0-0x0;var _0x242402=_0xe797[_0x517bc0];return _0x242402;};'use strict';var _=require(_0x7e79('0x0'));var util=require(_0x7e79('0x1'));var moment=require(_0x7e79('0x2'));var BPromise=require(_0x7e79('0x3'));var rs=require(_0x7e79('0x4'));var fs=require('fs');var Redis=require(_0x7e79('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e79('0x6'));var logger=require(_0x7e79('0x7'))('rpc');var config=require(_0x7e79('0x8'));var jayson=require(_0x7e79('0x9'));var client=jayson[_0x7e79('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fdfa1,_0x9dd35a,_0x358bd6){return new BPromise(function(_0x484e66,_0x54aab5){return client[_0x7e79('0xb')](_0x4fdfa1,_0x358bd6)[_0x7e79('0xc')](function(_0x134e89){logger['info'](_0x7e79('0xd'),_0x9dd35a,_0x7e79('0xe'));logger[_0x7e79('0xf')](_0x7e79('0x10'),_0x9dd35a,_0x7e79('0xe'),JSON[_0x7e79('0x11')](_0x134e89));if(_0x134e89[_0x7e79('0x12')]){if(_0x134e89[_0x7e79('0x12')][_0x7e79('0x13')]===0x1f4){logger['error'](_0x7e79('0xd'),_0x9dd35a,_0x134e89['error'][_0x7e79('0x14')]);return _0x54aab5(_0x134e89['error'][_0x7e79('0x14')]);}logger[_0x7e79('0x12')](_0x7e79('0xd'),_0x9dd35a,_0x134e89[_0x7e79('0x12')]['message']);return _0x484e66(_0x134e89[_0x7e79('0x12')][_0x7e79('0x14')]);}else{logger[_0x7e79('0x15')](_0x7e79('0xd'),_0x9dd35a,_0x7e79('0xe'));_0x484e66(_0x134e89[_0x7e79('0x16')][_0x7e79('0x14')]);}})['catch'](function(_0x2ec0c7){logger[_0x7e79('0x12')](_0x7e79('0xd'),_0x9dd35a,_0x2ec0c7);_0x54aab5(_0x2ec0c7);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 754307b..9897f47 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 _0xf7a8=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','multer','path'];(function(_0x21fc2,_0x36ff9e){var _0x93a6d5=function(_0x9b29ff){while(--_0x9b29ff){_0x21fc2['push'](_0x21fc2['shift']());}};_0x93a6d5(++_0x36ff9e);}(_0xf7a8,0xfa));var _0x8f7a=function(_0x29e883,_0x2e9ee3){_0x29e883=_0x29e883-0x0;var _0x58a1b8=_0xf7a8[_0x29e883];return _0x58a1b8;};'use strict';var multer=require(_0x8f7a('0x0'));var util=require('util');var path=require(_0x8f7a('0x1'));var timeout=require(_0x8f7a('0x2'));var express=require('express');var router=express[_0x8f7a('0x3')]();var fs_extra=require(_0x8f7a('0x4'));var auth=require(_0x8f7a('0x5'));var interaction=require(_0x8f7a('0x6'));var config=require(_0x8f7a('0x7'));var controller=require(_0x8f7a('0x8'));router[_0x8f7a('0x9')]('/',auth[_0x8f7a('0xa')](),controller[_0x8f7a('0xb')]);router[_0x8f7a('0x9')](_0x8f7a('0xc'),auth[_0x8f7a('0xa')](),controller[_0x8f7a('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8f7a('0xe')]);router[_0x8f7a('0xf')](_0x8f7a('0xc'),auth[_0x8f7a('0xa')](),controller['update']);router[_0x8f7a('0x10')](_0x8f7a('0xc'),auth[_0x8f7a('0xa')](),controller[_0x8f7a('0x11')]);module['exports']=router; \ No newline at end of file +var _0x11c1=['get','isAuthenticated','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x11c1,0x1cb));var _0x111c=function(_0x5da49e,_0x358e31){_0x5da49e=_0x5da49e-0x0;var _0x3729e6=_0x11c1[_0x5da49e];return _0x3729e6;};'use strict';var multer=require(_0x111c('0x0'));var util=require('util');var path=require(_0x111c('0x1'));var timeout=require(_0x111c('0x2'));var express=require(_0x111c('0x3'));var router=express[_0x111c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x111c('0x5'));var interaction=require(_0x111c('0x6'));var config=require(_0x111c('0x7'));var controller=require(_0x111c('0x8'));router[_0x111c('0x9')]('/',auth[_0x111c('0xa')](),controller['index']);router[_0x111c('0x9')](_0x111c('0xb'),auth[_0x111c('0xa')](),controller[_0x111c('0xc')]);router[_0x111c('0xd')]('/',auth[_0x111c('0xa')](),controller[_0x111c('0xe')]);router[_0x111c('0xf')](_0x111c('0xb'),auth[_0x111c('0xa')](),controller[_0x111c('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x111c('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index b7b244e..23a9260 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 _0x4431=['name','sequelize','STRING'];(function(_0x45b2b5,_0x1ae667){var _0x27650a=function(_0x4903c2){while(--_0x4903c2){_0x45b2b5['push'](_0x45b2b5['shift']());}};_0x27650a(++_0x1ae667);}(_0x4431,0x1b4));var _0x1443=function(_0x192687,_0x5b9e85){_0x192687=_0x192687-0x0;var _0x456889=_0x4431[_0x192687];return _0x456889;};'use strict';var Sequelize=require(_0x1443('0x0'));module['exports']={'name':{'type':Sequelize[_0x1443('0x1')],'unique':_0x1443('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1443('0x1')]},'companyId':{'type':Sequelize[_0x1443('0x1')]},'website':{'type':Sequelize[_0x1443('0x1')]},'phone':{'type':Sequelize[_0x1443('0x1')]},'fax':{'type':Sequelize[_0x1443('0x1')]},'type':{'type':Sequelize[_0x1443('0x1')]},'street':{'type':Sequelize[_0x1443('0x1')]},'postalCode':{'type':Sequelize[_0x1443('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x1443('0x1')]},'email':{'type':Sequelize[_0x1443('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1443('0x1')]},'sStreet':{'type':Sequelize[_0x1443('0x1')]},'sPostalCode':{'type':Sequelize[_0x1443('0x1')]},'sCity':{'type':Sequelize[_0x1443('0x1')]},'sCountry':{'type':Sequelize[_0x1443('0x1')]},'description':{'type':Sequelize[_0x1443('0x1')]}}; \ No newline at end of file +var _0x5089=['exports','name','STRING','sequelize'];(function(_0x32e4de,_0x7da1c5){var _0x51ba2a=function(_0x2a7322){while(--_0x2a7322){_0x32e4de['push'](_0x32e4de['shift']());}};_0x51ba2a(++_0x7da1c5);}(_0x5089,0x1bb));var _0x9508=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0x5089[_0xa1e3ca];return _0x5005ab;};'use strict';var Sequelize=require(_0x9508('0x0'));module[_0x9508('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9508('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x9508('0x3')]},'companyId':{'type':Sequelize[_0x9508('0x3')]},'website':{'type':Sequelize[_0x9508('0x3')]},'phone':{'type':Sequelize[_0x9508('0x3')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9508('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x9508('0x3')]},'city':{'type':Sequelize[_0x9508('0x3')]},'country':{'type':Sequelize[_0x9508('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9508('0x3')]},'sStreet':{'type':Sequelize[_0x9508('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x9508('0x3')]},'sCountry':{'type':Sequelize[_0x9508('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 727f669..7239898 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 _0x2346=['count','offset','set','Content-Range','json','apply','reject','update','then','get','Companies','UserProfileResource','destroy','error','stack','name','CmCompany','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','includeAll','include','findAll','rows','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','ids','findOne','rawAttributes','map','getContacts','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x2346,0x18a));var _0x6234=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0x2346[_0x43941d];return _0x27b82a;};'use strict';var emlformat=require(_0x6234('0x0'));var rimraf=require(_0x6234('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6234('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6234('0x3'));var Mustache=require('mustache');var util=require(_0x6234('0x4'));var path=require(_0x6234('0x5'));var sox=require(_0x6234('0x6'));var csv=require('to-csv');var ejs=require(_0x6234('0x7'));var fs=require('fs');var fs_extra=require(_0x6234('0x8'));var _=require(_0x6234('0x9'));var squel=require('squel');var crypto=require(_0x6234('0xa'));var jsforce=require(_0x6234('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6234('0xc'));var querystring=require('querystring');var Papa=require(_0x6234('0xd'));var Redis=require(_0x6234('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6234('0xf'));var hardwareService=require(_0x6234('0x10'));var logger=require(_0x6234('0x11'))(_0x6234('0x12'));var utils=require(_0x6234('0x13'));var config=require(_0x6234('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4274c2,_0x23aaa2){_0x23aaa2=_0x23aaa2||0xcc;return function(_0x3201e4){if(_0x3201e4){return _0x4274c2[_0x6234('0x15')](_0x23aaa2);}return _0x4274c2[_0x6234('0x16')](_0x23aaa2)[_0x6234('0x17')]();};}function respondWithResult(_0x1f0e90,_0x119640){_0x119640=_0x119640||0xc8;return function(_0x37bab2){if(_0x37bab2){return _0x1f0e90[_0x6234('0x16')](_0x119640)['json'](_0x37bab2);}};}function respondWithFilteredResult(_0x2f103b,_0x138893){return function(_0x5e1094){if(_0x5e1094){var _0x1877dc=typeof _0x138893['offset']===_0x6234('0x18')&&typeof _0x138893[_0x6234('0x19')]===_0x6234('0x18');var _0x5f3920=_0x5e1094[_0x6234('0x1a')];var _0x3d527a=_0x1877dc?0x0:_0x138893[_0x6234('0x1b')];var _0x1ebbca=_0x1877dc?_0x5e1094['count']:_0x138893[_0x6234('0x1b')]+_0x138893[_0x6234('0x19')];var _0x1e3c1f;if(_0x1ebbca>=_0x5f3920){_0x1ebbca=_0x5f3920;_0x1e3c1f=0xc8;}else{_0x1e3c1f=0xce;}_0x2f103b[_0x6234('0x16')](_0x1e3c1f);return _0x2f103b[_0x6234('0x1c')](_0x6234('0x1d'),_0x3d527a+'-'+_0x1ebbca+'/'+_0x5f3920)[_0x6234('0x1e')](_0x5e1094);}return null;};}function patchUpdates(_0x54e219){return function(_0x1becb7){try{jsonpatch[_0x6234('0x1f')](_0x1becb7,_0x54e219,!![]);}catch(_0x5e9ad5){return BPromise[_0x6234('0x20')](_0x5e9ad5);}return _0x1becb7['save']();};}function saveUpdates(_0x2b1395,_0x141d36){return function(_0x5bd25e){if(_0x5bd25e){return _0x5bd25e[_0x6234('0x21')](_0x2b1395)[_0x6234('0x22')](function(_0x1eeea8){return _0x1eeea8;});}return null;};}function removeEntity(_0xccf6dd,_0x214134){return function(_0x2a9966){if(_0x2a9966){return _0x2a9966['destroy']()[_0x6234('0x22')](function(){var _0x2ce268=_0x2a9966[_0x6234('0x23')]({'plain':!![]});var _0x37ee0d=_0x6234('0x24');return db[_0x6234('0x25')][_0x6234('0x26')]({'where':{'type':_0x37ee0d,'resourceId':_0x2ce268['id']}})[_0x6234('0x22')](function(){return _0x2a9966;});})[_0x6234('0x22')](function(){_0xccf6dd[_0x6234('0x16')](0xcc)[_0x6234('0x17')]();});}};}function handleEntityNotFound(_0x559b7a,_0x63af54){return function(_0x26e521){if(!_0x26e521){_0x559b7a[_0x6234('0x15')](0x194);}return _0x26e521;};}function handleError(_0x3211f3,_0x4f178d){_0x4f178d=_0x4f178d||0x1f4;return function(_0x212afe){logger[_0x6234('0x27')](_0x212afe[_0x6234('0x28')]);if(_0x212afe[_0x6234('0x29')]){delete _0x212afe[_0x6234('0x29')];}_0x3211f3[_0x6234('0x16')](_0x4f178d)['send'](_0x212afe);};}exports['index']=function(_0x838824,_0x14d0f9){var _0x262561={},_0x41fee4={},_0x5e1985={'count':0x0,'rows':[]};return db[_0x6234('0x2a')]['describe']()[_0x6234('0x22')](function(_0x19a20d){_0x41fee4[_0x6234('0x2b')]=_['keys'](_0x19a20d);_0x41fee4[_0x6234('0x2c')]=_[_0x6234('0x2d')](_0x838824['query']);_0x41fee4[_0x6234('0x2e')]=_[_0x6234('0x2f')](_0x41fee4['model'],_0x41fee4['query']);_0x262561[_0x6234('0x30')]=_[_0x6234('0x2f')](_0x41fee4[_0x6234('0x2b')],qs[_0x6234('0x31')](_0x838824[_0x6234('0x2c')][_0x6234('0x31')]));_0x262561[_0x6234('0x30')]=_0x262561[_0x6234('0x30')][_0x6234('0x32')]?_0x262561['attributes']:_0x41fee4[_0x6234('0x2b')];if(!_0x838824[_0x6234('0x2c')][_0x6234('0x33')](_0x6234('0x34'))){_0x262561[_0x6234('0x19')]=qs['limit'](_0x838824[_0x6234('0x2c')][_0x6234('0x19')]);_0x262561['offset']=qs['offset'](_0x838824[_0x6234('0x2c')][_0x6234('0x1b')]);}_0x262561[_0x6234('0x35')]=qs[_0x6234('0x36')](_0x838824[_0x6234('0x2c')][_0x6234('0x36')]);_0x262561['where']=qs[_0x6234('0x2e')](_[_0x6234('0x37')](_0x838824['query'],_0x41fee4[_0x6234('0x2e')]),_0x19a20d);if(_0x838824['query']['filter']){_0x262561[_0x6234('0x38')]=_[_0x6234('0x39')](_0x262561[_0x6234('0x38')],{'$or':_['map'](_0x262561[_0x6234('0x30')],function(_0x5b408a){var _0xd9d9b2={};_0xd9d9b2[_0x5b408a]={'$like':'%'+_0x838824['query'][_0x6234('0x3a')]+'%'};return _0xd9d9b2;})});}_0x262561=_[_0x6234('0x39')]({},_0x262561,_0x838824['options']);var _0x34e8e2={'where':_0x262561['where']};return db[_0x6234('0x2a')]['count'](_0x34e8e2)[_0x6234('0x22')](function(_0x3366a0){_0x5e1985[_0x6234('0x1a')]=_0x3366a0;if(_0x838824[_0x6234('0x2c')][_0x6234('0x3b')]){_0x262561[_0x6234('0x3c')]=[{'all':!![]}];}return db[_0x6234('0x2a')][_0x6234('0x3d')](_0x262561);})[_0x6234('0x22')](function(_0x2aecd7){_0x5e1985[_0x6234('0x3e')]=_0x2aecd7;return _0x5e1985;})[_0x6234('0x22')](respondWithFilteredResult(_0x14d0f9,_0x262561))[_0x6234('0x3f')](handleError(_0x14d0f9,null));})[_0x6234('0x3f')](handleError(_0x14d0f9,null));};exports[_0x6234('0x40')]=function(_0x547106,_0x144f67){var _0x474df1={'raw':![],'where':{'id':_0x547106[_0x6234('0x41')]['id']}},_0x4f6217={};_0x4f6217[_0x6234('0x2b')]=_[_0x6234('0x2d')](db[_0x6234('0x2a')]['rawAttributes']);_0x4f6217[_0x6234('0x2c')]=_[_0x6234('0x2d')](_0x547106[_0x6234('0x2c')]);_0x4f6217[_0x6234('0x2e')]=_[_0x6234('0x2f')](_0x4f6217[_0x6234('0x2b')],_0x4f6217[_0x6234('0x2c')]);_0x474df1[_0x6234('0x30')]=_['intersection'](_0x4f6217[_0x6234('0x2b')],qs[_0x6234('0x31')](_0x547106[_0x6234('0x2c')][_0x6234('0x31')]));_0x474df1['attributes']=_0x474df1['attributes'][_0x6234('0x32')]?_0x474df1[_0x6234('0x30')]:_0x4f6217[_0x6234('0x2b')];if(_0x547106['query']['includeAll']){_0x474df1[_0x6234('0x3c')]=[{'all':!![]}];}_0x474df1=_[_0x6234('0x39')]({},_0x474df1,_0x547106[_0x6234('0x42')]);return db[_0x6234('0x2a')]['find'](_0x474df1)[_0x6234('0x22')](handleEntityNotFound(_0x144f67,null))['then'](respondWithResult(_0x144f67,null))[_0x6234('0x3f')](handleError(_0x144f67,null));};exports[_0x6234('0x43')]=function(_0x5353c6,_0x4bccca){return db[_0x6234('0x2a')][_0x6234('0x43')](_0x5353c6[_0x6234('0x44')],{})['then'](function(_0x33f64c){var _0x5da07a=_0x5353c6[_0x6234('0x45')]['get']({'plain':!![]});if(!_0x5da07a)throw new Error(_0x6234('0x46'));if(_0x5da07a[_0x6234('0x47')]==='user'){var _0x38ef47=_0x33f64c[_0x6234('0x23')]({'plain':!![]});var _0x1d3c4b=_0x6234('0x24');return db['UserProfileSection'][_0x6234('0x48')]({'where':{'name':_0x1d3c4b,'userProfileId':_0x5da07a[_0x6234('0x49')]},'raw':!![]})['then'](function(_0x4d5204){if(_0x4d5204&&_0x4d5204[_0x6234('0x4a')]===0x0){return db[_0x6234('0x25')][_0x6234('0x43')]({'name':_0x38ef47[_0x6234('0x29')],'resourceId':_0x38ef47['id'],'type':_0x4d5204[_0x6234('0x29')],'sectionId':_0x4d5204['id']},{})[_0x6234('0x22')](function(){return _0x33f64c;});}else{return _0x33f64c;}})['catch'](function(_0x212b62){logger[_0x6234('0x27')](_0x6234('0x4b'),_0x212b62);throw _0x212b62;});}return _0x33f64c;})[_0x6234('0x22')](respondWithResult(_0x4bccca,0xc9))[_0x6234('0x3f')](handleError(_0x4bccca,null));};exports[_0x6234('0x21')]=function(_0x359d41,_0x38d35c){if(_0x359d41[_0x6234('0x44')]['id']){delete _0x359d41['body']['id'];}return db[_0x6234('0x2a')][_0x6234('0x48')]({'where':{'id':_0x359d41[_0x6234('0x41')]['id']}})[_0x6234('0x22')](handleEntityNotFound(_0x38d35c,null))[_0x6234('0x22')](saveUpdates(_0x359d41[_0x6234('0x44')],null))[_0x6234('0x22')](respondWithResult(_0x38d35c,null))['catch'](handleError(_0x38d35c,null));};exports[_0x6234('0x26')]=function(_0x578547,_0x31e140){return db[_0x6234('0x2a')][_0x6234('0x48')]({'where':{'id':_0x578547[_0x6234('0x41')]['id']}})[_0x6234('0x22')](handleEntityNotFound(_0x31e140,null))[_0x6234('0x22')](removeEntity(_0x31e140,null))[_0x6234('0x3f')](handleError(_0x31e140,null));};exports['describe']=function(_0xe11af1,_0x13da10){return db[_0x6234('0x2a')][_0x6234('0x4c')]()[_0x6234('0x22')](respondWithResult(_0x13da10,null))[_0x6234('0x3f')](handleError(_0x13da10,null));};exports[_0x6234('0x4d')]=function(_0xde38a9,_0x3ebc5d,_0x23de6a){return db[_0x6234('0x4e')]['find']({'where':{'id':_0xde38a9[_0x6234('0x41')]['id']}})[_0x6234('0x22')](handleEntityNotFound(_0x3ebc5d,null))[_0x6234('0x22')](function(_0x4875a4){if(_0x4875a4){return _0x4875a4[_0x6234('0x4d')](_0xde38a9['body'][_0x6234('0x4f')],_['omit'](_0xde38a9[_0x6234('0x44')],['ids','id'])||{});}})[_0x6234('0x22')](respondWithResult(_0x3ebc5d,null))[_0x6234('0x3f')](handleError(_0x3ebc5d,null));};exports['getContacts']=function(_0x5b9c34,_0x57f4be,_0x34f7dc){var _0x3d7259={};var _0x54a12d={};var _0x4b6bf2;var _0x472771;return db[_0x6234('0x2a')][_0x6234('0x50')]({'where':{'id':_0x5b9c34[_0x6234('0x41')]['id']}})[_0x6234('0x22')](handleEntityNotFound(_0x57f4be,null))[_0x6234('0x22')](function(_0x16b3c7){if(_0x16b3c7){_0x4b6bf2=_0x16b3c7;_0x54a12d[_0x6234('0x2b')]=_[_0x6234('0x2d')](db['CmContact'][_0x6234('0x51')]);_0x54a12d[_0x6234('0x2c')]=_[_0x6234('0x2d')](_0x5b9c34[_0x6234('0x2c')]);_0x54a12d[_0x6234('0x2e')]=_[_0x6234('0x2f')](_0x54a12d[_0x6234('0x2b')],_0x54a12d[_0x6234('0x2c')]);_0x3d7259['attributes']=_[_0x6234('0x2f')](_0x54a12d['model'],qs[_0x6234('0x31')](_0x5b9c34[_0x6234('0x2c')][_0x6234('0x31')]));_0x3d7259[_0x6234('0x30')]=_0x3d7259[_0x6234('0x30')][_0x6234('0x32')]?_0x3d7259['attributes']:_0x54a12d['model'];_0x3d7259[_0x6234('0x35')]=qs['sort'](_0x5b9c34[_0x6234('0x2c')][_0x6234('0x36')]);_0x3d7259[_0x6234('0x38')]=qs['filters'](_[_0x6234('0x37')](_0x5b9c34[_0x6234('0x2c')],_0x54a12d[_0x6234('0x2e')]));if(_0x5b9c34[_0x6234('0x2c')][_0x6234('0x3a')]){_0x3d7259['where']=_[_0x6234('0x39')](_0x3d7259[_0x6234('0x38')],{'$or':_[_0x6234('0x52')](_0x3d7259[_0x6234('0x30')],function(_0x200049){var _0x1333c1={};_0x1333c1[_0x200049]={'$like':'%'+_0x5b9c34[_0x6234('0x2c')][_0x6234('0x3a')]+'%'};return _0x1333c1;})});}_0x3d7259=_[_0x6234('0x39')]({},_0x3d7259,_0x5b9c34[_0x6234('0x42')]);return _0x4b6bf2[_0x6234('0x53')](_0x3d7259);}})['then'](function(_0x3aaa62){if(_0x3aaa62){_0x472771=_0x3aaa62['length'];if(!_0x5b9c34[_0x6234('0x2c')][_0x6234('0x33')]('nolimit')){_0x3d7259[_0x6234('0x19')]=qs[_0x6234('0x19')](_0x5b9c34['query']['limit']);_0x3d7259[_0x6234('0x1b')]=qs[_0x6234('0x1b')](_0x5b9c34[_0x6234('0x2c')][_0x6234('0x1b')]);}return _0x4b6bf2[_0x6234('0x53')](_0x3d7259);}})['then'](function(_0x5b0b75){if(_0x5b0b75){return _0x5b0b75?{'count':_0x472771,'rows':_0x5b0b75}:null;}})[_0x6234('0x22')](respondWithResult(_0x57f4be,null))['catch'](handleError(_0x57f4be,null));}; \ No newline at end of file +var _0xea6f=['stack','name','send','index','CmCompany','describe','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','ids','omit','getContacts','findOne','pick','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','json','apply','save','update','then','destroy','get','Companies','UserProfileResource'];(function(_0x2bb033,_0x517cda){var _0x1d47d5=function(_0x17f98c){while(--_0x17f98c){_0x2bb033['push'](_0x2bb033['shift']());}};_0x1d47d5(++_0x517cda);}(_0xea6f,0xd5));var _0xfea6=function(_0xdd59ff,_0x3288f7){_0xdd59ff=_0xdd59ff-0x0;var _0x3f187e=_0xea6f[_0xdd59ff];return _0x3f187e;};'use strict';var emlformat=require(_0xfea6('0x0'));var rimraf=require(_0xfea6('0x1'));var zipdir=require(_0xfea6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfea6('0x3'));var moment=require(_0xfea6('0x4'));var BPromise=require(_0xfea6('0x5'));var Mustache=require(_0xfea6('0x6'));var util=require(_0xfea6('0x7'));var path=require('path');var sox=require(_0xfea6('0x8'));var csv=require(_0xfea6('0x9'));var ejs=require(_0xfea6('0xa'));var fs=require('fs');var fs_extra=require(_0xfea6('0xb'));var _=require(_0xfea6('0xc'));var squel=require(_0xfea6('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfea6('0xe'));var authService=require(_0xfea6('0xf'));var qs=require(_0xfea6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfea6('0x11'));var logger=require('../../config/logger')(_0xfea6('0x12'));var utils=require(_0xfea6('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfea6('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x457a4e,_0x4f8732){_0x4f8732=_0x4f8732||0xcc;return function(_0x27ced1){if(_0x27ced1){return _0x457a4e[_0xfea6('0x15')](_0x4f8732);}return _0x457a4e['status'](_0x4f8732)[_0xfea6('0x16')]();};}function respondWithResult(_0x44cd2a,_0x104816){_0x104816=_0x104816||0xc8;return function(_0x3a6feb){if(_0x3a6feb){return _0x44cd2a[_0xfea6('0x17')](_0x104816)['json'](_0x3a6feb);}};}function respondWithFilteredResult(_0x3dedc4,_0x387c63){return function(_0x250b30){if(_0x250b30){var _0x58ccfc=typeof _0x387c63['offset']==='undefined'&&typeof _0x387c63[_0xfea6('0x18')]===_0xfea6('0x19');var _0x768454=_0x250b30[_0xfea6('0x1a')];var _0x344887=_0x58ccfc?0x0:_0x387c63['offset'];var _0x59958d=_0x58ccfc?_0x250b30['count']:_0x387c63[_0xfea6('0x1b')]+_0x387c63['limit'];var _0x1f6c2b;if(_0x59958d>=_0x768454){_0x59958d=_0x768454;_0x1f6c2b=0xc8;}else{_0x1f6c2b=0xce;}_0x3dedc4[_0xfea6('0x17')](_0x1f6c2b);return _0x3dedc4[_0xfea6('0x1c')](_0xfea6('0x1d'),_0x344887+'-'+_0x59958d+'/'+_0x768454)[_0xfea6('0x1e')](_0x250b30);}return null;};}function patchUpdates(_0x4f7902){return function(_0x2feab5){try{jsonpatch[_0xfea6('0x1f')](_0x2feab5,_0x4f7902,!![]);}catch(_0x29f530){return BPromise['reject'](_0x29f530);}return _0x2feab5[_0xfea6('0x20')]();};}function saveUpdates(_0x2aba02,_0x4c2750){return function(_0x1aba1f){if(_0x1aba1f){return _0x1aba1f[_0xfea6('0x21')](_0x2aba02)[_0xfea6('0x22')](function(_0x1c379d){return _0x1c379d;});}return null;};}function removeEntity(_0x5e4edc,_0x545edb){return function(_0x115eed){if(_0x115eed){return _0x115eed[_0xfea6('0x23')]()[_0xfea6('0x22')](function(){var _0x41b993=_0x115eed[_0xfea6('0x24')]({'plain':!![]});var _0x38d865=_0xfea6('0x25');return db[_0xfea6('0x26')]['destroy']({'where':{'type':_0x38d865,'resourceId':_0x41b993['id']}})[_0xfea6('0x22')](function(){return _0x115eed;});})['then'](function(){_0x5e4edc['status'](0xcc)[_0xfea6('0x16')]();});}};}function handleEntityNotFound(_0x2bf808,_0x1316fd){return function(_0x23e2ba){if(!_0x23e2ba){_0x2bf808[_0xfea6('0x15')](0x194);}return _0x23e2ba;};}function handleError(_0x37856c,_0x343034){_0x343034=_0x343034||0x1f4;return function(_0x5e3e03){logger['error'](_0x5e3e03[_0xfea6('0x27')]);if(_0x5e3e03[_0xfea6('0x28')]){delete _0x5e3e03[_0xfea6('0x28')];}_0x37856c[_0xfea6('0x17')](_0x343034)[_0xfea6('0x29')](_0x5e3e03);};}exports[_0xfea6('0x2a')]=function(_0x57e6a2,_0x558f4c){var _0x877e91={},_0x5d8d80={},_0x442f99={'count':0x0,'rows':[]};return db[_0xfea6('0x2b')][_0xfea6('0x2c')]()[_0xfea6('0x22')](function(_0x25ca62){_0x5d8d80['model']=_[_0xfea6('0x2d')](_0x25ca62);_0x5d8d80[_0xfea6('0x2e')]=_[_0xfea6('0x2d')](_0x57e6a2[_0xfea6('0x2e')]);_0x5d8d80[_0xfea6('0x2f')]=_[_0xfea6('0x30')](_0x5d8d80[_0xfea6('0x31')],_0x5d8d80[_0xfea6('0x2e')]);_0x877e91[_0xfea6('0x32')]=_['intersection'](_0x5d8d80[_0xfea6('0x31')],qs['fields'](_0x57e6a2[_0xfea6('0x2e')][_0xfea6('0x33')]));_0x877e91[_0xfea6('0x32')]=_0x877e91[_0xfea6('0x32')][_0xfea6('0x34')]?_0x877e91[_0xfea6('0x32')]:_0x5d8d80[_0xfea6('0x31')];if(!_0x57e6a2[_0xfea6('0x2e')][_0xfea6('0x35')](_0xfea6('0x36'))){_0x877e91[_0xfea6('0x18')]=qs[_0xfea6('0x18')](_0x57e6a2[_0xfea6('0x2e')][_0xfea6('0x18')]);_0x877e91[_0xfea6('0x1b')]=qs['offset'](_0x57e6a2[_0xfea6('0x2e')][_0xfea6('0x1b')]);}_0x877e91[_0xfea6('0x37')]=qs[_0xfea6('0x38')](_0x57e6a2['query'][_0xfea6('0x38')]);_0x877e91['where']=qs[_0xfea6('0x2f')](_['pick'](_0x57e6a2[_0xfea6('0x2e')],_0x5d8d80[_0xfea6('0x2f')]),_0x25ca62);if(_0x57e6a2[_0xfea6('0x2e')][_0xfea6('0x39')]){_0x877e91[_0xfea6('0x3a')]=_[_0xfea6('0x3b')](_0x877e91[_0xfea6('0x3a')],{'$or':_['map'](_0x877e91[_0xfea6('0x32')],function(_0x2248df){var _0x319d28={};_0x319d28[_0x2248df]={'$like':'%'+_0x57e6a2['query'][_0xfea6('0x39')]+'%'};return _0x319d28;})});}_0x877e91=_[_0xfea6('0x3b')]({},_0x877e91,_0x57e6a2['options']);var _0x523016={'where':_0x877e91[_0xfea6('0x3a')]};return db[_0xfea6('0x2b')][_0xfea6('0x1a')](_0x523016)[_0xfea6('0x22')](function(_0x5ca3b0){_0x442f99[_0xfea6('0x1a')]=_0x5ca3b0;if(_0x57e6a2['query'][_0xfea6('0x3c')]){_0x877e91[_0xfea6('0x3d')]=[{'all':!![]}];}return db['CmCompany'][_0xfea6('0x3e')](_0x877e91);})[_0xfea6('0x22')](function(_0x34762b){_0x442f99[_0xfea6('0x3f')]=_0x34762b;return _0x442f99;})['then'](respondWithFilteredResult(_0x558f4c,_0x877e91))[_0xfea6('0x40')](handleError(_0x558f4c,null));})['catch'](handleError(_0x558f4c,null));};exports[_0xfea6('0x41')]=function(_0x559635,_0x3811ad){var _0x1a3ec0={'raw':![],'where':{'id':_0x559635[_0xfea6('0x42')]['id']}},_0x29f13f={};_0x29f13f[_0xfea6('0x31')]=_[_0xfea6('0x2d')](db[_0xfea6('0x2b')][_0xfea6('0x43')]);_0x29f13f[_0xfea6('0x2e')]=_[_0xfea6('0x2d')](_0x559635[_0xfea6('0x2e')]);_0x29f13f[_0xfea6('0x2f')]=_[_0xfea6('0x30')](_0x29f13f[_0xfea6('0x31')],_0x29f13f[_0xfea6('0x2e')]);_0x1a3ec0['attributes']=_['intersection'](_0x29f13f['model'],qs[_0xfea6('0x33')](_0x559635[_0xfea6('0x2e')][_0xfea6('0x33')]));_0x1a3ec0[_0xfea6('0x32')]=_0x1a3ec0[_0xfea6('0x32')]['length']?_0x1a3ec0[_0xfea6('0x32')]:_0x29f13f[_0xfea6('0x31')];if(_0x559635[_0xfea6('0x2e')][_0xfea6('0x3c')]){_0x1a3ec0['include']=[{'all':!![]}];}_0x1a3ec0=_[_0xfea6('0x3b')]({},_0x1a3ec0,_0x559635[_0xfea6('0x44')]);return db[_0xfea6('0x2b')][_0xfea6('0x45')](_0x1a3ec0)[_0xfea6('0x22')](handleEntityNotFound(_0x3811ad,null))['then'](respondWithResult(_0x3811ad,null))[_0xfea6('0x40')](handleError(_0x3811ad,null));};exports[_0xfea6('0x46')]=function(_0x85fa5f,_0x4e84dc){return db[_0xfea6('0x2b')][_0xfea6('0x46')](_0x85fa5f['body'],{})[_0xfea6('0x22')](function(_0x22b889){var _0x309e28=_0x85fa5f[_0xfea6('0x47')]['get']({'plain':!![]});if(!_0x309e28)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x309e28['role']===_0xfea6('0x47')){var _0x347980=_0x22b889[_0xfea6('0x24')]({'plain':!![]});var _0x4482db=_0xfea6('0x25');return db[_0xfea6('0x48')][_0xfea6('0x45')]({'where':{'name':_0x4482db,'userProfileId':_0x309e28['userProfileId']},'raw':!![]})[_0xfea6('0x22')](function(_0x19300d){if(_0x19300d&&_0x19300d[_0xfea6('0x49')]===0x0){return db['UserProfileResource'][_0xfea6('0x46')]({'name':_0x347980[_0xfea6('0x28')],'resourceId':_0x347980['id'],'type':_0x19300d[_0xfea6('0x28')],'sectionId':_0x19300d['id']},{})[_0xfea6('0x22')](function(){return _0x22b889;});}else{return _0x22b889;}})[_0xfea6('0x40')](function(_0x38f598){logger[_0xfea6('0x4a')](_0xfea6('0x4b'),_0x38f598);throw _0x38f598;});}return _0x22b889;})[_0xfea6('0x22')](respondWithResult(_0x4e84dc,0xc9))[_0xfea6('0x40')](handleError(_0x4e84dc,null));};exports['update']=function(_0x23f34d,_0x267745){if(_0x23f34d[_0xfea6('0x4c')]['id']){delete _0x23f34d[_0xfea6('0x4c')]['id'];}return db[_0xfea6('0x2b')][_0xfea6('0x45')]({'where':{'id':_0x23f34d[_0xfea6('0x42')]['id']}})[_0xfea6('0x22')](handleEntityNotFound(_0x267745,null))[_0xfea6('0x22')](saveUpdates(_0x23f34d['body'],null))['then'](respondWithResult(_0x267745,null))[_0xfea6('0x40')](handleError(_0x267745,null));};exports[_0xfea6('0x23')]=function(_0x23fef9,_0x800164){return db[_0xfea6('0x2b')]['find']({'where':{'id':_0x23fef9[_0xfea6('0x42')]['id']}})[_0xfea6('0x22')](handleEntityNotFound(_0x800164,null))[_0xfea6('0x22')](removeEntity(_0x800164,null))['catch'](handleError(_0x800164,null));};exports[_0xfea6('0x2c')]=function(_0x286095,_0x410546){return db['CmCompany'][_0xfea6('0x2c')]()['then'](respondWithResult(_0x410546,null))[_0xfea6('0x40')](handleError(_0x410546,null));};exports[_0xfea6('0x4d')]=function(_0x1d6a89,_0x307b6b,_0x556c22){return db[_0xfea6('0x4e')][_0xfea6('0x45')]({'where':{'id':_0x1d6a89[_0xfea6('0x42')]['id']}})[_0xfea6('0x22')](handleEntityNotFound(_0x307b6b,null))[_0xfea6('0x22')](function(_0x2b4a9f){if(_0x2b4a9f){return _0x2b4a9f[_0xfea6('0x4d')](_0x1d6a89['body'][_0xfea6('0x4f')],_[_0xfea6('0x50')](_0x1d6a89[_0xfea6('0x4c')],[_0xfea6('0x4f'),'id'])||{});}})[_0xfea6('0x22')](respondWithResult(_0x307b6b,null))[_0xfea6('0x40')](handleError(_0x307b6b,null));};exports[_0xfea6('0x51')]=function(_0x173da4,_0x53c9c4,_0x4e4adc){var _0x1054a8={};var _0x257201={};var _0x179a28;var _0x23d6e4;return db['CmCompany'][_0xfea6('0x52')]({'where':{'id':_0x173da4[_0xfea6('0x42')]['id']}})['then'](handleEntityNotFound(_0x53c9c4,null))[_0xfea6('0x22')](function(_0x377bfd){if(_0x377bfd){_0x179a28=_0x377bfd;_0x257201[_0xfea6('0x31')]=_[_0xfea6('0x2d')](db[_0xfea6('0x4e')]['rawAttributes']);_0x257201['query']=_[_0xfea6('0x2d')](_0x173da4[_0xfea6('0x2e')]);_0x257201[_0xfea6('0x2f')]=_[_0xfea6('0x30')](_0x257201[_0xfea6('0x31')],_0x257201[_0xfea6('0x2e')]);_0x1054a8[_0xfea6('0x32')]=_[_0xfea6('0x30')](_0x257201[_0xfea6('0x31')],qs['fields'](_0x173da4[_0xfea6('0x2e')][_0xfea6('0x33')]));_0x1054a8[_0xfea6('0x32')]=_0x1054a8[_0xfea6('0x32')]['length']?_0x1054a8[_0xfea6('0x32')]:_0x257201[_0xfea6('0x31')];_0x1054a8[_0xfea6('0x37')]=qs[_0xfea6('0x38')](_0x173da4[_0xfea6('0x2e')][_0xfea6('0x38')]);_0x1054a8[_0xfea6('0x3a')]=qs[_0xfea6('0x2f')](_[_0xfea6('0x53')](_0x173da4[_0xfea6('0x2e')],_0x257201[_0xfea6('0x2f')]));if(_0x173da4[_0xfea6('0x2e')][_0xfea6('0x39')]){_0x1054a8[_0xfea6('0x3a')]=_[_0xfea6('0x3b')](_0x1054a8['where'],{'$or':_['map'](_0x1054a8[_0xfea6('0x32')],function(_0x46e658){var _0xd135ff={};_0xd135ff[_0x46e658]={'$like':'%'+_0x173da4['query'][_0xfea6('0x39')]+'%'};return _0xd135ff;})});}_0x1054a8=_[_0xfea6('0x3b')]({},_0x1054a8,_0x173da4[_0xfea6('0x44')]);return _0x179a28['getContacts'](_0x1054a8);}})[_0xfea6('0x22')](function(_0x3d7efa){if(_0x3d7efa){_0x23d6e4=_0x3d7efa[_0xfea6('0x34')];if(!_0x173da4['query'][_0xfea6('0x35')](_0xfea6('0x36'))){_0x1054a8[_0xfea6('0x18')]=qs[_0xfea6('0x18')](_0x173da4[_0xfea6('0x2e')][_0xfea6('0x18')]);_0x1054a8['offset']=qs[_0xfea6('0x1b')](_0x173da4[_0xfea6('0x2e')][_0xfea6('0x1b')]);}return _0x179a28[_0xfea6('0x51')](_0x1054a8);}})[_0xfea6('0x22')](function(_0x264beb){if(_0x264beb){return _0x264beb?{'count':_0x23d6e4,'rows':_0x264beb}:null;}})[_0xfea6('0x22')](respondWithResult(_0x53c9c4,null))['catch'](handleError(_0x53c9c4,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index c3a7a3d..760f8d0 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 _0x3736=['moment','bluebird','path','rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies','util','api'];(function(_0x497144,_0x2f4865){var _0x5cf6df=function(_0x19f789){while(--_0x19f789){_0x497144['push'](_0x497144['shift']());}};_0x5cf6df(++_0x2f4865);}(_0x3736,0xb9));var _0x6373=function(_0x389ecc,_0xb62531){_0x389ecc=_0x389ecc-0x0;var _0x45133e=_0x3736[_0x389ecc];return _0x45133e;};'use strict';var _=require('lodash');var util=require(_0x6373('0x0'));var logger=require('../../config/logger')(_0x6373('0x1'));var moment=require(_0x6373('0x2'));var BPromise=require(_0x6373('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6373('0x4'));var rimraf=require(_0x6373('0x5'));var config=require('../../config/environment');var attributes=require(_0x6373('0x6'));module[_0x6373('0x7')]=function(_0x2779af,_0x111144){return _0x2779af[_0x6373('0x8')](_0x6373('0x9'),attributes,{'tableName':_0x6373('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2831=['moment','rimraf','../../config/environment','./cmCompany.attributes','exports','define','cm_companies','lodash','util','api'];(function(_0x54a2e4,_0x1ff92c){var _0x4742d0=function(_0x147a6f){while(--_0x147a6f){_0x54a2e4['push'](_0x54a2e4['shift']());}};_0x4742d0(++_0x1ff92c);}(_0x2831,0xed));var _0x1283=function(_0x390785,_0x55f296){_0x390785=_0x390785-0x0;var _0x476272=_0x2831[_0x390785];return _0x476272;};'use strict';var _=require(_0x1283('0x0'));var util=require(_0x1283('0x1'));var logger=require('../../config/logger')(_0x1283('0x2'));var moment=require(_0x1283('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1283('0x4'));var config=require(_0x1283('0x5'));var attributes=require(_0x1283('0x6'));module[_0x1283('0x7')]=function(_0x142860,_0x4453e3){return _0x142860[_0x1283('0x8')]('CmCompany',attributes,{'tableName':_0x1283('0x9'),'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 1009301..5907a96 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 _0x65c0=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message'];(function(_0x29fd52,_0x28fe66){var _0x4683d9=function(_0x4c0e0a){while(--_0x4c0e0a){_0x29fd52['push'](_0x29fd52['shift']());}};_0x4683d9(++_0x28fe66);}(_0x65c0,0x115));var _0x065c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x65c0[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x065c('0x0'));var util=require(_0x065c('0x1'));var moment=require(_0x065c('0x2'));var BPromise=require(_0x065c('0x3'));var rs=require(_0x065c('0x4'));var fs=require('fs');var Redis=require(_0x065c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x065c('0x6'));var logger=require(_0x065c('0x7'))(_0x065c('0x8'));var config=require(_0x065c('0x9'));var jayson=require(_0x065c('0xa'));var client=jayson[_0x065c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x360f7b,_0x2398b3,_0x2d7bac){return new BPromise(function(_0x3a2095,_0x45309e){return client[_0x065c('0xc')](_0x360f7b,_0x2d7bac)[_0x065c('0xd')](function(_0xdd62bd){logger[_0x065c('0xe')]('CmCompany,\x20%s,\x20%s',_0x2398b3,_0x065c('0xf'));logger['debug'](_0x065c('0x10'),_0x2398b3,_0x065c('0xf'),JSON[_0x065c('0x11')](_0xdd62bd));if(_0xdd62bd[_0x065c('0x12')]){if(_0xdd62bd[_0x065c('0x12')][_0x065c('0x13')]===0x1f4){logger['error'](_0x065c('0x14'),_0x2398b3,_0xdd62bd[_0x065c('0x12')][_0x065c('0x15')]);return _0x45309e(_0xdd62bd['error']['message']);}logger['error'](_0x065c('0x14'),_0x2398b3,_0xdd62bd['error'][_0x065c('0x15')]);return _0x3a2095(_0xdd62bd['error']['message']);}else{logger[_0x065c('0xe')](_0x065c('0x14'),_0x2398b3,_0x065c('0xf'));_0x3a2095(_0xdd62bd[_0x065c('0x16')][_0x065c('0x15')]);}})['catch'](function(_0x475d70){logger[_0x065c('0x12')](_0x065c('0x14'),_0x2398b3,_0x475d70);_0x45309e(_0x475d70);});});} \ No newline at end of file +var _0x3201=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x310319,_0x2acf87){var _0x1d9d4c=function(_0x1f67dd){while(--_0x1f67dd){_0x310319['push'](_0x310319['shift']());}};_0x1d9d4c(++_0x2acf87);}(_0x3201,0x17c));var _0x1320=function(_0x2a8c21,_0x163576){_0x2a8c21=_0x2a8c21-0x0;var _0x5f3061=_0x3201[_0x2a8c21];return _0x5f3061;};'use strict';var _=require(_0x1320('0x0'));var util=require(_0x1320('0x1'));var moment=require(_0x1320('0x2'));var BPromise=require(_0x1320('0x3'));var rs=require(_0x1320('0x4'));var fs=require('fs');var Redis=require(_0x1320('0x5'));var db=require(_0x1320('0x6'))['db'];var utils=require(_0x1320('0x7'));var logger=require(_0x1320('0x8'))(_0x1320('0x9'));var config=require(_0x1320('0xa'));var jayson=require(_0x1320('0xb'));var client=jayson[_0x1320('0xc')][_0x1320('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3ae9d7,_0xf3decf,_0x3ccb60){return new BPromise(function(_0xbbfcb4,_0x30b161){return client['request'](_0x3ae9d7,_0x3ccb60)[_0x1320('0xe')](function(_0x3fca3a){logger[_0x1320('0xf')](_0x1320('0x10'),_0xf3decf,'request\x20sent');logger[_0x1320('0x11')](_0x1320('0x12'),_0xf3decf,_0x1320('0x13'),JSON['stringify'](_0x3fca3a));if(_0x3fca3a[_0x1320('0x14')]){if(_0x3fca3a[_0x1320('0x14')][_0x1320('0x15')]===0x1f4){logger[_0x1320('0x14')]('CmCompany,\x20%s,\x20%s',_0xf3decf,_0x3fca3a[_0x1320('0x14')][_0x1320('0x16')]);return _0x30b161(_0x3fca3a['error'][_0x1320('0x16')]);}logger[_0x1320('0x14')](_0x1320('0x10'),_0xf3decf,_0x3fca3a['error']['message']);return _0xbbfcb4(_0x3fca3a[_0x1320('0x14')][_0x1320('0x16')]);}else{logger[_0x1320('0xf')](_0x1320('0x10'),_0xf3decf,_0x1320('0x13'));_0xbbfcb4(_0x3fca3a[_0x1320('0x17')][_0x1320('0x16')]);}})[_0x1320('0x18')](function(_0x29ee7b){logger[_0x1320('0x14')](_0x1320('0x10'),_0xf3decf,_0x29ee7b);_0x30b161(_0x29ee7b);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 99590a6..9e1b805 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 _0x64a4=['isAuthenticated','index','/describe','describe','/:id','/:id/contacts','getContacts','create','post','addContacts','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x3ff4a3,_0xa5bfa6){var _0x38676f=function(_0x3ab2b1){while(--_0x3ab2b1){_0x3ff4a3['push'](_0x3ff4a3['shift']());}};_0x38676f(++_0xa5bfa6);}(_0x64a4,0x9e));var _0x464a=function(_0x8639c5,_0x38ce0c){_0x8639c5=_0x8639c5-0x0;var _0x5972c3=_0x64a4[_0x8639c5];return _0x5972c3;};'use strict';var multer=require(_0x464a('0x0'));var util=require(_0x464a('0x1'));var path=require(_0x464a('0x2'));var timeout=require(_0x464a('0x3'));var express=require(_0x464a('0x4'));var router=express[_0x464a('0x5')]();var fs_extra=require(_0x464a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x464a('0x7'));var config=require(_0x464a('0x8'));var controller=require('./cmCompany.controller');router[_0x464a('0x9')]('/',auth[_0x464a('0xa')](),controller[_0x464a('0xb')]);router[_0x464a('0x9')](_0x464a('0xc'),auth[_0x464a('0xa')](),controller[_0x464a('0xd')]);router[_0x464a('0x9')](_0x464a('0xe'),auth[_0x464a('0xa')](),controller['show']);router[_0x464a('0x9')](_0x464a('0xf'),auth[_0x464a('0xa')](),controller[_0x464a('0x10')]);router['post']('/',auth[_0x464a('0xa')](),controller[_0x464a('0x11')]);router[_0x464a('0x12')]('/:id/contacts',auth[_0x464a('0xa')](),controller[_0x464a('0x13')]);router[_0x464a('0x14')](_0x464a('0xe'),auth[_0x464a('0xa')](),controller[_0x464a('0x15')]);router[_0x464a('0x16')](_0x464a('0xe'),auth[_0x464a('0xa')](),controller[_0x464a('0x17')]);module['exports']=router; \ No newline at end of file +var _0x3cca=['getContacts','post','create','addContacts','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','/:id/contacts'];(function(_0x1a9ed0,_0x1085fc){var _0x47bbd6=function(_0x27bd1c){while(--_0x27bd1c){_0x1a9ed0['push'](_0x1a9ed0['shift']());}};_0x47bbd6(++_0x1085fc);}(_0x3cca,0xce));var _0xa3cc=function(_0x5a76f7,_0xbc12b9){_0x5a76f7=_0x5a76f7-0x0;var _0x2f23d3=_0x3cca[_0x5a76f7];return _0x2f23d3;};'use strict';var multer=require(_0xa3cc('0x0'));var util=require(_0xa3cc('0x1'));var path=require(_0xa3cc('0x2'));var timeout=require('connect-timeout');var express=require(_0xa3cc('0x3'));var router=express[_0xa3cc('0x4')]();var fs_extra=require(_0xa3cc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa3cc('0x6'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router['get']('/',auth[_0xa3cc('0x7')](),controller[_0xa3cc('0x8')]);router[_0xa3cc('0x9')](_0xa3cc('0xa'),auth['isAuthenticated'](),controller[_0xa3cc('0xb')]);router[_0xa3cc('0x9')](_0xa3cc('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa3cc('0x9')](_0xa3cc('0xd'),auth[_0xa3cc('0x7')](),controller[_0xa3cc('0xe')]);router[_0xa3cc('0xf')]('/',auth[_0xa3cc('0x7')](),controller[_0xa3cc('0x10')]);router[_0xa3cc('0xf')](_0xa3cc('0xd'),auth['isAuthenticated'](),controller[_0xa3cc('0x11')]);router[_0xa3cc('0x12')](_0xa3cc('0xc'),auth[_0xa3cc('0x7')](),controller['update']);router[_0xa3cc('0x13')](_0xa3cc('0xc'),auth['isAuthenticated'](),controller[_0xa3cc('0x14')]);module[_0xa3cc('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 7a7422a..6a75745 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 _0x3da4=['UNSIGNED','NOW','lodash','sequelize','STRING','TEXT'];(function(_0x5b2410,_0x1ed938){var _0x3f2609=function(_0xf5de82){while(--_0xf5de82){_0x5b2410['push'](_0x5b2410['shift']());}};_0x3f2609(++_0x1ed938);}(_0x3da4,0x14c));var _0x43da=function(_0x22fc38,_0x367834){_0x22fc38=_0x22fc38-0x0;var _0x1671fd=_0x3da4[_0x22fc38];return _0x1671fd;};'use strict';var _=require(_0x43da('0x0'));var Sequelize=require(_0x43da('0x1'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x43da('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x43da('0x3')]},'phone':{'type':Sequelize[_0x43da('0x2')]},'mobile':{'type':Sequelize[_0x43da('0x2')]},'fax':{'type':Sequelize[_0x43da('0x2')]},'email':{'type':Sequelize[_0x43da('0x2')]},'url':{'type':Sequelize[_0x43da('0x2')]},'facebook':{'type':Sequelize[_0x43da('0x2')]},'fb_data':{'type':Sequelize[_0x43da('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x43da('0x2')]},'line':{'type':Sequelize[_0x43da('0x2')]},'wechat':{'type':Sequelize[_0x43da('0x2')]},'telegram':{'type':Sequelize[_0x43da('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x43da('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x43da('0x5')]}}; \ No newline at end of file +var _0x2136=['DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x2ab64d,_0x393c32){var _0xa365c2=function(_0x5087ce){while(--_0x5087ce){_0x2ab64d['push'](_0x2ab64d['shift']());}};_0xa365c2(++_0x393c32);}(_0x2136,0x152));var _0x6213=function(_0x45ccf6,_0x187595){_0x45ccf6=_0x45ccf6-0x0;var _0x140e18=_0x2136[_0x45ccf6];return _0x140e18;};'use strict';var _=require(_0x6213('0x0'));var Sequelize=require(_0x6213('0x1'));module[_0x6213('0x2')]={'firstName':{'type':Sequelize[_0x6213('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x6213('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x6213('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6213('0x4')]},'phone':{'type':Sequelize[_0x6213('0x3')]},'mobile':{'type':Sequelize[_0x6213('0x3')]},'fax':{'type':Sequelize[_0x6213('0x3')]},'email':{'type':Sequelize[_0x6213('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x6213('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x6213('0x3')]},'skype':{'type':Sequelize[_0x6213('0x3')]},'teams':{'type':Sequelize[_0x6213('0x3')]},'viber':{'type':Sequelize[_0x6213('0x3')]},'line':{'type':Sequelize[_0x6213('0x3')]},'wechat':{'type':Sequelize[_0x6213('0x3')]},'telegram':{'type':Sequelize[_0x6213('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x6213('0x5')],'defaultValue':Sequelize[_0x6213('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index f07dbe5..079efd6 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 _0x1c12=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','./cmContact.socket','register','sendStatus','status','end','json','undefined','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','CmContact','describe','keys','length','cf_','CmCustomField','findOne','trimStart','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','where','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','dateOfBirth','datetime','castTo','buildExpression','text','start','filter','push','isEmpty','ListId','Contact','\x20=\x20?','tag','isArray','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','user','some','User','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','role','agent','toString','sequelize','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.email','c.ListId','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','params','tags','startsWith','columnName','displayName','findAll','alias','custom','values','body','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','create','bulkCreate','each','duplicates','findOrCreate','spread','get','$and','omit','format','cf_%d','pickBy','setFields','id\x20=\x20?','phone','getTags','rawAttributes','pick','nolimit','setTags','getHoppers','includeAll','include','ContactId','options','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','filename','chmodSync','0777','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','upload','createReadStream','file','parse','meta','binding','No\x20firstName\x20column\x20specified','child_process','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','pid','error\x20child\x20process','mail','sms','openchannel','whatsapp','voice','-createdAt','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','destination','starttime','endtime','duration','note','createdAt','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','startCase','chat','Website','Account','disposition','thirdDisposition','key','customerPort','deviceModel','osName','ratingType','substatus','externalUrl','threadId','Interaction','Owner','all','flatten','reverse','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0xb647d5,_0x221e8b){var _0x8e4c08=function(_0x51447c){while(--_0x51447c){_0xb647d5['push'](_0xb647d5['shift']());}};_0x8e4c08(++_0x221e8b);}(_0x1c12,0x115));var _0x21c1=function(_0x2eb11d,_0x1fe615){_0x2eb11d=_0x2eb11d-0x0;var _0x5c21ec=_0x1c12[_0x2eb11d];return _0x5c21ec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21c1('0x0'));var zipdir=require(_0x21c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21c1('0x2'));var moment=require(_0x21c1('0x3'));var BPromise=require(_0x21c1('0x4'));var Mustache=require(_0x21c1('0x5'));var util=require(_0x21c1('0x6'));var path=require(_0x21c1('0x7'));var sox=require('sox');var csv=require(_0x21c1('0x8'));var ejs=require(_0x21c1('0x9'));var fs=require('fs');var fs_extra=require(_0x21c1('0xa'));var _=require(_0x21c1('0xb'));var squel=require(_0x21c1('0xc'));var crypto=require('crypto');var jsforce=require(_0x21c1('0xd'));var deskjs=require(_0x21c1('0xe'));var toCsv=require(_0x21c1('0x8'));var querystring=require(_0x21c1('0xf'));var Papa=require(_0x21c1('0x10'));var Redis=require(_0x21c1('0x11'));var authService=require(_0x21c1('0x12'));var qs=require(_0x21c1('0x13'));var as=require(_0x21c1('0x14'));var hardwareService=require(_0x21c1('0x15'));var logger=require(_0x21c1('0x16'))(_0x21c1('0x17'));var utils=require(_0x21c1('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x21c1('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x21c1('0x1a')]));require(_0x21c1('0x1b'))[_0x21c1('0x1c')](socket);function respondWithStatusCode(_0x5980d6,_0xa83c92){_0xa83c92=_0xa83c92||0xcc;return function(_0x1b0fa3){if(_0x1b0fa3){return _0x5980d6[_0x21c1('0x1d')](_0xa83c92);}return _0x5980d6[_0x21c1('0x1e')](_0xa83c92)[_0x21c1('0x1f')]();};}function respondWithResult(_0x23c892,_0x51fe58){_0x51fe58=_0x51fe58||0xc8;return function(_0x21957c){if(_0x21957c){return _0x23c892[_0x21c1('0x1e')](_0x51fe58)[_0x21c1('0x20')](_0x21957c);}};}function respondWithFilteredResult(_0x30ff69,_0x52a3cc){return function(_0x2fe463){if(_0x2fe463){var _0x205448=typeof _0x52a3cc['offset']===_0x21c1('0x21')&&typeof _0x52a3cc['limit']==='undefined';var _0x2d5ef6=_0x2fe463[_0x21c1('0x22')];var _0x3e506f=_0x205448?0x0:_0x52a3cc[_0x21c1('0x23')];var _0x1d3ffa=_0x205448?_0x2fe463[_0x21c1('0x22')]:_0x52a3cc[_0x21c1('0x23')]+_0x52a3cc['limit'];var _0x195ab0;if(_0x1d3ffa>=_0x2d5ef6){_0x1d3ffa=_0x2d5ef6;_0x195ab0=0xc8;}else{_0x195ab0=0xce;}_0x30ff69[_0x21c1('0x1e')](_0x195ab0);return _0x30ff69['set'](_0x21c1('0x24'),_0x3e506f+'-'+_0x1d3ffa+'/'+_0x2d5ef6)['json'](_0x2fe463);}return null;};}function patchUpdates(_0x40d5e3){return function(_0x1a4726){try{jsonpatch['apply'](_0x1a4726,_0x40d5e3,!![]);}catch(_0x5a41e9){return BPromise[_0x21c1('0x25')](_0x5a41e9);}return _0x1a4726[_0x21c1('0x26')]();};}function saveUpdates(_0x1e68aa,_0x543444){return function(_0x12b02d){if(_0x12b02d){return _0x12b02d[_0x21c1('0x27')](_0x1e68aa)[_0x21c1('0x28')](function(_0x2e150e){return _0x2e150e;});}return null;};}function removeEntity(_0x31919b,_0x311418){return function(_0x2089b2){if(_0x2089b2){return _0x2089b2[_0x21c1('0x29')]()['then'](function(){_0x31919b[_0x21c1('0x1e')](0xcc)[_0x21c1('0x1f')]();});}};}function handleEntityNotFound(_0x3550ec,_0x263d0f){return function(_0x3c4ee4){if(!_0x3c4ee4){_0x3550ec[_0x21c1('0x1d')](0x194);}return _0x3c4ee4;};}function handleError(_0x31e5e2,_0x4bf23c){_0x4bf23c=_0x4bf23c||0x1f4;return function(_0x189cb1){logger[_0x21c1('0x2a')](_0x189cb1[_0x21c1('0x2b')]);if(_0x189cb1['name']){delete _0x189cb1[_0x21c1('0x2c')];}_0x31e5e2['status'](_0x4bf23c)[_0x21c1('0x2d')](_0x189cb1);};}exports[_0x21c1('0x2e')]=function(_0x4660bf,_0x439629){var _0x453856={},_0xe3c916={},_0xf48630={'count':0x0,'rows':[]};return db[_0x21c1('0x2f')][_0x21c1('0x30')]()[_0x21c1('0x28')](function(_0x3b7f6f){var _0x29da47=[];for(var _0x3602fc=0x0;_0x3602fc0x1){_0x3e62af['or'](_0x21c1('0x6b'),qs[_0x21c1('0x6c')](_0x5581df),null);}else{if(qs[_0x21c1('0x6d')](_0x5581df)){_0x3e62af['or'](_0x21c1('0x6e'),_0x5581df+'%');_0x3e62af['or'](_0x21c1('0x6f'),_0x5581df+'%');_0x3e62af['or'](_0x21c1('0x70'),_0x5581df+'%');_0x3e62af['or']('c.fax\x20LIKE\x20?',_0x5581df+'%');}else if(qs['isEmail'](_0x5581df)){_0x3e62af['or'](_0x21c1('0x71'),_0x5581df+'%');}else{_0x3e62af['or'](_0x21c1('0x72'),'%'+_0x5581df+'%');_0x3e62af['or'](_0x21c1('0x73'),'%'+_0x5581df+'%');_0x3e62af['or'](_0x21c1('0x71'),'%'+_0x5581df+'%');}}}}_0xe22d5d[_0x21c1('0x4e')](_0x3e62af);_0xe22d5d[_0x21c1('0x74')](_0x21c1('0x75'));var _0x2e426e={'type':db[_0x21c1('0x76')][_0x21c1('0x77')][_0x21c1('0x78')],'raw':!![]};var _0x2542d1=_0xe22d5d[_0x21c1('0x79')]()['field'](_0x21c1('0x75'));if(_0x453856[_0x21c1('0x41')]){_0x453856[_0x21c1('0x41')][_0x21c1('0x5a')](function(_0x9ce2a8){_0xe22d5d[_0x21c1('0x41')]('c.'+_0x9ce2a8[0x0],_0x9ce2a8[0x1]===_0x21c1('0x7a')?![]:!![]);});}if(!_['isEmpty'](_0x3381f5)){_0xe22d5d[_0x21c1('0x7b')](_0x2abb0b);_0x2542d1[_0x21c1('0x4e')](_0x21c1('0x7c'),_0x3381f5);}BPromise[_0x21c1('0x7d')]()[_0x21c1('0x28')](function(){if(!_0x34e72a)return;if(_0x4660bf[_0x21c1('0x7e')]['role']!=='agent')return;if(!_[_0x21c1('0x7f')](_0x34e72a[_0x21c1('0x54')],['field',_0x21c1('0x80')])){return _0x4660bf[_0x21c1('0x7e')][_0x21c1('0x81')]({'attributes':['id'],'raw':!![]})[_0x21c1('0x28')](function(_0x115bfa){if(_['isEmpty'](_0x115bfa)){_0x2542d1[_0x21c1('0x4e')](_0x21c1('0x82'));_0xe22d5d[_0x21c1('0x4e')](_0x21c1('0x82'));}else{_0x2542d1['where'](_0x21c1('0x83'),_[_0x21c1('0x59')](_0x115bfa,'id'));_0xe22d5d[_0x21c1('0x4e')](_0x21c1('0x83'),_['map'](_0x115bfa,'id'));}});}})[_0x21c1('0x28')](function(){if(_0x4660bf['user'][_0x21c1('0x84')]===_0x21c1('0x85')&&!_0x34e72a&&!_0x4660bf[_0x21c1('0x3a')][_0x21c1('0x66')])return[];return db['sequelize'][_0x21c1('0x3a')](_0x2542d1[_0x21c1('0x86')](),_0x2e426e);})[_0x21c1('0x28')](function(_0x235483){_0xf48630[_0x21c1('0x22')]=_0x235483['length'];if(_0xf48630[_0x21c1('0x22')]===0x0)return[];return db[_0x21c1('0x87')][_0x21c1('0x3a')](_0x297e01[_0x21c1('0x86')](),_0x2e426e)[_0x21c1('0x28')](function(_0xa679fd){_0x6dffd7=_[_0x21c1('0x88')](_0xa679fd,'id');_0x2e426e=_[_0x21c1('0x89')](_0x2e426e,{'model':db[_0x21c1('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4660bf[_0x21c1('0x3a')][_0x21c1('0x3e')]){_0x453856[_0x21c1('0x3d')][_0x21c1('0x5a')](function(_0x14e4d2){_0xe22d5d[_0x21c1('0x43')]('c.'+_0x14e4d2);});}else{_0xe22d5d[_0x21c1('0x43')](_0x21c1('0x75'));_0xe22d5d['field'](_0x21c1('0x8a'));_0xe22d5d[_0x21c1('0x43')](_0x21c1('0x8b'));_0xe22d5d['field'](_0x21c1('0x8c'));_0xe22d5d[_0x21c1('0x43')](_0x21c1('0x8d'));_0xe22d5d['field']('c.fax');_0xe22d5d[_0x21c1('0x43')](_0x21c1('0x8e'));_0xe22d5d[_0x21c1('0x43')](_0x21c1('0x8f'));_0xe22d5d[_0x21c1('0x43')]('c.createdAt');_0xe22d5d[_0x21c1('0x43')]('c.deletedAt');_0xe22d5d['field'](_0x21c1('0x90'));_0xe22d5d[_0x21c1('0x43')](_0x21c1('0x91'),_0x21c1('0x92'));}if(_0x453856[_0x21c1('0x40')])_0xe22d5d[_0x21c1('0x40')](_0x453856[_0x21c1('0x40')]);if(_0x453856[_0x21c1('0x23')])_0xe22d5d[_0x21c1('0x23')](_0x453856[_0x21c1('0x23')]);return db['sequelize']['query'](_0xe22d5d[_0x21c1('0x86')](),_0x2e426e);});})[_0x21c1('0x28')](function(_0x58e08c){_0x58e08c['forEach'](function(_0x23af4f){if(_0x23af4f['TagIds']){_0x23af4f[_0x21c1('0x93')]=[];_0x23af4f[_0x21c1('0x92')][_0x21c1('0x58')](',')[_0x21c1('0x5a')](function(_0xc8544e){_0x23af4f[_0x21c1('0x93')][_0x21c1('0x64')](_0x6dffd7[_0xc8544e]);});}delete _0x23af4f['TagIds'];});_0xf48630[_0x21c1('0x94')]=_0x58e08c;return _0xf48630;})[_0x21c1('0x28')](respondWithFilteredResult(_0x439629,_0x453856));})[_0x21c1('0x95')](handleError(_0x439629,null));};exports[_0x21c1('0x29')]=function(_0x5f51cd,_0x46dfe3){return db['CmContact'][_0x21c1('0x55')]({'where':{'id':_0x5f51cd[_0x21c1('0x96')]['id']}})[_0x21c1('0x28')](handleEntityNotFound(_0x46dfe3,null))['then'](removeEntity(_0x46dfe3,null))[_0x21c1('0x95')](handleError(_0x46dfe3,null));};exports['describe']=function(_0x2e706c,_0x5aacc1){return db[_0x21c1('0x2f')][_0x21c1('0x30')]()[_0x21c1('0x28')](function(_0x2b700f){delete _0x2b700f[_0x21c1('0x97')];for(var _0xcca70f=0x0;_0xcca70f=_0x32b8cd){_0xaa04bb=_0x32b8cd;_0x4b4344=0xc8;}else{_0x4b4344=0xce;}_0x59a6ac['status'](_0x4b4344);return _0x59a6ac[_0x607f('0x28')](_0x607f('0x29'),_0x522032+'-'+_0xaa04bb+'/'+_0x32b8cd)['json'](_0x3da3ff);}return null;};}function patchUpdates(_0x425c81){return function(_0x8b01cf){try{jsonpatch[_0x607f('0x2a')](_0x8b01cf,_0x425c81,!![]);}catch(_0x32bcbe){return BPromise[_0x607f('0x2b')](_0x32bcbe);}return _0x8b01cf[_0x607f('0x2c')]();};}function saveUpdates(_0x811d81,_0x265373){return function(_0x46a49f){if(_0x46a49f){return _0x46a49f[_0x607f('0x2d')](_0x811d81)['then'](function(_0x14ba4a){return _0x14ba4a;});}return null;};}function removeEntity(_0x441d75,_0xc8ca4b){return function(_0x454777){if(_0x454777){return _0x454777[_0x607f('0x2e')]()[_0x607f('0x2f')](function(){_0x441d75[_0x607f('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x508297,_0x162bf4){return function(_0x58c073){if(!_0x58c073){_0x508297[_0x607f('0x21')](0x194);}return _0x58c073;};}function handleError(_0x1896f,_0x2792d8){_0x2792d8=_0x2792d8||0x1f4;return function(_0x576781){logger['error'](_0x576781['stack']);if(_0x576781[_0x607f('0x30')]){delete _0x576781[_0x607f('0x30')];}_0x1896f['status'](_0x2792d8)[_0x607f('0x31')](_0x576781);};}exports[_0x607f('0x32')]=function(_0x7a5624,_0x369725){var _0x3719ca={},_0x2afa87={},_0x15c195={'count':0x0,'rows':[]};return db[_0x607f('0x33')][_0x607f('0x34')]()[_0x607f('0x2f')](function(_0xad25bd){var _0x56a7ef=[];for(var _0x18fe9d=0x0;_0x18fe9d0x1){_0x30aa91['or'](_0x607f('0x74'),qs[_0x607f('0x75')](_0x4cf804),null);}else{if(qs[_0x607f('0x76')](_0x4cf804)){_0x30aa91['or'](_0x607f('0x77'),_0x4cf804+'%');_0x30aa91['or'](_0x607f('0x78'),_0x4cf804+'%');_0x30aa91['or'](_0x607f('0x79'),_0x4cf804+'%');_0x30aa91['or'](_0x607f('0x7a'),_0x4cf804+'%');}else if(qs[_0x607f('0x7b')](_0x4cf804)){_0x30aa91['or'](_0x607f('0x7c'),_0x4cf804+'%');}else{_0x30aa91['or'](_0x607f('0x7d'),'%'+_0x4cf804+'%');_0x30aa91['or'](_0x607f('0x7e'),'%'+_0x4cf804+'%');_0x30aa91['or'](_0x607f('0x7c'),'%'+_0x4cf804+'%');}}}}_0x14f75c['where'](_0x30aa91);_0x14f75c[_0x607f('0x7f')](_0x607f('0x80'));var _0x24728a={'type':db[_0x607f('0x81')][_0x607f('0x82')][_0x607f('0x83')],'raw':!![]};var _0x188d92=_0x14f75c[_0x607f('0x84')]()[_0x607f('0x4a')](_0x607f('0x80'));if(_0x3719ca[_0x607f('0x46')]){_0x3719ca[_0x607f('0x46')][_0x607f('0x5a')](function(_0x242eae){_0x14f75c[_0x607f('0x46')]('c.'+_0x242eae[0x0],_0x242eae[0x1]===_0x607f('0x85')?![]:!![]);});}if(!_[_0x607f('0x6c')](_0x404be8)){_0x14f75c[_0x607f('0x86')](_0x20b253);_0x188d92[_0x607f('0x48')](_0x607f('0x87'),_0x404be8);}BPromise['resolve']()[_0x607f('0x2f')](function(){if(!_0x404f80)return;if(_0x7a5624[_0x607f('0x88')][_0x607f('0x89')]!==_0x607f('0x8a'))return;if(!_[_0x607f('0x8b')](_0x404f80[_0x607f('0x55')],[_0x607f('0x4a'),_0x607f('0x5d')])){return _0x7a5624[_0x607f('0x88')][_0x607f('0x8c')]({'attributes':['id'],'raw':!![]})[_0x607f('0x2f')](function(_0x3efa67){if(_[_0x607f('0x6c')](_0x3efa67)){_0x188d92[_0x607f('0x48')](_0x607f('0x8d'));_0x14f75c[_0x607f('0x48')](_0x607f('0x8d'));}else{_0x188d92[_0x607f('0x48')]('c.ListId\x20IN\x20?',_[_0x607f('0x59')](_0x3efa67,'id'));_0x14f75c[_0x607f('0x48')](_0x607f('0x8e'),_[_0x607f('0x59')](_0x3efa67,'id'));}});}})[_0x607f('0x2f')](function(){if(_0x7a5624[_0x607f('0x88')][_0x607f('0x89')]==='agent'&&!_0x404f80&&!_0x7a5624[_0x607f('0x40')][_0x607f('0x6d')])return[];return db[_0x607f('0x8f')]['query'](_0x188d92[_0x607f('0x90')](),_0x24728a);})[_0x607f('0x2f')](function(_0x195c0a){_0x15c195[_0x607f('0x26')]=_0x195c0a[_0x607f('0x36')];if(_0x15c195[_0x607f('0x26')]===0x0)return[];return db[_0x607f('0x8f')]['query'](_0x148b8f[_0x607f('0x90')](),_0x24728a)['then'](function(_0x4bc208){_0x29d6b9=_[_0x607f('0x91')](_0x4bc208,'id');_0x24728a=_[_0x607f('0x92')](_0x24728a,{'model':db[_0x607f('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x7a5624['query'][_0x607f('0x44')]){_0x3719ca[_0x607f('0x43')][_0x607f('0x5a')](function(_0x6a5333){_0x14f75c['field']('c.'+_0x6a5333);});}else{_0x14f75c[_0x607f('0x4a')](_0x607f('0x80'));_0x14f75c['field'](_0x607f('0x93'));_0x14f75c['field'](_0x607f('0x94'));_0x14f75c['field'](_0x607f('0x95'));_0x14f75c[_0x607f('0x4a')]('c.mobile');_0x14f75c[_0x607f('0x4a')](_0x607f('0x96'));_0x14f75c[_0x607f('0x4a')](_0x607f('0x97'));_0x14f75c[_0x607f('0x4a')](_0x607f('0x98'));_0x14f75c[_0x607f('0x4a')](_0x607f('0x99'));_0x14f75c[_0x607f('0x4a')]('c.deletedAt');_0x14f75c[_0x607f('0x4a')](_0x607f('0x9a'));_0x14f75c[_0x607f('0x4a')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x607f('0x9b'));}if(_0x3719ca[_0x607f('0x25')])_0x14f75c['limit'](_0x3719ca['limit']);if(_0x3719ca[_0x607f('0x27')])_0x14f75c[_0x607f('0x27')](_0x3719ca[_0x607f('0x27')]);return db[_0x607f('0x8f')]['query'](_0x14f75c['toString'](),_0x24728a);});})[_0x607f('0x2f')](function(_0x3b66e9){_0x3b66e9[_0x607f('0x5a')](function(_0x3486f5){if(_0x3486f5[_0x607f('0x9b')]){_0x3486f5[_0x607f('0x9c')]=[];_0x3486f5[_0x607f('0x9b')][_0x607f('0x58')](',')[_0x607f('0x5a')](function(_0x3b266e){_0x3486f5['Tags']['push'](_0x29d6b9[_0x3b266e]);});}delete _0x3486f5[_0x607f('0x9b')];});_0x15c195[_0x607f('0x9d')]=_0x3b66e9;return _0x15c195;})[_0x607f('0x2f')](respondWithFilteredResult(_0x369725,_0x3719ca));})[_0x607f('0x9e')](handleError(_0x369725,null));};exports['destroy']=function(_0x497e94,_0x28fac5){return db[_0x607f('0x33')][_0x607f('0x56')]({'where':{'id':_0x497e94['params']['id']}})[_0x607f('0x2f')](handleEntityNotFound(_0x28fac5,null))[_0x607f('0x2f')](removeEntity(_0x28fac5,null))[_0x607f('0x9e')](handleError(_0x28fac5,null));};exports[_0x607f('0x34')]=function(_0x5ad85d,_0x1e65ff){return db[_0x607f('0x33')][_0x607f('0x34')]()[_0x607f('0x2f')](function(_0x387096){delete _0x387096['tags'];for(var _0x1416ce=0x0;_0x1416ce{}\s\\|]/g,'-');_0x24da31(null,util['format']('%s-%s%s',path[_0x43bb('0x1f')](_0x3f3406[_0x43bb('0x20')],path[_0x43bb('0x21')](_0x3f3406[_0x43bb('0x20')])),Date[_0x43bb('0x22')](),path[_0x43bb('0x21')](_0x3f3406[_0x43bb('0x20')])));}})});router[_0x43bb('0x16')](_0x43bb('0x23'),upload[_0x43bb('0x24')](_0x43bb('0x25')),controller[_0x43bb('0x26')]);var upload=multer({'storage':multer[_0x43bb('0x1c')]({'destination':function(_0x10bd47,_0x5cd066,_0x16f955){_0x16f955(null,path[_0x43bb('0x27')](config[_0x43bb('0x1d')],_0x43bb('0x1e')));},'filename':function(_0x190294,_0x534761,_0x48999c){_0x534761[_0x43bb('0x20')]=_0x534761[_0x43bb('0x20')][_0x43bb('0x28')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x48999c(null,util[_0x43bb('0x29')]('%s-%s%s',path[_0x43bb('0x1f')](_0x534761['originalname'],path[_0x43bb('0x21')](_0x534761[_0x43bb('0x20')])),Date['now'](),path[_0x43bb('0x21')](_0x534761['originalname'])));}})});router[_0x43bb('0x16')](_0x43bb('0x2a'),upload[_0x43bb('0x24')](_0x43bb('0x25')),controller[_0x43bb('0x2b')]);router['post']('/upload/:id',auth[_0x43bb('0x9')](),controller['import']);router[_0x43bb('0x2c')](_0x43bb('0x2d'),auth[_0x43bb('0x9')](),controller['update']);router[_0x43bb('0x2e')](_0x43bb('0x2d'),auth['isAuthenticated'](),controller[_0x43bb('0x2f')]);module['exports']=router; \ No newline at end of file +var _0x89ed=['multer','util','path','express','fs-extra','../../config/environment','./cmContact.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/tags','getTags','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','/:id/journey','getJourney','post','/merge','create','/create_many','bulkCreate','setTags','join','root','server/files/tmp','originalname','replace','format','%s-%s%s','extname','now','/csv','single','uploadCsv','diskStorage','basename','file','upload','import','put','update','destroy'];(function(_0x449166,_0x35d5c7){var _0x37916d=function(_0x8e4ba1){while(--_0x8e4ba1){_0x449166['push'](_0x449166['shift']());}};_0x37916d(++_0x35d5c7);}(_0x89ed,0x157));var _0xd89e=function(_0xccd9f4,_0x3958cd){_0xccd9f4=_0xccd9f4-0x0;var _0x17bd26=_0x89ed[_0xccd9f4];return _0x17bd26;};'use strict';var multer=require(_0xd89e('0x0'));var util=require(_0xd89e('0x1'));var path=require(_0xd89e('0x2'));var timeout=require('connect-timeout');var express=require(_0xd89e('0x3'));var router=express['Router']();var fs_extra=require(_0xd89e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd89e('0x5'));var controller=require(_0xd89e('0x6'));router['get']('/',auth[_0xd89e('0x7')](),controller[_0xd89e('0x8')]);router[_0xd89e('0x9')](_0xd89e('0xa'),auth[_0xd89e('0x7')](),controller[_0xd89e('0xb')]);router['get'](_0xd89e('0xc'),auth[_0xd89e('0x7')](),controller['show']);router[_0xd89e('0x9')](_0xd89e('0xd'),auth[_0xd89e('0x7')](),controller[_0xd89e('0xe')]);router['get'](_0xd89e('0xf'),auth[_0xd89e('0x7')](),controller['getHoppers']);router['get'](_0xd89e('0x10'),auth[_0xd89e('0x7')](),controller[_0xd89e('0x11')]);router[_0xd89e('0x9')](_0xd89e('0x12'),auth[_0xd89e('0x7')](),controller[_0xd89e('0x13')]);router[_0xd89e('0x9')](_0xd89e('0x14'),auth[_0xd89e('0x7')](),controller['getJscriptySessions']);router[_0xd89e('0x9')](_0xd89e('0x15'),auth[_0xd89e('0x7')](),controller[_0xd89e('0x16')]);router[_0xd89e('0x17')](_0xd89e('0x18'),auth[_0xd89e('0x7')](),controller['merge']);router[_0xd89e('0x17')]('/',auth[_0xd89e('0x7')](),controller[_0xd89e('0x19')]);router[_0xd89e('0x17')](_0xd89e('0x1a'),auth[_0xd89e('0x7')](),controller[_0xd89e('0x1b')]);router['post'](_0xd89e('0xd'),auth[_0xd89e('0x7')](),controller[_0xd89e('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xad0f8f,_0xda2c7a,_0x251ddb){_0x251ddb(null,path[_0xd89e('0x1d')](config[_0xd89e('0x1e')],_0xd89e('0x1f')));},'filename':function(_0x2f8fe4,_0x391187,_0x2e5855){_0x391187[_0xd89e('0x20')]=_0x391187[_0xd89e('0x20')][_0xd89e('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2e5855(null,util[_0xd89e('0x22')](_0xd89e('0x23'),path['basename'](_0x391187['originalname'],path[_0xd89e('0x24')](_0x391187[_0xd89e('0x20')])),Date[_0xd89e('0x25')](),path['extname'](_0x391187[_0xd89e('0x20')])));}})});router['post'](_0xd89e('0x26'),upload[_0xd89e('0x27')]('file'),controller[_0xd89e('0x28')]);var upload=multer({'storage':multer[_0xd89e('0x29')]({'destination':function(_0x5dbef9,_0x155aad,_0x153989){_0x153989(null,path[_0xd89e('0x1d')](config[_0xd89e('0x1e')],_0xd89e('0x1f')));},'filename':function(_0x4e8711,_0x4e4427,_0x497fa4){_0x4e4427[_0xd89e('0x20')]=_0x4e4427[_0xd89e('0x20')][_0xd89e('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x497fa4(null,util[_0xd89e('0x22')](_0xd89e('0x23'),path[_0xd89e('0x2a')](_0x4e4427[_0xd89e('0x20')],path[_0xd89e('0x24')](_0x4e4427[_0xd89e('0x20')])),Date[_0xd89e('0x25')](),path[_0xd89e('0x24')](_0x4e4427[_0xd89e('0x20')])));}})});router[_0xd89e('0x17')]('/upload',upload['single'](_0xd89e('0x2b')),controller[_0xd89e('0x2c')]);router[_0xd89e('0x17')]('/upload/:id',auth[_0xd89e('0x7')](),controller[_0xd89e('0x2d')]);router[_0xd89e('0x2e')](_0xd89e('0xc'),auth[_0xd89e('0x7')](),controller[_0xd89e('0x2f')]);router['delete'](_0xd89e('0xc'),auth[_0xd89e('0x7')](),controller[_0xd89e('0x30')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 42c57ea..4e3da0a 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 _0x655d=['TEXT','long','getDataValue','select','parse','values','BOOLEAN','voice','lodash','VIRTUAL','alias','STRING','setDataValue','name'];(function(_0x193c10,_0x329e0d){var _0x5fe7f=function(_0x4d1715){while(--_0x4d1715){_0x193c10['push'](_0x193c10['shift']());}};_0x5fe7f(++_0x329e0d);}(_0x655d,0xb0));var _0xd655=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x655d[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');var _=require(_0xd655('0x0'));module['exports']={'name':{'type':Sequelize[_0xd655('0x1')],'get':function(_0xffc23e){return this['getDataValue'](_0xd655('0x2'));}},'alias':{'type':Sequelize[_0xd655('0x3')],'allowNull':![],'set':function(_0x4ef60d){this[_0xd655('0x4')](_0xd655('0x2'),_0x4ef60d?_0x4ef60d:this['getDataValue'](_0xd655('0x5')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xd655('0x6')](_0xd655('0x7')),'get':function(){if(this[_0xd655('0x8')]('type')===_0xd655('0x9')){return JSON[_0xd655('0xa')](this[_0xd655('0x8')]('values'));}else{return this[_0xd655('0x8')]('values');}},'set':function(_0xceb623){if(Array['isArray'](_0xceb623)){this[_0xd655('0x4')](_0xd655('0xb'),JSON['stringify'](_0xceb623));}else{this[_0xd655('0x4')](_0xd655('0xb'),_0xceb623);}}},'required':{'type':Sequelize[_0xd655('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xd655('0xd'))}}; \ No newline at end of file +var _0xf248=['type','parse','values','isArray','setDataValue','stringify','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','name','TEXT','long'];(function(_0x58f65e,_0x467d61){var _0x35684b=function(_0x17cafe){while(--_0x17cafe){_0x58f65e['push'](_0x58f65e['shift']());}};_0x35684b(++_0x467d61);}(_0xf248,0x15c));var _0x8f24=function(_0x5d8302,_0xa145db){_0x5d8302=_0x5d8302-0x0;var _0xd2aaec=_0xf248[_0x5d8302];return _0xd2aaec;};'use strict';var Sequelize=require(_0x8f24('0x0'));var _=require(_0x8f24('0x1'));module[_0x8f24('0x2')]={'name':{'type':Sequelize[_0x8f24('0x3')],'get':function(_0x48f7e2){return this[_0x8f24('0x4')]('alias');}},'alias':{'type':Sequelize[_0x8f24('0x5')],'allowNull':![],'set':function(_0x3e071d){this['setDataValue']('alias',_0x3e071d?_0x3e071d:this[_0x8f24('0x4')](_0x8f24('0x6')));}},'type':{'type':Sequelize[_0x8f24('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x8f24('0x7')](_0x8f24('0x8')),'get':function(){if(this[_0x8f24('0x4')](_0x8f24('0x9'))==='select'){return JSON[_0x8f24('0xa')](this[_0x8f24('0x4')](_0x8f24('0xb')));}else{return this[_0x8f24('0x4')](_0x8f24('0xb'));}},'set':function(_0x2c9fdb){if(Array[_0x8f24('0xc')](_0x2c9fdb)){this[_0x8f24('0xd')](_0x8f24('0xb'),JSON[_0x8f24('0xe')](_0x2c9fdb));}else{this[_0x8f24('0xd')](_0x8f24('0xb'),_0x2c9fdb);}}},'required':{'type':Sequelize[_0x8f24('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x8f24('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x8f24('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index af3158f..98e64be 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 _0xe8f3=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','CmCustomField','rawAttributes','type','key','differenceBy','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','options','include','findAll','then','rows','includeAll','find','catch','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','eml-format'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0xe8f3,0x1bc));var _0x3e8f=function(_0x15790f,_0x3dd5a8){_0x15790f=_0x15790f-0x0;var _0x30f02d=_0xe8f3[_0x15790f];return _0x30f02d;};'use strict';var emlformat=require(_0x3e8f('0x0'));var rimraf=require(_0x3e8f('0x1'));var zipdir=require(_0x3e8f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3e8f('0x3'));var moment=require(_0x3e8f('0x4'));var BPromise=require(_0x3e8f('0x5'));var Mustache=require(_0x3e8f('0x6'));var util=require(_0x3e8f('0x7'));var path=require(_0x3e8f('0x8'));var sox=require('sox');var csv=require(_0x3e8f('0x9'));var ejs=require(_0x3e8f('0xa'));var fs=require('fs');var fs_extra=require(_0x3e8f('0xb'));var _=require(_0x3e8f('0xc'));var squel=require(_0x3e8f('0xd'));var crypto=require(_0x3e8f('0xe'));var jsforce=require(_0x3e8f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3e8f('0x9'));var querystring=require(_0x3e8f('0x10'));var Papa=require(_0x3e8f('0x11'));var Redis=require(_0x3e8f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e8f('0x13'));var logger=require(_0x3e8f('0x14'))(_0x3e8f('0x15'));var utils=require(_0x3e8f('0x16'));var config=require(_0x3e8f('0x17'));var licenseUtil=require(_0x3e8f('0x18'));var db=require(_0x3e8f('0x19'))['db'];function respondWithStatusCode(_0x269897,_0x120bf1){_0x120bf1=_0x120bf1||0xcc;return function(_0x50d53e){if(_0x50d53e){return _0x269897[_0x3e8f('0x1a')](_0x120bf1);}return _0x269897[_0x3e8f('0x1b')](_0x120bf1)[_0x3e8f('0x1c')]();};}function respondWithResult(_0x727074,_0x3839bb){_0x3839bb=_0x3839bb||0xc8;return function(_0x2fd73e){if(_0x2fd73e){return _0x727074[_0x3e8f('0x1b')](_0x3839bb)[_0x3e8f('0x1d')](_0x2fd73e);}};}function respondWithFilteredResult(_0x5b854d,_0x149e18){return function(_0x377e3a){if(_0x377e3a){var _0x3407c3=typeof _0x149e18[_0x3e8f('0x1e')]===_0x3e8f('0x1f')&&typeof _0x149e18[_0x3e8f('0x20')]===_0x3e8f('0x1f');var _0x2e838f=_0x377e3a[_0x3e8f('0x21')];var _0x5099a1=_0x3407c3?0x0:_0x149e18[_0x3e8f('0x1e')];var _0x3dc2a1=_0x3407c3?_0x377e3a[_0x3e8f('0x21')]:_0x149e18[_0x3e8f('0x1e')]+_0x149e18[_0x3e8f('0x20')];var _0x599201;if(_0x3dc2a1>=_0x2e838f){_0x3dc2a1=_0x2e838f;_0x599201=0xc8;}else{_0x599201=0xce;}_0x5b854d['status'](_0x599201);return _0x5b854d[_0x3e8f('0x22')](_0x3e8f('0x23'),_0x5099a1+'-'+_0x3dc2a1+'/'+_0x2e838f)[_0x3e8f('0x1d')](_0x377e3a);}return null;};}function patchUpdates(_0x4dc3b0){return function(_0x3aed5f){try{jsonpatch[_0x3e8f('0x24')](_0x3aed5f,_0x4dc3b0,!![]);}catch(_0x3b8111){return BPromise[_0x3e8f('0x25')](_0x3b8111);}return _0x3aed5f[_0x3e8f('0x26')]();};}function saveUpdates(_0x47f2cf,_0x5d9333){return function(_0x57ecad){if(_0x57ecad){return _0x57ecad[_0x3e8f('0x27')](_0x47f2cf)['then'](function(_0x39da9a){return _0x39da9a;});}return null;};}function removeEntity(_0x43d304,_0x1db034){return function(_0x12a062){if(_0x12a062){return _0x12a062[_0x3e8f('0x28')]()['then'](function(){_0x43d304[_0x3e8f('0x1b')](0xcc)[_0x3e8f('0x1c')]();});}};}function handleEntityNotFound(_0x1f34fe,_0x384c7d){return function(_0x6c69aa){if(!_0x6c69aa){_0x1f34fe['sendStatus'](0x194);}return _0x6c69aa;};}function handleError(_0x3f68fb,_0x537d7c){_0x537d7c=_0x537d7c||0x1f4;return function(_0x546d3d){logger[_0x3e8f('0x29')](_0x546d3d[_0x3e8f('0x2a')]);if(_0x546d3d[_0x3e8f('0x2b')]){delete _0x546d3d[_0x3e8f('0x2b')];}_0x3f68fb[_0x3e8f('0x1b')](_0x537d7c)[_0x3e8f('0x2c')](_0x546d3d);};}exports[_0x3e8f('0x2d')]=function(_0x277c94,_0x7c6957){var _0x5c1d8c={},_0x131678={},_0x4ae593={'count':0x0,'rows':[]};var _0x399dd8=_['map'](db[_0x3e8f('0x2e')][_0x3e8f('0x2f')],function(_0x54ac81){return{'name':_0x54ac81['fieldName'],'type':_0x54ac81[_0x3e8f('0x30')][_0x3e8f('0x31')]};});_0x131678['model']=_[_0x3e8f('0x32')](_['map'](_0x399dd8,_0x3e8f('0x2b')),[_0x3e8f('0x2b')]);_0x131678[_0x3e8f('0x33')]=_[_0x3e8f('0x34')](_0x277c94['query']);_0x131678[_0x3e8f('0x35')]=_[_0x3e8f('0x36')](_0x131678['model'],_0x131678['query']);_0x5c1d8c[_0x3e8f('0x37')]=_[_0x3e8f('0x36')](_0x131678[_0x3e8f('0x38')],qs[_0x3e8f('0x39')](_0x277c94['query'][_0x3e8f('0x39')]));_0x5c1d8c[_0x3e8f('0x37')]=_0x5c1d8c[_0x3e8f('0x37')][_0x3e8f('0x3a')]?_0x5c1d8c[_0x3e8f('0x37')]:_0x131678[_0x3e8f('0x38')];if(!_0x277c94[_0x3e8f('0x33')]['hasOwnProperty'](_0x3e8f('0x3b'))){_0x5c1d8c[_0x3e8f('0x20')]=qs[_0x3e8f('0x20')](_0x277c94[_0x3e8f('0x33')]['limit']);_0x5c1d8c['offset']=qs['offset'](_0x277c94['query'][_0x3e8f('0x1e')]);}_0x5c1d8c[_0x3e8f('0x3c')]=qs[_0x3e8f('0x3d')](_0x277c94['query'][_0x3e8f('0x3d')]);_0x5c1d8c['where']=qs[_0x3e8f('0x35')](_[_0x3e8f('0x3e')](_0x277c94[_0x3e8f('0x33')],_0x131678[_0x3e8f('0x35')]),_0x399dd8);if(_0x277c94[_0x3e8f('0x33')]['filter']){_0x5c1d8c[_0x3e8f('0x3f')]=_[_0x3e8f('0x40')](_0x5c1d8c[_0x3e8f('0x3f')],{'$or':_['map'](_0x399dd8,function(_0x202c56){if(_0x202c56['type']!==_0x3e8f('0x41')){var _0x20d5eb={};_0x20d5eb[_0x202c56['name']]={'$like':'%'+_0x277c94[_0x3e8f('0x33')]['filter']+'%'};return _0x20d5eb;}})});}_0x5c1d8c=_[_0x3e8f('0x40')]({},_0x5c1d8c,_0x277c94[_0x3e8f('0x42')]);var _0x5cc2b4={'where':_0x5c1d8c[_0x3e8f('0x3f')]};return db[_0x3e8f('0x2e')]['count'](_0x5cc2b4)['then'](function(_0x4fbdba){_0x4ae593[_0x3e8f('0x21')]=_0x4fbdba;if(_0x277c94[_0x3e8f('0x33')]['includeAll']){_0x5c1d8c[_0x3e8f('0x43')]=[{'all':!![]}];}return db[_0x3e8f('0x2e')][_0x3e8f('0x44')](_0x5c1d8c);})[_0x3e8f('0x45')](function(_0x43be5b){_0x4ae593[_0x3e8f('0x46')]=_0x43be5b;return _0x4ae593;})['then'](respondWithFilteredResult(_0x7c6957,_0x5c1d8c))['catch'](handleError(_0x7c6957,null));};exports['show']=function(_0x271f49,_0x407792){var _0x17c509={'raw':!![],'where':{'id':_0x271f49['params']['id']}},_0x46fa5c={};_0x46fa5c[_0x3e8f('0x38')]=_['keys'](db[_0x3e8f('0x2e')][_0x3e8f('0x2f')]);_0x46fa5c['query']=_[_0x3e8f('0x34')](_0x271f49[_0x3e8f('0x33')]);_0x46fa5c[_0x3e8f('0x35')]=_[_0x3e8f('0x36')](_0x46fa5c['model'],_0x46fa5c[_0x3e8f('0x33')]);_0x17c509[_0x3e8f('0x37')]=_[_0x3e8f('0x36')](_0x46fa5c[_0x3e8f('0x38')],qs[_0x3e8f('0x39')](_0x271f49[_0x3e8f('0x33')]['fields']));_0x17c509[_0x3e8f('0x37')]=_0x17c509['attributes'][_0x3e8f('0x3a')]?_0x17c509[_0x3e8f('0x37')]:_0x46fa5c[_0x3e8f('0x38')];if(_0x271f49['query'][_0x3e8f('0x47')]){_0x17c509[_0x3e8f('0x43')]=[{'all':!![]}];}_0x17c509=_['merge']({},_0x17c509,_0x271f49[_0x3e8f('0x42')]);return db[_0x3e8f('0x2e')][_0x3e8f('0x48')](_0x17c509)[_0x3e8f('0x45')](handleEntityNotFound(_0x407792,null))['then'](respondWithResult(_0x407792,null))[_0x3e8f('0x49')](handleError(_0x407792,null));};exports[_0x3e8f('0x27')]=function(_0xd3de76,_0x2b71fa){if(_0xd3de76[_0x3e8f('0x4a')]['id']){delete _0xd3de76[_0x3e8f('0x4a')]['id'];}return db[_0x3e8f('0x2e')]['find']({'where':{'id':_0xd3de76['params']['id']}})[_0x3e8f('0x45')](handleEntityNotFound(_0x2b71fa,null))['then'](saveUpdates(_0xd3de76[_0x3e8f('0x4a')],null))['then'](respondWithResult(_0x2b71fa,null))[_0x3e8f('0x49')](handleError(_0x2b71fa,null));};exports['destroy']=function(_0x1f2769,_0x1ca1b2){return db[_0x3e8f('0x2e')][_0x3e8f('0x48')]({'where':{'id':_0x1f2769['params']['id']}})['then'](handleEntityNotFound(_0x1ca1b2,null))[_0x3e8f('0x45')](removeEntity(_0x1ca1b2,null))['catch'](handleError(_0x1ca1b2,null));};exports[_0x3e8f('0x4b')]=function(_0x108cfe,_0x16d27d){var _0x74f5d0;return db[_0x3e8f('0x4c')][_0x3e8f('0x4d')](function(_0x53b019){return db[_0x3e8f('0x2e')]['create'](_0x108cfe['body'],{'transaction':_0x53b019})[_0x3e8f('0x45')](function(_0x3c25b2){_0x74f5d0=_0x3c25b2;var _0x234b1d={'type':db[_0x3e8f('0x4e')][_0x3e8f('0x4f')],'transaction':_0x53b019};switch(_0x108cfe[_0x3e8f('0x4a')][_0x3e8f('0x30')]){case _0x3e8f('0x50'):_0x234b1d[_0x3e8f('0x30')]=db[_0x3e8f('0x4e')][_0x3e8f('0x4f')];break;case _0x3e8f('0x51'):_0x234b1d[_0x3e8f('0x30')]=db[_0x3e8f('0x4e')][_0x3e8f('0x52')];break;case _0x3e8f('0x53'):_0x234b1d[_0x3e8f('0x30')]=db[_0x3e8f('0x4e')][_0x3e8f('0x54')];_0x234b1d[_0x3e8f('0x55')]=![];break;default:}return db[_0x3e8f('0x4c')][_0x3e8f('0x56')][_0x3e8f('0x57')](_0x3e8f('0x58'),util['format']('cf_%d',_0x74f5d0['id']),_0x234b1d);})[_0x3e8f('0x45')](function(){return _0x74f5d0;});})[_0x3e8f('0x45')](respondWithResult(_0x16d27d,0xc9))['catch'](handleError(_0x16d27d,null));}; \ No newline at end of file +var _0x2546=['keys','options','update','body','find','create','transaction','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','destroy','then','error','stack','name','index','CmCustomField','rawAttributes','type','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params'];(function(_0x219353,_0x5cd156){var _0x364146=function(_0x23e5be){while(--_0x23e5be){_0x219353['push'](_0x219353['shift']());}};_0x364146(++_0x5cd156);}(_0x2546,0xc8));var _0x6254=function(_0x2a8d94,_0x387f97){_0x2a8d94=_0x2a8d94-0x0;var _0x5a1f1d=_0x2546[_0x2a8d94];return _0x5a1f1d;};'use strict';var emlformat=require(_0x6254('0x0'));var rimraf=require(_0x6254('0x1'));var zipdir=require(_0x6254('0x2'));var jsonpatch=require(_0x6254('0x3'));var rp=require(_0x6254('0x4'));var moment=require('moment');var BPromise=require(_0x6254('0x5'));var Mustache=require(_0x6254('0x6'));var util=require('util');var path=require(_0x6254('0x7'));var sox=require(_0x6254('0x8'));var csv=require(_0x6254('0x9'));var ejs=require(_0x6254('0xa'));var fs=require('fs');var fs_extra=require(_0x6254('0xb'));var _=require(_0x6254('0xc'));var squel=require(_0x6254('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6254('0x9'));var querystring=require(_0x6254('0xe'));var Papa=require(_0x6254('0xf'));var Redis=require(_0x6254('0x10'));var authService=require(_0x6254('0x11'));var qs=require(_0x6254('0x12'));var as=require(_0x6254('0x13'));var hardwareService=require(_0x6254('0x14'));var logger=require(_0x6254('0x15'))(_0x6254('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6254('0x17'));var db=require(_0x6254('0x18'))['db'];function respondWithStatusCode(_0x128bf1,_0x3ec250){_0x3ec250=_0x3ec250||0xcc;return function(_0x427855){if(_0x427855){return _0x128bf1[_0x6254('0x19')](_0x3ec250);}return _0x128bf1[_0x6254('0x1a')](_0x3ec250)[_0x6254('0x1b')]();};}function respondWithResult(_0x1ef44b,_0x3e6bf6){_0x3e6bf6=_0x3e6bf6||0xc8;return function(_0x2d7690){if(_0x2d7690){return _0x1ef44b[_0x6254('0x1a')](_0x3e6bf6)[_0x6254('0x1c')](_0x2d7690);}};}function respondWithFilteredResult(_0x493bb3,_0x4f4580){return function(_0x5cb3c7){if(_0x5cb3c7){var _0x3c558d=typeof _0x4f4580[_0x6254('0x1d')]===_0x6254('0x1e')&&typeof _0x4f4580['limit']===_0x6254('0x1e');var _0xc4f9f3=_0x5cb3c7[_0x6254('0x1f')];var _0x3703bd=_0x3c558d?0x0:_0x4f4580[_0x6254('0x1d')];var _0x1902d4=_0x3c558d?_0x5cb3c7['count']:_0x4f4580['offset']+_0x4f4580[_0x6254('0x20')];var _0x1d94b7;if(_0x1902d4>=_0xc4f9f3){_0x1902d4=_0xc4f9f3;_0x1d94b7=0xc8;}else{_0x1d94b7=0xce;}_0x493bb3['status'](_0x1d94b7);return _0x493bb3[_0x6254('0x21')]('Content-Range',_0x3703bd+'-'+_0x1902d4+'/'+_0xc4f9f3)[_0x6254('0x1c')](_0x5cb3c7);}return null;};}function patchUpdates(_0x4facf6){return function(_0x405ef6){try{jsonpatch[_0x6254('0x22')](_0x405ef6,_0x4facf6,!![]);}catch(_0x1f8542){return BPromise['reject'](_0x1f8542);}return _0x405ef6[_0x6254('0x23')]();};}function saveUpdates(_0x542a67,_0x262439){return function(_0x48e737){if(_0x48e737){return _0x48e737['update'](_0x542a67)['then'](function(_0x67b05c){return _0x67b05c;});}return null;};}function removeEntity(_0x39f619,_0x38f34e){return function(_0x57126c){if(_0x57126c){return _0x57126c[_0x6254('0x24')]()[_0x6254('0x25')](function(){_0x39f619[_0x6254('0x1a')](0xcc)[_0x6254('0x1b')]();});}};}function handleEntityNotFound(_0x408e3b,_0x546ea7){return function(_0xb0ba6b){if(!_0xb0ba6b){_0x408e3b['sendStatus'](0x194);}return _0xb0ba6b;};}function handleError(_0xc57239,_0x36f061){_0x36f061=_0x36f061||0x1f4;return function(_0x312df4){logger[_0x6254('0x26')](_0x312df4[_0x6254('0x27')]);if(_0x312df4[_0x6254('0x28')]){delete _0x312df4[_0x6254('0x28')];}_0xc57239['status'](_0x36f061)['send'](_0x312df4);};}exports[_0x6254('0x29')]=function(_0x27d1bf,_0x1f94d9){var _0x80bdee={},_0x39be77={},_0x8cedcf={'count':0x0,'rows':[]};var _0x673f01=_['map'](db[_0x6254('0x2a')][_0x6254('0x2b')],function(_0x4b084a){return{'name':_0x4b084a['fieldName'],'type':_0x4b084a[_0x6254('0x2c')][_0x6254('0x2d')]};});_0x39be77['model']=_['differenceBy'](_[_0x6254('0x2e')](_0x673f01,_0x6254('0x28')),['name']);_0x39be77[_0x6254('0x2f')]=_['keys'](_0x27d1bf[_0x6254('0x2f')]);_0x39be77['filters']=_[_0x6254('0x30')](_0x39be77[_0x6254('0x31')],_0x39be77[_0x6254('0x2f')]);_0x80bdee['attributes']=_[_0x6254('0x30')](_0x39be77[_0x6254('0x31')],qs[_0x6254('0x32')](_0x27d1bf['query'][_0x6254('0x32')]));_0x80bdee[_0x6254('0x33')]=_0x80bdee[_0x6254('0x33')][_0x6254('0x34')]?_0x80bdee['attributes']:_0x39be77[_0x6254('0x31')];if(!_0x27d1bf[_0x6254('0x2f')][_0x6254('0x35')](_0x6254('0x36'))){_0x80bdee[_0x6254('0x20')]=qs[_0x6254('0x20')](_0x27d1bf['query'][_0x6254('0x20')]);_0x80bdee[_0x6254('0x1d')]=qs[_0x6254('0x1d')](_0x27d1bf[_0x6254('0x2f')]['offset']);}_0x80bdee[_0x6254('0x37')]=qs[_0x6254('0x38')](_0x27d1bf[_0x6254('0x2f')][_0x6254('0x38')]);_0x80bdee[_0x6254('0x39')]=qs[_0x6254('0x3a')](_[_0x6254('0x3b')](_0x27d1bf[_0x6254('0x2f')],_0x39be77['filters']),_0x673f01);if(_0x27d1bf['query'][_0x6254('0x3c')]){_0x80bdee['where']=_[_0x6254('0x3d')](_0x80bdee[_0x6254('0x39')],{'$or':_['map'](_0x673f01,function(_0x2aff1a){if(_0x2aff1a[_0x6254('0x2c')]!==_0x6254('0x3e')){var _0x5c147e={};_0x5c147e[_0x2aff1a[_0x6254('0x28')]]={'$like':'%'+_0x27d1bf[_0x6254('0x2f')][_0x6254('0x3c')]+'%'};return _0x5c147e;}})});}_0x80bdee=_[_0x6254('0x3d')]({},_0x80bdee,_0x27d1bf['options']);var _0xd41c81={'where':_0x80bdee[_0x6254('0x39')]};return db[_0x6254('0x2a')]['count'](_0xd41c81)[_0x6254('0x25')](function(_0x1f84d3){_0x8cedcf[_0x6254('0x1f')]=_0x1f84d3;if(_0x27d1bf[_0x6254('0x2f')][_0x6254('0x3f')]){_0x80bdee[_0x6254('0x40')]=[{'all':!![]}];}return db[_0x6254('0x2a')][_0x6254('0x41')](_0x80bdee);})[_0x6254('0x25')](function(_0x56bb87){_0x8cedcf[_0x6254('0x42')]=_0x56bb87;return _0x8cedcf;})[_0x6254('0x25')](respondWithFilteredResult(_0x1f94d9,_0x80bdee))[_0x6254('0x43')](handleError(_0x1f94d9,null));};exports[_0x6254('0x44')]=function(_0x381f7f,_0x4f72ba){var _0x475f18={'raw':!![],'where':{'id':_0x381f7f[_0x6254('0x45')]['id']}},_0x5eef6b={};_0x5eef6b[_0x6254('0x31')]=_[_0x6254('0x46')](db[_0x6254('0x2a')][_0x6254('0x2b')]);_0x5eef6b[_0x6254('0x2f')]=_[_0x6254('0x46')](_0x381f7f[_0x6254('0x2f')]);_0x5eef6b[_0x6254('0x3a')]=_['intersection'](_0x5eef6b[_0x6254('0x31')],_0x5eef6b[_0x6254('0x2f')]);_0x475f18[_0x6254('0x33')]=_[_0x6254('0x30')](_0x5eef6b[_0x6254('0x31')],qs[_0x6254('0x32')](_0x381f7f[_0x6254('0x2f')]['fields']));_0x475f18[_0x6254('0x33')]=_0x475f18['attributes']['length']?_0x475f18[_0x6254('0x33')]:_0x5eef6b['model'];if(_0x381f7f[_0x6254('0x2f')][_0x6254('0x3f')]){_0x475f18[_0x6254('0x40')]=[{'all':!![]}];}_0x475f18=_['merge']({},_0x475f18,_0x381f7f[_0x6254('0x47')]);return db['CmCustomField']['find'](_0x475f18)[_0x6254('0x25')](handleEntityNotFound(_0x4f72ba,null))[_0x6254('0x25')](respondWithResult(_0x4f72ba,null))[_0x6254('0x43')](handleError(_0x4f72ba,null));};exports[_0x6254('0x48')]=function(_0x1ccee8,_0xc5f2df){if(_0x1ccee8[_0x6254('0x49')]['id']){delete _0x1ccee8[_0x6254('0x49')]['id'];}return db[_0x6254('0x2a')][_0x6254('0x4a')]({'where':{'id':_0x1ccee8[_0x6254('0x45')]['id']}})[_0x6254('0x25')](handleEntityNotFound(_0xc5f2df,null))['then'](saveUpdates(_0x1ccee8[_0x6254('0x49')],null))[_0x6254('0x25')](respondWithResult(_0xc5f2df,null))['catch'](handleError(_0xc5f2df,null));};exports[_0x6254('0x24')]=function(_0x51e837,_0x262961){return db[_0x6254('0x2a')][_0x6254('0x4a')]({'where':{'id':_0x51e837[_0x6254('0x45')]['id']}})['then'](handleEntityNotFound(_0x262961,null))[_0x6254('0x25')](removeEntity(_0x262961,null))[_0x6254('0x43')](handleError(_0x262961,null));};exports[_0x6254('0x4b')]=function(_0x2b941d,_0x13edb5){var _0x40f35c;return db['sequelize'][_0x6254('0x4c')](function(_0x5e986a){return db[_0x6254('0x2a')]['create'](_0x2b941d[_0x6254('0x49')],{'transaction':_0x5e986a})[_0x6254('0x25')](function(_0x3c6ba2){_0x40f35c=_0x3c6ba2;var _0x33e010={'type':db[_0x6254('0x4d')][_0x6254('0x4e')],'transaction':_0x5e986a};switch(_0x2b941d[_0x6254('0x49')]['type']){case _0x6254('0x4f'):_0x33e010[_0x6254('0x2c')]=db[_0x6254('0x4d')][_0x6254('0x4e')];break;case'number':_0x33e010['type']=db[_0x6254('0x4d')][_0x6254('0x50')];break;case _0x6254('0x51'):_0x33e010[_0x6254('0x2c')]=db[_0x6254('0x4d')][_0x6254('0x52')];_0x33e010[_0x6254('0x53')]=![];break;default:}return db[_0x6254('0x54')][_0x6254('0x55')][_0x6254('0x56')](_0x6254('0x57'),util[_0x6254('0x58')](_0x6254('0x59'),_0x40f35c['id']),_0x33e010);})[_0x6254('0x25')](function(){return _0x40f35c;});})[_0x6254('0x25')](respondWithResult(_0x13edb5,0xc9))['catch'](handleError(_0x13edb5,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index c4d7de3..bef5c48 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 _0xc9f2=['exports','define','CmCustomField','cm_custom_fields','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x3b8af8,_0x3c1c15){var _0x305b05=function(_0x3649ba){while(--_0x3649ba){_0x3b8af8['push'](_0x3b8af8['shift']());}};_0x305b05(++_0x3c1c15);}(_0xc9f2,0xac));var _0x2c9f=function(_0x23a636,_0x1eb369){_0x23a636=_0x23a636-0x0;var _0x3b61ae=_0xc9f2[_0x23a636];return _0x3b61ae;};'use strict';var _=require('lodash');var util=require(_0x2c9f('0x0'));var logger=require(_0x2c9f('0x1'))(_0x2c9f('0x2'));var moment=require(_0x2c9f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c9f('0x4'));var rimraf=require(_0x2c9f('0x5'));var config=require(_0x2c9f('0x6'));var attributes=require(_0x2c9f('0x7'));module[_0x2c9f('0x8')]=function(_0x371db0,_0x5edcf9){return _0x371db0[_0x2c9f('0x9')](_0x2c9f('0xa'),attributes,{'tableName':_0x2c9f('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3320=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x3320,0x1eb));var _0x0332=function(_0x305272,_0x19a527){_0x305272=_0x305272-0x0;var _0x43fdf1=_0x3320[_0x305272];return _0x43fdf1;};'use strict';var _=require(_0x0332('0x0'));var util=require(_0x0332('0x1'));var logger=require(_0x0332('0x2'))(_0x0332('0x3'));var moment=require(_0x0332('0x4'));var BPromise=require(_0x0332('0x5'));var rp=require(_0x0332('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0332('0x7'));var config=require(_0x0332('0x8'));var attributes=require(_0x0332('0x9'));module[_0x0332('0xa')]=function(_0x39c68a,_0x2ed3b1){return _0x39c68a['define'](_0x0332('0xb'),attributes,{'tableName':_0x0332('0xc'),'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 64d0c45..196c771 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 _0xd1b7=['../../mysqldb','../../config/environment','jayson/promise','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x153a08,_0x8d956d){var _0x334eaf=function(_0x55f4ec){while(--_0x55f4ec){_0x153a08['push'](_0x153a08['shift']());}};_0x334eaf(++_0x8d956d);}(_0xd1b7,0xc3));var _0x7d1b=function(_0x4c3627,_0x4fb8e6){_0x4c3627=_0x4c3627-0x0;var _0x3e209c=_0xd1b7[_0x4c3627];return _0x3e209c;};'use strict';var _=require(_0x7d1b('0x0'));var util=require(_0x7d1b('0x1'));var moment=require(_0x7d1b('0x2'));var BPromise=require(_0x7d1b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d1b('0x4'));var db=require(_0x7d1b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7d1b('0x6'));var jayson=require(_0x7d1b('0x7'));var client=jayson['client'][_0x7d1b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x589455,_0x140cc3,_0x2fc8c8){return new BPromise(function(_0x338c98,_0x69bf17){return client[_0x7d1b('0x9')](_0x589455,_0x2fc8c8)[_0x7d1b('0xa')](function(_0xab1ac2){logger['info'](_0x7d1b('0xb'),_0x140cc3,'request\x20sent');logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x140cc3,_0x7d1b('0xc'),JSON[_0x7d1b('0xd')](_0xab1ac2));if(_0xab1ac2[_0x7d1b('0xe')]){if(_0xab1ac2[_0x7d1b('0xe')][_0x7d1b('0xf')]===0x1f4){logger[_0x7d1b('0xe')](_0x7d1b('0xb'),_0x140cc3,_0xab1ac2[_0x7d1b('0xe')][_0x7d1b('0x10')]);return _0x69bf17(_0xab1ac2['error'][_0x7d1b('0x10')]);}logger[_0x7d1b('0xe')](_0x7d1b('0xb'),_0x140cc3,_0xab1ac2[_0x7d1b('0xe')][_0x7d1b('0x10')]);return _0x338c98(_0xab1ac2[_0x7d1b('0xe')][_0x7d1b('0x10')]);}else{logger[_0x7d1b('0x11')](_0x7d1b('0xb'),_0x140cc3,'request\x20sent');_0x338c98(_0xab1ac2[_0x7d1b('0x12')][_0x7d1b('0x10')]);}})[_0x7d1b('0x13')](function(_0x97e752){logger[_0x7d1b('0xe')]('CmCustomField,\x20%s,\x20%s',_0x140cc3,_0x97e752);_0x69bf17(_0x97e752);});});} \ No newline at end of file +var _0xfaa0=['info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then'];(function(_0x20fae5,_0x1cd746){var _0x3a4ec9=function(_0x3df499){while(--_0x3df499){_0x20fae5['push'](_0x20fae5['shift']());}};_0x3a4ec9(++_0x1cd746);}(_0xfaa0,0x16a));var _0x0faa=function(_0x540f62,_0x5e81eb){_0x540f62=_0x540f62-0x0;var _0x19a147=_0xfaa0[_0x540f62];return _0x19a147;};'use strict';var _=require(_0x0faa('0x0'));var util=require(_0x0faa('0x1'));var moment=require(_0x0faa('0x2'));var BPromise=require('bluebird');var rs=require(_0x0faa('0x3'));var fs=require('fs');var Redis=require(_0x0faa('0x4'));var db=require(_0x0faa('0x5'))['db'];var utils=require(_0x0faa('0x6'));var logger=require(_0x0faa('0x7'))(_0x0faa('0x8'));var config=require(_0x0faa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0faa('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fca7a,_0x2678e5,_0x40c35f){return new BPromise(function(_0x182356,_0x2296f2){return client['request'](_0x3fca7a,_0x40c35f)[_0x0faa('0xb')](function(_0x4a60a7){logger[_0x0faa('0xc')](_0x0faa('0xd'),_0x2678e5,_0x0faa('0xe'));logger[_0x0faa('0xf')](_0x0faa('0x10'),_0x2678e5,'request\x20sent',JSON[_0x0faa('0x11')](_0x4a60a7));if(_0x4a60a7[_0x0faa('0x12')]){if(_0x4a60a7[_0x0faa('0x12')][_0x0faa('0x13')]===0x1f4){logger['error'](_0x0faa('0xd'),_0x2678e5,_0x4a60a7[_0x0faa('0x12')][_0x0faa('0x14')]);return _0x2296f2(_0x4a60a7['error'][_0x0faa('0x14')]);}logger[_0x0faa('0x12')](_0x0faa('0xd'),_0x2678e5,_0x4a60a7[_0x0faa('0x12')][_0x0faa('0x14')]);return _0x182356(_0x4a60a7['error'][_0x0faa('0x14')]);}else{logger[_0x0faa('0xc')]('CmCustomField,\x20%s,\x20%s',_0x2678e5,_0x0faa('0xe'));_0x182356(_0x4a60a7[_0x0faa('0x15')][_0x0faa('0x14')]);}})['catch'](function(_0x258025){logger[_0x0faa('0x12')](_0x0faa('0xd'),_0x2678e5,_0x258025);_0x2296f2(_0x258025);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 74e0d40..b984eeb 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 _0xf3be=['exports','multer','util','path','connect-timeout','Router','./cmCustomField.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x27137b,_0x1c973d){var _0x111090=function(_0x29b1db){while(--_0x29b1db){_0x27137b['push'](_0x27137b['shift']());}};_0x111090(++_0x1c973d);}(_0xf3be,0x1e1));var _0xef3b=function(_0x5c3eec,_0x383646){_0x5c3eec=_0x5c3eec-0x0;var _0xa8fa46=_0xf3be[_0x5c3eec];return _0xa8fa46;};'use strict';var multer=require(_0xef3b('0x0'));var util=require(_0xef3b('0x1'));var path=require(_0xef3b('0x2'));var timeout=require(_0xef3b('0x3'));var express=require('express');var router=express[_0xef3b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xef3b('0x5'));router[_0xef3b('0x6')]('/',auth['isAuthenticated'](),controller[_0xef3b('0x7')]);router[_0xef3b('0x6')](_0xef3b('0x8'),auth[_0xef3b('0x9')](),controller[_0xef3b('0xa')]);router[_0xef3b('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xef3b('0xc')]('/:id',auth[_0xef3b('0x9')](),controller[_0xef3b('0xd')]);router[_0xef3b('0xe')]('/:id',auth[_0xef3b('0x9')](),controller['destroy']);module[_0xef3b('0xf')]=router; \ No newline at end of file +var _0xc83b=['delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x1f39bb,_0x5cd7fe){var _0x57d502=function(_0x391b47){while(--_0x391b47){_0x1f39bb['push'](_0x1f39bb['shift']());}};_0x57d502(++_0x5cd7fe);}(_0xc83b,0xa4));var _0xbc83=function(_0x25d8ea,_0x25ddf1){_0x25d8ea=_0x25d8ea-0x0;var _0x2afc26=_0xc83b[_0x25d8ea];return _0x2afc26;};'use strict';var multer=require(_0xbc83('0x0'));var util=require(_0xbc83('0x1'));var path=require(_0xbc83('0x2'));var timeout=require(_0xbc83('0x3'));var express=require('express');var router=express[_0xbc83('0x4')]();var fs_extra=require(_0xbc83('0x5'));var auth=require(_0xbc83('0x6'));var interaction=require(_0xbc83('0x7'));var config=require(_0xbc83('0x8'));var controller=require('./cmCustomField.controller');router[_0xbc83('0x9')]('/',auth[_0xbc83('0xa')](),controller['index']);router[_0xbc83('0x9')](_0xbc83('0xb'),auth['isAuthenticated'](),controller[_0xbc83('0xc')]);router[_0xbc83('0xd')]('/',auth['isAuthenticated'](),controller[_0xbc83('0xe')]);router[_0xbc83('0xf')](_0xbc83('0xb'),auth[_0xbc83('0xa')](),controller['update']);router[_0xbc83('0x10')](_0xbc83('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xbc83('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 0bc8bc1..feddc16 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 _0xbab4=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue','exports','STRING','BOOLEAN'];(function(_0x5bb804,_0x1e97b0){var _0x176dab=function(_0x299610){while(--_0x299610){_0x5bb804['push'](_0x5bb804['shift']());}};_0x176dab(++_0x1e97b0);}(_0xbab4,0x7b));var _0x4bab=function(_0x513114,_0x4d43f9){_0x513114=_0x513114-0x0;var _0x5bc44e=_0xbab4[_0x513114];return _0x5bc44e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x4bab('0x0')]={'phone':{'type':Sequelize[_0x4bab('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x4bab('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x4bab('0x3')](_0x4bab('0x4'))},'countbusyretry':{'type':Sequelize[_0x4bab('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4bab('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4bab('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4bab('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4bab('0x6')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x4bab('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4bab('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4bab('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x4bab('0x8')},'UserId':{'type':Sequelize[_0x4bab('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x4bab('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x4bab('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4bab('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4bab('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4bab('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcf4e=['STRING','BOOLEAN','contactListQueue','moment','sequelize','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0xcf4e,0x108));var _0xecf4=function(_0xa90f94,_0x76cf3){_0xa90f94=_0xa90f94-0x0;var _0x429da9=_0xcf4e[_0xa90f94];return _0x429da9;};'use strict';var moment=require(_0xecf4('0x0'));var Sequelize=require(_0xecf4('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xecf4('0x2')],'defaultValue':moment()[_0xecf4('0x3')](_0xecf4('0x4'))},'countbusyretry':{'type':Sequelize[_0xecf4('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xecf4('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xecf4('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xecf4('0x2')]},'priority':{'type':Sequelize[_0xecf4('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xecf4('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xecf4('0x5')],'unique':_0xecf4('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xecf4('0x8')},'UserId':{'type':Sequelize[_0xecf4('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xecf4('0x5')],'unique':_0xecf4('0x8')},'CampaignId':{'type':Sequelize[_0xecf4('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xecf4('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xecf4('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xecf4('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xecf4('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index c54bcc2..c64241d 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 _0xe6dd=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','map','CmHopper','rawAttributes','type','filters','intersection','concat','$and','$or','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','attributes','fields','query','length','model','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','VoiceQueueId','VoiceQueue','CampaignId','omit','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','lastName','calleridname','firstName','isNil','finally','CmHopperFinal','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','findOne','LOCK','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6dd,0x88));var _0xde6d=function(_0x423f68,_0x1293de){_0x423f68=_0x423f68-0x0;var _0xf0221f=_0xe6dd[_0x423f68];return _0xf0221f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde6d('0x0'));var zipdir=require(_0xde6d('0x1'));var jsonpatch=require(_0xde6d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xde6d('0x3'));var Mustache=require(_0xde6d('0x4'));var util=require(_0xde6d('0x5'));var path=require(_0xde6d('0x6'));var sox=require(_0xde6d('0x7'));var csv=require(_0xde6d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde6d('0x9'));var _=require(_0xde6d('0xa'));var squel=require(_0xde6d('0xb'));var crypto=require(_0xde6d('0xc'));var jsforce=require(_0xde6d('0xd'));var deskjs=require(_0xde6d('0xe'));var toCsv=require(_0xde6d('0x8'));var querystring=require(_0xde6d('0xf'));var Papa=require(_0xde6d('0x10'));var Redis=require(_0xde6d('0x11'));var authService=require(_0xde6d('0x12'));var qs=require(_0xde6d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde6d('0x14'));var logger=require('../../config/logger')(_0xde6d('0x15'));var utils=require('../../config/utils');var config=require(_0xde6d('0x16'));var licenseUtil=require(_0xde6d('0x17'));var db=require(_0xde6d('0x18'))['db'];function respondWithStatusCode(_0x16da61,_0x2adb58){_0x2adb58=_0x2adb58||0xcc;return function(_0x5d1598){if(_0x5d1598){return _0x16da61[_0xde6d('0x19')](_0x2adb58);}return _0x16da61[_0xde6d('0x1a')](_0x2adb58)[_0xde6d('0x1b')]();};}function respondWithResult(_0x19b42c,_0x4eb1aa){_0x4eb1aa=_0x4eb1aa||0xc8;return function(_0x23882e){if(_0x23882e){return _0x19b42c['status'](_0x4eb1aa)[_0xde6d('0x1c')](_0x23882e);}};}function respondWithFilteredResult(_0x411066,_0x44bf2c){return function(_0x352c5e){if(_0x352c5e){var _0x4186fe=typeof _0x44bf2c[_0xde6d('0x1d')]==='undefined'&&typeof _0x44bf2c[_0xde6d('0x1e')]===_0xde6d('0x1f');var _0x4f213e=_0x352c5e[_0xde6d('0x20')];var _0x1f6d75=_0x4186fe?0x0:_0x44bf2c[_0xde6d('0x1d')];var _0x2c6c42=_0x4186fe?_0x352c5e[_0xde6d('0x20')]:_0x44bf2c[_0xde6d('0x1d')]+_0x44bf2c[_0xde6d('0x1e')];var _0x2c2fd7;if(_0x2c6c42>=_0x4f213e){_0x2c6c42=_0x4f213e;_0x2c2fd7=0xc8;}else{_0x2c2fd7=0xce;}_0x411066[_0xde6d('0x1a')](_0x2c2fd7);return _0x411066[_0xde6d('0x21')](_0xde6d('0x22'),_0x1f6d75+'-'+_0x2c6c42+'/'+_0x4f213e)[_0xde6d('0x1c')](_0x352c5e);}return null;};}function patchUpdates(_0x45e55d){return function(_0x4a54f5){try{jsonpatch[_0xde6d('0x23')](_0x4a54f5,_0x45e55d,!![]);}catch(_0x3ba06e){return BPromise[_0xde6d('0x24')](_0x3ba06e);}return _0x4a54f5['save']();};}function saveUpdates(_0x3a0924,_0xe323f1){return function(_0x23038a){if(_0x23038a){return _0x23038a[_0xde6d('0x25')](_0x3a0924)[_0xde6d('0x26')](function(_0x2bba4f){return _0x2bba4f;});}return null;};}function removeEntity(_0x1e66a6,_0x3b3cd2){return function(_0x3dea63){if(_0x3dea63){return _0x3dea63[_0xde6d('0x27')]()[_0xde6d('0x26')](function(){_0x1e66a6['status'](0xcc)[_0xde6d('0x1b')]();});}};}function handleEntityNotFound(_0x5b0284,_0x4fd8b6){return function(_0x4dfef1){if(!_0x4dfef1){_0x5b0284[_0xde6d('0x19')](0x194);}return _0x4dfef1;};}function handleError(_0x1ee5dd,_0x414660){_0x414660=_0x414660||0x1f4;return function(_0x31e032){logger[_0xde6d('0x28')](_0x31e032[_0xde6d('0x29')]);if(_0x31e032[_0xde6d('0x2a')]){delete _0x31e032[_0xde6d('0x2a')];}_0x1ee5dd[_0xde6d('0x1a')](_0x414660)['send'](_0x31e032);};}exports['index']=function(_0x116417,_0x12750a){var _0x399ec6={},_0x1981c4={},_0x46dd96={'count':0x0,'rows':[]};var _0x3a0489=_[_0xde6d('0x2b')](db[_0xde6d('0x2c')][_0xde6d('0x2d')],function(_0x4cb671){return{'name':_0x4cb671['fieldName'],'type':_0x4cb671[_0xde6d('0x2e')]['key']};});_0x1981c4['model']=_[_0xde6d('0x2b')](_0x3a0489,'name');_0x1981c4['query']=_['keys'](_0x116417['query']);_0x1981c4[_0xde6d('0x2f')]=_[_0xde6d('0x30')](_0x1981c4['model'],_0x1981c4['query']);_0x1981c4[_0xde6d('0x2f')]=_[_0xde6d('0x31')](_0x1981c4[_0xde6d('0x2f')],[_0xde6d('0x32'),_0xde6d('0x33'),'$gt','$gte',_0xde6d('0x34'),_0xde6d('0x35'),_0xde6d('0x36'),_0xde6d('0x37'),_0xde6d('0x38'),_0xde6d('0x39'),_0xde6d('0x3a'),_0xde6d('0x3b'),_0xde6d('0x3c'),_0xde6d('0x3d'),_0xde6d('0x3e'),_0xde6d('0x3f'),_0xde6d('0x40'),'$like',_0xde6d('0x41'),_0xde6d('0x42'),'$contained','$any']);_0x399ec6[_0xde6d('0x43')]=_[_0xde6d('0x30')](_0x1981c4['model'],qs[_0xde6d('0x44')](_0x116417[_0xde6d('0x45')][_0xde6d('0x44')]));_0x399ec6[_0xde6d('0x43')]=_0x399ec6['attributes'][_0xde6d('0x46')]?_0x399ec6['attributes']:_0x1981c4[_0xde6d('0x47')];if(!_0x116417[_0xde6d('0x45')][_0xde6d('0x48')]('nolimit')){_0x399ec6[_0xde6d('0x1e')]=qs[_0xde6d('0x1e')](_0x116417[_0xde6d('0x45')][_0xde6d('0x1e')]);_0x399ec6[_0xde6d('0x1d')]=qs['offset'](_0x116417[_0xde6d('0x45')][_0xde6d('0x1d')]);}_0x399ec6[_0xde6d('0x49')]=qs[_0xde6d('0x4a')](_0x116417[_0xde6d('0x45')][_0xde6d('0x4a')]);_0x399ec6[_0xde6d('0x4b')]=qs['filters'](_['pick'](_0x116417['query'],_0x1981c4['filters']),_0x3a0489);if(_0x116417[_0xde6d('0x45')][_0xde6d('0x4c')]){_0x399ec6['where']=_[_0xde6d('0x4d')](_0x399ec6[_0xde6d('0x4b')],{'$or':_[_0xde6d('0x2b')](_0x3a0489,function(_0x3e8848){if(_0x3e8848[_0xde6d('0x2e')]!=='VIRTUAL'){var _0x48df22={};_0x48df22[_0x3e8848['name']]={'$like':'%'+_0x116417[_0xde6d('0x45')]['filter']+'%'};return _0x48df22;}})});}_0x399ec6=_[_0xde6d('0x4d')]({},_0x399ec6,_0x116417['options']);var _0x429de4={'where':_0x399ec6[_0xde6d('0x4b')]};return db[_0xde6d('0x2c')]['count'](_0x429de4)['then'](function(_0x47f7f4){_0x46dd96[_0xde6d('0x20')]=_0x47f7f4;if(_0x116417[_0xde6d('0x45')][_0xde6d('0x4e')]){_0x399ec6[_0xde6d('0x4f')]=[{'all':!![]}];}return db['CmHopper'][_0xde6d('0x50')](_0x399ec6);})[_0xde6d('0x26')](function(_0xbf35ec){_0x46dd96[_0xde6d('0x51')]=_0xbf35ec;return _0x46dd96;})[_0xde6d('0x26')](respondWithFilteredResult(_0x12750a,_0x399ec6))[_0xde6d('0x52')](handleError(_0x12750a,null));};exports[_0xde6d('0x53')]=function(_0x397f9a,_0x3874c5){var _0x136d92={'raw':!![],'where':{'id':_0x397f9a[_0xde6d('0x54')]['id']}},_0x56f54d={};_0x56f54d[_0xde6d('0x47')]=_[_0xde6d('0x55')](db[_0xde6d('0x2c')][_0xde6d('0x2d')]);_0x56f54d[_0xde6d('0x45')]=_[_0xde6d('0x55')](_0x397f9a[_0xde6d('0x45')]);_0x56f54d[_0xde6d('0x2f')]=_['intersection'](_0x56f54d[_0xde6d('0x47')],_0x56f54d['query']);_0x136d92[_0xde6d('0x43')]=_[_0xde6d('0x30')](_0x56f54d[_0xde6d('0x47')],qs['fields'](_0x397f9a[_0xde6d('0x45')][_0xde6d('0x44')]));_0x136d92[_0xde6d('0x43')]=_0x136d92['attributes'][_0xde6d('0x46')]?_0x136d92[_0xde6d('0x43')]:_0x56f54d[_0xde6d('0x47')];if(_0x397f9a[_0xde6d('0x45')][_0xde6d('0x4e')]){_0x136d92[_0xde6d('0x4f')]=[{'all':!![]}];}_0x136d92=_['merge']({},_0x136d92,_0x397f9a[_0xde6d('0x56')]);return db[_0xde6d('0x2c')][_0xde6d('0x57')](_0x136d92)[_0xde6d('0x26')](handleEntityNotFound(_0x3874c5,null))[_0xde6d('0x26')](respondWithResult(_0x3874c5,null))[_0xde6d('0x52')](handleError(_0x3874c5,null));};exports['create']=function(_0x5be1a1,_0xdf9526){return db[_0xde6d('0x2c')][_0xde6d('0x58')](_0x5be1a1[_0xde6d('0x59')],{})['then'](respondWithResult(_0xdf9526,0xc9))['catch'](handleError(_0xdf9526,null));};exports[_0xde6d('0x25')]=function(_0x24228c,_0x41aac8){if(_0x24228c['body']['id']){delete _0x24228c[_0xde6d('0x59')]['id'];}return db[_0xde6d('0x2c')][_0xde6d('0x57')]({'where':{'id':_0x24228c[_0xde6d('0x54')]['id']}})[_0xde6d('0x26')](handleEntityNotFound(_0x41aac8,null))[_0xde6d('0x26')](saveUpdates(_0x24228c['body'],null))[_0xde6d('0x26')](respondWithResult(_0x41aac8,null))[_0xde6d('0x52')](handleError(_0x41aac8,null));};exports[_0xde6d('0x5a')]=function(_0x42da5a,_0xf723a2){return db[_0xde6d('0x2c')][_0xde6d('0x5a')]()[_0xde6d('0x26')](respondWithResult(_0xf723a2,null))[_0xde6d('0x52')](handleError(_0xf723a2,null));};exports[_0xde6d('0x27')]=function(_0x426f1f,_0x432fee){var _0x358443;return db[_0xde6d('0x2c')][_0xde6d('0x57')]({'where':{'id':_0x426f1f[_0xde6d('0x54')]['id']}})[_0xde6d('0x26')](handleEntityNotFound(_0x432fee,null))[_0xde6d('0x26')](function(_0x4da70){if(_0x4da70){return _0x4da70[_0xde6d('0x27')]()[_0xde6d('0x26')](function(_0x557cfa){return _0x557cfa;});}})[_0xde6d('0x26')](function(_0x464ac6){_0x358443=_0x464ac6;if(_0x464ac6){if(_0x464ac6[_0xde6d('0x5b')]||_0x464ac6['CampaignId']){return db[_0x464ac6['VoiceQueueId']?_0xde6d('0x5c'):'Campaign']['find']({'where':{'id':_0x464ac6['VoiceQueueId']?_0x464ac6[_0xde6d('0x5b')]:_0x464ac6[_0xde6d('0x5d')]},'attributes':['id',_0xde6d('0x2a')],'raw':!![]});}}})['then'](function(_0x51c6de){var _0x5482d0={};if(_0x51c6de){_['merge'](_0x5482d0,_[_0xde6d('0x5e')](_0x358443['dataValues'],[_0xde6d('0x5f'),_0xde6d('0x60'),'id']));_0x5482d0[_0xde6d('0x61')]=0x15;_0x5482d0[_0xde6d('0x62')]=_0xde6d('0x63');_0x5482d0['campaign']=_0x51c6de['name'];_0x5482d0[_0xde6d('0x64')]=_0x426f1f[_0xde6d('0x65')][_0xde6d('0x2a')];_0x5482d0[_0xde6d('0x66')]=_0x426f1f[_0xde6d('0x65')]['id'];_0x5482d0['deleted']=!![];_0x5482d0[_0xde6d('0x67')]=moment()[_0xde6d('0x68')](_0xde6d('0x69'));_0x5482d0[_0xde6d('0x6a')]=_0x358443['phone'];_0x5482d0[_0xde6d('0x6b')]=_0x358443['VoiceQueueId']?_0xde6d('0x6c'):_0xde6d('0x6d');return db[_0xde6d('0x6e')][_0xde6d('0x57')]({'where':{'id':_0x5482d0[_0xde6d('0x6f')]},'attributes':['firstName',_0xde6d('0x70')]})['then'](function(_0x514303){if(!_['isNil'](_0x432fee)&&!_['isNil'](_0x514303['firstName'])){_0x5482d0[_0xde6d('0x71')]=_0x514303[_0xde6d('0x72')];if(!_[_0xde6d('0x73')](_0x514303[_0xde6d('0x70')])){_0x5482d0[_0xde6d('0x71')]+='\x20'+_0x514303['lastName'];}}})[_0xde6d('0x74')](function(){return db[_0xde6d('0x75')][_0xde6d('0x58')](_0x5482d0);});}})[_0xde6d('0x26')](function(){return _0x432fee[_0xde6d('0x1a')](0xcc)[_0xde6d('0x1b')]();})[_0xde6d('0x52')](handleError(_0x432fee,null));};exports['getPreview']=function(_0x1c0909,_0x565775,_0x1b92c3){var _0x44b9ec=[];return db[_0xde6d('0x6e')][_0xde6d('0x5a')]()[_0xde6d('0x26')](function(_0x482f0d){_0x44b9ec=_['keys'](_0x482f0d);return _0x1c0909[_0xde6d('0x65')][_0xde6d('0x76')]({'where':{'type':_0xde6d('0x77'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xde6d('0x78')],'raw':!![]});})['then'](function(_0x8b0a81){if(_0x8b0a81&&_0x8b0a81[_0xde6d('0x46')]){return db[_0xde6d('0x79')]['transaction'](function(_0x647db5){var _0x2dcaf5={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xde6d('0x68')](_0xde6d('0x69'))},'VoiceQueueId':{'$in':_[_0xde6d('0x2b')](_0x8b0a81,'id')},'$or':[{'UserId':null},{'UserId':_0x1c0909[_0xde6d('0x65')]['id']}]};var _0x564c68=[];if(_0x1c0909[_0xde6d('0x59')][_0xde6d('0x7a')]&&_0x1c0909['body'][_0xde6d('0x7a')]===_0xde6d('0x7b')){if(!_[_0xde6d('0x7c')](_0x1c0909[_0xde6d('0x59')][_0xde6d('0x7d')])){_0x2dcaf5['id']={'$in':_0x1c0909[_0xde6d('0x59')][_0xde6d('0x7d')]};}_0x564c68=[[_0xde6d('0x7e'),_0xde6d('0x7f')],[_0xde6d('0x80'),_0x8b0a81[0x0][_0xde6d('0x78')]===_0xde6d('0x7f')?_0xde6d('0x81'):_0xde6d('0x7f')],db[_0xde6d('0x79')][_0xde6d('0x82')](_0xde6d('0x83')),['id',_0xde6d('0x81')]];}else{if(!_[_0xde6d('0x7c')](_0x1c0909['body']['hopperIds'])){_0x2dcaf5['id']={'$notIn':_0x1c0909[_0xde6d('0x59')][_0xde6d('0x7d')]};}_0x564c68=[['priority',_0xde6d('0x81')],[_0xde6d('0x80'),_0x8b0a81[0x0][_0xde6d('0x78')]],db[_0xde6d('0x79')][_0xde6d('0x82')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xde6d('0x7f')]];}return db[_0xde6d('0x2c')][_0xde6d('0x84')]({'attributes':['id','scheduledat'],'where':_0x2dcaf5,'order':_0x564c68,'transaction':_0x647db5,'lock':_0x647db5[_0xde6d('0x85')]['UPDATE'],'include':[{'model':db[_0xde6d('0x6e')],'as':_0xde6d('0x86'),'attributes':_0x44b9ec,'include':[{'model':db[_0xde6d('0x87')],'as':_0xde6d('0x88'),'attributes':['id',_0xde6d('0x2a')]}]},{'model':db[_0xde6d('0x89')],'as':_0xde6d('0x8a'),'attributes':['id',_0xde6d('0x2a')]},{'model':db[_0xde6d('0x5c')],'as':_0xde6d('0x8b'),'attributes':['id','name',_0xde6d('0x8c')]}]})['then'](function(_0x35dfcd){if(_0x35dfcd){return _0x35dfcd[_0xde6d('0x25')]({'UserId':_0x1c0909['user']['id']},{'transaction':_0x647db5});}});});}})['then'](handleEntityNotFound(_0x565775,null))[_0xde6d('0x26')](respondWithResult(_0x565775,null))['catch'](handleError(_0x565775,null));};exports[_0xde6d('0x8d')]=function(_0x5c84ec,_0x5abf9c,_0x465f44){return _0x5c84ec[_0xde6d('0x65')][_0xde6d('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xde6d('0x26')](function(_0x3b9986){if(_0x3b9986&&_0x3b9986[_0xde6d('0x46')]){return db[_0xde6d('0x2c')][_0xde6d('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xde6d('0x68')](_0xde6d('0x69'))},'VoiceQueueId':{'$in':_[_0xde6d('0x2b')](_0x3b9986,'id')},'$or':[{'UserId':null},{'UserId':_0x5c84ec[_0xde6d('0x65')]['id']}]}});}return 0x0;})[_0xde6d('0x26')](function(_0x47144a){if(!_['isNil'](_0x47144a)&&_[_0xde6d('0x8e')](_0x47144a)){return _0x5abf9c[_0xde6d('0x1a')](0xc8)['json']({'contacts':_0x47144a});}else{logger[_0xde6d('0x28')](_0xde6d('0x8f'),'getOpenContacts',0x194,_0xde6d('0x90'));_0x5abf9c[_0xde6d('0x19')](0x194);}})[_0xde6d('0x52')](handleError(_0x5abf9c,null));}; \ No newline at end of file +var _0x196e=['VoiceQueue','Queue','dialActive','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','name','index','map','CmHopper','rawAttributes','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','fields','attributes','hasOwnProperty','nolimit','sort','filter','merge','where','type','includeAll','include','catch','show','params','length','options','find','create','body','describe','VoiceQueueId','omit','dataValues','createdAt','updatedAt','state','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','LOCK','UPDATE','CmCompany','Company','CmList'];(function(_0x3c2e23,_0x2dcebb){var _0x110306=function(_0x5baa29){while(--_0x5baa29){_0x3c2e23['push'](_0x3c2e23['shift']());}};_0x110306(++_0x2dcebb);}(_0x196e,0x96));var _0xe196=function(_0x7c0074,_0x1ffdcf){_0x7c0074=_0x7c0074-0x0;var _0x13e95b=_0x196e[_0x7c0074];return _0x13e95b;};'use strict';var emlformat=require(_0xe196('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe196('0x1'));var jsonpatch=require(_0xe196('0x2'));var rp=require(_0xe196('0x3'));var moment=require(_0xe196('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe196('0x5'));var util=require('util');var path=require(_0xe196('0x6'));var sox=require(_0xe196('0x7'));var csv=require(_0xe196('0x8'));var ejs=require(_0xe196('0x9'));var fs=require('fs');var fs_extra=require(_0xe196('0xa'));var _=require(_0xe196('0xb'));var squel=require(_0xe196('0xc'));var crypto=require(_0xe196('0xd'));var jsforce=require(_0xe196('0xe'));var deskjs=require(_0xe196('0xf'));var toCsv=require(_0xe196('0x8'));var querystring=require(_0xe196('0x10'));var Papa=require(_0xe196('0x11'));var Redis=require(_0xe196('0x12'));var authService=require(_0xe196('0x13'));var qs=require(_0xe196('0x14'));var as=require(_0xe196('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe196('0x16'));var utils=require(_0xe196('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe196('0x18'));var db=require(_0xe196('0x19'))['db'];function respondWithStatusCode(_0x491e92,_0xf6bead){_0xf6bead=_0xf6bead||0xcc;return function(_0x417683){if(_0x417683){return _0x491e92['sendStatus'](_0xf6bead);}return _0x491e92[_0xe196('0x1a')](_0xf6bead)['end']();};}function respondWithResult(_0xe7574a,_0x2cda61){_0x2cda61=_0x2cda61||0xc8;return function(_0x331c8d){if(_0x331c8d){return _0xe7574a[_0xe196('0x1a')](_0x2cda61)[_0xe196('0x1b')](_0x331c8d);}};}function respondWithFilteredResult(_0x2dc22b,_0x23ffd8){return function(_0x832e86){if(_0x832e86){var _0xe90d40=typeof _0x23ffd8[_0xe196('0x1c')]===_0xe196('0x1d')&&typeof _0x23ffd8[_0xe196('0x1e')]==='undefined';var _0x41642c=_0x832e86[_0xe196('0x1f')];var _0x54f1af=_0xe90d40?0x0:_0x23ffd8[_0xe196('0x1c')];var _0x8db238=_0xe90d40?_0x832e86[_0xe196('0x1f')]:_0x23ffd8[_0xe196('0x1c')]+_0x23ffd8[_0xe196('0x1e')];var _0x3bb6b2;if(_0x8db238>=_0x41642c){_0x8db238=_0x41642c;_0x3bb6b2=0xc8;}else{_0x3bb6b2=0xce;}_0x2dc22b[_0xe196('0x1a')](_0x3bb6b2);return _0x2dc22b[_0xe196('0x20')](_0xe196('0x21'),_0x54f1af+'-'+_0x8db238+'/'+_0x41642c)[_0xe196('0x1b')](_0x832e86);}return null;};}function patchUpdates(_0x4ce257){return function(_0x13a068){try{jsonpatch['apply'](_0x13a068,_0x4ce257,!![]);}catch(_0x268767){return BPromise[_0xe196('0x22')](_0x268767);}return _0x13a068[_0xe196('0x23')]();};}function saveUpdates(_0x56d471,_0x1222b3){return function(_0x5ac84d){if(_0x5ac84d){return _0x5ac84d[_0xe196('0x24')](_0x56d471)[_0xe196('0x25')](function(_0x5c05a0){return _0x5c05a0;});}return null;};}function removeEntity(_0x23e95e,_0x140ad9){return function(_0x15dad4){if(_0x15dad4){return _0x15dad4[_0xe196('0x26')]()['then'](function(){_0x23e95e[_0xe196('0x1a')](0xcc)[_0xe196('0x27')]();});}};}function handleEntityNotFound(_0xa9d0f7,_0x1232af){return function(_0x44cc34){if(!_0x44cc34){_0xa9d0f7[_0xe196('0x28')](0x194);}return _0x44cc34;};}function handleError(_0xc3489e,_0x1bdee4){_0x1bdee4=_0x1bdee4||0x1f4;return function(_0x16fb23){logger[_0xe196('0x29')](_0x16fb23['stack']);if(_0x16fb23['name']){delete _0x16fb23[_0xe196('0x2a')];}_0xc3489e[_0xe196('0x1a')](_0x1bdee4)['send'](_0x16fb23);};}exports[_0xe196('0x2b')]=function(_0x4c6c30,_0x4e5dbb){var _0x4d60ce={},_0x212f8e={},_0x15ad20={'count':0x0,'rows':[]};var _0x4f7c64=_[_0xe196('0x2c')](db[_0xe196('0x2d')][_0xe196('0x2e')],function(_0x5a5e9b){return{'name':_0x5a5e9b['fieldName'],'type':_0x5a5e9b['type'][_0xe196('0x2f')]};});_0x212f8e[_0xe196('0x30')]=_[_0xe196('0x2c')](_0x4f7c64,_0xe196('0x2a'));_0x212f8e[_0xe196('0x31')]=_[_0xe196('0x32')](_0x4c6c30['query']);_0x212f8e[_0xe196('0x33')]=_[_0xe196('0x34')](_0x212f8e[_0xe196('0x30')],_0x212f8e[_0xe196('0x31')]);_0x212f8e[_0xe196('0x33')]=_[_0xe196('0x35')](_0x212f8e[_0xe196('0x33')],[_0xe196('0x36'),_0xe196('0x37'),_0xe196('0x38'),'$gte',_0xe196('0x39'),_0xe196('0x3a'),_0xe196('0x3b'),_0xe196('0x3c'),_0xe196('0x3d'),_0xe196('0x3e'),_0xe196('0x3f'),_0xe196('0x40'),_0xe196('0x41'),_0xe196('0x42'),_0xe196('0x43'),_0xe196('0x44'),_0xe196('0x45'),'$like',_0xe196('0x46'),'$contains',_0xe196('0x47'),_0xe196('0x48')]);_0x4d60ce['attributes']=_[_0xe196('0x34')](_0x212f8e['model'],qs[_0xe196('0x49')](_0x4c6c30[_0xe196('0x31')][_0xe196('0x49')]));_0x4d60ce[_0xe196('0x4a')]=_0x4d60ce[_0xe196('0x4a')]['length']?_0x4d60ce['attributes']:_0x212f8e['model'];if(!_0x4c6c30[_0xe196('0x31')][_0xe196('0x4b')](_0xe196('0x4c'))){_0x4d60ce[_0xe196('0x1e')]=qs['limit'](_0x4c6c30['query'][_0xe196('0x1e')]);_0x4d60ce['offset']=qs[_0xe196('0x1c')](_0x4c6c30[_0xe196('0x31')]['offset']);}_0x4d60ce['order']=qs[_0xe196('0x4d')](_0x4c6c30[_0xe196('0x31')]['sort']);_0x4d60ce['where']=qs[_0xe196('0x33')](_['pick'](_0x4c6c30[_0xe196('0x31')],_0x212f8e['filters']),_0x4f7c64);if(_0x4c6c30['query'][_0xe196('0x4e')]){_0x4d60ce['where']=_[_0xe196('0x4f')](_0x4d60ce[_0xe196('0x50')],{'$or':_[_0xe196('0x2c')](_0x4f7c64,function(_0x13533d){if(_0x13533d[_0xe196('0x51')]!=='VIRTUAL'){var _0x16896b={};_0x16896b[_0x13533d[_0xe196('0x2a')]]={'$like':'%'+_0x4c6c30[_0xe196('0x31')][_0xe196('0x4e')]+'%'};return _0x16896b;}})});}_0x4d60ce=_[_0xe196('0x4f')]({},_0x4d60ce,_0x4c6c30['options']);var _0x313381={'where':_0x4d60ce[_0xe196('0x50')]};return db['CmHopper'][_0xe196('0x1f')](_0x313381)['then'](function(_0x30c524){_0x15ad20[_0xe196('0x1f')]=_0x30c524;if(_0x4c6c30[_0xe196('0x31')][_0xe196('0x52')]){_0x4d60ce[_0xe196('0x53')]=[{'all':!![]}];}return db[_0xe196('0x2d')]['findAll'](_0x4d60ce);})['then'](function(_0x32a583){_0x15ad20['rows']=_0x32a583;return _0x15ad20;})[_0xe196('0x25')](respondWithFilteredResult(_0x4e5dbb,_0x4d60ce))[_0xe196('0x54')](handleError(_0x4e5dbb,null));};exports[_0xe196('0x55')]=function(_0x13218f,_0x579118){var _0xf45418={'raw':!![],'where':{'id':_0x13218f[_0xe196('0x56')]['id']}},_0x4fb187={};_0x4fb187[_0xe196('0x30')]=_[_0xe196('0x32')](db['CmHopper']['rawAttributes']);_0x4fb187[_0xe196('0x31')]=_[_0xe196('0x32')](_0x13218f[_0xe196('0x31')]);_0x4fb187[_0xe196('0x33')]=_['intersection'](_0x4fb187[_0xe196('0x30')],_0x4fb187[_0xe196('0x31')]);_0xf45418['attributes']=_[_0xe196('0x34')](_0x4fb187['model'],qs[_0xe196('0x49')](_0x13218f[_0xe196('0x31')][_0xe196('0x49')]));_0xf45418[_0xe196('0x4a')]=_0xf45418['attributes'][_0xe196('0x57')]?_0xf45418['attributes']:_0x4fb187[_0xe196('0x30')];if(_0x13218f[_0xe196('0x31')][_0xe196('0x52')]){_0xf45418['include']=[{'all':!![]}];}_0xf45418=_[_0xe196('0x4f')]({},_0xf45418,_0x13218f[_0xe196('0x58')]);return db[_0xe196('0x2d')][_0xe196('0x59')](_0xf45418)['then'](handleEntityNotFound(_0x579118,null))[_0xe196('0x25')](respondWithResult(_0x579118,null))[_0xe196('0x54')](handleError(_0x579118,null));};exports[_0xe196('0x5a')]=function(_0x23d0d2,_0x4b5b6e){return db[_0xe196('0x2d')][_0xe196('0x5a')](_0x23d0d2[_0xe196('0x5b')],{})[_0xe196('0x25')](respondWithResult(_0x4b5b6e,0xc9))['catch'](handleError(_0x4b5b6e,null));};exports[_0xe196('0x24')]=function(_0x1e6531,_0x57a06f){if(_0x1e6531[_0xe196('0x5b')]['id']){delete _0x1e6531['body']['id'];}return db[_0xe196('0x2d')][_0xe196('0x59')]({'where':{'id':_0x1e6531['params']['id']}})[_0xe196('0x25')](handleEntityNotFound(_0x57a06f,null))[_0xe196('0x25')](saveUpdates(_0x1e6531['body'],null))[_0xe196('0x25')](respondWithResult(_0x57a06f,null))[_0xe196('0x54')](handleError(_0x57a06f,null));};exports[_0xe196('0x5c')]=function(_0x1a3d64,_0x124001){return db[_0xe196('0x2d')][_0xe196('0x5c')]()['then'](respondWithResult(_0x124001,null))[_0xe196('0x54')](handleError(_0x124001,null));};exports[_0xe196('0x26')]=function(_0x3ff619,_0x42328c){var _0x1d3c55;return db['CmHopper']['find']({'where':{'id':_0x3ff619['params']['id']}})[_0xe196('0x25')](handleEntityNotFound(_0x42328c,null))[_0xe196('0x25')](function(_0xa2c0fa){if(_0xa2c0fa){return _0xa2c0fa[_0xe196('0x26')]()[_0xe196('0x25')](function(_0x4e66f1){return _0x4e66f1;});}})['then'](function(_0x4ed15f){_0x1d3c55=_0x4ed15f;if(_0x4ed15f){if(_0x4ed15f[_0xe196('0x5d')]||_0x4ed15f['CampaignId']){return db[_0x4ed15f['VoiceQueueId']?'VoiceQueue':'Campaign'][_0xe196('0x59')]({'where':{'id':_0x4ed15f[_0xe196('0x5d')]?_0x4ed15f[_0xe196('0x5d')]:_0x4ed15f['CampaignId']},'attributes':['id',_0xe196('0x2a')],'raw':!![]});}}})[_0xe196('0x25')](function(_0x59fc6d){var _0x14dc9d={};if(_0x59fc6d){_[_0xe196('0x4f')](_0x14dc9d,_[_0xe196('0x5e')](_0x1d3c55[_0xe196('0x5f')],[_0xe196('0x60'),_0xe196('0x61'),'id']));_0x14dc9d[_0xe196('0x62')]=0x15;_0x14dc9d['statedesc']='deleted';_0x14dc9d[_0xe196('0x63')]=_0x59fc6d[_0xe196('0x2a')];_0x14dc9d[_0xe196('0x64')]=_0x3ff619[_0xe196('0x65')]['name'];_0x14dc9d[_0xe196('0x66')]=_0x3ff619[_0xe196('0x65')]['id'];_0x14dc9d[_0xe196('0x67')]=!![];_0x14dc9d[_0xe196('0x68')]=moment()[_0xe196('0x69')](_0xe196('0x6a'));_0x14dc9d[_0xe196('0x6b')]=_0x1d3c55[_0xe196('0x6c')];_0x14dc9d[_0xe196('0x6d')]=_0x1d3c55['VoiceQueueId']?_0xe196('0x6e'):'ivr';return db[_0xe196('0x6f')]['find']({'where':{'id':_0x14dc9d[_0xe196('0x70')]},'attributes':['firstName',_0xe196('0x71')]})['then'](function(_0x54d8c1){if(!_['isNil'](_0x42328c)&&!_[_0xe196('0x72')](_0x54d8c1[_0xe196('0x73')])){_0x14dc9d['calleridname']=_0x54d8c1['firstName'];if(!_[_0xe196('0x72')](_0x54d8c1[_0xe196('0x71')])){_0x14dc9d[_0xe196('0x74')]+='\x20'+_0x54d8c1[_0xe196('0x71')];}}})['finally'](function(){return db[_0xe196('0x75')]['create'](_0x14dc9d);});}})[_0xe196('0x25')](function(){return _0x42328c['status'](0xcc)[_0xe196('0x27')]();})[_0xe196('0x54')](handleError(_0x42328c,null));};exports['getPreview']=function(_0x1c03e1,_0x5d0b13,_0x1f71e4){var _0x59ebbf=[];return db['CmContact'][_0xe196('0x5c')]()[_0xe196('0x25')](function(_0x195be7){_0x59ebbf=_[_0xe196('0x32')](_0x195be7);return _0x1c03e1['user'][_0xe196('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xe196('0x77')},'attributes':['id',_0xe196('0x78')],'raw':!![]});})['then'](function(_0x486f37){if(_0x486f37&&_0x486f37[_0xe196('0x57')]){return db[_0xe196('0x79')]['transaction'](function(_0x5f2c1c){var _0x4cdd32={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe196('0x69')](_0xe196('0x6a'))},'VoiceQueueId':{'$in':_[_0xe196('0x2c')](_0x486f37,'id')},'$or':[{'UserId':null},{'UserId':_0x1c03e1[_0xe196('0x65')]['id']}]};var _0x212466=[];if(_0x1c03e1[_0xe196('0x5b')]['direction']&&_0x1c03e1['body']['direction']===_0xe196('0x7a')){if(!_[_0xe196('0x7b')](_0x1c03e1[_0xe196('0x5b')][_0xe196('0x7c')])){_0x4cdd32['id']={'$in':_0x1c03e1[_0xe196('0x5b')][_0xe196('0x7c')]};}_0x212466=[[_0xe196('0x7d'),_0xe196('0x7e')],[_0xe196('0x7f'),_0x486f37[0x0][_0xe196('0x78')]===_0xe196('0x7e')?_0xe196('0x80'):_0xe196('0x7e')],db[_0xe196('0x79')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0xe196('0x7b')](_0x1c03e1['body'][_0xe196('0x7c')])){_0x4cdd32['id']={'$notIn':_0x1c03e1['body'][_0xe196('0x7c')]};}_0x212466=[[_0xe196('0x7d'),'DESC'],[_0xe196('0x7f'),_0x486f37[0x0][_0xe196('0x78')]],db[_0xe196('0x79')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db['CmHopper']['findOne']({'attributes':['id','scheduledat'],'where':_0x4cdd32,'order':_0x212466,'transaction':_0x5f2c1c,'lock':_0x5f2c1c[_0xe196('0x81')][_0xe196('0x82')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x59ebbf,'include':[{'model':db[_0xe196('0x83')],'as':_0xe196('0x84'),'attributes':['id',_0xe196('0x2a')]}]},{'model':db[_0xe196('0x85')],'as':'List','attributes':['id','name']},{'model':db[_0xe196('0x86')],'as':_0xe196('0x87'),'attributes':['id',_0xe196('0x2a'),_0xe196('0x88')]}]})[_0xe196('0x25')](function(_0x18a2a2){if(_0x18a2a2){return _0x18a2a2[_0xe196('0x24')]({'UserId':_0x1c03e1[_0xe196('0x65')]['id']},{'transaction':_0x5f2c1c});}});});}})[_0xe196('0x25')](handleEntityNotFound(_0x5d0b13,null))[_0xe196('0x25')](respondWithResult(_0x5d0b13,null))[_0xe196('0x54')](handleError(_0x5d0b13,null));};exports['getOpenContacts']=function(_0x3686ee,_0x390576,_0x470e93){return _0x3686ee['user'][_0xe196('0x76')]({'where':{'type':_0xe196('0x89'),'dialActive':!![],'dialMethod':_0xe196('0x77')},'attributes':['id'],'raw':!![]})[_0xe196('0x25')](function(_0x36bbb9){if(_0x36bbb9&&_0x36bbb9['length']){return db[_0xe196('0x2d')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe196('0x69')](_0xe196('0x6a'))},'VoiceQueueId':{'$in':_[_0xe196('0x2c')](_0x36bbb9,'id')},'$or':[{'UserId':null},{'UserId':_0x3686ee[_0xe196('0x65')]['id']}]}});}return 0x0;})[_0xe196('0x25')](function(_0x5d139d){if(!_[_0xe196('0x72')](_0x5d139d)&&_[_0xe196('0x8a')](_0x5d139d)){return _0x390576[_0xe196('0x1a')](0xc8)[_0xe196('0x1b')]({'contacts':_0x5d139d});}else{logger[_0xe196('0x29')](_0xe196('0x8b'),_0xe196('0x8c'),0x194,_0xe196('0x8d'));_0x390576[_0xe196('0x28')](0x194);}})['catch'](handleError(_0x390576,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 8682ec8..c8444a5 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 _0x90b1=['priority','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','CmHopper','cm_hopper','scheduledat','phone'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x90b1,0x1bb));var _0x190b=function(_0x52c9b3,_0x9f75c5){_0x52c9b3=_0x52c9b3-0x0;var _0x281c6d=_0x90b1[_0x52c9b3];return _0x281c6d;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xa')]},{'name':_0x190b('0xb'),'fields':['phone']},{'name':_0x190b('0xc'),'fields':[_0x190b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x2972d1,_0x433cc4){var _0x418ecb=function(_0x3898bb){while(--_0x3898bb){_0x2972d1['push'](_0x2972d1['shift']());}};_0x418ecb(++_0x433cc4);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4de38a,_0x2442d3){_0x4de38a=_0x4de38a-0x0;var _0x2b3563=_0xc1c6[_0x4de38a];return _0x2b3563;};'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 diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 8cfc889..83264bf 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 _0x67d6=['map','model','find','raw','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','CmHopper','update','DestroyCmHopper','destroy','CmContact','transaction','LOCK','UPDATE','Contact','keys','User','Agent','voicePause','length','UserId','push','includes','GetContactDialer','MoveContactManagedDialer','sequelize','CmHopperFinal','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','describe','order','all','GetContactRecallMe','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopper,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetCmHopper','findAll','options','where','attributes','limit','include'];(function(_0x26cab7,_0x1ccfca){var _0x31ba06=function(_0x1ed04a){while(--_0x1ed04a){_0x26cab7['push'](_0x26cab7['shift']());}};_0x31ba06(++_0x1ccfca);}(_0x67d6,0x6b));var _0x667d=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x67d6[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x667d('0x0'));var BPromise=require(_0x667d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x667d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x667d('0x3'));var logger=require(_0x667d('0x4'))(_0x667d('0x5'));var config=require(_0x667d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x667d('0x7')][_0x667d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55971c,_0x392569,_0x386f83){return new BPromise(function(_0x34e791,_0x55e568){return client[_0x667d('0x9')](_0x55971c,_0x386f83)[_0x667d('0xa')](function(_0x5c136c){logger[_0x667d('0xb')](_0x667d('0xc'),_0x392569,'request\x20sent');logger[_0x667d('0xd')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x392569,_0x667d('0xe'),JSON[_0x667d('0xf')](_0x5c136c));if(_0x5c136c['error']){if(_0x5c136c[_0x667d('0x10')][_0x667d('0x11')]===0x1f4){logger[_0x667d('0x10')](_0x667d('0xc'),_0x392569,_0x5c136c[_0x667d('0x10')][_0x667d('0x12')]);return _0x55e568(_0x5c136c[_0x667d('0x10')]['message']);}logger[_0x667d('0x10')](_0x667d('0xc'),_0x392569,_0x5c136c[_0x667d('0x10')]['message']);return _0x34e791(_0x5c136c[_0x667d('0x10')][_0x667d('0x12')]);}else{logger[_0x667d('0xb')](_0x667d('0xc'),_0x392569,_0x667d('0xe'));_0x34e791(_0x5c136c['result'][_0x667d('0x12')]);}})[_0x667d('0x13')](function(_0x26a977){logger[_0x667d('0x10')](_0x667d('0xc'),_0x392569,_0x26a977);_0x55e568(_0x26a977);});});}exports[_0x667d('0x14')]=function(_0x5080c7){var _0x18bf2c=this;return new Promise(function(_0x25b8bb,_0x3e0a5d){return db['CmHopper'][_0x667d('0x15')]({'raw':_0x5080c7[_0x667d('0x16')]?_0x5080c7[_0x667d('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5080c7[_0x667d('0x16')]?_0x5080c7[_0x667d('0x16')][_0x667d('0x17')]||null:null,'attributes':_0x5080c7[_0x667d('0x16')]?_0x5080c7[_0x667d('0x16')][_0x667d('0x18')]||null:null,'limit':_0x5080c7[_0x667d('0x16')]?_0x5080c7[_0x667d('0x16')][_0x667d('0x19')]||null:null,'include':_0x5080c7['options']?_0x5080c7['options'][_0x667d('0x1a')]?_[_0x667d('0x1b')](_0x5080c7['options']['include'],function(_0x55d47e){return{'model':db[_0x55d47e['model']],'as':_0x55d47e['as'],'attributes':_0x55d47e[_0x667d('0x18')],'include':_0x55d47e[_0x667d('0x1a')]?_[_0x667d('0x1b')](_0x55d47e['include'],function(_0x59f993){return{'model':db[_0x59f993['model']],'as':_0x59f993['as'],'attributes':_0x59f993['attributes'],'include':_0x59f993['include']?_[_0x667d('0x1b')](_0x59f993[_0x667d('0x1a')],function(_0x583334){return{'model':db[_0x583334[_0x667d('0x1c')]],'as':_0x583334['as'],'attributes':_0x583334[_0x667d('0x18')]};}):[]};}):[]};}):[]:[]})[_0x667d('0xa')](function(_0x457550){logger[_0x667d('0xb')]('GetCmHopper',_0x5080c7);logger[_0x667d('0xd')]('GetCmHopper',_0x5080c7,JSON[_0x667d('0xf')](_0x457550));_0x25b8bb(_0x457550);})[_0x667d('0x13')](function(_0x7238d9){logger[_0x667d('0x10')](_0x667d('0x14'),_0x7238d9['message'],_0x5080c7);_0x3e0a5d(_0x18bf2c[_0x667d('0x10')](0x1f4,_0x7238d9[_0x667d('0x12')]));});});};exports['ShowCmHopper']=function(_0x2633dc){var _0x2dee9c=this;return new Promise(function(_0x51d7b8,_0x3b7ffb){return db['CmHopper'][_0x667d('0x1d')]({'raw':_0x2633dc[_0x667d('0x16')]?_0x2633dc[_0x667d('0x16')][_0x667d('0x1e')]===undefined?!![]:![]:!![],'where':_0x2633dc[_0x667d('0x16')]?_0x2633dc[_0x667d('0x16')]['where']||null:null,'attributes':_0x2633dc['options']?_0x2633dc['options'][_0x667d('0x18')]||null:null,'include':_0x2633dc[_0x667d('0x16')]?_0x2633dc['options'][_0x667d('0x1a')]?_[_0x667d('0x1b')](_0x2633dc[_0x667d('0x16')]['include'],function(_0x2d11a5){return{'model':db[_0x2d11a5[_0x667d('0x1c')]],'as':_0x2d11a5['as'],'attributes':_0x2d11a5[_0x667d('0x18')],'include':_0x2d11a5[_0x667d('0x1a')]?_[_0x667d('0x1b')](_0x2d11a5['include'],function(_0x4710bc){return{'model':db[_0x4710bc[_0x667d('0x1c')]],'as':_0x4710bc['as'],'attributes':_0x4710bc['attributes'],'include':_0x4710bc['include']?_[_0x667d('0x1b')](_0x4710bc[_0x667d('0x1a')],function(_0x3b6888){return{'model':db[_0x3b6888['model']],'as':_0x3b6888['as'],'attributes':_0x3b6888['attributes']};}):[]};}):[]};}):[]:[]})[_0x667d('0xa')](function(_0x5a682a){logger[_0x667d('0xb')](_0x667d('0x1f'),_0x2633dc);logger[_0x667d('0xd')](_0x667d('0x1f'),_0x2633dc,JSON['stringify'](_0x5a682a));_0x51d7b8(_0x5a682a);})['catch'](function(_0xeee767){logger['error']('ShowCmHopper',_0xeee767[_0x667d('0x12')],_0x2633dc);_0x3b7ffb(_0x2dee9c[_0x667d('0x10')](0x1f4,_0xeee767[_0x667d('0x12')]));});});};exports[_0x667d('0x20')]=function(_0x5cc5c3){var _0x5d35ec=this;return new Promise(function(_0x5628c7,_0x3e5302){return db['CmHopper'][_0x667d('0x21')](_0x5cc5c3[_0x667d('0x22')],{'raw':_0x5cc5c3[_0x667d('0x16')]?_0x5cc5c3[_0x667d('0x16')][_0x667d('0x1e')]===undefined?!![]:![]:!![]})[_0x667d('0xa')](function(_0x4dbaee){logger[_0x667d('0xb')](_0x667d('0x20'),_0x5cc5c3);logger[_0x667d('0xd')](_0x667d('0x20'),_0x5cc5c3,JSON[_0x667d('0xf')](_0x4dbaee));_0x5628c7(_0x4dbaee);})[_0x667d('0x13')](function(_0x286038){logger['error'](_0x667d('0x20'),_0x286038['message'],_0x5cc5c3);_0x3e5302(_0x5d35ec[_0x667d('0x10')](0x1f4,_0x286038[_0x667d('0x12')]));});});};exports[_0x667d('0x23')]=function(_0x45acbf){var _0x20a05d=this;return new Promise(function(_0xd98e1d,_0x2b6885){return db[_0x667d('0x24')][_0x667d('0x25')](_0x45acbf[_0x667d('0x22')],{'raw':_0x45acbf[_0x667d('0x16')]?_0x45acbf[_0x667d('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45acbf[_0x667d('0x16')]?_0x45acbf[_0x667d('0x16')][_0x667d('0x17')]||null:null,'attributes':_0x45acbf[_0x667d('0x16')]?_0x45acbf[_0x667d('0x16')][_0x667d('0x18')]||null:null,'limit':_0x45acbf[_0x667d('0x16')]?_0x45acbf[_0x667d('0x16')][_0x667d('0x19')]||null:null})[_0x667d('0xa')](function(_0x4eb31b){logger[_0x667d('0xb')](_0x667d('0x23'),_0x45acbf);logger['debug'](_0x667d('0x23'),_0x45acbf,JSON[_0x667d('0xf')](_0x4eb31b));_0xd98e1d(_0x4eb31b);})['catch'](function(_0x26d389){logger['error'](_0x667d('0x23'),_0x26d389[_0x667d('0x12')],_0x45acbf);_0x2b6885(_0x20a05d[_0x667d('0x10')](0x1f4,_0x26d389[_0x667d('0x12')]));});});};exports[_0x667d('0x26')]=function(_0x2e047a){var _0x549453=this;return new Promise(function(_0x4b9fd2,_0xef2084){return db[_0x667d('0x24')][_0x667d('0x27')]({'where':_0x2e047a[_0x667d('0x16')]?_0x2e047a[_0x667d('0x16')]['where']||null:null})['then'](function(_0x1219ad){logger['info']('DestroyCmHopper',_0x2e047a);logger[_0x667d('0xd')]('DestroyCmHopper',_0x2e047a,JSON[_0x667d('0xf')](_0x1219ad));_0x4b9fd2(_0x1219ad);})[_0x667d('0x13')](function(_0x6f2732){logger['error']('DestroyCmHopper',_0x6f2732['message'],_0x2e047a);_0xef2084(_0x549453[_0x667d('0x10')](0x1f4,_0x6f2732[_0x667d('0x12')]));});});};exports['GetContactDialer']=function(_0x6fd2a3){var _0x2c76ed=this;return new Promise(function(_0x39adbb,_0x68a12e){return db[_0x667d('0x28')]['describe']()[_0x667d('0xa')](function(_0x32e113){return db['sequelize'][_0x667d('0x29')](function(_0x4e6c55){return db['CmHopper'][_0x667d('0x15')]({'where':_0x6fd2a3[_0x667d('0x16')]?_0x6fd2a3[_0x667d('0x16')]['where']||null:null,'attributes':_0x6fd2a3[_0x667d('0x16')]?_0x6fd2a3['options'][_0x667d('0x18')]||null:null,'limit':_0x6fd2a3[_0x667d('0x16')]?_0x6fd2a3[_0x667d('0x16')][_0x667d('0x19')]||null:null,'order':_0x6fd2a3[_0x667d('0x16')]?_0x6fd2a3[_0x667d('0x16')]['order']||null:null,'transaction':_0x4e6c55,'lock':_0x4e6c55[_0x667d('0x2a')][_0x667d('0x2b')],'include':[{'model':db['CmContact'],'as':_0x667d('0x2c'),'attributes':_[_0x667d('0x2d')](_0x32e113)},{'model':db[_0x667d('0x2e')],'as':_0x667d('0x2f'),'attributes':['id','name',_0x667d('0x30')]}]})[_0x667d('0xa')](function(_0x5cdb7b){var _0x5ed585=[];var _0x423f55=[];for(var _0x578132=0x0;_0x578132<_0x5cdb7b[_0x667d('0x31')];_0x578132+=0x1){var _0x267e45=_0x5cdb7b[_0x578132][_0x667d('0x32')];if(_0x267e45===null){_0x5ed585[_0x667d('0x33')](_0x5cdb7b[_0x578132][_0x667d('0x25')](_0x6fd2a3[_0x667d('0x22')],{'transaction':_0x4e6c55}));}else if(!_0x423f55[_0x667d('0x34')](_0x267e45)){_0x423f55[_0x667d('0x33')](_0x267e45);_0x5ed585[_0x667d('0x33')](_0x5cdb7b[_0x578132][_0x667d('0x25')](_0x6fd2a3['body'],{'transaction':_0x4e6c55}));}}return BPromise['all'](_0x5ed585);});})[_0x667d('0xa')](function(_0x46c7c1){logger[_0x667d('0xb')]('GetContactDialer',_0x6fd2a3);logger[_0x667d('0xd')](_0x667d('0x35'),_0x6fd2a3,JSON[_0x667d('0xf')](_0x46c7c1));_0x39adbb(_0x46c7c1);})['catch'](function(_0x53194c){logger['error']('GetContactDialer',_0x53194c[_0x667d('0x12')],_0x6fd2a3);_0x68a12e(_0x2c76ed[_0x667d('0x10')](0x1f4,_0x53194c['message']));});});});};exports[_0x667d('0x36')]=function(_0x3306d9){var _0x2ceef8=this;return new Promise(function(_0x4b361b,_0x2c5862){return db[_0x667d('0x37')][_0x667d('0x29')](function(_0x1700e2){return db[_0x667d('0x38')][_0x667d('0x21')](_0x3306d9['body'],{'raw':_0x3306d9['options']?_0x3306d9[_0x667d('0x16')][_0x667d('0x1e')]===undefined?!![]:![]:!![],'transaction':_0x1700e2})['then'](function(){return db[_0x667d('0x24')][_0x667d('0x27')]({'where':_0x3306d9[_0x667d('0x16')]?_0x3306d9[_0x667d('0x16')][_0x667d('0x17')]||null:null,'transaction':_0x1700e2});});})[_0x667d('0xa')](function(_0x20d412){logger[_0x667d('0xb')](_0x667d('0x36'),_0x3306d9);logger['debug'](_0x667d('0x36'),_0x3306d9,JSON[_0x667d('0xf')](_0x20d412));_0x4b361b(_0x20d412);})[_0x667d('0x13')](function(_0x453f1e){logger[_0x667d('0x10')](_0x667d('0x36'),_0x453f1e['message'],_0x3306d9);_0x2c5862(_0x2ceef8[_0x667d('0x10')](0x1f4,_0x453f1e[_0x667d('0x12')]));});});};exports['CountReScheduled']=function(_0x5ad913){var _0x21c359=this;return new Promise(function(_0x1ee8ad,_0x2f3158){return db['CmHopper'][_0x667d('0x15')]({'raw':_0x5ad913[_0x667d('0x16')]?_0x5ad913['options'][_0x667d('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ad913[_0x667d('0x16')]?_0x5ad913[_0x667d('0x16')][_0x667d('0x17')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x667d('0x37')]['fn']('IF',db[_0x667d('0x37')][_0x667d('0x39')]('`scheduledat`\x20>=\x20'+util[_0x667d('0x3a')](_0x667d('0x3b'),moment()[_0x667d('0x3a')](_0x667d('0x3c')))+_0x667d('0x3d')))),'contactsRescheduled']]})[_0x667d('0xa')](function(_0x1abe12){logger[_0x667d('0xb')](_0x667d('0x3e'),_0x5ad913);logger[_0x667d('0xd')](_0x667d('0x3e'),_0x5ad913,JSON[_0x667d('0xf')](_0x1abe12));_0x1ee8ad(_0x1abe12);})[_0x667d('0x13')](function(_0x2cfede){logger[_0x667d('0x10')](_0x667d('0x3e'),_0x2cfede[_0x667d('0x12')],_0x5ad913);_0x2f3158(_0x21c359[_0x667d('0x10')](0x1f4,_0x2cfede[_0x667d('0x12')]));});});};exports['GetContactRecallMe']=function(_0x8de975){var _0xd46fa4=this;return new Promise(function(_0x40328d,_0x4864b1){return db[_0x667d('0x28')][_0x667d('0x3f')]()[_0x667d('0xa')](function(_0x2b0e28){return db[_0x667d('0x37')]['transaction'](function(_0x533792){return db[_0x667d('0x24')][_0x667d('0x15')]({'where':_0x8de975[_0x667d('0x16')]?_0x8de975[_0x667d('0x16')][_0x667d('0x17')]||null:null,'attributes':_0x8de975[_0x667d('0x16')]?_0x8de975[_0x667d('0x16')]['attributes']||null:null,'limit':0x1,'order':_0x8de975[_0x667d('0x16')]?_0x8de975[_0x667d('0x16')][_0x667d('0x40')]||null:null,'group':db[_0x667d('0x24')][_0x667d('0x32')],'transaction':_0x533792,'lock':_0x533792[_0x667d('0x2a')]['UPDATE'],'include':_0x8de975[_0x667d('0x16')]?_0x8de975[_0x667d('0x16')]['include']?_[_0x667d('0x1b')](_0x8de975[_0x667d('0x16')]['include'],function(_0x25881a){return{'model':db[_0x25881a[_0x667d('0x1c')]],'as':_0x25881a['as'],'attributes':_0x25881a[_0x667d('0x18')],'include':_0x25881a[_0x667d('0x1a')]?_[_0x667d('0x1b')](_0x25881a[_0x667d('0x1a')],function(_0xdd2ac1){return{'model':db[_0xdd2ac1[_0x667d('0x1c')]],'as':_0xdd2ac1['as'],'attributes':_0xdd2ac1[_0x667d('0x18')],'include':_0xdd2ac1[_0x667d('0x1a')]?_[_0x667d('0x1b')](_0xdd2ac1[_0x667d('0x1a')],function(_0x27b608){return{'model':db[_0x27b608['model']],'as':_0x27b608['as'],'attributes':_0x27b608['attributes']};}):[]};}):[]};}):[]:[]})[_0x667d('0xa')](function(_0x584238){var _0x12880a=[];for(var _0x28a9fb=0x0;_0x28a9fb<_0x584238[_0x667d('0x31')];_0x28a9fb+=0x1){_0x12880a[_0x667d('0x33')](_0x584238[_0x28a9fb][_0x667d('0x25')](_0x8de975[_0x667d('0x22')],{'transaction':_0x533792}));}return BPromise[_0x667d('0x41')](_0x12880a);});})[_0x667d('0xa')](function(_0x37e833){logger['info']('GetContactRecallMe',_0x8de975);logger[_0x667d('0xd')](_0x667d('0x42'),_0x8de975,JSON[_0x667d('0xf')](_0x37e833));_0x40328d(_0x37e833);})[_0x667d('0x13')](function(_0x24525f){logger[_0x667d('0x10')](_0x667d('0x42'),_0x24525f[_0x667d('0x12')],_0x8de975);_0x4864b1(_0xd46fa4[_0x667d('0x10')](0x1f4,_0x24525f['message']));});});});};exports['GetCmHopperPreview']=function(_0x4b5134){var _0x4d334a=this;return new Promise(function(_0x143272,_0x2508df){db['CmContact']['describe']()[_0x667d('0xa')](function(_0x327f2e){return db['CmHopper'][_0x667d('0x15')]({'raw':_0x4b5134[_0x667d('0x16')]?_0x4b5134[_0x667d('0x16')][_0x667d('0x1e')]===undefined?!![]:![]:!![],'where':_0x4b5134[_0x667d('0x16')]?_0x4b5134['options'][_0x667d('0x17')]||null:null,'attributes':_0x4b5134['options']?_0x4b5134[_0x667d('0x16')]['attributes']||null:null,'limit':_0x4b5134[_0x667d('0x16')]?_0x4b5134[_0x667d('0x16')]['limit']||null:null,'include':_0x4b5134[_0x667d('0x16')]?_0x4b5134['options']['include']?_['map'](_0x4b5134[_0x667d('0x16')][_0x667d('0x1a')],function(_0x11df16){return{'model':db[_0x11df16[_0x667d('0x1c')]],'as':_0x11df16['as'],'attributes':_0x11df16['as']===_0x667d('0x2c')?_[_0x667d('0x2d')](_0x327f2e):_0x11df16[_0x667d('0x18')],'include':_0x11df16[_0x667d('0x1a')]?_[_0x667d('0x1b')](_0x11df16[_0x667d('0x1a')],function(_0x56b697){return{'model':db[_0x56b697[_0x667d('0x1c')]],'as':_0x56b697['as'],'attributes':_0x56b697[_0x667d('0x18')],'include':_0x56b697[_0x667d('0x1a')]?_[_0x667d('0x1b')](_0x56b697[_0x667d('0x1a')],function(_0x1ef61c){return{'model':db[_0x1ef61c['model']],'as':_0x1ef61c['as'],'attributes':_0x1ef61c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x49f1c9){logger[_0x667d('0xb')](_0x667d('0x14'),_0x4b5134);logger[_0x667d('0xd')](_0x667d('0x14'),_0x4b5134,JSON[_0x667d('0xf')](_0x49f1c9));_0x143272(_0x49f1c9);})[_0x667d('0x13')](function(_0x39592f){logger['error'](_0x667d('0x14'),_0x39592f[_0x667d('0x12')],_0x4b5134);_0x2508df(_0x4d334a[_0x667d('0x10')](0x1f4,_0x39592f[_0x667d('0x12')]));});});});}; \ No newline at end of file +var _0x374e=['Agent','name','voicePause','length','UserId','push','includes','MoveContactManagedDialer','`scheduledat`\x20>=\x20','format','\x22%s\x22','CountReScheduled','GetContactRecallMe','all','GetCmHopperPreview','describe','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetCmHopper','CmHopper','options','include','map','model','attributes','then','catch','ShowCmHopper','find','raw','CreateCmHopper','create','body','UpdateCmHopper','update','where','limit','DestroyCmHopper','destroy','GetContactDialer','sequelize','transaction','findAll','order','LOCK','UPDATE','CmContact','Contact','keys','User'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0x374e,0x1a8));var _0xe374=function(_0x2b20b3,_0x124c9e){_0x2b20b3=_0x2b20b3-0x0;var _0x4dad4b=_0x374e[_0x2b20b3];return _0x4dad4b;};'use strict';var _=require(_0xe374('0x0'));var util=require(_0xe374('0x1'));var moment=require('moment');var BPromise=require(_0xe374('0x2'));var rs=require(_0xe374('0x3'));var fs=require('fs');var Redis=require(_0xe374('0x4'));var db=require(_0xe374('0x5'))['db'];var utils=require(_0xe374('0x6'));var logger=require(_0xe374('0x7'))(_0xe374('0x8'));var config=require(_0xe374('0x9'));var jayson=require(_0xe374('0xa'));var client=jayson['client'][_0xe374('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e87a8,_0x579cf9,_0xafd364){return new BPromise(function(_0x223a13,_0x34553b){return client['request'](_0x2e87a8,_0xafd364)['then'](function(_0x412552){logger[_0xe374('0xc')](_0xe374('0xd'),_0x579cf9,_0xe374('0xe'));logger[_0xe374('0xf')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x579cf9,_0xe374('0xe'),JSON[_0xe374('0x10')](_0x412552));if(_0x412552['error']){if(_0x412552[_0xe374('0x11')][_0xe374('0x12')]===0x1f4){logger[_0xe374('0x11')]('CmHopper,\x20%s,\x20%s',_0x579cf9,_0x412552[_0xe374('0x11')][_0xe374('0x13')]);return _0x34553b(_0x412552[_0xe374('0x11')][_0xe374('0x13')]);}logger[_0xe374('0x11')](_0xe374('0xd'),_0x579cf9,_0x412552[_0xe374('0x11')][_0xe374('0x13')]);return _0x223a13(_0x412552[_0xe374('0x11')][_0xe374('0x13')]);}else{logger[_0xe374('0xc')](_0xe374('0xd'),_0x579cf9,_0xe374('0xe'));_0x223a13(_0x412552['result'][_0xe374('0x13')]);}})['catch'](function(_0x369915){logger[_0xe374('0x11')](_0xe374('0xd'),_0x579cf9,_0x369915);_0x34553b(_0x369915);});});}exports[_0xe374('0x14')]=function(_0x1fde75){var _0x23bcfc=this;return new Promise(function(_0x1ea3bc,_0x1c9ad7){return db[_0xe374('0x15')]['findAll']({'raw':_0x1fde75['options']?_0x1fde75[_0xe374('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1fde75['options']?_0x1fde75[_0xe374('0x16')]['where']||null:null,'attributes':_0x1fde75[_0xe374('0x16')]?_0x1fde75[_0xe374('0x16')]['attributes']||null:null,'limit':_0x1fde75[_0xe374('0x16')]?_0x1fde75['options']['limit']||null:null,'include':_0x1fde75[_0xe374('0x16')]?_0x1fde75[_0xe374('0x16')][_0xe374('0x17')]?_[_0xe374('0x18')](_0x1fde75[_0xe374('0x16')]['include'],function(_0x2bc1e8){return{'model':db[_0x2bc1e8[_0xe374('0x19')]],'as':_0x2bc1e8['as'],'attributes':_0x2bc1e8[_0xe374('0x1a')],'include':_0x2bc1e8[_0xe374('0x17')]?_['map'](_0x2bc1e8[_0xe374('0x17')],function(_0x1cb486){return{'model':db[_0x1cb486[_0xe374('0x19')]],'as':_0x1cb486['as'],'attributes':_0x1cb486[_0xe374('0x1a')],'include':_0x1cb486['include']?_[_0xe374('0x18')](_0x1cb486[_0xe374('0x17')],function(_0x5f2cc9){return{'model':db[_0x5f2cc9['model']],'as':_0x5f2cc9['as'],'attributes':_0x5f2cc9[_0xe374('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe374('0x1b')](function(_0xc009ab){logger['info'](_0xe374('0x14'),_0x1fde75);logger[_0xe374('0xf')]('GetCmHopper',_0x1fde75,JSON[_0xe374('0x10')](_0xc009ab));_0x1ea3bc(_0xc009ab);})[_0xe374('0x1c')](function(_0x385c30){logger[_0xe374('0x11')](_0xe374('0x14'),_0x385c30[_0xe374('0x13')],_0x1fde75);_0x1c9ad7(_0x23bcfc['error'](0x1f4,_0x385c30[_0xe374('0x13')]));});});};exports[_0xe374('0x1d')]=function(_0x1dada1){var _0x3e37b6=this;return new Promise(function(_0x288e29,_0x377aa0){return db[_0xe374('0x15')][_0xe374('0x1e')]({'raw':_0x1dada1[_0xe374('0x16')]?_0x1dada1['options'][_0xe374('0x1f')]===undefined?!![]:![]:!![],'where':_0x1dada1[_0xe374('0x16')]?_0x1dada1[_0xe374('0x16')]['where']||null:null,'attributes':_0x1dada1[_0xe374('0x16')]?_0x1dada1[_0xe374('0x16')]['attributes']||null:null,'include':_0x1dada1[_0xe374('0x16')]?_0x1dada1[_0xe374('0x16')][_0xe374('0x17')]?_['map'](_0x1dada1[_0xe374('0x16')]['include'],function(_0x209817){return{'model':db[_0x209817[_0xe374('0x19')]],'as':_0x209817['as'],'attributes':_0x209817['attributes'],'include':_0x209817['include']?_[_0xe374('0x18')](_0x209817[_0xe374('0x17')],function(_0x58dc31){return{'model':db[_0x58dc31['model']],'as':_0x58dc31['as'],'attributes':_0x58dc31[_0xe374('0x1a')],'include':_0x58dc31[_0xe374('0x17')]?_['map'](_0x58dc31[_0xe374('0x17')],function(_0x4cece0){return{'model':db[_0x4cece0['model']],'as':_0x4cece0['as'],'attributes':_0x4cece0[_0xe374('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe374('0x1b')](function(_0x5ca60c){logger[_0xe374('0xc')](_0xe374('0x1d'),_0x1dada1);logger[_0xe374('0xf')](_0xe374('0x1d'),_0x1dada1,JSON['stringify'](_0x5ca60c));_0x288e29(_0x5ca60c);})[_0xe374('0x1c')](function(_0x1167b1){logger['error']('ShowCmHopper',_0x1167b1[_0xe374('0x13')],_0x1dada1);_0x377aa0(_0x3e37b6['error'](0x1f4,_0x1167b1[_0xe374('0x13')]));});});};exports[_0xe374('0x20')]=function(_0x1cba23){var _0x4bca8d=this;return new Promise(function(_0x389eb6,_0x359ade){return db['CmHopper'][_0xe374('0x21')](_0x1cba23[_0xe374('0x22')],{'raw':_0x1cba23[_0xe374('0x16')]?_0x1cba23[_0xe374('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xe374('0x1b')](function(_0x52061d){logger[_0xe374('0xc')]('CreateCmHopper',_0x1cba23);logger[_0xe374('0xf')](_0xe374('0x20'),_0x1cba23,JSON[_0xe374('0x10')](_0x52061d));_0x389eb6(_0x52061d);})[_0xe374('0x1c')](function(_0x2bed0e){logger[_0xe374('0x11')]('CreateCmHopper',_0x2bed0e['message'],_0x1cba23);_0x359ade(_0x4bca8d['error'](0x1f4,_0x2bed0e[_0xe374('0x13')]));});});};exports[_0xe374('0x23')]=function(_0x54d532){var _0x5e07db=this;return new Promise(function(_0x1b7f62,_0x15af27){return db['CmHopper'][_0xe374('0x24')](_0x54d532[_0xe374('0x22')],{'raw':_0x54d532[_0xe374('0x16')]?_0x54d532['options'][_0xe374('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54d532[_0xe374('0x16')]?_0x54d532[_0xe374('0x16')][_0xe374('0x25')]||null:null,'attributes':_0x54d532[_0xe374('0x16')]?_0x54d532[_0xe374('0x16')]['attributes']||null:null,'limit':_0x54d532[_0xe374('0x16')]?_0x54d532['options'][_0xe374('0x26')]||null:null})['then'](function(_0x20fd5b){logger[_0xe374('0xc')](_0xe374('0x23'),_0x54d532);logger['debug'](_0xe374('0x23'),_0x54d532,JSON['stringify'](_0x20fd5b));_0x1b7f62(_0x20fd5b);})['catch'](function(_0x52ad55){logger[_0xe374('0x11')](_0xe374('0x23'),_0x52ad55[_0xe374('0x13')],_0x54d532);_0x15af27(_0x5e07db[_0xe374('0x11')](0x1f4,_0x52ad55['message']));});});};exports[_0xe374('0x27')]=function(_0x1bdbd1){var _0x6c1e5b=this;return new Promise(function(_0x30975f,_0x2ddc09){return db[_0xe374('0x15')][_0xe374('0x28')]({'where':_0x1bdbd1['options']?_0x1bdbd1[_0xe374('0x16')]['where']||null:null})[_0xe374('0x1b')](function(_0x1b93ca){logger[_0xe374('0xc')](_0xe374('0x27'),_0x1bdbd1);logger['debug']('DestroyCmHopper',_0x1bdbd1,JSON[_0xe374('0x10')](_0x1b93ca));_0x30975f(_0x1b93ca);})[_0xe374('0x1c')](function(_0x5e4b45){logger[_0xe374('0x11')](_0xe374('0x27'),_0x5e4b45[_0xe374('0x13')],_0x1bdbd1);_0x2ddc09(_0x6c1e5b['error'](0x1f4,_0x5e4b45[_0xe374('0x13')]));});});};exports[_0xe374('0x29')]=function(_0x144720){var _0x5030e4=this;return new Promise(function(_0x323a20,_0x2eee8c){return db['CmContact']['describe']()[_0xe374('0x1b')](function(_0x3a91a1){return db[_0xe374('0x2a')][_0xe374('0x2b')](function(_0x23a07e){return db[_0xe374('0x15')][_0xe374('0x2c')]({'where':_0x144720[_0xe374('0x16')]?_0x144720[_0xe374('0x16')]['where']||null:null,'attributes':_0x144720[_0xe374('0x16')]?_0x144720['options'][_0xe374('0x1a')]||null:null,'limit':_0x144720[_0xe374('0x16')]?_0x144720[_0xe374('0x16')][_0xe374('0x26')]||null:null,'order':_0x144720[_0xe374('0x16')]?_0x144720[_0xe374('0x16')][_0xe374('0x2d')]||null:null,'transaction':_0x23a07e,'lock':_0x23a07e[_0xe374('0x2e')][_0xe374('0x2f')],'include':[{'model':db[_0xe374('0x30')],'as':_0xe374('0x31'),'attributes':_[_0xe374('0x32')](_0x3a91a1)},{'model':db[_0xe374('0x33')],'as':_0xe374('0x34'),'attributes':['id',_0xe374('0x35'),_0xe374('0x36')]}]})[_0xe374('0x1b')](function(_0x35df31){var _0x3e1e5a=[];var _0x153f5d=[];for(var _0x3e911a=0x0;_0x3e911a<_0x35df31[_0xe374('0x37')];_0x3e911a+=0x1){var _0x4e2129=_0x35df31[_0x3e911a][_0xe374('0x38')];if(_0x4e2129===null){_0x3e1e5a[_0xe374('0x39')](_0x35df31[_0x3e911a][_0xe374('0x24')](_0x144720['body'],{'transaction':_0x23a07e}));}else if(!_0x153f5d[_0xe374('0x3a')](_0x4e2129)){_0x153f5d[_0xe374('0x39')](_0x4e2129);_0x3e1e5a[_0xe374('0x39')](_0x35df31[_0x3e911a][_0xe374('0x24')](_0x144720['body'],{'transaction':_0x23a07e}));}}return BPromise['all'](_0x3e1e5a);});})[_0xe374('0x1b')](function(_0x1c0fee){logger['info'](_0xe374('0x29'),_0x144720);logger[_0xe374('0xf')](_0xe374('0x29'),_0x144720,JSON['stringify'](_0x1c0fee));_0x323a20(_0x1c0fee);})['catch'](function(_0x4690d4){logger['error'](_0xe374('0x29'),_0x4690d4[_0xe374('0x13')],_0x144720);_0x2eee8c(_0x5030e4['error'](0x1f4,_0x4690d4[_0xe374('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x489e9e){var _0x49be94=this;return new Promise(function(_0x1ce299,_0x47e258){return db['sequelize'][_0xe374('0x2b')](function(_0x31485e){return db['CmHopperFinal'][_0xe374('0x21')](_0x489e9e[_0xe374('0x22')],{'raw':_0x489e9e['options']?_0x489e9e[_0xe374('0x16')][_0xe374('0x1f')]===undefined?!![]:![]:!![],'transaction':_0x31485e})[_0xe374('0x1b')](function(){return db[_0xe374('0x15')][_0xe374('0x28')]({'where':_0x489e9e['options']?_0x489e9e['options']['where']||null:null,'transaction':_0x31485e});});})[_0xe374('0x1b')](function(_0x4a4b32){logger[_0xe374('0xc')](_0xe374('0x3b'),_0x489e9e);logger['debug'](_0xe374('0x3b'),_0x489e9e,JSON['stringify'](_0x4a4b32));_0x1ce299(_0x4a4b32);})[_0xe374('0x1c')](function(_0x3b04e1){logger['error'](_0xe374('0x3b'),_0x3b04e1[_0xe374('0x13')],_0x489e9e);_0x47e258(_0x49be94['error'](0x1f4,_0x3b04e1[_0xe374('0x13')]));});});};exports['CountReScheduled']=function(_0x6b5aee){var _0x18c83d=this;return new Promise(function(_0x35339e,_0x48b117){return db[_0xe374('0x15')][_0xe374('0x2c')]({'raw':_0x6b5aee[_0xe374('0x16')]?_0x6b5aee[_0xe374('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x6b5aee[_0xe374('0x16')]?_0x6b5aee[_0xe374('0x16')][_0xe374('0x25')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xe374('0x2a')]['fn']('IF',db[_0xe374('0x2a')]['literal'](_0xe374('0x3c')+util[_0xe374('0x3d')](_0xe374('0x3e'),moment()[_0xe374('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0xe374('0x1b')](function(_0x3158b9){logger['info'](_0xe374('0x3f'),_0x6b5aee);logger[_0xe374('0xf')](_0xe374('0x3f'),_0x6b5aee,JSON[_0xe374('0x10')](_0x3158b9));_0x35339e(_0x3158b9);})[_0xe374('0x1c')](function(_0x217c1d){logger['error'](_0xe374('0x3f'),_0x217c1d['message'],_0x6b5aee);_0x48b117(_0x18c83d['error'](0x1f4,_0x217c1d[_0xe374('0x13')]));});});};exports[_0xe374('0x40')]=function(_0x27656f){var _0x5cb9d3=this;return new Promise(function(_0x33fa03,_0x559ed5){return db['CmContact']['describe']()[_0xe374('0x1b')](function(_0x1399a6){return db[_0xe374('0x2a')][_0xe374('0x2b')](function(_0x5cc475){return db[_0xe374('0x15')][_0xe374('0x2c')]({'where':_0x27656f[_0xe374('0x16')]?_0x27656f[_0xe374('0x16')]['where']||null:null,'attributes':_0x27656f[_0xe374('0x16')]?_0x27656f[_0xe374('0x16')][_0xe374('0x1a')]||null:null,'limit':0x1,'order':_0x27656f['options']?_0x27656f[_0xe374('0x16')]['order']||null:null,'group':db[_0xe374('0x15')][_0xe374('0x38')],'transaction':_0x5cc475,'lock':_0x5cc475[_0xe374('0x2e')]['UPDATE'],'include':_0x27656f[_0xe374('0x16')]?_0x27656f[_0xe374('0x16')]['include']?_[_0xe374('0x18')](_0x27656f[_0xe374('0x16')][_0xe374('0x17')],function(_0x3ac8cd){return{'model':db[_0x3ac8cd[_0xe374('0x19')]],'as':_0x3ac8cd['as'],'attributes':_0x3ac8cd[_0xe374('0x1a')],'include':_0x3ac8cd[_0xe374('0x17')]?_[_0xe374('0x18')](_0x3ac8cd[_0xe374('0x17')],function(_0x3c7b6a){return{'model':db[_0x3c7b6a[_0xe374('0x19')]],'as':_0x3c7b6a['as'],'attributes':_0x3c7b6a['attributes'],'include':_0x3c7b6a['include']?_[_0xe374('0x18')](_0x3c7b6a[_0xe374('0x17')],function(_0x51d694){return{'model':db[_0x51d694[_0xe374('0x19')]],'as':_0x51d694['as'],'attributes':_0x51d694[_0xe374('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe374('0x1b')](function(_0x53338b){var _0x41c9a8=[];for(var _0x701891=0x0;_0x701891<_0x53338b[_0xe374('0x37')];_0x701891+=0x1){_0x41c9a8[_0xe374('0x39')](_0x53338b[_0x701891]['update'](_0x27656f[_0xe374('0x22')],{'transaction':_0x5cc475}));}return BPromise[_0xe374('0x41')](_0x41c9a8);});})[_0xe374('0x1b')](function(_0x4013e7){logger[_0xe374('0xc')](_0xe374('0x40'),_0x27656f);logger[_0xe374('0xf')](_0xe374('0x40'),_0x27656f,JSON[_0xe374('0x10')](_0x4013e7));_0x33fa03(_0x4013e7);})[_0xe374('0x1c')](function(_0x1badd7){logger['error'](_0xe374('0x40'),_0x1badd7['message'],_0x27656f);_0x559ed5(_0x5cb9d3['error'](0x1f4,_0x1badd7[_0xe374('0x13')]));});});});};exports[_0xe374('0x42')]=function(_0x354cd6){var _0x32532b=this;return new Promise(function(_0xafab90,_0x4f113a){db[_0xe374('0x30')][_0xe374('0x43')]()[_0xe374('0x1b')](function(_0x572966){return db['CmHopper'][_0xe374('0x2c')]({'raw':_0x354cd6[_0xe374('0x16')]?_0x354cd6[_0xe374('0x16')][_0xe374('0x1f')]===undefined?!![]:![]:!![],'where':_0x354cd6[_0xe374('0x16')]?_0x354cd6[_0xe374('0x16')][_0xe374('0x25')]||null:null,'attributes':_0x354cd6['options']?_0x354cd6['options'][_0xe374('0x1a')]||null:null,'limit':_0x354cd6[_0xe374('0x16')]?_0x354cd6[_0xe374('0x16')][_0xe374('0x26')]||null:null,'include':_0x354cd6[_0xe374('0x16')]?_0x354cd6[_0xe374('0x16')]['include']?_[_0xe374('0x18')](_0x354cd6[_0xe374('0x16')]['include'],function(_0x30b720){return{'model':db[_0x30b720[_0xe374('0x19')]],'as':_0x30b720['as'],'attributes':_0x30b720['as']===_0xe374('0x31')?_[_0xe374('0x32')](_0x572966):_0x30b720[_0xe374('0x1a')],'include':_0x30b720[_0xe374('0x17')]?_[_0xe374('0x18')](_0x30b720[_0xe374('0x17')],function(_0x1609e4){return{'model':db[_0x1609e4[_0xe374('0x19')]],'as':_0x1609e4['as'],'attributes':_0x1609e4[_0xe374('0x1a')],'include':_0x1609e4[_0xe374('0x17')]?_['map'](_0x1609e4[_0xe374('0x17')],function(_0x1aa04b){return{'model':db[_0x1aa04b[_0xe374('0x19')]],'as':_0x1aa04b['as'],'attributes':_0x1aa04b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x11d20f){logger[_0xe374('0xc')](_0xe374('0x14'),_0x354cd6);logger[_0xe374('0xf')](_0xe374('0x14'),_0x354cd6,JSON[_0xe374('0x10')](_0x11d20f));_0xafab90(_0x11d20f);})['catch'](function(_0x567e4d){logger['error'](_0xe374('0x14'),_0x567e4d[_0xe374('0x13')],_0x354cd6);_0x4f113a(_0x32532b[_0xe374('0x11')](0x1f4,_0x567e4d[_0xe374('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 9cdf726..419902b 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 _0xe403=['util','path','express','Router','fs-extra','../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','/describe','describe','/opencontacts','/:id','show','post','create','/preview','getPreview','put','update','delete','destroy'];(function(_0x1d2c18,_0x67fa9b){var _0x48d6ce=function(_0x164261){while(--_0x164261){_0x1d2c18['push'](_0x1d2c18['shift']());}};_0x48d6ce(++_0x67fa9b);}(_0xe403,0x1e4));var _0x3e40=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe403[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x3e40('0x0'));var path=require(_0x3e40('0x1'));var timeout=require('connect-timeout');var express=require(_0x3e40('0x2'));var router=express[_0x3e40('0x3')]();var fs_extra=require(_0x3e40('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3e40('0x5'));var config=require('../../config/environment');var controller=require(_0x3e40('0x6'));router[_0x3e40('0x7')]('/',auth[_0x3e40('0x8')](),controller['index']);router[_0x3e40('0x7')](_0x3e40('0x9'),auth['isAuthenticated'](),controller[_0x3e40('0xa')]);router[_0x3e40('0x7')](_0x3e40('0xb'),auth[_0x3e40('0x8')](),controller['getOpenContacts']);router[_0x3e40('0x7')](_0x3e40('0xc'),auth[_0x3e40('0x8')](),controller[_0x3e40('0xd')]);router[_0x3e40('0xe')]('/',auth[_0x3e40('0x8')](),controller[_0x3e40('0xf')]);router['post'](_0x3e40('0x10'),auth[_0x3e40('0x8')](),controller[_0x3e40('0x11')]);router[_0x3e40('0x12')](_0x3e40('0xc'),auth[_0x3e40('0x8')](),controller[_0x3e40('0x13')]);router[_0x3e40('0x14')](_0x3e40('0xc'),auth[_0x3e40('0x8')](),controller[_0x3e40('0x15')]);module['exports']=router; \ No newline at end of file +var _0xa95f=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','get','describe','/opencontacts','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xa95f,0x131));var _0xfa95=function(_0x540b5d,_0x3c2b28){_0x540b5d=_0x540b5d-0x0;var _0x484ca7=_0xa95f[_0x540b5d];return _0x484ca7;};'use strict';var multer=require(_0xfa95('0x0'));var util=require(_0xfa95('0x1'));var path=require('path');var timeout=require(_0xfa95('0x2'));var express=require(_0xfa95('0x3'));var router=express[_0xfa95('0x4')]();var fs_extra=require(_0xfa95('0x5'));var auth=require(_0xfa95('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfa95('0x7'));var controller=require(_0xfa95('0x8'));router['get']('/',auth[_0xfa95('0x9')](),controller[_0xfa95('0xa')]);router[_0xfa95('0xb')]('/describe',auth[_0xfa95('0x9')](),controller[_0xfa95('0xc')]);router[_0xfa95('0xb')](_0xfa95('0xd'),auth[_0xfa95('0x9')](),controller['getOpenContacts']);router[_0xfa95('0xb')](_0xfa95('0xe'),auth[_0xfa95('0x9')](),controller[_0xfa95('0xf')]);router[_0xfa95('0x10')]('/',auth[_0xfa95('0x9')](),controller[_0xfa95('0x11')]);router['post']('/preview',auth[_0xfa95('0x9')](),controller['getPreview']);router[_0xfa95('0x12')]('/:id',auth[_0xfa95('0x9')](),controller['update']);router[_0xfa95('0x13')](_0xfa95('0xe'),auth[_0xfa95('0x9')](),controller[_0xfa95('0x14')]);module[_0xfa95('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index cabb369..8b08248 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 _0x3157=['moment','sequelize','exports','STRING','contactListQueue','INTEGER'];(function(_0x528133,_0x2d67fc){var _0x4493b3=function(_0x488fd3){while(--_0x488fd3){_0x528133['push'](_0x528133['shift']());}};_0x4493b3(++_0x2d67fc);}(_0x3157,0x198));var _0x7315=function(_0x1f216c,_0x459882){_0x1f216c=_0x1f216c-0x0;var _0x4dc3f0=_0x3157[_0x1f216c];return _0x4dc3f0;};'use strict';var moment=require(_0x7315('0x0'));var Sequelize=require(_0x7315('0x1'));module[_0x7315('0x2')]={'phone':{'type':Sequelize[_0x7315('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x7315('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x7315('0x4')},'VoiceQueueId':{'type':Sequelize[_0x7315('0x5')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xafdd=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x5e5f5a,_0x5cb19a){var _0x4141ae=function(_0x4bb2ea){while(--_0x4bb2ea){_0x5e5f5a['push'](_0x5e5f5a['shift']());}};_0x4141ae(++_0x5cb19a);}(_0xafdd,0x19a));var _0xdafd=function(_0x1709c4,_0x397c9d){_0x1709c4=_0x1709c4-0x0;var _0x5126a1=_0xafdd[_0x1709c4];return _0x5126a1;};'use strict';var moment=require(_0xdafd('0x0'));var Sequelize=require(_0xdafd('0x1'));module[_0xdafd('0x2')]={'phone':{'type':Sequelize[_0xdafd('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xdafd('0x4')],'unique':_0xdafd('0x5')},'ListId':{'type':Sequelize[_0xdafd('0x4')],'unique':_0xdafd('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xdafd('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 986441e..62310d9 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 _0xdf1c=['sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','show','params','merge','find','catch','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util'];(function(_0x4b362b,_0xb811a){var _0x5cde92=function(_0x143f21){while(--_0x143f21){_0x4b362b['push'](_0x4b362b['shift']());}};_0x5cde92(++_0xb811a);}(_0xdf1c,0x115));var _0xcdf1=function(_0x40cf10,_0x2153c3){_0x40cf10=_0x40cf10-0x0;var _0x39076c=_0xdf1c[_0x40cf10];return _0x39076c;};'use strict';var emlformat=require(_0xcdf1('0x0'));var rimraf=require(_0xcdf1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcdf1('0x2'));var rp=require('request-promise');var moment=require(_0xcdf1('0x3'));var BPromise=require(_0xcdf1('0x4'));var Mustache=require(_0xcdf1('0x5'));var util=require(_0xcdf1('0x6'));var path=require(_0xcdf1('0x7'));var sox=require('sox');var csv=require(_0xcdf1('0x8'));var ejs=require(_0xcdf1('0x9'));var fs=require('fs');var fs_extra=require(_0xcdf1('0xa'));var _=require('lodash');var squel=require(_0xcdf1('0xb'));var crypto=require(_0xcdf1('0xc'));var jsforce=require(_0xcdf1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcdf1('0xe'));var Papa=require('papaparse');var Redis=require(_0xcdf1('0xf'));var authService=require(_0xcdf1('0x10'));var qs=require(_0xcdf1('0x11'));var as=require(_0xcdf1('0x12'));var hardwareService=require(_0xcdf1('0x13'));var logger=require('../../config/logger')(_0xcdf1('0x14'));var utils=require('../../config/utils');var config=require(_0xcdf1('0x15'));var licenseUtil=require(_0xcdf1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x136210,_0x19be7e){_0x19be7e=_0x19be7e||0xcc;return function(_0x62d09d){if(_0x62d09d){return _0x136210[_0xcdf1('0x17')](_0x19be7e);}return _0x136210[_0xcdf1('0x18')](_0x19be7e)[_0xcdf1('0x19')]();};}function respondWithResult(_0x3d0a50,_0x3d1e77){_0x3d1e77=_0x3d1e77||0xc8;return function(_0x299d91){if(_0x299d91){return _0x3d0a50['status'](_0x3d1e77)[_0xcdf1('0x1a')](_0x299d91);}};}function respondWithFilteredResult(_0x4203df,_0x271377){return function(_0x5d2fae){if(_0x5d2fae){var _0x48a247=typeof _0x271377[_0xcdf1('0x1b')]==='undefined'&&typeof _0x271377[_0xcdf1('0x1c')]===_0xcdf1('0x1d');var _0x3c231e=_0x5d2fae[_0xcdf1('0x1e')];var _0x4336d8=_0x48a247?0x0:_0x271377[_0xcdf1('0x1b')];var _0x1317e6=_0x48a247?_0x5d2fae[_0xcdf1('0x1e')]:_0x271377['offset']+_0x271377[_0xcdf1('0x1c')];var _0xa7612f;if(_0x1317e6>=_0x3c231e){_0x1317e6=_0x3c231e;_0xa7612f=0xc8;}else{_0xa7612f=0xce;}_0x4203df[_0xcdf1('0x18')](_0xa7612f);return _0x4203df[_0xcdf1('0x1f')](_0xcdf1('0x20'),_0x4336d8+'-'+_0x1317e6+'/'+_0x3c231e)[_0xcdf1('0x1a')](_0x5d2fae);}return null;};}function patchUpdates(_0x1612c0){return function(_0x3c6870){try{jsonpatch[_0xcdf1('0x21')](_0x3c6870,_0x1612c0,!![]);}catch(_0xf1b6e0){return BPromise[_0xcdf1('0x22')](_0xf1b6e0);}return _0x3c6870[_0xcdf1('0x23')]();};}function saveUpdates(_0x387376,_0x1a23ad){return function(_0x12c96b){if(_0x12c96b){return _0x12c96b[_0xcdf1('0x24')](_0x387376)['then'](function(_0x4ac3e3){return _0x4ac3e3;});}return null;};}function removeEntity(_0x5d164c,_0x3ee89d){return function(_0x5394af){if(_0x5394af){return _0x5394af[_0xcdf1('0x25')]()[_0xcdf1('0x26')](function(){_0x5d164c[_0xcdf1('0x18')](0xcc)[_0xcdf1('0x19')]();});}};}function handleEntityNotFound(_0x13bd26,_0x460a0b){return function(_0x391dbe){if(!_0x391dbe){_0x13bd26[_0xcdf1('0x17')](0x194);}return _0x391dbe;};}function handleError(_0x4ee437,_0x12e1a8){_0x12e1a8=_0x12e1a8||0x1f4;return function(_0x12b1ce){logger[_0xcdf1('0x27')](_0x12b1ce[_0xcdf1('0x28')]);if(_0x12b1ce[_0xcdf1('0x29')]){delete _0x12b1ce[_0xcdf1('0x29')];}_0x4ee437['status'](_0x12e1a8)[_0xcdf1('0x2a')](_0x12b1ce);};}exports['index']=function(_0x22b4b7,_0x326f63){var _0x1cea7d={},_0x192816={},_0x442d11={'count':0x0,'rows':[]};var _0x421ee4=_[_0xcdf1('0x2b')](db[_0xcdf1('0x2c')][_0xcdf1('0x2d')],function(_0x5b73d4){return{'name':_0x5b73d4[_0xcdf1('0x2e')],'type':_0x5b73d4[_0xcdf1('0x2f')][_0xcdf1('0x30')]};});_0x192816[_0xcdf1('0x31')]=_[_0xcdf1('0x2b')](_0x421ee4,_0xcdf1('0x29'));_0x192816[_0xcdf1('0x32')]=_[_0xcdf1('0x33')](_0x22b4b7[_0xcdf1('0x32')]);_0x192816[_0xcdf1('0x34')]=_[_0xcdf1('0x35')](_0x192816[_0xcdf1('0x31')],_0x192816[_0xcdf1('0x32')]);_0x1cea7d[_0xcdf1('0x36')]=_[_0xcdf1('0x35')](_0x192816['model'],qs['fields'](_0x22b4b7[_0xcdf1('0x32')][_0xcdf1('0x37')]));_0x1cea7d['attributes']=_0x1cea7d[_0xcdf1('0x36')][_0xcdf1('0x38')]?_0x1cea7d[_0xcdf1('0x36')]:_0x192816[_0xcdf1('0x31')];if(!_0x22b4b7[_0xcdf1('0x32')][_0xcdf1('0x39')]('nolimit')){_0x1cea7d['limit']=qs[_0xcdf1('0x1c')](_0x22b4b7[_0xcdf1('0x32')][_0xcdf1('0x1c')]);_0x1cea7d['offset']=qs[_0xcdf1('0x1b')](_0x22b4b7[_0xcdf1('0x32')][_0xcdf1('0x1b')]);}_0x1cea7d[_0xcdf1('0x3a')]=qs[_0xcdf1('0x3b')](_0x22b4b7[_0xcdf1('0x32')]['sort']);_0x1cea7d[_0xcdf1('0x3c')]=qs['filters'](_[_0xcdf1('0x3d')](_0x22b4b7[_0xcdf1('0x32')],_0x192816[_0xcdf1('0x34')]),_0x421ee4);if(_0x22b4b7['query'][_0xcdf1('0x3e')]){_0x1cea7d['where']=_['merge'](_0x1cea7d[_0xcdf1('0x3c')],{'$or':_[_0xcdf1('0x2b')](_0x421ee4,function(_0xb9d4d6){if(_0xb9d4d6[_0xcdf1('0x2f')]!==_0xcdf1('0x3f')){var _0x3a018d={};_0x3a018d[_0xb9d4d6['name']]={'$like':'%'+_0x22b4b7[_0xcdf1('0x32')][_0xcdf1('0x3e')]+'%'};return _0x3a018d;}})});}_0x1cea7d=_['merge']({},_0x1cea7d,_0x22b4b7[_0xcdf1('0x40')]);var _0x2864fb={'where':_0x1cea7d[_0xcdf1('0x3c')]};return db[_0xcdf1('0x2c')][_0xcdf1('0x1e')](_0x2864fb)[_0xcdf1('0x26')](function(_0x2e31af){_0x442d11[_0xcdf1('0x1e')]=_0x2e31af;if(_0x22b4b7[_0xcdf1('0x32')][_0xcdf1('0x41')]){_0x1cea7d[_0xcdf1('0x42')]=[{'all':!![]}];}return db[_0xcdf1('0x2c')][_0xcdf1('0x43')](_0x1cea7d);})[_0xcdf1('0x26')](function(_0x4c88f6){_0x442d11['rows']=_0x4c88f6;return _0x442d11;})[_0xcdf1('0x26')](respondWithFilteredResult(_0x326f63,_0x1cea7d))['catch'](handleError(_0x326f63,null));};exports[_0xcdf1('0x44')]=function(_0x4d3a88,_0x241286){var _0x5897cb={'raw':!![],'where':{'id':_0x4d3a88[_0xcdf1('0x45')]['id']}},_0x5ad626={};_0x5ad626[_0xcdf1('0x31')]=_[_0xcdf1('0x33')](db['CmHopperBlack']['rawAttributes']);_0x5ad626[_0xcdf1('0x32')]=_[_0xcdf1('0x33')](_0x4d3a88['query']);_0x5ad626['filters']=_[_0xcdf1('0x35')](_0x5ad626['model'],_0x5ad626[_0xcdf1('0x32')]);_0x5897cb[_0xcdf1('0x36')]=_[_0xcdf1('0x35')](_0x5ad626['model'],qs[_0xcdf1('0x37')](_0x4d3a88[_0xcdf1('0x32')][_0xcdf1('0x37')]));_0x5897cb[_0xcdf1('0x36')]=_0x5897cb['attributes'][_0xcdf1('0x38')]?_0x5897cb[_0xcdf1('0x36')]:_0x5ad626['model'];if(_0x4d3a88[_0xcdf1('0x32')][_0xcdf1('0x41')]){_0x5897cb['include']=[{'all':!![]}];}_0x5897cb=_[_0xcdf1('0x46')]({},_0x5897cb,_0x4d3a88[_0xcdf1('0x40')]);return db['CmHopperBlack'][_0xcdf1('0x47')](_0x5897cb)[_0xcdf1('0x26')](handleEntityNotFound(_0x241286,null))[_0xcdf1('0x26')](respondWithResult(_0x241286,null))[_0xcdf1('0x48')](handleError(_0x241286,null));};exports['update']=function(_0x5ba700,_0x20b10f){if(_0x5ba700[_0xcdf1('0x49')]['id']){delete _0x5ba700[_0xcdf1('0x49')]['id'];}return db[_0xcdf1('0x2c')][_0xcdf1('0x47')]({'where':{'id':_0x5ba700['params']['id']}})['then'](handleEntityNotFound(_0x20b10f,null))[_0xcdf1('0x26')](saveUpdates(_0x5ba700['body'],null))[_0xcdf1('0x26')](respondWithResult(_0x20b10f,null))[_0xcdf1('0x48')](handleError(_0x20b10f,null));};exports['destroy']=function(_0x20bc76,_0x5675fd){return db['CmHopperBlack'][_0xcdf1('0x47')]({'where':{'id':_0x20bc76[_0xcdf1('0x45')]['id']}})[_0xcdf1('0x26')](handleEntityNotFound(_0x5675fd,null))[_0xcdf1('0x26')](removeEntity(_0x5675fd,null))[_0xcdf1('0x48')](handleError(_0x5675fd,null));};exports[_0xcdf1('0x4a')]=function(_0x8de552,_0x17c81c){return db['CmHopperBlack'][_0xcdf1('0x4a')]()[_0xcdf1('0x26')](respondWithResult(_0x17c81c,null))['catch'](handleError(_0x17c81c,null));}; \ No newline at end of file +var _0xdacb=['filters','pick','filter','merge','options','includeAll','findAll','rows','include','find','body','params','catch','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','keys','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where'];(function(_0x59987b,_0x3a0d06){var _0x39960f=function(_0x2ece88){while(--_0x2ece88){_0x59987b['push'](_0x59987b['shift']());}};_0x39960f(++_0x3a0d06);}(_0xdacb,0xec));var _0xbdac=function(_0x1fec15,_0xac95a){_0x1fec15=_0x1fec15-0x0;var _0x25a469=_0xdacb[_0x1fec15];return _0x25a469;};'use strict';var emlformat=require(_0xbdac('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbdac('0x1'));var rp=require(_0xbdac('0x2'));var moment=require('moment');var BPromise=require(_0xbdac('0x3'));var Mustache=require(_0xbdac('0x4'));var util=require(_0xbdac('0x5'));var path=require(_0xbdac('0x6'));var sox=require(_0xbdac('0x7'));var csv=require(_0xbdac('0x8'));var ejs=require(_0xbdac('0x9'));var fs=require('fs');var fs_extra=require(_0xbdac('0xa'));var _=require(_0xbdac('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbdac('0xc'));var deskjs=require(_0xbdac('0xd'));var toCsv=require(_0xbdac('0x8'));var querystring=require(_0xbdac('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbdac('0xf'));var qs=require(_0xbdac('0x10'));var as=require(_0xbdac('0x11'));var hardwareService=require(_0xbdac('0x12'));var logger=require('../../config/logger')(_0xbdac('0x13'));var utils=require(_0xbdac('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbdac('0x15'))['db'];function respondWithStatusCode(_0x564d73,_0xbfa9c2){_0xbfa9c2=_0xbfa9c2||0xcc;return function(_0x53aa0a){if(_0x53aa0a){return _0x564d73[_0xbdac('0x16')](_0xbfa9c2);}return _0x564d73['status'](_0xbfa9c2)[_0xbdac('0x17')]();};}function respondWithResult(_0x32465d,_0x22165b){_0x22165b=_0x22165b||0xc8;return function(_0x4e2e21){if(_0x4e2e21){return _0x32465d['status'](_0x22165b)[_0xbdac('0x18')](_0x4e2e21);}};}function respondWithFilteredResult(_0x195ecc,_0x3b5c98){return function(_0xdbfd1f){if(_0xdbfd1f){var _0x4317a3=typeof _0x3b5c98['offset']===_0xbdac('0x19')&&typeof _0x3b5c98[_0xbdac('0x1a')]===_0xbdac('0x19');var _0x3ece29=_0xdbfd1f[_0xbdac('0x1b')];var _0x27ec63=_0x4317a3?0x0:_0x3b5c98['offset'];var _0xec82d2=_0x4317a3?_0xdbfd1f[_0xbdac('0x1b')]:_0x3b5c98[_0xbdac('0x1c')]+_0x3b5c98[_0xbdac('0x1a')];var _0x4a2085;if(_0xec82d2>=_0x3ece29){_0xec82d2=_0x3ece29;_0x4a2085=0xc8;}else{_0x4a2085=0xce;}_0x195ecc[_0xbdac('0x1d')](_0x4a2085);return _0x195ecc[_0xbdac('0x1e')](_0xbdac('0x1f'),_0x27ec63+'-'+_0xec82d2+'/'+_0x3ece29)[_0xbdac('0x18')](_0xdbfd1f);}return null;};}function patchUpdates(_0x100ce8){return function(_0x311732){try{jsonpatch[_0xbdac('0x20')](_0x311732,_0x100ce8,!![]);}catch(_0x3e5792){return BPromise[_0xbdac('0x21')](_0x3e5792);}return _0x311732[_0xbdac('0x22')]();};}function saveUpdates(_0x18febd,_0x394c31){return function(_0x2604a4){if(_0x2604a4){return _0x2604a4[_0xbdac('0x23')](_0x18febd)[_0xbdac('0x24')](function(_0x1173ec){return _0x1173ec;});}return null;};}function removeEntity(_0x1c8bce,_0x4fce33){return function(_0x1072f8){if(_0x1072f8){return _0x1072f8[_0xbdac('0x25')]()['then'](function(){_0x1c8bce[_0xbdac('0x1d')](0xcc)[_0xbdac('0x17')]();});}};}function handleEntityNotFound(_0x24f8e4,_0x357342){return function(_0xc88c76){if(!_0xc88c76){_0x24f8e4['sendStatus'](0x194);}return _0xc88c76;};}function handleError(_0x58387a,_0x55bfbd){_0x55bfbd=_0x55bfbd||0x1f4;return function(_0x203cf0){logger[_0xbdac('0x26')](_0x203cf0[_0xbdac('0x27')]);if(_0x203cf0['name']){delete _0x203cf0[_0xbdac('0x28')];}_0x58387a[_0xbdac('0x1d')](_0x55bfbd)[_0xbdac('0x29')](_0x203cf0);};}exports[_0xbdac('0x2a')]=function(_0xd0fc76,_0x48deed){var _0x4f5cce={},_0x45829b={},_0x40c3a4={'count':0x0,'rows':[]};var _0x74c079=_['map'](db[_0xbdac('0x2b')][_0xbdac('0x2c')],function(_0x5174ff){return{'name':_0x5174ff[_0xbdac('0x2d')],'type':_0x5174ff[_0xbdac('0x2e')][_0xbdac('0x2f')]};});_0x45829b[_0xbdac('0x30')]=_[_0xbdac('0x31')](_0x74c079,'name');_0x45829b['query']=_[_0xbdac('0x32')](_0xd0fc76['query']);_0x45829b['filters']=_[_0xbdac('0x33')](_0x45829b['model'],_0x45829b[_0xbdac('0x34')]);_0x4f5cce['attributes']=_[_0xbdac('0x33')](_0x45829b[_0xbdac('0x30')],qs[_0xbdac('0x35')](_0xd0fc76['query'][_0xbdac('0x35')]));_0x4f5cce[_0xbdac('0x36')]=_0x4f5cce[_0xbdac('0x36')][_0xbdac('0x37')]?_0x4f5cce[_0xbdac('0x36')]:_0x45829b['model'];if(!_0xd0fc76[_0xbdac('0x34')][_0xbdac('0x38')]('nolimit')){_0x4f5cce[_0xbdac('0x1a')]=qs['limit'](_0xd0fc76['query']['limit']);_0x4f5cce[_0xbdac('0x1c')]=qs[_0xbdac('0x1c')](_0xd0fc76[_0xbdac('0x34')][_0xbdac('0x1c')]);}_0x4f5cce[_0xbdac('0x39')]=qs[_0xbdac('0x3a')](_0xd0fc76[_0xbdac('0x34')][_0xbdac('0x3a')]);_0x4f5cce[_0xbdac('0x3b')]=qs[_0xbdac('0x3c')](_[_0xbdac('0x3d')](_0xd0fc76[_0xbdac('0x34')],_0x45829b[_0xbdac('0x3c')]),_0x74c079);if(_0xd0fc76[_0xbdac('0x34')][_0xbdac('0x3e')]){_0x4f5cce[_0xbdac('0x3b')]=_['merge'](_0x4f5cce[_0xbdac('0x3b')],{'$or':_[_0xbdac('0x31')](_0x74c079,function(_0x3be550){if(_0x3be550[_0xbdac('0x2e')]!=='VIRTUAL'){var _0x59e3ca={};_0x59e3ca[_0x3be550[_0xbdac('0x28')]]={'$like':'%'+_0xd0fc76[_0xbdac('0x34')]['filter']+'%'};return _0x59e3ca;}})});}_0x4f5cce=_[_0xbdac('0x3f')]({},_0x4f5cce,_0xd0fc76[_0xbdac('0x40')]);var _0x5d7fb9={'where':_0x4f5cce['where']};return db[_0xbdac('0x2b')][_0xbdac('0x1b')](_0x5d7fb9)[_0xbdac('0x24')](function(_0x5c7286){_0x40c3a4[_0xbdac('0x1b')]=_0x5c7286;if(_0xd0fc76[_0xbdac('0x34')][_0xbdac('0x41')]){_0x4f5cce['include']=[{'all':!![]}];}return db[_0xbdac('0x2b')][_0xbdac('0x42')](_0x4f5cce);})[_0xbdac('0x24')](function(_0x304cda){_0x40c3a4[_0xbdac('0x43')]=_0x304cda;return _0x40c3a4;})[_0xbdac('0x24')](respondWithFilteredResult(_0x48deed,_0x4f5cce))['catch'](handleError(_0x48deed,null));};exports['show']=function(_0x575cfd,_0x233cae){var _0xc68faf={'raw':!![],'where':{'id':_0x575cfd['params']['id']}},_0x4d80a3={};_0x4d80a3[_0xbdac('0x30')]=_[_0xbdac('0x32')](db[_0xbdac('0x2b')][_0xbdac('0x2c')]);_0x4d80a3['query']=_[_0xbdac('0x32')](_0x575cfd[_0xbdac('0x34')]);_0x4d80a3[_0xbdac('0x3c')]=_[_0xbdac('0x33')](_0x4d80a3[_0xbdac('0x30')],_0x4d80a3[_0xbdac('0x34')]);_0xc68faf[_0xbdac('0x36')]=_[_0xbdac('0x33')](_0x4d80a3['model'],qs['fields'](_0x575cfd[_0xbdac('0x34')][_0xbdac('0x35')]));_0xc68faf[_0xbdac('0x36')]=_0xc68faf[_0xbdac('0x36')][_0xbdac('0x37')]?_0xc68faf[_0xbdac('0x36')]:_0x4d80a3[_0xbdac('0x30')];if(_0x575cfd['query'][_0xbdac('0x41')]){_0xc68faf[_0xbdac('0x44')]=[{'all':!![]}];}_0xc68faf=_['merge']({},_0xc68faf,_0x575cfd[_0xbdac('0x40')]);return db['CmHopperBlack'][_0xbdac('0x45')](_0xc68faf)[_0xbdac('0x24')](handleEntityNotFound(_0x233cae,null))['then'](respondWithResult(_0x233cae,null))['catch'](handleError(_0x233cae,null));};exports[_0xbdac('0x23')]=function(_0x262fa4,_0x4fc758){if(_0x262fa4[_0xbdac('0x46')]['id']){delete _0x262fa4[_0xbdac('0x46')]['id'];}return db['CmHopperBlack'][_0xbdac('0x45')]({'where':{'id':_0x262fa4[_0xbdac('0x47')]['id']}})[_0xbdac('0x24')](handleEntityNotFound(_0x4fc758,null))[_0xbdac('0x24')](saveUpdates(_0x262fa4[_0xbdac('0x46')],null))[_0xbdac('0x24')](respondWithResult(_0x4fc758,null))[_0xbdac('0x48')](handleError(_0x4fc758,null));};exports[_0xbdac('0x25')]=function(_0x468605,_0x291a19){return db[_0xbdac('0x2b')][_0xbdac('0x45')]({'where':{'id':_0x468605[_0xbdac('0x47')]['id']}})['then'](handleEntityNotFound(_0x291a19,null))['then'](removeEntity(_0x291a19,null))[_0xbdac('0x48')](handleError(_0x291a19,null));};exports[_0xbdac('0x49')]=function(_0x3a0166,_0x414be5){return db[_0xbdac('0x2b')][_0xbdac('0x49')]()[_0xbdac('0x24')](respondWithResult(_0x414be5,null))[_0xbdac('0x48')](handleError(_0x414be5,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 6ba547b..fb61628 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 _0xae1f=['request-promise','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','bluebird'];(function(_0x1bd843,_0x2be387){var _0x24fab8=function(_0x2d7f5d){while(--_0x2d7f5d){_0x1bd843['push'](_0x1bd843['shift']());}};_0x24fab8(++_0x2be387);}(_0xae1f,0x192));var _0xfae1=function(_0x44ae0b,_0x3e9865){_0x44ae0b=_0x44ae0b-0x0;var _0x69232a=_0xae1f[_0x44ae0b];return _0x69232a;};'use strict';var _=require('lodash');var util=require(_0xfae1('0x0'));var logger=require(_0xfae1('0x1'))(_0xfae1('0x2'));var moment=require(_0xfae1('0x3'));var BPromise=require(_0xfae1('0x4'));var rp=require(_0xfae1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfae1('0x6'));var attributes=require(_0xfae1('0x7'));module['exports']=function(_0x1023fb,_0x52f34a){return _0x1023fb[_0xfae1('0x8')](_0xfae1('0x9'),attributes,{'tableName':_0xfae1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1ef=['bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','define','CmHopperBlack','../../config/logger','api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa1ef,0x6a));var _0xfa1e=function(_0x18d36f,_0x31b65f){_0x18d36f=_0x18d36f-0x0;var _0x10034d=_0xa1ef[_0x18d36f];return _0x10034d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa1e('0x0'))(_0xfa1e('0x1'));var moment=require('moment');var BPromise=require(_0xfa1e('0x2'));var rp=require(_0xfa1e('0x3'));var fs=require('fs');var path=require(_0xfa1e('0x4'));var rimraf=require(_0xfa1e('0x5'));var config=require('../../config/environment');var attributes=require(_0xfa1e('0x6'));module['exports']=function(_0x3e5604,_0x49c0dd){return _0x3e5604[_0xfa1e('0x7')](_0xfa1e('0x8'),attributes,{'tableName':'cm_hopper_black','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 2312b1c..63c617f 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 _0x1b32=['destroy','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','UpdateCmHopperBlack','update'];(function(_0x1ec1ea,_0x4c9394){var _0x684ba5=function(_0x207ed5){while(--_0x207ed5){_0x1ec1ea['push'](_0x1ec1ea['shift']());}};_0x684ba5(++_0x4c9394);}(_0x1b32,0x132));var _0x21b3=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x1b32[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x21b3('0x0'));var util=require(_0x21b3('0x1'));var moment=require(_0x21b3('0x2'));var BPromise=require(_0x21b3('0x3'));var rs=require(_0x21b3('0x4'));var fs=require('fs');var Redis=require(_0x21b3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x21b3('0x6'));var logger=require('../../config/logger')(_0x21b3('0x7'));var config=require(_0x21b3('0x8'));var jayson=require(_0x21b3('0x9'));var client=jayson[_0x21b3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d8819,_0x116b74,_0x205e16){return new BPromise(function(_0x17eaac,_0x4b100d){return client[_0x21b3('0xb')](_0x2d8819,_0x205e16)[_0x21b3('0xc')](function(_0x46192c){logger['info'](_0x21b3('0xd'),_0x116b74,_0x21b3('0xe'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x116b74,_0x21b3('0xe'),JSON['stringify'](_0x46192c));if(_0x46192c[_0x21b3('0xf')]){if(_0x46192c['error'][_0x21b3('0x10')]===0x1f4){logger[_0x21b3('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x116b74,_0x46192c[_0x21b3('0xf')]['message']);return _0x4b100d(_0x46192c[_0x21b3('0xf')][_0x21b3('0x11')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x116b74,_0x46192c['error'][_0x21b3('0x11')]);return _0x17eaac(_0x46192c[_0x21b3('0xf')][_0x21b3('0x11')]);}else{logger[_0x21b3('0x12')](_0x21b3('0xd'),_0x116b74,'request\x20sent');_0x17eaac(_0x46192c[_0x21b3('0x13')][_0x21b3('0x11')]);}})[_0x21b3('0x14')](function(_0x2e4942){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x116b74,_0x2e4942);_0x4b100d(_0x2e4942);});});}exports[_0x21b3('0x15')]=function(_0x405bb1){var _0x5e5ef3=this;return new Promise(function(_0x1286a6,_0xdd5ca9){return db[_0x21b3('0x16')][_0x21b3('0x17')]({'raw':_0x405bb1[_0x21b3('0x18')]?_0x405bb1[_0x21b3('0x18')][_0x21b3('0x19')]===undefined?!![]:![]:!![],'where':_0x405bb1[_0x21b3('0x18')]?_0x405bb1[_0x21b3('0x18')][_0x21b3('0x1a')]||null:null,'attributes':_0x405bb1[_0x21b3('0x18')]?_0x405bb1[_0x21b3('0x18')][_0x21b3('0x1b')]||null:null,'limit':_0x405bb1[_0x21b3('0x18')]?_0x405bb1['options'][_0x21b3('0x1c')]||null:null,'include':_0x405bb1[_0x21b3('0x18')]?_0x405bb1[_0x21b3('0x18')][_0x21b3('0x1d')]?_['map'](_0x405bb1[_0x21b3('0x18')]['include'],function(_0x5d32b4){return{'model':db[_0x5d32b4['model']],'as':_0x5d32b4['as'],'attributes':_0x5d32b4[_0x21b3('0x1b')],'include':_0x5d32b4[_0x21b3('0x1d')]?_[_0x21b3('0x1e')](_0x5d32b4[_0x21b3('0x1d')],function(_0x2cf8c3){return{'model':db[_0x2cf8c3['model']],'as':_0x2cf8c3['as'],'attributes':_0x2cf8c3[_0x21b3('0x1b')],'include':_0x2cf8c3[_0x21b3('0x1d')]?_[_0x21b3('0x1e')](_0x2cf8c3['include'],function(_0x558f99){return{'model':db[_0x558f99[_0x21b3('0x1f')]],'as':_0x558f99['as'],'attributes':_0x558f99[_0x21b3('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3df3b1){logger[_0x21b3('0x12')](_0x21b3('0x15'),_0x405bb1);logger[_0x21b3('0x20')](_0x21b3('0x15'),_0x405bb1,JSON[_0x21b3('0x21')](_0x3df3b1));_0x1286a6(_0x3df3b1);})[_0x21b3('0x14')](function(_0x2367e0){logger[_0x21b3('0xf')](_0x21b3('0x15'),_0x2367e0[_0x21b3('0x11')],_0x405bb1);_0xdd5ca9(_0x5e5ef3['error'](0x1f4,_0x2367e0[_0x21b3('0x11')]));});});};exports[_0x21b3('0x22')]=function(_0x1723e4){var _0x219944=this;return new Promise(function(_0x47fde2,_0x3d29be){return db[_0x21b3('0x16')][_0x21b3('0x23')](_0x1723e4['body'],{'raw':_0x1723e4[_0x21b3('0x18')]?_0x1723e4[_0x21b3('0x18')][_0x21b3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1723e4['options']?_0x1723e4[_0x21b3('0x18')]['where']||null:null,'attributes':_0x1723e4[_0x21b3('0x18')]?_0x1723e4[_0x21b3('0x18')][_0x21b3('0x1b')]||null:null,'limit':_0x1723e4['options']?_0x1723e4[_0x21b3('0x18')]['limit']||null:null})[_0x21b3('0xc')](function(_0x29297f){logger[_0x21b3('0x12')](_0x21b3('0x22'),_0x1723e4);logger['debug'](_0x21b3('0x22'),_0x1723e4,JSON[_0x21b3('0x21')](_0x29297f));_0x47fde2(_0x29297f);})[_0x21b3('0x14')](function(_0x2913c7){logger['error'](_0x21b3('0x22'),_0x2913c7[_0x21b3('0x11')],_0x1723e4);_0x3d29be(_0x219944[_0x21b3('0xf')](0x1f4,_0x2913c7['message']));});});};exports['DestroyCmHopperBlack']=function(_0x1021b1){var _0x3ea536=this;return new Promise(function(_0x3877a4,_0x1a83f4){return db[_0x21b3('0x16')][_0x21b3('0x24')]({'where':_0x1021b1[_0x21b3('0x18')]?_0x1021b1[_0x21b3('0x18')][_0x21b3('0x1a')]||null:null})[_0x21b3('0xc')](function(_0x3e3c87){logger['info'](_0x21b3('0x25'),_0x1021b1);logger[_0x21b3('0x20')](_0x21b3('0x25'),_0x1021b1,JSON[_0x21b3('0x21')](_0x3e3c87));_0x3877a4(_0x3e3c87);})['catch'](function(_0x1c7222){logger[_0x21b3('0xf')]('DestroyCmHopperBlack',_0x1c7222[_0x21b3('0x11')],_0x1021b1);_0x1a83f4(_0x3ea536[_0x21b3('0xf')](0x1f4,_0x1c7222['message']));});});}; \ No newline at end of file +var _0xc687=['then','info','CmHopperBlack,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetCmHopperBlack','findAll','options','raw','attributes','limit','include','map','model','UpdateCmHopperBlack','CmHopperBlack','update','body','DestroyCmHopperBlack','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x230cf2,_0x3d7bd7){var _0x3931ae=function(_0x482fde){while(--_0x482fde){_0x230cf2['push'](_0x230cf2['shift']());}};_0x3931ae(++_0x3d7bd7);}(_0xc687,0x1b0));var _0x7c68=function(_0x4ef2ca,_0x229fe0){_0x4ef2ca=_0x4ef2ca-0x0;var _0x20d1d6=_0xc687[_0x4ef2ca];return _0x20d1d6;};'use strict';var _=require(_0x7c68('0x0'));var util=require(_0x7c68('0x1'));var moment=require(_0x7c68('0x2'));var BPromise=require('bluebird');var rs=require(_0x7c68('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7c68('0x4'));var logger=require(_0x7c68('0x5'))(_0x7c68('0x6'));var config=require(_0x7c68('0x7'));var jayson=require(_0x7c68('0x8'));var client=jayson[_0x7c68('0x9')][_0x7c68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fb810,_0x20bd70,_0x3adaee){return new BPromise(function(_0x873ae3,_0x3fc489){return client[_0x7c68('0xb')](_0x1fb810,_0x3adaee)[_0x7c68('0xc')](function(_0x4b3d3f){logger[_0x7c68('0xd')](_0x7c68('0xe'),_0x20bd70,'request\x20sent');logger[_0x7c68('0xf')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x20bd70,_0x7c68('0x10'),JSON[_0x7c68('0x11')](_0x4b3d3f));if(_0x4b3d3f['error']){if(_0x4b3d3f[_0x7c68('0x12')][_0x7c68('0x13')]===0x1f4){logger[_0x7c68('0x12')](_0x7c68('0xe'),_0x20bd70,_0x4b3d3f[_0x7c68('0x12')][_0x7c68('0x14')]);return _0x3fc489(_0x4b3d3f['error'][_0x7c68('0x14')]);}logger[_0x7c68('0x12')](_0x7c68('0xe'),_0x20bd70,_0x4b3d3f[_0x7c68('0x12')][_0x7c68('0x14')]);return _0x873ae3(_0x4b3d3f[_0x7c68('0x12')]['message']);}else{logger['info'](_0x7c68('0xe'),_0x20bd70,_0x7c68('0x10'));_0x873ae3(_0x4b3d3f[_0x7c68('0x15')]['message']);}})[_0x7c68('0x16')](function(_0x53d74e){logger['error'](_0x7c68('0xe'),_0x20bd70,_0x53d74e);_0x3fc489(_0x53d74e);});});}exports[_0x7c68('0x17')]=function(_0x2afba7){var _0x29aabe=this;return new Promise(function(_0x93691b,_0x5c46bb){return db['CmHopperBlack'][_0x7c68('0x18')]({'raw':_0x2afba7[_0x7c68('0x19')]?_0x2afba7[_0x7c68('0x19')][_0x7c68('0x1a')]===undefined?!![]:![]:!![],'where':_0x2afba7[_0x7c68('0x19')]?_0x2afba7[_0x7c68('0x19')]['where']||null:null,'attributes':_0x2afba7['options']?_0x2afba7[_0x7c68('0x19')][_0x7c68('0x1b')]||null:null,'limit':_0x2afba7['options']?_0x2afba7['options'][_0x7c68('0x1c')]||null:null,'include':_0x2afba7['options']?_0x2afba7['options'][_0x7c68('0x1d')]?_['map'](_0x2afba7[_0x7c68('0x19')][_0x7c68('0x1d')],function(_0x1be999){return{'model':db[_0x1be999['model']],'as':_0x1be999['as'],'attributes':_0x1be999[_0x7c68('0x1b')],'include':_0x1be999[_0x7c68('0x1d')]?_[_0x7c68('0x1e')](_0x1be999[_0x7c68('0x1d')],function(_0x411fe3){return{'model':db[_0x411fe3[_0x7c68('0x1f')]],'as':_0x411fe3['as'],'attributes':_0x411fe3[_0x7c68('0x1b')],'include':_0x411fe3[_0x7c68('0x1d')]?_[_0x7c68('0x1e')](_0x411fe3[_0x7c68('0x1d')],function(_0x2c0b85){return{'model':db[_0x2c0b85[_0x7c68('0x1f')]],'as':_0x2c0b85['as'],'attributes':_0x2c0b85['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c68('0xc')](function(_0xaf023f){logger['info'](_0x7c68('0x17'),_0x2afba7);logger[_0x7c68('0xf')]('GetCmHopperBlack',_0x2afba7,JSON[_0x7c68('0x11')](_0xaf023f));_0x93691b(_0xaf023f);})['catch'](function(_0x3f4642){logger['error'](_0x7c68('0x17'),_0x3f4642[_0x7c68('0x14')],_0x2afba7);_0x5c46bb(_0x29aabe[_0x7c68('0x12')](0x1f4,_0x3f4642[_0x7c68('0x14')]));});});};exports[_0x7c68('0x20')]=function(_0x1b68cb){var _0x10fca9=this;return new Promise(function(_0x1b035d,_0x5aba89){return db[_0x7c68('0x21')][_0x7c68('0x22')](_0x1b68cb[_0x7c68('0x23')],{'raw':_0x1b68cb[_0x7c68('0x19')]?_0x1b68cb[_0x7c68('0x19')][_0x7c68('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b68cb[_0x7c68('0x19')]?_0x1b68cb[_0x7c68('0x19')]['where']||null:null,'attributes':_0x1b68cb[_0x7c68('0x19')]?_0x1b68cb[_0x7c68('0x19')][_0x7c68('0x1b')]||null:null,'limit':_0x1b68cb[_0x7c68('0x19')]?_0x1b68cb[_0x7c68('0x19')][_0x7c68('0x1c')]||null:null})[_0x7c68('0xc')](function(_0x34f211){logger[_0x7c68('0xd')](_0x7c68('0x20'),_0x1b68cb);logger['debug'](_0x7c68('0x20'),_0x1b68cb,JSON[_0x7c68('0x11')](_0x34f211));_0x1b035d(_0x34f211);})[_0x7c68('0x16')](function(_0xdf0c18){logger[_0x7c68('0x12')](_0x7c68('0x20'),_0xdf0c18[_0x7c68('0x14')],_0x1b68cb);_0x5aba89(_0x10fca9[_0x7c68('0x12')](0x1f4,_0xdf0c18['message']));});});};exports['DestroyCmHopperBlack']=function(_0x3b9dba){var _0x51b3f7=this;return new Promise(function(_0x2cb213,_0x3b649f){return db[_0x7c68('0x21')]['destroy']({'where':_0x3b9dba[_0x7c68('0x19')]?_0x3b9dba[_0x7c68('0x19')]['where']||null:null})[_0x7c68('0xc')](function(_0x13ad55){logger[_0x7c68('0xd')](_0x7c68('0x24'),_0x3b9dba);logger[_0x7c68('0xf')]('DestroyCmHopperBlack',_0x3b9dba,JSON[_0x7c68('0x11')](_0x13ad55));_0x2cb213(_0x13ad55);})[_0x7c68('0x16')](function(_0xe2cb7d){logger[_0x7c68('0x12')](_0x7c68('0x24'),_0xe2cb7d['message'],_0x3b9dba);_0x3b649f(_0x51b3f7[_0x7c68('0x12')](0x1f4,_0xe2cb7d[_0x7c68('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 5400935..c5d818e 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 _0x5334=['isAuthenticated','show','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','index','describe','get','/:id'];(function(_0x21aab1,_0x36e78d){var _0x321c23=function(_0x1f500f){while(--_0x1f500f){_0x21aab1['push'](_0x21aab1['shift']());}};_0x321c23(++_0x36e78d);}(_0x5334,0x84));var _0x4533=function(_0x2be35b,_0x543ed2){_0x2be35b=_0x2be35b-0x0;var _0x37fc31=_0x5334[_0x2be35b];return _0x37fc31;};'use strict';var multer=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var path=require(_0x4533('0x2'));var timeout=require(_0x4533('0x3'));var express=require(_0x4533('0x4'));var router=express['Router']();var fs_extra=require(_0x4533('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4533('0x6'));var config=require(_0x4533('0x7'));var controller=require('./cmHopperBlack.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4533('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4533('0x9')]);router[_0x4533('0xa')](_0x4533('0xb'),auth[_0x4533('0xc')](),controller[_0x4533('0xd')]);router[_0x4533('0xe')](_0x4533('0xb'),auth['isAuthenticated'](),controller[_0x4533('0xf')]);router[_0x4533('0x10')](_0x4533('0xb'),auth[_0x4533('0xc')](),controller['destroy']);module[_0x4533('0x11')]=router; \ No newline at end of file +var _0x781d=['isAuthenticated','index','/describe','describe','put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x781d,0x14a));var _0xd781=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x781d[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd781('0x2'));var router=express[_0xd781('0x3')]();var fs_extra=require(_0xd781('0x4'));var auth=require(_0xd781('0x5'));var interaction=require(_0xd781('0x6'));var config=require(_0xd781('0x7'));var controller=require(_0xd781('0x8'));router[_0xd781('0x9')]('/',auth[_0xd781('0xa')](),controller[_0xd781('0xb')]);router['get'](_0xd781('0xc'),auth[_0xd781('0xa')](),controller[_0xd781('0xd')]);router[_0xd781('0x9')]('/:id',auth[_0xd781('0xa')](),controller['show']);router[_0xd781('0xe')](_0xd781('0xf'),auth['isAuthenticated'](),controller[_0xd781('0x10')]);router[_0xd781('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd781('0x12')]);module[_0xd781('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 0b4ceba..625970e 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 _0xc0ea=['followuptime','diff','seconds','setDataValue','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0ea,0x131));var _0xac0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc0ea[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xac0e('0x0'));var moment=require(_0xac0e('0x1'));module[_0xac0e('0x2')]={'state':{'type':Sequelize[_0xac0e('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xac0e('0x4')]},'scheduledat':{'type':Sequelize[_0xac0e('0x5')]},'countbusyretry':{'type':Sequelize[_0xac0e('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xac0e('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xac0e('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xac0e('0x4')]},'calleridnum':{'type':Sequelize[_0xac0e('0x4')]},'calleridname':{'type':Sequelize[_0xac0e('0x4')]},'starttime':{'type':Sequelize[_0xac0e('0x5')]},'responsetime':{'type':Sequelize[_0xac0e('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xac0e('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xac0e('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xac0e('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xac0e('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xac0e('0x4')]},'campaign':{'type':Sequelize[_0xac0e('0x4')]},'campaigntype':{'type':Sequelize[_0xac0e('0x4')]},'membername':{'type':Sequelize[_0xac0e('0x4')]},'reason':{'type':Sequelize[_0xac0e('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xac0e('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x2a8196){var _0x1cdea2=this[_0xac0e('0x6')]('endtime');if(_0x1cdea2&&_0x2a8196){this['setDataValue'](_0xac0e('0x7'),moment(_0x2a8196)[_0xac0e('0x8')](moment(_0x1cdea2),_0xac0e('0x9')));}return this[_0xac0e('0xa')](_0xac0e('0xb'),_0x2a8196);}},'amd':{'type':Sequelize[_0xac0e('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xac0e('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xac0e('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xac0e('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xac0e('0x5')]},'callback':{'type':Sequelize[_0xac0e('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xac0e('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xac0e('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xac0e('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xac0e('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xac0e('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xac0e('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xac0e('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xac0e('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xac0e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1876=['STRING','DATE','getDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x18805f,_0x9973b){var _0x54edbb=function(_0x4686e8){while(--_0x4686e8){_0x18805f['push'](_0x18805f['shift']());}};_0x54edbb(++_0x9973b);}(_0x1876,0xbb));var _0x6187=function(_0x560d0f,_0x35c834){_0x560d0f=_0x560d0f-0x0;var _0x1686f4=_0x1876[_0x560d0f];return _0x1686f4;};'use strict';var Sequelize=require(_0x6187('0x0'));var moment=require('moment');module[_0x6187('0x1')]={'state':{'type':Sequelize[_0x6187('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6187('0x3')]},'scheduledat':{'type':Sequelize[_0x6187('0x4')]},'countbusyretry':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6187('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x6187('0x3')]},'originatecalleridname':{'type':Sequelize[_0x6187('0x3')]},'calleridnum':{'type':Sequelize[_0x6187('0x3')]},'calleridname':{'type':Sequelize[_0x6187('0x3')]},'starttime':{'type':Sequelize[_0x6187('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x6187('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x6187('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6187('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x6187('0x3')]},'membername':{'type':Sequelize[_0x6187('0x3')]},'reason':{'type':Sequelize[_0x6187('0x3')]},'disposition':{'type':Sequelize[_0x6187('0x3')]},'secondDisposition':{'type':Sequelize[_0x6187('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6187('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4758ce){var _0x37962c=this[_0x6187('0x5')]('endtime');if(_0x37962c&&_0x4758ce){this['setDataValue'](_0x6187('0x6'),moment(_0x4758ce)[_0x6187('0x7')](moment(_0x37962c),_0x6187('0x8')));}return this['setDataValue']('dispositionat',_0x4758ce);}},'amd':{'type':Sequelize[_0x6187('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6187('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6187('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6187('0x4')]},'callback':{'type':Sequelize[_0x6187('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6187('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6187('0x4')]},'deleted':{'type':Sequelize[_0x6187('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6187('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6187('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index f383dfa..73e34bf 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 _0xbd51=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','from','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','then','includeAll','include','rows','show','params','keys','length','catch','describe','body','uniqueid','find','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','`state`\x20=\x208,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','scheduledAt'];(function(_0x39b3a9,_0x20b8dd){var _0x51b689=function(_0x338cd9){while(--_0x338cd9){_0x39b3a9['push'](_0x39b3a9['shift']());}};_0x51b689(++_0x20b8dd);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x31cc68,_0x17767b){_0x31cc68=_0x31cc68-0x0;var _0x5324e0=_0xbd51[_0x31cc68];return _0x5324e0;};'use strict';var emlformat=require(_0x1bd5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1bd5('0x1'));var jsonpatch=require(_0x1bd5('0x2'));var rp=require(_0x1bd5('0x3'));var moment=require(_0x1bd5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1bd5('0x5'));var csv=require(_0x1bd5('0x6'));var ejs=require(_0x1bd5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1bd5('0x8'));var squel=require(_0x1bd5('0x9'));var crypto=require(_0x1bd5('0xa'));var jsforce=require(_0x1bd5('0xb'));var deskjs=require(_0x1bd5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1bd5('0xd'));var Papa=require('papaparse');var Redis=require(_0x1bd5('0xe'));var authService=require(_0x1bd5('0xf'));var qs=require(_0x1bd5('0x10'));var as=require(_0x1bd5('0x11'));var hardwareService=require(_0x1bd5('0x12'));var logger=require(_0x1bd5('0x13'))('api');var utils=require(_0x1bd5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1bd5('0x15'));var db=require(_0x1bd5('0x16'))['db'];function respondWithStatusCode(_0x37e8e1,_0x14606b){_0x14606b=_0x14606b||0xcc;return function(_0x177be0){if(_0x177be0){return _0x37e8e1[_0x1bd5('0x17')](_0x14606b);}return _0x37e8e1[_0x1bd5('0x18')](_0x14606b)['end']();};}function respondWithResult(_0x5650b5,_0x8b2390){_0x8b2390=_0x8b2390||0xc8;return function(_0x6d2c40){if(_0x6d2c40){return _0x5650b5[_0x1bd5('0x18')](_0x8b2390)[_0x1bd5('0x19')](_0x6d2c40);}};}function respondWithFilteredResult(_0x48d048,_0x5072c2){return function(_0xa63190){if(_0xa63190){var _0xc7277e=typeof _0x5072c2[_0x1bd5('0x1a')]===_0x1bd5('0x1b')&&typeof _0x5072c2[_0x1bd5('0x1c')]===_0x1bd5('0x1b');var _0x13cf34=_0xa63190[_0x1bd5('0x1d')];var _0x4670b5=_0xc7277e?0x0:_0x5072c2['offset'];var _0x53ad5e=_0xc7277e?_0xa63190[_0x1bd5('0x1d')]:_0x5072c2[_0x1bd5('0x1a')]+_0x5072c2[_0x1bd5('0x1c')];var _0xb95d4e;if(_0x53ad5e>=_0x13cf34){_0x53ad5e=_0x13cf34;_0xb95d4e=0xc8;}else{_0xb95d4e=0xce;}_0x48d048[_0x1bd5('0x18')](_0xb95d4e);return _0x48d048[_0x1bd5('0x1e')](_0x1bd5('0x1f'),_0x4670b5+'-'+_0x53ad5e+'/'+_0x13cf34)[_0x1bd5('0x19')](_0xa63190);}return null;};}function patchUpdates(_0x456051){return function(_0xb1ac1e){try{jsonpatch[_0x1bd5('0x20')](_0xb1ac1e,_0x456051,!![]);}catch(_0x2447c4){return BPromise[_0x1bd5('0x21')](_0x2447c4);}return _0xb1ac1e[_0x1bd5('0x22')]();};}function saveUpdates(_0x253d79,_0x46c580){return function(_0x1f13e7){if(_0x1f13e7){return _0x1f13e7[_0x1bd5('0x23')](_0x253d79)['then'](function(_0x42c43d){return _0x42c43d;});}return null;};}function removeEntity(_0x50c663,_0x18fd18){return function(_0x1e534e){if(_0x1e534e){return _0x1e534e[_0x1bd5('0x24')]()['then'](function(){_0x50c663[_0x1bd5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ed551,_0x30676d){return function(_0x3dba4f){if(!_0x3dba4f){_0x2ed551[_0x1bd5('0x17')](0x194);}return _0x3dba4f;};}function handleError(_0x47c84b,_0x202ed3){_0x202ed3=_0x202ed3||0x1f4;return function(_0x69bb17){logger[_0x1bd5('0x25')](_0x69bb17[_0x1bd5('0x26')]);if(_0x69bb17['name']){delete _0x69bb17[_0x1bd5('0x27')];}_0x47c84b[_0x1bd5('0x18')](_0x202ed3)[_0x1bd5('0x28')](_0x69bb17);};}exports[_0x1bd5('0x29')]=function(_0xe54b9f,_0xc73670){var _0x4e72b2={},_0x289097={},_0x472b22={'count':0x0,'rows':[]};var _0x8d53ba=_['map'](db[_0x1bd5('0x2a')][_0x1bd5('0x2b')],function(_0x345181){return{'name':_0x345181[_0x1bd5('0x2c')],'type':_0x345181[_0x1bd5('0x2d')][_0x1bd5('0x2e')]};});_0x289097['model']=_['map'](_0x8d53ba,_0x1bd5('0x27'));_0x289097[_0x1bd5('0x2f')]=_['keys'](_0xe54b9f[_0x1bd5('0x2f')]);_0x289097[_0x1bd5('0x30')]=_[_0x1bd5('0x31')](_0x289097[_0x1bd5('0x32')],_0x289097['query']);_0x4e72b2[_0x1bd5('0x33')]=_[_0x1bd5('0x31')](_0x289097[_0x1bd5('0x32')],qs[_0x1bd5('0x34')](_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x34')]));_0x4e72b2[_0x1bd5('0x33')]=_0x4e72b2[_0x1bd5('0x33')]['length']?_0x4e72b2[_0x1bd5('0x33')]:_0x289097[_0x1bd5('0x32')];if(!_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x35')](_0x1bd5('0x36'))){_0x4e72b2[_0x1bd5('0x1c')]=qs[_0x1bd5('0x1c')](_0xe54b9f['query'][_0x1bd5('0x1c')]);_0x4e72b2[_0x1bd5('0x1a')]=qs[_0x1bd5('0x1a')](_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x1a')]);}_0x4e72b2[_0x1bd5('0x37')]=qs[_0x1bd5('0x38')](_0xe54b9f['query']['sort']);_0x4e72b2[_0x1bd5('0x39')]=qs[_0x1bd5('0x30')](_[_0x1bd5('0x3a')](_0xe54b9f['query'],_0x289097[_0x1bd5('0x30')]),_0x8d53ba);if(_0xe54b9f['query'][_0x1bd5('0x3b')]){_0x4e72b2[_0x1bd5('0x39')]=_[_0x1bd5('0x3c')](_0x4e72b2[_0x1bd5('0x39')],{'$or':_[_0x1bd5('0x3d')](_0x8d53ba,function(_0x2470ec){if(_0x2470ec[_0x1bd5('0x2d')]!==_0x1bd5('0x3e')){var _0x4bbefc={};_0x4bbefc[_0x2470ec[_0x1bd5('0x27')]]={'$like':'%'+_0xe54b9f[_0x1bd5('0x2f')]['filter']+'%'};return _0x4bbefc;}})});}_0x4e72b2=_[_0x1bd5('0x3c')]({},_0x4e72b2,_0xe54b9f[_0x1bd5('0x3f')]);var _0x20b25c={'where':_0x4e72b2['where']};return db[_0x1bd5('0x2a')][_0x1bd5('0x1d')](_0x20b25c)[_0x1bd5('0x40')](function(_0x4074f1){_0x472b22['count']=_0x4074f1;if(_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x41')]){_0x4e72b2[_0x1bd5('0x42')]=[{'all':!![]}];}return db[_0x1bd5('0x2a')]['findAll'](_0x4e72b2);})['then'](function(_0x40eeff){_0x472b22[_0x1bd5('0x43')]=_0x40eeff;return _0x472b22;})[_0x1bd5('0x40')](respondWithFilteredResult(_0xc73670,_0x4e72b2))['catch'](handleError(_0xc73670,null));};exports[_0x1bd5('0x44')]=function(_0x3b1092,_0x574d95){var _0x1eacac={'raw':!![],'where':{'id':_0x3b1092[_0x1bd5('0x45')]['id']}},_0x5761b8={};_0x5761b8[_0x1bd5('0x32')]=_['keys'](db[_0x1bd5('0x2a')][_0x1bd5('0x2b')]);_0x5761b8[_0x1bd5('0x2f')]=_[_0x1bd5('0x46')](_0x3b1092[_0x1bd5('0x2f')]);_0x5761b8[_0x1bd5('0x30')]=_[_0x1bd5('0x31')](_0x5761b8[_0x1bd5('0x32')],_0x5761b8[_0x1bd5('0x2f')]);_0x1eacac[_0x1bd5('0x33')]=_[_0x1bd5('0x31')](_0x5761b8[_0x1bd5('0x32')],qs['fields'](_0x3b1092[_0x1bd5('0x2f')][_0x1bd5('0x34')]));_0x1eacac[_0x1bd5('0x33')]=_0x1eacac['attributes'][_0x1bd5('0x47')]?_0x1eacac[_0x1bd5('0x33')]:_0x5761b8['model'];if(_0x3b1092[_0x1bd5('0x2f')]['includeAll']){_0x1eacac[_0x1bd5('0x42')]=[{'all':!![]}];}_0x1eacac=_['merge']({},_0x1eacac,_0x3b1092[_0x1bd5('0x3f')]);return db[_0x1bd5('0x2a')]['find'](_0x1eacac)[_0x1bd5('0x40')](handleEntityNotFound(_0x574d95,null))['then'](respondWithResult(_0x574d95,null))[_0x1bd5('0x48')](handleError(_0x574d95,null));};exports[_0x1bd5('0x49')]=function(_0x1a29f3,_0xe71454){return db[_0x1bd5('0x2a')][_0x1bd5('0x49')]()[_0x1bd5('0x40')](respondWithResult(_0xe71454,null))[_0x1bd5('0x48')](handleError(_0xe71454,null));};exports['update']=function(_0x13985e,_0x227a68){if(_0x13985e[_0x1bd5('0x4a')][_0x1bd5('0x4b')]){delete _0x13985e[_0x1bd5('0x4a')][_0x1bd5('0x4b')];}return db['CmHopperFinal'][_0x1bd5('0x4c')]({'where':{'uniqueid':_0x13985e[_0x1bd5('0x45')]['id']}})[_0x1bd5('0x40')](handleEntityNotFound(_0x227a68,null))[_0x1bd5('0x40')](saveUpdates(_0x13985e[_0x1bd5('0x4a')],null))[_0x1bd5('0x40')](respondWithResult(_0x227a68,null))[_0x1bd5('0x48')](handleError(_0x227a68,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x587c46,_0x126221,_0x2d713b){return db[_0x1bd5('0x2a')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x587c46[_0x1bd5('0x45')]['id']},'attributes':[[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x50')))),'noSuchContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')]['literal'](_0x1bd5('0x51')))),'noAnswerContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x52')))),_0x1bd5('0x53')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')]('`state`\x20=\x208,\x201,\x20null'))),_0x1bd5('0x54')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x55')))),_0x1bd5('0x56')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x57')))),_0x1bd5('0x58')],[db['sequelize']['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x59')))),'reCallContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x5a')))),_0x1bd5('0x5b')]]})[_0x1bd5('0x40')](handleEntityNotFound(_0x126221,null))['then'](respondWithResult(_0x126221,null))['catch'](handleError(_0x126221,null));};exports[_0x1bd5('0x5c')]=function(_0xec9fac,_0x1790af,_0x54a8c4){return db['CmHopperFinal'][_0x1bd5('0x5d')]({'raw':![],'where':{'CampaignId':_0xec9fac['params']['id']},'attributes':[[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')]['literal'](_0x1bd5('0x50')))),'noSuchContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x5e')))),'congestionContacts'],[db['sequelize']['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x55')))),'dropContacts'],[db[_0x1bd5('0x4d')]['fn']('COUNT',db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x57')))),'abandonedContacts'],[db['sequelize']['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x59')))),_0x1bd5('0x5f')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x5a')))),_0x1bd5('0x5b')]]})[_0x1bd5('0x40')](handleEntityNotFound(_0x1790af,null))[_0x1bd5('0x40')](respondWithResult(_0x1790af,null))[_0x1bd5('0x48')](handleError(_0x1790af,null));};exports[_0x1bd5('0x60')]=function(_0x195176,_0x393a8f,_0x1ffbab){return db[_0x1bd5('0x61')][_0x1bd5('0x4c')]({'where':{'id':_0x195176[_0x1bd5('0x45')]['id']}})[_0x1bd5('0x40')](handleEntityNotFound(_0x393a8f,null))['then'](function(_0x3bd058){var _0x1d6223;if(_0x3bd058){_0x1d6223=squel[_0x1bd5('0x62')]()[_0x1bd5('0x63')](_0x1bd5('0x64'))[_0x1bd5('0x65')]([_0x1bd5('0x66'),'scheduledAt',_0x1bd5('0x67'),_0x1bd5('0x68'),_0x1bd5('0x69'),_0x1bd5('0x6a'),'updatedAt'],squel[_0x1bd5('0x6b')]()[_0x1bd5('0x6c')](_0x1bd5('0x6d'),_0x1bd5('0x66'))[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x6f'))['field'](_0x1bd5('0x70'),'ContactId')['field'](_0x1bd5('0x71'),'ListId')[_0x1bd5('0x6c')](_0x1bd5('0x72'),'VoiceQueueId')[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x6a'))[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x73'))['from'](_0x1bd5('0x74'))[_0x1bd5('0x39')](_0x1bd5('0x75'),_0x195176[_0x1bd5('0x45')]['id']['toString']())['where'](_0x1bd5('0x76'),_0x195176[_0x1bd5('0x4a')][_0x1bd5('0x77')][_0x1bd5('0x78')]())['where'](_0x1bd5('0x79'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1bd5('0x6b')]()['field'](_0x1bd5('0x66'))[_0x1bd5('0x7a')](_0x1bd5('0x64'))[_0x1bd5('0x39')](_0x1bd5('0x75'),_0x195176[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]()))[_0x1bd5('0x39')](_0x1bd5('0x7b'),squel['select']()[_0x1bd5('0x6c')]('calleridnum')['from']('cm_hopper_final')[_0x1bd5('0x39')]('VoiceQueueId\x20=\x20?',_0x195176[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]())[_0x1bd5('0x39')](_0x1bd5('0x7c')))[_0x1bd5('0x7d')](_0x1bd5('0x67')))[_0x1bd5('0x78')]();return db['sequelize'][_0x1bd5('0x2f')](_0x1d6223);}return[];})['then'](respondWithResult(_0x393a8f,null))[_0x1bd5('0x48')](handleError(_0x393a8f,null));};exports[_0x1bd5('0x7e')]=function(_0x7d097,_0x50f2ac,_0x5db61c){return db[_0x1bd5('0x7f')]['find']({'where':{'id':_0x7d097[_0x1bd5('0x45')]['id']}})['then'](handleEntityNotFound(_0x50f2ac,null))[_0x1bd5('0x40')](function(_0x16f996){var _0x248d66;if(_0x16f996){_0x248d66=squel[_0x1bd5('0x62')]()[_0x1bd5('0x63')](_0x1bd5('0x64'))[_0x1bd5('0x65')]([_0x1bd5('0x66'),_0x1bd5('0x6f'),_0x1bd5('0x67'),_0x1bd5('0x68'),_0x1bd5('0x80'),_0x1bd5('0x6a'),_0x1bd5('0x73')],squel['select']()[_0x1bd5('0x6c')](_0x1bd5('0x6d'),_0x1bd5('0x66'))['field'](_0x1bd5('0x6e'),_0x1bd5('0x6f'))['field'](_0x1bd5('0x70'),_0x1bd5('0x67'))[_0x1bd5('0x6c')]('ANY_VALUE(ListId)',_0x1bd5('0x68'))[_0x1bd5('0x6c')](_0x1bd5('0x81'),_0x1bd5('0x80'))['field'](_0x1bd5('0x6e'),_0x1bd5('0x6a'))[_0x1bd5('0x6c')]('NOW()',_0x1bd5('0x73'))[_0x1bd5('0x7a')]('cm_hopper_final')['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id']['toString']())['where'](_0x1bd5('0x76'),_0x7d097['body']['state'][_0x1bd5('0x78')]())['where'](_0x1bd5('0x79'))[_0x1bd5('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1bd5('0x6b')]()[_0x1bd5('0x6c')](_0x1bd5('0x66'))['from'](_0x1bd5('0x64'))['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]()))[_0x1bd5('0x39')](_0x1bd5('0x7b'),squel['select']()[_0x1bd5('0x6c')]('calleridnum')[_0x1bd5('0x7a')]('cm_hopper_final')['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]())[_0x1bd5('0x39')]('state\x20=\x204'))[_0x1bd5('0x7d')](_0x1bd5('0x67')))[_0x1bd5('0x78')]();return db[_0x1bd5('0x4d')][_0x1bd5('0x2f')](_0x248d66);}return[];})[_0x1bd5('0x40')](respondWithResult(_0x50f2ac,null))[_0x1bd5('0x48')](handleError(_0x50f2ac,null));};exports[_0x1bd5('0x83')]=function(_0x22e1f4,_0x347d06,_0x3cf023){return db[_0x1bd5('0x84')][_0x1bd5('0x85')]({'where':{'VoiceQueueId':_0x22e1f4[_0x1bd5('0x4a')]['VoiceQueueId'],'CampaignId':_0x22e1f4[_0x1bd5('0x4a')][_0x1bd5('0x80')],'ContactId':_0x22e1f4[_0x1bd5('0x4a')][_0x1bd5('0x67')]}})[_0x1bd5('0x40')](handleEntityNotFound(_0x347d06,null))[_0x1bd5('0x40')](function(_0x28f567){if(_0x28f567){return _0x28f567;}return null;})[_0x1bd5('0x40')](respondWithResult(_0x347d06,null))[_0x1bd5('0x48')](handleError(_0x347d06,null));}; \ No newline at end of file +var _0x1261=['attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','describe','catch','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','cm_hopper','fromQuery','phone','scheduledAt','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','into','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','checkContactHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','CmHopperFinal','model','map','name','keys','query','intersection'];(function(_0x47e3ba,_0x4856f5){var _0x58d2a3=function(_0x4ebb95){while(--_0x4ebb95){_0x47e3ba['push'](_0x47e3ba['shift']());}};_0x58d2a3(++_0x4856f5);}(_0x1261,0x144));var _0x1126=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x1261[_0x1c8c28];return _0x1f59b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['CmHopperFinal'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':!![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['CmHopperFinal']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')]()['then'](respondWithResult(_0x5111d3,null))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports[_0x1126('0x24')]=function(_0x518e0a,_0x3e4eeb){if(_0x518e0a[_0x1126('0x44')][_0x1126('0x45')]){delete _0x518e0a['body'][_0x1126('0x45')];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'uniqueid':_0x518e0a[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0x3e4eeb,null))[_0x1126('0x25')](saveUpdates(_0x518e0a[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0x3e4eeb,null))['catch'](handleError(_0x3e4eeb,null));};exports[_0x1126('0x46')]=function(_0x5a2287,_0x40168e,_0x2ad118){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x5a2287[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4a')))),_0x1126('0x4b')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x4e')))),_0x1126('0x4f')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x1126('0x50')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x1126('0x51')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),_0x1126('0x53')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x40168e,null))[_0x1126('0x25')](respondWithResult(_0x40168e,null))[_0x1126('0x43')](handleError(_0x40168e,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xcc1a95,_0x315386,_0x5e0ea1){return db[_0x1126('0x29')]['findAll']({'raw':![],'where':{'CampaignId':_0xcc1a95[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x1126('0x4b')],[db['sequelize']['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x56')))),_0x1126('0x57')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x4e')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x58')))),'dropContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x59')))),_0x1126('0x51')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),'reCallContacts'],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x315386,null))[_0x1126('0x25')](respondWithResult(_0x315386,null))[_0x1126('0x43')](handleError(_0x315386,null));};exports[_0x1126('0x5a')]=function(_0x247f12,_0xd20fbe,_0x3d5e15){return db[_0x1126('0x5b')][_0x1126('0x41')]({'where':{'id':_0x247f12[_0x1126('0x3f')]['id']}})['then'](handleEntityNotFound(_0xd20fbe,null))[_0x1126('0x25')](function(_0x274343){var _0x2b61ae;if(_0x274343){_0x2b61ae=squel['insert']()['into'](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),'ContactId','ListId','VoiceQueueId',_0x1126('0x60'),_0x1126('0x61')],squel[_0x1126('0x62')]()[_0x1126('0x63')]('ANY_VALUE(calleridnum)',_0x1126('0x5e'))['field'](_0x1126('0x64'),_0x1126('0x5f'))[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),'ListId')[_0x1126('0x63')]('ANY_VALUE(VoiceQueueId)',_0x1126('0x68'))[_0x1126('0x63')]('NOW()',_0x1126('0x60'))[_0x1126('0x63')]('NOW()',_0x1126('0x61'))[_0x1126('0x69')]('cm_hopper_final')['where'](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())['where']('state\x20=\x20?',_0x247f12['body'][_0x1126('0x6c')]['toString']())['where'](_0x1126('0x6d'))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()['field'](_0x1126('0x5e'))[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12['params']['id'][_0x1126('0x6b')]()))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')](_0x1126('0x71')))[_0x1126('0x72')](_0x1126('0x66')))[_0x1126('0x6b')]();return db[_0x1126('0x47')][_0x1126('0x2e')](_0x2b61ae);}return[];})['then'](respondWithResult(_0xd20fbe,null))[_0x1126('0x43')](handleError(_0xd20fbe,null));};exports[_0x1126('0x73')]=function(_0x33cccf,_0x1483f4,_0x3be5bf){return db['Campaign'][_0x1126('0x41')]({'where':{'id':_0x33cccf['params']['id']}})['then'](handleEntityNotFound(_0x1483f4,null))[_0x1126('0x25')](function(_0x2b1884){var _0x55f366;if(_0x2b1884){_0x55f366=squel['insert']()[_0x1126('0x74')](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),_0x1126('0x66'),_0x1126('0x75'),_0x1126('0x76'),_0x1126('0x60'),'updatedAt'],squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x77'),_0x1126('0x5e'))[_0x1126('0x63')](_0x1126('0x64'),'scheduledAt')[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),_0x1126('0x75'))[_0x1126('0x63')](_0x1126('0x78'),_0x1126('0x76'))[_0x1126('0x63')]('NOW()','createdAt')[_0x1126('0x63')]('NOW()',_0x1126('0x61'))['from'](_0x1126('0x70'))['where'](_0x1126('0x79'),_0x33cccf['params']['id']['toString']())['where'](_0x1126('0x7a'),_0x33cccf[_0x1126('0x44')]['state']['toString']())[_0x1126('0x37')](_0x1126('0x6d'))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x1126('0x63')]('phone')[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id']['toString']()))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')]('state\x20=\x204'))[_0x1126('0x72')]('ContactId'))[_0x1126('0x6b')]();return db['sequelize'][_0x1126('0x2e')](_0x55f366);}return[];})[_0x1126('0x25')](respondWithResult(_0x1483f4,null))[_0x1126('0x43')](handleError(_0x1483f4,null));};exports[_0x1126('0x7b')]=function(_0x59c04b,_0x429183,_0x834360){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x59c04b[_0x1126('0x44')][_0x1126('0x68')],'CampaignId':_0x59c04b[_0x1126('0x44')]['CampaignId'],'ContactId':_0x59c04b[_0x1126('0x44')]['ContactId']}})[_0x1126('0x25')](handleEntityNotFound(_0x429183,null))[_0x1126('0x25')](function(_0x4d6bb2){if(_0x4d6bb2){return _0x4d6bb2;}return null;})[_0x1126('0x25')](respondWithResult(_0x429183,null))[_0x1126('0x43')](handleError(_0x429183,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 6baf15b..eb46257 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 _0xf692=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x537c37,_0x536e74){var _0x241f84=function(_0x3fe709){while(--_0x3fe709){_0x537c37['push'](_0x537c37['shift']());}};_0x241f84(++_0x536e74);}(_0xf692,0x85));var _0x2f69=function(_0x4e9c50,_0x2626d3){_0x4e9c50=_0x4e9c50-0x0;var _0x1547b8=_0xf692[_0x4e9c50];return _0x1547b8;};'use strict';var _=require(_0x2f69('0x0'));var util=require(_0x2f69('0x1'));var logger=require(_0x2f69('0x2'))(_0x2f69('0x3'));var moment=require('moment');var BPromise=require(_0x2f69('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f69('0x5'));var rimraf=require(_0x2f69('0x6'));var config=require(_0x2f69('0x7'));var attributes=require(_0x2f69('0x8'));module[_0x2f69('0x9')]=function(_0x35e8aa,_0x4707d0){return _0x35e8aa[_0x2f69('0xa')](_0x2f69('0xb'),attributes,{'tableName':_0x2f69('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x2f69('0xd')]},{'name':_0x2f69('0xe'),'fields':[_0x2f69('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x751d=['./cmHopperFinal.attributes','exports','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x751d,0x1d3));var _0xd751=function(_0x20fb02,_0x96c029){_0x20fb02=_0x20fb02-0x0;var _0x24a33e=_0x751d[_0x20fb02];return _0x24a33e;};'use strict';var _=require(_0xd751('0x0'));var util=require(_0xd751('0x1'));var logger=require(_0xd751('0x2'))(_0xd751('0x3'));var moment=require('moment');var BPromise=require(_0xd751('0x4'));var rp=require(_0xd751('0x5'));var fs=require('fs');var path=require(_0xd751('0x6'));var rimraf=require(_0xd751('0x7'));var config=require(_0xd751('0x8'));var attributes=require(_0xd751('0x9'));module[_0xd751('0xa')]=function(_0x1f15d2,_0x519006){return _0x1f15d2['define'](_0xd751('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xd751('0xc'),'fields':['calleridnum']},{'name':_0xd751('0xd'),'fields':[_0xd751('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 85d2b9a..02dde2a 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x424dfb,_0xb7a54){var _0x870ca3=function(_0x5e8957){while(--_0x5e8957){_0x424dfb['push'](_0x424dfb['shift']());}};_0x870ca3(++_0xb7a54);}(_0xb10b,0x12a));var _0xbb10=function(_0x1b4b01,_0x43eb55){_0x1b4b01=_0x1b4b01-0x0;var _0x521446=_0xb10b[_0x1b4b01];return _0x521446;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x4a850c,_0x49eb71){var _0x4008cf=function(_0x50e31f){while(--_0x50e31f){_0x4a850c['push'](_0x4a850c['shift']());}};_0x4008cf(++_0x49eb71);}(_0xb10b,0x12a));var _0xbb10=function(_0x1eb5da,_0x1974ec){_0x1eb5da=_0x1eb5da-0x0;var _0x579a2f=_0xb10b[_0x1eb5da];return _0x579a2f;};'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 23c0000..6ffa5c8 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 _0x0cb9=['countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','checkContactHopper','put','/:id','update','exports','util','connect-timeout','express','Router','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','show','/voice/queue/countAttributes/:id'];(function(_0x28cadd,_0x3b8ccc){var _0x768e13=function(_0x2607b7){while(--_0x2607b7){_0x28cadd['push'](_0x28cadd['shift']());}};_0x768e13(++_0x3b8ccc);}(_0x0cb9,0xc8));var _0x90cb=function(_0x42f051,_0x137358){_0x42f051=_0x42f051-0x0;var _0x2b87b5=_0x0cb9[_0x42f051];return _0x2b87b5;};'use strict';var multer=require('multer');var util=require(_0x90cb('0x0'));var path=require('path');var timeout=require(_0x90cb('0x1'));var express=require(_0x90cb('0x2'));var router=express[_0x90cb('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x90cb('0x4'));var config=require('../../config/environment');var controller=require(_0x90cb('0x5'));router[_0x90cb('0x6')]('/',auth[_0x90cb('0x7')](),controller['index']);router[_0x90cb('0x6')]('/describe',auth[_0x90cb('0x7')](),controller['describe']);router[_0x90cb('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x90cb('0x8')]);router[_0x90cb('0x6')](_0x90cb('0x9'),auth[_0x90cb('0x7')](),controller[_0x90cb('0xa')]);router[_0x90cb('0x6')](_0x90cb('0xb'),auth[_0x90cb('0x7')](),controller[_0x90cb('0xc')]);router[_0x90cb('0xd')](_0x90cb('0xe'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x90cb('0xd')](_0x90cb('0xf'),auth[_0x90cb('0x7')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x90cb('0xd')]('/checkContactHopper',auth[_0x90cb('0x7')](),controller[_0x90cb('0x10')]);router[_0x90cb('0x11')](_0x90cb('0x12'),auth[_0x90cb('0x7')](),controller[_0x90cb('0x13')]);module[_0x90cb('0x14')]=router; \ No newline at end of file +var _0x3a6d=['/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x3a6d,0x143));var _0xd3a6=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x3a6d[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var path=require('path');var timeout=require(_0xd3a6('0x2'));var express=require(_0xd3a6('0x3'));var router=express[_0xd3a6('0x4')]();var fs_extra=require(_0xd3a6('0x5'));var auth=require(_0xd3a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd3a6('0x7'));var controller=require(_0xd3a6('0x8'));router[_0xd3a6('0x9')]('/',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xb')]);router[_0xd3a6('0x9')]('/describe',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xc')]);router[_0xd3a6('0x9')](_0xd3a6('0xd'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xe')]);router[_0xd3a6('0x9')](_0xd3a6('0xf'),auth[_0xd3a6('0xa')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xd3a6('0x9')](_0xd3a6('0x10'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x11')]);router[_0xd3a6('0x12')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xd3a6('0x12')](_0xd3a6('0x13'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x14')]);router[_0xd3a6('0x12')](_0xd3a6('0x15'),auth[_0xd3a6('0xa')](),controller['checkContactHopper']);router[_0xd3a6('0x16')](_0xd3a6('0xd'),auth[_0xd3a6('0xa')](),controller['update']);module[_0xd3a6('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 92ee2db..4f1abea 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 _0xca3d=['STRING','BOOLEAN','sequelize','exports','INTEGER','DATE'];(function(_0x591e11,_0x363e09){var _0x23a0a=function(_0x43734d){while(--_0x43734d){_0x591e11['push'](_0x591e11['shift']());}};_0x23a0a(++_0x363e09);}(_0xca3d,0x1e8));var _0xdca3=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0xca3d[_0x2984d0];return _0x2885f2;};'use strict';var Sequelize=require(_0xdca3('0x0'));module[_0xdca3('0x1')]={'state':{'type':Sequelize[_0xdca3('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xdca3('0x3')]},'countbusyretry':{'type':Sequelize[_0xdca3('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdca3('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdca3('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xdca3('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xdca3('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xdca3('0x4')]},'calleridname':{'type':Sequelize[_0xdca3('0x4')]},'starttime':{'type':Sequelize[_0xdca3('0x3')]},'responsetime':{'type':Sequelize[_0xdca3('0x3')]},'answertime':{'type':Sequelize[_0xdca3('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xdca3('0x3')]},'ringtime':{'type':Sequelize[_0xdca3('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xdca3('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xdca3('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xdca3('0x4')]},'campaign':{'type':Sequelize[_0xdca3('0x4')]},'campaigntype':{'type':Sequelize[_0xdca3('0x4')]},'membername':{'type':Sequelize[_0xdca3('0x4')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xdca3('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xdca3('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdca3('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdca3('0x3')]},'recallme':{'type':Sequelize[_0xdca3('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xdca3('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdca3('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdca3('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdca3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x53fd=['DATE','STRING','BOOLEAN','sequelize','INTEGER'];(function(_0xaf4769,_0xdb8bf7){var _0x4f491c=function(_0x1c0f76){while(--_0x1c0f76){_0xaf4769['push'](_0xaf4769['shift']());}};_0x4f491c(++_0xdb8bf7);}(_0x53fd,0x184));var _0xd53f=function(_0x492e5a,_0x2e051f){_0x492e5a=_0x492e5a-0x0;var _0x4f83b2=_0x53fd[_0x492e5a];return _0x4f83b2;};'use strict';var Sequelize=require(_0xd53f('0x0'));module['exports']={'state':{'type':Sequelize[_0xd53f('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xd53f('0x2')]},'countbusyretry':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd53f('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xd53f('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd53f('0x3')]},'calleridname':{'type':Sequelize[_0xd53f('0x3')]},'starttime':{'type':Sequelize[_0xd53f('0x2')]},'responsetime':{'type':Sequelize[_0xd53f('0x2')]},'answertime':{'type':Sequelize[_0xd53f('0x2')]},'droptime':{'type':Sequelize[_0xd53f('0x2')]},'endtime':{'type':Sequelize[_0xd53f('0x2')]},'ringtime':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd53f('0x3')]},'campaign':{'type':Sequelize[_0xd53f('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd53f('0x3')]},'reason':{'type':Sequelize[_0xd53f('0x3')]},'amd':{'type':Sequelize[_0xd53f('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd53f('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd53f('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xd53f('0x2')]},'edited':{'type':Sequelize[_0xd53f('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 0b3c1b7..58262be 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 _0x6074=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','json','apply','save','update','then','destroy','end','error','stack','name','send','index','map','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','CmHopperHistory','includeAll','include','findAll','rows','catch','show','params','options','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x174096,_0x345c0e){var _0x37742d=function(_0x535f9f){while(--_0x535f9f){_0x174096['push'](_0x174096['shift']());}};_0x37742d(++_0x345c0e);}(_0x6074,0x12b));var _0x4607=function(_0x13915f,_0x3d90c6){_0x13915f=_0x13915f-0x0;var _0x373181=_0x6074[_0x13915f];return _0x373181;};'use strict';var emlformat=require(_0x4607('0x0'));var rimraf=require(_0x4607('0x1'));var zipdir=require(_0x4607('0x2'));var jsonpatch=require(_0x4607('0x3'));var rp=require(_0x4607('0x4'));var moment=require(_0x4607('0x5'));var BPromise=require(_0x4607('0x6'));var Mustache=require(_0x4607('0x7'));var util=require('util');var path=require(_0x4607('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4607('0x9'));var fs=require('fs');var fs_extra=require(_0x4607('0xa'));var _=require(_0x4607('0xb'));var squel=require(_0x4607('0xc'));var crypto=require(_0x4607('0xd'));var jsforce=require(_0x4607('0xe'));var deskjs=require(_0x4607('0xf'));var toCsv=require(_0x4607('0x10'));var querystring=require(_0x4607('0x11'));var Papa=require('papaparse');var Redis=require(_0x4607('0x12'));var authService=require(_0x4607('0x13'));var qs=require(_0x4607('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4607('0x15'));var logger=require(_0x4607('0x16'))('api');var utils=require(_0x4607('0x17'));var config=require(_0x4607('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4607('0x19'))['db'];function respondWithStatusCode(_0x3120d3,_0x65cd62){_0x65cd62=_0x65cd62||0xcc;return function(_0x135cac){if(_0x135cac){return _0x3120d3['sendStatus'](_0x65cd62);}return _0x3120d3[_0x4607('0x1a')](_0x65cd62)['end']();};}function respondWithResult(_0x11eeb4,_0x569dcc){_0x569dcc=_0x569dcc||0xc8;return function(_0x16f63b){if(_0x16f63b){return _0x11eeb4[_0x4607('0x1a')](_0x569dcc)['json'](_0x16f63b);}};}function respondWithFilteredResult(_0x99cdb4,_0x2cab3a){return function(_0x538a50){if(_0x538a50){var _0x2f1ebb=typeof _0x2cab3a[_0x4607('0x1b')]===_0x4607('0x1c')&&typeof _0x2cab3a[_0x4607('0x1d')]===_0x4607('0x1c');var _0x2159e1=_0x538a50[_0x4607('0x1e')];var _0x33e19d=_0x2f1ebb?0x0:_0x2cab3a['offset'];var _0x1fa3e3=_0x2f1ebb?_0x538a50[_0x4607('0x1e')]:_0x2cab3a[_0x4607('0x1b')]+_0x2cab3a[_0x4607('0x1d')];var _0x80af0;if(_0x1fa3e3>=_0x2159e1){_0x1fa3e3=_0x2159e1;_0x80af0=0xc8;}else{_0x80af0=0xce;}_0x99cdb4[_0x4607('0x1a')](_0x80af0);return _0x99cdb4['set']('Content-Range',_0x33e19d+'-'+_0x1fa3e3+'/'+_0x2159e1)[_0x4607('0x1f')](_0x538a50);}return null;};}function patchUpdates(_0x172b08){return function(_0x24f227){try{jsonpatch[_0x4607('0x20')](_0x24f227,_0x172b08,!![]);}catch(_0x260d96){return BPromise['reject'](_0x260d96);}return _0x24f227[_0x4607('0x21')]();};}function saveUpdates(_0x16a9b5,_0x43c281){return function(_0x19a541){if(_0x19a541){return _0x19a541[_0x4607('0x22')](_0x16a9b5)[_0x4607('0x23')](function(_0x13882b){return _0x13882b;});}return null;};}function removeEntity(_0x2549a3,_0x2da231){return function(_0x5d00db){if(_0x5d00db){return _0x5d00db[_0x4607('0x24')]()[_0x4607('0x23')](function(){_0x2549a3[_0x4607('0x1a')](0xcc)[_0x4607('0x25')]();});}};}function handleEntityNotFound(_0x4d1673,_0x4f5bc3){return function(_0x7a3d5b){if(!_0x7a3d5b){_0x4d1673['sendStatus'](0x194);}return _0x7a3d5b;};}function handleError(_0x5d2845,_0xa0ece9){_0xa0ece9=_0xa0ece9||0x1f4;return function(_0x307586){logger[_0x4607('0x26')](_0x307586[_0x4607('0x27')]);if(_0x307586[_0x4607('0x28')]){delete _0x307586[_0x4607('0x28')];}_0x5d2845[_0x4607('0x1a')](_0xa0ece9)[_0x4607('0x29')](_0x307586);};}exports[_0x4607('0x2a')]=function(_0x4d3364,_0x5c84f8){var _0x2d38be={},_0x477210={},_0x2b478d={'count':0x0,'rows':[]};var _0x1ca9f6=_[_0x4607('0x2b')](db['CmHopperHistory']['rawAttributes'],function(_0x1cdecf){return{'name':_0x1cdecf[_0x4607('0x2c')],'type':_0x1cdecf['type'][_0x4607('0x2d')]};});_0x477210['model']=_[_0x4607('0x2b')](_0x1ca9f6,'name');_0x477210[_0x4607('0x2e')]=_[_0x4607('0x2f')](_0x4d3364['query']);_0x477210[_0x4607('0x30')]=_[_0x4607('0x31')](_0x477210[_0x4607('0x32')],_0x477210['query']);_0x2d38be[_0x4607('0x33')]=_[_0x4607('0x31')](_0x477210[_0x4607('0x32')],qs[_0x4607('0x34')](_0x4d3364[_0x4607('0x2e')][_0x4607('0x34')]));_0x2d38be[_0x4607('0x33')]=_0x2d38be['attributes'][_0x4607('0x35')]?_0x2d38be[_0x4607('0x33')]:_0x477210[_0x4607('0x32')];if(!_0x4d3364[_0x4607('0x2e')][_0x4607('0x36')](_0x4607('0x37'))){_0x2d38be['limit']=qs[_0x4607('0x1d')](_0x4d3364[_0x4607('0x2e')][_0x4607('0x1d')]);_0x2d38be['offset']=qs[_0x4607('0x1b')](_0x4d3364['query'][_0x4607('0x1b')]);}_0x2d38be[_0x4607('0x38')]=qs[_0x4607('0x39')](_0x4d3364[_0x4607('0x2e')][_0x4607('0x39')]);_0x2d38be['where']=qs['filters'](_[_0x4607('0x3a')](_0x4d3364[_0x4607('0x2e')],_0x477210['filters']),_0x1ca9f6);if(_0x4d3364['query'][_0x4607('0x3b')]){_0x2d38be[_0x4607('0x3c')]=_[_0x4607('0x3d')](_0x2d38be[_0x4607('0x3c')],{'$or':_[_0x4607('0x2b')](_0x1ca9f6,function(_0x24e5b7){if(_0x24e5b7['type']!==_0x4607('0x3e')){var _0x22e150={};_0x22e150[_0x24e5b7[_0x4607('0x28')]]={'$like':'%'+_0x4d3364[_0x4607('0x2e')]['filter']+'%'};return _0x22e150;}})});}_0x2d38be=_['merge']({},_0x2d38be,_0x4d3364['options']);var _0x292b46={'where':_0x2d38be[_0x4607('0x3c')]};return db[_0x4607('0x3f')]['count'](_0x292b46)['then'](function(_0x3d125a){_0x2b478d[_0x4607('0x1e')]=_0x3d125a;if(_0x4d3364[_0x4607('0x2e')][_0x4607('0x40')]){_0x2d38be[_0x4607('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x4607('0x42')](_0x2d38be);})[_0x4607('0x23')](function(_0x2130a3){_0x2b478d[_0x4607('0x43')]=_0x2130a3;return _0x2b478d;})[_0x4607('0x23')](respondWithFilteredResult(_0x5c84f8,_0x2d38be))[_0x4607('0x44')](handleError(_0x5c84f8,null));};exports[_0x4607('0x45')]=function(_0x14dfd9,_0x328b8d){var _0x8ba808={'raw':!![],'where':{'id':_0x14dfd9[_0x4607('0x46')]['id']}},_0xdf53c9={};_0xdf53c9['model']=_[_0x4607('0x2f')](db[_0x4607('0x3f')]['rawAttributes']);_0xdf53c9[_0x4607('0x2e')]=_[_0x4607('0x2f')](_0x14dfd9['query']);_0xdf53c9['filters']=_['intersection'](_0xdf53c9['model'],_0xdf53c9[_0x4607('0x2e')]);_0x8ba808[_0x4607('0x33')]=_['intersection'](_0xdf53c9[_0x4607('0x32')],qs[_0x4607('0x34')](_0x14dfd9[_0x4607('0x2e')]['fields']));_0x8ba808[_0x4607('0x33')]=_0x8ba808[_0x4607('0x33')][_0x4607('0x35')]?_0x8ba808['attributes']:_0xdf53c9['model'];if(_0x14dfd9[_0x4607('0x2e')][_0x4607('0x40')]){_0x8ba808[_0x4607('0x41')]=[{'all':!![]}];}_0x8ba808=_[_0x4607('0x3d')]({},_0x8ba808,_0x14dfd9[_0x4607('0x47')]);return db[_0x4607('0x3f')]['find'](_0x8ba808)['then'](handleEntityNotFound(_0x328b8d,null))[_0x4607('0x23')](respondWithResult(_0x328b8d,null))['catch'](handleError(_0x328b8d,null));};exports[_0x4607('0x48')]=function(_0x3a424a,_0x59b932){return db['CmHopperHistory'][_0x4607('0x48')](_0x3a424a[_0x4607('0x49')],{})['then'](respondWithResult(_0x59b932,0xc9))[_0x4607('0x44')](handleError(_0x59b932,null));};exports[_0x4607('0x4a')]=function(_0x2f1cbc,_0x29fe64){return db['CmHopperHistory'][_0x4607('0x4a')]()[_0x4607('0x23')](respondWithResult(_0x29fe64,null))[_0x4607('0x44')](handleError(_0x29fe64,null));};exports[_0x4607('0x22')]=function(_0x59ff1d,_0x168392){if(_0x59ff1d['body']['uniqueid']){delete _0x59ff1d[_0x4607('0x49')][_0x4607('0x4b')];}return db[_0x4607('0x3f')][_0x4607('0x4c')]({'where':{'uniqueid':_0x59ff1d['params']['id']}})[_0x4607('0x23')](handleEntityNotFound(_0x168392,null))[_0x4607('0x23')](saveUpdates(_0x59ff1d[_0x4607('0x49')],null))['then'](respondWithResult(_0x168392,null))[_0x4607('0x44')](handleError(_0x168392,null));}; \ No newline at end of file +var _0x4671=['merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','end','error','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where'];(function(_0x164cb4,_0x40ea97){var _0x1bbe7e=function(_0x562197){while(--_0x562197){_0x164cb4['push'](_0x164cb4['shift']());}};_0x1bbe7e(++_0x40ea97);}(_0x4671,0x1c9));var _0x1467=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4671[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1467('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1467('0x1'));var rp=require(_0x1467('0x2'));var moment=require(_0x1467('0x3'));var BPromise=require(_0x1467('0x4'));var Mustache=require(_0x1467('0x5'));var util=require('util');var path=require(_0x1467('0x6'));var sox=require(_0x1467('0x7'));var csv=require('to-csv');var ejs=require(_0x1467('0x8'));var fs=require('fs');var fs_extra=require(_0x1467('0x9'));var _=require(_0x1467('0xa'));var squel=require(_0x1467('0xb'));var crypto=require(_0x1467('0xc'));var jsforce=require(_0x1467('0xd'));var deskjs=require(_0x1467('0xe'));var toCsv=require(_0x1467('0xf'));var querystring=require('querystring');var Papa=require(_0x1467('0x10'));var Redis=require('ioredis');var authService=require(_0x1467('0x11'));var qs=require(_0x1467('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1467('0x13'))('api');var utils=require(_0x1467('0x14'));var config=require(_0x1467('0x15'));var licenseUtil=require(_0x1467('0x16'));var db=require(_0x1467('0x17'))['db'];function respondWithStatusCode(_0x3c096c,_0x24a133){_0x24a133=_0x24a133||0xcc;return function(_0x587039){if(_0x587039){return _0x3c096c[_0x1467('0x18')](_0x24a133);}return _0x3c096c[_0x1467('0x19')](_0x24a133)['end']();};}function respondWithResult(_0x20aea0,_0x3c2f14){_0x3c2f14=_0x3c2f14||0xc8;return function(_0x3088bf){if(_0x3088bf){return _0x20aea0[_0x1467('0x19')](_0x3c2f14)[_0x1467('0x1a')](_0x3088bf);}};}function respondWithFilteredResult(_0x14921d,_0x4c357e){return function(_0x322802){if(_0x322802){var _0xd2529b=typeof _0x4c357e[_0x1467('0x1b')]===_0x1467('0x1c')&&typeof _0x4c357e[_0x1467('0x1d')]===_0x1467('0x1c');var _0x1f6319=_0x322802[_0x1467('0x1e')];var _0x3651dc=_0xd2529b?0x0:_0x4c357e[_0x1467('0x1b')];var _0x48138e=_0xd2529b?_0x322802['count']:_0x4c357e[_0x1467('0x1b')]+_0x4c357e['limit'];var _0x439e3b;if(_0x48138e>=_0x1f6319){_0x48138e=_0x1f6319;_0x439e3b=0xc8;}else{_0x439e3b=0xce;}_0x14921d[_0x1467('0x19')](_0x439e3b);return _0x14921d['set'](_0x1467('0x1f'),_0x3651dc+'-'+_0x48138e+'/'+_0x1f6319)[_0x1467('0x1a')](_0x322802);}return null;};}function patchUpdates(_0x1138d8){return function(_0x4b4a40){try{jsonpatch['apply'](_0x4b4a40,_0x1138d8,!![]);}catch(_0x51caf7){return BPromise[_0x1467('0x20')](_0x51caf7);}return _0x4b4a40[_0x1467('0x21')]();};}function saveUpdates(_0x20ceff,_0x4b054b){return function(_0x418625){if(_0x418625){return _0x418625[_0x1467('0x22')](_0x20ceff)[_0x1467('0x23')](function(_0x31e6c4){return _0x31e6c4;});}return null;};}function removeEntity(_0x34d39f,_0x3737f6){return function(_0x4e700d){if(_0x4e700d){return _0x4e700d['destroy']()[_0x1467('0x23')](function(){_0x34d39f[_0x1467('0x19')](0xcc)[_0x1467('0x24')]();});}};}function handleEntityNotFound(_0x34655c,_0x4f549e){return function(_0x5dcbde){if(!_0x5dcbde){_0x34655c['sendStatus'](0x194);}return _0x5dcbde;};}function handleError(_0x583f20,_0x1fe098){_0x1fe098=_0x1fe098||0x1f4;return function(_0x15a3eb){logger[_0x1467('0x25')](_0x15a3eb[_0x1467('0x26')]);if(_0x15a3eb[_0x1467('0x27')]){delete _0x15a3eb['name'];}_0x583f20['status'](_0x1fe098)[_0x1467('0x28')](_0x15a3eb);};}exports[_0x1467('0x29')]=function(_0x23b06b,_0x2cbd22){var _0x410af7={},_0x475b64={},_0x2bdd11={'count':0x0,'rows':[]};var _0x256da1=_['map'](db[_0x1467('0x2a')][_0x1467('0x2b')],function(_0x71f1f1){return{'name':_0x71f1f1[_0x1467('0x2c')],'type':_0x71f1f1[_0x1467('0x2d')][_0x1467('0x2e')]};});_0x475b64[_0x1467('0x2f')]=_[_0x1467('0x30')](_0x256da1,_0x1467('0x27'));_0x475b64[_0x1467('0x31')]=_[_0x1467('0x32')](_0x23b06b[_0x1467('0x31')]);_0x475b64[_0x1467('0x33')]=_[_0x1467('0x34')](_0x475b64[_0x1467('0x2f')],_0x475b64[_0x1467('0x31')]);_0x410af7[_0x1467('0x35')]=_[_0x1467('0x34')](_0x475b64[_0x1467('0x2f')],qs[_0x1467('0x36')](_0x23b06b['query']['fields']));_0x410af7[_0x1467('0x35')]=_0x410af7['attributes'][_0x1467('0x37')]?_0x410af7[_0x1467('0x35')]:_0x475b64[_0x1467('0x2f')];if(!_0x23b06b[_0x1467('0x31')]['hasOwnProperty'](_0x1467('0x38'))){_0x410af7[_0x1467('0x1d')]=qs[_0x1467('0x1d')](_0x23b06b[_0x1467('0x31')]['limit']);_0x410af7[_0x1467('0x1b')]=qs[_0x1467('0x1b')](_0x23b06b[_0x1467('0x31')][_0x1467('0x1b')]);}_0x410af7[_0x1467('0x39')]=qs[_0x1467('0x3a')](_0x23b06b[_0x1467('0x31')]['sort']);_0x410af7['where']=qs[_0x1467('0x33')](_['pick'](_0x23b06b[_0x1467('0x31')],_0x475b64[_0x1467('0x33')]),_0x256da1);if(_0x23b06b['query'][_0x1467('0x3b')]){_0x410af7[_0x1467('0x3c')]=_[_0x1467('0x3d')](_0x410af7[_0x1467('0x3c')],{'$or':_['map'](_0x256da1,function(_0x38c103){if(_0x38c103['type']!==_0x1467('0x3e')){var _0x844657={};_0x844657[_0x38c103[_0x1467('0x27')]]={'$like':'%'+_0x23b06b[_0x1467('0x31')]['filter']+'%'};return _0x844657;}})});}_0x410af7=_[_0x1467('0x3d')]({},_0x410af7,_0x23b06b[_0x1467('0x3f')]);var _0x3bd2e1={'where':_0x410af7['where']};return db['CmHopperHistory'][_0x1467('0x1e')](_0x3bd2e1)['then'](function(_0x56d123){_0x2bdd11[_0x1467('0x1e')]=_0x56d123;if(_0x23b06b['query'][_0x1467('0x40')]){_0x410af7[_0x1467('0x41')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x410af7);})[_0x1467('0x23')](function(_0x4a43cb){_0x2bdd11['rows']=_0x4a43cb;return _0x2bdd11;})[_0x1467('0x23')](respondWithFilteredResult(_0x2cbd22,_0x410af7))[_0x1467('0x42')](handleError(_0x2cbd22,null));};exports[_0x1467('0x43')]=function(_0x40cc40,_0x318989){var _0x1db13f={'raw':!![],'where':{'id':_0x40cc40[_0x1467('0x44')]['id']}},_0x87d8b8={};_0x87d8b8[_0x1467('0x2f')]=_[_0x1467('0x32')](db['CmHopperHistory']['rawAttributes']);_0x87d8b8[_0x1467('0x31')]=_[_0x1467('0x32')](_0x40cc40[_0x1467('0x31')]);_0x87d8b8[_0x1467('0x33')]=_['intersection'](_0x87d8b8[_0x1467('0x2f')],_0x87d8b8[_0x1467('0x31')]);_0x1db13f['attributes']=_[_0x1467('0x34')](_0x87d8b8[_0x1467('0x2f')],qs[_0x1467('0x36')](_0x40cc40[_0x1467('0x31')][_0x1467('0x36')]));_0x1db13f[_0x1467('0x35')]=_0x1db13f['attributes'][_0x1467('0x37')]?_0x1db13f[_0x1467('0x35')]:_0x87d8b8[_0x1467('0x2f')];if(_0x40cc40['query']['includeAll']){_0x1db13f[_0x1467('0x41')]=[{'all':!![]}];}_0x1db13f=_[_0x1467('0x3d')]({},_0x1db13f,_0x40cc40['options']);return db['CmHopperHistory'][_0x1467('0x45')](_0x1db13f)[_0x1467('0x23')](handleEntityNotFound(_0x318989,null))['then'](respondWithResult(_0x318989,null))[_0x1467('0x42')](handleError(_0x318989,null));};exports[_0x1467('0x46')]=function(_0x34d4c6,_0x341a29){return db[_0x1467('0x2a')][_0x1467('0x46')](_0x34d4c6[_0x1467('0x47')],{})[_0x1467('0x23')](respondWithResult(_0x341a29,0xc9))[_0x1467('0x42')](handleError(_0x341a29,null));};exports[_0x1467('0x48')]=function(_0x169216,_0x1a5d4b){return db[_0x1467('0x2a')][_0x1467('0x48')]()['then'](respondWithResult(_0x1a5d4b,null))[_0x1467('0x42')](handleError(_0x1a5d4b,null));};exports[_0x1467('0x22')]=function(_0xd612af,_0x52f363){if(_0xd612af['body'][_0x1467('0x49')]){delete _0xd612af[_0x1467('0x47')][_0x1467('0x49')];}return db['CmHopperHistory'][_0x1467('0x45')]({'where':{'uniqueid':_0xd612af['params']['id']}})[_0x1467('0x23')](handleEntityNotFound(_0x52f363,null))[_0x1467('0x23')](saveUpdates(_0xd612af[_0x1467('0x47')],null))[_0x1467('0x23')](respondWithResult(_0x52f363,null))[_0x1467('0x42')](handleError(_0x52f363,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 90872ee..604a5bd 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 _0xf562=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime'];(function(_0x25d8c8,_0x419069){var _0x412caf=function(_0x3e031e){while(--_0x3e031e){_0x25d8c8['push'](_0x25d8c8['shift']());}};_0x412caf(++_0x419069);}(_0xf562,0x100));var _0x2f56=function(_0x2e654d,_0x4b6a1b){_0x2e654d=_0x2e654d-0x0;var _0x32925d=_0xf562[_0x2e654d];return _0x32925d;};'use strict';var _=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var logger=require(_0x2f56('0x2'))(_0x2f56('0x3'));var moment=require(_0x2f56('0x4'));var BPromise=require(_0x2f56('0x5'));var rp=require(_0x2f56('0x6'));var fs=require('fs');var path=require(_0x2f56('0x7'));var rimraf=require(_0x2f56('0x8'));var config=require('../../config/environment');var attributes=require(_0x2f56('0x9'));module['exports']=function(_0x14436b,_0x5b3784){return _0x14436b[_0x2f56('0xa')](_0x2f56('0xb'),attributes,{'tableName':_0x2f56('0xc'),'paranoid':![],'indexes':[{'name':_0x2f56('0xd'),'fields':[_0x2f56('0xd')]},{'name':_0x2f56('0xe'),'fields':[_0x2f56('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf9e5=['request-promise','rimraf','../../config/environment','exports','define','CmHopperHistory','endtime','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x211182,_0x551948){var _0x33f194=function(_0x355896){while(--_0x355896){_0x211182['push'](_0x211182['shift']());}};_0x33f194(++_0x551948);}(_0xf9e5,0x89));var _0x5f9e=function(_0x51f74c,_0x294369){_0x51f74c=_0x51f74c-0x0;var _0x13d4de=_0xf9e5[_0x51f74c];return _0x13d4de;};'use strict';var _=require(_0x5f9e('0x0'));var util=require(_0x5f9e('0x1'));var logger=require(_0x5f9e('0x2'))(_0x5f9e('0x3'));var moment=require(_0x5f9e('0x4'));var BPromise=require(_0x5f9e('0x5'));var rp=require(_0x5f9e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f9e('0x7'));var config=require(_0x5f9e('0x8'));var attributes=require('./cmHopperHistory.attributes');module[_0x5f9e('0x9')]=function(_0x4c3209,_0x5d1f10){return _0x4c3209[_0x5f9e('0xa')](_0x5f9e('0xb'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x5f9e('0xc'),'fields':[_0x5f9e('0xc')]},{'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 6b43504..35930eb 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 _0xb028=['CmHopperHistory,\x20%s,\x20%s','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','debug','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','catch','GetCampaignHopperHistory','name','col','lodash','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x392ea6,_0x37f8f0){var _0x44a276=function(_0x3bc062){while(--_0x3bc062){_0x392ea6['push'](_0x392ea6['shift']());}};_0x44a276(++_0x37f8f0);}(_0xb028,0x72));var _0x8b02=function(_0x33f3a9,_0x4ffd00){_0x33f3a9=_0x33f3a9-0x0;var _0x5677f0=_0xb028[_0x33f3a9];return _0x5677f0;};'use strict';var _=require(_0x8b02('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8b02('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b02('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b02('0x3'));var logger=require(_0x8b02('0x4'))('rpc');var config=require(_0x8b02('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8b02('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49e1b7,_0x5c0dc0,_0x206e94){return new BPromise(function(_0x449c2e,_0x33af49){return client[_0x8b02('0x7')](_0x49e1b7,_0x206e94)[_0x8b02('0x8')](function(_0x3ada4b){logger[_0x8b02('0x9')]('CmHopperHistory,\x20%s,\x20%s',_0x5c0dc0,'request\x20sent');logger['debug'](_0x8b02('0xa'),_0x5c0dc0,_0x8b02('0xb'),JSON[_0x8b02('0xc')](_0x3ada4b));if(_0x3ada4b[_0x8b02('0xd')]){if(_0x3ada4b[_0x8b02('0xd')]['code']===0x1f4){logger['error'](_0x8b02('0xe'),_0x5c0dc0,_0x3ada4b['error']['message']);return _0x33af49(_0x3ada4b[_0x8b02('0xd')]['message']);}logger[_0x8b02('0xd')](_0x8b02('0xe'),_0x5c0dc0,_0x3ada4b[_0x8b02('0xd')][_0x8b02('0xf')]);return _0x449c2e(_0x3ada4b[_0x8b02('0xd')][_0x8b02('0xf')]);}else{logger[_0x8b02('0x9')](_0x8b02('0xe'),_0x5c0dc0,_0x8b02('0xb'));_0x449c2e(_0x3ada4b[_0x8b02('0x10')][_0x8b02('0xf')]);}})['catch'](function(_0x306b86){logger[_0x8b02('0xd')](_0x8b02('0xe'),_0x5c0dc0,_0x306b86);_0x33af49(_0x306b86);});});}exports[_0x8b02('0x11')]=function(_0x1a62a3){var _0x6bc07d=this;return new Promise(function(_0x54ac6b,_0x2127b7){return db[_0x8b02('0x12')][_0x8b02('0x13')](_0x1a62a3[_0x8b02('0x14')],{'raw':_0x1a62a3[_0x8b02('0x15')]?_0x1a62a3[_0x8b02('0x15')][_0x8b02('0x16')]===undefined?!![]:![]:!![]})[_0x8b02('0x8')](function(_0x492e59){logger[_0x8b02('0x9')]('CreateCmHopperHistory',_0x1a62a3);logger['debug'](_0x8b02('0x11'),_0x1a62a3,JSON[_0x8b02('0xc')](_0x492e59));_0x54ac6b(_0x492e59);})['catch'](function(_0x5cd163){logger['error'](_0x8b02('0x11'),_0x5cd163[_0x8b02('0xf')],_0x1a62a3);_0x2127b7(_0x6bc07d['error'](0x1f4,_0x5cd163['message']));});});};exports['AvgHandleTime']=function(_0x271907){var _0x3224a6=this;return new Promise(function(_0x5e5165,_0x14ceb4){return db[_0x8b02('0x12')][_0x8b02('0x17')]({'raw':_0x271907['options']?_0x271907[_0x8b02('0x15')][_0x8b02('0x16')]===undefined?!![]:![]:!![],'where':_0x271907[_0x8b02('0x15')]?_0x271907[_0x8b02('0x15')][_0x8b02('0x18')]||null:null,'attributes':[[db[_0x8b02('0x19')]['fn'](_0x8b02('0x1a'),db[_0x8b02('0x19')]['col']('id')),_0x8b02('0x1b')],[db[_0x8b02('0x19')]['fn'](_0x8b02('0x1a'),db['sequelize']['fn']('IF',db['sequelize'][_0x8b02('0x1c')](_0x8b02('0x1d')))),_0x8b02('0x1e')],[db['sequelize']['fn'](_0x8b02('0x1a'),db[_0x8b02('0x19')]['fn']('IF',db[_0x8b02('0x19')][_0x8b02('0x1c')](_0x8b02('0x1f')))),_0x8b02('0x20')],[db['sequelize']['fn'](_0x8b02('0x1a'),db[_0x8b02('0x19')]['fn']('IF',db['sequelize'][_0x8b02('0x1c')]('`state`\x20=\x2011,\x201,\x20null'))),_0x8b02('0x21')],[db['sequelize']['fn']('AVG',db['sequelize']['fn']('IF',db[_0x8b02('0x19')]['literal'](_0x8b02('0x22')))),_0x8b02('0x23')],[db['sequelize']['fn'](_0x8b02('0x24'),db[_0x8b02('0x19')]['fn']('IF',db['sequelize'][_0x8b02('0x1c')](_0x8b02('0x25')))),_0x8b02('0x26')]]})['then'](function(_0x38a09b){logger['info']('AvgHandleTime',_0x271907);logger[_0x8b02('0x27')](_0x8b02('0x28'),_0x271907,JSON['stringify'](_0x38a09b));_0x5e5165(_0x38a09b);})['catch'](function(_0x461bc0){logger['error']('AvgHandleTime',_0x461bc0[_0x8b02('0xf')],_0x271907);_0x14ceb4(_0x3224a6[_0x8b02('0xd')](0x1f4,_0x461bc0[_0x8b02('0xf')]));});});};exports[_0x8b02('0x29')]=function(_0x3a9f13){var _0x776660=this;return new Promise(function(_0x497855,_0x2404c5){return db['CmHopperHistory'][_0x8b02('0x17')]({'raw':_0x3a9f13['options']?_0x3a9f13[_0x8b02('0x15')][_0x8b02('0x16')]===undefined?!![]:![]:!![],'where':_0x3a9f13['options']?_0x3a9f13[_0x8b02('0x15')][_0x8b02('0x18')]||null:null,'attributes':[[_0x8b02('0x2a'),'name'],[db[_0x8b02('0x19')]['fn'](_0x8b02('0x1a'),db[_0x8b02('0x19')]['fn']('IF',db[_0x8b02('0x19')][_0x8b02('0x1c')](_0x8b02('0x2b')))),'outboundNoSuchCallsDay'],[db[_0x8b02('0x19')]['fn'](_0x8b02('0x1a'),db[_0x8b02('0x19')]['fn']('IF',db[_0x8b02('0x19')][_0x8b02('0x1c')](_0x8b02('0x2c')))),_0x8b02('0x2d')],[db[_0x8b02('0x19')]['fn'](_0x8b02('0x1a'),db[_0x8b02('0x19')]['fn']('IF',db[_0x8b02('0x19')][_0x8b02('0x1c')]('`state`\x20=\x204,\x201,\x20null'))),_0x8b02('0x2e')],[db[_0x8b02('0x19')]['fn'](_0x8b02('0x1a'),db[_0x8b02('0x19')]['fn']('IF',db[_0x8b02('0x19')][_0x8b02('0x1c')](_0x8b02('0x2f')))),_0x8b02('0x30')],[db[_0x8b02('0x19')]['fn'](_0x8b02('0x1a'),db['sequelize']['fn']('IF',db[_0x8b02('0x19')]['literal'](_0x8b02('0x31')))),_0x8b02('0x32')],[db[_0x8b02('0x19')]['fn']('COUNT',db[_0x8b02('0x19')]['fn']('IF',db['sequelize'][_0x8b02('0x1c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8b02('0x33')],[db['sequelize']['fn'](_0x8b02('0x1a'),db[_0x8b02('0x19')]['fn']('IF',db[_0x8b02('0x19')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x8b02('0x34')],[db[_0x8b02('0x19')]['fn']('COUNT',db[_0x8b02('0x19')]['fn']('IF',db[_0x8b02('0x19')]['literal'](_0x8b02('0x35')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x8b02('0x1a'),db[_0x8b02('0x19')]['fn']('IF',db[_0x8b02('0x19')][_0x8b02('0x1c')](_0x8b02('0x36')))),'outboundBlacklistCallsDay'],[db[_0x8b02('0x19')]['fn'](_0x8b02('0x1a'),db[_0x8b02('0x19')]['fn']('IF',db['sequelize'][_0x8b02('0x1c')](_0x8b02('0x37')))),_0x8b02('0x38')],[db[_0x8b02('0x19')]['fn']('COUNT',db[_0x8b02('0x19')]['fn']('IF',db[_0x8b02('0x19')][_0x8b02('0x1c')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x8b02('0x19')]['fn']('COUNT',db[_0x8b02('0x19')]['fn']('IF',db[_0x8b02('0x19')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0x8b02('0x39')],[db['sequelize']['fn'](_0x8b02('0x1a'),db[_0x8b02('0x19')]['fn']('IF',db[_0x8b02('0x19')][_0x8b02('0x1c')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x8b02('0x19')]['fn'](_0x8b02('0x1a'),db[_0x8b02('0x19')]['fn']('IF',db[_0x8b02('0x19')]['literal'](_0x8b02('0x3a')))),_0x8b02('0x3b')]],'group':[_0x8b02('0x2a')]})['then'](function(_0x52b267){logger['info'](_0x8b02('0x29'),_0x3a9f13);logger['debug']('GetVoiceQueueHopperHistory',_0x3a9f13,JSON[_0x8b02('0xc')](_0x52b267));_0x497855(_0x52b267);})[_0x8b02('0x3c')](function(_0x4e9983){logger[_0x8b02('0xd')]('GetVoiceQueueHopperHistory',_0x4e9983[_0x8b02('0xf')],_0x3a9f13);_0x2404c5(_0x776660['error'](0x1f4,_0x4e9983[_0x8b02('0xf')]));});});};exports[_0x8b02('0x3d')]=function(_0x554c37){var _0x575845=this;return new Promise(function(_0x57a9e1,_0x1ad825){return db['CmHopperHistory'][_0x8b02('0x17')]({'raw':_0x554c37[_0x8b02('0x15')]?_0x554c37['options'][_0x8b02('0x16')]===undefined?!![]:![]:!![],'where':_0x554c37[_0x8b02('0x15')]?_0x554c37[_0x8b02('0x15')][_0x8b02('0x18')]||null:null,'attributes':[['campaign',_0x8b02('0x3e')],[db[_0x8b02('0x19')]['fn'](_0x8b02('0x1a'),db[_0x8b02('0x19')][_0x8b02('0x3f')]('id')),'ivrTotalCallsDays'],[db[_0x8b02('0x19')]['fn'](_0x8b02('0x1a'),db[_0x8b02('0x19')]['fn']('IF',db[_0x8b02('0x19')][_0x8b02('0x1c')](_0x8b02('0x1d')))),'ivrAnswerCallsDay']],'group':[_0x8b02('0x2a')]})[_0x8b02('0x8')](function(_0x1f164f){logger[_0x8b02('0x9')]('GetCampaignHopperHistory',_0x554c37);logger[_0x8b02('0x27')](_0x8b02('0x3d'),_0x554c37,JSON[_0x8b02('0xc')](_0x1f164f));_0x57a9e1(_0x1f164f);})['catch'](function(_0x8a0f98){logger[_0x8b02('0xd')](_0x8b02('0x3d'),_0x8a0f98[_0x8b02('0xf')],_0x554c37);_0x1ad825(_0x575845[_0x8b02('0xd')](0x1f4,_0x8a0f98[_0x8b02('0xf')]));});});}; \ No newline at end of file +var _0x9bb4=['request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','then','findAll','raw','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','AvgHandleTime','stringify','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','debug','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','CmHopperHistory,\x20%s,\x20%s'];(function(_0x421c77,_0x31e9b9){var _0x1296f3=function(_0x239d4c){while(--_0x239d4c){_0x421c77['push'](_0x421c77['shift']());}};_0x1296f3(++_0x31e9b9);}(_0x9bb4,0xd5));var _0x49bb=function(_0x4e7ea8,_0x2e208c){_0x4e7ea8=_0x4e7ea8-0x0;var _0x5d9cd1=_0x9bb4[_0x4e7ea8];return _0x5d9cd1;};'use strict';var _=require(_0x49bb('0x0'));var util=require(_0x49bb('0x1'));var moment=require(_0x49bb('0x2'));var BPromise=require(_0x49bb('0x3'));var rs=require(_0x49bb('0x4'));var fs=require('fs');var Redis=require(_0x49bb('0x5'));var db=require(_0x49bb('0x6'))['db'];var utils=require(_0x49bb('0x7'));var logger=require(_0x49bb('0x8'))('rpc');var config=require(_0x49bb('0x9'));var jayson=require(_0x49bb('0xa'));var client=jayson[_0x49bb('0xb')][_0x49bb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d603d,_0x15c24c,_0x353853){return new BPromise(function(_0x1a4094,_0x2967d4){return client[_0x49bb('0xd')](_0x4d603d,_0x353853)['then'](function(_0x6ba4a2){logger['info'](_0x49bb('0xe'),_0x15c24c,_0x49bb('0xf'));logger['debug'](_0x49bb('0x10'),_0x15c24c,'request\x20sent',JSON['stringify'](_0x6ba4a2));if(_0x6ba4a2[_0x49bb('0x11')]){if(_0x6ba4a2['error'][_0x49bb('0x12')]===0x1f4){logger[_0x49bb('0x11')](_0x49bb('0xe'),_0x15c24c,_0x6ba4a2[_0x49bb('0x11')][_0x49bb('0x13')]);return _0x2967d4(_0x6ba4a2[_0x49bb('0x11')][_0x49bb('0x13')]);}logger[_0x49bb('0x11')](_0x49bb('0xe'),_0x15c24c,_0x6ba4a2['error'][_0x49bb('0x13')]);return _0x1a4094(_0x6ba4a2['error'][_0x49bb('0x13')]);}else{logger[_0x49bb('0x14')](_0x49bb('0xe'),_0x15c24c,_0x49bb('0xf'));_0x1a4094(_0x6ba4a2[_0x49bb('0x15')][_0x49bb('0x13')]);}})[_0x49bb('0x16')](function(_0x11bc5f){logger['error'](_0x49bb('0xe'),_0x15c24c,_0x11bc5f);_0x2967d4(_0x11bc5f);});});}exports[_0x49bb('0x17')]=function(_0x5b45c0){var _0x2cb8de=this;return new Promise(function(_0x3d41f2,_0x554fbb){return db[_0x49bb('0x18')][_0x49bb('0x19')](_0x5b45c0['body'],{'raw':_0x5b45c0[_0x49bb('0x1a')]?_0x5b45c0[_0x49bb('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x49bb('0x1b')](function(_0x5387ed){logger[_0x49bb('0x14')]('CreateCmHopperHistory',_0x5b45c0);logger['debug'](_0x49bb('0x17'),_0x5b45c0,JSON['stringify'](_0x5387ed));_0x3d41f2(_0x5387ed);})['catch'](function(_0x16b8fa){logger[_0x49bb('0x11')](_0x49bb('0x17'),_0x16b8fa[_0x49bb('0x13')],_0x5b45c0);_0x554fbb(_0x2cb8de['error'](0x1f4,_0x16b8fa['message']));});});};exports['AvgHandleTime']=function(_0x4eae24){var _0x5f5625=this;return new Promise(function(_0xe9938a,_0x570847){return db['CmHopperHistory'][_0x49bb('0x1c')]({'raw':_0x4eae24[_0x49bb('0x1a')]?_0x4eae24[_0x49bb('0x1a')][_0x49bb('0x1d')]===undefined?!![]:![]:!![],'where':_0x4eae24[_0x49bb('0x1a')]?_0x4eae24['options'][_0x49bb('0x1e')]||null:null,'attributes':[[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['col']('id')),_0x49bb('0x21')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db['sequelize'][_0x49bb('0x22')](_0x49bb('0x23')))),_0x49bb('0x24')],[db[_0x49bb('0x1f')]['fn']('COUNT',db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')]['literal'](_0x49bb('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db['sequelize']['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')]('`state`\x20=\x2011,\x201,\x20null'))),_0x49bb('0x26')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x27'),db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')](_0x49bb('0x28')))),_0x49bb('0x29')],[db['sequelize']['fn'](_0x49bb('0x27'),db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x49bb('0x2a')]]})['then'](function(_0x182aa0){logger['info'](_0x49bb('0x2b'),_0x4eae24);logger['debug'](_0x49bb('0x2b'),_0x4eae24,JSON[_0x49bb('0x2c')](_0x182aa0));_0xe9938a(_0x182aa0);})['catch'](function(_0x56139c){logger['error']('AvgHandleTime',_0x56139c['message'],_0x4eae24);_0x570847(_0x5f5625[_0x49bb('0x11')](0x1f4,_0x56139c[_0x49bb('0x13')]));});});};exports[_0x49bb('0x2d')]=function(_0x2b9680){var _0x203e6d=this;return new Promise(function(_0x2784a9,_0x1025c5){return db['CmHopperHistory']['findAll']({'raw':_0x2b9680[_0x49bb('0x1a')]?_0x2b9680[_0x49bb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2b9680[_0x49bb('0x1a')]?_0x2b9680[_0x49bb('0x1a')]['where']||null:null,'attributes':[['campaign',_0x49bb('0x2e')],[db['sequelize']['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')](_0x49bb('0x2f')))),_0x49bb('0x30')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')](_0x49bb('0x31')))),_0x49bb('0x32')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')](_0x49bb('0x23')))),_0x49bb('0x33')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db['sequelize'][_0x49bb('0x22')]('`state`\x20=\x205,\x201,\x20null'))),_0x49bb('0x34')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')]['literal'](_0x49bb('0x35')))),_0x49bb('0x36')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db['sequelize'][_0x49bb('0x22')](_0x49bb('0x37')))),_0x49bb('0x38')],[db[_0x49bb('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')](_0x49bb('0x39')))),_0x49bb('0x3a')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db['sequelize']['fn']('IF',db[_0x49bb('0x1f')]['literal'](_0x49bb('0x3b')))),_0x49bb('0x3c')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x49bb('0x22')](_0x49bb('0x3d')))),_0x49bb('0x3e')],[db[_0x49bb('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')](_0x49bb('0x3f')))),_0x49bb('0x40')],[db['sequelize']['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db['sequelize'][_0x49bb('0x22')](_0x49bb('0x41')))),_0x49bb('0x42')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db['sequelize']['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')](_0x49bb('0x43')))),'outboundAnswerAgiCallsDay'],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')]('`state`\x20=\x2020,\x201,\x20null'))),_0x49bb('0x42')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')](_0x49bb('0x44')))),_0x49bb('0x45')]],'group':[_0x49bb('0x46')]})[_0x49bb('0x1b')](function(_0x2ead0f){logger['info'](_0x49bb('0x2d'),_0x2b9680);logger[_0x49bb('0x47')](_0x49bb('0x2d'),_0x2b9680,JSON[_0x49bb('0x2c')](_0x2ead0f));_0x2784a9(_0x2ead0f);})[_0x49bb('0x16')](function(_0x3fc2f1){logger[_0x49bb('0x11')](_0x49bb('0x2d'),_0x3fc2f1[_0x49bb('0x13')],_0x2b9680);_0x1025c5(_0x203e6d[_0x49bb('0x11')](0x1f4,_0x3fc2f1[_0x49bb('0x13')]));});});};exports[_0x49bb('0x48')]=function(_0x36ccc2){var _0x72569b=this;return new Promise(function(_0xec9667,_0x386bff){return db[_0x49bb('0x18')][_0x49bb('0x1c')]({'raw':_0x36ccc2[_0x49bb('0x1a')]?_0x36ccc2[_0x49bb('0x1a')][_0x49bb('0x1d')]===undefined?!![]:![]:!![],'where':_0x36ccc2[_0x49bb('0x1a')]?_0x36ccc2[_0x49bb('0x1a')]['where']||null:null,'attributes':[[_0x49bb('0x46'),_0x49bb('0x2e')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')][_0x49bb('0x49')]('id')),_0x49bb('0x4a')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x49bb('0x4b')]],'group':['campaign']})[_0x49bb('0x1b')](function(_0x2630a7){logger[_0x49bb('0x14')](_0x49bb('0x48'),_0x36ccc2);logger[_0x49bb('0x47')](_0x49bb('0x48'),_0x36ccc2,JSON[_0x49bb('0x2c')](_0x2630a7));_0xec9667(_0x2630a7);})[_0x49bb('0x16')](function(_0x5e5aad){logger[_0x49bb('0x11')](_0x49bb('0x48'),_0x5e5aad[_0x49bb('0x13')],_0x36ccc2);_0x386bff(_0x72569b[_0x49bb('0x11')](0x1f4,_0x5e5aad[_0x49bb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index e9cb539..f079845 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 _0xfb1a=['fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','exports','multer','util','connect-timeout','express','Router'];(function(_0x35d026,_0x520c4a){var _0x38f29d=function(_0x370f88){while(--_0x370f88){_0x35d026['push'](_0x35d026['shift']());}};_0x38f29d(++_0x520c4a);}(_0xfb1a,0xa6));var _0xafb1=function(_0x403192,_0x61d6a4){_0x403192=_0x403192-0x0;var _0x2fefba=_0xfb1a[_0x403192];return _0x2fefba;};'use strict';var multer=require(_0xafb1('0x0'));var util=require(_0xafb1('0x1'));var path=require('path');var timeout=require(_0xafb1('0x2'));var express=require(_0xafb1('0x3'));var router=express[_0xafb1('0x4')]();var fs_extra=require(_0xafb1('0x5'));var auth=require(_0xafb1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xafb1('0x7'));var controller=require(_0xafb1('0x8'));router[_0xafb1('0x9')]('/',auth[_0xafb1('0xa')](),controller[_0xafb1('0xb')]);router[_0xafb1('0x9')](_0xafb1('0xc'),auth['isAuthenticated'](),controller[_0xafb1('0xd')]);router[_0xafb1('0x9')](_0xafb1('0xe'),auth[_0xafb1('0xa')](),controller['show']);router[_0xafb1('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xafb1('0x10')](_0xafb1('0xe'),auth['isAuthenticated'](),controller[_0xafb1('0x11')]);module[_0xafb1('0x12')]=router; \ No newline at end of file +var _0x5b1c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','post','create','put','/:id','update','exports'];(function(_0x203569,_0x5cfc79){var _0x2c9216=function(_0x12d5dc){while(--_0x12d5dc){_0x203569['push'](_0x203569['shift']());}};_0x2c9216(++_0x5cfc79);}(_0x5b1c,0x118));var _0xc5b1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5b1c[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xc5b1('0x0'));var util=require(_0xc5b1('0x1'));var path=require(_0xc5b1('0x2'));var timeout=require(_0xc5b1('0x3'));var express=require(_0xc5b1('0x4'));var router=express[_0xc5b1('0x5')]();var fs_extra=require(_0xc5b1('0x6'));var auth=require(_0xc5b1('0x7'));var interaction=require(_0xc5b1('0x8'));var config=require('../../config/environment');var controller=require(_0xc5b1('0x9'));router[_0xc5b1('0xa')]('/',auth[_0xc5b1('0xb')](),controller[_0xc5b1('0xc')]);router[_0xc5b1('0xa')](_0xc5b1('0xd'),auth[_0xc5b1('0xb')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc5b1('0xe')]('/',auth[_0xc5b1('0xb')](),controller[_0xc5b1('0xf')]);router[_0xc5b1('0x10')](_0xc5b1('0x11'),auth['isAuthenticated'](),controller[_0xc5b1('0x12')]);module[_0xc5b1('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index cd0bb78..fe47059 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 _0x8a28=['name','sequelize','exports','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8a28,0xfd));var _0x88a2=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x8a28[_0x521929];return _0x632436;};'use strict';var Sequelize=require(_0x88a2('0x0'));module[_0x88a2('0x1')]={'name':{'type':Sequelize[_0x88a2('0x2')],'unique':_0x88a2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x88a2('0x2')]},'dialPrefix':{'type':Sequelize[_0x88a2('0x2')]}}; \ No newline at end of file +var _0x0763=['sequelize','STRING','name'];(function(_0x34d343,_0x1f5141){var _0x4f1e20=function(_0x35b8eb){while(--_0x35b8eb){_0x34d343['push'](_0x34d343['shift']());}};_0x4f1e20(++_0x1f5141);}(_0x0763,0x87));var _0x3076=function(_0x6978c0,_0x1f6765){_0x6978c0=_0x6978c0-0x0;var _0x361377=_0x0763[_0x6978c0];return _0x361377;};'use strict';var Sequelize=require(_0x3076('0x0'));module['exports']={'name':{'type':Sequelize[_0x3076('0x1')],'unique':_0x3076('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x3076('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index ef22649..4d66d7d 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 _0xd01a=['keys','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','ListId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','success','dataValues','errors','message','getContacts','concat','CustomFields','format','cf_%d','raw','getContactsCsv','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','getCustomFields','CmCustomField','addAgents','omit','spread','removeAgents','emit','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','fs-extra','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','json','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','end','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','filters','intersection','attributes','fields','query','length','model','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','include','rows','catch','params'];(function(_0x1ca9eb,_0x99a10b){var _0x2e284e=function(_0x1196a4){while(--_0x1196a4){_0x1ca9eb['push'](_0x1ca9eb['shift']());}};_0x2e284e(++_0x99a10b);}(_0xd01a,0x16a));var _0xad01=function(_0x33e37f,_0x17c971){_0x33e37f=_0x33e37f-0x0;var _0x6a5a6=_0xd01a[_0x33e37f];return _0x6a5a6;};'use strict';var emlformat=require(_0xad01('0x0'));var rimraf=require(_0xad01('0x1'));var zipdir=require(_0xad01('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad01('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xad01('0x4'));var util=require('util');var path=require(_0xad01('0x5'));var sox=require(_0xad01('0x6'));var csv=require(_0xad01('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad01('0x8'));var _=require('lodash');var squel=require(_0xad01('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xad01('0xa'));var Papa=require('papaparse');var Redis=require(_0xad01('0xb'));var authService=require(_0xad01('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xad01('0xd'));var hardwareService=require(_0xad01('0xe'));var logger=require(_0xad01('0xf'))(_0xad01('0x10'));var utils=require(_0xad01('0x11'));var config=require(_0xad01('0x12'));var licenseUtil=require(_0xad01('0x13'));var db=require(_0xad01('0x14'))['db'];config[_0xad01('0x15')]=_['defaults'](config[_0xad01('0x15')],{'host':_0xad01('0x16'),'port':0x18eb});var socket=require(_0xad01('0x17'))(new Redis(config['redis']));require(_0xad01('0x18'))[_0xad01('0x19')](socket);function respondWithStatusCode(_0x42cd10,_0x372e77){_0x372e77=_0x372e77||0xcc;return function(_0x5ac4d3){if(_0x5ac4d3){return _0x42cd10[_0xad01('0x1a')](_0x372e77);}return _0x42cd10['status'](_0x372e77)['end']();};}function respondWithResult(_0x329619,_0x4534e2){_0x4534e2=_0x4534e2||0xc8;return function(_0x204ca8){if(_0x204ca8){return _0x329619['status'](_0x4534e2)[_0xad01('0x1b')](_0x204ca8);}};}function respondWithFilteredResult(_0x266e9c,_0xc5033e){return function(_0x36ce02){if(_0x36ce02){var _0x470701=typeof _0xc5033e['offset']==='undefined'&&typeof _0xc5033e[_0xad01('0x1c')]===_0xad01('0x1d');var _0x78b74c=_0x36ce02[_0xad01('0x1e')];var _0x4a108a=_0x470701?0x0:_0xc5033e['offset'];var _0x450556=_0x470701?_0x36ce02['count']:_0xc5033e['offset']+_0xc5033e[_0xad01('0x1c')];var _0x197048;if(_0x450556>=_0x78b74c){_0x450556=_0x78b74c;_0x197048=0xc8;}else{_0x197048=0xce;}_0x266e9c[_0xad01('0x1f')](_0x197048);return _0x266e9c[_0xad01('0x20')](_0xad01('0x21'),_0x4a108a+'-'+_0x450556+'/'+_0x78b74c)[_0xad01('0x1b')](_0x36ce02);}return null;};}function patchUpdates(_0xca300b){return function(_0x20823f){try{jsonpatch[_0xad01('0x22')](_0x20823f,_0xca300b,!![]);}catch(_0x530028){return BPromise[_0xad01('0x23')](_0x530028);}return _0x20823f[_0xad01('0x24')]();};}function saveUpdates(_0x1c839f,_0xb9cd4){return function(_0x56329a){if(_0x56329a){return _0x56329a[_0xad01('0x25')](_0x1c839f)[_0xad01('0x26')](function(_0x18bf6c){return _0x18bf6c;});}return null;};}function removeEntity(_0x2c45c2,_0x2d65f6){return function(_0x4c20d6){if(_0x4c20d6){return _0x4c20d6[_0xad01('0x27')]()['then'](function(){var _0x2cf5bb=_0x4c20d6[_0xad01('0x28')]({'plain':!![]});var _0x45eed9=_0xad01('0x29');return db[_0xad01('0x2a')]['destroy']({'where':{'type':_0x45eed9,'resourceId':_0x2cf5bb['id']}})['then'](function(){return _0x4c20d6;});})[_0xad01('0x26')](function(){_0x2c45c2['status'](0xcc)[_0xad01('0x2b')]();});}};}function handleEntityNotFound(_0x41f169,_0x58cdbb){return function(_0x1b54a1){if(!_0x1b54a1){_0x41f169[_0xad01('0x1a')](0x194);}return _0x1b54a1;};}function handleError(_0x9ef904,_0x1e2961){_0x1e2961=_0x1e2961||0x1f4;return function(_0x19e69a){logger[_0xad01('0x2c')](_0x19e69a[_0xad01('0x2d')]);if(_0x19e69a[_0xad01('0x2e')]){delete _0x19e69a[_0xad01('0x2e')];}_0x9ef904[_0xad01('0x1f')](_0x1e2961)[_0xad01('0x2f')](_0x19e69a);};}exports[_0xad01('0x30')]=function(_0x4b48d9,_0x480331){var _0x3e8684={},_0x3f883a={},_0x454e97={'count':0x0,'rows':[]};var _0x310428=_[_0xad01('0x31')](db[_0xad01('0x32')][_0xad01('0x33')],function(_0x28aaba){return{'name':_0x28aaba[_0xad01('0x34')],'type':_0x28aaba[_0xad01('0x35')][_0xad01('0x36')]};});_0x3f883a['model']=_[_0xad01('0x31')](_0x310428,_0xad01('0x2e'));_0x3f883a['query']=_['keys'](_0x4b48d9['query']);_0x3f883a[_0xad01('0x37')]=_[_0xad01('0x38')](_0x3f883a['model'],_0x3f883a['query']);_0x3e8684[_0xad01('0x39')]=_[_0xad01('0x38')](_0x3f883a['model'],qs[_0xad01('0x3a')](_0x4b48d9[_0xad01('0x3b')][_0xad01('0x3a')]));_0x3e8684[_0xad01('0x39')]=_0x3e8684[_0xad01('0x39')][_0xad01('0x3c')]?_0x3e8684[_0xad01('0x39')]:_0x3f883a[_0xad01('0x3d')];if(!_0x4b48d9[_0xad01('0x3b')][_0xad01('0x3e')](_0xad01('0x3f'))){_0x3e8684['limit']=qs[_0xad01('0x1c')](_0x4b48d9[_0xad01('0x3b')][_0xad01('0x1c')]);_0x3e8684['offset']=qs[_0xad01('0x40')](_0x4b48d9[_0xad01('0x3b')][_0xad01('0x40')]);}_0x3e8684[_0xad01('0x41')]=qs[_0xad01('0x42')](_0x4b48d9['query']['sort']);_0x3e8684[_0xad01('0x43')]=qs['filters'](_[_0xad01('0x44')](_0x4b48d9[_0xad01('0x3b')],_0x3f883a[_0xad01('0x37')]),_0x310428);if(_0x4b48d9[_0xad01('0x3b')][_0xad01('0x45')]){_0x3e8684['where']=_[_0xad01('0x46')](_0x3e8684[_0xad01('0x43')],{'$or':_[_0xad01('0x31')](_0x310428,function(_0x44acfe){if(_0x44acfe['type']!=='VIRTUAL'){var _0x5c9a90={};_0x5c9a90[_0x44acfe['name']]={'$like':'%'+_0x4b48d9[_0xad01('0x3b')][_0xad01('0x45')]+'%'};return _0x5c9a90;}})});}_0x3e8684=_[_0xad01('0x46')]({},_0x3e8684,_0x4b48d9[_0xad01('0x47')]);var _0x1630b1={'where':_0x3e8684[_0xad01('0x43')]};return db['CmList'][_0xad01('0x1e')](_0x1630b1)[_0xad01('0x26')](function(_0x1c4b97){_0x454e97[_0xad01('0x1e')]=_0x1c4b97;if(_0x4b48d9[_0xad01('0x3b')]['includeAll']){_0x3e8684[_0xad01('0x48')]=[{'all':!![]}];}return db[_0xad01('0x32')]['findAll'](_0x3e8684);})['then'](function(_0x5a15de){_0x454e97[_0xad01('0x49')]=_0x5a15de;return _0x454e97;})[_0xad01('0x26')](respondWithFilteredResult(_0x480331,_0x3e8684))[_0xad01('0x4a')](handleError(_0x480331,null));};exports['show']=function(_0x169da0,_0x1d9983){var _0x10a8b4={'raw':![],'where':{'id':_0x169da0[_0xad01('0x4b')]['id']}},_0x45150e={};_0x45150e['model']=_[_0xad01('0x4c')](db[_0xad01('0x32')]['rawAttributes']);_0x45150e[_0xad01('0x3b')]=_[_0xad01('0x4c')](_0x169da0[_0xad01('0x3b')]);_0x45150e[_0xad01('0x37')]=_[_0xad01('0x38')](_0x45150e[_0xad01('0x3d')],_0x45150e[_0xad01('0x3b')]);_0x10a8b4['attributes']=_[_0xad01('0x38')](_0x45150e[_0xad01('0x3d')],qs[_0xad01('0x3a')](_0x169da0[_0xad01('0x3b')][_0xad01('0x3a')]));_0x10a8b4[_0xad01('0x39')]=_0x10a8b4[_0xad01('0x39')][_0xad01('0x3c')]?_0x10a8b4[_0xad01('0x39')]:_0x45150e[_0xad01('0x3d')];if(_0x169da0[_0xad01('0x3b')][_0xad01('0x4d')]){_0x10a8b4[_0xad01('0x48')]=[{'all':!![]}];}_0x10a8b4=_[_0xad01('0x46')]({},_0x10a8b4,_0x169da0[_0xad01('0x47')]);return db['CmList']['find'](_0x10a8b4)[_0xad01('0x26')](handleEntityNotFound(_0x1d9983,null))[_0xad01('0x26')](respondWithResult(_0x1d9983,null))[_0xad01('0x4a')](handleError(_0x1d9983,null));};exports[_0xad01('0x4e')]=function(_0x29f336,_0x44f788){return db[_0xad01('0x32')][_0xad01('0x4e')](_0x29f336['body'],{})[_0xad01('0x26')](function(_0x46c8bb){var _0x3e8d7b=_0x29f336[_0xad01('0x4f')][_0xad01('0x28')]({'plain':!![]});if(!_0x3e8d7b)throw new Error(_0xad01('0x50'));if(_0x3e8d7b[_0xad01('0x51')]===_0xad01('0x4f')){var _0x217aa8=_0x46c8bb[_0xad01('0x28')]({'plain':!![]});var _0x525302=_0xad01('0x29');return db[_0xad01('0x52')][_0xad01('0x53')]({'where':{'name':_0x525302,'userProfileId':_0x3e8d7b[_0xad01('0x54')]},'raw':!![]})[_0xad01('0x26')](function(_0x3ea112){if(_0x3ea112&&_0x3ea112[_0xad01('0x55')]===0x0){return db[_0xad01('0x2a')]['create']({'name':_0x217aa8[_0xad01('0x2e')],'resourceId':_0x217aa8['id'],'type':_0x3ea112[_0xad01('0x2e')],'sectionId':_0x3ea112['id']},{})[_0xad01('0x26')](function(){return _0x46c8bb;});}else{return _0x46c8bb;}})['catch'](function(_0x2f2605){logger[_0xad01('0x2c')](_0xad01('0x56'),_0x2f2605);throw _0x2f2605;});}return _0x46c8bb;})[_0xad01('0x26')](respondWithResult(_0x44f788,0xc9))[_0xad01('0x4a')](handleError(_0x44f788,null));};exports[_0xad01('0x25')]=function(_0x1e174d,_0x48b5f4){if(_0x1e174d['body']['id']){delete _0x1e174d[_0xad01('0x57')]['id'];}return db['CmList'][_0xad01('0x53')]({'where':{'id':_0x1e174d[_0xad01('0x4b')]['id']}})[_0xad01('0x26')](handleEntityNotFound(_0x48b5f4,null))[_0xad01('0x26')](saveUpdates(_0x1e174d[_0xad01('0x57')],null))[_0xad01('0x26')](respondWithResult(_0x48b5f4,null))[_0xad01('0x4a')](handleError(_0x48b5f4,null));};exports[_0xad01('0x27')]=function(_0x47a284,_0x1032e2){return db[_0xad01('0x32')][_0xad01('0x53')]({'where':{'id':_0x47a284[_0xad01('0x4b')]['id']}})[_0xad01('0x26')](handleEntityNotFound(_0x1032e2,null))[_0xad01('0x26')](removeEntity(_0x1032e2,null))[_0xad01('0x4a')](handleError(_0x1032e2,null));};exports[_0xad01('0x58')]=function(_0x2c5cdd,_0x3590f7){return db[_0xad01('0x32')][_0xad01('0x58')]()['then'](respondWithResult(_0x3590f7,null))[_0xad01('0x4a')](handleError(_0x3590f7,null));};exports['addDisposition']=function(_0xd82f68,_0x4748f7,_0x4002d5){if(_0xd82f68[_0xad01('0x57')]['id']){delete _0xd82f68[_0xad01('0x57')]['id'];}return db['CmList'][_0xad01('0x53')]({'where':{'id':_0xd82f68['params']['id']}})[_0xad01('0x26')](handleEntityNotFound(_0x4748f7,null))['then'](function(_0x50d830){if(_0x50d830){_0xd82f68[_0xad01('0x57')][_0xad01('0x59')]=_0x50d830['id'];return db[_0xad01('0x5a')][_0xad01('0x4e')](_0xd82f68[_0xad01('0x57')]);}})['then'](respondWithResult(_0x4748f7,null))['catch'](handleError(_0x4748f7,null));};exports[_0xad01('0x5b')]=function(_0x352ee9,_0x307ed8,_0x2be06d){var _0x56098a={'raw':![],'where':{}};var _0x4111fb={};var _0x42ae24={'count':0x0,'rows':[]};return db[_0xad01('0x32')][_0xad01('0x5c')]({'where':{'id':_0x352ee9['params']['id']}})[_0xad01('0x26')](handleEntityNotFound(_0x307ed8,null))['then'](function(_0x253e47){if(_0x253e47){_0x4111fb['model']=_[_0xad01('0x4c')](db[_0xad01('0x5a')]['rawAttributes']);_0x4111fb[_0xad01('0x3b')]=_[_0xad01('0x4c')](_0x352ee9[_0xad01('0x3b')]);_0x4111fb[_0xad01('0x37')]=_[_0xad01('0x38')](_0x4111fb[_0xad01('0x3d')],_0x4111fb[_0xad01('0x3b')]);_0x56098a[_0xad01('0x39')]=_[_0xad01('0x38')](_0x4111fb['model'],qs[_0xad01('0x3a')](_0x352ee9[_0xad01('0x3b')][_0xad01('0x3a')]));_0x56098a['attributes']=_0x56098a[_0xad01('0x39')][_0xad01('0x3c')]?_0x56098a[_0xad01('0x39')]:_0x4111fb[_0xad01('0x3d')];if(!_0x352ee9[_0xad01('0x3b')][_0xad01('0x3e')](_0xad01('0x3f'))){_0x56098a[_0xad01('0x1c')]=qs[_0xad01('0x1c')](_0x352ee9[_0xad01('0x3b')][_0xad01('0x1c')]);_0x56098a['offset']=qs[_0xad01('0x40')](_0x352ee9['query'][_0xad01('0x40')]);}_0x56098a[_0xad01('0x41')]=qs[_0xad01('0x42')](_0x352ee9[_0xad01('0x3b')][_0xad01('0x42')]);_0x56098a[_0xad01('0x43')]=qs[_0xad01('0x37')](_[_0xad01('0x44')](_0x352ee9[_0xad01('0x3b')],_0x4111fb[_0xad01('0x37')]));_0x56098a[_0xad01('0x43')]['ListId']=_0x253e47['id'];if(_0x352ee9[_0xad01('0x3b')][_0xad01('0x45')]){_0x56098a[_0xad01('0x43')]=_['merge'](_0x56098a['where'],{'$or':_[_0xad01('0x31')](_0x56098a['attributes'],function(_0x2c1b74){var _0x3ad237={};_0x3ad237[_0x2c1b74]={'$like':'%'+_0x352ee9[_0xad01('0x3b')][_0xad01('0x45')]+'%'};return _0x3ad237;})});}_0x56098a=_[_0xad01('0x46')]({},_0x56098a,_0x352ee9[_0xad01('0x47')]);return db[_0xad01('0x5a')][_0xad01('0x1e')]({'where':_0x56098a['where']})['then'](function(_0x3128e9){_0x42ae24[_0xad01('0x1e')]=_0x3128e9;if(_0x352ee9[_0xad01('0x3b')][_0xad01('0x4d')]){_0x56098a[_0xad01('0x48')]=[{'all':!![]}];}return db[_0xad01('0x5a')][_0xad01('0x5d')](_0x56098a);})['then'](function(_0x37139a){_0x42ae24[_0xad01('0x49')]=_0x37139a;return _0x42ae24;});}})['then'](respondWithFilteredResult(_0x307ed8,_0x56098a))['catch'](handleError(_0x307ed8,null));};exports[_0xad01('0x5e')]=function(_0x934924,_0x494a5a,_0x280887){return db['CmList'][_0xad01('0x53')]({'where':{'id':_0x934924[_0xad01('0x4b')]['id']}})['then'](handleEntityNotFound(_0x494a5a,null))[_0xad01('0x26')](function(_0x7fac12){if(_0x7fac12){return _0x7fac12[_0xad01('0x5e')](_0x934924[_0xad01('0x3b')][_0xad01('0x5f')]);}})[_0xad01('0x26')](respondWithStatusCode(_0x494a5a,null))[_0xad01('0x4a')](handleError(_0x494a5a,null));};exports[_0xad01('0x60')]=function(_0x2a24b3,_0x16b598,_0x2e4998){return db['CmList'][_0xad01('0x53')]({'where':{'id':_0x2a24b3[_0xad01('0x4b')]['id']}})[_0xad01('0x26')](handleEntityNotFound(_0x16b598,null))[_0xad01('0x26')](function(_0x3c6826){if(_0x3c6826){var _0x4674d5=[];var _0x493ad7={'success':[],'errors':[]};return db[_0xad01('0x61')][_0xad01('0x58')]()['then'](function(_0x58fa47){if(_0x2a24b3[_0xad01('0x57')][_0xad01('0x62')]&&_[_0xad01('0x63')](_0x2a24b3[_0xad01('0x57')]['tags'])){if(_0x2a24b3[_0xad01('0x57')][_0xad01('0x62')][_0xad01('0x3c')]){_0x2a24b3[_0xad01('0x57')]['tags']=_0x2a24b3[_0xad01('0x57')]['tags'][_0xad01('0x64')](';')+';';}else{_0x2a24b3[_0xad01('0x57')][_0xad01('0x62')]=null;}}else{_0x2a24b3[_0xad01('0x57')][_0xad01('0x62')]=null;}if(_0x2a24b3[_0xad01('0x57')]&&_['isArray'](_0x2a24b3[_0xad01('0x57')])){for(var _0x2c7366=0x0;_0x2c7366<_0x2a24b3[_0xad01('0x57')][_0xad01('0x3c')];_0x2c7366+=0x1){_0x2a24b3[_0xad01('0x57')][_0x2c7366][_0xad01('0x59')]=_0x2a24b3['params']['id'];_0x4674d5[_0xad01('0x65')](_0x2a24b3[_0xad01('0x57')][_0x2c7366]);}return BPromise[_0xad01('0x66')](_0x4674d5,function(_0x583399){return db[_0xad01('0x61')][_0xad01('0x4e')](_['omit'](_0x583399,['ids','id'])||{},{'fields':_[_0xad01('0x4c')](_0x58fa47),'raw':!![]})[_0xad01('0x26')](function(_0x5d6c3b){_0x493ad7[_0xad01('0x67')][_0xad01('0x65')](_0x5d6c3b[_0xad01('0x68')]);})[_0xad01('0x4a')](function(_0x318c9f){_0x493ad7[_0xad01('0x69')]['push']({'data':_0x583399,'error':_0x318c9f[_0xad01('0x6a')]});});})['then'](function(_0x2669a2){return _0x493ad7;})[_0xad01('0x4a')](function(_0x43b2d1){return _0x43b2d1;});}else{_0x16b598[_0xad01('0x1f')](0x190)[_0xad01('0x1b')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xad01('0x26')](respondWithResult(_0x16b598,null))[_0xad01('0x4a')](handleError(_0x16b598,null));};exports[_0xad01('0x6b')]=function(_0x40dbc0,_0x3632aa,_0x4f53ea){var _0x5b302e;return db['CmList'][_0xad01('0x53')]({'where':{'id':_0x40dbc0[_0xad01('0x4b')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0xad01('0x26')](handleEntityNotFound(_0x3632aa,null))['then'](function(_0x22f959){if(_0x22f959){_0x5b302e=_0x22f959;return db[_0xad01('0x61')]['rawAttributes'];}})[_0xad01('0x26')](function(_0x2b569a){if(_0x2b569a){var _0x25ee17={};var _0x27798d={};_0x27798d[_0xad01('0x3d')]=_[_0xad01('0x6c')](_[_0xad01('0x4c')](_0x2b569a),_[_0xad01('0x31')](_0x5b302e[_0xad01('0x6d')],function(_0x3ea8c9){return util[_0xad01('0x6e')](_0xad01('0x6f'),_0x3ea8c9['id']);}));_0x27798d[_0xad01('0x3b')]=_[_0xad01('0x4c')](_0x40dbc0[_0xad01('0x3b')]);_0x27798d[_0xad01('0x37')]=_['intersection'](_0x27798d['model'],_0x27798d['query']);_0x25ee17['attributes']=_[_0xad01('0x38')](_0x27798d[_0xad01('0x3d')],qs['fields'](_0x40dbc0[_0xad01('0x3b')]['fields']));_0x25ee17[_0xad01('0x39')]=_0x25ee17[_0xad01('0x39')][_0xad01('0x3c')]?_0x25ee17[_0xad01('0x39')]:_0x27798d[_0xad01('0x3d')];if(!_0x40dbc0[_0xad01('0x3b')][_0xad01('0x3e')](_0xad01('0x3f'))){_0x25ee17[_0xad01('0x1c')]=qs[_0xad01('0x1c')](_0x40dbc0['query'][_0xad01('0x1c')]);_0x25ee17[_0xad01('0x40')]=qs[_0xad01('0x40')](_0x40dbc0['query'][_0xad01('0x40')]);}_0x25ee17['order']=qs['sort'](_0x40dbc0[_0xad01('0x3b')]['sort']);_0x25ee17[_0xad01('0x43')]=qs[_0xad01('0x37')](_[_0xad01('0x44')](_0x40dbc0[_0xad01('0x3b')],_0x27798d[_0xad01('0x37')]));_0x25ee17[_0xad01('0x70')]=!![];if(_0x40dbc0[_0xad01('0x3b')][_0xad01('0x45')]){_0x25ee17[_0xad01('0x43')]=_['merge'](_0x25ee17['where'],{'$or':_[_0xad01('0x31')](_0x25ee17[_0xad01('0x39')],function(_0xbe5ded){var _0x2b7d36={};_0x2b7d36[_0xbe5ded]={'$like':'%'+_0x40dbc0[_0xad01('0x3b')]['filter']+'%'};return _0x2b7d36;})});}_0x25ee17=_[_0xad01('0x46')]({},_0x25ee17,_0x40dbc0[_0xad01('0x47')]);return _0x5b302e[_0xad01('0x6b')](_0x25ee17);}})[_0xad01('0x26')](respondWithResult(_0x3632aa,null))['catch'](handleError(_0x3632aa,null));};exports[_0xad01('0x71')]=function(_0x3e9786,_0x13f238,_0x3778c9){var _0x45794c;return db[_0xad01('0x32')]['find']({'where':{'id':_0x3e9786['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0xad01('0x6d')}]})[_0xad01('0x26')](handleEntityNotFound(_0x13f238,null))['then'](function(_0x433e6e){if(_0x433e6e){_0x45794c=_0x433e6e;return db[_0xad01('0x61')][_0xad01('0x33')];}})[_0xad01('0x26')](function(_0x530720){if(_0x530720){var _0x18fba0={};var _0x1fee13={};_0x1fee13[_0xad01('0x3d')]=_[_0xad01('0x6c')](_[_0xad01('0x4c')](_0x530720),_[_0xad01('0x31')](_0x45794c[_0xad01('0x6d')],function(_0x250352){return util[_0xad01('0x6e')](_0xad01('0x6f'),_0x250352['id']);}));_0x1fee13[_0xad01('0x3b')]=_[_0xad01('0x4c')](_0x3e9786[_0xad01('0x3b')]);_0x1fee13['filters']=_[_0xad01('0x38')](_0x1fee13[_0xad01('0x3d')],_0x1fee13[_0xad01('0x3b')]);_0x18fba0[_0xad01('0x39')]=_[_0xad01('0x38')](_0x1fee13[_0xad01('0x3d')],qs[_0xad01('0x3a')](_0x3e9786['query'][_0xad01('0x3a')]));_0x18fba0[_0xad01('0x39')]=_0x18fba0[_0xad01('0x39')][_0xad01('0x3c')]?_0x18fba0[_0xad01('0x39')]:_0x1fee13[_0xad01('0x3d')];if(!_0x3e9786['query'][_0xad01('0x3e')](_0xad01('0x3f'))){_0x18fba0['limit']=qs[_0xad01('0x1c')](_0x3e9786['query'][_0xad01('0x1c')]);_0x18fba0['offset']=qs[_0xad01('0x40')](_0x3e9786[_0xad01('0x3b')][_0xad01('0x40')]);}_0x18fba0['order']=qs['sort'](_0x3e9786[_0xad01('0x3b')][_0xad01('0x42')]);_0x18fba0['where']=qs[_0xad01('0x37')](_['pick'](_0x3e9786['query'],_0x1fee13[_0xad01('0x37')]));_0x18fba0['raw']=!![];if(_0x3e9786[_0xad01('0x3b')][_0xad01('0x45')]){_0x18fba0[_0xad01('0x43')]=_[_0xad01('0x46')](_0x18fba0[_0xad01('0x43')],{'$or':_[_0xad01('0x31')](_0x18fba0[_0xad01('0x39')],function(_0x57c577){var _0x51c611={};_0x51c611[_0x57c577]={'$like':'%'+_0x3e9786[_0xad01('0x3b')][_0xad01('0x45')]+'%'};return _0x51c611;})});}_0x18fba0=_[_0xad01('0x46')]({},_0x18fba0,_0x3e9786[_0xad01('0x47')]);return _0x45794c['getContacts'](_0x18fba0);}})[_0xad01('0x26')](function(_0x1c8d04){if(!_[_0xad01('0x72')](_0x1c8d04)){var _0x7768e6=toCsv(_0x1c8d04);var _0xd4af9b=Date[_0xad01('0x73')]();fs['writeFileSync'](util[_0xad01('0x6e')](_0xad01('0x74'),_0x45794c['id'],_0xd4af9b),_0x7768e6);_0x13f238[_0xad01('0x75')](_0xad01('0x76'),_0xad01('0x77')+util[_0xad01('0x6e')]('list_%d_%s.csv',_0x45794c['id'],_0xd4af9b));_0x13f238[_0xad01('0x75')](_0xad01('0x78'),_0xad01('0x79'));return _0x13f238[_0xad01('0x7a')](util[_0xad01('0x6e')](_0xad01('0x74'),_0x45794c['id'],_0xd4af9b));}else{return _0x13f238[_0xad01('0x1a')](0xcc);}})[_0xad01('0x4a')](handleError(_0x13f238,null));};exports['addCustomField']=function(_0x5d29fc,_0x29f9b3,_0x4eabe4){var _0x466752;delete _0x5d29fc['body']['id'];return db[_0xad01('0x32')]['findOne']({'where':{'id':_0x5d29fc['params']['id']}})[_0xad01('0x26')](handleEntityNotFound(_0x29f9b3,null))[_0xad01('0x26')](function(_0xb61944){if(_0xb61944){return db['sequelize']['transaction'](function(_0x6cdb21){return db['CmCustomField'][_0xad01('0x4e')](_0x5d29fc[_0xad01('0x57')],{'transaction':_0x6cdb21})[_0xad01('0x26')](function(_0x3fa981){_0x466752=_0x3fa981;return _0xb61944[_0xad01('0x7b')](_0x3fa981,{'transaction':_0x6cdb21});})[_0xad01('0x26')](function(){var _0x57d33a={'type':db['Sequelize'][_0xad01('0x7c')],'transaction':_0x6cdb21};switch(_0x5d29fc[_0xad01('0x57')]['type']){case _0xad01('0x7d'):_0x57d33a[_0xad01('0x35')]=db[_0xad01('0x7e')]['TEXT'];break;case _0xad01('0x7f'):_0x57d33a[_0xad01('0x35')]=db[_0xad01('0x7e')][_0xad01('0x80')];break;case _0xad01('0x81'):_0x57d33a['type']=db[_0xad01('0x7e')][_0xad01('0x82')];_0x57d33a[_0xad01('0x83')]=![];break;default:}return db[_0xad01('0x84')][_0xad01('0x85')][_0xad01('0x86')](_0xad01('0x87'),util[_0xad01('0x6e')]('cf_%s',_0x466752['id']),_0x57d33a);})[_0xad01('0x26')](function(){return _0x466752;});});}})[_0xad01('0x26')](respondWithResult(_0x29f9b3,null))[_0xad01('0x4a')](handleError(_0x29f9b3,null));};exports[_0xad01('0x88')]=function(_0x438ba1,_0x277660,_0x282975){var _0x186584={};var _0x244fd8={};var _0x238001;var _0x80b524;return db[_0xad01('0x32')]['findOne']({'where':{'id':_0x438ba1[_0xad01('0x4b')]['id']}})[_0xad01('0x26')](handleEntityNotFound(_0x277660,null))[_0xad01('0x26')](function(_0x5d7ca1){if(_0x5d7ca1){_0x238001=_0x5d7ca1;_0x244fd8[_0xad01('0x3d')]=_[_0xad01('0x4c')](db['CmCustomField'][_0xad01('0x33')]);_0x244fd8[_0xad01('0x3b')]=_['keys'](_0x438ba1['query']);_0x244fd8['filters']=_[_0xad01('0x38')](_0x244fd8[_0xad01('0x3d')],_0x244fd8['query']);_0x186584[_0xad01('0x39')]=_[_0xad01('0x38')](_0x244fd8['model'],qs[_0xad01('0x3a')](_0x438ba1[_0xad01('0x3b')][_0xad01('0x3a')]));_0x186584['attributes']=_0x186584['attributes'][_0xad01('0x3c')]?_0x186584[_0xad01('0x39')]:_0x244fd8[_0xad01('0x3d')];_0x186584[_0xad01('0x41')]=qs[_0xad01('0x42')](_0x438ba1['query']['sort']);_0x186584['where']=qs['filters'](_[_0xad01('0x44')](_0x438ba1[_0xad01('0x3b')],_0x244fd8['filters']));_0x186584[_0xad01('0x43')]=_[_0xad01('0x46')](_0x186584[_0xad01('0x43')],{'$or':[{'ListId':_0x5d7ca1['id']},{'ListId':null}]});if(_0x438ba1[_0xad01('0x3b')]['filter']){_0x186584[_0xad01('0x43')]=_['merge'](_0x186584[_0xad01('0x43')],{'$or':_[_0xad01('0x31')](_0x186584[_0xad01('0x39')],function(_0x2f8d15){var _0x4a4f33={};_0x4a4f33[_0x2f8d15]={'$like':'%'+_0x438ba1[_0xad01('0x3b')]['filter']+'%'};return _0x4a4f33;})});}_0x186584=_[_0xad01('0x46')]({},_0x186584,_0x438ba1[_0xad01('0x47')]);return db[_0xad01('0x89')]['findAndCountAll'](_0x186584);}})[_0xad01('0x26')](respondWithResult(_0x277660,null))[_0xad01('0x4a')](handleError(_0x277660,null));};exports[_0xad01('0x8a')]=function(_0x3dc5f8,_0x1ae5c8,_0x5cc37f){return db[_0xad01('0x32')][_0xad01('0x53')]({'where':{'id':_0x3dc5f8['params']['id']}})[_0xad01('0x26')](handleEntityNotFound(_0x1ae5c8,null))[_0xad01('0x26')](function(_0x2651eb){if(_0x2651eb){return _0x2651eb['addAgents'](_0x3dc5f8['body'][_0xad01('0x5f')],_[_0xad01('0x8b')](_0x3dc5f8['body'],['ids','id'])||{})[_0xad01('0x8c')](function(_0x523834){for(var _0x3d37ea=0x0;_0x3d37ea<_0x3dc5f8[_0xad01('0x57')]['ids']['length'];_0x3d37ea+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x3dc5f8[_0xad01('0x57')][_0xad01('0x5f')][_0x3d37ea]),'CmListId':Number(_0x3dc5f8[_0xad01('0x4b')]['id'])});}return _0x523834;});}})[_0xad01('0x26')](respondWithResult(_0x1ae5c8,null))['catch'](handleError(_0x1ae5c8,null));};exports[_0xad01('0x8d')]=function(_0x9bbee3,_0x42f5d2,_0x1ac365){return db[_0xad01('0x32')]['find']({'where':{'id':_0x9bbee3[_0xad01('0x4b')]['id']}})[_0xad01('0x26')](handleEntityNotFound(_0x42f5d2,null))['then'](function(_0x3e3aa8){if(_0x3e3aa8){return _0x3e3aa8[_0xad01('0x8d')](_0x9bbee3['query'][_0xad01('0x5f')])[_0xad01('0x26')](function(){if(_[_0xad01('0x63')](_0x9bbee3[_0xad01('0x3b')][_0xad01('0x5f')])){for(var _0x2e54b3=0x0;_0x2e54b3<_0x9bbee3[_0xad01('0x3b')][_0xad01('0x5f')][_0xad01('0x3c')];_0x2e54b3+=0x1){socket[_0xad01('0x8e')]('userCmList:remove',{'UserId':Number(_0x9bbee3[_0xad01('0x3b')][_0xad01('0x5f')][_0x2e54b3]),'CmListId':Number(_0x9bbee3[_0xad01('0x4b')]['id'])});}}else{socket[_0xad01('0x8e')](_0xad01('0x8f'),{'UserId':Number(_0x9bbee3[_0xad01('0x3b')][_0xad01('0x5f')]),'CmListId':Number(_0x9bbee3['params']['id'])});}});}})[_0xad01('0x26')](respondWithStatusCode(_0x42f5d2,null))[_0xad01('0x4a')](handleError(_0x42f5d2,null));};exports[_0xad01('0x90')]=function(_0x59827e,_0x248754,_0x163758){var _0x440ed7={};var _0x44b2f6={};var _0x14a197;var _0x1c3981;return db[_0xad01('0x32')]['findOne']({'where':{'id':_0x59827e[_0xad01('0x4b')]['id']}})[_0xad01('0x26')](handleEntityNotFound(_0x248754,null))[_0xad01('0x26')](function(_0x951a5){if(_0x951a5){_0x14a197=_0x951a5;_0x44b2f6[_0xad01('0x3d')]=_[_0xad01('0x4c')](db[_0xad01('0x91')]['rawAttributes']);_0x44b2f6[_0xad01('0x3b')]=_[_0xad01('0x4c')](_0x59827e[_0xad01('0x3b')]);_0x44b2f6[_0xad01('0x37')]=_['intersection'](_0x44b2f6[_0xad01('0x3d')],_0x44b2f6[_0xad01('0x3b')]);_0x440ed7[_0xad01('0x39')]=_['intersection'](_0x44b2f6[_0xad01('0x3d')],qs[_0xad01('0x3a')](_0x59827e[_0xad01('0x3b')][_0xad01('0x3a')]));_0x440ed7[_0xad01('0x39')]=_0x440ed7[_0xad01('0x39')][_0xad01('0x3c')]?_0x440ed7[_0xad01('0x39')]:_0x44b2f6['model'];_0x440ed7['order']=qs['sort'](_0x59827e[_0xad01('0x3b')]['sort']);_0x440ed7['where']=qs['filters'](_['pick'](_0x59827e['query'],_0x44b2f6[_0xad01('0x37')]));if(_0x59827e['query']['filter']){_0x440ed7['where']=_['merge'](_0x440ed7[_0xad01('0x43')],{'$or':_[_0xad01('0x31')](_0x440ed7[_0xad01('0x39')],function(_0x41db27){var _0x276d27={};_0x276d27[_0x41db27]={'$like':'%'+_0x59827e[_0xad01('0x3b')]['filter']+'%'};return _0x276d27;})});}_0x440ed7=_[_0xad01('0x46')]({},_0x440ed7,_0x59827e[_0xad01('0x47')]);return _0x14a197['getAgents'](_0x440ed7);}})[_0xad01('0x26')](function(_0x136a36){if(_0x136a36){_0x1c3981=_0x136a36[_0xad01('0x3c')];if(!_0x59827e[_0xad01('0x3b')][_0xad01('0x3e')]('nolimit')){_0x440ed7['limit']=qs[_0xad01('0x1c')](_0x59827e['query'][_0xad01('0x1c')]);_0x440ed7['offset']=qs[_0xad01('0x40')](_0x59827e[_0xad01('0x3b')][_0xad01('0x40')]);}return _0x14a197[_0xad01('0x90')](_0x440ed7);}})[_0xad01('0x26')](function(_0x87033e){if(_0x87033e){return _0x87033e?{'count':_0x1c3981,'rows':_0x87033e}:null;}})[_0xad01('0x26')](respondWithResult(_0x248754,null))[_0xad01('0x4a')](handleError(_0x248754,null));}; \ No newline at end of file +var _0xc914=['model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','params','rawAttributes','length','find','catch','create','body','user','role','Lists','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','Disposition','getDispositions','findOne','hasOwnProperty','ListId','removeDispositions','ids','CmContact','isArray','tags','join','each','success','dataValues','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','CmCustomField','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./cmList.socket','register','sendStatus','status','end','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','get','error','name','map','CmList','type','key'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0xc914,0x173));var _0x4c91=function(_0x4caefc,_0x4f667c){_0x4caefc=_0x4caefc-0x0;var _0x35fd5f=_0xc914[_0x4caefc];return _0x35fd5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c91('0x0'));var zipdir=require(_0x4c91('0x1'));var jsonpatch=require(_0x4c91('0x2'));var rp=require(_0x4c91('0x3'));var moment=require(_0x4c91('0x4'));var BPromise=require(_0x4c91('0x5'));var Mustache=require('mustache');var util=require(_0x4c91('0x6'));var path=require('path');var sox=require(_0x4c91('0x7'));var csv=require('to-csv');var ejs=require(_0x4c91('0x8'));var fs=require('fs');var fs_extra=require(_0x4c91('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4c91('0xa'));var jsforce=require(_0x4c91('0xb'));var deskjs=require(_0x4c91('0xc'));var toCsv=require(_0x4c91('0xd'));var querystring=require(_0x4c91('0xe'));var Papa=require(_0x4c91('0xf'));var Redis=require(_0x4c91('0x10'));var authService=require(_0x4c91('0x11'));var qs=require(_0x4c91('0x12'));var as=require(_0x4c91('0x13'));var hardwareService=require(_0x4c91('0x14'));var logger=require(_0x4c91('0x15'))(_0x4c91('0x16'));var utils=require('../../config/utils');var config=require(_0x4c91('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4c91('0x18'))['db'];config['redis']=_[_0x4c91('0x19')](config['redis'],{'host':_0x4c91('0x1a'),'port':0x18eb});var socket=require(_0x4c91('0x1b'))(new Redis(config[_0x4c91('0x1c')]));require(_0x4c91('0x1d'))[_0x4c91('0x1e')](socket);function respondWithStatusCode(_0x321570,_0x3b083a){_0x3b083a=_0x3b083a||0xcc;return function(_0x5e1834){if(_0x5e1834){return _0x321570[_0x4c91('0x1f')](_0x3b083a);}return _0x321570[_0x4c91('0x20')](_0x3b083a)[_0x4c91('0x21')]();};}function respondWithResult(_0x36105e,_0x57d876){_0x57d876=_0x57d876||0xc8;return function(_0xc82253){if(_0xc82253){return _0x36105e[_0x4c91('0x20')](_0x57d876)['json'](_0xc82253);}};}function respondWithFilteredResult(_0x1fb7c1,_0x5dbc45){return function(_0xf1d8){if(_0xf1d8){var _0x38411d=typeof _0x5dbc45['offset']==='undefined'&&typeof _0x5dbc45[_0x4c91('0x22')]==='undefined';var _0x217531=_0xf1d8[_0x4c91('0x23')];var _0x52f324=_0x38411d?0x0:_0x5dbc45[_0x4c91('0x24')];var _0x6e6a66=_0x38411d?_0xf1d8['count']:_0x5dbc45[_0x4c91('0x24')]+_0x5dbc45[_0x4c91('0x22')];var _0x3ebd59;if(_0x6e6a66>=_0x217531){_0x6e6a66=_0x217531;_0x3ebd59=0xc8;}else{_0x3ebd59=0xce;}_0x1fb7c1[_0x4c91('0x20')](_0x3ebd59);return _0x1fb7c1[_0x4c91('0x25')](_0x4c91('0x26'),_0x52f324+'-'+_0x6e6a66+'/'+_0x217531)[_0x4c91('0x27')](_0xf1d8);}return null;};}function patchUpdates(_0x3fac3b){return function(_0x3a833c){try{jsonpatch[_0x4c91('0x28')](_0x3a833c,_0x3fac3b,!![]);}catch(_0x5271b4){return BPromise[_0x4c91('0x29')](_0x5271b4);}return _0x3a833c[_0x4c91('0x2a')]();};}function saveUpdates(_0x23d90b,_0x3dc31f){return function(_0x3a9024){if(_0x3a9024){return _0x3a9024[_0x4c91('0x2b')](_0x23d90b)[_0x4c91('0x2c')](function(_0xb95a0d){return _0xb95a0d;});}return null;};}function removeEntity(_0x30ebb2,_0x37ab47){return function(_0x1fd1ce){if(_0x1fd1ce){return _0x1fd1ce['destroy']()[_0x4c91('0x2c')](function(){var _0xd72464=_0x1fd1ce[_0x4c91('0x2d')]({'plain':!![]});var _0x52504d='Lists';return db['UserProfileResource']['destroy']({'where':{'type':_0x52504d,'resourceId':_0xd72464['id']}})[_0x4c91('0x2c')](function(){return _0x1fd1ce;});})[_0x4c91('0x2c')](function(){_0x30ebb2['status'](0xcc)[_0x4c91('0x21')]();});}};}function handleEntityNotFound(_0x3e2634,_0x5c29c4){return function(_0x3439b7){if(!_0x3439b7){_0x3e2634[_0x4c91('0x1f')](0x194);}return _0x3439b7;};}function handleError(_0x4f5b24,_0x36fef4){_0x36fef4=_0x36fef4||0x1f4;return function(_0x54950c){logger[_0x4c91('0x2e')](_0x54950c['stack']);if(_0x54950c[_0x4c91('0x2f')]){delete _0x54950c[_0x4c91('0x2f')];}_0x4f5b24[_0x4c91('0x20')](_0x36fef4)['send'](_0x54950c);};}exports['index']=function(_0x3aa880,_0x4973f2){var _0x896a20={},_0x34fff3={},_0x15b3f7={'count':0x0,'rows':[]};var _0x5ad1f8=_[_0x4c91('0x30')](db[_0x4c91('0x31')]['rawAttributes'],function(_0x5bc72e){return{'name':_0x5bc72e['fieldName'],'type':_0x5bc72e[_0x4c91('0x32')][_0x4c91('0x33')]};});_0x34fff3[_0x4c91('0x34')]=_['map'](_0x5ad1f8,'name');_0x34fff3['query']=_[_0x4c91('0x35')](_0x3aa880[_0x4c91('0x36')]);_0x34fff3['filters']=_[_0x4c91('0x37')](_0x34fff3[_0x4c91('0x34')],_0x34fff3[_0x4c91('0x36')]);_0x896a20[_0x4c91('0x38')]=_[_0x4c91('0x37')](_0x34fff3[_0x4c91('0x34')],qs[_0x4c91('0x39')](_0x3aa880[_0x4c91('0x36')]['fields']));_0x896a20['attributes']=_0x896a20[_0x4c91('0x38')]['length']?_0x896a20[_0x4c91('0x38')]:_0x34fff3[_0x4c91('0x34')];if(!_0x3aa880['query']['hasOwnProperty'](_0x4c91('0x3a'))){_0x896a20[_0x4c91('0x22')]=qs[_0x4c91('0x22')](_0x3aa880[_0x4c91('0x36')]['limit']);_0x896a20[_0x4c91('0x24')]=qs['offset'](_0x3aa880[_0x4c91('0x36')][_0x4c91('0x24')]);}_0x896a20[_0x4c91('0x3b')]=qs[_0x4c91('0x3c')](_0x3aa880['query'][_0x4c91('0x3c')]);_0x896a20[_0x4c91('0x3d')]=qs[_0x4c91('0x3e')](_[_0x4c91('0x3f')](_0x3aa880[_0x4c91('0x36')],_0x34fff3['filters']),_0x5ad1f8);if(_0x3aa880[_0x4c91('0x36')][_0x4c91('0x40')]){_0x896a20[_0x4c91('0x3d')]=_[_0x4c91('0x41')](_0x896a20['where'],{'$or':_[_0x4c91('0x30')](_0x5ad1f8,function(_0x1bea0d){if(_0x1bea0d[_0x4c91('0x32')]!=='VIRTUAL'){var _0x243035={};_0x243035[_0x1bea0d[_0x4c91('0x2f')]]={'$like':'%'+_0x3aa880['query'][_0x4c91('0x40')]+'%'};return _0x243035;}})});}_0x896a20=_[_0x4c91('0x41')]({},_0x896a20,_0x3aa880[_0x4c91('0x42')]);var _0x4345f8={'where':_0x896a20[_0x4c91('0x3d')]};return db['CmList']['count'](_0x4345f8)[_0x4c91('0x2c')](function(_0xeb4ba9){_0x15b3f7['count']=_0xeb4ba9;if(_0x3aa880[_0x4c91('0x36')][_0x4c91('0x43')]){_0x896a20[_0x4c91('0x44')]=[{'all':!![]}];}return db[_0x4c91('0x31')][_0x4c91('0x45')](_0x896a20);})[_0x4c91('0x2c')](function(_0x82cbb6){_0x15b3f7[_0x4c91('0x46')]=_0x82cbb6;return _0x15b3f7;})[_0x4c91('0x2c')](respondWithFilteredResult(_0x4973f2,_0x896a20))['catch'](handleError(_0x4973f2,null));};exports['show']=function(_0x362cca,_0x575452){var _0x1f9986={'raw':![],'where':{'id':_0x362cca[_0x4c91('0x47')]['id']}},_0x4a3520={};_0x4a3520[_0x4c91('0x34')]=_['keys'](db[_0x4c91('0x31')][_0x4c91('0x48')]);_0x4a3520[_0x4c91('0x36')]=_[_0x4c91('0x35')](_0x362cca[_0x4c91('0x36')]);_0x4a3520[_0x4c91('0x3e')]=_[_0x4c91('0x37')](_0x4a3520[_0x4c91('0x34')],_0x4a3520['query']);_0x1f9986['attributes']=_[_0x4c91('0x37')](_0x4a3520['model'],qs['fields'](_0x362cca[_0x4c91('0x36')][_0x4c91('0x39')]));_0x1f9986[_0x4c91('0x38')]=_0x1f9986[_0x4c91('0x38')][_0x4c91('0x49')]?_0x1f9986[_0x4c91('0x38')]:_0x4a3520[_0x4c91('0x34')];if(_0x362cca[_0x4c91('0x36')][_0x4c91('0x43')]){_0x1f9986[_0x4c91('0x44')]=[{'all':!![]}];}_0x1f9986=_['merge']({},_0x1f9986,_0x362cca[_0x4c91('0x42')]);return db[_0x4c91('0x31')][_0x4c91('0x4a')](_0x1f9986)[_0x4c91('0x2c')](handleEntityNotFound(_0x575452,null))[_0x4c91('0x2c')](respondWithResult(_0x575452,null))[_0x4c91('0x4b')](handleError(_0x575452,null));};exports['create']=function(_0x12d5d0,_0x87811e){return db[_0x4c91('0x31')][_0x4c91('0x4c')](_0x12d5d0[_0x4c91('0x4d')],{})[_0x4c91('0x2c')](function(_0x571998){var _0x4db8a3=_0x12d5d0[_0x4c91('0x4e')][_0x4c91('0x2d')]({'plain':!![]});if(!_0x4db8a3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4db8a3[_0x4c91('0x4f')]===_0x4c91('0x4e')){var _0x1f16cf=_0x571998['get']({'plain':!![]});var _0x5a3c28=_0x4c91('0x50');return db[_0x4c91('0x51')]['find']({'where':{'name':_0x5a3c28,'userProfileId':_0x4db8a3[_0x4c91('0x52')]},'raw':!![]})['then'](function(_0x503245){if(_0x503245&&_0x503245['autoAssociation']===0x0){return db[_0x4c91('0x53')][_0x4c91('0x4c')]({'name':_0x1f16cf['name'],'resourceId':_0x1f16cf['id'],'type':_0x503245[_0x4c91('0x2f')],'sectionId':_0x503245['id']},{})[_0x4c91('0x2c')](function(){return _0x571998;});}else{return _0x571998;}})[_0x4c91('0x4b')](function(_0x1e1336){logger['error'](_0x4c91('0x54'),_0x1e1336);throw _0x1e1336;});}return _0x571998;})[_0x4c91('0x2c')](respondWithResult(_0x87811e,0xc9))['catch'](handleError(_0x87811e,null));};exports[_0x4c91('0x2b')]=function(_0x456b4a,_0xe9c6b3){if(_0x456b4a[_0x4c91('0x4d')]['id']){delete _0x456b4a['body']['id'];}return db['CmList']['find']({'where':{'id':_0x456b4a[_0x4c91('0x47')]['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0xe9c6b3,null))['then'](saveUpdates(_0x456b4a['body'],null))[_0x4c91('0x2c')](respondWithResult(_0xe9c6b3,null))[_0x4c91('0x4b')](handleError(_0xe9c6b3,null));};exports[_0x4c91('0x55')]=function(_0x1e5347,_0x37ea04){return db[_0x4c91('0x31')]['find']({'where':{'id':_0x1e5347['params']['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0x37ea04,null))[_0x4c91('0x2c')](removeEntity(_0x37ea04,null))[_0x4c91('0x4b')](handleError(_0x37ea04,null));};exports['describe']=function(_0x5c73e,_0x3519db){return db[_0x4c91('0x31')][_0x4c91('0x56')]()[_0x4c91('0x2c')](respondWithResult(_0x3519db,null))['catch'](handleError(_0x3519db,null));};exports['addDisposition']=function(_0xfb69cd,_0x5de183,_0x53c339){if(_0xfb69cd[_0x4c91('0x4d')]['id']){delete _0xfb69cd[_0x4c91('0x4d')]['id'];}return db[_0x4c91('0x31')][_0x4c91('0x4a')]({'where':{'id':_0xfb69cd[_0x4c91('0x47')]['id']}})['then'](handleEntityNotFound(_0x5de183,null))[_0x4c91('0x2c')](function(_0x25fa2d){if(_0x25fa2d){_0xfb69cd[_0x4c91('0x4d')]['ListId']=_0x25fa2d['id'];return db[_0x4c91('0x57')][_0x4c91('0x4c')](_0xfb69cd[_0x4c91('0x4d')]);}})['then'](respondWithResult(_0x5de183,null))[_0x4c91('0x4b')](handleError(_0x5de183,null));};exports[_0x4c91('0x58')]=function(_0x5cab5e,_0x8c5e19,_0x5a83b8){var _0x30e791={'raw':![],'where':{}};var _0x3826d8={};var _0x1fd022={'count':0x0,'rows':[]};return db['CmList'][_0x4c91('0x59')]({'where':{'id':_0x5cab5e[_0x4c91('0x47')]['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0x8c5e19,null))[_0x4c91('0x2c')](function(_0x5f468c){if(_0x5f468c){_0x3826d8[_0x4c91('0x34')]=_['keys'](db['Disposition']['rawAttributes']);_0x3826d8[_0x4c91('0x36')]=_[_0x4c91('0x35')](_0x5cab5e[_0x4c91('0x36')]);_0x3826d8['filters']=_[_0x4c91('0x37')](_0x3826d8[_0x4c91('0x34')],_0x3826d8['query']);_0x30e791['attributes']=_[_0x4c91('0x37')](_0x3826d8[_0x4c91('0x34')],qs[_0x4c91('0x39')](_0x5cab5e['query'][_0x4c91('0x39')]));_0x30e791[_0x4c91('0x38')]=_0x30e791[_0x4c91('0x38')][_0x4c91('0x49')]?_0x30e791[_0x4c91('0x38')]:_0x3826d8[_0x4c91('0x34')];if(!_0x5cab5e['query'][_0x4c91('0x5a')](_0x4c91('0x3a'))){_0x30e791['limit']=qs['limit'](_0x5cab5e[_0x4c91('0x36')][_0x4c91('0x22')]);_0x30e791[_0x4c91('0x24')]=qs[_0x4c91('0x24')](_0x5cab5e[_0x4c91('0x36')][_0x4c91('0x24')]);}_0x30e791[_0x4c91('0x3b')]=qs['sort'](_0x5cab5e[_0x4c91('0x36')][_0x4c91('0x3c')]);_0x30e791[_0x4c91('0x3d')]=qs['filters'](_[_0x4c91('0x3f')](_0x5cab5e[_0x4c91('0x36')],_0x3826d8['filters']));_0x30e791[_0x4c91('0x3d')][_0x4c91('0x5b')]=_0x5f468c['id'];if(_0x5cab5e[_0x4c91('0x36')]['filter']){_0x30e791[_0x4c91('0x3d')]=_['merge'](_0x30e791['where'],{'$or':_[_0x4c91('0x30')](_0x30e791[_0x4c91('0x38')],function(_0x2c94b4){var _0x29c44c={};_0x29c44c[_0x2c94b4]={'$like':'%'+_0x5cab5e[_0x4c91('0x36')]['filter']+'%'};return _0x29c44c;})});}_0x30e791=_[_0x4c91('0x41')]({},_0x30e791,_0x5cab5e[_0x4c91('0x42')]);return db['Disposition'][_0x4c91('0x23')]({'where':_0x30e791[_0x4c91('0x3d')]})['then'](function(_0x3b862d){_0x1fd022['count']=_0x3b862d;if(_0x5cab5e[_0x4c91('0x36')][_0x4c91('0x43')]){_0x30e791[_0x4c91('0x44')]=[{'all':!![]}];}return db[_0x4c91('0x57')][_0x4c91('0x45')](_0x30e791);})[_0x4c91('0x2c')](function(_0x164ea6){_0x1fd022[_0x4c91('0x46')]=_0x164ea6;return _0x1fd022;});}})[_0x4c91('0x2c')](respondWithFilteredResult(_0x8c5e19,_0x30e791))[_0x4c91('0x4b')](handleError(_0x8c5e19,null));};exports[_0x4c91('0x5c')]=function(_0x4ec5dc,_0x4c98a0,_0x29b940){return db['CmList'][_0x4c91('0x4a')]({'where':{'id':_0x4ec5dc['params']['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0x4c98a0,null))[_0x4c91('0x2c')](function(_0x2a2218){if(_0x2a2218){return _0x2a2218[_0x4c91('0x5c')](_0x4ec5dc['query'][_0x4c91('0x5d')]);}})['then'](respondWithStatusCode(_0x4c98a0,null))[_0x4c91('0x4b')](handleError(_0x4c98a0,null));};exports['addContacts']=function(_0x448847,_0xefd81e,_0x15cd4c){return db[_0x4c91('0x31')][_0x4c91('0x4a')]({'where':{'id':_0x448847[_0x4c91('0x47')]['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0xefd81e,null))[_0x4c91('0x2c')](function(_0x271309){if(_0x271309){var _0x1132d7=[];var _0x583a5f={'success':[],'errors':[]};return db[_0x4c91('0x5e')][_0x4c91('0x56')]()[_0x4c91('0x2c')](function(_0x1638d1){if(_0x448847['body']['tags']&&_[_0x4c91('0x5f')](_0x448847[_0x4c91('0x4d')]['tags'])){if(_0x448847[_0x4c91('0x4d')][_0x4c91('0x60')][_0x4c91('0x49')]){_0x448847[_0x4c91('0x4d')][_0x4c91('0x60')]=_0x448847[_0x4c91('0x4d')][_0x4c91('0x60')][_0x4c91('0x61')](';')+';';}else{_0x448847[_0x4c91('0x4d')][_0x4c91('0x60')]=null;}}else{_0x448847[_0x4c91('0x4d')][_0x4c91('0x60')]=null;}if(_0x448847['body']&&_['isArray'](_0x448847['body'])){for(var _0x5393c2=0x0;_0x5393c2<_0x448847[_0x4c91('0x4d')][_0x4c91('0x49')];_0x5393c2+=0x1){_0x448847[_0x4c91('0x4d')][_0x5393c2][_0x4c91('0x5b')]=_0x448847[_0x4c91('0x47')]['id'];_0x1132d7['push'](_0x448847[_0x4c91('0x4d')][_0x5393c2]);}return BPromise[_0x4c91('0x62')](_0x1132d7,function(_0x15bfb2){return db[_0x4c91('0x5e')][_0x4c91('0x4c')](_['omit'](_0x15bfb2,[_0x4c91('0x5d'),'id'])||{},{'fields':_[_0x4c91('0x35')](_0x1638d1),'raw':!![]})[_0x4c91('0x2c')](function(_0x27240e){_0x583a5f[_0x4c91('0x63')]['push'](_0x27240e[_0x4c91('0x64')]);})['catch'](function(_0x49afaf){_0x583a5f['errors']['push']({'data':_0x15bfb2,'error':_0x49afaf['message']});});})[_0x4c91('0x2c')](function(_0x5e1afa){return _0x583a5f;})[_0x4c91('0x4b')](function(_0x26f221){return _0x26f221;});}else{_0xefd81e[_0x4c91('0x20')](0x190)[_0x4c91('0x27')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x4c91('0x2c')](respondWithResult(_0xefd81e,null))['catch'](handleError(_0xefd81e,null));};exports[_0x4c91('0x65')]=function(_0x9cecd6,_0x123d7c,_0x10518a){var _0x47caa2;return db[_0x4c91('0x31')]['find']({'where':{'id':_0x9cecd6['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x4c91('0x66')}]})[_0x4c91('0x2c')](handleEntityNotFound(_0x123d7c,null))['then'](function(_0x49e156){if(_0x49e156){_0x47caa2=_0x49e156;return db[_0x4c91('0x5e')][_0x4c91('0x48')];}})[_0x4c91('0x2c')](function(_0x55f5be){if(_0x55f5be){var _0x21f652={};var _0x314a5a={};_0x314a5a['model']=_[_0x4c91('0x67')](_['keys'](_0x55f5be),_[_0x4c91('0x30')](_0x47caa2[_0x4c91('0x66')],function(_0x156cf5){return util[_0x4c91('0x68')](_0x4c91('0x69'),_0x156cf5['id']);}));_0x314a5a[_0x4c91('0x36')]=_[_0x4c91('0x35')](_0x9cecd6[_0x4c91('0x36')]);_0x314a5a[_0x4c91('0x3e')]=_[_0x4c91('0x37')](_0x314a5a[_0x4c91('0x34')],_0x314a5a[_0x4c91('0x36')]);_0x21f652[_0x4c91('0x38')]=_[_0x4c91('0x37')](_0x314a5a[_0x4c91('0x34')],qs[_0x4c91('0x39')](_0x9cecd6[_0x4c91('0x36')][_0x4c91('0x39')]));_0x21f652['attributes']=_0x21f652[_0x4c91('0x38')]['length']?_0x21f652['attributes']:_0x314a5a['model'];if(!_0x9cecd6[_0x4c91('0x36')][_0x4c91('0x5a')](_0x4c91('0x3a'))){_0x21f652[_0x4c91('0x22')]=qs[_0x4c91('0x22')](_0x9cecd6[_0x4c91('0x36')][_0x4c91('0x22')]);_0x21f652['offset']=qs[_0x4c91('0x24')](_0x9cecd6[_0x4c91('0x36')][_0x4c91('0x24')]);}_0x21f652[_0x4c91('0x3b')]=qs[_0x4c91('0x3c')](_0x9cecd6[_0x4c91('0x36')][_0x4c91('0x3c')]);_0x21f652[_0x4c91('0x3d')]=qs[_0x4c91('0x3e')](_[_0x4c91('0x3f')](_0x9cecd6[_0x4c91('0x36')],_0x314a5a['filters']));_0x21f652[_0x4c91('0x6a')]=!![];if(_0x9cecd6['query'][_0x4c91('0x40')]){_0x21f652[_0x4c91('0x3d')]=_[_0x4c91('0x41')](_0x21f652[_0x4c91('0x3d')],{'$or':_[_0x4c91('0x30')](_0x21f652[_0x4c91('0x38')],function(_0x2e36de){var _0x431423={};_0x431423[_0x2e36de]={'$like':'%'+_0x9cecd6[_0x4c91('0x36')]['filter']+'%'};return _0x431423;})});}_0x21f652=_[_0x4c91('0x41')]({},_0x21f652,_0x9cecd6[_0x4c91('0x42')]);return _0x47caa2[_0x4c91('0x65')](_0x21f652);}})[_0x4c91('0x2c')](respondWithResult(_0x123d7c,null))[_0x4c91('0x4b')](handleError(_0x123d7c,null));};exports[_0x4c91('0x6b')]=function(_0x3722e8,_0x395dfb,_0x2357c2){var _0x3a1b93;return db['CmList'][_0x4c91('0x4a')]({'where':{'id':_0x3722e8[_0x4c91('0x47')]['id']},'include':[{'model':db[_0x4c91('0x6c')],'as':_0x4c91('0x66')}]})[_0x4c91('0x2c')](handleEntityNotFound(_0x395dfb,null))['then'](function(_0x53d407){if(_0x53d407){_0x3a1b93=_0x53d407;return db['CmContact']['rawAttributes'];}})['then'](function(_0x2ef898){if(_0x2ef898){var _0x275e28={};var _0x552f05={};_0x552f05[_0x4c91('0x34')]=_[_0x4c91('0x67')](_[_0x4c91('0x35')](_0x2ef898),_[_0x4c91('0x30')](_0x3a1b93[_0x4c91('0x66')],function(_0x1d672e){return util[_0x4c91('0x68')](_0x4c91('0x69'),_0x1d672e['id']);}));_0x552f05[_0x4c91('0x36')]=_[_0x4c91('0x35')](_0x3722e8[_0x4c91('0x36')]);_0x552f05[_0x4c91('0x3e')]=_['intersection'](_0x552f05[_0x4c91('0x34')],_0x552f05[_0x4c91('0x36')]);_0x275e28[_0x4c91('0x38')]=_[_0x4c91('0x37')](_0x552f05[_0x4c91('0x34')],qs[_0x4c91('0x39')](_0x3722e8[_0x4c91('0x36')][_0x4c91('0x39')]));_0x275e28['attributes']=_0x275e28[_0x4c91('0x38')]['length']?_0x275e28[_0x4c91('0x38')]:_0x552f05[_0x4c91('0x34')];if(!_0x3722e8['query'][_0x4c91('0x5a')](_0x4c91('0x3a'))){_0x275e28[_0x4c91('0x22')]=qs[_0x4c91('0x22')](_0x3722e8[_0x4c91('0x36')][_0x4c91('0x22')]);_0x275e28['offset']=qs[_0x4c91('0x24')](_0x3722e8['query']['offset']);}_0x275e28[_0x4c91('0x3b')]=qs[_0x4c91('0x3c')](_0x3722e8[_0x4c91('0x36')][_0x4c91('0x3c')]);_0x275e28['where']=qs[_0x4c91('0x3e')](_[_0x4c91('0x3f')](_0x3722e8[_0x4c91('0x36')],_0x552f05['filters']));_0x275e28[_0x4c91('0x6a')]=!![];if(_0x3722e8[_0x4c91('0x36')][_0x4c91('0x40')]){_0x275e28[_0x4c91('0x3d')]=_[_0x4c91('0x41')](_0x275e28[_0x4c91('0x3d')],{'$or':_[_0x4c91('0x30')](_0x275e28['attributes'],function(_0x59a384){var _0x4f287b={};_0x4f287b[_0x59a384]={'$like':'%'+_0x3722e8['query']['filter']+'%'};return _0x4f287b;})});}_0x275e28=_['merge']({},_0x275e28,_0x3722e8[_0x4c91('0x42')]);return _0x3a1b93[_0x4c91('0x65')](_0x275e28);}})[_0x4c91('0x2c')](function(_0x512784){if(!_['isEmpty'](_0x512784)){var _0x53ebc9=toCsv(_0x512784);var _0x58c4cf=Date[_0x4c91('0x6d')]();fs[_0x4c91('0x6e')](util[_0x4c91('0x68')](_0x4c91('0x6f'),_0x3a1b93['id'],_0x58c4cf),_0x53ebc9);_0x395dfb['setHeader'](_0x4c91('0x70'),_0x4c91('0x71')+util[_0x4c91('0x68')](_0x4c91('0x72'),_0x3a1b93['id'],_0x58c4cf));_0x395dfb['setHeader'](_0x4c91('0x73'),_0x4c91('0x74'));return _0x395dfb[_0x4c91('0x75')](util['format'](_0x4c91('0x6f'),_0x3a1b93['id'],_0x58c4cf));}else{return _0x395dfb[_0x4c91('0x1f')](0xcc);}})['catch'](handleError(_0x395dfb,null));};exports['addCustomField']=function(_0x45a7fe,_0x5caa91,_0x2b884b){var _0x3c2421;delete _0x45a7fe[_0x4c91('0x4d')]['id'];return db['CmList'][_0x4c91('0x59')]({'where':{'id':_0x45a7fe['params']['id']}})['then'](handleEntityNotFound(_0x5caa91,null))[_0x4c91('0x2c')](function(_0x1d27f6){if(_0x1d27f6){return db[_0x4c91('0x76')][_0x4c91('0x77')](function(_0x16ba54){return db[_0x4c91('0x6c')][_0x4c91('0x4c')](_0x45a7fe[_0x4c91('0x4d')],{'transaction':_0x16ba54})[_0x4c91('0x2c')](function(_0x5cb915){_0x3c2421=_0x5cb915;return _0x1d27f6['addCustomFields'](_0x5cb915,{'transaction':_0x16ba54});})[_0x4c91('0x2c')](function(){var _0x8264e2={'type':db[_0x4c91('0x78')][_0x4c91('0x79')],'transaction':_0x16ba54};switch(_0x45a7fe[_0x4c91('0x4d')][_0x4c91('0x32')]){case _0x4c91('0x7a'):_0x8264e2[_0x4c91('0x32')]=db[_0x4c91('0x78')][_0x4c91('0x79')];break;case _0x4c91('0x7b'):_0x8264e2[_0x4c91('0x32')]=db[_0x4c91('0x78')][_0x4c91('0x7c')];break;case _0x4c91('0x7d'):_0x8264e2[_0x4c91('0x32')]=db[_0x4c91('0x78')][_0x4c91('0x7e')];_0x8264e2[_0x4c91('0x7f')]=![];break;default:}return db[_0x4c91('0x76')][_0x4c91('0x80')][_0x4c91('0x81')](_0x4c91('0x82'),util[_0x4c91('0x68')](_0x4c91('0x83'),_0x3c2421['id']),_0x8264e2);})[_0x4c91('0x2c')](function(){return _0x3c2421;});});}})[_0x4c91('0x2c')](respondWithResult(_0x5caa91,null))[_0x4c91('0x4b')](handleError(_0x5caa91,null));};exports[_0x4c91('0x84')]=function(_0x481520,_0x58d1f4,_0x51206f){var _0x2b3de0={};var _0x3e410b={};var _0x3a4951;var _0x405e62;return db[_0x4c91('0x31')][_0x4c91('0x59')]({'where':{'id':_0x481520[_0x4c91('0x47')]['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0x58d1f4,null))[_0x4c91('0x2c')](function(_0x3463e6){if(_0x3463e6){_0x3a4951=_0x3463e6;_0x3e410b[_0x4c91('0x34')]=_[_0x4c91('0x35')](db[_0x4c91('0x6c')][_0x4c91('0x48')]);_0x3e410b[_0x4c91('0x36')]=_[_0x4c91('0x35')](_0x481520[_0x4c91('0x36')]);_0x3e410b[_0x4c91('0x3e')]=_[_0x4c91('0x37')](_0x3e410b[_0x4c91('0x34')],_0x3e410b['query']);_0x2b3de0[_0x4c91('0x38')]=_[_0x4c91('0x37')](_0x3e410b[_0x4c91('0x34')],qs[_0x4c91('0x39')](_0x481520[_0x4c91('0x36')][_0x4c91('0x39')]));_0x2b3de0[_0x4c91('0x38')]=_0x2b3de0[_0x4c91('0x38')][_0x4c91('0x49')]?_0x2b3de0['attributes']:_0x3e410b[_0x4c91('0x34')];_0x2b3de0[_0x4c91('0x3b')]=qs['sort'](_0x481520[_0x4c91('0x36')][_0x4c91('0x3c')]);_0x2b3de0[_0x4c91('0x3d')]=qs[_0x4c91('0x3e')](_[_0x4c91('0x3f')](_0x481520['query'],_0x3e410b['filters']));_0x2b3de0[_0x4c91('0x3d')]=_[_0x4c91('0x41')](_0x2b3de0[_0x4c91('0x3d')],{'$or':[{'ListId':_0x3463e6['id']},{'ListId':null}]});if(_0x481520['query'][_0x4c91('0x40')]){_0x2b3de0[_0x4c91('0x3d')]=_[_0x4c91('0x41')](_0x2b3de0['where'],{'$or':_['map'](_0x2b3de0[_0x4c91('0x38')],function(_0x4b9954){var _0x189c52={};_0x189c52[_0x4b9954]={'$like':'%'+_0x481520[_0x4c91('0x36')][_0x4c91('0x40')]+'%'};return _0x189c52;})});}_0x2b3de0=_[_0x4c91('0x41')]({},_0x2b3de0,_0x481520[_0x4c91('0x42')]);return db[_0x4c91('0x6c')]['findAndCountAll'](_0x2b3de0);}})[_0x4c91('0x2c')](respondWithResult(_0x58d1f4,null))['catch'](handleError(_0x58d1f4,null));};exports[_0x4c91('0x85')]=function(_0x14e673,_0x3e7917,_0x1f7c02){return db[_0x4c91('0x31')][_0x4c91('0x4a')]({'where':{'id':_0x14e673[_0x4c91('0x47')]['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0x3e7917,null))[_0x4c91('0x2c')](function(_0x4ea19d){if(_0x4ea19d){return _0x4ea19d[_0x4c91('0x85')](_0x14e673[_0x4c91('0x4d')]['ids'],_['omit'](_0x14e673[_0x4c91('0x4d')],[_0x4c91('0x5d'),'id'])||{})[_0x4c91('0x86')](function(_0x330a7c){for(var _0x4b72bb=0x0;_0x4b72bb<_0x14e673[_0x4c91('0x4d')][_0x4c91('0x5d')][_0x4c91('0x49')];_0x4b72bb+=0x1){socket[_0x4c91('0x87')](_0x4c91('0x88'),{'UserId':Number(_0x14e673[_0x4c91('0x4d')][_0x4c91('0x5d')][_0x4b72bb]),'CmListId':Number(_0x14e673[_0x4c91('0x47')]['id'])});}return _0x330a7c;});}})[_0x4c91('0x2c')](respondWithResult(_0x3e7917,null))[_0x4c91('0x4b')](handleError(_0x3e7917,null));};exports[_0x4c91('0x89')]=function(_0x33fe53,_0x41ce07,_0x5cb48c){return db[_0x4c91('0x31')][_0x4c91('0x4a')]({'where':{'id':_0x33fe53[_0x4c91('0x47')]['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0x41ce07,null))[_0x4c91('0x2c')](function(_0x4a5f1b){if(_0x4a5f1b){return _0x4a5f1b[_0x4c91('0x89')](_0x33fe53[_0x4c91('0x36')][_0x4c91('0x5d')])['then'](function(){if(_[_0x4c91('0x5f')](_0x33fe53['query'][_0x4c91('0x5d')])){for(var _0x15ce25=0x0;_0x15ce25<_0x33fe53[_0x4c91('0x36')]['ids']['length'];_0x15ce25+=0x1){socket['emit'](_0x4c91('0x8a'),{'UserId':Number(_0x33fe53[_0x4c91('0x36')][_0x4c91('0x5d')][_0x15ce25]),'CmListId':Number(_0x33fe53[_0x4c91('0x47')]['id'])});}}else{socket[_0x4c91('0x87')](_0x4c91('0x8a'),{'UserId':Number(_0x33fe53[_0x4c91('0x36')]['ids']),'CmListId':Number(_0x33fe53[_0x4c91('0x47')]['id'])});}});}})[_0x4c91('0x2c')](respondWithStatusCode(_0x41ce07,null))[_0x4c91('0x4b')](handleError(_0x41ce07,null));};exports[_0x4c91('0x8b')]=function(_0x495571,_0x3adb72,_0x2822ae){var _0x55e34f={};var _0xb1ebdc={};var _0x556ab8;var _0x32478f;return db[_0x4c91('0x31')]['findOne']({'where':{'id':_0x495571[_0x4c91('0x47')]['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0x3adb72,null))['then'](function(_0x155780){if(_0x155780){_0x556ab8=_0x155780;_0xb1ebdc[_0x4c91('0x34')]=_[_0x4c91('0x35')](db[_0x4c91('0x8c')]['rawAttributes']);_0xb1ebdc[_0x4c91('0x36')]=_[_0x4c91('0x35')](_0x495571[_0x4c91('0x36')]);_0xb1ebdc['filters']=_[_0x4c91('0x37')](_0xb1ebdc[_0x4c91('0x34')],_0xb1ebdc[_0x4c91('0x36')]);_0x55e34f[_0x4c91('0x38')]=_['intersection'](_0xb1ebdc[_0x4c91('0x34')],qs[_0x4c91('0x39')](_0x495571[_0x4c91('0x36')][_0x4c91('0x39')]));_0x55e34f[_0x4c91('0x38')]=_0x55e34f[_0x4c91('0x38')][_0x4c91('0x49')]?_0x55e34f[_0x4c91('0x38')]:_0xb1ebdc[_0x4c91('0x34')];_0x55e34f['order']=qs[_0x4c91('0x3c')](_0x495571[_0x4c91('0x36')][_0x4c91('0x3c')]);_0x55e34f[_0x4c91('0x3d')]=qs[_0x4c91('0x3e')](_[_0x4c91('0x3f')](_0x495571[_0x4c91('0x36')],_0xb1ebdc[_0x4c91('0x3e')]));if(_0x495571['query'][_0x4c91('0x40')]){_0x55e34f[_0x4c91('0x3d')]=_[_0x4c91('0x41')](_0x55e34f[_0x4c91('0x3d')],{'$or':_[_0x4c91('0x30')](_0x55e34f['attributes'],function(_0x1d52dc){var _0x5054fd={};_0x5054fd[_0x1d52dc]={'$like':'%'+_0x495571[_0x4c91('0x36')][_0x4c91('0x40')]+'%'};return _0x5054fd;})});}_0x55e34f=_[_0x4c91('0x41')]({},_0x55e34f,_0x495571[_0x4c91('0x42')]);return _0x556ab8[_0x4c91('0x8b')](_0x55e34f);}})['then'](function(_0x59c189){if(_0x59c189){_0x32478f=_0x59c189[_0x4c91('0x49')];if(!_0x495571[_0x4c91('0x36')][_0x4c91('0x5a')](_0x4c91('0x3a'))){_0x55e34f[_0x4c91('0x22')]=qs[_0x4c91('0x22')](_0x495571[_0x4c91('0x36')]['limit']);_0x55e34f[_0x4c91('0x24')]=qs[_0x4c91('0x24')](_0x495571[_0x4c91('0x36')][_0x4c91('0x24')]);}return _0x556ab8[_0x4c91('0x8b')](_0x55e34f);}})['then'](function(_0x53e7bd){if(_0x53e7bd){return _0x53e7bd?{'count':_0x32478f,'rows':_0x53e7bd}:null;}})[_0x4c91('0x2c')](respondWithResult(_0x3adb72,null))[_0x4c91('0x4b')](handleError(_0x3adb72,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index d7cb798..30fa364 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 _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x326f,0xd1));var _0xf326=function(_0x53b505,_0x25086f){_0x53b505=_0x53b505-0x0;var _0x2b4fb4=_0x326f[_0x53b505];return _0x2b4fb4;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0x7217,0x19e));var _0x7721=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x7217[_0x1c546c];return _0x2cc384;};'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 diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 12b5621..3fd42fc 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 _0x0a9a=['bluebird','request-promise','rimraf','../../config/environment','exports','define','cm_lists','util','api','moment'];(function(_0xb64d0c,_0x4eed6b){var _0x39cf07=function(_0x1162a5){while(--_0x1162a5){_0xb64d0c['push'](_0xb64d0c['shift']());}};_0x39cf07(++_0x4eed6b);}(_0x0a9a,0x183));var _0xa0a9=function(_0x15781e,_0x264aa1){_0x15781e=_0x15781e-0x0;var _0x3f30bf=_0x0a9a[_0x15781e];return _0x3f30bf;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var logger=require('../../config/logger')(_0xa0a9('0x1'));var moment=require(_0xa0a9('0x2'));var BPromise=require(_0xa0a9('0x3'));var rp=require(_0xa0a9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var attributes=require('./cmList.attributes');module[_0xa0a9('0x7')]=function(_0xc65bbb,_0x1aa717){return _0xc65bbb[_0xa0a9('0x8')]('CmList',attributes,{'tableName':_0xa0a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3cd=['path','rimraf','../../config/environment','exports','define','CmList','cm_lists','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x32a132,_0x48723d){var _0x32a726=function(_0x519b32){while(--_0x519b32){_0x32a132['push'](_0x32a132['shift']());}};_0x32a726(++_0x48723d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3a634e,_0x273db2){_0x3a634e=_0x3a634e-0x0;var _0x2ecddb=_0xf3cd[_0x3a634e];return _0x2ecddb;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./cmList.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 79fe9fb..e9b7d86 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 _0xb91f=['CmList,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmList.socket','register','then','CmList,\x20%s,\x20%s','debug'];(function(_0xe2c227,_0x4cf94c){var _0x40c901=function(_0x36426f){while(--_0x36426f){_0xe2c227['push'](_0xe2c227['shift']());}};_0x40c901(++_0x4cf94c);}(_0xb91f,0x1c2));var _0xfb91=function(_0x51bd06,_0x4576f0){_0x51bd06=_0x51bd06-0x0;var _0x4a3e67=_0xb91f[_0x51bd06];return _0x4a3e67;};'use strict';var _=require(_0xfb91('0x0'));var util=require('util');var moment=require(_0xfb91('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb91('0x2'));var db=require(_0xfb91('0x3'))['db'];var utils=require(_0xfb91('0x4'));var logger=require(_0xfb91('0x5'))(_0xfb91('0x6'));var config=require(_0xfb91('0x7'));var jayson=require(_0xfb91('0x8'));var client=jayson[_0xfb91('0x9')][_0xfb91('0xa')]({'port':0x232a});config[_0xfb91('0xb')]=_['defaults'](config['redis'],{'host':_0xfb91('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb91('0xb')]));require(_0xfb91('0xd'))[_0xfb91('0xe')](socket);function respondWithRpcPromise(_0x4a9415,_0x491f48,_0x3e8191){return new BPromise(function(_0x55d20d,_0x11d06b){return client['request'](_0x4a9415,_0x3e8191)[_0xfb91('0xf')](function(_0x259ff1){logger['info'](_0xfb91('0x10'),_0x491f48,'request\x20sent');logger[_0xfb91('0x11')](_0xfb91('0x12'),_0x491f48,_0xfb91('0x13'),JSON['stringify'](_0x259ff1));if(_0x259ff1[_0xfb91('0x14')]){if(_0x259ff1['error'][_0xfb91('0x15')]===0x1f4){logger['error'](_0xfb91('0x10'),_0x491f48,_0x259ff1[_0xfb91('0x14')][_0xfb91('0x16')]);return _0x11d06b(_0x259ff1[_0xfb91('0x14')]['message']);}logger[_0xfb91('0x14')](_0xfb91('0x10'),_0x491f48,_0x259ff1[_0xfb91('0x14')]['message']);return _0x55d20d(_0x259ff1[_0xfb91('0x14')][_0xfb91('0x16')]);}else{logger[_0xfb91('0x17')]('CmList,\x20%s,\x20%s',_0x491f48,'request\x20sent');_0x55d20d(_0x259ff1[_0xfb91('0x18')][_0xfb91('0x16')]);}})[_0xfb91('0x19')](function(_0x3c1826){logger[_0xfb91('0x14')](_0xfb91('0x10'),_0x491f48,_0x3c1826);_0x11d06b(_0x3c1826);});});} \ No newline at end of file +var _0x76e3=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmList,\x20%s,\x20%s'];(function(_0x3599a3,_0x303d80){var _0x428b04=function(_0x1559bf){while(--_0x1559bf){_0x3599a3['push'](_0x3599a3['shift']());}};_0x428b04(++_0x303d80);}(_0x76e3,0x14c));var _0x376e=function(_0x1ec792,_0xe9bdf7){_0x1ec792=_0x1ec792-0x0;var _0x3051a0=_0x76e3[_0x1ec792];return _0x3051a0;};'use strict';var _=require(_0x376e('0x0'));var util=require(_0x376e('0x1'));var moment=require(_0x376e('0x2'));var BPromise=require(_0x376e('0x3'));var rs=require(_0x376e('0x4'));var fs=require('fs');var Redis=require(_0x376e('0x5'));var db=require(_0x376e('0x6'))['db'];var utils=require(_0x376e('0x7'));var logger=require(_0x376e('0x8'))(_0x376e('0x9'));var config=require(_0x376e('0xa'));var jayson=require(_0x376e('0xb'));var client=jayson[_0x376e('0xc')][_0x376e('0xd')]({'port':0x232a});config[_0x376e('0xe')]=_[_0x376e('0xf')](config[_0x376e('0xe')],{'host':_0x376e('0x10'),'port':0x18eb});var socket=require(_0x376e('0x11'))(new Redis(config[_0x376e('0xe')]));require('./cmList.socket')[_0x376e('0x12')](socket);function respondWithRpcPromise(_0x5c3c69,_0x401c02,_0x18cf0d){return new BPromise(function(_0xf55405,_0x14d9db){return client[_0x376e('0x13')](_0x5c3c69,_0x18cf0d)[_0x376e('0x14')](function(_0x416860){logger[_0x376e('0x15')]('CmList,\x20%s,\x20%s',_0x401c02,'request\x20sent');logger[_0x376e('0x16')](_0x376e('0x17'),_0x401c02,_0x376e('0x18'),JSON[_0x376e('0x19')](_0x416860));if(_0x416860[_0x376e('0x1a')]){if(_0x416860['error']['code']===0x1f4){logger[_0x376e('0x1a')](_0x376e('0x1b'),_0x401c02,_0x416860[_0x376e('0x1a')][_0x376e('0x1c')]);return _0x14d9db(_0x416860[_0x376e('0x1a')][_0x376e('0x1c')]);}logger[_0x376e('0x1a')](_0x376e('0x1b'),_0x401c02,_0x416860[_0x376e('0x1a')][_0x376e('0x1c')]);return _0xf55405(_0x416860['error'][_0x376e('0x1c')]);}else{logger[_0x376e('0x15')](_0x376e('0x1b'),_0x401c02,_0x376e('0x18'));_0xf55405(_0x416860['result']['message']);}})[_0x376e('0x1d')](function(_0x1bfbde){logger[_0x376e('0x1a')](_0x376e('0x1b'),_0x401c02,_0x1bfbde);_0x14d9db(_0x1bfbde);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index d088083..ad8fdd1 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 _0x7960=['length','cmList:','save','remove','update','emit','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7960,0xf0));var _0x0796=function(_0x22878e,_0x2a5290){_0x22878e=_0x22878e-0x0;var _0x51e0d8=_0x7960[_0x22878e];return _0x51e0d8;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x0796('0x0'),_0x0796('0x1'),_0x0796('0x2')];function createListener(_0x229fb4,_0x26bb73){return function(_0x20cf4e){_0x26bb73[_0x0796('0x3')](_0x229fb4,_0x20cf4e);};}function removeListener(_0x4af816,_0x2d3ce1){return function(){CmListEvents['removeListener'](_0x4af816,_0x2d3ce1);};}exports[_0x0796('0x4')]=function(_0x46fa1e){for(var _0x4d1184=0x0,_0x3afd04=events[_0x0796('0x5')];_0x4d1184<_0x3afd04;_0x4d1184++){var _0x399527=events[_0x4d1184];var _0x14b1b0=createListener(_0x0796('0x6')+_0x399527,_0x46fa1e);CmListEvents['on'](_0x399527,_0x14b1b0);}}; \ No newline at end of file +var _0xe24f=['remove','emit','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x31cb0e,_0x14b7ea){var _0x4e7bc2=function(_0x19e568){while(--_0x19e568){_0x31cb0e['push'](_0x31cb0e['shift']());}};_0x4e7bc2(++_0x14b7ea);}(_0xe24f,0x1d6));var _0xfe24=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe24f[_0x20a584];return _0x4b41a8;};'use strict';var CmListEvents=require(_0xfe24('0x0'));var events=[_0xfe24('0x1'),_0xfe24('0x2'),'update'];function createListener(_0x5440b3,_0x1d3d75){return function(_0x3f26d2){_0x1d3d75[_0xfe24('0x3')](_0x5440b3,_0x3f26d2);};}function removeListener(_0x59af7a,_0xbc3dc){return function(){CmListEvents[_0xfe24('0x4')](_0x59af7a,_0xbc3dc);};}exports[_0xfe24('0x5')]=function(_0xd2e36){for(var _0x3a2cda=0x0,_0x4a55c2=events[_0xfe24('0x6')];_0x3a2cda<_0x4a55c2;_0x3a2cda++){var _0x2b04bd=events[_0x3a2cda];var _0x4f4b20=createListener(_0xfe24('0x7')+_0x2b04bd,_0xd2e36);CmListEvents['on'](_0x2b04bd,_0x4f4b20);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index c2ea0e9..2e9daf9 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 _0xf160=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','post','create','addDisposition','addContacts','addAgents','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf160,0x165));var _0x0f16=function(_0x4f2b6a,_0x40583f){_0x4f2b6a=_0x4f2b6a-0x0;var _0x140925=_0xf160[_0x4f2b6a];return _0x140925;};'use strict';var multer=require('multer');var util=require(_0x0f16('0x0'));var path=require(_0x0f16('0x1'));var timeout=require(_0x0f16('0x2'));var express=require(_0x0f16('0x3'));var router=express['Router']();var fs_extra=require(_0x0f16('0x4'));var auth=require(_0x0f16('0x5'));var interaction=require(_0x0f16('0x6'));var config=require(_0x0f16('0x7'));var controller=require('./cmList.controller');router[_0x0f16('0x8')]('/',auth[_0x0f16('0x9')](),controller['index']);router[_0x0f16('0x8')](_0x0f16('0xa'),auth[_0x0f16('0x9')](),controller[_0x0f16('0xb')]);router[_0x0f16('0x8')](_0x0f16('0xc'),auth[_0x0f16('0x9')](),controller[_0x0f16('0xd')]);router[_0x0f16('0x8')](_0x0f16('0xe'),auth[_0x0f16('0x9')](),controller['getDispositions']);router[_0x0f16('0x8')](_0x0f16('0xf'),auth[_0x0f16('0x9')](),controller[_0x0f16('0x10')]);router[_0x0f16('0x8')](_0x0f16('0x11'),auth[_0x0f16('0x9')](),controller[_0x0f16('0x12')]);router[_0x0f16('0x8')](_0x0f16('0x13'),auth[_0x0f16('0x9')](),controller['getCustomFields']);router[_0x0f16('0x8')](_0x0f16('0x14'),auth[_0x0f16('0x9')](),controller[_0x0f16('0x15')]);router[_0x0f16('0x16')]('/',auth[_0x0f16('0x9')](),controller[_0x0f16('0x17')]);router[_0x0f16('0x16')](_0x0f16('0xe'),auth['isAuthenticated'](),controller[_0x0f16('0x18')]);router['post']('/:id/contacts',auth[_0x0f16('0x9')](),controller[_0x0f16('0x19')]);router[_0x0f16('0x16')](_0x0f16('0x13'),auth[_0x0f16('0x9')](),controller['addCustomField']);router[_0x0f16('0x16')](_0x0f16('0x14'),auth['isAuthenticated'](),controller[_0x0f16('0x1a')]);router['put'](_0x0f16('0xc'),auth[_0x0f16('0x9')](),controller[_0x0f16('0x1b')]);router[_0x0f16('0x1c')](_0x0f16('0xc'),auth[_0x0f16('0x9')](),controller[_0x0f16('0x1d')]);router[_0x0f16('0x1c')](_0x0f16('0xe'),auth['isAuthenticated'](),controller[_0x0f16('0x1e')]);router[_0x0f16('0x1c')](_0x0f16('0x14'),auth[_0x0f16('0x9')](),controller[_0x0f16('0x1f')]);module[_0x0f16('0x20')]=router; \ No newline at end of file +var _0x3009=['connect-timeout','express','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/fields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','put','/:id','update','delete','removeDispositions','exports','multer','util','path'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x3009,0x152));var _0x9300=function(_0x67cdef,_0x4fab65){_0x67cdef=_0x67cdef-0x0;var _0xc78571=_0x3009[_0x67cdef];return _0xc78571;};'use strict';var multer=require(_0x9300('0x0'));var util=require(_0x9300('0x1'));var path=require(_0x9300('0x2'));var timeout=require(_0x9300('0x3'));var express=require(_0x9300('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9300('0x5'));var config=require(_0x9300('0x6'));var controller=require(_0x9300('0x7'));router[_0x9300('0x8')]('/',auth[_0x9300('0x9')](),controller[_0x9300('0xa')]);router[_0x9300('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x9300('0xb')]);router[_0x9300('0x8')]('/:id',auth[_0x9300('0x9')](),controller[_0x9300('0xc')]);router[_0x9300('0x8')](_0x9300('0xd'),auth[_0x9300('0x9')](),controller[_0x9300('0xe')]);router[_0x9300('0x8')](_0x9300('0xf'),auth[_0x9300('0x9')](),controller[_0x9300('0x10')]);router[_0x9300('0x8')]('/:id/contacts/csv',auth[_0x9300('0x9')](),controller['getContactsCsv']);router[_0x9300('0x8')](_0x9300('0x11'),auth['isAuthenticated'](),controller['getCustomFields']);router[_0x9300('0x8')](_0x9300('0x12'),auth[_0x9300('0x9')](),controller[_0x9300('0x13')]);router[_0x9300('0x14')]('/',auth[_0x9300('0x9')](),controller[_0x9300('0x15')]);router['post'](_0x9300('0xd'),auth[_0x9300('0x9')](),controller[_0x9300('0x16')]);router[_0x9300('0x14')](_0x9300('0xf'),auth[_0x9300('0x9')](),controller[_0x9300('0x17')]);router[_0x9300('0x14')](_0x9300('0x11'),auth[_0x9300('0x9')](),controller[_0x9300('0x18')]);router[_0x9300('0x14')](_0x9300('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0x9300('0x19')](_0x9300('0x1a'),auth[_0x9300('0x9')](),controller[_0x9300('0x1b')]);router[_0x9300('0x1c')](_0x9300('0x1a'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9300('0x1d')]);router[_0x9300('0x1c')](_0x9300('0x12'),auth[_0x9300('0x9')](),controller['removeAgents']);module[_0x9300('0x1e')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index b618fe6..5680444 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 _0xf976=['VIRTUAL','field','STRING'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xf976,0x81));var _0x6f97=function(_0x11b09f,_0x3ebc15){_0x11b09f=_0x11b09f-0x0;var _0x11306c=_0xf976[_0x11b09f];return _0x11306c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6f97('0x0')],'get':function(_0xd76078){return this['getDataValue'](_0x6f97('0x1'));}},'field':{'type':Sequelize[_0x6f97('0x2')],'allowNull':![]},'operator':{'type':Sequelize[_0x6f97('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x6f97('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x245d=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0xe62c94,_0x185f32){var _0x3c512e=function(_0x197406){while(--_0x197406){_0xe62c94['push'](_0xe62c94['shift']());}};_0x3c512e(++_0x185f32);}(_0x245d,0x11e));var _0xd245=function(_0x5aa253,_0x4c85e1){_0x5aa253=_0x5aa253-0x0;var _0x5b82ef=_0x245d[_0x5aa253];return _0x5b82ef;};'use strict';var Sequelize=require(_0xd245('0x0'));module[_0xd245('0x1')]={'name':{'type':Sequelize[_0xd245('0x2')],'get':function(_0x27775d){return this['getDataValue'](_0xd245('0x3'));}},'field':{'type':Sequelize[_0xd245('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xd245('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xd245('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 4b0978b..0392a03 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(_0x58d87c,_0x23409b){var _0x15f443=function(_0x62f9a0){while(--_0x62f9a0){_0x58d87c['push'](_0x58d87c['shift']());}};_0x15f443(++_0x23409b);}(_0x7a54,0x106));var _0x47a5=function(_0x3e89a5,_0x54e0c7){_0x3e89a5=_0x3e89a5-0x0;var _0x25b6e0=_0x7a54[_0x3e89a5];return _0x25b6e0;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x5454b1,_0x1936aa){var _0x3b9e41=function(_0x40a418){while(--_0x40a418){_0x5454b1['push'](_0x5454b1['shift']());}};_0x3b9e41(++_0x1936aa);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index a95e8b5..da0da1b 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 _0x6fa2=['define','Condition','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6fa2,0xe6));var _0x26fa=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x6fa2[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require(_0x26fa('0x0'));var logger=require('../../config/logger')(_0x26fa('0x1'));var moment=require(_0x26fa('0x2'));var BPromise=require(_0x26fa('0x3'));var rp=require(_0x26fa('0x4'));var fs=require('fs');var path=require(_0x26fa('0x5'));var rimraf=require(_0x26fa('0x6'));var config=require(_0x26fa('0x7'));var attributes=require(_0x26fa('0x8'));module[_0x26fa('0x9')]=function(_0x3c3e83,_0x183e43){return _0x3c3e83[_0x26fa('0xa')](_0x26fa('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce1e=['path','rimraf','../../config/environment','./condition.attributes','Condition','tools_conditions','lodash','util','api','bluebird','request-promise'];(function(_0x396cda,_0x274c16){var _0x270107=function(_0x4f822e){while(--_0x4f822e){_0x396cda['push'](_0x396cda['shift']());}};_0x270107(++_0x274c16);}(_0xce1e,0x171));var _0xece1=function(_0x285d39,_0x587c0b){_0x285d39=_0x285d39-0x0;var _0x2cb8c3=_0xce1e[_0x285d39];return _0x2cb8c3;};'use strict';var _=require(_0xece1('0x0'));var util=require(_0xece1('0x1'));var logger=require('../../config/logger')(_0xece1('0x2'));var moment=require('moment');var BPromise=require(_0xece1('0x3'));var rp=require(_0xece1('0x4'));var fs=require('fs');var path=require(_0xece1('0x5'));var rimraf=require(_0xece1('0x6'));var config=require(_0xece1('0x7'));var attributes=require(_0xece1('0x8'));module['exports']=function(_0x4f4b99,_0x2553db){return _0x4f4b99['define'](_0xece1('0x9'),attributes,{'tableName':_0xece1('0xa'),'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 3d7de76..503759d 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 _0xa41b=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5a7d5f,_0x5695cb){var _0x5dcded=function(_0x13f053){while(--_0x13f053){_0x5a7d5f['push'](_0x5a7d5f['shift']());}};_0x5dcded(++_0x5695cb);}(_0xa41b,0x11a));var _0xba41=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0xa41b[_0x11946c];return _0x383935;};'use strict';var _=require(_0xba41('0x0'));var util=require(_0xba41('0x1'));var moment=require(_0xba41('0x2'));var BPromise=require(_0xba41('0x3'));var rs=require(_0xba41('0x4'));var fs=require('fs');var Redis=require(_0xba41('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xba41('0x6'));var logger=require(_0xba41('0x7'))(_0xba41('0x8'));var config=require('../../config/environment');var jayson=require(_0xba41('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2444ca,_0x42863b,_0x341bea){return new BPromise(function(_0x3d5bb7,_0x464d2a){return client[_0xba41('0xa')](_0x2444ca,_0x341bea)['then'](function(_0x58e48f){logger[_0xba41('0xb')]('Condition,\x20%s,\x20%s',_0x42863b,'request\x20sent');logger[_0xba41('0xc')](_0xba41('0xd'),_0x42863b,_0xba41('0xe'),JSON[_0xba41('0xf')](_0x58e48f));if(_0x58e48f[_0xba41('0x10')]){if(_0x58e48f[_0xba41('0x10')][_0xba41('0x11')]===0x1f4){logger[_0xba41('0x10')](_0xba41('0x12'),_0x42863b,_0x58e48f[_0xba41('0x10')][_0xba41('0x13')]);return _0x464d2a(_0x58e48f['error'][_0xba41('0x13')]);}logger[_0xba41('0x10')](_0xba41('0x12'),_0x42863b,_0x58e48f[_0xba41('0x10')][_0xba41('0x13')]);return _0x3d5bb7(_0x58e48f[_0xba41('0x10')][_0xba41('0x13')]);}else{logger[_0xba41('0xb')](_0xba41('0x12'),_0x42863b,_0xba41('0xe'));_0x3d5bb7(_0x58e48f[_0xba41('0x14')][_0xba41('0x13')]);}})[_0xba41('0x15')](function(_0x1884af){logger[_0xba41('0x10')]('Condition,\x20%s,\x20%s',_0x42863b,_0x1884af);_0x464d2a(_0x1884af);});});} \ No newline at end of file +var _0xa389=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1abd18,_0xf44d37){var _0x221f16=function(_0x2aa5f7){while(--_0x2aa5f7){_0x1abd18['push'](_0x1abd18['shift']());}};_0x221f16(++_0xf44d37);}(_0xa389,0xfe));var _0x9a38=function(_0x1e05f9,_0x369a14){_0x1e05f9=_0x1e05f9-0x0;var _0x132bbb=_0xa389[_0x1e05f9];return _0x132bbb;};'use strict';var _=require(_0x9a38('0x0'));var util=require('util');var moment=require(_0x9a38('0x1'));var BPromise=require(_0x9a38('0x2'));var rs=require(_0x9a38('0x3'));var fs=require('fs');var Redis=require(_0x9a38('0x4'));var db=require(_0x9a38('0x5'))['db'];var utils=require(_0x9a38('0x6'));var logger=require('../../config/logger')(_0x9a38('0x7'));var config=require(_0x9a38('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9a38('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x386f57,_0x1be649,_0x399e23){return new BPromise(function(_0x305d21,_0x3015c2){return client[_0x9a38('0xa')](_0x386f57,_0x399e23)[_0x9a38('0xb')](function(_0xc663e6){logger[_0x9a38('0xc')](_0x9a38('0xd'),_0x1be649,_0x9a38('0xe'));logger[_0x9a38('0xf')](_0x9a38('0x10'),_0x1be649,_0x9a38('0xe'),JSON[_0x9a38('0x11')](_0xc663e6));if(_0xc663e6[_0x9a38('0x12')]){if(_0xc663e6[_0x9a38('0x12')][_0x9a38('0x13')]===0x1f4){logger[_0x9a38('0x12')](_0x9a38('0xd'),_0x1be649,_0xc663e6['error'][_0x9a38('0x14')]);return _0x3015c2(_0xc663e6['error']['message']);}logger[_0x9a38('0x12')]('Condition,\x20%s,\x20%s',_0x1be649,_0xc663e6[_0x9a38('0x12')][_0x9a38('0x14')]);return _0x305d21(_0xc663e6[_0x9a38('0x12')]['message']);}else{logger[_0x9a38('0xc')](_0x9a38('0xd'),_0x1be649,_0x9a38('0xe'));_0x305d21(_0xc663e6[_0x9a38('0x15')][_0x9a38('0x14')]);}})[_0x9a38('0x16')](function(_0x17daf6){logger[_0x9a38('0x12')](_0x9a38('0xd'),_0x1be649,_0x17daf6);_0x3015c2(_0x17daf6);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 95f8337..b3ee71b 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 _0xced5=['destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','put','isAuthenticated','update','delete','/:id'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xced5,0x8e));var _0x5ced=function(_0x5e3c4e,_0x28d998){_0x5e3c4e=_0x5e3c4e-0x0;var _0x1044b6=_0xced5[_0x5e3c4e];return _0x1044b6;};'use strict';var multer=require(_0x5ced('0x0'));var util=require(_0x5ced('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5ced('0x2'));var router=express[_0x5ced('0x3')]();var fs_extra=require(_0x5ced('0x4'));var auth=require(_0x5ced('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5ced('0x6'));var controller=require('./condition.controller');router[_0x5ced('0x7')]('/:id',auth[_0x5ced('0x8')](),controller[_0x5ced('0x9')]);router[_0x5ced('0xa')](_0x5ced('0xb'),auth['isAuthenticated'](),controller[_0x5ced('0xc')]);module[_0x5ced('0xd')]=router; \ No newline at end of file +var _0xae79=['../../config/environment','put','/:id','update','delete','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x7b707c,_0x206242){var _0x2f8f35=function(_0x3e840b){while(--_0x3e840b){_0x7b707c['push'](_0x7b707c['shift']());}};_0x2f8f35(++_0x206242);}(_0xae79,0x77));var _0x9ae7=function(_0x35f047,_0x52b671){_0x35f047=_0x35f047-0x0;var _0x28c539=_0xae79[_0x35f047];return _0x28c539;};'use strict';var multer=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var path=require(_0x9ae7('0x2'));var timeout=require(_0x9ae7('0x3'));var express=require(_0x9ae7('0x4'));var router=express[_0x9ae7('0x5')]();var fs_extra=require(_0x9ae7('0x6'));var auth=require(_0x9ae7('0x7'));var interaction=require(_0x9ae7('0x8'));var config=require(_0x9ae7('0x9'));var controller=require('./condition.controller');router[_0x9ae7('0xa')](_0x9ae7('0xb'),auth['isAuthenticated'](),controller[_0x9ae7('0xc')]);router[_0x9ae7('0xd')]('/:id',auth[_0x9ae7('0xe')](),controller['destroy']);module[_0x9ae7('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index ae21e76..a120762 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(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xb7e7,0x121));var _0x7b7e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb7e7[_0x19e35c];return _0x3e1fe8;};'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(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xb7e7,0x121));var _0x7b7e=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xb7e7[_0x138adb];return _0x1b27f2;};'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 36d6796..c25195d 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 _0xc612=['../../config/license/util','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','save','update','then','destroy','get','CustomDashboards','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','Dashboard','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','updatedAt','createdAt','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','DashboardItem','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x1443d5,_0x21f839){var _0x3f8e34=function(_0x5e1263){while(--_0x5e1263){_0x1443d5['push'](_0x1443d5['shift']());}};_0x3f8e34(++_0x21f839);}(_0xc612,0xd6));var _0x2c61=function(_0x5475b0,_0x2cee55){_0x5475b0=_0x5475b0-0x0;var _0x34cc74=_0xc612[_0x5475b0];return _0x34cc74;};'use strict';var emlformat=require(_0x2c61('0x0'));var rimraf=require(_0x2c61('0x1'));var zipdir=require(_0x2c61('0x2'));var jsonpatch=require(_0x2c61('0x3'));var rp=require(_0x2c61('0x4'));var moment=require(_0x2c61('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2c61('0x6'));var util=require(_0x2c61('0x7'));var path=require(_0x2c61('0x8'));var sox=require(_0x2c61('0x9'));var csv=require('to-csv');var ejs=require(_0x2c61('0xa'));var fs=require('fs');var fs_extra=require(_0x2c61('0xb'));var _=require(_0x2c61('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2c61('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2c61('0xe'));var Papa=require(_0x2c61('0xf'));var Redis=require(_0x2c61('0x10'));var authService=require(_0x2c61('0x11'));var qs=require(_0x2c61('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c61('0x13'));var logger=require(_0x2c61('0x14'))('api');var utils=require(_0x2c61('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2c61('0x16'));var db=require('../../mysqldb')['db'];config[_0x2c61('0x17')]=_[_0x2c61('0x18')](config[_0x2c61('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x2c61('0x19'))(new Redis(config[_0x2c61('0x17')]));require(_0x2c61('0x1a'))[_0x2c61('0x1b')](socket);function respondWithStatusCode(_0x48b9e8,_0x6e7c7e){_0x6e7c7e=_0x6e7c7e||0xcc;return function(_0x4a3b0e){if(_0x4a3b0e){return _0x48b9e8[_0x2c61('0x1c')](_0x6e7c7e);}return _0x48b9e8['status'](_0x6e7c7e)['end']();};}function respondWithResult(_0x2d7c84,_0x18fdbf){_0x18fdbf=_0x18fdbf||0xc8;return function(_0x5f098e){if(_0x5f098e){return _0x2d7c84[_0x2c61('0x1d')](_0x18fdbf)[_0x2c61('0x1e')](_0x5f098e);}};}function respondWithFilteredResult(_0x61a40a,_0x55d57b){return function(_0x33fce5){if(_0x33fce5){var _0x2ef507=typeof _0x55d57b['offset']===_0x2c61('0x1f')&&typeof _0x55d57b['limit']===_0x2c61('0x1f');var _0x4dd499=_0x33fce5[_0x2c61('0x20')];var _0x217b9e=_0x2ef507?0x0:_0x55d57b[_0x2c61('0x21')];var _0x52f066=_0x2ef507?_0x33fce5[_0x2c61('0x20')]:_0x55d57b['offset']+_0x55d57b[_0x2c61('0x22')];var _0x5e170b;if(_0x52f066>=_0x4dd499){_0x52f066=_0x4dd499;_0x5e170b=0xc8;}else{_0x5e170b=0xce;}_0x61a40a[_0x2c61('0x1d')](_0x5e170b);return _0x61a40a[_0x2c61('0x23')](_0x2c61('0x24'),_0x217b9e+'-'+_0x52f066+'/'+_0x4dd499)['json'](_0x33fce5);}return null;};}function patchUpdates(_0x39160d){return function(_0x853c53){try{jsonpatch['apply'](_0x853c53,_0x39160d,!![]);}catch(_0x2630a1){return BPromise['reject'](_0x2630a1);}return _0x853c53[_0x2c61('0x25')]();};}function saveUpdates(_0x2c93f0,_0x5415c9){return function(_0x3de32e){if(_0x3de32e){return _0x3de32e[_0x2c61('0x26')](_0x2c93f0)[_0x2c61('0x27')](function(_0x59b55f){return _0x59b55f;});}return null;};}function removeEntity(_0x4661a3,_0x11ac0b){return function(_0x370fbe){if(_0x370fbe){return _0x370fbe[_0x2c61('0x28')]()[_0x2c61('0x27')](function(){var _0x40b621=_0x370fbe[_0x2c61('0x29')]({'plain':!![]});var _0x3007b7=_0x2c61('0x2a');return db[_0x2c61('0x2b')][_0x2c61('0x28')]({'where':{'type':_0x3007b7,'resourceId':_0x40b621['id']}})['then'](function(){return _0x370fbe;});})['then'](function(){_0x4661a3['status'](0xcc)[_0x2c61('0x2c')]();});}};}function handleEntityNotFound(_0x3a35c5,_0x5675d3){return function(_0x1f4a2c){if(!_0x1f4a2c){_0x3a35c5[_0x2c61('0x1c')](0x194);}return _0x1f4a2c;};}function handleError(_0x5c1c0b,_0x4fcc73){_0x4fcc73=_0x4fcc73||0x1f4;return function(_0x3fb7a7){logger[_0x2c61('0x2d')](_0x3fb7a7[_0x2c61('0x2e')]);if(_0x3fb7a7['name']){delete _0x3fb7a7[_0x2c61('0x2f')];}_0x5c1c0b[_0x2c61('0x1d')](_0x4fcc73)[_0x2c61('0x30')](_0x3fb7a7);};}exports[_0x2c61('0x31')]=function(_0x55d06b,_0x525910){var _0x2ee438={},_0x2177eb={},_0x19d8a4={'count':0x0,'rows':[]};var _0x41277b=_[_0x2c61('0x32')](db['Dashboard'][_0x2c61('0x33')],function(_0x5bf002){return{'name':_0x5bf002[_0x2c61('0x34')],'type':_0x5bf002[_0x2c61('0x35')]['key']};});_0x2177eb['model']=_[_0x2c61('0x32')](_0x41277b,_0x2c61('0x2f'));_0x2177eb[_0x2c61('0x36')]=_[_0x2c61('0x37')](_0x55d06b[_0x2c61('0x36')]);_0x2177eb[_0x2c61('0x38')]=_[_0x2c61('0x39')](_0x2177eb[_0x2c61('0x3a')],_0x2177eb[_0x2c61('0x36')]);_0x2ee438['attributes']=_[_0x2c61('0x39')](_0x2177eb[_0x2c61('0x3a')],qs[_0x2c61('0x3b')](_0x55d06b['query'][_0x2c61('0x3b')]));_0x2ee438[_0x2c61('0x3c')]=_0x2ee438[_0x2c61('0x3c')][_0x2c61('0x3d')]?_0x2ee438[_0x2c61('0x3c')]:_0x2177eb[_0x2c61('0x3a')];if(!_0x55d06b[_0x2c61('0x36')][_0x2c61('0x3e')](_0x2c61('0x3f'))){_0x2ee438[_0x2c61('0x22')]=qs[_0x2c61('0x22')](_0x55d06b[_0x2c61('0x36')][_0x2c61('0x22')]);_0x2ee438[_0x2c61('0x21')]=qs[_0x2c61('0x21')](_0x55d06b[_0x2c61('0x36')][_0x2c61('0x21')]);}_0x2ee438['order']=qs[_0x2c61('0x40')](_0x55d06b[_0x2c61('0x36')]['sort']);_0x2ee438[_0x2c61('0x41')]=qs['filters'](_[_0x2c61('0x42')](_0x55d06b['query'],_0x2177eb['filters']),_0x41277b);if(_0x55d06b['query'][_0x2c61('0x43')]){_0x2ee438[_0x2c61('0x41')]=_[_0x2c61('0x44')](_0x2ee438['where'],{'$or':_[_0x2c61('0x32')](_0x41277b,function(_0x40e64f){if(_0x40e64f[_0x2c61('0x35')]!=='VIRTUAL'){var _0x25281c={};_0x25281c[_0x40e64f[_0x2c61('0x2f')]]={'$like':'%'+_0x55d06b[_0x2c61('0x36')]['filter']+'%'};return _0x25281c;}})});}_0x2ee438=_[_0x2c61('0x44')]({},_0x2ee438,_0x55d06b[_0x2c61('0x45')]);var _0x5aa2ee={'where':_0x2ee438[_0x2c61('0x41')]};return db['Dashboard'][_0x2c61('0x20')](_0x5aa2ee)[_0x2c61('0x27')](function(_0x426364){_0x19d8a4[_0x2c61('0x20')]=_0x426364;if(_0x55d06b[_0x2c61('0x36')][_0x2c61('0x46')]){_0x2ee438['include']=[{'all':!![]}];}return db[_0x2c61('0x47')]['findAll'](_0x2ee438);})['then'](function(_0x22ab68){_0x19d8a4[_0x2c61('0x48')]=_0x22ab68;return _0x19d8a4;})[_0x2c61('0x27')](respondWithFilteredResult(_0x525910,_0x2ee438))[_0x2c61('0x49')](handleError(_0x525910,null));};exports[_0x2c61('0x4a')]=function(_0x2091f3,_0x188af9){var _0xb0c3a2={'raw':![],'where':{'id':_0x2091f3[_0x2c61('0x4b')]['id']}},_0x4b3252={};_0x4b3252['model']=_[_0x2c61('0x37')](db[_0x2c61('0x47')][_0x2c61('0x33')]);_0x4b3252[_0x2c61('0x36')]=_[_0x2c61('0x37')](_0x2091f3[_0x2c61('0x36')]);_0x4b3252['filters']=_[_0x2c61('0x39')](_0x4b3252[_0x2c61('0x3a')],_0x4b3252[_0x2c61('0x36')]);_0xb0c3a2[_0x2c61('0x3c')]=_[_0x2c61('0x39')](_0x4b3252[_0x2c61('0x3a')],qs[_0x2c61('0x3b')](_0x2091f3[_0x2c61('0x36')]['fields']));_0xb0c3a2[_0x2c61('0x3c')]=_0xb0c3a2['attributes'][_0x2c61('0x3d')]?_0xb0c3a2[_0x2c61('0x3c')]:_0x4b3252['model'];if(_0x2091f3['query'][_0x2c61('0x46')]){_0xb0c3a2[_0x2c61('0x4c')]=[{'all':!![]}];}_0xb0c3a2=_['merge']({},_0xb0c3a2,_0x2091f3[_0x2c61('0x45')]);return db['Dashboard'][_0x2c61('0x4d')](_0xb0c3a2)[_0x2c61('0x27')](handleEntityNotFound(_0x188af9,null))[_0x2c61('0x27')](respondWithResult(_0x188af9,null))[_0x2c61('0x49')](handleError(_0x188af9,null));};exports[_0x2c61('0x4e')]=function(_0x717348,_0x43761a){return db[_0x2c61('0x47')]['create'](_0x717348[_0x2c61('0x4f')],{})[_0x2c61('0x27')](function(_0x46fa48){var _0x334e5c=_0x717348[_0x2c61('0x50')]['get']({'plain':!![]});if(!_0x334e5c)throw new Error(_0x2c61('0x51'));if(_0x334e5c[_0x2c61('0x52')]==='user'){var _0xc6b614=_0x46fa48[_0x2c61('0x29')]({'plain':!![]});var _0x16f32a=_0x2c61('0x2a');return db[_0x2c61('0x53')][_0x2c61('0x4d')]({'where':{'name':_0x16f32a,'userProfileId':_0x334e5c[_0x2c61('0x54')]},'raw':!![]})[_0x2c61('0x27')](function(_0x5ae5f9){if(_0x5ae5f9&&_0x5ae5f9[_0x2c61('0x55')]===0x0){return db[_0x2c61('0x2b')][_0x2c61('0x4e')]({'name':_0xc6b614['name'],'resourceId':_0xc6b614['id'],'type':_0x5ae5f9[_0x2c61('0x2f')],'sectionId':_0x5ae5f9['id']},{})[_0x2c61('0x27')](function(){return _0x46fa48;});}else{return _0x46fa48;}})[_0x2c61('0x49')](function(_0x4fcad5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fcad5);throw _0x4fcad5;});}return _0x46fa48;})[_0x2c61('0x27')](respondWithResult(_0x43761a,0xc9))[_0x2c61('0x49')](handleError(_0x43761a,null));};exports[_0x2c61('0x56')]=function(_0x1389bc,_0x48e971){var _0x28c86c={'where':{'id':_0x1389bc[_0x2c61('0x4b')]['id']}},_0x13afb5={};_0x13afb5[_0x2c61('0x3a')]=_[_0x2c61('0x37')](db[_0x2c61('0x47')][_0x2c61('0x33')]);_0x28c86c['attributes']=_[_0x2c61('0x39')](_0x13afb5['model'],qs[_0x2c61('0x3b')](_0x1389bc[_0x2c61('0x36')][_0x2c61('0x3b')]));_0x28c86c[_0x2c61('0x3c')]=_0x28c86c['attributes']['length']?_0x28c86c[_0x2c61('0x3c')]:_0x13afb5[_0x2c61('0x3a')];if(_0x1389bc[_0x2c61('0x36')][_0x2c61('0x46')]){_0x28c86c['include']=[{'all':!![]}];}_0x28c86c=_[_0x2c61('0x44')]({},_0x28c86c,_0x1389bc['options']);return db[_0x2c61('0x47')]['find'](_0x28c86c)[_0x2c61('0x27')](handleEntityNotFound(_0x48e971,null))['then'](function(_0x4cc7b4){if(_0x4cc7b4){var _0xe17e5=_0x4cc7b4[_0x2c61('0x29')]({'plain':!![]});_0xe17e5=qs[_0x2c61('0x57')](_0xe17e5,['id','createdAt',_0x2c61('0x58')]);_0x1389bc[_0x2c61('0x4f')]=_['omit'](_0x1389bc[_0x2c61('0x4f')],['id',_0x2c61('0x59'),_0x2c61('0x58')]);return db[_0x2c61('0x47')][_0x2c61('0x4e')](_[_0x2c61('0x44')](_0xe17e5,_0x1389bc['body']),{'include':_0x1389bc[_0x2c61('0x36')]['includeAll']?[{'all':!![]}]:undefined})[_0x2c61('0x27')](function(_0x2caa63){var _0x336c4a=_0x1389bc[_0x2c61('0x50')][_0x2c61('0x29')]({'plain':!![]});if(!_0x336c4a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x336c4a[_0x2c61('0x52')]===_0x2c61('0x50')){var _0x57b3dd=_0x2caa63[_0x2c61('0x29')]({'plain':!![]});var _0x329441=_0x2c61('0x2a');return db[_0x2c61('0x53')][_0x2c61('0x4d')]({'where':{'name':_0x329441,'userProfileId':_0x336c4a['userProfileId']},'raw':!![]})['then'](function(_0x4da00c){if(_0x4da00c&&_0x4da00c[_0x2c61('0x55')]===0x0){return db[_0x2c61('0x2b')][_0x2c61('0x4e')]({'name':_0x57b3dd[_0x2c61('0x2f')],'resourceId':_0x57b3dd['id'],'type':_0x4da00c[_0x2c61('0x2f')],'sectionId':_0x4da00c['id']},{})[_0x2c61('0x27')](function(){return _0x2caa63;});}else{return _0x2caa63;}})[_0x2c61('0x49')](function(_0x37e660){logger[_0x2c61('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37e660);throw _0x37e660;});}return _0x2caa63;});}})[_0x2c61('0x27')](respondWithResult(_0x48e971,0xc9))[_0x2c61('0x49')](handleError(_0x48e971,null));};exports[_0x2c61('0x26')]=function(_0x490a83,_0x4fb952){if(_0x490a83[_0x2c61('0x4f')]['id']){delete _0x490a83['body']['id'];}return db['Dashboard'][_0x2c61('0x4d')]({'where':{'id':_0x490a83['params']['id']}})['then'](handleEntityNotFound(_0x4fb952,null))[_0x2c61('0x27')](saveUpdates(_0x490a83['body'],null))[_0x2c61('0x27')](respondWithResult(_0x4fb952,null))['catch'](handleError(_0x4fb952,null));};exports[_0x2c61('0x28')]=function(_0x3b86e7,_0xe1f3e8){return db['Dashboard'][_0x2c61('0x4d')]({'where':{'id':_0x3b86e7['params']['id']}})[_0x2c61('0x27')](handleEntityNotFound(_0xe1f3e8,null))[_0x2c61('0x27')](removeEntity(_0xe1f3e8,null))[_0x2c61('0x49')](handleError(_0xe1f3e8,null));};function widgetAttributes(_0x544074){try{switch(_0x544074[_0x2c61('0x35')]){case _0x2c61('0x5a'):return[{'name':'attrUrl','value':_0x544074[_0x2c61('0x5b')]||(_0x544074[_0x2c61('0x5c')]&&_0x544074[_0x2c61('0x5c')][0x0]?_0x544074[_0x2c61('0x5c')][0x0]['value']:undefined)||_0x2c61('0x5d')}];case _0x2c61('0x5e'):return[{'name':_0x2c61('0x5f'),'value':_0x544074[_0x2c61('0x5f')]||(_0x544074[_0x2c61('0x5c')]&&_0x544074[_0x2c61('0x5c')][0x0]?_0x544074[_0x2c61('0x5c')][0x0][_0x2c61('0x60')]:undefined)||''}];case _0x2c61('0x61'):return[{'name':'attrHourFormat','value':_0x544074['attrHourFormat']||(_0x544074[_0x2c61('0x5c')]&&_0x544074['attrs'][0x0]?_0x544074[_0x2c61('0x5c')][0x0][_0x2c61('0x60')]:undefined)||_0x2c61('0x62')},{'name':_0x2c61('0x63'),'value':_0x544074[_0x2c61('0x63')]||(_0x544074[_0x2c61('0x5c')]&&_0x544074[_0x2c61('0x5c')][0x1]?_0x544074[_0x2c61('0x5c')][0x1][_0x2c61('0x60')]:undefined)||_0x2c61('0x64')},{'name':'attrFontSize','value':_0x544074[_0x2c61('0x65')]||(_0x544074['attrs']&&_0x544074['attrs'][0x2]?_0x544074['attrs'][0x2][_0x2c61('0x60')]:undefined)||0xc}];case'counter':return[{'name':_0x2c61('0x66'),'value':_0x544074[_0x2c61('0x66')]||(_0x544074['attrs']&&_0x544074['attrs'][0x0]?_0x544074['attrs'][0x0][_0x2c61('0x60')]:undefined)||'total'},{'name':_0x2c61('0x67'),'value':_0x544074[_0x2c61('0x67')]||(_0x544074[_0x2c61('0x5c')]&&_0x544074[_0x2c61('0x5c')][0x1]?_0x544074[_0x2c61('0x5c')][0x1]['value']:undefined)||[]},{'name':_0x2c61('0x65'),'value':_0x544074[_0x2c61('0x65')]||(_0x544074[_0x2c61('0x5c')]&&_0x544074[_0x2c61('0x5c')][0x2]?_0x544074['attrs'][0x2][_0x2c61('0x60')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0x2c61('0x68'),'value':_0x544074[_0x2c61('0x68')]||(_0x544074[_0x2c61('0x5c')]&&_0x544074['attrs'][0x0]?_0x544074[_0x2c61('0x5c')][0x0][_0x2c61('0x60')]:undefined)||'total'},{'name':_0x2c61('0x69'),'value':_0x544074[_0x2c61('0x69')]||(_0x544074[_0x2c61('0x5c')]&&_0x544074['attrs'][0x1]?_0x544074[_0x2c61('0x5c')][0x1][_0x2c61('0x60')]:undefined)||null},{'name':'attrSerie3','value':_0x544074[_0x2c61('0x6a')]||(_0x544074['attrs']&&_0x544074[_0x2c61('0x5c')][0x2]?_0x544074[_0x2c61('0x5c')][0x2][_0x2c61('0x60')]:undefined)||null},{'name':_0x2c61('0x67'),'value':_0x544074['attrVoiceQueues']||(_0x544074[_0x2c61('0x5c')]&&_0x544074[_0x2c61('0x5c')][0x3]?_0x544074[_0x2c61('0x5c')][0x3]['value']:undefined)||[]}];case _0x2c61('0x6b'):return[{'name':_0x2c61('0x6c'),'type':_0x544074[_0x2c61('0x6d')]||(_0x544074['attrs']&&_0x544074[_0x2c61('0x5c')][0x0]?_0x544074[_0x2c61('0x5c')][0x0][_0x2c61('0x35')]:undefined)||null,'value':_0x544074[_0x2c61('0x6c')]||(_0x544074['attrs']&&_0x544074['attrs'][0x0]?_0x544074[_0x2c61('0x5c')][0x0][_0x2c61('0x60')]:undefined)||null},{'name':_0x2c61('0x6e'),'value':_0x544074[_0x2c61('0x6e')]||(_0x544074[_0x2c61('0x5c')]&&_0x544074[_0x2c61('0x5c')][0x1]?_0x544074['attrs'][0x1][_0x2c61('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x537329){logger[_0x2c61('0x2d')](_0x2c61('0x6f'),JSON[_0x2c61('0x70')](_0x537329));return[];}}exports[_0x2c61('0x71')]=function(_0x2eed33,_0x21413a,_0x446af1){if(_0x2eed33['body']['id']){delete _0x2eed33[_0x2c61('0x4f')]['id'];}return db[_0x2c61('0x47')]['find']({'where':{'id':_0x2eed33['params']['id']}})[_0x2c61('0x27')](handleEntityNotFound(_0x21413a,null))[_0x2c61('0x27')](function(_0x169ad4){if(_0x169ad4){_0x2eed33['body'][_0x2c61('0x72')]=_0x169ad4['id'];_0x2eed33[_0x2c61('0x4f')][_0x2c61('0x5c')]=widgetAttributes(_0x2eed33[_0x2c61('0x4f')]);return db['DashboardItem']['create'](_0x2eed33[_0x2c61('0x4f')]);}})['then'](respondWithResult(_0x21413a,null))['catch'](handleError(_0x21413a,null));};exports[_0x2c61('0x73')]=function(_0x304473,_0x4af3b8,_0x23a932){var _0x213ce6={};var _0x5cf86e={};var _0x5e24df;var _0x3746f3;return db['Dashboard']['findOne']({'where':{'id':_0x304473['params']['id']}})[_0x2c61('0x27')](handleEntityNotFound(_0x4af3b8,null))[_0x2c61('0x27')](function(_0x3443ab){if(_0x3443ab){_0x5e24df=_0x3443ab;_0x5cf86e[_0x2c61('0x3a')]=_['keys'](db[_0x2c61('0x74')][_0x2c61('0x33')]);_0x5cf86e[_0x2c61('0x36')]=_[_0x2c61('0x37')](_0x304473[_0x2c61('0x36')]);_0x5cf86e[_0x2c61('0x38')]=_[_0x2c61('0x39')](_0x5cf86e[_0x2c61('0x3a')],_0x5cf86e[_0x2c61('0x36')]);_0x213ce6['attributes']=_[_0x2c61('0x39')](_0x5cf86e[_0x2c61('0x3a')],qs[_0x2c61('0x3b')](_0x304473[_0x2c61('0x36')][_0x2c61('0x3b')]));_0x213ce6['attributes']=_0x213ce6[_0x2c61('0x3c')][_0x2c61('0x3d')]?_0x213ce6[_0x2c61('0x3c')]:_0x5cf86e['model'];_0x213ce6[_0x2c61('0x75')]=qs['sort'](_0x304473[_0x2c61('0x36')][_0x2c61('0x40')]);_0x213ce6[_0x2c61('0x41')]=qs[_0x2c61('0x38')](_['pick'](_0x304473[_0x2c61('0x36')],_0x5cf86e[_0x2c61('0x38')]));if(_0x304473[_0x2c61('0x36')][_0x2c61('0x43')]){_0x213ce6[_0x2c61('0x41')]=_['merge'](_0x213ce6[_0x2c61('0x41')],{'$or':_[_0x2c61('0x32')](_0x213ce6[_0x2c61('0x3c')],function(_0x3dd3ba){var _0x8269e0={};_0x8269e0[_0x3dd3ba]={'$like':'%'+_0x304473[_0x2c61('0x36')][_0x2c61('0x43')]+'%'};return _0x8269e0;})});}_0x213ce6=_[_0x2c61('0x44')]({},_0x213ce6,_0x304473[_0x2c61('0x45')]);return _0x5e24df[_0x2c61('0x73')](_0x213ce6);}})[_0x2c61('0x27')](function(_0x5b5c23){if(_0x5b5c23){_0x3746f3=_0x5b5c23[_0x2c61('0x3d')];if(!_0x304473[_0x2c61('0x36')][_0x2c61('0x3e')](_0x2c61('0x3f'))){_0x213ce6[_0x2c61('0x22')]=qs[_0x2c61('0x22')](_0x304473['query'][_0x2c61('0x22')]);_0x213ce6['offset']=qs[_0x2c61('0x21')](_0x304473[_0x2c61('0x36')]['offset']);}return _0x5e24df[_0x2c61('0x73')](_0x213ce6);}})['then'](function(_0x49528c){if(_0x49528c){return _0x49528c?{'count':_0x3746f3,'rows':_0x49528c}:null;}})[_0x2c61('0x27')](respondWithResult(_0x4af3b8,null))['catch'](handleError(_0x4af3b8,null));}; \ No newline at end of file +var _0xe69f=['ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','Dashboard','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','update','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','findOne','DashboardItem','pick','getItems','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0xe69f,0x73));var _0xfe69=function(_0x3fa6c5,_0x12644e){_0x3fa6c5=_0x3fa6c5-0x0;var _0x373708=_0xe69f[_0x3fa6c5];return _0x373708;};'use strict';var emlformat=require(_0xfe69('0x0'));var rimraf=require(_0xfe69('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe69('0x2'));var rp=require(_0xfe69('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfe69('0x4'));var util=require('util');var path=require(_0xfe69('0x5'));var sox=require(_0xfe69('0x6'));var csv=require(_0xfe69('0x7'));var ejs=require(_0xfe69('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfe69('0x9'));var squel=require(_0xfe69('0xa'));var crypto=require(_0xfe69('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfe69('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfe69('0xd'));var Redis=require(_0xfe69('0xe'));var authService=require(_0xfe69('0xf'));var qs=require(_0xfe69('0x10'));var as=require(_0xfe69('0x11'));var hardwareService=require(_0xfe69('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xfe69('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfe69('0x14'));var db=require('../../mysqldb')['db'];config[_0xfe69('0x15')]=_[_0xfe69('0x16')](config[_0xfe69('0x15')],{'host':_0xfe69('0x17'),'port':0x18eb});var socket=require(_0xfe69('0x18'))(new Redis(config['redis']));require(_0xfe69('0x19'))[_0xfe69('0x1a')](socket);function respondWithStatusCode(_0x241108,_0x193264){_0x193264=_0x193264||0xcc;return function(_0x130aa3){if(_0x130aa3){return _0x241108[_0xfe69('0x1b')](_0x193264);}return _0x241108[_0xfe69('0x1c')](_0x193264)[_0xfe69('0x1d')]();};}function respondWithResult(_0x4b22d0,_0x20eb9b){_0x20eb9b=_0x20eb9b||0xc8;return function(_0x545021){if(_0x545021){return _0x4b22d0[_0xfe69('0x1c')](_0x20eb9b)[_0xfe69('0x1e')](_0x545021);}};}function respondWithFilteredResult(_0x2f7a81,_0x4488d0){return function(_0x489f1b){if(_0x489f1b){var _0x5231f4=typeof _0x4488d0['offset']===_0xfe69('0x1f')&&typeof _0x4488d0[_0xfe69('0x20')]===_0xfe69('0x1f');var _0x4bea83=_0x489f1b[_0xfe69('0x21')];var _0x552ee1=_0x5231f4?0x0:_0x4488d0['offset'];var _0x2adecf=_0x5231f4?_0x489f1b['count']:_0x4488d0[_0xfe69('0x22')]+_0x4488d0['limit'];var _0x2876f1;if(_0x2adecf>=_0x4bea83){_0x2adecf=_0x4bea83;_0x2876f1=0xc8;}else{_0x2876f1=0xce;}_0x2f7a81[_0xfe69('0x1c')](_0x2876f1);return _0x2f7a81[_0xfe69('0x23')](_0xfe69('0x24'),_0x552ee1+'-'+_0x2adecf+'/'+_0x4bea83)[_0xfe69('0x1e')](_0x489f1b);}return null;};}function patchUpdates(_0x5d7f40){return function(_0x1f09bc){try{jsonpatch[_0xfe69('0x25')](_0x1f09bc,_0x5d7f40,!![]);}catch(_0x2040ba){return BPromise[_0xfe69('0x26')](_0x2040ba);}return _0x1f09bc[_0xfe69('0x27')]();};}function saveUpdates(_0x46897b,_0x27dbeb){return function(_0xceb48e){if(_0xceb48e){return _0xceb48e['update'](_0x46897b)[_0xfe69('0x28')](function(_0x5f3245){return _0x5f3245;});}return null;};}function removeEntity(_0x1cb98b,_0x49172d){return function(_0x2ff063){if(_0x2ff063){return _0x2ff063['destroy']()[_0xfe69('0x28')](function(){var _0x39b9ee=_0x2ff063[_0xfe69('0x29')]({'plain':!![]});var _0x2345fe=_0xfe69('0x2a');return db[_0xfe69('0x2b')][_0xfe69('0x2c')]({'where':{'type':_0x2345fe,'resourceId':_0x39b9ee['id']}})[_0xfe69('0x28')](function(){return _0x2ff063;});})[_0xfe69('0x28')](function(){_0x1cb98b[_0xfe69('0x1c')](0xcc)[_0xfe69('0x1d')]();});}};}function handleEntityNotFound(_0x588a2e,_0x448522){return function(_0x48c8ab){if(!_0x48c8ab){_0x588a2e['sendStatus'](0x194);}return _0x48c8ab;};}function handleError(_0x235e1b,_0x218c56){_0x218c56=_0x218c56||0x1f4;return function(_0x38bb93){logger[_0xfe69('0x2d')](_0x38bb93[_0xfe69('0x2e')]);if(_0x38bb93[_0xfe69('0x2f')]){delete _0x38bb93['name'];}_0x235e1b[_0xfe69('0x1c')](_0x218c56)[_0xfe69('0x30')](_0x38bb93);};}exports[_0xfe69('0x31')]=function(_0x5076c4,_0x485038){var _0x393d9e={},_0xc7b2b7={},_0x1c91a8={'count':0x0,'rows':[]};var _0x181c07=_['map'](db['Dashboard'][_0xfe69('0x32')],function(_0x174d31){return{'name':_0x174d31[_0xfe69('0x33')],'type':_0x174d31[_0xfe69('0x34')][_0xfe69('0x35')]};});_0xc7b2b7[_0xfe69('0x36')]=_[_0xfe69('0x37')](_0x181c07,'name');_0xc7b2b7[_0xfe69('0x38')]=_[_0xfe69('0x39')](_0x5076c4[_0xfe69('0x38')]);_0xc7b2b7[_0xfe69('0x3a')]=_['intersection'](_0xc7b2b7[_0xfe69('0x36')],_0xc7b2b7['query']);_0x393d9e[_0xfe69('0x3b')]=_[_0xfe69('0x3c')](_0xc7b2b7[_0xfe69('0x36')],qs[_0xfe69('0x3d')](_0x5076c4[_0xfe69('0x38')]['fields']));_0x393d9e[_0xfe69('0x3b')]=_0x393d9e[_0xfe69('0x3b')][_0xfe69('0x3e')]?_0x393d9e['attributes']:_0xc7b2b7[_0xfe69('0x36')];if(!_0x5076c4[_0xfe69('0x38')][_0xfe69('0x3f')](_0xfe69('0x40'))){_0x393d9e['limit']=qs[_0xfe69('0x20')](_0x5076c4[_0xfe69('0x38')]['limit']);_0x393d9e[_0xfe69('0x22')]=qs['offset'](_0x5076c4[_0xfe69('0x38')]['offset']);}_0x393d9e[_0xfe69('0x41')]=qs[_0xfe69('0x42')](_0x5076c4[_0xfe69('0x38')]['sort']);_0x393d9e[_0xfe69('0x43')]=qs[_0xfe69('0x3a')](_['pick'](_0x5076c4[_0xfe69('0x38')],_0xc7b2b7['filters']),_0x181c07);if(_0x5076c4[_0xfe69('0x38')]['filter']){_0x393d9e[_0xfe69('0x43')]=_[_0xfe69('0x44')](_0x393d9e['where'],{'$or':_['map'](_0x181c07,function(_0x537e23){if(_0x537e23[_0xfe69('0x34')]!==_0xfe69('0x45')){var _0x19a80d={};_0x19a80d[_0x537e23['name']]={'$like':'%'+_0x5076c4[_0xfe69('0x38')][_0xfe69('0x46')]+'%'};return _0x19a80d;}})});}_0x393d9e=_['merge']({},_0x393d9e,_0x5076c4[_0xfe69('0x47')]);var _0x167ee7={'where':_0x393d9e[_0xfe69('0x43')]};return db[_0xfe69('0x48')][_0xfe69('0x21')](_0x167ee7)[_0xfe69('0x28')](function(_0x5a8367){_0x1c91a8[_0xfe69('0x21')]=_0x5a8367;if(_0x5076c4[_0xfe69('0x38')][_0xfe69('0x49')]){_0x393d9e[_0xfe69('0x4a')]=[{'all':!![]}];}return db[_0xfe69('0x48')][_0xfe69('0x4b')](_0x393d9e);})[_0xfe69('0x28')](function(_0x3cc001){_0x1c91a8[_0xfe69('0x4c')]=_0x3cc001;return _0x1c91a8;})[_0xfe69('0x28')](respondWithFilteredResult(_0x485038,_0x393d9e))['catch'](handleError(_0x485038,null));};exports[_0xfe69('0x4d')]=function(_0x3a9809,_0x1ca8dc){var _0x31b6b4={'raw':![],'where':{'id':_0x3a9809[_0xfe69('0x4e')]['id']}},_0x3bfd0c={};_0x3bfd0c['model']=_[_0xfe69('0x39')](db[_0xfe69('0x48')][_0xfe69('0x32')]);_0x3bfd0c[_0xfe69('0x38')]=_[_0xfe69('0x39')](_0x3a9809[_0xfe69('0x38')]);_0x3bfd0c[_0xfe69('0x3a')]=_[_0xfe69('0x3c')](_0x3bfd0c[_0xfe69('0x36')],_0x3bfd0c[_0xfe69('0x38')]);_0x31b6b4[_0xfe69('0x3b')]=_['intersection'](_0x3bfd0c[_0xfe69('0x36')],qs['fields'](_0x3a9809[_0xfe69('0x38')]['fields']));_0x31b6b4[_0xfe69('0x3b')]=_0x31b6b4[_0xfe69('0x3b')][_0xfe69('0x3e')]?_0x31b6b4[_0xfe69('0x3b')]:_0x3bfd0c['model'];if(_0x3a9809[_0xfe69('0x38')][_0xfe69('0x49')]){_0x31b6b4[_0xfe69('0x4a')]=[{'all':!![]}];}_0x31b6b4=_[_0xfe69('0x44')]({},_0x31b6b4,_0x3a9809[_0xfe69('0x47')]);return db[_0xfe69('0x48')][_0xfe69('0x4f')](_0x31b6b4)['then'](handleEntityNotFound(_0x1ca8dc,null))['then'](respondWithResult(_0x1ca8dc,null))[_0xfe69('0x50')](handleError(_0x1ca8dc,null));};exports[_0xfe69('0x51')]=function(_0x493d84,_0x4584ac){return db[_0xfe69('0x48')][_0xfe69('0x51')](_0x493d84[_0xfe69('0x52')],{})['then'](function(_0x5755f6){var _0x37cf4a=_0x493d84[_0xfe69('0x53')][_0xfe69('0x29')]({'plain':!![]});if(!_0x37cf4a)throw new Error(_0xfe69('0x54'));if(_0x37cf4a[_0xfe69('0x55')]==='user'){var _0x41b5f5=_0x5755f6[_0xfe69('0x29')]({'plain':!![]});var _0x4e2784=_0xfe69('0x2a');return db[_0xfe69('0x56')][_0xfe69('0x4f')]({'where':{'name':_0x4e2784,'userProfileId':_0x37cf4a[_0xfe69('0x57')]},'raw':!![]})[_0xfe69('0x28')](function(_0x44fdfa){if(_0x44fdfa&&_0x44fdfa['autoAssociation']===0x0){return db['UserProfileResource'][_0xfe69('0x51')]({'name':_0x41b5f5['name'],'resourceId':_0x41b5f5['id'],'type':_0x44fdfa['name'],'sectionId':_0x44fdfa['id']},{})[_0xfe69('0x28')](function(){return _0x5755f6;});}else{return _0x5755f6;}})[_0xfe69('0x50')](function(_0x246fa1){logger[_0xfe69('0x2d')](_0xfe69('0x58'),_0x246fa1);throw _0x246fa1;});}return _0x5755f6;})[_0xfe69('0x28')](respondWithResult(_0x4584ac,0xc9))[_0xfe69('0x50')](handleError(_0x4584ac,null));};exports[_0xfe69('0x59')]=function(_0x3620a7,_0xdbdeb1){var _0x19f304={'where':{'id':_0x3620a7[_0xfe69('0x4e')]['id']}},_0xcf457d={};_0xcf457d[_0xfe69('0x36')]=_[_0xfe69('0x39')](db[_0xfe69('0x48')][_0xfe69('0x32')]);_0x19f304[_0xfe69('0x3b')]=_[_0xfe69('0x3c')](_0xcf457d[_0xfe69('0x36')],qs[_0xfe69('0x3d')](_0x3620a7[_0xfe69('0x38')][_0xfe69('0x3d')]));_0x19f304[_0xfe69('0x3b')]=_0x19f304['attributes'][_0xfe69('0x3e')]?_0x19f304[_0xfe69('0x3b')]:_0xcf457d[_0xfe69('0x36')];if(_0x3620a7[_0xfe69('0x38')][_0xfe69('0x49')]){_0x19f304[_0xfe69('0x4a')]=[{'all':!![]}];}_0x19f304=_['merge']({},_0x19f304,_0x3620a7['options']);return db[_0xfe69('0x48')][_0xfe69('0x4f')](_0x19f304)[_0xfe69('0x28')](handleEntityNotFound(_0xdbdeb1,null))[_0xfe69('0x28')](function(_0x6e2169){if(_0x6e2169){var _0x4ea7c0=_0x6e2169['get']({'plain':!![]});_0x4ea7c0=qs[_0xfe69('0x5a')](_0x4ea7c0,['id',_0xfe69('0x5b'),_0xfe69('0x5c')]);_0x3620a7[_0xfe69('0x52')]=_[_0xfe69('0x5a')](_0x3620a7['body'],['id','createdAt',_0xfe69('0x5c')]);return db[_0xfe69('0x48')][_0xfe69('0x51')](_[_0xfe69('0x44')](_0x4ea7c0,_0x3620a7[_0xfe69('0x52')]),{'include':_0x3620a7['query'][_0xfe69('0x49')]?[{'all':!![]}]:undefined})[_0xfe69('0x28')](function(_0x12953f){var _0x35e52d=_0x3620a7['user'][_0xfe69('0x29')]({'plain':!![]});if(!_0x35e52d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35e52d[_0xfe69('0x55')]===_0xfe69('0x53')){var _0x254197=_0x12953f[_0xfe69('0x29')]({'plain':!![]});var _0x2b48d3=_0xfe69('0x2a');return db['UserProfileSection'][_0xfe69('0x4f')]({'where':{'name':_0x2b48d3,'userProfileId':_0x35e52d[_0xfe69('0x57')]},'raw':!![]})['then'](function(_0x2bd7b1){if(_0x2bd7b1&&_0x2bd7b1['autoAssociation']===0x0){return db[_0xfe69('0x2b')][_0xfe69('0x51')]({'name':_0x254197[_0xfe69('0x2f')],'resourceId':_0x254197['id'],'type':_0x2bd7b1['name'],'sectionId':_0x2bd7b1['id']},{})[_0xfe69('0x28')](function(){return _0x12953f;});}else{return _0x12953f;}})[_0xfe69('0x50')](function(_0x37ef29){logger['error'](_0xfe69('0x58'),_0x37ef29);throw _0x37ef29;});}return _0x12953f;});}})[_0xfe69('0x28')](respondWithResult(_0xdbdeb1,0xc9))['catch'](handleError(_0xdbdeb1,null));};exports[_0xfe69('0x5d')]=function(_0x2835c6,_0x219fb8){if(_0x2835c6[_0xfe69('0x52')]['id']){delete _0x2835c6[_0xfe69('0x52')]['id'];}return db[_0xfe69('0x48')]['find']({'where':{'id':_0x2835c6[_0xfe69('0x4e')]['id']}})[_0xfe69('0x28')](handleEntityNotFound(_0x219fb8,null))['then'](saveUpdates(_0x2835c6[_0xfe69('0x52')],null))[_0xfe69('0x28')](respondWithResult(_0x219fb8,null))[_0xfe69('0x50')](handleError(_0x219fb8,null));};exports[_0xfe69('0x2c')]=function(_0x118f57,_0x529dd7){return db[_0xfe69('0x48')][_0xfe69('0x4f')]({'where':{'id':_0x118f57[_0xfe69('0x4e')]['id']}})['then'](handleEntityNotFound(_0x529dd7,null))[_0xfe69('0x28')](removeEntity(_0x529dd7,null))[_0xfe69('0x50')](handleError(_0x529dd7,null));};function widgetAttributes(_0x5e09b0){try{switch(_0x5e09b0['type']){case'iframe':return[{'name':_0xfe69('0x5e'),'value':_0x5e09b0[_0xfe69('0x5e')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0[_0xfe69('0x5f')][0x0]?_0x5e09b0[_0xfe69('0x5f')][0x0][_0xfe69('0x60')]:undefined)||_0xfe69('0x61')}];case'custom':return[{'name':_0xfe69('0x62'),'value':_0x5e09b0['attrPath']||(_0x5e09b0['attrs']&&_0x5e09b0[_0xfe69('0x5f')][0x0]?_0x5e09b0[_0xfe69('0x5f')][0x0][_0xfe69('0x60')]:undefined)||''}];case _0xfe69('0x63'):return[{'name':'attrHourFormat','value':_0x5e09b0[_0xfe69('0x64')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0[_0xfe69('0x5f')][0x0]?_0x5e09b0[_0xfe69('0x5f')][0x0][_0xfe69('0x60')]:undefined)||_0xfe69('0x65')},{'name':'attrTimezone','value':_0x5e09b0['attrTimezone']||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0[_0xfe69('0x5f')][0x1]?_0x5e09b0[_0xfe69('0x5f')][0x1][_0xfe69('0x60')]:undefined)||'0.00'},{'name':_0xfe69('0x66'),'value':_0x5e09b0[_0xfe69('0x66')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0['attrs'][0x2]?_0x5e09b0['attrs'][0x2][_0xfe69('0x60')]:undefined)||0xc}];case _0xfe69('0x67'):return[{'name':_0xfe69('0x68'),'value':_0x5e09b0[_0xfe69('0x68')]||(_0x5e09b0['attrs']&&_0x5e09b0[_0xfe69('0x5f')][0x0]?_0x5e09b0[_0xfe69('0x5f')][0x0]['value']:undefined)||'total'},{'name':_0xfe69('0x69'),'value':_0x5e09b0['attrVoiceQueues']||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0[_0xfe69('0x5f')][0x1]?_0x5e09b0[_0xfe69('0x5f')][0x1][_0xfe69('0x60')]:undefined)||[]},{'name':_0xfe69('0x66'),'value':_0x5e09b0[_0xfe69('0x66')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0[_0xfe69('0x5f')][0x2]?_0x5e09b0[_0xfe69('0x5f')][0x2]['value']:undefined)||0x14}];case _0xfe69('0x6a'):case _0xfe69('0x6b'):return[{'name':_0xfe69('0x6c'),'value':_0x5e09b0[_0xfe69('0x6c')]||(_0x5e09b0['attrs']&&_0x5e09b0[_0xfe69('0x5f')][0x0]?_0x5e09b0[_0xfe69('0x5f')][0x0][_0xfe69('0x60')]:undefined)||_0xfe69('0x6d')},{'name':_0xfe69('0x6e'),'value':_0x5e09b0[_0xfe69('0x6e')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0['attrs'][0x1]?_0x5e09b0[_0xfe69('0x5f')][0x1][_0xfe69('0x60')]:undefined)||null},{'name':_0xfe69('0x6f'),'value':_0x5e09b0[_0xfe69('0x6f')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0['attrs'][0x2]?_0x5e09b0[_0xfe69('0x5f')][0x2][_0xfe69('0x60')]:undefined)||null},{'name':_0xfe69('0x69'),'value':_0x5e09b0[_0xfe69('0x69')]||(_0x5e09b0['attrs']&&_0x5e09b0[_0xfe69('0x5f')][0x3]?_0x5e09b0[_0xfe69('0x5f')][0x3][_0xfe69('0x60')]:undefined)||[]}];case _0xfe69('0x70'):return[{'name':_0xfe69('0x71'),'type':_0x5e09b0[_0xfe69('0x72')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0[_0xfe69('0x5f')][0x0]?_0x5e09b0[_0xfe69('0x5f')][0x0]['type']:undefined)||null,'value':_0x5e09b0[_0xfe69('0x71')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0['attrs'][0x0]?_0x5e09b0[_0xfe69('0x5f')][0x0]['value']:undefined)||null},{'name':_0xfe69('0x73'),'value':_0x5e09b0[_0xfe69('0x73')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0[_0xfe69('0x5f')][0x1]?_0x5e09b0['attrs'][0x1][_0xfe69('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x1b3fc7){logger[_0xfe69('0x2d')]('widgetAttributes:\x20%s',JSON[_0xfe69('0x74')](_0x1b3fc7));return[];}}exports[_0xfe69('0x75')]=function(_0x50b7c2,_0x307c14,_0x1c4599){if(_0x50b7c2[_0xfe69('0x52')]['id']){delete _0x50b7c2[_0xfe69('0x52')]['id'];}return db['Dashboard'][_0xfe69('0x4f')]({'where':{'id':_0x50b7c2[_0xfe69('0x4e')]['id']}})[_0xfe69('0x28')](handleEntityNotFound(_0x307c14,null))['then'](function(_0x1d9efe){if(_0x1d9efe){_0x50b7c2['body'][_0xfe69('0x76')]=_0x1d9efe['id'];_0x50b7c2[_0xfe69('0x52')][_0xfe69('0x5f')]=widgetAttributes(_0x50b7c2[_0xfe69('0x52')]);return db['DashboardItem']['create'](_0x50b7c2[_0xfe69('0x52')]);}})[_0xfe69('0x28')](respondWithResult(_0x307c14,null))[_0xfe69('0x50')](handleError(_0x307c14,null));};exports['getItems']=function(_0x254058,_0xbdb9e,_0x585704){var _0x7882fa={};var _0x499e32={};var _0x347794;var _0xb88c1c;return db[_0xfe69('0x48')][_0xfe69('0x77')]({'where':{'id':_0x254058[_0xfe69('0x4e')]['id']}})[_0xfe69('0x28')](handleEntityNotFound(_0xbdb9e,null))['then'](function(_0x5cc10f){if(_0x5cc10f){_0x347794=_0x5cc10f;_0x499e32['model']=_['keys'](db[_0xfe69('0x78')][_0xfe69('0x32')]);_0x499e32[_0xfe69('0x38')]=_['keys'](_0x254058[_0xfe69('0x38')]);_0x499e32[_0xfe69('0x3a')]=_[_0xfe69('0x3c')](_0x499e32[_0xfe69('0x36')],_0x499e32[_0xfe69('0x38')]);_0x7882fa[_0xfe69('0x3b')]=_[_0xfe69('0x3c')](_0x499e32[_0xfe69('0x36')],qs[_0xfe69('0x3d')](_0x254058[_0xfe69('0x38')][_0xfe69('0x3d')]));_0x7882fa[_0xfe69('0x3b')]=_0x7882fa[_0xfe69('0x3b')][_0xfe69('0x3e')]?_0x7882fa[_0xfe69('0x3b')]:_0x499e32[_0xfe69('0x36')];_0x7882fa[_0xfe69('0x41')]=qs[_0xfe69('0x42')](_0x254058[_0xfe69('0x38')][_0xfe69('0x42')]);_0x7882fa[_0xfe69('0x43')]=qs[_0xfe69('0x3a')](_[_0xfe69('0x79')](_0x254058['query'],_0x499e32[_0xfe69('0x3a')]));if(_0x254058[_0xfe69('0x38')][_0xfe69('0x46')]){_0x7882fa[_0xfe69('0x43')]=_[_0xfe69('0x44')](_0x7882fa['where'],{'$or':_[_0xfe69('0x37')](_0x7882fa['attributes'],function(_0x38b015){var _0xe0e6e5={};_0xe0e6e5[_0x38b015]={'$like':'%'+_0x254058[_0xfe69('0x38')][_0xfe69('0x46')]+'%'};return _0xe0e6e5;})});}_0x7882fa=_['merge']({},_0x7882fa,_0x254058[_0xfe69('0x47')]);return _0x347794[_0xfe69('0x7a')](_0x7882fa);}})['then'](function(_0x193af3){if(_0x193af3){_0xb88c1c=_0x193af3[_0xfe69('0x3e')];if(!_0x254058['query'][_0xfe69('0x3f')](_0xfe69('0x40'))){_0x7882fa[_0xfe69('0x20')]=qs[_0xfe69('0x20')](_0x254058[_0xfe69('0x38')][_0xfe69('0x20')]);_0x7882fa[_0xfe69('0x22')]=qs[_0xfe69('0x22')](_0x254058['query'][_0xfe69('0x22')]);}return _0x347794[_0xfe69('0x7a')](_0x7882fa);}})[_0xfe69('0x28')](function(_0x42f57b){if(_0x42f57b){return _0x42f57b?{'count':_0xb88c1c,'rows':_0x42f57b}:null;}})[_0xfe69('0x28')](respondWithResult(_0xbdb9e,null))[_0xfe69('0x50')](handleError(_0xbdb9e,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 6d50fd1..239b3ad 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 _0xb209=['update','remove','emit','hasOwnProperty','hook','exports','events','Dashboard','setMaxListeners','save'];(function(_0x3aac08,_0x332c48){var _0x2959f4=function(_0x4813c0){while(--_0x4813c0){_0x3aac08['push'](_0x3aac08['shift']());}};_0x2959f4(++_0x332c48);}(_0xb209,0x16e));var _0x9b20=function(_0x37844a,_0x2e6613){_0x37844a=_0x37844a-0x0;var _0x120c1=_0xb209[_0x37844a];return _0x120c1;};'use strict';var EventEmitter=require(_0x9b20('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x9b20('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x9b20('0x2')](0x0);var events={'afterCreate':_0x9b20('0x3'),'afterUpdate':_0x9b20('0x4'),'afterDestroy':_0x9b20('0x5')};function emitEvent(_0xbd28b6){return function(_0x2a5b29,_0x2f7339,_0x36da5c){DashboardEvents[_0x9b20('0x6')](_0xbd28b6+':'+_0x2a5b29['id'],_0x2a5b29);DashboardEvents[_0x9b20('0x6')](_0xbd28b6,_0x2a5b29);_0x36da5c(null);};}for(var e in events){if(events[_0x9b20('0x7')](e)){var event=events[e];Dashboard[_0x9b20('0x8')](e,emitEvent(event));}}module[_0x9b20('0x9')]=DashboardEvents; \ No newline at end of file +var _0x30cd=['emit','hasOwnProperty','exports','events','../../mysqldb','Dashboard','save','update'];(function(_0x3aec10,_0x234b92){var _0x41b475=function(_0x1e2f40){while(--_0x1e2f40){_0x3aec10['push'](_0x3aec10['shift']());}};_0x41b475(++_0x234b92);}(_0x30cd,0x1e3));var _0xd30c=function(_0x401fd6,_0xb28d69){_0x401fd6=_0x401fd6-0x0;var _0x451f8f=_0x30cd[_0x401fd6];return _0x451f8f;};'use strict';var EventEmitter=require(_0xd30c('0x0'));var Dashboard=require(_0xd30c('0x1'))['db'][_0xd30c('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd30c('0x3'),'afterUpdate':_0xd30c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x286d63){return function(_0x1226fd,_0x44aff3,_0x1381b9){DashboardEvents[_0xd30c('0x5')](_0x286d63+':'+_0x1226fd['id'],_0x1226fd);DashboardEvents[_0xd30c('0x5')](_0x286d63,_0x1226fd);_0x1381b9(null);};}for(var e in events){if(events[_0xd30c('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xd30c('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 5f98ad4..afa8b02 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 _0xff2e=['define','Dashboard','dashboards','util','bluebird','request-promise','rimraf','./dashboard.attributes','exports'];(function(_0x154269,_0x2f13ad){var _0x1ef8e8=function(_0x4eeb8f){while(--_0x4eeb8f){_0x154269['push'](_0x154269['shift']());}};_0x1ef8e8(++_0x2f13ad);}(_0xff2e,0xe4));var _0xeff2=function(_0x2f64f7,_0x1f365d){_0x2f64f7=_0x2f64f7-0x0;var _0x473ec5=_0xff2e[_0x2f64f7];return _0x473ec5;};'use strict';var _=require('lodash');var util=require(_0xeff2('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xeff2('0x1'));var rp=require(_0xeff2('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeff2('0x3'));var config=require('../../config/environment');var attributes=require(_0xeff2('0x4'));module[_0xeff2('0x5')]=function(_0x2fd524,_0x194345){return _0x2fd524[_0xeff2('0x6')](_0xeff2('0x7'),attributes,{'tableName':_0xeff2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x699c=['dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x1e7d5d,_0x8fbf6c){var _0x272207=function(_0x44ea51){while(--_0x44ea51){_0x1e7d5d['push'](_0x1e7d5d['shift']());}};_0x272207(++_0x8fbf6c);}(_0x699c,0x127));var _0xc699=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x699c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xc699('0x0'));var util=require(_0xc699('0x1'));var logger=require(_0xc699('0x2'))(_0xc699('0x3'));var moment=require(_0xc699('0x4'));var BPromise=require(_0xc699('0x5'));var rp=require(_0xc699('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc699('0x7'));var config=require(_0xc699('0x8'));var attributes=require(_0xc699('0x9'));module[_0xc699('0xa')]=function(_0x160857,_0x55bc89){return _0x160857[_0xc699('0xb')](_0xc699('0xc'),attributes,{'tableName':_0xc699('0xd'),'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 54fff16..fc7ceeb 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 _0xd2d0=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./dashboard.socket','register','request','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','info','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x56db28,_0x95952b){var _0x255efc=function(_0x11c095){while(--_0x11c095){_0x56db28['push'](_0x56db28['shift']());}};_0x255efc(++_0x95952b);}(_0xd2d0,0x80));var _0x0d2d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd2d0[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0d2d('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d2d('0x1'));var db=require(_0x0d2d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d2d('0x3'))(_0x0d2d('0x4'));var config=require(_0x0d2d('0x5'));var jayson=require(_0x0d2d('0x6'));var client=jayson[_0x0d2d('0x7')]['http']({'port':0x232a});config[_0x0d2d('0x8')]=_[_0x0d2d('0x9')](config['redis'],{'host':_0x0d2d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d2d('0x8')]));require(_0x0d2d('0xb'))[_0x0d2d('0xc')](socket);function respondWithRpcPromise(_0x459390,_0x41c4cf,_0x343c14){return new BPromise(function(_0x336dd4,_0x7dcc5e){return client[_0x0d2d('0xd')](_0x459390,_0x343c14)['then'](function(_0x54d451){logger['info'](_0x0d2d('0xe'),_0x41c4cf,_0x0d2d('0xf'));logger[_0x0d2d('0x10')](_0x0d2d('0x11'),_0x41c4cf,_0x0d2d('0xf'),JSON[_0x0d2d('0x12')](_0x54d451));if(_0x54d451[_0x0d2d('0x13')]){if(_0x54d451['error']['code']===0x1f4){logger[_0x0d2d('0x13')](_0x0d2d('0xe'),_0x41c4cf,_0x54d451[_0x0d2d('0x13')][_0x0d2d('0x14')]);return _0x7dcc5e(_0x54d451['error'][_0x0d2d('0x14')]);}logger['error'](_0x0d2d('0xe'),_0x41c4cf,_0x54d451[_0x0d2d('0x13')][_0x0d2d('0x14')]);return _0x336dd4(_0x54d451[_0x0d2d('0x13')][_0x0d2d('0x14')]);}else{logger[_0x0d2d('0x15')](_0x0d2d('0xe'),_0x41c4cf,_0x0d2d('0xf'));_0x336dd4(_0x54d451['result']['message']);}})['catch'](function(_0x2ab016){logger[_0x0d2d('0x13')]('Dashboard,\x20%s,\x20%s',_0x41c4cf,_0x2ab016);_0x7dcc5e(_0x2ab016);});});} \ No newline at end of file +var _0x46b7=['request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x597834,_0x159bb6){var _0x12da6c=function(_0x161c38){while(--_0x161c38){_0x597834['push'](_0x597834['shift']());}};_0x12da6c(++_0x159bb6);}(_0x46b7,0xf0));var _0x746b=function(_0xc6fb21,_0x23e9e9){_0xc6fb21=_0xc6fb21-0x0;var _0x398166=_0x46b7[_0xc6fb21];return _0x398166;};'use strict';var _=require(_0x746b('0x0'));var util=require(_0x746b('0x1'));var moment=require(_0x746b('0x2'));var BPromise=require(_0x746b('0x3'));var rs=require(_0x746b('0x4'));var fs=require('fs');var Redis=require(_0x746b('0x5'));var db=require(_0x746b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x746b('0x7'))(_0x746b('0x8'));var config=require(_0x746b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x746b('0xa')]['http']({'port':0x232a});config[_0x746b('0xb')]=_[_0x746b('0xc')](config[_0x746b('0xb')],{'host':_0x746b('0xd'),'port':0x18eb});var socket=require(_0x746b('0xe'))(new Redis(config[_0x746b('0xb')]));require(_0x746b('0xf'))['register'](socket);function respondWithRpcPromise(_0x321113,_0x4a34df,_0x42b22b){return new BPromise(function(_0x2442ad,_0x5941b1){return client[_0x746b('0x10')](_0x321113,_0x42b22b)[_0x746b('0x11')](function(_0x180a37){logger[_0x746b('0x12')](_0x746b('0x13'),_0x4a34df,_0x746b('0x14'));logger['debug'](_0x746b('0x15'),_0x4a34df,_0x746b('0x14'),JSON['stringify'](_0x180a37));if(_0x180a37[_0x746b('0x16')]){if(_0x180a37['error'][_0x746b('0x17')]===0x1f4){logger['error'](_0x746b('0x13'),_0x4a34df,_0x180a37[_0x746b('0x16')]['message']);return _0x5941b1(_0x180a37[_0x746b('0x16')][_0x746b('0x18')]);}logger['error'](_0x746b('0x13'),_0x4a34df,_0x180a37['error'][_0x746b('0x18')]);return _0x2442ad(_0x180a37[_0x746b('0x16')][_0x746b('0x18')]);}else{logger[_0x746b('0x12')](_0x746b('0x13'),_0x4a34df,_0x746b('0x14'));_0x2442ad(_0x180a37['result']['message']);}})[_0x746b('0x19')](function(_0x419d3a){logger['error'](_0x746b('0x13'),_0x4a34df,_0x419d3a);_0x5941b1(_0x419d3a);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index bed4e8a..362978e 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 _0xbd9e=['save','remove','removeListener'];(function(_0x550ae6,_0x492707){var _0xb752cd=function(_0x3e7594){while(--_0x3e7594){_0x550ae6['push'](_0x550ae6['shift']());}};_0xb752cd(++_0x492707);}(_0xbd9e,0x1d1));var _0xebd9=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xbd9e[_0x4bb66f];return _0xf2772f;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xebd9('0x0'),_0xebd9('0x1'),'update'];function createListener(_0x577876,_0x2bde7c){return function(_0x30a709){_0x2bde7c['emit'](_0x577876,_0x30a709);};}function removeListener(_0x5d8644,_0x456c4a){return function(){DashboardEvents[_0xebd9('0x2')](_0x5d8644,_0x456c4a);};}exports['register']=function(_0x4abcd8){for(var _0x5236f5=0x0,_0x1bd4db=events['length'];_0x5236f5<_0x1bd4db;_0x5236f5++){var _0x4b06fb=events[_0x5236f5];var _0x49d74c=createListener('dashboard:'+_0x4b06fb,_0x4abcd8);DashboardEvents['on'](_0x4b06fb,_0x49d74c);}}; \ No newline at end of file +var _0x88fc=['removeListener','register','length','./dashboard.events','save','remove','update','emit'];(function(_0x20bc66,_0x2aef37){var _0x3c1b3c=function(_0x23c970){while(--_0x23c970){_0x20bc66['push'](_0x20bc66['shift']());}};_0x3c1b3c(++_0x2aef37);}(_0x88fc,0x193));var _0xc88f=function(_0x29c150,_0x46d349){_0x29c150=_0x29c150-0x0;var _0x5b1731=_0x88fc[_0x29c150];return _0x5b1731;};'use strict';var DashboardEvents=require(_0xc88f('0x0'));var events=[_0xc88f('0x1'),_0xc88f('0x2'),_0xc88f('0x3')];function createListener(_0xc6713d,_0x21f62e){return function(_0x352f38){_0x21f62e[_0xc88f('0x4')](_0xc6713d,_0x352f38);};}function removeListener(_0x36f0a1,_0x14f26d){return function(){DashboardEvents[_0xc88f('0x5')](_0x36f0a1,_0x14f26d);};}exports[_0xc88f('0x6')]=function(_0x408dc4){for(var _0x25ca72=0x0,_0x4e7a26=events[_0xc88f('0x7')];_0x25ca72<_0x4e7a26;_0x25ca72++){var _0x413335=events[_0x25ca72];var _0x198a16=createListener('dashboard:'+_0x413335,_0x408dc4);DashboardEvents['on'](_0x413335,_0x198a16);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index b8dbfd4..96bd353 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 _0x4f5b=['get','isAuthenticated','show','/:id/items','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3f8772,_0x89068d){var _0x387c7f=function(_0x272095){while(--_0x272095){_0x3f8772['push'](_0x3f8772['shift']());}};_0x387c7f(++_0x89068d);}(_0x4f5b,0x158));var _0xb4f5=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4f5b[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0xb4f5('0x0'));var path=require('path');var timeout=require(_0xb4f5('0x1'));var express=require(_0xb4f5('0x2'));var router=express[_0xb4f5('0x3')]();var fs_extra=require(_0xb4f5('0x4'));var auth=require(_0xb4f5('0x5'));var interaction=require(_0xb4f5('0x6'));var config=require(_0xb4f5('0x7'));var controller=require('./dashboard.controller');router[_0xb4f5('0x8')]('/',auth[_0xb4f5('0x9')](),controller['index']);router[_0xb4f5('0x8')]('/:id',auth[_0xb4f5('0x9')](),controller[_0xb4f5('0xa')]);router[_0xb4f5('0x8')](_0xb4f5('0xb'),auth[_0xb4f5('0x9')](),controller[_0xb4f5('0xc')]);router[_0xb4f5('0xd')]('/',auth['isAuthenticated'](),controller[_0xb4f5('0xe')]);router[_0xb4f5('0xd')](_0xb4f5('0xf'),auth[_0xb4f5('0x9')](),controller['clone']);router[_0xb4f5('0xd')](_0xb4f5('0xb'),auth[_0xb4f5('0x9')](),controller[_0xb4f5('0x10')]);router[_0xb4f5('0x11')]('/:id',auth[_0xb4f5('0x9')](),controller[_0xb4f5('0x12')]);router[_0xb4f5('0x13')]('/:id',auth[_0xb4f5('0x9')](),controller[_0xb4f5('0x14')]);module[_0xb4f5('0x15')]=router; \ No newline at end of file +var _0xca80=['post','create','/:id/clone','/:id/items','addItem','put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','show','getItems'];(function(_0x3f499d,_0x4edf4b){var _0x4242c3=function(_0x14f3bd){while(--_0x14f3bd){_0x3f499d['push'](_0x3f499d['shift']());}};_0x4242c3(++_0x4edf4b);}(_0xca80,0x162));var _0x0ca8=function(_0x3b318a,_0x34f9a8){_0x3b318a=_0x3b318a-0x0;var _0x21ae80=_0xca80[_0x3b318a];return _0x21ae80;};'use strict';var multer=require(_0x0ca8('0x0'));var util=require(_0x0ca8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0ca8('0x2'));var router=express[_0x0ca8('0x3')]();var fs_extra=require(_0x0ca8('0x4'));var auth=require(_0x0ca8('0x5'));var interaction=require(_0x0ca8('0x6'));var config=require(_0x0ca8('0x7'));var controller=require(_0x0ca8('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0ca8('0x9')](_0x0ca8('0xa'),auth[_0x0ca8('0xb')](),controller[_0x0ca8('0xc')]);router[_0x0ca8('0x9')]('/:id/items',auth['isAuthenticated'](),controller[_0x0ca8('0xd')]);router[_0x0ca8('0xe')]('/',auth[_0x0ca8('0xb')](),controller[_0x0ca8('0xf')]);router[_0x0ca8('0xe')](_0x0ca8('0x10'),auth[_0x0ca8('0xb')](),controller['clone']);router['post'](_0x0ca8('0x11'),auth[_0x0ca8('0xb')](),controller[_0x0ca8('0x12')]);router[_0x0ca8('0x13')]('/:id',auth[_0x0ca8('0xb')](),controller[_0x0ca8('0x14')]);router['delete'](_0x0ca8('0xa'),auth[_0x0ca8('0xb')](),controller[_0x0ca8('0x15')]);module[_0x0ca8('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index fd01ab6..84932cc 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 _0xacf4=['lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','stringify','INTEGER','#2196f3'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xacf4,0xe7));var _0x4acf=function(_0x497908,_0x48f14c){_0x497908=_0x497908-0x0;var _0x165382=_0xacf4[_0x497908];return _0x165382;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0x4acf('0x0'));module[_0x4acf('0x1')]={'title':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4acf('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4acf('0x3')](_0x4acf('0x4')),'get':function(){try{return JSON[_0x4acf('0x5')](this['getDataValue'](_0x4acf('0x6')));}catch(_0x2124c8){return[];}},'set':function(_0x4e0c43){try{this[_0x4acf('0x7')](_0x4acf('0x6'),JSON[_0x4acf('0x8')](_0x4e0c43));}catch(_0x45a5a4){this[_0x4acf('0x7')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x4acf('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4acf('0x9')]},'col':{'type':Sequelize[_0x4acf('0x9')]},'background':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![],'defaultValue':_0x4acf('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x0295=['#ffffff','sequelize','exports','TEXT','long','parse','getDataValue','attrs','setDataValue','INTEGER','STRING'];(function(_0x91384,_0x545eef){var _0x44daa0=function(_0x5a0cc5){while(--_0x5a0cc5){_0x91384['push'](_0x91384['shift']());}};_0x44daa0(++_0x545eef);}(_0x0295,0x1f0));var _0x5029=function(_0x451130,_0x595ee2){_0x451130=_0x451130-0x0;var _0x68c08e=_0x0295[_0x451130];return _0x68c08e;};'use strict';var Sequelize=require(_0x5029('0x0'));var squel=require('squel');var _=require('lodash');module[_0x5029('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5029('0x2')](_0x5029('0x3')),'get':function(){try{return JSON[_0x5029('0x4')](this[_0x5029('0x5')](_0x5029('0x6')));}catch(_0x69a497){return[];}},'set':function(_0x200217){try{this[_0x5029('0x7')](_0x5029('0x6'),JSON['stringify'](_0x200217));}catch(_0x54978f){this['setDataValue'](_0x5029('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5029('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5029('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':_0x5029('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5029('0x9')]},'titleFontSize':{'type':Sequelize[_0x5029('0x8')],'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 a18f5d9..c614d72 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 _0x4d33=['socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','destroy','then','name','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','params','type','attrUrl','attrs','value','https://','custom','attrPath','clock','HH:mm:ss','attrTimezone','attrFontSize','counter','total','attrSerie2','attrSerie3','attrVoiceQueues','attrReport','reportType','stringify','body','catch','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x2f1d44,_0xeba5ad){var _0x524ede=function(_0x88756e){while(--_0x88756e){_0x2f1d44['push'](_0x2f1d44['shift']());}};_0x524ede(++_0xeba5ad);}(_0x4d33,0x1cc));var _0x34d3=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0x4d33[_0x3de873];return _0x380b8c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x34d3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x34d3('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x34d3('0x2'));var Mustache=require(_0x34d3('0x3'));var util=require(_0x34d3('0x4'));var path=require(_0x34d3('0x5'));var sox=require(_0x34d3('0x6'));var csv=require(_0x34d3('0x7'));var ejs=require(_0x34d3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34d3('0x9'));var squel=require(_0x34d3('0xa'));var crypto=require(_0x34d3('0xb'));var jsforce=require(_0x34d3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x34d3('0xd'));var Papa=require('papaparse');var Redis=require(_0x34d3('0xe'));var authService=require(_0x34d3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x34d3('0x10'));var hardwareService=require(_0x34d3('0x11'));var logger=require(_0x34d3('0x12'))(_0x34d3('0x13'));var utils=require(_0x34d3('0x14'));var config=require(_0x34d3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x34d3('0x16'))['db'];config[_0x34d3('0x17')]=_[_0x34d3('0x18')](config[_0x34d3('0x17')],{'host':_0x34d3('0x19'),'port':0x18eb});var socket=require(_0x34d3('0x1a'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x34d3('0x1b')](socket);function respondWithStatusCode(_0x5192ac,_0x478a49){_0x478a49=_0x478a49||0xcc;return function(_0x3d055f){if(_0x3d055f){return _0x5192ac[_0x34d3('0x1c')](_0x478a49);}return _0x5192ac['status'](_0x478a49)[_0x34d3('0x1d')]();};}function respondWithResult(_0x4c1727,_0xbd0613){_0xbd0613=_0xbd0613||0xc8;return function(_0x3d2f02){if(_0x3d2f02){return _0x4c1727['status'](_0xbd0613)[_0x34d3('0x1e')](_0x3d2f02);}};}function respondWithFilteredResult(_0x19d2de,_0x2d536d){return function(_0x38798b){if(_0x38798b){var _0x47aa7d=typeof _0x2d536d[_0x34d3('0x1f')]===_0x34d3('0x20')&&typeof _0x2d536d[_0x34d3('0x21')]===_0x34d3('0x20');var _0x2c792c=_0x38798b[_0x34d3('0x22')];var _0x166fa2=_0x47aa7d?0x0:_0x2d536d[_0x34d3('0x1f')];var _0x3aeb76=_0x47aa7d?_0x38798b['count']:_0x2d536d[_0x34d3('0x1f')]+_0x2d536d[_0x34d3('0x21')];var _0x3c626f;if(_0x3aeb76>=_0x2c792c){_0x3aeb76=_0x2c792c;_0x3c626f=0xc8;}else{_0x3c626f=0xce;}_0x19d2de[_0x34d3('0x23')](_0x3c626f);return _0x19d2de[_0x34d3('0x24')](_0x34d3('0x25'),_0x166fa2+'-'+_0x3aeb76+'/'+_0x2c792c)[_0x34d3('0x1e')](_0x38798b);}return null;};}function patchUpdates(_0x4dda32){return function(_0x428adc){try{jsonpatch[_0x34d3('0x26')](_0x428adc,_0x4dda32,!![]);}catch(_0x18f090){return BPromise[_0x34d3('0x27')](_0x18f090);}return _0x428adc[_0x34d3('0x28')]();};}function saveUpdates(_0x28058a,_0x2ee533){return function(_0x2bb146){if(_0x2bb146){return _0x2bb146['update'](_0x28058a)['then'](function(_0x4fd4d5){return _0x4fd4d5;});}return null;};}function removeEntity(_0x48d706,_0x5ef8fe){return function(_0x45dc5d){if(_0x45dc5d){return _0x45dc5d[_0x34d3('0x29')]()[_0x34d3('0x2a')](function(){_0x48d706['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b1e3f,_0x16578d){return function(_0x4840d1){if(!_0x4840d1){_0x5b1e3f[_0x34d3('0x1c')](0x194);}return _0x4840d1;};}function handleError(_0x583822,_0x5c6bd1){_0x5c6bd1=_0x5c6bd1||0x1f4;return function(_0x5f1d38){logger['error'](_0x5f1d38['stack']);if(_0x5f1d38[_0x34d3('0x2b')]){delete _0x5f1d38[_0x34d3('0x2b')];}_0x583822[_0x34d3('0x23')](_0x5c6bd1)['send'](_0x5f1d38);};}exports['show']=function(_0x3e78b2,_0x4f0fdc){var _0x2e0518={'raw':![],'where':{'id':_0x3e78b2['params']['id']}},_0x10c45d={};_0x10c45d[_0x34d3('0x2c')]=_[_0x34d3('0x2d')](db[_0x34d3('0x2e')][_0x34d3('0x2f')]);_0x10c45d[_0x34d3('0x30')]=_[_0x34d3('0x2d')](_0x3e78b2['query']);_0x10c45d[_0x34d3('0x31')]=_[_0x34d3('0x32')](_0x10c45d[_0x34d3('0x2c')],_0x10c45d[_0x34d3('0x30')]);_0x2e0518['attributes']=_['intersection'](_0x10c45d[_0x34d3('0x2c')],qs[_0x34d3('0x33')](_0x3e78b2[_0x34d3('0x30')][_0x34d3('0x33')]));_0x2e0518[_0x34d3('0x34')]=_0x2e0518['attributes'][_0x34d3('0x35')]?_0x2e0518[_0x34d3('0x34')]:_0x10c45d[_0x34d3('0x2c')];if(_0x3e78b2[_0x34d3('0x30')][_0x34d3('0x36')]){_0x2e0518[_0x34d3('0x37')]=[{'all':!![]}];}_0x2e0518=_[_0x34d3('0x38')]({},_0x2e0518,_0x3e78b2[_0x34d3('0x39')]);return db['DashboardItem'][_0x34d3('0x3a')](_0x2e0518)[_0x34d3('0x2a')](handleEntityNotFound(_0x4f0fdc,null))['then'](respondWithResult(_0x4f0fdc,null))['catch'](handleError(_0x4f0fdc,null));};exports[_0x34d3('0x29')]=function(_0x247d4c,_0x11dfbf){return db[_0x34d3('0x2e')][_0x34d3('0x3a')]({'where':{'id':_0x247d4c[_0x34d3('0x3b')]['id']}})[_0x34d3('0x2a')](handleEntityNotFound(_0x11dfbf,null))[_0x34d3('0x2a')](removeEntity(_0x11dfbf,null))['catch'](handleError(_0x11dfbf,null));};function widgetAttributes(_0x56bb6f){try{switch(_0x56bb6f[_0x34d3('0x3c')]){case'iframe':return[{'name':'attrUrl','value':_0x56bb6f[_0x34d3('0x3d')]||(_0x56bb6f['attrs']&&_0x56bb6f[_0x34d3('0x3e')][0x0]?_0x56bb6f[_0x34d3('0x3e')][0x0][_0x34d3('0x3f')]:undefined)||_0x34d3('0x40')}];case _0x34d3('0x41'):return[{'name':'attrPath','value':_0x56bb6f[_0x34d3('0x42')]||(_0x56bb6f[_0x34d3('0x3e')]&&_0x56bb6f['attrs'][0x0]?_0x56bb6f[_0x34d3('0x3e')][0x0][_0x34d3('0x3f')]:undefined)||''}];case _0x34d3('0x43'):return[{'name':'attrHourFormat','value':_0x56bb6f['attrHourFormat']||(_0x56bb6f[_0x34d3('0x3e')]&&_0x56bb6f[_0x34d3('0x3e')][0x0]?_0x56bb6f[_0x34d3('0x3e')][0x0][_0x34d3('0x3f')]:undefined)||_0x34d3('0x44')},{'name':'attrTimezone','value':_0x56bb6f[_0x34d3('0x45')]||(_0x56bb6f[_0x34d3('0x3e')]&&_0x56bb6f['attrs'][0x1]?_0x56bb6f[_0x34d3('0x3e')][0x1][_0x34d3('0x3f')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x56bb6f[_0x34d3('0x46')]||(_0x56bb6f[_0x34d3('0x3e')]&&_0x56bb6f['attrs'][0x2]?_0x56bb6f[_0x34d3('0x3e')][0x2][_0x34d3('0x3f')]:undefined)||0xc}];case _0x34d3('0x47'):return[{'name':'attrMetric','value':_0x56bb6f['attrMetric']||(_0x56bb6f['attrs']&&_0x56bb6f['attrs'][0x0]?_0x56bb6f['attrs'][0x0][_0x34d3('0x3f')]:undefined)||_0x34d3('0x48')},{'name':'attrVoiceQueues','value':_0x56bb6f['attrVoiceQueues']||(_0x56bb6f[_0x34d3('0x3e')]&&_0x56bb6f['attrs'][0x1]?_0x56bb6f[_0x34d3('0x3e')][0x1][_0x34d3('0x3f')]:undefined)||[]},{'name':_0x34d3('0x46'),'value':_0x56bb6f[_0x34d3('0x46')]||(_0x56bb6f[_0x34d3('0x3e')]&&_0x56bb6f[_0x34d3('0x3e')][0x2]?_0x56bb6f['attrs'][0x2][_0x34d3('0x3f')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x56bb6f['attrSerie1']||(_0x56bb6f[_0x34d3('0x3e')]&&_0x56bb6f[_0x34d3('0x3e')][0x0]?_0x56bb6f[_0x34d3('0x3e')][0x0][_0x34d3('0x3f')]:undefined)||'total'},{'name':_0x34d3('0x49'),'value':_0x56bb6f['attrSerie2']||(_0x56bb6f[_0x34d3('0x3e')]&&_0x56bb6f[_0x34d3('0x3e')][0x1]?_0x56bb6f[_0x34d3('0x3e')][0x1]['value']:undefined)||null},{'name':_0x34d3('0x4a'),'value':_0x56bb6f[_0x34d3('0x4a')]||(_0x56bb6f['attrs']&&_0x56bb6f[_0x34d3('0x3e')][0x2]?_0x56bb6f[_0x34d3('0x3e')][0x2][_0x34d3('0x3f')]:undefined)||null},{'name':_0x34d3('0x4b'),'value':_0x56bb6f[_0x34d3('0x4b')]||(_0x56bb6f[_0x34d3('0x3e')]&&_0x56bb6f[_0x34d3('0x3e')][0x3]?_0x56bb6f[_0x34d3('0x3e')][0x3][_0x34d3('0x3f')]:undefined)||[]}];case'web-report':return[{'name':_0x34d3('0x4c'),'type':_0x56bb6f[_0x34d3('0x4d')]||(_0x56bb6f[_0x34d3('0x3e')]&&_0x56bb6f[_0x34d3('0x3e')][0x0]?_0x56bb6f['attrs'][0x0][_0x34d3('0x3c')]:undefined)||null,'value':_0x56bb6f[_0x34d3('0x4c')]||(_0x56bb6f[_0x34d3('0x3e')]&&_0x56bb6f['attrs'][0x0]?_0x56bb6f[_0x34d3('0x3e')][0x0][_0x34d3('0x3f')]:undefined)||null},{'name':'attrRefresh','value':_0x56bb6f['attrRefresh']||(_0x56bb6f[_0x34d3('0x3e')]&&_0x56bb6f['attrs'][0x1]?_0x56bb6f[_0x34d3('0x3e')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x3ac63e){logger['error']('widgetAttributes:\x20%s',JSON[_0x34d3('0x4e')](_0x3ac63e));return[];}}exports['create']=function(_0x5807fc,_0x59a7d5){if(_0x5807fc['body']){_0x5807fc[_0x34d3('0x4f')]['attrs']=widgetAttributes(_0x5807fc[_0x34d3('0x4f')]);}return db[_0x34d3('0x2e')]['create'](_0x5807fc[_0x34d3('0x4f')],{})[_0x34d3('0x2a')](respondWithResult(_0x59a7d5,0xc9))[_0x34d3('0x50')](handleError(_0x59a7d5,null));};exports['update']=function(_0x2a561b,_0x14f989){if(_0x2a561b[_0x34d3('0x4f')]['id']){delete _0x2a561b[_0x34d3('0x4f')]['id'];}_0x2a561b[_0x34d3('0x4f')][_0x34d3('0x3e')]=widgetAttributes(_0x2a561b[_0x34d3('0x4f')]);return db[_0x34d3('0x2e')][_0x34d3('0x3a')]({'where':{'id':_0x2a561b['params']['id']}})[_0x34d3('0x2a')](handleEntityNotFound(_0x14f989,null))[_0x34d3('0x2a')](saveUpdates(_0x2a561b['body'],null))[_0x34d3('0x2a')](respondWithResult(_0x14f989,null))[_0x34d3('0x50')](handleError(_0x14f989,null));}; \ No newline at end of file +var _0xb4c9=['error','name','send','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','include','merge','options','DashboardItem','catch','find','params','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','status','json','undefined','limit','count','offset','apply','reject','update','then','destroy'];(function(_0x2d23d8,_0xe79330){var _0x17bbff=function(_0x2ac01e){while(--_0x2ac01e){_0x2d23d8['push'](_0x2d23d8['shift']());}};_0x17bbff(++_0xe79330);}(_0xb4c9,0xe5));var _0x9b4c=function(_0x21637e,_0x3266b1){_0x21637e=_0x21637e-0x0;var _0x36617f=_0xb4c9[_0x21637e];return _0x36617f;};'use strict';var emlformat=require(_0x9b4c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9b4c('0x1'));var jsonpatch=require(_0x9b4c('0x2'));var rp=require(_0x9b4c('0x3'));var moment=require('moment');var BPromise=require(_0x9b4c('0x4'));var Mustache=require('mustache');var util=require(_0x9b4c('0x5'));var path=require(_0x9b4c('0x6'));var sox=require(_0x9b4c('0x7'));var csv=require(_0x9b4c('0x8'));var ejs=require(_0x9b4c('0x9'));var fs=require('fs');var fs_extra=require(_0x9b4c('0xa'));var _=require(_0x9b4c('0xb'));var squel=require('squel');var crypto=require(_0x9b4c('0xc'));var jsforce=require(_0x9b4c('0xd'));var deskjs=require(_0x9b4c('0xe'));var toCsv=require(_0x9b4c('0x8'));var querystring=require(_0x9b4c('0xf'));var Papa=require(_0x9b4c('0x10'));var Redis=require(_0x9b4c('0x11'));var authService=require(_0x9b4c('0x12'));var qs=require(_0x9b4c('0x13'));var as=require(_0x9b4c('0x14'));var hardwareService=require(_0x9b4c('0x15'));var logger=require(_0x9b4c('0x16'))(_0x9b4c('0x17'));var utils=require(_0x9b4c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9b4c('0x19'));var db=require(_0x9b4c('0x1a'))['db'];config['redis']=_[_0x9b4c('0x1b')](config[_0x9b4c('0x1c')],{'host':_0x9b4c('0x1d'),'port':0x18eb});var socket=require(_0x9b4c('0x1e'))(new Redis(config[_0x9b4c('0x1c')]));require(_0x9b4c('0x1f'))[_0x9b4c('0x20')](socket);function respondWithStatusCode(_0xa946bb,_0x2249b4){_0x2249b4=_0x2249b4||0xcc;return function(_0xd52936){if(_0xd52936){return _0xa946bb['sendStatus'](_0x2249b4);}return _0xa946bb['status'](_0x2249b4)['end']();};}function respondWithResult(_0x1b2a7f,_0x6b8f8d){_0x6b8f8d=_0x6b8f8d||0xc8;return function(_0x4afcc2){if(_0x4afcc2){return _0x1b2a7f[_0x9b4c('0x21')](_0x6b8f8d)[_0x9b4c('0x22')](_0x4afcc2);}};}function respondWithFilteredResult(_0x1b105e,_0x5aa46d){return function(_0xc15210){if(_0xc15210){var _0x320a1e=typeof _0x5aa46d['offset']===_0x9b4c('0x23')&&typeof _0x5aa46d[_0x9b4c('0x24')]==='undefined';var _0x46bae2=_0xc15210[_0x9b4c('0x25')];var _0x43466d=_0x320a1e?0x0:_0x5aa46d[_0x9b4c('0x26')];var _0x1219be=_0x320a1e?_0xc15210[_0x9b4c('0x25')]:_0x5aa46d['offset']+_0x5aa46d[_0x9b4c('0x24')];var _0x1d62b5;if(_0x1219be>=_0x46bae2){_0x1219be=_0x46bae2;_0x1d62b5=0xc8;}else{_0x1d62b5=0xce;}_0x1b105e[_0x9b4c('0x21')](_0x1d62b5);return _0x1b105e['set']('Content-Range',_0x43466d+'-'+_0x1219be+'/'+_0x46bae2)['json'](_0xc15210);}return null;};}function patchUpdates(_0x313349){return function(_0xc7e36c){try{jsonpatch[_0x9b4c('0x27')](_0xc7e36c,_0x313349,!![]);}catch(_0x551d27){return BPromise[_0x9b4c('0x28')](_0x551d27);}return _0xc7e36c['save']();};}function saveUpdates(_0x51ef95,_0x58fd02){return function(_0x401ccc){if(_0x401ccc){return _0x401ccc[_0x9b4c('0x29')](_0x51ef95)[_0x9b4c('0x2a')](function(_0x4d65f7){return _0x4d65f7;});}return null;};}function removeEntity(_0x470f05,_0x3dfe96){return function(_0x4e37ba){if(_0x4e37ba){return _0x4e37ba[_0x9b4c('0x2b')]()['then'](function(){_0x470f05['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15052b,_0x34392f){return function(_0x34e975){if(!_0x34e975){_0x15052b['sendStatus'](0x194);}return _0x34e975;};}function handleError(_0x131f12,_0x2d6f97){_0x2d6f97=_0x2d6f97||0x1f4;return function(_0x189829){logger[_0x9b4c('0x2c')](_0x189829['stack']);if(_0x189829[_0x9b4c('0x2d')]){delete _0x189829[_0x9b4c('0x2d')];}_0x131f12[_0x9b4c('0x21')](_0x2d6f97)[_0x9b4c('0x2e')](_0x189829);};}exports[_0x9b4c('0x2f')]=function(_0x2adf7e,_0x16047f){var _0x69f737={'raw':![],'where':{'id':_0x2adf7e['params']['id']}},_0x7117c9={};_0x7117c9[_0x9b4c('0x30')]=_[_0x9b4c('0x31')](db['DashboardItem'][_0x9b4c('0x32')]);_0x7117c9['query']=_[_0x9b4c('0x31')](_0x2adf7e[_0x9b4c('0x33')]);_0x7117c9[_0x9b4c('0x34')]=_[_0x9b4c('0x35')](_0x7117c9[_0x9b4c('0x30')],_0x7117c9[_0x9b4c('0x33')]);_0x69f737[_0x9b4c('0x36')]=_[_0x9b4c('0x35')](_0x7117c9['model'],qs['fields'](_0x2adf7e[_0x9b4c('0x33')][_0x9b4c('0x37')]));_0x69f737['attributes']=_0x69f737[_0x9b4c('0x36')]['length']?_0x69f737[_0x9b4c('0x36')]:_0x7117c9[_0x9b4c('0x30')];if(_0x2adf7e[_0x9b4c('0x33')]['includeAll']){_0x69f737[_0x9b4c('0x38')]=[{'all':!![]}];}_0x69f737=_[_0x9b4c('0x39')]({},_0x69f737,_0x2adf7e[_0x9b4c('0x3a')]);return db[_0x9b4c('0x3b')]['find'](_0x69f737)[_0x9b4c('0x2a')](handleEntityNotFound(_0x16047f,null))['then'](respondWithResult(_0x16047f,null))[_0x9b4c('0x3c')](handleError(_0x16047f,null));};exports[_0x9b4c('0x2b')]=function(_0x2fb192,_0x5d9a69){return db['DashboardItem'][_0x9b4c('0x3d')]({'where':{'id':_0x2fb192[_0x9b4c('0x3e')]['id']}})[_0x9b4c('0x2a')](handleEntityNotFound(_0x5d9a69,null))[_0x9b4c('0x2a')](removeEntity(_0x5d9a69,null))[_0x9b4c('0x3c')](handleError(_0x5d9a69,null));};function widgetAttributes(_0x4cb305){try{switch(_0x4cb305['type']){case _0x9b4c('0x3f'):return[{'name':_0x9b4c('0x40'),'value':_0x4cb305[_0x9b4c('0x40')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305[_0x9b4c('0x41')][0x0]?_0x4cb305[_0x9b4c('0x41')][0x0]['value']:undefined)||_0x9b4c('0x42')}];case _0x9b4c('0x43'):return[{'name':_0x9b4c('0x44'),'value':_0x4cb305[_0x9b4c('0x44')]||(_0x4cb305['attrs']&&_0x4cb305[_0x9b4c('0x41')][0x0]?_0x4cb305[_0x9b4c('0x41')][0x0][_0x9b4c('0x45')]:undefined)||''}];case _0x9b4c('0x46'):return[{'name':'attrHourFormat','value':_0x4cb305[_0x9b4c('0x47')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305['attrs'][0x0]?_0x4cb305[_0x9b4c('0x41')][0x0]['value']:undefined)||_0x9b4c('0x48')},{'name':_0x9b4c('0x49'),'value':_0x4cb305[_0x9b4c('0x49')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305[_0x9b4c('0x41')][0x1]?_0x4cb305[_0x9b4c('0x41')][0x1][_0x9b4c('0x45')]:undefined)||_0x9b4c('0x4a')},{'name':_0x9b4c('0x4b'),'value':_0x4cb305[_0x9b4c('0x4b')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305[_0x9b4c('0x41')][0x2]?_0x4cb305[_0x9b4c('0x41')][0x2][_0x9b4c('0x45')]:undefined)||0xc}];case _0x9b4c('0x4c'):return[{'name':'attrMetric','value':_0x4cb305['attrMetric']||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305[_0x9b4c('0x41')][0x0]?_0x4cb305[_0x9b4c('0x41')][0x0]['value']:undefined)||_0x9b4c('0x4d')},{'name':'attrVoiceQueues','value':_0x4cb305[_0x9b4c('0x4e')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305['attrs'][0x1]?_0x4cb305[_0x9b4c('0x41')][0x1][_0x9b4c('0x45')]:undefined)||[]},{'name':_0x9b4c('0x4b'),'value':_0x4cb305[_0x9b4c('0x4b')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305[_0x9b4c('0x41')][0x2]?_0x4cb305[_0x9b4c('0x41')][0x2][_0x9b4c('0x45')]:undefined)||0x14}];case _0x9b4c('0x4f'):case'pie-chart':return[{'name':_0x9b4c('0x50'),'value':_0x4cb305[_0x9b4c('0x50')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305[_0x9b4c('0x41')][0x0]?_0x4cb305['attrs'][0x0][_0x9b4c('0x45')]:undefined)||_0x9b4c('0x4d')},{'name':_0x9b4c('0x51'),'value':_0x4cb305[_0x9b4c('0x51')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305[_0x9b4c('0x41')][0x1]?_0x4cb305[_0x9b4c('0x41')][0x1][_0x9b4c('0x45')]:undefined)||null},{'name':'attrSerie3','value':_0x4cb305[_0x9b4c('0x52')]||(_0x4cb305['attrs']&&_0x4cb305[_0x9b4c('0x41')][0x2]?_0x4cb305['attrs'][0x2][_0x9b4c('0x45')]:undefined)||null},{'name':_0x9b4c('0x4e'),'value':_0x4cb305[_0x9b4c('0x4e')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305[_0x9b4c('0x41')][0x3]?_0x4cb305[_0x9b4c('0x41')][0x3][_0x9b4c('0x45')]:undefined)||[]}];case _0x9b4c('0x53'):return[{'name':_0x9b4c('0x54'),'type':_0x4cb305[_0x9b4c('0x55')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305['attrs'][0x0]?_0x4cb305[_0x9b4c('0x41')][0x0]['type']:undefined)||null,'value':_0x4cb305[_0x9b4c('0x54')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305['attrs'][0x0]?_0x4cb305['attrs'][0x0]['value']:undefined)||null},{'name':_0x9b4c('0x56'),'value':_0x4cb305[_0x9b4c('0x56')]||(_0x4cb305['attrs']&&_0x4cb305[_0x9b4c('0x41')][0x1]?_0x4cb305['attrs'][0x1][_0x9b4c('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x3a44e4){logger[_0x9b4c('0x2c')](_0x9b4c('0x57'),JSON[_0x9b4c('0x58')](_0x3a44e4));return[];}}exports['create']=function(_0x55e21d,_0x42820c){if(_0x55e21d[_0x9b4c('0x59')]){_0x55e21d[_0x9b4c('0x59')]['attrs']=widgetAttributes(_0x55e21d[_0x9b4c('0x59')]);}return db['DashboardItem'][_0x9b4c('0x5a')](_0x55e21d['body'],{})[_0x9b4c('0x2a')](respondWithResult(_0x42820c,0xc9))[_0x9b4c('0x3c')](handleError(_0x42820c,null));};exports[_0x9b4c('0x29')]=function(_0x5c40df,_0x28010e){if(_0x5c40df[_0x9b4c('0x59')]['id']){delete _0x5c40df[_0x9b4c('0x59')]['id'];}_0x5c40df[_0x9b4c('0x59')]['attrs']=widgetAttributes(_0x5c40df[_0x9b4c('0x59')]);return db['DashboardItem'][_0x9b4c('0x3d')]({'where':{'id':_0x5c40df[_0x9b4c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x28010e,null))[_0x9b4c('0x2a')](saveUpdates(_0x5c40df[_0x9b4c('0x59')],null))[_0x9b4c('0x2a')](respondWithResult(_0x28010e,null))[_0x9b4c('0x3c')](handleError(_0x28010e,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 8b6dedb..5298014 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 _0x5120=['hook','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x39309b,_0x41aef3){var _0x49d508=function(_0x427f77){while(--_0x427f77){_0x39309b['push'](_0x39309b['shift']());}};_0x49d508(++_0x41aef3);}(_0x5120,0x179));var _0x0512=function(_0x542d87,_0x3f1428){_0x542d87=_0x542d87-0x0;var _0x18f154=_0x5120[_0x542d87];return _0x18f154;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x0512('0x0'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0512('0x1')](0x0);var events={'afterCreate':_0x0512('0x2'),'afterUpdate':_0x0512('0x3'),'afterDestroy':_0x0512('0x4')};function emitEvent(_0x20a139){return function(_0x532ed5,_0x5d41b4,_0x47b8f2){DashboardItemEvents[_0x0512('0x5')](_0x20a139+':'+_0x532ed5['id'],_0x532ed5);DashboardItemEvents[_0x0512('0x5')](_0x20a139,_0x532ed5);_0x47b8f2(null);};}for(var e in events){if(events[_0x0512('0x6')](e)){var event=events[e];DashboardItem[_0x0512('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xb0dd=['hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','save','update','remove','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb0dd,0xc1));var _0xdb0d=function(_0x4654f7,_0x2d4205){_0x4654f7=_0x4654f7-0x0;var _0x14b3aa=_0xb0dd[_0x4654f7];return _0x14b3aa;};'use strict';var EventEmitter=require(_0xdb0d('0x0'));var DashboardItem=require(_0xdb0d('0x1'))['db'][_0xdb0d('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdb0d('0x3'),'afterUpdate':_0xdb0d('0x4'),'afterDestroy':_0xdb0d('0x5')};function emitEvent(_0x52a96f){return function(_0xe54f9d,_0x5bf0be,_0x4749d8){DashboardItemEvents[_0xdb0d('0x6')](_0x52a96f+':'+_0xe54f9d['id'],_0xe54f9d);DashboardItemEvents[_0xdb0d('0x6')](_0x52a96f,_0xe54f9d);_0x4749d8(null);};}for(var e in events){if(events[_0xdb0d('0x7')](e)){var event=events[e];DashboardItem[_0xdb0d('0x8')](e,emitEvent(event));}}module[_0xdb0d('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index e9848d7..afd1fdd 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 _0x1f1c=['moment','bluebird','request-promise','path','../../config/environment','exports','define','DashboardItem','dashboard_items','util','api'];(function(_0x551f90,_0x46c25f){var _0x767a4f=function(_0x33acd5){while(--_0x33acd5){_0x551f90['push'](_0x551f90['shift']());}};_0x767a4f(++_0x46c25f);}(_0x1f1c,0x1ed));var _0xc1f1=function(_0x20e7ef,_0x90911e){_0x20e7ef=_0x20e7ef-0x0;var _0x5045e1=_0x1f1c[_0x20e7ef];return _0x5045e1;};'use strict';var _=require('lodash');var util=require(_0xc1f1('0x0'));var logger=require('../../config/logger')(_0xc1f1('0x1'));var moment=require(_0xc1f1('0x2'));var BPromise=require(_0xc1f1('0x3'));var rp=require(_0xc1f1('0x4'));var fs=require('fs');var path=require(_0xc1f1('0x5'));var rimraf=require('rimraf');var config=require(_0xc1f1('0x6'));var attributes=require('./dashboardItem.attributes');module[_0xc1f1('0x7')]=function(_0x4902a8,_0x77601){return _0x4902a8[_0xc1f1('0x8')](_0xc1f1('0x9'),attributes,{'tableName':_0xc1f1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d23=['moment','bluebird','request-promise','path','../../config/environment','./dashboardItem.attributes','define','dashboard_items','lodash','util','api'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0x6d23,0x6b));var _0x36d2=function(_0x8b3a8a,_0x1ce5de){_0x8b3a8a=_0x8b3a8a-0x0;var _0x4e9011=_0x6d23[_0x8b3a8a];return _0x4e9011;};'use strict';var _=require(_0x36d2('0x0'));var util=require(_0x36d2('0x1'));var logger=require('../../config/logger')(_0x36d2('0x2'));var moment=require(_0x36d2('0x3'));var BPromise=require(_0x36d2('0x4'));var rp=require(_0x36d2('0x5'));var fs=require('fs');var path=require(_0x36d2('0x6'));var rimraf=require('rimraf');var config=require(_0x36d2('0x7'));var attributes=require(_0x36d2('0x8'));module['exports']=function(_0x7e13ef,_0x584992){return _0x7e13ef[_0x36d2('0x9')]('DashboardItem',attributes,{'tableName':_0x36d2('0xa'),'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 89b0c6d..b37bee3 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 _0xe5ea=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x251ee1,_0x4a3f4d){var _0x1f7495=function(_0x411f04){while(--_0x411f04){_0x251ee1['push'](_0x251ee1['shift']());}};_0x1f7495(++_0x4a3f4d);}(_0xe5ea,0xcf));var _0xae5e=function(_0x3fd79e,_0x66da71){_0x3fd79e=_0x3fd79e-0x0;var _0x3c5755=_0xe5ea[_0x3fd79e];return _0x3c5755;};'use strict';var _=require('lodash');var util=require(_0xae5e('0x0'));var moment=require(_0xae5e('0x1'));var BPromise=require(_0xae5e('0x2'));var rs=require(_0xae5e('0x3'));var fs=require('fs');var Redis=require(_0xae5e('0x4'));var db=require(_0xae5e('0x5'))['db'];var utils=require(_0xae5e('0x6'));var logger=require(_0xae5e('0x7'))('rpc');var config=require(_0xae5e('0x8'));var jayson=require(_0xae5e('0x9'));var client=jayson[_0xae5e('0xa')][_0xae5e('0xb')]({'port':0x232a});config[_0xae5e('0xc')]=_[_0xae5e('0xd')](config[_0xae5e('0xc')],{'host':_0xae5e('0xe'),'port':0x18eb});var socket=require(_0xae5e('0xf'))(new Redis(config[_0xae5e('0xc')]));require(_0xae5e('0x10'))['register'](socket);function respondWithRpcPromise(_0x4ea62c,_0x507a16,_0x529e3d){return new BPromise(function(_0x31071c,_0x238884){return client[_0xae5e('0x11')](_0x4ea62c,_0x529e3d)[_0xae5e('0x12')](function(_0xde32a){logger[_0xae5e('0x13')](_0xae5e('0x14'),_0x507a16,_0xae5e('0x15'));logger[_0xae5e('0x16')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x507a16,_0xae5e('0x15'),JSON[_0xae5e('0x17')](_0xde32a));if(_0xde32a['error']){if(_0xde32a[_0xae5e('0x18')][_0xae5e('0x19')]===0x1f4){logger['error'](_0xae5e('0x14'),_0x507a16,_0xde32a[_0xae5e('0x18')][_0xae5e('0x1a')]);return _0x238884(_0xde32a[_0xae5e('0x18')]['message']);}logger[_0xae5e('0x18')]('DashboardItem,\x20%s,\x20%s',_0x507a16,_0xde32a[_0xae5e('0x18')]['message']);return _0x31071c(_0xde32a[_0xae5e('0x18')][_0xae5e('0x1a')]);}else{logger[_0xae5e('0x13')](_0xae5e('0x14'),_0x507a16,'request\x20sent');_0x31071c(_0xde32a[_0xae5e('0x1b')][_0xae5e('0x1a')]);}})[_0xae5e('0x1c')](function(_0x17f8c6){logger[_0xae5e('0x18')](_0xae5e('0x14'),_0x507a16,_0x17f8c6);_0x238884(_0x17f8c6);});});} \ No newline at end of file +var _0xa4f8=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x28949a,_0x3c4e18){var _0x220936=function(_0x27a8e8){while(--_0x27a8e8){_0x28949a['push'](_0x28949a['shift']());}};_0x220936(++_0x3c4e18);}(_0xa4f8,0x1f4));var _0x8a4f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa4f8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8a4f('0x0'));var util=require('util');var moment=require(_0x8a4f('0x1'));var BPromise=require(_0x8a4f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a4f('0x3'));var db=require(_0x8a4f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a4f('0x5'))(_0x8a4f('0x6'));var config=require(_0x8a4f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8a4f('0x8')]({'port':0x232a});config[_0x8a4f('0x9')]=_[_0x8a4f('0xa')](config[_0x8a4f('0x9')],{'host':_0x8a4f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8a4f('0x9')]));require(_0x8a4f('0xc'))[_0x8a4f('0xd')](socket);function respondWithRpcPromise(_0x112676,_0x56ba71,_0x7ec341){return new BPromise(function(_0x278a55,_0x52af90){return client[_0x8a4f('0xe')](_0x112676,_0x7ec341)['then'](function(_0x2fc9f3){logger[_0x8a4f('0xf')](_0x8a4f('0x10'),_0x56ba71,_0x8a4f('0x11'));logger[_0x8a4f('0x12')](_0x8a4f('0x13'),_0x56ba71,_0x8a4f('0x11'),JSON[_0x8a4f('0x14')](_0x2fc9f3));if(_0x2fc9f3[_0x8a4f('0x15')]){if(_0x2fc9f3['error']['code']===0x1f4){logger[_0x8a4f('0x15')](_0x8a4f('0x10'),_0x56ba71,_0x2fc9f3[_0x8a4f('0x15')]['message']);return _0x52af90(_0x2fc9f3[_0x8a4f('0x15')]['message']);}logger[_0x8a4f('0x15')]('DashboardItem,\x20%s,\x20%s',_0x56ba71,_0x2fc9f3[_0x8a4f('0x15')][_0x8a4f('0x16')]);return _0x278a55(_0x2fc9f3['error'][_0x8a4f('0x16')]);}else{logger[_0x8a4f('0xf')](_0x8a4f('0x10'),_0x56ba71,_0x8a4f('0x11'));_0x278a55(_0x2fc9f3[_0x8a4f('0x17')]['message']);}})[_0x8a4f('0x18')](function(_0x15c9e3){logger[_0x8a4f('0x15')](_0x8a4f('0x10'),_0x56ba71,_0x15c9e3);_0x52af90(_0x15c9e3);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index c8310d8..e06b872 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 _0x0997=['save','remove','register','dashboardItem:','./dashboardItem.events'];(function(_0x488300,_0x54b265){var _0x3a82a7=function(_0x572659){while(--_0x572659){_0x488300['push'](_0x488300['shift']());}};_0x3a82a7(++_0x54b265);}(_0x0997,0x135));var _0x7099=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0997[_0x20a584];return _0x4b41a8;};'use strict';var DashboardItemEvents=require(_0x7099('0x0'));var events=[_0x7099('0x1'),_0x7099('0x2'),'update'];function createListener(_0x231996,_0x29c6f2){return function(_0x2033ae){_0x29c6f2['emit'](_0x231996,_0x2033ae);};}function removeListener(_0x108b1a,_0x5242b3){return function(){DashboardItemEvents['removeListener'](_0x108b1a,_0x5242b3);};}exports[_0x7099('0x3')]=function(_0xa43d93){for(var _0x326929=0x0,_0x2c59ab=events['length'];_0x326929<_0x2c59ab;_0x326929++){var _0x2f25c2=events[_0x326929];var _0x43f001=createListener(_0x7099('0x4')+_0x2f25c2,_0xa43d93);DashboardItemEvents['on'](_0x2f25c2,_0x43f001);}}; \ No newline at end of file +var _0x2d45=['save','remove','update','emit','register','length','./dashboardItem.events'];(function(_0x4c6e7e,_0x151f05){var _0x5770ff=function(_0x192b65){while(--_0x192b65){_0x4c6e7e['push'](_0x4c6e7e['shift']());}};_0x5770ff(++_0x151f05);}(_0x2d45,0x195));var _0x52d4=function(_0x5eb3c9,_0x37673d){_0x5eb3c9=_0x5eb3c9-0x0;var _0x3608c2=_0x2d45[_0x5eb3c9];return _0x3608c2;};'use strict';var DashboardItemEvents=require(_0x52d4('0x0'));var events=[_0x52d4('0x1'),_0x52d4('0x2'),_0x52d4('0x3')];function createListener(_0x4eaa3a,_0x3e83be){return function(_0x59531c){_0x3e83be[_0x52d4('0x4')](_0x4eaa3a,_0x59531c);};}function removeListener(_0x3c08b5,_0x476227){return function(){DashboardItemEvents['removeListener'](_0x3c08b5,_0x476227);};}exports[_0x52d4('0x5')]=function(_0x16d373){for(var _0x3a52f6=0x0,_0x45ccc4=events[_0x52d4('0x6')];_0x3a52f6<_0x45ccc4;_0x3a52f6++){var _0x5be438=events[_0x3a52f6];var _0x1df239=createListener('dashboardItem:'+_0x5be438,_0x16d373);DashboardItemEvents['on'](_0x5be438,_0x1df239);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 379ef00..ce23764 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 _0x8516=['../../config/environment','get','isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3f3f06,_0x581e5b){var _0x140feb=function(_0x4cc383){while(--_0x4cc383){_0x3f3f06['push'](_0x3f3f06['shift']());}};_0x140feb(++_0x581e5b);}(_0x8516,0x1c0));var _0x6851=function(_0x2af312,_0x2588df){_0x2af312=_0x2af312-0x0;var _0x14bde5=_0x8516[_0x2af312];return _0x14bde5;};'use strict';var multer=require(_0x6851('0x0'));var util=require('util');var path=require(_0x6851('0x1'));var timeout=require(_0x6851('0x2'));var express=require(_0x6851('0x3'));var router=express[_0x6851('0x4')]();var fs_extra=require(_0x6851('0x5'));var auth=require(_0x6851('0x6'));var interaction=require(_0x6851('0x7'));var config=require(_0x6851('0x8'));var controller=require('./dashboardItem.controller');router[_0x6851('0x9')]('/:id',auth[_0x6851('0xa')](),controller[_0x6851('0xb')]);router[_0x6851('0xc')]('/',auth[_0x6851('0xa')](),controller[_0x6851('0xd')]);router[_0x6851('0xe')](_0x6851('0xf'),auth['isAuthenticated'](),controller[_0x6851('0x10')]);router['delete'](_0x6851('0xf'),auth[_0x6851('0xa')](),controller[_0x6851('0x11')]);module[_0x6851('0x12')]=router; \ No newline at end of file +var _0x0253=['connect-timeout','express','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','post','create','update','delete','util','path'];(function(_0x3af881,_0xe63125){var _0x225dd9=function(_0x20d5be){while(--_0x20d5be){_0x3af881['push'](_0x3af881['shift']());}};_0x225dd9(++_0xe63125);}(_0x0253,0x11c));var _0x3025=function(_0x3215ea,_0x3dd690){_0x3215ea=_0x3215ea-0x0;var _0x3d6fd2=_0x0253[_0x3215ea];return _0x3d6fd2;};'use strict';var multer=require('multer');var util=require(_0x3025('0x0'));var path=require(_0x3025('0x1'));var timeout=require(_0x3025('0x2'));var express=require(_0x3025('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3025('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3025('0x5'));var controller=require('./dashboardItem.controller');router[_0x3025('0x6')](_0x3025('0x7'),auth[_0x3025('0x8')](),controller['show']);router[_0x3025('0x9')]('/',auth[_0x3025('0x8')](),controller[_0x3025('0xa')]);router['put'](_0x3025('0x7'),auth['isAuthenticated'](),controller[_0x3025('0xb')]);router[_0x3025('0xc')](_0x3025('0x7'),auth[_0x3025('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 6f0d781..5018721 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 _0x8f29=['ENUM','first','second','third','sequelize','exports'];(function(_0x55c09c,_0x406cfe){var _0x35c8ed=function(_0x2d3612){while(--_0x2d3612){_0x55c09c['push'](_0x55c09c['shift']());}};_0x35c8ed(++_0x406cfe);}(_0x8f29,0x124));var _0x98f2=function(_0x3e803e,_0x4ea857){_0x3e803e=_0x3e803e-0x0;var _0x2bcdb6=_0x8f29[_0x3e803e];return _0x2bcdb6;};'use strict';var Sequelize=require(_0x98f2('0x0'));module[_0x98f2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x98f2('0x2')](_0x98f2('0x3'),_0x98f2('0x4'),_0x98f2('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa2b3=['STRING','ENUM','first','third','exports'];(function(_0x549386,_0x45ad0f){var _0x12b4d4=function(_0x5a76e8){while(--_0x5a76e8){_0x549386['push'](_0x549386['shift']());}};_0x12b4d4(++_0x45ad0f);}(_0xa2b3,0x77));var _0x3a2b=function(_0x30df6a,_0x1c77b8){_0x30df6a=_0x30df6a-0x0;var _0xad223f=_0xa2b3[_0x30df6a];return _0xad223f;};'use strict';var Sequelize=require('sequelize');module[_0x3a2b('0x0')]={'name':{'type':Sequelize[_0x3a2b('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x3a2b('0x2')](_0x3a2b('0x3'),'second',_0x3a2b('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x3a2b('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 32d430b..3a91102 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 _0xf40b=['zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','type','key','model','keys','filters','query','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','rimraf'];(function(_0x598f07,_0x4d383f){var _0x45594e=function(_0xfd1dc2){while(--_0xfd1dc2){_0x598f07['push'](_0x598f07['shift']());}};_0x45594e(++_0x4d383f);}(_0xf40b,0xfb));var _0xbf40=function(_0x448c09,_0x40cacc){_0x448c09=_0x448c09-0x0;var _0x3825cd=_0xf40b[_0x448c09];return _0x3825cd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf40('0x0'));var zipdir=require(_0xbf40('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf40('0x2'));var moment=require(_0xbf40('0x3'));var BPromise=require(_0xbf40('0x4'));var Mustache=require(_0xbf40('0x5'));var util=require(_0xbf40('0x6'));var path=require('path');var sox=require(_0xbf40('0x7'));var csv=require(_0xbf40('0x8'));var ejs=require(_0xbf40('0x9'));var fs=require('fs');var fs_extra=require(_0xbf40('0xa'));var _=require(_0xbf40('0xb'));var squel=require('squel');var crypto=require(_0xbf40('0xc'));var jsforce=require(_0xbf40('0xd'));var deskjs=require(_0xbf40('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbf40('0xf'));var Papa=require(_0xbf40('0x10'));var Redis=require(_0xbf40('0x11'));var authService=require(_0xbf40('0x12'));var qs=require(_0xbf40('0x13'));var as=require(_0xbf40('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf40('0x15'))('api');var utils=require(_0xbf40('0x16'));var config=require(_0xbf40('0x17'));var licenseUtil=require(_0xbf40('0x18'));var db=require(_0xbf40('0x19'))['db'];function respondWithStatusCode(_0x4c3088,_0x144352){_0x144352=_0x144352||0xcc;return function(_0x1a05ce){if(_0x1a05ce){return _0x4c3088['sendStatus'](_0x144352);}return _0x4c3088[_0xbf40('0x1a')](_0x144352)[_0xbf40('0x1b')]();};}function respondWithResult(_0x119bb8,_0x235110){_0x235110=_0x235110||0xc8;return function(_0x417094){if(_0x417094){return _0x119bb8[_0xbf40('0x1a')](_0x235110)[_0xbf40('0x1c')](_0x417094);}};}function respondWithFilteredResult(_0x51e799,_0x3d4c98){return function(_0x3b7f2b){if(_0x3b7f2b){var _0x4b223a=typeof _0x3d4c98[_0xbf40('0x1d')]===_0xbf40('0x1e')&&typeof _0x3d4c98[_0xbf40('0x1f')]==='undefined';var _0x4e2134=_0x3b7f2b[_0xbf40('0x20')];var _0x2fa58d=_0x4b223a?0x0:_0x3d4c98[_0xbf40('0x1d')];var _0x198a4f=_0x4b223a?_0x3b7f2b[_0xbf40('0x20')]:_0x3d4c98['offset']+_0x3d4c98[_0xbf40('0x1f')];var _0x12ff75;if(_0x198a4f>=_0x4e2134){_0x198a4f=_0x4e2134;_0x12ff75=0xc8;}else{_0x12ff75=0xce;}_0x51e799[_0xbf40('0x1a')](_0x12ff75);return _0x51e799[_0xbf40('0x21')]('Content-Range',_0x2fa58d+'-'+_0x198a4f+'/'+_0x4e2134)[_0xbf40('0x1c')](_0x3b7f2b);}return null;};}function patchUpdates(_0x17e3ef){return function(_0x10f5d2){try{jsonpatch['apply'](_0x10f5d2,_0x17e3ef,!![]);}catch(_0x307995){return BPromise[_0xbf40('0x22')](_0x307995);}return _0x10f5d2[_0xbf40('0x23')]();};}function saveUpdates(_0x2d17f,_0x5686c6){return function(_0x149d27){if(_0x149d27){return _0x149d27[_0xbf40('0x24')](_0x2d17f)['then'](function(_0xe0a013){return _0xe0a013;});}return null;};}function removeEntity(_0x4dbc76,_0x37f8d1){return function(_0x21f700){if(_0x21f700){return _0x21f700[_0xbf40('0x25')]()[_0xbf40('0x26')](function(){var _0xfee99b=_0x21f700[_0xbf40('0x27')]({'plain':!![]});var _0x5b33dd=_0xbf40('0x28');return db[_0xbf40('0x29')]['destroy']({'where':{'type':_0x5b33dd,'resourceId':_0xfee99b['id']}})[_0xbf40('0x26')](function(){return _0x21f700;});})[_0xbf40('0x26')](function(){_0x4dbc76[_0xbf40('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dff39,_0xee45f8){return function(_0x2c0179){if(!_0x2c0179){_0x3dff39['sendStatus'](0x194);}return _0x2c0179;};}function handleError(_0x535361,_0x1b1a0c){_0x1b1a0c=_0x1b1a0c||0x1f4;return function(_0x3b43e5){logger[_0xbf40('0x2a')](_0x3b43e5[_0xbf40('0x2b')]);if(_0x3b43e5['name']){delete _0x3b43e5[_0xbf40('0x2c')];}_0x535361[_0xbf40('0x1a')](_0x1b1a0c)[_0xbf40('0x2d')](_0x3b43e5);};}exports[_0xbf40('0x2e')]=function(_0x13ba8e,_0x467c53){var _0x35bc29={},_0x595f25={},_0x5a5cf3={'count':0x0,'rows':[]};var _0x43cd4a=_[_0xbf40('0x2f')](db[_0xbf40('0x30')][_0xbf40('0x31')],function(_0x552d1e){return{'name':_0x552d1e['fieldName'],'type':_0x552d1e[_0xbf40('0x32')][_0xbf40('0x33')]};});_0x595f25[_0xbf40('0x34')]=_[_0xbf40('0x2f')](_0x43cd4a,_0xbf40('0x2c'));_0x595f25['query']=_[_0xbf40('0x35')](_0x13ba8e['query']);_0x595f25[_0xbf40('0x36')]=_['intersection'](_0x595f25[_0xbf40('0x34')],_0x595f25[_0xbf40('0x37')]);_0x35bc29[_0xbf40('0x38')]=_[_0xbf40('0x39')](_0x595f25['model'],qs[_0xbf40('0x3a')](_0x13ba8e['query']['fields']));_0x35bc29[_0xbf40('0x38')]=_0x35bc29[_0xbf40('0x38')]['length']?_0x35bc29[_0xbf40('0x38')]:_0x595f25[_0xbf40('0x34')];if(!_0x13ba8e[_0xbf40('0x37')][_0xbf40('0x3b')]('nolimit')){_0x35bc29['limit']=qs[_0xbf40('0x1f')](_0x13ba8e[_0xbf40('0x37')]['limit']);_0x35bc29[_0xbf40('0x1d')]=qs[_0xbf40('0x1d')](_0x13ba8e[_0xbf40('0x37')]['offset']);}_0x35bc29[_0xbf40('0x3c')]=qs[_0xbf40('0x3d')](_0x13ba8e[_0xbf40('0x37')]['sort']);_0x35bc29[_0xbf40('0x3e')]=qs[_0xbf40('0x36')](_[_0xbf40('0x3f')](_0x13ba8e['query'],_0x595f25[_0xbf40('0x36')]),_0x43cd4a);if(_0x13ba8e[_0xbf40('0x37')][_0xbf40('0x40')]){_0x35bc29['where']=_[_0xbf40('0x41')](_0x35bc29['where'],{'$or':_[_0xbf40('0x2f')](_0x43cd4a,function(_0x12cf67){if(_0x12cf67[_0xbf40('0x32')]!==_0xbf40('0x42')){var _0x45fa61={};_0x45fa61[_0x12cf67[_0xbf40('0x2c')]]={'$like':'%'+_0x13ba8e[_0xbf40('0x37')]['filter']+'%'};return _0x45fa61;}})});}_0x35bc29=_[_0xbf40('0x41')]({},_0x35bc29,_0x13ba8e[_0xbf40('0x43')]);var _0x27a915={'where':_0x35bc29[_0xbf40('0x3e')]};return db[_0xbf40('0x30')][_0xbf40('0x20')](_0x27a915)[_0xbf40('0x26')](function(_0x5d5bb2){_0x5a5cf3[_0xbf40('0x20')]=_0x5d5bb2;if(_0x13ba8e['query'][_0xbf40('0x44')]){_0x35bc29[_0xbf40('0x45')]=[{'all':!![]}];}return db[_0xbf40('0x30')][_0xbf40('0x46')](_0x35bc29);})['then'](function(_0xd08ca2){_0x5a5cf3[_0xbf40('0x47')]=_0xd08ca2;return _0x5a5cf3;})[_0xbf40('0x26')](respondWithFilteredResult(_0x467c53,_0x35bc29))[_0xbf40('0x48')](handleError(_0x467c53,null));};exports[_0xbf40('0x49')]=function(_0x4fe0b7,_0x46a537){var _0x24accf={'raw':!![],'where':{'id':_0x4fe0b7['params']['id']}},_0x27cb62={};_0x27cb62['model']=_['keys'](db[_0xbf40('0x30')][_0xbf40('0x31')]);_0x27cb62[_0xbf40('0x37')]=_[_0xbf40('0x35')](_0x4fe0b7[_0xbf40('0x37')]);_0x27cb62[_0xbf40('0x36')]=_[_0xbf40('0x39')](_0x27cb62[_0xbf40('0x34')],_0x27cb62[_0xbf40('0x37')]);_0x24accf[_0xbf40('0x38')]=_['intersection'](_0x27cb62[_0xbf40('0x34')],qs['fields'](_0x4fe0b7[_0xbf40('0x37')]['fields']));_0x24accf['attributes']=_0x24accf[_0xbf40('0x38')][_0xbf40('0x4a')]?_0x24accf['attributes']:_0x27cb62[_0xbf40('0x34')];if(_0x4fe0b7[_0xbf40('0x37')][_0xbf40('0x44')]){_0x24accf[_0xbf40('0x45')]=[{'all':!![]}];}_0x24accf=_[_0xbf40('0x41')]({},_0x24accf,_0x4fe0b7[_0xbf40('0x43')]);return db['Disposition'][_0xbf40('0x4b')](_0x24accf)[_0xbf40('0x26')](handleEntityNotFound(_0x46a537,null))[_0xbf40('0x26')](respondWithResult(_0x46a537,null))['catch'](handleError(_0x46a537,null));};exports[_0xbf40('0x4c')]=function(_0x50498b,_0x1aff75){return db['Disposition'][_0xbf40('0x4c')](_0x50498b[_0xbf40('0x4d')],{})['then'](function(_0x30387a){var _0x1a0a55=_0x50498b[_0xbf40('0x4e')]['get']({'plain':!![]});if(!_0x1a0a55)throw new Error(_0xbf40('0x4f'));if(_0x1a0a55['role']==='user'){var _0x24c670=_0x30387a[_0xbf40('0x27')]({'plain':!![]});var _0x2128b2=_0xbf40('0x28');return db[_0xbf40('0x50')]['find']({'where':{'name':_0x2128b2,'userProfileId':_0x1a0a55[_0xbf40('0x51')]},'raw':!![]})[_0xbf40('0x26')](function(_0x380a10){if(_0x380a10&&_0x380a10[_0xbf40('0x52')]===0x0){return db[_0xbf40('0x29')]['create']({'name':_0x24c670['name'],'resourceId':_0x24c670['id'],'type':_0x380a10['name'],'sectionId':_0x380a10['id']},{})[_0xbf40('0x26')](function(){return _0x30387a;});}else{return _0x30387a;}})['catch'](function(_0x3555e1){logger[_0xbf40('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3555e1);throw _0x3555e1;});}return _0x30387a;})[_0xbf40('0x26')](respondWithResult(_0x1aff75,0xc9))[_0xbf40('0x48')](handleError(_0x1aff75,null));};exports['update']=function(_0x220450,_0x33c0aa){if(_0x220450[_0xbf40('0x4d')]['id']){delete _0x220450[_0xbf40('0x4d')]['id'];}return db[_0xbf40('0x30')][_0xbf40('0x4b')]({'where':{'id':_0x220450[_0xbf40('0x53')]['id']}})[_0xbf40('0x26')](handleEntityNotFound(_0x33c0aa,null))[_0xbf40('0x26')](saveUpdates(_0x220450[_0xbf40('0x4d')],null))['then'](respondWithResult(_0x33c0aa,null))['catch'](handleError(_0x33c0aa,null));};exports[_0xbf40('0x25')]=function(_0x384279,_0x17a1b4){return db[_0xbf40('0x30')]['find']({'where':{'id':_0x384279[_0xbf40('0x53')]['id']}})[_0xbf40('0x26')](handleEntityNotFound(_0x17a1b4,null))[_0xbf40('0x26')](removeEntity(_0x17a1b4,null))[_0xbf40('0x48')](handleError(_0x17a1b4,null));}; \ No newline at end of file +var _0xa166=['name','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','includeAll','include','findAll','show','params','length','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Dispositions','UserProfileResource'];(function(_0x5a888a,_0x1f8460){var _0x14dd31=function(_0x202643){while(--_0x202643){_0x5a888a['push'](_0x5a888a['shift']());}};_0x14dd31(++_0x1f8460);}(_0xa166,0x1be));var _0x6a16=function(_0x360a38,_0x14fe94){_0x360a38=_0x360a38-0x0;var _0x1c6544=_0xa166[_0x360a38];return _0x1c6544;};'use strict';var emlformat=require(_0x6a16('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6a16('0x1'));var moment=require(_0x6a16('0x2'));var BPromise=require(_0x6a16('0x3'));var Mustache=require('mustache');var util=require(_0x6a16('0x4'));var path=require('path');var sox=require(_0x6a16('0x5'));var csv=require(_0x6a16('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a16('0x7'));var squel=require(_0x6a16('0x8'));var crypto=require(_0x6a16('0x9'));var jsforce=require(_0x6a16('0xa'));var deskjs=require(_0x6a16('0xb'));var toCsv=require(_0x6a16('0x6'));var querystring=require(_0x6a16('0xc'));var Papa=require('papaparse');var Redis=require(_0x6a16('0xd'));var authService=require(_0x6a16('0xe'));var qs=require(_0x6a16('0xf'));var as=require(_0x6a16('0x10'));var hardwareService=require(_0x6a16('0x11'));var logger=require(_0x6a16('0x12'))('api');var utils=require(_0x6a16('0x13'));var config=require(_0x6a16('0x14'));var licenseUtil=require(_0x6a16('0x15'));var db=require(_0x6a16('0x16'))['db'];function respondWithStatusCode(_0x1fc1e0,_0x4d55c2){_0x4d55c2=_0x4d55c2||0xcc;return function(_0x2a03ff){if(_0x2a03ff){return _0x1fc1e0['sendStatus'](_0x4d55c2);}return _0x1fc1e0[_0x6a16('0x17')](_0x4d55c2)[_0x6a16('0x18')]();};}function respondWithResult(_0x5c4888,_0x4829da){_0x4829da=_0x4829da||0xc8;return function(_0x38835f){if(_0x38835f){return _0x5c4888[_0x6a16('0x17')](_0x4829da)[_0x6a16('0x19')](_0x38835f);}};}function respondWithFilteredResult(_0x2195bf,_0x36a3ac){return function(_0x2d05a0){if(_0x2d05a0){var _0x530c32=typeof _0x36a3ac[_0x6a16('0x1a')]===_0x6a16('0x1b')&&typeof _0x36a3ac[_0x6a16('0x1c')]===_0x6a16('0x1b');var _0x244d01=_0x2d05a0[_0x6a16('0x1d')];var _0x3f36a7=_0x530c32?0x0:_0x36a3ac['offset'];var _0x4704fa=_0x530c32?_0x2d05a0['count']:_0x36a3ac[_0x6a16('0x1a')]+_0x36a3ac[_0x6a16('0x1c')];var _0x33f637;if(_0x4704fa>=_0x244d01){_0x4704fa=_0x244d01;_0x33f637=0xc8;}else{_0x33f637=0xce;}_0x2195bf['status'](_0x33f637);return _0x2195bf[_0x6a16('0x1e')](_0x6a16('0x1f'),_0x3f36a7+'-'+_0x4704fa+'/'+_0x244d01)['json'](_0x2d05a0);}return null;};}function patchUpdates(_0xe7d99f){return function(_0x5e0a5f){try{jsonpatch[_0x6a16('0x20')](_0x5e0a5f,_0xe7d99f,!![]);}catch(_0x2fcd9b){return BPromise[_0x6a16('0x21')](_0x2fcd9b);}return _0x5e0a5f[_0x6a16('0x22')]();};}function saveUpdates(_0x11e210,_0x8aa476){return function(_0x4b027d){if(_0x4b027d){return _0x4b027d[_0x6a16('0x23')](_0x11e210)[_0x6a16('0x24')](function(_0x2bf7ab){return _0x2bf7ab;});}return null;};}function removeEntity(_0x2d0d7e,_0x9cb29e){return function(_0x9fbd6f){if(_0x9fbd6f){return _0x9fbd6f[_0x6a16('0x25')]()['then'](function(){var _0x2051c9=_0x9fbd6f['get']({'plain':!![]});var _0x11dc41=_0x6a16('0x26');return db[_0x6a16('0x27')]['destroy']({'where':{'type':_0x11dc41,'resourceId':_0x2051c9['id']}})[_0x6a16('0x24')](function(){return _0x9fbd6f;});})[_0x6a16('0x24')](function(){_0x2d0d7e[_0x6a16('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b7880,_0x56402b){return function(_0x3ed0af){if(!_0x3ed0af){_0x5b7880['sendStatus'](0x194);}return _0x3ed0af;};}function handleError(_0x5d086d,_0x13cd10){_0x13cd10=_0x13cd10||0x1f4;return function(_0x3e4b67){logger['error'](_0x3e4b67['stack']);if(_0x3e4b67['name']){delete _0x3e4b67[_0x6a16('0x28')];}_0x5d086d[_0x6a16('0x17')](_0x13cd10)['send'](_0x3e4b67);};}exports[_0x6a16('0x29')]=function(_0x57faff,_0x2f0eee){var _0x1311c6={},_0x2262a0={},_0xb00fb3={'count':0x0,'rows':[]};var _0x2e76dd=_[_0x6a16('0x2a')](db[_0x6a16('0x2b')][_0x6a16('0x2c')],function(_0x365c9b){return{'name':_0x365c9b[_0x6a16('0x2d')],'type':_0x365c9b[_0x6a16('0x2e')][_0x6a16('0x2f')]};});_0x2262a0[_0x6a16('0x30')]=_[_0x6a16('0x2a')](_0x2e76dd,'name');_0x2262a0[_0x6a16('0x31')]=_[_0x6a16('0x32')](_0x57faff[_0x6a16('0x31')]);_0x2262a0[_0x6a16('0x33')]=_['intersection'](_0x2262a0[_0x6a16('0x30')],_0x2262a0[_0x6a16('0x31')]);_0x1311c6['attributes']=_[_0x6a16('0x34')](_0x2262a0[_0x6a16('0x30')],qs['fields'](_0x57faff[_0x6a16('0x31')][_0x6a16('0x35')]));_0x1311c6[_0x6a16('0x36')]=_0x1311c6[_0x6a16('0x36')]['length']?_0x1311c6['attributes']:_0x2262a0[_0x6a16('0x30')];if(!_0x57faff[_0x6a16('0x31')]['hasOwnProperty']('nolimit')){_0x1311c6['limit']=qs[_0x6a16('0x1c')](_0x57faff[_0x6a16('0x31')]['limit']);_0x1311c6[_0x6a16('0x1a')]=qs['offset'](_0x57faff[_0x6a16('0x31')][_0x6a16('0x1a')]);}_0x1311c6[_0x6a16('0x37')]=qs[_0x6a16('0x38')](_0x57faff[_0x6a16('0x31')]['sort']);_0x1311c6[_0x6a16('0x39')]=qs['filters'](_[_0x6a16('0x3a')](_0x57faff[_0x6a16('0x31')],_0x2262a0['filters']),_0x2e76dd);if(_0x57faff['query'][_0x6a16('0x3b')]){_0x1311c6[_0x6a16('0x39')]=_[_0x6a16('0x3c')](_0x1311c6[_0x6a16('0x39')],{'$or':_[_0x6a16('0x2a')](_0x2e76dd,function(_0x52ed1f){if(_0x52ed1f[_0x6a16('0x2e')]!=='VIRTUAL'){var _0x3f4207={};_0x3f4207[_0x52ed1f[_0x6a16('0x28')]]={'$like':'%'+_0x57faff[_0x6a16('0x31')][_0x6a16('0x3b')]+'%'};return _0x3f4207;}})});}_0x1311c6=_[_0x6a16('0x3c')]({},_0x1311c6,_0x57faff['options']);var _0x357311={'where':_0x1311c6[_0x6a16('0x39')]};return db['Disposition'][_0x6a16('0x1d')](_0x357311)['then'](function(_0x301878){_0xb00fb3['count']=_0x301878;if(_0x57faff['query'][_0x6a16('0x3d')]){_0x1311c6[_0x6a16('0x3e')]=[{'all':!![]}];}return db[_0x6a16('0x2b')][_0x6a16('0x3f')](_0x1311c6);})[_0x6a16('0x24')](function(_0x5e020e){_0xb00fb3['rows']=_0x5e020e;return _0xb00fb3;})[_0x6a16('0x24')](respondWithFilteredResult(_0x2f0eee,_0x1311c6))['catch'](handleError(_0x2f0eee,null));};exports[_0x6a16('0x40')]=function(_0x212ea5,_0x20ec12){var _0x3885c7={'raw':!![],'where':{'id':_0x212ea5[_0x6a16('0x41')]['id']}},_0x21973a={};_0x21973a['model']=_[_0x6a16('0x32')](db[_0x6a16('0x2b')][_0x6a16('0x2c')]);_0x21973a[_0x6a16('0x31')]=_[_0x6a16('0x32')](_0x212ea5[_0x6a16('0x31')]);_0x21973a[_0x6a16('0x33')]=_[_0x6a16('0x34')](_0x21973a[_0x6a16('0x30')],_0x21973a['query']);_0x3885c7[_0x6a16('0x36')]=_[_0x6a16('0x34')](_0x21973a[_0x6a16('0x30')],qs['fields'](_0x212ea5[_0x6a16('0x31')][_0x6a16('0x35')]));_0x3885c7[_0x6a16('0x36')]=_0x3885c7['attributes'][_0x6a16('0x42')]?_0x3885c7['attributes']:_0x21973a['model'];if(_0x212ea5['query']['includeAll']){_0x3885c7[_0x6a16('0x3e')]=[{'all':!![]}];}_0x3885c7=_[_0x6a16('0x3c')]({},_0x3885c7,_0x212ea5[_0x6a16('0x43')]);return db['Disposition'][_0x6a16('0x44')](_0x3885c7)['then'](handleEntityNotFound(_0x20ec12,null))[_0x6a16('0x24')](respondWithResult(_0x20ec12,null))[_0x6a16('0x45')](handleError(_0x20ec12,null));};exports[_0x6a16('0x46')]=function(_0x5b08cc,_0x4a80a2){return db[_0x6a16('0x2b')]['create'](_0x5b08cc[_0x6a16('0x47')],{})[_0x6a16('0x24')](function(_0x2d9ab){var _0x1a160b=_0x5b08cc[_0x6a16('0x48')][_0x6a16('0x49')]({'plain':!![]});if(!_0x1a160b)throw new Error(_0x6a16('0x4a'));if(_0x1a160b[_0x6a16('0x4b')]===_0x6a16('0x48')){var _0x4d74ec=_0x2d9ab[_0x6a16('0x49')]({'plain':!![]});var _0xe88dc3='Dispositions';return db[_0x6a16('0x4c')][_0x6a16('0x44')]({'where':{'name':_0xe88dc3,'userProfileId':_0x1a160b[_0x6a16('0x4d')]},'raw':!![]})[_0x6a16('0x24')](function(_0x37957d){if(_0x37957d&&_0x37957d[_0x6a16('0x4e')]===0x0){return db['UserProfileResource'][_0x6a16('0x46')]({'name':_0x4d74ec[_0x6a16('0x28')],'resourceId':_0x4d74ec['id'],'type':_0x37957d['name'],'sectionId':_0x37957d['id']},{})['then'](function(){return _0x2d9ab;});}else{return _0x2d9ab;}})[_0x6a16('0x45')](function(_0x4e5093){logger[_0x6a16('0x4f')](_0x6a16('0x50'),_0x4e5093);throw _0x4e5093;});}return _0x2d9ab;})[_0x6a16('0x24')](respondWithResult(_0x4a80a2,0xc9))[_0x6a16('0x45')](handleError(_0x4a80a2,null));};exports[_0x6a16('0x23')]=function(_0x305c8d,_0x5b0c3c){if(_0x305c8d[_0x6a16('0x47')]['id']){delete _0x305c8d['body']['id'];}return db['Disposition'][_0x6a16('0x44')]({'where':{'id':_0x305c8d[_0x6a16('0x41')]['id']}})[_0x6a16('0x24')](handleEntityNotFound(_0x5b0c3c,null))[_0x6a16('0x24')](saveUpdates(_0x305c8d[_0x6a16('0x47')],null))[_0x6a16('0x24')](respondWithResult(_0x5b0c3c,null))[_0x6a16('0x45')](handleError(_0x5b0c3c,null));};exports[_0x6a16('0x25')]=function(_0x42e981,_0x48028d){return db['Disposition'][_0x6a16('0x44')]({'where':{'id':_0x42e981[_0x6a16('0x41')]['id']}})['then'](handleEntityNotFound(_0x48028d,null))['then'](removeEntity(_0x48028d,null))['catch'](handleError(_0x48028d,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 237f85b..0595b5b 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 _0x7822=['name_openchannel','WhatsappAccountId','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','define','Disposition','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId'];(function(_0x1c06f4,_0x4ff1b8){var _0x36e37a=function(_0x4b2f6f){while(--_0x4b2f6f){_0x1c06f4['push'](_0x1c06f4['shift']());}};_0x36e37a(++_0x4ff1b8);}(_0x7822,0x1b7));var _0x2782=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7822[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2782('0x0'));var logger=require(_0x2782('0x1'))('api');var moment=require(_0x2782('0x2'));var BPromise=require(_0x2782('0x3'));var rp=require(_0x2782('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2782('0x5'));var config=require(_0x2782('0x6'));var attributes=require(_0x2782('0x7'));module['exports']=function(_0x8b69d0,_0x65ee57){return _0x8b69d0[_0x2782('0x8')](_0x2782('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x2782('0xa'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x2782('0xa'),_0x2782('0xb')]},{'unique':!![],'name':_0x2782('0xc'),'fields':[_0x2782('0xa'),_0x2782('0xd')]},{'unique':!![],'name':_0x2782('0xe'),'fields':[_0x2782('0xa'),_0x2782('0xf')]},{'unique':!![],'name':'name_fax','fields':['name',_0x2782('0x10')]},{'unique':!![],'name':_0x2782('0x11'),'fields':[_0x2782('0xa'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x2782('0xa'),_0x2782('0x12')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x67ec=['name_chat','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','../../config/logger','api','moment','bluebird','./disposition.attributes','Disposition','name','ListId'];(function(_0x30ee43,_0x2675eb){var _0x1664b3=function(_0x2e1282){while(--_0x2e1282){_0x30ee43['push'](_0x30ee43['shift']());}};_0x1664b3(++_0x2675eb);}(_0x67ec,0xd8));var _0xc67e=function(_0x4cc9d2,_0x216c44){_0x4cc9d2=_0x4cc9d2-0x0;var _0x45db56=_0x67ec[_0x4cc9d2];return _0x45db56;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc67e('0x0'))(_0xc67e('0x1'));var moment=require(_0xc67e('0x2'));var BPromise=require(_0xc67e('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(_0xc67e('0x4'));module['exports']=function(_0x3e2582,_0x260591){return _0x3e2582['define'](_0xc67e('0x5'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xc67e('0x6'),_0xc67e('0x7')]},{'unique':!![],'name':_0xc67e('0x8'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0xc67e('0x6'),_0xc67e('0x9')]},{'unique':!![],'name':_0xc67e('0xa'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0xc67e('0xb'),'fields':[_0xc67e('0x6'),_0xc67e('0xc')]},{'unique':!![],'name':_0xc67e('0xd'),'fields':[_0xc67e('0x6'),_0xc67e('0xe')]},{'unique':!![],'name':_0xc67e('0xf'),'fields':[_0xc67e('0x6'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index a8e3a05..a9db7c0 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(_0x22052f,_0x274768){var _0x1658c2=function(_0x584ac5){while(--_0x584ac5){_0x22052f['push'](_0x22052f['shift']());}};_0x1658c2(++_0x274768);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x15c734,_0x20b0d3){var _0x38cee6=function(_0x15b4d7){while(--_0x15b4d7){_0x15c734['push'](_0x15c734['shift']());}};_0x38cee6(++_0x20b0d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 4207762..d662064 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 _0x73b3=['./disposition.controller','isAuthenticated','get','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x49b382,_0x500ccc){var _0x5b362a=function(_0x6e93cc){while(--_0x6e93cc){_0x49b382['push'](_0x49b382['shift']());}};_0x5b362a(++_0x500ccc);}(_0x73b3,0x1ab));var _0x373b=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0x73b3[_0x5d4f12];return _0x4eb577;};'use strict';var multer=require(_0x373b('0x0'));var util=require(_0x373b('0x1'));var path=require(_0x373b('0x2'));var timeout=require(_0x373b('0x3'));var express=require(_0x373b('0x4'));var router=express[_0x373b('0x5')]();var fs_extra=require(_0x373b('0x6'));var auth=require(_0x373b('0x7'));var interaction=require(_0x373b('0x8'));var config=require(_0x373b('0x9'));var controller=require(_0x373b('0xa'));router['get']('/',auth[_0x373b('0xb')](),controller['index']);router[_0x373b('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x373b('0xd')]('/',auth[_0x373b('0xb')](),controller[_0x373b('0xe')]);router[_0x373b('0xf')](_0x373b('0x10'),auth[_0x373b('0xb')](),controller[_0x373b('0x11')]);router[_0x373b('0x12')](_0x373b('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcf5b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x2fdf6e,_0x5ac9e8){var _0x28f96d=function(_0x29b71d){while(--_0x29b71d){_0x2fdf6e['push'](_0x2fdf6e['shift']());}};_0x28f96d(++_0x5ac9e8);}(_0xcf5b,0xd3));var _0xbcf5=function(_0x168127,_0x59cea1){_0x168127=_0x168127-0x0;var _0x4c99ad=_0xcf5b[_0x168127];return _0x4c99ad;};'use strict';var multer=require(_0xbcf5('0x0'));var util=require(_0xbcf5('0x1'));var path=require(_0xbcf5('0x2'));var timeout=require(_0xbcf5('0x3'));var express=require(_0xbcf5('0x4'));var router=express[_0xbcf5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbcf5('0x6'));var interaction=require(_0xbcf5('0x7'));var config=require(_0xbcf5('0x8'));var controller=require('./disposition.controller');router['get']('/',auth[_0xbcf5('0x9')](),controller[_0xbcf5('0xa')]);router[_0xbcf5('0xb')](_0xbcf5('0xc'),auth[_0xbcf5('0x9')](),controller[_0xbcf5('0xd')]);router[_0xbcf5('0xe')]('/',auth[_0xbcf5('0x9')](),controller['create']);router[_0xbcf5('0xf')](_0xbcf5('0xc'),auth[_0xbcf5('0x9')](),controller[_0xbcf5('0x10')]);router['delete'](_0xbcf5('0xc'),auth[_0xbcf5('0x9')](),controller[_0xbcf5('0x11')]);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 6c7a744..72d94c8 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 _0x8da9=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','7200','9600','12000','14400','4800','v17,v27,v29','INTEGER','SIP','DADHI'];(function(_0x40b55e,_0x215f89){var _0x16c20f=function(_0x338979){while(--_0x338979){_0x40b55e['push'](_0x40b55e['shift']());}};_0x16c20f(++_0x215f89);}(_0x8da9,0x1be));var _0x98da=function(_0x3bc85f,_0x49ab22){_0x3bc85f=_0x3bc85f-0x0;var _0x44b771=_0x8da9[_0x3bc85f];return _0x44b771;};'use strict';var Sequelize=require('sequelize');module[_0x98da('0x0')]={'name':{'type':Sequelize[_0x98da('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x98da('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0x98da('0x2'),'no'),'defaultValue':_0x98da('0x2')},'headerinfo':{'type':Sequelize[_0x98da('0x1')],'defaultValue':_0x98da('0x3')},'localstationid':{'type':Sequelize[_0x98da('0x1')],'unique':_0x98da('0x4')},'minrate':{'type':Sequelize[_0x98da('0x5')](_0x98da('0x6'),'4800',_0x98da('0x7'),_0x98da('0x8'),_0x98da('0x9'),_0x98da('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x98da('0x5')](_0x98da('0x6'),_0x98da('0xb'),_0x98da('0x7'),_0x98da('0x8'),'12000',_0x98da('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x98da('0x1')],'defaultValue':_0x98da('0xc')},'gateway':{'type':Sequelize[_0x98da('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x98da('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x98da('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x98da('0xe'),'IAX',_0x98da('0xf'),'KHOMP'),'defaultValue':_0x98da('0xe')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x98da('0x10')],'defaultValue':function(){return _0x98da('0x11');}},'notificationSound':{'type':Sequelize[_0x98da('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x98da('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x98da('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x98da('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x98da('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x98da('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x98da('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x98da('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x552fef){if(!_0x552fef)this['setDataValue'](_0x98da('0x13'),null);this['setDataValue'](_0x98da('0x14'),_0x552fef);}}}; \ No newline at end of file +var _0xce91=['4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','TEXT','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400'];(function(_0x1998bb,_0x1f1da1){var _0x4ae4c9=function(_0x4741e8){while(--_0x4741e8){_0x1998bb['push'](_0x1998bb['shift']());}};_0x4ae4c9(++_0x1f1da1);}(_0xce91,0x78));var _0x1ce9=function(_0x191b1a,_0x58360e){_0x191b1a=_0x191b1a-0x0;var _0xde89da=_0xce91[_0x191b1a];return _0xde89da;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1ce9('0x0')]},'ecm':{'type':Sequelize[_0x1ce9('0x1')](_0x1ce9('0x2'),'no'),'defaultValue':_0x1ce9('0x2')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x1ce9('0x3')},'localstationid':{'type':Sequelize[_0x1ce9('0x0')],'unique':_0x1ce9('0x4')},'minrate':{'type':Sequelize[_0x1ce9('0x1')](_0x1ce9('0x5'),_0x1ce9('0x6'),_0x1ce9('0x7'),_0x1ce9('0x8'),_0x1ce9('0x9'),_0x1ce9('0xa')),'defaultValue':_0x1ce9('0x6')},'maxrate':{'type':Sequelize[_0x1ce9('0x1')](_0x1ce9('0x5'),_0x1ce9('0x6'),_0x1ce9('0x7'),_0x1ce9('0x8'),_0x1ce9('0x9'),_0x1ce9('0xa')),'defaultValue':_0x1ce9('0xa')},'modem':{'type':Sequelize[_0x1ce9('0x0')],'defaultValue':_0x1ce9('0xb')},'gateway':{'type':Sequelize[_0x1ce9('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x1ce9('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1ce9('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1ce9('0x1')](_0x1ce9('0xd'),_0x1ce9('0xe'),_0x1ce9('0xf'),'KHOMP'),'defaultValue':_0x1ce9('0xd')},'key':{'type':Sequelize[_0x1ce9('0x0')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1ce9('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1ce9('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1ce9('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1ce9('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1ce9('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1ce9('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1ce9('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1ce9('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1ce9('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1ce9('0x12'),'set':function(_0x26a793){if(!_0x26a793)this['setDataValue'](_0x1ce9('0x13'),null);this['setDataValue'](_0x1ce9('0x14'),_0x26a793);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 0fab16d..10a10ba 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 _0xd4e8=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','maxrate','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','tech','updatedAt','TrunkId','findById','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','attachments','join','root','basename','CheckAfterSend','isNil','from','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','FaxAccount','includeAll','include','findAll','rows','catch','show','Pause','rawAttributes','find','create','body'];(function(_0x17c938,_0x557096){var _0x2d22b2=function(_0x5efcfd){while(--_0x5efcfd){_0x17c938['push'](_0x17c938['shift']());}};_0x2d22b2(++_0x557096);}(_0xd4e8,0x1ed));var _0x8d4e=function(_0x205c11,_0x941d3d){_0x205c11=_0x205c11-0x0;var _0x550e7b=_0xd4e8[_0x205c11];return _0x550e7b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d4e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8d4e('0x1'));var moment=require(_0x8d4e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8d4e('0x3'));var util=require(_0x8d4e('0x4'));var path=require(_0x8d4e('0x5'));var sox=require(_0x8d4e('0x6'));var csv=require(_0x8d4e('0x7'));var ejs=require(_0x8d4e('0x8'));var fs=require('fs');var fs_extra=require(_0x8d4e('0x9'));var _=require(_0x8d4e('0xa'));var squel=require(_0x8d4e('0xb'));var crypto=require('crypto');var jsforce=require(_0x8d4e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8d4e('0x7'));var querystring=require(_0x8d4e('0xd'));var Papa=require(_0x8d4e('0xe'));var Redis=require(_0x8d4e('0xf'));var authService=require(_0x8d4e('0x10'));var qs=require(_0x8d4e('0x11'));var as=require(_0x8d4e('0x12'));var hardwareService=require(_0x8d4e('0x13'));var logger=require(_0x8d4e('0x14'))(_0x8d4e('0x15'));var utils=require(_0x8d4e('0x16'));var config=require(_0x8d4e('0x17'));var licenseUtil=require(_0x8d4e('0x18'));var db=require(_0x8d4e('0x19'))['db'];config[_0x8d4e('0x1a')]=_[_0x8d4e('0x1b')](config['redis'],{'host':_0x8d4e('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8d4e('0x1a')]));require(_0x8d4e('0x1d'))[_0x8d4e('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8d4e('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x88ef6e,_0x51dbec,_0x1edaab,_0x1d01fc){return new BPromise(function(_0x529bd8,_0x5ceed3){var _0x2b7add=_0x1d01fc||client;return _0x2b7add[_0x8d4e('0x20')](_0x88ef6e,_0x1edaab)[_0x8d4e('0x21')](function(_0x5c9221){logger[_0x8d4e('0x22')](_0x8d4e('0x23'),_0x51dbec,_0x8d4e('0x24'));logger[_0x8d4e('0x25')](_0x8d4e('0x26'),_0x51dbec,_0x8d4e('0x24'),JSON[_0x8d4e('0x27')](_0x5c9221));if(_0x5c9221['error']){if(_0x5c9221['error']['code']===0x1f4){logger[_0x8d4e('0x28')](_0x8d4e('0x23'),_0x51dbec,_0x5c9221[_0x8d4e('0x28')][_0x8d4e('0x29')]);return _0x5ceed3(_0x5c9221[_0x8d4e('0x28')][_0x8d4e('0x29')]);}logger[_0x8d4e('0x28')](_0x8d4e('0x23'),_0x51dbec,_0x5c9221['error'][_0x8d4e('0x29')]);return _0x529bd8(_0x5c9221[_0x8d4e('0x28')][_0x8d4e('0x29')]);}else{logger[_0x8d4e('0x22')](_0x8d4e('0x23'),_0x51dbec,_0x8d4e('0x24'));_0x529bd8(_0x5c9221['result']['message']);}})['catch'](function(_0x48f024){logger[_0x8d4e('0x28')](_0x8d4e('0x23'),_0x51dbec,_0x48f024);_0x5ceed3(_0x48f024);});});}function respondWithStatusCode(_0x5592c9,_0x5551bb){_0x5551bb=_0x5551bb||0xcc;return function(_0x461ad2){if(_0x461ad2){return _0x5592c9[_0x8d4e('0x2a')](_0x5551bb);}return _0x5592c9[_0x8d4e('0x2b')](_0x5551bb)[_0x8d4e('0x2c')]();};}function respondWithResult(_0xe44ed3,_0x75730d){_0x75730d=_0x75730d||0xc8;return function(_0x5908be){if(_0x5908be){return _0xe44ed3[_0x8d4e('0x2b')](_0x75730d)[_0x8d4e('0x2d')](_0x5908be);}};}function respondWithFilteredResult(_0x1491d6,_0x1717e3){return function(_0x15d904){if(_0x15d904){var _0x1df246=typeof _0x1717e3[_0x8d4e('0x2e')]===_0x8d4e('0x2f')&&typeof _0x1717e3[_0x8d4e('0x30')]==='undefined';var _0x327807=_0x15d904[_0x8d4e('0x31')];var _0x3ddc8a=_0x1df246?0x0:_0x1717e3[_0x8d4e('0x2e')];var _0x134dcf=_0x1df246?_0x15d904[_0x8d4e('0x31')]:_0x1717e3[_0x8d4e('0x2e')]+_0x1717e3[_0x8d4e('0x30')];var _0xd5c556;if(_0x134dcf>=_0x327807){_0x134dcf=_0x327807;_0xd5c556=0xc8;}else{_0xd5c556=0xce;}_0x1491d6[_0x8d4e('0x2b')](_0xd5c556);return _0x1491d6[_0x8d4e('0x32')](_0x8d4e('0x33'),_0x3ddc8a+'-'+_0x134dcf+'/'+_0x327807)[_0x8d4e('0x2d')](_0x15d904);}return null;};}function patchUpdates(_0x483695){return function(_0x3e487d){try{jsonpatch[_0x8d4e('0x34')](_0x3e487d,_0x483695,!![]);}catch(_0x4415d8){return BPromise['reject'](_0x4415d8);}return _0x3e487d['save']();};}function saveUpdates(_0x6864a2,_0xd47c31){return function(_0x3c6104){if(_0x3c6104){return _0x3c6104[_0x8d4e('0x35')](_0x6864a2)['then'](function(_0x199de6){return _0x199de6;});}return null;};}function removeEntity(_0x4ffb7e,_0x19ada2){return function(_0x37de8f){if(_0x37de8f){return _0x37de8f[_0x8d4e('0x36')]()[_0x8d4e('0x21')](function(){var _0x36be70=_0x37de8f[_0x8d4e('0x37')]({'plain':!![]});var _0x21767f=_0x8d4e('0x38');return db[_0x8d4e('0x39')][_0x8d4e('0x36')]({'where':{'type':_0x21767f,'resourceId':_0x36be70['id']}})[_0x8d4e('0x21')](function(){return _0x37de8f;});})[_0x8d4e('0x21')](function(){_0x4ffb7e['status'](0xcc)[_0x8d4e('0x2c')]();});}};}function handleEntityNotFound(_0x29d793,_0x4d476f){return function(_0x1eca6d){if(!_0x1eca6d){_0x29d793[_0x8d4e('0x2a')](0x194);}return _0x1eca6d;};}function handleError(_0x1fe6c3,_0x5d8094){_0x5d8094=_0x5d8094||0x1f4;return function(_0x451b7d){logger[_0x8d4e('0x28')](_0x451b7d[_0x8d4e('0x3a')]);if(_0x451b7d[_0x8d4e('0x3b')]){delete _0x451b7d[_0x8d4e('0x3b')];}_0x1fe6c3[_0x8d4e('0x2b')](_0x5d8094)[_0x8d4e('0x3c')](_0x451b7d);};}exports[_0x8d4e('0x3d')]=function(_0x5471e7,_0x3ebac0){var _0x31e2ab={'include':[{'model':db['Pause'],'as':_0x8d4e('0x3e')}]},_0x1503f0={},_0x5c4cbc={'count':0x0,'rows':[]};var _0x5404a1=_[_0x8d4e('0x3f')](db['FaxAccount']['rawAttributes'],function(_0x3c384e){return{'name':_0x3c384e[_0x8d4e('0x40')],'type':_0x3c384e[_0x8d4e('0x41')][_0x8d4e('0x42')]};});_0x1503f0['model']=_[_0x8d4e('0x3f')](_0x5404a1,'name');_0x1503f0[_0x8d4e('0x43')]=_[_0x8d4e('0x44')](_0x5471e7[_0x8d4e('0x43')]);_0x1503f0[_0x8d4e('0x45')]=_[_0x8d4e('0x46')](_0x1503f0[_0x8d4e('0x47')],_0x1503f0[_0x8d4e('0x43')]);_0x31e2ab[_0x8d4e('0x48')]=_[_0x8d4e('0x46')](_0x1503f0[_0x8d4e('0x47')],qs[_0x8d4e('0x49')](_0x5471e7['query'][_0x8d4e('0x49')]));_0x31e2ab[_0x8d4e('0x48')]=_0x31e2ab[_0x8d4e('0x48')][_0x8d4e('0x4a')]?_0x31e2ab[_0x8d4e('0x48')]:_0x1503f0[_0x8d4e('0x47')];if(!_0x5471e7[_0x8d4e('0x43')][_0x8d4e('0x4b')](_0x8d4e('0x4c'))){_0x31e2ab[_0x8d4e('0x30')]=qs[_0x8d4e('0x30')](_0x5471e7[_0x8d4e('0x43')][_0x8d4e('0x30')]);_0x31e2ab[_0x8d4e('0x2e')]=qs[_0x8d4e('0x2e')](_0x5471e7[_0x8d4e('0x43')]['offset']);}_0x31e2ab[_0x8d4e('0x4d')]=qs['sort'](_0x5471e7[_0x8d4e('0x43')][_0x8d4e('0x4e')]);_0x31e2ab[_0x8d4e('0x4f')]=qs[_0x8d4e('0x45')](_['pick'](_0x5471e7[_0x8d4e('0x43')],_0x1503f0['filters']),_0x5404a1);if(_0x5471e7[_0x8d4e('0x43')][_0x8d4e('0x50')]){_0x31e2ab[_0x8d4e('0x4f')]=_['merge'](_0x31e2ab['where'],{'$or':_[_0x8d4e('0x3f')](_0x5404a1,function(_0xaadbca){if(_0xaadbca[_0x8d4e('0x41')]!=='VIRTUAL'){var _0x4eb19b={};_0x4eb19b[_0xaadbca[_0x8d4e('0x3b')]]={'$like':'%'+_0x5471e7[_0x8d4e('0x43')][_0x8d4e('0x50')]+'%'};return _0x4eb19b;}})});}_0x31e2ab=_[_0x8d4e('0x51')]({},_0x31e2ab,_0x5471e7[_0x8d4e('0x52')]);var _0x1050e3={'where':_0x31e2ab[_0x8d4e('0x4f')]};return db[_0x8d4e('0x53')][_0x8d4e('0x31')](_0x1050e3)[_0x8d4e('0x21')](function(_0x42b8dd){_0x5c4cbc[_0x8d4e('0x31')]=_0x42b8dd;if(_0x5471e7[_0x8d4e('0x43')][_0x8d4e('0x54')]){_0x31e2ab[_0x8d4e('0x55')]=[{'all':!![]}];}return db[_0x8d4e('0x53')][_0x8d4e('0x56')](_0x31e2ab);})[_0x8d4e('0x21')](function(_0x1fd560){_0x5c4cbc[_0x8d4e('0x57')]=_0x1fd560;return _0x5c4cbc;})['then'](respondWithFilteredResult(_0x3ebac0,_0x31e2ab))[_0x8d4e('0x58')](handleError(_0x3ebac0,null));};exports[_0x8d4e('0x59')]=function(_0x49baf5,_0x54faff){var _0x2cb6f8={'raw':![],'where':{'id':_0x49baf5['params']['id']},'include':[{'model':db[_0x8d4e('0x5a')],'as':_0x8d4e('0x3e')}]},_0x72e0f3={};_0x72e0f3[_0x8d4e('0x47')]=_[_0x8d4e('0x44')](db[_0x8d4e('0x53')][_0x8d4e('0x5b')]);_0x72e0f3['query']=_[_0x8d4e('0x44')](_0x49baf5[_0x8d4e('0x43')]);_0x72e0f3[_0x8d4e('0x45')]=_[_0x8d4e('0x46')](_0x72e0f3['model'],_0x72e0f3[_0x8d4e('0x43')]);_0x2cb6f8[_0x8d4e('0x48')]=_[_0x8d4e('0x46')](_0x72e0f3[_0x8d4e('0x47')],qs[_0x8d4e('0x49')](_0x49baf5[_0x8d4e('0x43')]['fields']));_0x2cb6f8[_0x8d4e('0x48')]=_0x2cb6f8['attributes'][_0x8d4e('0x4a')]?_0x2cb6f8['attributes']:_0x72e0f3['model'];if(_0x49baf5[_0x8d4e('0x43')][_0x8d4e('0x54')]){_0x2cb6f8['include']=[{'all':!![]}];}_0x2cb6f8=_[_0x8d4e('0x51')]({},_0x2cb6f8,_0x49baf5[_0x8d4e('0x52')]);return db[_0x8d4e('0x53')][_0x8d4e('0x5c')](_0x2cb6f8)[_0x8d4e('0x21')](handleEntityNotFound(_0x54faff,null))['then'](respondWithResult(_0x54faff,null))[_0x8d4e('0x58')](handleError(_0x54faff,null));};exports[_0x8d4e('0x5d')]=function(_0x392f9a,_0x47fec2){return db['FaxAccount'][_0x8d4e('0x5d')](_0x392f9a[_0x8d4e('0x5e')],{})[_0x8d4e('0x21')](function(_0x136cb6){var _0x287904=_0x392f9a[_0x8d4e('0x5f')]['get']({'plain':!![]});if(!_0x287904)throw new Error(_0x8d4e('0x60'));if(_0x287904[_0x8d4e('0x61')]===_0x8d4e('0x5f')){var _0x667df7=_0x136cb6[_0x8d4e('0x37')]({'plain':!![]});var _0x40ff8c='FaxAccounts';return db[_0x8d4e('0x62')][_0x8d4e('0x5c')]({'where':{'name':_0x40ff8c,'userProfileId':_0x287904[_0x8d4e('0x63')]},'raw':!![]})['then'](function(_0x4402ea){if(_0x4402ea&&_0x4402ea['autoAssociation']===0x0){return db[_0x8d4e('0x39')][_0x8d4e('0x5d')]({'name':_0x667df7[_0x8d4e('0x3b')],'resourceId':_0x667df7['id'],'type':_0x4402ea[_0x8d4e('0x3b')],'sectionId':_0x4402ea['id']},{})[_0x8d4e('0x21')](function(){return _0x136cb6;});}else{return _0x136cb6;}})[_0x8d4e('0x58')](function(_0x533f58){logger[_0x8d4e('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x533f58);throw _0x533f58;});}return _0x136cb6;})[_0x8d4e('0x21')](respondWithResult(_0x47fec2,0xc9))[_0x8d4e('0x58')](handleError(_0x47fec2,null));};exports['update']=function(_0x2d3da3,_0x2c1896){if(_0x2d3da3[_0x8d4e('0x5e')]['id']){delete _0x2d3da3['body']['id'];}return db[_0x8d4e('0x53')]['find']({'where':{'id':_0x2d3da3[_0x8d4e('0x64')]['id']},'include':[{'model':db[_0x8d4e('0x5a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2c1896,null))[_0x8d4e('0x21')](saveUpdates(_0x2d3da3['body'],null))[_0x8d4e('0x21')](respondWithResult(_0x2c1896,null))['catch'](handleError(_0x2c1896,null));};exports[_0x8d4e('0x36')]=function(_0x3feb78,_0x4bb646){return db[_0x8d4e('0x53')][_0x8d4e('0x5c')]({'where':{'id':_0x3feb78['params']['id']}})[_0x8d4e('0x21')](handleEntityNotFound(_0x4bb646,null))[_0x8d4e('0x21')](removeEntity(_0x4bb646,null))[_0x8d4e('0x58')](handleError(_0x4bb646,null));};exports[_0x8d4e('0x65')]=function(_0x2f6d68,_0x552ded){return db[_0x8d4e('0x53')][_0x8d4e('0x65')]()[_0x8d4e('0x21')](respondWithResult(_0x552ded,null))[_0x8d4e('0x58')](handleError(_0x552ded,null));};exports[_0x8d4e('0x66')]=function(_0x410445,_0x16e917,_0x7d70b3){if(_0x410445['body']['id']){delete _0x410445[_0x8d4e('0x5e')]['id'];}return db['FaxAccount'][_0x8d4e('0x5c')]({'where':{'id':_0x410445['params']['id']}})[_0x8d4e('0x21')](handleEntityNotFound(_0x16e917,null))['then'](function(_0x506df5){if(_0x506df5){_0x410445[_0x8d4e('0x5e')][_0x8d4e('0x67')]=_0x506df5['id'];return db[_0x8d4e('0x68')]['create'](_0x410445[_0x8d4e('0x5e')]);}})[_0x8d4e('0x21')](respondWithResult(_0x16e917,null))[_0x8d4e('0x58')](handleError(_0x16e917,null));};exports[_0x8d4e('0x69')]=function(_0x472bd0,_0x17b753,_0x1c7e68){var _0x5a760e={'raw':![],'where':{}};var _0x46b9b6={};var _0x4bdf63={'count':0x0,'rows':[]};return db['FaxAccount'][_0x8d4e('0x6a')]({'where':{'id':_0x472bd0[_0x8d4e('0x64')]['id']}})[_0x8d4e('0x21')](handleEntityNotFound(_0x17b753,null))[_0x8d4e('0x21')](function(_0x2b4ecc){if(_0x2b4ecc){_0x46b9b6[_0x8d4e('0x47')]=_[_0x8d4e('0x44')](db[_0x8d4e('0x68')][_0x8d4e('0x5b')]);_0x46b9b6[_0x8d4e('0x43')]=_[_0x8d4e('0x44')](_0x472bd0[_0x8d4e('0x43')]);_0x46b9b6[_0x8d4e('0x45')]=_[_0x8d4e('0x46')](_0x46b9b6[_0x8d4e('0x47')],_0x46b9b6[_0x8d4e('0x43')]);_0x5a760e[_0x8d4e('0x48')]=_[_0x8d4e('0x46')](_0x46b9b6[_0x8d4e('0x47')],qs[_0x8d4e('0x49')](_0x472bd0[_0x8d4e('0x43')]['fields']));_0x5a760e[_0x8d4e('0x48')]=_0x5a760e['attributes'][_0x8d4e('0x4a')]?_0x5a760e[_0x8d4e('0x48')]:_0x46b9b6['model'];if(!_0x472bd0[_0x8d4e('0x43')][_0x8d4e('0x4b')](_0x8d4e('0x4c'))){_0x5a760e[_0x8d4e('0x30')]=qs[_0x8d4e('0x30')](_0x472bd0['query'][_0x8d4e('0x30')]);_0x5a760e[_0x8d4e('0x2e')]=qs['offset'](_0x472bd0[_0x8d4e('0x43')]['offset']);}_0x5a760e[_0x8d4e('0x4d')]=qs[_0x8d4e('0x4e')](_0x472bd0['query'][_0x8d4e('0x4e')]);_0x5a760e[_0x8d4e('0x4f')]=qs[_0x8d4e('0x45')](_[_0x8d4e('0x6b')](_0x472bd0[_0x8d4e('0x43')],_0x46b9b6[_0x8d4e('0x45')]));_0x5a760e[_0x8d4e('0x4f')][_0x8d4e('0x67')]=_0x2b4ecc['id'];if(_0x472bd0[_0x8d4e('0x43')][_0x8d4e('0x50')]){_0x5a760e[_0x8d4e('0x4f')]=_[_0x8d4e('0x51')](_0x5a760e[_0x8d4e('0x4f')],{'$or':_[_0x8d4e('0x3f')](_0x5a760e['attributes'],function(_0x53fda7){var _0x5315e3={};_0x5315e3[_0x53fda7]={'$like':'%'+_0x472bd0[_0x8d4e('0x43')][_0x8d4e('0x50')]+'%'};return _0x5315e3;})});}_0x5a760e=_[_0x8d4e('0x51')]({},_0x5a760e,_0x472bd0['options']);return db['Disposition'][_0x8d4e('0x31')]({'where':_0x5a760e[_0x8d4e('0x4f')]})[_0x8d4e('0x21')](function(_0x1ff4be){_0x4bdf63[_0x8d4e('0x31')]=_0x1ff4be;if(_0x472bd0['query'][_0x8d4e('0x54')]){_0x5a760e[_0x8d4e('0x55')]=[{'all':!![]}];}return db['Disposition'][_0x8d4e('0x56')](_0x5a760e);})[_0x8d4e('0x21')](function(_0x202265){_0x4bdf63['rows']=_0x202265;return _0x4bdf63;});}})[_0x8d4e('0x21')](respondWithFilteredResult(_0x17b753,_0x5a760e))['catch'](handleError(_0x17b753,null));};exports['removeDispositions']=function(_0x5956c8,_0x15e7a0,_0x4d262f){return db[_0x8d4e('0x53')][_0x8d4e('0x5c')]({'where':{'id':_0x5956c8[_0x8d4e('0x64')]['id']}})[_0x8d4e('0x21')](handleEntityNotFound(_0x15e7a0,null))[_0x8d4e('0x21')](function(_0xcca6b0){if(_0xcca6b0){return _0xcca6b0[_0x8d4e('0x6c')](_0x5956c8['query'][_0x8d4e('0x6d')]);}})[_0x8d4e('0x21')](respondWithStatusCode(_0x15e7a0,null))[_0x8d4e('0x58')](handleError(_0x15e7a0,null));};exports[_0x8d4e('0x6e')]=function(_0x16c08a,_0xca4d7c,_0x5e6e68){if(_0x16c08a[_0x8d4e('0x5e')]['id']){delete _0x16c08a[_0x8d4e('0x5e')]['id'];}return db['FaxAccount'][_0x8d4e('0x5c')]({'where':{'id':_0x16c08a['params']['id']}})[_0x8d4e('0x21')](handleEntityNotFound(_0xca4d7c,null))['then'](function(_0x2ad898){if(_0x2ad898){_0x16c08a[_0x8d4e('0x5e')][_0x8d4e('0x67')]=_0x2ad898['id'];return db[_0x8d4e('0x6f')]['create'](_0x16c08a[_0x8d4e('0x5e')]);}})[_0x8d4e('0x21')](respondWithResult(_0xca4d7c,null))['catch'](handleError(_0xca4d7c,null));};exports[_0x8d4e('0x70')]=function(_0x2fcbc2,_0x504aab,_0x23997a){var _0x492a65={'raw':![],'where':{}};var _0x4a4d18={};var _0x2d786c={'count':0x0,'rows':[]};return db[_0x8d4e('0x53')][_0x8d4e('0x6a')]({'where':{'id':_0x2fcbc2[_0x8d4e('0x64')]['id']}})[_0x8d4e('0x21')](handleEntityNotFound(_0x504aab,null))[_0x8d4e('0x21')](function(_0x3e2f44){if(_0x3e2f44){_0x4a4d18[_0x8d4e('0x47')]=_[_0x8d4e('0x44')](db[_0x8d4e('0x6f')][_0x8d4e('0x5b')]);_0x4a4d18['query']=_[_0x8d4e('0x44')](_0x2fcbc2['query']);_0x4a4d18[_0x8d4e('0x45')]=_[_0x8d4e('0x46')](_0x4a4d18['model'],_0x4a4d18['query']);_0x492a65[_0x8d4e('0x48')]=_['intersection'](_0x4a4d18[_0x8d4e('0x47')],qs[_0x8d4e('0x49')](_0x2fcbc2[_0x8d4e('0x43')][_0x8d4e('0x49')]));_0x492a65[_0x8d4e('0x48')]=_0x492a65[_0x8d4e('0x48')][_0x8d4e('0x4a')]?_0x492a65[_0x8d4e('0x48')]:_0x4a4d18[_0x8d4e('0x47')];if(!_0x2fcbc2[_0x8d4e('0x43')][_0x8d4e('0x4b')](_0x8d4e('0x4c'))){_0x492a65[_0x8d4e('0x30')]=qs['limit'](_0x2fcbc2['query'][_0x8d4e('0x30')]);_0x492a65['offset']=qs['offset'](_0x2fcbc2['query']['offset']);}_0x492a65[_0x8d4e('0x4d')]=qs[_0x8d4e('0x4e')](_0x2fcbc2[_0x8d4e('0x43')]['sort']);_0x492a65[_0x8d4e('0x4f')]=qs[_0x8d4e('0x45')](_[_0x8d4e('0x6b')](_0x2fcbc2[_0x8d4e('0x43')],_0x4a4d18[_0x8d4e('0x45')]));_0x492a65[_0x8d4e('0x4f')]['FaxAccountId']=_0x3e2f44['id'];if(_0x2fcbc2[_0x8d4e('0x43')][_0x8d4e('0x50')]){_0x492a65['where']=_[_0x8d4e('0x51')](_0x492a65['where'],{'$or':_[_0x8d4e('0x3f')](_0x492a65[_0x8d4e('0x48')],function(_0xadaf9b){var _0x451de3={};_0x451de3[_0xadaf9b]={'$like':'%'+_0x2fcbc2[_0x8d4e('0x43')][_0x8d4e('0x50')]+'%'};return _0x451de3;})});}_0x492a65=_[_0x8d4e('0x51')]({},_0x492a65,_0x2fcbc2[_0x8d4e('0x52')]);return db['CannedAnswer'][_0x8d4e('0x31')]({'where':_0x492a65['where']})['then'](function(_0x2e9f67){_0x2d786c[_0x8d4e('0x31')]=_0x2e9f67;if(_0x2fcbc2[_0x8d4e('0x43')]['includeAll']){_0x492a65[_0x8d4e('0x55')]=[{'all':!![]}];}return db[_0x8d4e('0x6f')][_0x8d4e('0x56')](_0x492a65);})[_0x8d4e('0x21')](function(_0x54ad7a){_0x2d786c[_0x8d4e('0x57')]=_0x54ad7a;return _0x2d786c;});}})['then'](respondWithFilteredResult(_0x504aab,_0x492a65))['catch'](handleError(_0x504aab,null));};exports[_0x8d4e('0x71')]=function(_0x47038c,_0x5b500e,_0x209f40){return db[_0x8d4e('0x53')][_0x8d4e('0x5c')]({'where':{'id':_0x47038c['params']['id']}})[_0x8d4e('0x21')](handleEntityNotFound(_0x5b500e,null))[_0x8d4e('0x21')](function(_0x2b915a){if(_0x2b915a){return _0x2b915a['removeAnswers'](_0x47038c[_0x8d4e('0x43')]['ids']);}})[_0x8d4e('0x21')](respondWithStatusCode(_0x5b500e,null))['catch'](handleError(_0x5b500e,null));};exports[_0x8d4e('0x72')]=function(_0x2e2cbb,_0xd43cbe,_0x13e052){return db[_0x8d4e('0x73')][_0x8d4e('0x5c')]({'where':{'id':_0x2e2cbb[_0x8d4e('0x64')]['id']}})['then'](handleEntityNotFound(_0xd43cbe,null))[_0x8d4e('0x21')](function(_0x240ed9){if(_0x240ed9){return _0x240ed9[_0x8d4e('0x72')](_0x2e2cbb['body'][_0x8d4e('0x6d')],_[_0x8d4e('0x74')](_0x2e2cbb[_0x8d4e('0x5e')],[_0x8d4e('0x6d'),'id'])||{});}})[_0x8d4e('0x21')](respondWithResult(_0xd43cbe,null))[_0x8d4e('0x58')](handleError(_0xd43cbe,null));};exports[_0x8d4e('0x75')]=function(_0x1fc3d0,_0xe06f4d,_0x364c79){var _0x5f55b9={'raw':![],'where':{}};var _0x1c89b0={};var _0xcca843={'count':0x0,'rows':[]};return db['FaxAccount'][_0x8d4e('0x6a')]({'where':{'id':_0x1fc3d0[_0x8d4e('0x64')]['id']}})[_0x8d4e('0x21')](handleEntityNotFound(_0xe06f4d,null))[_0x8d4e('0x21')](function(_0x894e8c){if(_0x894e8c){_0x1c89b0['model']=_['keys'](db['FaxInteraction']['rawAttributes']);_0x1c89b0['query']=_['keys'](_0x1fc3d0[_0x8d4e('0x43')]);_0x1c89b0['filters']=_[_0x8d4e('0x46')](_0x1c89b0['model'],_0x1c89b0[_0x8d4e('0x43')]);_0x5f55b9[_0x8d4e('0x48')]=_[_0x8d4e('0x46')](_0x1c89b0[_0x8d4e('0x47')],qs[_0x8d4e('0x49')](_0x1fc3d0['query'][_0x8d4e('0x49')]));_0x5f55b9[_0x8d4e('0x48')]=_0x5f55b9[_0x8d4e('0x48')][_0x8d4e('0x4a')]?_0x5f55b9[_0x8d4e('0x48')]:_0x1c89b0[_0x8d4e('0x47')];if(!_0x1fc3d0[_0x8d4e('0x43')]['hasOwnProperty'](_0x8d4e('0x4c'))){_0x5f55b9[_0x8d4e('0x30')]=qs[_0x8d4e('0x30')](_0x1fc3d0[_0x8d4e('0x43')][_0x8d4e('0x30')]);_0x5f55b9['offset']=qs[_0x8d4e('0x2e')](_0x1fc3d0[_0x8d4e('0x43')]['offset']);}_0x5f55b9[_0x8d4e('0x4d')]=qs['sort'](_0x1fc3d0[_0x8d4e('0x43')][_0x8d4e('0x4e')]);_0x5f55b9[_0x8d4e('0x4f')]=qs[_0x8d4e('0x45')](_[_0x8d4e('0x6b')](_0x1fc3d0[_0x8d4e('0x43')],_0x1c89b0[_0x8d4e('0x45')]));_0x5f55b9['where']['FaxAccountId']=_0x894e8c['id'];if(_0x1fc3d0[_0x8d4e('0x43')][_0x8d4e('0x50')]){_0x5f55b9['where']=_[_0x8d4e('0x51')](_0x5f55b9[_0x8d4e('0x4f')],{'$or':_['map'](_0x5f55b9[_0x8d4e('0x48')],function(_0x364dfd){var _0x9fcad8={};_0x9fcad8[_0x364dfd]={'$like':'%'+_0x1fc3d0[_0x8d4e('0x43')]['filter']+'%'};return _0x9fcad8;})});}_0x5f55b9=_[_0x8d4e('0x51')]({},_0x5f55b9,_0x1fc3d0[_0x8d4e('0x52')]);return db[_0x8d4e('0x73')][_0x8d4e('0x31')]({'where':_0x5f55b9[_0x8d4e('0x4f')]})[_0x8d4e('0x21')](function(_0x2a78a4){_0xcca843[_0x8d4e('0x31')]=_0x2a78a4;if(_0x1fc3d0[_0x8d4e('0x43')][_0x8d4e('0x54')]){_0x5f55b9[_0x8d4e('0x55')]=[{'model':db[_0x8d4e('0x76')],'as':'Contact','required':![]},{'model':db[_0x8d4e('0x77')],'as':_0x8d4e('0x78'),'attributes':['name',_0x8d4e('0x79'),_0x8d4e('0x7a')],'required':![]},{'model':db[_0x8d4e('0x7b')],'as':'Tags','attributes':['id',_0x8d4e('0x3b'),_0x8d4e('0x7c')],'where':_0x1fc3d0[_0x8d4e('0x43')][_0x8d4e('0x7d')]?{'id':_0x1fc3d0[_0x8d4e('0x43')][_0x8d4e('0x7d')]}:undefined,'required':_0x1fc3d0[_0x8d4e('0x43')][_0x8d4e('0x7d')]?!![]:![]}];}return db[_0x8d4e('0x73')][_0x8d4e('0x56')](_0x5f55b9);})[_0x8d4e('0x21')](function(_0x48efc9){_0xcca843[_0x8d4e('0x57')]=_0x48efc9;return _0xcca843;});}})[_0x8d4e('0x21')](respondWithFilteredResult(_0xe06f4d,_0x5f55b9))['catch'](handleError(_0xe06f4d,null));};exports[_0x8d4e('0x7e')]=function(_0xdf5d67,_0x30d600,_0x314173){return db['FaxAccount'][_0x8d4e('0x6a')]({'where':{'id':_0xdf5d67[_0x8d4e('0x64')]['id']}})[_0x8d4e('0x21')](handleEntityNotFound(_0x30d600,null))[_0x8d4e('0x21')](function(_0x514b8b){if(_0x514b8b){return db[_0x8d4e('0x7f')][_0x8d4e('0x80')](function(_0x5f5a64){return db['FaxApplication'][_0x8d4e('0x36')]({'where':{'FaxAccountId':_0xdf5d67[_0x8d4e('0x64')]['id']},'transaction':_0x5f5a64})[_0x8d4e('0x21')](function(_0xa038d9){var _0x49108c=_[_0x8d4e('0x3f')](_0xdf5d67[_0x8d4e('0x5e')],function(_0x5f0521){_0x5f0521[_0x8d4e('0x67')]=_0xdf5d67['params']['id'];return _0x5f0521;});return db[_0x8d4e('0x81')][_0x8d4e('0x82')](_0x49108c,{'transaction':_0x5f5a64});});})[_0x8d4e('0x21')](function(){return db['FaxApplication'][_0x8d4e('0x83')]({'where':{'FaxAccountId':_0xdf5d67[_0x8d4e('0x64')]['id']},'order':'priority'});});}})[_0x8d4e('0x21')](respondWithResult(_0x30d600,null))[_0x8d4e('0x58')](handleError(_0x30d600,null));};exports[_0x8d4e('0x84')]=function(_0x34db1e,_0x4b0eb6,_0x339705){var _0x27fcde={};var _0x4dafbc={};var _0x2923db;var _0x4e655b;return db['FaxAccount'][_0x8d4e('0x6a')]({'where':{'id':_0x34db1e[_0x8d4e('0x64')]['id']}})[_0x8d4e('0x21')](handleEntityNotFound(_0x4b0eb6,null))[_0x8d4e('0x21')](function(_0x115a88){if(_0x115a88){_0x2923db=_0x115a88;_0x4dafbc['model']=_[_0x8d4e('0x44')](db['FaxApplication'][_0x8d4e('0x5b')]);_0x4dafbc['query']=_[_0x8d4e('0x44')](_0x34db1e[_0x8d4e('0x43')]);_0x4dafbc['filters']=_[_0x8d4e('0x46')](_0x4dafbc[_0x8d4e('0x47')],_0x4dafbc['query']);_0x27fcde[_0x8d4e('0x48')]=_[_0x8d4e('0x46')](_0x4dafbc['model'],qs['fields'](_0x34db1e[_0x8d4e('0x43')][_0x8d4e('0x49')]));_0x27fcde[_0x8d4e('0x48')]=_0x27fcde[_0x8d4e('0x48')][_0x8d4e('0x4a')]?_0x27fcde['attributes']:_0x4dafbc[_0x8d4e('0x47')];_0x27fcde[_0x8d4e('0x4d')]=qs[_0x8d4e('0x4e')](_0x34db1e[_0x8d4e('0x43')][_0x8d4e('0x4e')]);_0x27fcde['where']=qs[_0x8d4e('0x45')](_[_0x8d4e('0x6b')](_0x34db1e[_0x8d4e('0x43')],_0x4dafbc[_0x8d4e('0x45')]));if(_0x34db1e[_0x8d4e('0x43')][_0x8d4e('0x50')]){_0x27fcde[_0x8d4e('0x4f')]=_['merge'](_0x27fcde[_0x8d4e('0x4f')],{'$or':_[_0x8d4e('0x3f')](_0x27fcde['attributes'],function(_0x4a34a){var _0x46f3d2={};_0x46f3d2[_0x4a34a]={'$like':'%'+_0x34db1e[_0x8d4e('0x43')][_0x8d4e('0x50')]+'%'};return _0x46f3d2;})});}_0x27fcde=_[_0x8d4e('0x51')]({},_0x27fcde,_0x34db1e[_0x8d4e('0x52')]);return _0x2923db[_0x8d4e('0x84')](_0x27fcde);}})[_0x8d4e('0x21')](function(_0x26b69d){if(_0x26b69d){_0x4e655b=_0x26b69d[_0x8d4e('0x4a')];if(!_0x34db1e[_0x8d4e('0x43')][_0x8d4e('0x4b')](_0x8d4e('0x4c'))){_0x27fcde[_0x8d4e('0x30')]=qs[_0x8d4e('0x30')](_0x34db1e['query']['limit']);_0x27fcde[_0x8d4e('0x2e')]=qs[_0x8d4e('0x2e')](_0x34db1e[_0x8d4e('0x43')]['offset']);}return _0x2923db[_0x8d4e('0x84')](_0x27fcde);}})[_0x8d4e('0x21')](function(_0x2f0775){if(_0x2f0775){return _0x2f0775?{'count':_0x4e655b,'rows':_0x2f0775}:null;}})[_0x8d4e('0x21')](respondWithResult(_0x4b0eb6,null))['catch'](handleError(_0x4b0eb6,null));};function Extension(_0x22a28e,_0xbcbae7,_0x411902,_0x2e18d8){this[_0x8d4e('0x85')]=_0x8d4e('0x86');this[_0x8d4e('0x87')]=_0x22a28e[_0x8d4e('0x88')];this[_0x8d4e('0x89')]=_0x2e18d8;this[_0x8d4e('0x41')]=_0x8d4e('0x8a');this[_0x8d4e('0x8b')]=_0x8d4e('0x8c');this[_0x8d4e('0x67')]=_0x22a28e['id'];this[_0x8d4e('0x8d')]=_0xbcbae7;this['appdata']=_0x411902;}function createExtensionsReciveFax(_0xd7a7f5){var _0x8b72ca=0x1;var _0x2420a3=[];_0x2420a3[_0x8d4e('0x8e')](new Extension(_0xd7a7f5,_0x8b72ca,'',_0x8d4e('0x8f')));_0x8b72ca+=0x1;_0x2420a3[_0x8d4e('0x8e')](new Extension(_0xd7a7f5,_0x8b72ca,_0x8d4e('0x90'),_0x8d4e('0x91')));_0x8b72ca+=0x1;for(var _0x7d8a6 in _0xd7a7f5){if(_0xd7a7f5[_0x8d4e('0x4b')](_0x7d8a6)&&(_0x7d8a6===_0x8d4e('0x92')||_0x7d8a6===_0x8d4e('0x88')||_0x7d8a6===_0x8d4e('0x93')||_0x7d8a6===_0x8d4e('0x94')||_0x7d8a6==='headerinfo'||_0x7d8a6===_0x8d4e('0x95')||_0x7d8a6===_0x8d4e('0x96')||_0x7d8a6===_0x8d4e('0x97')||_0x7d8a6==='t38timeout')){_0x2420a3[_0x8d4e('0x8e')](new Extension(_0xd7a7f5,_0x8b72ca,_0x8d4e('0x98')+_0x7d8a6+')='+_0xd7a7f5[_0x7d8a6],_0x8d4e('0x91')));_0x8b72ca+=0x1;}}_0x2420a3[_0x8d4e('0x8e')](new Extension(_0xd7a7f5,_0x8b72ca,'6',_0x8d4e('0x99')));_0x8b72ca+=0x1;_0x2420a3[_0x8d4e('0x8e')](new Extension(_0xd7a7f5,_0x8b72ca,_0x8d4e('0x9a'),'ReceiveFax'));_0x8b72ca=0x0;return _0x2420a3;}exports[_0x8d4e('0x9b')]=function(_0x3dce1f,_0x46466c,_0x52d465){var _0x3b6bba;return db[_0x8d4e('0x7f')][_0x8d4e('0x80')](function(_0x54668f){return db[_0x8d4e('0x53')][_0x8d4e('0x5d')](_0x3dce1f[_0x8d4e('0x5e')],{'transaction':_0x54668f})[_0x8d4e('0x21')](function(_0x16602f){_0x3b6bba=_0x16602f[_0x8d4e('0x37')]({'plain':!![]});return db[_0x8d4e('0x9c')][_0x8d4e('0x82')](createExtensionsReciveFax(_0x3b6bba),{'transaction':_0x54668f});});})[_0x8d4e('0x21')](function(){return _0x3b6bba;})[_0x8d4e('0x21')](respondWithResult(_0x46466c,null))['catch'](handleError(_0x46466c,null));};exports['updateAccountApplications']=function(_0x2bbdd5,_0x4440d3,_0x5981e5){var _0x4fd6b4;return db[_0x8d4e('0x7f')][_0x8d4e('0x80')](function(_0x489f10){return db[_0x8d4e('0x53')]['update'](_0x2bbdd5[_0x8d4e('0x5e')],{'where':{'id':_0x2bbdd5[_0x8d4e('0x5e')]['id']},'transaction':_0x489f10})[_0x8d4e('0x21')](function(_0x70e8d8){return db['VoiceExtension'][_0x8d4e('0x36')]({'where':{'FaxAccountId':_0x2bbdd5[_0x8d4e('0x5e')]['id']},'transaction':_0x489f10})[_0x8d4e('0x21')](function(_0x1f194c){return db[_0x8d4e('0x9c')][_0x8d4e('0x82')](createExtensionsReciveFax(_['omit'](_0x2bbdd5[_0x8d4e('0x5e')],[_0x8d4e('0x9d'),'key','createdAt',_0x8d4e('0x9e'),_0x8d4e('0x9f'),'ListId'])),{'transaction':_0x489f10});});});})['then'](function(){return db[_0x8d4e('0x53')][_0x8d4e('0xa0')](_0x2bbdd5['body']['id']);})[_0x8d4e('0x21')](respondWithResult(_0x4440d3,null))[_0x8d4e('0x58')](handleError(_0x4440d3,null));};exports[_0x8d4e('0xa1')]=function(_0x44eb58,_0x475d0c,_0x54e7b7){var _0x52d77e={'raw':!![],'where':{}};var _0x52699c={};var _0x398667={'count':0x0,'rows':[]};return db['FaxAccount'][_0x8d4e('0x6a')]({'where':{'id':_0x44eb58[_0x8d4e('0x64')]['id']}})[_0x8d4e('0x21')](handleEntityNotFound(_0x475d0c,null))[_0x8d4e('0x21')](function(_0x16ec6c){if(_0x16ec6c){_0x52699c[_0x8d4e('0x47')]=_[_0x8d4e('0x44')](db['FaxMessage'][_0x8d4e('0x5b')]);_0x52699c['query']=_[_0x8d4e('0x44')](_0x44eb58['query']);_0x52699c[_0x8d4e('0x45')]=_[_0x8d4e('0x46')](_0x52699c[_0x8d4e('0x47')],_0x52699c[_0x8d4e('0x43')]);_0x52d77e[_0x8d4e('0x48')]=_[_0x8d4e('0x46')](_0x52699c[_0x8d4e('0x47')],qs[_0x8d4e('0x49')](_0x44eb58[_0x8d4e('0x43')][_0x8d4e('0x49')]));_0x52d77e['attributes']=_0x52d77e[_0x8d4e('0x48')][_0x8d4e('0x4a')]?_0x52d77e[_0x8d4e('0x48')]:_0x52699c[_0x8d4e('0x47')];if(!_0x44eb58[_0x8d4e('0x43')][_0x8d4e('0x4b')](_0x8d4e('0x4c'))){_0x52d77e[_0x8d4e('0x30')]=qs['limit'](_0x44eb58[_0x8d4e('0x43')][_0x8d4e('0x30')]);_0x52d77e['offset']=qs['offset'](_0x44eb58[_0x8d4e('0x43')]['offset']);}_0x52d77e[_0x8d4e('0x4d')]=qs[_0x8d4e('0x4e')](_0x44eb58['query'][_0x8d4e('0x4e')]);_0x52d77e['where']=qs[_0x8d4e('0x45')](_[_0x8d4e('0x6b')](_0x44eb58['query'],_0x52699c[_0x8d4e('0x45')]));_0x52d77e[_0x8d4e('0x4f')][_0x8d4e('0x67')]=_0x16ec6c['id'];if(_0x44eb58['query'][_0x8d4e('0x50')]){_0x52d77e[_0x8d4e('0x4f')]=_['merge'](_0x52d77e[_0x8d4e('0x4f')],{'$or':_[_0x8d4e('0x3f')](_0x52d77e[_0x8d4e('0x48')],function(_0x2166c0){var _0x17ede3={};_0x17ede3[_0x2166c0]={'$like':'%'+_0x44eb58[_0x8d4e('0x43')][_0x8d4e('0x50')]+'%'};return _0x17ede3;})});}if(_0x44eb58[_0x8d4e('0x43')][_0x8d4e('0xa2')]){var _0x561fc2=_0x44eb58[_0x8d4e('0x43')][_0x8d4e('0xa2')]['split'](',');var _0xb08736={};_0xb08736[_0x561fc2[0x0]]={'$gte':moment(_0x561fc2[0x1])[_0x8d4e('0xa3')](_0x8d4e('0xa4'))};_0x52d77e[_0x8d4e('0x4f')]=_[_0x8d4e('0x51')](_0x52d77e[_0x8d4e('0x4f')],_0xb08736);}_0x52d77e=_[_0x8d4e('0x51')]({},_0x52d77e,_0x44eb58['options']);return db[_0x8d4e('0xa5')][_0x8d4e('0x31')]({'where':_0x52d77e[_0x8d4e('0x4f')]})[_0x8d4e('0x21')](function(_0x29929a){_0x398667[_0x8d4e('0x31')]=_0x29929a;if(_0x44eb58[_0x8d4e('0x43')][_0x8d4e('0x54')]){_0x52d77e[_0x8d4e('0x55')]=[{'all':!![]}];}return db['FaxMessage'][_0x8d4e('0x56')](_0x52d77e);})[_0x8d4e('0x21')](function(_0x48bed4){_0x398667[_0x8d4e('0x57')]=_0x48bed4;return _0x398667;});}})[_0x8d4e('0x21')](respondWithFilteredResult(_0x475d0c,_0x52d77e))[_0x8d4e('0x58')](handleError(_0x475d0c,null));};exports[_0x8d4e('0x3c')]=function(_0xe027ee,_0x362f9d,_0x5453e7){var _0x1e23d7,_0x339cdc={},_0x4c990e;if(_0xe027ee['body']['to']){_0x4c990e=_0xe027ee[_0x8d4e('0x5e')]['to'][0x0];}return db[_0x8d4e('0x53')][_0x8d4e('0x5c')]({'where':{'id':_0xe027ee[_0x8d4e('0x64')]['id']},'include':[{'model':db[_0x8d4e('0xa6')],'as':_0x8d4e('0xa7'),'include':[{'model':db[_0x8d4e('0x76')],'as':_0x8d4e('0xa8'),'where':{'fax':_0x4c990e},'limit':0x1,'order':[[_0x8d4e('0x9e'),'DESC']]}]}]})[_0x8d4e('0x21')](handleEntityNotFound(_0x362f9d,null))[_0x8d4e('0x21')](function(_0xe51a65){_0x1e23d7=_0xe51a65;if(_0xe027ee[_0x8d4e('0x5e')][_0x8d4e('0xa9')]&&_0xe027ee['body'][_0x8d4e('0xa9')]['length']){for(var _0x589a43=0x0;_0x589a43<_0xe027ee[_0x8d4e('0x5e')][_0x8d4e('0xa9')][_0x8d4e('0x4a')];_0x589a43+=0x1){_0xe027ee[_0x8d4e('0x5e')][_0x8d4e('0xa9')][_0x589a43]={'filename':_0xe027ee[_0x8d4e('0x5e')][_0x8d4e('0xa9')][_0x589a43][_0x8d4e('0x3b')],'id':_0xe027ee['body'][_0x8d4e('0xa9')][_0x589a43]['id'],'path':path[_0x8d4e('0xaa')](config[_0x8d4e('0xab')],'server/files/attachments',_0xe027ee[_0x8d4e('0x5e')][_0x8d4e('0xa9')][_0x589a43][_0x8d4e('0xac')])};}}return respondWithRpcPromise(_0x8d4e('0xad'),_0x8d4e('0xad'),{'FaxAccountId':_['isNil'](_0xe027ee[_0x8d4e('0x64')]['id'])?undefined:_0xe027ee[_0x8d4e('0x64')]['id'],'path':_['isNil'](_0xe027ee[_0x8d4e('0x5e')][_0x8d4e('0xa9')][0x0][_0x8d4e('0x5')])?undefined:_0xe027ee[_0x8d4e('0x5e')][_0x8d4e('0xa9')][0x0][_0x8d4e('0x5')],'fax':_[_0x8d4e('0xae')](_0xe027ee[_0x8d4e('0x5e')]['to'][0x0])?undefined:_0xe027ee[_0x8d4e('0x5e')]['to'][0x0]},client9002);})['then'](function(){if(_0x1e23d7){if(_[_0x8d4e('0xae')](_0xe027ee['body'][_0x8d4e('0xaf')])){_0xe027ee['body'][_0x8d4e('0xaf')]=util['format']('\x22%s\x22\x20<%s>',_0x1e23d7[_0x8d4e('0x3b')],_0x1e23d7[_0x8d4e('0xb0')]);}if(_0x1e23d7[_0x8d4e('0xa7')]){if(_0x1e23d7[_0x8d4e('0xa7')]['Contacts']['length']){return _0x1e23d7[_0x8d4e('0xa7')]['Contacts'][0x0];}else{return db[_0x8d4e('0x76')][_0x8d4e('0x5d')](_[_0x8d4e('0x1b')](_0xe027ee['body'],{'firstName':_0xe027ee['body']['to'][0x0],'phone':_0xe027ee[_0x8d4e('0x5e')]['to'][0x0],'fax':_0xe027ee[_0x8d4e('0x5e')]['to'][0x0],'ListId':_0x1e23d7[_0x8d4e('0xb1')]}));}}else{throw new Error(_0x8d4e('0xb2'));}}else{throw new Error(_0x8d4e('0xb3'));}})['then'](function(_0xa0cbd1){if(_0xa0cbd1){return db[_0x8d4e('0x73')][_0x8d4e('0x5c')]({'where':{'ContactId':_0xa0cbd1['id'],'closed':![],'FaxAccountId':_0x1e23d7['id']}})['then'](function(_0x37ad78){if(_0x37ad78){return[_0x37ad78,![]];}return db[_0x8d4e('0x73')]['create']({'UserId':_0xe027ee[_0x8d4e('0x5f')]['id'],'ContactId':_0xa0cbd1['id'],'FaxAccountId':_0x1e23d7['id'],'fax':_0xe027ee['body']['to'][0x0],'firstMsgDirection':_0x8d4e('0xb4'),'Messages':[_[_0x8d4e('0x51')](_0xe027ee['body'],{'read':![],'body':_0xe027ee[_0x8d4e('0x5e')]['attachments'][0x0][_0x8d4e('0xb5')],'FaxAccountId':_0x1e23d7['id'],'UserId':_0xe027ee[_0x8d4e('0x5f')]['id'],'ContactId':_0xa0cbd1['id'],'AttachmentId':_0xe027ee[_0x8d4e('0x5e')][_0x8d4e('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0x8d4e('0xa5')],'as':_0x8d4e('0xb6')}]})[_0x8d4e('0x21')](function(_0x2f6277){return[_0x2f6277,!![]];});});}else{throw new Error(_0x8d4e('0xb7'));}})[_0x8d4e('0xb8')](function(_0x50c090,_0x5d0267){if(_0x5d0267){return _0x50c090;}return db[_0x8d4e('0xa5')]['create']({'direction':_0x8d4e('0xb4'),'read':![],'body':_0xe027ee[_0x8d4e('0x5e')][_0x8d4e('0xa9')][0x0][_0x8d4e('0xb5')],'FaxAccountId':_0x1e23d7['id'],'FaxInteractionId':_0x50c090['id'],'UserId':_0xe027ee[_0x8d4e('0x5f')]['id'],'ContactId':_0x50c090[_0x8d4e('0xb9')],'AttachmentId':_0xe027ee[_0x8d4e('0x5e')][_0x8d4e('0xa9')][0x0]['id']})[_0x8d4e('0x21')](function(_0x2070d4){_0x50c090[_0x8d4e('0xba')][_0x8d4e('0xb6')]=[];_0x50c090[_0x8d4e('0xba')][_0x8d4e('0xb6')]['push'](_0x2070d4[_0x8d4e('0xba')]);return _0x50c090;});})[_0x8d4e('0x21')](function(_0x29830c){respondWithRpcPromise(_0x8d4e('0xbb'),_0x8d4e('0xbb'),{'FaxAccountId':_['isNil'](_0xe027ee[_0x8d4e('0x64')]['id'])?undefined:_0xe027ee[_0x8d4e('0x64')]['id'],'path':_[_0x8d4e('0xae')](_0xe027ee[_0x8d4e('0x5e')][_0x8d4e('0xa9')][0x0][_0x8d4e('0x5')])?undefined:_0xe027ee['body'][_0x8d4e('0xa9')][0x0][_0x8d4e('0x5')],'fax':_[_0x8d4e('0xae')](_0xe027ee[_0x8d4e('0x5e')]['to'][0x0])?undefined:_0xe027ee[_0x8d4e('0x5e')]['to'][0x0],'AttachmentId':_0xe027ee[_0x8d4e('0x5e')][_0x8d4e('0xa9')][0x0]['id']},client9002)[_0x8d4e('0x21')](function(_0x5016e6){logger['info'](_0x8d4e('0xbc'),_0x5016e6);})[_0x8d4e('0x58')](function(_0x5b2ed7){logger[_0x8d4e('0x22')](_0x8d4e('0xbc'),_0x5b2ed7);});return _0x29830c;})[_0x8d4e('0x21')](respondWithResult(_0x362f9d,null))[_0x8d4e('0x58')](handleError(_0x362f9d,null));};exports[_0x8d4e('0xbd')]=function(_0x46ca1a,_0xaca3ea,_0x39398b){return db[_0x8d4e('0x53')][_0x8d4e('0x5c')]({'where':{'id':_0x46ca1a[_0x8d4e('0x64')]['id']}})[_0x8d4e('0x21')](handleEntityNotFound(_0xaca3ea,null))[_0x8d4e('0x21')](function(_0x2e68c5){if(_0x2e68c5){return _0x2e68c5[_0x8d4e('0xbd')](_0x46ca1a[_0x8d4e('0x5e')][_0x8d4e('0x6d')],_['omit'](_0x46ca1a[_0x8d4e('0x5e')],[_0x8d4e('0x6d'),'id'])||{})[_0x8d4e('0xb8')](function(_0x534609){for(var _0x53dfea=0x0;_0x53dfea<_0x46ca1a['body'][_0x8d4e('0x6d')][_0x8d4e('0x4a')];_0x53dfea+=0x1){socket[_0x8d4e('0xbe')](_0x8d4e('0xbf'),{'UserId':Number(_0x46ca1a['body'][_0x8d4e('0x6d')][_0x53dfea]),'FaxAccountId':Number(_0x46ca1a[_0x8d4e('0x64')]['id'])});}return _0x534609;});}})[_0x8d4e('0x21')](respondWithResult(_0xaca3ea,null))[_0x8d4e('0x58')](handleError(_0xaca3ea,null));};exports[_0x8d4e('0xc0')]=function(_0x549973,_0x11031b,_0x8223eb){return db['FaxAccount'][_0x8d4e('0x5c')]({'where':{'id':_0x549973[_0x8d4e('0x64')]['id']}})['then'](handleEntityNotFound(_0x11031b,null))[_0x8d4e('0x21')](function(_0x24711e){if(_0x24711e){return _0x24711e[_0x8d4e('0xc0')](_0x549973[_0x8d4e('0x43')][_0x8d4e('0x6d')])[_0x8d4e('0x21')](function(){if(_[_0x8d4e('0xc1')](_0x549973[_0x8d4e('0x43')]['ids'])){for(var _0x49c623=0x0;_0x49c623<_0x549973[_0x8d4e('0x43')][_0x8d4e('0x6d')][_0x8d4e('0x4a')];_0x49c623+=0x1){socket[_0x8d4e('0xbe')](_0x8d4e('0xc2'),{'UserId':Number(_0x549973['query'][_0x8d4e('0x6d')][_0x49c623]),'FaxAccountId':Number(_0x549973[_0x8d4e('0x64')]['id'])});}}else{socket[_0x8d4e('0xbe')](_0x8d4e('0xc2'),{'UserId':Number(_0x549973[_0x8d4e('0x43')][_0x8d4e('0x6d')]),'FaxAccountId':Number(_0x549973[_0x8d4e('0x64')]['id'])});}});}})[_0x8d4e('0x21')](respondWithStatusCode(_0x11031b,null))[_0x8d4e('0x58')](handleError(_0x11031b,null));};exports['getAgents']=function(_0x32bfc8,_0x10c095,_0x248396){var _0x31d63d={};var _0x5a096c={};var _0x4e743b;var _0x4e90fa;return db[_0x8d4e('0x53')][_0x8d4e('0x6a')]({'where':{'id':_0x32bfc8[_0x8d4e('0x64')]['id']}})[_0x8d4e('0x21')](handleEntityNotFound(_0x10c095,null))[_0x8d4e('0x21')](function(_0x408e34){if(_0x408e34){_0x4e743b=_0x408e34;_0x5a096c[_0x8d4e('0x47')]=_[_0x8d4e('0x44')](db['User'][_0x8d4e('0x5b')]);_0x5a096c['query']=_[_0x8d4e('0x44')](_0x32bfc8[_0x8d4e('0x43')]);_0x5a096c[_0x8d4e('0x45')]=_[_0x8d4e('0x46')](_0x5a096c['model'],_0x5a096c[_0x8d4e('0x43')]);_0x31d63d[_0x8d4e('0x48')]=_[_0x8d4e('0x46')](_0x5a096c[_0x8d4e('0x47')],qs[_0x8d4e('0x49')](_0x32bfc8[_0x8d4e('0x43')][_0x8d4e('0x49')]));_0x31d63d[_0x8d4e('0x48')]=_0x31d63d[_0x8d4e('0x48')][_0x8d4e('0x4a')]?_0x31d63d[_0x8d4e('0x48')]:_0x5a096c[_0x8d4e('0x47')];_0x31d63d['order']=qs[_0x8d4e('0x4e')](_0x32bfc8[_0x8d4e('0x43')][_0x8d4e('0x4e')]);_0x31d63d[_0x8d4e('0x4f')]=qs[_0x8d4e('0x45')](_[_0x8d4e('0x6b')](_0x32bfc8[_0x8d4e('0x43')],_0x5a096c['filters']));if(_0x32bfc8[_0x8d4e('0x43')][_0x8d4e('0x50')]){_0x31d63d['where']=_[_0x8d4e('0x51')](_0x31d63d['where'],{'$or':_[_0x8d4e('0x3f')](_0x31d63d['attributes'],function(_0x2b05fd){var _0x17f57a={};_0x17f57a[_0x2b05fd]={'$like':'%'+_0x32bfc8[_0x8d4e('0x43')][_0x8d4e('0x50')]+'%'};return _0x17f57a;})});}_0x31d63d=_[_0x8d4e('0x51')]({},_0x31d63d,_0x32bfc8[_0x8d4e('0x52')]);return _0x4e743b[_0x8d4e('0xc3')](_0x31d63d);}})[_0x8d4e('0x21')](function(_0x346c35){if(_0x346c35){_0x4e90fa=_0x346c35[_0x8d4e('0x4a')];if(!_0x32bfc8['query'][_0x8d4e('0x4b')](_0x8d4e('0x4c'))){_0x31d63d[_0x8d4e('0x30')]=qs[_0x8d4e('0x30')](_0x32bfc8[_0x8d4e('0x43')][_0x8d4e('0x30')]);_0x31d63d[_0x8d4e('0x2e')]=qs['offset'](_0x32bfc8['query'][_0x8d4e('0x2e')]);}return _0x4e743b[_0x8d4e('0xc3')](_0x31d63d);}})[_0x8d4e('0x21')](function(_0x4ff71a){if(_0x4ff71a){return _0x4ff71a?{'count':_0x4e90fa,'rows':_0x4ff71a}:null;}})[_0x8d4e('0x21')](respondWithResult(_0x10c095,null))['catch'](handleError(_0x10c095,null));}; \ No newline at end of file +var _0x2fcb=['sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','List','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','ContactId','dataValues','SendFax','info','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','removeAgents','userFaxAccount:remove','emit','User','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','offset','undefined','count','limit','set','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','map','FaxAccount','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','options','includeAll','include','findAll','show','params','Pause','mandatoryDispositionPause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','addDisposition','FaxAccountId','Disposition','findOne','rawAttributes','order','merge','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Owner','fullname','internal','Tag','Tags'];(function(_0x47bb96,_0x21a22d){var _0x1b921b=function(_0x25d152){while(--_0x25d152){_0x47bb96['push'](_0x47bb96['shift']());}};_0x1b921b(++_0x21a22d);}(_0x2fcb,0x1d1));var _0xb2fc=function(_0x35f8d5,_0x21df88){_0x35f8d5=_0x35f8d5-0x0;var _0x2fd0ac=_0x2fcb[_0x35f8d5];return _0x2fd0ac;};'use strict';var emlformat=require(_0xb2fc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb2fc('0x1'));var jsonpatch=require(_0xb2fc('0x2'));var rp=require(_0xb2fc('0x3'));var moment=require(_0xb2fc('0x4'));var BPromise=require(_0xb2fc('0x5'));var Mustache=require(_0xb2fc('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb2fc('0x7'));var csv=require(_0xb2fc('0x8'));var ejs=require(_0xb2fc('0x9'));var fs=require('fs');var fs_extra=require(_0xb2fc('0xa'));var _=require(_0xb2fc('0xb'));var squel=require(_0xb2fc('0xc'));var crypto=require(_0xb2fc('0xd'));var jsforce=require(_0xb2fc('0xe'));var deskjs=require(_0xb2fc('0xf'));var toCsv=require(_0xb2fc('0x8'));var querystring=require(_0xb2fc('0x10'));var Papa=require(_0xb2fc('0x11'));var Redis=require(_0xb2fc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb2fc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb2fc('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb2fc('0x15'));var licenseUtil=require(_0xb2fc('0x16'));var db=require(_0xb2fc('0x17'))['db'];config[_0xb2fc('0x18')]=_[_0xb2fc('0x19')](config['redis'],{'host':_0xb2fc('0x1a'),'port':0x18eb});var socket=require(_0xb2fc('0x1b'))(new Redis(config[_0xb2fc('0x18')]));require(_0xb2fc('0x1c'))[_0xb2fc('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb2fc('0x1e')][_0xb2fc('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x147dbb,_0x2b236d,_0x4eaf9d,_0x485d21){return new BPromise(function(_0x4d081d,_0x3aab34){var _0x44302e=_0x485d21||client;return _0x44302e[_0xb2fc('0x20')](_0x147dbb,_0x4eaf9d)[_0xb2fc('0x21')](function(_0x3882fb){logger['info'](_0xb2fc('0x22'),_0x2b236d,_0xb2fc('0x23'));logger[_0xb2fc('0x24')](_0xb2fc('0x25'),_0x2b236d,_0xb2fc('0x23'),JSON[_0xb2fc('0x26')](_0x3882fb));if(_0x3882fb[_0xb2fc('0x27')]){if(_0x3882fb[_0xb2fc('0x27')][_0xb2fc('0x28')]===0x1f4){logger[_0xb2fc('0x27')](_0xb2fc('0x22'),_0x2b236d,_0x3882fb[_0xb2fc('0x27')][_0xb2fc('0x29')]);return _0x3aab34(_0x3882fb[_0xb2fc('0x27')]['message']);}logger['error'](_0xb2fc('0x22'),_0x2b236d,_0x3882fb['error'][_0xb2fc('0x29')]);return _0x4d081d(_0x3882fb['error']['message']);}else{logger['info'](_0xb2fc('0x22'),_0x2b236d,_0xb2fc('0x23'));_0x4d081d(_0x3882fb[_0xb2fc('0x2a')]['message']);}})[_0xb2fc('0x2b')](function(_0x5c30e5){logger[_0xb2fc('0x27')](_0xb2fc('0x22'),_0x2b236d,_0x5c30e5);_0x3aab34(_0x5c30e5);});});}function respondWithStatusCode(_0x2964a8,_0x4c4245){_0x4c4245=_0x4c4245||0xcc;return function(_0xb1c3a3){if(_0xb1c3a3){return _0x2964a8['sendStatus'](_0x4c4245);}return _0x2964a8['status'](_0x4c4245)[_0xb2fc('0x2c')]();};}function respondWithResult(_0x54620f,_0x592681){_0x592681=_0x592681||0xc8;return function(_0x763ede){if(_0x763ede){return _0x54620f[_0xb2fc('0x2d')](_0x592681)[_0xb2fc('0x2e')](_0x763ede);}};}function respondWithFilteredResult(_0x598846,_0x23c668){return function(_0x1f3ca5){if(_0x1f3ca5){var _0x18c08d=typeof _0x23c668[_0xb2fc('0x2f')]==='undefined'&&typeof _0x23c668['limit']===_0xb2fc('0x30');var _0x3f978e=_0x1f3ca5['count'];var _0xc163b9=_0x18c08d?0x0:_0x23c668[_0xb2fc('0x2f')];var _0x3351d1=_0x18c08d?_0x1f3ca5[_0xb2fc('0x31')]:_0x23c668[_0xb2fc('0x2f')]+_0x23c668[_0xb2fc('0x32')];var _0x3e122e;if(_0x3351d1>=_0x3f978e){_0x3351d1=_0x3f978e;_0x3e122e=0xc8;}else{_0x3e122e=0xce;}_0x598846['status'](_0x3e122e);return _0x598846[_0xb2fc('0x33')]('Content-Range',_0xc163b9+'-'+_0x3351d1+'/'+_0x3f978e)[_0xb2fc('0x2e')](_0x1f3ca5);}return null;};}function patchUpdates(_0x22fe70){return function(_0x200425){try{jsonpatch[_0xb2fc('0x34')](_0x200425,_0x22fe70,!![]);}catch(_0x567c1c){return BPromise['reject'](_0x567c1c);}return _0x200425[_0xb2fc('0x35')]();};}function saveUpdates(_0x2b0fc2,_0x25eb0d){return function(_0x305e3f){if(_0x305e3f){return _0x305e3f[_0xb2fc('0x36')](_0x2b0fc2)[_0xb2fc('0x21')](function(_0x423b19){return _0x423b19;});}return null;};}function removeEntity(_0x52a929,_0xc91b53){return function(_0x1dd56a){if(_0x1dd56a){return _0x1dd56a[_0xb2fc('0x37')]()[_0xb2fc('0x21')](function(){var _0x1bd18c=_0x1dd56a[_0xb2fc('0x38')]({'plain':!![]});var _0x4728a8=_0xb2fc('0x39');return db[_0xb2fc('0x3a')][_0xb2fc('0x37')]({'where':{'type':_0x4728a8,'resourceId':_0x1bd18c['id']}})[_0xb2fc('0x21')](function(){return _0x1dd56a;});})[_0xb2fc('0x21')](function(){_0x52a929['status'](0xcc)[_0xb2fc('0x2c')]();});}};}function handleEntityNotFound(_0x4d091c,_0x3c326e){return function(_0x5e1527){if(!_0x5e1527){_0x4d091c['sendStatus'](0x194);}return _0x5e1527;};}function handleError(_0x41e01b,_0x5d9fa2){_0x5d9fa2=_0x5d9fa2||0x1f4;return function(_0x1b345e){logger[_0xb2fc('0x27')](_0x1b345e[_0xb2fc('0x3b')]);if(_0x1b345e[_0xb2fc('0x3c')]){delete _0x1b345e['name'];}_0x41e01b[_0xb2fc('0x2d')](_0x5d9fa2)[_0xb2fc('0x3d')](_0x1b345e);};}exports[_0xb2fc('0x3e')]=function(_0x59ff53,_0x23564c){var _0xccc9f7={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x49a324={},_0x21d411={'count':0x0,'rows':[]};var _0x29b326=_[_0xb2fc('0x3f')](db[_0xb2fc('0x40')]['rawAttributes'],function(_0x10c612){return{'name':_0x10c612[_0xb2fc('0x41')],'type':_0x10c612[_0xb2fc('0x42')][_0xb2fc('0x43')]};});_0x49a324[_0xb2fc('0x44')]=_[_0xb2fc('0x3f')](_0x29b326,_0xb2fc('0x3c'));_0x49a324[_0xb2fc('0x45')]=_[_0xb2fc('0x46')](_0x59ff53[_0xb2fc('0x45')]);_0x49a324['filters']=_[_0xb2fc('0x47')](_0x49a324[_0xb2fc('0x44')],_0x49a324[_0xb2fc('0x45')]);_0xccc9f7['attributes']=_[_0xb2fc('0x47')](_0x49a324[_0xb2fc('0x44')],qs['fields'](_0x59ff53[_0xb2fc('0x45')][_0xb2fc('0x48')]));_0xccc9f7[_0xb2fc('0x49')]=_0xccc9f7[_0xb2fc('0x49')][_0xb2fc('0x4a')]?_0xccc9f7[_0xb2fc('0x49')]:_0x49a324['model'];if(!_0x59ff53[_0xb2fc('0x45')][_0xb2fc('0x4b')](_0xb2fc('0x4c'))){_0xccc9f7['limit']=qs[_0xb2fc('0x32')](_0x59ff53[_0xb2fc('0x45')][_0xb2fc('0x32')]);_0xccc9f7[_0xb2fc('0x2f')]=qs[_0xb2fc('0x2f')](_0x59ff53[_0xb2fc('0x45')][_0xb2fc('0x2f')]);}_0xccc9f7['order']=qs[_0xb2fc('0x4d')](_0x59ff53['query'][_0xb2fc('0x4d')]);_0xccc9f7[_0xb2fc('0x4e')]=qs[_0xb2fc('0x4f')](_[_0xb2fc('0x50')](_0x59ff53[_0xb2fc('0x45')],_0x49a324[_0xb2fc('0x4f')]),_0x29b326);if(_0x59ff53['query'][_0xb2fc('0x51')]){_0xccc9f7[_0xb2fc('0x4e')]=_['merge'](_0xccc9f7[_0xb2fc('0x4e')],{'$or':_[_0xb2fc('0x3f')](_0x29b326,function(_0xc2ef4){if(_0xc2ef4[_0xb2fc('0x42')]!=='VIRTUAL'){var _0x914a4a={};_0x914a4a[_0xc2ef4['name']]={'$like':'%'+_0x59ff53[_0xb2fc('0x45')]['filter']+'%'};return _0x914a4a;}})});}_0xccc9f7=_['merge']({},_0xccc9f7,_0x59ff53[_0xb2fc('0x52')]);var _0x6675a0={'where':_0xccc9f7[_0xb2fc('0x4e')]};return db[_0xb2fc('0x40')]['count'](_0x6675a0)['then'](function(_0x379685){_0x21d411[_0xb2fc('0x31')]=_0x379685;if(_0x59ff53['query'][_0xb2fc('0x53')]){_0xccc9f7[_0xb2fc('0x54')]=[{'all':!![]}];}return db['FaxAccount'][_0xb2fc('0x55')](_0xccc9f7);})[_0xb2fc('0x21')](function(_0x54d979){_0x21d411['rows']=_0x54d979;return _0x21d411;})['then'](respondWithFilteredResult(_0x23564c,_0xccc9f7))[_0xb2fc('0x2b')](handleError(_0x23564c,null));};exports[_0xb2fc('0x56')]=function(_0x2a5db7,_0x5d809f){var _0x1d2296={'raw':![],'where':{'id':_0x2a5db7[_0xb2fc('0x57')]['id']},'include':[{'model':db[_0xb2fc('0x58')],'as':_0xb2fc('0x59')}]},_0x1ee52e={};_0x1ee52e['model']=_[_0xb2fc('0x46')](db[_0xb2fc('0x40')]['rawAttributes']);_0x1ee52e[_0xb2fc('0x45')]=_[_0xb2fc('0x46')](_0x2a5db7[_0xb2fc('0x45')]);_0x1ee52e[_0xb2fc('0x4f')]=_[_0xb2fc('0x47')](_0x1ee52e[_0xb2fc('0x44')],_0x1ee52e[_0xb2fc('0x45')]);_0x1d2296[_0xb2fc('0x49')]=_['intersection'](_0x1ee52e[_0xb2fc('0x44')],qs[_0xb2fc('0x48')](_0x2a5db7[_0xb2fc('0x45')][_0xb2fc('0x48')]));_0x1d2296[_0xb2fc('0x49')]=_0x1d2296[_0xb2fc('0x49')][_0xb2fc('0x4a')]?_0x1d2296[_0xb2fc('0x49')]:_0x1ee52e[_0xb2fc('0x44')];if(_0x2a5db7[_0xb2fc('0x45')][_0xb2fc('0x53')]){_0x1d2296[_0xb2fc('0x54')]=[{'all':!![]}];}_0x1d2296=_['merge']({},_0x1d2296,_0x2a5db7[_0xb2fc('0x52')]);return db[_0xb2fc('0x40')][_0xb2fc('0x5a')](_0x1d2296)['then'](handleEntityNotFound(_0x5d809f,null))[_0xb2fc('0x21')](respondWithResult(_0x5d809f,null))[_0xb2fc('0x2b')](handleError(_0x5d809f,null));};exports[_0xb2fc('0x5b')]=function(_0x85774,_0x5a90cc){return db['FaxAccount'][_0xb2fc('0x5b')](_0x85774[_0xb2fc('0x5c')],{})[_0xb2fc('0x21')](function(_0x5adcd0){var _0x3b07c6=_0x85774[_0xb2fc('0x5d')][_0xb2fc('0x38')]({'plain':!![]});if(!_0x3b07c6)throw new Error(_0xb2fc('0x5e'));if(_0x3b07c6[_0xb2fc('0x5f')]===_0xb2fc('0x5d')){var _0x44f237=_0x5adcd0['get']({'plain':!![]});var _0x384b8a=_0xb2fc('0x39');return db[_0xb2fc('0x60')][_0xb2fc('0x5a')]({'where':{'name':_0x384b8a,'userProfileId':_0x3b07c6[_0xb2fc('0x61')]},'raw':!![]})[_0xb2fc('0x21')](function(_0x44dea2){if(_0x44dea2&&_0x44dea2['autoAssociation']===0x0){return db[_0xb2fc('0x3a')][_0xb2fc('0x5b')]({'name':_0x44f237['name'],'resourceId':_0x44f237['id'],'type':_0x44dea2['name'],'sectionId':_0x44dea2['id']},{})[_0xb2fc('0x21')](function(){return _0x5adcd0;});}else{return _0x5adcd0;}})[_0xb2fc('0x2b')](function(_0x4e0c50){logger[_0xb2fc('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e0c50);throw _0x4e0c50;});}return _0x5adcd0;})[_0xb2fc('0x21')](respondWithResult(_0x5a90cc,0xc9))[_0xb2fc('0x2b')](handleError(_0x5a90cc,null));};exports[_0xb2fc('0x36')]=function(_0x53b5b1,_0x5bbabe){if(_0x53b5b1[_0xb2fc('0x5c')]['id']){delete _0x53b5b1[_0xb2fc('0x5c')]['id'];}return db['FaxAccount'][_0xb2fc('0x5a')]({'where':{'id':_0x53b5b1['params']['id']},'include':[{'model':db[_0xb2fc('0x58')],'as':_0xb2fc('0x59')}]})[_0xb2fc('0x21')](handleEntityNotFound(_0x5bbabe,null))[_0xb2fc('0x21')](saveUpdates(_0x53b5b1[_0xb2fc('0x5c')],null))[_0xb2fc('0x21')](respondWithResult(_0x5bbabe,null))[_0xb2fc('0x2b')](handleError(_0x5bbabe,null));};exports['destroy']=function(_0x41f134,_0x21a5df){return db[_0xb2fc('0x40')][_0xb2fc('0x5a')]({'where':{'id':_0x41f134['params']['id']}})['then'](handleEntityNotFound(_0x21a5df,null))['then'](removeEntity(_0x21a5df,null))[_0xb2fc('0x2b')](handleError(_0x21a5df,null));};exports[_0xb2fc('0x62')]=function(_0x56ea61,_0x5700a0){return db[_0xb2fc('0x40')][_0xb2fc('0x62')]()[_0xb2fc('0x21')](respondWithResult(_0x5700a0,null))[_0xb2fc('0x2b')](handleError(_0x5700a0,null));};exports[_0xb2fc('0x63')]=function(_0x4649d0,_0x1a4030,_0x2db5f5){if(_0x4649d0[_0xb2fc('0x5c')]['id']){delete _0x4649d0[_0xb2fc('0x5c')]['id'];}return db[_0xb2fc('0x40')][_0xb2fc('0x5a')]({'where':{'id':_0x4649d0[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x1a4030,null))[_0xb2fc('0x21')](function(_0x343dab){if(_0x343dab){_0x4649d0['body'][_0xb2fc('0x64')]=_0x343dab['id'];return db[_0xb2fc('0x65')][_0xb2fc('0x5b')](_0x4649d0[_0xb2fc('0x5c')]);}})['then'](respondWithResult(_0x1a4030,null))['catch'](handleError(_0x1a4030,null));};exports['getDispositions']=function(_0xdd4d47,_0x1f94eb,_0x3c7d0e){var _0x3fc328={'raw':![],'where':{}};var _0xd67d9e={};var _0x15ed78={'count':0x0,'rows':[]};return db[_0xb2fc('0x40')][_0xb2fc('0x66')]({'where':{'id':_0xdd4d47[_0xb2fc('0x57')]['id']}})['then'](handleEntityNotFound(_0x1f94eb,null))[_0xb2fc('0x21')](function(_0x18c88d){if(_0x18c88d){_0xd67d9e[_0xb2fc('0x44')]=_[_0xb2fc('0x46')](db[_0xb2fc('0x65')][_0xb2fc('0x67')]);_0xd67d9e[_0xb2fc('0x45')]=_[_0xb2fc('0x46')](_0xdd4d47[_0xb2fc('0x45')]);_0xd67d9e[_0xb2fc('0x4f')]=_['intersection'](_0xd67d9e['model'],_0xd67d9e[_0xb2fc('0x45')]);_0x3fc328['attributes']=_['intersection'](_0xd67d9e[_0xb2fc('0x44')],qs[_0xb2fc('0x48')](_0xdd4d47[_0xb2fc('0x45')][_0xb2fc('0x48')]));_0x3fc328[_0xb2fc('0x49')]=_0x3fc328['attributes'][_0xb2fc('0x4a')]?_0x3fc328[_0xb2fc('0x49')]:_0xd67d9e[_0xb2fc('0x44')];if(!_0xdd4d47[_0xb2fc('0x45')][_0xb2fc('0x4b')](_0xb2fc('0x4c'))){_0x3fc328[_0xb2fc('0x32')]=qs[_0xb2fc('0x32')](_0xdd4d47['query'][_0xb2fc('0x32')]);_0x3fc328['offset']=qs[_0xb2fc('0x2f')](_0xdd4d47[_0xb2fc('0x45')]['offset']);}_0x3fc328[_0xb2fc('0x68')]=qs[_0xb2fc('0x4d')](_0xdd4d47['query']['sort']);_0x3fc328[_0xb2fc('0x4e')]=qs[_0xb2fc('0x4f')](_[_0xb2fc('0x50')](_0xdd4d47[_0xb2fc('0x45')],_0xd67d9e['filters']));_0x3fc328['where'][_0xb2fc('0x64')]=_0x18c88d['id'];if(_0xdd4d47['query']['filter']){_0x3fc328['where']=_[_0xb2fc('0x69')](_0x3fc328[_0xb2fc('0x4e')],{'$or':_[_0xb2fc('0x3f')](_0x3fc328[_0xb2fc('0x49')],function(_0x46deb4){var _0x54882a={};_0x54882a[_0x46deb4]={'$like':'%'+_0xdd4d47[_0xb2fc('0x45')][_0xb2fc('0x51')]+'%'};return _0x54882a;})});}_0x3fc328=_[_0xb2fc('0x69')]({},_0x3fc328,_0xdd4d47[_0xb2fc('0x52')]);return db[_0xb2fc('0x65')][_0xb2fc('0x31')]({'where':_0x3fc328['where']})['then'](function(_0x1e53a6){_0x15ed78[_0xb2fc('0x31')]=_0x1e53a6;if(_0xdd4d47['query'][_0xb2fc('0x53')]){_0x3fc328[_0xb2fc('0x54')]=[{'all':!![]}];}return db['Disposition'][_0xb2fc('0x55')](_0x3fc328);})[_0xb2fc('0x21')](function(_0x22e943){_0x15ed78[_0xb2fc('0x6a')]=_0x22e943;return _0x15ed78;});}})['then'](respondWithFilteredResult(_0x1f94eb,_0x3fc328))[_0xb2fc('0x2b')](handleError(_0x1f94eb,null));};exports[_0xb2fc('0x6b')]=function(_0x32979c,_0x548274,_0x39e077){return db[_0xb2fc('0x40')]['find']({'where':{'id':_0x32979c[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x548274,null))[_0xb2fc('0x21')](function(_0x35863b){if(_0x35863b){return _0x35863b[_0xb2fc('0x6b')](_0x32979c[_0xb2fc('0x45')][_0xb2fc('0x6c')]);}})[_0xb2fc('0x21')](respondWithStatusCode(_0x548274,null))[_0xb2fc('0x2b')](handleError(_0x548274,null));};exports[_0xb2fc('0x6d')]=function(_0x2dd5cd,_0x1d4936,_0x241c13){if(_0x2dd5cd['body']['id']){delete _0x2dd5cd[_0xb2fc('0x5c')]['id'];}return db[_0xb2fc('0x40')][_0xb2fc('0x5a')]({'where':{'id':_0x2dd5cd[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x1d4936,null))[_0xb2fc('0x21')](function(_0x13802a){if(_0x13802a){_0x2dd5cd['body']['FaxAccountId']=_0x13802a['id'];return db[_0xb2fc('0x6e')]['create'](_0x2dd5cd[_0xb2fc('0x5c')]);}})[_0xb2fc('0x21')](respondWithResult(_0x1d4936,null))[_0xb2fc('0x2b')](handleError(_0x1d4936,null));};exports[_0xb2fc('0x6f')]=function(_0x564e3d,_0xfad38e,_0x17aa24){var _0x26f258={'raw':![],'where':{}};var _0x135886={};var _0x4f0fd3={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x564e3d[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0xfad38e,null))[_0xb2fc('0x21')](function(_0x63d76a){if(_0x63d76a){_0x135886[_0xb2fc('0x44')]=_[_0xb2fc('0x46')](db[_0xb2fc('0x6e')][_0xb2fc('0x67')]);_0x135886['query']=_[_0xb2fc('0x46')](_0x564e3d['query']);_0x135886[_0xb2fc('0x4f')]=_['intersection'](_0x135886['model'],_0x135886[_0xb2fc('0x45')]);_0x26f258['attributes']=_[_0xb2fc('0x47')](_0x135886[_0xb2fc('0x44')],qs[_0xb2fc('0x48')](_0x564e3d[_0xb2fc('0x45')][_0xb2fc('0x48')]));_0x26f258[_0xb2fc('0x49')]=_0x26f258[_0xb2fc('0x49')]['length']?_0x26f258[_0xb2fc('0x49')]:_0x135886['model'];if(!_0x564e3d['query']['hasOwnProperty'](_0xb2fc('0x4c'))){_0x26f258[_0xb2fc('0x32')]=qs[_0xb2fc('0x32')](_0x564e3d[_0xb2fc('0x45')][_0xb2fc('0x32')]);_0x26f258[_0xb2fc('0x2f')]=qs[_0xb2fc('0x2f')](_0x564e3d['query'][_0xb2fc('0x2f')]);}_0x26f258[_0xb2fc('0x68')]=qs['sort'](_0x564e3d[_0xb2fc('0x45')][_0xb2fc('0x4d')]);_0x26f258[_0xb2fc('0x4e')]=qs[_0xb2fc('0x4f')](_[_0xb2fc('0x50')](_0x564e3d[_0xb2fc('0x45')],_0x135886[_0xb2fc('0x4f')]));_0x26f258[_0xb2fc('0x4e')][_0xb2fc('0x64')]=_0x63d76a['id'];if(_0x564e3d[_0xb2fc('0x45')][_0xb2fc('0x51')]){_0x26f258[_0xb2fc('0x4e')]=_[_0xb2fc('0x69')](_0x26f258[_0xb2fc('0x4e')],{'$or':_[_0xb2fc('0x3f')](_0x26f258[_0xb2fc('0x49')],function(_0x50027c){var _0x9ee921={};_0x9ee921[_0x50027c]={'$like':'%'+_0x564e3d['query']['filter']+'%'};return _0x9ee921;})});}_0x26f258=_[_0xb2fc('0x69')]({},_0x26f258,_0x564e3d[_0xb2fc('0x52')]);return db[_0xb2fc('0x6e')][_0xb2fc('0x31')]({'where':_0x26f258[_0xb2fc('0x4e')]})[_0xb2fc('0x21')](function(_0x2060c6){_0x4f0fd3[_0xb2fc('0x31')]=_0x2060c6;if(_0x564e3d[_0xb2fc('0x45')][_0xb2fc('0x53')]){_0x26f258[_0xb2fc('0x54')]=[{'all':!![]}];}return db[_0xb2fc('0x6e')][_0xb2fc('0x55')](_0x26f258);})[_0xb2fc('0x21')](function(_0x317c04){_0x4f0fd3[_0xb2fc('0x6a')]=_0x317c04;return _0x4f0fd3;});}})[_0xb2fc('0x21')](respondWithFilteredResult(_0xfad38e,_0x26f258))[_0xb2fc('0x2b')](handleError(_0xfad38e,null));};exports['removeAnswers']=function(_0x54e581,_0x56505a,_0x243def){return db[_0xb2fc('0x40')][_0xb2fc('0x5a')]({'where':{'id':_0x54e581[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x56505a,null))[_0xb2fc('0x21')](function(_0x3ed9c7){if(_0x3ed9c7){return _0x3ed9c7[_0xb2fc('0x70')](_0x54e581[_0xb2fc('0x45')]['ids']);}})[_0xb2fc('0x21')](respondWithStatusCode(_0x56505a,null))[_0xb2fc('0x2b')](handleError(_0x56505a,null));};exports[_0xb2fc('0x71')]=function(_0xd7004f,_0x67fa93,_0x29130d){return db['FaxInteraction'][_0xb2fc('0x5a')]({'where':{'id':_0xd7004f[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x67fa93,null))[_0xb2fc('0x21')](function(_0x40ecf7){if(_0x40ecf7){return _0x40ecf7[_0xb2fc('0x71')](_0xd7004f[_0xb2fc('0x5c')]['ids'],_[_0xb2fc('0x72')](_0xd7004f[_0xb2fc('0x5c')],[_0xb2fc('0x6c'),'id'])||{});}})[_0xb2fc('0x21')](respondWithResult(_0x67fa93,null))[_0xb2fc('0x2b')](handleError(_0x67fa93,null));};exports[_0xb2fc('0x73')]=function(_0x2cd669,_0x67ff00,_0x3c89ae){var _0x3a494a={'raw':![],'where':{}};var _0x3231da={};var _0x1f8003={'count':0x0,'rows':[]};return db[_0xb2fc('0x40')]['findOne']({'where':{'id':_0x2cd669[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x67ff00,null))[_0xb2fc('0x21')](function(_0x2633c7){if(_0x2633c7){_0x3231da[_0xb2fc('0x44')]=_[_0xb2fc('0x46')](db[_0xb2fc('0x74')][_0xb2fc('0x67')]);_0x3231da[_0xb2fc('0x45')]=_[_0xb2fc('0x46')](_0x2cd669[_0xb2fc('0x45')]);_0x3231da[_0xb2fc('0x4f')]=_[_0xb2fc('0x47')](_0x3231da['model'],_0x3231da[_0xb2fc('0x45')]);_0x3a494a[_0xb2fc('0x49')]=_[_0xb2fc('0x47')](_0x3231da['model'],qs[_0xb2fc('0x48')](_0x2cd669[_0xb2fc('0x45')][_0xb2fc('0x48')]));_0x3a494a['attributes']=_0x3a494a['attributes']['length']?_0x3a494a[_0xb2fc('0x49')]:_0x3231da[_0xb2fc('0x44')];if(!_0x2cd669[_0xb2fc('0x45')][_0xb2fc('0x4b')](_0xb2fc('0x4c'))){_0x3a494a[_0xb2fc('0x32')]=qs['limit'](_0x2cd669[_0xb2fc('0x45')][_0xb2fc('0x32')]);_0x3a494a['offset']=qs[_0xb2fc('0x2f')](_0x2cd669[_0xb2fc('0x45')][_0xb2fc('0x2f')]);}_0x3a494a[_0xb2fc('0x68')]=qs[_0xb2fc('0x4d')](_0x2cd669[_0xb2fc('0x45')][_0xb2fc('0x4d')]);_0x3a494a[_0xb2fc('0x4e')]=qs[_0xb2fc('0x4f')](_[_0xb2fc('0x50')](_0x2cd669[_0xb2fc('0x45')],_0x3231da[_0xb2fc('0x4f')]));_0x3a494a['where'][_0xb2fc('0x64')]=_0x2633c7['id'];if(_0x2cd669['query']['filter']){_0x3a494a['where']=_[_0xb2fc('0x69')](_0x3a494a[_0xb2fc('0x4e')],{'$or':_['map'](_0x3a494a[_0xb2fc('0x49')],function(_0x4ee66b){var _0x112365={};_0x112365[_0x4ee66b]={'$like':'%'+_0x2cd669[_0xb2fc('0x45')][_0xb2fc('0x51')]+'%'};return _0x112365;})});}_0x3a494a=_[_0xb2fc('0x69')]({},_0x3a494a,_0x2cd669[_0xb2fc('0x52')]);return db[_0xb2fc('0x74')][_0xb2fc('0x31')]({'where':_0x3a494a[_0xb2fc('0x4e')]})['then'](function(_0x5f1243){_0x1f8003[_0xb2fc('0x31')]=_0x5f1243;if(_0x2cd669[_0xb2fc('0x45')][_0xb2fc('0x53')]){_0x3a494a['include']=[{'model':db[_0xb2fc('0x75')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xb2fc('0x76'),'attributes':[_0xb2fc('0x3c'),_0xb2fc('0x77'),_0xb2fc('0x78')],'required':![]},{'model':db[_0xb2fc('0x79')],'as':_0xb2fc('0x7a'),'attributes':['id',_0xb2fc('0x3c'),'color'],'where':_0x2cd669[_0xb2fc('0x45')]['tag']?{'id':_0x2cd669['query']['tag']}:undefined,'required':_0x2cd669[_0xb2fc('0x45')]['tag']?!![]:![]}];}return db[_0xb2fc('0x74')][_0xb2fc('0x55')](_0x3a494a);})[_0xb2fc('0x21')](function(_0x5d22a2){_0x1f8003[_0xb2fc('0x6a')]=_0x5d22a2;return _0x1f8003;});}})[_0xb2fc('0x21')](respondWithFilteredResult(_0x67ff00,_0x3a494a))[_0xb2fc('0x2b')](handleError(_0x67ff00,null));};exports['addApplications']=function(_0xb284fe,_0x4a153c,_0x75aa93){return db[_0xb2fc('0x40')][_0xb2fc('0x66')]({'where':{'id':_0xb284fe[_0xb2fc('0x57')]['id']}})['then'](handleEntityNotFound(_0x4a153c,null))['then'](function(_0x2a87f8){if(_0x2a87f8){return db[_0xb2fc('0x7b')][_0xb2fc('0x7c')](function(_0x4bbe2c){return db[_0xb2fc('0x7d')][_0xb2fc('0x37')]({'where':{'FaxAccountId':_0xb284fe[_0xb2fc('0x57')]['id']},'transaction':_0x4bbe2c})[_0xb2fc('0x21')](function(_0x28bda3){var _0x1a46c0=_[_0xb2fc('0x3f')](_0xb284fe[_0xb2fc('0x5c')],function(_0x52f1ab){_0x52f1ab['FaxAccountId']=_0xb284fe['params']['id'];return _0x52f1ab;});return db['FaxApplication'][_0xb2fc('0x7e')](_0x1a46c0,{'transaction':_0x4bbe2c});});})['then'](function(){return db[_0xb2fc('0x7d')][_0xb2fc('0x7f')]({'where':{'FaxAccountId':_0xb284fe[_0xb2fc('0x57')]['id']},'order':_0xb2fc('0x80')});});}})[_0xb2fc('0x21')](respondWithResult(_0x4a153c,null))[_0xb2fc('0x2b')](handleError(_0x4a153c,null));};exports['getApplications']=function(_0x56ff4e,_0x586fc2,_0x140c01){var _0x37207d={};var _0x5704f7={};var _0x2e7f02;var _0xe6f28a;return db['FaxAccount'][_0xb2fc('0x66')]({'where':{'id':_0x56ff4e['params']['id']}})['then'](handleEntityNotFound(_0x586fc2,null))['then'](function(_0x336168){if(_0x336168){_0x2e7f02=_0x336168;_0x5704f7[_0xb2fc('0x44')]=_[_0xb2fc('0x46')](db[_0xb2fc('0x7d')]['rawAttributes']);_0x5704f7[_0xb2fc('0x45')]=_[_0xb2fc('0x46')](_0x56ff4e[_0xb2fc('0x45')]);_0x5704f7[_0xb2fc('0x4f')]=_['intersection'](_0x5704f7['model'],_0x5704f7[_0xb2fc('0x45')]);_0x37207d[_0xb2fc('0x49')]=_['intersection'](_0x5704f7['model'],qs['fields'](_0x56ff4e[_0xb2fc('0x45')]['fields']));_0x37207d[_0xb2fc('0x49')]=_0x37207d['attributes'][_0xb2fc('0x4a')]?_0x37207d[_0xb2fc('0x49')]:_0x5704f7[_0xb2fc('0x44')];_0x37207d['order']=qs[_0xb2fc('0x4d')](_0x56ff4e[_0xb2fc('0x45')][_0xb2fc('0x4d')]);_0x37207d[_0xb2fc('0x4e')]=qs[_0xb2fc('0x4f')](_[_0xb2fc('0x50')](_0x56ff4e[_0xb2fc('0x45')],_0x5704f7[_0xb2fc('0x4f')]));if(_0x56ff4e[_0xb2fc('0x45')]['filter']){_0x37207d['where']=_['merge'](_0x37207d[_0xb2fc('0x4e')],{'$or':_[_0xb2fc('0x3f')](_0x37207d[_0xb2fc('0x49')],function(_0x4acc56){var _0x1e137f={};_0x1e137f[_0x4acc56]={'$like':'%'+_0x56ff4e['query']['filter']+'%'};return _0x1e137f;})});}_0x37207d=_[_0xb2fc('0x69')]({},_0x37207d,_0x56ff4e[_0xb2fc('0x52')]);return _0x2e7f02['getApplications'](_0x37207d);}})[_0xb2fc('0x21')](function(_0x25a082){if(_0x25a082){_0xe6f28a=_0x25a082[_0xb2fc('0x4a')];if(!_0x56ff4e[_0xb2fc('0x45')]['hasOwnProperty'](_0xb2fc('0x4c'))){_0x37207d[_0xb2fc('0x32')]=qs[_0xb2fc('0x32')](_0x56ff4e[_0xb2fc('0x45')][_0xb2fc('0x32')]);_0x37207d[_0xb2fc('0x2f')]=qs[_0xb2fc('0x2f')](_0x56ff4e['query'][_0xb2fc('0x2f')]);}return _0x2e7f02[_0xb2fc('0x81')](_0x37207d);}})[_0xb2fc('0x21')](function(_0x201646){if(_0x201646){return _0x201646?{'count':_0xe6f28a,'rows':_0x201646}:null;}})[_0xb2fc('0x21')](respondWithResult(_0x586fc2,null))[_0xb2fc('0x2b')](handleError(_0x586fc2,null));};function Extension(_0x1aaa75,_0x5dc150,_0x5b146b,_0x332146){this[_0xb2fc('0x82')]=_0xb2fc('0x83');this[_0xb2fc('0x84')]=_0x1aaa75[_0xb2fc('0x85')];this[_0xb2fc('0x86')]=_0x332146;this[_0xb2fc('0x42')]=_0xb2fc('0x87');this['description']='Fax\x20Extension';this[_0xb2fc('0x64')]=_0x1aaa75['id'];this[_0xb2fc('0x80')]=_0x5dc150;this[_0xb2fc('0x88')]=_0x5b146b;}function createExtensionsReciveFax(_0x209fb8){var _0x5a1a7d=0x1;var _0x162bc0=[];_0x162bc0[_0xb2fc('0x89')](new Extension(_0x209fb8,_0x5a1a7d,'','Answer'));_0x5a1a7d+=0x1;_0x162bc0[_0xb2fc('0x89')](new Extension(_0x209fb8,_0x5a1a7d,_0xb2fc('0x8a'),_0xb2fc('0x8b')));_0x5a1a7d+=0x1;for(var _0x449bce in _0x209fb8){if(_0x209fb8[_0xb2fc('0x4b')](_0x449bce)&&(_0x449bce===_0xb2fc('0x8c')||_0x449bce===_0xb2fc('0x85')||_0x449bce===_0xb2fc('0x8d')||_0x449bce===_0xb2fc('0x8e')||_0x449bce===_0xb2fc('0x8f')||_0x449bce===_0xb2fc('0x90')||_0x449bce===_0xb2fc('0x91')||_0x449bce===_0xb2fc('0x92')||_0x449bce==='t38timeout')){_0x162bc0[_0xb2fc('0x89')](new Extension(_0x209fb8,_0x5a1a7d,_0xb2fc('0x93')+_0x449bce+')='+_0x209fb8[_0x449bce],_0xb2fc('0x8b')));_0x5a1a7d+=0x1;}}_0x162bc0['push'](new Extension(_0x209fb8,_0x5a1a7d,'6',_0xb2fc('0x94')));_0x5a1a7d+=0x1;_0x162bc0['push'](new Extension(_0x209fb8,_0x5a1a7d,_0xb2fc('0x95'),_0xb2fc('0x96')));_0x5a1a7d=0x0;return _0x162bc0;}exports[_0xb2fc('0x97')]=function(_0x19f61d,_0x20a463,_0x106219){var _0x3bdab3;return db[_0xb2fc('0x7b')][_0xb2fc('0x7c')](function(_0x21c0ce){return db[_0xb2fc('0x40')][_0xb2fc('0x5b')](_0x19f61d['body'],{'transaction':_0x21c0ce})[_0xb2fc('0x21')](function(_0x1b4170){_0x3bdab3=_0x1b4170[_0xb2fc('0x38')]({'plain':!![]});return db[_0xb2fc('0x98')]['bulkCreate'](createExtensionsReciveFax(_0x3bdab3),{'transaction':_0x21c0ce});});})[_0xb2fc('0x21')](function(){return _0x3bdab3;})[_0xb2fc('0x21')](respondWithResult(_0x20a463,null))[_0xb2fc('0x2b')](handleError(_0x20a463,null));};exports[_0xb2fc('0x99')]=function(_0x122f6c,_0x1c729e,_0x4cd1d8){var _0x3e9299;return db['sequelize'][_0xb2fc('0x7c')](function(_0x1b457f){return db[_0xb2fc('0x40')][_0xb2fc('0x36')](_0x122f6c['body'],{'where':{'id':_0x122f6c[_0xb2fc('0x5c')]['id']},'transaction':_0x1b457f})[_0xb2fc('0x21')](function(_0x23157c){return db['VoiceExtension'][_0xb2fc('0x37')]({'where':{'FaxAccountId':_0x122f6c[_0xb2fc('0x5c')]['id']},'transaction':_0x1b457f})['then'](function(_0xc48893){return db[_0xb2fc('0x98')][_0xb2fc('0x7e')](createExtensionsReciveFax(_[_0xb2fc('0x72')](_0x122f6c[_0xb2fc('0x5c')],['tech',_0xb2fc('0x43'),_0xb2fc('0x9a'),_0xb2fc('0x9b'),_0xb2fc('0x9c'),_0xb2fc('0x9d')])),{'transaction':_0x1b457f});});});})[_0xb2fc('0x21')](function(){return db[_0xb2fc('0x40')][_0xb2fc('0x9e')](_0x122f6c[_0xb2fc('0x5c')]['id']);})[_0xb2fc('0x21')](respondWithResult(_0x1c729e,null))[_0xb2fc('0x2b')](handleError(_0x1c729e,null));};exports[_0xb2fc('0x9f')]=function(_0x191ef7,_0x34b8f4,_0x2aa46e){var _0x3a52ad={'raw':!![],'where':{}};var _0x448694={};var _0x4606b2={'count':0x0,'rows':[]};return db[_0xb2fc('0x40')][_0xb2fc('0x66')]({'where':{'id':_0x191ef7['params']['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x34b8f4,null))[_0xb2fc('0x21')](function(_0x1212f6){if(_0x1212f6){_0x448694[_0xb2fc('0x44')]=_[_0xb2fc('0x46')](db[_0xb2fc('0xa0')][_0xb2fc('0x67')]);_0x448694[_0xb2fc('0x45')]=_[_0xb2fc('0x46')](_0x191ef7[_0xb2fc('0x45')]);_0x448694['filters']=_['intersection'](_0x448694[_0xb2fc('0x44')],_0x448694['query']);_0x3a52ad[_0xb2fc('0x49')]=_[_0xb2fc('0x47')](_0x448694[_0xb2fc('0x44')],qs['fields'](_0x191ef7[_0xb2fc('0x45')]['fields']));_0x3a52ad[_0xb2fc('0x49')]=_0x3a52ad[_0xb2fc('0x49')][_0xb2fc('0x4a')]?_0x3a52ad[_0xb2fc('0x49')]:_0x448694[_0xb2fc('0x44')];if(!_0x191ef7[_0xb2fc('0x45')][_0xb2fc('0x4b')]('nolimit')){_0x3a52ad[_0xb2fc('0x32')]=qs[_0xb2fc('0x32')](_0x191ef7['query'][_0xb2fc('0x32')]);_0x3a52ad[_0xb2fc('0x2f')]=qs[_0xb2fc('0x2f')](_0x191ef7[_0xb2fc('0x45')][_0xb2fc('0x2f')]);}_0x3a52ad[_0xb2fc('0x68')]=qs[_0xb2fc('0x4d')](_0x191ef7[_0xb2fc('0x45')][_0xb2fc('0x4d')]);_0x3a52ad[_0xb2fc('0x4e')]=qs[_0xb2fc('0x4f')](_[_0xb2fc('0x50')](_0x191ef7[_0xb2fc('0x45')],_0x448694[_0xb2fc('0x4f')]));_0x3a52ad[_0xb2fc('0x4e')][_0xb2fc('0x64')]=_0x1212f6['id'];if(_0x191ef7[_0xb2fc('0x45')][_0xb2fc('0x51')]){_0x3a52ad['where']=_[_0xb2fc('0x69')](_0x3a52ad[_0xb2fc('0x4e')],{'$or':_[_0xb2fc('0x3f')](_0x3a52ad[_0xb2fc('0x49')],function(_0x1ae584){var _0x8fed19={};_0x8fed19[_0x1ae584]={'$like':'%'+_0x191ef7[_0xb2fc('0x45')][_0xb2fc('0x51')]+'%'};return _0x8fed19;})});}if(_0x191ef7[_0xb2fc('0x45')]['$gte']){var _0xf58f1a=_0x191ef7[_0xb2fc('0x45')][_0xb2fc('0xa1')][_0xb2fc('0xa2')](',');var _0x4fd764={};_0x4fd764[_0xf58f1a[0x0]]={'$gte':moment(_0xf58f1a[0x1])[_0xb2fc('0xa3')](_0xb2fc('0xa4'))};_0x3a52ad['where']=_[_0xb2fc('0x69')](_0x3a52ad[_0xb2fc('0x4e')],_0x4fd764);}_0x3a52ad=_[_0xb2fc('0x69')]({},_0x3a52ad,_0x191ef7['options']);return db['FaxMessage'][_0xb2fc('0x31')]({'where':_0x3a52ad[_0xb2fc('0x4e')]})[_0xb2fc('0x21')](function(_0xcf64e2){_0x4606b2['count']=_0xcf64e2;if(_0x191ef7[_0xb2fc('0x45')][_0xb2fc('0x53')]){_0x3a52ad[_0xb2fc('0x54')]=[{'all':!![]}];}return db[_0xb2fc('0xa0')][_0xb2fc('0x55')](_0x3a52ad);})[_0xb2fc('0x21')](function(_0x5ba787){_0x4606b2['rows']=_0x5ba787;return _0x4606b2;});}})[_0xb2fc('0x21')](respondWithFilteredResult(_0x34b8f4,_0x3a52ad))['catch'](handleError(_0x34b8f4,null));};exports['send']=function(_0x459e32,_0x546a80,_0x11a931){var _0x22decb,_0x7571df={},_0x278922;if(_0x459e32[_0xb2fc('0x5c')]['to']){_0x278922=_0x459e32[_0xb2fc('0x5c')]['to'][0x0];}return db['FaxAccount'][_0xb2fc('0x5a')]({'where':{'id':_0x459e32[_0xb2fc('0x57')]['id']},'include':[{'model':db[_0xb2fc('0xa5')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x278922},'limit':0x1,'order':[['updatedAt',_0xb2fc('0xa6')]]}]}]})[_0xb2fc('0x21')](handleEntityNotFound(_0x546a80,null))[_0xb2fc('0x21')](function(_0x419564){_0x22decb=_0x419564;if(_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')]&&_0x459e32['body']['attachments'][_0xb2fc('0x4a')]){for(var _0x54d383=0x0;_0x54d383<_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][_0xb2fc('0x4a')];_0x54d383+=0x1){_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][_0x54d383]={'filename':_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][_0x54d383]['name'],'id':_0x459e32[_0xb2fc('0x5c')]['attachments'][_0x54d383]['id'],'path':path['join'](config[_0xb2fc('0xa8')],_0xb2fc('0xa9'),_0x459e32['body']['attachments'][_0x54d383][_0xb2fc('0xaa')])};}}return respondWithRpcPromise(_0xb2fc('0xab'),_0xb2fc('0xab'),{'FaxAccountId':_[_0xb2fc('0xac')](_0x459e32[_0xb2fc('0x57')]['id'])?undefined:_0x459e32['params']['id'],'path':_[_0xb2fc('0xac')](_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][0x0][_0xb2fc('0xad')])?undefined:_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][0x0][_0xb2fc('0xad')],'fax':_['isNil'](_0x459e32[_0xb2fc('0x5c')]['to'][0x0])?undefined:_0x459e32['body']['to'][0x0]},client9002);})['then'](function(){if(_0x22decb){if(_[_0xb2fc('0xac')](_0x459e32[_0xb2fc('0x5c')]['from'])){_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xae')]=util[_0xb2fc('0xa3')](_0xb2fc('0xaf'),_0x22decb[_0xb2fc('0x3c')],_0x22decb['fax']);}if(_0x22decb[_0xb2fc('0xb0')]){if(_0x22decb[_0xb2fc('0xb0')][_0xb2fc('0xb1')]['length']){return _0x22decb[_0xb2fc('0xb0')][_0xb2fc('0xb1')][0x0];}else{return db['CmContact'][_0xb2fc('0x5b')](_[_0xb2fc('0x19')](_0x459e32[_0xb2fc('0x5c')],{'firstName':_0x459e32[_0xb2fc('0x5c')]['to'][0x0],'phone':_0x459e32['body']['to'][0x0],'fax':_0x459e32['body']['to'][0x0],'ListId':_0x22decb[_0xb2fc('0x9d')]}));}}else{throw new Error(_0xb2fc('0xb2'));}}else{throw new Error(_0xb2fc('0xb3'));}})[_0xb2fc('0x21')](function(_0x195b21){if(_0x195b21){return db[_0xb2fc('0x74')][_0xb2fc('0x5a')]({'where':{'ContactId':_0x195b21['id'],'closed':![],'FaxAccountId':_0x22decb['id']}})['then'](function(_0x42f7f5){if(_0x42f7f5){return[_0x42f7f5,![]];}return db[_0xb2fc('0x74')][_0xb2fc('0x5b')]({'UserId':_0x459e32[_0xb2fc('0x5d')]['id'],'ContactId':_0x195b21['id'],'FaxAccountId':_0x22decb['id'],'fax':_0x459e32['body']['to'][0x0],'firstMsgDirection':_0xb2fc('0xb4'),'Messages':[_[_0xb2fc('0x69')](_0x459e32[_0xb2fc('0x5c')],{'read':![],'body':_0x459e32['body'][_0xb2fc('0xa7')][0x0][_0xb2fc('0xb5')],'FaxAccountId':_0x22decb['id'],'UserId':_0x459e32[_0xb2fc('0x5d')]['id'],'ContactId':_0x195b21['id'],'AttachmentId':_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0xb2fc('0xa0')],'as':_0xb2fc('0xb6')}]})[_0xb2fc('0x21')](function(_0x286db3){return[_0x286db3,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x1273cc,_0x25e667){if(_0x25e667){return _0x1273cc;}return db[_0xb2fc('0xa0')][_0xb2fc('0x5b')]({'direction':'out','read':![],'body':_0x459e32['body'][_0xb2fc('0xa7')][0x0][_0xb2fc('0xb5')],'FaxAccountId':_0x22decb['id'],'FaxInteractionId':_0x1273cc['id'],'UserId':_0x459e32[_0xb2fc('0x5d')]['id'],'ContactId':_0x1273cc[_0xb2fc('0xb7')],'AttachmentId':_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][0x0]['id']})['then'](function(_0x58a717){_0x1273cc['dataValues'][_0xb2fc('0xb6')]=[];_0x1273cc[_0xb2fc('0xb8')][_0xb2fc('0xb6')][_0xb2fc('0x89')](_0x58a717['dataValues']);return _0x1273cc;});})['then'](function(_0x262b3b){respondWithRpcPromise(_0xb2fc('0xb9'),'SendFax',{'FaxAccountId':_[_0xb2fc('0xac')](_0x459e32['params']['id'])?undefined:_0x459e32[_0xb2fc('0x57')]['id'],'path':_[_0xb2fc('0xac')](_0x459e32['body'][_0xb2fc('0xa7')][0x0][_0xb2fc('0xad')])?undefined:_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][0x0][_0xb2fc('0xad')],'fax':_[_0xb2fc('0xac')](_0x459e32[_0xb2fc('0x5c')]['to'][0x0])?undefined:_0x459e32[_0xb2fc('0x5c')]['to'][0x0],'AttachmentId':_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][0x0]['id']},client9002)[_0xb2fc('0x21')](function(_0x51ce85){logger[_0xb2fc('0xba')]('SendFaxRpc,\x20%s',_0x51ce85);})[_0xb2fc('0x2b')](function(_0x4ac1f7){logger[_0xb2fc('0xba')](_0xb2fc('0xbb'),_0x4ac1f7);});return _0x262b3b;})['then'](respondWithResult(_0x546a80,null))[_0xb2fc('0x2b')](handleError(_0x546a80,null));};exports['addAgents']=function(_0x8a6cdd,_0x435b10,_0x56b649){return db[_0xb2fc('0x40')][_0xb2fc('0x5a')]({'where':{'id':_0x8a6cdd[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x435b10,null))[_0xb2fc('0x21')](function(_0x2fafbe){if(_0x2fafbe){return _0x2fafbe[_0xb2fc('0xbc')](_0x8a6cdd[_0xb2fc('0x5c')][_0xb2fc('0x6c')],_['omit'](_0x8a6cdd['body'],[_0xb2fc('0x6c'),'id'])||{})[_0xb2fc('0xbd')](function(_0x14a4eb){for(var _0x416d1d=0x0;_0x416d1d<_0x8a6cdd[_0xb2fc('0x5c')][_0xb2fc('0x6c')]['length'];_0x416d1d+=0x1){socket['emit'](_0xb2fc('0xbe'),{'UserId':Number(_0x8a6cdd[_0xb2fc('0x5c')][_0xb2fc('0x6c')][_0x416d1d]),'FaxAccountId':Number(_0x8a6cdd[_0xb2fc('0x57')]['id'])});}return _0x14a4eb;});}})[_0xb2fc('0x21')](respondWithResult(_0x435b10,null))[_0xb2fc('0x2b')](handleError(_0x435b10,null));};exports[_0xb2fc('0xbf')]=function(_0x347b2d,_0x4e5ad8,_0x46be4a){return db[_0xb2fc('0x40')][_0xb2fc('0x5a')]({'where':{'id':_0x347b2d[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x4e5ad8,null))['then'](function(_0x23a634){if(_0x23a634){return _0x23a634[_0xb2fc('0xbf')](_0x347b2d[_0xb2fc('0x45')][_0xb2fc('0x6c')])[_0xb2fc('0x21')](function(){if(_['isArray'](_0x347b2d[_0xb2fc('0x45')]['ids'])){for(var _0x5560ed=0x0;_0x5560ed<_0x347b2d['query'][_0xb2fc('0x6c')][_0xb2fc('0x4a')];_0x5560ed+=0x1){socket['emit'](_0xb2fc('0xc0'),{'UserId':Number(_0x347b2d['query'][_0xb2fc('0x6c')][_0x5560ed]),'FaxAccountId':Number(_0x347b2d[_0xb2fc('0x57')]['id'])});}}else{socket[_0xb2fc('0xc1')](_0xb2fc('0xc0'),{'UserId':Number(_0x347b2d[_0xb2fc('0x45')][_0xb2fc('0x6c')]),'FaxAccountId':Number(_0x347b2d['params']['id'])});}});}})[_0xb2fc('0x21')](respondWithStatusCode(_0x4e5ad8,null))[_0xb2fc('0x2b')](handleError(_0x4e5ad8,null));};exports['getAgents']=function(_0x24efe7,_0x1b0e52,_0x220dff){var _0x96304d={};var _0x375e87={};var _0x39a014;var _0xd995ab;return db[_0xb2fc('0x40')][_0xb2fc('0x66')]({'where':{'id':_0x24efe7[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x1b0e52,null))['then'](function(_0x5abdac){if(_0x5abdac){_0x39a014=_0x5abdac;_0x375e87[_0xb2fc('0x44')]=_[_0xb2fc('0x46')](db[_0xb2fc('0xc2')][_0xb2fc('0x67')]);_0x375e87[_0xb2fc('0x45')]=_[_0xb2fc('0x46')](_0x24efe7[_0xb2fc('0x45')]);_0x375e87[_0xb2fc('0x4f')]=_[_0xb2fc('0x47')](_0x375e87[_0xb2fc('0x44')],_0x375e87[_0xb2fc('0x45')]);_0x96304d[_0xb2fc('0x49')]=_['intersection'](_0x375e87[_0xb2fc('0x44')],qs[_0xb2fc('0x48')](_0x24efe7[_0xb2fc('0x45')][_0xb2fc('0x48')]));_0x96304d[_0xb2fc('0x49')]=_0x96304d['attributes'][_0xb2fc('0x4a')]?_0x96304d[_0xb2fc('0x49')]:_0x375e87['model'];_0x96304d[_0xb2fc('0x68')]=qs[_0xb2fc('0x4d')](_0x24efe7[_0xb2fc('0x45')]['sort']);_0x96304d[_0xb2fc('0x4e')]=qs[_0xb2fc('0x4f')](_[_0xb2fc('0x50')](_0x24efe7[_0xb2fc('0x45')],_0x375e87[_0xb2fc('0x4f')]));if(_0x24efe7[_0xb2fc('0x45')][_0xb2fc('0x51')]){_0x96304d[_0xb2fc('0x4e')]=_[_0xb2fc('0x69')](_0x96304d[_0xb2fc('0x4e')],{'$or':_[_0xb2fc('0x3f')](_0x96304d[_0xb2fc('0x49')],function(_0x2fb541){var _0x43e4f4={};_0x43e4f4[_0x2fb541]={'$like':'%'+_0x24efe7[_0xb2fc('0x45')][_0xb2fc('0x51')]+'%'};return _0x43e4f4;})});}_0x96304d=_[_0xb2fc('0x69')]({},_0x96304d,_0x24efe7[_0xb2fc('0x52')]);return _0x39a014[_0xb2fc('0xc3')](_0x96304d);}})[_0xb2fc('0x21')](function(_0x1eb01c){if(_0x1eb01c){_0xd995ab=_0x1eb01c[_0xb2fc('0x4a')];if(!_0x24efe7[_0xb2fc('0x45')][_0xb2fc('0x4b')](_0xb2fc('0x4c'))){_0x96304d[_0xb2fc('0x32')]=qs[_0xb2fc('0x32')](_0x24efe7[_0xb2fc('0x45')]['limit']);_0x96304d[_0xb2fc('0x2f')]=qs[_0xb2fc('0x2f')](_0x24efe7[_0xb2fc('0x45')]['offset']);}return _0x39a014[_0xb2fc('0xc3')](_0x96304d);}})[_0xb2fc('0x21')](function(_0x68659a){if(_0x68659a){return _0x68659a?{'count':_0xd995ab,'rows':_0x68659a}:null;}})[_0xb2fc('0x21')](respondWithResult(_0x1b0e52,null))['catch'](handleError(_0x1b0e52,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 2cbdc27..7ed8867 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 _0x7d44=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','FaxAccount'];(function(_0x397545,_0x4612b){var _0x50c5d2=function(_0x548c00){while(--_0x548c00){_0x397545['push'](_0x397545['shift']());}};_0x50c5d2(++_0x4612b);}(_0x7d44,0xbc));var _0x47d4=function(_0x2d056f,_0x5e563a){_0x2d056f=_0x2d056f-0x0;var _0x2fcc53=_0x7d44[_0x2d056f];return _0x2fcc53;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0x47d4('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x47d4('0x1')](0x0);var events={'afterCreate':_0x47d4('0x2'),'afterUpdate':_0x47d4('0x3'),'afterDestroy':_0x47d4('0x4')};function emitEvent(_0x1a3cbf){return function(_0x193b47,_0x3a82c8,_0x3f73c1){FaxAccountEvents[_0x47d4('0x5')](_0x1a3cbf+':'+_0x193b47['id'],_0x193b47);FaxAccountEvents['emit'](_0x1a3cbf,_0x193b47);_0x3f73c1(null);};}for(var e in events){if(events[_0x47d4('0x6')](e)){var event=events[e];FaxAccount[_0x47d4('0x7')](e,emitEvent(event));}}module[_0x47d4('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x9dc7=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x8e8578,_0xd2a6b5){var _0x279605=function(_0x4b0347){while(--_0x4b0347){_0x8e8578['push'](_0x8e8578['shift']());}};_0x279605(++_0xd2a6b5);}(_0x9dc7,0x1b1));var _0x79dc=function(_0x490069,_0x362791){_0x490069=_0x490069-0x0;var _0x361d12=_0x9dc7[_0x490069];return _0x361d12;};'use strict';var EventEmitter=require(_0x79dc('0x0'));var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x79dc('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x79dc('0x2')};function emitEvent(_0x785001){return function(_0x473c7b,_0x23532e,_0x2dbb56){FaxAccountEvents[_0x79dc('0x3')](_0x785001+':'+_0x473c7b['id'],_0x473c7b);FaxAccountEvents[_0x79dc('0x3')](_0x785001,_0x473c7b);_0x2dbb56(null);};}for(var e in events){if(events[_0x79dc('0x4')](e)){var event=events[e];FaxAccount[_0x79dc('0x5')](e,emitEvent(event));}}module[_0x79dc('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 0b5c0d7..9727ced 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 _0xd37b=['api','moment','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd37b,0x17e));var _0xbd37=function(_0x57d9fe,_0x14f1e4){_0x57d9fe=_0x57d9fe-0x0;var _0x4b29e3=_0xd37b[_0x57d9fe];return _0x4b29e3;};'use strict';var _=require(_0xbd37('0x0'));var util=require(_0xbd37('0x1'));var logger=require('../../config/logger')(_0xbd37('0x2'));var moment=require(_0xbd37('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd37('0x4'));var fs=require('fs');var path=require(_0xbd37('0x5'));var rimraf=require(_0xbd37('0x6'));var config=require(_0xbd37('0x7'));var attributes=require(_0xbd37('0x8'));module['exports']=function(_0x136b94,_0xf73fa2){return _0x136b94[_0xbd37('0x9')](_0xbd37('0xa'),attributes,{'tableName':_0xbd37('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20b8=['fax_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','define','FaxAccount'];(function(_0x1efae1,_0xa90eb2){var _0x394c47=function(_0x3fad25){while(--_0x3fad25){_0x1efae1['push'](_0x1efae1['shift']());}};_0x394c47(++_0xa90eb2);}(_0x20b8,0x1ae));var _0x820b=function(_0x3d274e,_0x329874){_0x3d274e=_0x3d274e-0x0;var _0x4e73d8=_0x20b8[_0x3d274e];return _0x4e73d8;};'use strict';var _=require(_0x820b('0x0'));var util=require(_0x820b('0x1'));var logger=require(_0x820b('0x2'))('api');var moment=require(_0x820b('0x3'));var BPromise=require(_0x820b('0x4'));var rp=require(_0x820b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x820b('0x6'));var config=require(_0x820b('0x7'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0xa37aa1,_0x496c6e){return _0xa37aa1[_0x820b('0x8')](_0x820b('0x9'),attributes,{'tableName':_0x820b('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 f3b3f78..997f033 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 _0x9ae9=['account','CmList','List','Contacts','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','create','FaxInteraction','Contact\x20not\x20found','autoclose','push','length','close','unmanaged','created','interaction','FaxMessage','ContactId','UserId','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','FaxAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetFaxAccount','stringify','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','ListId','body','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9ae9,0x131));var _0x99ae=function(_0x2b5af8,_0x8ec596){_0x2b5af8=_0x2b5af8-0x0;var _0x4beaba=_0x9ae9[_0x2b5af8];return _0x4beaba;};'use strict';var _=require(_0x99ae('0x0'));var util=require('util');var moment=require(_0x99ae('0x1'));var BPromise=require('bluebird');var rs=require(_0x99ae('0x2'));var fs=require('fs');var Redis=require(_0x99ae('0x3'));var db=require(_0x99ae('0x4'))['db'];var utils=require(_0x99ae('0x5'));var logger=require(_0x99ae('0x6'))(_0x99ae('0x7'));var config=require(_0x99ae('0x8'));var jayson=require(_0x99ae('0x9'));var client=jayson[_0x99ae('0xa')]['http']({'port':0x232c});config['redis']=_[_0x99ae('0xb')](config[_0x99ae('0xc')],{'host':_0x99ae('0xd'),'port':0x18eb});var socket=require(_0x99ae('0xe'))(new Redis(config[_0x99ae('0xc')]));require(_0x99ae('0xf'))['register'](socket);function respondWithRpcPromise(_0x722d5a,_0x2e3f06,_0xb2b81b){return new BPromise(function(_0x568bc8,_0x20dbce){return client[_0x99ae('0x10')](_0x722d5a,_0xb2b81b)[_0x99ae('0x11')](function(_0x267336){logger[_0x99ae('0x12')](_0x99ae('0x13'),_0x2e3f06,_0x99ae('0x14'));logger[_0x99ae('0x15')](_0x99ae('0x16'),_0x2e3f06,_0x99ae('0x14'),JSON['stringify'](_0x267336));if(_0x267336[_0x99ae('0x17')]){if(_0x267336[_0x99ae('0x17')]['code']===0x1f4){logger['error'](_0x99ae('0x13'),_0x2e3f06,_0x267336[_0x99ae('0x17')]['message']);return _0x20dbce(_0x267336[_0x99ae('0x17')][_0x99ae('0x18')]);}logger[_0x99ae('0x17')]('FaxAccount,\x20%s,\x20%s',_0x2e3f06,_0x267336[_0x99ae('0x17')][_0x99ae('0x18')]);return _0x568bc8(_0x267336['error'][_0x99ae('0x18')]);}else{logger['info'](_0x99ae('0x13'),_0x2e3f06,_0x99ae('0x14'));_0x568bc8(_0x267336[_0x99ae('0x19')][_0x99ae('0x18')]);}})[_0x99ae('0x1a')](function(_0xafc976){logger[_0x99ae('0x17')](_0x99ae('0x13'),_0x2e3f06,_0xafc976);_0x20dbce(_0xafc976);});});}exports['GetFaxAccount']=function(_0x37a794){var _0x24775b=this;return new Promise(function(_0x4a3af9,_0x43c04f){return db[_0x99ae('0x1b')][_0x99ae('0x1c')]({'raw':_0x37a794[_0x99ae('0x1d')]?_0x37a794['options'][_0x99ae('0x1e')]===undefined?!![]:![]:!![],'where':_0x37a794[_0x99ae('0x1d')]?_0x37a794['options'][_0x99ae('0x1f')]||null:null,'attributes':_0x37a794[_0x99ae('0x1d')]?_0x37a794['options'][_0x99ae('0x20')]||null:null,'limit':_0x37a794[_0x99ae('0x1d')]?_0x37a794['options'][_0x99ae('0x21')]||null:null,'include':_0x37a794[_0x99ae('0x1d')]?_0x37a794['options'][_0x99ae('0x22')]?_['map'](_0x37a794[_0x99ae('0x1d')][_0x99ae('0x22')],function(_0x588c1d){return{'model':db[_0x588c1d[_0x99ae('0x23')]],'as':_0x588c1d['as'],'attributes':_0x588c1d[_0x99ae('0x20')],'include':_0x588c1d['include']?_[_0x99ae('0x24')](_0x588c1d['include'],function(_0x5e150c){return{'model':db[_0x5e150c[_0x99ae('0x23')]],'as':_0x5e150c['as'],'attributes':_0x5e150c[_0x99ae('0x20')],'include':_0x5e150c[_0x99ae('0x22')]?_[_0x99ae('0x24')](_0x5e150c['include'],function(_0x2eb811){return{'model':db[_0x2eb811[_0x99ae('0x23')]],'as':_0x2eb811['as'],'attributes':_0x2eb811['attributes']};}):[]};}):[]};}):[]:[]})[_0x99ae('0x11')](function(_0x3b6aff){logger[_0x99ae('0x12')](_0x99ae('0x25'),_0x37a794);logger[_0x99ae('0x15')](_0x99ae('0x25'),_0x37a794,JSON[_0x99ae('0x26')](_0x3b6aff));_0x4a3af9(_0x3b6aff);})[_0x99ae('0x1a')](function(_0x3f3eda){logger[_0x99ae('0x17')]('GetFaxAccount',_0x3f3eda['message'],_0x37a794);_0x43c04f(_0x24775b[_0x99ae('0x17')](0x1f4,_0x3f3eda['message']));});});};exports[_0x99ae('0x27')]=function(_0x5a5c39,_0x5dbef5,_0x184ddf){var _0x3db2d6=this;return new Promise(function(_0x3e53e4,_0x3e605a){var _0x715710={'body':_0x5a5c39['body'],'channel':_0x99ae('0x28')};var _0xc466e8=[];var _0x59b4c4=[];var _0x2ba8e1={};return db[_0x99ae('0x29')][_0x99ae('0x2a')]()[_0x99ae('0x11')](function(_0x9e09c5){if(!_0x9e09c5){throw new db[(_0x99ae('0x2b'))][(_0x99ae('0x2c'))]('no\x20available\x20attributes');}_0xc466e8=_[_0x99ae('0x2d')](_[_0x99ae('0x2e')](_0x9e09c5),[_0x99ae('0x2f'),_0x99ae('0x30')]);_0x59b4c4=_[_0x99ae('0x2d')](_[_0x99ae('0x2e')](_0x9e09c5),[_0x99ae('0x2f'),_0x99ae('0x30'),'CompanyId',_0x99ae('0x31')]);if(_0x5a5c39[_0x99ae('0x32')]['id']){delete _0x5a5c39['body']['id'];}if(_[_0x99ae('0x33')](_0x5a5c39[_0x99ae('0x32')][_0x99ae('0x34')])){throw new db[(_0x99ae('0x2b'))][(_0x99ae('0x2c'))]('from\x20is\x20mandatory');}if(_[_0x99ae('0x33')](_0x5a5c39['body']['body'])||_0x5a5c39[_0x99ae('0x32')][_0x99ae('0x32')]===''){throw new db[(_0x99ae('0x2b'))]['ValidationError'](_0x99ae('0x35'));}if(_['isNil'](_0x5a5c39[_0x99ae('0x32')][_0x99ae('0x36')])){throw new db[(_0x99ae('0x2b'))]['ValidationError'](_0x99ae('0x37')+_0x59b4c4);}if(!_[_0x99ae('0x38')](_0x59b4c4,_0x5a5c39['body'][_0x99ae('0x36')])){throw new db['Sequelize'][(_0x99ae('0x2c'))](_0x99ae('0x39')+_0x59b4c4);}_0x2ba8e1[_0x5a5c39[_0x99ae('0x32')][_0x99ae('0x36')]]=_0x5a5c39[_0x99ae('0x32')][_0x99ae('0x34')];})[_0x99ae('0x11')](function(){return db[_0x99ae('0x1b')][_0x99ae('0x3a')]({'where':{'id':_0x5a5c39[_0x99ae('0x3b')]['id']},'include':[{'model':db[_0x99ae('0x3c')],'as':_0x99ae('0x3d'),'include':[{'model':db[_0x99ae('0x29')],'as':_0x99ae('0x3e'),'where':_0x2ba8e1,'limit':0x1,'order':[[_0x99ae('0x30'),'DESC']]}]},{'model':db[_0x99ae('0x3f')],'as':_0x99ae('0x40')}]});})[_0x99ae('0x11')](function(_0x1b8b67){if(_0x1b8b67&&_0x1b8b67['List']){var _0x3694df=_0x1b8b67[_0x99ae('0x41')]({'plain':!![]});_0x715710[_0x99ae('0x3b')]=_0x3694df;_0x715710[_0x99ae('0x42')]=_0x3694df[_0x99ae('0x40')];_0x715710[_0x99ae('0x43')]=_0x3694df[_0x99ae('0x3d')];_0x715710[_0x99ae('0x42')]=_[_0x99ae('0x44')](_0x715710[_0x99ae('0x42')],[_0x99ae('0x45')],[_0x99ae('0x46')]);if(_0x715710[_0x99ae('0x3b')][_0x99ae('0x40')]){delete _0x715710['account'][_0x99ae('0x40')];}if(_0x715710[_0x99ae('0x3b')]['List']&&_0x715710[_0x99ae('0x3b')][_0x99ae('0x3d')][_0x99ae('0x3e')]['length']){return _0x715710[_0x99ae('0x3b')][_0x99ae('0x3d')][_0x99ae('0x3e')][0x0];}var _0x387ed0=_[_0x99ae('0xb')](_0x5a5c39[_0x99ae('0x32')],{'firstName':_0x5a5c39[_0x99ae('0x32')][_0x99ae('0x34')],'ListId':_0x3694df[_0x99ae('0x31')]});_0x387ed0[_0x5a5c39['body'][_0x99ae('0x36')]]=_0x5a5c39[_0x99ae('0x32')]['from'];return db['CmContact'][_0x99ae('0x47')](_0x387ed0,{'fields':_0xc466e8,'raw':!![]});}})['then'](function(_0x4d00c3){_0x715710['contact']=_0x4d00c3;if(_0x4d00c3){var _0x35ff96={'ContactId':_0x4d00c3['id'],'FaxAccountId':_0x5a5c39[_0x99ae('0x3b')]['id'],'fax':_0x4d00c3[_0x99ae('0x28')]};return db['FaxInteraction'][_0x99ae('0x3a')]({'where':{'ContactId':_0x4d00c3['id'],'closed':![],'FaxAccountId':_0x5a5c39[_0x99ae('0x3b')]['id']}})[_0x99ae('0x11')](function(_0x40625c){if(_0x40625c){return[_0x40625c,![]];}return db[_0x99ae('0x48')][_0x99ae('0x47')](_0x35ff96)[_0x99ae('0x11')](function(_0xb1d671){return[_0xb1d671,!![]];});});}else{throw new Error(_0x99ae('0x49'));}})['spread'](function(_0x4399da,_0x40e3a8){var _0x931655=_0x4399da['get']({'plain':!![]});if(_0x40e3a8){if(_0x715710[_0x99ae('0x3b')][_0x99ae('0x4a')]){_0x715710[_0x99ae('0x42')][_0x99ae('0x4b')]({'id':0x0,'priority':_0x715710[_0x99ae('0x42')][_0x99ae('0x4c')]+0x1,'app':_0x99ae('0x4d'),'appdata':_0x99ae('0x4e'),'interval':'*,*,*,*'});}_0x931655[_0x99ae('0x4f')]=!![];}else{_0x931655[_0x99ae('0x4f')]=![];}_0x715710[_0x99ae('0x50')]=_0x931655;return db[_0x99ae('0x51')][_0x99ae('0x47')]({'body':_0x5a5c39[_0x99ae('0x32')]['body'],'FaxAccountId':_0x5a5c39[_0x99ae('0x3b')]['id'],'FaxInteractionId':_0x4399da['id'],'direction':'in','ContactId':_0x4399da[_0x99ae('0x52')],'AttachmentId':_0x5a5c39[_0x99ae('0x32')]['AttachmentId']});})[_0x99ae('0x11')](function(_0x2b76e0){_0x715710[_0x99ae('0x18')]=_0x2b76e0;if(_0x715710[_0x99ae('0x50')][_0x99ae('0x53')]){return db['User'][_0x99ae('0x3a')]({'attributes':['id',_0x99ae('0x54')],'where':{'id':_0x715710[_0x99ae('0x50')][_0x99ae('0x53')]}})[_0x99ae('0x11')](function(_0x24782a){if(_0x24782a){_0x715710[_0x99ae('0x42')][_0x99ae('0x55')]({'id':0x0,'priority':0x0,'app':_0x99ae('0x56'),'appdata':_0x24782a[_0x99ae('0x54')]+','+(_0x715710[_0x99ae('0x3b')][_0x99ae('0x57')]||0xa),'interval':_0x99ae('0x58')});}return respondWithRpcPromise(_0x99ae('0x59'),_0x99ae('0x5a'),_0x715710);});}return respondWithRpcPromise('Start','startRouting',_0x715710);})[_0x99ae('0x11')](function(_0x542a4){_0x3e53e4(_0x542a4);})[_0x99ae('0x1a')](function(_0x48a4cc){_0x3e605a(_0x3db2d6[_0x99ae('0x17')](0x1f4,_0x48a4cc['message']));});});}; \ No newline at end of file +var _0xa2af=['length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFaxAccount','findAll','options','raw','attributes','include','model','map','then','debug','stringify','NotifyFaxAccount','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','ValidationError','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','CmContact','Contacts','DESC','FaxApplication','Applications','get','account','applications','list','orderBy','priority','asc'];(function(_0x523c93,_0x3258be){var _0x1d2d7f=function(_0x572da1){while(--_0x572da1){_0x523c93['push'](_0x523c93['shift']());}};_0x1d2d7f(++_0x3258be);}(_0xa2af,0x1c8));var _0xfa2a=function(_0x3dc46d,_0x1790d0){_0x3dc46d=_0x3dc46d-0x0;var _0x47bca8=_0xa2af[_0x3dc46d];return _0x47bca8;};'use strict';var _=require('lodash');var util=require(_0xfa2a('0x0'));var moment=require(_0xfa2a('0x1'));var BPromise=require(_0xfa2a('0x2'));var rs=require(_0xfa2a('0x3'));var fs=require('fs');var Redis=require(_0xfa2a('0x4'));var db=require(_0xfa2a('0x5'))['db'];var utils=require(_0xfa2a('0x6'));var logger=require(_0xfa2a('0x7'))(_0xfa2a('0x8'));var config=require(_0xfa2a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfa2a('0xa')][_0xfa2a('0xb')]({'port':0x232c});config[_0xfa2a('0xc')]=_[_0xfa2a('0xd')](config[_0xfa2a('0xc')],{'host':_0xfa2a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0xedbfe0,_0x325889,_0x3394a8){return new BPromise(function(_0x94a1c6,_0x24ba7e){return client['request'](_0xedbfe0,_0x3394a8)['then'](function(_0x4b4d7c){logger[_0xfa2a('0xf')](_0xfa2a('0x10'),_0x325889,_0xfa2a('0x11'));logger['debug'](_0xfa2a('0x12'),_0x325889,'request\x20sent',JSON['stringify'](_0x4b4d7c));if(_0x4b4d7c['error']){if(_0x4b4d7c[_0xfa2a('0x13')]['code']===0x1f4){logger[_0xfa2a('0x13')]('FaxAccount,\x20%s,\x20%s',_0x325889,_0x4b4d7c['error'][_0xfa2a('0x14')]);return _0x24ba7e(_0x4b4d7c[_0xfa2a('0x13')][_0xfa2a('0x14')]);}logger[_0xfa2a('0x13')](_0xfa2a('0x10'),_0x325889,_0x4b4d7c[_0xfa2a('0x13')][_0xfa2a('0x14')]);return _0x94a1c6(_0x4b4d7c['error'][_0xfa2a('0x14')]);}else{logger[_0xfa2a('0xf')]('FaxAccount,\x20%s,\x20%s',_0x325889,_0xfa2a('0x11'));_0x94a1c6(_0x4b4d7c[_0xfa2a('0x15')]['message']);}})[_0xfa2a('0x16')](function(_0x5a6c75){logger[_0xfa2a('0x13')](_0xfa2a('0x10'),_0x325889,_0x5a6c75);_0x24ba7e(_0x5a6c75);});});}exports[_0xfa2a('0x17')]=function(_0x36d750){var _0x30fddf=this;return new Promise(function(_0x29bc21,_0x32eb3b){return db['FaxAccount'][_0xfa2a('0x18')]({'raw':_0x36d750[_0xfa2a('0x19')]?_0x36d750[_0xfa2a('0x19')][_0xfa2a('0x1a')]===undefined?!![]:![]:!![],'where':_0x36d750[_0xfa2a('0x19')]?_0x36d750['options']['where']||null:null,'attributes':_0x36d750[_0xfa2a('0x19')]?_0x36d750[_0xfa2a('0x19')][_0xfa2a('0x1b')]||null:null,'limit':_0x36d750[_0xfa2a('0x19')]?_0x36d750[_0xfa2a('0x19')]['limit']||null:null,'include':_0x36d750[_0xfa2a('0x19')]?_0x36d750[_0xfa2a('0x19')][_0xfa2a('0x1c')]?_['map'](_0x36d750[_0xfa2a('0x19')][_0xfa2a('0x1c')],function(_0x214eb6){return{'model':db[_0x214eb6[_0xfa2a('0x1d')]],'as':_0x214eb6['as'],'attributes':_0x214eb6[_0xfa2a('0x1b')],'include':_0x214eb6[_0xfa2a('0x1c')]?_['map'](_0x214eb6[_0xfa2a('0x1c')],function(_0x5112ee){return{'model':db[_0x5112ee[_0xfa2a('0x1d')]],'as':_0x5112ee['as'],'attributes':_0x5112ee[_0xfa2a('0x1b')],'include':_0x5112ee['include']?_[_0xfa2a('0x1e')](_0x5112ee[_0xfa2a('0x1c')],function(_0x70a472){return{'model':db[_0x70a472[_0xfa2a('0x1d')]],'as':_0x70a472['as'],'attributes':_0x70a472[_0xfa2a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfa2a('0x1f')](function(_0x302d8b){logger[_0xfa2a('0xf')](_0xfa2a('0x17'),_0x36d750);logger[_0xfa2a('0x20')](_0xfa2a('0x17'),_0x36d750,JSON[_0xfa2a('0x21')](_0x302d8b));_0x29bc21(_0x302d8b);})['catch'](function(_0x336c8f){logger[_0xfa2a('0x13')]('GetFaxAccount',_0x336c8f[_0xfa2a('0x14')],_0x36d750);_0x32eb3b(_0x30fddf[_0xfa2a('0x13')](0x1f4,_0x336c8f['message']));});});};exports[_0xfa2a('0x22')]=function(_0x2118e6,_0x2843ad,_0x5183cb){var _0x3310d3=this;return new Promise(function(_0x47923a,_0x4a388c){var _0x257358={'body':_0x2118e6['body'],'channel':'fax'};var _0x2e025f=[];var _0x554981=[];var _0x4314d0={};return db['CmContact'][_0xfa2a('0x23')]()['then'](function(_0x3102fc){if(!_0x3102fc){throw new db[(_0xfa2a('0x24'))]['ValidationError'](_0xfa2a('0x25'));}_0x2e025f=_[_0xfa2a('0x26')](_[_0xfa2a('0x27')](_0x3102fc),[_0xfa2a('0x28'),_0xfa2a('0x29')]);_0x554981=_['difference'](_['keys'](_0x3102fc),['createdAt',_0xfa2a('0x29'),_0xfa2a('0x2a'),_0xfa2a('0x2b')]);if(_0x2118e6[_0xfa2a('0x2c')]['id']){delete _0x2118e6[_0xfa2a('0x2c')]['id'];}if(_[_0xfa2a('0x2d')](_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x2e')])){throw new db[(_0xfa2a('0x24'))][(_0xfa2a('0x2f'))]('from\x20is\x20mandatory');}if(_[_0xfa2a('0x2d')](_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x2c')])||_0x2118e6[_0xfa2a('0x2c')]['body']===''){throw new db['Sequelize'][(_0xfa2a('0x2f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xfa2a('0x2d')](_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x30')])){throw new db[(_0xfa2a('0x24'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x554981);}if(!_[_0xfa2a('0x31')](_0x554981,_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x30')])){throw new db[(_0xfa2a('0x24'))][(_0xfa2a('0x2f'))](_0xfa2a('0x32')+_0x554981);}_0x4314d0[_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x30')]]=_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x2e')];})[_0xfa2a('0x1f')](function(){return db['FaxAccount'][_0xfa2a('0x33')]({'where':{'id':_0x2118e6['account']['id']},'include':[{'model':db[_0xfa2a('0x34')],'as':_0xfa2a('0x35'),'include':[{'model':db[_0xfa2a('0x36')],'as':_0xfa2a('0x37'),'where':_0x4314d0,'limit':0x1,'order':[[_0xfa2a('0x29'),_0xfa2a('0x38')]]}]},{'model':db[_0xfa2a('0x39')],'as':_0xfa2a('0x3a')}]});})['then'](function(_0x360e81){if(_0x360e81&&_0x360e81['List']){var _0x5807b4=_0x360e81[_0xfa2a('0x3b')]({'plain':!![]});_0x257358[_0xfa2a('0x3c')]=_0x5807b4;_0x257358[_0xfa2a('0x3d')]=_0x5807b4[_0xfa2a('0x3a')];_0x257358[_0xfa2a('0x3e')]=_0x5807b4[_0xfa2a('0x35')];_0x257358[_0xfa2a('0x3d')]=_[_0xfa2a('0x3f')](_0x257358['applications'],[_0xfa2a('0x40')],[_0xfa2a('0x41')]);if(_0x257358[_0xfa2a('0x3c')]['Applications']){delete _0x257358['account'][_0xfa2a('0x3a')];}if(_0x257358[_0xfa2a('0x3c')][_0xfa2a('0x35')]&&_0x257358[_0xfa2a('0x3c')]['List']['Contacts'][_0xfa2a('0x42')]){return _0x257358['account'][_0xfa2a('0x35')][_0xfa2a('0x37')][0x0];}var _0x5b2188=_[_0xfa2a('0xd')](_0x2118e6[_0xfa2a('0x2c')],{'firstName':_0x2118e6[_0xfa2a('0x2c')]['from'],'ListId':_0x5807b4[_0xfa2a('0x2b')]});_0x5b2188[_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x30')]]=_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x2e')];return db[_0xfa2a('0x36')][_0xfa2a('0x43')](_0x5b2188,{'fields':_0x2e025f,'raw':!![]});}})[_0xfa2a('0x1f')](function(_0x34e15d){_0x257358[_0xfa2a('0x44')]=_0x34e15d;if(_0x34e15d){var _0x7a821d={'ContactId':_0x34e15d['id'],'FaxAccountId':_0x2118e6[_0xfa2a('0x3c')]['id'],'fax':_0x34e15d['fax']};return db['FaxInteraction'][_0xfa2a('0x33')]({'where':{'ContactId':_0x34e15d['id'],'closed':![],'FaxAccountId':_0x2118e6[_0xfa2a('0x3c')]['id']}})[_0xfa2a('0x1f')](function(_0x2906bd){if(_0x2906bd){return[_0x2906bd,![]];}return db[_0xfa2a('0x45')][_0xfa2a('0x43')](_0x7a821d)[_0xfa2a('0x1f')](function(_0x54759c){return[_0x54759c,!![]];});});}else{throw new Error(_0xfa2a('0x46'));}})[_0xfa2a('0x47')](function(_0x4723bd,_0x3314e5){var _0x567459=_0x4723bd[_0xfa2a('0x3b')]({'plain':!![]});if(_0x3314e5){if(_0x257358[_0xfa2a('0x3c')]['autoclose']){_0x257358[_0xfa2a('0x3d')]['push']({'id':0x0,'priority':_0x257358[_0xfa2a('0x3d')]['length']+0x1,'app':_0xfa2a('0x48'),'appdata':_0xfa2a('0x49'),'interval':_0xfa2a('0x4a')});}_0x567459[_0xfa2a('0x4b')]=!![];}else{_0x567459[_0xfa2a('0x4b')]=![];}_0x257358[_0xfa2a('0x4c')]=_0x567459;return db[_0xfa2a('0x4d')][_0xfa2a('0x43')]({'body':_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x2c')],'FaxAccountId':_0x2118e6[_0xfa2a('0x3c')]['id'],'FaxInteractionId':_0x4723bd['id'],'direction':'in','ContactId':_0x4723bd[_0xfa2a('0x4e')],'AttachmentId':_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x4f')]});})[_0xfa2a('0x1f')](function(_0x542322){_0x257358[_0xfa2a('0x14')]=_0x542322;if(_0x257358[_0xfa2a('0x4c')][_0xfa2a('0x50')]){return db[_0xfa2a('0x51')][_0xfa2a('0x33')]({'attributes':['id',_0xfa2a('0x52')],'where':{'id':_0x257358[_0xfa2a('0x4c')][_0xfa2a('0x50')]}})[_0xfa2a('0x1f')](function(_0x5972ad){if(_0x5972ad){_0x257358[_0xfa2a('0x3d')][_0xfa2a('0x53')]({'id':0x0,'priority':0x0,'app':_0xfa2a('0x54'),'appdata':_0x5972ad[_0xfa2a('0x52')]+','+(_0x257358['account']['waitForTheAssignedAgent']||0xa),'interval':_0xfa2a('0x4a')});}return respondWithRpcPromise(_0xfa2a('0x55'),_0xfa2a('0x56'),_0x257358);});}return respondWithRpcPromise(_0xfa2a('0x55'),_0xfa2a('0x56'),_0x257358);})[_0xfa2a('0x1f')](function(_0x3ac8cc){_0x47923a(_0x3ac8cc);})[_0xfa2a('0x16')](function(_0x101eb1){_0x4a388c(_0x3310d3['error'](0x1f4,_0x101eb1[_0xfa2a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index a6c00b5..1a94438 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 _0x63a1=['emit','register','./faxAccount.events','save'];(function(_0x24affb,_0x1a6410){var _0x2cf3da=function(_0x32a985){while(--_0x32a985){_0x24affb['push'](_0x24affb['shift']());}};_0x2cf3da(++_0x1a6410);}(_0x63a1,0x162));var _0x163a=function(_0xf1d580,_0x31d097){_0xf1d580=_0xf1d580-0x0;var _0x4d764e=_0x63a1[_0xf1d580];return _0x4d764e;};'use strict';var FaxAccountEvents=require(_0x163a('0x0'));var events=[_0x163a('0x1'),'remove','update'];function createListener(_0x577993,_0x27f9e0){return function(_0x402212){_0x27f9e0[_0x163a('0x2')](_0x577993,_0x402212);};}function removeListener(_0x242272,_0x176bd6){return function(){FaxAccountEvents['removeListener'](_0x242272,_0x176bd6);};}exports[_0x163a('0x3')]=function(_0x3c12ab){for(var _0x37bd29=0x0,_0x3d08e3=events['length'];_0x37bd29<_0x3d08e3;_0x37bd29++){var _0x111721=events[_0x37bd29];var _0x2f74a8=createListener('faxAccount:'+_0x111721,_0x3c12ab);FaxAccountEvents['on'](_0x111721,_0x2f74a8);}}; \ No newline at end of file +var _0x3416=['removeListener','register','./faxAccount.events','save','remove','update','emit'];(function(_0x3017e8,_0x26bd0e){var _0x396032=function(_0x5b3670){while(--_0x5b3670){_0x3017e8['push'](_0x3017e8['shift']());}};_0x396032(++_0x26bd0e);}(_0x3416,0xf0));var _0x6341=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0x3416[_0x29c3b2];return _0x4b3aa7;};'use strict';var FaxAccountEvents=require(_0x6341('0x0'));var events=[_0x6341('0x1'),_0x6341('0x2'),_0x6341('0x3')];function createListener(_0x756ded,_0x489c95){return function(_0x24fd0b){_0x489c95[_0x6341('0x4')](_0x756ded,_0x24fd0b);};}function removeListener(_0x1b6246,_0x132313){return function(){FaxAccountEvents[_0x6341('0x5')](_0x1b6246,_0x132313);};}exports[_0x6341('0x6')]=function(_0x706bcf){for(var _0x3c99ba=0x0,_0x44d525=events['length'];_0x3c99ba<_0x44d525;_0x3c99ba++){var _0x4d3add=events[_0x3c99ba];var _0x2f3a48=createListener('faxAccount:'+_0x4d3add,_0x706bcf);FaxAccountEvents['on'](_0x4d3add,_0x2f3a48);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 674ae4b..cb1e992 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x521d4a,_0x587a93){var _0x1f487e=function(_0xe284a7){while(--_0xe284a7){_0x521d4a['push'](_0x521d4a['shift']());}};_0x1f487e(++_0x587a93);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x648319,_0x464339){var _0x50f646=function(_0x547523){while(--_0x547523){_0x648319['push'](_0x648319['shift']());}};_0x50f646(++_0x464339);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 19c56ad..18e73a8 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 _0x8898=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x3f2ad0,_0x10d42b){var _0x5a9b8d=function(_0x35f32b){while(--_0x35f32b){_0x3f2ad0['push'](_0x3f2ad0['shift']());}};_0x5a9b8d(++_0x10d42b);}(_0x8898,0x135));var _0x8889=function(_0x3cf915,_0xec2ff0){_0x3cf915=_0x3cf915-0x0;var _0x5f53be=_0x8898[_0x3cf915];return _0x5f53be;};'use strict';var Sequelize=require(_0x8889('0x0'));module[_0x8889('0x1')]={'priority':{'type':Sequelize[_0x8889('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8889('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8889('0x4')]()},'description':{'type':Sequelize[_0x8889('0x3')]},'interval':{'type':Sequelize[_0x8889('0x3')],'defaultValue':_0x8889('0x5')}}; \ No newline at end of file +var _0x34f0=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1b2cf7,_0x8b25e2){var _0x5471c6=function(_0x54f4ac){while(--_0x54f4ac){_0x1b2cf7['push'](_0x1b2cf7['shift']());}};_0x5471c6(++_0x8b25e2);}(_0x34f0,0x1be));var _0x034f=function(_0x1b519e,_0x439a87){_0x1b519e=_0x1b519e-0x0;var _0x1f03d4=_0x34f0[_0x1b519e];return _0x1f03d4;};'use strict';var Sequelize=require(_0x034f('0x0'));module[_0x034f('0x1')]={'priority':{'type':Sequelize[_0x034f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x034f('0x3')],'allowNull':![],'defaultValue':_0x034f('0x4')},'appdata':{'type':Sequelize[_0x034f('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x034f('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index e429892..4586c2c 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 _0x8ae5=['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','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','stack','name','index','map','FaxApplication','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0xacf8c,_0x1d484b){var _0x21fd7b=function(_0x10b1bf){while(--_0x10b1bf){_0xacf8c['push'](_0xacf8c['shift']());}};_0x21fd7b(++_0x1d484b);}(_0x8ae5,0x90));var _0x58ae=function(_0xad7608,_0x5c9478){_0xad7608=_0xad7608-0x0;var _0x1b0261=_0x8ae5[_0xad7608];return _0x1b0261;};'use strict';var emlformat=require(_0x58ae('0x0'));var rimraf=require(_0x58ae('0x1'));var zipdir=require(_0x58ae('0x2'));var jsonpatch=require(_0x58ae('0x3'));var rp=require(_0x58ae('0x4'));var moment=require(_0x58ae('0x5'));var BPromise=require(_0x58ae('0x6'));var Mustache=require(_0x58ae('0x7'));var util=require(_0x58ae('0x8'));var path=require(_0x58ae('0x9'));var sox=require(_0x58ae('0xa'));var csv=require(_0x58ae('0xb'));var ejs=require(_0x58ae('0xc'));var fs=require('fs');var fs_extra=require(_0x58ae('0xd'));var _=require(_0x58ae('0xe'));var squel=require(_0x58ae('0xf'));var crypto=require('crypto');var jsforce=require(_0x58ae('0x10'));var deskjs=require(_0x58ae('0x11'));var toCsv=require(_0x58ae('0xb'));var querystring=require(_0x58ae('0x12'));var Papa=require(_0x58ae('0x13'));var Redis=require(_0x58ae('0x14'));var authService=require(_0x58ae('0x15'));var qs=require(_0x58ae('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x58ae('0x17'));var logger=require('../../config/logger')(_0x58ae('0x18'));var utils=require(_0x58ae('0x19'));var config=require(_0x58ae('0x1a'));var licenseUtil=require(_0x58ae('0x1b'));var db=require(_0x58ae('0x1c'))['db'];function respondWithStatusCode(_0x5dae06,_0x116b17){_0x116b17=_0x116b17||0xcc;return function(_0x2862f1){if(_0x2862f1){return _0x5dae06[_0x58ae('0x1d')](_0x116b17);}return _0x5dae06[_0x58ae('0x1e')](_0x116b17)[_0x58ae('0x1f')]();};}function respondWithResult(_0x26b980,_0x39faea){_0x39faea=_0x39faea||0xc8;return function(_0x2dead9){if(_0x2dead9){return _0x26b980[_0x58ae('0x1e')](_0x39faea)[_0x58ae('0x20')](_0x2dead9);}};}function respondWithFilteredResult(_0x59bc7f,_0xbb7dbd){return function(_0x171790){if(_0x171790){var _0x342072=typeof _0xbb7dbd[_0x58ae('0x21')]===_0x58ae('0x22')&&typeof _0xbb7dbd[_0x58ae('0x23')]==='undefined';var _0x16b17=_0x171790['count'];var _0x47c7ca=_0x342072?0x0:_0xbb7dbd[_0x58ae('0x21')];var _0x5b5d06=_0x342072?_0x171790[_0x58ae('0x24')]:_0xbb7dbd[_0x58ae('0x21')]+_0xbb7dbd[_0x58ae('0x23')];var _0x291ff4;if(_0x5b5d06>=_0x16b17){_0x5b5d06=_0x16b17;_0x291ff4=0xc8;}else{_0x291ff4=0xce;}_0x59bc7f[_0x58ae('0x1e')](_0x291ff4);return _0x59bc7f[_0x58ae('0x25')](_0x58ae('0x26'),_0x47c7ca+'-'+_0x5b5d06+'/'+_0x16b17)[_0x58ae('0x20')](_0x171790);}return null;};}function patchUpdates(_0x3eec4e){return function(_0x396ab1){try{jsonpatch[_0x58ae('0x27')](_0x396ab1,_0x3eec4e,!![]);}catch(_0x36a46e){return BPromise[_0x58ae('0x28')](_0x36a46e);}return _0x396ab1['save']();};}function saveUpdates(_0x131051,_0x5584c2){return function(_0x13a6bb){if(_0x13a6bb){return _0x13a6bb[_0x58ae('0x29')](_0x131051)[_0x58ae('0x2a')](function(_0x2d70fa){return _0x2d70fa;});}return null;};}function removeEntity(_0x424df3,_0x2292df){return function(_0xbbb929){if(_0xbbb929){return _0xbbb929['destroy']()[_0x58ae('0x2a')](function(){_0x424df3[_0x58ae('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3796e5,_0x1a8fd2){return function(_0x163328){if(!_0x163328){_0x3796e5[_0x58ae('0x1d')](0x194);}return _0x163328;};}function handleError(_0x4cba2f,_0x3d9ee3){_0x3d9ee3=_0x3d9ee3||0x1f4;return function(_0xefe08f){logger['error'](_0xefe08f[_0x58ae('0x2b')]);if(_0xefe08f[_0x58ae('0x2c')]){delete _0xefe08f[_0x58ae('0x2c')];}_0x4cba2f['status'](_0x3d9ee3)['send'](_0xefe08f);};}exports[_0x58ae('0x2d')]=function(_0x3eda5b,_0x11473c){var _0x507011={},_0x30aec2={},_0x5427d4={'count':0x0,'rows':[]};var _0x1a2e91=_[_0x58ae('0x2e')](db[_0x58ae('0x2f')][_0x58ae('0x30')],function(_0x2a58cb){return{'name':_0x2a58cb[_0x58ae('0x31')],'type':_0x2a58cb['type'][_0x58ae('0x32')]};});_0x30aec2['model']=_[_0x58ae('0x2e')](_0x1a2e91,_0x58ae('0x2c'));_0x30aec2[_0x58ae('0x33')]=_[_0x58ae('0x34')](_0x3eda5b[_0x58ae('0x33')]);_0x30aec2['filters']=_[_0x58ae('0x35')](_0x30aec2[_0x58ae('0x36')],_0x30aec2[_0x58ae('0x33')]);_0x507011[_0x58ae('0x37')]=_[_0x58ae('0x35')](_0x30aec2['model'],qs[_0x58ae('0x38')](_0x3eda5b[_0x58ae('0x33')][_0x58ae('0x38')]));_0x507011[_0x58ae('0x37')]=_0x507011[_0x58ae('0x37')][_0x58ae('0x39')]?_0x507011['attributes']:_0x30aec2['model'];if(!_0x3eda5b[_0x58ae('0x33')][_0x58ae('0x3a')](_0x58ae('0x3b'))){_0x507011[_0x58ae('0x23')]=qs[_0x58ae('0x23')](_0x3eda5b[_0x58ae('0x33')][_0x58ae('0x23')]);_0x507011['offset']=qs[_0x58ae('0x21')](_0x3eda5b[_0x58ae('0x33')][_0x58ae('0x21')]);}_0x507011[_0x58ae('0x3c')]=qs[_0x58ae('0x3d')](_0x3eda5b[_0x58ae('0x33')][_0x58ae('0x3d')]);_0x507011[_0x58ae('0x3e')]=qs['filters'](_['pick'](_0x3eda5b['query'],_0x30aec2[_0x58ae('0x3f')]),_0x1a2e91);if(_0x3eda5b['query'][_0x58ae('0x40')]){_0x507011[_0x58ae('0x3e')]=_[_0x58ae('0x41')](_0x507011[_0x58ae('0x3e')],{'$or':_[_0x58ae('0x2e')](_0x1a2e91,function(_0x2fd095){if(_0x2fd095[_0x58ae('0x42')]!==_0x58ae('0x43')){var _0x584700={};_0x584700[_0x2fd095['name']]={'$like':'%'+_0x3eda5b[_0x58ae('0x33')][_0x58ae('0x40')]+'%'};return _0x584700;}})});}_0x507011=_[_0x58ae('0x41')]({},_0x507011,_0x3eda5b['options']);var _0x465537={'where':_0x507011[_0x58ae('0x3e')]};return db[_0x58ae('0x2f')][_0x58ae('0x24')](_0x465537)[_0x58ae('0x2a')](function(_0x2a631c){_0x5427d4[_0x58ae('0x24')]=_0x2a631c;if(_0x3eda5b['query']['includeAll']){_0x507011[_0x58ae('0x44')]=[{'all':!![]}];}return db[_0x58ae('0x2f')][_0x58ae('0x45')](_0x507011);})[_0x58ae('0x2a')](function(_0x343496){_0x5427d4[_0x58ae('0x46')]=_0x343496;return _0x5427d4;})[_0x58ae('0x2a')](respondWithFilteredResult(_0x11473c,_0x507011))['catch'](handleError(_0x11473c,null));};exports[_0x58ae('0x47')]=function(_0xcaf495,_0x93728f){var _0x3cf196={'raw':!![],'where':{'id':_0xcaf495[_0x58ae('0x48')]['id']}},_0x12a179={};_0x12a179['model']=_['keys'](db[_0x58ae('0x2f')][_0x58ae('0x30')]);_0x12a179['query']=_[_0x58ae('0x34')](_0xcaf495[_0x58ae('0x33')]);_0x12a179[_0x58ae('0x3f')]=_[_0x58ae('0x35')](_0x12a179['model'],_0x12a179['query']);_0x3cf196[_0x58ae('0x37')]=_[_0x58ae('0x35')](_0x12a179[_0x58ae('0x36')],qs[_0x58ae('0x38')](_0xcaf495[_0x58ae('0x33')]['fields']));_0x3cf196[_0x58ae('0x37')]=_0x3cf196[_0x58ae('0x37')][_0x58ae('0x39')]?_0x3cf196[_0x58ae('0x37')]:_0x12a179[_0x58ae('0x36')];if(_0xcaf495[_0x58ae('0x33')][_0x58ae('0x49')]){_0x3cf196[_0x58ae('0x44')]=[{'all':!![]}];}_0x3cf196=_[_0x58ae('0x41')]({},_0x3cf196,_0xcaf495[_0x58ae('0x4a')]);return db[_0x58ae('0x2f')][_0x58ae('0x4b')](_0x3cf196)['then'](handleEntityNotFound(_0x93728f,null))[_0x58ae('0x2a')](respondWithResult(_0x93728f,null))[_0x58ae('0x4c')](handleError(_0x93728f,null));};exports[_0x58ae('0x4d')]=function(_0x1d6598,_0x3478be){return db[_0x58ae('0x2f')][_0x58ae('0x4d')](_0x1d6598['body'],{})[_0x58ae('0x2a')](respondWithResult(_0x3478be,0xc9))['catch'](handleError(_0x3478be,null));};exports[_0x58ae('0x29')]=function(_0x36ffa8,_0x19545a){if(_0x36ffa8[_0x58ae('0x4e')]['id']){delete _0x36ffa8['body']['id'];}return db[_0x58ae('0x2f')]['find']({'where':{'id':_0x36ffa8[_0x58ae('0x48')]['id']}})[_0x58ae('0x2a')](handleEntityNotFound(_0x19545a,null))['then'](saveUpdates(_0x36ffa8[_0x58ae('0x4e')],null))['then'](respondWithResult(_0x19545a,null))[_0x58ae('0x4c')](handleError(_0x19545a,null));};exports[_0x58ae('0x4f')]=function(_0x5a9e66,_0x1d263e){return db[_0x58ae('0x2f')][_0x58ae('0x4b')]({'where':{'id':_0x5a9e66[_0x58ae('0x48')]['id']}})[_0x58ae('0x2a')](handleEntityNotFound(_0x1d263e,null))[_0x58ae('0x2a')](removeEntity(_0x1d263e,null))['catch'](handleError(_0x1d263e,null));}; \ No newline at end of file +var _0x4632=['limit','count','set','Content-Range','json','apply','save','update','then','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','options','findAll','rows','params','keys','fields','includeAll','merge','catch','create','find','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset'];(function(_0x4b6db3,_0x4bfef8){var _0x5797ff=function(_0x574adf){while(--_0x574adf){_0x4b6db3['push'](_0x4b6db3['shift']());}};_0x5797ff(++_0x4bfef8);}(_0x4632,0x1c8));var _0x2463=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4632[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x2463('0x0'));var rimraf=require(_0x2463('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2463('0x2'));var rp=require(_0x2463('0x3'));var moment=require('moment');var BPromise=require(_0x2463('0x4'));var Mustache=require(_0x2463('0x5'));var util=require('util');var path=require(_0x2463('0x6'));var sox=require(_0x2463('0x7'));var csv=require(_0x2463('0x8'));var ejs=require(_0x2463('0x9'));var fs=require('fs');var fs_extra=require(_0x2463('0xa'));var _=require(_0x2463('0xb'));var squel=require(_0x2463('0xc'));var crypto=require(_0x2463('0xd'));var jsforce=require(_0x2463('0xe'));var deskjs=require(_0x2463('0xf'));var toCsv=require(_0x2463('0x8'));var querystring=require(_0x2463('0x10'));var Papa=require('papaparse');var Redis=require(_0x2463('0x11'));var authService=require(_0x2463('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2463('0x13'));var config=require(_0x2463('0x14'));var licenseUtil=require(_0x2463('0x15'));var db=require(_0x2463('0x16'))['db'];function respondWithStatusCode(_0x33dcb1,_0x1df8bc){_0x1df8bc=_0x1df8bc||0xcc;return function(_0x593291){if(_0x593291){return _0x33dcb1[_0x2463('0x17')](_0x1df8bc);}return _0x33dcb1['status'](_0x1df8bc)[_0x2463('0x18')]();};}function respondWithResult(_0xcec5d1,_0x244f7b){_0x244f7b=_0x244f7b||0xc8;return function(_0x2e48fa){if(_0x2e48fa){return _0xcec5d1[_0x2463('0x19')](_0x244f7b)['json'](_0x2e48fa);}};}function respondWithFilteredResult(_0x723a0,_0x33e4c7){return function(_0x4006ac){if(_0x4006ac){var _0x54a829=typeof _0x33e4c7[_0x2463('0x1a')]==='undefined'&&typeof _0x33e4c7[_0x2463('0x1b')]==='undefined';var _0x5a2c24=_0x4006ac[_0x2463('0x1c')];var _0x29134a=_0x54a829?0x0:_0x33e4c7[_0x2463('0x1a')];var _0x512514=_0x54a829?_0x4006ac[_0x2463('0x1c')]:_0x33e4c7['offset']+_0x33e4c7[_0x2463('0x1b')];var _0x1275d6;if(_0x512514>=_0x5a2c24){_0x512514=_0x5a2c24;_0x1275d6=0xc8;}else{_0x1275d6=0xce;}_0x723a0[_0x2463('0x19')](_0x1275d6);return _0x723a0[_0x2463('0x1d')](_0x2463('0x1e'),_0x29134a+'-'+_0x512514+'/'+_0x5a2c24)[_0x2463('0x1f')](_0x4006ac);}return null;};}function patchUpdates(_0x4d59b9){return function(_0x469c0c){try{jsonpatch[_0x2463('0x20')](_0x469c0c,_0x4d59b9,!![]);}catch(_0x20f27d){return BPromise['reject'](_0x20f27d);}return _0x469c0c[_0x2463('0x21')]();};}function saveUpdates(_0x53a1ee,_0x274904){return function(_0x37bc91){if(_0x37bc91){return _0x37bc91[_0x2463('0x22')](_0x53a1ee)[_0x2463('0x23')](function(_0x542fc5){return _0x542fc5;});}return null;};}function removeEntity(_0x3a586f,_0x1635cb){return function(_0x4a41b8){if(_0x4a41b8){return _0x4a41b8['destroy']()[_0x2463('0x23')](function(){_0x3a586f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48d846,_0xec82ec){return function(_0x12fcf5){if(!_0x12fcf5){_0x48d846[_0x2463('0x17')](0x194);}return _0x12fcf5;};}function handleError(_0x1afb22,_0x5cb405){_0x5cb405=_0x5cb405||0x1f4;return function(_0x3032c1){logger['error'](_0x3032c1['stack']);if(_0x3032c1[_0x2463('0x24')]){delete _0x3032c1[_0x2463('0x24')];}_0x1afb22[_0x2463('0x19')](_0x5cb405)['send'](_0x3032c1);};}exports[_0x2463('0x25')]=function(_0x5d2286,_0x1440e3){var _0x3eab0c={},_0x2aa329={},_0x19c588={'count':0x0,'rows':[]};var _0x58b3b3=_[_0x2463('0x26')](db[_0x2463('0x27')][_0x2463('0x28')],function(_0x23276a){return{'name':_0x23276a[_0x2463('0x29')],'type':_0x23276a[_0x2463('0x2a')][_0x2463('0x2b')]};});_0x2aa329[_0x2463('0x2c')]=_[_0x2463('0x26')](_0x58b3b3,_0x2463('0x24'));_0x2aa329['query']=_['keys'](_0x5d2286[_0x2463('0x2d')]);_0x2aa329[_0x2463('0x2e')]=_['intersection'](_0x2aa329[_0x2463('0x2c')],_0x2aa329[_0x2463('0x2d')]);_0x3eab0c[_0x2463('0x2f')]=_[_0x2463('0x30')](_0x2aa329[_0x2463('0x2c')],qs['fields'](_0x5d2286[_0x2463('0x2d')]['fields']));_0x3eab0c['attributes']=_0x3eab0c['attributes'][_0x2463('0x31')]?_0x3eab0c[_0x2463('0x2f')]:_0x2aa329['model'];if(!_0x5d2286[_0x2463('0x2d')][_0x2463('0x32')](_0x2463('0x33'))){_0x3eab0c[_0x2463('0x1b')]=qs[_0x2463('0x1b')](_0x5d2286['query'][_0x2463('0x1b')]);_0x3eab0c[_0x2463('0x1a')]=qs['offset'](_0x5d2286[_0x2463('0x2d')][_0x2463('0x1a')]);}_0x3eab0c[_0x2463('0x34')]=qs['sort'](_0x5d2286[_0x2463('0x2d')]['sort']);_0x3eab0c[_0x2463('0x35')]=qs[_0x2463('0x2e')](_[_0x2463('0x36')](_0x5d2286[_0x2463('0x2d')],_0x2aa329[_0x2463('0x2e')]),_0x58b3b3);if(_0x5d2286['query'][_0x2463('0x37')]){_0x3eab0c[_0x2463('0x35')]=_['merge'](_0x3eab0c[_0x2463('0x35')],{'$or':_['map'](_0x58b3b3,function(_0x3c1c4e){if(_0x3c1c4e[_0x2463('0x2a')]!==_0x2463('0x38')){var _0x3e894a={};_0x3e894a[_0x3c1c4e[_0x2463('0x24')]]={'$like':'%'+_0x5d2286[_0x2463('0x2d')][_0x2463('0x37')]+'%'};return _0x3e894a;}})});}_0x3eab0c=_['merge']({},_0x3eab0c,_0x5d2286[_0x2463('0x39')]);var _0x45430b={'where':_0x3eab0c[_0x2463('0x35')]};return db[_0x2463('0x27')]['count'](_0x45430b)[_0x2463('0x23')](function(_0x3cc9ee){_0x19c588[_0x2463('0x1c')]=_0x3cc9ee;if(_0x5d2286['query']['includeAll']){_0x3eab0c['include']=[{'all':!![]}];}return db[_0x2463('0x27')][_0x2463('0x3a')](_0x3eab0c);})['then'](function(_0x4e96cc){_0x19c588[_0x2463('0x3b')]=_0x4e96cc;return _0x19c588;})[_0x2463('0x23')](respondWithFilteredResult(_0x1440e3,_0x3eab0c))['catch'](handleError(_0x1440e3,null));};exports['show']=function(_0x3e7cf8,_0x2e79ea){var _0x1059cd={'raw':!![],'where':{'id':_0x3e7cf8[_0x2463('0x3c')]['id']}},_0x4adeba={};_0x4adeba['model']=_[_0x2463('0x3d')](db[_0x2463('0x27')][_0x2463('0x28')]);_0x4adeba[_0x2463('0x2d')]=_[_0x2463('0x3d')](_0x3e7cf8[_0x2463('0x2d')]);_0x4adeba[_0x2463('0x2e')]=_['intersection'](_0x4adeba[_0x2463('0x2c')],_0x4adeba[_0x2463('0x2d')]);_0x1059cd[_0x2463('0x2f')]=_[_0x2463('0x30')](_0x4adeba[_0x2463('0x2c')],qs[_0x2463('0x3e')](_0x3e7cf8['query'][_0x2463('0x3e')]));_0x1059cd['attributes']=_0x1059cd['attributes']['length']?_0x1059cd['attributes']:_0x4adeba[_0x2463('0x2c')];if(_0x3e7cf8[_0x2463('0x2d')][_0x2463('0x3f')]){_0x1059cd['include']=[{'all':!![]}];}_0x1059cd=_[_0x2463('0x40')]({},_0x1059cd,_0x3e7cf8[_0x2463('0x39')]);return db[_0x2463('0x27')]['find'](_0x1059cd)['then'](handleEntityNotFound(_0x2e79ea,null))[_0x2463('0x23')](respondWithResult(_0x2e79ea,null))[_0x2463('0x41')](handleError(_0x2e79ea,null));};exports['create']=function(_0x207a51,_0x39e47e){return db[_0x2463('0x27')][_0x2463('0x42')](_0x207a51['body'],{})['then'](respondWithResult(_0x39e47e,0xc9))[_0x2463('0x41')](handleError(_0x39e47e,null));};exports[_0x2463('0x22')]=function(_0x4d388b,_0xe37306){if(_0x4d388b['body']['id']){delete _0x4d388b['body']['id'];}return db[_0x2463('0x27')][_0x2463('0x43')]({'where':{'id':_0x4d388b[_0x2463('0x3c')]['id']}})[_0x2463('0x23')](handleEntityNotFound(_0xe37306,null))[_0x2463('0x23')](saveUpdates(_0x4d388b[_0x2463('0x44')],null))[_0x2463('0x23')](respondWithResult(_0xe37306,null))[_0x2463('0x41')](handleError(_0xe37306,null));};exports['destroy']=function(_0x2f1a90,_0x49a6ce){return db[_0x2463('0x27')][_0x2463('0x43')]({'where':{'id':_0x2f1a90[_0x2463('0x3c')]['id']}})[_0x2463('0x23')](handleEntityNotFound(_0x49a6ce,null))[_0x2463('0x23')](removeEntity(_0x49a6ce,null))[_0x2463('0x41')](handleError(_0x49a6ce,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 3a837b5..af4a185 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 _0x1aa8=['utf8mb4_unicode_ci','api','moment','request-promise','path','rimraf','../../config/environment','define','fax_applications','utf8mb4'];(function(_0x3ea3e9,_0x41ab98){var _0x431a88=function(_0x1f74f5){while(--_0x1f74f5){_0x3ea3e9['push'](_0x3ea3e9['shift']());}};_0x431a88(++_0x41ab98);}(_0x1aa8,0x8d));var _0x81aa=function(_0x5a09aa,_0x54f654){_0x5a09aa=_0x5a09aa-0x0;var _0xe5b2f=_0x1aa8[_0x5a09aa];return _0xe5b2f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x81aa('0x0'));var moment=require(_0x81aa('0x1'));var BPromise=require('bluebird');var rp=require(_0x81aa('0x2'));var fs=require('fs');var path=require(_0x81aa('0x3'));var rimraf=require(_0x81aa('0x4'));var config=require(_0x81aa('0x5'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x18ee47,_0x3db088){return _0x18ee47[_0x81aa('0x6')]('FaxApplication',attributes,{'tableName':_0x81aa('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x81aa('0x8'),'collate':_0x81aa('0x9')});}; \ No newline at end of file +var _0xc964=['moment','bluebird','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','lodash','util','api'];(function(_0x4f2cb1,_0x58c675){var _0x29077b=function(_0x284ac9){while(--_0x284ac9){_0x4f2cb1['push'](_0x4f2cb1['shift']());}};_0x29077b(++_0x58c675);}(_0xc964,0xc9));var _0x4c96=function(_0x307d15,_0xab4946){_0x307d15=_0x307d15-0x0;var _0x2f517c=_0xc964[_0x307d15];return _0x2f517c;};'use strict';var _=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var logger=require('../../config/logger')(_0x4c96('0x2'));var moment=require(_0x4c96('0x3'));var BPromise=require(_0x4c96('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c96('0x5'));var rimraf=require(_0x4c96('0x6'));var config=require(_0x4c96('0x7'));var attributes=require('./faxApplication.attributes');module[_0x4c96('0x8')]=function(_0x16efed,_0x220b4d){return _0x16efed[_0x4c96('0x9')](_0x4c96('0xa'),attributes,{'tableName':_0x4c96('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index ba0f196..900a6ef 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 _0xfe65=['catch','update','body','options','where','limit','UpdateFaxApplication','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','debug','request\x20sent','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','info'];(function(_0x3fd1f0,_0xb66780){var _0x31dd66=function(_0x1bf18f){while(--_0x1bf18f){_0x3fd1f0['push'](_0x3fd1f0['shift']());}};_0x31dd66(++_0xb66780);}(_0xfe65,0xc4));var _0x5fe6=function(_0xc80702,_0x18ef50){_0xc80702=_0xc80702-0x0;var _0x4c4c76=_0xfe65[_0xc80702];return _0x4c4c76;};'use strict';var _=require(_0x5fe6('0x0'));var util=require(_0x5fe6('0x1'));var moment=require('moment');var BPromise=require(_0x5fe6('0x2'));var rs=require(_0x5fe6('0x3'));var fs=require('fs');var Redis=require(_0x5fe6('0x4'));var db=require(_0x5fe6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5fe6('0x6'))('rpc');var config=require(_0x5fe6('0x7'));var jayson=require(_0x5fe6('0x8'));var client=jayson['client'][_0x5fe6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35d936,_0x304c3a,_0x4e6715){return new BPromise(function(_0x414f71,_0x2930af){return client[_0x5fe6('0xa')](_0x35d936,_0x4e6715)[_0x5fe6('0xb')](function(_0x4dfbdd){logger['info']('FaxApplication,\x20%s,\x20%s',_0x304c3a,'request\x20sent');logger[_0x5fe6('0xc')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x304c3a,_0x5fe6('0xd'),JSON[_0x5fe6('0xe')](_0x4dfbdd));if(_0x4dfbdd[_0x5fe6('0xf')]){if(_0x4dfbdd[_0x5fe6('0xf')][_0x5fe6('0x10')]===0x1f4){logger['error'](_0x5fe6('0x11'),_0x304c3a,_0x4dfbdd[_0x5fe6('0xf')][_0x5fe6('0x12')]);return _0x2930af(_0x4dfbdd[_0x5fe6('0xf')][_0x5fe6('0x12')]);}logger['error'](_0x5fe6('0x11'),_0x304c3a,_0x4dfbdd[_0x5fe6('0xf')][_0x5fe6('0x12')]);return _0x414f71(_0x4dfbdd[_0x5fe6('0xf')][_0x5fe6('0x12')]);}else{logger[_0x5fe6('0x13')](_0x5fe6('0x11'),_0x304c3a,_0x5fe6('0xd'));_0x414f71(_0x4dfbdd['result'][_0x5fe6('0x12')]);}})[_0x5fe6('0x14')](function(_0x9a72d0){logger[_0x5fe6('0xf')](_0x5fe6('0x11'),_0x304c3a,_0x9a72d0);_0x2930af(_0x9a72d0);});});}exports['UpdateFaxApplication']=function(_0x34cc47){var _0x9e285a=this;return new Promise(function(_0x4af938,_0x1f7e25){return db['FaxApplication'][_0x5fe6('0x15')](_0x34cc47[_0x5fe6('0x16')],{'raw':_0x34cc47[_0x5fe6('0x17')]?_0x34cc47[_0x5fe6('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34cc47[_0x5fe6('0x17')]?_0x34cc47['options'][_0x5fe6('0x18')]||null:null,'attributes':_0x34cc47['options']?_0x34cc47[_0x5fe6('0x17')]['attributes']||null:null,'limit':_0x34cc47[_0x5fe6('0x17')]?_0x34cc47[_0x5fe6('0x17')][_0x5fe6('0x19')]||null:null})['then'](function(_0x18f353){logger['info'](_0x5fe6('0x1a'),_0x34cc47);logger[_0x5fe6('0xc')](_0x5fe6('0x1a'),_0x34cc47,JSON[_0x5fe6('0xe')](_0x18f353));_0x4af938(_0x18f353);})[_0x5fe6('0x14')](function(_0x510d3a){logger[_0x5fe6('0xf')](_0x5fe6('0x1a'),_0x510d3a['message'],_0x34cc47);_0x1f7e25(_0x9e285a[_0x5fe6('0xf')](0x1f4,_0x510d3a['message']));});});}; \ No newline at end of file +var _0x33a7=['catch','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','request','then','info','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateFaxApplication','update','body','options','raw','where','attributes','limit','debug'];(function(_0x319696,_0x477274){var _0x44085a=function(_0x33c51d){while(--_0x33c51d){_0x319696['push'](_0x319696['shift']());}};_0x44085a(++_0x477274);}(_0x33a7,0xfd));var _0x733a=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0x33a7[_0x40df5f];return _0x1573f1;};'use strict';var _=require('lodash');var util=require(_0x733a('0x0'));var moment=require(_0x733a('0x1'));var BPromise=require(_0x733a('0x2'));var rs=require(_0x733a('0x3'));var fs=require('fs');var Redis=require(_0x733a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x733a('0x5'));var config=require(_0x733a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x733a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f347d,_0x2dce9c,_0x51d9dd){return new BPromise(function(_0x1b6aeb,_0x1cf7f1){return client[_0x733a('0x8')](_0x2f347d,_0x51d9dd)[_0x733a('0x9')](function(_0x5036e4){logger[_0x733a('0xa')](_0x733a('0xb'),_0x2dce9c,'request\x20sent');logger['debug'](_0x733a('0xc'),_0x2dce9c,_0x733a('0xd'),JSON[_0x733a('0xe')](_0x5036e4));if(_0x5036e4[_0x733a('0xf')]){if(_0x5036e4['error']['code']===0x1f4){logger[_0x733a('0xf')](_0x733a('0xb'),_0x2dce9c,_0x5036e4[_0x733a('0xf')][_0x733a('0x10')]);return _0x1cf7f1(_0x5036e4[_0x733a('0xf')]['message']);}logger[_0x733a('0xf')](_0x733a('0xb'),_0x2dce9c,_0x5036e4[_0x733a('0xf')]['message']);return _0x1b6aeb(_0x5036e4['error']['message']);}else{logger[_0x733a('0xa')]('FaxApplication,\x20%s,\x20%s',_0x2dce9c,_0x733a('0xd'));_0x1b6aeb(_0x5036e4[_0x733a('0x11')][_0x733a('0x10')]);}})['catch'](function(_0x22d45d){logger[_0x733a('0xf')](_0x733a('0xb'),_0x2dce9c,_0x22d45d);_0x1cf7f1(_0x22d45d);});});}exports[_0x733a('0x12')]=function(_0x3a96fb){var _0x5031b2=this;return new Promise(function(_0x23b939,_0xa5329b){return db['FaxApplication'][_0x733a('0x13')](_0x3a96fb[_0x733a('0x14')],{'raw':_0x3a96fb[_0x733a('0x15')]?_0x3a96fb[_0x733a('0x15')][_0x733a('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a96fb[_0x733a('0x15')]?_0x3a96fb['options'][_0x733a('0x17')]||null:null,'attributes':_0x3a96fb[_0x733a('0x15')]?_0x3a96fb[_0x733a('0x15')][_0x733a('0x18')]||null:null,'limit':_0x3a96fb[_0x733a('0x15')]?_0x3a96fb[_0x733a('0x15')][_0x733a('0x19')]||null:null})[_0x733a('0x9')](function(_0x2f43bc){logger[_0x733a('0xa')](_0x733a('0x12'),_0x3a96fb);logger[_0x733a('0x1a')](_0x733a('0x12'),_0x3a96fb,JSON[_0x733a('0xe')](_0x2f43bc));_0x23b939(_0x2f43bc);})[_0x733a('0x1b')](function(_0x2cfe6c){logger[_0x733a('0xf')](_0x733a('0x12'),_0x2cfe6c[_0x733a('0x10')],_0x3a96fb);_0xa5329b(_0x5031b2[_0x733a('0xf')](0x1f4,_0x2cfe6c[_0x733a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 25eb242..fa55135 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 _0xd7d1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x31880d,_0x4f0ff3){var _0x423823=function(_0x57cc92){while(--_0x57cc92){_0x31880d['push'](_0x31880d['shift']());}};_0x423823(++_0x4f0ff3);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x396e4e,_0x4dee71){_0x396e4e=_0x396e4e-0x0;var _0x2ed50e=_0xd7d1[_0x396e4e];return _0x2ed50e;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var fs_extra=require(_0x1d7d('0x6'));var auth=require(_0x1d7d('0x7'));var interaction=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var controller=require(_0x1d7d('0xa'));router[_0x1d7d('0xb')]('/',auth[_0x1d7d('0xc')](),controller['index']);router[_0x1d7d('0xb')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xf')]('/',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0x11')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x12')]);router['delete'](_0x1d7d('0xd'),auth['isAuthenticated'](),controller[_0x1d7d('0x13')]);module[_0x1d7d('0x14')]=router; \ No newline at end of file +var _0x0abf=['isAuthenticated','index','show','post','put','/:id','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x0abf,0xe8));var _0xf0ab=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0abf[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0xb')]('/',auth[_0xf0ab('0x8')](),controller['create']);router[_0xf0ab('0xc')](_0xf0ab('0xd'),auth[_0xf0ab('0x8')](),controller['update']);router['delete'](_0xf0ab('0xd'),auth['isAuthenticated'](),controller[_0xf0ab('0xe')]);module[_0xf0ab('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index c7ed395..827b07c 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 _0xda3e=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x52e430,_0x3a9037){var _0x2edc71=function(_0x4345fd){while(--_0x4345fd){_0x52e430['push'](_0x52e430['shift']());}};_0x2edc71(++_0x3a9037);}(_0xda3e,0xf5));var _0xeda3=function(_0xfe5da,_0x3fa047){_0xfe5da=_0xfe5da-0x0;var _0x4d776b=_0xda3e[_0xfe5da];return _0x4d776b;};'use strict';var Sequelize=require(_0xeda3('0x0'));module[_0xeda3('0x1')]={'closed':{'type':Sequelize[_0xeda3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xeda3('0x3')]},'disposition':{'type':Sequelize[_0xeda3('0x4')]},'secondDisposition':{'type':Sequelize[_0xeda3('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xeda3('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xeda3('0x5')]('in',_0xeda3('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xeda3('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xeda3('0x5')]('in',_0xeda3('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x8d23=['DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x214500,_0x5d3434){var _0x46496c=function(_0x3373f6){while(--_0x3373f6){_0x214500['push'](_0x214500['shift']());}};_0x46496c(++_0x5d3434);}(_0x8d23,0x1c1));var _0x38d2=function(_0x18413b,_0x2fee67){_0x18413b=_0x18413b-0x0;var _0x213331=_0x8d23[_0x18413b];return _0x213331;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x38d2('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x38d2('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x38d2('0x2')]},'thirdDisposition':{'type':Sequelize[_0x38d2('0x2')]},'note':{'type':Sequelize[_0x38d2('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x38d2('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x38d2('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x38d2('0x3')]('in',_0x38d2('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 1e14f7b..a9c4df7 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 _0x8364=['addMessage','FaxMessage','ids','findOne','nolimit','format','findAll','addTags','setTags','omit','spread','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','existsSync','createWriteStream','basename','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','json','limit','count','offset','set','apply','reject','save','update','then','sendStatus','error','stack','name','Users','fullname','TagIds','split','push','catch','index','map','FaxInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','field','color','tools_tags','select','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','u.id\x20=\x20ui.UserId','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','some','compact','isEmpty','forEach','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','user','sequelize','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','toString','FaxInteractionId','all','rows','show','includeAll','include','options','create','body','params','destroy','describe'];(function(_0x2e7dfc,_0xbd2ca2){var _0x1a6e88=function(_0x25132a){while(--_0x25132a){_0x2e7dfc['push'](_0x2e7dfc['shift']());}};_0x1a6e88(++_0xbd2ca2);}(_0x8364,0xf2));var _0x4836=function(_0x3a881e,_0x2272de){_0x3a881e=_0x3a881e-0x0;var _0x42bd9e=_0x8364[_0x3a881e];return _0x42bd9e;};'use strict';var emlformat=require(_0x4836('0x0'));var rimraf=require(_0x4836('0x1'));var zipdir=require(_0x4836('0x2'));var jsonpatch=require(_0x4836('0x3'));var rp=require(_0x4836('0x4'));var moment=require('moment');var BPromise=require(_0x4836('0x5'));var Mustache=require(_0x4836('0x6'));var util=require('util');var path=require(_0x4836('0x7'));var sox=require(_0x4836('0x8'));var csv=require(_0x4836('0x9'));var ejs=require(_0x4836('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4836('0xb'));var squel=require(_0x4836('0xc'));var crypto=require(_0x4836('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4836('0xe'));var toCsv=require(_0x4836('0x9'));var querystring=require(_0x4836('0xf'));var Papa=require('papaparse');var Redis=require(_0x4836('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4836('0x11'));var as=require(_0x4836('0x12'));var hardwareService=require(_0x4836('0x13'));var logger=require(_0x4836('0x14'))(_0x4836('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4836('0x16'))['db'];config['redis']=_[_0x4836('0x17')](config[_0x4836('0x18')],{'host':_0x4836('0x19'),'port':0x18eb});var socket=require(_0x4836('0x1a'))(new Redis(config[_0x4836('0x18')]));require('./faxInteraction.socket')[_0x4836('0x1b')](socket);function respondWithStatusCode(_0x3b5868,_0x361c44){_0x361c44=_0x361c44||0xcc;return function(_0x420d42){if(_0x420d42){return _0x3b5868['sendStatus'](_0x361c44);}return _0x3b5868[_0x4836('0x1c')](_0x361c44)[_0x4836('0x1d')]();};}function respondWithResult(_0x124252,_0x4c533f){_0x4c533f=_0x4c533f||0xc8;return function(_0x2f95d6){if(_0x2f95d6){return _0x124252[_0x4836('0x1c')](_0x4c533f)[_0x4836('0x1e')](_0x2f95d6);}};}function respondWithFilteredResult(_0x562a67,_0x23184a){return function(_0x2b7c23){if(_0x2b7c23){var _0xa51afe=typeof _0x23184a['offset']==='undefined'&&typeof _0x23184a[_0x4836('0x1f')]==='undefined';var _0x143852=_0x2b7c23[_0x4836('0x20')];var _0x5c8bf1=_0xa51afe?0x0:_0x23184a[_0x4836('0x21')];var _0xe738b1=_0xa51afe?_0x2b7c23[_0x4836('0x20')]:_0x23184a[_0x4836('0x21')]+_0x23184a[_0x4836('0x1f')];var _0x19014a;if(_0xe738b1>=_0x143852){_0xe738b1=_0x143852;_0x19014a=0xc8;}else{_0x19014a=0xce;}_0x562a67['status'](_0x19014a);return _0x562a67[_0x4836('0x22')]('Content-Range',_0x5c8bf1+'-'+_0xe738b1+'/'+_0x143852)[_0x4836('0x1e')](_0x2b7c23);}return null;};}function patchUpdates(_0x289e69){return function(_0x529bcd){try{jsonpatch[_0x4836('0x23')](_0x529bcd,_0x289e69,!![]);}catch(_0x5c0051){return BPromise[_0x4836('0x24')](_0x5c0051);}return _0x529bcd[_0x4836('0x25')]();};}function saveUpdates(_0x1fa303,_0x518458){return function(_0x5ac833){if(_0x5ac833){return _0x5ac833[_0x4836('0x26')](_0x1fa303)[_0x4836('0x27')](function(_0x88c7b7){return _0x88c7b7;});}return null;};}function removeEntity(_0x260d5d,_0x58639c){return function(_0x38e9f6){if(_0x38e9f6){return _0x38e9f6['destroy']()[_0x4836('0x27')](function(){_0x260d5d[_0x4836('0x1c')](0xcc)[_0x4836('0x1d')]();});}};}function handleEntityNotFound(_0x4540cf,_0x4a7c56){return function(_0x236ee7){if(!_0x236ee7){_0x4540cf[_0x4836('0x28')](0x194);}return _0x236ee7;};}function handleError(_0x2c7fe1,_0x155f81){_0x155f81=_0x155f81||0x1f4;return function(_0x5e0a27){logger[_0x4836('0x29')](_0x5e0a27[_0x4836('0x2a')]);if(_0x5e0a27[_0x4836('0x2b')]){delete _0x5e0a27[_0x4836('0x2b')];}_0x2c7fe1[_0x4836('0x1c')](_0x155f81)['send'](_0x5e0a27);};}function getInteractionUsers(_0x185b5e,_0x446ab7){return new BPromise(function(_0x49c724,_0x1eb4f9){try{if(_0x446ab7[_0x185b5e['id']]){_0x185b5e[_0x4836('0x2c')]=_['map'](_0x446ab7[_0x185b5e['id']],function(_0x3ada53){return{'id':_0x3ada53['id'],'fullname':_0x3ada53[_0x4836('0x2d')]};});}}catch(_0x27ad9c){_0x1eb4f9(_0x27ad9c);}_0x49c724(_0x185b5e);});}function getInteractionTags(_0x125943,_0x5b7161){return new BPromise(function(_0x434cf8,_0x12054c){try{if(_0x125943[_0x4836('0x2e')]){_0x125943['Tags']=[];_0x125943[_0x4836('0x2e')][_0x4836('0x2f')](',')['forEach'](function(_0x5bda8b){_0x125943['Tags'][_0x4836('0x30')](_0x5b7161[_0x5bda8b]);});}delete _0x125943[_0x4836('0x2e')];}catch(_0x122396){_0x12054c(_0x122396);}_0x434cf8(_0x125943);});}function updateFaxInteraction(_0x1b3ee6,_0x5e0034,_0x1ff285){return new BPromise(function(_0x12b836,_0x51c52c){return getInteractionUsers(_0x1b3ee6,_0x1ff285)[_0x4836('0x27')](function(_0x190bf9){return getInteractionTags(_0x190bf9,_0x5e0034);})[_0x4836('0x27')](function(_0x57cdb3){_0x12b836(_0x57cdb3);})[_0x4836('0x31')](function(_0x8ced99){_0x51c52c(_0x8ced99);});});}exports[_0x4836('0x32')]=function(_0xbfe13e,_0x31a38e){var _0x3775c9={},_0x2aae22={},_0x44764b={'count':0x0,'rows':[]};var _0x34a79b=_[_0x4836('0x33')](db[_0x4836('0x34')][_0x4836('0x35')],function(_0x3a93df){return{'name':_0x3a93df[_0x4836('0x36')],'type':_0x3a93df[_0x4836('0x37')][_0x4836('0x38')]};});_0x2aae22[_0x4836('0x39')]=_['map'](_0x34a79b,'name');_0x2aae22['query']=_[_0x4836('0x3a')](_0xbfe13e[_0x4836('0x3b')]);_0x2aae22[_0x4836('0x3c')]=_[_0x4836('0x3d')](_0x2aae22[_0x4836('0x39')],_0x2aae22[_0x4836('0x3b')]);_0x3775c9[_0x4836('0x3e')]=_[_0x4836('0x3d')](_0x2aae22[_0x4836('0x39')],qs[_0x4836('0x3f')](_0xbfe13e[_0x4836('0x3b')][_0x4836('0x3f')]));_0x3775c9[_0x4836('0x3e')]=_0x3775c9['attributes'][_0x4836('0x40')]?_0x3775c9['attributes']:_0x2aae22[_0x4836('0x39')];if(!_0xbfe13e[_0x4836('0x3b')][_0x4836('0x41')]('nolimit')){_0x3775c9['limit']=qs[_0x4836('0x1f')](_0xbfe13e[_0x4836('0x3b')][_0x4836('0x1f')]);_0x3775c9['offset']=qs[_0x4836('0x21')](_0xbfe13e[_0x4836('0x3b')][_0x4836('0x21')]);}_0x3775c9[_0x4836('0x42')]=qs[_0x4836('0x43')](_0xbfe13e[_0x4836('0x3b')][_0x4836('0x43')]);_0x3775c9['where']=qs[_0x4836('0x3c')](_[_0x4836('0x44')](_0xbfe13e[_0x4836('0x3b')],_0x2aae22['filters']),_0x34a79b);var _0x384828=[];var _0x44cade=squel['select']()['field']('id')['field'](_0x4836('0x2b'))[_0x4836('0x45')](_0x4836('0x46'))['from'](_0x4836('0x47'));var _0x4c9e73=squel[_0x4836('0x48')]()['field'](_0x4836('0x49'))['field'](_0x4836('0x4a'))[_0x4836('0x45')](_0x4836('0x4b'))['from'](_0x4836('0x4c'),'ui')['left_join']('users','u',_0x4836('0x4d'));var _0x32869d=squel[_0x4836('0x48')]()['from'](_0x4836('0x4e'),'i')[_0x4836('0x4f')](_0x4836('0x50'),'c',_0x4836('0x51'))[_0x4836('0x4f')](_0x4836('0x52'),'o',_0x4836('0x53'))[_0x4836('0x4f')](_0x4836('0x54'),'a','a.id\x20=\x20i.FaxAccountId')[_0x4836('0x4f')](_0x4836('0x55'),'me',_0x4836('0x56'))[_0x4836('0x4f')](_0x4836('0x57'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x4836('0x4f')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x1ba70f=squel['expr']();var _0x392269=[];var _0x27e638=squel[_0x4836('0x58')]();var _0x3e3eaa;if(_0xbfe13e[_0x4836('0x3b')][_0x4836('0x59')]){_0x3e3eaa=as[_0x4836('0x5a')](_0xbfe13e[_0x4836('0x3b')][_0x4836('0x59')]);var _0x29a71e=_0x3e3eaa[_0x4836('0x5b')];for(var _0x4a5a6a=0x0;_0x4a5a6a<_0x3e3eaa[_0x4836('0x5c')][_0x4836('0x40')];_0x4a5a6a++){var _0xefac38=_0x3e3eaa[_0x4836('0x5c')][_0x4a5a6a];var _0x3a2c72='i';var _0x40662b=_[_0x4836('0x5d')](_0x34a79b,[_0x4836('0x2b'),_0xefac38[_0x4836('0x45')]]);if(!_0x40662b){switch(_0xefac38['field']){case _0x4836('0x5e'):if(_0xefac38['value']==0x1){_0x32869d[_0x4836('0x5f')]('`'+_0xefac38[_0x4836('0x45')]+_0x4836('0x60'));}else{_0x32869d['having']('`'+_0xefac38[_0x4836('0x45')]+_0x4836('0x61'));}break;case _0x4836('0x62'):if(_0xefac38[_0x4836('0x63')]===_0x4836('0x64')){if(_0xefac38[_0x4836('0x65')][_0x4836('0x2f')]('\x20')[_0x4836('0x40')]>0x1){_0x1ba70f[_0x29a71e](_0x4836('0x66'),qs['getFullTextValue'](_0xefac38[_0x4836('0x65')]),null);}else{var _0x296ce2='%'+_0xefac38['value']+'%';_0x1ba70f[_0x29a71e](_0x4836('0x67'),_0x296ce2,_0x296ce2,_0x296ce2);}}else{_0x40662b=_[_0x4836('0x5d')](_0x34a79b,['name',_0x4836('0x68')]);_0xefac38[_0x4836('0x45')]=_0x4836('0x68');_0x37d4c5=as[_0x4836('0x69')](_0x3a2c72,_0x40662b[_0x4836('0x37')],_0xefac38);_0x1ba70f[_0x29a71e](_0x37d4c5['text'],_0x37d4c5['value'][_0x4836('0x6a')],_0x37d4c5[_0x4836('0x65')][_0x4836('0x1d')]);}break;case _0x4836('0x6b'):var _0x3ee407=_0xefac38[_0x4836('0x65')][_0x4836('0x2f')](',')[_0x4836('0x33')](function(_0x1288a8){return Number(_0x1288a8);});_0x3ee407['forEach'](function(_0xf941e){_0x27e638['or'](_0x4836('0x6c'),'%,'+_0xf941e+',%');});_0x392269=_[_0x4836('0x6d')](_0x392269,_0x3ee407);break;case _0x4836('0x6e'):if(_0xefac38[_0x4836('0x63')]===_0x4836('0x64')){_0x1ba70f[_0x29a71e](_0x4836('0x6f'),'%'+_0xefac38[_0x4836('0x65')]+'%',null);}else{_0x40662b=_['find'](_0x34a79b,[_0x4836('0x2b'),'UserId']);_0xefac38['field']=_0x4836('0x70');_0x37d4c5=as['buildExpression'](_0x3a2c72,_0x40662b[_0x4836('0x37')],_0xefac38);_0x1ba70f[_0x29a71e](_0x37d4c5[_0x4836('0x71')],_0x37d4c5[_0x4836('0x65')]['start'],_0x37d4c5[_0x4836('0x65')]['end']);}break;case'body':_0x37d4c5=as[_0x4836('0x69')]('me',null,_0xefac38);_0x1ba70f[_0x29a71e](_0x37d4c5['text'],_0x37d4c5[_0x4836('0x65')]['start'],_0x37d4c5[_0x4836('0x65')][_0x4836('0x1d')]);break;}}else{var _0x37d4c5=as['buildExpression'](_0x3a2c72,_0x40662b[_0x4836('0x37')],_0xefac38);_0x1ba70f[_0x29a71e](_0x37d4c5[_0x4836('0x71')],_0x37d4c5[_0x4836('0x65')][_0x4836('0x6a')],_0x37d4c5[_0x4836('0x65')]['end']);}}}else{var _0x56965b=_(_0xbfe13e[_0x4836('0x3b')])[_0x4836('0x3a')]()[_0x4836('0x33')](function(_0xf7e146){return _[_0x4836('0x72')](_0x34a79b,[_0x4836('0x2b'),_0xf7e146])?_0xf7e146:undefined;})[_0x4836('0x73')]()['value']();if(!_[_0x4836('0x74')](_0x56965b)){_0x56965b[_0x4836('0x75')](function(_0x186d67){if(_0x186d67===_0x4836('0x76')){_0x32869d[_0x4836('0x77')](_0x4836('0x78'),[][_0x4836('0x79')](_0xbfe13e[_0x4836('0x3b')][_0x186d67]));}else if(_0x186d67===_0x4836('0x7a')){var _0xf6cb14=JSON[_0x4836('0x7b')](_0xbfe13e[_0x4836('0x3b')][_0x186d67])[_0x4836('0x7c')];var _0x56c6c1=JSON[_0x4836('0x7b')](_0xbfe13e['query'][_0x186d67])[_0x4836('0x7d')];_0x32869d['where'](_0x4836('0x7e'),_0xf6cb14,_0x56c6c1);}else{if(_0xbfe13e[_0x4836('0x3b')][_0x186d67]==='null'){_0x32869d[_0x4836('0x77')]('i.'+_0x186d67+'\x20IS\x20NULL');}else{_0x32869d['where']('i.'+_0x186d67+'\x20=\x20?',_0xbfe13e['query'][_0x186d67]);}}});}if(_0xbfe13e['query'][_0x4836('0x7f')]){if(_0xbfe13e['query']['read']==0x1){_0x32869d[_0x4836('0x5f')](_0x4836('0x80'));}else{_0x32869d[_0x4836('0x5f')]('`unreadMessages`\x20>\x200');}}if(_0xbfe13e['query'][_0x4836('0x81')]){_0x392269=_[_0x4836('0x82')](_0xbfe13e['query'][_0x4836('0x81')])?_0xbfe13e[_0x4836('0x3b')][_0x4836('0x81')]:new Array(_0xbfe13e['query'][_0x4836('0x81')]);_0x392269['forEach'](function(_0x54b0d3){_0x27e638['or'](_0x4836('0x6c'),'%,'+_0x54b0d3+',%');});}if(_0xbfe13e[_0x4836('0x3b')][_0x4836('0x83')]){var _0x13ba02=_0xbfe13e[_0x4836('0x3b')][_0x4836('0x83')][_0x4836('0x84')]('\x5c','\x5c\x5c')[_0x4836('0x84')](/'/g,'\x27\x27');if(qs[_0x4836('0x85')](_0x13ba02)){_0x1ba70f['or']('i.id\x20LIKE\x20?',_0x13ba02+'%')['or']('i.fax\x20LIKE\x20?',_0x13ba02+'%');}_0x1ba70f['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x13ba02+'%');}}_0x32869d[_0x4836('0x77')](_0x1ba70f);_0x32869d[_0x4836('0x86')]('i.id');var _0x54881b={'type':db[_0x4836('0x87')][_0x4836('0x88')][_0x4836('0x89')],'raw':!![]};var _0x5965f9=_0x32869d[_0x4836('0x8a')]();_0x5965f9[_0x4836('0x45')](_0x4836('0x8b'));_0x5965f9[_0x4836('0x45')](_0x4836('0x8c'),_0x4836('0x5e'));if(_0x3775c9['order']){_0x3775c9['order'][_0x4836('0x75')](function(_0x530f9b){var _0x103b5a=_0x530f9b[0x0]===_0x4836('0x8d')?_0x530f9b[0x0]:'i.'+_0x530f9b[0x0];_0x32869d[_0x4836('0x42')](_0x103b5a,_0x530f9b[0x1]===_0x4836('0x8e')?![]:!![]);});}if(!_[_0x4836('0x74')](_0x392269)){_0x32869d[_0x4836('0x5f')](_0x27e638);_0x5965f9[_0x4836('0x77')](_0x4836('0x8f'),_0x392269);}BPromise[_0x4836('0x90')]()[_0x4836('0x27')](function(){if(!_0x3e3eaa){if(_0xbfe13e[_0x4836('0x3b')][_0x4836('0x76')])return;_0x5965f9[_0x4836('0x77')](_0x4836('0x91'));_0x32869d[_0x4836('0x77')](_0x4836('0x91'));return;}if(_0xbfe13e['user'][_0x4836('0x92')]!==_0x4836('0x93'))return;return _0xbfe13e['user'][_0x4836('0x94')]({'attributes':['id'],'raw':!![]})[_0x4836('0x27')](function(_0x5b58c3){if(_[_0x4836('0x74')](_0x5b58c3)){_0x5965f9[_0x4836('0x77')](_0x4836('0x95'));_0x32869d[_0x4836('0x77')](_0x4836('0x95'));}else{_0x5965f9[_0x4836('0x77')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x5b58c3,'id'));_0x32869d['where'](_0x4836('0x78'),_['map'](_0x5b58c3,'id'));}});})['then'](function(){if(_0xbfe13e[_0x4836('0x96')][_0x4836('0x92')]===_0x4836('0x93')&&!_0x3e3eaa&&!_0xbfe13e[_0x4836('0x3b')][_0x4836('0x76')])return[];return db['sequelize'][_0x4836('0x3b')](_0x5965f9['toString'](),_0x54881b);})[_0x4836('0x27')](function(_0x26e489){_0x44764b['count']=_0x26e489['length'];if(_0x44764b[_0x4836('0x20')]===0x0)return[];return db[_0x4836('0x97')]['query'](_0x44cade['toString'](),_0x54881b)['then'](function(_0x1e9b08){_0x384828=_[_0x4836('0x98')](_0x1e9b08,'id');_0x54881b=_[_0x4836('0x99')](_0x54881b,{'model':db[_0x4836('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xbfe13e[_0x4836('0x3b')][_0x4836('0x3f')]){_0x3775c9[_0x4836('0x3e')]['forEach'](function(_0x384b13){_0x32869d[_0x4836('0x45')]('i.'+_0x384b13);});}else{_0x32869d['field'](_0x4836('0x8c'),_0x4836('0x5e'));_0x32869d[_0x4836('0x45')]('a.key',_0x4836('0x9a'));_0x32869d[_0x4836('0x45')](_0x4836('0x9b'),_0x4836('0x9c'));_0x32869d[_0x4836('0x45')](_0x4836('0x9d'),_0x4836('0x8d'));_0x32869d[_0x4836('0x45')](_0x4836('0x9e'));_0x32869d[_0x4836('0x45')]('c.firstName',_0x4836('0x9f'));_0x32869d[_0x4836('0x45')]('c.lastName',_0x4836('0xa0'));_0x32869d['field'](_0x4836('0xa1'),_0x4836('0xa2'));_0x32869d[_0x4836('0x45')]('c.phone','Contact.phone');_0x32869d['field'](_0x4836('0xa3'),_0x4836('0xa4'));_0x32869d[_0x4836('0x45')](_0x4836('0xa5'),'Contact.fax');_0x32869d[_0x4836('0x45')](_0x4836('0xa6'),'Owner.fullname');_0x32869d[_0x4836('0x45')]('o.internal','Owner.internal');_0x32869d[_0x4836('0x45')](_0x4836('0xa7'),'TagIds');}if(_0x3775c9[_0x4836('0x1f')])_0x32869d[_0x4836('0x1f')](_0x3775c9[_0x4836('0x1f')]);if(_0x3775c9[_0x4836('0x21')])_0x32869d[_0x4836('0x21')](_0x3775c9[_0x4836('0x21')]);return db['sequelize']['query'](_0x32869d['toString'](),_0x54881b);})['then'](function(_0x3d33fa){if(_0x3d33fa[_0x4836('0x40')]>0x0)_0x4c9e73[_0x4836('0x77')](_0x4836('0xa8'),_[_0x4836('0x33')](_0x3d33fa,'id'));return db[_0x4836('0x97')]['query'](_0x4c9e73[_0x4836('0xa9')](),_0x54881b)[_0x4836('0x27')](function(_0x38de21){var _0x40cd32=_['groupBy'](_0x38de21,_0x4836('0xaa'));var _0x38c814=[];_0x3d33fa[_0x4836('0x75')](function(_0x4cd272){_0x38c814['push'](updateFaxInteraction(_0x4cd272,_0x384828,_0x40cd32));});return BPromise[_0x4836('0xab')](_0x38c814);});});})[_0x4836('0x27')](function(_0x102ffe){_0x44764b[_0x4836('0xac')]=_0x102ffe;return _0x44764b;})[_0x4836('0x27')](respondWithFilteredResult(_0x31a38e,_0x3775c9))[_0x4836('0x31')](handleError(_0x31a38e,null));};exports[_0x4836('0xad')]=function(_0xe0433e,_0xd36252){var _0x3369f1={'raw':![],'where':{'id':_0xe0433e['params']['id']}},_0x44dcfc={};_0x44dcfc[_0x4836('0x39')]=_['keys'](db[_0x4836('0x34')][_0x4836('0x35')]);_0x44dcfc[_0x4836('0x3b')]=_['keys'](_0xe0433e[_0x4836('0x3b')]);_0x44dcfc[_0x4836('0x3c')]=_[_0x4836('0x3d')](_0x44dcfc['model'],_0x44dcfc[_0x4836('0x3b')]);_0x3369f1['attributes']=_[_0x4836('0x3d')](_0x44dcfc[_0x4836('0x39')],qs[_0x4836('0x3f')](_0xe0433e[_0x4836('0x3b')][_0x4836('0x3f')]));_0x3369f1[_0x4836('0x3e')]=_0x3369f1[_0x4836('0x3e')][_0x4836('0x40')]?_0x3369f1[_0x4836('0x3e')]:_0x44dcfc[_0x4836('0x39')];if(_0xe0433e[_0x4836('0x3b')][_0x4836('0xae')]){_0x3369f1[_0x4836('0xaf')]=[{'all':!![]}];}_0x3369f1=_[_0x4836('0x99')]({},_0x3369f1,_0xe0433e[_0x4836('0xb0')]);return db[_0x4836('0x34')]['find'](_0x3369f1)[_0x4836('0x27')](handleEntityNotFound(_0xd36252,null))[_0x4836('0x27')](respondWithResult(_0xd36252,null))['catch'](handleError(_0xd36252,null));};exports[_0x4836('0xb1')]=function(_0x3e4bb1,_0x2e8161){return db[_0x4836('0x34')][_0x4836('0xb1')](_0x3e4bb1['body'],{})[_0x4836('0x27')](respondWithResult(_0x2e8161,0xc9))[_0x4836('0x31')](handleError(_0x2e8161,null));};exports[_0x4836('0x26')]=function(_0x4e1984,_0x58b88e){if(_0x4e1984[_0x4836('0xb2')]['id']){delete _0x4e1984['body']['id'];}return db[_0x4836('0x34')][_0x4836('0x5d')]({'where':{'id':_0x4e1984[_0x4836('0xb3')]['id']}})[_0x4836('0x27')](handleEntityNotFound(_0x58b88e,null))[_0x4836('0x27')](saveUpdates(_0x4e1984[_0x4836('0xb2')],null))['then'](respondWithResult(_0x58b88e,null))['catch'](handleError(_0x58b88e,null));};exports[_0x4836('0xb4')]=function(_0x1c9c9c,_0x5547a7){return db[_0x4836('0x34')][_0x4836('0x5d')]({'where':{'id':_0x1c9c9c[_0x4836('0xb3')]['id']}})[_0x4836('0x27')](handleEntityNotFound(_0x5547a7,null))[_0x4836('0x27')](removeEntity(_0x5547a7,null))['catch'](handleError(_0x5547a7,null));};exports[_0x4836('0xb5')]=function(_0x48635b,_0x41ff6a){return db[_0x4836('0x34')][_0x4836('0xb5')]()[_0x4836('0x27')](respondWithResult(_0x41ff6a,null))[_0x4836('0x31')](handleError(_0x41ff6a,null));};exports[_0x4836('0xb6')]=function(_0x4ca18f,_0x539f41,_0x23b65c){return db[_0x4836('0xb7')][_0x4836('0x5d')]({'where':{'id':_0x4ca18f[_0x4836('0xb3')]['id']}})[_0x4836('0x27')](handleEntityNotFound(_0x539f41,null))[_0x4836('0x27')](function(_0x396aa6){if(_0x396aa6){return _0x396aa6[_0x4836('0xb6')](_0x4ca18f[_0x4836('0xb2')][_0x4836('0xb8')],_['omit'](_0x4ca18f[_0x4836('0xb2')],[_0x4836('0xb8'),'id'])||{});}})[_0x4836('0x27')](respondWithResult(_0x539f41,null))[_0x4836('0x31')](handleError(_0x539f41,null));};exports['getMessages']=function(_0x4647f5,_0x17df9a,_0x120c9f){var _0x44c65f={'raw':![],'where':{}};var _0x3c29b5={};var _0x1a1c90={'count':0x0,'rows':[]};return db[_0x4836('0x34')][_0x4836('0xb9')]({'where':{'id':_0x4647f5[_0x4836('0xb3')]['id']}})[_0x4836('0x27')](handleEntityNotFound(_0x17df9a,null))[_0x4836('0x27')](function(_0x33831b){if(_0x33831b){_0x3c29b5[_0x4836('0x39')]=_[_0x4836('0x3a')](db[_0x4836('0xb7')]['rawAttributes']);_0x3c29b5[_0x4836('0x3b')]=_[_0x4836('0x3a')](_0x4647f5[_0x4836('0x3b')]);_0x3c29b5['filters']=_[_0x4836('0x3d')](_0x3c29b5[_0x4836('0x39')],_0x3c29b5['query']);_0x44c65f[_0x4836('0x3e')]=_[_0x4836('0x3d')](_0x3c29b5[_0x4836('0x39')],qs[_0x4836('0x3f')](_0x4647f5['query'][_0x4836('0x3f')]));_0x44c65f[_0x4836('0x3e')]=_0x44c65f['attributes'][_0x4836('0x40')]?_0x44c65f[_0x4836('0x3e')]:_0x3c29b5[_0x4836('0x39')];if(!_0x4647f5['query']['hasOwnProperty'](_0x4836('0xba'))){_0x44c65f['limit']=qs[_0x4836('0x1f')](_0x4647f5['query'][_0x4836('0x1f')]);_0x44c65f[_0x4836('0x21')]=qs[_0x4836('0x21')](_0x4647f5[_0x4836('0x3b')]['offset']);}_0x44c65f['order']=qs[_0x4836('0x43')](_0x4647f5[_0x4836('0x3b')][_0x4836('0x43')]);_0x44c65f[_0x4836('0x77')]=qs['filters'](_[_0x4836('0x44')](_0x4647f5['query'],_0x3c29b5['filters']));_0x44c65f[_0x4836('0x77')][_0x4836('0xaa')]=_0x33831b['id'];if(_0x4647f5['query']['filter']){_0x44c65f['where']=_[_0x4836('0x99')](_0x44c65f[_0x4836('0x77')],{'$or':_[_0x4836('0x33')](_0x44c65f[_0x4836('0x3e')],function(_0x3d9941){var _0x330475={};_0x330475[_0x3d9941]={'$like':'%'+_0x4647f5['query'][_0x4836('0x83')]+'%'};return _0x330475;})});}if(_0x4647f5[_0x4836('0x3b')][_0x4836('0x7c')]){var _0x2b2d3d=_0x4647f5[_0x4836('0x3b')][_0x4836('0x7c')][_0x4836('0x2f')](',');var _0x20c9a9={};_0x20c9a9[_0x2b2d3d[0x0]]={'$gte':moment(_0x2b2d3d[0x1])[_0x4836('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')};_0x44c65f[_0x4836('0x77')]=_[_0x4836('0x99')](_0x44c65f[_0x4836('0x77')],_0x20c9a9);}_0x44c65f=_[_0x4836('0x99')]({},_0x44c65f,_0x4647f5[_0x4836('0xb0')]);return db['FaxMessage']['count']({'where':_0x44c65f[_0x4836('0x77')]})[_0x4836('0x27')](function(_0x490c8b){_0x1a1c90[_0x4836('0x20')]=_0x490c8b;if(_0x4647f5['query'][_0x4836('0xae')]){_0x44c65f[_0x4836('0xaf')]=[{'all':!![]}];}return db[_0x4836('0xb7')][_0x4836('0xbc')](_0x44c65f);})[_0x4836('0x27')](function(_0x3aa2b3){_0x1a1c90['rows']=_0x3aa2b3;return _0x1a1c90;});}})[_0x4836('0x27')](respondWithFilteredResult(_0x17df9a,_0x44c65f))['catch'](handleError(_0x17df9a,null));};exports[_0x4836('0xbd')]=function(_0x161cc7,_0x5792f1,_0x27bd68){return db[_0x4836('0x34')][_0x4836('0x5d')]({'where':{'id':_0x161cc7[_0x4836('0xb3')]['id']}})[_0x4836('0x27')](handleEntityNotFound(_0x5792f1,null))[_0x4836('0x27')](function(_0x567aa9){if(_0x567aa9){return _0x567aa9[_0x4836('0xbe')](_0x161cc7[_0x4836('0xb2')][_0x4836('0xb8')],_[_0x4836('0xbf')](_0x161cc7['body'],[_0x4836('0xb8'),'id'])||{})[_0x4836('0xc0')](function(){return db['Tag'][_0x4836('0xbc')]({'attributes':['id',_0x4836('0x2b'),_0x4836('0x46')],'where':{'id':_0x161cc7['body'][_0x4836('0xb8')]}});})[_0x4836('0x27')](function(_0x517c4c){socket[_0x4836('0xc1')]('faxInteractionTags:save',{'id':Number(_0x161cc7['params']['id']),'tags':_0x517c4c||[]});return{'id':Number(_0x161cc7[_0x4836('0xb3')]['id']),'tags':_0x517c4c||[]};});}})['then'](respondWithResult(_0x5792f1,null))[_0x4836('0x31')](handleError(_0x5792f1,null));};exports[_0x4836('0xc2')]=function(_0x49029b,_0x2d15b4,_0x17f097){return db[_0x4836('0x34')][_0x4836('0x5d')]({'where':{'id':_0x49029b[_0x4836('0xb3')]['id']}})[_0x4836('0x27')](handleEntityNotFound(_0x2d15b4,null))['then'](function(_0x4eaee6){if(_0x4eaee6){return _0x4eaee6['removeTags'](_0x49029b[_0x4836('0x3b')][_0x4836('0xb8')]);}})['then'](respondWithStatusCode(_0x2d15b4,null))[_0x4836('0x31')](handleError(_0x2d15b4,null));};exports[_0x4836('0xc3')]=function(_0x1d303c,_0x2a6b0b){var _0x1b7208=moment()[_0x4836('0xc4')]()[_0x4836('0xa9')]();var _0x1a24c0=path[_0x4836('0xc5')](config[_0x4836('0xc6')],_0x4836('0xc7'),_0x4836('0xc8'),_0x4836('0xc9'));var _0x4f832b=path[_0x4836('0xc5')](config[_0x4836('0xc6')],_0x4836('0xc7'),_0x4836('0xc8'),_0x4836('0xca'));var _0x48b596=path[_0x4836('0xc5')](_0x1a24c0,_0x1b7208);var _0x4dcb7d=util['format'](_0x4836('0xcb'),_0x1d303c[_0x4836('0xb3')]['id'],_0x1b7208);var _0xcc64b6=path[_0x4836('0xc5')](_0x1a24c0,_0x4dcb7d);var _0x1206ff=[];_0x1206ff[_0x4836('0x30')]({'model':db['Attachment'],'as':_0x4836('0xcc'),'raw':!![]});var _0x54e71c=[{'model':db[_0x4836('0xb7')],'as':_0x4836('0xcd'),'attributes':['id',_0x4836('0xb2'),'createdAt'],'include':_0x1206ff}];return db[_0x4836('0x34')][_0x4836('0x5d')]({'where':{'id':_0x1d303c[_0x4836('0xb3')]['id']},'include':_0x54e71c})[_0x4836('0x27')](handleEntityNotFound(_0x2a6b0b,null))[_0x4836('0x27')](function(_0x2fa96c){if(_0x2fa96c&&_0x2fa96c[_0x4836('0xcd')]){var _0x424313=_0x2fa96c[_0x4836('0xce')]({'plain':!![]});fs[_0x4836('0xcf')](_0x48b596);for(var _0x3b1d14=0x0;_0x3b1d14<_0x424313[_0x4836('0xcd')][_0x4836('0x40')];_0x3b1d14++){var _0x2eaa78=_0x424313[_0x4836('0xcd')][_0x3b1d14][_0x4836('0xcc')];if(_0x2eaa78){var _0x377d87=path[_0x4836('0xc5')](_0x4f832b,_0x2eaa78['basename']);if(fs[_0x4836('0xd0')](_0x377d87)){fs['createReadStream'](_0x377d87)['pipe'](fs[_0x4836('0xd1')](path[_0x4836('0xc5')](_0x48b596,_0x2eaa78[_0x4836('0xd2')])));}}}return BPromise['resolve']()[_0x4836('0x27')](function(){return new BPromise(function(_0x516005,_0x2d3f4b){zipdir(_0x48b596,{'saveTo':_0xcc64b6},function(_0x1cad03,_0x34d924){if(_0x1cad03)return _0x2d3f4b(_0x1cad03);return _0x516005(_0x34d924);});})[_0x4836('0x27')](function(){return new BPromise(function(_0x4704de,_0x316460){rimraf(_0x48b596,function(_0x19b4d5){if(_0x19b4d5)_0x316460(_0x19b4d5);return _0x4704de();});});})[_0x4836('0x27')](function(){return _0x2a6b0b['download'](_0xcc64b6,_0x4dcb7d,function(_0x479119){if(_0x479119){console['log']('err',_0x479119);}else{fs[_0x4836('0xd3')](_0xcc64b6);}});});});}else{return _0x2a6b0b[_0x4836('0x28')](0xc8);}})[_0x4836('0x31')](handleError(_0x2a6b0b,null));}; \ No newline at end of file +var _0x363a=['files','tmp','attachments','join','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./faxInteraction.socket','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','map','fullname','TagIds','Tags','split','forEach','push','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','select','field','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','includeAll','options','create','describe','addMessage','ids','getMessages','findOne','FaxMessage','nolimit','sort','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','color','emit','faxInteractionTags:save','removeTags','download','root','server'];(function(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_0x363a,0x1cc));var _0xa363=function(_0x400b6c,_0x4a6139){_0x400b6c=_0x400b6c-0x0;var _0x4c4e3e=_0x363a[_0x400b6c];return _0x4c4e3e;};'use strict';var emlformat=require(_0xa363('0x0'));var rimraf=require(_0xa363('0x1'));var zipdir=require(_0xa363('0x2'));var jsonpatch=require(_0xa363('0x3'));var rp=require(_0xa363('0x4'));var moment=require('moment');var BPromise=require(_0xa363('0x5'));var Mustache=require(_0xa363('0x6'));var util=require(_0xa363('0x7'));var path=require(_0xa363('0x8'));var sox=require(_0xa363('0x9'));var csv=require(_0xa363('0xa'));var ejs=require(_0xa363('0xb'));var fs=require('fs');var fs_extra=require(_0xa363('0xc'));var _=require(_0xa363('0xd'));var squel=require(_0xa363('0xe'));var crypto=require(_0xa363('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa363('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa363('0x11'));var Papa=require(_0xa363('0x12'));var Redis=require('ioredis');var authService=require(_0xa363('0x13'));var qs=require(_0xa363('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa363('0x15'));var logger=require(_0xa363('0x16'))(_0xa363('0x17'));var utils=require(_0xa363('0x18'));var config=require(_0xa363('0x19'));var licenseUtil=require(_0xa363('0x1a'));var db=require(_0xa363('0x1b'))['db'];config[_0xa363('0x1c')]=_[_0xa363('0x1d')](config[_0xa363('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa363('0x1c')]));require(_0xa363('0x1e'))['register'](socket);function respondWithStatusCode(_0xf7e474,_0x2880c9){_0x2880c9=_0x2880c9||0xcc;return function(_0x1e77da){if(_0x1e77da){return _0xf7e474[_0xa363('0x1f')](_0x2880c9);}return _0xf7e474[_0xa363('0x20')](_0x2880c9)[_0xa363('0x21')]();};}function respondWithResult(_0x3befd3,_0x1384ac){_0x1384ac=_0x1384ac||0xc8;return function(_0x4dca9a){if(_0x4dca9a){return _0x3befd3['status'](_0x1384ac)['json'](_0x4dca9a);}};}function respondWithFilteredResult(_0x177cd7,_0x4e326c){return function(_0x45897c){if(_0x45897c){var _0x57f939=typeof _0x4e326c[_0xa363('0x22')]==='undefined'&&typeof _0x4e326c['limit']===_0xa363('0x23');var _0x44da24=_0x45897c[_0xa363('0x24')];var _0x5a75f9=_0x57f939?0x0:_0x4e326c['offset'];var _0x3f0781=_0x57f939?_0x45897c[_0xa363('0x24')]:_0x4e326c[_0xa363('0x22')]+_0x4e326c[_0xa363('0x25')];var _0x3dc8ea;if(_0x3f0781>=_0x44da24){_0x3f0781=_0x44da24;_0x3dc8ea=0xc8;}else{_0x3dc8ea=0xce;}_0x177cd7[_0xa363('0x20')](_0x3dc8ea);return _0x177cd7[_0xa363('0x26')](_0xa363('0x27'),_0x5a75f9+'-'+_0x3f0781+'/'+_0x44da24)[_0xa363('0x28')](_0x45897c);}return null;};}function patchUpdates(_0x153502){return function(_0x623e03){try{jsonpatch['apply'](_0x623e03,_0x153502,!![]);}catch(_0x214fbd){return BPromise[_0xa363('0x29')](_0x214fbd);}return _0x623e03[_0xa363('0x2a')]();};}function saveUpdates(_0x209d3d,_0x2186d3){return function(_0xa0cc50){if(_0xa0cc50){return _0xa0cc50[_0xa363('0x2b')](_0x209d3d)[_0xa363('0x2c')](function(_0x5b0ed5){return _0x5b0ed5;});}return null;};}function removeEntity(_0x5afc80,_0x4dabc3){return function(_0x1fcfed){if(_0x1fcfed){return _0x1fcfed[_0xa363('0x2d')]()['then'](function(){_0x5afc80['status'](0xcc)[_0xa363('0x21')]();});}};}function handleEntityNotFound(_0x23c3d1,_0x4bb604){return function(_0x196a71){if(!_0x196a71){_0x23c3d1[_0xa363('0x1f')](0x194);}return _0x196a71;};}function handleError(_0x3b79fa,_0x4591fe){_0x4591fe=_0x4591fe||0x1f4;return function(_0x4bd12f){logger[_0xa363('0x2e')](_0x4bd12f['stack']);if(_0x4bd12f[_0xa363('0x2f')]){delete _0x4bd12f[_0xa363('0x2f')];}_0x3b79fa[_0xa363('0x20')](_0x4591fe)[_0xa363('0x30')](_0x4bd12f);};}function getInteractionUsers(_0x46301d,_0x2ba4ba){return new BPromise(function(_0x50598a,_0x24037a){try{if(_0x2ba4ba[_0x46301d['id']]){_0x46301d['Users']=_[_0xa363('0x31')](_0x2ba4ba[_0x46301d['id']],function(_0x57c51c){return{'id':_0x57c51c['id'],'fullname':_0x57c51c[_0xa363('0x32')]};});}}catch(_0x3206e0){_0x24037a(_0x3206e0);}_0x50598a(_0x46301d);});}function getInteractionTags(_0x43396a,_0x1d9955){return new BPromise(function(_0x5143cc,_0x34245c){try{if(_0x43396a[_0xa363('0x33')]){_0x43396a[_0xa363('0x34')]=[];_0x43396a[_0xa363('0x33')][_0xa363('0x35')](',')[_0xa363('0x36')](function(_0x3360b9){_0x43396a[_0xa363('0x34')][_0xa363('0x37')](_0x1d9955[_0x3360b9]);});}delete _0x43396a[_0xa363('0x33')];}catch(_0x1f7632){_0x34245c(_0x1f7632);}_0x5143cc(_0x43396a);});}function updateFaxInteraction(_0xaced40,_0x3937c1,_0x37a597){return new BPromise(function(_0xaad0f2,_0x29b269){return getInteractionUsers(_0xaced40,_0x37a597)[_0xa363('0x2c')](function(_0x33c4ab){return getInteractionTags(_0x33c4ab,_0x3937c1);})[_0xa363('0x2c')](function(_0x5bd8c0){_0xaad0f2(_0x5bd8c0);})[_0xa363('0x38')](function(_0x391512){_0x29b269(_0x391512);});});}exports[_0xa363('0x39')]=function(_0x1885a8,_0x168e62){var _0x192797={},_0x3e4ac5={},_0x471b92={'count':0x0,'rows':[]};var _0x179713=_[_0xa363('0x31')](db[_0xa363('0x3a')][_0xa363('0x3b')],function(_0x2ab3ee){return{'name':_0x2ab3ee[_0xa363('0x3c')],'type':_0x2ab3ee[_0xa363('0x3d')][_0xa363('0x3e')]};});_0x3e4ac5[_0xa363('0x3f')]=_[_0xa363('0x31')](_0x179713,'name');_0x3e4ac5['query']=_[_0xa363('0x40')](_0x1885a8[_0xa363('0x41')]);_0x3e4ac5[_0xa363('0x42')]=_[_0xa363('0x43')](_0x3e4ac5[_0xa363('0x3f')],_0x3e4ac5['query']);_0x192797[_0xa363('0x44')]=_[_0xa363('0x43')](_0x3e4ac5['model'],qs[_0xa363('0x45')](_0x1885a8['query'][_0xa363('0x45')]));_0x192797[_0xa363('0x44')]=_0x192797[_0xa363('0x44')][_0xa363('0x46')]?_0x192797[_0xa363('0x44')]:_0x3e4ac5['model'];if(!_0x1885a8[_0xa363('0x41')][_0xa363('0x47')]('nolimit')){_0x192797[_0xa363('0x25')]=qs['limit'](_0x1885a8[_0xa363('0x41')][_0xa363('0x25')]);_0x192797[_0xa363('0x22')]=qs[_0xa363('0x22')](_0x1885a8[_0xa363('0x41')][_0xa363('0x22')]);}_0x192797[_0xa363('0x48')]=qs['sort'](_0x1885a8[_0xa363('0x41')]['sort']);_0x192797[_0xa363('0x49')]=qs[_0xa363('0x42')](_[_0xa363('0x4a')](_0x1885a8[_0xa363('0x41')],_0x3e4ac5[_0xa363('0x42')]),_0x179713);var _0x3661ef=[];var _0x45d94d=squel[_0xa363('0x4b')]()['field']('id')[_0xa363('0x4c')]('name')[_0xa363('0x4c')]('color')['from'](_0xa363('0x4d'));var _0x5aabf2=squel[_0xa363('0x4b')]()[_0xa363('0x4c')](_0xa363('0x4e'))[_0xa363('0x4c')](_0xa363('0x4f'))['field'](_0xa363('0x50'))[_0xa363('0x51')]('user_has_fax_interactions','ui')[_0xa363('0x52')](_0xa363('0x53'),'u',_0xa363('0x54'));var _0x1d740c=squel[_0xa363('0x4b')]()[_0xa363('0x51')]('fax_interactions','i')[_0xa363('0x52')](_0xa363('0x55'),'c',_0xa363('0x56'))[_0xa363('0x52')](_0xa363('0x53'),'o',_0xa363('0x57'))[_0xa363('0x52')](_0xa363('0x58'),'a',_0xa363('0x59'))[_0xa363('0x52')](_0xa363('0x5a'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xa363('0x52')](_0xa363('0x5b'),'it','it.FaxInteractionId\x20=\x20i.id')[_0xa363('0x52')](_0xa363('0x4d'),'t',_0xa363('0x5c'));var _0x312ac4=squel[_0xa363('0x5d')]();var _0x1397d0=[];var _0x381893=squel[_0xa363('0x5d')]();var _0x3fb4e1;if(_0x1885a8[_0xa363('0x41')]['search']){_0x3fb4e1=as[_0xa363('0x5e')](_0x1885a8[_0xa363('0x41')]['search']);var _0x406d62=_0x3fb4e1['sqlOperator'];for(var _0x46782a=0x0;_0x46782a<_0x3fb4e1['conditions']['length'];_0x46782a++){var _0x288403=_0x3fb4e1[_0xa363('0x5f')][_0x46782a];var _0x3caf4b='i';var _0x42f1a2=_[_0xa363('0x60')](_0x179713,[_0xa363('0x2f'),_0x288403[_0xa363('0x4c')]]);if(!_0x42f1a2){switch(_0x288403[_0xa363('0x4c')]){case'unreadMessages':if(_0x288403[_0xa363('0x61')]==0x1){_0x1d740c[_0xa363('0x62')]('`'+_0x288403['field']+_0xa363('0x63'));}else{_0x1d740c[_0xa363('0x62')]('`'+_0x288403[_0xa363('0x4c')]+_0xa363('0x64'));}break;case _0xa363('0x65'):if(_0x288403[_0xa363('0x66')]==='$substring'){if(_0x288403[_0xa363('0x61')][_0xa363('0x35')]('\x20')[_0xa363('0x46')]>0x1){_0x312ac4[_0x406d62](_0xa363('0x67'),qs[_0xa363('0x68')](_0x288403[_0xa363('0x61')]),null);}else{var _0x3f1e2b='%'+_0x288403[_0xa363('0x61')]+'%';_0x312ac4[_0x406d62](_0xa363('0x69'),_0x3f1e2b,_0x3f1e2b,_0x3f1e2b);}}else{_0x42f1a2=_[_0xa363('0x60')](_0x179713,['name',_0xa363('0x6a')]);_0x288403[_0xa363('0x4c')]=_0xa363('0x6a');_0x44c308=as[_0xa363('0x6b')](_0x3caf4b,_0x42f1a2[_0xa363('0x3d')],_0x288403);_0x312ac4[_0x406d62](_0x44c308[_0xa363('0x6c')],_0x44c308[_0xa363('0x61')][_0xa363('0x6d')],_0x44c308['value'][_0xa363('0x21')]);}break;case _0xa363('0x6e'):var _0x7d81b4=_0x288403[_0xa363('0x61')][_0xa363('0x35')](',')[_0xa363('0x31')](function(_0x16f3b4){return Number(_0x16f3b4);});_0x7d81b4[_0xa363('0x36')](function(_0x382d61){_0x381893['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x382d61+',%');});_0x1397d0=_[_0xa363('0x6f')](_0x1397d0,_0x7d81b4);break;case'User':if(_0x288403['operator']==='$substring'){_0x312ac4[_0x406d62](_0xa363('0x70'),'%'+_0x288403[_0xa363('0x61')]+'%',null);}else{_0x42f1a2=_['find'](_0x179713,[_0xa363('0x2f'),_0xa363('0x71')]);_0x288403['field']='UserId';_0x44c308=as[_0xa363('0x6b')](_0x3caf4b,_0x42f1a2[_0xa363('0x3d')],_0x288403);_0x312ac4[_0x406d62](_0x44c308[_0xa363('0x6c')],_0x44c308['value'][_0xa363('0x6d')],_0x44c308[_0xa363('0x61')][_0xa363('0x21')]);}break;case _0xa363('0x72'):_0x44c308=as[_0xa363('0x6b')]('me',null,_0x288403);_0x312ac4[_0x406d62](_0x44c308[_0xa363('0x6c')],_0x44c308[_0xa363('0x61')][_0xa363('0x6d')],_0x44c308[_0xa363('0x61')][_0xa363('0x21')]);break;}}else{var _0x44c308=as[_0xa363('0x6b')](_0x3caf4b,_0x42f1a2[_0xa363('0x3d')],_0x288403);_0x312ac4[_0x406d62](_0x44c308['text'],_0x44c308[_0xa363('0x61')]['start'],_0x44c308[_0xa363('0x61')]['end']);}}}else{var _0x343cb8=_(_0x1885a8[_0xa363('0x41')])[_0xa363('0x40')]()[_0xa363('0x31')](function(_0x841049){return _[_0xa363('0x73')](_0x179713,[_0xa363('0x2f'),_0x841049])?_0x841049:undefined;})[_0xa363('0x74')]()[_0xa363('0x61')]();if(!_[_0xa363('0x75')](_0x343cb8)){_0x343cb8[_0xa363('0x36')](function(_0x3988d4){if(_0x3988d4===_0xa363('0x76')){_0x1d740c[_0xa363('0x49')](_0xa363('0x77'),[][_0xa363('0x78')](_0x1885a8[_0xa363('0x41')][_0x3988d4]));}else if(_0x3988d4===_0xa363('0x79')){var _0x415a58=JSON[_0xa363('0x7a')](_0x1885a8[_0xa363('0x41')][_0x3988d4])[_0xa363('0x7b')];var _0xec404b=JSON['parse'](_0x1885a8[_0xa363('0x41')][_0x3988d4])[_0xa363('0x7c')];_0x1d740c[_0xa363('0x49')](_0xa363('0x7d'),_0x415a58,_0xec404b);}else{if(_0x1885a8[_0xa363('0x41')][_0x3988d4]===_0xa363('0x7e')){_0x1d740c[_0xa363('0x49')]('i.'+_0x3988d4+_0xa363('0x7f'));}else{_0x1d740c[_0xa363('0x49')]('i.'+_0x3988d4+'\x20=\x20?',_0x1885a8[_0xa363('0x41')][_0x3988d4]);}}});}if(_0x1885a8[_0xa363('0x41')][_0xa363('0x80')]){if(_0x1885a8[_0xa363('0x41')][_0xa363('0x80')]==0x1){_0x1d740c['having']('`unreadMessages`\x20=\x200');}else{_0x1d740c[_0xa363('0x62')](_0xa363('0x81'));}}if(_0x1885a8['query'][_0xa363('0x82')]){_0x1397d0=_[_0xa363('0x83')](_0x1885a8[_0xa363('0x41')][_0xa363('0x82')])?_0x1885a8[_0xa363('0x41')]['tag']:new Array(_0x1885a8['query'][_0xa363('0x82')]);_0x1397d0['forEach'](function(_0x420472){_0x381893['or'](_0xa363('0x84'),'%,'+_0x420472+',%');});}if(_0x1885a8[_0xa363('0x41')][_0xa363('0x85')]){var _0x3daf7e=_0x1885a8[_0xa363('0x41')][_0xa363('0x85')][_0xa363('0x86')]('\x5c','\x5c\x5c')[_0xa363('0x86')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3daf7e)){_0x312ac4['or'](_0xa363('0x87'),_0x3daf7e+'%')['or'](_0xa363('0x88'),_0x3daf7e+'%');}_0x312ac4['or'](_0xa363('0x89'),_0x3daf7e+'%');}}_0x1d740c[_0xa363('0x49')](_0x312ac4);_0x1d740c['group']('i.id');var _0x47baf0={'type':db[_0xa363('0x8a')][_0xa363('0x8b')]['SELECT'],'raw':!![]};var _0x298a5a=_0x1d740c[_0xa363('0x8c')]();_0x298a5a[_0xa363('0x4c')](_0xa363('0x8d'));_0x298a5a[_0xa363('0x4c')](_0xa363('0x8e'),_0xa363('0x8f'));if(_0x192797[_0xa363('0x48')]){_0x192797[_0xa363('0x48')][_0xa363('0x36')](function(_0x270cf0){var _0x326128=_0x270cf0[0x0]===_0xa363('0x90')?_0x270cf0[0x0]:'i.'+_0x270cf0[0x0];_0x1d740c['order'](_0x326128,_0x270cf0[0x1]===_0xa363('0x91')?![]:!![]);});}if(!_['isEmpty'](_0x1397d0)){_0x1d740c[_0xa363('0x62')](_0x381893);_0x298a5a[_0xa363('0x49')](_0xa363('0x92'),_0x1397d0);}BPromise[_0xa363('0x93')]()[_0xa363('0x2c')](function(){if(!_0x3fb4e1){if(_0x1885a8[_0xa363('0x41')][_0xa363('0x76')])return;_0x298a5a[_0xa363('0x49')](_0xa363('0x94'));_0x1d740c[_0xa363('0x49')](_0xa363('0x94'));return;}if(_0x1885a8[_0xa363('0x95')][_0xa363('0x96')]!==_0xa363('0x97'))return;return _0x1885a8[_0xa363('0x95')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xa363('0x2c')](function(_0x1f0d92){if(_[_0xa363('0x75')](_0x1f0d92)){_0x298a5a['where'](_0xa363('0x98'));_0x1d740c[_0xa363('0x49')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x298a5a['where'](_0xa363('0x77'),_[_0xa363('0x31')](_0x1f0d92,'id'));_0x1d740c[_0xa363('0x49')](_0xa363('0x77'),_[_0xa363('0x31')](_0x1f0d92,'id'));}});})['then'](function(){if(_0x1885a8['user'][_0xa363('0x96')]===_0xa363('0x97')&&!_0x3fb4e1&&!_0x1885a8[_0xa363('0x41')][_0xa363('0x76')])return[];return db[_0xa363('0x99')][_0xa363('0x41')](_0x298a5a[_0xa363('0x9a')](),_0x47baf0);})[_0xa363('0x2c')](function(_0x120535){_0x471b92[_0xa363('0x24')]=_0x120535[_0xa363('0x46')];if(_0x471b92['count']===0x0)return[];return db[_0xa363('0x99')][_0xa363('0x41')](_0x45d94d[_0xa363('0x9a')](),_0x47baf0)[_0xa363('0x2c')](function(_0xc794c6){_0x3661ef=_[_0xa363('0x9b')](_0xc794c6,'id');_0x47baf0=_[_0xa363('0x9c')](_0x47baf0,{'model':db[_0xa363('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1885a8[_0xa363('0x41')][_0xa363('0x45')]){_0x192797[_0xa363('0x44')][_0xa363('0x36')](function(_0x45d933){_0x1d740c[_0xa363('0x4c')]('i.'+_0x45d933);});}else{_0x1d740c[_0xa363('0x4c')](_0xa363('0x8e'),_0xa363('0x8f'));_0x1d740c[_0xa363('0x4c')](_0xa363('0x9d'),_0xa363('0x9e'));_0x1d740c[_0xa363('0x4c')]('a.mandatoryDisposition',_0xa363('0x9f'));_0x1d740c[_0xa363('0x4c')](_0xa363('0xa0'),_0xa363('0x90'));_0x1d740c[_0xa363('0x4c')](_0xa363('0xa1'));_0x1d740c[_0xa363('0x4c')](_0xa363('0xa2'),_0xa363('0xa3'));_0x1d740c[_0xa363('0x4c')]('c.lastName',_0xa363('0xa4'));_0x1d740c['field']('c.email',_0xa363('0xa5'));_0x1d740c[_0xa363('0x4c')](_0xa363('0xa6'),_0xa363('0xa7'));_0x1d740c[_0xa363('0x4c')](_0xa363('0xa8'),_0xa363('0xa9'));_0x1d740c[_0xa363('0x4c')](_0xa363('0xaa'),'Contact.fax');_0x1d740c['field'](_0xa363('0xab'),_0xa363('0xac'));_0x1d740c[_0xa363('0x4c')](_0xa363('0xad'),_0xa363('0xae'));_0x1d740c[_0xa363('0x4c')](_0xa363('0xaf'),_0xa363('0x33'));}if(_0x192797[_0xa363('0x25')])_0x1d740c[_0xa363('0x25')](_0x192797[_0xa363('0x25')]);if(_0x192797[_0xa363('0x22')])_0x1d740c['offset'](_0x192797[_0xa363('0x22')]);return db[_0xa363('0x99')][_0xa363('0x41')](_0x1d740c[_0xa363('0x9a')](),_0x47baf0);})['then'](function(_0x56851e){if(_0x56851e[_0xa363('0x46')]>0x0)_0x5aabf2[_0xa363('0x49')](_0xa363('0xb0'),_['map'](_0x56851e,'id'));return db[_0xa363('0x99')]['query'](_0x5aabf2[_0xa363('0x9a')](),_0x47baf0)[_0xa363('0x2c')](function(_0x2757fa){var _0x400f9c=_[_0xa363('0xb1')](_0x2757fa,_0xa363('0xb2'));var _0xbb321e=[];_0x56851e[_0xa363('0x36')](function(_0x4706e1){_0xbb321e[_0xa363('0x37')](updateFaxInteraction(_0x4706e1,_0x3661ef,_0x400f9c));});return BPromise[_0xa363('0xb3')](_0xbb321e);});});})['then'](function(_0x9bd6){_0x471b92[_0xa363('0xb4')]=_0x9bd6;return _0x471b92;})[_0xa363('0x2c')](respondWithFilteredResult(_0x168e62,_0x192797))[_0xa363('0x38')](handleError(_0x168e62,null));};exports[_0xa363('0xb5')]=function(_0x38d025,_0x2fb56b){var _0x59c17d={'raw':![],'where':{'id':_0x38d025[_0xa363('0xb6')]['id']}},_0x2282ed={};_0x2282ed[_0xa363('0x3f')]=_[_0xa363('0x40')](db[_0xa363('0x3a')][_0xa363('0x3b')]);_0x2282ed['query']=_[_0xa363('0x40')](_0x38d025[_0xa363('0x41')]);_0x2282ed['filters']=_[_0xa363('0x43')](_0x2282ed[_0xa363('0x3f')],_0x2282ed[_0xa363('0x41')]);_0x59c17d['attributes']=_['intersection'](_0x2282ed['model'],qs[_0xa363('0x45')](_0x38d025[_0xa363('0x41')][_0xa363('0x45')]));_0x59c17d['attributes']=_0x59c17d[_0xa363('0x44')][_0xa363('0x46')]?_0x59c17d['attributes']:_0x2282ed['model'];if(_0x38d025['query'][_0xa363('0xb7')]){_0x59c17d['include']=[{'all':!![]}];}_0x59c17d=_[_0xa363('0x9c')]({},_0x59c17d,_0x38d025[_0xa363('0xb8')]);return db[_0xa363('0x3a')]['find'](_0x59c17d)[_0xa363('0x2c')](handleEntityNotFound(_0x2fb56b,null))['then'](respondWithResult(_0x2fb56b,null))[_0xa363('0x38')](handleError(_0x2fb56b,null));};exports[_0xa363('0xb9')]=function(_0x1074e5,_0x5b497c){return db[_0xa363('0x3a')][_0xa363('0xb9')](_0x1074e5[_0xa363('0x72')],{})[_0xa363('0x2c')](respondWithResult(_0x5b497c,0xc9))[_0xa363('0x38')](handleError(_0x5b497c,null));};exports['update']=function(_0x499986,_0x10e204){if(_0x499986[_0xa363('0x72')]['id']){delete _0x499986[_0xa363('0x72')]['id'];}return db[_0xa363('0x3a')][_0xa363('0x60')]({'where':{'id':_0x499986['params']['id']}})['then'](handleEntityNotFound(_0x10e204,null))[_0xa363('0x2c')](saveUpdates(_0x499986['body'],null))['then'](respondWithResult(_0x10e204,null))[_0xa363('0x38')](handleError(_0x10e204,null));};exports[_0xa363('0x2d')]=function(_0x4b49c1,_0x3aa069){return db['FaxInteraction']['find']({'where':{'id':_0x4b49c1[_0xa363('0xb6')]['id']}})[_0xa363('0x2c')](handleEntityNotFound(_0x3aa069,null))['then'](removeEntity(_0x3aa069,null))[_0xa363('0x38')](handleError(_0x3aa069,null));};exports['describe']=function(_0x4048c9,_0x5e60e7){return db[_0xa363('0x3a')][_0xa363('0xba')]()[_0xa363('0x2c')](respondWithResult(_0x5e60e7,null))[_0xa363('0x38')](handleError(_0x5e60e7,null));};exports[_0xa363('0xbb')]=function(_0x67c50e,_0x19dc03,_0x9351d){return db['FaxMessage'][_0xa363('0x60')]({'where':{'id':_0x67c50e[_0xa363('0xb6')]['id']}})['then'](handleEntityNotFound(_0x19dc03,null))['then'](function(_0x22520a){if(_0x22520a){return _0x22520a['addMessage'](_0x67c50e['body']['ids'],_['omit'](_0x67c50e[_0xa363('0x72')],[_0xa363('0xbc'),'id'])||{});}})[_0xa363('0x2c')](respondWithResult(_0x19dc03,null))[_0xa363('0x38')](handleError(_0x19dc03,null));};exports[_0xa363('0xbd')]=function(_0x51f548,_0x35b789,_0x47ab22){var _0x49e301={'raw':![],'where':{}};var _0x1e4937={};var _0x28543b={'count':0x0,'rows':[]};return db[_0xa363('0x3a')][_0xa363('0xbe')]({'where':{'id':_0x51f548[_0xa363('0xb6')]['id']}})['then'](handleEntityNotFound(_0x35b789,null))[_0xa363('0x2c')](function(_0x365cc0){if(_0x365cc0){_0x1e4937[_0xa363('0x3f')]=_['keys'](db[_0xa363('0xbf')]['rawAttributes']);_0x1e4937[_0xa363('0x41')]=_[_0xa363('0x40')](_0x51f548[_0xa363('0x41')]);_0x1e4937['filters']=_[_0xa363('0x43')](_0x1e4937['model'],_0x1e4937[_0xa363('0x41')]);_0x49e301[_0xa363('0x44')]=_[_0xa363('0x43')](_0x1e4937[_0xa363('0x3f')],qs['fields'](_0x51f548['query'][_0xa363('0x45')]));_0x49e301['attributes']=_0x49e301['attributes'][_0xa363('0x46')]?_0x49e301[_0xa363('0x44')]:_0x1e4937[_0xa363('0x3f')];if(!_0x51f548['query'][_0xa363('0x47')](_0xa363('0xc0'))){_0x49e301[_0xa363('0x25')]=qs[_0xa363('0x25')](_0x51f548[_0xa363('0x41')]['limit']);_0x49e301['offset']=qs[_0xa363('0x22')](_0x51f548[_0xa363('0x41')]['offset']);}_0x49e301['order']=qs['sort'](_0x51f548[_0xa363('0x41')][_0xa363('0xc1')]);_0x49e301[_0xa363('0x49')]=qs['filters'](_['pick'](_0x51f548['query'],_0x1e4937[_0xa363('0x42')]));_0x49e301[_0xa363('0x49')][_0xa363('0xb2')]=_0x365cc0['id'];if(_0x51f548[_0xa363('0x41')][_0xa363('0x85')]){_0x49e301[_0xa363('0x49')]=_[_0xa363('0x9c')](_0x49e301[_0xa363('0x49')],{'$or':_['map'](_0x49e301['attributes'],function(_0x3be759){var _0x1d4d9e={};_0x1d4d9e[_0x3be759]={'$like':'%'+_0x51f548[_0xa363('0x41')][_0xa363('0x85')]+'%'};return _0x1d4d9e;})});}if(_0x51f548[_0xa363('0x41')][_0xa363('0x7b')]){var _0x380306=_0x51f548[_0xa363('0x41')][_0xa363('0x7b')][_0xa363('0x35')](',');var _0x1c83ff={};_0x1c83ff[_0x380306[0x0]]={'$gte':moment(_0x380306[0x1])[_0xa363('0xc2')](_0xa363('0xc3'))};_0x49e301[_0xa363('0x49')]=_[_0xa363('0x9c')](_0x49e301[_0xa363('0x49')],_0x1c83ff);}_0x49e301=_[_0xa363('0x9c')]({},_0x49e301,_0x51f548[_0xa363('0xb8')]);return db[_0xa363('0xbf')][_0xa363('0x24')]({'where':_0x49e301[_0xa363('0x49')]})['then'](function(_0x505638){_0x28543b[_0xa363('0x24')]=_0x505638;if(_0x51f548['query'][_0xa363('0xb7')]){_0x49e301['include']=[{'all':!![]}];}return db[_0xa363('0xbf')][_0xa363('0xc4')](_0x49e301);})[_0xa363('0x2c')](function(_0x199770){_0x28543b['rows']=_0x199770;return _0x28543b;});}})[_0xa363('0x2c')](respondWithFilteredResult(_0x35b789,_0x49e301))[_0xa363('0x38')](handleError(_0x35b789,null));};exports['addTags']=function(_0x2d4edd,_0x4c6e8f,_0x507d54){return db[_0xa363('0x3a')][_0xa363('0x60')]({'where':{'id':_0x2d4edd[_0xa363('0xb6')]['id']}})[_0xa363('0x2c')](handleEntityNotFound(_0x4c6e8f,null))[_0xa363('0x2c')](function(_0x5ddabe){if(_0x5ddabe){return _0x5ddabe[_0xa363('0xc5')](_0x2d4edd[_0xa363('0x72')][_0xa363('0xbc')],_['omit'](_0x2d4edd[_0xa363('0x72')],[_0xa363('0xbc'),'id'])||{})[_0xa363('0xc6')](function(){return db[_0xa363('0x6e')][_0xa363('0xc4')]({'attributes':['id',_0xa363('0x2f'),_0xa363('0xc7')],'where':{'id':_0x2d4edd[_0xa363('0x72')]['ids']}});})[_0xa363('0x2c')](function(_0x58ddc0){socket[_0xa363('0xc8')](_0xa363('0xc9'),{'id':Number(_0x2d4edd[_0xa363('0xb6')]['id']),'tags':_0x58ddc0||[]});return{'id':Number(_0x2d4edd[_0xa363('0xb6')]['id']),'tags':_0x58ddc0||[]};});}})[_0xa363('0x2c')](respondWithResult(_0x4c6e8f,null))[_0xa363('0x38')](handleError(_0x4c6e8f,null));};exports[_0xa363('0xca')]=function(_0x277301,_0x1787ab,_0x469584){return db['FaxInteraction']['find']({'where':{'id':_0x277301['params']['id']}})['then'](handleEntityNotFound(_0x1787ab,null))['then'](function(_0x138c38){if(_0x138c38){return _0x138c38[_0xa363('0xca')](_0x277301[_0xa363('0x41')][_0xa363('0xbc')]);}})['then'](respondWithStatusCode(_0x1787ab,null))[_0xa363('0x38')](handleError(_0x1787ab,null));};exports[_0xa363('0xcb')]=function(_0x443a7a,_0x4b4b97){var _0x385bb0=moment()['unix']()[_0xa363('0x9a')]();var _0x378332=path['join'](config[_0xa363('0xcc')],_0xa363('0xcd'),_0xa363('0xce'),_0xa363('0xcf'));var _0x540e64=path['join'](config[_0xa363('0xcc')],'server',_0xa363('0xce'),_0xa363('0xd0'));var _0x2bdfc2=path[_0xa363('0xd1')](_0x378332,_0x385bb0);var _0x34e5b3=util[_0xa363('0xc2')](_0xa363('0xd2'),_0x443a7a[_0xa363('0xb6')]['id'],_0x385bb0);var _0x242c8c=path[_0xa363('0xd1')](_0x378332,_0x34e5b3);var _0x55ac86=[];_0x55ac86[_0xa363('0x37')]({'model':db[_0xa363('0xd3')],'as':_0xa363('0xd3'),'raw':!![]});var _0x579d2a=[{'model':db[_0xa363('0xbf')],'as':_0xa363('0xd4'),'attributes':['id',_0xa363('0x72'),_0xa363('0x79')],'include':_0x55ac86}];return db['FaxInteraction'][_0xa363('0x60')]({'where':{'id':_0x443a7a[_0xa363('0xb6')]['id']},'include':_0x579d2a})[_0xa363('0x2c')](handleEntityNotFound(_0x4b4b97,null))[_0xa363('0x2c')](function(_0x12138d){if(_0x12138d&&_0x12138d[_0xa363('0xd4')]){var _0x296f2a=_0x12138d[_0xa363('0xd5')]({'plain':!![]});fs[_0xa363('0xd6')](_0x2bdfc2);for(var _0x2f5e87=0x0;_0x2f5e87<_0x296f2a[_0xa363('0xd4')][_0xa363('0x46')];_0x2f5e87++){var _0x18736c=_0x296f2a[_0xa363('0xd4')][_0x2f5e87]['Attachment'];if(_0x18736c){var _0x2a63e4=path['join'](_0x540e64,_0x18736c[_0xa363('0xd7')]);if(fs[_0xa363('0xd8')](_0x2a63e4)){fs[_0xa363('0xd9')](_0x2a63e4)[_0xa363('0xda')](fs[_0xa363('0xdb')](path[_0xa363('0xd1')](_0x2bdfc2,_0x18736c[_0xa363('0xd7')])));}}}return BPromise[_0xa363('0x93')]()[_0xa363('0x2c')](function(){return new BPromise(function(_0xaf938c,_0xd6f7ed){zipdir(_0x2bdfc2,{'saveTo':_0x242c8c},function(_0x26df25,_0x2511c9){if(_0x26df25)return _0xd6f7ed(_0x26df25);return _0xaf938c(_0x2511c9);});})[_0xa363('0x2c')](function(){return new BPromise(function(_0x1fd64a,_0x412da7){rimraf(_0x2bdfc2,function(_0x48c195){if(_0x48c195)_0x412da7(_0x48c195);return _0x1fd64a();});});})[_0xa363('0x2c')](function(){return _0x4b4b97[_0xa363('0xcb')](_0x242c8c,_0x34e5b3,function(_0x20d634){if(_0x20d634){console['log'](_0xa363('0xdc'),_0x20d634);}else{fs[_0xa363('0xdd')](_0x242c8c);}});});});}else{return _0x4b4b97[_0xa363('0x1f')](0xc8);}})[_0xa363('0x38')](handleError(_0x4b4b97,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index b440d8e..dcab9c4 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 _0xed1c=['update','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save'];(function(_0x55b037,_0x2d9392){var _0x5f1053=function(_0x7a13d4){while(--_0x7a13d4){_0x55b037['push'](_0x55b037['shift']());}};_0x5f1053(++_0x2d9392);}(_0xed1c,0xd8));var _0xced1=function(_0x2405bb,_0x5c9e3e){_0x2405bb=_0x2405bb-0x0;var _0x5e5fe9=_0xed1c[_0x2405bb];return _0x5e5fe9;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xced1('0x0'))['db'][_0xced1('0x1')];var FaxMessage=require(_0xced1('0x0'))['db'][_0xced1('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xced1('0x3')](0x0);var events={'afterCreate':_0xced1('0x4'),'afterUpdate':_0xced1('0x5'),'afterDestroy':_0xced1('0x6')};function emitEvent(_0x123bf4){return function(_0x2c9f26,_0x41d482,_0x464983){_0x2c9f26['getUsers']({'attributes':['id'],'raw':!![]})[_0xced1('0x7')](function(_0x3ed82a){_0x2c9f26[_0xced1('0x8')]('Users',_0x3ed82a[_0xced1('0x9')](function(_0x53d4e0){return{'id':_0x53d4e0['id']};}));return FaxMessage[_0xced1('0xa')]({'where':{'FaxInteractionId':_0x2c9f26['id'],'direction':'in','read':![]},'raw':!![]});})[_0xced1('0x7')](function(_0x329ca1){_0x2c9f26[_0xced1('0x8')](_0xced1('0xb'),_0x329ca1[_0xced1('0xc')]);FaxInteractionEvents[_0xced1('0xd')](_0x123bf4+':'+_0x2c9f26['id'],_0x2c9f26);FaxInteractionEvents[_0xced1('0xd')](_0x123bf4,_0x2c9f26);_0x464983(null);})['catch'](_0x464983(null));};}for(var e in events){if(events[_0xced1('0xe')](e)){var event=events[e];FaxInteraction[_0xced1('0xf')](e,emitEvent(event));}}module[_0xced1('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0xb71d=['events','../../mysqldb','FaxInteraction','save','update','getUsers','setDataValue','map','unreadMessages','length','catch','hook'];(function(_0x197c9a,_0x2729c1){var _0x53ff6e=function(_0x5c0569){while(--_0x5c0569){_0x197c9a['push'](_0x197c9a['shift']());}};_0x53ff6e(++_0x2729c1);}(_0xb71d,0x120));var _0xdb71=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb71d[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require(_0xdb71('0x0'));var FaxInteraction=require(_0xdb71('0x1'))['db'][_0xdb71('0x2')];var FaxMessage=require(_0xdb71('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdb71('0x3'),'afterUpdate':_0xdb71('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1e573b){return function(_0x4cb3fe,_0x40421f,_0x55d9d2){_0x4cb3fe[_0xdb71('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x40549c){_0x4cb3fe[_0xdb71('0x6')]('Users',_0x40549c[_0xdb71('0x7')](function(_0x2473de){return{'id':_0x2473de['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x4cb3fe['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x368926){_0x4cb3fe[_0xdb71('0x6')](_0xdb71('0x8'),_0x368926[_0xdb71('0x9')]);FaxInteractionEvents['emit'](_0x1e573b+':'+_0x4cb3fe['id'],_0x4cb3fe);FaxInteractionEvents['emit'](_0x1e573b,_0x4cb3fe);_0x55d9d2(null);})[_0xdb71('0xa')](_0x55d9d2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xdb71('0xb')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 2ec4578..6215288 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 _0x4996=['path','rimraf','./faxInteraction.attributes','exports','changed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3fde75,_0x12d1bb){var _0x2e1d66=function(_0x2bff84){while(--_0x2bff84){_0x3fde75['push'](_0x3fde75['shift']());}};_0x2e1d66(++_0x12d1bb);}(_0x4996,0x173));var _0x6499=function(_0x26d9b3,_0x591f4e){_0x26d9b3=_0x26d9b3-0x0;var _0x15c226=_0x4996[_0x26d9b3];return _0x15c226;};'use strict';var _=require(_0x6499('0x0'));var util=require(_0x6499('0x1'));var logger=require(_0x6499('0x2'))(_0x6499('0x3'));var moment=require(_0x6499('0x4'));var BPromise=require(_0x6499('0x5'));var rp=require(_0x6499('0x6'));var fs=require('fs');var path=require(_0x6499('0x7'));var rimraf=require(_0x6499('0x8'));var config=require('../../config/environment');var attributes=require(_0x6499('0x9'));module[_0x6499('0xa')]=function(_0xb7aca3,_0x2714f0){return _0xb7aca3['define']('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50e7eb,_0x33338f,_0x381001){if(_0x50e7eb[_0x6499('0xb')]('closed')){_0x50e7eb[_0x6499('0xc')]=moment()[_0x6499('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x381001(null,_0x50e7eb);}}});}; \ No newline at end of file +var _0x233b=['closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','FaxInteraction','fax_interactions','changed','closed'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x233b,0x92));var _0xb233=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x233b[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xb233('0x0'));var logger=require(_0xb233('0x1'))(_0xb233('0x2'));var moment=require(_0xb233('0x3'));var BPromise=require(_0xb233('0x4'));var rp=require(_0xb233('0x5'));var fs=require('fs');var path=require(_0xb233('0x6'));var rimraf=require(_0xb233('0x7'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0xb233('0x8')]=function(_0x242c36,_0x44fe0f){return _0x242c36[_0xb233('0x9')](_0xb233('0xa'),attributes,{'tableName':_0xb233('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x53ecf6,_0x3f8314,_0x39d9c2){if(_0x53ecf6[_0xb233('0xc')](_0xb233('0xd'))){_0x53ecf6[_0xb233('0xe')]=moment()['format'](_0xb233('0xf'));}_0x39d9c2(null,_0x53ecf6);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 1f00f0c..bce9d4e 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 _0x4934=['AddTags','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','localhost','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','where','limit','stringify','AddTagsToFaxInteraction','find','addTags','ids','omit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4934,0xb5));var _0x4493=function(_0xfb0fd,_0x5a0728){_0xfb0fd=_0xfb0fd-0x0;var _0x320763=_0x4934[_0xfb0fd];return _0x320763;};'use strict';var _=require('lodash');var util=require(_0x4493('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4493('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4493('0x2'))['db'];var utils=require(_0x4493('0x3'));var logger=require(_0x4493('0x4'))(_0x4493('0x5'));var config=require(_0x4493('0x6'));var jayson=require(_0x4493('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x4493('0x8')](config['redis'],{'host':_0x4493('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4493('0xa'))[_0x4493('0xb')](socket);function respondWithRpcPromise(_0x293766,_0x18e597,_0x2a3510){return new BPromise(function(_0x2bba78,_0x4f5e2f){return client[_0x4493('0xc')](_0x293766,_0x2a3510)[_0x4493('0xd')](function(_0xbe58da){logger[_0x4493('0xe')](_0x4493('0xf'),_0x18e597,_0x4493('0x10'));logger[_0x4493('0x11')](_0x4493('0x12'),_0x18e597,'request\x20sent',JSON['stringify'](_0xbe58da));if(_0xbe58da[_0x4493('0x13')]){if(_0xbe58da['error']['code']===0x1f4){logger[_0x4493('0x13')](_0x4493('0xf'),_0x18e597,_0xbe58da[_0x4493('0x13')][_0x4493('0x14')]);return _0x4f5e2f(_0xbe58da[_0x4493('0x13')][_0x4493('0x14')]);}logger[_0x4493('0x13')](_0x4493('0xf'),_0x18e597,_0xbe58da[_0x4493('0x13')][_0x4493('0x14')]);return _0x2bba78(_0xbe58da[_0x4493('0x13')][_0x4493('0x14')]);}else{logger['info'](_0x4493('0xf'),_0x18e597,_0x4493('0x10'));_0x2bba78(_0xbe58da[_0x4493('0x15')][_0x4493('0x14')]);}})[_0x4493('0x16')](function(_0x376ae2){logger[_0x4493('0x13')](_0x4493('0xf'),_0x18e597,_0x376ae2);_0x4f5e2f(_0x376ae2);});});}exports[_0x4493('0x17')]=function(_0x2699d7){var _0xb64de1=this;return new Promise(function(_0x3e9b98,_0x561eb4){return db[_0x4493('0x18')]['update'](_0x2699d7[_0x4493('0x19')],{'raw':_0x2699d7[_0x4493('0x1a')]?_0x2699d7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2699d7[_0x4493('0x1a')]?_0x2699d7[_0x4493('0x1a')][_0x4493('0x1b')]||null:null,'attributes':_0x2699d7[_0x4493('0x1a')]?_0x2699d7[_0x4493('0x1a')]['attributes']||null:null,'limit':_0x2699d7[_0x4493('0x1a')]?_0x2699d7['options'][_0x4493('0x1c')]||null:null})[_0x4493('0xd')](function(_0x4bb697){logger[_0x4493('0xe')](_0x4493('0x17'),_0x2699d7);logger[_0x4493('0x11')](_0x4493('0x17'),_0x2699d7,JSON[_0x4493('0x1d')](_0x4bb697));_0x3e9b98(_0x4bb697);})[_0x4493('0x16')](function(_0x3d3bb0){logger[_0x4493('0x13')](_0x4493('0x17'),_0x3d3bb0['message'],_0x2699d7);_0x561eb4(_0xb64de1[_0x4493('0x13')](0x1f4,_0x3d3bb0['message']));});});};exports[_0x4493('0x1e')]=function(_0x4f906e){return new Promise(function(_0x3516a6,_0x2d3387){return db[_0x4493('0x18')][_0x4493('0x1f')]({'where':_0x4f906e[_0x4493('0x1a')]?_0x4f906e['options'][_0x4493('0x1b')]||null:null})[_0x4493('0xd')](function(_0x13ea6f){if(_0x13ea6f){return _0x13ea6f[_0x4493('0x20')](_0x4f906e['body'][_0x4493('0x21')],_[_0x4493('0x22')](_0x4f906e['body'],[_0x4493('0x21'),'id'])||{});}})['spread'](function(_0x56209b){logger[_0x4493('0xe')](_0x4493('0x23'),_0x4f906e);logger['debug']('AddTags',_0x4f906e,JSON['stringify'](_0x56209b));_0x3516a6(_0x56209b);})['catch'](function(_0x4b890a){logger[_0x4493('0x13')](_0x4493('0x23'),_0x4b890a[_0x4493('0x14')],_0x4f906e);_0x2d3387(_this[_0x4493('0x13')](0x1f4,_0x4b890a[_0x4493('0x14')]));});});}; \ No newline at end of file +var _0xe894=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','attributes','limit','AddTagsToFaxInteraction','find','where','addTags','ids','omit','body','spread','AddTags','lodash','util','moment','bluebird'];(function(_0xc4cc76,_0x509923){var _0x49d202=function(_0x1fdc72){while(--_0x1fdc72){_0xc4cc76['push'](_0xc4cc76['shift']());}};_0x49d202(++_0x509923);}(_0xe894,0x1b4));var _0x4e89=function(_0x71b765,_0x3053f8){_0x71b765=_0x71b765-0x0;var _0x34cb24=_0xe894[_0x71b765];return _0x34cb24;};'use strict';var _=require(_0x4e89('0x0'));var util=require(_0x4e89('0x1'));var moment=require(_0x4e89('0x2'));var BPromise=require(_0x4e89('0x3'));var rs=require(_0x4e89('0x4'));var fs=require('fs');var Redis=require(_0x4e89('0x5'));var db=require(_0x4e89('0x6'))['db'];var utils=require(_0x4e89('0x7'));var logger=require(_0x4e89('0x8'))(_0x4e89('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4e89('0xa')][_0x4e89('0xb')]({'port':0x232a});config[_0x4e89('0xc')]=_[_0x4e89('0xd')](config[_0x4e89('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4e89('0xe'))(new Redis(config[_0x4e89('0xc')]));require(_0x4e89('0xf'))[_0x4e89('0x10')](socket);function respondWithRpcPromise(_0x3d3c42,_0x245203,_0x324bc0){return new BPromise(function(_0x14cdbd,_0xdb32a3){return client['request'](_0x3d3c42,_0x324bc0)[_0x4e89('0x11')](function(_0x47e98c){logger[_0x4e89('0x12')](_0x4e89('0x13'),_0x245203,_0x4e89('0x14'));logger[_0x4e89('0x15')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x245203,_0x4e89('0x14'),JSON[_0x4e89('0x16')](_0x47e98c));if(_0x47e98c[_0x4e89('0x17')]){if(_0x47e98c[_0x4e89('0x17')][_0x4e89('0x18')]===0x1f4){logger[_0x4e89('0x17')](_0x4e89('0x13'),_0x245203,_0x47e98c[_0x4e89('0x17')]['message']);return _0xdb32a3(_0x47e98c[_0x4e89('0x17')][_0x4e89('0x19')]);}logger[_0x4e89('0x17')](_0x4e89('0x13'),_0x245203,_0x47e98c['error'][_0x4e89('0x19')]);return _0x14cdbd(_0x47e98c[_0x4e89('0x17')]['message']);}else{logger[_0x4e89('0x12')](_0x4e89('0x13'),_0x245203,_0x4e89('0x14'));_0x14cdbd(_0x47e98c[_0x4e89('0x1a')][_0x4e89('0x19')]);}})[_0x4e89('0x1b')](function(_0x6660a6){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x245203,_0x6660a6);_0xdb32a3(_0x6660a6);});});}exports[_0x4e89('0x1c')]=function(_0x467b19){var _0x2b3269=this;return new Promise(function(_0x315a81,_0x3124e9){return db[_0x4e89('0x1d')][_0x4e89('0x1e')](_0x467b19['body'],{'raw':_0x467b19['options']?_0x467b19[_0x4e89('0x1f')][_0x4e89('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x467b19[_0x4e89('0x1f')]?_0x467b19[_0x4e89('0x1f')]['where']||null:null,'attributes':_0x467b19[_0x4e89('0x1f')]?_0x467b19[_0x4e89('0x1f')][_0x4e89('0x21')]||null:null,'limit':_0x467b19['options']?_0x467b19['options'][_0x4e89('0x22')]||null:null})[_0x4e89('0x11')](function(_0x35ab46){logger[_0x4e89('0x12')](_0x4e89('0x1c'),_0x467b19);logger[_0x4e89('0x15')](_0x4e89('0x1c'),_0x467b19,JSON[_0x4e89('0x16')](_0x35ab46));_0x315a81(_0x35ab46);})[_0x4e89('0x1b')](function(_0x216f25){logger['error'](_0x4e89('0x1c'),_0x216f25[_0x4e89('0x19')],_0x467b19);_0x3124e9(_0x2b3269[_0x4e89('0x17')](0x1f4,_0x216f25['message']));});});};exports[_0x4e89('0x23')]=function(_0x120c45){return new Promise(function(_0x17b2b1,_0xe312e5){return db[_0x4e89('0x1d')][_0x4e89('0x24')]({'where':_0x120c45[_0x4e89('0x1f')]?_0x120c45[_0x4e89('0x1f')][_0x4e89('0x25')]||null:null})[_0x4e89('0x11')](function(_0x56617d){if(_0x56617d){return _0x56617d[_0x4e89('0x26')](_0x120c45['body'][_0x4e89('0x27')],_[_0x4e89('0x28')](_0x120c45[_0x4e89('0x29')],[_0x4e89('0x27'),'id'])||{});}})[_0x4e89('0x2a')](function(_0x5dce1c){logger[_0x4e89('0x12')]('AddTags',_0x120c45);logger[_0x4e89('0x15')](_0x4e89('0x2b'),_0x120c45,JSON[_0x4e89('0x16')](_0x5dce1c));_0x17b2b1(_0x5dce1c);})[_0x4e89('0x1b')](function(_0x613dd4){logger[_0x4e89('0x17')](_0x4e89('0x2b'),_0x613dd4[_0x4e89('0x19')],_0x120c45);_0xe312e5(_this[_0x4e89('0x17')](0x1f4,_0x613dd4[_0x4e89('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index dce1b16..df85534 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 _0xa217=['./faxInteraction.events','remove','emit','removeListener','register'];(function(_0x2a19cb,_0x350846){var _0x4eb262=function(_0x303ed2){while(--_0x303ed2){_0x2a19cb['push'](_0x2a19cb['shift']());}};_0x4eb262(++_0x350846);}(_0xa217,0xaa));var _0x7a21=function(_0xd91551,_0x52d19c){_0xd91551=_0xd91551-0x0;var _0x4a387c=_0xa217[_0xd91551];return _0x4a387c;};'use strict';var FaxInteractionEvents=require(_0x7a21('0x0'));var events=['save',_0x7a21('0x1'),'update'];function createListener(_0x5c5321,_0x579d06){return function(_0x4b1913){_0x579d06[_0x7a21('0x2')](_0x5c5321,_0x4b1913);};}function removeListener(_0x2d2e9a,_0xc7b0da){return function(){FaxInteractionEvents[_0x7a21('0x3')](_0x2d2e9a,_0xc7b0da);};}exports[_0x7a21('0x4')]=function(_0x1570e0){for(var _0x5bfc88=0x0,_0x34ac8d=events['length'];_0x5bfc88<_0x34ac8d;_0x5bfc88++){var _0x5c0216=events[_0x5bfc88];var _0x4accec=createListener('faxInteraction:'+_0x5c0216,_0x1570e0);FaxInteractionEvents['on'](_0x5c0216,_0x4accec);}}; \ No newline at end of file +var _0x12a6=['update','emit','removeListener','length','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x12a6,0x165));var _0x612a=function(_0x4c3f1c,_0x30d1a5){_0x4c3f1c=_0x4c3f1c-0x0;var _0x2119b4=_0x12a6[_0x4c3f1c];return _0x2119b4;};'use strict';var FaxInteractionEvents=require(_0x612a('0x0'));var events=[_0x612a('0x1'),_0x612a('0x2'),_0x612a('0x3')];function createListener(_0x10bb0e,_0xd2be51){return function(_0x1911eb){_0xd2be51[_0x612a('0x4')](_0x10bb0e,_0x1911eb);};}function removeListener(_0x45da9e,_0x41f844){return function(){FaxInteractionEvents[_0x612a('0x5')](_0x45da9e,_0x41f844);};}exports['register']=function(_0x5dd7b3){for(var _0x40a319=0x0,_0x4a1df6=events[_0x612a('0x6')];_0x40a319<_0x4a1df6;_0x40a319++){var _0xab23a6=events[_0x40a319];var _0x2e3839=createListener(_0x612a('0x7')+_0xab23a6,_0x5dd7b3);FaxInteractionEvents['on'](_0xab23a6,_0x2e3839);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 84a1e5c..c4cc993 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 _0x903e=['faxinteraction:destroy','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','update'];(function(_0x304b66,_0x1131fa){var _0x3de849=function(_0x579aff){while(--_0x579aff){_0x304b66['push'](_0x304b66['shift']());}};_0x3de849(++_0x1131fa);}(_0x903e,0x195));var _0xe903=function(_0x38fb0d,_0x52b5db){_0x38fb0d=_0x38fb0d-0x0;var _0x30a5d6=_0x903e[_0x38fb0d];return _0x30a5d6;};'use strict';var multer=require('multer');var util=require(_0xe903('0x0'));var path=require(_0xe903('0x1'));var timeout=require(_0xe903('0x2'));var express=require(_0xe903('0x3'));var router=express[_0xe903('0x4')]();var fs_extra=require(_0xe903('0x5'));var auth=require(_0xe903('0x6'));var interaction=require(_0xe903('0x7'));var config=require('../../config/environment');var controller=require(_0xe903('0x8'));router[_0xe903('0x9')]('/',auth[_0xe903('0xa')](),controller[_0xe903('0xb')]);router[_0xe903('0x9')](_0xe903('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xe903('0x9')](_0xe903('0xd'),auth[_0xe903('0xa')](),controller[_0xe903('0xe')]);router[_0xe903('0x9')](_0xe903('0xf'),auth[_0xe903('0xa')](),controller[_0xe903('0x10')]);router[_0xe903('0x9')](_0xe903('0x11'),auth['isAuthenticated'](),controller[_0xe903('0x12')]);router[_0xe903('0x13')]('/',auth['isAuthenticated'](),controller[_0xe903('0x14')]);router[_0xe903('0x13')](_0xe903('0xf'),auth[_0xe903('0xa')](),controller[_0xe903('0x15')]);router[_0xe903('0x13')](_0xe903('0x16'),auth[_0xe903('0xa')](),interaction['tracked'](_0xe903('0x17'),_0xe903('0x18')),controller[_0xe903('0x19')]);router[_0xe903('0x1a')](_0xe903('0xd'),auth[_0xe903('0xa')](),interaction[_0xe903('0x1b')]('fax','faxinteraction:update'),controller[_0xe903('0x1c')]);router['delete'](_0xe903('0xd'),auth[_0xe903('0xa')](),interaction[_0xe903('0x1b')](_0xe903('0x17'),_0xe903('0x1d')),controller['destroy']);router['delete'](_0xe903('0x16'),auth[_0xe903('0xa')](),controller[_0xe903('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x4d39=['get','isAuthenticated','index','/describe','/:id','show','/:id/messages','download','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','exports','path','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0x26b08d,_0xa50004){var _0x1711e6=function(_0x28a79c){while(--_0x28a79c){_0x26b08d['push'](_0x26b08d['shift']());}};_0x1711e6(++_0xa50004);}(_0x4d39,0xb2));var _0x94d3=function(_0x496895,_0x481fda){_0x496895=_0x496895-0x0;var _0x18e186=_0x4d39[_0x496895];return _0x18e186;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x94d3('0x0'));var timeout=require(_0x94d3('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x94d3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x94d3('0x3'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0x94d3('0x4')]('/',auth[_0x94d3('0x5')](),controller[_0x94d3('0x6')]);router['get'](_0x94d3('0x7'),auth[_0x94d3('0x5')](),controller['describe']);router['get'](_0x94d3('0x8'),auth['isAuthenticated'](),controller[_0x94d3('0x9')]);router[_0x94d3('0x4')](_0x94d3('0xa'),auth[_0x94d3('0x5')](),controller['getMessages']);router[_0x94d3('0x4')]('/:id/download',auth['isAuthenticated'](),controller[_0x94d3('0xb')]);router[_0x94d3('0xc')]('/',auth['isAuthenticated'](),controller[_0x94d3('0xd')]);router[_0x94d3('0xc')](_0x94d3('0xa'),auth['isAuthenticated'](),controller['addMessage']);router[_0x94d3('0xc')](_0x94d3('0xe'),auth[_0x94d3('0x5')](),interaction[_0x94d3('0xf')](_0x94d3('0x10'),_0x94d3('0x11')),controller[_0x94d3('0x12')]);router[_0x94d3('0x13')]('/:id',auth[_0x94d3('0x5')](),interaction['tracked'](_0x94d3('0x10'),_0x94d3('0x14')),controller[_0x94d3('0x15')]);router[_0x94d3('0x16')](_0x94d3('0x8'),auth[_0x94d3('0x5')](),interaction[_0x94d3('0xf')](_0x94d3('0x10'),_0x94d3('0x17')),controller['destroy']);router['delete'](_0x94d3('0xe'),auth[_0x94d3('0x5')](),controller[_0x94d3('0x18')]);module[_0x94d3('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 592b83e..a00346f 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 _0x13c0=['DATE','sequelize','exports','TEXT','medium','out'];(function(_0x42c794,_0x232fdf){var _0x4965f0=function(_0x12ad76){while(--_0x12ad76){_0x42c794['push'](_0x42c794['shift']());}};_0x4965f0(++_0x232fdf);}(_0x13c0,0x79));var _0x013c=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0x13c0[_0x3bef2c];return _0x331503;};'use strict';var Sequelize=require(_0x013c('0x0'));module[_0x013c('0x1')]={'body':{'type':Sequelize[_0x013c('0x2')](_0x013c('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x013c('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x013c('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x013c('0x5')]}}; \ No newline at end of file +var _0x03ce=['medium','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x41a72b,_0x6c933){var _0x4d4411=function(_0x1cfd32){while(--_0x1cfd32){_0x41a72b['push'](_0x41a72b['shift']());}};_0x4d4411(++_0x6c933);}(_0x03ce,0x1a1));var _0xe03c=function(_0x20b1f9,_0x1abe8a){_0x20b1f9=_0x20b1f9-0x0;var _0x578891=_0x03ce[_0x20b1f9];return _0x578891;};'use strict';var Sequelize=require(_0xe03c('0x0'));module[_0xe03c('0x1')]={'body':{'type':Sequelize[_0xe03c('0x2')](_0xe03c('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe03c('0x4')]('in',_0xe03c('0x5')),'defaultValue':_0xe03c('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xe03c('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 509993e..7d939ef 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 _0x16ee=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','http','client','request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','stack','name','send','index','map','rawAttributes','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','FaxMessage','includeAll','include','rows','show','params','find','body','destroy','describe','../../config/logger','fax-interactions','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','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','accept','EventManager','acceptmessage','FaxInteractionId','role','RejectMessage','rejectMessage','fullname','rejectmessage','create','CmContact','findOne','Attachment','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','files','download'];(function(_0x48c4ef,_0x319d44){var _0x435715=function(_0x925d50){while(--_0x925d50){_0x48c4ef['push'](_0x48c4ef['shift']());}};_0x435715(++_0x319d44);}(_0x16ee,0x126));var _0xe16e=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0x16ee[_0x55fa03];return _0x2cd7cd;};'use strict';var emlformat=require(_0xe16e('0x0'));var rimraf=require(_0xe16e('0x1'));var zipdir=require(_0xe16e('0x2'));var jsonpatch=require(_0xe16e('0x3'));var rp=require(_0xe16e('0x4'));var moment=require(_0xe16e('0x5'));var BPromise=require(_0xe16e('0x6'));var Mustache=require('mustache');var util=require(_0xe16e('0x7'));var path=require(_0xe16e('0x8'));var sox=require('sox');var csv=require(_0xe16e('0x9'));var ejs=require(_0xe16e('0xa'));var fs=require('fs');var fs_extra=require(_0xe16e('0xb'));var _=require(_0xe16e('0xc'));var squel=require('squel');var crypto=require(_0xe16e('0xd'));var jsforce=require(_0xe16e('0xe'));var deskjs=require(_0xe16e('0xf'));var toCsv=require(_0xe16e('0x9'));var querystring=require(_0xe16e('0x10'));var Papa=require(_0xe16e('0x11'));var Redis=require('ioredis');var authService=require(_0xe16e('0x12'));var qs=require(_0xe16e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe16e('0x14'));var logger=require('../../config/logger')(_0xe16e('0x15'));var utils=require(_0xe16e('0x16'));var config=require(_0xe16e('0x17'));var licenseUtil=require(_0xe16e('0x18'));var db=require(_0xe16e('0x19'))['db'];config[_0xe16e('0x1a')]=_[_0xe16e('0x1b')](config[_0xe16e('0x1a')],{'host':_0xe16e('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe16e('0x1a')]));require('./faxMessage.socket')[_0xe16e('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xe16e('0x1e')]({'port':0x232c});var client9002=jayson[_0xe16e('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x546328,_0x572e19,_0x29973b,_0x48badf){return new BPromise(function(_0x2a09d3,_0x2e30f0){var _0x41d88c=_0x48badf||client;return _0x41d88c[_0xe16e('0x20')](_0x546328,_0x29973b)['then'](function(_0x58120e){logger[_0xe16e('0x21')](_0xe16e('0x22'),_0x572e19,'request\x20sent');logger[_0xe16e('0x23')](_0xe16e('0x24'),_0x572e19,_0xe16e('0x25'),JSON['stringify'](_0x58120e));if(_0x58120e[_0xe16e('0x26')]){if(_0x58120e[_0xe16e('0x26')][_0xe16e('0x27')]===0x1f4){logger[_0xe16e('0x26')]('FaxMessage,\x20%s,\x20%s',_0x572e19,_0x58120e[_0xe16e('0x26')][_0xe16e('0x28')]);return _0x2e30f0(_0x58120e[_0xe16e('0x26')][_0xe16e('0x28')]);}logger[_0xe16e('0x26')](_0xe16e('0x22'),_0x572e19,_0x58120e[_0xe16e('0x26')][_0xe16e('0x28')]);return _0x2a09d3(_0x58120e['error'][_0xe16e('0x28')]);}else{logger[_0xe16e('0x21')](_0xe16e('0x22'),_0x572e19,_0xe16e('0x25'));_0x2a09d3(_0x58120e[_0xe16e('0x29')]['message']);}})[_0xe16e('0x2a')](function(_0x3e3ff3){logger[_0xe16e('0x26')]('FaxMessage,\x20%s,\x20%s',_0x572e19,_0x3e3ff3);_0x2e30f0(_0x3e3ff3);});});}function respondWithStatusCode(_0xb875c0,_0x1f30e6){_0x1f30e6=_0x1f30e6||0xcc;return function(_0x41f90d){if(_0x41f90d){return _0xb875c0[_0xe16e('0x2b')](_0x1f30e6);}return _0xb875c0['status'](_0x1f30e6)['end']();};}function respondWithResult(_0x298a6c,_0x22350a){_0x22350a=_0x22350a||0xc8;return function(_0x57c490){if(_0x57c490){return _0x298a6c[_0xe16e('0x2c')](_0x22350a)[_0xe16e('0x2d')](_0x57c490);}};}function respondWithFilteredResult(_0xe60e35,_0x299a45){return function(_0x3bbd81){if(_0x3bbd81){var _0x13d594=typeof _0x299a45[_0xe16e('0x2e')]===_0xe16e('0x2f')&&typeof _0x299a45[_0xe16e('0x30')]===_0xe16e('0x2f');var _0x58c9ea=_0x3bbd81[_0xe16e('0x31')];var _0x35995e=_0x13d594?0x0:_0x299a45[_0xe16e('0x2e')];var _0x243a13=_0x13d594?_0x3bbd81['count']:_0x299a45[_0xe16e('0x2e')]+_0x299a45[_0xe16e('0x30')];var _0x349566;if(_0x243a13>=_0x58c9ea){_0x243a13=_0x58c9ea;_0x349566=0xc8;}else{_0x349566=0xce;}_0xe60e35[_0xe16e('0x2c')](_0x349566);return _0xe60e35[_0xe16e('0x32')]('Content-Range',_0x35995e+'-'+_0x243a13+'/'+_0x58c9ea)[_0xe16e('0x2d')](_0x3bbd81);}return null;};}function patchUpdates(_0x330ad1){return function(_0x597483){try{jsonpatch[_0xe16e('0x33')](_0x597483,_0x330ad1,!![]);}catch(_0x311ea1){return BPromise[_0xe16e('0x34')](_0x311ea1);}return _0x597483[_0xe16e('0x35')]();};}function saveUpdates(_0x40d313,_0x384414){return function(_0x1f2548){if(_0x1f2548){return _0x1f2548[_0xe16e('0x36')](_0x40d313)[_0xe16e('0x37')](function(_0x5f8a8f){return _0x5f8a8f;});}return null;};}function removeEntity(_0x579a14,_0xe3744c){return function(_0x276835){if(_0x276835){return _0x276835['destroy']()[_0xe16e('0x37')](function(){_0x579a14[_0xe16e('0x2c')](0xcc)[_0xe16e('0x38')]();});}};}function handleEntityNotFound(_0x528adc,_0x31215b){return function(_0x228629){if(!_0x228629){_0x528adc[_0xe16e('0x2b')](0x194);}return _0x228629;};}function handleError(_0x4f31a1,_0xf8a4e0){_0xf8a4e0=_0xf8a4e0||0x1f4;return function(_0x2b905f){logger[_0xe16e('0x26')](_0x2b905f[_0xe16e('0x39')]);if(_0x2b905f[_0xe16e('0x3a')]){delete _0x2b905f[_0xe16e('0x3a')];}_0x4f31a1[_0xe16e('0x2c')](_0xf8a4e0)[_0xe16e('0x3b')](_0x2b905f);};}exports[_0xe16e('0x3c')]=function(_0x4e5456,_0x3009be){var _0x2b733c={},_0x4b8192={},_0x36054e={'count':0x0,'rows':[]};var _0xb6058f=_[_0xe16e('0x3d')](db['FaxMessage'][_0xe16e('0x3e')],function(_0x3d634a){return{'name':_0x3d634a['fieldName'],'type':_0x3d634a['type'][_0xe16e('0x3f')]};});_0x4b8192['model']=_[_0xe16e('0x3d')](_0xb6058f,_0xe16e('0x3a'));_0x4b8192[_0xe16e('0x40')]=_[_0xe16e('0x41')](_0x4e5456[_0xe16e('0x40')]);_0x4b8192[_0xe16e('0x42')]=_['intersection'](_0x4b8192['model'],_0x4b8192['query']);_0x2b733c[_0xe16e('0x43')]=_[_0xe16e('0x44')](_0x4b8192[_0xe16e('0x45')],qs['fields'](_0x4e5456[_0xe16e('0x40')][_0xe16e('0x46')]));_0x2b733c[_0xe16e('0x43')]=_0x2b733c['attributes'][_0xe16e('0x47')]?_0x2b733c[_0xe16e('0x43')]:_0x4b8192[_0xe16e('0x45')];if(!_0x4e5456['query'][_0xe16e('0x48')](_0xe16e('0x49'))){_0x2b733c['limit']=qs[_0xe16e('0x30')](_0x4e5456[_0xe16e('0x40')][_0xe16e('0x30')]);_0x2b733c[_0xe16e('0x2e')]=qs[_0xe16e('0x2e')](_0x4e5456[_0xe16e('0x40')]['offset']);}_0x2b733c[_0xe16e('0x4a')]=qs[_0xe16e('0x4b')](_0x4e5456[_0xe16e('0x40')][_0xe16e('0x4b')]);_0x2b733c[_0xe16e('0x4c')]=qs[_0xe16e('0x42')](_['pick'](_0x4e5456['query'],_0x4b8192[_0xe16e('0x42')]),_0xb6058f);if(_0x4e5456['query'][_0xe16e('0x4d')]){_0x2b733c[_0xe16e('0x4c')]=_[_0xe16e('0x4e')](_0x2b733c[_0xe16e('0x4c')],{'$or':_['map'](_0xb6058f,function(_0x4c352f){if(_0x4c352f[_0xe16e('0x4f')]!==_0xe16e('0x50')){var _0x342110={};_0x342110[_0x4c352f[_0xe16e('0x3a')]]={'$like':'%'+_0x4e5456[_0xe16e('0x40')][_0xe16e('0x4d')]+'%'};return _0x342110;}})});}_0x2b733c=_['merge']({},_0x2b733c,_0x4e5456[_0xe16e('0x51')]);var _0x372675={'where':_0x2b733c[_0xe16e('0x4c')]};return db[_0xe16e('0x52')][_0xe16e('0x31')](_0x372675)[_0xe16e('0x37')](function(_0x36fe69){_0x36054e[_0xe16e('0x31')]=_0x36fe69;if(_0x4e5456[_0xe16e('0x40')][_0xe16e('0x53')]){_0x2b733c[_0xe16e('0x54')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x2b733c);})[_0xe16e('0x37')](function(_0x1167ca){_0x36054e[_0xe16e('0x55')]=_0x1167ca;return _0x36054e;})[_0xe16e('0x37')](respondWithFilteredResult(_0x3009be,_0x2b733c))[_0xe16e('0x2a')](handleError(_0x3009be,null));};exports[_0xe16e('0x56')]=function(_0x269c14,_0x440237){var _0x4a3a0e={'raw':!![],'where':{'id':_0x269c14[_0xe16e('0x57')]['id']}},_0x4b3bfe={};_0x4b3bfe['model']=_[_0xe16e('0x41')](db[_0xe16e('0x52')][_0xe16e('0x3e')]);_0x4b3bfe[_0xe16e('0x40')]=_[_0xe16e('0x41')](_0x269c14['query']);_0x4b3bfe[_0xe16e('0x42')]=_[_0xe16e('0x44')](_0x4b3bfe[_0xe16e('0x45')],_0x4b3bfe[_0xe16e('0x40')]);_0x4a3a0e[_0xe16e('0x43')]=_['intersection'](_0x4b3bfe[_0xe16e('0x45')],qs['fields'](_0x269c14[_0xe16e('0x40')]['fields']));_0x4a3a0e[_0xe16e('0x43')]=_0x4a3a0e[_0xe16e('0x43')]['length']?_0x4a3a0e['attributes']:_0x4b3bfe['model'];if(_0x269c14[_0xe16e('0x40')][_0xe16e('0x53')]){_0x4a3a0e[_0xe16e('0x54')]=[{'all':!![]}];}_0x4a3a0e=_[_0xe16e('0x4e')]({},_0x4a3a0e,_0x269c14[_0xe16e('0x51')]);return db[_0xe16e('0x52')][_0xe16e('0x58')](_0x4a3a0e)['then'](handleEntityNotFound(_0x440237,null))['then'](respondWithResult(_0x440237,null))[_0xe16e('0x2a')](handleError(_0x440237,null));};exports[_0xe16e('0x36')]=function(_0x2ddd16,_0x4f5cca){if(_0x2ddd16[_0xe16e('0x59')]['id']){delete _0x2ddd16[_0xe16e('0x59')]['id'];}return db[_0xe16e('0x52')]['find']({'where':{'id':_0x2ddd16[_0xe16e('0x57')]['id']}})[_0xe16e('0x37')](handleEntityNotFound(_0x4f5cca,null))[_0xe16e('0x37')](saveUpdates(_0x2ddd16[_0xe16e('0x59')],null))['then'](respondWithResult(_0x4f5cca,null))[_0xe16e('0x2a')](handleError(_0x4f5cca,null));};exports[_0xe16e('0x5a')]=function(_0x4218e9,_0x2b517e){return db[_0xe16e('0x52')]['find']({'where':{'id':_0x4218e9[_0xe16e('0x57')]['id']}})[_0xe16e('0x37')](handleEntityNotFound(_0x2b517e,null))[_0xe16e('0x37')](removeEntity(_0x2b517e,null))[_0xe16e('0x2a')](handleError(_0x2b517e,null));};exports[_0xe16e('0x5b')]=function(_0x262bdf,_0x55f916){return db[_0xe16e('0x52')][_0xe16e('0x5b')]()[_0xe16e('0x37')](respondWithResult(_0x55f916,null))[_0xe16e('0x2a')](handleError(_0x55f916,null));};var interaction_log=require(_0xe16e('0x5c'))(_0xe16e('0x5d'));exports['accept']=function(_0x30e921,_0x4c0703,_0x3c9423){var _0x38a60c={'agent':{},'channel':_0xe16e('0x5e')};if(_0x30e921[_0xe16e('0x59')]['id']){delete _0x30e921[_0xe16e('0x59')]['id'];}_0x30e921[_0xe16e('0x59')][_0xe16e('0x5f')]=!![];_0x30e921[_0xe16e('0x59')]['readAt']=moment()[_0xe16e('0x60')](_0xe16e('0x61'));_0x30e921['body'][_0xe16e('0x62')]=_0x30e921[_0xe16e('0x59')][_0xe16e('0x62')]||_0x30e921[_0xe16e('0x63')]['id'];_0x38a60c['agent']['id']=_0x30e921['body'][_0xe16e('0x62')];return db[_0xe16e('0x52')]['find']({'where':{'id':_0x30e921[_0xe16e('0x57')]['id'],'UserId':null}})[_0xe16e('0x37')](handleEntityNotFound(_0x4c0703,null))[_0xe16e('0x37')](saveUpdates(_0x30e921[_0xe16e('0x59')],null))[_0xe16e('0x37')](function(_0x35ba05){if(_0x35ba05){_0x38a60c[_0xe16e('0x28')]=_0x35ba05[_0xe16e('0x64')]({'plain':!![]});return db[_0xe16e('0x65')]['find']({'where':{'id':_0x35ba05['FaxInteractionId']}});}return null;})[_0xe16e('0x37')](handleEntityNotFound(_0x4c0703,null))[_0xe16e('0x37')](function(_0x41e11d){if(_0x41e11d){return _0x41e11d[_0xe16e('0x36')]({'UserId':_0x30e921[_0xe16e('0x59')][_0xe16e('0x62')],'read1stAt':_[_0xe16e('0x66')](_0x41e11d[_0xe16e('0x67')])?moment()[_0xe16e('0x60')](_0xe16e('0x61')):undefined});}return null;})[_0xe16e('0x37')](function(_0x280008){if(_0x280008){_0x38a60c[_0xe16e('0x68')]=_0x280008['get']({'plain':!![]});interaction_log[_0xe16e('0x21')](_0xe16e('0x69'),_0x30e921[_0xe16e('0x63')]['id'],_0x30e921['user']['name'],_0x30e921[_0xe16e('0x63')]['role'],_0x38a60c['interaction']['id'],_0x30e921[_0xe16e('0x59')]?JSON[_0xe16e('0x6a')](_0x30e921[_0xe16e('0x59')]):'null');return respondWithRpcPromise(_0xe16e('0x6b'),_0xe16e('0x6c'),_0x38a60c);}return null;})[_0xe16e('0x37')](function(_0x558a2c){var _0x1c8241=_0xe16e('0x6d')+_0x558a2c[_0xe16e('0x28')][_0xe16e('0x6e')];return db[_0xe16e('0x6f')][_0xe16e('0x40')](_0x1c8241,{'type':db[_0xe16e('0x70')][_0xe16e('0x71')][_0xe16e('0x72')],'raw':!![]})['then'](function(_0x26fb35){return _0x26fb35;});})[_0xe16e('0x37')](function(_0x5c5dcd){if(_0x5c5dcd){_0x38a60c[_0xe16e('0x28')][_0xe16e('0x73')]=_0x5c5dcd[0x0];if(!_0x30e921[_0xe16e('0x59')][_0xe16e('0x62')])return;return db[_0xe16e('0x74')]['find']({'where':{'id':_0x30e921[_0xe16e('0x59')]['UserId'],'role':'agent'},'attributes':['id',_0xe16e('0x3a'),'fullname',_0xe16e('0x75'),_0xe16e('0x76')],'raw':!![]});}return null;})[_0xe16e('0x37')](function(_0x19f281){if(!_0x19f281)return null;_0x38a60c[_0xe16e('0x28')][_0xe16e('0x77')]=_0x19f281;return _0x38a60c;})['then'](function(_0x31f148){if(_0x31f148){if(_0x30e921[_0xe16e('0x59')][_0xe16e('0x78')]){_0x38a60c['message'][_0xe16e('0x79')]=util['format'](_0xe16e('0x7a'),_0x30e921[_0xe16e('0x63')][_0xe16e('0x3a')]);_0x38a60c[_0xe16e('0x28')][_0xe16e('0x7b')]=_0x38a60c[_0xe16e('0x7b')];_0x38a60c[_0xe16e('0x28')][_0xe16e('0x7c')]=_0x38a60c['channel'];_0x38a60c['message'][_0xe16e('0x7d')]=_0xe16e('0x7e');return respondWithRpcPromise('EventManager',_0xe16e('0x7f'),{'event':_0xe16e('0x80'),'message':_0x38a60c[_0xe16e('0x28')]},client9002)[_0xe16e('0x37')](function(){return _0x38a60c;});}return _0x38a60c;}return null;})['then'](respondWithResult(_0x4c0703,null))[_0xe16e('0x2a')](handleError(_0x4c0703,null));};var interaction_log=require(_0xe16e('0x5c'))(_0xe16e('0x5d'));exports['reject']=function(_0x4a4c9f,_0x2c11f8,_0x5ecce0){var _0x58291b={'agent':{},'channel':_0xe16e('0x5e')};if(_0x4a4c9f[_0xe16e('0x59')]['id']){delete _0x4a4c9f['body']['id'];}_0x4a4c9f[_0xe16e('0x59')][_0xe16e('0x62')]=_0x4a4c9f[_0xe16e('0x59')][_0xe16e('0x62')]||_0x4a4c9f[_0xe16e('0x63')]['id'];_0x58291b[_0xe16e('0x77')]['id']=_0x4a4c9f['body'][_0xe16e('0x62')];return db['FaxMessage']['find']({'where':{'id':_0x4a4c9f[_0xe16e('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2c11f8,null))[_0xe16e('0x37')](function(_0x4f62df){if(_0x4f62df){_0x58291b[_0xe16e('0x28')]=_0x4f62df[_0xe16e('0x64')]({'plain':!![]});return db[_0xe16e('0x65')][_0xe16e('0x58')]({'where':{'id':_0x4f62df[_0xe16e('0x81')]}});}return null;})[_0xe16e('0x37')](handleEntityNotFound(_0x2c11f8,null))[_0xe16e('0x37')](function(_0x46afea){if(_0x46afea){_0x58291b[_0xe16e('0x68')]=_0x46afea[_0xe16e('0x64')]({'plain':!![]});interaction_log[_0xe16e('0x21')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a4c9f[_0xe16e('0x63')]['id'],_0x4a4c9f[_0xe16e('0x63')][_0xe16e('0x3a')],_0x4a4c9f[_0xe16e('0x63')][_0xe16e('0x82')],_0x58291b['interaction']['id'],_0x4a4c9f[_0xe16e('0x59')]?JSON['stringify'](_0x4a4c9f['body']):'null');return respondWithRpcPromise(_0xe16e('0x83'),_0xe16e('0x84'),_0x58291b);}return null;})[_0xe16e('0x37')](function(_0x28b5f5){var _0x31ff19=_0xe16e('0x6d')+_0x28b5f5[_0xe16e('0x28')]['ContactId'];return db[_0xe16e('0x6f')]['query'](_0x31ff19,{'type':db[_0xe16e('0x70')][_0xe16e('0x71')]['SELECT'],'raw':!![]})[_0xe16e('0x37')](function(_0x654925){return _0x654925;});})['then'](function(_0x5e3d60){if(_0x5e3d60){_0x58291b[_0xe16e('0x28')]['contact']=_0x5e3d60[0x0];if(!_0x4a4c9f['body'][_0xe16e('0x62')])return;return db[_0xe16e('0x74')][_0xe16e('0x58')]({'where':{'id':_0x4a4c9f['body']['UserId'],'role':_0xe16e('0x77')},'attributes':['id',_0xe16e('0x3a'),_0xe16e('0x85'),_0xe16e('0x75'),_0xe16e('0x76')],'raw':!![]});}return null;})[_0xe16e('0x37')](function(_0x33222b){if(!_0x33222b)return null;_0x58291b[_0xe16e('0x28')][_0xe16e('0x77')]=_0x33222b;return _0x58291b;})[_0xe16e('0x37')](function(_0x1d9fcd){if(_0x1d9fcd){_0x1d9fcd[_0xe16e('0x28')][_0xe16e('0x79')]=util[_0xe16e('0x60')]('SIP/%s',_0x4a4c9f[_0xe16e('0x63')]['name']);_0x1d9fcd[_0xe16e('0x28')][_0xe16e('0x7b')]=_0x58291b[_0xe16e('0x7b')];_0x1d9fcd[_0xe16e('0x28')][_0xe16e('0x7c')]=_0x58291b[_0xe16e('0x7b')];_0x1d9fcd[_0xe16e('0x28')][_0xe16e('0x7d')]='reject';respondWithRpcPromise(_0xe16e('0x7f'),'EventManager',{'event':_0xe16e('0x86'),'message':_0x1d9fcd[_0xe16e('0x28')]},client9002);return _0x58291b;}return null;})['then'](respondWithResult(_0x2c11f8,null))[_0xe16e('0x2a')](handleError(_0x2c11f8,null));};exports[_0xe16e('0x87')]=function(_0x47788d,_0x510526){var _0x14336d;return db[_0xe16e('0x52')][_0xe16e('0x87')](_0x47788d['body'],{})[_0xe16e('0x37')](function(_0x44fc2a){_0x14336d=_0x44fc2a;return db[_0xe16e('0x88')][_0xe16e('0x89')]({'where':{'id':_0x14336d['ContactId']}});})[_0xe16e('0x37')](function(_0x1bc36d){if(_['isNil'](_0x1bc36d)){return;}else{_0x14336d[_0xe16e('0x5e')]=_0x1bc36d[_0xe16e('0x5e')];return db[_0xe16e('0x8a')][_0xe16e('0x89')]({'where':{'id':_0x14336d['AttachmentId']}});}})['then'](function(_0x46198d){return respondWithRpcPromise('SendFax',_0xe16e('0x8b'),{'FaxAccountId':_['isNil'](_0x47788d[_0xe16e('0x59')])?undefined:_0x47788d['body']['FaxAccountId'],'path':_[_0xe16e('0x66')](_0x46198d)?undefined:util[_0xe16e('0x60')](_0xe16e('0x8c'),_0x46198d[_0xe16e('0x8d')]),'fax':_['isNil'](_0x14336d[_0xe16e('0x5e')])?undefined:_0x14336d['fax'],'AttachmentId':_0x14336d['AttachmentId']},client9002);})['then'](respondWithResult(_0x510526,0xc9))[_0xe16e('0x2a')](handleError(_0x510526,null));};exports['download']=function(_0x31c7d5,_0x4b153c){var _0x33b3fc=path[_0xe16e('0x8e')](config[_0xe16e('0x8f')],_0xe16e('0x90'),_0xe16e('0x91'),'attachments');return db[_0xe16e('0x52')][_0xe16e('0x58')]({'where':{'id':_0x31c7d5[_0xe16e('0x57')]['id']},'include':[{'model':db[_0xe16e('0x8a')],'as':_0xe16e('0x8a')}]})[_0xe16e('0x37')](handleEntityNotFound(_0x4b153c,null))[_0xe16e('0x37')](function(_0xa8b2fd){if(_0xa8b2fd){return _0x4b153c[_0xe16e('0x92')](path[_0xe16e('0x8e')](_0x33b3fc,_0xa8b2fd['Attachment'][_0xe16e('0x8d')]));}})[_0xe16e('0x2a')](handleError(_0x4b153c,null));}; \ No newline at end of file +var _0xa0cd=['[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','manual','SIP/%s','channel','motionChannel','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','interface','rejectmessage','create','CmContact','findOne','fax','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','join','root','server','files','attachments','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./faxMessage.socket','register','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','merge','filter','options','FaxMessage','includeAll','include','findAll','rows','catch','show','length','find','body','params','describe','../../config/logger','fax-interactions','accept','read','readAt','format','UserId','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','info'];(function(_0x57524e,_0x236f11){var _0x4a0867=function(_0x472b27){while(--_0x472b27){_0x57524e['push'](_0x57524e['shift']());}};_0x4a0867(++_0x236f11);}(_0xa0cd,0xbe));var _0xda0c=function(_0x4accb5,_0xd15c51){_0x4accb5=_0x4accb5-0x0;var _0x5ce1f2=_0xa0cd[_0x4accb5];return _0x5ce1f2;};'use strict';var emlformat=require(_0xda0c('0x0'));var rimraf=require(_0xda0c('0x1'));var zipdir=require(_0xda0c('0x2'));var jsonpatch=require(_0xda0c('0x3'));var rp=require(_0xda0c('0x4'));var moment=require('moment');var BPromise=require(_0xda0c('0x5'));var Mustache=require('mustache');var util=require(_0xda0c('0x6'));var path=require(_0xda0c('0x7'));var sox=require('sox');var csv=require(_0xda0c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda0c('0x9'));var _=require(_0xda0c('0xa'));var squel=require('squel');var crypto=require(_0xda0c('0xb'));var jsforce=require(_0xda0c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xda0c('0xd'));var Papa=require(_0xda0c('0xe'));var Redis=require('ioredis');var authService=require(_0xda0c('0xf'));var qs=require(_0xda0c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda0c('0x11'));var logger=require('../../config/logger')(_0xda0c('0x12'));var utils=require(_0xda0c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xda0c('0x14'));var db=require('../../mysqldb')['db'];config[_0xda0c('0x15')]=_[_0xda0c('0x16')](config[_0xda0c('0x15')],{'host':_0xda0c('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda0c('0x15')]));require(_0xda0c('0x18'))[_0xda0c('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xda0c('0x1a')][_0xda0c('0x1b')]({'port':0x232c});var client9002=jayson[_0xda0c('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6fa885,_0x3c3534,_0x155693,_0x474c56){return new BPromise(function(_0x4f0c23,_0x53d8a7){var _0x1826b1=_0x474c56||client;return _0x1826b1[_0xda0c('0x1c')](_0x6fa885,_0x155693)[_0xda0c('0x1d')](function(_0x3fefdb){logger['info'](_0xda0c('0x1e'),_0x3c3534,_0xda0c('0x1f'));logger[_0xda0c('0x20')](_0xda0c('0x21'),_0x3c3534,_0xda0c('0x1f'),JSON[_0xda0c('0x22')](_0x3fefdb));if(_0x3fefdb[_0xda0c('0x23')]){if(_0x3fefdb[_0xda0c('0x23')]['code']===0x1f4){logger['error'](_0xda0c('0x1e'),_0x3c3534,_0x3fefdb['error'][_0xda0c('0x24')]);return _0x53d8a7(_0x3fefdb[_0xda0c('0x23')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x3c3534,_0x3fefdb[_0xda0c('0x23')][_0xda0c('0x24')]);return _0x4f0c23(_0x3fefdb['error'][_0xda0c('0x24')]);}else{logger['info'](_0xda0c('0x1e'),_0x3c3534,_0xda0c('0x1f'));_0x4f0c23(_0x3fefdb[_0xda0c('0x25')][_0xda0c('0x24')]);}})['catch'](function(_0xfbcb7c){logger[_0xda0c('0x23')](_0xda0c('0x1e'),_0x3c3534,_0xfbcb7c);_0x53d8a7(_0xfbcb7c);});});}function respondWithStatusCode(_0x10246b,_0x44db7e){_0x44db7e=_0x44db7e||0xcc;return function(_0x58736a){if(_0x58736a){return _0x10246b['sendStatus'](_0x44db7e);}return _0x10246b[_0xda0c('0x26')](_0x44db7e)['end']();};}function respondWithResult(_0x456588,_0x3c2407){_0x3c2407=_0x3c2407||0xc8;return function(_0x2f91fd){if(_0x2f91fd){return _0x456588[_0xda0c('0x26')](_0x3c2407)[_0xda0c('0x27')](_0x2f91fd);}};}function respondWithFilteredResult(_0x547ece,_0x5bc010){return function(_0x182b67){if(_0x182b67){var _0xa89a3b=typeof _0x5bc010[_0xda0c('0x28')]===_0xda0c('0x29')&&typeof _0x5bc010[_0xda0c('0x2a')]==='undefined';var _0x22ef5f=_0x182b67[_0xda0c('0x2b')];var _0x582d58=_0xa89a3b?0x0:_0x5bc010[_0xda0c('0x28')];var _0x52ee4c=_0xa89a3b?_0x182b67['count']:_0x5bc010[_0xda0c('0x28')]+_0x5bc010['limit'];var _0x343497;if(_0x52ee4c>=_0x22ef5f){_0x52ee4c=_0x22ef5f;_0x343497=0xc8;}else{_0x343497=0xce;}_0x547ece[_0xda0c('0x26')](_0x343497);return _0x547ece[_0xda0c('0x2c')](_0xda0c('0x2d'),_0x582d58+'-'+_0x52ee4c+'/'+_0x22ef5f)[_0xda0c('0x27')](_0x182b67);}return null;};}function patchUpdates(_0x51dd76){return function(_0x2fb442){try{jsonpatch[_0xda0c('0x2e')](_0x2fb442,_0x51dd76,!![]);}catch(_0x4eb57b){return BPromise[_0xda0c('0x2f')](_0x4eb57b);}return _0x2fb442['save']();};}function saveUpdates(_0x3d9a97,_0x108e06){return function(_0x322763){if(_0x322763){return _0x322763[_0xda0c('0x30')](_0x3d9a97)[_0xda0c('0x1d')](function(_0x32a981){return _0x32a981;});}return null;};}function removeEntity(_0x363d69,_0x182e1e){return function(_0x373571){if(_0x373571){return _0x373571[_0xda0c('0x31')]()[_0xda0c('0x1d')](function(){_0x363d69[_0xda0c('0x26')](0xcc)[_0xda0c('0x32')]();});}};}function handleEntityNotFound(_0x263d68,_0x1d3481){return function(_0x201610){if(!_0x201610){_0x263d68[_0xda0c('0x33')](0x194);}return _0x201610;};}function handleError(_0x2a314,_0x526dd2){_0x526dd2=_0x526dd2||0x1f4;return function(_0x15c9be){logger[_0xda0c('0x23')](_0x15c9be[_0xda0c('0x34')]);if(_0x15c9be[_0xda0c('0x35')]){delete _0x15c9be[_0xda0c('0x35')];}_0x2a314[_0xda0c('0x26')](_0x526dd2)[_0xda0c('0x36')](_0x15c9be);};}exports[_0xda0c('0x37')]=function(_0x3f9dee,_0x10a58f){var _0x5a1ac3={},_0x3eae10={},_0x4230ae={'count':0x0,'rows':[]};var _0x132f46=_[_0xda0c('0x38')](db['FaxMessage'][_0xda0c('0x39')],function(_0x1aa19b){return{'name':_0x1aa19b[_0xda0c('0x3a')],'type':_0x1aa19b[_0xda0c('0x3b')][_0xda0c('0x3c')]};});_0x3eae10[_0xda0c('0x3d')]=_[_0xda0c('0x38')](_0x132f46,'name');_0x3eae10[_0xda0c('0x3e')]=_[_0xda0c('0x3f')](_0x3f9dee[_0xda0c('0x3e')]);_0x3eae10[_0xda0c('0x40')]=_['intersection'](_0x3eae10['model'],_0x3eae10[_0xda0c('0x3e')]);_0x5a1ac3['attributes']=_[_0xda0c('0x41')](_0x3eae10[_0xda0c('0x3d')],qs['fields'](_0x3f9dee[_0xda0c('0x3e')][_0xda0c('0x42')]));_0x5a1ac3[_0xda0c('0x43')]=_0x5a1ac3[_0xda0c('0x43')]['length']?_0x5a1ac3[_0xda0c('0x43')]:_0x3eae10[_0xda0c('0x3d')];if(!_0x3f9dee['query'][_0xda0c('0x44')]('nolimit')){_0x5a1ac3['limit']=qs[_0xda0c('0x2a')](_0x3f9dee[_0xda0c('0x3e')][_0xda0c('0x2a')]);_0x5a1ac3[_0xda0c('0x28')]=qs['offset'](_0x3f9dee[_0xda0c('0x3e')]['offset']);}_0x5a1ac3['order']=qs[_0xda0c('0x45')](_0x3f9dee[_0xda0c('0x3e')][_0xda0c('0x45')]);_0x5a1ac3[_0xda0c('0x46')]=qs['filters'](_[_0xda0c('0x47')](_0x3f9dee[_0xda0c('0x3e')],_0x3eae10[_0xda0c('0x40')]),_0x132f46);if(_0x3f9dee[_0xda0c('0x3e')]['filter']){_0x5a1ac3[_0xda0c('0x46')]=_[_0xda0c('0x48')](_0x5a1ac3[_0xda0c('0x46')],{'$or':_[_0xda0c('0x38')](_0x132f46,function(_0x538171){if(_0x538171[_0xda0c('0x3b')]!=='VIRTUAL'){var _0x291fb4={};_0x291fb4[_0x538171[_0xda0c('0x35')]]={'$like':'%'+_0x3f9dee['query'][_0xda0c('0x49')]+'%'};return _0x291fb4;}})});}_0x5a1ac3=_[_0xda0c('0x48')]({},_0x5a1ac3,_0x3f9dee[_0xda0c('0x4a')]);var _0x3d58fb={'where':_0x5a1ac3[_0xda0c('0x46')]};return db[_0xda0c('0x4b')][_0xda0c('0x2b')](_0x3d58fb)[_0xda0c('0x1d')](function(_0x37be64){_0x4230ae['count']=_0x37be64;if(_0x3f9dee['query'][_0xda0c('0x4c')]){_0x5a1ac3[_0xda0c('0x4d')]=[{'all':!![]}];}return db['FaxMessage'][_0xda0c('0x4e')](_0x5a1ac3);})['then'](function(_0x2dad3a){_0x4230ae[_0xda0c('0x4f')]=_0x2dad3a;return _0x4230ae;})[_0xda0c('0x1d')](respondWithFilteredResult(_0x10a58f,_0x5a1ac3))[_0xda0c('0x50')](handleError(_0x10a58f,null));};exports[_0xda0c('0x51')]=function(_0x210ee8,_0x716d){var _0x2e9332={'raw':!![],'where':{'id':_0x210ee8['params']['id']}},_0x1cc1f9={};_0x1cc1f9[_0xda0c('0x3d')]=_[_0xda0c('0x3f')](db[_0xda0c('0x4b')][_0xda0c('0x39')]);_0x1cc1f9[_0xda0c('0x3e')]=_[_0xda0c('0x3f')](_0x210ee8[_0xda0c('0x3e')]);_0x1cc1f9[_0xda0c('0x40')]=_[_0xda0c('0x41')](_0x1cc1f9[_0xda0c('0x3d')],_0x1cc1f9['query']);_0x2e9332['attributes']=_[_0xda0c('0x41')](_0x1cc1f9[_0xda0c('0x3d')],qs[_0xda0c('0x42')](_0x210ee8[_0xda0c('0x3e')]['fields']));_0x2e9332[_0xda0c('0x43')]=_0x2e9332[_0xda0c('0x43')][_0xda0c('0x52')]?_0x2e9332[_0xda0c('0x43')]:_0x1cc1f9[_0xda0c('0x3d')];if(_0x210ee8[_0xda0c('0x3e')][_0xda0c('0x4c')]){_0x2e9332[_0xda0c('0x4d')]=[{'all':!![]}];}_0x2e9332=_['merge']({},_0x2e9332,_0x210ee8[_0xda0c('0x4a')]);return db[_0xda0c('0x4b')][_0xda0c('0x53')](_0x2e9332)[_0xda0c('0x1d')](handleEntityNotFound(_0x716d,null))[_0xda0c('0x1d')](respondWithResult(_0x716d,null))[_0xda0c('0x50')](handleError(_0x716d,null));};exports[_0xda0c('0x30')]=function(_0x532236,_0x10b39f){if(_0x532236[_0xda0c('0x54')]['id']){delete _0x532236['body']['id'];}return db['FaxMessage'][_0xda0c('0x53')]({'where':{'id':_0x532236[_0xda0c('0x55')]['id']}})[_0xda0c('0x1d')](handleEntityNotFound(_0x10b39f,null))['then'](saveUpdates(_0x532236[_0xda0c('0x54')],null))['then'](respondWithResult(_0x10b39f,null))[_0xda0c('0x50')](handleError(_0x10b39f,null));};exports[_0xda0c('0x31')]=function(_0x2d7f43,_0x40432b){return db[_0xda0c('0x4b')][_0xda0c('0x53')]({'where':{'id':_0x2d7f43[_0xda0c('0x55')]['id']}})[_0xda0c('0x1d')](handleEntityNotFound(_0x40432b,null))['then'](removeEntity(_0x40432b,null))[_0xda0c('0x50')](handleError(_0x40432b,null));};exports[_0xda0c('0x56')]=function(_0x556278,_0x5b6429){return db[_0xda0c('0x4b')][_0xda0c('0x56')]()[_0xda0c('0x1d')](respondWithResult(_0x5b6429,null))[_0xda0c('0x50')](handleError(_0x5b6429,null));};var interaction_log=require(_0xda0c('0x57'))(_0xda0c('0x58'));exports[_0xda0c('0x59')]=function(_0x4bbc86,_0x4748ec,_0x31fc22){var _0x78a21c={'agent':{},'channel':'fax'};if(_0x4bbc86[_0xda0c('0x54')]['id']){delete _0x4bbc86[_0xda0c('0x54')]['id'];}_0x4bbc86[_0xda0c('0x54')][_0xda0c('0x5a')]=!![];_0x4bbc86[_0xda0c('0x54')][_0xda0c('0x5b')]=moment()[_0xda0c('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x4bbc86[_0xda0c('0x54')][_0xda0c('0x5d')]=_0x4bbc86[_0xda0c('0x54')][_0xda0c('0x5d')]||_0x4bbc86['user']['id'];_0x78a21c['agent']['id']=_0x4bbc86[_0xda0c('0x54')][_0xda0c('0x5d')];return db[_0xda0c('0x4b')][_0xda0c('0x53')]({'where':{'id':_0x4bbc86[_0xda0c('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4748ec,null))['then'](saveUpdates(_0x4bbc86['body'],null))[_0xda0c('0x1d')](function(_0x430342){if(_0x430342){_0x78a21c[_0xda0c('0x24')]=_0x430342[_0xda0c('0x5e')]({'plain':!![]});return db[_0xda0c('0x5f')][_0xda0c('0x53')]({'where':{'id':_0x430342[_0xda0c('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x4748ec,null))['then'](function(_0x4b5e57){if(_0x4b5e57){return _0x4b5e57[_0xda0c('0x30')]({'UserId':_0x4bbc86['body'][_0xda0c('0x5d')],'read1stAt':_[_0xda0c('0x61')](_0x4b5e57[_0xda0c('0x62')])?moment()[_0xda0c('0x5c')](_0xda0c('0x63')):undefined});}return null;})[_0xda0c('0x1d')](function(_0x1745e6){if(_0x1745e6){_0x78a21c[_0xda0c('0x64')]=_0x1745e6[_0xda0c('0x5e')]({'plain':!![]});interaction_log[_0xda0c('0x65')](_0xda0c('0x66'),_0x4bbc86['user']['id'],_0x4bbc86[_0xda0c('0x67')][_0xda0c('0x35')],_0x4bbc86[_0xda0c('0x67')]['role'],_0x78a21c[_0xda0c('0x64')]['id'],_0x4bbc86[_0xda0c('0x54')]?JSON[_0xda0c('0x22')](_0x4bbc86[_0xda0c('0x54')]):_0xda0c('0x68'));return respondWithRpcPromise(_0xda0c('0x69'),_0xda0c('0x6a'),_0x78a21c);}return null;})[_0xda0c('0x1d')](function(_0x208842){var _0x2e8033='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x208842['message'][_0xda0c('0x6b')];return db[_0xda0c('0x6c')][_0xda0c('0x3e')](_0x2e8033,{'type':db[_0xda0c('0x6d')][_0xda0c('0x6e')][_0xda0c('0x6f')],'raw':!![]})[_0xda0c('0x1d')](function(_0x1b8055){return _0x1b8055;});})[_0xda0c('0x1d')](function(_0x472e2c){if(_0x472e2c){_0x78a21c[_0xda0c('0x24')][_0xda0c('0x70')]=_0x472e2c[0x0];if(!_0x4bbc86[_0xda0c('0x54')][_0xda0c('0x5d')])return;return db[_0xda0c('0x71')]['find']({'where':{'id':_0x4bbc86[_0xda0c('0x54')][_0xda0c('0x5d')],'role':_0xda0c('0x72')},'attributes':['id',_0xda0c('0x35'),_0xda0c('0x73'),'email',_0xda0c('0x74')],'raw':!![]});}return null;})[_0xda0c('0x1d')](function(_0x2aff9e){if(!_0x2aff9e)return null;_0x78a21c[_0xda0c('0x24')]['agent']=_0x2aff9e;return _0x78a21c;})[_0xda0c('0x1d')](function(_0x503ec3){if(_0x503ec3){if(_0x4bbc86[_0xda0c('0x54')][_0xda0c('0x75')]){_0x78a21c[_0xda0c('0x24')]['interface']=util[_0xda0c('0x5c')](_0xda0c('0x76'),_0x4bbc86[_0xda0c('0x67')][_0xda0c('0x35')]);_0x78a21c[_0xda0c('0x24')][_0xda0c('0x77')]=_0x78a21c[_0xda0c('0x77')];_0x78a21c[_0xda0c('0x24')][_0xda0c('0x78')]=_0x78a21c['channel'];_0x78a21c[_0xda0c('0x24')]['event']=_0xda0c('0x59');return respondWithRpcPromise(_0xda0c('0x79'),_0xda0c('0x79'),{'event':'acceptmessage','message':_0x78a21c[_0xda0c('0x24')]},client9002)['then'](function(){return _0x78a21c;});}return _0x78a21c;}return null;})[_0xda0c('0x1d')](respondWithResult(_0x4748ec,null))[_0xda0c('0x50')](handleError(_0x4748ec,null));};var interaction_log=require(_0xda0c('0x57'))('fax-interactions');exports['reject']=function(_0x194b16,_0x9eb683,_0xf4d344){var _0xbd0588={'agent':{},'channel':'fax'};if(_0x194b16[_0xda0c('0x54')]['id']){delete _0x194b16[_0xda0c('0x54')]['id'];}_0x194b16[_0xda0c('0x54')][_0xda0c('0x5d')]=_0x194b16[_0xda0c('0x54')][_0xda0c('0x5d')]||_0x194b16[_0xda0c('0x67')]['id'];_0xbd0588[_0xda0c('0x72')]['id']=_0x194b16[_0xda0c('0x54')][_0xda0c('0x5d')];return db[_0xda0c('0x4b')][_0xda0c('0x53')]({'where':{'id':_0x194b16[_0xda0c('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x9eb683,null))[_0xda0c('0x1d')](function(_0x9bceca){if(_0x9bceca){_0xbd0588[_0xda0c('0x24')]=_0x9bceca[_0xda0c('0x5e')]({'plain':!![]});return db[_0xda0c('0x5f')][_0xda0c('0x53')]({'where':{'id':_0x9bceca[_0xda0c('0x60')]}});}return null;})[_0xda0c('0x1d')](handleEntityNotFound(_0x9eb683,null))[_0xda0c('0x1d')](function(_0x5ccade){if(_0x5ccade){_0xbd0588[_0xda0c('0x64')]=_0x5ccade[_0xda0c('0x5e')]({'plain':!![]});interaction_log[_0xda0c('0x65')](_0xda0c('0x7a'),_0x194b16[_0xda0c('0x67')]['id'],_0x194b16['user'][_0xda0c('0x35')],_0x194b16['user'][_0xda0c('0x7b')],_0xbd0588[_0xda0c('0x64')]['id'],_0x194b16[_0xda0c('0x54')]?JSON['stringify'](_0x194b16[_0xda0c('0x54')]):_0xda0c('0x68'));return respondWithRpcPromise(_0xda0c('0x7c'),_0xda0c('0x7d'),_0xbd0588);}return null;})['then'](function(_0x37f124){var _0x114239=_0xda0c('0x7e')+_0x37f124['message']['ContactId'];return db[_0xda0c('0x6c')]['query'](_0x114239,{'type':db[_0xda0c('0x6d')][_0xda0c('0x6e')]['SELECT'],'raw':!![]})['then'](function(_0x3457ed){return _0x3457ed;});})[_0xda0c('0x1d')](function(_0x512484){if(_0x512484){_0xbd0588[_0xda0c('0x24')][_0xda0c('0x70')]=_0x512484[0x0];if(!_0x194b16[_0xda0c('0x54')]['UserId'])return;return db[_0xda0c('0x71')][_0xda0c('0x53')]({'where':{'id':_0x194b16[_0xda0c('0x54')]['UserId'],'role':'agent'},'attributes':['id',_0xda0c('0x35'),'fullname',_0xda0c('0x7f'),'internal'],'raw':!![]});}return null;})[_0xda0c('0x1d')](function(_0x4b3285){if(!_0x4b3285)return null;_0xbd0588[_0xda0c('0x24')][_0xda0c('0x72')]=_0x4b3285;return _0xbd0588;})[_0xda0c('0x1d')](function(_0x46be71){if(_0x46be71){_0x46be71[_0xda0c('0x24')][_0xda0c('0x80')]=util['format'](_0xda0c('0x76'),_0x194b16[_0xda0c('0x67')]['name']);_0x46be71[_0xda0c('0x24')][_0xda0c('0x77')]=_0xbd0588[_0xda0c('0x77')];_0x46be71[_0xda0c('0x24')]['motionChannel']=_0xbd0588['channel'];_0x46be71[_0xda0c('0x24')]['event']=_0xda0c('0x2f');respondWithRpcPromise('EventManager',_0xda0c('0x79'),{'event':_0xda0c('0x81'),'message':_0x46be71['message']},client9002);return _0xbd0588;}return null;})[_0xda0c('0x1d')](respondWithResult(_0x9eb683,null))['catch'](handleError(_0x9eb683,null));};exports[_0xda0c('0x82')]=function(_0x4f68c4,_0x5a0865){var _0xae56d6;return db[_0xda0c('0x4b')]['create'](_0x4f68c4['body'],{})['then'](function(_0xe7ce0){_0xae56d6=_0xe7ce0;return db[_0xda0c('0x83')][_0xda0c('0x84')]({'where':{'id':_0xae56d6[_0xda0c('0x6b')]}});})['then'](function(_0xce0fe1){if(_['isNil'](_0xce0fe1)){return;}else{_0xae56d6['fax']=_0xce0fe1[_0xda0c('0x85')];return db[_0xda0c('0x86')][_0xda0c('0x84')]({'where':{'id':_0xae56d6['AttachmentId']}});}})['then'](function(_0x9b2884){return respondWithRpcPromise(_0xda0c('0x87'),_0xda0c('0x87'),{'FaxAccountId':_[_0xda0c('0x61')](_0x4f68c4[_0xda0c('0x54')])?undefined:_0x4f68c4[_0xda0c('0x54')][_0xda0c('0x88')],'path':_[_0xda0c('0x61')](_0x9b2884)?undefined:util[_0xda0c('0x5c')](_0xda0c('0x89'),_0x9b2884[_0xda0c('0x8a')]),'fax':_['isNil'](_0xae56d6[_0xda0c('0x85')])?undefined:_0xae56d6[_0xda0c('0x85')],'AttachmentId':_0xae56d6[_0xda0c('0x8b')]},client9002);})[_0xda0c('0x1d')](respondWithResult(_0x5a0865,0xc9))[_0xda0c('0x50')](handleError(_0x5a0865,null));};exports['download']=function(_0x52f67f,_0x410eb4){var _0x3b0487=path[_0xda0c('0x8c')](config[_0xda0c('0x8d')],_0xda0c('0x8e'),_0xda0c('0x8f'),_0xda0c('0x90'));return db[_0xda0c('0x4b')][_0xda0c('0x53')]({'where':{'id':_0x52f67f[_0xda0c('0x55')]['id']},'include':[{'model':db[_0xda0c('0x86')],'as':'Attachment'}]})[_0xda0c('0x1d')](handleEntityNotFound(_0x410eb4,null))['then'](function(_0x591472){if(_0x591472){return _0x410eb4[_0xda0c('0x91')](path[_0xda0c('0x8c')](_0x3b0487,_0x591472[_0xda0c('0x86')][_0xda0c('0x8a')]));}})[_0xda0c('0x50')](handleError(_0x410eb4,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 684491d..f266abf 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 _0x3914=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x4ae9f0,_0x10077c){var _0x4be677=function(_0x83d38b){while(--_0x83d38b){_0x4ae9f0['push'](_0x4ae9f0['shift']());}};_0x4be677(++_0x10077c);}(_0x3914,0xeb));var _0x4391=function(_0x3ee55a,_0x19aeea){_0x3ee55a=_0x3ee55a-0x0;var _0x581800=_0x3914[_0x3ee55a];return _0x581800;};'use strict';var EventEmitter=require(_0x4391('0x0'));var FaxMessage=require(_0x4391('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4391('0x2')](0x0);var events={'afterCreate':_0x4391('0x3'),'afterUpdate':'update','afterDestroy':_0x4391('0x4')};function emitEvent(_0x343fb7){return function(_0x175dbc,_0x5b5acb,_0x1eecd4){FaxMessageEvents[_0x4391('0x5')](_0x343fb7+':'+_0x175dbc['id'],_0x175dbc);FaxMessageEvents['emit'](_0x343fb7,_0x175dbc);_0x1eecd4(null);};}for(var e in events){if(events[_0x4391('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x4391('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x2515=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x456000,_0x21cf68){var _0x2094e2=function(_0x58f3ca){while(--_0x58f3ca){_0x456000['push'](_0x456000['shift']());}};_0x2094e2(++_0x21cf68);}(_0x2515,0x1c2));var _0x5251=function(_0x14f5ed,_0x3fd34d){_0x14f5ed=_0x14f5ed-0x0;var _0x49f682=_0x2515[_0x14f5ed];return _0x49f682;};'use strict';var EventEmitter=require(_0x5251('0x0'));var FaxMessage=require(_0x5251('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x5251('0x2')](0x0);var events={'afterCreate':_0x5251('0x3'),'afterUpdate':_0x5251('0x4'),'afterDestroy':_0x5251('0x5')};function emitEvent(_0x4c95e4){return function(_0x20a3e1,_0x3fe745,_0x570b38){FaxMessageEvents[_0x5251('0x6')](_0x4c95e4+':'+_0x20a3e1['id'],_0x20a3e1);FaxMessageEvents[_0x5251('0x6')](_0x4c95e4,_0x20a3e1);_0x570b38(null);};}for(var e in events){if(events[_0x5251('0x7')](e)){var event=events[e];FaxMessage[_0x5251('0x8')](e,emitEvent(event));}}module[_0x5251('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 4f476d5..8e1b619 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 _0x5ad2=['out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x5ad2,0x1a1));var _0x25ad=function(_0x387442,_0x22cf1c){_0x387442=_0x387442-0x0;var _0x4def6d=_0x5ad2[_0x387442];return _0x4def6d;};'use strict';var _=require('lodash');var util=require(_0x25ad('0x0'));var logger=require(_0x25ad('0x1'))('api');var moment=require(_0x25ad('0x2'));var BPromise=require(_0x25ad('0x3'));var rp=require(_0x25ad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25ad('0x5'));var config=require(_0x25ad('0x6'));var attributes=require(_0x25ad('0x7'));module[_0x25ad('0x8')]=function(_0x3b3fd7,_0x586e51){return _0x3b3fd7[_0x25ad('0x9')](_0x25ad('0xa'),attributes,{'tableName':_0x25ad('0xb'),'paranoid':![],'indexes':[{'name':_0x25ad('0xc'),'fields':[_0x25ad('0xd')],'type':_0x25ad('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e7138,_0x1795f7,_0x56f59b){var _0x4ec805=_0x3b3fd7[_0x25ad('0xf')];var _0xc96176=_0x3e7138['get']({'plain':!![]});if(_0xc96176['direction']['toLowerCase']()==='in'||_0xc96176[_0x25ad('0x10')][_0x25ad('0x11')]()===_0x25ad('0x12')&&!_0xc96176[_0x25ad('0x13')]&&!_[_0x25ad('0x14')](_0xc96176[_0x25ad('0x15')])){_0x4ec805[_0x25ad('0x16')]['findOne']({'where':{'id':_0xc96176[_0x25ad('0x17')]}})[_0x25ad('0x18')](function(_0x2f76a7){if(_0x2f76a7){_0x2f76a7[_0x25ad('0x19')]({'lastMsgAt':_0xc96176['createdAt'],'lastMsgDirection':_0xc96176[_0x25ad('0x10')]['toLowerCase']()});}})[_0x25ad('0x1a')](function(_0x1a097f){console['error'](_0x1a097f);});}_0x56f59b();}},'charset':_0x25ad('0x1b'),'collate':_0x25ad('0x1c')});}; \ No newline at end of file +var _0x50e8=['get','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','createdAt','catch','error','utf8mb4','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','fax_messages','body','FULLTEXT'];(function(_0x33edaa,_0x1b51f8){var _0x5ac492=function(_0x3099a9){while(--_0x3099a9){_0x33edaa['push'](_0x33edaa['shift']());}};_0x5ac492(++_0x1b51f8);}(_0x50e8,0x1a5));var _0x850e=function(_0xfd5f37,_0x24a79c){_0xfd5f37=_0xfd5f37-0x0;var _0x11bd01=_0x50e8[_0xfd5f37];return _0x11bd01;};'use strict';var _=require(_0x850e('0x0'));var util=require('util');var logger=require(_0x850e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x850e('0x2'));var rp=require(_0x850e('0x3'));var fs=require('fs');var path=require(_0x850e('0x4'));var rimraf=require('rimraf');var config=require(_0x850e('0x5'));var attributes=require('./faxMessage.attributes');module[_0x850e('0x6')]=function(_0x1721eb,_0x25b63a){return _0x1721eb[_0x850e('0x7')]('FaxMessage',attributes,{'tableName':_0x850e('0x8'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x850e('0x9')],'type':_0x850e('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x46c488,_0x5b6a60,_0x268c87){var _0x39b8b3=_0x1721eb['models'];var _0x4156b3=_0x46c488[_0x850e('0xb')]({'plain':!![]});if(_0x4156b3[_0x850e('0xc')][_0x850e('0xd')]()==='in'||_0x4156b3['direction'][_0x850e('0xd')]()===_0x850e('0xe')&&!_0x4156b3[_0x850e('0xf')]&&!_[_0x850e('0x10')](_0x4156b3[_0x850e('0x11')])){_0x39b8b3['FaxInteraction'][_0x850e('0x12')]({'where':{'id':_0x4156b3[_0x850e('0x13')]}})['then'](function(_0x32b28a){if(_0x32b28a){_0x32b28a['update']({'lastMsgAt':_0x4156b3[_0x850e('0x14')],'lastMsgDirection':_0x4156b3[_0x850e('0xc')]['toLowerCase']()});}})[_0x850e('0x15')](function(_0x5e8218){console[_0x850e('0x16')](_0x5e8218);});}_0x268c87();}},'charset':_0x850e('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 27f2891..43802bc 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 _0x55e0=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxMessage.socket','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','then','UpdateFaxMessage','update','where','attributes','limit','lodash','util'];(function(_0x4c9aee,_0x4ba22a){var _0x1b0cb7=function(_0x562dc5){while(--_0x562dc5){_0x4c9aee['push'](_0x4c9aee['shift']());}};_0x1b0cb7(++_0x4ba22a);}(_0x55e0,0xdc));var _0x055e=function(_0x5c7ca0,_0x2a7ecb){_0x5c7ca0=_0x5c7ca0-0x0;var _0x226229=_0x55e0[_0x5c7ca0];return _0x226229;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x055e('0xa')]=_['defaults'](config[_0x055e('0xa')],{'host':_0x055e('0xb'),'port':0x18eb});var socket=require(_0x055e('0xc'))(new Redis(config[_0x055e('0xa')]));require(_0x055e('0xd'))['register'](socket);function respondWithRpcPromise(_0x40779c,_0xd67814,_0xb816c){return new BPromise(function(_0xa0d384,_0x238068){return client['request'](_0x40779c,_0xb816c)['then'](function(_0x187cce){logger['info'](_0x055e('0xe'),_0xd67814,_0x055e('0xf'));logger[_0x055e('0x10')](_0x055e('0x11'),_0xd67814,_0x055e('0xf'),JSON[_0x055e('0x12')](_0x187cce));if(_0x187cce[_0x055e('0x13')]){if(_0x187cce['error'][_0x055e('0x14')]===0x1f4){logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);return _0x238068(_0x187cce['error'][_0x055e('0x15')]);}logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce['error'][_0x055e('0x15')]);return _0xa0d384(_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);}else{logger[_0x055e('0x16')](_0x055e('0xe'),_0xd67814,'request\x20sent');_0xa0d384(_0x187cce[_0x055e('0x17')][_0x055e('0x15')]);}})[_0x055e('0x18')](function(_0x2ed6fb){logger['error'](_0x055e('0xe'),_0xd67814,_0x2ed6fb);_0x238068(_0x2ed6fb);});});}exports[_0x055e('0x19')]=function(_0x58e44a){var _0xe2b7b5=this;return new Promise(function(_0x4412f9,_0x10258f){return db[_0x055e('0x1a')][_0x055e('0x1b')](_0x58e44a[_0x055e('0x1c')],{'raw':_0x58e44a['options']?_0x58e44a[_0x055e('0x1d')][_0x055e('0x1e')]===undefined?!![]:![]:!![]})[_0x055e('0x1f')](function(_0x5930ff){logger[_0x055e('0x16')](_0x055e('0x19'),_0x58e44a);logger[_0x055e('0x10')](_0x055e('0x19'),_0x58e44a,JSON['stringify'](_0x5930ff));_0x4412f9(_0x5930ff);})[_0x055e('0x18')](function(_0x56c372){logger[_0x055e('0x13')](_0x055e('0x19'),_0x56c372[_0x055e('0x15')],_0x58e44a);_0x10258f(_0xe2b7b5[_0x055e('0x13')](0x1f4,_0x56c372[_0x055e('0x15')]));});});};exports[_0x055e('0x20')]=function(_0x58caf9){var _0x2fb49b=this;return new Promise(function(_0x1f90a9,_0x2a82f8){return db['FaxMessage'][_0x055e('0x21')](_0x58caf9[_0x055e('0x1c')],{'raw':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x22')]||null:null,'attributes':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')][_0x055e('0x23')]||null:null,'limit':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x24')]||null:null})[_0x055e('0x1f')](function(_0x293062){logger[_0x055e('0x16')](_0x055e('0x20'),_0x58caf9);logger[_0x055e('0x10')](_0x055e('0x20'),_0x58caf9,JSON[_0x055e('0x12')](_0x293062));_0x1f90a9(_0x293062);})['catch'](function(_0x26d1c2){logger[_0x055e('0x13')]('UpdateFaxMessage',_0x26d1c2[_0x055e('0x15')],_0x58caf9);_0x2a82f8(_0x2fb49b[_0x055e('0x13')](0x1f4,_0x26d1c2[_0x055e('0x15')]));});});}; \ No newline at end of file +var _0x7bae=['request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxMessage,\x20%s,\x20%s','create','body','options','raw','CreateFaxMessage','debug','FaxMessage','update','where','limit','UpdateFaxMessage','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','request','then','info'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x7bae[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});config[_0xe7ba('0xa')]=_[_0xe7ba('0xb')](config[_0xe7ba('0xa')],{'host':_0xe7ba('0xc'),'port':0x18eb});var socket=require(_0xe7ba('0xd'))(new Redis(config[_0xe7ba('0xa')]));require(_0xe7ba('0xe'))['register'](socket);function respondWithRpcPromise(_0x3df8bf,_0xe57e33,_0x375ebb){return new BPromise(function(_0x276bc3,_0x15083a){return client[_0xe7ba('0xf')](_0x3df8bf,_0x375ebb)[_0xe7ba('0x10')](function(_0x448bcc){logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0xe7ba('0x12'));logger['debug'](_0xe7ba('0x13'),_0xe57e33,_0xe7ba('0x12'),JSON[_0xe7ba('0x14')](_0x448bcc));if(_0x448bcc[_0xe7ba('0x15')]){if(_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x16')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x17')]);return _0x15083a(_0x448bcc[_0xe7ba('0x15')]['message']);}logger[_0xe7ba('0x15')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc['error']['message']);return _0x276bc3(_0x448bcc[_0xe7ba('0x15')]['message']);}else{logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,'request\x20sent');_0x276bc3(_0x448bcc['result'][_0xe7ba('0x17')]);}})[_0xe7ba('0x18')](function(_0x39ca38){logger[_0xe7ba('0x15')](_0xe7ba('0x19'),_0xe57e33,_0x39ca38);_0x15083a(_0x39ca38);});});}exports['CreateFaxMessage']=function(_0x149c62){var _0x20c653=this;return new Promise(function(_0x3b40fb,_0x136ec6){return db['FaxMessage'][_0xe7ba('0x1a')](_0x149c62[_0xe7ba('0x1b')],{'raw':_0x149c62['options']?_0x149c62[_0xe7ba('0x1c')][_0xe7ba('0x1d')]===undefined?!![]:![]:!![]})[_0xe7ba('0x10')](function(_0x7ab9e4){logger[_0xe7ba('0x11')](_0xe7ba('0x1e'),_0x149c62);logger[_0xe7ba('0x1f')](_0xe7ba('0x1e'),_0x149c62,JSON[_0xe7ba('0x14')](_0x7ab9e4));_0x3b40fb(_0x7ab9e4);})[_0xe7ba('0x18')](function(_0x58cf43){logger['error']('CreateFaxMessage',_0x58cf43['message'],_0x149c62);_0x136ec6(_0x20c653[_0xe7ba('0x15')](0x1f4,_0x58cf43['message']));});});};exports['UpdateFaxMessage']=function(_0x5ece11){var _0x255def=this;return new Promise(function(_0x32cc00,_0xe32862){return db[_0xe7ba('0x20')][_0xe7ba('0x21')](_0x5ece11[_0xe7ba('0x1b')],{'raw':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11['options'][_0xe7ba('0x22')]||null:null,'attributes':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['attributes']||null:null,'limit':_0x5ece11['options']?_0x5ece11[_0xe7ba('0x1c')][_0xe7ba('0x23')]||null:null})[_0xe7ba('0x10')](function(_0x20b6cd){logger[_0xe7ba('0x11')]('UpdateFaxMessage',_0x5ece11);logger[_0xe7ba('0x1f')](_0xe7ba('0x24'),_0x5ece11,JSON['stringify'](_0x20b6cd));_0x32cc00(_0x20b6cd);})[_0xe7ba('0x18')](function(_0x530227){logger['error'](_0xe7ba('0x24'),_0x530227[_0xe7ba('0x17')],_0x5ece11);_0xe32862(_0x255def[_0xe7ba('0x15')](0x1f4,_0x530227['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index baee5ac..7c299ae 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 _0x67ca=['remove','update','register','faxMessage:','./faxMessage.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67ca,0x1cc));var _0xa67c=function(_0x3f8065,_0x1f20d5){_0x3f8065=_0x3f8065-0x0;var _0x53c230=_0x67ca[_0x3f8065];return _0x53c230;};'use strict';var FaxMessageEvents=require(_0xa67c('0x0'));var events=[_0xa67c('0x1'),_0xa67c('0x2'),_0xa67c('0x3')];function createListener(_0x49b9b6,_0x25a3fc){return function(_0x36f950){_0x25a3fc['emit'](_0x49b9b6,_0x36f950);};}function removeListener(_0x66a0b3,_0x1901f9){return function(){FaxMessageEvents['removeListener'](_0x66a0b3,_0x1901f9);};}exports[_0xa67c('0x4')]=function(_0x12dc92){for(var _0x4c6d3c=0x0,_0x19e274=events['length'];_0x4c6d3c<_0x19e274;_0x4c6d3c++){var _0x2bc140=events[_0x4c6d3c];var _0x3bcc41=createListener(_0xa67c('0x5')+_0x2bc140,_0x12dc92);FaxMessageEvents['on'](_0x2bc140,_0x3bcc41);}}; \ No newline at end of file +var _0x6ca6=['faxMessage:','./faxMessage.events','remove','emit','removeListener','register','length'];(function(_0x5ff517,_0x3e4ee0){var _0x19a245=function(_0x4c00ac){while(--_0x4c00ac){_0x5ff517['push'](_0x5ff517['shift']());}};_0x19a245(++_0x3e4ee0);}(_0x6ca6,0x13c));var _0x66ca=function(_0x19d1d5,_0x1bc696){_0x19d1d5=_0x19d1d5-0x0;var _0x2a38fc=_0x6ca6[_0x19d1d5];return _0x2a38fc;};'use strict';var FaxMessageEvents=require(_0x66ca('0x0'));var events=['save',_0x66ca('0x1'),'update'];function createListener(_0x431098,_0x3222f7){return function(_0x499437){_0x3222f7[_0x66ca('0x2')](_0x431098,_0x499437);};}function removeListener(_0x3668d8,_0x34ec76){return function(){FaxMessageEvents[_0x66ca('0x3')](_0x3668d8,_0x34ec76);};}exports[_0x66ca('0x4')]=function(_0xe93c50){for(var _0x2efa4f=0x0,_0xfc51dd=events[_0x66ca('0x5')];_0x2efa4f<_0xfc51dd;_0x2efa4f++){var _0x40e667=events[_0x2efa4f];var _0x43f3f3=createListener(_0x66ca('0x6')+_0x40e667,_0xe93c50);FaxMessageEvents['on'](_0x40e667,_0x43f3f3);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ff0dcdd..5911f06 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 _0x4e81=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','download','post','tracked','fax','faxmessage:create','create','update','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','fs-extra'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x4e81,0x1bc));var _0x14e8=function(_0x3e91a9,_0x53c466){_0x3e91a9=_0x3e91a9-0x0;var _0x25c9ad=_0x4e81[_0x3e91a9];return _0x25c9ad;};'use strict';var multer=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var path=require(_0x14e8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x14e8('0x3'));var auth=require(_0x14e8('0x4'));var interaction=require(_0x14e8('0x5'));var config=require(_0x14e8('0x6'));var controller=require(_0x14e8('0x7'));router[_0x14e8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x14e8('0x8')](_0x14e8('0x9'),auth[_0x14e8('0xa')](),controller[_0x14e8('0xb')]);router[_0x14e8('0x8')](_0x14e8('0xc'),auth[_0x14e8('0xa')](),controller[_0x14e8('0xd')]);router[_0x14e8('0x8')]('/:id/download',auth[_0x14e8('0xa')](),controller[_0x14e8('0xe')]);router[_0x14e8('0xf')]('/',auth[_0x14e8('0xa')](),interaction[_0x14e8('0x10')](_0x14e8('0x11'),_0x14e8('0x12')),controller[_0x14e8('0x13')]);router['put'](_0x14e8('0xc'),auth['isAuthenticated'](),controller[_0x14e8('0x14')]);router[_0x14e8('0x15')](_0x14e8('0x16'),auth['isAuthenticated'](),controller[_0x14e8('0x17')]);router['put'](_0x14e8('0x18'),auth['isAuthenticated'](),controller[_0x14e8('0x19')]);router[_0x14e8('0x1a')](_0x14e8('0xc'),auth[_0x14e8('0xa')](),controller['destroy']);module[_0x14e8('0x1b')]=router; \ No newline at end of file +var _0xda3f=['create','put','/:id/accept','/:id/reject','destroy','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create'];(function(_0x1a02cd,_0x469319){var _0x555453=function(_0x17ae4a){while(--_0x17ae4a){_0x1a02cd['push'](_0x1a02cd['shift']());}};_0x555453(++_0x469319);}(_0xda3f,0xec));var _0xfda3=function(_0x5aecfe,_0x1dad8d){_0x5aecfe=_0x5aecfe-0x0;var _0x44de4d=_0xda3f[_0x5aecfe];return _0x44de4d;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./faxMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')]('/',auth['isAuthenticated'](),interaction[_0xfda3('0xe')](_0xfda3('0xf'),_0xfda3('0x10')),controller[_0xfda3('0x11')]);router[_0xfda3('0x12')]('/:id',auth[_0xfda3('0x6')](),controller['update']);router[_0xfda3('0x12')](_0xfda3('0x13'),auth['isAuthenticated'](),controller['accept']);router['put'](_0xfda3('0x14'),auth[_0xfda3('0x6')](),controller['reject']);router['delete']('/:id',auth[_0xfda3('0x6')](),controller[_0xfda3('0x15')]);module[_0xfda3('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 7f7138f..00406c5 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 _0x43c4=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x5458f4,_0x4d3557){var _0x4dcace=function(_0x13df62){while(--_0x13df62){_0x5458f4['push'](_0x5458f4['shift']());}};_0x4dcace(++_0x4d3557);}(_0x43c4,0xf7));var _0x443c=function(_0x2e3d88,_0x290606){_0x2e3d88=_0x2e3d88-0x0;var _0x4af8bf=_0x43c4[_0x2e3d88];return _0x4af8bf;};'use strict';var Sequelize=require('sequelize');module[_0x443c('0x0')]={'name':{'type':Sequelize[_0x443c('0x1')],'unique':_0x443c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x443c('0x1')]},'timeout':{'type':Sequelize[_0x443c('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x443c('0x4')](_0x443c('0x5'),_0x443c('0x6'),_0x443c('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc9b0=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x1bd1f3,_0x3c6601){var _0x359317=function(_0x452d29){while(--_0x452d29){_0x1bd1f3['push'](_0x1bd1f3['shift']());}};_0x359317(++_0x3c6601);}(_0xc9b0,0x14c));var _0x0c9b=function(_0x423e39,_0x3ea4a2){_0x423e39=_0x423e39-0x0;var _0x385fd1=_0xc9b0[_0x423e39];return _0x385fd1;};'use strict';var Sequelize=require(_0x0c9b('0x0'));module[_0x0c9b('0x1')]={'name':{'type':Sequelize[_0x0c9b('0x2')],'unique':_0x0c9b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0c9b('0x2')]},'timeout':{'type':Sequelize[_0x0c9b('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0c9b('0x5')](_0x0c9b('0x6'),_0x0c9b('0x7'),_0x0c9b('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x0c9b('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 06846af..3c4bfa4 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 _0x4dd2=['filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserFaxQueue','FaxQueueId','User','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','Agents','online','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','ids','select','field','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','all','union','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','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','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','get','FaxQueues','UserProfileResource','destroy','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4dd2,0x1ea));var _0x24dd=function(_0x4334af,_0x21e066){_0x4334af=_0x4334af-0x0;var _0xec5be0=_0x4dd2[_0x4334af];return _0xec5be0;};'use strict';var emlformat=require(_0x24dd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x24dd('0x1'));var jsonpatch=require(_0x24dd('0x2'));var rp=require(_0x24dd('0x3'));var moment=require(_0x24dd('0x4'));var BPromise=require(_0x24dd('0x5'));var Mustache=require(_0x24dd('0x6'));var util=require(_0x24dd('0x7'));var path=require(_0x24dd('0x8'));var sox=require(_0x24dd('0x9'));var csv=require(_0x24dd('0xa'));var ejs=require(_0x24dd('0xb'));var fs=require('fs');var fs_extra=require(_0x24dd('0xc'));var _=require(_0x24dd('0xd'));var squel=require(_0x24dd('0xe'));var crypto=require('crypto');var jsforce=require(_0x24dd('0xf'));var deskjs=require(_0x24dd('0x10'));var toCsv=require(_0x24dd('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x24dd('0x11'));var authService=require(_0x24dd('0x12'));var qs=require(_0x24dd('0x13'));var as=require(_0x24dd('0x14'));var hardwareService=require(_0x24dd('0x15'));var logger=require(_0x24dd('0x16'))(_0x24dd('0x17'));var utils=require(_0x24dd('0x18'));var config=require(_0x24dd('0x19'));var licenseUtil=require(_0x24dd('0x1a'));var db=require(_0x24dd('0x1b'))['db'];config[_0x24dd('0x1c')]=_[_0x24dd('0x1d')](config[_0x24dd('0x1c')],{'host':_0x24dd('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x24dd('0x1c')]));require(_0x24dd('0x1f'))[_0x24dd('0x20')](socket);function respondWithStatusCode(_0x2c5fa2,_0x360035){_0x360035=_0x360035||0xcc;return function(_0x573bef){if(_0x573bef){return _0x2c5fa2[_0x24dd('0x21')](_0x360035);}return _0x2c5fa2[_0x24dd('0x22')](_0x360035)[_0x24dd('0x23')]();};}function respondWithResult(_0x4ae48a,_0x507e16){_0x507e16=_0x507e16||0xc8;return function(_0x4b5f85){if(_0x4b5f85){return _0x4ae48a[_0x24dd('0x22')](_0x507e16)[_0x24dd('0x24')](_0x4b5f85);}};}function respondWithFilteredResult(_0xdae9b8,_0x4b5b16){return function(_0x594dc0){if(_0x594dc0){var _0x50ced8=typeof _0x4b5b16[_0x24dd('0x25')]===_0x24dd('0x26')&&typeof _0x4b5b16['limit']==='undefined';var _0x4305ef=_0x594dc0[_0x24dd('0x27')];var _0x546cf5=_0x50ced8?0x0:_0x4b5b16['offset'];var _0x283a36=_0x50ced8?_0x594dc0[_0x24dd('0x27')]:_0x4b5b16[_0x24dd('0x25')]+_0x4b5b16[_0x24dd('0x28')];var _0x269ce7;if(_0x283a36>=_0x4305ef){_0x283a36=_0x4305ef;_0x269ce7=0xc8;}else{_0x269ce7=0xce;}_0xdae9b8['status'](_0x269ce7);return _0xdae9b8[_0x24dd('0x29')](_0x24dd('0x2a'),_0x546cf5+'-'+_0x283a36+'/'+_0x4305ef)[_0x24dd('0x24')](_0x594dc0);}return null;};}function patchUpdates(_0x3052e7){return function(_0x2e030b){try{jsonpatch[_0x24dd('0x2b')](_0x2e030b,_0x3052e7,!![]);}catch(_0x2c4d9d){return BPromise['reject'](_0x2c4d9d);}return _0x2e030b[_0x24dd('0x2c')]();};}function saveUpdates(_0x22adb6,_0x2d6c25){return function(_0x201306){if(_0x201306){return _0x201306[_0x24dd('0x2d')](_0x22adb6)[_0x24dd('0x2e')](function(_0x50ff1c){return _0x50ff1c;});}return null;};}function removeEntity(_0x325249,_0x4601dc){return function(_0x123bb2){if(_0x123bb2){return _0x123bb2['destroy']()[_0x24dd('0x2e')](function(){var _0x2e3dbe=_0x123bb2[_0x24dd('0x2f')]({'plain':!![]});var _0x473cde=_0x24dd('0x30');return db[_0x24dd('0x31')][_0x24dd('0x32')]({'where':{'type':_0x473cde,'resourceId':_0x2e3dbe['id']}})[_0x24dd('0x2e')](function(){return _0x123bb2;});})[_0x24dd('0x2e')](function(){_0x325249[_0x24dd('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e0fc,_0x172f1a){return function(_0x41b4c1){if(!_0x41b4c1){_0x17e0fc[_0x24dd('0x21')](0x194);}return _0x41b4c1;};}function handleError(_0x39ec9a,_0x4be7d8){_0x4be7d8=_0x4be7d8||0x1f4;return function(_0x3567d2){logger[_0x24dd('0x33')](_0x3567d2[_0x24dd('0x34')]);if(_0x3567d2['name']){delete _0x3567d2[_0x24dd('0x35')];}_0x39ec9a['status'](_0x4be7d8)[_0x24dd('0x36')](_0x3567d2);};}exports[_0x24dd('0x37')]=function(_0x57016e,_0x25b253){var _0x1a067e={},_0x3afffc={},_0x4ace5c={'count':0x0,'rows':[]};var _0xe665f6=_[_0x24dd('0x38')](db[_0x24dd('0x39')][_0x24dd('0x3a')],function(_0x2c4ff4){return{'name':_0x2c4ff4[_0x24dd('0x3b')],'type':_0x2c4ff4[_0x24dd('0x3c')]['key']};});_0x3afffc[_0x24dd('0x3d')]=_[_0x24dd('0x38')](_0xe665f6,_0x24dd('0x35'));_0x3afffc[_0x24dd('0x3e')]=_['keys'](_0x57016e['query']);_0x3afffc[_0x24dd('0x3f')]=_[_0x24dd('0x40')](_0x3afffc['model'],_0x3afffc[_0x24dd('0x3e')]);_0x1a067e[_0x24dd('0x41')]=_[_0x24dd('0x40')](_0x3afffc[_0x24dd('0x3d')],qs[_0x24dd('0x42')](_0x57016e[_0x24dd('0x3e')][_0x24dd('0x42')]));_0x1a067e[_0x24dd('0x41')]=_0x1a067e[_0x24dd('0x41')][_0x24dd('0x43')]?_0x1a067e[_0x24dd('0x41')]:_0x3afffc[_0x24dd('0x3d')];if(!_0x57016e[_0x24dd('0x3e')]['hasOwnProperty'](_0x24dd('0x44'))){_0x1a067e[_0x24dd('0x28')]=qs['limit'](_0x57016e['query'][_0x24dd('0x28')]);_0x1a067e[_0x24dd('0x25')]=qs[_0x24dd('0x25')](_0x57016e[_0x24dd('0x3e')]['offset']);}_0x1a067e[_0x24dd('0x45')]=qs[_0x24dd('0x46')](_0x57016e['query']['sort']);_0x1a067e[_0x24dd('0x47')]=qs[_0x24dd('0x3f')](_[_0x24dd('0x48')](_0x57016e[_0x24dd('0x3e')],_0x3afffc[_0x24dd('0x3f')]),_0xe665f6);if(_0x57016e[_0x24dd('0x3e')]['filter']){_0x1a067e[_0x24dd('0x47')]=_['merge'](_0x1a067e[_0x24dd('0x47')],{'$or':_[_0x24dd('0x38')](_0xe665f6,function(_0x97505e){if(_0x97505e[_0x24dd('0x3c')]!==_0x24dd('0x49')){var _0x292a6e={};_0x292a6e[_0x97505e[_0x24dd('0x35')]]={'$like':'%'+_0x57016e['query'][_0x24dd('0x4a')]+'%'};return _0x292a6e;}})});}_0x1a067e=_[_0x24dd('0x4b')]({},_0x1a067e,_0x57016e[_0x24dd('0x4c')]);var _0xeb1ca9={'where':_0x1a067e['where']};return db['FaxQueue']['count'](_0xeb1ca9)[_0x24dd('0x2e')](function(_0x4b1f36){_0x4ace5c['count']=_0x4b1f36;if(_0x57016e['query'][_0x24dd('0x4d')]){_0x1a067e['include']=[{'all':!![]}];}return db[_0x24dd('0x39')][_0x24dd('0x4e')](_0x1a067e);})[_0x24dd('0x2e')](function(_0x38971f){_0x4ace5c[_0x24dd('0x4f')]=_0x38971f;return _0x4ace5c;})[_0x24dd('0x2e')](respondWithFilteredResult(_0x25b253,_0x1a067e))[_0x24dd('0x50')](handleError(_0x25b253,null));};exports[_0x24dd('0x51')]=function(_0x3cff1e,_0x251e99){var _0x38764f={'raw':!![],'where':{'id':_0x3cff1e[_0x24dd('0x52')]['id']}},_0x55a24c={};_0x55a24c[_0x24dd('0x3d')]=_['keys'](db['FaxQueue'][_0x24dd('0x3a')]);_0x55a24c[_0x24dd('0x3e')]=_[_0x24dd('0x53')](_0x3cff1e[_0x24dd('0x3e')]);_0x55a24c['filters']=_[_0x24dd('0x40')](_0x55a24c[_0x24dd('0x3d')],_0x55a24c[_0x24dd('0x3e')]);_0x38764f[_0x24dd('0x41')]=_[_0x24dd('0x40')](_0x55a24c[_0x24dd('0x3d')],qs[_0x24dd('0x42')](_0x3cff1e[_0x24dd('0x3e')][_0x24dd('0x42')]));_0x38764f['attributes']=_0x38764f[_0x24dd('0x41')]['length']?_0x38764f['attributes']:_0x55a24c[_0x24dd('0x3d')];if(_0x3cff1e[_0x24dd('0x3e')][_0x24dd('0x4d')]){_0x38764f[_0x24dd('0x54')]=[{'all':!![]}];}_0x38764f=_[_0x24dd('0x4b')]({},_0x38764f,_0x3cff1e[_0x24dd('0x4c')]);return db[_0x24dd('0x39')]['find'](_0x38764f)['then'](handleEntityNotFound(_0x251e99,null))[_0x24dd('0x2e')](respondWithResult(_0x251e99,null))['catch'](handleError(_0x251e99,null));};exports[_0x24dd('0x55')]=function(_0x2b8ab6,_0x54c606){return db[_0x24dd('0x39')]['create'](_0x2b8ab6['body'],{})['then'](function(_0x29afae){var _0x840659=_0x2b8ab6[_0x24dd('0x56')][_0x24dd('0x2f')]({'plain':!![]});if(!_0x840659)throw new Error(_0x24dd('0x57'));if(_0x840659[_0x24dd('0x58')]===_0x24dd('0x56')){var _0x586f7b=_0x29afae[_0x24dd('0x2f')]({'plain':!![]});var _0x374ec2='FaxQueues';return db[_0x24dd('0x59')][_0x24dd('0x5a')]({'where':{'name':_0x374ec2,'userProfileId':_0x840659[_0x24dd('0x5b')]},'raw':!![]})[_0x24dd('0x2e')](function(_0x11e865){if(_0x11e865&&_0x11e865['autoAssociation']===0x0){return db[_0x24dd('0x31')]['create']({'name':_0x586f7b[_0x24dd('0x35')],'resourceId':_0x586f7b['id'],'type':_0x11e865[_0x24dd('0x35')],'sectionId':_0x11e865['id']},{})['then'](function(){return _0x29afae;});}else{return _0x29afae;}})[_0x24dd('0x50')](function(_0x665a8c){logger[_0x24dd('0x33')](_0x24dd('0x5c'),_0x665a8c);throw _0x665a8c;});}return _0x29afae;})[_0x24dd('0x2e')](respondWithResult(_0x54c606,0xc9))['catch'](handleError(_0x54c606,null));};exports[_0x24dd('0x2d')]=function(_0x299535,_0x5e8b8f){if(_0x299535[_0x24dd('0x5d')]['id']){delete _0x299535[_0x24dd('0x5d')]['id'];}return db[_0x24dd('0x39')][_0x24dd('0x5a')]({'where':{'id':_0x299535['params']['id']}})[_0x24dd('0x2e')](handleEntityNotFound(_0x5e8b8f,null))[_0x24dd('0x2e')](saveUpdates(_0x299535['body'],null))[_0x24dd('0x2e')](respondWithResult(_0x5e8b8f,null))[_0x24dd('0x50')](handleError(_0x5e8b8f,null));};exports['destroy']=function(_0x88f81,_0x3c4aa2){return db['FaxQueue'][_0x24dd('0x5a')]({'where':{'id':_0x88f81['params']['id']}})[_0x24dd('0x2e')](handleEntityNotFound(_0x3c4aa2,null))[_0x24dd('0x2e')](removeEntity(_0x3c4aa2,null))['catch'](handleError(_0x3c4aa2,null));};exports[_0x24dd('0x5e')]=function(_0x5d9fb7,_0x3445af){return db[_0x24dd('0x39')][_0x24dd('0x5e')]()[_0x24dd('0x2e')](respondWithResult(_0x3445af,null))[_0x24dd('0x50')](handleError(_0x3445af,null));};exports['getMembers']=function(_0x2b9172,_0x3f9732,_0x4ec0c8){var _0x1088bc={'raw':!![],'where':{}},_0x4fb3db={},_0x27779a;return db['FaxQueue'][_0x24dd('0x5f')]({'where':{'id':_0x2b9172[_0x24dd('0x52')]['id']}})['then'](handleEntityNotFound(_0x3f9732,null))[_0x24dd('0x2e')](function(_0x4d01c1){if(_0x4d01c1){_0x27779a=_0x4d01c1[_0x24dd('0x2f')]({'plain':!![]});_0x4fb3db[_0x24dd('0x3d')]=_[_0x24dd('0x53')](db[_0x24dd('0x60')][_0x24dd('0x3a')]);_0x4fb3db[_0x24dd('0x3e')]=_[_0x24dd('0x53')](_0x2b9172[_0x24dd('0x3e')]);_0x4fb3db[_0x24dd('0x3f')]=_[_0x24dd('0x40')](_0x4fb3db[_0x24dd('0x3d')],_0x4fb3db[_0x24dd('0x3e')]);_0x1088bc[_0x24dd('0x41')]=_[_0x24dd('0x40')](_0x4fb3db[_0x24dd('0x3d')],qs['fields'](_0x2b9172[_0x24dd('0x3e')]['fields']));_0x1088bc[_0x24dd('0x41')]=_0x1088bc[_0x24dd('0x41')]['length']?_0x1088bc[_0x24dd('0x41')]:_0x4fb3db['model'];if(!_0x2b9172[_0x24dd('0x3e')]['hasOwnProperty'](_0x24dd('0x44'))){_0x1088bc[_0x24dd('0x28')]=qs[_0x24dd('0x28')](_0x2b9172['query']['limit']);_0x1088bc[_0x24dd('0x25')]=qs[_0x24dd('0x25')](_0x2b9172['query'][_0x24dd('0x25')]);}_0x1088bc[_0x24dd('0x45')]=qs[_0x24dd('0x46')](_0x2b9172[_0x24dd('0x3e')][_0x24dd('0x46')]);_0x1088bc[_0x24dd('0x47')]=qs[_0x24dd('0x3f')](_['pick'](_0x2b9172[_0x24dd('0x3e')],_0x4fb3db[_0x24dd('0x3f')]));_0x1088bc[_0x24dd('0x47')][_0x24dd('0x61')]=_0x4d01c1['id'];if(_0x2b9172[_0x24dd('0x3e')][_0x24dd('0x4a')]){_0x1088bc['where']=_[_0x24dd('0x4b')](_0x1088bc[_0x24dd('0x47')],{'$or':_[_0x24dd('0x38')](_0x1088bc['attributes'],function(_0x15129c){var _0x2b2ee8={};_0x2b2ee8[_0x15129c]={'$like':'%'+_0x2b9172[_0x24dd('0x3e')][_0x24dd('0x4a')]+'%'};return _0x2b2ee8;})});}_0x1088bc=_['merge']({},_0x1088bc,_0x2b9172['options']);return db['UserFaxQueue'][_0x24dd('0x4e')](_0x1088bc);}})['then'](function(_0x269f03){if(_0x269f03){return db[_0x24dd('0x62')]['findAndCountAll']({'where':{'id':_['map'](_0x269f03,'UserId'),'role':_0x24dd('0x63')},'attributes':['id','name','faxPause',_0x24dd('0x64'),_0x24dd('0x65')]});}})[_0x24dd('0x2e')](function(_0x50bcd0){if(_0x50bcd0){return{'count':_0x50bcd0[_0x24dd('0x27')],'rows':_[_0x24dd('0x38')](_0x50bcd0[_0x24dd('0x4f')],function(_0x27abf0){return{'membername':_0x27abf0[_0x24dd('0x35')],'UserId':_0x27abf0['id'],'queue_name':_0x27779a['name'],'FaxQueueId':_0x27779a['id'],'interface':util[_0x24dd('0x66')](_0x24dd('0x67'),_0x24dd('0x68'),_0x27abf0[_0x24dd('0x35')]),'penalty':0x0,'paused':_0x27abf0['faxPause'],'createdAt':_0x27abf0[_0x24dd('0x65')],'updatedAt':_0x27abf0['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x24dd('0x2e')](respondWithFilteredResult(_0x3f9732,_0x1088bc))[_0x24dd('0x50')](handleError(_0x3f9732,null));};exports[_0x24dd('0x69')]=function(_0x4e8409,_0x9beb9c,_0x1c6b9d){var _0x39d642={};var _0x43f38f={};var _0x5b4517;var _0x1fee1e;return db[_0x24dd('0x39')][_0x24dd('0x5f')]({'where':{'id':_0x4e8409['params']['id']}})['then'](handleEntityNotFound(_0x9beb9c,null))['then'](function(_0x4deab8){if(_0x4deab8){_0x5b4517=_0x4deab8;_0x43f38f[_0x24dd('0x3d')]=_[_0x24dd('0x53')](db[_0x24dd('0x6a')]['rawAttributes']);_0x43f38f[_0x24dd('0x3e')]=_[_0x24dd('0x53')](_0x4e8409['query']);_0x43f38f[_0x24dd('0x3f')]=_['intersection'](_0x43f38f[_0x24dd('0x3d')],_0x43f38f[_0x24dd('0x3e')]);_0x39d642['attributes']=_[_0x24dd('0x40')](_0x43f38f[_0x24dd('0x3d')],qs[_0x24dd('0x42')](_0x4e8409[_0x24dd('0x3e')][_0x24dd('0x42')]));_0x39d642['attributes']=_0x39d642[_0x24dd('0x41')][_0x24dd('0x43')]?_0x39d642[_0x24dd('0x41')]:_0x43f38f[_0x24dd('0x3d')];_0x39d642['order']=qs[_0x24dd('0x46')](_0x4e8409[_0x24dd('0x3e')][_0x24dd('0x46')]);_0x39d642[_0x24dd('0x47')]=qs['filters'](_[_0x24dd('0x48')](_0x4e8409[_0x24dd('0x3e')],_0x43f38f[_0x24dd('0x3f')]));if(_0x4e8409['query']['filter']){_0x39d642['where']=_[_0x24dd('0x4b')](_0x39d642[_0x24dd('0x47')],{'$or':_[_0x24dd('0x38')](_0x39d642[_0x24dd('0x41')],function(_0x2db2c6){var _0x1d9dae={};_0x1d9dae[_0x2db2c6]={'$like':'%'+_0x4e8409['query'][_0x24dd('0x4a')]+'%'};return _0x1d9dae;})});}_0x39d642=_['merge']({},_0x39d642,_0x4e8409[_0x24dd('0x4c')]);return _0x5b4517[_0x24dd('0x69')](_0x39d642);}})[_0x24dd('0x2e')](function(_0x19136d){if(_0x19136d){_0x1fee1e=_0x19136d[_0x24dd('0x43')];if(!_0x4e8409[_0x24dd('0x3e')][_0x24dd('0x6b')]('nolimit')){_0x39d642[_0x24dd('0x28')]=qs[_0x24dd('0x28')](_0x4e8409['query'][_0x24dd('0x28')]);_0x39d642[_0x24dd('0x25')]=qs[_0x24dd('0x25')](_0x4e8409[_0x24dd('0x3e')]['offset']);}return _0x5b4517[_0x24dd('0x69')](_0x39d642);}})[_0x24dd('0x2e')](function(_0x184ca8){if(_0x184ca8){return _0x184ca8?{'count':_0x1fee1e,'rows':_0x184ca8}:null;}})[_0x24dd('0x2e')](respondWithResult(_0x9beb9c,null))[_0x24dd('0x50')](handleError(_0x9beb9c,null));};exports['addTeams']=function(_0x1feaf3,_0x2d788c,_0x25e5e0){var _0x299bba=_0x1feaf3['body']['ids'];return db['Team']['findAll']({'where':{'id':_0x299bba},'attributes':['id'],'include':[{'model':db[_0x24dd('0x62')],'as':_0x24dd('0x6c'),'attributes':['id','name',_0x24dd('0x6d'),'voicePause',_0x24dd('0x6e')],'raw':!![]}]})[_0x24dd('0x2e')](function(_0x127d8d){if(_0x127d8d){var _0x29c2b7=_['flatMap'](_0x127d8d,function(_0x579d87){var _0x22752b=_0x579d87['get']({'plain':!![]});return _0x22752b[_0x24dd('0x6c')];});return db[_0x24dd('0x39')][_0x24dd('0x5a')]({'where':{'id':_0x1feaf3[_0x24dd('0x52')]['id']}})[_0x24dd('0x2e')](function(_0x4ffd13){return db[_0x24dd('0x6f')][_0x24dd('0x70')](function(_0x3e66da){return _0x4ffd13[_0x24dd('0x71')](_0x299bba,{'transaction':_0x3e66da})[_0x24dd('0x2e')](function(){return BPromise[_0x24dd('0x72')](_0x29c2b7,function(_0x45669b){return db['UserFaxQueue'][_0x24dd('0x73')]({'where':{'UserId':_0x45669b['id'],'FaxQueueId':_0x1feaf3[_0x24dd('0x52')]['id']},'transaction':_0x3e66da});});})[_0x24dd('0x2e')](function(){_0x29c2b7[_0x24dd('0x74')](function(_0x32246d){socket[_0x24dd('0x75')](_0x24dd('0x76'),{'UserId':_0x32246d['id'],'FaxQueueId':_0x4ffd13['id']});});});});});}})[_0x24dd('0x2e')](respondWithStatusCode(_0x2d788c,null))['catch'](handleError(_0x2d788c,null));};exports[_0x24dd('0x77')]=function(_0x165dc3,_0x56bc70,_0x2f27c2){return db[_0x24dd('0x6a')][_0x24dd('0x4e')]({'where':{'id':_0x165dc3[_0x24dd('0x3e')][_0x24dd('0x78')]},'attributes':['id'],'include':[{'model':db[_0x24dd('0x62')],'as':_0x24dd('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x56bc70,null))[_0x24dd('0x2e')](function(_0xafdac3){var _0x22b090=_[_0x24dd('0x38')](_0xafdac3,'id');var _0x293f07=[];var _0x1b6713=[];var _0x3359fd=squel[_0x24dd('0x79')]();_0x3359fd[_0x24dd('0x7a')]('tq.TeamId')[_0x24dd('0x7b')](_0x24dd('0x7c'),'tq')[_0x24dd('0x7d')](_0x24dd('0x7e'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x24dd('0x47')](_0x24dd('0x7f'),_0x165dc3[_0x24dd('0x52')]['id']);for(var _0x11bb00=0x0;_0x11bb00<_0xafdac3[_0x24dd('0x43')];_0x11bb00+=0x1){let _0x6636c7=_0xafdac3[_0x11bb00];for(var _0x1fd9f8=0x0;_0x1fd9f8<_0x6636c7[_0x24dd('0x6c')][_0x24dd('0x43')];_0x1fd9f8+=0x1){let _0x13df5f=_0x6636c7[_0x24dd('0x6c')][_0x1fd9f8];var _0x8fc4fd=_0x3359fd['clone']();_0x8fc4fd[_0x24dd('0x47')](_0x24dd('0x80'),_0x13df5f['id']);_0x1b6713[_0x24dd('0x81')](db[_0x24dd('0x6f')][_0x24dd('0x3e')](_0x8fc4fd[_0x24dd('0x82')](),{'type':db['sequelize']['QueryTypes'][_0x24dd('0x83')]})[_0x24dd('0x2e')](function(_0x2299a7){if(_0x2299a7[_0x24dd('0x43')]===0x1){return _0x13df5f['id'];}else{var _0x5aa0c9=_['every'](_[_0x24dd('0x38')](_0x2299a7,'TeamId'),function(_0x558d0e){return _['includes'](_0x22b090,_0x558d0e);});if(_0x5aa0c9){return _0x13df5f['id'];}}}));}}return BPromise[_0x24dd('0x84')](_0x1b6713)[_0x24dd('0x2e')](function(_0x389493){_0x293f07=_(_0x293f07)[_0x24dd('0x85')](_0x389493)['compact']()[_0x24dd('0x86')]();return db[_0x24dd('0x39')][_0x24dd('0x5a')]({'where':{'id':_0x165dc3[_0x24dd('0x52')]['id']}})['then'](function(_0x42212b){return db[_0x24dd('0x6f')][_0x24dd('0x70')](function(_0x1ff5d6){return _0x42212b[_0x24dd('0x77')](_0x165dc3['query'][_0x24dd('0x78')],{'transaction':_0x1ff5d6})[_0x24dd('0x2e')](function(){if(!_[_0x24dd('0x87')](_0x293f07)){return _0x42212b[_0x24dd('0x88')](_0x293f07,{'transaction':_0x1ff5d6});}})[_0x24dd('0x2e')](function(){_0x293f07[_0x24dd('0x74')](function(_0x2f135c){socket['emit'](_0x24dd('0x89'),{'UserId':_0x2f135c,'FaxQueueId':_0x42212b['id']});});});});});});})[_0x24dd('0x2e')](respondWithStatusCode(_0x56bc70,null))[_0x24dd('0x50')](handleError(_0x56bc70,null));};exports[_0x24dd('0x8a')]=function(_0x90626b,_0x4a862d,_0xda22b1){return db['FaxQueue'][_0x24dd('0x5a')]({'where':{'id':_0x90626b[_0x24dd('0x52')]['id']}})[_0x24dd('0x2e')](handleEntityNotFound(_0x4a862d,null))[_0x24dd('0x2e')](function(_0x4fbd1b){if(_0x4fbd1b){return _0x4fbd1b[_0x24dd('0x8a')](_0x90626b['body']['ids'],_['omit'](_0x90626b[_0x24dd('0x5d')],[_0x24dd('0x78'),'id'])||{})['spread'](function(_0x4cf337){for(var _0x4d2062=0x0;_0x4d2062<_0x90626b[_0x24dd('0x5d')]['ids'][_0x24dd('0x43')];_0x4d2062+=0x1){socket[_0x24dd('0x75')](_0x24dd('0x76'),{'UserId':Number(_0x90626b['body']['ids'][_0x4d2062]),'FaxQueueId':Number(_0x90626b[_0x24dd('0x52')]['id'])});}return _0x4cf337;});}})[_0x24dd('0x2e')](respondWithResult(_0x4a862d,null))['catch'](handleError(_0x4a862d,null));};exports[_0x24dd('0x88')]=function(_0x5dd63a,_0x5a9784,_0x457ba2){return db[_0x24dd('0x39')]['find']({'where':{'id':_0x5dd63a[_0x24dd('0x52')]['id']}})['then'](handleEntityNotFound(_0x5a9784,null))[_0x24dd('0x2e')](function(_0x4206ca){if(_0x4206ca){return _0x4206ca[_0x24dd('0x88')](_0x5dd63a[_0x24dd('0x3e')][_0x24dd('0x78')])[_0x24dd('0x2e')](function(){if(_[_0x24dd('0x8b')](_0x5dd63a[_0x24dd('0x3e')][_0x24dd('0x78')])){for(var _0x240443=0x0;_0x240443<_0x5dd63a[_0x24dd('0x3e')][_0x24dd('0x78')][_0x24dd('0x43')];_0x240443+=0x1){socket[_0x24dd('0x75')](_0x24dd('0x89'),{'UserId':Number(_0x5dd63a[_0x24dd('0x3e')][_0x24dd('0x78')][_0x240443]),'FaxQueueId':Number(_0x5dd63a['params']['id'])});}}else{socket['emit'](_0x24dd('0x89'),{'UserId':Number(_0x5dd63a[_0x24dd('0x3e')]['ids']),'FaxQueueId':Number(_0x5dd63a[_0x24dd('0x52')]['id'])});}});}})[_0x24dd('0x2e')](respondWithStatusCode(_0x5a9784,null))[_0x24dd('0x50')](handleError(_0x5a9784,null));};exports[_0x24dd('0x8c')]=function(_0x470bd0,_0x3cc575,_0x27819d){var _0x15a760={};var _0x2c3304={};var _0x4e32fa;var _0x9eaaf4;return db[_0x24dd('0x39')][_0x24dd('0x5f')]({'where':{'id':_0x470bd0[_0x24dd('0x52')]['id']}})['then'](handleEntityNotFound(_0x3cc575,null))[_0x24dd('0x2e')](function(_0x23d973){if(_0x23d973){_0x4e32fa=_0x23d973;_0x2c3304[_0x24dd('0x3d')]=_[_0x24dd('0x53')](db[_0x24dd('0x62')][_0x24dd('0x3a')]);_0x2c3304['query']=_[_0x24dd('0x53')](_0x470bd0[_0x24dd('0x3e')]);_0x2c3304[_0x24dd('0x3f')]=_['intersection'](_0x2c3304[_0x24dd('0x3d')],_0x2c3304[_0x24dd('0x3e')]);_0x15a760[_0x24dd('0x41')]=_[_0x24dd('0x40')](_0x2c3304[_0x24dd('0x3d')],qs[_0x24dd('0x42')](_0x470bd0['query'][_0x24dd('0x42')]));_0x15a760['attributes']=_0x15a760[_0x24dd('0x41')][_0x24dd('0x43')]?_0x15a760[_0x24dd('0x41')]:_0x2c3304[_0x24dd('0x3d')];_0x15a760[_0x24dd('0x45')]=qs['sort'](_0x470bd0[_0x24dd('0x3e')][_0x24dd('0x46')]);_0x15a760[_0x24dd('0x47')]=qs[_0x24dd('0x3f')](_[_0x24dd('0x48')](_0x470bd0[_0x24dd('0x3e')],_0x2c3304['filters']));if(_0x470bd0[_0x24dd('0x3e')][_0x24dd('0x4a')]){_0x15a760['where']=_[_0x24dd('0x4b')](_0x15a760['where'],{'$or':_[_0x24dd('0x38')](_0x15a760[_0x24dd('0x41')],function(_0x367575){var _0x1ecd06={};_0x1ecd06[_0x367575]={'$like':'%'+_0x470bd0[_0x24dd('0x3e')][_0x24dd('0x4a')]+'%'};return _0x1ecd06;})});}_0x15a760=_[_0x24dd('0x4b')]({},_0x15a760,_0x470bd0[_0x24dd('0x4c')]);return _0x4e32fa['getAgents'](_0x15a760);}})[_0x24dd('0x2e')](function(_0x286b7b){if(_0x286b7b){_0x9eaaf4=_0x286b7b['length'];if(!_0x470bd0['query'][_0x24dd('0x6b')](_0x24dd('0x44'))){_0x15a760[_0x24dd('0x28')]=qs[_0x24dd('0x28')](_0x470bd0[_0x24dd('0x3e')]['limit']);_0x15a760[_0x24dd('0x25')]=qs[_0x24dd('0x25')](_0x470bd0[_0x24dd('0x3e')][_0x24dd('0x25')]);}return _0x4e32fa[_0x24dd('0x8c')](_0x15a760);}})['then'](function(_0x358b35){if(_0x358b35){return _0x358b35?{'count':_0x9eaaf4,'rows':_0x358b35}:null;}})['then'](respondWithResult(_0x3cc575,null))[_0x24dd('0x50')](handleError(_0x3cc575,null));}; \ No newline at end of file +var _0xfb1c=['findAndCountAll','UserId','agent','updatedAt','rows','SIP','createdAt','getTeams','Team','addTeams','User','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','./faxQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','FaxQueues','UserProfileResource','sendStatus','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','findAll','catch','show','params','filters','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','FaxQueueId'];(function(_0x2803ab,_0x1c33f2){var _0x3d6e8e=function(_0x8a86f1){while(--_0x8a86f1){_0x2803ab['push'](_0x2803ab['shift']());}};_0x3d6e8e(++_0x1c33f2);}(_0xfb1c,0x150));var _0xcfb1=function(_0x485907,_0x47224d){_0x485907=_0x485907-0x0;var _0x3ed143=_0xfb1c[_0x485907];return _0x3ed143;};'use strict';var emlformat=require(_0xcfb1('0x0'));var rimraf=require(_0xcfb1('0x1'));var zipdir=require(_0xcfb1('0x2'));var jsonpatch=require(_0xcfb1('0x3'));var rp=require('request-promise');var moment=require(_0xcfb1('0x4'));var BPromise=require(_0xcfb1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcfb1('0x6'));var sox=require(_0xcfb1('0x7'));var csv=require(_0xcfb1('0x8'));var ejs=require(_0xcfb1('0x9'));var fs=require('fs');var fs_extra=require(_0xcfb1('0xa'));var _=require(_0xcfb1('0xb'));var squel=require(_0xcfb1('0xc'));var crypto=require(_0xcfb1('0xd'));var jsforce=require(_0xcfb1('0xe'));var deskjs=require(_0xcfb1('0xf'));var toCsv=require(_0xcfb1('0x8'));var querystring=require(_0xcfb1('0x10'));var Papa=require(_0xcfb1('0x11'));var Redis=require(_0xcfb1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xcfb1('0x13'));var as=require(_0xcfb1('0x14'));var hardwareService=require(_0xcfb1('0x15'));var logger=require(_0xcfb1('0x16'))(_0xcfb1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcfb1('0x18'));var db=require('../../mysqldb')['db'];config[_0xcfb1('0x19')]=_['defaults'](config[_0xcfb1('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcfb1('0x19')]));require(_0xcfb1('0x1a'))[_0xcfb1('0x1b')](socket);function respondWithStatusCode(_0x518c13,_0x5efeb8){_0x5efeb8=_0x5efeb8||0xcc;return function(_0x406784){if(_0x406784){return _0x518c13['sendStatus'](_0x5efeb8);}return _0x518c13[_0xcfb1('0x1c')](_0x5efeb8)[_0xcfb1('0x1d')]();};}function respondWithResult(_0x351d53,_0x45473d){_0x45473d=_0x45473d||0xc8;return function(_0x165639){if(_0x165639){return _0x351d53[_0xcfb1('0x1c')](_0x45473d)[_0xcfb1('0x1e')](_0x165639);}};}function respondWithFilteredResult(_0x33d82b,_0x2929ba){return function(_0x3da71d){if(_0x3da71d){var _0x41cc41=typeof _0x2929ba[_0xcfb1('0x1f')]===_0xcfb1('0x20')&&typeof _0x2929ba[_0xcfb1('0x21')]===_0xcfb1('0x20');var _0x27c7c8=_0x3da71d[_0xcfb1('0x22')];var _0x1c9434=_0x41cc41?0x0:_0x2929ba[_0xcfb1('0x1f')];var _0x10e401=_0x41cc41?_0x3da71d[_0xcfb1('0x22')]:_0x2929ba[_0xcfb1('0x1f')]+_0x2929ba[_0xcfb1('0x21')];var _0x3ded68;if(_0x10e401>=_0x27c7c8){_0x10e401=_0x27c7c8;_0x3ded68=0xc8;}else{_0x3ded68=0xce;}_0x33d82b['status'](_0x3ded68);return _0x33d82b[_0xcfb1('0x23')](_0xcfb1('0x24'),_0x1c9434+'-'+_0x10e401+'/'+_0x27c7c8)[_0xcfb1('0x1e')](_0x3da71d);}return null;};}function patchUpdates(_0x460f5a){return function(_0x480f11){try{jsonpatch[_0xcfb1('0x25')](_0x480f11,_0x460f5a,!![]);}catch(_0x4cee4d){return BPromise['reject'](_0x4cee4d);}return _0x480f11[_0xcfb1('0x26')]();};}function saveUpdates(_0x212988,_0x12caf0){return function(_0x21eca4){if(_0x21eca4){return _0x21eca4[_0xcfb1('0x27')](_0x212988)[_0xcfb1('0x28')](function(_0xa3221d){return _0xa3221d;});}return null;};}function removeEntity(_0x29b2b2,_0x171699){return function(_0x567d83){if(_0x567d83){return _0x567d83[_0xcfb1('0x29')]()[_0xcfb1('0x28')](function(){var _0x4f837d=_0x567d83[_0xcfb1('0x2a')]({'plain':!![]});var _0x4924ee=_0xcfb1('0x2b');return db[_0xcfb1('0x2c')][_0xcfb1('0x29')]({'where':{'type':_0x4924ee,'resourceId':_0x4f837d['id']}})[_0xcfb1('0x28')](function(){return _0x567d83;});})['then'](function(){_0x29b2b2[_0xcfb1('0x1c')](0xcc)[_0xcfb1('0x1d')]();});}};}function handleEntityNotFound(_0x3ee5ee,_0x3ae9a4){return function(_0x21030a){if(!_0x21030a){_0x3ee5ee[_0xcfb1('0x2d')](0x194);}return _0x21030a;};}function handleError(_0x257a35,_0x2b3b43){_0x2b3b43=_0x2b3b43||0x1f4;return function(_0x255c13){logger['error'](_0x255c13[_0xcfb1('0x2e')]);if(_0x255c13[_0xcfb1('0x2f')]){delete _0x255c13[_0xcfb1('0x2f')];}_0x257a35[_0xcfb1('0x1c')](_0x2b3b43)[_0xcfb1('0x30')](_0x255c13);};}exports[_0xcfb1('0x31')]=function(_0x5f5d70,_0x441366){var _0x294703={},_0xa3ece2={},_0x328e86={'count':0x0,'rows':[]};var _0x3540ce=_['map'](db[_0xcfb1('0x32')][_0xcfb1('0x33')],function(_0x2e7a9e){return{'name':_0x2e7a9e[_0xcfb1('0x34')],'type':_0x2e7a9e[_0xcfb1('0x35')][_0xcfb1('0x36')]};});_0xa3ece2['model']=_['map'](_0x3540ce,'name');_0xa3ece2[_0xcfb1('0x37')]=_[_0xcfb1('0x38')](_0x5f5d70[_0xcfb1('0x37')]);_0xa3ece2['filters']=_['intersection'](_0xa3ece2[_0xcfb1('0x39')],_0xa3ece2[_0xcfb1('0x37')]);_0x294703['attributes']=_[_0xcfb1('0x3a')](_0xa3ece2['model'],qs[_0xcfb1('0x3b')](_0x5f5d70[_0xcfb1('0x37')]['fields']));_0x294703[_0xcfb1('0x3c')]=_0x294703[_0xcfb1('0x3c')][_0xcfb1('0x3d')]?_0x294703['attributes']:_0xa3ece2[_0xcfb1('0x39')];if(!_0x5f5d70[_0xcfb1('0x37')][_0xcfb1('0x3e')](_0xcfb1('0x3f'))){_0x294703[_0xcfb1('0x21')]=qs[_0xcfb1('0x21')](_0x5f5d70[_0xcfb1('0x37')]['limit']);_0x294703['offset']=qs['offset'](_0x5f5d70['query'][_0xcfb1('0x1f')]);}_0x294703[_0xcfb1('0x40')]=qs['sort'](_0x5f5d70[_0xcfb1('0x37')][_0xcfb1('0x41')]);_0x294703[_0xcfb1('0x42')]=qs['filters'](_[_0xcfb1('0x43')](_0x5f5d70[_0xcfb1('0x37')],_0xa3ece2['filters']),_0x3540ce);if(_0x5f5d70[_0xcfb1('0x37')][_0xcfb1('0x44')]){_0x294703['where']=_[_0xcfb1('0x45')](_0x294703['where'],{'$or':_[_0xcfb1('0x46')](_0x3540ce,function(_0x2caa7b){if(_0x2caa7b['type']!=='VIRTUAL'){var _0x20a756={};_0x20a756[_0x2caa7b[_0xcfb1('0x2f')]]={'$like':'%'+_0x5f5d70[_0xcfb1('0x37')][_0xcfb1('0x44')]+'%'};return _0x20a756;}})});}_0x294703=_['merge']({},_0x294703,_0x5f5d70['options']);var _0xef66c7={'where':_0x294703['where']};return db['FaxQueue'][_0xcfb1('0x22')](_0xef66c7)[_0xcfb1('0x28')](function(_0x46c833){_0x328e86[_0xcfb1('0x22')]=_0x46c833;if(_0x5f5d70[_0xcfb1('0x37')][_0xcfb1('0x47')]){_0x294703['include']=[{'all':!![]}];}return db[_0xcfb1('0x32')][_0xcfb1('0x48')](_0x294703);})[_0xcfb1('0x28')](function(_0x2c2de4){_0x328e86['rows']=_0x2c2de4;return _0x328e86;})[_0xcfb1('0x28')](respondWithFilteredResult(_0x441366,_0x294703))[_0xcfb1('0x49')](handleError(_0x441366,null));};exports[_0xcfb1('0x4a')]=function(_0x16c842,_0x1d9091){var _0x37e874={'raw':!![],'where':{'id':_0x16c842[_0xcfb1('0x4b')]['id']}},_0x3f9785={};_0x3f9785[_0xcfb1('0x39')]=_[_0xcfb1('0x38')](db[_0xcfb1('0x32')][_0xcfb1('0x33')]);_0x3f9785[_0xcfb1('0x37')]=_['keys'](_0x16c842[_0xcfb1('0x37')]);_0x3f9785[_0xcfb1('0x4c')]=_[_0xcfb1('0x3a')](_0x3f9785[_0xcfb1('0x39')],_0x3f9785[_0xcfb1('0x37')]);_0x37e874['attributes']=_[_0xcfb1('0x3a')](_0x3f9785[_0xcfb1('0x39')],qs[_0xcfb1('0x3b')](_0x16c842[_0xcfb1('0x37')][_0xcfb1('0x3b')]));_0x37e874[_0xcfb1('0x3c')]=_0x37e874['attributes'][_0xcfb1('0x3d')]?_0x37e874[_0xcfb1('0x3c')]:_0x3f9785[_0xcfb1('0x39')];if(_0x16c842[_0xcfb1('0x37')][_0xcfb1('0x47')]){_0x37e874['include']=[{'all':!![]}];}_0x37e874=_[_0xcfb1('0x45')]({},_0x37e874,_0x16c842[_0xcfb1('0x4d')]);return db['FaxQueue'][_0xcfb1('0x4e')](_0x37e874)[_0xcfb1('0x28')](handleEntityNotFound(_0x1d9091,null))['then'](respondWithResult(_0x1d9091,null))[_0xcfb1('0x49')](handleError(_0x1d9091,null));};exports['create']=function(_0x3e93e3,_0x3fadaf){return db['FaxQueue']['create'](_0x3e93e3[_0xcfb1('0x4f')],{})['then'](function(_0x435e77){var _0x46b7c1=_0x3e93e3[_0xcfb1('0x50')][_0xcfb1('0x2a')]({'plain':!![]});if(!_0x46b7c1)throw new Error(_0xcfb1('0x51'));if(_0x46b7c1[_0xcfb1('0x52')]===_0xcfb1('0x50')){var _0x5583a0=_0x435e77['get']({'plain':!![]});var _0x6b1970='FaxQueues';return db[_0xcfb1('0x53')][_0xcfb1('0x4e')]({'where':{'name':_0x6b1970,'userProfileId':_0x46b7c1['userProfileId']},'raw':!![]})['then'](function(_0x33cfdd){if(_0x33cfdd&&_0x33cfdd[_0xcfb1('0x54')]===0x0){return db[_0xcfb1('0x2c')][_0xcfb1('0x55')]({'name':_0x5583a0[_0xcfb1('0x2f')],'resourceId':_0x5583a0['id'],'type':_0x33cfdd['name'],'sectionId':_0x33cfdd['id']},{})[_0xcfb1('0x28')](function(){return _0x435e77;});}else{return _0x435e77;}})[_0xcfb1('0x49')](function(_0xe973a9){logger[_0xcfb1('0x56')](_0xcfb1('0x57'),_0xe973a9);throw _0xe973a9;});}return _0x435e77;})[_0xcfb1('0x28')](respondWithResult(_0x3fadaf,0xc9))[_0xcfb1('0x49')](handleError(_0x3fadaf,null));};exports[_0xcfb1('0x27')]=function(_0x1dd34d,_0x224622){if(_0x1dd34d['body']['id']){delete _0x1dd34d['body']['id'];}return db[_0xcfb1('0x32')][_0xcfb1('0x4e')]({'where':{'id':_0x1dd34d['params']['id']}})[_0xcfb1('0x28')](handleEntityNotFound(_0x224622,null))['then'](saveUpdates(_0x1dd34d['body'],null))[_0xcfb1('0x28')](respondWithResult(_0x224622,null))[_0xcfb1('0x49')](handleError(_0x224622,null));};exports[_0xcfb1('0x29')]=function(_0x1efa43,_0x254f4b){return db[_0xcfb1('0x32')][_0xcfb1('0x4e')]({'where':{'id':_0x1efa43[_0xcfb1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x254f4b,null))['then'](removeEntity(_0x254f4b,null))[_0xcfb1('0x49')](handleError(_0x254f4b,null));};exports['describe']=function(_0x6da768,_0x21a87f){return db[_0xcfb1('0x32')][_0xcfb1('0x58')]()[_0xcfb1('0x28')](respondWithResult(_0x21a87f,null))[_0xcfb1('0x49')](handleError(_0x21a87f,null));};exports[_0xcfb1('0x59')]=function(_0x53ddd9,_0x3d3231,_0x5d6815){var _0x1d442a={'raw':!![],'where':{}},_0xdfdf69={},_0x5d861b;return db[_0xcfb1('0x32')][_0xcfb1('0x5a')]({'where':{'id':_0x53ddd9['params']['id']}})['then'](handleEntityNotFound(_0x3d3231,null))[_0xcfb1('0x28')](function(_0x2d1142){if(_0x2d1142){_0x5d861b=_0x2d1142[_0xcfb1('0x2a')]({'plain':!![]});_0xdfdf69[_0xcfb1('0x39')]=_[_0xcfb1('0x38')](db[_0xcfb1('0x5b')][_0xcfb1('0x33')]);_0xdfdf69['query']=_[_0xcfb1('0x38')](_0x53ddd9[_0xcfb1('0x37')]);_0xdfdf69[_0xcfb1('0x4c')]=_[_0xcfb1('0x3a')](_0xdfdf69[_0xcfb1('0x39')],_0xdfdf69[_0xcfb1('0x37')]);_0x1d442a['attributes']=_['intersection'](_0xdfdf69['model'],qs['fields'](_0x53ddd9['query'][_0xcfb1('0x3b')]));_0x1d442a[_0xcfb1('0x3c')]=_0x1d442a[_0xcfb1('0x3c')][_0xcfb1('0x3d')]?_0x1d442a['attributes']:_0xdfdf69[_0xcfb1('0x39')];if(!_0x53ddd9[_0xcfb1('0x37')][_0xcfb1('0x3e')](_0xcfb1('0x3f'))){_0x1d442a[_0xcfb1('0x21')]=qs['limit'](_0x53ddd9[_0xcfb1('0x37')][_0xcfb1('0x21')]);_0x1d442a[_0xcfb1('0x1f')]=qs[_0xcfb1('0x1f')](_0x53ddd9[_0xcfb1('0x37')][_0xcfb1('0x1f')]);}_0x1d442a[_0xcfb1('0x40')]=qs[_0xcfb1('0x41')](_0x53ddd9[_0xcfb1('0x37')][_0xcfb1('0x41')]);_0x1d442a[_0xcfb1('0x42')]=qs[_0xcfb1('0x4c')](_[_0xcfb1('0x43')](_0x53ddd9[_0xcfb1('0x37')],_0xdfdf69[_0xcfb1('0x4c')]));_0x1d442a[_0xcfb1('0x42')][_0xcfb1('0x5c')]=_0x2d1142['id'];if(_0x53ddd9[_0xcfb1('0x37')][_0xcfb1('0x44')]){_0x1d442a[_0xcfb1('0x42')]=_[_0xcfb1('0x45')](_0x1d442a[_0xcfb1('0x42')],{'$or':_[_0xcfb1('0x46')](_0x1d442a[_0xcfb1('0x3c')],function(_0x453fb6){var _0x575569={};_0x575569[_0x453fb6]={'$like':'%'+_0x53ddd9[_0xcfb1('0x37')]['filter']+'%'};return _0x575569;})});}_0x1d442a=_['merge']({},_0x1d442a,_0x53ddd9[_0xcfb1('0x4d')]);return db['UserFaxQueue'][_0xcfb1('0x48')](_0x1d442a);}})['then'](function(_0x5cdf67){if(_0x5cdf67){return db['User'][_0xcfb1('0x5d')]({'where':{'id':_['map'](_0x5cdf67,_0xcfb1('0x5e')),'role':_0xcfb1('0x5f')},'attributes':['id',_0xcfb1('0x2f'),'faxPause',_0xcfb1('0x60'),'createdAt']});}})[_0xcfb1('0x28')](function(_0x450842){if(_0x450842){return{'count':_0x450842[_0xcfb1('0x22')],'rows':_['map'](_0x450842[_0xcfb1('0x61')],function(_0x368a5f){return{'membername':_0x368a5f['name'],'UserId':_0x368a5f['id'],'queue_name':_0x5d861b[_0xcfb1('0x2f')],'FaxQueueId':_0x5d861b['id'],'interface':util['format']('%s/%s',_0xcfb1('0x62'),_0x368a5f[_0xcfb1('0x2f')]),'penalty':0x0,'paused':_0x368a5f['faxPause'],'createdAt':_0x368a5f[_0xcfb1('0x63')],'updatedAt':_0x368a5f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xcfb1('0x28')](respondWithFilteredResult(_0x3d3231,_0x1d442a))[_0xcfb1('0x49')](handleError(_0x3d3231,null));};exports[_0xcfb1('0x64')]=function(_0x56470c,_0x1341a4,_0xc18e3c){var _0x4a654d={};var _0x14a388={};var _0x24e5cb;var _0x57da2d;return db[_0xcfb1('0x32')][_0xcfb1('0x5a')]({'where':{'id':_0x56470c[_0xcfb1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1341a4,null))[_0xcfb1('0x28')](function(_0x51fe24){if(_0x51fe24){_0x24e5cb=_0x51fe24;_0x14a388[_0xcfb1('0x39')]=_[_0xcfb1('0x38')](db[_0xcfb1('0x65')]['rawAttributes']);_0x14a388[_0xcfb1('0x37')]=_['keys'](_0x56470c[_0xcfb1('0x37')]);_0x14a388['filters']=_[_0xcfb1('0x3a')](_0x14a388[_0xcfb1('0x39')],_0x14a388[_0xcfb1('0x37')]);_0x4a654d[_0xcfb1('0x3c')]=_[_0xcfb1('0x3a')](_0x14a388[_0xcfb1('0x39')],qs[_0xcfb1('0x3b')](_0x56470c[_0xcfb1('0x37')]['fields']));_0x4a654d[_0xcfb1('0x3c')]=_0x4a654d[_0xcfb1('0x3c')]['length']?_0x4a654d[_0xcfb1('0x3c')]:_0x14a388['model'];_0x4a654d['order']=qs[_0xcfb1('0x41')](_0x56470c[_0xcfb1('0x37')][_0xcfb1('0x41')]);_0x4a654d[_0xcfb1('0x42')]=qs[_0xcfb1('0x4c')](_['pick'](_0x56470c['query'],_0x14a388[_0xcfb1('0x4c')]));if(_0x56470c[_0xcfb1('0x37')]['filter']){_0x4a654d[_0xcfb1('0x42')]=_['merge'](_0x4a654d['where'],{'$or':_['map'](_0x4a654d['attributes'],function(_0x450538){var _0x2a3675={};_0x2a3675[_0x450538]={'$like':'%'+_0x56470c['query']['filter']+'%'};return _0x2a3675;})});}_0x4a654d=_[_0xcfb1('0x45')]({},_0x4a654d,_0x56470c[_0xcfb1('0x4d')]);return _0x24e5cb[_0xcfb1('0x64')](_0x4a654d);}})[_0xcfb1('0x28')](function(_0x38224f){if(_0x38224f){_0x57da2d=_0x38224f[_0xcfb1('0x3d')];if(!_0x56470c[_0xcfb1('0x37')][_0xcfb1('0x3e')]('nolimit')){_0x4a654d[_0xcfb1('0x21')]=qs[_0xcfb1('0x21')](_0x56470c[_0xcfb1('0x37')]['limit']);_0x4a654d['offset']=qs['offset'](_0x56470c[_0xcfb1('0x37')][_0xcfb1('0x1f')]);}return _0x24e5cb[_0xcfb1('0x64')](_0x4a654d);}})[_0xcfb1('0x28')](function(_0x18b092){if(_0x18b092){return _0x18b092?{'count':_0x57da2d,'rows':_0x18b092}:null;}})['then'](respondWithResult(_0x1341a4,null))[_0xcfb1('0x49')](handleError(_0x1341a4,null));};exports[_0xcfb1('0x66')]=function(_0x718d55,_0x58c17f,_0x12bd4a){var _0x875289=_0x718d55[_0xcfb1('0x4f')]['ids'];return db['Team']['findAll']({'where':{'id':_0x875289},'attributes':['id'],'include':[{'model':db[_0xcfb1('0x67')],'as':_0xcfb1('0x68'),'attributes':['id',_0xcfb1('0x2f'),'online',_0xcfb1('0x69'),_0xcfb1('0x6a')],'raw':!![]}]})['then'](function(_0xcf16ee){if(_0xcf16ee){var _0x43f415=_['flatMap'](_0xcf16ee,function(_0x4e2c1f){var _0x2e7c6f=_0x4e2c1f[_0xcfb1('0x2a')]({'plain':!![]});return _0x2e7c6f[_0xcfb1('0x68')];});return db['FaxQueue']['find']({'where':{'id':_0x718d55[_0xcfb1('0x4b')]['id']}})[_0xcfb1('0x28')](function(_0x4b1c16){return db[_0xcfb1('0x6b')][_0xcfb1('0x6c')](function(_0x3fe515){return _0x4b1c16['addTeams'](_0x875289,{'transaction':_0x3fe515})[_0xcfb1('0x28')](function(){return BPromise[_0xcfb1('0x6d')](_0x43f415,function(_0x371d8b){return db[_0xcfb1('0x5b')][_0xcfb1('0x6e')]({'where':{'UserId':_0x371d8b['id'],'FaxQueueId':_0x718d55[_0xcfb1('0x4b')]['id']},'transaction':_0x3fe515});});})['then'](function(){_0x43f415[_0xcfb1('0x6f')](function(_0x391430){socket['emit'](_0xcfb1('0x70'),{'UserId':_0x391430['id'],'FaxQueueId':_0x4b1c16['id']});});});});});}})['then'](respondWithStatusCode(_0x58c17f,null))['catch'](handleError(_0x58c17f,null));};exports[_0xcfb1('0x71')]=function(_0x592177,_0xe2ebb,_0x976ad3){return db[_0xcfb1('0x65')][_0xcfb1('0x48')]({'where':{'id':_0x592177['query'][_0xcfb1('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcfb1('0x68'),'attributes':['id'],'raw':!![]}]})[_0xcfb1('0x28')](handleEntityNotFound(_0xe2ebb,null))[_0xcfb1('0x28')](function(_0x42ba31){var _0x44186d=_[_0xcfb1('0x46')](_0x42ba31,'id');var _0x9e3b60=[];var _0x8e14b0=[];var _0x239ba7=squel[_0xcfb1('0x73')]();_0x239ba7['field'](_0xcfb1('0x74'))[_0xcfb1('0x75')](_0xcfb1('0x76'),'tq')['join'](_0xcfb1('0x77'),'ut',_0xcfb1('0x78'))[_0xcfb1('0x42')](_0xcfb1('0x79'),_0x592177[_0xcfb1('0x4b')]['id']);for(var _0x4c128c=0x0;_0x4c128c<_0x42ba31[_0xcfb1('0x3d')];_0x4c128c+=0x1){let _0x48c7e7=_0x42ba31[_0x4c128c];for(var _0x54baf0=0x0;_0x54baf0<_0x48c7e7[_0xcfb1('0x68')][_0xcfb1('0x3d')];_0x54baf0+=0x1){let _0x50381f=_0x48c7e7[_0xcfb1('0x68')][_0x54baf0];var _0x5c3a18=_0x239ba7[_0xcfb1('0x7a')]();_0x5c3a18['where'](_0xcfb1('0x7b'),_0x50381f['id']);_0x8e14b0[_0xcfb1('0x7c')](db[_0xcfb1('0x6b')][_0xcfb1('0x37')](_0x5c3a18[_0xcfb1('0x7d')](),{'type':db['sequelize'][_0xcfb1('0x7e')][_0xcfb1('0x7f')]})[_0xcfb1('0x28')](function(_0x362344){if(_0x362344[_0xcfb1('0x3d')]===0x1){return _0x50381f['id'];}else{var _0x248897=_[_0xcfb1('0x80')](_[_0xcfb1('0x46')](_0x362344,'TeamId'),function(_0x290331){return _[_0xcfb1('0x81')](_0x44186d,_0x290331);});if(_0x248897){return _0x50381f['id'];}}}));}}return BPromise[_0xcfb1('0x82')](_0x8e14b0)[_0xcfb1('0x28')](function(_0xe74a4d){_0x9e3b60=_(_0x9e3b60)[_0xcfb1('0x83')](_0xe74a4d)[_0xcfb1('0x84')]()[_0xcfb1('0x85')]();return db[_0xcfb1('0x32')][_0xcfb1('0x4e')]({'where':{'id':_0x592177[_0xcfb1('0x4b')]['id']}})['then'](function(_0x22ca9e){return db[_0xcfb1('0x6b')][_0xcfb1('0x6c')](function(_0x42450c){return _0x22ca9e[_0xcfb1('0x71')](_0x592177[_0xcfb1('0x37')][_0xcfb1('0x72')],{'transaction':_0x42450c})[_0xcfb1('0x28')](function(){if(!_[_0xcfb1('0x86')](_0x9e3b60)){return _0x22ca9e[_0xcfb1('0x87')](_0x9e3b60,{'transaction':_0x42450c});}})[_0xcfb1('0x28')](function(){_0x9e3b60[_0xcfb1('0x6f')](function(_0x2ba0c8){socket[_0xcfb1('0x88')](_0xcfb1('0x89'),{'UserId':_0x2ba0c8,'FaxQueueId':_0x22ca9e['id']});});});});});});})['then'](respondWithStatusCode(_0xe2ebb,null))['catch'](handleError(_0xe2ebb,null));};exports[_0xcfb1('0x8a')]=function(_0x9bb216,_0x2bfb18,_0x484053){return db[_0xcfb1('0x32')][_0xcfb1('0x4e')]({'where':{'id':_0x9bb216['params']['id']}})[_0xcfb1('0x28')](handleEntityNotFound(_0x2bfb18,null))[_0xcfb1('0x28')](function(_0x1fff44){if(_0x1fff44){return _0x1fff44[_0xcfb1('0x8a')](_0x9bb216[_0xcfb1('0x4f')][_0xcfb1('0x72')],_[_0xcfb1('0x8b')](_0x9bb216[_0xcfb1('0x4f')],[_0xcfb1('0x72'),'id'])||{})[_0xcfb1('0x8c')](function(_0x3d9a80){for(var _0x21f73e=0x0;_0x21f73e<_0x9bb216[_0xcfb1('0x4f')][_0xcfb1('0x72')]['length'];_0x21f73e+=0x1){socket[_0xcfb1('0x88')](_0xcfb1('0x70'),{'UserId':Number(_0x9bb216[_0xcfb1('0x4f')][_0xcfb1('0x72')][_0x21f73e]),'FaxQueueId':Number(_0x9bb216[_0xcfb1('0x4b')]['id'])});}return _0x3d9a80;});}})['then'](respondWithResult(_0x2bfb18,null))[_0xcfb1('0x49')](handleError(_0x2bfb18,null));};exports[_0xcfb1('0x87')]=function(_0x3839db,_0x197c33,_0x3cb1c8){return db[_0xcfb1('0x32')]['find']({'where':{'id':_0x3839db[_0xcfb1('0x4b')]['id']}})[_0xcfb1('0x28')](handleEntityNotFound(_0x197c33,null))[_0xcfb1('0x28')](function(_0x1f6d60){if(_0x1f6d60){return _0x1f6d60[_0xcfb1('0x87')](_0x3839db[_0xcfb1('0x37')][_0xcfb1('0x72')])[_0xcfb1('0x28')](function(){if(_[_0xcfb1('0x8d')](_0x3839db[_0xcfb1('0x37')][_0xcfb1('0x72')])){for(var _0x14f51f=0x0;_0x14f51f<_0x3839db[_0xcfb1('0x37')][_0xcfb1('0x72')][_0xcfb1('0x3d')];_0x14f51f+=0x1){socket[_0xcfb1('0x88')](_0xcfb1('0x89'),{'UserId':Number(_0x3839db[_0xcfb1('0x37')][_0xcfb1('0x72')][_0x14f51f]),'FaxQueueId':Number(_0x3839db[_0xcfb1('0x4b')]['id'])});}}else{socket[_0xcfb1('0x88')](_0xcfb1('0x89'),{'UserId':Number(_0x3839db[_0xcfb1('0x37')][_0xcfb1('0x72')]),'FaxQueueId':Number(_0x3839db[_0xcfb1('0x4b')]['id'])});}});}})[_0xcfb1('0x28')](respondWithStatusCode(_0x197c33,null))[_0xcfb1('0x49')](handleError(_0x197c33,null));};exports[_0xcfb1('0x8e')]=function(_0x4af521,_0x22060f,_0x4ca7b1){var _0x32dcce={};var _0x184eb6={};var _0x488e8e;var _0x367752;return db[_0xcfb1('0x32')][_0xcfb1('0x5a')]({'where':{'id':_0x4af521[_0xcfb1('0x4b')]['id']}})[_0xcfb1('0x28')](handleEntityNotFound(_0x22060f,null))['then'](function(_0x410249){if(_0x410249){_0x488e8e=_0x410249;_0x184eb6[_0xcfb1('0x39')]=_[_0xcfb1('0x38')](db[_0xcfb1('0x67')]['rawAttributes']);_0x184eb6[_0xcfb1('0x37')]=_[_0xcfb1('0x38')](_0x4af521[_0xcfb1('0x37')]);_0x184eb6[_0xcfb1('0x4c')]=_['intersection'](_0x184eb6[_0xcfb1('0x39')],_0x184eb6[_0xcfb1('0x37')]);_0x32dcce['attributes']=_[_0xcfb1('0x3a')](_0x184eb6[_0xcfb1('0x39')],qs[_0xcfb1('0x3b')](_0x4af521[_0xcfb1('0x37')][_0xcfb1('0x3b')]));_0x32dcce[_0xcfb1('0x3c')]=_0x32dcce[_0xcfb1('0x3c')][_0xcfb1('0x3d')]?_0x32dcce['attributes']:_0x184eb6[_0xcfb1('0x39')];_0x32dcce[_0xcfb1('0x40')]=qs[_0xcfb1('0x41')](_0x4af521[_0xcfb1('0x37')][_0xcfb1('0x41')]);_0x32dcce['where']=qs[_0xcfb1('0x4c')](_[_0xcfb1('0x43')](_0x4af521['query'],_0x184eb6[_0xcfb1('0x4c')]));if(_0x4af521[_0xcfb1('0x37')]['filter']){_0x32dcce[_0xcfb1('0x42')]=_[_0xcfb1('0x45')](_0x32dcce[_0xcfb1('0x42')],{'$or':_[_0xcfb1('0x46')](_0x32dcce[_0xcfb1('0x3c')],function(_0x484983){var _0xdd9d67={};_0xdd9d67[_0x484983]={'$like':'%'+_0x4af521['query']['filter']+'%'};return _0xdd9d67;})});}_0x32dcce=_[_0xcfb1('0x45')]({},_0x32dcce,_0x4af521['options']);return _0x488e8e['getAgents'](_0x32dcce);}})[_0xcfb1('0x28')](function(_0x4500ac){if(_0x4500ac){_0x367752=_0x4500ac[_0xcfb1('0x3d')];if(!_0x4af521['query'][_0xcfb1('0x3e')](_0xcfb1('0x3f'))){_0x32dcce['limit']=qs[_0xcfb1('0x21')](_0x4af521[_0xcfb1('0x37')]['limit']);_0x32dcce['offset']=qs[_0xcfb1('0x1f')](_0x4af521[_0xcfb1('0x37')]['offset']);}return _0x488e8e[_0xcfb1('0x8e')](_0x32dcce);}})['then'](function(_0x467148){if(_0x467148){return _0x467148?{'count':_0x367752,'rows':_0x467148}:null;}})[_0xcfb1('0x28')](respondWithResult(_0x22060f,null))['catch'](handleError(_0x22060f,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 245db9b..096293e 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 _0xa95d=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x22c718,_0x4126b8){var _0x921848=function(_0x451b09){while(--_0x451b09){_0x22c718['push'](_0x22c718['shift']());}};_0x921848(++_0x4126b8);}(_0xa95d,0x1a1));var _0xda95=function(_0x570ad8,_0x425ec5){_0x570ad8=_0x570ad8-0x0;var _0x1eb874=_0xa95d[_0x570ad8];return _0x1eb874;};'use strict';var EventEmitter=require(_0xda95('0x0'));var FaxQueue=require(_0xda95('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xda95('0x2')](0x0);var events={'afterCreate':_0xda95('0x3'),'afterUpdate':'update','afterDestroy':_0xda95('0x4')};function emitEvent(_0x44edb4){return function(_0x488ec8,_0x54b3b5,_0x3105e0){FaxQueueEvents['emit'](_0x44edb4+':'+_0x488ec8['id'],_0x488ec8);FaxQueueEvents[_0xda95('0x5')](_0x44edb4,_0x488ec8);_0x3105e0(null);};}for(var e in events){if(events[_0xda95('0x6')](e)){var event=events[e];FaxQueue[_0xda95('0x7')](e,emitEvent(event));}}module[_0xda95('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x8b90=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x8b90,0x197));var _0x08b9=function(_0x4f724f,_0x29213e){_0x4f724f=_0x4f724f-0x0;var _0x2343c3=_0x8b90[_0x4f724f];return _0x2343c3;};'use strict';var EventEmitter=require(_0x08b9('0x0'));var FaxQueue=require(_0x08b9('0x1'))['db'][_0x08b9('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x08b9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x08b9('0x4'),'afterDestroy':_0x08b9('0x5')};function emitEvent(_0x5ce53d){return function(_0x11ff27,_0x5ec797,_0x5e7e12){FaxQueueEvents[_0x08b9('0x6')](_0x5ce53d+':'+_0x11ff27['id'],_0x11ff27);FaxQueueEvents[_0x08b9('0x6')](_0x5ce53d,_0x11ff27);_0x5e7e12(null);};}for(var e in events){if(events[_0x08b9('0x7')](e)){var event=events[e];FaxQueue[_0x08b9('0x8')](e,emitEvent(event));}}module[_0x08b9('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index f3aa1bf..ab18e5b 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 _0x013e=['path','rimraf','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','api','moment','bluebird'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x013e,0x6a));var _0xe013=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0x013e[_0x96f74c];return _0x379222;};'use strict';var _=require(_0xe013('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe013('0x1'));var moment=require(_0xe013('0x2'));var BPromise=require(_0xe013('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe013('0x4'));var rimraf=require(_0xe013('0x5'));var config=require('../../config/environment');var attributes=require(_0xe013('0x6'));module[_0xe013('0x7')]=function(_0x423d81,_0x3785d7){return _0x423d81[_0xe013('0x8')](_0xe013('0x9'),attributes,{'tableName':_0xe013('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f3a=['path','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','moment','request-promise'];(function(_0x38f737,_0x54f685){var _0x7afda3=function(_0x1ac1d7){while(--_0x1ac1d7){_0x38f737['push'](_0x38f737['shift']());}};_0x7afda3(++_0x54f685);}(_0x3f3a,0x72));var _0xa3f3=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x3f3a[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xa3f3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa3f3('0x1'));var BPromise=require('bluebird');var rp=require(_0xa3f3('0x2'));var fs=require('fs');var path=require(_0xa3f3('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa3f3('0x4'));module[_0xa3f3('0x5')]=function(_0x3b99a5,_0x4d53ce){return _0x3b99a5[_0xa3f3('0x6')](_0xa3f3('0x7'),attributes,{'tableName':_0xa3f3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index c9ccf9a..93ca115 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 _0xa4f1=['error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','limit','include','model','map','ShowFaxQueue','find','where','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','http','redis','defaults','./faxQueue.socket','register','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x4d59f0,_0x266144){var _0x59e2de=function(_0x357e1c){while(--_0x357e1c){_0x4d59f0['push'](_0x4d59f0['shift']());}};_0x59e2de(++_0x266144);}(_0xa4f1,0x13c));var _0x1a4f=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xa4f1[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x1a4f('0x0'));var util=require(_0x1a4f('0x1'));var moment=require(_0x1a4f('0x2'));var BPromise=require('bluebird');var rs=require(_0x1a4f('0x3'));var fs=require('fs');var Redis=require(_0x1a4f('0x4'));var db=require(_0x1a4f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a4f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1a4f('0x7')]({'port':0x232a});config[_0x1a4f('0x8')]=_[_0x1a4f('0x9')](config[_0x1a4f('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a4f('0x8')]));require(_0x1a4f('0xa'))[_0x1a4f('0xb')](socket);function respondWithRpcPromise(_0x5c2173,_0x294c20,_0x2dd719){return new BPromise(function(_0x311c7b,_0x3fb4aa){return client['request'](_0x5c2173,_0x2dd719)[_0x1a4f('0xc')](function(_0xe43c04){logger['info'](_0x1a4f('0xd'),_0x294c20,_0x1a4f('0xe'));logger[_0x1a4f('0xf')](_0x1a4f('0x10'),_0x294c20,_0x1a4f('0xe'),JSON['stringify'](_0xe43c04));if(_0xe43c04[_0x1a4f('0x11')]){if(_0xe43c04[_0x1a4f('0x11')][_0x1a4f('0x12')]===0x1f4){logger[_0x1a4f('0x11')](_0x1a4f('0xd'),_0x294c20,_0xe43c04[_0x1a4f('0x11')][_0x1a4f('0x13')]);return _0x3fb4aa(_0xe43c04['error']['message']);}logger['error'](_0x1a4f('0xd'),_0x294c20,_0xe43c04[_0x1a4f('0x11')][_0x1a4f('0x13')]);return _0x311c7b(_0xe43c04[_0x1a4f('0x11')][_0x1a4f('0x13')]);}else{logger[_0x1a4f('0x14')]('FaxQueue,\x20%s,\x20%s',_0x294c20,_0x1a4f('0xe'));_0x311c7b(_0xe43c04[_0x1a4f('0x15')][_0x1a4f('0x13')]);}})[_0x1a4f('0x16')](function(_0x34f331){logger[_0x1a4f('0x11')]('FaxQueue,\x20%s,\x20%s',_0x294c20,_0x34f331);_0x3fb4aa(_0x34f331);});});}exports[_0x1a4f('0x17')]=function(_0x5c02de){var _0x488d1b=this;return new Promise(function(_0x11f124,_0x38bb2a){return db[_0x1a4f('0x18')][_0x1a4f('0x19')]({'raw':_0x5c02de[_0x1a4f('0x1a')]?_0x5c02de[_0x1a4f('0x1a')][_0x1a4f('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c02de[_0x1a4f('0x1a')]?_0x5c02de[_0x1a4f('0x1a')]['where']||null:null,'attributes':_0x5c02de['options']?_0x5c02de['options'][_0x1a4f('0x1c')]||null:null,'limit':_0x5c02de[_0x1a4f('0x1a')]?_0x5c02de['options'][_0x1a4f('0x1d')]||null:null,'include':_0x5c02de[_0x1a4f('0x1a')]?_0x5c02de[_0x1a4f('0x1a')][_0x1a4f('0x1e')]?_['map'](_0x5c02de[_0x1a4f('0x1a')][_0x1a4f('0x1e')],function(_0x1b2ebe){return{'model':db[_0x1b2ebe[_0x1a4f('0x1f')]],'as':_0x1b2ebe['as'],'attributes':_0x1b2ebe['attributes'],'include':_0x1b2ebe[_0x1a4f('0x1e')]?_['map'](_0x1b2ebe[_0x1a4f('0x1e')],function(_0x3b90d4){return{'model':db[_0x3b90d4[_0x1a4f('0x1f')]],'as':_0x3b90d4['as'],'attributes':_0x3b90d4[_0x1a4f('0x1c')],'include':_0x3b90d4[_0x1a4f('0x1e')]?_[_0x1a4f('0x20')](_0x3b90d4[_0x1a4f('0x1e')],function(_0x579c80){return{'model':db[_0x579c80[_0x1a4f('0x1f')]],'as':_0x579c80['as'],'attributes':_0x579c80[_0x1a4f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1a4f('0xc')](function(_0x12411a){logger[_0x1a4f('0x14')]('GetFaxQueue',_0x5c02de);logger[_0x1a4f('0xf')]('GetFaxQueue',_0x5c02de,JSON['stringify'](_0x12411a));_0x11f124(_0x12411a);})[_0x1a4f('0x16')](function(_0x3e244d){logger[_0x1a4f('0x11')](_0x1a4f('0x17'),_0x3e244d[_0x1a4f('0x13')],_0x5c02de);_0x38bb2a(_0x488d1b[_0x1a4f('0x11')](0x1f4,_0x3e244d['message']));});});};exports[_0x1a4f('0x21')]=function(_0x24d887){var _0xbd4611=this;return new Promise(function(_0x850ae7,_0x502f32){return db[_0x1a4f('0x18')][_0x1a4f('0x22')]({'raw':_0x24d887[_0x1a4f('0x1a')]?_0x24d887[_0x1a4f('0x1a')][_0x1a4f('0x1b')]===undefined?!![]:![]:!![],'where':_0x24d887[_0x1a4f('0x1a')]?_0x24d887[_0x1a4f('0x1a')][_0x1a4f('0x23')]||null:null,'attributes':_0x24d887[_0x1a4f('0x1a')]?_0x24d887[_0x1a4f('0x1a')]['attributes']||null:null,'include':_0x24d887[_0x1a4f('0x1a')]?_0x24d887[_0x1a4f('0x1a')][_0x1a4f('0x1e')]?_[_0x1a4f('0x20')](_0x24d887[_0x1a4f('0x1a')][_0x1a4f('0x1e')],function(_0x1d8668){return{'model':db[_0x1d8668[_0x1a4f('0x1f')]],'as':_0x1d8668['as'],'attributes':_0x1d8668[_0x1a4f('0x1c')],'include':_0x1d8668['include']?_[_0x1a4f('0x20')](_0x1d8668['include'],function(_0x1ec167){return{'model':db[_0x1ec167['model']],'as':_0x1ec167['as'],'attributes':_0x1ec167[_0x1a4f('0x1c')],'include':_0x1ec167[_0x1a4f('0x1e')]?_['map'](_0x1ec167['include'],function(_0x44da7c){return{'model':db[_0x44da7c[_0x1a4f('0x1f')]],'as':_0x44da7c['as'],'attributes':_0x44da7c[_0x1a4f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1a4f('0xc')](function(_0x410d3f){logger[_0x1a4f('0x14')](_0x1a4f('0x21'),_0x24d887);logger[_0x1a4f('0xf')](_0x1a4f('0x21'),_0x24d887,JSON[_0x1a4f('0x24')](_0x410d3f));_0x850ae7(_0x410d3f);})[_0x1a4f('0x16')](function(_0x37993f){logger[_0x1a4f('0x11')](_0x1a4f('0x21'),_0x37993f[_0x1a4f('0x13')],_0x24d887);_0x502f32(_0xbd4611[_0x1a4f('0x11')](0x1f4,_0x37993f[_0x1a4f('0x13')]));});});}; \ No newline at end of file +var _0x9488=['FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFaxQueue','options','raw','where','map','include','model','attributes','FaxQueue','find','ShowFaxQueue','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxQueue.socket','register','then','info'];(function(_0x82b1b1,_0x2ab269){var _0x14bac3=function(_0x39f43d){while(--_0x39f43d){_0x82b1b1['push'](_0x82b1b1['shift']());}};_0x14bac3(++_0x2ab269);}(_0x9488,0x1e7));var _0x8948=function(_0x88271d,_0x54a578){_0x88271d=_0x88271d-0x0;var _0x1ad066=_0x9488[_0x88271d];return _0x1ad066;};'use strict';var _=require(_0x8948('0x0'));var util=require('util');var moment=require(_0x8948('0x1'));var BPromise=require(_0x8948('0x2'));var rs=require(_0x8948('0x3'));var fs=require('fs');var Redis=require(_0x8948('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8948('0x5'));var logger=require(_0x8948('0x6'))(_0x8948('0x7'));var config=require(_0x8948('0x8'));var jayson=require(_0x8948('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x8948('0xa')]=_['defaults'](config[_0x8948('0xa')],{'host':_0x8948('0xb'),'port':0x18eb});var socket=require(_0x8948('0xc'))(new Redis(config[_0x8948('0xa')]));require(_0x8948('0xd'))[_0x8948('0xe')](socket);function respondWithRpcPromise(_0x2e877e,_0xd849fd,_0xa3af0c){return new BPromise(function(_0x360a5a,_0x36defe){return client['request'](_0x2e877e,_0xa3af0c)[_0x8948('0xf')](function(_0x4c649a){logger[_0x8948('0x10')](_0x8948('0x11'),_0xd849fd,_0x8948('0x12'));logger[_0x8948('0x13')](_0x8948('0x14'),_0xd849fd,_0x8948('0x12'),JSON[_0x8948('0x15')](_0x4c649a));if(_0x4c649a[_0x8948('0x16')]){if(_0x4c649a[_0x8948('0x16')]['code']===0x1f4){logger['error'](_0x8948('0x11'),_0xd849fd,_0x4c649a['error'][_0x8948('0x17')]);return _0x36defe(_0x4c649a[_0x8948('0x16')][_0x8948('0x17')]);}logger['error'](_0x8948('0x11'),_0xd849fd,_0x4c649a[_0x8948('0x16')][_0x8948('0x17')]);return _0x360a5a(_0x4c649a['error']['message']);}else{logger['info'](_0x8948('0x11'),_0xd849fd,_0x8948('0x12'));_0x360a5a(_0x4c649a['result'][_0x8948('0x17')]);}})[_0x8948('0x18')](function(_0x3c850a){logger['error']('FaxQueue,\x20%s,\x20%s',_0xd849fd,_0x3c850a);_0x36defe(_0x3c850a);});});}exports[_0x8948('0x19')]=function(_0x59c204){var _0x5ef470=this;return new Promise(function(_0x2baa79,_0x54e009){return db['FaxQueue']['findAll']({'raw':_0x59c204[_0x8948('0x1a')]?_0x59c204[_0x8948('0x1a')][_0x8948('0x1b')]===undefined?!![]:![]:!![],'where':_0x59c204[_0x8948('0x1a')]?_0x59c204[_0x8948('0x1a')][_0x8948('0x1c')]||null:null,'attributes':_0x59c204['options']?_0x59c204[_0x8948('0x1a')]['attributes']||null:null,'limit':_0x59c204[_0x8948('0x1a')]?_0x59c204[_0x8948('0x1a')]['limit']||null:null,'include':_0x59c204[_0x8948('0x1a')]?_0x59c204[_0x8948('0x1a')]['include']?_[_0x8948('0x1d')](_0x59c204[_0x8948('0x1a')][_0x8948('0x1e')],function(_0x3aa8eb){return{'model':db[_0x3aa8eb[_0x8948('0x1f')]],'as':_0x3aa8eb['as'],'attributes':_0x3aa8eb[_0x8948('0x20')],'include':_0x3aa8eb['include']?_['map'](_0x3aa8eb[_0x8948('0x1e')],function(_0x5488be){return{'model':db[_0x5488be[_0x8948('0x1f')]],'as':_0x5488be['as'],'attributes':_0x5488be[_0x8948('0x20')],'include':_0x5488be[_0x8948('0x1e')]?_[_0x8948('0x1d')](_0x5488be['include'],function(_0x3689be){return{'model':db[_0x3689be[_0x8948('0x1f')]],'as':_0x3689be['as'],'attributes':_0x3689be[_0x8948('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5478f3){logger['info']('GetFaxQueue',_0x59c204);logger[_0x8948('0x13')](_0x8948('0x19'),_0x59c204,JSON['stringify'](_0x5478f3));_0x2baa79(_0x5478f3);})[_0x8948('0x18')](function(_0x37475d){logger[_0x8948('0x16')]('GetFaxQueue',_0x37475d[_0x8948('0x17')],_0x59c204);_0x54e009(_0x5ef470['error'](0x1f4,_0x37475d[_0x8948('0x17')]));});});};exports['ShowFaxQueue']=function(_0x51d59f){var _0x56875a=this;return new Promise(function(_0x44129f,_0x587dbf){return db[_0x8948('0x21')][_0x8948('0x22')]({'raw':_0x51d59f['options']?_0x51d59f[_0x8948('0x1a')][_0x8948('0x1b')]===undefined?!![]:![]:!![],'where':_0x51d59f['options']?_0x51d59f[_0x8948('0x1a')][_0x8948('0x1c')]||null:null,'attributes':_0x51d59f['options']?_0x51d59f[_0x8948('0x1a')]['attributes']||null:null,'include':_0x51d59f[_0x8948('0x1a')]?_0x51d59f[_0x8948('0x1a')]['include']?_[_0x8948('0x1d')](_0x51d59f[_0x8948('0x1a')][_0x8948('0x1e')],function(_0x15e958){return{'model':db[_0x15e958[_0x8948('0x1f')]],'as':_0x15e958['as'],'attributes':_0x15e958[_0x8948('0x20')],'include':_0x15e958[_0x8948('0x1e')]?_[_0x8948('0x1d')](_0x15e958['include'],function(_0x590227){return{'model':db[_0x590227[_0x8948('0x1f')]],'as':_0x590227['as'],'attributes':_0x590227[_0x8948('0x20')],'include':_0x590227[_0x8948('0x1e')]?_['map'](_0x590227[_0x8948('0x1e')],function(_0x305a0a){return{'model':db[_0x305a0a[_0x8948('0x1f')]],'as':_0x305a0a['as'],'attributes':_0x305a0a[_0x8948('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a9168){logger[_0x8948('0x10')]('ShowFaxQueue',_0x51d59f);logger[_0x8948('0x13')](_0x8948('0x23'),_0x51d59f,JSON['stringify'](_0x3a9168));_0x44129f(_0x3a9168);})['catch'](function(_0x34e9a4){logger[_0x8948('0x16')]('ShowFaxQueue',_0x34e9a4[_0x8948('0x17')],_0x51d59f);_0x587dbf(_0x56875a[_0x8948('0x16')](0x1f4,_0x34e9a4['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 1007ddd..ece374c 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 _0xf5b8=['length','./faxQueue.events','emit','register'];(function(_0x2ac6d6,_0x45a3b9){var _0x16174b=function(_0x2c660b){while(--_0x2c660b){_0x2ac6d6['push'](_0x2ac6d6['shift']());}};_0x16174b(++_0x45a3b9);}(_0xf5b8,0xcd));var _0x8f5b=function(_0x572ab0,_0x40e0ea){_0x572ab0=_0x572ab0-0x0;var _0x3e9079=_0xf5b8[_0x572ab0];return _0x3e9079;};'use strict';var FaxQueueEvents=require(_0x8f5b('0x0'));var events=['save','remove','update'];function createListener(_0x384b73,_0x13779f){return function(_0x43a87f){_0x13779f[_0x8f5b('0x1')](_0x384b73,_0x43a87f);};}function removeListener(_0x4c3e07,_0x5dcb2d){return function(){FaxQueueEvents['removeListener'](_0x4c3e07,_0x5dcb2d);};}exports[_0x8f5b('0x2')]=function(_0x3d12a0){for(var _0x18ee33=0x0,_0x199f75=events[_0x8f5b('0x3')];_0x18ee33<_0x199f75;_0x18ee33++){var _0x26b91f=events[_0x18ee33];var _0x25992e=createListener('faxQueue:'+_0x26b91f,_0x3d12a0);FaxQueueEvents['on'](_0x26b91f,_0x25992e);}}; \ No newline at end of file +var _0xa0e9=['emit','length','faxQueue:','save','update'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xa0e9,0xdf));var _0x9a0e=function(_0x67caf,_0x56a915){_0x67caf=_0x67caf-0x0;var _0x57118e=_0xa0e9[_0x67caf];return _0x57118e;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x9a0e('0x0'),'remove',_0x9a0e('0x1')];function createListener(_0x19d5a7,_0x330b0f){return function(_0x24724a){_0x330b0f[_0x9a0e('0x2')](_0x19d5a7,_0x24724a);};}function removeListener(_0x4105d8,_0x5e0a0c){return function(){FaxQueueEvents['removeListener'](_0x4105d8,_0x5e0a0c);};}exports['register']=function(_0x5b6687){for(var _0x291497=0x0,_0x35a632=events[_0x9a0e('0x3')];_0x291497<_0x35a632;_0x291497++){var _0x325f8f=events[_0x291497];var _0x306b51=createListener(_0x9a0e('0x4')+_0x325f8f,_0x5b6687);FaxQueueEvents['on'](_0x325f8f,_0x306b51);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 723ad2f..213e8e5 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 _0x0295=['../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','getMembers','getTeams','getAgents','/:id/teams','addTeams','post','/:id/users','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','multer','connect-timeout','fs-extra','../../components/auth/service'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x0295,0x1f0));var _0x5029=function(_0x3677fc,_0x187168){_0x3677fc=_0x3677fc-0x0;var _0x183fc3=_0x0295[_0x3677fc];return _0x183fc3;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5029('0x7')]('/:id',auth[_0x5029('0x8')](),controller['show']);router[_0x5029('0x7')]('/:id/members',auth[_0x5029('0x8')](),controller[_0x5029('0xa')]);router[_0x5029('0x7')]('/:id/teams',auth[_0x5029('0x8')](),controller[_0x5029('0xb')]);router[_0x5029('0x7')]('/:id/users',auth[_0x5029('0x8')](),controller[_0x5029('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x5029('0xd'),auth[_0x5029('0x8')](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0x10'),auth[_0x5029('0x8')](),controller[_0x5029('0x11')]);router[_0x5029('0x12')](_0x5029('0x13'),auth[_0x5029('0x8')](),controller[_0x5029('0x14')]);router[_0x5029('0x15')](_0x5029('0x13'),auth[_0x5029('0x8')](),controller[_0x5029('0x16')]);router['delete'](_0x5029('0xd'),auth[_0x5029('0x8')](),controller[_0x5029('0x17')]);router[_0x5029('0x15')](_0x5029('0x10'),auth[_0x5029('0x8')](),controller[_0x5029('0x18')]);module['exports']=router; \ No newline at end of file +var _0xe61c=['addAgents','destroy','removeTeams','delete','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams'];(function(_0x1f3064,_0x1bff33){var _0x45979d=function(_0xcc991c){while(--_0xcc991c){_0x1f3064['push'](_0x1f3064['shift']());}};_0x45979d(++_0x1bff33);}(_0xe61c,0xee));var _0xce61=function(_0xf31767,_0x381746){_0xf31767=_0xf31767-0x0;var _0x24bd0c=_0xe61c[_0xf31767];return _0x24bd0c;};'use strict';var multer=require(_0xce61('0x0'));var util=require('util');var path=require(_0xce61('0x1'));var timeout=require(_0xce61('0x2'));var express=require(_0xce61('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xce61('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xce61('0x5'));var controller=require(_0xce61('0x6'));router[_0xce61('0x7')]('/',auth[_0xce61('0x8')](),controller[_0xce61('0x9')]);router[_0xce61('0x7')](_0xce61('0xa'),auth['isAuthenticated'](),controller[_0xce61('0xb')]);router[_0xce61('0x7')](_0xce61('0xc'),auth[_0xce61('0x8')](),controller[_0xce61('0xd')]);router[_0xce61('0x7')](_0xce61('0xe'),auth['isAuthenticated'](),controller[_0xce61('0xf')]);router[_0xce61('0x7')]('/:id/teams',auth[_0xce61('0x8')](),controller[_0xce61('0x10')]);router['get'](_0xce61('0x11'),auth['isAuthenticated'](),controller[_0xce61('0x12')]);router[_0xce61('0x13')]('/',auth['isAuthenticated'](),controller[_0xce61('0x14')]);router['post'](_0xce61('0x15'),auth['isAuthenticated'](),controller[_0xce61('0x16')]);router[_0xce61('0x13')](_0xce61('0x11'),auth[_0xce61('0x8')](),controller[_0xce61('0x17')]);router['put']('/:id',auth[_0xce61('0x8')](),controller['update']);router['delete'](_0xce61('0xc'),auth[_0xce61('0x8')](),controller[_0xce61('0x18')]);router['delete'](_0xce61('0x15'),auth['isAuthenticated'](),controller[_0xce61('0x19')]);router[_0xce61('0x1a')](_0xce61('0x11'),auth[_0xce61('0x8')](),controller[_0xce61('0x1b')]);module[_0xce61('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index a32f5a6..4410568 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 _0x0c97=['DATE','sequelize','STRING'];(function(_0x5e99fa,_0x54e734){var _0x28654a=function(_0x233350){while(--_0x233350){_0x5e99fa['push'](_0x5e99fa['shift']());}};_0x28654a(++_0x54e734);}(_0x0c97,0x64));var _0x70c9=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x0c97[_0x462999];return _0x4b1366;};'use strict';var moment=require('moment');var Sequelize=require(_0x70c9('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x70c9('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x70c9('0x2')]},'leaveAt':{'type':Sequelize[_0x70c9('0x2')]},'acceptAt':{'type':Sequelize[_0x70c9('0x2')]},'exitAt':{'type':Sequelize[_0x70c9('0x2')]},'reason':{'type':Sequelize[_0x70c9('0x1')]}}; \ No newline at end of file +var _0x7789=['STRING','DATE','moment','sequelize','exports'];(function(_0x53aee9,_0x5a22b3){var _0x3e9631=function(_0x57e852){while(--_0x57e852){_0x53aee9['push'](_0x53aee9['shift']());}};_0x3e9631(++_0x5a22b3);}(_0x7789,0x11a));var _0x9778=function(_0x15ceb3,_0x2fa894){_0x15ceb3=_0x15ceb3-0x0;var _0x5593d9=_0x7789[_0x15ceb3];return _0x5593d9;};'use strict';var moment=require(_0x9778('0x0'));var Sequelize=require(_0x9778('0x1'));module[_0x9778('0x2')]={'uniqueid':{'type':Sequelize[_0x9778('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9778('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9778('0x4')]},'acceptAt':{'type':Sequelize[_0x9778('0x4')]},'exitAt':{'type':Sequelize[_0x9778('0x4')]},'reason':{'type':Sequelize[_0x9778('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index e57f6d8..0a372f4 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 _0x3451=['nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','show','includeAll','find','catch','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3451,0x19a));var _0x1345=function(_0x9ccb03,_0x56b4d0){_0x9ccb03=_0x9ccb03-0x0;var _0x101a5d=_0x3451[_0x9ccb03];return _0x101a5d;};'use strict';var emlformat=require(_0x1345('0x0'));var rimraf=require(_0x1345('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1345('0x2'));var rp=require(_0x1345('0x3'));var moment=require(_0x1345('0x4'));var BPromise=require(_0x1345('0x5'));var Mustache=require(_0x1345('0x6'));var util=require(_0x1345('0x7'));var path=require(_0x1345('0x8'));var sox=require(_0x1345('0x9'));var csv=require(_0x1345('0xa'));var ejs=require(_0x1345('0xb'));var fs=require('fs');var fs_extra=require(_0x1345('0xc'));var _=require(_0x1345('0xd'));var squel=require('squel');var crypto=require(_0x1345('0xe'));var jsforce=require(_0x1345('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1345('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1345('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1345('0x11'));var as=require(_0x1345('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1345('0x13'));var utils=require('../../config/utils');var config=require(_0x1345('0x14'));var licenseUtil=require(_0x1345('0x15'));var db=require(_0x1345('0x16'))['db'];function respondWithStatusCode(_0x3e1362,_0x528692){_0x528692=_0x528692||0xcc;return function(_0x3fdff0){if(_0x3fdff0){return _0x3e1362[_0x1345('0x17')](_0x528692);}return _0x3e1362[_0x1345('0x18')](_0x528692)[_0x1345('0x19')]();};}function respondWithResult(_0x4ea08a,_0x181a2b){_0x181a2b=_0x181a2b||0xc8;return function(_0x426e00){if(_0x426e00){return _0x4ea08a[_0x1345('0x18')](_0x181a2b)[_0x1345('0x1a')](_0x426e00);}};}function respondWithFilteredResult(_0x347591,_0x959544){return function(_0x3cd49e){if(_0x3cd49e){var _0x520e6c=typeof _0x959544[_0x1345('0x1b')]===_0x1345('0x1c')&&typeof _0x959544[_0x1345('0x1d')]==='undefined';var _0x5b4d04=_0x3cd49e[_0x1345('0x1e')];var _0x1afc89=_0x520e6c?0x0:_0x959544[_0x1345('0x1b')];var _0x1db636=_0x520e6c?_0x3cd49e['count']:_0x959544[_0x1345('0x1b')]+_0x959544[_0x1345('0x1d')];var _0x1f3746;if(_0x1db636>=_0x5b4d04){_0x1db636=_0x5b4d04;_0x1f3746=0xc8;}else{_0x1f3746=0xce;}_0x347591[_0x1345('0x18')](_0x1f3746);return _0x347591[_0x1345('0x1f')](_0x1345('0x20'),_0x1afc89+'-'+_0x1db636+'/'+_0x5b4d04)[_0x1345('0x1a')](_0x3cd49e);}return null;};}function patchUpdates(_0x43d209){return function(_0x3bc681){try{jsonpatch[_0x1345('0x21')](_0x3bc681,_0x43d209,!![]);}catch(_0x265ea8){return BPromise['reject'](_0x265ea8);}return _0x3bc681[_0x1345('0x22')]();};}function saveUpdates(_0x4855d7,_0xaf6ecc){return function(_0x217712){if(_0x217712){return _0x217712[_0x1345('0x23')](_0x4855d7)[_0x1345('0x24')](function(_0x422dd9){return _0x422dd9;});}return null;};}function removeEntity(_0x2fd7ca,_0x26c2a6){return function(_0x339ea9){if(_0x339ea9){return _0x339ea9[_0x1345('0x25')]()[_0x1345('0x24')](function(){_0x2fd7ca[_0x1345('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x346054,_0x4a390c){return function(_0xd08b03){if(!_0xd08b03){_0x346054[_0x1345('0x17')](0x194);}return _0xd08b03;};}function handleError(_0x11827a,_0x32f9a3){_0x32f9a3=_0x32f9a3||0x1f4;return function(_0x44aa74){logger[_0x1345('0x26')](_0x44aa74[_0x1345('0x27')]);if(_0x44aa74[_0x1345('0x28')]){delete _0x44aa74[_0x1345('0x28')];}_0x11827a[_0x1345('0x18')](_0x32f9a3)[_0x1345('0x29')](_0x44aa74);};}exports[_0x1345('0x2a')]=function(_0x483e75,_0x3ffbdc){var _0x50533b={},_0x5ac56d={},_0x2b598a={'count':0x0,'rows':[]};var _0x2e2b94=_[_0x1345('0x2b')](db[_0x1345('0x2c')][_0x1345('0x2d')],function(_0x51425d){return{'name':_0x51425d[_0x1345('0x2e')],'type':_0x51425d[_0x1345('0x2f')][_0x1345('0x30')]};});_0x5ac56d['model']=_[_0x1345('0x2b')](_0x2e2b94,'name');_0x5ac56d['query']=_[_0x1345('0x31')](_0x483e75[_0x1345('0x32')]);_0x5ac56d[_0x1345('0x33')]=_[_0x1345('0x34')](_0x5ac56d['model'],_0x5ac56d[_0x1345('0x32')]);_0x50533b[_0x1345('0x35')]=_[_0x1345('0x34')](_0x5ac56d[_0x1345('0x36')],qs[_0x1345('0x37')](_0x483e75[_0x1345('0x32')][_0x1345('0x37')]));_0x50533b[_0x1345('0x35')]=_0x50533b[_0x1345('0x35')][_0x1345('0x38')]?_0x50533b[_0x1345('0x35')]:_0x5ac56d['model'];if(!_0x483e75[_0x1345('0x32')][_0x1345('0x39')](_0x1345('0x3a'))){_0x50533b[_0x1345('0x1d')]=qs[_0x1345('0x1d')](_0x483e75['query'][_0x1345('0x1d')]);_0x50533b['offset']=qs['offset'](_0x483e75[_0x1345('0x32')][_0x1345('0x1b')]);}_0x50533b[_0x1345('0x3b')]=qs['sort'](_0x483e75[_0x1345('0x32')][_0x1345('0x3c')]);_0x50533b[_0x1345('0x3d')]=qs[_0x1345('0x33')](_[_0x1345('0x3e')](_0x483e75[_0x1345('0x32')],_0x5ac56d[_0x1345('0x33')]),_0x2e2b94);if(_0x483e75['query']['filter']){_0x50533b['where']=_['merge'](_0x50533b['where'],{'$or':_[_0x1345('0x2b')](_0x2e2b94,function(_0x216911){if(_0x216911[_0x1345('0x2f')]!==_0x1345('0x3f')){var _0x116035={};_0x116035[_0x216911['name']]={'$like':'%'+_0x483e75['query'][_0x1345('0x40')]+'%'};return _0x116035;}})});}_0x50533b=_[_0x1345('0x41')]({},_0x50533b,_0x483e75[_0x1345('0x42')]);var _0x3b1578={'where':_0x50533b[_0x1345('0x3d')]};return db[_0x1345('0x2c')]['count'](_0x3b1578)[_0x1345('0x24')](function(_0x373d0a){_0x2b598a[_0x1345('0x1e')]=_0x373d0a;if(_0x483e75[_0x1345('0x32')]['includeAll']){_0x50533b[_0x1345('0x43')]=[{'all':!![]}];}return db[_0x1345('0x2c')][_0x1345('0x44')](_0x50533b);})['then'](function(_0x10f67b){_0x2b598a[_0x1345('0x45')]=_0x10f67b;return _0x2b598a;})[_0x1345('0x24')](respondWithFilteredResult(_0x3ffbdc,_0x50533b))['catch'](handleError(_0x3ffbdc,null));};exports[_0x1345('0x46')]=function(_0x35791c,_0x2a798a){var _0x1210c2={'raw':!![],'where':{'id':_0x35791c['params']['id']}},_0x3bbc86={};_0x3bbc86[_0x1345('0x36')]=_[_0x1345('0x31')](db[_0x1345('0x2c')][_0x1345('0x2d')]);_0x3bbc86['query']=_[_0x1345('0x31')](_0x35791c[_0x1345('0x32')]);_0x3bbc86[_0x1345('0x33')]=_[_0x1345('0x34')](_0x3bbc86[_0x1345('0x36')],_0x3bbc86[_0x1345('0x32')]);_0x1210c2[_0x1345('0x35')]=_[_0x1345('0x34')](_0x3bbc86[_0x1345('0x36')],qs[_0x1345('0x37')](_0x35791c[_0x1345('0x32')][_0x1345('0x37')]));_0x1210c2[_0x1345('0x35')]=_0x1210c2[_0x1345('0x35')][_0x1345('0x38')]?_0x1210c2[_0x1345('0x35')]:_0x3bbc86['model'];if(_0x35791c[_0x1345('0x32')][_0x1345('0x47')]){_0x1210c2[_0x1345('0x43')]=[{'all':!![]}];}_0x1210c2=_[_0x1345('0x41')]({},_0x1210c2,_0x35791c[_0x1345('0x42')]);return db[_0x1345('0x2c')][_0x1345('0x48')](_0x1210c2)[_0x1345('0x24')](handleEntityNotFound(_0x2a798a,null))[_0x1345('0x24')](respondWithResult(_0x2a798a,null))[_0x1345('0x49')](handleError(_0x2a798a,null));};exports[_0x1345('0x4a')]=function(_0x5aa1d3,_0x1753bc){return db['FaxQueueReport'][_0x1345('0x4a')](_0x5aa1d3['body'],{})[_0x1345('0x24')](respondWithResult(_0x1753bc,0xc9))[_0x1345('0x49')](handleError(_0x1753bc,null));};exports['update']=function(_0x49b8fc,_0x27fc27){if(_0x49b8fc[_0x1345('0x4b')]['id']){delete _0x49b8fc['body']['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x49b8fc[_0x1345('0x4c')]['id']}})[_0x1345('0x24')](handleEntityNotFound(_0x27fc27,null))['then'](saveUpdates(_0x49b8fc[_0x1345('0x4b')],null))[_0x1345('0x24')](respondWithResult(_0x27fc27,null))['catch'](handleError(_0x27fc27,null));};exports[_0x1345('0x25')]=function(_0x4ce41d,_0x34ea34){return db['FaxQueueReport'][_0x1345('0x48')]({'where':{'id':_0x4ce41d[_0x1345('0x4c')]['id']}})['then'](handleEntityNotFound(_0x34ea34,null))[_0x1345('0x24')](removeEntity(_0x34ea34,null))[_0x1345('0x49')](handleError(_0x34ea34,null));};exports['describe']=function(_0x573abe,_0x30428e){return db['FaxQueueReport'][_0x1345('0x4d')]()[_0x1345('0x24')](respondWithResult(_0x30428e,null))[_0x1345('0x49')](handleError(_0x30428e,null));}; \ No newline at end of file +var _0xfa12=['json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','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','../../config/license/util','sendStatus','status','end'];(function(_0x3f219e,_0x5c0d36){var _0x4e315d=function(_0x2e7581){while(--_0x2e7581){_0x3f219e['push'](_0x3f219e['shift']());}};_0x4e315d(++_0x5c0d36);}(_0xfa12,0x1b2));var _0x2fa1=function(_0x1bd1f1,_0x1ba8cd){_0x1bd1f1=_0x1bd1f1-0x0;var _0x43ba1f=_0xfa12[_0x1bd1f1];return _0x43ba1f;};'use strict';var emlformat=require(_0x2fa1('0x0'));var rimraf=require(_0x2fa1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2fa1('0x2'));var rp=require(_0x2fa1('0x3'));var moment=require(_0x2fa1('0x4'));var BPromise=require(_0x2fa1('0x5'));var Mustache=require('mustache');var util=require(_0x2fa1('0x6'));var path=require(_0x2fa1('0x7'));var sox=require(_0x2fa1('0x8'));var csv=require(_0x2fa1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2fa1('0xa'));var _=require(_0x2fa1('0xb'));var squel=require('squel');var crypto=require(_0x2fa1('0xc'));var jsforce=require(_0x2fa1('0xd'));var deskjs=require(_0x2fa1('0xe'));var toCsv=require(_0x2fa1('0x9'));var querystring=require('querystring');var Papa=require(_0x2fa1('0xf'));var Redis=require(_0x2fa1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2fa1('0x11'));var as=require(_0x2fa1('0x12'));var hardwareService=require(_0x2fa1('0x13'));var logger=require(_0x2fa1('0x14'))(_0x2fa1('0x15'));var utils=require(_0x2fa1('0x16'));var config=require(_0x2fa1('0x17'));var licenseUtil=require(_0x2fa1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x305bb3,_0x4198e1){_0x4198e1=_0x4198e1||0xcc;return function(_0x311441){if(_0x311441){return _0x305bb3[_0x2fa1('0x19')](_0x4198e1);}return _0x305bb3[_0x2fa1('0x1a')](_0x4198e1)[_0x2fa1('0x1b')]();};}function respondWithResult(_0x567bc5,_0xf81957){_0xf81957=_0xf81957||0xc8;return function(_0x409ea0){if(_0x409ea0){return _0x567bc5[_0x2fa1('0x1a')](_0xf81957)[_0x2fa1('0x1c')](_0x409ea0);}};}function respondWithFilteredResult(_0x5e7ed0,_0x3c79b6){return function(_0x3d6647){if(_0x3d6647){var _0x59aa4d=typeof _0x3c79b6[_0x2fa1('0x1d')]===_0x2fa1('0x1e')&&typeof _0x3c79b6[_0x2fa1('0x1f')]===_0x2fa1('0x1e');var _0xaf39c7=_0x3d6647[_0x2fa1('0x20')];var _0x21004a=_0x59aa4d?0x0:_0x3c79b6[_0x2fa1('0x1d')];var _0x4d16ac=_0x59aa4d?_0x3d6647[_0x2fa1('0x20')]:_0x3c79b6['offset']+_0x3c79b6['limit'];var _0x18d225;if(_0x4d16ac>=_0xaf39c7){_0x4d16ac=_0xaf39c7;_0x18d225=0xc8;}else{_0x18d225=0xce;}_0x5e7ed0[_0x2fa1('0x1a')](_0x18d225);return _0x5e7ed0[_0x2fa1('0x21')](_0x2fa1('0x22'),_0x21004a+'-'+_0x4d16ac+'/'+_0xaf39c7)[_0x2fa1('0x1c')](_0x3d6647);}return null;};}function patchUpdates(_0x5c451e){return function(_0x23f0d2){try{jsonpatch['apply'](_0x23f0d2,_0x5c451e,!![]);}catch(_0x22e15f){return BPromise[_0x2fa1('0x23')](_0x22e15f);}return _0x23f0d2[_0x2fa1('0x24')]();};}function saveUpdates(_0x245898,_0x24fe15){return function(_0x3fa70d){if(_0x3fa70d){return _0x3fa70d[_0x2fa1('0x25')](_0x245898)[_0x2fa1('0x26')](function(_0x2e95f0){return _0x2e95f0;});}return null;};}function removeEntity(_0x15037c,_0x5021fb){return function(_0x1eaa57){if(_0x1eaa57){return _0x1eaa57['destroy']()['then'](function(){_0x15037c['status'](0xcc)[_0x2fa1('0x1b')]();});}};}function handleEntityNotFound(_0x5c89fc,_0x4a152c){return function(_0x16a2b0){if(!_0x16a2b0){_0x5c89fc[_0x2fa1('0x19')](0x194);}return _0x16a2b0;};}function handleError(_0xa4be1b,_0x398c53){_0x398c53=_0x398c53||0x1f4;return function(_0x42cc71){logger[_0x2fa1('0x27')](_0x42cc71[_0x2fa1('0x28')]);if(_0x42cc71[_0x2fa1('0x29')]){delete _0x42cc71[_0x2fa1('0x29')];}_0xa4be1b[_0x2fa1('0x1a')](_0x398c53)[_0x2fa1('0x2a')](_0x42cc71);};}exports[_0x2fa1('0x2b')]=function(_0x16c050,_0x44856f){var _0x2a5dda={},_0xdb4308={},_0xd53b8={'count':0x0,'rows':[]};var _0x300970=_['map'](db[_0x2fa1('0x2c')][_0x2fa1('0x2d')],function(_0x4bf6b5){return{'name':_0x4bf6b5[_0x2fa1('0x2e')],'type':_0x4bf6b5[_0x2fa1('0x2f')][_0x2fa1('0x30')]};});_0xdb4308[_0x2fa1('0x31')]=_[_0x2fa1('0x32')](_0x300970,'name');_0xdb4308[_0x2fa1('0x33')]=_[_0x2fa1('0x34')](_0x16c050[_0x2fa1('0x33')]);_0xdb4308[_0x2fa1('0x35')]=_['intersection'](_0xdb4308[_0x2fa1('0x31')],_0xdb4308[_0x2fa1('0x33')]);_0x2a5dda['attributes']=_[_0x2fa1('0x36')](_0xdb4308['model'],qs[_0x2fa1('0x37')](_0x16c050[_0x2fa1('0x33')][_0x2fa1('0x37')]));_0x2a5dda[_0x2fa1('0x38')]=_0x2a5dda[_0x2fa1('0x38')][_0x2fa1('0x39')]?_0x2a5dda[_0x2fa1('0x38')]:_0xdb4308[_0x2fa1('0x31')];if(!_0x16c050['query'][_0x2fa1('0x3a')](_0x2fa1('0x3b'))){_0x2a5dda['limit']=qs[_0x2fa1('0x1f')](_0x16c050[_0x2fa1('0x33')][_0x2fa1('0x1f')]);_0x2a5dda[_0x2fa1('0x1d')]=qs[_0x2fa1('0x1d')](_0x16c050[_0x2fa1('0x33')][_0x2fa1('0x1d')]);}_0x2a5dda[_0x2fa1('0x3c')]=qs['sort'](_0x16c050['query']['sort']);_0x2a5dda[_0x2fa1('0x3d')]=qs[_0x2fa1('0x35')](_['pick'](_0x16c050['query'],_0xdb4308[_0x2fa1('0x35')]),_0x300970);if(_0x16c050['query'][_0x2fa1('0x3e')]){_0x2a5dda['where']=_[_0x2fa1('0x3f')](_0x2a5dda[_0x2fa1('0x3d')],{'$or':_[_0x2fa1('0x32')](_0x300970,function(_0x1b129a){if(_0x1b129a['type']!=='VIRTUAL'){var _0x15c7d7={};_0x15c7d7[_0x1b129a[_0x2fa1('0x29')]]={'$like':'%'+_0x16c050[_0x2fa1('0x33')][_0x2fa1('0x3e')]+'%'};return _0x15c7d7;}})});}_0x2a5dda=_[_0x2fa1('0x3f')]({},_0x2a5dda,_0x16c050[_0x2fa1('0x40')]);var _0xdc1506={'where':_0x2a5dda[_0x2fa1('0x3d')]};return db['FaxQueueReport'][_0x2fa1('0x20')](_0xdc1506)[_0x2fa1('0x26')](function(_0x549dff){_0xd53b8[_0x2fa1('0x20')]=_0x549dff;if(_0x16c050[_0x2fa1('0x33')][_0x2fa1('0x41')]){_0x2a5dda[_0x2fa1('0x42')]=[{'all':!![]}];}return db[_0x2fa1('0x2c')][_0x2fa1('0x43')](_0x2a5dda);})[_0x2fa1('0x26')](function(_0x5154b7){_0xd53b8[_0x2fa1('0x44')]=_0x5154b7;return _0xd53b8;})[_0x2fa1('0x26')](respondWithFilteredResult(_0x44856f,_0x2a5dda))[_0x2fa1('0x45')](handleError(_0x44856f,null));};exports[_0x2fa1('0x46')]=function(_0x587c9e,_0x2f4a0d){var _0x229026={'raw':!![],'where':{'id':_0x587c9e[_0x2fa1('0x47')]['id']}},_0x1180eb={};_0x1180eb['model']=_[_0x2fa1('0x34')](db[_0x2fa1('0x2c')][_0x2fa1('0x2d')]);_0x1180eb[_0x2fa1('0x33')]=_[_0x2fa1('0x34')](_0x587c9e[_0x2fa1('0x33')]);_0x1180eb[_0x2fa1('0x35')]=_[_0x2fa1('0x36')](_0x1180eb[_0x2fa1('0x31')],_0x1180eb[_0x2fa1('0x33')]);_0x229026['attributes']=_['intersection'](_0x1180eb['model'],qs[_0x2fa1('0x37')](_0x587c9e['query']['fields']));_0x229026['attributes']=_0x229026[_0x2fa1('0x38')][_0x2fa1('0x39')]?_0x229026[_0x2fa1('0x38')]:_0x1180eb[_0x2fa1('0x31')];if(_0x587c9e['query'][_0x2fa1('0x41')]){_0x229026[_0x2fa1('0x42')]=[{'all':!![]}];}_0x229026=_[_0x2fa1('0x3f')]({},_0x229026,_0x587c9e[_0x2fa1('0x40')]);return db[_0x2fa1('0x2c')][_0x2fa1('0x48')](_0x229026)[_0x2fa1('0x26')](handleEntityNotFound(_0x2f4a0d,null))[_0x2fa1('0x26')](respondWithResult(_0x2f4a0d,null))[_0x2fa1('0x45')](handleError(_0x2f4a0d,null));};exports[_0x2fa1('0x49')]=function(_0x5ab852,_0x34460a){return db[_0x2fa1('0x2c')][_0x2fa1('0x49')](_0x5ab852[_0x2fa1('0x4a')],{})[_0x2fa1('0x26')](respondWithResult(_0x34460a,0xc9))['catch'](handleError(_0x34460a,null));};exports[_0x2fa1('0x25')]=function(_0x2410e4,_0x1b8556){if(_0x2410e4[_0x2fa1('0x4a')]['id']){delete _0x2410e4['body']['id'];}return db['FaxQueueReport'][_0x2fa1('0x48')]({'where':{'id':_0x2410e4['params']['id']}})[_0x2fa1('0x26')](handleEntityNotFound(_0x1b8556,null))[_0x2fa1('0x26')](saveUpdates(_0x2410e4[_0x2fa1('0x4a')],null))[_0x2fa1('0x26')](respondWithResult(_0x1b8556,null))[_0x2fa1('0x45')](handleError(_0x1b8556,null));};exports[_0x2fa1('0x4b')]=function(_0x5198b1,_0x4d522f){return db['FaxQueueReport']['find']({'where':{'id':_0x5198b1['params']['id']}})[_0x2fa1('0x26')](handleEntityNotFound(_0x4d522f,null))[_0x2fa1('0x26')](removeEntity(_0x4d522f,null))[_0x2fa1('0x45')](handleError(_0x4d522f,null));};exports[_0x2fa1('0x4c')]=function(_0x31b9ab,_0x557cde){return db['FaxQueueReport']['describe']()[_0x2fa1('0x26')](respondWithResult(_0x557cde,null))[_0x2fa1('0x45')](handleError(_0x557cde,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index d3c646a..27b4b7d 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 _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger'];(function(_0x1dc539,_0x3658b8){var _0x1b7ffd=function(_0x2b3f3d){while(--_0x2b3f3d){_0x1dc539['push'](_0x1dc539['shift']());}};_0x1b7ffd(++_0x3658b8);}(_0x7217,0x19e));var _0x7721=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7217[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[{'name':_0x7721('0xc'),'fields':[_0x7721('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4816b2,_0x3e581e){var _0x4aa813=function(_0xbe5e11){while(--_0xbe5e11){_0x4816b2['push'](_0x4816b2['shift']());}};_0x4aa813(++_0x3e581e);}(_0x53ec,0x192));var _0xc53e=function(_0x548e1d,_0x3534d3){_0x548e1d=_0x548e1d-0x0;var _0x398584=_0x53ec[_0x548e1d];return _0x398584;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 1215597..88baedc 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 _0xbe16=['../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','UpdateFaxQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2149c1,_0x18a713){var _0x425f88=function(_0x665374){while(--_0x665374){_0x2149c1['push'](_0x2149c1['shift']());}};_0x425f88(++_0x18a713);}(_0xbe16,0x15f));var _0x6be1=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xbe16[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require(_0x6be1('0x0'));var util=require(_0x6be1('0x1'));var moment=require(_0x6be1('0x2'));var BPromise=require(_0x6be1('0x3'));var rs=require(_0x6be1('0x4'));var fs=require('fs');var Redis=require(_0x6be1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6be1('0x6'));var logger=require(_0x6be1('0x7'))(_0x6be1('0x8'));var config=require(_0x6be1('0x9'));var jayson=require(_0x6be1('0xa'));var client=jayson[_0x6be1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c8bc1,_0xfcb4da,_0x213398){return new BPromise(function(_0x449bde,_0x148141){return client[_0x6be1('0xc')](_0x3c8bc1,_0x213398)[_0x6be1('0xd')](function(_0xcbe900){logger[_0x6be1('0xe')](_0x6be1('0xf'),_0xfcb4da,_0x6be1('0x10'));logger[_0x6be1('0x11')](_0x6be1('0x12'),_0xfcb4da,'request\x20sent',JSON[_0x6be1('0x13')](_0xcbe900));if(_0xcbe900[_0x6be1('0x14')]){if(_0xcbe900['error'][_0x6be1('0x15')]===0x1f4){logger[_0x6be1('0x14')](_0x6be1('0xf'),_0xfcb4da,_0xcbe900['error']['message']);return _0x148141(_0xcbe900[_0x6be1('0x14')][_0x6be1('0x16')]);}logger[_0x6be1('0x14')](_0x6be1('0xf'),_0xfcb4da,_0xcbe900[_0x6be1('0x14')]['message']);return _0x449bde(_0xcbe900['error'][_0x6be1('0x16')]);}else{logger[_0x6be1('0xe')](_0x6be1('0xf'),_0xfcb4da,'request\x20sent');_0x449bde(_0xcbe900[_0x6be1('0x17')]['message']);}})[_0x6be1('0x18')](function(_0x1e9a01){logger[_0x6be1('0x14')](_0x6be1('0xf'),_0xfcb4da,_0x1e9a01);_0x148141(_0x1e9a01);});});}exports[_0x6be1('0x19')]=function(_0x4049d4){var _0x44409d=this;return new Promise(function(_0x546345,_0x22c4ed){return db[_0x6be1('0x1a')][_0x6be1('0x1b')](_0x4049d4['body'],{'raw':_0x4049d4[_0x6be1('0x1c')]?_0x4049d4[_0x6be1('0x1c')][_0x6be1('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x496983){logger[_0x6be1('0xe')]('CreateFaxQueueReport',_0x4049d4);logger[_0x6be1('0x11')]('CreateFaxQueueReport',_0x4049d4,JSON[_0x6be1('0x13')](_0x496983));_0x546345(_0x496983);})[_0x6be1('0x18')](function(_0x5cb8aa){logger['error'](_0x6be1('0x19'),_0x5cb8aa[_0x6be1('0x16')],_0x4049d4);_0x22c4ed(_0x44409d[_0x6be1('0x14')](0x1f4,_0x5cb8aa[_0x6be1('0x16')]));});});};exports[_0x6be1('0x1e')]=function(_0xa67320){var _0x129776=this;return new Promise(function(_0x1f71b3,_0x5739cf){return db[_0x6be1('0x1a')][_0x6be1('0x1f')](_0xa67320[_0x6be1('0x20')],{'raw':_0xa67320['options']?_0xa67320['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa67320[_0x6be1('0x1c')]?_0xa67320[_0x6be1('0x1c')][_0x6be1('0x21')]||null:null,'attributes':_0xa67320['options']?_0xa67320['options'][_0x6be1('0x22')]||null:null,'limit':_0xa67320[_0x6be1('0x1c')]?_0xa67320['options'][_0x6be1('0x23')]||null:null})[_0x6be1('0xd')](function(_0x39677f){logger[_0x6be1('0xe')]('UpdateFaxQueueReport',_0xa67320);logger[_0x6be1('0x11')]('UpdateFaxQueueReport',_0xa67320,JSON['stringify'](_0x39677f));_0x1f71b3(_0x39677f);})[_0x6be1('0x18')](function(_0x177254){logger[_0x6be1('0x14')](_0x6be1('0x1e'),_0x177254[_0x6be1('0x16')],_0xa67320);_0x5739cf(_0x129776['error'](0x1f4,_0x177254[_0x6be1('0x16')]));});});}; \ No newline at end of file +var _0x59ab=['../../config/environment','jayson/promise','http','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','create','options','then','FaxQueueReport','update','raw','where','attributes','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x20713e,_0x44f710){var _0x7d998b=function(_0x5d98ab){while(--_0x5d98ab){_0x20713e['push'](_0x20713e['shift']());}};_0x7d998b(++_0x44f710);}(_0x59ab,0x98));var _0xb59a=function(_0x44295a,_0x465c7a){_0x44295a=_0x44295a-0x0;var _0x4d60a8=_0x59ab[_0x44295a];return _0x4d60a8;};'use strict';var _=require(_0xb59a('0x0'));var util=require(_0xb59a('0x1'));var moment=require(_0xb59a('0x2'));var BPromise=require(_0xb59a('0x3'));var rs=require(_0xb59a('0x4'));var fs=require('fs');var Redis=require(_0xb59a('0x5'));var db=require(_0xb59a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb59a('0x7'))('rpc');var config=require(_0xb59a('0x8'));var jayson=require(_0xb59a('0x9'));var client=jayson['client'][_0xb59a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x188003,_0x4bd7af,_0x54ff24){return new BPromise(function(_0x3fabf2,_0x34a2b0){return client['request'](_0x188003,_0x54ff24)['then'](function(_0x27640c){logger[_0xb59a('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x4bd7af,_0xb59a('0xc'));logger[_0xb59a('0xd')](_0xb59a('0xe'),_0x4bd7af,'request\x20sent',JSON[_0xb59a('0xf')](_0x27640c));if(_0x27640c[_0xb59a('0x10')]){if(_0x27640c[_0xb59a('0x10')][_0xb59a('0x11')]===0x1f4){logger[_0xb59a('0x10')](_0xb59a('0x12'),_0x4bd7af,_0x27640c[_0xb59a('0x10')][_0xb59a('0x13')]);return _0x34a2b0(_0x27640c[_0xb59a('0x10')][_0xb59a('0x13')]);}logger[_0xb59a('0x10')](_0xb59a('0x12'),_0x4bd7af,_0x27640c['error']['message']);return _0x3fabf2(_0x27640c[_0xb59a('0x10')][_0xb59a('0x13')]);}else{logger[_0xb59a('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x4bd7af,'request\x20sent');_0x3fabf2(_0x27640c[_0xb59a('0x14')]['message']);}})[_0xb59a('0x15')](function(_0x5ceaac){logger[_0xb59a('0x10')](_0xb59a('0x12'),_0x4bd7af,_0x5ceaac);_0x34a2b0(_0x5ceaac);});});}exports[_0xb59a('0x16')]=function(_0x32ceff){var _0x4d1988=this;return new Promise(function(_0x2a08e8,_0x1e066e){return db['FaxQueueReport'][_0xb59a('0x17')](_0x32ceff['body'],{'raw':_0x32ceff[_0xb59a('0x18')]?_0x32ceff['options']['raw']===undefined?!![]:![]:!![]})[_0xb59a('0x19')](function(_0x4ffabc){logger['info']('CreateFaxQueueReport',_0x32ceff);logger['debug'](_0xb59a('0x16'),_0x32ceff,JSON[_0xb59a('0xf')](_0x4ffabc));_0x2a08e8(_0x4ffabc);})['catch'](function(_0x5987f7){logger['error'](_0xb59a('0x16'),_0x5987f7[_0xb59a('0x13')],_0x32ceff);_0x1e066e(_0x4d1988[_0xb59a('0x10')](0x1f4,_0x5987f7[_0xb59a('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x2572dd){var _0xd8e3dc=this;return new Promise(function(_0x233498,_0x1c504b){return db[_0xb59a('0x1a')][_0xb59a('0x1b')](_0x2572dd['body'],{'raw':_0x2572dd[_0xb59a('0x18')]?_0x2572dd[_0xb59a('0x18')][_0xb59a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2572dd[_0xb59a('0x18')]?_0x2572dd[_0xb59a('0x18')][_0xb59a('0x1d')]||null:null,'attributes':_0x2572dd[_0xb59a('0x18')]?_0x2572dd[_0xb59a('0x18')][_0xb59a('0x1e')]||null:null,'limit':_0x2572dd[_0xb59a('0x18')]?_0x2572dd[_0xb59a('0x18')]['limit']||null:null})[_0xb59a('0x19')](function(_0x4299c5){logger['info'](_0xb59a('0x1f'),_0x2572dd);logger['debug'](_0xb59a('0x1f'),_0x2572dd,JSON['stringify'](_0x4299c5));_0x233498(_0x4299c5);})[_0xb59a('0x15')](function(_0x1c21cd){logger[_0xb59a('0x10')](_0xb59a('0x1f'),_0x1c21cd[_0xb59a('0x13')],_0x2572dd);_0x1c504b(_0xd8e3dc[_0xb59a('0x10')](0x1f4,_0x1c21cd[_0xb59a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 80a3908..905d80a 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 _0xdeb1=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','destroy','exports','multer'];(function(_0x4677f0,_0x4be6be){var _0x12fdee=function(_0x535577){while(--_0x535577){_0x4677f0['push'](_0x4677f0['shift']());}};_0x12fdee(++_0x4be6be);}(_0xdeb1,0x153));var _0x1deb=function(_0x40bfea,_0x985435){_0x40bfea=_0x40bfea-0x0;var _0x3db147=_0xdeb1[_0x40bfea];return _0x3db147;};'use strict';var multer=require(_0x1deb('0x0'));var util=require(_0x1deb('0x1'));var path=require(_0x1deb('0x2'));var timeout=require(_0x1deb('0x3'));var express=require(_0x1deb('0x4'));var router=express[_0x1deb('0x5')]();var fs_extra=require(_0x1deb('0x6'));var auth=require(_0x1deb('0x7'));var interaction=require(_0x1deb('0x8'));var config=require(_0x1deb('0x9'));var controller=require('./faxQueueReport.controller');router[_0x1deb('0xa')]('/',auth[_0x1deb('0xb')](),controller[_0x1deb('0xc')]);router[_0x1deb('0xa')]('/describe',auth[_0x1deb('0xb')](),controller[_0x1deb('0xd')]);router[_0x1deb('0xa')](_0x1deb('0xe'),auth[_0x1deb('0xb')](),controller[_0x1deb('0xf')]);router[_0x1deb('0x10')]('/',auth[_0x1deb('0xb')](),controller[_0x1deb('0x11')]);router['put'](_0x1deb('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1deb('0xe'),auth['isAuthenticated'](),controller[_0x1deb('0x12')]);module[_0x1deb('0x13')]=router; \ No newline at end of file +var _0x6fd8=['Router','../../components/auth/service','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0x6fd8,0x10d));var _0x86fd=function(_0x1a8167,_0x4e57a4){_0x1a8167=_0x1a8167-0x0;var _0xe8197e=_0x6fd8[_0x1a8167];return _0xe8197e;};'use strict';var multer=require(_0x86fd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x86fd('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x86fd('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x86fd('0x3')]('/',auth[_0x86fd('0x4')](),controller[_0x86fd('0x5')]);router[_0x86fd('0x3')](_0x86fd('0x6'),auth[_0x86fd('0x4')](),controller['describe']);router[_0x86fd('0x3')](_0x86fd('0x7'),auth[_0x86fd('0x4')](),controller[_0x86fd('0x8')]);router[_0x86fd('0x9')]('/',auth['isAuthenticated'](),controller[_0x86fd('0xa')]);router[_0x86fd('0xb')]('/:id',auth[_0x86fd('0x4')](),controller['update']);router[_0x86fd('0xc')]('/:id',auth[_0x86fd('0x4')](),controller[_0x86fd('0xd')]);module[_0x86fd('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 4376038..6959d35 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x2aefb6,_0x1bd384){var _0x202772=function(_0x507d3f){while(--_0x507d3f){_0x2aefb6['push'](_0x2aefb6['shift']());}};_0x202772(++_0x1bd384);}(_0xb43b,0x1b2));var _0xbb43=function(_0x41ba4f,_0x4866d8){_0x41ba4f=_0x41ba4f-0x0;var _0x4f1c46=_0xb43b[_0x41ba4f];return _0x4f1c46;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x5c8aed,_0x3a3c35){var _0x5c2eb0=function(_0x56e067){while(--_0x56e067){_0x5c8aed['push'](_0x5c8aed['shift']());}};_0x5c2eb0(++_0x3a3c35);}(_0x70e0,0x17b));var _0x070e=function(_0x4d1694,_0x4bd1cb){_0x4d1694=_0x4d1694-0x0;var _0x187800=_0x70e0[_0x4d1694];return _0x187800;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 31524f9..08ee90b 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 _0x9c70=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','keys','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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','../../mysqldb','end','status','json','offset','limit','undefined','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','filters','query','attributes','intersection'];(function(_0x4c2747,_0x47b07c){var _0xbc9a73=function(_0xb8eb5e){while(--_0xb8eb5e){_0x4c2747['push'](_0x4c2747['shift']());}};_0xbc9a73(++_0x47b07c);}(_0x9c70,0x14a));var _0x09c7=function(_0x359fd3,_0x278add){_0x359fd3=_0x359fd3-0x0;var _0x257acd=_0x9c70[_0x359fd3];return _0x257acd;};'use strict';var emlformat=require(_0x09c7('0x0'));var rimraf=require(_0x09c7('0x1'));var zipdir=require(_0x09c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x09c7('0x3'));var moment=require(_0x09c7('0x4'));var BPromise=require(_0x09c7('0x5'));var Mustache=require(_0x09c7('0x6'));var util=require(_0x09c7('0x7'));var path=require('path');var sox=require(_0x09c7('0x8'));var csv=require(_0x09c7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09c7('0xa'));var _=require(_0x09c7('0xb'));var squel=require(_0x09c7('0xc'));var crypto=require(_0x09c7('0xd'));var jsforce=require(_0x09c7('0xe'));var deskjs=require(_0x09c7('0xf'));var toCsv=require(_0x09c7('0x9'));var querystring=require(_0x09c7('0x10'));var Papa=require(_0x09c7('0x11'));var Redis=require(_0x09c7('0x12'));var authService=require(_0x09c7('0x13'));var qs=require(_0x09c7('0x14'));var as=require(_0x09c7('0x15'));var hardwareService=require(_0x09c7('0x16'));var logger=require(_0x09c7('0x17'))(_0x09c7('0x18'));var utils=require(_0x09c7('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x09c7('0x1a'))['db'];function respondWithStatusCode(_0x109274,_0x3da6e9){_0x3da6e9=_0x3da6e9||0xcc;return function(_0x238e41){if(_0x238e41){return _0x109274['sendStatus'](_0x3da6e9);}return _0x109274['status'](_0x3da6e9)[_0x09c7('0x1b')]();};}function respondWithResult(_0x1c55ef,_0x2a83f5){_0x2a83f5=_0x2a83f5||0xc8;return function(_0x2cfb2f){if(_0x2cfb2f){return _0x1c55ef[_0x09c7('0x1c')](_0x2a83f5)[_0x09c7('0x1d')](_0x2cfb2f);}};}function respondWithFilteredResult(_0x39c458,_0xca0877){return function(_0x28d7c3){if(_0x28d7c3){var _0x50794b=typeof _0xca0877[_0x09c7('0x1e')]==='undefined'&&typeof _0xca0877[_0x09c7('0x1f')]===_0x09c7('0x20');var _0x438789=_0x28d7c3['count'];var _0x54384c=_0x50794b?0x0:_0xca0877[_0x09c7('0x1e')];var _0x281df1=_0x50794b?_0x28d7c3['count']:_0xca0877[_0x09c7('0x1e')]+_0xca0877[_0x09c7('0x1f')];var _0x1bed35;if(_0x281df1>=_0x438789){_0x281df1=_0x438789;_0x1bed35=0xc8;}else{_0x1bed35=0xce;}_0x39c458[_0x09c7('0x1c')](_0x1bed35);return _0x39c458['set'](_0x09c7('0x21'),_0x54384c+'-'+_0x281df1+'/'+_0x438789)[_0x09c7('0x1d')](_0x28d7c3);}return null;};}function patchUpdates(_0x35975c){return function(_0x42a799){try{jsonpatch['apply'](_0x42a799,_0x35975c,!![]);}catch(_0x37cf7b){return BPromise[_0x09c7('0x22')](_0x37cf7b);}return _0x42a799[_0x09c7('0x23')]();};}function saveUpdates(_0x19d79e,_0x318d57){return function(_0x194c82){if(_0x194c82){return _0x194c82[_0x09c7('0x24')](_0x19d79e)[_0x09c7('0x25')](function(_0xf28517){return _0xf28517;});}return null;};}function removeEntity(_0x1ab43a,_0x340641){return function(_0x3b1bd4){if(_0x3b1bd4){return _0x3b1bd4[_0x09c7('0x26')]()[_0x09c7('0x25')](function(){_0x1ab43a['status'](0xcc)[_0x09c7('0x1b')]();});}};}function handleEntityNotFound(_0x5c524c,_0x4e7326){return function(_0x1485ab){if(!_0x1485ab){_0x5c524c[_0x09c7('0x27')](0x194);}return _0x1485ab;};}function handleError(_0x31eb95,_0x571940){_0x571940=_0x571940||0x1f4;return function(_0x5c5cf3){logger['error'](_0x5c5cf3[_0x09c7('0x28')]);if(_0x5c5cf3[_0x09c7('0x29')]){delete _0x5c5cf3[_0x09c7('0x29')];}_0x31eb95[_0x09c7('0x1c')](_0x571940)[_0x09c7('0x2a')](_0x5c5cf3);};}exports[_0x09c7('0x2b')]=function(_0x4450c0,_0x1bd401){var _0x51a3d2={},_0x297497={},_0x26ff54={'count':0x0,'rows':[]};var _0x4773fa=_[_0x09c7('0x2c')](db[_0x09c7('0x2d')][_0x09c7('0x2e')],function(_0x43dc0b){return{'name':_0x43dc0b[_0x09c7('0x2f')],'type':_0x43dc0b[_0x09c7('0x30')][_0x09c7('0x31')]};});_0x297497[_0x09c7('0x32')]=_['map'](_0x4773fa,_0x09c7('0x29'));_0x297497['query']=_['keys'](_0x4450c0['query']);_0x297497[_0x09c7('0x33')]=_['intersection'](_0x297497[_0x09c7('0x32')],_0x297497[_0x09c7('0x34')]);_0x51a3d2[_0x09c7('0x35')]=_[_0x09c7('0x36')](_0x297497[_0x09c7('0x32')],qs['fields'](_0x4450c0[_0x09c7('0x34')][_0x09c7('0x37')]));_0x51a3d2['attributes']=_0x51a3d2[_0x09c7('0x35')][_0x09c7('0x38')]?_0x51a3d2[_0x09c7('0x35')]:_0x297497[_0x09c7('0x32')];if(!_0x4450c0[_0x09c7('0x34')][_0x09c7('0x39')](_0x09c7('0x3a'))){_0x51a3d2[_0x09c7('0x1f')]=qs[_0x09c7('0x1f')](_0x4450c0[_0x09c7('0x34')][_0x09c7('0x1f')]);_0x51a3d2[_0x09c7('0x1e')]=qs[_0x09c7('0x1e')](_0x4450c0['query']['offset']);}_0x51a3d2[_0x09c7('0x3b')]=qs['sort'](_0x4450c0['query'][_0x09c7('0x3c')]);_0x51a3d2[_0x09c7('0x3d')]=qs[_0x09c7('0x33')](_[_0x09c7('0x3e')](_0x4450c0[_0x09c7('0x34')],_0x297497[_0x09c7('0x33')]),_0x4773fa);if(_0x4450c0[_0x09c7('0x34')][_0x09c7('0x3f')]){_0x51a3d2[_0x09c7('0x3d')]=_[_0x09c7('0x40')](_0x51a3d2[_0x09c7('0x3d')],{'$or':_[_0x09c7('0x2c')](_0x4773fa,function(_0x42617e){if(_0x42617e[_0x09c7('0x30')]!=='VIRTUAL'){var _0x51126c={};_0x51126c[_0x42617e[_0x09c7('0x29')]]={'$like':'%'+_0x4450c0['query']['filter']+'%'};return _0x51126c;}})});}_0x51a3d2=_['merge']({},_0x51a3d2,_0x4450c0[_0x09c7('0x41')]);var _0x49a48f={'where':_0x51a3d2[_0x09c7('0x3d')]};return db[_0x09c7('0x2d')][_0x09c7('0x42')](_0x49a48f)[_0x09c7('0x25')](function(_0x5c641a){_0x26ff54[_0x09c7('0x42')]=_0x5c641a;if(_0x4450c0[_0x09c7('0x34')][_0x09c7('0x43')]){_0x51a3d2[_0x09c7('0x44')]=[{'all':!![]}];}return db[_0x09c7('0x2d')][_0x09c7('0x45')](_0x51a3d2);})[_0x09c7('0x25')](function(_0xd7f0af){_0x26ff54[_0x09c7('0x46')]=_0xd7f0af;return _0x26ff54;})[_0x09c7('0x25')](respondWithFilteredResult(_0x1bd401,_0x51a3d2))[_0x09c7('0x47')](handleError(_0x1bd401,null));};exports['show']=function(_0x178df5,_0x256110){var _0x170450={'raw':!![],'where':{'id':_0x178df5['params']['id']}},_0x50d663={};_0x50d663[_0x09c7('0x32')]=_[_0x09c7('0x48')](db[_0x09c7('0x2d')][_0x09c7('0x2e')]);_0x50d663[_0x09c7('0x34')]=_['keys'](_0x178df5[_0x09c7('0x34')]);_0x50d663[_0x09c7('0x33')]=_[_0x09c7('0x36')](_0x50d663[_0x09c7('0x32')],_0x50d663['query']);_0x170450[_0x09c7('0x35')]=_[_0x09c7('0x36')](_0x50d663[_0x09c7('0x32')],qs[_0x09c7('0x37')](_0x178df5[_0x09c7('0x34')][_0x09c7('0x37')]));_0x170450[_0x09c7('0x35')]=_0x170450[_0x09c7('0x35')][_0x09c7('0x38')]?_0x170450[_0x09c7('0x35')]:_0x50d663['model'];if(_0x178df5[_0x09c7('0x34')][_0x09c7('0x43')]){_0x170450['include']=[{'all':!![]}];}_0x170450=_[_0x09c7('0x40')]({},_0x170450,_0x178df5[_0x09c7('0x41')]);return db[_0x09c7('0x2d')][_0x09c7('0x49')](_0x170450)['then'](handleEntityNotFound(_0x256110,null))[_0x09c7('0x25')](respondWithResult(_0x256110,null))[_0x09c7('0x47')](handleError(_0x256110,null));};exports[_0x09c7('0x4a')]=function(_0x4fea85,_0x19f86a){return db['FaxTransferReport'][_0x09c7('0x4a')](_0x4fea85[_0x09c7('0x4b')],{})[_0x09c7('0x25')](respondWithResult(_0x19f86a,0xc9))[_0x09c7('0x47')](handleError(_0x19f86a,null));};exports[_0x09c7('0x24')]=function(_0x3d668a,_0x4a44bd){if(_0x3d668a[_0x09c7('0x4b')]['id']){delete _0x3d668a[_0x09c7('0x4b')]['id'];}return db[_0x09c7('0x2d')][_0x09c7('0x49')]({'where':{'id':_0x3d668a[_0x09c7('0x4c')]['id']}})[_0x09c7('0x25')](handleEntityNotFound(_0x4a44bd,null))['then'](saveUpdates(_0x3d668a[_0x09c7('0x4b')],null))['then'](respondWithResult(_0x4a44bd,null))[_0x09c7('0x47')](handleError(_0x4a44bd,null));};exports[_0x09c7('0x26')]=function(_0x27645a,_0x148085){return db['FaxTransferReport']['find']({'where':{'id':_0x27645a[_0x09c7('0x4c')]['id']}})[_0x09c7('0x25')](handleEntityNotFound(_0x148085,null))[_0x09c7('0x25')](removeEntity(_0x148085,null))[_0x09c7('0x47')](handleError(_0x148085,null));};exports['describe']=function(_0x39281,_0x3cc172){return db[_0x09c7('0x2d')]['describe']()[_0x09c7('0x25')](respondWithResult(_0x3cc172,null))[_0x09c7('0x47')](handleError(_0x3cc172,null));}; \ No newline at end of file +var _0x5c02=['filter','merge','VIRTUAL','include','rows','show','params','includeAll','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','update','then','destroy','sendStatus','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x31daf3,_0x234429){var _0x53295f=function(_0x1cbca0){while(--_0x1cbca0){_0x31daf3['push'](_0x31daf3['shift']());}};_0x53295f(++_0x234429);}(_0x5c02,0x13a));var _0x25c0=function(_0x263419,_0x2debdc){_0x263419=_0x263419-0x0;var _0x3ceed9=_0x5c02[_0x263419];return _0x3ceed9;};'use strict';var emlformat=require(_0x25c0('0x0'));var rimraf=require(_0x25c0('0x1'));var zipdir=require(_0x25c0('0x2'));var jsonpatch=require(_0x25c0('0x3'));var rp=require(_0x25c0('0x4'));var moment=require(_0x25c0('0x5'));var BPromise=require(_0x25c0('0x6'));var Mustache=require('mustache');var util=require(_0x25c0('0x7'));var path=require('path');var sox=require(_0x25c0('0x8'));var csv=require(_0x25c0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x25c0('0xa'));var squel=require(_0x25c0('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x25c0('0xc'));var toCsv=require(_0x25c0('0x9'));var querystring=require(_0x25c0('0xd'));var Papa=require(_0x25c0('0xe'));var Redis=require(_0x25c0('0xf'));var authService=require(_0x25c0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x25c0('0x11'));var hardwareService=require(_0x25c0('0x12'));var logger=require(_0x25c0('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x25c0('0x14'));var licenseUtil=require(_0x25c0('0x15'));var db=require(_0x25c0('0x16'))['db'];function respondWithStatusCode(_0x39db0f,_0x34b505){_0x34b505=_0x34b505||0xcc;return function(_0x572d1b){if(_0x572d1b){return _0x39db0f['sendStatus'](_0x34b505);}return _0x39db0f[_0x25c0('0x17')](_0x34b505)[_0x25c0('0x18')]();};}function respondWithResult(_0x4bc6b3,_0x316c7d){_0x316c7d=_0x316c7d||0xc8;return function(_0x492183){if(_0x492183){return _0x4bc6b3[_0x25c0('0x17')](_0x316c7d)['json'](_0x492183);}};}function respondWithFilteredResult(_0x1ecc27,_0xeb29d4){return function(_0x21b9ba){if(_0x21b9ba){var _0x19f03b=typeof _0xeb29d4['offset']==='undefined'&&typeof _0xeb29d4[_0x25c0('0x19')]===_0x25c0('0x1a');var _0x5341b6=_0x21b9ba[_0x25c0('0x1b')];var _0x2c98f0=_0x19f03b?0x0:_0xeb29d4[_0x25c0('0x1c')];var _0x3b9722=_0x19f03b?_0x21b9ba['count']:_0xeb29d4['offset']+_0xeb29d4[_0x25c0('0x19')];var _0x3e3507;if(_0x3b9722>=_0x5341b6){_0x3b9722=_0x5341b6;_0x3e3507=0xc8;}else{_0x3e3507=0xce;}_0x1ecc27['status'](_0x3e3507);return _0x1ecc27[_0x25c0('0x1d')](_0x25c0('0x1e'),_0x2c98f0+'-'+_0x3b9722+'/'+_0x5341b6)[_0x25c0('0x1f')](_0x21b9ba);}return null;};}function patchUpdates(_0x45ef56){return function(_0x2158df){try{jsonpatch['apply'](_0x2158df,_0x45ef56,!![]);}catch(_0x22cdac){return BPromise[_0x25c0('0x20')](_0x22cdac);}return _0x2158df['save']();};}function saveUpdates(_0x31eb8f,_0x35aff3){return function(_0x5c2232){if(_0x5c2232){return _0x5c2232[_0x25c0('0x21')](_0x31eb8f)[_0x25c0('0x22')](function(_0x264b0f){return _0x264b0f;});}return null;};}function removeEntity(_0x54415c,_0x4ccd90){return function(_0x173ec1){if(_0x173ec1){return _0x173ec1[_0x25c0('0x23')]()[_0x25c0('0x22')](function(){_0x54415c[_0x25c0('0x17')](0xcc)[_0x25c0('0x18')]();});}};}function handleEntityNotFound(_0x233390,_0x1625f4){return function(_0x30f951){if(!_0x30f951){_0x233390[_0x25c0('0x24')](0x194);}return _0x30f951;};}function handleError(_0x189edf,_0x54e6d6){_0x54e6d6=_0x54e6d6||0x1f4;return function(_0xf0e80e){logger['error'](_0xf0e80e[_0x25c0('0x25')]);if(_0xf0e80e[_0x25c0('0x26')]){delete _0xf0e80e[_0x25c0('0x26')];}_0x189edf[_0x25c0('0x17')](_0x54e6d6)[_0x25c0('0x27')](_0xf0e80e);};}exports[_0x25c0('0x28')]=function(_0x552a23,_0xd9c336){var _0x3cff0d={},_0xda4fb6={},_0x99664a={'count':0x0,'rows':[]};var _0x2e8f87=_[_0x25c0('0x29')](db[_0x25c0('0x2a')][_0x25c0('0x2b')],function(_0x36df96){return{'name':_0x36df96[_0x25c0('0x2c')],'type':_0x36df96[_0x25c0('0x2d')][_0x25c0('0x2e')]};});_0xda4fb6[_0x25c0('0x2f')]=_[_0x25c0('0x29')](_0x2e8f87,_0x25c0('0x26'));_0xda4fb6[_0x25c0('0x30')]=_[_0x25c0('0x31')](_0x552a23[_0x25c0('0x30')]);_0xda4fb6[_0x25c0('0x32')]=_[_0x25c0('0x33')](_0xda4fb6[_0x25c0('0x2f')],_0xda4fb6[_0x25c0('0x30')]);_0x3cff0d[_0x25c0('0x34')]=_[_0x25c0('0x33')](_0xda4fb6[_0x25c0('0x2f')],qs[_0x25c0('0x35')](_0x552a23['query'][_0x25c0('0x35')]));_0x3cff0d['attributes']=_0x3cff0d[_0x25c0('0x34')][_0x25c0('0x36')]?_0x3cff0d[_0x25c0('0x34')]:_0xda4fb6[_0x25c0('0x2f')];if(!_0x552a23[_0x25c0('0x30')][_0x25c0('0x37')](_0x25c0('0x38'))){_0x3cff0d[_0x25c0('0x19')]=qs[_0x25c0('0x19')](_0x552a23[_0x25c0('0x30')][_0x25c0('0x19')]);_0x3cff0d['offset']=qs[_0x25c0('0x1c')](_0x552a23[_0x25c0('0x30')][_0x25c0('0x1c')]);}_0x3cff0d[_0x25c0('0x39')]=qs[_0x25c0('0x3a')](_0x552a23[_0x25c0('0x30')]['sort']);_0x3cff0d[_0x25c0('0x3b')]=qs['filters'](_[_0x25c0('0x3c')](_0x552a23['query'],_0xda4fb6[_0x25c0('0x32')]),_0x2e8f87);if(_0x552a23[_0x25c0('0x30')][_0x25c0('0x3d')]){_0x3cff0d[_0x25c0('0x3b')]=_[_0x25c0('0x3e')](_0x3cff0d[_0x25c0('0x3b')],{'$or':_['map'](_0x2e8f87,function(_0x49f2be){if(_0x49f2be[_0x25c0('0x2d')]!==_0x25c0('0x3f')){var _0x10fd83={};_0x10fd83[_0x49f2be[_0x25c0('0x26')]]={'$like':'%'+_0x552a23[_0x25c0('0x30')][_0x25c0('0x3d')]+'%'};return _0x10fd83;}})});}_0x3cff0d=_[_0x25c0('0x3e')]({},_0x3cff0d,_0x552a23['options']);var _0x192f66={'where':_0x3cff0d['where']};return db[_0x25c0('0x2a')][_0x25c0('0x1b')](_0x192f66)[_0x25c0('0x22')](function(_0x5672d9){_0x99664a['count']=_0x5672d9;if(_0x552a23[_0x25c0('0x30')]['includeAll']){_0x3cff0d[_0x25c0('0x40')]=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x3cff0d);})[_0x25c0('0x22')](function(_0xf90593){_0x99664a[_0x25c0('0x41')]=_0xf90593;return _0x99664a;})[_0x25c0('0x22')](respondWithFilteredResult(_0xd9c336,_0x3cff0d))['catch'](handleError(_0xd9c336,null));};exports[_0x25c0('0x42')]=function(_0xa43eb6,_0x4164c2){var _0x217b0a={'raw':!![],'where':{'id':_0xa43eb6[_0x25c0('0x43')]['id']}},_0x13d323={};_0x13d323['model']=_[_0x25c0('0x31')](db[_0x25c0('0x2a')][_0x25c0('0x2b')]);_0x13d323[_0x25c0('0x30')]=_[_0x25c0('0x31')](_0xa43eb6[_0x25c0('0x30')]);_0x13d323['filters']=_[_0x25c0('0x33')](_0x13d323['model'],_0x13d323[_0x25c0('0x30')]);_0x217b0a[_0x25c0('0x34')]=_[_0x25c0('0x33')](_0x13d323[_0x25c0('0x2f')],qs[_0x25c0('0x35')](_0xa43eb6[_0x25c0('0x30')][_0x25c0('0x35')]));_0x217b0a[_0x25c0('0x34')]=_0x217b0a[_0x25c0('0x34')][_0x25c0('0x36')]?_0x217b0a[_0x25c0('0x34')]:_0x13d323[_0x25c0('0x2f')];if(_0xa43eb6[_0x25c0('0x30')][_0x25c0('0x44')]){_0x217b0a[_0x25c0('0x40')]=[{'all':!![]}];}_0x217b0a=_['merge']({},_0x217b0a,_0xa43eb6[_0x25c0('0x45')]);return db[_0x25c0('0x2a')][_0x25c0('0x46')](_0x217b0a)[_0x25c0('0x22')](handleEntityNotFound(_0x4164c2,null))[_0x25c0('0x22')](respondWithResult(_0x4164c2,null))[_0x25c0('0x47')](handleError(_0x4164c2,null));};exports['create']=function(_0x582102,_0x268362){return db[_0x25c0('0x2a')][_0x25c0('0x48')](_0x582102[_0x25c0('0x49')],{})[_0x25c0('0x22')](respondWithResult(_0x268362,0xc9))['catch'](handleError(_0x268362,null));};exports[_0x25c0('0x21')]=function(_0x466398,_0xd13c77){if(_0x466398[_0x25c0('0x49')]['id']){delete _0x466398[_0x25c0('0x49')]['id'];}return db[_0x25c0('0x2a')][_0x25c0('0x46')]({'where':{'id':_0x466398['params']['id']}})['then'](handleEntityNotFound(_0xd13c77,null))[_0x25c0('0x22')](saveUpdates(_0x466398[_0x25c0('0x49')],null))[_0x25c0('0x22')](respondWithResult(_0xd13c77,null))[_0x25c0('0x47')](handleError(_0xd13c77,null));};exports[_0x25c0('0x23')]=function(_0x2facfe,_0x29073b){return db[_0x25c0('0x2a')][_0x25c0('0x46')]({'where':{'id':_0x2facfe['params']['id']}})[_0x25c0('0x22')](handleEntityNotFound(_0x29073b,null))['then'](removeEntity(_0x29073b,null))['catch'](handleError(_0x29073b,null));};exports[_0x25c0('0x4a')]=function(_0x31b1a4,_0x55b51d){return db['FaxTransferReport'][_0x25c0('0x4a')]()['then'](respondWithResult(_0x55b51d,null))[_0x25c0('0x47')](handleError(_0x55b51d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index ddaa10c..dc921e1 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 _0x635b=['util','../../config/logger','moment','bluebird','request-promise','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x22a603,_0x26b623){var _0xc212e8=function(_0x3acdca){while(--_0x3acdca){_0x22a603['push'](_0x22a603['shift']());}};_0xc212e8(++_0x26b623);}(_0x635b,0x16a));var _0xb635=function(_0x54e59b,_0x17eeec){_0x54e59b=_0x54e59b-0x0;var _0x297e68=_0x635b[_0x54e59b];return _0x297e68;};'use strict';var _=require(_0xb635('0x0'));var util=require(_0xb635('0x1'));var logger=require(_0xb635('0x2'))('api');var moment=require(_0xb635('0x3'));var BPromise=require(_0xb635('0x4'));var rp=require(_0xb635('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb635('0x6'));module['exports']=function(_0x304add,_0x4d81c2){return _0x304add[_0xb635('0x7')](_0xb635('0x8'),attributes,{'tableName':_0xb635('0x9'),'paranoid':![],'indexes':[{'name':_0xb635('0xa'),'fields':[_0xb635('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb67f=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define'];(function(_0x2b9e6d,_0x5c54ce){var _0x4d9413=function(_0x189ba7){while(--_0x189ba7){_0x2b9e6d['push'](_0x2b9e6d['shift']());}};_0x4d9413(++_0x5c54ce);}(_0xb67f,0x12d));var _0xfb67=function(_0x2d4dd7,_0x739a55){_0x2d4dd7=_0x2d4dd7-0x0;var _0x14109f=_0xb67f[_0x2d4dd7];return _0x14109f;};'use strict';var _=require('lodash');var util=require(_0xfb67('0x0'));var logger=require(_0xfb67('0x1'))(_0xfb67('0x2'));var moment=require(_0xfb67('0x3'));var BPromise=require(_0xfb67('0x4'));var rp=require(_0xfb67('0x5'));var fs=require('fs');var path=require(_0xfb67('0x6'));var rimraf=require(_0xfb67('0x7'));var config=require('../../config/environment');var attributes=require(_0xfb67('0x8'));module[_0xfb67('0x9')]=function(_0x2dc6bf,_0x43bc06){return _0x2dc6bf[_0xfb67('0xa')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xfb67('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 2be2296..8dbd010 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 _0x6e3f=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1ecc91,_0x3e6d62){var _0x416a20=function(_0x35f52e){while(--_0x35f52e){_0x1ecc91['push'](_0x1ecc91['shift']());}};_0x416a20(++_0x3e6d62);}(_0x6e3f,0x1e7));var _0xf6e3=function(_0x30913a,_0x39f36b){_0x30913a=_0x30913a-0x0;var _0x19dc15=_0x6e3f[_0x30913a];return _0x19dc15;};'use strict';var _=require(_0xf6e3('0x0'));var util=require(_0xf6e3('0x1'));var moment=require(_0xf6e3('0x2'));var BPromise=require(_0xf6e3('0x3'));var rs=require(_0xf6e3('0x4'));var fs=require('fs');var Redis=require(_0xf6e3('0x5'));var db=require(_0xf6e3('0x6'))['db'];var utils=require(_0xf6e3('0x7'));var logger=require('../../config/logger')(_0xf6e3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf6e3('0x9')][_0xf6e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc2c6d2,_0x549852,_0x17c39e){return new BPromise(function(_0x48a8b0,_0x45eb59){return client['request'](_0xc2c6d2,_0x17c39e)[_0xf6e3('0xb')](function(_0x574d2d){logger[_0xf6e3('0xc')](_0xf6e3('0xd'),_0x549852,_0xf6e3('0xe'));logger['debug'](_0xf6e3('0xf'),_0x549852,_0xf6e3('0xe'),JSON[_0xf6e3('0x10')](_0x574d2d));if(_0x574d2d[_0xf6e3('0x11')]){if(_0x574d2d[_0xf6e3('0x11')]['code']===0x1f4){logger[_0xf6e3('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x549852,_0x574d2d[_0xf6e3('0x11')][_0xf6e3('0x12')]);return _0x45eb59(_0x574d2d[_0xf6e3('0x11')]['message']);}logger[_0xf6e3('0x11')](_0xf6e3('0xd'),_0x549852,_0x574d2d[_0xf6e3('0x11')]['message']);return _0x48a8b0(_0x574d2d[_0xf6e3('0x11')][_0xf6e3('0x12')]);}else{logger[_0xf6e3('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x549852,_0xf6e3('0xe'));_0x48a8b0(_0x574d2d[_0xf6e3('0x13')]['message']);}})[_0xf6e3('0x14')](function(_0xb2b77e){logger['error'](_0xf6e3('0xd'),_0x549852,_0xb2b77e);_0x45eb59(_0xb2b77e);});});} \ No newline at end of file +var _0x9521=['../../config/environment','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','bluebird','ioredis','rpc'];(function(_0x57a962,_0x847d7c){var _0x2aff26=function(_0x59b1e8){while(--_0x59b1e8){_0x57a962['push'](_0x57a962['shift']());}};_0x2aff26(++_0x847d7c);}(_0x9521,0x13f));var _0x1952=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x9521[_0x56f7e2];return _0x36240b;};'use strict';var _=require(_0x1952('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1952('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1952('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1952('0x3'));var config=require(_0x1952('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x1952('0x5')][_0x1952('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x204d0d,_0x1e4bb9,_0x23bb9f){return new BPromise(function(_0x4ec920,_0x1b94ae){return client[_0x1952('0x7')](_0x204d0d,_0x23bb9f)[_0x1952('0x8')](function(_0x998b44){logger[_0x1952('0x9')](_0x1952('0xa'),_0x1e4bb9,_0x1952('0xb'));logger['debug'](_0x1952('0xc'),_0x1e4bb9,_0x1952('0xb'),JSON[_0x1952('0xd')](_0x998b44));if(_0x998b44['error']){if(_0x998b44[_0x1952('0xe')]['code']===0x1f4){logger[_0x1952('0xe')](_0x1952('0xa'),_0x1e4bb9,_0x998b44[_0x1952('0xe')]['message']);return _0x1b94ae(_0x998b44[_0x1952('0xe')][_0x1952('0xf')]);}logger[_0x1952('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x1e4bb9,_0x998b44[_0x1952('0xe')][_0x1952('0xf')]);return _0x4ec920(_0x998b44[_0x1952('0xe')][_0x1952('0xf')]);}else{logger[_0x1952('0x9')]('FaxTransferReport,\x20%s,\x20%s',_0x1e4bb9,_0x1952('0xb'));_0x4ec920(_0x998b44['result'][_0x1952('0xf')]);}})[_0x1952('0x10')](function(_0x2041a9){logger[_0x1952('0xe')](_0x1952('0xa'),_0x1e4bb9,_0x2041a9);_0x1b94ae(_0x2041a9);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index e17a57a..3dd7878 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 _0x3b98=['./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x8a8d3d,_0x1091e4){var _0x4a8118=function(_0x1dc94c){while(--_0x1dc94c){_0x8a8d3d['push'](_0x8a8d3d['shift']());}};_0x4a8118(++_0x1091e4);}(_0x3b98,0x14a));var _0x83b9=function(_0x296ade,_0x46205a){_0x296ade=_0x296ade-0x0;var _0x264040=_0x3b98[_0x296ade];return _0x264040;};'use strict';var multer=require(_0x83b9('0x0'));var util=require(_0x83b9('0x1'));var path=require(_0x83b9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x83b9('0x3'));var interaction=require(_0x83b9('0x4'));var config=require(_0x83b9('0x5'));var controller=require(_0x83b9('0x6'));router[_0x83b9('0x7')]('/',auth[_0x83b9('0x8')](),controller[_0x83b9('0x9')]);router[_0x83b9('0x7')](_0x83b9('0xa'),auth[_0x83b9('0x8')](),controller[_0x83b9('0xb')]);router['get'](_0x83b9('0xc'),auth[_0x83b9('0x8')](),controller[_0x83b9('0xd')]);router[_0x83b9('0xe')]('/',auth[_0x83b9('0x8')](),controller[_0x83b9('0xf')]);router[_0x83b9('0x10')](_0x83b9('0xc'),auth[_0x83b9('0x8')](),controller[_0x83b9('0x11')]);router[_0x83b9('0x12')]('/:id',auth[_0x83b9('0x8')](),controller[_0x83b9('0x13')]);module[_0x83b9('0x14')]=router; \ No newline at end of file +var _0x18d2=['describe','get','/:id','show','post','create','put','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','/describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x18d2,0x1ad));var _0x218d=function(_0x20db6b,_0x2aa394){_0x20db6b=_0x20db6b-0x0;var _0x4846d8=_0x18d2[_0x20db6b];return _0x4846d8;};'use strict';var multer=require('multer');var util=require(_0x218d('0x0'));var path=require('path');var timeout=require(_0x218d('0x1'));var express=require(_0x218d('0x2'));var router=express[_0x218d('0x3')]();var fs_extra=require(_0x218d('0x4'));var auth=require(_0x218d('0x5'));var interaction=require(_0x218d('0x6'));var config=require(_0x218d('0x7'));var controller=require(_0x218d('0x8'));router['get']('/',auth[_0x218d('0x9')](),controller[_0x218d('0xa')]);router['get'](_0x218d('0xb'),auth['isAuthenticated'](),controller[_0x218d('0xc')]);router[_0x218d('0xd')](_0x218d('0xe'),auth[_0x218d('0x9')](),controller[_0x218d('0xf')]);router[_0x218d('0x10')]('/',auth[_0x218d('0x9')](),controller[_0x218d('0x11')]);router[_0x218d('0x12')](_0x218d('0xe'),auth[_0x218d('0x9')](),controller['update']);router[_0x218d('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x218d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 2424ebd..ad6ab13 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 _0xadeb=['../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','get','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x3a5541,_0x34dc2e){var _0x549d59=function(_0x246401){while(--_0x246401){_0x3a5541['push'](_0x3a5541['shift']());}};_0x549d59(++_0x34dc2e);}(_0xadeb,0x14a));var _0xbade=function(_0x2cd9bc,_0x531c5b){_0x2cd9bc=_0x2cd9bc-0x0;var _0x2c6fe3=_0xadeb[_0x2cd9bc];return _0x2c6fe3;};'use strict';var multer=require(_0xbade('0x0'));var util=require(_0xbade('0x1'));var path=require(_0xbade('0x2'));var timeout=require(_0xbade('0x3'));var express=require('express');var router=express[_0xbade('0x4')]();var fs_extra=require(_0xbade('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbade('0x6'));var config=require(_0xbade('0x7'));var controller=require(_0xbade('0x8'));router['get']('/',auth[_0xbade('0x9')](),controller['index']);router[_0xbade('0xa')]('/:id',auth[_0xbade('0x9')](),controller[_0xbade('0xb')]);router[_0xbade('0xa')]('/:id/configurations',auth[_0xbade('0x9')](),controller[_0xbade('0xc')]);router[_0xbade('0xa')](_0xbade('0xd'),auth['isAuthenticated'](),controller[_0xbade('0xe')]);router[_0xbade('0xf')]('/',auth[_0xbade('0x9')](),controller[_0xbade('0x10')]);router[_0xbade('0xf')](_0xbade('0x11'),auth[_0xbade('0x9')](),controller[_0xbade('0x12')]);router[_0xbade('0x13')](_0xbade('0x14'),auth['isAuthenticated'](),controller['update']);router[_0xbade('0x15')](_0xbade('0x14'),auth[_0xbade('0x9')](),controller[_0xbade('0x16')]);module[_0xbade('0x17')]=router; \ No newline at end of file +var _0xd472=['/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x2a4412,_0x314034){var _0x36f71e=function(_0x3dd386){while(--_0x3dd386){_0x2a4412['push'](_0x2a4412['shift']());}};_0x36f71e(++_0x314034);}(_0xd472,0x1eb));var _0x2d47=function(_0x4826ca,_0x29aab0){_0x4826ca=_0x4826ca-0x0;var _0x1f3f38=_0xd472[_0x4826ca];return _0x1f3f38;};'use strict';var multer=require(_0x2d47('0x0'));var util=require(_0x2d47('0x1'));var path=require(_0x2d47('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d47('0x3'));var router=express[_0x2d47('0x4')]();var fs_extra=require(_0x2d47('0x5'));var auth=require(_0x2d47('0x6'));var interaction=require(_0x2d47('0x7'));var config=require(_0x2d47('0x8'));var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0x2d47('0x9')](),controller[_0x2d47('0xa')]);router[_0x2d47('0xb')](_0x2d47('0xc'),auth[_0x2d47('0x9')](),controller['show']);router[_0x2d47('0xb')](_0x2d47('0xd'),auth[_0x2d47('0x9')](),controller['getConfigurations']);router['get'](_0x2d47('0xe'),auth[_0x2d47('0x9')](),controller[_0x2d47('0xf')]);router[_0x2d47('0x10')]('/',auth['isAuthenticated'](),controller[_0x2d47('0x11')]);router[_0x2d47('0x10')](_0x2d47('0xd'),auth[_0x2d47('0x9')](),controller[_0x2d47('0x12')]);router[_0x2d47('0x13')](_0x2d47('0xc'),auth[_0x2d47('0x9')](),controller[_0x2d47('0x14')]);router[_0x2d47('0x15')](_0x2d47('0xc'),auth[_0x2d47('0x9')](),controller[_0x2d47('0x16')]);module[_0x2d47('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 59459bc..6cf62c9 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 _0x7375=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0xa662bd,_0x496f73){var _0x5c14b9=function(_0x2477dd){while(--_0x2477dd){_0xa662bd['push'](_0xa662bd['shift']());}};_0x5c14b9(++_0x496f73);}(_0x7375,0x1e5));var _0x5737=function(_0x207411,_0x510818){_0x207411=_0x207411-0x0;var _0x421e8d=_0x7375[_0x207411];return _0x421e8d;};'use strict';var Sequelize=require(_0x5737('0x0'));module[_0x5737('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5737('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5737('0x2')]},'authType':{'type':Sequelize[_0x5737('0x3')](_0x5737('0x4')),'defaultValue':_0x5737('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x5737('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x5737('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5737('0x3')](_0x5737('0x5'),_0x5737('0x6')),'defaultValue':_0x5737('0x5')}}; \ No newline at end of file +var _0x04f8=['integrationTab','exports','STRING','ENUM','basic'];(function(_0x50b2c9,_0x2758a8){var _0x20ae2e=function(_0x31ea5d){while(--_0x31ea5d){_0x50b2c9['push'](_0x50b2c9['shift']());}};_0x20ae2e(++_0x2758a8);}(_0x04f8,0x10f));var _0x804f=function(_0x837a6,_0x1988f6){_0x837a6=_0x837a6-0x0;var _0xea149f=_0x04f8[_0x837a6];return _0xea149f;};'use strict';var Sequelize=require('sequelize');module[_0x804f('0x0')]={'name':{'type':Sequelize[_0x804f('0x1')]},'description':{'type':Sequelize[_0x804f('0x1')]},'username':{'type':Sequelize[_0x804f('0x1')]},'remoteUri':{'type':Sequelize[_0x804f('0x1')]},'authType':{'type':Sequelize[_0x804f('0x2')](_0x804f('0x3')),'defaultValue':_0x804f('0x3')},'password':{'type':Sequelize[_0x804f('0x1')]},'consumerKey':{'type':Sequelize[_0x804f('0x1')]},'consumerSecret':{'type':Sequelize[_0x804f('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x804f('0x1')]},'serverUrl':{'type':Sequelize[_0x804f('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':_0x804f('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 75fe3ea..3d44f50 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 _0xe14a=['apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','options','DeskAccount','include','findAll','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','DeskConfiguration','filter','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','DeskField','Descriptions','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','mustache','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/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x5d14d7,_0x3ffae7){var _0xf6f560=function(_0x2225c0){while(--_0x2225c0){_0x5d14d7['push'](_0x5d14d7['shift']());}};_0xf6f560(++_0x3ffae7);}(_0xe14a,0x1ab));var _0xae14=function(_0x5d7b51,_0x5f2fe8){_0x5d7b51=_0x5d7b51-0x0;var _0x53b03e=_0xe14a[_0x5d7b51];return _0x53b03e;};'use strict';var emlformat=require(_0xae14('0x0'));var rimraf=require(_0xae14('0x1'));var zipdir=require(_0xae14('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xae14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xae14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xae14('0x5'));var csv=require(_0xae14('0x6'));var ejs=require(_0xae14('0x7'));var fs=require('fs');var fs_extra=require(_0xae14('0x8'));var _=require(_0xae14('0x9'));var squel=require(_0xae14('0xa'));var crypto=require(_0xae14('0xb'));var jsforce=require(_0xae14('0xc'));var deskjs=require(_0xae14('0xd'));var toCsv=require(_0xae14('0x6'));var querystring=require(_0xae14('0xe'));var Papa=require(_0xae14('0xf'));var Redis=require('ioredis');var authService=require(_0xae14('0x10'));var qs=require(_0xae14('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae14('0x12'));var logger=require(_0xae14('0x13'))(_0xae14('0x14'));var utils=require('../../config/utils');var config=require(_0xae14('0x15'));var licenseUtil=require(_0xae14('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3e770c,_0x247f90){_0x247f90=_0x247f90||0xcc;return function(_0x529a01){if(_0x529a01){return _0x3e770c[_0xae14('0x17')](_0x247f90);}return _0x3e770c[_0xae14('0x18')](_0x247f90)[_0xae14('0x19')]();};}function respondWithResult(_0x5191b2,_0x1d857f){_0x1d857f=_0x1d857f||0xc8;return function(_0x179611){if(_0x179611){return _0x5191b2[_0xae14('0x18')](_0x1d857f)[_0xae14('0x1a')](_0x179611);}};}function respondWithFilteredResult(_0x5724a4,_0x285b56){return function(_0x2cd10a){if(_0x2cd10a){var _0xa0920a=typeof _0x285b56[_0xae14('0x1b')]===_0xae14('0x1c')&&typeof _0x285b56[_0xae14('0x1d')]==='undefined';var _0x2faca8=_0x2cd10a[_0xae14('0x1e')];var _0x32e84c=_0xa0920a?0x0:_0x285b56[_0xae14('0x1b')];var _0x439df6=_0xa0920a?_0x2cd10a[_0xae14('0x1e')]:_0x285b56[_0xae14('0x1b')]+_0x285b56[_0xae14('0x1d')];var _0x19e562;if(_0x439df6>=_0x2faca8){_0x439df6=_0x2faca8;_0x19e562=0xc8;}else{_0x19e562=0xce;}_0x5724a4['status'](_0x19e562);return _0x5724a4[_0xae14('0x1f')](_0xae14('0x20'),_0x32e84c+'-'+_0x439df6+'/'+_0x2faca8)[_0xae14('0x1a')](_0x2cd10a);}return null;};}function patchUpdates(_0x392ec5){return function(_0x2f897b){try{jsonpatch[_0xae14('0x21')](_0x2f897b,_0x392ec5,!![]);}catch(_0x4893c1){return BPromise['reject'](_0x4893c1);}return _0x2f897b[_0xae14('0x22')]();};}function saveUpdates(_0x30687e,_0x36ec75){return function(_0x1486ce){if(_0x1486ce){return _0x1486ce[_0xae14('0x23')](_0x30687e)[_0xae14('0x24')](function(_0x259bdf){return _0x259bdf;});}return null;};}function removeEntity(_0x396d2d,_0x3b7f1d){return function(_0x4db30d){if(_0x4db30d){return _0x4db30d[_0xae14('0x25')]()[_0xae14('0x24')](function(){_0x396d2d[_0xae14('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c29f1,_0x4894d0){return function(_0x374c71){if(!_0x374c71){_0x3c29f1['sendStatus'](0x194);}return _0x374c71;};}function handleError(_0x22b2e7,_0x410428){_0x410428=_0x410428||0x1f4;return function(_0x4ed963){logger[_0xae14('0x26')](_0x4ed963[_0xae14('0x27')]);if(_0x4ed963[_0xae14('0x28')]){delete _0x4ed963['name'];}_0x22b2e7[_0xae14('0x18')](_0x410428)[_0xae14('0x29')](_0x4ed963);};}exports[_0xae14('0x2a')]=function(_0x3ae78b,_0x8c1cfd){var _0x2dd041={},_0x2b86ef={},_0x47c697={'count':0x0,'rows':[]};var _0x591c7c=_[_0xae14('0x2b')](db['DeskAccount'][_0xae14('0x2c')],function(_0x48c530){return{'name':_0x48c530['fieldName'],'type':_0x48c530[_0xae14('0x2d')][_0xae14('0x2e')]};});_0x2b86ef[_0xae14('0x2f')]=_[_0xae14('0x2b')](_0x591c7c,'name');_0x2b86ef[_0xae14('0x30')]=_[_0xae14('0x31')](_0x3ae78b[_0xae14('0x30')]);_0x2b86ef[_0xae14('0x32')]=_['intersection'](_0x2b86ef[_0xae14('0x2f')],_0x2b86ef[_0xae14('0x30')]);_0x2dd041[_0xae14('0x33')]=_[_0xae14('0x34')](_0x2b86ef[_0xae14('0x2f')],qs[_0xae14('0x35')](_0x3ae78b['query'][_0xae14('0x35')]));_0x2dd041[_0xae14('0x33')]=_0x2dd041[_0xae14('0x33')][_0xae14('0x36')]?_0x2dd041['attributes']:_0x2b86ef[_0xae14('0x2f')];if(!_0x3ae78b[_0xae14('0x30')]['hasOwnProperty'](_0xae14('0x37'))){_0x2dd041[_0xae14('0x1d')]=qs['limit'](_0x3ae78b[_0xae14('0x30')][_0xae14('0x1d')]);_0x2dd041[_0xae14('0x1b')]=qs['offset'](_0x3ae78b[_0xae14('0x30')]['offset']);}_0x2dd041[_0xae14('0x38')]=qs[_0xae14('0x39')](_0x3ae78b[_0xae14('0x30')]['sort']);_0x2dd041[_0xae14('0x3a')]=qs[_0xae14('0x32')](_[_0xae14('0x3b')](_0x3ae78b[_0xae14('0x30')],_0x2b86ef[_0xae14('0x32')]),_0x591c7c);if(_0x3ae78b[_0xae14('0x30')]['filter']){_0x2dd041[_0xae14('0x3a')]=_[_0xae14('0x3c')](_0x2dd041[_0xae14('0x3a')],{'$or':_[_0xae14('0x2b')](_0x591c7c,function(_0x3c73eb){if(_0x3c73eb[_0xae14('0x2d')]!=='VIRTUAL'){var _0x371ccd={};_0x371ccd[_0x3c73eb[_0xae14('0x28')]]={'$like':'%'+_0x3ae78b['query']['filter']+'%'};return _0x371ccd;}})});}_0x2dd041=_[_0xae14('0x3c')]({},_0x2dd041,_0x3ae78b[_0xae14('0x3d')]);var _0x492325={'where':_0x2dd041[_0xae14('0x3a')]};return db[_0xae14('0x3e')][_0xae14('0x1e')](_0x492325)['then'](function(_0x48123e){_0x47c697[_0xae14('0x1e')]=_0x48123e;if(_0x3ae78b['query']['includeAll']){_0x2dd041[_0xae14('0x3f')]=[{'all':!![]}];}return db[_0xae14('0x3e')][_0xae14('0x40')](_0x2dd041);})[_0xae14('0x24')](function(_0xeb96d1){_0x47c697['rows']=_0xeb96d1;return _0x47c697;})[_0xae14('0x24')](respondWithFilteredResult(_0x8c1cfd,_0x2dd041))[_0xae14('0x41')](handleError(_0x8c1cfd,null));};exports[_0xae14('0x42')]=function(_0x42c5ca,_0x17c044){var _0x53a489={'raw':![],'where':{'id':_0x42c5ca[_0xae14('0x43')]['id']}},_0x5c9ac3={};_0x5c9ac3[_0xae14('0x2f')]=_[_0xae14('0x31')](db['DeskAccount']['rawAttributes']);_0x5c9ac3[_0xae14('0x30')]=_[_0xae14('0x31')](_0x42c5ca[_0xae14('0x30')]);_0x5c9ac3[_0xae14('0x32')]=_[_0xae14('0x34')](_0x5c9ac3[_0xae14('0x2f')],_0x5c9ac3[_0xae14('0x30')]);_0x53a489[_0xae14('0x33')]=_['intersection'](_0x5c9ac3[_0xae14('0x2f')],qs[_0xae14('0x35')](_0x42c5ca['query'][_0xae14('0x35')]));_0x53a489[_0xae14('0x33')]=_0x53a489['attributes'][_0xae14('0x36')]?_0x53a489[_0xae14('0x33')]:_0x5c9ac3['model'];if(_0x42c5ca[_0xae14('0x30')][_0xae14('0x44')]){_0x53a489[_0xae14('0x3f')]=[{'all':!![]}];}_0x53a489=_[_0xae14('0x3c')]({},_0x53a489,_0x42c5ca[_0xae14('0x3d')]);return db[_0xae14('0x3e')][_0xae14('0x45')](_0x53a489)[_0xae14('0x24')](handleEntityNotFound(_0x17c044,null))[_0xae14('0x24')](respondWithResult(_0x17c044,null))[_0xae14('0x41')](handleError(_0x17c044,null));};exports['create']=function(_0x4cd19b,_0x3dedab){return db[_0xae14('0x3e')][_0xae14('0x46')](_0x4cd19b[_0xae14('0x47')],{})[_0xae14('0x24')](respondWithResult(_0x3dedab,0xc9))[_0xae14('0x41')](handleError(_0x3dedab,null));};exports[_0xae14('0x23')]=function(_0x26f7a1,_0x56a905){if(_0x26f7a1['body']['id']){delete _0x26f7a1['body']['id'];}return db[_0xae14('0x3e')][_0xae14('0x45')]({'where':{'id':_0x26f7a1['params']['id']}})[_0xae14('0x24')](handleEntityNotFound(_0x56a905,null))['then'](saveUpdates(_0x26f7a1['body'],null))[_0xae14('0x24')](respondWithResult(_0x56a905,null))[_0xae14('0x41')](handleError(_0x56a905,null));};exports[_0xae14('0x25')]=function(_0x287dfa,_0x37edbb){return db[_0xae14('0x3e')][_0xae14('0x45')]({'where':{'id':_0x287dfa[_0xae14('0x43')]['id']}})[_0xae14('0x24')](handleEntityNotFound(_0x37edbb,null))[_0xae14('0x24')](removeEntity(_0x37edbb,null))['catch'](handleError(_0x37edbb,null));};exports[_0xae14('0x48')]=function(_0x4d9649,_0x12ba29,_0x1d2102){var _0x37a5e3={};var _0x4f0273={};var _0x44a81d;var _0x527c57;return db[_0xae14('0x3e')][_0xae14('0x49')]({'where':{'id':_0x4d9649[_0xae14('0x43')]['id']}})[_0xae14('0x24')](handleEntityNotFound(_0x12ba29,null))['then'](function(_0x2bc73d){if(_0x2bc73d){_0x44a81d=_0x2bc73d;_0x4f0273['model']=_[_0xae14('0x31')](db[_0xae14('0x4a')]['rawAttributes']);_0x4f0273[_0xae14('0x30')]=_['keys'](_0x4d9649[_0xae14('0x30')]);_0x4f0273[_0xae14('0x32')]=_[_0xae14('0x34')](_0x4f0273[_0xae14('0x2f')],_0x4f0273[_0xae14('0x30')]);_0x37a5e3[_0xae14('0x33')]=_[_0xae14('0x34')](_0x4f0273[_0xae14('0x2f')],qs[_0xae14('0x35')](_0x4d9649[_0xae14('0x30')][_0xae14('0x35')]));_0x37a5e3[_0xae14('0x33')]=_0x37a5e3[_0xae14('0x33')][_0xae14('0x36')]?_0x37a5e3[_0xae14('0x33')]:_0x4f0273[_0xae14('0x2f')];_0x37a5e3[_0xae14('0x38')]=qs[_0xae14('0x39')](_0x4d9649[_0xae14('0x30')][_0xae14('0x39')]);_0x37a5e3[_0xae14('0x3a')]=qs['filters'](_['pick'](_0x4d9649[_0xae14('0x30')],_0x4f0273[_0xae14('0x32')]));if(_0x4d9649[_0xae14('0x30')][_0xae14('0x4b')]){_0x37a5e3[_0xae14('0x3a')]=_[_0xae14('0x3c')](_0x37a5e3[_0xae14('0x3a')],{'$or':_[_0xae14('0x2b')](_0x37a5e3[_0xae14('0x33')],function(_0xa1055d){var _0x2c3ae0={};_0x2c3ae0[_0xa1055d]={'$like':'%'+_0x4d9649[_0xae14('0x30')]['filter']+'%'};return _0x2c3ae0;})});}_0x37a5e3=_[_0xae14('0x3c')]({},_0x37a5e3,_0x4d9649['options']);return _0x44a81d[_0xae14('0x48')](_0x37a5e3);}})[_0xae14('0x24')](function(_0x126569){if(_0x126569){_0x527c57=_0x126569[_0xae14('0x36')];if(!_0x4d9649['query'][_0xae14('0x4c')](_0xae14('0x37'))){_0x37a5e3[_0xae14('0x1d')]=qs[_0xae14('0x1d')](_0x4d9649[_0xae14('0x30')][_0xae14('0x1d')]);_0x37a5e3[_0xae14('0x1b')]=qs[_0xae14('0x1b')](_0x4d9649[_0xae14('0x30')][_0xae14('0x1b')]);}return _0x44a81d[_0xae14('0x48')](_0x37a5e3);}})[_0xae14('0x24')](function(_0x5c100c){if(_0x5c100c){return _0x5c100c?{'count':_0x527c57,'rows':_0x5c100c}:null;}})['then'](respondWithResult(_0x12ba29,null))['catch'](handleError(_0x12ba29,null));};exports[_0xae14('0x4d')]=function(_0x1a1b2d,_0x2dd024,_0x5d7ac7){if(_0x1a1b2d[_0xae14('0x47')]['id']){delete _0x1a1b2d['body']['id'];}return db['DeskAccount'][_0xae14('0x49')]({'where':{'id':_0x1a1b2d[_0xae14('0x43')]['id']}})[_0xae14('0x24')](handleEntityNotFound(_0x2dd024,null))[_0xae14('0x24')](function(_0x1961aa){if(_0x1961aa){_0x1a1b2d[_0xae14('0x47')][_0xae14('0x4e')]=_0x1961aa['id'];_0x1a1b2d['body'][_0xae14('0x4f')]=integrations[_0xae14('0x50')](_0x1a1b2d[_0xae14('0x47')]['channel'],_0x1a1b2d['body'][_0xae14('0x2d')]);_0x1a1b2d[_0xae14('0x47')]['Descriptions']=integrations[_0xae14('0x51')](_0x1a1b2d['body'][_0xae14('0x52')],_0x1a1b2d[_0xae14('0x47')][_0xae14('0x2d')]);return db[_0xae14('0x4a')][_0xae14('0x46')](_0x1a1b2d[_0xae14('0x47')],{'include':[{'model':db[_0xae14('0x53')],'as':_0xae14('0x4f')},{'model':db['DeskField'],'as':_0xae14('0x54')}]});}return null;})[_0xae14('0x24')](respondWithResult(_0x2dd024,null))[_0xae14('0x41')](handleError(_0x2dd024,null));};exports['getFields']=function(_0x478429,_0x3a5e52,_0x2adfb7){var _0x2e77f7=[{'name':_0xae14('0x55'),'label':_0xae14('0x55'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4aedf0='';return db['DeskAccount'][_0xae14('0x49')]({'where':{'id':_0x478429[_0xae14('0x43')]['id']},'attributes':['id',_0xae14('0x56'),_0xae14('0x57'),_0xae14('0x58'),_0xae14('0x59'),_0xae14('0x5a'),_0xae14('0x5b'),_0xae14('0x5c'),_0xae14('0x5d')]})[_0xae14('0x24')](handleEntityNotFound(_0x3a5e52,null))['then'](function(_0x242cc0){if(_0x242cc0){_0x4aedf0=_0x242cc0[_0xae14('0x56')];var _0x5e0249=_0x4aedf0[_0xae14('0x5e')](-0x1);if(_0x5e0249==='/'){_0x4aedf0=_0x4aedf0[_0xae14('0x5f')](0x0,_0x4aedf0['lastIndexOf'](_0x5e0249));}var _0x2cbf4f={'method':_0xae14('0x60'),'uri':util[_0xae14('0x61')](_0xae14('0x62'),_0x4aedf0),'headers':{'Content-Type':_0xae14('0x63'),'Accept':_0xae14('0x63')},'json':!![]};if(_0x242cc0[_0xae14('0x57')]===_0xae14('0x64')){_0x2cbf4f[_0xae14('0x65')][_0xae14('0x66')]=util['format'](_0xae14('0x67'),new Buffer(util[_0xae14('0x61')](_0xae14('0x68'),_0x242cc0['username'],_0x242cc0[_0xae14('0x59')]))[_0xae14('0x69')](_0xae14('0x6a')));}return rp(_0x2cbf4f)['then'](function(_0xf4700a){return _0x2e77f7['concat'](_[_0xae14('0x2b')](_0xf4700a[_0xae14('0x6b')][_0xae14('0x6c')],function(_0x70444e){return{'id':_0x70444e[_0xae14('0x28')],'name':_0x70444e[_0xae14('0x28')],'type':_0x70444e['type'],'active':_0x70444e[_0xae14('0x6d')],'label':_0x70444e[_0xae14('0x6e')],'custom':!![]};}));});}})['then'](function(_0x3426fa){return{'count':_0x3426fa['length'],'rows':_0x3426fa};})[_0xae14('0x24')](respondWithResult(_0x3a5e52,null))[_0xae14('0x41')](function(_0x13cbe8){var _0x41b497=_0x478429['query'][_0xae14('0x6f')]?0x1f4:_0x13cbe8[_0xae14('0x70')]||0x1f4;logger[_0xae14('0x26')](_0xae14('0x71'),'getFields',_0x41b497,JSON['stringify'](_0x13cbe8));delete _0x13cbe8['name'];if(_0x41b497===0x191){_0x41b497=0x190;}_0x3a5e52['status'](_0x41b497)[_0xae14('0x29')](_0x478429['query']['test']?{'message':_0xae14('0x72'),'statusCode':_0x13cbe8[_0xae14('0x70')]}:_0x13cbe8);});}; \ No newline at end of file +var _0x7c5a=['end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','error','stack','name','map','DeskAccount','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','include','findAll','then','rows','catch','show','params','keys','length','includeAll','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','format','headers','Basic\x20%s','%s:%s','password','toString','base64','concat','_embedded','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c5a,0xc5));var _0xa7c5=function(_0x1c1842,_0x2fad73){_0x1c1842=_0x1c1842-0x0;var _0x2100c3=_0x7c5a[_0x1c1842];return _0x2100c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa7c5('0x0'));var zipdir=require(_0xa7c5('0x1'));var jsonpatch=require(_0xa7c5('0x2'));var rp=require(_0xa7c5('0x3'));var moment=require(_0xa7c5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa7c5('0x5'));var path=require(_0xa7c5('0x6'));var sox=require(_0xa7c5('0x7'));var csv=require('to-csv');var ejs=require(_0xa7c5('0x8'));var fs=require('fs');var fs_extra=require(_0xa7c5('0x9'));var _=require(_0xa7c5('0xa'));var squel=require(_0xa7c5('0xb'));var crypto=require(_0xa7c5('0xc'));var jsforce=require(_0xa7c5('0xd'));var deskjs=require(_0xa7c5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa7c5('0xf'));var Papa=require(_0xa7c5('0x10'));var Redis=require(_0xa7c5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa7c5('0x12'));var as=require(_0xa7c5('0x13'));var hardwareService=require(_0xa7c5('0x14'));var logger=require(_0xa7c5('0x15'))(_0xa7c5('0x16'));var utils=require(_0xa7c5('0x17'));var config=require(_0xa7c5('0x18'));var licenseUtil=require(_0xa7c5('0x19'));var db=require(_0xa7c5('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x53e348,_0x3f8ffe){_0x3f8ffe=_0x3f8ffe||0xcc;return function(_0x3be176){if(_0x3be176){return _0x53e348[_0xa7c5('0x1b')](_0x3f8ffe);}return _0x53e348[_0xa7c5('0x1c')](_0x3f8ffe)[_0xa7c5('0x1d')]();};}function respondWithResult(_0x562cdc,_0xe9a69){_0xe9a69=_0xe9a69||0xc8;return function(_0x4e46d2){if(_0x4e46d2){return _0x562cdc[_0xa7c5('0x1c')](_0xe9a69)[_0xa7c5('0x1e')](_0x4e46d2);}};}function respondWithFilteredResult(_0x237075,_0x48fd49){return function(_0x290957){if(_0x290957){var _0x4ddf73=typeof _0x48fd49[_0xa7c5('0x1f')]===_0xa7c5('0x20')&&typeof _0x48fd49[_0xa7c5('0x21')]===_0xa7c5('0x20');var _0x20f436=_0x290957[_0xa7c5('0x22')];var _0x4310c1=_0x4ddf73?0x0:_0x48fd49['offset'];var _0x476c42=_0x4ddf73?_0x290957[_0xa7c5('0x22')]:_0x48fd49[_0xa7c5('0x1f')]+_0x48fd49['limit'];var _0x12b39a;if(_0x476c42>=_0x20f436){_0x476c42=_0x20f436;_0x12b39a=0xc8;}else{_0x12b39a=0xce;}_0x237075[_0xa7c5('0x1c')](_0x12b39a);return _0x237075['set'](_0xa7c5('0x23'),_0x4310c1+'-'+_0x476c42+'/'+_0x20f436)[_0xa7c5('0x1e')](_0x290957);}return null;};}function patchUpdates(_0x175325){return function(_0x45a650){try{jsonpatch[_0xa7c5('0x24')](_0x45a650,_0x175325,!![]);}catch(_0x34016b){return BPromise['reject'](_0x34016b);}return _0x45a650[_0xa7c5('0x25')]();};}function saveUpdates(_0x38ebde,_0x307658){return function(_0x2cd86a){if(_0x2cd86a){return _0x2cd86a[_0xa7c5('0x26')](_0x38ebde)['then'](function(_0x2cc7d6){return _0x2cc7d6;});}return null;};}function removeEntity(_0x2ccfee,_0x4ce4a5){return function(_0x4f190b){if(_0x4f190b){return _0x4f190b[_0xa7c5('0x27')]()['then'](function(){_0x2ccfee['status'](0xcc)[_0xa7c5('0x1d')]();});}};}function handleEntityNotFound(_0x49852a,_0x5eb9c4){return function(_0x35c64f){if(!_0x35c64f){_0x49852a[_0xa7c5('0x1b')](0x194);}return _0x35c64f;};}function handleError(_0x535ebf,_0x5187ec){_0x5187ec=_0x5187ec||0x1f4;return function(_0x4eb0ae){logger[_0xa7c5('0x28')](_0x4eb0ae[_0xa7c5('0x29')]);if(_0x4eb0ae[_0xa7c5('0x2a')]){delete _0x4eb0ae[_0xa7c5('0x2a')];}_0x535ebf['status'](_0x5187ec)['send'](_0x4eb0ae);};}exports['index']=function(_0x5ab68b,_0x26961f){var _0x537501={},_0x1920f1={},_0x58ffeb={'count':0x0,'rows':[]};var _0x1ed689=_[_0xa7c5('0x2b')](db[_0xa7c5('0x2c')][_0xa7c5('0x2d')],function(_0x5323da){return{'name':_0x5323da['fieldName'],'type':_0x5323da[_0xa7c5('0x2e')][_0xa7c5('0x2f')]};});_0x1920f1[_0xa7c5('0x30')]=_['map'](_0x1ed689,_0xa7c5('0x2a'));_0x1920f1['query']=_['keys'](_0x5ab68b[_0xa7c5('0x31')]);_0x1920f1['filters']=_[_0xa7c5('0x32')](_0x1920f1[_0xa7c5('0x30')],_0x1920f1[_0xa7c5('0x31')]);_0x537501[_0xa7c5('0x33')]=_[_0xa7c5('0x32')](_0x1920f1[_0xa7c5('0x30')],qs[_0xa7c5('0x34')](_0x5ab68b[_0xa7c5('0x31')][_0xa7c5('0x34')]));_0x537501[_0xa7c5('0x33')]=_0x537501[_0xa7c5('0x33')]['length']?_0x537501[_0xa7c5('0x33')]:_0x1920f1[_0xa7c5('0x30')];if(!_0x5ab68b[_0xa7c5('0x31')][_0xa7c5('0x35')](_0xa7c5('0x36'))){_0x537501[_0xa7c5('0x21')]=qs[_0xa7c5('0x21')](_0x5ab68b[_0xa7c5('0x31')][_0xa7c5('0x21')]);_0x537501[_0xa7c5('0x1f')]=qs[_0xa7c5('0x1f')](_0x5ab68b[_0xa7c5('0x31')]['offset']);}_0x537501[_0xa7c5('0x37')]=qs[_0xa7c5('0x38')](_0x5ab68b[_0xa7c5('0x31')]['sort']);_0x537501[_0xa7c5('0x39')]=qs['filters'](_[_0xa7c5('0x3a')](_0x5ab68b['query'],_0x1920f1[_0xa7c5('0x3b')]),_0x1ed689);if(_0x5ab68b[_0xa7c5('0x31')][_0xa7c5('0x3c')]){_0x537501[_0xa7c5('0x39')]=_[_0xa7c5('0x3d')](_0x537501[_0xa7c5('0x39')],{'$or':_[_0xa7c5('0x2b')](_0x1ed689,function(_0x5262f2){if(_0x5262f2[_0xa7c5('0x2e')]!=='VIRTUAL'){var _0x12f76f={};_0x12f76f[_0x5262f2['name']]={'$like':'%'+_0x5ab68b[_0xa7c5('0x31')][_0xa7c5('0x3c')]+'%'};return _0x12f76f;}})});}_0x537501=_[_0xa7c5('0x3d')]({},_0x537501,_0x5ab68b[_0xa7c5('0x3e')]);var _0x5f3e75={'where':_0x537501['where']};return db['DeskAccount'][_0xa7c5('0x22')](_0x5f3e75)['then'](function(_0x4c5f10){_0x58ffeb['count']=_0x4c5f10;if(_0x5ab68b[_0xa7c5('0x31')]['includeAll']){_0x537501[_0xa7c5('0x3f')]=[{'all':!![]}];}return db['DeskAccount'][_0xa7c5('0x40')](_0x537501);})[_0xa7c5('0x41')](function(_0x4f7697){_0x58ffeb[_0xa7c5('0x42')]=_0x4f7697;return _0x58ffeb;})[_0xa7c5('0x41')](respondWithFilteredResult(_0x26961f,_0x537501))[_0xa7c5('0x43')](handleError(_0x26961f,null));};exports[_0xa7c5('0x44')]=function(_0x1d42ef,_0x4f18f3){var _0x3ef5d3={'raw':![],'where':{'id':_0x1d42ef[_0xa7c5('0x45')]['id']}},_0x714a0b={};_0x714a0b['model']=_[_0xa7c5('0x46')](db[_0xa7c5('0x2c')][_0xa7c5('0x2d')]);_0x714a0b[_0xa7c5('0x31')]=_[_0xa7c5('0x46')](_0x1d42ef['query']);_0x714a0b['filters']=_['intersection'](_0x714a0b[_0xa7c5('0x30')],_0x714a0b[_0xa7c5('0x31')]);_0x3ef5d3['attributes']=_[_0xa7c5('0x32')](_0x714a0b['model'],qs[_0xa7c5('0x34')](_0x1d42ef[_0xa7c5('0x31')][_0xa7c5('0x34')]));_0x3ef5d3[_0xa7c5('0x33')]=_0x3ef5d3['attributes'][_0xa7c5('0x47')]?_0x3ef5d3['attributes']:_0x714a0b[_0xa7c5('0x30')];if(_0x1d42ef['query'][_0xa7c5('0x48')]){_0x3ef5d3['include']=[{'all':!![]}];}_0x3ef5d3=_[_0xa7c5('0x3d')]({},_0x3ef5d3,_0x1d42ef[_0xa7c5('0x3e')]);return db[_0xa7c5('0x2c')][_0xa7c5('0x49')](_0x3ef5d3)['then'](handleEntityNotFound(_0x4f18f3,null))[_0xa7c5('0x41')](respondWithResult(_0x4f18f3,null))['catch'](handleError(_0x4f18f3,null));};exports[_0xa7c5('0x4a')]=function(_0x24102e,_0x2cda50){return db[_0xa7c5('0x2c')]['create'](_0x24102e[_0xa7c5('0x4b')],{})[_0xa7c5('0x41')](respondWithResult(_0x2cda50,0xc9))['catch'](handleError(_0x2cda50,null));};exports[_0xa7c5('0x26')]=function(_0x6d5f67,_0x4d6814){if(_0x6d5f67['body']['id']){delete _0x6d5f67[_0xa7c5('0x4b')]['id'];}return db[_0xa7c5('0x2c')][_0xa7c5('0x49')]({'where':{'id':_0x6d5f67[_0xa7c5('0x45')]['id']}})[_0xa7c5('0x41')](handleEntityNotFound(_0x4d6814,null))[_0xa7c5('0x41')](saveUpdates(_0x6d5f67['body'],null))['then'](respondWithResult(_0x4d6814,null))['catch'](handleError(_0x4d6814,null));};exports['destroy']=function(_0x1e6da1,_0x2ae3c2){return db[_0xa7c5('0x2c')]['find']({'where':{'id':_0x1e6da1[_0xa7c5('0x45')]['id']}})[_0xa7c5('0x41')](handleEntityNotFound(_0x2ae3c2,null))[_0xa7c5('0x41')](removeEntity(_0x2ae3c2,null))['catch'](handleError(_0x2ae3c2,null));};exports[_0xa7c5('0x4c')]=function(_0x4b07bc,_0x3df423,_0x14a8d7){var _0x1e0050={};var _0x18ee37={};var _0x3e6d0b;var _0x44b263;return db[_0xa7c5('0x2c')][_0xa7c5('0x4d')]({'where':{'id':_0x4b07bc[_0xa7c5('0x45')]['id']}})[_0xa7c5('0x41')](handleEntityNotFound(_0x3df423,null))[_0xa7c5('0x41')](function(_0x4c1ba3){if(_0x4c1ba3){_0x3e6d0b=_0x4c1ba3;_0x18ee37[_0xa7c5('0x30')]=_[_0xa7c5('0x46')](db['DeskConfiguration'][_0xa7c5('0x2d')]);_0x18ee37[_0xa7c5('0x31')]=_[_0xa7c5('0x46')](_0x4b07bc[_0xa7c5('0x31')]);_0x18ee37[_0xa7c5('0x3b')]=_[_0xa7c5('0x32')](_0x18ee37[_0xa7c5('0x30')],_0x18ee37[_0xa7c5('0x31')]);_0x1e0050['attributes']=_[_0xa7c5('0x32')](_0x18ee37[_0xa7c5('0x30')],qs['fields'](_0x4b07bc[_0xa7c5('0x31')][_0xa7c5('0x34')]));_0x1e0050[_0xa7c5('0x33')]=_0x1e0050[_0xa7c5('0x33')][_0xa7c5('0x47')]?_0x1e0050[_0xa7c5('0x33')]:_0x18ee37[_0xa7c5('0x30')];_0x1e0050[_0xa7c5('0x37')]=qs[_0xa7c5('0x38')](_0x4b07bc[_0xa7c5('0x31')][_0xa7c5('0x38')]);_0x1e0050[_0xa7c5('0x39')]=qs[_0xa7c5('0x3b')](_[_0xa7c5('0x3a')](_0x4b07bc[_0xa7c5('0x31')],_0x18ee37[_0xa7c5('0x3b')]));if(_0x4b07bc['query']['filter']){_0x1e0050[_0xa7c5('0x39')]=_['merge'](_0x1e0050['where'],{'$or':_[_0xa7c5('0x2b')](_0x1e0050[_0xa7c5('0x33')],function(_0x9240d4){var _0x31368f={};_0x31368f[_0x9240d4]={'$like':'%'+_0x4b07bc[_0xa7c5('0x31')][_0xa7c5('0x3c')]+'%'};return _0x31368f;})});}_0x1e0050=_[_0xa7c5('0x3d')]({},_0x1e0050,_0x4b07bc['options']);return _0x3e6d0b[_0xa7c5('0x4c')](_0x1e0050);}})[_0xa7c5('0x41')](function(_0x50a5b4){if(_0x50a5b4){_0x44b263=_0x50a5b4[_0xa7c5('0x47')];if(!_0x4b07bc[_0xa7c5('0x31')]['hasOwnProperty'](_0xa7c5('0x36'))){_0x1e0050[_0xa7c5('0x21')]=qs[_0xa7c5('0x21')](_0x4b07bc[_0xa7c5('0x31')]['limit']);_0x1e0050['offset']=qs[_0xa7c5('0x1f')](_0x4b07bc[_0xa7c5('0x31')][_0xa7c5('0x1f')]);}return _0x3e6d0b[_0xa7c5('0x4c')](_0x1e0050);}})[_0xa7c5('0x41')](function(_0x4892d0){if(_0x4892d0){return _0x4892d0?{'count':_0x44b263,'rows':_0x4892d0}:null;}})[_0xa7c5('0x41')](respondWithResult(_0x3df423,null))[_0xa7c5('0x43')](handleError(_0x3df423,null));};exports[_0xa7c5('0x4e')]=function(_0x409018,_0x2f250e,_0x1ffce3){if(_0x409018[_0xa7c5('0x4b')]['id']){delete _0x409018['body']['id'];}return db[_0xa7c5('0x2c')]['findOne']({'where':{'id':_0x409018[_0xa7c5('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f250e,null))['then'](function(_0x5f4f44){if(_0x5f4f44){_0x409018['body'][_0xa7c5('0x4f')]=_0x5f4f44['id'];_0x409018[_0xa7c5('0x4b')][_0xa7c5('0x50')]=integrations[_0xa7c5('0x51')](_0x409018[_0xa7c5('0x4b')][_0xa7c5('0x52')],_0x409018[_0xa7c5('0x4b')][_0xa7c5('0x2e')]);_0x409018[_0xa7c5('0x4b')][_0xa7c5('0x53')]=integrations['getDescriptions'](_0x409018[_0xa7c5('0x4b')]['channel'],_0x409018['body']['type']);return db[_0xa7c5('0x54')][_0xa7c5('0x4a')](_0x409018[_0xa7c5('0x4b')],{'include':[{'model':db['DeskField'],'as':_0xa7c5('0x50')},{'model':db[_0xa7c5('0x55')],'as':_0xa7c5('0x53')}]});}return null;})[_0xa7c5('0x41')](respondWithResult(_0x2f250e,null))[_0xa7c5('0x43')](handleError(_0x2f250e,null));};exports[_0xa7c5('0x56')]=function(_0x3031b3,_0x210c2a,_0x41b789){var _0x3c7b13=[{'name':'priority','label':_0xa7c5('0x57'),'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 _0x1ba2f4='';return db[_0xa7c5('0x2c')][_0xa7c5('0x4d')]({'where':{'id':_0x3031b3[_0xa7c5('0x45')]['id']},'attributes':['id',_0xa7c5('0x58'),_0xa7c5('0x59'),_0xa7c5('0x5a'),'password',_0xa7c5('0x5b'),_0xa7c5('0x5c'),_0xa7c5('0x5d'),_0xa7c5('0x5e')]})[_0xa7c5('0x41')](handleEntityNotFound(_0x210c2a,null))[_0xa7c5('0x41')](function(_0x31bbf9){if(_0x31bbf9){_0x1ba2f4=_0x31bbf9[_0xa7c5('0x58')];var _0x1c22c7=_0x1ba2f4['slice'](-0x1);if(_0x1c22c7==='/'){_0x1ba2f4=_0x1ba2f4[_0xa7c5('0x5f')](0x0,_0x1ba2f4[_0xa7c5('0x60')](_0x1c22c7));}var _0x2996a9={'method':'GET','uri':util[_0xa7c5('0x61')]('%s/custom_fields',_0x1ba2f4),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x31bbf9[_0xa7c5('0x59')]==='basic'){_0x2996a9[_0xa7c5('0x62')]['Authorization']=util[_0xa7c5('0x61')](_0xa7c5('0x63'),new Buffer(util[_0xa7c5('0x61')](_0xa7c5('0x64'),_0x31bbf9[_0xa7c5('0x5a')],_0x31bbf9[_0xa7c5('0x65')]))[_0xa7c5('0x66')](_0xa7c5('0x67')));}return rp(_0x2996a9)[_0xa7c5('0x41')](function(_0x3898ef){return _0x3c7b13[_0xa7c5('0x68')](_[_0xa7c5('0x2b')](_0x3898ef[_0xa7c5('0x69')][_0xa7c5('0x6a')],function(_0x10d73d){return{'id':_0x10d73d[_0xa7c5('0x2a')],'name':_0x10d73d['name'],'type':_0x10d73d[_0xa7c5('0x2e')],'active':_0x10d73d[_0xa7c5('0x6b')],'label':_0x10d73d[_0xa7c5('0x6c')],'custom':!![]};}));});}})[_0xa7c5('0x41')](function(_0x324c34){return{'count':_0x324c34[_0xa7c5('0x47')],'rows':_0x324c34};})['then'](respondWithResult(_0x210c2a,null))[_0xa7c5('0x43')](function(_0x3bc6cb){var _0x27677e=_0x3031b3['query'][_0xa7c5('0x6d')]?0x1f4:_0x3bc6cb['statusCode']||0x1f4;logger[_0xa7c5('0x28')](_0xa7c5('0x6e'),_0xa7c5('0x56'),_0x27677e,JSON['stringify'](_0x3bc6cb));delete _0x3bc6cb[_0xa7c5('0x2a')];if(_0x27677e===0x191){_0x27677e=0x190;}_0x210c2a[_0xa7c5('0x1c')](_0x27677e)[_0xa7c5('0x6f')](_0x3031b3[_0xa7c5('0x31')][_0xa7c5('0x6d')]?{'message':_0xa7c5('0x70'),'statusCode':_0x3bc6cb['statusCode']}:_0x3bc6cb);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 9d7b889..d000a17 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 _0x5360=['int_desk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','DeskAccount'];(function(_0x17b32c,_0x515973){var _0x196d41=function(_0x5a65df){while(--_0x5a65df){_0x17b32c['push'](_0x17b32c['shift']());}};_0x196d41(++_0x515973);}(_0x5360,0x16d));var _0x0536=function(_0x171473,_0x5f0073){_0x171473=_0x171473-0x0;var _0x571851=_0x5360[_0x171473];return _0x571851;};'use strict';var _=require(_0x0536('0x0'));var util=require(_0x0536('0x1'));var logger=require('../../config/logger')(_0x0536('0x2'));var moment=require(_0x0536('0x3'));var BPromise=require(_0x0536('0x4'));var rp=require(_0x0536('0x5'));var fs=require('fs');var path=require(_0x0536('0x6'));var rimraf=require(_0x0536('0x7'));var config=require(_0x0536('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x0536('0x9'));module[_0x0536('0xa')]=function(_0x4bb80b,_0x372b02){return _0x4bb80b['define'](_0x0536('0xb'),attributes,{'tableName':_0x0536('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ceb=['moment','bluebird','request-promise','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api'];(function(_0x588489,_0x13e7e3){var _0x1ea6ec=function(_0x1e3fc6){while(--_0x1e3fc6){_0x588489['push'](_0x588489['shift']());}};_0x1ea6ec(++_0x13e7e3);}(_0x3ceb,0x141));var _0xb3ce=function(_0x559587,_0x53504b){_0x559587=_0x559587-0x0;var _0x21f2b0=_0x3ceb[_0x559587];return _0x21f2b0;};'use strict';var _=require(_0xb3ce('0x0'));var util=require(_0xb3ce('0x1'));var logger=require(_0xb3ce('0x2'))(_0xb3ce('0x3'));var moment=require(_0xb3ce('0x4'));var BPromise=require(_0xb3ce('0x5'));var rp=require(_0xb3ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3ce('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xb3ce('0x8'));module[_0xb3ce('0x9')]=function(_0x897e75,_0x5cc9bd){return _0x897e75[_0xb3ce('0xa')](_0xb3ce('0xb'),attributes,{'tableName':_0xb3ce('0xc'),'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 4506442..235bd04 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 _0xbad1=['DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','info','message','catch','DeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetDeskAccount','stringify','ShowDeskAccount','find','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','then','DeskAccount,\x20%s,\x20%s','debug'];(function(_0x2211ed,_0x1bca0b){var _0x4d78cc=function(_0x467b59){while(--_0x467b59){_0x2211ed['push'](_0x2211ed['shift']());}};_0x4d78cc(++_0x1bca0b);}(_0xbad1,0x10c));var _0x1bad=function(_0x4f742c,_0x30aa81){_0x4f742c=_0x4f742c-0x0;var _0x1b8338=_0xbad1[_0x4f742c];return _0x1b8338;};'use strict';var _=require('lodash');var util=require(_0x1bad('0x0'));var moment=require(_0x1bad('0x1'));var BPromise=require('bluebird');var rs=require(_0x1bad('0x2'));var fs=require('fs');var Redis=require(_0x1bad('0x3'));var db=require(_0x1bad('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1bad('0x5'));var config=require(_0x1bad('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1bad('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x11ffe4,_0x1b8076,_0x5f4784){return new BPromise(function(_0x12b4d4,_0x9fb389){return client['request'](_0x11ffe4,_0x5f4784)[_0x1bad('0x8')](function(_0x1925ac){logger['info'](_0x1bad('0x9'),_0x1b8076,'request\x20sent');logger[_0x1bad('0xa')](_0x1bad('0xb'),_0x1b8076,_0x1bad('0xc'),JSON['stringify'](_0x1925ac));if(_0x1925ac[_0x1bad('0xd')]){if(_0x1925ac['error']['code']===0x1f4){logger[_0x1bad('0xd')](_0x1bad('0x9'),_0x1b8076,_0x1925ac[_0x1bad('0xd')]['message']);return _0x9fb389(_0x1925ac[_0x1bad('0xd')]['message']);}logger[_0x1bad('0xd')](_0x1bad('0x9'),_0x1b8076,_0x1925ac[_0x1bad('0xd')]['message']);return _0x12b4d4(_0x1925ac['error']['message']);}else{logger[_0x1bad('0xe')](_0x1bad('0x9'),_0x1b8076,_0x1bad('0xc'));_0x12b4d4(_0x1925ac['result'][_0x1bad('0xf')]);}})[_0x1bad('0x10')](function(_0x1e8447){logger[_0x1bad('0xd')](_0x1bad('0x9'),_0x1b8076,_0x1e8447);_0x9fb389(_0x1e8447);});});}exports['GetDeskAccount']=function(_0x588e8c){var _0x2f4399=this;return new Promise(function(_0x473dc7,_0x47521b){return db[_0x1bad('0x11')][_0x1bad('0x12')]({'raw':_0x588e8c[_0x1bad('0x13')]?_0x588e8c['options'][_0x1bad('0x14')]===undefined?!![]:![]:!![],'where':_0x588e8c['options']?_0x588e8c['options'][_0x1bad('0x15')]||null:null,'attributes':_0x588e8c[_0x1bad('0x13')]?_0x588e8c[_0x1bad('0x13')][_0x1bad('0x16')]||null:null,'limit':_0x588e8c[_0x1bad('0x13')]?_0x588e8c[_0x1bad('0x13')][_0x1bad('0x17')]||null:null,'include':_0x588e8c[_0x1bad('0x13')]?_0x588e8c['options'][_0x1bad('0x18')]?_['map'](_0x588e8c[_0x1bad('0x13')][_0x1bad('0x18')],function(_0x531e7c){return{'model':db[_0x531e7c[_0x1bad('0x19')]],'as':_0x531e7c['as'],'attributes':_0x531e7c[_0x1bad('0x16')],'include':_0x531e7c[_0x1bad('0x18')]?_[_0x1bad('0x1a')](_0x531e7c['include'],function(_0x10f7a1){return{'model':db[_0x10f7a1[_0x1bad('0x19')]],'as':_0x10f7a1['as'],'attributes':_0x10f7a1[_0x1bad('0x16')],'include':_0x10f7a1[_0x1bad('0x18')]?_[_0x1bad('0x1a')](_0x10f7a1['include'],function(_0x15d260){return{'model':db[_0x15d260[_0x1bad('0x19')]],'as':_0x15d260['as'],'attributes':_0x15d260['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x43553d){logger[_0x1bad('0xe')](_0x1bad('0x1b'),_0x588e8c);logger[_0x1bad('0xa')](_0x1bad('0x1b'),_0x588e8c,JSON[_0x1bad('0x1c')](_0x43553d));_0x473dc7(_0x43553d);})[_0x1bad('0x10')](function(_0x40f512){logger[_0x1bad('0xd')](_0x1bad('0x1b'),_0x40f512[_0x1bad('0xf')],_0x588e8c);_0x47521b(_0x2f4399[_0x1bad('0xd')](0x1f4,_0x40f512[_0x1bad('0xf')]));});});};exports[_0x1bad('0x1d')]=function(_0x3a0d90){var _0x1fc2dc=this;return new Promise(function(_0x561094,_0x46500d){return db[_0x1bad('0x11')][_0x1bad('0x1e')]({'raw':_0x3a0d90[_0x1bad('0x13')]?_0x3a0d90[_0x1bad('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x3a0d90[_0x1bad('0x13')]?_0x3a0d90['options'][_0x1bad('0x15')]||null:null,'attributes':_0x3a0d90[_0x1bad('0x13')]?_0x3a0d90[_0x1bad('0x13')]['attributes']||null:null,'include':_0x3a0d90[_0x1bad('0x13')]?_0x3a0d90[_0x1bad('0x13')][_0x1bad('0x18')]?_[_0x1bad('0x1a')](_0x3a0d90['options'][_0x1bad('0x18')],function(_0x379500){return{'model':db[_0x379500[_0x1bad('0x19')]],'as':_0x379500['as'],'attributes':_0x379500[_0x1bad('0x16')],'include':_0x379500[_0x1bad('0x18')]?_['map'](_0x379500[_0x1bad('0x18')],function(_0x4f2bb4){return{'model':db[_0x4f2bb4[_0x1bad('0x19')]],'as':_0x4f2bb4['as'],'attributes':_0x4f2bb4['attributes'],'include':_0x4f2bb4['include']?_[_0x1bad('0x1a')](_0x4f2bb4[_0x1bad('0x18')],function(_0x14540f){return{'model':db[_0x14540f[_0x1bad('0x19')]],'as':_0x14540f['as'],'attributes':_0x14540f[_0x1bad('0x16')]};}):[]};}):[]};}):[]:[]})[_0x1bad('0x8')](function(_0x4d184c){logger[_0x1bad('0xe')](_0x1bad('0x1d'),_0x3a0d90);logger[_0x1bad('0xa')](_0x1bad('0x1d'),_0x3a0d90,JSON[_0x1bad('0x1c')](_0x4d184c));_0x561094(_0x4d184c);})['catch'](function(_0x9ee79b){logger['error'](_0x1bad('0x1d'),_0x9ee79b[_0x1bad('0xf')],_0x3a0d90);_0x46500d(_0x1fc2dc[_0x1bad('0xd')](0x1f4,_0x9ee79b[_0x1bad('0xf')]));});});}; \ No newline at end of file +var _0xdda6=['error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','include','map','model','then','ShowDeskAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xebbc9f,_0x3e35bd){var _0x2f511d=function(_0xb9b3ca){while(--_0xb9b3ca){_0xebbc9f['push'](_0xebbc9f['shift']());}};_0x2f511d(++_0x3e35bd);}(_0xdda6,0xa1));var _0x6dda=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0xdda6[_0x3f4dd9];return _0x31c54a;};'use strict';var _=require(_0x6dda('0x0'));var util=require(_0x6dda('0x1'));var moment=require(_0x6dda('0x2'));var BPromise=require(_0x6dda('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6dda('0x4'));var db=require(_0x6dda('0x5'))['db'];var utils=require(_0x6dda('0x6'));var logger=require(_0x6dda('0x7'))(_0x6dda('0x8'));var config=require(_0x6dda('0x9'));var jayson=require(_0x6dda('0xa'));var client=jayson[_0x6dda('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f7827,_0x262469,_0x8ed81d){return new BPromise(function(_0x268aef,_0xfba9f3){return client[_0x6dda('0xc')](_0x1f7827,_0x8ed81d)['then'](function(_0x288335){logger[_0x6dda('0xd')](_0x6dda('0xe'),_0x262469,_0x6dda('0xf'));logger[_0x6dda('0x10')](_0x6dda('0x11'),_0x262469,_0x6dda('0xf'),JSON[_0x6dda('0x12')](_0x288335));if(_0x288335[_0x6dda('0x13')]){if(_0x288335[_0x6dda('0x13')][_0x6dda('0x14')]===0x1f4){logger[_0x6dda('0x13')](_0x6dda('0xe'),_0x262469,_0x288335['error'][_0x6dda('0x15')]);return _0xfba9f3(_0x288335[_0x6dda('0x13')][_0x6dda('0x15')]);}logger[_0x6dda('0x13')](_0x6dda('0xe'),_0x262469,_0x288335[_0x6dda('0x13')][_0x6dda('0x15')]);return _0x268aef(_0x288335['error'][_0x6dda('0x15')]);}else{logger[_0x6dda('0xd')]('DeskAccount,\x20%s,\x20%s',_0x262469,_0x6dda('0xf'));_0x268aef(_0x288335[_0x6dda('0x16')][_0x6dda('0x15')]);}})[_0x6dda('0x17')](function(_0x51f8ee){logger[_0x6dda('0x13')](_0x6dda('0xe'),_0x262469,_0x51f8ee);_0xfba9f3(_0x51f8ee);});});}exports[_0x6dda('0x18')]=function(_0x47705d){var _0x51e0a0=this;return new Promise(function(_0x587c02,_0x466d71){return db[_0x6dda('0x19')]['findAll']({'raw':_0x47705d[_0x6dda('0x1a')]?_0x47705d[_0x6dda('0x1a')][_0x6dda('0x1b')]===undefined?!![]:![]:!![],'where':_0x47705d[_0x6dda('0x1a')]?_0x47705d[_0x6dda('0x1a')][_0x6dda('0x1c')]||null:null,'attributes':_0x47705d[_0x6dda('0x1a')]?_0x47705d[_0x6dda('0x1a')][_0x6dda('0x1d')]||null:null,'limit':_0x47705d[_0x6dda('0x1a')]?_0x47705d[_0x6dda('0x1a')]['limit']||null:null,'include':_0x47705d[_0x6dda('0x1a')]?_0x47705d[_0x6dda('0x1a')][_0x6dda('0x1e')]?_[_0x6dda('0x1f')](_0x47705d[_0x6dda('0x1a')][_0x6dda('0x1e')],function(_0x2ecff0){return{'model':db[_0x2ecff0[_0x6dda('0x20')]],'as':_0x2ecff0['as'],'attributes':_0x2ecff0[_0x6dda('0x1d')],'include':_0x2ecff0['include']?_[_0x6dda('0x1f')](_0x2ecff0['include'],function(_0x3c8ed1){return{'model':db[_0x3c8ed1['model']],'as':_0x3c8ed1['as'],'attributes':_0x3c8ed1[_0x6dda('0x1d')],'include':_0x3c8ed1[_0x6dda('0x1e')]?_['map'](_0x3c8ed1['include'],function(_0x51d2b0){return{'model':db[_0x51d2b0[_0x6dda('0x20')]],'as':_0x51d2b0['as'],'attributes':_0x51d2b0['attributes']};}):[]};}):[]};}):[]:[]})[_0x6dda('0x21')](function(_0x1e53a5){logger[_0x6dda('0xd')](_0x6dda('0x18'),_0x47705d);logger['debug'](_0x6dda('0x18'),_0x47705d,JSON[_0x6dda('0x12')](_0x1e53a5));_0x587c02(_0x1e53a5);})[_0x6dda('0x17')](function(_0x239011){logger['error'](_0x6dda('0x18'),_0x239011[_0x6dda('0x15')],_0x47705d);_0x466d71(_0x51e0a0[_0x6dda('0x13')](0x1f4,_0x239011[_0x6dda('0x15')]));});});};exports[_0x6dda('0x22')]=function(_0x171ffa){var _0x2e554f=this;return new Promise(function(_0x3fd36f,_0x4a320c){return db['DeskAccount'][_0x6dda('0x23')]({'raw':_0x171ffa[_0x6dda('0x1a')]?_0x171ffa[_0x6dda('0x1a')][_0x6dda('0x1b')]===undefined?!![]:![]:!![],'where':_0x171ffa[_0x6dda('0x1a')]?_0x171ffa[_0x6dda('0x1a')][_0x6dda('0x1c')]||null:null,'attributes':_0x171ffa[_0x6dda('0x1a')]?_0x171ffa[_0x6dda('0x1a')]['attributes']||null:null,'include':_0x171ffa[_0x6dda('0x1a')]?_0x171ffa[_0x6dda('0x1a')][_0x6dda('0x1e')]?_['map'](_0x171ffa[_0x6dda('0x1a')]['include'],function(_0xc7093e){return{'model':db[_0xc7093e[_0x6dda('0x20')]],'as':_0xc7093e['as'],'attributes':_0xc7093e['attributes'],'include':_0xc7093e['include']?_[_0x6dda('0x1f')](_0xc7093e[_0x6dda('0x1e')],function(_0x3f560c){return{'model':db[_0x3f560c[_0x6dda('0x20')]],'as':_0x3f560c['as'],'attributes':_0x3f560c['attributes'],'include':_0x3f560c['include']?_[_0x6dda('0x1f')](_0x3f560c[_0x6dda('0x1e')],function(_0x56cdaf){return{'model':db[_0x56cdaf[_0x6dda('0x20')]],'as':_0x56cdaf['as'],'attributes':_0x56cdaf['attributes']};}):[]};}):[]};}):[]:[]})[_0x6dda('0x21')](function(_0xbf30bb){logger['info'](_0x6dda('0x22'),_0x171ffa);logger[_0x6dda('0x10')](_0x6dda('0x22'),_0x171ffa,JSON[_0x6dda('0x12')](_0xbf30bb));_0x3fd36f(_0xbf30bb);})['catch'](function(_0x2ff498){logger['error']('ShowDeskAccount',_0x2ff498[_0x6dda('0x15')],_0x171ffa);_0x4a320c(_0x2e554f[_0x6dda('0x13')](0x1f4,_0x2ff498[_0x6dda('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index e4574cc..067102d 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x22003b,_0x50231b){var _0x221aef=function(_0x282353){while(--_0x282353){_0x22003b['push'](_0x22003b['shift']());}};_0x221aef(++_0x50231b);}(_0x008c,0x188));var _0xc008=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0x008c[_0x3239f5];return _0x3559c8;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x79e32a,_0x1d3a86){var _0x5d1f3f=function(_0x2e28c2){while(--_0x2e28c2){_0x79e32a['push'](_0x79e32a['shift']());}};_0x5d1f3f(++_0x1d3a86);}(_0x7217,0x19e));var _0x7721=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7217[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 3a0a1ac..6d0406e 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 _0x998a=['sequelize','STRING'];(function(_0x3531b2,_0x574314){var _0x4beebe=function(_0xefeea3){while(--_0xefeea3){_0x3531b2['push'](_0x3531b2['shift']());}};_0x4beebe(++_0x574314);}(_0x998a,0x16c));var _0xa998=function(_0x1f33de,_0x30b0e3){_0x1f33de=_0x1f33de-0x0;var _0x2568b8=_0x998a[_0x1f33de];return _0x2568b8;};'use strict';var Sequelize=require(_0xa998('0x0'));module['exports']={'name':{'type':Sequelize[_0xa998('0x1')]},'description':{'type':Sequelize[_0xa998('0x1')]}}; \ No newline at end of file +var _0x8490=['STRING','sequelize','exports'];(function(_0x701eb2,_0x2d3aba){var _0x2e3bc7=function(_0x98295){while(--_0x98295){_0x701eb2['push'](_0x701eb2['shift']());}};_0x2e3bc7(++_0x2d3aba);}(_0x8490,0x154));var _0x0849=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x8490[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x0849('0x0'));module[_0x0849('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0849('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 4916396..7da2eda 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 _0x7efe=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','status','json','limit','undefined','count','offset','set','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','catch','params','find','create','body','getFields','findOne','DeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch'];(function(_0x123224,_0x103372){var _0x56be5f=function(_0x4cc817){while(--_0x4cc817){_0x123224['push'](_0x123224['shift']());}};_0x56be5f(++_0x103372);}(_0x7efe,0xe7));var _0xe7ef=function(_0x53b093,_0x2f985d){_0x53b093=_0x53b093-0x0;var _0x58b76b=_0x7efe[_0x53b093];return _0x58b76b;};'use strict';var emlformat=require(_0xe7ef('0x0'));var rimraf=require(_0xe7ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe7ef('0x2'));var rp=require(_0xe7ef('0x3'));var moment=require(_0xe7ef('0x4'));var BPromise=require(_0xe7ef('0x5'));var Mustache=require(_0xe7ef('0x6'));var util=require(_0xe7ef('0x7'));var path=require(_0xe7ef('0x8'));var sox=require(_0xe7ef('0x9'));var csv=require(_0xe7ef('0xa'));var ejs=require(_0xe7ef('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe7ef('0xc'));var crypto=require(_0xe7ef('0xd'));var jsforce=require(_0xe7ef('0xe'));var deskjs=require(_0xe7ef('0xf'));var toCsv=require(_0xe7ef('0xa'));var querystring=require(_0xe7ef('0x10'));var Papa=require(_0xe7ef('0x11'));var Redis=require(_0xe7ef('0x12'));var authService=require(_0xe7ef('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe7ef('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe7ef('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c0e45,_0x35a932){_0x35a932=_0x35a932||0xcc;return function(_0x2dfc02){if(_0x2dfc02){return _0x3c0e45['sendStatus'](_0x35a932);}return _0x3c0e45[_0xe7ef('0x16')](_0x35a932)['end']();};}function respondWithResult(_0x488274,_0x470e69){_0x470e69=_0x470e69||0xc8;return function(_0x215400){if(_0x215400){return _0x488274[_0xe7ef('0x16')](_0x470e69)[_0xe7ef('0x17')](_0x215400);}};}function respondWithFilteredResult(_0x4059f1,_0x1271ec){return function(_0x2d1055){if(_0x2d1055){var _0x29038a=typeof _0x1271ec['offset']==='undefined'&&typeof _0x1271ec[_0xe7ef('0x18')]===_0xe7ef('0x19');var _0x16184f=_0x2d1055[_0xe7ef('0x1a')];var _0x53ecf7=_0x29038a?0x0:_0x1271ec[_0xe7ef('0x1b')];var _0x358e21=_0x29038a?_0x2d1055['count']:_0x1271ec['offset']+_0x1271ec[_0xe7ef('0x18')];var _0x843682;if(_0x358e21>=_0x16184f){_0x358e21=_0x16184f;_0x843682=0xc8;}else{_0x843682=0xce;}_0x4059f1['status'](_0x843682);return _0x4059f1[_0xe7ef('0x1c')]('Content-Range',_0x53ecf7+'-'+_0x358e21+'/'+_0x16184f)['json'](_0x2d1055);}return null;};}function patchUpdates(_0x32f4ad){return function(_0x455b71){try{jsonpatch[_0xe7ef('0x1d')](_0x455b71,_0x32f4ad,!![]);}catch(_0x1e3d17){return BPromise[_0xe7ef('0x1e')](_0x1e3d17);}return _0x455b71['save']();};}function saveUpdates(_0x297160,_0x5b13b3){return function(_0x146d37){if(_0x146d37){return _0x146d37[_0xe7ef('0x1f')](_0x297160)[_0xe7ef('0x20')](function(_0x4508c7){return _0x4508c7;});}return null;};}function removeEntity(_0x502e56,_0x4156d7){return function(_0x35ea7c){if(_0x35ea7c){return _0x35ea7c[_0xe7ef('0x21')]()['then'](function(){_0x502e56[_0xe7ef('0x16')](0xcc)[_0xe7ef('0x22')]();});}};}function handleEntityNotFound(_0x502a67,_0x2a3517){return function(_0x4b39af){if(!_0x4b39af){_0x502a67[_0xe7ef('0x23')](0x194);}return _0x4b39af;};}function handleError(_0x1fc0fd,_0x1a720c){_0x1a720c=_0x1a720c||0x1f4;return function(_0x34694b){logger[_0xe7ef('0x24')](_0x34694b[_0xe7ef('0x25')]);if(_0x34694b[_0xe7ef('0x26')]){delete _0x34694b[_0xe7ef('0x26')];}_0x1fc0fd[_0xe7ef('0x16')](_0x1a720c)[_0xe7ef('0x27')](_0x34694b);};}exports['index']=function(_0x1a7525,_0x3a3111){var _0x5a9363={},_0x23e3b8={},_0x48a8cd={'count':0x0,'rows':[]};var _0x1a2b4d=_[_0xe7ef('0x28')](db[_0xe7ef('0x29')][_0xe7ef('0x2a')],function(_0x4ce1ef){return{'name':_0x4ce1ef[_0xe7ef('0x2b')],'type':_0x4ce1ef[_0xe7ef('0x2c')]['key']};});_0x23e3b8[_0xe7ef('0x2d')]=_[_0xe7ef('0x28')](_0x1a2b4d,'name');_0x23e3b8[_0xe7ef('0x2e')]=_[_0xe7ef('0x2f')](_0x1a7525[_0xe7ef('0x2e')]);_0x23e3b8[_0xe7ef('0x30')]=_[_0xe7ef('0x31')](_0x23e3b8[_0xe7ef('0x2d')],_0x23e3b8[_0xe7ef('0x2e')]);_0x5a9363['attributes']=_[_0xe7ef('0x31')](_0x23e3b8[_0xe7ef('0x2d')],qs['fields'](_0x1a7525[_0xe7ef('0x2e')][_0xe7ef('0x32')]));_0x5a9363['attributes']=_0x5a9363[_0xe7ef('0x33')][_0xe7ef('0x34')]?_0x5a9363[_0xe7ef('0x33')]:_0x23e3b8[_0xe7ef('0x2d')];if(!_0x1a7525[_0xe7ef('0x2e')][_0xe7ef('0x35')]('nolimit')){_0x5a9363['limit']=qs[_0xe7ef('0x18')](_0x1a7525[_0xe7ef('0x2e')][_0xe7ef('0x18')]);_0x5a9363[_0xe7ef('0x1b')]=qs[_0xe7ef('0x1b')](_0x1a7525[_0xe7ef('0x2e')]['offset']);}_0x5a9363[_0xe7ef('0x36')]=qs[_0xe7ef('0x37')](_0x1a7525[_0xe7ef('0x2e')][_0xe7ef('0x37')]);_0x5a9363[_0xe7ef('0x38')]=qs[_0xe7ef('0x30')](_[_0xe7ef('0x39')](_0x1a7525['query'],_0x23e3b8[_0xe7ef('0x30')]),_0x1a2b4d);if(_0x1a7525[_0xe7ef('0x2e')][_0xe7ef('0x3a')]){_0x5a9363['where']=_[_0xe7ef('0x3b')](_0x5a9363[_0xe7ef('0x38')],{'$or':_['map'](_0x1a2b4d,function(_0x3f7467){if(_0x3f7467[_0xe7ef('0x2c')]!=='VIRTUAL'){var _0x25e0b2={};_0x25e0b2[_0x3f7467[_0xe7ef('0x26')]]={'$like':'%'+_0x1a7525[_0xe7ef('0x2e')]['filter']+'%'};return _0x25e0b2;}})});}_0x5a9363=_[_0xe7ef('0x3b')]({},_0x5a9363,_0x1a7525[_0xe7ef('0x3c')]);var _0x5d24d8={'where':_0x5a9363[_0xe7ef('0x38')]};return db[_0xe7ef('0x29')][_0xe7ef('0x1a')](_0x5d24d8)[_0xe7ef('0x20')](function(_0x4ffab0){_0x48a8cd[_0xe7ef('0x1a')]=_0x4ffab0;if(_0x1a7525[_0xe7ef('0x2e')][_0xe7ef('0x3d')]){_0x5a9363[_0xe7ef('0x3e')]=[{'all':!![]}];}return db[_0xe7ef('0x29')]['findAll'](_0x5a9363);})[_0xe7ef('0x20')](function(_0x3b639e){_0x48a8cd['rows']=_0x3b639e;return _0x48a8cd;})[_0xe7ef('0x20')](respondWithFilteredResult(_0x3a3111,_0x5a9363))[_0xe7ef('0x3f')](handleError(_0x3a3111,null));};exports['show']=function(_0x8af185,_0x26ddb9){var _0x4f68d4={'raw':![],'where':{'id':_0x8af185[_0xe7ef('0x40')]['id']}},_0x2ca687={};_0x2ca687[_0xe7ef('0x2d')]=_[_0xe7ef('0x2f')](db[_0xe7ef('0x29')][_0xe7ef('0x2a')]);_0x2ca687[_0xe7ef('0x2e')]=_[_0xe7ef('0x2f')](_0x8af185['query']);_0x2ca687['filters']=_[_0xe7ef('0x31')](_0x2ca687[_0xe7ef('0x2d')],_0x2ca687[_0xe7ef('0x2e')]);_0x4f68d4[_0xe7ef('0x33')]=_[_0xe7ef('0x31')](_0x2ca687[_0xe7ef('0x2d')],qs[_0xe7ef('0x32')](_0x8af185[_0xe7ef('0x2e')][_0xe7ef('0x32')]));_0x4f68d4[_0xe7ef('0x33')]=_0x4f68d4[_0xe7ef('0x33')][_0xe7ef('0x34')]?_0x4f68d4[_0xe7ef('0x33')]:_0x2ca687[_0xe7ef('0x2d')];if(_0x8af185['query']['includeAll']){_0x4f68d4['include']=[{'all':!![]}];}_0x4f68d4=_[_0xe7ef('0x3b')]({},_0x4f68d4,_0x8af185[_0xe7ef('0x3c')]);return db[_0xe7ef('0x29')][_0xe7ef('0x41')](_0x4f68d4)[_0xe7ef('0x20')](handleEntityNotFound(_0x26ddb9,null))['then'](respondWithResult(_0x26ddb9,null))[_0xe7ef('0x3f')](handleError(_0x26ddb9,null));};exports['create']=function(_0x5ef93c,_0x903293){return db['DeskConfiguration'][_0xe7ef('0x42')](_0x5ef93c[_0xe7ef('0x43')],{})[_0xe7ef('0x20')](respondWithResult(_0x903293,0xc9))[_0xe7ef('0x3f')](handleError(_0x903293,null));};exports[_0xe7ef('0x1f')]=function(_0x2b99ae,_0x2c50d9){if(_0x2b99ae[_0xe7ef('0x43')]['id']){delete _0x2b99ae[_0xe7ef('0x43')]['id'];}return db[_0xe7ef('0x29')][_0xe7ef('0x41')]({'where':{'id':_0x2b99ae['params']['id']}})[_0xe7ef('0x20')](handleEntityNotFound(_0x2c50d9,null))['then'](saveUpdates(_0x2b99ae[_0xe7ef('0x43')],null))['then'](respondWithResult(_0x2c50d9,null))[_0xe7ef('0x3f')](handleError(_0x2c50d9,null));};exports[_0xe7ef('0x21')]=function(_0x5dfcc0,_0x5d3f21){return db['DeskConfiguration']['find']({'where':{'id':_0x5dfcc0[_0xe7ef('0x40')]['id']}})[_0xe7ef('0x20')](handleEntityNotFound(_0x5d3f21,null))['then'](removeEntity(_0x5d3f21,null))[_0xe7ef('0x3f')](handleError(_0x5d3f21,null));};exports[_0xe7ef('0x44')]=function(_0x5e62f0,_0x22db8b,_0x374912){var _0x4fd646={};var _0x2b3a88={};var _0xf43567;var _0x4186bd;return db[_0xe7ef('0x29')][_0xe7ef('0x45')]({'where':{'id':_0x5e62f0[_0xe7ef('0x40')]['id']}})[_0xe7ef('0x20')](handleEntityNotFound(_0x22db8b,null))[_0xe7ef('0x20')](function(_0x48611f){if(_0x48611f){_0xf43567=_0x48611f;_0x2b3a88[_0xe7ef('0x2d')]=_[_0xe7ef('0x2f')](db[_0xe7ef('0x46')][_0xe7ef('0x2a')]);_0x2b3a88['query']=_['keys'](_0x5e62f0[_0xe7ef('0x2e')]);_0x2b3a88['filters']=_['intersection'](_0x2b3a88[_0xe7ef('0x2d')],_0x2b3a88[_0xe7ef('0x2e')]);_0x4fd646['attributes']=_[_0xe7ef('0x31')](_0x2b3a88[_0xe7ef('0x2d')],qs[_0xe7ef('0x32')](_0x5e62f0[_0xe7ef('0x2e')]['fields']));_0x4fd646[_0xe7ef('0x33')]=_0x4fd646['attributes'][_0xe7ef('0x34')]?_0x4fd646[_0xe7ef('0x33')]:_0x2b3a88['model'];_0x4fd646['order']=qs[_0xe7ef('0x37')](_0x5e62f0[_0xe7ef('0x2e')][_0xe7ef('0x37')]);_0x4fd646[_0xe7ef('0x38')]=qs[_0xe7ef('0x30')](_[_0xe7ef('0x39')](_0x5e62f0[_0xe7ef('0x2e')],_0x2b3a88[_0xe7ef('0x30')]));if(_0x5e62f0[_0xe7ef('0x2e')][_0xe7ef('0x3a')]){_0x4fd646[_0xe7ef('0x38')]=_[_0xe7ef('0x3b')](_0x4fd646[_0xe7ef('0x38')],{'$or':_[_0xe7ef('0x28')](_0x4fd646['attributes'],function(_0x443ce3){var _0x1216a0={};_0x1216a0[_0x443ce3]={'$like':'%'+_0x5e62f0['query'][_0xe7ef('0x3a')]+'%'};return _0x1216a0;})});}_0x4fd646=_[_0xe7ef('0x3b')]({},_0x4fd646,_0x5e62f0[_0xe7ef('0x3c')]);return _0xf43567[_0xe7ef('0x44')](_0x4fd646);}})['then'](function(_0x2ce05f){if(_0x2ce05f){_0x4186bd=_0x2ce05f[_0xe7ef('0x34')];if(!_0x5e62f0[_0xe7ef('0x2e')]['hasOwnProperty'](_0xe7ef('0x47'))){_0x4fd646[_0xe7ef('0x18')]=qs['limit'](_0x5e62f0[_0xe7ef('0x2e')][_0xe7ef('0x18')]);_0x4fd646[_0xe7ef('0x1b')]=qs['offset'](_0x5e62f0[_0xe7ef('0x2e')][_0xe7ef('0x1b')]);}return _0xf43567[_0xe7ef('0x44')](_0x4fd646);}})[_0xe7ef('0x20')](function(_0x274ad5){if(_0x274ad5){return _0x274ad5?{'count':_0x4186bd,'rows':_0x274ad5}:null;}})[_0xe7ef('0x20')](respondWithResult(_0x22db8b,null))[_0xe7ef('0x3f')](handleError(_0x22db8b,null));};exports[_0xe7ef('0x48')]=function(_0x350bfa,_0x34341e,_0x52cc1a){var _0x3c3db3={};var _0x298a1c={};var _0x106cd5;var _0x412563;return db[_0xe7ef('0x29')][_0xe7ef('0x45')]({'where':{'id':_0x350bfa[_0xe7ef('0x40')]['id']}})[_0xe7ef('0x20')](handleEntityNotFound(_0x34341e,null))[_0xe7ef('0x20')](function(_0x9e986f){if(_0x9e986f){_0x106cd5=_0x9e986f;_0x298a1c[_0xe7ef('0x2d')]=_[_0xe7ef('0x2f')](db['DeskField']['rawAttributes']);_0x298a1c[_0xe7ef('0x2e')]=_[_0xe7ef('0x2f')](_0x350bfa[_0xe7ef('0x2e')]);_0x298a1c[_0xe7ef('0x30')]=_[_0xe7ef('0x31')](_0x298a1c[_0xe7ef('0x2d')],_0x298a1c[_0xe7ef('0x2e')]);_0x3c3db3[_0xe7ef('0x33')]=_[_0xe7ef('0x31')](_0x298a1c[_0xe7ef('0x2d')],qs['fields'](_0x350bfa[_0xe7ef('0x2e')][_0xe7ef('0x32')]));_0x3c3db3[_0xe7ef('0x33')]=_0x3c3db3[_0xe7ef('0x33')]['length']?_0x3c3db3['attributes']:_0x298a1c[_0xe7ef('0x2d')];_0x3c3db3[_0xe7ef('0x36')]=qs['sort'](_0x350bfa[_0xe7ef('0x2e')][_0xe7ef('0x37')]);_0x3c3db3[_0xe7ef('0x38')]=qs[_0xe7ef('0x30')](_[_0xe7ef('0x39')](_0x350bfa[_0xe7ef('0x2e')],_0x298a1c[_0xe7ef('0x30')]));if(_0x350bfa['query'][_0xe7ef('0x3a')]){_0x3c3db3[_0xe7ef('0x38')]=_[_0xe7ef('0x3b')](_0x3c3db3['where'],{'$or':_['map'](_0x3c3db3[_0xe7ef('0x33')],function(_0xb12fcd){var _0x3a0fbb={};_0x3a0fbb[_0xb12fcd]={'$like':'%'+_0x350bfa['query'][_0xe7ef('0x3a')]+'%'};return _0x3a0fbb;})});}_0x3c3db3=_[_0xe7ef('0x3b')]({},_0x3c3db3,_0x350bfa[_0xe7ef('0x3c')]);return _0x106cd5[_0xe7ef('0x48')](_0x3c3db3);}})[_0xe7ef('0x20')](function(_0xbaa146){if(_0xbaa146){_0x412563=_0xbaa146[_0xe7ef('0x34')];if(!_0x350bfa[_0xe7ef('0x2e')]['hasOwnProperty'](_0xe7ef('0x47'))){_0x3c3db3[_0xe7ef('0x18')]=qs['limit'](_0x350bfa['query'][_0xe7ef('0x18')]);_0x3c3db3[_0xe7ef('0x1b')]=qs[_0xe7ef('0x1b')](_0x350bfa['query'][_0xe7ef('0x1b')]);}return _0x106cd5['getSubjects'](_0x3c3db3);}})['then'](function(_0x4c67ee){if(_0x4c67ee){return _0x4c67ee?{'count':_0x412563,'rows':_0x4c67ee}:null;}})[_0xe7ef('0x20')](respondWithResult(_0x34341e,null))[_0xe7ef('0x3f')](handleError(_0x34341e,null));};exports[_0xe7ef('0x49')]=function(_0x1b9225,_0x12eb6e,_0x2bb3c4){var _0x45683e={};var _0x5a8031={};var _0x3333d7;var _0x1abf7e;return db[_0xe7ef('0x29')][_0xe7ef('0x45')]({'where':{'id':_0x1b9225['params']['id']}})[_0xe7ef('0x20')](handleEntityNotFound(_0x12eb6e,null))[_0xe7ef('0x20')](function(_0x2cc404){if(_0x2cc404){_0x3333d7=_0x2cc404;_0x5a8031['model']=_['keys'](db[_0xe7ef('0x46')][_0xe7ef('0x2a')]);_0x5a8031[_0xe7ef('0x2e')]=_['keys'](_0x1b9225['query']);_0x5a8031[_0xe7ef('0x30')]=_['intersection'](_0x5a8031[_0xe7ef('0x2d')],_0x5a8031[_0xe7ef('0x2e')]);_0x45683e[_0xe7ef('0x33')]=_[_0xe7ef('0x31')](_0x5a8031['model'],qs[_0xe7ef('0x32')](_0x1b9225[_0xe7ef('0x2e')][_0xe7ef('0x32')]));_0x45683e[_0xe7ef('0x33')]=_0x45683e['attributes'][_0xe7ef('0x34')]?_0x45683e[_0xe7ef('0x33')]:_0x5a8031[_0xe7ef('0x2d')];_0x45683e[_0xe7ef('0x36')]=qs['sort'](_0x1b9225[_0xe7ef('0x2e')][_0xe7ef('0x37')]);_0x45683e[_0xe7ef('0x38')]=qs['filters'](_['pick'](_0x1b9225[_0xe7ef('0x2e')],_0x5a8031[_0xe7ef('0x30')]));if(_0x1b9225[_0xe7ef('0x2e')][_0xe7ef('0x3a')]){_0x45683e[_0xe7ef('0x38')]=_['merge'](_0x45683e[_0xe7ef('0x38')],{'$or':_[_0xe7ef('0x28')](_0x45683e['attributes'],function(_0x24fe98){var _0x2c2892={};_0x2c2892[_0x24fe98]={'$like':'%'+_0x1b9225[_0xe7ef('0x2e')][_0xe7ef('0x3a')]+'%'};return _0x2c2892;})});}_0x45683e=_['merge']({},_0x45683e,_0x1b9225[_0xe7ef('0x3c')]);return _0x3333d7['getDescriptions'](_0x45683e);}})[_0xe7ef('0x20')](function(_0x15a6df){if(_0x15a6df){_0x1abf7e=_0x15a6df['length'];if(!_0x1b9225[_0xe7ef('0x2e')]['hasOwnProperty'](_0xe7ef('0x47'))){_0x45683e['limit']=qs[_0xe7ef('0x18')](_0x1b9225['query'][_0xe7ef('0x18')]);_0x45683e[_0xe7ef('0x1b')]=qs['offset'](_0x1b9225[_0xe7ef('0x2e')][_0xe7ef('0x1b')]);}return _0x3333d7[_0xe7ef('0x49')](_0x45683e);}})[_0xe7ef('0x20')](function(_0x339858){if(_0x339858){return _0x339858?{'count':_0x1abf7e,'rows':_0x339858}:null;}})[_0xe7ef('0x20')](respondWithResult(_0x12eb6e,null))[_0xe7ef('0x3f')](handleError(_0x12eb6e,null));};exports[_0xe7ef('0x4a')]=function(_0x20e485,_0x3f7bf6,_0x26fdbc){var _0x3333a8={};var _0x2eccae={};var _0x473564;var _0x455981;return db['DeskConfiguration']['findOne']({'where':{'id':_0x20e485['params']['id']}})['then'](handleEntityNotFound(_0x3f7bf6,null))[_0xe7ef('0x20')](function(_0x996795){if(_0x996795){_0x473564=_0x996795;_0x2eccae[_0xe7ef('0x2d')]=_[_0xe7ef('0x2f')](db[_0xe7ef('0x4b')][_0xe7ef('0x2a')]);_0x2eccae[_0xe7ef('0x2e')]=_[_0xe7ef('0x2f')](_0x20e485['query']);_0x2eccae[_0xe7ef('0x30')]=_[_0xe7ef('0x31')](_0x2eccae['model'],_0x2eccae[_0xe7ef('0x2e')]);_0x3333a8['attributes']=_[_0xe7ef('0x31')](_0x2eccae[_0xe7ef('0x2d')],qs['fields'](_0x20e485['query'][_0xe7ef('0x32')]));_0x3333a8[_0xe7ef('0x33')]=_0x3333a8['attributes'][_0xe7ef('0x34')]?_0x3333a8['attributes']:_0x2eccae[_0xe7ef('0x2d')];_0x3333a8[_0xe7ef('0x36')]=qs[_0xe7ef('0x37')](_0x20e485['query'][_0xe7ef('0x37')]);_0x3333a8[_0xe7ef('0x38')]=qs['filters'](_['pick'](_0x20e485[_0xe7ef('0x2e')],_0x2eccae[_0xe7ef('0x30')]));if(_0x20e485[_0xe7ef('0x2e')]['filter']){_0x3333a8[_0xe7ef('0x38')]=_[_0xe7ef('0x3b')](_0x3333a8[_0xe7ef('0x38')],{'$or':_[_0xe7ef('0x28')](_0x3333a8[_0xe7ef('0x33')],function(_0x432914){var _0x283db6={};_0x283db6[_0x432914]={'$like':'%'+_0x20e485[_0xe7ef('0x2e')][_0xe7ef('0x3a')]+'%'};return _0x283db6;})});}_0x3333a8=_['merge']({},_0x3333a8,_0x20e485[_0xe7ef('0x3c')]);return _0x473564[_0xe7ef('0x4a')](_0x3333a8);}})[_0xe7ef('0x20')](function(_0x5469c3){if(_0x5469c3){_0x455981=_0x5469c3['length'];if(!_0x20e485[_0xe7ef('0x2e')][_0xe7ef('0x35')](_0xe7ef('0x47'))){_0x3333a8['limit']=qs[_0xe7ef('0x18')](_0x20e485[_0xe7ef('0x2e')][_0xe7ef('0x18')]);_0x3333a8[_0xe7ef('0x1b')]=qs['offset'](_0x20e485[_0xe7ef('0x2e')][_0xe7ef('0x1b')]);}return _0x473564[_0xe7ef('0x4a')](_0x3333a8);}})[_0xe7ef('0x20')](function(_0x3e68b6){if(_0x3e68b6){return _0x3e68b6?{'count':_0x455981,'rows':_0x3e68b6}:null;}})['then'](respondWithResult(_0x3f7bf6,null))[_0xe7ef('0x3f')](handleError(_0x3f7bf6,null));};exports['setTags']=function(_0x2038ca,_0x4fe10d,_0x2720a6){if(_0x2038ca['body']['id']){delete _0x2038ca[_0xe7ef('0x43')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x2038ca[_0xe7ef('0x40')]['id']}})['then'](handleEntityNotFound(_0x4fe10d,null))[_0xe7ef('0x20')](function(_0xe36a6f){if(_0xe36a6f){return _0xe36a6f[_0xe7ef('0x4c')](_0x2038ca[_0xe7ef('0x43')][_0xe7ef('0x4d')]||[]);}return null;})['then'](respondWithResult(_0x4fe10d,null))['catch'](handleError(_0x4fe10d,null));}; \ No newline at end of file +var _0xe77b=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','filter','options','DeskConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','findOne','DeskField','pick','getFields','getSubjects','getDescriptions','getTags','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0x1b4ca5,_0x577148){var _0x15948e=function(_0x453039){while(--_0x453039){_0x1b4ca5['push'](_0x1b4ca5['shift']());}};_0x15948e(++_0x577148);}(_0xe77b,0x97));var _0xbe77=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe77b[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe77('0x0'));var zipdir=require(_0xbe77('0x1'));var jsonpatch=require(_0xbe77('0x2'));var rp=require(_0xbe77('0x3'));var moment=require(_0xbe77('0x4'));var BPromise=require(_0xbe77('0x5'));var Mustache=require('mustache');var util=require(_0xbe77('0x6'));var path=require(_0xbe77('0x7'));var sox=require(_0xbe77('0x8'));var csv=require(_0xbe77('0x9'));var ejs=require(_0xbe77('0xa'));var fs=require('fs');var fs_extra=require(_0xbe77('0xb'));var _=require(_0xbe77('0xc'));var squel=require('squel');var crypto=require(_0xbe77('0xd'));var jsforce=require(_0xbe77('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe77('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbe77('0x10'));var qs=require(_0xbe77('0x11'));var as=require(_0xbe77('0x12'));var hardwareService=require(_0xbe77('0x13'));var logger=require(_0xbe77('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xbe77('0x15'));var licenseUtil=require(_0xbe77('0x16'));var db=require(_0xbe77('0x17'))['db'];function respondWithStatusCode(_0x5769fc,_0x1e5a03){_0x1e5a03=_0x1e5a03||0xcc;return function(_0x41f2d9){if(_0x41f2d9){return _0x5769fc[_0xbe77('0x18')](_0x1e5a03);}return _0x5769fc[_0xbe77('0x19')](_0x1e5a03)[_0xbe77('0x1a')]();};}function respondWithResult(_0x34234b,_0x275a1e){_0x275a1e=_0x275a1e||0xc8;return function(_0x4f6f9c){if(_0x4f6f9c){return _0x34234b[_0xbe77('0x19')](_0x275a1e)['json'](_0x4f6f9c);}};}function respondWithFilteredResult(_0x424639,_0x4d637e){return function(_0x4754db){if(_0x4754db){var _0x744e32=typeof _0x4d637e[_0xbe77('0x1b')]===_0xbe77('0x1c')&&typeof _0x4d637e['limit']===_0xbe77('0x1c');var _0xccf131=_0x4754db[_0xbe77('0x1d')];var _0xcefad4=_0x744e32?0x0:_0x4d637e[_0xbe77('0x1b')];var _0x430d53=_0x744e32?_0x4754db[_0xbe77('0x1d')]:_0x4d637e['offset']+_0x4d637e['limit'];var _0x1d767c;if(_0x430d53>=_0xccf131){_0x430d53=_0xccf131;_0x1d767c=0xc8;}else{_0x1d767c=0xce;}_0x424639['status'](_0x1d767c);return _0x424639[_0xbe77('0x1e')](_0xbe77('0x1f'),_0xcefad4+'-'+_0x430d53+'/'+_0xccf131)[_0xbe77('0x20')](_0x4754db);}return null;};}function patchUpdates(_0x5b477d){return function(_0x582ef4){try{jsonpatch[_0xbe77('0x21')](_0x582ef4,_0x5b477d,!![]);}catch(_0x532d68){return BPromise['reject'](_0x532d68);}return _0x582ef4['save']();};}function saveUpdates(_0x35e1cf,_0x31fd36){return function(_0x37a65e){if(_0x37a65e){return _0x37a65e[_0xbe77('0x22')](_0x35e1cf)[_0xbe77('0x23')](function(_0x2eeeba){return _0x2eeeba;});}return null;};}function removeEntity(_0x115a22,_0xc2f2c6){return function(_0x440b3f){if(_0x440b3f){return _0x440b3f['destroy']()[_0xbe77('0x23')](function(){_0x115a22[_0xbe77('0x19')](0xcc)[_0xbe77('0x1a')]();});}};}function handleEntityNotFound(_0x51f1f6,_0xbf8978){return function(_0x2be818){if(!_0x2be818){_0x51f1f6[_0xbe77('0x18')](0x194);}return _0x2be818;};}function handleError(_0x620d85,_0x31ab3d){_0x31ab3d=_0x31ab3d||0x1f4;return function(_0x598909){logger[_0xbe77('0x24')](_0x598909['stack']);if(_0x598909[_0xbe77('0x25')]){delete _0x598909[_0xbe77('0x25')];}_0x620d85[_0xbe77('0x19')](_0x31ab3d)[_0xbe77('0x26')](_0x598909);};}exports['index']=function(_0x1433e8,_0x2a1ebe){var _0x1739e3={},_0xc52923={},_0x57ffe9={'count':0x0,'rows':[]};var _0x11efcc=_[_0xbe77('0x27')](db['DeskConfiguration'][_0xbe77('0x28')],function(_0x30ad98){return{'name':_0x30ad98[_0xbe77('0x29')],'type':_0x30ad98[_0xbe77('0x2a')][_0xbe77('0x2b')]};});_0xc52923[_0xbe77('0x2c')]=_[_0xbe77('0x27')](_0x11efcc,'name');_0xc52923[_0xbe77('0x2d')]=_['keys'](_0x1433e8[_0xbe77('0x2d')]);_0xc52923[_0xbe77('0x2e')]=_[_0xbe77('0x2f')](_0xc52923[_0xbe77('0x2c')],_0xc52923[_0xbe77('0x2d')]);_0x1739e3[_0xbe77('0x30')]=_['intersection'](_0xc52923['model'],qs[_0xbe77('0x31')](_0x1433e8[_0xbe77('0x2d')][_0xbe77('0x31')]));_0x1739e3[_0xbe77('0x30')]=_0x1739e3['attributes'][_0xbe77('0x32')]?_0x1739e3[_0xbe77('0x30')]:_0xc52923[_0xbe77('0x2c')];if(!_0x1433e8[_0xbe77('0x2d')][_0xbe77('0x33')](_0xbe77('0x34'))){_0x1739e3[_0xbe77('0x35')]=qs['limit'](_0x1433e8['query'][_0xbe77('0x35')]);_0x1739e3['offset']=qs[_0xbe77('0x1b')](_0x1433e8[_0xbe77('0x2d')][_0xbe77('0x1b')]);}_0x1739e3[_0xbe77('0x36')]=qs[_0xbe77('0x37')](_0x1433e8['query'][_0xbe77('0x37')]);_0x1739e3[_0xbe77('0x38')]=qs[_0xbe77('0x2e')](_['pick'](_0x1433e8['query'],_0xc52923[_0xbe77('0x2e')]),_0x11efcc);if(_0x1433e8[_0xbe77('0x2d')]['filter']){_0x1739e3[_0xbe77('0x38')]=_[_0xbe77('0x39')](_0x1739e3[_0xbe77('0x38')],{'$or':_[_0xbe77('0x27')](_0x11efcc,function(_0x4ad1b5){if(_0x4ad1b5['type']!=='VIRTUAL'){var _0x905930={};_0x905930[_0x4ad1b5[_0xbe77('0x25')]]={'$like':'%'+_0x1433e8[_0xbe77('0x2d')][_0xbe77('0x3a')]+'%'};return _0x905930;}})});}_0x1739e3=_[_0xbe77('0x39')]({},_0x1739e3,_0x1433e8[_0xbe77('0x3b')]);var _0x18dc79={'where':_0x1739e3['where']};return db[_0xbe77('0x3c')][_0xbe77('0x1d')](_0x18dc79)[_0xbe77('0x23')](function(_0x3a132a){_0x57ffe9[_0xbe77('0x1d')]=_0x3a132a;if(_0x1433e8['query'][_0xbe77('0x3d')]){_0x1739e3[_0xbe77('0x3e')]=[{'all':!![]}];}return db[_0xbe77('0x3c')][_0xbe77('0x3f')](_0x1739e3);})[_0xbe77('0x23')](function(_0x5d3796){_0x57ffe9[_0xbe77('0x40')]=_0x5d3796;return _0x57ffe9;})[_0xbe77('0x23')](respondWithFilteredResult(_0x2a1ebe,_0x1739e3))[_0xbe77('0x41')](handleError(_0x2a1ebe,null));};exports[_0xbe77('0x42')]=function(_0x959c0e,_0x5859d8){var _0x40dbf2={'raw':![],'where':{'id':_0x959c0e[_0xbe77('0x43')]['id']}},_0x2d7b86={};_0x2d7b86[_0xbe77('0x2c')]=_[_0xbe77('0x44')](db[_0xbe77('0x3c')][_0xbe77('0x28')]);_0x2d7b86[_0xbe77('0x2d')]=_[_0xbe77('0x44')](_0x959c0e[_0xbe77('0x2d')]);_0x2d7b86[_0xbe77('0x2e')]=_[_0xbe77('0x2f')](_0x2d7b86[_0xbe77('0x2c')],_0x2d7b86[_0xbe77('0x2d')]);_0x40dbf2[_0xbe77('0x30')]=_['intersection'](_0x2d7b86[_0xbe77('0x2c')],qs[_0xbe77('0x31')](_0x959c0e[_0xbe77('0x2d')][_0xbe77('0x31')]));_0x40dbf2[_0xbe77('0x30')]=_0x40dbf2[_0xbe77('0x30')]['length']?_0x40dbf2[_0xbe77('0x30')]:_0x2d7b86['model'];if(_0x959c0e[_0xbe77('0x2d')][_0xbe77('0x3d')]){_0x40dbf2[_0xbe77('0x3e')]=[{'all':!![]}];}_0x40dbf2=_['merge']({},_0x40dbf2,_0x959c0e[_0xbe77('0x3b')]);return db[_0xbe77('0x3c')][_0xbe77('0x45')](_0x40dbf2)[_0xbe77('0x23')](handleEntityNotFound(_0x5859d8,null))[_0xbe77('0x23')](respondWithResult(_0x5859d8,null))[_0xbe77('0x41')](handleError(_0x5859d8,null));};exports['create']=function(_0x31bf81,_0x10462b){return db[_0xbe77('0x3c')][_0xbe77('0x46')](_0x31bf81[_0xbe77('0x47')],{})[_0xbe77('0x23')](respondWithResult(_0x10462b,0xc9))[_0xbe77('0x41')](handleError(_0x10462b,null));};exports[_0xbe77('0x22')]=function(_0x23be23,_0x5719e6){if(_0x23be23[_0xbe77('0x47')]['id']){delete _0x23be23['body']['id'];}return db[_0xbe77('0x3c')][_0xbe77('0x45')]({'where':{'id':_0x23be23['params']['id']}})[_0xbe77('0x23')](handleEntityNotFound(_0x5719e6,null))[_0xbe77('0x23')](saveUpdates(_0x23be23[_0xbe77('0x47')],null))[_0xbe77('0x23')](respondWithResult(_0x5719e6,null))[_0xbe77('0x41')](handleError(_0x5719e6,null));};exports['destroy']=function(_0x2f2616,_0x3f40b8){return db['DeskConfiguration'][_0xbe77('0x45')]({'where':{'id':_0x2f2616[_0xbe77('0x43')]['id']}})[_0xbe77('0x23')](handleEntityNotFound(_0x3f40b8,null))['then'](removeEntity(_0x3f40b8,null))[_0xbe77('0x41')](handleError(_0x3f40b8,null));};exports['getFields']=function(_0x14a983,_0x377ed9,_0xdc103){var _0x3b1bee={};var _0x3b0b1d={};var _0x154326;var _0x59154e;return db[_0xbe77('0x3c')][_0xbe77('0x48')]({'where':{'id':_0x14a983[_0xbe77('0x43')]['id']}})[_0xbe77('0x23')](handleEntityNotFound(_0x377ed9,null))[_0xbe77('0x23')](function(_0x574cfa){if(_0x574cfa){_0x154326=_0x574cfa;_0x3b0b1d[_0xbe77('0x2c')]=_[_0xbe77('0x44')](db[_0xbe77('0x49')][_0xbe77('0x28')]);_0x3b0b1d[_0xbe77('0x2d')]=_['keys'](_0x14a983[_0xbe77('0x2d')]);_0x3b0b1d[_0xbe77('0x2e')]=_[_0xbe77('0x2f')](_0x3b0b1d['model'],_0x3b0b1d[_0xbe77('0x2d')]);_0x3b1bee[_0xbe77('0x30')]=_[_0xbe77('0x2f')](_0x3b0b1d[_0xbe77('0x2c')],qs['fields'](_0x14a983['query'][_0xbe77('0x31')]));_0x3b1bee['attributes']=_0x3b1bee[_0xbe77('0x30')]['length']?_0x3b1bee[_0xbe77('0x30')]:_0x3b0b1d[_0xbe77('0x2c')];_0x3b1bee[_0xbe77('0x36')]=qs[_0xbe77('0x37')](_0x14a983['query']['sort']);_0x3b1bee[_0xbe77('0x38')]=qs['filters'](_[_0xbe77('0x4a')](_0x14a983[_0xbe77('0x2d')],_0x3b0b1d[_0xbe77('0x2e')]));if(_0x14a983[_0xbe77('0x2d')][_0xbe77('0x3a')]){_0x3b1bee['where']=_[_0xbe77('0x39')](_0x3b1bee[_0xbe77('0x38')],{'$or':_[_0xbe77('0x27')](_0x3b1bee[_0xbe77('0x30')],function(_0xcd03d5){var _0x2b251b={};_0x2b251b[_0xcd03d5]={'$like':'%'+_0x14a983['query'][_0xbe77('0x3a')]+'%'};return _0x2b251b;})});}_0x3b1bee=_[_0xbe77('0x39')]({},_0x3b1bee,_0x14a983[_0xbe77('0x3b')]);return _0x154326[_0xbe77('0x4b')](_0x3b1bee);}})[_0xbe77('0x23')](function(_0x49c166){if(_0x49c166){_0x59154e=_0x49c166['length'];if(!_0x14a983[_0xbe77('0x2d')][_0xbe77('0x33')](_0xbe77('0x34'))){_0x3b1bee['limit']=qs[_0xbe77('0x35')](_0x14a983['query']['limit']);_0x3b1bee['offset']=qs['offset'](_0x14a983['query'][_0xbe77('0x1b')]);}return _0x154326[_0xbe77('0x4b')](_0x3b1bee);}})[_0xbe77('0x23')](function(_0x123a94){if(_0x123a94){return _0x123a94?{'count':_0x59154e,'rows':_0x123a94}:null;}})[_0xbe77('0x23')](respondWithResult(_0x377ed9,null))[_0xbe77('0x41')](handleError(_0x377ed9,null));};exports['getSubjects']=function(_0x542ab8,_0x5dbc42,_0x442f0d){var _0x128378={};var _0x2b6b6d={};var _0x5efabe;var _0x10b70e;return db[_0xbe77('0x3c')]['findOne']({'where':{'id':_0x542ab8[_0xbe77('0x43')]['id']}})[_0xbe77('0x23')](handleEntityNotFound(_0x5dbc42,null))[_0xbe77('0x23')](function(_0x207166){if(_0x207166){_0x5efabe=_0x207166;_0x2b6b6d['model']=_[_0xbe77('0x44')](db[_0xbe77('0x49')]['rawAttributes']);_0x2b6b6d[_0xbe77('0x2d')]=_[_0xbe77('0x44')](_0x542ab8[_0xbe77('0x2d')]);_0x2b6b6d[_0xbe77('0x2e')]=_[_0xbe77('0x2f')](_0x2b6b6d[_0xbe77('0x2c')],_0x2b6b6d[_0xbe77('0x2d')]);_0x128378['attributes']=_['intersection'](_0x2b6b6d[_0xbe77('0x2c')],qs[_0xbe77('0x31')](_0x542ab8['query']['fields']));_0x128378['attributes']=_0x128378[_0xbe77('0x30')]['length']?_0x128378['attributes']:_0x2b6b6d['model'];_0x128378['order']=qs[_0xbe77('0x37')](_0x542ab8[_0xbe77('0x2d')][_0xbe77('0x37')]);_0x128378[_0xbe77('0x38')]=qs[_0xbe77('0x2e')](_[_0xbe77('0x4a')](_0x542ab8[_0xbe77('0x2d')],_0x2b6b6d['filters']));if(_0x542ab8[_0xbe77('0x2d')][_0xbe77('0x3a')]){_0x128378[_0xbe77('0x38')]=_['merge'](_0x128378['where'],{'$or':_[_0xbe77('0x27')](_0x128378[_0xbe77('0x30')],function(_0x5773f8){var _0x27d35a={};_0x27d35a[_0x5773f8]={'$like':'%'+_0x542ab8[_0xbe77('0x2d')][_0xbe77('0x3a')]+'%'};return _0x27d35a;})});}_0x128378=_['merge']({},_0x128378,_0x542ab8[_0xbe77('0x3b')]);return _0x5efabe[_0xbe77('0x4c')](_0x128378);}})[_0xbe77('0x23')](function(_0x2ef666){if(_0x2ef666){_0x10b70e=_0x2ef666[_0xbe77('0x32')];if(!_0x542ab8[_0xbe77('0x2d')][_0xbe77('0x33')](_0xbe77('0x34'))){_0x128378['limit']=qs[_0xbe77('0x35')](_0x542ab8['query'][_0xbe77('0x35')]);_0x128378['offset']=qs[_0xbe77('0x1b')](_0x542ab8[_0xbe77('0x2d')]['offset']);}return _0x5efabe[_0xbe77('0x4c')](_0x128378);}})['then'](function(_0x3d36d0){if(_0x3d36d0){return _0x3d36d0?{'count':_0x10b70e,'rows':_0x3d36d0}:null;}})[_0xbe77('0x23')](respondWithResult(_0x5dbc42,null))[_0xbe77('0x41')](handleError(_0x5dbc42,null));};exports[_0xbe77('0x4d')]=function(_0x499ca9,_0x1d179,_0x1e3010){var _0xf68f46={};var _0x1d0ca8={};var _0x3b7dde;var _0x28466a;return db[_0xbe77('0x3c')][_0xbe77('0x48')]({'where':{'id':_0x499ca9[_0xbe77('0x43')]['id']}})['then'](handleEntityNotFound(_0x1d179,null))[_0xbe77('0x23')](function(_0x3af8dd){if(_0x3af8dd){_0x3b7dde=_0x3af8dd;_0x1d0ca8[_0xbe77('0x2c')]=_[_0xbe77('0x44')](db['DeskField'][_0xbe77('0x28')]);_0x1d0ca8[_0xbe77('0x2d')]=_[_0xbe77('0x44')](_0x499ca9[_0xbe77('0x2d')]);_0x1d0ca8['filters']=_[_0xbe77('0x2f')](_0x1d0ca8['model'],_0x1d0ca8[_0xbe77('0x2d')]);_0xf68f46[_0xbe77('0x30')]=_['intersection'](_0x1d0ca8[_0xbe77('0x2c')],qs['fields'](_0x499ca9[_0xbe77('0x2d')]['fields']));_0xf68f46[_0xbe77('0x30')]=_0xf68f46[_0xbe77('0x30')][_0xbe77('0x32')]?_0xf68f46[_0xbe77('0x30')]:_0x1d0ca8[_0xbe77('0x2c')];_0xf68f46[_0xbe77('0x36')]=qs[_0xbe77('0x37')](_0x499ca9['query']['sort']);_0xf68f46[_0xbe77('0x38')]=qs[_0xbe77('0x2e')](_[_0xbe77('0x4a')](_0x499ca9[_0xbe77('0x2d')],_0x1d0ca8[_0xbe77('0x2e')]));if(_0x499ca9[_0xbe77('0x2d')][_0xbe77('0x3a')]){_0xf68f46['where']=_[_0xbe77('0x39')](_0xf68f46[_0xbe77('0x38')],{'$or':_[_0xbe77('0x27')](_0xf68f46[_0xbe77('0x30')],function(_0x223305){var _0x19d6c2={};_0x19d6c2[_0x223305]={'$like':'%'+_0x499ca9[_0xbe77('0x2d')][_0xbe77('0x3a')]+'%'};return _0x19d6c2;})});}_0xf68f46=_[_0xbe77('0x39')]({},_0xf68f46,_0x499ca9[_0xbe77('0x3b')]);return _0x3b7dde[_0xbe77('0x4d')](_0xf68f46);}})[_0xbe77('0x23')](function(_0x1c4b80){if(_0x1c4b80){_0x28466a=_0x1c4b80['length'];if(!_0x499ca9[_0xbe77('0x2d')][_0xbe77('0x33')](_0xbe77('0x34'))){_0xf68f46[_0xbe77('0x35')]=qs[_0xbe77('0x35')](_0x499ca9['query'][_0xbe77('0x35')]);_0xf68f46[_0xbe77('0x1b')]=qs[_0xbe77('0x1b')](_0x499ca9['query']['offset']);}return _0x3b7dde[_0xbe77('0x4d')](_0xf68f46);}})[_0xbe77('0x23')](function(_0x5be23c){if(_0x5be23c){return _0x5be23c?{'count':_0x28466a,'rows':_0x5be23c}:null;}})['then'](respondWithResult(_0x1d179,null))[_0xbe77('0x41')](handleError(_0x1d179,null));};exports[_0xbe77('0x4e')]=function(_0xae596f,_0x1204f1,_0x3f7d39){var _0x3a6bc6={};var _0xcfae59={};var _0x2860c4;var _0x1a565c;return db[_0xbe77('0x3c')]['findOne']({'where':{'id':_0xae596f[_0xbe77('0x43')]['id']}})[_0xbe77('0x23')](handleEntityNotFound(_0x1204f1,null))[_0xbe77('0x23')](function(_0x15cea1){if(_0x15cea1){_0x2860c4=_0x15cea1;_0xcfae59['model']=_[_0xbe77('0x44')](db['Tag'][_0xbe77('0x28')]);_0xcfae59['query']=_[_0xbe77('0x44')](_0xae596f['query']);_0xcfae59['filters']=_[_0xbe77('0x2f')](_0xcfae59[_0xbe77('0x2c')],_0xcfae59[_0xbe77('0x2d')]);_0x3a6bc6[_0xbe77('0x30')]=_['intersection'](_0xcfae59[_0xbe77('0x2c')],qs[_0xbe77('0x31')](_0xae596f[_0xbe77('0x2d')][_0xbe77('0x31')]));_0x3a6bc6['attributes']=_0x3a6bc6['attributes']['length']?_0x3a6bc6['attributes']:_0xcfae59[_0xbe77('0x2c')];_0x3a6bc6['order']=qs[_0xbe77('0x37')](_0xae596f[_0xbe77('0x2d')][_0xbe77('0x37')]);_0x3a6bc6[_0xbe77('0x38')]=qs['filters'](_[_0xbe77('0x4a')](_0xae596f[_0xbe77('0x2d')],_0xcfae59['filters']));if(_0xae596f[_0xbe77('0x2d')][_0xbe77('0x3a')]){_0x3a6bc6[_0xbe77('0x38')]=_[_0xbe77('0x39')](_0x3a6bc6[_0xbe77('0x38')],{'$or':_[_0xbe77('0x27')](_0x3a6bc6[_0xbe77('0x30')],function(_0x3179b5){var _0x4a47eb={};_0x4a47eb[_0x3179b5]={'$like':'%'+_0xae596f[_0xbe77('0x2d')][_0xbe77('0x3a')]+'%'};return _0x4a47eb;})});}_0x3a6bc6=_[_0xbe77('0x39')]({},_0x3a6bc6,_0xae596f[_0xbe77('0x3b')]);return _0x2860c4['getTags'](_0x3a6bc6);}})[_0xbe77('0x23')](function(_0x2a19ae){if(_0x2a19ae){_0x1a565c=_0x2a19ae[_0xbe77('0x32')];if(!_0xae596f[_0xbe77('0x2d')]['hasOwnProperty'](_0xbe77('0x34'))){_0x3a6bc6[_0xbe77('0x35')]=qs[_0xbe77('0x35')](_0xae596f[_0xbe77('0x2d')][_0xbe77('0x35')]);_0x3a6bc6[_0xbe77('0x1b')]=qs[_0xbe77('0x1b')](_0xae596f['query'][_0xbe77('0x1b')]);}return _0x2860c4[_0xbe77('0x4e')](_0x3a6bc6);}})[_0xbe77('0x23')](function(_0x3e7840){if(_0x3e7840){return _0x3e7840?{'count':_0x1a565c,'rows':_0x3e7840}:null;}})[_0xbe77('0x23')](respondWithResult(_0x1204f1,null))[_0xbe77('0x41')](handleError(_0x1204f1,null));};exports[_0xbe77('0x4f')]=function(_0x70dac0,_0x5f2f0d,_0x450ad1){if(_0x70dac0[_0xbe77('0x47')]['id']){delete _0x70dac0['body']['id'];}return db[_0xbe77('0x3c')][_0xbe77('0x48')]({'where':{'id':_0x70dac0[_0xbe77('0x43')]['id']}})['then'](handleEntityNotFound(_0x5f2f0d,null))[_0xbe77('0x23')](function(_0xe302ab){if(_0xe302ab){return _0xe302ab[_0xbe77('0x4f')](_0x70dac0['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x5f2f0d,null))[_0xbe77('0x41')](handleError(_0x5f2f0d,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index b73ce7c..2a8a072 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 _0xecd6=['./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x58cf07,_0x2e3858){var _0x42afe0=function(_0x3c71ff){while(--_0x3c71ff){_0x58cf07['push'](_0x58cf07['shift']());}};_0x42afe0(++_0x2e3858);}(_0xecd6,0xe1));var _0x6ecd=function(_0x278b0a,_0x1315f8){_0x278b0a=_0x278b0a-0x0;var _0x143360=_0xecd6[_0x278b0a];return _0x143360;};'use strict';var _=require(_0x6ecd('0x0'));var util=require('util');var logger=require(_0x6ecd('0x1'))(_0x6ecd('0x2'));var moment=require(_0x6ecd('0x3'));var BPromise=require(_0x6ecd('0x4'));var rp=require(_0x6ecd('0x5'));var fs=require('fs');var path=require(_0x6ecd('0x6'));var rimraf=require(_0x6ecd('0x7'));var config=require(_0x6ecd('0x8'));var attributes=require(_0x6ecd('0x9'));module[_0x6ecd('0xa')]=function(_0x1127a3,_0x33acc4){return _0x1127a3[_0x6ecd('0xb')](_0x6ecd('0xc'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd46e=['moment','bluebird','request-promise','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xd46e,0x1a3));var _0xed46=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd46e[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xed46('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xed46('0x1'));var BPromise=require(_0xed46('0x2'));var rp=require(_0xed46('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed46('0x4'));var config=require('../../config/environment');var attributes=require(_0xed46('0x5'));module[_0xed46('0x6')]=function(_0x10e0d2,_0x5a82ef){return _0x10e0d2[_0xed46('0x7')](_0xed46('0x8'),attributes,{'tableName':_0xed46('0x9'),'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 f7c0552..5345584 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 _0xa875=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x119320,_0x4fffad){var _0x1fbab1=function(_0x199b91){while(--_0x199b91){_0x119320['push'](_0x119320['shift']());}};_0x1fbab1(++_0x4fffad);}(_0xa875,0x176));var _0x5a87=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0xa875[_0x53bcc3];return _0x47c959;};'use strict';var _=require('lodash');var util=require(_0x5a87('0x0'));var moment=require(_0x5a87('0x1'));var BPromise=require(_0x5a87('0x2'));var rs=require(_0x5a87('0x3'));var fs=require('fs');var Redis=require(_0x5a87('0x4'));var db=require(_0x5a87('0x5'))['db'];var utils=require(_0x5a87('0x6'));var logger=require(_0x5a87('0x7'))('rpc');var config=require(_0x5a87('0x8'));var jayson=require(_0x5a87('0x9'));var client=jayson[_0x5a87('0xa')][_0x5a87('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5042b5,_0x428b34,_0x4ff305){return new BPromise(function(_0x162a61,_0xcd96f5){return client[_0x5a87('0xc')](_0x5042b5,_0x4ff305)['then'](function(_0x5d9e42){logger[_0x5a87('0xd')](_0x5a87('0xe'),_0x428b34,_0x5a87('0xf'));logger[_0x5a87('0x10')](_0x5a87('0x11'),_0x428b34,'request\x20sent',JSON[_0x5a87('0x12')](_0x5d9e42));if(_0x5d9e42[_0x5a87('0x13')]){if(_0x5d9e42['error']['code']===0x1f4){logger[_0x5a87('0x13')](_0x5a87('0xe'),_0x428b34,_0x5d9e42[_0x5a87('0x13')]['message']);return _0xcd96f5(_0x5d9e42[_0x5a87('0x13')]['message']);}logger[_0x5a87('0x13')](_0x5a87('0xe'),_0x428b34,_0x5d9e42['error'][_0x5a87('0x14')]);return _0x162a61(_0x5d9e42['error'][_0x5a87('0x14')]);}else{logger[_0x5a87('0xd')](_0x5a87('0xe'),_0x428b34,_0x5a87('0xf'));_0x162a61(_0x5d9e42[_0x5a87('0x15')][_0x5a87('0x14')]);}})['catch'](function(_0x630da1){logger['error'](_0x5a87('0xe'),_0x428b34,_0x630da1);_0xcd96f5(_0x630da1);});});} \ No newline at end of file +var _0x8a25=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','info','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x158112,_0x392f4d){var _0x44c3ac=function(_0x185e60){while(--_0x185e60){_0x158112['push'](_0x158112['shift']());}};_0x44c3ac(++_0x392f4d);}(_0x8a25,0xb7));var _0x58a2=function(_0x3debfb,_0x4912fd){_0x3debfb=_0x3debfb-0x0;var _0x60e082=_0x8a25[_0x3debfb];return _0x60e082;};'use strict';var _=require(_0x58a2('0x0'));var util=require(_0x58a2('0x1'));var moment=require(_0x58a2('0x2'));var BPromise=require(_0x58a2('0x3'));var rs=require(_0x58a2('0x4'));var fs=require('fs');var Redis=require(_0x58a2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x58a2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x58a2('0x7'));var jayson=require(_0x58a2('0x8'));var client=jayson[_0x58a2('0x9')][_0x58a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fe895,_0x2b6bf0,_0x38712c){return new BPromise(function(_0x4ecc5b,_0x31c4c0){return client[_0x58a2('0xb')](_0x1fe895,_0x38712c)[_0x58a2('0xc')](function(_0x2c17d9){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x2b6bf0,_0x58a2('0xd'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2b6bf0,_0x58a2('0xd'),JSON[_0x58a2('0xe')](_0x2c17d9));if(_0x2c17d9[_0x58a2('0xf')]){if(_0x2c17d9[_0x58a2('0xf')][_0x58a2('0x10')]===0x1f4){logger[_0x58a2('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x2b6bf0,_0x2c17d9['error'][_0x58a2('0x11')]);return _0x31c4c0(_0x2c17d9[_0x58a2('0xf')][_0x58a2('0x11')]);}logger[_0x58a2('0xf')](_0x58a2('0x12'),_0x2b6bf0,_0x2c17d9[_0x58a2('0xf')][_0x58a2('0x11')]);return _0x4ecc5b(_0x2c17d9[_0x58a2('0xf')][_0x58a2('0x11')]);}else{logger[_0x58a2('0x13')](_0x58a2('0x12'),_0x2b6bf0,_0x58a2('0xd'));_0x4ecc5b(_0x2c17d9['result']['message']);}})[_0x58a2('0x14')](function(_0x5a138e){logger[_0x58a2('0xf')](_0x58a2('0x12'),_0x2b6bf0,_0x5a138e);_0x31c4c0(_0x5a138e);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 165fb37..2ef87bd 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 _0xea2d=['./intDeskField.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa7b420,_0x1161b3){var _0x1462f5=function(_0x3e9dc0){while(--_0x3e9dc0){_0xa7b420['push'](_0xa7b420['shift']());}};_0x1462f5(++_0x1161b3);}(_0xea2d,0xfb));var _0xdea2=function(_0x38ace7,_0x468b84){_0x38ace7=_0x38ace7-0x0;var _0x2dc9fe=_0xea2d[_0x38ace7];return _0x2dc9fe;};'use strict';var multer=require('multer');var util=require(_0xdea2('0x0'));var path=require(_0xdea2('0x1'));var timeout=require(_0xdea2('0x2'));var express=require(_0xdea2('0x3'));var router=express[_0xdea2('0x4')]();var fs_extra=require(_0xdea2('0x5'));var auth=require(_0xdea2('0x6'));var interaction=require(_0xdea2('0x7'));var config=require(_0xdea2('0x8'));var controller=require(_0xdea2('0x9'));router[_0xdea2('0xa')]('/',auth[_0xdea2('0xb')](),controller[_0xdea2('0xc')]);router[_0xdea2('0xa')](_0xdea2('0xd'),auth['isAuthenticated'](),controller[_0xdea2('0xe')]);router['post']('/',auth[_0xdea2('0xb')](),controller[_0xdea2('0xf')]);router[_0xdea2('0x10')](_0xdea2('0xd'),auth[_0xdea2('0xb')](),controller['update']);router[_0xdea2('0x11')]('/:id',auth[_0xdea2('0xb')](),controller[_0xdea2('0x12')]);module[_0xdea2('0x13')]=router; \ No newline at end of file +var _0xbc1d=['../../components/interaction/service','./intDeskField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x3d4612,_0x51f870){var _0x70934b=function(_0x2563c0){while(--_0x2563c0){_0x3d4612['push'](_0x3d4612['shift']());}};_0x70934b(++_0x51f870);}(_0xbc1d,0x12a));var _0xdbc1=function(_0x31b31b,_0x5f044e){_0x31b31b=_0x31b31b-0x0;var _0x2c8fc2=_0xbc1d[_0x31b31b];return _0x2c8fc2;};'use strict';var multer=require(_0xdbc1('0x0'));var util=require(_0xdbc1('0x1'));var path=require(_0xdbc1('0x2'));var timeout=require('connect-timeout');var express=require(_0xdbc1('0x3'));var router=express[_0xdbc1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdbc1('0x5'));var interaction=require(_0xdbc1('0x6'));var config=require('../../config/environment');var controller=require(_0xdbc1('0x7'));router['get']('/',auth[_0xdbc1('0x8')](),controller[_0xdbc1('0x9')]);router[_0xdbc1('0xa')](_0xdbc1('0xb'),auth[_0xdbc1('0x8')](),controller[_0xdbc1('0xc')]);router[_0xdbc1('0xd')]('/',auth[_0xdbc1('0x8')](),controller[_0xdbc1('0xe')]);router['put'](_0xdbc1('0xb'),auth[_0xdbc1('0x8')](),controller[_0xdbc1('0xf')]);router[_0xdbc1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xdbc1('0x11')]);module[_0xdbc1('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 3335857..1327710 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 _0x5fed=['picklist','STRING','ENUM','BOOLEAN','string','variable','customVariable'];(function(_0x505dfb,_0x273445){var _0x5da2f3=function(_0x5c32fd){while(--_0x5c32fd){_0x505dfb['push'](_0x505dfb['shift']());}};_0x5da2f3(++_0x273445);}(_0x5fed,0x9e));var _0xd5fe=function(_0x593f03,_0x4af84a){_0x593f03=_0x593f03-0x0;var _0x178299=_0x5fed[_0x593f03];return _0x178299;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xd5fe('0x0'),_0xd5fe('0x1'),_0xd5fe('0x2'),'keyValue',_0xd5fe('0x3')),'defaultValue':_0xd5fe('0x0')},'content':{'type':Sequelize[_0xd5fe('0x4')]},'key':{'type':Sequelize[_0xd5fe('0x4')]},'keyType':{'type':Sequelize[_0xd5fe('0x5')]('string',_0xd5fe('0x1'),_0xd5fe('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd5fe('0x4')]},'nameField':{'type':Sequelize[_0xd5fe('0x4')]},'customField':{'type':Sequelize[_0xd5fe('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd5fe('0x4')]}}; \ No newline at end of file +var _0x0453=['STRING','ENUM','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x2671e8,_0x4c937a){var _0x38051a=function(_0x28bdad){while(--_0x28bdad){_0x2671e8['push'](_0x2671e8['shift']());}};_0x38051a(++_0x4c937a);}(_0x0453,0x65));var _0x3045=function(_0x4da31a,_0x435af7){_0x4da31a=_0x4da31a-0x0;var _0x2211f3=_0x0453[_0x4da31a];return _0x2211f3;};'use strict';var Sequelize=require(_0x3045('0x0'));module[_0x3045('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3045('0x2'),_0x3045('0x3'),_0x3045('0x4'),_0x3045('0x5'),_0x3045('0x6')),'defaultValue':_0x3045('0x2')},'content':{'type':Sequelize[_0x3045('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3045('0x8')](_0x3045('0x2'),_0x3045('0x3'),_0x3045('0x4'))},'keyContent':{'type':Sequelize[_0x3045('0x7')]},'idField':{'type':Sequelize[_0x3045('0x7')]},'nameField':{'type':Sequelize[_0x3045('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3045('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index bd5552c..0012acc 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 _0x82f8=['stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','length','includeAll','options','find','create','body','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x82f8,0x157));var _0x882f=function(_0x5990c3,_0x118d6b){_0x5990c3=_0x5990c3-0x0;var _0x5aa47e=_0x82f8[_0x5990c3];return _0x5aa47e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x882f('0x0'));var zipdir=require(_0x882f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x882f('0x2'));var moment=require(_0x882f('0x3'));var BPromise=require(_0x882f('0x4'));var Mustache=require(_0x882f('0x5'));var util=require(_0x882f('0x6'));var path=require(_0x882f('0x7'));var sox=require(_0x882f('0x8'));var csv=require(_0x882f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x882f('0xa'));var squel=require(_0x882f('0xb'));var crypto=require(_0x882f('0xc'));var jsforce=require(_0x882f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x882f('0x9'));var querystring=require('querystring');var Papa=require(_0x882f('0xe'));var Redis=require('ioredis');var authService=require(_0x882f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x882f('0x10'));var logger=require(_0x882f('0x11'))(_0x882f('0x12'));var utils=require(_0x882f('0x13'));var config=require(_0x882f('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x188e41,_0x1b5c5d){_0x1b5c5d=_0x1b5c5d||0xcc;return function(_0x1ffbde){if(_0x1ffbde){return _0x188e41[_0x882f('0x15')](_0x1b5c5d);}return _0x188e41[_0x882f('0x16')](_0x1b5c5d)[_0x882f('0x17')]();};}function respondWithResult(_0x39f2bb,_0x56034c){_0x56034c=_0x56034c||0xc8;return function(_0x33740b){if(_0x33740b){return _0x39f2bb[_0x882f('0x16')](_0x56034c)[_0x882f('0x18')](_0x33740b);}};}function respondWithFilteredResult(_0x167a0,_0x4cee2a){return function(_0x4ca189){if(_0x4ca189){var _0x4e9b6e=typeof _0x4cee2a[_0x882f('0x19')]===_0x882f('0x1a')&&typeof _0x4cee2a[_0x882f('0x1b')]===_0x882f('0x1a');var _0x3f72c2=_0x4ca189[_0x882f('0x1c')];var _0x3bd47c=_0x4e9b6e?0x0:_0x4cee2a[_0x882f('0x19')];var _0x544fd5=_0x4e9b6e?_0x4ca189[_0x882f('0x1c')]:_0x4cee2a['offset']+_0x4cee2a['limit'];var _0xaa6bcb;if(_0x544fd5>=_0x3f72c2){_0x544fd5=_0x3f72c2;_0xaa6bcb=0xc8;}else{_0xaa6bcb=0xce;}_0x167a0[_0x882f('0x16')](_0xaa6bcb);return _0x167a0[_0x882f('0x1d')](_0x882f('0x1e'),_0x3bd47c+'-'+_0x544fd5+'/'+_0x3f72c2)['json'](_0x4ca189);}return null;};}function patchUpdates(_0x3cfc4e){return function(_0x14792c){try{jsonpatch[_0x882f('0x1f')](_0x14792c,_0x3cfc4e,!![]);}catch(_0x421aaf){return BPromise[_0x882f('0x20')](_0x421aaf);}return _0x14792c[_0x882f('0x21')]();};}function saveUpdates(_0x3ee80d,_0x1dd9e4){return function(_0x251ed0){if(_0x251ed0){return _0x251ed0['update'](_0x3ee80d)['then'](function(_0x4c0a93){return _0x4c0a93;});}return null;};}function removeEntity(_0x3705e8,_0x2c44e5){return function(_0x11298b){if(_0x11298b){return _0x11298b[_0x882f('0x22')]()[_0x882f('0x23')](function(){_0x3705e8[_0x882f('0x16')](0xcc)[_0x882f('0x17')]();});}};}function handleEntityNotFound(_0x2d6f58,_0x1bfc1d){return function(_0x4f24f1){if(!_0x4f24f1){_0x2d6f58[_0x882f('0x15')](0x194);}return _0x4f24f1;};}function handleError(_0x2a8605,_0x51d359){_0x51d359=_0x51d359||0x1f4;return function(_0x48c52b){logger[_0x882f('0x24')](_0x48c52b[_0x882f('0x25')]);if(_0x48c52b[_0x882f('0x26')]){delete _0x48c52b['name'];}_0x2a8605[_0x882f('0x16')](_0x51d359)[_0x882f('0x27')](_0x48c52b);};}exports[_0x882f('0x28')]=function(_0x29fc23,_0x58d4ce){var _0x41605c={},_0x31d0b7={},_0x48431={'count':0x0,'rows':[]};var _0x1cb5e3=_[_0x882f('0x29')](db[_0x882f('0x2a')][_0x882f('0x2b')],function(_0x862f1b){return{'name':_0x862f1b[_0x882f('0x2c')],'type':_0x862f1b[_0x882f('0x2d')][_0x882f('0x2e')]};});_0x31d0b7[_0x882f('0x2f')]=_[_0x882f('0x29')](_0x1cb5e3,'name');_0x31d0b7[_0x882f('0x30')]=_['keys'](_0x29fc23[_0x882f('0x30')]);_0x31d0b7['filters']=_['intersection'](_0x31d0b7[_0x882f('0x2f')],_0x31d0b7[_0x882f('0x30')]);_0x41605c['attributes']=_[_0x882f('0x31')](_0x31d0b7[_0x882f('0x2f')],qs[_0x882f('0x32')](_0x29fc23[_0x882f('0x30')][_0x882f('0x32')]));_0x41605c[_0x882f('0x33')]=_0x41605c['attributes']['length']?_0x41605c['attributes']:_0x31d0b7[_0x882f('0x2f')];if(!_0x29fc23['query'][_0x882f('0x34')](_0x882f('0x35'))){_0x41605c['limit']=qs['limit'](_0x29fc23[_0x882f('0x30')][_0x882f('0x1b')]);_0x41605c['offset']=qs[_0x882f('0x19')](_0x29fc23[_0x882f('0x30')][_0x882f('0x19')]);}_0x41605c[_0x882f('0x36')]=qs[_0x882f('0x37')](_0x29fc23['query'][_0x882f('0x37')]);_0x41605c[_0x882f('0x38')]=qs[_0x882f('0x39')](_[_0x882f('0x3a')](_0x29fc23[_0x882f('0x30')],_0x31d0b7[_0x882f('0x39')]),_0x1cb5e3);if(_0x29fc23[_0x882f('0x30')][_0x882f('0x3b')]){_0x41605c['where']=_[_0x882f('0x3c')](_0x41605c[_0x882f('0x38')],{'$or':_[_0x882f('0x29')](_0x1cb5e3,function(_0x1dd865){if(_0x1dd865[_0x882f('0x2d')]!==_0x882f('0x3d')){var _0x281e89={};_0x281e89[_0x1dd865[_0x882f('0x26')]]={'$like':'%'+_0x29fc23['query'][_0x882f('0x3b')]+'%'};return _0x281e89;}})});}_0x41605c=_[_0x882f('0x3c')]({},_0x41605c,_0x29fc23['options']);var _0x2a02f9={'where':_0x41605c[_0x882f('0x38')]};return db[_0x882f('0x2a')]['count'](_0x2a02f9)[_0x882f('0x23')](function(_0x9210e3){_0x48431[_0x882f('0x1c')]=_0x9210e3;if(_0x29fc23['query']['includeAll']){_0x41605c[_0x882f('0x3e')]=[{'all':!![]}];}return db[_0x882f('0x2a')][_0x882f('0x3f')](_0x41605c);})[_0x882f('0x23')](function(_0x45b848){_0x48431[_0x882f('0x40')]=_0x45b848;return _0x48431;})[_0x882f('0x23')](respondWithFilteredResult(_0x58d4ce,_0x41605c))[_0x882f('0x41')](handleError(_0x58d4ce,null));};exports[_0x882f('0x42')]=function(_0xa8e935,_0x184e92){var _0x4fbd9b={'raw':!![],'where':{'id':_0xa8e935[_0x882f('0x43')]['id']}},_0xb34eb4={};_0xb34eb4[_0x882f('0x2f')]=_[_0x882f('0x44')](db[_0x882f('0x2a')][_0x882f('0x2b')]);_0xb34eb4[_0x882f('0x30')]=_[_0x882f('0x44')](_0xa8e935[_0x882f('0x30')]);_0xb34eb4['filters']=_['intersection'](_0xb34eb4['model'],_0xb34eb4[_0x882f('0x30')]);_0x4fbd9b['attributes']=_['intersection'](_0xb34eb4[_0x882f('0x2f')],qs[_0x882f('0x32')](_0xa8e935[_0x882f('0x30')][_0x882f('0x32')]));_0x4fbd9b['attributes']=_0x4fbd9b[_0x882f('0x33')][_0x882f('0x45')]?_0x4fbd9b[_0x882f('0x33')]:_0xb34eb4['model'];if(_0xa8e935[_0x882f('0x30')][_0x882f('0x46')]){_0x4fbd9b[_0x882f('0x3e')]=[{'all':!![]}];}_0x4fbd9b=_[_0x882f('0x3c')]({},_0x4fbd9b,_0xa8e935[_0x882f('0x47')]);return db['DeskField'][_0x882f('0x48')](_0x4fbd9b)[_0x882f('0x23')](handleEntityNotFound(_0x184e92,null))['then'](respondWithResult(_0x184e92,null))[_0x882f('0x41')](handleError(_0x184e92,null));};exports[_0x882f('0x49')]=function(_0x11dacc,_0x4e6175){return db[_0x882f('0x2a')]['create'](_0x11dacc[_0x882f('0x4a')],{})[_0x882f('0x23')](respondWithResult(_0x4e6175,0xc9))[_0x882f('0x41')](handleError(_0x4e6175,null));};exports[_0x882f('0x4b')]=function(_0x3b2f7b,_0x1b89cd){if(_0x3b2f7b[_0x882f('0x4a')]['id']){delete _0x3b2f7b[_0x882f('0x4a')]['id'];}return db[_0x882f('0x2a')]['find']({'where':{'id':_0x3b2f7b[_0x882f('0x43')]['id']}})[_0x882f('0x23')](handleEntityNotFound(_0x1b89cd,null))[_0x882f('0x23')](saveUpdates(_0x3b2f7b['body'],null))['then'](respondWithResult(_0x1b89cd,null))[_0x882f('0x41')](handleError(_0x1b89cd,null));};exports[_0x882f('0x22')]=function(_0x3d2947,_0x2deeea){return db[_0x882f('0x2a')][_0x882f('0x48')]({'where':{'id':_0x3d2947[_0x882f('0x43')]['id']}})['then'](handleEntityNotFound(_0x2deeea,null))[_0x882f('0x23')](removeEntity(_0x2deeea,null))['catch'](handleError(_0x2deeea,null));}; \ No newline at end of file +var _0xb7ae=['include','find','create','catch','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','show'];(function(_0x2f2b74,_0x58080a){var _0x5ee600=function(_0x434583){while(--_0x434583){_0x2f2b74['push'](_0x2f2b74['shift']());}};_0x5ee600(++_0x58080a);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x90b497,_0x167944){_0x90b497=_0x90b497-0x0;var _0xc6daea=_0xb7ae[_0x90b497];return _0xc6daea;};'use strict';var emlformat=require(_0xeb7a('0x0'));var rimraf=require(_0xeb7a('0x1'));var zipdir=require(_0xeb7a('0x2'));var jsonpatch=require(_0xeb7a('0x3'));var rp=require(_0xeb7a('0x4'));var moment=require('moment');var BPromise=require(_0xeb7a('0x5'));var Mustache=require(_0xeb7a('0x6'));var util=require(_0xeb7a('0x7'));var path=require('path');var sox=require(_0xeb7a('0x8'));var csv=require(_0xeb7a('0x9'));var ejs=require(_0xeb7a('0xa'));var fs=require('fs');var fs_extra=require(_0xeb7a('0xb'));var _=require(_0xeb7a('0xc'));var squel=require('squel');var crypto=require(_0xeb7a('0xd'));var jsforce=require(_0xeb7a('0xe'));var deskjs=require(_0xeb7a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb7a('0x10'));var Papa=require(_0xeb7a('0x11'));var Redis=require(_0xeb7a('0x12'));var authService=require(_0xeb7a('0x13'));var qs=require(_0xeb7a('0x14'));var as=require(_0xeb7a('0x15'));var hardwareService=require(_0xeb7a('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xeb7a('0x17'));var config=require(_0xeb7a('0x18'));var licenseUtil=require(_0xeb7a('0x19'));var db=require(_0xeb7a('0x1a'))['db'];function respondWithStatusCode(_0x13bcf4,_0x203723){_0x203723=_0x203723||0xcc;return function(_0x166e4d){if(_0x166e4d){return _0x13bcf4['sendStatus'](_0x203723);}return _0x13bcf4[_0xeb7a('0x1b')](_0x203723)[_0xeb7a('0x1c')]();};}function respondWithResult(_0x4e86a7,_0x110acb){_0x110acb=_0x110acb||0xc8;return function(_0x186ea3){if(_0x186ea3){return _0x4e86a7['status'](_0x110acb)[_0xeb7a('0x1d')](_0x186ea3);}};}function respondWithFilteredResult(_0x5db84f,_0x5d953f){return function(_0x388666){if(_0x388666){var _0x5e6256=typeof _0x5d953f['offset']===_0xeb7a('0x1e')&&typeof _0x5d953f[_0xeb7a('0x1f')]===_0xeb7a('0x1e');var _0x2d92c7=_0x388666['count'];var _0x4be13e=_0x5e6256?0x0:_0x5d953f[_0xeb7a('0x20')];var _0x26bd85=_0x5e6256?_0x388666['count']:_0x5d953f['offset']+_0x5d953f[_0xeb7a('0x1f')];var _0x25a399;if(_0x26bd85>=_0x2d92c7){_0x26bd85=_0x2d92c7;_0x25a399=0xc8;}else{_0x25a399=0xce;}_0x5db84f[_0xeb7a('0x1b')](_0x25a399);return _0x5db84f[_0xeb7a('0x21')](_0xeb7a('0x22'),_0x4be13e+'-'+_0x26bd85+'/'+_0x2d92c7)[_0xeb7a('0x1d')](_0x388666);}return null;};}function patchUpdates(_0x29fa3f){return function(_0x120128){try{jsonpatch['apply'](_0x120128,_0x29fa3f,!![]);}catch(_0x431d4a){return BPromise[_0xeb7a('0x23')](_0x431d4a);}return _0x120128['save']();};}function saveUpdates(_0x5af915,_0xeab362){return function(_0x434aac){if(_0x434aac){return _0x434aac[_0xeb7a('0x24')](_0x5af915)[_0xeb7a('0x25')](function(_0x29db91){return _0x29db91;});}return null;};}function removeEntity(_0x44cefc,_0xfb62a5){return function(_0x4c4816){if(_0x4c4816){return _0x4c4816[_0xeb7a('0x26')]()[_0xeb7a('0x25')](function(){_0x44cefc[_0xeb7a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10b7d3,_0x1cf8f6){return function(_0x182335){if(!_0x182335){_0x10b7d3[_0xeb7a('0x27')](0x194);}return _0x182335;};}function handleError(_0x53ade4,_0x15199a){_0x15199a=_0x15199a||0x1f4;return function(_0x52e882){logger[_0xeb7a('0x28')](_0x52e882[_0xeb7a('0x29')]);if(_0x52e882[_0xeb7a('0x2a')]){delete _0x52e882[_0xeb7a('0x2a')];}_0x53ade4[_0xeb7a('0x1b')](_0x15199a)[_0xeb7a('0x2b')](_0x52e882);};}exports[_0xeb7a('0x2c')]=function(_0x3917eb,_0x2a492f){var _0x20a197={},_0x2d2f9f={},_0x567bbe={'count':0x0,'rows':[]};var _0x34b88b=_[_0xeb7a('0x2d')](db[_0xeb7a('0x2e')][_0xeb7a('0x2f')],function(_0x14e2e1){return{'name':_0x14e2e1[_0xeb7a('0x30')],'type':_0x14e2e1[_0xeb7a('0x31')][_0xeb7a('0x32')]};});_0x2d2f9f[_0xeb7a('0x33')]=_[_0xeb7a('0x2d')](_0x34b88b,_0xeb7a('0x2a'));_0x2d2f9f['query']=_[_0xeb7a('0x34')](_0x3917eb[_0xeb7a('0x35')]);_0x2d2f9f[_0xeb7a('0x36')]=_[_0xeb7a('0x37')](_0x2d2f9f['model'],_0x2d2f9f[_0xeb7a('0x35')]);_0x20a197[_0xeb7a('0x38')]=_[_0xeb7a('0x37')](_0x2d2f9f[_0xeb7a('0x33')],qs[_0xeb7a('0x39')](_0x3917eb[_0xeb7a('0x35')]['fields']));_0x20a197[_0xeb7a('0x38')]=_0x20a197[_0xeb7a('0x38')][_0xeb7a('0x3a')]?_0x20a197[_0xeb7a('0x38')]:_0x2d2f9f[_0xeb7a('0x33')];if(!_0x3917eb[_0xeb7a('0x35')]['hasOwnProperty'](_0xeb7a('0x3b'))){_0x20a197['limit']=qs[_0xeb7a('0x1f')](_0x3917eb[_0xeb7a('0x35')]['limit']);_0x20a197[_0xeb7a('0x20')]=qs[_0xeb7a('0x20')](_0x3917eb[_0xeb7a('0x35')][_0xeb7a('0x20')]);}_0x20a197[_0xeb7a('0x3c')]=qs[_0xeb7a('0x3d')](_0x3917eb[_0xeb7a('0x35')][_0xeb7a('0x3d')]);_0x20a197['where']=qs[_0xeb7a('0x36')](_[_0xeb7a('0x3e')](_0x3917eb['query'],_0x2d2f9f[_0xeb7a('0x36')]),_0x34b88b);if(_0x3917eb[_0xeb7a('0x35')][_0xeb7a('0x3f')]){_0x20a197[_0xeb7a('0x40')]=_[_0xeb7a('0x41')](_0x20a197[_0xeb7a('0x40')],{'$or':_[_0xeb7a('0x2d')](_0x34b88b,function(_0x573e30){if(_0x573e30[_0xeb7a('0x31')]!==_0xeb7a('0x42')){var _0x308a2e={};_0x308a2e[_0x573e30[_0xeb7a('0x2a')]]={'$like':'%'+_0x3917eb[_0xeb7a('0x35')][_0xeb7a('0x3f')]+'%'};return _0x308a2e;}})});}_0x20a197=_[_0xeb7a('0x41')]({},_0x20a197,_0x3917eb[_0xeb7a('0x43')]);var _0x414580={'where':_0x20a197[_0xeb7a('0x40')]};return db[_0xeb7a('0x2e')][_0xeb7a('0x44')](_0x414580)['then'](function(_0x2d3d4d){_0x567bbe[_0xeb7a('0x44')]=_0x2d3d4d;if(_0x3917eb[_0xeb7a('0x35')][_0xeb7a('0x45')]){_0x20a197['include']=[{'all':!![]}];}return db[_0xeb7a('0x2e')][_0xeb7a('0x46')](_0x20a197);})[_0xeb7a('0x25')](function(_0x1803d6){_0x567bbe[_0xeb7a('0x47')]=_0x1803d6;return _0x567bbe;})[_0xeb7a('0x25')](respondWithFilteredResult(_0x2a492f,_0x20a197))['catch'](handleError(_0x2a492f,null));};exports[_0xeb7a('0x48')]=function(_0x1b1575,_0x48d620){var _0x436346={'raw':!![],'where':{'id':_0x1b1575['params']['id']}},_0x58c004={};_0x58c004['model']=_[_0xeb7a('0x34')](db[_0xeb7a('0x2e')][_0xeb7a('0x2f')]);_0x58c004[_0xeb7a('0x35')]=_[_0xeb7a('0x34')](_0x1b1575[_0xeb7a('0x35')]);_0x58c004['filters']=_['intersection'](_0x58c004[_0xeb7a('0x33')],_0x58c004['query']);_0x436346[_0xeb7a('0x38')]=_[_0xeb7a('0x37')](_0x58c004[_0xeb7a('0x33')],qs[_0xeb7a('0x39')](_0x1b1575['query'][_0xeb7a('0x39')]));_0x436346[_0xeb7a('0x38')]=_0x436346[_0xeb7a('0x38')][_0xeb7a('0x3a')]?_0x436346['attributes']:_0x58c004[_0xeb7a('0x33')];if(_0x1b1575['query'][_0xeb7a('0x45')]){_0x436346[_0xeb7a('0x49')]=[{'all':!![]}];}_0x436346=_[_0xeb7a('0x41')]({},_0x436346,_0x1b1575[_0xeb7a('0x43')]);return db[_0xeb7a('0x2e')][_0xeb7a('0x4a')](_0x436346)[_0xeb7a('0x25')](handleEntityNotFound(_0x48d620,null))['then'](respondWithResult(_0x48d620,null))['catch'](handleError(_0x48d620,null));};exports[_0xeb7a('0x4b')]=function(_0x3d48c8,_0x18c60f){return db[_0xeb7a('0x2e')][_0xeb7a('0x4b')](_0x3d48c8['body'],{})['then'](respondWithResult(_0x18c60f,0xc9))[_0xeb7a('0x4c')](handleError(_0x18c60f,null));};exports['update']=function(_0x202753,_0x5846bc){if(_0x202753[_0xeb7a('0x4d')]['id']){delete _0x202753[_0xeb7a('0x4d')]['id'];}return db[_0xeb7a('0x2e')][_0xeb7a('0x4a')]({'where':{'id':_0x202753[_0xeb7a('0x4e')]['id']}})[_0xeb7a('0x25')](handleEntityNotFound(_0x5846bc,null))[_0xeb7a('0x25')](saveUpdates(_0x202753[_0xeb7a('0x4d')],null))[_0xeb7a('0x25')](respondWithResult(_0x5846bc,null))[_0xeb7a('0x4c')](handleError(_0x5846bc,null));};exports[_0xeb7a('0x26')]=function(_0x466a2f,_0x55eb50){return db[_0xeb7a('0x2e')][_0xeb7a('0x4a')]({'where':{'id':_0x466a2f[_0xeb7a('0x4e')]['id']}})[_0xeb7a('0x25')](handleEntityNotFound(_0x55eb50,null))[_0xeb7a('0x25')](removeEntity(_0x55eb50,null))[_0xeb7a('0x4c')](handleError(_0x55eb50,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 841529b..35f71d6 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 _0x744d=['desk_unique_index','idField','api','moment','bluebird','request-promise','path','./intDeskField.attributes','define','DeskField','int_desk_fields'];(function(_0x15106b,_0x4d96f6){var _0x521203=function(_0x4dbe23){while(--_0x4dbe23){_0x15106b['push'](_0x15106b['shift']());}};_0x521203(++_0x4d96f6);}(_0x744d,0xf4));var _0xd744=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0x744d[_0x3df9dd];return _0x4f11e4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd744('0x0'));var moment=require(_0xd744('0x1'));var BPromise=require(_0xd744('0x2'));var rp=require(_0xd744('0x3'));var fs=require('fs');var path=require(_0xd744('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd744('0x5'));module['exports']=function(_0x10dc25,_0xaf1f96){return _0x10dc25[_0xd744('0x6')](_0xd744('0x7'),attributes,{'tableName':_0xd744('0x8'),'paranoid':![],'indexes':[{'name':_0xd744('0x9'),'fields':[_0xd744('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe86e=['FieldId','api','request-promise','rimraf','../../config/environment','exports','define','DeskField'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0xe86e,0x159));var _0xee86=function(_0x4f43d4,_0x5c3af2){_0x4f43d4=_0x4f43d4-0x0;var _0x363e9c=_0xe86e[_0x4f43d4];return _0x363e9c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xee86('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xee86('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee86('0x2'));var config=require(_0xee86('0x3'));var attributes=require('./intDeskField.attributes');module[_0xee86('0x4')]=function(_0x201641,_0x1851d1){return _0x201641[_0xee86('0x5')](_0xee86('0x6'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0xee86('0x7')],'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 0c4d02f..887251c 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 _0x972d=['DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info'];(function(_0xec20d5,_0x508fff){var _0x3973fd=function(_0x945259){while(--_0x945259){_0xec20d5['push'](_0xec20d5['shift']());}};_0x3973fd(++_0x508fff);}(_0x972d,0x129));var _0xd972=function(_0xd7e228,_0x322298){_0xd7e228=_0xd7e228-0x0;var _0x3e7552=_0x972d[_0xd7e228];return _0x3e7552;};'use strict';var _=require(_0xd972('0x0'));var util=require(_0xd972('0x1'));var moment=require(_0xd972('0x2'));var BPromise=require(_0xd972('0x3'));var rs=require(_0xd972('0x4'));var fs=require('fs');var Redis=require(_0xd972('0x5'));var db=require(_0xd972('0x6'))['db'];var utils=require(_0xd972('0x7'));var logger=require(_0xd972('0x8'))(_0xd972('0x9'));var config=require('../../config/environment');var jayson=require(_0xd972('0xa'));var client=jayson[_0xd972('0xb')][_0xd972('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34f2db,_0x4f6237,_0x2cbf5d){return new BPromise(function(_0x385820,_0x2ee436){return client[_0xd972('0xd')](_0x34f2db,_0x2cbf5d)['then'](function(_0x5af019){logger[_0xd972('0xe')](_0xd972('0xf'),_0x4f6237,_0xd972('0x10'));logger[_0xd972('0x11')](_0xd972('0x12'),_0x4f6237,_0xd972('0x10'),JSON[_0xd972('0x13')](_0x5af019));if(_0x5af019['error']){if(_0x5af019[_0xd972('0x14')][_0xd972('0x15')]===0x1f4){logger[_0xd972('0x14')](_0xd972('0xf'),_0x4f6237,_0x5af019['error'][_0xd972('0x16')]);return _0x2ee436(_0x5af019[_0xd972('0x14')]['message']);}logger[_0xd972('0x14')]('DeskField,\x20%s,\x20%s',_0x4f6237,_0x5af019[_0xd972('0x14')][_0xd972('0x16')]);return _0x385820(_0x5af019[_0xd972('0x14')][_0xd972('0x16')]);}else{logger[_0xd972('0xe')]('DeskField,\x20%s,\x20%s',_0x4f6237,_0xd972('0x10'));_0x385820(_0x5af019['result'][_0xd972('0x16')]);}})[_0xd972('0x17')](function(_0x3234f6){logger[_0xd972('0x14')]('DeskField,\x20%s,\x20%s',_0x4f6237,_0x3234f6);_0x2ee436(_0x3234f6);});});} \ No newline at end of file +var _0x7987=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result'];(function(_0x2f92d5,_0x1ad1a9){var _0x509020=function(_0x4c12bd){while(--_0x4c12bd){_0x2f92d5['push'](_0x2f92d5['shift']());}};_0x509020(++_0x1ad1a9);}(_0x7987,0x1e5));var _0x7798=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0x7987[_0x5db657];return _0x2d6e70;};'use strict';var _=require(_0x7798('0x0'));var util=require(_0x7798('0x1'));var moment=require(_0x7798('0x2'));var BPromise=require(_0x7798('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7798('0x4'));var db=require(_0x7798('0x5'))['db'];var utils=require(_0x7798('0x6'));var logger=require(_0x7798('0x7'))('rpc');var config=require(_0x7798('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7798('0x9')][_0x7798('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11e616,_0x8acdb2,_0xd033f8){return new BPromise(function(_0x3b10ca,_0x1a5428){return client['request'](_0x11e616,_0xd033f8)[_0x7798('0xb')](function(_0x3b41b9){logger['info'](_0x7798('0xc'),_0x8acdb2,'request\x20sent');logger[_0x7798('0xd')](_0x7798('0xe'),_0x8acdb2,_0x7798('0xf'),JSON[_0x7798('0x10')](_0x3b41b9));if(_0x3b41b9[_0x7798('0x11')]){if(_0x3b41b9['error']['code']===0x1f4){logger[_0x7798('0x11')]('DeskField,\x20%s,\x20%s',_0x8acdb2,_0x3b41b9[_0x7798('0x11')]['message']);return _0x1a5428(_0x3b41b9['error']['message']);}logger[_0x7798('0x11')](_0x7798('0xc'),_0x8acdb2,_0x3b41b9[_0x7798('0x11')][_0x7798('0x12')]);return _0x3b10ca(_0x3b41b9[_0x7798('0x11')][_0x7798('0x12')]);}else{logger[_0x7798('0x13')](_0x7798('0xc'),_0x8acdb2,'request\x20sent');_0x3b10ca(_0x3b41b9[_0x7798('0x14')][_0x7798('0x12')]);}})[_0x7798('0x15')](function(_0x4f483a){logger[_0x7798('0x11')](_0x7798('0xc'),_0x8acdb2,_0x4f483a);_0x1a5428(_0x4f483a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 605a779..695713b 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 _0x0d96=['show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id'];(function(_0x2ab7ff,_0x59435c){var _0x59d1fa=function(_0x2959ac){while(--_0x2959ac){_0x2ab7ff['push'](_0x2ab7ff['shift']());}};_0x59d1fa(++_0x59435c);}(_0x0d96,0x9a));var _0x60d9=function(_0x26f1b5,_0x411fa1){_0x26f1b5=_0x26f1b5-0x0;var _0x581527=_0x0d96[_0x26f1b5];return _0x581527;};'use strict';var multer=require(_0x60d9('0x0'));var util=require(_0x60d9('0x1'));var path=require(_0x60d9('0x2'));var timeout=require(_0x60d9('0x3'));var express=require(_0x60d9('0x4'));var router=express[_0x60d9('0x5')]();var fs_extra=require(_0x60d9('0x6'));var auth=require(_0x60d9('0x7'));var interaction=require(_0x60d9('0x8'));var config=require(_0x60d9('0x9'));var controller=require(_0x60d9('0xa'));router[_0x60d9('0xb')]('/',auth[_0x60d9('0xc')](),controller['index']);router[_0x60d9('0xb')](_0x60d9('0xd'),auth['isAuthenticated'](),controller[_0x60d9('0xe')]);router['get'](_0x60d9('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x60d9('0xb')](_0x60d9('0x10'),auth[_0x60d9('0xc')](),controller[_0x60d9('0x11')]);router[_0x60d9('0x12')]('/',auth[_0x60d9('0xc')](),controller['create']);router[_0x60d9('0x12')]('/:id/configurations',auth[_0x60d9('0xc')](),controller[_0x60d9('0x13')]);router[_0x60d9('0x14')](_0x60d9('0xd'),auth[_0x60d9('0xc')](),controller[_0x60d9('0x15')]);router[_0x60d9('0x16')](_0x60d9('0xd'),auth[_0x60d9('0xc')](),controller['destroy']);module[_0x60d9('0x17')]=router; \ No newline at end of file +var _0x0a11=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','index','get','isAuthenticated','show','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0x0a11,0x74));var _0x10a1=function(_0x143cc6,_0xf94536){_0x143cc6=_0x143cc6-0x0;var _0x2cedba=_0x0a11[_0x143cc6];return _0x2cedba;};'use strict';var multer=require(_0x10a1('0x0'));var util=require('util');var path=require(_0x10a1('0x1'));var timeout=require(_0x10a1('0x2'));var express=require(_0x10a1('0x3'));var router=express[_0x10a1('0x4')]();var fs_extra=require(_0x10a1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x10a1('0x6'));var config=require(_0x10a1('0x7'));var controller=require(_0x10a1('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x10a1('0x9')]);router[_0x10a1('0xa')]('/:id',auth[_0x10a1('0xb')](),controller[_0x10a1('0xc')]);router[_0x10a1('0xa')]('/:id/configurations',auth[_0x10a1('0xb')](),controller['getConfigurations']);router[_0x10a1('0xa')](_0x10a1('0xd'),auth[_0x10a1('0xb')](),controller[_0x10a1('0xe')]);router[_0x10a1('0xf')]('/',auth['isAuthenticated'](),controller[_0x10a1('0x10')]);router[_0x10a1('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x10a1('0x11')]);router[_0x10a1('0x12')](_0x10a1('0x13'),auth[_0x10a1('0xb')](),controller[_0x10a1('0x14')]);router[_0x10a1('0x15')](_0x10a1('0x13'),auth[_0x10a1('0xb')](),controller[_0x10a1('0x16')]);module[_0x10a1('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 6f0c2a4..77fe8d4 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 _0x0536=['sequelize','STRING'];(function(_0x4eb6ec,_0x7f2520){var _0x58881b=function(_0x4f375f){while(--_0x4f375f){_0x4eb6ec['push'](_0x4eb6ec['shift']());}};_0x58881b(++_0x7f2520);}(_0x0536,0xc6));var _0x6053=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0536[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x6053('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6053('0x1')]},'password':{'type':Sequelize[_0x6053('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x6053('0x1')]},'clientId':{'type':Sequelize[_0x6053('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6053('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6053('0x1')]}}; \ No newline at end of file +var _0x5e0a=['exports','STRING','sequelize'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x5e0a,0x16a));var _0xa5e0=function(_0x59754a,_0x2c7eeb){_0x59754a=_0x59754a-0x0;var _0x5171f6=_0x5e0a[_0x59754a];return _0x5171f6;};'use strict';var Sequelize=require(_0xa5e0('0x0'));module[_0xa5e0('0x1')]={'name':{'type':Sequelize[_0xa5e0('0x2')]},'username':{'type':Sequelize[_0xa5e0('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa5e0('0x2')]},'tenantId':{'type':Sequelize[_0xa5e0('0x2')]},'clientId':{'type':Sequelize[_0xa5e0('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa5e0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 0e8f0f8..7f64ccf 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 _0x89fe=['create','update','body','destroy','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','access_token','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','stack','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','DisplayName','GET',')/Attributes(','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','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','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','then','error','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89fe,0x83));var _0xe89f=function(_0x296f54,_0x19697a){_0x296f54=_0x296f54-0x0;var _0x5bc0ad=_0x89fe[_0x296f54];return _0x5bc0ad;};'use strict';var emlformat=require(_0xe89f('0x0'));var rimraf=require(_0xe89f('0x1'));var zipdir=require(_0xe89f('0x2'));var jsonpatch=require(_0xe89f('0x3'));var rp=require('request-promise');var moment=require(_0xe89f('0x4'));var BPromise=require(_0xe89f('0x5'));var Mustache=require('mustache');var util=require(_0xe89f('0x6'));var path=require(_0xe89f('0x7'));var sox=require(_0xe89f('0x8'));var csv=require(_0xe89f('0x9'));var ejs=require(_0xe89f('0xa'));var fs=require('fs');var fs_extra=require(_0xe89f('0xb'));var _=require(_0xe89f('0xc'));var squel=require('squel');var crypto=require(_0xe89f('0xd'));var jsforce=require(_0xe89f('0xe'));var deskjs=require(_0xe89f('0xf'));var toCsv=require(_0xe89f('0x9'));var querystring=require(_0xe89f('0x10'));var Papa=require('papaparse');var Redis=require(_0xe89f('0x11'));var authService=require(_0xe89f('0x12'));var qs=require(_0xe89f('0x13'));var as=require(_0xe89f('0x14'));var hardwareService=require(_0xe89f('0x15'));var logger=require(_0xe89f('0x16'))(_0xe89f('0x17'));var utils=require(_0xe89f('0x18'));var config=require(_0xe89f('0x19'));var licenseUtil=require(_0xe89f('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x548a3b,_0x4976a1){_0x4976a1=_0x4976a1||0xcc;return function(_0x4bbdb6){if(_0x4bbdb6){return _0x548a3b[_0xe89f('0x1b')](_0x4976a1);}return _0x548a3b[_0xe89f('0x1c')](_0x4976a1)['end']();};}function respondWithResult(_0x489ef2,_0x4617e7){_0x4617e7=_0x4617e7||0xc8;return function(_0x1a1ce7){if(_0x1a1ce7){return _0x489ef2[_0xe89f('0x1c')](_0x4617e7)[_0xe89f('0x1d')](_0x1a1ce7);}};}function respondWithFilteredResult(_0xf1d0bf,_0x2c82c3){return function(_0x38050e){if(_0x38050e){var _0x3de8a1=typeof _0x2c82c3[_0xe89f('0x1e')]===_0xe89f('0x1f')&&typeof _0x2c82c3['limit']===_0xe89f('0x1f');var _0x4683af=_0x38050e['count'];var _0x5106e4=_0x3de8a1?0x0:_0x2c82c3[_0xe89f('0x1e')];var _0x127517=_0x3de8a1?_0x38050e[_0xe89f('0x20')]:_0x2c82c3[_0xe89f('0x1e')]+_0x2c82c3[_0xe89f('0x21')];var _0x518a4a;if(_0x127517>=_0x4683af){_0x127517=_0x4683af;_0x518a4a=0xc8;}else{_0x518a4a=0xce;}_0xf1d0bf['status'](_0x518a4a);return _0xf1d0bf[_0xe89f('0x22')]('Content-Range',_0x5106e4+'-'+_0x127517+'/'+_0x4683af)[_0xe89f('0x1d')](_0x38050e);}return null;};}function patchUpdates(_0x33c584){return function(_0x43f2c6){try{jsonpatch[_0xe89f('0x23')](_0x43f2c6,_0x33c584,!![]);}catch(_0x1958a2){return BPromise[_0xe89f('0x24')](_0x1958a2);}return _0x43f2c6[_0xe89f('0x25')]();};}function saveUpdates(_0x559d84,_0x415505){return function(_0x5c97db){if(_0x5c97db){return _0x5c97db['update'](_0x559d84)['then'](function(_0x18b52e){return _0x18b52e;});}return null;};}function removeEntity(_0x5b548d,_0x24878d){return function(_0xe9e162){if(_0xe9e162){return _0xe9e162['destroy']()[_0xe89f('0x26')](function(){_0x5b548d[_0xe89f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d7bff,_0x2bd661){return function(_0x38e552){if(!_0x38e552){_0x5d7bff[_0xe89f('0x1b')](0x194);}return _0x38e552;};}function handleError(_0x29b9ff,_0x288d8f){_0x288d8f=_0x288d8f||0x1f4;return function(_0x269b57){logger[_0xe89f('0x27')](_0x269b57['stack']);if(_0x269b57['name']){delete _0x269b57[_0xe89f('0x28')];}_0x29b9ff[_0xe89f('0x1c')](_0x288d8f)[_0xe89f('0x29')](_0x269b57);};}exports[_0xe89f('0x2a')]=function(_0x26604a,_0x5cf085){var _0x3c773c={},_0x31f4ec={},_0x29f7c2={'count':0x0,'rows':[]};var _0x2d5218=_[_0xe89f('0x2b')](db[_0xe89f('0x2c')][_0xe89f('0x2d')],function(_0x4e15dc){return{'name':_0x4e15dc[_0xe89f('0x2e')],'type':_0x4e15dc[_0xe89f('0x2f')]['key']};});_0x31f4ec[_0xe89f('0x30')]=_[_0xe89f('0x2b')](_0x2d5218,_0xe89f('0x28'));_0x31f4ec[_0xe89f('0x31')]=_[_0xe89f('0x32')](_0x26604a[_0xe89f('0x31')]);_0x31f4ec['filters']=_[_0xe89f('0x33')](_0x31f4ec[_0xe89f('0x30')],_0x31f4ec['query']);_0x3c773c[_0xe89f('0x34')]=_[_0xe89f('0x33')](_0x31f4ec[_0xe89f('0x30')],qs[_0xe89f('0x35')](_0x26604a[_0xe89f('0x31')][_0xe89f('0x35')]));_0x3c773c[_0xe89f('0x34')]=_0x3c773c[_0xe89f('0x34')][_0xe89f('0x36')]?_0x3c773c[_0xe89f('0x34')]:_0x31f4ec[_0xe89f('0x30')];if(!_0x26604a[_0xe89f('0x31')][_0xe89f('0x37')](_0xe89f('0x38'))){_0x3c773c['limit']=qs[_0xe89f('0x21')](_0x26604a['query'][_0xe89f('0x21')]);_0x3c773c[_0xe89f('0x1e')]=qs['offset'](_0x26604a[_0xe89f('0x31')]['offset']);}_0x3c773c[_0xe89f('0x39')]=qs[_0xe89f('0x3a')](_0x26604a[_0xe89f('0x31')][_0xe89f('0x3a')]);_0x3c773c[_0xe89f('0x3b')]=qs[_0xe89f('0x3c')](_[_0xe89f('0x3d')](_0x26604a['query'],_0x31f4ec[_0xe89f('0x3c')]),_0x2d5218);if(_0x26604a[_0xe89f('0x31')]['filter']){_0x3c773c[_0xe89f('0x3b')]=_[_0xe89f('0x3e')](_0x3c773c['where'],{'$or':_[_0xe89f('0x2b')](_0x2d5218,function(_0x29dcd7){if(_0x29dcd7[_0xe89f('0x2f')]!==_0xe89f('0x3f')){var _0x1ff534={};_0x1ff534[_0x29dcd7[_0xe89f('0x28')]]={'$like':'%'+_0x26604a[_0xe89f('0x31')][_0xe89f('0x40')]+'%'};return _0x1ff534;}})});}_0x3c773c=_[_0xe89f('0x3e')]({},_0x3c773c,_0x26604a[_0xe89f('0x41')]);var _0x9f1422={'where':_0x3c773c[_0xe89f('0x3b')]};return db[_0xe89f('0x2c')]['count'](_0x9f1422)[_0xe89f('0x26')](function(_0xe03c26){_0x29f7c2['count']=_0xe03c26;if(_0x26604a[_0xe89f('0x31')][_0xe89f('0x42')]){_0x3c773c[_0xe89f('0x43')]=[{'all':!![]}];}return db[_0xe89f('0x2c')][_0xe89f('0x44')](_0x3c773c);})[_0xe89f('0x26')](function(_0x1ff8d1){_0x29f7c2[_0xe89f('0x45')]=_0x1ff8d1;return _0x29f7c2;})[_0xe89f('0x26')](respondWithFilteredResult(_0x5cf085,_0x3c773c))[_0xe89f('0x46')](handleError(_0x5cf085,null));};exports[_0xe89f('0x47')]=function(_0x2a0567,_0x2b4229){var _0x1926f2={'raw':![],'where':{'id':_0x2a0567[_0xe89f('0x48')]['id']}},_0x15778c={};_0x15778c[_0xe89f('0x30')]=_[_0xe89f('0x32')](db[_0xe89f('0x2c')]['rawAttributes']);_0x15778c[_0xe89f('0x31')]=_[_0xe89f('0x32')](_0x2a0567[_0xe89f('0x31')]);_0x15778c['filters']=_[_0xe89f('0x33')](_0x15778c[_0xe89f('0x30')],_0x15778c[_0xe89f('0x31')]);_0x1926f2[_0xe89f('0x34')]=_[_0xe89f('0x33')](_0x15778c[_0xe89f('0x30')],qs[_0xe89f('0x35')](_0x2a0567[_0xe89f('0x31')][_0xe89f('0x35')]));_0x1926f2[_0xe89f('0x34')]=_0x1926f2[_0xe89f('0x34')][_0xe89f('0x36')]?_0x1926f2[_0xe89f('0x34')]:_0x15778c[_0xe89f('0x30')];if(_0x2a0567[_0xe89f('0x31')][_0xe89f('0x42')]){_0x1926f2[_0xe89f('0x43')]=[{'all':!![]}];}_0x1926f2=_[_0xe89f('0x3e')]({},_0x1926f2,_0x2a0567[_0xe89f('0x41')]);return db[_0xe89f('0x2c')][_0xe89f('0x49')](_0x1926f2)[_0xe89f('0x26')](handleEntityNotFound(_0x2b4229,null))[_0xe89f('0x26')](respondWithResult(_0x2b4229,null))[_0xe89f('0x46')](handleError(_0x2b4229,null));};exports[_0xe89f('0x4a')]=function(_0x2d19a7,_0x210995){return db[_0xe89f('0x2c')][_0xe89f('0x4a')](_0x2d19a7['body'],{})[_0xe89f('0x26')](respondWithResult(_0x210995,0xc9))[_0xe89f('0x46')](handleError(_0x210995,null));};exports[_0xe89f('0x4b')]=function(_0x2143ef,_0x5cee9e){if(_0x2143ef[_0xe89f('0x4c')]['id']){delete _0x2143ef[_0xe89f('0x4c')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x2143ef[_0xe89f('0x48')]['id']}})['then'](handleEntityNotFound(_0x5cee9e,null))[_0xe89f('0x26')](saveUpdates(_0x2143ef[_0xe89f('0x4c')],null))[_0xe89f('0x26')](respondWithResult(_0x5cee9e,null))['catch'](handleError(_0x5cee9e,null));};exports[_0xe89f('0x4d')]=function(_0x362855,_0x20128e){return db[_0xe89f('0x2c')][_0xe89f('0x49')]({'where':{'id':_0x362855[_0xe89f('0x48')]['id']}})[_0xe89f('0x26')](handleEntityNotFound(_0x20128e,null))[_0xe89f('0x26')](removeEntity(_0x20128e,null))[_0xe89f('0x46')](handleError(_0x20128e,null));};exports[_0xe89f('0x4e')]=function(_0x864d13,_0xbac93c,_0x43a5b9){var _0x33aee6={};var _0x37b7cc={};var _0x28076c;var _0x58cf10;return db['Dynamics365Account'][_0xe89f('0x4f')]({'where':{'id':_0x864d13[_0xe89f('0x48')]['id']}})[_0xe89f('0x26')](handleEntityNotFound(_0xbac93c,null))[_0xe89f('0x26')](function(_0x2001ab){if(_0x2001ab){_0x28076c=_0x2001ab;_0x37b7cc['model']=_['keys'](db[_0xe89f('0x50')][_0xe89f('0x2d')]);_0x37b7cc[_0xe89f('0x31')]=_[_0xe89f('0x32')](_0x864d13['query']);_0x37b7cc['filters']=_[_0xe89f('0x33')](_0x37b7cc['model'],_0x37b7cc['query']);_0x33aee6[_0xe89f('0x34')]=_['intersection'](_0x37b7cc[_0xe89f('0x30')],qs[_0xe89f('0x35')](_0x864d13[_0xe89f('0x31')][_0xe89f('0x35')]));_0x33aee6[_0xe89f('0x34')]=_0x33aee6[_0xe89f('0x34')][_0xe89f('0x36')]?_0x33aee6[_0xe89f('0x34')]:_0x37b7cc['model'];_0x33aee6[_0xe89f('0x39')]=qs[_0xe89f('0x3a')](_0x864d13[_0xe89f('0x31')][_0xe89f('0x3a')]);_0x33aee6['where']=qs[_0xe89f('0x3c')](_[_0xe89f('0x3d')](_0x864d13[_0xe89f('0x31')],_0x37b7cc[_0xe89f('0x3c')]));if(_0x864d13[_0xe89f('0x31')][_0xe89f('0x40')]){_0x33aee6[_0xe89f('0x3b')]=_[_0xe89f('0x3e')](_0x33aee6[_0xe89f('0x3b')],{'$or':_[_0xe89f('0x2b')](_0x33aee6[_0xe89f('0x34')],function(_0x20c1e2){var _0xedf722={};_0xedf722[_0x20c1e2]={'$like':'%'+_0x864d13[_0xe89f('0x31')][_0xe89f('0x40')]+'%'};return _0xedf722;})});}_0x33aee6=_[_0xe89f('0x3e')]({},_0x33aee6,_0x864d13[_0xe89f('0x41')]);return _0x28076c['getConfigurations'](_0x33aee6);}})['then'](function(_0x59712a){if(_0x59712a){_0x58cf10=_0x59712a[_0xe89f('0x36')];if(!_0x864d13[_0xe89f('0x31')]['hasOwnProperty'](_0xe89f('0x38'))){_0x33aee6[_0xe89f('0x21')]=qs[_0xe89f('0x21')](_0x864d13['query'][_0xe89f('0x21')]);_0x33aee6[_0xe89f('0x1e')]=qs[_0xe89f('0x1e')](_0x864d13[_0xe89f('0x31')]['offset']);}return _0x28076c[_0xe89f('0x4e')](_0x33aee6);}})[_0xe89f('0x26')](function(_0x4ffbd2){if(_0x4ffbd2){return _0x4ffbd2?{'count':_0x58cf10,'rows':_0x4ffbd2}:null;}})[_0xe89f('0x26')](respondWithResult(_0xbac93c,null))[_0xe89f('0x46')](handleError(_0xbac93c,null));};exports[_0xe89f('0x51')]=function(_0x489f58,_0x3d82af,_0x569386){if(_0x489f58[_0xe89f('0x4c')]['id']){delete _0x489f58[_0xe89f('0x4c')]['id'];}return db[_0xe89f('0x2c')]['findOne']({'where':{'id':_0x489f58[_0xe89f('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d82af,null))[_0xe89f('0x26')](function(_0x4a2a00){if(_0x4a2a00){_0x489f58[_0xe89f('0x4c')][_0xe89f('0x52')]=_0x4a2a00['id'];_0x489f58[_0xe89f('0x4c')][_0xe89f('0x53')]=integrations['getSubjects'](_0x489f58[_0xe89f('0x4c')][_0xe89f('0x54')],_0x489f58[_0xe89f('0x4c')]['type']);_0x489f58['body'][_0xe89f('0x55')]=integrations[_0xe89f('0x56')](_0x489f58[_0xe89f('0x4c')]['channel'],_0x489f58[_0xe89f('0x4c')]['type']);return db[_0xe89f('0x50')][_0xe89f('0x4a')](_0x489f58[_0xe89f('0x4c')],{'include':[{'model':db['Dynamics365Field'],'as':_0xe89f('0x53')},{'model':db[_0xe89f('0x57')],'as':_0xe89f('0x55')}]});}return null;})[_0xe89f('0x26')](respondWithResult(_0x3d82af,null))[_0xe89f('0x46')](handleError(_0x3d82af,null));};exports[_0xe89f('0x58')]=function(_0x459d65,_0x2766b5,_0x1182b5){var _0xcc4143=_0x459d65['query'][_0xe89f('0x59')];var _0x458276=_0xcc4143===_0xe89f('0x5a')?'Incident':_0xe89f('0x5b');var _0x47fc4c='';var _0x1beca5='';var _0x49d488='';var _0x134e73='';var _0x494fc4='';var _0x4ce0f6='';var _0xdd7fd8='';var _0x1e27cd='';var _0x304fc1=[_0xe89f('0x5c'),_0xe89f('0x5d'),_0xe89f('0x5e'),_0xe89f('0x5f'),_0xe89f('0x60'),_0xe89f('0x61'),'phonenumber','regardingobjectid',_0xe89f('0x62'),_0xe89f('0x63')];var _0x5efa66=[_0xe89f('0x64'),_0xe89f('0x65'),_0xe89f('0x66'),_0xe89f('0x67'),'contactidname',_0xe89f('0x68'),_0xe89f('0x69'),'contractidname',_0xe89f('0x6a'),_0xe89f('0x6b'),_0xe89f('0x6c'),_0xe89f('0x6d'),'createdon',_0xe89f('0x6e'),_0xe89f('0x6f'),'customeridname','customeridtype',_0xe89f('0x70'),_0xe89f('0x71'),_0xe89f('0x72'),'entityimage_timestamp',_0xe89f('0x73'),_0xe89f('0x74'),_0xe89f('0x75'),'firstresponsebykpiidname',_0xe89f('0x76'),_0xe89f('0x77'),_0xe89f('0x78'),'kbarticleidname','lastonholdtime','masteridname',_0xe89f('0x79'),_0xe89f('0x7a'),'modifiedbyname',_0xe89f('0x7b'),'modifiedon',_0xe89f('0x7c'),_0xe89f('0x7d'),'msdyn_incidenttypename',_0xe89f('0x7e'),'numberofchildincidents',_0xe89f('0x7f'),_0xe89f('0x80'),_0xe89f('0x81'),_0xe89f('0x82'),_0xe89f('0x83'),'parentcaseidname',_0xe89f('0x84'),_0xe89f('0x85'),_0xe89f('0x86'),_0xe89f('0x87'),_0xe89f('0x88'),_0xe89f('0x89'),_0xe89f('0x8a'),_0xe89f('0x8b'),_0xe89f('0x8c'),'responsiblecontactidyominame',_0xe89f('0x8d'),'slainvokedidname',_0xe89f('0x8e'),_0xe89f('0x8f'),_0xe89f('0x90'),_0xe89f('0x91'),_0xe89f('0x92'),_0xe89f('0x93'),'timezoneruleversionnumber','transactioncurrencyidname','traversedpath',_0xe89f('0x94'),_0xe89f('0x95')];var _0x1504fb=_0x304fc1['concat'](_0x5efa66);return db[_0xe89f('0x2c')][_0xe89f('0x4f')]({'where':{'id':_0x459d65[_0xe89f('0x48')]['id']},'attributes':['id',_0xe89f('0x96'),_0xe89f('0x97'),_0xe89f('0x98'),_0xe89f('0x99'),_0xe89f('0x9a'),_0xe89f('0x9b')]})[_0xe89f('0x26')](handleEntityNotFound(_0x2766b5,null))[_0xe89f('0x26')](function(_0x293c5b){if(_0x293c5b){_0x1e27cd=_0x293c5b[_0xe89f('0x98')];var _0x1c98a5=_0x1e27cd[_0xe89f('0x9c')](-0x1);if(_0x1c98a5==='/'){_0x1e27cd=_0x1e27cd[_0xe89f('0x9d')](0x0,_0x1e27cd[_0xe89f('0x9e')](_0x1c98a5));}_0xdd7fd8=util[_0xe89f('0x9f')](_0xe89f('0xa0'),_0x1e27cd);var _0x88cec9={'method':_0xe89f('0xa1'),'uri':_0xe89f('0xa2')+_0x293c5b[_0xe89f('0x99')]+'/oauth2/token','form':{'client_id':_0x293c5b[_0xe89f('0x9a')],'resource':_0x1e27cd,'username':_0x293c5b['username'],'password':_0x293c5b[_0xe89f('0x97')],'grant_type':_0xe89f('0x97'),'client_secret':_0x293c5b[_0xe89f('0x9b')]},'json':!![]};return rp(_0x88cec9);}})[_0xe89f('0x26')](function(_0xda1a4){_0x4ce0f6=_0xda1a4[_0xe89f('0xa3')];var _0x564d9c={'method':'GET','uri':encodeURI(_0xdd7fd8+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x458276+'\x27'),'headers':{'Authorization':_0xe89f('0xa4')+_0x4ce0f6,'If-None-Match':null,'OData-Version':_0xe89f('0xa5')},'json':!![]};return rp(_0x564d9c);})[_0xe89f('0x26')](function(_0x310aa3){var _0x37bd34=_0x310aa3[_0xe89f('0xa6')][0x0];var _0x36477b=_0x37bd34[_0xe89f('0xa7')];var _0x44a5ee={'method':'GET','uri':_0xdd7fd8+_0xe89f('0xa8')+_0x36477b+_0xe89f('0xa9'),'headers':{'Authorization':_0xe89f('0xa4')+_0x4ce0f6,'If-None-Match':null,'OData-Version':_0xe89f('0xa5')},'json':!![]};return rp(_0x44a5ee);})['then'](function(_0x544f4f){_0x47fc4c=_0x544f4f;_0x1beca5=_0x47fc4c[_0xe89f('0xaa')];_0x1beca5=_['remove'](_0x1beca5,function(_0x216aea){return!_0x1504fb[_0xe89f('0xab')](_0x216aea[_0xe89f('0xac')]);});var _0x1630df=[];var _0x861f74=[];_0x1beca5[_0xe89f('0xad')](function(_0xa870d0){if(_0xa870d0[_0xe89f('0xae')]){var _0x441580=_0xa870d0['@odata.type']['substring'](_0xa870d0[_0xe89f('0xae')][_0xe89f('0x9e')]('.')+0x1);if(_0x441580===_0xe89f('0xaf')){_0x1630df[_0xe89f('0xb0')](getSelectList(_0xdd7fd8,_0xcc4143,_0x861f74,_0x47fc4c['MetadataId'],_0xa870d0[_0xe89f('0xa7')],_0x4ce0f6));}}});return Promise[_0xe89f('0xb1')](_0x1630df);})[_0xe89f('0x26')](function(_0x414bc8){_0x49d488=_0x414bc8[0x0];var _0x39db45=[];var _0x7f7498=[];_0x1beca5[_0xe89f('0xad')](function(_0x554b62){if(!_[_0xe89f('0xb2')](_0x554b62[_0xe89f('0xae')])){var _0x189a90=_0x554b62[_0xe89f('0xae')]['substring'](_0x554b62[_0xe89f('0xae')][_0xe89f('0x9e')]('.')+0x1);if(_0x189a90===_0xe89f('0xb3')){_0x39db45[_0xe89f('0xb0')](getBooleanList(_0xdd7fd8,_0xcc4143,_0x7f7498,_0x47fc4c[_0xe89f('0xa7')],_0x554b62[_0xe89f('0xa7')],_0x4ce0f6));}}});return Promise[_0xe89f('0xb1')](_0x39db45);})[_0xe89f('0x26')](function(_0x305ad7){_0x134e73=_0x305ad7[0x0];var _0x42b4ca=[];var _0x307664=[];_0x1beca5['forEach'](function(_0x47b62a){if(_0x47b62a[_0xe89f('0xae')]){var _0x129155=_0x47b62a[_0xe89f('0xae')]['substring'](_0x47b62a[_0xe89f('0xae')][_0xe89f('0x9e')]('.')+0x1);if(_0x129155===_0xe89f('0xb4')||_0x129155==='DoubleAttributeMetadata'||_0x129155===_0xe89f('0xb5')||_0x129155===_0xe89f('0xb6')||_0x129155===_0xe89f('0xb7')||_0x129155==='DateTimeAttributeMetadata'||_0x129155===_0xe89f('0xb8')||_0x129155==='EntityNameAttributeMetadata'||_0x129155==='StateAttributeMetadata'||_0x129155===_0xe89f('0xb9')){_0x42b4ca['push'](getInputList(_0xdd7fd8,_0xcc4143,_0x129155,_0x307664,_0x47fc4c['MetadataId'],_0x47b62a['MetadataId'],_0x4ce0f6));}}});return Promise['all'](_0x42b4ca);})['then'](function(_0x80b2d1){_0x494fc4=_0x80b2d1[0x0];var _0x125971=_0x49d488['concat'](_0x134e73)[_0xe89f('0xba')](_0x494fc4);var _0x329d8c={'count':_0x125971['length'],'rows':_0x125971};return _0x329d8c;})[_0xe89f('0x26')](respondWithResult(_0x2766b5,null))['catch'](function(_0x976dc9){var _0x43326d=_0x459d65[_0xe89f('0x31')][_0xe89f('0xbb')]?0x1f4:_0x976dc9[_0xe89f('0xbc')]||0x1f4;logger[_0xe89f('0x27')](_0x976dc9[_0xe89f('0xbd')]);delete _0x976dc9['name'];if(_0x43326d===0x191){_0x43326d=0x190;}_0x2766b5[_0xe89f('0x1c')](_0x43326d)[_0xe89f('0x29')](_0x459d65[_0xe89f('0x31')]['test']?{'message':_0xe89f('0xbe'),'statusCode':_0x976dc9[_0xe89f('0xbc')]}:_0x976dc9);});};function getSelectList(_0x3df2c1,_0x384f3f,_0x2d73ec,_0x43de70,_0x33d008,_0x1d7d4d){var _0x3c73f3={'method':'GET','uri':_0x3df2c1+_0xe89f('0xa8')+_0x43de70+')/Attributes('+_0x33d008+_0xe89f('0xbf')+_0xe89f('0xc0'),'headers':{'Authorization':_0xe89f('0xa4')+_0x1d7d4d,'If-None-Match':null,'OData-Version':_0xe89f('0xa5')},'json':!![]};return rp(_0x3c73f3)['then'](function(_0xee108b){var _0x1ad9fc=[];var _0xfb495e=_0xee108b[_0xe89f('0xc1')]['Options'];_0xfb495e[_0xe89f('0xad')](function(_0x2864c6){_0x1ad9fc[_0xe89f('0xb0')]({'name':_0x2864c6[_0xe89f('0xc2')][_0xe89f('0xc3')]['Label'],'value':String(_0x2864c6[_0xe89f('0xc4')])});});var _0x4c2244={'id':_0x384f3f+'_'+_0xee108b[_0xe89f('0xac')],'name':_0xee108b[_0xe89f('0xc5')][_0xe89f('0xc3')][_0xe89f('0xc2')],'custom':![],'options':_0x1ad9fc};_0x2d73ec[_0xe89f('0xb0')](_0x4c2244);return _0x2d73ec;});}function getBooleanList(_0x2b286b,_0x2f3b24,_0x29f12a,_0x10aff1,_0x3876f5,_0x3ce6f7){var _0xccf7ad={'method':_0xe89f('0xc6'),'uri':_0x2b286b+_0xe89f('0xa8')+_0x10aff1+_0xe89f('0xc7')+_0x3876f5+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xe89f('0xa4')+_0x3ce6f7,'If-None-Match':null,'OData-Version':_0xe89f('0xa5')},'json':!![]};return rp(_0xccf7ad)[_0xe89f('0x26')](function(_0x49c53f){var _0x584465=[];_0x584465[_0xe89f('0xb0')]({'name':_0x49c53f[_0xe89f('0xc1')][_0xe89f('0xc8')][_0xe89f('0xc2')]['UserLocalizedLabel'][_0xe89f('0xc2')],'value':_0xe89f('0xc9')},{'name':_0x49c53f[_0xe89f('0xc1')][_0xe89f('0xca')][_0xe89f('0xc2')]['UserLocalizedLabel'][_0xe89f('0xc2')],'value':'false'});var _0x1b7172={'id':_0x2f3b24+'_'+_0x49c53f[_0xe89f('0xac')],'name':_0x49c53f[_0xe89f('0xc5')][_0xe89f('0xc3')][_0xe89f('0xc2')],'custom':![],'options':_0x584465};_0x29f12a[_0xe89f('0xb0')](_0x1b7172);return _0x29f12a;});}function getInputList(_0x45c5ff,_0x5a93e3,_0x316c82,_0x1adc51,_0x1453e2,_0x406629,_0x36e575){var _0x426021={'method':_0xe89f('0xc6'),'uri':_0x45c5ff+_0xe89f('0xa8')+_0x1453e2+_0xe89f('0xc7')+_0x406629+_0xe89f('0xcb')+_0x316c82+_0xe89f('0xcc'),'headers':{'Authorization':_0xe89f('0xa4')+_0x36e575,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x426021)[_0xe89f('0x26')](function(_0x1b5100){var _0x11b68c={'id':_0x5a93e3+'_'+_0x1b5100[_0xe89f('0xac')],'name':_0x1b5100['DisplayName'][_0xe89f('0xc3')]?_0x1b5100[_0xe89f('0xc5')][_0xe89f('0xc3')][_0xe89f('0xc2')]:_0x1b5100[_0xe89f('0xac')],'custom':![],'options':[]};_0x1adc51[_0xe89f('0xb0')](_0x11b68c);return _0x1adc51;});} \ No newline at end of file +var _0x97d5=[')/Microsoft.Dynamics.CRM.','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','Dynamics365Account','fieldName','type','model','keys','filters','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','then','create','body','getConfigurations','findOne','options','addConfiguration','channel','Descriptions','getDescriptions','Dynamics365Field','Subjects','ticketType','incident','Incident','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','clientSecret','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','push','MetadataId','all','isNil','substring','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','false'];(function(_0x5dc0ed,_0x5c98b4){var _0x54eeab=function(_0x5b7f13){while(--_0x5b7f13){_0x5dc0ed['push'](_0x5dc0ed['shift']());}};_0x54eeab(++_0x5c98b4);}(_0x97d5,0x199));var _0x597d=function(_0x163d57,_0x12852d){_0x163d57=_0x163d57-0x0;var _0x228d41=_0x97d5[_0x163d57];return _0x228d41;};'use strict';var emlformat=require(_0x597d('0x0'));var rimraf=require(_0x597d('0x1'));var zipdir=require(_0x597d('0x2'));var jsonpatch=require(_0x597d('0x3'));var rp=require(_0x597d('0x4'));var moment=require(_0x597d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x597d('0x6'));var util=require(_0x597d('0x7'));var path=require(_0x597d('0x8'));var sox=require('sox');var csv=require(_0x597d('0x9'));var ejs=require(_0x597d('0xa'));var fs=require('fs');var fs_extra=require(_0x597d('0xb'));var _=require(_0x597d('0xc'));var squel=require(_0x597d('0xd'));var crypto=require(_0x597d('0xe'));var jsforce=require(_0x597d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x597d('0x9'));var querystring=require(_0x597d('0x10'));var Papa=require('papaparse');var Redis=require(_0x597d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x597d('0x12'));var as=require(_0x597d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x597d('0x14'));var utils=require(_0x597d('0x15'));var config=require(_0x597d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x597d('0x17'))['db'];var integrations=require(_0x597d('0x18'));function respondWithStatusCode(_0x355fbd,_0x1664e5){_0x1664e5=_0x1664e5||0xcc;return function(_0x517e34){if(_0x517e34){return _0x355fbd[_0x597d('0x19')](_0x1664e5);}return _0x355fbd[_0x597d('0x1a')](_0x1664e5)[_0x597d('0x1b')]();};}function respondWithResult(_0x810dce,_0x11147c){_0x11147c=_0x11147c||0xc8;return function(_0x35850d){if(_0x35850d){return _0x810dce[_0x597d('0x1a')](_0x11147c)[_0x597d('0x1c')](_0x35850d);}};}function respondWithFilteredResult(_0x394d1d,_0x4ca1b1){return function(_0x17b021){if(_0x17b021){var _0x487246=typeof _0x4ca1b1[_0x597d('0x1d')]===_0x597d('0x1e')&&typeof _0x4ca1b1['limit']===_0x597d('0x1e');var _0x52c211=_0x17b021[_0x597d('0x1f')];var _0x1662ec=_0x487246?0x0:_0x4ca1b1['offset'];var _0x5b1e89=_0x487246?_0x17b021['count']:_0x4ca1b1[_0x597d('0x1d')]+_0x4ca1b1[_0x597d('0x20')];var _0x150ee2;if(_0x5b1e89>=_0x52c211){_0x5b1e89=_0x52c211;_0x150ee2=0xc8;}else{_0x150ee2=0xce;}_0x394d1d[_0x597d('0x1a')](_0x150ee2);return _0x394d1d[_0x597d('0x21')](_0x597d('0x22'),_0x1662ec+'-'+_0x5b1e89+'/'+_0x52c211)[_0x597d('0x1c')](_0x17b021);}return null;};}function patchUpdates(_0x1f8966){return function(_0x438a61){try{jsonpatch[_0x597d('0x23')](_0x438a61,_0x1f8966,!![]);}catch(_0x53e7ab){return BPromise[_0x597d('0x24')](_0x53e7ab);}return _0x438a61[_0x597d('0x25')]();};}function saveUpdates(_0x639ac,_0x2d4e7b){return function(_0xeff3c2){if(_0xeff3c2){return _0xeff3c2[_0x597d('0x26')](_0x639ac)['then'](function(_0xc6ca7){return _0xc6ca7;});}return null;};}function removeEntity(_0xa0a6da,_0x104476){return function(_0x4324da){if(_0x4324da){return _0x4324da[_0x597d('0x27')]()['then'](function(){_0xa0a6da[_0x597d('0x1a')](0xcc)[_0x597d('0x1b')]();});}};}function handleEntityNotFound(_0x1379a2,_0x5a551f){return function(_0xcbc4a7){if(!_0xcbc4a7){_0x1379a2[_0x597d('0x19')](0x194);}return _0xcbc4a7;};}function handleError(_0x30d783,_0x6f424f){_0x6f424f=_0x6f424f||0x1f4;return function(_0xd552f2){logger[_0x597d('0x28')](_0xd552f2[_0x597d('0x29')]);if(_0xd552f2[_0x597d('0x2a')]){delete _0xd552f2[_0x597d('0x2a')];}_0x30d783[_0x597d('0x1a')](_0x6f424f)[_0x597d('0x2b')](_0xd552f2);};}exports[_0x597d('0x2c')]=function(_0x25ffc6,_0x2fcb0d){var _0x106b92={},_0x1cd733={},_0x3f928f={'count':0x0,'rows':[]};var _0x4bd607=_[_0x597d('0x2d')](db[_0x597d('0x2e')]['rawAttributes'],function(_0x59eb1c){return{'name':_0x59eb1c[_0x597d('0x2f')],'type':_0x59eb1c[_0x597d('0x30')]['key']};});_0x1cd733[_0x597d('0x31')]=_[_0x597d('0x2d')](_0x4bd607,_0x597d('0x2a'));_0x1cd733['query']=_[_0x597d('0x32')](_0x25ffc6['query']);_0x1cd733[_0x597d('0x33')]=_['intersection'](_0x1cd733['model'],_0x1cd733['query']);_0x106b92['attributes']=_['intersection'](_0x1cd733[_0x597d('0x31')],qs[_0x597d('0x34')](_0x25ffc6[_0x597d('0x35')][_0x597d('0x34')]));_0x106b92[_0x597d('0x36')]=_0x106b92[_0x597d('0x36')][_0x597d('0x37')]?_0x106b92[_0x597d('0x36')]:_0x1cd733['model'];if(!_0x25ffc6[_0x597d('0x35')][_0x597d('0x38')](_0x597d('0x39'))){_0x106b92[_0x597d('0x20')]=qs['limit'](_0x25ffc6[_0x597d('0x35')][_0x597d('0x20')]);_0x106b92[_0x597d('0x1d')]=qs[_0x597d('0x1d')](_0x25ffc6[_0x597d('0x35')][_0x597d('0x1d')]);}_0x106b92[_0x597d('0x3a')]=qs[_0x597d('0x3b')](_0x25ffc6[_0x597d('0x35')][_0x597d('0x3b')]);_0x106b92[_0x597d('0x3c')]=qs[_0x597d('0x33')](_[_0x597d('0x3d')](_0x25ffc6[_0x597d('0x35')],_0x1cd733[_0x597d('0x33')]),_0x4bd607);if(_0x25ffc6[_0x597d('0x35')][_0x597d('0x3e')]){_0x106b92[_0x597d('0x3c')]=_[_0x597d('0x3f')](_0x106b92[_0x597d('0x3c')],{'$or':_['map'](_0x4bd607,function(_0x5c4357){if(_0x5c4357[_0x597d('0x30')]!=='VIRTUAL'){var _0x467169={};_0x467169[_0x5c4357[_0x597d('0x2a')]]={'$like':'%'+_0x25ffc6['query']['filter']+'%'};return _0x467169;}})});}_0x106b92=_[_0x597d('0x3f')]({},_0x106b92,_0x25ffc6['options']);var _0x3dd45e={'where':_0x106b92[_0x597d('0x3c')]};return db[_0x597d('0x2e')][_0x597d('0x1f')](_0x3dd45e)['then'](function(_0x419079){_0x3f928f[_0x597d('0x1f')]=_0x419079;if(_0x25ffc6[_0x597d('0x35')][_0x597d('0x40')]){_0x106b92[_0x597d('0x41')]=[{'all':!![]}];}return db[_0x597d('0x2e')][_0x597d('0x42')](_0x106b92);})['then'](function(_0x2cd4e0){_0x3f928f[_0x597d('0x43')]=_0x2cd4e0;return _0x3f928f;})['then'](respondWithFilteredResult(_0x2fcb0d,_0x106b92))[_0x597d('0x44')](handleError(_0x2fcb0d,null));};exports[_0x597d('0x45')]=function(_0x1fe4ba,_0x1de5d7){var _0x90f83a={'raw':![],'where':{'id':_0x1fe4ba[_0x597d('0x46')]['id']}},_0x34b518={};_0x34b518[_0x597d('0x31')]=_[_0x597d('0x32')](db[_0x597d('0x2e')][_0x597d('0x47')]);_0x34b518[_0x597d('0x35')]=_[_0x597d('0x32')](_0x1fe4ba[_0x597d('0x35')]);_0x34b518['filters']=_['intersection'](_0x34b518[_0x597d('0x31')],_0x34b518['query']);_0x90f83a[_0x597d('0x36')]=_[_0x597d('0x48')](_0x34b518[_0x597d('0x31')],qs[_0x597d('0x34')](_0x1fe4ba[_0x597d('0x35')][_0x597d('0x34')]));_0x90f83a['attributes']=_0x90f83a[_0x597d('0x36')]['length']?_0x90f83a[_0x597d('0x36')]:_0x34b518[_0x597d('0x31')];if(_0x1fe4ba['query']['includeAll']){_0x90f83a[_0x597d('0x41')]=[{'all':!![]}];}_0x90f83a=_[_0x597d('0x3f')]({},_0x90f83a,_0x1fe4ba['options']);return db[_0x597d('0x2e')][_0x597d('0x49')](_0x90f83a)[_0x597d('0x4a')](handleEntityNotFound(_0x1de5d7,null))['then'](respondWithResult(_0x1de5d7,null))[_0x597d('0x44')](handleError(_0x1de5d7,null));};exports[_0x597d('0x4b')]=function(_0x243090,_0x37b46d){return db[_0x597d('0x2e')]['create'](_0x243090[_0x597d('0x4c')],{})[_0x597d('0x4a')](respondWithResult(_0x37b46d,0xc9))[_0x597d('0x44')](handleError(_0x37b46d,null));};exports[_0x597d('0x26')]=function(_0x18b043,_0x2cd5bf){if(_0x18b043['body']['id']){delete _0x18b043[_0x597d('0x4c')]['id'];}return db[_0x597d('0x2e')][_0x597d('0x49')]({'where':{'id':_0x18b043[_0x597d('0x46')]['id']}})['then'](handleEntityNotFound(_0x2cd5bf,null))[_0x597d('0x4a')](saveUpdates(_0x18b043[_0x597d('0x4c')],null))[_0x597d('0x4a')](respondWithResult(_0x2cd5bf,null))[_0x597d('0x44')](handleError(_0x2cd5bf,null));};exports[_0x597d('0x27')]=function(_0x3d8368,_0x59e284){return db[_0x597d('0x2e')][_0x597d('0x49')]({'where':{'id':_0x3d8368[_0x597d('0x46')]['id']}})[_0x597d('0x4a')](handleEntityNotFound(_0x59e284,null))[_0x597d('0x4a')](removeEntity(_0x59e284,null))[_0x597d('0x44')](handleError(_0x59e284,null));};exports[_0x597d('0x4d')]=function(_0x42e76f,_0x93c010,_0x5620f5){var _0x22fc7d={};var _0x432953={};var _0x1eacdd;var _0x55fedb;return db['Dynamics365Account'][_0x597d('0x4e')]({'where':{'id':_0x42e76f['params']['id']}})[_0x597d('0x4a')](handleEntityNotFound(_0x93c010,null))[_0x597d('0x4a')](function(_0x173a3b){if(_0x173a3b){_0x1eacdd=_0x173a3b;_0x432953['model']=_[_0x597d('0x32')](db['Dynamics365Configuration'][_0x597d('0x47')]);_0x432953[_0x597d('0x35')]=_[_0x597d('0x32')](_0x42e76f[_0x597d('0x35')]);_0x432953[_0x597d('0x33')]=_['intersection'](_0x432953[_0x597d('0x31')],_0x432953['query']);_0x22fc7d[_0x597d('0x36')]=_['intersection'](_0x432953[_0x597d('0x31')],qs[_0x597d('0x34')](_0x42e76f[_0x597d('0x35')]['fields']));_0x22fc7d[_0x597d('0x36')]=_0x22fc7d[_0x597d('0x36')][_0x597d('0x37')]?_0x22fc7d['attributes']:_0x432953[_0x597d('0x31')];_0x22fc7d[_0x597d('0x3a')]=qs[_0x597d('0x3b')](_0x42e76f[_0x597d('0x35')][_0x597d('0x3b')]);_0x22fc7d['where']=qs['filters'](_[_0x597d('0x3d')](_0x42e76f[_0x597d('0x35')],_0x432953['filters']));if(_0x42e76f[_0x597d('0x35')][_0x597d('0x3e')]){_0x22fc7d[_0x597d('0x3c')]=_[_0x597d('0x3f')](_0x22fc7d[_0x597d('0x3c')],{'$or':_[_0x597d('0x2d')](_0x22fc7d[_0x597d('0x36')],function(_0x3e2ec8){var _0x1dd9ab={};_0x1dd9ab[_0x3e2ec8]={'$like':'%'+_0x42e76f['query'][_0x597d('0x3e')]+'%'};return _0x1dd9ab;})});}_0x22fc7d=_[_0x597d('0x3f')]({},_0x22fc7d,_0x42e76f[_0x597d('0x4f')]);return _0x1eacdd['getConfigurations'](_0x22fc7d);}})[_0x597d('0x4a')](function(_0x4594bc){if(_0x4594bc){_0x55fedb=_0x4594bc['length'];if(!_0x42e76f[_0x597d('0x35')]['hasOwnProperty'](_0x597d('0x39'))){_0x22fc7d[_0x597d('0x20')]=qs[_0x597d('0x20')](_0x42e76f[_0x597d('0x35')][_0x597d('0x20')]);_0x22fc7d[_0x597d('0x1d')]=qs[_0x597d('0x1d')](_0x42e76f[_0x597d('0x35')][_0x597d('0x1d')]);}return _0x1eacdd[_0x597d('0x4d')](_0x22fc7d);}})[_0x597d('0x4a')](function(_0x455813){if(_0x455813){return _0x455813?{'count':_0x55fedb,'rows':_0x455813}:null;}})[_0x597d('0x4a')](respondWithResult(_0x93c010,null))[_0x597d('0x44')](handleError(_0x93c010,null));};exports[_0x597d('0x50')]=function(_0x53971d,_0x535719,_0x496765){if(_0x53971d[_0x597d('0x4c')]['id']){delete _0x53971d[_0x597d('0x4c')]['id'];}return db['Dynamics365Account'][_0x597d('0x4e')]({'where':{'id':_0x53971d['params']['id']}})[_0x597d('0x4a')](handleEntityNotFound(_0x535719,null))[_0x597d('0x4a')](function(_0x3fad43){if(_0x3fad43){_0x53971d[_0x597d('0x4c')]['AccountId']=_0x3fad43['id'];_0x53971d[_0x597d('0x4c')]['Subjects']=integrations['getSubjects'](_0x53971d[_0x597d('0x4c')][_0x597d('0x51')],_0x53971d[_0x597d('0x4c')][_0x597d('0x30')]);_0x53971d[_0x597d('0x4c')][_0x597d('0x52')]=integrations[_0x597d('0x53')](_0x53971d[_0x597d('0x4c')]['channel'],_0x53971d[_0x597d('0x4c')][_0x597d('0x30')]);return db['Dynamics365Configuration'][_0x597d('0x4b')](_0x53971d['body'],{'include':[{'model':db[_0x597d('0x54')],'as':_0x597d('0x55')},{'model':db[_0x597d('0x54')],'as':_0x597d('0x52')}]});}return null;})[_0x597d('0x4a')](respondWithResult(_0x535719,null))[_0x597d('0x44')](handleError(_0x535719,null));};exports['getFields']=function(_0x1ab7e9,_0x1a6d44,_0x5dbd8e){var _0x37a02e=_0x1ab7e9[_0x597d('0x35')][_0x597d('0x56')];var _0x1ef698=_0x37a02e===_0x597d('0x57')?_0x597d('0x58'):'PhoneCall';var _0x257643='';var _0x5a328d='';var _0x4a1c20='';var _0x4164c6='';var _0x3054a0='';var _0x1e4c39='';var _0x4c50d0='';var _0x62692c='';var _0x99da9c=['title','description',_0x597d('0x59'),_0x597d('0x5a'),_0x597d('0x5b'),_0x597d('0x5c'),_0x597d('0x5d'),_0x597d('0x5e'),_0x597d('0x5f'),'phonecall_activity_parties'];var _0x134a1b=[_0x597d('0x60'),_0x597d('0x61'),_0x597d('0x62'),_0x597d('0x63'),_0x597d('0x64'),_0x597d('0x65'),_0x597d('0x66'),_0x597d('0x67'),_0x597d('0x68'),_0x597d('0x69'),_0x597d('0x6a'),'createdbyyominame',_0x597d('0x6b'),'createdonbehalfbyname',_0x597d('0x6c'),_0x597d('0x6d'),_0x597d('0x6e'),_0x597d('0x6f'),'emailaddress',_0x597d('0x70'),_0x597d('0x71'),_0x597d('0x72'),'escalatedon',_0x597d('0x73'),_0x597d('0x74'),_0x597d('0x75'),_0x597d('0x76'),_0x597d('0x77'),_0x597d('0x78'),_0x597d('0x79'),_0x597d('0x7a'),_0x597d('0x7b'),_0x597d('0x7c'),_0x597d('0x7d'),_0x597d('0x7e'),'modifiedon','modifiedonbehalfbyname',_0x597d('0x7f'),_0x597d('0x80'),'msdyn_iotalertname',_0x597d('0x81'),_0x597d('0x82'),_0x597d('0x83'),_0x597d('0x84'),_0x597d('0x85'),_0x597d('0x86'),_0x597d('0x87'),_0x597d('0x88'),_0x597d('0x89'),_0x597d('0x8a'),'productidname',_0x597d('0x8b'),'resolveby',_0x597d('0x8c'),_0x597d('0x8d'),_0x597d('0x8e'),_0x597d('0x8f'),_0x597d('0x90'),'slainvokedidname',_0x597d('0x91'),_0x597d('0x92'),'statecode','statuscode','subjectidname',_0x597d('0x93'),_0x597d('0x94'),_0x597d('0x95'),_0x597d('0x96'),_0x597d('0x97'),'versionnumber'];var _0x15651a=_0x99da9c[_0x597d('0x98')](_0x134a1b);return db['Dynamics365Account']['findOne']({'where':{'id':_0x1ab7e9[_0x597d('0x46')]['id']},'attributes':['id',_0x597d('0x99'),_0x597d('0x9a'),_0x597d('0x9b'),_0x597d('0x9c'),_0x597d('0x9d'),_0x597d('0x9e')]})[_0x597d('0x4a')](handleEntityNotFound(_0x1a6d44,null))[_0x597d('0x4a')](function(_0x1d162e){if(_0x1d162e){_0x62692c=_0x1d162e['remoteUri'];var _0x36c8be=_0x62692c[_0x597d('0x9f')](-0x1);if(_0x36c8be==='/'){_0x62692c=_0x62692c['substring'](0x0,_0x62692c[_0x597d('0xa0')](_0x36c8be));}_0x4c50d0=util[_0x597d('0xa1')](_0x597d('0xa2'),_0x62692c);var _0x225c80={'method':_0x597d('0xa3'),'uri':_0x597d('0xa4')+_0x1d162e[_0x597d('0x9c')]+_0x597d('0xa5'),'form':{'client_id':_0x1d162e[_0x597d('0x9d')],'resource':_0x62692c,'username':_0x1d162e[_0x597d('0x99')],'password':_0x1d162e[_0x597d('0x9a')],'grant_type':_0x597d('0x9a'),'client_secret':_0x1d162e[_0x597d('0x9e')]},'json':!![]};return rp(_0x225c80);}})[_0x597d('0x4a')](function(_0x483250){_0x1e4c39=_0x483250[_0x597d('0xa6')];var _0x4419a0={'method':_0x597d('0xa7'),'uri':encodeURI(_0x4c50d0+_0x597d('0xa8')+_0x1ef698+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1e4c39,'If-None-Match':null,'OData-Version':_0x597d('0xa9')},'json':!![]};return rp(_0x4419a0);})[_0x597d('0x4a')](function(_0x1cdfb4){var _0x525f28=_0x1cdfb4['value'][0x0];var _0x2325b5=_0x525f28['MetadataId'];var _0x4e6364={'method':'GET','uri':_0x4c50d0+_0x597d('0xaa')+_0x2325b5+_0x597d('0xab'),'headers':{'Authorization':_0x597d('0xac')+_0x1e4c39,'If-None-Match':null,'OData-Version':_0x597d('0xa9')},'json':!![]};return rp(_0x4e6364);})[_0x597d('0x4a')](function(_0x2fa306){_0x257643=_0x2fa306;_0x5a328d=_0x257643[_0x597d('0xad')];_0x5a328d=_[_0x597d('0xae')](_0x5a328d,function(_0x5244e1){return!_0x15651a[_0x597d('0xaf')](_0x5244e1[_0x597d('0xb0')]);});var _0x48afad=[];var _0x5a4a32=[];_0x5a328d[_0x597d('0xb1')](function(_0x377996){if(_0x377996['@odata.type']){var _0x5a9b51=_0x377996[_0x597d('0xb2')]['substring'](_0x377996['@odata.type'][_0x597d('0xa0')]('.')+0x1);if(_0x5a9b51==='PicklistAttributeMetadata'){_0x48afad[_0x597d('0xb3')](getSelectList(_0x4c50d0,_0x37a02e,_0x5a4a32,_0x257643[_0x597d('0xb4')],_0x377996[_0x597d('0xb4')],_0x1e4c39));}}});return Promise[_0x597d('0xb5')](_0x48afad);})[_0x597d('0x4a')](function(_0x6ec31b){_0x4a1c20=_0x6ec31b[0x0];var _0x4bae54=[];var _0x5c2349=[];_0x5a328d['forEach'](function(_0x83821f){if(!_[_0x597d('0xb6')](_0x83821f[_0x597d('0xb2')])){var _0x2dce4d=_0x83821f[_0x597d('0xb2')]['substring'](_0x83821f[_0x597d('0xb2')][_0x597d('0xa0')]('.')+0x1);if(_0x2dce4d==='BooleanAttributeMetadata'){_0x4bae54[_0x597d('0xb3')](getBooleanList(_0x4c50d0,_0x37a02e,_0x5c2349,_0x257643[_0x597d('0xb4')],_0x83821f['MetadataId'],_0x1e4c39));}}});return Promise['all'](_0x4bae54);})[_0x597d('0x4a')](function(_0x2c5d6c){_0x4164c6=_0x2c5d6c[0x0];var _0x134def=[];var _0x350bd7=[];_0x5a328d[_0x597d('0xb1')](function(_0x10d145){if(_0x10d145[_0x597d('0xb2')]){var _0x551d9b=_0x10d145['@odata.type'][_0x597d('0xb7')](_0x10d145[_0x597d('0xb2')][_0x597d('0xa0')]('.')+0x1);if(_0x551d9b===_0x597d('0xb8')||_0x551d9b===_0x597d('0xb9')||_0x551d9b===_0x597d('0xba')||_0x551d9b===_0x597d('0xbb')||_0x551d9b===_0x597d('0xbc')||_0x551d9b===_0x597d('0xbd')||_0x551d9b===_0x597d('0xbe')||_0x551d9b==='EntityNameAttributeMetadata'||_0x551d9b===_0x597d('0xbf')||_0x551d9b===_0x597d('0xc0')){_0x134def[_0x597d('0xb3')](getInputList(_0x4c50d0,_0x37a02e,_0x551d9b,_0x350bd7,_0x257643[_0x597d('0xb4')],_0x10d145[_0x597d('0xb4')],_0x1e4c39));}}});return Promise[_0x597d('0xb5')](_0x134def);})[_0x597d('0x4a')](function(_0x57cc10){_0x3054a0=_0x57cc10[0x0];var _0xb358fd=_0x4a1c20[_0x597d('0x98')](_0x4164c6)[_0x597d('0x98')](_0x3054a0);var _0x2795e4={'count':_0xb358fd[_0x597d('0x37')],'rows':_0xb358fd};return _0x2795e4;})[_0x597d('0x4a')](respondWithResult(_0x1a6d44,null))[_0x597d('0x44')](function(_0x33220f){var _0x2114a4=_0x1ab7e9['query']['test']?0x1f4:_0x33220f[_0x597d('0xc1')]||0x1f4;logger[_0x597d('0x28')](_0x33220f[_0x597d('0x29')]);delete _0x33220f[_0x597d('0x2a')];if(_0x2114a4===0x191){_0x2114a4=0x190;}_0x1a6d44[_0x597d('0x1a')](_0x2114a4)[_0x597d('0x2b')](_0x1ab7e9[_0x597d('0x35')]['test']?{'message':_0x597d('0xc2'),'statusCode':_0x33220f['statusCode']}:_0x33220f);});};function getSelectList(_0xf9f253,_0x5c56d3,_0x2a1ce6,_0x400a03,_0x5c7221,_0xf73a9e){var _0x1d3355={'method':_0x597d('0xa7'),'uri':_0xf9f253+'EntityDefinitions('+_0x400a03+_0x597d('0xc3')+_0x5c7221+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x597d('0xc4'),'headers':{'Authorization':_0x597d('0xac')+_0xf73a9e,'If-None-Match':null,'OData-Version':_0x597d('0xa9')},'json':!![]};return rp(_0x1d3355)[_0x597d('0x4a')](function(_0x1b3706){var _0x5e701c=[];var _0xbf3185=_0x1b3706[_0x597d('0xc5')]['Options'];_0xbf3185[_0x597d('0xb1')](function(_0x37097c){_0x5e701c[_0x597d('0xb3')]({'name':_0x37097c[_0x597d('0xc6')][_0x597d('0xc7')]['Label'],'value':String(_0x37097c['Value'])});});var _0x32b562={'id':_0x5c56d3+'_'+_0x1b3706[_0x597d('0xb0')],'name':_0x1b3706[_0x597d('0xc8')]['UserLocalizedLabel'][_0x597d('0xc6')],'custom':![],'options':_0x5e701c};_0x2a1ce6[_0x597d('0xb3')](_0x32b562);return _0x2a1ce6;});}function getBooleanList(_0x202b99,_0x2c6a0d,_0x2dd8f6,_0x3276e7,_0x430039,_0x439084){var _0x3cec5a={'method':'GET','uri':_0x202b99+_0x597d('0xaa')+_0x3276e7+_0x597d('0xc3')+_0x430039+_0x597d('0xc9'),'headers':{'Authorization':'Bearer\x20'+_0x439084,'If-None-Match':null,'OData-Version':_0x597d('0xa9')},'json':!![]};return rp(_0x3cec5a)[_0x597d('0x4a')](function(_0x5ada0f){var _0x4c41a9=[];_0x4c41a9[_0x597d('0xb3')]({'name':_0x5ada0f[_0x597d('0xc5')]['TrueOption']['Label'][_0x597d('0xc7')]['Label'],'value':'true'},{'name':_0x5ada0f[_0x597d('0xc5')]['FalseOption']['Label'][_0x597d('0xc7')][_0x597d('0xc6')],'value':_0x597d('0xca')});var _0x3201b1={'id':_0x2c6a0d+'_'+_0x5ada0f[_0x597d('0xb0')],'name':_0x5ada0f[_0x597d('0xc8')][_0x597d('0xc7')][_0x597d('0xc6')],'custom':![],'options':_0x4c41a9};_0x2dd8f6[_0x597d('0xb3')](_0x3201b1);return _0x2dd8f6;});}function getInputList(_0x385189,_0xe63706,_0x16fb1d,_0x5bf87b,_0x2d5625,_0x15ff27,_0x5bee9e){var _0x22cefa={'method':_0x597d('0xa7'),'uri':_0x385189+_0x597d('0xaa')+_0x2d5625+_0x597d('0xc3')+_0x15ff27+_0x597d('0xcb')+_0x16fb1d+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x5bee9e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x22cefa)[_0x597d('0x4a')](function(_0x5e9fd6){var _0x316bd4={'id':_0xe63706+'_'+_0x5e9fd6['LogicalName'],'name':_0x5e9fd6['DisplayName'][_0x597d('0xc7')]?_0x5e9fd6[_0x597d('0xc8')][_0x597d('0xc7')][_0x597d('0xc6')]:_0x5e9fd6[_0x597d('0xb0')],'custom':![],'options':[]};_0x5bf87b[_0x597d('0xb3')](_0x316bd4);return _0x5bf87b;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 3895ad4..1fb1972 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x127499,_0x421bbd){var _0x537d68=function(_0x297bad){while(--_0x297bad){_0x127499['push'](_0x127499['shift']());}};_0x537d68(++_0x421bbd);}(_0xe706,0xa3));var _0x6e70=function(_0x4d30c0,_0x3a0ae7){_0x4d30c0=_0x4d30c0-0x0;var _0x5b0c2e=_0xe706[_0x4d30c0];return _0x5b0c2e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_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'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'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 399532e..cd65cc5 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 _0xd5aa=['model','ShowDynamics365Account','find','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x70303f,_0x3d6709){var _0x38b120=function(_0x5b2495){while(--_0x5b2495){_0x70303f['push'](_0x70303f['shift']());}};_0x38b120(++_0x3d6709);}(_0xd5aa,0x162));var _0xad5a=function(_0x4a06e7,_0x35bd05){_0x4a06e7=_0x4a06e7-0x0;var _0x5fefa8=_0xd5aa[_0x4a06e7];return _0x5fefa8;};'use strict';var _=require(_0xad5a('0x0'));var util=require(_0xad5a('0x1'));var moment=require(_0xad5a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad5a('0x3'));var db=require(_0xad5a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xad5a('0x5'))(_0xad5a('0x6'));var config=require(_0xad5a('0x7'));var jayson=require(_0xad5a('0x8'));var client=jayson[_0xad5a('0x9')][_0xad5a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17278d,_0x276d44,_0x18f5f8){return new BPromise(function(_0x2ed481,_0x57de7c){return client[_0xad5a('0xb')](_0x17278d,_0x18f5f8)[_0xad5a('0xc')](function(_0x1390c9){logger[_0xad5a('0xd')](_0xad5a('0xe'),_0x276d44,_0xad5a('0xf'));logger[_0xad5a('0x10')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x276d44,_0xad5a('0xf'),JSON['stringify'](_0x1390c9));if(_0x1390c9[_0xad5a('0x11')]){if(_0x1390c9[_0xad5a('0x11')][_0xad5a('0x12')]===0x1f4){logger[_0xad5a('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x276d44,_0x1390c9[_0xad5a('0x11')][_0xad5a('0x13')]);return _0x57de7c(_0x1390c9['error'][_0xad5a('0x13')]);}logger[_0xad5a('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x276d44,_0x1390c9[_0xad5a('0x11')]['message']);return _0x2ed481(_0x1390c9[_0xad5a('0x11')][_0xad5a('0x13')]);}else{logger[_0xad5a('0xd')](_0xad5a('0xe'),_0x276d44,_0xad5a('0xf'));_0x2ed481(_0x1390c9['result'][_0xad5a('0x13')]);}})[_0xad5a('0x14')](function(_0x5745fe){logger[_0xad5a('0x11')](_0xad5a('0xe'),_0x276d44,_0x5745fe);_0x57de7c(_0x5745fe);});});}exports[_0xad5a('0x15')]=function(_0x4d3f33){var _0x5a0983=this;return new Promise(function(_0xb65d28,_0x1f64b9){return db[_0xad5a('0x16')][_0xad5a('0x17')]({'raw':_0x4d3f33[_0xad5a('0x18')]?_0x4d3f33[_0xad5a('0x18')][_0xad5a('0x19')]===undefined?!![]:![]:!![],'where':_0x4d3f33[_0xad5a('0x18')]?_0x4d3f33[_0xad5a('0x18')][_0xad5a('0x1a')]||null:null,'attributes':_0x4d3f33[_0xad5a('0x18')]?_0x4d3f33[_0xad5a('0x18')][_0xad5a('0x1b')]||null:null,'limit':_0x4d3f33[_0xad5a('0x18')]?_0x4d3f33[_0xad5a('0x18')][_0xad5a('0x1c')]||null:null,'include':_0x4d3f33['options']?_0x4d3f33[_0xad5a('0x18')][_0xad5a('0x1d')]?_[_0xad5a('0x1e')](_0x4d3f33[_0xad5a('0x18')][_0xad5a('0x1d')],function(_0x53d6dc){return{'model':db[_0x53d6dc[_0xad5a('0x1f')]],'as':_0x53d6dc['as'],'attributes':_0x53d6dc[_0xad5a('0x1b')],'include':_0x53d6dc[_0xad5a('0x1d')]?_[_0xad5a('0x1e')](_0x53d6dc[_0xad5a('0x1d')],function(_0x59176a){return{'model':db[_0x59176a[_0xad5a('0x1f')]],'as':_0x59176a['as'],'attributes':_0x59176a[_0xad5a('0x1b')],'include':_0x59176a['include']?_['map'](_0x59176a[_0xad5a('0x1d')],function(_0x391256){return{'model':db[_0x391256[_0xad5a('0x1f')]],'as':_0x391256['as'],'attributes':_0x391256[_0xad5a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47f6e1){logger[_0xad5a('0xd')]('GetDynamics365Account',_0x4d3f33);logger['debug'](_0xad5a('0x15'),_0x4d3f33,JSON['stringify'](_0x47f6e1));_0xb65d28(_0x47f6e1);})[_0xad5a('0x14')](function(_0x300892){logger[_0xad5a('0x11')](_0xad5a('0x15'),_0x300892[_0xad5a('0x13')],_0x4d3f33);_0x1f64b9(_0x5a0983['error'](0x1f4,_0x300892[_0xad5a('0x13')]));});});};exports[_0xad5a('0x20')]=function(_0x5e0bbb){var _0x36893a=this;return new Promise(function(_0x330f34,_0x779957){return db[_0xad5a('0x16')][_0xad5a('0x21')]({'raw':_0x5e0bbb['options']?_0x5e0bbb[_0xad5a('0x18')][_0xad5a('0x19')]===undefined?!![]:![]:!![],'where':_0x5e0bbb[_0xad5a('0x18')]?_0x5e0bbb[_0xad5a('0x18')]['where']||null:null,'attributes':_0x5e0bbb[_0xad5a('0x18')]?_0x5e0bbb[_0xad5a('0x18')]['attributes']||null:null,'include':_0x5e0bbb[_0xad5a('0x18')]?_0x5e0bbb['options'][_0xad5a('0x1d')]?_[_0xad5a('0x1e')](_0x5e0bbb[_0xad5a('0x18')]['include'],function(_0x518796){return{'model':db[_0x518796[_0xad5a('0x1f')]],'as':_0x518796['as'],'attributes':_0x518796[_0xad5a('0x1b')],'include':_0x518796[_0xad5a('0x1d')]?_[_0xad5a('0x1e')](_0x518796[_0xad5a('0x1d')],function(_0x501733){return{'model':db[_0x501733['model']],'as':_0x501733['as'],'attributes':_0x501733[_0xad5a('0x1b')],'include':_0x501733[_0xad5a('0x1d')]?_['map'](_0x501733['include'],function(_0x989605){return{'model':db[_0x989605[_0xad5a('0x1f')]],'as':_0x989605['as'],'attributes':_0x989605[_0xad5a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xad5a('0xc')](function(_0x3988a9){logger[_0xad5a('0xd')]('ShowDynamics365Account',_0x5e0bbb);logger[_0xad5a('0x10')](_0xad5a('0x20'),_0x5e0bbb,JSON[_0xad5a('0x22')](_0x3988a9));_0x330f34(_0x3988a9);})['catch'](function(_0x480d25){logger[_0xad5a('0x11')](_0xad5a('0x20'),_0x480d25[_0xad5a('0x13')],_0x5e0bbb);_0x779957(_0x36893a['error'](0x1f4,_0x480d25[_0xad5a('0x13')]));});});}; \ No newline at end of file +var _0xe906=['map','model','attributes','debug','ShowDynamics365Account','Dynamics365Account','find','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','options','raw','where','limit','include'];(function(_0x39e85c,_0x3bca61){var _0xf96780=function(_0x3b0708){while(--_0x3b0708){_0x39e85c['push'](_0x39e85c['shift']());}};_0xf96780(++_0x3bca61);}(_0xe906,0x14b));var _0x6e90=function(_0xe30ca7,_0x465221){_0xe30ca7=_0xe30ca7-0x0;var _0x515a39=_0xe906[_0xe30ca7];return _0x515a39;};'use strict';var _=require(_0x6e90('0x0'));var util=require(_0x6e90('0x1'));var moment=require(_0x6e90('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e90('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6e90('0x4'));var logger=require(_0x6e90('0x5'))(_0x6e90('0x6'));var config=require(_0x6e90('0x7'));var jayson=require(_0x6e90('0x8'));var client=jayson[_0x6e90('0x9')][_0x6e90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a6b4e,_0x24a44c,_0x380d3f){return new BPromise(function(_0x582b36,_0x30b77a){return client[_0x6e90('0xb')](_0x1a6b4e,_0x380d3f)[_0x6e90('0xc')](function(_0x249d85){logger[_0x6e90('0xd')](_0x6e90('0xe'),_0x24a44c,_0x6e90('0xf'));logger['debug'](_0x6e90('0x10'),_0x24a44c,_0x6e90('0xf'),JSON[_0x6e90('0x11')](_0x249d85));if(_0x249d85[_0x6e90('0x12')]){if(_0x249d85[_0x6e90('0x12')][_0x6e90('0x13')]===0x1f4){logger[_0x6e90('0x12')](_0x6e90('0xe'),_0x24a44c,_0x249d85[_0x6e90('0x12')]['message']);return _0x30b77a(_0x249d85[_0x6e90('0x12')]['message']);}logger[_0x6e90('0x12')](_0x6e90('0xe'),_0x24a44c,_0x249d85['error'][_0x6e90('0x14')]);return _0x582b36(_0x249d85[_0x6e90('0x12')][_0x6e90('0x14')]);}else{logger[_0x6e90('0xd')](_0x6e90('0xe'),_0x24a44c,'request\x20sent');_0x582b36(_0x249d85[_0x6e90('0x15')]['message']);}})[_0x6e90('0x16')](function(_0x44eb24){logger[_0x6e90('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x24a44c,_0x44eb24);_0x30b77a(_0x44eb24);});});}exports[_0x6e90('0x17')]=function(_0x44d7de){var _0x27fc11=this;return new Promise(function(_0x21e498,_0x6d06f4){return db['Dynamics365Account']['findAll']({'raw':_0x44d7de[_0x6e90('0x18')]?_0x44d7de['options'][_0x6e90('0x19')]===undefined?!![]:![]:!![],'where':_0x44d7de[_0x6e90('0x18')]?_0x44d7de[_0x6e90('0x18')][_0x6e90('0x1a')]||null:null,'attributes':_0x44d7de[_0x6e90('0x18')]?_0x44d7de[_0x6e90('0x18')]['attributes']||null:null,'limit':_0x44d7de[_0x6e90('0x18')]?_0x44d7de[_0x6e90('0x18')][_0x6e90('0x1b')]||null:null,'include':_0x44d7de[_0x6e90('0x18')]?_0x44d7de[_0x6e90('0x18')][_0x6e90('0x1c')]?_[_0x6e90('0x1d')](_0x44d7de[_0x6e90('0x18')][_0x6e90('0x1c')],function(_0x58ecbf){return{'model':db[_0x58ecbf[_0x6e90('0x1e')]],'as':_0x58ecbf['as'],'attributes':_0x58ecbf[_0x6e90('0x1f')],'include':_0x58ecbf['include']?_['map'](_0x58ecbf[_0x6e90('0x1c')],function(_0x1b7d27){return{'model':db[_0x1b7d27[_0x6e90('0x1e')]],'as':_0x1b7d27['as'],'attributes':_0x1b7d27[_0x6e90('0x1f')],'include':_0x1b7d27[_0x6e90('0x1c')]?_[_0x6e90('0x1d')](_0x1b7d27[_0x6e90('0x1c')],function(_0x118916){return{'model':db[_0x118916['model']],'as':_0x118916['as'],'attributes':_0x118916[_0x6e90('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5717e4){logger['info'](_0x6e90('0x17'),_0x44d7de);logger[_0x6e90('0x20')](_0x6e90('0x17'),_0x44d7de,JSON[_0x6e90('0x11')](_0x5717e4));_0x21e498(_0x5717e4);})[_0x6e90('0x16')](function(_0x169d0e){logger[_0x6e90('0x12')](_0x6e90('0x17'),_0x169d0e[_0x6e90('0x14')],_0x44d7de);_0x6d06f4(_0x27fc11[_0x6e90('0x12')](0x1f4,_0x169d0e[_0x6e90('0x14')]));});});};exports[_0x6e90('0x21')]=function(_0x4dd8a8){var _0x5f6ad3=this;return new Promise(function(_0x429e6e,_0x3cf5cd){return db[_0x6e90('0x22')][_0x6e90('0x23')]({'raw':_0x4dd8a8['options']?_0x4dd8a8[_0x6e90('0x18')][_0x6e90('0x19')]===undefined?!![]:![]:!![],'where':_0x4dd8a8[_0x6e90('0x18')]?_0x4dd8a8[_0x6e90('0x18')][_0x6e90('0x1a')]||null:null,'attributes':_0x4dd8a8[_0x6e90('0x18')]?_0x4dd8a8['options'][_0x6e90('0x1f')]||null:null,'include':_0x4dd8a8[_0x6e90('0x18')]?_0x4dd8a8[_0x6e90('0x18')]['include']?_[_0x6e90('0x1d')](_0x4dd8a8[_0x6e90('0x18')][_0x6e90('0x1c')],function(_0x1706b2){return{'model':db[_0x1706b2['model']],'as':_0x1706b2['as'],'attributes':_0x1706b2[_0x6e90('0x1f')],'include':_0x1706b2[_0x6e90('0x1c')]?_[_0x6e90('0x1d')](_0x1706b2['include'],function(_0x54af8e){return{'model':db[_0x54af8e[_0x6e90('0x1e')]],'as':_0x54af8e['as'],'attributes':_0x54af8e['attributes'],'include':_0x54af8e[_0x6e90('0x1c')]?_[_0x6e90('0x1d')](_0x54af8e[_0x6e90('0x1c')],function(_0x282794){return{'model':db[_0x282794[_0x6e90('0x1e')]],'as':_0x282794['as'],'attributes':_0x282794[_0x6e90('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6e90('0xc')](function(_0x581464){logger[_0x6e90('0xd')](_0x6e90('0x21'),_0x4dd8a8);logger[_0x6e90('0x20')](_0x6e90('0x21'),_0x4dd8a8,JSON['stringify'](_0x581464));_0x429e6e(_0x581464);})[_0x6e90('0x16')](function(_0x3c4aae){logger[_0x6e90('0x12')](_0x6e90('0x21'),_0x3c4aae[_0x6e90('0x14')],_0x4dd8a8);_0x3cf5cd(_0x5f6ad3['error'](0x1f4,_0x3c4aae[_0x6e90('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 69ea3ed..8bf0adf 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 _0x2ff5=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x237de5,_0x541d3d){var _0x545649=function(_0x1bb0c5){while(--_0x1bb0c5){_0x237de5['push'](_0x237de5['shift']());}};_0x545649(++_0x541d3d);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x44ab8d,_0x1ea8e7){_0x44ab8d=_0x44ab8d-0x0;var _0x5a9510=_0x2ff5[_0x44ab8d];return _0x5a9510;};'use strict';var multer=require('multer');var util=require(_0x52ff('0x0'));var path=require(_0x52ff('0x1'));var timeout=require('connect-timeout');var express=require(_0x52ff('0x2'));var router=express[_0x52ff('0x3')]();var fs_extra=require(_0x52ff('0x4'));var auth=require(_0x52ff('0x5'));var interaction=require(_0x52ff('0x6'));var config=require(_0x52ff('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0x52ff('0x8')]('/',auth[_0x52ff('0x9')](),controller[_0x52ff('0xa')]);router['get'](_0x52ff('0xb'),auth[_0x52ff('0x9')](),controller[_0x52ff('0xc')]);router[_0x52ff('0x8')](_0x52ff('0xd'),auth[_0x52ff('0x9')](),controller[_0x52ff('0xe')]);router[_0x52ff('0x8')](_0x52ff('0xf'),auth[_0x52ff('0x9')](),controller[_0x52ff('0x10')]);router[_0x52ff('0x8')](_0x52ff('0x11'),auth[_0x52ff('0x9')](),controller[_0x52ff('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x52ff('0xb'),auth['isAuthenticated'](),controller[_0x52ff('0x13')]);router[_0x52ff('0x14')]('/:id',auth[_0x52ff('0x9')](),controller[_0x52ff('0x15')]);module[_0x52ff('0x16')]=router; \ No newline at end of file +var _0x45c2=['index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x45c2,0x68));var _0x245c=function(_0x54a479,_0x1b321d){_0x54a479=_0x54a479-0x0;var _0x2474ab=_0x45c2[_0x54a479];return _0x2474ab;};'use strict';var multer=require(_0x245c('0x0'));var util=require(_0x245c('0x1'));var path=require(_0x245c('0x2'));var timeout=require(_0x245c('0x3'));var express=require('express');var router=express[_0x245c('0x4')]();var fs_extra=require(_0x245c('0x5'));var auth=require(_0x245c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x245c('0x7'));var controller=require(_0x245c('0x8'));router[_0x245c('0x9')]('/',auth[_0x245c('0xa')](),controller[_0x245c('0xb')]);router[_0x245c('0x9')](_0x245c('0xc'),auth[_0x245c('0xa')](),controller[_0x245c('0xd')]);router[_0x245c('0x9')](_0x245c('0xe'),auth[_0x245c('0xa')](),controller['getFields']);router[_0x245c('0x9')](_0x245c('0xf'),auth[_0x245c('0xa')](),controller['getSubjects']);router['get'](_0x245c('0x10'),auth[_0x245c('0xa')](),controller['getDescriptions']);router[_0x245c('0x11')]('/',auth['isAuthenticated'](),controller[_0x245c('0x12')]);router[_0x245c('0x13')](_0x245c('0xc'),auth[_0x245c('0xa')](),controller[_0x245c('0x14')]);router['delete'](_0x245c('0xc'),auth[_0x245c('0xa')](),controller[_0x245c('0x15')]);module[_0x245c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index f5d8a5b..1035c91 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 _0x4617=['ENUM','incident','phonecall','exports','STRING'];(function(_0x1a0620,_0x4f40c3){var _0x475abc=function(_0x276d92){while(--_0x276d92){_0x1a0620['push'](_0x1a0620['shift']());}};_0x475abc(++_0x4f40c3);}(_0x4617,0x1a7));var _0x7461=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x4617[_0xfa634c];return _0x73e478;};'use strict';var Sequelize=require('sequelize');module[_0x7461('0x0')]={'name':{'type':Sequelize[_0x7461('0x1')]},'description':{'type':Sequelize[_0x7461('0x1')]},'ticketType':{'type':Sequelize[_0x7461('0x2')](_0x7461('0x3'),_0x7461('0x4')),'defaultValue':_0x7461('0x3')}}; \ No newline at end of file +var _0xe173=['exports','STRING','ENUM','phonecall','incident','sequelize'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xe173,0xc5));var _0x3e17=function(_0x491220,_0xb4cdc7){_0x491220=_0x491220-0x0;var _0x34a153=_0xe173[_0x491220];return _0x34a153;};'use strict';var Sequelize=require(_0x3e17('0x0'));module[_0x3e17('0x1')]={'name':{'type':Sequelize[_0x3e17('0x2')]},'description':{'type':Sequelize[_0x3e17('0x2')]},'ticketType':{'type':Sequelize[_0x3e17('0x3')]('incident',_0x3e17('0x4')),'defaultValue':_0x3e17('0x5')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 8a2da68..5a7bbea 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 _0x876f=['rawAttributes','create','body','find','getFields','Dynamics365Field','sort','hasOwnProperty','nolimit','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','name','send','index','Dynamics365Configuration','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params'];(function(_0xd655cc,_0x1a5c03){var _0x468a9e=function(_0x2c5ce5){while(--_0x2c5ce5){_0xd655cc['push'](_0xd655cc['shift']());}};_0x468a9e(++_0x1a5c03);}(_0x876f,0xff));var _0xf876=function(_0x52286f,_0x492e43){_0x52286f=_0x52286f-0x0;var _0x5a1482=_0x876f[_0x52286f];return _0x5a1482;};'use strict';var emlformat=require(_0xf876('0x0'));var rimraf=require(_0xf876('0x1'));var zipdir=require(_0xf876('0x2'));var jsonpatch=require(_0xf876('0x3'));var rp=require(_0xf876('0x4'));var moment=require('moment');var BPromise=require(_0xf876('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf876('0x6'));var sox=require(_0xf876('0x7'));var csv=require(_0xf876('0x8'));var ejs=require(_0xf876('0x9'));var fs=require('fs');var fs_extra=require(_0xf876('0xa'));var _=require('lodash');var squel=require(_0xf876('0xb'));var crypto=require(_0xf876('0xc'));var jsforce=require(_0xf876('0xd'));var deskjs=require(_0xf876('0xe'));var toCsv=require(_0xf876('0x8'));var querystring=require(_0xf876('0xf'));var Papa=require(_0xf876('0x10'));var Redis=require(_0xf876('0x11'));var authService=require(_0xf876('0x12'));var qs=require(_0xf876('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf876('0x14'));var logger=require(_0xf876('0x15'))(_0xf876('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf876('0x17'));var db=require(_0xf876('0x18'))['db'];function respondWithStatusCode(_0xcaa57f,_0xe64156){_0xe64156=_0xe64156||0xcc;return function(_0xbe2f69){if(_0xbe2f69){return _0xcaa57f['sendStatus'](_0xe64156);}return _0xcaa57f[_0xf876('0x19')](_0xe64156)['end']();};}function respondWithResult(_0x2b2abf,_0x428aff){_0x428aff=_0x428aff||0xc8;return function(_0x519e4b){if(_0x519e4b){return _0x2b2abf[_0xf876('0x19')](_0x428aff)[_0xf876('0x1a')](_0x519e4b);}};}function respondWithFilteredResult(_0x15a430,_0x4a3172){return function(_0x4b733e){if(_0x4b733e){var _0xdfdd6a=typeof _0x4a3172['offset']==='undefined'&&typeof _0x4a3172[_0xf876('0x1b')]===_0xf876('0x1c');var _0x29413e=_0x4b733e[_0xf876('0x1d')];var _0xb52129=_0xdfdd6a?0x0:_0x4a3172[_0xf876('0x1e')];var _0xab0129=_0xdfdd6a?_0x4b733e[_0xf876('0x1d')]:_0x4a3172[_0xf876('0x1e')]+_0x4a3172[_0xf876('0x1b')];var _0x43c52f;if(_0xab0129>=_0x29413e){_0xab0129=_0x29413e;_0x43c52f=0xc8;}else{_0x43c52f=0xce;}_0x15a430[_0xf876('0x19')](_0x43c52f);return _0x15a430[_0xf876('0x1f')](_0xf876('0x20'),_0xb52129+'-'+_0xab0129+'/'+_0x29413e)[_0xf876('0x1a')](_0x4b733e);}return null;};}function patchUpdates(_0x2fb84c){return function(_0x41e46b){try{jsonpatch[_0xf876('0x21')](_0x41e46b,_0x2fb84c,!![]);}catch(_0x35f080){return BPromise['reject'](_0x35f080);}return _0x41e46b[_0xf876('0x22')]();};}function saveUpdates(_0x526283,_0x4d592a){return function(_0x1819c5){if(_0x1819c5){return _0x1819c5[_0xf876('0x23')](_0x526283)[_0xf876('0x24')](function(_0x5d3179){return _0x5d3179;});}return null;};}function removeEntity(_0x163f5a,_0xa88e1d){return function(_0x4573fe){if(_0x4573fe){return _0x4573fe[_0xf876('0x25')]()[_0xf876('0x24')](function(){_0x163f5a[_0xf876('0x19')](0xcc)[_0xf876('0x26')]();});}};}function handleEntityNotFound(_0xe51c63,_0x205533){return function(_0x3b5dc5){if(!_0x3b5dc5){_0xe51c63[_0xf876('0x27')](0x194);}return _0x3b5dc5;};}function handleError(_0x5b5732,_0x30a4aa){_0x30a4aa=_0x30a4aa||0x1f4;return function(_0xfa2beb){logger['error'](_0xfa2beb['stack']);if(_0xfa2beb[_0xf876('0x28')]){delete _0xfa2beb[_0xf876('0x28')];}_0x5b5732['status'](_0x30a4aa)[_0xf876('0x29')](_0xfa2beb);};}exports[_0xf876('0x2a')]=function(_0x4cf69f,_0x1f71b4){var _0x1511d8={},_0x1dcdee={},_0x2e4166={'count':0x0,'rows':[]};var _0x193bc4=_['map'](db[_0xf876('0x2b')]['rawAttributes'],function(_0x104061){return{'name':_0x104061[_0xf876('0x2c')],'type':_0x104061[_0xf876('0x2d')][_0xf876('0x2e')]};});_0x1dcdee[_0xf876('0x2f')]=_['map'](_0x193bc4,'name');_0x1dcdee[_0xf876('0x30')]=_[_0xf876('0x31')](_0x4cf69f[_0xf876('0x30')]);_0x1dcdee['filters']=_[_0xf876('0x32')](_0x1dcdee[_0xf876('0x2f')],_0x1dcdee['query']);_0x1511d8[_0xf876('0x33')]=_[_0xf876('0x32')](_0x1dcdee['model'],qs[_0xf876('0x34')](_0x4cf69f['query'][_0xf876('0x34')]));_0x1511d8[_0xf876('0x33')]=_0x1511d8[_0xf876('0x33')][_0xf876('0x35')]?_0x1511d8[_0xf876('0x33')]:_0x1dcdee[_0xf876('0x2f')];if(!_0x4cf69f['query']['hasOwnProperty']('nolimit')){_0x1511d8[_0xf876('0x1b')]=qs[_0xf876('0x1b')](_0x4cf69f[_0xf876('0x30')][_0xf876('0x1b')]);_0x1511d8['offset']=qs[_0xf876('0x1e')](_0x4cf69f[_0xf876('0x30')][_0xf876('0x1e')]);}_0x1511d8[_0xf876('0x36')]=qs['sort'](_0x4cf69f[_0xf876('0x30')]['sort']);_0x1511d8[_0xf876('0x37')]=qs[_0xf876('0x38')](_[_0xf876('0x39')](_0x4cf69f[_0xf876('0x30')],_0x1dcdee[_0xf876('0x38')]),_0x193bc4);if(_0x4cf69f['query'][_0xf876('0x3a')]){_0x1511d8[_0xf876('0x37')]=_[_0xf876('0x3b')](_0x1511d8['where'],{'$or':_[_0xf876('0x3c')](_0x193bc4,function(_0xcc2a3f){if(_0xcc2a3f['type']!==_0xf876('0x3d')){var _0x12571a={};_0x12571a[_0xcc2a3f[_0xf876('0x28')]]={'$like':'%'+_0x4cf69f['query'][_0xf876('0x3a')]+'%'};return _0x12571a;}})});}_0x1511d8=_[_0xf876('0x3b')]({},_0x1511d8,_0x4cf69f[_0xf876('0x3e')]);var _0x2f32a5={'where':_0x1511d8[_0xf876('0x37')]};return db[_0xf876('0x2b')][_0xf876('0x1d')](_0x2f32a5)[_0xf876('0x24')](function(_0x74bb33){_0x2e4166[_0xf876('0x1d')]=_0x74bb33;if(_0x4cf69f['query'][_0xf876('0x3f')]){_0x1511d8[_0xf876('0x40')]=[{'all':!![]}];}return db[_0xf876('0x2b')][_0xf876('0x41')](_0x1511d8);})[_0xf876('0x24')](function(_0x17292e){_0x2e4166['rows']=_0x17292e;return _0x2e4166;})[_0xf876('0x24')](respondWithFilteredResult(_0x1f71b4,_0x1511d8))[_0xf876('0x42')](handleError(_0x1f71b4,null));};exports[_0xf876('0x43')]=function(_0x50a0b8,_0x540bdc){var _0x5ec260={'raw':![],'where':{'id':_0x50a0b8[_0xf876('0x44')]['id']}},_0x2be5b3={};_0x2be5b3[_0xf876('0x2f')]=_['keys'](db['Dynamics365Configuration'][_0xf876('0x45')]);_0x2be5b3[_0xf876('0x30')]=_['keys'](_0x50a0b8[_0xf876('0x30')]);_0x2be5b3[_0xf876('0x38')]=_['intersection'](_0x2be5b3[_0xf876('0x2f')],_0x2be5b3[_0xf876('0x30')]);_0x5ec260[_0xf876('0x33')]=_['intersection'](_0x2be5b3[_0xf876('0x2f')],qs[_0xf876('0x34')](_0x50a0b8[_0xf876('0x30')][_0xf876('0x34')]));_0x5ec260['attributes']=_0x5ec260[_0xf876('0x33')][_0xf876('0x35')]?_0x5ec260[_0xf876('0x33')]:_0x2be5b3[_0xf876('0x2f')];if(_0x50a0b8[_0xf876('0x30')][_0xf876('0x3f')]){_0x5ec260[_0xf876('0x40')]=[{'all':!![]}];}_0x5ec260=_[_0xf876('0x3b')]({},_0x5ec260,_0x50a0b8[_0xf876('0x3e')]);return db['Dynamics365Configuration']['find'](_0x5ec260)[_0xf876('0x24')](handleEntityNotFound(_0x540bdc,null))[_0xf876('0x24')](respondWithResult(_0x540bdc,null))[_0xf876('0x42')](handleError(_0x540bdc,null));};exports['create']=function(_0x5c528b,_0x18212f){return db['Dynamics365Configuration'][_0xf876('0x46')](_0x5c528b[_0xf876('0x47')],{})['then'](respondWithResult(_0x18212f,0xc9))[_0xf876('0x42')](handleError(_0x18212f,null));};exports[_0xf876('0x23')]=function(_0x6a444f,_0x2638ab){if(_0x6a444f[_0xf876('0x47')]['id']){delete _0x6a444f[_0xf876('0x47')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x6a444f[_0xf876('0x44')]['id']}})[_0xf876('0x24')](handleEntityNotFound(_0x2638ab,null))['then'](saveUpdates(_0x6a444f[_0xf876('0x47')],null))[_0xf876('0x24')](respondWithResult(_0x2638ab,null))[_0xf876('0x42')](handleError(_0x2638ab,null));};exports[_0xf876('0x25')]=function(_0x283ba2,_0x3a9cc6){return db[_0xf876('0x2b')][_0xf876('0x48')]({'where':{'id':_0x283ba2[_0xf876('0x44')]['id']}})[_0xf876('0x24')](handleEntityNotFound(_0x3a9cc6,null))['then'](removeEntity(_0x3a9cc6,null))[_0xf876('0x42')](handleError(_0x3a9cc6,null));};exports[_0xf876('0x49')]=function(_0x4be529,_0x5ae12a,_0x413c20){var _0x2e340f={};var _0x305251={};var _0x1b0404;var _0x228e5a;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x4be529[_0xf876('0x44')]['id']}})[_0xf876('0x24')](handleEntityNotFound(_0x5ae12a,null))[_0xf876('0x24')](function(_0x2fbd5c){if(_0x2fbd5c){_0x1b0404=_0x2fbd5c;_0x305251[_0xf876('0x2f')]=_['keys'](db[_0xf876('0x4a')][_0xf876('0x45')]);_0x305251['query']=_[_0xf876('0x31')](_0x4be529[_0xf876('0x30')]);_0x305251[_0xf876('0x38')]=_[_0xf876('0x32')](_0x305251[_0xf876('0x2f')],_0x305251[_0xf876('0x30')]);_0x2e340f[_0xf876('0x33')]=_[_0xf876('0x32')](_0x305251[_0xf876('0x2f')],qs[_0xf876('0x34')](_0x4be529[_0xf876('0x30')]['fields']));_0x2e340f[_0xf876('0x33')]=_0x2e340f['attributes'][_0xf876('0x35')]?_0x2e340f['attributes']:_0x305251[_0xf876('0x2f')];_0x2e340f[_0xf876('0x36')]=qs[_0xf876('0x4b')](_0x4be529[_0xf876('0x30')][_0xf876('0x4b')]);_0x2e340f[_0xf876('0x37')]=qs[_0xf876('0x38')](_['pick'](_0x4be529['query'],_0x305251[_0xf876('0x38')]));if(_0x4be529[_0xf876('0x30')]['filter']){_0x2e340f[_0xf876('0x37')]=_[_0xf876('0x3b')](_0x2e340f['where'],{'$or':_['map'](_0x2e340f[_0xf876('0x33')],function(_0xf59ad6){var _0x14bb1c={};_0x14bb1c[_0xf59ad6]={'$like':'%'+_0x4be529[_0xf876('0x30')][_0xf876('0x3a')]+'%'};return _0x14bb1c;})});}_0x2e340f=_[_0xf876('0x3b')]({},_0x2e340f,_0x4be529['options']);return _0x1b0404[_0xf876('0x49')](_0x2e340f);}})[_0xf876('0x24')](function(_0x134c27){if(_0x134c27){_0x228e5a=_0x134c27[_0xf876('0x35')];if(!_0x4be529[_0xf876('0x30')][_0xf876('0x4c')](_0xf876('0x4d'))){_0x2e340f[_0xf876('0x1b')]=qs['limit'](_0x4be529[_0xf876('0x30')][_0xf876('0x1b')]);_0x2e340f[_0xf876('0x1e')]=qs[_0xf876('0x1e')](_0x4be529[_0xf876('0x30')]['offset']);}return _0x1b0404[_0xf876('0x49')](_0x2e340f);}})[_0xf876('0x24')](function(_0x43d548){if(_0x43d548){return _0x43d548?{'count':_0x228e5a,'rows':_0x43d548}:null;}})['then'](respondWithResult(_0x5ae12a,null))[_0xf876('0x42')](handleError(_0x5ae12a,null));};exports[_0xf876('0x4e')]=function(_0x581aa3,_0x22aa49,_0x266f52){var _0x28ae24={};var _0x7da740={};var _0x4ebf9b;var _0x179b7a;return db[_0xf876('0x2b')]['findOne']({'where':{'id':_0x581aa3[_0xf876('0x44')]['id']}})[_0xf876('0x24')](handleEntityNotFound(_0x22aa49,null))[_0xf876('0x24')](function(_0x1b1dd0){if(_0x1b1dd0){_0x4ebf9b=_0x1b1dd0;_0x7da740[_0xf876('0x2f')]=_[_0xf876('0x31')](db[_0xf876('0x4a')][_0xf876('0x45')]);_0x7da740[_0xf876('0x30')]=_[_0xf876('0x31')](_0x581aa3[_0xf876('0x30')]);_0x7da740[_0xf876('0x38')]=_['intersection'](_0x7da740['model'],_0x7da740[_0xf876('0x30')]);_0x28ae24['attributes']=_[_0xf876('0x32')](_0x7da740[_0xf876('0x2f')],qs[_0xf876('0x34')](_0x581aa3['query'][_0xf876('0x34')]));_0x28ae24[_0xf876('0x33')]=_0x28ae24[_0xf876('0x33')][_0xf876('0x35')]?_0x28ae24[_0xf876('0x33')]:_0x7da740[_0xf876('0x2f')];_0x28ae24[_0xf876('0x36')]=qs[_0xf876('0x4b')](_0x581aa3[_0xf876('0x30')][_0xf876('0x4b')]);_0x28ae24[_0xf876('0x37')]=qs[_0xf876('0x38')](_[_0xf876('0x39')](_0x581aa3[_0xf876('0x30')],_0x7da740[_0xf876('0x38')]));if(_0x581aa3[_0xf876('0x30')][_0xf876('0x3a')]){_0x28ae24[_0xf876('0x37')]=_['merge'](_0x28ae24['where'],{'$or':_[_0xf876('0x3c')](_0x28ae24[_0xf876('0x33')],function(_0x6f3193){var _0x4c4b12={};_0x4c4b12[_0x6f3193]={'$like':'%'+_0x581aa3[_0xf876('0x30')]['filter']+'%'};return _0x4c4b12;})});}_0x28ae24=_[_0xf876('0x3b')]({},_0x28ae24,_0x581aa3[_0xf876('0x3e')]);return _0x4ebf9b['getSubjects'](_0x28ae24);}})[_0xf876('0x24')](function(_0x4826bf){if(_0x4826bf){_0x179b7a=_0x4826bf[_0xf876('0x35')];if(!_0x581aa3[_0xf876('0x30')]['hasOwnProperty']('nolimit')){_0x28ae24[_0xf876('0x1b')]=qs[_0xf876('0x1b')](_0x581aa3['query']['limit']);_0x28ae24[_0xf876('0x1e')]=qs[_0xf876('0x1e')](_0x581aa3[_0xf876('0x30')][_0xf876('0x1e')]);}return _0x4ebf9b[_0xf876('0x4e')](_0x28ae24);}})[_0xf876('0x24')](function(_0x5e8a7d){if(_0x5e8a7d){return _0x5e8a7d?{'count':_0x179b7a,'rows':_0x5e8a7d}:null;}})[_0xf876('0x24')](respondWithResult(_0x22aa49,null))[_0xf876('0x42')](handleError(_0x22aa49,null));};exports[_0xf876('0x4f')]=function(_0x4e7037,_0x276f4d,_0x2535aa){var _0x10ed44={};var _0x17ccbf={};var _0x153491;var _0x4dedef;return db['Dynamics365Configuration'][_0xf876('0x50')]({'where':{'id':_0x4e7037[_0xf876('0x44')]['id']}})[_0xf876('0x24')](handleEntityNotFound(_0x276f4d,null))[_0xf876('0x24')](function(_0x10858){if(_0x10858){_0x153491=_0x10858;_0x17ccbf['model']=_[_0xf876('0x31')](db['Dynamics365Field'][_0xf876('0x45')]);_0x17ccbf['query']=_[_0xf876('0x31')](_0x4e7037[_0xf876('0x30')]);_0x17ccbf['filters']=_[_0xf876('0x32')](_0x17ccbf[_0xf876('0x2f')],_0x17ccbf['query']);_0x10ed44['attributes']=_[_0xf876('0x32')](_0x17ccbf[_0xf876('0x2f')],qs[_0xf876('0x34')](_0x4e7037['query']['fields']));_0x10ed44['attributes']=_0x10ed44['attributes'][_0xf876('0x35')]?_0x10ed44[_0xf876('0x33')]:_0x17ccbf[_0xf876('0x2f')];_0x10ed44['order']=qs[_0xf876('0x4b')](_0x4e7037['query'][_0xf876('0x4b')]);_0x10ed44['where']=qs[_0xf876('0x38')](_[_0xf876('0x39')](_0x4e7037['query'],_0x17ccbf[_0xf876('0x38')]));if(_0x4e7037[_0xf876('0x30')][_0xf876('0x3a')]){_0x10ed44['where']=_[_0xf876('0x3b')](_0x10ed44['where'],{'$or':_[_0xf876('0x3c')](_0x10ed44[_0xf876('0x33')],function(_0x1f6060){var _0x3a5f24={};_0x3a5f24[_0x1f6060]={'$like':'%'+_0x4e7037[_0xf876('0x30')][_0xf876('0x3a')]+'%'};return _0x3a5f24;})});}_0x10ed44=_['merge']({},_0x10ed44,_0x4e7037[_0xf876('0x3e')]);return _0x153491['getDescriptions'](_0x10ed44);}})[_0xf876('0x24')](function(_0xcc042f){if(_0xcc042f){_0x4dedef=_0xcc042f[_0xf876('0x35')];if(!_0x4e7037[_0xf876('0x30')][_0xf876('0x4c')](_0xf876('0x4d'))){_0x10ed44[_0xf876('0x1b')]=qs[_0xf876('0x1b')](_0x4e7037['query'][_0xf876('0x1b')]);_0x10ed44[_0xf876('0x1e')]=qs[_0xf876('0x1e')](_0x4e7037[_0xf876('0x30')][_0xf876('0x1e')]);}return _0x153491['getDescriptions'](_0x10ed44);}})[_0xf876('0x24')](function(_0x49834b){if(_0x49834b){return _0x49834b?{'count':_0x4dedef,'rows':_0x49834b}:null;}})['then'](respondWithResult(_0x276f4d,null))['catch'](handleError(_0x276f4d,null));}; \ No newline at end of file +var _0x4662=['undefined','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','getFields','length','getSubjects','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x397a6e,_0x58fb92){var _0x49848b=function(_0x10a229){while(--_0x10a229){_0x397a6e['push'](_0x397a6e['shift']());}};_0x49848b(++_0x58fb92);}(_0x4662,0xd5));var _0x2466=function(_0x55f9ac,_0x480166){_0x55f9ac=_0x55f9ac-0x0;var _0x528f2e=_0x4662[_0x55f9ac];return _0x528f2e;};'use strict';var emlformat=require(_0x2466('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2466('0x1'));var jsonpatch=require(_0x2466('0x2'));var rp=require(_0x2466('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2466('0x4'));var util=require(_0x2466('0x5'));var path=require('path');var sox=require(_0x2466('0x6'));var csv=require(_0x2466('0x7'));var ejs=require(_0x2466('0x8'));var fs=require('fs');var fs_extra=require(_0x2466('0x9'));var _=require(_0x2466('0xa'));var squel=require(_0x2466('0xb'));var crypto=require(_0x2466('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2466('0xd'));var toCsv=require(_0x2466('0x7'));var querystring=require(_0x2466('0xe'));var Papa=require('papaparse');var Redis=require(_0x2466('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2466('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2466('0x11'))(_0x2466('0x12'));var utils=require(_0x2466('0x13'));var config=require(_0x2466('0x14'));var licenseUtil=require(_0x2466('0x15'));var db=require(_0x2466('0x16'))['db'];function respondWithStatusCode(_0x2132e2,_0x5a7a13){_0x5a7a13=_0x5a7a13||0xcc;return function(_0x4a9684){if(_0x4a9684){return _0x2132e2[_0x2466('0x17')](_0x5a7a13);}return _0x2132e2[_0x2466('0x18')](_0x5a7a13)[_0x2466('0x19')]();};}function respondWithResult(_0x36ef05,_0x25eba0){_0x25eba0=_0x25eba0||0xc8;return function(_0x4a723a){if(_0x4a723a){return _0x36ef05[_0x2466('0x18')](_0x25eba0)[_0x2466('0x1a')](_0x4a723a);}};}function respondWithFilteredResult(_0x332bf6,_0xd71eba){return function(_0x5caa4a){if(_0x5caa4a){var _0x57375d=typeof _0xd71eba['offset']===_0x2466('0x1b')&&typeof _0xd71eba['limit']===_0x2466('0x1b');var _0x32e5e0=_0x5caa4a['count'];var _0x419566=_0x57375d?0x0:_0xd71eba['offset'];var _0xfb94f8=_0x57375d?_0x5caa4a[_0x2466('0x1c')]:_0xd71eba['offset']+_0xd71eba['limit'];var _0x2e5da3;if(_0xfb94f8>=_0x32e5e0){_0xfb94f8=_0x32e5e0;_0x2e5da3=0xc8;}else{_0x2e5da3=0xce;}_0x332bf6[_0x2466('0x18')](_0x2e5da3);return _0x332bf6[_0x2466('0x1d')](_0x2466('0x1e'),_0x419566+'-'+_0xfb94f8+'/'+_0x32e5e0)[_0x2466('0x1a')](_0x5caa4a);}return null;};}function patchUpdates(_0x5b79af){return function(_0x52fd76){try{jsonpatch[_0x2466('0x1f')](_0x52fd76,_0x5b79af,!![]);}catch(_0x395a3f){return BPromise[_0x2466('0x20')](_0x395a3f);}return _0x52fd76[_0x2466('0x21')]();};}function saveUpdates(_0x12d228,_0x528ab3){return function(_0x3a2bba){if(_0x3a2bba){return _0x3a2bba['update'](_0x12d228)['then'](function(_0x21467e){return _0x21467e;});}return null;};}function removeEntity(_0x570cf6,_0x1367d2){return function(_0x4d7566){if(_0x4d7566){return _0x4d7566['destroy']()[_0x2466('0x22')](function(){_0x570cf6[_0x2466('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16f265,_0x3517c8){return function(_0x35e31c){if(!_0x35e31c){_0x16f265[_0x2466('0x17')](0x194);}return _0x35e31c;};}function handleError(_0x4ae9e4,_0x466b5d){_0x466b5d=_0x466b5d||0x1f4;return function(_0xa8c08){logger[_0x2466('0x23')](_0xa8c08[_0x2466('0x24')]);if(_0xa8c08[_0x2466('0x25')]){delete _0xa8c08['name'];}_0x4ae9e4[_0x2466('0x18')](_0x466b5d)[_0x2466('0x26')](_0xa8c08);};}exports['index']=function(_0x169054,_0x314162){var _0xc8de54={},_0x55247d={},_0x4b6891={'count':0x0,'rows':[]};var _0x3c3112=_[_0x2466('0x27')](db[_0x2466('0x28')][_0x2466('0x29')],function(_0x106270){return{'name':_0x106270[_0x2466('0x2a')],'type':_0x106270[_0x2466('0x2b')][_0x2466('0x2c')]};});_0x55247d[_0x2466('0x2d')]=_[_0x2466('0x27')](_0x3c3112,'name');_0x55247d[_0x2466('0x2e')]=_[_0x2466('0x2f')](_0x169054[_0x2466('0x2e')]);_0x55247d[_0x2466('0x30')]=_['intersection'](_0x55247d[_0x2466('0x2d')],_0x55247d['query']);_0xc8de54[_0x2466('0x31')]=_[_0x2466('0x32')](_0x55247d[_0x2466('0x2d')],qs['fields'](_0x169054[_0x2466('0x2e')][_0x2466('0x33')]));_0xc8de54[_0x2466('0x31')]=_0xc8de54[_0x2466('0x31')]['length']?_0xc8de54[_0x2466('0x31')]:_0x55247d['model'];if(!_0x169054[_0x2466('0x2e')][_0x2466('0x34')](_0x2466('0x35'))){_0xc8de54[_0x2466('0x36')]=qs[_0x2466('0x36')](_0x169054[_0x2466('0x2e')]['limit']);_0xc8de54[_0x2466('0x37')]=qs['offset'](_0x169054[_0x2466('0x2e')][_0x2466('0x37')]);}_0xc8de54[_0x2466('0x38')]=qs['sort'](_0x169054[_0x2466('0x2e')][_0x2466('0x39')]);_0xc8de54['where']=qs[_0x2466('0x30')](_[_0x2466('0x3a')](_0x169054[_0x2466('0x2e')],_0x55247d[_0x2466('0x30')]),_0x3c3112);if(_0x169054[_0x2466('0x2e')]['filter']){_0xc8de54[_0x2466('0x3b')]=_[_0x2466('0x3c')](_0xc8de54[_0x2466('0x3b')],{'$or':_['map'](_0x3c3112,function(_0x1fdcf3){if(_0x1fdcf3[_0x2466('0x2b')]!==_0x2466('0x3d')){var _0x210e57={};_0x210e57[_0x1fdcf3[_0x2466('0x25')]]={'$like':'%'+_0x169054[_0x2466('0x2e')][_0x2466('0x3e')]+'%'};return _0x210e57;}})});}_0xc8de54=_['merge']({},_0xc8de54,_0x169054[_0x2466('0x3f')]);var _0x5f2fef={'where':_0xc8de54[_0x2466('0x3b')]};return db[_0x2466('0x28')][_0x2466('0x1c')](_0x5f2fef)[_0x2466('0x22')](function(_0x54b581){_0x4b6891[_0x2466('0x1c')]=_0x54b581;if(_0x169054[_0x2466('0x2e')][_0x2466('0x40')]){_0xc8de54[_0x2466('0x41')]=[{'all':!![]}];}return db[_0x2466('0x28')][_0x2466('0x42')](_0xc8de54);})[_0x2466('0x22')](function(_0x185b53){_0x4b6891[_0x2466('0x43')]=_0x185b53;return _0x4b6891;})[_0x2466('0x22')](respondWithFilteredResult(_0x314162,_0xc8de54))['catch'](handleError(_0x314162,null));};exports[_0x2466('0x44')]=function(_0xb57c5c,_0x4312e9){var _0x53fb24={'raw':![],'where':{'id':_0xb57c5c[_0x2466('0x45')]['id']}},_0x53e5e0={};_0x53e5e0[_0x2466('0x2d')]=_[_0x2466('0x2f')](db['Dynamics365Configuration'][_0x2466('0x29')]);_0x53e5e0[_0x2466('0x2e')]=_['keys'](_0xb57c5c[_0x2466('0x2e')]);_0x53e5e0[_0x2466('0x30')]=_['intersection'](_0x53e5e0[_0x2466('0x2d')],_0x53e5e0[_0x2466('0x2e')]);_0x53fb24['attributes']=_[_0x2466('0x32')](_0x53e5e0[_0x2466('0x2d')],qs[_0x2466('0x33')](_0xb57c5c['query'][_0x2466('0x33')]));_0x53fb24['attributes']=_0x53fb24[_0x2466('0x31')]['length']?_0x53fb24[_0x2466('0x31')]:_0x53e5e0[_0x2466('0x2d')];if(_0xb57c5c[_0x2466('0x2e')][_0x2466('0x40')]){_0x53fb24['include']=[{'all':!![]}];}_0x53fb24=_[_0x2466('0x3c')]({},_0x53fb24,_0xb57c5c[_0x2466('0x3f')]);return db[_0x2466('0x28')][_0x2466('0x46')](_0x53fb24)[_0x2466('0x22')](handleEntityNotFound(_0x4312e9,null))[_0x2466('0x22')](respondWithResult(_0x4312e9,null))[_0x2466('0x47')](handleError(_0x4312e9,null));};exports['create']=function(_0x22a894,_0x4f4409){return db['Dynamics365Configuration'][_0x2466('0x48')](_0x22a894[_0x2466('0x49')],{})[_0x2466('0x22')](respondWithResult(_0x4f4409,0xc9))[_0x2466('0x47')](handleError(_0x4f4409,null));};exports[_0x2466('0x4a')]=function(_0x5c10e7,_0xdbaf25){if(_0x5c10e7[_0x2466('0x49')]['id']){delete _0x5c10e7['body']['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x5c10e7[_0x2466('0x45')]['id']}})['then'](handleEntityNotFound(_0xdbaf25,null))['then'](saveUpdates(_0x5c10e7['body'],null))[_0x2466('0x22')](respondWithResult(_0xdbaf25,null))[_0x2466('0x47')](handleError(_0xdbaf25,null));};exports['destroy']=function(_0x13d017,_0x334012){return db['Dynamics365Configuration'][_0x2466('0x46')]({'where':{'id':_0x13d017[_0x2466('0x45')]['id']}})[_0x2466('0x22')](handleEntityNotFound(_0x334012,null))['then'](removeEntity(_0x334012,null))[_0x2466('0x47')](handleError(_0x334012,null));};exports[_0x2466('0x4b')]=function(_0x331e65,_0xf234a4,_0x4cf091){var _0x2ef948={};var _0x4a7e6f={};var _0x3b76e0;var _0x48e75f;return db[_0x2466('0x28')]['findOne']({'where':{'id':_0x331e65[_0x2466('0x45')]['id']}})[_0x2466('0x22')](handleEntityNotFound(_0xf234a4,null))[_0x2466('0x22')](function(_0x280525){if(_0x280525){_0x3b76e0=_0x280525;_0x4a7e6f[_0x2466('0x2d')]=_[_0x2466('0x2f')](db['Dynamics365Field']['rawAttributes']);_0x4a7e6f[_0x2466('0x2e')]=_[_0x2466('0x2f')](_0x331e65['query']);_0x4a7e6f[_0x2466('0x30')]=_[_0x2466('0x32')](_0x4a7e6f['model'],_0x4a7e6f[_0x2466('0x2e')]);_0x2ef948[_0x2466('0x31')]=_['intersection'](_0x4a7e6f[_0x2466('0x2d')],qs[_0x2466('0x33')](_0x331e65['query'][_0x2466('0x33')]));_0x2ef948[_0x2466('0x31')]=_0x2ef948['attributes'][_0x2466('0x4c')]?_0x2ef948['attributes']:_0x4a7e6f[_0x2466('0x2d')];_0x2ef948['order']=qs[_0x2466('0x39')](_0x331e65[_0x2466('0x2e')]['sort']);_0x2ef948['where']=qs[_0x2466('0x30')](_[_0x2466('0x3a')](_0x331e65[_0x2466('0x2e')],_0x4a7e6f['filters']));if(_0x331e65[_0x2466('0x2e')]['filter']){_0x2ef948['where']=_[_0x2466('0x3c')](_0x2ef948[_0x2466('0x3b')],{'$or':_[_0x2466('0x27')](_0x2ef948['attributes'],function(_0x1b553e){var _0x3e131e={};_0x3e131e[_0x1b553e]={'$like':'%'+_0x331e65[_0x2466('0x2e')][_0x2466('0x3e')]+'%'};return _0x3e131e;})});}_0x2ef948=_[_0x2466('0x3c')]({},_0x2ef948,_0x331e65['options']);return _0x3b76e0[_0x2466('0x4b')](_0x2ef948);}})[_0x2466('0x22')](function(_0x5882e1){if(_0x5882e1){_0x48e75f=_0x5882e1[_0x2466('0x4c')];if(!_0x331e65[_0x2466('0x2e')]['hasOwnProperty'](_0x2466('0x35'))){_0x2ef948[_0x2466('0x36')]=qs[_0x2466('0x36')](_0x331e65[_0x2466('0x2e')][_0x2466('0x36')]);_0x2ef948[_0x2466('0x37')]=qs[_0x2466('0x37')](_0x331e65[_0x2466('0x2e')][_0x2466('0x37')]);}return _0x3b76e0[_0x2466('0x4b')](_0x2ef948);}})[_0x2466('0x22')](function(_0x33d837){if(_0x33d837){return _0x33d837?{'count':_0x48e75f,'rows':_0x33d837}:null;}})[_0x2466('0x22')](respondWithResult(_0xf234a4,null))['catch'](handleError(_0xf234a4,null));};exports[_0x2466('0x4d')]=function(_0x215177,_0x5eb15e,_0x79e5a6){var _0x5d9bdf={};var _0x5f51b1={};var _0x375f16;var _0x15e296;return db[_0x2466('0x28')]['findOne']({'where':{'id':_0x215177[_0x2466('0x45')]['id']}})[_0x2466('0x22')](handleEntityNotFound(_0x5eb15e,null))[_0x2466('0x22')](function(_0x3bd98f){if(_0x3bd98f){_0x375f16=_0x3bd98f;_0x5f51b1[_0x2466('0x2d')]=_['keys'](db['Dynamics365Field'][_0x2466('0x29')]);_0x5f51b1['query']=_[_0x2466('0x2f')](_0x215177[_0x2466('0x2e')]);_0x5f51b1[_0x2466('0x30')]=_[_0x2466('0x32')](_0x5f51b1[_0x2466('0x2d')],_0x5f51b1[_0x2466('0x2e')]);_0x5d9bdf[_0x2466('0x31')]=_[_0x2466('0x32')](_0x5f51b1[_0x2466('0x2d')],qs[_0x2466('0x33')](_0x215177[_0x2466('0x2e')][_0x2466('0x33')]));_0x5d9bdf[_0x2466('0x31')]=_0x5d9bdf['attributes']['length']?_0x5d9bdf['attributes']:_0x5f51b1['model'];_0x5d9bdf[_0x2466('0x38')]=qs[_0x2466('0x39')](_0x215177[_0x2466('0x2e')]['sort']);_0x5d9bdf['where']=qs[_0x2466('0x30')](_[_0x2466('0x3a')](_0x215177[_0x2466('0x2e')],_0x5f51b1['filters']));if(_0x215177[_0x2466('0x2e')][_0x2466('0x3e')]){_0x5d9bdf[_0x2466('0x3b')]=_['merge'](_0x5d9bdf[_0x2466('0x3b')],{'$or':_[_0x2466('0x27')](_0x5d9bdf[_0x2466('0x31')],function(_0x516580){var _0x2d80b5={};_0x2d80b5[_0x516580]={'$like':'%'+_0x215177[_0x2466('0x2e')][_0x2466('0x3e')]+'%'};return _0x2d80b5;})});}_0x5d9bdf=_[_0x2466('0x3c')]({},_0x5d9bdf,_0x215177[_0x2466('0x3f')]);return _0x375f16[_0x2466('0x4d')](_0x5d9bdf);}})['then'](function(_0x389a57){if(_0x389a57){_0x15e296=_0x389a57[_0x2466('0x4c')];if(!_0x215177[_0x2466('0x2e')]['hasOwnProperty'](_0x2466('0x35'))){_0x5d9bdf['limit']=qs[_0x2466('0x36')](_0x215177['query'][_0x2466('0x36')]);_0x5d9bdf[_0x2466('0x37')]=qs['offset'](_0x215177[_0x2466('0x2e')][_0x2466('0x37')]);}return _0x375f16[_0x2466('0x4d')](_0x5d9bdf);}})['then'](function(_0x110fcf){if(_0x110fcf){return _0x110fcf?{'count':_0x15e296,'rows':_0x110fcf}:null;}})[_0x2466('0x22')](respondWithResult(_0x5eb15e,null))[_0x2466('0x47')](handleError(_0x5eb15e,null));};exports[_0x2466('0x4e')]=function(_0x5b06a2,_0x2dd85a,_0x260fa8){var _0x157f4a={};var _0x31da00={};var _0xa9ce1f;var _0x5e7282;return db[_0x2466('0x28')][_0x2466('0x4f')]({'where':{'id':_0x5b06a2['params']['id']}})[_0x2466('0x22')](handleEntityNotFound(_0x2dd85a,null))[_0x2466('0x22')](function(_0x295226){if(_0x295226){_0xa9ce1f=_0x295226;_0x31da00[_0x2466('0x2d')]=_[_0x2466('0x2f')](db['Dynamics365Field']['rawAttributes']);_0x31da00[_0x2466('0x2e')]=_[_0x2466('0x2f')](_0x5b06a2[_0x2466('0x2e')]);_0x31da00[_0x2466('0x30')]=_['intersection'](_0x31da00[_0x2466('0x2d')],_0x31da00['query']);_0x157f4a['attributes']=_['intersection'](_0x31da00['model'],qs['fields'](_0x5b06a2[_0x2466('0x2e')]['fields']));_0x157f4a[_0x2466('0x31')]=_0x157f4a[_0x2466('0x31')][_0x2466('0x4c')]?_0x157f4a[_0x2466('0x31')]:_0x31da00[_0x2466('0x2d')];_0x157f4a['order']=qs[_0x2466('0x39')](_0x5b06a2[_0x2466('0x2e')][_0x2466('0x39')]);_0x157f4a[_0x2466('0x3b')]=qs['filters'](_[_0x2466('0x3a')](_0x5b06a2[_0x2466('0x2e')],_0x31da00[_0x2466('0x30')]));if(_0x5b06a2[_0x2466('0x2e')][_0x2466('0x3e')]){_0x157f4a[_0x2466('0x3b')]=_[_0x2466('0x3c')](_0x157f4a[_0x2466('0x3b')],{'$or':_[_0x2466('0x27')](_0x157f4a['attributes'],function(_0x5e964b){var _0x3a7fe6={};_0x3a7fe6[_0x5e964b]={'$like':'%'+_0x5b06a2[_0x2466('0x2e')][_0x2466('0x3e')]+'%'};return _0x3a7fe6;})});}_0x157f4a=_['merge']({},_0x157f4a,_0x5b06a2['options']);return _0xa9ce1f['getDescriptions'](_0x157f4a);}})[_0x2466('0x22')](function(_0x59794b){if(_0x59794b){_0x5e7282=_0x59794b[_0x2466('0x4c')];if(!_0x5b06a2[_0x2466('0x2e')][_0x2466('0x34')](_0x2466('0x35'))){_0x157f4a['limit']=qs[_0x2466('0x36')](_0x5b06a2[_0x2466('0x2e')][_0x2466('0x36')]);_0x157f4a[_0x2466('0x37')]=qs[_0x2466('0x37')](_0x5b06a2[_0x2466('0x2e')][_0x2466('0x37')]);}return _0xa9ce1f['getDescriptions'](_0x157f4a);}})[_0x2466('0x22')](function(_0x5ceabb){if(_0x5ceabb){return _0x5ceabb?{'count':_0x5e7282,'rows':_0x5ceabb}:null;}})[_0x2466('0x22')](respondWithResult(_0x2dd85a,null))['catch'](handleError(_0x2dd85a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index c225d43..673f3a2 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 _0xbec5=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird'];(function(_0x5a0ae1,_0x39aa77){var _0x2f3c94=function(_0x340374){while(--_0x340374){_0x5a0ae1['push'](_0x5a0ae1['shift']());}};_0x2f3c94(++_0x39aa77);}(_0xbec5,0xe5));var _0x5bec=function(_0x5d6c3e,_0x409a3e){_0x5d6c3e=_0x5d6c3e-0x0;var _0x44ecb7=_0xbec5[_0x5d6c3e];return _0x44ecb7;};'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 +var _0x70e0=['int_dynamics365_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0xff01d2,_0x55806d){var _0xde0945=function(_0x1423fe){while(--_0x1423fe){_0xff01d2['push'](_0xff01d2['shift']());}};_0xde0945(++_0x55806d);}(_0x70e0,0x17b));var _0x070e=function(_0x364ed2,_0x54a329){_0x364ed2=_0x364ed2-0x0;var _0x3333f9=_0x70e0[_0x364ed2];return _0x3333f9;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('Dynamics365Configuration',attributes,{'tableName':_0x070e('0x8'),'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 073a5dc..24ea829 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 _0xb04f=['request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xa6b85d,_0x7cacfa){var _0xfeaad2=function(_0x11158f){while(--_0x11158f){_0xa6b85d['push'](_0xa6b85d['shift']());}};_0xfeaad2(++_0x7cacfa);}(_0xb04f,0x1ce));var _0xfb04=function(_0x428e32,_0x362d6c){_0x428e32=_0x428e32-0x0;var _0x29ff5b=_0xb04f[_0x428e32];return _0x29ff5b;};'use strict';var _=require(_0xfb04('0x0'));var util=require(_0xfb04('0x1'));var moment=require(_0xfb04('0x2'));var BPromise=require(_0xfb04('0x3'));var rs=require(_0xfb04('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb04('0x5'))['db'];var utils=require(_0xfb04('0x6'));var logger=require(_0xfb04('0x7'))(_0xfb04('0x8'));var config=require(_0xfb04('0x9'));var jayson=require(_0xfb04('0xa'));var client=jayson[_0xfb04('0xb')][_0xfb04('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54c4f6,_0x592b16,_0x21cd07){return new BPromise(function(_0x29c9a9,_0x537711){return client[_0xfb04('0xd')](_0x54c4f6,_0x21cd07)[_0xfb04('0xe')](function(_0x6d578){logger['info'](_0xfb04('0xf'),_0x592b16,_0xfb04('0x10'));logger[_0xfb04('0x11')](_0xfb04('0x12'),_0x592b16,_0xfb04('0x10'),JSON[_0xfb04('0x13')](_0x6d578));if(_0x6d578[_0xfb04('0x14')]){if(_0x6d578['error'][_0xfb04('0x15')]===0x1f4){logger[_0xfb04('0x14')](_0xfb04('0xf'),_0x592b16,_0x6d578[_0xfb04('0x14')][_0xfb04('0x16')]);return _0x537711(_0x6d578[_0xfb04('0x14')][_0xfb04('0x16')]);}logger[_0xfb04('0x14')](_0xfb04('0xf'),_0x592b16,_0x6d578[_0xfb04('0x14')][_0xfb04('0x16')]);return _0x29c9a9(_0x6d578[_0xfb04('0x14')][_0xfb04('0x16')]);}else{logger[_0xfb04('0x17')](_0xfb04('0xf'),_0x592b16,_0xfb04('0x10'));_0x29c9a9(_0x6d578['result'][_0xfb04('0x16')]);}})[_0xfb04('0x18')](function(_0x264351){logger[_0xfb04('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x592b16,_0x264351);_0x537711(_0x264351);});});} \ No newline at end of file +var _0x817b=['../../config/logger','rpc','../../config/environment','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x21830c,_0x5d6f6a){var _0x5efa39=function(_0x13d850){while(--_0x13d850){_0x21830c['push'](_0x21830c['shift']());}};_0x5efa39(++_0x5d6f6a);}(_0x817b,0x1a9));var _0xb817=function(_0x2c704c,_0x43be3c){_0x2c704c=_0x2c704c-0x0;var _0x24b747=_0x817b[_0x2c704c];return _0x24b747;};'use strict';var _=require(_0xb817('0x0'));var util=require(_0xb817('0x1'));var moment=require(_0xb817('0x2'));var BPromise=require(_0xb817('0x3'));var rs=require(_0xb817('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb817('0x5'))['db'];var utils=require(_0xb817('0x6'));var logger=require(_0xb817('0x7'))(_0xb817('0x8'));var config=require(_0xb817('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb817('0xa')][_0xb817('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e5d3,_0x4a1bb7,_0x56fd50){return new BPromise(function(_0x43ef94,_0x4a85bb){return client[_0xb817('0xc')](_0x4e5d3,_0x56fd50)[_0xb817('0xd')](function(_0x2a338c){logger['info'](_0xb817('0xe'),_0x4a1bb7,_0xb817('0xf'));logger[_0xb817('0x10')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x4a1bb7,_0xb817('0xf'),JSON[_0xb817('0x11')](_0x2a338c));if(_0x2a338c['error']){if(_0x2a338c[_0xb817('0x12')][_0xb817('0x13')]===0x1f4){logger['error'](_0xb817('0xe'),_0x4a1bb7,_0x2a338c[_0xb817('0x12')][_0xb817('0x14')]);return _0x4a85bb(_0x2a338c[_0xb817('0x12')][_0xb817('0x14')]);}logger[_0xb817('0x12')](_0xb817('0xe'),_0x4a1bb7,_0x2a338c[_0xb817('0x12')][_0xb817('0x14')]);return _0x43ef94(_0x2a338c[_0xb817('0x12')][_0xb817('0x14')]);}else{logger[_0xb817('0x15')](_0xb817('0xe'),_0x4a1bb7,_0xb817('0xf'));_0x43ef94(_0x2a338c[_0xb817('0x16')][_0xb817('0x14')]);}})[_0xb817('0x17')](function(_0x5f4ee8){logger['error'](_0xb817('0xe'),_0x4a1bb7,_0x5f4ee8);_0x4a85bb(_0x5f4ee8);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index b91230c..f950442 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 _0xee41=['/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x4f6464,_0x19ce0b){var _0x2970c0=function(_0x30b705){while(--_0x30b705){_0x4f6464['push'](_0x4f6464['shift']());}};_0x2970c0(++_0x19ce0b);}(_0xee41,0x15b));var _0x1ee4=function(_0xd9f102,_0x5a0d28){_0xd9f102=_0xd9f102-0x0;var _0x2652e4=_0xee41[_0xd9f102];return _0x2652e4;};'use strict';var multer=require(_0x1ee4('0x0'));var util=require(_0x1ee4('0x1'));var path=require(_0x1ee4('0x2'));var timeout=require(_0x1ee4('0x3'));var express=require(_0x1ee4('0x4'));var router=express[_0x1ee4('0x5')]();var fs_extra=require(_0x1ee4('0x6'));var auth=require(_0x1ee4('0x7'));var interaction=require(_0x1ee4('0x8'));var config=require(_0x1ee4('0x9'));var controller=require('./intDynamics365Field.controller');router[_0x1ee4('0xa')]('/',auth[_0x1ee4('0xb')](),controller[_0x1ee4('0xc')]);router['get'](_0x1ee4('0xd'),auth['isAuthenticated'](),controller[_0x1ee4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1ee4('0xf')]);router[_0x1ee4('0x10')](_0x1ee4('0xd'),auth[_0x1ee4('0xb')](),controller[_0x1ee4('0x11')]);router[_0x1ee4('0x12')](_0x1ee4('0xd'),auth['isAuthenticated'](),controller[_0x1ee4('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2381=['exports','util','path','express','Router','fs-extra','../../components/auth/service','./intDynamics365Field.controller','get','isAuthenticated','/:id','post','create','delete'];(function(_0x2efed6,_0x4881e1){var _0xd9da51=function(_0x1e8dc6){while(--_0x1e8dc6){_0x2efed6['push'](_0x2efed6['shift']());}};_0xd9da51(++_0x4881e1);}(_0x2381,0x1cf));var _0x1238=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x2381[_0x5bd426];return _0x23a7eb;};'use strict';var multer=require('multer');var util=require(_0x1238('0x0'));var path=require(_0x1238('0x1'));var timeout=require('connect-timeout');var express=require(_0x1238('0x2'));var router=express[_0x1238('0x3')]();var fs_extra=require(_0x1238('0x4'));var auth=require(_0x1238('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1238('0x6'));router[_0x1238('0x7')]('/',auth[_0x1238('0x8')](),controller['index']);router[_0x1238('0x7')](_0x1238('0x9'),auth[_0x1238('0x8')](),controller['show']);router[_0x1238('0xa')]('/',auth[_0x1238('0x8')](),controller[_0x1238('0xb')]);router['put'](_0x1238('0x9'),auth[_0x1238('0x8')](),controller['update']);router[_0x1238('0xc')](_0x1238('0x9'),auth[_0x1238('0x8')](),controller['destroy']);module[_0x1238('0xd')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 84f4bc2..ff85587 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 _0x9fe7=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','picklist','STRING'];(function(_0x19fa23,_0x541bab){var _0x545014=function(_0x36970f){while(--_0x36970f){_0x19fa23['push'](_0x19fa23['shift']());}};_0x545014(++_0x541bab);}(_0x9fe7,0x1bb));var _0x79fe=function(_0x594cd6,_0x24f16e){_0x594cd6=_0x594cd6-0x0;var _0x4cf17b=_0x9fe7[_0x594cd6];return _0x4cf17b;};'use strict';var Sequelize=require(_0x79fe('0x0'));module[_0x79fe('0x1')]={'type':{'type':Sequelize['ENUM'](_0x79fe('0x2'),_0x79fe('0x3'),_0x79fe('0x4'),'keyValue',_0x79fe('0x5')),'defaultValue':_0x79fe('0x2')},'content':{'type':Sequelize[_0x79fe('0x6')]},'key':{'type':Sequelize[_0x79fe('0x6')]},'keyType':{'type':Sequelize[_0x79fe('0x7')]('string',_0x79fe('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x79fe('0x6')]},'nameField':{'type':Sequelize[_0x79fe('0x6')]},'customField':{'type':Sequelize[_0x79fe('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x79fe('0x6')]}}; \ No newline at end of file +var _0x2dab=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue','picklist','STRING','variable'];(function(_0x4cafb1,_0x2954df){var _0x5d0869=function(_0x43667a){while(--_0x43667a){_0x4cafb1['push'](_0x4cafb1['shift']());}};_0x5d0869(++_0x2954df);}(_0x2dab,0x12e));var _0xb2da=function(_0xe18851,_0x12dee9){_0xe18851=_0xe18851-0x0;var _0x4522f2=_0x2dab[_0xe18851];return _0x4522f2;};'use strict';var Sequelize=require(_0xb2da('0x0'));module[_0xb2da('0x1')]={'type':{'type':Sequelize[_0xb2da('0x2')](_0xb2da('0x3'),'variable','customVariable',_0xb2da('0x4'),_0xb2da('0x5')),'defaultValue':_0xb2da('0x3')},'content':{'type':Sequelize[_0xb2da('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb2da('0x2')](_0xb2da('0x3'),_0xb2da('0x7'),_0xb2da('0x8'))},'keyContent':{'type':Sequelize[_0xb2da('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 4de0a90..da0c5c7 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 _0x0dd3=['save','update','then','destroy','error','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject'];(function(_0x20b8e2,_0xd2e18f){var _0x495fba=function(_0x5e2641){while(--_0x5e2641){_0x20b8e2['push'](_0x20b8e2['shift']());}};_0x495fba(++_0xd2e18f);}(_0x0dd3,0x10e));var _0x30dd=function(_0x181afb,_0x318e34){_0x181afb=_0x181afb-0x0;var _0x1405cb=_0x0dd3[_0x181afb];return _0x1405cb;};'use strict';var emlformat=require(_0x30dd('0x0'));var rimraf=require(_0x30dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x30dd('0x2'));var rp=require(_0x30dd('0x3'));var moment=require('moment');var BPromise=require(_0x30dd('0x4'));var Mustache=require(_0x30dd('0x5'));var util=require(_0x30dd('0x6'));var path=require(_0x30dd('0x7'));var sox=require(_0x30dd('0x8'));var csv=require(_0x30dd('0x9'));var ejs=require(_0x30dd('0xa'));var fs=require('fs');var fs_extra=require(_0x30dd('0xb'));var _=require(_0x30dd('0xc'));var squel=require(_0x30dd('0xd'));var crypto=require(_0x30dd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x30dd('0xf'));var toCsv=require(_0x30dd('0x9'));var querystring=require('querystring');var Papa=require(_0x30dd('0x10'));var Redis=require(_0x30dd('0x11'));var authService=require(_0x30dd('0x12'));var qs=require(_0x30dd('0x13'));var as=require(_0x30dd('0x14'));var hardwareService=require(_0x30dd('0x15'));var logger=require('../../config/logger')(_0x30dd('0x16'));var utils=require(_0x30dd('0x17'));var config=require(_0x30dd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x30dd('0x19'))['db'];function respondWithStatusCode(_0x2484bc,_0x387540){_0x387540=_0x387540||0xcc;return function(_0x54c715){if(_0x54c715){return _0x2484bc[_0x30dd('0x1a')](_0x387540);}return _0x2484bc[_0x30dd('0x1b')](_0x387540)[_0x30dd('0x1c')]();};}function respondWithResult(_0x34e60d,_0x2913f8){_0x2913f8=_0x2913f8||0xc8;return function(_0x28ce3e){if(_0x28ce3e){return _0x34e60d[_0x30dd('0x1b')](_0x2913f8)[_0x30dd('0x1d')](_0x28ce3e);}};}function respondWithFilteredResult(_0x5523dc,_0x465d64){return function(_0x36a9cb){if(_0x36a9cb){var _0x52e0c8=typeof _0x465d64[_0x30dd('0x1e')]==='undefined'&&typeof _0x465d64[_0x30dd('0x1f')]===_0x30dd('0x20');var _0x3839ae=_0x36a9cb[_0x30dd('0x21')];var _0x5b84a0=_0x52e0c8?0x0:_0x465d64[_0x30dd('0x1e')];var _0x5c482c=_0x52e0c8?_0x36a9cb['count']:_0x465d64[_0x30dd('0x1e')]+_0x465d64[_0x30dd('0x1f')];var _0x39988b;if(_0x5c482c>=_0x3839ae){_0x5c482c=_0x3839ae;_0x39988b=0xc8;}else{_0x39988b=0xce;}_0x5523dc[_0x30dd('0x1b')](_0x39988b);return _0x5523dc[_0x30dd('0x22')](_0x30dd('0x23'),_0x5b84a0+'-'+_0x5c482c+'/'+_0x3839ae)['json'](_0x36a9cb);}return null;};}function patchUpdates(_0x34795a){return function(_0x456742){try{jsonpatch[_0x30dd('0x24')](_0x456742,_0x34795a,!![]);}catch(_0x46c7db){return BPromise[_0x30dd('0x25')](_0x46c7db);}return _0x456742[_0x30dd('0x26')]();};}function saveUpdates(_0xb18773,_0xfad416){return function(_0x1b2dd8){if(_0x1b2dd8){return _0x1b2dd8[_0x30dd('0x27')](_0xb18773)[_0x30dd('0x28')](function(_0x4ce87e){return _0x4ce87e;});}return null;};}function removeEntity(_0x2b69a2,_0x350f09){return function(_0x2a35c5){if(_0x2a35c5){return _0x2a35c5[_0x30dd('0x29')]()['then'](function(){_0x2b69a2[_0x30dd('0x1b')](0xcc)[_0x30dd('0x1c')]();});}};}function handleEntityNotFound(_0x514dfd,_0x2c7c9a){return function(_0x358fab){if(!_0x358fab){_0x514dfd[_0x30dd('0x1a')](0x194);}return _0x358fab;};}function handleError(_0xb505f9,_0x4faaf4){_0x4faaf4=_0x4faaf4||0x1f4;return function(_0x4f0e11){logger[_0x30dd('0x2a')](_0x4f0e11['stack']);if(_0x4f0e11[_0x30dd('0x2b')]){delete _0x4f0e11['name'];}_0xb505f9[_0x30dd('0x1b')](_0x4faaf4)[_0x30dd('0x2c')](_0x4f0e11);};}exports['index']=function(_0x5030c6,_0x24476c){var _0x30a276={},_0x21f79b={},_0x52a4f9={'count':0x0,'rows':[]};var _0x1aac13=_[_0x30dd('0x2d')](db[_0x30dd('0x2e')][_0x30dd('0x2f')],function(_0x393a9a){return{'name':_0x393a9a[_0x30dd('0x30')],'type':_0x393a9a[_0x30dd('0x31')][_0x30dd('0x32')]};});_0x21f79b[_0x30dd('0x33')]=_['map'](_0x1aac13,_0x30dd('0x2b'));_0x21f79b[_0x30dd('0x34')]=_[_0x30dd('0x35')](_0x5030c6[_0x30dd('0x34')]);_0x21f79b[_0x30dd('0x36')]=_[_0x30dd('0x37')](_0x21f79b['model'],_0x21f79b['query']);_0x30a276[_0x30dd('0x38')]=_[_0x30dd('0x37')](_0x21f79b['model'],qs[_0x30dd('0x39')](_0x5030c6[_0x30dd('0x34')][_0x30dd('0x39')]));_0x30a276['attributes']=_0x30a276[_0x30dd('0x38')][_0x30dd('0x3a')]?_0x30a276['attributes']:_0x21f79b[_0x30dd('0x33')];if(!_0x5030c6[_0x30dd('0x34')][_0x30dd('0x3b')](_0x30dd('0x3c'))){_0x30a276[_0x30dd('0x1f')]=qs[_0x30dd('0x1f')](_0x5030c6[_0x30dd('0x34')][_0x30dd('0x1f')]);_0x30a276['offset']=qs[_0x30dd('0x1e')](_0x5030c6[_0x30dd('0x34')][_0x30dd('0x1e')]);}_0x30a276['order']=qs[_0x30dd('0x3d')](_0x5030c6[_0x30dd('0x34')]['sort']);_0x30a276[_0x30dd('0x3e')]=qs['filters'](_[_0x30dd('0x3f')](_0x5030c6[_0x30dd('0x34')],_0x21f79b[_0x30dd('0x36')]),_0x1aac13);if(_0x5030c6[_0x30dd('0x34')]['filter']){_0x30a276[_0x30dd('0x3e')]=_[_0x30dd('0x40')](_0x30a276[_0x30dd('0x3e')],{'$or':_[_0x30dd('0x2d')](_0x1aac13,function(_0x10b7e8){if(_0x10b7e8[_0x30dd('0x31')]!==_0x30dd('0x41')){var _0x33909e={};_0x33909e[_0x10b7e8[_0x30dd('0x2b')]]={'$like':'%'+_0x5030c6[_0x30dd('0x34')][_0x30dd('0x42')]+'%'};return _0x33909e;}})});}_0x30a276=_[_0x30dd('0x40')]({},_0x30a276,_0x5030c6[_0x30dd('0x43')]);var _0x38445e={'where':_0x30a276['where']};return db[_0x30dd('0x2e')]['count'](_0x38445e)[_0x30dd('0x28')](function(_0x45b393){_0x52a4f9[_0x30dd('0x21')]=_0x45b393;if(_0x5030c6[_0x30dd('0x34')][_0x30dd('0x44')]){_0x30a276[_0x30dd('0x45')]=[{'all':!![]}];}return db[_0x30dd('0x2e')][_0x30dd('0x46')](_0x30a276);})['then'](function(_0x48de20){_0x52a4f9['rows']=_0x48de20;return _0x52a4f9;})[_0x30dd('0x28')](respondWithFilteredResult(_0x24476c,_0x30a276))['catch'](handleError(_0x24476c,null));};exports[_0x30dd('0x47')]=function(_0xd5b15d,_0x61df7c){var _0x52cefa={'raw':!![],'where':{'id':_0xd5b15d[_0x30dd('0x48')]['id']}},_0x57aaa2={};_0x57aaa2[_0x30dd('0x33')]=_[_0x30dd('0x35')](db['Dynamics365Field'][_0x30dd('0x2f')]);_0x57aaa2[_0x30dd('0x34')]=_[_0x30dd('0x35')](_0xd5b15d['query']);_0x57aaa2[_0x30dd('0x36')]=_[_0x30dd('0x37')](_0x57aaa2[_0x30dd('0x33')],_0x57aaa2[_0x30dd('0x34')]);_0x52cefa[_0x30dd('0x38')]=_[_0x30dd('0x37')](_0x57aaa2[_0x30dd('0x33')],qs[_0x30dd('0x39')](_0xd5b15d[_0x30dd('0x34')][_0x30dd('0x39')]));_0x52cefa['attributes']=_0x52cefa[_0x30dd('0x38')][_0x30dd('0x3a')]?_0x52cefa[_0x30dd('0x38')]:_0x57aaa2[_0x30dd('0x33')];if(_0xd5b15d['query'][_0x30dd('0x44')]){_0x52cefa['include']=[{'all':!![]}];}_0x52cefa=_['merge']({},_0x52cefa,_0xd5b15d[_0x30dd('0x43')]);return db[_0x30dd('0x2e')][_0x30dd('0x49')](_0x52cefa)[_0x30dd('0x28')](handleEntityNotFound(_0x61df7c,null))['then'](respondWithResult(_0x61df7c,null))[_0x30dd('0x4a')](handleError(_0x61df7c,null));};exports['create']=function(_0x5e3558,_0x2c5edf){return db['Dynamics365Field'][_0x30dd('0x4b')](_0x5e3558[_0x30dd('0x4c')],{})[_0x30dd('0x28')](respondWithResult(_0x2c5edf,0xc9))[_0x30dd('0x4a')](handleError(_0x2c5edf,null));};exports[_0x30dd('0x27')]=function(_0x483c31,_0x1ed04a){if(_0x483c31['body']['id']){delete _0x483c31[_0x30dd('0x4c')]['id'];}return db[_0x30dd('0x2e')][_0x30dd('0x49')]({'where':{'id':_0x483c31[_0x30dd('0x48')]['id']}})[_0x30dd('0x28')](handleEntityNotFound(_0x1ed04a,null))[_0x30dd('0x28')](saveUpdates(_0x483c31['body'],null))[_0x30dd('0x28')](respondWithResult(_0x1ed04a,null))[_0x30dd('0x4a')](handleError(_0x1ed04a,null));};exports['destroy']=function(_0x2cc0c4,_0x2ff862){return db['Dynamics365Field'][_0x30dd('0x49')]({'where':{'id':_0x2cc0c4[_0x30dd('0x48')]['id']}})[_0x30dd('0x28')](handleEntityNotFound(_0x2ff862,null))[_0x30dd('0x28')](removeEntity(_0x2ff862,null))[_0x30dd('0x4a')](handleError(_0x2ff862,null));}; \ No newline at end of file +var _0x2607=['type','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','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','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','Dynamics365Field','fieldName'];(function(_0x411e71,_0xf9652){var _0x226ae3=function(_0x1339f6){while(--_0x1339f6){_0x411e71['push'](_0x411e71['shift']());}};_0x226ae3(++_0xf9652);}(_0x2607,0x69));var _0x7260=function(_0x70fd53,_0x2a95a6){_0x70fd53=_0x70fd53-0x0;var _0x4b71c5=_0x2607[_0x70fd53];return _0x4b71c5;};'use strict';var emlformat=require(_0x7260('0x0'));var rimraf=require(_0x7260('0x1'));var zipdir=require(_0x7260('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7260('0x3'));var moment=require(_0x7260('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7260('0x5'));var util=require(_0x7260('0x6'));var path=require('path');var sox=require(_0x7260('0x7'));var csv=require(_0x7260('0x8'));var ejs=require(_0x7260('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7260('0xa'));var squel=require(_0x7260('0xb'));var crypto=require(_0x7260('0xc'));var jsforce=require(_0x7260('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7260('0x8'));var querystring=require(_0x7260('0xe'));var Papa=require('papaparse');var Redis=require(_0x7260('0xf'));var authService=require(_0x7260('0x10'));var qs=require(_0x7260('0x11'));var as=require(_0x7260('0x12'));var hardwareService=require(_0x7260('0x13'));var logger=require(_0x7260('0x14'))(_0x7260('0x15'));var utils=require(_0x7260('0x16'));var config=require(_0x7260('0x17'));var licenseUtil=require(_0x7260('0x18'));var db=require(_0x7260('0x19'))['db'];function respondWithStatusCode(_0x5f3e21,_0x218712){_0x218712=_0x218712||0xcc;return function(_0x1ea9fb){if(_0x1ea9fb){return _0x5f3e21[_0x7260('0x1a')](_0x218712);}return _0x5f3e21[_0x7260('0x1b')](_0x218712)[_0x7260('0x1c')]();};}function respondWithResult(_0x6b659e,_0x39ba0f){_0x39ba0f=_0x39ba0f||0xc8;return function(_0x198ffc){if(_0x198ffc){return _0x6b659e[_0x7260('0x1b')](_0x39ba0f)[_0x7260('0x1d')](_0x198ffc);}};}function respondWithFilteredResult(_0x2d8be9,_0x165b47){return function(_0x5525e0){if(_0x5525e0){var _0x4c45ec=typeof _0x165b47[_0x7260('0x1e')]===_0x7260('0x1f')&&typeof _0x165b47[_0x7260('0x20')]===_0x7260('0x1f');var _0x413ff1=_0x5525e0['count'];var _0x29136d=_0x4c45ec?0x0:_0x165b47[_0x7260('0x1e')];var _0x2f6510=_0x4c45ec?_0x5525e0[_0x7260('0x21')]:_0x165b47[_0x7260('0x1e')]+_0x165b47[_0x7260('0x20')];var _0x55e650;if(_0x2f6510>=_0x413ff1){_0x2f6510=_0x413ff1;_0x55e650=0xc8;}else{_0x55e650=0xce;}_0x2d8be9[_0x7260('0x1b')](_0x55e650);return _0x2d8be9['set'](_0x7260('0x22'),_0x29136d+'-'+_0x2f6510+'/'+_0x413ff1)[_0x7260('0x1d')](_0x5525e0);}return null;};}function patchUpdates(_0x23d681){return function(_0x127beb){try{jsonpatch['apply'](_0x127beb,_0x23d681,!![]);}catch(_0x44a04c){return BPromise[_0x7260('0x23')](_0x44a04c);}return _0x127beb[_0x7260('0x24')]();};}function saveUpdates(_0x1e279e,_0x2821cc){return function(_0x258092){if(_0x258092){return _0x258092['update'](_0x1e279e)[_0x7260('0x25')](function(_0x59f4de){return _0x59f4de;});}return null;};}function removeEntity(_0x1aba40,_0xf080bb){return function(_0x11095d){if(_0x11095d){return _0x11095d[_0x7260('0x26')]()['then'](function(){_0x1aba40[_0x7260('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26378e,_0x504bb6){return function(_0x3d3f8a){if(!_0x3d3f8a){_0x26378e[_0x7260('0x1a')](0x194);}return _0x3d3f8a;};}function handleError(_0xe350e8,_0xa9d1f){_0xa9d1f=_0xa9d1f||0x1f4;return function(_0x3a492d){logger[_0x7260('0x27')](_0x3a492d[_0x7260('0x28')]);if(_0x3a492d['name']){delete _0x3a492d[_0x7260('0x29')];}_0xe350e8[_0x7260('0x1b')](_0xa9d1f)[_0x7260('0x2a')](_0x3a492d);};}exports[_0x7260('0x2b')]=function(_0x25f139,_0x33f479){var _0x59dee2={},_0x11209c={},_0x790b5a={'count':0x0,'rows':[]};var _0x61236c=_[_0x7260('0x2c')](db[_0x7260('0x2d')]['rawAttributes'],function(_0x437981){return{'name':_0x437981[_0x7260('0x2e')],'type':_0x437981[_0x7260('0x2f')][_0x7260('0x30')]};});_0x11209c[_0x7260('0x31')]=_[_0x7260('0x2c')](_0x61236c,_0x7260('0x29'));_0x11209c[_0x7260('0x32')]=_[_0x7260('0x33')](_0x25f139[_0x7260('0x32')]);_0x11209c[_0x7260('0x34')]=_[_0x7260('0x35')](_0x11209c['model'],_0x11209c[_0x7260('0x32')]);_0x59dee2[_0x7260('0x36')]=_[_0x7260('0x35')](_0x11209c['model'],qs['fields'](_0x25f139[_0x7260('0x32')]['fields']));_0x59dee2[_0x7260('0x36')]=_0x59dee2[_0x7260('0x36')]['length']?_0x59dee2[_0x7260('0x36')]:_0x11209c[_0x7260('0x31')];if(!_0x25f139['query']['hasOwnProperty'](_0x7260('0x37'))){_0x59dee2[_0x7260('0x20')]=qs['limit'](_0x25f139[_0x7260('0x32')][_0x7260('0x20')]);_0x59dee2[_0x7260('0x1e')]=qs[_0x7260('0x1e')](_0x25f139[_0x7260('0x32')][_0x7260('0x1e')]);}_0x59dee2[_0x7260('0x38')]=qs['sort'](_0x25f139[_0x7260('0x32')][_0x7260('0x39')]);_0x59dee2[_0x7260('0x3a')]=qs['filters'](_[_0x7260('0x3b')](_0x25f139[_0x7260('0x32')],_0x11209c[_0x7260('0x34')]),_0x61236c);if(_0x25f139[_0x7260('0x32')]['filter']){_0x59dee2[_0x7260('0x3a')]=_[_0x7260('0x3c')](_0x59dee2[_0x7260('0x3a')],{'$or':_[_0x7260('0x2c')](_0x61236c,function(_0x4b1264){if(_0x4b1264[_0x7260('0x2f')]!=='VIRTUAL'){var _0x5a21e4={};_0x5a21e4[_0x4b1264[_0x7260('0x29')]]={'$like':'%'+_0x25f139[_0x7260('0x32')][_0x7260('0x3d')]+'%'};return _0x5a21e4;}})});}_0x59dee2=_[_0x7260('0x3c')]({},_0x59dee2,_0x25f139[_0x7260('0x3e')]);var _0x20bda1={'where':_0x59dee2[_0x7260('0x3a')]};return db[_0x7260('0x2d')][_0x7260('0x21')](_0x20bda1)[_0x7260('0x25')](function(_0x47ad69){_0x790b5a[_0x7260('0x21')]=_0x47ad69;if(_0x25f139[_0x7260('0x32')][_0x7260('0x3f')]){_0x59dee2[_0x7260('0x40')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x7260('0x41')](_0x59dee2);})[_0x7260('0x25')](function(_0x44a541){_0x790b5a[_0x7260('0x42')]=_0x44a541;return _0x790b5a;})[_0x7260('0x25')](respondWithFilteredResult(_0x33f479,_0x59dee2))[_0x7260('0x43')](handleError(_0x33f479,null));};exports[_0x7260('0x44')]=function(_0x6f1dab,_0x254d34){var _0x47357a={'raw':!![],'where':{'id':_0x6f1dab[_0x7260('0x45')]['id']}},_0x26b5b5={};_0x26b5b5[_0x7260('0x31')]=_[_0x7260('0x33')](db[_0x7260('0x2d')][_0x7260('0x46')]);_0x26b5b5['query']=_[_0x7260('0x33')](_0x6f1dab[_0x7260('0x32')]);_0x26b5b5[_0x7260('0x34')]=_[_0x7260('0x35')](_0x26b5b5[_0x7260('0x31')],_0x26b5b5[_0x7260('0x32')]);_0x47357a[_0x7260('0x36')]=_[_0x7260('0x35')](_0x26b5b5[_0x7260('0x31')],qs['fields'](_0x6f1dab[_0x7260('0x32')][_0x7260('0x47')]));_0x47357a['attributes']=_0x47357a['attributes'][_0x7260('0x48')]?_0x47357a[_0x7260('0x36')]:_0x26b5b5[_0x7260('0x31')];if(_0x6f1dab[_0x7260('0x32')][_0x7260('0x3f')]){_0x47357a[_0x7260('0x40')]=[{'all':!![]}];}_0x47357a=_['merge']({},_0x47357a,_0x6f1dab['options']);return db[_0x7260('0x2d')][_0x7260('0x49')](_0x47357a)[_0x7260('0x25')](handleEntityNotFound(_0x254d34,null))[_0x7260('0x25')](respondWithResult(_0x254d34,null))[_0x7260('0x43')](handleError(_0x254d34,null));};exports['create']=function(_0x307128,_0x529648){return db['Dynamics365Field'][_0x7260('0x4a')](_0x307128[_0x7260('0x4b')],{})[_0x7260('0x25')](respondWithResult(_0x529648,0xc9))['catch'](handleError(_0x529648,null));};exports['update']=function(_0x1230b4,_0x2e7ec0){if(_0x1230b4[_0x7260('0x4b')]['id']){delete _0x1230b4[_0x7260('0x4b')]['id'];}return db[_0x7260('0x2d')][_0x7260('0x49')]({'where':{'id':_0x1230b4[_0x7260('0x45')]['id']}})[_0x7260('0x25')](handleEntityNotFound(_0x2e7ec0,null))[_0x7260('0x25')](saveUpdates(_0x1230b4[_0x7260('0x4b')],null))['then'](respondWithResult(_0x2e7ec0,null))['catch'](handleError(_0x2e7ec0,null));};exports[_0x7260('0x26')]=function(_0xe19f82,_0x56588e){return db[_0x7260('0x2d')][_0x7260('0x49')]({'where':{'id':_0xe19f82['params']['id']}})[_0x7260('0x25')](handleEntityNotFound(_0x56588e,null))[_0x7260('0x25')](removeEntity(_0x56588e,null))[_0x7260('0x43')](handleError(_0x56588e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index ab7bf31..5c0715c 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 _0x5029=['dynamics365_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports','Dynamics365Field','int_dynamics365_fields'];(function(_0x3f1688,_0x34b8ad){var _0x5390e8=function(_0x2a5a3b){while(--_0x2a5a3b){_0x3f1688['push'](_0x3f1688['shift']());}};_0x5390e8(++_0x34b8ad);}(_0x5029,0xfe));var _0x9502=function(_0x47c227,_0x1fb3c8){_0x47c227=_0x47c227-0x0;var _0x511253=_0x5029[_0x47c227];return _0x511253;};'use strict';var _=require(_0x9502('0x0'));var util=require(_0x9502('0x1'));var logger=require(_0x9502('0x2'))(_0x9502('0x3'));var moment=require(_0x9502('0x4'));var BPromise=require('bluebird');var rp=require(_0x9502('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9502('0x6'));var attributes=require('./intDynamics365Field.attributes');module[_0x9502('0x7')]=function(_0x455be8,_0x51fa47){return _0x455be8['define'](_0x9502('0x8'),attributes,{'tableName':_0x9502('0x9'),'paranoid':![],'indexes':[{'name':_0x9502('0xa'),'fields':['idField',_0x9502('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfc09=['dynamics365_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0xfc09,0xa8));var _0x9fc0=function(_0x1935e1,_0xdaca61){_0x1935e1=_0x1935e1-0x0;var _0x132b50=_0xfc09[_0x1935e1];return _0x132b50;};'use strict';var _=require(_0x9fc0('0x0'));var util=require(_0x9fc0('0x1'));var logger=require('../../config/logger')(_0x9fc0('0x2'));var moment=require(_0x9fc0('0x3'));var BPromise=require(_0x9fc0('0x4'));var rp=require(_0x9fc0('0x5'));var fs=require('fs');var path=require(_0x9fc0('0x6'));var rimraf=require(_0x9fc0('0x7'));var config=require('../../config/environment');var attributes=require(_0x9fc0('0x8'));module[_0x9fc0('0x9')]=function(_0x5d4d3f,_0x134064){return _0x5d4d3f['define'](_0x9fc0('0xa'),attributes,{'tableName':_0x9fc0('0xb'),'paranoid':![],'indexes':[{'name':_0x9fc0('0xc'),'fields':[_0x9fc0('0xd'),_0x9fc0('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 d5cf91d..4ef1bab 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 _0x28b8=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x28b8,0x18c));var _0x828b=function(_0x463ca0,_0x23a9a8){_0x463ca0=_0x463ca0-0x0;var _0x65ff5f=_0x28b8[_0x463ca0];return _0x65ff5f;};'use strict';var _=require('lodash');var util=require(_0x828b('0x0'));var moment=require(_0x828b('0x1'));var BPromise=require('bluebird');var rs=require(_0x828b('0x2'));var fs=require('fs');var Redis=require(_0x828b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x828b('0x4'));var logger=require(_0x828b('0x5'))(_0x828b('0x6'));var config=require(_0x828b('0x7'));var jayson=require(_0x828b('0x8'));var client=jayson[_0x828b('0x9')][_0x828b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22246f,_0x72e2bc,_0x26cf68){return new BPromise(function(_0xe2e229,_0x5b5a97){return client['request'](_0x22246f,_0x26cf68)[_0x828b('0xb')](function(_0x13e3b7){logger[_0x828b('0xc')](_0x828b('0xd'),_0x72e2bc,_0x828b('0xe'));logger[_0x828b('0xf')](_0x828b('0x10'),_0x72e2bc,_0x828b('0xe'),JSON['stringify'](_0x13e3b7));if(_0x13e3b7['error']){if(_0x13e3b7[_0x828b('0x11')][_0x828b('0x12')]===0x1f4){logger[_0x828b('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x72e2bc,_0x13e3b7['error'][_0x828b('0x13')]);return _0x5b5a97(_0x13e3b7[_0x828b('0x11')]['message']);}logger[_0x828b('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x72e2bc,_0x13e3b7['error'][_0x828b('0x13')]);return _0xe2e229(_0x13e3b7[_0x828b('0x11')]['message']);}else{logger[_0x828b('0xc')](_0x828b('0xd'),_0x72e2bc,'request\x20sent');_0xe2e229(_0x13e3b7[_0x828b('0x14')][_0x828b('0x13')]);}})[_0x828b('0x15')](function(_0x4691a9){logger[_0x828b('0x11')](_0x828b('0xd'),_0x72e2bc,_0x4691a9);_0x5b5a97(_0x4691a9);});});} \ No newline at end of file +var _0xfeb3=['error','code','message','result','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x108866,_0x5c6e14){var _0x53e5db=function(_0x23bc23){while(--_0x23bc23){_0x108866['push'](_0x108866['shift']());}};_0x53e5db(++_0x5c6e14);}(_0xfeb3,0xca));var _0x3feb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfeb3[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x3feb('0x0'));var util=require(_0x3feb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3feb('0x2'));var db=require(_0x3feb('0x3'))['db'];var utils=require(_0x3feb('0x4'));var logger=require(_0x3feb('0x5'))(_0x3feb('0x6'));var config=require('../../config/environment');var jayson=require(_0x3feb('0x7'));var client=jayson[_0x3feb('0x8')][_0x3feb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x240752,_0x4b0262,_0x3deb89){return new BPromise(function(_0x36ea16,_0x13d622){return client['request'](_0x240752,_0x3deb89)['then'](function(_0x3529de){logger[_0x3feb('0xa')](_0x3feb('0xb'),_0x4b0262,'request\x20sent');logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4b0262,_0x3feb('0xc'),JSON[_0x3feb('0xd')](_0x3529de));if(_0x3529de['error']){if(_0x3529de[_0x3feb('0xe')][_0x3feb('0xf')]===0x1f4){logger[_0x3feb('0xe')](_0x3feb('0xb'),_0x4b0262,_0x3529de[_0x3feb('0xe')][_0x3feb('0x10')]);return _0x13d622(_0x3529de[_0x3feb('0xe')][_0x3feb('0x10')]);}logger['error'](_0x3feb('0xb'),_0x4b0262,_0x3529de[_0x3feb('0xe')][_0x3feb('0x10')]);return _0x36ea16(_0x3529de[_0x3feb('0xe')][_0x3feb('0x10')]);}else{logger['info'](_0x3feb('0xb'),_0x4b0262,_0x3feb('0xc'));_0x36ea16(_0x3529de[_0x3feb('0x11')][_0x3feb('0x10')]);}})['catch'](function(_0x557551){logger[_0x3feb('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x4b0262,_0x557551);_0x13d622(_0x557551);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 0cf7061..dd2c78c 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 _0xf67a=['show','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x545773,_0x5160c5){var _0x4f1176=function(_0x1d9516){while(--_0x1d9516){_0x545773['push'](_0x545773['shift']());}};_0x4f1176(++_0x5160c5);}(_0xf67a,0x10c));var _0xaf67=function(_0x42a99e,_0x58920a){_0x42a99e=_0x42a99e-0x0;var _0x3494d3=_0xf67a[_0x42a99e];return _0x3494d3;};'use strict';var multer=require(_0xaf67('0x0'));var util=require(_0xaf67('0x1'));var path=require('path');var timeout=require(_0xaf67('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xaf67('0x3'));var auth=require(_0xaf67('0x4'));var interaction=require(_0xaf67('0x5'));var config=require(_0xaf67('0x6'));var controller=require(_0xaf67('0x7'));router[_0xaf67('0x8')]('/',auth[_0xaf67('0x9')](),controller[_0xaf67('0xa')]);router['get'](_0xaf67('0xb'),auth[_0xaf67('0x9')](),controller[_0xaf67('0xc')]);router[_0xaf67('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xaf67('0xd')]);router[_0xaf67('0x8')](_0xaf67('0xe'),auth[_0xaf67('0x9')](),controller['getFields']);router['post']('/',auth[_0xaf67('0x9')](),controller['create']);router[_0xaf67('0xf')]('/:id/configurations',auth[_0xaf67('0x9')](),controller[_0xaf67('0x10')]);router[_0xaf67('0x11')](_0xaf67('0xb'),auth['isAuthenticated'](),controller[_0xaf67('0x12')]);router[_0xaf67('0x13')](_0xaf67('0xb'),auth[_0xaf67('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2abc=['getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','isAuthenticated','get','/:id','/:id/configurations','getConfigurations','/:id/fields'];(function(_0xc5e02a,_0xd9da3c){var _0xbeca77=function(_0x2a7d11){while(--_0x2a7d11){_0xc5e02a['push'](_0xc5e02a['shift']());}};_0xbeca77(++_0xd9da3c);}(_0x2abc,0xe4));var _0xc2ab=function(_0x293880,_0x444dd1){_0x293880=_0x293880-0x0;var _0x478d27=_0x2abc[_0x293880];return _0x478d27;};'use strict';var multer=require(_0xc2ab('0x0'));var util=require(_0xc2ab('0x1'));var path=require(_0xc2ab('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc2ab('0x3')]();var fs_extra=require(_0xc2ab('0x4'));var auth=require(_0xc2ab('0x5'));var interaction=require(_0xc2ab('0x6'));var config=require('../../config/environment');var controller=require(_0xc2ab('0x7'));router['get']('/',auth[_0xc2ab('0x8')](),controller['index']);router[_0xc2ab('0x9')](_0xc2ab('0xa'),auth[_0xc2ab('0x8')](),controller['show']);router[_0xc2ab('0x9')](_0xc2ab('0xb'),auth[_0xc2ab('0x8')](),controller[_0xc2ab('0xc')]);router['get'](_0xc2ab('0xd'),auth[_0xc2ab('0x8')](),controller[_0xc2ab('0xe')]);router[_0xc2ab('0xf')]('/',auth[_0xc2ab('0x8')](),controller['create']);router[_0xc2ab('0xf')](_0xc2ab('0xb'),auth['isAuthenticated'](),controller[_0xc2ab('0x10')]);router[_0xc2ab('0x11')](_0xc2ab('0xa'),auth['isAuthenticated'](),controller[_0xc2ab('0x12')]);router[_0xc2ab('0x13')](_0xc2ab('0xa'),auth['isAuthenticated'](),controller[_0xc2ab('0x14')]);module[_0xc2ab('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 6656547..8cc7aac 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 _0x7916=['sequelize','STRING','username','remoteUri'];(function(_0x2d077c,_0x8f68d9){var _0x32956d=function(_0x236106){while(--_0x236106){_0x2d077c['push'](_0x2d077c['shift']());}};_0x32956d(++_0x8f68d9);}(_0x7916,0x128));var _0x6791=function(_0x57cb38,_0x377f1c){_0x57cb38=_0x57cb38-0x0;var _0x56af6c=_0x7916[_0x57cb38];return _0x56af6c;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')]},'description':{'type':Sequelize[_0x6791('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6791('0x2')},'apiKey':{'type':Sequelize[_0x6791('0x1')]},'remoteUri':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xef0f=['sequelize','STRING','remoteUri'];(function(_0xcb5f3c,_0x3f602c){var _0x1056e0=function(_0x31473f){while(--_0x31473f){_0xcb5f3c['push'](_0xcb5f3c['shift']());}};_0x1056e0(++_0x3f602c);}(_0xef0f,0x168));var _0xfef0=function(_0x170cb7,_0x209645){_0x170cb7=_0x170cb7-0x0;var _0x54fad9=_0xef0f[_0x170cb7];return _0x54fad9;};'use strict';var Sequelize=require(_0xfef0('0x0'));module['exports']={'name':{'type':Sequelize[_0xfef0('0x1')]},'description':{'type':Sequelize[_0xfef0('0x1')]},'username':{'type':Sequelize[_0xfef0('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xfef0('0x1')]},'remoteUri':{'type':Sequelize[_0xfef0('0x1')],'unique':_0xfef0('0x2')},'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 1b8c4aa..3afa516 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 _0x8ba2=['save','update','then','destroy','sendStatus','error','stack','send','index','map','FreshdeskAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','type','VIRTUAL','name','filter','options','includeAll','rows','catch','params','find','create','body','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId','getSubjects','channel','getDescriptions','Subjects','FreshdeskField','getFields','remoteUri','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','agent','description','priority','source','ticket_type','group','remove','includes','default','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','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','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject'];(function(_0x4e67a0,_0x5aaa2d){var _0x3e73d7=function(_0x305555){while(--_0x305555){_0x4e67a0['push'](_0x4e67a0['shift']());}};_0x3e73d7(++_0x5aaa2d);}(_0x8ba2,0x13f));var _0x28ba=function(_0x3ae982,_0x5621f9){_0x3ae982=_0x3ae982-0x0;var _0x3e0d24=_0x8ba2[_0x3ae982];return _0x3e0d24;};'use strict';var emlformat=require(_0x28ba('0x0'));var rimraf=require(_0x28ba('0x1'));var zipdir=require(_0x28ba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28ba('0x3'));var moment=require(_0x28ba('0x4'));var BPromise=require(_0x28ba('0x5'));var Mustache=require('mustache');var util=require(_0x28ba('0x6'));var path=require(_0x28ba('0x7'));var sox=require(_0x28ba('0x8'));var csv=require(_0x28ba('0x9'));var ejs=require(_0x28ba('0xa'));var fs=require('fs');var fs_extra=require(_0x28ba('0xb'));var _=require('lodash');var squel=require(_0x28ba('0xc'));var crypto=require(_0x28ba('0xd'));var jsforce=require(_0x28ba('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x28ba('0x9'));var querystring=require(_0x28ba('0xf'));var Papa=require(_0x28ba('0x10'));var Redis=require(_0x28ba('0x11'));var authService=require(_0x28ba('0x12'));var qs=require(_0x28ba('0x13'));var as=require(_0x28ba('0x14'));var hardwareService=require(_0x28ba('0x15'));var logger=require(_0x28ba('0x16'))(_0x28ba('0x17'));var utils=require('../../config/utils');var config=require(_0x28ba('0x18'));var licenseUtil=require(_0x28ba('0x19'));var db=require(_0x28ba('0x1a'))['db'];var integrations=require(_0x28ba('0x1b'));function respondWithStatusCode(_0x1204af,_0x3a9644){_0x3a9644=_0x3a9644||0xcc;return function(_0x245c22){if(_0x245c22){return _0x1204af['sendStatus'](_0x3a9644);}return _0x1204af[_0x28ba('0x1c')](_0x3a9644)[_0x28ba('0x1d')]();};}function respondWithResult(_0x4ebcd6,_0x29cd51){_0x29cd51=_0x29cd51||0xc8;return function(_0x291be0){if(_0x291be0){return _0x4ebcd6[_0x28ba('0x1c')](_0x29cd51)[_0x28ba('0x1e')](_0x291be0);}};}function respondWithFilteredResult(_0x563797,_0x24b3f3){return function(_0x38df4f){if(_0x38df4f){var _0x3ae8c5=typeof _0x24b3f3[_0x28ba('0x1f')]===_0x28ba('0x20')&&typeof _0x24b3f3['limit']==='undefined';var _0x37480e=_0x38df4f[_0x28ba('0x21')];var _0x17826b=_0x3ae8c5?0x0:_0x24b3f3[_0x28ba('0x1f')];var _0x41f630=_0x3ae8c5?_0x38df4f[_0x28ba('0x21')]:_0x24b3f3[_0x28ba('0x1f')]+_0x24b3f3[_0x28ba('0x22')];var _0x3f8b52;if(_0x41f630>=_0x37480e){_0x41f630=_0x37480e;_0x3f8b52=0xc8;}else{_0x3f8b52=0xce;}_0x563797['status'](_0x3f8b52);return _0x563797['set'](_0x28ba('0x23'),_0x17826b+'-'+_0x41f630+'/'+_0x37480e)[_0x28ba('0x1e')](_0x38df4f);}return null;};}function patchUpdates(_0x5d3d33){return function(_0x5c9567){try{jsonpatch[_0x28ba('0x24')](_0x5c9567,_0x5d3d33,!![]);}catch(_0x34bde3){return BPromise[_0x28ba('0x25')](_0x34bde3);}return _0x5c9567[_0x28ba('0x26')]();};}function saveUpdates(_0x425732,_0x4ff05c){return function(_0x400ae2){if(_0x400ae2){return _0x400ae2[_0x28ba('0x27')](_0x425732)[_0x28ba('0x28')](function(_0x3eec5d){return _0x3eec5d;});}return null;};}function removeEntity(_0x27a579,_0x256892){return function(_0x5d6f70){if(_0x5d6f70){return _0x5d6f70[_0x28ba('0x29')]()[_0x28ba('0x28')](function(){_0x27a579[_0x28ba('0x1c')](0xcc)[_0x28ba('0x1d')]();});}};}function handleEntityNotFound(_0x43e6c1,_0x35ed28){return function(_0x5df91b){if(!_0x5df91b){_0x43e6c1[_0x28ba('0x2a')](0x194);}return _0x5df91b;};}function handleError(_0x362254,_0x599b88){_0x599b88=_0x599b88||0x1f4;return function(_0x47da7d){logger[_0x28ba('0x2b')](_0x47da7d[_0x28ba('0x2c')]);if(_0x47da7d['name']){delete _0x47da7d['name'];}_0x362254[_0x28ba('0x1c')](_0x599b88)[_0x28ba('0x2d')](_0x47da7d);};}exports[_0x28ba('0x2e')]=function(_0x30afd,_0x3b3d3c){var _0x1176a7={},_0x21612d={},_0x2adf88={'count':0x0,'rows':[]};var _0x51dc98=_[_0x28ba('0x2f')](db[_0x28ba('0x30')][_0x28ba('0x31')],function(_0x27737d){return{'name':_0x27737d[_0x28ba('0x32')],'type':_0x27737d['type'][_0x28ba('0x33')]};});_0x21612d[_0x28ba('0x34')]=_[_0x28ba('0x2f')](_0x51dc98,'name');_0x21612d[_0x28ba('0x35')]=_[_0x28ba('0x36')](_0x30afd[_0x28ba('0x35')]);_0x21612d['filters']=_[_0x28ba('0x37')](_0x21612d[_0x28ba('0x34')],_0x21612d[_0x28ba('0x35')]);_0x1176a7[_0x28ba('0x38')]=_[_0x28ba('0x37')](_0x21612d[_0x28ba('0x34')],qs[_0x28ba('0x39')](_0x30afd[_0x28ba('0x35')][_0x28ba('0x39')]));_0x1176a7[_0x28ba('0x38')]=_0x1176a7['attributes'][_0x28ba('0x3a')]?_0x1176a7[_0x28ba('0x38')]:_0x21612d[_0x28ba('0x34')];if(!_0x30afd['query'][_0x28ba('0x3b')](_0x28ba('0x3c'))){_0x1176a7[_0x28ba('0x22')]=qs[_0x28ba('0x22')](_0x30afd[_0x28ba('0x35')][_0x28ba('0x22')]);_0x1176a7[_0x28ba('0x1f')]=qs[_0x28ba('0x1f')](_0x30afd[_0x28ba('0x35')][_0x28ba('0x1f')]);}_0x1176a7[_0x28ba('0x3d')]=qs[_0x28ba('0x3e')](_0x30afd['query']['sort']);_0x1176a7['where']=qs[_0x28ba('0x3f')](_[_0x28ba('0x40')](_0x30afd['query'],_0x21612d[_0x28ba('0x3f')]),_0x51dc98);if(_0x30afd[_0x28ba('0x35')]['filter']){_0x1176a7['where']=_[_0x28ba('0x41')](_0x1176a7[_0x28ba('0x42')],{'$or':_['map'](_0x51dc98,function(_0x5c2d66){if(_0x5c2d66[_0x28ba('0x43')]!==_0x28ba('0x44')){var _0x1a2f36={};_0x1a2f36[_0x5c2d66[_0x28ba('0x45')]]={'$like':'%'+_0x30afd[_0x28ba('0x35')][_0x28ba('0x46')]+'%'};return _0x1a2f36;}})});}_0x1176a7=_[_0x28ba('0x41')]({},_0x1176a7,_0x30afd[_0x28ba('0x47')]);var _0x18c35d={'where':_0x1176a7['where']};return db['FreshdeskAccount']['count'](_0x18c35d)[_0x28ba('0x28')](function(_0xbc63e4){_0x2adf88[_0x28ba('0x21')]=_0xbc63e4;if(_0x30afd[_0x28ba('0x35')][_0x28ba('0x48')]){_0x1176a7['include']=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x1176a7);})[_0x28ba('0x28')](function(_0x428309){_0x2adf88[_0x28ba('0x49')]=_0x428309;return _0x2adf88;})[_0x28ba('0x28')](respondWithFilteredResult(_0x3b3d3c,_0x1176a7))[_0x28ba('0x4a')](handleError(_0x3b3d3c,null));};exports['show']=function(_0x19b943,_0x43a438){var _0x364b7a={'raw':![],'where':{'id':_0x19b943[_0x28ba('0x4b')]['id']}},_0x20be2f={};_0x20be2f[_0x28ba('0x34')]=_[_0x28ba('0x36')](db[_0x28ba('0x30')][_0x28ba('0x31')]);_0x20be2f['query']=_['keys'](_0x19b943[_0x28ba('0x35')]);_0x20be2f[_0x28ba('0x3f')]=_[_0x28ba('0x37')](_0x20be2f[_0x28ba('0x34')],_0x20be2f[_0x28ba('0x35')]);_0x364b7a['attributes']=_['intersection'](_0x20be2f['model'],qs['fields'](_0x19b943[_0x28ba('0x35')][_0x28ba('0x39')]));_0x364b7a[_0x28ba('0x38')]=_0x364b7a[_0x28ba('0x38')][_0x28ba('0x3a')]?_0x364b7a[_0x28ba('0x38')]:_0x20be2f['model'];if(_0x19b943[_0x28ba('0x35')][_0x28ba('0x48')]){_0x364b7a['include']=[{'all':!![]}];}_0x364b7a=_['merge']({},_0x364b7a,_0x19b943[_0x28ba('0x47')]);return db['FreshdeskAccount'][_0x28ba('0x4c')](_0x364b7a)[_0x28ba('0x28')](handleEntityNotFound(_0x43a438,null))['then'](respondWithResult(_0x43a438,null))[_0x28ba('0x4a')](handleError(_0x43a438,null));};exports['create']=function(_0x52b4ed,_0x4c6383){return db[_0x28ba('0x30')][_0x28ba('0x4d')](_0x52b4ed[_0x28ba('0x4e')],{})[_0x28ba('0x28')](respondWithResult(_0x4c6383,0xc9))[_0x28ba('0x4a')](handleError(_0x4c6383,null));};exports[_0x28ba('0x27')]=function(_0x5ccfab,_0x114773){if(_0x5ccfab['body']['id']){delete _0x5ccfab['body']['id'];}return db[_0x28ba('0x30')][_0x28ba('0x4c')]({'where':{'id':_0x5ccfab[_0x28ba('0x4b')]['id']}})[_0x28ba('0x28')](handleEntityNotFound(_0x114773,null))['then'](saveUpdates(_0x5ccfab[_0x28ba('0x4e')],null))['then'](respondWithResult(_0x114773,null))['catch'](handleError(_0x114773,null));};exports[_0x28ba('0x29')]=function(_0x397f81,_0xf0938f){return db[_0x28ba('0x30')][_0x28ba('0x4c')]({'where':{'id':_0x397f81[_0x28ba('0x4b')]['id']}})[_0x28ba('0x28')](handleEntityNotFound(_0xf0938f,null))[_0x28ba('0x28')](removeEntity(_0xf0938f,null))['catch'](handleError(_0xf0938f,null));};exports[_0x28ba('0x4f')]=function(_0x3773bc,_0x6f0df2,_0x46a1dc){var _0x28913c={};var _0x4f5156={};var _0x23b52f;var _0x2ec307;return db[_0x28ba('0x30')]['findOne']({'where':{'id':_0x3773bc[_0x28ba('0x4b')]['id']}})[_0x28ba('0x28')](handleEntityNotFound(_0x6f0df2,null))[_0x28ba('0x28')](function(_0x4f5a05){if(_0x4f5a05){_0x23b52f=_0x4f5a05;_0x4f5156[_0x28ba('0x34')]=_['keys'](db[_0x28ba('0x50')][_0x28ba('0x31')]);_0x4f5156['query']=_[_0x28ba('0x36')](_0x3773bc[_0x28ba('0x35')]);_0x4f5156[_0x28ba('0x3f')]=_[_0x28ba('0x37')](_0x4f5156[_0x28ba('0x34')],_0x4f5156[_0x28ba('0x35')]);_0x28913c[_0x28ba('0x38')]=_[_0x28ba('0x37')](_0x4f5156[_0x28ba('0x34')],qs[_0x28ba('0x39')](_0x3773bc[_0x28ba('0x35')]['fields']));_0x28913c[_0x28ba('0x38')]=_0x28913c[_0x28ba('0x38')][_0x28ba('0x3a')]?_0x28913c[_0x28ba('0x38')]:_0x4f5156[_0x28ba('0x34')];_0x28913c['order']=qs[_0x28ba('0x3e')](_0x3773bc[_0x28ba('0x35')][_0x28ba('0x3e')]);_0x28913c[_0x28ba('0x42')]=qs[_0x28ba('0x3f')](_[_0x28ba('0x40')](_0x3773bc[_0x28ba('0x35')],_0x4f5156['filters']));if(_0x3773bc[_0x28ba('0x35')][_0x28ba('0x46')]){_0x28913c['where']=_[_0x28ba('0x41')](_0x28913c[_0x28ba('0x42')],{'$or':_['map'](_0x28913c['attributes'],function(_0x548750){var _0x5c14fb={};_0x5c14fb[_0x548750]={'$like':'%'+_0x3773bc[_0x28ba('0x35')][_0x28ba('0x46')]+'%'};return _0x5c14fb;})});}_0x28913c=_['merge']({},_0x28913c,_0x3773bc['options']);return _0x23b52f[_0x28ba('0x4f')](_0x28913c);}})[_0x28ba('0x28')](function(_0x197a02){if(_0x197a02){_0x2ec307=_0x197a02['length'];if(!_0x3773bc[_0x28ba('0x35')][_0x28ba('0x3b')](_0x28ba('0x3c'))){_0x28913c[_0x28ba('0x22')]=qs[_0x28ba('0x22')](_0x3773bc[_0x28ba('0x35')][_0x28ba('0x22')]);_0x28913c[_0x28ba('0x1f')]=qs[_0x28ba('0x1f')](_0x3773bc['query'][_0x28ba('0x1f')]);}return _0x23b52f['getConfigurations'](_0x28913c);}})[_0x28ba('0x28')](function(_0x55011e){if(_0x55011e){return _0x55011e?{'count':_0x2ec307,'rows':_0x55011e}:null;}})[_0x28ba('0x28')](respondWithResult(_0x6f0df2,null))['catch'](handleError(_0x6f0df2,null));};exports[_0x28ba('0x51')]=function(_0x2dc04c,_0x4b6f2e,_0x53e6e4){if(_0x2dc04c[_0x28ba('0x4e')]['id']){delete _0x2dc04c[_0x28ba('0x4e')]['id'];}return db[_0x28ba('0x30')][_0x28ba('0x52')]({'where':{'id':_0x2dc04c[_0x28ba('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4b6f2e,null))['then'](function(_0x307db6){if(_0x307db6){_0x2dc04c[_0x28ba('0x4e')][_0x28ba('0x53')]=_0x307db6['id'];_0x2dc04c['body']['Subjects']=integrations[_0x28ba('0x54')](_0x2dc04c['body'][_0x28ba('0x55')],_0x2dc04c[_0x28ba('0x4e')][_0x28ba('0x43')]);_0x2dc04c[_0x28ba('0x4e')]['Descriptions']=integrations[_0x28ba('0x56')](_0x2dc04c[_0x28ba('0x4e')]['channel'],_0x2dc04c['body'][_0x28ba('0x43')]);return db[_0x28ba('0x50')][_0x28ba('0x4d')](_0x2dc04c[_0x28ba('0x4e')],{'include':[{'model':db['FreshdeskField'],'as':_0x28ba('0x57')},{'model':db[_0x28ba('0x58')],'as':'Descriptions'}]});}return null;})[_0x28ba('0x28')](respondWithResult(_0x4b6f2e,null))[_0x28ba('0x4a')](handleError(_0x4b6f2e,null));};exports[_0x28ba('0x59')]=function(_0x5f035d,_0x4cad66,_0x4aa658){var _0x52184e='';return db[_0x28ba('0x30')][_0x28ba('0x52')]({'where':{'id':_0x5f035d[_0x28ba('0x4b')]['id']},'attributes':['id',_0x28ba('0x5a'),'apiKey']})[_0x28ba('0x28')](handleEntityNotFound(_0x4cad66,null))[_0x28ba('0x28')](function(_0xf4d918){if(_0xf4d918){_0x52184e=_0xf4d918['remoteUri'];var _0x1f9805=_0x52184e[_0x28ba('0x5b')](-0x1);if(_0x1f9805==='/'){_0x52184e=_0x52184e['substring'](0x0,_0x52184e[_0x28ba('0x5c')](_0x1f9805));}return rp({'method':_0x28ba('0x5d'),'uri':util[_0x28ba('0x5e')](_0x28ba('0x5f'),_0x52184e,_0x28ba('0x60')),'headers':{'Authorization':util['format'](_0x28ba('0x61'),new Buffer(util['format'](_0x28ba('0x62'),_0xf4d918[_0x28ba('0x63')]))[_0x28ba('0x64')](_0x28ba('0x65')))},'json':!![]});}})[_0x28ba('0x28')](function(_0x43ae98){if(_0x43ae98){var _0xd7bd26=[_0x28ba('0x66'),_0x28ba('0x67'),_0x28ba('0x68'),_0x28ba('0x69'),'status',_0x28ba('0x6a'),'group',_0x28ba('0x6b'),_0x28ba('0x6c'),_0x28ba('0x6d'),'company'];_[_0x28ba('0x6e')](_0x43ae98,function(_0x1782f8){return _0xd7bd26[_0x28ba('0x6f')](_0x1782f8[_0x28ba('0x45')])||!_0x1782f8[_0x28ba('0x70')]&&_0x1782f8['type']!=='custom_text'&&_0x1782f8['type']!=='custom_dropdown';});return{'count':_0x43ae98[_0x28ba('0x3a')],'rows':_[_0x28ba('0x2f')](_0x43ae98,function(_0x4b8d2e){return{'id':_0x4b8d2e['name'],'name':_0x4b8d2e['label'],'custom':!_0x4b8d2e[_0x28ba('0x70')],'options':_0x4b8d2e[_0x28ba('0x71')]?_['map'](_0x4b8d2e[_0x28ba('0x71')],function(_0x297e07){return{'name':_[_0x28ba('0x72')](_0x297e07),'value':_0x297e07};}):[]};})};}})[_0x28ba('0x28')](respondWithResult(_0x4cad66,null))[_0x28ba('0x4a')](function(_0x2d1a3a){var _0x18a9ab=_0x5f035d[_0x28ba('0x35')]['test']?0x1f4:_0x2d1a3a['statusCode']||0x1f4;logger[_0x28ba('0x2b')](_0x28ba('0x73'),'getFields',_0x18a9ab,JSON['stringify'](_0x2d1a3a));delete _0x2d1a3a[_0x28ba('0x45')];if(_0x18a9ab===0x191){_0x18a9ab=0x190;}_0x4cad66['status'](_0x18a9ab)[_0x28ba('0x2d')](_0x5f035d['query'][_0x28ba('0x74')]?{'message':_0x28ba('0x75'),'statusCode':_0x2d1a3a[_0x28ba('0x76')]}:_0x2d1a3a);});}; \ No newline at end of file +var _0x4d6e=['stringify','send','test','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','end','error','index','map','fieldName','key','model','name','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','type','options','FreshdeskAccount','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','destroy','params','getConfigurations','FreshdeskConfiguration','sort','addConfiguration','findOne','AccountId','channel','getDescriptions','Subjects','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','agent','priority','group','ticket_type','company','remove','includes','default','custom_text','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x591db7,_0x150445){var _0x4ad760=function(_0x5dd24e){while(--_0x5dd24e){_0x591db7['push'](_0x591db7['shift']());}};_0x4ad760(++_0x150445);}(_0x4d6e,0x77));var _0xe4d6=function(_0x595add,_0x15feb9){_0x595add=_0x595add-0x0;var _0x52eb1a=_0x4d6e[_0x595add];return _0x52eb1a;};'use strict';var emlformat=require(_0xe4d6('0x0'));var rimraf=require(_0xe4d6('0x1'));var zipdir=require(_0xe4d6('0x2'));var jsonpatch=require(_0xe4d6('0x3'));var rp=require(_0xe4d6('0x4'));var moment=require('moment');var BPromise=require(_0xe4d6('0x5'));var Mustache=require(_0xe4d6('0x6'));var util=require(_0xe4d6('0x7'));var path=require(_0xe4d6('0x8'));var sox=require(_0xe4d6('0x9'));var csv=require(_0xe4d6('0xa'));var ejs=require(_0xe4d6('0xb'));var fs=require('fs');var fs_extra=require(_0xe4d6('0xc'));var _=require(_0xe4d6('0xd'));var squel=require(_0xe4d6('0xe'));var crypto=require(_0xe4d6('0xf'));var jsforce=require(_0xe4d6('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe4d6('0xa'));var querystring=require(_0xe4d6('0x11'));var Papa=require('papaparse');var Redis=require(_0xe4d6('0x12'));var authService=require(_0xe4d6('0x13'));var qs=require(_0xe4d6('0x14'));var as=require(_0xe4d6('0x15'));var hardwareService=require(_0xe4d6('0x16'));var logger=require(_0xe4d6('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xe4d6('0x18'));var licenseUtil=require(_0xe4d6('0x19'));var db=require(_0xe4d6('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1a80eb,_0x3f7441){_0x3f7441=_0x3f7441||0xcc;return function(_0x53eac7){if(_0x53eac7){return _0x1a80eb[_0xe4d6('0x1b')](_0x3f7441);}return _0x1a80eb[_0xe4d6('0x1c')](_0x3f7441)['end']();};}function respondWithResult(_0xdc7f40,_0x780caa){_0x780caa=_0x780caa||0xc8;return function(_0x178f59){if(_0x178f59){return _0xdc7f40[_0xe4d6('0x1c')](_0x780caa)['json'](_0x178f59);}};}function respondWithFilteredResult(_0x2e04a9,_0x28e001){return function(_0x3dbe31){if(_0x3dbe31){var _0x1ca3fb=typeof _0x28e001['offset']===_0xe4d6('0x1d')&&typeof _0x28e001['limit']==='undefined';var _0x24e9cb=_0x3dbe31[_0xe4d6('0x1e')];var _0x68b15f=_0x1ca3fb?0x0:_0x28e001[_0xe4d6('0x1f')];var _0xe99d00=_0x1ca3fb?_0x3dbe31['count']:_0x28e001[_0xe4d6('0x1f')]+_0x28e001[_0xe4d6('0x20')];var _0xab15c8;if(_0xe99d00>=_0x24e9cb){_0xe99d00=_0x24e9cb;_0xab15c8=0xc8;}else{_0xab15c8=0xce;}_0x2e04a9[_0xe4d6('0x1c')](_0xab15c8);return _0x2e04a9[_0xe4d6('0x21')](_0xe4d6('0x22'),_0x68b15f+'-'+_0xe99d00+'/'+_0x24e9cb)[_0xe4d6('0x23')](_0x3dbe31);}return null;};}function patchUpdates(_0x27e824){return function(_0x52d88d){try{jsonpatch[_0xe4d6('0x24')](_0x52d88d,_0x27e824,!![]);}catch(_0x48a404){return BPromise[_0xe4d6('0x25')](_0x48a404);}return _0x52d88d[_0xe4d6('0x26')]();};}function saveUpdates(_0x31f569,_0x162b57){return function(_0x185b9e){if(_0x185b9e){return _0x185b9e[_0xe4d6('0x27')](_0x31f569)[_0xe4d6('0x28')](function(_0x202f67){return _0x202f67;});}return null;};}function removeEntity(_0x59233f,_0x404fe1){return function(_0x12b159){if(_0x12b159){return _0x12b159['destroy']()[_0xe4d6('0x28')](function(){_0x59233f[_0xe4d6('0x1c')](0xcc)[_0xe4d6('0x29')]();});}};}function handleEntityNotFound(_0x3e8f41,_0x13aeec){return function(_0x2f467f){if(!_0x2f467f){_0x3e8f41[_0xe4d6('0x1b')](0x194);}return _0x2f467f;};}function handleError(_0xb4fe6a,_0x53110a){_0x53110a=_0x53110a||0x1f4;return function(_0x16d492){logger[_0xe4d6('0x2a')](_0x16d492['stack']);if(_0x16d492['name']){delete _0x16d492['name'];}_0xb4fe6a[_0xe4d6('0x1c')](_0x53110a)['send'](_0x16d492);};}exports[_0xe4d6('0x2b')]=function(_0x4b83fa,_0x4f0485){var _0x39f7d5={},_0x4e45f0={},_0x54ae70={'count':0x0,'rows':[]};var _0x112cbd=_[_0xe4d6('0x2c')](db['FreshdeskAccount']['rawAttributes'],function(_0x3fd34f){return{'name':_0x3fd34f[_0xe4d6('0x2d')],'type':_0x3fd34f['type'][_0xe4d6('0x2e')]};});_0x4e45f0[_0xe4d6('0x2f')]=_[_0xe4d6('0x2c')](_0x112cbd,_0xe4d6('0x30'));_0x4e45f0[_0xe4d6('0x31')]=_[_0xe4d6('0x32')](_0x4b83fa['query']);_0x4e45f0['filters']=_[_0xe4d6('0x33')](_0x4e45f0[_0xe4d6('0x2f')],_0x4e45f0['query']);_0x39f7d5[_0xe4d6('0x34')]=_['intersection'](_0x4e45f0[_0xe4d6('0x2f')],qs['fields'](_0x4b83fa['query'][_0xe4d6('0x35')]));_0x39f7d5['attributes']=_0x39f7d5['attributes'][_0xe4d6('0x36')]?_0x39f7d5[_0xe4d6('0x34')]:_0x4e45f0[_0xe4d6('0x2f')];if(!_0x4b83fa[_0xe4d6('0x31')]['hasOwnProperty'](_0xe4d6('0x37'))){_0x39f7d5[_0xe4d6('0x20')]=qs[_0xe4d6('0x20')](_0x4b83fa[_0xe4d6('0x31')][_0xe4d6('0x20')]);_0x39f7d5[_0xe4d6('0x1f')]=qs[_0xe4d6('0x1f')](_0x4b83fa[_0xe4d6('0x31')][_0xe4d6('0x1f')]);}_0x39f7d5[_0xe4d6('0x38')]=qs['sort'](_0x4b83fa[_0xe4d6('0x31')]['sort']);_0x39f7d5[_0xe4d6('0x39')]=qs[_0xe4d6('0x3a')](_[_0xe4d6('0x3b')](_0x4b83fa[_0xe4d6('0x31')],_0x4e45f0['filters']),_0x112cbd);if(_0x4b83fa['query'][_0xe4d6('0x3c')]){_0x39f7d5[_0xe4d6('0x39')]=_[_0xe4d6('0x3d')](_0x39f7d5[_0xe4d6('0x39')],{'$or':_[_0xe4d6('0x2c')](_0x112cbd,function(_0x20c286){if(_0x20c286[_0xe4d6('0x3e')]!=='VIRTUAL'){var _0x252dfd={};_0x252dfd[_0x20c286[_0xe4d6('0x30')]]={'$like':'%'+_0x4b83fa['query']['filter']+'%'};return _0x252dfd;}})});}_0x39f7d5=_[_0xe4d6('0x3d')]({},_0x39f7d5,_0x4b83fa[_0xe4d6('0x3f')]);var _0x4950cf={'where':_0x39f7d5[_0xe4d6('0x39')]};return db[_0xe4d6('0x40')][_0xe4d6('0x1e')](_0x4950cf)[_0xe4d6('0x28')](function(_0x48207b){_0x54ae70[_0xe4d6('0x1e')]=_0x48207b;if(_0x4b83fa[_0xe4d6('0x31')][_0xe4d6('0x41')]){_0x39f7d5[_0xe4d6('0x42')]=[{'all':!![]}];}return db[_0xe4d6('0x40')][_0xe4d6('0x43')](_0x39f7d5);})['then'](function(_0x5002dc){_0x54ae70['rows']=_0x5002dc;return _0x54ae70;})[_0xe4d6('0x28')](respondWithFilteredResult(_0x4f0485,_0x39f7d5))[_0xe4d6('0x44')](handleError(_0x4f0485,null));};exports[_0xe4d6('0x45')]=function(_0x314ad6,_0x4bc768){var _0x3d2516={'raw':![],'where':{'id':_0x314ad6['params']['id']}},_0x526593={};_0x526593[_0xe4d6('0x2f')]=_[_0xe4d6('0x32')](db[_0xe4d6('0x40')][_0xe4d6('0x46')]);_0x526593[_0xe4d6('0x31')]=_[_0xe4d6('0x32')](_0x314ad6['query']);_0x526593[_0xe4d6('0x3a')]=_[_0xe4d6('0x33')](_0x526593[_0xe4d6('0x2f')],_0x526593[_0xe4d6('0x31')]);_0x3d2516[_0xe4d6('0x34')]=_[_0xe4d6('0x33')](_0x526593[_0xe4d6('0x2f')],qs[_0xe4d6('0x35')](_0x314ad6['query'][_0xe4d6('0x35')]));_0x3d2516[_0xe4d6('0x34')]=_0x3d2516[_0xe4d6('0x34')]['length']?_0x3d2516['attributes']:_0x526593[_0xe4d6('0x2f')];if(_0x314ad6[_0xe4d6('0x31')][_0xe4d6('0x41')]){_0x3d2516[_0xe4d6('0x42')]=[{'all':!![]}];}_0x3d2516=_[_0xe4d6('0x3d')]({},_0x3d2516,_0x314ad6[_0xe4d6('0x3f')]);return db[_0xe4d6('0x40')][_0xe4d6('0x47')](_0x3d2516)[_0xe4d6('0x28')](handleEntityNotFound(_0x4bc768,null))[_0xe4d6('0x28')](respondWithResult(_0x4bc768,null))[_0xe4d6('0x44')](handleError(_0x4bc768,null));};exports[_0xe4d6('0x48')]=function(_0xe6fb2c,_0x194307){return db[_0xe4d6('0x40')][_0xe4d6('0x48')](_0xe6fb2c['body'],{})[_0xe4d6('0x28')](respondWithResult(_0x194307,0xc9))[_0xe4d6('0x44')](handleError(_0x194307,null));};exports['update']=function(_0x2bea52,_0x538e25){if(_0x2bea52[_0xe4d6('0x49')]['id']){delete _0x2bea52[_0xe4d6('0x49')]['id'];}return db['FreshdeskAccount'][_0xe4d6('0x47')]({'where':{'id':_0x2bea52['params']['id']}})['then'](handleEntityNotFound(_0x538e25,null))[_0xe4d6('0x28')](saveUpdates(_0x2bea52[_0xe4d6('0x49')],null))['then'](respondWithResult(_0x538e25,null))[_0xe4d6('0x44')](handleError(_0x538e25,null));};exports[_0xe4d6('0x4a')]=function(_0x24ed6b,_0x278c96){return db[_0xe4d6('0x40')]['find']({'where':{'id':_0x24ed6b[_0xe4d6('0x4b')]['id']}})[_0xe4d6('0x28')](handleEntityNotFound(_0x278c96,null))['then'](removeEntity(_0x278c96,null))['catch'](handleError(_0x278c96,null));};exports[_0xe4d6('0x4c')]=function(_0x12ecaf,_0x30612c,_0x478827){var _0x14f615={};var _0xc55241={};var _0x1da5e9;var _0x427575;return db[_0xe4d6('0x40')]['findOne']({'where':{'id':_0x12ecaf[_0xe4d6('0x4b')]['id']}})[_0xe4d6('0x28')](handleEntityNotFound(_0x30612c,null))[_0xe4d6('0x28')](function(_0x1b22c2){if(_0x1b22c2){_0x1da5e9=_0x1b22c2;_0xc55241[_0xe4d6('0x2f')]=_['keys'](db[_0xe4d6('0x4d')][_0xe4d6('0x46')]);_0xc55241[_0xe4d6('0x31')]=_[_0xe4d6('0x32')](_0x12ecaf[_0xe4d6('0x31')]);_0xc55241[_0xe4d6('0x3a')]=_['intersection'](_0xc55241[_0xe4d6('0x2f')],_0xc55241[_0xe4d6('0x31')]);_0x14f615[_0xe4d6('0x34')]=_[_0xe4d6('0x33')](_0xc55241[_0xe4d6('0x2f')],qs[_0xe4d6('0x35')](_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x35')]));_0x14f615[_0xe4d6('0x34')]=_0x14f615[_0xe4d6('0x34')][_0xe4d6('0x36')]?_0x14f615['attributes']:_0xc55241[_0xe4d6('0x2f')];_0x14f615[_0xe4d6('0x38')]=qs[_0xe4d6('0x4e')](_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x4e')]);_0x14f615[_0xe4d6('0x39')]=qs['filters'](_['pick'](_0x12ecaf[_0xe4d6('0x31')],_0xc55241[_0xe4d6('0x3a')]));if(_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x3c')]){_0x14f615['where']=_['merge'](_0x14f615[_0xe4d6('0x39')],{'$or':_[_0xe4d6('0x2c')](_0x14f615[_0xe4d6('0x34')],function(_0x2b6451){var _0x4b8047={};_0x4b8047[_0x2b6451]={'$like':'%'+_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x3c')]+'%'};return _0x4b8047;})});}_0x14f615=_['merge']({},_0x14f615,_0x12ecaf[_0xe4d6('0x3f')]);return _0x1da5e9['getConfigurations'](_0x14f615);}})[_0xe4d6('0x28')](function(_0x3b155b){if(_0x3b155b){_0x427575=_0x3b155b['length'];if(!_0x12ecaf[_0xe4d6('0x31')]['hasOwnProperty'](_0xe4d6('0x37'))){_0x14f615[_0xe4d6('0x20')]=qs['limit'](_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x20')]);_0x14f615[_0xe4d6('0x1f')]=qs['offset'](_0x12ecaf['query']['offset']);}return _0x1da5e9[_0xe4d6('0x4c')](_0x14f615);}})[_0xe4d6('0x28')](function(_0x2ae27f){if(_0x2ae27f){return _0x2ae27f?{'count':_0x427575,'rows':_0x2ae27f}:null;}})[_0xe4d6('0x28')](respondWithResult(_0x30612c,null))[_0xe4d6('0x44')](handleError(_0x30612c,null));};exports[_0xe4d6('0x4f')]=function(_0x520608,_0x2d780d,_0x17d129){if(_0x520608[_0xe4d6('0x49')]['id']){delete _0x520608[_0xe4d6('0x49')]['id'];}return db[_0xe4d6('0x40')][_0xe4d6('0x50')]({'where':{'id':_0x520608[_0xe4d6('0x4b')]['id']}})[_0xe4d6('0x28')](handleEntityNotFound(_0x2d780d,null))[_0xe4d6('0x28')](function(_0x4fde5e){if(_0x4fde5e){_0x520608['body'][_0xe4d6('0x51')]=_0x4fde5e['id'];_0x520608[_0xe4d6('0x49')]['Subjects']=integrations['getSubjects'](_0x520608[_0xe4d6('0x49')][_0xe4d6('0x52')],_0x520608[_0xe4d6('0x49')][_0xe4d6('0x3e')]);_0x520608[_0xe4d6('0x49')]['Descriptions']=integrations[_0xe4d6('0x53')](_0x520608[_0xe4d6('0x49')][_0xe4d6('0x52')],_0x520608[_0xe4d6('0x49')][_0xe4d6('0x3e')]);return db[_0xe4d6('0x4d')]['create'](_0x520608[_0xe4d6('0x49')],{'include':[{'model':db['FreshdeskField'],'as':_0xe4d6('0x54')},{'model':db[_0xe4d6('0x55')],'as':_0xe4d6('0x56')}]});}return null;})[_0xe4d6('0x28')](respondWithResult(_0x2d780d,null))['catch'](handleError(_0x2d780d,null));};exports[_0xe4d6('0x57')]=function(_0xea686f,_0x3da67a,_0x309421){var _0x5e10ca='';return db[_0xe4d6('0x40')][_0xe4d6('0x50')]({'where':{'id':_0xea686f[_0xe4d6('0x4b')]['id']},'attributes':['id',_0xe4d6('0x58'),_0xe4d6('0x59')]})[_0xe4d6('0x28')](handleEntityNotFound(_0x3da67a,null))[_0xe4d6('0x28')](function(_0xc91476){if(_0xc91476){_0x5e10ca=_0xc91476[_0xe4d6('0x58')];var _0xeaa39=_0x5e10ca[_0xe4d6('0x5a')](-0x1);if(_0xeaa39==='/'){_0x5e10ca=_0x5e10ca[_0xe4d6('0x5b')](0x0,_0x5e10ca[_0xe4d6('0x5c')](_0xeaa39));}return rp({'method':_0xe4d6('0x5d'),'uri':util[_0xe4d6('0x5e')](_0xe4d6('0x5f'),_0x5e10ca,_0xe4d6('0x60')),'headers':{'Authorization':util[_0xe4d6('0x5e')]('Basic\x20%s',new Buffer(util[_0xe4d6('0x5e')](_0xe4d6('0x61'),_0xc91476[_0xe4d6('0x59')]))[_0xe4d6('0x62')]('base64'))},'json':!![]});}})[_0xe4d6('0x28')](function(_0x36a77f){if(_0x36a77f){var _0x256541=['requester','subject',_0xe4d6('0x63'),'description',_0xe4d6('0x1c'),_0xe4d6('0x64'),_0xe4d6('0x65'),'source',_0xe4d6('0x66'),_0xe4d6('0x65'),_0xe4d6('0x67')];_[_0xe4d6('0x68')](_0x36a77f,function(_0x2b2bdc){return _0x256541[_0xe4d6('0x69')](_0x2b2bdc[_0xe4d6('0x30')])||!_0x2b2bdc[_0xe4d6('0x6a')]&&_0x2b2bdc[_0xe4d6('0x3e')]!==_0xe4d6('0x6b')&&_0x2b2bdc[_0xe4d6('0x3e')]!=='custom_dropdown';});return{'count':_0x36a77f[_0xe4d6('0x36')],'rows':_['map'](_0x36a77f,function(_0x1ea6b7){return{'id':_0x1ea6b7['name'],'name':_0x1ea6b7[_0xe4d6('0x6c')],'custom':!_0x1ea6b7[_0xe4d6('0x6a')],'options':_0x1ea6b7[_0xe4d6('0x6d')]?_[_0xe4d6('0x2c')](_0x1ea6b7[_0xe4d6('0x6d')],function(_0x258f2d){return{'name':_[_0xe4d6('0x6e')](_0x258f2d),'value':_0x258f2d};}):[]};})};}})[_0xe4d6('0x28')](respondWithResult(_0x3da67a,null))[_0xe4d6('0x44')](function(_0x55e95c){var _0x87d700=_0xea686f[_0xe4d6('0x31')]['test']?0x1f4:_0x55e95c[_0xe4d6('0x6f')]||0x1f4;logger[_0xe4d6('0x2a')](_0xe4d6('0x70'),'getFields',_0x87d700,JSON[_0xe4d6('0x71')](_0x55e95c));delete _0x55e95c['name'];if(_0x87d700===0x191){_0x87d700=0x190;}_0x3da67a[_0xe4d6('0x1c')](_0x87d700)[_0xe4d6('0x72')](_0xea686f[_0xe4d6('0x31')][_0xe4d6('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x55e95c[_0xe4d6('0x6f')]}:_0x55e95c);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index c71ffd8..6bfcbb5 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 _0xd5f0=['bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','../../config/logger'];(function(_0x1b85ce,_0x3cea6a){var _0x29c386=function(_0x415eaf){while(--_0x415eaf){_0x1b85ce['push'](_0x1b85ce['shift']());}};_0x29c386(++_0x3cea6a);}(_0xd5f0,0x169));var _0x0d5f=function(_0x38400d,_0x4d62e8){_0x38400d=_0x38400d-0x0;var _0xd56c2e=_0xd5f0[_0x38400d];return _0xd56c2e;};'use strict';var _=require(_0x0d5f('0x0'));var util=require('util');var logger=require(_0x0d5f('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0d5f('0x2'));var rp=require(_0x0d5f('0x3'));var fs=require('fs');var path=require(_0x0d5f('0x4'));var rimraf=require(_0x0d5f('0x5'));var config=require('../../config/environment');var attributes=require(_0x0d5f('0x6'));var integrations=require(_0x0d5f('0x7'));module[_0x0d5f('0x8')]=function(_0x347960,_0xaf50c1){return _0x347960[_0x0d5f('0x9')](_0x0d5f('0xa'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79db=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','FreshdeskAccount','lodash'];(function(_0x1d9c1b,_0x4e8ceb){var _0x4eef3b=function(_0xdd6cf3){while(--_0xdd6cf3){_0x1d9c1b['push'](_0x1d9c1b['shift']());}};_0x4eef3b(++_0x4e8ceb);}(_0x79db,0x1a3));var _0xb79d=function(_0x28b7ab,_0x16a764){_0x28b7ab=_0x28b7ab-0x0;var _0x56791b=_0x79db[_0x28b7ab];return _0x56791b;};'use strict';var _=require(_0xb79d('0x0'));var util=require(_0xb79d('0x1'));var logger=require('../../config/logger')(_0xb79d('0x2'));var moment=require(_0xb79d('0x3'));var BPromise=require(_0xb79d('0x4'));var rp=require(_0xb79d('0x5'));var fs=require('fs');var path=require(_0xb79d('0x6'));var rimraf=require(_0xb79d('0x7'));var config=require(_0xb79d('0x8'));var attributes=require(_0xb79d('0x9'));var integrations=require(_0xb79d('0xa'));module['exports']=function(_0x3e90c1,_0x2de1ae){return _0x3e90c1['define'](_0xb79d('0xb'),attributes,{'tableName':'int_freshdesk_accounts','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 5303305..37975e9 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 _0x730b=['ShowFreshdeskAccount','find','raw','where','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','GetFreshdeskAccount','FreshdeskAccount','findAll','options','include','map','model','attributes'];(function(_0x130201,_0x448b57){var _0x52d290=function(_0x2779d7){while(--_0x2779d7){_0x130201['push'](_0x130201['shift']());}};_0x52d290(++_0x448b57);}(_0x730b,0x91));var _0xb730=function(_0x583796,_0x4cfda5){_0x583796=_0x583796-0x0;var _0x4e22c5=_0x730b[_0x583796];return _0x4e22c5;};'use strict';var _=require(_0xb730('0x0'));var util=require('util');var moment=require(_0xb730('0x1'));var BPromise=require(_0xb730('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb730('0x3'));var db=require(_0xb730('0x4'))['db'];var utils=require(_0xb730('0x5'));var logger=require(_0xb730('0x6'))(_0xb730('0x7'));var config=require(_0xb730('0x8'));var jayson=require(_0xb730('0x9'));var client=jayson[_0xb730('0xa')][_0xb730('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c5c42,_0x477e51,_0x1fd269){return new BPromise(function(_0x59dc4b,_0x154b65){return client[_0xb730('0xc')](_0x3c5c42,_0x1fd269)[_0xb730('0xd')](function(_0x3b6406){logger[_0xb730('0xe')](_0xb730('0xf'),_0x477e51,_0xb730('0x10'));logger[_0xb730('0x11')](_0xb730('0x12'),_0x477e51,_0xb730('0x10'),JSON[_0xb730('0x13')](_0x3b6406));if(_0x3b6406['error']){if(_0x3b6406['error']['code']===0x1f4){logger[_0xb730('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x477e51,_0x3b6406['error'][_0xb730('0x15')]);return _0x154b65(_0x3b6406['error'][_0xb730('0x15')]);}logger[_0xb730('0x14')](_0xb730('0xf'),_0x477e51,_0x3b6406[_0xb730('0x14')][_0xb730('0x15')]);return _0x59dc4b(_0x3b6406['error'][_0xb730('0x15')]);}else{logger[_0xb730('0xe')](_0xb730('0xf'),_0x477e51,_0xb730('0x10'));_0x59dc4b(_0x3b6406['result'][_0xb730('0x15')]);}})['catch'](function(_0x434707){logger[_0xb730('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x477e51,_0x434707);_0x154b65(_0x434707);});});}exports[_0xb730('0x16')]=function(_0x4545b3){var _0xf9a985=this;return new Promise(function(_0x909189,_0x8cd10b){return db[_0xb730('0x17')][_0xb730('0x18')]({'raw':_0x4545b3['options']?_0x4545b3[_0xb730('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4545b3[_0xb730('0x19')]?_0x4545b3['options']['where']||null:null,'attributes':_0x4545b3[_0xb730('0x19')]?_0x4545b3['options']['attributes']||null:null,'limit':_0x4545b3['options']?_0x4545b3[_0xb730('0x19')]['limit']||null:null,'include':_0x4545b3[_0xb730('0x19')]?_0x4545b3[_0xb730('0x19')][_0xb730('0x1a')]?_[_0xb730('0x1b')](_0x4545b3['options'][_0xb730('0x1a')],function(_0x1cce79){return{'model':db[_0x1cce79[_0xb730('0x1c')]],'as':_0x1cce79['as'],'attributes':_0x1cce79[_0xb730('0x1d')],'include':_0x1cce79[_0xb730('0x1a')]?_[_0xb730('0x1b')](_0x1cce79[_0xb730('0x1a')],function(_0x2e569b){return{'model':db[_0x2e569b[_0xb730('0x1c')]],'as':_0x2e569b['as'],'attributes':_0x2e569b[_0xb730('0x1d')],'include':_0x2e569b['include']?_[_0xb730('0x1b')](_0x2e569b[_0xb730('0x1a')],function(_0x2e9741){return{'model':db[_0x2e9741[_0xb730('0x1c')]],'as':_0x2e9741['as'],'attributes':_0x2e9741['attributes']};}):[]};}):[]};}):[]:[]})[_0xb730('0xd')](function(_0x2be4d4){logger[_0xb730('0xe')](_0xb730('0x16'),_0x4545b3);logger[_0xb730('0x11')](_0xb730('0x16'),_0x4545b3,JSON['stringify'](_0x2be4d4));_0x909189(_0x2be4d4);})['catch'](function(_0x3eaf5d){logger['error']('GetFreshdeskAccount',_0x3eaf5d[_0xb730('0x15')],_0x4545b3);_0x8cd10b(_0xf9a985[_0xb730('0x14')](0x1f4,_0x3eaf5d[_0xb730('0x15')]));});});};exports[_0xb730('0x1e')]=function(_0x69bf6e){var _0x661537=this;return new Promise(function(_0x4de3e2,_0x1fbb97){return db[_0xb730('0x17')][_0xb730('0x1f')]({'raw':_0x69bf6e[_0xb730('0x19')]?_0x69bf6e[_0xb730('0x19')][_0xb730('0x20')]===undefined?!![]:![]:!![],'where':_0x69bf6e[_0xb730('0x19')]?_0x69bf6e[_0xb730('0x19')][_0xb730('0x21')]||null:null,'attributes':_0x69bf6e[_0xb730('0x19')]?_0x69bf6e[_0xb730('0x19')][_0xb730('0x1d')]||null:null,'include':_0x69bf6e[_0xb730('0x19')]?_0x69bf6e[_0xb730('0x19')]['include']?_['map'](_0x69bf6e[_0xb730('0x19')][_0xb730('0x1a')],function(_0x1f552f){return{'model':db[_0x1f552f[_0xb730('0x1c')]],'as':_0x1f552f['as'],'attributes':_0x1f552f[_0xb730('0x1d')],'include':_0x1f552f['include']?_[_0xb730('0x1b')](_0x1f552f[_0xb730('0x1a')],function(_0x165344){return{'model':db[_0x165344['model']],'as':_0x165344['as'],'attributes':_0x165344[_0xb730('0x1d')],'include':_0x165344[_0xb730('0x1a')]?_[_0xb730('0x1b')](_0x165344[_0xb730('0x1a')],function(_0x58e4c8){return{'model':db[_0x58e4c8['model']],'as':_0x58e4c8['as'],'attributes':_0x58e4c8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x439a6f){logger[_0xb730('0xe')](_0xb730('0x1e'),_0x69bf6e);logger['debug'](_0xb730('0x1e'),_0x69bf6e,JSON[_0xb730('0x13')](_0x439a6f));_0x4de3e2(_0x439a6f);})[_0xb730('0x22')](function(_0x5ff25c){logger[_0xb730('0x14')](_0xb730('0x1e'),_0x5ff25c[_0xb730('0x15')],_0x69bf6e);_0x1fbb97(_0x661537[_0xb730('0x14')](0x1f4,_0x5ff25c['message']));});});}; \ No newline at end of file +var _0x4e03=['then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFreshdeskAccount','findAll','options','raw','where','include','map','attributes','ShowFreshdeskAccount','FreshdeskAccount','model','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0x13b524,_0x1bbdc4){var _0x2babdb=function(_0x55d190){while(--_0x55d190){_0x13b524['push'](_0x13b524['shift']());}};_0x2babdb(++_0x1bbdc4);}(_0x4e03,0x1e5));var _0x34e0=function(_0x3fad4f,_0x58525f){_0x3fad4f=_0x3fad4f-0x0;var _0x2b4ec3=_0x4e03[_0x3fad4f];return _0x2b4ec3;};'use strict';var _=require(_0x34e0('0x0'));var util=require('util');var moment=require(_0x34e0('0x1'));var BPromise=require('bluebird');var rs=require(_0x34e0('0x2'));var fs=require('fs');var Redis=require(_0x34e0('0x3'));var db=require(_0x34e0('0x4'))['db'];var utils=require(_0x34e0('0x5'));var logger=require(_0x34e0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x34e0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x243e68,_0x185d0c,_0x29b28c){return new BPromise(function(_0x3e80ac,_0x522047){return client['request'](_0x243e68,_0x29b28c)[_0x34e0('0x8')](function(_0x15d7d3){logger[_0x34e0('0x9')](_0x34e0('0xa'),_0x185d0c,_0x34e0('0xb'));logger[_0x34e0('0xc')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x185d0c,_0x34e0('0xb'),JSON[_0x34e0('0xd')](_0x15d7d3));if(_0x15d7d3[_0x34e0('0xe')]){if(_0x15d7d3[_0x34e0('0xe')][_0x34e0('0xf')]===0x1f4){logger[_0x34e0('0xe')](_0x34e0('0xa'),_0x185d0c,_0x15d7d3[_0x34e0('0xe')][_0x34e0('0x10')]);return _0x522047(_0x15d7d3['error']['message']);}logger[_0x34e0('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x185d0c,_0x15d7d3[_0x34e0('0xe')][_0x34e0('0x10')]);return _0x3e80ac(_0x15d7d3['error'][_0x34e0('0x10')]);}else{logger[_0x34e0('0x9')](_0x34e0('0xa'),_0x185d0c,_0x34e0('0xb'));_0x3e80ac(_0x15d7d3['result'][_0x34e0('0x10')]);}})[_0x34e0('0x11')](function(_0x17674c){logger[_0x34e0('0xe')](_0x34e0('0xa'),_0x185d0c,_0x17674c);_0x522047(_0x17674c);});});}exports[_0x34e0('0x12')]=function(_0x2da208){var _0x18e396=this;return new Promise(function(_0x360031,_0x170652){return db['FreshdeskAccount'][_0x34e0('0x13')]({'raw':_0x2da208[_0x34e0('0x14')]?_0x2da208[_0x34e0('0x14')][_0x34e0('0x15')]===undefined?!![]:![]:!![],'where':_0x2da208[_0x34e0('0x14')]?_0x2da208[_0x34e0('0x14')][_0x34e0('0x16')]||null:null,'attributes':_0x2da208['options']?_0x2da208['options']['attributes']||null:null,'limit':_0x2da208[_0x34e0('0x14')]?_0x2da208[_0x34e0('0x14')]['limit']||null:null,'include':_0x2da208[_0x34e0('0x14')]?_0x2da208[_0x34e0('0x14')][_0x34e0('0x17')]?_[_0x34e0('0x18')](_0x2da208['options']['include'],function(_0x2d4854){return{'model':db[_0x2d4854['model']],'as':_0x2d4854['as'],'attributes':_0x2d4854[_0x34e0('0x19')],'include':_0x2d4854['include']?_[_0x34e0('0x18')](_0x2d4854[_0x34e0('0x17')],function(_0x5d75c5){return{'model':db[_0x5d75c5['model']],'as':_0x5d75c5['as'],'attributes':_0x5d75c5[_0x34e0('0x19')],'include':_0x5d75c5[_0x34e0('0x17')]?_['map'](_0x5d75c5[_0x34e0('0x17')],function(_0x53790b){return{'model':db[_0x53790b['model']],'as':_0x53790b['as'],'attributes':_0x53790b[_0x34e0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x34e0('0x8')](function(_0x27743f){logger['info'](_0x34e0('0x12'),_0x2da208);logger[_0x34e0('0xc')](_0x34e0('0x12'),_0x2da208,JSON[_0x34e0('0xd')](_0x27743f));_0x360031(_0x27743f);})['catch'](function(_0x577ffd){logger[_0x34e0('0xe')]('GetFreshdeskAccount',_0x577ffd[_0x34e0('0x10')],_0x2da208);_0x170652(_0x18e396[_0x34e0('0xe')](0x1f4,_0x577ffd[_0x34e0('0x10')]));});});};exports[_0x34e0('0x1a')]=function(_0x53ea2){var _0x40f332=this;return new Promise(function(_0x2fa97,_0x4c7bc5){return db[_0x34e0('0x1b')]['find']({'raw':_0x53ea2[_0x34e0('0x14')]?_0x53ea2[_0x34e0('0x14')][_0x34e0('0x15')]===undefined?!![]:![]:!![],'where':_0x53ea2['options']?_0x53ea2[_0x34e0('0x14')]['where']||null:null,'attributes':_0x53ea2[_0x34e0('0x14')]?_0x53ea2[_0x34e0('0x14')][_0x34e0('0x19')]||null:null,'include':_0x53ea2[_0x34e0('0x14')]?_0x53ea2[_0x34e0('0x14')][_0x34e0('0x17')]?_[_0x34e0('0x18')](_0x53ea2[_0x34e0('0x14')][_0x34e0('0x17')],function(_0x2d119f){return{'model':db[_0x2d119f[_0x34e0('0x1c')]],'as':_0x2d119f['as'],'attributes':_0x2d119f[_0x34e0('0x19')],'include':_0x2d119f[_0x34e0('0x17')]?_['map'](_0x2d119f[_0x34e0('0x17')],function(_0x54d75a){return{'model':db[_0x54d75a[_0x34e0('0x1c')]],'as':_0x54d75a['as'],'attributes':_0x54d75a[_0x34e0('0x19')],'include':_0x54d75a[_0x34e0('0x17')]?_['map'](_0x54d75a[_0x34e0('0x17')],function(_0x2c9bdb){return{'model':db[_0x2c9bdb[_0x34e0('0x1c')]],'as':_0x2c9bdb['as'],'attributes':_0x2c9bdb[_0x34e0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x34e0('0x8')](function(_0x5a2331){logger['info'](_0x34e0('0x1a'),_0x53ea2);logger[_0x34e0('0xc')](_0x34e0('0x1a'),_0x53ea2,JSON[_0x34e0('0xd')](_0x5a2331));_0x2fa97(_0x5a2331);})[_0x34e0('0x11')](function(_0x5c5343){logger[_0x34e0('0xe')](_0x34e0('0x1a'),_0x5c5343[_0x34e0('0x10')],_0x53ea2);_0x4c7bc5(_0x40f332[_0x34e0('0xe')](0x1f4,_0x5c5343[_0x34e0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 59861bb..312cd82 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 _0x9bea=['show','/:id/fields','getFields','getSubjects','getDescriptions','/:id/tags','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x34c86b,_0x5843fb){var _0x4cb216=function(_0xf18b5a){while(--_0xf18b5a){_0x34c86b['push'](_0x34c86b['shift']());}};_0x4cb216(++_0x5843fb);}(_0x9bea,0x108));var _0xa9be=function(_0x574c32,_0x2d5258){_0x574c32=_0x574c32-0x0;var _0x23c8ec=_0x9bea[_0x574c32];return _0x23c8ec;};'use strict';var multer=require(_0xa9be('0x0'));var util=require(_0xa9be('0x1'));var path=require(_0xa9be('0x2'));var timeout=require(_0xa9be('0x3'));var express=require('express');var router=express[_0xa9be('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa9be('0x5'));var config=require(_0xa9be('0x6'));var controller=require(_0xa9be('0x7'));router[_0xa9be('0x8')]('/',auth[_0xa9be('0x9')](),controller[_0xa9be('0xa')]);router[_0xa9be('0x8')](_0xa9be('0xb'),auth['isAuthenticated'](),controller[_0xa9be('0xc')]);router['get'](_0xa9be('0xd'),auth[_0xa9be('0x9')](),controller[_0xa9be('0xe')]);router[_0xa9be('0x8')]('/:id/subjects',auth[_0xa9be('0x9')](),controller[_0xa9be('0xf')]);router[_0xa9be('0x8')]('/:id/descriptions',auth[_0xa9be('0x9')](),controller[_0xa9be('0x10')]);router[_0xa9be('0x8')](_0xa9be('0x11'),auth[_0xa9be('0x9')](),controller['getTags']);router[_0xa9be('0x12')]('/',auth[_0xa9be('0x9')](),controller['create']);router[_0xa9be('0x12')](_0xa9be('0x11'),auth[_0xa9be('0x9')](),controller['setTags']);router[_0xa9be('0x13')](_0xa9be('0xb'),auth[_0xa9be('0x9')](),controller[_0xa9be('0x14')]);router[_0xa9be('0x15')](_0xa9be('0xb'),auth[_0xa9be('0x9')](),controller['destroy']);module[_0xa9be('0x16')]=router; \ No newline at end of file +var _0x5dcf=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','show','/:id/fields','isAuthenticated','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','update','delete'];(function(_0x13d93b,_0x577f4b){var _0x2aa740=function(_0x31af30){while(--_0x31af30){_0x13d93b['push'](_0x13d93b['shift']());}};_0x2aa740(++_0x577f4b);}(_0x5dcf,0x17c));var _0xf5dc=function(_0x46d467,_0x440580){_0x46d467=_0x46d467-0x0;var _0x6b892f=_0x5dcf[_0x46d467];return _0x6b892f;};'use strict';var multer=require('multer');var util=require(_0xf5dc('0x0'));var path=require('path');var timeout=require(_0xf5dc('0x1'));var express=require(_0xf5dc('0x2'));var router=express[_0xf5dc('0x3')]();var fs_extra=require(_0xf5dc('0x4'));var auth=require(_0xf5dc('0x5'));var interaction=require(_0xf5dc('0x6'));var config=require(_0xf5dc('0x7'));var controller=require(_0xf5dc('0x8'));router[_0xf5dc('0x9')]('/',auth['isAuthenticated'](),controller[_0xf5dc('0xa')]);router[_0xf5dc('0x9')](_0xf5dc('0xb'),auth['isAuthenticated'](),controller[_0xf5dc('0xc')]);router[_0xf5dc('0x9')](_0xf5dc('0xd'),auth[_0xf5dc('0xe')](),controller['getFields']);router[_0xf5dc('0x9')](_0xf5dc('0xf'),auth[_0xf5dc('0xe')](),controller['getSubjects']);router['get'](_0xf5dc('0x10'),auth[_0xf5dc('0xe')](),controller[_0xf5dc('0x11')]);router[_0xf5dc('0x9')](_0xf5dc('0x12'),auth[_0xf5dc('0xe')](),controller['getTags']);router[_0xf5dc('0x13')]('/',auth['isAuthenticated'](),controller[_0xf5dc('0x14')]);router[_0xf5dc('0x13')](_0xf5dc('0x12'),auth[_0xf5dc('0xe')](),controller[_0xf5dc('0x15')]);router[_0xf5dc('0x16')](_0xf5dc('0xb'),auth[_0xf5dc('0xe')](),controller[_0xf5dc('0x17')]);router[_0xf5dc('0x18')](_0xf5dc('0xb'),auth['isAuthenticated'](),controller[_0xf5dc('0x19')]);module[_0xf5dc('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 660271f..f83d97c 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 _0xb9ed=['STRING','sequelize','exports'];(function(_0x11e2bf,_0x167681){var _0x43ab71=function(_0xeaa806){while(--_0xeaa806){_0x11e2bf['push'](_0x11e2bf['shift']());}};_0x43ab71(++_0x167681);}(_0xb9ed,0x181));var _0xdb9e=function(_0xbded9d,_0x694a44){_0xbded9d=_0xbded9d-0x0;var _0x3ac737=_0xb9ed[_0xbded9d];return _0x3ac737;};'use strict';var Sequelize=require(_0xdb9e('0x0'));module[_0xdb9e('0x1')]={'name':{'type':Sequelize[_0xdb9e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe075=['STRING','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe075,0x1c3));var _0x5e07=function(_0x52aaae,_0x32765a){_0x52aaae=_0x52aaae-0x0;var _0xbd1fe3=_0xe075[_0x52aaae];return _0xbd1fe3;};'use strict';var Sequelize=require('sequelize');module[_0x5e07('0x0')]={'name':{'type':Sequelize[_0x5e07('0x1')]},'description':{'type':Sequelize[_0x5e07('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index f0582d4..7539342 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 _0xbbc4=['VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','getFields','findOne','FreshdeskField','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where'];(function(_0x1f1e31,_0x27b5c3){var _0x229b56=function(_0x16db77){while(--_0x16db77){_0x1f1e31['push'](_0x1f1e31['shift']());}};_0x229b56(++_0x27b5c3);}(_0xbbc4,0x1bf));var _0x4bbc=function(_0x508a99,_0x42b963){_0x508a99=_0x508a99-0x0;var _0x4ed68d=_0xbbc4[_0x508a99];return _0x4ed68d;};'use strict';var emlformat=require(_0x4bbc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4bbc('0x1'));var jsonpatch=require(_0x4bbc('0x2'));var rp=require(_0x4bbc('0x3'));var moment=require(_0x4bbc('0x4'));var BPromise=require(_0x4bbc('0x5'));var Mustache=require(_0x4bbc('0x6'));var util=require(_0x4bbc('0x7'));var path=require(_0x4bbc('0x8'));var sox=require(_0x4bbc('0x9'));var csv=require('to-csv');var ejs=require(_0x4bbc('0xa'));var fs=require('fs');var fs_extra=require(_0x4bbc('0xb'));var _=require(_0x4bbc('0xc'));var squel=require(_0x4bbc('0xd'));var crypto=require(_0x4bbc('0xe'));var jsforce=require(_0x4bbc('0xf'));var deskjs=require(_0x4bbc('0x10'));var toCsv=require(_0x4bbc('0x11'));var querystring=require(_0x4bbc('0x12'));var Papa=require('papaparse');var Redis=require(_0x4bbc('0x13'));var authService=require(_0x4bbc('0x14'));var qs=require(_0x4bbc('0x15'));var as=require(_0x4bbc('0x16'));var hardwareService=require(_0x4bbc('0x17'));var logger=require(_0x4bbc('0x18'))(_0x4bbc('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c32a8,_0x26a0b2){_0x26a0b2=_0x26a0b2||0xcc;return function(_0x2d3081){if(_0x2d3081){return _0x1c32a8[_0x4bbc('0x1a')](_0x26a0b2);}return _0x1c32a8[_0x4bbc('0x1b')](_0x26a0b2)[_0x4bbc('0x1c')]();};}function respondWithResult(_0x17d8d1,_0x1a74fe){_0x1a74fe=_0x1a74fe||0xc8;return function(_0x5935e8){if(_0x5935e8){return _0x17d8d1[_0x4bbc('0x1b')](_0x1a74fe)[_0x4bbc('0x1d')](_0x5935e8);}};}function respondWithFilteredResult(_0xb129b9,_0x143778){return function(_0x510ed1){if(_0x510ed1){var _0x26911f=typeof _0x143778['offset']===_0x4bbc('0x1e')&&typeof _0x143778[_0x4bbc('0x1f')]===_0x4bbc('0x1e');var _0x1b211e=_0x510ed1[_0x4bbc('0x20')];var _0x5255cf=_0x26911f?0x0:_0x143778['offset'];var _0x3b49da=_0x26911f?_0x510ed1[_0x4bbc('0x20')]:_0x143778[_0x4bbc('0x21')]+_0x143778['limit'];var _0x530fdc;if(_0x3b49da>=_0x1b211e){_0x3b49da=_0x1b211e;_0x530fdc=0xc8;}else{_0x530fdc=0xce;}_0xb129b9['status'](_0x530fdc);return _0xb129b9[_0x4bbc('0x22')](_0x4bbc('0x23'),_0x5255cf+'-'+_0x3b49da+'/'+_0x1b211e)[_0x4bbc('0x1d')](_0x510ed1);}return null;};}function patchUpdates(_0xc552a){return function(_0x2ea9f2){try{jsonpatch[_0x4bbc('0x24')](_0x2ea9f2,_0xc552a,!![]);}catch(_0x4baf23){return BPromise[_0x4bbc('0x25')](_0x4baf23);}return _0x2ea9f2['save']();};}function saveUpdates(_0x3df204,_0x3df355){return function(_0x4e654e){if(_0x4e654e){return _0x4e654e[_0x4bbc('0x26')](_0x3df204)[_0x4bbc('0x27')](function(_0x341a18){return _0x341a18;});}return null;};}function removeEntity(_0x5c9137,_0x14bc06){return function(_0x241eb9){if(_0x241eb9){return _0x241eb9['destroy']()[_0x4bbc('0x27')](function(){_0x5c9137['status'](0xcc)[_0x4bbc('0x1c')]();});}};}function handleEntityNotFound(_0x3eec06,_0x2ad050){return function(_0x31241f){if(!_0x31241f){_0x3eec06[_0x4bbc('0x1a')](0x194);}return _0x31241f;};}function handleError(_0x23ec08,_0x2c2a26){_0x2c2a26=_0x2c2a26||0x1f4;return function(_0x5a0c37){logger[_0x4bbc('0x28')](_0x5a0c37[_0x4bbc('0x29')]);if(_0x5a0c37[_0x4bbc('0x2a')]){delete _0x5a0c37[_0x4bbc('0x2a')];}_0x23ec08[_0x4bbc('0x1b')](_0x2c2a26)[_0x4bbc('0x2b')](_0x5a0c37);};}exports[_0x4bbc('0x2c')]=function(_0x4dbf74,_0x4f9d5a){var _0x5b92e7={},_0x230aaf={},_0x5c47e7={'count':0x0,'rows':[]};var _0x449aaa=_[_0x4bbc('0x2d')](db[_0x4bbc('0x2e')][_0x4bbc('0x2f')],function(_0xb869a5){return{'name':_0xb869a5['fieldName'],'type':_0xb869a5[_0x4bbc('0x30')][_0x4bbc('0x31')]};});_0x230aaf[_0x4bbc('0x32')]=_[_0x4bbc('0x2d')](_0x449aaa,_0x4bbc('0x2a'));_0x230aaf[_0x4bbc('0x33')]=_['keys'](_0x4dbf74['query']);_0x230aaf[_0x4bbc('0x34')]=_[_0x4bbc('0x35')](_0x230aaf[_0x4bbc('0x32')],_0x230aaf[_0x4bbc('0x33')]);_0x5b92e7['attributes']=_['intersection'](_0x230aaf['model'],qs['fields'](_0x4dbf74[_0x4bbc('0x33')][_0x4bbc('0x36')]));_0x5b92e7[_0x4bbc('0x37')]=_0x5b92e7[_0x4bbc('0x37')][_0x4bbc('0x38')]?_0x5b92e7[_0x4bbc('0x37')]:_0x230aaf[_0x4bbc('0x32')];if(!_0x4dbf74['query']['hasOwnProperty'](_0x4bbc('0x39'))){_0x5b92e7['limit']=qs[_0x4bbc('0x1f')](_0x4dbf74[_0x4bbc('0x33')][_0x4bbc('0x1f')]);_0x5b92e7['offset']=qs[_0x4bbc('0x21')](_0x4dbf74[_0x4bbc('0x33')]['offset']);}_0x5b92e7[_0x4bbc('0x3a')]=qs[_0x4bbc('0x3b')](_0x4dbf74[_0x4bbc('0x33')][_0x4bbc('0x3b')]);_0x5b92e7['where']=qs[_0x4bbc('0x34')](_[_0x4bbc('0x3c')](_0x4dbf74[_0x4bbc('0x33')],_0x230aaf[_0x4bbc('0x34')]),_0x449aaa);if(_0x4dbf74[_0x4bbc('0x33')][_0x4bbc('0x3d')]){_0x5b92e7[_0x4bbc('0x3e')]=_['merge'](_0x5b92e7[_0x4bbc('0x3e')],{'$or':_[_0x4bbc('0x2d')](_0x449aaa,function(_0x24ea07){if(_0x24ea07[_0x4bbc('0x30')]!==_0x4bbc('0x3f')){var _0x136153={};_0x136153[_0x24ea07[_0x4bbc('0x2a')]]={'$like':'%'+_0x4dbf74['query'][_0x4bbc('0x3d')]+'%'};return _0x136153;}})});}_0x5b92e7=_[_0x4bbc('0x40')]({},_0x5b92e7,_0x4dbf74[_0x4bbc('0x41')]);var _0x44a8f0={'where':_0x5b92e7[_0x4bbc('0x3e')]};return db[_0x4bbc('0x2e')]['count'](_0x44a8f0)[_0x4bbc('0x27')](function(_0x1af42b){_0x5c47e7[_0x4bbc('0x20')]=_0x1af42b;if(_0x4dbf74[_0x4bbc('0x33')][_0x4bbc('0x42')]){_0x5b92e7[_0x4bbc('0x43')]=[{'all':!![]}];}return db[_0x4bbc('0x2e')][_0x4bbc('0x44')](_0x5b92e7);})[_0x4bbc('0x27')](function(_0x1b18fc){_0x5c47e7['rows']=_0x1b18fc;return _0x5c47e7;})['then'](respondWithFilteredResult(_0x4f9d5a,_0x5b92e7))[_0x4bbc('0x45')](handleError(_0x4f9d5a,null));};exports[_0x4bbc('0x46')]=function(_0x5d5f82,_0x9756de){var _0x194d04={'raw':![],'where':{'id':_0x5d5f82[_0x4bbc('0x47')]['id']}},_0x591c2b={};_0x591c2b['model']=_[_0x4bbc('0x48')](db[_0x4bbc('0x2e')][_0x4bbc('0x2f')]);_0x591c2b[_0x4bbc('0x33')]=_['keys'](_0x5d5f82['query']);_0x591c2b[_0x4bbc('0x34')]=_[_0x4bbc('0x35')](_0x591c2b['model'],_0x591c2b[_0x4bbc('0x33')]);_0x194d04[_0x4bbc('0x37')]=_['intersection'](_0x591c2b[_0x4bbc('0x32')],qs[_0x4bbc('0x36')](_0x5d5f82[_0x4bbc('0x33')][_0x4bbc('0x36')]));_0x194d04[_0x4bbc('0x37')]=_0x194d04[_0x4bbc('0x37')]['length']?_0x194d04[_0x4bbc('0x37')]:_0x591c2b[_0x4bbc('0x32')];if(_0x5d5f82[_0x4bbc('0x33')][_0x4bbc('0x42')]){_0x194d04[_0x4bbc('0x43')]=[{'all':!![]}];}_0x194d04=_['merge']({},_0x194d04,_0x5d5f82[_0x4bbc('0x41')]);return db['FreshdeskConfiguration'][_0x4bbc('0x49')](_0x194d04)[_0x4bbc('0x27')](handleEntityNotFound(_0x9756de,null))[_0x4bbc('0x27')](respondWithResult(_0x9756de,null))['catch'](handleError(_0x9756de,null));};exports[_0x4bbc('0x4a')]=function(_0x4c81f7,_0x52cd9f){return db[_0x4bbc('0x2e')][_0x4bbc('0x4a')](_0x4c81f7[_0x4bbc('0x4b')],{})[_0x4bbc('0x27')](respondWithResult(_0x52cd9f,0xc9))[_0x4bbc('0x45')](handleError(_0x52cd9f,null));};exports[_0x4bbc('0x26')]=function(_0x457fd9,_0xef864d){if(_0x457fd9['body']['id']){delete _0x457fd9['body']['id'];}return db[_0x4bbc('0x2e')][_0x4bbc('0x49')]({'where':{'id':_0x457fd9[_0x4bbc('0x47')]['id']}})[_0x4bbc('0x27')](handleEntityNotFound(_0xef864d,null))[_0x4bbc('0x27')](saveUpdates(_0x457fd9[_0x4bbc('0x4b')],null))[_0x4bbc('0x27')](respondWithResult(_0xef864d,null))[_0x4bbc('0x45')](handleError(_0xef864d,null));};exports['destroy']=function(_0x5e459a,_0xd11ad0){return db[_0x4bbc('0x2e')][_0x4bbc('0x49')]({'where':{'id':_0x5e459a[_0x4bbc('0x47')]['id']}})[_0x4bbc('0x27')](handleEntityNotFound(_0xd11ad0,null))[_0x4bbc('0x27')](removeEntity(_0xd11ad0,null))[_0x4bbc('0x45')](handleError(_0xd11ad0,null));};exports[_0x4bbc('0x4c')]=function(_0x16d7d7,_0x44934a,_0x2554d5){var _0xb06442={};var _0x5cbce9={};var _0x1fab1c;var _0x4c1619;return db[_0x4bbc('0x2e')][_0x4bbc('0x4d')]({'where':{'id':_0x16d7d7[_0x4bbc('0x47')]['id']}})[_0x4bbc('0x27')](handleEntityNotFound(_0x44934a,null))[_0x4bbc('0x27')](function(_0x2cd752){if(_0x2cd752){_0x1fab1c=_0x2cd752;_0x5cbce9['model']=_[_0x4bbc('0x48')](db[_0x4bbc('0x4e')][_0x4bbc('0x2f')]);_0x5cbce9[_0x4bbc('0x33')]=_[_0x4bbc('0x48')](_0x16d7d7[_0x4bbc('0x33')]);_0x5cbce9[_0x4bbc('0x34')]=_[_0x4bbc('0x35')](_0x5cbce9[_0x4bbc('0x32')],_0x5cbce9[_0x4bbc('0x33')]);_0xb06442[_0x4bbc('0x37')]=_[_0x4bbc('0x35')](_0x5cbce9['model'],qs[_0x4bbc('0x36')](_0x16d7d7[_0x4bbc('0x33')][_0x4bbc('0x36')]));_0xb06442['attributes']=_0xb06442[_0x4bbc('0x37')]['length']?_0xb06442[_0x4bbc('0x37')]:_0x5cbce9[_0x4bbc('0x32')];_0xb06442[_0x4bbc('0x3a')]=qs['sort'](_0x16d7d7[_0x4bbc('0x33')][_0x4bbc('0x3b')]);_0xb06442['where']=qs[_0x4bbc('0x34')](_[_0x4bbc('0x3c')](_0x16d7d7[_0x4bbc('0x33')],_0x5cbce9['filters']));if(_0x16d7d7[_0x4bbc('0x33')][_0x4bbc('0x3d')]){_0xb06442['where']=_[_0x4bbc('0x40')](_0xb06442[_0x4bbc('0x3e')],{'$or':_[_0x4bbc('0x2d')](_0xb06442['attributes'],function(_0x185587){var _0x4de9c2={};_0x4de9c2[_0x185587]={'$like':'%'+_0x16d7d7[_0x4bbc('0x33')][_0x4bbc('0x3d')]+'%'};return _0x4de9c2;})});}_0xb06442=_[_0x4bbc('0x40')]({},_0xb06442,_0x16d7d7[_0x4bbc('0x41')]);return _0x1fab1c['getFields'](_0xb06442);}})[_0x4bbc('0x27')](function(_0x4bf1fd){if(_0x4bf1fd){_0x4c1619=_0x4bf1fd[_0x4bbc('0x38')];if(!_0x16d7d7['query']['hasOwnProperty'](_0x4bbc('0x39'))){_0xb06442['limit']=qs[_0x4bbc('0x1f')](_0x16d7d7['query'][_0x4bbc('0x1f')]);_0xb06442[_0x4bbc('0x21')]=qs['offset'](_0x16d7d7[_0x4bbc('0x33')][_0x4bbc('0x21')]);}return _0x1fab1c[_0x4bbc('0x4c')](_0xb06442);}})[_0x4bbc('0x27')](function(_0x371b7b){if(_0x371b7b){return _0x371b7b?{'count':_0x4c1619,'rows':_0x371b7b}:null;}})[_0x4bbc('0x27')](respondWithResult(_0x44934a,null))['catch'](handleError(_0x44934a,null));};exports[_0x4bbc('0x4f')]=function(_0x2e8314,_0x4d4f0f,_0x1d4c37){var _0x4c7eda={};var _0x258484={};var _0x4c02d0;var _0x191044;return db['FreshdeskConfiguration'][_0x4bbc('0x4d')]({'where':{'id':_0x2e8314[_0x4bbc('0x47')]['id']}})['then'](handleEntityNotFound(_0x4d4f0f,null))[_0x4bbc('0x27')](function(_0x37459b){if(_0x37459b){_0x4c02d0=_0x37459b;_0x258484[_0x4bbc('0x32')]=_['keys'](db[_0x4bbc('0x4e')][_0x4bbc('0x2f')]);_0x258484[_0x4bbc('0x33')]=_['keys'](_0x2e8314[_0x4bbc('0x33')]);_0x258484[_0x4bbc('0x34')]=_[_0x4bbc('0x35')](_0x258484[_0x4bbc('0x32')],_0x258484[_0x4bbc('0x33')]);_0x4c7eda['attributes']=_[_0x4bbc('0x35')](_0x258484[_0x4bbc('0x32')],qs['fields'](_0x2e8314[_0x4bbc('0x33')][_0x4bbc('0x36')]));_0x4c7eda[_0x4bbc('0x37')]=_0x4c7eda[_0x4bbc('0x37')][_0x4bbc('0x38')]?_0x4c7eda[_0x4bbc('0x37')]:_0x258484['model'];_0x4c7eda[_0x4bbc('0x3a')]=qs[_0x4bbc('0x3b')](_0x2e8314['query'][_0x4bbc('0x3b')]);_0x4c7eda[_0x4bbc('0x3e')]=qs[_0x4bbc('0x34')](_[_0x4bbc('0x3c')](_0x2e8314[_0x4bbc('0x33')],_0x258484[_0x4bbc('0x34')]));if(_0x2e8314[_0x4bbc('0x33')][_0x4bbc('0x3d')]){_0x4c7eda[_0x4bbc('0x3e')]=_[_0x4bbc('0x40')](_0x4c7eda[_0x4bbc('0x3e')],{'$or':_[_0x4bbc('0x2d')](_0x4c7eda[_0x4bbc('0x37')],function(_0x5ae573){var _0x22e0e1={};_0x22e0e1[_0x5ae573]={'$like':'%'+_0x2e8314[_0x4bbc('0x33')][_0x4bbc('0x3d')]+'%'};return _0x22e0e1;})});}_0x4c7eda=_[_0x4bbc('0x40')]({},_0x4c7eda,_0x2e8314[_0x4bbc('0x41')]);return _0x4c02d0[_0x4bbc('0x4f')](_0x4c7eda);}})[_0x4bbc('0x27')](function(_0xb1e8b0){if(_0xb1e8b0){_0x191044=_0xb1e8b0['length'];if(!_0x2e8314[_0x4bbc('0x33')]['hasOwnProperty'](_0x4bbc('0x39'))){_0x4c7eda[_0x4bbc('0x1f')]=qs[_0x4bbc('0x1f')](_0x2e8314[_0x4bbc('0x33')]['limit']);_0x4c7eda[_0x4bbc('0x21')]=qs[_0x4bbc('0x21')](_0x2e8314[_0x4bbc('0x33')][_0x4bbc('0x21')]);}return _0x4c02d0[_0x4bbc('0x4f')](_0x4c7eda);}})[_0x4bbc('0x27')](function(_0xed9af6){if(_0xed9af6){return _0xed9af6?{'count':_0x191044,'rows':_0xed9af6}:null;}})['then'](respondWithResult(_0x4d4f0f,null))[_0x4bbc('0x45')](handleError(_0x4d4f0f,null));};exports['getDescriptions']=function(_0x39ea2e,_0x3a7e7d,_0x12d2a7){var _0x1e1c74={};var _0x55ab29={};var _0x5ee266;var _0xf77842;return db[_0x4bbc('0x2e')][_0x4bbc('0x4d')]({'where':{'id':_0x39ea2e['params']['id']}})[_0x4bbc('0x27')](handleEntityNotFound(_0x3a7e7d,null))[_0x4bbc('0x27')](function(_0x33a787){if(_0x33a787){_0x5ee266=_0x33a787;_0x55ab29[_0x4bbc('0x32')]=_[_0x4bbc('0x48')](db[_0x4bbc('0x4e')]['rawAttributes']);_0x55ab29[_0x4bbc('0x33')]=_[_0x4bbc('0x48')](_0x39ea2e['query']);_0x55ab29['filters']=_[_0x4bbc('0x35')](_0x55ab29[_0x4bbc('0x32')],_0x55ab29[_0x4bbc('0x33')]);_0x1e1c74[_0x4bbc('0x37')]=_['intersection'](_0x55ab29[_0x4bbc('0x32')],qs[_0x4bbc('0x36')](_0x39ea2e[_0x4bbc('0x33')][_0x4bbc('0x36')]));_0x1e1c74[_0x4bbc('0x37')]=_0x1e1c74[_0x4bbc('0x37')][_0x4bbc('0x38')]?_0x1e1c74[_0x4bbc('0x37')]:_0x55ab29['model'];_0x1e1c74[_0x4bbc('0x3a')]=qs['sort'](_0x39ea2e[_0x4bbc('0x33')][_0x4bbc('0x3b')]);_0x1e1c74[_0x4bbc('0x3e')]=qs[_0x4bbc('0x34')](_['pick'](_0x39ea2e[_0x4bbc('0x33')],_0x55ab29['filters']));if(_0x39ea2e[_0x4bbc('0x33')]['filter']){_0x1e1c74[_0x4bbc('0x3e')]=_[_0x4bbc('0x40')](_0x1e1c74[_0x4bbc('0x3e')],{'$or':_[_0x4bbc('0x2d')](_0x1e1c74[_0x4bbc('0x37')],function(_0x3398c7){var _0x34ec91={};_0x34ec91[_0x3398c7]={'$like':'%'+_0x39ea2e[_0x4bbc('0x33')][_0x4bbc('0x3d')]+'%'};return _0x34ec91;})});}_0x1e1c74=_['merge']({},_0x1e1c74,_0x39ea2e[_0x4bbc('0x41')]);return _0x5ee266['getDescriptions'](_0x1e1c74);}})[_0x4bbc('0x27')](function(_0x2eefae){if(_0x2eefae){_0xf77842=_0x2eefae['length'];if(!_0x39ea2e[_0x4bbc('0x33')][_0x4bbc('0x50')](_0x4bbc('0x39'))){_0x1e1c74['limit']=qs['limit'](_0x39ea2e['query']['limit']);_0x1e1c74[_0x4bbc('0x21')]=qs[_0x4bbc('0x21')](_0x39ea2e[_0x4bbc('0x33')][_0x4bbc('0x21')]);}return _0x5ee266[_0x4bbc('0x51')](_0x1e1c74);}})[_0x4bbc('0x27')](function(_0x4ce187){if(_0x4ce187){return _0x4ce187?{'count':_0xf77842,'rows':_0x4ce187}:null;}})['then'](respondWithResult(_0x3a7e7d,null))[_0x4bbc('0x45')](handleError(_0x3a7e7d,null));};exports[_0x4bbc('0x52')]=function(_0x2ec176,_0x4b3d74,_0x46ea5f){var _0x2e8447={};var _0x44d46a={};var _0x14c09b;var _0x513590;return db[_0x4bbc('0x2e')][_0x4bbc('0x4d')]({'where':{'id':_0x2ec176[_0x4bbc('0x47')]['id']}})[_0x4bbc('0x27')](handleEntityNotFound(_0x4b3d74,null))[_0x4bbc('0x27')](function(_0x383db2){if(_0x383db2){_0x14c09b=_0x383db2;_0x44d46a[_0x4bbc('0x32')]=_[_0x4bbc('0x48')](db[_0x4bbc('0x53')]['rawAttributes']);_0x44d46a[_0x4bbc('0x33')]=_[_0x4bbc('0x48')](_0x2ec176['query']);_0x44d46a[_0x4bbc('0x34')]=_[_0x4bbc('0x35')](_0x44d46a['model'],_0x44d46a[_0x4bbc('0x33')]);_0x2e8447[_0x4bbc('0x37')]=_[_0x4bbc('0x35')](_0x44d46a[_0x4bbc('0x32')],qs[_0x4bbc('0x36')](_0x2ec176[_0x4bbc('0x33')][_0x4bbc('0x36')]));_0x2e8447[_0x4bbc('0x37')]=_0x2e8447[_0x4bbc('0x37')][_0x4bbc('0x38')]?_0x2e8447[_0x4bbc('0x37')]:_0x44d46a[_0x4bbc('0x32')];_0x2e8447['order']=qs[_0x4bbc('0x3b')](_0x2ec176[_0x4bbc('0x33')]['sort']);_0x2e8447[_0x4bbc('0x3e')]=qs[_0x4bbc('0x34')](_[_0x4bbc('0x3c')](_0x2ec176[_0x4bbc('0x33')],_0x44d46a['filters']));if(_0x2ec176[_0x4bbc('0x33')][_0x4bbc('0x3d')]){_0x2e8447[_0x4bbc('0x3e')]=_[_0x4bbc('0x40')](_0x2e8447[_0x4bbc('0x3e')],{'$or':_[_0x4bbc('0x2d')](_0x2e8447['attributes'],function(_0x2c6602){var _0x281264={};_0x281264[_0x2c6602]={'$like':'%'+_0x2ec176[_0x4bbc('0x33')][_0x4bbc('0x3d')]+'%'};return _0x281264;})});}_0x2e8447=_[_0x4bbc('0x40')]({},_0x2e8447,_0x2ec176[_0x4bbc('0x41')]);return _0x14c09b[_0x4bbc('0x52')](_0x2e8447);}})[_0x4bbc('0x27')](function(_0x5e2856){if(_0x5e2856){_0x513590=_0x5e2856['length'];if(!_0x2ec176['query'][_0x4bbc('0x50')]('nolimit')){_0x2e8447[_0x4bbc('0x1f')]=qs['limit'](_0x2ec176['query'][_0x4bbc('0x1f')]);_0x2e8447[_0x4bbc('0x21')]=qs[_0x4bbc('0x21')](_0x2ec176['query']['offset']);}return _0x14c09b['getTags'](_0x2e8447);}})[_0x4bbc('0x27')](function(_0x49ba3c){if(_0x49ba3c){return _0x49ba3c?{'count':_0x513590,'rows':_0x49ba3c}:null;}})['then'](respondWithResult(_0x4b3d74,null))[_0x4bbc('0x45')](handleError(_0x4b3d74,null));};exports[_0x4bbc('0x54')]=function(_0x199b8b,_0x21ce10,_0x271103){if(_0x199b8b[_0x4bbc('0x4b')]['id']){delete _0x199b8b[_0x4bbc('0x4b')]['id'];}return db[_0x4bbc('0x2e')][_0x4bbc('0x4d')]({'where':{'id':_0x199b8b[_0x4bbc('0x47')]['id']}})[_0x4bbc('0x27')](handleEntityNotFound(_0x21ce10,null))[_0x4bbc('0x27')](function(_0x9d14a7){if(_0x9d14a7){return _0x9d14a7['setTags'](_0x199b8b['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x21ce10,null))[_0x4bbc('0x45')](handleError(_0x21ce10,null));}; \ No newline at end of file +var _0x2d18=['sort','where','merge','filter','options','includeAll','findAll','rows','catch','params','keys','include','find','create','body','destroy','getFields','findOne','FreshdeskField','rawAttributes','map','getSubjects','pick','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','stack','name','send','index','FreshdeskConfiguration','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x2d18,0x1bb));var _0x82d1=function(_0x297fc4,_0x540792){_0x297fc4=_0x297fc4-0x0;var _0x8f774=_0x2d18[_0x297fc4];return _0x8f774;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x82d1('0x0'));var jsonpatch=require(_0x82d1('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x82d1('0x2'));var Mustache=require('mustache');var util=require(_0x82d1('0x3'));var path=require('path');var sox=require(_0x82d1('0x4'));var csv=require('to-csv');var ejs=require(_0x82d1('0x5'));var fs=require('fs');var fs_extra=require(_0x82d1('0x6'));var _=require(_0x82d1('0x7'));var squel=require(_0x82d1('0x8'));var crypto=require(_0x82d1('0x9'));var jsforce=require(_0x82d1('0xa'));var deskjs=require(_0x82d1('0xb'));var toCsv=require(_0x82d1('0xc'));var querystring=require(_0x82d1('0xd'));var Papa=require(_0x82d1('0xe'));var Redis=require(_0x82d1('0xf'));var authService=require(_0x82d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x82d1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x82d1('0x12'))(_0x82d1('0x13'));var utils=require('../../config/utils');var config=require(_0x82d1('0x14'));var licenseUtil=require(_0x82d1('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a4a8e,_0x3662d1){_0x3662d1=_0x3662d1||0xcc;return function(_0x4732d5){if(_0x4732d5){return _0x1a4a8e[_0x82d1('0x16')](_0x3662d1);}return _0x1a4a8e[_0x82d1('0x17')](_0x3662d1)['end']();};}function respondWithResult(_0x12077b,_0x22f967){_0x22f967=_0x22f967||0xc8;return function(_0x20ad68){if(_0x20ad68){return _0x12077b[_0x82d1('0x17')](_0x22f967)[_0x82d1('0x18')](_0x20ad68);}};}function respondWithFilteredResult(_0x3ee3c8,_0x3883e6){return function(_0x3639af){if(_0x3639af){var _0x7fe439=typeof _0x3883e6[_0x82d1('0x19')]===_0x82d1('0x1a')&&typeof _0x3883e6[_0x82d1('0x1b')]==='undefined';var _0x1b0619=_0x3639af['count'];var _0x439455=_0x7fe439?0x0:_0x3883e6['offset'];var _0x3ecf56=_0x7fe439?_0x3639af[_0x82d1('0x1c')]:_0x3883e6['offset']+_0x3883e6[_0x82d1('0x1b')];var _0x405a81;if(_0x3ecf56>=_0x1b0619){_0x3ecf56=_0x1b0619;_0x405a81=0xc8;}else{_0x405a81=0xce;}_0x3ee3c8[_0x82d1('0x17')](_0x405a81);return _0x3ee3c8[_0x82d1('0x1d')]('Content-Range',_0x439455+'-'+_0x3ecf56+'/'+_0x1b0619)[_0x82d1('0x18')](_0x3639af);}return null;};}function patchUpdates(_0x1d6287){return function(_0x5c44f9){try{jsonpatch[_0x82d1('0x1e')](_0x5c44f9,_0x1d6287,!![]);}catch(_0x220942){return BPromise[_0x82d1('0x1f')](_0x220942);}return _0x5c44f9[_0x82d1('0x20')]();};}function saveUpdates(_0x41c23f,_0x827b7d){return function(_0x56405d){if(_0x56405d){return _0x56405d[_0x82d1('0x21')](_0x41c23f)[_0x82d1('0x22')](function(_0x168d79){return _0x168d79;});}return null;};}function removeEntity(_0xddb31e,_0x5a4b26){return function(_0x416392){if(_0x416392){return _0x416392['destroy']()['then'](function(){_0xddb31e[_0x82d1('0x17')](0xcc)[_0x82d1('0x23')]();});}};}function handleEntityNotFound(_0x4d3cfb,_0x316c30){return function(_0x474426){if(!_0x474426){_0x4d3cfb[_0x82d1('0x16')](0x194);}return _0x474426;};}function handleError(_0x21b6ab,_0x16520e){_0x16520e=_0x16520e||0x1f4;return function(_0x17c710){logger[_0x82d1('0x24')](_0x17c710[_0x82d1('0x25')]);if(_0x17c710[_0x82d1('0x26')]){delete _0x17c710[_0x82d1('0x26')];}_0x21b6ab['status'](_0x16520e)[_0x82d1('0x27')](_0x17c710);};}exports[_0x82d1('0x28')]=function(_0x417a82,_0x2f65e9){var _0xde8b5c={},_0x1fbce5={},_0xff2bb1={'count':0x0,'rows':[]};var _0x503c7c=_['map'](db[_0x82d1('0x29')]['rawAttributes'],function(_0x25f1f7){return{'name':_0x25f1f7[_0x82d1('0x2a')],'type':_0x25f1f7[_0x82d1('0x2b')][_0x82d1('0x2c')]};});_0x1fbce5[_0x82d1('0x2d')]=_['map'](_0x503c7c,_0x82d1('0x26'));_0x1fbce5[_0x82d1('0x2e')]=_['keys'](_0x417a82[_0x82d1('0x2e')]);_0x1fbce5[_0x82d1('0x2f')]=_[_0x82d1('0x30')](_0x1fbce5[_0x82d1('0x2d')],_0x1fbce5[_0x82d1('0x2e')]);_0xde8b5c['attributes']=_[_0x82d1('0x30')](_0x1fbce5[_0x82d1('0x2d')],qs[_0x82d1('0x31')](_0x417a82['query'][_0x82d1('0x31')]));_0xde8b5c[_0x82d1('0x32')]=_0xde8b5c[_0x82d1('0x32')][_0x82d1('0x33')]?_0xde8b5c[_0x82d1('0x32')]:_0x1fbce5['model'];if(!_0x417a82[_0x82d1('0x2e')][_0x82d1('0x34')](_0x82d1('0x35'))){_0xde8b5c['limit']=qs[_0x82d1('0x1b')](_0x417a82[_0x82d1('0x2e')][_0x82d1('0x1b')]);_0xde8b5c[_0x82d1('0x19')]=qs[_0x82d1('0x19')](_0x417a82['query'][_0x82d1('0x19')]);}_0xde8b5c[_0x82d1('0x36')]=qs[_0x82d1('0x37')](_0x417a82[_0x82d1('0x2e')][_0x82d1('0x37')]);_0xde8b5c[_0x82d1('0x38')]=qs[_0x82d1('0x2f')](_['pick'](_0x417a82[_0x82d1('0x2e')],_0x1fbce5[_0x82d1('0x2f')]),_0x503c7c);if(_0x417a82[_0x82d1('0x2e')]['filter']){_0xde8b5c[_0x82d1('0x38')]=_[_0x82d1('0x39')](_0xde8b5c[_0x82d1('0x38')],{'$or':_['map'](_0x503c7c,function(_0x23d74f){if(_0x23d74f[_0x82d1('0x2b')]!=='VIRTUAL'){var _0x18c0f1={};_0x18c0f1[_0x23d74f['name']]={'$like':'%'+_0x417a82['query'][_0x82d1('0x3a')]+'%'};return _0x18c0f1;}})});}_0xde8b5c=_[_0x82d1('0x39')]({},_0xde8b5c,_0x417a82[_0x82d1('0x3b')]);var _0x5ad7fe={'where':_0xde8b5c[_0x82d1('0x38')]};return db[_0x82d1('0x29')]['count'](_0x5ad7fe)[_0x82d1('0x22')](function(_0xb8458b){_0xff2bb1['count']=_0xb8458b;if(_0x417a82['query'][_0x82d1('0x3c')]){_0xde8b5c['include']=[{'all':!![]}];}return db[_0x82d1('0x29')][_0x82d1('0x3d')](_0xde8b5c);})[_0x82d1('0x22')](function(_0x599344){_0xff2bb1[_0x82d1('0x3e')]=_0x599344;return _0xff2bb1;})[_0x82d1('0x22')](respondWithFilteredResult(_0x2f65e9,_0xde8b5c))[_0x82d1('0x3f')](handleError(_0x2f65e9,null));};exports['show']=function(_0x1fc003,_0x2e3abc){var _0x2b7d02={'raw':![],'where':{'id':_0x1fc003[_0x82d1('0x40')]['id']}},_0x24638d={};_0x24638d[_0x82d1('0x2d')]=_[_0x82d1('0x41')](db[_0x82d1('0x29')]['rawAttributes']);_0x24638d[_0x82d1('0x2e')]=_['keys'](_0x1fc003[_0x82d1('0x2e')]);_0x24638d[_0x82d1('0x2f')]=_[_0x82d1('0x30')](_0x24638d[_0x82d1('0x2d')],_0x24638d[_0x82d1('0x2e')]);_0x2b7d02[_0x82d1('0x32')]=_[_0x82d1('0x30')](_0x24638d['model'],qs['fields'](_0x1fc003[_0x82d1('0x2e')]['fields']));_0x2b7d02[_0x82d1('0x32')]=_0x2b7d02[_0x82d1('0x32')][_0x82d1('0x33')]?_0x2b7d02['attributes']:_0x24638d['model'];if(_0x1fc003[_0x82d1('0x2e')][_0x82d1('0x3c')]){_0x2b7d02[_0x82d1('0x42')]=[{'all':!![]}];}_0x2b7d02=_[_0x82d1('0x39')]({},_0x2b7d02,_0x1fc003[_0x82d1('0x3b')]);return db[_0x82d1('0x29')][_0x82d1('0x43')](_0x2b7d02)['then'](handleEntityNotFound(_0x2e3abc,null))[_0x82d1('0x22')](respondWithResult(_0x2e3abc,null))[_0x82d1('0x3f')](handleError(_0x2e3abc,null));};exports[_0x82d1('0x44')]=function(_0x438a52,_0xe73153){return db[_0x82d1('0x29')]['create'](_0x438a52[_0x82d1('0x45')],{})[_0x82d1('0x22')](respondWithResult(_0xe73153,0xc9))[_0x82d1('0x3f')](handleError(_0xe73153,null));};exports[_0x82d1('0x21')]=function(_0x248579,_0xceae46){if(_0x248579[_0x82d1('0x45')]['id']){delete _0x248579[_0x82d1('0x45')]['id'];}return db[_0x82d1('0x29')][_0x82d1('0x43')]({'where':{'id':_0x248579['params']['id']}})[_0x82d1('0x22')](handleEntityNotFound(_0xceae46,null))[_0x82d1('0x22')](saveUpdates(_0x248579[_0x82d1('0x45')],null))['then'](respondWithResult(_0xceae46,null))[_0x82d1('0x3f')](handleError(_0xceae46,null));};exports[_0x82d1('0x46')]=function(_0x44b9ff,_0xb5b8f7){return db['FreshdeskConfiguration'][_0x82d1('0x43')]({'where':{'id':_0x44b9ff[_0x82d1('0x40')]['id']}})['then'](handleEntityNotFound(_0xb5b8f7,null))[_0x82d1('0x22')](removeEntity(_0xb5b8f7,null))['catch'](handleError(_0xb5b8f7,null));};exports[_0x82d1('0x47')]=function(_0x46b42,_0x236108,_0x27e513){var _0x15817e={};var _0x521d31={};var _0x2b9314;var _0x2c8325;return db[_0x82d1('0x29')][_0x82d1('0x48')]({'where':{'id':_0x46b42[_0x82d1('0x40')]['id']}})[_0x82d1('0x22')](handleEntityNotFound(_0x236108,null))[_0x82d1('0x22')](function(_0x1b984d){if(_0x1b984d){_0x2b9314=_0x1b984d;_0x521d31['model']=_['keys'](db[_0x82d1('0x49')][_0x82d1('0x4a')]);_0x521d31[_0x82d1('0x2e')]=_[_0x82d1('0x41')](_0x46b42[_0x82d1('0x2e')]);_0x521d31[_0x82d1('0x2f')]=_[_0x82d1('0x30')](_0x521d31[_0x82d1('0x2d')],_0x521d31[_0x82d1('0x2e')]);_0x15817e[_0x82d1('0x32')]=_[_0x82d1('0x30')](_0x521d31[_0x82d1('0x2d')],qs[_0x82d1('0x31')](_0x46b42[_0x82d1('0x2e')]['fields']));_0x15817e[_0x82d1('0x32')]=_0x15817e[_0x82d1('0x32')][_0x82d1('0x33')]?_0x15817e[_0x82d1('0x32')]:_0x521d31[_0x82d1('0x2d')];_0x15817e[_0x82d1('0x36')]=qs[_0x82d1('0x37')](_0x46b42[_0x82d1('0x2e')][_0x82d1('0x37')]);_0x15817e[_0x82d1('0x38')]=qs['filters'](_['pick'](_0x46b42['query'],_0x521d31[_0x82d1('0x2f')]));if(_0x46b42[_0x82d1('0x2e')][_0x82d1('0x3a')]){_0x15817e[_0x82d1('0x38')]=_['merge'](_0x15817e[_0x82d1('0x38')],{'$or':_[_0x82d1('0x4b')](_0x15817e[_0x82d1('0x32')],function(_0x249c07){var _0x1ae06f={};_0x1ae06f[_0x249c07]={'$like':'%'+_0x46b42[_0x82d1('0x2e')]['filter']+'%'};return _0x1ae06f;})});}_0x15817e=_[_0x82d1('0x39')]({},_0x15817e,_0x46b42[_0x82d1('0x3b')]);return _0x2b9314['getFields'](_0x15817e);}})[_0x82d1('0x22')](function(_0x44e241){if(_0x44e241){_0x2c8325=_0x44e241[_0x82d1('0x33')];if(!_0x46b42[_0x82d1('0x2e')]['hasOwnProperty'](_0x82d1('0x35'))){_0x15817e[_0x82d1('0x1b')]=qs[_0x82d1('0x1b')](_0x46b42['query'][_0x82d1('0x1b')]);_0x15817e['offset']=qs[_0x82d1('0x19')](_0x46b42[_0x82d1('0x2e')][_0x82d1('0x19')]);}return _0x2b9314[_0x82d1('0x47')](_0x15817e);}})['then'](function(_0x425d9d){if(_0x425d9d){return _0x425d9d?{'count':_0x2c8325,'rows':_0x425d9d}:null;}})['then'](respondWithResult(_0x236108,null))[_0x82d1('0x3f')](handleError(_0x236108,null));};exports[_0x82d1('0x4c')]=function(_0x37fd09,_0x4e30bf,_0x2d8843){var _0x40eb7b={};var _0x3652d8={};var _0x32da5d;var _0x127e03;return db[_0x82d1('0x29')][_0x82d1('0x48')]({'where':{'id':_0x37fd09[_0x82d1('0x40')]['id']}})[_0x82d1('0x22')](handleEntityNotFound(_0x4e30bf,null))[_0x82d1('0x22')](function(_0x42142f){if(_0x42142f){_0x32da5d=_0x42142f;_0x3652d8[_0x82d1('0x2d')]=_['keys'](db[_0x82d1('0x49')][_0x82d1('0x4a')]);_0x3652d8[_0x82d1('0x2e')]=_[_0x82d1('0x41')](_0x37fd09[_0x82d1('0x2e')]);_0x3652d8[_0x82d1('0x2f')]=_['intersection'](_0x3652d8[_0x82d1('0x2d')],_0x3652d8[_0x82d1('0x2e')]);_0x40eb7b[_0x82d1('0x32')]=_[_0x82d1('0x30')](_0x3652d8[_0x82d1('0x2d')],qs[_0x82d1('0x31')](_0x37fd09[_0x82d1('0x2e')][_0x82d1('0x31')]));_0x40eb7b['attributes']=_0x40eb7b[_0x82d1('0x32')][_0x82d1('0x33')]?_0x40eb7b[_0x82d1('0x32')]:_0x3652d8[_0x82d1('0x2d')];_0x40eb7b[_0x82d1('0x36')]=qs[_0x82d1('0x37')](_0x37fd09['query'][_0x82d1('0x37')]);_0x40eb7b['where']=qs[_0x82d1('0x2f')](_[_0x82d1('0x4d')](_0x37fd09[_0x82d1('0x2e')],_0x3652d8[_0x82d1('0x2f')]));if(_0x37fd09[_0x82d1('0x2e')]['filter']){_0x40eb7b[_0x82d1('0x38')]=_[_0x82d1('0x39')](_0x40eb7b[_0x82d1('0x38')],{'$or':_[_0x82d1('0x4b')](_0x40eb7b['attributes'],function(_0x591656){var _0x9b8a68={};_0x9b8a68[_0x591656]={'$like':'%'+_0x37fd09[_0x82d1('0x2e')][_0x82d1('0x3a')]+'%'};return _0x9b8a68;})});}_0x40eb7b=_[_0x82d1('0x39')]({},_0x40eb7b,_0x37fd09[_0x82d1('0x3b')]);return _0x32da5d[_0x82d1('0x4c')](_0x40eb7b);}})['then'](function(_0x393872){if(_0x393872){_0x127e03=_0x393872[_0x82d1('0x33')];if(!_0x37fd09['query'][_0x82d1('0x34')]('nolimit')){_0x40eb7b['limit']=qs['limit'](_0x37fd09[_0x82d1('0x2e')][_0x82d1('0x1b')]);_0x40eb7b['offset']=qs[_0x82d1('0x19')](_0x37fd09[_0x82d1('0x2e')][_0x82d1('0x19')]);}return _0x32da5d[_0x82d1('0x4c')](_0x40eb7b);}})[_0x82d1('0x22')](function(_0x14cced){if(_0x14cced){return _0x14cced?{'count':_0x127e03,'rows':_0x14cced}:null;}})['then'](respondWithResult(_0x4e30bf,null))[_0x82d1('0x3f')](handleError(_0x4e30bf,null));};exports[_0x82d1('0x4e')]=function(_0x3c337f,_0x544ac8,_0x184ccf){var _0x197773={};var _0x5b8379={};var _0x44a6f5;var _0x4066f3;return db[_0x82d1('0x29')][_0x82d1('0x48')]({'where':{'id':_0x3c337f['params']['id']}})[_0x82d1('0x22')](handleEntityNotFound(_0x544ac8,null))[_0x82d1('0x22')](function(_0x2ea3e1){if(_0x2ea3e1){_0x44a6f5=_0x2ea3e1;_0x5b8379[_0x82d1('0x2d')]=_[_0x82d1('0x41')](db[_0x82d1('0x49')][_0x82d1('0x4a')]);_0x5b8379[_0x82d1('0x2e')]=_['keys'](_0x3c337f['query']);_0x5b8379[_0x82d1('0x2f')]=_[_0x82d1('0x30')](_0x5b8379[_0x82d1('0x2d')],_0x5b8379['query']);_0x197773[_0x82d1('0x32')]=_[_0x82d1('0x30')](_0x5b8379[_0x82d1('0x2d')],qs[_0x82d1('0x31')](_0x3c337f[_0x82d1('0x2e')][_0x82d1('0x31')]));_0x197773[_0x82d1('0x32')]=_0x197773[_0x82d1('0x32')][_0x82d1('0x33')]?_0x197773['attributes']:_0x5b8379[_0x82d1('0x2d')];_0x197773[_0x82d1('0x36')]=qs[_0x82d1('0x37')](_0x3c337f[_0x82d1('0x2e')][_0x82d1('0x37')]);_0x197773[_0x82d1('0x38')]=qs['filters'](_[_0x82d1('0x4d')](_0x3c337f[_0x82d1('0x2e')],_0x5b8379['filters']));if(_0x3c337f[_0x82d1('0x2e')][_0x82d1('0x3a')]){_0x197773[_0x82d1('0x38')]=_[_0x82d1('0x39')](_0x197773[_0x82d1('0x38')],{'$or':_[_0x82d1('0x4b')](_0x197773[_0x82d1('0x32')],function(_0x26a2cf){var _0x41a99a={};_0x41a99a[_0x26a2cf]={'$like':'%'+_0x3c337f[_0x82d1('0x2e')][_0x82d1('0x3a')]+'%'};return _0x41a99a;})});}_0x197773=_['merge']({},_0x197773,_0x3c337f[_0x82d1('0x3b')]);return _0x44a6f5['getDescriptions'](_0x197773);}})[_0x82d1('0x22')](function(_0x4dd5d8){if(_0x4dd5d8){_0x4066f3=_0x4dd5d8[_0x82d1('0x33')];if(!_0x3c337f['query'][_0x82d1('0x34')]('nolimit')){_0x197773[_0x82d1('0x1b')]=qs[_0x82d1('0x1b')](_0x3c337f['query'][_0x82d1('0x1b')]);_0x197773[_0x82d1('0x19')]=qs[_0x82d1('0x19')](_0x3c337f['query'][_0x82d1('0x19')]);}return _0x44a6f5['getDescriptions'](_0x197773);}})[_0x82d1('0x22')](function(_0x3fce61){if(_0x3fce61){return _0x3fce61?{'count':_0x4066f3,'rows':_0x3fce61}:null;}})[_0x82d1('0x22')](respondWithResult(_0x544ac8,null))[_0x82d1('0x3f')](handleError(_0x544ac8,null));};exports[_0x82d1('0x4f')]=function(_0x38da4c,_0x531557,_0x1eaba3){var _0x47d150={};var _0x39c925={};var _0x19bd9d;var _0x97b2f6;return db[_0x82d1('0x29')][_0x82d1('0x48')]({'where':{'id':_0x38da4c['params']['id']}})[_0x82d1('0x22')](handleEntityNotFound(_0x531557,null))[_0x82d1('0x22')](function(_0x5d1389){if(_0x5d1389){_0x19bd9d=_0x5d1389;_0x39c925['model']=_[_0x82d1('0x41')](db[_0x82d1('0x50')]['rawAttributes']);_0x39c925['query']=_[_0x82d1('0x41')](_0x38da4c[_0x82d1('0x2e')]);_0x39c925[_0x82d1('0x2f')]=_[_0x82d1('0x30')](_0x39c925[_0x82d1('0x2d')],_0x39c925[_0x82d1('0x2e')]);_0x47d150['attributes']=_[_0x82d1('0x30')](_0x39c925[_0x82d1('0x2d')],qs[_0x82d1('0x31')](_0x38da4c[_0x82d1('0x2e')][_0x82d1('0x31')]));_0x47d150['attributes']=_0x47d150[_0x82d1('0x32')][_0x82d1('0x33')]?_0x47d150[_0x82d1('0x32')]:_0x39c925[_0x82d1('0x2d')];_0x47d150['order']=qs[_0x82d1('0x37')](_0x38da4c['query'][_0x82d1('0x37')]);_0x47d150['where']=qs[_0x82d1('0x2f')](_[_0x82d1('0x4d')](_0x38da4c['query'],_0x39c925['filters']));if(_0x38da4c[_0x82d1('0x2e')][_0x82d1('0x3a')]){_0x47d150[_0x82d1('0x38')]=_[_0x82d1('0x39')](_0x47d150[_0x82d1('0x38')],{'$or':_[_0x82d1('0x4b')](_0x47d150[_0x82d1('0x32')],function(_0x16a43e){var _0x2813a8={};_0x2813a8[_0x16a43e]={'$like':'%'+_0x38da4c['query'][_0x82d1('0x3a')]+'%'};return _0x2813a8;})});}_0x47d150=_[_0x82d1('0x39')]({},_0x47d150,_0x38da4c[_0x82d1('0x3b')]);return _0x19bd9d[_0x82d1('0x4f')](_0x47d150);}})['then'](function(_0x1c9b16){if(_0x1c9b16){_0x97b2f6=_0x1c9b16[_0x82d1('0x33')];if(!_0x38da4c[_0x82d1('0x2e')][_0x82d1('0x34')](_0x82d1('0x35'))){_0x47d150['limit']=qs[_0x82d1('0x1b')](_0x38da4c[_0x82d1('0x2e')][_0x82d1('0x1b')]);_0x47d150[_0x82d1('0x19')]=qs['offset'](_0x38da4c[_0x82d1('0x2e')][_0x82d1('0x19')]);}return _0x19bd9d['getTags'](_0x47d150);}})[_0x82d1('0x22')](function(_0x83f030){if(_0x83f030){return _0x83f030?{'count':_0x97b2f6,'rows':_0x83f030}:null;}})[_0x82d1('0x22')](respondWithResult(_0x531557,null))[_0x82d1('0x3f')](handleError(_0x531557,null));};exports[_0x82d1('0x51')]=function(_0x30c1e0,_0x109de2,_0x170ade){if(_0x30c1e0[_0x82d1('0x45')]['id']){delete _0x30c1e0[_0x82d1('0x45')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x30c1e0[_0x82d1('0x40')]['id']}})[_0x82d1('0x22')](handleEntityNotFound(_0x109de2,null))[_0x82d1('0x22')](function(_0x3e3727){if(_0x3e3727){return _0x3e3727['setTags'](_0x30c1e0['body'][_0x82d1('0x52')]||[]);}return null;})[_0x82d1('0x22')](respondWithResult(_0x109de2,null))[_0x82d1('0x3f')](handleError(_0x109de2,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 964f590..bfad04c 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 _0x9237=['FreshdeskConfiguration','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x10b6c6,_0x55a02e){var _0x53024a=function(_0xd914b7){while(--_0xd914b7){_0x10b6c6['push'](_0x10b6c6['shift']());}};_0x53024a(++_0x55a02e);}(_0x9237,0x17d));var _0x7923=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x9237[_0x220dbb];return _0x2b77de;};'use strict';var _=require('lodash');var util=require(_0x7923('0x0'));var logger=require('../../config/logger')(_0x7923('0x1'));var moment=require(_0x7923('0x2'));var BPromise=require(_0x7923('0x3'));var rp=require(_0x7923('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7923('0x5'));var config=require(_0x7923('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x7923('0x7')]=function(_0x25fe4b,_0x160fb7){return _0x25fe4b[_0x7923('0x8')](_0x7923('0x9'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1a5=['int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x14e201,_0x31e6d7){var _0x1f0fa0=function(_0x1a7da9){while(--_0x1a7da9){_0x14e201['push'](_0x14e201['shift']());}};_0x1f0fa0(++_0x31e6d7);}(_0xf1a5,0x151));var _0x5f1a=function(_0x18f88b,_0x18f637){_0x18f88b=_0x18f88b-0x0;var _0x3512bd=_0xf1a5[_0x18f88b];return _0x3512bd;};'use strict';var _=require(_0x5f1a('0x0'));var util=require('util');var logger=require(_0x5f1a('0x1'))(_0x5f1a('0x2'));var moment=require(_0x5f1a('0x3'));var BPromise=require(_0x5f1a('0x4'));var rp=require(_0x5f1a('0x5'));var fs=require('fs');var path=require(_0x5f1a('0x6'));var rimraf=require('rimraf');var config=require(_0x5f1a('0x7'));var attributes=require(_0x5f1a('0x8'));module[_0x5f1a('0x9')]=function(_0x40f1b9,_0x4c2abe){return _0x40f1b9[_0x5f1a('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0x5f1a('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 c2f7cd3..431d441 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 _0x1097=['jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x5a5969,_0x5709e3){var _0x5ea525=function(_0x4cb5dc){while(--_0x4cb5dc){_0x5a5969['push'](_0x5a5969['shift']());}};_0x5ea525(++_0x5709e3);}(_0x1097,0x151));var _0x7109=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x1097[_0x1b6186];return _0x186121;};'use strict';var _=require(_0x7109('0x0'));var util=require('util');var moment=require(_0x7109('0x1'));var BPromise=require(_0x7109('0x2'));var rs=require(_0x7109('0x3'));var fs=require('fs');var Redis=require(_0x7109('0x4'));var db=require(_0x7109('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7109('0x6'))('rpc');var config=require(_0x7109('0x7'));var jayson=require(_0x7109('0x8'));var client=jayson[_0x7109('0x9')][_0x7109('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x254dcb,_0x59908c,_0x22a6ee){return new BPromise(function(_0x39da29,_0x12f2d2){return client[_0x7109('0xb')](_0x254dcb,_0x22a6ee)[_0x7109('0xc')](function(_0x446282){logger[_0x7109('0xd')](_0x7109('0xe'),_0x59908c,'request\x20sent');logger[_0x7109('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x59908c,'request\x20sent',JSON[_0x7109('0x10')](_0x446282));if(_0x446282[_0x7109('0x11')]){if(_0x446282[_0x7109('0x11')][_0x7109('0x12')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x59908c,_0x446282[_0x7109('0x11')][_0x7109('0x13')]);return _0x12f2d2(_0x446282[_0x7109('0x11')][_0x7109('0x13')]);}logger[_0x7109('0x11')](_0x7109('0xe'),_0x59908c,_0x446282[_0x7109('0x11')][_0x7109('0x13')]);return _0x39da29(_0x446282[_0x7109('0x11')]['message']);}else{logger[_0x7109('0xd')](_0x7109('0xe'),_0x59908c,_0x7109('0x14'));_0x39da29(_0x446282[_0x7109('0x15')]['message']);}})[_0x7109('0x16')](function(_0x5bfb6a){logger[_0x7109('0x11')](_0x7109('0xe'),_0x59908c,_0x5bfb6a);_0x12f2d2(_0x5bfb6a);});});} \ No newline at end of file +var _0xc7a2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0xc027db,_0x1ee3c8){var _0x1a2189=function(_0x1c4c83){while(--_0x1c4c83){_0xc027db['push'](_0xc027db['shift']());}};_0x1a2189(++_0x1ee3c8);}(_0xc7a2,0x106));var _0x2c7a=function(_0x5ec09b,_0x12d654){_0x5ec09b=_0x5ec09b-0x0;var _0x5a8482=_0xc7a2[_0x5ec09b];return _0x5a8482;};'use strict';var _=require(_0x2c7a('0x0'));var util=require(_0x2c7a('0x1'));var moment=require('moment');var BPromise=require(_0x2c7a('0x2'));var rs=require(_0x2c7a('0x3'));var fs=require('fs');var Redis=require(_0x2c7a('0x4'));var db=require(_0x2c7a('0x5'))['db'];var utils=require(_0x2c7a('0x6'));var logger=require(_0x2c7a('0x7'))(_0x2c7a('0x8'));var config=require(_0x2c7a('0x9'));var jayson=require(_0x2c7a('0xa'));var client=jayson['client'][_0x2c7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d3589,_0x63a461,_0x36ce38){return new BPromise(function(_0x39e019,_0x5b2bbd){return client['request'](_0x3d3589,_0x36ce38)[_0x2c7a('0xc')](function(_0x49fbc3){logger[_0x2c7a('0xd')](_0x2c7a('0xe'),_0x63a461,_0x2c7a('0xf'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x63a461,_0x2c7a('0xf'),JSON[_0x2c7a('0x10')](_0x49fbc3));if(_0x49fbc3[_0x2c7a('0x11')]){if(_0x49fbc3[_0x2c7a('0x11')][_0x2c7a('0x12')]===0x1f4){logger['error'](_0x2c7a('0xe'),_0x63a461,_0x49fbc3[_0x2c7a('0x11')][_0x2c7a('0x13')]);return _0x5b2bbd(_0x49fbc3['error'][_0x2c7a('0x13')]);}logger[_0x2c7a('0x11')](_0x2c7a('0xe'),_0x63a461,_0x49fbc3[_0x2c7a('0x11')][_0x2c7a('0x13')]);return _0x39e019(_0x49fbc3['error'][_0x2c7a('0x13')]);}else{logger[_0x2c7a('0xd')](_0x2c7a('0xe'),_0x63a461,_0x2c7a('0xf'));_0x39e019(_0x49fbc3[_0x2c7a('0x14')][_0x2c7a('0x13')]);}})[_0x2c7a('0x15')](function(_0x3dcef8){logger[_0x2c7a('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x63a461,_0x3dcef8);_0x5b2bbd(_0x3dcef8);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 648608e..65f8bce 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 _0xc3e1=['index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get'];(function(_0x55288a,_0x4089b5){var _0x20802d=function(_0x5d2c2a){while(--_0x5d2c2a){_0x55288a['push'](_0x55288a['shift']());}};_0x20802d(++_0x4089b5);}(_0xc3e1,0x64));var _0x1c3e=function(_0x126274,_0x2c1027){_0x126274=_0x126274-0x0;var _0x29aab5=_0xc3e1[_0x126274];return _0x29aab5;};'use strict';var multer=require('multer');var util=require(_0x1c3e('0x0'));var path=require('path');var timeout=require(_0x1c3e('0x1'));var express=require(_0x1c3e('0x2'));var router=express['Router']();var fs_extra=require(_0x1c3e('0x3'));var auth=require(_0x1c3e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1c3e('0x5'));var controller=require(_0x1c3e('0x6'));router[_0x1c3e('0x7')]('/',auth['isAuthenticated'](),controller[_0x1c3e('0x8')]);router[_0x1c3e('0x7')](_0x1c3e('0x9'),auth['isAuthenticated'](),controller[_0x1c3e('0xa')]);router[_0x1c3e('0xb')]('/',auth[_0x1c3e('0xc')](),controller[_0x1c3e('0xd')]);router[_0x1c3e('0xe')](_0x1c3e('0x9'),auth[_0x1c3e('0xc')](),controller[_0x1c3e('0xf')]);router[_0x1c3e('0x10')]('/:id',auth[_0x1c3e('0xc')](),controller[_0x1c3e('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf1a8=['index','/:id','post','create','put','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x3a54c1,_0x1b19a7){var _0x532e71=function(_0x232423){while(--_0x232423){_0x3a54c1['push'](_0x3a54c1['shift']());}};_0x532e71(++_0x1b19a7);}(_0xf1a8,0x181));var _0x8f1a=function(_0x4a5d14,_0x1c8043){_0x4a5d14=_0x4a5d14-0x0;var _0x9e05e7=_0xf1a8[_0x4a5d14];return _0x9e05e7;};'use strict';var multer=require(_0x8f1a('0x0'));var util=require(_0x8f1a('0x1'));var path=require(_0x8f1a('0x2'));var timeout=require(_0x8f1a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8f1a('0x4'));var auth=require(_0x8f1a('0x5'));var interaction=require(_0x8f1a('0x6'));var config=require(_0x8f1a('0x7'));var controller=require(_0x8f1a('0x8'));router[_0x8f1a('0x9')]('/',auth[_0x8f1a('0xa')](),controller[_0x8f1a('0xb')]);router[_0x8f1a('0x9')](_0x8f1a('0xc'),auth[_0x8f1a('0xa')](),controller['show']);router[_0x8f1a('0xd')]('/',auth['isAuthenticated'](),controller[_0x8f1a('0xe')]);router[_0x8f1a('0xf')](_0x8f1a('0xc'),auth[_0x8f1a('0xa')](),controller['update']);router['delete'](_0x8f1a('0xc'),auth['isAuthenticated'](),controller[_0x8f1a('0x10')]);module[_0x8f1a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 44e3740..ebed05c 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 _0x93ad=['customVariable','BOOLEAN','exports','ENUM','string','variable','keyValue','STRING'];(function(_0x258b93,_0x188ccc){var _0x35484b=function(_0x2563ea){while(--_0x2563ea){_0x258b93['push'](_0x258b93['shift']());}};_0x35484b(++_0x188ccc);}(_0x93ad,0x1b2));var _0xd93a=function(_0x5538a4,_0xe0b8b0){_0x5538a4=_0x5538a4-0x0;var _0x530a52=_0x93ad[_0x5538a4];return _0x530a52;};'use strict';var Sequelize=require('sequelize');module[_0xd93a('0x0')]={'type':{'type':Sequelize[_0xd93a('0x1')](_0xd93a('0x2'),_0xd93a('0x3'),'customVariable',_0xd93a('0x4'),'picklist'),'defaultValue':_0xd93a('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd93a('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xd93a('0x3'),_0xd93a('0x6'))},'keyContent':{'type':Sequelize[_0xd93a('0x5')]},'idField':{'type':Sequelize[_0xd93a('0x5')]},'nameField':{'type':Sequelize[_0xd93a('0x5')]},'customField':{'type':Sequelize[_0xd93a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd93a('0x5')]}}; \ No newline at end of file +var _0x9cf2=['STRING','sequelize','exports','ENUM','variable','keyValue','picklist','string'];(function(_0x388f8b,_0x1435d3){var _0x1a1fc7=function(_0x1f2c31){while(--_0x1f2c31){_0x388f8b['push'](_0x388f8b['shift']());}};_0x1a1fc7(++_0x1435d3);}(_0x9cf2,0x169));var _0x29cf=function(_0x363370,_0x219c1e){_0x363370=_0x363370-0x0;var _0x30ec47=_0x9cf2[_0x363370];return _0x30ec47;};'use strict';var Sequelize=require(_0x29cf('0x0'));module[_0x29cf('0x1')]={'type':{'type':Sequelize[_0x29cf('0x2')]('string',_0x29cf('0x3'),'customVariable',_0x29cf('0x4'),_0x29cf('0x5')),'defaultValue':_0x29cf('0x6')},'content':{'type':Sequelize[_0x29cf('0x7')]},'key':{'type':Sequelize[_0x29cf('0x7')]},'keyType':{'type':Sequelize[_0x29cf('0x2')](_0x29cf('0x6'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x29cf('0x7')]},'idField':{'type':Sequelize[_0x29cf('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x29cf('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e02d77d..9eab689 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 _0x57f8=['query','intersection','attributes','fields','hasOwnProperty','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','keys'];(function(_0x4360c4,_0x2f8209){var _0x3168c8=function(_0x309523){while(--_0x309523){_0x4360c4['push'](_0x4360c4['shift']());}};_0x3168c8(++_0x2f8209);}(_0x57f8,0x198));var _0x857f=function(_0x3a42fa,_0x55e471){_0x3a42fa=_0x3a42fa-0x0;var _0x30dcba=_0x57f8[_0x3a42fa];return _0x30dcba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x857f('0x0'));var zipdir=require(_0x857f('0x1'));var jsonpatch=require(_0x857f('0x2'));var rp=require(_0x857f('0x3'));var moment=require(_0x857f('0x4'));var BPromise=require(_0x857f('0x5'));var Mustache=require(_0x857f('0x6'));var util=require(_0x857f('0x7'));var path=require(_0x857f('0x8'));var sox=require(_0x857f('0x9'));var csv=require(_0x857f('0xa'));var ejs=require(_0x857f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x857f('0xc'));var squel=require(_0x857f('0xd'));var crypto=require(_0x857f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x857f('0xf'));var toCsv=require(_0x857f('0xa'));var querystring=require(_0x857f('0x10'));var Papa=require('papaparse');var Redis=require(_0x857f('0x11'));var authService=require(_0x857f('0x12'));var qs=require(_0x857f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x857f('0x14'));var logger=require(_0x857f('0x15'))(_0x857f('0x16'));var utils=require(_0x857f('0x17'));var config=require(_0x857f('0x18'));var licenseUtil=require(_0x857f('0x19'));var db=require(_0x857f('0x1a'))['db'];function respondWithStatusCode(_0x533631,_0x2e1eda){_0x2e1eda=_0x2e1eda||0xcc;return function(_0x2d5e26){if(_0x2d5e26){return _0x533631[_0x857f('0x1b')](_0x2e1eda);}return _0x533631[_0x857f('0x1c')](_0x2e1eda)[_0x857f('0x1d')]();};}function respondWithResult(_0x4a25ec,_0x4bc590){_0x4bc590=_0x4bc590||0xc8;return function(_0x3b09d9){if(_0x3b09d9){return _0x4a25ec['status'](_0x4bc590)[_0x857f('0x1e')](_0x3b09d9);}};}function respondWithFilteredResult(_0x4ac81f,_0x1d47bf){return function(_0x134a4f){if(_0x134a4f){var _0x5c3a69=typeof _0x1d47bf[_0x857f('0x1f')]===_0x857f('0x20')&&typeof _0x1d47bf[_0x857f('0x21')]===_0x857f('0x20');var _0x279e74=_0x134a4f[_0x857f('0x22')];var _0x1a9ef8=_0x5c3a69?0x0:_0x1d47bf[_0x857f('0x1f')];var _0x1014ca=_0x5c3a69?_0x134a4f[_0x857f('0x22')]:_0x1d47bf[_0x857f('0x1f')]+_0x1d47bf['limit'];var _0x1729d8;if(_0x1014ca>=_0x279e74){_0x1014ca=_0x279e74;_0x1729d8=0xc8;}else{_0x1729d8=0xce;}_0x4ac81f[_0x857f('0x1c')](_0x1729d8);return _0x4ac81f['set'](_0x857f('0x23'),_0x1a9ef8+'-'+_0x1014ca+'/'+_0x279e74)[_0x857f('0x1e')](_0x134a4f);}return null;};}function patchUpdates(_0x377587){return function(_0x484035){try{jsonpatch['apply'](_0x484035,_0x377587,!![]);}catch(_0x12ee77){return BPromise[_0x857f('0x24')](_0x12ee77);}return _0x484035[_0x857f('0x25')]();};}function saveUpdates(_0x4fa031,_0x118237){return function(_0x17a98e){if(_0x17a98e){return _0x17a98e[_0x857f('0x26')](_0x4fa031)['then'](function(_0x1961ea){return _0x1961ea;});}return null;};}function removeEntity(_0x14a8ce,_0x50bfb7){return function(_0x3bc543){if(_0x3bc543){return _0x3bc543[_0x857f('0x27')]()[_0x857f('0x28')](function(){_0x14a8ce[_0x857f('0x1c')](0xcc)[_0x857f('0x1d')]();});}};}function handleEntityNotFound(_0x3b23a7,_0x233a68){return function(_0x2a89ba){if(!_0x2a89ba){_0x3b23a7[_0x857f('0x1b')](0x194);}return _0x2a89ba;};}function handleError(_0xcd1ee9,_0x72f0aa){_0x72f0aa=_0x72f0aa||0x1f4;return function(_0x4782ab){logger[_0x857f('0x29')](_0x4782ab[_0x857f('0x2a')]);if(_0x4782ab['name']){delete _0x4782ab[_0x857f('0x2b')];}_0xcd1ee9[_0x857f('0x1c')](_0x72f0aa)[_0x857f('0x2c')](_0x4782ab);};}exports[_0x857f('0x2d')]=function(_0x58c2de,_0x40c306){var _0x57ceaa={},_0x1b405a={},_0x234048={'count':0x0,'rows':[]};var _0x45a37f=_[_0x857f('0x2e')](db[_0x857f('0x2f')][_0x857f('0x30')],function(_0x1c4fff){return{'name':_0x1c4fff[_0x857f('0x31')],'type':_0x1c4fff[_0x857f('0x32')][_0x857f('0x33')]};});_0x1b405a[_0x857f('0x34')]=_[_0x857f('0x2e')](_0x45a37f,_0x857f('0x2b'));_0x1b405a['query']=_[_0x857f('0x35')](_0x58c2de[_0x857f('0x36')]);_0x1b405a['filters']=_[_0x857f('0x37')](_0x1b405a[_0x857f('0x34')],_0x1b405a['query']);_0x57ceaa[_0x857f('0x38')]=_[_0x857f('0x37')](_0x1b405a['model'],qs[_0x857f('0x39')](_0x58c2de[_0x857f('0x36')][_0x857f('0x39')]));_0x57ceaa[_0x857f('0x38')]=_0x57ceaa['attributes']['length']?_0x57ceaa[_0x857f('0x38')]:_0x1b405a[_0x857f('0x34')];if(!_0x58c2de['query'][_0x857f('0x3a')]('nolimit')){_0x57ceaa[_0x857f('0x21')]=qs[_0x857f('0x21')](_0x58c2de[_0x857f('0x36')][_0x857f('0x21')]);_0x57ceaa[_0x857f('0x1f')]=qs['offset'](_0x58c2de['query'][_0x857f('0x1f')]);}_0x57ceaa['order']=qs[_0x857f('0x3b')](_0x58c2de[_0x857f('0x36')][_0x857f('0x3b')]);_0x57ceaa['where']=qs[_0x857f('0x3c')](_[_0x857f('0x3d')](_0x58c2de[_0x857f('0x36')],_0x1b405a[_0x857f('0x3c')]),_0x45a37f);if(_0x58c2de[_0x857f('0x36')][_0x857f('0x3e')]){_0x57ceaa[_0x857f('0x3f')]=_['merge'](_0x57ceaa[_0x857f('0x3f')],{'$or':_[_0x857f('0x2e')](_0x45a37f,function(_0x1f285c){if(_0x1f285c[_0x857f('0x32')]!==_0x857f('0x40')){var _0x2356fb={};_0x2356fb[_0x1f285c[_0x857f('0x2b')]]={'$like':'%'+_0x58c2de['query'][_0x857f('0x3e')]+'%'};return _0x2356fb;}})});}_0x57ceaa=_[_0x857f('0x41')]({},_0x57ceaa,_0x58c2de[_0x857f('0x42')]);var _0xc2ac41={'where':_0x57ceaa[_0x857f('0x3f')]};return db[_0x857f('0x2f')]['count'](_0xc2ac41)[_0x857f('0x28')](function(_0x354678){_0x234048[_0x857f('0x22')]=_0x354678;if(_0x58c2de[_0x857f('0x36')][_0x857f('0x43')]){_0x57ceaa[_0x857f('0x44')]=[{'all':!![]}];}return db[_0x857f('0x2f')][_0x857f('0x45')](_0x57ceaa);})['then'](function(_0x40fb37){_0x234048[_0x857f('0x46')]=_0x40fb37;return _0x234048;})[_0x857f('0x28')](respondWithFilteredResult(_0x40c306,_0x57ceaa))[_0x857f('0x47')](handleError(_0x40c306,null));};exports[_0x857f('0x48')]=function(_0x1bbf9f,_0x374b9f){var _0x42d922={'raw':!![],'where':{'id':_0x1bbf9f[_0x857f('0x49')]['id']}},_0xb4d7c2={};_0xb4d7c2[_0x857f('0x34')]=_[_0x857f('0x35')](db[_0x857f('0x2f')][_0x857f('0x30')]);_0xb4d7c2['query']=_[_0x857f('0x35')](_0x1bbf9f['query']);_0xb4d7c2[_0x857f('0x3c')]=_[_0x857f('0x37')](_0xb4d7c2[_0x857f('0x34')],_0xb4d7c2[_0x857f('0x36')]);_0x42d922[_0x857f('0x38')]=_[_0x857f('0x37')](_0xb4d7c2[_0x857f('0x34')],qs[_0x857f('0x39')](_0x1bbf9f[_0x857f('0x36')][_0x857f('0x39')]));_0x42d922[_0x857f('0x38')]=_0x42d922['attributes']['length']?_0x42d922[_0x857f('0x38')]:_0xb4d7c2['model'];if(_0x1bbf9f[_0x857f('0x36')]['includeAll']){_0x42d922[_0x857f('0x44')]=[{'all':!![]}];}_0x42d922=_[_0x857f('0x41')]({},_0x42d922,_0x1bbf9f[_0x857f('0x42')]);return db[_0x857f('0x2f')][_0x857f('0x4a')](_0x42d922)[_0x857f('0x28')](handleEntityNotFound(_0x374b9f,null))[_0x857f('0x28')](respondWithResult(_0x374b9f,null))[_0x857f('0x47')](handleError(_0x374b9f,null));};exports['create']=function(_0x42cf05,_0x3b431d){return db[_0x857f('0x2f')][_0x857f('0x4b')](_0x42cf05['body'],{})[_0x857f('0x28')](respondWithResult(_0x3b431d,0xc9))[_0x857f('0x47')](handleError(_0x3b431d,null));};exports[_0x857f('0x26')]=function(_0x736ef6,_0x67563){if(_0x736ef6['body']['id']){delete _0x736ef6[_0x857f('0x4c')]['id'];}return db[_0x857f('0x2f')]['find']({'where':{'id':_0x736ef6[_0x857f('0x49')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x67563,null))['then'](saveUpdates(_0x736ef6[_0x857f('0x4c')],null))['then'](respondWithResult(_0x67563,null))[_0x857f('0x47')](handleError(_0x67563,null));};exports[_0x857f('0x27')]=function(_0x446fe9,_0x2008d5){return db[_0x857f('0x2f')][_0x857f('0x4a')]({'where':{'id':_0x446fe9[_0x857f('0x49')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x2008d5,null))[_0x857f('0x28')](removeEntity(_0x2008d5,null))[_0x857f('0x47')](handleError(_0x2008d5,null));}; \ No newline at end of file +var _0x422f=['update','destroy','then','error','stack','name','map','FreshdeskField','fieldName','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','type','VIRTUAL','findAll','rows','show','params','rawAttributes','length','includeAll','include','merge','options','find','body','catch','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x422f,0x1c7));var _0xf422=function(_0xb012e3,_0x33b165){_0xb012e3=_0xb012e3-0x0;var _0x195c7e=_0x422f[_0xb012e3];return _0x195c7e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf422('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf422('0x1'));var rp=require(_0xf422('0x2'));var moment=require('moment');var BPromise=require(_0xf422('0x3'));var Mustache=require(_0xf422('0x4'));var util=require(_0xf422('0x5'));var path=require(_0xf422('0x6'));var sox=require(_0xf422('0x7'));var csv=require(_0xf422('0x8'));var ejs=require(_0xf422('0x9'));var fs=require('fs');var fs_extra=require(_0xf422('0xa'));var _=require(_0xf422('0xb'));var squel=require('squel');var crypto=require(_0xf422('0xc'));var jsforce=require(_0xf422('0xd'));var deskjs=require(_0xf422('0xe'));var toCsv=require(_0xf422('0x8'));var querystring=require(_0xf422('0xf'));var Papa=require('papaparse');var Redis=require(_0xf422('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf422('0x11'));var hardwareService=require(_0xf422('0x12'));var logger=require(_0xf422('0x13'))(_0xf422('0x14'));var utils=require(_0xf422('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf422('0x16'));var db=require(_0xf422('0x17'))['db'];function respondWithStatusCode(_0x4d56d1,_0x133a6a){_0x133a6a=_0x133a6a||0xcc;return function(_0x8aa9cc){if(_0x8aa9cc){return _0x4d56d1[_0xf422('0x18')](_0x133a6a);}return _0x4d56d1[_0xf422('0x19')](_0x133a6a)[_0xf422('0x1a')]();};}function respondWithResult(_0x28a6a8,_0x223b21){_0x223b21=_0x223b21||0xc8;return function(_0x272430){if(_0x272430){return _0x28a6a8[_0xf422('0x19')](_0x223b21)['json'](_0x272430);}};}function respondWithFilteredResult(_0x54bb9c,_0x52f96b){return function(_0x1c81e1){if(_0x1c81e1){var _0x30b70a=typeof _0x52f96b[_0xf422('0x1b')]===_0xf422('0x1c')&&typeof _0x52f96b['limit']===_0xf422('0x1c');var _0x264964=_0x1c81e1[_0xf422('0x1d')];var _0x2ae133=_0x30b70a?0x0:_0x52f96b[_0xf422('0x1b')];var _0x29b0b1=_0x30b70a?_0x1c81e1['count']:_0x52f96b['offset']+_0x52f96b[_0xf422('0x1e')];var _0x4b657;if(_0x29b0b1>=_0x264964){_0x29b0b1=_0x264964;_0x4b657=0xc8;}else{_0x4b657=0xce;}_0x54bb9c[_0xf422('0x19')](_0x4b657);return _0x54bb9c['set'](_0xf422('0x1f'),_0x2ae133+'-'+_0x29b0b1+'/'+_0x264964)['json'](_0x1c81e1);}return null;};}function patchUpdates(_0x22afe7){return function(_0x15833b){try{jsonpatch[_0xf422('0x20')](_0x15833b,_0x22afe7,!![]);}catch(_0x4d6717){return BPromise[_0xf422('0x21')](_0x4d6717);}return _0x15833b[_0xf422('0x22')]();};}function saveUpdates(_0x511529,_0x4b80a0){return function(_0x268575){if(_0x268575){return _0x268575[_0xf422('0x23')](_0x511529)['then'](function(_0x25b6a5){return _0x25b6a5;});}return null;};}function removeEntity(_0x570ea2,_0x3b21a5){return function(_0x32ceee){if(_0x32ceee){return _0x32ceee[_0xf422('0x24')]()[_0xf422('0x25')](function(){_0x570ea2[_0xf422('0x19')](0xcc)[_0xf422('0x1a')]();});}};}function handleEntityNotFound(_0xd8d70f,_0x11d10b){return function(_0x5dcab4){if(!_0x5dcab4){_0xd8d70f[_0xf422('0x18')](0x194);}return _0x5dcab4;};}function handleError(_0x59d03d,_0x2f0f9f){_0x2f0f9f=_0x2f0f9f||0x1f4;return function(_0x7d36e7){logger[_0xf422('0x26')](_0x7d36e7[_0xf422('0x27')]);if(_0x7d36e7[_0xf422('0x28')]){delete _0x7d36e7[_0xf422('0x28')];}_0x59d03d[_0xf422('0x19')](_0x2f0f9f)['send'](_0x7d36e7);};}exports['index']=function(_0x35d1fa,_0x10d51b){var _0x266fb8={},_0x33ef63={},_0xefb99e={'count':0x0,'rows':[]};var _0x48e0c7=_[_0xf422('0x29')](db[_0xf422('0x2a')]['rawAttributes'],function(_0x5f0186){return{'name':_0x5f0186[_0xf422('0x2b')],'type':_0x5f0186['type']['key']};});_0x33ef63[_0xf422('0x2c')]=_[_0xf422('0x29')](_0x48e0c7,'name');_0x33ef63[_0xf422('0x2d')]=_[_0xf422('0x2e')](_0x35d1fa[_0xf422('0x2d')]);_0x33ef63[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x33ef63['model'],_0x33ef63[_0xf422('0x2d')]);_0x266fb8['attributes']=_[_0xf422('0x30')](_0x33ef63[_0xf422('0x2c')],qs[_0xf422('0x31')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x31')]));_0x266fb8[_0xf422('0x32')]=_0x266fb8[_0xf422('0x32')]['length']?_0x266fb8['attributes']:_0x33ef63[_0xf422('0x2c')];if(!_0x35d1fa[_0xf422('0x2d')]['hasOwnProperty'](_0xf422('0x33'))){_0x266fb8[_0xf422('0x1e')]=qs[_0xf422('0x1e')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x1e')]);_0x266fb8[_0xf422('0x1b')]=qs[_0xf422('0x1b')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x1b')]);}_0x266fb8[_0xf422('0x34')]=qs[_0xf422('0x35')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x35')]);_0x266fb8[_0xf422('0x36')]=qs['filters'](_['pick'](_0x35d1fa['query'],_0x33ef63[_0xf422('0x2f')]),_0x48e0c7);if(_0x35d1fa[_0xf422('0x2d')]['filter']){_0x266fb8[_0xf422('0x36')]=_['merge'](_0x266fb8[_0xf422('0x36')],{'$or':_[_0xf422('0x29')](_0x48e0c7,function(_0x55ac68){if(_0x55ac68[_0xf422('0x37')]!==_0xf422('0x38')){var _0x174f6f={};_0x174f6f[_0x55ac68['name']]={'$like':'%'+_0x35d1fa[_0xf422('0x2d')]['filter']+'%'};return _0x174f6f;}})});}_0x266fb8=_['merge']({},_0x266fb8,_0x35d1fa['options']);var _0x112bce={'where':_0x266fb8[_0xf422('0x36')]};return db[_0xf422('0x2a')][_0xf422('0x1d')](_0x112bce)[_0xf422('0x25')](function(_0x2f82a0){_0xefb99e[_0xf422('0x1d')]=_0x2f82a0;if(_0x35d1fa[_0xf422('0x2d')]['includeAll']){_0x266fb8['include']=[{'all':!![]}];}return db[_0xf422('0x2a')][_0xf422('0x39')](_0x266fb8);})[_0xf422('0x25')](function(_0xb3955){_0xefb99e[_0xf422('0x3a')]=_0xb3955;return _0xefb99e;})[_0xf422('0x25')](respondWithFilteredResult(_0x10d51b,_0x266fb8))['catch'](handleError(_0x10d51b,null));};exports[_0xf422('0x3b')]=function(_0x4f453a,_0x17c1f2){var _0x391e3c={'raw':!![],'where':{'id':_0x4f453a[_0xf422('0x3c')]['id']}},_0x564041={};_0x564041[_0xf422('0x2c')]=_[_0xf422('0x2e')](db[_0xf422('0x2a')][_0xf422('0x3d')]);_0x564041['query']=_[_0xf422('0x2e')](_0x4f453a[_0xf422('0x2d')]);_0x564041[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x564041[_0xf422('0x2c')],_0x564041['query']);_0x391e3c[_0xf422('0x32')]=_[_0xf422('0x30')](_0x564041['model'],qs[_0xf422('0x31')](_0x4f453a['query'][_0xf422('0x31')]));_0x391e3c[_0xf422('0x32')]=_0x391e3c[_0xf422('0x32')][_0xf422('0x3e')]?_0x391e3c[_0xf422('0x32')]:_0x564041[_0xf422('0x2c')];if(_0x4f453a[_0xf422('0x2d')][_0xf422('0x3f')]){_0x391e3c[_0xf422('0x40')]=[{'all':!![]}];}_0x391e3c=_[_0xf422('0x41')]({},_0x391e3c,_0x4f453a[_0xf422('0x42')]);return db[_0xf422('0x2a')][_0xf422('0x43')](_0x391e3c)[_0xf422('0x25')](handleEntityNotFound(_0x17c1f2,null))[_0xf422('0x25')](respondWithResult(_0x17c1f2,null))['catch'](handleError(_0x17c1f2,null));};exports['create']=function(_0x3c59dd,_0x2c2ce9){return db[_0xf422('0x2a')]['create'](_0x3c59dd[_0xf422('0x44')],{})[_0xf422('0x25')](respondWithResult(_0x2c2ce9,0xc9))[_0xf422('0x45')](handleError(_0x2c2ce9,null));};exports[_0xf422('0x23')]=function(_0x1f3a30,_0x259e24){if(_0x1f3a30[_0xf422('0x44')]['id']){delete _0x1f3a30['body']['id'];}return db[_0xf422('0x2a')]['find']({'where':{'id':_0x1f3a30[_0xf422('0x3c')]['id']}})[_0xf422('0x25')](handleEntityNotFound(_0x259e24,null))['then'](saveUpdates(_0x1f3a30[_0xf422('0x44')],null))[_0xf422('0x25')](respondWithResult(_0x259e24,null))[_0xf422('0x45')](handleError(_0x259e24,null));};exports[_0xf422('0x24')]=function(_0x2df71a,_0x5c3cb8){return db['FreshdeskField'][_0xf422('0x43')]({'where':{'id':_0x2df71a['params']['id']}})[_0xf422('0x25')](handleEntityNotFound(_0x5c3cb8,null))[_0xf422('0x25')](removeEntity(_0x5c3cb8,null))[_0xf422('0x45')](handleError(_0x5c3cb8,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 033bd6e..c3f60f3 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 _0x9e7c=['exports','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x300a31,_0x4df078){var _0x52b562=function(_0x5454bd){while(--_0x5454bd){_0x300a31['push'](_0x300a31['shift']());}};_0x52b562(++_0x4df078);}(_0x9e7c,0xc6));var _0xc9e7=function(_0x2ae7e5,_0x14e0a7){_0x2ae7e5=_0x2ae7e5-0x0;var _0x395838=_0x9e7c[_0x2ae7e5];return _0x395838;};'use strict';var _=require(_0xc9e7('0x0'));var util=require(_0xc9e7('0x1'));var logger=require(_0xc9e7('0x2'))(_0xc9e7('0x3'));var moment=require(_0xc9e7('0x4'));var BPromise=require(_0xc9e7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9e7('0x6'));var rimraf=require(_0xc9e7('0x7'));var config=require(_0xc9e7('0x8'));var attributes=require(_0xc9e7('0x9'));module[_0xc9e7('0xa')]=function(_0x1e0d6c,_0xf54995){return _0x1e0d6c[_0xc9e7('0xb')]('FreshdeskField',attributes,{'tableName':_0xc9e7('0xc'),'paranoid':![],'indexes':[{'name':_0xc9e7('0xd'),'fields':[_0xc9e7('0xe'),_0xc9e7('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdeee=['path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc7fdff,_0x109fc1){var _0x178754=function(_0x37fb70){while(--_0x37fb70){_0xc7fdff['push'](_0xc7fdff['shift']());}};_0x178754(++_0x109fc1);}(_0xdeee,0x10a));var _0xedee=function(_0x121d4c,_0x52c595){_0x121d4c=_0x121d4c-0x0;var _0x16b686=_0xdeee[_0x121d4c];return _0x16b686;};'use strict';var _=require('lodash');var util=require(_0xedee('0x0'));var logger=require(_0xedee('0x1'))(_0xedee('0x2'));var moment=require(_0xedee('0x3'));var BPromise=require(_0xedee('0x4'));var rp=require(_0xedee('0x5'));var fs=require('fs');var path=require(_0xedee('0x6'));var rimraf=require(_0xedee('0x7'));var config=require(_0xedee('0x8'));var attributes=require(_0xedee('0x9'));module[_0xedee('0xa')]=function(_0x16ee4b,_0x86834a){return _0x16ee4b[_0xedee('0xb')](_0xedee('0xc'),attributes,{'tableName':_0xedee('0xd'),'paranoid':![],'indexes':[{'name':_0xedee('0xe'),'fields':['idField',_0xedee('0xf')],'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 21c95e1..5d10e3f 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 _0x8c50=['FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3d6974,_0x224c77){var _0x494446=function(_0x2b6640){while(--_0x2b6640){_0x3d6974['push'](_0x3d6974['shift']());}};_0x494446(++_0x224c77);}(_0x8c50,0x194));var _0x08c5=function(_0x4b24b0,_0x50ec6b){_0x4b24b0=_0x4b24b0-0x0;var _0x7177a6=_0x8c50[_0x4b24b0];return _0x7177a6;};'use strict';var _=require(_0x08c5('0x0'));var util=require(_0x08c5('0x1'));var moment=require(_0x08c5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x08c5('0x3'))['db'];var utils=require(_0x08c5('0x4'));var logger=require(_0x08c5('0x5'))('rpc');var config=require(_0x08c5('0x6'));var jayson=require(_0x08c5('0x7'));var client=jayson[_0x08c5('0x8')][_0x08c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b011f,_0x26e0d9,_0x3b6f90){return new BPromise(function(_0x16da50,_0x4a2ae0){return client['request'](_0x2b011f,_0x3b6f90)[_0x08c5('0xa')](function(_0x42b53b){logger['info'](_0x08c5('0xb'),_0x26e0d9,_0x08c5('0xc'));logger[_0x08c5('0xd')](_0x08c5('0xe'),_0x26e0d9,_0x08c5('0xc'),JSON[_0x08c5('0xf')](_0x42b53b));if(_0x42b53b[_0x08c5('0x10')]){if(_0x42b53b[_0x08c5('0x10')][_0x08c5('0x11')]===0x1f4){logger[_0x08c5('0x10')](_0x08c5('0xb'),_0x26e0d9,_0x42b53b['error'][_0x08c5('0x12')]);return _0x4a2ae0(_0x42b53b[_0x08c5('0x10')]['message']);}logger[_0x08c5('0x10')](_0x08c5('0xb'),_0x26e0d9,_0x42b53b['error'][_0x08c5('0x12')]);return _0x16da50(_0x42b53b[_0x08c5('0x10')][_0x08c5('0x12')]);}else{logger[_0x08c5('0x13')](_0x08c5('0xb'),_0x26e0d9,_0x08c5('0xc'));_0x16da50(_0x42b53b[_0x08c5('0x14')][_0x08c5('0x12')]);}})[_0x08c5('0x15')](function(_0x2655bd){logger[_0x08c5('0x10')](_0x08c5('0xb'),_0x26e0d9,_0x2655bd);_0x4a2ae0(_0x2655bd);});});} \ No newline at end of file +var _0xad21=['FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xad21,0x84));var _0x1ad2=function(_0x10a212,_0x579d85){_0x10a212=_0x10a212-0x0;var _0x23c82b=_0xad21[_0x10a212];return _0x23c82b;};'use strict';var _=require('lodash');var util=require(_0x1ad2('0x0'));var moment=require(_0x1ad2('0x1'));var BPromise=require('bluebird');var rs=require(_0x1ad2('0x2'));var fs=require('fs');var Redis=require(_0x1ad2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1ad2('0x4'));var logger=require(_0x1ad2('0x5'))(_0x1ad2('0x6'));var config=require('../../config/environment');var jayson=require(_0x1ad2('0x7'));var client=jayson[_0x1ad2('0x8')][_0x1ad2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2572c1,_0x1b6fad,_0x453432){return new BPromise(function(_0x34a9ac,_0x208d0a){return client['request'](_0x2572c1,_0x453432)[_0x1ad2('0xa')](function(_0xfec730){logger[_0x1ad2('0xb')](_0x1ad2('0xc'),_0x1b6fad,_0x1ad2('0xd'));logger[_0x1ad2('0xe')](_0x1ad2('0xf'),_0x1b6fad,_0x1ad2('0xd'),JSON['stringify'](_0xfec730));if(_0xfec730[_0x1ad2('0x10')]){if(_0xfec730[_0x1ad2('0x10')][_0x1ad2('0x11')]===0x1f4){logger[_0x1ad2('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x1b6fad,_0xfec730[_0x1ad2('0x10')][_0x1ad2('0x12')]);return _0x208d0a(_0xfec730[_0x1ad2('0x10')]['message']);}logger[_0x1ad2('0x10')](_0x1ad2('0xc'),_0x1b6fad,_0xfec730[_0x1ad2('0x10')]['message']);return _0x34a9ac(_0xfec730[_0x1ad2('0x10')][_0x1ad2('0x12')]);}else{logger[_0x1ad2('0xb')]('FreshdeskField,\x20%s,\x20%s',_0x1b6fad,_0x1ad2('0xd'));_0x34a9ac(_0xfec730[_0x1ad2('0x13')][_0x1ad2('0x12')]);}})[_0x1ad2('0x14')](function(_0x4de8bd){logger[_0x1ad2('0x10')](_0x1ad2('0xc'),_0x1b6fad,_0x4de8bd);_0x208d0a(_0x4de8bd);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 320d01f..4614cf4 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 _0xeb74=['getFields','post','/:id/configurations','addConfiguration','put','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields'];(function(_0x40b4cb,_0x4c1458){var _0x40a5ff=function(_0x2cee2c){while(--_0x2cee2c){_0x40b4cb['push'](_0x40b4cb['shift']());}};_0x40a5ff(++_0x4c1458);}(_0xeb74,0xe3));var _0x4eb7=function(_0x497e8f,_0xdc8da2){_0x497e8f=_0x497e8f-0x0;var _0x26e917=_0xeb74[_0x497e8f];return _0x26e917;};'use strict';var multer=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var path=require(_0x4eb7('0x2'));var timeout=require(_0x4eb7('0x3'));var express=require(_0x4eb7('0x4'));var router=express[_0x4eb7('0x5')]();var fs_extra=require(_0x4eb7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4eb7('0x7'));var config=require(_0x4eb7('0x8'));var controller=require(_0x4eb7('0x9'));router[_0x4eb7('0xa')]('/',auth[_0x4eb7('0xb')](),controller['index']);router[_0x4eb7('0xa')]('/:id',auth[_0x4eb7('0xb')](),controller[_0x4eb7('0xc')]);router['get']('/:id/configurations',auth[_0x4eb7('0xb')](),controller[_0x4eb7('0xd')]);router['get'](_0x4eb7('0xe'),auth['isAuthenticated'](),controller[_0x4eb7('0xf')]);router[_0x4eb7('0x10')]('/',auth[_0x4eb7('0xb')](),controller['create']);router[_0x4eb7('0x10')](_0x4eb7('0x11'),auth[_0x4eb7('0xb')](),controller[_0x4eb7('0x12')]);router[_0x4eb7('0x13')](_0x4eb7('0x14'),auth[_0x4eb7('0xb')](),controller['update']);router['delete']('/:id',auth[_0x4eb7('0xb')](),controller['destroy']);module[_0x4eb7('0x15')]=router; \ No newline at end of file +var _0x04b8=['get','index','/:id','show','isAuthenticated','getConfigurations','/:id/fields','post','create','/:id/configurations','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x04b8,0x159));var _0x804b=function(_0x28d9ef,_0x126431){_0x28d9ef=_0x28d9ef-0x0;var _0x482782=_0x04b8[_0x28d9ef];return _0x482782;};'use strict';var multer=require('multer');var util=require(_0x804b('0x0'));var path=require('path');var timeout=require(_0x804b('0x1'));var express=require(_0x804b('0x2'));var router=express['Router']();var fs_extra=require(_0x804b('0x3'));var auth=require(_0x804b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x804b('0x5'));var controller=require(_0x804b('0x6'));router[_0x804b('0x7')]('/',auth['isAuthenticated'](),controller[_0x804b('0x8')]);router[_0x804b('0x7')](_0x804b('0x9'),auth['isAuthenticated'](),controller[_0x804b('0xa')]);router[_0x804b('0x7')]('/:id/configurations',auth[_0x804b('0xb')](),controller[_0x804b('0xc')]);router[_0x804b('0x7')](_0x804b('0xd'),auth[_0x804b('0xb')](),controller['getFields']);router[_0x804b('0xe')]('/',auth[_0x804b('0xb')](),controller[_0x804b('0xf')]);router[_0x804b('0xe')](_0x804b('0x10'),auth[_0x804b('0xb')](),controller['addConfiguration']);router[_0x804b('0x11')]('/:id',auth[_0x804b('0xb')](),controller[_0x804b('0x12')]);router[_0x804b('0x13')](_0x804b('0x9'),auth['isAuthenticated'](),controller[_0x804b('0x14')]);module[_0x804b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 388c686..baba003 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 _0x6d38=['exports','STRING','remoteUri'];(function(_0x5e462b,_0x187b06){var _0xb01a65=function(_0x2cc9a3){while(--_0x2cc9a3){_0x5e462b['push'](_0x5e462b['shift']());}};_0xb01a65(++_0x187b06);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x86d3('0x0')]={'name':{'type':Sequelize[_0x86d3('0x1')]},'description':{'type':Sequelize[_0x86d3('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x86d3('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x86d3('0x2')},'serverUrl':{'type':Sequelize[_0x86d3('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8603=['remoteUri','exports','STRING'];(function(_0x6ed9b,_0x49dd9d){var _0x548761=function(_0xd533d2){while(--_0xd533d2){_0x6ed9b['push'](_0x6ed9b['shift']());}};_0x548761(++_0x49dd9d);}(_0x8603,0x190));var _0x3860=function(_0x1ef08e,_0x918ebf){_0x1ef08e=_0x1ef08e-0x0;var _0x43e915=_0x8603[_0x1ef08e];return _0x43e915;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'name':{'type':Sequelize[_0x3860('0x1')]},'description':{'type':Sequelize[_0x3860('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x3860('0x1')]},'remoteUri':{'type':Sequelize[_0x3860('0x1')],'unique':_0x3860('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index f960e2f..4874918 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 _0x686b=['sort','where','pick','merge','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','intersection','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','filter','addConfiguration','AccountId','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','slice','lastIndexOf','format','%s%s','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','FreshsalesAccount','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x10b863,_0x4027c2){var _0x498d2a=function(_0x140cf6){while(--_0x140cf6){_0x10b863['push'](_0x10b863['shift']());}};_0x498d2a(++_0x4027c2);}(_0x686b,0x149));var _0xb686=function(_0x4be7c1,_0x1cc912){_0x4be7c1=_0x4be7c1-0x0;var _0x83f79a=_0x686b[_0x4be7c1];return _0x83f79a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb686('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb686('0x1'));var rp=require(_0xb686('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb686('0x3'));var csv=require(_0xb686('0x4'));var ejs=require(_0xb686('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb686('0x6'));var crypto=require(_0xb686('0x7'));var jsforce=require(_0xb686('0x8'));var deskjs=require(_0xb686('0x9'));var toCsv=require(_0xb686('0x4'));var querystring=require('querystring');var Papa=require(_0xb686('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb686('0xb'));var as=require(_0xb686('0xc'));var hardwareService=require(_0xb686('0xd'));var logger=require(_0xb686('0xe'))('api');var utils=require(_0xb686('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0xb686('0x10'));var db=require(_0xb686('0x11'))['db'];var integrations=require(_0xb686('0x12'));function respondWithStatusCode(_0x3433e4,_0x11bdfa){_0x11bdfa=_0x11bdfa||0xcc;return function(_0x374dd3){if(_0x374dd3){return _0x3433e4[_0xb686('0x13')](_0x11bdfa);}return _0x3433e4[_0xb686('0x14')](_0x11bdfa)[_0xb686('0x15')]();};}function respondWithResult(_0x5066ff,_0x96c953){_0x96c953=_0x96c953||0xc8;return function(_0x148d7e){if(_0x148d7e){return _0x5066ff['status'](_0x96c953)[_0xb686('0x16')](_0x148d7e);}};}function respondWithFilteredResult(_0x149865,_0x15a763){return function(_0x2cf4fc){if(_0x2cf4fc){var _0x5aa4db=typeof _0x15a763['offset']===_0xb686('0x17')&&typeof _0x15a763['limit']===_0xb686('0x17');var _0x1954f3=_0x2cf4fc[_0xb686('0x18')];var _0x3875a3=_0x5aa4db?0x0:_0x15a763[_0xb686('0x19')];var _0x3a755=_0x5aa4db?_0x2cf4fc[_0xb686('0x18')]:_0x15a763['offset']+_0x15a763[_0xb686('0x1a')];var _0x52aa71;if(_0x3a755>=_0x1954f3){_0x3a755=_0x1954f3;_0x52aa71=0xc8;}else{_0x52aa71=0xce;}_0x149865[_0xb686('0x14')](_0x52aa71);return _0x149865['set'](_0xb686('0x1b'),_0x3875a3+'-'+_0x3a755+'/'+_0x1954f3)[_0xb686('0x16')](_0x2cf4fc);}return null;};}function patchUpdates(_0x594413){return function(_0x2c9f0f){try{jsonpatch[_0xb686('0x1c')](_0x2c9f0f,_0x594413,!![]);}catch(_0x3fc724){return BPromise['reject'](_0x3fc724);}return _0x2c9f0f[_0xb686('0x1d')]();};}function saveUpdates(_0x2be083,_0xe7b21b){return function(_0x348cd3){if(_0x348cd3){return _0x348cd3[_0xb686('0x1e')](_0x2be083)[_0xb686('0x1f')](function(_0x41c650){return _0x41c650;});}return null;};}function removeEntity(_0xc866e0,_0xc498db){return function(_0x1af8d){if(_0x1af8d){return _0x1af8d[_0xb686('0x20')]()[_0xb686('0x1f')](function(){_0xc866e0[_0xb686('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1925c9,_0x4bcf9e){return function(_0x34e4c2){if(!_0x34e4c2){_0x1925c9[_0xb686('0x13')](0x194);}return _0x34e4c2;};}function handleError(_0x414cc7,_0x3110de){_0x3110de=_0x3110de||0x1f4;return function(_0x38126e){logger[_0xb686('0x21')](_0x38126e[_0xb686('0x22')]);if(_0x38126e[_0xb686('0x23')]){delete _0x38126e['name'];}_0x414cc7[_0xb686('0x14')](_0x3110de)['send'](_0x38126e);};}exports[_0xb686('0x24')]=function(_0x4ec053,_0x27cc2f){var _0x335f30={},_0xd59cf8={},_0xe67062={'count':0x0,'rows':[]};var _0x204999=_[_0xb686('0x25')](db[_0xb686('0x26')]['rawAttributes'],function(_0x41c470){return{'name':_0x41c470[_0xb686('0x27')],'type':_0x41c470[_0xb686('0x28')][_0xb686('0x29')]};});_0xd59cf8[_0xb686('0x2a')]=_[_0xb686('0x25')](_0x204999,_0xb686('0x23'));_0xd59cf8['query']=_['keys'](_0x4ec053[_0xb686('0x2b')]);_0xd59cf8[_0xb686('0x2c')]=_['intersection'](_0xd59cf8[_0xb686('0x2a')],_0xd59cf8['query']);_0x335f30[_0xb686('0x2d')]=_['intersection'](_0xd59cf8['model'],qs[_0xb686('0x2e')](_0x4ec053['query']['fields']));_0x335f30['attributes']=_0x335f30[_0xb686('0x2d')][_0xb686('0x2f')]?_0x335f30[_0xb686('0x2d')]:_0xd59cf8[_0xb686('0x2a')];if(!_0x4ec053['query'][_0xb686('0x30')](_0xb686('0x31'))){_0x335f30[_0xb686('0x1a')]=qs['limit'](_0x4ec053[_0xb686('0x2b')]['limit']);_0x335f30[_0xb686('0x19')]=qs[_0xb686('0x19')](_0x4ec053[_0xb686('0x2b')][_0xb686('0x19')]);}_0x335f30[_0xb686('0x32')]=qs[_0xb686('0x33')](_0x4ec053[_0xb686('0x2b')]['sort']);_0x335f30[_0xb686('0x34')]=qs[_0xb686('0x2c')](_[_0xb686('0x35')](_0x4ec053[_0xb686('0x2b')],_0xd59cf8[_0xb686('0x2c')]),_0x204999);if(_0x4ec053[_0xb686('0x2b')]['filter']){_0x335f30[_0xb686('0x34')]=_['merge'](_0x335f30['where'],{'$or':_['map'](_0x204999,function(_0xa79db3){if(_0xa79db3[_0xb686('0x28')]!=='VIRTUAL'){var _0xd3c5d3={};_0xd3c5d3[_0xa79db3[_0xb686('0x23')]]={'$like':'%'+_0x4ec053[_0xb686('0x2b')]['filter']+'%'};return _0xd3c5d3;}})});}_0x335f30=_[_0xb686('0x36')]({},_0x335f30,_0x4ec053[_0xb686('0x37')]);var _0xf285b={'where':_0x335f30[_0xb686('0x34')]};return db[_0xb686('0x26')][_0xb686('0x18')](_0xf285b)['then'](function(_0x4237dc){_0xe67062[_0xb686('0x18')]=_0x4237dc;if(_0x4ec053['query'][_0xb686('0x38')]){_0x335f30['include']=[{'all':!![]}];}return db[_0xb686('0x26')][_0xb686('0x39')](_0x335f30);})[_0xb686('0x1f')](function(_0x462cb8){_0xe67062[_0xb686('0x3a')]=_0x462cb8;return _0xe67062;})[_0xb686('0x1f')](respondWithFilteredResult(_0x27cc2f,_0x335f30))[_0xb686('0x3b')](handleError(_0x27cc2f,null));};exports['show']=function(_0xf8b9fe,_0xb35e6d){var _0x1968c6={'raw':![],'where':{'id':_0xf8b9fe[_0xb686('0x3c')]['id']}},_0x49d9f2={};_0x49d9f2[_0xb686('0x2a')]=_[_0xb686('0x3d')](db['FreshsalesAccount'][_0xb686('0x3e')]);_0x49d9f2[_0xb686('0x2b')]=_['keys'](_0xf8b9fe[_0xb686('0x2b')]);_0x49d9f2[_0xb686('0x2c')]=_[_0xb686('0x3f')](_0x49d9f2[_0xb686('0x2a')],_0x49d9f2[_0xb686('0x2b')]);_0x1968c6[_0xb686('0x2d')]=_['intersection'](_0x49d9f2[_0xb686('0x2a')],qs['fields'](_0xf8b9fe[_0xb686('0x2b')][_0xb686('0x2e')]));_0x1968c6[_0xb686('0x2d')]=_0x1968c6[_0xb686('0x2d')][_0xb686('0x2f')]?_0x1968c6[_0xb686('0x2d')]:_0x49d9f2[_0xb686('0x2a')];if(_0xf8b9fe[_0xb686('0x2b')]['includeAll']){_0x1968c6['include']=[{'all':!![]}];}_0x1968c6=_[_0xb686('0x36')]({},_0x1968c6,_0xf8b9fe[_0xb686('0x37')]);return db['FreshsalesAccount'][_0xb686('0x40')](_0x1968c6)['then'](handleEntityNotFound(_0xb35e6d,null))[_0xb686('0x1f')](respondWithResult(_0xb35e6d,null))[_0xb686('0x3b')](handleError(_0xb35e6d,null));};exports[_0xb686('0x41')]=function(_0x279533,_0x468e0d){return db[_0xb686('0x26')][_0xb686('0x41')](_0x279533['body'],{})[_0xb686('0x1f')](respondWithResult(_0x468e0d,0xc9))[_0xb686('0x3b')](handleError(_0x468e0d,null));};exports[_0xb686('0x1e')]=function(_0x47dd29,_0xfe1286){if(_0x47dd29[_0xb686('0x42')]['id']){delete _0x47dd29[_0xb686('0x42')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x47dd29[_0xb686('0x3c')]['id']}})[_0xb686('0x1f')](handleEntityNotFound(_0xfe1286,null))['then'](saveUpdates(_0x47dd29[_0xb686('0x42')],null))[_0xb686('0x1f')](respondWithResult(_0xfe1286,null))[_0xb686('0x3b')](handleError(_0xfe1286,null));};exports[_0xb686('0x20')]=function(_0x26ac85,_0x1c9330){return db[_0xb686('0x26')][_0xb686('0x40')]({'where':{'id':_0x26ac85[_0xb686('0x3c')]['id']}})[_0xb686('0x1f')](handleEntityNotFound(_0x1c9330,null))[_0xb686('0x1f')](removeEntity(_0x1c9330,null))[_0xb686('0x3b')](handleError(_0x1c9330,null));};exports[_0xb686('0x43')]=function(_0x347f6b,_0x4b4454,_0x1cae04){var _0x2bbc68={};var _0x19e710={};var _0x4bfb9a;var _0x15405c;return db['FreshsalesAccount'][_0xb686('0x44')]({'where':{'id':_0x347f6b[_0xb686('0x3c')]['id']}})[_0xb686('0x1f')](handleEntityNotFound(_0x4b4454,null))['then'](function(_0x1151ef){if(_0x1151ef){_0x4bfb9a=_0x1151ef;_0x19e710[_0xb686('0x2a')]=_[_0xb686('0x3d')](db[_0xb686('0x45')][_0xb686('0x3e')]);_0x19e710['query']=_[_0xb686('0x3d')](_0x347f6b[_0xb686('0x2b')]);_0x19e710[_0xb686('0x2c')]=_[_0xb686('0x3f')](_0x19e710[_0xb686('0x2a')],_0x19e710[_0xb686('0x2b')]);_0x2bbc68[_0xb686('0x2d')]=_['intersection'](_0x19e710[_0xb686('0x2a')],qs[_0xb686('0x2e')](_0x347f6b[_0xb686('0x2b')][_0xb686('0x2e')]));_0x2bbc68['attributes']=_0x2bbc68[_0xb686('0x2d')][_0xb686('0x2f')]?_0x2bbc68[_0xb686('0x2d')]:_0x19e710[_0xb686('0x2a')];_0x2bbc68[_0xb686('0x32')]=qs[_0xb686('0x33')](_0x347f6b['query']['sort']);_0x2bbc68['where']=qs['filters'](_[_0xb686('0x35')](_0x347f6b[_0xb686('0x2b')],_0x19e710[_0xb686('0x2c')]));if(_0x347f6b[_0xb686('0x2b')][_0xb686('0x46')]){_0x2bbc68['where']=_['merge'](_0x2bbc68[_0xb686('0x34')],{'$or':_[_0xb686('0x25')](_0x2bbc68[_0xb686('0x2d')],function(_0x51c63f){var _0x1f5198={};_0x1f5198[_0x51c63f]={'$like':'%'+_0x347f6b['query'][_0xb686('0x46')]+'%'};return _0x1f5198;})});}_0x2bbc68=_['merge']({},_0x2bbc68,_0x347f6b['options']);return _0x4bfb9a[_0xb686('0x43')](_0x2bbc68);}})[_0xb686('0x1f')](function(_0x450141){if(_0x450141){_0x15405c=_0x450141[_0xb686('0x2f')];if(!_0x347f6b[_0xb686('0x2b')]['hasOwnProperty']('nolimit')){_0x2bbc68[_0xb686('0x1a')]=qs[_0xb686('0x1a')](_0x347f6b[_0xb686('0x2b')][_0xb686('0x1a')]);_0x2bbc68['offset']=qs['offset'](_0x347f6b[_0xb686('0x2b')][_0xb686('0x19')]);}return _0x4bfb9a[_0xb686('0x43')](_0x2bbc68);}})[_0xb686('0x1f')](function(_0x50fc56){if(_0x50fc56){return _0x50fc56?{'count':_0x15405c,'rows':_0x50fc56}:null;}})['then'](respondWithResult(_0x4b4454,null))[_0xb686('0x3b')](handleError(_0x4b4454,null));};exports[_0xb686('0x47')]=function(_0x2a9d4c,_0x51d938,_0x182bc5){if(_0x2a9d4c[_0xb686('0x42')]['id']){delete _0x2a9d4c['body']['id'];}return db[_0xb686('0x26')][_0xb686('0x44')]({'where':{'id':_0x2a9d4c['params']['id']}})[_0xb686('0x1f')](handleEntityNotFound(_0x51d938,null))[_0xb686('0x1f')](function(_0xb5278c){if(_0xb5278c){_0x2a9d4c['body'][_0xb686('0x48')]=_0xb5278c['id'];_0x2a9d4c['body']['Subjects']=integrations[_0xb686('0x49')](_0x2a9d4c[_0xb686('0x42')][_0xb686('0x4a')],_0x2a9d4c[_0xb686('0x42')][_0xb686('0x28')]);_0x2a9d4c[_0xb686('0x42')][_0xb686('0x4b')]=integrations['getDescriptions'](_0x2a9d4c[_0xb686('0x42')][_0xb686('0x4a')],_0x2a9d4c[_0xb686('0x42')][_0xb686('0x28')]);return db[_0xb686('0x45')][_0xb686('0x41')](_0x2a9d4c[_0xb686('0x42')],{'include':[{'model':db[_0xb686('0x4c')],'as':'Subjects'},{'model':db[_0xb686('0x4c')],'as':_0xb686('0x4b')}]});}return null;})[_0xb686('0x1f')](respondWithResult(_0x51d938,null))[_0xb686('0x3b')](handleError(_0x51d938,null));};exports[_0xb686('0x4d')]=function(_0x14e9da,_0x469b56,_0x15c364){var _0x410835='';var _0x17909c='';return db['FreshsalesAccount'][_0xb686('0x44')]({'where':{'id':_0x14e9da[_0xb686('0x3c')]['id']},'attributes':['id',_0xb686('0x4e'),_0xb686('0x4f'),'apiKey']})[_0xb686('0x1f')](handleEntityNotFound(_0x469b56,null))['then'](function(_0x422c06){if(_0x422c06){_0x17909c=_0x422c06[_0xb686('0x4e')];_0x410835=_0x422c06[_0xb686('0x4f')];var _0x5a03a0=_0x422c06[_0xb686('0x4f')][_0xb686('0x50')](-0x1);if(_0x5a03a0==='/'){_0x410835=_0x410835['substring'](0x0,_0x410835[_0xb686('0x51')](_0x5a03a0));}return rp({'method':'GET','uri':util[_0xb686('0x52')](_0xb686('0x53'),_0x410835,'/api/selector/owners'),'headers':{'Authorization':_0xb686('0x54')+_0x422c06[_0xb686('0x55')]},'json':!![]});}})['then'](function(_0x4c793d){if(_0x4c793d){var _0x339339=_0x4c793d[_0xb686('0x56')];var _0x45c90d=![];var _0xad5a99=null;for(_0xad5a99=0x0;_0xad5a99<_0x339339[_0xb686('0x2f')];_0xad5a99++){if(_0x339339[_0xad5a99][_0xb686('0x57')]===_0x17909c){_0x45c90d=!![];}}if(_0x45c90d){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xb686('0x58')});}}})[_0xb686('0x1f')](respondWithResult(_0x469b56,null))[_0xb686('0x3b')](function(_0x77da16){var _0x2d965a=_0x14e9da['query'][_0xb686('0x59')]?0x1f4:_0x77da16[_0xb686('0x5a')]||0x1f4;logger[_0xb686('0x21')](_0xb686('0x5b'),'getFields',_0x2d965a,JSON[_0xb686('0x5c')](_0x77da16));delete _0x77da16[_0xb686('0x23')];if(_0x2d965a===0x191){_0x2d965a=0x190;}_0x469b56['status'](_0x2d965a)[_0xb686('0x5d')](_0x14e9da[_0xb686('0x2b')][_0xb686('0x59')]?{'message':_0xb686('0x5e'),'statusCode':_0x77da16[_0xb686('0x5a')]}:_0x77da16);});}; \ No newline at end of file +var _0xa898=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','offset','count','apply','update','then','end','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','apiKey','username','remoteUri','slice','format','%s%s','/api/selector/owners','users','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x21a3df,_0x3bcd8e){var _0xaf4d38=function(_0xe103e8){while(--_0xe103e8){_0x21a3df['push'](_0x21a3df['shift']());}};_0xaf4d38(++_0x3bcd8e);}(_0xa898,0x17e));var _0x8a89=function(_0x1e5b1b,_0x1e8c99){_0x1e5b1b=_0x1e5b1b-0x0;var _0x3c0a42=_0xa898[_0x1e5b1b];return _0x3c0a42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a89('0x0'));var zipdir=require(_0x8a89('0x1'));var jsonpatch=require(_0x8a89('0x2'));var rp=require('request-promise');var moment=require(_0x8a89('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8a89('0x4'));var util=require(_0x8a89('0x5'));var path=require(_0x8a89('0x6'));var sox=require(_0x8a89('0x7'));var csv=require('to-csv');var ejs=require(_0x8a89('0x8'));var fs=require('fs');var fs_extra=require(_0x8a89('0x9'));var _=require(_0x8a89('0xa'));var squel=require(_0x8a89('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8a89('0xc'));var toCsv=require(_0x8a89('0xd'));var querystring=require(_0x8a89('0xe'));var Papa=require('papaparse');var Redis=require(_0x8a89('0xf'));var authService=require(_0x8a89('0x10'));var qs=require(_0x8a89('0x11'));var as=require(_0x8a89('0x12'));var hardwareService=require(_0x8a89('0x13'));var logger=require(_0x8a89('0x14'))('api');var utils=require(_0x8a89('0x15'));var config=require(_0x8a89('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1b18e6,_0x128d74){_0x128d74=_0x128d74||0xcc;return function(_0x4137a0){if(_0x4137a0){return _0x1b18e6[_0x8a89('0x17')](_0x128d74);}return _0x1b18e6['status'](_0x128d74)['end']();};}function respondWithResult(_0x2a08d7,_0x574b3f){_0x574b3f=_0x574b3f||0xc8;return function(_0x13742e){if(_0x13742e){return _0x2a08d7[_0x8a89('0x18')](_0x574b3f)[_0x8a89('0x19')](_0x13742e);}};}function respondWithFilteredResult(_0x6e1b79,_0x4c2d52){return function(_0x39c23e){if(_0x39c23e){var _0x1a94bd=typeof _0x4c2d52['offset']===_0x8a89('0x1a')&&typeof _0x4c2d52[_0x8a89('0x1b')]===_0x8a89('0x1a');var _0x4a2ed8=_0x39c23e['count'];var _0x286f28=_0x1a94bd?0x0:_0x4c2d52[_0x8a89('0x1c')];var _0x45421c=_0x1a94bd?_0x39c23e[_0x8a89('0x1d')]:_0x4c2d52[_0x8a89('0x1c')]+_0x4c2d52[_0x8a89('0x1b')];var _0x8a169d;if(_0x45421c>=_0x4a2ed8){_0x45421c=_0x4a2ed8;_0x8a169d=0xc8;}else{_0x8a169d=0xce;}_0x6e1b79[_0x8a89('0x18')](_0x8a169d);return _0x6e1b79['set']('Content-Range',_0x286f28+'-'+_0x45421c+'/'+_0x4a2ed8)[_0x8a89('0x19')](_0x39c23e);}return null;};}function patchUpdates(_0x1c9dfb){return function(_0x81d4a9){try{jsonpatch[_0x8a89('0x1e')](_0x81d4a9,_0x1c9dfb,!![]);}catch(_0x353da2){return BPromise['reject'](_0x353da2);}return _0x81d4a9['save']();};}function saveUpdates(_0x3092f2,_0x4aafe7){return function(_0x15ec69){if(_0x15ec69){return _0x15ec69[_0x8a89('0x1f')](_0x3092f2)[_0x8a89('0x20')](function(_0x2737d7){return _0x2737d7;});}return null;};}function removeEntity(_0xeaa57b,_0x560f34){return function(_0x25c12d){if(_0x25c12d){return _0x25c12d['destroy']()['then'](function(){_0xeaa57b[_0x8a89('0x18')](0xcc)[_0x8a89('0x21')]();});}};}function handleEntityNotFound(_0x8d820b,_0xb35241){return function(_0x49663d){if(!_0x49663d){_0x8d820b[_0x8a89('0x17')](0x194);}return _0x49663d;};}function handleError(_0x27add8,_0x41d499){_0x41d499=_0x41d499||0x1f4;return function(_0x45cbd2){logger[_0x8a89('0x22')](_0x45cbd2[_0x8a89('0x23')]);if(_0x45cbd2['name']){delete _0x45cbd2[_0x8a89('0x24')];}_0x27add8[_0x8a89('0x18')](_0x41d499)[_0x8a89('0x25')](_0x45cbd2);};}exports[_0x8a89('0x26')]=function(_0x27fd1e,_0x5bde6a){var _0x58ff02={},_0x31d025={},_0x41e7d7={'count':0x0,'rows':[]};var _0x504ee8=_[_0x8a89('0x27')](db[_0x8a89('0x28')][_0x8a89('0x29')],function(_0x56847c){return{'name':_0x56847c[_0x8a89('0x2a')],'type':_0x56847c[_0x8a89('0x2b')][_0x8a89('0x2c')]};});_0x31d025['model']=_[_0x8a89('0x27')](_0x504ee8,_0x8a89('0x24'));_0x31d025[_0x8a89('0x2d')]=_[_0x8a89('0x2e')](_0x27fd1e[_0x8a89('0x2d')]);_0x31d025[_0x8a89('0x2f')]=_[_0x8a89('0x30')](_0x31d025[_0x8a89('0x31')],_0x31d025[_0x8a89('0x2d')]);_0x58ff02['attributes']=_[_0x8a89('0x30')](_0x31d025['model'],qs[_0x8a89('0x32')](_0x27fd1e['query'][_0x8a89('0x32')]));_0x58ff02['attributes']=_0x58ff02[_0x8a89('0x33')][_0x8a89('0x34')]?_0x58ff02[_0x8a89('0x33')]:_0x31d025['model'];if(!_0x27fd1e[_0x8a89('0x2d')][_0x8a89('0x35')](_0x8a89('0x36'))){_0x58ff02['limit']=qs[_0x8a89('0x1b')](_0x27fd1e['query']['limit']);_0x58ff02[_0x8a89('0x1c')]=qs[_0x8a89('0x1c')](_0x27fd1e[_0x8a89('0x2d')]['offset']);}_0x58ff02[_0x8a89('0x37')]=qs['sort'](_0x27fd1e['query'][_0x8a89('0x38')]);_0x58ff02['where']=qs['filters'](_['pick'](_0x27fd1e[_0x8a89('0x2d')],_0x31d025[_0x8a89('0x2f')]),_0x504ee8);if(_0x27fd1e['query'][_0x8a89('0x39')]){_0x58ff02[_0x8a89('0x3a')]=_['merge'](_0x58ff02[_0x8a89('0x3a')],{'$or':_[_0x8a89('0x27')](_0x504ee8,function(_0x3c8e47){if(_0x3c8e47[_0x8a89('0x2b')]!==_0x8a89('0x3b')){var _0x4c786e={};_0x4c786e[_0x3c8e47['name']]={'$like':'%'+_0x27fd1e[_0x8a89('0x2d')][_0x8a89('0x39')]+'%'};return _0x4c786e;}})});}_0x58ff02=_[_0x8a89('0x3c')]({},_0x58ff02,_0x27fd1e[_0x8a89('0x3d')]);var _0x3261bc={'where':_0x58ff02[_0x8a89('0x3a')]};return db[_0x8a89('0x28')][_0x8a89('0x1d')](_0x3261bc)['then'](function(_0x429698){_0x41e7d7[_0x8a89('0x1d')]=_0x429698;if(_0x27fd1e[_0x8a89('0x2d')][_0x8a89('0x3e')]){_0x58ff02[_0x8a89('0x3f')]=[{'all':!![]}];}return db[_0x8a89('0x28')][_0x8a89('0x40')](_0x58ff02);})[_0x8a89('0x20')](function(_0x5c50f0){_0x41e7d7[_0x8a89('0x41')]=_0x5c50f0;return _0x41e7d7;})[_0x8a89('0x20')](respondWithFilteredResult(_0x5bde6a,_0x58ff02))[_0x8a89('0x42')](handleError(_0x5bde6a,null));};exports[_0x8a89('0x43')]=function(_0x195a4b,_0x311fe7){var _0x353e6d={'raw':![],'where':{'id':_0x195a4b[_0x8a89('0x44')]['id']}},_0x5550c0={};_0x5550c0[_0x8a89('0x31')]=_['keys'](db[_0x8a89('0x28')]['rawAttributes']);_0x5550c0[_0x8a89('0x2d')]=_[_0x8a89('0x2e')](_0x195a4b[_0x8a89('0x2d')]);_0x5550c0[_0x8a89('0x2f')]=_[_0x8a89('0x30')](_0x5550c0[_0x8a89('0x31')],_0x5550c0[_0x8a89('0x2d')]);_0x353e6d['attributes']=_[_0x8a89('0x30')](_0x5550c0[_0x8a89('0x31')],qs[_0x8a89('0x32')](_0x195a4b['query'][_0x8a89('0x32')]));_0x353e6d[_0x8a89('0x33')]=_0x353e6d[_0x8a89('0x33')][_0x8a89('0x34')]?_0x353e6d[_0x8a89('0x33')]:_0x5550c0[_0x8a89('0x31')];if(_0x195a4b['query'][_0x8a89('0x3e')]){_0x353e6d[_0x8a89('0x3f')]=[{'all':!![]}];}_0x353e6d=_[_0x8a89('0x3c')]({},_0x353e6d,_0x195a4b[_0x8a89('0x3d')]);return db[_0x8a89('0x28')][_0x8a89('0x45')](_0x353e6d)['then'](handleEntityNotFound(_0x311fe7,null))[_0x8a89('0x20')](respondWithResult(_0x311fe7,null))[_0x8a89('0x42')](handleError(_0x311fe7,null));};exports[_0x8a89('0x46')]=function(_0x58d740,_0x22b612){return db[_0x8a89('0x28')][_0x8a89('0x46')](_0x58d740[_0x8a89('0x47')],{})[_0x8a89('0x20')](respondWithResult(_0x22b612,0xc9))[_0x8a89('0x42')](handleError(_0x22b612,null));};exports['update']=function(_0x3c852d,_0x3be918){if(_0x3c852d[_0x8a89('0x47')]['id']){delete _0x3c852d[_0x8a89('0x47')]['id'];}return db[_0x8a89('0x28')]['find']({'where':{'id':_0x3c852d['params']['id']}})[_0x8a89('0x20')](handleEntityNotFound(_0x3be918,null))[_0x8a89('0x20')](saveUpdates(_0x3c852d['body'],null))[_0x8a89('0x20')](respondWithResult(_0x3be918,null))[_0x8a89('0x42')](handleError(_0x3be918,null));};exports[_0x8a89('0x48')]=function(_0x5c92a1,_0x12c9e4){return db[_0x8a89('0x28')]['find']({'where':{'id':_0x5c92a1[_0x8a89('0x44')]['id']}})[_0x8a89('0x20')](handleEntityNotFound(_0x12c9e4,null))[_0x8a89('0x20')](removeEntity(_0x12c9e4,null))['catch'](handleError(_0x12c9e4,null));};exports[_0x8a89('0x49')]=function(_0x5de811,_0x1b6790,_0x44365d){var _0xb9553f={};var _0x2dd9d9={};var _0x49dc26;var _0x4573bb;return db['FreshsalesAccount'][_0x8a89('0x4a')]({'where':{'id':_0x5de811[_0x8a89('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b6790,null))['then'](function(_0xf7ab9a){if(_0xf7ab9a){_0x49dc26=_0xf7ab9a;_0x2dd9d9['model']=_[_0x8a89('0x2e')](db[_0x8a89('0x4b')][_0x8a89('0x29')]);_0x2dd9d9[_0x8a89('0x2d')]=_['keys'](_0x5de811[_0x8a89('0x2d')]);_0x2dd9d9[_0x8a89('0x2f')]=_[_0x8a89('0x30')](_0x2dd9d9[_0x8a89('0x31')],_0x2dd9d9[_0x8a89('0x2d')]);_0xb9553f[_0x8a89('0x33')]=_[_0x8a89('0x30')](_0x2dd9d9[_0x8a89('0x31')],qs[_0x8a89('0x32')](_0x5de811[_0x8a89('0x2d')]['fields']));_0xb9553f[_0x8a89('0x33')]=_0xb9553f[_0x8a89('0x33')][_0x8a89('0x34')]?_0xb9553f[_0x8a89('0x33')]:_0x2dd9d9[_0x8a89('0x31')];_0xb9553f[_0x8a89('0x37')]=qs[_0x8a89('0x38')](_0x5de811[_0x8a89('0x2d')][_0x8a89('0x38')]);_0xb9553f['where']=qs['filters'](_[_0x8a89('0x4c')](_0x5de811['query'],_0x2dd9d9[_0x8a89('0x2f')]));if(_0x5de811[_0x8a89('0x2d')][_0x8a89('0x39')]){_0xb9553f[_0x8a89('0x3a')]=_[_0x8a89('0x3c')](_0xb9553f[_0x8a89('0x3a')],{'$or':_[_0x8a89('0x27')](_0xb9553f[_0x8a89('0x33')],function(_0x5ae93c){var _0x69b0d5={};_0x69b0d5[_0x5ae93c]={'$like':'%'+_0x5de811[_0x8a89('0x2d')][_0x8a89('0x39')]+'%'};return _0x69b0d5;})});}_0xb9553f=_['merge']({},_0xb9553f,_0x5de811[_0x8a89('0x3d')]);return _0x49dc26['getConfigurations'](_0xb9553f);}})[_0x8a89('0x20')](function(_0x4fa4e0){if(_0x4fa4e0){_0x4573bb=_0x4fa4e0[_0x8a89('0x34')];if(!_0x5de811[_0x8a89('0x2d')][_0x8a89('0x35')](_0x8a89('0x36'))){_0xb9553f[_0x8a89('0x1b')]=qs[_0x8a89('0x1b')](_0x5de811[_0x8a89('0x2d')][_0x8a89('0x1b')]);_0xb9553f['offset']=qs[_0x8a89('0x1c')](_0x5de811[_0x8a89('0x2d')]['offset']);}return _0x49dc26[_0x8a89('0x49')](_0xb9553f);}})[_0x8a89('0x20')](function(_0x4678ef){if(_0x4678ef){return _0x4678ef?{'count':_0x4573bb,'rows':_0x4678ef}:null;}})[_0x8a89('0x20')](respondWithResult(_0x1b6790,null))['catch'](handleError(_0x1b6790,null));};exports[_0x8a89('0x4d')]=function(_0x2dccc8,_0x5e6f73,_0x220e2c){if(_0x2dccc8['body']['id']){delete _0x2dccc8[_0x8a89('0x47')]['id'];}return db['FreshsalesAccount'][_0x8a89('0x4a')]({'where':{'id':_0x2dccc8['params']['id']}})[_0x8a89('0x20')](handleEntityNotFound(_0x5e6f73,null))['then'](function(_0x50012d){if(_0x50012d){_0x2dccc8['body'][_0x8a89('0x4e')]=_0x50012d['id'];_0x2dccc8[_0x8a89('0x47')][_0x8a89('0x4f')]=integrations[_0x8a89('0x50')](_0x2dccc8[_0x8a89('0x47')][_0x8a89('0x51')],_0x2dccc8['body'][_0x8a89('0x2b')]);_0x2dccc8['body'][_0x8a89('0x52')]=integrations[_0x8a89('0x53')](_0x2dccc8['body'][_0x8a89('0x51')],_0x2dccc8[_0x8a89('0x47')][_0x8a89('0x2b')]);return db[_0x8a89('0x4b')][_0x8a89('0x46')](_0x2dccc8['body'],{'include':[{'model':db[_0x8a89('0x54')],'as':'Subjects'},{'model':db[_0x8a89('0x54')],'as':_0x8a89('0x52')}]});}return null;})['then'](respondWithResult(_0x5e6f73,null))[_0x8a89('0x42')](handleError(_0x5e6f73,null));};exports[_0x8a89('0x55')]=function(_0x4c0add,_0x1ca234,_0x1f2b83){var _0x441d1f='';var _0x4ace2f='';return db[_0x8a89('0x28')]['findOne']({'where':{'id':_0x4c0add[_0x8a89('0x44')]['id']},'attributes':['id','username','remoteUri',_0x8a89('0x56')]})[_0x8a89('0x20')](handleEntityNotFound(_0x1ca234,null))[_0x8a89('0x20')](function(_0x212e0b){if(_0x212e0b){_0x4ace2f=_0x212e0b[_0x8a89('0x57')];_0x441d1f=_0x212e0b[_0x8a89('0x58')];var _0x53c330=_0x212e0b['remoteUri'][_0x8a89('0x59')](-0x1);if(_0x53c330==='/'){_0x441d1f=_0x441d1f['substring'](0x0,_0x441d1f['lastIndexOf'](_0x53c330));}return rp({'method':'GET','uri':util[_0x8a89('0x5a')](_0x8a89('0x5b'),_0x441d1f,_0x8a89('0x5c')),'headers':{'Authorization':'Token\x20token='+_0x212e0b[_0x8a89('0x56')]},'json':!![]});}})['then'](function(_0x442714){if(_0x442714){var _0x120a39=_0x442714[_0x8a89('0x5d')];var _0x49e431=![];var _0xa9a835=null;for(_0xa9a835=0x0;_0xa9a835<_0x120a39[_0x8a89('0x34')];_0xa9a835++){if(_0x120a39[_0xa9a835][_0x8a89('0x5e')]===_0x4ace2f){_0x49e431=!![];}}if(_0x49e431){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x1ca234,null))[_0x8a89('0x42')](function(_0x900ab){var _0x1ba3fe=_0x4c0add[_0x8a89('0x2d')][_0x8a89('0x5f')]?0x1f4:_0x900ab[_0x8a89('0x60')]||0x1f4;logger['error'](_0x8a89('0x61'),_0x8a89('0x55'),_0x1ba3fe,JSON[_0x8a89('0x62')](_0x900ab));delete _0x900ab['name'];if(_0x1ba3fe===0x191){_0x1ba3fe=0x190;}_0x1ca234['status'](_0x1ba3fe)[_0x8a89('0x25')](_0x4c0add['query'][_0x8a89('0x5f')]?{'message':_0x8a89('0x63'),'statusCode':_0x900ab['statusCode']}:_0x900ab);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 05cbb96..0ed7ab0 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 _0x6a55=['define','FreshsalesAccount','int_freshsales_accounts','lodash','moment','path','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0x6a55,0xdb));var _0x56a5=function(_0x2cfb48,_0x24b83b){_0x2cfb48=_0x2cfb48-0x0;var _0xc4594f=_0x6a55[_0x2cfb48];return _0xc4594f;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56a5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56a5('0x2'));var rimraf=require('rimraf');var config=require(_0x56a5('0x3'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x56a5('0x4'));module[_0x56a5('0x5')]=function(_0x42d164,_0x293ea1){return _0x42d164[_0x56a5('0x6')](_0x56a5('0x7'),attributes,{'tableName':_0x56a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a07=['moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x26a5a2,_0x29591b){var _0x2800a4=function(_0x5a7c90){while(--_0x5a7c90){_0x26a5a2['push'](_0x26a5a2['shift']());}};_0x2800a4(++_0x29591b);}(_0x2a07,0x74));var _0x72a0=function(_0x215ea3,_0x24d78){_0x215ea3=_0x215ea3-0x0;var _0x542d1d=_0x2a07[_0x215ea3];return _0x542d1d;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));var integrations=require(_0x72a0('0xa'));module[_0x72a0('0xb')]=function(_0x20dab9,_0x193e3b){return _0x20dab9[_0x72a0('0xc')](_0x72a0('0xd'),attributes,{'tableName':_0x72a0('0xe'),'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 f4c321d..1227716 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 _0x32f4=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include','model','map','find','ShowFreshsalesAccount'];(function(_0x89c40f,_0xd92eb2){var _0x17acbb=function(_0xd57d85){while(--_0xd57d85){_0x89c40f['push'](_0x89c40f['shift']());}};_0x17acbb(++_0xd92eb2);}(_0x32f4,0x154));var _0x432f=function(_0x22a8ff,_0x49b9c2){_0x22a8ff=_0x22a8ff-0x0;var _0x281144=_0x32f4[_0x22a8ff];return _0x281144;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5f08,_0x2f66fd,_0x32b062){return new BPromise(function(_0x4a5b56,_0x2a2ef6){return client['request'](_0x5b5f08,_0x32b062)[_0x432f('0xb')](function(_0x340fe9){logger[_0x432f('0xc')](_0x432f('0xd'),_0x2f66fd,_0x432f('0xe'));logger['debug'](_0x432f('0xf'),_0x2f66fd,'request\x20sent',JSON[_0x432f('0x10')](_0x340fe9));if(_0x340fe9['error']){if(_0x340fe9[_0x432f('0x11')][_0x432f('0x12')]===0x1f4){logger['error'](_0x432f('0xd'),_0x2f66fd,_0x340fe9[_0x432f('0x11')]['message']);return _0x2a2ef6(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x2f66fd,_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);return _0x4a5b56(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}else{logger[_0x432f('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x2f66fd,_0x432f('0xe'));_0x4a5b56(_0x340fe9[_0x432f('0x14')][_0x432f('0x13')]);}})[_0x432f('0x15')](function(_0x5bae29){logger[_0x432f('0x11')](_0x432f('0xd'),_0x2f66fd,_0x5bae29);_0x2a2ef6(_0x5bae29);});});}exports[_0x432f('0x16')]=function(_0x243cf){var _0x3cd5da=this;return new Promise(function(_0x129582,_0x5ae24e){return db[_0x432f('0x17')]['findAll']({'raw':_0x243cf[_0x432f('0x18')]?_0x243cf[_0x432f('0x18')][_0x432f('0x19')]===undefined?!![]:![]:!![],'where':_0x243cf[_0x432f('0x18')]?_0x243cf[_0x432f('0x18')][_0x432f('0x1a')]||null:null,'attributes':_0x243cf[_0x432f('0x18')]?_0x243cf[_0x432f('0x18')][_0x432f('0x1b')]||null:null,'limit':_0x243cf[_0x432f('0x18')]?_0x243cf[_0x432f('0x18')][_0x432f('0x1c')]||null:null,'include':_0x243cf['options']?_0x243cf['options'][_0x432f('0x1d')]?_['map'](_0x243cf[_0x432f('0x18')]['include'],function(_0x37f136){return{'model':db[_0x37f136[_0x432f('0x1e')]],'as':_0x37f136['as'],'attributes':_0x37f136[_0x432f('0x1b')],'include':_0x37f136[_0x432f('0x1d')]?_[_0x432f('0x1f')](_0x37f136[_0x432f('0x1d')],function(_0x59f352){return{'model':db[_0x59f352[_0x432f('0x1e')]],'as':_0x59f352['as'],'attributes':_0x59f352[_0x432f('0x1b')],'include':_0x59f352['include']?_[_0x432f('0x1f')](_0x59f352[_0x432f('0x1d')],function(_0x2bcbb4){return{'model':db[_0x2bcbb4[_0x432f('0x1e')]],'as':_0x2bcbb4['as'],'attributes':_0x2bcbb4[_0x432f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x432f('0xb')](function(_0x138a6a){logger['info'](_0x432f('0x16'),_0x243cf);logger['debug'](_0x432f('0x16'),_0x243cf,JSON['stringify'](_0x138a6a));_0x129582(_0x138a6a);})[_0x432f('0x15')](function(_0x5a2c14){logger[_0x432f('0x11')]('GetFreshsalesAccount',_0x5a2c14[_0x432f('0x13')],_0x243cf);_0x5ae24e(_0x3cd5da[_0x432f('0x11')](0x1f4,_0x5a2c14[_0x432f('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x6a116e){var _0x24406a=this;return new Promise(function(_0x48139b,_0x5ee0fa){return db[_0x432f('0x17')][_0x432f('0x20')]({'raw':_0x6a116e[_0x432f('0x18')]?_0x6a116e[_0x432f('0x18')][_0x432f('0x19')]===undefined?!![]:![]:!![],'where':_0x6a116e[_0x432f('0x18')]?_0x6a116e['options']['where']||null:null,'attributes':_0x6a116e[_0x432f('0x18')]?_0x6a116e[_0x432f('0x18')][_0x432f('0x1b')]||null:null,'include':_0x6a116e['options']?_0x6a116e[_0x432f('0x18')][_0x432f('0x1d')]?_[_0x432f('0x1f')](_0x6a116e[_0x432f('0x18')][_0x432f('0x1d')],function(_0x3ad632){return{'model':db[_0x3ad632[_0x432f('0x1e')]],'as':_0x3ad632['as'],'attributes':_0x3ad632[_0x432f('0x1b')],'include':_0x3ad632['include']?_['map'](_0x3ad632[_0x432f('0x1d')],function(_0xa5e0d){return{'model':db[_0xa5e0d['model']],'as':_0xa5e0d['as'],'attributes':_0xa5e0d['attributes'],'include':_0xa5e0d['include']?_[_0x432f('0x1f')](_0xa5e0d[_0x432f('0x1d')],function(_0x5648a7){return{'model':db[_0x5648a7[_0x432f('0x1e')]],'as':_0x5648a7['as'],'attributes':_0x5648a7[_0x432f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x432f('0xb')](function(_0x5903f6){logger[_0x432f('0xc')](_0x432f('0x21'),_0x6a116e);logger['debug'](_0x432f('0x21'),_0x6a116e,JSON[_0x432f('0x10')](_0x5903f6));_0x48139b(_0x5903f6);})['catch'](function(_0x28da2e){logger[_0x432f('0x11')](_0x432f('0x21'),_0x28da2e[_0x432f('0x13')],_0x6a116e);_0x5ee0fa(_0x24406a[_0x432f('0x11')](0x1f4,_0x28da2e[_0x432f('0x13')]));});});}; \ No newline at end of file +var _0xbff5=['attributes','limit','include','map','model','GetFreshsalesAccount','FreshsalesAccount','find','raw','ShowFreshsalesAccount','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','findAll','options','where'];(function(_0x5b3e06,_0x91af7b){var _0x5bf864=function(_0x154dc0){while(--_0x154dc0){_0x5b3e06['push'](_0x5b3e06['shift']());}};_0x5bf864(++_0x91af7b);}(_0xbff5,0x1bc));var _0x5bff=function(_0xfcc34a,_0x1dcef9){_0xfcc34a=_0xfcc34a-0x0;var _0x50ff8c=_0xbff5[_0xfcc34a];return _0x50ff8c;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var moment=require(_0x5bff('0x2'));var BPromise=require(_0x5bff('0x3'));var rs=require(_0x5bff('0x4'));var fs=require('fs');var Redis=require(_0x5bff('0x5'));var db=require(_0x5bff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bff('0x8'));var client=jayson[_0x5bff('0x9')][_0x5bff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa54c57,_0x43605a,_0xd4b9dc){return new BPromise(function(_0x1acb49,_0x139c99){return client[_0x5bff('0xb')](_0xa54c57,_0xd4b9dc)['then'](function(_0x20e26f){logger['info'](_0x5bff('0xc'),_0x43605a,_0x5bff('0xd'));logger['debug'](_0x5bff('0xe'),_0x43605a,'request\x20sent',JSON[_0x5bff('0xf')](_0x20e26f));if(_0x20e26f['error']){if(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x11')]===0x1f4){logger['error'](_0x5bff('0xc'),_0x43605a,_0x20e26f['error'][_0x5bff('0x12')]);return _0x139c99(_0x20e26f[_0x5bff('0x10')]['message']);}logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x20e26f['error']['message']);return _0x1acb49(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x12')]);}else{logger[_0x5bff('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x43605a,_0x5bff('0xd'));_0x1acb49(_0x20e26f[_0x5bff('0x14')][_0x5bff('0x12')]);}})['catch'](function(_0x3ffbbc){logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x3ffbbc);_0x139c99(_0x3ffbbc);});});}exports['GetFreshsalesAccount']=function(_0xc9fbc3){var _0x279c22=this;return new Promise(function(_0x36653b,_0x32cf60){return db['FreshsalesAccount'][_0x5bff('0x15')]({'raw':_0xc9fbc3['options']?_0xc9fbc3[_0x5bff('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x17')]||null:null,'attributes':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x18')]||null:null,'limit':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x19')]||null:null,'include':_0xc9fbc3['options']?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x1a')],function(_0x31d26b){return{'model':db[_0x31d26b[_0x5bff('0x1c')]],'as':_0x31d26b['as'],'attributes':_0x31d26b[_0x5bff('0x18')],'include':_0x31d26b['include']?_['map'](_0x31d26b[_0x5bff('0x1a')],function(_0x53bd97){return{'model':db[_0x53bd97[_0x5bff('0x1c')]],'as':_0x53bd97['as'],'attributes':_0x53bd97[_0x5bff('0x18')],'include':_0x53bd97[_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0x53bd97[_0x5bff('0x1a')],function(_0x1140eb){return{'model':db[_0x1140eb[_0x5bff('0x1c')]],'as':_0x1140eb['as'],'attributes':_0x1140eb[_0x5bff('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4df57a){logger[_0x5bff('0x13')](_0x5bff('0x1d'),_0xc9fbc3);logger['debug'](_0x5bff('0x1d'),_0xc9fbc3,JSON['stringify'](_0x4df57a));_0x36653b(_0x4df57a);})['catch'](function(_0x3eda3a){logger['error'](_0x5bff('0x1d'),_0x3eda3a[_0x5bff('0x12')],_0xc9fbc3);_0x32cf60(_0x279c22[_0x5bff('0x10')](0x1f4,_0x3eda3a[_0x5bff('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x71783){var _0x4ee6f1=this;return new Promise(function(_0x3c1405,_0x5a7873){return db[_0x5bff('0x1e')][_0x5bff('0x1f')]({'raw':_0x71783[_0x5bff('0x16')]?_0x71783[_0x5bff('0x16')][_0x5bff('0x20')]===undefined?!![]:![]:!![],'where':_0x71783[_0x5bff('0x16')]?_0x71783['options'][_0x5bff('0x17')]||null:null,'attributes':_0x71783[_0x5bff('0x16')]?_0x71783[_0x5bff('0x16')][_0x5bff('0x18')]||null:null,'include':_0x71783[_0x5bff('0x16')]?_0x71783[_0x5bff('0x16')][_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0x71783['options'][_0x5bff('0x1a')],function(_0x16042d){return{'model':db[_0x16042d[_0x5bff('0x1c')]],'as':_0x16042d['as'],'attributes':_0x16042d[_0x5bff('0x18')],'include':_0x16042d['include']?_[_0x5bff('0x1b')](_0x16042d[_0x5bff('0x1a')],function(_0x5a24be){return{'model':db[_0x5a24be[_0x5bff('0x1c')]],'as':_0x5a24be['as'],'attributes':_0x5a24be[_0x5bff('0x18')],'include':_0x5a24be[_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0x5a24be['include'],function(_0x38245d){return{'model':db[_0x38245d[_0x5bff('0x1c')]],'as':_0x38245d['as'],'attributes':_0x38245d[_0x5bff('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1065d1){logger['info'](_0x5bff('0x21'),_0x71783);logger[_0x5bff('0x22')](_0x5bff('0x21'),_0x71783,JSON['stringify'](_0x1065d1));_0x3c1405(_0x1065d1);})[_0x5bff('0x23')](function(_0x1ec079){logger[_0x5bff('0x10')]('ShowFreshsalesAccount',_0x1ec079[_0x5bff('0x12')],_0x71783);_0x5a7873(_0x4ee6f1[_0x5bff('0x10')](0x1f4,_0x1ec079['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 4b2448b..c8e8f71 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 _0x423b=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','get','/:id','show','getDescriptions','/:id/fields','getFields','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x439a58,_0x3f9a13){var _0x35d29a=function(_0x472ecb){while(--_0x472ecb){_0x439a58['push'](_0x439a58['shift']());}};_0x35d29a(++_0x3f9a13);}(_0x423b,0x1a0));var _0xb423=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x423b[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require(_0xb423('0x0'));var util=require(_0xb423('0x1'));var path=require(_0xb423('0x2'));var timeout=require(_0xb423('0x3'));var express=require(_0xb423('0x4'));var router=express[_0xb423('0x5')]();var fs_extra=require(_0xb423('0x6'));var auth=require(_0xb423('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb423('0x8'));var controller=require(_0xb423('0x9'));router['get']('/',auth[_0xb423('0xa')](),controller['index']);router[_0xb423('0xb')](_0xb423('0xc'),auth[_0xb423('0xa')](),controller[_0xb423('0xd')]);router['get']('/:id/subjects',auth[_0xb423('0xa')](),controller['getSubjects']);router[_0xb423('0xb')]('/:id/descriptions',auth[_0xb423('0xa')](),controller[_0xb423('0xe')]);router['get'](_0xb423('0xf'),auth[_0xb423('0xa')](),controller[_0xb423('0x10')]);router['post']('/',auth[_0xb423('0xa')](),controller['create']);router[_0xb423('0x11')](_0xb423('0xc'),auth[_0xb423('0xa')](),controller['update']);router[_0xb423('0x12')](_0xb423('0xc'),auth[_0xb423('0xa')](),controller[_0xb423('0x13')]);module['exports']=router; \ No newline at end of file +var _0x157a=['/:id/descriptions','/:id/fields','getFields','create','put','exports','multer','util','path','express','Router','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects'];(function(_0x15d178,_0x533561){var _0xc73785=function(_0x30674c){while(--_0x30674c){_0x15d178['push'](_0x15d178['shift']());}};_0xc73785(++_0x533561);}(_0x157a,0x84));var _0xa157=function(_0x32cce8,_0x18762f){_0x32cce8=_0x32cce8-0x0;var _0x4a732b=_0x157a[_0x32cce8];return _0x4a732b;};'use strict';var multer=require(_0xa157('0x0'));var util=require(_0xa157('0x1'));var path=require(_0xa157('0x2'));var timeout=require('connect-timeout');var express=require(_0xa157('0x3'));var router=express[_0xa157('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa157('0x5'));router[_0xa157('0x6')]('/',auth[_0xa157('0x7')](),controller[_0xa157('0x8')]);router[_0xa157('0x6')](_0xa157('0x9'),auth['isAuthenticated'](),controller[_0xa157('0xa')]);router[_0xa157('0x6')](_0xa157('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xa157('0x6')](_0xa157('0xc'),auth[_0xa157('0x7')](),controller['getDescriptions']);router[_0xa157('0x6')](_0xa157('0xd'),auth[_0xa157('0x7')](),controller[_0xa157('0xe')]);router['post']('/',auth[_0xa157('0x7')](),controller[_0xa157('0xf')]);router[_0xa157('0x10')](_0xa157('0x9'),auth[_0xa157('0x7')](),controller['update']);router['delete']('/:id',auth[_0xa157('0x7')](),controller['destroy']);module[_0xa157('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 967cf45..3853239 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 _0xfec0=['STRING','sequelize'];(function(_0x1c1c64,_0x48300d){var _0x4d470b=function(_0x2a4aec){while(--_0x2a4aec){_0x1c1c64['push'](_0x1c1c64['shift']());}};_0x4d470b(++_0x48300d);}(_0xfec0,0x1eb));var _0x0fec=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xfec0[_0x2cf2e9];return _0xd3670d;};'use strict';var Sequelize=require(_0x0fec('0x0'));module['exports']={'name':{'type':Sequelize[_0x0fec('0x1')]},'description':{'type':Sequelize[_0x0fec('0x1')]}}; \ No newline at end of file +var _0xcacd=['sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcacd,0x108));var _0xdcac=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xcacd[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xdcac('0x0'));module[_0xdcac('0x1')]={'name':{'type':Sequelize[_0xdcac('0x2')]},'description':{'type':Sequelize[_0xdcac('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 041ba8b..87ca532 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 _0x45ce=['util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','end','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','options','includeAll','findAll','rows','params','find','catch','create','body','update','findOne','FreshsalesField','filter','getSubjects','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0xb5fe5f,_0x3e24a4){var _0x7e85a7=function(_0xf70992){while(--_0xf70992){_0xb5fe5f['push'](_0xb5fe5f['shift']());}};_0x7e85a7(++_0x3e24a4);}(_0x45ce,0x1c7));var _0xe45c=function(_0x5bc60e,_0x20e628){_0x5bc60e=_0x5bc60e-0x0;var _0x559cfc=_0x45ce[_0x5bc60e];return _0x559cfc;};'use strict';var emlformat=require(_0xe45c('0x0'));var rimraf=require(_0xe45c('0x1'));var zipdir=require(_0xe45c('0x2'));var jsonpatch=require(_0xe45c('0x3'));var rp=require(_0xe45c('0x4'));var moment=require(_0xe45c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe45c('0x6'));var util=require(_0xe45c('0x7'));var path=require(_0xe45c('0x8'));var sox=require(_0xe45c('0x9'));var csv=require(_0xe45c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe45c('0xb'));var _=require(_0xe45c('0xc'));var squel=require(_0xe45c('0xd'));var crypto=require(_0xe45c('0xe'));var jsforce=require(_0xe45c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe45c('0xa'));var querystring=require(_0xe45c('0x10'));var Papa=require(_0xe45c('0x11'));var Redis=require(_0xe45c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe45c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe45c('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xe45c('0x15'));var licenseUtil=require(_0xe45c('0x16'));var db=require(_0xe45c('0x17'))['db'];function respondWithStatusCode(_0x245e33,_0x516955){_0x516955=_0x516955||0xcc;return function(_0x164c07){if(_0x164c07){return _0x245e33[_0xe45c('0x18')](_0x516955);}return _0x245e33[_0xe45c('0x19')](_0x516955)['end']();};}function respondWithResult(_0x491e94,_0x22fdc2){_0x22fdc2=_0x22fdc2||0xc8;return function(_0x24b21b){if(_0x24b21b){return _0x491e94[_0xe45c('0x19')](_0x22fdc2)[_0xe45c('0x1a')](_0x24b21b);}};}function respondWithFilteredResult(_0xf13fe0,_0xe3a718){return function(_0x403ca1){if(_0x403ca1){var _0x27509a=typeof _0xe3a718[_0xe45c('0x1b')]===_0xe45c('0x1c')&&typeof _0xe3a718[_0xe45c('0x1d')]==='undefined';var _0xe47043=_0x403ca1[_0xe45c('0x1e')];var _0x2945bd=_0x27509a?0x0:_0xe3a718[_0xe45c('0x1b')];var _0x422bcb=_0x27509a?_0x403ca1[_0xe45c('0x1e')]:_0xe3a718['offset']+_0xe3a718[_0xe45c('0x1d')];var _0x5a2006;if(_0x422bcb>=_0xe47043){_0x422bcb=_0xe47043;_0x5a2006=0xc8;}else{_0x5a2006=0xce;}_0xf13fe0['status'](_0x5a2006);return _0xf13fe0['set'](_0xe45c('0x1f'),_0x2945bd+'-'+_0x422bcb+'/'+_0xe47043)['json'](_0x403ca1);}return null;};}function patchUpdates(_0xc94175){return function(_0x20aab0){try{jsonpatch[_0xe45c('0x20')](_0x20aab0,_0xc94175,!![]);}catch(_0x1bae28){return BPromise['reject'](_0x1bae28);}return _0x20aab0[_0xe45c('0x21')]();};}function saveUpdates(_0xb43429,_0x438daa){return function(_0x505977){if(_0x505977){return _0x505977['update'](_0xb43429)[_0xe45c('0x22')](function(_0xe84ba5){return _0xe84ba5;});}return null;};}function removeEntity(_0x1b3883,_0x3232a6){return function(_0x5316fc){if(_0x5316fc){return _0x5316fc[_0xe45c('0x23')]()['then'](function(){_0x1b3883[_0xe45c('0x19')](0xcc)[_0xe45c('0x24')]();});}};}function handleEntityNotFound(_0x51eda0,_0x9a3df8){return function(_0x24fcf9){if(!_0x24fcf9){_0x51eda0['sendStatus'](0x194);}return _0x24fcf9;};}function handleError(_0x3c6375,_0x2062a1){_0x2062a1=_0x2062a1||0x1f4;return function(_0x57bf9f){logger['error'](_0x57bf9f['stack']);if(_0x57bf9f[_0xe45c('0x25')]){delete _0x57bf9f[_0xe45c('0x25')];}_0x3c6375[_0xe45c('0x19')](_0x2062a1)[_0xe45c('0x26')](_0x57bf9f);};}exports[_0xe45c('0x27')]=function(_0x2da1fa,_0xcab6c6){var _0x2cc0ef={},_0x168652={},_0x5433af={'count':0x0,'rows':[]};var _0x561e8b=_[_0xe45c('0x28')](db[_0xe45c('0x29')][_0xe45c('0x2a')],function(_0x634cda){return{'name':_0x634cda[_0xe45c('0x2b')],'type':_0x634cda[_0xe45c('0x2c')][_0xe45c('0x2d')]};});_0x168652[_0xe45c('0x2e')]=_[_0xe45c('0x28')](_0x561e8b,_0xe45c('0x25'));_0x168652[_0xe45c('0x2f')]=_[_0xe45c('0x30')](_0x2da1fa['query']);_0x168652['filters']=_['intersection'](_0x168652[_0xe45c('0x2e')],_0x168652[_0xe45c('0x2f')]);_0x2cc0ef['attributes']=_[_0xe45c('0x31')](_0x168652['model'],qs[_0xe45c('0x32')](_0x2da1fa[_0xe45c('0x2f')][_0xe45c('0x32')]));_0x2cc0ef[_0xe45c('0x33')]=_0x2cc0ef['attributes'][_0xe45c('0x34')]?_0x2cc0ef[_0xe45c('0x33')]:_0x168652[_0xe45c('0x2e')];if(!_0x2da1fa['query'][_0xe45c('0x35')](_0xe45c('0x36'))){_0x2cc0ef[_0xe45c('0x1d')]=qs[_0xe45c('0x1d')](_0x2da1fa[_0xe45c('0x2f')][_0xe45c('0x1d')]);_0x2cc0ef[_0xe45c('0x1b')]=qs[_0xe45c('0x1b')](_0x2da1fa[_0xe45c('0x2f')][_0xe45c('0x1b')]);}_0x2cc0ef[_0xe45c('0x37')]=qs[_0xe45c('0x38')](_0x2da1fa[_0xe45c('0x2f')][_0xe45c('0x38')]);_0x2cc0ef['where']=qs[_0xe45c('0x39')](_[_0xe45c('0x3a')](_0x2da1fa[_0xe45c('0x2f')],_0x168652[_0xe45c('0x39')]),_0x561e8b);if(_0x2da1fa[_0xe45c('0x2f')]['filter']){_0x2cc0ef[_0xe45c('0x3b')]=_[_0xe45c('0x3c')](_0x2cc0ef[_0xe45c('0x3b')],{'$or':_[_0xe45c('0x28')](_0x561e8b,function(_0x3b51ae){if(_0x3b51ae[_0xe45c('0x2c')]!=='VIRTUAL'){var _0x1f8dfa={};_0x1f8dfa[_0x3b51ae[_0xe45c('0x25')]]={'$like':'%'+_0x2da1fa[_0xe45c('0x2f')]['filter']+'%'};return _0x1f8dfa;}})});}_0x2cc0ef=_[_0xe45c('0x3c')]({},_0x2cc0ef,_0x2da1fa[_0xe45c('0x3d')]);var _0x1363b3={'where':_0x2cc0ef[_0xe45c('0x3b')]};return db[_0xe45c('0x29')][_0xe45c('0x1e')](_0x1363b3)[_0xe45c('0x22')](function(_0x5a910e){_0x5433af[_0xe45c('0x1e')]=_0x5a910e;if(_0x2da1fa[_0xe45c('0x2f')][_0xe45c('0x3e')]){_0x2cc0ef['include']=[{'all':!![]}];}return db[_0xe45c('0x29')][_0xe45c('0x3f')](_0x2cc0ef);})[_0xe45c('0x22')](function(_0x4669a6){_0x5433af[_0xe45c('0x40')]=_0x4669a6;return _0x5433af;})[_0xe45c('0x22')](respondWithFilteredResult(_0xcab6c6,_0x2cc0ef))['catch'](handleError(_0xcab6c6,null));};exports['show']=function(_0x3e405a,_0x26a647){var _0x4ebdae={'raw':![],'where':{'id':_0x3e405a[_0xe45c('0x41')]['id']}},_0x414d24={};_0x414d24[_0xe45c('0x2e')]=_[_0xe45c('0x30')](db[_0xe45c('0x29')][_0xe45c('0x2a')]);_0x414d24['query']=_[_0xe45c('0x30')](_0x3e405a[_0xe45c('0x2f')]);_0x414d24[_0xe45c('0x39')]=_['intersection'](_0x414d24['model'],_0x414d24[_0xe45c('0x2f')]);_0x4ebdae['attributes']=_['intersection'](_0x414d24[_0xe45c('0x2e')],qs[_0xe45c('0x32')](_0x3e405a[_0xe45c('0x2f')][_0xe45c('0x32')]));_0x4ebdae[_0xe45c('0x33')]=_0x4ebdae[_0xe45c('0x33')]['length']?_0x4ebdae['attributes']:_0x414d24[_0xe45c('0x2e')];if(_0x3e405a[_0xe45c('0x2f')][_0xe45c('0x3e')]){_0x4ebdae['include']=[{'all':!![]}];}_0x4ebdae=_[_0xe45c('0x3c')]({},_0x4ebdae,_0x3e405a['options']);return db['FreshsalesConfiguration'][_0xe45c('0x42')](_0x4ebdae)[_0xe45c('0x22')](handleEntityNotFound(_0x26a647,null))[_0xe45c('0x22')](respondWithResult(_0x26a647,null))[_0xe45c('0x43')](handleError(_0x26a647,null));};exports[_0xe45c('0x44')]=function(_0x555f6e,_0x2937aa){return db[_0xe45c('0x29')][_0xe45c('0x44')](_0x555f6e[_0xe45c('0x45')],{})[_0xe45c('0x22')](respondWithResult(_0x2937aa,0xc9))[_0xe45c('0x43')](handleError(_0x2937aa,null));};exports[_0xe45c('0x46')]=function(_0x3ef264,_0x184364){if(_0x3ef264[_0xe45c('0x45')]['id']){delete _0x3ef264[_0xe45c('0x45')]['id'];}return db[_0xe45c('0x29')][_0xe45c('0x42')]({'where':{'id':_0x3ef264[_0xe45c('0x41')]['id']}})[_0xe45c('0x22')](handleEntityNotFound(_0x184364,null))[_0xe45c('0x22')](saveUpdates(_0x3ef264[_0xe45c('0x45')],null))[_0xe45c('0x22')](respondWithResult(_0x184364,null))[_0xe45c('0x43')](handleError(_0x184364,null));};exports[_0xe45c('0x23')]=function(_0x42ed62,_0x411c61){return db[_0xe45c('0x29')]['find']({'where':{'id':_0x42ed62[_0xe45c('0x41')]['id']}})[_0xe45c('0x22')](handleEntityNotFound(_0x411c61,null))[_0xe45c('0x22')](removeEntity(_0x411c61,null))[_0xe45c('0x43')](handleError(_0x411c61,null));};exports['getSubjects']=function(_0xfd709a,_0x27072d,_0x535878){var _0x37734c={};var _0x569e8b={};var _0x42fe69;var _0x1a3d99;return db[_0xe45c('0x29')][_0xe45c('0x47')]({'where':{'id':_0xfd709a[_0xe45c('0x41')]['id']}})[_0xe45c('0x22')](handleEntityNotFound(_0x27072d,null))[_0xe45c('0x22')](function(_0x4557de){if(_0x4557de){_0x42fe69=_0x4557de;_0x569e8b[_0xe45c('0x2e')]=_['keys'](db[_0xe45c('0x48')][_0xe45c('0x2a')]);_0x569e8b['query']=_['keys'](_0xfd709a['query']);_0x569e8b[_0xe45c('0x39')]=_[_0xe45c('0x31')](_0x569e8b[_0xe45c('0x2e')],_0x569e8b[_0xe45c('0x2f')]);_0x37734c[_0xe45c('0x33')]=_['intersection'](_0x569e8b[_0xe45c('0x2e')],qs[_0xe45c('0x32')](_0xfd709a[_0xe45c('0x2f')][_0xe45c('0x32')]));_0x37734c[_0xe45c('0x33')]=_0x37734c[_0xe45c('0x33')][_0xe45c('0x34')]?_0x37734c['attributes']:_0x569e8b[_0xe45c('0x2e')];_0x37734c['order']=qs[_0xe45c('0x38')](_0xfd709a[_0xe45c('0x2f')][_0xe45c('0x38')]);_0x37734c['where']=qs[_0xe45c('0x39')](_['pick'](_0xfd709a[_0xe45c('0x2f')],_0x569e8b[_0xe45c('0x39')]));if(_0xfd709a[_0xe45c('0x2f')]['filter']){_0x37734c['where']=_[_0xe45c('0x3c')](_0x37734c['where'],{'$or':_[_0xe45c('0x28')](_0x37734c[_0xe45c('0x33')],function(_0x4fcba6){var _0x2d90cf={};_0x2d90cf[_0x4fcba6]={'$like':'%'+_0xfd709a[_0xe45c('0x2f')][_0xe45c('0x49')]+'%'};return _0x2d90cf;})});}_0x37734c=_[_0xe45c('0x3c')]({},_0x37734c,_0xfd709a[_0xe45c('0x3d')]);return _0x42fe69[_0xe45c('0x4a')](_0x37734c);}})['then'](function(_0x3dc346){if(_0x3dc346){_0x1a3d99=_0x3dc346[_0xe45c('0x34')];if(!_0xfd709a[_0xe45c('0x2f')]['hasOwnProperty']('nolimit')){_0x37734c[_0xe45c('0x1d')]=qs[_0xe45c('0x1d')](_0xfd709a['query'][_0xe45c('0x1d')]);_0x37734c[_0xe45c('0x1b')]=qs[_0xe45c('0x1b')](_0xfd709a[_0xe45c('0x2f')]['offset']);}return _0x42fe69[_0xe45c('0x4a')](_0x37734c);}})[_0xe45c('0x22')](function(_0x40b02b){if(_0x40b02b){return _0x40b02b?{'count':_0x1a3d99,'rows':_0x40b02b}:null;}})[_0xe45c('0x22')](respondWithResult(_0x27072d,null))[_0xe45c('0x43')](handleError(_0x27072d,null));};exports[_0xe45c('0x4b')]=function(_0x2bba99,_0x28925a,_0x1a71ee){var _0x3ee2ef={};var _0x351efe={};var _0x3aa8da;var _0x5d70d3;return db['FreshsalesConfiguration'][_0xe45c('0x47')]({'where':{'id':_0x2bba99[_0xe45c('0x41')]['id']}})[_0xe45c('0x22')](handleEntityNotFound(_0x28925a,null))['then'](function(_0xe17da6){if(_0xe17da6){_0x3aa8da=_0xe17da6;_0x351efe[_0xe45c('0x2e')]=_[_0xe45c('0x30')](db[_0xe45c('0x48')][_0xe45c('0x2a')]);_0x351efe[_0xe45c('0x2f')]=_[_0xe45c('0x30')](_0x2bba99[_0xe45c('0x2f')]);_0x351efe['filters']=_[_0xe45c('0x31')](_0x351efe[_0xe45c('0x2e')],_0x351efe['query']);_0x3ee2ef[_0xe45c('0x33')]=_[_0xe45c('0x31')](_0x351efe[_0xe45c('0x2e')],qs[_0xe45c('0x32')](_0x2bba99['query'][_0xe45c('0x32')]));_0x3ee2ef[_0xe45c('0x33')]=_0x3ee2ef[_0xe45c('0x33')][_0xe45c('0x34')]?_0x3ee2ef['attributes']:_0x351efe['model'];_0x3ee2ef[_0xe45c('0x37')]=qs[_0xe45c('0x38')](_0x2bba99['query']['sort']);_0x3ee2ef[_0xe45c('0x3b')]=qs[_0xe45c('0x39')](_['pick'](_0x2bba99[_0xe45c('0x2f')],_0x351efe[_0xe45c('0x39')]));if(_0x2bba99[_0xe45c('0x2f')]['filter']){_0x3ee2ef[_0xe45c('0x3b')]=_[_0xe45c('0x3c')](_0x3ee2ef['where'],{'$or':_[_0xe45c('0x28')](_0x3ee2ef[_0xe45c('0x33')],function(_0x5013e){var _0x10b268={};_0x10b268[_0x5013e]={'$like':'%'+_0x2bba99[_0xe45c('0x2f')][_0xe45c('0x49')]+'%'};return _0x10b268;})});}_0x3ee2ef=_[_0xe45c('0x3c')]({},_0x3ee2ef,_0x2bba99[_0xe45c('0x3d')]);return _0x3aa8da['getDescriptions'](_0x3ee2ef);}})[_0xe45c('0x22')](function(_0x47913f){if(_0x47913f){_0x5d70d3=_0x47913f[_0xe45c('0x34')];if(!_0x2bba99[_0xe45c('0x2f')][_0xe45c('0x35')](_0xe45c('0x36'))){_0x3ee2ef[_0xe45c('0x1d')]=qs[_0xe45c('0x1d')](_0x2bba99[_0xe45c('0x2f')][_0xe45c('0x1d')]);_0x3ee2ef[_0xe45c('0x1b')]=qs[_0xe45c('0x1b')](_0x2bba99[_0xe45c('0x2f')][_0xe45c('0x1b')]);}return _0x3aa8da[_0xe45c('0x4b')](_0x3ee2ef);}})['then'](function(_0x5c10ab){if(_0x5c10ab){return _0x5c10ab?{'count':_0x5d70d3,'rows':_0x5c10ab}:null;}})[_0xe45c('0x22')](respondWithResult(_0x28925a,null))['catch'](handleError(_0x28925a,null));};exports['getFields']=function(_0x5db1a6,_0x467ce3,_0x3cd4f9){var _0x5c0477={};var _0x12529d={};var _0x5cdd9d;var _0x250d6f;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x5db1a6[_0xe45c('0x41')]['id']}})[_0xe45c('0x22')](handleEntityNotFound(_0x467ce3,null))[_0xe45c('0x22')](function(_0x20d095){if(_0x20d095){_0x5cdd9d=_0x20d095;_0x12529d[_0xe45c('0x2e')]=_[_0xe45c('0x30')](db[_0xe45c('0x48')][_0xe45c('0x2a')]);_0x12529d['query']=_[_0xe45c('0x30')](_0x5db1a6['query']);_0x12529d[_0xe45c('0x39')]=_[_0xe45c('0x31')](_0x12529d[_0xe45c('0x2e')],_0x12529d['query']);_0x5c0477[_0xe45c('0x33')]=_[_0xe45c('0x31')](_0x12529d['model'],qs[_0xe45c('0x32')](_0x5db1a6['query'][_0xe45c('0x32')]));_0x5c0477[_0xe45c('0x33')]=_0x5c0477[_0xe45c('0x33')]['length']?_0x5c0477[_0xe45c('0x33')]:_0x12529d[_0xe45c('0x2e')];_0x5c0477[_0xe45c('0x37')]=qs[_0xe45c('0x38')](_0x5db1a6[_0xe45c('0x2f')][_0xe45c('0x38')]);_0x5c0477[_0xe45c('0x3b')]=qs['filters'](_['pick'](_0x5db1a6['query'],_0x12529d[_0xe45c('0x39')]));if(_0x5db1a6['query']['filter']){_0x5c0477['where']=_['merge'](_0x5c0477[_0xe45c('0x3b')],{'$or':_[_0xe45c('0x28')](_0x5c0477[_0xe45c('0x33')],function(_0x2fc702){var _0x59c3ff={};_0x59c3ff[_0x2fc702]={'$like':'%'+_0x5db1a6['query']['filter']+'%'};return _0x59c3ff;})});}_0x5c0477=_[_0xe45c('0x3c')]({},_0x5c0477,_0x5db1a6[_0xe45c('0x3d')]);return _0x5cdd9d[_0xe45c('0x4c')](_0x5c0477);}})[_0xe45c('0x22')](function(_0x1fa7b3){if(_0x1fa7b3){_0x250d6f=_0x1fa7b3['length'];if(!_0x5db1a6[_0xe45c('0x2f')][_0xe45c('0x35')](_0xe45c('0x36'))){_0x5c0477[_0xe45c('0x1d')]=qs[_0xe45c('0x1d')](_0x5db1a6[_0xe45c('0x2f')][_0xe45c('0x1d')]);_0x5c0477[_0xe45c('0x1b')]=qs[_0xe45c('0x1b')](_0x5db1a6['query']['offset']);}return _0x5cdd9d['getFields'](_0x5c0477);}})[_0xe45c('0x22')](function(_0x10018c){if(_0x10018c){return _0x10018c?{'count':_0x250d6f,'rows':_0x10018c}:null;}})[_0xe45c('0x22')](respondWithResult(_0x467ce3,null))[_0xe45c('0x43')](handleError(_0x467ce3,null));}; \ No newline at end of file +var _0x8678=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','FreshsalesConfiguration','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','includeAll','include','findAll','catch','show','options','create','body','find','params','getSubjects','rawAttributes','order','pick','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0x8678,0x90));var _0x8867=function(_0x5b2f5b,_0x5a38d8){_0x5b2f5b=_0x5b2f5b-0x0;var _0x330b3b=_0x8678[_0x5b2f5b];return _0x330b3b;};'use strict';var emlformat=require(_0x8867('0x0'));var rimraf=require(_0x8867('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8867('0x2'));var rp=require(_0x8867('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8867('0x4'));var util=require(_0x8867('0x5'));var path=require(_0x8867('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8867('0x7'));var fs=require('fs');var fs_extra=require(_0x8867('0x8'));var _=require('lodash');var squel=require(_0x8867('0x9'));var crypto=require(_0x8867('0xa'));var jsforce=require(_0x8867('0xb'));var deskjs=require(_0x8867('0xc'));var toCsv=require(_0x8867('0xd'));var querystring=require(_0x8867('0xe'));var Papa=require(_0x8867('0xf'));var Redis=require(_0x8867('0x10'));var authService=require(_0x8867('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8867('0x12'));var logger=require(_0x8867('0x13'))('api');var utils=require(_0x8867('0x14'));var config=require(_0x8867('0x15'));var licenseUtil=require(_0x8867('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50e745,_0x51b6bb){_0x51b6bb=_0x51b6bb||0xcc;return function(_0x57e1c3){if(_0x57e1c3){return _0x50e745['sendStatus'](_0x51b6bb);}return _0x50e745[_0x8867('0x17')](_0x51b6bb)['end']();};}function respondWithResult(_0x5244e5,_0x3b1ecd){_0x3b1ecd=_0x3b1ecd||0xc8;return function(_0x4fa69c){if(_0x4fa69c){return _0x5244e5[_0x8867('0x17')](_0x3b1ecd)[_0x8867('0x18')](_0x4fa69c);}};}function respondWithFilteredResult(_0x50f762,_0x2d771a){return function(_0x14186f){if(_0x14186f){var _0x27737b=typeof _0x2d771a[_0x8867('0x19')]===_0x8867('0x1a')&&typeof _0x2d771a[_0x8867('0x1b')]===_0x8867('0x1a');var _0x4fdead=_0x14186f['count'];var _0x201943=_0x27737b?0x0:_0x2d771a['offset'];var _0x5e852a=_0x27737b?_0x14186f[_0x8867('0x1c')]:_0x2d771a['offset']+_0x2d771a[_0x8867('0x1b')];var _0x4b05de;if(_0x5e852a>=_0x4fdead){_0x5e852a=_0x4fdead;_0x4b05de=0xc8;}else{_0x4b05de=0xce;}_0x50f762['status'](_0x4b05de);return _0x50f762[_0x8867('0x1d')](_0x8867('0x1e'),_0x201943+'-'+_0x5e852a+'/'+_0x4fdead)[_0x8867('0x18')](_0x14186f);}return null;};}function patchUpdates(_0x55b16c){return function(_0xf8b0cc){try{jsonpatch[_0x8867('0x1f')](_0xf8b0cc,_0x55b16c,!![]);}catch(_0x2b9b77){return BPromise[_0x8867('0x20')](_0x2b9b77);}return _0xf8b0cc['save']();};}function saveUpdates(_0x125524,_0x24f7d7){return function(_0x5df5b1){if(_0x5df5b1){return _0x5df5b1[_0x8867('0x21')](_0x125524)[_0x8867('0x22')](function(_0x489a87){return _0x489a87;});}return null;};}function removeEntity(_0x18a58e,_0xa22e96){return function(_0x890928){if(_0x890928){return _0x890928[_0x8867('0x23')]()[_0x8867('0x22')](function(){_0x18a58e[_0x8867('0x17')](0xcc)[_0x8867('0x24')]();});}};}function handleEntityNotFound(_0x497eca,_0x27d796){return function(_0x37e5d2){if(!_0x37e5d2){_0x497eca[_0x8867('0x25')](0x194);}return _0x37e5d2;};}function handleError(_0x1470db,_0x5e2dc9){_0x5e2dc9=_0x5e2dc9||0x1f4;return function(_0xef5c05){logger[_0x8867('0x26')](_0xef5c05['stack']);if(_0xef5c05[_0x8867('0x27')]){delete _0xef5c05[_0x8867('0x27')];}_0x1470db[_0x8867('0x17')](_0x5e2dc9)[_0x8867('0x28')](_0xef5c05);};}exports['index']=function(_0x45b2b5,_0x4cfba1){var _0x2d0fe8={},_0x474d71={},_0x3f27f7={'count':0x0,'rows':[]};var _0x5c4484=_['map'](db[_0x8867('0x29')]['rawAttributes'],function(_0x402b06){return{'name':_0x402b06[_0x8867('0x2a')],'type':_0x402b06[_0x8867('0x2b')][_0x8867('0x2c')]};});_0x474d71[_0x8867('0x2d')]=_[_0x8867('0x2e')](_0x5c4484,_0x8867('0x27'));_0x474d71[_0x8867('0x2f')]=_[_0x8867('0x30')](_0x45b2b5[_0x8867('0x2f')]);_0x474d71['filters']=_[_0x8867('0x31')](_0x474d71[_0x8867('0x2d')],_0x474d71[_0x8867('0x2f')]);_0x2d0fe8['attributes']=_['intersection'](_0x474d71[_0x8867('0x2d')],qs[_0x8867('0x32')](_0x45b2b5[_0x8867('0x2f')][_0x8867('0x32')]));_0x2d0fe8[_0x8867('0x33')]=_0x2d0fe8[_0x8867('0x33')][_0x8867('0x34')]?_0x2d0fe8[_0x8867('0x33')]:_0x474d71['model'];if(!_0x45b2b5[_0x8867('0x2f')][_0x8867('0x35')](_0x8867('0x36'))){_0x2d0fe8[_0x8867('0x1b')]=qs[_0x8867('0x1b')](_0x45b2b5[_0x8867('0x2f')][_0x8867('0x1b')]);_0x2d0fe8[_0x8867('0x19')]=qs['offset'](_0x45b2b5[_0x8867('0x2f')][_0x8867('0x19')]);}_0x2d0fe8['order']=qs[_0x8867('0x37')](_0x45b2b5[_0x8867('0x2f')][_0x8867('0x37')]);_0x2d0fe8[_0x8867('0x38')]=qs[_0x8867('0x39')](_['pick'](_0x45b2b5[_0x8867('0x2f')],_0x474d71['filters']),_0x5c4484);if(_0x45b2b5[_0x8867('0x2f')][_0x8867('0x3a')]){_0x2d0fe8[_0x8867('0x38')]=_[_0x8867('0x3b')](_0x2d0fe8['where'],{'$or':_[_0x8867('0x2e')](_0x5c4484,function(_0x280677){if(_0x280677['type']!=='VIRTUAL'){var _0x4f2dc1={};_0x4f2dc1[_0x280677['name']]={'$like':'%'+_0x45b2b5[_0x8867('0x2f')][_0x8867('0x3a')]+'%'};return _0x4f2dc1;}})});}_0x2d0fe8=_['merge']({},_0x2d0fe8,_0x45b2b5['options']);var _0x368680={'where':_0x2d0fe8[_0x8867('0x38')]};return db[_0x8867('0x29')]['count'](_0x368680)['then'](function(_0xc6f70){_0x3f27f7[_0x8867('0x1c')]=_0xc6f70;if(_0x45b2b5[_0x8867('0x2f')][_0x8867('0x3c')]){_0x2d0fe8[_0x8867('0x3d')]=[{'all':!![]}];}return db[_0x8867('0x29')][_0x8867('0x3e')](_0x2d0fe8);})['then'](function(_0x2089d1){_0x3f27f7['rows']=_0x2089d1;return _0x3f27f7;})[_0x8867('0x22')](respondWithFilteredResult(_0x4cfba1,_0x2d0fe8))[_0x8867('0x3f')](handleError(_0x4cfba1,null));};exports[_0x8867('0x40')]=function(_0x28159f,_0x1f1476){var _0x1fe902={'raw':![],'where':{'id':_0x28159f['params']['id']}},_0x5d1b24={};_0x5d1b24['model']=_['keys'](db[_0x8867('0x29')]['rawAttributes']);_0x5d1b24[_0x8867('0x2f')]=_[_0x8867('0x30')](_0x28159f[_0x8867('0x2f')]);_0x5d1b24['filters']=_[_0x8867('0x31')](_0x5d1b24[_0x8867('0x2d')],_0x5d1b24[_0x8867('0x2f')]);_0x1fe902[_0x8867('0x33')]=_[_0x8867('0x31')](_0x5d1b24[_0x8867('0x2d')],qs[_0x8867('0x32')](_0x28159f[_0x8867('0x2f')][_0x8867('0x32')]));_0x1fe902[_0x8867('0x33')]=_0x1fe902[_0x8867('0x33')]['length']?_0x1fe902[_0x8867('0x33')]:_0x5d1b24[_0x8867('0x2d')];if(_0x28159f[_0x8867('0x2f')]['includeAll']){_0x1fe902['include']=[{'all':!![]}];}_0x1fe902=_['merge']({},_0x1fe902,_0x28159f[_0x8867('0x41')]);return db['FreshsalesConfiguration']['find'](_0x1fe902)[_0x8867('0x22')](handleEntityNotFound(_0x1f1476,null))['then'](respondWithResult(_0x1f1476,null))[_0x8867('0x3f')](handleError(_0x1f1476,null));};exports[_0x8867('0x42')]=function(_0xf68536,_0x173db9){return db[_0x8867('0x29')]['create'](_0xf68536[_0x8867('0x43')],{})[_0x8867('0x22')](respondWithResult(_0x173db9,0xc9))[_0x8867('0x3f')](handleError(_0x173db9,null));};exports['update']=function(_0x8d77fa,_0x17b058){if(_0x8d77fa[_0x8867('0x43')]['id']){delete _0x8d77fa[_0x8867('0x43')]['id'];}return db[_0x8867('0x29')][_0x8867('0x44')]({'where':{'id':_0x8d77fa[_0x8867('0x45')]['id']}})['then'](handleEntityNotFound(_0x17b058,null))[_0x8867('0x22')](saveUpdates(_0x8d77fa[_0x8867('0x43')],null))[_0x8867('0x22')](respondWithResult(_0x17b058,null))[_0x8867('0x3f')](handleError(_0x17b058,null));};exports[_0x8867('0x23')]=function(_0x10646e,_0x3bf910){return db[_0x8867('0x29')]['find']({'where':{'id':_0x10646e['params']['id']}})['then'](handleEntityNotFound(_0x3bf910,null))['then'](removeEntity(_0x3bf910,null))['catch'](handleError(_0x3bf910,null));};exports[_0x8867('0x46')]=function(_0x2290f1,_0x430bfc,_0x2f61e0){var _0x51fa90={};var _0x1723ca={};var _0x5d6ee5;var _0x1f6284;return db[_0x8867('0x29')]['findOne']({'where':{'id':_0x2290f1[_0x8867('0x45')]['id']}})[_0x8867('0x22')](handleEntityNotFound(_0x430bfc,null))[_0x8867('0x22')](function(_0x2b294b){if(_0x2b294b){_0x5d6ee5=_0x2b294b;_0x1723ca[_0x8867('0x2d')]=_[_0x8867('0x30')](db['FreshsalesField'][_0x8867('0x47')]);_0x1723ca[_0x8867('0x2f')]=_['keys'](_0x2290f1[_0x8867('0x2f')]);_0x1723ca[_0x8867('0x39')]=_['intersection'](_0x1723ca[_0x8867('0x2d')],_0x1723ca['query']);_0x51fa90[_0x8867('0x33')]=_[_0x8867('0x31')](_0x1723ca[_0x8867('0x2d')],qs[_0x8867('0x32')](_0x2290f1[_0x8867('0x2f')][_0x8867('0x32')]));_0x51fa90[_0x8867('0x33')]=_0x51fa90[_0x8867('0x33')]['length']?_0x51fa90[_0x8867('0x33')]:_0x1723ca['model'];_0x51fa90[_0x8867('0x48')]=qs['sort'](_0x2290f1[_0x8867('0x2f')][_0x8867('0x37')]);_0x51fa90[_0x8867('0x38')]=qs[_0x8867('0x39')](_[_0x8867('0x49')](_0x2290f1[_0x8867('0x2f')],_0x1723ca[_0x8867('0x39')]));if(_0x2290f1[_0x8867('0x2f')][_0x8867('0x3a')]){_0x51fa90[_0x8867('0x38')]=_[_0x8867('0x3b')](_0x51fa90['where'],{'$or':_[_0x8867('0x2e')](_0x51fa90[_0x8867('0x33')],function(_0x35d99c){var _0x15154d={};_0x15154d[_0x35d99c]={'$like':'%'+_0x2290f1[_0x8867('0x2f')][_0x8867('0x3a')]+'%'};return _0x15154d;})});}_0x51fa90=_['merge']({},_0x51fa90,_0x2290f1[_0x8867('0x41')]);return _0x5d6ee5[_0x8867('0x46')](_0x51fa90);}})['then'](function(_0x1d1371){if(_0x1d1371){_0x1f6284=_0x1d1371['length'];if(!_0x2290f1['query'][_0x8867('0x35')](_0x8867('0x36'))){_0x51fa90[_0x8867('0x1b')]=qs[_0x8867('0x1b')](_0x2290f1[_0x8867('0x2f')][_0x8867('0x1b')]);_0x51fa90[_0x8867('0x19')]=qs['offset'](_0x2290f1[_0x8867('0x2f')]['offset']);}return _0x5d6ee5[_0x8867('0x46')](_0x51fa90);}})[_0x8867('0x22')](function(_0x2f61e7){if(_0x2f61e7){return _0x2f61e7?{'count':_0x1f6284,'rows':_0x2f61e7}:null;}})[_0x8867('0x22')](respondWithResult(_0x430bfc,null))[_0x8867('0x3f')](handleError(_0x430bfc,null));};exports['getDescriptions']=function(_0x53fa98,_0x2c18eb,_0x5385e2){var _0x13489d={};var _0x2eb66c={};var _0x483d39;var _0x2efdbe;return db[_0x8867('0x29')][_0x8867('0x4a')]({'where':{'id':_0x53fa98[_0x8867('0x45')]['id']}})[_0x8867('0x22')](handleEntityNotFound(_0x2c18eb,null))[_0x8867('0x22')](function(_0x4c25c4){if(_0x4c25c4){_0x483d39=_0x4c25c4;_0x2eb66c[_0x8867('0x2d')]=_['keys'](db[_0x8867('0x4b')]['rawAttributes']);_0x2eb66c[_0x8867('0x2f')]=_[_0x8867('0x30')](_0x53fa98['query']);_0x2eb66c['filters']=_[_0x8867('0x31')](_0x2eb66c[_0x8867('0x2d')],_0x2eb66c[_0x8867('0x2f')]);_0x13489d['attributes']=_[_0x8867('0x31')](_0x2eb66c[_0x8867('0x2d')],qs[_0x8867('0x32')](_0x53fa98['query'][_0x8867('0x32')]));_0x13489d[_0x8867('0x33')]=_0x13489d[_0x8867('0x33')][_0x8867('0x34')]?_0x13489d[_0x8867('0x33')]:_0x2eb66c[_0x8867('0x2d')];_0x13489d[_0x8867('0x48')]=qs[_0x8867('0x37')](_0x53fa98[_0x8867('0x2f')][_0x8867('0x37')]);_0x13489d[_0x8867('0x38')]=qs[_0x8867('0x39')](_[_0x8867('0x49')](_0x53fa98[_0x8867('0x2f')],_0x2eb66c['filters']));if(_0x53fa98[_0x8867('0x2f')][_0x8867('0x3a')]){_0x13489d[_0x8867('0x38')]=_[_0x8867('0x3b')](_0x13489d['where'],{'$or':_['map'](_0x13489d[_0x8867('0x33')],function(_0x472fe5){var _0x477099={};_0x477099[_0x472fe5]={'$like':'%'+_0x53fa98[_0x8867('0x2f')][_0x8867('0x3a')]+'%'};return _0x477099;})});}_0x13489d=_[_0x8867('0x3b')]({},_0x13489d,_0x53fa98['options']);return _0x483d39['getDescriptions'](_0x13489d);}})[_0x8867('0x22')](function(_0xbd3693){if(_0xbd3693){_0x2efdbe=_0xbd3693[_0x8867('0x34')];if(!_0x53fa98['query'][_0x8867('0x35')]('nolimit')){_0x13489d[_0x8867('0x1b')]=qs['limit'](_0x53fa98['query']['limit']);_0x13489d[_0x8867('0x19')]=qs[_0x8867('0x19')](_0x53fa98['query'][_0x8867('0x19')]);}return _0x483d39[_0x8867('0x4c')](_0x13489d);}})[_0x8867('0x22')](function(_0x351253){if(_0x351253){return _0x351253?{'count':_0x2efdbe,'rows':_0x351253}:null;}})[_0x8867('0x22')](respondWithResult(_0x2c18eb,null))[_0x8867('0x3f')](handleError(_0x2c18eb,null));};exports[_0x8867('0x4d')]=function(_0x29f265,_0x358aa9,_0x2cf4b6){var _0x2f6c12={};var _0x37ada5={};var _0x2dea3c;var _0x41228e;return db[_0x8867('0x29')][_0x8867('0x4a')]({'where':{'id':_0x29f265[_0x8867('0x45')]['id']}})['then'](handleEntityNotFound(_0x358aa9,null))[_0x8867('0x22')](function(_0x4181e3){if(_0x4181e3){_0x2dea3c=_0x4181e3;_0x37ada5[_0x8867('0x2d')]=_[_0x8867('0x30')](db['FreshsalesField'][_0x8867('0x47')]);_0x37ada5[_0x8867('0x2f')]=_[_0x8867('0x30')](_0x29f265[_0x8867('0x2f')]);_0x37ada5[_0x8867('0x39')]=_[_0x8867('0x31')](_0x37ada5[_0x8867('0x2d')],_0x37ada5[_0x8867('0x2f')]);_0x2f6c12[_0x8867('0x33')]=_[_0x8867('0x31')](_0x37ada5[_0x8867('0x2d')],qs[_0x8867('0x32')](_0x29f265[_0x8867('0x2f')][_0x8867('0x32')]));_0x2f6c12[_0x8867('0x33')]=_0x2f6c12[_0x8867('0x33')]['length']?_0x2f6c12['attributes']:_0x37ada5[_0x8867('0x2d')];_0x2f6c12[_0x8867('0x48')]=qs[_0x8867('0x37')](_0x29f265[_0x8867('0x2f')][_0x8867('0x37')]);_0x2f6c12[_0x8867('0x38')]=qs[_0x8867('0x39')](_[_0x8867('0x49')](_0x29f265['query'],_0x37ada5[_0x8867('0x39')]));if(_0x29f265['query'][_0x8867('0x3a')]){_0x2f6c12[_0x8867('0x38')]=_[_0x8867('0x3b')](_0x2f6c12[_0x8867('0x38')],{'$or':_[_0x8867('0x2e')](_0x2f6c12[_0x8867('0x33')],function(_0x4cb931){var _0x44df7d={};_0x44df7d[_0x4cb931]={'$like':'%'+_0x29f265[_0x8867('0x2f')][_0x8867('0x3a')]+'%'};return _0x44df7d;})});}_0x2f6c12=_[_0x8867('0x3b')]({},_0x2f6c12,_0x29f265[_0x8867('0x41')]);return _0x2dea3c['getFields'](_0x2f6c12);}})[_0x8867('0x22')](function(_0x15092d){if(_0x15092d){_0x41228e=_0x15092d[_0x8867('0x34')];if(!_0x29f265[_0x8867('0x2f')][_0x8867('0x35')](_0x8867('0x36'))){_0x2f6c12[_0x8867('0x1b')]=qs['limit'](_0x29f265[_0x8867('0x2f')][_0x8867('0x1b')]);_0x2f6c12[_0x8867('0x19')]=qs['offset'](_0x29f265[_0x8867('0x2f')]['offset']);}return _0x2dea3c[_0x8867('0x4d')](_0x2f6c12);}})[_0x8867('0x22')](function(_0x432466){if(_0x432466){return _0x432466?{'count':_0x41228e,'rows':_0x432466}:null;}})[_0x8867('0x22')](respondWithResult(_0x358aa9,null))['catch'](handleError(_0x358aa9,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 3be05b6..cb74d08 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 _0xc6be=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x19cc92,_0x4df512){var _0x4c88d4=function(_0x40bf46){while(--_0x40bf46){_0x19cc92['push'](_0x19cc92['shift']());}};_0x4c88d4(++_0x4df512);}(_0xc6be,0x1a4));var _0xec6b=function(_0x160b65,_0x1ae655){_0x160b65=_0x160b65-0x0;var _0x34b02a=_0xc6be[_0x160b65];return _0x34b02a;};'use strict';var _=require('lodash');var util=require(_0xec6b('0x0'));var logger=require('../../config/logger')(_0xec6b('0x1'));var moment=require('moment');var BPromise=require(_0xec6b('0x2'));var rp=require(_0xec6b('0x3'));var fs=require('fs');var path=require(_0xec6b('0x4'));var rimraf=require(_0xec6b('0x5'));var config=require(_0xec6b('0x6'));var attributes=require(_0xec6b('0x7'));module[_0xec6b('0x8')]=function(_0x414e8c,_0x52db0d){return _0x414e8c[_0xec6b('0x9')](_0xec6b('0xa'),attributes,{'tableName':_0xec6b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a62=['FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define'];(function(_0x5709e7,_0x3359e2){var _0xe1fbcf=function(_0x25977b){while(--_0x25977b){_0x5709e7['push'](_0x5709e7['shift']());}};_0xe1fbcf(++_0x3359e2);}(_0x4a62,0xf4));var _0x24a6=function(_0x255380,_0x2924a9){_0x255380=_0x255380-0x0;var _0x8c8de=_0x4a62[_0x255380];return _0x8c8de;};'use strict';var _=require(_0x24a6('0x0'));var util=require('util');var logger=require(_0x24a6('0x1'))(_0x24a6('0x2'));var moment=require(_0x24a6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x24a6('0x4'));var rimraf=require(_0x24a6('0x5'));var config=require(_0x24a6('0x6'));var attributes=require(_0x24a6('0x7'));module['exports']=function(_0x273b0b,_0x537e3e){return _0x273b0b[_0x24a6('0x8')](_0x24a6('0x9'),attributes,{'tableName':_0x24a6('0xa'),'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 fab1f35..4e84ef7 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 _0x8555=['jayson/promise','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x8555,0x1f2));var _0x5855=function(_0x56e307,_0x221664){_0x56e307=_0x56e307-0x0;var _0x452270=_0x8555[_0x56e307];return _0x452270;};'use strict';var _=require(_0x5855('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5855('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5855('0x2'));var db=require(_0x5855('0x3'))['db'];var utils=require(_0x5855('0x4'));var logger=require(_0x5855('0x5'))(_0x5855('0x6'));var config=require(_0x5855('0x7'));var jayson=require(_0x5855('0x8'));var client=jayson['client'][_0x5855('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x493706,_0x5e7980,_0x4f555f){return new BPromise(function(_0x211e8c,_0x3cd623){return client[_0x5855('0xa')](_0x493706,_0x4f555f)[_0x5855('0xb')](function(_0x47d07e){logger[_0x5855('0xc')](_0x5855('0xd'),_0x5e7980,_0x5855('0xe'));logger[_0x5855('0xf')](_0x5855('0x10'),_0x5e7980,_0x5855('0xe'),JSON[_0x5855('0x11')](_0x47d07e));if(_0x47d07e[_0x5855('0x12')]){if(_0x47d07e['error']['code']===0x1f4){logger[_0x5855('0x12')](_0x5855('0xd'),_0x5e7980,_0x47d07e['error'][_0x5855('0x13')]);return _0x3cd623(_0x47d07e[_0x5855('0x12')][_0x5855('0x13')]);}logger['error'](_0x5855('0xd'),_0x5e7980,_0x47d07e[_0x5855('0x12')][_0x5855('0x13')]);return _0x211e8c(_0x47d07e[_0x5855('0x12')][_0x5855('0x13')]);}else{logger[_0x5855('0xc')](_0x5855('0xd'),_0x5e7980,_0x5855('0xe'));_0x211e8c(_0x47d07e[_0x5855('0x14')][_0x5855('0x13')]);}})[_0x5855('0x15')](function(_0x3485c7){logger[_0x5855('0x12')](_0x5855('0xd'),_0x5e7980,_0x3485c7);_0x3cd623(_0x3485c7);});});} \ No newline at end of file +var _0x893a=['request','info','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x35a59c,_0x3c08ef){var _0x11bf0e=function(_0x154cec){while(--_0x154cec){_0x35a59c['push'](_0x35a59c['shift']());}};_0x11bf0e(++_0x3c08ef);}(_0x893a,0x14d));var _0xa893=function(_0xa941ac,_0x1ace99){_0xa941ac=_0xa941ac-0x0;var _0x499906=_0x893a[_0xa941ac];return _0x499906;};'use strict';var _=require(_0xa893('0x0'));var util=require(_0xa893('0x1'));var moment=require(_0xa893('0x2'));var BPromise=require(_0xa893('0x3'));var rs=require(_0xa893('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa893('0x5'))['db'];var utils=require(_0xa893('0x6'));var logger=require(_0xa893('0x7'))(_0xa893('0x8'));var config=require(_0xa893('0x9'));var jayson=require(_0xa893('0xa'));var client=jayson['client'][_0xa893('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x252b60,_0x610815,_0x1003c7){return new BPromise(function(_0x15017a,_0x241c6c){return client[_0xa893('0xc')](_0x252b60,_0x1003c7)['then'](function(_0x10d2e3){logger[_0xa893('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x610815,'request\x20sent');logger['debug'](_0xa893('0xe'),_0x610815,'request\x20sent',JSON[_0xa893('0xf')](_0x10d2e3));if(_0x10d2e3['error']){if(_0x10d2e3[_0xa893('0x10')][_0xa893('0x11')]===0x1f4){logger[_0xa893('0x10')](_0xa893('0x12'),_0x610815,_0x10d2e3[_0xa893('0x10')]['message']);return _0x241c6c(_0x10d2e3['error'][_0xa893('0x13')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x610815,_0x10d2e3[_0xa893('0x10')][_0xa893('0x13')]);return _0x15017a(_0x10d2e3[_0xa893('0x10')]['message']);}else{logger[_0xa893('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x610815,_0xa893('0x14'));_0x15017a(_0x10d2e3[_0xa893('0x15')]['message']);}})[_0xa893('0x16')](function(_0x531b3a){logger[_0xa893('0x10')](_0xa893('0x12'),_0x610815,_0x531b3a);_0x241c6c(_0x531b3a);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index d969711..e1007be 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 _0xdb13=['show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id'];(function(_0x1d77d8,_0x2a390a){var _0x1eddcd=function(_0xeeeae){while(--_0xeeeae){_0x1d77d8['push'](_0x1d77d8['shift']());}};_0x1eddcd(++_0x2a390a);}(_0xdb13,0x10c));var _0x3db1=function(_0x21451d,_0x196642){_0x21451d=_0x21451d-0x0;var _0x2a1978=_0xdb13[_0x21451d];return _0x2a1978;};'use strict';var multer=require('multer');var util=require(_0x3db1('0x0'));var path=require(_0x3db1('0x1'));var timeout=require(_0x3db1('0x2'));var express=require(_0x3db1('0x3'));var router=express[_0x3db1('0x4')]();var fs_extra=require(_0x3db1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3db1('0x6'));var config=require(_0x3db1('0x7'));var controller=require(_0x3db1('0x8'));router[_0x3db1('0x9')]('/',auth[_0x3db1('0xa')](),controller['index']);router[_0x3db1('0x9')](_0x3db1('0xb'),auth[_0x3db1('0xa')](),controller[_0x3db1('0xc')]);router[_0x3db1('0xd')]('/',auth[_0x3db1('0xa')](),controller[_0x3db1('0xe')]);router[_0x3db1('0xf')](_0x3db1('0xb'),auth[_0x3db1('0xa')](),controller[_0x3db1('0x10')]);router[_0x3db1('0x11')]('/:id',auth[_0x3db1('0xa')](),controller[_0x3db1('0x12')]);module[_0x3db1('0x13')]=router; \ No newline at end of file +var _0x22fb=['./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x11066a,_0x347efe){var _0x58d875=function(_0x45d3f8){while(--_0x45d3f8){_0x11066a['push'](_0x11066a['shift']());}};_0x58d875(++_0x347efe);}(_0x22fb,0x192));var _0xb22f=function(_0x59d3e6,_0x3cf4d3){_0x59d3e6=_0x59d3e6-0x0;var _0x713379=_0x22fb[_0x59d3e6];return _0x713379;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0xc')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xe')](_0xb22f('0xa'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')](_0xb22f('0xa'),auth[_0xb22f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index e40dedd..bdeb878 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 _0xd4cd=['customVariable','picklist','STRING','variable','exports','ENUM','string'];(function(_0x5a7126,_0x51a30c){var _0x5d80c7=function(_0x51bbec){while(--_0x51bbec){_0x5a7126['push'](_0x5a7126['shift']());}};_0x5d80c7(++_0x51a30c);}(_0xd4cd,0x19a));var _0xdd4c=function(_0x254abd,_0x1ab7f0){_0x254abd=_0x254abd-0x0;var _0x31bf1b=_0xd4cd[_0x254abd];return _0x31bf1b;};'use strict';var Sequelize=require('sequelize');module[_0xdd4c('0x0')]={'type':{'type':Sequelize[_0xdd4c('0x1')](_0xdd4c('0x2'),'variable',_0xdd4c('0x3'),'keyValue',_0xdd4c('0x4')),'defaultValue':_0xdd4c('0x2')},'content':{'type':Sequelize[_0xdd4c('0x5')]},'key':{'type':Sequelize[_0xdd4c('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xdd4c('0x2'),_0xdd4c('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xdd4c('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdd4c('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdd4c('0x5')]}}; \ No newline at end of file +var _0x9c7a=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','string','variable'];(function(_0x58fe5b,_0x4ee0fd){var _0x1bedc7=function(_0x3e5d2d){while(--_0x3e5d2d){_0x58fe5b['push'](_0x58fe5b['shift']());}};_0x1bedc7(++_0x4ee0fd);}(_0x9c7a,0xec));var _0xa9c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c7a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa9c7('0x0'));module[_0xa9c7('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa9c7('0x2'),_0xa9c7('0x3'),_0xa9c7('0x4'),_0xa9c7('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa9c7('0x6')]},'key':{'type':Sequelize[_0xa9c7('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xa9c7('0x2'),_0xa9c7('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xa9c7('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa9c7('0x6')]},'customField':{'type':Sequelize[_0xa9c7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa9c7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index d0f89db..04b90ac 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 _0x8e61=['VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','count','offset','limit','Content-Range','apply','save','update','destroy','end','error','stack','name','send','map','FreshsalesField','type','key','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x8e61,0x132));var _0x18e6=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x8e61[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require(_0x18e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x18e6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x18e6('0x2'));var moment=require(_0x18e6('0x3'));var BPromise=require(_0x18e6('0x4'));var Mustache=require(_0x18e6('0x5'));var util=require('util');var path=require(_0x18e6('0x6'));var sox=require(_0x18e6('0x7'));var csv=require(_0x18e6('0x8'));var ejs=require(_0x18e6('0x9'));var fs=require('fs');var fs_extra=require(_0x18e6('0xa'));var _=require(_0x18e6('0xb'));var squel=require(_0x18e6('0xc'));var crypto=require(_0x18e6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x18e6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x18e6('0xf'));var Papa=require(_0x18e6('0x10'));var Redis=require(_0x18e6('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x18e6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x18e6('0x13'))(_0x18e6('0x14'));var utils=require(_0x18e6('0x15'));var config=require(_0x18e6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x18e6('0x17'))['db'];function respondWithStatusCode(_0x495dad,_0x55c777){_0x55c777=_0x55c777||0xcc;return function(_0x41077c){if(_0x41077c){return _0x495dad[_0x18e6('0x18')](_0x55c777);}return _0x495dad[_0x18e6('0x19')](_0x55c777)['end']();};}function respondWithResult(_0x653b55,_0xccf70c){_0xccf70c=_0xccf70c||0xc8;return function(_0x1ff038){if(_0x1ff038){return _0x653b55[_0x18e6('0x19')](_0xccf70c)['json'](_0x1ff038);}};}function respondWithFilteredResult(_0x1b357d,_0x3d51ed){return function(_0xf72eb5){if(_0xf72eb5){var _0x544db3=typeof _0x3d51ed['offset']===_0x18e6('0x1a')&&typeof _0x3d51ed['limit']===_0x18e6('0x1a');var _0x3b8ec1=_0xf72eb5[_0x18e6('0x1b')];var _0x2f551d=_0x544db3?0x0:_0x3d51ed[_0x18e6('0x1c')];var _0x152dbb=_0x544db3?_0xf72eb5[_0x18e6('0x1b')]:_0x3d51ed[_0x18e6('0x1c')]+_0x3d51ed[_0x18e6('0x1d')];var _0x5a306c;if(_0x152dbb>=_0x3b8ec1){_0x152dbb=_0x3b8ec1;_0x5a306c=0xc8;}else{_0x5a306c=0xce;}_0x1b357d['status'](_0x5a306c);return _0x1b357d['set'](_0x18e6('0x1e'),_0x2f551d+'-'+_0x152dbb+'/'+_0x3b8ec1)['json'](_0xf72eb5);}return null;};}function patchUpdates(_0x2949f7){return function(_0x21be37){try{jsonpatch[_0x18e6('0x1f')](_0x21be37,_0x2949f7,!![]);}catch(_0xdca717){return BPromise['reject'](_0xdca717);}return _0x21be37[_0x18e6('0x20')]();};}function saveUpdates(_0x189eee,_0x1f0fb1){return function(_0x256b1d){if(_0x256b1d){return _0x256b1d[_0x18e6('0x21')](_0x189eee)['then'](function(_0x51a227){return _0x51a227;});}return null;};}function removeEntity(_0x9ab74f,_0x250477){return function(_0x1cae13){if(_0x1cae13){return _0x1cae13[_0x18e6('0x22')]()['then'](function(){_0x9ab74f[_0x18e6('0x19')](0xcc)[_0x18e6('0x23')]();});}};}function handleEntityNotFound(_0x387d6e,_0x47ec52){return function(_0x2b3463){if(!_0x2b3463){_0x387d6e[_0x18e6('0x18')](0x194);}return _0x2b3463;};}function handleError(_0x13975f,_0x51128d){_0x51128d=_0x51128d||0x1f4;return function(_0x121930){logger[_0x18e6('0x24')](_0x121930[_0x18e6('0x25')]);if(_0x121930['name']){delete _0x121930[_0x18e6('0x26')];}_0x13975f[_0x18e6('0x19')](_0x51128d)[_0x18e6('0x27')](_0x121930);};}exports['index']=function(_0x1c0b2b,_0x33c626){var _0x4e3ed4={},_0x3fde06={},_0x3069db={'count':0x0,'rows':[]};var _0x1043c5=_[_0x18e6('0x28')](db[_0x18e6('0x29')]['rawAttributes'],function(_0x493b82){return{'name':_0x493b82['fieldName'],'type':_0x493b82[_0x18e6('0x2a')][_0x18e6('0x2b')]};});_0x3fde06['model']=_[_0x18e6('0x28')](_0x1043c5,_0x18e6('0x26'));_0x3fde06['query']=_[_0x18e6('0x2c')](_0x1c0b2b['query']);_0x3fde06[_0x18e6('0x2d')]=_[_0x18e6('0x2e')](_0x3fde06['model'],_0x3fde06[_0x18e6('0x2f')]);_0x4e3ed4[_0x18e6('0x30')]=_['intersection'](_0x3fde06[_0x18e6('0x31')],qs[_0x18e6('0x32')](_0x1c0b2b[_0x18e6('0x2f')]['fields']));_0x4e3ed4[_0x18e6('0x30')]=_0x4e3ed4[_0x18e6('0x30')][_0x18e6('0x33')]?_0x4e3ed4[_0x18e6('0x30')]:_0x3fde06[_0x18e6('0x31')];if(!_0x1c0b2b[_0x18e6('0x2f')][_0x18e6('0x34')](_0x18e6('0x35'))){_0x4e3ed4['limit']=qs['limit'](_0x1c0b2b['query'][_0x18e6('0x1d')]);_0x4e3ed4[_0x18e6('0x1c')]=qs[_0x18e6('0x1c')](_0x1c0b2b[_0x18e6('0x2f')]['offset']);}_0x4e3ed4['order']=qs['sort'](_0x1c0b2b['query'][_0x18e6('0x36')]);_0x4e3ed4[_0x18e6('0x37')]=qs['filters'](_[_0x18e6('0x38')](_0x1c0b2b[_0x18e6('0x2f')],_0x3fde06['filters']),_0x1043c5);if(_0x1c0b2b['query'][_0x18e6('0x39')]){_0x4e3ed4[_0x18e6('0x37')]=_[_0x18e6('0x3a')](_0x4e3ed4['where'],{'$or':_['map'](_0x1043c5,function(_0x2e34d6){if(_0x2e34d6[_0x18e6('0x2a')]!==_0x18e6('0x3b')){var _0x1e329b={};_0x1e329b[_0x2e34d6[_0x18e6('0x26')]]={'$like':'%'+_0x1c0b2b[_0x18e6('0x2f')][_0x18e6('0x39')]+'%'};return _0x1e329b;}})});}_0x4e3ed4=_[_0x18e6('0x3a')]({},_0x4e3ed4,_0x1c0b2b[_0x18e6('0x3c')]);var _0x52bcb6={'where':_0x4e3ed4[_0x18e6('0x37')]};return db[_0x18e6('0x29')][_0x18e6('0x1b')](_0x52bcb6)[_0x18e6('0x3d')](function(_0x403613){_0x3069db[_0x18e6('0x1b')]=_0x403613;if(_0x1c0b2b[_0x18e6('0x2f')][_0x18e6('0x3e')]){_0x4e3ed4[_0x18e6('0x3f')]=[{'all':!![]}];}return db['FreshsalesField'][_0x18e6('0x40')](_0x4e3ed4);})['then'](function(_0x304daa){_0x3069db[_0x18e6('0x41')]=_0x304daa;return _0x3069db;})[_0x18e6('0x3d')](respondWithFilteredResult(_0x33c626,_0x4e3ed4))[_0x18e6('0x42')](handleError(_0x33c626,null));};exports[_0x18e6('0x43')]=function(_0x5eb61e,_0x237030){var _0x4f485a={'raw':!![],'where':{'id':_0x5eb61e[_0x18e6('0x44')]['id']}},_0x19d281={};_0x19d281[_0x18e6('0x31')]=_[_0x18e6('0x2c')](db[_0x18e6('0x29')][_0x18e6('0x45')]);_0x19d281[_0x18e6('0x2f')]=_['keys'](_0x5eb61e['query']);_0x19d281[_0x18e6('0x2d')]=_[_0x18e6('0x2e')](_0x19d281[_0x18e6('0x31')],_0x19d281['query']);_0x4f485a[_0x18e6('0x30')]=_[_0x18e6('0x2e')](_0x19d281['model'],qs['fields'](_0x5eb61e[_0x18e6('0x2f')][_0x18e6('0x32')]));_0x4f485a[_0x18e6('0x30')]=_0x4f485a[_0x18e6('0x30')][_0x18e6('0x33')]?_0x4f485a['attributes']:_0x19d281[_0x18e6('0x31')];if(_0x5eb61e[_0x18e6('0x2f')][_0x18e6('0x3e')]){_0x4f485a[_0x18e6('0x3f')]=[{'all':!![]}];}_0x4f485a=_[_0x18e6('0x3a')]({},_0x4f485a,_0x5eb61e[_0x18e6('0x3c')]);return db['FreshsalesField'][_0x18e6('0x46')](_0x4f485a)[_0x18e6('0x3d')](handleEntityNotFound(_0x237030,null))['then'](respondWithResult(_0x237030,null))[_0x18e6('0x42')](handleError(_0x237030,null));};exports[_0x18e6('0x47')]=function(_0x55f431,_0x4c31b0){return db[_0x18e6('0x29')]['create'](_0x55f431['body'],{})[_0x18e6('0x3d')](respondWithResult(_0x4c31b0,0xc9))['catch'](handleError(_0x4c31b0,null));};exports['update']=function(_0x565c23,_0x3895ae){if(_0x565c23[_0x18e6('0x48')]['id']){delete _0x565c23[_0x18e6('0x48')]['id'];}return db[_0x18e6('0x29')]['find']({'where':{'id':_0x565c23[_0x18e6('0x44')]['id']}})[_0x18e6('0x3d')](handleEntityNotFound(_0x3895ae,null))['then'](saveUpdates(_0x565c23[_0x18e6('0x48')],null))['then'](respondWithResult(_0x3895ae,null))[_0x18e6('0x42')](handleError(_0x3895ae,null));};exports[_0x18e6('0x22')]=function(_0x2021a8,_0x1509a1){return db[_0x18e6('0x29')]['find']({'where':{'id':_0x2021a8[_0x18e6('0x44')]['id']}})['then'](handleEntityNotFound(_0x1509a1,null))[_0x18e6('0x3d')](removeEntity(_0x1509a1,null))['catch'](handleError(_0x1509a1,null));}; \ No newline at end of file +var _0x7f49=['count','set','Content-Range','save','update','destroy','then','end','error','stack','name','index','map','FreshsalesField','fieldName','model','query','keys','intersection','attributes','fields','order','sort','where','filters','filter','type','merge','options','includeAll','include','findAll','catch','show','rawAttributes','length','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit'];(function(_0x5f46c3,_0x28fcd4){var _0x1ac590=function(_0x237286){while(--_0x237286){_0x5f46c3['push'](_0x5f46c3['shift']());}};_0x1ac590(++_0x28fcd4);}(_0x7f49,0x1c6));var _0x97f4=function(_0x15be8b,_0x2be876){_0x15be8b=_0x15be8b-0x0;var _0x121d14=_0x7f49[_0x15be8b];return _0x121d14;};'use strict';var emlformat=require(_0x97f4('0x0'));var rimraf=require(_0x97f4('0x1'));var zipdir=require(_0x97f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97f4('0x3'));var moment=require(_0x97f4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x97f4('0x5'));var path=require(_0x97f4('0x6'));var sox=require(_0x97f4('0x7'));var csv=require(_0x97f4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97f4('0x9'));var _=require('lodash');var squel=require(_0x97f4('0xa'));var crypto=require(_0x97f4('0xb'));var jsforce=require(_0x97f4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x97f4('0x8'));var querystring=require(_0x97f4('0xd'));var Papa=require(_0x97f4('0xe'));var Redis=require(_0x97f4('0xf'));var authService=require(_0x97f4('0x10'));var qs=require(_0x97f4('0x11'));var as=require(_0x97f4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97f4('0x13'))(_0x97f4('0x14'));var utils=require(_0x97f4('0x15'));var config=require(_0x97f4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x97f4('0x17'))['db'];function respondWithStatusCode(_0x56e30b,_0x238422){_0x238422=_0x238422||0xcc;return function(_0x31120c){if(_0x31120c){return _0x56e30b['sendStatus'](_0x238422);}return _0x56e30b[_0x97f4('0x18')](_0x238422)['end']();};}function respondWithResult(_0x2605ae,_0x89651e){_0x89651e=_0x89651e||0xc8;return function(_0x2fcdb9){if(_0x2fcdb9){return _0x2605ae[_0x97f4('0x18')](_0x89651e)[_0x97f4('0x19')](_0x2fcdb9);}};}function respondWithFilteredResult(_0x181a89,_0x294d89){return function(_0x76c740){if(_0x76c740){var _0x298873=typeof _0x294d89[_0x97f4('0x1a')]===_0x97f4('0x1b')&&typeof _0x294d89[_0x97f4('0x1c')]==='undefined';var _0x4a3dc9=_0x76c740[_0x97f4('0x1d')];var _0x2a95ab=_0x298873?0x0:_0x294d89[_0x97f4('0x1a')];var _0x46c7c6=_0x298873?_0x76c740['count']:_0x294d89[_0x97f4('0x1a')]+_0x294d89[_0x97f4('0x1c')];var _0x49e9ea;if(_0x46c7c6>=_0x4a3dc9){_0x46c7c6=_0x4a3dc9;_0x49e9ea=0xc8;}else{_0x49e9ea=0xce;}_0x181a89[_0x97f4('0x18')](_0x49e9ea);return _0x181a89[_0x97f4('0x1e')](_0x97f4('0x1f'),_0x2a95ab+'-'+_0x46c7c6+'/'+_0x4a3dc9)[_0x97f4('0x19')](_0x76c740);}return null;};}function patchUpdates(_0x1446d2){return function(_0x3a4c3e){try{jsonpatch['apply'](_0x3a4c3e,_0x1446d2,!![]);}catch(_0x4723e6){return BPromise['reject'](_0x4723e6);}return _0x3a4c3e[_0x97f4('0x20')]();};}function saveUpdates(_0x2fb8ba,_0x4292b5){return function(_0x45787f){if(_0x45787f){return _0x45787f[_0x97f4('0x21')](_0x2fb8ba)['then'](function(_0x1dbd0b){return _0x1dbd0b;});}return null;};}function removeEntity(_0x1d884d,_0x423e22){return function(_0x39f2c7){if(_0x39f2c7){return _0x39f2c7[_0x97f4('0x22')]()[_0x97f4('0x23')](function(){_0x1d884d[_0x97f4('0x18')](0xcc)[_0x97f4('0x24')]();});}};}function handleEntityNotFound(_0x5a19a7,_0x38211c){return function(_0xa0a04c){if(!_0xa0a04c){_0x5a19a7['sendStatus'](0x194);}return _0xa0a04c;};}function handleError(_0x45abb6,_0x555041){_0x555041=_0x555041||0x1f4;return function(_0x9359d6){logger[_0x97f4('0x25')](_0x9359d6[_0x97f4('0x26')]);if(_0x9359d6[_0x97f4('0x27')]){delete _0x9359d6[_0x97f4('0x27')];}_0x45abb6[_0x97f4('0x18')](_0x555041)['send'](_0x9359d6);};}exports[_0x97f4('0x28')]=function(_0x973ad7,_0x1574d){var _0xeb6779={},_0x1021b3={},_0x5cd7cd={'count':0x0,'rows':[]};var _0x4a48eb=_[_0x97f4('0x29')](db[_0x97f4('0x2a')]['rawAttributes'],function(_0x3c11f3){return{'name':_0x3c11f3[_0x97f4('0x2b')],'type':_0x3c11f3['type']['key']};});_0x1021b3[_0x97f4('0x2c')]=_[_0x97f4('0x29')](_0x4a48eb,'name');_0x1021b3[_0x97f4('0x2d')]=_[_0x97f4('0x2e')](_0x973ad7[_0x97f4('0x2d')]);_0x1021b3['filters']=_[_0x97f4('0x2f')](_0x1021b3[_0x97f4('0x2c')],_0x1021b3['query']);_0xeb6779[_0x97f4('0x30')]=_['intersection'](_0x1021b3[_0x97f4('0x2c')],qs[_0x97f4('0x31')](_0x973ad7['query'][_0x97f4('0x31')]));_0xeb6779[_0x97f4('0x30')]=_0xeb6779[_0x97f4('0x30')]['length']?_0xeb6779[_0x97f4('0x30')]:_0x1021b3[_0x97f4('0x2c')];if(!_0x973ad7[_0x97f4('0x2d')]['hasOwnProperty']('nolimit')){_0xeb6779[_0x97f4('0x1c')]=qs['limit'](_0x973ad7[_0x97f4('0x2d')][_0x97f4('0x1c')]);_0xeb6779[_0x97f4('0x1a')]=qs['offset'](_0x973ad7[_0x97f4('0x2d')][_0x97f4('0x1a')]);}_0xeb6779[_0x97f4('0x32')]=qs[_0x97f4('0x33')](_0x973ad7['query'][_0x97f4('0x33')]);_0xeb6779[_0x97f4('0x34')]=qs['filters'](_['pick'](_0x973ad7[_0x97f4('0x2d')],_0x1021b3[_0x97f4('0x35')]),_0x4a48eb);if(_0x973ad7[_0x97f4('0x2d')][_0x97f4('0x36')]){_0xeb6779['where']=_['merge'](_0xeb6779[_0x97f4('0x34')],{'$or':_[_0x97f4('0x29')](_0x4a48eb,function(_0x19f404){if(_0x19f404[_0x97f4('0x37')]!=='VIRTUAL'){var _0x1076f8={};_0x1076f8[_0x19f404['name']]={'$like':'%'+_0x973ad7[_0x97f4('0x2d')][_0x97f4('0x36')]+'%'};return _0x1076f8;}})});}_0xeb6779=_[_0x97f4('0x38')]({},_0xeb6779,_0x973ad7[_0x97f4('0x39')]);var _0x396b49={'where':_0xeb6779['where']};return db['FreshsalesField'][_0x97f4('0x1d')](_0x396b49)['then'](function(_0x1c9252){_0x5cd7cd[_0x97f4('0x1d')]=_0x1c9252;if(_0x973ad7[_0x97f4('0x2d')][_0x97f4('0x3a')]){_0xeb6779[_0x97f4('0x3b')]=[{'all':!![]}];}return db[_0x97f4('0x2a')][_0x97f4('0x3c')](_0xeb6779);})[_0x97f4('0x23')](function(_0x2997aa){_0x5cd7cd['rows']=_0x2997aa;return _0x5cd7cd;})[_0x97f4('0x23')](respondWithFilteredResult(_0x1574d,_0xeb6779))[_0x97f4('0x3d')](handleError(_0x1574d,null));};exports[_0x97f4('0x3e')]=function(_0x175d04,_0xadd6a8){var _0x39ce0c={'raw':!![],'where':{'id':_0x175d04['params']['id']}},_0x2a042a={};_0x2a042a[_0x97f4('0x2c')]=_[_0x97f4('0x2e')](db['FreshsalesField'][_0x97f4('0x3f')]);_0x2a042a[_0x97f4('0x2d')]=_['keys'](_0x175d04['query']);_0x2a042a[_0x97f4('0x35')]=_[_0x97f4('0x2f')](_0x2a042a[_0x97f4('0x2c')],_0x2a042a['query']);_0x39ce0c['attributes']=_[_0x97f4('0x2f')](_0x2a042a[_0x97f4('0x2c')],qs[_0x97f4('0x31')](_0x175d04[_0x97f4('0x2d')][_0x97f4('0x31')]));_0x39ce0c[_0x97f4('0x30')]=_0x39ce0c[_0x97f4('0x30')][_0x97f4('0x40')]?_0x39ce0c['attributes']:_0x2a042a[_0x97f4('0x2c')];if(_0x175d04[_0x97f4('0x2d')][_0x97f4('0x3a')]){_0x39ce0c[_0x97f4('0x3b')]=[{'all':!![]}];}_0x39ce0c=_[_0x97f4('0x38')]({},_0x39ce0c,_0x175d04[_0x97f4('0x39')]);return db[_0x97f4('0x2a')][_0x97f4('0x41')](_0x39ce0c)['then'](handleEntityNotFound(_0xadd6a8,null))[_0x97f4('0x23')](respondWithResult(_0xadd6a8,null))[_0x97f4('0x3d')](handleError(_0xadd6a8,null));};exports[_0x97f4('0x42')]=function(_0x3e260b,_0x1cb0a6){return db[_0x97f4('0x2a')]['create'](_0x3e260b[_0x97f4('0x43')],{})[_0x97f4('0x23')](respondWithResult(_0x1cb0a6,0xc9))[_0x97f4('0x3d')](handleError(_0x1cb0a6,null));};exports[_0x97f4('0x21')]=function(_0x1f0a1b,_0x25881a){if(_0x1f0a1b[_0x97f4('0x43')]['id']){delete _0x1f0a1b['body']['id'];}return db[_0x97f4('0x2a')][_0x97f4('0x41')]({'where':{'id':_0x1f0a1b[_0x97f4('0x44')]['id']}})[_0x97f4('0x23')](handleEntityNotFound(_0x25881a,null))['then'](saveUpdates(_0x1f0a1b[_0x97f4('0x43')],null))['then'](respondWithResult(_0x25881a,null))[_0x97f4('0x3d')](handleError(_0x25881a,null));};exports[_0x97f4('0x22')]=function(_0x2f2c6e,_0x3174ca){return db['FreshsalesField'][_0x97f4('0x41')]({'where':{'id':_0x2f2c6e['params']['id']}})[_0x97f4('0x23')](handleEntityNotFound(_0x3174ca,null))[_0x97f4('0x23')](removeEntity(_0x3174ca,null))[_0x97f4('0x3d')](handleError(_0x3174ca,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index a14f7fe..17bd280 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 _0xaec5=['../../config/environment','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xaec5,0x92));var _0x5aec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaec5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5aec('0x0'));var util=require(_0x5aec('0x1'));var logger=require(_0x5aec('0x2'))(_0x5aec('0x3'));var moment=require(_0x5aec('0x4'));var BPromise=require(_0x5aec('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5aec('0x6'));var rimraf=require(_0x5aec('0x7'));var config=require(_0x5aec('0x8'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x539cdf,_0x52d725){return _0x539cdf[_0x5aec('0x9')](_0x5aec('0xa'),attributes,{'tableName':_0x5aec('0xb'),'paranoid':![],'indexes':[{'name':_0x5aec('0xc'),'fields':['idField',_0x5aec('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1c3d=['api','moment','bluebird','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','idField','FieldId','util','../../config/logger'];(function(_0x27a49e,_0x1cb0b0){var _0x350480=function(_0x4a60b6){while(--_0x4a60b6){_0x27a49e['push'](_0x27a49e['shift']());}};_0x350480(++_0x1cb0b0);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0xe7d24e,_0x235022){_0xe7d24e=_0xe7d24e-0x0;var _0x42c6e3=_0x1c3d[_0xe7d24e];return _0x42c6e3;};'use strict';var _=require('lodash');var util=require(_0xd1c3('0x0'));var logger=require(_0xd1c3('0x1'))(_0xd1c3('0x2'));var moment=require(_0xd1c3('0x3'));var BPromise=require(_0xd1c3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd1c3('0x5'));var config=require(_0xd1c3('0x6'));var attributes=require(_0xd1c3('0x7'));module[_0xd1c3('0x8')]=function(_0x14093d,_0x391a41){return _0x14093d['define'](_0xd1c3('0x9'),attributes,{'tableName':_0xd1c3('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xd1c3('0xb'),_0xd1c3('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 4934031..2ac5d00 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 _0x2bd8=['info','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x4ced3a,_0x4193d4){var _0x6aae87=function(_0x1bbe65){while(--_0x1bbe65){_0x4ced3a['push'](_0x4ced3a['shift']());}};_0x6aae87(++_0x4193d4);}(_0x2bd8,0x130));var _0x82bd=function(_0x585cf8,_0x4cd223){_0x585cf8=_0x585cf8-0x0;var _0x9216bd=_0x2bd8[_0x585cf8];return _0x9216bd;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var moment=require(_0x82bd('0x1'));var BPromise=require(_0x82bd('0x2'));var rs=require(_0x82bd('0x3'));var fs=require('fs');var Redis=require(_0x82bd('0x4'));var db=require(_0x82bd('0x5'))['db'];var utils=require(_0x82bd('0x6'));var logger=require(_0x82bd('0x7'))('rpc');var config=require(_0x82bd('0x8'));var jayson=require(_0x82bd('0x9'));var client=jayson[_0x82bd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19dbb1,_0x77d7a9,_0x226f60){return new BPromise(function(_0x1f7463,_0x4dc3a6){return client[_0x82bd('0xb')](_0x19dbb1,_0x226f60)['then'](function(_0x4a9b2c){logger['info'](_0x82bd('0xc'),_0x77d7a9,'request\x20sent');logger['debug'](_0x82bd('0xd'),_0x77d7a9,'request\x20sent',JSON['stringify'](_0x4a9b2c));if(_0x4a9b2c[_0x82bd('0xe')]){if(_0x4a9b2c[_0x82bd('0xe')]['code']===0x1f4){logger[_0x82bd('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x77d7a9,_0x4a9b2c[_0x82bd('0xe')]['message']);return _0x4dc3a6(_0x4a9b2c[_0x82bd('0xe')][_0x82bd('0xf')]);}logger[_0x82bd('0xe')](_0x82bd('0xc'),_0x77d7a9,_0x4a9b2c['error'][_0x82bd('0xf')]);return _0x1f7463(_0x4a9b2c[_0x82bd('0xe')]['message']);}else{logger[_0x82bd('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x77d7a9,_0x82bd('0x11'));_0x1f7463(_0x4a9b2c[_0x82bd('0x12')][_0x82bd('0xf')]);}})[_0x82bd('0x13')](function(_0x209081){logger[_0x82bd('0xe')](_0x82bd('0xc'),_0x77d7a9,_0x209081);_0x4dc3a6(_0x209081);});});} \ No newline at end of file +var _0xe3da=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s'];(function(_0x10ba7f,_0x4519f3){var _0x5e55ea=function(_0x4c7953){while(--_0x4c7953){_0x10ba7f['push'](_0x10ba7f['shift']());}};_0x5e55ea(++_0x4519f3);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index abdefb6..f55d440 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(_0x313477,_0x511883){var _0x494c09=function(_0x3bf837){while(--_0x3bf837){_0x313477['push'](_0x313477['shift']());}};_0x494c09(++_0x511883);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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(_0x499c31,_0x3ead9e){var _0x237677=function(_0x1d0927){while(--_0x1d0927){_0x499c31['push'](_0x499c31['shift']());}};_0x237677(++_0x3ead9e);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index dd6c85a..c1f8e01 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 _0x4eb8=['exports','STRING','username','ENUM','integrationTab','sequelize'];(function(_0x22c866,_0x325c4d){var _0x53a322=function(_0x5900d3){while(--_0x5900d3){_0x22c866['push'](_0x22c866['shift']());}};_0x53a322(++_0x325c4d);}(_0x4eb8,0x1b5));var _0x84eb=function(_0x1b3a72,_0x3a1f98){_0x1b3a72=_0x1b3a72-0x0;var _0x8b247f=_0x4eb8[_0x1b3a72];return _0x8b247f;};'use strict';var Sequelize=require(_0x84eb('0x0'));module[_0x84eb('0x1')]={'name':{'type':Sequelize[_0x84eb('0x2')]},'description':{'type':Sequelize[_0x84eb('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x84eb('0x3')},'remoteUri':{'type':Sequelize[_0x84eb('0x2')]},'password':{'type':Sequelize[_0x84eb('0x2')]},'clientId':{'type':Sequelize[_0x84eb('0x2')]},'clientSecret':{'type':Sequelize[_0x84eb('0x2')]},'securityToken':{'type':Sequelize[_0x84eb('0x2')]},'serverUrl':{'type':Sequelize[_0x84eb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x84eb('0x4')](_0x84eb('0x5'),'newTab'),'defaultValue':_0x84eb('0x5')}}; \ No newline at end of file +var _0x5cc3=['integrationTab','newTab','sequelize','exports','STRING','username','ENUM'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5cc3,0x144));var _0x35cc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5cc3[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x35cc('0x0'));module[_0x35cc('0x1')]={'name':{'type':Sequelize[_0x35cc('0x2')]},'description':{'type':Sequelize[_0x35cc('0x2')]},'username':{'type':Sequelize[_0x35cc('0x2')],'unique':_0x35cc('0x3')},'remoteUri':{'type':Sequelize[_0x35cc('0x2')]},'password':{'type':Sequelize[_0x35cc('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x35cc('0x2')]},'serverUrl':{'type':Sequelize[_0x35cc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x35cc('0x4')](_0x35cc('0x5'),_0x35cc('0x6')),'defaultValue':_0x35cc('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 7ae8d55..14439fe 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 _0xbfd5=['rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','send','index','map','rawAttributes','fieldName','type','key','name','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','SalesforceAccount','findAll','rows','params','intersection','find','catch','create','body','getConfigurations','SalesforceConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','SalesforceField','Descriptions','getFields','Task','remoteUri','clientSecret','username','password','securityToken','slice','lastIndexOf','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','boolean','textarea','phone','remove','includes','label','custom','picklistValues','value','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format'];(function(_0xc272b9,_0x1fae9a){var _0x2ae592=function(_0x382add){while(--_0x382add){_0xc272b9['push'](_0xc272b9['shift']());}};_0x2ae592(++_0x1fae9a);}(_0xbfd5,0x101));var _0x5bfd=function(_0x365ef4,_0x192fb3){_0x365ef4=_0x365ef4-0x0;var _0xe3ea05=_0xbfd5[_0x365ef4];return _0xe3ea05;};'use strict';var emlformat=require(_0x5bfd('0x0'));var rimraf=require(_0x5bfd('0x1'));var zipdir=require(_0x5bfd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5bfd('0x3'));var moment=require('moment');var BPromise=require(_0x5bfd('0x4'));var Mustache=require(_0x5bfd('0x5'));var util=require(_0x5bfd('0x6'));var path=require(_0x5bfd('0x7'));var sox=require(_0x5bfd('0x8'));var csv=require('to-csv');var ejs=require(_0x5bfd('0x9'));var fs=require('fs');var fs_extra=require(_0x5bfd('0xa'));var _=require(_0x5bfd('0xb'));var squel=require(_0x5bfd('0xc'));var crypto=require(_0x5bfd('0xd'));var jsforce=require(_0x5bfd('0xe'));var deskjs=require(_0x5bfd('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5bfd('0x10'));var Papa=require(_0x5bfd('0x11'));var Redis=require('ioredis');var authService=require(_0x5bfd('0x12'));var qs=require(_0x5bfd('0x13'));var as=require(_0x5bfd('0x14'));var hardwareService=require(_0x5bfd('0x15'));var logger=require(_0x5bfd('0x16'))(_0x5bfd('0x17'));var utils=require(_0x5bfd('0x18'));var config=require(_0x5bfd('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bfd('0x1a'))['db'];var integrations=require(_0x5bfd('0x1b'));function respondWithStatusCode(_0x4e381d,_0x92a15e){_0x92a15e=_0x92a15e||0xcc;return function(_0x17a167){if(_0x17a167){return _0x4e381d[_0x5bfd('0x1c')](_0x92a15e);}return _0x4e381d[_0x5bfd('0x1d')](_0x92a15e)[_0x5bfd('0x1e')]();};}function respondWithResult(_0x4c2cb8,_0x445bca){_0x445bca=_0x445bca||0xc8;return function(_0x1a8c72){if(_0x1a8c72){return _0x4c2cb8[_0x5bfd('0x1d')](_0x445bca)[_0x5bfd('0x1f')](_0x1a8c72);}};}function respondWithFilteredResult(_0x12e8dc,_0x1c9d77){return function(_0xcd719a){if(_0xcd719a){var _0x24b3c8=typeof _0x1c9d77[_0x5bfd('0x20')]===_0x5bfd('0x21')&&typeof _0x1c9d77['limit']===_0x5bfd('0x21');var _0xe54f6e=_0xcd719a[_0x5bfd('0x22')];var _0x15bc47=_0x24b3c8?0x0:_0x1c9d77['offset'];var _0x53336c=_0x24b3c8?_0xcd719a[_0x5bfd('0x22')]:_0x1c9d77['offset']+_0x1c9d77[_0x5bfd('0x23')];var _0x2e5022;if(_0x53336c>=_0xe54f6e){_0x53336c=_0xe54f6e;_0x2e5022=0xc8;}else{_0x2e5022=0xce;}_0x12e8dc['status'](_0x2e5022);return _0x12e8dc[_0x5bfd('0x24')](_0x5bfd('0x25'),_0x15bc47+'-'+_0x53336c+'/'+_0xe54f6e)[_0x5bfd('0x1f')](_0xcd719a);}return null;};}function patchUpdates(_0x642a9d){return function(_0x153fe2){try{jsonpatch['apply'](_0x153fe2,_0x642a9d,!![]);}catch(_0x4e8e75){return BPromise[_0x5bfd('0x26')](_0x4e8e75);}return _0x153fe2[_0x5bfd('0x27')]();};}function saveUpdates(_0x4e1642,_0x3fdf72){return function(_0xcd5d8b){if(_0xcd5d8b){return _0xcd5d8b[_0x5bfd('0x28')](_0x4e1642)['then'](function(_0x1b64a3){return _0x1b64a3;});}return null;};}function removeEntity(_0x13a8ff,_0x31b991){return function(_0x376ce1){if(_0x376ce1){return _0x376ce1[_0x5bfd('0x29')]()[_0x5bfd('0x2a')](function(){_0x13a8ff[_0x5bfd('0x1d')](0xcc)[_0x5bfd('0x1e')]();});}};}function handleEntityNotFound(_0x2ed7f1,_0x214d46){return function(_0x2c3360){if(!_0x2c3360){_0x2ed7f1[_0x5bfd('0x1c')](0x194);}return _0x2c3360;};}function handleError(_0x5dd9b1,_0x5f0042){_0x5f0042=_0x5f0042||0x1f4;return function(_0x4312a0){logger[_0x5bfd('0x2b')](_0x4312a0[_0x5bfd('0x2c')]);if(_0x4312a0['name']){delete _0x4312a0['name'];}_0x5dd9b1[_0x5bfd('0x1d')](_0x5f0042)[_0x5bfd('0x2d')](_0x4312a0);};}exports[_0x5bfd('0x2e')]=function(_0x365eb5,_0x590ea5){var _0x4a7c13={},_0x25d7c6={},_0x2ce22f={'count':0x0,'rows':[]};var _0xbe936c=_[_0x5bfd('0x2f')](db['SalesforceAccount'][_0x5bfd('0x30')],function(_0x58979c){return{'name':_0x58979c[_0x5bfd('0x31')],'type':_0x58979c[_0x5bfd('0x32')][_0x5bfd('0x33')]};});_0x25d7c6['model']=_[_0x5bfd('0x2f')](_0xbe936c,_0x5bfd('0x34'));_0x25d7c6[_0x5bfd('0x35')]=_[_0x5bfd('0x36')](_0x365eb5[_0x5bfd('0x35')]);_0x25d7c6[_0x5bfd('0x37')]=_['intersection'](_0x25d7c6[_0x5bfd('0x38')],_0x25d7c6['query']);_0x4a7c13[_0x5bfd('0x39')]=_['intersection'](_0x25d7c6[_0x5bfd('0x38')],qs[_0x5bfd('0x3a')](_0x365eb5[_0x5bfd('0x35')][_0x5bfd('0x3a')]));_0x4a7c13[_0x5bfd('0x39')]=_0x4a7c13[_0x5bfd('0x39')][_0x5bfd('0x3b')]?_0x4a7c13['attributes']:_0x25d7c6[_0x5bfd('0x38')];if(!_0x365eb5[_0x5bfd('0x35')][_0x5bfd('0x3c')](_0x5bfd('0x3d'))){_0x4a7c13['limit']=qs[_0x5bfd('0x23')](_0x365eb5['query']['limit']);_0x4a7c13['offset']=qs['offset'](_0x365eb5['query'][_0x5bfd('0x20')]);}_0x4a7c13[_0x5bfd('0x3e')]=qs[_0x5bfd('0x3f')](_0x365eb5[_0x5bfd('0x35')][_0x5bfd('0x3f')]);_0x4a7c13[_0x5bfd('0x40')]=qs[_0x5bfd('0x37')](_[_0x5bfd('0x41')](_0x365eb5[_0x5bfd('0x35')],_0x25d7c6[_0x5bfd('0x37')]),_0xbe936c);if(_0x365eb5[_0x5bfd('0x35')][_0x5bfd('0x42')]){_0x4a7c13[_0x5bfd('0x40')]=_[_0x5bfd('0x43')](_0x4a7c13[_0x5bfd('0x40')],{'$or':_['map'](_0xbe936c,function(_0x16097a){if(_0x16097a['type']!=='VIRTUAL'){var _0x3ee93b={};_0x3ee93b[_0x16097a['name']]={'$like':'%'+_0x365eb5['query']['filter']+'%'};return _0x3ee93b;}})});}_0x4a7c13=_[_0x5bfd('0x43')]({},_0x4a7c13,_0x365eb5[_0x5bfd('0x44')]);var _0x206556={'where':_0x4a7c13['where']};return db['SalesforceAccount'][_0x5bfd('0x22')](_0x206556)[_0x5bfd('0x2a')](function(_0x369967){_0x2ce22f[_0x5bfd('0x22')]=_0x369967;if(_0x365eb5['query'][_0x5bfd('0x45')]){_0x4a7c13[_0x5bfd('0x46')]=[{'all':!![]}];}return db[_0x5bfd('0x47')][_0x5bfd('0x48')](_0x4a7c13);})[_0x5bfd('0x2a')](function(_0x3c5f67){_0x2ce22f[_0x5bfd('0x49')]=_0x3c5f67;return _0x2ce22f;})[_0x5bfd('0x2a')](respondWithFilteredResult(_0x590ea5,_0x4a7c13))['catch'](handleError(_0x590ea5,null));};exports['show']=function(_0x184c93,_0x35f22f){var _0x37eac0={'raw':![],'where':{'id':_0x184c93[_0x5bfd('0x4a')]['id']}},_0x26001d={};_0x26001d[_0x5bfd('0x38')]=_[_0x5bfd('0x36')](db[_0x5bfd('0x47')]['rawAttributes']);_0x26001d['query']=_[_0x5bfd('0x36')](_0x184c93['query']);_0x26001d['filters']=_['intersection'](_0x26001d['model'],_0x26001d[_0x5bfd('0x35')]);_0x37eac0[_0x5bfd('0x39')]=_[_0x5bfd('0x4b')](_0x26001d['model'],qs[_0x5bfd('0x3a')](_0x184c93[_0x5bfd('0x35')][_0x5bfd('0x3a')]));_0x37eac0[_0x5bfd('0x39')]=_0x37eac0[_0x5bfd('0x39')][_0x5bfd('0x3b')]?_0x37eac0[_0x5bfd('0x39')]:_0x26001d['model'];if(_0x184c93[_0x5bfd('0x35')][_0x5bfd('0x45')]){_0x37eac0[_0x5bfd('0x46')]=[{'all':!![]}];}_0x37eac0=_[_0x5bfd('0x43')]({},_0x37eac0,_0x184c93[_0x5bfd('0x44')]);return db[_0x5bfd('0x47')][_0x5bfd('0x4c')](_0x37eac0)['then'](handleEntityNotFound(_0x35f22f,null))[_0x5bfd('0x2a')](respondWithResult(_0x35f22f,null))[_0x5bfd('0x4d')](handleError(_0x35f22f,null));};exports[_0x5bfd('0x4e')]=function(_0x33f8fb,_0x3ef7c7){return db['SalesforceAccount'][_0x5bfd('0x4e')](_0x33f8fb[_0x5bfd('0x4f')],{})[_0x5bfd('0x2a')](respondWithResult(_0x3ef7c7,0xc9))[_0x5bfd('0x4d')](handleError(_0x3ef7c7,null));};exports[_0x5bfd('0x28')]=function(_0x21c188,_0x43e53b){if(_0x21c188[_0x5bfd('0x4f')]['id']){delete _0x21c188[_0x5bfd('0x4f')]['id'];}return db[_0x5bfd('0x47')][_0x5bfd('0x4c')]({'where':{'id':_0x21c188[_0x5bfd('0x4a')]['id']}})[_0x5bfd('0x2a')](handleEntityNotFound(_0x43e53b,null))[_0x5bfd('0x2a')](saveUpdates(_0x21c188[_0x5bfd('0x4f')],null))[_0x5bfd('0x2a')](respondWithResult(_0x43e53b,null))[_0x5bfd('0x4d')](handleError(_0x43e53b,null));};exports['destroy']=function(_0x343c96,_0x1d453f){return db['SalesforceAccount'][_0x5bfd('0x4c')]({'where':{'id':_0x343c96[_0x5bfd('0x4a')]['id']}})[_0x5bfd('0x2a')](handleEntityNotFound(_0x1d453f,null))['then'](removeEntity(_0x1d453f,null))[_0x5bfd('0x4d')](handleError(_0x1d453f,null));};exports[_0x5bfd('0x50')]=function(_0x1d12f8,_0x2e7a17,_0x11bd02){var _0x446f9d={};var _0x510ac9={};var _0x3cc8e0;var _0x3055fe;return db['SalesforceAccount']['findOne']({'where':{'id':_0x1d12f8[_0x5bfd('0x4a')]['id']}})[_0x5bfd('0x2a')](handleEntityNotFound(_0x2e7a17,null))[_0x5bfd('0x2a')](function(_0x1b83cf){if(_0x1b83cf){_0x3cc8e0=_0x1b83cf;_0x510ac9['model']=_['keys'](db[_0x5bfd('0x51')][_0x5bfd('0x30')]);_0x510ac9[_0x5bfd('0x35')]=_[_0x5bfd('0x36')](_0x1d12f8[_0x5bfd('0x35')]);_0x510ac9[_0x5bfd('0x37')]=_['intersection'](_0x510ac9['model'],_0x510ac9[_0x5bfd('0x35')]);_0x446f9d['attributes']=_[_0x5bfd('0x4b')](_0x510ac9[_0x5bfd('0x38')],qs[_0x5bfd('0x3a')](_0x1d12f8['query']['fields']));_0x446f9d[_0x5bfd('0x39')]=_0x446f9d[_0x5bfd('0x39')]['length']?_0x446f9d[_0x5bfd('0x39')]:_0x510ac9[_0x5bfd('0x38')];_0x446f9d['order']=qs['sort'](_0x1d12f8[_0x5bfd('0x35')][_0x5bfd('0x3f')]);_0x446f9d[_0x5bfd('0x40')]=qs[_0x5bfd('0x37')](_[_0x5bfd('0x41')](_0x1d12f8['query'],_0x510ac9[_0x5bfd('0x37')]));if(_0x1d12f8['query'][_0x5bfd('0x42')]){_0x446f9d['where']=_[_0x5bfd('0x43')](_0x446f9d[_0x5bfd('0x40')],{'$or':_[_0x5bfd('0x2f')](_0x446f9d[_0x5bfd('0x39')],function(_0x5038c7){var _0x33e280={};_0x33e280[_0x5038c7]={'$like':'%'+_0x1d12f8[_0x5bfd('0x35')][_0x5bfd('0x42')]+'%'};return _0x33e280;})});}_0x446f9d=_[_0x5bfd('0x43')]({},_0x446f9d,_0x1d12f8[_0x5bfd('0x44')]);return _0x3cc8e0[_0x5bfd('0x50')](_0x446f9d);}})[_0x5bfd('0x2a')](function(_0x5fd165){if(_0x5fd165){_0x3055fe=_0x5fd165['length'];if(!_0x1d12f8['query']['hasOwnProperty'](_0x5bfd('0x3d'))){_0x446f9d[_0x5bfd('0x23')]=qs[_0x5bfd('0x23')](_0x1d12f8['query'][_0x5bfd('0x23')]);_0x446f9d[_0x5bfd('0x20')]=qs[_0x5bfd('0x20')](_0x1d12f8[_0x5bfd('0x35')][_0x5bfd('0x20')]);}return _0x3cc8e0[_0x5bfd('0x50')](_0x446f9d);}})[_0x5bfd('0x2a')](function(_0x53f024){if(_0x53f024){return _0x53f024?{'count':_0x3055fe,'rows':_0x53f024}:null;}})['then'](respondWithResult(_0x2e7a17,null))['catch'](handleError(_0x2e7a17,null));};exports[_0x5bfd('0x52')]=function(_0x39b10f,_0x283763,_0x480d15){if(_0x39b10f[_0x5bfd('0x4f')]['id']){delete _0x39b10f[_0x5bfd('0x4f')]['id'];}return db['SalesforceAccount'][_0x5bfd('0x53')]({'where':{'id':_0x39b10f[_0x5bfd('0x4a')]['id']}})[_0x5bfd('0x2a')](handleEntityNotFound(_0x283763,null))[_0x5bfd('0x2a')](function(_0x24ee5c){if(_0x24ee5c){_0x39b10f['body'][_0x5bfd('0x54')]=_0x24ee5c['id'];_0x39b10f[_0x5bfd('0x4f')][_0x5bfd('0x55')]=integrations[_0x5bfd('0x56')](_0x39b10f[_0x5bfd('0x4f')][_0x5bfd('0x57')],_0x39b10f[_0x5bfd('0x4f')][_0x5bfd('0x32')]);_0x39b10f[_0x5bfd('0x4f')]['Descriptions']=integrations['getDescriptions'](_0x39b10f['body']['channel'],_0x39b10f[_0x5bfd('0x4f')][_0x5bfd('0x32')]);return db[_0x5bfd('0x51')][_0x5bfd('0x4e')](_0x39b10f[_0x5bfd('0x4f')],{'include':[{'model':db['SalesforceField'],'as':_0x5bfd('0x55')},{'model':db[_0x5bfd('0x58')],'as':_0x5bfd('0x59')}]});}return null;})[_0x5bfd('0x2a')](respondWithResult(_0x283763,null))['catch'](handleError(_0x283763,null));};exports[_0x5bfd('0x5a')]=function(_0xc88981,_0x3e07d5,_0x373c0f){var _0x210a79;var _0x1d2ca7='';var _0x51b27c=_0x5bfd('0x5b');return db['SalesforceAccount'][_0x5bfd('0x53')]({'where':{'id':_0xc88981[_0x5bfd('0x4a')]['id']},'attributes':['id',_0x5bfd('0x5c'),'clientId',_0x5bfd('0x5d'),_0x5bfd('0x5e'),_0x5bfd('0x5f'),_0x5bfd('0x60')]})[_0x5bfd('0x2a')](handleEntityNotFound(_0x3e07d5,null))[_0x5bfd('0x2a')](function(_0x43ea35){if(_0x43ea35){_0x1d2ca7=_0x43ea35[_0x5bfd('0x5c')];var _0x4b0927=_0x1d2ca7[_0x5bfd('0x61')](-0x1);if(_0x4b0927==='/'){_0x1d2ca7=_0x1d2ca7['substring'](0x0,_0x1d2ca7[_0x5bfd('0x62')](_0x4b0927));}_0x210a79=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1d2ca7,'clientId':_0x43ea35['clientId'],'clientSecret':_0x43ea35[_0x5bfd('0x5d')]}});return _0x210a79[_0x5bfd('0x63')](_0x43ea35[_0x5bfd('0x5e')],_0x43ea35['password'][_0x5bfd('0x64')](_0x43ea35[_0x5bfd('0x60')]));}})[_0x5bfd('0x2a')](function(_0x260721){if(_0x260721){if(!_[_0x5bfd('0x65')](_0xc88981['query'][_0x5bfd('0x66')])){_0x51b27c=_0xc88981['query'][_0x5bfd('0x66')];}return _0x210a79[_0x5bfd('0x67')](_0x51b27c)[_0x5bfd('0x68')]();}})[_0x5bfd('0x2a')](function(_0x1c9851){var _0x13767a=[_0x5bfd('0x69'),_0x5bfd('0x6a'),_0x5bfd('0x6b'),_0x5bfd('0x6c'),_0x5bfd('0x6d'),_0x5bfd('0x6e')];var _0x4b906d=[_0x5bfd('0x6f'),_0x5bfd('0x70'),'picklist',_0x5bfd('0x71'),'email',_0x5bfd('0x72'),_0x5bfd('0x73')];if(_0x1c9851){_[_0x5bfd('0x74')](_0x1c9851[_0x5bfd('0x3a')],function(_0x23a4ee){return _0x13767a[_0x5bfd('0x75')](_0x23a4ee['name'])||!_0x4b906d[_0x5bfd('0x75')](_0x23a4ee[_0x5bfd('0x32')]);});return{'count':_0x1c9851[_0x5bfd('0x3a')][_0x5bfd('0x3b')],'rows':_[_0x5bfd('0x2f')](_0x1c9851[_0x5bfd('0x3a')],function(_0x3bcfc9){return{'id':_0x3bcfc9[_0x5bfd('0x34')],'name':_0x3bcfc9[_0x5bfd('0x76')],'custom':_0x3bcfc9[_0x5bfd('0x77')],'options':_0x3bcfc9[_0x5bfd('0x78')][_0x5bfd('0x3b')]>0x0?_['map'](_0x3bcfc9[_0x5bfd('0x78')],function(_0x272325){return{'name':_0x272325[_0x5bfd('0x76')],'value':_0x272325[_0x5bfd('0x79')]};}):_0x3bcfc9[_0x5bfd('0x32')]==_0x5bfd('0x71')?[{'name':_0x5bfd('0x7a'),'value':'true'},{'name':_0x5bfd('0x7b'),'value':_0x5bfd('0x7c')}]:[]};})};}})[_0x5bfd('0x2a')](respondWithResult(_0x3e07d5,null))[_0x5bfd('0x4d')](function(_0xe33e4e){var _0x25a879=_0xc88981['query'][_0x5bfd('0x7d')]?0x1f4:_0xe33e4e[_0x5bfd('0x7e')]||0x1f4;logger[_0x5bfd('0x2b')](_0x5bfd('0x7f'),_0x5bfd('0x5a'),_0x25a879,JSON['stringify'](_0xe33e4e));delete _0xe33e4e[_0x5bfd('0x34')];if(_0x25a879===0x191){_0x25a879=0x190;}_0x3e07d5[_0x5bfd('0x1d')](_0x25a879)[_0x5bfd('0x2d')](_0xc88981[_0x5bfd('0x35')][_0x5bfd('0x7d')]?{'message':_0x5bfd('0x80'),'statusCode':_0xe33e4e[_0x5bfd('0x7e')]}:_0xe33e4e);});}; \ No newline at end of file +var _0xf87a=['show','params','filters','find','body','getConfigurations','findOne','SalesforceConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','SalesforceField','getFields','Task','clientId','clientSecret','password','securityToken','remoteUri','substring','lastIndexOf','login','username','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','boolean','email','phone','remove','includes','custom','picklistValues','label','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf87a,0x1be));var _0xaf87=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf87a[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xaf87('0x0'));var rimraf=require(_0xaf87('0x1'));var zipdir=require(_0xaf87('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf87('0x3'));var moment=require(_0xaf87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaf87('0x5'));var util=require(_0xaf87('0x6'));var path=require(_0xaf87('0x7'));var sox=require(_0xaf87('0x8'));var csv=require('to-csv');var ejs=require(_0xaf87('0x9'));var fs=require('fs');var fs_extra=require(_0xaf87('0xa'));var _=require(_0xaf87('0xb'));var squel=require(_0xaf87('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaf87('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaf87('0xe'));var Redis=require(_0xaf87('0xf'));var authService=require(_0xaf87('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xaf87('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf87('0x12'))(_0xaf87('0x13'));var utils=require('../../config/utils');var config=require(_0xaf87('0x14'));var licenseUtil=require(_0xaf87('0x15'));var db=require(_0xaf87('0x16'))['db'];var integrations=require(_0xaf87('0x17'));function respondWithStatusCode(_0xf99ba3,_0x1d6261){_0x1d6261=_0x1d6261||0xcc;return function(_0xbe3cc1){if(_0xbe3cc1){return _0xf99ba3['sendStatus'](_0x1d6261);}return _0xf99ba3[_0xaf87('0x18')](_0x1d6261)[_0xaf87('0x19')]();};}function respondWithResult(_0x1a506d,_0x57825c){_0x57825c=_0x57825c||0xc8;return function(_0x404c59){if(_0x404c59){return _0x1a506d['status'](_0x57825c)[_0xaf87('0x1a')](_0x404c59);}};}function respondWithFilteredResult(_0x4a1def,_0x14a5b8){return function(_0x56e235){if(_0x56e235){var _0x79da5a=typeof _0x14a5b8[_0xaf87('0x1b')]===_0xaf87('0x1c')&&typeof _0x14a5b8[_0xaf87('0x1d')]===_0xaf87('0x1c');var _0x45d80a=_0x56e235[_0xaf87('0x1e')];var _0x1a88f0=_0x79da5a?0x0:_0x14a5b8[_0xaf87('0x1b')];var _0x175f9a=_0x79da5a?_0x56e235[_0xaf87('0x1e')]:_0x14a5b8[_0xaf87('0x1b')]+_0x14a5b8[_0xaf87('0x1d')];var _0x3aa6ec;if(_0x175f9a>=_0x45d80a){_0x175f9a=_0x45d80a;_0x3aa6ec=0xc8;}else{_0x3aa6ec=0xce;}_0x4a1def[_0xaf87('0x18')](_0x3aa6ec);return _0x4a1def[_0xaf87('0x1f')](_0xaf87('0x20'),_0x1a88f0+'-'+_0x175f9a+'/'+_0x45d80a)['json'](_0x56e235);}return null;};}function patchUpdates(_0xedb665){return function(_0x5d1649){try{jsonpatch['apply'](_0x5d1649,_0xedb665,!![]);}catch(_0x3634f9){return BPromise['reject'](_0x3634f9);}return _0x5d1649[_0xaf87('0x21')]();};}function saveUpdates(_0x367b66,_0x4201ab){return function(_0x231828){if(_0x231828){return _0x231828[_0xaf87('0x22')](_0x367b66)[_0xaf87('0x23')](function(_0x4d16c9){return _0x4d16c9;});}return null;};}function removeEntity(_0x13c0d9,_0x1bbd55){return function(_0x564b04){if(_0x564b04){return _0x564b04[_0xaf87('0x24')]()['then'](function(){_0x13c0d9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x57a718,_0x4daf91){return function(_0x1291cf){if(!_0x1291cf){_0x57a718[_0xaf87('0x25')](0x194);}return _0x1291cf;};}function handleError(_0x5f45bc,_0x3eec9a){_0x3eec9a=_0x3eec9a||0x1f4;return function(_0x5ab03b){logger[_0xaf87('0x26')](_0x5ab03b[_0xaf87('0x27')]);if(_0x5ab03b['name']){delete _0x5ab03b[_0xaf87('0x28')];}_0x5f45bc[_0xaf87('0x18')](_0x3eec9a)[_0xaf87('0x29')](_0x5ab03b);};}exports[_0xaf87('0x2a')]=function(_0x41fc32,_0x35be4d){var _0x25c030={},_0x412c58={},_0x51e9ea={'count':0x0,'rows':[]};var _0x2a7b86=_['map'](db[_0xaf87('0x2b')][_0xaf87('0x2c')],function(_0x4af729){return{'name':_0x4af729[_0xaf87('0x2d')],'type':_0x4af729['type'][_0xaf87('0x2e')]};});_0x412c58[_0xaf87('0x2f')]=_[_0xaf87('0x30')](_0x2a7b86,_0xaf87('0x28'));_0x412c58[_0xaf87('0x31')]=_[_0xaf87('0x32')](_0x41fc32[_0xaf87('0x31')]);_0x412c58['filters']=_[_0xaf87('0x33')](_0x412c58['model'],_0x412c58['query']);_0x25c030[_0xaf87('0x34')]=_[_0xaf87('0x33')](_0x412c58[_0xaf87('0x2f')],qs[_0xaf87('0x35')](_0x41fc32[_0xaf87('0x31')][_0xaf87('0x35')]));_0x25c030['attributes']=_0x25c030[_0xaf87('0x34')][_0xaf87('0x36')]?_0x25c030[_0xaf87('0x34')]:_0x412c58[_0xaf87('0x2f')];if(!_0x41fc32[_0xaf87('0x31')][_0xaf87('0x37')]('nolimit')){_0x25c030['limit']=qs[_0xaf87('0x1d')](_0x41fc32[_0xaf87('0x31')][_0xaf87('0x1d')]);_0x25c030[_0xaf87('0x1b')]=qs[_0xaf87('0x1b')](_0x41fc32[_0xaf87('0x31')]['offset']);}_0x25c030[_0xaf87('0x38')]=qs[_0xaf87('0x39')](_0x41fc32[_0xaf87('0x31')][_0xaf87('0x39')]);_0x25c030[_0xaf87('0x3a')]=qs['filters'](_[_0xaf87('0x3b')](_0x41fc32[_0xaf87('0x31')],_0x412c58['filters']),_0x2a7b86);if(_0x41fc32[_0xaf87('0x31')][_0xaf87('0x3c')]){_0x25c030[_0xaf87('0x3a')]=_[_0xaf87('0x3d')](_0x25c030['where'],{'$or':_[_0xaf87('0x30')](_0x2a7b86,function(_0xfa91fd){if(_0xfa91fd[_0xaf87('0x3e')]!==_0xaf87('0x3f')){var _0x4cec5a={};_0x4cec5a[_0xfa91fd[_0xaf87('0x28')]]={'$like':'%'+_0x41fc32['query'][_0xaf87('0x3c')]+'%'};return _0x4cec5a;}})});}_0x25c030=_[_0xaf87('0x3d')]({},_0x25c030,_0x41fc32[_0xaf87('0x40')]);var _0x1fcd06={'where':_0x25c030[_0xaf87('0x3a')]};return db[_0xaf87('0x2b')]['count'](_0x1fcd06)[_0xaf87('0x23')](function(_0x13f508){_0x51e9ea['count']=_0x13f508;if(_0x41fc32[_0xaf87('0x31')][_0xaf87('0x41')]){_0x25c030[_0xaf87('0x42')]=[{'all':!![]}];}return db[_0xaf87('0x2b')][_0xaf87('0x43')](_0x25c030);})['then'](function(_0x38f96e){_0x51e9ea[_0xaf87('0x44')]=_0x38f96e;return _0x51e9ea;})[_0xaf87('0x23')](respondWithFilteredResult(_0x35be4d,_0x25c030))[_0xaf87('0x45')](handleError(_0x35be4d,null));};exports[_0xaf87('0x46')]=function(_0x482c97,_0x10e489){var _0x1617af={'raw':![],'where':{'id':_0x482c97[_0xaf87('0x47')]['id']}},_0x3b02ad={};_0x3b02ad[_0xaf87('0x2f')]=_[_0xaf87('0x32')](db[_0xaf87('0x2b')][_0xaf87('0x2c')]);_0x3b02ad['query']=_[_0xaf87('0x32')](_0x482c97['query']);_0x3b02ad[_0xaf87('0x48')]=_[_0xaf87('0x33')](_0x3b02ad[_0xaf87('0x2f')],_0x3b02ad[_0xaf87('0x31')]);_0x1617af[_0xaf87('0x34')]=_[_0xaf87('0x33')](_0x3b02ad['model'],qs[_0xaf87('0x35')](_0x482c97[_0xaf87('0x31')][_0xaf87('0x35')]));_0x1617af[_0xaf87('0x34')]=_0x1617af[_0xaf87('0x34')][_0xaf87('0x36')]?_0x1617af[_0xaf87('0x34')]:_0x3b02ad[_0xaf87('0x2f')];if(_0x482c97[_0xaf87('0x31')][_0xaf87('0x41')]){_0x1617af[_0xaf87('0x42')]=[{'all':!![]}];}_0x1617af=_[_0xaf87('0x3d')]({},_0x1617af,_0x482c97[_0xaf87('0x40')]);return db[_0xaf87('0x2b')][_0xaf87('0x49')](_0x1617af)[_0xaf87('0x23')](handleEntityNotFound(_0x10e489,null))[_0xaf87('0x23')](respondWithResult(_0x10e489,null))[_0xaf87('0x45')](handleError(_0x10e489,null));};exports['create']=function(_0x58ae59,_0x4a1eea){return db[_0xaf87('0x2b')]['create'](_0x58ae59['body'],{})[_0xaf87('0x23')](respondWithResult(_0x4a1eea,0xc9))['catch'](handleError(_0x4a1eea,null));};exports[_0xaf87('0x22')]=function(_0x3a7e66,_0x427400){if(_0x3a7e66[_0xaf87('0x4a')]['id']){delete _0x3a7e66[_0xaf87('0x4a')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x3a7e66[_0xaf87('0x47')]['id']}})[_0xaf87('0x23')](handleEntityNotFound(_0x427400,null))['then'](saveUpdates(_0x3a7e66[_0xaf87('0x4a')],null))[_0xaf87('0x23')](respondWithResult(_0x427400,null))[_0xaf87('0x45')](handleError(_0x427400,null));};exports[_0xaf87('0x24')]=function(_0x573962,_0x14c6d5){return db[_0xaf87('0x2b')][_0xaf87('0x49')]({'where':{'id':_0x573962[_0xaf87('0x47')]['id']}})[_0xaf87('0x23')](handleEntityNotFound(_0x14c6d5,null))['then'](removeEntity(_0x14c6d5,null))[_0xaf87('0x45')](handleError(_0x14c6d5,null));};exports[_0xaf87('0x4b')]=function(_0xde2df9,_0x15dcd4,_0x184fc3){var _0x187b39={};var _0x146d56={};var _0x25d253;var _0x4238e5;return db[_0xaf87('0x2b')][_0xaf87('0x4c')]({'where':{'id':_0xde2df9[_0xaf87('0x47')]['id']}})[_0xaf87('0x23')](handleEntityNotFound(_0x15dcd4,null))[_0xaf87('0x23')](function(_0x421948){if(_0x421948){_0x25d253=_0x421948;_0x146d56[_0xaf87('0x2f')]=_[_0xaf87('0x32')](db[_0xaf87('0x4d')]['rawAttributes']);_0x146d56[_0xaf87('0x31')]=_[_0xaf87('0x32')](_0xde2df9[_0xaf87('0x31')]);_0x146d56[_0xaf87('0x48')]=_['intersection'](_0x146d56[_0xaf87('0x2f')],_0x146d56[_0xaf87('0x31')]);_0x187b39[_0xaf87('0x34')]=_['intersection'](_0x146d56[_0xaf87('0x2f')],qs[_0xaf87('0x35')](_0xde2df9['query'][_0xaf87('0x35')]));_0x187b39['attributes']=_0x187b39['attributes']['length']?_0x187b39['attributes']:_0x146d56[_0xaf87('0x2f')];_0x187b39[_0xaf87('0x38')]=qs['sort'](_0xde2df9[_0xaf87('0x31')][_0xaf87('0x39')]);_0x187b39[_0xaf87('0x3a')]=qs['filters'](_[_0xaf87('0x3b')](_0xde2df9[_0xaf87('0x31')],_0x146d56['filters']));if(_0xde2df9['query'][_0xaf87('0x3c')]){_0x187b39[_0xaf87('0x3a')]=_[_0xaf87('0x3d')](_0x187b39['where'],{'$or':_['map'](_0x187b39['attributes'],function(_0x1bf72a){var _0x1106db={};_0x1106db[_0x1bf72a]={'$like':'%'+_0xde2df9[_0xaf87('0x31')][_0xaf87('0x3c')]+'%'};return _0x1106db;})});}_0x187b39=_['merge']({},_0x187b39,_0xde2df9[_0xaf87('0x40')]);return _0x25d253['getConfigurations'](_0x187b39);}})['then'](function(_0x471436){if(_0x471436){_0x4238e5=_0x471436[_0xaf87('0x36')];if(!_0xde2df9['query'][_0xaf87('0x37')](_0xaf87('0x4e'))){_0x187b39['limit']=qs[_0xaf87('0x1d')](_0xde2df9['query']['limit']);_0x187b39['offset']=qs[_0xaf87('0x1b')](_0xde2df9[_0xaf87('0x31')][_0xaf87('0x1b')]);}return _0x25d253['getConfigurations'](_0x187b39);}})['then'](function(_0x1ff0bb){if(_0x1ff0bb){return _0x1ff0bb?{'count':_0x4238e5,'rows':_0x1ff0bb}:null;}})[_0xaf87('0x23')](respondWithResult(_0x15dcd4,null))[_0xaf87('0x45')](handleError(_0x15dcd4,null));};exports[_0xaf87('0x4f')]=function(_0xbd1b0f,_0x1dab03,_0x270e48){if(_0xbd1b0f['body']['id']){delete _0xbd1b0f[_0xaf87('0x4a')]['id'];}return db[_0xaf87('0x2b')][_0xaf87('0x4c')]({'where':{'id':_0xbd1b0f[_0xaf87('0x47')]['id']}})[_0xaf87('0x23')](handleEntityNotFound(_0x1dab03,null))[_0xaf87('0x23')](function(_0x4bcc95){if(_0x4bcc95){_0xbd1b0f[_0xaf87('0x4a')][_0xaf87('0x50')]=_0x4bcc95['id'];_0xbd1b0f['body'][_0xaf87('0x51')]=integrations[_0xaf87('0x52')](_0xbd1b0f['body']['channel'],_0xbd1b0f[_0xaf87('0x4a')]['type']);_0xbd1b0f[_0xaf87('0x4a')][_0xaf87('0x53')]=integrations[_0xaf87('0x54')](_0xbd1b0f[_0xaf87('0x4a')][_0xaf87('0x55')],_0xbd1b0f['body'][_0xaf87('0x3e')]);return db['SalesforceConfiguration'][_0xaf87('0x56')](_0xbd1b0f['body'],{'include':[{'model':db['SalesforceField'],'as':_0xaf87('0x51')},{'model':db[_0xaf87('0x57')],'as':_0xaf87('0x53')}]});}return null;})['then'](respondWithResult(_0x1dab03,null))[_0xaf87('0x45')](handleError(_0x1dab03,null));};exports[_0xaf87('0x58')]=function(_0x421fb5,_0x452ed8,_0x477690){var _0x1abb9c;var _0x16e205='';var _0x2bf15e=_0xaf87('0x59');return db['SalesforceAccount'][_0xaf87('0x4c')]({'where':{'id':_0x421fb5[_0xaf87('0x47')]['id']},'attributes':['id','remoteUri',_0xaf87('0x5a'),_0xaf87('0x5b'),'username',_0xaf87('0x5c'),_0xaf87('0x5d')]})[_0xaf87('0x23')](handleEntityNotFound(_0x452ed8,null))[_0xaf87('0x23')](function(_0x25989e){if(_0x25989e){_0x16e205=_0x25989e[_0xaf87('0x5e')];var _0xde5495=_0x16e205['slice'](-0x1);if(_0xde5495==='/'){_0x16e205=_0x16e205[_0xaf87('0x5f')](0x0,_0x16e205[_0xaf87('0x60')](_0xde5495));}_0x1abb9c=new jsforce['Connection']({'oauth2':{'loginUrl':_0x16e205,'clientId':_0x25989e[_0xaf87('0x5a')],'clientSecret':_0x25989e['clientSecret']}});return _0x1abb9c[_0xaf87('0x61')](_0x25989e[_0xaf87('0x62')],_0x25989e['password'][_0xaf87('0x63')](_0x25989e[_0xaf87('0x5d')]));}})['then'](function(_0x5ef974){if(_0x5ef974){if(!_['isNil'](_0x421fb5[_0xaf87('0x31')][_0xaf87('0x64')])){_0x2bf15e=_0x421fb5[_0xaf87('0x31')][_0xaf87('0x64')];}return _0x1abb9c[_0xaf87('0x65')](_0x2bf15e)[_0xaf87('0x66')]();}})[_0xaf87('0x23')](function(_0x508584){var _0x5a4606=[_0xaf87('0x67'),_0xaf87('0x68'),_0xaf87('0x69'),_0xaf87('0x6a'),_0xaf87('0x6b'),_0xaf87('0x6c')];var _0x403b01=['string',_0xaf87('0x6d'),_0xaf87('0x6e'),_0xaf87('0x6f'),_0xaf87('0x70'),'textarea',_0xaf87('0x71')];if(_0x508584){_[_0xaf87('0x72')](_0x508584[_0xaf87('0x35')],function(_0x39d6ac){return _0x5a4606[_0xaf87('0x73')](_0x39d6ac['name'])||!_0x403b01[_0xaf87('0x73')](_0x39d6ac[_0xaf87('0x3e')]);});return{'count':_0x508584[_0xaf87('0x35')]['length'],'rows':_[_0xaf87('0x30')](_0x508584[_0xaf87('0x35')],function(_0x5c9740){return{'id':_0x5c9740[_0xaf87('0x28')],'name':_0x5c9740['label'],'custom':_0x5c9740[_0xaf87('0x74')],'options':_0x5c9740[_0xaf87('0x75')]['length']>0x0?_[_0xaf87('0x30')](_0x5c9740[_0xaf87('0x75')],function(_0x2340b5){return{'name':_0x2340b5[_0xaf87('0x76')],'value':_0x2340b5[_0xaf87('0x77')]};}):_0x5c9740['type']==_0xaf87('0x6f')?[{'name':_0xaf87('0x78'),'value':_0xaf87('0x79')},{'name':_0xaf87('0x7a'),'value':_0xaf87('0x7b')}]:[]};})};}})[_0xaf87('0x23')](respondWithResult(_0x452ed8,null))['catch'](function(_0x109d14){var _0x4cd77f=_0x421fb5[_0xaf87('0x31')][_0xaf87('0x7c')]?0x1f4:_0x109d14[_0xaf87('0x7d')]||0x1f4;logger[_0xaf87('0x26')](_0xaf87('0x7e'),_0xaf87('0x58'),_0x4cd77f,JSON[_0xaf87('0x7f')](_0x109d14));delete _0x109d14[_0xaf87('0x28')];if(_0x4cd77f===0x191){_0x4cd77f=0x190;}_0x452ed8[_0xaf87('0x18')](_0x4cd77f)[_0xaf87('0x29')](_0x421fb5[_0xaf87('0x31')][_0xaf87('0x7c')]?{'message':_0xaf87('0x80'),'statusCode':_0x109d14[_0xaf87('0x7d')]}:_0x109d14);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 83b7245..24e572a 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 _0x07f4=['lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x07f4,0xe7));var _0x407f=function(_0x1152a6,_0x2bf21e){_0x1152a6=_0x1152a6-0x0;var _0xdd3f9=_0x07f4[_0x1152a6];return _0xdd3f9;};'use strict';var _=require(_0x407f('0x0'));var util=require('util');var logger=require(_0x407f('0x1'))('api');var moment=require(_0x407f('0x2'));var BPromise=require('bluebird');var rp=require(_0x407f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x407f('0x4'));var config=require(_0x407f('0x5'));var attributes=require(_0x407f('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x407f('0x7')]=function(_0x22006e,_0x112842){return _0x22006e[_0x407f('0x8')](_0x407f('0x9'),attributes,{'tableName':_0x407f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b02=['api','moment','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger'];(function(_0x430228,_0x11206a){var _0x4e19aa=function(_0x1d01b2){while(--_0x1d01b2){_0x430228['push'](_0x430228['shift']());}};_0x4e19aa(++_0x11206a);}(_0x3b02,0x1d2));var _0x23b0=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x3b02[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x23b0('0x0'));var util=require('util');var logger=require(_0x23b0('0x1'))(_0x23b0('0x2'));var moment=require(_0x23b0('0x3'));var BPromise=require(_0x23b0('0x4'));var rp=require(_0x23b0('0x5'));var fs=require('fs');var path=require(_0x23b0('0x6'));var rimraf=require(_0x23b0('0x7'));var config=require('../../config/environment');var attributes=require(_0x23b0('0x8'));var integrations=require(_0x23b0('0x9'));module[_0x23b0('0xa')]=function(_0x2b06ac,_0x460155){return _0x2b06ac['define'](_0x23b0('0xb'),attributes,{'tableName':_0x23b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 00d597a..6d28282 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 _0xa7c2=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetSalesforceAccount','findAll','options','where','attributes','limit','include','map','model','then','SalesforceAccount','find','raw','ShowSalesforceAccount','lodash'];(function(_0x568511,_0x533449){var _0x34bc5c=function(_0x2fc846){while(--_0x2fc846){_0x568511['push'](_0x568511['shift']());}};_0x34bc5c(++_0x533449);}(_0xa7c2,0x8f));var _0x2a7c=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xa7c2[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x2a7c('0x0'));var util=require('util');var moment=require(_0x2a7c('0x1'));var BPromise=require(_0x2a7c('0x2'));var rs=require(_0x2a7c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a7c('0x4'))['db'];var utils=require(_0x2a7c('0x5'));var logger=require(_0x2a7c('0x6'))(_0x2a7c('0x7'));var config=require(_0x2a7c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2a7c('0x9')][_0x2a7c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a0cfd,_0x44954a,_0xd6f98f){return new BPromise(function(_0x20b2d5,_0x1d38bf){return client[_0x2a7c('0xb')](_0x1a0cfd,_0xd6f98f)['then'](function(_0x302440){logger[_0x2a7c('0xc')](_0x2a7c('0xd'),_0x44954a,'request\x20sent');logger[_0x2a7c('0xe')](_0x2a7c('0xf'),_0x44954a,_0x2a7c('0x10'),JSON[_0x2a7c('0x11')](_0x302440));if(_0x302440[_0x2a7c('0x12')]){if(_0x302440[_0x2a7c('0x12')][_0x2a7c('0x13')]===0x1f4){logger[_0x2a7c('0x12')](_0x2a7c('0xd'),_0x44954a,_0x302440[_0x2a7c('0x12')][_0x2a7c('0x14')]);return _0x1d38bf(_0x302440['error'][_0x2a7c('0x14')]);}logger[_0x2a7c('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x44954a,_0x302440[_0x2a7c('0x12')][_0x2a7c('0x14')]);return _0x20b2d5(_0x302440[_0x2a7c('0x12')][_0x2a7c('0x14')]);}else{logger[_0x2a7c('0xc')](_0x2a7c('0xd'),_0x44954a,'request\x20sent');_0x20b2d5(_0x302440['result']['message']);}})[_0x2a7c('0x15')](function(_0x4a49cd){logger[_0x2a7c('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x44954a,_0x4a49cd);_0x1d38bf(_0x4a49cd);});});}exports[_0x2a7c('0x16')]=function(_0x417587){var _0x17a239=this;return new Promise(function(_0x48fd06,_0x48cc3c){return db['SalesforceAccount'][_0x2a7c('0x17')]({'raw':_0x417587[_0x2a7c('0x18')]?_0x417587[_0x2a7c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x417587['options']?_0x417587[_0x2a7c('0x18')][_0x2a7c('0x19')]||null:null,'attributes':_0x417587['options']?_0x417587[_0x2a7c('0x18')][_0x2a7c('0x1a')]||null:null,'limit':_0x417587[_0x2a7c('0x18')]?_0x417587[_0x2a7c('0x18')][_0x2a7c('0x1b')]||null:null,'include':_0x417587[_0x2a7c('0x18')]?_0x417587[_0x2a7c('0x18')][_0x2a7c('0x1c')]?_['map'](_0x417587['options'][_0x2a7c('0x1c')],function(_0x2e83fb){return{'model':db[_0x2e83fb['model']],'as':_0x2e83fb['as'],'attributes':_0x2e83fb['attributes'],'include':_0x2e83fb[_0x2a7c('0x1c')]?_[_0x2a7c('0x1d')](_0x2e83fb[_0x2a7c('0x1c')],function(_0x59b79e){return{'model':db[_0x59b79e[_0x2a7c('0x1e')]],'as':_0x59b79e['as'],'attributes':_0x59b79e[_0x2a7c('0x1a')],'include':_0x59b79e[_0x2a7c('0x1c')]?_[_0x2a7c('0x1d')](_0x59b79e[_0x2a7c('0x1c')],function(_0x17af20){return{'model':db[_0x17af20[_0x2a7c('0x1e')]],'as':_0x17af20['as'],'attributes':_0x17af20['attributes']};}):[]};}):[]};}):[]:[]})[_0x2a7c('0x1f')](function(_0x26cbaa){logger[_0x2a7c('0xc')](_0x2a7c('0x16'),_0x417587);logger['debug'](_0x2a7c('0x16'),_0x417587,JSON[_0x2a7c('0x11')](_0x26cbaa));_0x48fd06(_0x26cbaa);})[_0x2a7c('0x15')](function(_0x148626){logger[_0x2a7c('0x12')](_0x2a7c('0x16'),_0x148626[_0x2a7c('0x14')],_0x417587);_0x48cc3c(_0x17a239[_0x2a7c('0x12')](0x1f4,_0x148626[_0x2a7c('0x14')]));});});};exports['ShowSalesforceAccount']=function(_0x361400){var _0x533282=this;return new Promise(function(_0x245ae8,_0x45b90e){return db[_0x2a7c('0x20')][_0x2a7c('0x21')]({'raw':_0x361400['options']?_0x361400[_0x2a7c('0x18')][_0x2a7c('0x22')]===undefined?!![]:![]:!![],'where':_0x361400[_0x2a7c('0x18')]?_0x361400[_0x2a7c('0x18')]['where']||null:null,'attributes':_0x361400[_0x2a7c('0x18')]?_0x361400[_0x2a7c('0x18')][_0x2a7c('0x1a')]||null:null,'include':_0x361400['options']?_0x361400[_0x2a7c('0x18')][_0x2a7c('0x1c')]?_['map'](_0x361400[_0x2a7c('0x18')][_0x2a7c('0x1c')],function(_0x22b02e){return{'model':db[_0x22b02e[_0x2a7c('0x1e')]],'as':_0x22b02e['as'],'attributes':_0x22b02e[_0x2a7c('0x1a')],'include':_0x22b02e[_0x2a7c('0x1c')]?_[_0x2a7c('0x1d')](_0x22b02e[_0x2a7c('0x1c')],function(_0x1b040a){return{'model':db[_0x1b040a[_0x2a7c('0x1e')]],'as':_0x1b040a['as'],'attributes':_0x1b040a[_0x2a7c('0x1a')],'include':_0x1b040a[_0x2a7c('0x1c')]?_[_0x2a7c('0x1d')](_0x1b040a[_0x2a7c('0x1c')],function(_0x2ef487){return{'model':db[_0x2ef487[_0x2a7c('0x1e')]],'as':_0x2ef487['as'],'attributes':_0x2ef487[_0x2a7c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2a7c('0x1f')](function(_0xfb1464){logger[_0x2a7c('0xc')](_0x2a7c('0x23'),_0x361400);logger[_0x2a7c('0xe')](_0x2a7c('0x23'),_0x361400,JSON[_0x2a7c('0x11')](_0xfb1464));_0x245ae8(_0xfb1464);})[_0x2a7c('0x15')](function(_0x1b8160){logger[_0x2a7c('0x12')](_0x2a7c('0x23'),_0x1b8160['message'],_0x361400);_0x45b90e(_0x533282[_0x2a7c('0x12')](0x1f4,_0x1b8160['message']));});});}; \ No newline at end of file +var _0xa6f8=['catch','ShowSalesforceAccount','find','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','debug','request\x20sent','error','code','SalesforceAccount,\x20%s,\x20%s','message','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','info'];(function(_0x263558,_0x2cd536){var _0x53f63f=function(_0x30fdf1){while(--_0x30fdf1){_0x263558['push'](_0x263558['shift']());}};_0x53f63f(++_0x2cd536);}(_0xa6f8,0x94));var _0x8a6f=function(_0x2446ef,_0x5b42d5){_0x2446ef=_0x2446ef-0x0;var _0x53e0a9=_0xa6f8[_0x2446ef];return _0x53e0a9;};'use strict';var _=require(_0x8a6f('0x0'));var util=require('util');var moment=require(_0x8a6f('0x1'));var BPromise=require(_0x8a6f('0x2'));var rs=require(_0x8a6f('0x3'));var fs=require('fs');var Redis=require(_0x8a6f('0x4'));var db=require(_0x8a6f('0x5'))['db'];var utils=require(_0x8a6f('0x6'));var logger=require(_0x8a6f('0x7'))(_0x8a6f('0x8'));var config=require(_0x8a6f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8a6f('0xa')][_0x8a6f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25915f,_0x482f58,_0x7dcd55){return new BPromise(function(_0x3f035c,_0x1a4577){return client[_0x8a6f('0xc')](_0x25915f,_0x7dcd55)[_0x8a6f('0xd')](function(_0x32a38b){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x482f58,'request\x20sent');logger[_0x8a6f('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x482f58,_0x8a6f('0xf'),JSON['stringify'](_0x32a38b));if(_0x32a38b[_0x8a6f('0x10')]){if(_0x32a38b['error'][_0x8a6f('0x11')]===0x1f4){logger['error'](_0x8a6f('0x12'),_0x482f58,_0x32a38b[_0x8a6f('0x10')][_0x8a6f('0x13')]);return _0x1a4577(_0x32a38b['error'][_0x8a6f('0x13')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x482f58,_0x32a38b[_0x8a6f('0x10')]['message']);return _0x3f035c(_0x32a38b[_0x8a6f('0x10')][_0x8a6f('0x13')]);}else{logger['info'](_0x8a6f('0x12'),_0x482f58,_0x8a6f('0xf'));_0x3f035c(_0x32a38b['result']['message']);}})['catch'](function(_0x47a614){logger[_0x8a6f('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x482f58,_0x47a614);_0x1a4577(_0x47a614);});});}exports[_0x8a6f('0x14')]=function(_0x3f7760){var _0x368bd6=this;return new Promise(function(_0x4ec3fb,_0x333907){return db[_0x8a6f('0x15')][_0x8a6f('0x16')]({'raw':_0x3f7760[_0x8a6f('0x17')]?_0x3f7760[_0x8a6f('0x17')][_0x8a6f('0x18')]===undefined?!![]:![]:!![],'where':_0x3f7760['options']?_0x3f7760['options'][_0x8a6f('0x19')]||null:null,'attributes':_0x3f7760['options']?_0x3f7760[_0x8a6f('0x17')][_0x8a6f('0x1a')]||null:null,'limit':_0x3f7760[_0x8a6f('0x17')]?_0x3f7760[_0x8a6f('0x17')][_0x8a6f('0x1b')]||null:null,'include':_0x3f7760[_0x8a6f('0x17')]?_0x3f7760['options'][_0x8a6f('0x1c')]?_[_0x8a6f('0x1d')](_0x3f7760[_0x8a6f('0x17')][_0x8a6f('0x1c')],function(_0xf124b2){return{'model':db[_0xf124b2[_0x8a6f('0x1e')]],'as':_0xf124b2['as'],'attributes':_0xf124b2['attributes'],'include':_0xf124b2[_0x8a6f('0x1c')]?_[_0x8a6f('0x1d')](_0xf124b2[_0x8a6f('0x1c')],function(_0x245007){return{'model':db[_0x245007[_0x8a6f('0x1e')]],'as':_0x245007['as'],'attributes':_0x245007[_0x8a6f('0x1a')],'include':_0x245007[_0x8a6f('0x1c')]?_[_0x8a6f('0x1d')](_0x245007['include'],function(_0x3ac959){return{'model':db[_0x3ac959[_0x8a6f('0x1e')]],'as':_0x3ac959['as'],'attributes':_0x3ac959[_0x8a6f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b591a){logger[_0x8a6f('0x1f')](_0x8a6f('0x14'),_0x3f7760);logger[_0x8a6f('0xe')](_0x8a6f('0x14'),_0x3f7760,JSON['stringify'](_0x3b591a));_0x4ec3fb(_0x3b591a);})[_0x8a6f('0x20')](function(_0x5b87b4){logger[_0x8a6f('0x10')](_0x8a6f('0x14'),_0x5b87b4[_0x8a6f('0x13')],_0x3f7760);_0x333907(_0x368bd6[_0x8a6f('0x10')](0x1f4,_0x5b87b4[_0x8a6f('0x13')]));});});};exports[_0x8a6f('0x21')]=function(_0x348516){var _0x404faa=this;return new Promise(function(_0x4b4464,_0x19070c){return db[_0x8a6f('0x15')][_0x8a6f('0x22')]({'raw':_0x348516[_0x8a6f('0x17')]?_0x348516[_0x8a6f('0x17')][_0x8a6f('0x18')]===undefined?!![]:![]:!![],'where':_0x348516[_0x8a6f('0x17')]?_0x348516[_0x8a6f('0x17')][_0x8a6f('0x19')]||null:null,'attributes':_0x348516[_0x8a6f('0x17')]?_0x348516[_0x8a6f('0x17')][_0x8a6f('0x1a')]||null:null,'include':_0x348516['options']?_0x348516[_0x8a6f('0x17')][_0x8a6f('0x1c')]?_[_0x8a6f('0x1d')](_0x348516[_0x8a6f('0x17')][_0x8a6f('0x1c')],function(_0x213947){return{'model':db[_0x213947[_0x8a6f('0x1e')]],'as':_0x213947['as'],'attributes':_0x213947[_0x8a6f('0x1a')],'include':_0x213947[_0x8a6f('0x1c')]?_[_0x8a6f('0x1d')](_0x213947[_0x8a6f('0x1c')],function(_0x4cd4f6){return{'model':db[_0x4cd4f6[_0x8a6f('0x1e')]],'as':_0x4cd4f6['as'],'attributes':_0x4cd4f6[_0x8a6f('0x1a')],'include':_0x4cd4f6['include']?_[_0x8a6f('0x1d')](_0x4cd4f6[_0x8a6f('0x1c')],function(_0x52118f){return{'model':db[_0x52118f[_0x8a6f('0x1e')]],'as':_0x52118f['as'],'attributes':_0x52118f[_0x8a6f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8a6f('0xd')](function(_0x5d3648){logger[_0x8a6f('0x1f')](_0x8a6f('0x21'),_0x348516);logger['debug'](_0x8a6f('0x21'),_0x348516,JSON[_0x8a6f('0x23')](_0x5d3648));_0x4b4464(_0x5d3648);})[_0x8a6f('0x20')](function(_0x112e9c){logger['error'](_0x8a6f('0x21'),_0x112e9c[_0x8a6f('0x13')],_0x348516);_0x19070c(_0x404faa[_0x8a6f('0x10')](0x1f4,_0x112e9c[_0x8a6f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 744afcc..ea26d29 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x0b0e,0x187));var _0xe0b0=function(_0x26ac27,_0x574b86){_0x26ac27=_0x26ac27-0x0;var _0x44a599=_0x0b0e[_0x26ac27];return _0x44a599;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4f9d26,_0x641341){_0x4f9d26=_0x4f9d26-0x0;var _0x57debc=_0x0b0e[_0x4f9d26];return _0x57debc;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 4ab146f..951494c 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 _0xdc20=['Task','Case','contact_lead','contact','lead','account_contact_lead','nothing','account','STRING','ENUM'];(function(_0x851134,_0x1075e0){var _0x19dd9e=function(_0x387b2f){while(--_0x387b2f){_0x851134['push'](_0x851134['shift']());}};_0x19dd9e(++_0x1075e0);}(_0xdc20,0xc6));var _0x0dc2=function(_0x11166a,_0x468a74){_0x11166a=_0x11166a-0x0;var _0x5447c6=_0xdc20[_0x11166a];return _0x5447c6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0dc2('0x0')]},'description':{'type':Sequelize[_0x0dc2('0x0')]},'ticketType':{'type':Sequelize[_0x0dc2('0x1')](_0x0dc2('0x2'),_0x0dc2('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0x0dc2('0x4'),_0x0dc2('0x5'),_0x0dc2('0x6'),_0x0dc2('0x7'),'account'),'defaultValue':_0x0dc2('0x4')},'moduleCreate':{'type':Sequelize[_0x0dc2('0x1')](_0x0dc2('0x8'),_0x0dc2('0x5'),'lead',_0x0dc2('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x0dc2('0x0')]},'additionalSearchAccount':{'type':Sequelize[_0x0dc2('0x0')]},'additionalSearchContact':{'type':Sequelize[_0x0dc2('0x0')]},'additionalSearchLead':{'type':Sequelize[_0x0dc2('0x0')]}}; \ No newline at end of file +var _0xf60b=['ENUM','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING','Task','Case'];(function(_0x41898a,_0x4a3d56){var _0x32124f=function(_0x1faec4){while(--_0x1faec4){_0x41898a['push'](_0x41898a['shift']());}};_0x32124f(++_0x4a3d56);}(_0xf60b,0x17b));var _0xbf60=function(_0xec034,_0x16c358){_0xec034=_0xec034-0x0;var _0x2c5a19=_0xf60b[_0xec034];return _0x2c5a19;};'use strict';var Sequelize=require(_0xbf60('0x0'));module[_0xbf60('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbf60('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xbf60('0x3'),_0xbf60('0x4')),'defaultValue':_0xbf60('0x3')},'moduleSearch':{'type':Sequelize[_0xbf60('0x5')](_0xbf60('0x6'),_0xbf60('0x7'),_0xbf60('0x8'),_0xbf60('0x9'),_0xbf60('0xa')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xbf60('0x5')](_0xbf60('0xb'),'contact',_0xbf60('0x8'),'account'),'defaultValue':_0xbf60('0x8')},'leadId':{'type':Sequelize[_0xbf60('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xbf60('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xbf60('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xbf60('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 54787a6..ee21be5 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 _0x9776=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','SalesforceConfiguration','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','find','catch','create','body','params','SalesforceField','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir'];(function(_0x19776e,_0x3690de){var _0xce4b5f=function(_0x6e04fd){while(--_0x6e04fd){_0x19776e['push'](_0x19776e['shift']());}};_0xce4b5f(++_0x3690de);}(_0x9776,0x19c));var _0x6977=function(_0x5f42a2,_0x5aa519){_0x5f42a2=_0x5f42a2-0x0;var _0x3968c7=_0x9776[_0x5f42a2];return _0x3968c7;};'use strict';var emlformat=require(_0x6977('0x0'));var rimraf=require(_0x6977('0x1'));var zipdir=require(_0x6977('0x2'));var jsonpatch=require(_0x6977('0x3'));var rp=require(_0x6977('0x4'));var moment=require(_0x6977('0x5'));var BPromise=require(_0x6977('0x6'));var Mustache=require(_0x6977('0x7'));var util=require(_0x6977('0x8'));var path=require(_0x6977('0x9'));var sox=require(_0x6977('0xa'));var csv=require(_0x6977('0xb'));var ejs=require(_0x6977('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6977('0xd'));var crypto=require(_0x6977('0xe'));var jsforce=require(_0x6977('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6977('0xb'));var querystring=require(_0x6977('0x10'));var Papa=require(_0x6977('0x11'));var Redis=require(_0x6977('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6977('0x13'));var hardwareService=require(_0x6977('0x14'));var logger=require(_0x6977('0x15'))(_0x6977('0x16'));var utils=require(_0x6977('0x17'));var config=require(_0x6977('0x18'));var licenseUtil=require(_0x6977('0x19'));var db=require(_0x6977('0x1a'))['db'];function respondWithStatusCode(_0x35fcb1,_0x5b186e){_0x5b186e=_0x5b186e||0xcc;return function(_0x3001ba){if(_0x3001ba){return _0x35fcb1[_0x6977('0x1b')](_0x5b186e);}return _0x35fcb1[_0x6977('0x1c')](_0x5b186e)[_0x6977('0x1d')]();};}function respondWithResult(_0x3e1686,_0x3ae79b){_0x3ae79b=_0x3ae79b||0xc8;return function(_0xae925e){if(_0xae925e){return _0x3e1686['status'](_0x3ae79b)[_0x6977('0x1e')](_0xae925e);}};}function respondWithFilteredResult(_0x164e90,_0x4ec891){return function(_0x2eb904){if(_0x2eb904){var _0x2bb3e9=typeof _0x4ec891['offset']===_0x6977('0x1f')&&typeof _0x4ec891['limit']===_0x6977('0x1f');var _0x1f7569=_0x2eb904[_0x6977('0x20')];var _0x18e70a=_0x2bb3e9?0x0:_0x4ec891[_0x6977('0x21')];var _0x1508d9=_0x2bb3e9?_0x2eb904[_0x6977('0x20')]:_0x4ec891[_0x6977('0x21')]+_0x4ec891[_0x6977('0x22')];var _0x34601e;if(_0x1508d9>=_0x1f7569){_0x1508d9=_0x1f7569;_0x34601e=0xc8;}else{_0x34601e=0xce;}_0x164e90[_0x6977('0x1c')](_0x34601e);return _0x164e90['set'](_0x6977('0x23'),_0x18e70a+'-'+_0x1508d9+'/'+_0x1f7569)[_0x6977('0x1e')](_0x2eb904);}return null;};}function patchUpdates(_0x123d15){return function(_0x129e07){try{jsonpatch[_0x6977('0x24')](_0x129e07,_0x123d15,!![]);}catch(_0x42f672){return BPromise[_0x6977('0x25')](_0x42f672);}return _0x129e07[_0x6977('0x26')]();};}function saveUpdates(_0x174e2c,_0x1b2209){return function(_0x3e84ee){if(_0x3e84ee){return _0x3e84ee[_0x6977('0x27')](_0x174e2c)['then'](function(_0x5b7fdf){return _0x5b7fdf;});}return null;};}function removeEntity(_0x4fc126,_0xeaefc2){return function(_0x3843f6){if(_0x3843f6){return _0x3843f6[_0x6977('0x28')]()[_0x6977('0x29')](function(){_0x4fc126[_0x6977('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b3acb,_0x428c19){return function(_0x588eaf){if(!_0x588eaf){_0x4b3acb[_0x6977('0x1b')](0x194);}return _0x588eaf;};}function handleError(_0x5535c1,_0x48970a){_0x48970a=_0x48970a||0x1f4;return function(_0x4ddda2){logger[_0x6977('0x2a')](_0x4ddda2['stack']);if(_0x4ddda2[_0x6977('0x2b')]){delete _0x4ddda2[_0x6977('0x2b')];}_0x5535c1['status'](_0x48970a)[_0x6977('0x2c')](_0x4ddda2);};}exports[_0x6977('0x2d')]=function(_0x18b71c,_0x253404){var _0x50eff0={},_0xaeee1a={},_0x4fdc49={'count':0x0,'rows':[]};var _0x51a84f=_[_0x6977('0x2e')](db[_0x6977('0x2f')][_0x6977('0x30')],function(_0x4dc84c){return{'name':_0x4dc84c['fieldName'],'type':_0x4dc84c['type'][_0x6977('0x31')]};});_0xaeee1a[_0x6977('0x32')]=_[_0x6977('0x2e')](_0x51a84f,'name');_0xaeee1a[_0x6977('0x33')]=_[_0x6977('0x34')](_0x18b71c[_0x6977('0x33')]);_0xaeee1a[_0x6977('0x35')]=_[_0x6977('0x36')](_0xaeee1a[_0x6977('0x32')],_0xaeee1a['query']);_0x50eff0[_0x6977('0x37')]=_['intersection'](_0xaeee1a[_0x6977('0x32')],qs['fields'](_0x18b71c[_0x6977('0x33')][_0x6977('0x38')]));_0x50eff0['attributes']=_0x50eff0['attributes'][_0x6977('0x39')]?_0x50eff0[_0x6977('0x37')]:_0xaeee1a[_0x6977('0x32')];if(!_0x18b71c[_0x6977('0x33')][_0x6977('0x3a')](_0x6977('0x3b'))){_0x50eff0['limit']=qs[_0x6977('0x22')](_0x18b71c['query'][_0x6977('0x22')]);_0x50eff0['offset']=qs[_0x6977('0x21')](_0x18b71c[_0x6977('0x33')][_0x6977('0x21')]);}_0x50eff0[_0x6977('0x3c')]=qs[_0x6977('0x3d')](_0x18b71c[_0x6977('0x33')][_0x6977('0x3d')]);_0x50eff0[_0x6977('0x3e')]=qs[_0x6977('0x35')](_[_0x6977('0x3f')](_0x18b71c['query'],_0xaeee1a['filters']),_0x51a84f);if(_0x18b71c[_0x6977('0x33')][_0x6977('0x40')]){_0x50eff0[_0x6977('0x3e')]=_['merge'](_0x50eff0[_0x6977('0x3e')],{'$or':_[_0x6977('0x2e')](_0x51a84f,function(_0x262e4b){if(_0x262e4b[_0x6977('0x41')]!==_0x6977('0x42')){var _0x4d49d7={};_0x4d49d7[_0x262e4b[_0x6977('0x2b')]]={'$like':'%'+_0x18b71c['query'][_0x6977('0x40')]+'%'};return _0x4d49d7;}})});}_0x50eff0=_[_0x6977('0x43')]({},_0x50eff0,_0x18b71c[_0x6977('0x44')]);var _0x169184={'where':_0x50eff0[_0x6977('0x3e')]};return db[_0x6977('0x2f')][_0x6977('0x20')](_0x169184)[_0x6977('0x29')](function(_0x44ad23){_0x4fdc49[_0x6977('0x20')]=_0x44ad23;if(_0x18b71c['query'][_0x6977('0x45')]){_0x50eff0[_0x6977('0x46')]=[{'all':!![]}];}return db[_0x6977('0x2f')][_0x6977('0x47')](_0x50eff0);})[_0x6977('0x29')](function(_0x211418){_0x4fdc49[_0x6977('0x48')]=_0x211418;return _0x4fdc49;})[_0x6977('0x29')](respondWithFilteredResult(_0x253404,_0x50eff0))['catch'](handleError(_0x253404,null));};exports['show']=function(_0x27cf1a,_0x5b399d){var _0x1ef2fe={'raw':![],'where':{'id':_0x27cf1a['params']['id']}},_0x43af5a={};_0x43af5a['model']=_[_0x6977('0x34')](db['SalesforceConfiguration'][_0x6977('0x30')]);_0x43af5a[_0x6977('0x33')]=_['keys'](_0x27cf1a[_0x6977('0x33')]);_0x43af5a['filters']=_[_0x6977('0x36')](_0x43af5a[_0x6977('0x32')],_0x43af5a[_0x6977('0x33')]);_0x1ef2fe['attributes']=_['intersection'](_0x43af5a[_0x6977('0x32')],qs[_0x6977('0x38')](_0x27cf1a[_0x6977('0x33')][_0x6977('0x38')]));_0x1ef2fe['attributes']=_0x1ef2fe['attributes']['length']?_0x1ef2fe[_0x6977('0x37')]:_0x43af5a['model'];if(_0x27cf1a[_0x6977('0x33')]['includeAll']){_0x1ef2fe[_0x6977('0x46')]=[{'all':!![]}];}_0x1ef2fe=_[_0x6977('0x43')]({},_0x1ef2fe,_0x27cf1a['options']);return db[_0x6977('0x2f')][_0x6977('0x49')](_0x1ef2fe)[_0x6977('0x29')](handleEntityNotFound(_0x5b399d,null))['then'](respondWithResult(_0x5b399d,null))[_0x6977('0x4a')](handleError(_0x5b399d,null));};exports[_0x6977('0x4b')]=function(_0x5ea9c5,_0x5e67d6){return db[_0x6977('0x2f')][_0x6977('0x4b')](_0x5ea9c5[_0x6977('0x4c')],{})[_0x6977('0x29')](respondWithResult(_0x5e67d6,0xc9))['catch'](handleError(_0x5e67d6,null));};exports[_0x6977('0x27')]=function(_0x669c84,_0x3c4c43){if(_0x669c84[_0x6977('0x4c')]['id']){delete _0x669c84[_0x6977('0x4c')]['id'];}return db[_0x6977('0x2f')][_0x6977('0x49')]({'where':{'id':_0x669c84[_0x6977('0x4d')]['id']}})[_0x6977('0x29')](handleEntityNotFound(_0x3c4c43,null))[_0x6977('0x29')](saveUpdates(_0x669c84[_0x6977('0x4c')],null))[_0x6977('0x29')](respondWithResult(_0x3c4c43,null))['catch'](handleError(_0x3c4c43,null));};exports[_0x6977('0x28')]=function(_0x199fa9,_0x226b86){return db[_0x6977('0x2f')]['find']({'where':{'id':_0x199fa9['params']['id']}})[_0x6977('0x29')](handleEntityNotFound(_0x226b86,null))[_0x6977('0x29')](removeEntity(_0x226b86,null))[_0x6977('0x4a')](handleError(_0x226b86,null));};exports['getFields']=function(_0x19ee02,_0x152c23,_0x2bae9a){var _0x79bf2b={};var _0x3bda5b={};var _0x22a736;var _0xef6723;return db[_0x6977('0x2f')]['findOne']({'where':{'id':_0x19ee02['params']['id']}})[_0x6977('0x29')](handleEntityNotFound(_0x152c23,null))[_0x6977('0x29')](function(_0x116d71){if(_0x116d71){_0x22a736=_0x116d71;_0x3bda5b[_0x6977('0x32')]=_[_0x6977('0x34')](db[_0x6977('0x4e')]['rawAttributes']);_0x3bda5b['query']=_['keys'](_0x19ee02[_0x6977('0x33')]);_0x3bda5b[_0x6977('0x35')]=_[_0x6977('0x36')](_0x3bda5b[_0x6977('0x32')],_0x3bda5b[_0x6977('0x33')]);_0x79bf2b[_0x6977('0x37')]=_[_0x6977('0x36')](_0x3bda5b['model'],qs[_0x6977('0x38')](_0x19ee02[_0x6977('0x33')]['fields']));_0x79bf2b[_0x6977('0x37')]=_0x79bf2b[_0x6977('0x37')][_0x6977('0x39')]?_0x79bf2b[_0x6977('0x37')]:_0x3bda5b[_0x6977('0x32')];_0x79bf2b[_0x6977('0x3c')]=qs[_0x6977('0x3d')](_0x19ee02[_0x6977('0x33')][_0x6977('0x3d')]);_0x79bf2b[_0x6977('0x3e')]=qs[_0x6977('0x35')](_[_0x6977('0x3f')](_0x19ee02[_0x6977('0x33')],_0x3bda5b[_0x6977('0x35')]));if(_0x19ee02[_0x6977('0x33')][_0x6977('0x40')]){_0x79bf2b[_0x6977('0x3e')]=_[_0x6977('0x43')](_0x79bf2b[_0x6977('0x3e')],{'$or':_[_0x6977('0x2e')](_0x79bf2b['attributes'],function(_0x26ed67){var _0x5e7255={};_0x5e7255[_0x26ed67]={'$like':'%'+_0x19ee02[_0x6977('0x33')][_0x6977('0x40')]+'%'};return _0x5e7255;})});}_0x79bf2b=_[_0x6977('0x43')]({},_0x79bf2b,_0x19ee02[_0x6977('0x44')]);return _0x22a736['getFields'](_0x79bf2b);}})['then'](function(_0x910b33){if(_0x910b33){_0xef6723=_0x910b33[_0x6977('0x39')];if(!_0x19ee02[_0x6977('0x33')]['hasOwnProperty'](_0x6977('0x3b'))){_0x79bf2b[_0x6977('0x22')]=qs[_0x6977('0x22')](_0x19ee02['query'][_0x6977('0x22')]);_0x79bf2b['offset']=qs[_0x6977('0x21')](_0x19ee02[_0x6977('0x33')]['offset']);}return _0x22a736[_0x6977('0x4f')](_0x79bf2b);}})['then'](function(_0x233755){if(_0x233755){return _0x233755?{'count':_0xef6723,'rows':_0x233755}:null;}})['then'](respondWithResult(_0x152c23,null))[_0x6977('0x4a')](handleError(_0x152c23,null));};exports[_0x6977('0x50')]=function(_0x3a16d6,_0x8b064c,_0x163850){var _0x4d2229={};var _0x1cf556={};var _0x4292cd;var _0x23019d;return db[_0x6977('0x2f')][_0x6977('0x51')]({'where':{'id':_0x3a16d6[_0x6977('0x4d')]['id']}})['then'](handleEntityNotFound(_0x8b064c,null))[_0x6977('0x29')](function(_0x484b7c){if(_0x484b7c){_0x4292cd=_0x484b7c;_0x1cf556[_0x6977('0x32')]=_[_0x6977('0x34')](db['SalesforceField'][_0x6977('0x30')]);_0x1cf556[_0x6977('0x33')]=_['keys'](_0x3a16d6[_0x6977('0x33')]);_0x1cf556['filters']=_[_0x6977('0x36')](_0x1cf556['model'],_0x1cf556[_0x6977('0x33')]);_0x4d2229[_0x6977('0x37')]=_[_0x6977('0x36')](_0x1cf556[_0x6977('0x32')],qs[_0x6977('0x38')](_0x3a16d6[_0x6977('0x33')]['fields']));_0x4d2229[_0x6977('0x37')]=_0x4d2229[_0x6977('0x37')][_0x6977('0x39')]?_0x4d2229[_0x6977('0x37')]:_0x1cf556['model'];_0x4d2229[_0x6977('0x3c')]=qs[_0x6977('0x3d')](_0x3a16d6['query'][_0x6977('0x3d')]);_0x4d2229[_0x6977('0x3e')]=qs['filters'](_['pick'](_0x3a16d6[_0x6977('0x33')],_0x1cf556[_0x6977('0x35')]));if(_0x3a16d6[_0x6977('0x33')][_0x6977('0x40')]){_0x4d2229[_0x6977('0x3e')]=_[_0x6977('0x43')](_0x4d2229[_0x6977('0x3e')],{'$or':_[_0x6977('0x2e')](_0x4d2229[_0x6977('0x37')],function(_0x1e3690){var _0x3d5784={};_0x3d5784[_0x1e3690]={'$like':'%'+_0x3a16d6[_0x6977('0x33')][_0x6977('0x40')]+'%'};return _0x3d5784;})});}_0x4d2229=_[_0x6977('0x43')]({},_0x4d2229,_0x3a16d6[_0x6977('0x44')]);return _0x4292cd[_0x6977('0x50')](_0x4d2229);}})[_0x6977('0x29')](function(_0x4dd112){if(_0x4dd112){_0x23019d=_0x4dd112['length'];if(!_0x3a16d6[_0x6977('0x33')][_0x6977('0x3a')](_0x6977('0x3b'))){_0x4d2229[_0x6977('0x22')]=qs['limit'](_0x3a16d6[_0x6977('0x33')][_0x6977('0x22')]);_0x4d2229['offset']=qs['offset'](_0x3a16d6[_0x6977('0x33')][_0x6977('0x21')]);}return _0x4292cd[_0x6977('0x50')](_0x4d2229);}})['then'](function(_0x4b7b9b){if(_0x4b7b9b){return _0x4b7b9b?{'count':_0x23019d,'rows':_0x4b7b9b}:null;}})[_0x6977('0x29')](respondWithResult(_0x8b064c,null))[_0x6977('0x4a')](handleError(_0x8b064c,null));};exports[_0x6977('0x52')]=function(_0x564189,_0x3e5903,_0x4df64f){var _0x5f2396={};var _0x2cc0dd={};var _0x452aab;var _0x477082;return db[_0x6977('0x2f')]['findOne']({'where':{'id':_0x564189[_0x6977('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3e5903,null))[_0x6977('0x29')](function(_0x549169){if(_0x549169){_0x452aab=_0x549169;_0x2cc0dd['model']=_[_0x6977('0x34')](db[_0x6977('0x4e')][_0x6977('0x30')]);_0x2cc0dd['query']=_[_0x6977('0x34')](_0x564189[_0x6977('0x33')]);_0x2cc0dd['filters']=_[_0x6977('0x36')](_0x2cc0dd[_0x6977('0x32')],_0x2cc0dd['query']);_0x5f2396[_0x6977('0x37')]=_[_0x6977('0x36')](_0x2cc0dd[_0x6977('0x32')],qs[_0x6977('0x38')](_0x564189[_0x6977('0x33')][_0x6977('0x38')]));_0x5f2396[_0x6977('0x37')]=_0x5f2396[_0x6977('0x37')][_0x6977('0x39')]?_0x5f2396[_0x6977('0x37')]:_0x2cc0dd[_0x6977('0x32')];_0x5f2396[_0x6977('0x3c')]=qs[_0x6977('0x3d')](_0x564189['query'][_0x6977('0x3d')]);_0x5f2396[_0x6977('0x3e')]=qs['filters'](_['pick'](_0x564189['query'],_0x2cc0dd[_0x6977('0x35')]));if(_0x564189[_0x6977('0x33')][_0x6977('0x40')]){_0x5f2396[_0x6977('0x3e')]=_[_0x6977('0x43')](_0x5f2396[_0x6977('0x3e')],{'$or':_[_0x6977('0x2e')](_0x5f2396[_0x6977('0x37')],function(_0x118a23){var _0x1cac23={};_0x1cac23[_0x118a23]={'$like':'%'+_0x564189['query'][_0x6977('0x40')]+'%'};return _0x1cac23;})});}_0x5f2396=_[_0x6977('0x43')]({},_0x5f2396,_0x564189[_0x6977('0x44')]);return _0x452aab['getDescriptions'](_0x5f2396);}})[_0x6977('0x29')](function(_0xa44340){if(_0xa44340){_0x477082=_0xa44340[_0x6977('0x39')];if(!_0x564189[_0x6977('0x33')][_0x6977('0x3a')](_0x6977('0x3b'))){_0x5f2396[_0x6977('0x22')]=qs['limit'](_0x564189[_0x6977('0x33')]['limit']);_0x5f2396[_0x6977('0x21')]=qs[_0x6977('0x21')](_0x564189[_0x6977('0x33')]['offset']);}return _0x452aab['getDescriptions'](_0x5f2396);}})[_0x6977('0x29')](function(_0x52f15c){if(_0x52f15c){return _0x52f15c?{'count':_0x477082,'rows':_0x52f15c}:null;}})[_0x6977('0x29')](respondWithResult(_0x3e5903,null))['catch'](handleError(_0x3e5903,null));}; \ No newline at end of file +var _0x2982=['ejs','fs-extra','squel','crypto','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','Content-Range','reject','save','update','then','end','stack','name','send','index','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SalesforceConfiguration','includeAll','findAll','catch','rawAttributes','include','create','body','find','params','getFields','findOne','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2982,0x8d));var _0x2298=function(_0x16377f,_0x1aa6da){_0x16377f=_0x16377f-0x0;var _0x4c9878=_0x2982[_0x16377f];return _0x4c9878;};'use strict';var emlformat=require(_0x2298('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2298('0x1'));var jsonpatch=require(_0x2298('0x2'));var rp=require(_0x2298('0x3'));var moment=require(_0x2298('0x4'));var BPromise=require(_0x2298('0x5'));var Mustache=require('mustache');var util=require(_0x2298('0x6'));var path=require(_0x2298('0x7'));var sox=require('sox');var csv=require(_0x2298('0x8'));var ejs=require(_0x2298('0x9'));var fs=require('fs');var fs_extra=require(_0x2298('0xa'));var _=require('lodash');var squel=require(_0x2298('0xb'));var crypto=require(_0x2298('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2298('0xd'));var Papa=require('papaparse');var Redis=require(_0x2298('0xe'));var authService=require(_0x2298('0xf'));var qs=require(_0x2298('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2298('0x11'));var logger=require(_0x2298('0x12'))(_0x2298('0x13'));var utils=require(_0x2298('0x14'));var config=require(_0x2298('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2298('0x16'))['db'];function respondWithStatusCode(_0x444fe9,_0x2adf04){_0x2adf04=_0x2adf04||0xcc;return function(_0x139c9a){if(_0x139c9a){return _0x444fe9[_0x2298('0x17')](_0x2adf04);}return _0x444fe9[_0x2298('0x18')](_0x2adf04)['end']();};}function respondWithResult(_0x2d5e0d,_0x57fcd8){_0x57fcd8=_0x57fcd8||0xc8;return function(_0x47436b){if(_0x47436b){return _0x2d5e0d[_0x2298('0x18')](_0x57fcd8)[_0x2298('0x19')](_0x47436b);}};}function respondWithFilteredResult(_0x569ee5,_0x8208a4){return function(_0x37e120){if(_0x37e120){var _0x46d9dc=typeof _0x8208a4[_0x2298('0x1a')]===_0x2298('0x1b')&&typeof _0x8208a4[_0x2298('0x1c')]===_0x2298('0x1b');var _0x207af9=_0x37e120[_0x2298('0x1d')];var _0x474903=_0x46d9dc?0x0:_0x8208a4[_0x2298('0x1a')];var _0xc9e163=_0x46d9dc?_0x37e120[_0x2298('0x1d')]:_0x8208a4[_0x2298('0x1a')]+_0x8208a4[_0x2298('0x1c')];var _0x4c6484;if(_0xc9e163>=_0x207af9){_0xc9e163=_0x207af9;_0x4c6484=0xc8;}else{_0x4c6484=0xce;}_0x569ee5['status'](_0x4c6484);return _0x569ee5['set'](_0x2298('0x1e'),_0x474903+'-'+_0xc9e163+'/'+_0x207af9)[_0x2298('0x19')](_0x37e120);}return null;};}function patchUpdates(_0x599e9f){return function(_0xc6eb11){try{jsonpatch['apply'](_0xc6eb11,_0x599e9f,!![]);}catch(_0x4e49ba){return BPromise[_0x2298('0x1f')](_0x4e49ba);}return _0xc6eb11[_0x2298('0x20')]();};}function saveUpdates(_0x5cb8e9,_0x30e084){return function(_0x4ddb2e){if(_0x4ddb2e){return _0x4ddb2e[_0x2298('0x21')](_0x5cb8e9)['then'](function(_0x14ffd2){return _0x14ffd2;});}return null;};}function removeEntity(_0x3368d6,_0x1acb8c){return function(_0x355460){if(_0x355460){return _0x355460['destroy']()[_0x2298('0x22')](function(){_0x3368d6[_0x2298('0x18')](0xcc)[_0x2298('0x23')]();});}};}function handleEntityNotFound(_0x36a9a2,_0x258e4f){return function(_0x23527d){if(!_0x23527d){_0x36a9a2[_0x2298('0x17')](0x194);}return _0x23527d;};}function handleError(_0x523f78,_0x3fa24e){_0x3fa24e=_0x3fa24e||0x1f4;return function(_0x331137){logger['error'](_0x331137[_0x2298('0x24')]);if(_0x331137[_0x2298('0x25')]){delete _0x331137[_0x2298('0x25')];}_0x523f78[_0x2298('0x18')](_0x3fa24e)[_0x2298('0x26')](_0x331137);};}exports[_0x2298('0x27')]=function(_0x135947,_0x8f3aff){var _0xbeb77f={},_0x35709c={},_0x1ab40e={'count':0x0,'rows':[]};var _0x2fec89=_['map'](db['SalesforceConfiguration']['rawAttributes'],function(_0xa80495){return{'name':_0xa80495[_0x2298('0x28')],'type':_0xa80495['type'][_0x2298('0x29')]};});_0x35709c[_0x2298('0x2a')]=_[_0x2298('0x2b')](_0x2fec89,'name');_0x35709c[_0x2298('0x2c')]=_[_0x2298('0x2d')](_0x135947[_0x2298('0x2c')]);_0x35709c[_0x2298('0x2e')]=_[_0x2298('0x2f')](_0x35709c[_0x2298('0x2a')],_0x35709c[_0x2298('0x2c')]);_0xbeb77f['attributes']=_['intersection'](_0x35709c[_0x2298('0x2a')],qs[_0x2298('0x30')](_0x135947[_0x2298('0x2c')]['fields']));_0xbeb77f[_0x2298('0x31')]=_0xbeb77f[_0x2298('0x31')][_0x2298('0x32')]?_0xbeb77f['attributes']:_0x35709c[_0x2298('0x2a')];if(!_0x135947[_0x2298('0x2c')][_0x2298('0x33')](_0x2298('0x34'))){_0xbeb77f[_0x2298('0x1c')]=qs[_0x2298('0x1c')](_0x135947['query'][_0x2298('0x1c')]);_0xbeb77f[_0x2298('0x1a')]=qs[_0x2298('0x1a')](_0x135947[_0x2298('0x2c')]['offset']);}_0xbeb77f[_0x2298('0x35')]=qs[_0x2298('0x36')](_0x135947[_0x2298('0x2c')]['sort']);_0xbeb77f[_0x2298('0x37')]=qs[_0x2298('0x2e')](_[_0x2298('0x38')](_0x135947[_0x2298('0x2c')],_0x35709c['filters']),_0x2fec89);if(_0x135947[_0x2298('0x2c')]['filter']){_0xbeb77f[_0x2298('0x37')]=_[_0x2298('0x39')](_0xbeb77f[_0x2298('0x37')],{'$or':_['map'](_0x2fec89,function(_0x59a587){if(_0x59a587['type']!==_0x2298('0x3a')){var _0x14d6e8={};_0x14d6e8[_0x59a587['name']]={'$like':'%'+_0x135947[_0x2298('0x2c')][_0x2298('0x3b')]+'%'};return _0x14d6e8;}})});}_0xbeb77f=_[_0x2298('0x39')]({},_0xbeb77f,_0x135947[_0x2298('0x3c')]);var _0x3f1b1c={'where':_0xbeb77f[_0x2298('0x37')]};return db[_0x2298('0x3d')][_0x2298('0x1d')](_0x3f1b1c)['then'](function(_0x5461a0){_0x1ab40e[_0x2298('0x1d')]=_0x5461a0;if(_0x135947['query'][_0x2298('0x3e')]){_0xbeb77f['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x2298('0x3f')](_0xbeb77f);})[_0x2298('0x22')](function(_0x5a1124){_0x1ab40e['rows']=_0x5a1124;return _0x1ab40e;})[_0x2298('0x22')](respondWithFilteredResult(_0x8f3aff,_0xbeb77f))[_0x2298('0x40')](handleError(_0x8f3aff,null));};exports['show']=function(_0xc3d8f2,_0x56e75a){var _0x3877d4={'raw':![],'where':{'id':_0xc3d8f2['params']['id']}},_0x48c25c={};_0x48c25c['model']=_['keys'](db[_0x2298('0x3d')][_0x2298('0x41')]);_0x48c25c[_0x2298('0x2c')]=_[_0x2298('0x2d')](_0xc3d8f2[_0x2298('0x2c')]);_0x48c25c[_0x2298('0x2e')]=_[_0x2298('0x2f')](_0x48c25c[_0x2298('0x2a')],_0x48c25c[_0x2298('0x2c')]);_0x3877d4[_0x2298('0x31')]=_[_0x2298('0x2f')](_0x48c25c['model'],qs[_0x2298('0x30')](_0xc3d8f2[_0x2298('0x2c')]['fields']));_0x3877d4[_0x2298('0x31')]=_0x3877d4[_0x2298('0x31')]['length']?_0x3877d4['attributes']:_0x48c25c[_0x2298('0x2a')];if(_0xc3d8f2['query'][_0x2298('0x3e')]){_0x3877d4[_0x2298('0x42')]=[{'all':!![]}];}_0x3877d4=_[_0x2298('0x39')]({},_0x3877d4,_0xc3d8f2[_0x2298('0x3c')]);return db[_0x2298('0x3d')]['find'](_0x3877d4)['then'](handleEntityNotFound(_0x56e75a,null))[_0x2298('0x22')](respondWithResult(_0x56e75a,null))[_0x2298('0x40')](handleError(_0x56e75a,null));};exports[_0x2298('0x43')]=function(_0x40de4b,_0x256088){return db[_0x2298('0x3d')]['create'](_0x40de4b[_0x2298('0x44')],{})['then'](respondWithResult(_0x256088,0xc9))[_0x2298('0x40')](handleError(_0x256088,null));};exports[_0x2298('0x21')]=function(_0x2381c7,_0x33543b){if(_0x2381c7[_0x2298('0x44')]['id']){delete _0x2381c7['body']['id'];}return db['SalesforceConfiguration'][_0x2298('0x45')]({'where':{'id':_0x2381c7[_0x2298('0x46')]['id']}})[_0x2298('0x22')](handleEntityNotFound(_0x33543b,null))['then'](saveUpdates(_0x2381c7['body'],null))[_0x2298('0x22')](respondWithResult(_0x33543b,null))[_0x2298('0x40')](handleError(_0x33543b,null));};exports['destroy']=function(_0x430861,_0x29cc53){return db[_0x2298('0x3d')][_0x2298('0x45')]({'where':{'id':_0x430861['params']['id']}})['then'](handleEntityNotFound(_0x29cc53,null))[_0x2298('0x22')](removeEntity(_0x29cc53,null))[_0x2298('0x40')](handleError(_0x29cc53,null));};exports[_0x2298('0x47')]=function(_0x5bd8cf,_0x53abaf,_0x642f6b){var _0x1a3896={};var _0x340a7f={};var _0xcc1301;var _0x373302;return db[_0x2298('0x3d')][_0x2298('0x48')]({'where':{'id':_0x5bd8cf[_0x2298('0x46')]['id']}})[_0x2298('0x22')](handleEntityNotFound(_0x53abaf,null))[_0x2298('0x22')](function(_0x2ff544){if(_0x2ff544){_0xcc1301=_0x2ff544;_0x340a7f[_0x2298('0x2a')]=_[_0x2298('0x2d')](db['SalesforceField'][_0x2298('0x41')]);_0x340a7f['query']=_['keys'](_0x5bd8cf['query']);_0x340a7f[_0x2298('0x2e')]=_[_0x2298('0x2f')](_0x340a7f[_0x2298('0x2a')],_0x340a7f['query']);_0x1a3896['attributes']=_['intersection'](_0x340a7f[_0x2298('0x2a')],qs[_0x2298('0x30')](_0x5bd8cf['query'][_0x2298('0x30')]));_0x1a3896['attributes']=_0x1a3896['attributes'][_0x2298('0x32')]?_0x1a3896['attributes']:_0x340a7f[_0x2298('0x2a')];_0x1a3896[_0x2298('0x35')]=qs[_0x2298('0x36')](_0x5bd8cf['query'][_0x2298('0x36')]);_0x1a3896[_0x2298('0x37')]=qs[_0x2298('0x2e')](_[_0x2298('0x38')](_0x5bd8cf[_0x2298('0x2c')],_0x340a7f[_0x2298('0x2e')]));if(_0x5bd8cf[_0x2298('0x2c')][_0x2298('0x3b')]){_0x1a3896[_0x2298('0x37')]=_[_0x2298('0x39')](_0x1a3896[_0x2298('0x37')],{'$or':_[_0x2298('0x2b')](_0x1a3896[_0x2298('0x31')],function(_0x28cc68){var _0x488710={};_0x488710[_0x28cc68]={'$like':'%'+_0x5bd8cf[_0x2298('0x2c')][_0x2298('0x3b')]+'%'};return _0x488710;})});}_0x1a3896=_[_0x2298('0x39')]({},_0x1a3896,_0x5bd8cf['options']);return _0xcc1301[_0x2298('0x47')](_0x1a3896);}})[_0x2298('0x22')](function(_0x3b26a5){if(_0x3b26a5){_0x373302=_0x3b26a5[_0x2298('0x32')];if(!_0x5bd8cf[_0x2298('0x2c')]['hasOwnProperty'](_0x2298('0x34'))){_0x1a3896[_0x2298('0x1c')]=qs[_0x2298('0x1c')](_0x5bd8cf[_0x2298('0x2c')][_0x2298('0x1c')]);_0x1a3896[_0x2298('0x1a')]=qs[_0x2298('0x1a')](_0x5bd8cf['query'][_0x2298('0x1a')]);}return _0xcc1301[_0x2298('0x47')](_0x1a3896);}})[_0x2298('0x22')](function(_0x5bb4fc){if(_0x5bb4fc){return _0x5bb4fc?{'count':_0x373302,'rows':_0x5bb4fc}:null;}})['then'](respondWithResult(_0x53abaf,null))['catch'](handleError(_0x53abaf,null));};exports[_0x2298('0x49')]=function(_0xc3eea,_0x37c2c2,_0x2e092f){var _0x9951ed={};var _0x10b036={};var _0x409c4a;var _0x593ec0;return db[_0x2298('0x3d')][_0x2298('0x48')]({'where':{'id':_0xc3eea[_0x2298('0x46')]['id']}})[_0x2298('0x22')](handleEntityNotFound(_0x37c2c2,null))['then'](function(_0x34f914){if(_0x34f914){_0x409c4a=_0x34f914;_0x10b036[_0x2298('0x2a')]=_[_0x2298('0x2d')](db['SalesforceField'][_0x2298('0x41')]);_0x10b036['query']=_[_0x2298('0x2d')](_0xc3eea[_0x2298('0x2c')]);_0x10b036[_0x2298('0x2e')]=_[_0x2298('0x2f')](_0x10b036[_0x2298('0x2a')],_0x10b036['query']);_0x9951ed[_0x2298('0x31')]=_['intersection'](_0x10b036[_0x2298('0x2a')],qs['fields'](_0xc3eea['query']['fields']));_0x9951ed[_0x2298('0x31')]=_0x9951ed['attributes'][_0x2298('0x32')]?_0x9951ed[_0x2298('0x31')]:_0x10b036['model'];_0x9951ed[_0x2298('0x35')]=qs[_0x2298('0x36')](_0xc3eea['query']['sort']);_0x9951ed[_0x2298('0x37')]=qs[_0x2298('0x2e')](_['pick'](_0xc3eea[_0x2298('0x2c')],_0x10b036['filters']));if(_0xc3eea[_0x2298('0x2c')]['filter']){_0x9951ed['where']=_[_0x2298('0x39')](_0x9951ed[_0x2298('0x37')],{'$or':_['map'](_0x9951ed['attributes'],function(_0x18fed4){var _0x52ef1b={};_0x52ef1b[_0x18fed4]={'$like':'%'+_0xc3eea['query'][_0x2298('0x3b')]+'%'};return _0x52ef1b;})});}_0x9951ed=_[_0x2298('0x39')]({},_0x9951ed,_0xc3eea[_0x2298('0x3c')]);return _0x409c4a[_0x2298('0x49')](_0x9951ed);}})[_0x2298('0x22')](function(_0x3040de){if(_0x3040de){_0x593ec0=_0x3040de[_0x2298('0x32')];if(!_0xc3eea[_0x2298('0x2c')][_0x2298('0x33')](_0x2298('0x34'))){_0x9951ed[_0x2298('0x1c')]=qs[_0x2298('0x1c')](_0xc3eea[_0x2298('0x2c')][_0x2298('0x1c')]);_0x9951ed['offset']=qs[_0x2298('0x1a')](_0xc3eea[_0x2298('0x2c')][_0x2298('0x1a')]);}return _0x409c4a['getSubjects'](_0x9951ed);}})[_0x2298('0x22')](function(_0x1e785e){if(_0x1e785e){return _0x1e785e?{'count':_0x593ec0,'rows':_0x1e785e}:null;}})[_0x2298('0x22')](respondWithResult(_0x37c2c2,null))[_0x2298('0x40')](handleError(_0x37c2c2,null));};exports[_0x2298('0x4a')]=function(_0x2c29db,_0x2abd41,_0x191511){var _0x1686af={};var _0x2f47d7={};var _0x30f79e;var _0x5862e1;return db[_0x2298('0x3d')][_0x2298('0x48')]({'where':{'id':_0x2c29db['params']['id']}})[_0x2298('0x22')](handleEntityNotFound(_0x2abd41,null))[_0x2298('0x22')](function(_0x1da421){if(_0x1da421){_0x30f79e=_0x1da421;_0x2f47d7[_0x2298('0x2a')]=_[_0x2298('0x2d')](db['SalesforceField']['rawAttributes']);_0x2f47d7[_0x2298('0x2c')]=_[_0x2298('0x2d')](_0x2c29db['query']);_0x2f47d7[_0x2298('0x2e')]=_['intersection'](_0x2f47d7[_0x2298('0x2a')],_0x2f47d7[_0x2298('0x2c')]);_0x1686af['attributes']=_['intersection'](_0x2f47d7[_0x2298('0x2a')],qs[_0x2298('0x30')](_0x2c29db[_0x2298('0x2c')][_0x2298('0x30')]));_0x1686af['attributes']=_0x1686af[_0x2298('0x31')]['length']?_0x1686af['attributes']:_0x2f47d7[_0x2298('0x2a')];_0x1686af[_0x2298('0x35')]=qs[_0x2298('0x36')](_0x2c29db['query']['sort']);_0x1686af[_0x2298('0x37')]=qs[_0x2298('0x2e')](_[_0x2298('0x38')](_0x2c29db[_0x2298('0x2c')],_0x2f47d7[_0x2298('0x2e')]));if(_0x2c29db[_0x2298('0x2c')][_0x2298('0x3b')]){_0x1686af[_0x2298('0x37')]=_[_0x2298('0x39')](_0x1686af['where'],{'$or':_[_0x2298('0x2b')](_0x1686af['attributes'],function(_0x286a7a){var _0x3bafe4={};_0x3bafe4[_0x286a7a]={'$like':'%'+_0x2c29db[_0x2298('0x2c')][_0x2298('0x3b')]+'%'};return _0x3bafe4;})});}_0x1686af=_[_0x2298('0x39')]({},_0x1686af,_0x2c29db[_0x2298('0x3c')]);return _0x30f79e[_0x2298('0x4a')](_0x1686af);}})[_0x2298('0x22')](function(_0x1fed62){if(_0x1fed62){_0x5862e1=_0x1fed62[_0x2298('0x32')];if(!_0x2c29db[_0x2298('0x2c')][_0x2298('0x33')](_0x2298('0x34'))){_0x1686af[_0x2298('0x1c')]=qs[_0x2298('0x1c')](_0x2c29db['query']['limit']);_0x1686af['offset']=qs[_0x2298('0x1a')](_0x2c29db[_0x2298('0x2c')][_0x2298('0x1a')]);}return _0x30f79e[_0x2298('0x4a')](_0x1686af);}})[_0x2298('0x22')](function(_0x969e56){if(_0x969e56){return _0x969e56?{'count':_0x5862e1,'rows':_0x969e56}:null;}})['then'](respondWithResult(_0x2abd41,null))[_0x2298('0x40')](handleError(_0x2abd41,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index a671a5d..767e7a4 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 _0x2740=['bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x1a1251,_0x4c386f){var _0x163c72=function(_0x2abc1f){while(--_0x2abc1f){_0x1a1251['push'](_0x1a1251['shift']());}};_0x163c72(++_0x4c386f);}(_0x2740,0xe9));var _0x0274=function(_0x328c0d,_0x20e19c){_0x328c0d=_0x328c0d-0x0;var _0x5e56c2=_0x2740[_0x328c0d];return _0x5e56c2;};'use strict';var _=require(_0x0274('0x0'));var util=require(_0x0274('0x1'));var logger=require(_0x0274('0x2'))(_0x0274('0x3'));var moment=require(_0x0274('0x4'));var BPromise=require(_0x0274('0x5'));var rp=require(_0x0274('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0274('0x7'));var config=require(_0x0274('0x8'));var attributes=require(_0x0274('0x9'));module[_0x0274('0xa')]=function(_0x191c80,_0x1610fc){return _0x191c80[_0x0274('0xb')](_0x0274('0xc'),attributes,{'tableName':_0x0274('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdef0=['exports','define','int_salesforce_configurations','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x5e58f5,_0x16896a){var _0x5e3df3=function(_0x23114d){while(--_0x23114d){_0x5e58f5['push'](_0x5e58f5['shift']());}};_0x5e3df3(++_0x16896a);}(_0xdef0,0x111));var _0x0def=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdef0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x0def('0x0'));var logger=require(_0x0def('0x1'))(_0x0def('0x2'));var moment=require(_0x0def('0x3'));var BPromise=require('bluebird');var rp=require(_0x0def('0x4'));var fs=require('fs');var path=require(_0x0def('0x5'));var rimraf=require('rimraf');var config=require(_0x0def('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x0def('0x7')]=function(_0x4ad800,_0x5963ca){return _0x4ad800[_0x0def('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0x0def('0x9'),'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 cfa2a72..f0ab95d 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 _0xdccc=['request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x41b515,_0x186ff7){var _0x1be3a0=function(_0x46e5fa){while(--_0x46e5fa){_0x41b515['push'](_0x41b515['shift']());}};_0x1be3a0(++_0x186ff7);}(_0xdccc,0x114));var _0xcdcc=function(_0x39c63e,_0x570a22){_0x39c63e=_0x39c63e-0x0;var _0x3fd553=_0xdccc[_0x39c63e];return _0x3fd553;};'use strict';var _=require(_0xcdcc('0x0'));var util=require(_0xcdcc('0x1'));var moment=require(_0xcdcc('0x2'));var BPromise=require(_0xcdcc('0x3'));var rs=require(_0xcdcc('0x4'));var fs=require('fs');var Redis=require(_0xcdcc('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcdcc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcdcc('0x7')][_0xcdcc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c84b6,_0x2cdb6f,_0x53bb00){return new BPromise(function(_0x3f3b4e,_0x2d2626){return client[_0xcdcc('0x9')](_0x4c84b6,_0x53bb00)[_0xcdcc('0xa')](function(_0x21474f){logger['info'](_0xcdcc('0xb'),_0x2cdb6f,_0xcdcc('0xc'));logger['debug'](_0xcdcc('0xd'),_0x2cdb6f,'request\x20sent',JSON[_0xcdcc('0xe')](_0x21474f));if(_0x21474f['error']){if(_0x21474f['error']['code']===0x1f4){logger[_0xcdcc('0xf')](_0xcdcc('0xb'),_0x2cdb6f,_0x21474f['error'][_0xcdcc('0x10')]);return _0x2d2626(_0x21474f[_0xcdcc('0xf')][_0xcdcc('0x10')]);}logger[_0xcdcc('0xf')](_0xcdcc('0xb'),_0x2cdb6f,_0x21474f['error'][_0xcdcc('0x10')]);return _0x3f3b4e(_0x21474f[_0xcdcc('0xf')]['message']);}else{logger['info'](_0xcdcc('0xb'),_0x2cdb6f,'request\x20sent');_0x3f3b4e(_0x21474f[_0xcdcc('0x11')][_0xcdcc('0x10')]);}})['catch'](function(_0x4bc235){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x2cdb6f,_0x4bc235);_0x2d2626(_0x4bc235);});});} \ No newline at end of file +var _0xcc58=['result','catch','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x5e4fdc,_0x183475){var _0xe2d401=function(_0x59ac98){while(--_0x59ac98){_0x5e4fdc['push'](_0x5e4fdc['shift']());}};_0xe2d401(++_0x183475);}(_0xcc58,0x16a));var _0x8cc5=function(_0x5010a0,_0x27c207){_0x5010a0=_0x5010a0-0x0;var _0x3777bc=_0xcc58[_0x5010a0];return _0x3777bc;};'use strict';var _=require('lodash');var util=require(_0x8cc5('0x0'));var moment=require(_0x8cc5('0x1'));var BPromise=require('bluebird');var rs=require(_0x8cc5('0x2'));var fs=require('fs');var Redis=require(_0x8cc5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8cc5('0x4'))(_0x8cc5('0x5'));var config=require('../../config/environment');var jayson=require(_0x8cc5('0x6'));var client=jayson[_0x8cc5('0x7')][_0x8cc5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3395b4,_0x486182,_0x30aca2){return new BPromise(function(_0x3c110a,_0x517535){return client[_0x8cc5('0x9')](_0x3395b4,_0x30aca2)['then'](function(_0x289fd7){logger['info'](_0x8cc5('0xa'),_0x486182,'request\x20sent');logger[_0x8cc5('0xb')](_0x8cc5('0xc'),_0x486182,_0x8cc5('0xd'),JSON['stringify'](_0x289fd7));if(_0x289fd7[_0x8cc5('0xe')]){if(_0x289fd7[_0x8cc5('0xe')]['code']===0x1f4){logger['error'](_0x8cc5('0xa'),_0x486182,_0x289fd7['error'][_0x8cc5('0xf')]);return _0x517535(_0x289fd7[_0x8cc5('0xe')][_0x8cc5('0xf')]);}logger[_0x8cc5('0xe')](_0x8cc5('0xa'),_0x486182,_0x289fd7[_0x8cc5('0xe')][_0x8cc5('0xf')]);return _0x3c110a(_0x289fd7[_0x8cc5('0xe')][_0x8cc5('0xf')]);}else{logger['info'](_0x8cc5('0xa'),_0x486182,_0x8cc5('0xd'));_0x3c110a(_0x289fd7[_0x8cc5('0x10')][_0x8cc5('0xf')]);}})[_0x8cc5('0x11')](function(_0x55c134){logger[_0x8cc5('0xe')](_0x8cc5('0xa'),_0x486182,_0x55c134);_0x517535(_0x55c134);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index ed1a216..e0e3c57 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 _0xe33c=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','post','isAuthenticated','put'];(function(_0x44247d,_0x22dbd5){var _0x173794=function(_0xd2d0b4){while(--_0xd2d0b4){_0x44247d['push'](_0x44247d['shift']());}};_0x173794(++_0x22dbd5);}(_0xe33c,0x10e));var _0xce33=function(_0x3d84ef,_0x14dc9c){_0x3d84ef=_0x3d84ef-0x0;var _0x3ac262=_0xe33c[_0x3d84ef];return _0x3ac262;};'use strict';var multer=require(_0xce33('0x0'));var util=require(_0xce33('0x1'));var path=require(_0xce33('0x2'));var timeout=require(_0xce33('0x3'));var express=require('express');var router=express[_0xce33('0x4')]();var fs_extra=require(_0xce33('0x5'));var auth=require(_0xce33('0x6'));var interaction=require(_0xce33('0x7'));var config=require(_0xce33('0x8'));var controller=require('./intSalesforceField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xce33('0x9')](_0xce33('0xa'),auth['isAuthenticated'](),controller[_0xce33('0xb')]);router[_0xce33('0xc')]('/',auth[_0xce33('0xd')](),controller['create']);router[_0xce33('0xe')](_0xce33('0xa'),auth[_0xce33('0xd')](),controller[_0xce33('0xf')]);router[_0xce33('0x10')](_0xce33('0xa'),auth['isAuthenticated'](),controller[_0xce33('0x11')]);module[_0xce33('0x12')]=router; \ No newline at end of file +var _0x9bec=['/:id','show','post','create','put','update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0x9bec,0x1c1));var _0xc9be=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x9bec[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc9be('0x0'));var timeout=require(_0xc9be('0x1'));var express=require(_0xc9be('0x2'));var router=express[_0xc9be('0x3')]();var fs_extra=require(_0xc9be('0x4'));var auth=require(_0xc9be('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc9be('0x6'));var controller=require(_0xc9be('0x7'));router[_0xc9be('0x8')]('/',auth[_0xc9be('0x9')](),controller['index']);router[_0xc9be('0x8')](_0xc9be('0xa'),auth[_0xc9be('0x9')](),controller[_0xc9be('0xb')]);router[_0xc9be('0xc')]('/',auth[_0xc9be('0x9')](),controller[_0xc9be('0xd')]);router[_0xc9be('0xe')](_0xc9be('0xa'),auth['isAuthenticated'](),controller[_0xc9be('0xf')]);router['delete']('/:id',auth[_0xc9be('0x9')](),controller[_0xc9be('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 88b727c..f1dbb92 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 _0x6255=['picklist','STRING','customVariable','sequelize','exports','string','variable','keyValue'];(function(_0x23a2f7,_0x3bd9e0){var _0x1e5a7d=function(_0x46037d){while(--_0x46037d){_0x23a2f7['push'](_0x23a2f7['shift']());}};_0x1e5a7d(++_0x3bd9e0);}(_0x6255,0x103));var _0x5625=function(_0x1b0899,_0x179c99){_0x1b0899=_0x1b0899-0x0;var _0x30273f=_0x6255[_0x1b0899];return _0x30273f;};'use strict';var Sequelize=require(_0x5625('0x0'));module[_0x5625('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5625('0x2'),_0x5625('0x3'),'customVariable',_0x5625('0x4'),_0x5625('0x5')),'defaultValue':_0x5625('0x2')},'content':{'type':Sequelize[_0x5625('0x6')]},'key':{'type':Sequelize[_0x5625('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x5625('0x2'),_0x5625('0x3'),_0x5625('0x7'))},'keyContent':{'type':Sequelize[_0x5625('0x6')]},'idField':{'type':Sequelize[_0x5625('0x6')]},'variableName':{'type':Sequelize[_0x5625('0x6')]}}; \ No newline at end of file +var _0x63d9=['string','variable','customVariable','picklist','STRING','sequelize','ENUM'];(function(_0x4c00a3,_0x2d23e2){var _0x893854=function(_0x6f552c){while(--_0x6f552c){_0x4c00a3['push'](_0x4c00a3['shift']());}};_0x893854(++_0x2d23e2);}(_0x63d9,0x1c5));var _0x963d=function(_0x2e0dca,_0x45a901){_0x2e0dca=_0x2e0dca-0x0;var _0x31605b=_0x63d9[_0x2e0dca];return _0x31605b;};'use strict';var Sequelize=require(_0x963d('0x0'));module['exports']={'type':{'type':Sequelize[_0x963d('0x1')](_0x963d('0x2'),_0x963d('0x3'),_0x963d('0x4'),'keyValue',_0x963d('0x5')),'defaultValue':_0x963d('0x2')},'content':{'type':Sequelize[_0x963d('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x963d('0x2'),_0x963d('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x963d('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 5ad2f80..be2ea09 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 _0xb3fd=['destroy','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','length','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then'];(function(_0x4ae5a2,_0x24f918){var _0x20ce73=function(_0x1719f7){while(--_0x1719f7){_0x4ae5a2['push'](_0x4ae5a2['shift']());}};_0x20ce73(++_0x24f918);}(_0xb3fd,0x1f3));var _0xdb3f=function(_0x2b69c5,_0x2b0749){_0x2b69c5=_0x2b69c5-0x0;var _0x3f122f=_0xb3fd[_0x2b69c5];return _0x3f122f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb3f('0x0'));var zipdir=require(_0xdb3f('0x1'));var jsonpatch=require(_0xdb3f('0x2'));var rp=require(_0xdb3f('0x3'));var moment=require(_0xdb3f('0x4'));var BPromise=require(_0xdb3f('0x5'));var Mustache=require(_0xdb3f('0x6'));var util=require(_0xdb3f('0x7'));var path=require(_0xdb3f('0x8'));var sox=require(_0xdb3f('0x9'));var csv=require(_0xdb3f('0xa'));var ejs=require(_0xdb3f('0xb'));var fs=require('fs');var fs_extra=require(_0xdb3f('0xc'));var _=require(_0xdb3f('0xd'));var squel=require('squel');var crypto=require(_0xdb3f('0xe'));var jsforce=require(_0xdb3f('0xf'));var deskjs=require(_0xdb3f('0x10'));var toCsv=require(_0xdb3f('0xa'));var querystring=require(_0xdb3f('0x11'));var Papa=require('papaparse');var Redis=require(_0xdb3f('0x12'));var authService=require(_0xdb3f('0x13'));var qs=require(_0xdb3f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb3f('0x15'));var logger=require(_0xdb3f('0x16'))(_0xdb3f('0x17'));var utils=require('../../config/utils');var config=require(_0xdb3f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb3f('0x19'))['db'];function respondWithStatusCode(_0x4821ff,_0x157a36){_0x157a36=_0x157a36||0xcc;return function(_0x127b25){if(_0x127b25){return _0x4821ff[_0xdb3f('0x1a')](_0x157a36);}return _0x4821ff[_0xdb3f('0x1b')](_0x157a36)[_0xdb3f('0x1c')]();};}function respondWithResult(_0x460845,_0x56b768){_0x56b768=_0x56b768||0xc8;return function(_0xcac264){if(_0xcac264){return _0x460845['status'](_0x56b768)['json'](_0xcac264);}};}function respondWithFilteredResult(_0x3d4298,_0xc2022d){return function(_0x83268b){if(_0x83268b){var _0x5f473f=typeof _0xc2022d[_0xdb3f('0x1d')]===_0xdb3f('0x1e')&&typeof _0xc2022d['limit']===_0xdb3f('0x1e');var _0x163273=_0x83268b['count'];var _0xb2d80d=_0x5f473f?0x0:_0xc2022d[_0xdb3f('0x1d')];var _0x1b3e7a=_0x5f473f?_0x83268b[_0xdb3f('0x1f')]:_0xc2022d['offset']+_0xc2022d[_0xdb3f('0x20')];var _0x586e77;if(_0x1b3e7a>=_0x163273){_0x1b3e7a=_0x163273;_0x586e77=0xc8;}else{_0x586e77=0xce;}_0x3d4298[_0xdb3f('0x1b')](_0x586e77);return _0x3d4298['set'](_0xdb3f('0x21'),_0xb2d80d+'-'+_0x1b3e7a+'/'+_0x163273)[_0xdb3f('0x22')](_0x83268b);}return null;};}function patchUpdates(_0x4d16f6){return function(_0x2c8ea0){try{jsonpatch[_0xdb3f('0x23')](_0x2c8ea0,_0x4d16f6,!![]);}catch(_0x302509){return BPromise[_0xdb3f('0x24')](_0x302509);}return _0x2c8ea0[_0xdb3f('0x25')]();};}function saveUpdates(_0x44387b,_0x33f7dd){return function(_0x456a01){if(_0x456a01){return _0x456a01[_0xdb3f('0x26')](_0x44387b)[_0xdb3f('0x27')](function(_0x2836f5){return _0x2836f5;});}return null;};}function removeEntity(_0x33515c,_0x225f24){return function(_0x3f9f28){if(_0x3f9f28){return _0x3f9f28[_0xdb3f('0x28')]()[_0xdb3f('0x27')](function(){_0x33515c[_0xdb3f('0x1b')](0xcc)[_0xdb3f('0x1c')]();});}};}function handleEntityNotFound(_0x1b459d,_0x4eb8db){return function(_0x1f7580){if(!_0x1f7580){_0x1b459d[_0xdb3f('0x1a')](0x194);}return _0x1f7580;};}function handleError(_0x49738a,_0x62331c){_0x62331c=_0x62331c||0x1f4;return function(_0x187023){logger[_0xdb3f('0x29')](_0x187023[_0xdb3f('0x2a')]);if(_0x187023[_0xdb3f('0x2b')]){delete _0x187023[_0xdb3f('0x2b')];}_0x49738a['status'](_0x62331c)[_0xdb3f('0x2c')](_0x187023);};}exports[_0xdb3f('0x2d')]=function(_0x3c6527,_0x2e7c8a){var _0x545f50={},_0x2c3344={},_0x46cca8={'count':0x0,'rows':[]};var _0x413e1e=_[_0xdb3f('0x2e')](db[_0xdb3f('0x2f')][_0xdb3f('0x30')],function(_0x1522c6){return{'name':_0x1522c6[_0xdb3f('0x31')],'type':_0x1522c6[_0xdb3f('0x32')][_0xdb3f('0x33')]};});_0x2c3344[_0xdb3f('0x34')]=_[_0xdb3f('0x2e')](_0x413e1e,_0xdb3f('0x2b'));_0x2c3344[_0xdb3f('0x35')]=_[_0xdb3f('0x36')](_0x3c6527[_0xdb3f('0x35')]);_0x2c3344[_0xdb3f('0x37')]=_[_0xdb3f('0x38')](_0x2c3344['model'],_0x2c3344[_0xdb3f('0x35')]);_0x545f50[_0xdb3f('0x39')]=_['intersection'](_0x2c3344[_0xdb3f('0x34')],qs[_0xdb3f('0x3a')](_0x3c6527[_0xdb3f('0x35')]['fields']));_0x545f50['attributes']=_0x545f50['attributes']['length']?_0x545f50['attributes']:_0x2c3344[_0xdb3f('0x34')];if(!_0x3c6527[_0xdb3f('0x35')][_0xdb3f('0x3b')]('nolimit')){_0x545f50[_0xdb3f('0x20')]=qs[_0xdb3f('0x20')](_0x3c6527['query']['limit']);_0x545f50[_0xdb3f('0x1d')]=qs[_0xdb3f('0x1d')](_0x3c6527[_0xdb3f('0x35')][_0xdb3f('0x1d')]);}_0x545f50[_0xdb3f('0x3c')]=qs['sort'](_0x3c6527['query'][_0xdb3f('0x3d')]);_0x545f50[_0xdb3f('0x3e')]=qs[_0xdb3f('0x37')](_['pick'](_0x3c6527[_0xdb3f('0x35')],_0x2c3344[_0xdb3f('0x37')]),_0x413e1e);if(_0x3c6527[_0xdb3f('0x35')][_0xdb3f('0x3f')]){_0x545f50['where']=_[_0xdb3f('0x40')](_0x545f50[_0xdb3f('0x3e')],{'$or':_[_0xdb3f('0x2e')](_0x413e1e,function(_0x3906eb){if(_0x3906eb[_0xdb3f('0x32')]!==_0xdb3f('0x41')){var _0x156dbe={};_0x156dbe[_0x3906eb[_0xdb3f('0x2b')]]={'$like':'%'+_0x3c6527[_0xdb3f('0x35')][_0xdb3f('0x3f')]+'%'};return _0x156dbe;}})});}_0x545f50=_[_0xdb3f('0x40')]({},_0x545f50,_0x3c6527[_0xdb3f('0x42')]);var _0x1d7a56={'where':_0x545f50[_0xdb3f('0x3e')]};return db[_0xdb3f('0x2f')][_0xdb3f('0x1f')](_0x1d7a56)[_0xdb3f('0x27')](function(_0x3ca660){_0x46cca8['count']=_0x3ca660;if(_0x3c6527[_0xdb3f('0x35')]['includeAll']){_0x545f50[_0xdb3f('0x43')]=[{'all':!![]}];}return db[_0xdb3f('0x2f')][_0xdb3f('0x44')](_0x545f50);})[_0xdb3f('0x27')](function(_0x41f784){_0x46cca8['rows']=_0x41f784;return _0x46cca8;})[_0xdb3f('0x27')](respondWithFilteredResult(_0x2e7c8a,_0x545f50))[_0xdb3f('0x45')](handleError(_0x2e7c8a,null));};exports[_0xdb3f('0x46')]=function(_0x26e993,_0x459642){var _0x4f9a66={'raw':!![],'where':{'id':_0x26e993[_0xdb3f('0x47')]['id']}},_0x513396={};_0x513396[_0xdb3f('0x34')]=_['keys'](db[_0xdb3f('0x2f')]['rawAttributes']);_0x513396['query']=_['keys'](_0x26e993[_0xdb3f('0x35')]);_0x513396[_0xdb3f('0x37')]=_[_0xdb3f('0x38')](_0x513396[_0xdb3f('0x34')],_0x513396[_0xdb3f('0x35')]);_0x4f9a66[_0xdb3f('0x39')]=_[_0xdb3f('0x38')](_0x513396['model'],qs[_0xdb3f('0x3a')](_0x26e993[_0xdb3f('0x35')][_0xdb3f('0x3a')]));_0x4f9a66[_0xdb3f('0x39')]=_0x4f9a66[_0xdb3f('0x39')][_0xdb3f('0x48')]?_0x4f9a66[_0xdb3f('0x39')]:_0x513396[_0xdb3f('0x34')];if(_0x26e993['query'][_0xdb3f('0x49')]){_0x4f9a66[_0xdb3f('0x43')]=[{'all':!![]}];}_0x4f9a66=_['merge']({},_0x4f9a66,_0x26e993[_0xdb3f('0x42')]);return db[_0xdb3f('0x2f')][_0xdb3f('0x4a')](_0x4f9a66)[_0xdb3f('0x27')](handleEntityNotFound(_0x459642,null))[_0xdb3f('0x27')](respondWithResult(_0x459642,null))[_0xdb3f('0x45')](handleError(_0x459642,null));};exports[_0xdb3f('0x4b')]=function(_0x191c49,_0x556720){return db[_0xdb3f('0x2f')][_0xdb3f('0x4b')](_0x191c49[_0xdb3f('0x4c')],{})[_0xdb3f('0x27')](respondWithResult(_0x556720,0xc9))[_0xdb3f('0x45')](handleError(_0x556720,null));};exports[_0xdb3f('0x26')]=function(_0x477000,_0x36ce83){if(_0x477000['body']['id']){delete _0x477000[_0xdb3f('0x4c')]['id'];}return db['SalesforceField'][_0xdb3f('0x4a')]({'where':{'id':_0x477000[_0xdb3f('0x47')]['id']}})['then'](handleEntityNotFound(_0x36ce83,null))[_0xdb3f('0x27')](saveUpdates(_0x477000[_0xdb3f('0x4c')],null))[_0xdb3f('0x27')](respondWithResult(_0x36ce83,null))[_0xdb3f('0x45')](handleError(_0x36ce83,null));};exports['destroy']=function(_0x416190,_0x3b812f){return db[_0xdb3f('0x2f')]['find']({'where':{'id':_0x416190['params']['id']}})[_0xdb3f('0x27')](handleEntityNotFound(_0x3b812f,null))[_0xdb3f('0x27')](removeEntity(_0x3b812f,null))[_0xdb3f('0x45')](handleError(_0x3b812f,null));}; \ No newline at end of file +var _0x0644=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','type','model','keys','filters','intersection','query','attributes','fields','length','nolimit','pick','filter','where','merge','VIRTUAL','SalesforceField','findAll','rows','catch','show','includeAll','include','options','create','body','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware'];(function(_0x4b0746,_0x340908){var _0x4da05f=function(_0x20bc41){while(--_0x20bc41){_0x4b0746['push'](_0x4b0746['shift']());}};_0x4da05f(++_0x340908);}(_0x0644,0x111));var _0x4064=function(_0x1bdf08,_0x4a22a9){_0x1bdf08=_0x1bdf08-0x0;var _0x212e0d=_0x0644[_0x1bdf08];return _0x212e0d;};'use strict';var emlformat=require(_0x4064('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4064('0x1'));var jsonpatch=require(_0x4064('0x2'));var rp=require(_0x4064('0x3'));var moment=require(_0x4064('0x4'));var BPromise=require(_0x4064('0x5'));var Mustache=require(_0x4064('0x6'));var util=require(_0x4064('0x7'));var path=require(_0x4064('0x8'));var sox=require('sox');var csv=require(_0x4064('0x9'));var ejs=require(_0x4064('0xa'));var fs=require('fs');var fs_extra=require(_0x4064('0xb'));var _=require('lodash');var squel=require(_0x4064('0xc'));var crypto=require(_0x4064('0xd'));var jsforce=require(_0x4064('0xe'));var deskjs=require(_0x4064('0xf'));var toCsv=require(_0x4064('0x9'));var querystring=require('querystring');var Papa=require(_0x4064('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4064('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4064('0x12'));var logger=require(_0x4064('0x13'))(_0x4064('0x14'));var utils=require(_0x4064('0x15'));var config=require(_0x4064('0x16'));var licenseUtil=require(_0x4064('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422ff3,_0x1266a7){_0x1266a7=_0x1266a7||0xcc;return function(_0x410a5e){if(_0x410a5e){return _0x422ff3[_0x4064('0x18')](_0x1266a7);}return _0x422ff3[_0x4064('0x19')](_0x1266a7)[_0x4064('0x1a')]();};}function respondWithResult(_0x2543f8,_0x2cfece){_0x2cfece=_0x2cfece||0xc8;return function(_0x47b726){if(_0x47b726){return _0x2543f8[_0x4064('0x19')](_0x2cfece)[_0x4064('0x1b')](_0x47b726);}};}function respondWithFilteredResult(_0x16d1cc,_0x464b47){return function(_0x425b71){if(_0x425b71){var _0x4b4370=typeof _0x464b47[_0x4064('0x1c')]===_0x4064('0x1d')&&typeof _0x464b47[_0x4064('0x1e')]==='undefined';var _0x126367=_0x425b71[_0x4064('0x1f')];var _0xfd2cba=_0x4b4370?0x0:_0x464b47[_0x4064('0x1c')];var _0x4e489f=_0x4b4370?_0x425b71[_0x4064('0x1f')]:_0x464b47[_0x4064('0x1c')]+_0x464b47[_0x4064('0x1e')];var _0x5b7577;if(_0x4e489f>=_0x126367){_0x4e489f=_0x126367;_0x5b7577=0xc8;}else{_0x5b7577=0xce;}_0x16d1cc['status'](_0x5b7577);return _0x16d1cc[_0x4064('0x20')](_0x4064('0x21'),_0xfd2cba+'-'+_0x4e489f+'/'+_0x126367)[_0x4064('0x1b')](_0x425b71);}return null;};}function patchUpdates(_0x16844e){return function(_0x32995e){try{jsonpatch[_0x4064('0x22')](_0x32995e,_0x16844e,!![]);}catch(_0x56ce36){return BPromise[_0x4064('0x23')](_0x56ce36);}return _0x32995e[_0x4064('0x24')]();};}function saveUpdates(_0x5b1b1d,_0x5d116a){return function(_0x46fc97){if(_0x46fc97){return _0x46fc97[_0x4064('0x25')](_0x5b1b1d)['then'](function(_0x2956b7){return _0x2956b7;});}return null;};}function removeEntity(_0x174e6c,_0x563b82){return function(_0x4cb5fa){if(_0x4cb5fa){return _0x4cb5fa['destroy']()[_0x4064('0x26')](function(){_0x174e6c[_0x4064('0x19')](0xcc)[_0x4064('0x1a')]();});}};}function handleEntityNotFound(_0x542b06,_0x229f8a){return function(_0x221025){if(!_0x221025){_0x542b06[_0x4064('0x18')](0x194);}return _0x221025;};}function handleError(_0x33cafe,_0x5ddcd5){_0x5ddcd5=_0x5ddcd5||0x1f4;return function(_0x5827b2){logger[_0x4064('0x27')](_0x5827b2[_0x4064('0x28')]);if(_0x5827b2[_0x4064('0x29')]){delete _0x5827b2[_0x4064('0x29')];}_0x33cafe[_0x4064('0x19')](_0x5ddcd5)[_0x4064('0x2a')](_0x5827b2);};}exports[_0x4064('0x2b')]=function(_0x2ab293,_0x3b0c46){var _0x3288c1={},_0x2da098={},_0x49d184={'count':0x0,'rows':[]};var _0x1aa0a3=_[_0x4064('0x2c')](db['SalesforceField'][_0x4064('0x2d')],function(_0x58c155){return{'name':_0x58c155['fieldName'],'type':_0x58c155[_0x4064('0x2e')]['key']};});_0x2da098[_0x4064('0x2f')]=_[_0x4064('0x2c')](_0x1aa0a3,_0x4064('0x29'));_0x2da098['query']=_[_0x4064('0x30')](_0x2ab293['query']);_0x2da098[_0x4064('0x31')]=_[_0x4064('0x32')](_0x2da098[_0x4064('0x2f')],_0x2da098[_0x4064('0x33')]);_0x3288c1[_0x4064('0x34')]=_[_0x4064('0x32')](_0x2da098['model'],qs[_0x4064('0x35')](_0x2ab293[_0x4064('0x33')][_0x4064('0x35')]));_0x3288c1[_0x4064('0x34')]=_0x3288c1[_0x4064('0x34')][_0x4064('0x36')]?_0x3288c1[_0x4064('0x34')]:_0x2da098[_0x4064('0x2f')];if(!_0x2ab293[_0x4064('0x33')]['hasOwnProperty'](_0x4064('0x37'))){_0x3288c1[_0x4064('0x1e')]=qs[_0x4064('0x1e')](_0x2ab293[_0x4064('0x33')][_0x4064('0x1e')]);_0x3288c1[_0x4064('0x1c')]=qs[_0x4064('0x1c')](_0x2ab293[_0x4064('0x33')][_0x4064('0x1c')]);}_0x3288c1['order']=qs['sort'](_0x2ab293[_0x4064('0x33')]['sort']);_0x3288c1['where']=qs['filters'](_[_0x4064('0x38')](_0x2ab293[_0x4064('0x33')],_0x2da098[_0x4064('0x31')]),_0x1aa0a3);if(_0x2ab293[_0x4064('0x33')][_0x4064('0x39')]){_0x3288c1[_0x4064('0x3a')]=_[_0x4064('0x3b')](_0x3288c1[_0x4064('0x3a')],{'$or':_[_0x4064('0x2c')](_0x1aa0a3,function(_0x26e959){if(_0x26e959[_0x4064('0x2e')]!==_0x4064('0x3c')){var _0x51f9d3={};_0x51f9d3[_0x26e959[_0x4064('0x29')]]={'$like':'%'+_0x2ab293[_0x4064('0x33')][_0x4064('0x39')]+'%'};return _0x51f9d3;}})});}_0x3288c1=_[_0x4064('0x3b')]({},_0x3288c1,_0x2ab293['options']);var _0x423255={'where':_0x3288c1['where']};return db[_0x4064('0x3d')][_0x4064('0x1f')](_0x423255)[_0x4064('0x26')](function(_0x17dd4c){_0x49d184[_0x4064('0x1f')]=_0x17dd4c;if(_0x2ab293[_0x4064('0x33')]['includeAll']){_0x3288c1['include']=[{'all':!![]}];}return db[_0x4064('0x3d')][_0x4064('0x3e')](_0x3288c1);})[_0x4064('0x26')](function(_0x519de6){_0x49d184[_0x4064('0x3f')]=_0x519de6;return _0x49d184;})[_0x4064('0x26')](respondWithFilteredResult(_0x3b0c46,_0x3288c1))[_0x4064('0x40')](handleError(_0x3b0c46,null));};exports[_0x4064('0x41')]=function(_0x1cba76,_0x4a5643){var _0x4874b7={'raw':!![],'where':{'id':_0x1cba76['params']['id']}},_0x559e18={};_0x559e18[_0x4064('0x2f')]=_[_0x4064('0x30')](db[_0x4064('0x3d')]['rawAttributes']);_0x559e18[_0x4064('0x33')]=_['keys'](_0x1cba76[_0x4064('0x33')]);_0x559e18['filters']=_['intersection'](_0x559e18[_0x4064('0x2f')],_0x559e18[_0x4064('0x33')]);_0x4874b7[_0x4064('0x34')]=_[_0x4064('0x32')](_0x559e18[_0x4064('0x2f')],qs[_0x4064('0x35')](_0x1cba76[_0x4064('0x33')]['fields']));_0x4874b7[_0x4064('0x34')]=_0x4874b7[_0x4064('0x34')][_0x4064('0x36')]?_0x4874b7[_0x4064('0x34')]:_0x559e18[_0x4064('0x2f')];if(_0x1cba76['query'][_0x4064('0x42')]){_0x4874b7[_0x4064('0x43')]=[{'all':!![]}];}_0x4874b7=_['merge']({},_0x4874b7,_0x1cba76[_0x4064('0x44')]);return db[_0x4064('0x3d')]['find'](_0x4874b7)['then'](handleEntityNotFound(_0x4a5643,null))[_0x4064('0x26')](respondWithResult(_0x4a5643,null))[_0x4064('0x40')](handleError(_0x4a5643,null));};exports['create']=function(_0x165541,_0x42b659){return db['SalesforceField'][_0x4064('0x45')](_0x165541[_0x4064('0x46')],{})['then'](respondWithResult(_0x42b659,0xc9))[_0x4064('0x40')](handleError(_0x42b659,null));};exports[_0x4064('0x25')]=function(_0x221312,_0x52e589){if(_0x221312[_0x4064('0x46')]['id']){delete _0x221312['body']['id'];}return db[_0x4064('0x3d')]['find']({'where':{'id':_0x221312[_0x4064('0x47')]['id']}})['then'](handleEntityNotFound(_0x52e589,null))[_0x4064('0x26')](saveUpdates(_0x221312[_0x4064('0x46')],null))[_0x4064('0x26')](respondWithResult(_0x52e589,null))[_0x4064('0x40')](handleError(_0x52e589,null));};exports[_0x4064('0x48')]=function(_0x22d77a,_0x165dda){return db['SalesforceField']['find']({'where':{'id':_0x22d77a['params']['id']}})[_0x4064('0x26')](handleEntityNotFound(_0x165dda,null))['then'](removeEntity(_0x165dda,null))[_0x4064('0x40')](handleError(_0x165dda,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 9ac24fb..dfe19a4 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 _0x2578=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','salesforce_unique_index','idField','FieldId','lodash','util'];(function(_0x33d902,_0x23dc77){var _0xff23a8=function(_0x22322b){while(--_0x22322b){_0x33d902['push'](_0x33d902['shift']());}};_0xff23a8(++_0x23dc77);}(_0x2578,0x1c0));var _0x8257=function(_0xa91bb6,_0x436b4c){_0xa91bb6=_0xa91bb6-0x0;var _0x5e3e02=_0x2578[_0xa91bb6];return _0x5e3e02;};'use strict';var _=require(_0x8257('0x0'));var util=require(_0x8257('0x1'));var logger=require(_0x8257('0x2'))(_0x8257('0x3'));var moment=require(_0x8257('0x4'));var BPromise=require('bluebird');var rp=require(_0x8257('0x5'));var fs=require('fs');var path=require(_0x8257('0x6'));var rimraf=require(_0x8257('0x7'));var config=require(_0x8257('0x8'));var attributes=require(_0x8257('0x9'));module[_0x8257('0xa')]=function(_0x320746,_0x3ce7af){return _0x320746[_0x8257('0xb')]('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x8257('0xc'),'fields':[_0x8257('0xd'),_0x8257('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60e4=['request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','../../config/logger','api','bluebird'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x60e4,0x122));var _0x460e=function(_0x164546,_0x31e578){_0x164546=_0x164546-0x0;var _0x369e58=_0x60e4[_0x164546];return _0x369e58;};'use strict';var _=require(_0x460e('0x0'));var util=require('util');var logger=require(_0x460e('0x1'))(_0x460e('0x2'));var moment=require('moment');var BPromise=require(_0x460e('0x3'));var rp=require(_0x460e('0x4'));var fs=require('fs');var path=require(_0x460e('0x5'));var rimraf=require(_0x460e('0x6'));var config=require(_0x460e('0x7'));var attributes=require(_0x460e('0x8'));module['exports']=function(_0x160a2b,_0x54e910){return _0x160a2b[_0x460e('0x9')](_0x460e('0xa'),attributes,{'tableName':_0x460e('0xb'),'paranoid':![],'indexes':[{'name':_0x460e('0xc'),'fields':['idField',_0x460e('0xd')],'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 e0978f4..32349e4 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 _0xa592=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x359dda,_0x38666a){var _0x12b93f=function(_0x3a30e0){while(--_0x3a30e0){_0x359dda['push'](_0x359dda['shift']());}};_0x12b93f(++_0x38666a);}(_0xa592,0xa1));var _0x2a59=function(_0x527b3a,_0x479654){_0x527b3a=_0x527b3a-0x0;var _0x58f141=_0xa592[_0x527b3a];return _0x58f141;};'use strict';var _=require('lodash');var util=require(_0x2a59('0x0'));var moment=require(_0x2a59('0x1'));var BPromise=require('bluebird');var rs=require(_0x2a59('0x2'));var fs=require('fs');var Redis=require(_0x2a59('0x3'));var db=require(_0x2a59('0x4'))['db'];var utils=require(_0x2a59('0x5'));var logger=require(_0x2a59('0x6'))(_0x2a59('0x7'));var config=require(_0x2a59('0x8'));var jayson=require(_0x2a59('0x9'));var client=jayson[_0x2a59('0xa')][_0x2a59('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x252d4f,_0x25a785,_0x45377b){return new BPromise(function(_0x233a7f,_0x20226d){return client[_0x2a59('0xc')](_0x252d4f,_0x45377b)[_0x2a59('0xd')](function(_0x2ab22e){logger[_0x2a59('0xe')](_0x2a59('0xf'),_0x25a785,_0x2a59('0x10'));logger[_0x2a59('0x11')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x25a785,_0x2a59('0x10'),JSON['stringify'](_0x2ab22e));if(_0x2ab22e[_0x2a59('0x12')]){if(_0x2ab22e[_0x2a59('0x12')][_0x2a59('0x13')]===0x1f4){logger[_0x2a59('0x12')]('SalesforceField,\x20%s,\x20%s',_0x25a785,_0x2ab22e[_0x2a59('0x12')][_0x2a59('0x14')]);return _0x20226d(_0x2ab22e['error'][_0x2a59('0x14')]);}logger[_0x2a59('0x12')](_0x2a59('0xf'),_0x25a785,_0x2ab22e[_0x2a59('0x12')][_0x2a59('0x14')]);return _0x233a7f(_0x2ab22e[_0x2a59('0x12')][_0x2a59('0x14')]);}else{logger[_0x2a59('0xe')](_0x2a59('0xf'),_0x25a785,_0x2a59('0x10'));_0x233a7f(_0x2ab22e['result'][_0x2a59('0x14')]);}})['catch'](function(_0x1b2590){logger[_0x2a59('0x12')](_0x2a59('0xf'),_0x25a785,_0x1b2590);_0x20226d(_0x1b2590);});});} \ No newline at end of file +var _0x19a3=['SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x19a3,0x1be));var _0x319a=function(_0x53342e,_0x49614e){_0x53342e=_0x53342e-0x0;var _0x44a8d7=_0x19a3[_0x53342e];return _0x44a8d7;};'use strict';var _=require('lodash');var util=require(_0x319a('0x0'));var moment=require(_0x319a('0x1'));var BPromise=require(_0x319a('0x2'));var rs=require(_0x319a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x319a('0x4'))['db'];var utils=require(_0x319a('0x5'));var logger=require(_0x319a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x319a('0x7'));var client=jayson[_0x319a('0x8')][_0x319a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e1fe5,_0xc39b48,_0x5b0ccd){return new BPromise(function(_0x4aa6d8,_0x4f2d82){return client[_0x319a('0xa')](_0x3e1fe5,_0x5b0ccd)[_0x319a('0xb')](function(_0x24f416){logger['info']('SalesforceField,\x20%s,\x20%s',_0xc39b48,_0x319a('0xc'));logger[_0x319a('0xd')](_0x319a('0xe'),_0xc39b48,_0x319a('0xc'),JSON[_0x319a('0xf')](_0x24f416));if(_0x24f416[_0x319a('0x10')]){if(_0x24f416['error'][_0x319a('0x11')]===0x1f4){logger[_0x319a('0x10')](_0x319a('0x12'),_0xc39b48,_0x24f416[_0x319a('0x10')]['message']);return _0x4f2d82(_0x24f416[_0x319a('0x10')][_0x319a('0x13')]);}logger[_0x319a('0x10')]('SalesforceField,\x20%s,\x20%s',_0xc39b48,_0x24f416[_0x319a('0x10')][_0x319a('0x13')]);return _0x4aa6d8(_0x24f416[_0x319a('0x10')][_0x319a('0x13')]);}else{logger[_0x319a('0x14')](_0x319a('0x12'),_0xc39b48,_0x319a('0xc'));_0x4aa6d8(_0x24f416[_0x319a('0x15')][_0x319a('0x13')]);}})[_0x319a('0x16')](function(_0x407e38){logger[_0x319a('0x10')](_0x319a('0x12'),_0xc39b48,_0x407e38);_0x4f2d82(_0x407e38);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 2ded4dd..29b7830 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 _0xaf5c=['isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xaf5c,0x161));var _0xcaf5=function(_0x234beb,_0x711cc5){_0x234beb=_0x234beb-0x0;var _0x58f925=_0xaf5c[_0x234beb];return _0x58f925;};'use strict';var multer=require('multer');var util=require(_0xcaf5('0x0'));var path=require(_0xcaf5('0x1'));var timeout=require(_0xcaf5('0x2'));var express=require(_0xcaf5('0x3'));var router=express['Router']();var fs_extra=require(_0xcaf5('0x4'));var auth=require(_0xcaf5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcaf5('0x6'));var controller=require('./intServicenowAccount.controller');router[_0xcaf5('0x7')]('/',auth[_0xcaf5('0x8')](),controller[_0xcaf5('0x9')]);router[_0xcaf5('0x7')](_0xcaf5('0xa'),auth[_0xcaf5('0x8')](),controller['show']);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xcaf5('0xb')]);router[_0xcaf5('0x7')](_0xcaf5('0xc'),auth['isAuthenticated'](),controller[_0xcaf5('0xd')]);router[_0xcaf5('0xe')]('/',auth[_0xcaf5('0x8')](),controller['create']);router['post']('/:id/configurations',auth[_0xcaf5('0x8')](),controller[_0xcaf5('0xf')]);router['put'](_0xcaf5('0xa'),auth[_0xcaf5('0x8')](),controller[_0xcaf5('0x10')]);router['delete'](_0xcaf5('0xa'),auth['isAuthenticated'](),controller[_0xcaf5('0x11')]);module[_0xcaf5('0x12')]=router; \ No newline at end of file +var _0x5884=['getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/configurations'];(function(_0x425a62,_0x4ec77f){var _0x2df1e1=function(_0x5c35e3){while(--_0x5c35e3){_0x425a62['push'](_0x425a62['shift']());}};_0x2df1e1(++_0x4ec77f);}(_0x5884,0x144));var _0x4588=function(_0x51871d,_0x4ea3bf){_0x51871d=_0x51871d-0x0;var _0x1aef47=_0x5884[_0x51871d];return _0x1aef47;};'use strict';var multer=require(_0x4588('0x0'));var util=require(_0x4588('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4588('0x2'));var router=express['Router']();var fs_extra=require(_0x4588('0x3'));var auth=require(_0x4588('0x4'));var interaction=require(_0x4588('0x5'));var config=require(_0x4588('0x6'));var controller=require('./intServicenowAccount.controller');router[_0x4588('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4588('0x7')](_0x4588('0x8'),auth[_0x4588('0x9')](),controller[_0x4588('0xa')]);router[_0x4588('0x7')](_0x4588('0xb'),auth[_0x4588('0x9')](),controller['getConfigurations']);router[_0x4588('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x4588('0xc')]);router[_0x4588('0xd')]('/',auth[_0x4588('0x9')](),controller[_0x4588('0xe')]);router[_0x4588('0xd')](_0x4588('0xb'),auth[_0x4588('0x9')](),controller[_0x4588('0xf')]);router[_0x4588('0x10')](_0x4588('0x8'),auth[_0x4588('0x9')](),controller[_0x4588('0x11')]);router[_0x4588('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4588('0x13')]);module[_0x4588('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 75d3d56..eb53b86 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 _0x3c8f=['exports','STRING','username','remoteUri'];(function(_0xd1788c,_0x4830a2){var _0x9ce47f=function(_0x150888){while(--_0x150888){_0xd1788c['push'](_0xd1788c['shift']());}};_0x9ce47f(++_0x4830a2);}(_0x3c8f,0x7c));var _0xf3c8=function(_0x24d926,_0x4a1aee){_0x24d926=_0x24d926-0x0;var _0x1b6463=_0x3c8f[_0x24d926];return _0x1b6463;};'use strict';var Sequelize=require('sequelize');module[_0xf3c8('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf3c8('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xf3c8('0x2')},'password':{'type':Sequelize[_0xf3c8('0x1')]},'email':{'type':Sequelize[_0xf3c8('0x1')]},'remoteUri':{'type':Sequelize[_0xf3c8('0x1')],'unique':_0xf3c8('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x7d82=['STRING','username','remoteUri','sequelize','exports'];(function(_0x115f91,_0xf14b74){var _0x45ccc0=function(_0x1ba01e){while(--_0x1ba01e){_0x115f91['push'](_0x115f91['shift']());}};_0x45ccc0(++_0xf14b74);}(_0x7d82,0x99));var _0x27d8=function(_0x3618ac,_0x42172a){_0x3618ac=_0x3618ac-0x0;var _0x3c24f1=_0x7d82[_0x3618ac];return _0x3c24f1;};'use strict';var Sequelize=require(_0x27d8('0x0'));module[_0x27d8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x27d8('0x2')],'unique':_0x27d8('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x27d8('0x2')]},'remoteUri':{'type':Sequelize[_0x27d8('0x2')],'unique':_0x27d8('0x4')},'serverUrl':{'type':Sequelize[_0x27d8('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index ae596d6..c259476 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 _0xf769=['findOne','ServicenowConfiguration','rawAttributes','hasOwnProperty','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','category','parent','upon_reject','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','caller_id','approval_set','work_notes','correlation_display','delivery_task','work_start','assignment_group','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','severity','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','escalation','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','result','log','assign','forEach','internalType','label','push','all','TCL:\x20_object','remove','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','stack','send','Wrong\x20credentials','boolean','True','true','False','false','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','ServicenowAccount','type','key','model','map','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','keys','options','find','create','body','update','getConfigurations'];(function(_0x5287fe,_0x1a5965){var _0x4283c7=function(_0x28f788){while(--_0x28f788){_0x5287fe['push'](_0x5287fe['shift']());}};_0x4283c7(++_0x1a5965);}(_0xf769,0x6a));var _0x9f76=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xf769[_0xf0bcac];return _0x4e4c65;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9f76('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9f76('0x1'));var Mustache=require(_0x9f76('0x2'));var util=require(_0x9f76('0x3'));var path=require(_0x9f76('0x4'));var sox=require(_0x9f76('0x5'));var csv=require(_0x9f76('0x6'));var ejs=require(_0x9f76('0x7'));var fs=require('fs');var fs_extra=require(_0x9f76('0x8'));var _=require(_0x9f76('0x9'));var squel=require(_0x9f76('0xa'));var crypto=require('crypto');var jsforce=require(_0x9f76('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9f76('0x6'));var querystring=require(_0x9f76('0xc'));var Papa=require(_0x9f76('0xd'));var Redis=require(_0x9f76('0xe'));var authService=require(_0x9f76('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f76('0x10'));var logger=require(_0x9f76('0x11'))(_0x9f76('0x12'));var utils=require('../../config/utils');var config=require(_0x9f76('0x13'));var licenseUtil=require(_0x9f76('0x14'));var db=require(_0x9f76('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x433467,_0x377f70){_0x377f70=_0x377f70||0xcc;return function(_0x1e0eca){if(_0x1e0eca){return _0x433467[_0x9f76('0x16')](_0x377f70);}return _0x433467[_0x9f76('0x17')](_0x377f70)[_0x9f76('0x18')]();};}function respondWithResult(_0x2f9d74,_0x585ce2){_0x585ce2=_0x585ce2||0xc8;return function(_0x7f8d29){if(_0x7f8d29){return _0x2f9d74['status'](_0x585ce2)[_0x9f76('0x19')](_0x7f8d29);}};}function respondWithFilteredResult(_0x33e192,_0x473185){return function(_0x522203){if(_0x522203){var _0x292b7e=typeof _0x473185[_0x9f76('0x1a')]===_0x9f76('0x1b')&&typeof _0x473185[_0x9f76('0x1c')]===_0x9f76('0x1b');var _0x55bf0b=_0x522203['count'];var _0x4461a6=_0x292b7e?0x0:_0x473185[_0x9f76('0x1a')];var _0xd2d38e=_0x292b7e?_0x522203[_0x9f76('0x1d')]:_0x473185[_0x9f76('0x1a')]+_0x473185[_0x9f76('0x1c')];var _0x4289d1;if(_0xd2d38e>=_0x55bf0b){_0xd2d38e=_0x55bf0b;_0x4289d1=0xc8;}else{_0x4289d1=0xce;}_0x33e192[_0x9f76('0x17')](_0x4289d1);return _0x33e192[_0x9f76('0x1e')](_0x9f76('0x1f'),_0x4461a6+'-'+_0xd2d38e+'/'+_0x55bf0b)['json'](_0x522203);}return null;};}function patchUpdates(_0x8f8233){return function(_0x292dfc){try{jsonpatch[_0x9f76('0x20')](_0x292dfc,_0x8f8233,!![]);}catch(_0x11d1d1){return BPromise['reject'](_0x11d1d1);}return _0x292dfc[_0x9f76('0x21')]();};}function saveUpdates(_0x3fd03a,_0x31714a){return function(_0x5a8669){if(_0x5a8669){return _0x5a8669['update'](_0x3fd03a)[_0x9f76('0x22')](function(_0x180d37){return _0x180d37;});}return null;};}function removeEntity(_0x37b93b,_0x508b38){return function(_0x2e5a5a){if(_0x2e5a5a){return _0x2e5a5a[_0x9f76('0x23')]()[_0x9f76('0x22')](function(){_0x37b93b['status'](0xcc)[_0x9f76('0x18')]();});}};}function handleEntityNotFound(_0x36c017,_0x234f1e){return function(_0x29c029){if(!_0x29c029){_0x36c017['sendStatus'](0x194);}return _0x29c029;};}function handleError(_0x2383a0,_0x165718){_0x165718=_0x165718||0x1f4;return function(_0x3ee146){logger[_0x9f76('0x24')](_0x3ee146['stack']);if(_0x3ee146[_0x9f76('0x25')]){delete _0x3ee146[_0x9f76('0x25')];}_0x2383a0[_0x9f76('0x17')](_0x165718)['send'](_0x3ee146);};}exports['index']=function(_0x38066f,_0x180b05){var _0x14ecdb={},_0x672a48={},_0x70dea4={'count':0x0,'rows':[]};var _0x4b5364=_['map'](db[_0x9f76('0x26')]['rawAttributes'],function(_0x4a21b9){return{'name':_0x4a21b9['fieldName'],'type':_0x4a21b9[_0x9f76('0x27')][_0x9f76('0x28')]};});_0x672a48[_0x9f76('0x29')]=_[_0x9f76('0x2a')](_0x4b5364,_0x9f76('0x25'));_0x672a48['query']=_['keys'](_0x38066f[_0x9f76('0x2b')]);_0x672a48['filters']=_[_0x9f76('0x2c')](_0x672a48[_0x9f76('0x29')],_0x672a48[_0x9f76('0x2b')]);_0x14ecdb[_0x9f76('0x2d')]=_[_0x9f76('0x2c')](_0x672a48['model'],qs['fields'](_0x38066f['query'][_0x9f76('0x2e')]));_0x14ecdb[_0x9f76('0x2d')]=_0x14ecdb['attributes'][_0x9f76('0x2f')]?_0x14ecdb[_0x9f76('0x2d')]:_0x672a48['model'];if(!_0x38066f[_0x9f76('0x2b')]['hasOwnProperty'](_0x9f76('0x30'))){_0x14ecdb[_0x9f76('0x1c')]=qs[_0x9f76('0x1c')](_0x38066f[_0x9f76('0x2b')][_0x9f76('0x1c')]);_0x14ecdb[_0x9f76('0x1a')]=qs[_0x9f76('0x1a')](_0x38066f[_0x9f76('0x2b')][_0x9f76('0x1a')]);}_0x14ecdb[_0x9f76('0x31')]=qs[_0x9f76('0x32')](_0x38066f[_0x9f76('0x2b')][_0x9f76('0x32')]);_0x14ecdb[_0x9f76('0x33')]=qs[_0x9f76('0x34')](_[_0x9f76('0x35')](_0x38066f['query'],_0x672a48[_0x9f76('0x34')]),_0x4b5364);if(_0x38066f[_0x9f76('0x2b')][_0x9f76('0x36')]){_0x14ecdb['where']=_[_0x9f76('0x37')](_0x14ecdb[_0x9f76('0x33')],{'$or':_[_0x9f76('0x2a')](_0x4b5364,function(_0x225331){if(_0x225331[_0x9f76('0x27')]!==_0x9f76('0x38')){var _0x9e61a0={};_0x9e61a0[_0x225331['name']]={'$like':'%'+_0x38066f[_0x9f76('0x2b')][_0x9f76('0x36')]+'%'};return _0x9e61a0;}})});}_0x14ecdb=_[_0x9f76('0x37')]({},_0x14ecdb,_0x38066f['options']);var _0x63213b={'where':_0x14ecdb[_0x9f76('0x33')]};return db[_0x9f76('0x26')]['count'](_0x63213b)[_0x9f76('0x22')](function(_0xfb23d8){_0x70dea4[_0x9f76('0x1d')]=_0xfb23d8;if(_0x38066f[_0x9f76('0x2b')]['includeAll']){_0x14ecdb[_0x9f76('0x39')]=[{'all':!![]}];}return db[_0x9f76('0x26')]['findAll'](_0x14ecdb);})[_0x9f76('0x22')](function(_0x35d7ad){_0x70dea4[_0x9f76('0x3a')]=_0x35d7ad;return _0x70dea4;})[_0x9f76('0x22')](respondWithFilteredResult(_0x180b05,_0x14ecdb))[_0x9f76('0x3b')](handleError(_0x180b05,null));};exports[_0x9f76('0x3c')]=function(_0x43ed35,_0x3434bc){var _0x5b415b={'raw':![],'where':{'id':_0x43ed35[_0x9f76('0x3d')]['id']}},_0x301c31={};_0x301c31[_0x9f76('0x29')]=_[_0x9f76('0x3e')](db['ServicenowAccount']['rawAttributes']);_0x301c31[_0x9f76('0x2b')]=_[_0x9f76('0x3e')](_0x43ed35[_0x9f76('0x2b')]);_0x301c31[_0x9f76('0x34')]=_[_0x9f76('0x2c')](_0x301c31[_0x9f76('0x29')],_0x301c31[_0x9f76('0x2b')]);_0x5b415b[_0x9f76('0x2d')]=_[_0x9f76('0x2c')](_0x301c31['model'],qs[_0x9f76('0x2e')](_0x43ed35[_0x9f76('0x2b')][_0x9f76('0x2e')]));_0x5b415b[_0x9f76('0x2d')]=_0x5b415b[_0x9f76('0x2d')][_0x9f76('0x2f')]?_0x5b415b[_0x9f76('0x2d')]:_0x301c31[_0x9f76('0x29')];if(_0x43ed35[_0x9f76('0x2b')]['includeAll']){_0x5b415b['include']=[{'all':!![]}];}_0x5b415b=_['merge']({},_0x5b415b,_0x43ed35[_0x9f76('0x3f')]);return db['ServicenowAccount'][_0x9f76('0x40')](_0x5b415b)[_0x9f76('0x22')](handleEntityNotFound(_0x3434bc,null))[_0x9f76('0x22')](respondWithResult(_0x3434bc,null))['catch'](handleError(_0x3434bc,null));};exports[_0x9f76('0x41')]=function(_0x1fd4e0,_0x24fb4c){return db['ServicenowAccount'][_0x9f76('0x41')](_0x1fd4e0[_0x9f76('0x42')],{})[_0x9f76('0x22')](respondWithResult(_0x24fb4c,0xc9))['catch'](handleError(_0x24fb4c,null));};exports[_0x9f76('0x43')]=function(_0x37d649,_0x218909){if(_0x37d649['body']['id']){delete _0x37d649[_0x9f76('0x42')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x37d649[_0x9f76('0x3d')]['id']}})[_0x9f76('0x22')](handleEntityNotFound(_0x218909,null))[_0x9f76('0x22')](saveUpdates(_0x37d649[_0x9f76('0x42')],null))[_0x9f76('0x22')](respondWithResult(_0x218909,null))[_0x9f76('0x3b')](handleError(_0x218909,null));};exports[_0x9f76('0x23')]=function(_0x283519,_0x2f1696){return db[_0x9f76('0x26')][_0x9f76('0x40')]({'where':{'id':_0x283519[_0x9f76('0x3d')]['id']}})[_0x9f76('0x22')](handleEntityNotFound(_0x2f1696,null))[_0x9f76('0x22')](removeEntity(_0x2f1696,null))[_0x9f76('0x3b')](handleError(_0x2f1696,null));};exports[_0x9f76('0x44')]=function(_0x3f9d23,_0xee9d20,_0x14f1dc){var _0x1a323d={};var _0x3e37a7={};var _0x52c7cf;var _0x262c5a;return db[_0x9f76('0x26')][_0x9f76('0x45')]({'where':{'id':_0x3f9d23[_0x9f76('0x3d')]['id']}})['then'](handleEntityNotFound(_0xee9d20,null))['then'](function(_0x309540){if(_0x309540){_0x52c7cf=_0x309540;_0x3e37a7['model']=_[_0x9f76('0x3e')](db[_0x9f76('0x46')][_0x9f76('0x47')]);_0x3e37a7[_0x9f76('0x2b')]=_['keys'](_0x3f9d23['query']);_0x3e37a7[_0x9f76('0x34')]=_[_0x9f76('0x2c')](_0x3e37a7[_0x9f76('0x29')],_0x3e37a7['query']);_0x1a323d[_0x9f76('0x2d')]=_['intersection'](_0x3e37a7[_0x9f76('0x29')],qs[_0x9f76('0x2e')](_0x3f9d23[_0x9f76('0x2b')]['fields']));_0x1a323d['attributes']=_0x1a323d['attributes'][_0x9f76('0x2f')]?_0x1a323d[_0x9f76('0x2d')]:_0x3e37a7[_0x9f76('0x29')];_0x1a323d[_0x9f76('0x31')]=qs[_0x9f76('0x32')](_0x3f9d23[_0x9f76('0x2b')][_0x9f76('0x32')]);_0x1a323d['where']=qs[_0x9f76('0x34')](_[_0x9f76('0x35')](_0x3f9d23['query'],_0x3e37a7['filters']));if(_0x3f9d23[_0x9f76('0x2b')][_0x9f76('0x36')]){_0x1a323d[_0x9f76('0x33')]=_[_0x9f76('0x37')](_0x1a323d[_0x9f76('0x33')],{'$or':_['map'](_0x1a323d[_0x9f76('0x2d')],function(_0x514cb8){var _0x1e8b6f={};_0x1e8b6f[_0x514cb8]={'$like':'%'+_0x3f9d23[_0x9f76('0x2b')][_0x9f76('0x36')]+'%'};return _0x1e8b6f;})});}_0x1a323d=_[_0x9f76('0x37')]({},_0x1a323d,_0x3f9d23['options']);return _0x52c7cf['getConfigurations'](_0x1a323d);}})[_0x9f76('0x22')](function(_0x44d07d){if(_0x44d07d){_0x262c5a=_0x44d07d['length'];if(!_0x3f9d23[_0x9f76('0x2b')][_0x9f76('0x48')](_0x9f76('0x30'))){_0x1a323d['limit']=qs['limit'](_0x3f9d23['query'][_0x9f76('0x1c')]);_0x1a323d[_0x9f76('0x1a')]=qs['offset'](_0x3f9d23[_0x9f76('0x2b')][_0x9f76('0x1a')]);}return _0x52c7cf[_0x9f76('0x44')](_0x1a323d);}})['then'](function(_0x3e9f23){if(_0x3e9f23){return _0x3e9f23?{'count':_0x262c5a,'rows':_0x3e9f23}:null;}})[_0x9f76('0x22')](respondWithResult(_0xee9d20,null))['catch'](handleError(_0xee9d20,null));};exports[_0x9f76('0x49')]=function(_0x1aa131,_0x3d17e5,_0x3e67ec){if(_0x1aa131['body']['id']){delete _0x1aa131[_0x9f76('0x42')]['id'];}return db[_0x9f76('0x26')][_0x9f76('0x45')]({'where':{'id':_0x1aa131['params']['id']}})['then'](handleEntityNotFound(_0x3d17e5,null))[_0x9f76('0x22')](function(_0x39ba08){if(_0x39ba08){_0x1aa131[_0x9f76('0x42')][_0x9f76('0x4a')]=_0x39ba08['id'];_0x1aa131[_0x9f76('0x42')][_0x9f76('0x4b')]=integrations['getSubjects'](_0x1aa131[_0x9f76('0x42')]['channel'],_0x1aa131[_0x9f76('0x42')][_0x9f76('0x27')]);_0x1aa131[_0x9f76('0x42')][_0x9f76('0x4c')]=integrations[_0x9f76('0x4d')](_0x1aa131['body'][_0x9f76('0x4e')],_0x1aa131['body']['type']);return db[_0x9f76('0x46')]['create'](_0x1aa131['body'],{'include':[{'model':db[_0x9f76('0x4f')],'as':_0x9f76('0x4b')},{'model':db[_0x9f76('0x4f')],'as':'Descriptions'}]});}return null;})[_0x9f76('0x22')](respondWithResult(_0x3d17e5,null))['catch'](handleError(_0x3d17e5,null));};exports[_0x9f76('0x50')]=function(_0x656e09,_0x51d4fe,_0x22dba1){var _0x2f6159=[_0x9f76('0x51'),_0x9f76('0x52'),'knowledge',_0x9f76('0x53'),_0x9f76('0x54'),_0x9f76('0x55'),_0x9f76('0x56'),'severity',_0x9f76('0x57')];var _0x1ab2c0=[_0x9f76('0x58'),'made_sla','caused_by','watch_list',_0x9f76('0x59'),_0x9f76('0x5a'),_0x9f76('0x5b'),_0x9f76('0x52'),'approval_history',_0x9f76('0x5c'),_0x9f76('0x5d'),_0x9f76('0x5e'),_0x9f76('0x5f'),'user_input',_0x9f76('0x60'),_0x9f76('0x61'),'state',_0x9f76('0x62'),_0x9f76('0x63'),_0x9f76('0x31'),_0x9f76('0x64'),_0x9f76('0x65'),_0x9f76('0x66'),'delivery_plan','impact','active',_0x9f76('0x67'),_0x9f76('0x68'),_0x9f76('0x69'),_0x9f76('0x6a'),_0x9f76('0x6b'),_0x9f76('0x6c'),_0x9f76('0x6d'),_0x9f76('0x6e'),_0x9f76('0x6f'),'group_list',_0x9f76('0x70'),'reopened_time','resolved_at',_0x9f76('0x71'),_0x9f76('0x72'),'subcategory',_0x9f76('0x73'),'short_description',_0x9f76('0x54'),_0x9f76('0x74'),_0x9f76('0x75'),_0x9f76('0x76'),_0x9f76('0x77'),'business_stc','additional_assignee_list','description',_0x9f76('0x78'),_0x9f76('0x55'),'sys_class_name',_0x9f76('0x79'),_0x9f76('0x7a'),_0x9f76('0x7b'),_0x9f76('0x7c'),_0x9f76('0x7d'),_0x9f76('0x7e'),_0x9f76('0x7f'),_0x9f76('0x56'),_0x9f76('0x80'),_0x9f76('0x81'),_0x9f76('0x82'),'reassignment_count','activity_due','assigned_to',_0x9f76('0x83'),_0x9f76('0x84'),_0x9f76('0x85'),_0x9f76('0x86'),'comments_and_work_notes',_0x9f76('0x87'),_0x9f76('0x88'),_0x9f76('0x89'),'sys_tags',_0x9f76('0x8a'),'upon_approval',_0x9f76('0x8b'),_0x9f76('0x8c'),_0x9f76('0x57')];var _0x91ac32='';var _0x4ade27='';var _0x29e2ee=[];var _0x15f637='';var _0x1d0ece='';var _0x5bd7ca=[];var _0x400f79='';var _0x15fc29='';var _0x31f39d={};var _0x14c662='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x656e09['params']['id']},'attributes':['id',_0x9f76('0x8d'),_0x9f76('0x8e'),_0x9f76('0x8f'),_0x9f76('0x90'),_0x9f76('0x91')]})['then'](handleEntityNotFound(_0x51d4fe,null))['then'](function(_0x39a3ec){if(_0x39a3ec){_0x14c662=_0x39a3ec[_0x9f76('0x90')];var _0x187024=_0x14c662[_0x9f76('0x92')](-0x1);if(_0x187024==='/'){_0x14c662=_0x14c662[_0x9f76('0x93')](0x0,_0x14c662['lastIndexOf'](_0x187024));}_0x15fc29=util['format'](_0x9f76('0x94'),_0x14c662);_0x400f79=util[_0x9f76('0x95')](_0x9f76('0x96'),_0x14c662);_0x31f39d={'user':_0x39a3ec[_0x9f76('0x8d')],'pass':_0x39a3ec[_0x9f76('0x8e')]};var _0x1a9055={'method':_0x9f76('0x97'),'uri':_0x15fc29+'incident?sysparm_display_value=all','auth':_0x31f39d,'json':!![]};return rp(_0x1a9055);}})[_0x9f76('0x22')](function(_0x229b48){if(_0x229b48['result'][_0x9f76('0x2f')]>0x0){_0x91ac32=_0x229b48[_0x9f76('0x98')];}console[_0x9f76('0x99')]('incident\x20table\x20objects',_0x91ac32);_0x5bd7ca=[];_0x4ade27=Object[_0x9f76('0x9a')]([],_0x91ac32);_['remove'](_0x4ade27,function(_0x11529e){return!_0x2f6159['includes'](_0x11529e[_0x9f76('0x25')]);});_0x4ade27[_0x9f76('0x9b')](function(_0x4df089){var _0x2f4f07=createFieldObject(_0x400f79,_0x31f39d,_0x4df089[_0x9f76('0x9c')],_0x4df089['name'],_0x4df089[_0x9f76('0x9d')],![]);_0x5bd7ca[_0x9f76('0x9e')](_0x2f4f07);});return Promise[_0x9f76('0x9f')](_0x5bd7ca);})[_0x9f76('0x22')](function(_0x46807b){_0x29e2ee=_0x46807b;_0x15f637=Object[_0x9f76('0x9a')]([],_0x91ac32);console[_0x9f76('0x99')](_0x9f76('0xa0'),_0x91ac32);_[_0x9f76('0xa1')](_0x15f637,function(_0x430c72){return _0x1ab2c0[_0x9f76('0xa2')](_0x430c72[_0x9f76('0x25')]);});console['log'](_0x9f76('0xa3'),_0x15f637);_0x5bd7ca=[];_0x15f637['forEach'](function(_0x10c299){var _0x107dae=createFieldObject(_0x400f79,_0x31f39d,_0x10c299['internalType'],_0x10c299['name'],_0x10c299['label'],!![]);_0x5bd7ca['push'](_0x107dae);});return Promise['all'](_0x5bd7ca);})[_0x9f76('0x22')](function(_0x10a11a){_0x1d0ece=_0x10a11a;var _0x42d789=_0x29e2ee[_0x9f76('0xa4')](_0x1d0ece);return{'count':_0x42d789[_0x9f76('0x2f')],'rows':_0x42d789};})[_0x9f76('0x22')](respondWithResult(_0x51d4fe,null))[_0x9f76('0x3b')](function(_0x22e60b){console['log'](_0x9f76('0xa5')+_0x22e60b);var _0x3d1c41=_0x656e09[_0x9f76('0x2b')]['test']?0x1f4:_0x22e60b[_0x9f76('0xa6')]||0x1f4;logger['error'](_0x22e60b[_0x9f76('0xa7')]);delete _0x22e60b[_0x9f76('0x25')];if(_0x3d1c41===0x191){_0x3d1c41=0x190;}_0x51d4fe['status'](_0x3d1c41)[_0x9f76('0xa8')](_0x656e09['query']['test']?{'message':_0x9f76('0xa9'),'statusCode':_0x22e60b[_0x9f76('0xa6')]}:_0x22e60b);});};function createFieldObject(_0x156a8b,_0x5d7ca4,_0x1564e0,_0x376793,_0x3811a5,_0x5eb257){return new Promise(function(_0x47b9b8,_0x3d0e6d){var _0x142cf8={'id':_0x376793,'name':_0x3811a5,'custom':_0x5eb257};if(_0x1564e0===_0x9f76('0xaa')){_0x142cf8[_0x9f76('0x3f')]=[{'name':_0x9f76('0xab'),'value':_0x9f76('0xac')},{'name':_0x9f76('0xad'),'value':_0x9f76('0xae')}];_0x47b9b8(_0x142cf8);}else{var _0x261ab0={'method':_0x9f76('0x97'),'uri':_0x156a8b+'sys_choice?sysparm_query=name=incident^element='+_0x376793,'auth':_0x5d7ca4,'json':!![]};return rp(_0x261ab0)[_0x9f76('0x22')](function(_0x2be416){var _0x2f6d16=[];if(_0x2be416[_0x9f76('0x98')][_0x9f76('0x2f')]>0x0){_0x2be416[_0x9f76('0x98')][_0x9f76('0x9b')](function(_0x15f3be){if(_0x15f3be['inactive']===_0x9f76('0xae')){var _0xe262f={'name':_0x15f3be[_0x9f76('0x9d')],'value':_0x15f3be['value']};_0x2f6d16[_0x9f76('0x9e')](_0xe262f);}});}_0x142cf8[_0x9f76('0x3f')]=_0x2f6d16;if(_0x142cf8['options'][_0x9f76('0x2f')]>0x0){_0x47b9b8(_0x142cf8);}else{if(_0x5eb257==![]){_0x47b9b8();}else{_0x47b9b8(_0x142cf8);}}});}});} \ No newline at end of file +var _0x639c=['rows','catch','show','rawAttributes','merge','find','create','body','params','findOne','pick','getConfigurations','getSubjects','channel','Descriptions','ServicenowConfiguration','Subjects','ServicenowField','getFields','made_sla','knowledge','notify','severity','category','parent','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','time_worked','group_list','reopened_time','resolved_at','approval_set','work_notes','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','calendar_duration','close_notes','closed_by','parent_incident','sys_id','incident_state','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','assign','includes','forEach','internalType','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','ServiceNow\x20error:\x20','statusCode','error','send','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','options','ServicenowAccount','includeAll','include','findAll'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x639c,0x70));var _0xc639=function(_0x137da3,_0xa6277a){_0x137da3=_0x137da3-0x0;var _0x1ac46c=_0x639c[_0x137da3];return _0x1ac46c;};'use strict';var emlformat=require(_0xc639('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc639('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc639('0x2'));var moment=require('moment');var BPromise=require(_0xc639('0x3'));var Mustache=require(_0xc639('0x4'));var util=require(_0xc639('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xc639('0x6'));var ejs=require(_0xc639('0x7'));var fs=require('fs');var fs_extra=require(_0xc639('0x8'));var _=require(_0xc639('0x9'));var squel=require(_0xc639('0xa'));var crypto=require('crypto');var jsforce=require(_0xc639('0xb'));var deskjs=require(_0xc639('0xc'));var toCsv=require(_0xc639('0x6'));var querystring=require('querystring');var Papa=require(_0xc639('0xd'));var Redis=require(_0xc639('0xe'));var authService=require(_0xc639('0xf'));var qs=require(_0xc639('0x10'));var as=require(_0xc639('0x11'));var hardwareService=require(_0xc639('0x12'));var logger=require(_0xc639('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xc639('0x14'));var licenseUtil=require(_0xc639('0x15'));var db=require(_0xc639('0x16'))['db'];var integrations=require(_0xc639('0x17'));function respondWithStatusCode(_0x16c73c,_0x2abc96){_0x2abc96=_0x2abc96||0xcc;return function(_0x2e7034){if(_0x2e7034){return _0x16c73c['sendStatus'](_0x2abc96);}return _0x16c73c[_0xc639('0x18')](_0x2abc96)[_0xc639('0x19')]();};}function respondWithResult(_0x1b9324,_0x2c67e3){_0x2c67e3=_0x2c67e3||0xc8;return function(_0x4701a2){if(_0x4701a2){return _0x1b9324[_0xc639('0x18')](_0x2c67e3)[_0xc639('0x1a')](_0x4701a2);}};}function respondWithFilteredResult(_0x27b921,_0x324edc){return function(_0x4250f2){if(_0x4250f2){var _0x297cec=typeof _0x324edc['offset']===_0xc639('0x1b')&&typeof _0x324edc[_0xc639('0x1c')]===_0xc639('0x1b');var _0x1b9ae5=_0x4250f2[_0xc639('0x1d')];var _0xf98643=_0x297cec?0x0:_0x324edc[_0xc639('0x1e')];var _0x150ef2=_0x297cec?_0x4250f2[_0xc639('0x1d')]:_0x324edc['offset']+_0x324edc[_0xc639('0x1c')];var _0x26e5af;if(_0x150ef2>=_0x1b9ae5){_0x150ef2=_0x1b9ae5;_0x26e5af=0xc8;}else{_0x26e5af=0xce;}_0x27b921[_0xc639('0x18')](_0x26e5af);return _0x27b921[_0xc639('0x1f')](_0xc639('0x20'),_0xf98643+'-'+_0x150ef2+'/'+_0x1b9ae5)[_0xc639('0x1a')](_0x4250f2);}return null;};}function patchUpdates(_0x36a3a9){return function(_0x4fc83e){try{jsonpatch[_0xc639('0x21')](_0x4fc83e,_0x36a3a9,!![]);}catch(_0x394dbc){return BPromise[_0xc639('0x22')](_0x394dbc);}return _0x4fc83e[_0xc639('0x23')]();};}function saveUpdates(_0xbb2f61,_0x2be665){return function(_0x3ed583){if(_0x3ed583){return _0x3ed583[_0xc639('0x24')](_0xbb2f61)[_0xc639('0x25')](function(_0x19728f){return _0x19728f;});}return null;};}function removeEntity(_0x10c560,_0x5b5bfc){return function(_0x20cd3f){if(_0x20cd3f){return _0x20cd3f[_0xc639('0x26')]()[_0xc639('0x25')](function(){_0x10c560[_0xc639('0x18')](0xcc)[_0xc639('0x19')]();});}};}function handleEntityNotFound(_0x8e3a80,_0xdf5e13){return function(_0x526008){if(!_0x526008){_0x8e3a80[_0xc639('0x27')](0x194);}return _0x526008;};}function handleError(_0x3c26f1,_0x3f2809){_0x3f2809=_0x3f2809||0x1f4;return function(_0x13f17f){logger['error'](_0x13f17f[_0xc639('0x28')]);if(_0x13f17f[_0xc639('0x29')]){delete _0x13f17f[_0xc639('0x29')];}_0x3c26f1[_0xc639('0x18')](_0x3f2809)['send'](_0x13f17f);};}exports[_0xc639('0x2a')]=function(_0x41fee3,_0x17c41d){var _0x438863={},_0x445349={},_0x37c7d3={'count':0x0,'rows':[]};var _0x313b11=_['map'](db['ServicenowAccount']['rawAttributes'],function(_0x18be54){return{'name':_0x18be54[_0xc639('0x2b')],'type':_0x18be54[_0xc639('0x2c')][_0xc639('0x2d')]};});_0x445349[_0xc639('0x2e')]=_[_0xc639('0x2f')](_0x313b11,_0xc639('0x29'));_0x445349['query']=_[_0xc639('0x30')](_0x41fee3[_0xc639('0x31')]);_0x445349[_0xc639('0x32')]=_[_0xc639('0x33')](_0x445349[_0xc639('0x2e')],_0x445349[_0xc639('0x31')]);_0x438863['attributes']=_[_0xc639('0x33')](_0x445349[_0xc639('0x2e')],qs[_0xc639('0x34')](_0x41fee3[_0xc639('0x31')][_0xc639('0x34')]));_0x438863[_0xc639('0x35')]=_0x438863[_0xc639('0x35')][_0xc639('0x36')]?_0x438863[_0xc639('0x35')]:_0x445349['model'];if(!_0x41fee3[_0xc639('0x31')][_0xc639('0x37')](_0xc639('0x38'))){_0x438863[_0xc639('0x1c')]=qs[_0xc639('0x1c')](_0x41fee3[_0xc639('0x31')][_0xc639('0x1c')]);_0x438863[_0xc639('0x1e')]=qs[_0xc639('0x1e')](_0x41fee3[_0xc639('0x31')][_0xc639('0x1e')]);}_0x438863[_0xc639('0x39')]=qs[_0xc639('0x3a')](_0x41fee3['query'][_0xc639('0x3a')]);_0x438863[_0xc639('0x3b')]=qs[_0xc639('0x32')](_['pick'](_0x41fee3[_0xc639('0x31')],_0x445349[_0xc639('0x32')]),_0x313b11);if(_0x41fee3[_0xc639('0x31')]['filter']){_0x438863[_0xc639('0x3b')]=_['merge'](_0x438863['where'],{'$or':_[_0xc639('0x2f')](_0x313b11,function(_0xb39722){if(_0xb39722[_0xc639('0x2c')]!=='VIRTUAL'){var _0x2aa83b={};_0x2aa83b[_0xb39722[_0xc639('0x29')]]={'$like':'%'+_0x41fee3[_0xc639('0x31')][_0xc639('0x3c')]+'%'};return _0x2aa83b;}})});}_0x438863=_['merge']({},_0x438863,_0x41fee3[_0xc639('0x3d')]);var _0x15e8c1={'where':_0x438863[_0xc639('0x3b')]};return db[_0xc639('0x3e')]['count'](_0x15e8c1)[_0xc639('0x25')](function(_0x452147){_0x37c7d3['count']=_0x452147;if(_0x41fee3['query'][_0xc639('0x3f')]){_0x438863[_0xc639('0x40')]=[{'all':!![]}];}return db[_0xc639('0x3e')][_0xc639('0x41')](_0x438863);})[_0xc639('0x25')](function(_0x4d5a48){_0x37c7d3[_0xc639('0x42')]=_0x4d5a48;return _0x37c7d3;})['then'](respondWithFilteredResult(_0x17c41d,_0x438863))[_0xc639('0x43')](handleError(_0x17c41d,null));};exports[_0xc639('0x44')]=function(_0x5bf130,_0x4a8d5d){var _0x2019a6={'raw':![],'where':{'id':_0x5bf130['params']['id']}},_0x40779e={};_0x40779e[_0xc639('0x2e')]=_['keys'](db[_0xc639('0x3e')][_0xc639('0x45')]);_0x40779e['query']=_[_0xc639('0x30')](_0x5bf130[_0xc639('0x31')]);_0x40779e['filters']=_['intersection'](_0x40779e[_0xc639('0x2e')],_0x40779e[_0xc639('0x31')]);_0x2019a6['attributes']=_[_0xc639('0x33')](_0x40779e['model'],qs['fields'](_0x5bf130['query'][_0xc639('0x34')]));_0x2019a6[_0xc639('0x35')]=_0x2019a6[_0xc639('0x35')][_0xc639('0x36')]?_0x2019a6['attributes']:_0x40779e[_0xc639('0x2e')];if(_0x5bf130['query'][_0xc639('0x3f')]){_0x2019a6[_0xc639('0x40')]=[{'all':!![]}];}_0x2019a6=_[_0xc639('0x46')]({},_0x2019a6,_0x5bf130[_0xc639('0x3d')]);return db[_0xc639('0x3e')][_0xc639('0x47')](_0x2019a6)[_0xc639('0x25')](handleEntityNotFound(_0x4a8d5d,null))[_0xc639('0x25')](respondWithResult(_0x4a8d5d,null))[_0xc639('0x43')](handleError(_0x4a8d5d,null));};exports[_0xc639('0x48')]=function(_0x29b3b6,_0x206b24){return db[_0xc639('0x3e')]['create'](_0x29b3b6[_0xc639('0x49')],{})[_0xc639('0x25')](respondWithResult(_0x206b24,0xc9))['catch'](handleError(_0x206b24,null));};exports['update']=function(_0x344a27,_0x486d01){if(_0x344a27[_0xc639('0x49')]['id']){delete _0x344a27[_0xc639('0x49')]['id'];}return db['ServicenowAccount'][_0xc639('0x47')]({'where':{'id':_0x344a27[_0xc639('0x4a')]['id']}})[_0xc639('0x25')](handleEntityNotFound(_0x486d01,null))[_0xc639('0x25')](saveUpdates(_0x344a27['body'],null))[_0xc639('0x25')](respondWithResult(_0x486d01,null))[_0xc639('0x43')](handleError(_0x486d01,null));};exports[_0xc639('0x26')]=function(_0x4fb223,_0x1fad4b){return db['ServicenowAccount'][_0xc639('0x47')]({'where':{'id':_0x4fb223[_0xc639('0x4a')]['id']}})[_0xc639('0x25')](handleEntityNotFound(_0x1fad4b,null))[_0xc639('0x25')](removeEntity(_0x1fad4b,null))[_0xc639('0x43')](handleError(_0x1fad4b,null));};exports['getConfigurations']=function(_0x3705da,_0x4d9b39,_0xfb51bf){var _0x1ea20d={};var _0x649e3d={};var _0x4aad20;var _0x1db503;return db[_0xc639('0x3e')][_0xc639('0x4b')]({'where':{'id':_0x3705da[_0xc639('0x4a')]['id']}})[_0xc639('0x25')](handleEntityNotFound(_0x4d9b39,null))[_0xc639('0x25')](function(_0x2a5afe){if(_0x2a5afe){_0x4aad20=_0x2a5afe;_0x649e3d['model']=_[_0xc639('0x30')](db['ServicenowConfiguration'][_0xc639('0x45')]);_0x649e3d[_0xc639('0x31')]=_['keys'](_0x3705da['query']);_0x649e3d[_0xc639('0x32')]=_[_0xc639('0x33')](_0x649e3d[_0xc639('0x2e')],_0x649e3d['query']);_0x1ea20d[_0xc639('0x35')]=_['intersection'](_0x649e3d[_0xc639('0x2e')],qs['fields'](_0x3705da[_0xc639('0x31')][_0xc639('0x34')]));_0x1ea20d['attributes']=_0x1ea20d['attributes'][_0xc639('0x36')]?_0x1ea20d['attributes']:_0x649e3d['model'];_0x1ea20d[_0xc639('0x39')]=qs['sort'](_0x3705da[_0xc639('0x31')][_0xc639('0x3a')]);_0x1ea20d[_0xc639('0x3b')]=qs[_0xc639('0x32')](_[_0xc639('0x4c')](_0x3705da['query'],_0x649e3d['filters']));if(_0x3705da[_0xc639('0x31')][_0xc639('0x3c')]){_0x1ea20d['where']=_[_0xc639('0x46')](_0x1ea20d['where'],{'$or':_[_0xc639('0x2f')](_0x1ea20d[_0xc639('0x35')],function(_0x3db0cf){var _0x22ca79={};_0x22ca79[_0x3db0cf]={'$like':'%'+_0x3705da[_0xc639('0x31')]['filter']+'%'};return _0x22ca79;})});}_0x1ea20d=_['merge']({},_0x1ea20d,_0x3705da[_0xc639('0x3d')]);return _0x4aad20[_0xc639('0x4d')](_0x1ea20d);}})['then'](function(_0x4ed430){if(_0x4ed430){_0x1db503=_0x4ed430[_0xc639('0x36')];if(!_0x3705da[_0xc639('0x31')]['hasOwnProperty'](_0xc639('0x38'))){_0x1ea20d[_0xc639('0x1c')]=qs[_0xc639('0x1c')](_0x3705da['query']['limit']);_0x1ea20d[_0xc639('0x1e')]=qs[_0xc639('0x1e')](_0x3705da[_0xc639('0x31')][_0xc639('0x1e')]);}return _0x4aad20[_0xc639('0x4d')](_0x1ea20d);}})[_0xc639('0x25')](function(_0x3c4101){if(_0x3c4101){return _0x3c4101?{'count':_0x1db503,'rows':_0x3c4101}:null;}})[_0xc639('0x25')](respondWithResult(_0x4d9b39,null))[_0xc639('0x43')](handleError(_0x4d9b39,null));};exports['addConfiguration']=function(_0xe48b62,_0x1f2566,_0x7e2a9d){if(_0xe48b62['body']['id']){delete _0xe48b62[_0xc639('0x49')]['id'];}return db[_0xc639('0x3e')]['findOne']({'where':{'id':_0xe48b62[_0xc639('0x4a')]['id']}})[_0xc639('0x25')](handleEntityNotFound(_0x1f2566,null))[_0xc639('0x25')](function(_0xa8634a){if(_0xa8634a){_0xe48b62[_0xc639('0x49')]['AccountId']=_0xa8634a['id'];_0xe48b62[_0xc639('0x49')]['Subjects']=integrations[_0xc639('0x4e')](_0xe48b62[_0xc639('0x49')][_0xc639('0x4f')],_0xe48b62[_0xc639('0x49')][_0xc639('0x2c')]);_0xe48b62['body'][_0xc639('0x50')]=integrations['getDescriptions'](_0xe48b62[_0xc639('0x49')]['channel'],_0xe48b62[_0xc639('0x49')][_0xc639('0x2c')]);return db[_0xc639('0x51')][_0xc639('0x48')](_0xe48b62['body'],{'include':[{'model':db['ServicenowField'],'as':_0xc639('0x52')},{'model':db[_0xc639('0x53')],'as':_0xc639('0x50')}]});}return null;})['then'](respondWithResult(_0x1f2566,null))['catch'](handleError(_0x1f2566,null));};exports[_0xc639('0x54')]=function(_0x4a322a,_0xf28f33,_0x3afbe2){var _0xf90693=[_0xc639('0x55'),'hold_reason',_0xc639('0x56'),'subcategory','close_code',_0xc639('0x57'),'incident_state',_0xc639('0x58'),_0xc639('0x59')];var _0x56364d=[_0xc639('0x5a'),_0xc639('0x55'),'caused_by',_0xc639('0x5b'),_0xc639('0x5c'),_0xc639('0x5d'),_0xc639('0x5e'),_0xc639('0x5f'),_0xc639('0x60'),_0xc639('0x61'),_0xc639('0x62'),_0xc639('0x63'),_0xc639('0x64'),'user_input',_0xc639('0x65'),_0xc639('0x66'),_0xc639('0x67'),_0xc639('0x68'),'knowledge',_0xc639('0x39'),_0xc639('0x69'),_0xc639('0x6a'),_0xc639('0x6b'),_0xc639('0x6c'),_0xc639('0x6d'),'active',_0xc639('0x6e'),_0xc639('0x6f'),_0xc639('0x70'),'sys_domain_path','rfc',_0xc639('0x71'),'expected_start','opened_at','business_duration',_0xc639('0x72'),'work_end',_0xc639('0x73'),_0xc639('0x74'),'caller_id',_0xc639('0x75'),'subcategory',_0xc639('0x76'),_0xc639('0x77'),_0xc639('0x78'),_0xc639('0x79'),_0xc639('0x7a'),_0xc639('0x7b'),_0xc639('0x7c'),'business_stc',_0xc639('0x7d'),'description',_0xc639('0x7e'),_0xc639('0x57'),'sys_class_name',_0xc639('0x7f'),_0xc639('0x80'),'follow_up',_0xc639('0x81'),_0xc639('0x82'),'contact_type','reopened_by',_0xc639('0x83'),'urgency',_0xc639('0x84'),_0xc639('0x85'),_0xc639('0x86'),_0xc639('0x87'),_0xc639('0x88'),_0xc639('0x58'),'comments',_0xc639('0x89'),_0xc639('0x8a'),_0xc639('0x8b'),_0xc639('0x8c'),_0xc639('0x8d'),'reopen_count','sys_tags',_0xc639('0x8e'),_0xc639('0x8f'),_0xc639('0x90'),_0xc639('0x91'),_0xc639('0x59')];var _0x2f21a8='';var _0x1fd7e1='';var _0x344437=[];var _0x45545d='';var _0x4c58f3='';var _0x1a09ba=[];var _0xea10bc='';var _0x4013ee='';var _0x3083b7={};var _0xbede10='';return db[_0xc639('0x3e')][_0xc639('0x4b')]({'where':{'id':_0x4a322a['params']['id']},'attributes':['id',_0xc639('0x92'),_0xc639('0x93'),_0xc639('0x94'),_0xc639('0x95'),_0xc639('0x96')]})[_0xc639('0x25')](handleEntityNotFound(_0xf28f33,null))[_0xc639('0x25')](function(_0x1215cd){if(_0x1215cd){_0xbede10=_0x1215cd['remoteUri'];var _0x1b30fa=_0xbede10[_0xc639('0x97')](-0x1);if(_0x1b30fa==='/'){_0xbede10=_0xbede10[_0xc639('0x98')](0x0,_0xbede10['lastIndexOf'](_0x1b30fa));}_0x4013ee=util['format']('%s/api/now/doc/table/schema/',_0xbede10);_0xea10bc=util['format'](_0xc639('0x99'),_0xbede10);_0x3083b7={'user':_0x1215cd[_0xc639('0x92')],'pass':_0x1215cd[_0xc639('0x93')]};var _0x218d40={'method':_0xc639('0x9a'),'uri':_0x4013ee+_0xc639('0x9b'),'auth':_0x3083b7,'json':!![]};return rp(_0x218d40);}})[_0xc639('0x25')](function(_0x100c0b){if(_0x100c0b[_0xc639('0x9c')][_0xc639('0x36')]>0x0){_0x2f21a8=_0x100c0b[_0xc639('0x9c')];}console[_0xc639('0x9d')]('incident\x20table\x20objects',_0x2f21a8);_0x1a09ba=[];_0x1fd7e1=Object[_0xc639('0x9e')]([],_0x2f21a8);_['remove'](_0x1fd7e1,function(_0x5449d1){return!_0xf90693[_0xc639('0x9f')](_0x5449d1[_0xc639('0x29')]);});_0x1fd7e1[_0xc639('0xa0')](function(_0x50b1f5){var _0x3f731f=createFieldObject(_0xea10bc,_0x3083b7,_0x50b1f5[_0xc639('0xa1')],_0x50b1f5[_0xc639('0x29')],_0x50b1f5['label'],![]);_0x1a09ba[_0xc639('0xa2')](_0x3f731f);});return Promise[_0xc639('0xa3')](_0x1a09ba);})[_0xc639('0x25')](function(_0x6fcad5){_0x344437=_0x6fcad5;_0x45545d=Object['assign']([],_0x2f21a8);console[_0xc639('0x9d')]('TCL:\x20_object',_0x2f21a8);_['remove'](_0x45545d,function(_0x5acd2b){return _0x56364d[_0xc639('0x9f')](_0x5acd2b[_0xc639('0x29')]);});console[_0xc639('0x9d')](_0xc639('0xa4'),_0x45545d);_0x1a09ba=[];_0x45545d['forEach'](function(_0x45a815){var _0x5dbbf9=createFieldObject(_0xea10bc,_0x3083b7,_0x45a815[_0xc639('0xa1')],_0x45a815['name'],_0x45a815[_0xc639('0xa5')],!![]);_0x1a09ba['push'](_0x5dbbf9);});return Promise['all'](_0x1a09ba);})[_0xc639('0x25')](function(_0x55b772){_0x4c58f3=_0x55b772;var _0x3050d3=_0x344437['concat'](_0x4c58f3);return{'count':_0x3050d3[_0xc639('0x36')],'rows':_0x3050d3};})[_0xc639('0x25')](respondWithResult(_0xf28f33,null))['catch'](function(_0x59458b){console['log'](_0xc639('0xa6')+_0x59458b);var _0x222842=_0x4a322a[_0xc639('0x31')]['test']?0x1f4:_0x59458b[_0xc639('0xa7')]||0x1f4;logger[_0xc639('0xa8')](_0x59458b[_0xc639('0x28')]);delete _0x59458b[_0xc639('0x29')];if(_0x222842===0x191){_0x222842=0x190;}_0xf28f33[_0xc639('0x18')](_0x222842)[_0xc639('0xa9')](_0x4a322a[_0xc639('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x59458b['statusCode']}:_0x59458b);});};function createFieldObject(_0x4668f3,_0x31d416,_0x242f2d,_0x391df7,_0x4222e9,_0x1ac142){return new Promise(function(_0x1f01e7,_0xc7140b){var _0x102384={'id':_0x391df7,'name':_0x4222e9,'custom':_0x1ac142};if(_0x242f2d===_0xc639('0xaa')){_0x102384[_0xc639('0x3d')]=[{'name':_0xc639('0xab'),'value':_0xc639('0xac')},{'name':_0xc639('0xad'),'value':_0xc639('0xae')}];_0x1f01e7(_0x102384);}else{var _0x5de767={'method':_0xc639('0x9a'),'uri':_0x4668f3+_0xc639('0xaf')+_0x391df7,'auth':_0x31d416,'json':!![]};return rp(_0x5de767)['then'](function(_0x568473){var _0x1bcb9b=[];if(_0x568473[_0xc639('0x9c')][_0xc639('0x36')]>0x0){_0x568473[_0xc639('0x9c')][_0xc639('0xa0')](function(_0x568ad2){if(_0x568ad2[_0xc639('0xb0')]==='false'){var _0x2438c5={'name':_0x568ad2[_0xc639('0xa5')],'value':_0x568ad2[_0xc639('0xb1')]};_0x1bcb9b[_0xc639('0xa2')](_0x2438c5);}});}_0x102384[_0xc639('0x3d')]=_0x1bcb9b;if(_0x102384[_0xc639('0x3d')][_0xc639('0x36')]>0x0){_0x1f01e7(_0x102384);}else{if(_0x1ac142==![]){_0x1f01e7();}else{_0x1f01e7(_0x102384);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 4aaff87..d36052a 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c5a=['int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x3a9926,_0x30a862){var _0x2dceca=function(_0x501f22){while(--_0x501f22){_0x3a9926['push'](_0x3a9926['shift']());}};_0x2dceca(++_0x30a862);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x38ba51,_0x314221){_0x38ba51=_0x38ba51-0x0;var _0x3372cb=_0x9c5a[_0x38ba51];return _0x3372cb;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xa9c5('0x8'));module['exports']=function(_0x394d84,_0x3df556){return _0x394d84['define']('ServicenowAccount',attributes,{'tableName':_0xa9c5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fb=['../../components/integrations/configuration','define','int_servicenow_accounts','lodash','util','../../config/logger','api','path','rimraf','./intServicenowAccount.attributes'];(function(_0xf32e32,_0xb683ed){var _0x301682=function(_0x520d13){while(--_0x520d13){_0xf32e32['push'](_0xf32e32['shift']());}};_0x301682(++_0xb683ed);}(_0xd8fb,0x99));var _0xbd8f=function(_0x426a54,_0x45eda9){_0x426a54=_0x426a54-0x0;var _0x51c7e9=_0xd8fb[_0x426a54];return _0x51c7e9;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));var integrations=require(_0xbd8f('0x7'));module['exports']=function(_0x33d541,_0x4e97cf){return _0x33d541[_0xbd8f('0x8')]('ServicenowAccount',attributes,{'tableName':_0xbd8f('0x9'),'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 19b8568..845d5e6 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 _0x1158=['result','catch','GetServicenowAccount','ServicenowAccount','findAll','raw','options','where','attributes','include','model','map','ShowServicenowAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','request\x20sent','debug','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1158,0x1dc));var _0x8115=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x1158[_0x2aec52];return _0x3b8835;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8115('0x0'));var BPromise=require(_0x8115('0x1'));var rs=require(_0x8115('0x2'));var fs=require('fs');var Redis=require(_0x8115('0x3'));var db=require(_0x8115('0x4'))['db'];var utils=require(_0x8115('0x5'));var logger=require('../../config/logger')(_0x8115('0x6'));var config=require(_0x8115('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8115('0x8')][_0x8115('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a890b,_0x13d136,_0x491f53){return new BPromise(function(_0x2ee0c7,_0xace7f1){return client['request'](_0x4a890b,_0x491f53)[_0x8115('0xa')](function(_0x2c9930){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x13d136,_0x8115('0xb'));logger[_0x8115('0xc')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x13d136,'request\x20sent',JSON[_0x8115('0xd')](_0x2c9930));if(_0x2c9930[_0x8115('0xe')]){if(_0x2c9930[_0x8115('0xe')][_0x8115('0xf')]===0x1f4){logger[_0x8115('0xe')](_0x8115('0x10'),_0x13d136,_0x2c9930[_0x8115('0xe')][_0x8115('0x11')]);return _0xace7f1(_0x2c9930[_0x8115('0xe')]['message']);}logger[_0x8115('0xe')](_0x8115('0x10'),_0x13d136,_0x2c9930[_0x8115('0xe')][_0x8115('0x11')]);return _0x2ee0c7(_0x2c9930['error'][_0x8115('0x11')]);}else{logger[_0x8115('0x12')](_0x8115('0x10'),_0x13d136,_0x8115('0xb'));_0x2ee0c7(_0x2c9930[_0x8115('0x13')][_0x8115('0x11')]);}})[_0x8115('0x14')](function(_0x2bf060){logger[_0x8115('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x13d136,_0x2bf060);_0xace7f1(_0x2bf060);});});}exports[_0x8115('0x15')]=function(_0xd1ad63){var _0x3fa4cb=this;return new Promise(function(_0x51a8d2,_0x58fecb){return db[_0x8115('0x16')][_0x8115('0x17')]({'raw':_0xd1ad63['options']?_0xd1ad63['options'][_0x8115('0x18')]===undefined?!![]:![]:!![],'where':_0xd1ad63[_0x8115('0x19')]?_0xd1ad63['options'][_0x8115('0x1a')]||null:null,'attributes':_0xd1ad63['options']?_0xd1ad63[_0x8115('0x19')][_0x8115('0x1b')]||null:null,'limit':_0xd1ad63['options']?_0xd1ad63[_0x8115('0x19')]['limit']||null:null,'include':_0xd1ad63['options']?_0xd1ad63[_0x8115('0x19')][_0x8115('0x1c')]?_['map'](_0xd1ad63['options']['include'],function(_0x472045){return{'model':db[_0x472045[_0x8115('0x1d')]],'as':_0x472045['as'],'attributes':_0x472045[_0x8115('0x1b')],'include':_0x472045[_0x8115('0x1c')]?_[_0x8115('0x1e')](_0x472045[_0x8115('0x1c')],function(_0x2720af){return{'model':db[_0x2720af[_0x8115('0x1d')]],'as':_0x2720af['as'],'attributes':_0x2720af[_0x8115('0x1b')],'include':_0x2720af['include']?_[_0x8115('0x1e')](_0x2720af[_0x8115('0x1c')],function(_0x41a530){return{'model':db[_0x41a530[_0x8115('0x1d')]],'as':_0x41a530['as'],'attributes':_0x41a530[_0x8115('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8115('0xa')](function(_0x11be93){logger[_0x8115('0x12')](_0x8115('0x15'),_0xd1ad63);logger[_0x8115('0xc')](_0x8115('0x15'),_0xd1ad63,JSON[_0x8115('0xd')](_0x11be93));_0x51a8d2(_0x11be93);})['catch'](function(_0x3ec4ea){logger[_0x8115('0xe')](_0x8115('0x15'),_0x3ec4ea[_0x8115('0x11')],_0xd1ad63);_0x58fecb(_0x3fa4cb['error'](0x1f4,_0x3ec4ea[_0x8115('0x11')]));});});};exports[_0x8115('0x1f')]=function(_0x262b81){var _0xedde95=this;return new Promise(function(_0x2a83d6,_0x553d22){return db[_0x8115('0x16')][_0x8115('0x20')]({'raw':_0x262b81['options']?_0x262b81['options'][_0x8115('0x18')]===undefined?!![]:![]:!![],'where':_0x262b81[_0x8115('0x19')]?_0x262b81[_0x8115('0x19')][_0x8115('0x1a')]||null:null,'attributes':_0x262b81[_0x8115('0x19')]?_0x262b81[_0x8115('0x19')][_0x8115('0x1b')]||null:null,'include':_0x262b81[_0x8115('0x19')]?_0x262b81[_0x8115('0x19')][_0x8115('0x1c')]?_[_0x8115('0x1e')](_0x262b81[_0x8115('0x19')][_0x8115('0x1c')],function(_0x4f880d){return{'model':db[_0x4f880d[_0x8115('0x1d')]],'as':_0x4f880d['as'],'attributes':_0x4f880d['attributes'],'include':_0x4f880d[_0x8115('0x1c')]?_['map'](_0x4f880d['include'],function(_0x374732){return{'model':db[_0x374732['model']],'as':_0x374732['as'],'attributes':_0x374732[_0x8115('0x1b')],'include':_0x374732[_0x8115('0x1c')]?_[_0x8115('0x1e')](_0x374732[_0x8115('0x1c')],function(_0xf2e682){return{'model':db[_0xf2e682[_0x8115('0x1d')]],'as':_0xf2e682['as'],'attributes':_0xf2e682[_0x8115('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8115('0xa')](function(_0x808033){logger[_0x8115('0x12')](_0x8115('0x1f'),_0x262b81);logger[_0x8115('0xc')](_0x8115('0x1f'),_0x262b81,JSON[_0x8115('0xd')](_0x808033));_0x2a83d6(_0x808033);})[_0x8115('0x14')](function(_0x4d8319){logger[_0x8115('0xe')](_0x8115('0x1f'),_0x4d8319[_0x8115('0x11')],_0x262b81);_0x553d22(_0xedde95['error'](0x1f4,_0x4d8319['message']));});});}; \ No newline at end of file +var _0x8695=['catch','ShowServicenowAccount','find','where','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','limit','include','map','model','attributes','stringify'];(function(_0x54435b,_0x5f2492){var _0x38c044=function(_0x456002){while(--_0x456002){_0x54435b['push'](_0x54435b['shift']());}};_0x38c044(++_0x5f2492);}(_0x8695,0x1cc));var _0x5869=function(_0x55e659,_0x233aa4){_0x55e659=_0x55e659-0x0;var _0xca08c7=_0x8695[_0x55e659];return _0xca08c7;};'use strict';var _=require(_0x5869('0x0'));var util=require(_0x5869('0x1'));var moment=require('moment');var BPromise=require(_0x5869('0x2'));var rs=require(_0x5869('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5869('0x4'))['db'];var utils=require(_0x5869('0x5'));var logger=require(_0x5869('0x6'))('rpc');var config=require(_0x5869('0x7'));var jayson=require(_0x5869('0x8'));var client=jayson['client'][_0x5869('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ca13b,_0x419c40,_0x35668b){return new BPromise(function(_0xbf47d8,_0xe81fcb){return client[_0x5869('0xa')](_0x5ca13b,_0x35668b)['then'](function(_0x133e23){logger[_0x5869('0xb')](_0x5869('0xc'),_0x419c40,_0x5869('0xd'));logger[_0x5869('0xe')](_0x5869('0xf'),_0x419c40,_0x5869('0xd'),JSON['stringify'](_0x133e23));if(_0x133e23['error']){if(_0x133e23[_0x5869('0x10')]['code']===0x1f4){logger[_0x5869('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x419c40,_0x133e23['error']['message']);return _0xe81fcb(_0x133e23[_0x5869('0x10')][_0x5869('0x11')]);}logger[_0x5869('0x10')](_0x5869('0xc'),_0x419c40,_0x133e23[_0x5869('0x10')][_0x5869('0x11')]);return _0xbf47d8(_0x133e23['error'][_0x5869('0x11')]);}else{logger['info'](_0x5869('0xc'),_0x419c40,_0x5869('0xd'));_0xbf47d8(_0x133e23[_0x5869('0x12')][_0x5869('0x11')]);}})['catch'](function(_0x107577){logger['error'](_0x5869('0xc'),_0x419c40,_0x107577);_0xe81fcb(_0x107577);});});}exports[_0x5869('0x13')]=function(_0x580fb8){var _0x19b48f=this;return new Promise(function(_0x521696,_0x57b756){return db[_0x5869('0x14')][_0x5869('0x15')]({'raw':_0x580fb8[_0x5869('0x16')]?_0x580fb8[_0x5869('0x16')][_0x5869('0x17')]===undefined?!![]:![]:!![],'where':_0x580fb8[_0x5869('0x16')]?_0x580fb8[_0x5869('0x16')]['where']||null:null,'attributes':_0x580fb8['options']?_0x580fb8[_0x5869('0x16')]['attributes']||null:null,'limit':_0x580fb8['options']?_0x580fb8[_0x5869('0x16')][_0x5869('0x18')]||null:null,'include':_0x580fb8[_0x5869('0x16')]?_0x580fb8[_0x5869('0x16')][_0x5869('0x19')]?_[_0x5869('0x1a')](_0x580fb8['options']['include'],function(_0xc6d51c){return{'model':db[_0xc6d51c[_0x5869('0x1b')]],'as':_0xc6d51c['as'],'attributes':_0xc6d51c[_0x5869('0x1c')],'include':_0xc6d51c[_0x5869('0x19')]?_[_0x5869('0x1a')](_0xc6d51c[_0x5869('0x19')],function(_0x2a942c){return{'model':db[_0x2a942c[_0x5869('0x1b')]],'as':_0x2a942c['as'],'attributes':_0x2a942c['attributes'],'include':_0x2a942c[_0x5869('0x19')]?_['map'](_0x2a942c[_0x5869('0x19')],function(_0x41d5e7){return{'model':db[_0x41d5e7[_0x5869('0x1b')]],'as':_0x41d5e7['as'],'attributes':_0x41d5e7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x21d64a){logger[_0x5869('0xb')](_0x5869('0x13'),_0x580fb8);logger['debug'](_0x5869('0x13'),_0x580fb8,JSON[_0x5869('0x1d')](_0x21d64a));_0x521696(_0x21d64a);})[_0x5869('0x1e')](function(_0x3b4c9f){logger['error']('GetServicenowAccount',_0x3b4c9f[_0x5869('0x11')],_0x580fb8);_0x57b756(_0x19b48f[_0x5869('0x10')](0x1f4,_0x3b4c9f[_0x5869('0x11')]));});});};exports[_0x5869('0x1f')]=function(_0xd4373c){var _0x148f8b=this;return new Promise(function(_0x5a2780,_0x3619be){return db['ServicenowAccount'][_0x5869('0x20')]({'raw':_0xd4373c[_0x5869('0x16')]?_0xd4373c['options'][_0x5869('0x17')]===undefined?!![]:![]:!![],'where':_0xd4373c['options']?_0xd4373c[_0x5869('0x16')][_0x5869('0x21')]||null:null,'attributes':_0xd4373c[_0x5869('0x16')]?_0xd4373c['options'][_0x5869('0x1c')]||null:null,'include':_0xd4373c[_0x5869('0x16')]?_0xd4373c['options'][_0x5869('0x19')]?_[_0x5869('0x1a')](_0xd4373c[_0x5869('0x16')][_0x5869('0x19')],function(_0xf26e3a){return{'model':db[_0xf26e3a['model']],'as':_0xf26e3a['as'],'attributes':_0xf26e3a[_0x5869('0x1c')],'include':_0xf26e3a[_0x5869('0x19')]?_[_0x5869('0x1a')](_0xf26e3a[_0x5869('0x19')],function(_0x14e422){return{'model':db[_0x14e422[_0x5869('0x1b')]],'as':_0x14e422['as'],'attributes':_0x14e422[_0x5869('0x1c')],'include':_0x14e422[_0x5869('0x19')]?_['map'](_0x14e422[_0x5869('0x19')],function(_0x1f7de1){return{'model':db[_0x1f7de1[_0x5869('0x1b')]],'as':_0x1f7de1['as'],'attributes':_0x1f7de1['attributes']};}):[]};}):[]};}):[]:[]})[_0x5869('0x22')](function(_0x3f6c1a){logger['info'](_0x5869('0x1f'),_0xd4373c);logger[_0x5869('0xe')](_0x5869('0x1f'),_0xd4373c,JSON['stringify'](_0x3f6c1a));_0x5a2780(_0x3f6c1a);})[_0x5869('0x1e')](function(_0x5a73a7){logger[_0x5869('0x10')]('ShowServicenowAccount',_0x5a73a7['message'],_0xd4373c);_0x3619be(_0x148f8b[_0x5869('0x10')](0x1f4,_0x5a73a7[_0x5869('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 4057aa5..31e09e5 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 _0x5eaa=['getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','/:id','/:id/fields','isAuthenticated','getFields','/:id/subjects'];(function(_0x1280a1,_0x5967cd){var _0x240d6f=function(_0x480ee9){while(--_0x480ee9){_0x1280a1['push'](_0x1280a1['shift']());}};_0x240d6f(++_0x5967cd);}(_0x5eaa,0x14b));var _0xa5ea=function(_0x125378,_0x243ad2){_0x125378=_0x125378-0x0;var _0x243ebc=_0x5eaa[_0x125378];return _0x243ebc;};'use strict';var multer=require(_0xa5ea('0x0'));var util=require('util');var path=require(_0xa5ea('0x1'));var timeout=require(_0xa5ea('0x2'));var express=require(_0xa5ea('0x3'));var router=express['Router']();var fs_extra=require(_0xa5ea('0x4'));var auth=require(_0xa5ea('0x5'));var interaction=require(_0xa5ea('0x6'));var config=require('../../config/environment');var controller=require(_0xa5ea('0x7'));router[_0xa5ea('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa5ea('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xa5ea('0x8')](_0xa5ea('0xa'),auth[_0xa5ea('0xb')](),controller[_0xa5ea('0xc')]);router[_0xa5ea('0x8')](_0xa5ea('0xd'),auth[_0xa5ea('0xb')](),controller[_0xa5ea('0xe')]);router['get'](_0xa5ea('0xf'),auth['isAuthenticated'](),controller[_0xa5ea('0x10')]);router['post']('/',auth[_0xa5ea('0xb')](),controller[_0xa5ea('0x11')]);router[_0xa5ea('0x12')]('/:id',auth[_0xa5ea('0xb')](),controller[_0xa5ea('0x13')]);router[_0xa5ea('0x14')]('/:id',auth[_0xa5ea('0xb')](),controller[_0xa5ea('0x15')]);module[_0xa5ea('0x16')]=router; \ No newline at end of file +var _0x3c25=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update'];(function(_0xffd8b0,_0x12c51f){var _0x301ba0=function(_0x103c05){while(--_0x103c05){_0xffd8b0['push'](_0xffd8b0['shift']());}};_0x301ba0(++_0x12c51f);}(_0x3c25,0x19a));var _0x53c2=function(_0x2251cf,_0xb30177){_0x2251cf=_0x2251cf-0x0;var _0x4f99ee=_0x3c25[_0x2251cf];return _0x4f99ee;};'use strict';var multer=require(_0x53c2('0x0'));var util=require(_0x53c2('0x1'));var path=require(_0x53c2('0x2'));var timeout=require(_0x53c2('0x3'));var express=require(_0x53c2('0x4'));var router=express[_0x53c2('0x5')]();var fs_extra=require(_0x53c2('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x53c2('0x7'));var controller=require(_0x53c2('0x8'));router[_0x53c2('0x9')]('/',auth['isAuthenticated'](),controller[_0x53c2('0xa')]);router[_0x53c2('0x9')](_0x53c2('0xb'),auth[_0x53c2('0xc')](),controller[_0x53c2('0xd')]);router[_0x53c2('0x9')]('/:id/fields',auth[_0x53c2('0xc')](),controller[_0x53c2('0xe')]);router[_0x53c2('0x9')](_0x53c2('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x53c2('0x9')](_0x53c2('0x10'),auth[_0x53c2('0xc')](),controller[_0x53c2('0x11')]);router[_0x53c2('0x12')]('/',auth[_0x53c2('0xc')](),controller[_0x53c2('0x13')]);router[_0x53c2('0x14')]('/:id',auth[_0x53c2('0xc')](),controller[_0x53c2('0x15')]);router[_0x53c2('0x16')](_0x53c2('0xb'),auth[_0x53c2('0xc')](),controller[_0x53c2('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 3cca45b..bd20beb 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 _0xe052=['STRING','sequelize'];(function(_0x515c95,_0x18930f){var _0x55ad4b=function(_0x2c706c){while(--_0x2c706c){_0x515c95['push'](_0x515c95['shift']());}};_0x55ad4b(++_0x18930f);}(_0xe052,0xcb));var _0x2e05=function(_0x4a6bd8,_0x3fd9ce){_0x4a6bd8=_0x4a6bd8-0x0;var _0x55d8d9=_0xe052[_0x4a6bd8];return _0x55d8d9;};'use strict';var Sequelize=require(_0x2e05('0x0'));module['exports']={'name':{'type':Sequelize[_0x2e05('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf25d=['STRING'];(function(_0x1c63a9,_0x49726c){var _0x4a3b03=function(_0x1eda26){while(--_0x1eda26){_0x1c63a9['push'](_0x1c63a9['shift']());}};_0x4a3b03(++_0x49726c);}(_0xf25d,0x11b));var _0xdf25=function(_0x25dbcb,_0x40eb18){_0x25dbcb=_0x25dbcb-0x0;var _0x329d76=_0xf25d[_0x25dbcb];return _0x329d76;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdf25('0x0')]},'description':{'type':Sequelize[_0xdf25('0x0')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index ca2147c..42a7de4 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 _0x2058=['findAll','rows','params','keys','include','options','find','catch','create','body','getFields','findOne','length','nolimit','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','then','destroy','stack','name','index','map','ServicenowConfiguration','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll'];(function(_0x468938,_0x550e5c){var _0x727af0=function(_0x65b60d){while(--_0x65b60d){_0x468938['push'](_0x468938['shift']());}};_0x727af0(++_0x550e5c);}(_0x2058,0xab));var _0x8205=function(_0x1d0aee,_0x2c4454){_0x1d0aee=_0x1d0aee-0x0;var _0x34ee2c=_0x2058[_0x1d0aee];return _0x34ee2c;};'use strict';var emlformat=require(_0x8205('0x0'));var rimraf=require(_0x8205('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8205('0x2'));var rp=require(_0x8205('0x3'));var moment=require(_0x8205('0x4'));var BPromise=require(_0x8205('0x5'));var Mustache=require(_0x8205('0x6'));var util=require('util');var path=require(_0x8205('0x7'));var sox=require(_0x8205('0x8'));var csv=require(_0x8205('0x9'));var ejs=require(_0x8205('0xa'));var fs=require('fs');var fs_extra=require(_0x8205('0xb'));var _=require('lodash');var squel=require(_0x8205('0xc'));var crypto=require(_0x8205('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8205('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8205('0xf'));var authService=require(_0x8205('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8205('0x11'));var hardwareService=require(_0x8205('0x12'));var logger=require('../../config/logger')(_0x8205('0x13'));var utils=require('../../config/utils');var config=require(_0x8205('0x14'));var licenseUtil=require(_0x8205('0x15'));var db=require(_0x8205('0x16'))['db'];function respondWithStatusCode(_0x403ac,_0x53e3e5){_0x53e3e5=_0x53e3e5||0xcc;return function(_0x263646){if(_0x263646){return _0x403ac[_0x8205('0x17')](_0x53e3e5);}return _0x403ac[_0x8205('0x18')](_0x53e3e5)[_0x8205('0x19')]();};}function respondWithResult(_0x32ba43,_0x1d37c3){_0x1d37c3=_0x1d37c3||0xc8;return function(_0x432996){if(_0x432996){return _0x32ba43[_0x8205('0x18')](_0x1d37c3)[_0x8205('0x1a')](_0x432996);}};}function respondWithFilteredResult(_0x8a8e22,_0x5f16c2){return function(_0x4451f3){if(_0x4451f3){var _0x1baee8=typeof _0x5f16c2['offset']===_0x8205('0x1b')&&typeof _0x5f16c2[_0x8205('0x1c')]==='undefined';var _0x23ced1=_0x4451f3['count'];var _0x113897=_0x1baee8?0x0:_0x5f16c2[_0x8205('0x1d')];var _0x142c9e=_0x1baee8?_0x4451f3[_0x8205('0x1e')]:_0x5f16c2[_0x8205('0x1d')]+_0x5f16c2[_0x8205('0x1c')];var _0x5604cd;if(_0x142c9e>=_0x23ced1){_0x142c9e=_0x23ced1;_0x5604cd=0xc8;}else{_0x5604cd=0xce;}_0x8a8e22[_0x8205('0x18')](_0x5604cd);return _0x8a8e22[_0x8205('0x1f')]('Content-Range',_0x113897+'-'+_0x142c9e+'/'+_0x23ced1)['json'](_0x4451f3);}return null;};}function patchUpdates(_0x20c1ae){return function(_0xfe85a){try{jsonpatch[_0x8205('0x20')](_0xfe85a,_0x20c1ae,!![]);}catch(_0x1f4c2a){return BPromise[_0x8205('0x21')](_0x1f4c2a);}return _0xfe85a[_0x8205('0x22')]();};}function saveUpdates(_0x27058c,_0x3f6e82){return function(_0x31936a){if(_0x31936a){return _0x31936a['update'](_0x27058c)[_0x8205('0x23')](function(_0x2ae8aa){return _0x2ae8aa;});}return null;};}function removeEntity(_0x31a4d3,_0x4508ff){return function(_0x1f1ae2){if(_0x1f1ae2){return _0x1f1ae2[_0x8205('0x24')]()[_0x8205('0x23')](function(){_0x31a4d3['status'](0xcc)[_0x8205('0x19')]();});}};}function handleEntityNotFound(_0x5a2d32,_0x3df18f){return function(_0x4a05fe){if(!_0x4a05fe){_0x5a2d32[_0x8205('0x17')](0x194);}return _0x4a05fe;};}function handleError(_0x2537a5,_0x15e9f0){_0x15e9f0=_0x15e9f0||0x1f4;return function(_0x3537f5){logger['error'](_0x3537f5[_0x8205('0x25')]);if(_0x3537f5[_0x8205('0x26')]){delete _0x3537f5[_0x8205('0x26')];}_0x2537a5['status'](_0x15e9f0)['send'](_0x3537f5);};}exports[_0x8205('0x27')]=function(_0x34d668,_0x1d237f){var _0x1a8c18={},_0x2a6834={},_0x5c4137={'count':0x0,'rows':[]};var _0x15ffbc=_[_0x8205('0x28')](db[_0x8205('0x29')][_0x8205('0x2a')],function(_0x4a9955){return{'name':_0x4a9955['fieldName'],'type':_0x4a9955[_0x8205('0x2b')][_0x8205('0x2c')]};});_0x2a6834['model']=_['map'](_0x15ffbc,'name');_0x2a6834[_0x8205('0x2d')]=_['keys'](_0x34d668[_0x8205('0x2d')]);_0x2a6834[_0x8205('0x2e')]=_['intersection'](_0x2a6834[_0x8205('0x2f')],_0x2a6834['query']);_0x1a8c18[_0x8205('0x30')]=_[_0x8205('0x31')](_0x2a6834[_0x8205('0x2f')],qs[_0x8205('0x32')](_0x34d668[_0x8205('0x2d')][_0x8205('0x32')]));_0x1a8c18['attributes']=_0x1a8c18[_0x8205('0x30')]['length']?_0x1a8c18[_0x8205('0x30')]:_0x2a6834[_0x8205('0x2f')];if(!_0x34d668[_0x8205('0x2d')][_0x8205('0x33')]('nolimit')){_0x1a8c18[_0x8205('0x1c')]=qs[_0x8205('0x1c')](_0x34d668[_0x8205('0x2d')][_0x8205('0x1c')]);_0x1a8c18[_0x8205('0x1d')]=qs[_0x8205('0x1d')](_0x34d668[_0x8205('0x2d')][_0x8205('0x1d')]);}_0x1a8c18[_0x8205('0x34')]=qs[_0x8205('0x35')](_0x34d668[_0x8205('0x2d')][_0x8205('0x35')]);_0x1a8c18[_0x8205('0x36')]=qs[_0x8205('0x2e')](_[_0x8205('0x37')](_0x34d668[_0x8205('0x2d')],_0x2a6834[_0x8205('0x2e')]),_0x15ffbc);if(_0x34d668['query'][_0x8205('0x38')]){_0x1a8c18[_0x8205('0x36')]=_[_0x8205('0x39')](_0x1a8c18['where'],{'$or':_[_0x8205('0x28')](_0x15ffbc,function(_0x3c3122){if(_0x3c3122[_0x8205('0x2b')]!==_0x8205('0x3a')){var _0x58ee32={};_0x58ee32[_0x3c3122['name']]={'$like':'%'+_0x34d668[_0x8205('0x2d')][_0x8205('0x38')]+'%'};return _0x58ee32;}})});}_0x1a8c18=_[_0x8205('0x39')]({},_0x1a8c18,_0x34d668['options']);var _0x5ea68f={'where':_0x1a8c18[_0x8205('0x36')]};return db[_0x8205('0x29')]['count'](_0x5ea68f)[_0x8205('0x23')](function(_0x5cdfd6){_0x5c4137[_0x8205('0x1e')]=_0x5cdfd6;if(_0x34d668[_0x8205('0x2d')][_0x8205('0x3b')]){_0x1a8c18['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x8205('0x3c')](_0x1a8c18);})[_0x8205('0x23')](function(_0x3d3301){_0x5c4137[_0x8205('0x3d')]=_0x3d3301;return _0x5c4137;})['then'](respondWithFilteredResult(_0x1d237f,_0x1a8c18))['catch'](handleError(_0x1d237f,null));};exports['show']=function(_0x5c8540,_0x2bb384){var _0x76a002={'raw':![],'where':{'id':_0x5c8540[_0x8205('0x3e')]['id']}},_0x246206={};_0x246206[_0x8205('0x2f')]=_[_0x8205('0x3f')](db[_0x8205('0x29')]['rawAttributes']);_0x246206[_0x8205('0x2d')]=_[_0x8205('0x3f')](_0x5c8540['query']);_0x246206[_0x8205('0x2e')]=_[_0x8205('0x31')](_0x246206[_0x8205('0x2f')],_0x246206[_0x8205('0x2d')]);_0x76a002[_0x8205('0x30')]=_['intersection'](_0x246206[_0x8205('0x2f')],qs['fields'](_0x5c8540[_0x8205('0x2d')][_0x8205('0x32')]));_0x76a002[_0x8205('0x30')]=_0x76a002['attributes']['length']?_0x76a002['attributes']:_0x246206[_0x8205('0x2f')];if(_0x5c8540[_0x8205('0x2d')][_0x8205('0x3b')]){_0x76a002[_0x8205('0x40')]=[{'all':!![]}];}_0x76a002=_[_0x8205('0x39')]({},_0x76a002,_0x5c8540[_0x8205('0x41')]);return db[_0x8205('0x29')][_0x8205('0x42')](_0x76a002)[_0x8205('0x23')](handleEntityNotFound(_0x2bb384,null))['then'](respondWithResult(_0x2bb384,null))[_0x8205('0x43')](handleError(_0x2bb384,null));};exports['create']=function(_0x510bb6,_0x349b59){return db[_0x8205('0x29')][_0x8205('0x44')](_0x510bb6['body'],{})[_0x8205('0x23')](respondWithResult(_0x349b59,0xc9))[_0x8205('0x43')](handleError(_0x349b59,null));};exports['update']=function(_0xec4506,_0xec248a){if(_0xec4506[_0x8205('0x45')]['id']){delete _0xec4506[_0x8205('0x45')]['id'];}return db['ServicenowConfiguration'][_0x8205('0x42')]({'where':{'id':_0xec4506[_0x8205('0x3e')]['id']}})[_0x8205('0x23')](handleEntityNotFound(_0xec248a,null))[_0x8205('0x23')](saveUpdates(_0xec4506[_0x8205('0x45')],null))[_0x8205('0x23')](respondWithResult(_0xec248a,null))[_0x8205('0x43')](handleError(_0xec248a,null));};exports[_0x8205('0x24')]=function(_0x1927b5,_0x56d71c){return db['ServicenowConfiguration']['find']({'where':{'id':_0x1927b5[_0x8205('0x3e')]['id']}})[_0x8205('0x23')](handleEntityNotFound(_0x56d71c,null))['then'](removeEntity(_0x56d71c,null))[_0x8205('0x43')](handleError(_0x56d71c,null));};exports[_0x8205('0x46')]=function(_0x571d49,_0x124011,_0x5c887c){var _0x45ea9c={};var _0x507224={};var _0x522115;var _0x23857b;return db['ServicenowConfiguration'][_0x8205('0x47')]({'where':{'id':_0x571d49[_0x8205('0x3e')]['id']}})[_0x8205('0x23')](handleEntityNotFound(_0x124011,null))[_0x8205('0x23')](function(_0x192c2f){if(_0x192c2f){_0x522115=_0x192c2f;_0x507224[_0x8205('0x2f')]=_[_0x8205('0x3f')](db['ServicenowField']['rawAttributes']);_0x507224[_0x8205('0x2d')]=_[_0x8205('0x3f')](_0x571d49[_0x8205('0x2d')]);_0x507224[_0x8205('0x2e')]=_[_0x8205('0x31')](_0x507224['model'],_0x507224[_0x8205('0x2d')]);_0x45ea9c[_0x8205('0x30')]=_['intersection'](_0x507224[_0x8205('0x2f')],qs[_0x8205('0x32')](_0x571d49['query'][_0x8205('0x32')]));_0x45ea9c[_0x8205('0x30')]=_0x45ea9c[_0x8205('0x30')][_0x8205('0x48')]?_0x45ea9c[_0x8205('0x30')]:_0x507224[_0x8205('0x2f')];_0x45ea9c[_0x8205('0x34')]=qs[_0x8205('0x35')](_0x571d49['query']['sort']);_0x45ea9c[_0x8205('0x36')]=qs[_0x8205('0x2e')](_['pick'](_0x571d49[_0x8205('0x2d')],_0x507224[_0x8205('0x2e')]));if(_0x571d49[_0x8205('0x2d')][_0x8205('0x38')]){_0x45ea9c[_0x8205('0x36')]=_[_0x8205('0x39')](_0x45ea9c[_0x8205('0x36')],{'$or':_['map'](_0x45ea9c[_0x8205('0x30')],function(_0x3be27b){var _0x400750={};_0x400750[_0x3be27b]={'$like':'%'+_0x571d49[_0x8205('0x2d')][_0x8205('0x38')]+'%'};return _0x400750;})});}_0x45ea9c=_[_0x8205('0x39')]({},_0x45ea9c,_0x571d49['options']);return _0x522115['getFields'](_0x45ea9c);}})[_0x8205('0x23')](function(_0x2de7e6){if(_0x2de7e6){_0x23857b=_0x2de7e6['length'];if(!_0x571d49[_0x8205('0x2d')][_0x8205('0x33')](_0x8205('0x49'))){_0x45ea9c[_0x8205('0x1c')]=qs[_0x8205('0x1c')](_0x571d49[_0x8205('0x2d')][_0x8205('0x1c')]);_0x45ea9c[_0x8205('0x1d')]=qs[_0x8205('0x1d')](_0x571d49[_0x8205('0x2d')][_0x8205('0x1d')]);}return _0x522115[_0x8205('0x46')](_0x45ea9c);}})[_0x8205('0x23')](function(_0x443ee9){if(_0x443ee9){return _0x443ee9?{'count':_0x23857b,'rows':_0x443ee9}:null;}})[_0x8205('0x23')](respondWithResult(_0x124011,null))[_0x8205('0x43')](handleError(_0x124011,null));};exports['getSubjects']=function(_0x42f177,_0x13d7c5,_0x31d633){var _0x27655d={};var _0x2b752c={};var _0x417f62;var _0x428c26;return db['ServicenowConfiguration'][_0x8205('0x47')]({'where':{'id':_0x42f177[_0x8205('0x3e')]['id']}})[_0x8205('0x23')](handleEntityNotFound(_0x13d7c5,null))['then'](function(_0x191ab3){if(_0x191ab3){_0x417f62=_0x191ab3;_0x2b752c[_0x8205('0x2f')]=_[_0x8205('0x3f')](db[_0x8205('0x4a')][_0x8205('0x2a')]);_0x2b752c[_0x8205('0x2d')]=_['keys'](_0x42f177[_0x8205('0x2d')]);_0x2b752c[_0x8205('0x2e')]=_[_0x8205('0x31')](_0x2b752c[_0x8205('0x2f')],_0x2b752c[_0x8205('0x2d')]);_0x27655d[_0x8205('0x30')]=_['intersection'](_0x2b752c[_0x8205('0x2f')],qs[_0x8205('0x32')](_0x42f177[_0x8205('0x2d')][_0x8205('0x32')]));_0x27655d[_0x8205('0x30')]=_0x27655d[_0x8205('0x30')]['length']?_0x27655d['attributes']:_0x2b752c[_0x8205('0x2f')];_0x27655d[_0x8205('0x34')]=qs[_0x8205('0x35')](_0x42f177[_0x8205('0x2d')][_0x8205('0x35')]);_0x27655d[_0x8205('0x36')]=qs['filters'](_[_0x8205('0x37')](_0x42f177[_0x8205('0x2d')],_0x2b752c[_0x8205('0x2e')]));if(_0x42f177[_0x8205('0x2d')][_0x8205('0x38')]){_0x27655d[_0x8205('0x36')]=_[_0x8205('0x39')](_0x27655d[_0x8205('0x36')],{'$or':_['map'](_0x27655d['attributes'],function(_0x1bc016){var _0x509af8={};_0x509af8[_0x1bc016]={'$like':'%'+_0x42f177[_0x8205('0x2d')][_0x8205('0x38')]+'%'};return _0x509af8;})});}_0x27655d=_[_0x8205('0x39')]({},_0x27655d,_0x42f177[_0x8205('0x41')]);return _0x417f62[_0x8205('0x4b')](_0x27655d);}})[_0x8205('0x23')](function(_0x50622a){if(_0x50622a){_0x428c26=_0x50622a[_0x8205('0x48')];if(!_0x42f177[_0x8205('0x2d')][_0x8205('0x33')]('nolimit')){_0x27655d[_0x8205('0x1c')]=qs[_0x8205('0x1c')](_0x42f177['query'][_0x8205('0x1c')]);_0x27655d['offset']=qs[_0x8205('0x1d')](_0x42f177['query'][_0x8205('0x1d')]);}return _0x417f62['getSubjects'](_0x27655d);}})[_0x8205('0x23')](function(_0x123340){if(_0x123340){return _0x123340?{'count':_0x428c26,'rows':_0x123340}:null;}})[_0x8205('0x23')](respondWithResult(_0x13d7c5,null))[_0x8205('0x43')](handleError(_0x13d7c5,null));};exports[_0x8205('0x4c')]=function(_0x1efdfb,_0x48aca4,_0x157e60){var _0x47dbd6={};var _0x91b313={};var _0x504235;var _0x528a0f;return db[_0x8205('0x29')][_0x8205('0x47')]({'where':{'id':_0x1efdfb[_0x8205('0x3e')]['id']}})[_0x8205('0x23')](handleEntityNotFound(_0x48aca4,null))['then'](function(_0x1b64f6){if(_0x1b64f6){_0x504235=_0x1b64f6;_0x91b313[_0x8205('0x2f')]=_[_0x8205('0x3f')](db[_0x8205('0x4a')][_0x8205('0x2a')]);_0x91b313[_0x8205('0x2d')]=_[_0x8205('0x3f')](_0x1efdfb[_0x8205('0x2d')]);_0x91b313[_0x8205('0x2e')]=_[_0x8205('0x31')](_0x91b313[_0x8205('0x2f')],_0x91b313[_0x8205('0x2d')]);_0x47dbd6[_0x8205('0x30')]=_[_0x8205('0x31')](_0x91b313['model'],qs['fields'](_0x1efdfb[_0x8205('0x2d')][_0x8205('0x32')]));_0x47dbd6['attributes']=_0x47dbd6[_0x8205('0x30')][_0x8205('0x48')]?_0x47dbd6[_0x8205('0x30')]:_0x91b313[_0x8205('0x2f')];_0x47dbd6['order']=qs[_0x8205('0x35')](_0x1efdfb[_0x8205('0x2d')][_0x8205('0x35')]);_0x47dbd6['where']=qs[_0x8205('0x2e')](_[_0x8205('0x37')](_0x1efdfb[_0x8205('0x2d')],_0x91b313[_0x8205('0x2e')]));if(_0x1efdfb[_0x8205('0x2d')][_0x8205('0x38')]){_0x47dbd6[_0x8205('0x36')]=_['merge'](_0x47dbd6[_0x8205('0x36')],{'$or':_[_0x8205('0x28')](_0x47dbd6[_0x8205('0x30')],function(_0x109e02){var _0x5628c3={};_0x5628c3[_0x109e02]={'$like':'%'+_0x1efdfb[_0x8205('0x2d')][_0x8205('0x38')]+'%'};return _0x5628c3;})});}_0x47dbd6=_[_0x8205('0x39')]({},_0x47dbd6,_0x1efdfb[_0x8205('0x41')]);return _0x504235[_0x8205('0x4c')](_0x47dbd6);}})['then'](function(_0x2ecb25){if(_0x2ecb25){_0x528a0f=_0x2ecb25[_0x8205('0x48')];if(!_0x1efdfb[_0x8205('0x2d')][_0x8205('0x33')](_0x8205('0x49'))){_0x47dbd6['limit']=qs[_0x8205('0x1c')](_0x1efdfb[_0x8205('0x2d')][_0x8205('0x1c')]);_0x47dbd6['offset']=qs[_0x8205('0x1d')](_0x1efdfb[_0x8205('0x2d')][_0x8205('0x1d')]);}return _0x504235[_0x8205('0x4c')](_0x47dbd6);}})[_0x8205('0x23')](function(_0x40ee2c){if(_0x40ee2c){return _0x40ee2c?{'count':_0x528a0f,'rows':_0x40ee2c}:null;}})['then'](respondWithResult(_0x48aca4,null))[_0x8205('0x43')](handleError(_0x48aca4,null));}; \ No newline at end of file +var _0xfde8=['mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','error','stack','send','index','ServicenowConfiguration','rawAttributes','fieldName','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','includeAll','findAll','catch','params','keys','length','include','options','find','create','body','getFields','findOne','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3f4b60,_0x11b53c){var _0x153731=function(_0x3529bb){while(--_0x3529bb){_0x3f4b60['push'](_0x3f4b60['shift']());}};_0x153731(++_0x11b53c);}(_0xfde8,0x13e));var _0x8fde=function(_0x2cde4f,_0x48aee8){_0x2cde4f=_0x2cde4f-0x0;var _0x195e22=_0xfde8[_0x2cde4f];return _0x195e22;};'use strict';var emlformat=require(_0x8fde('0x0'));var rimraf=require(_0x8fde('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8fde('0x2'));var rp=require(_0x8fde('0x3'));var moment=require(_0x8fde('0x4'));var BPromise=require(_0x8fde('0x5'));var Mustache=require(_0x8fde('0x6'));var util=require(_0x8fde('0x7'));var path=require(_0x8fde('0x8'));var sox=require(_0x8fde('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8fde('0xa'));var _=require(_0x8fde('0xb'));var squel=require('squel');var crypto=require(_0x8fde('0xc'));var jsforce=require(_0x8fde('0xd'));var deskjs=require(_0x8fde('0xe'));var toCsv=require(_0x8fde('0xf'));var querystring=require('querystring');var Papa=require(_0x8fde('0x10'));var Redis=require('ioredis');var authService=require(_0x8fde('0x11'));var qs=require(_0x8fde('0x12'));var as=require(_0x8fde('0x13'));var hardwareService=require(_0x8fde('0x14'));var logger=require(_0x8fde('0x15'))(_0x8fde('0x16'));var utils=require(_0x8fde('0x17'));var config=require(_0x8fde('0x18'));var licenseUtil=require(_0x8fde('0x19'));var db=require(_0x8fde('0x1a'))['db'];function respondWithStatusCode(_0x419a63,_0x1c6b28){_0x1c6b28=_0x1c6b28||0xcc;return function(_0x3553e8){if(_0x3553e8){return _0x419a63[_0x8fde('0x1b')](_0x1c6b28);}return _0x419a63['status'](_0x1c6b28)[_0x8fde('0x1c')]();};}function respondWithResult(_0x1f2056,_0x3f58c4){_0x3f58c4=_0x3f58c4||0xc8;return function(_0x35fc3b){if(_0x35fc3b){return _0x1f2056[_0x8fde('0x1d')](_0x3f58c4)[_0x8fde('0x1e')](_0x35fc3b);}};}function respondWithFilteredResult(_0x360d82,_0x203f4f){return function(_0x20266f){if(_0x20266f){var _0x2b78b5=typeof _0x203f4f['offset']===_0x8fde('0x1f')&&typeof _0x203f4f[_0x8fde('0x20')]===_0x8fde('0x1f');var _0x4a7d08=_0x20266f['count'];var _0x2d8113=_0x2b78b5?0x0:_0x203f4f['offset'];var _0x60079f=_0x2b78b5?_0x20266f[_0x8fde('0x21')]:_0x203f4f[_0x8fde('0x22')]+_0x203f4f['limit'];var _0x2c7f5e;if(_0x60079f>=_0x4a7d08){_0x60079f=_0x4a7d08;_0x2c7f5e=0xc8;}else{_0x2c7f5e=0xce;}_0x360d82[_0x8fde('0x1d')](_0x2c7f5e);return _0x360d82[_0x8fde('0x23')](_0x8fde('0x24'),_0x2d8113+'-'+_0x60079f+'/'+_0x4a7d08)[_0x8fde('0x1e')](_0x20266f);}return null;};}function patchUpdates(_0x4f3119){return function(_0x3d3e42){try{jsonpatch['apply'](_0x3d3e42,_0x4f3119,!![]);}catch(_0x5321f6){return BPromise['reject'](_0x5321f6);}return _0x3d3e42[_0x8fde('0x25')]();};}function saveUpdates(_0x2a003a,_0x598881){return function(_0x235729){if(_0x235729){return _0x235729[_0x8fde('0x26')](_0x2a003a)[_0x8fde('0x27')](function(_0x21f513){return _0x21f513;});}return null;};}function removeEntity(_0x589852,_0x3a24e6){return function(_0x271b9f){if(_0x271b9f){return _0x271b9f[_0x8fde('0x28')]()['then'](function(){_0x589852['status'](0xcc)[_0x8fde('0x1c')]();});}};}function handleEntityNotFound(_0x5aba30,_0x49e840){return function(_0x117a29){if(!_0x117a29){_0x5aba30['sendStatus'](0x194);}return _0x117a29;};}function handleError(_0x2fd948,_0x2a013a){_0x2a013a=_0x2a013a||0x1f4;return function(_0x224f34){logger[_0x8fde('0x29')](_0x224f34[_0x8fde('0x2a')]);if(_0x224f34['name']){delete _0x224f34['name'];}_0x2fd948[_0x8fde('0x1d')](_0x2a013a)[_0x8fde('0x2b')](_0x224f34);};}exports[_0x8fde('0x2c')]=function(_0x2ca85f,_0x446863){var _0x3ed901={},_0x265806={},_0x4b9702={'count':0x0,'rows':[]};var _0x1e8d2c=_['map'](db[_0x8fde('0x2d')][_0x8fde('0x2e')],function(_0x7ee7e0){return{'name':_0x7ee7e0[_0x8fde('0x2f')],'type':_0x7ee7e0['type']['key']};});_0x265806[_0x8fde('0x30')]=_['map'](_0x1e8d2c,_0x8fde('0x31'));_0x265806[_0x8fde('0x32')]=_['keys'](_0x2ca85f[_0x8fde('0x32')]);_0x265806[_0x8fde('0x33')]=_[_0x8fde('0x34')](_0x265806[_0x8fde('0x30')],_0x265806['query']);_0x3ed901[_0x8fde('0x35')]=_[_0x8fde('0x34')](_0x265806[_0x8fde('0x30')],qs[_0x8fde('0x36')](_0x2ca85f['query'][_0x8fde('0x36')]));_0x3ed901[_0x8fde('0x35')]=_0x3ed901[_0x8fde('0x35')]['length']?_0x3ed901['attributes']:_0x265806['model'];if(!_0x2ca85f[_0x8fde('0x32')][_0x8fde('0x37')](_0x8fde('0x38'))){_0x3ed901[_0x8fde('0x20')]=qs[_0x8fde('0x20')](_0x2ca85f['query'][_0x8fde('0x20')]);_0x3ed901['offset']=qs[_0x8fde('0x22')](_0x2ca85f[_0x8fde('0x32')][_0x8fde('0x22')]);}_0x3ed901[_0x8fde('0x39')]=qs[_0x8fde('0x3a')](_0x2ca85f[_0x8fde('0x32')][_0x8fde('0x3a')]);_0x3ed901['where']=qs['filters'](_[_0x8fde('0x3b')](_0x2ca85f[_0x8fde('0x32')],_0x265806['filters']),_0x1e8d2c);if(_0x2ca85f[_0x8fde('0x32')][_0x8fde('0x3c')]){_0x3ed901[_0x8fde('0x3d')]=_[_0x8fde('0x3e')](_0x3ed901[_0x8fde('0x3d')],{'$or':_[_0x8fde('0x3f')](_0x1e8d2c,function(_0x86cce){if(_0x86cce[_0x8fde('0x40')]!=='VIRTUAL'){var _0x137af0={};_0x137af0[_0x86cce[_0x8fde('0x31')]]={'$like':'%'+_0x2ca85f[_0x8fde('0x32')]['filter']+'%'};return _0x137af0;}})});}_0x3ed901=_[_0x8fde('0x3e')]({},_0x3ed901,_0x2ca85f['options']);var _0x23656e={'where':_0x3ed901[_0x8fde('0x3d')]};return db[_0x8fde('0x2d')][_0x8fde('0x21')](_0x23656e)[_0x8fde('0x27')](function(_0x55cb0c){_0x4b9702['count']=_0x55cb0c;if(_0x2ca85f[_0x8fde('0x32')][_0x8fde('0x41')]){_0x3ed901['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x8fde('0x42')](_0x3ed901);})[_0x8fde('0x27')](function(_0x5170dc){_0x4b9702['rows']=_0x5170dc;return _0x4b9702;})[_0x8fde('0x27')](respondWithFilteredResult(_0x446863,_0x3ed901))[_0x8fde('0x43')](handleError(_0x446863,null));};exports['show']=function(_0x446826,_0xe0414c){var _0x512e48={'raw':![],'where':{'id':_0x446826[_0x8fde('0x44')]['id']}},_0x30fdba={};_0x30fdba[_0x8fde('0x30')]=_[_0x8fde('0x45')](db[_0x8fde('0x2d')]['rawAttributes']);_0x30fdba[_0x8fde('0x32')]=_[_0x8fde('0x45')](_0x446826[_0x8fde('0x32')]);_0x30fdba['filters']=_['intersection'](_0x30fdba[_0x8fde('0x30')],_0x30fdba[_0x8fde('0x32')]);_0x512e48[_0x8fde('0x35')]=_[_0x8fde('0x34')](_0x30fdba['model'],qs['fields'](_0x446826[_0x8fde('0x32')][_0x8fde('0x36')]));_0x512e48[_0x8fde('0x35')]=_0x512e48[_0x8fde('0x35')][_0x8fde('0x46')]?_0x512e48[_0x8fde('0x35')]:_0x30fdba[_0x8fde('0x30')];if(_0x446826[_0x8fde('0x32')][_0x8fde('0x41')]){_0x512e48[_0x8fde('0x47')]=[{'all':!![]}];}_0x512e48=_[_0x8fde('0x3e')]({},_0x512e48,_0x446826[_0x8fde('0x48')]);return db[_0x8fde('0x2d')][_0x8fde('0x49')](_0x512e48)[_0x8fde('0x27')](handleEntityNotFound(_0xe0414c,null))['then'](respondWithResult(_0xe0414c,null))[_0x8fde('0x43')](handleError(_0xe0414c,null));};exports[_0x8fde('0x4a')]=function(_0x47da5f,_0x1bd9f1){return db[_0x8fde('0x2d')][_0x8fde('0x4a')](_0x47da5f[_0x8fde('0x4b')],{})[_0x8fde('0x27')](respondWithResult(_0x1bd9f1,0xc9))[_0x8fde('0x43')](handleError(_0x1bd9f1,null));};exports[_0x8fde('0x26')]=function(_0x54ac6b,_0x415907){if(_0x54ac6b[_0x8fde('0x4b')]['id']){delete _0x54ac6b[_0x8fde('0x4b')]['id'];}return db[_0x8fde('0x2d')][_0x8fde('0x49')]({'where':{'id':_0x54ac6b[_0x8fde('0x44')]['id']}})[_0x8fde('0x27')](handleEntityNotFound(_0x415907,null))[_0x8fde('0x27')](saveUpdates(_0x54ac6b[_0x8fde('0x4b')],null))['then'](respondWithResult(_0x415907,null))[_0x8fde('0x43')](handleError(_0x415907,null));};exports['destroy']=function(_0x544622,_0x203424){return db[_0x8fde('0x2d')][_0x8fde('0x49')]({'where':{'id':_0x544622['params']['id']}})[_0x8fde('0x27')](handleEntityNotFound(_0x203424,null))[_0x8fde('0x27')](removeEntity(_0x203424,null))[_0x8fde('0x43')](handleError(_0x203424,null));};exports[_0x8fde('0x4c')]=function(_0x63b658,_0x1544c2,_0x4e7767){var _0x1661e8={};var _0x5e26ae={};var _0x4b2e78;var _0x54d227;return db[_0x8fde('0x2d')][_0x8fde('0x4d')]({'where':{'id':_0x63b658[_0x8fde('0x44')]['id']}})[_0x8fde('0x27')](handleEntityNotFound(_0x1544c2,null))[_0x8fde('0x27')](function(_0x113283){if(_0x113283){_0x4b2e78=_0x113283;_0x5e26ae[_0x8fde('0x30')]=_[_0x8fde('0x45')](db['ServicenowField'][_0x8fde('0x2e')]);_0x5e26ae['query']=_[_0x8fde('0x45')](_0x63b658['query']);_0x5e26ae[_0x8fde('0x33')]=_[_0x8fde('0x34')](_0x5e26ae['model'],_0x5e26ae[_0x8fde('0x32')]);_0x1661e8[_0x8fde('0x35')]=_['intersection'](_0x5e26ae[_0x8fde('0x30')],qs[_0x8fde('0x36')](_0x63b658['query'][_0x8fde('0x36')]));_0x1661e8['attributes']=_0x1661e8['attributes'][_0x8fde('0x46')]?_0x1661e8[_0x8fde('0x35')]:_0x5e26ae[_0x8fde('0x30')];_0x1661e8['order']=qs['sort'](_0x63b658[_0x8fde('0x32')][_0x8fde('0x3a')]);_0x1661e8[_0x8fde('0x3d')]=qs['filters'](_['pick'](_0x63b658[_0x8fde('0x32')],_0x5e26ae[_0x8fde('0x33')]));if(_0x63b658[_0x8fde('0x32')][_0x8fde('0x3c')]){_0x1661e8['where']=_[_0x8fde('0x3e')](_0x1661e8['where'],{'$or':_[_0x8fde('0x3f')](_0x1661e8['attributes'],function(_0x1ba997){var _0x3a1e07={};_0x3a1e07[_0x1ba997]={'$like':'%'+_0x63b658['query'][_0x8fde('0x3c')]+'%'};return _0x3a1e07;})});}_0x1661e8=_[_0x8fde('0x3e')]({},_0x1661e8,_0x63b658['options']);return _0x4b2e78[_0x8fde('0x4c')](_0x1661e8);}})[_0x8fde('0x27')](function(_0x22c27b){if(_0x22c27b){_0x54d227=_0x22c27b[_0x8fde('0x46')];if(!_0x63b658[_0x8fde('0x32')][_0x8fde('0x37')]('nolimit')){_0x1661e8[_0x8fde('0x20')]=qs['limit'](_0x63b658[_0x8fde('0x32')][_0x8fde('0x20')]);_0x1661e8[_0x8fde('0x22')]=qs[_0x8fde('0x22')](_0x63b658[_0x8fde('0x32')][_0x8fde('0x22')]);}return _0x4b2e78[_0x8fde('0x4c')](_0x1661e8);}})['then'](function(_0x1ce4fc){if(_0x1ce4fc){return _0x1ce4fc?{'count':_0x54d227,'rows':_0x1ce4fc}:null;}})[_0x8fde('0x27')](respondWithResult(_0x1544c2,null))[_0x8fde('0x43')](handleError(_0x1544c2,null));};exports[_0x8fde('0x4e')]=function(_0x9f8e6c,_0x443d56,_0x19b3cf){var _0x590049={};var _0x5459f0={};var _0x586567;var _0x50d91d;return db[_0x8fde('0x2d')][_0x8fde('0x4d')]({'where':{'id':_0x9f8e6c[_0x8fde('0x44')]['id']}})[_0x8fde('0x27')](handleEntityNotFound(_0x443d56,null))[_0x8fde('0x27')](function(_0x59fe8c){if(_0x59fe8c){_0x586567=_0x59fe8c;_0x5459f0[_0x8fde('0x30')]=_[_0x8fde('0x45')](db[_0x8fde('0x4f')]['rawAttributes']);_0x5459f0['query']=_[_0x8fde('0x45')](_0x9f8e6c['query']);_0x5459f0[_0x8fde('0x33')]=_[_0x8fde('0x34')](_0x5459f0[_0x8fde('0x30')],_0x5459f0[_0x8fde('0x32')]);_0x590049[_0x8fde('0x35')]=_[_0x8fde('0x34')](_0x5459f0['model'],qs['fields'](_0x9f8e6c[_0x8fde('0x32')][_0x8fde('0x36')]));_0x590049[_0x8fde('0x35')]=_0x590049[_0x8fde('0x35')][_0x8fde('0x46')]?_0x590049[_0x8fde('0x35')]:_0x5459f0['model'];_0x590049[_0x8fde('0x39')]=qs[_0x8fde('0x3a')](_0x9f8e6c[_0x8fde('0x32')][_0x8fde('0x3a')]);_0x590049[_0x8fde('0x3d')]=qs[_0x8fde('0x33')](_[_0x8fde('0x3b')](_0x9f8e6c[_0x8fde('0x32')],_0x5459f0[_0x8fde('0x33')]));if(_0x9f8e6c['query'][_0x8fde('0x3c')]){_0x590049[_0x8fde('0x3d')]=_[_0x8fde('0x3e')](_0x590049['where'],{'$or':_[_0x8fde('0x3f')](_0x590049[_0x8fde('0x35')],function(_0x417829){var _0x93acc6={};_0x93acc6[_0x417829]={'$like':'%'+_0x9f8e6c[_0x8fde('0x32')]['filter']+'%'};return _0x93acc6;})});}_0x590049=_[_0x8fde('0x3e')]({},_0x590049,_0x9f8e6c['options']);return _0x586567[_0x8fde('0x4e')](_0x590049);}})[_0x8fde('0x27')](function(_0x374e07){if(_0x374e07){_0x50d91d=_0x374e07[_0x8fde('0x46')];if(!_0x9f8e6c[_0x8fde('0x32')][_0x8fde('0x37')]('nolimit')){_0x590049[_0x8fde('0x20')]=qs['limit'](_0x9f8e6c[_0x8fde('0x32')][_0x8fde('0x20')]);_0x590049[_0x8fde('0x22')]=qs[_0x8fde('0x22')](_0x9f8e6c['query'][_0x8fde('0x22')]);}return _0x586567[_0x8fde('0x4e')](_0x590049);}})[_0x8fde('0x27')](function(_0x4b274d){if(_0x4b274d){return _0x4b274d?{'count':_0x50d91d,'rows':_0x4b274d}:null;}})[_0x8fde('0x27')](respondWithResult(_0x443d56,null))[_0x8fde('0x43')](handleError(_0x443d56,null));};exports['getDescriptions']=function(_0x124278,_0xf07048,_0xbcfa8b){var _0x4c82fa={};var _0x580175={};var _0x557d97;var _0x2854d1;return db['ServicenowConfiguration'][_0x8fde('0x4d')]({'where':{'id':_0x124278[_0x8fde('0x44')]['id']}})[_0x8fde('0x27')](handleEntityNotFound(_0xf07048,null))['then'](function(_0x15b69f){if(_0x15b69f){_0x557d97=_0x15b69f;_0x580175[_0x8fde('0x30')]=_[_0x8fde('0x45')](db[_0x8fde('0x4f')][_0x8fde('0x2e')]);_0x580175[_0x8fde('0x32')]=_[_0x8fde('0x45')](_0x124278['query']);_0x580175['filters']=_[_0x8fde('0x34')](_0x580175[_0x8fde('0x30')],_0x580175[_0x8fde('0x32')]);_0x4c82fa[_0x8fde('0x35')]=_[_0x8fde('0x34')](_0x580175[_0x8fde('0x30')],qs[_0x8fde('0x36')](_0x124278[_0x8fde('0x32')][_0x8fde('0x36')]));_0x4c82fa[_0x8fde('0x35')]=_0x4c82fa[_0x8fde('0x35')][_0x8fde('0x46')]?_0x4c82fa[_0x8fde('0x35')]:_0x580175[_0x8fde('0x30')];_0x4c82fa['order']=qs[_0x8fde('0x3a')](_0x124278[_0x8fde('0x32')]['sort']);_0x4c82fa[_0x8fde('0x3d')]=qs['filters'](_['pick'](_0x124278[_0x8fde('0x32')],_0x580175['filters']));if(_0x124278[_0x8fde('0x32')]['filter']){_0x4c82fa['where']=_[_0x8fde('0x3e')](_0x4c82fa[_0x8fde('0x3d')],{'$or':_[_0x8fde('0x3f')](_0x4c82fa[_0x8fde('0x35')],function(_0x3343f9){var _0x29f148={};_0x29f148[_0x3343f9]={'$like':'%'+_0x124278[_0x8fde('0x32')][_0x8fde('0x3c')]+'%'};return _0x29f148;})});}_0x4c82fa=_[_0x8fde('0x3e')]({},_0x4c82fa,_0x124278[_0x8fde('0x48')]);return _0x557d97[_0x8fde('0x50')](_0x4c82fa);}})['then'](function(_0x3372d9){if(_0x3372d9){_0x2854d1=_0x3372d9[_0x8fde('0x46')];if(!_0x124278['query'][_0x8fde('0x37')](_0x8fde('0x38'))){_0x4c82fa[_0x8fde('0x20')]=qs[_0x8fde('0x20')](_0x124278[_0x8fde('0x32')][_0x8fde('0x20')]);_0x4c82fa[_0x8fde('0x22')]=qs[_0x8fde('0x22')](_0x124278['query'][_0x8fde('0x22')]);}return _0x557d97[_0x8fde('0x50')](_0x4c82fa);}})[_0x8fde('0x27')](function(_0x56d364){if(_0x56d364){return _0x56d364?{'count':_0x2854d1,'rows':_0x56d364}:null;}})[_0x8fde('0x27')](respondWithResult(_0xf07048,null))[_0x8fde('0x43')](handleError(_0xf07048,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 2023528..a876505 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 _0x8603=['util','../../config/logger','api','request-promise','path','rimraf','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x227b9a,_0x29a43f){var _0x52bdf9=function(_0x5eb50e){while(--_0x5eb50e){_0x227b9a['push'](_0x227b9a['shift']());}};_0x52bdf9(++_0x29a43f);}(_0x8603,0x190));var _0x3860=function(_0x48c2ae,_0x4cea90){_0x48c2ae=_0x48c2ae-0x0;var _0x8f7531=_0x8603[_0x48c2ae];return _0x8f7531;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var logger=require(_0x3860('0x1'))(_0x3860('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3860('0x3'));var fs=require('fs');var path=require(_0x3860('0x4'));var rimraf=require(_0x3860('0x5'));var config=require('../../config/environment');var attributes=require(_0x3860('0x6'));module['exports']=function(_0xb0fc24,_0x40739b){return _0xb0fc24[_0x3860('0x7')](_0x3860('0x8'),attributes,{'tableName':_0x3860('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x867f=['exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./intServicenowConfiguration.attributes'];(function(_0xddcb3c,_0x188628){var _0xf39702=function(_0x4a6f61){while(--_0x4a6f61){_0xddcb3c['push'](_0xddcb3c['shift']());}};_0xf39702(++_0x188628);}(_0x867f,0xdc));var _0xf867=function(_0x2c6991,_0x4b5775){_0x2c6991=_0x2c6991-0x0;var _0x4de9fa=_0x867f[_0x2c6991];return _0x4de9fa;};'use strict';var _=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var logger=require(_0xf867('0x2'))('api');var moment=require(_0xf867('0x3'));var BPromise=require(_0xf867('0x4'));var rp=require(_0xf867('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf867('0x6'));var config=require('../../config/environment');var attributes=require(_0xf867('0x7'));module[_0xf867('0x8')]=function(_0x2708d5,_0x287b67){return _0x2708d5[_0xf867('0x9')](_0xf867('0xa'),attributes,{'tableName':_0xf867('0xb'),'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 7c4c99b..cce15fd 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 _0xf333=['util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','ServicenowConfiguration,\x20%s,\x20%s','message'];(function(_0x5ddb21,_0x4f196c){var _0x451b14=function(_0x2bc33d){while(--_0x2bc33d){_0x5ddb21['push'](_0x5ddb21['shift']());}};_0x451b14(++_0x4f196c);}(_0xf333,0x1d4));var _0x3f33=function(_0x55c7c8,_0x4b15db){_0x55c7c8=_0x55c7c8-0x0;var _0x30af7b=_0xf333[_0x55c7c8];return _0x30af7b;};'use strict';var _=require('lodash');var util=require(_0x3f33('0x0'));var moment=require(_0x3f33('0x1'));var BPromise=require('bluebird');var rs=require(_0x3f33('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f33('0x3'))['db'];var utils=require(_0x3f33('0x4'));var logger=require('../../config/logger')(_0x3f33('0x5'));var config=require(_0x3f33('0x6'));var jayson=require(_0x3f33('0x7'));var client=jayson[_0x3f33('0x8')][_0x3f33('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56aa2e,_0x20b18e,_0x2732d0){return new BPromise(function(_0x53826c,_0x35b137){return client['request'](_0x56aa2e,_0x2732d0)[_0x3f33('0xa')](function(_0x27ced6){logger[_0x3f33('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x20b18e,_0x3f33('0xc'));logger['debug'](_0x3f33('0xd'),_0x20b18e,_0x3f33('0xc'),JSON['stringify'](_0x27ced6));if(_0x27ced6[_0x3f33('0xe')]){if(_0x27ced6[_0x3f33('0xe')][_0x3f33('0xf')]===0x1f4){logger['error'](_0x3f33('0x10'),_0x20b18e,_0x27ced6['error'][_0x3f33('0x11')]);return _0x35b137(_0x27ced6['error'][_0x3f33('0x11')]);}logger[_0x3f33('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x20b18e,_0x27ced6[_0x3f33('0xe')][_0x3f33('0x11')]);return _0x53826c(_0x27ced6[_0x3f33('0xe')][_0x3f33('0x11')]);}else{logger[_0x3f33('0xb')](_0x3f33('0x10'),_0x20b18e,_0x3f33('0xc'));_0x53826c(_0x27ced6['result'][_0x3f33('0x11')]);}})['catch'](function(_0x2b4ffe){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x20b18e,_0x2b4ffe);_0x35b137(_0x2b4ffe);});});} \ No newline at end of file +var _0xa897=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2f57b2,_0xa8e91a){var _0x5ace77=function(_0x59c00a){while(--_0x59c00a){_0x2f57b2['push'](_0x2f57b2['shift']());}};_0x5ace77(++_0xa8e91a);}(_0xa897,0x17c));var _0x7a89=function(_0x5c5f81,_0xf044ad){_0x5c5f81=_0x5c5f81-0x0;var _0x495355=_0xa897[_0x5c5f81];return _0x495355;};'use strict';var _=require(_0x7a89('0x0'));var util=require('util');var moment=require(_0x7a89('0x1'));var BPromise=require(_0x7a89('0x2'));var rs=require(_0x7a89('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a89('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a89('0x5'))('rpc');var config=require(_0x7a89('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7a89('0x7')][_0x7a89('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x340a28,_0x1ef066,_0x2f1c93){return new BPromise(function(_0x46798d,_0x4cbc83){return client[_0x7a89('0x9')](_0x340a28,_0x2f1c93)[_0x7a89('0xa')](function(_0x47dff0){logger[_0x7a89('0xb')](_0x7a89('0xc'),_0x1ef066,_0x7a89('0xd'));logger[_0x7a89('0xe')](_0x7a89('0xf'),_0x1ef066,_0x7a89('0xd'),JSON['stringify'](_0x47dff0));if(_0x47dff0[_0x7a89('0x10')]){if(_0x47dff0[_0x7a89('0x10')][_0x7a89('0x11')]===0x1f4){logger[_0x7a89('0x10')](_0x7a89('0xc'),_0x1ef066,_0x47dff0['error']['message']);return _0x4cbc83(_0x47dff0[_0x7a89('0x10')][_0x7a89('0x12')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x1ef066,_0x47dff0[_0x7a89('0x10')]['message']);return _0x46798d(_0x47dff0['error'][_0x7a89('0x12')]);}else{logger[_0x7a89('0xb')](_0x7a89('0xc'),_0x1ef066,_0x7a89('0xd'));_0x46798d(_0x47dff0[_0x7a89('0x13')][_0x7a89('0x12')]);}})[_0x7a89('0x14')](function(_0x49ec85){logger[_0x7a89('0x10')](_0x7a89('0xc'),_0x1ef066,_0x49ec85);_0x4cbc83(_0x49ec85);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 9ad3814..86eefde 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 _0x89a9=['show','post','create','/:id','update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get'];(function(_0x33bdf4,_0x3f52b3){var _0x52c747=function(_0x57dc27){while(--_0x57dc27){_0x33bdf4['push'](_0x33bdf4['shift']());}};_0x52c747(++_0x3f52b3);}(_0x89a9,0x1ca));var _0x989a=function(_0x5e94c5,_0x565c68){_0x5e94c5=_0x5e94c5-0x0;var _0x3747ad=_0x89a9[_0x5e94c5];return _0x3747ad;};'use strict';var multer=require(_0x989a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x989a('0x1'));var express=require(_0x989a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x989a('0x3'));var interaction=require(_0x989a('0x4'));var config=require(_0x989a('0x5'));var controller=require(_0x989a('0x6'));router['get']('/',auth[_0x989a('0x7')](),controller[_0x989a('0x8')]);router[_0x989a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x989a('0xa')]);router[_0x989a('0xb')]('/',auth[_0x989a('0x7')](),controller[_0x989a('0xc')]);router['put'](_0x989a('0xd'),auth[_0x989a('0x7')](),controller[_0x989a('0xe')]);router[_0x989a('0xf')](_0x989a('0xd'),auth[_0x989a('0x7')](),controller[_0x989a('0x10')]);module[_0x989a('0x11')]=router; \ No newline at end of file +var _0x7f97=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x7f97,0xee));var _0x77f9=function(_0x5262c1,_0x37bc37){_0x5262c1=_0x5262c1-0x0;var _0x179e58=_0x7f97[_0x5262c1];return _0x179e58;};'use strict';var multer=require('multer');var util=require(_0x77f9('0x0'));var path=require(_0x77f9('0x1'));var timeout=require('connect-timeout');var express=require(_0x77f9('0x2'));var router=express[_0x77f9('0x3')]();var fs_extra=require(_0x77f9('0x4'));var auth=require(_0x77f9('0x5'));var interaction=require(_0x77f9('0x6'));var config=require(_0x77f9('0x7'));var controller=require(_0x77f9('0x8'));router[_0x77f9('0x9')]('/',auth[_0x77f9('0xa')](),controller[_0x77f9('0xb')]);router['get'](_0x77f9('0xc'),auth[_0x77f9('0xa')](),controller[_0x77f9('0xd')]);router[_0x77f9('0xe')]('/',auth[_0x77f9('0xa')](),controller[_0x77f9('0xf')]);router[_0x77f9('0x10')](_0x77f9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x77f9('0x11')](_0x77f9('0xc'),auth[_0x77f9('0xa')](),controller[_0x77f9('0x12')]);module[_0x77f9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index ab18fe1..0375a53 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 _0xc1a7=['BOOLEAN','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc1a7,0xb9));var _0x7c1a=function(_0x78800,_0x5c6ed5){_0x78800=_0x78800-0x0;var _0x3f873a=_0xc1a7[_0x78800];return _0x3f873a;};'use strict';var Sequelize=require('sequelize');module[_0x7c1a('0x0')]={'type':{'type':Sequelize[_0x7c1a('0x1')](_0x7c1a('0x2'),_0x7c1a('0x3'),_0x7c1a('0x4'),'keyValue',_0x7c1a('0x5')),'defaultValue':_0x7c1a('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7c1a('0x6')]},'keyType':{'type':Sequelize[_0x7c1a('0x1')]('string','variable',_0x7c1a('0x4'))},'keyContent':{'type':Sequelize[_0x7c1a('0x6')]},'idField':{'type':Sequelize[_0x7c1a('0x6')]},'nameField':{'type':Sequelize[_0x7c1a('0x6')]},'customField':{'type':Sequelize[_0x7c1a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7c1a('0x6')]}}; \ No newline at end of file +var _0x1901=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x1901,0x187));var _0x1190=function(_0x2715cf,_0x517bb2){_0x2715cf=_0x2715cf-0x0;var _0x1bdcb8=_0x1901[_0x2715cf];return _0x1bdcb8;};'use strict';var Sequelize=require(_0x1190('0x0'));module['exports']={'type':{'type':Sequelize[_0x1190('0x1')](_0x1190('0x2'),_0x1190('0x3'),_0x1190('0x4'),_0x1190('0x5'),_0x1190('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1190('0x7')]},'keyType':{'type':Sequelize[_0x1190('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x1190('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1190('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 35ef3d5..9d8c82e 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 _0x1233=['sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','update','then','error','stack','name','send','map','ServicenowField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','body','destroy','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x1233,0xb3));var _0x3123=function(_0x4c8a8f,_0x997ef){_0x4c8a8f=_0x4c8a8f-0x0;var _0x404500=_0x1233[_0x4c8a8f];return _0x404500;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3123('0x0'));var rp=require('request-promise');var moment=require(_0x3123('0x1'));var BPromise=require(_0x3123('0x2'));var Mustache=require(_0x3123('0x3'));var util=require('util');var path=require(_0x3123('0x4'));var sox=require(_0x3123('0x5'));var csv=require(_0x3123('0x6'));var ejs=require(_0x3123('0x7'));var fs=require('fs');var fs_extra=require(_0x3123('0x8'));var _=require('lodash');var squel=require(_0x3123('0x9'));var crypto=require(_0x3123('0xa'));var jsforce=require(_0x3123('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3123('0x6'));var querystring=require(_0x3123('0xc'));var Papa=require(_0x3123('0xd'));var Redis=require(_0x3123('0xe'));var authService=require(_0x3123('0xf'));var qs=require(_0x3123('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3123('0x11'));var logger=require('../../config/logger')(_0x3123('0x12'));var utils=require(_0x3123('0x13'));var config=require(_0x3123('0x14'));var licenseUtil=require(_0x3123('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7567b4,_0x32e5bd){_0x32e5bd=_0x32e5bd||0xcc;return function(_0x5f96bd){if(_0x5f96bd){return _0x7567b4[_0x3123('0x16')](_0x32e5bd);}return _0x7567b4[_0x3123('0x17')](_0x32e5bd)['end']();};}function respondWithResult(_0x4fa461,_0x3f5cb7){_0x3f5cb7=_0x3f5cb7||0xc8;return function(_0x22d4ec){if(_0x22d4ec){return _0x4fa461[_0x3123('0x17')](_0x3f5cb7)[_0x3123('0x18')](_0x22d4ec);}};}function respondWithFilteredResult(_0x337fee,_0x4ed301){return function(_0x234e42){if(_0x234e42){var _0x5464c4=typeof _0x4ed301['offset']===_0x3123('0x19')&&typeof _0x4ed301[_0x3123('0x1a')]==='undefined';var _0x3b7cc9=_0x234e42['count'];var _0x588f7a=_0x5464c4?0x0:_0x4ed301[_0x3123('0x1b')];var _0x31f5d5=_0x5464c4?_0x234e42[_0x3123('0x1c')]:_0x4ed301[_0x3123('0x1b')]+_0x4ed301['limit'];var _0x6de313;if(_0x31f5d5>=_0x3b7cc9){_0x31f5d5=_0x3b7cc9;_0x6de313=0xc8;}else{_0x6de313=0xce;}_0x337fee[_0x3123('0x17')](_0x6de313);return _0x337fee[_0x3123('0x1d')](_0x3123('0x1e'),_0x588f7a+'-'+_0x31f5d5+'/'+_0x3b7cc9)[_0x3123('0x18')](_0x234e42);}return null;};}function patchUpdates(_0x313c81){return function(_0x32fa67){try{jsonpatch[_0x3123('0x1f')](_0x32fa67,_0x313c81,!![]);}catch(_0x541ef4){return BPromise['reject'](_0x541ef4);}return _0x32fa67['save']();};}function saveUpdates(_0x3cad1f,_0x5bf166){return function(_0x399dfe){if(_0x399dfe){return _0x399dfe[_0x3123('0x20')](_0x3cad1f)[_0x3123('0x21')](function(_0x11bfd3){return _0x11bfd3;});}return null;};}function removeEntity(_0x4bb1ed,_0x421d75){return function(_0x1d3a48){if(_0x1d3a48){return _0x1d3a48['destroy']()[_0x3123('0x21')](function(){_0x4bb1ed['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x593d48,_0x42a080){return function(_0x3d9560){if(!_0x3d9560){_0x593d48[_0x3123('0x16')](0x194);}return _0x3d9560;};}function handleError(_0x41b245,_0x5882eb){_0x5882eb=_0x5882eb||0x1f4;return function(_0x55be19){logger[_0x3123('0x22')](_0x55be19[_0x3123('0x23')]);if(_0x55be19[_0x3123('0x24')]){delete _0x55be19['name'];}_0x41b245[_0x3123('0x17')](_0x5882eb)[_0x3123('0x25')](_0x55be19);};}exports['index']=function(_0x31d539,_0x50e60a){var _0x48d737={},_0x33960a={},_0x5104ef={'count':0x0,'rows':[]};var _0x226c55=_[_0x3123('0x26')](db[_0x3123('0x27')][_0x3123('0x28')],function(_0x47a012){return{'name':_0x47a012[_0x3123('0x29')],'type':_0x47a012[_0x3123('0x2a')]['key']};});_0x33960a[_0x3123('0x2b')]=_[_0x3123('0x26')](_0x226c55,_0x3123('0x24'));_0x33960a[_0x3123('0x2c')]=_[_0x3123('0x2d')](_0x31d539['query']);_0x33960a[_0x3123('0x2e')]=_[_0x3123('0x2f')](_0x33960a['model'],_0x33960a[_0x3123('0x2c')]);_0x48d737[_0x3123('0x30')]=_['intersection'](_0x33960a[_0x3123('0x2b')],qs['fields'](_0x31d539['query'][_0x3123('0x31')]));_0x48d737['attributes']=_0x48d737[_0x3123('0x30')][_0x3123('0x32')]?_0x48d737[_0x3123('0x30')]:_0x33960a[_0x3123('0x2b')];if(!_0x31d539['query']['hasOwnProperty'](_0x3123('0x33'))){_0x48d737['limit']=qs['limit'](_0x31d539[_0x3123('0x2c')]['limit']);_0x48d737[_0x3123('0x1b')]=qs[_0x3123('0x1b')](_0x31d539[_0x3123('0x2c')][_0x3123('0x1b')]);}_0x48d737[_0x3123('0x34')]=qs[_0x3123('0x35')](_0x31d539['query']['sort']);_0x48d737[_0x3123('0x36')]=qs[_0x3123('0x2e')](_['pick'](_0x31d539[_0x3123('0x2c')],_0x33960a[_0x3123('0x2e')]),_0x226c55);if(_0x31d539[_0x3123('0x2c')]['filter']){_0x48d737[_0x3123('0x36')]=_[_0x3123('0x37')](_0x48d737[_0x3123('0x36')],{'$or':_[_0x3123('0x26')](_0x226c55,function(_0x5de657){if(_0x5de657[_0x3123('0x2a')]!==_0x3123('0x38')){var _0x272729={};_0x272729[_0x5de657[_0x3123('0x24')]]={'$like':'%'+_0x31d539['query']['filter']+'%'};return _0x272729;}})});}_0x48d737=_[_0x3123('0x37')]({},_0x48d737,_0x31d539['options']);var _0x55f2b3={'where':_0x48d737[_0x3123('0x36')]};return db['ServicenowField'][_0x3123('0x1c')](_0x55f2b3)['then'](function(_0x4571d1){_0x5104ef[_0x3123('0x1c')]=_0x4571d1;if(_0x31d539[_0x3123('0x2c')][_0x3123('0x39')]){_0x48d737[_0x3123('0x3a')]=[{'all':!![]}];}return db[_0x3123('0x27')][_0x3123('0x3b')](_0x48d737);})['then'](function(_0x4d785a){_0x5104ef[_0x3123('0x3c')]=_0x4d785a;return _0x5104ef;})[_0x3123('0x21')](respondWithFilteredResult(_0x50e60a,_0x48d737))[_0x3123('0x3d')](handleError(_0x50e60a,null));};exports[_0x3123('0x3e')]=function(_0x4f88bd,_0x1c9481){var _0x339d6b={'raw':!![],'where':{'id':_0x4f88bd[_0x3123('0x3f')]['id']}},_0x2af8fb={};_0x2af8fb[_0x3123('0x2b')]=_[_0x3123('0x2d')](db['ServicenowField'][_0x3123('0x28')]);_0x2af8fb[_0x3123('0x2c')]=_['keys'](_0x4f88bd[_0x3123('0x2c')]);_0x2af8fb[_0x3123('0x2e')]=_[_0x3123('0x2f')](_0x2af8fb['model'],_0x2af8fb[_0x3123('0x2c')]);_0x339d6b['attributes']=_[_0x3123('0x2f')](_0x2af8fb[_0x3123('0x2b')],qs[_0x3123('0x31')](_0x4f88bd[_0x3123('0x2c')][_0x3123('0x31')]));_0x339d6b[_0x3123('0x30')]=_0x339d6b[_0x3123('0x30')]['length']?_0x339d6b[_0x3123('0x30')]:_0x2af8fb[_0x3123('0x2b')];if(_0x4f88bd[_0x3123('0x2c')]['includeAll']){_0x339d6b[_0x3123('0x3a')]=[{'all':!![]}];}_0x339d6b=_[_0x3123('0x37')]({},_0x339d6b,_0x4f88bd['options']);return db[_0x3123('0x27')][_0x3123('0x40')](_0x339d6b)['then'](handleEntityNotFound(_0x1c9481,null))[_0x3123('0x21')](respondWithResult(_0x1c9481,null))[_0x3123('0x3d')](handleError(_0x1c9481,null));};exports['create']=function(_0x57ad17,_0x7253e){return db[_0x3123('0x27')]['create'](_0x57ad17[_0x3123('0x41')],{})[_0x3123('0x21')](respondWithResult(_0x7253e,0xc9))[_0x3123('0x3d')](handleError(_0x7253e,null));};exports[_0x3123('0x20')]=function(_0x221033,_0x48d354){if(_0x221033[_0x3123('0x41')]['id']){delete _0x221033[_0x3123('0x41')]['id'];}return db['ServicenowField']['find']({'where':{'id':_0x221033[_0x3123('0x3f')]['id']}})[_0x3123('0x21')](handleEntityNotFound(_0x48d354,null))[_0x3123('0x21')](saveUpdates(_0x221033[_0x3123('0x41')],null))[_0x3123('0x21')](respondWithResult(_0x48d354,null))[_0x3123('0x3d')](handleError(_0x48d354,null));};exports[_0x3123('0x42')]=function(_0xd6a54,_0xd6b0c){return db['ServicenowField'][_0x3123('0x40')]({'where':{'id':_0xd6a54[_0x3123('0x3f')]['id']}})[_0x3123('0x21')](handleEntityNotFound(_0xd6b0c,null))[_0x3123('0x21')](removeEntity(_0xd6b0c,null))['catch'](handleError(_0xd6b0c,null));}; \ No newline at end of file +var _0x1d89=['query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','find','create','body','update','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','model'];(function(_0x18b9e9,_0x20f5fb){var _0x384505=function(_0x2d94e4){while(--_0x2d94e4){_0x18b9e9['push'](_0x18b9e9['shift']());}};_0x384505(++_0x20f5fb);}(_0x1d89,0x6b));var _0x91d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d89[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x91d8('0x0'));var rimraf=require(_0x91d8('0x1'));var zipdir=require(_0x91d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x91d8('0x3'));var moment=require(_0x91d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91d8('0x5'));var util=require(_0x91d8('0x6'));var path=require(_0x91d8('0x7'));var sox=require('sox');var csv=require(_0x91d8('0x8'));var ejs=require(_0x91d8('0x9'));var fs=require('fs');var fs_extra=require(_0x91d8('0xa'));var _=require(_0x91d8('0xb'));var squel=require(_0x91d8('0xc'));var crypto=require(_0x91d8('0xd'));var jsforce=require(_0x91d8('0xe'));var deskjs=require(_0x91d8('0xf'));var toCsv=require(_0x91d8('0x8'));var querystring=require(_0x91d8('0x10'));var Papa=require(_0x91d8('0x11'));var Redis=require(_0x91d8('0x12'));var authService=require(_0x91d8('0x13'));var qs=require(_0x91d8('0x14'));var as=require(_0x91d8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x91d8('0x16'))(_0x91d8('0x17'));var utils=require(_0x91d8('0x18'));var config=require(_0x91d8('0x19'));var licenseUtil=require(_0x91d8('0x1a'));var db=require(_0x91d8('0x1b'))['db'];function respondWithStatusCode(_0x23f7b3,_0x12ed28){_0x12ed28=_0x12ed28||0xcc;return function(_0x526203){if(_0x526203){return _0x23f7b3[_0x91d8('0x1c')](_0x12ed28);}return _0x23f7b3['status'](_0x12ed28)[_0x91d8('0x1d')]();};}function respondWithResult(_0x284d59,_0x2f3029){_0x2f3029=_0x2f3029||0xc8;return function(_0x58ff3b){if(_0x58ff3b){return _0x284d59[_0x91d8('0x1e')](_0x2f3029)[_0x91d8('0x1f')](_0x58ff3b);}};}function respondWithFilteredResult(_0x1e60f9,_0x57ed63){return function(_0x420b1e){if(_0x420b1e){var _0x25a109=typeof _0x57ed63['offset']==='undefined'&&typeof _0x57ed63['limit']===_0x91d8('0x20');var _0x1d8631=_0x420b1e['count'];var _0x512a10=_0x25a109?0x0:_0x57ed63[_0x91d8('0x21')];var _0x166a5b=_0x25a109?_0x420b1e['count']:_0x57ed63[_0x91d8('0x21')]+_0x57ed63[_0x91d8('0x22')];var _0x134b01;if(_0x166a5b>=_0x1d8631){_0x166a5b=_0x1d8631;_0x134b01=0xc8;}else{_0x134b01=0xce;}_0x1e60f9[_0x91d8('0x1e')](_0x134b01);return _0x1e60f9[_0x91d8('0x23')](_0x91d8('0x24'),_0x512a10+'-'+_0x166a5b+'/'+_0x1d8631)[_0x91d8('0x1f')](_0x420b1e);}return null;};}function patchUpdates(_0x4231ad){return function(_0x300549){try{jsonpatch[_0x91d8('0x25')](_0x300549,_0x4231ad,!![]);}catch(_0x2d1577){return BPromise[_0x91d8('0x26')](_0x2d1577);}return _0x300549[_0x91d8('0x27')]();};}function saveUpdates(_0x2c0591,_0x713d0c){return function(_0x67fe89){if(_0x67fe89){return _0x67fe89['update'](_0x2c0591)['then'](function(_0x3e2087){return _0x3e2087;});}return null;};}function removeEntity(_0x1d5f89,_0x2b2ee0){return function(_0x41cd14){if(_0x41cd14){return _0x41cd14[_0x91d8('0x28')]()[_0x91d8('0x29')](function(){_0x1d5f89[_0x91d8('0x1e')](0xcc)[_0x91d8('0x1d')]();});}};}function handleEntityNotFound(_0x124c0d,_0x265349){return function(_0x56723f){if(!_0x56723f){_0x124c0d[_0x91d8('0x1c')](0x194);}return _0x56723f;};}function handleError(_0x297e06,_0x3f1315){_0x3f1315=_0x3f1315||0x1f4;return function(_0xa88da3){logger[_0x91d8('0x2a')](_0xa88da3[_0x91d8('0x2b')]);if(_0xa88da3[_0x91d8('0x2c')]){delete _0xa88da3[_0x91d8('0x2c')];}_0x297e06[_0x91d8('0x1e')](_0x3f1315)[_0x91d8('0x2d')](_0xa88da3);};}exports[_0x91d8('0x2e')]=function(_0x2a67bf,_0x33f020){var _0x1e1152={},_0x50eabd={},_0x107d6c={'count':0x0,'rows':[]};var _0xc51e27=_[_0x91d8('0x2f')](db[_0x91d8('0x30')][_0x91d8('0x31')],function(_0x13eece){return{'name':_0x13eece[_0x91d8('0x32')],'type':_0x13eece[_0x91d8('0x33')]['key']};});_0x50eabd[_0x91d8('0x34')]=_['map'](_0xc51e27,_0x91d8('0x2c'));_0x50eabd[_0x91d8('0x35')]=_[_0x91d8('0x36')](_0x2a67bf[_0x91d8('0x35')]);_0x50eabd['filters']=_[_0x91d8('0x37')](_0x50eabd['model'],_0x50eabd[_0x91d8('0x35')]);_0x1e1152[_0x91d8('0x38')]=_[_0x91d8('0x37')](_0x50eabd['model'],qs[_0x91d8('0x39')](_0x2a67bf[_0x91d8('0x35')][_0x91d8('0x39')]));_0x1e1152[_0x91d8('0x38')]=_0x1e1152['attributes'][_0x91d8('0x3a')]?_0x1e1152[_0x91d8('0x38')]:_0x50eabd[_0x91d8('0x34')];if(!_0x2a67bf['query']['hasOwnProperty'](_0x91d8('0x3b'))){_0x1e1152[_0x91d8('0x22')]=qs['limit'](_0x2a67bf['query'][_0x91d8('0x22')]);_0x1e1152[_0x91d8('0x21')]=qs[_0x91d8('0x21')](_0x2a67bf['query'][_0x91d8('0x21')]);}_0x1e1152[_0x91d8('0x3c')]=qs[_0x91d8('0x3d')](_0x2a67bf[_0x91d8('0x35')]['sort']);_0x1e1152[_0x91d8('0x3e')]=qs['filters'](_[_0x91d8('0x3f')](_0x2a67bf[_0x91d8('0x35')],_0x50eabd[_0x91d8('0x40')]),_0xc51e27);if(_0x2a67bf[_0x91d8('0x35')]['filter']){_0x1e1152[_0x91d8('0x3e')]=_['merge'](_0x1e1152['where'],{'$or':_[_0x91d8('0x2f')](_0xc51e27,function(_0x442b55){if(_0x442b55[_0x91d8('0x33')]!==_0x91d8('0x41')){var _0x37ee79={};_0x37ee79[_0x442b55[_0x91d8('0x2c')]]={'$like':'%'+_0x2a67bf[_0x91d8('0x35')][_0x91d8('0x42')]+'%'};return _0x37ee79;}})});}_0x1e1152=_[_0x91d8('0x43')]({},_0x1e1152,_0x2a67bf[_0x91d8('0x44')]);var _0x3930e2={'where':_0x1e1152[_0x91d8('0x3e')]};return db[_0x91d8('0x30')][_0x91d8('0x45')](_0x3930e2)[_0x91d8('0x29')](function(_0x252dbe){_0x107d6c[_0x91d8('0x45')]=_0x252dbe;if(_0x2a67bf[_0x91d8('0x35')][_0x91d8('0x46')]){_0x1e1152[_0x91d8('0x47')]=[{'all':!![]}];}return db[_0x91d8('0x30')][_0x91d8('0x48')](_0x1e1152);})[_0x91d8('0x29')](function(_0x9775e7){_0x107d6c[_0x91d8('0x49')]=_0x9775e7;return _0x107d6c;})[_0x91d8('0x29')](respondWithFilteredResult(_0x33f020,_0x1e1152))[_0x91d8('0x4a')](handleError(_0x33f020,null));};exports['show']=function(_0x518049,_0x4a8945){var _0x3305bc={'raw':!![],'where':{'id':_0x518049['params']['id']}},_0x2ba9c8={};_0x2ba9c8['model']=_[_0x91d8('0x36')](db[_0x91d8('0x30')][_0x91d8('0x31')]);_0x2ba9c8[_0x91d8('0x35')]=_[_0x91d8('0x36')](_0x518049[_0x91d8('0x35')]);_0x2ba9c8[_0x91d8('0x40')]=_[_0x91d8('0x37')](_0x2ba9c8[_0x91d8('0x34')],_0x2ba9c8[_0x91d8('0x35')]);_0x3305bc[_0x91d8('0x38')]=_[_0x91d8('0x37')](_0x2ba9c8[_0x91d8('0x34')],qs[_0x91d8('0x39')](_0x518049[_0x91d8('0x35')][_0x91d8('0x39')]));_0x3305bc['attributes']=_0x3305bc[_0x91d8('0x38')][_0x91d8('0x3a')]?_0x3305bc[_0x91d8('0x38')]:_0x2ba9c8['model'];if(_0x518049['query'][_0x91d8('0x46')]){_0x3305bc[_0x91d8('0x47')]=[{'all':!![]}];}_0x3305bc=_[_0x91d8('0x43')]({},_0x3305bc,_0x518049[_0x91d8('0x44')]);return db[_0x91d8('0x30')][_0x91d8('0x4b')](_0x3305bc)[_0x91d8('0x29')](handleEntityNotFound(_0x4a8945,null))['then'](respondWithResult(_0x4a8945,null))[_0x91d8('0x4a')](handleError(_0x4a8945,null));};exports['create']=function(_0x2f0eaf,_0x28b416){return db[_0x91d8('0x30')][_0x91d8('0x4c')](_0x2f0eaf[_0x91d8('0x4d')],{})[_0x91d8('0x29')](respondWithResult(_0x28b416,0xc9))['catch'](handleError(_0x28b416,null));};exports[_0x91d8('0x4e')]=function(_0x6b8ffe,_0x4ac41a){if(_0x6b8ffe['body']['id']){delete _0x6b8ffe[_0x91d8('0x4d')]['id'];}return db[_0x91d8('0x30')][_0x91d8('0x4b')]({'where':{'id':_0x6b8ffe['params']['id']}})[_0x91d8('0x29')](handleEntityNotFound(_0x4ac41a,null))['then'](saveUpdates(_0x6b8ffe[_0x91d8('0x4d')],null))['then'](respondWithResult(_0x4ac41a,null))[_0x91d8('0x4a')](handleError(_0x4ac41a,null));};exports[_0x91d8('0x28')]=function(_0x1ed525,_0x27c023){return db[_0x91d8('0x30')][_0x91d8('0x4b')]({'where':{'id':_0x1ed525[_0x91d8('0x4f')]['id']}})[_0x91d8('0x29')](handleEntityNotFound(_0x27c023,null))[_0x91d8('0x29')](removeEntity(_0x27c023,null))[_0x91d8('0x4a')](handleError(_0x27c023,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 17348f7..69e7113 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 _0x0f3a=['lodash','util','../../config/logger','api','request-promise','path','./intServicenowField.attributes','ServicenowField','servicenow_unique_index','idField','FieldId'];(function(_0x16ae34,_0x1dc6d){var _0x184836=function(_0x1e48b7){while(--_0x1e48b7){_0x16ae34['push'](_0x16ae34['shift']());}};_0x184836(++_0x1dc6d);}(_0x0f3a,0x134));var _0xa0f3=function(_0x52abed,_0x4e6380){_0x52abed=_0x52abed-0x0;var _0x3dba06=_0x0f3a[_0x52abed];return _0x3dba06;};'use strict';var _=require(_0xa0f3('0x0'));var util=require(_0xa0f3('0x1'));var logger=require(_0xa0f3('0x2'))(_0xa0f3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa0f3('0x4'));var fs=require('fs');var path=require(_0xa0f3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa0f3('0x6'));module['exports']=function(_0xb5ee6a,_0x7a0c31){return _0xb5ee6a['define'](_0xa0f3('0x7'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xa0f3('0x8'),'fields':[_0xa0f3('0x9'),_0xa0f3('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0880=['servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0880,0x16b));var _0x0088=function(_0x1fb038,_0xc3f69b){_0x1fb038=_0x1fb038-0x0;var _0x1600dc=_0x0880[_0x1fb038];return _0x1600dc;};'use strict';var _=require(_0x0088('0x0'));var util=require(_0x0088('0x1'));var logger=require('../../config/logger')(_0x0088('0x2'));var moment=require(_0x0088('0x3'));var BPromise=require(_0x0088('0x4'));var rp=require(_0x0088('0x5'));var fs=require('fs');var path=require(_0x0088('0x6'));var rimraf=require('rimraf');var config=require(_0x0088('0x7'));var attributes=require(_0x0088('0x8'));module[_0x0088('0x9')]=function(_0x2d302c,_0x4b22e8){return _0x2d302c[_0x0088('0xa')](_0x0088('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x0088('0xc'),'fields':[_0x0088('0xd'),_0x0088('0xe')],'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 3733b8c..ad2b8c7 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 _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(_0x47b900,_0x1a8c14){var _0x4eacfa=function(_0x24767f){while(--_0x24767f){_0x47b900['push'](_0x47b900['shift']());}};_0x4eacfa(++_0x1a8c14);}(_0xaa88,0x137));var _0x8aa8=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0xaa88[_0x5a7d5f];return _0x5dcded;};'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 +var _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x1e3fac,_0xa43e1d){var _0x596d94=function(_0x91e510){while(--_0x91e510){_0x1e3fac['push'](_0x1e3fac['shift']());}};_0x596d94(++_0xa43e1d);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1782ce,_0x248d45){_0x1782ce=_0x1782ce-0x0;var _0x21b855=_0x9ffd[_0x1782ce];return _0x21b855;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index c09192a..1b5ce19 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(_0x3fe4fa,_0x2a5538){var _0x2c087e=function(_0x1da4c2){while(--_0x1da4c2){_0x3fe4fa['push'](_0x3fe4fa['shift']());}};_0x2c087e(++_0x2a5538);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x196bfc,_0x10ff6e){var _0x5a032f=function(_0x28ffb){while(--_0x28ffb){_0x196bfc['push'](_0x196bfc['shift']());}};_0x5a032f(++_0x10ff6e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 c4f29c3..59086d8 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(_0x3279d4,_0x33d320){var _0x3bf6f0=function(_0xa039b4){while(--_0xa039b4){_0x3279d4['push'](_0x3279d4['shift']());}};_0x3bf6f0(++_0x33d320);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0xc4b405,_0x230ff6){var _0x5ea0a9=function(_0x5105f2){while(--_0x5105f2){_0xc4b405['push'](_0xc4b405['shift']());}};_0x5ea0a9(++_0x230ff6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 273fb24..a667aa5 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 _0x9cbe=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SugarcrmAccount','findAll','catch','show','params','fields','length','includeAll','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','description','date_start','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','stringify','values','module_fields','includes','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','limit','undefined','count'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9cbe,0xcb));var _0xe9cb=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x9cbe[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9cb('0x0'));var zipdir=require(_0xe9cb('0x1'));var jsonpatch=require(_0xe9cb('0x2'));var rp=require('request-promise');var moment=require(_0xe9cb('0x3'));var BPromise=require(_0xe9cb('0x4'));var Mustache=require('mustache');var util=require(_0xe9cb('0x5'));var path=require(_0xe9cb('0x6'));var sox=require(_0xe9cb('0x7'));var csv=require('to-csv');var ejs=require(_0xe9cb('0x8'));var fs=require('fs');var fs_extra=require(_0xe9cb('0x9'));var _=require(_0xe9cb('0xa'));var squel=require(_0xe9cb('0xb'));var crypto=require(_0xe9cb('0xc'));var jsforce=require(_0xe9cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe9cb('0xe'));var querystring=require('querystring');var Papa=require(_0xe9cb('0xf'));var Redis=require(_0xe9cb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9cb('0x11'));var hardwareService=require(_0xe9cb('0x12'));var logger=require(_0xe9cb('0x13'))('api');var utils=require(_0xe9cb('0x14'));var config=require(_0xe9cb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9cb('0x16'))['db'];var integrations=require(_0xe9cb('0x17'));function respondWithStatusCode(_0x481516,_0x36f310){_0x36f310=_0x36f310||0xcc;return function(_0x128f57){if(_0x128f57){return _0x481516[_0xe9cb('0x18')](_0x36f310);}return _0x481516['status'](_0x36f310)[_0xe9cb('0x19')]();};}function respondWithResult(_0x1fc4f9,_0x374f9d){_0x374f9d=_0x374f9d||0xc8;return function(_0x5119ec){if(_0x5119ec){return _0x1fc4f9[_0xe9cb('0x1a')](_0x374f9d)['json'](_0x5119ec);}};}function respondWithFilteredResult(_0x56a291,_0x1da900){return function(_0x40005e){if(_0x40005e){var _0x10207e=typeof _0x1da900[_0xe9cb('0x1b')]==='undefined'&&typeof _0x1da900[_0xe9cb('0x1c')]===_0xe9cb('0x1d');var _0x41c390=_0x40005e['count'];var _0x57b73b=_0x10207e?0x0:_0x1da900[_0xe9cb('0x1b')];var _0x2a66ca=_0x10207e?_0x40005e[_0xe9cb('0x1e')]:_0x1da900[_0xe9cb('0x1b')]+_0x1da900[_0xe9cb('0x1c')];var _0x52ae90;if(_0x2a66ca>=_0x41c390){_0x2a66ca=_0x41c390;_0x52ae90=0xc8;}else{_0x52ae90=0xce;}_0x56a291[_0xe9cb('0x1a')](_0x52ae90);return _0x56a291[_0xe9cb('0x1f')](_0xe9cb('0x20'),_0x57b73b+'-'+_0x2a66ca+'/'+_0x41c390)['json'](_0x40005e);}return null;};}function patchUpdates(_0x2234b7){return function(_0x38929d){try{jsonpatch[_0xe9cb('0x21')](_0x38929d,_0x2234b7,!![]);}catch(_0x538138){return BPromise[_0xe9cb('0x22')](_0x538138);}return _0x38929d[_0xe9cb('0x23')]();};}function saveUpdates(_0x2dc742,_0x420bfa){return function(_0x110f4c){if(_0x110f4c){return _0x110f4c[_0xe9cb('0x24')](_0x2dc742)[_0xe9cb('0x25')](function(_0x51549d){return _0x51549d;});}return null;};}function removeEntity(_0x47a819,_0xc731da){return function(_0x62f13d){if(_0x62f13d){return _0x62f13d[_0xe9cb('0x26')]()[_0xe9cb('0x25')](function(){_0x47a819[_0xe9cb('0x1a')](0xcc)[_0xe9cb('0x19')]();});}};}function handleEntityNotFound(_0x2d18e0,_0xb18161){return function(_0x3dd65c){if(!_0x3dd65c){_0x2d18e0[_0xe9cb('0x18')](0x194);}return _0x3dd65c;};}function handleError(_0x515a14,_0x23a3c1){_0x23a3c1=_0x23a3c1||0x1f4;return function(_0x4abbb2){logger[_0xe9cb('0x27')](_0x4abbb2[_0xe9cb('0x28')]);if(_0x4abbb2[_0xe9cb('0x29')]){delete _0x4abbb2[_0xe9cb('0x29')];}_0x515a14[_0xe9cb('0x1a')](_0x23a3c1)[_0xe9cb('0x2a')](_0x4abbb2);};}exports['index']=function(_0x5b26c9,_0x42f339){var _0x186632={},_0x258e98={},_0x184e15={'count':0x0,'rows':[]};var _0x3e8f89=_[_0xe9cb('0x2b')](db['SugarcrmAccount'][_0xe9cb('0x2c')],function(_0x532b41){return{'name':_0x532b41[_0xe9cb('0x2d')],'type':_0x532b41[_0xe9cb('0x2e')][_0xe9cb('0x2f')]};});_0x258e98[_0xe9cb('0x30')]=_['map'](_0x3e8f89,_0xe9cb('0x29'));_0x258e98[_0xe9cb('0x31')]=_[_0xe9cb('0x32')](_0x5b26c9[_0xe9cb('0x31')]);_0x258e98[_0xe9cb('0x33')]=_[_0xe9cb('0x34')](_0x258e98[_0xe9cb('0x30')],_0x258e98[_0xe9cb('0x31')]);_0x186632['attributes']=_[_0xe9cb('0x34')](_0x258e98[_0xe9cb('0x30')],qs['fields'](_0x5b26c9[_0xe9cb('0x31')]['fields']));_0x186632[_0xe9cb('0x35')]=_0x186632['attributes']['length']?_0x186632[_0xe9cb('0x35')]:_0x258e98[_0xe9cb('0x30')];if(!_0x5b26c9[_0xe9cb('0x31')][_0xe9cb('0x36')](_0xe9cb('0x37'))){_0x186632[_0xe9cb('0x1c')]=qs[_0xe9cb('0x1c')](_0x5b26c9['query'][_0xe9cb('0x1c')]);_0x186632[_0xe9cb('0x1b')]=qs[_0xe9cb('0x1b')](_0x5b26c9[_0xe9cb('0x31')][_0xe9cb('0x1b')]);}_0x186632[_0xe9cb('0x38')]=qs[_0xe9cb('0x39')](_0x5b26c9[_0xe9cb('0x31')]['sort']);_0x186632[_0xe9cb('0x3a')]=qs[_0xe9cb('0x33')](_[_0xe9cb('0x3b')](_0x5b26c9[_0xe9cb('0x31')],_0x258e98[_0xe9cb('0x33')]),_0x3e8f89);if(_0x5b26c9[_0xe9cb('0x31')]['filter']){_0x186632[_0xe9cb('0x3a')]=_[_0xe9cb('0x3c')](_0x186632[_0xe9cb('0x3a')],{'$or':_['map'](_0x3e8f89,function(_0xf3bcf9){if(_0xf3bcf9[_0xe9cb('0x2e')]!==_0xe9cb('0x3d')){var _0x53cd43={};_0x53cd43[_0xf3bcf9['name']]={'$like':'%'+_0x5b26c9['query'][_0xe9cb('0x3e')]+'%'};return _0x53cd43;}})});}_0x186632=_[_0xe9cb('0x3c')]({},_0x186632,_0x5b26c9[_0xe9cb('0x3f')]);var _0x5cc7eb={'where':_0x186632[_0xe9cb('0x3a')]};return db[_0xe9cb('0x40')]['count'](_0x5cc7eb)[_0xe9cb('0x25')](function(_0x2d5325){_0x184e15['count']=_0x2d5325;if(_0x5b26c9[_0xe9cb('0x31')]['includeAll']){_0x186632['include']=[{'all':!![]}];}return db[_0xe9cb('0x40')][_0xe9cb('0x41')](_0x186632);})[_0xe9cb('0x25')](function(_0x5de5b9){_0x184e15['rows']=_0x5de5b9;return _0x184e15;})[_0xe9cb('0x25')](respondWithFilteredResult(_0x42f339,_0x186632))[_0xe9cb('0x42')](handleError(_0x42f339,null));};exports[_0xe9cb('0x43')]=function(_0x384d5c,_0x5863b9){var _0x255019={'raw':![],'where':{'id':_0x384d5c[_0xe9cb('0x44')]['id']}},_0x1db92f={};_0x1db92f[_0xe9cb('0x30')]=_[_0xe9cb('0x32')](db[_0xe9cb('0x40')]['rawAttributes']);_0x1db92f[_0xe9cb('0x31')]=_[_0xe9cb('0x32')](_0x384d5c[_0xe9cb('0x31')]);_0x1db92f[_0xe9cb('0x33')]=_[_0xe9cb('0x34')](_0x1db92f['model'],_0x1db92f[_0xe9cb('0x31')]);_0x255019[_0xe9cb('0x35')]=_[_0xe9cb('0x34')](_0x1db92f['model'],qs['fields'](_0x384d5c[_0xe9cb('0x31')][_0xe9cb('0x45')]));_0x255019[_0xe9cb('0x35')]=_0x255019['attributes'][_0xe9cb('0x46')]?_0x255019[_0xe9cb('0x35')]:_0x1db92f[_0xe9cb('0x30')];if(_0x384d5c[_0xe9cb('0x31')][_0xe9cb('0x47')]){_0x255019['include']=[{'all':!![]}];}_0x255019=_[_0xe9cb('0x3c')]({},_0x255019,_0x384d5c[_0xe9cb('0x3f')]);return db[_0xe9cb('0x40')][_0xe9cb('0x48')](_0x255019)[_0xe9cb('0x25')](handleEntityNotFound(_0x5863b9,null))[_0xe9cb('0x25')](respondWithResult(_0x5863b9,null))[_0xe9cb('0x42')](handleError(_0x5863b9,null));};exports[_0xe9cb('0x49')]=function(_0x367cf6,_0x286f23){return db['SugarcrmAccount'][_0xe9cb('0x49')](_0x367cf6[_0xe9cb('0x4a')],{})[_0xe9cb('0x25')](respondWithResult(_0x286f23,0xc9))[_0xe9cb('0x42')](handleError(_0x286f23,null));};exports['update']=function(_0x2254e1,_0x49f15e){if(_0x2254e1[_0xe9cb('0x4a')]['id']){delete _0x2254e1[_0xe9cb('0x4a')]['id'];}return db[_0xe9cb('0x40')][_0xe9cb('0x48')]({'where':{'id':_0x2254e1['params']['id']}})[_0xe9cb('0x25')](handleEntityNotFound(_0x49f15e,null))[_0xe9cb('0x25')](saveUpdates(_0x2254e1[_0xe9cb('0x4a')],null))['then'](respondWithResult(_0x49f15e,null))[_0xe9cb('0x42')](handleError(_0x49f15e,null));};exports[_0xe9cb('0x26')]=function(_0x4be300,_0x5d9bc6){return db['SugarcrmAccount'][_0xe9cb('0x48')]({'where':{'id':_0x4be300[_0xe9cb('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d9bc6,null))['then'](removeEntity(_0x5d9bc6,null))[_0xe9cb('0x42')](handleError(_0x5d9bc6,null));};exports[_0xe9cb('0x4b')]=function(_0x138b24,_0x2754ea,_0x6ee8a7){var _0x490d15={};var _0x447afa={};var _0x21b363;var _0x535085;return db[_0xe9cb('0x40')][_0xe9cb('0x4c')]({'where':{'id':_0x138b24[_0xe9cb('0x44')]['id']}})['then'](handleEntityNotFound(_0x2754ea,null))[_0xe9cb('0x25')](function(_0x5d16f5){if(_0x5d16f5){_0x21b363=_0x5d16f5;_0x447afa['model']=_[_0xe9cb('0x32')](db[_0xe9cb('0x4d')]['rawAttributes']);_0x447afa[_0xe9cb('0x31')]=_[_0xe9cb('0x32')](_0x138b24[_0xe9cb('0x31')]);_0x447afa[_0xe9cb('0x33')]=_['intersection'](_0x447afa[_0xe9cb('0x30')],_0x447afa['query']);_0x490d15[_0xe9cb('0x35')]=_[_0xe9cb('0x34')](_0x447afa[_0xe9cb('0x30')],qs[_0xe9cb('0x45')](_0x138b24['query'][_0xe9cb('0x45')]));_0x490d15[_0xe9cb('0x35')]=_0x490d15[_0xe9cb('0x35')][_0xe9cb('0x46')]?_0x490d15[_0xe9cb('0x35')]:_0x447afa[_0xe9cb('0x30')];_0x490d15[_0xe9cb('0x38')]=qs[_0xe9cb('0x39')](_0x138b24[_0xe9cb('0x31')]['sort']);_0x490d15['where']=qs[_0xe9cb('0x33')](_['pick'](_0x138b24[_0xe9cb('0x31')],_0x447afa['filters']));if(_0x138b24[_0xe9cb('0x31')][_0xe9cb('0x3e')]){_0x490d15['where']=_['merge'](_0x490d15['where'],{'$or':_[_0xe9cb('0x2b')](_0x490d15[_0xe9cb('0x35')],function(_0x10c8be){var _0x1fc01d={};_0x1fc01d[_0x10c8be]={'$like':'%'+_0x138b24[_0xe9cb('0x31')][_0xe9cb('0x3e')]+'%'};return _0x1fc01d;})});}_0x490d15=_[_0xe9cb('0x3c')]({},_0x490d15,_0x138b24[_0xe9cb('0x3f')]);return _0x21b363[_0xe9cb('0x4b')](_0x490d15);}})[_0xe9cb('0x25')](function(_0x44468b){if(_0x44468b){_0x535085=_0x44468b[_0xe9cb('0x46')];if(!_0x138b24['query'][_0xe9cb('0x36')](_0xe9cb('0x37'))){_0x490d15['limit']=qs[_0xe9cb('0x1c')](_0x138b24['query'][_0xe9cb('0x1c')]);_0x490d15[_0xe9cb('0x1b')]=qs[_0xe9cb('0x1b')](_0x138b24[_0xe9cb('0x31')][_0xe9cb('0x1b')]);}return _0x21b363['getConfigurations'](_0x490d15);}})[_0xe9cb('0x25')](function(_0x591458){if(_0x591458){return _0x591458?{'count':_0x535085,'rows':_0x591458}:null;}})['then'](respondWithResult(_0x2754ea,null))[_0xe9cb('0x42')](handleError(_0x2754ea,null));};exports[_0xe9cb('0x4e')]=function(_0x167d71,_0x2e66dc,_0x28ce3a){if(_0x167d71[_0xe9cb('0x4a')]['id']){delete _0x167d71[_0xe9cb('0x4a')]['id'];}return db[_0xe9cb('0x40')]['findOne']({'where':{'id':_0x167d71[_0xe9cb('0x44')]['id']}})[_0xe9cb('0x25')](handleEntityNotFound(_0x2e66dc,null))['then'](function(_0x3744a5){if(_0x3744a5){_0x167d71[_0xe9cb('0x4a')]['AccountId']=_0x3744a5['id'];_0x167d71['body']['Subjects']=integrations[_0xe9cb('0x4f')](_0x167d71[_0xe9cb('0x4a')][_0xe9cb('0x50')],_0x167d71[_0xe9cb('0x4a')]['type']);_0x167d71[_0xe9cb('0x4a')][_0xe9cb('0x51')]=integrations[_0xe9cb('0x52')](_0x167d71[_0xe9cb('0x4a')][_0xe9cb('0x50')],_0x167d71[_0xe9cb('0x4a')]['type']);return db['SugarcrmConfiguration'][_0xe9cb('0x49')](_0x167d71[_0xe9cb('0x4a')],{'include':[{'model':db[_0xe9cb('0x53')],'as':_0xe9cb('0x54')},{'model':db[_0xe9cb('0x53')],'as':_0xe9cb('0x51')}]});}return null;})['then'](respondWithResult(_0x2e66dc,null))[_0xe9cb('0x42')](handleError(_0x2e66dc,null));};exports[_0xe9cb('0x55')]=function(_0x27a0ce,_0x1af4f5,_0x4549a0){var _0x53c5dc='';var _0x4558bf=['id',_0xe9cb('0x29'),_0xe9cb('0x56'),'created_by',_0xe9cb('0x57'),_0xe9cb('0x58'),'duration_hours',_0xe9cb('0x59'),_0xe9cb('0x5a'),'parent_type',_0xe9cb('0x5b'),_0xe9cb('0x5c')];return db[_0xe9cb('0x40')][_0xe9cb('0x4c')]({'where':{'id':_0x27a0ce['params']['id']},'attributes':['id',_0xe9cb('0x5d'),_0xe9cb('0x5e'),_0xe9cb('0x5f')]})[_0xe9cb('0x25')](handleEntityNotFound(_0x1af4f5,null))[_0xe9cb('0x25')](function(_0x1e66c4){if(_0x1e66c4){_0x53c5dc=_0x1e66c4[_0xe9cb('0x5f')];var _0x433d79=_0x53c5dc[_0xe9cb('0x60')](-0x1);if(_0x433d79==='/'){_0x53c5dc=_0x53c5dc[_0xe9cb('0x61')](0x0,_0x53c5dc[_0xe9cb('0x62')](_0x433d79));}return rp({'method':_0xe9cb('0x63'),'uri':util[_0xe9cb('0x64')](_0xe9cb('0x65'),_0x53c5dc,_0xe9cb('0x66')),'json':!![],'form':{'method':_0xe9cb('0x67'),'input_type':_0xe9cb('0x68'),'response_type':_0xe9cb('0x68'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1e66c4[_0xe9cb('0x5d')],'password':_0x1e66c4[_0xe9cb('0x5e')],'encryption':_0xe9cb('0x69')},'application':_0xe9cb('0x6a')})}});}})[_0xe9cb('0x25')](function(_0xb58b1b){if(_0xb58b1b&&_0xb58b1b[_0xe9cb('0x29')]!==_0xe9cb('0x6b')&&_0xb58b1b[_0xe9cb('0x29')]!=='Password\x20Expired'){return rp({'method':_0xe9cb('0x63'),'uri':util[_0xe9cb('0x64')](_0xe9cb('0x65'),_0x53c5dc,_0xe9cb('0x66')),'json':!![],'form':{'method':_0xe9cb('0x6c'),'input_type':_0xe9cb('0x68'),'response_type':'JSON','rest_data':JSON[_0xe9cb('0x6d')]({'session':_0xb58b1b['id'],'module_name':'Calls'})}})[_0xe9cb('0x25')](function(_0x5da3ad){if(_0x5da3ad){var _0x61b058=_[_0xe9cb('0x6e')](_0x5da3ad[_0xe9cb('0x6f')]);_['remove'](_0x61b058,function(_0x23564b){return _0x4558bf[_0xe9cb('0x70')](_0x23564b['name']);});return{'count':_0x61b058[_0xe9cb('0x46')],'rows':_[_0xe9cb('0x2b')](_0x61b058,function(_0x19b44a){return{'id':_0x19b44a[_0xe9cb('0x29')],'name':_0x19b44a['label'],'custom':_['endsWith'](_0x19b44a[_0xe9cb('0x29')],'_c')?!![]:![],'options':_0x19b44a[_0xe9cb('0x3f')]?_[_0xe9cb('0x2b')](_['values'](_0x19b44a[_0xe9cb('0x3f')]),function(_0x109859){return{'name':_0x109859['value'],'value':_0x109859[_0xe9cb('0x29')]};}):[]};})};}})[_0xe9cb('0x25')](respondWithResult(_0x1af4f5,null))[_0xe9cb('0x42')](function(_0x1cf0cd){var _0x3f1f3c=_0x27a0ce[_0xe9cb('0x31')]['test']?0x1f4:_0x1cf0cd['statusCode']||0x1f4;logger[_0xe9cb('0x27')](_0xe9cb('0x71'),'getFields',_0x3f1f3c,JSON[_0xe9cb('0x6d')](_0x1cf0cd));delete _0x1cf0cd['name'];if(_0x3f1f3c===0x191){_0x3f1f3c=0x190;}_0x1af4f5['status'](_0x3f1f3c)[_0xe9cb('0x2a')](_0x27a0ce[_0xe9cb('0x31')][_0xe9cb('0x72')]?{'message':_0xe9cb('0x73'),'statusCode':_0x1cf0cd[_0xe9cb('0x74')]}:_0x1cf0cd);});}else{var _0x1726a4=0x1f4;_0x1af4f5[_0xe9cb('0x1a')](_0x1726a4)[_0xe9cb('0x2a')]({'message':_0xe9cb('0x73'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xffba=['nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','keys','length','include','catch','create','body','find','params','getConfigurations','findOne','SugarcrmConfiguration','rawAttributes','order','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Calls','module_fields','remove','includes','label','endsWith','values','value','getFields','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','crypto','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','SugarcrmAccount','type','key','model','filters','intersection','query','attributes','fields','hasOwnProperty'];(function(_0x2a723e,_0x61bb43){var _0x48a0e1=function(_0x470e57){while(--_0x470e57){_0x2a723e['push'](_0x2a723e['shift']());}};_0x48a0e1(++_0x61bb43);}(_0xffba,0x19b));var _0xaffb=function(_0x59b2e9,_0x1497aa){_0x59b2e9=_0x59b2e9-0x0;var _0x17c132=_0xffba[_0x59b2e9];return _0x17c132;};'use strict';var emlformat=require(_0xaffb('0x0'));var rimraf=require(_0xaffb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaffb('0x2'));var rp=require(_0xaffb('0x3'));var moment=require(_0xaffb('0x4'));var BPromise=require(_0xaffb('0x5'));var Mustache=require('mustache');var util=require(_0xaffb('0x6'));var path=require('path');var sox=require(_0xaffb('0x7'));var csv=require(_0xaffb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaffb('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xaffb('0xa'));var toCsv=require(_0xaffb('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaffb('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaffb('0xc'));var logger=require(_0xaffb('0xd'))(_0xaffb('0xe'));var utils=require(_0xaffb('0xf'));var config=require(_0xaffb('0x10'));var licenseUtil=require(_0xaffb('0x11'));var db=require(_0xaffb('0x12'))['db'];var integrations=require(_0xaffb('0x13'));function respondWithStatusCode(_0x4398cb,_0x16e652){_0x16e652=_0x16e652||0xcc;return function(_0x19d8aa){if(_0x19d8aa){return _0x4398cb[_0xaffb('0x14')](_0x16e652);}return _0x4398cb['status'](_0x16e652)[_0xaffb('0x15')]();};}function respondWithResult(_0x48a184,_0x5cb01e){_0x5cb01e=_0x5cb01e||0xc8;return function(_0x1bf86b){if(_0x1bf86b){return _0x48a184['status'](_0x5cb01e)['json'](_0x1bf86b);}};}function respondWithFilteredResult(_0x4631d0,_0xe2e4be){return function(_0x134ddc){if(_0x134ddc){var _0x4f5153=typeof _0xe2e4be[_0xaffb('0x16')]===_0xaffb('0x17')&&typeof _0xe2e4be[_0xaffb('0x18')]===_0xaffb('0x17');var _0x33c2e8=_0x134ddc[_0xaffb('0x19')];var _0x46e119=_0x4f5153?0x0:_0xe2e4be['offset'];var _0x2ab183=_0x4f5153?_0x134ddc[_0xaffb('0x19')]:_0xe2e4be[_0xaffb('0x16')]+_0xe2e4be[_0xaffb('0x18')];var _0x9509a1;if(_0x2ab183>=_0x33c2e8){_0x2ab183=_0x33c2e8;_0x9509a1=0xc8;}else{_0x9509a1=0xce;}_0x4631d0[_0xaffb('0x1a')](_0x9509a1);return _0x4631d0[_0xaffb('0x1b')](_0xaffb('0x1c'),_0x46e119+'-'+_0x2ab183+'/'+_0x33c2e8)['json'](_0x134ddc);}return null;};}function patchUpdates(_0x2525ce){return function(_0x6196a1){try{jsonpatch[_0xaffb('0x1d')](_0x6196a1,_0x2525ce,!![]);}catch(_0x233043){return BPromise[_0xaffb('0x1e')](_0x233043);}return _0x6196a1['save']();};}function saveUpdates(_0x25c9a4,_0x40207a){return function(_0x3cc168){if(_0x3cc168){return _0x3cc168[_0xaffb('0x1f')](_0x25c9a4)[_0xaffb('0x20')](function(_0x112c5f){return _0x112c5f;});}return null;};}function removeEntity(_0x311d28,_0x4275bd){return function(_0x125234){if(_0x125234){return _0x125234[_0xaffb('0x21')]()[_0xaffb('0x20')](function(){_0x311d28['status'](0xcc)[_0xaffb('0x15')]();});}};}function handleEntityNotFound(_0x58e28b,_0x1b50b1){return function(_0x3c0d5a){if(!_0x3c0d5a){_0x58e28b[_0xaffb('0x14')](0x194);}return _0x3c0d5a;};}function handleError(_0xfb3910,_0x5d1c47){_0x5d1c47=_0x5d1c47||0x1f4;return function(_0x508995){logger['error'](_0x508995[_0xaffb('0x22')]);if(_0x508995[_0xaffb('0x23')]){delete _0x508995[_0xaffb('0x23')];}_0xfb3910[_0xaffb('0x1a')](_0x5d1c47)[_0xaffb('0x24')](_0x508995);};}exports[_0xaffb('0x25')]=function(_0x318a07,_0x553e5c){var _0x12960f={},_0xb8dfb8={},_0x3b24e3={'count':0x0,'rows':[]};var _0x35b7de=_[_0xaffb('0x26')](db[_0xaffb('0x27')]['rawAttributes'],function(_0x348763){return{'name':_0x348763['fieldName'],'type':_0x348763[_0xaffb('0x28')][_0xaffb('0x29')]};});_0xb8dfb8[_0xaffb('0x2a')]=_[_0xaffb('0x26')](_0x35b7de,_0xaffb('0x23'));_0xb8dfb8['query']=_['keys'](_0x318a07['query']);_0xb8dfb8[_0xaffb('0x2b')]=_[_0xaffb('0x2c')](_0xb8dfb8['model'],_0xb8dfb8[_0xaffb('0x2d')]);_0x12960f[_0xaffb('0x2e')]=_['intersection'](_0xb8dfb8[_0xaffb('0x2a')],qs[_0xaffb('0x2f')](_0x318a07[_0xaffb('0x2d')][_0xaffb('0x2f')]));_0x12960f[_0xaffb('0x2e')]=_0x12960f[_0xaffb('0x2e')]['length']?_0x12960f[_0xaffb('0x2e')]:_0xb8dfb8[_0xaffb('0x2a')];if(!_0x318a07[_0xaffb('0x2d')][_0xaffb('0x30')](_0xaffb('0x31'))){_0x12960f[_0xaffb('0x18')]=qs['limit'](_0x318a07[_0xaffb('0x2d')][_0xaffb('0x18')]);_0x12960f[_0xaffb('0x16')]=qs[_0xaffb('0x16')](_0x318a07[_0xaffb('0x2d')][_0xaffb('0x16')]);}_0x12960f['order']=qs[_0xaffb('0x32')](_0x318a07[_0xaffb('0x2d')]['sort']);_0x12960f[_0xaffb('0x33')]=qs[_0xaffb('0x2b')](_['pick'](_0x318a07[_0xaffb('0x2d')],_0xb8dfb8['filters']),_0x35b7de);if(_0x318a07[_0xaffb('0x2d')]['filter']){_0x12960f['where']=_[_0xaffb('0x34')](_0x12960f[_0xaffb('0x33')],{'$or':_[_0xaffb('0x26')](_0x35b7de,function(_0x34fd1a){if(_0x34fd1a[_0xaffb('0x28')]!==_0xaffb('0x35')){var _0x36f344={};_0x36f344[_0x34fd1a[_0xaffb('0x23')]]={'$like':'%'+_0x318a07[_0xaffb('0x2d')][_0xaffb('0x36')]+'%'};return _0x36f344;}})});}_0x12960f=_[_0xaffb('0x34')]({},_0x12960f,_0x318a07[_0xaffb('0x37')]);var _0x3e9394={'where':_0x12960f[_0xaffb('0x33')]};return db['SugarcrmAccount'][_0xaffb('0x19')](_0x3e9394)['then'](function(_0x282b11){_0x3b24e3[_0xaffb('0x19')]=_0x282b11;if(_0x318a07[_0xaffb('0x2d')][_0xaffb('0x38')]){_0x12960f['include']=[{'all':!![]}];}return db[_0xaffb('0x27')][_0xaffb('0x39')](_0x12960f);})['then'](function(_0x538619){_0x3b24e3[_0xaffb('0x3a')]=_0x538619;return _0x3b24e3;})[_0xaffb('0x20')](respondWithFilteredResult(_0x553e5c,_0x12960f))['catch'](handleError(_0x553e5c,null));};exports[_0xaffb('0x3b')]=function(_0x55357d,_0x329eed){var _0x4bd019={'raw':![],'where':{'id':_0x55357d['params']['id']}},_0x3d7dae={};_0x3d7dae[_0xaffb('0x2a')]=_[_0xaffb('0x3c')](db[_0xaffb('0x27')]['rawAttributes']);_0x3d7dae[_0xaffb('0x2d')]=_[_0xaffb('0x3c')](_0x55357d[_0xaffb('0x2d')]);_0x3d7dae['filters']=_[_0xaffb('0x2c')](_0x3d7dae['model'],_0x3d7dae[_0xaffb('0x2d')]);_0x4bd019[_0xaffb('0x2e')]=_['intersection'](_0x3d7dae[_0xaffb('0x2a')],qs[_0xaffb('0x2f')](_0x55357d[_0xaffb('0x2d')][_0xaffb('0x2f')]));_0x4bd019[_0xaffb('0x2e')]=_0x4bd019[_0xaffb('0x2e')][_0xaffb('0x3d')]?_0x4bd019[_0xaffb('0x2e')]:_0x3d7dae[_0xaffb('0x2a')];if(_0x55357d[_0xaffb('0x2d')][_0xaffb('0x38')]){_0x4bd019[_0xaffb('0x3e')]=[{'all':!![]}];}_0x4bd019=_[_0xaffb('0x34')]({},_0x4bd019,_0x55357d['options']);return db[_0xaffb('0x27')]['find'](_0x4bd019)[_0xaffb('0x20')](handleEntityNotFound(_0x329eed,null))[_0xaffb('0x20')](respondWithResult(_0x329eed,null))[_0xaffb('0x3f')](handleError(_0x329eed,null));};exports[_0xaffb('0x40')]=function(_0x28b96d,_0x571728){return db[_0xaffb('0x27')][_0xaffb('0x40')](_0x28b96d[_0xaffb('0x41')],{})[_0xaffb('0x20')](respondWithResult(_0x571728,0xc9))['catch'](handleError(_0x571728,null));};exports[_0xaffb('0x1f')]=function(_0x5e42f3,_0x529ffb){if(_0x5e42f3[_0xaffb('0x41')]['id']){delete _0x5e42f3[_0xaffb('0x41')]['id'];}return db[_0xaffb('0x27')][_0xaffb('0x42')]({'where':{'id':_0x5e42f3[_0xaffb('0x43')]['id']}})[_0xaffb('0x20')](handleEntityNotFound(_0x529ffb,null))['then'](saveUpdates(_0x5e42f3['body'],null))['then'](respondWithResult(_0x529ffb,null))[_0xaffb('0x3f')](handleError(_0x529ffb,null));};exports[_0xaffb('0x21')]=function(_0x2d89c5,_0x1b9c34){return db[_0xaffb('0x27')]['find']({'where':{'id':_0x2d89c5['params']['id']}})[_0xaffb('0x20')](handleEntityNotFound(_0x1b9c34,null))[_0xaffb('0x20')](removeEntity(_0x1b9c34,null))[_0xaffb('0x3f')](handleError(_0x1b9c34,null));};exports[_0xaffb('0x44')]=function(_0xfaa074,_0x33e7ea,_0x1c7086){var _0x573045={};var _0xa73331={};var _0x4f9583;var _0x458624;return db['SugarcrmAccount'][_0xaffb('0x45')]({'where':{'id':_0xfaa074[_0xaffb('0x43')]['id']}})[_0xaffb('0x20')](handleEntityNotFound(_0x33e7ea,null))[_0xaffb('0x20')](function(_0x3768cc){if(_0x3768cc){_0x4f9583=_0x3768cc;_0xa73331['model']=_[_0xaffb('0x3c')](db[_0xaffb('0x46')][_0xaffb('0x47')]);_0xa73331[_0xaffb('0x2d')]=_[_0xaffb('0x3c')](_0xfaa074[_0xaffb('0x2d')]);_0xa73331[_0xaffb('0x2b')]=_[_0xaffb('0x2c')](_0xa73331[_0xaffb('0x2a')],_0xa73331[_0xaffb('0x2d')]);_0x573045['attributes']=_[_0xaffb('0x2c')](_0xa73331[_0xaffb('0x2a')],qs[_0xaffb('0x2f')](_0xfaa074['query']['fields']));_0x573045[_0xaffb('0x2e')]=_0x573045['attributes'][_0xaffb('0x3d')]?_0x573045[_0xaffb('0x2e')]:_0xa73331[_0xaffb('0x2a')];_0x573045[_0xaffb('0x48')]=qs['sort'](_0xfaa074[_0xaffb('0x2d')][_0xaffb('0x32')]);_0x573045['where']=qs[_0xaffb('0x2b')](_['pick'](_0xfaa074['query'],_0xa73331[_0xaffb('0x2b')]));if(_0xfaa074['query']['filter']){_0x573045[_0xaffb('0x33')]=_[_0xaffb('0x34')](_0x573045[_0xaffb('0x33')],{'$or':_[_0xaffb('0x26')](_0x573045[_0xaffb('0x2e')],function(_0x4bb39a){var _0x51c74d={};_0x51c74d[_0x4bb39a]={'$like':'%'+_0xfaa074[_0xaffb('0x2d')][_0xaffb('0x36')]+'%'};return _0x51c74d;})});}_0x573045=_[_0xaffb('0x34')]({},_0x573045,_0xfaa074['options']);return _0x4f9583[_0xaffb('0x44')](_0x573045);}})[_0xaffb('0x20')](function(_0x31cfd1){if(_0x31cfd1){_0x458624=_0x31cfd1[_0xaffb('0x3d')];if(!_0xfaa074[_0xaffb('0x2d')][_0xaffb('0x30')](_0xaffb('0x31'))){_0x573045[_0xaffb('0x18')]=qs[_0xaffb('0x18')](_0xfaa074[_0xaffb('0x2d')][_0xaffb('0x18')]);_0x573045['offset']=qs[_0xaffb('0x16')](_0xfaa074[_0xaffb('0x2d')]['offset']);}return _0x4f9583[_0xaffb('0x44')](_0x573045);}})[_0xaffb('0x20')](function(_0x3a677c){if(_0x3a677c){return _0x3a677c?{'count':_0x458624,'rows':_0x3a677c}:null;}})[_0xaffb('0x20')](respondWithResult(_0x33e7ea,null))[_0xaffb('0x3f')](handleError(_0x33e7ea,null));};exports[_0xaffb('0x49')]=function(_0x1ab6d0,_0xa83e17,_0x9e2b0d){if(_0x1ab6d0['body']['id']){delete _0x1ab6d0[_0xaffb('0x41')]['id'];}return db[_0xaffb('0x27')][_0xaffb('0x45')]({'where':{'id':_0x1ab6d0[_0xaffb('0x43')]['id']}})[_0xaffb('0x20')](handleEntityNotFound(_0xa83e17,null))[_0xaffb('0x20')](function(_0x334efb){if(_0x334efb){_0x1ab6d0[_0xaffb('0x41')][_0xaffb('0x4a')]=_0x334efb['id'];_0x1ab6d0[_0xaffb('0x41')][_0xaffb('0x4b')]=integrations[_0xaffb('0x4c')](_0x1ab6d0[_0xaffb('0x41')]['channel'],_0x1ab6d0['body']['type']);_0x1ab6d0[_0xaffb('0x41')][_0xaffb('0x4d')]=integrations['getDescriptions'](_0x1ab6d0[_0xaffb('0x41')][_0xaffb('0x4e')],_0x1ab6d0[_0xaffb('0x41')][_0xaffb('0x28')]);return db[_0xaffb('0x46')][_0xaffb('0x40')](_0x1ab6d0[_0xaffb('0x41')],{'include':[{'model':db[_0xaffb('0x4f')],'as':_0xaffb('0x4b')},{'model':db['SugarcrmField'],'as':_0xaffb('0x4d')}]});}return null;})['then'](respondWithResult(_0xa83e17,null))[_0xaffb('0x3f')](handleError(_0xa83e17,null));};exports['getFields']=function(_0x4ebf8b,_0x463904,_0x1c6e5b){var _0x24f4e4='';var _0x32a3df=['id',_0xaffb('0x23'),_0xaffb('0x50'),_0xaffb('0x51'),_0xaffb('0x52'),_0xaffb('0x53'),_0xaffb('0x54'),_0xaffb('0x55'),_0xaffb('0x56'),_0xaffb('0x57'),'parent_name',_0xaffb('0x58')];return db[_0xaffb('0x27')][_0xaffb('0x45')]({'where':{'id':_0x4ebf8b[_0xaffb('0x43')]['id']},'attributes':['id',_0xaffb('0x59'),_0xaffb('0x5a'),_0xaffb('0x5b')]})[_0xaffb('0x20')](handleEntityNotFound(_0x463904,null))['then'](function(_0x459c8b){if(_0x459c8b){_0x24f4e4=_0x459c8b[_0xaffb('0x5b')];var _0x2c6f93=_0x24f4e4[_0xaffb('0x5c')](-0x1);if(_0x2c6f93==='/'){_0x24f4e4=_0x24f4e4[_0xaffb('0x5d')](0x0,_0x24f4e4[_0xaffb('0x5e')](_0x2c6f93));}return rp({'method':_0xaffb('0x5f'),'uri':util[_0xaffb('0x60')](_0xaffb('0x61'),_0x24f4e4,_0xaffb('0x62')),'json':!![],'form':{'method':_0xaffb('0x63'),'input_type':_0xaffb('0x64'),'response_type':'JSON','rest_data':JSON[_0xaffb('0x65')]({'user_auth':{'user_name':_0x459c8b[_0xaffb('0x59')],'password':_0x459c8b[_0xaffb('0x5a')],'encryption':_0xaffb('0x66')},'application':_0xaffb('0x67')})}});}})[_0xaffb('0x20')](function(_0x3b6bc1){if(_0x3b6bc1&&_0x3b6bc1[_0xaffb('0x23')]!==_0xaffb('0x68')&&_0x3b6bc1[_0xaffb('0x23')]!=='Password\x20Expired'){return rp({'method':_0xaffb('0x5f'),'uri':util[_0xaffb('0x60')](_0xaffb('0x61'),_0x24f4e4,_0xaffb('0x62')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xaffb('0x64'),'response_type':'JSON','rest_data':JSON[_0xaffb('0x65')]({'session':_0x3b6bc1['id'],'module_name':_0xaffb('0x69')})}})['then'](function(_0x148e58){if(_0x148e58){var _0x4b115c=_['values'](_0x148e58[_0xaffb('0x6a')]);_[_0xaffb('0x6b')](_0x4b115c,function(_0x4617a3){return _0x32a3df[_0xaffb('0x6c')](_0x4617a3[_0xaffb('0x23')]);});return{'count':_0x4b115c['length'],'rows':_[_0xaffb('0x26')](_0x4b115c,function(_0x3c65eb){return{'id':_0x3c65eb[_0xaffb('0x23')],'name':_0x3c65eb[_0xaffb('0x6d')],'custom':_[_0xaffb('0x6e')](_0x3c65eb[_0xaffb('0x23')],'_c')?!![]:![],'options':_0x3c65eb['options']?_[_0xaffb('0x26')](_[_0xaffb('0x6f')](_0x3c65eb[_0xaffb('0x37')]),function(_0x1b5510){return{'name':_0x1b5510[_0xaffb('0x70')],'value':_0x1b5510['name']};}):[]};})};}})[_0xaffb('0x20')](respondWithResult(_0x463904,null))['catch'](function(_0x14d122){var _0x41af64=_0x4ebf8b[_0xaffb('0x2d')]['test']?0x1f4:_0x14d122['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xaffb('0x71'),_0x41af64,JSON[_0xaffb('0x65')](_0x14d122));delete _0x14d122[_0xaffb('0x23')];if(_0x41af64===0x191){_0x41af64=0x190;}_0x463904['status'](_0x41af64)['send'](_0x4ebf8b[_0xaffb('0x2d')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x14d122[_0xaffb('0x72')]}:_0x14d122);});}else{var _0x3f309a=0x1f4;_0x463904[_0xaffb('0x1a')](_0x3f309a)[_0xaffb('0x24')]({'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 83407fb..76be5a9 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 _0xbd11=['SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xbd11,0xc5));var _0x1bd1=function(_0x241e61,_0x51e5ea){_0x241e61=_0x241e61-0x0;var _0x409de4=_0xbd11[_0x241e61];return _0x409de4;};'use strict';var _=require(_0x1bd1('0x0'));var util=require(_0x1bd1('0x1'));var logger=require('../../config/logger')(_0x1bd1('0x2'));var moment=require(_0x1bd1('0x3'));var BPromise=require(_0x1bd1('0x4'));var rp=require(_0x1bd1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1bd1('0x6'));var attributes=require(_0x1bd1('0x7'));var integrations=require(_0x1bd1('0x8'));module[_0x1bd1('0x9')]=function(_0x1db907,_0x2d40c5){return _0x1db907[_0x1bd1('0xa')](_0x1bd1('0xb'),attributes,{'tableName':_0x1bd1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2323=['int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x5c9f2d,_0xeee094){var _0x4007f0=function(_0xf9dac4){while(--_0xf9dac4){_0x5c9f2d['push'](_0x5c9f2d['shift']());}};_0x4007f0(++_0xeee094);}(_0x2323,0x7f));var _0x3232=function(_0x76faa4,_0x4a8b9c){_0x76faa4=_0x76faa4-0x0;var _0x5cab58=_0x2323[_0x76faa4];return _0x5cab58;};'use strict';var _=require(_0x3232('0x0'));var util=require('util');var logger=require(_0x3232('0x1'))(_0x3232('0x2'));var moment=require(_0x3232('0x3'));var BPromise=require(_0x3232('0x4'));var rp=require(_0x3232('0x5'));var fs=require('fs');var path=require(_0x3232('0x6'));var rimraf=require(_0x3232('0x7'));var config=require(_0x3232('0x8'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x3232('0x9'));module[_0x3232('0xa')]=function(_0x3a2c4f,_0x50a374){return _0x3a2c4f[_0x3232('0xb')](_0x3232('0xc'),attributes,{'tableName':_0x3232('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 1b1cdc1..f42b557 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 _0x77eb=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','error','code','message','SugarcrmAccount,\x20%s,\x20%s','info','request\x20sent','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','attributes','limit','include','map','model','debug','stringify','ShowSugarcrmAccount','raw','lodash','util','moment'];(function(_0x29f80e,_0x9027ff){var _0x5c7eaa=function(_0x48ec7c){while(--_0x48ec7c){_0x29f80e['push'](_0x29f80e['shift']());}};_0x5c7eaa(++_0x9027ff);}(_0x77eb,0x81));var _0xb77e=function(_0x149083,_0x4047b6){_0x149083=_0x149083-0x0;var _0x4dc74e=_0x77eb[_0x149083];return _0x4dc74e;};'use strict';var _=require(_0xb77e('0x0'));var util=require(_0xb77e('0x1'));var moment=require(_0xb77e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb77e('0x3'));var db=require(_0xb77e('0x4'))['db'];var utils=require(_0xb77e('0x5'));var logger=require('../../config/logger')(_0xb77e('0x6'));var config=require(_0xb77e('0x7'));var jayson=require(_0xb77e('0x8'));var client=jayson[_0xb77e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1923e6,_0x3f02dc,_0x378aee){return new BPromise(function(_0x3f8517,_0xc50c7d){return client[_0xb77e('0xa')](_0x1923e6,_0x378aee)[_0xb77e('0xb')](function(_0x5efff3){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x3f02dc,'request\x20sent');logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x3f02dc,'request\x20sent',JSON['stringify'](_0x5efff3));if(_0x5efff3[_0xb77e('0xc')]){if(_0x5efff3['error'][_0xb77e('0xd')]===0x1f4){logger[_0xb77e('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x3f02dc,_0x5efff3[_0xb77e('0xc')][_0xb77e('0xe')]);return _0xc50c7d(_0x5efff3[_0xb77e('0xc')][_0xb77e('0xe')]);}logger[_0xb77e('0xc')](_0xb77e('0xf'),_0x3f02dc,_0x5efff3[_0xb77e('0xc')]['message']);return _0x3f8517(_0x5efff3[_0xb77e('0xc')][_0xb77e('0xe')]);}else{logger[_0xb77e('0x10')](_0xb77e('0xf'),_0x3f02dc,_0xb77e('0x11'));_0x3f8517(_0x5efff3[_0xb77e('0x12')]['message']);}})[_0xb77e('0x13')](function(_0x593763){logger[_0xb77e('0xc')](_0xb77e('0xf'),_0x3f02dc,_0x593763);_0xc50c7d(_0x593763);});});}exports[_0xb77e('0x14')]=function(_0x515f8e){var _0x5879f3=this;return new Promise(function(_0x3d3949,_0x5e7b5d){return db[_0xb77e('0x15')][_0xb77e('0x16')]({'raw':_0x515f8e['options']?_0x515f8e[_0xb77e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x515f8e[_0xb77e('0x17')]?_0x515f8e['options']['where']||null:null,'attributes':_0x515f8e[_0xb77e('0x17')]?_0x515f8e[_0xb77e('0x17')][_0xb77e('0x18')]||null:null,'limit':_0x515f8e[_0xb77e('0x17')]?_0x515f8e[_0xb77e('0x17')][_0xb77e('0x19')]||null:null,'include':_0x515f8e[_0xb77e('0x17')]?_0x515f8e[_0xb77e('0x17')][_0xb77e('0x1a')]?_['map'](_0x515f8e[_0xb77e('0x17')]['include'],function(_0xa6fb98){return{'model':db[_0xa6fb98['model']],'as':_0xa6fb98['as'],'attributes':_0xa6fb98[_0xb77e('0x18')],'include':_0xa6fb98['include']?_[_0xb77e('0x1b')](_0xa6fb98[_0xb77e('0x1a')],function(_0x8faa48){return{'model':db[_0x8faa48[_0xb77e('0x1c')]],'as':_0x8faa48['as'],'attributes':_0x8faa48['attributes'],'include':_0x8faa48[_0xb77e('0x1a')]?_[_0xb77e('0x1b')](_0x8faa48[_0xb77e('0x1a')],function(_0x20c43f){return{'model':db[_0x20c43f['model']],'as':_0x20c43f['as'],'attributes':_0x20c43f[_0xb77e('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb77e('0xb')](function(_0x394b07){logger[_0xb77e('0x10')](_0xb77e('0x14'),_0x515f8e);logger[_0xb77e('0x1d')](_0xb77e('0x14'),_0x515f8e,JSON[_0xb77e('0x1e')](_0x394b07));_0x3d3949(_0x394b07);})['catch'](function(_0x58b3ff){logger[_0xb77e('0xc')](_0xb77e('0x14'),_0x58b3ff[_0xb77e('0xe')],_0x515f8e);_0x5e7b5d(_0x5879f3['error'](0x1f4,_0x58b3ff[_0xb77e('0xe')]));});});};exports[_0xb77e('0x1f')]=function(_0x2f93af){var _0x25ff1b=this;return new Promise(function(_0x85296b,_0x2d12fc){return db['SugarcrmAccount']['find']({'raw':_0x2f93af[_0xb77e('0x17')]?_0x2f93af[_0xb77e('0x17')][_0xb77e('0x20')]===undefined?!![]:![]:!![],'where':_0x2f93af[_0xb77e('0x17')]?_0x2f93af[_0xb77e('0x17')]['where']||null:null,'attributes':_0x2f93af[_0xb77e('0x17')]?_0x2f93af[_0xb77e('0x17')]['attributes']||null:null,'include':_0x2f93af[_0xb77e('0x17')]?_0x2f93af[_0xb77e('0x17')][_0xb77e('0x1a')]?_[_0xb77e('0x1b')](_0x2f93af['options'][_0xb77e('0x1a')],function(_0x3a593f){return{'model':db[_0x3a593f[_0xb77e('0x1c')]],'as':_0x3a593f['as'],'attributes':_0x3a593f['attributes'],'include':_0x3a593f[_0xb77e('0x1a')]?_[_0xb77e('0x1b')](_0x3a593f['include'],function(_0x4a2559){return{'model':db[_0x4a2559[_0xb77e('0x1c')]],'as':_0x4a2559['as'],'attributes':_0x4a2559['attributes'],'include':_0x4a2559[_0xb77e('0x1a')]?_[_0xb77e('0x1b')](_0x4a2559['include'],function(_0x50c2ea){return{'model':db[_0x50c2ea[_0xb77e('0x1c')]],'as':_0x50c2ea['as'],'attributes':_0x50c2ea[_0xb77e('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d05c0){logger[_0xb77e('0x10')](_0xb77e('0x1f'),_0x2f93af);logger['debug'](_0xb77e('0x1f'),_0x2f93af,JSON[_0xb77e('0x1e')](_0x4d05c0));_0x85296b(_0x4d05c0);})[_0xb77e('0x13')](function(_0x1e1e1b){logger[_0xb77e('0xc')](_0xb77e('0x1f'),_0x1e1e1b['message'],_0x2f93af);_0x2d12fc(_0x25ff1b['error'](0x1f4,_0x1e1e1b[_0xb77e('0xe')]));});});}; \ No newline at end of file +var _0xbb22=['model','ShowSugarcrmAccount','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit','map','include'];(function(_0x2d1d94,_0x480325){var _0x1d7064=function(_0x425184){while(--_0x425184){_0x2d1d94['push'](_0x2d1d94['shift']());}};_0x1d7064(++_0x480325);}(_0xbb22,0x12b));var _0x2bb2=function(_0x458050,_0xaeb1b2){_0x458050=_0x458050-0x0;var _0x9df646=_0xbb22[_0x458050];return _0x9df646;};'use strict';var _=require(_0x2bb2('0x0'));var util=require(_0x2bb2('0x1'));var moment=require(_0x2bb2('0x2'));var BPromise=require('bluebird');var rs=require(_0x2bb2('0x3'));var fs=require('fs');var Redis=require(_0x2bb2('0x4'));var db=require(_0x2bb2('0x5'))['db'];var utils=require(_0x2bb2('0x6'));var logger=require(_0x2bb2('0x7'))(_0x2bb2('0x8'));var config=require(_0x2bb2('0x9'));var jayson=require(_0x2bb2('0xa'));var client=jayson[_0x2bb2('0xb')][_0x2bb2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38c39f,_0x298f19,_0x2caee2){return new BPromise(function(_0x4948ed,_0x171a84){return client['request'](_0x38c39f,_0x2caee2)[_0x2bb2('0xd')](function(_0x2464bf){logger['info'](_0x2bb2('0xe'),_0x298f19,_0x2bb2('0xf'));logger[_0x2bb2('0x10')](_0x2bb2('0x11'),_0x298f19,'request\x20sent',JSON[_0x2bb2('0x12')](_0x2464bf));if(_0x2464bf['error']){if(_0x2464bf['error'][_0x2bb2('0x13')]===0x1f4){logger['error'](_0x2bb2('0xe'),_0x298f19,_0x2464bf[_0x2bb2('0x14')]['message']);return _0x171a84(_0x2464bf[_0x2bb2('0x14')][_0x2bb2('0x15')]);}logger[_0x2bb2('0x14')](_0x2bb2('0xe'),_0x298f19,_0x2464bf[_0x2bb2('0x14')][_0x2bb2('0x15')]);return _0x4948ed(_0x2464bf[_0x2bb2('0x14')][_0x2bb2('0x15')]);}else{logger[_0x2bb2('0x16')](_0x2bb2('0xe'),_0x298f19,_0x2bb2('0xf'));_0x4948ed(_0x2464bf[_0x2bb2('0x17')][_0x2bb2('0x15')]);}})[_0x2bb2('0x18')](function(_0x451001){logger[_0x2bb2('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x298f19,_0x451001);_0x171a84(_0x451001);});});}exports[_0x2bb2('0x19')]=function(_0xf01fc6){var _0x951cbb=this;return new Promise(function(_0x4a2d29,_0x23f9ec){return db[_0x2bb2('0x1a')][_0x2bb2('0x1b')]({'raw':_0xf01fc6[_0x2bb2('0x1c')]?_0xf01fc6['options']['raw']===undefined?!![]:![]:!![],'where':_0xf01fc6[_0x2bb2('0x1c')]?_0xf01fc6['options'][_0x2bb2('0x1d')]||null:null,'attributes':_0xf01fc6[_0x2bb2('0x1c')]?_0xf01fc6['options'][_0x2bb2('0x1e')]||null:null,'limit':_0xf01fc6[_0x2bb2('0x1c')]?_0xf01fc6[_0x2bb2('0x1c')][_0x2bb2('0x1f')]||null:null,'include':_0xf01fc6[_0x2bb2('0x1c')]?_0xf01fc6[_0x2bb2('0x1c')]['include']?_[_0x2bb2('0x20')](_0xf01fc6[_0x2bb2('0x1c')][_0x2bb2('0x21')],function(_0x5b9125){return{'model':db[_0x5b9125['model']],'as':_0x5b9125['as'],'attributes':_0x5b9125['attributes'],'include':_0x5b9125['include']?_[_0x2bb2('0x20')](_0x5b9125[_0x2bb2('0x21')],function(_0x1c9d3f){return{'model':db[_0x1c9d3f[_0x2bb2('0x22')]],'as':_0x1c9d3f['as'],'attributes':_0x1c9d3f['attributes'],'include':_0x1c9d3f['include']?_[_0x2bb2('0x20')](_0x1c9d3f[_0x2bb2('0x21')],function(_0x56d3e4){return{'model':db[_0x56d3e4[_0x2bb2('0x22')]],'as':_0x56d3e4['as'],'attributes':_0x56d3e4[_0x2bb2('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32acfd){logger['info'](_0x2bb2('0x19'),_0xf01fc6);logger[_0x2bb2('0x10')]('GetSugarcrmAccount',_0xf01fc6,JSON[_0x2bb2('0x12')](_0x32acfd));_0x4a2d29(_0x32acfd);})[_0x2bb2('0x18')](function(_0x5bcf41){logger[_0x2bb2('0x14')]('GetSugarcrmAccount',_0x5bcf41[_0x2bb2('0x15')],_0xf01fc6);_0x23f9ec(_0x951cbb['error'](0x1f4,_0x5bcf41[_0x2bb2('0x15')]));});});};exports[_0x2bb2('0x23')]=function(_0x38556a){var _0x81a860=this;return new Promise(function(_0x2d8183,_0x4c7595){return db[_0x2bb2('0x1a')]['find']({'raw':_0x38556a[_0x2bb2('0x1c')]?_0x38556a[_0x2bb2('0x1c')][_0x2bb2('0x24')]===undefined?!![]:![]:!![],'where':_0x38556a['options']?_0x38556a['options'][_0x2bb2('0x1d')]||null:null,'attributes':_0x38556a[_0x2bb2('0x1c')]?_0x38556a[_0x2bb2('0x1c')][_0x2bb2('0x1e')]||null:null,'include':_0x38556a[_0x2bb2('0x1c')]?_0x38556a['options'][_0x2bb2('0x21')]?_[_0x2bb2('0x20')](_0x38556a[_0x2bb2('0x1c')]['include'],function(_0x677d){return{'model':db[_0x677d[_0x2bb2('0x22')]],'as':_0x677d['as'],'attributes':_0x677d[_0x2bb2('0x1e')],'include':_0x677d[_0x2bb2('0x21')]?_[_0x2bb2('0x20')](_0x677d[_0x2bb2('0x21')],function(_0x391b44){return{'model':db[_0x391b44[_0x2bb2('0x22')]],'as':_0x391b44['as'],'attributes':_0x391b44[_0x2bb2('0x1e')],'include':_0x391b44[_0x2bb2('0x21')]?_['map'](_0x391b44[_0x2bb2('0x21')],function(_0x42e0a4){return{'model':db[_0x42e0a4[_0x2bb2('0x22')]],'as':_0x42e0a4['as'],'attributes':_0x42e0a4[_0x2bb2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2bb2('0xd')](function(_0x2ae29c){logger[_0x2bb2('0x16')](_0x2bb2('0x23'),_0x38556a);logger['debug'](_0x2bb2('0x23'),_0x38556a,JSON['stringify'](_0x2ae29c));_0x2d8183(_0x2ae29c);})[_0x2bb2('0x18')](function(_0x5f28ff){logger[_0x2bb2('0x14')]('ShowSugarcrmAccount',_0x5f28ff[_0x2bb2('0x15')],_0x38556a);_0x4c7595(_0x81a860[_0x2bb2('0x14')](0x1f4,_0x5f28ff[_0x2bb2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 20afbff..40ee9fd 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 _0xa512=['post','create','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x5c83d4,_0x186655){var _0x3622ab=function(_0x222245){while(--_0x222245){_0x5c83d4['push'](_0x5c83d4['shift']());}};_0x3622ab(++_0x186655);}(_0xa512,0x194));var _0x2a51=function(_0x399e4b,_0x18206b){_0x399e4b=_0x399e4b-0x0;var _0x62d5ab=_0xa512[_0x399e4b];return _0x62d5ab;};'use strict';var multer=require('multer');var util=require(_0x2a51('0x0'));var path=require('path');var timeout=require(_0x2a51('0x1'));var express=require(_0x2a51('0x2'));var router=express[_0x2a51('0x3')]();var fs_extra=require(_0x2a51('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2a51('0x5'));var controller=require(_0x2a51('0x6'));router[_0x2a51('0x7')]('/',auth[_0x2a51('0x8')](),controller['index']);router[_0x2a51('0x7')](_0x2a51('0x9'),auth[_0x2a51('0x8')](),controller[_0x2a51('0xa')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x2a51('0xb')]);router['get'](_0x2a51('0xc'),auth['isAuthenticated'](),controller[_0x2a51('0xd')]);router['get'](_0x2a51('0xe'),auth[_0x2a51('0x8')](),controller[_0x2a51('0xf')]);router[_0x2a51('0x10')]('/',auth[_0x2a51('0x8')](),controller[_0x2a51('0x11')]);router['put'](_0x2a51('0x9'),auth[_0x2a51('0x8')](),controller['update']);router[_0x2a51('0x12')](_0x2a51('0x9'),auth[_0x2a51('0x8')](),controller[_0x2a51('0x13')]);module[_0x2a51('0x14')]=router; \ No newline at end of file +var _0x5274=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','update','destroy','exports','multer','path','connect-timeout'];(function(_0xec5805,_0x20fb30){var _0x5d4868=function(_0x8f0c9e){while(--_0x8f0c9e){_0xec5805['push'](_0xec5805['shift']());}};_0x5d4868(++_0x20fb30);}(_0x5274,0x9e));var _0x4527=function(_0x2616de,_0x56dab8){_0x2616de=_0x2616de-0x0;var _0x19f21a=_0x5274[_0x2616de];return _0x19f21a;};'use strict';var multer=require(_0x4527('0x0'));var util=require('util');var path=require(_0x4527('0x1'));var timeout=require(_0x4527('0x2'));var express=require(_0x4527('0x3'));var router=express[_0x4527('0x4')]();var fs_extra=require(_0x4527('0x5'));var auth=require(_0x4527('0x6'));var interaction=require(_0x4527('0x7'));var config=require(_0x4527('0x8'));var controller=require(_0x4527('0x9'));router[_0x4527('0xa')]('/',auth[_0x4527('0xb')](),controller[_0x4527('0xc')]);router['get'](_0x4527('0xd'),auth[_0x4527('0xb')](),controller[_0x4527('0xe')]);router[_0x4527('0xa')](_0x4527('0xf'),auth[_0x4527('0xb')](),controller[_0x4527('0x10')]);router[_0x4527('0xa')]('/:id/subjects',auth[_0x4527('0xb')](),controller['getSubjects']);router['get'](_0x4527('0x11'),auth[_0x4527('0xb')](),controller[_0x4527('0x12')]);router[_0x4527('0x13')]('/',auth[_0x4527('0xb')](),controller['create']);router['put'](_0x4527('0xd'),auth[_0x4527('0xb')](),controller[_0x4527('0x14')]);router['delete'](_0x4527('0xd'),auth[_0x4527('0xb')](),controller[_0x4527('0x15')]);module[_0x4527('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 7158ac5..d26ce86 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 _0xe7dc=['STRING','sequelize','exports'];(function(_0x4d290a,_0x597c6b){var _0x4f3267=function(_0xbc96ea){while(--_0xbc96ea){_0x4d290a['push'](_0x4d290a['shift']());}};_0x4f3267(++_0x597c6b);}(_0xe7dc,0xbe));var _0xce7d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe7dc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xce7d('0x0'));module[_0xce7d('0x1')]={'name':{'type':Sequelize[_0xce7d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x55ea=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55ea,0xb8));var _0xa55e=function(_0x368f94,_0x8355fb){_0x368f94=_0x368f94-0x0;var _0x157211=_0x55ea[_0x368f94];return _0x157211;};'use strict';var Sequelize=require(_0xa55e('0x0'));module[_0xa55e('0x1')]={'name':{'type':Sequelize[_0xa55e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index d8c94d7..de566b1 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 _0x569c=['stack','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','intersection','length','options','find','create','body','params','getFields','findOne','SugarcrmField','order','pick','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x569c,0x16d));var _0xc569=function(_0x1f3ad8,_0xb0d07){_0x1f3ad8=_0x1f3ad8-0x0;var _0xf4814d=_0x569c[_0x1f3ad8];return _0xf4814d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc569('0x0'));var zipdir=require(_0xc569('0x1'));var jsonpatch=require(_0xc569('0x2'));var rp=require(_0xc569('0x3'));var moment=require(_0xc569('0x4'));var BPromise=require(_0xc569('0x5'));var Mustache=require(_0xc569('0x6'));var util=require('util');var path=require(_0xc569('0x7'));var sox=require(_0xc569('0x8'));var csv=require(_0xc569('0x9'));var ejs=require(_0xc569('0xa'));var fs=require('fs');var fs_extra=require(_0xc569('0xb'));var _=require(_0xc569('0xc'));var squel=require('squel');var crypto=require(_0xc569('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc569('0xe'));var toCsv=require(_0xc569('0x9'));var querystring=require(_0xc569('0xf'));var Papa=require('papaparse');var Redis=require(_0xc569('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc569('0x11'));var as=require(_0xc569('0x12'));var hardwareService=require(_0xc569('0x13'));var logger=require('../../config/logger')(_0xc569('0x14'));var utils=require('../../config/utils');var config=require(_0xc569('0x15'));var licenseUtil=require(_0xc569('0x16'));var db=require(_0xc569('0x17'))['db'];function respondWithStatusCode(_0x5e3e4c,_0x2ad881){_0x2ad881=_0x2ad881||0xcc;return function(_0x2fb8c5){if(_0x2fb8c5){return _0x5e3e4c[_0xc569('0x18')](_0x2ad881);}return _0x5e3e4c['status'](_0x2ad881)['end']();};}function respondWithResult(_0x4b8f44,_0x403d6a){_0x403d6a=_0x403d6a||0xc8;return function(_0x2d2a2e){if(_0x2d2a2e){return _0x4b8f44[_0xc569('0x19')](_0x403d6a)[_0xc569('0x1a')](_0x2d2a2e);}};}function respondWithFilteredResult(_0xad2dcf,_0x35ffaa){return function(_0x43117b){if(_0x43117b){var _0x44af98=typeof _0x35ffaa[_0xc569('0x1b')]===_0xc569('0x1c')&&typeof _0x35ffaa['limit']===_0xc569('0x1c');var _0x45a47f=_0x43117b[_0xc569('0x1d')];var _0x5e197f=_0x44af98?0x0:_0x35ffaa[_0xc569('0x1b')];var _0x2a2dc8=_0x44af98?_0x43117b[_0xc569('0x1d')]:_0x35ffaa[_0xc569('0x1b')]+_0x35ffaa[_0xc569('0x1e')];var _0x24a28f;if(_0x2a2dc8>=_0x45a47f){_0x2a2dc8=_0x45a47f;_0x24a28f=0xc8;}else{_0x24a28f=0xce;}_0xad2dcf[_0xc569('0x19')](_0x24a28f);return _0xad2dcf[_0xc569('0x1f')](_0xc569('0x20'),_0x5e197f+'-'+_0x2a2dc8+'/'+_0x45a47f)[_0xc569('0x1a')](_0x43117b);}return null;};}function patchUpdates(_0x1679c9){return function(_0x17edb4){try{jsonpatch[_0xc569('0x21')](_0x17edb4,_0x1679c9,!![]);}catch(_0x5172a0){return BPromise[_0xc569('0x22')](_0x5172a0);}return _0x17edb4[_0xc569('0x23')]();};}function saveUpdates(_0xa26357,_0x13edd9){return function(_0x259397){if(_0x259397){return _0x259397[_0xc569('0x24')](_0xa26357)[_0xc569('0x25')](function(_0x2aadf8){return _0x2aadf8;});}return null;};}function removeEntity(_0x4ed1c3,_0x27f6fb){return function(_0x51d75b){if(_0x51d75b){return _0x51d75b[_0xc569('0x26')]()[_0xc569('0x25')](function(){_0x4ed1c3[_0xc569('0x19')](0xcc)[_0xc569('0x27')]();});}};}function handleEntityNotFound(_0x13158d,_0x59bb83){return function(_0x3618ad){if(!_0x3618ad){_0x13158d[_0xc569('0x18')](0x194);}return _0x3618ad;};}function handleError(_0x14a13b,_0x18fbb3){_0x18fbb3=_0x18fbb3||0x1f4;return function(_0x214c28){logger['error'](_0x214c28[_0xc569('0x28')]);if(_0x214c28[_0xc569('0x29')]){delete _0x214c28[_0xc569('0x29')];}_0x14a13b[_0xc569('0x19')](_0x18fbb3)['send'](_0x214c28);};}exports[_0xc569('0x2a')]=function(_0x5903f4,_0x1456b4){var _0x5dd567={},_0x2dc9a8={},_0x48d575={'count':0x0,'rows':[]};var _0x28caaf=_[_0xc569('0x2b')](db[_0xc569('0x2c')][_0xc569('0x2d')],function(_0x18f497){return{'name':_0x18f497[_0xc569('0x2e')],'type':_0x18f497[_0xc569('0x2f')][_0xc569('0x30')]};});_0x2dc9a8[_0xc569('0x31')]=_[_0xc569('0x2b')](_0x28caaf,_0xc569('0x29'));_0x2dc9a8[_0xc569('0x32')]=_[_0xc569('0x33')](_0x5903f4[_0xc569('0x32')]);_0x2dc9a8[_0xc569('0x34')]=_['intersection'](_0x2dc9a8[_0xc569('0x31')],_0x2dc9a8[_0xc569('0x32')]);_0x5dd567['attributes']=_['intersection'](_0x2dc9a8['model'],qs[_0xc569('0x35')](_0x5903f4[_0xc569('0x32')]['fields']));_0x5dd567[_0xc569('0x36')]=_0x5dd567[_0xc569('0x36')]['length']?_0x5dd567['attributes']:_0x2dc9a8['model'];if(!_0x5903f4[_0xc569('0x32')][_0xc569('0x37')](_0xc569('0x38'))){_0x5dd567['limit']=qs[_0xc569('0x1e')](_0x5903f4['query'][_0xc569('0x1e')]);_0x5dd567[_0xc569('0x1b')]=qs[_0xc569('0x1b')](_0x5903f4[_0xc569('0x32')][_0xc569('0x1b')]);}_0x5dd567['order']=qs[_0xc569('0x39')](_0x5903f4['query'][_0xc569('0x39')]);_0x5dd567[_0xc569('0x3a')]=qs[_0xc569('0x34')](_['pick'](_0x5903f4['query'],_0x2dc9a8['filters']),_0x28caaf);if(_0x5903f4[_0xc569('0x32')][_0xc569('0x3b')]){_0x5dd567[_0xc569('0x3a')]=_[_0xc569('0x3c')](_0x5dd567[_0xc569('0x3a')],{'$or':_[_0xc569('0x2b')](_0x28caaf,function(_0x300ae4){if(_0x300ae4[_0xc569('0x2f')]!==_0xc569('0x3d')){var _0x583415={};_0x583415[_0x300ae4['name']]={'$like':'%'+_0x5903f4['query'][_0xc569('0x3b')]+'%'};return _0x583415;}})});}_0x5dd567=_[_0xc569('0x3c')]({},_0x5dd567,_0x5903f4['options']);var _0x4948ca={'where':_0x5dd567['where']};return db[_0xc569('0x2c')][_0xc569('0x1d')](_0x4948ca)['then'](function(_0xb97f00){_0x48d575[_0xc569('0x1d')]=_0xb97f00;if(_0x5903f4['query'][_0xc569('0x3e')]){_0x5dd567[_0xc569('0x3f')]=[{'all':!![]}];}return db[_0xc569('0x2c')][_0xc569('0x40')](_0x5dd567);})['then'](function(_0x47b4af){_0x48d575['rows']=_0x47b4af;return _0x48d575;})[_0xc569('0x25')](respondWithFilteredResult(_0x1456b4,_0x5dd567))[_0xc569('0x41')](handleError(_0x1456b4,null));};exports[_0xc569('0x42')]=function(_0x1460f1,_0x29132e){var _0x54a051={'raw':![],'where':{'id':_0x1460f1['params']['id']}},_0x310d42={};_0x310d42[_0xc569('0x31')]=_['keys'](db[_0xc569('0x2c')][_0xc569('0x2d')]);_0x310d42[_0xc569('0x32')]=_[_0xc569('0x33')](_0x1460f1[_0xc569('0x32')]);_0x310d42['filters']=_[_0xc569('0x43')](_0x310d42[_0xc569('0x31')],_0x310d42[_0xc569('0x32')]);_0x54a051[_0xc569('0x36')]=_['intersection'](_0x310d42[_0xc569('0x31')],qs['fields'](_0x1460f1[_0xc569('0x32')][_0xc569('0x35')]));_0x54a051[_0xc569('0x36')]=_0x54a051[_0xc569('0x36')][_0xc569('0x44')]?_0x54a051[_0xc569('0x36')]:_0x310d42[_0xc569('0x31')];if(_0x1460f1[_0xc569('0x32')][_0xc569('0x3e')]){_0x54a051[_0xc569('0x3f')]=[{'all':!![]}];}_0x54a051=_[_0xc569('0x3c')]({},_0x54a051,_0x1460f1[_0xc569('0x45')]);return db[_0xc569('0x2c')][_0xc569('0x46')](_0x54a051)[_0xc569('0x25')](handleEntityNotFound(_0x29132e,null))[_0xc569('0x25')](respondWithResult(_0x29132e,null))[_0xc569('0x41')](handleError(_0x29132e,null));};exports[_0xc569('0x47')]=function(_0x39a1ca,_0x4dc3c6){return db[_0xc569('0x2c')]['create'](_0x39a1ca[_0xc569('0x48')],{})['then'](respondWithResult(_0x4dc3c6,0xc9))[_0xc569('0x41')](handleError(_0x4dc3c6,null));};exports[_0xc569('0x24')]=function(_0x4b7d28,_0x31310f){if(_0x4b7d28['body']['id']){delete _0x4b7d28[_0xc569('0x48')]['id'];}return db[_0xc569('0x2c')][_0xc569('0x46')]({'where':{'id':_0x4b7d28[_0xc569('0x49')]['id']}})['then'](handleEntityNotFound(_0x31310f,null))[_0xc569('0x25')](saveUpdates(_0x4b7d28[_0xc569('0x48')],null))['then'](respondWithResult(_0x31310f,null))['catch'](handleError(_0x31310f,null));};exports[_0xc569('0x26')]=function(_0x2ccc1f,_0x2bee27){return db[_0xc569('0x2c')][_0xc569('0x46')]({'where':{'id':_0x2ccc1f[_0xc569('0x49')]['id']}})[_0xc569('0x25')](handleEntityNotFound(_0x2bee27,null))[_0xc569('0x25')](removeEntity(_0x2bee27,null))['catch'](handleError(_0x2bee27,null));};exports[_0xc569('0x4a')]=function(_0x1b99c2,_0x5bf890,_0x299ea0){var _0xe83f75={};var _0x4a52c0={};var _0x59e26b;var _0x484a05;return db[_0xc569('0x2c')][_0xc569('0x4b')]({'where':{'id':_0x1b99c2[_0xc569('0x49')]['id']}})['then'](handleEntityNotFound(_0x5bf890,null))[_0xc569('0x25')](function(_0x26217a){if(_0x26217a){_0x59e26b=_0x26217a;_0x4a52c0[_0xc569('0x31')]=_[_0xc569('0x33')](db[_0xc569('0x4c')][_0xc569('0x2d')]);_0x4a52c0[_0xc569('0x32')]=_[_0xc569('0x33')](_0x1b99c2[_0xc569('0x32')]);_0x4a52c0['filters']=_[_0xc569('0x43')](_0x4a52c0['model'],_0x4a52c0[_0xc569('0x32')]);_0xe83f75[_0xc569('0x36')]=_['intersection'](_0x4a52c0[_0xc569('0x31')],qs[_0xc569('0x35')](_0x1b99c2[_0xc569('0x32')][_0xc569('0x35')]));_0xe83f75[_0xc569('0x36')]=_0xe83f75[_0xc569('0x36')][_0xc569('0x44')]?_0xe83f75['attributes']:_0x4a52c0['model'];_0xe83f75[_0xc569('0x4d')]=qs[_0xc569('0x39')](_0x1b99c2[_0xc569('0x32')][_0xc569('0x39')]);_0xe83f75[_0xc569('0x3a')]=qs[_0xc569('0x34')](_[_0xc569('0x4e')](_0x1b99c2[_0xc569('0x32')],_0x4a52c0['filters']));if(_0x1b99c2[_0xc569('0x32')][_0xc569('0x3b')]){_0xe83f75['where']=_['merge'](_0xe83f75[_0xc569('0x3a')],{'$or':_[_0xc569('0x2b')](_0xe83f75['attributes'],function(_0x35c227){var _0x219725={};_0x219725[_0x35c227]={'$like':'%'+_0x1b99c2['query'][_0xc569('0x3b')]+'%'};return _0x219725;})});}_0xe83f75=_['merge']({},_0xe83f75,_0x1b99c2[_0xc569('0x45')]);return _0x59e26b[_0xc569('0x4a')](_0xe83f75);}})[_0xc569('0x25')](function(_0x2af16e){if(_0x2af16e){_0x484a05=_0x2af16e['length'];if(!_0x1b99c2[_0xc569('0x32')][_0xc569('0x37')](_0xc569('0x38'))){_0xe83f75[_0xc569('0x1e')]=qs[_0xc569('0x1e')](_0x1b99c2[_0xc569('0x32')][_0xc569('0x1e')]);_0xe83f75[_0xc569('0x1b')]=qs[_0xc569('0x1b')](_0x1b99c2[_0xc569('0x32')][_0xc569('0x1b')]);}return _0x59e26b[_0xc569('0x4a')](_0xe83f75);}})[_0xc569('0x25')](function(_0x111cd4){if(_0x111cd4){return _0x111cd4?{'count':_0x484a05,'rows':_0x111cd4}:null;}})[_0xc569('0x25')](respondWithResult(_0x5bf890,null))[_0xc569('0x41')](handleError(_0x5bf890,null));};exports[_0xc569('0x4f')]=function(_0x2934ba,_0x271496,_0x4b4b6f){var _0x228a6b={};var _0x13d447={};var _0x1764e4;var _0xaa7d22;return db[_0xc569('0x2c')][_0xc569('0x4b')]({'where':{'id':_0x2934ba[_0xc569('0x49')]['id']}})[_0xc569('0x25')](handleEntityNotFound(_0x271496,null))[_0xc569('0x25')](function(_0x342f0d){if(_0x342f0d){_0x1764e4=_0x342f0d;_0x13d447[_0xc569('0x31')]=_[_0xc569('0x33')](db[_0xc569('0x4c')][_0xc569('0x2d')]);_0x13d447['query']=_[_0xc569('0x33')](_0x2934ba['query']);_0x13d447[_0xc569('0x34')]=_['intersection'](_0x13d447[_0xc569('0x31')],_0x13d447[_0xc569('0x32')]);_0x228a6b[_0xc569('0x36')]=_[_0xc569('0x43')](_0x13d447[_0xc569('0x31')],qs[_0xc569('0x35')](_0x2934ba[_0xc569('0x32')][_0xc569('0x35')]));_0x228a6b[_0xc569('0x36')]=_0x228a6b['attributes'][_0xc569('0x44')]?_0x228a6b[_0xc569('0x36')]:_0x13d447['model'];_0x228a6b[_0xc569('0x4d')]=qs[_0xc569('0x39')](_0x2934ba[_0xc569('0x32')][_0xc569('0x39')]);_0x228a6b[_0xc569('0x3a')]=qs['filters'](_[_0xc569('0x4e')](_0x2934ba[_0xc569('0x32')],_0x13d447['filters']));if(_0x2934ba[_0xc569('0x32')]['filter']){_0x228a6b['where']=_[_0xc569('0x3c')](_0x228a6b[_0xc569('0x3a')],{'$or':_[_0xc569('0x2b')](_0x228a6b['attributes'],function(_0x52b60d){var _0x10ca81={};_0x10ca81[_0x52b60d]={'$like':'%'+_0x2934ba[_0xc569('0x32')]['filter']+'%'};return _0x10ca81;})});}_0x228a6b=_[_0xc569('0x3c')]({},_0x228a6b,_0x2934ba[_0xc569('0x45')]);return _0x1764e4[_0xc569('0x4f')](_0x228a6b);}})['then'](function(_0xdb5e7){if(_0xdb5e7){_0xaa7d22=_0xdb5e7[_0xc569('0x44')];if(!_0x2934ba[_0xc569('0x32')]['hasOwnProperty']('nolimit')){_0x228a6b['limit']=qs[_0xc569('0x1e')](_0x2934ba[_0xc569('0x32')][_0xc569('0x1e')]);_0x228a6b[_0xc569('0x1b')]=qs[_0xc569('0x1b')](_0x2934ba[_0xc569('0x32')][_0xc569('0x1b')]);}return _0x1764e4[_0xc569('0x4f')](_0x228a6b);}})['then'](function(_0x48406d){if(_0x48406d){return _0x48406d?{'count':_0xaa7d22,'rows':_0x48406d}:null;}})[_0xc569('0x25')](respondWithResult(_0x271496,null))[_0xc569('0x41')](handleError(_0x271496,null));};exports[_0xc569('0x50')]=function(_0x5422ed,_0x5497b3,_0x2426a4){var _0x2b9de1={};var _0x275ab7={};var _0x26fb07;var _0x26831e;return db['SugarcrmConfiguration'][_0xc569('0x4b')]({'where':{'id':_0x5422ed[_0xc569('0x49')]['id']}})['then'](handleEntityNotFound(_0x5497b3,null))[_0xc569('0x25')](function(_0x423871){if(_0x423871){_0x26fb07=_0x423871;_0x275ab7[_0xc569('0x31')]=_['keys'](db[_0xc569('0x4c')][_0xc569('0x2d')]);_0x275ab7[_0xc569('0x32')]=_[_0xc569('0x33')](_0x5422ed[_0xc569('0x32')]);_0x275ab7['filters']=_[_0xc569('0x43')](_0x275ab7['model'],_0x275ab7[_0xc569('0x32')]);_0x2b9de1['attributes']=_['intersection'](_0x275ab7[_0xc569('0x31')],qs[_0xc569('0x35')](_0x5422ed[_0xc569('0x32')][_0xc569('0x35')]));_0x2b9de1['attributes']=_0x2b9de1[_0xc569('0x36')][_0xc569('0x44')]?_0x2b9de1[_0xc569('0x36')]:_0x275ab7[_0xc569('0x31')];_0x2b9de1[_0xc569('0x4d')]=qs[_0xc569('0x39')](_0x5422ed['query']['sort']);_0x2b9de1[_0xc569('0x3a')]=qs[_0xc569('0x34')](_[_0xc569('0x4e')](_0x5422ed[_0xc569('0x32')],_0x275ab7[_0xc569('0x34')]));if(_0x5422ed[_0xc569('0x32')][_0xc569('0x3b')]){_0x2b9de1['where']=_[_0xc569('0x3c')](_0x2b9de1[_0xc569('0x3a')],{'$or':_[_0xc569('0x2b')](_0x2b9de1[_0xc569('0x36')],function(_0x2ace6f){var _0x697989={};_0x697989[_0x2ace6f]={'$like':'%'+_0x5422ed[_0xc569('0x32')][_0xc569('0x3b')]+'%'};return _0x697989;})});}_0x2b9de1=_[_0xc569('0x3c')]({},_0x2b9de1,_0x5422ed['options']);return _0x26fb07['getDescriptions'](_0x2b9de1);}})[_0xc569('0x25')](function(_0x2d1c61){if(_0x2d1c61){_0x26831e=_0x2d1c61[_0xc569('0x44')];if(!_0x5422ed['query'][_0xc569('0x37')](_0xc569('0x38'))){_0x2b9de1[_0xc569('0x1e')]=qs['limit'](_0x5422ed['query'][_0xc569('0x1e')]);_0x2b9de1[_0xc569('0x1b')]=qs[_0xc569('0x1b')](_0x5422ed[_0xc569('0x32')][_0xc569('0x1b')]);}return _0x26fb07[_0xc569('0x50')](_0x2b9de1);}})[_0xc569('0x25')](function(_0x3cf1bb){if(_0x3cf1bb){return _0x3cf1bb?{'count':_0x26831e,'rows':_0x3cf1bb}:null;}})[_0xc569('0x25')](respondWithResult(_0x5497b3,null))[_0xc569('0x41')](handleError(_0x5497b3,null));}; \ No newline at end of file +var _0x4051=['body','destroy','getFields','findOne','SugarcrmField','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','include','rows','catch','show','params','fields','includeAll','find','create'];(function(_0xabf623,_0x2a2c3c){var _0x3529a2=function(_0x3ae77c){while(--_0x3ae77c){_0xabf623['push'](_0xabf623['shift']());}};_0x3529a2(++_0x2a2c3c);}(_0x4051,0xf5));var _0x1405=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x4051[_0x5f1391];return _0x50ebe3;};'use strict';var emlformat=require(_0x1405('0x0'));var rimraf=require(_0x1405('0x1'));var zipdir=require(_0x1405('0x2'));var jsonpatch=require(_0x1405('0x3'));var rp=require('request-promise');var moment=require(_0x1405('0x4'));var BPromise=require(_0x1405('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1405('0x6'));var csv=require('to-csv');var ejs=require(_0x1405('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1405('0x8'));var squel=require(_0x1405('0x9'));var crypto=require(_0x1405('0xa'));var jsforce=require(_0x1405('0xb'));var deskjs=require(_0x1405('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1405('0xd'));var Papa=require('papaparse');var Redis=require(_0x1405('0xe'));var authService=require(_0x1405('0xf'));var qs=require(_0x1405('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1405('0x11'));var logger=require('../../config/logger')(_0x1405('0x12'));var utils=require(_0x1405('0x13'));var config=require(_0x1405('0x14'));var licenseUtil=require(_0x1405('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe9afcb,_0x5c8525){_0x5c8525=_0x5c8525||0xcc;return function(_0x3ea452){if(_0x3ea452){return _0xe9afcb[_0x1405('0x16')](_0x5c8525);}return _0xe9afcb[_0x1405('0x17')](_0x5c8525)[_0x1405('0x18')]();};}function respondWithResult(_0xfc0e25,_0x4a6fa0){_0x4a6fa0=_0x4a6fa0||0xc8;return function(_0x5ddbfb){if(_0x5ddbfb){return _0xfc0e25[_0x1405('0x17')](_0x4a6fa0)['json'](_0x5ddbfb);}};}function respondWithFilteredResult(_0xffd95e,_0x5df50){return function(_0x182a3a){if(_0x182a3a){var _0xa2ce35=typeof _0x5df50[_0x1405('0x19')]==='undefined'&&typeof _0x5df50[_0x1405('0x1a')]===_0x1405('0x1b');var _0x50f3a2=_0x182a3a['count'];var _0x320c88=_0xa2ce35?0x0:_0x5df50[_0x1405('0x19')];var _0x478c16=_0xa2ce35?_0x182a3a[_0x1405('0x1c')]:_0x5df50[_0x1405('0x19')]+_0x5df50[_0x1405('0x1a')];var _0x54e4f7;if(_0x478c16>=_0x50f3a2){_0x478c16=_0x50f3a2;_0x54e4f7=0xc8;}else{_0x54e4f7=0xce;}_0xffd95e[_0x1405('0x17')](_0x54e4f7);return _0xffd95e[_0x1405('0x1d')](_0x1405('0x1e'),_0x320c88+'-'+_0x478c16+'/'+_0x50f3a2)[_0x1405('0x1f')](_0x182a3a);}return null;};}function patchUpdates(_0x32e08f){return function(_0x33f07d){try{jsonpatch[_0x1405('0x20')](_0x33f07d,_0x32e08f,!![]);}catch(_0x40d955){return BPromise[_0x1405('0x21')](_0x40d955);}return _0x33f07d[_0x1405('0x22')]();};}function saveUpdates(_0x2363d4,_0x41d49d){return function(_0xf9a52f){if(_0xf9a52f){return _0xf9a52f[_0x1405('0x23')](_0x2363d4)['then'](function(_0x53f57f){return _0x53f57f;});}return null;};}function removeEntity(_0x45e245,_0x36a52c){return function(_0x772bf3){if(_0x772bf3){return _0x772bf3['destroy']()[_0x1405('0x24')](function(){_0x45e245[_0x1405('0x17')](0xcc)[_0x1405('0x18')]();});}};}function handleEntityNotFound(_0x38b3d8,_0xc18eb5){return function(_0xc0a55d){if(!_0xc0a55d){_0x38b3d8[_0x1405('0x16')](0x194);}return _0xc0a55d;};}function handleError(_0x363bf4,_0x33cab4){_0x33cab4=_0x33cab4||0x1f4;return function(_0x408c93){logger[_0x1405('0x25')](_0x408c93[_0x1405('0x26')]);if(_0x408c93[_0x1405('0x27')]){delete _0x408c93['name'];}_0x363bf4[_0x1405('0x17')](_0x33cab4)['send'](_0x408c93);};}exports[_0x1405('0x28')]=function(_0x346f2a,_0xe41411){var _0x33891e={},_0x5ec008={},_0x31f8b0={'count':0x0,'rows':[]};var _0x1e5199=_[_0x1405('0x29')](db[_0x1405('0x2a')][_0x1405('0x2b')],function(_0x333e2c){return{'name':_0x333e2c[_0x1405('0x2c')],'type':_0x333e2c[_0x1405('0x2d')]['key']};});_0x5ec008[_0x1405('0x2e')]=_[_0x1405('0x29')](_0x1e5199,_0x1405('0x27'));_0x5ec008[_0x1405('0x2f')]=_[_0x1405('0x30')](_0x346f2a['query']);_0x5ec008[_0x1405('0x31')]=_[_0x1405('0x32')](_0x5ec008['model'],_0x5ec008[_0x1405('0x2f')]);_0x33891e[_0x1405('0x33')]=_['intersection'](_0x5ec008[_0x1405('0x2e')],qs['fields'](_0x346f2a['query']['fields']));_0x33891e[_0x1405('0x33')]=_0x33891e[_0x1405('0x33')][_0x1405('0x34')]?_0x33891e[_0x1405('0x33')]:_0x5ec008['model'];if(!_0x346f2a[_0x1405('0x2f')][_0x1405('0x35')](_0x1405('0x36'))){_0x33891e['limit']=qs[_0x1405('0x1a')](_0x346f2a['query'][_0x1405('0x1a')]);_0x33891e['offset']=qs[_0x1405('0x19')](_0x346f2a['query'][_0x1405('0x19')]);}_0x33891e[_0x1405('0x37')]=qs[_0x1405('0x38')](_0x346f2a[_0x1405('0x2f')][_0x1405('0x38')]);_0x33891e['where']=qs[_0x1405('0x31')](_['pick'](_0x346f2a[_0x1405('0x2f')],_0x5ec008[_0x1405('0x31')]),_0x1e5199);if(_0x346f2a[_0x1405('0x2f')][_0x1405('0x39')]){_0x33891e['where']=_['merge'](_0x33891e[_0x1405('0x3a')],{'$or':_[_0x1405('0x29')](_0x1e5199,function(_0x455124){if(_0x455124['type']!==_0x1405('0x3b')){var _0xcf6edf={};_0xcf6edf[_0x455124[_0x1405('0x27')]]={'$like':'%'+_0x346f2a[_0x1405('0x2f')][_0x1405('0x39')]+'%'};return _0xcf6edf;}})});}_0x33891e=_[_0x1405('0x3c')]({},_0x33891e,_0x346f2a[_0x1405('0x3d')]);var _0x1eda77={'where':_0x33891e[_0x1405('0x3a')]};return db[_0x1405('0x2a')][_0x1405('0x1c')](_0x1eda77)['then'](function(_0x26f625){_0x31f8b0[_0x1405('0x1c')]=_0x26f625;if(_0x346f2a[_0x1405('0x2f')]['includeAll']){_0x33891e[_0x1405('0x3e')]=[{'all':!![]}];}return db[_0x1405('0x2a')]['findAll'](_0x33891e);})[_0x1405('0x24')](function(_0x330b21){_0x31f8b0[_0x1405('0x3f')]=_0x330b21;return _0x31f8b0;})[_0x1405('0x24')](respondWithFilteredResult(_0xe41411,_0x33891e))[_0x1405('0x40')](handleError(_0xe41411,null));};exports[_0x1405('0x41')]=function(_0x202d2b,_0x3c8b26){var _0x3f4885={'raw':![],'where':{'id':_0x202d2b[_0x1405('0x42')]['id']}},_0x4cd24f={};_0x4cd24f['model']=_[_0x1405('0x30')](db[_0x1405('0x2a')][_0x1405('0x2b')]);_0x4cd24f[_0x1405('0x2f')]=_[_0x1405('0x30')](_0x202d2b['query']);_0x4cd24f['filters']=_[_0x1405('0x32')](_0x4cd24f['model'],_0x4cd24f[_0x1405('0x2f')]);_0x3f4885[_0x1405('0x33')]=_[_0x1405('0x32')](_0x4cd24f[_0x1405('0x2e')],qs[_0x1405('0x43')](_0x202d2b[_0x1405('0x2f')][_0x1405('0x43')]));_0x3f4885[_0x1405('0x33')]=_0x3f4885[_0x1405('0x33')]['length']?_0x3f4885[_0x1405('0x33')]:_0x4cd24f[_0x1405('0x2e')];if(_0x202d2b[_0x1405('0x2f')][_0x1405('0x44')]){_0x3f4885[_0x1405('0x3e')]=[{'all':!![]}];}_0x3f4885=_[_0x1405('0x3c')]({},_0x3f4885,_0x202d2b[_0x1405('0x3d')]);return db[_0x1405('0x2a')][_0x1405('0x45')](_0x3f4885)[_0x1405('0x24')](handleEntityNotFound(_0x3c8b26,null))[_0x1405('0x24')](respondWithResult(_0x3c8b26,null))[_0x1405('0x40')](handleError(_0x3c8b26,null));};exports[_0x1405('0x46')]=function(_0x2dcd8d,_0x22ed43){return db[_0x1405('0x2a')]['create'](_0x2dcd8d[_0x1405('0x47')],{})[_0x1405('0x24')](respondWithResult(_0x22ed43,0xc9))['catch'](handleError(_0x22ed43,null));};exports[_0x1405('0x23')]=function(_0x59b069,_0x29824f){if(_0x59b069[_0x1405('0x47')]['id']){delete _0x59b069[_0x1405('0x47')]['id'];}return db[_0x1405('0x2a')][_0x1405('0x45')]({'where':{'id':_0x59b069[_0x1405('0x42')]['id']}})['then'](handleEntityNotFound(_0x29824f,null))[_0x1405('0x24')](saveUpdates(_0x59b069['body'],null))[_0x1405('0x24')](respondWithResult(_0x29824f,null))[_0x1405('0x40')](handleError(_0x29824f,null));};exports[_0x1405('0x48')]=function(_0x5e4392,_0x390139){return db[_0x1405('0x2a')][_0x1405('0x45')]({'where':{'id':_0x5e4392[_0x1405('0x42')]['id']}})[_0x1405('0x24')](handleEntityNotFound(_0x390139,null))['then'](removeEntity(_0x390139,null))['catch'](handleError(_0x390139,null));};exports[_0x1405('0x49')]=function(_0x28c39b,_0x235659,_0x4b9f86){var _0x40d316={};var _0x34bdbf={};var _0x5af2ad;var _0x32feec;return db['SugarcrmConfiguration'][_0x1405('0x4a')]({'where':{'id':_0x28c39b[_0x1405('0x42')]['id']}})[_0x1405('0x24')](handleEntityNotFound(_0x235659,null))[_0x1405('0x24')](function(_0x5cc95a){if(_0x5cc95a){_0x5af2ad=_0x5cc95a;_0x34bdbf['model']=_['keys'](db[_0x1405('0x4b')][_0x1405('0x2b')]);_0x34bdbf['query']=_[_0x1405('0x30')](_0x28c39b[_0x1405('0x2f')]);_0x34bdbf['filters']=_[_0x1405('0x32')](_0x34bdbf[_0x1405('0x2e')],_0x34bdbf[_0x1405('0x2f')]);_0x40d316[_0x1405('0x33')]=_[_0x1405('0x32')](_0x34bdbf[_0x1405('0x2e')],qs[_0x1405('0x43')](_0x28c39b[_0x1405('0x2f')][_0x1405('0x43')]));_0x40d316[_0x1405('0x33')]=_0x40d316[_0x1405('0x33')]['length']?_0x40d316[_0x1405('0x33')]:_0x34bdbf[_0x1405('0x2e')];_0x40d316[_0x1405('0x37')]=qs['sort'](_0x28c39b[_0x1405('0x2f')]['sort']);_0x40d316[_0x1405('0x3a')]=qs[_0x1405('0x31')](_['pick'](_0x28c39b[_0x1405('0x2f')],_0x34bdbf['filters']));if(_0x28c39b[_0x1405('0x2f')]['filter']){_0x40d316[_0x1405('0x3a')]=_[_0x1405('0x3c')](_0x40d316[_0x1405('0x3a')],{'$or':_[_0x1405('0x29')](_0x40d316[_0x1405('0x33')],function(_0x2de42d){var _0x5a5139={};_0x5a5139[_0x2de42d]={'$like':'%'+_0x28c39b['query']['filter']+'%'};return _0x5a5139;})});}_0x40d316=_[_0x1405('0x3c')]({},_0x40d316,_0x28c39b[_0x1405('0x3d')]);return _0x5af2ad[_0x1405('0x49')](_0x40d316);}})[_0x1405('0x24')](function(_0x4f435){if(_0x4f435){_0x32feec=_0x4f435[_0x1405('0x34')];if(!_0x28c39b['query']['hasOwnProperty'](_0x1405('0x36'))){_0x40d316['limit']=qs[_0x1405('0x1a')](_0x28c39b[_0x1405('0x2f')][_0x1405('0x1a')]);_0x40d316[_0x1405('0x19')]=qs[_0x1405('0x19')](_0x28c39b[_0x1405('0x2f')]['offset']);}return _0x5af2ad[_0x1405('0x49')](_0x40d316);}})[_0x1405('0x24')](function(_0x4abd32){if(_0x4abd32){return _0x4abd32?{'count':_0x32feec,'rows':_0x4abd32}:null;}})[_0x1405('0x24')](respondWithResult(_0x235659,null))['catch'](handleError(_0x235659,null));};exports[_0x1405('0x4c')]=function(_0x34ea85,_0x4338ce,_0xa86781){var _0x34710a={};var _0x2c35e9={};var _0x335f8d;var _0x3e33a4;return db[_0x1405('0x2a')][_0x1405('0x4a')]({'where':{'id':_0x34ea85[_0x1405('0x42')]['id']}})[_0x1405('0x24')](handleEntityNotFound(_0x4338ce,null))[_0x1405('0x24')](function(_0xed979){if(_0xed979){_0x335f8d=_0xed979;_0x2c35e9['model']=_[_0x1405('0x30')](db[_0x1405('0x4b')]['rawAttributes']);_0x2c35e9[_0x1405('0x2f')]=_[_0x1405('0x30')](_0x34ea85[_0x1405('0x2f')]);_0x2c35e9[_0x1405('0x31')]=_[_0x1405('0x32')](_0x2c35e9['model'],_0x2c35e9[_0x1405('0x2f')]);_0x34710a[_0x1405('0x33')]=_['intersection'](_0x2c35e9[_0x1405('0x2e')],qs[_0x1405('0x43')](_0x34ea85[_0x1405('0x2f')][_0x1405('0x43')]));_0x34710a['attributes']=_0x34710a[_0x1405('0x33')]['length']?_0x34710a['attributes']:_0x2c35e9[_0x1405('0x2e')];_0x34710a[_0x1405('0x37')]=qs[_0x1405('0x38')](_0x34ea85[_0x1405('0x2f')][_0x1405('0x38')]);_0x34710a[_0x1405('0x3a')]=qs[_0x1405('0x31')](_['pick'](_0x34ea85[_0x1405('0x2f')],_0x2c35e9[_0x1405('0x31')]));if(_0x34ea85[_0x1405('0x2f')][_0x1405('0x39')]){_0x34710a[_0x1405('0x3a')]=_[_0x1405('0x3c')](_0x34710a[_0x1405('0x3a')],{'$or':_[_0x1405('0x29')](_0x34710a['attributes'],function(_0xa886e2){var _0x3ee430={};_0x3ee430[_0xa886e2]={'$like':'%'+_0x34ea85[_0x1405('0x2f')][_0x1405('0x39')]+'%'};return _0x3ee430;})});}_0x34710a=_[_0x1405('0x3c')]({},_0x34710a,_0x34ea85[_0x1405('0x3d')]);return _0x335f8d['getSubjects'](_0x34710a);}})[_0x1405('0x24')](function(_0x43b3be){if(_0x43b3be){_0x3e33a4=_0x43b3be[_0x1405('0x34')];if(!_0x34ea85['query'][_0x1405('0x35')](_0x1405('0x36'))){_0x34710a['limit']=qs['limit'](_0x34ea85[_0x1405('0x2f')][_0x1405('0x1a')]);_0x34710a[_0x1405('0x19')]=qs[_0x1405('0x19')](_0x34ea85[_0x1405('0x2f')][_0x1405('0x19')]);}return _0x335f8d[_0x1405('0x4c')](_0x34710a);}})[_0x1405('0x24')](function(_0x223223){if(_0x223223){return _0x223223?{'count':_0x3e33a4,'rows':_0x223223}:null;}})[_0x1405('0x24')](respondWithResult(_0x4338ce,null))['catch'](handleError(_0x4338ce,null));};exports['getDescriptions']=function(_0x1b43d9,_0xf440c1,_0x453fd8){var _0x85bd52={};var _0x1a1091={};var _0x1349f2;var _0x48cf66;return db['SugarcrmConfiguration'][_0x1405('0x4a')]({'where':{'id':_0x1b43d9[_0x1405('0x42')]['id']}})[_0x1405('0x24')](handleEntityNotFound(_0xf440c1,null))['then'](function(_0x374b33){if(_0x374b33){_0x1349f2=_0x374b33;_0x1a1091[_0x1405('0x2e')]=_[_0x1405('0x30')](db['SugarcrmField'][_0x1405('0x2b')]);_0x1a1091[_0x1405('0x2f')]=_['keys'](_0x1b43d9[_0x1405('0x2f')]);_0x1a1091[_0x1405('0x31')]=_[_0x1405('0x32')](_0x1a1091[_0x1405('0x2e')],_0x1a1091[_0x1405('0x2f')]);_0x85bd52[_0x1405('0x33')]=_[_0x1405('0x32')](_0x1a1091['model'],qs[_0x1405('0x43')](_0x1b43d9['query'][_0x1405('0x43')]));_0x85bd52[_0x1405('0x33')]=_0x85bd52[_0x1405('0x33')][_0x1405('0x34')]?_0x85bd52[_0x1405('0x33')]:_0x1a1091[_0x1405('0x2e')];_0x85bd52[_0x1405('0x37')]=qs[_0x1405('0x38')](_0x1b43d9[_0x1405('0x2f')][_0x1405('0x38')]);_0x85bd52[_0x1405('0x3a')]=qs[_0x1405('0x31')](_[_0x1405('0x4d')](_0x1b43d9[_0x1405('0x2f')],_0x1a1091[_0x1405('0x31')]));if(_0x1b43d9[_0x1405('0x2f')][_0x1405('0x39')]){_0x85bd52[_0x1405('0x3a')]=_[_0x1405('0x3c')](_0x85bd52[_0x1405('0x3a')],{'$or':_[_0x1405('0x29')](_0x85bd52[_0x1405('0x33')],function(_0x3399e6){var _0x51eaa2={};_0x51eaa2[_0x3399e6]={'$like':'%'+_0x1b43d9[_0x1405('0x2f')][_0x1405('0x39')]+'%'};return _0x51eaa2;})});}_0x85bd52=_[_0x1405('0x3c')]({},_0x85bd52,_0x1b43d9[_0x1405('0x3d')]);return _0x1349f2[_0x1405('0x4e')](_0x85bd52);}})[_0x1405('0x24')](function(_0x4b3b57){if(_0x4b3b57){_0x48cf66=_0x4b3b57[_0x1405('0x34')];if(!_0x1b43d9[_0x1405('0x2f')]['hasOwnProperty'](_0x1405('0x36'))){_0x85bd52['limit']=qs[_0x1405('0x1a')](_0x1b43d9['query'][_0x1405('0x1a')]);_0x85bd52[_0x1405('0x19')]=qs[_0x1405('0x19')](_0x1b43d9[_0x1405('0x2f')]['offset']);}return _0x1349f2['getDescriptions'](_0x85bd52);}})[_0x1405('0x24')](function(_0x1d3fc4){if(_0x1d3fc4){return _0x1d3fc4?{'count':_0x48cf66,'rows':_0x1d3fc4}:null;}})[_0x1405('0x24')](respondWithResult(_0xf440c1,null))['catch'](handleError(_0xf440c1,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index cdf2911..df8d4d1 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 _0xe04d=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0xe04d,0x66));var _0xde04=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xe04d[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0xde04('0x0'));var util=require(_0xde04('0x1'));var logger=require(_0xde04('0x2'))(_0xde04('0x3'));var moment=require(_0xde04('0x4'));var BPromise=require(_0xde04('0x5'));var rp=require(_0xde04('0x6'));var fs=require('fs');var path=require(_0xde04('0x7'));var rimraf=require('rimraf');var config=require(_0xde04('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xde04('0x9')]=function(_0x5666f8,_0x496e8b){return _0x5666f8[_0xde04('0xa')](_0xde04('0xb'),attributes,{'tableName':_0xde04('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5460=['bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x2dcef2,_0x1727a8){var _0x4d65da=function(_0x1b70ef){while(--_0x1b70ef){_0x2dcef2['push'](_0x2dcef2['shift']());}};_0x4d65da(++_0x1727a8);}(_0x5460,0x1dc));var _0x0546=function(_0x36b67c,_0x137421){_0x36b67c=_0x36b67c-0x0;var _0x21777a=_0x5460[_0x36b67c];return _0x21777a;};'use strict';var _=require(_0x0546('0x0'));var util=require(_0x0546('0x1'));var logger=require(_0x0546('0x2'))(_0x0546('0x3'));var moment=require(_0x0546('0x4'));var BPromise=require(_0x0546('0x5'));var rp=require(_0x0546('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0546('0x7'));var config=require(_0x0546('0x8'));var attributes=require(_0x0546('0x9'));module[_0x0546('0xa')]=function(_0x330bcf,_0x2d0a6f){return _0x330bcf['define'](_0x0546('0xb'),attributes,{'tableName':_0x0546('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 03e3563..8475e63 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 _0x8f3d=['then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','SugarcrmConfiguration,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request'];(function(_0xa02d8b,_0xb97abc){var _0x1d9757=function(_0xc5030){while(--_0xc5030){_0xa02d8b['push'](_0xa02d8b['shift']());}};_0x1d9757(++_0xb97abc);}(_0x8f3d,0x79));var _0xd8f3=function(_0x3c324c,_0x5bbff8){_0x3c324c=_0x3c324c-0x0;var _0x5c3825=_0x8f3d[_0x3c324c];return _0x5c3825;};'use strict';var _=require(_0xd8f3('0x0'));var util=require(_0xd8f3('0x1'));var moment=require('moment');var BPromise=require(_0xd8f3('0x2'));var rs=require(_0xd8f3('0x3'));var fs=require('fs');var Redis=require(_0xd8f3('0x4'));var db=require(_0xd8f3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd8f3('0x6'))(_0xd8f3('0x7'));var config=require(_0xd8f3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd8f3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x256da6,_0x190ca3,_0x2c131c){return new BPromise(function(_0x2bba0c,_0x6fa338){return client[_0xd8f3('0xa')](_0x256da6,_0x2c131c)[_0xd8f3('0xb')](function(_0x5dc088){logger[_0xd8f3('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x190ca3,_0xd8f3('0xd'));logger[_0xd8f3('0xe')](_0xd8f3('0xf'),_0x190ca3,_0xd8f3('0xd'),JSON['stringify'](_0x5dc088));if(_0x5dc088['error']){if(_0x5dc088['error'][_0xd8f3('0x10')]===0x1f4){logger[_0xd8f3('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x190ca3,_0x5dc088[_0xd8f3('0x11')][_0xd8f3('0x12')]);return _0x6fa338(_0x5dc088['error'][_0xd8f3('0x12')]);}logger['error'](_0xd8f3('0x13'),_0x190ca3,_0x5dc088[_0xd8f3('0x11')][_0xd8f3('0x12')]);return _0x2bba0c(_0x5dc088[_0xd8f3('0x11')][_0xd8f3('0x12')]);}else{logger[_0xd8f3('0xc')](_0xd8f3('0x13'),_0x190ca3,_0xd8f3('0xd'));_0x2bba0c(_0x5dc088[_0xd8f3('0x14')][_0xd8f3('0x12')]);}})[_0xd8f3('0x15')](function(_0x3d68ad){logger['error'](_0xd8f3('0x13'),_0x190ca3,_0x3d68ad);_0x6fa338(_0x3d68ad);});});} \ No newline at end of file +var _0x21ef=['jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xd1788c,_0x4830a2){var _0x9ce47f=function(_0x150888){while(--_0x150888){_0xd1788c['push'](_0xd1788c['shift']());}};_0x9ce47f(++_0x4830a2);}(_0x21ef,0xa3));var _0xf21e=function(_0x1cd5b1,_0x58dd23){_0x1cd5b1=_0x1cd5b1-0x0;var _0x25b4c7=_0x21ef[_0x1cd5b1];return _0x25b4c7;};'use strict';var _=require(_0xf21e('0x0'));var util=require(_0xf21e('0x1'));var moment=require(_0xf21e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf21e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf21e('0x4'));var logger=require(_0xf21e('0x5'))(_0xf21e('0x6'));var config=require(_0xf21e('0x7'));var jayson=require(_0xf21e('0x8'));var client=jayson['client'][_0xf21e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3207a3,_0x4dbe14,_0x28412c){return new BPromise(function(_0x5c6a2a,_0x1a1dec){return client[_0xf21e('0xa')](_0x3207a3,_0x28412c)[_0xf21e('0xb')](function(_0x2a2cf7){logger[_0xf21e('0xc')](_0xf21e('0xd'),_0x4dbe14,_0xf21e('0xe'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x4dbe14,_0xf21e('0xe'),JSON['stringify'](_0x2a2cf7));if(_0x2a2cf7[_0xf21e('0xf')]){if(_0x2a2cf7['error'][_0xf21e('0x10')]===0x1f4){logger[_0xf21e('0xf')](_0xf21e('0xd'),_0x4dbe14,_0x2a2cf7['error']['message']);return _0x1a1dec(_0x2a2cf7[_0xf21e('0xf')][_0xf21e('0x11')]);}logger[_0xf21e('0xf')](_0xf21e('0xd'),_0x4dbe14,_0x2a2cf7['error'][_0xf21e('0x11')]);return _0x5c6a2a(_0x2a2cf7[_0xf21e('0xf')]['message']);}else{logger[_0xf21e('0xc')](_0xf21e('0xd'),_0x4dbe14,'request\x20sent');_0x5c6a2a(_0x2a2cf7['result']['message']);}})[_0xf21e('0x12')](function(_0x43bf5b){logger[_0xf21e('0xf')](_0xf21e('0xd'),_0x4dbe14,_0x43bf5b);_0x1a1dec(_0x43bf5b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index e95c74e..8aaab19 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 _0x9035=['../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x9035,0xe9));var _0x5903=function(_0x40bd76,_0xd305f8){_0x40bd76=_0x40bd76-0x0;var _0x5a1c88=_0x9035[_0x40bd76];return _0x5a1c88;};'use strict';var multer=require(_0x5903('0x0'));var util=require(_0x5903('0x1'));var path=require(_0x5903('0x2'));var timeout=require(_0x5903('0x3'));var express=require(_0x5903('0x4'));var router=express[_0x5903('0x5')]();var fs_extra=require(_0x5903('0x6'));var auth=require(_0x5903('0x7'));var interaction=require(_0x5903('0x8'));var config=require(_0x5903('0x9'));var controller=require(_0x5903('0xa'));router['get']('/',auth[_0x5903('0xb')](),controller[_0x5903('0xc')]);router[_0x5903('0xd')](_0x5903('0xe'),auth[_0x5903('0xb')](),controller[_0x5903('0xf')]);router['post']('/',auth[_0x5903('0xb')](),controller[_0x5903('0x10')]);router[_0x5903('0x11')](_0x5903('0xe'),auth[_0x5903('0xb')](),controller[_0x5903('0x12')]);router[_0x5903('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x5903('0x14')]);module[_0x5903('0x15')]=router; \ No newline at end of file +var _0x02f3=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x02f3,0xc8));var _0x302f=function(_0x51e3cf,_0x1054b8){_0x51e3cf=_0x51e3cf-0x0;var _0x58ae52=_0x02f3[_0x51e3cf];return _0x58ae52;};'use strict';var multer=require(_0x302f('0x0'));var util=require(_0x302f('0x1'));var path=require('path');var timeout=require(_0x302f('0x2'));var express=require(_0x302f('0x3'));var router=express[_0x302f('0x4')]();var fs_extra=require(_0x302f('0x5'));var auth=require(_0x302f('0x6'));var interaction=require(_0x302f('0x7'));var config=require(_0x302f('0x8'));var controller=require(_0x302f('0x9'));router[_0x302f('0xa')]('/',auth[_0x302f('0xb')](),controller[_0x302f('0xc')]);router[_0x302f('0xa')](_0x302f('0xd'),auth[_0x302f('0xb')](),controller[_0x302f('0xe')]);router[_0x302f('0xf')]('/',auth[_0x302f('0xb')](),controller['create']);router[_0x302f('0x10')](_0x302f('0xd'),auth[_0x302f('0xb')](),controller[_0x302f('0x11')]);router['delete'](_0x302f('0xd'),auth[_0x302f('0xb')](),controller[_0x302f('0x12')]);module[_0x302f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index ce342ce..a674bc6 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 _0x84e7=['picklist','variable','STRING','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x56aac9,_0x5ac12d){var _0x5be616=function(_0x28683e){while(--_0x28683e){_0x56aac9['push'](_0x56aac9['shift']());}};_0x5be616(++_0x5ac12d);}(_0x84e7,0xe0));var _0x784e=function(_0x4f0504,_0x5f14fb){_0x4f0504=_0x4f0504-0x0;var _0x1fb242=_0x84e7[_0x4f0504];return _0x1fb242;};'use strict';var Sequelize=require(_0x784e('0x0'));module[_0x784e('0x1')]={'type':{'type':Sequelize[_0x784e('0x2')](_0x784e('0x3'),'variable',_0x784e('0x4'),_0x784e('0x5'),_0x784e('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x784e('0x2')](_0x784e('0x3'),_0x784e('0x7'),_0x784e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x784e('0x8')]},'nameField':{'type':Sequelize[_0x784e('0x8')]},'customField':{'type':Sequelize[_0x784e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x78f0=['STRING','ENUM','BOOLEAN','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x313df3,_0x4fca45){var _0x241d59=function(_0x452786){while(--_0x452786){_0x313df3['push'](_0x313df3['shift']());}};_0x241d59(++_0x4fca45);}(_0x78f0,0x186));var _0x078f=function(_0x393328,_0x54f281){_0x393328=_0x393328-0x0;var _0x5d0be5=_0x78f0[_0x393328];return _0x5d0be5;};'use strict';var Sequelize=require('sequelize');module[_0x078f('0x0')]={'type':{'type':Sequelize['ENUM'](_0x078f('0x1'),_0x078f('0x2'),_0x078f('0x3'),_0x078f('0x4'),_0x078f('0x5')),'defaultValue':_0x078f('0x1')},'content':{'type':Sequelize[_0x078f('0x6')]},'key':{'type':Sequelize[_0x078f('0x6')]},'keyType':{'type':Sequelize[_0x078f('0x7')](_0x078f('0x1'),_0x078f('0x2'),_0x078f('0x3'))},'keyContent':{'type':Sequelize[_0x078f('0x6')]},'idField':{'type':Sequelize[_0x078f('0x6')]},'nameField':{'type':Sequelize[_0x078f('0x6')]},'customField':{'type':Sequelize[_0x078f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x078f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index a9d4554..389954c 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 _0xc5a4=['attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','options','create','body','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','map','SugarcrmField','key','model','query','filters','intersection','fields'];(function(_0x41c5b2,_0x1214e1){var _0x45508f=function(_0x5600d0){while(--_0x5600d0){_0x41c5b2['push'](_0x41c5b2['shift']());}};_0x45508f(++_0x1214e1);}(_0xc5a4,0x1d2));var _0x4c5a=function(_0x2d8323,_0x58d3f6){_0x2d8323=_0x2d8323-0x0;var _0xb7e647=_0xc5a4[_0x2d8323];return _0xb7e647;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c5a('0x0'));var jsonpatch=require(_0x4c5a('0x1'));var rp=require(_0x4c5a('0x2'));var moment=require(_0x4c5a('0x3'));var BPromise=require(_0x4c5a('0x4'));var Mustache=require(_0x4c5a('0x5'));var util=require(_0x4c5a('0x6'));var path=require('path');var sox=require(_0x4c5a('0x7'));var csv=require(_0x4c5a('0x8'));var ejs=require(_0x4c5a('0x9'));var fs=require('fs');var fs_extra=require(_0x4c5a('0xa'));var _=require(_0x4c5a('0xb'));var squel=require('squel');var crypto=require(_0x4c5a('0xc'));var jsforce=require(_0x4c5a('0xd'));var deskjs=require(_0x4c5a('0xe'));var toCsv=require(_0x4c5a('0x8'));var querystring=require(_0x4c5a('0xf'));var Papa=require(_0x4c5a('0x10'));var Redis=require(_0x4c5a('0x11'));var authService=require(_0x4c5a('0x12'));var qs=require(_0x4c5a('0x13'));var as=require(_0x4c5a('0x14'));var hardwareService=require(_0x4c5a('0x15'));var logger=require('../../config/logger')(_0x4c5a('0x16'));var utils=require(_0x4c5a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4c5a('0x18'));var db=require(_0x4c5a('0x19'))['db'];function respondWithStatusCode(_0x2432f4,_0x39552b){_0x39552b=_0x39552b||0xcc;return function(_0xcce5af){if(_0xcce5af){return _0x2432f4[_0x4c5a('0x1a')](_0x39552b);}return _0x2432f4[_0x4c5a('0x1b')](_0x39552b)[_0x4c5a('0x1c')]();};}function respondWithResult(_0x24a39e,_0x33cdda){_0x33cdda=_0x33cdda||0xc8;return function(_0x46183f){if(_0x46183f){return _0x24a39e[_0x4c5a('0x1b')](_0x33cdda)[_0x4c5a('0x1d')](_0x46183f);}};}function respondWithFilteredResult(_0x3ce912,_0x6f6a57){return function(_0x3be788){if(_0x3be788){var _0x39a258=typeof _0x6f6a57[_0x4c5a('0x1e')]===_0x4c5a('0x1f')&&typeof _0x6f6a57['limit']===_0x4c5a('0x1f');var _0x256dba=_0x3be788[_0x4c5a('0x20')];var _0x381328=_0x39a258?0x0:_0x6f6a57[_0x4c5a('0x1e')];var _0x2ed75f=_0x39a258?_0x3be788[_0x4c5a('0x20')]:_0x6f6a57['offset']+_0x6f6a57[_0x4c5a('0x21')];var _0x25c1f9;if(_0x2ed75f>=_0x256dba){_0x2ed75f=_0x256dba;_0x25c1f9=0xc8;}else{_0x25c1f9=0xce;}_0x3ce912[_0x4c5a('0x1b')](_0x25c1f9);return _0x3ce912[_0x4c5a('0x22')](_0x4c5a('0x23'),_0x381328+'-'+_0x2ed75f+'/'+_0x256dba)['json'](_0x3be788);}return null;};}function patchUpdates(_0x5e9095){return function(_0x410de6){try{jsonpatch[_0x4c5a('0x24')](_0x410de6,_0x5e9095,!![]);}catch(_0x1028bc){return BPromise[_0x4c5a('0x25')](_0x1028bc);}return _0x410de6[_0x4c5a('0x26')]();};}function saveUpdates(_0x12079d,_0x3278de){return function(_0x3a5db7){if(_0x3a5db7){return _0x3a5db7['update'](_0x12079d)[_0x4c5a('0x27')](function(_0x4f07fb){return _0x4f07fb;});}return null;};}function removeEntity(_0x48e359,_0x107b27){return function(_0x343e0f){if(_0x343e0f){return _0x343e0f[_0x4c5a('0x28')]()['then'](function(){_0x48e359[_0x4c5a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f5ebe,_0x1d6248){return function(_0x2725e0){if(!_0x2725e0){_0x3f5ebe[_0x4c5a('0x1a')](0x194);}return _0x2725e0;};}function handleError(_0x240ac3,_0x13c65e){_0x13c65e=_0x13c65e||0x1f4;return function(_0x88f15f){logger[_0x4c5a('0x29')](_0x88f15f['stack']);if(_0x88f15f[_0x4c5a('0x2a')]){delete _0x88f15f[_0x4c5a('0x2a')];}_0x240ac3[_0x4c5a('0x1b')](_0x13c65e)[_0x4c5a('0x2b')](_0x88f15f);};}exports['index']=function(_0x10f089,_0x21da42){var _0x145b47={},_0x392c1a={},_0x475214={'count':0x0,'rows':[]};var _0xb05bf9=_[_0x4c5a('0x2c')](db[_0x4c5a('0x2d')]['rawAttributes'],function(_0x41ea3d){return{'name':_0x41ea3d['fieldName'],'type':_0x41ea3d['type'][_0x4c5a('0x2e')]};});_0x392c1a[_0x4c5a('0x2f')]=_[_0x4c5a('0x2c')](_0xb05bf9,_0x4c5a('0x2a'));_0x392c1a[_0x4c5a('0x30')]=_['keys'](_0x10f089['query']);_0x392c1a[_0x4c5a('0x31')]=_[_0x4c5a('0x32')](_0x392c1a[_0x4c5a('0x2f')],_0x392c1a[_0x4c5a('0x30')]);_0x145b47['attributes']=_[_0x4c5a('0x32')](_0x392c1a['model'],qs[_0x4c5a('0x33')](_0x10f089[_0x4c5a('0x30')][_0x4c5a('0x33')]));_0x145b47[_0x4c5a('0x34')]=_0x145b47[_0x4c5a('0x34')][_0x4c5a('0x35')]?_0x145b47[_0x4c5a('0x34')]:_0x392c1a[_0x4c5a('0x2f')];if(!_0x10f089[_0x4c5a('0x30')][_0x4c5a('0x36')](_0x4c5a('0x37'))){_0x145b47[_0x4c5a('0x21')]=qs[_0x4c5a('0x21')](_0x10f089[_0x4c5a('0x30')]['limit']);_0x145b47[_0x4c5a('0x1e')]=qs['offset'](_0x10f089['query'][_0x4c5a('0x1e')]);}_0x145b47['order']=qs[_0x4c5a('0x38')](_0x10f089[_0x4c5a('0x30')]['sort']);_0x145b47[_0x4c5a('0x39')]=qs['filters'](_[_0x4c5a('0x3a')](_0x10f089['query'],_0x392c1a[_0x4c5a('0x31')]),_0xb05bf9);if(_0x10f089['query'][_0x4c5a('0x3b')]){_0x145b47[_0x4c5a('0x39')]=_[_0x4c5a('0x3c')](_0x145b47[_0x4c5a('0x39')],{'$or':_[_0x4c5a('0x2c')](_0xb05bf9,function(_0x1df2a2){if(_0x1df2a2[_0x4c5a('0x3d')]!=='VIRTUAL'){var _0x23004f={};_0x23004f[_0x1df2a2[_0x4c5a('0x2a')]]={'$like':'%'+_0x10f089[_0x4c5a('0x30')]['filter']+'%'};return _0x23004f;}})});}_0x145b47=_[_0x4c5a('0x3c')]({},_0x145b47,_0x10f089['options']);var _0x128235={'where':_0x145b47[_0x4c5a('0x39')]};return db['SugarcrmField'][_0x4c5a('0x20')](_0x128235)['then'](function(_0x56930e){_0x475214[_0x4c5a('0x20')]=_0x56930e;if(_0x10f089['query'][_0x4c5a('0x3e')]){_0x145b47[_0x4c5a('0x3f')]=[{'all':!![]}];}return db[_0x4c5a('0x2d')][_0x4c5a('0x40')](_0x145b47);})[_0x4c5a('0x27')](function(_0x5aaa17){_0x475214[_0x4c5a('0x41')]=_0x5aaa17;return _0x475214;})[_0x4c5a('0x27')](respondWithFilteredResult(_0x21da42,_0x145b47))[_0x4c5a('0x42')](handleError(_0x21da42,null));};exports['show']=function(_0x5414b2,_0x123421){var _0xd05180={'raw':!![],'where':{'id':_0x5414b2[_0x4c5a('0x43')]['id']}},_0x298d86={};_0x298d86[_0x4c5a('0x2f')]=_['keys'](db[_0x4c5a('0x2d')][_0x4c5a('0x44')]);_0x298d86['query']=_[_0x4c5a('0x45')](_0x5414b2[_0x4c5a('0x30')]);_0x298d86[_0x4c5a('0x31')]=_[_0x4c5a('0x32')](_0x298d86[_0x4c5a('0x2f')],_0x298d86[_0x4c5a('0x30')]);_0xd05180[_0x4c5a('0x34')]=_[_0x4c5a('0x32')](_0x298d86[_0x4c5a('0x2f')],qs[_0x4c5a('0x33')](_0x5414b2['query']['fields']));_0xd05180[_0x4c5a('0x34')]=_0xd05180[_0x4c5a('0x34')][_0x4c5a('0x35')]?_0xd05180['attributes']:_0x298d86[_0x4c5a('0x2f')];if(_0x5414b2[_0x4c5a('0x30')]['includeAll']){_0xd05180[_0x4c5a('0x3f')]=[{'all':!![]}];}_0xd05180=_[_0x4c5a('0x3c')]({},_0xd05180,_0x5414b2[_0x4c5a('0x46')]);return db[_0x4c5a('0x2d')]['find'](_0xd05180)[_0x4c5a('0x27')](handleEntityNotFound(_0x123421,null))[_0x4c5a('0x27')](respondWithResult(_0x123421,null))[_0x4c5a('0x42')](handleError(_0x123421,null));};exports[_0x4c5a('0x47')]=function(_0x3053ab,_0x40a598){return db[_0x4c5a('0x2d')]['create'](_0x3053ab['body'],{})[_0x4c5a('0x27')](respondWithResult(_0x40a598,0xc9))[_0x4c5a('0x42')](handleError(_0x40a598,null));};exports['update']=function(_0x45e964,_0x400804){if(_0x45e964[_0x4c5a('0x48')]['id']){delete _0x45e964[_0x4c5a('0x48')]['id'];}return db[_0x4c5a('0x2d')][_0x4c5a('0x49')]({'where':{'id':_0x45e964[_0x4c5a('0x43')]['id']}})[_0x4c5a('0x27')](handleEntityNotFound(_0x400804,null))[_0x4c5a('0x27')](saveUpdates(_0x45e964[_0x4c5a('0x48')],null))[_0x4c5a('0x27')](respondWithResult(_0x400804,null))[_0x4c5a('0x42')](handleError(_0x400804,null));};exports[_0x4c5a('0x28')]=function(_0x3f8cdd,_0x318bee){return db['SugarcrmField'][_0x4c5a('0x49')]({'where':{'id':_0x3f8cdd[_0x4c5a('0x43')]['id']}})[_0x4c5a('0x27')](handleEntityNotFound(_0x318bee,null))[_0x4c5a('0x27')](removeEntity(_0x318bee,null))['catch'](handleError(_0x318bee,null));}; \ No newline at end of file +var _0xb912=['offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','name','send','map','SugarcrmField','query','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','where','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','merge','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb912,0xfb));var _0x2b91=function(_0x32574c,_0x42b146){_0x32574c=_0x32574c-0x0;var _0xee363a=_0xb912[_0x32574c];return _0xee363a;};'use strict';var emlformat=require(_0x2b91('0x0'));var rimraf=require(_0x2b91('0x1'));var zipdir=require(_0x2b91('0x2'));var jsonpatch=require(_0x2b91('0x3'));var rp=require('request-promise');var moment=require(_0x2b91('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2b91('0x5'));var util=require(_0x2b91('0x6'));var path=require(_0x2b91('0x7'));var sox=require(_0x2b91('0x8'));var csv=require(_0x2b91('0x9'));var ejs=require(_0x2b91('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b91('0xb'));var squel=require(_0x2b91('0xc'));var crypto=require(_0x2b91('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2b91('0xe'));var toCsv=require(_0x2b91('0x9'));var querystring=require('querystring');var Papa=require(_0x2b91('0xf'));var Redis=require('ioredis');var authService=require(_0x2b91('0x10'));var qs=require(_0x2b91('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b91('0x12'));var logger=require(_0x2b91('0x13'))(_0x2b91('0x14'));var utils=require(_0x2b91('0x15'));var config=require(_0x2b91('0x16'));var licenseUtil=require(_0x2b91('0x17'));var db=require(_0x2b91('0x18'))['db'];function respondWithStatusCode(_0x18dea3,_0x43df86){_0x43df86=_0x43df86||0xcc;return function(_0x3df196){if(_0x3df196){return _0x18dea3[_0x2b91('0x19')](_0x43df86);}return _0x18dea3[_0x2b91('0x1a')](_0x43df86)[_0x2b91('0x1b')]();};}function respondWithResult(_0x5b4324,_0x5c7d27){_0x5c7d27=_0x5c7d27||0xc8;return function(_0x43d412){if(_0x43d412){return _0x5b4324['status'](_0x5c7d27)[_0x2b91('0x1c')](_0x43d412);}};}function respondWithFilteredResult(_0x33dcfe,_0x2c9528){return function(_0x5590c6){if(_0x5590c6){var _0x5dc7a0=typeof _0x2c9528[_0x2b91('0x1d')]===_0x2b91('0x1e')&&typeof _0x2c9528[_0x2b91('0x1f')]===_0x2b91('0x1e');var _0x69d036=_0x5590c6[_0x2b91('0x20')];var _0x52b727=_0x5dc7a0?0x0:_0x2c9528[_0x2b91('0x1d')];var _0xa86cd2=_0x5dc7a0?_0x5590c6[_0x2b91('0x20')]:_0x2c9528[_0x2b91('0x1d')]+_0x2c9528[_0x2b91('0x1f')];var _0x16efca;if(_0xa86cd2>=_0x69d036){_0xa86cd2=_0x69d036;_0x16efca=0xc8;}else{_0x16efca=0xce;}_0x33dcfe[_0x2b91('0x1a')](_0x16efca);return _0x33dcfe[_0x2b91('0x21')](_0x2b91('0x22'),_0x52b727+'-'+_0xa86cd2+'/'+_0x69d036)['json'](_0x5590c6);}return null;};}function patchUpdates(_0x1c3ed5){return function(_0x90ee1f){try{jsonpatch[_0x2b91('0x23')](_0x90ee1f,_0x1c3ed5,!![]);}catch(_0x16ae2a){return BPromise['reject'](_0x16ae2a);}return _0x90ee1f['save']();};}function saveUpdates(_0x2ceea3,_0x5a7ceb){return function(_0x271577){if(_0x271577){return _0x271577[_0x2b91('0x24')](_0x2ceea3)[_0x2b91('0x25')](function(_0x5ce791){return _0x5ce791;});}return null;};}function removeEntity(_0x2141bd,_0x58584c){return function(_0x2d750e){if(_0x2d750e){return _0x2d750e[_0x2b91('0x26')]()['then'](function(){_0x2141bd[_0x2b91('0x1a')](0xcc)[_0x2b91('0x1b')]();});}};}function handleEntityNotFound(_0x1f03b2,_0x21d134){return function(_0x47d56f){if(!_0x47d56f){_0x1f03b2[_0x2b91('0x19')](0x194);}return _0x47d56f;};}function handleError(_0x44e50e,_0x4528ed){_0x4528ed=_0x4528ed||0x1f4;return function(_0x2f4b52){logger['error'](_0x2f4b52['stack']);if(_0x2f4b52['name']){delete _0x2f4b52[_0x2b91('0x27')];}_0x44e50e[_0x2b91('0x1a')](_0x4528ed)[_0x2b91('0x28')](_0x2f4b52);};}exports['index']=function(_0x3813fb,_0x1aa64c){var _0x6bae14={},_0x2fc972={},_0x2e5622={'count':0x0,'rows':[]};var _0x3f9895=_[_0x2b91('0x29')](db[_0x2b91('0x2a')]['rawAttributes'],function(_0x26f917){return{'name':_0x26f917['fieldName'],'type':_0x26f917['type']['key']};});_0x2fc972['model']=_['map'](_0x3f9895,_0x2b91('0x27'));_0x2fc972[_0x2b91('0x2b')]=_['keys'](_0x3813fb[_0x2b91('0x2b')]);_0x2fc972[_0x2b91('0x2c')]=_[_0x2b91('0x2d')](_0x2fc972[_0x2b91('0x2e')],_0x2fc972[_0x2b91('0x2b')]);_0x6bae14[_0x2b91('0x2f')]=_['intersection'](_0x2fc972['model'],qs[_0x2b91('0x30')](_0x3813fb[_0x2b91('0x2b')]['fields']));_0x6bae14[_0x2b91('0x2f')]=_0x6bae14[_0x2b91('0x2f')][_0x2b91('0x31')]?_0x6bae14[_0x2b91('0x2f')]:_0x2fc972[_0x2b91('0x2e')];if(!_0x3813fb['query']['hasOwnProperty'](_0x2b91('0x32'))){_0x6bae14['limit']=qs['limit'](_0x3813fb[_0x2b91('0x2b')]['limit']);_0x6bae14[_0x2b91('0x1d')]=qs[_0x2b91('0x1d')](_0x3813fb[_0x2b91('0x2b')][_0x2b91('0x1d')]);}_0x6bae14['order']=qs[_0x2b91('0x33')](_0x3813fb[_0x2b91('0x2b')]['sort']);_0x6bae14['where']=qs[_0x2b91('0x2c')](_[_0x2b91('0x34')](_0x3813fb[_0x2b91('0x2b')],_0x2fc972[_0x2b91('0x2c')]),_0x3f9895);if(_0x3813fb['query']['filter']){_0x6bae14['where']=_['merge'](_0x6bae14[_0x2b91('0x35')],{'$or':_['map'](_0x3f9895,function(_0x509a7d){if(_0x509a7d[_0x2b91('0x36')]!==_0x2b91('0x37')){var _0x1bba55={};_0x1bba55[_0x509a7d[_0x2b91('0x27')]]={'$like':'%'+_0x3813fb['query'][_0x2b91('0x38')]+'%'};return _0x1bba55;}})});}_0x6bae14=_['merge']({},_0x6bae14,_0x3813fb[_0x2b91('0x39')]);var _0x8c9590={'where':_0x6bae14['where']};return db['SugarcrmField'][_0x2b91('0x20')](_0x8c9590)[_0x2b91('0x25')](function(_0x39d59f){_0x2e5622[_0x2b91('0x20')]=_0x39d59f;if(_0x3813fb[_0x2b91('0x2b')][_0x2b91('0x3a')]){_0x6bae14[_0x2b91('0x3b')]=[{'all':!![]}];}return db[_0x2b91('0x2a')][_0x2b91('0x3c')](_0x6bae14);})[_0x2b91('0x25')](function(_0x11eae7){_0x2e5622['rows']=_0x11eae7;return _0x2e5622;})[_0x2b91('0x25')](respondWithFilteredResult(_0x1aa64c,_0x6bae14))[_0x2b91('0x3d')](handleError(_0x1aa64c,null));};exports[_0x2b91('0x3e')]=function(_0x248cef,_0x1853fe){var _0x413135={'raw':!![],'where':{'id':_0x248cef[_0x2b91('0x3f')]['id']}},_0x123c4e={};_0x123c4e['model']=_[_0x2b91('0x40')](db[_0x2b91('0x2a')][_0x2b91('0x41')]);_0x123c4e[_0x2b91('0x2b')]=_[_0x2b91('0x40')](_0x248cef[_0x2b91('0x2b')]);_0x123c4e[_0x2b91('0x2c')]=_[_0x2b91('0x2d')](_0x123c4e[_0x2b91('0x2e')],_0x123c4e[_0x2b91('0x2b')]);_0x413135[_0x2b91('0x2f')]=_[_0x2b91('0x2d')](_0x123c4e[_0x2b91('0x2e')],qs[_0x2b91('0x30')](_0x248cef[_0x2b91('0x2b')][_0x2b91('0x30')]));_0x413135[_0x2b91('0x2f')]=_0x413135[_0x2b91('0x2f')]['length']?_0x413135['attributes']:_0x123c4e[_0x2b91('0x2e')];if(_0x248cef['query'][_0x2b91('0x3a')]){_0x413135[_0x2b91('0x3b')]=[{'all':!![]}];}_0x413135=_[_0x2b91('0x42')]({},_0x413135,_0x248cef[_0x2b91('0x39')]);return db[_0x2b91('0x2a')]['find'](_0x413135)[_0x2b91('0x25')](handleEntityNotFound(_0x1853fe,null))['then'](respondWithResult(_0x1853fe,null))[_0x2b91('0x3d')](handleError(_0x1853fe,null));};exports[_0x2b91('0x43')]=function(_0x3a197f,_0x1bb2c8){return db[_0x2b91('0x2a')][_0x2b91('0x43')](_0x3a197f['body'],{})[_0x2b91('0x25')](respondWithResult(_0x1bb2c8,0xc9))[_0x2b91('0x3d')](handleError(_0x1bb2c8,null));};exports['update']=function(_0x44689e,_0x30cd26){if(_0x44689e[_0x2b91('0x44')]['id']){delete _0x44689e[_0x2b91('0x44')]['id'];}return db[_0x2b91('0x2a')]['find']({'where':{'id':_0x44689e['params']['id']}})['then'](handleEntityNotFound(_0x30cd26,null))[_0x2b91('0x25')](saveUpdates(_0x44689e[_0x2b91('0x44')],null))[_0x2b91('0x25')](respondWithResult(_0x30cd26,null))[_0x2b91('0x3d')](handleError(_0x30cd26,null));};exports['destroy']=function(_0x3ad717,_0xede7f9){return db[_0x2b91('0x2a')][_0x2b91('0x45')]({'where':{'id':_0x3ad717['params']['id']}})[_0x2b91('0x25')](handleEntityNotFound(_0xede7f9,null))[_0x2b91('0x25')](removeEntity(_0xede7f9,null))[_0x2b91('0x3d')](handleError(_0xede7f9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 181f325..f3a0f7f 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 _0xee20=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','util'];(function(_0x471b7a,_0x2e17ed){var _0x547d29=function(_0x2264c7){while(--_0x2264c7){_0x471b7a['push'](_0x471b7a['shift']());}};_0x547d29(++_0x2e17ed);}(_0xee20,0x94));var _0x0ee2=function(_0x19af45,_0x46aa48){_0x19af45=_0x19af45-0x0;var _0x3b047e=_0xee20[_0x19af45];return _0x3b047e;};'use strict';var _=require(_0x0ee2('0x0'));var util=require(_0x0ee2('0x1'));var logger=require(_0x0ee2('0x2'))('api');var moment=require(_0x0ee2('0x3'));var BPromise=require(_0x0ee2('0x4'));var rp=require(_0x0ee2('0x5'));var fs=require('fs');var path=require(_0x0ee2('0x6'));var rimraf=require('rimraf');var config=require(_0x0ee2('0x7'));var attributes=require(_0x0ee2('0x8'));module[_0x0ee2('0x9')]=function(_0x44519e,_0x252039){return _0x44519e[_0x0ee2('0xa')](_0x0ee2('0xb'),attributes,{'tableName':_0x0ee2('0xc'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x0ee2('0xd'),_0x0ee2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4174=['../../config/logger','api','moment','bluebird','path','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util'];(function(_0x37563f,_0x3cf11a){var _0x79b3e3=function(_0x576532){while(--_0x576532){_0x37563f['push'](_0x37563f['shift']());}};_0x79b3e3(++_0x3cf11a);}(_0x4174,0x1b1));var _0x4417=function(_0x56a3b1,_0x1c59b5){_0x56a3b1=_0x56a3b1-0x0;var _0x3b8897=_0x4174[_0x56a3b1];return _0x3b8897;};'use strict';var _=require(_0x4417('0x0'));var util=require(_0x4417('0x1'));var logger=require(_0x4417('0x2'))(_0x4417('0x3'));var moment=require(_0x4417('0x4'));var BPromise=require(_0x4417('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4417('0x6'));var rimraf=require(_0x4417('0x7'));var config=require('../../config/environment');var attributes=require(_0x4417('0x8'));module[_0x4417('0x9')]=function(_0x3243c4,_0x1391a8){return _0x3243c4[_0x4417('0xa')](_0x4417('0xb'),attributes,{'tableName':_0x4417('0xc'),'paranoid':![],'indexes':[{'name':_0x4417('0xd'),'fields':[_0x4417('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 4637f01..4e6f147 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 _0xfa5f=['error','code','SugarcrmField,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1b5af6,_0x18dfa4){var _0x15248b=function(_0x4aea92){while(--_0x4aea92){_0x1b5af6['push'](_0x1b5af6['shift']());}};_0x15248b(++_0x18dfa4);}(_0xfa5f,0x10f));var _0xffa5=function(_0x1bd332,_0x10477a){_0x1bd332=_0x1bd332-0x0;var _0x2cae66=_0xfa5f[_0x1bd332];return _0x2cae66;};'use strict';var _=require(_0xffa5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xffa5('0x1'));var rs=require(_0xffa5('0x2'));var fs=require('fs');var Redis=require(_0xffa5('0x3'));var db=require(_0xffa5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xffa5('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xffa5('0x6')][_0xffa5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3924d1,_0x2f6c2c,_0xeb9b12){return new BPromise(function(_0x26d1ff,_0x40fb0b){return client[_0xffa5('0x8')](_0x3924d1,_0xeb9b12)['then'](function(_0x23cc23){logger[_0xffa5('0x9')]('SugarcrmField,\x20%s,\x20%s',_0x2f6c2c,_0xffa5('0xa'));logger[_0xffa5('0xb')](_0xffa5('0xc'),_0x2f6c2c,_0xffa5('0xa'),JSON[_0xffa5('0xd')](_0x23cc23));if(_0x23cc23[_0xffa5('0xe')]){if(_0x23cc23[_0xffa5('0xe')][_0xffa5('0xf')]===0x1f4){logger['error'](_0xffa5('0x10'),_0x2f6c2c,_0x23cc23['error'][_0xffa5('0x11')]);return _0x40fb0b(_0x23cc23[_0xffa5('0xe')][_0xffa5('0x11')]);}logger['error'](_0xffa5('0x10'),_0x2f6c2c,_0x23cc23['error'][_0xffa5('0x11')]);return _0x26d1ff(_0x23cc23[_0xffa5('0xe')][_0xffa5('0x11')]);}else{logger['info'](_0xffa5('0x10'),_0x2f6c2c,_0xffa5('0xa'));_0x26d1ff(_0x23cc23[_0xffa5('0x12')][_0xffa5('0x11')]);}})['catch'](function(_0x3b47a4){logger[_0xffa5('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2f6c2c,_0x3b47a4);_0x40fb0b(_0x3b47a4);});});} \ No newline at end of file +var _0x67dc=['debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent'];(function(_0x504e13,_0x291b50){var _0xeb0f14=function(_0x3144a1){while(--_0x3144a1){_0x504e13['push'](_0x504e13['shift']());}};_0xeb0f14(++_0x291b50);}(_0x67dc,0x15f));var _0xc67d=function(_0x58ee19,_0xdf0765){_0x58ee19=_0x58ee19-0x0;var _0x49af25=_0x67dc[_0x58ee19];return _0x49af25;};'use strict';var _=require(_0xc67d('0x0'));var util=require(_0xc67d('0x1'));var moment=require(_0xc67d('0x2'));var BPromise=require(_0xc67d('0x3'));var rs=require(_0xc67d('0x4'));var fs=require('fs');var Redis=require(_0xc67d('0x5'));var db=require(_0xc67d('0x6'))['db'];var utils=require(_0xc67d('0x7'));var logger=require('../../config/logger')(_0xc67d('0x8'));var config=require(_0xc67d('0x9'));var jayson=require(_0xc67d('0xa'));var client=jayson[_0xc67d('0xb')][_0xc67d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3241e7,_0x3d1fa9,_0x15fe1c){return new BPromise(function(_0xaa4e83,_0x283d14){return client['request'](_0x3241e7,_0x15fe1c)[_0xc67d('0xd')](function(_0x1bcfb8){logger[_0xc67d('0xe')](_0xc67d('0xf'),_0x3d1fa9,_0xc67d('0x10'));logger[_0xc67d('0x11')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x3d1fa9,_0xc67d('0x10'),JSON[_0xc67d('0x12')](_0x1bcfb8));if(_0x1bcfb8['error']){if(_0x1bcfb8['error']['code']===0x1f4){logger[_0xc67d('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x3d1fa9,_0x1bcfb8[_0xc67d('0x13')][_0xc67d('0x14')]);return _0x283d14(_0x1bcfb8[_0xc67d('0x13')][_0xc67d('0x14')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x3d1fa9,_0x1bcfb8['error'][_0xc67d('0x14')]);return _0xaa4e83(_0x1bcfb8[_0xc67d('0x13')][_0xc67d('0x14')]);}else{logger[_0xc67d('0xe')](_0xc67d('0xf'),_0x3d1fa9,_0xc67d('0x10'));_0xaa4e83(_0x1bcfb8[_0xc67d('0x15')][_0xc67d('0x14')]);}})[_0xc67d('0x16')](function(_0x4090a3){logger[_0xc67d('0x13')](_0xc67d('0xf'),_0x3d1fa9,_0x4090a3);_0x283d14(_0x4090a3);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 86edc79..1491a3c 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 _0x655d=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','exports'];(function(_0x27e4b2,_0x10e844){var _0x4d2ba9=function(_0x3f6caf){while(--_0x3f6caf){_0x27e4b2['push'](_0x27e4b2['shift']());}};_0x4d2ba9(++_0x10e844);}(_0x655d,0x13b));var _0xd655=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x655d[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xd655('0x0'));var util=require(_0xd655('0x1'));var path=require(_0xd655('0x2'));var timeout=require(_0xd655('0x3'));var express=require(_0xd655('0x4'));var router=express[_0xd655('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd655('0x6'));var interaction=require(_0xd655('0x7'));var config=require('../../config/environment');var controller=require(_0xd655('0x8'));router['get']('/',auth[_0xd655('0x9')](),controller[_0xd655('0xa')]);router[_0xd655('0xb')](_0xd655('0xc'),auth[_0xd655('0x9')](),controller[_0xd655('0xd')]);router[_0xd655('0xb')](_0xd655('0xe'),auth[_0xd655('0x9')](),controller[_0xd655('0xf')]);router[_0xd655('0xb')]('/:id/fields',auth[_0xd655('0x9')](),controller[_0xd655('0x10')]);router[_0xd655('0x11')]('/',auth[_0xd655('0x9')](),controller['create']);router[_0xd655('0x11')](_0xd655('0xe'),auth[_0xd655('0x9')](),controller[_0xd655('0x12')]);router[_0xd655('0x13')](_0xd655('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd655('0xc'),auth[_0xd655('0x9')](),controller['destroy']);module[_0xd655('0x14')]=router; \ No newline at end of file +var _0xf808=['/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','delete','destroy','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x10540b,_0x41547b){var _0x21733e=function(_0x5a78c2){while(--_0x5a78c2){_0x10540b['push'](_0x10540b['shift']());}};_0x21733e(++_0x41547b);}(_0xf808,0x83));var _0x8f80=function(_0x5838d8,_0x3bf753){_0x5838d8=_0x5838d8-0x0;var _0x4be2af=_0xf808[_0x5838d8];return _0x4be2af;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8f80('0x0'));var timeout=require(_0x8f80('0x1'));var express=require(_0x8f80('0x2'));var router=express['Router']();var fs_extra=require(_0x8f80('0x3'));var auth=require(_0x8f80('0x4'));var interaction=require(_0x8f80('0x5'));var config=require(_0x8f80('0x6'));var controller=require('./intVtigerAccount.controller');router[_0x8f80('0x7')]('/',auth['isAuthenticated'](),controller[_0x8f80('0x8')]);router['get'](_0x8f80('0x9'),auth[_0x8f80('0xa')](),controller['show']);router[_0x8f80('0x7')](_0x8f80('0xb'),auth[_0x8f80('0xa')](),controller[_0x8f80('0xc')]);router[_0x8f80('0x7')](_0x8f80('0xd'),auth[_0x8f80('0xa')](),controller['getFields']);router[_0x8f80('0xe')]('/',auth[_0x8f80('0xa')](),controller[_0x8f80('0xf')]);router['post']('/:id/configurations',auth[_0x8f80('0xa')](),controller[_0x8f80('0x10')]);router['put'](_0x8f80('0x9'),auth[_0x8f80('0xa')](),controller[_0x8f80('0x11')]);router[_0x8f80('0x12')](_0x8f80('0x9'),auth[_0x8f80('0xa')](),controller[_0x8f80('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 7e7d5cf..9697314 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 _0x094d=['exports','STRING','HelpDesk','sequelize'];(function(_0x4cf61b,_0x3fe192){var _0x3d15f3=function(_0x44fe18){while(--_0x44fe18){_0x4cf61b['push'](_0x4cf61b['shift']());}};_0x3d15f3(++_0x3fe192);}(_0x094d,0xa3));var _0xd094=function(_0x16bb8e,_0x4f2d87){_0x16bb8e=_0x16bb8e-0x0;var _0x55b01a=_0x094d[_0x16bb8e];return _0x55b01a;};'use strict';var Sequelize=require(_0xd094('0x0'));module[_0xd094('0x1')]={'name':{'type':Sequelize[_0xd094('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd094('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd094('0x3')},'remoteUri':{'type':Sequelize[_0xd094('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xd094('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xd094('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x43d8=['exports','STRING','HelpDesk','sequelize'];(function(_0x2855ea,_0x46a9f5){var _0x56bb43=function(_0x2d9ea8){while(--_0x2d9ea8){_0x2855ea['push'](_0x2855ea['shift']());}};_0x56bb43(++_0x46a9f5);}(_0x43d8,0xff));var _0x843d=function(_0x206096,_0x1c6cfd){_0x206096=_0x206096-0x0;var _0x3f3b50=_0x43d8[_0x206096];return _0x3f3b50;};'use strict';var Sequelize=require(_0x843d('0x0'));module[_0x843d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x843d('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x843d('0x2')],'allowNull':![],'defaultValue':_0x843d('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x843d('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x843d('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 4c2e06b..6c65387 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 _0x6056=['then','error','stack','name','send','index','map','VtigerAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','params','create','body','find','getConfigurations','findOne','VtigerConfiguration','AccountId','Subjects','getSubjects','channel','VtigerField','description','moduleName','remoteUri','serverUrl','username','accessKey','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy'];(function(_0x289cc4,_0x8e8d85){var _0x43a5d4=function(_0xda27dd){while(--_0xda27dd){_0x289cc4['push'](_0x289cc4['shift']());}};_0x43a5d4(++_0x8e8d85);}(_0x6056,0x136));var _0x6605=function(_0x13de37,_0x157f1d){_0x13de37=_0x13de37-0x0;var _0x3db774=_0x6056[_0x13de37];return _0x3db774;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6605('0x0'));var zipdir=require(_0x6605('0x1'));var jsonpatch=require(_0x6605('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6605('0x3'));var Mustache=require(_0x6605('0x4'));var util=require(_0x6605('0x5'));var path=require(_0x6605('0x6'));var sox=require(_0x6605('0x7'));var csv=require(_0x6605('0x8'));var ejs=require(_0x6605('0x9'));var fs=require('fs');var fs_extra=require(_0x6605('0xa'));var _=require(_0x6605('0xb'));var squel=require(_0x6605('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6605('0x8'));var querystring=require(_0x6605('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6605('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6605('0xf'));var logger=require('../../config/logger')(_0x6605('0x10'));var utils=require(_0x6605('0x11'));var config=require(_0x6605('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x6605('0x13'))['db'];var integrations=require(_0x6605('0x14'));function respondWithStatusCode(_0x4c3f94,_0x1ecfb4){_0x1ecfb4=_0x1ecfb4||0xcc;return function(_0x202abc){if(_0x202abc){return _0x4c3f94[_0x6605('0x15')](_0x1ecfb4);}return _0x4c3f94[_0x6605('0x16')](_0x1ecfb4)[_0x6605('0x17')]();};}function respondWithResult(_0x366c71,_0x5c7f39){_0x5c7f39=_0x5c7f39||0xc8;return function(_0x1a2d33){if(_0x1a2d33){return _0x366c71[_0x6605('0x16')](_0x5c7f39)['json'](_0x1a2d33);}};}function respondWithFilteredResult(_0x5b92f6,_0x1b21a3){return function(_0x256608){if(_0x256608){var _0x4ed857=typeof _0x1b21a3[_0x6605('0x18')]===_0x6605('0x19')&&typeof _0x1b21a3[_0x6605('0x1a')]===_0x6605('0x19');var _0x3f9627=_0x256608[_0x6605('0x1b')];var _0x75fcba=_0x4ed857?0x0:_0x1b21a3[_0x6605('0x18')];var _0x28550c=_0x4ed857?_0x256608[_0x6605('0x1b')]:_0x1b21a3[_0x6605('0x18')]+_0x1b21a3[_0x6605('0x1a')];var _0xa6f1ef;if(_0x28550c>=_0x3f9627){_0x28550c=_0x3f9627;_0xa6f1ef=0xc8;}else{_0xa6f1ef=0xce;}_0x5b92f6['status'](_0xa6f1ef);return _0x5b92f6[_0x6605('0x1c')]('Content-Range',_0x75fcba+'-'+_0x28550c+'/'+_0x3f9627)[_0x6605('0x1d')](_0x256608);}return null;};}function patchUpdates(_0x599aad){return function(_0x404f6d){try{jsonpatch[_0x6605('0x1e')](_0x404f6d,_0x599aad,!![]);}catch(_0x280a57){return BPromise[_0x6605('0x1f')](_0x280a57);}return _0x404f6d[_0x6605('0x20')]();};}function saveUpdates(_0x42435a,_0xbb87c){return function(_0x1fca5a){if(_0x1fca5a){return _0x1fca5a[_0x6605('0x21')](_0x42435a)['then'](function(_0x14ba64){return _0x14ba64;});}return null;};}function removeEntity(_0x691ab1,_0x1367a1){return function(_0x1f08db){if(_0x1f08db){return _0x1f08db[_0x6605('0x22')]()[_0x6605('0x23')](function(){_0x691ab1[_0x6605('0x16')](0xcc)[_0x6605('0x17')]();});}};}function handleEntityNotFound(_0x4b74b2,_0x5ac7ee){return function(_0x16be86){if(!_0x16be86){_0x4b74b2['sendStatus'](0x194);}return _0x16be86;};}function handleError(_0x20ec32,_0x38e0cc){_0x38e0cc=_0x38e0cc||0x1f4;return function(_0x479e10){logger[_0x6605('0x24')](_0x479e10[_0x6605('0x25')]);if(_0x479e10[_0x6605('0x26')]){delete _0x479e10[_0x6605('0x26')];}_0x20ec32['status'](_0x38e0cc)[_0x6605('0x27')](_0x479e10);};}exports[_0x6605('0x28')]=function(_0x552843,_0x4e1563){var _0x47a072={},_0x2b1831={},_0x42f100={'count':0x0,'rows':[]};var _0x2a9dcf=_[_0x6605('0x29')](db[_0x6605('0x2a')][_0x6605('0x2b')],function(_0x211981){return{'name':_0x211981['fieldName'],'type':_0x211981[_0x6605('0x2c')][_0x6605('0x2d')]};});_0x2b1831['model']=_['map'](_0x2a9dcf,_0x6605('0x26'));_0x2b1831[_0x6605('0x2e')]=_[_0x6605('0x2f')](_0x552843['query']);_0x2b1831[_0x6605('0x30')]=_[_0x6605('0x31')](_0x2b1831[_0x6605('0x32')],_0x2b1831[_0x6605('0x2e')]);_0x47a072[_0x6605('0x33')]=_['intersection'](_0x2b1831['model'],qs['fields'](_0x552843['query'][_0x6605('0x34')]));_0x47a072[_0x6605('0x33')]=_0x47a072[_0x6605('0x33')][_0x6605('0x35')]?_0x47a072[_0x6605('0x33')]:_0x2b1831[_0x6605('0x32')];if(!_0x552843['query'][_0x6605('0x36')](_0x6605('0x37'))){_0x47a072[_0x6605('0x1a')]=qs['limit'](_0x552843[_0x6605('0x2e')]['limit']);_0x47a072['offset']=qs[_0x6605('0x18')](_0x552843[_0x6605('0x2e')][_0x6605('0x18')]);}_0x47a072[_0x6605('0x38')]=qs[_0x6605('0x39')](_0x552843[_0x6605('0x2e')][_0x6605('0x39')]);_0x47a072['where']=qs[_0x6605('0x30')](_[_0x6605('0x3a')](_0x552843[_0x6605('0x2e')],_0x2b1831[_0x6605('0x30')]),_0x2a9dcf);if(_0x552843[_0x6605('0x2e')][_0x6605('0x3b')]){_0x47a072['where']=_[_0x6605('0x3c')](_0x47a072[_0x6605('0x3d')],{'$or':_[_0x6605('0x29')](_0x2a9dcf,function(_0x3dcbc1){if(_0x3dcbc1['type']!==_0x6605('0x3e')){var _0x5ded70={};_0x5ded70[_0x3dcbc1[_0x6605('0x26')]]={'$like':'%'+_0x552843[_0x6605('0x2e')]['filter']+'%'};return _0x5ded70;}})});}_0x47a072=_[_0x6605('0x3c')]({},_0x47a072,_0x552843[_0x6605('0x3f')]);var _0x36d6b6={'where':_0x47a072[_0x6605('0x3d')]};return db[_0x6605('0x2a')]['count'](_0x36d6b6)[_0x6605('0x23')](function(_0x3dc1f3){_0x42f100['count']=_0x3dc1f3;if(_0x552843[_0x6605('0x2e')][_0x6605('0x40')]){_0x47a072[_0x6605('0x41')]=[{'all':!![]}];}return db[_0x6605('0x2a')][_0x6605('0x42')](_0x47a072);})[_0x6605('0x23')](function(_0x3b6b2c){_0x42f100['rows']=_0x3b6b2c;return _0x42f100;})[_0x6605('0x23')](respondWithFilteredResult(_0x4e1563,_0x47a072))[_0x6605('0x43')](handleError(_0x4e1563,null));};exports['show']=function(_0x208d9f,_0x349345){var _0x4ffcd3={'raw':![],'where':{'id':_0x208d9f[_0x6605('0x44')]['id']}},_0x19c401={};_0x19c401['model']=_[_0x6605('0x2f')](db[_0x6605('0x2a')][_0x6605('0x2b')]);_0x19c401[_0x6605('0x2e')]=_['keys'](_0x208d9f[_0x6605('0x2e')]);_0x19c401['filters']=_['intersection'](_0x19c401['model'],_0x19c401[_0x6605('0x2e')]);_0x4ffcd3[_0x6605('0x33')]=_[_0x6605('0x31')](_0x19c401['model'],qs[_0x6605('0x34')](_0x208d9f[_0x6605('0x2e')][_0x6605('0x34')]));_0x4ffcd3['attributes']=_0x4ffcd3['attributes'][_0x6605('0x35')]?_0x4ffcd3['attributes']:_0x19c401[_0x6605('0x32')];if(_0x208d9f[_0x6605('0x2e')][_0x6605('0x40')]){_0x4ffcd3[_0x6605('0x41')]=[{'all':!![]}];}_0x4ffcd3=_[_0x6605('0x3c')]({},_0x4ffcd3,_0x208d9f[_0x6605('0x3f')]);return db[_0x6605('0x2a')]['find'](_0x4ffcd3)[_0x6605('0x23')](handleEntityNotFound(_0x349345,null))['then'](respondWithResult(_0x349345,null))[_0x6605('0x43')](handleError(_0x349345,null));};exports[_0x6605('0x45')]=function(_0x21e454,_0x341156){return db[_0x6605('0x2a')][_0x6605('0x45')](_0x21e454[_0x6605('0x46')],{})['then'](respondWithResult(_0x341156,0xc9))[_0x6605('0x43')](handleError(_0x341156,null));};exports[_0x6605('0x21')]=function(_0x454de6,_0x4d535c){if(_0x454de6[_0x6605('0x46')]['id']){delete _0x454de6[_0x6605('0x46')]['id'];}return db[_0x6605('0x2a')][_0x6605('0x47')]({'where':{'id':_0x454de6[_0x6605('0x44')]['id']}})[_0x6605('0x23')](handleEntityNotFound(_0x4d535c,null))[_0x6605('0x23')](saveUpdates(_0x454de6[_0x6605('0x46')],null))[_0x6605('0x23')](respondWithResult(_0x4d535c,null))[_0x6605('0x43')](handleError(_0x4d535c,null));};exports[_0x6605('0x22')]=function(_0x3952fa,_0x1b6531){return db[_0x6605('0x2a')][_0x6605('0x47')]({'where':{'id':_0x3952fa['params']['id']}})[_0x6605('0x23')](handleEntityNotFound(_0x1b6531,null))['then'](removeEntity(_0x1b6531,null))[_0x6605('0x43')](handleError(_0x1b6531,null));};exports[_0x6605('0x48')]=function(_0x544e66,_0x2601bf,_0x274f97){var _0x33d9a2={};var _0x6a2be6={};var _0x56c9cd;var _0x38b473;return db['VtigerAccount'][_0x6605('0x49')]({'where':{'id':_0x544e66[_0x6605('0x44')]['id']}})['then'](handleEntityNotFound(_0x2601bf,null))[_0x6605('0x23')](function(_0x22657a){if(_0x22657a){_0x56c9cd=_0x22657a;_0x6a2be6[_0x6605('0x32')]=_['keys'](db[_0x6605('0x4a')][_0x6605('0x2b')]);_0x6a2be6['query']=_[_0x6605('0x2f')](_0x544e66['query']);_0x6a2be6[_0x6605('0x30')]=_['intersection'](_0x6a2be6[_0x6605('0x32')],_0x6a2be6[_0x6605('0x2e')]);_0x33d9a2[_0x6605('0x33')]=_[_0x6605('0x31')](_0x6a2be6[_0x6605('0x32')],qs[_0x6605('0x34')](_0x544e66[_0x6605('0x2e')][_0x6605('0x34')]));_0x33d9a2[_0x6605('0x33')]=_0x33d9a2[_0x6605('0x33')]['length']?_0x33d9a2[_0x6605('0x33')]:_0x6a2be6[_0x6605('0x32')];_0x33d9a2[_0x6605('0x38')]=qs[_0x6605('0x39')](_0x544e66['query'][_0x6605('0x39')]);_0x33d9a2[_0x6605('0x3d')]=qs[_0x6605('0x30')](_['pick'](_0x544e66[_0x6605('0x2e')],_0x6a2be6[_0x6605('0x30')]));if(_0x544e66['query'][_0x6605('0x3b')]){_0x33d9a2[_0x6605('0x3d')]=_[_0x6605('0x3c')](_0x33d9a2[_0x6605('0x3d')],{'$or':_[_0x6605('0x29')](_0x33d9a2[_0x6605('0x33')],function(_0x4377a0){var _0x3f953b={};_0x3f953b[_0x4377a0]={'$like':'%'+_0x544e66['query']['filter']+'%'};return _0x3f953b;})});}_0x33d9a2=_['merge']({},_0x33d9a2,_0x544e66[_0x6605('0x3f')]);return _0x56c9cd[_0x6605('0x48')](_0x33d9a2);}})[_0x6605('0x23')](function(_0x2e2c4d){if(_0x2e2c4d){_0x38b473=_0x2e2c4d[_0x6605('0x35')];if(!_0x544e66['query'][_0x6605('0x36')](_0x6605('0x37'))){_0x33d9a2[_0x6605('0x1a')]=qs[_0x6605('0x1a')](_0x544e66[_0x6605('0x2e')][_0x6605('0x1a')]);_0x33d9a2[_0x6605('0x18')]=qs[_0x6605('0x18')](_0x544e66['query']['offset']);}return _0x56c9cd[_0x6605('0x48')](_0x33d9a2);}})[_0x6605('0x23')](function(_0x440c60){if(_0x440c60){return _0x440c60?{'count':_0x38b473,'rows':_0x440c60}:null;}})[_0x6605('0x23')](respondWithResult(_0x2601bf,null))[_0x6605('0x43')](handleError(_0x2601bf,null));};exports['addConfiguration']=function(_0x134a34,_0x4e2975,_0xaae64f){if(_0x134a34[_0x6605('0x46')]['id']){delete _0x134a34['body']['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x134a34[_0x6605('0x44')]['id']}})[_0x6605('0x23')](handleEntityNotFound(_0x4e2975,null))['then'](function(_0x2f7c41){if(_0x2f7c41){_0x134a34[_0x6605('0x46')][_0x6605('0x4b')]=_0x2f7c41['id'];_0x134a34[_0x6605('0x46')][_0x6605('0x4c')]=integrations[_0x6605('0x4d')](_0x134a34['body'][_0x6605('0x4e')],_0x134a34['body'][_0x6605('0x2c')]);_0x134a34[_0x6605('0x46')]['Descriptions']=integrations['getDescriptions'](_0x134a34[_0x6605('0x46')][_0x6605('0x4e')],_0x134a34[_0x6605('0x46')][_0x6605('0x2c')]);return db[_0x6605('0x4a')][_0x6605('0x45')](_0x134a34[_0x6605('0x46')],{'include':[{'model':db[_0x6605('0x4f')],'as':_0x6605('0x4c')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x6605('0x23')](respondWithResult(_0x4e2975,null))[_0x6605('0x43')](handleError(_0x4e2975,null));};var md5=require('md5');exports['getFields']=function(_0x1d53e3,_0x9abfab,_0x4c4159){var _0x19fbc2=null;var _0x28e561=null;var _0x139b4a=null;var _0x56cb9c=null;var _0xbd830d='';return db['VtigerAccount'][_0x6605('0x49')]({'where':{'id':_0x1d53e3[_0x6605('0x44')]['id']},'attributes':['id',_0x6605('0x26'),'username',_0x6605('0x50'),_0x6605('0x51'),_0x6605('0x52'),_0x6605('0x53'),'accessKey']})[_0x6605('0x23')](handleEntityNotFound(_0x9abfab,null))['then'](function(_0x2a51c7){if(_0x2a51c7){_0x19fbc2=_0x2a51c7[_0x6605('0x54')];_0x28e561=_0x2a51c7[_0x6605('0x55')];_0x139b4a=_0x2a51c7[_0x6605('0x51')];_0xbd830d=_0x2a51c7[_0x6605('0x52')];var _0x28651a=_0xbd830d[_0x6605('0x56')](-0x1);if(_0x28651a==='/'){_0xbd830d=_0xbd830d['substring'](0x0,_0xbd830d[_0x6605('0x57')](_0x28651a));}_0x56cb9c=util[_0x6605('0x58')](_0x6605('0x59'),_0xbd830d);var _0x59dec2={'method':_0x6605('0x5a'),'uri':_0x56cb9c,'qs':{'operation':_0x6605('0x5b'),'username':_0x2a51c7['username']},'json':!![]};return rp(_0x59dec2);}})[_0x6605('0x23')](function(_0x3c3a70){if(_0x3c3a70[_0x6605('0x5c')]){var _0x320e55={'method':'POST','uri':_0x56cb9c,'form':{'operation':_0x6605('0x5d'),'username':_0x19fbc2,'accessKey':md5(_0x3c3a70[_0x6605('0x5e')][_0x6605('0x5f')]+_0x28e561)},'json':!![]};return rp(_0x320e55);}})[_0x6605('0x23')](function(_0x8141a0){if(_0x8141a0[_0x6605('0x5c')]){var _0x2562a7={'method':_0x6605('0x5a'),'uri':_0x56cb9c,'qs':{'operation':_0x6605('0x60'),'username':_0x19fbc2,'sessionName':_0x8141a0[_0x6605('0x5e')][_0x6605('0x61')],'elementType':_0x139b4a},'json':!![]};return rp(_0x2562a7);}})['then'](function(_0x32d607){if(_0x32d607[_0x6605('0x5c')]){var _0x3a7677=[_0x6605('0x62'),_0x6605('0x63'),_0x6605('0x64')];_['remove'](_0x32d607[_0x6605('0x5e')][_0x6605('0x34')],function(_0xe9482b){return _0x3a7677['includes'](_0xe9482b['type']['name']);});_[_0x6605('0x65')](_0x32d607[_0x6605('0x5e')][_0x6605('0x34')],function(_0x15f0ca){return _0x15f0ca['editable']===_0x6605('0x66');});return{'count':_0x32d607[_0x6605('0x5e')][_0x6605('0x34')]['length'],'rows':_[_0x6605('0x29')](_0x32d607['result']['fields'],function(_0x221b4c){return{'id':_0x221b4c['name'],'name':_0x221b4c[_0x6605('0x67')],'custom':_[_0x6605('0x68')](_0x221b4c[_0x6605('0x26')],_0x6605('0x69'))?!![]:![],'options':_0x221b4c['type'][_0x6605('0x26')]===_0x6605('0x6a')&&_0x221b4c[_0x6605('0x2c')][_0x6605('0x6b')][_0x6605('0x35')]>0x0?_[_0x6605('0x29')](_0x221b4c[_0x6605('0x2c')][_0x6605('0x6b')],function(_0x387fce){return{'name':_0x387fce[_0x6605('0x67')],'value':_0x387fce[_0x6605('0x6c')]};}):[]};})};}})[_0x6605('0x23')](respondWithResult(_0x9abfab,null))['catch'](function(_0x1cbfcd){console[_0x6605('0x6d')](_0x6605('0x6e')+_0x1cbfcd);var _0x228d08=_0x1d53e3['query'][_0x6605('0x6f')]?0x1f4:_0x1cbfcd['statusCode']||0x1f4;logger[_0x6605('0x24')](_0x6605('0x70'),'getFields',_0x228d08,JSON['stringify'](_0x1cbfcd));delete _0x1cbfcd[_0x6605('0x26')];if(_0x228d08===0x191){_0x228d08=0x190;}_0x9abfab['status'](_0x228d08)[_0x6605('0x27')](_0x1d53e3[_0x6605('0x2e')][_0x6605('0x6f')]?{'message':_0x6605('0x71'),'statusCode':_0x1cbfcd[_0x6605('0x72')]}:_0x1cbfcd);});}; \ No newline at end of file +var _0x6a83=['map','VtigerAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','update','getConfigurations','findOne','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','create','VtigerField','getFields','username','moduleName','serverUrl','accessKey','slice','lastIndexOf','format','GET','getchallenge','POST','login','result','token','success','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','destroy','then','error','stack','name','send'];(function(_0x3d5daa,_0xdbb491){var _0x161588=function(_0x2c28f9){while(--_0x2c28f9){_0x3d5daa['push'](_0x3d5daa['shift']());}};_0x161588(++_0xdbb491);}(_0x6a83,0x1a4));var _0x36a8=function(_0x10d3b5,_0x453611){_0x10d3b5=_0x10d3b5-0x0;var _0x4c385e=_0x6a83[_0x10d3b5];return _0x4c385e;};'use strict';var emlformat=require(_0x36a8('0x0'));var rimraf=require(_0x36a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x36a8('0x2'));var rp=require(_0x36a8('0x3'));var moment=require(_0x36a8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x36a8('0x5'));var util=require(_0x36a8('0x6'));var path=require(_0x36a8('0x7'));var sox=require(_0x36a8('0x8'));var csv=require(_0x36a8('0x9'));var ejs=require(_0x36a8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x36a8('0xb'));var squel=require(_0x36a8('0xc'));var crypto=require(_0x36a8('0xd'));var jsforce=require(_0x36a8('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x36a8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x36a8('0x10'));var as=require(_0x36a8('0x11'));var hardwareService=require(_0x36a8('0x12'));var logger=require('../../config/logger')(_0x36a8('0x13'));var utils=require(_0x36a8('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x36a8('0x15'))['db'];var integrations=require(_0x36a8('0x16'));function respondWithStatusCode(_0x33d83a,_0x580de9){_0x580de9=_0x580de9||0xcc;return function(_0x223821){if(_0x223821){return _0x33d83a[_0x36a8('0x17')](_0x580de9);}return _0x33d83a['status'](_0x580de9)[_0x36a8('0x18')]();};}function respondWithResult(_0x5a003d,_0x51a95e){_0x51a95e=_0x51a95e||0xc8;return function(_0x360429){if(_0x360429){return _0x5a003d[_0x36a8('0x19')](_0x51a95e)[_0x36a8('0x1a')](_0x360429);}};}function respondWithFilteredResult(_0x5d9a08,_0x2b61d6){return function(_0x225baa){if(_0x225baa){var _0x278b63=typeof _0x2b61d6[_0x36a8('0x1b')]===_0x36a8('0x1c')&&typeof _0x2b61d6[_0x36a8('0x1d')]===_0x36a8('0x1c');var _0x1e14bd=_0x225baa[_0x36a8('0x1e')];var _0x21a28b=_0x278b63?0x0:_0x2b61d6[_0x36a8('0x1b')];var _0x5ae6a6=_0x278b63?_0x225baa[_0x36a8('0x1e')]:_0x2b61d6['offset']+_0x2b61d6['limit'];var _0x12a21e;if(_0x5ae6a6>=_0x1e14bd){_0x5ae6a6=_0x1e14bd;_0x12a21e=0xc8;}else{_0x12a21e=0xce;}_0x5d9a08[_0x36a8('0x19')](_0x12a21e);return _0x5d9a08[_0x36a8('0x1f')](_0x36a8('0x20'),_0x21a28b+'-'+_0x5ae6a6+'/'+_0x1e14bd)['json'](_0x225baa);}return null;};}function patchUpdates(_0x127d31){return function(_0x27428f){try{jsonpatch['apply'](_0x27428f,_0x127d31,!![]);}catch(_0x13be09){return BPromise['reject'](_0x13be09);}return _0x27428f[_0x36a8('0x21')]();};}function saveUpdates(_0x1ae46b,_0x5c874f){return function(_0x49cf18){if(_0x49cf18){return _0x49cf18['update'](_0x1ae46b)['then'](function(_0x94af7a){return _0x94af7a;});}return null;};}function removeEntity(_0x27de79,_0x54cd1d){return function(_0x4df5e1){if(_0x4df5e1){return _0x4df5e1[_0x36a8('0x22')]()[_0x36a8('0x23')](function(){_0x27de79[_0x36a8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f62c,_0x3b182a){return function(_0x24f881){if(!_0x24f881){_0x12f62c[_0x36a8('0x17')](0x194);}return _0x24f881;};}function handleError(_0x2f045c,_0x152958){_0x152958=_0x152958||0x1f4;return function(_0x4bb33e){logger[_0x36a8('0x24')](_0x4bb33e[_0x36a8('0x25')]);if(_0x4bb33e[_0x36a8('0x26')]){delete _0x4bb33e[_0x36a8('0x26')];}_0x2f045c['status'](_0x152958)[_0x36a8('0x27')](_0x4bb33e);};}exports['index']=function(_0x198ecf,_0x44d1b3){var _0x15c6ec={},_0x1abe64={},_0x2c392e={'count':0x0,'rows':[]};var _0x317c03=_[_0x36a8('0x28')](db[_0x36a8('0x29')]['rawAttributes'],function(_0x3fad4e){return{'name':_0x3fad4e[_0x36a8('0x2a')],'type':_0x3fad4e[_0x36a8('0x2b')][_0x36a8('0x2c')]};});_0x1abe64[_0x36a8('0x2d')]=_[_0x36a8('0x28')](_0x317c03,_0x36a8('0x26'));_0x1abe64[_0x36a8('0x2e')]=_[_0x36a8('0x2f')](_0x198ecf[_0x36a8('0x2e')]);_0x1abe64[_0x36a8('0x30')]=_[_0x36a8('0x31')](_0x1abe64[_0x36a8('0x2d')],_0x1abe64['query']);_0x15c6ec[_0x36a8('0x32')]=_[_0x36a8('0x31')](_0x1abe64[_0x36a8('0x2d')],qs[_0x36a8('0x33')](_0x198ecf[_0x36a8('0x2e')]['fields']));_0x15c6ec[_0x36a8('0x32')]=_0x15c6ec[_0x36a8('0x32')][_0x36a8('0x34')]?_0x15c6ec['attributes']:_0x1abe64[_0x36a8('0x2d')];if(!_0x198ecf['query']['hasOwnProperty'](_0x36a8('0x35'))){_0x15c6ec[_0x36a8('0x1d')]=qs[_0x36a8('0x1d')](_0x198ecf['query'][_0x36a8('0x1d')]);_0x15c6ec[_0x36a8('0x1b')]=qs[_0x36a8('0x1b')](_0x198ecf[_0x36a8('0x2e')][_0x36a8('0x1b')]);}_0x15c6ec[_0x36a8('0x36')]=qs[_0x36a8('0x37')](_0x198ecf[_0x36a8('0x2e')]['sort']);_0x15c6ec['where']=qs[_0x36a8('0x30')](_[_0x36a8('0x38')](_0x198ecf[_0x36a8('0x2e')],_0x1abe64[_0x36a8('0x30')]),_0x317c03);if(_0x198ecf[_0x36a8('0x2e')][_0x36a8('0x39')]){_0x15c6ec[_0x36a8('0x3a')]=_[_0x36a8('0x3b')](_0x15c6ec[_0x36a8('0x3a')],{'$or':_[_0x36a8('0x28')](_0x317c03,function(_0x29ff39){if(_0x29ff39[_0x36a8('0x2b')]!==_0x36a8('0x3c')){var _0x1524d7={};_0x1524d7[_0x29ff39[_0x36a8('0x26')]]={'$like':'%'+_0x198ecf[_0x36a8('0x2e')][_0x36a8('0x39')]+'%'};return _0x1524d7;}})});}_0x15c6ec=_[_0x36a8('0x3b')]({},_0x15c6ec,_0x198ecf[_0x36a8('0x3d')]);var _0x8c5948={'where':_0x15c6ec[_0x36a8('0x3a')]};return db[_0x36a8('0x29')][_0x36a8('0x1e')](_0x8c5948)[_0x36a8('0x23')](function(_0xa7e595){_0x2c392e[_0x36a8('0x1e')]=_0xa7e595;if(_0x198ecf[_0x36a8('0x2e')][_0x36a8('0x3e')]){_0x15c6ec[_0x36a8('0x3f')]=[{'all':!![]}];}return db[_0x36a8('0x29')][_0x36a8('0x40')](_0x15c6ec);})[_0x36a8('0x23')](function(_0x46cff4){_0x2c392e[_0x36a8('0x41')]=_0x46cff4;return _0x2c392e;})[_0x36a8('0x23')](respondWithFilteredResult(_0x44d1b3,_0x15c6ec))[_0x36a8('0x42')](handleError(_0x44d1b3,null));};exports[_0x36a8('0x43')]=function(_0x3df200,_0x383cd3){var _0x4ded8c={'raw':![],'where':{'id':_0x3df200[_0x36a8('0x44')]['id']}},_0x50233e={};_0x50233e[_0x36a8('0x2d')]=_[_0x36a8('0x2f')](db[_0x36a8('0x29')][_0x36a8('0x45')]);_0x50233e[_0x36a8('0x2e')]=_['keys'](_0x3df200[_0x36a8('0x2e')]);_0x50233e[_0x36a8('0x30')]=_[_0x36a8('0x31')](_0x50233e[_0x36a8('0x2d')],_0x50233e[_0x36a8('0x2e')]);_0x4ded8c[_0x36a8('0x32')]=_['intersection'](_0x50233e[_0x36a8('0x2d')],qs[_0x36a8('0x33')](_0x3df200['query'][_0x36a8('0x33')]));_0x4ded8c[_0x36a8('0x32')]=_0x4ded8c['attributes'][_0x36a8('0x34')]?_0x4ded8c[_0x36a8('0x32')]:_0x50233e[_0x36a8('0x2d')];if(_0x3df200[_0x36a8('0x2e')][_0x36a8('0x3e')]){_0x4ded8c[_0x36a8('0x3f')]=[{'all':!![]}];}_0x4ded8c=_[_0x36a8('0x3b')]({},_0x4ded8c,_0x3df200['options']);return db[_0x36a8('0x29')][_0x36a8('0x46')](_0x4ded8c)['then'](handleEntityNotFound(_0x383cd3,null))[_0x36a8('0x23')](respondWithResult(_0x383cd3,null))[_0x36a8('0x42')](handleError(_0x383cd3,null));};exports['create']=function(_0x1e9d2b,_0x90a0be){return db['VtigerAccount']['create'](_0x1e9d2b[_0x36a8('0x47')],{})['then'](respondWithResult(_0x90a0be,0xc9))[_0x36a8('0x42')](handleError(_0x90a0be,null));};exports[_0x36a8('0x48')]=function(_0x183824,_0x5b3239){if(_0x183824[_0x36a8('0x47')]['id']){delete _0x183824[_0x36a8('0x47')]['id'];}return db[_0x36a8('0x29')][_0x36a8('0x46')]({'where':{'id':_0x183824[_0x36a8('0x44')]['id']}})[_0x36a8('0x23')](handleEntityNotFound(_0x5b3239,null))[_0x36a8('0x23')](saveUpdates(_0x183824['body'],null))[_0x36a8('0x23')](respondWithResult(_0x5b3239,null))[_0x36a8('0x42')](handleError(_0x5b3239,null));};exports['destroy']=function(_0x4c4c06,_0x3e6305){return db['VtigerAccount']['find']({'where':{'id':_0x4c4c06[_0x36a8('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e6305,null))[_0x36a8('0x23')](removeEntity(_0x3e6305,null))['catch'](handleError(_0x3e6305,null));};exports[_0x36a8('0x49')]=function(_0x6a46ef,_0x2a9f07,_0x27edd3){var _0x2e3570={};var _0x6a172d={};var _0x2092b7;var _0x4a8d86;return db['VtigerAccount'][_0x36a8('0x4a')]({'where':{'id':_0x6a46ef[_0x36a8('0x44')]['id']}})[_0x36a8('0x23')](handleEntityNotFound(_0x2a9f07,null))['then'](function(_0x503ca0){if(_0x503ca0){_0x2092b7=_0x503ca0;_0x6a172d[_0x36a8('0x2d')]=_[_0x36a8('0x2f')](db['VtigerConfiguration'][_0x36a8('0x45')]);_0x6a172d[_0x36a8('0x2e')]=_[_0x36a8('0x2f')](_0x6a46ef['query']);_0x6a172d[_0x36a8('0x30')]=_[_0x36a8('0x31')](_0x6a172d['model'],_0x6a172d[_0x36a8('0x2e')]);_0x2e3570['attributes']=_['intersection'](_0x6a172d[_0x36a8('0x2d')],qs[_0x36a8('0x33')](_0x6a46ef['query']['fields']));_0x2e3570[_0x36a8('0x32')]=_0x2e3570[_0x36a8('0x32')][_0x36a8('0x34')]?_0x2e3570[_0x36a8('0x32')]:_0x6a172d['model'];_0x2e3570[_0x36a8('0x36')]=qs[_0x36a8('0x37')](_0x6a46ef[_0x36a8('0x2e')][_0x36a8('0x37')]);_0x2e3570[_0x36a8('0x3a')]=qs['filters'](_[_0x36a8('0x38')](_0x6a46ef[_0x36a8('0x2e')],_0x6a172d[_0x36a8('0x30')]));if(_0x6a46ef[_0x36a8('0x2e')][_0x36a8('0x39')]){_0x2e3570[_0x36a8('0x3a')]=_[_0x36a8('0x3b')](_0x2e3570[_0x36a8('0x3a')],{'$or':_[_0x36a8('0x28')](_0x2e3570['attributes'],function(_0x321346){var _0x15fddf={};_0x15fddf[_0x321346]={'$like':'%'+_0x6a46ef[_0x36a8('0x2e')]['filter']+'%'};return _0x15fddf;})});}_0x2e3570=_[_0x36a8('0x3b')]({},_0x2e3570,_0x6a46ef[_0x36a8('0x3d')]);return _0x2092b7[_0x36a8('0x49')](_0x2e3570);}})['then'](function(_0x4a4e00){if(_0x4a4e00){_0x4a8d86=_0x4a4e00[_0x36a8('0x34')];if(!_0x6a46ef[_0x36a8('0x2e')][_0x36a8('0x4b')](_0x36a8('0x35'))){_0x2e3570[_0x36a8('0x1d')]=qs['limit'](_0x6a46ef[_0x36a8('0x2e')][_0x36a8('0x1d')]);_0x2e3570[_0x36a8('0x1b')]=qs['offset'](_0x6a46ef['query']['offset']);}return _0x2092b7['getConfigurations'](_0x2e3570);}})[_0x36a8('0x23')](function(_0x2ea445){if(_0x2ea445){return _0x2ea445?{'count':_0x4a8d86,'rows':_0x2ea445}:null;}})['then'](respondWithResult(_0x2a9f07,null))[_0x36a8('0x42')](handleError(_0x2a9f07,null));};exports[_0x36a8('0x4c')]=function(_0x362f5c,_0x476285,_0x2efa7f){if(_0x362f5c[_0x36a8('0x47')]['id']){delete _0x362f5c[_0x36a8('0x47')]['id'];}return db[_0x36a8('0x29')][_0x36a8('0x4a')]({'where':{'id':_0x362f5c[_0x36a8('0x44')]['id']}})[_0x36a8('0x23')](handleEntityNotFound(_0x476285,null))[_0x36a8('0x23')](function(_0x404402){if(_0x404402){_0x362f5c['body']['AccountId']=_0x404402['id'];_0x362f5c[_0x36a8('0x47')][_0x36a8('0x4d')]=integrations[_0x36a8('0x4e')](_0x362f5c[_0x36a8('0x47')][_0x36a8('0x4f')],_0x362f5c[_0x36a8('0x47')][_0x36a8('0x2b')]);_0x362f5c[_0x36a8('0x47')][_0x36a8('0x50')]=integrations['getDescriptions'](_0x362f5c['body'][_0x36a8('0x4f')],_0x362f5c[_0x36a8('0x47')][_0x36a8('0x2b')]);return db['VtigerConfiguration'][_0x36a8('0x51')](_0x362f5c[_0x36a8('0x47')],{'include':[{'model':db[_0x36a8('0x52')],'as':_0x36a8('0x4d')},{'model':db[_0x36a8('0x52')],'as':_0x36a8('0x50')}]});}return null;})[_0x36a8('0x23')](respondWithResult(_0x476285,null))[_0x36a8('0x42')](handleError(_0x476285,null));};var md5=require('md5');exports[_0x36a8('0x53')]=function(_0x719a16,_0x712cb0,_0x5485d4){var _0x1d9694=null;var _0x5eae85=null;var _0x29486d=null;var _0x26bdb1=null;var _0x9d3931='';return db[_0x36a8('0x29')]['findOne']({'where':{'id':_0x719a16[_0x36a8('0x44')]['id']},'attributes':['id',_0x36a8('0x26'),_0x36a8('0x54'),'description',_0x36a8('0x55'),'remoteUri',_0x36a8('0x56'),_0x36a8('0x57')]})['then'](handleEntityNotFound(_0x712cb0,null))[_0x36a8('0x23')](function(_0x49d788){if(_0x49d788){_0x1d9694=_0x49d788[_0x36a8('0x54')];_0x5eae85=_0x49d788['accessKey'];_0x29486d=_0x49d788[_0x36a8('0x55')];_0x9d3931=_0x49d788['remoteUri'];var _0x1bcf87=_0x9d3931[_0x36a8('0x58')](-0x1);if(_0x1bcf87==='/'){_0x9d3931=_0x9d3931['substring'](0x0,_0x9d3931[_0x36a8('0x59')](_0x1bcf87));}_0x26bdb1=util[_0x36a8('0x5a')]('%s/webservice.php',_0x9d3931);var _0x1c038d={'method':_0x36a8('0x5b'),'uri':_0x26bdb1,'qs':{'operation':_0x36a8('0x5c'),'username':_0x49d788['username']},'json':!![]};return rp(_0x1c038d);}})['then'](function(_0x21ec12){if(_0x21ec12['success']){var _0x2a5934={'method':_0x36a8('0x5d'),'uri':_0x26bdb1,'form':{'operation':_0x36a8('0x5e'),'username':_0x1d9694,'accessKey':md5(_0x21ec12[_0x36a8('0x5f')][_0x36a8('0x60')]+_0x5eae85)},'json':!![]};return rp(_0x2a5934);}})[_0x36a8('0x23')](function(_0x57f96b){if(_0x57f96b[_0x36a8('0x61')]){var _0x355ec1={'method':_0x36a8('0x5b'),'uri':_0x26bdb1,'qs':{'operation':'describe','username':_0x1d9694,'sessionName':_0x57f96b[_0x36a8('0x5f')]['sessionName'],'elementType':_0x29486d},'json':!![]};return rp(_0x355ec1);}})[_0x36a8('0x23')](function(_0x4edefe){if(_0x4edefe[_0x36a8('0x61')]){var _0x36e292=[_0x36a8('0x62'),_0x36a8('0x63'),_0x36a8('0x64')];_[_0x36a8('0x65')](_0x4edefe[_0x36a8('0x5f')][_0x36a8('0x33')],function(_0x443671){return _0x36e292[_0x36a8('0x66')](_0x443671[_0x36a8('0x2b')][_0x36a8('0x26')]);});_['remove'](_0x4edefe[_0x36a8('0x5f')]['fields'],function(_0x37437a){return _0x37437a[_0x36a8('0x67')]===_0x36a8('0x68');});return{'count':_0x4edefe[_0x36a8('0x5f')][_0x36a8('0x33')]['length'],'rows':_[_0x36a8('0x28')](_0x4edefe[_0x36a8('0x5f')][_0x36a8('0x33')],function(_0x111642){return{'id':_0x111642[_0x36a8('0x26')],'name':_0x111642[_0x36a8('0x69')],'custom':_[_0x36a8('0x6a')](_0x111642[_0x36a8('0x26')],_0x36a8('0x6b'))?!![]:![],'options':_0x111642[_0x36a8('0x2b')]['name']===_0x36a8('0x6c')&&_0x111642['type'][_0x36a8('0x6d')]['length']>0x0?_[_0x36a8('0x28')](_0x111642[_0x36a8('0x2b')][_0x36a8('0x6d')],function(_0x23a5ac){return{'name':_0x23a5ac[_0x36a8('0x69')],'value':_0x23a5ac[_0x36a8('0x6e')]};}):[]};})};}})[_0x36a8('0x23')](respondWithResult(_0x712cb0,null))[_0x36a8('0x42')](function(_0x1f5dd0){console[_0x36a8('0x6f')](_0x36a8('0x70')+_0x1f5dd0);var _0x143408=_0x719a16[_0x36a8('0x2e')][_0x36a8('0x71')]?0x1f4:_0x1f5dd0[_0x36a8('0x72')]||0x1f4;logger[_0x36a8('0x24')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x143408,JSON['stringify'](_0x1f5dd0));delete _0x1f5dd0[_0x36a8('0x26')];if(_0x143408===0x191){_0x143408=0x190;}_0x712cb0[_0x36a8('0x19')](_0x143408)[_0x36a8('0x27')](_0x719a16['query'][_0x36a8('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x1f5dd0[_0x36a8('0x72')]}:_0x1f5dd0);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index b3d6785..9cee2ff 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 _0x4183=['request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x51d70c,_0x21848a){var _0xc939b1=function(_0x209f6a){while(--_0x209f6a){_0x51d70c['push'](_0x51d70c['shift']());}};_0xc939b1(++_0x21848a);}(_0x4183,0x112));var _0x3418=function(_0x451522,_0x55e766){_0x451522=_0x451522-0x0;var _0x24bee4=_0x4183[_0x451522];return _0x24bee4;};'use strict';var _=require(_0x3418('0x0'));var util=require(_0x3418('0x1'));var logger=require(_0x3418('0x2'))(_0x3418('0x3'));var moment=require(_0x3418('0x4'));var BPromise=require(_0x3418('0x5'));var rp=require(_0x3418('0x6'));var fs=require('fs');var path=require(_0x3418('0x7'));var rimraf=require('rimraf');var config=require(_0x3418('0x8'));var attributes=require(_0x3418('0x9'));var integrations=require(_0x3418('0xa'));module[_0x3418('0xb')]=function(_0x26920a,_0x1f0fdb){return _0x26920a[_0x3418('0xc')](_0x3418('0xd'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa3d=['request-promise','path','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x4f5519,_0x346fdc){var _0x1ae5c2=function(_0xd97be7){while(--_0xd97be7){_0x4f5519['push'](_0x4f5519['shift']());}};_0x1ae5c2(++_0x346fdc);}(_0xaa3d,0x177));var _0xdaa3=function(_0x484ac5,_0x552a1d){_0x484ac5=_0x484ac5-0x0;var _0x5a3c31=_0xaa3d[_0x484ac5];return _0x5a3c31;};'use strict';var _=require('lodash');var util=require(_0xdaa3('0x0'));var logger=require(_0xdaa3('0x1'))(_0xdaa3('0x2'));var moment=require(_0xdaa3('0x3'));var BPromise=require(_0xdaa3('0x4'));var rp=require(_0xdaa3('0x5'));var fs=require('fs');var path=require(_0xdaa3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x31ac34,_0x118a75){return _0x31ac34[_0xdaa3('0x7')](_0xdaa3('0x8'),attributes,{'tableName':_0xdaa3('0x9'),'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 28d35bf..6b13d55 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 _0x36ee=['message','info','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','find','ShowVtigerAccount','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5b6514,_0x22d770){var _0x8cf35=function(_0x1462d7){while(--_0x1462d7){_0x5b6514['push'](_0x5b6514['shift']());}};_0x8cf35(++_0x22d770);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36e('0x1'));var fs=require('fs');var Redis=require(_0xe36e('0x2'));var db=require(_0xe36e('0x3'))['db'];var utils=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var jayson=require(_0xe36e('0x8'));var client=jayson[_0xe36e('0x9')][_0xe36e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21be0b,_0x1aa596,_0x51b4bd){return new BPromise(function(_0x74b4b7,_0x4aebdd){return client[_0xe36e('0xb')](_0x21be0b,_0x51b4bd)[_0xe36e('0xc')](function(_0x46f239){logger['info'](_0xe36e('0xd'),_0x1aa596,'request\x20sent');logger[_0xe36e('0xe')](_0xe36e('0xf'),_0x1aa596,_0xe36e('0x10'),JSON[_0xe36e('0x11')](_0x46f239));if(_0x46f239[_0xe36e('0x12')]){if(_0x46f239[_0xe36e('0x12')][_0xe36e('0x13')]===0x1f4){logger[_0xe36e('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1aa596,_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);return _0x4aebdd(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}logger['error'](_0xe36e('0xd'),_0x1aa596,_0x46f239['error']['message']);return _0x74b4b7(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}else{logger[_0xe36e('0x15')](_0xe36e('0xd'),_0x1aa596,_0xe36e('0x10'));_0x74b4b7(_0x46f239[_0xe36e('0x16')][_0xe36e('0x14')]);}})[_0xe36e('0x17')](function(_0x387c37){logger[_0xe36e('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1aa596,_0x387c37);_0x4aebdd(_0x387c37);});});}exports[_0xe36e('0x18')]=function(_0x2184ae){var _0x56c019=this;return new Promise(function(_0x21d9a3,_0x533c06){return db[_0xe36e('0x19')][_0xe36e('0x1a')]({'raw':_0x2184ae['options']?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1c')]===undefined?!![]:![]:!![],'where':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae['options'][_0xe36e('0x1d')]||null:null,'attributes':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1e')]||null:null,'limit':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')]['limit']||null:null,'include':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x2184ae[_0xe36e('0x1b')]['include'],function(_0x598a7a){return{'model':db[_0x598a7a[_0xe36e('0x21')]],'as':_0x598a7a['as'],'attributes':_0x598a7a[_0xe36e('0x1e')],'include':_0x598a7a[_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x598a7a[_0xe36e('0x1f')],function(_0x1507f9){return{'model':db[_0x1507f9[_0xe36e('0x21')]],'as':_0x1507f9['as'],'attributes':_0x1507f9['attributes'],'include':_0x1507f9[_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x1507f9[_0xe36e('0x1f')],function(_0x262caa){return{'model':db[_0x262caa['model']],'as':_0x262caa['as'],'attributes':_0x262caa[_0xe36e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf7b02e){logger['info'](_0xe36e('0x18'),_0x2184ae);logger['debug'](_0xe36e('0x18'),_0x2184ae,JSON['stringify'](_0xf7b02e));_0x21d9a3(_0xf7b02e);})[_0xe36e('0x17')](function(_0x59548b){logger['error']('GetVtigerAccount',_0x59548b['message'],_0x2184ae);_0x533c06(_0x56c019[_0xe36e('0x12')](0x1f4,_0x59548b[_0xe36e('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x4ac819){var _0x1fa1ec=this;return new Promise(function(_0xb8d44e,_0x259e19){return db[_0xe36e('0x19')][_0xe36e('0x22')]({'raw':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819['options'][_0xe36e('0x1c')]===undefined?!![]:![]:!![],'where':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819['options'][_0xe36e('0x1d')]||null:null,'attributes':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819[_0xe36e('0x1b')][_0xe36e('0x1e')]||null:null,'include':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819[_0xe36e('0x1b')][_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x4ac819[_0xe36e('0x1b')][_0xe36e('0x1f')],function(_0xf808f5){return{'model':db[_0xf808f5['model']],'as':_0xf808f5['as'],'attributes':_0xf808f5[_0xe36e('0x1e')],'include':_0xf808f5['include']?_['map'](_0xf808f5[_0xe36e('0x1f')],function(_0x4f620d){return{'model':db[_0x4f620d[_0xe36e('0x21')]],'as':_0x4f620d['as'],'attributes':_0x4f620d[_0xe36e('0x1e')],'include':_0x4f620d[_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x4f620d['include'],function(_0x56135c){return{'model':db[_0x56135c[_0xe36e('0x21')]],'as':_0x56135c['as'],'attributes':_0x56135c[_0xe36e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe36e('0xc')](function(_0x243338){logger['info'](_0xe36e('0x23'),_0x4ac819);logger[_0xe36e('0xe')](_0xe36e('0x23'),_0x4ac819,JSON['stringify'](_0x243338));_0xb8d44e(_0x243338);})[_0xe36e('0x17')](function(_0x2ff8f4){logger['error'](_0xe36e('0x23'),_0x2ff8f4[_0xe36e('0x14')],_0x4ac819);_0x259e19(_0x1fa1ec[_0xe36e('0x12')](0x1f4,_0x2ff8f4[_0xe36e('0x14')]));});});}; \ No newline at end of file +var _0x69d3=['debug','stringify','error','code','message','result','catch','VtigerAccount','options','raw','attributes','limit','include','model','map','then','GetVtigerAccount','ShowVtigerAccount','find','where','lodash','util','moment','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x3c6edd,_0x57b795){var _0x73e901=function(_0x3a1da3){while(--_0x3a1da3){_0x3c6edd['push'](_0x3c6edd['shift']());}};_0x73e901(++_0x57b795);}(_0x69d3,0xda));var _0x369d=function(_0x3b2f85,_0x596bea){_0x3b2f85=_0x3b2f85-0x0;var _0x547e41=_0x69d3[_0x3b2f85];return _0x547e41;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var moment=require(_0x369d('0x2'));var BPromise=require('bluebird');var rs=require(_0x369d('0x3'));var fs=require('fs');var Redis=require(_0x369d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x369d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x369d('0x6'));var client=jayson[_0x369d('0x7')][_0x369d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x424d8c,_0x1bd94c,_0x186302){return new BPromise(function(_0x3adb26,_0x2ac0ec){return client[_0x369d('0x9')](_0x424d8c,_0x186302)['then'](function(_0x5d2ded){logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,_0x369d('0xc'));logger[_0x369d('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1bd94c,'request\x20sent',JSON[_0x369d('0xe')](_0x5d2ded));if(_0x5d2ded[_0x369d('0xf')]){if(_0x5d2ded[_0x369d('0xf')][_0x369d('0x10')]===0x1f4){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error'][_0x369d('0x11')]);return _0x2ac0ec(_0x5d2ded[_0x369d('0xf')][_0x369d('0x11')]);}logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error']['message']);return _0x3adb26(_0x5d2ded['error'][_0x369d('0x11')]);}else{logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,'request\x20sent');_0x3adb26(_0x5d2ded[_0x369d('0x12')][_0x369d('0x11')]);}})[_0x369d('0x13')](function(_0x4e234e){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x4e234e);_0x2ac0ec(_0x4e234e);});});}exports['GetVtigerAccount']=function(_0x572513){var _0x597b67=this;return new Promise(function(_0x2946be,_0x4494b3){return db[_0x369d('0x14')]['findAll']({'raw':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x16')]===undefined?!![]:![]:!![],'where':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')]['where']||null:null,'attributes':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x17')]||null:null,'limit':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x18')]||null:null,'include':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')]['include']?_['map'](_0x572513[_0x369d('0x15')][_0x369d('0x19')],function(_0xf7bc3a){return{'model':db[_0xf7bc3a[_0x369d('0x1a')]],'as':_0xf7bc3a['as'],'attributes':_0xf7bc3a[_0x369d('0x17')],'include':_0xf7bc3a[_0x369d('0x19')]?_[_0x369d('0x1b')](_0xf7bc3a['include'],function(_0x4dfe83){return{'model':db[_0x4dfe83[_0x369d('0x1a')]],'as':_0x4dfe83['as'],'attributes':_0x4dfe83[_0x369d('0x17')],'include':_0x4dfe83[_0x369d('0x19')]?_[_0x369d('0x1b')](_0x4dfe83[_0x369d('0x19')],function(_0x41e0cf){return{'model':db[_0x41e0cf[_0x369d('0x1a')]],'as':_0x41e0cf['as'],'attributes':_0x41e0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x369d('0x1c')](function(_0xe95742){logger[_0x369d('0xa')](_0x369d('0x1d'),_0x572513);logger[_0x369d('0xd')](_0x369d('0x1d'),_0x572513,JSON[_0x369d('0xe')](_0xe95742));_0x2946be(_0xe95742);})['catch'](function(_0x157291){logger['error']('GetVtigerAccount',_0x157291[_0x369d('0x11')],_0x572513);_0x4494b3(_0x597b67[_0x369d('0xf')](0x1f4,_0x157291['message']));});});};exports[_0x369d('0x1e')]=function(_0x5a14ce){var _0x37274f=this;return new Promise(function(_0x39d656,_0xe45219){return db[_0x369d('0x14')][_0x369d('0x1f')]({'raw':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')][_0x369d('0x20')]||null:null,'attributes':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')][_0x369d('0x17')]||null:null,'include':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')]['include']?_[_0x369d('0x1b')](_0x5a14ce[_0x369d('0x15')][_0x369d('0x19')],function(_0x1b4453){return{'model':db[_0x1b4453[_0x369d('0x1a')]],'as':_0x1b4453['as'],'attributes':_0x1b4453['attributes'],'include':_0x1b4453[_0x369d('0x19')]?_[_0x369d('0x1b')](_0x1b4453[_0x369d('0x19')],function(_0x3a0277){return{'model':db[_0x3a0277[_0x369d('0x1a')]],'as':_0x3a0277['as'],'attributes':_0x3a0277[_0x369d('0x17')],'include':_0x3a0277['include']?_[_0x369d('0x1b')](_0x3a0277[_0x369d('0x19')],function(_0x40afb2){return{'model':db[_0x40afb2[_0x369d('0x1a')]],'as':_0x40afb2['as'],'attributes':_0x40afb2[_0x369d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x369d('0x1c')](function(_0xfa13da){logger[_0x369d('0xa')](_0x369d('0x1e'),_0x5a14ce);logger[_0x369d('0xd')](_0x369d('0x1e'),_0x5a14ce,JSON[_0x369d('0xe')](_0xfa13da));_0x39d656(_0xfa13da);})[_0x369d('0x13')](function(_0x43d734){logger[_0x369d('0xf')](_0x369d('0x1e'),_0x43d734[_0x369d('0x11')],_0x5a14ce);_0xe45219(_0x37274f[_0x369d('0xf')](0x1f4,_0x43d734[_0x369d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 4fa0bde..b4c3fb5 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 _0xf64f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','create','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x141ca7,_0xfecf96){var _0x4e0276=function(_0x36538e){while(--_0x36538e){_0x141ca7['push'](_0x141ca7['shift']());}};_0x4e0276(++_0xfecf96);}(_0xf64f,0x19f));var _0xff64=function(_0x9a9bf6,_0x50d071){_0x9a9bf6=_0x9a9bf6-0x0;var _0x2738f4=_0xf64f[_0x9a9bf6];return _0x2738f4;};'use strict';var multer=require('multer');var util=require(_0xff64('0x0'));var path=require('path');var timeout=require(_0xff64('0x1'));var express=require(_0xff64('0x2'));var router=express[_0xff64('0x3')]();var fs_extra=require(_0xff64('0x4'));var auth=require(_0xff64('0x5'));var interaction=require(_0xff64('0x6'));var config=require(_0xff64('0x7'));var controller=require(_0xff64('0x8'));router[_0xff64('0x9')]('/',auth[_0xff64('0xa')](),controller['index']);router[_0xff64('0x9')](_0xff64('0xb'),auth[_0xff64('0xa')](),controller[_0xff64('0xc')]);router['get'](_0xff64('0xd'),auth[_0xff64('0xa')](),controller[_0xff64('0xe')]);router['get'](_0xff64('0xf'),auth[_0xff64('0xa')](),controller['getSubjects']);router[_0xff64('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0xff64('0x10')]);router[_0xff64('0x11')](_0xff64('0xb'),auth['isAuthenticated'](),controller[_0xff64('0x12')]);router[_0xff64('0x13')](_0xff64('0xb'),auth['isAuthenticated'](),controller[_0xff64('0x14')]);module[_0xff64('0x15')]=router; \ No newline at end of file +var _0x7ffc=['path','express','Router','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','create','put','update','exports','multer','util'];(function(_0x317d61,_0x5e6335){var _0x3abc20=function(_0x556876){while(--_0x556876){_0x317d61['push'](_0x317d61['shift']());}};_0x3abc20(++_0x5e6335);}(_0x7ffc,0xe5));var _0xc7ff=function(_0x14d4eb,_0x1dff6b){_0x14d4eb=_0x14d4eb-0x0;var _0x58426a=_0x7ffc[_0x14d4eb];return _0x58426a;};'use strict';var multer=require(_0xc7ff('0x0'));var util=require(_0xc7ff('0x1'));var path=require(_0xc7ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xc7ff('0x3'));var router=express[_0xc7ff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc7ff('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc7ff('0x6'));var controller=require(_0xc7ff('0x7'));router[_0xc7ff('0x8')]('/',auth[_0xc7ff('0x9')](),controller[_0xc7ff('0xa')]);router[_0xc7ff('0x8')](_0xc7ff('0xb'),auth[_0xc7ff('0x9')](),controller[_0xc7ff('0xc')]);router[_0xc7ff('0x8')](_0xc7ff('0xd'),auth[_0xc7ff('0x9')](),controller[_0xc7ff('0xe')]);router[_0xc7ff('0x8')](_0xc7ff('0xf'),auth[_0xc7ff('0x9')](),controller[_0xc7ff('0x10')]);router[_0xc7ff('0x8')]('/:id/descriptions',auth[_0xc7ff('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0xc7ff('0x9')](),controller[_0xc7ff('0x11')]);router[_0xc7ff('0x12')](_0xc7ff('0xb'),auth[_0xc7ff('0x9')](),controller[_0xc7ff('0x13')]);router['delete'](_0xc7ff('0xb'),auth[_0xc7ff('0x9')](),controller['destroy']);module[_0xc7ff('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 2271810..4b39cee 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 _0x495d=['sequelize','STRING'];(function(_0x2d3275,_0x4f9f18){var _0x5309b4=function(_0x135255){while(--_0x135255){_0x2d3275['push'](_0x2d3275['shift']());}};_0x5309b4(++_0x4f9f18);}(_0x495d,0x194));var _0xd495=function(_0x550a1d,_0x3d8ee7){_0x550a1d=_0x550a1d-0x0;var _0x11e8ba=_0x495d[_0x550a1d];return _0x11e8ba;};'use strict';var Sequelize=require(_0xd495('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd495('0x1')]}}; \ No newline at end of file +var _0xf004=['sequelize','STRING'];(function(_0x28ff30,_0x342f9c){var _0x453c8b=function(_0x40e323){while(--_0x40e323){_0x28ff30['push'](_0x28ff30['shift']());}};_0x453c8b(++_0x342f9c);}(_0xf004,0x132));var _0x4f00=function(_0x57f076,_0x56f86d){_0x57f076=_0x57f076-0x0;var _0x373010=_0xf004[_0x57f076];return _0x373010;};'use strict';var Sequelize=require(_0x4f00('0x0'));module['exports']={'name':{'type':Sequelize[_0x4f00('0x1')]},'description':{'type':Sequelize[_0x4f00('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 17cbc0e..a4fa020 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 _0x878f=['limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','VtigerConfiguration','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','map','type','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','getFields','findOne','VtigerField','merge','hasOwnProperty','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0x878f,0x124));var _0xf878=function(_0x2f4997,_0x15fe35){_0x2f4997=_0x2f4997-0x0;var _0x2f51ec=_0x878f[_0x2f4997];return _0x2f51ec;};'use strict';var emlformat=require(_0xf878('0x0'));var rimraf=require(_0xf878('0x1'));var zipdir=require(_0xf878('0x2'));var jsonpatch=require(_0xf878('0x3'));var rp=require(_0xf878('0x4'));var moment=require(_0xf878('0x5'));var BPromise=require(_0xf878('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf878('0x7'));var sox=require(_0xf878('0x8'));var csv=require(_0xf878('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf878('0xa'));var _=require(_0xf878('0xb'));var squel=require(_0xf878('0xc'));var crypto=require(_0xf878('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf878('0xe'));var toCsv=require(_0xf878('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf878('0xf'));var authService=require(_0xf878('0x10'));var qs=require(_0xf878('0x11'));var as=require(_0xf878('0x12'));var hardwareService=require(_0xf878('0x13'));var logger=require(_0xf878('0x14'))(_0xf878('0x15'));var utils=require(_0xf878('0x16'));var config=require(_0xf878('0x17'));var licenseUtil=require(_0xf878('0x18'));var db=require(_0xf878('0x19'))['db'];function respondWithStatusCode(_0x2f4bb8,_0x2d1998){_0x2d1998=_0x2d1998||0xcc;return function(_0x58ea6c){if(_0x58ea6c){return _0x2f4bb8[_0xf878('0x1a')](_0x2d1998);}return _0x2f4bb8[_0xf878('0x1b')](_0x2d1998)[_0xf878('0x1c')]();};}function respondWithResult(_0x1d446e,_0x59cd39){_0x59cd39=_0x59cd39||0xc8;return function(_0x2e4791){if(_0x2e4791){return _0x1d446e[_0xf878('0x1b')](_0x59cd39)[_0xf878('0x1d')](_0x2e4791);}};}function respondWithFilteredResult(_0x590184,_0x3f533d){return function(_0x4f27e2){if(_0x4f27e2){var _0x3a3d53=typeof _0x3f533d[_0xf878('0x1e')]===_0xf878('0x1f')&&typeof _0x3f533d[_0xf878('0x20')]==='undefined';var _0x36c2ec=_0x4f27e2[_0xf878('0x21')];var _0x49ce6=_0x3a3d53?0x0:_0x3f533d['offset'];var _0x270b9c=_0x3a3d53?_0x4f27e2[_0xf878('0x21')]:_0x3f533d[_0xf878('0x1e')]+_0x3f533d[_0xf878('0x20')];var _0x1aec35;if(_0x270b9c>=_0x36c2ec){_0x270b9c=_0x36c2ec;_0x1aec35=0xc8;}else{_0x1aec35=0xce;}_0x590184[_0xf878('0x1b')](_0x1aec35);return _0x590184[_0xf878('0x22')](_0xf878('0x23'),_0x49ce6+'-'+_0x270b9c+'/'+_0x36c2ec)[_0xf878('0x1d')](_0x4f27e2);}return null;};}function patchUpdates(_0x2194a4){return function(_0x31d709){try{jsonpatch[_0xf878('0x24')](_0x31d709,_0x2194a4,!![]);}catch(_0x203f25){return BPromise[_0xf878('0x25')](_0x203f25);}return _0x31d709[_0xf878('0x26')]();};}function saveUpdates(_0x36113a,_0x413224){return function(_0x1bd437){if(_0x1bd437){return _0x1bd437[_0xf878('0x27')](_0x36113a)[_0xf878('0x28')](function(_0x5e2d40){return _0x5e2d40;});}return null;};}function removeEntity(_0x1c0cd6,_0x23191c){return function(_0x36840e){if(_0x36840e){return _0x36840e['destroy']()['then'](function(){_0x1c0cd6[_0xf878('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdb4226,_0xc5dcb2){return function(_0x29c26a){if(!_0x29c26a){_0xdb4226[_0xf878('0x1a')](0x194);}return _0x29c26a;};}function handleError(_0x3c56b2,_0x253c2a){_0x253c2a=_0x253c2a||0x1f4;return function(_0x3806e5){logger['error'](_0x3806e5[_0xf878('0x29')]);if(_0x3806e5['name']){delete _0x3806e5[_0xf878('0x2a')];}_0x3c56b2[_0xf878('0x1b')](_0x253c2a)[_0xf878('0x2b')](_0x3806e5);};}exports[_0xf878('0x2c')]=function(_0xd92684,_0xd8fa72){var _0x4a83d4={},_0x49cc36={},_0x3f9776={'count':0x0,'rows':[]};var _0x30d444=_['map'](db[_0xf878('0x2d')][_0xf878('0x2e')],function(_0x50d71b){return{'name':_0x50d71b['fieldName'],'type':_0x50d71b['type'][_0xf878('0x2f')]};});_0x49cc36[_0xf878('0x30')]=_['map'](_0x30d444,_0xf878('0x2a'));_0x49cc36[_0xf878('0x31')]=_[_0xf878('0x32')](_0xd92684['query']);_0x49cc36[_0xf878('0x33')]=_[_0xf878('0x34')](_0x49cc36['model'],_0x49cc36[_0xf878('0x31')]);_0x4a83d4['attributes']=_[_0xf878('0x34')](_0x49cc36['model'],qs[_0xf878('0x35')](_0xd92684[_0xf878('0x31')][_0xf878('0x35')]));_0x4a83d4[_0xf878('0x36')]=_0x4a83d4[_0xf878('0x36')][_0xf878('0x37')]?_0x4a83d4[_0xf878('0x36')]:_0x49cc36[_0xf878('0x30')];if(!_0xd92684['query']['hasOwnProperty'](_0xf878('0x38'))){_0x4a83d4['limit']=qs[_0xf878('0x20')](_0xd92684[_0xf878('0x31')][_0xf878('0x20')]);_0x4a83d4['offset']=qs[_0xf878('0x1e')](_0xd92684[_0xf878('0x31')][_0xf878('0x1e')]);}_0x4a83d4[_0xf878('0x39')]=qs['sort'](_0xd92684['query'][_0xf878('0x3a')]);_0x4a83d4[_0xf878('0x3b')]=qs[_0xf878('0x33')](_['pick'](_0xd92684[_0xf878('0x31')],_0x49cc36[_0xf878('0x33')]),_0x30d444);if(_0xd92684[_0xf878('0x31')][_0xf878('0x3c')]){_0x4a83d4[_0xf878('0x3b')]=_['merge'](_0x4a83d4[_0xf878('0x3b')],{'$or':_[_0xf878('0x3d')](_0x30d444,function(_0x361173){if(_0x361173[_0xf878('0x3e')]!==_0xf878('0x3f')){var _0x53e0fa={};_0x53e0fa[_0x361173[_0xf878('0x2a')]]={'$like':'%'+_0xd92684[_0xf878('0x31')][_0xf878('0x3c')]+'%'};return _0x53e0fa;}})});}_0x4a83d4=_['merge']({},_0x4a83d4,_0xd92684[_0xf878('0x40')]);var _0x290c98={'where':_0x4a83d4[_0xf878('0x3b')]};return db[_0xf878('0x2d')]['count'](_0x290c98)[_0xf878('0x28')](function(_0x4bb776){_0x3f9776['count']=_0x4bb776;if(_0xd92684[_0xf878('0x31')][_0xf878('0x41')]){_0x4a83d4[_0xf878('0x42')]=[{'all':!![]}];}return db[_0xf878('0x2d')]['findAll'](_0x4a83d4);})['then'](function(_0x257669){_0x3f9776['rows']=_0x257669;return _0x3f9776;})['then'](respondWithFilteredResult(_0xd8fa72,_0x4a83d4))[_0xf878('0x43')](handleError(_0xd8fa72,null));};exports[_0xf878('0x44')]=function(_0x417382,_0x1668ac){var _0x5aa759={'raw':![],'where':{'id':_0x417382[_0xf878('0x45')]['id']}},_0x82bce6={};_0x82bce6[_0xf878('0x30')]=_[_0xf878('0x32')](db[_0xf878('0x2d')][_0xf878('0x2e')]);_0x82bce6[_0xf878('0x31')]=_[_0xf878('0x32')](_0x417382[_0xf878('0x31')]);_0x82bce6[_0xf878('0x33')]=_['intersection'](_0x82bce6[_0xf878('0x30')],_0x82bce6[_0xf878('0x31')]);_0x5aa759[_0xf878('0x36')]=_[_0xf878('0x34')](_0x82bce6[_0xf878('0x30')],qs['fields'](_0x417382['query'][_0xf878('0x35')]));_0x5aa759[_0xf878('0x36')]=_0x5aa759[_0xf878('0x36')][_0xf878('0x37')]?_0x5aa759[_0xf878('0x36')]:_0x82bce6[_0xf878('0x30')];if(_0x417382[_0xf878('0x31')]['includeAll']){_0x5aa759[_0xf878('0x42')]=[{'all':!![]}];}_0x5aa759=_['merge']({},_0x5aa759,_0x417382[_0xf878('0x40')]);return db[_0xf878('0x2d')][_0xf878('0x46')](_0x5aa759)[_0xf878('0x28')](handleEntityNotFound(_0x1668ac,null))[_0xf878('0x28')](respondWithResult(_0x1668ac,null))[_0xf878('0x43')](handleError(_0x1668ac,null));};exports[_0xf878('0x47')]=function(_0x585e7c,_0x36d776){return db[_0xf878('0x2d')][_0xf878('0x47')](_0x585e7c[_0xf878('0x48')],{})[_0xf878('0x28')](respondWithResult(_0x36d776,0xc9))['catch'](handleError(_0x36d776,null));};exports[_0xf878('0x27')]=function(_0x3f8a77,_0x2dc6ed){if(_0x3f8a77[_0xf878('0x48')]['id']){delete _0x3f8a77[_0xf878('0x48')]['id'];}return db[_0xf878('0x2d')][_0xf878('0x46')]({'where':{'id':_0x3f8a77[_0xf878('0x45')]['id']}})[_0xf878('0x28')](handleEntityNotFound(_0x2dc6ed,null))['then'](saveUpdates(_0x3f8a77[_0xf878('0x48')],null))[_0xf878('0x28')](respondWithResult(_0x2dc6ed,null))['catch'](handleError(_0x2dc6ed,null));};exports['destroy']=function(_0x392b4e,_0x4cea73){return db[_0xf878('0x2d')][_0xf878('0x46')]({'where':{'id':_0x392b4e[_0xf878('0x45')]['id']}})[_0xf878('0x28')](handleEntityNotFound(_0x4cea73,null))[_0xf878('0x28')](removeEntity(_0x4cea73,null))[_0xf878('0x43')](handleError(_0x4cea73,null));};exports[_0xf878('0x49')]=function(_0x22ffb0,_0x22a50a,_0x1d7997){var _0x1223d9={};var _0x2f68ff={};var _0x1e5090;var _0xc0429a;return db['VtigerConfiguration'][_0xf878('0x4a')]({'where':{'id':_0x22ffb0[_0xf878('0x45')]['id']}})[_0xf878('0x28')](handleEntityNotFound(_0x22a50a,null))[_0xf878('0x28')](function(_0x4a9cf4){if(_0x4a9cf4){_0x1e5090=_0x4a9cf4;_0x2f68ff[_0xf878('0x30')]=_['keys'](db[_0xf878('0x4b')][_0xf878('0x2e')]);_0x2f68ff[_0xf878('0x31')]=_[_0xf878('0x32')](_0x22ffb0[_0xf878('0x31')]);_0x2f68ff[_0xf878('0x33')]=_[_0xf878('0x34')](_0x2f68ff[_0xf878('0x30')],_0x2f68ff[_0xf878('0x31')]);_0x1223d9[_0xf878('0x36')]=_[_0xf878('0x34')](_0x2f68ff[_0xf878('0x30')],qs[_0xf878('0x35')](_0x22ffb0['query']['fields']));_0x1223d9[_0xf878('0x36')]=_0x1223d9['attributes']['length']?_0x1223d9[_0xf878('0x36')]:_0x2f68ff[_0xf878('0x30')];_0x1223d9[_0xf878('0x39')]=qs[_0xf878('0x3a')](_0x22ffb0[_0xf878('0x31')]['sort']);_0x1223d9[_0xf878('0x3b')]=qs[_0xf878('0x33')](_['pick'](_0x22ffb0['query'],_0x2f68ff[_0xf878('0x33')]));if(_0x22ffb0['query']['filter']){_0x1223d9[_0xf878('0x3b')]=_[_0xf878('0x4c')](_0x1223d9['where'],{'$or':_[_0xf878('0x3d')](_0x1223d9[_0xf878('0x36')],function(_0x2459ba){var _0x4c33e1={};_0x4c33e1[_0x2459ba]={'$like':'%'+_0x22ffb0[_0xf878('0x31')]['filter']+'%'};return _0x4c33e1;})});}_0x1223d9=_[_0xf878('0x4c')]({},_0x1223d9,_0x22ffb0[_0xf878('0x40')]);return _0x1e5090[_0xf878('0x49')](_0x1223d9);}})['then'](function(_0x38f50a){if(_0x38f50a){_0xc0429a=_0x38f50a['length'];if(!_0x22ffb0[_0xf878('0x31')][_0xf878('0x4d')](_0xf878('0x38'))){_0x1223d9['limit']=qs[_0xf878('0x20')](_0x22ffb0[_0xf878('0x31')][_0xf878('0x20')]);_0x1223d9[_0xf878('0x1e')]=qs[_0xf878('0x1e')](_0x22ffb0['query']['offset']);}return _0x1e5090['getFields'](_0x1223d9);}})['then'](function(_0x4cfe43){if(_0x4cfe43){return _0x4cfe43?{'count':_0xc0429a,'rows':_0x4cfe43}:null;}})['then'](respondWithResult(_0x22a50a,null))[_0xf878('0x43')](handleError(_0x22a50a,null));};exports[_0xf878('0x4e')]=function(_0x2545b2,_0x4d80a7,_0x31f204){var _0x349258={};var _0x2bcec2={};var _0x3ef6e4;var _0x416904;return db[_0xf878('0x2d')][_0xf878('0x4a')]({'where':{'id':_0x2545b2[_0xf878('0x45')]['id']}})['then'](handleEntityNotFound(_0x4d80a7,null))[_0xf878('0x28')](function(_0x509c00){if(_0x509c00){_0x3ef6e4=_0x509c00;_0x2bcec2[_0xf878('0x30')]=_['keys'](db[_0xf878('0x4b')][_0xf878('0x2e')]);_0x2bcec2[_0xf878('0x31')]=_[_0xf878('0x32')](_0x2545b2[_0xf878('0x31')]);_0x2bcec2[_0xf878('0x33')]=_['intersection'](_0x2bcec2[_0xf878('0x30')],_0x2bcec2[_0xf878('0x31')]);_0x349258[_0xf878('0x36')]=_[_0xf878('0x34')](_0x2bcec2['model'],qs[_0xf878('0x35')](_0x2545b2[_0xf878('0x31')][_0xf878('0x35')]));_0x349258[_0xf878('0x36')]=_0x349258[_0xf878('0x36')][_0xf878('0x37')]?_0x349258[_0xf878('0x36')]:_0x2bcec2[_0xf878('0x30')];_0x349258[_0xf878('0x39')]=qs[_0xf878('0x3a')](_0x2545b2['query'][_0xf878('0x3a')]);_0x349258[_0xf878('0x3b')]=qs[_0xf878('0x33')](_[_0xf878('0x4f')](_0x2545b2[_0xf878('0x31')],_0x2bcec2[_0xf878('0x33')]));if(_0x2545b2[_0xf878('0x31')]['filter']){_0x349258[_0xf878('0x3b')]=_[_0xf878('0x4c')](_0x349258[_0xf878('0x3b')],{'$or':_[_0xf878('0x3d')](_0x349258[_0xf878('0x36')],function(_0x188d78){var _0x52fbd7={};_0x52fbd7[_0x188d78]={'$like':'%'+_0x2545b2[_0xf878('0x31')][_0xf878('0x3c')]+'%'};return _0x52fbd7;})});}_0x349258=_[_0xf878('0x4c')]({},_0x349258,_0x2545b2[_0xf878('0x40')]);return _0x3ef6e4['getSubjects'](_0x349258);}})[_0xf878('0x28')](function(_0x5ecadb){if(_0x5ecadb){_0x416904=_0x5ecadb[_0xf878('0x37')];if(!_0x2545b2[_0xf878('0x31')][_0xf878('0x4d')](_0xf878('0x38'))){_0x349258[_0xf878('0x20')]=qs['limit'](_0x2545b2[_0xf878('0x31')][_0xf878('0x20')]);_0x349258[_0xf878('0x1e')]=qs['offset'](_0x2545b2['query']['offset']);}return _0x3ef6e4[_0xf878('0x4e')](_0x349258);}})['then'](function(_0x1ee4ed){if(_0x1ee4ed){return _0x1ee4ed?{'count':_0x416904,'rows':_0x1ee4ed}:null;}})[_0xf878('0x28')](respondWithResult(_0x4d80a7,null))['catch'](handleError(_0x4d80a7,null));};exports[_0xf878('0x50')]=function(_0x9cfd96,_0x3b1d49,_0x396a1b){var _0x2742e0={};var _0x3fa156={};var _0x33b79b;var _0x5765e8;return db['VtigerConfiguration'][_0xf878('0x4a')]({'where':{'id':_0x9cfd96[_0xf878('0x45')]['id']}})[_0xf878('0x28')](handleEntityNotFound(_0x3b1d49,null))['then'](function(_0x341c60){if(_0x341c60){_0x33b79b=_0x341c60;_0x3fa156['model']=_[_0xf878('0x32')](db['VtigerField'][_0xf878('0x2e')]);_0x3fa156[_0xf878('0x31')]=_[_0xf878('0x32')](_0x9cfd96[_0xf878('0x31')]);_0x3fa156[_0xf878('0x33')]=_[_0xf878('0x34')](_0x3fa156[_0xf878('0x30')],_0x3fa156[_0xf878('0x31')]);_0x2742e0[_0xf878('0x36')]=_[_0xf878('0x34')](_0x3fa156[_0xf878('0x30')],qs[_0xf878('0x35')](_0x9cfd96['query'][_0xf878('0x35')]));_0x2742e0['attributes']=_0x2742e0[_0xf878('0x36')][_0xf878('0x37')]?_0x2742e0['attributes']:_0x3fa156[_0xf878('0x30')];_0x2742e0[_0xf878('0x39')]=qs['sort'](_0x9cfd96[_0xf878('0x31')]['sort']);_0x2742e0[_0xf878('0x3b')]=qs[_0xf878('0x33')](_[_0xf878('0x4f')](_0x9cfd96[_0xf878('0x31')],_0x3fa156['filters']));if(_0x9cfd96['query'][_0xf878('0x3c')]){_0x2742e0[_0xf878('0x3b')]=_[_0xf878('0x4c')](_0x2742e0[_0xf878('0x3b')],{'$or':_[_0xf878('0x3d')](_0x2742e0['attributes'],function(_0x2f9c72){var _0x4cf7da={};_0x4cf7da[_0x2f9c72]={'$like':'%'+_0x9cfd96[_0xf878('0x31')]['filter']+'%'};return _0x4cf7da;})});}_0x2742e0=_['merge']({},_0x2742e0,_0x9cfd96[_0xf878('0x40')]);return _0x33b79b[_0xf878('0x50')](_0x2742e0);}})[_0xf878('0x28')](function(_0x2631d6){if(_0x2631d6){_0x5765e8=_0x2631d6[_0xf878('0x37')];if(!_0x9cfd96[_0xf878('0x31')][_0xf878('0x4d')](_0xf878('0x38'))){_0x2742e0[_0xf878('0x20')]=qs[_0xf878('0x20')](_0x9cfd96[_0xf878('0x31')][_0xf878('0x20')]);_0x2742e0[_0xf878('0x1e')]=qs['offset'](_0x9cfd96['query'][_0xf878('0x1e')]);}return _0x33b79b[_0xf878('0x50')](_0x2742e0);}})['then'](function(_0x526236){if(_0x526236){return _0x526236?{'count':_0x5765e8,'rows':_0x526236}:null;}})[_0xf878('0x28')](respondWithResult(_0x3b1d49,null))[_0xf878('0x43')](handleError(_0x3b1d49,null));}; \ No newline at end of file +var _0xdcc2=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','VtigerConfiguration','include','findAll','rows','catch','show','length','includeAll','create','body','params','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x4e7a18,_0x5940c3){var _0x721285=function(_0x10fab2){while(--_0x10fab2){_0x4e7a18['push'](_0x4e7a18['shift']());}};_0x721285(++_0x5940c3);}(_0xdcc2,0x16b));var _0x2dcc=function(_0x51504d,_0x58bf5a){_0x51504d=_0x51504d-0x0;var _0x5b52c3=_0xdcc2[_0x51504d];return _0x5b52c3;};'use strict';var emlformat=require(_0x2dcc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2dcc('0x1'));var jsonpatch=require(_0x2dcc('0x2'));var rp=require(_0x2dcc('0x3'));var moment=require(_0x2dcc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2dcc('0x5'));var csv=require(_0x2dcc('0x6'));var ejs=require(_0x2dcc('0x7'));var fs=require('fs');var fs_extra=require(_0x2dcc('0x8'));var _=require(_0x2dcc('0x9'));var squel=require('squel');var crypto=require(_0x2dcc('0xa'));var jsforce=require(_0x2dcc('0xb'));var deskjs=require(_0x2dcc('0xc'));var toCsv=require(_0x2dcc('0x6'));var querystring=require(_0x2dcc('0xd'));var Papa=require(_0x2dcc('0xe'));var Redis=require(_0x2dcc('0xf'));var authService=require(_0x2dcc('0x10'));var qs=require(_0x2dcc('0x11'));var as=require(_0x2dcc('0x12'));var hardwareService=require(_0x2dcc('0x13'));var logger=require(_0x2dcc('0x14'))(_0x2dcc('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23d785,_0x25df45){_0x25df45=_0x25df45||0xcc;return function(_0x6127f9){if(_0x6127f9){return _0x23d785[_0x2dcc('0x16')](_0x25df45);}return _0x23d785[_0x2dcc('0x17')](_0x25df45)[_0x2dcc('0x18')]();};}function respondWithResult(_0xb821e8,_0x260da9){_0x260da9=_0x260da9||0xc8;return function(_0xf04393){if(_0xf04393){return _0xb821e8[_0x2dcc('0x17')](_0x260da9)[_0x2dcc('0x19')](_0xf04393);}};}function respondWithFilteredResult(_0x4e1e94,_0x50679b){return function(_0x6d284a){if(_0x6d284a){var _0x7d06ce=typeof _0x50679b[_0x2dcc('0x1a')]===_0x2dcc('0x1b')&&typeof _0x50679b[_0x2dcc('0x1c')]===_0x2dcc('0x1b');var _0x44f90b=_0x6d284a[_0x2dcc('0x1d')];var _0x7577f7=_0x7d06ce?0x0:_0x50679b['offset'];var _0x95066e=_0x7d06ce?_0x6d284a[_0x2dcc('0x1d')]:_0x50679b[_0x2dcc('0x1a')]+_0x50679b['limit'];var _0x577ea3;if(_0x95066e>=_0x44f90b){_0x95066e=_0x44f90b;_0x577ea3=0xc8;}else{_0x577ea3=0xce;}_0x4e1e94[_0x2dcc('0x17')](_0x577ea3);return _0x4e1e94['set'](_0x2dcc('0x1e'),_0x7577f7+'-'+_0x95066e+'/'+_0x44f90b)[_0x2dcc('0x19')](_0x6d284a);}return null;};}function patchUpdates(_0x418d14){return function(_0x5709c6){try{jsonpatch[_0x2dcc('0x1f')](_0x5709c6,_0x418d14,!![]);}catch(_0x1713d8){return BPromise['reject'](_0x1713d8);}return _0x5709c6['save']();};}function saveUpdates(_0x5505de,_0x478824){return function(_0x226cb3){if(_0x226cb3){return _0x226cb3[_0x2dcc('0x20')](_0x5505de)[_0x2dcc('0x21')](function(_0x4ad266){return _0x4ad266;});}return null;};}function removeEntity(_0x2e6753,_0x25b9d8){return function(_0x42b580){if(_0x42b580){return _0x42b580['destroy']()[_0x2dcc('0x21')](function(){_0x2e6753[_0x2dcc('0x17')](0xcc)[_0x2dcc('0x18')]();});}};}function handleEntityNotFound(_0x24063d,_0x4ae921){return function(_0x286598){if(!_0x286598){_0x24063d[_0x2dcc('0x16')](0x194);}return _0x286598;};}function handleError(_0x1a9aa5,_0x143c48){_0x143c48=_0x143c48||0x1f4;return function(_0x5d5436){logger['error'](_0x5d5436[_0x2dcc('0x22')]);if(_0x5d5436[_0x2dcc('0x23')]){delete _0x5d5436[_0x2dcc('0x23')];}_0x1a9aa5[_0x2dcc('0x17')](_0x143c48)['send'](_0x5d5436);};}exports[_0x2dcc('0x24')]=function(_0x5b6d9d,_0xd36fb7){var _0x3918fc={},_0xc91504={},_0x55c7e4={'count':0x0,'rows':[]};var _0x6d563f=_[_0x2dcc('0x25')](db['VtigerConfiguration'][_0x2dcc('0x26')],function(_0x5aac66){return{'name':_0x5aac66[_0x2dcc('0x27')],'type':_0x5aac66[_0x2dcc('0x28')][_0x2dcc('0x29')]};});_0xc91504[_0x2dcc('0x2a')]=_[_0x2dcc('0x25')](_0x6d563f,'name');_0xc91504[_0x2dcc('0x2b')]=_[_0x2dcc('0x2c')](_0x5b6d9d[_0x2dcc('0x2b')]);_0xc91504[_0x2dcc('0x2d')]=_[_0x2dcc('0x2e')](_0xc91504[_0x2dcc('0x2a')],_0xc91504[_0x2dcc('0x2b')]);_0x3918fc['attributes']=_[_0x2dcc('0x2e')](_0xc91504['model'],qs['fields'](_0x5b6d9d[_0x2dcc('0x2b')][_0x2dcc('0x2f')]));_0x3918fc[_0x2dcc('0x30')]=_0x3918fc[_0x2dcc('0x30')]['length']?_0x3918fc[_0x2dcc('0x30')]:_0xc91504[_0x2dcc('0x2a')];if(!_0x5b6d9d[_0x2dcc('0x2b')][_0x2dcc('0x31')](_0x2dcc('0x32'))){_0x3918fc[_0x2dcc('0x1c')]=qs['limit'](_0x5b6d9d[_0x2dcc('0x2b')]['limit']);_0x3918fc[_0x2dcc('0x1a')]=qs['offset'](_0x5b6d9d[_0x2dcc('0x2b')]['offset']);}_0x3918fc[_0x2dcc('0x33')]=qs[_0x2dcc('0x34')](_0x5b6d9d[_0x2dcc('0x2b')][_0x2dcc('0x34')]);_0x3918fc[_0x2dcc('0x35')]=qs[_0x2dcc('0x2d')](_[_0x2dcc('0x36')](_0x5b6d9d['query'],_0xc91504[_0x2dcc('0x2d')]),_0x6d563f);if(_0x5b6d9d['query']['filter']){_0x3918fc[_0x2dcc('0x35')]=_['merge'](_0x3918fc[_0x2dcc('0x35')],{'$or':_[_0x2dcc('0x25')](_0x6d563f,function(_0x2928de){if(_0x2928de[_0x2dcc('0x28')]!==_0x2dcc('0x37')){var _0x548018={};_0x548018[_0x2928de[_0x2dcc('0x23')]]={'$like':'%'+_0x5b6d9d[_0x2dcc('0x2b')][_0x2dcc('0x38')]+'%'};return _0x548018;}})});}_0x3918fc=_[_0x2dcc('0x39')]({},_0x3918fc,_0x5b6d9d[_0x2dcc('0x3a')]);var _0x260b67={'where':_0x3918fc[_0x2dcc('0x35')]};return db[_0x2dcc('0x3b')][_0x2dcc('0x1d')](_0x260b67)['then'](function(_0x5e543e){_0x55c7e4['count']=_0x5e543e;if(_0x5b6d9d[_0x2dcc('0x2b')]['includeAll']){_0x3918fc[_0x2dcc('0x3c')]=[{'all':!![]}];}return db[_0x2dcc('0x3b')][_0x2dcc('0x3d')](_0x3918fc);})[_0x2dcc('0x21')](function(_0x24fed9){_0x55c7e4[_0x2dcc('0x3e')]=_0x24fed9;return _0x55c7e4;})[_0x2dcc('0x21')](respondWithFilteredResult(_0xd36fb7,_0x3918fc))[_0x2dcc('0x3f')](handleError(_0xd36fb7,null));};exports[_0x2dcc('0x40')]=function(_0x337820,_0x372d77){var _0x317a3c={'raw':![],'where':{'id':_0x337820['params']['id']}},_0x11eb31={};_0x11eb31[_0x2dcc('0x2a')]=_[_0x2dcc('0x2c')](db[_0x2dcc('0x3b')][_0x2dcc('0x26')]);_0x11eb31[_0x2dcc('0x2b')]=_[_0x2dcc('0x2c')](_0x337820[_0x2dcc('0x2b')]);_0x11eb31['filters']=_['intersection'](_0x11eb31[_0x2dcc('0x2a')],_0x11eb31[_0x2dcc('0x2b')]);_0x317a3c[_0x2dcc('0x30')]=_['intersection'](_0x11eb31[_0x2dcc('0x2a')],qs[_0x2dcc('0x2f')](_0x337820[_0x2dcc('0x2b')][_0x2dcc('0x2f')]));_0x317a3c['attributes']=_0x317a3c[_0x2dcc('0x30')][_0x2dcc('0x41')]?_0x317a3c[_0x2dcc('0x30')]:_0x11eb31[_0x2dcc('0x2a')];if(_0x337820['query'][_0x2dcc('0x42')]){_0x317a3c['include']=[{'all':!![]}];}_0x317a3c=_[_0x2dcc('0x39')]({},_0x317a3c,_0x337820['options']);return db[_0x2dcc('0x3b')]['find'](_0x317a3c)[_0x2dcc('0x21')](handleEntityNotFound(_0x372d77,null))[_0x2dcc('0x21')](respondWithResult(_0x372d77,null))[_0x2dcc('0x3f')](handleError(_0x372d77,null));};exports['create']=function(_0x5a94a3,_0x5c9f73){return db[_0x2dcc('0x3b')][_0x2dcc('0x43')](_0x5a94a3[_0x2dcc('0x44')],{})[_0x2dcc('0x21')](respondWithResult(_0x5c9f73,0xc9))[_0x2dcc('0x3f')](handleError(_0x5c9f73,null));};exports[_0x2dcc('0x20')]=function(_0x994d75,_0x90f04c){if(_0x994d75[_0x2dcc('0x44')]['id']){delete _0x994d75[_0x2dcc('0x44')]['id'];}return db[_0x2dcc('0x3b')]['find']({'where':{'id':_0x994d75[_0x2dcc('0x45')]['id']}})[_0x2dcc('0x21')](handleEntityNotFound(_0x90f04c,null))[_0x2dcc('0x21')](saveUpdates(_0x994d75['body'],null))['then'](respondWithResult(_0x90f04c,null))[_0x2dcc('0x3f')](handleError(_0x90f04c,null));};exports['destroy']=function(_0x7e8711,_0x19bcb4){return db[_0x2dcc('0x3b')]['find']({'where':{'id':_0x7e8711[_0x2dcc('0x45')]['id']}})[_0x2dcc('0x21')](handleEntityNotFound(_0x19bcb4,null))[_0x2dcc('0x21')](removeEntity(_0x19bcb4,null))[_0x2dcc('0x3f')](handleError(_0x19bcb4,null));};exports[_0x2dcc('0x46')]=function(_0x170d7d,_0x23dca4,_0x2b5271){var _0x7853fc={};var _0x3701b9={};var _0x24570b;var _0x3e9229;return db[_0x2dcc('0x3b')][_0x2dcc('0x47')]({'where':{'id':_0x170d7d[_0x2dcc('0x45')]['id']}})[_0x2dcc('0x21')](handleEntityNotFound(_0x23dca4,null))['then'](function(_0x4595ff){if(_0x4595ff){_0x24570b=_0x4595ff;_0x3701b9[_0x2dcc('0x2a')]=_[_0x2dcc('0x2c')](db[_0x2dcc('0x48')][_0x2dcc('0x26')]);_0x3701b9['query']=_[_0x2dcc('0x2c')](_0x170d7d[_0x2dcc('0x2b')]);_0x3701b9[_0x2dcc('0x2d')]=_['intersection'](_0x3701b9[_0x2dcc('0x2a')],_0x3701b9[_0x2dcc('0x2b')]);_0x7853fc['attributes']=_[_0x2dcc('0x2e')](_0x3701b9[_0x2dcc('0x2a')],qs['fields'](_0x170d7d[_0x2dcc('0x2b')][_0x2dcc('0x2f')]));_0x7853fc[_0x2dcc('0x30')]=_0x7853fc['attributes'][_0x2dcc('0x41')]?_0x7853fc[_0x2dcc('0x30')]:_0x3701b9[_0x2dcc('0x2a')];_0x7853fc[_0x2dcc('0x33')]=qs[_0x2dcc('0x34')](_0x170d7d[_0x2dcc('0x2b')][_0x2dcc('0x34')]);_0x7853fc[_0x2dcc('0x35')]=qs['filters'](_[_0x2dcc('0x36')](_0x170d7d[_0x2dcc('0x2b')],_0x3701b9['filters']));if(_0x170d7d['query'][_0x2dcc('0x38')]){_0x7853fc[_0x2dcc('0x35')]=_[_0x2dcc('0x39')](_0x7853fc['where'],{'$or':_['map'](_0x7853fc['attributes'],function(_0x1d42bb){var _0x403845={};_0x403845[_0x1d42bb]={'$like':'%'+_0x170d7d['query'][_0x2dcc('0x38')]+'%'};return _0x403845;})});}_0x7853fc=_['merge']({},_0x7853fc,_0x170d7d[_0x2dcc('0x3a')]);return _0x24570b['getFields'](_0x7853fc);}})['then'](function(_0x5990b7){if(_0x5990b7){_0x3e9229=_0x5990b7[_0x2dcc('0x41')];if(!_0x170d7d[_0x2dcc('0x2b')][_0x2dcc('0x31')](_0x2dcc('0x32'))){_0x7853fc[_0x2dcc('0x1c')]=qs[_0x2dcc('0x1c')](_0x170d7d[_0x2dcc('0x2b')][_0x2dcc('0x1c')]);_0x7853fc[_0x2dcc('0x1a')]=qs[_0x2dcc('0x1a')](_0x170d7d[_0x2dcc('0x2b')]['offset']);}return _0x24570b[_0x2dcc('0x46')](_0x7853fc);}})[_0x2dcc('0x21')](function(_0x214456){if(_0x214456){return _0x214456?{'count':_0x3e9229,'rows':_0x214456}:null;}})[_0x2dcc('0x21')](respondWithResult(_0x23dca4,null))[_0x2dcc('0x3f')](handleError(_0x23dca4,null));};exports[_0x2dcc('0x49')]=function(_0x21148c,_0x20639c,_0x288007){var _0x5593b5={};var _0x4b10d5={};var _0x38cbc5;var _0x1a1265;return db['VtigerConfiguration'][_0x2dcc('0x47')]({'where':{'id':_0x21148c['params']['id']}})['then'](handleEntityNotFound(_0x20639c,null))[_0x2dcc('0x21')](function(_0x253a65){if(_0x253a65){_0x38cbc5=_0x253a65;_0x4b10d5[_0x2dcc('0x2a')]=_[_0x2dcc('0x2c')](db[_0x2dcc('0x48')][_0x2dcc('0x26')]);_0x4b10d5['query']=_['keys'](_0x21148c[_0x2dcc('0x2b')]);_0x4b10d5[_0x2dcc('0x2d')]=_[_0x2dcc('0x2e')](_0x4b10d5['model'],_0x4b10d5[_0x2dcc('0x2b')]);_0x5593b5[_0x2dcc('0x30')]=_[_0x2dcc('0x2e')](_0x4b10d5[_0x2dcc('0x2a')],qs[_0x2dcc('0x2f')](_0x21148c['query']['fields']));_0x5593b5[_0x2dcc('0x30')]=_0x5593b5[_0x2dcc('0x30')][_0x2dcc('0x41')]?_0x5593b5[_0x2dcc('0x30')]:_0x4b10d5['model'];_0x5593b5[_0x2dcc('0x33')]=qs[_0x2dcc('0x34')](_0x21148c[_0x2dcc('0x2b')][_0x2dcc('0x34')]);_0x5593b5[_0x2dcc('0x35')]=qs[_0x2dcc('0x2d')](_[_0x2dcc('0x36')](_0x21148c[_0x2dcc('0x2b')],_0x4b10d5['filters']));if(_0x21148c[_0x2dcc('0x2b')][_0x2dcc('0x38')]){_0x5593b5['where']=_['merge'](_0x5593b5['where'],{'$or':_[_0x2dcc('0x25')](_0x5593b5[_0x2dcc('0x30')],function(_0x32c633){var _0x394797={};_0x394797[_0x32c633]={'$like':'%'+_0x21148c[_0x2dcc('0x2b')][_0x2dcc('0x38')]+'%'};return _0x394797;})});}_0x5593b5=_[_0x2dcc('0x39')]({},_0x5593b5,_0x21148c['options']);return _0x38cbc5[_0x2dcc('0x49')](_0x5593b5);}})[_0x2dcc('0x21')](function(_0x5a457b){if(_0x5a457b){_0x1a1265=_0x5a457b['length'];if(!_0x21148c[_0x2dcc('0x2b')][_0x2dcc('0x31')](_0x2dcc('0x32'))){_0x5593b5['limit']=qs[_0x2dcc('0x1c')](_0x21148c['query'][_0x2dcc('0x1c')]);_0x5593b5[_0x2dcc('0x1a')]=qs[_0x2dcc('0x1a')](_0x21148c[_0x2dcc('0x2b')][_0x2dcc('0x1a')]);}return _0x38cbc5[_0x2dcc('0x49')](_0x5593b5);}})[_0x2dcc('0x21')](function(_0x2af897){if(_0x2af897){return _0x2af897?{'count':_0x1a1265,'rows':_0x2af897}:null;}})[_0x2dcc('0x21')](respondWithResult(_0x20639c,null))[_0x2dcc('0x3f')](handleError(_0x20639c,null));};exports[_0x2dcc('0x4a')]=function(_0x76cbd6,_0x422cdb,_0x5e1255){var _0x3096b5={};var _0x3eb5e7={};var _0x16e1ed;var _0x1e224a;return db['VtigerConfiguration'][_0x2dcc('0x47')]({'where':{'id':_0x76cbd6[_0x2dcc('0x45')]['id']}})[_0x2dcc('0x21')](handleEntityNotFound(_0x422cdb,null))['then'](function(_0x5b07f4){if(_0x5b07f4){_0x16e1ed=_0x5b07f4;_0x3eb5e7['model']=_['keys'](db[_0x2dcc('0x48')]['rawAttributes']);_0x3eb5e7[_0x2dcc('0x2b')]=_['keys'](_0x76cbd6['query']);_0x3eb5e7[_0x2dcc('0x2d')]=_[_0x2dcc('0x2e')](_0x3eb5e7[_0x2dcc('0x2a')],_0x3eb5e7[_0x2dcc('0x2b')]);_0x3096b5[_0x2dcc('0x30')]=_[_0x2dcc('0x2e')](_0x3eb5e7[_0x2dcc('0x2a')],qs[_0x2dcc('0x2f')](_0x76cbd6['query'][_0x2dcc('0x2f')]));_0x3096b5[_0x2dcc('0x30')]=_0x3096b5[_0x2dcc('0x30')][_0x2dcc('0x41')]?_0x3096b5[_0x2dcc('0x30')]:_0x3eb5e7['model'];_0x3096b5[_0x2dcc('0x33')]=qs[_0x2dcc('0x34')](_0x76cbd6[_0x2dcc('0x2b')][_0x2dcc('0x34')]);_0x3096b5['where']=qs[_0x2dcc('0x2d')](_[_0x2dcc('0x36')](_0x76cbd6['query'],_0x3eb5e7[_0x2dcc('0x2d')]));if(_0x76cbd6['query'][_0x2dcc('0x38')]){_0x3096b5[_0x2dcc('0x35')]=_['merge'](_0x3096b5[_0x2dcc('0x35')],{'$or':_[_0x2dcc('0x25')](_0x3096b5['attributes'],function(_0x36400d){var _0x434b9d={};_0x434b9d[_0x36400d]={'$like':'%'+_0x76cbd6['query'][_0x2dcc('0x38')]+'%'};return _0x434b9d;})});}_0x3096b5=_[_0x2dcc('0x39')]({},_0x3096b5,_0x76cbd6[_0x2dcc('0x3a')]);return _0x16e1ed[_0x2dcc('0x4a')](_0x3096b5);}})[_0x2dcc('0x21')](function(_0xd31086){if(_0xd31086){_0x1e224a=_0xd31086[_0x2dcc('0x41')];if(!_0x76cbd6[_0x2dcc('0x2b')]['hasOwnProperty'](_0x2dcc('0x32'))){_0x3096b5[_0x2dcc('0x1c')]=qs['limit'](_0x76cbd6[_0x2dcc('0x2b')][_0x2dcc('0x1c')]);_0x3096b5[_0x2dcc('0x1a')]=qs[_0x2dcc('0x1a')](_0x76cbd6['query'][_0x2dcc('0x1a')]);}return _0x16e1ed[_0x2dcc('0x4a')](_0x3096b5);}})[_0x2dcc('0x21')](function(_0x594660){if(_0x594660){return _0x594660?{'count':_0x1e224a,'rows':_0x594660}:null;}})[_0x2dcc('0x21')](respondWithResult(_0x422cdb,null))['catch'](handleError(_0x422cdb,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 1e76835..2acb984 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 _0xe598=['./intVtigerConfiguration.attributes','VtigerConfiguration','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4ebb08,_0x535dd5){var _0xf42c5b=function(_0x2d2613){while(--_0x2d2613){_0x4ebb08['push'](_0x4ebb08['shift']());}};_0xf42c5b(++_0x535dd5);}(_0xe598,0x122));var _0x8e59=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0xe598[_0xc55d64];return _0x4194f6;};'use strict';var _=require('lodash');var util=require(_0x8e59('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8e59('0x1'));var BPromise=require(_0x8e59('0x2'));var rp=require(_0x8e59('0x3'));var fs=require('fs');var path=require(_0x8e59('0x4'));var rimraf=require(_0x8e59('0x5'));var config=require(_0x8e59('0x6'));var attributes=require(_0x8e59('0x7'));module['exports']=function(_0x5422c8,_0x1d1004){return _0x5422c8['define'](_0x8e59('0x8'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd849=['path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','moment','bluebird','request-promise'];(function(_0x450d48,_0x381552){var _0x419404=function(_0x5caf85){while(--_0x5caf85){_0x450d48['push'](_0x450d48['shift']());}};_0x419404(++_0x381552);}(_0xd849,0x157));var _0x9d84=function(_0x120830,_0x4d996a){_0x120830=_0x120830-0x0;var _0x4d4a32=_0xd849[_0x120830];return _0x4d4a32;};'use strict';var _=require(_0x9d84('0x0'));var util=require(_0x9d84('0x1'));var logger=require('../../config/logger')('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('rimraf');var config=require(_0x9d84('0x6'));var attributes=require(_0x9d84('0x7'));module[_0x9d84('0x8')]=function(_0x2d20db,_0x176ce2){return _0x2d20db[_0x9d84('0x9')](_0x9d84('0xa'),attributes,{'tableName':_0x9d84('0xb'),'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 7d6e1e7..f9f1ed4 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 _0xef3d=['request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x4c5839,_0x364d7f){var _0x3246bc=function(_0x1aa384){while(--_0x1aa384){_0x4c5839['push'](_0x4c5839['shift']());}};_0x3246bc(++_0x364d7f);}(_0xef3d,0x1bf));var _0xdef3=function(_0x36caa9,_0x47bd47){_0x36caa9=_0x36caa9-0x0;var _0x3ed9b3=_0xef3d[_0x36caa9];return _0x3ed9b3;};'use strict';var _=require(_0xdef3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdef3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdef3('0x2'));var db=require(_0xdef3('0x3'))['db'];var utils=require(_0xdef3('0x4'));var logger=require('../../config/logger')(_0xdef3('0x5'));var config=require(_0xdef3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdef3('0x7')][_0xdef3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x83031d,_0x23a68e,_0x2f4f32){return new BPromise(function(_0x5796ef,_0x36fb34){return client[_0xdef3('0x9')](_0x83031d,_0x2f4f32)['then'](function(_0x1200a8){logger[_0xdef3('0xa')](_0xdef3('0xb'),_0x23a68e,_0xdef3('0xc'));logger[_0xdef3('0xd')](_0xdef3('0xe'),_0x23a68e,'request\x20sent',JSON['stringify'](_0x1200a8));if(_0x1200a8['error']){if(_0x1200a8['error']['code']===0x1f4){logger['error'](_0xdef3('0xb'),_0x23a68e,_0x1200a8['error']['message']);return _0x36fb34(_0x1200a8[_0xdef3('0xf')][_0xdef3('0x10')]);}logger[_0xdef3('0xf')](_0xdef3('0xb'),_0x23a68e,_0x1200a8['error'][_0xdef3('0x10')]);return _0x5796ef(_0x1200a8[_0xdef3('0xf')][_0xdef3('0x10')]);}else{logger[_0xdef3('0xa')](_0xdef3('0xb'),_0x23a68e,'request\x20sent');_0x5796ef(_0x1200a8[_0xdef3('0x11')][_0xdef3('0x10')]);}})[_0xdef3('0x12')](function(_0x24cce5){logger['error'](_0xdef3('0xb'),_0x23a68e,_0x24cce5);_0x36fb34(_0x24cce5);});});} \ No newline at end of file +var _0x6140=['jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xfb736e,_0x35e328){var _0x5df606=function(_0x246831){while(--_0x246831){_0xfb736e['push'](_0xfb736e['shift']());}};_0x5df606(++_0x35e328);}(_0x6140,0x6e));var _0x0614=function(_0x16c8a3,_0x211c55){_0x16c8a3=_0x16c8a3-0x0;var _0x500f71=_0x6140[_0x16c8a3];return _0x500f71;};'use strict';var _=require(_0x0614('0x0'));var util=require('util');var moment=require(_0x0614('0x1'));var BPromise=require(_0x0614('0x2'));var rs=require(_0x0614('0x3'));var fs=require('fs');var Redis=require(_0x0614('0x4'));var db=require(_0x0614('0x5'))['db'];var utils=require(_0x0614('0x6'));var logger=require(_0x0614('0x7'))(_0x0614('0x8'));var config=require(_0x0614('0x9'));var jayson=require(_0x0614('0xa'));var client=jayson[_0x0614('0xb')][_0x0614('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b64dd,_0xc5b583,_0x1bcade){return new BPromise(function(_0x2a9113,_0x14f3ab){return client[_0x0614('0xd')](_0x3b64dd,_0x1bcade)['then'](function(_0x3ab6e6){logger[_0x0614('0xe')](_0x0614('0xf'),_0xc5b583,_0x0614('0x10'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xc5b583,_0x0614('0x10'),JSON['stringify'](_0x3ab6e6));if(_0x3ab6e6[_0x0614('0x11')]){if(_0x3ab6e6['error']['code']===0x1f4){logger[_0x0614('0x11')](_0x0614('0xf'),_0xc5b583,_0x3ab6e6[_0x0614('0x11')][_0x0614('0x12')]);return _0x14f3ab(_0x3ab6e6['error'][_0x0614('0x12')]);}logger[_0x0614('0x11')](_0x0614('0xf'),_0xc5b583,_0x3ab6e6['error'][_0x0614('0x12')]);return _0x2a9113(_0x3ab6e6[_0x0614('0x11')][_0x0614('0x12')]);}else{logger['info'](_0x0614('0xf'),_0xc5b583,_0x0614('0x10'));_0x2a9113(_0x3ab6e6[_0x0614('0x13')][_0x0614('0x12')]);}})['catch'](function(_0x67a333){logger[_0x0614('0x11')](_0x0614('0xf'),_0xc5b583,_0x67a333);_0x14f3ab(_0x67a333);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 29781c1..a9d1017 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 _0xad02=['../../config/environment','get','isAuthenticated','index','/:id','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4c81ab,_0xfca3b7){var _0x35c3cf=function(_0x40660a){while(--_0x40660a){_0x4c81ab['push'](_0x4c81ab['shift']());}};_0x35c3cf(++_0xfca3b7);}(_0xad02,0x69));var _0x2ad0=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0xad02[_0x1bb58c];return _0x277586;};'use strict';var multer=require(_0x2ad0('0x0'));var util=require(_0x2ad0('0x1'));var path=require('path');var timeout=require(_0x2ad0('0x2'));var express=require(_0x2ad0('0x3'));var router=express[_0x2ad0('0x4')]();var fs_extra=require(_0x2ad0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2ad0('0x6'));var config=require(_0x2ad0('0x7'));var controller=require('./intVtigerField.controller');router[_0x2ad0('0x8')]('/',auth[_0x2ad0('0x9')](),controller[_0x2ad0('0xa')]);router[_0x2ad0('0x8')](_0x2ad0('0xb'),auth[_0x2ad0('0x9')](),controller['show']);router['post']('/',auth[_0x2ad0('0x9')](),controller[_0x2ad0('0xc')]);router[_0x2ad0('0xd')](_0x2ad0('0xb'),auth[_0x2ad0('0x9')](),controller['update']);router[_0x2ad0('0xe')](_0x2ad0('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2ad0('0xf')]=router; \ No newline at end of file +var _0x8a8a=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','isAuthenticated','get','/:id','show','create','put','update','destroy','exports'];(function(_0x47f1f3,_0x150f55){var _0x50d8e7=function(_0x15d671){while(--_0x15d671){_0x47f1f3['push'](_0x47f1f3['shift']());}};_0x50d8e7(++_0x150f55);}(_0x8a8a,0x18c));var _0xa8a8=function(_0x4e803d,_0x3dc487){_0x4e803d=_0x4e803d-0x0;var _0x5c6ae8=_0x8a8a[_0x4e803d];return _0x5c6ae8;};'use strict';var multer=require(_0xa8a8('0x0'));var util=require(_0xa8a8('0x1'));var path=require('path');var timeout=require(_0xa8a8('0x2'));var express=require(_0xa8a8('0x3'));var router=express[_0xa8a8('0x4')]();var fs_extra=require(_0xa8a8('0x5'));var auth=require(_0xa8a8('0x6'));var interaction=require(_0xa8a8('0x7'));var config=require('../../config/environment');var controller=require(_0xa8a8('0x8'));router['get']('/',auth[_0xa8a8('0x9')](),controller['index']);router[_0xa8a8('0xa')](_0xa8a8('0xb'),auth[_0xa8a8('0x9')](),controller[_0xa8a8('0xc')]);router['post']('/',auth[_0xa8a8('0x9')](),controller[_0xa8a8('0xd')]);router[_0xa8a8('0xe')](_0xa8a8('0xb'),auth['isAuthenticated'](),controller[_0xa8a8('0xf')]);router['delete'](_0xa8a8('0xb'),auth[_0xa8a8('0x9')](),controller[_0xa8a8('0x10')]);module[_0xa8a8('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 8765ada..beea6a9 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 _0x29af=['keyValue','picklist','STRING','ENUM','variable','customVariable'];(function(_0x36c550,_0x143ec3){var _0x44e264=function(_0x2436dc){while(--_0x2436dc){_0x36c550['push'](_0x36c550['shift']());}};_0x44e264(++_0x143ec3);}(_0x29af,0x99));var _0xf29a=function(_0x5a73c4,_0x19f61c){_0x5a73c4=_0x5a73c4-0x0;var _0x54611d=_0x29af[_0x5a73c4];return _0x54611d;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xf29a('0x0')]('string',_0xf29a('0x1'),_0xf29a('0x2'),_0xf29a('0x3'),_0xf29a('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf29a('0x5')]},'key':{'type':Sequelize[_0xf29a('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xf29a('0x1'),_0xf29a('0x2'))},'keyContent':{'type':Sequelize[_0xf29a('0x5')]},'idField':{'type':Sequelize[_0xf29a('0x5')]},'nameField':{'type':Sequelize[_0xf29a('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x66c2=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x1fc9ad,_0x54b320){var _0x351fd4=function(_0x2843a0){while(--_0x2843a0){_0x1fc9ad['push'](_0x1fc9ad['shift']());}};_0x351fd4(++_0x54b320);}(_0x66c2,0xd0));var _0x266c=function(_0x4c6346,_0x14b39b){_0x4c6346=_0x4c6346-0x0;var _0x1414a9=_0x66c2[_0x4c6346];return _0x1414a9;};'use strict';var Sequelize=require(_0x266c('0x0'));module[_0x266c('0x1')]={'type':{'type':Sequelize[_0x266c('0x2')](_0x266c('0x3'),_0x266c('0x4'),_0x266c('0x5'),_0x266c('0x6'),_0x266c('0x7')),'defaultValue':_0x266c('0x3')},'content':{'type':Sequelize[_0x266c('0x8')]},'key':{'type':Sequelize[_0x266c('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x266c('0x3'),'variable',_0x266c('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x266c('0x8')]},'nameField':{'type':Sequelize[_0x266c('0x8')]},'customField':{'type':Sequelize[_0x266c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 3e47976..c32eea6 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 _0x411e=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','map','VtigerField','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','body','find','params','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment'];(function(_0x3f333c,_0x14f59a){var _0x6af3ad=function(_0x497511){while(--_0x497511){_0x3f333c['push'](_0x3f333c['shift']());}};_0x6af3ad(++_0x14f59a);}(_0x411e,0x144));var _0xe411=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0x411e[_0x333798];return _0x389f4e;};'use strict';var emlformat=require(_0xe411('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe411('0x1'));var rp=require(_0xe411('0x2'));var moment=require('moment');var BPromise=require(_0xe411('0x3'));var Mustache=require(_0xe411('0x4'));var util=require('util');var path=require(_0xe411('0x5'));var sox=require('sox');var csv=require(_0xe411('0x6'));var ejs=require(_0xe411('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe411('0x8'));var squel=require(_0xe411('0x9'));var crypto=require(_0xe411('0xa'));var jsforce=require(_0xe411('0xb'));var deskjs=require(_0xe411('0xc'));var toCsv=require(_0xe411('0x6'));var querystring=require(_0xe411('0xd'));var Papa=require(_0xe411('0xe'));var Redis=require('ioredis');var authService=require(_0xe411('0xf'));var qs=require(_0xe411('0x10'));var as=require(_0xe411('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe411('0x12'))('api');var utils=require(_0xe411('0x13'));var config=require(_0xe411('0x14'));var licenseUtil=require(_0xe411('0x15'));var db=require(_0xe411('0x16'))['db'];function respondWithStatusCode(_0x2f3136,_0x16d0b2){_0x16d0b2=_0x16d0b2||0xcc;return function(_0x1d8393){if(_0x1d8393){return _0x2f3136[_0xe411('0x17')](_0x16d0b2);}return _0x2f3136[_0xe411('0x18')](_0x16d0b2)[_0xe411('0x19')]();};}function respondWithResult(_0x43aea9,_0x545a7c){_0x545a7c=_0x545a7c||0xc8;return function(_0x1a8515){if(_0x1a8515){return _0x43aea9[_0xe411('0x18')](_0x545a7c)[_0xe411('0x1a')](_0x1a8515);}};}function respondWithFilteredResult(_0x54a1d4,_0x1f9936){return function(_0x3d859a){if(_0x3d859a){var _0x4e306b=typeof _0x1f9936[_0xe411('0x1b')]===_0xe411('0x1c')&&typeof _0x1f9936[_0xe411('0x1d')]===_0xe411('0x1c');var _0x178333=_0x3d859a[_0xe411('0x1e')];var _0x2fcb7d=_0x4e306b?0x0:_0x1f9936['offset'];var _0x2f497c=_0x4e306b?_0x3d859a[_0xe411('0x1e')]:_0x1f9936[_0xe411('0x1b')]+_0x1f9936[_0xe411('0x1d')];var _0x967126;if(_0x2f497c>=_0x178333){_0x2f497c=_0x178333;_0x967126=0xc8;}else{_0x967126=0xce;}_0x54a1d4[_0xe411('0x18')](_0x967126);return _0x54a1d4[_0xe411('0x1f')](_0xe411('0x20'),_0x2fcb7d+'-'+_0x2f497c+'/'+_0x178333)[_0xe411('0x1a')](_0x3d859a);}return null;};}function patchUpdates(_0x18dae9){return function(_0xb8cd4){try{jsonpatch[_0xe411('0x21')](_0xb8cd4,_0x18dae9,!![]);}catch(_0x2e4f2c){return BPromise[_0xe411('0x22')](_0x2e4f2c);}return _0xb8cd4[_0xe411('0x23')]();};}function saveUpdates(_0x15f7d7,_0x19f3c7){return function(_0x516310){if(_0x516310){return _0x516310[_0xe411('0x24')](_0x15f7d7)[_0xe411('0x25')](function(_0x375e4e){return _0x375e4e;});}return null;};}function removeEntity(_0x3ea527,_0x3a871a){return function(_0x3b9263){if(_0x3b9263){return _0x3b9263['destroy']()['then'](function(){_0x3ea527[_0xe411('0x18')](0xcc)[_0xe411('0x19')]();});}};}function handleEntityNotFound(_0x1966e5,_0x3fcb88){return function(_0x2c337b){if(!_0x2c337b){_0x1966e5[_0xe411('0x17')](0x194);}return _0x2c337b;};}function handleError(_0x3acec0,_0x4dc266){_0x4dc266=_0x4dc266||0x1f4;return function(_0x5a4a8f){logger[_0xe411('0x26')](_0x5a4a8f['stack']);if(_0x5a4a8f[_0xe411('0x27')]){delete _0x5a4a8f[_0xe411('0x27')];}_0x3acec0['status'](_0x4dc266)[_0xe411('0x28')](_0x5a4a8f);};}exports['index']=function(_0x197a94,_0x293ae0){var _0x10dedd={},_0x9a26a4={},_0x5c6ade={'count':0x0,'rows':[]};var _0x14fa4f=_[_0xe411('0x29')](db[_0xe411('0x2a')]['rawAttributes'],function(_0x2e10a3){return{'name':_0x2e10a3[_0xe411('0x2b')],'type':_0x2e10a3[_0xe411('0x2c')]['key']};});_0x9a26a4[_0xe411('0x2d')]=_[_0xe411('0x29')](_0x14fa4f,'name');_0x9a26a4[_0xe411('0x2e')]=_[_0xe411('0x2f')](_0x197a94['query']);_0x9a26a4['filters']=_[_0xe411('0x30')](_0x9a26a4[_0xe411('0x2d')],_0x9a26a4[_0xe411('0x2e')]);_0x10dedd[_0xe411('0x31')]=_[_0xe411('0x30')](_0x9a26a4[_0xe411('0x2d')],qs[_0xe411('0x32')](_0x197a94[_0xe411('0x2e')]['fields']));_0x10dedd[_0xe411('0x31')]=_0x10dedd['attributes'][_0xe411('0x33')]?_0x10dedd[_0xe411('0x31')]:_0x9a26a4['model'];if(!_0x197a94[_0xe411('0x2e')]['hasOwnProperty'](_0xe411('0x34'))){_0x10dedd[_0xe411('0x1d')]=qs[_0xe411('0x1d')](_0x197a94['query']['limit']);_0x10dedd['offset']=qs['offset'](_0x197a94[_0xe411('0x2e')][_0xe411('0x1b')]);}_0x10dedd[_0xe411('0x35')]=qs[_0xe411('0x36')](_0x197a94[_0xe411('0x2e')][_0xe411('0x36')]);_0x10dedd[_0xe411('0x37')]=qs[_0xe411('0x38')](_[_0xe411('0x39')](_0x197a94[_0xe411('0x2e')],_0x9a26a4['filters']),_0x14fa4f);if(_0x197a94['query']['filter']){_0x10dedd['where']=_[_0xe411('0x3a')](_0x10dedd[_0xe411('0x37')],{'$or':_[_0xe411('0x29')](_0x14fa4f,function(_0x1fcefe){if(_0x1fcefe[_0xe411('0x2c')]!=='VIRTUAL'){var _0x252d34={};_0x252d34[_0x1fcefe['name']]={'$like':'%'+_0x197a94[_0xe411('0x2e')][_0xe411('0x3b')]+'%'};return _0x252d34;}})});}_0x10dedd=_[_0xe411('0x3a')]({},_0x10dedd,_0x197a94[_0xe411('0x3c')]);var _0x3f60ed={'where':_0x10dedd[_0xe411('0x37')]};return db[_0xe411('0x2a')][_0xe411('0x1e')](_0x3f60ed)['then'](function(_0x26ccda){_0x5c6ade[_0xe411('0x1e')]=_0x26ccda;if(_0x197a94['query'][_0xe411('0x3d')]){_0x10dedd[_0xe411('0x3e')]=[{'all':!![]}];}return db[_0xe411('0x2a')][_0xe411('0x3f')](_0x10dedd);})[_0xe411('0x25')](function(_0x2e5aa0){_0x5c6ade[_0xe411('0x40')]=_0x2e5aa0;return _0x5c6ade;})['then'](respondWithFilteredResult(_0x293ae0,_0x10dedd))[_0xe411('0x41')](handleError(_0x293ae0,null));};exports['show']=function(_0x4489e3,_0xf42992){var _0x381724={'raw':!![],'where':{'id':_0x4489e3['params']['id']}},_0xe7eb35={};_0xe7eb35[_0xe411('0x2d')]=_[_0xe411('0x2f')](db[_0xe411('0x2a')]['rawAttributes']);_0xe7eb35['query']=_[_0xe411('0x2f')](_0x4489e3['query']);_0xe7eb35[_0xe411('0x38')]=_[_0xe411('0x30')](_0xe7eb35[_0xe411('0x2d')],_0xe7eb35[_0xe411('0x2e')]);_0x381724[_0xe411('0x31')]=_[_0xe411('0x30')](_0xe7eb35[_0xe411('0x2d')],qs[_0xe411('0x32')](_0x4489e3[_0xe411('0x2e')][_0xe411('0x32')]));_0x381724[_0xe411('0x31')]=_0x381724[_0xe411('0x31')]['length']?_0x381724[_0xe411('0x31')]:_0xe7eb35[_0xe411('0x2d')];if(_0x4489e3[_0xe411('0x2e')][_0xe411('0x3d')]){_0x381724[_0xe411('0x3e')]=[{'all':!![]}];}_0x381724=_[_0xe411('0x3a')]({},_0x381724,_0x4489e3[_0xe411('0x3c')]);return db[_0xe411('0x2a')]['find'](_0x381724)[_0xe411('0x25')](handleEntityNotFound(_0xf42992,null))[_0xe411('0x25')](respondWithResult(_0xf42992,null))['catch'](handleError(_0xf42992,null));};exports['create']=function(_0x21bf08,_0x472fbc){return db[_0xe411('0x2a')]['create'](_0x21bf08[_0xe411('0x42')],{})[_0xe411('0x25')](respondWithResult(_0x472fbc,0xc9))[_0xe411('0x41')](handleError(_0x472fbc,null));};exports[_0xe411('0x24')]=function(_0x53ab5c,_0x2eb953){if(_0x53ab5c[_0xe411('0x42')]['id']){delete _0x53ab5c[_0xe411('0x42')]['id'];}return db[_0xe411('0x2a')][_0xe411('0x43')]({'where':{'id':_0x53ab5c[_0xe411('0x44')]['id']}})[_0xe411('0x25')](handleEntityNotFound(_0x2eb953,null))[_0xe411('0x25')](saveUpdates(_0x53ab5c['body'],null))[_0xe411('0x25')](respondWithResult(_0x2eb953,null))[_0xe411('0x41')](handleError(_0x2eb953,null));};exports['destroy']=function(_0x1a6190,_0x405227){return db['VtigerField'][_0xe411('0x43')]({'where':{'id':_0x1a6190[_0xe411('0x44')]['id']}})[_0xe411('0x25')](handleEntityNotFound(_0x405227,null))[_0xe411('0x25')](removeEntity(_0x405227,null))['catch'](handleError(_0x405227,null));}; \ No newline at end of file +var _0xa633=['create','update','body','find','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','VtigerField','include','findAll','catch','show','params','rawAttributes','includeAll','options'];(function(_0x514568,_0xe8c1b0){var _0x2aa28d=function(_0xdb6985){while(--_0xdb6985){_0x514568['push'](_0x514568['shift']());}};_0x2aa28d(++_0xe8c1b0);}(_0xa633,0x171));var _0x3a63=function(_0x47e14c,_0x1f5fc6){_0x47e14c=_0x47e14c-0x0;var _0x2c295d=_0xa633[_0x47e14c];return _0x2c295d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3a63('0x0'));var jsonpatch=require(_0x3a63('0x1'));var rp=require(_0x3a63('0x2'));var moment=require(_0x3a63('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3a63('0x4'));var util=require(_0x3a63('0x5'));var path=require(_0x3a63('0x6'));var sox=require(_0x3a63('0x7'));var csv=require('to-csv');var ejs=require(_0x3a63('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3a63('0x9'));var crypto=require(_0x3a63('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3a63('0xb'));var querystring=require('querystring');var Papa=require(_0x3a63('0xc'));var Redis=require(_0x3a63('0xd'));var authService=require(_0x3a63('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3a63('0xf'));var hardwareService=require(_0x3a63('0x10'));var logger=require(_0x3a63('0x11'))(_0x3a63('0x12'));var utils=require(_0x3a63('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3a63('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb2c1cc,_0x2339e7){_0x2339e7=_0x2339e7||0xcc;return function(_0x4987dc){if(_0x4987dc){return _0xb2c1cc[_0x3a63('0x15')](_0x2339e7);}return _0xb2c1cc['status'](_0x2339e7)[_0x3a63('0x16')]();};}function respondWithResult(_0xd8413f,_0x4590a1){_0x4590a1=_0x4590a1||0xc8;return function(_0x619f24){if(_0x619f24){return _0xd8413f[_0x3a63('0x17')](_0x4590a1)[_0x3a63('0x18')](_0x619f24);}};}function respondWithFilteredResult(_0x2e159c,_0x26747a){return function(_0x26bfc2){if(_0x26bfc2){var _0x31b69b=typeof _0x26747a[_0x3a63('0x19')]===_0x3a63('0x1a')&&typeof _0x26747a[_0x3a63('0x1b')]===_0x3a63('0x1a');var _0x20d592=_0x26bfc2[_0x3a63('0x1c')];var _0xd8d4b5=_0x31b69b?0x0:_0x26747a[_0x3a63('0x19')];var _0x517c70=_0x31b69b?_0x26bfc2[_0x3a63('0x1c')]:_0x26747a['offset']+_0x26747a[_0x3a63('0x1b')];var _0x2b11e0;if(_0x517c70>=_0x20d592){_0x517c70=_0x20d592;_0x2b11e0=0xc8;}else{_0x2b11e0=0xce;}_0x2e159c[_0x3a63('0x17')](_0x2b11e0);return _0x2e159c[_0x3a63('0x1d')](_0x3a63('0x1e'),_0xd8d4b5+'-'+_0x517c70+'/'+_0x20d592)['json'](_0x26bfc2);}return null;};}function patchUpdates(_0x2fb1f0){return function(_0x2e3200){try{jsonpatch[_0x3a63('0x1f')](_0x2e3200,_0x2fb1f0,!![]);}catch(_0x2ca201){return BPromise['reject'](_0x2ca201);}return _0x2e3200[_0x3a63('0x20')]();};}function saveUpdates(_0xe5571a,_0x1ee6e1){return function(_0x3dc207){if(_0x3dc207){return _0x3dc207['update'](_0xe5571a)[_0x3a63('0x21')](function(_0x56f82d){return _0x56f82d;});}return null;};}function removeEntity(_0x4edec0,_0x44392e){return function(_0x220ab7){if(_0x220ab7){return _0x220ab7[_0x3a63('0x22')]()[_0x3a63('0x21')](function(){_0x4edec0[_0x3a63('0x17')](0xcc)[_0x3a63('0x16')]();});}};}function handleEntityNotFound(_0x5c1d7b,_0x1a418f){return function(_0x3453ff){if(!_0x3453ff){_0x5c1d7b[_0x3a63('0x15')](0x194);}return _0x3453ff;};}function handleError(_0x42c981,_0x2624e7){_0x2624e7=_0x2624e7||0x1f4;return function(_0x2bc8fd){logger['error'](_0x2bc8fd[_0x3a63('0x23')]);if(_0x2bc8fd[_0x3a63('0x24')]){delete _0x2bc8fd[_0x3a63('0x24')];}_0x42c981[_0x3a63('0x17')](_0x2624e7)[_0x3a63('0x25')](_0x2bc8fd);};}exports[_0x3a63('0x26')]=function(_0x32833b,_0x5e8cd1){var _0x38fe94={},_0x14dacc={},_0x3d4e07={'count':0x0,'rows':[]};var _0x397a1d=_[_0x3a63('0x27')](db['VtigerField']['rawAttributes'],function(_0x565017){return{'name':_0x565017[_0x3a63('0x28')],'type':_0x565017[_0x3a63('0x29')][_0x3a63('0x2a')]};});_0x14dacc[_0x3a63('0x2b')]=_['map'](_0x397a1d,_0x3a63('0x24'));_0x14dacc['query']=_[_0x3a63('0x2c')](_0x32833b[_0x3a63('0x2d')]);_0x14dacc[_0x3a63('0x2e')]=_[_0x3a63('0x2f')](_0x14dacc[_0x3a63('0x2b')],_0x14dacc[_0x3a63('0x2d')]);_0x38fe94[_0x3a63('0x30')]=_[_0x3a63('0x2f')](_0x14dacc[_0x3a63('0x2b')],qs['fields'](_0x32833b[_0x3a63('0x2d')][_0x3a63('0x31')]));_0x38fe94['attributes']=_0x38fe94[_0x3a63('0x30')][_0x3a63('0x32')]?_0x38fe94[_0x3a63('0x30')]:_0x14dacc[_0x3a63('0x2b')];if(!_0x32833b['query'][_0x3a63('0x33')](_0x3a63('0x34'))){_0x38fe94['limit']=qs[_0x3a63('0x1b')](_0x32833b['query'][_0x3a63('0x1b')]);_0x38fe94[_0x3a63('0x19')]=qs['offset'](_0x32833b[_0x3a63('0x2d')][_0x3a63('0x19')]);}_0x38fe94[_0x3a63('0x35')]=qs['sort'](_0x32833b['query'][_0x3a63('0x36')]);_0x38fe94['where']=qs['filters'](_[_0x3a63('0x37')](_0x32833b[_0x3a63('0x2d')],_0x14dacc['filters']),_0x397a1d);if(_0x32833b['query']['filter']){_0x38fe94[_0x3a63('0x38')]=_[_0x3a63('0x39')](_0x38fe94['where'],{'$or':_[_0x3a63('0x27')](_0x397a1d,function(_0x176bf9){if(_0x176bf9[_0x3a63('0x29')]!==_0x3a63('0x3a')){var _0x525696={};_0x525696[_0x176bf9[_0x3a63('0x24')]]={'$like':'%'+_0x32833b[_0x3a63('0x2d')][_0x3a63('0x3b')]+'%'};return _0x525696;}})});}_0x38fe94=_[_0x3a63('0x39')]({},_0x38fe94,_0x32833b['options']);var _0x33c479={'where':_0x38fe94['where']};return db[_0x3a63('0x3c')][_0x3a63('0x1c')](_0x33c479)['then'](function(_0x478953){_0x3d4e07[_0x3a63('0x1c')]=_0x478953;if(_0x32833b[_0x3a63('0x2d')]['includeAll']){_0x38fe94[_0x3a63('0x3d')]=[{'all':!![]}];}return db[_0x3a63('0x3c')][_0x3a63('0x3e')](_0x38fe94);})[_0x3a63('0x21')](function(_0x344fee){_0x3d4e07['rows']=_0x344fee;return _0x3d4e07;})['then'](respondWithFilteredResult(_0x5e8cd1,_0x38fe94))[_0x3a63('0x3f')](handleError(_0x5e8cd1,null));};exports[_0x3a63('0x40')]=function(_0x133bd9,_0x30e2aa){var _0x1dce3e={'raw':!![],'where':{'id':_0x133bd9[_0x3a63('0x41')]['id']}},_0x2e99cd={};_0x2e99cd[_0x3a63('0x2b')]=_[_0x3a63('0x2c')](db['VtigerField'][_0x3a63('0x42')]);_0x2e99cd[_0x3a63('0x2d')]=_['keys'](_0x133bd9[_0x3a63('0x2d')]);_0x2e99cd[_0x3a63('0x2e')]=_['intersection'](_0x2e99cd[_0x3a63('0x2b')],_0x2e99cd[_0x3a63('0x2d')]);_0x1dce3e[_0x3a63('0x30')]=_[_0x3a63('0x2f')](_0x2e99cd['model'],qs[_0x3a63('0x31')](_0x133bd9[_0x3a63('0x2d')][_0x3a63('0x31')]));_0x1dce3e[_0x3a63('0x30')]=_0x1dce3e[_0x3a63('0x30')][_0x3a63('0x32')]?_0x1dce3e[_0x3a63('0x30')]:_0x2e99cd['model'];if(_0x133bd9[_0x3a63('0x2d')][_0x3a63('0x43')]){_0x1dce3e['include']=[{'all':!![]}];}_0x1dce3e=_[_0x3a63('0x39')]({},_0x1dce3e,_0x133bd9[_0x3a63('0x44')]);return db[_0x3a63('0x3c')]['find'](_0x1dce3e)[_0x3a63('0x21')](handleEntityNotFound(_0x30e2aa,null))['then'](respondWithResult(_0x30e2aa,null))[_0x3a63('0x3f')](handleError(_0x30e2aa,null));};exports[_0x3a63('0x45')]=function(_0x3658fe,_0x11122f){return db[_0x3a63('0x3c')][_0x3a63('0x45')](_0x3658fe['body'],{})[_0x3a63('0x21')](respondWithResult(_0x11122f,0xc9))['catch'](handleError(_0x11122f,null));};exports[_0x3a63('0x46')]=function(_0x5ea6fe,_0x322987){if(_0x5ea6fe[_0x3a63('0x47')]['id']){delete _0x5ea6fe[_0x3a63('0x47')]['id'];}return db[_0x3a63('0x3c')][_0x3a63('0x48')]({'where':{'id':_0x5ea6fe[_0x3a63('0x41')]['id']}})['then'](handleEntityNotFound(_0x322987,null))[_0x3a63('0x21')](saveUpdates(_0x5ea6fe[_0x3a63('0x47')],null))[_0x3a63('0x21')](respondWithResult(_0x322987,null))[_0x3a63('0x3f')](handleError(_0x322987,null));};exports['destroy']=function(_0x51a0a0,_0x3545f2){return db[_0x3a63('0x3c')]['find']({'where':{'id':_0x51a0a0['params']['id']}})['then'](handleEntityNotFound(_0x3545f2,null))[_0x3a63('0x21')](removeEntity(_0x3545f2,null))[_0x3a63('0x3f')](handleError(_0x3545f2,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index fefee37..5410fa6 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 _0x3ecf=['exports','vtiger_unique_index','idField','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0x16a14c,_0x2dbe5c){var _0x12d727=function(_0x15af80){while(--_0x15af80){_0x16a14c['push'](_0x16a14c['shift']());}};_0x12d727(++_0x2dbe5c);}(_0x3ecf,0xf5));var _0xf3ec=function(_0x29c7cb,_0x1cf6e1){_0x29c7cb=_0x29c7cb-0x0;var _0x4db9d7=_0x3ecf[_0x29c7cb];return _0x4db9d7;};'use strict';var _=require(_0xf3ec('0x0'));var util=require(_0xf3ec('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf3ec('0x2'));var BPromise=require(_0xf3ec('0x3'));var rp=require(_0xf3ec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf3ec('0x5'));var config=require(_0xf3ec('0x6'));var attributes=require(_0xf3ec('0x7'));module[_0xf3ec('0x8')]=function(_0x458ff1,_0x37d9c5){return _0x458ff1['define']('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xf3ec('0x9'),'fields':[_0xf3ec('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x06f0=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','./intVtigerField.attributes','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId'];(function(_0x38430a,_0x123894){var _0x4bef92=function(_0x555081){while(--_0x555081){_0x38430a['push'](_0x38430a['shift']());}};_0x4bef92(++_0x123894);}(_0x06f0,0x8f));var _0x006f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06f0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x006f('0x0'));var util=require(_0x006f('0x1'));var logger=require(_0x006f('0x2'))('api');var moment=require(_0x006f('0x3'));var BPromise=require(_0x006f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x006f('0x5'));var rimraf=require(_0x006f('0x6'));var config=require('../../config/environment');var attributes=require(_0x006f('0x7'));module['exports']=function(_0x3b095d,_0x1e55fc){return _0x3b095d['define'](_0x006f('0x8'),attributes,{'tableName':_0x006f('0x9'),'paranoid':![],'indexes':[{'name':_0x006f('0xa'),'fields':[_0x006f('0xb'),_0x006f('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index c10e969..6062c0d 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 _0xa923=['info','result','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','client','http','request','request\x20sent','stringify','error','code','message','VtigerField,\x20%s,\x20%s'];(function(_0x45d8e6,_0x25ec93){var _0x542273=function(_0x1a2655){while(--_0x1a2655){_0x45d8e6['push'](_0x45d8e6['shift']());}};_0x542273(++_0x25ec93);}(_0xa923,0xc8));var _0x3a92=function(_0x53bd2c,_0x5c47f3){_0x53bd2c=_0x53bd2c-0x0;var _0xa33a9=_0xa923[_0x53bd2c];return _0xa33a9;};'use strict';var _=require(_0x3a92('0x0'));var util=require(_0x3a92('0x1'));var moment=require(_0x3a92('0x2'));var BPromise=require('bluebird');var rs=require(_0x3a92('0x3'));var fs=require('fs');var Redis=require(_0x3a92('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3a92('0x5'))('rpc');var config=require(_0x3a92('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3a92('0x7')][_0x3a92('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a1751,_0x438733,_0x1b0801){return new BPromise(function(_0x5c30c9,_0x28c235){return client[_0x3a92('0x9')](_0x3a1751,_0x1b0801)['then'](function(_0x818881){logger['info']('VtigerField,\x20%s,\x20%s',_0x438733,_0x3a92('0xa'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x438733,_0x3a92('0xa'),JSON[_0x3a92('0xb')](_0x818881));if(_0x818881[_0x3a92('0xc')]){if(_0x818881[_0x3a92('0xc')][_0x3a92('0xd')]===0x1f4){logger[_0x3a92('0xc')]('VtigerField,\x20%s,\x20%s',_0x438733,_0x818881[_0x3a92('0xc')][_0x3a92('0xe')]);return _0x28c235(_0x818881[_0x3a92('0xc')][_0x3a92('0xe')]);}logger['error'](_0x3a92('0xf'),_0x438733,_0x818881[_0x3a92('0xc')][_0x3a92('0xe')]);return _0x5c30c9(_0x818881['error'][_0x3a92('0xe')]);}else{logger[_0x3a92('0x10')](_0x3a92('0xf'),_0x438733,_0x3a92('0xa'));_0x5c30c9(_0x818881[_0x3a92('0x11')]['message']);}})['catch'](function(_0x1ad895){logger[_0x3a92('0xc')](_0x3a92('0xf'),_0x438733,_0x1ad895);_0x28c235(_0x1ad895);});});} \ No newline at end of file +var _0x6af6=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','message','VtigerField,\x20%s,\x20%s','info','result','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6af6,0x1a3));var _0x66af=function(_0x52cdfb,_0x853ef4){_0x52cdfb=_0x52cdfb-0x0;var _0x5aad59=_0x6af6[_0x52cdfb];return _0x5aad59;};'use strict';var _=require(_0x66af('0x0'));var util=require(_0x66af('0x1'));var moment=require(_0x66af('0x2'));var BPromise=require('bluebird');var rs=require(_0x66af('0x3'));var fs=require('fs');var Redis=require(_0x66af('0x4'));var db=require(_0x66af('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x66af('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x66af('0x7'));var client=jayson[_0x66af('0x8')][_0x66af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ce14e,_0x55ba72,_0xc14e2a){return new BPromise(function(_0x3f1aec,_0x4142fd){return client[_0x66af('0xa')](_0x2ce14e,_0xc14e2a)[_0x66af('0xb')](function(_0x28a58a){logger['info']('VtigerField,\x20%s,\x20%s',_0x55ba72,_0x66af('0xc'));logger[_0x66af('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x55ba72,_0x66af('0xc'),JSON[_0x66af('0xe')](_0x28a58a));if(_0x28a58a[_0x66af('0xf')]){if(_0x28a58a[_0x66af('0xf')][_0x66af('0x10')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x55ba72,_0x28a58a[_0x66af('0xf')][_0x66af('0x11')]);return _0x4142fd(_0x28a58a[_0x66af('0xf')][_0x66af('0x11')]);}logger[_0x66af('0xf')](_0x66af('0x12'),_0x55ba72,_0x28a58a['error'][_0x66af('0x11')]);return _0x3f1aec(_0x28a58a[_0x66af('0xf')][_0x66af('0x11')]);}else{logger[_0x66af('0x13')](_0x66af('0x12'),_0x55ba72,_0x66af('0xc'));_0x3f1aec(_0x28a58a[_0x66af('0x14')][_0x66af('0x11')]);}})['catch'](function(_0x1ab1aa){logger['error']('VtigerField,\x20%s,\x20%s',_0x55ba72,_0x1ab1aa);_0x4142fd(_0x1ab1aa);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 39a7122..12c8de7 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 _0xa9c7=['post','create','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields'];(function(_0x154584,_0x421e12){var _0x969074=function(_0x17303b){while(--_0x17303b){_0x154584['push'](_0x154584['shift']());}};_0x969074(++_0x421e12);}(_0xa9c7,0x148));var _0x7a9c=function(_0x51c52b,_0x147712){_0x51c52b=_0x51c52b-0x0;var _0x581ce3=_0xa9c7[_0x51c52b];return _0x581ce3;};'use strict';var multer=require(_0x7a9c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7a9c('0x1'));var express=require('express');var router=express[_0x7a9c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7a9c('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0x7a9c('0x4')]('/',auth[_0x7a9c('0x5')](),controller[_0x7a9c('0x6')]);router[_0x7a9c('0x4')](_0x7a9c('0x7'),auth[_0x7a9c('0x5')](),controller[_0x7a9c('0x8')]);router[_0x7a9c('0x4')](_0x7a9c('0x9'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x7a9c('0x4')](_0x7a9c('0xa'),auth['isAuthenticated'](),controller[_0x7a9c('0xb')]);router[_0x7a9c('0xc')]('/',auth[_0x7a9c('0x5')](),controller[_0x7a9c('0xd')]);router[_0x7a9c('0xc')]('/:id/configurations',auth[_0x7a9c('0x5')](),controller[_0x7a9c('0xe')]);router[_0x7a9c('0xf')](_0x7a9c('0x7'),auth[_0x7a9c('0x5')](),controller[_0x7a9c('0x10')]);router[_0x7a9c('0x11')](_0x7a9c('0x7'),auth['isAuthenticated'](),controller[_0x7a9c('0x12')]);module[_0x7a9c('0x13')]=router; \ No newline at end of file +var _0x71f1=['multer','util','connect-timeout','express','../../config/environment','./intZendeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','create','post','put','update','destroy','exports'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x71f1,0xea));var _0x171f=function(_0x3ba57e,_0x2e6810){_0x3ba57e=_0x3ba57e-0x0;var _0x5d95cf=_0x71f1[_0x3ba57e];return _0x5d95cf;};'use strict';var multer=require(_0x171f('0x0'));var util=require(_0x171f('0x1'));var path=require('path');var timeout=require(_0x171f('0x2'));var express=require(_0x171f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x171f('0x4'));var controller=require(_0x171f('0x5'));router[_0x171f('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x171f('0x6')](_0x171f('0x7'),auth[_0x171f('0x8')](),controller[_0x171f('0x9')]);router[_0x171f('0x6')](_0x171f('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x171f('0x6')](_0x171f('0xb'),auth[_0x171f('0x8')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x171f('0xc')]);router[_0x171f('0xd')](_0x171f('0xa'),auth[_0x171f('0x8')](),controller['addConfiguration']);router[_0x171f('0xe')]('/:id',auth[_0x171f('0x8')](),controller[_0x171f('0xf')]);router['delete'](_0x171f('0x7'),auth[_0x171f('0x8')](),controller[_0x171f('0x10')]);module[_0x171f('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index b4ec8f4..f6f18be 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 _0xfbbb=['ENUM','newTab','integrationTab','sequelize','exports','STRING','username','password'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0xfbbb,0x1b3));var _0xbfbb=function(_0x54e60d,_0x3b3ee9){_0x54e60d=_0x54e60d-0x0;var _0x28db5e=_0xfbbb[_0x54e60d];return _0x28db5e;};'use strict';var Sequelize=require(_0xbfbb('0x0'));module[_0xbfbb('0x1')]={'name':{'type':Sequelize[_0xbfbb('0x2')]},'description':{'type':Sequelize[_0xbfbb('0x2')]},'username':{'type':Sequelize[_0xbfbb('0x2')],'unique':_0xbfbb('0x3')},'password':{'type':Sequelize[_0xbfbb('0x2')]},'token':{'type':Sequelize[_0xbfbb('0x2')]},'remoteUri':{'type':Sequelize[_0xbfbb('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0xbfbb('0x4'),'token'),'defaultValue':_0xbfbb('0x4')},'serverUrl':{'type':Sequelize[_0xbfbb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbfbb('0x5')]('integrationTab',_0xbfbb('0x6')),'defaultValue':_0xbfbb('0x7')}}; \ No newline at end of file +var _0x553a=['exports','STRING','username','password','ENUM','integrationTab'];(function(_0x1f9a7a,_0x2cecf6){var _0x2672ce=function(_0x2d7535){while(--_0x2d7535){_0x1f9a7a['push'](_0x1f9a7a['shift']());}};_0x2672ce(++_0x2cecf6);}(_0x553a,0x192));var _0xa553=function(_0x75aebf,_0xb132d7){_0x75aebf=_0x75aebf-0x0;var _0x148756=_0x553a[_0x75aebf];return _0x148756;};'use strict';var Sequelize=require('sequelize');module[_0xa553('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa553('0x1')]},'username':{'type':Sequelize[_0xa553('0x1')],'unique':_0xa553('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa553('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0xa553('0x3'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xa553('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa553('0x4')](_0xa553('0x5'),'newTab'),'defaultValue':_0xa553('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 4104ec4..c38963c 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 _0x3c81=['toString','base64','headers','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','name','map','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','ZendeskAccount','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','getConfigurations','findOne','order','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','type','ZendeskConfiguration','ZendeskField','getFields','username','password','token','remoteUri','slice','lastIndexOf','GET','format','%s/%s','authType','Basic\x20%s','%s:%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c81,0x102));var _0x13c8=function(_0x2ae74b,_0x38677a){_0x2ae74b=_0x2ae74b-0x0;var _0x5eca82=_0x3c81[_0x2ae74b];return _0x5eca82;};'use strict';var emlformat=require(_0x13c8('0x0'));var rimraf=require(_0x13c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13c8('0x2'));var rp=require(_0x13c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x13c8('0x4'));var sox=require(_0x13c8('0x5'));var csv=require(_0x13c8('0x6'));var ejs=require(_0x13c8('0x7'));var fs=require('fs');var fs_extra=require(_0x13c8('0x8'));var _=require(_0x13c8('0x9'));var squel=require(_0x13c8('0xa'));var crypto=require('crypto');var jsforce=require(_0x13c8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x13c8('0x6'));var querystring=require(_0x13c8('0xc'));var Papa=require(_0x13c8('0xd'));var Redis=require(_0x13c8('0xe'));var authService=require(_0x13c8('0xf'));var qs=require(_0x13c8('0x10'));var as=require(_0x13c8('0x11'));var hardwareService=require(_0x13c8('0x12'));var logger=require(_0x13c8('0x13'))(_0x13c8('0x14'));var utils=require(_0x13c8('0x15'));var config=require(_0x13c8('0x16'));var licenseUtil=require(_0x13c8('0x17'));var db=require(_0x13c8('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x21442d,_0x7b6da8){_0x7b6da8=_0x7b6da8||0xcc;return function(_0x2304b5){if(_0x2304b5){return _0x21442d[_0x13c8('0x19')](_0x7b6da8);}return _0x21442d['status'](_0x7b6da8)[_0x13c8('0x1a')]();};}function respondWithResult(_0x515681,_0x4d7a88){_0x4d7a88=_0x4d7a88||0xc8;return function(_0x589636){if(_0x589636){return _0x515681[_0x13c8('0x1b')](_0x4d7a88)['json'](_0x589636);}};}function respondWithFilteredResult(_0x337397,_0x17a3c1){return function(_0x23f64e){if(_0x23f64e){var _0x7cbfb=typeof _0x17a3c1['offset']===_0x13c8('0x1c')&&typeof _0x17a3c1[_0x13c8('0x1d')]===_0x13c8('0x1c');var _0x3bc5a9=_0x23f64e[_0x13c8('0x1e')];var _0x28f07e=_0x7cbfb?0x0:_0x17a3c1[_0x13c8('0x1f')];var _0x251c38=_0x7cbfb?_0x23f64e[_0x13c8('0x1e')]:_0x17a3c1[_0x13c8('0x1f')]+_0x17a3c1[_0x13c8('0x1d')];var _0x5ac776;if(_0x251c38>=_0x3bc5a9){_0x251c38=_0x3bc5a9;_0x5ac776=0xc8;}else{_0x5ac776=0xce;}_0x337397[_0x13c8('0x1b')](_0x5ac776);return _0x337397[_0x13c8('0x20')](_0x13c8('0x21'),_0x28f07e+'-'+_0x251c38+'/'+_0x3bc5a9)[_0x13c8('0x22')](_0x23f64e);}return null;};}function patchUpdates(_0x513085){return function(_0x1fb714){try{jsonpatch[_0x13c8('0x23')](_0x1fb714,_0x513085,!![]);}catch(_0x3e3951){return BPromise[_0x13c8('0x24')](_0x3e3951);}return _0x1fb714[_0x13c8('0x25')]();};}function saveUpdates(_0x2fc123,_0x5ab47f){return function(_0x28f99c){if(_0x28f99c){return _0x28f99c[_0x13c8('0x26')](_0x2fc123)[_0x13c8('0x27')](function(_0xcf41d2){return _0xcf41d2;});}return null;};}function removeEntity(_0x577df6,_0x1770e5){return function(_0x458217){if(_0x458217){return _0x458217['destroy']()['then'](function(){_0x577df6[_0x13c8('0x1b')](0xcc)[_0x13c8('0x1a')]();});}};}function handleEntityNotFound(_0x47e8ae,_0x5ad0dc){return function(_0x288c3c){if(!_0x288c3c){_0x47e8ae[_0x13c8('0x19')](0x194);}return _0x288c3c;};}function handleError(_0x53ada9,_0x4df077){_0x4df077=_0x4df077||0x1f4;return function(_0x196983){logger['error'](_0x196983['stack']);if(_0x196983[_0x13c8('0x28')]){delete _0x196983[_0x13c8('0x28')];}_0x53ada9[_0x13c8('0x1b')](_0x4df077)['send'](_0x196983);};}exports['index']=function(_0x277a89,_0x1071a0){var _0x399840={},_0x441182={},_0x138017={'count':0x0,'rows':[]};var _0x220d40=_[_0x13c8('0x29')](db['ZendeskAccount'][_0x13c8('0x2a')],function(_0xcbc9b7){return{'name':_0xcbc9b7['fieldName'],'type':_0xcbc9b7['type'][_0x13c8('0x2b')]};});_0x441182[_0x13c8('0x2c')]=_['map'](_0x220d40,_0x13c8('0x28'));_0x441182[_0x13c8('0x2d')]=_['keys'](_0x277a89[_0x13c8('0x2d')]);_0x441182[_0x13c8('0x2e')]=_[_0x13c8('0x2f')](_0x441182[_0x13c8('0x2c')],_0x441182[_0x13c8('0x2d')]);_0x399840[_0x13c8('0x30')]=_[_0x13c8('0x2f')](_0x441182[_0x13c8('0x2c')],qs['fields'](_0x277a89['query'][_0x13c8('0x31')]));_0x399840[_0x13c8('0x30')]=_0x399840['attributes'][_0x13c8('0x32')]?_0x399840['attributes']:_0x441182[_0x13c8('0x2c')];if(!_0x277a89['query'][_0x13c8('0x33')](_0x13c8('0x34'))){_0x399840[_0x13c8('0x1d')]=qs[_0x13c8('0x1d')](_0x277a89[_0x13c8('0x2d')][_0x13c8('0x1d')]);_0x399840[_0x13c8('0x1f')]=qs['offset'](_0x277a89[_0x13c8('0x2d')][_0x13c8('0x1f')]);}_0x399840['order']=qs[_0x13c8('0x35')](_0x277a89[_0x13c8('0x2d')][_0x13c8('0x35')]);_0x399840['where']=qs['filters'](_['pick'](_0x277a89[_0x13c8('0x2d')],_0x441182[_0x13c8('0x2e')]),_0x220d40);if(_0x277a89[_0x13c8('0x2d')][_0x13c8('0x36')]){_0x399840[_0x13c8('0x37')]=_[_0x13c8('0x38')](_0x399840[_0x13c8('0x37')],{'$or':_[_0x13c8('0x29')](_0x220d40,function(_0xf818be){if(_0xf818be['type']!=='VIRTUAL'){var _0x27e11b={};_0x27e11b[_0xf818be[_0x13c8('0x28')]]={'$like':'%'+_0x277a89[_0x13c8('0x2d')][_0x13c8('0x36')]+'%'};return _0x27e11b;}})});}_0x399840=_['merge']({},_0x399840,_0x277a89[_0x13c8('0x39')]);var _0x4bd627={'where':_0x399840[_0x13c8('0x37')]};return db[_0x13c8('0x3a')][_0x13c8('0x1e')](_0x4bd627)[_0x13c8('0x27')](function(_0xbb1d49){_0x138017[_0x13c8('0x1e')]=_0xbb1d49;if(_0x277a89[_0x13c8('0x2d')][_0x13c8('0x3b')]){_0x399840[_0x13c8('0x3c')]=[{'all':!![]}];}return db[_0x13c8('0x3a')][_0x13c8('0x3d')](_0x399840);})[_0x13c8('0x27')](function(_0x89bbab){_0x138017[_0x13c8('0x3e')]=_0x89bbab;return _0x138017;})[_0x13c8('0x27')](respondWithFilteredResult(_0x1071a0,_0x399840))[_0x13c8('0x3f')](handleError(_0x1071a0,null));};exports[_0x13c8('0x40')]=function(_0x1505fb,_0xc5eb86){var _0x1cff99={'raw':![],'where':{'id':_0x1505fb[_0x13c8('0x41')]['id']}},_0x3622d6={};_0x3622d6[_0x13c8('0x2c')]=_[_0x13c8('0x42')](db[_0x13c8('0x3a')]['rawAttributes']);_0x3622d6[_0x13c8('0x2d')]=_[_0x13c8('0x42')](_0x1505fb[_0x13c8('0x2d')]);_0x3622d6[_0x13c8('0x2e')]=_[_0x13c8('0x2f')](_0x3622d6['model'],_0x3622d6['query']);_0x1cff99[_0x13c8('0x30')]=_[_0x13c8('0x2f')](_0x3622d6[_0x13c8('0x2c')],qs['fields'](_0x1505fb['query']['fields']));_0x1cff99[_0x13c8('0x30')]=_0x1cff99['attributes'][_0x13c8('0x32')]?_0x1cff99['attributes']:_0x3622d6[_0x13c8('0x2c')];if(_0x1505fb[_0x13c8('0x2d')][_0x13c8('0x3b')]){_0x1cff99[_0x13c8('0x3c')]=[{'all':!![]}];}_0x1cff99=_[_0x13c8('0x38')]({},_0x1cff99,_0x1505fb[_0x13c8('0x39')]);return db['ZendeskAccount'][_0x13c8('0x43')](_0x1cff99)[_0x13c8('0x27')](handleEntityNotFound(_0xc5eb86,null))['then'](respondWithResult(_0xc5eb86,null))[_0x13c8('0x3f')](handleError(_0xc5eb86,null));};exports[_0x13c8('0x44')]=function(_0x2e925f,_0x162918){return db[_0x13c8('0x3a')]['create'](_0x2e925f[_0x13c8('0x45')],{})[_0x13c8('0x27')](respondWithResult(_0x162918,0xc9))[_0x13c8('0x3f')](handleError(_0x162918,null));};exports[_0x13c8('0x26')]=function(_0x185d18,_0x59ec9f){if(_0x185d18[_0x13c8('0x45')]['id']){delete _0x185d18[_0x13c8('0x45')]['id'];}return db[_0x13c8('0x3a')][_0x13c8('0x43')]({'where':{'id':_0x185d18[_0x13c8('0x41')]['id']}})[_0x13c8('0x27')](handleEntityNotFound(_0x59ec9f,null))[_0x13c8('0x27')](saveUpdates(_0x185d18[_0x13c8('0x45')],null))[_0x13c8('0x27')](respondWithResult(_0x59ec9f,null))[_0x13c8('0x3f')](handleError(_0x59ec9f,null));};exports[_0x13c8('0x46')]=function(_0x5e1fe5,_0x10ba7c){return db[_0x13c8('0x3a')][_0x13c8('0x43')]({'where':{'id':_0x5e1fe5[_0x13c8('0x41')]['id']}})[_0x13c8('0x27')](handleEntityNotFound(_0x10ba7c,null))[_0x13c8('0x27')](removeEntity(_0x10ba7c,null))['catch'](handleError(_0x10ba7c,null));};exports[_0x13c8('0x47')]=function(_0x416e4f,_0x2f1e83,_0x481205){var _0x54e0c8={};var _0x3d4863={};var _0x14a738;var _0x55d353;return db[_0x13c8('0x3a')][_0x13c8('0x48')]({'where':{'id':_0x416e4f['params']['id']}})[_0x13c8('0x27')](handleEntityNotFound(_0x2f1e83,null))['then'](function(_0x242791){if(_0x242791){_0x14a738=_0x242791;_0x3d4863[_0x13c8('0x2c')]=_[_0x13c8('0x42')](db['ZendeskConfiguration'][_0x13c8('0x2a')]);_0x3d4863[_0x13c8('0x2d')]=_['keys'](_0x416e4f[_0x13c8('0x2d')]);_0x3d4863['filters']=_[_0x13c8('0x2f')](_0x3d4863[_0x13c8('0x2c')],_0x3d4863[_0x13c8('0x2d')]);_0x54e0c8[_0x13c8('0x30')]=_[_0x13c8('0x2f')](_0x3d4863['model'],qs[_0x13c8('0x31')](_0x416e4f['query']['fields']));_0x54e0c8['attributes']=_0x54e0c8['attributes']['length']?_0x54e0c8[_0x13c8('0x30')]:_0x3d4863[_0x13c8('0x2c')];_0x54e0c8[_0x13c8('0x49')]=qs[_0x13c8('0x35')](_0x416e4f[_0x13c8('0x2d')][_0x13c8('0x35')]);_0x54e0c8[_0x13c8('0x37')]=qs['filters'](_['pick'](_0x416e4f[_0x13c8('0x2d')],_0x3d4863[_0x13c8('0x2e')]));if(_0x416e4f[_0x13c8('0x2d')][_0x13c8('0x36')]){_0x54e0c8[_0x13c8('0x37')]=_[_0x13c8('0x38')](_0x54e0c8[_0x13c8('0x37')],{'$or':_[_0x13c8('0x29')](_0x54e0c8['attributes'],function(_0x371410){var _0x326f90={};_0x326f90[_0x371410]={'$like':'%'+_0x416e4f['query'][_0x13c8('0x36')]+'%'};return _0x326f90;})});}_0x54e0c8=_[_0x13c8('0x38')]({},_0x54e0c8,_0x416e4f[_0x13c8('0x39')]);return _0x14a738[_0x13c8('0x47')](_0x54e0c8);}})[_0x13c8('0x27')](function(_0x1f823f){if(_0x1f823f){_0x55d353=_0x1f823f[_0x13c8('0x32')];if(!_0x416e4f[_0x13c8('0x2d')][_0x13c8('0x33')](_0x13c8('0x34'))){_0x54e0c8[_0x13c8('0x1d')]=qs[_0x13c8('0x1d')](_0x416e4f[_0x13c8('0x2d')][_0x13c8('0x1d')]);_0x54e0c8[_0x13c8('0x1f')]=qs[_0x13c8('0x1f')](_0x416e4f['query'][_0x13c8('0x1f')]);}return _0x14a738['getConfigurations'](_0x54e0c8);}})[_0x13c8('0x27')](function(_0xe861ad){if(_0xe861ad){return _0xe861ad?{'count':_0x55d353,'rows':_0xe861ad}:null;}})['then'](respondWithResult(_0x2f1e83,null))[_0x13c8('0x3f')](handleError(_0x2f1e83,null));};exports[_0x13c8('0x4a')]=function(_0x5539e8,_0x38fd82,_0x19330c){if(_0x5539e8[_0x13c8('0x45')]['id']){delete _0x5539e8[_0x13c8('0x45')]['id'];}return db[_0x13c8('0x3a')][_0x13c8('0x48')]({'where':{'id':_0x5539e8[_0x13c8('0x41')]['id']}})[_0x13c8('0x27')](handleEntityNotFound(_0x38fd82,null))[_0x13c8('0x27')](function(_0xee69b){if(_0xee69b){_0x5539e8[_0x13c8('0x45')]['AccountId']=_0xee69b['id'];_0x5539e8[_0x13c8('0x45')][_0x13c8('0x4b')]=integrations[_0x13c8('0x4c')](_0x5539e8[_0x13c8('0x45')][_0x13c8('0x4d')],_0x5539e8[_0x13c8('0x45')]['type']);_0x5539e8[_0x13c8('0x45')][_0x13c8('0x4e')]=integrations[_0x13c8('0x4f')](_0x5539e8['body'][_0x13c8('0x4d')],_0x5539e8[_0x13c8('0x45')][_0x13c8('0x50')]);return db[_0x13c8('0x51')][_0x13c8('0x44')](_0x5539e8[_0x13c8('0x45')],{'include':[{'model':db['ZendeskField'],'as':_0x13c8('0x4b')},{'model':db[_0x13c8('0x52')],'as':_0x13c8('0x4e')}]});}return null;})[_0x13c8('0x27')](respondWithResult(_0x38fd82,null))['catch'](handleError(_0x38fd82,null));};exports[_0x13c8('0x53')]=function(_0x2d552d,_0x258447,_0x308482){var _0x179a86='';return db[_0x13c8('0x3a')][_0x13c8('0x48')]({'where':{'id':_0x2d552d['params']['id']},'attributes':['id',_0x13c8('0x54'),_0x13c8('0x55'),_0x13c8('0x56'),'authType',_0x13c8('0x57')]})[_0x13c8('0x27')](handleEntityNotFound(_0x258447,null))['then'](function(_0x58728a){if(_0x58728a){_0x179a86=_0x58728a[_0x13c8('0x57')];var _0x5eb649=_0x179a86[_0x13c8('0x58')](-0x1);if(_0x5eb649==='/'){_0x179a86=_0x179a86['substring'](0x0,_0x179a86[_0x13c8('0x59')](_0x5eb649));}var _0x39aefc={'method':_0x13c8('0x5a'),'uri':util[_0x13c8('0x5b')](_0x13c8('0x5c'),_0x179a86,'ticket_fields'),'json':!![]};switch(_0x58728a[_0x13c8('0x5d')]){case _0x13c8('0x55'):_0x39aefc['headers']={'Authorization':util[_0x13c8('0x5b')](_0x13c8('0x5e'),new Buffer(util[_0x13c8('0x5b')](_0x13c8('0x5f'),_0x58728a[_0x13c8('0x54')],_0x58728a[_0x13c8('0x55')]))[_0x13c8('0x60')](_0x13c8('0x61')))};break;case _0x13c8('0x56'):_0x39aefc[_0x13c8('0x62')]={'Authorization':util['format'](_0x13c8('0x5e'),new Buffer(util[_0x13c8('0x5b')]('%s/token:%s',_0x58728a['username'],_0x58728a[_0x13c8('0x56')]))[_0x13c8('0x60')](_0x13c8('0x61')))};break;default:throw new db[(_0x13c8('0x63'))][(_0x13c8('0x64'))](_0x13c8('0x65'));}return rp(_0x39aefc);}})['then'](function(_0x18afe7){if(_0x18afe7){var _0x368f45=[_0x13c8('0x66'),_0x13c8('0x67'),_0x13c8('0x68'),'assignee'];_[_0x13c8('0x69')](_0x18afe7[_0x13c8('0x6a')],function(_0x564cc9){return _0x368f45[_0x13c8('0x6b')](_0x564cc9[_0x13c8('0x50')]);});return{'count':_0x18afe7['ticket_fields'][_0x13c8('0x32')],'rows':_['map'](_0x18afe7[_0x13c8('0x6a')],function(_0x5a4e0a){return{'id':_0x5a4e0a['id'],'name':_0x5a4e0a[_0x13c8('0x6c')]>0x7?_0x5a4e0a[_0x13c8('0x6d')]:_0x5a4e0a[_0x13c8('0x50')],'custom':_0x5a4e0a['position']>0x7?!![]:![],'options':_0x5a4e0a[_0x13c8('0x6e')]?_0x5a4e0a['system_field_options']:_0x5a4e0a['custom_field_options']?_0x5a4e0a[_0x13c8('0x6f')]:[]};})};}})[_0x13c8('0x27')](respondWithResult(_0x258447,null))[_0x13c8('0x3f')](function(_0x1e3097){var _0x4d6477=_0x2d552d['query'][_0x13c8('0x70')]?0x1f4:_0x1e3097['statusCode']||0x1f4;logger['error'](_0x13c8('0x71'),_0x13c8('0x53'),_0x4d6477,JSON[_0x13c8('0x72')](_0x1e3097));delete _0x1e3097[_0x13c8('0x28')];if(_0x4d6477===0x191){_0x4d6477=0x190;}_0x258447['status'](_0x4d6477)[_0x13c8('0x73')](_0x2d552d['query']['test']?{'message':_0x13c8('0x74'),'statusCode':_0x1e3097[_0x13c8('0x75')]}:_0x1e3097);});}; \ No newline at end of file +var _0xbc9d=['merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','find','create','update','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','getSubjects','channel','ZendeskField','Subjects','Descriptions','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../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','offset','undefined','limit','count','set','reject','save','then','destroy','error','stack','send','index','ZendeskAccount','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick'];(function(_0x1b9cd5,_0x103dc4){var _0x4c74ca=function(_0x460b5e){while(--_0x460b5e){_0x1b9cd5['push'](_0x1b9cd5['shift']());}};_0x4c74ca(++_0x103dc4);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x497d6d,_0xff7558){_0x497d6d=_0x497d6d-0x0;var _0x4a1d9a=_0xbc9d[_0x497d6d];return _0x4a1d9a;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];var integrations=require(_0xdbc9('0x19'));function respondWithStatusCode(_0x48bc83,_0x567e71){_0x567e71=_0x567e71||0xcc;return function(_0x3d0fdd){if(_0x3d0fdd){return _0x48bc83[_0xdbc9('0x1a')](_0x567e71);}return _0x48bc83[_0xdbc9('0x1b')](_0x567e71)[_0xdbc9('0x1c')]();};}function respondWithResult(_0x53495d,_0x4a9dcb){_0x4a9dcb=_0x4a9dcb||0xc8;return function(_0x2b7bd){if(_0x2b7bd){return _0x53495d[_0xdbc9('0x1b')](_0x4a9dcb)[_0xdbc9('0x1d')](_0x2b7bd);}};}function respondWithFilteredResult(_0x4c7b4f,_0x1b4616){return function(_0x1abee8){if(_0x1abee8){var _0x4fdb81=typeof _0x1b4616[_0xdbc9('0x1e')]===_0xdbc9('0x1f')&&typeof _0x1b4616[_0xdbc9('0x20')]===_0xdbc9('0x1f');var _0x1f22f4=_0x1abee8[_0xdbc9('0x21')];var _0x9f343d=_0x4fdb81?0x0:_0x1b4616[_0xdbc9('0x1e')];var _0x2ad952=_0x4fdb81?_0x1abee8[_0xdbc9('0x21')]:_0x1b4616['offset']+_0x1b4616[_0xdbc9('0x20')];var _0x497be2;if(_0x2ad952>=_0x1f22f4){_0x2ad952=_0x1f22f4;_0x497be2=0xc8;}else{_0x497be2=0xce;}_0x4c7b4f[_0xdbc9('0x1b')](_0x497be2);return _0x4c7b4f[_0xdbc9('0x22')]('Content-Range',_0x9f343d+'-'+_0x2ad952+'/'+_0x1f22f4)[_0xdbc9('0x1d')](_0x1abee8);}return null;};}function patchUpdates(_0x5367dc){return function(_0x569f32){try{jsonpatch['apply'](_0x569f32,_0x5367dc,!![]);}catch(_0x4f3b5d){return BPromise[_0xdbc9('0x23')](_0x4f3b5d);}return _0x569f32[_0xdbc9('0x24')]();};}function saveUpdates(_0x570ad9,_0x16dcf7){return function(_0x20563e){if(_0x20563e){return _0x20563e['update'](_0x570ad9)[_0xdbc9('0x25')](function(_0x6b788){return _0x6b788;});}return null;};}function removeEntity(_0x1b1c0d,_0x119230){return function(_0x3400e7){if(_0x3400e7){return _0x3400e7[_0xdbc9('0x26')]()[_0xdbc9('0x25')](function(){_0x1b1c0d[_0xdbc9('0x1b')](0xcc)[_0xdbc9('0x1c')]();});}};}function handleEntityNotFound(_0x4a868b,_0x550bef){return function(_0xe309ae){if(!_0xe309ae){_0x4a868b[_0xdbc9('0x1a')](0x194);}return _0xe309ae;};}function handleError(_0x1053ca,_0x24fdec){_0x24fdec=_0x24fdec||0x1f4;return function(_0x50c3ee){logger[_0xdbc9('0x27')](_0x50c3ee[_0xdbc9('0x28')]);if(_0x50c3ee['name']){delete _0x50c3ee['name'];}_0x1053ca[_0xdbc9('0x1b')](_0x24fdec)[_0xdbc9('0x29')](_0x50c3ee);};}exports[_0xdbc9('0x2a')]=function(_0x59bfd2,_0x13a432){var _0x539e57={},_0x561f8e={},_0x210a40={'count':0x0,'rows':[]};var _0x49da36=_['map'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')],function(_0x1cb557){return{'name':_0x1cb557['fieldName'],'type':_0x1cb557[_0xdbc9('0x2d')][_0xdbc9('0x2e')]};});_0x561f8e['model']=_['map'](_0x49da36,_0xdbc9('0x2f'));_0x561f8e[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x59bfd2[_0xdbc9('0x30')]);_0x561f8e[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],_0x561f8e['query']);_0x539e57[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],qs[_0xdbc9('0x36')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x539e57['attributes']=_0x539e57[_0xdbc9('0x35')]['length']?_0x539e57['attributes']:_0x561f8e['model'];if(!_0x59bfd2['query']['hasOwnProperty'](_0xdbc9('0x37'))){_0x539e57[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x59bfd2['query'][_0xdbc9('0x20')]);_0x539e57[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x1e')]);}_0x539e57[_0xdbc9('0x38')]=qs['sort'](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x39')]);_0x539e57[_0xdbc9('0x3a')]=qs['filters'](_[_0xdbc9('0x3b')](_0x59bfd2[_0xdbc9('0x30')],_0x561f8e[_0xdbc9('0x32')]),_0x49da36);if(_0x59bfd2[_0xdbc9('0x30')]['filter']){_0x539e57['where']=_[_0xdbc9('0x3c')](_0x539e57[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x49da36,function(_0x1ef970){if(_0x1ef970['type']!==_0xdbc9('0x3e')){var _0x3827be={};_0x3827be[_0x1ef970[_0xdbc9('0x2f')]]={'$like':'%'+_0x59bfd2['query'][_0xdbc9('0x3f')]+'%'};return _0x3827be;}})});}_0x539e57=_[_0xdbc9('0x3c')]({},_0x539e57,_0x59bfd2[_0xdbc9('0x40')]);var _0x523c79={'where':_0x539e57[_0xdbc9('0x3a')]};return db[_0xdbc9('0x2b')]['count'](_0x523c79)['then'](function(_0xfc34d5){_0x210a40[_0xdbc9('0x21')]=_0xfc34d5;if(_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x41')]){_0x539e57['include']=[{'all':!![]}];}return db[_0xdbc9('0x2b')][_0xdbc9('0x42')](_0x539e57);})['then'](function(_0x8445b8){_0x210a40[_0xdbc9('0x43')]=_0x8445b8;return _0x210a40;})['then'](respondWithFilteredResult(_0x13a432,_0x539e57))[_0xdbc9('0x44')](handleError(_0x13a432,null));};exports[_0xdbc9('0x45')]=function(_0x2adb23,_0x3415c3){var _0x3ed4de={'raw':![],'where':{'id':_0x2adb23[_0xdbc9('0x46')]['id']}},_0x1cd538={};_0x1cd538['model']=_['keys'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')]);_0x1cd538[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x2adb23[_0xdbc9('0x30')]);_0x1cd538[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x1cd538[_0xdbc9('0x34')],_0x1cd538[_0xdbc9('0x30')]);_0x3ed4de[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x1cd538['model'],qs['fields'](_0x2adb23[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x3ed4de[_0xdbc9('0x35')]=_0x3ed4de[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x3ed4de[_0xdbc9('0x35')]:_0x1cd538[_0xdbc9('0x34')];if(_0x2adb23[_0xdbc9('0x30')]['includeAll']){_0x3ed4de['include']=[{'all':!![]}];}_0x3ed4de=_[_0xdbc9('0x3c')]({},_0x3ed4de,_0x2adb23[_0xdbc9('0x40')]);return db[_0xdbc9('0x2b')][_0xdbc9('0x48')](_0x3ed4de)[_0xdbc9('0x25')](handleEntityNotFound(_0x3415c3,null))[_0xdbc9('0x25')](respondWithResult(_0x3415c3,null))[_0xdbc9('0x44')](handleError(_0x3415c3,null));};exports[_0xdbc9('0x49')]=function(_0x43e3ec,_0x589557){return db[_0xdbc9('0x2b')][_0xdbc9('0x49')](_0x43e3ec['body'],{})['then'](respondWithResult(_0x589557,0xc9))[_0xdbc9('0x44')](handleError(_0x589557,null));};exports[_0xdbc9('0x4a')]=function(_0x133a13,_0x49a55c){if(_0x133a13[_0xdbc9('0x4b')]['id']){delete _0x133a13[_0xdbc9('0x4b')]['id'];}return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x133a13['params']['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x49a55c,null))[_0xdbc9('0x25')](saveUpdates(_0x133a13[_0xdbc9('0x4b')],null))[_0xdbc9('0x25')](respondWithResult(_0x49a55c,null))['catch'](handleError(_0x49a55c,null));};exports[_0xdbc9('0x26')]=function(_0x36c70e,_0x3f49b7){return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x36c70e[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3f49b7,null))[_0xdbc9('0x25')](removeEntity(_0x3f49b7,null))['catch'](handleError(_0x3f49b7,null));};exports[_0xdbc9('0x4c')]=function(_0x4d09e1,_0x3f493e,_0x4279bc){var _0x53771a={};var _0x561737={};var _0xc7335d;var _0x4b55df;return db[_0xdbc9('0x2b')][_0xdbc9('0x4d')]({'where':{'id':_0x4d09e1[_0xdbc9('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f493e,null))[_0xdbc9('0x25')](function(_0x1c52e6){if(_0x1c52e6){_0xc7335d=_0x1c52e6;_0x561737[_0xdbc9('0x34')]=_[_0xdbc9('0x31')](db[_0xdbc9('0x4e')][_0xdbc9('0x2c')]);_0x561737[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x4d09e1['query']);_0x561737['filters']=_['intersection'](_0x561737[_0xdbc9('0x34')],_0x561737[_0xdbc9('0x30')]);_0x53771a[_0xdbc9('0x35')]=_['intersection'](_0x561737['model'],qs[_0xdbc9('0x36')](_0x4d09e1[_0xdbc9('0x30')]['fields']));_0x53771a['attributes']=_0x53771a[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x53771a[_0xdbc9('0x35')]:_0x561737[_0xdbc9('0x34')];_0x53771a[_0xdbc9('0x38')]=qs[_0xdbc9('0x39')](_0x4d09e1['query'][_0xdbc9('0x39')]);_0x53771a[_0xdbc9('0x3a')]=qs[_0xdbc9('0x32')](_['pick'](_0x4d09e1[_0xdbc9('0x30')],_0x561737[_0xdbc9('0x32')]));if(_0x4d09e1[_0xdbc9('0x30')]['filter']){_0x53771a[_0xdbc9('0x3a')]=_['merge'](_0x53771a[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x53771a[_0xdbc9('0x35')],function(_0x26ed1c){var _0x148061={};_0x148061[_0x26ed1c]={'$like':'%'+_0x4d09e1[_0xdbc9('0x30')]['filter']+'%'};return _0x148061;})});}_0x53771a=_[_0xdbc9('0x3c')]({},_0x53771a,_0x4d09e1['options']);return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})[_0xdbc9('0x25')](function(_0x53fcd6){if(_0x53fcd6){_0x4b55df=_0x53fcd6[_0xdbc9('0x47')];if(!_0x4d09e1[_0xdbc9('0x30')]['hasOwnProperty']('nolimit')){_0x53771a[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x4d09e1[_0xdbc9('0x30')]['limit']);_0x53771a[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x4d09e1['query'][_0xdbc9('0x1e')]);}return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})['then'](function(_0x4876f9){if(_0x4876f9){return _0x4876f9?{'count':_0x4b55df,'rows':_0x4876f9}:null;}})[_0xdbc9('0x25')](respondWithResult(_0x3f493e,null))[_0xdbc9('0x44')](handleError(_0x3f493e,null));};exports[_0xdbc9('0x4f')]=function(_0xa8b4d9,_0x3e93d3,_0x14cbf4){if(_0xa8b4d9[_0xdbc9('0x4b')]['id']){delete _0xa8b4d9[_0xdbc9('0x4b')]['id'];}return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0xa8b4d9[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3e93d3,null))[_0xdbc9('0x25')](function(_0x38f7da){if(_0x38f7da){_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x50')]=_0x38f7da['id'];_0xa8b4d9[_0xdbc9('0x4b')]['Subjects']=integrations[_0xdbc9('0x51')](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9['body'][_0xdbc9('0x2d')]);_0xa8b4d9[_0xdbc9('0x4b')]['Descriptions']=integrations['getDescriptions'](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x2d')]);return db['ZendeskConfiguration'][_0xdbc9('0x49')](_0xa8b4d9[_0xdbc9('0x4b')],{'include':[{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x54')},{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x55')}]});}return null;})[_0xdbc9('0x25')](respondWithResult(_0x3e93d3,null))[_0xdbc9('0x44')](handleError(_0x3e93d3,null));};exports[_0xdbc9('0x56')]=function(_0x5e6522,_0x2787d9,_0x2c3223){var _0x511778='';return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0x5e6522[_0xdbc9('0x46')]['id']},'attributes':['id',_0xdbc9('0x57'),_0xdbc9('0x58'),_0xdbc9('0x59'),_0xdbc9('0x5a'),_0xdbc9('0x5b')]})['then'](handleEntityNotFound(_0x2787d9,null))[_0xdbc9('0x25')](function(_0x19af46){if(_0x19af46){_0x511778=_0x19af46[_0xdbc9('0x5b')];var _0x4a412e=_0x511778[_0xdbc9('0x5c')](-0x1);if(_0x4a412e==='/'){_0x511778=_0x511778[_0xdbc9('0x5d')](0x0,_0x511778[_0xdbc9('0x5e')](_0x4a412e));}var _0x2b4905={'method':_0xdbc9('0x5f'),'uri':util[_0xdbc9('0x60')](_0xdbc9('0x61'),_0x511778,_0xdbc9('0x62')),'json':!![]};switch(_0x19af46[_0xdbc9('0x5a')]){case _0xdbc9('0x58'):_0x2b4905[_0xdbc9('0x63')]={'Authorization':util[_0xdbc9('0x60')]('Basic\x20%s',new Buffer(util['format'](_0xdbc9('0x64'),_0x19af46['username'],_0x19af46['password']))[_0xdbc9('0x65')](_0xdbc9('0x66')))};break;case _0xdbc9('0x59'):_0x2b4905['headers']={'Authorization':util[_0xdbc9('0x60')](_0xdbc9('0x67'),new Buffer(util[_0xdbc9('0x60')]('%s/token:%s',_0x19af46[_0xdbc9('0x57')],_0x19af46[_0xdbc9('0x59')]))['toString'](_0xdbc9('0x66')))};break;default:throw new db[(_0xdbc9('0x68'))][(_0xdbc9('0x69'))](_0xdbc9('0x6a'));}return rp(_0x2b4905);}})[_0xdbc9('0x25')](function(_0x501754){if(_0x501754){var _0x4f984b=[_0xdbc9('0x6b'),_0xdbc9('0x6c'),'group',_0xdbc9('0x6d')];_[_0xdbc9('0x6e')](_0x501754[_0xdbc9('0x62')],function(_0x5802fc){return _0x4f984b[_0xdbc9('0x6f')](_0x5802fc[_0xdbc9('0x2d')]);});return{'count':_0x501754[_0xdbc9('0x62')][_0xdbc9('0x47')],'rows':_[_0xdbc9('0x3d')](_0x501754[_0xdbc9('0x62')],function(_0x1b053a){return{'id':_0x1b053a['id'],'name':_0x1b053a[_0xdbc9('0x70')]>0x7?_0x1b053a['title']:_0x1b053a[_0xdbc9('0x2d')],'custom':_0x1b053a[_0xdbc9('0x70')]>0x7?!![]:![],'options':_0x1b053a[_0xdbc9('0x71')]?_0x1b053a[_0xdbc9('0x71')]:_0x1b053a['custom_field_options']?_0x1b053a[_0xdbc9('0x72')]:[]};})};}})['then'](respondWithResult(_0x2787d9,null))['catch'](function(_0x34ebeb){var _0x3400d0=_0x5e6522['query'][_0xdbc9('0x73')]?0x1f4:_0x34ebeb[_0xdbc9('0x74')]||0x1f4;logger[_0xdbc9('0x27')](_0xdbc9('0x75'),_0xdbc9('0x56'),_0x3400d0,JSON[_0xdbc9('0x76')](_0x34ebeb));delete _0x34ebeb[_0xdbc9('0x2f')];if(_0x3400d0===0x191){_0x3400d0=0x190;}_0x2787d9['status'](_0x3400d0)['send'](_0x5e6522[_0xdbc9('0x30')][_0xdbc9('0x73')]?{'message':_0xdbc9('0x77'),'statusCode':_0x34ebeb['statusCode']}:_0x34ebeb);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index dc20971..d60a97f 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 _0x2c02=['bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','../../config/logger','api','moment'];(function(_0x17db49,_0x29b4d3){var _0xd9ba3b=function(_0x1c937d){while(--_0x1c937d){_0x17db49['push'](_0x17db49['shift']());}};_0xd9ba3b(++_0x29b4d3);}(_0x2c02,0x99));var _0x22c0=function(_0x140be6,_0x3bf7ba){_0x140be6=_0x140be6-0x0;var _0x23e23=_0x2c02[_0x140be6];return _0x23e23;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x22c0('0x0'))(_0x22c0('0x1'));var moment=require(_0x22c0('0x2'));var BPromise=require(_0x22c0('0x3'));var rp=require(_0x22c0('0x4'));var fs=require('fs');var path=require(_0x22c0('0x5'));var rimraf=require(_0x22c0('0x6'));var config=require('../../config/environment');var attributes=require(_0x22c0('0x7'));var integrations=require(_0x22c0('0x8'));module[_0x22c0('0x9')]=function(_0x520852,_0x235108){return _0x520852['define'](_0x22c0('0xa'),attributes,{'tableName':_0x22c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fdc=['path','rimraf','./intZendeskAccount.attributes','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment','bluebird'];(function(_0x1569fc,_0x115095){var _0x277783=function(_0x49e9c1){while(--_0x49e9c1){_0x1569fc['push'](_0x1569fc['shift']());}};_0x277783(++_0x115095);}(_0x7fdc,0x1cf));var _0xc7fd=function(_0x37845e,_0x7dde25){_0x37845e=_0x37845e-0x0;var _0x105579=_0x7fdc[_0x37845e];return _0x105579;};'use strict';var _=require(_0xc7fd('0x0'));var util=require(_0xc7fd('0x1'));var logger=require('../../config/logger')(_0xc7fd('0x2'));var moment=require(_0xc7fd('0x3'));var BPromise=require(_0xc7fd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc7fd('0x5'));var rimraf=require(_0xc7fd('0x6'));var config=require('../../config/environment');var attributes=require(_0xc7fd('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xc7fd('0x8')]=function(_0xb23375,_0x1c190d){return _0xb23375[_0xc7fd('0x9')](_0xc7fd('0xa'),attributes,{'tableName':_0xc7fd('0xb'),'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 1bff9f4..c4fd3a4 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 _0x7f9d=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','include','map','model','ShowZendeskAccount','find','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','then','info','request\x20sent','debug'];(function(_0xc9cde0,_0x2427e6){var _0x493ca5=function(_0x78d7d0){while(--_0x78d7d0){_0xc9cde0['push'](_0xc9cde0['shift']());}};_0x493ca5(++_0x2427e6);}(_0x7f9d,0xb9));var _0xd7f9=function(_0x212d13,_0x488ecb){_0x212d13=_0x212d13-0x0;var _0xb4d1d=_0x7f9d[_0x212d13];return _0xb4d1d;};'use strict';var _=require(_0xd7f9('0x0'));var util=require('util');var moment=require(_0xd7f9('0x1'));var BPromise=require(_0xd7f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7f9('0x3'));var db=require(_0xd7f9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd7f9('0x5'))('rpc');var config=require(_0xd7f9('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd7f9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d240b,_0x1a8d7c,_0x5427a6){return new BPromise(function(_0x480c10,_0x117842){return client[_0xd7f9('0x8')](_0x5d240b,_0x5427a6)[_0xd7f9('0x9')](function(_0x3e7129){logger[_0xd7f9('0xa')]('ZendeskAccount,\x20%s,\x20%s',_0x1a8d7c,_0xd7f9('0xb'));logger[_0xd7f9('0xc')](_0xd7f9('0xd'),_0x1a8d7c,_0xd7f9('0xb'),JSON[_0xd7f9('0xe')](_0x3e7129));if(_0x3e7129[_0xd7f9('0xf')]){if(_0x3e7129[_0xd7f9('0xf')][_0xd7f9('0x10')]===0x1f4){logger[_0xd7f9('0xf')](_0xd7f9('0x11'),_0x1a8d7c,_0x3e7129[_0xd7f9('0xf')]['message']);return _0x117842(_0x3e7129[_0xd7f9('0xf')][_0xd7f9('0x12')]);}logger[_0xd7f9('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x1a8d7c,_0x3e7129[_0xd7f9('0xf')][_0xd7f9('0x12')]);return _0x480c10(_0x3e7129[_0xd7f9('0xf')]['message']);}else{logger[_0xd7f9('0xa')](_0xd7f9('0x11'),_0x1a8d7c,_0xd7f9('0xb'));_0x480c10(_0x3e7129[_0xd7f9('0x13')][_0xd7f9('0x12')]);}})[_0xd7f9('0x14')](function(_0x37d31a){logger[_0xd7f9('0xf')](_0xd7f9('0x11'),_0x1a8d7c,_0x37d31a);_0x117842(_0x37d31a);});});}exports[_0xd7f9('0x15')]=function(_0x43d59b){var _0x40b01a=this;return new Promise(function(_0x2ce6ad,_0x1a3b1c){return db[_0xd7f9('0x16')][_0xd7f9('0x17')]({'raw':_0x43d59b['options']?_0x43d59b[_0xd7f9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x43d59b[_0xd7f9('0x18')]?_0x43d59b[_0xd7f9('0x18')][_0xd7f9('0x19')]||null:null,'attributes':_0x43d59b[_0xd7f9('0x18')]?_0x43d59b['options'][_0xd7f9('0x1a')]||null:null,'limit':_0x43d59b['options']?_0x43d59b[_0xd7f9('0x18')]['limit']||null:null,'include':_0x43d59b[_0xd7f9('0x18')]?_0x43d59b[_0xd7f9('0x18')][_0xd7f9('0x1b')]?_[_0xd7f9('0x1c')](_0x43d59b['options']['include'],function(_0x113ef2){return{'model':db[_0x113ef2[_0xd7f9('0x1d')]],'as':_0x113ef2['as'],'attributes':_0x113ef2[_0xd7f9('0x1a')],'include':_0x113ef2[_0xd7f9('0x1b')]?_['map'](_0x113ef2[_0xd7f9('0x1b')],function(_0x3e9273){return{'model':db[_0x3e9273[_0xd7f9('0x1d')]],'as':_0x3e9273['as'],'attributes':_0x3e9273[_0xd7f9('0x1a')],'include':_0x3e9273[_0xd7f9('0x1b')]?_[_0xd7f9('0x1c')](_0x3e9273[_0xd7f9('0x1b')],function(_0x3e42f6){return{'model':db[_0x3e42f6['model']],'as':_0x3e42f6['as'],'attributes':_0x3e42f6['attributes']};}):[]};}):[]};}):[]:[]})[_0xd7f9('0x9')](function(_0x8d61bd){logger[_0xd7f9('0xa')](_0xd7f9('0x15'),_0x43d59b);logger['debug']('GetZendeskAccount',_0x43d59b,JSON['stringify'](_0x8d61bd));_0x2ce6ad(_0x8d61bd);})['catch'](function(_0x2282c4){logger[_0xd7f9('0xf')](_0xd7f9('0x15'),_0x2282c4[_0xd7f9('0x12')],_0x43d59b);_0x1a3b1c(_0x40b01a['error'](0x1f4,_0x2282c4['message']));});});};exports[_0xd7f9('0x1e')]=function(_0x4cdd07){var _0x3dcc80=this;return new Promise(function(_0x53386c,_0x36c2e9){return db[_0xd7f9('0x16')][_0xd7f9('0x1f')]({'raw':_0x4cdd07[_0xd7f9('0x18')]?_0x4cdd07[_0xd7f9('0x18')][_0xd7f9('0x20')]===undefined?!![]:![]:!![],'where':_0x4cdd07[_0xd7f9('0x18')]?_0x4cdd07[_0xd7f9('0x18')][_0xd7f9('0x19')]||null:null,'attributes':_0x4cdd07[_0xd7f9('0x18')]?_0x4cdd07[_0xd7f9('0x18')]['attributes']||null:null,'include':_0x4cdd07[_0xd7f9('0x18')]?_0x4cdd07[_0xd7f9('0x18')]['include']?_['map'](_0x4cdd07[_0xd7f9('0x18')][_0xd7f9('0x1b')],function(_0x147312){return{'model':db[_0x147312['model']],'as':_0x147312['as'],'attributes':_0x147312['attributes'],'include':_0x147312[_0xd7f9('0x1b')]?_[_0xd7f9('0x1c')](_0x147312[_0xd7f9('0x1b')],function(_0x49d0a8){return{'model':db[_0x49d0a8[_0xd7f9('0x1d')]],'as':_0x49d0a8['as'],'attributes':_0x49d0a8[_0xd7f9('0x1a')],'include':_0x49d0a8[_0xd7f9('0x1b')]?_[_0xd7f9('0x1c')](_0x49d0a8[_0xd7f9('0x1b')],function(_0x9b5b98){return{'model':db[_0x9b5b98['model']],'as':_0x9b5b98['as'],'attributes':_0x9b5b98[_0xd7f9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd7f9('0x9')](function(_0x4779ce){logger[_0xd7f9('0xa')](_0xd7f9('0x1e'),_0x4cdd07);logger[_0xd7f9('0xc')]('ShowZendeskAccount',_0x4cdd07,JSON[_0xd7f9('0xe')](_0x4779ce));_0x53386c(_0x4779ce);})[_0xd7f9('0x14')](function(_0x3f74b9){logger[_0xd7f9('0xf')](_0xd7f9('0x1e'),_0x3f74b9[_0xd7f9('0x12')],_0x4cdd07);_0x36c2e9(_0x3dcc80[_0xd7f9('0xf')](0x1f4,_0x3f74b9[_0xd7f9('0x12')]));});});}; \ No newline at end of file +var _0x9b06=['ZendeskAccount,\x20%s,\x20%s','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','info','ShowZendeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error'];(function(_0x43fc59,_0x4f2c63){var _0x2306e2=function(_0x10ee79){while(--_0x10ee79){_0x43fc59['push'](_0x43fc59['shift']());}};_0x2306e2(++_0x4f2c63);}(_0x9b06,0x193));var _0x69b0=function(_0x20f289,_0x3a355b){_0x20f289=_0x20f289-0x0;var _0x511cd3=_0x9b06[_0x20f289];return _0x511cd3;};'use strict';var _=require(_0x69b0('0x0'));var util=require(_0x69b0('0x1'));var moment=require(_0x69b0('0x2'));var BPromise=require('bluebird');var rs=require(_0x69b0('0x3'));var fs=require('fs');var Redis=require(_0x69b0('0x4'));var db=require(_0x69b0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x69b0('0x6'))(_0x69b0('0x7'));var config=require(_0x69b0('0x8'));var jayson=require(_0x69b0('0x9'));var client=jayson[_0x69b0('0xa')][_0x69b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x551b2e,_0x3f880b,_0x53a5a1){return new BPromise(function(_0x9f0d39,_0x24ba5d){return client[_0x69b0('0xc')](_0x551b2e,_0x53a5a1)['then'](function(_0x4d16f2){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x3f880b,_0x69b0('0xd'));logger[_0x69b0('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x3f880b,_0x69b0('0xd'),JSON[_0x69b0('0xf')](_0x4d16f2));if(_0x4d16f2[_0x69b0('0x10')]){if(_0x4d16f2[_0x69b0('0x10')]['code']===0x1f4){logger[_0x69b0('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x3f880b,_0x4d16f2[_0x69b0('0x10')]['message']);return _0x24ba5d(_0x4d16f2[_0x69b0('0x10')]['message']);}logger[_0x69b0('0x10')](_0x69b0('0x11'),_0x3f880b,_0x4d16f2['error'][_0x69b0('0x12')]);return _0x9f0d39(_0x4d16f2[_0x69b0('0x10')][_0x69b0('0x12')]);}else{logger['info'](_0x69b0('0x11'),_0x3f880b,_0x69b0('0xd'));_0x9f0d39(_0x4d16f2['result']['message']);}})[_0x69b0('0x13')](function(_0x2ede23){logger[_0x69b0('0x10')](_0x69b0('0x11'),_0x3f880b,_0x2ede23);_0x24ba5d(_0x2ede23);});});}exports[_0x69b0('0x14')]=function(_0x506d20){var _0x3eb2c5=this;return new Promise(function(_0x4e1041,_0x4e5998){return db[_0x69b0('0x15')][_0x69b0('0x16')]({'raw':_0x506d20[_0x69b0('0x17')]?_0x506d20[_0x69b0('0x17')][_0x69b0('0x18')]===undefined?!![]:![]:!![],'where':_0x506d20['options']?_0x506d20[_0x69b0('0x17')][_0x69b0('0x19')]||null:null,'attributes':_0x506d20[_0x69b0('0x17')]?_0x506d20['options'][_0x69b0('0x1a')]||null:null,'limit':_0x506d20[_0x69b0('0x17')]?_0x506d20['options'][_0x69b0('0x1b')]||null:null,'include':_0x506d20[_0x69b0('0x17')]?_0x506d20[_0x69b0('0x17')]['include']?_[_0x69b0('0x1c')](_0x506d20[_0x69b0('0x17')][_0x69b0('0x1d')],function(_0x5d167a){return{'model':db[_0x5d167a[_0x69b0('0x1e')]],'as':_0x5d167a['as'],'attributes':_0x5d167a[_0x69b0('0x1a')],'include':_0x5d167a[_0x69b0('0x1d')]?_[_0x69b0('0x1c')](_0x5d167a['include'],function(_0x17a95a){return{'model':db[_0x17a95a['model']],'as':_0x17a95a['as'],'attributes':_0x17a95a[_0x69b0('0x1a')],'include':_0x17a95a[_0x69b0('0x1d')]?_[_0x69b0('0x1c')](_0x17a95a[_0x69b0('0x1d')],function(_0x228cca){return{'model':db[_0x228cca[_0x69b0('0x1e')]],'as':_0x228cca['as'],'attributes':_0x228cca[_0x69b0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x69b0('0x1f')](function(_0x388aa4){logger[_0x69b0('0x20')](_0x69b0('0x14'),_0x506d20);logger[_0x69b0('0xe')]('GetZendeskAccount',_0x506d20,JSON['stringify'](_0x388aa4));_0x4e1041(_0x388aa4);})[_0x69b0('0x13')](function(_0x7303f4){logger[_0x69b0('0x10')](_0x69b0('0x14'),_0x7303f4[_0x69b0('0x12')],_0x506d20);_0x4e5998(_0x3eb2c5['error'](0x1f4,_0x7303f4['message']));});});};exports[_0x69b0('0x21')]=function(_0x4a03f2){var _0x15f31f=this;return new Promise(function(_0x4e6d9f,_0x5ed7e0){return db[_0x69b0('0x15')][_0x69b0('0x22')]({'raw':_0x4a03f2[_0x69b0('0x17')]?_0x4a03f2[_0x69b0('0x17')][_0x69b0('0x18')]===undefined?!![]:![]:!![],'where':_0x4a03f2[_0x69b0('0x17')]?_0x4a03f2[_0x69b0('0x17')]['where']||null:null,'attributes':_0x4a03f2['options']?_0x4a03f2[_0x69b0('0x17')][_0x69b0('0x1a')]||null:null,'include':_0x4a03f2[_0x69b0('0x17')]?_0x4a03f2[_0x69b0('0x17')]['include']?_[_0x69b0('0x1c')](_0x4a03f2[_0x69b0('0x17')][_0x69b0('0x1d')],function(_0x5ab892){return{'model':db[_0x5ab892[_0x69b0('0x1e')]],'as':_0x5ab892['as'],'attributes':_0x5ab892[_0x69b0('0x1a')],'include':_0x5ab892[_0x69b0('0x1d')]?_[_0x69b0('0x1c')](_0x5ab892['include'],function(_0x39c556){return{'model':db[_0x39c556[_0x69b0('0x1e')]],'as':_0x39c556['as'],'attributes':_0x39c556[_0x69b0('0x1a')],'include':_0x39c556[_0x69b0('0x1d')]?_[_0x69b0('0x1c')](_0x39c556[_0x69b0('0x1d')],function(_0x221b77){return{'model':db[_0x221b77[_0x69b0('0x1e')]],'as':_0x221b77['as'],'attributes':_0x221b77[_0x69b0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x69b0('0x1f')](function(_0x6cf43d){logger[_0x69b0('0x20')]('ShowZendeskAccount',_0x4a03f2);logger[_0x69b0('0xe')]('ShowZendeskAccount',_0x4a03f2,JSON['stringify'](_0x6cf43d));_0x4e6d9f(_0x6cf43d);})[_0x69b0('0x13')](function(_0x44166e){logger[_0x69b0('0x10')]('ShowZendeskAccount',_0x44166e[_0x69b0('0x12')],_0x4a03f2);_0x5ed7e0(_0x15f31f['error'](0x1f4,_0x44166e[_0x69b0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index c907b32..7dc254a 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 _0x91a7=['util','path','connect-timeout','Router','../../components/auth/service','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','put','update','destroy','exports'];(function(_0x1d4773,_0x574bce){var _0x490c91=function(_0x47214e){while(--_0x47214e){_0x1d4773['push'](_0x1d4773['shift']());}};_0x490c91(++_0x574bce);}(_0x91a7,0xe7));var _0x791a=function(_0x4a8d6e,_0x45b402){_0x4a8d6e=_0x4a8d6e-0x0;var _0x4d679b=_0x91a7[_0x4a8d6e];return _0x4d679b;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['show']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/subjects',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['get'](_0x791a('0xd'),auth[_0x791a('0x9')](),controller[_0x791a('0xe')]);router[_0x791a('0x6')](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['getTags']);router['post']('/',auth[_0x791a('0x9')](),controller[_0x791a('0x10')]);router['post'](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['setTags']);router[_0x791a('0x11')](_0x791a('0x8'),auth[_0x791a('0x9')](),controller[_0x791a('0x12')]);router['delete'](_0x791a('0x8'),auth['isAuthenticated'](),controller[_0x791a('0x13')]);module[_0x791a('0x14')]=router; \ No newline at end of file +var _0x36ee=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','update','delete','destroy','exports','path','express'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x8')](_0xe36e('0x13'),auth[_0xe36e('0x9')](),controller['getTags']);router[_0xe36e('0x14')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x14')]('/:id/tags',auth[_0xe36e('0x9')](),controller['setTags']);router['put'](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x16')]);router[_0xe36e('0x17')](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x18')]);module[_0xe36e('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index bee973b..de0f04f 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 _0xf4d3=['STRING','sequelize'];(function(_0x17bcdb,_0x8b7b16){var _0x4fd91a=function(_0x5d57fc){while(--_0x5d57fc){_0x17bcdb['push'](_0x17bcdb['shift']());}};_0x4fd91a(++_0x8b7b16);}(_0xf4d3,0x67));var _0x3f4d=function(_0x5407e5,_0x40dc3c){_0x5407e5=_0x5407e5-0x0;var _0x3ae6fd=_0xf4d3[_0x5407e5];return _0x3ae6fd;};'use strict';var Sequelize=require(_0x3f4d('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f4d('0x1')]},'description':{'type':Sequelize[_0x3f4d('0x1')]}}; \ No newline at end of file +var _0xfe01=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe01,0xfe));var _0x1fe0=function(_0x4bdc40,_0x5b9dc9){_0x4bdc40=_0x4bdc40-0x0;var _0x4dbd59=_0xfe01[_0x4bdc40];return _0x4dbd59;};'use strict';var Sequelize=require(_0x1fe0('0x0'));module[_0x1fe0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1fe0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index b7caa4e..61b578a 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 _0x04ed=['../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','ZendeskConfiguration','fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','includeAll','rows','show','params','keys','length','include','options','find','catch','body','getFields','ZendeskField','rawAttributes','nolimit','getSubjects','findOne','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0x04ed,0x1e5));var _0xd04e=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0x04ed[_0x3fe6df];return _0x372a0e;};'use strict';var emlformat=require(_0xd04e('0x0'));var rimraf=require(_0xd04e('0x1'));var zipdir=require(_0xd04e('0x2'));var jsonpatch=require(_0xd04e('0x3'));var rp=require(_0xd04e('0x4'));var moment=require('moment');var BPromise=require(_0xd04e('0x5'));var Mustache=require(_0xd04e('0x6'));var util=require(_0xd04e('0x7'));var path=require(_0xd04e('0x8'));var sox=require(_0xd04e('0x9'));var csv=require('to-csv');var ejs=require(_0xd04e('0xa'));var fs=require('fs');var fs_extra=require(_0xd04e('0xb'));var _=require(_0xd04e('0xc'));var squel=require(_0xd04e('0xd'));var crypto=require('crypto');var jsforce=require(_0xd04e('0xe'));var deskjs=require(_0xd04e('0xf'));var toCsv=require(_0xd04e('0x10'));var querystring=require(_0xd04e('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd04e('0x12'));var qs=require(_0xd04e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd04e('0x14'));var logger=require('../../config/logger')(_0xd04e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd04e('0x16'));var db=require(_0xd04e('0x17'))['db'];function respondWithStatusCode(_0x2fa5e1,_0x3d42d2){_0x3d42d2=_0x3d42d2||0xcc;return function(_0x1da1e7){if(_0x1da1e7){return _0x2fa5e1[_0xd04e('0x18')](_0x3d42d2);}return _0x2fa5e1[_0xd04e('0x19')](_0x3d42d2)['end']();};}function respondWithResult(_0x5c8607,_0x5dac04){_0x5dac04=_0x5dac04||0xc8;return function(_0x6dc6ed){if(_0x6dc6ed){return _0x5c8607[_0xd04e('0x19')](_0x5dac04)[_0xd04e('0x1a')](_0x6dc6ed);}};}function respondWithFilteredResult(_0x80f44a,_0x3cc1e7){return function(_0xb237cb){if(_0xb237cb){var _0x3f6f69=typeof _0x3cc1e7[_0xd04e('0x1b')]===_0xd04e('0x1c')&&typeof _0x3cc1e7[_0xd04e('0x1d')]===_0xd04e('0x1c');var _0x1372a9=_0xb237cb[_0xd04e('0x1e')];var _0x555799=_0x3f6f69?0x0:_0x3cc1e7['offset'];var _0x204644=_0x3f6f69?_0xb237cb[_0xd04e('0x1e')]:_0x3cc1e7[_0xd04e('0x1b')]+_0x3cc1e7['limit'];var _0x3c5d38;if(_0x204644>=_0x1372a9){_0x204644=_0x1372a9;_0x3c5d38=0xc8;}else{_0x3c5d38=0xce;}_0x80f44a[_0xd04e('0x19')](_0x3c5d38);return _0x80f44a[_0xd04e('0x1f')](_0xd04e('0x20'),_0x555799+'-'+_0x204644+'/'+_0x1372a9)[_0xd04e('0x1a')](_0xb237cb);}return null;};}function patchUpdates(_0x64257e){return function(_0x5e66e5){try{jsonpatch[_0xd04e('0x21')](_0x5e66e5,_0x64257e,!![]);}catch(_0xe4568d){return BPromise[_0xd04e('0x22')](_0xe4568d);}return _0x5e66e5['save']();};}function saveUpdates(_0x586800,_0x3fef23){return function(_0x3afe67){if(_0x3afe67){return _0x3afe67[_0xd04e('0x23')](_0x586800)[_0xd04e('0x24')](function(_0x32ed37){return _0x32ed37;});}return null;};}function removeEntity(_0x2b5f85,_0x143ac0){return function(_0x18594c){if(_0x18594c){return _0x18594c[_0xd04e('0x25')]()[_0xd04e('0x24')](function(){_0x2b5f85[_0xd04e('0x19')](0xcc)[_0xd04e('0x26')]();});}};}function handleEntityNotFound(_0x54f7c1,_0x55095e){return function(_0x560741){if(!_0x560741){_0x54f7c1[_0xd04e('0x18')](0x194);}return _0x560741;};}function handleError(_0x422fe6,_0x49e48a){_0x49e48a=_0x49e48a||0x1f4;return function(_0x623ceb){logger[_0xd04e('0x27')](_0x623ceb[_0xd04e('0x28')]);if(_0x623ceb[_0xd04e('0x29')]){delete _0x623ceb[_0xd04e('0x29')];}_0x422fe6[_0xd04e('0x19')](_0x49e48a)[_0xd04e('0x2a')](_0x623ceb);};}exports[_0xd04e('0x2b')]=function(_0x3d9441,_0x2e7ead){var _0x34d437={},_0x479328={},_0x26e89f={'count':0x0,'rows':[]};var _0x3d9431=_[_0xd04e('0x2c')](db[_0xd04e('0x2d')]['rawAttributes'],function(_0x3cd912){return{'name':_0x3cd912[_0xd04e('0x2e')],'type':_0x3cd912[_0xd04e('0x2f')][_0xd04e('0x30')]};});_0x479328['model']=_[_0xd04e('0x2c')](_0x3d9431,_0xd04e('0x29'));_0x479328[_0xd04e('0x31')]=_['keys'](_0x3d9441[_0xd04e('0x31')]);_0x479328['filters']=_[_0xd04e('0x32')](_0x479328[_0xd04e('0x33')],_0x479328[_0xd04e('0x31')]);_0x34d437[_0xd04e('0x34')]=_[_0xd04e('0x32')](_0x479328['model'],qs[_0xd04e('0x35')](_0x3d9441[_0xd04e('0x31')]['fields']));_0x34d437[_0xd04e('0x34')]=_0x34d437[_0xd04e('0x34')]['length']?_0x34d437[_0xd04e('0x34')]:_0x479328[_0xd04e('0x33')];if(!_0x3d9441[_0xd04e('0x31')][_0xd04e('0x36')]('nolimit')){_0x34d437[_0xd04e('0x1d')]=qs['limit'](_0x3d9441[_0xd04e('0x31')]['limit']);_0x34d437[_0xd04e('0x1b')]=qs[_0xd04e('0x1b')](_0x3d9441['query']['offset']);}_0x34d437[_0xd04e('0x37')]=qs[_0xd04e('0x38')](_0x3d9441[_0xd04e('0x31')]['sort']);_0x34d437[_0xd04e('0x39')]=qs[_0xd04e('0x3a')](_[_0xd04e('0x3b')](_0x3d9441[_0xd04e('0x31')],_0x479328[_0xd04e('0x3a')]),_0x3d9431);if(_0x3d9441[_0xd04e('0x31')][_0xd04e('0x3c')]){_0x34d437[_0xd04e('0x39')]=_[_0xd04e('0x3d')](_0x34d437[_0xd04e('0x39')],{'$or':_[_0xd04e('0x2c')](_0x3d9431,function(_0x5793bb){if(_0x5793bb[_0xd04e('0x2f')]!=='VIRTUAL'){var _0x58302e={};_0x58302e[_0x5793bb['name']]={'$like':'%'+_0x3d9441['query'][_0xd04e('0x3c')]+'%'};return _0x58302e;}})});}_0x34d437=_[_0xd04e('0x3d')]({},_0x34d437,_0x3d9441['options']);var _0x594e90={'where':_0x34d437[_0xd04e('0x39')]};return db[_0xd04e('0x2d')][_0xd04e('0x1e')](_0x594e90)[_0xd04e('0x24')](function(_0x227749){_0x26e89f['count']=_0x227749;if(_0x3d9441[_0xd04e('0x31')][_0xd04e('0x3e')]){_0x34d437['include']=[{'all':!![]}];}return db[_0xd04e('0x2d')]['findAll'](_0x34d437);})['then'](function(_0x2db105){_0x26e89f[_0xd04e('0x3f')]=_0x2db105;return _0x26e89f;})[_0xd04e('0x24')](respondWithFilteredResult(_0x2e7ead,_0x34d437))['catch'](handleError(_0x2e7ead,null));};exports[_0xd04e('0x40')]=function(_0x554d86,_0x58a41a){var _0x2c7d71={'raw':![],'where':{'id':_0x554d86[_0xd04e('0x41')]['id']}},_0x379e5d={};_0x379e5d['model']=_[_0xd04e('0x42')](db[_0xd04e('0x2d')]['rawAttributes']);_0x379e5d['query']=_['keys'](_0x554d86['query']);_0x379e5d[_0xd04e('0x3a')]=_[_0xd04e('0x32')](_0x379e5d['model'],_0x379e5d['query']);_0x2c7d71[_0xd04e('0x34')]=_[_0xd04e('0x32')](_0x379e5d['model'],qs['fields'](_0x554d86[_0xd04e('0x31')]['fields']));_0x2c7d71[_0xd04e('0x34')]=_0x2c7d71[_0xd04e('0x34')][_0xd04e('0x43')]?_0x2c7d71['attributes']:_0x379e5d[_0xd04e('0x33')];if(_0x554d86[_0xd04e('0x31')]['includeAll']){_0x2c7d71[_0xd04e('0x44')]=[{'all':!![]}];}_0x2c7d71=_[_0xd04e('0x3d')]({},_0x2c7d71,_0x554d86[_0xd04e('0x45')]);return db[_0xd04e('0x2d')][_0xd04e('0x46')](_0x2c7d71)[_0xd04e('0x24')](handleEntityNotFound(_0x58a41a,null))[_0xd04e('0x24')](respondWithResult(_0x58a41a,null))[_0xd04e('0x47')](handleError(_0x58a41a,null));};exports['create']=function(_0x237140,_0x2a7b04){return db[_0xd04e('0x2d')]['create'](_0x237140[_0xd04e('0x48')],{})['then'](respondWithResult(_0x2a7b04,0xc9))[_0xd04e('0x47')](handleError(_0x2a7b04,null));};exports[_0xd04e('0x23')]=function(_0x32a929,_0x45b77c){if(_0x32a929[_0xd04e('0x48')]['id']){delete _0x32a929['body']['id'];}return db[_0xd04e('0x2d')][_0xd04e('0x46')]({'where':{'id':_0x32a929[_0xd04e('0x41')]['id']}})[_0xd04e('0x24')](handleEntityNotFound(_0x45b77c,null))['then'](saveUpdates(_0x32a929[_0xd04e('0x48')],null))[_0xd04e('0x24')](respondWithResult(_0x45b77c,null))[_0xd04e('0x47')](handleError(_0x45b77c,null));};exports[_0xd04e('0x25')]=function(_0xa7eb44,_0x427728){return db[_0xd04e('0x2d')][_0xd04e('0x46')]({'where':{'id':_0xa7eb44[_0xd04e('0x41')]['id']}})['then'](handleEntityNotFound(_0x427728,null))[_0xd04e('0x24')](removeEntity(_0x427728,null))[_0xd04e('0x47')](handleError(_0x427728,null));};exports[_0xd04e('0x49')]=function(_0xe90bca,_0x559971,_0x242000){var _0x1e0e98={};var _0x5b0bf3={};var _0x36f435;var _0x2c9b43;return db[_0xd04e('0x2d')]['findOne']({'where':{'id':_0xe90bca[_0xd04e('0x41')]['id']}})['then'](handleEntityNotFound(_0x559971,null))[_0xd04e('0x24')](function(_0x47385f){if(_0x47385f){_0x36f435=_0x47385f;_0x5b0bf3['model']=_['keys'](db[_0xd04e('0x4a')][_0xd04e('0x4b')]);_0x5b0bf3[_0xd04e('0x31')]=_[_0xd04e('0x42')](_0xe90bca[_0xd04e('0x31')]);_0x5b0bf3[_0xd04e('0x3a')]=_[_0xd04e('0x32')](_0x5b0bf3['model'],_0x5b0bf3[_0xd04e('0x31')]);_0x1e0e98[_0xd04e('0x34')]=_[_0xd04e('0x32')](_0x5b0bf3[_0xd04e('0x33')],qs['fields'](_0xe90bca[_0xd04e('0x31')][_0xd04e('0x35')]));_0x1e0e98['attributes']=_0x1e0e98[_0xd04e('0x34')][_0xd04e('0x43')]?_0x1e0e98[_0xd04e('0x34')]:_0x5b0bf3['model'];_0x1e0e98[_0xd04e('0x37')]=qs[_0xd04e('0x38')](_0xe90bca[_0xd04e('0x31')]['sort']);_0x1e0e98[_0xd04e('0x39')]=qs[_0xd04e('0x3a')](_['pick'](_0xe90bca[_0xd04e('0x31')],_0x5b0bf3[_0xd04e('0x3a')]));if(_0xe90bca[_0xd04e('0x31')][_0xd04e('0x3c')]){_0x1e0e98['where']=_[_0xd04e('0x3d')](_0x1e0e98[_0xd04e('0x39')],{'$or':_[_0xd04e('0x2c')](_0x1e0e98['attributes'],function(_0x2ed87c){var _0x2f975e={};_0x2f975e[_0x2ed87c]={'$like':'%'+_0xe90bca[_0xd04e('0x31')]['filter']+'%'};return _0x2f975e;})});}_0x1e0e98=_[_0xd04e('0x3d')]({},_0x1e0e98,_0xe90bca[_0xd04e('0x45')]);return _0x36f435['getFields'](_0x1e0e98);}})[_0xd04e('0x24')](function(_0x585fea){if(_0x585fea){_0x2c9b43=_0x585fea[_0xd04e('0x43')];if(!_0xe90bca[_0xd04e('0x31')][_0xd04e('0x36')](_0xd04e('0x4c'))){_0x1e0e98[_0xd04e('0x1d')]=qs[_0xd04e('0x1d')](_0xe90bca[_0xd04e('0x31')][_0xd04e('0x1d')]);_0x1e0e98[_0xd04e('0x1b')]=qs[_0xd04e('0x1b')](_0xe90bca['query']['offset']);}return _0x36f435['getFields'](_0x1e0e98);}})[_0xd04e('0x24')](function(_0x3992df){if(_0x3992df){return _0x3992df?{'count':_0x2c9b43,'rows':_0x3992df}:null;}})[_0xd04e('0x24')](respondWithResult(_0x559971,null))[_0xd04e('0x47')](handleError(_0x559971,null));};exports[_0xd04e('0x4d')]=function(_0xed82c6,_0x4c41fe,_0x43c3d3){var _0x4a0085={};var _0x48fc6b={};var _0x3a1654;var _0x212058;return db[_0xd04e('0x2d')][_0xd04e('0x4e')]({'where':{'id':_0xed82c6[_0xd04e('0x41')]['id']}})[_0xd04e('0x24')](handleEntityNotFound(_0x4c41fe,null))[_0xd04e('0x24')](function(_0x2864f7){if(_0x2864f7){_0x3a1654=_0x2864f7;_0x48fc6b['model']=_['keys'](db['ZendeskField'][_0xd04e('0x4b')]);_0x48fc6b[_0xd04e('0x31')]=_[_0xd04e('0x42')](_0xed82c6[_0xd04e('0x31')]);_0x48fc6b[_0xd04e('0x3a')]=_[_0xd04e('0x32')](_0x48fc6b[_0xd04e('0x33')],_0x48fc6b[_0xd04e('0x31')]);_0x4a0085['attributes']=_[_0xd04e('0x32')](_0x48fc6b['model'],qs['fields'](_0xed82c6[_0xd04e('0x31')][_0xd04e('0x35')]));_0x4a0085['attributes']=_0x4a0085[_0xd04e('0x34')][_0xd04e('0x43')]?_0x4a0085[_0xd04e('0x34')]:_0x48fc6b['model'];_0x4a0085[_0xd04e('0x37')]=qs[_0xd04e('0x38')](_0xed82c6[_0xd04e('0x31')]['sort']);_0x4a0085['where']=qs['filters'](_[_0xd04e('0x3b')](_0xed82c6[_0xd04e('0x31')],_0x48fc6b[_0xd04e('0x3a')]));if(_0xed82c6[_0xd04e('0x31')][_0xd04e('0x3c')]){_0x4a0085[_0xd04e('0x39')]=_[_0xd04e('0x3d')](_0x4a0085[_0xd04e('0x39')],{'$or':_[_0xd04e('0x2c')](_0x4a0085[_0xd04e('0x34')],function(_0x590bb5){var _0xd47736={};_0xd47736[_0x590bb5]={'$like':'%'+_0xed82c6['query'][_0xd04e('0x3c')]+'%'};return _0xd47736;})});}_0x4a0085=_[_0xd04e('0x3d')]({},_0x4a0085,_0xed82c6[_0xd04e('0x45')]);return _0x3a1654[_0xd04e('0x4d')](_0x4a0085);}})[_0xd04e('0x24')](function(_0x17acc7){if(_0x17acc7){_0x212058=_0x17acc7[_0xd04e('0x43')];if(!_0xed82c6[_0xd04e('0x31')][_0xd04e('0x36')](_0xd04e('0x4c'))){_0x4a0085[_0xd04e('0x1d')]=qs[_0xd04e('0x1d')](_0xed82c6[_0xd04e('0x31')][_0xd04e('0x1d')]);_0x4a0085[_0xd04e('0x1b')]=qs[_0xd04e('0x1b')](_0xed82c6['query']['offset']);}return _0x3a1654[_0xd04e('0x4d')](_0x4a0085);}})[_0xd04e('0x24')](function(_0x2c0ceb){if(_0x2c0ceb){return _0x2c0ceb?{'count':_0x212058,'rows':_0x2c0ceb}:null;}})['then'](respondWithResult(_0x4c41fe,null))[_0xd04e('0x47')](handleError(_0x4c41fe,null));};exports[_0xd04e('0x4f')]=function(_0x9f45ff,_0x2de882,_0x57cad1){var _0x5a030d={};var _0x15c0e1={};var _0x29bd6f;var _0x119372;return db['ZendeskConfiguration'][_0xd04e('0x4e')]({'where':{'id':_0x9f45ff['params']['id']}})['then'](handleEntityNotFound(_0x2de882,null))[_0xd04e('0x24')](function(_0x5095b6){if(_0x5095b6){_0x29bd6f=_0x5095b6;_0x15c0e1[_0xd04e('0x33')]=_['keys'](db[_0xd04e('0x4a')][_0xd04e('0x4b')]);_0x15c0e1[_0xd04e('0x31')]=_[_0xd04e('0x42')](_0x9f45ff['query']);_0x15c0e1['filters']=_[_0xd04e('0x32')](_0x15c0e1['model'],_0x15c0e1[_0xd04e('0x31')]);_0x5a030d['attributes']=_['intersection'](_0x15c0e1[_0xd04e('0x33')],qs['fields'](_0x9f45ff[_0xd04e('0x31')][_0xd04e('0x35')]));_0x5a030d[_0xd04e('0x34')]=_0x5a030d[_0xd04e('0x34')]['length']?_0x5a030d['attributes']:_0x15c0e1[_0xd04e('0x33')];_0x5a030d['order']=qs[_0xd04e('0x38')](_0x9f45ff['query']['sort']);_0x5a030d[_0xd04e('0x39')]=qs[_0xd04e('0x3a')](_[_0xd04e('0x3b')](_0x9f45ff[_0xd04e('0x31')],_0x15c0e1[_0xd04e('0x3a')]));if(_0x9f45ff[_0xd04e('0x31')][_0xd04e('0x3c')]){_0x5a030d['where']=_[_0xd04e('0x3d')](_0x5a030d['where'],{'$or':_[_0xd04e('0x2c')](_0x5a030d[_0xd04e('0x34')],function(_0x29b338){var _0x450654={};_0x450654[_0x29b338]={'$like':'%'+_0x9f45ff[_0xd04e('0x31')]['filter']+'%'};return _0x450654;})});}_0x5a030d=_[_0xd04e('0x3d')]({},_0x5a030d,_0x9f45ff[_0xd04e('0x45')]);return _0x29bd6f[_0xd04e('0x4f')](_0x5a030d);}})[_0xd04e('0x24')](function(_0x4b205b){if(_0x4b205b){_0x119372=_0x4b205b[_0xd04e('0x43')];if(!_0x9f45ff[_0xd04e('0x31')]['hasOwnProperty'](_0xd04e('0x4c'))){_0x5a030d[_0xd04e('0x1d')]=qs[_0xd04e('0x1d')](_0x9f45ff[_0xd04e('0x31')]['limit']);_0x5a030d[_0xd04e('0x1b')]=qs['offset'](_0x9f45ff[_0xd04e('0x31')][_0xd04e('0x1b')]);}return _0x29bd6f[_0xd04e('0x4f')](_0x5a030d);}})[_0xd04e('0x24')](function(_0x1ea435){if(_0x1ea435){return _0x1ea435?{'count':_0x119372,'rows':_0x1ea435}:null;}})[_0xd04e('0x24')](respondWithResult(_0x2de882,null))['catch'](handleError(_0x2de882,null));};exports['getTags']=function(_0x5b088c,_0x5a69e7,_0x4e6354){var _0x96cb8c={};var _0x220908={};var _0x1cb9fa;var _0x1f4f75;return db['ZendeskConfiguration'][_0xd04e('0x4e')]({'where':{'id':_0x5b088c['params']['id']}})[_0xd04e('0x24')](handleEntityNotFound(_0x5a69e7,null))[_0xd04e('0x24')](function(_0x2b37a7){if(_0x2b37a7){_0x1cb9fa=_0x2b37a7;_0x220908['model']=_[_0xd04e('0x42')](db[_0xd04e('0x50')][_0xd04e('0x4b')]);_0x220908[_0xd04e('0x31')]=_[_0xd04e('0x42')](_0x5b088c['query']);_0x220908[_0xd04e('0x3a')]=_[_0xd04e('0x32')](_0x220908[_0xd04e('0x33')],_0x220908[_0xd04e('0x31')]);_0x96cb8c[_0xd04e('0x34')]=_[_0xd04e('0x32')](_0x220908['model'],qs[_0xd04e('0x35')](_0x5b088c[_0xd04e('0x31')]['fields']));_0x96cb8c[_0xd04e('0x34')]=_0x96cb8c[_0xd04e('0x34')][_0xd04e('0x43')]?_0x96cb8c['attributes']:_0x220908[_0xd04e('0x33')];_0x96cb8c[_0xd04e('0x37')]=qs[_0xd04e('0x38')](_0x5b088c[_0xd04e('0x31')][_0xd04e('0x38')]);_0x96cb8c[_0xd04e('0x39')]=qs['filters'](_['pick'](_0x5b088c['query'],_0x220908[_0xd04e('0x3a')]));if(_0x5b088c['query'][_0xd04e('0x3c')]){_0x96cb8c[_0xd04e('0x39')]=_[_0xd04e('0x3d')](_0x96cb8c['where'],{'$or':_['map'](_0x96cb8c[_0xd04e('0x34')],function(_0x22f503){var _0x7bb376={};_0x7bb376[_0x22f503]={'$like':'%'+_0x5b088c[_0xd04e('0x31')][_0xd04e('0x3c')]+'%'};return _0x7bb376;})});}_0x96cb8c=_[_0xd04e('0x3d')]({},_0x96cb8c,_0x5b088c[_0xd04e('0x45')]);return _0x1cb9fa[_0xd04e('0x51')](_0x96cb8c);}})[_0xd04e('0x24')](function(_0x4c0f9b){if(_0x4c0f9b){_0x1f4f75=_0x4c0f9b[_0xd04e('0x43')];if(!_0x5b088c[_0xd04e('0x31')][_0xd04e('0x36')]('nolimit')){_0x96cb8c[_0xd04e('0x1d')]=qs[_0xd04e('0x1d')](_0x5b088c[_0xd04e('0x31')][_0xd04e('0x1d')]);_0x96cb8c[_0xd04e('0x1b')]=qs[_0xd04e('0x1b')](_0x5b088c['query']['offset']);}return _0x1cb9fa[_0xd04e('0x51')](_0x96cb8c);}})[_0xd04e('0x24')](function(_0xf16ca4){if(_0xf16ca4){return _0xf16ca4?{'count':_0x1f4f75,'rows':_0xf16ca4}:null;}})[_0xd04e('0x24')](respondWithResult(_0x5a69e7,null))[_0xd04e('0x47')](handleError(_0x5a69e7,null));};exports['setTags']=function(_0x2904e5,_0x4bbd52,_0x506c3b){if(_0x2904e5['body']['id']){delete _0x2904e5[_0xd04e('0x48')]['id'];}return db[_0xd04e('0x2d')][_0xd04e('0x4e')]({'where':{'id':_0x2904e5[_0xd04e('0x41')]['id']}})[_0xd04e('0x24')](handleEntityNotFound(_0x4bbd52,null))['then'](function(_0x31a9fe){if(_0x31a9fe){return _0x31a9fe[_0xd04e('0x52')](_0x2904e5[_0xd04e('0x48')][_0xd04e('0x53')]||[]);}return null;})[_0xd04e('0x24')](respondWithResult(_0x4bbd52,null))[_0xd04e('0x47')](handleError(_0x4bbd52,null));}; \ No newline at end of file +var _0xd250=['attributes','fields','nolimit','limit','sort','where','pick','filters','filter','VIRTUAL','merge','options','ZendeskConfiguration','include','findAll','catch','show','length','includeAll','create','body','find','params','getFields','ZendeskField','getSubjects','findOne','order','hasOwnProperty','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','intersection'];(function(_0x1aee5e,_0x8671){var _0x4911d=function(_0x47b25a){while(--_0x47b25a){_0x1aee5e['push'](_0x1aee5e['shift']());}};_0x4911d(++_0x8671);}(_0xd250,0x75));var _0x0d25=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0xd250[_0x301dab];return _0x2500a2;};'use strict';var emlformat=require(_0x0d25('0x0'));var rimraf=require(_0x0d25('0x1'));var zipdir=require(_0x0d25('0x2'));var jsonpatch=require(_0x0d25('0x3'));var rp=require(_0x0d25('0x4'));var moment=require('moment');var BPromise=require(_0x0d25('0x5'));var Mustache=require(_0x0d25('0x6'));var util=require(_0x0d25('0x7'));var path=require(_0x0d25('0x8'));var sox=require(_0x0d25('0x9'));var csv=require(_0x0d25('0xa'));var ejs=require(_0x0d25('0xb'));var fs=require('fs');var fs_extra=require(_0x0d25('0xc'));var _=require(_0x0d25('0xd'));var squel=require(_0x0d25('0xe'));var crypto=require(_0x0d25('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x0d25('0x10'));var toCsv=require(_0x0d25('0xa'));var querystring=require(_0x0d25('0x11'));var Papa=require(_0x0d25('0x12'));var Redis=require(_0x0d25('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0d25('0x14'));var as=require(_0x0d25('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d25('0x16'))(_0x0d25('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0d25('0x18'));var db=require(_0x0d25('0x19'))['db'];function respondWithStatusCode(_0x5b5d89,_0x53418d){_0x53418d=_0x53418d||0xcc;return function(_0x90d693){if(_0x90d693){return _0x5b5d89[_0x0d25('0x1a')](_0x53418d);}return _0x5b5d89[_0x0d25('0x1b')](_0x53418d)[_0x0d25('0x1c')]();};}function respondWithResult(_0x5a8b32,_0x54a84d){_0x54a84d=_0x54a84d||0xc8;return function(_0x57df53){if(_0x57df53){return _0x5a8b32[_0x0d25('0x1b')](_0x54a84d)[_0x0d25('0x1d')](_0x57df53);}};}function respondWithFilteredResult(_0x5b6076,_0x45efbc){return function(_0x3c15d7){if(_0x3c15d7){var _0x3ffd30=typeof _0x45efbc[_0x0d25('0x1e')]===_0x0d25('0x1f')&&typeof _0x45efbc['limit']===_0x0d25('0x1f');var _0x5a826c=_0x3c15d7[_0x0d25('0x20')];var _0x1cb0a9=_0x3ffd30?0x0:_0x45efbc['offset'];var _0x4be88c=_0x3ffd30?_0x3c15d7[_0x0d25('0x20')]:_0x45efbc['offset']+_0x45efbc['limit'];var _0x86f333;if(_0x4be88c>=_0x5a826c){_0x4be88c=_0x5a826c;_0x86f333=0xc8;}else{_0x86f333=0xce;}_0x5b6076[_0x0d25('0x1b')](_0x86f333);return _0x5b6076[_0x0d25('0x21')]('Content-Range',_0x1cb0a9+'-'+_0x4be88c+'/'+_0x5a826c)[_0x0d25('0x1d')](_0x3c15d7);}return null;};}function patchUpdates(_0x442ec5){return function(_0x2cad21){try{jsonpatch[_0x0d25('0x22')](_0x2cad21,_0x442ec5,!![]);}catch(_0x367f0f){return BPromise['reject'](_0x367f0f);}return _0x2cad21[_0x0d25('0x23')]();};}function saveUpdates(_0x51a790,_0x869757){return function(_0x471c29){if(_0x471c29){return _0x471c29[_0x0d25('0x24')](_0x51a790)[_0x0d25('0x25')](function(_0x3e23f0){return _0x3e23f0;});}return null;};}function removeEntity(_0xbba298,_0x338a15){return function(_0x15ba1f){if(_0x15ba1f){return _0x15ba1f[_0x0d25('0x26')]()[_0x0d25('0x25')](function(){_0xbba298[_0x0d25('0x1b')](0xcc)[_0x0d25('0x1c')]();});}};}function handleEntityNotFound(_0x16d4e3,_0x3dd5b9){return function(_0x175048){if(!_0x175048){_0x16d4e3[_0x0d25('0x1a')](0x194);}return _0x175048;};}function handleError(_0x4e5fcf,_0x13f2d4){_0x13f2d4=_0x13f2d4||0x1f4;return function(_0x4430ae){logger[_0x0d25('0x27')](_0x4430ae[_0x0d25('0x28')]);if(_0x4430ae[_0x0d25('0x29')]){delete _0x4430ae['name'];}_0x4e5fcf[_0x0d25('0x1b')](_0x13f2d4)[_0x0d25('0x2a')](_0x4430ae);};}exports['index']=function(_0x5d914a,_0x5345b2){var _0x2bac3d={},_0x512a5c={},_0x7d6ce5={'count':0x0,'rows':[]};var _0x76155f=_[_0x0d25('0x2b')](db['ZendeskConfiguration'][_0x0d25('0x2c')],function(_0x507b90){return{'name':_0x507b90[_0x0d25('0x2d')],'type':_0x507b90[_0x0d25('0x2e')]['key']};});_0x512a5c[_0x0d25('0x2f')]=_[_0x0d25('0x2b')](_0x76155f,'name');_0x512a5c[_0x0d25('0x30')]=_[_0x0d25('0x31')](_0x5d914a[_0x0d25('0x30')]);_0x512a5c['filters']=_[_0x0d25('0x32')](_0x512a5c[_0x0d25('0x2f')],_0x512a5c[_0x0d25('0x30')]);_0x2bac3d[_0x0d25('0x33')]=_['intersection'](_0x512a5c[_0x0d25('0x2f')],qs['fields'](_0x5d914a['query'][_0x0d25('0x34')]));_0x2bac3d[_0x0d25('0x33')]=_0x2bac3d['attributes']['length']?_0x2bac3d['attributes']:_0x512a5c['model'];if(!_0x5d914a[_0x0d25('0x30')]['hasOwnProperty'](_0x0d25('0x35'))){_0x2bac3d[_0x0d25('0x36')]=qs[_0x0d25('0x36')](_0x5d914a[_0x0d25('0x30')][_0x0d25('0x36')]);_0x2bac3d[_0x0d25('0x1e')]=qs['offset'](_0x5d914a[_0x0d25('0x30')]['offset']);}_0x2bac3d['order']=qs[_0x0d25('0x37')](_0x5d914a['query']['sort']);_0x2bac3d[_0x0d25('0x38')]=qs['filters'](_[_0x0d25('0x39')](_0x5d914a[_0x0d25('0x30')],_0x512a5c[_0x0d25('0x3a')]),_0x76155f);if(_0x5d914a['query'][_0x0d25('0x3b')]){_0x2bac3d['where']=_['merge'](_0x2bac3d[_0x0d25('0x38')],{'$or':_[_0x0d25('0x2b')](_0x76155f,function(_0x2de166){if(_0x2de166[_0x0d25('0x2e')]!==_0x0d25('0x3c')){var _0x1408d4={};_0x1408d4[_0x2de166['name']]={'$like':'%'+_0x5d914a[_0x0d25('0x30')][_0x0d25('0x3b')]+'%'};return _0x1408d4;}})});}_0x2bac3d=_[_0x0d25('0x3d')]({},_0x2bac3d,_0x5d914a[_0x0d25('0x3e')]);var _0x29927e={'where':_0x2bac3d[_0x0d25('0x38')]};return db[_0x0d25('0x3f')][_0x0d25('0x20')](_0x29927e)[_0x0d25('0x25')](function(_0x308d8c){_0x7d6ce5[_0x0d25('0x20')]=_0x308d8c;if(_0x5d914a[_0x0d25('0x30')]['includeAll']){_0x2bac3d[_0x0d25('0x40')]=[{'all':!![]}];}return db[_0x0d25('0x3f')][_0x0d25('0x41')](_0x2bac3d);})[_0x0d25('0x25')](function(_0x556ae2){_0x7d6ce5['rows']=_0x556ae2;return _0x7d6ce5;})[_0x0d25('0x25')](respondWithFilteredResult(_0x5345b2,_0x2bac3d))[_0x0d25('0x42')](handleError(_0x5345b2,null));};exports[_0x0d25('0x43')]=function(_0x37816d,_0x2fd31c){var _0x23bdc0={'raw':![],'where':{'id':_0x37816d['params']['id']}},_0x307826={};_0x307826[_0x0d25('0x2f')]=_['keys'](db[_0x0d25('0x3f')][_0x0d25('0x2c')]);_0x307826['query']=_[_0x0d25('0x31')](_0x37816d[_0x0d25('0x30')]);_0x307826[_0x0d25('0x3a')]=_[_0x0d25('0x32')](_0x307826[_0x0d25('0x2f')],_0x307826[_0x0d25('0x30')]);_0x23bdc0[_0x0d25('0x33')]=_[_0x0d25('0x32')](_0x307826['model'],qs[_0x0d25('0x34')](_0x37816d['query']['fields']));_0x23bdc0[_0x0d25('0x33')]=_0x23bdc0[_0x0d25('0x33')][_0x0d25('0x44')]?_0x23bdc0[_0x0d25('0x33')]:_0x307826['model'];if(_0x37816d[_0x0d25('0x30')][_0x0d25('0x45')]){_0x23bdc0[_0x0d25('0x40')]=[{'all':!![]}];}_0x23bdc0=_[_0x0d25('0x3d')]({},_0x23bdc0,_0x37816d[_0x0d25('0x3e')]);return db['ZendeskConfiguration']['find'](_0x23bdc0)[_0x0d25('0x25')](handleEntityNotFound(_0x2fd31c,null))[_0x0d25('0x25')](respondWithResult(_0x2fd31c,null))[_0x0d25('0x42')](handleError(_0x2fd31c,null));};exports[_0x0d25('0x46')]=function(_0x3ca915,_0x55e46d){return db[_0x0d25('0x3f')][_0x0d25('0x46')](_0x3ca915['body'],{})[_0x0d25('0x25')](respondWithResult(_0x55e46d,0xc9))['catch'](handleError(_0x55e46d,null));};exports[_0x0d25('0x24')]=function(_0x53cfe9,_0x2d9e37){if(_0x53cfe9[_0x0d25('0x47')]['id']){delete _0x53cfe9[_0x0d25('0x47')]['id'];}return db[_0x0d25('0x3f')]['find']({'where':{'id':_0x53cfe9['params']['id']}})[_0x0d25('0x25')](handleEntityNotFound(_0x2d9e37,null))['then'](saveUpdates(_0x53cfe9[_0x0d25('0x47')],null))['then'](respondWithResult(_0x2d9e37,null))[_0x0d25('0x42')](handleError(_0x2d9e37,null));};exports[_0x0d25('0x26')]=function(_0x4a7658,_0x26e4ba){return db[_0x0d25('0x3f')][_0x0d25('0x48')]({'where':{'id':_0x4a7658[_0x0d25('0x49')]['id']}})[_0x0d25('0x25')](handleEntityNotFound(_0x26e4ba,null))['then'](removeEntity(_0x26e4ba,null))['catch'](handleError(_0x26e4ba,null));};exports[_0x0d25('0x4a')]=function(_0x43f0b9,_0x20c3c1,_0xf7537b){var _0x389090={};var _0x14d5dc={};var _0x362057;var _0xde728e;return db[_0x0d25('0x3f')]['findOne']({'where':{'id':_0x43f0b9[_0x0d25('0x49')]['id']}})[_0x0d25('0x25')](handleEntityNotFound(_0x20c3c1,null))['then'](function(_0x178f05){if(_0x178f05){_0x362057=_0x178f05;_0x14d5dc['model']=_[_0x0d25('0x31')](db[_0x0d25('0x4b')][_0x0d25('0x2c')]);_0x14d5dc[_0x0d25('0x30')]=_['keys'](_0x43f0b9[_0x0d25('0x30')]);_0x14d5dc['filters']=_[_0x0d25('0x32')](_0x14d5dc[_0x0d25('0x2f')],_0x14d5dc[_0x0d25('0x30')]);_0x389090['attributes']=_[_0x0d25('0x32')](_0x14d5dc[_0x0d25('0x2f')],qs[_0x0d25('0x34')](_0x43f0b9[_0x0d25('0x30')][_0x0d25('0x34')]));_0x389090[_0x0d25('0x33')]=_0x389090[_0x0d25('0x33')][_0x0d25('0x44')]?_0x389090[_0x0d25('0x33')]:_0x14d5dc[_0x0d25('0x2f')];_0x389090['order']=qs[_0x0d25('0x37')](_0x43f0b9['query']['sort']);_0x389090['where']=qs[_0x0d25('0x3a')](_[_0x0d25('0x39')](_0x43f0b9[_0x0d25('0x30')],_0x14d5dc[_0x0d25('0x3a')]));if(_0x43f0b9[_0x0d25('0x30')][_0x0d25('0x3b')]){_0x389090[_0x0d25('0x38')]=_[_0x0d25('0x3d')](_0x389090['where'],{'$or':_[_0x0d25('0x2b')](_0x389090['attributes'],function(_0x2b20b5){var _0x3d703e={};_0x3d703e[_0x2b20b5]={'$like':'%'+_0x43f0b9[_0x0d25('0x30')]['filter']+'%'};return _0x3d703e;})});}_0x389090=_[_0x0d25('0x3d')]({},_0x389090,_0x43f0b9[_0x0d25('0x3e')]);return _0x362057[_0x0d25('0x4a')](_0x389090);}})[_0x0d25('0x25')](function(_0x474469){if(_0x474469){_0xde728e=_0x474469[_0x0d25('0x44')];if(!_0x43f0b9[_0x0d25('0x30')]['hasOwnProperty'](_0x0d25('0x35'))){_0x389090['limit']=qs[_0x0d25('0x36')](_0x43f0b9[_0x0d25('0x30')][_0x0d25('0x36')]);_0x389090[_0x0d25('0x1e')]=qs[_0x0d25('0x1e')](_0x43f0b9[_0x0d25('0x30')][_0x0d25('0x1e')]);}return _0x362057[_0x0d25('0x4a')](_0x389090);}})[_0x0d25('0x25')](function(_0x431a1c){if(_0x431a1c){return _0x431a1c?{'count':_0xde728e,'rows':_0x431a1c}:null;}})[_0x0d25('0x25')](respondWithResult(_0x20c3c1,null))[_0x0d25('0x42')](handleError(_0x20c3c1,null));};exports[_0x0d25('0x4c')]=function(_0x38d7ea,_0x249ac7,_0x2ac98c){var _0x3b7d2f={};var _0x375abc={};var _0x33184f;var _0x1f3e5d;return db[_0x0d25('0x3f')][_0x0d25('0x4d')]({'where':{'id':_0x38d7ea[_0x0d25('0x49')]['id']}})['then'](handleEntityNotFound(_0x249ac7,null))[_0x0d25('0x25')](function(_0x54b4fe){if(_0x54b4fe){_0x33184f=_0x54b4fe;_0x375abc[_0x0d25('0x2f')]=_[_0x0d25('0x31')](db['ZendeskField'][_0x0d25('0x2c')]);_0x375abc[_0x0d25('0x30')]=_[_0x0d25('0x31')](_0x38d7ea['query']);_0x375abc['filters']=_[_0x0d25('0x32')](_0x375abc[_0x0d25('0x2f')],_0x375abc[_0x0d25('0x30')]);_0x3b7d2f[_0x0d25('0x33')]=_[_0x0d25('0x32')](_0x375abc[_0x0d25('0x2f')],qs[_0x0d25('0x34')](_0x38d7ea[_0x0d25('0x30')][_0x0d25('0x34')]));_0x3b7d2f['attributes']=_0x3b7d2f[_0x0d25('0x33')][_0x0d25('0x44')]?_0x3b7d2f[_0x0d25('0x33')]:_0x375abc[_0x0d25('0x2f')];_0x3b7d2f[_0x0d25('0x4e')]=qs[_0x0d25('0x37')](_0x38d7ea[_0x0d25('0x30')][_0x0d25('0x37')]);_0x3b7d2f[_0x0d25('0x38')]=qs[_0x0d25('0x3a')](_['pick'](_0x38d7ea[_0x0d25('0x30')],_0x375abc[_0x0d25('0x3a')]));if(_0x38d7ea[_0x0d25('0x30')]['filter']){_0x3b7d2f[_0x0d25('0x38')]=_['merge'](_0x3b7d2f[_0x0d25('0x38')],{'$or':_[_0x0d25('0x2b')](_0x3b7d2f['attributes'],function(_0x87c182){var _0x2e316b={};_0x2e316b[_0x87c182]={'$like':'%'+_0x38d7ea['query'][_0x0d25('0x3b')]+'%'};return _0x2e316b;})});}_0x3b7d2f=_[_0x0d25('0x3d')]({},_0x3b7d2f,_0x38d7ea[_0x0d25('0x3e')]);return _0x33184f[_0x0d25('0x4c')](_0x3b7d2f);}})['then'](function(_0x543cd3){if(_0x543cd3){_0x1f3e5d=_0x543cd3[_0x0d25('0x44')];if(!_0x38d7ea[_0x0d25('0x30')][_0x0d25('0x4f')]('nolimit')){_0x3b7d2f['limit']=qs[_0x0d25('0x36')](_0x38d7ea[_0x0d25('0x30')]['limit']);_0x3b7d2f['offset']=qs[_0x0d25('0x1e')](_0x38d7ea[_0x0d25('0x30')][_0x0d25('0x1e')]);}return _0x33184f[_0x0d25('0x4c')](_0x3b7d2f);}})[_0x0d25('0x25')](function(_0x20c287){if(_0x20c287){return _0x20c287?{'count':_0x1f3e5d,'rows':_0x20c287}:null;}})['then'](respondWithResult(_0x249ac7,null))[_0x0d25('0x42')](handleError(_0x249ac7,null));};exports[_0x0d25('0x50')]=function(_0x3d88cd,_0x42242d,_0x3c9925){var _0x4b3884={};var _0x59f7ac={};var _0x2eade9;var _0x4926cd;return db[_0x0d25('0x3f')]['findOne']({'where':{'id':_0x3d88cd[_0x0d25('0x49')]['id']}})[_0x0d25('0x25')](handleEntityNotFound(_0x42242d,null))['then'](function(_0x258f08){if(_0x258f08){_0x2eade9=_0x258f08;_0x59f7ac[_0x0d25('0x2f')]=_['keys'](db[_0x0d25('0x4b')]['rawAttributes']);_0x59f7ac[_0x0d25('0x30')]=_[_0x0d25('0x31')](_0x3d88cd['query']);_0x59f7ac['filters']=_['intersection'](_0x59f7ac['model'],_0x59f7ac[_0x0d25('0x30')]);_0x4b3884[_0x0d25('0x33')]=_['intersection'](_0x59f7ac[_0x0d25('0x2f')],qs[_0x0d25('0x34')](_0x3d88cd[_0x0d25('0x30')][_0x0d25('0x34')]));_0x4b3884[_0x0d25('0x33')]=_0x4b3884[_0x0d25('0x33')][_0x0d25('0x44')]?_0x4b3884[_0x0d25('0x33')]:_0x59f7ac[_0x0d25('0x2f')];_0x4b3884[_0x0d25('0x4e')]=qs[_0x0d25('0x37')](_0x3d88cd[_0x0d25('0x30')][_0x0d25('0x37')]);_0x4b3884[_0x0d25('0x38')]=qs[_0x0d25('0x3a')](_[_0x0d25('0x39')](_0x3d88cd[_0x0d25('0x30')],_0x59f7ac[_0x0d25('0x3a')]));if(_0x3d88cd['query']['filter']){_0x4b3884[_0x0d25('0x38')]=_[_0x0d25('0x3d')](_0x4b3884[_0x0d25('0x38')],{'$or':_[_0x0d25('0x2b')](_0x4b3884[_0x0d25('0x33')],function(_0x1bacd9){var _0x45dde4={};_0x45dde4[_0x1bacd9]={'$like':'%'+_0x3d88cd[_0x0d25('0x30')][_0x0d25('0x3b')]+'%'};return _0x45dde4;})});}_0x4b3884=_[_0x0d25('0x3d')]({},_0x4b3884,_0x3d88cd['options']);return _0x2eade9['getDescriptions'](_0x4b3884);}})[_0x0d25('0x25')](function(_0x58f47e){if(_0x58f47e){_0x4926cd=_0x58f47e['length'];if(!_0x3d88cd[_0x0d25('0x30')][_0x0d25('0x4f')](_0x0d25('0x35'))){_0x4b3884[_0x0d25('0x36')]=qs['limit'](_0x3d88cd[_0x0d25('0x30')][_0x0d25('0x36')]);_0x4b3884[_0x0d25('0x1e')]=qs[_0x0d25('0x1e')](_0x3d88cd[_0x0d25('0x30')][_0x0d25('0x1e')]);}return _0x2eade9[_0x0d25('0x50')](_0x4b3884);}})['then'](function(_0x317ee2){if(_0x317ee2){return _0x317ee2?{'count':_0x4926cd,'rows':_0x317ee2}:null;}})[_0x0d25('0x25')](respondWithResult(_0x42242d,null))[_0x0d25('0x42')](handleError(_0x42242d,null));};exports[_0x0d25('0x51')]=function(_0x38feb8,_0x42ecbf,_0x3b95f6){var _0x18d387={};var _0x3a497a={};var _0x4db1b4;var _0x295bd7;return db['ZendeskConfiguration'][_0x0d25('0x4d')]({'where':{'id':_0x38feb8[_0x0d25('0x49')]['id']}})[_0x0d25('0x25')](handleEntityNotFound(_0x42ecbf,null))[_0x0d25('0x25')](function(_0x376e7d){if(_0x376e7d){_0x4db1b4=_0x376e7d;_0x3a497a[_0x0d25('0x2f')]=_[_0x0d25('0x31')](db[_0x0d25('0x52')][_0x0d25('0x2c')]);_0x3a497a[_0x0d25('0x30')]=_[_0x0d25('0x31')](_0x38feb8[_0x0d25('0x30')]);_0x3a497a[_0x0d25('0x3a')]=_[_0x0d25('0x32')](_0x3a497a[_0x0d25('0x2f')],_0x3a497a[_0x0d25('0x30')]);_0x18d387[_0x0d25('0x33')]=_[_0x0d25('0x32')](_0x3a497a[_0x0d25('0x2f')],qs['fields'](_0x38feb8[_0x0d25('0x30')]['fields']));_0x18d387[_0x0d25('0x33')]=_0x18d387[_0x0d25('0x33')]['length']?_0x18d387[_0x0d25('0x33')]:_0x3a497a[_0x0d25('0x2f')];_0x18d387[_0x0d25('0x4e')]=qs['sort'](_0x38feb8[_0x0d25('0x30')][_0x0d25('0x37')]);_0x18d387[_0x0d25('0x38')]=qs[_0x0d25('0x3a')](_[_0x0d25('0x39')](_0x38feb8[_0x0d25('0x30')],_0x3a497a[_0x0d25('0x3a')]));if(_0x38feb8[_0x0d25('0x30')][_0x0d25('0x3b')]){_0x18d387[_0x0d25('0x38')]=_['merge'](_0x18d387[_0x0d25('0x38')],{'$or':_[_0x0d25('0x2b')](_0x18d387[_0x0d25('0x33')],function(_0x58ca62){var _0x504fac={};_0x504fac[_0x58ca62]={'$like':'%'+_0x38feb8['query'][_0x0d25('0x3b')]+'%'};return _0x504fac;})});}_0x18d387=_[_0x0d25('0x3d')]({},_0x18d387,_0x38feb8[_0x0d25('0x3e')]);return _0x4db1b4['getTags'](_0x18d387);}})[_0x0d25('0x25')](function(_0x102238){if(_0x102238){_0x295bd7=_0x102238['length'];if(!_0x38feb8[_0x0d25('0x30')][_0x0d25('0x4f')]('nolimit')){_0x18d387[_0x0d25('0x36')]=qs[_0x0d25('0x36')](_0x38feb8[_0x0d25('0x30')][_0x0d25('0x36')]);_0x18d387['offset']=qs[_0x0d25('0x1e')](_0x38feb8[_0x0d25('0x30')][_0x0d25('0x1e')]);}return _0x4db1b4['getTags'](_0x18d387);}})['then'](function(_0x11a863){if(_0x11a863){return _0x11a863?{'count':_0x295bd7,'rows':_0x11a863}:null;}})[_0x0d25('0x25')](respondWithResult(_0x42ecbf,null))[_0x0d25('0x42')](handleError(_0x42ecbf,null));};exports[_0x0d25('0x53')]=function(_0x5b5262,_0x3f7b0a,_0x34ad10){if(_0x5b5262[_0x0d25('0x47')]['id']){delete _0x5b5262[_0x0d25('0x47')]['id'];}return db[_0x0d25('0x3f')][_0x0d25('0x4d')]({'where':{'id':_0x5b5262['params']['id']}})[_0x0d25('0x25')](handleEntityNotFound(_0x3f7b0a,null))[_0x0d25('0x25')](function(_0x4fbb14){if(_0x4fbb14){return _0x4fbb14[_0x0d25('0x53')](_0x5b5262[_0x0d25('0x47')]['ids']||[]);}return null;})[_0x0d25('0x25')](respondWithResult(_0x3f7b0a,null))[_0x0d25('0x42')](handleError(_0x3f7b0a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 845c7ee..61fad8d 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 _0x77e6=['path','../../config/environment','./intZendeskConfiguration.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x301a15,_0x27aa97){var _0x4843c9=function(_0xeba3e8){while(--_0xeba3e8){_0x301a15['push'](_0x301a15['shift']());}};_0x4843c9(++_0x27aa97);}(_0x77e6,0x1a6));var _0x677e=function(_0x5d77e1,_0x243fea){_0x5d77e1=_0x5d77e1-0x0;var _0x3392ac=_0x77e6[_0x5d77e1];return _0x3392ac;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var logger=require(_0x677e('0x2'))(_0x677e('0x3'));var moment=require(_0x677e('0x4'));var BPromise=require(_0x677e('0x5'));var rp=require(_0x677e('0x6'));var fs=require('fs');var path=require(_0x677e('0x7'));var rimraf=require('rimraf');var config=require(_0x677e('0x8'));var attributes=require(_0x677e('0x9'));module['exports']=function(_0x18c5e1,_0x591b21){return _0x18c5e1[_0x677e('0xa')]('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5204=['request-promise','path','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','moment','bluebird'];(function(_0xbac1ec,_0x2f59dc){var _0x1d5ce9=function(_0x18c604){while(--_0x18c604){_0xbac1ec['push'](_0xbac1ec['shift']());}};_0x1d5ce9(++_0x2f59dc);}(_0x5204,0xdf));var _0x4520=function(_0x5ff517,_0x3e4ee0){_0x5ff517=_0x5ff517-0x0;var _0x19a245=_0x5204[_0x5ff517];return _0x19a245;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var logger=require('../../config/logger')(_0x4520('0x2'));var moment=require(_0x4520('0x3'));var BPromise=require(_0x4520('0x4'));var rp=require(_0x4520('0x5'));var fs=require('fs');var path=require(_0x4520('0x6'));var rimraf=require('rimraf');var config=require(_0x4520('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x4520('0x8')]=function(_0x209381,_0xe0a256){return _0x209381[_0x4520('0x9')](_0x4520('0xa'),attributes,{'tableName':_0x4520('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index d58877f..2d109bc 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 _0x339f=['../../config/utils','../../config/logger','../../config/environment','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','ioredis','../../mysqldb'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x339f,0xe0));var _0xf339=function(_0x4cee43,_0xf0cb6e){_0x4cee43=_0x4cee43-0x0;var _0x4e8077=_0x339f[_0x4cee43];return _0x4e8077;};'use strict';var _=require(_0xf339('0x0'));var util=require('util');var moment=require(_0xf339('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf339('0x2'));var db=require(_0xf339('0x3'))['db'];var utils=require(_0xf339('0x4'));var logger=require(_0xf339('0x5'))('rpc');var config=require(_0xf339('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf339('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d0a50,_0x152f4f,_0x387285){return new BPromise(function(_0x2734cf,_0x1f1223){return client[_0xf339('0x8')](_0x3d0a50,_0x387285)[_0xf339('0x9')](function(_0xf7e01){logger[_0xf339('0xa')](_0xf339('0xb'),_0x152f4f,_0xf339('0xc'));logger[_0xf339('0xd')](_0xf339('0xe'),_0x152f4f,'request\x20sent',JSON['stringify'](_0xf7e01));if(_0xf7e01[_0xf339('0xf')]){if(_0xf7e01[_0xf339('0xf')]['code']===0x1f4){logger[_0xf339('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x152f4f,_0xf7e01[_0xf339('0xf')][_0xf339('0x10')]);return _0x1f1223(_0xf7e01['error'][_0xf339('0x10')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x152f4f,_0xf7e01['error'][_0xf339('0x10')]);return _0x2734cf(_0xf7e01[_0xf339('0xf')][_0xf339('0x10')]);}else{logger[_0xf339('0xa')](_0xf339('0xb'),_0x152f4f,_0xf339('0xc'));_0x2734cf(_0xf7e01[_0xf339('0x11')][_0xf339('0x10')]);}})[_0xf339('0x12')](function(_0x26340c){logger[_0xf339('0xf')](_0xf339('0xb'),_0x152f4f,_0x26340c);_0x1f1223(_0x26340c);});});} \ No newline at end of file +var _0xf0c8=['../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x52cf62,_0x5de2c5){var _0x55b3d8=function(_0x2d586f){while(--_0x2d586f){_0x52cf62['push'](_0x52cf62['shift']());}};_0x55b3d8(++_0x5de2c5);}(_0xf0c8,0xaa));var _0x8f0c=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0xf0c8[_0x5d30b4];return _0x1acfb8;};'use strict';var _=require(_0x8f0c('0x0'));var util=require(_0x8f0c('0x1'));var moment=require(_0x8f0c('0x2'));var BPromise=require(_0x8f0c('0x3'));var rs=require(_0x8f0c('0x4'));var fs=require('fs');var Redis=require(_0x8f0c('0x5'));var db=require(_0x8f0c('0x6'))['db'];var utils=require(_0x8f0c('0x7'));var logger=require('../../config/logger')(_0x8f0c('0x8'));var config=require(_0x8f0c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8f0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fdb62,_0x8d802,_0x42b132){return new BPromise(function(_0x4e8edb,_0x195495){return client[_0x8f0c('0xb')](_0x1fdb62,_0x42b132)[_0x8f0c('0xc')](function(_0x28d423){logger[_0x8f0c('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x8d802,_0x8f0c('0xe'));logger[_0x8f0c('0xf')](_0x8f0c('0x10'),_0x8d802,_0x8f0c('0xe'),JSON['stringify'](_0x28d423));if(_0x28d423[_0x8f0c('0x11')]){if(_0x28d423[_0x8f0c('0x11')]['code']===0x1f4){logger['error'](_0x8f0c('0x12'),_0x8d802,_0x28d423[_0x8f0c('0x11')][_0x8f0c('0x13')]);return _0x195495(_0x28d423[_0x8f0c('0x11')][_0x8f0c('0x13')]);}logger[_0x8f0c('0x11')](_0x8f0c('0x12'),_0x8d802,_0x28d423[_0x8f0c('0x11')]['message']);return _0x4e8edb(_0x28d423[_0x8f0c('0x11')][_0x8f0c('0x13')]);}else{logger[_0x8f0c('0xd')](_0x8f0c('0x12'),_0x8d802,_0x8f0c('0xe'));_0x4e8edb(_0x28d423[_0x8f0c('0x14')]['message']);}})[_0x8f0c('0x15')](function(_0x50a03e){logger[_0x8f0c('0x11')](_0x8f0c('0x12'),_0x8d802,_0x50a03e);_0x195495(_0x50a03e);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index fc6fa4f..8ef5b90 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 _0xd64e=['express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util'];(function(_0x15ad4d,_0x159d0f){var _0x395d3b=function(_0x11b713){while(--_0x11b713){_0x15ad4d['push'](_0x15ad4d['shift']());}};_0x395d3b(++_0x159d0f);}(_0xd64e,0xce));var _0xed64=function(_0x3fbf3d,_0x3a80f4){_0x3fbf3d=_0x3fbf3d-0x0;var _0x2ff7a8=_0xd64e[_0x3fbf3d];return _0x2ff7a8;};'use strict';var multer=require(_0xed64('0x0'));var util=require(_0xed64('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xed64('0x2'));var router=express['Router']();var fs_extra=require(_0xed64('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xed64('0x4'));var config=require(_0xed64('0x5'));var controller=require(_0xed64('0x6'));router[_0xed64('0x7')]('/',auth['isAuthenticated'](),controller[_0xed64('0x8')]);router['get'](_0xed64('0x9'),auth[_0xed64('0xa')](),controller[_0xed64('0xb')]);router['post']('/',auth[_0xed64('0xa')](),controller[_0xed64('0xc')]);router[_0xed64('0xd')](_0xed64('0x9'),auth[_0xed64('0xa')](),controller['update']);router['delete'](_0xed64('0x9'),auth[_0xed64('0xa')](),controller[_0xed64('0xe')]);module[_0xed64('0xf')]=router; \ No newline at end of file +var _0xaeae=['post','create','put','/:id','update','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','show'];(function(_0x4605dc,_0x3f7ae5){var _0x5d3e81=function(_0x1d0375){while(--_0x1d0375){_0x4605dc['push'](_0x4605dc['shift']());}};_0x5d3e81(++_0x3f7ae5);}(_0xaeae,0x166));var _0xeaea=function(_0x5be475,_0x43892e){_0x5be475=_0x5be475-0x0;var _0x47e579=_0xaeae[_0x5be475];return _0x47e579;};'use strict';var multer=require('multer');var util=require(_0xeaea('0x0'));var path=require('path');var timeout=require(_0xeaea('0x1'));var express=require(_0xeaea('0x2'));var router=express[_0xeaea('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xeaea('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xeaea('0x5'));var controller=require(_0xeaea('0x6'));router[_0xeaea('0x7')]('/',auth[_0xeaea('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xeaea('0x9')]);router[_0xeaea('0xa')]('/',auth[_0xeaea('0x8')](),controller[_0xeaea('0xb')]);router[_0xeaea('0xc')](_0xeaea('0xd'),auth[_0xeaea('0x8')](),controller[_0xeaea('0xe')]);router['delete'](_0xeaea('0xd'),auth[_0xeaea('0x8')](),controller['destroy']);module[_0xeaea('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 148a7cb..38cb43e 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 _0x43f3=['keyValue','picklist','STRING','customVariable','BOOLEAN','ENUM','string','variable'];(function(_0x14349b,_0x1eb24d){var _0x34f8cb=function(_0x100008){while(--_0x100008){_0x14349b['push'](_0x14349b['shift']());}};_0x34f8cb(++_0x1eb24d);}(_0x43f3,0x10d));var _0x343f=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0x43f3[_0x4ce028];return _0x583d0c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x343f('0x0')](_0x343f('0x1'),_0x343f('0x2'),'customVariable',_0x343f('0x3'),_0x343f('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x343f('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x343f('0x0')](_0x343f('0x1'),_0x343f('0x2'),_0x343f('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x343f('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x343f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x932c=['picklist','STRING','string','customVariable','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x2110d4,_0x20b1d5){var _0x2bcdf6=function(_0x1e9204){while(--_0x1e9204){_0x2110d4['push'](_0x2110d4['shift']());}};_0x2bcdf6(++_0x20b1d5);}(_0x932c,0xb9));var _0xc932=function(_0x2c6810,_0x23c079){_0x2c6810=_0x2c6810-0x0;var _0x213881=_0x932c[_0x2c6810];return _0x213881;};'use strict';var Sequelize=require(_0xc932('0x0'));module[_0xc932('0x1')]={'type':{'type':Sequelize[_0xc932('0x2')]('string',_0xc932('0x3'),'customVariable','keyValue',_0xc932('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc932('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc932('0x2')](_0xc932('0x6'),_0xc932('0x3'),_0xc932('0x7'))},'keyContent':{'type':Sequelize[_0xc932('0x5')]},'idField':{'type':Sequelize[_0xc932('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc932('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc932('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index f4167f2..b8f2234 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 _0xe0f5=['limit','count','offset','set','apply','reject','destroy','then','error','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined'];(function(_0x1061dc,_0x38b1c4){var _0x53bc34=function(_0x3dfb9a){while(--_0x3dfb9a){_0x1061dc['push'](_0x1061dc['shift']());}};_0x53bc34(++_0x38b1c4);}(_0xe0f5,0xfd));var _0x5e0f=function(_0x186511,_0x514c0b){_0x186511=_0x186511-0x0;var _0x17fc4d=_0xe0f5[_0x186511];return _0x17fc4d;};'use strict';var emlformat=require(_0x5e0f('0x0'));var rimraf=require(_0x5e0f('0x1'));var zipdir=require(_0x5e0f('0x2'));var jsonpatch=require(_0x5e0f('0x3'));var rp=require('request-promise');var moment=require(_0x5e0f('0x4'));var BPromise=require(_0x5e0f('0x5'));var Mustache=require(_0x5e0f('0x6'));var util=require(_0x5e0f('0x7'));var path=require(_0x5e0f('0x8'));var sox=require(_0x5e0f('0x9'));var csv=require(_0x5e0f('0xa'));var ejs=require(_0x5e0f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5e0f('0xc'));var crypto=require('crypto');var jsforce=require(_0x5e0f('0xd'));var deskjs=require(_0x5e0f('0xe'));var toCsv=require(_0x5e0f('0xa'));var querystring=require('querystring');var Papa=require(_0x5e0f('0xf'));var Redis=require(_0x5e0f('0x10'));var authService=require(_0x5e0f('0x11'));var qs=require(_0x5e0f('0x12'));var as=require(_0x5e0f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5e0f('0x14'));var licenseUtil=require(_0x5e0f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41d07d,_0x1de004){_0x1de004=_0x1de004||0xcc;return function(_0x2bf48b){if(_0x2bf48b){return _0x41d07d[_0x5e0f('0x16')](_0x1de004);}return _0x41d07d['status'](_0x1de004)[_0x5e0f('0x17')]();};}function respondWithResult(_0x1c91f5,_0x56e9ec){_0x56e9ec=_0x56e9ec||0xc8;return function(_0x470b14){if(_0x470b14){return _0x1c91f5[_0x5e0f('0x18')](_0x56e9ec)[_0x5e0f('0x19')](_0x470b14);}};}function respondWithFilteredResult(_0x4f0c6c,_0x16f9e5){return function(_0x52c989){if(_0x52c989){var _0x50af40=typeof _0x16f9e5['offset']===_0x5e0f('0x1a')&&typeof _0x16f9e5[_0x5e0f('0x1b')]===_0x5e0f('0x1a');var _0x22142c=_0x52c989[_0x5e0f('0x1c')];var _0x433c74=_0x50af40?0x0:_0x16f9e5['offset'];var _0x497a71=_0x50af40?_0x52c989[_0x5e0f('0x1c')]:_0x16f9e5[_0x5e0f('0x1d')]+_0x16f9e5[_0x5e0f('0x1b')];var _0x58e720;if(_0x497a71>=_0x22142c){_0x497a71=_0x22142c;_0x58e720=0xc8;}else{_0x58e720=0xce;}_0x4f0c6c[_0x5e0f('0x18')](_0x58e720);return _0x4f0c6c[_0x5e0f('0x1e')]('Content-Range',_0x433c74+'-'+_0x497a71+'/'+_0x22142c)[_0x5e0f('0x19')](_0x52c989);}return null;};}function patchUpdates(_0x22ae65){return function(_0x5bc3f2){try{jsonpatch[_0x5e0f('0x1f')](_0x5bc3f2,_0x22ae65,!![]);}catch(_0x1f17e8){return BPromise[_0x5e0f('0x20')](_0x1f17e8);}return _0x5bc3f2['save']();};}function saveUpdates(_0x44d303,_0x40b91d){return function(_0x50d104){if(_0x50d104){return _0x50d104['update'](_0x44d303)['then'](function(_0x5272ec){return _0x5272ec;});}return null;};}function removeEntity(_0x2b6eaa,_0xa2e754){return function(_0xd7a171){if(_0xd7a171){return _0xd7a171[_0x5e0f('0x21')]()[_0x5e0f('0x22')](function(){_0x2b6eaa[_0x5e0f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cdd03,_0x56971d){return function(_0x44a3c5){if(!_0x44a3c5){_0x4cdd03[_0x5e0f('0x16')](0x194);}return _0x44a3c5;};}function handleError(_0x4e79b5,_0x537095){_0x537095=_0x537095||0x1f4;return function(_0x10ea0f){logger[_0x5e0f('0x23')](_0x10ea0f['stack']);if(_0x10ea0f[_0x5e0f('0x24')]){delete _0x10ea0f['name'];}_0x4e79b5[_0x5e0f('0x18')](_0x537095)[_0x5e0f('0x25')](_0x10ea0f);};}exports[_0x5e0f('0x26')]=function(_0x38895b,_0x38cb9){var _0x2cee64={},_0x2dd911={},_0x57f829={'count':0x0,'rows':[]};var _0x16d4ec=_[_0x5e0f('0x27')](db[_0x5e0f('0x28')][_0x5e0f('0x29')],function(_0x683df4){return{'name':_0x683df4[_0x5e0f('0x2a')],'type':_0x683df4[_0x5e0f('0x2b')]['key']};});_0x2dd911['model']=_[_0x5e0f('0x27')](_0x16d4ec,_0x5e0f('0x24'));_0x2dd911['query']=_[_0x5e0f('0x2c')](_0x38895b[_0x5e0f('0x2d')]);_0x2dd911['filters']=_['intersection'](_0x2dd911[_0x5e0f('0x2e')],_0x2dd911['query']);_0x2cee64[_0x5e0f('0x2f')]=_[_0x5e0f('0x30')](_0x2dd911[_0x5e0f('0x2e')],qs[_0x5e0f('0x31')](_0x38895b['query'][_0x5e0f('0x31')]));_0x2cee64[_0x5e0f('0x2f')]=_0x2cee64[_0x5e0f('0x2f')][_0x5e0f('0x32')]?_0x2cee64[_0x5e0f('0x2f')]:_0x2dd911[_0x5e0f('0x2e')];if(!_0x38895b[_0x5e0f('0x2d')][_0x5e0f('0x33')](_0x5e0f('0x34'))){_0x2cee64[_0x5e0f('0x1b')]=qs[_0x5e0f('0x1b')](_0x38895b[_0x5e0f('0x2d')]['limit']);_0x2cee64[_0x5e0f('0x1d')]=qs[_0x5e0f('0x1d')](_0x38895b['query'][_0x5e0f('0x1d')]);}_0x2cee64[_0x5e0f('0x35')]=qs['sort'](_0x38895b['query'][_0x5e0f('0x36')]);_0x2cee64[_0x5e0f('0x37')]=qs[_0x5e0f('0x38')](_[_0x5e0f('0x39')](_0x38895b[_0x5e0f('0x2d')],_0x2dd911[_0x5e0f('0x38')]),_0x16d4ec);if(_0x38895b[_0x5e0f('0x2d')][_0x5e0f('0x3a')]){_0x2cee64['where']=_['merge'](_0x2cee64[_0x5e0f('0x37')],{'$or':_[_0x5e0f('0x27')](_0x16d4ec,function(_0x251f92){if(_0x251f92[_0x5e0f('0x2b')]!==_0x5e0f('0x3b')){var _0x46458e={};_0x46458e[_0x251f92[_0x5e0f('0x24')]]={'$like':'%'+_0x38895b['query'][_0x5e0f('0x3a')]+'%'};return _0x46458e;}})});}_0x2cee64=_[_0x5e0f('0x3c')]({},_0x2cee64,_0x38895b[_0x5e0f('0x3d')]);var _0x370748={'where':_0x2cee64[_0x5e0f('0x37')]};return db[_0x5e0f('0x28')][_0x5e0f('0x1c')](_0x370748)[_0x5e0f('0x22')](function(_0x8d44f1){_0x57f829[_0x5e0f('0x1c')]=_0x8d44f1;if(_0x38895b[_0x5e0f('0x2d')][_0x5e0f('0x3e')]){_0x2cee64[_0x5e0f('0x3f')]=[{'all':!![]}];}return db[_0x5e0f('0x28')][_0x5e0f('0x40')](_0x2cee64);})[_0x5e0f('0x22')](function(_0x1cf4e4){_0x57f829['rows']=_0x1cf4e4;return _0x57f829;})[_0x5e0f('0x22')](respondWithFilteredResult(_0x38cb9,_0x2cee64))[_0x5e0f('0x41')](handleError(_0x38cb9,null));};exports['show']=function(_0xe295e3,_0x9d5b11){var _0x42240d={'raw':!![],'where':{'id':_0xe295e3[_0x5e0f('0x42')]['id']}},_0xa47387={};_0xa47387[_0x5e0f('0x2e')]=_['keys'](db[_0x5e0f('0x28')][_0x5e0f('0x29')]);_0xa47387[_0x5e0f('0x2d')]=_['keys'](_0xe295e3[_0x5e0f('0x2d')]);_0xa47387['filters']=_['intersection'](_0xa47387['model'],_0xa47387['query']);_0x42240d[_0x5e0f('0x2f')]=_['intersection'](_0xa47387[_0x5e0f('0x2e')],qs['fields'](_0xe295e3['query'][_0x5e0f('0x31')]));_0x42240d['attributes']=_0x42240d[_0x5e0f('0x2f')][_0x5e0f('0x32')]?_0x42240d[_0x5e0f('0x2f')]:_0xa47387[_0x5e0f('0x2e')];if(_0xe295e3[_0x5e0f('0x2d')][_0x5e0f('0x3e')]){_0x42240d[_0x5e0f('0x3f')]=[{'all':!![]}];}_0x42240d=_[_0x5e0f('0x3c')]({},_0x42240d,_0xe295e3[_0x5e0f('0x3d')]);return db[_0x5e0f('0x28')][_0x5e0f('0x43')](_0x42240d)['then'](handleEntityNotFound(_0x9d5b11,null))[_0x5e0f('0x22')](respondWithResult(_0x9d5b11,null))['catch'](handleError(_0x9d5b11,null));};exports[_0x5e0f('0x44')]=function(_0x4cef1f,_0x21dad4){return db[_0x5e0f('0x28')][_0x5e0f('0x44')](_0x4cef1f['body'],{})[_0x5e0f('0x22')](respondWithResult(_0x21dad4,0xc9))[_0x5e0f('0x41')](handleError(_0x21dad4,null));};exports['update']=function(_0x30f77b,_0x1b7386){if(_0x30f77b[_0x5e0f('0x45')]['id']){delete _0x30f77b[_0x5e0f('0x45')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x30f77b['params']['id']}})[_0x5e0f('0x22')](handleEntityNotFound(_0x1b7386,null))[_0x5e0f('0x22')](saveUpdates(_0x30f77b[_0x5e0f('0x45')],null))[_0x5e0f('0x22')](respondWithResult(_0x1b7386,null))[_0x5e0f('0x41')](handleError(_0x1b7386,null));};exports[_0x5e0f('0x21')]=function(_0x583f26,_0x355b15){return db[_0x5e0f('0x28')][_0x5e0f('0x43')]({'where':{'id':_0x583f26[_0x5e0f('0x42')]['id']}})[_0x5e0f('0x22')](handleEntityNotFound(_0x355b15,null))[_0x5e0f('0x22')](removeEntity(_0x355b15,null))[_0x5e0f('0x41')](handleError(_0x355b15,null));}; \ No newline at end of file +var _0x8d53=['lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','ZendeskField','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x1f6a76,_0x1d89c0){var _0x5bd07d=function(_0x2d9bb7){while(--_0x2d9bb7){_0x1f6a76['push'](_0x1f6a76['shift']());}};_0x5bd07d(++_0x1d89c0);}(_0x8d53,0x1c2));var _0x38d5=function(_0x2e8889,_0xcd72f9){_0x2e8889=_0x2e8889-0x0;var _0x19dae6=_0x8d53[_0x2e8889];return _0x19dae6;};'use strict';var emlformat=require(_0x38d5('0x0'));var rimraf=require(_0x38d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38d5('0x2'));var rp=require(_0x38d5('0x3'));var moment=require(_0x38d5('0x4'));var BPromise=require(_0x38d5('0x5'));var Mustache=require(_0x38d5('0x6'));var util=require(_0x38d5('0x7'));var path=require(_0x38d5('0x8'));var sox=require(_0x38d5('0x9'));var csv=require('to-csv');var ejs=require(_0x38d5('0xa'));var fs=require('fs');var fs_extra=require(_0x38d5('0xb'));var _=require(_0x38d5('0xc'));var squel=require('squel');var crypto=require(_0x38d5('0xd'));var jsforce=require(_0x38d5('0xe'));var deskjs=require(_0x38d5('0xf'));var toCsv=require(_0x38d5('0x10'));var querystring=require(_0x38d5('0x11'));var Papa=require('papaparse');var Redis=require(_0x38d5('0x12'));var authService=require(_0x38d5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x38d5('0x14'));var hardwareService=require(_0x38d5('0x15'));var logger=require(_0x38d5('0x16'))(_0x38d5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x38d5('0x18'));var db=require(_0x38d5('0x19'))['db'];function respondWithStatusCode(_0x53c236,_0x421410){_0x421410=_0x421410||0xcc;return function(_0x4dbccf){if(_0x4dbccf){return _0x53c236[_0x38d5('0x1a')](_0x421410);}return _0x53c236[_0x38d5('0x1b')](_0x421410)[_0x38d5('0x1c')]();};}function respondWithResult(_0x413055,_0x217a90){_0x217a90=_0x217a90||0xc8;return function(_0x3115b5){if(_0x3115b5){return _0x413055['status'](_0x217a90)[_0x38d5('0x1d')](_0x3115b5);}};}function respondWithFilteredResult(_0x4c8f0f,_0xa455d1){return function(_0x53e995){if(_0x53e995){var _0x44cfa8=typeof _0xa455d1[_0x38d5('0x1e')]===_0x38d5('0x1f')&&typeof _0xa455d1['limit']===_0x38d5('0x1f');var _0x2a2b7d=_0x53e995[_0x38d5('0x20')];var _0xdc1374=_0x44cfa8?0x0:_0xa455d1[_0x38d5('0x1e')];var _0x380904=_0x44cfa8?_0x53e995['count']:_0xa455d1[_0x38d5('0x1e')]+_0xa455d1['limit'];var _0x55c0e1;if(_0x380904>=_0x2a2b7d){_0x380904=_0x2a2b7d;_0x55c0e1=0xc8;}else{_0x55c0e1=0xce;}_0x4c8f0f['status'](_0x55c0e1);return _0x4c8f0f[_0x38d5('0x21')](_0x38d5('0x22'),_0xdc1374+'-'+_0x380904+'/'+_0x2a2b7d)[_0x38d5('0x1d')](_0x53e995);}return null;};}function patchUpdates(_0x4c7ce3){return function(_0x48eb53){try{jsonpatch[_0x38d5('0x23')](_0x48eb53,_0x4c7ce3,!![]);}catch(_0x1c5289){return BPromise[_0x38d5('0x24')](_0x1c5289);}return _0x48eb53['save']();};}function saveUpdates(_0x3eb7d1,_0x58d42a){return function(_0x83a6be){if(_0x83a6be){return _0x83a6be[_0x38d5('0x25')](_0x3eb7d1)['then'](function(_0x567ef9){return _0x567ef9;});}return null;};}function removeEntity(_0x34d764,_0x4e1b5f){return function(_0x3d1c85){if(_0x3d1c85){return _0x3d1c85['destroy']()[_0x38d5('0x26')](function(){_0x34d764[_0x38d5('0x1b')](0xcc)[_0x38d5('0x1c')]();});}};}function handleEntityNotFound(_0x5b9552,_0x4b33ea){return function(_0x44b0d5){if(!_0x44b0d5){_0x5b9552['sendStatus'](0x194);}return _0x44b0d5;};}function handleError(_0x35e2ff,_0x1f8d11){_0x1f8d11=_0x1f8d11||0x1f4;return function(_0x12d220){logger[_0x38d5('0x27')](_0x12d220[_0x38d5('0x28')]);if(_0x12d220[_0x38d5('0x29')]){delete _0x12d220[_0x38d5('0x29')];}_0x35e2ff[_0x38d5('0x1b')](_0x1f8d11)[_0x38d5('0x2a')](_0x12d220);};}exports[_0x38d5('0x2b')]=function(_0x33d883,_0x3a8879){var _0x341af1={},_0x5dd0c1={},_0x514d2f={'count':0x0,'rows':[]};var _0x55a6d7=_[_0x38d5('0x2c')](db[_0x38d5('0x2d')]['rawAttributes'],function(_0x2f44be){return{'name':_0x2f44be[_0x38d5('0x2e')],'type':_0x2f44be[_0x38d5('0x2f')][_0x38d5('0x30')]};});_0x5dd0c1[_0x38d5('0x31')]=_['map'](_0x55a6d7,_0x38d5('0x29'));_0x5dd0c1[_0x38d5('0x32')]=_[_0x38d5('0x33')](_0x33d883[_0x38d5('0x32')]);_0x5dd0c1['filters']=_[_0x38d5('0x34')](_0x5dd0c1['model'],_0x5dd0c1[_0x38d5('0x32')]);_0x341af1['attributes']=_[_0x38d5('0x34')](_0x5dd0c1[_0x38d5('0x31')],qs['fields'](_0x33d883[_0x38d5('0x32')][_0x38d5('0x35')]));_0x341af1[_0x38d5('0x36')]=_0x341af1['attributes'][_0x38d5('0x37')]?_0x341af1['attributes']:_0x5dd0c1[_0x38d5('0x31')];if(!_0x33d883[_0x38d5('0x32')][_0x38d5('0x38')](_0x38d5('0x39'))){_0x341af1['limit']=qs[_0x38d5('0x3a')](_0x33d883[_0x38d5('0x32')]['limit']);_0x341af1[_0x38d5('0x1e')]=qs[_0x38d5('0x1e')](_0x33d883[_0x38d5('0x32')][_0x38d5('0x1e')]);}_0x341af1[_0x38d5('0x3b')]=qs[_0x38d5('0x3c')](_0x33d883[_0x38d5('0x32')][_0x38d5('0x3c')]);_0x341af1['where']=qs[_0x38d5('0x3d')](_['pick'](_0x33d883[_0x38d5('0x32')],_0x5dd0c1[_0x38d5('0x3d')]),_0x55a6d7);if(_0x33d883[_0x38d5('0x32')]['filter']){_0x341af1['where']=_[_0x38d5('0x3e')](_0x341af1[_0x38d5('0x3f')],{'$or':_[_0x38d5('0x2c')](_0x55a6d7,function(_0x4affd3){if(_0x4affd3['type']!==_0x38d5('0x40')){var _0x34b7ca={};_0x34b7ca[_0x4affd3[_0x38d5('0x29')]]={'$like':'%'+_0x33d883[_0x38d5('0x32')]['filter']+'%'};return _0x34b7ca;}})});}_0x341af1=_[_0x38d5('0x3e')]({},_0x341af1,_0x33d883[_0x38d5('0x41')]);var _0x3d16eb={'where':_0x341af1[_0x38d5('0x3f')]};return db['ZendeskField']['count'](_0x3d16eb)['then'](function(_0x13ef36){_0x514d2f[_0x38d5('0x20')]=_0x13ef36;if(_0x33d883[_0x38d5('0x32')][_0x38d5('0x42')]){_0x341af1[_0x38d5('0x43')]=[{'all':!![]}];}return db[_0x38d5('0x2d')]['findAll'](_0x341af1);})[_0x38d5('0x26')](function(_0x2d8122){_0x514d2f[_0x38d5('0x44')]=_0x2d8122;return _0x514d2f;})[_0x38d5('0x26')](respondWithFilteredResult(_0x3a8879,_0x341af1))[_0x38d5('0x45')](handleError(_0x3a8879,null));};exports[_0x38d5('0x46')]=function(_0x5bbada,_0x38d4cf){var _0xdd589e={'raw':!![],'where':{'id':_0x5bbada[_0x38d5('0x47')]['id']}},_0x48612c={};_0x48612c[_0x38d5('0x31')]=_[_0x38d5('0x33')](db[_0x38d5('0x2d')][_0x38d5('0x48')]);_0x48612c[_0x38d5('0x32')]=_[_0x38d5('0x33')](_0x5bbada[_0x38d5('0x32')]);_0x48612c['filters']=_[_0x38d5('0x34')](_0x48612c['model'],_0x48612c['query']);_0xdd589e[_0x38d5('0x36')]=_['intersection'](_0x48612c['model'],qs['fields'](_0x5bbada['query']['fields']));_0xdd589e['attributes']=_0xdd589e['attributes']['length']?_0xdd589e[_0x38d5('0x36')]:_0x48612c[_0x38d5('0x31')];if(_0x5bbada[_0x38d5('0x32')][_0x38d5('0x42')]){_0xdd589e[_0x38d5('0x43')]=[{'all':!![]}];}_0xdd589e=_[_0x38d5('0x3e')]({},_0xdd589e,_0x5bbada[_0x38d5('0x41')]);return db[_0x38d5('0x2d')][_0x38d5('0x49')](_0xdd589e)[_0x38d5('0x26')](handleEntityNotFound(_0x38d4cf,null))[_0x38d5('0x26')](respondWithResult(_0x38d4cf,null))[_0x38d5('0x45')](handleError(_0x38d4cf,null));};exports[_0x38d5('0x4a')]=function(_0x11f266,_0x22b866){return db[_0x38d5('0x2d')][_0x38d5('0x4a')](_0x11f266[_0x38d5('0x4b')],{})[_0x38d5('0x26')](respondWithResult(_0x22b866,0xc9))['catch'](handleError(_0x22b866,null));};exports['update']=function(_0x4bdd78,_0x91cd1d){if(_0x4bdd78[_0x38d5('0x4b')]['id']){delete _0x4bdd78[_0x38d5('0x4b')]['id'];}return db[_0x38d5('0x2d')][_0x38d5('0x49')]({'where':{'id':_0x4bdd78[_0x38d5('0x47')]['id']}})[_0x38d5('0x26')](handleEntityNotFound(_0x91cd1d,null))[_0x38d5('0x26')](saveUpdates(_0x4bdd78[_0x38d5('0x4b')],null))[_0x38d5('0x26')](respondWithResult(_0x91cd1d,null))[_0x38d5('0x45')](handleError(_0x91cd1d,null));};exports[_0x38d5('0x4c')]=function(_0x2810c4,_0x2aa73d){return db['ZendeskField'][_0x38d5('0x49')]({'where':{'id':_0x2810c4[_0x38d5('0x47')]['id']}})[_0x38d5('0x26')](handleEntityNotFound(_0x2aa73d,null))[_0x38d5('0x26')](removeEntity(_0x2aa73d,null))['catch'](handleError(_0x2aa73d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 2c7a519..1e2ac10 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 _0x67c3=['./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x495977,_0x107906){var _0x2105f8=function(_0x4af937){while(--_0x4af937){_0x495977['push'](_0x495977['shift']());}};_0x2105f8(++_0x107906);}(_0x67c3,0x159));var _0x367c=function(_0x2d67fa,_0x4edc78){_0x2d67fa=_0x2d67fa-0x0;var _0x350f91=_0x67c3[_0x2d67fa];return _0x350f91;};'use strict';var _=require(_0x367c('0x0'));var util=require('util');var logger=require(_0x367c('0x1'))('api');var moment=require(_0x367c('0x2'));var BPromise=require(_0x367c('0x3'));var rp=require(_0x367c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x367c('0x5'));var config=require('../../config/environment');var attributes=require(_0x367c('0x6'));module[_0x367c('0x7')]=function(_0x2b92c1,_0x57a182){return _0x2b92c1[_0x367c('0x8')](_0x367c('0x9'),attributes,{'tableName':_0x367c('0xa'),'paranoid':![],'indexes':[{'name':_0x367c('0xb'),'fields':[_0x367c('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e4e=['bluebird','request-promise','path','rimraf','../../config/environment','define','ZendeskField','int_zendesk_fields','FieldId','../../config/logger','api'];(function(_0x43fe0a,_0x4af4de){var _0x1d1f67=function(_0x3d6d0d){while(--_0x3d6d0d){_0x43fe0a['push'](_0x43fe0a['shift']());}};_0x1d1f67(++_0x4af4de);}(_0x1e4e,0x82));var _0xe1e4=function(_0x518f96,_0x1942b2){_0x518f96=_0x518f96-0x0;var _0x48d7b9=_0x1e4e[_0x518f96];return _0x48d7b9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe1e4('0x0'))(_0xe1e4('0x1'));var moment=require('moment');var BPromise=require(_0xe1e4('0x2'));var rp=require(_0xe1e4('0x3'));var fs=require('fs');var path=require(_0xe1e4('0x4'));var rimraf=require(_0xe1e4('0x5'));var config=require(_0xe1e4('0x6'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x2bfadb,_0x5f185b){return _0x2bfadb[_0xe1e4('0x7')](_0xe1e4('0x8'),attributes,{'tableName':_0xe1e4('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xe1e4('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 21dd764..295446d 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 _0x4a1a=['request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x58a5e7,_0x46cacd){var _0x41e8f2=function(_0x22035e){while(--_0x22035e){_0x58a5e7['push'](_0x58a5e7['shift']());}};_0x41e8f2(++_0x46cacd);}(_0x4a1a,0x181));var _0xa4a1=function(_0x549f69,_0x3a1680){_0x549f69=_0x549f69-0x0;var _0x5cc403=_0x4a1a[_0x549f69];return _0x5cc403;};'use strict';var _=require('lodash');var util=require(_0xa4a1('0x0'));var moment=require(_0xa4a1('0x1'));var BPromise=require('bluebird');var rs=require(_0xa4a1('0x2'));var fs=require('fs');var Redis=require(_0xa4a1('0x3'));var db=require(_0xa4a1('0x4'))['db'];var utils=require(_0xa4a1('0x5'));var logger=require('../../config/logger')(_0xa4a1('0x6'));var config=require(_0xa4a1('0x7'));var jayson=require(_0xa4a1('0x8'));var client=jayson[_0xa4a1('0x9')][_0xa4a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37262c,_0x39e8b9,_0x54cb4e){return new BPromise(function(_0x1d4251,_0x11112d){return client[_0xa4a1('0xb')](_0x37262c,_0x54cb4e)['then'](function(_0x40f022){logger[_0xa4a1('0xc')](_0xa4a1('0xd'),_0x39e8b9,_0xa4a1('0xe'));logger[_0xa4a1('0xf')](_0xa4a1('0x10'),_0x39e8b9,_0xa4a1('0xe'),JSON[_0xa4a1('0x11')](_0x40f022));if(_0x40f022[_0xa4a1('0x12')]){if(_0x40f022[_0xa4a1('0x12')][_0xa4a1('0x13')]===0x1f4){logger[_0xa4a1('0x12')](_0xa4a1('0xd'),_0x39e8b9,_0x40f022[_0xa4a1('0x12')][_0xa4a1('0x14')]);return _0x11112d(_0x40f022['error']['message']);}logger[_0xa4a1('0x12')](_0xa4a1('0xd'),_0x39e8b9,_0x40f022[_0xa4a1('0x12')]['message']);return _0x1d4251(_0x40f022['error'][_0xa4a1('0x14')]);}else{logger[_0xa4a1('0xc')](_0xa4a1('0xd'),_0x39e8b9,_0xa4a1('0xe'));_0x1d4251(_0x40f022['result']['message']);}})[_0xa4a1('0x15')](function(_0x216fb1){logger[_0xa4a1('0x12')](_0xa4a1('0xd'),_0x39e8b9,_0x216fb1);_0x11112d(_0x216fb1);});});} \ No newline at end of file +var _0x46d2=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x262c5f,_0x5ed814){var _0x14a0bc=function(_0x519217){while(--_0x519217){_0x262c5f['push'](_0x262c5f['shift']());}};_0x14a0bc(++_0x5ed814);}(_0x46d2,0xbf));var _0x246d=function(_0x262f19,_0x34e866){_0x262f19=_0x262f19-0x0;var _0xf0ae2f=_0x46d2[_0x262f19];return _0xf0ae2f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x246d('0x0'));var BPromise=require(_0x246d('0x1'));var rs=require(_0x246d('0x2'));var fs=require('fs');var Redis=require(_0x246d('0x3'));var db=require(_0x246d('0x4'))['db'];var utils=require(_0x246d('0x5'));var logger=require(_0x246d('0x6'))('rpc');var config=require(_0x246d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x246d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d3288,_0x162cf0,_0x457f7){return new BPromise(function(_0x20d754,_0x54366a){return client[_0x246d('0x9')](_0x3d3288,_0x457f7)[_0x246d('0xa')](function(_0x451197){logger['info'](_0x246d('0xb'),_0x162cf0,_0x246d('0xc'));logger[_0x246d('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x162cf0,'request\x20sent',JSON[_0x246d('0xe')](_0x451197));if(_0x451197[_0x246d('0xf')]){if(_0x451197[_0x246d('0xf')]['code']===0x1f4){logger['error'](_0x246d('0xb'),_0x162cf0,_0x451197[_0x246d('0xf')]['message']);return _0x54366a(_0x451197['error'][_0x246d('0x10')]);}logger[_0x246d('0xf')](_0x246d('0xb'),_0x162cf0,_0x451197[_0x246d('0xf')][_0x246d('0x10')]);return _0x20d754(_0x451197[_0x246d('0xf')]['message']);}else{logger['info'](_0x246d('0xb'),_0x162cf0,'request\x20sent');_0x20d754(_0x451197[_0x246d('0x11')][_0x246d('0x10')]);}})[_0x246d('0x12')](function(_0x1e4c56){logger[_0x246d('0xf')](_0x246d('0xb'),_0x162cf0,_0x1e4c56);_0x54366a(_0x1e4c56);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index d2a4735..54b678f 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 _0xd2bd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','express','Router'];(function(_0x1bea0f,_0x4e2edb){var _0xd24123=function(_0x46cd7d){while(--_0x46cd7d){_0x1bea0f['push'](_0x1bea0f['shift']());}};_0xd24123(++_0x4e2edb);}(_0xd2bd,0x154));var _0xdd2b=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0xd2bd[_0x4914e2];return _0x2dcd07;};'use strict';var multer=require(_0xdd2b('0x0'));var util=require(_0xdd2b('0x1'));var path=require(_0xdd2b('0x2'));var timeout=require('connect-timeout');var express=require(_0xdd2b('0x3'));var router=express[_0xdd2b('0x4')]();var fs_extra=require(_0xdd2b('0x5'));var auth=require(_0xdd2b('0x6'));var interaction=require(_0xdd2b('0x7'));var config=require(_0xdd2b('0x8'));var controller=require(_0xdd2b('0x9'));router[_0xdd2b('0xa')]('/',auth['isAuthenticated'](),controller[_0xdd2b('0xb')]);router[_0xdd2b('0xa')](_0xdd2b('0xc'),auth[_0xdd2b('0xd')](),controller['show']);router[_0xdd2b('0xa')](_0xdd2b('0xe'),auth[_0xdd2b('0xd')](),controller['getConfigurations']);router[_0xdd2b('0xa')]('/:id/fields',auth[_0xdd2b('0xd')](),controller[_0xdd2b('0xf')]);router[_0xdd2b('0x10')]('/',auth['isAuthenticated'](),controller[_0xdd2b('0x11')]);router[_0xdd2b('0x10')]('/:id/configurations',auth[_0xdd2b('0xd')](),controller[_0xdd2b('0x12')]);router[_0xdd2b('0x13')](_0xdd2b('0xc'),auth[_0xdd2b('0xd')](),controller[_0xdd2b('0x14')]);router[_0xdd2b('0x15')](_0xdd2b('0xc'),auth['isAuthenticated'](),controller[_0xdd2b('0x16')]);module['exports']=router; \ No newline at end of file +var _0x6324=['create','post','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields'];(function(_0x433b8c,_0xa246f1){var _0x37d1a2=function(_0x75df79){while(--_0x75df79){_0x433b8c['push'](_0x433b8c['shift']());}};_0x37d1a2(++_0xa246f1);}(_0x6324,0x110));var _0x4632=function(_0x14909f,_0xe25f2e){_0x14909f=_0x14909f-0x0;var _0x19698c=_0x6324[_0x14909f];return _0x19698c;};'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(_0x4632('0x5'));var auth=require(_0x4632('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x7'));var controller=require('./intZohoAccount.controller');router[_0x4632('0x8')]('/',auth[_0x4632('0x9')](),controller[_0x4632('0xa')]);router[_0x4632('0x8')](_0x4632('0xb'),auth[_0x4632('0x9')](),controller[_0x4632('0xc')]);router[_0x4632('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4632('0xd')]);router['get'](_0x4632('0xe'),auth['isAuthenticated'](),controller[_0x4632('0xf')]);router['post']('/',auth[_0x4632('0x9')](),controller[_0x4632('0x10')]);router[_0x4632('0x11')](_0x4632('0x12'),auth[_0x4632('0x9')](),controller[_0x4632('0x13')]);router[_0x4632('0x14')](_0x4632('0xb'),auth[_0x4632('0x9')](),controller['update']);router[_0x4632('0x15')](_0x4632('0xb'),auth[_0x4632('0x9')](),controller[_0x4632('0x16')]);module[_0x4632('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index f045598..b70d47f 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 _0x4b84=['STRING','sequelize','exports'];(function(_0x35ff7a,_0x4cdf1b){var _0x321ba7=function(_0x12b0d3){while(--_0x12b0d3){_0x35ff7a['push'](_0x35ff7a['shift']());}};_0x321ba7(++_0x4cdf1b);}(_0x4b84,0x1cc));var _0x44b8=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0x4b84[_0x265003];return _0x33c743;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x44b8('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x44b8('0x2')]},'serverUrl':{'type':Sequelize[_0x44b8('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x44b8('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4522=['STRING'];(function(_0x4f7083,_0x12577a){var _0x3e30f8=function(_0x96847e){while(--_0x96847e){_0x4f7083['push'](_0x4f7083['shift']());}};_0x3e30f8(++_0x12577a);}(_0x4522,0x1a0));var _0x2452=function(_0x180b9c,_0x663206){_0x180b9c=_0x180b9c-0x0;var _0x51baad=_0x4522[_0x180b9c];return _0x51baad;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2452('0x0')]},'description':{'type':Sequelize[_0x2452('0x0')]},'host':{'type':Sequelize[_0x2452('0x0')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2452('0x0')]},'clientSecret':{'type':Sequelize[_0x2452('0x0')]},'serverUrl':{'type':Sequelize[_0x2452('0x0')],'allowNull':![]},'code':{'type':Sequelize[_0x2452('0x0')]},'refreshToken':{'type':Sequelize[_0x2452('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 9b82fa9..f45f1fb 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 _0xd8c6=['AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','getFields','serverUrl','code','host','zoho.eu','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','response','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','name','send','index','map','ZohoAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','hasOwnProperty'];(function(_0x5cb9fc,_0x3c5573){var _0x50e24e=function(_0x54943e){while(--_0x54943e){_0x5cb9fc['push'](_0x5cb9fc['shift']());}};_0x50e24e(++_0x3c5573);}(_0xd8c6,0x12a));var _0x6d8c=function(_0x2944a4,_0x21a845){_0x2944a4=_0x2944a4-0x0;var _0x46476e=_0xd8c6[_0x2944a4];return _0x46476e;};'use strict';var emlformat=require(_0x6d8c('0x0'));var rimraf=require(_0x6d8c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d8c('0x2'));var rp=require('request-promise');var moment=require(_0x6d8c('0x3'));var BPromise=require(_0x6d8c('0x4'));var Mustache=require(_0x6d8c('0x5'));var util=require(_0x6d8c('0x6'));var path=require(_0x6d8c('0x7'));var sox=require(_0x6d8c('0x8'));var csv=require(_0x6d8c('0x9'));var ejs=require(_0x6d8c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6d8c('0xb'));var crypto=require('crypto');var jsforce=require(_0x6d8c('0xc'));var deskjs=require(_0x6d8c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d8c('0xe'));var authService=require(_0x6d8c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6d8c('0x10'));var hardwareService=require(_0x6d8c('0x11'));var logger=require(_0x6d8c('0x12'))(_0x6d8c('0x13'));var utils=require(_0x6d8c('0x14'));var config=require(_0x6d8c('0x15'));var licenseUtil=require(_0x6d8c('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4fcf6a,_0x3c09b9){_0x3c09b9=_0x3c09b9||0xcc;return function(_0x435e3b){if(_0x435e3b){return _0x4fcf6a[_0x6d8c('0x17')](_0x3c09b9);}return _0x4fcf6a[_0x6d8c('0x18')](_0x3c09b9)[_0x6d8c('0x19')]();};}function respondWithResult(_0x4253bb,_0x50a0b7){_0x50a0b7=_0x50a0b7||0xc8;return function(_0x34fa9b){if(_0x34fa9b){return _0x4253bb[_0x6d8c('0x18')](_0x50a0b7)[_0x6d8c('0x1a')](_0x34fa9b);}};}function respondWithFilteredResult(_0x46b325,_0x13f59c){return function(_0x511325){if(_0x511325){var _0x467346=typeof _0x13f59c[_0x6d8c('0x1b')]===_0x6d8c('0x1c')&&typeof _0x13f59c[_0x6d8c('0x1d')]===_0x6d8c('0x1c');var _0x2ba013=_0x511325[_0x6d8c('0x1e')];var _0x5875c7=_0x467346?0x0:_0x13f59c[_0x6d8c('0x1b')];var _0x752d08=_0x467346?_0x511325['count']:_0x13f59c[_0x6d8c('0x1b')]+_0x13f59c[_0x6d8c('0x1d')];var _0x5477ed;if(_0x752d08>=_0x2ba013){_0x752d08=_0x2ba013;_0x5477ed=0xc8;}else{_0x5477ed=0xce;}_0x46b325['status'](_0x5477ed);return _0x46b325[_0x6d8c('0x1f')](_0x6d8c('0x20'),_0x5875c7+'-'+_0x752d08+'/'+_0x2ba013)[_0x6d8c('0x1a')](_0x511325);}return null;};}function patchUpdates(_0x123028){return function(_0x2f6807){try{jsonpatch[_0x6d8c('0x21')](_0x2f6807,_0x123028,!![]);}catch(_0x1e59c2){return BPromise['reject'](_0x1e59c2);}return _0x2f6807['save']();};}function saveUpdates(_0x58bd79,_0x2390ea){return function(_0x5d0263){if(_0x5d0263){return _0x5d0263[_0x6d8c('0x22')](_0x58bd79)[_0x6d8c('0x23')](function(_0x308b56){return _0x308b56;});}return null;};}function removeEntity(_0x2f1dba,_0x8fe776){return function(_0x1048c8){if(_0x1048c8){return _0x1048c8[_0x6d8c('0x24')]()[_0x6d8c('0x23')](function(){_0x2f1dba['status'](0xcc)[_0x6d8c('0x19')]();});}};}function handleEntityNotFound(_0x5425cf,_0x38b5cd){return function(_0x2da215){if(!_0x2da215){_0x5425cf[_0x6d8c('0x17')](0x194);}return _0x2da215;};}function handleError(_0x2a68e7,_0x3b58e1){_0x3b58e1=_0x3b58e1||0x1f4;return function(_0x4377b7){logger[_0x6d8c('0x25')](_0x4377b7['stack']);if(_0x4377b7['name']){delete _0x4377b7[_0x6d8c('0x26')];}_0x2a68e7[_0x6d8c('0x18')](_0x3b58e1)[_0x6d8c('0x27')](_0x4377b7);};}exports[_0x6d8c('0x28')]=function(_0x3bda91,_0x1e95fb){var _0x565f09={},_0x2aa5c6={},_0x59ac0b={'count':0x0,'rows':[]};var _0x3f1d82=_[_0x6d8c('0x29')](db[_0x6d8c('0x2a')][_0x6d8c('0x2b')],function(_0x55e349){return{'name':_0x55e349[_0x6d8c('0x2c')],'type':_0x55e349['type']['key']};});_0x2aa5c6[_0x6d8c('0x2d')]=_[_0x6d8c('0x29')](_0x3f1d82,'name');_0x2aa5c6[_0x6d8c('0x2e')]=_[_0x6d8c('0x2f')](_0x3bda91[_0x6d8c('0x2e')]);_0x2aa5c6[_0x6d8c('0x30')]=_[_0x6d8c('0x31')](_0x2aa5c6[_0x6d8c('0x2d')],_0x2aa5c6['query']);_0x565f09['attributes']=_['intersection'](_0x2aa5c6[_0x6d8c('0x2d')],qs[_0x6d8c('0x32')](_0x3bda91[_0x6d8c('0x2e')][_0x6d8c('0x32')]));_0x565f09[_0x6d8c('0x33')]=_0x565f09[_0x6d8c('0x33')][_0x6d8c('0x34')]?_0x565f09['attributes']:_0x2aa5c6['model'];if(!_0x3bda91['query']['hasOwnProperty'](_0x6d8c('0x35'))){_0x565f09['limit']=qs['limit'](_0x3bda91[_0x6d8c('0x2e')]['limit']);_0x565f09['offset']=qs[_0x6d8c('0x1b')](_0x3bda91[_0x6d8c('0x2e')][_0x6d8c('0x1b')]);}_0x565f09[_0x6d8c('0x36')]=qs[_0x6d8c('0x37')](_0x3bda91[_0x6d8c('0x2e')][_0x6d8c('0x37')]);_0x565f09[_0x6d8c('0x38')]=qs[_0x6d8c('0x30')](_['pick'](_0x3bda91[_0x6d8c('0x2e')],_0x2aa5c6['filters']),_0x3f1d82);if(_0x3bda91['query'][_0x6d8c('0x39')]){_0x565f09[_0x6d8c('0x38')]=_[_0x6d8c('0x3a')](_0x565f09[_0x6d8c('0x38')],{'$or':_['map'](_0x3f1d82,function(_0x388b77){if(_0x388b77[_0x6d8c('0x3b')]!=='VIRTUAL'){var _0x573b92={};_0x573b92[_0x388b77[_0x6d8c('0x26')]]={'$like':'%'+_0x3bda91[_0x6d8c('0x2e')][_0x6d8c('0x39')]+'%'};return _0x573b92;}})});}_0x565f09=_[_0x6d8c('0x3a')]({},_0x565f09,_0x3bda91[_0x6d8c('0x3c')]);var _0x10a938={'where':_0x565f09[_0x6d8c('0x38')]};return db[_0x6d8c('0x2a')][_0x6d8c('0x1e')](_0x10a938)['then'](function(_0x1f7b66){_0x59ac0b[_0x6d8c('0x1e')]=_0x1f7b66;if(_0x3bda91[_0x6d8c('0x2e')][_0x6d8c('0x3d')]){_0x565f09[_0x6d8c('0x3e')]=[{'all':!![]}];}return db[_0x6d8c('0x2a')][_0x6d8c('0x3f')](_0x565f09);})['then'](function(_0x2324b5){_0x59ac0b[_0x6d8c('0x40')]=_0x2324b5;return _0x59ac0b;})['then'](respondWithFilteredResult(_0x1e95fb,_0x565f09))[_0x6d8c('0x41')](handleError(_0x1e95fb,null));};exports[_0x6d8c('0x42')]=function(_0x401ae1,_0x11a63e){var _0x45db0b={'raw':![],'where':{'id':_0x401ae1[_0x6d8c('0x43')]['id']}},_0x68de10={};_0x68de10[_0x6d8c('0x2d')]=_[_0x6d8c('0x2f')](db[_0x6d8c('0x2a')][_0x6d8c('0x2b')]);_0x68de10[_0x6d8c('0x2e')]=_[_0x6d8c('0x2f')](_0x401ae1[_0x6d8c('0x2e')]);_0x68de10[_0x6d8c('0x30')]=_['intersection'](_0x68de10[_0x6d8c('0x2d')],_0x68de10[_0x6d8c('0x2e')]);_0x45db0b['attributes']=_['intersection'](_0x68de10['model'],qs['fields'](_0x401ae1['query'][_0x6d8c('0x32')]));_0x45db0b[_0x6d8c('0x33')]=_0x45db0b[_0x6d8c('0x33')]['length']?_0x45db0b[_0x6d8c('0x33')]:_0x68de10[_0x6d8c('0x2d')];if(_0x401ae1[_0x6d8c('0x2e')][_0x6d8c('0x3d')]){_0x45db0b['include']=[{'all':!![]}];}_0x45db0b=_[_0x6d8c('0x3a')]({},_0x45db0b,_0x401ae1[_0x6d8c('0x3c')]);return db['ZohoAccount']['find'](_0x45db0b)[_0x6d8c('0x23')](handleEntityNotFound(_0x11a63e,null))[_0x6d8c('0x23')](respondWithResult(_0x11a63e,null))[_0x6d8c('0x41')](handleError(_0x11a63e,null));};exports[_0x6d8c('0x44')]=function(_0x45f9b1,_0x350d29){return db[_0x6d8c('0x2a')][_0x6d8c('0x44')](_0x45f9b1[_0x6d8c('0x45')],{})[_0x6d8c('0x23')](respondWithResult(_0x350d29,0xc9))[_0x6d8c('0x41')](handleError(_0x350d29,null));};exports[_0x6d8c('0x22')]=function(_0x154dab,_0x471cef){if(_0x154dab[_0x6d8c('0x45')]['id']){delete _0x154dab['body']['id'];}return db['ZohoAccount'][_0x6d8c('0x46')]({'where':{'id':_0x154dab[_0x6d8c('0x43')]['id']}})[_0x6d8c('0x23')](handleEntityNotFound(_0x471cef,null))[_0x6d8c('0x23')](saveUpdates(_0x154dab[_0x6d8c('0x45')],null))[_0x6d8c('0x23')](respondWithResult(_0x471cef,null))[_0x6d8c('0x41')](handleError(_0x471cef,null));};exports[_0x6d8c('0x24')]=function(_0x19d150,_0x1861e9){return db['ZohoAccount'][_0x6d8c('0x46')]({'where':{'id':_0x19d150[_0x6d8c('0x43')]['id']}})[_0x6d8c('0x23')](handleEntityNotFound(_0x1861e9,null))[_0x6d8c('0x23')](removeEntity(_0x1861e9,null))[_0x6d8c('0x41')](handleError(_0x1861e9,null));};exports[_0x6d8c('0x47')]=function(_0x3d3af4,_0x114991,_0x3d08d9){var _0x43e428={};var _0x5c532c={};var _0x1ec433;var _0x311ec6;return db[_0x6d8c('0x2a')][_0x6d8c('0x48')]({'where':{'id':_0x3d3af4[_0x6d8c('0x43')]['id']}})[_0x6d8c('0x23')](handleEntityNotFound(_0x114991,null))[_0x6d8c('0x23')](function(_0x1da27f){if(_0x1da27f){_0x1ec433=_0x1da27f;_0x5c532c[_0x6d8c('0x2d')]=_['keys'](db['ZohoConfiguration'][_0x6d8c('0x2b')]);_0x5c532c[_0x6d8c('0x2e')]=_[_0x6d8c('0x2f')](_0x3d3af4['query']);_0x5c532c[_0x6d8c('0x30')]=_[_0x6d8c('0x31')](_0x5c532c[_0x6d8c('0x2d')],_0x5c532c[_0x6d8c('0x2e')]);_0x43e428[_0x6d8c('0x33')]=_[_0x6d8c('0x31')](_0x5c532c['model'],qs[_0x6d8c('0x32')](_0x3d3af4['query']['fields']));_0x43e428[_0x6d8c('0x33')]=_0x43e428[_0x6d8c('0x33')][_0x6d8c('0x34')]?_0x43e428[_0x6d8c('0x33')]:_0x5c532c[_0x6d8c('0x2d')];_0x43e428[_0x6d8c('0x36')]=qs['sort'](_0x3d3af4[_0x6d8c('0x2e')][_0x6d8c('0x37')]);_0x43e428[_0x6d8c('0x38')]=qs[_0x6d8c('0x30')](_['pick'](_0x3d3af4[_0x6d8c('0x2e')],_0x5c532c['filters']));if(_0x3d3af4[_0x6d8c('0x2e')][_0x6d8c('0x39')]){_0x43e428[_0x6d8c('0x38')]=_[_0x6d8c('0x3a')](_0x43e428['where'],{'$or':_[_0x6d8c('0x29')](_0x43e428[_0x6d8c('0x33')],function(_0x22b699){var _0x606334={};_0x606334[_0x22b699]={'$like':'%'+_0x3d3af4[_0x6d8c('0x2e')][_0x6d8c('0x39')]+'%'};return _0x606334;})});}_0x43e428=_['merge']({},_0x43e428,_0x3d3af4['options']);return _0x1ec433[_0x6d8c('0x47')](_0x43e428);}})[_0x6d8c('0x23')](function(_0x1f027a){if(_0x1f027a){_0x311ec6=_0x1f027a[_0x6d8c('0x34')];if(!_0x3d3af4[_0x6d8c('0x2e')][_0x6d8c('0x49')]('nolimit')){_0x43e428[_0x6d8c('0x1d')]=qs[_0x6d8c('0x1d')](_0x3d3af4[_0x6d8c('0x2e')][_0x6d8c('0x1d')]);_0x43e428[_0x6d8c('0x1b')]=qs[_0x6d8c('0x1b')](_0x3d3af4[_0x6d8c('0x2e')][_0x6d8c('0x1b')]);}return _0x1ec433['getConfigurations'](_0x43e428);}})[_0x6d8c('0x23')](function(_0x26c46b){if(_0x26c46b){return _0x26c46b?{'count':_0x311ec6,'rows':_0x26c46b}:null;}})[_0x6d8c('0x23')](respondWithResult(_0x114991,null))[_0x6d8c('0x41')](handleError(_0x114991,null));};exports['addConfiguration']=function(_0x2174ee,_0x3b85fb,_0x10c326){if(_0x2174ee['body']['id']){delete _0x2174ee['body']['id'];}return db[_0x6d8c('0x2a')]['findOne']({'where':{'id':_0x2174ee[_0x6d8c('0x43')]['id']}})[_0x6d8c('0x23')](handleEntityNotFound(_0x3b85fb,null))['then'](function(_0x1563bf){if(_0x1563bf){_0x2174ee[_0x6d8c('0x45')][_0x6d8c('0x4a')]=_0x1563bf['id'];_0x2174ee[_0x6d8c('0x45')][_0x6d8c('0x4b')]=integrations[_0x6d8c('0x4c')](_0x2174ee['body'][_0x6d8c('0x4d')],_0x2174ee['body']['type']);_0x2174ee['body'][_0x6d8c('0x4e')]=integrations[_0x6d8c('0x4f')](_0x2174ee[_0x6d8c('0x45')][_0x6d8c('0x4d')],_0x2174ee[_0x6d8c('0x45')][_0x6d8c('0x3b')]);return db[_0x6d8c('0x50')][_0x6d8c('0x44')](_0x2174ee[_0x6d8c('0x45')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x6d8c('0x51')],'as':'Descriptions'}]});}return null;})[_0x6d8c('0x23')](respondWithResult(_0x3b85fb,null))[_0x6d8c('0x41')](handleError(_0x3b85fb,null));};function getAccessToken(_0x1248be){return new Promise(function(_0x97a6df,_0x27fe1f){var _0x50394f;switch(_0x1248be[_0x6d8c('0x52')]){case'US':_0x50394f=_0x6d8c('0x53');break;case'AU':_0x50394f=_0x6d8c('0x54');break;case'EU':_0x50394f='https://accounts.zoho.eu';break;case'IN':_0x50394f='https://accounts.zoho.in';break;case'CN':_0x50394f=_0x6d8c('0x55');break;default:_0x50394f='https://accounts.zoho.eu';break;}var _0x112efd={'method':_0x6d8c('0x56'),'uri':_0x50394f+_0x6d8c('0x57'),'qs':{'refresh_token':_0x1248be[_0x6d8c('0x58')],'client_id':_0x1248be[_0x6d8c('0x59')],'client_secret':_0x1248be['clientSecret'],'grant_type':_0x6d8c('0x5a')},'json':!![]};return rp(_0x112efd)[_0x6d8c('0x23')](function(_0x459438){if(_0x459438[_0x6d8c('0x5b')]){_0x97a6df(_0x459438[_0x6d8c('0x5b')]);}else{_0x27fe1f('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x6d8c('0x41')](function(_0x1f451a){_0x27fe1f(_0x1f451a);});});}exports[_0x6d8c('0x5c')]=function(_0x22ccfa,_0x43883a,_0x344793){var _0x56171a,_0x12a066,_0x4abd87,_0x24c138,_0x59d9bf;return db[_0x6d8c('0x2a')][_0x6d8c('0x48')]({'where':{'id':_0x22ccfa[_0x6d8c('0x43')]['id']},'attributes':['id','host',_0x6d8c('0x52'),'clientId','clientSecret',_0x6d8c('0x5d'),_0x6d8c('0x5e'),_0x6d8c('0x58')]})[_0x6d8c('0x23')](handleEntityNotFound(_0x43883a,null))[_0x6d8c('0x23')](function(_0x2cee4e){_0x59d9bf=_0x2cee4e;_0x56171a=_0x59d9bf[_0x6d8c('0x5f')];_0x12a066=_0x56171a===_0x6d8c('0x60')?'eu':'com';_0x4abd87=_0x59d9bf[_0x6d8c('0x5d')];var _0x4384bd=_0x4abd87['slice'](-0x1);if(_0x4384bd==='/'||_0x4384bd==='\x5c'||_0x4384bd===':'){_0x4abd87=_0x4abd87[_0x6d8c('0x61')](0x0,_0x4abd87[_0x6d8c('0x62')](_0x4384bd));}if(!_0x59d9bf[_0x6d8c('0x58')]){throw new Error(_0x6d8c('0x63'));}return getAccessToken(_0x59d9bf);})[_0x6d8c('0x23')](function(_0x199668){if(_0x199668){return rp({'method':_0x6d8c('0x64'),'uri':util[_0x6d8c('0x65')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x12a066),'qs':{'module':_0x6d8c('0x66')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x199668},'json':!![]});}})['then'](function(_0x259668){if(_0x259668){if(_0x259668['response']&&_0x259668[_0x6d8c('0x67')][_0x6d8c('0x25')]){throw new Error(_0x259668[_0x6d8c('0x67')]['error']['message']);}var _0xeb23a=[];var _0x1e7d52=[];var _0x45d21e=['Owner',_0x6d8c('0x68'),_0x6d8c('0x69'),'WhoId',_0x6d8c('0x6a'),_0x6d8c('0x6b'),_0x6d8c('0x6c'),_0x6d8c('0x6d')];_0x1e7d52=_[_0x6d8c('0x6e')](_0x259668['fields'],function(_0x2b2ea9){return _0x45d21e[_0x6d8c('0x6f')](_0x2b2ea9[_0x6d8c('0x70')]);});for(var _0x40a996=0x0;_0x40a996<_0x1e7d52[_0x6d8c('0x34')];_0x40a996++){if(_0x1e7d52[_0x40a996][_0x6d8c('0x71')]===![]){_0xeb23a[_0x6d8c('0x72')]({'id':_0x1e7d52[_0x40a996]['id'],'name':_0x1e7d52[_0x40a996][_0x6d8c('0x73')],'custom':_0x1e7d52[_0x40a996][_0x6d8c('0x74')],'options':_0x1e7d52[_0x40a996][_0x6d8c('0x75')]===_0x6d8c('0x76')&&_0x1e7d52[_0x40a996][_0x6d8c('0x77')][_0x6d8c('0x34')]>-0x1?_[_0x6d8c('0x29')](_0x1e7d52[_0x40a996][_0x6d8c('0x77')],function(_0x294be0){return{'name':_0x294be0,'value':_0x294be0};}):[]});}}return{'count':_0xeb23a[_0x6d8c('0x34')],'rows':_0xeb23a};}else{return{'count':0x0,'rows':[]};}})[_0x6d8c('0x23')](respondWithResult(_0x43883a,null))[_0x6d8c('0x41')](function(_0x4d7e86){var _0x17b2ef=_0x22ccfa['query'][_0x6d8c('0x78')]?0x1f4:_0x4d7e86[_0x6d8c('0x79')]||0x1f4;logger['error'](_0x6d8c('0x7a'),'getFields',_0x17b2ef,JSON[_0x6d8c('0x7b')](_0x4d7e86));delete _0x4d7e86['name'];if(_0x17b2ef===0x191){_0x17b2ef=0x190;}_0x43883a['status'](_0x17b2ef)[_0x6d8c('0x27')](_0x22ccfa[_0x6d8c('0x2e')][_0x6d8c('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x4d7e86[_0x6d8c('0x79')]}:_0x4d7e86);});}; \ No newline at end of file +var _0x8ef1=['access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','code','zoho.eu','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','ZohoAccount','includeAll','include','show','params','create','body','find','catch','findOne','ZohoConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ef1,0x190));var _0x18ef=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x8ef1[_0x40a825];return _0x273a54;};'use strict';var emlformat=require(_0x18ef('0x0'));var rimraf=require(_0x18ef('0x1'));var zipdir=require(_0x18ef('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x18ef('0x3'));var moment=require(_0x18ef('0x4'));var BPromise=require(_0x18ef('0x5'));var Mustache=require(_0x18ef('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x18ef('0x7'));var ejs=require(_0x18ef('0x8'));var fs=require('fs');var fs_extra=require(_0x18ef('0x9'));var _=require('lodash');var squel=require(_0x18ef('0xa'));var crypto=require(_0x18ef('0xb'));var jsforce=require(_0x18ef('0xc'));var deskjs=require(_0x18ef('0xd'));var toCsv=require(_0x18ef('0x7'));var querystring=require(_0x18ef('0xe'));var Papa=require(_0x18ef('0xf'));var Redis=require(_0x18ef('0x10'));var authService=require(_0x18ef('0x11'));var qs=require(_0x18ef('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x18ef('0x13'));var logger=require(_0x18ef('0x14'))(_0x18ef('0x15'));var utils=require(_0x18ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x18ef('0x17'));var db=require(_0x18ef('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1bea0e,_0x3d9f90){_0x3d9f90=_0x3d9f90||0xcc;return function(_0x1b820b){if(_0x1b820b){return _0x1bea0e[_0x18ef('0x19')](_0x3d9f90);}return _0x1bea0e[_0x18ef('0x1a')](_0x3d9f90)[_0x18ef('0x1b')]();};}function respondWithResult(_0x3c7457,_0x181c97){_0x181c97=_0x181c97||0xc8;return function(_0x13ca6a){if(_0x13ca6a){return _0x3c7457[_0x18ef('0x1a')](_0x181c97)[_0x18ef('0x1c')](_0x13ca6a);}};}function respondWithFilteredResult(_0xf71486,_0x31528d){return function(_0x5b48a8){if(_0x5b48a8){var _0x308163=typeof _0x31528d[_0x18ef('0x1d')]===_0x18ef('0x1e')&&typeof _0x31528d[_0x18ef('0x1f')]===_0x18ef('0x1e');var _0x2b41ad=_0x5b48a8['count'];var _0x27a08e=_0x308163?0x0:_0x31528d[_0x18ef('0x1d')];var _0xc854e5=_0x308163?_0x5b48a8[_0x18ef('0x20')]:_0x31528d[_0x18ef('0x1d')]+_0x31528d[_0x18ef('0x1f')];var _0x4dbd52;if(_0xc854e5>=_0x2b41ad){_0xc854e5=_0x2b41ad;_0x4dbd52=0xc8;}else{_0x4dbd52=0xce;}_0xf71486[_0x18ef('0x1a')](_0x4dbd52);return _0xf71486[_0x18ef('0x21')](_0x18ef('0x22'),_0x27a08e+'-'+_0xc854e5+'/'+_0x2b41ad)[_0x18ef('0x1c')](_0x5b48a8);}return null;};}function patchUpdates(_0x3bff33){return function(_0x51995b){try{jsonpatch['apply'](_0x51995b,_0x3bff33,!![]);}catch(_0x14b271){return BPromise[_0x18ef('0x23')](_0x14b271);}return _0x51995b[_0x18ef('0x24')]();};}function saveUpdates(_0x401d36,_0x329032){return function(_0x5e783d){if(_0x5e783d){return _0x5e783d[_0x18ef('0x25')](_0x401d36)[_0x18ef('0x26')](function(_0xa3fa16){return _0xa3fa16;});}return null;};}function removeEntity(_0x2d84b3,_0x4262d1){return function(_0x318479){if(_0x318479){return _0x318479[_0x18ef('0x27')]()['then'](function(){_0x2d84b3[_0x18ef('0x1a')](0xcc)[_0x18ef('0x1b')]();});}};}function handleEntityNotFound(_0x29c818,_0x8e8c67){return function(_0x4ff7c1){if(!_0x4ff7c1){_0x29c818[_0x18ef('0x19')](0x194);}return _0x4ff7c1;};}function handleError(_0x34ddc3,_0x5e5538){_0x5e5538=_0x5e5538||0x1f4;return function(_0x324907){logger['error'](_0x324907[_0x18ef('0x28')]);if(_0x324907[_0x18ef('0x29')]){delete _0x324907[_0x18ef('0x29')];}_0x34ddc3[_0x18ef('0x1a')](_0x5e5538)[_0x18ef('0x2a')](_0x324907);};}exports['index']=function(_0x4e72e3,_0x2cc46e){var _0x3b081e={},_0x4fb5bf={},_0x37e570={'count':0x0,'rows':[]};var _0x59dfd1=_[_0x18ef('0x2b')](db['ZohoAccount'][_0x18ef('0x2c')],function(_0x27ffed){return{'name':_0x27ffed['fieldName'],'type':_0x27ffed[_0x18ef('0x2d')]['key']};});_0x4fb5bf[_0x18ef('0x2e')]=_[_0x18ef('0x2b')](_0x59dfd1,_0x18ef('0x29'));_0x4fb5bf[_0x18ef('0x2f')]=_[_0x18ef('0x30')](_0x4e72e3[_0x18ef('0x2f')]);_0x4fb5bf[_0x18ef('0x31')]=_['intersection'](_0x4fb5bf[_0x18ef('0x2e')],_0x4fb5bf[_0x18ef('0x2f')]);_0x3b081e[_0x18ef('0x32')]=_[_0x18ef('0x33')](_0x4fb5bf[_0x18ef('0x2e')],qs[_0x18ef('0x34')](_0x4e72e3[_0x18ef('0x2f')][_0x18ef('0x34')]));_0x3b081e[_0x18ef('0x32')]=_0x3b081e[_0x18ef('0x32')][_0x18ef('0x35')]?_0x3b081e[_0x18ef('0x32')]:_0x4fb5bf[_0x18ef('0x2e')];if(!_0x4e72e3['query'][_0x18ef('0x36')]('nolimit')){_0x3b081e[_0x18ef('0x1f')]=qs[_0x18ef('0x1f')](_0x4e72e3[_0x18ef('0x2f')][_0x18ef('0x1f')]);_0x3b081e[_0x18ef('0x1d')]=qs[_0x18ef('0x1d')](_0x4e72e3[_0x18ef('0x2f')][_0x18ef('0x1d')]);}_0x3b081e[_0x18ef('0x37')]=qs[_0x18ef('0x38')](_0x4e72e3[_0x18ef('0x2f')][_0x18ef('0x38')]);_0x3b081e['where']=qs[_0x18ef('0x31')](_[_0x18ef('0x39')](_0x4e72e3[_0x18ef('0x2f')],_0x4fb5bf[_0x18ef('0x31')]),_0x59dfd1);if(_0x4e72e3[_0x18ef('0x2f')][_0x18ef('0x3a')]){_0x3b081e[_0x18ef('0x3b')]=_['merge'](_0x3b081e[_0x18ef('0x3b')],{'$or':_['map'](_0x59dfd1,function(_0x107cb0){if(_0x107cb0['type']!==_0x18ef('0x3c')){var _0x39d2a5={};_0x39d2a5[_0x107cb0['name']]={'$like':'%'+_0x4e72e3[_0x18ef('0x2f')][_0x18ef('0x3a')]+'%'};return _0x39d2a5;}})});}_0x3b081e=_[_0x18ef('0x3d')]({},_0x3b081e,_0x4e72e3[_0x18ef('0x3e')]);var _0x300731={'where':_0x3b081e[_0x18ef('0x3b')]};return db[_0x18ef('0x3f')][_0x18ef('0x20')](_0x300731)[_0x18ef('0x26')](function(_0x4b9603){_0x37e570[_0x18ef('0x20')]=_0x4b9603;if(_0x4e72e3[_0x18ef('0x2f')][_0x18ef('0x40')]){_0x3b081e[_0x18ef('0x41')]=[{'all':!![]}];}return db[_0x18ef('0x3f')]['findAll'](_0x3b081e);})[_0x18ef('0x26')](function(_0x3a21b7){_0x37e570['rows']=_0x3a21b7;return _0x37e570;})['then'](respondWithFilteredResult(_0x2cc46e,_0x3b081e))['catch'](handleError(_0x2cc46e,null));};exports[_0x18ef('0x42')]=function(_0x319197,_0x501544){var _0xf62526={'raw':![],'where':{'id':_0x319197[_0x18ef('0x43')]['id']}},_0x376a70={};_0x376a70['model']=_[_0x18ef('0x30')](db[_0x18ef('0x3f')][_0x18ef('0x2c')]);_0x376a70[_0x18ef('0x2f')]=_[_0x18ef('0x30')](_0x319197[_0x18ef('0x2f')]);_0x376a70[_0x18ef('0x31')]=_[_0x18ef('0x33')](_0x376a70[_0x18ef('0x2e')],_0x376a70[_0x18ef('0x2f')]);_0xf62526[_0x18ef('0x32')]=_[_0x18ef('0x33')](_0x376a70[_0x18ef('0x2e')],qs[_0x18ef('0x34')](_0x319197[_0x18ef('0x2f')]['fields']));_0xf62526['attributes']=_0xf62526[_0x18ef('0x32')]['length']?_0xf62526['attributes']:_0x376a70['model'];if(_0x319197['query'][_0x18ef('0x40')]){_0xf62526[_0x18ef('0x41')]=[{'all':!![]}];}_0xf62526=_[_0x18ef('0x3d')]({},_0xf62526,_0x319197[_0x18ef('0x3e')]);return db[_0x18ef('0x3f')]['find'](_0xf62526)[_0x18ef('0x26')](handleEntityNotFound(_0x501544,null))[_0x18ef('0x26')](respondWithResult(_0x501544,null))['catch'](handleError(_0x501544,null));};exports[_0x18ef('0x44')]=function(_0x4b083d,_0x21f781){return db[_0x18ef('0x3f')][_0x18ef('0x44')](_0x4b083d[_0x18ef('0x45')],{})[_0x18ef('0x26')](respondWithResult(_0x21f781,0xc9))['catch'](handleError(_0x21f781,null));};exports[_0x18ef('0x25')]=function(_0x113123,_0x165c13){if(_0x113123[_0x18ef('0x45')]['id']){delete _0x113123['body']['id'];}return db[_0x18ef('0x3f')][_0x18ef('0x46')]({'where':{'id':_0x113123['params']['id']}})[_0x18ef('0x26')](handleEntityNotFound(_0x165c13,null))[_0x18ef('0x26')](saveUpdates(_0x113123[_0x18ef('0x45')],null))[_0x18ef('0x26')](respondWithResult(_0x165c13,null))[_0x18ef('0x47')](handleError(_0x165c13,null));};exports['destroy']=function(_0x30242f,_0x2e053d){return db[_0x18ef('0x3f')][_0x18ef('0x46')]({'where':{'id':_0x30242f[_0x18ef('0x43')]['id']}})[_0x18ef('0x26')](handleEntityNotFound(_0x2e053d,null))[_0x18ef('0x26')](removeEntity(_0x2e053d,null))[_0x18ef('0x47')](handleError(_0x2e053d,null));};exports['getConfigurations']=function(_0x399ae4,_0x278631,_0x4b9acd){var _0x48f9d1={};var _0x512ac5={};var _0x6ee08a;var _0x1387ed;return db['ZohoAccount'][_0x18ef('0x48')]({'where':{'id':_0x399ae4[_0x18ef('0x43')]['id']}})[_0x18ef('0x26')](handleEntityNotFound(_0x278631,null))[_0x18ef('0x26')](function(_0x5c87b8){if(_0x5c87b8){_0x6ee08a=_0x5c87b8;_0x512ac5['model']=_[_0x18ef('0x30')](db[_0x18ef('0x49')][_0x18ef('0x2c')]);_0x512ac5['query']=_[_0x18ef('0x30')](_0x399ae4[_0x18ef('0x2f')]);_0x512ac5['filters']=_[_0x18ef('0x33')](_0x512ac5['model'],_0x512ac5[_0x18ef('0x2f')]);_0x48f9d1[_0x18ef('0x32')]=_[_0x18ef('0x33')](_0x512ac5[_0x18ef('0x2e')],qs[_0x18ef('0x34')](_0x399ae4[_0x18ef('0x2f')][_0x18ef('0x34')]));_0x48f9d1[_0x18ef('0x32')]=_0x48f9d1[_0x18ef('0x32')][_0x18ef('0x35')]?_0x48f9d1[_0x18ef('0x32')]:_0x512ac5[_0x18ef('0x2e')];_0x48f9d1[_0x18ef('0x37')]=qs['sort'](_0x399ae4[_0x18ef('0x2f')][_0x18ef('0x38')]);_0x48f9d1[_0x18ef('0x3b')]=qs[_0x18ef('0x31')](_['pick'](_0x399ae4[_0x18ef('0x2f')],_0x512ac5[_0x18ef('0x31')]));if(_0x399ae4[_0x18ef('0x2f')]['filter']){_0x48f9d1[_0x18ef('0x3b')]=_['merge'](_0x48f9d1[_0x18ef('0x3b')],{'$or':_['map'](_0x48f9d1['attributes'],function(_0x2c0d75){var _0xab4daf={};_0xab4daf[_0x2c0d75]={'$like':'%'+_0x399ae4['query']['filter']+'%'};return _0xab4daf;})});}_0x48f9d1=_[_0x18ef('0x3d')]({},_0x48f9d1,_0x399ae4[_0x18ef('0x3e')]);return _0x6ee08a[_0x18ef('0x4a')](_0x48f9d1);}})['then'](function(_0x18e437){if(_0x18e437){_0x1387ed=_0x18e437[_0x18ef('0x35')];if(!_0x399ae4[_0x18ef('0x2f')]['hasOwnProperty'](_0x18ef('0x4b'))){_0x48f9d1['limit']=qs[_0x18ef('0x1f')](_0x399ae4[_0x18ef('0x2f')][_0x18ef('0x1f')]);_0x48f9d1[_0x18ef('0x1d')]=qs[_0x18ef('0x1d')](_0x399ae4[_0x18ef('0x2f')][_0x18ef('0x1d')]);}return _0x6ee08a[_0x18ef('0x4a')](_0x48f9d1);}})[_0x18ef('0x26')](function(_0x4f816a){if(_0x4f816a){return _0x4f816a?{'count':_0x1387ed,'rows':_0x4f816a}:null;}})[_0x18ef('0x26')](respondWithResult(_0x278631,null))[_0x18ef('0x47')](handleError(_0x278631,null));};exports[_0x18ef('0x4c')]=function(_0x386b42,_0x41e07e,_0x1b6b21){if(_0x386b42[_0x18ef('0x45')]['id']){delete _0x386b42[_0x18ef('0x45')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x386b42[_0x18ef('0x43')]['id']}})[_0x18ef('0x26')](handleEntityNotFound(_0x41e07e,null))[_0x18ef('0x26')](function(_0x68942d){if(_0x68942d){_0x386b42['body'][_0x18ef('0x4d')]=_0x68942d['id'];_0x386b42[_0x18ef('0x45')][_0x18ef('0x4e')]=integrations['getSubjects'](_0x386b42['body'][_0x18ef('0x4f')],_0x386b42[_0x18ef('0x45')][_0x18ef('0x2d')]);_0x386b42[_0x18ef('0x45')][_0x18ef('0x50')]=integrations[_0x18ef('0x51')](_0x386b42[_0x18ef('0x45')]['channel'],_0x386b42[_0x18ef('0x45')][_0x18ef('0x2d')]);return db[_0x18ef('0x49')][_0x18ef('0x44')](_0x386b42['body'],{'include':[{'model':db[_0x18ef('0x52')],'as':_0x18ef('0x4e')},{'model':db[_0x18ef('0x52')],'as':_0x18ef('0x50')}]});}return null;})['then'](respondWithResult(_0x41e07e,null))[_0x18ef('0x47')](handleError(_0x41e07e,null));};function getAccessToken(_0x34d2f1){return new Promise(function(_0x34f315,_0x5f2d52){var _0x20465b;switch(_0x34d2f1[_0x18ef('0x53')]){case'US':_0x20465b='https://accounts.zoho.com';break;case'AU':_0x20465b='https://accounts.zoho.com.au';break;case'EU':_0x20465b=_0x18ef('0x54');break;case'IN':_0x20465b=_0x18ef('0x55');break;case'CN':_0x20465b=_0x18ef('0x56');break;default:_0x20465b=_0x18ef('0x54');break;}var _0x15efff={'method':_0x18ef('0x57'),'uri':_0x20465b+_0x18ef('0x58'),'qs':{'refresh_token':_0x34d2f1[_0x18ef('0x59')],'client_id':_0x34d2f1[_0x18ef('0x5a')],'client_secret':_0x34d2f1[_0x18ef('0x5b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x15efff)[_0x18ef('0x26')](function(_0x511b1c){if(_0x511b1c['access_token']){_0x34f315(_0x511b1c[_0x18ef('0x5c')]);}else{_0x5f2d52(_0x18ef('0x5d'));}})['catch'](function(_0x16d218){_0x5f2d52(_0x16d218);});});}exports['getFields']=function(_0x14f33f,_0x40be07,_0x29179c){var _0x32dbce,_0x62bfdd,_0xd25533,_0xb72f4c,_0x191607;return db[_0x18ef('0x3f')][_0x18ef('0x48')]({'where':{'id':_0x14f33f[_0x18ef('0x43')]['id']},'attributes':['id',_0x18ef('0x5e'),_0x18ef('0x53'),_0x18ef('0x5a'),'clientSecret','serverUrl',_0x18ef('0x5f'),'refreshToken']})[_0x18ef('0x26')](handleEntityNotFound(_0x40be07,null))[_0x18ef('0x26')](function(_0x4ed9cc){_0x191607=_0x4ed9cc;_0x32dbce=_0x191607['host'];_0x62bfdd=_0x32dbce===_0x18ef('0x60')?'eu':'com';_0xd25533=_0x191607['serverUrl'];var _0x5c7a2a=_0xd25533['slice'](-0x1);if(_0x5c7a2a==='/'||_0x5c7a2a==='\x5c'||_0x5c7a2a===':'){_0xd25533=_0xd25533['substring'](0x0,_0xd25533['lastIndexOf'](_0x5c7a2a));}if(!_0x191607[_0x18ef('0x59')]){throw new Error(_0x18ef('0x61'));}return getAccessToken(_0x191607);})[_0x18ef('0x26')](function(_0x1d9b56){if(_0x1d9b56){return rp({'method':_0x18ef('0x62'),'uri':util['format'](_0x18ef('0x63'),_0x62bfdd),'qs':{'module':_0x18ef('0x64')},'headers':{'Authorization':_0x18ef('0x65')+_0x1d9b56},'json':!![]});}})['then'](function(_0x303ccd){if(_0x303ccd){if(_0x303ccd[_0x18ef('0x66')]&&_0x303ccd['response']['error']){throw new Error(_0x303ccd['response'][_0x18ef('0x67')][_0x18ef('0x68')]);}var _0x2c8e31=[];var _0x52f063=[];var _0x56feee=[_0x18ef('0x69'),'Subject',_0x18ef('0x6a'),_0x18ef('0x6b'),_0x18ef('0x6c'),_0x18ef('0x6d'),_0x18ef('0x6e'),'Call_Type'];_0x52f063=_[_0x18ef('0x6f')](_0x303ccd[_0x18ef('0x34')],function(_0x3467e6){return _0x56feee[_0x18ef('0x70')](_0x3467e6[_0x18ef('0x71')]);});for(var _0x50c8a=0x0;_0x50c8a<_0x52f063[_0x18ef('0x35')];_0x50c8a++){if(_0x52f063[_0x50c8a][_0x18ef('0x72')]===![]){_0x2c8e31['push']({'id':_0x52f063[_0x50c8a]['id'],'name':_0x52f063[_0x50c8a]['display_label'],'custom':_0x52f063[_0x50c8a][_0x18ef('0x73')],'options':_0x52f063[_0x50c8a][_0x18ef('0x74')]==='picklist'&&_0x52f063[_0x50c8a][_0x18ef('0x75')][_0x18ef('0x35')]>-0x1?_[_0x18ef('0x2b')](_0x52f063[_0x50c8a]['pick_list_values'],function(_0x452f21){return{'name':_0x452f21,'value':_0x452f21};}):[]});}}return{'count':_0x2c8e31[_0x18ef('0x35')],'rows':_0x2c8e31};}else{return{'count':0x0,'rows':[]};}})[_0x18ef('0x26')](respondWithResult(_0x40be07,null))[_0x18ef('0x47')](function(_0x4e2bbe){var _0x54e9fa=_0x14f33f[_0x18ef('0x2f')]['test']?0x1f4:_0x4e2bbe[_0x18ef('0x76')]||0x1f4;logger['error'](_0x18ef('0x77'),_0x18ef('0x78'),_0x54e9fa,JSON[_0x18ef('0x79')](_0x4e2bbe));delete _0x4e2bbe['name'];if(_0x54e9fa===0x191){_0x54e9fa=0x190;}_0x40be07[_0x18ef('0x1a')](_0x54e9fa)[_0x18ef('0x2a')](_0x14f33f[_0x18ef('0x2f')][_0x18ef('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x4e2bbe['statusCode']}:_0x4e2bbe);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 6e7e954..1981c03 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 _0x9b33=['substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','host','lastIndexOf','https://accounts.zoho.eu','POST','/oauth/v2/token','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','slice'];(function(_0x1ae491,_0x5b83b9){var _0x4958a5=function(_0xf0f364){while(--_0xf0f364){_0x1ae491['push'](_0x1ae491['shift']());}};_0x4958a5(++_0x5b83b9);}(_0x9b33,0x1a5));var _0x39b3=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x9b33[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x39b3('0x0'));var util=require(_0x39b3('0x1'));var logger=require(_0x39b3('0x2'))(_0x39b3('0x3'));var moment=require(_0x39b3('0x4'));var BPromise=require(_0x39b3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x39b3('0x6'));var config=require('../../config/environment');var attributes=require(_0x39b3('0x7'));var integrations=require(_0x39b3('0x8'));module[_0x39b3('0x9')]=function(_0xbd5e69,_0x432f1a){return _0xbd5e69[_0x39b3('0xa')](_0x39b3('0xb'),attributes,{'tableName':_0x39b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x29e182,_0x212aed,_0x2e3f6c){if(_0x29e182['changed'](_0x39b3('0xd'))||_0x29e182[_0x39b3('0xe')](_0x39b3('0xf'))||_0x29e182[_0x39b3('0xe')](_0x39b3('0x10'))||_0x29e182[_0x39b3('0xe')](_0x39b3('0x11'))||_0x29e182['changed']('code')||_0x29e182['changed']('host')){var _0x2dd73a,_0xc13d93;_0x2dd73a=_0x29e182[_0x39b3('0xf')];var _0x19bf60=_0x2dd73a[_0x39b3('0x12')](-0x1);if(_0x19bf60==='/'||_0x19bf60==='\x5c'||_0x19bf60===':'){_0x2dd73a=_0x2dd73a[_0x39b3('0x13')](0x0,_0x2dd73a['lastIndexOf'](_0x19bf60));}switch(_0x29e182[_0x39b3('0xd')]){case'US':_0xc13d93=_0x39b3('0x14');break;case'AU':_0xc13d93=_0x39b3('0x15');break;case'IN':_0xc13d93=_0x39b3('0x16');break;case'CN':_0xc13d93=_0x39b3('0x17');break;default:_0xc13d93='https://accounts.zoho.eu';break;}var _0x264c15={'method':'POST','uri':_0xc13d93+'/oauth/v2/token','form':{'grant_type':_0x39b3('0x18'),'client_id':_0x29e182[_0x39b3('0x10')],'client_secret':_0x29e182['clientSecret'],'redirect_uri':_0x29e182['serverUrl'],'code':_0x29e182[_0x39b3('0x19')]},'headers':{'Content-Type':_0x39b3('0x1a')}};return rp(_0x264c15)[_0x39b3('0x1b')](function(_0x35c270){var _0xa92b6c=JSON[_0x39b3('0x1c')](_0x35c270);if(_0xa92b6c[_0x39b3('0x1d')]){_0x29e182[_0x39b3('0x1e')]=_0xa92b6c['refresh_token'];logger[_0x39b3('0x1f')](util[_0x39b3('0x20')](_0x39b3('0x21'),_0x29e182[_0x39b3('0x22')],_0x29e182['id']));}else{logger[_0x39b3('0x23')](util['format'](_0x39b3('0x24'),_0x29e182[_0x39b3('0x22')],_0x29e182['id']),util[_0x39b3('0x25')](_0xa92b6c,{'showHidden':![],'depth':null}));}return _0x2e3f6c(null,_0x212aed);})[_0x39b3('0x26')](function(_0x34ffe4){logger[_0x39b3('0x23')](util[_0x39b3('0x20')](_0x39b3('0x24'),_0x29e182['name'],_0x29e182['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x2e3f6c(_0x34ffe4);});}else{return _0x2e3f6c(null,_0x212aed);}},'beforeUpdate':function(_0x1f10e9,_0x12855b,_0x46d7fb){if(_0x1f10e9['changed'](_0x39b3('0xd'))||_0x1f10e9['changed']('serverUrl')||_0x1f10e9[_0x39b3('0xe')](_0x39b3('0x10'))||_0x1f10e9[_0x39b3('0xe')](_0x39b3('0x11'))||_0x1f10e9[_0x39b3('0xe')]('code')||_0x1f10e9['changed'](_0x39b3('0x27'))){var _0x54236e,_0x78089d;_0x54236e=_0x1f10e9[_0x39b3('0xf')];var _0x487d5f=_0x54236e[_0x39b3('0x12')](-0x1);if(_0x487d5f==='/'||_0x487d5f==='\x5c'||_0x487d5f===':'){_0x54236e=_0x54236e['substring'](0x0,_0x54236e[_0x39b3('0x28')](_0x487d5f));}switch(_0x1f10e9[_0x39b3('0xd')]){case'US':_0x78089d='https://accounts.zoho.com';break;case'AU':_0x78089d=_0x39b3('0x15');break;case'IN':_0x78089d=_0x39b3('0x16');break;case'CN':_0x78089d=_0x39b3('0x17');break;default:_0x78089d=_0x39b3('0x29');break;}var _0x3da2bf={'method':_0x39b3('0x2a'),'uri':_0x78089d+_0x39b3('0x2b'),'form':{'grant_type':_0x39b3('0x18'),'client_id':_0x1f10e9[_0x39b3('0x10')],'client_secret':_0x1f10e9[_0x39b3('0x11')],'redirect_uri':_0x1f10e9[_0x39b3('0xf')],'code':_0x1f10e9[_0x39b3('0x19')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3da2bf)[_0x39b3('0x1b')](function(_0x8425ee){var _0x1123e2=JSON['parse'](_0x8425ee);if(_0x1123e2[_0x39b3('0x1d')]){_0x1f10e9[_0x39b3('0x1e')]=_0x1123e2[_0x39b3('0x1d')];logger[_0x39b3('0x1f')](util[_0x39b3('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1f10e9['name'],_0x1f10e9['id']));}else{logger[_0x39b3('0x23')](util[_0x39b3('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1f10e9['name'],_0x1f10e9['id']),util[_0x39b3('0x25')](_0x1123e2,{'showHidden':![],'depth':null}));}return _0x46d7fb(null,_0x12855b);})[_0x39b3('0x26')](function(_0x2b0737){logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1f10e9[_0x39b3('0x22')],_0x1f10e9['id']),util[_0x39b3('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x46d7fb(_0x2b0737);});}else{return _0x46d7fb(null,_0x12855b);}}}});}; \ No newline at end of file +var _0x37f6=['lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','authorization_code','clientId','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','zone','https://accounts.zoho.eu','/oauth/v2/token','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientSecret','code','host','slice','substring'];(function(_0x149eb2,_0x467466){var _0x47d529=function(_0x348abc){while(--_0x348abc){_0x149eb2['push'](_0x149eb2['shift']());}};_0x47d529(++_0x467466);}(_0x37f6,0x19b));var _0x637f=function(_0x24e364,_0x22c22c){_0x24e364=_0x24e364-0x0;var _0x3921b0=_0x37f6[_0x24e364];return _0x3921b0;};'use strict';var _=require(_0x637f('0x0'));var util=require('util');var logger=require(_0x637f('0x1'))(_0x637f('0x2'));var moment=require(_0x637f('0x3'));var BPromise=require(_0x637f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x637f('0x5'));var rimraf=require('rimraf');var config=require(_0x637f('0x6'));var attributes=require(_0x637f('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x637f('0x8')]=function(_0x4d0cea,_0x2ce2fe){return _0x4d0cea[_0x637f('0x9')](_0x637f('0xa'),attributes,{'tableName':_0x637f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4ced03,_0x395073,_0x1290e0){if(_0x4ced03[_0x637f('0xc')]('zone')||_0x4ced03[_0x637f('0xc')](_0x637f('0xd'))||_0x4ced03[_0x637f('0xc')]('clientId')||_0x4ced03[_0x637f('0xc')](_0x637f('0xe'))||_0x4ced03[_0x637f('0xc')](_0x637f('0xf'))||_0x4ced03['changed'](_0x637f('0x10'))){var _0x4d1762,_0x4acab5;_0x4d1762=_0x4ced03['serverUrl'];var _0x5e16f5=_0x4d1762[_0x637f('0x11')](-0x1);if(_0x5e16f5==='/'||_0x5e16f5==='\x5c'||_0x5e16f5===':'){_0x4d1762=_0x4d1762[_0x637f('0x12')](0x0,_0x4d1762[_0x637f('0x13')](_0x5e16f5));}switch(_0x4ced03['zone']){case'US':_0x4acab5=_0x637f('0x14');break;case'AU':_0x4acab5=_0x637f('0x15');break;case'IN':_0x4acab5=_0x637f('0x16');break;case'CN':_0x4acab5=_0x637f('0x17');break;default:_0x4acab5='https://accounts.zoho.eu';break;}var _0x298055={'method':_0x637f('0x18'),'uri':_0x4acab5+'/oauth/v2/token','form':{'grant_type':_0x637f('0x19'),'client_id':_0x4ced03[_0x637f('0x1a')],'client_secret':_0x4ced03[_0x637f('0xe')],'redirect_uri':_0x4ced03[_0x637f('0xd')],'code':_0x4ced03[_0x637f('0xf')]},'headers':{'Content-Type':_0x637f('0x1b')}};return rp(_0x298055)[_0x637f('0x1c')](function(_0x12bc21){var _0x287392=JSON[_0x637f('0x1d')](_0x12bc21);if(_0x287392[_0x637f('0x1e')]){_0x4ced03[_0x637f('0x1f')]=_0x287392[_0x637f('0x1e')];logger[_0x637f('0x20')](util[_0x637f('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4ced03[_0x637f('0x22')],_0x4ced03['id']));}else{logger[_0x637f('0x23')](util[_0x637f('0x21')](_0x637f('0x24'),_0x4ced03['name'],_0x4ced03['id']),util[_0x637f('0x25')](_0x287392,{'showHidden':![],'depth':null}));}return _0x1290e0(null,_0x395073);})[_0x637f('0x26')](function(_0xcb67cf){logger[_0x637f('0x23')](util['format'](_0x637f('0x24'),_0x4ced03['name'],_0x4ced03['id']),util[_0x637f('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x1290e0(_0xcb67cf);});}else{return _0x1290e0(null,_0x395073);}},'beforeUpdate':function(_0x35ad4c,_0x5c4039,_0x55dae3){if(_0x35ad4c[_0x637f('0xc')](_0x637f('0x27'))||_0x35ad4c[_0x637f('0xc')](_0x637f('0xd'))||_0x35ad4c['changed'](_0x637f('0x1a'))||_0x35ad4c[_0x637f('0xc')]('clientSecret')||_0x35ad4c['changed'](_0x637f('0xf'))||_0x35ad4c[_0x637f('0xc')]('host')){var _0x5791ab,_0x458beb;_0x5791ab=_0x35ad4c['serverUrl'];var _0x5ab060=_0x5791ab[_0x637f('0x11')](-0x1);if(_0x5ab060==='/'||_0x5ab060==='\x5c'||_0x5ab060===':'){_0x5791ab=_0x5791ab[_0x637f('0x12')](0x0,_0x5791ab[_0x637f('0x13')](_0x5ab060));}switch(_0x35ad4c['zone']){case'US':_0x458beb=_0x637f('0x14');break;case'AU':_0x458beb=_0x637f('0x15');break;case'IN':_0x458beb=_0x637f('0x16');break;case'CN':_0x458beb=_0x637f('0x17');break;default:_0x458beb=_0x637f('0x28');break;}var _0x19b79f={'method':_0x637f('0x18'),'uri':_0x458beb+_0x637f('0x29'),'form':{'grant_type':'authorization_code','client_id':_0x35ad4c[_0x637f('0x1a')],'client_secret':_0x35ad4c['clientSecret'],'redirect_uri':_0x35ad4c['serverUrl'],'code':_0x35ad4c[_0x637f('0xf')]},'headers':{'Content-Type':_0x637f('0x1b')}};return rp(_0x19b79f)[_0x637f('0x1c')](function(_0x39a26c){var _0x49f9f4=JSON[_0x637f('0x1d')](_0x39a26c);if(_0x49f9f4[_0x637f('0x1e')]){_0x35ad4c[_0x637f('0x1f')]=_0x49f9f4[_0x637f('0x1e')];logger['info'](util[_0x637f('0x21')](_0x637f('0x2a'),_0x35ad4c['name'],_0x35ad4c['id']));}else{logger[_0x637f('0x23')](util[_0x637f('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x35ad4c[_0x637f('0x22')],_0x35ad4c['id']),util['inspect'](_0x49f9f4,{'showHidden':![],'depth':null}));}return _0x55dae3(null,_0x5c4039);})[_0x637f('0x26')](function(_0x903f74){logger['error'](util[_0x637f('0x21')](_0x637f('0x24'),_0x35ad4c[_0x637f('0x22')],_0x35ad4c['id']),util[_0x637f('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x55dae3(_0x903f74);});}else{return _0x55dae3(null,_0x5c4039);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 2dd211f..0f1f4bf 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 _0x3c91=['raw','where','attributes','limit','include','map','model','GetZohoAccount','debug','ShowZohoAccount','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ZohoAccount','options'];(function(_0x4b717f,_0x18ab31){var _0x1afdd4=function(_0x2a9192){while(--_0x2a9192){_0x4b717f['push'](_0x4b717f['shift']());}};_0x1afdd4(++_0x18ab31);}(_0x3c91,0x1af));var _0x13c9=function(_0x1f0839,_0x1d329d){_0x1f0839=_0x1f0839-0x0;var _0x2bb8ab=_0x3c91[_0x1f0839];return _0x2bb8ab;};'use strict';var _=require(_0x13c9('0x0'));var util=require(_0x13c9('0x1'));var moment=require(_0x13c9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13c9('0x3'));var db=require(_0x13c9('0x4'))['db'];var utils=require(_0x13c9('0x5'));var logger=require('../../config/logger')(_0x13c9('0x6'));var config=require(_0x13c9('0x7'));var jayson=require(_0x13c9('0x8'));var client=jayson[_0x13c9('0x9')][_0x13c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c4332,_0x58b610,_0x44243f){return new BPromise(function(_0x196c2a,_0x5fd23){return client[_0x13c9('0xb')](_0x4c4332,_0x44243f)[_0x13c9('0xc')](function(_0x5370dd){logger['info'](_0x13c9('0xd'),_0x58b610,_0x13c9('0xe'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x58b610,_0x13c9('0xe'),JSON[_0x13c9('0xf')](_0x5370dd));if(_0x5370dd[_0x13c9('0x10')]){if(_0x5370dd[_0x13c9('0x10')][_0x13c9('0x11')]===0x1f4){logger[_0x13c9('0x10')](_0x13c9('0xd'),_0x58b610,_0x5370dd['error'][_0x13c9('0x12')]);return _0x5fd23(_0x5370dd['error']['message']);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x58b610,_0x5370dd['error'][_0x13c9('0x12')]);return _0x196c2a(_0x5370dd[_0x13c9('0x10')]['message']);}else{logger[_0x13c9('0x13')](_0x13c9('0xd'),_0x58b610,_0x13c9('0xe'));_0x196c2a(_0x5370dd[_0x13c9('0x14')][_0x13c9('0x12')]);}})[_0x13c9('0x15')](function(_0x238952){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x58b610,_0x238952);_0x5fd23(_0x238952);});});}exports['GetZohoAccount']=function(_0xd08fc0){var _0x1a6c06=this;return new Promise(function(_0x1dcaf7,_0x339e7f){return db[_0x13c9('0x16')]['findAll']({'raw':_0xd08fc0[_0x13c9('0x17')]?_0xd08fc0[_0x13c9('0x17')][_0x13c9('0x18')]===undefined?!![]:![]:!![],'where':_0xd08fc0[_0x13c9('0x17')]?_0xd08fc0[_0x13c9('0x17')][_0x13c9('0x19')]||null:null,'attributes':_0xd08fc0[_0x13c9('0x17')]?_0xd08fc0['options'][_0x13c9('0x1a')]||null:null,'limit':_0xd08fc0[_0x13c9('0x17')]?_0xd08fc0[_0x13c9('0x17')][_0x13c9('0x1b')]||null:null,'include':_0xd08fc0[_0x13c9('0x17')]?_0xd08fc0[_0x13c9('0x17')][_0x13c9('0x1c')]?_[_0x13c9('0x1d')](_0xd08fc0[_0x13c9('0x17')][_0x13c9('0x1c')],function(_0x5dfd9d){return{'model':db[_0x5dfd9d[_0x13c9('0x1e')]],'as':_0x5dfd9d['as'],'attributes':_0x5dfd9d[_0x13c9('0x1a')],'include':_0x5dfd9d[_0x13c9('0x1c')]?_[_0x13c9('0x1d')](_0x5dfd9d[_0x13c9('0x1c')],function(_0x55b3d9){return{'model':db[_0x55b3d9[_0x13c9('0x1e')]],'as':_0x55b3d9['as'],'attributes':_0x55b3d9['attributes'],'include':_0x55b3d9['include']?_[_0x13c9('0x1d')](_0x55b3d9[_0x13c9('0x1c')],function(_0x3ca92a){return{'model':db[_0x3ca92a[_0x13c9('0x1e')]],'as':_0x3ca92a['as'],'attributes':_0x3ca92a[_0x13c9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x13c9('0xc')](function(_0x3fcf1c){logger[_0x13c9('0x13')](_0x13c9('0x1f'),_0xd08fc0);logger[_0x13c9('0x20')]('GetZohoAccount',_0xd08fc0,JSON[_0x13c9('0xf')](_0x3fcf1c));_0x1dcaf7(_0x3fcf1c);})[_0x13c9('0x15')](function(_0x5d8997){logger[_0x13c9('0x10')](_0x13c9('0x1f'),_0x5d8997[_0x13c9('0x12')],_0xd08fc0);_0x339e7f(_0x1a6c06['error'](0x1f4,_0x5d8997['message']));});});};exports[_0x13c9('0x21')]=function(_0x35249b){var _0x1a1710=this;return new Promise(function(_0x4cb64a,_0x309606){return db[_0x13c9('0x16')][_0x13c9('0x22')]({'raw':_0x35249b[_0x13c9('0x17')]?_0x35249b[_0x13c9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x35249b[_0x13c9('0x17')]?_0x35249b[_0x13c9('0x17')][_0x13c9('0x19')]||null:null,'attributes':_0x35249b[_0x13c9('0x17')]?_0x35249b[_0x13c9('0x17')][_0x13c9('0x1a')]||null:null,'include':_0x35249b[_0x13c9('0x17')]?_0x35249b['options'][_0x13c9('0x1c')]?_[_0x13c9('0x1d')](_0x35249b['options'][_0x13c9('0x1c')],function(_0x119b60){return{'model':db[_0x119b60[_0x13c9('0x1e')]],'as':_0x119b60['as'],'attributes':_0x119b60[_0x13c9('0x1a')],'include':_0x119b60[_0x13c9('0x1c')]?_[_0x13c9('0x1d')](_0x119b60['include'],function(_0x4db35f){return{'model':db[_0x4db35f[_0x13c9('0x1e')]],'as':_0x4db35f['as'],'attributes':_0x4db35f[_0x13c9('0x1a')],'include':_0x4db35f[_0x13c9('0x1c')]?_[_0x13c9('0x1d')](_0x4db35f['include'],function(_0x38d479){return{'model':db[_0x38d479[_0x13c9('0x1e')]],'as':_0x38d479['as'],'attributes':_0x38d479['attributes']};}):[]};}):[]};}):[]:[]})[_0x13c9('0xc')](function(_0x1cfdfc){logger[_0x13c9('0x13')]('ShowZohoAccount',_0x35249b);logger[_0x13c9('0x20')](_0x13c9('0x21'),_0x35249b,JSON[_0x13c9('0xf')](_0x1cfdfc));_0x4cb64a(_0x1cfdfc);})[_0x13c9('0x15')](function(_0x4e6cc3){logger['error'](_0x13c9('0x21'),_0x4e6cc3[_0x13c9('0x12')],_0x35249b);_0x309606(_0x1a1710['error'](0x1f4,_0x4e6cc3[_0x13c9('0x12')]));});});}; \ No newline at end of file +var _0xc177=['catch','GetZohoAccount','findAll','options','raw','where','include','attributes','model','map','debug','ZohoAccount','find','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xc177,0x1b2));var _0x7c17=function(_0x59b405,_0x221cbc){_0x59b405=_0x59b405-0x0;var _0x4ddae7=_0xc177[_0x59b405];return _0x4ddae7;};'use strict';var _=require(_0x7c17('0x0'));var util=require(_0x7c17('0x1'));var moment=require(_0x7c17('0x2'));var BPromise=require(_0x7c17('0x3'));var rs=require(_0x7c17('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c17('0x5'))['db'];var utils=require(_0x7c17('0x6'));var logger=require(_0x7c17('0x7'))(_0x7c17('0x8'));var config=require('../../config/environment');var jayson=require(_0x7c17('0x9'));var client=jayson[_0x7c17('0xa')][_0x7c17('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4810b7,_0x3ab87c,_0x3aa79e){return new BPromise(function(_0x33dd1e,_0x3854dd){return client[_0x7c17('0xc')](_0x4810b7,_0x3aa79e)[_0x7c17('0xd')](function(_0x44e782){logger[_0x7c17('0xe')](_0x7c17('0xf'),_0x3ab87c,_0x7c17('0x10'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3ab87c,'request\x20sent',JSON[_0x7c17('0x11')](_0x44e782));if(_0x44e782[_0x7c17('0x12')]){if(_0x44e782[_0x7c17('0x12')]['code']===0x1f4){logger[_0x7c17('0x12')](_0x7c17('0xf'),_0x3ab87c,_0x44e782[_0x7c17('0x12')]['message']);return _0x3854dd(_0x44e782['error'][_0x7c17('0x13')]);}logger[_0x7c17('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x3ab87c,_0x44e782[_0x7c17('0x12')]['message']);return _0x33dd1e(_0x44e782[_0x7c17('0x12')]['message']);}else{logger[_0x7c17('0xe')](_0x7c17('0xf'),_0x3ab87c,_0x7c17('0x10'));_0x33dd1e(_0x44e782[_0x7c17('0x14')][_0x7c17('0x13')]);}})[_0x7c17('0x15')](function(_0x87715a){logger[_0x7c17('0x12')](_0x7c17('0xf'),_0x3ab87c,_0x87715a);_0x3854dd(_0x87715a);});});}exports[_0x7c17('0x16')]=function(_0x24a25d){var _0x47307a=this;return new Promise(function(_0x2092b8,_0x41440d){return db['ZohoAccount'][_0x7c17('0x17')]({'raw':_0x24a25d[_0x7c17('0x18')]?_0x24a25d['options'][_0x7c17('0x19')]===undefined?!![]:![]:!![],'where':_0x24a25d['options']?_0x24a25d['options'][_0x7c17('0x1a')]||null:null,'attributes':_0x24a25d[_0x7c17('0x18')]?_0x24a25d[_0x7c17('0x18')]['attributes']||null:null,'limit':_0x24a25d[_0x7c17('0x18')]?_0x24a25d[_0x7c17('0x18')]['limit']||null:null,'include':_0x24a25d[_0x7c17('0x18')]?_0x24a25d[_0x7c17('0x18')][_0x7c17('0x1b')]?_['map'](_0x24a25d[_0x7c17('0x18')][_0x7c17('0x1b')],function(_0x394866){return{'model':db[_0x394866['model']],'as':_0x394866['as'],'attributes':_0x394866[_0x7c17('0x1c')],'include':_0x394866[_0x7c17('0x1b')]?_['map'](_0x394866['include'],function(_0x42260f){return{'model':db[_0x42260f[_0x7c17('0x1d')]],'as':_0x42260f['as'],'attributes':_0x42260f[_0x7c17('0x1c')],'include':_0x42260f[_0x7c17('0x1b')]?_[_0x7c17('0x1e')](_0x42260f[_0x7c17('0x1b')],function(_0x5605c6){return{'model':db[_0x5605c6[_0x7c17('0x1d')]],'as':_0x5605c6['as'],'attributes':_0x5605c6[_0x7c17('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7c17('0xd')](function(_0xf2c46c){logger[_0x7c17('0xe')](_0x7c17('0x16'),_0x24a25d);logger[_0x7c17('0x1f')](_0x7c17('0x16'),_0x24a25d,JSON[_0x7c17('0x11')](_0xf2c46c));_0x2092b8(_0xf2c46c);})[_0x7c17('0x15')](function(_0x4776cc){logger[_0x7c17('0x12')](_0x7c17('0x16'),_0x4776cc[_0x7c17('0x13')],_0x24a25d);_0x41440d(_0x47307a[_0x7c17('0x12')](0x1f4,_0x4776cc[_0x7c17('0x13')]));});});};exports['ShowZohoAccount']=function(_0x1378e7){var _0x61a143=this;return new Promise(function(_0x4dd018,_0x98f8f4){return db[_0x7c17('0x20')][_0x7c17('0x21')]({'raw':_0x1378e7['options']?_0x1378e7[_0x7c17('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1378e7[_0x7c17('0x18')]?_0x1378e7[_0x7c17('0x18')][_0x7c17('0x1a')]||null:null,'attributes':_0x1378e7[_0x7c17('0x18')]?_0x1378e7['options'][_0x7c17('0x1c')]||null:null,'include':_0x1378e7[_0x7c17('0x18')]?_0x1378e7[_0x7c17('0x18')][_0x7c17('0x1b')]?_[_0x7c17('0x1e')](_0x1378e7[_0x7c17('0x18')]['include'],function(_0x8c237f){return{'model':db[_0x8c237f[_0x7c17('0x1d')]],'as':_0x8c237f['as'],'attributes':_0x8c237f['attributes'],'include':_0x8c237f[_0x7c17('0x1b')]?_[_0x7c17('0x1e')](_0x8c237f['include'],function(_0x37a986){return{'model':db[_0x37a986['model']],'as':_0x37a986['as'],'attributes':_0x37a986[_0x7c17('0x1c')],'include':_0x37a986[_0x7c17('0x1b')]?_[_0x7c17('0x1e')](_0x37a986['include'],function(_0x8f24cc){return{'model':db[_0x8f24cc[_0x7c17('0x1d')]],'as':_0x8f24cc['as'],'attributes':_0x8f24cc[_0x7c17('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x502e36){logger[_0x7c17('0xe')]('ShowZohoAccount',_0x1378e7);logger[_0x7c17('0x1f')](_0x7c17('0x22'),_0x1378e7,JSON[_0x7c17('0x11')](_0x502e36));_0x4dd018(_0x502e36);})['catch'](function(_0x369c70){logger[_0x7c17('0x12')](_0x7c17('0x22'),_0x369c70[_0x7c17('0x13')],_0x1378e7);_0x98f8f4(_0x61a143[_0x7c17('0x12')](0x1f4,_0x369c70[_0x7c17('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index d8abb1e..40702d9 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 _0x945a=['post','create','put','/:id','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions'];(function(_0x2fa255,_0xae09a4){var _0x116134=function(_0x206e9f){while(--_0x206e9f){_0x2fa255['push'](_0x2fa255['shift']());}};_0x116134(++_0xae09a4);}(_0x945a,0x140));var _0xa945=function(_0x12780d,_0x4e69c4){_0x12780d=_0x12780d-0x0;var _0x2023fe=_0x945a[_0x12780d];return _0x2023fe;};'use strict';var multer=require(_0xa945('0x0'));var util=require('util');var path=require(_0xa945('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa945('0x2')]();var fs_extra=require(_0xa945('0x3'));var auth=require(_0xa945('0x4'));var interaction=require(_0xa945('0x5'));var config=require('../../config/environment');var controller=require(_0xa945('0x6'));router[_0xa945('0x7')]('/',auth[_0xa945('0x8')](),controller[_0xa945('0x9')]);router[_0xa945('0x7')]('/:id',auth[_0xa945('0x8')](),controller[_0xa945('0xa')]);router[_0xa945('0x7')](_0xa945('0xb'),auth[_0xa945('0x8')](),controller[_0xa945('0xc')]);router[_0xa945('0x7')](_0xa945('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xa945('0x7')](_0xa945('0xe'),auth[_0xa945('0x8')](),controller[_0xa945('0xf')]);router[_0xa945('0x10')]('/',auth[_0xa945('0x8')](),controller[_0xa945('0x11')]);router[_0xa945('0x12')](_0xa945('0x13'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa945('0x13'),auth[_0xa945('0x8')](),controller['destroy']);module[_0xa945('0x14')]=router; \ No newline at end of file +var _0x7155=['/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x453d8b,_0x3c3e28){var _0x5a23c1=function(_0x3eeb22){while(--_0x3eeb22){_0x453d8b['push'](_0x453d8b['shift']());}};_0x5a23c1(++_0x3c3e28);}(_0x7155,0x19f));var _0x5715=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7155[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x5715('0x0'));var path=require(_0x5715('0x1'));var timeout=require(_0x5715('0x2'));var express=require(_0x5715('0x3'));var router=express[_0x5715('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5715('0x5'));var config=require(_0x5715('0x6'));var controller=require(_0x5715('0x7'));router[_0x5715('0x8')]('/',auth[_0x5715('0x9')](),controller[_0x5715('0xa')]);router[_0x5715('0x8')](_0x5715('0xb'),auth[_0x5715('0x9')](),controller[_0x5715('0xc')]);router[_0x5715('0x8')](_0x5715('0xd'),auth['isAuthenticated'](),controller[_0x5715('0xe')]);router[_0x5715('0x8')](_0x5715('0xf'),auth[_0x5715('0x9')](),controller[_0x5715('0x10')]);router[_0x5715('0x8')](_0x5715('0x11'),auth['isAuthenticated'](),controller[_0x5715('0x12')]);router['post']('/',auth[_0x5715('0x9')](),controller['create']);router[_0x5715('0x13')](_0x5715('0xb'),auth[_0x5715('0x9')](),controller[_0x5715('0x14')]);router[_0x5715('0x15')](_0x5715('0xb'),auth[_0x5715('0x9')](),controller[_0x5715('0x16')]);module[_0x5715('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index eb37c64..8713efa 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 _0x3450=['STRING','ENUM','lead','contact','nothing','contact_lead','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3450,0x1ee));var _0x0345=function(_0x3f9b50,_0x5d40fc){_0x3f9b50=_0x3f9b50-0x0;var _0x48ffaf=_0x3450[_0x3f9b50];return _0x48ffaf;};'use strict';var Sequelize=require(_0x0345('0x0'));module[_0x0345('0x1')]={'name':{'type':Sequelize[_0x0345('0x2')]},'moduleCreate':{'type':Sequelize[_0x0345('0x3')](_0x0345('0x4'),_0x0345('0x5'),_0x0345('0x6')),'defaultValue':_0x0345('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x0345('0x7'),_0x0345('0x5'),_0x0345('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x0345('0x2')]}}; \ No newline at end of file +var _0xfdc5=['sequelize','exports','STRING','ENUM','lead','contact','nothing','contact_lead'];(function(_0x3d6bab,_0x3242db){var _0x348415=function(_0x324f3b){while(--_0x324f3b){_0x3d6bab['push'](_0x3d6bab['shift']());}};_0x348415(++_0x3242db);}(_0xfdc5,0xa8));var _0x5fdc=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfdc5[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x5fdc('0x0'));module[_0x5fdc('0x1')]={'name':{'type':Sequelize[_0x5fdc('0x2')]},'moduleCreate':{'type':Sequelize[_0x5fdc('0x3')](_0x5fdc('0x4'),_0x5fdc('0x5'),_0x5fdc('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x5fdc('0x3')]('contact_lead',_0x5fdc('0x5'),_0x5fdc('0x4')),'defaultValue':_0x5fdc('0x7')},'description':{'type':Sequelize[_0x5fdc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 8d7a036..9c8937e 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 _0x8497=['then','destroy','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','find','catch','create','body','params','getFields','findOne','getSubjects','getDescriptions','ZohoField','nolimit','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update'];(function(_0x313c4e,_0x553488){var _0x2aab8e=function(_0x5c296c){while(--_0x5c296c){_0x313c4e['push'](_0x313c4e['shift']());}};_0x2aab8e(++_0x553488);}(_0x8497,0x1c7));var _0x7849=function(_0x31977a,_0x4c8389){_0x31977a=_0x31977a-0x0;var _0x437ae2=_0x8497[_0x31977a];return _0x437ae2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7849('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7849('0x1'));var rp=require(_0x7849('0x2'));var moment=require('moment');var BPromise=require(_0x7849('0x3'));var Mustache=require(_0x7849('0x4'));var util=require('util');var path=require(_0x7849('0x5'));var sox=require(_0x7849('0x6'));var csv=require(_0x7849('0x7'));var ejs=require(_0x7849('0x8'));var fs=require('fs');var fs_extra=require(_0x7849('0x9'));var _=require(_0x7849('0xa'));var squel=require(_0x7849('0xb'));var crypto=require(_0x7849('0xc'));var jsforce=require(_0x7849('0xd'));var deskjs=require(_0x7849('0xe'));var toCsv=require(_0x7849('0x7'));var querystring=require('querystring');var Papa=require(_0x7849('0xf'));var Redis=require(_0x7849('0x10'));var authService=require(_0x7849('0x11'));var qs=require(_0x7849('0x12'));var as=require(_0x7849('0x13'));var hardwareService=require(_0x7849('0x14'));var logger=require(_0x7849('0x15'))(_0x7849('0x16'));var utils=require(_0x7849('0x17'));var config=require(_0x7849('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7849('0x19'))['db'];function respondWithStatusCode(_0x34a70e,_0x3bf192){_0x3bf192=_0x3bf192||0xcc;return function(_0x28027d){if(_0x28027d){return _0x34a70e['sendStatus'](_0x3bf192);}return _0x34a70e[_0x7849('0x1a')](_0x3bf192)[_0x7849('0x1b')]();};}function respondWithResult(_0x490d30,_0x3e11af){_0x3e11af=_0x3e11af||0xc8;return function(_0x481c5e){if(_0x481c5e){return _0x490d30[_0x7849('0x1a')](_0x3e11af)['json'](_0x481c5e);}};}function respondWithFilteredResult(_0x517835,_0x2ae801){return function(_0x2d9f90){if(_0x2d9f90){var _0x337db0=typeof _0x2ae801[_0x7849('0x1c')]===_0x7849('0x1d')&&typeof _0x2ae801[_0x7849('0x1e')]===_0x7849('0x1d');var _0x13fb0f=_0x2d9f90[_0x7849('0x1f')];var _0x3cd592=_0x337db0?0x0:_0x2ae801[_0x7849('0x1c')];var _0x3776da=_0x337db0?_0x2d9f90['count']:_0x2ae801[_0x7849('0x1c')]+_0x2ae801[_0x7849('0x1e')];var _0x5d0b90;if(_0x3776da>=_0x13fb0f){_0x3776da=_0x13fb0f;_0x5d0b90=0xc8;}else{_0x5d0b90=0xce;}_0x517835[_0x7849('0x1a')](_0x5d0b90);return _0x517835[_0x7849('0x20')](_0x7849('0x21'),_0x3cd592+'-'+_0x3776da+'/'+_0x13fb0f)[_0x7849('0x22')](_0x2d9f90);}return null;};}function patchUpdates(_0x2aa28f){return function(_0x5e162c){try{jsonpatch['apply'](_0x5e162c,_0x2aa28f,!![]);}catch(_0x51f876){return BPromise['reject'](_0x51f876);}return _0x5e162c[_0x7849('0x23')]();};}function saveUpdates(_0x1e0778,_0x43b45d){return function(_0xd4a81a){if(_0xd4a81a){return _0xd4a81a[_0x7849('0x24')](_0x1e0778)[_0x7849('0x25')](function(_0x3bbb4c){return _0x3bbb4c;});}return null;};}function removeEntity(_0x295cc4,_0x4b1d83){return function(_0x1ddf71){if(_0x1ddf71){return _0x1ddf71[_0x7849('0x26')]()[_0x7849('0x25')](function(){_0x295cc4[_0x7849('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27388e,_0x46eebe){return function(_0x295a4d){if(!_0x295a4d){_0x27388e[_0x7849('0x27')](0x194);}return _0x295a4d;};}function handleError(_0x5e98ce,_0x2b8ea4){_0x2b8ea4=_0x2b8ea4||0x1f4;return function(_0x204cd4){logger[_0x7849('0x28')](_0x204cd4[_0x7849('0x29')]);if(_0x204cd4[_0x7849('0x2a')]){delete _0x204cd4[_0x7849('0x2a')];}_0x5e98ce['status'](_0x2b8ea4)[_0x7849('0x2b')](_0x204cd4);};}exports[_0x7849('0x2c')]=function(_0x415139,_0x5ee3e8){var _0x419e63={},_0xbc41cd={},_0x224671={'count':0x0,'rows':[]};var _0x2d54d5=_[_0x7849('0x2d')](db[_0x7849('0x2e')][_0x7849('0x2f')],function(_0x2f94fc){return{'name':_0x2f94fc[_0x7849('0x30')],'type':_0x2f94fc[_0x7849('0x31')][_0x7849('0x32')]};});_0xbc41cd[_0x7849('0x33')]=_[_0x7849('0x2d')](_0x2d54d5,_0x7849('0x2a'));_0xbc41cd[_0x7849('0x34')]=_[_0x7849('0x35')](_0x415139['query']);_0xbc41cd[_0x7849('0x36')]=_[_0x7849('0x37')](_0xbc41cd[_0x7849('0x33')],_0xbc41cd[_0x7849('0x34')]);_0x419e63[_0x7849('0x38')]=_['intersection'](_0xbc41cd['model'],qs[_0x7849('0x39')](_0x415139[_0x7849('0x34')][_0x7849('0x39')]));_0x419e63['attributes']=_0x419e63['attributes'][_0x7849('0x3a')]?_0x419e63[_0x7849('0x38')]:_0xbc41cd[_0x7849('0x33')];if(!_0x415139[_0x7849('0x34')][_0x7849('0x3b')]('nolimit')){_0x419e63[_0x7849('0x1e')]=qs[_0x7849('0x1e')](_0x415139[_0x7849('0x34')][_0x7849('0x1e')]);_0x419e63[_0x7849('0x1c')]=qs[_0x7849('0x1c')](_0x415139['query'][_0x7849('0x1c')]);}_0x419e63[_0x7849('0x3c')]=qs[_0x7849('0x3d')](_0x415139[_0x7849('0x34')][_0x7849('0x3d')]);_0x419e63[_0x7849('0x3e')]=qs[_0x7849('0x36')](_[_0x7849('0x3f')](_0x415139[_0x7849('0x34')],_0xbc41cd['filters']),_0x2d54d5);if(_0x415139[_0x7849('0x34')][_0x7849('0x40')]){_0x419e63[_0x7849('0x3e')]=_[_0x7849('0x41')](_0x419e63[_0x7849('0x3e')],{'$or':_[_0x7849('0x2d')](_0x2d54d5,function(_0x5997b2){if(_0x5997b2['type']!==_0x7849('0x42')){var _0xe22004={};_0xe22004[_0x5997b2[_0x7849('0x2a')]]={'$like':'%'+_0x415139['query'][_0x7849('0x40')]+'%'};return _0xe22004;}})});}_0x419e63=_[_0x7849('0x41')]({},_0x419e63,_0x415139[_0x7849('0x43')]);var _0x5666fb={'where':_0x419e63['where']};return db[_0x7849('0x2e')][_0x7849('0x1f')](_0x5666fb)['then'](function(_0x38f88b){_0x224671[_0x7849('0x1f')]=_0x38f88b;if(_0x415139[_0x7849('0x34')][_0x7849('0x44')]){_0x419e63[_0x7849('0x45')]=[{'all':!![]}];}return db[_0x7849('0x2e')]['findAll'](_0x419e63);})['then'](function(_0x4c6631){_0x224671[_0x7849('0x46')]=_0x4c6631;return _0x224671;})[_0x7849('0x25')](respondWithFilteredResult(_0x5ee3e8,_0x419e63))['catch'](handleError(_0x5ee3e8,null));};exports['show']=function(_0x5d5ba8,_0xabb611){var _0x2263bd={'raw':![],'where':{'id':_0x5d5ba8['params']['id']}},_0x3240c3={};_0x3240c3[_0x7849('0x33')]=_[_0x7849('0x35')](db['ZohoConfiguration'][_0x7849('0x2f')]);_0x3240c3[_0x7849('0x34')]=_['keys'](_0x5d5ba8[_0x7849('0x34')]);_0x3240c3[_0x7849('0x36')]=_[_0x7849('0x37')](_0x3240c3[_0x7849('0x33')],_0x3240c3['query']);_0x2263bd[_0x7849('0x38')]=_[_0x7849('0x37')](_0x3240c3['model'],qs[_0x7849('0x39')](_0x5d5ba8[_0x7849('0x34')][_0x7849('0x39')]));_0x2263bd[_0x7849('0x38')]=_0x2263bd[_0x7849('0x38')][_0x7849('0x3a')]?_0x2263bd['attributes']:_0x3240c3[_0x7849('0x33')];if(_0x5d5ba8[_0x7849('0x34')][_0x7849('0x44')]){_0x2263bd[_0x7849('0x45')]=[{'all':!![]}];}_0x2263bd=_[_0x7849('0x41')]({},_0x2263bd,_0x5d5ba8[_0x7849('0x43')]);return db[_0x7849('0x2e')][_0x7849('0x47')](_0x2263bd)[_0x7849('0x25')](handleEntityNotFound(_0xabb611,null))['then'](respondWithResult(_0xabb611,null))[_0x7849('0x48')](handleError(_0xabb611,null));};exports[_0x7849('0x49')]=function(_0x25ecda,_0x4c70b5){return db[_0x7849('0x2e')]['create'](_0x25ecda[_0x7849('0x4a')],{})['then'](respondWithResult(_0x4c70b5,0xc9))[_0x7849('0x48')](handleError(_0x4c70b5,null));};exports[_0x7849('0x24')]=function(_0x14886d,_0x2a1224){if(_0x14886d[_0x7849('0x4a')]['id']){delete _0x14886d[_0x7849('0x4a')]['id'];}return db[_0x7849('0x2e')][_0x7849('0x47')]({'where':{'id':_0x14886d[_0x7849('0x4b')]['id']}})[_0x7849('0x25')](handleEntityNotFound(_0x2a1224,null))[_0x7849('0x25')](saveUpdates(_0x14886d[_0x7849('0x4a')],null))[_0x7849('0x25')](respondWithResult(_0x2a1224,null))[_0x7849('0x48')](handleError(_0x2a1224,null));};exports[_0x7849('0x26')]=function(_0x4bb965,_0x28b9db){return db[_0x7849('0x2e')][_0x7849('0x47')]({'where':{'id':_0x4bb965[_0x7849('0x4b')]['id']}})[_0x7849('0x25')](handleEntityNotFound(_0x28b9db,null))['then'](removeEntity(_0x28b9db,null))[_0x7849('0x48')](handleError(_0x28b9db,null));};exports[_0x7849('0x4c')]=function(_0x3de415,_0x408217,_0x383071){var _0x4ca712={};var _0x2b3fcc={};var _0x2571c3;var _0x50a89e;return db['ZohoConfiguration'][_0x7849('0x4d')]({'where':{'id':_0x3de415['params']['id']}})[_0x7849('0x25')](handleEntityNotFound(_0x408217,null))[_0x7849('0x25')](function(_0x5f5800){if(_0x5f5800){_0x2571c3=_0x5f5800;_0x2b3fcc[_0x7849('0x33')]=_[_0x7849('0x35')](db['ZohoField'][_0x7849('0x2f')]);_0x2b3fcc['query']=_['keys'](_0x3de415[_0x7849('0x34')]);_0x2b3fcc[_0x7849('0x36')]=_[_0x7849('0x37')](_0x2b3fcc[_0x7849('0x33')],_0x2b3fcc['query']);_0x4ca712['attributes']=_['intersection'](_0x2b3fcc[_0x7849('0x33')],qs[_0x7849('0x39')](_0x3de415[_0x7849('0x34')][_0x7849('0x39')]));_0x4ca712['attributes']=_0x4ca712[_0x7849('0x38')][_0x7849('0x3a')]?_0x4ca712[_0x7849('0x38')]:_0x2b3fcc[_0x7849('0x33')];_0x4ca712[_0x7849('0x3c')]=qs['sort'](_0x3de415['query'][_0x7849('0x3d')]);_0x4ca712[_0x7849('0x3e')]=qs[_0x7849('0x36')](_['pick'](_0x3de415['query'],_0x2b3fcc[_0x7849('0x36')]));if(_0x3de415[_0x7849('0x34')]['filter']){_0x4ca712[_0x7849('0x3e')]=_[_0x7849('0x41')](_0x4ca712[_0x7849('0x3e')],{'$or':_['map'](_0x4ca712[_0x7849('0x38')],function(_0x10f27d){var _0xbcfd5a={};_0xbcfd5a[_0x10f27d]={'$like':'%'+_0x3de415[_0x7849('0x34')][_0x7849('0x40')]+'%'};return _0xbcfd5a;})});}_0x4ca712=_[_0x7849('0x41')]({},_0x4ca712,_0x3de415[_0x7849('0x43')]);return _0x2571c3[_0x7849('0x4c')](_0x4ca712);}})[_0x7849('0x25')](function(_0x4fbaca){if(_0x4fbaca){_0x50a89e=_0x4fbaca[_0x7849('0x3a')];if(!_0x3de415[_0x7849('0x34')]['hasOwnProperty']('nolimit')){_0x4ca712[_0x7849('0x1e')]=qs[_0x7849('0x1e')](_0x3de415[_0x7849('0x34')]['limit']);_0x4ca712[_0x7849('0x1c')]=qs['offset'](_0x3de415[_0x7849('0x34')][_0x7849('0x1c')]);}return _0x2571c3[_0x7849('0x4c')](_0x4ca712);}})[_0x7849('0x25')](function(_0x44b4b3){if(_0x44b4b3){return _0x44b4b3?{'count':_0x50a89e,'rows':_0x44b4b3}:null;}})[_0x7849('0x25')](respondWithResult(_0x408217,null))['catch'](handleError(_0x408217,null));};exports[_0x7849('0x4e')]=function(_0x9604ce,_0x139a3a,_0x5e7ab3){var _0x13dc70={};var _0x205452={};var _0x5a578f;var _0x36a104;return db[_0x7849('0x2e')]['findOne']({'where':{'id':_0x9604ce['params']['id']}})[_0x7849('0x25')](handleEntityNotFound(_0x139a3a,null))[_0x7849('0x25')](function(_0x1c9422){if(_0x1c9422){_0x5a578f=_0x1c9422;_0x205452[_0x7849('0x33')]=_[_0x7849('0x35')](db['ZohoField']['rawAttributes']);_0x205452[_0x7849('0x34')]=_[_0x7849('0x35')](_0x9604ce[_0x7849('0x34')]);_0x205452[_0x7849('0x36')]=_[_0x7849('0x37')](_0x205452[_0x7849('0x33')],_0x205452[_0x7849('0x34')]);_0x13dc70[_0x7849('0x38')]=_['intersection'](_0x205452[_0x7849('0x33')],qs['fields'](_0x9604ce[_0x7849('0x34')][_0x7849('0x39')]));_0x13dc70[_0x7849('0x38')]=_0x13dc70[_0x7849('0x38')]['length']?_0x13dc70[_0x7849('0x38')]:_0x205452[_0x7849('0x33')];_0x13dc70[_0x7849('0x3c')]=qs[_0x7849('0x3d')](_0x9604ce[_0x7849('0x34')]['sort']);_0x13dc70[_0x7849('0x3e')]=qs[_0x7849('0x36')](_['pick'](_0x9604ce[_0x7849('0x34')],_0x205452[_0x7849('0x36')]));if(_0x9604ce[_0x7849('0x34')][_0x7849('0x40')]){_0x13dc70[_0x7849('0x3e')]=_['merge'](_0x13dc70[_0x7849('0x3e')],{'$or':_[_0x7849('0x2d')](_0x13dc70[_0x7849('0x38')],function(_0x1bf7ee){var _0x3bc8f6={};_0x3bc8f6[_0x1bf7ee]={'$like':'%'+_0x9604ce['query'][_0x7849('0x40')]+'%'};return _0x3bc8f6;})});}_0x13dc70=_[_0x7849('0x41')]({},_0x13dc70,_0x9604ce[_0x7849('0x43')]);return _0x5a578f[_0x7849('0x4e')](_0x13dc70);}})[_0x7849('0x25')](function(_0x566898){if(_0x566898){_0x36a104=_0x566898[_0x7849('0x3a')];if(!_0x9604ce[_0x7849('0x34')][_0x7849('0x3b')]('nolimit')){_0x13dc70[_0x7849('0x1e')]=qs[_0x7849('0x1e')](_0x9604ce[_0x7849('0x34')][_0x7849('0x1e')]);_0x13dc70[_0x7849('0x1c')]=qs['offset'](_0x9604ce[_0x7849('0x34')][_0x7849('0x1c')]);}return _0x5a578f[_0x7849('0x4e')](_0x13dc70);}})[_0x7849('0x25')](function(_0x306bcd){if(_0x306bcd){return _0x306bcd?{'count':_0x36a104,'rows':_0x306bcd}:null;}})[_0x7849('0x25')](respondWithResult(_0x139a3a,null))['catch'](handleError(_0x139a3a,null));};exports[_0x7849('0x4f')]=function(_0x4bd30c,_0x54d077,_0x4cce60){var _0x1a523e={};var _0x2b6fee={};var _0x4d78f8;var _0x4a3268;return db[_0x7849('0x2e')][_0x7849('0x4d')]({'where':{'id':_0x4bd30c[_0x7849('0x4b')]['id']}})[_0x7849('0x25')](handleEntityNotFound(_0x54d077,null))[_0x7849('0x25')](function(_0x5f7202){if(_0x5f7202){_0x4d78f8=_0x5f7202;_0x2b6fee[_0x7849('0x33')]=_[_0x7849('0x35')](db[_0x7849('0x50')][_0x7849('0x2f')]);_0x2b6fee['query']=_[_0x7849('0x35')](_0x4bd30c[_0x7849('0x34')]);_0x2b6fee['filters']=_['intersection'](_0x2b6fee['model'],_0x2b6fee[_0x7849('0x34')]);_0x1a523e[_0x7849('0x38')]=_['intersection'](_0x2b6fee[_0x7849('0x33')],qs['fields'](_0x4bd30c[_0x7849('0x34')]['fields']));_0x1a523e[_0x7849('0x38')]=_0x1a523e[_0x7849('0x38')]['length']?_0x1a523e['attributes']:_0x2b6fee[_0x7849('0x33')];_0x1a523e[_0x7849('0x3c')]=qs['sort'](_0x4bd30c[_0x7849('0x34')]['sort']);_0x1a523e[_0x7849('0x3e')]=qs[_0x7849('0x36')](_['pick'](_0x4bd30c['query'],_0x2b6fee[_0x7849('0x36')]));if(_0x4bd30c[_0x7849('0x34')][_0x7849('0x40')]){_0x1a523e[_0x7849('0x3e')]=_[_0x7849('0x41')](_0x1a523e[_0x7849('0x3e')],{'$or':_['map'](_0x1a523e[_0x7849('0x38')],function(_0x55bcfd){var _0x1b2070={};_0x1b2070[_0x55bcfd]={'$like':'%'+_0x4bd30c[_0x7849('0x34')]['filter']+'%'};return _0x1b2070;})});}_0x1a523e=_[_0x7849('0x41')]({},_0x1a523e,_0x4bd30c['options']);return _0x4d78f8[_0x7849('0x4f')](_0x1a523e);}})[_0x7849('0x25')](function(_0x3ceb8c){if(_0x3ceb8c){_0x4a3268=_0x3ceb8c[_0x7849('0x3a')];if(!_0x4bd30c['query']['hasOwnProperty'](_0x7849('0x51'))){_0x1a523e[_0x7849('0x1e')]=qs['limit'](_0x4bd30c['query'][_0x7849('0x1e')]);_0x1a523e[_0x7849('0x1c')]=qs[_0x7849('0x1c')](_0x4bd30c[_0x7849('0x34')][_0x7849('0x1c')]);}return _0x4d78f8[_0x7849('0x4f')](_0x1a523e);}})[_0x7849('0x25')](function(_0x4044a7){if(_0x4044a7){return _0x4044a7?{'count':_0x4a3268,'rows':_0x4044a7}:null;}})[_0x7849('0x25')](respondWithResult(_0x54d077,null))[_0x7849('0x48')](handleError(_0x54d077,null));}; \ No newline at end of file +var _0x458d=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','getFields','findOne','pick','options','ZohoField','getSubjects','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','model','query'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x458d,0x6c));var _0xd458=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x458d[_0x2112d4];return _0x434972;};'use strict';var emlformat=require(_0xd458('0x0'));var rimraf=require(_0xd458('0x1'));var zipdir=require(_0xd458('0x2'));var jsonpatch=require(_0xd458('0x3'));var rp=require(_0xd458('0x4'));var moment=require('moment');var BPromise=require(_0xd458('0x5'));var Mustache=require(_0xd458('0x6'));var util=require(_0xd458('0x7'));var path=require(_0xd458('0x8'));var sox=require(_0xd458('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd458('0xa'));var _=require('lodash');var squel=require(_0xd458('0xb'));var crypto=require(_0xd458('0xc'));var jsforce=require(_0xd458('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd458('0xe'));var Papa=require(_0xd458('0xf'));var Redis=require(_0xd458('0x10'));var authService=require(_0xd458('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd458('0x12'));var hardwareService=require(_0xd458('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd458('0x14'));var config=require(_0xd458('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd458('0x16'))['db'];function respondWithStatusCode(_0x1498f6,_0x2c8d30){_0x2c8d30=_0x2c8d30||0xcc;return function(_0x3d76aa){if(_0x3d76aa){return _0x1498f6['sendStatus'](_0x2c8d30);}return _0x1498f6[_0xd458('0x17')](_0x2c8d30)[_0xd458('0x18')]();};}function respondWithResult(_0x29e884,_0x29154c){_0x29154c=_0x29154c||0xc8;return function(_0x89cf34){if(_0x89cf34){return _0x29e884['status'](_0x29154c)[_0xd458('0x19')](_0x89cf34);}};}function respondWithFilteredResult(_0x427db7,_0x4eb0d5){return function(_0x301ee1){if(_0x301ee1){var _0x203a67=typeof _0x4eb0d5[_0xd458('0x1a')]==='undefined'&&typeof _0x4eb0d5[_0xd458('0x1b')]===_0xd458('0x1c');var _0x5e217=_0x301ee1[_0xd458('0x1d')];var _0x3925f7=_0x203a67?0x0:_0x4eb0d5['offset'];var _0x1a9587=_0x203a67?_0x301ee1[_0xd458('0x1d')]:_0x4eb0d5[_0xd458('0x1a')]+_0x4eb0d5[_0xd458('0x1b')];var _0x32d48c;if(_0x1a9587>=_0x5e217){_0x1a9587=_0x5e217;_0x32d48c=0xc8;}else{_0x32d48c=0xce;}_0x427db7['status'](_0x32d48c);return _0x427db7[_0xd458('0x1e')](_0xd458('0x1f'),_0x3925f7+'-'+_0x1a9587+'/'+_0x5e217)[_0xd458('0x19')](_0x301ee1);}return null;};}function patchUpdates(_0x93681f){return function(_0x15fb95){try{jsonpatch[_0xd458('0x20')](_0x15fb95,_0x93681f,!![]);}catch(_0x28c998){return BPromise['reject'](_0x28c998);}return _0x15fb95[_0xd458('0x21')]();};}function saveUpdates(_0x4eac97,_0x51d20f){return function(_0x1ff75c){if(_0x1ff75c){return _0x1ff75c[_0xd458('0x22')](_0x4eac97)[_0xd458('0x23')](function(_0x341caa){return _0x341caa;});}return null;};}function removeEntity(_0x17e357,_0x99fbbe){return function(_0x242bfa){if(_0x242bfa){return _0x242bfa[_0xd458('0x24')]()[_0xd458('0x23')](function(){_0x17e357[_0xd458('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x350c53,_0x398cfa){return function(_0x120082){if(!_0x120082){_0x350c53[_0xd458('0x25')](0x194);}return _0x120082;};}function handleError(_0x12644d,_0x35986b){_0x35986b=_0x35986b||0x1f4;return function(_0x107c13){logger[_0xd458('0x26')](_0x107c13[_0xd458('0x27')]);if(_0x107c13['name']){delete _0x107c13[_0xd458('0x28')];}_0x12644d[_0xd458('0x17')](_0x35986b)[_0xd458('0x29')](_0x107c13);};}exports[_0xd458('0x2a')]=function(_0x5567f8,_0x2a52e6){var _0x54c082={},_0x456ed5={},_0x319270={'count':0x0,'rows':[]};var _0x5e3b00=_[_0xd458('0x2b')](db[_0xd458('0x2c')][_0xd458('0x2d')],function(_0x5609a7){return{'name':_0x5609a7['fieldName'],'type':_0x5609a7[_0xd458('0x2e')][_0xd458('0x2f')]};});_0x456ed5[_0xd458('0x30')]=_[_0xd458('0x2b')](_0x5e3b00,_0xd458('0x28'));_0x456ed5[_0xd458('0x31')]=_['keys'](_0x5567f8['query']);_0x456ed5['filters']=_[_0xd458('0x32')](_0x456ed5['model'],_0x456ed5['query']);_0x54c082['attributes']=_['intersection'](_0x456ed5['model'],qs[_0xd458('0x33')](_0x5567f8[_0xd458('0x31')][_0xd458('0x33')]));_0x54c082[_0xd458('0x34')]=_0x54c082['attributes'][_0xd458('0x35')]?_0x54c082['attributes']:_0x456ed5[_0xd458('0x30')];if(!_0x5567f8['query'][_0xd458('0x36')](_0xd458('0x37'))){_0x54c082['limit']=qs['limit'](_0x5567f8['query'][_0xd458('0x1b')]);_0x54c082[_0xd458('0x1a')]=qs[_0xd458('0x1a')](_0x5567f8[_0xd458('0x31')][_0xd458('0x1a')]);}_0x54c082[_0xd458('0x38')]=qs[_0xd458('0x39')](_0x5567f8[_0xd458('0x31')][_0xd458('0x39')]);_0x54c082[_0xd458('0x3a')]=qs['filters'](_['pick'](_0x5567f8[_0xd458('0x31')],_0x456ed5[_0xd458('0x3b')]),_0x5e3b00);if(_0x5567f8[_0xd458('0x31')][_0xd458('0x3c')]){_0x54c082['where']=_[_0xd458('0x3d')](_0x54c082[_0xd458('0x3a')],{'$or':_['map'](_0x5e3b00,function(_0x2727ea){if(_0x2727ea[_0xd458('0x2e')]!=='VIRTUAL'){var _0x4a9c61={};_0x4a9c61[_0x2727ea[_0xd458('0x28')]]={'$like':'%'+_0x5567f8[_0xd458('0x31')][_0xd458('0x3c')]+'%'};return _0x4a9c61;}})});}_0x54c082=_[_0xd458('0x3d')]({},_0x54c082,_0x5567f8['options']);var _0x160f3b={'where':_0x54c082[_0xd458('0x3a')]};return db['ZohoConfiguration'][_0xd458('0x1d')](_0x160f3b)['then'](function(_0x48660d){_0x319270[_0xd458('0x1d')]=_0x48660d;if(_0x5567f8[_0xd458('0x31')][_0xd458('0x3e')]){_0x54c082[_0xd458('0x3f')]=[{'all':!![]}];}return db[_0xd458('0x2c')][_0xd458('0x40')](_0x54c082);})[_0xd458('0x23')](function(_0x596ea3){_0x319270[_0xd458('0x41')]=_0x596ea3;return _0x319270;})['then'](respondWithFilteredResult(_0x2a52e6,_0x54c082))['catch'](handleError(_0x2a52e6,null));};exports[_0xd458('0x42')]=function(_0xd9ac40,_0x2422ac){var _0x4395f3={'raw':![],'where':{'id':_0xd9ac40[_0xd458('0x43')]['id']}},_0x50de6a={};_0x50de6a[_0xd458('0x30')]=_[_0xd458('0x44')](db[_0xd458('0x2c')][_0xd458('0x2d')]);_0x50de6a[_0xd458('0x31')]=_[_0xd458('0x44')](_0xd9ac40[_0xd458('0x31')]);_0x50de6a[_0xd458('0x3b')]=_[_0xd458('0x32')](_0x50de6a[_0xd458('0x30')],_0x50de6a['query']);_0x4395f3[_0xd458('0x34')]=_['intersection'](_0x50de6a[_0xd458('0x30')],qs[_0xd458('0x33')](_0xd9ac40[_0xd458('0x31')][_0xd458('0x33')]));_0x4395f3[_0xd458('0x34')]=_0x4395f3[_0xd458('0x34')]['length']?_0x4395f3[_0xd458('0x34')]:_0x50de6a[_0xd458('0x30')];if(_0xd9ac40[_0xd458('0x31')][_0xd458('0x3e')]){_0x4395f3[_0xd458('0x3f')]=[{'all':!![]}];}_0x4395f3=_['merge']({},_0x4395f3,_0xd9ac40['options']);return db[_0xd458('0x2c')]['find'](_0x4395f3)[_0xd458('0x23')](handleEntityNotFound(_0x2422ac,null))['then'](respondWithResult(_0x2422ac,null))[_0xd458('0x45')](handleError(_0x2422ac,null));};exports[_0xd458('0x46')]=function(_0x29e1c0,_0x4fcddb){return db[_0xd458('0x2c')][_0xd458('0x46')](_0x29e1c0['body'],{})[_0xd458('0x23')](respondWithResult(_0x4fcddb,0xc9))['catch'](handleError(_0x4fcddb,null));};exports['update']=function(_0x5bf624,_0x44f8f4){if(_0x5bf624[_0xd458('0x47')]['id']){delete _0x5bf624[_0xd458('0x47')]['id'];}return db[_0xd458('0x2c')][_0xd458('0x48')]({'where':{'id':_0x5bf624['params']['id']}})[_0xd458('0x23')](handleEntityNotFound(_0x44f8f4,null))[_0xd458('0x23')](saveUpdates(_0x5bf624[_0xd458('0x47')],null))['then'](respondWithResult(_0x44f8f4,null))[_0xd458('0x45')](handleError(_0x44f8f4,null));};exports[_0xd458('0x24')]=function(_0x52326c,_0x5a8baa){return db[_0xd458('0x2c')][_0xd458('0x48')]({'where':{'id':_0x52326c[_0xd458('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a8baa,null))[_0xd458('0x23')](removeEntity(_0x5a8baa,null))[_0xd458('0x45')](handleError(_0x5a8baa,null));};exports[_0xd458('0x49')]=function(_0x41d166,_0x5e637d,_0x8f7596){var _0x53ec26={};var _0x3b0785={};var _0x447dbd;var _0x3169e4;return db[_0xd458('0x2c')][_0xd458('0x4a')]({'where':{'id':_0x41d166[_0xd458('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e637d,null))['then'](function(_0x43084b){if(_0x43084b){_0x447dbd=_0x43084b;_0x3b0785[_0xd458('0x30')]=_['keys'](db['ZohoField'][_0xd458('0x2d')]);_0x3b0785[_0xd458('0x31')]=_[_0xd458('0x44')](_0x41d166['query']);_0x3b0785[_0xd458('0x3b')]=_['intersection'](_0x3b0785[_0xd458('0x30')],_0x3b0785[_0xd458('0x31')]);_0x53ec26[_0xd458('0x34')]=_['intersection'](_0x3b0785['model'],qs['fields'](_0x41d166[_0xd458('0x31')][_0xd458('0x33')]));_0x53ec26[_0xd458('0x34')]=_0x53ec26[_0xd458('0x34')][_0xd458('0x35')]?_0x53ec26[_0xd458('0x34')]:_0x3b0785[_0xd458('0x30')];_0x53ec26[_0xd458('0x38')]=qs[_0xd458('0x39')](_0x41d166['query'][_0xd458('0x39')]);_0x53ec26['where']=qs['filters'](_[_0xd458('0x4b')](_0x41d166[_0xd458('0x31')],_0x3b0785[_0xd458('0x3b')]));if(_0x41d166[_0xd458('0x31')][_0xd458('0x3c')]){_0x53ec26[_0xd458('0x3a')]=_[_0xd458('0x3d')](_0x53ec26[_0xd458('0x3a')],{'$or':_[_0xd458('0x2b')](_0x53ec26[_0xd458('0x34')],function(_0x148cbd){var _0x1ce674={};_0x1ce674[_0x148cbd]={'$like':'%'+_0x41d166[_0xd458('0x31')]['filter']+'%'};return _0x1ce674;})});}_0x53ec26=_[_0xd458('0x3d')]({},_0x53ec26,_0x41d166[_0xd458('0x4c')]);return _0x447dbd[_0xd458('0x49')](_0x53ec26);}})[_0xd458('0x23')](function(_0x4fb9f4){if(_0x4fb9f4){_0x3169e4=_0x4fb9f4[_0xd458('0x35')];if(!_0x41d166[_0xd458('0x31')][_0xd458('0x36')](_0xd458('0x37'))){_0x53ec26[_0xd458('0x1b')]=qs[_0xd458('0x1b')](_0x41d166[_0xd458('0x31')][_0xd458('0x1b')]);_0x53ec26['offset']=qs[_0xd458('0x1a')](_0x41d166[_0xd458('0x31')][_0xd458('0x1a')]);}return _0x447dbd[_0xd458('0x49')](_0x53ec26);}})[_0xd458('0x23')](function(_0xef7ca6){if(_0xef7ca6){return _0xef7ca6?{'count':_0x3169e4,'rows':_0xef7ca6}:null;}})[_0xd458('0x23')](respondWithResult(_0x5e637d,null))[_0xd458('0x45')](handleError(_0x5e637d,null));};exports['getSubjects']=function(_0x482ec6,_0x5bf319,_0x5730a){var _0x36a7a7={};var _0xd37548={};var _0x307ff9;var _0x31d20f;return db[_0xd458('0x2c')][_0xd458('0x4a')]({'where':{'id':_0x482ec6[_0xd458('0x43')]['id']}})[_0xd458('0x23')](handleEntityNotFound(_0x5bf319,null))['then'](function(_0x5c2d83){if(_0x5c2d83){_0x307ff9=_0x5c2d83;_0xd37548['model']=_[_0xd458('0x44')](db[_0xd458('0x4d')][_0xd458('0x2d')]);_0xd37548[_0xd458('0x31')]=_[_0xd458('0x44')](_0x482ec6[_0xd458('0x31')]);_0xd37548['filters']=_[_0xd458('0x32')](_0xd37548[_0xd458('0x30')],_0xd37548[_0xd458('0x31')]);_0x36a7a7[_0xd458('0x34')]=_[_0xd458('0x32')](_0xd37548[_0xd458('0x30')],qs[_0xd458('0x33')](_0x482ec6[_0xd458('0x31')][_0xd458('0x33')]));_0x36a7a7['attributes']=_0x36a7a7[_0xd458('0x34')][_0xd458('0x35')]?_0x36a7a7[_0xd458('0x34')]:_0xd37548[_0xd458('0x30')];_0x36a7a7[_0xd458('0x38')]=qs['sort'](_0x482ec6['query'][_0xd458('0x39')]);_0x36a7a7[_0xd458('0x3a')]=qs[_0xd458('0x3b')](_[_0xd458('0x4b')](_0x482ec6[_0xd458('0x31')],_0xd37548[_0xd458('0x3b')]));if(_0x482ec6[_0xd458('0x31')]['filter']){_0x36a7a7[_0xd458('0x3a')]=_[_0xd458('0x3d')](_0x36a7a7[_0xd458('0x3a')],{'$or':_[_0xd458('0x2b')](_0x36a7a7['attributes'],function(_0x3be5b5){var _0x577e1b={};_0x577e1b[_0x3be5b5]={'$like':'%'+_0x482ec6[_0xd458('0x31')][_0xd458('0x3c')]+'%'};return _0x577e1b;})});}_0x36a7a7=_[_0xd458('0x3d')]({},_0x36a7a7,_0x482ec6[_0xd458('0x4c')]);return _0x307ff9[_0xd458('0x4e')](_0x36a7a7);}})[_0xd458('0x23')](function(_0x280576){if(_0x280576){_0x31d20f=_0x280576[_0xd458('0x35')];if(!_0x482ec6[_0xd458('0x31')][_0xd458('0x36')](_0xd458('0x37'))){_0x36a7a7[_0xd458('0x1b')]=qs['limit'](_0x482ec6['query']['limit']);_0x36a7a7[_0xd458('0x1a')]=qs[_0xd458('0x1a')](_0x482ec6[_0xd458('0x31')][_0xd458('0x1a')]);}return _0x307ff9[_0xd458('0x4e')](_0x36a7a7);}})[_0xd458('0x23')](function(_0x5d224b){if(_0x5d224b){return _0x5d224b?{'count':_0x31d20f,'rows':_0x5d224b}:null;}})['then'](respondWithResult(_0x5bf319,null))[_0xd458('0x45')](handleError(_0x5bf319,null));};exports['getDescriptions']=function(_0x695a7d,_0x52fa4b,_0x4748e1){var _0x220bdd={};var _0x11a171={};var _0x3dd8ac;var _0x16c238;return db[_0xd458('0x2c')][_0xd458('0x4a')]({'where':{'id':_0x695a7d['params']['id']}})[_0xd458('0x23')](handleEntityNotFound(_0x52fa4b,null))[_0xd458('0x23')](function(_0xc80b88){if(_0xc80b88){_0x3dd8ac=_0xc80b88;_0x11a171['model']=_[_0xd458('0x44')](db['ZohoField']['rawAttributes']);_0x11a171['query']=_[_0xd458('0x44')](_0x695a7d['query']);_0x11a171[_0xd458('0x3b')]=_[_0xd458('0x32')](_0x11a171[_0xd458('0x30')],_0x11a171[_0xd458('0x31')]);_0x220bdd[_0xd458('0x34')]=_[_0xd458('0x32')](_0x11a171[_0xd458('0x30')],qs[_0xd458('0x33')](_0x695a7d[_0xd458('0x31')][_0xd458('0x33')]));_0x220bdd[_0xd458('0x34')]=_0x220bdd['attributes'][_0xd458('0x35')]?_0x220bdd['attributes']:_0x11a171[_0xd458('0x30')];_0x220bdd[_0xd458('0x38')]=qs['sort'](_0x695a7d[_0xd458('0x31')][_0xd458('0x39')]);_0x220bdd[_0xd458('0x3a')]=qs['filters'](_['pick'](_0x695a7d[_0xd458('0x31')],_0x11a171[_0xd458('0x3b')]));if(_0x695a7d[_0xd458('0x31')]['filter']){_0x220bdd[_0xd458('0x3a')]=_[_0xd458('0x3d')](_0x220bdd[_0xd458('0x3a')],{'$or':_[_0xd458('0x2b')](_0x220bdd[_0xd458('0x34')],function(_0x1e8d99){var _0x1f95cb={};_0x1f95cb[_0x1e8d99]={'$like':'%'+_0x695a7d['query']['filter']+'%'};return _0x1f95cb;})});}_0x220bdd=_[_0xd458('0x3d')]({},_0x220bdd,_0x695a7d[_0xd458('0x4c')]);return _0x3dd8ac['getDescriptions'](_0x220bdd);}})[_0xd458('0x23')](function(_0x1c2ef4){if(_0x1c2ef4){_0x16c238=_0x1c2ef4[_0xd458('0x35')];if(!_0x695a7d['query'][_0xd458('0x36')]('nolimit')){_0x220bdd[_0xd458('0x1b')]=qs[_0xd458('0x1b')](_0x695a7d[_0xd458('0x31')][_0xd458('0x1b')]);_0x220bdd[_0xd458('0x1a')]=qs[_0xd458('0x1a')](_0x695a7d[_0xd458('0x31')][_0xd458('0x1a')]);}return _0x3dd8ac['getDescriptions'](_0x220bdd);}})[_0xd458('0x23')](function(_0x4e83e8){if(_0x4e83e8){return _0x4e83e8?{'count':_0x16c238,'rows':_0x4e83e8}:null;}})[_0xd458('0x23')](respondWithResult(_0x52fa4b,null))[_0xd458('0x45')](handleError(_0x52fa4b,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 809872f..6e6ef27 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 _0xad3e=['bluebird','request-promise','path','rimraf','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','util'];(function(_0x5edc18,_0x4cf9ce){var _0x35ecaf=function(_0x6c71f2){while(--_0x6c71f2){_0x5edc18['push'](_0x5edc18['shift']());}};_0x35ecaf(++_0x4cf9ce);}(_0xad3e,0x94));var _0xead3=function(_0x14de18,_0x939047){_0x14de18=_0x14de18-0x0;var _0x33e12c=_0xad3e[_0x14de18];return _0x33e12c;};'use strict';var _=require(_0xead3('0x0'));var util=require(_0xead3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xead3('0x2'));var rp=require(_0xead3('0x3'));var fs=require('fs');var path=require(_0xead3('0x4'));var rimraf=require(_0xead3('0x5'));var config=require('../../config/environment');var attributes=require(_0xead3('0x6'));module[_0xead3('0x7')]=function(_0x10ddfe,_0x419744){return _0x10ddfe['define'](_0xead3('0x8'),attributes,{'tableName':_0xead3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68fd=['ZohoConfiguration','lodash','util','api','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x51dd21,_0x5b54a7){var _0x258c57=function(_0x5bcdb8){while(--_0x5bcdb8){_0x51dd21['push'](_0x51dd21['shift']());}};_0x258c57(++_0x5b54a7);}(_0x68fd,0x14b));var _0xd68f=function(_0x3ae8d8,_0x588442){_0x3ae8d8=_0x3ae8d8-0x0;var _0x38628e=_0x68fd[_0x3ae8d8];return _0x38628e;};'use strict';var _=require(_0xd68f('0x0'));var util=require(_0xd68f('0x1'));var logger=require('../../config/logger')(_0xd68f('0x2'));var moment=require('moment');var BPromise=require(_0xd68f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd68f('0x4'));var rimraf=require(_0xd68f('0x5'));var config=require(_0xd68f('0x6'));var attributes=require(_0xd68f('0x7'));module[_0xd68f('0x8')]=function(_0x321c59,_0x4755f7){return _0x321c59[_0xd68f('0x9')](_0xd68f('0xa'),attributes,{'tableName':'int_zoho_configurations','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 2de6617..39679da 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 _0xdfd1=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZohoConfiguration,\x20%s,\x20%s','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0xdfd1,0x14a));var _0x1dfd=function(_0x287a21,_0x20f156){_0x287a21=_0x287a21-0x0;var _0x292ea3=_0xdfd1[_0x287a21];return _0x292ea3;};'use strict';var _=require(_0x1dfd('0x0'));var util=require(_0x1dfd('0x1'));var moment=require(_0x1dfd('0x2'));var BPromise=require(_0x1dfd('0x3'));var rs=require(_0x1dfd('0x4'));var fs=require('fs');var Redis=require(_0x1dfd('0x5'));var db=require(_0x1dfd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1dfd('0x7'))(_0x1dfd('0x8'));var config=require(_0x1dfd('0x9'));var jayson=require(_0x1dfd('0xa'));var client=jayson[_0x1dfd('0xb')][_0x1dfd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31b758,_0x1e9b7f,_0x5d14d7){return new BPromise(function(_0x2aefd3,_0x2903c0){return client['request'](_0x31b758,_0x5d14d7)[_0x1dfd('0xd')](function(_0x4858b3){logger['info'](_0x1dfd('0xe'),_0x1e9b7f,'request\x20sent');logger['debug'](_0x1dfd('0xf'),_0x1e9b7f,_0x1dfd('0x10'),JSON[_0x1dfd('0x11')](_0x4858b3));if(_0x4858b3['error']){if(_0x4858b3[_0x1dfd('0x12')][_0x1dfd('0x13')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x1e9b7f,_0x4858b3[_0x1dfd('0x12')][_0x1dfd('0x14')]);return _0x2903c0(_0x4858b3[_0x1dfd('0x12')][_0x1dfd('0x14')]);}logger[_0x1dfd('0x12')](_0x1dfd('0xe'),_0x1e9b7f,_0x4858b3[_0x1dfd('0x12')][_0x1dfd('0x14')]);return _0x2aefd3(_0x4858b3['error'][_0x1dfd('0x14')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x1e9b7f,_0x1dfd('0x10'));_0x2aefd3(_0x4858b3['result'][_0x1dfd('0x14')]);}})[_0x1dfd('0x15')](function(_0xc68300){logger[_0x1dfd('0x12')](_0x1dfd('0xe'),_0x1e9b7f,_0xc68300);_0x2903c0(_0xc68300);});});} \ No newline at end of file +var _0x5ecd=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x43afd8,_0x3e571c){var _0x50a859=function(_0x33c1ea){while(--_0x33c1ea){_0x43afd8['push'](_0x43afd8['shift']());}};_0x50a859(++_0x3e571c);}(_0x5ecd,0xcd));var _0xd5ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ecd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5ec('0x0'));var util=require('util');var moment=require(_0xd5ec('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5ec('0x2'));var db=require(_0xd5ec('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd5ec('0x4'))(_0xd5ec('0x5'));var config=require('../../config/environment');var jayson=require(_0xd5ec('0x6'));var client=jayson['client'][_0xd5ec('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xa362cb,_0x1c5f18,_0x468237){return new BPromise(function(_0x5ce5f3,_0x3e376b){return client[_0xd5ec('0x8')](_0xa362cb,_0x468237)[_0xd5ec('0x9')](function(_0x542ea1){logger[_0xd5ec('0xa')](_0xd5ec('0xb'),_0x1c5f18,_0xd5ec('0xc'));logger['debug'](_0xd5ec('0xd'),_0x1c5f18,_0xd5ec('0xc'),JSON['stringify'](_0x542ea1));if(_0x542ea1[_0xd5ec('0xe')]){if(_0x542ea1[_0xd5ec('0xe')][_0xd5ec('0xf')]===0x1f4){logger['error'](_0xd5ec('0xb'),_0x1c5f18,_0x542ea1[_0xd5ec('0xe')][_0xd5ec('0x10')]);return _0x3e376b(_0x542ea1[_0xd5ec('0xe')][_0xd5ec('0x10')]);}logger[_0xd5ec('0xe')](_0xd5ec('0xb'),_0x1c5f18,_0x542ea1[_0xd5ec('0xe')][_0xd5ec('0x10')]);return _0x5ce5f3(_0x542ea1['error'][_0xd5ec('0x10')]);}else{logger['info'](_0xd5ec('0xb'),_0x1c5f18,_0xd5ec('0xc'));_0x5ce5f3(_0x542ea1['result']['message']);}})[_0xd5ec('0x11')](function(_0xccd534){logger[_0xd5ec('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x1c5f18,_0xccd534);_0x3e376b(_0xccd534);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 2888cab..227e361 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 _0xd082=['show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','/:id','isAuthenticated'];(function(_0x3dccfb,_0x305e5e){var _0x2894fb=function(_0x524574){while(--_0x524574){_0x3dccfb['push'](_0x3dccfb['shift']());}};_0x2894fb(++_0x305e5e);}(_0xd082,0x15d));var _0x2d08=function(_0x571429,_0x2bbcd4){_0x571429=_0x571429-0x0;var _0x45413c=_0xd082[_0x571429];return _0x45413c;};'use strict';var multer=require(_0x2d08('0x0'));var util=require(_0x2d08('0x1'));var path=require(_0x2d08('0x2'));var timeout=require(_0x2d08('0x3'));var express=require(_0x2d08('0x4'));var router=express['Router']();var fs_extra=require(_0x2d08('0x5'));var auth=require(_0x2d08('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2d08('0x7'));var controller=require(_0x2d08('0x8'));router[_0x2d08('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2d08('0x9')](_0x2d08('0xa'),auth[_0x2d08('0xb')](),controller[_0x2d08('0xc')]);router[_0x2d08('0xd')]('/',auth[_0x2d08('0xb')](),controller[_0x2d08('0xe')]);router[_0x2d08('0xf')](_0x2d08('0xa'),auth[_0x2d08('0xb')](),controller[_0x2d08('0x10')]);router[_0x2d08('0x11')](_0x2d08('0xa'),auth[_0x2d08('0xb')](),controller['destroy']);module[_0x2d08('0x12')]=router; \ No newline at end of file +var _0xb195=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','get','/:id','show','post','create','put','update'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xb195,0x12e));var _0x5b19=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xb195[_0x45d55e];return _0x29812a;};'use strict';var multer=require(_0x5b19('0x0'));var util=require('util');var path=require(_0x5b19('0x1'));var timeout=require(_0x5b19('0x2'));var express=require(_0x5b19('0x3'));var router=express[_0x5b19('0x4')]();var fs_extra=require(_0x5b19('0x5'));var auth=require(_0x5b19('0x6'));var interaction=require(_0x5b19('0x7'));var config=require(_0x5b19('0x8'));var controller=require(_0x5b19('0x9'));router['get']('/',auth[_0x5b19('0xa')](),controller['index']);router[_0x5b19('0xb')](_0x5b19('0xc'),auth[_0x5b19('0xa')](),controller[_0x5b19('0xd')]);router[_0x5b19('0xe')]('/',auth['isAuthenticated'](),controller[_0x5b19('0xf')]);router[_0x5b19('0x10')](_0x5b19('0xc'),auth[_0x5b19('0xa')](),controller[_0x5b19('0x11')]);router[_0x5b19('0x12')](_0x5b19('0xc'),auth[_0x5b19('0xa')](),controller['destroy']);module[_0x5b19('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index f290d82..422fd3d 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 _0xab49=['exports','string','variable','customVariable','keyValue','STRING','ENUM','sequelize'];(function(_0x3e8e33,_0x41a565){var _0x3c83f3=function(_0x33a21b){while(--_0x33a21b){_0x3e8e33['push'](_0x3e8e33['shift']());}};_0x3c83f3(++_0x41a565);}(_0xab49,0x1bf));var _0x9ab4=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0xab49[_0xb7a459];return _0x104ab5;};'use strict';var Sequelize=require(_0x9ab4('0x0'));module[_0x9ab4('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9ab4('0x2'),_0x9ab4('0x3'),_0x9ab4('0x4'),_0x9ab4('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x9ab4('0x6')]},'key':{'type':Sequelize[_0x9ab4('0x6')]},'keyType':{'type':Sequelize[_0x9ab4('0x7')](_0x9ab4('0x2'),_0x9ab4('0x3'),_0x9ab4('0x4'))},'keyContent':{'type':Sequelize[_0x9ab4('0x6')]},'idField':{'type':Sequelize[_0x9ab4('0x6')]},'nameField':{'type':Sequelize[_0x9ab4('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9ab4('0x6')]}}; \ No newline at end of file +var _0x1be6=['variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','exports','ENUM'];(function(_0x2641be,_0x481a5e){var _0x53429e=function(_0x2391ea){while(--_0x2391ea){_0x2641be['push'](_0x2641be['shift']());}};_0x53429e(++_0x481a5e);}(_0x1be6,0x1ed));var _0x61be=function(_0x2112b8,_0x11d37b){_0x2112b8=_0x2112b8-0x0;var _0x24f917=_0x1be6[_0x2112b8];return _0x24f917;};'use strict';var Sequelize=require('sequelize');module[_0x61be('0x0')]={'type':{'type':Sequelize[_0x61be('0x1')]('string',_0x61be('0x2'),_0x61be('0x3'),_0x61be('0x4'),_0x61be('0x5')),'defaultValue':_0x61be('0x6')},'content':{'type':Sequelize[_0x61be('0x7')]},'key':{'type':Sequelize[_0x61be('0x7')]},'keyType':{'type':Sequelize[_0x61be('0x1')](_0x61be('0x6'),_0x61be('0x2'),_0x61be('0x3'))},'keyContent':{'type':Sequelize[_0x61be('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x61be('0x7')]},'customField':{'type':Sequelize[_0x61be('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 4757ca9..0ca27b2 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 _0x1349=['end','json','offset','count','limit','set','reject','update','destroy','then','error','stack','name','send','index','map','ZohoField','rawAttributes','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x651ebd,_0x299e6a){var _0x4c836f=function(_0x4b7ba6){while(--_0x4b7ba6){_0x651ebd['push'](_0x651ebd['shift']());}};_0x4c836f(++_0x299e6a);}(_0x1349,0x1ac));var _0x9134=function(_0xfd5d1f,_0x6e6974){_0xfd5d1f=_0xfd5d1f-0x0;var _0x2f75bb=_0x1349[_0xfd5d1f];return _0x2f75bb;};'use strict';var emlformat=require(_0x9134('0x0'));var rimraf=require(_0x9134('0x1'));var zipdir=require(_0x9134('0x2'));var jsonpatch=require(_0x9134('0x3'));var rp=require(_0x9134('0x4'));var moment=require(_0x9134('0x5'));var BPromise=require(_0x9134('0x6'));var Mustache=require(_0x9134('0x7'));var util=require(_0x9134('0x8'));var path=require('path');var sox=require(_0x9134('0x9'));var csv=require('to-csv');var ejs=require(_0x9134('0xa'));var fs=require('fs');var fs_extra=require(_0x9134('0xb'));var _=require(_0x9134('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9134('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9134('0xe'));var querystring=require(_0x9134('0xf'));var Papa=require(_0x9134('0x10'));var Redis=require('ioredis');var authService=require(_0x9134('0x11'));var qs=require(_0x9134('0x12'));var as=require(_0x9134('0x13'));var hardwareService=require(_0x9134('0x14'));var logger=require(_0x9134('0x15'))(_0x9134('0x16'));var utils=require('../../config/utils');var config=require(_0x9134('0x17'));var licenseUtil=require(_0x9134('0x18'));var db=require(_0x9134('0x19'))['db'];function respondWithStatusCode(_0x4a9830,_0x11fba0){_0x11fba0=_0x11fba0||0xcc;return function(_0x37e4f1){if(_0x37e4f1){return _0x4a9830[_0x9134('0x1a')](_0x11fba0);}return _0x4a9830[_0x9134('0x1b')](_0x11fba0)[_0x9134('0x1c')]();};}function respondWithResult(_0x3f4965,_0xbee2ea){_0xbee2ea=_0xbee2ea||0xc8;return function(_0xbceab){if(_0xbceab){return _0x3f4965[_0x9134('0x1b')](_0xbee2ea)[_0x9134('0x1d')](_0xbceab);}};}function respondWithFilteredResult(_0x4a7f01,_0x5a6f5c){return function(_0x243aca){if(_0x243aca){var _0x345b59=typeof _0x5a6f5c[_0x9134('0x1e')]==='undefined'&&typeof _0x5a6f5c['limit']==='undefined';var _0xce1f88=_0x243aca[_0x9134('0x1f')];var _0x38ea95=_0x345b59?0x0:_0x5a6f5c[_0x9134('0x1e')];var _0x2e6f31=_0x345b59?_0x243aca[_0x9134('0x1f')]:_0x5a6f5c[_0x9134('0x1e')]+_0x5a6f5c[_0x9134('0x20')];var _0x2ebf96;if(_0x2e6f31>=_0xce1f88){_0x2e6f31=_0xce1f88;_0x2ebf96=0xc8;}else{_0x2ebf96=0xce;}_0x4a7f01[_0x9134('0x1b')](_0x2ebf96);return _0x4a7f01[_0x9134('0x21')]('Content-Range',_0x38ea95+'-'+_0x2e6f31+'/'+_0xce1f88)[_0x9134('0x1d')](_0x243aca);}return null;};}function patchUpdates(_0x256e5f){return function(_0xe82713){try{jsonpatch['apply'](_0xe82713,_0x256e5f,!![]);}catch(_0x2889e6){return BPromise[_0x9134('0x22')](_0x2889e6);}return _0xe82713['save']();};}function saveUpdates(_0x42401b,_0x33dda8){return function(_0x533955){if(_0x533955){return _0x533955[_0x9134('0x23')](_0x42401b)['then'](function(_0x2dbd51){return _0x2dbd51;});}return null;};}function removeEntity(_0xf1a654,_0x50b0e5){return function(_0x5d53a4){if(_0x5d53a4){return _0x5d53a4[_0x9134('0x24')]()[_0x9134('0x25')](function(){_0xf1a654[_0x9134('0x1b')](0xcc)[_0x9134('0x1c')]();});}};}function handleEntityNotFound(_0x16f5bc,_0x4d7415){return function(_0x5dae69){if(!_0x5dae69){_0x16f5bc[_0x9134('0x1a')](0x194);}return _0x5dae69;};}function handleError(_0x2bd4c7,_0x47eb9a){_0x47eb9a=_0x47eb9a||0x1f4;return function(_0x498022){logger[_0x9134('0x26')](_0x498022[_0x9134('0x27')]);if(_0x498022[_0x9134('0x28')]){delete _0x498022['name'];}_0x2bd4c7[_0x9134('0x1b')](_0x47eb9a)[_0x9134('0x29')](_0x498022);};}exports[_0x9134('0x2a')]=function(_0x4c858b,_0x2760d0){var _0x327d5e={},_0x351a49={},_0xe77df2={'count':0x0,'rows':[]};var _0x4e974f=_[_0x9134('0x2b')](db[_0x9134('0x2c')][_0x9134('0x2d')],function(_0x32c637){return{'name':_0x32c637['fieldName'],'type':_0x32c637[_0x9134('0x2e')][_0x9134('0x2f')]};});_0x351a49['model']=_[_0x9134('0x2b')](_0x4e974f,_0x9134('0x28'));_0x351a49[_0x9134('0x30')]=_[_0x9134('0x31')](_0x4c858b[_0x9134('0x30')]);_0x351a49[_0x9134('0x32')]=_[_0x9134('0x33')](_0x351a49['model'],_0x351a49[_0x9134('0x30')]);_0x327d5e[_0x9134('0x34')]=_['intersection'](_0x351a49['model'],qs[_0x9134('0x35')](_0x4c858b[_0x9134('0x30')][_0x9134('0x35')]));_0x327d5e[_0x9134('0x34')]=_0x327d5e[_0x9134('0x34')][_0x9134('0x36')]?_0x327d5e[_0x9134('0x34')]:_0x351a49[_0x9134('0x37')];if(!_0x4c858b[_0x9134('0x30')][_0x9134('0x38')](_0x9134('0x39'))){_0x327d5e[_0x9134('0x20')]=qs['limit'](_0x4c858b[_0x9134('0x30')][_0x9134('0x20')]);_0x327d5e[_0x9134('0x1e')]=qs['offset'](_0x4c858b[_0x9134('0x30')][_0x9134('0x1e')]);}_0x327d5e[_0x9134('0x3a')]=qs['sort'](_0x4c858b[_0x9134('0x30')][_0x9134('0x3b')]);_0x327d5e['where']=qs['filters'](_[_0x9134('0x3c')](_0x4c858b[_0x9134('0x30')],_0x351a49[_0x9134('0x32')]),_0x4e974f);if(_0x4c858b[_0x9134('0x30')][_0x9134('0x3d')]){_0x327d5e[_0x9134('0x3e')]=_[_0x9134('0x3f')](_0x327d5e[_0x9134('0x3e')],{'$or':_[_0x9134('0x2b')](_0x4e974f,function(_0x324ba0){if(_0x324ba0[_0x9134('0x2e')]!==_0x9134('0x40')){var _0x430aa2={};_0x430aa2[_0x324ba0[_0x9134('0x28')]]={'$like':'%'+_0x4c858b[_0x9134('0x30')][_0x9134('0x3d')]+'%'};return _0x430aa2;}})});}_0x327d5e=_['merge']({},_0x327d5e,_0x4c858b['options']);var _0x25b9cf={'where':_0x327d5e[_0x9134('0x3e')]};return db[_0x9134('0x2c')][_0x9134('0x1f')](_0x25b9cf)['then'](function(_0x1c2f02){_0xe77df2[_0x9134('0x1f')]=_0x1c2f02;if(_0x4c858b['query'][_0x9134('0x41')]){_0x327d5e['include']=[{'all':!![]}];}return db['ZohoField'][_0x9134('0x42')](_0x327d5e);})[_0x9134('0x25')](function(_0x517399){_0xe77df2[_0x9134('0x43')]=_0x517399;return _0xe77df2;})[_0x9134('0x25')](respondWithFilteredResult(_0x2760d0,_0x327d5e))['catch'](handleError(_0x2760d0,null));};exports[_0x9134('0x44')]=function(_0x1d6297,_0x30b548){var _0x26d8a9={'raw':!![],'where':{'id':_0x1d6297[_0x9134('0x45')]['id']}},_0x41bc93={};_0x41bc93[_0x9134('0x37')]=_[_0x9134('0x31')](db[_0x9134('0x2c')][_0x9134('0x2d')]);_0x41bc93['query']=_[_0x9134('0x31')](_0x1d6297[_0x9134('0x30')]);_0x41bc93[_0x9134('0x32')]=_[_0x9134('0x33')](_0x41bc93[_0x9134('0x37')],_0x41bc93['query']);_0x26d8a9[_0x9134('0x34')]=_[_0x9134('0x33')](_0x41bc93['model'],qs[_0x9134('0x35')](_0x1d6297[_0x9134('0x30')]['fields']));_0x26d8a9[_0x9134('0x34')]=_0x26d8a9['attributes'][_0x9134('0x36')]?_0x26d8a9[_0x9134('0x34')]:_0x41bc93[_0x9134('0x37')];if(_0x1d6297[_0x9134('0x30')][_0x9134('0x41')]){_0x26d8a9[_0x9134('0x46')]=[{'all':!![]}];}_0x26d8a9=_[_0x9134('0x3f')]({},_0x26d8a9,_0x1d6297[_0x9134('0x47')]);return db[_0x9134('0x2c')][_0x9134('0x48')](_0x26d8a9)[_0x9134('0x25')](handleEntityNotFound(_0x30b548,null))[_0x9134('0x25')](respondWithResult(_0x30b548,null))[_0x9134('0x49')](handleError(_0x30b548,null));};exports[_0x9134('0x4a')]=function(_0x244682,_0x31f8bd){return db[_0x9134('0x2c')][_0x9134('0x4a')](_0x244682['body'],{})[_0x9134('0x25')](respondWithResult(_0x31f8bd,0xc9))[_0x9134('0x49')](handleError(_0x31f8bd,null));};exports[_0x9134('0x23')]=function(_0x3fa760,_0x55dad8){if(_0x3fa760[_0x9134('0x4b')]['id']){delete _0x3fa760[_0x9134('0x4b')]['id'];}return db[_0x9134('0x2c')][_0x9134('0x48')]({'where':{'id':_0x3fa760[_0x9134('0x45')]['id']}})[_0x9134('0x25')](handleEntityNotFound(_0x55dad8,null))[_0x9134('0x25')](saveUpdates(_0x3fa760[_0x9134('0x4b')],null))[_0x9134('0x25')](respondWithResult(_0x55dad8,null))[_0x9134('0x49')](handleError(_0x55dad8,null));};exports['destroy']=function(_0x267d04,_0x34db22){return db['ZohoField'][_0x9134('0x48')]({'where':{'id':_0x267d04['params']['id']}})[_0x9134('0x25')](handleEntityNotFound(_0x34db22,null))[_0x9134('0x25')](removeEntity(_0x34db22,null))['catch'](handleError(_0x34db22,null));}; \ No newline at end of file +var _0x38f9=['sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','filters','filter','where','merge','type','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x475bf1,_0x5235b6){var _0x4095d1=function(_0x30fe72){while(--_0x30fe72){_0x475bf1['push'](_0x475bf1['shift']());}};_0x4095d1(++_0x5235b6);}(_0x38f9,0x1af));var _0x938f=function(_0x2341c6,_0x3af092){_0x2341c6=_0x2341c6-0x0;var _0x54c34d=_0x38f9[_0x2341c6];return _0x54c34d;};'use strict';var emlformat=require(_0x938f('0x0'));var rimraf=require(_0x938f('0x1'));var zipdir=require(_0x938f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x938f('0x3'));var moment=require(_0x938f('0x4'));var BPromise=require(_0x938f('0x5'));var Mustache=require(_0x938f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x938f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x938f('0x8'));var _=require(_0x938f('0x9'));var squel=require(_0x938f('0xa'));var crypto=require(_0x938f('0xb'));var jsforce=require(_0x938f('0xc'));var deskjs=require(_0x938f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x938f('0xe'));var Papa=require(_0x938f('0xf'));var Redis=require(_0x938f('0x10'));var authService=require(_0x938f('0x11'));var qs=require(_0x938f('0x12'));var as=require(_0x938f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x938f('0x14'))(_0x938f('0x15'));var utils=require('../../config/utils');var config=require(_0x938f('0x16'));var licenseUtil=require(_0x938f('0x17'));var db=require(_0x938f('0x18'))['db'];function respondWithStatusCode(_0x48d70e,_0x7ba7e0){_0x7ba7e0=_0x7ba7e0||0xcc;return function(_0x15b582){if(_0x15b582){return _0x48d70e[_0x938f('0x19')](_0x7ba7e0);}return _0x48d70e[_0x938f('0x1a')](_0x7ba7e0)[_0x938f('0x1b')]();};}function respondWithResult(_0x2efa4a,_0x4d3f94){_0x4d3f94=_0x4d3f94||0xc8;return function(_0x5c3f97){if(_0x5c3f97){return _0x2efa4a[_0x938f('0x1a')](_0x4d3f94)['json'](_0x5c3f97);}};}function respondWithFilteredResult(_0x4d946a,_0xdd3f82){return function(_0x36edf5){if(_0x36edf5){var _0x1c5f9e=typeof _0xdd3f82[_0x938f('0x1c')]===_0x938f('0x1d')&&typeof _0xdd3f82['limit']===_0x938f('0x1d');var _0x17afee=_0x36edf5[_0x938f('0x1e')];var _0x1dbdce=_0x1c5f9e?0x0:_0xdd3f82['offset'];var _0x5915a5=_0x1c5f9e?_0x36edf5[_0x938f('0x1e')]:_0xdd3f82[_0x938f('0x1c')]+_0xdd3f82[_0x938f('0x1f')];var _0x19ae6d;if(_0x5915a5>=_0x17afee){_0x5915a5=_0x17afee;_0x19ae6d=0xc8;}else{_0x19ae6d=0xce;}_0x4d946a[_0x938f('0x1a')](_0x19ae6d);return _0x4d946a['set'](_0x938f('0x20'),_0x1dbdce+'-'+_0x5915a5+'/'+_0x17afee)[_0x938f('0x21')](_0x36edf5);}return null;};}function patchUpdates(_0x54394c){return function(_0x50c6c9){try{jsonpatch['apply'](_0x50c6c9,_0x54394c,!![]);}catch(_0x46547e){return BPromise[_0x938f('0x22')](_0x46547e);}return _0x50c6c9[_0x938f('0x23')]();};}function saveUpdates(_0x5445fd,_0x44001e){return function(_0x2495b){if(_0x2495b){return _0x2495b[_0x938f('0x24')](_0x5445fd)[_0x938f('0x25')](function(_0x5ed7fd){return _0x5ed7fd;});}return null;};}function removeEntity(_0x5f2ce8,_0x55d5ff){return function(_0x2f6ba7){if(_0x2f6ba7){return _0x2f6ba7[_0x938f('0x26')]()[_0x938f('0x25')](function(){_0x5f2ce8[_0x938f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42312e,_0x1f0294){return function(_0x2c44cd){if(!_0x2c44cd){_0x42312e[_0x938f('0x19')](0x194);}return _0x2c44cd;};}function handleError(_0x5c70a9,_0x158d97){_0x158d97=_0x158d97||0x1f4;return function(_0x57cdd7){logger[_0x938f('0x27')](_0x57cdd7[_0x938f('0x28')]);if(_0x57cdd7[_0x938f('0x29')]){delete _0x57cdd7['name'];}_0x5c70a9[_0x938f('0x1a')](_0x158d97)[_0x938f('0x2a')](_0x57cdd7);};}exports[_0x938f('0x2b')]=function(_0x2a2814,_0x2c5d38){var _0x2914d3={},_0x219e9c={},_0x11bada={'count':0x0,'rows':[]};var _0x3abb0f=_[_0x938f('0x2c')](db[_0x938f('0x2d')][_0x938f('0x2e')],function(_0xbc26b9){return{'name':_0xbc26b9['fieldName'],'type':_0xbc26b9['type']['key']};});_0x219e9c['model']=_[_0x938f('0x2c')](_0x3abb0f,_0x938f('0x29'));_0x219e9c[_0x938f('0x2f')]=_[_0x938f('0x30')](_0x2a2814[_0x938f('0x2f')]);_0x219e9c['filters']=_[_0x938f('0x31')](_0x219e9c[_0x938f('0x32')],_0x219e9c[_0x938f('0x2f')]);_0x2914d3[_0x938f('0x33')]=_[_0x938f('0x31')](_0x219e9c[_0x938f('0x32')],qs[_0x938f('0x34')](_0x2a2814[_0x938f('0x2f')][_0x938f('0x34')]));_0x2914d3[_0x938f('0x33')]=_0x2914d3[_0x938f('0x33')][_0x938f('0x35')]?_0x2914d3['attributes']:_0x219e9c['model'];if(!_0x2a2814['query'][_0x938f('0x36')](_0x938f('0x37'))){_0x2914d3['limit']=qs['limit'](_0x2a2814[_0x938f('0x2f')][_0x938f('0x1f')]);_0x2914d3[_0x938f('0x1c')]=qs[_0x938f('0x1c')](_0x2a2814['query']['offset']);}_0x2914d3[_0x938f('0x38')]=qs['sort'](_0x2a2814[_0x938f('0x2f')]['sort']);_0x2914d3['where']=qs[_0x938f('0x39')](_['pick'](_0x2a2814[_0x938f('0x2f')],_0x219e9c['filters']),_0x3abb0f);if(_0x2a2814['query'][_0x938f('0x3a')]){_0x2914d3[_0x938f('0x3b')]=_[_0x938f('0x3c')](_0x2914d3[_0x938f('0x3b')],{'$or':_[_0x938f('0x2c')](_0x3abb0f,function(_0x3c9d9c){if(_0x3c9d9c[_0x938f('0x3d')]!=='VIRTUAL'){var _0x23d19c={};_0x23d19c[_0x3c9d9c[_0x938f('0x29')]]={'$like':'%'+_0x2a2814[_0x938f('0x2f')][_0x938f('0x3a')]+'%'};return _0x23d19c;}})});}_0x2914d3=_[_0x938f('0x3c')]({},_0x2914d3,_0x2a2814[_0x938f('0x3e')]);var _0x1e92e9={'where':_0x2914d3[_0x938f('0x3b')]};return db[_0x938f('0x2d')][_0x938f('0x1e')](_0x1e92e9)[_0x938f('0x25')](function(_0xca2cd4){_0x11bada[_0x938f('0x1e')]=_0xca2cd4;if(_0x2a2814[_0x938f('0x2f')][_0x938f('0x3f')]){_0x2914d3['include']=[{'all':!![]}];}return db[_0x938f('0x2d')][_0x938f('0x40')](_0x2914d3);})[_0x938f('0x25')](function(_0x2f39c2){_0x11bada[_0x938f('0x41')]=_0x2f39c2;return _0x11bada;})[_0x938f('0x25')](respondWithFilteredResult(_0x2c5d38,_0x2914d3))[_0x938f('0x42')](handleError(_0x2c5d38,null));};exports[_0x938f('0x43')]=function(_0x7f0b37,_0x3ce242){var _0x599dfe={'raw':!![],'where':{'id':_0x7f0b37[_0x938f('0x44')]['id']}},_0x1c03a5={};_0x1c03a5[_0x938f('0x32')]=_['keys'](db['ZohoField'][_0x938f('0x2e')]);_0x1c03a5[_0x938f('0x2f')]=_['keys'](_0x7f0b37['query']);_0x1c03a5[_0x938f('0x39')]=_['intersection'](_0x1c03a5[_0x938f('0x32')],_0x1c03a5[_0x938f('0x2f')]);_0x599dfe[_0x938f('0x33')]=_[_0x938f('0x31')](_0x1c03a5[_0x938f('0x32')],qs[_0x938f('0x34')](_0x7f0b37['query'][_0x938f('0x34')]));_0x599dfe[_0x938f('0x33')]=_0x599dfe[_0x938f('0x33')]['length']?_0x599dfe['attributes']:_0x1c03a5[_0x938f('0x32')];if(_0x7f0b37[_0x938f('0x2f')]['includeAll']){_0x599dfe[_0x938f('0x45')]=[{'all':!![]}];}_0x599dfe=_[_0x938f('0x3c')]({},_0x599dfe,_0x7f0b37[_0x938f('0x3e')]);return db[_0x938f('0x2d')][_0x938f('0x46')](_0x599dfe)['then'](handleEntityNotFound(_0x3ce242,null))[_0x938f('0x25')](respondWithResult(_0x3ce242,null))[_0x938f('0x42')](handleError(_0x3ce242,null));};exports[_0x938f('0x47')]=function(_0x1b727b,_0x4e60cf){return db[_0x938f('0x2d')][_0x938f('0x47')](_0x1b727b[_0x938f('0x48')],{})[_0x938f('0x25')](respondWithResult(_0x4e60cf,0xc9))[_0x938f('0x42')](handleError(_0x4e60cf,null));};exports[_0x938f('0x24')]=function(_0x23ebfd,_0x570e0c){if(_0x23ebfd[_0x938f('0x48')]['id']){delete _0x23ebfd[_0x938f('0x48')]['id'];}return db['ZohoField'][_0x938f('0x46')]({'where':{'id':_0x23ebfd[_0x938f('0x44')]['id']}})[_0x938f('0x25')](handleEntityNotFound(_0x570e0c,null))['then'](saveUpdates(_0x23ebfd[_0x938f('0x48')],null))['then'](respondWithResult(_0x570e0c,null))[_0x938f('0x42')](handleError(_0x570e0c,null));};exports[_0x938f('0x26')]=function(_0x3bcabd,_0x38d16a){return db[_0x938f('0x2d')][_0x938f('0x46')]({'where':{'id':_0x3bcabd[_0x938f('0x44')]['id']}})['then'](handleEntityNotFound(_0x38d16a,null))[_0x938f('0x25')](removeEntity(_0x38d16a,null))[_0x938f('0x42')](handleError(_0x38d16a,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 688597c..8808fa8 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 _0xadb5=['ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xadb5,0xad));var _0x5adb=function(_0x3f93e3,_0x4daa15){_0x3f93e3=_0x3f93e3-0x0;var _0x1d9f9a=_0xadb5[_0x3f93e3];return _0x1d9f9a;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./intZohoField.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[{'name':_0x5adb('0xb'),'fields':[_0x5adb('0xc'),_0x5adb('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2542=['../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x2542,0x169));var _0x2254=function(_0x10ddd8,_0x1c44f5){_0x10ddd8=_0x10ddd8-0x0;var _0x2ac3b2=_0x2542[_0x10ddd8];return _0x2ac3b2;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));module[_0x2254('0x9')]=function(_0x508183,_0x19ad3c){return _0x508183[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[{'name':_0x2254('0xd'),'fields':[_0x2254('0xe'),_0x2254('0xf')],'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 e66cd41..b1f7019 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 _0xdb05=['ZohoField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/environment','client','http','request','info','request\x20sent','stringify','error'];(function(_0x14e20e,_0x2bac8e){var _0xa93410=function(_0x174e55){while(--_0x174e55){_0x14e20e['push'](_0x14e20e['shift']());}};_0xa93410(++_0x2bac8e);}(_0xdb05,0x114));var _0x5db0=function(_0x32cce8,_0x18762f){_0x32cce8=_0x32cce8-0x0;var _0x4a732b=_0xdb05[_0x32cce8];return _0x4a732b;};'use strict';var _=require(_0x5db0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5db0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5db0('0x2'));var db=require(_0x5db0('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5db0('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x5db0('0x5')][_0x5db0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4ae569,_0x53dfb7,_0x49c224){return new BPromise(function(_0x574c73,_0x54693e){return client[_0x5db0('0x7')](_0x4ae569,_0x49c224)['then'](function(_0x567dca){logger[_0x5db0('0x8')]('ZohoField,\x20%s,\x20%s',_0x53dfb7,_0x5db0('0x9'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x53dfb7,_0x5db0('0x9'),JSON[_0x5db0('0xa')](_0x567dca));if(_0x567dca[_0x5db0('0xb')]){if(_0x567dca['error']['code']===0x1f4){logger[_0x5db0('0xb')](_0x5db0('0xc'),_0x53dfb7,_0x567dca[_0x5db0('0xb')][_0x5db0('0xd')]);return _0x54693e(_0x567dca[_0x5db0('0xb')]['message']);}logger[_0x5db0('0xb')](_0x5db0('0xc'),_0x53dfb7,_0x567dca[_0x5db0('0xb')][_0x5db0('0xd')]);return _0x574c73(_0x567dca['error'][_0x5db0('0xd')]);}else{logger[_0x5db0('0x8')]('ZohoField,\x20%s,\x20%s',_0x53dfb7,_0x5db0('0x9'));_0x574c73(_0x567dca[_0x5db0('0xe')][_0x5db0('0xd')]);}})[_0x5db0('0xf')](function(_0x213c5e){logger['error']('ZohoField,\x20%s,\x20%s',_0x53dfb7,_0x213c5e);_0x54693e(_0x213c5e);});});} \ No newline at end of file +var _0x3e6a=['http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1d612c,_0x41b4db){var _0x4ac39a=function(_0x36846b){while(--_0x36846b){_0x1d612c['push'](_0x1d612c['shift']());}};_0x4ac39a(++_0x41b4db);}(_0x3e6a,0x1d6));var _0xa3e6=function(_0x5244bc,_0xbeed11){_0x5244bc=_0x5244bc-0x0;var _0x3ae51c=_0x3e6a[_0x5244bc];return _0x3ae51c;};'use strict';var _=require('lodash');var util=require(_0xa3e6('0x0'));var moment=require('moment');var BPromise=require(_0xa3e6('0x1'));var rs=require(_0xa3e6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3e6('0x3'))['db'];var utils=require(_0xa3e6('0x4'));var logger=require(_0xa3e6('0x5'))(_0xa3e6('0x6'));var config=require(_0xa3e6('0x7'));var jayson=require(_0xa3e6('0x8'));var client=jayson[_0xa3e6('0x9')][_0xa3e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48ad10,_0x4d1b18,_0x3a5902){return new BPromise(function(_0x439694,_0x140f50){return client[_0xa3e6('0xb')](_0x48ad10,_0x3a5902)[_0xa3e6('0xc')](function(_0x2660f1){logger[_0xa3e6('0xd')](_0xa3e6('0xe'),_0x4d1b18,_0xa3e6('0xf'));logger[_0xa3e6('0x10')](_0xa3e6('0x11'),_0x4d1b18,_0xa3e6('0xf'),JSON[_0xa3e6('0x12')](_0x2660f1));if(_0x2660f1[_0xa3e6('0x13')]){if(_0x2660f1[_0xa3e6('0x13')][_0xa3e6('0x14')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x4d1b18,_0x2660f1[_0xa3e6('0x13')]['message']);return _0x140f50(_0x2660f1[_0xa3e6('0x13')][_0xa3e6('0x15')]);}logger[_0xa3e6('0x13')]('ZohoField,\x20%s,\x20%s',_0x4d1b18,_0x2660f1['error'][_0xa3e6('0x15')]);return _0x439694(_0x2660f1['error'][_0xa3e6('0x15')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x4d1b18,'request\x20sent');_0x439694(_0x2660f1[_0xa3e6('0x16')][_0xa3e6('0x15')]);}})[_0xa3e6('0x17')](function(_0x1e4a34){logger[_0xa3e6('0x13')](_0xa3e6('0xe'),_0x4d1b18,_0x1e4a34);_0x140f50(_0x1e4a34);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 44f74ca..e1e1b64 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3304b0,_0x1fec1a){var _0x335a34=function(_0x589b3c){while(--_0x589b3c){_0x3304b0['push'](_0x3304b0['shift']());}};_0x335a34(++_0x1fec1a);}(_0xe706,0xa3));var _0x6e70=function(_0x43e918,_0x363513){_0x43e918=_0x43e918-0x0;var _0x1694fd=_0xe706[_0x43e918];return _0x1694fd;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1afe3e,_0x4bf84a){var _0x25645f=function(_0x1a8eb1){while(--_0x1a8eb1){_0x1afe3e['push'](_0x1afe3e['shift']());}};_0x25645f(++_0x4bf84a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 7a9e849..8739b03 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 _0xecb6=['BOOLEAN','state','sequelize','exports','unique_name_and_version','STRING','app.js','INTEGER'];(function(_0x3257c8,_0x278f5b){var _0x48d7e9=function(_0x13706d){while(--_0x13706d){_0x3257c8['push'](_0x3257c8['shift']());}};_0x48d7e9(++_0x278f5b);}(_0xecb6,0xaa));var _0x6ecb=function(_0x3c8341,_0x2d557f){_0x3c8341=_0x3c8341-0x0;var _0x16e6f7=_0xecb6[_0x3c8341];return _0x16e6f7;};'use strict';var Sequelize=require(_0x6ecb('0x0'));module[_0x6ecb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6ecb('0x2')},'version':{'type':Sequelize[_0x6ecb('0x3')],'allowNull':![],'unique':_0x6ecb('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x6ecb('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x6ecb('0x3')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x6ecb('0x5')]},'active':{'type':Sequelize[_0x6ecb('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x6ecb('0x3')]},'state':{'type':Sequelize[_0x6ecb('0x3')],'unique':_0x6ecb('0x7')},'description':{'type':Sequelize[_0x6ecb('0x3')]},'title':{'type':Sequelize[_0x6ecb('0x3')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x6ecb('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0x6f21=['unique_name_and_version','INTEGER','BOOLEAN','state','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6f21,0x1da));var _0x16f2=function(_0x56ddd3,_0x5a931d){_0x56ddd3=_0x56ddd3-0x0;var _0x62cf7b=_0x6f21[_0x56ddd3];return _0x62cf7b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x16f2('0x0')],'allowNull':![],'unique':_0x16f2('0x1')},'version':{'type':Sequelize[_0x16f2('0x0')],'allowNull':![],'unique':_0x16f2('0x1')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x16f2('0x0')]},'path':{'type':Sequelize[_0x16f2('0x0')]},'type':{'type':Sequelize[_0x16f2('0x0')]},'size':{'type':Sequelize[_0x16f2('0x2')]},'active':{'type':Sequelize[_0x16f2('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x16f2('0x0')]},'logo':{'type':Sequelize[_0x16f2('0x0')]},'state':{'type':Sequelize[_0x16f2('0x0')],'unique':_0x16f2('0x4')},'description':{'type':Sequelize[_0x16f2('0x0')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x16f2('0x0')]},'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 ad9bc35..d4f1a59 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 _0xafc4=['reject','save','update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','Integration','includeAll','catch','show','params','create','body','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x59a1b6,_0x50f2ca){var _0x4ba249=function(_0x56fa83){while(--_0x56fa83){_0x59a1b6['push'](_0x59a1b6['shift']());}};_0x4ba249(++_0x50f2ca);}(_0xafc4,0x69));var _0x4afc=function(_0x2706fa,_0x207edd){_0x2706fa=_0x2706fa-0x0;var _0x48c609=_0xafc4[_0x2706fa];return _0x48c609;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['Integration'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['Integration']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['Integration']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));}; \ No newline at end of file +var _0xc1c6=['type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','Integration','rawAttributes'];(function(_0x16fb52,_0xd7d1bd){var _0x2bb121=function(_0x3d18ab){while(--_0x3d18ab){_0x16fb52['push'](_0x16fb52['shift']());}};_0x2bb121(++_0xd7d1bd);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x21487a,_0x263ed5){_0x21487a=_0x21487a-0x0;var _0x9c1b5e=_0xc1c6[_0x21487a];return _0x9c1b5e;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['Integration']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['Integration'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['Integration'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['Integration']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index e17b343..55ce899 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 _0x5b49=['exports','Integration','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./integration.attributes'];(function(_0xb9b73c,_0x11c1d5){var _0x2bdd53=function(_0x5a507a){while(--_0x5a507a){_0xb9b73c['push'](_0xb9b73c['shift']());}};_0x2bdd53(++_0x11c1d5);}(_0x5b49,0xbd));var _0x95b4=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x5b49[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x95b4('0x0'));var util=require(_0x95b4('0x1'));var logger=require(_0x95b4('0x2'))(_0x95b4('0x3'));var moment=require('moment');var BPromise=require(_0x95b4('0x4'));var rp=require(_0x95b4('0x5'));var fs=require('fs');var path=require(_0x95b4('0x6'));var rimraf=require('rimraf');var config=require(_0x95b4('0x7'));var attributes=require(_0x95b4('0x8'));module[_0x95b4('0x9')]=function(_0x1acf85,_0x2596f0){return _0x1acf85['define'](_0x95b4('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x700d=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','Integration','lodash'];(function(_0x477653,_0x37e344){var _0x5234cd=function(_0x2c1e96){while(--_0x2c1e96){_0x477653['push'](_0x477653['shift']());}};_0x5234cd(++_0x37e344);}(_0x700d,0x113));var _0xd700=function(_0x1d82dd,_0x2ec35f){_0x1d82dd=_0x1d82dd-0x0;var _0x222d66=_0x700d[_0x1d82dd];return _0x222d66;};'use strict';var _=require(_0xd700('0x0'));var util=require(_0xd700('0x1'));var logger=require(_0xd700('0x2'))(_0xd700('0x3'));var moment=require('moment');var BPromise=require(_0xd700('0x4'));var rp=require(_0xd700('0x5'));var fs=require('fs');var path=require(_0xd700('0x6'));var rimraf=require(_0xd700('0x7'));var config=require(_0xd700('0x8'));var attributes=require(_0xd700('0x9'));module[_0xd700('0xa')]=function(_0x29d8bf,_0x3c434d){return _0x29d8bf['define'](_0xd700('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index fd5414c..718beb5 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0xf23806,_0x9893d5){var _0x78928c=function(_0x5c46ea){while(--_0x5c46ea){_0xf23806['push'](_0xf23806['shift']());}};_0x78928c(++_0x9893d5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x7460b0,_0x2b7afa){_0x7460b0=_0x7460b0-0x0;var _0x3ec665=_0x5f2f[_0x7460b0];return _0x3ec665;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x31d6a1,_0x4a3baa){var _0x3b51de=function(_0x48cfa1){while(--_0x48cfa1){_0x31d6a1['push'](_0x31d6a1['shift']());}};_0x3b51de(++_0x4a3baa);}(_0x1a85,0x178));var _0x51a8=function(_0x1fcb67,_0x70fb6c){_0x1fcb67=_0x1fcb67-0x0;var _0x17a001=_0x1a85[_0x1fcb67];return _0x17a001;};'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')]('Integration,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index fd1d3be..5c4a891 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 _0x6d38=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','/:id','create','update','destroy','exports','util'];(function(_0x182be9,_0x32c209){var _0x772c4b=function(_0x1bf6d1){while(--_0x1bf6d1){_0x182be9['push'](_0x182be9['shift']());}};_0x772c4b(++_0x32c209);}(_0x6d38,0x1ef));var _0x86d3=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6d38[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['post']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0xc')]);router['put']('/:id',auth[_0x86d3('0x7')](),controller[_0x86d3('0xd')]);router['delete'](_0x86d3('0xb'),auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file +var _0x1261=['create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','index','get','isAuthenticated','describe','/:id','post'];(function(_0x17722a,_0x51651b){var _0x65ad74=function(_0x203b36){while(--_0x203b36){_0x17722a['push'](_0x17722a['shift']());}};_0x65ad74(++_0x51651b);}(_0x1261,0x144));var _0x1126=function(_0x549cad,_0xc32566){_0x549cad=_0x549cad-0x0;var _0x5a9eed=_0x1261[_0x549cad];return _0x5a9eed;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x12')]);module[_0x1126('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index dd07294..d9fcdf5 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 _0xeee4=['SENDING','RECEIVED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeee4,0x98));var _0x4eee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeee4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4eee('0x0'));module[_0x4eee('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x4eee('0x2')]},'exitStatus':{'type':Sequelize[_0x4eee('0x2')]},'ticketId':{'type':Sequelize[_0x4eee('0x2')]},'integrationId':{'type':Sequelize[_0x4eee('0x3')]},'contacts':{'type':Sequelize[_0x4eee('0x2')]},'uniqueid':{'type':Sequelize[_0x4eee('0x2')]},'calleridnum':{'type':Sequelize[_0x4eee('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4eee('0x2')]},'interface':{'type':Sequelize[_0x4eee('0x2')]},'membername':{'type':Sequelize[_0x4eee('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x4eee('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4eee('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4eee('0x4')]},'talktime':{'type':Sequelize[_0x4eee('0x3')]},'agentacw':{'type':Sequelize[_0x4eee('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4eee('0x3')]},'reason':{'type':Sequelize[_0x4eee('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4eee('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4eee('0x2')]},'channelstate':{'type':Sequelize[_0x4eee('0x3')]},'channelstatedesc':{'type':Sequelize[_0x4eee('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4eee('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4eee('0x2')]},'accountcode':{'type':Sequelize[_0x4eee('0x2')]},'context':{'type':Sequelize[_0x4eee('0x2')]},'exten':{'type':Sequelize[_0x4eee('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x4eee('0x2')]},'destchannelstate':{'type':Sequelize[_0x4eee('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x4eee('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4eee('0x2')]},'destcalleridname':{'type':Sequelize[_0x4eee('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x4eee('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4eee('0x2')]},'destcontext':{'type':Sequelize[_0x4eee('0x2')]},'destexten':{'type':Sequelize[_0x4eee('0x2')]},'destpriority':{'type':Sequelize[_0x4eee('0x2')]},'destuniqueid':{'type':Sequelize[_0x4eee('0x2')]},'messageId':{'type':Sequelize[_0x4eee('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x4eee('0x2')]},'to':{'type':Sequelize[_0x4eee('0x2')]},'cc':{'type':Sequelize[_0x4eee('0x2')]},'attachment':{'type':Sequelize[_0x4eee('0x6')]},'html':{'type':Sequelize[_0x4eee('0x6')]},'text':{'type':Sequelize[_0x4eee('0x6')]},'status':{'type':Sequelize[_0x4eee('0x7')]('SENT',_0x4eee('0x8'),_0x4eee('0x9'),'FAILED')},'url':{'type':Sequelize[_0x4eee('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x4eee('0x2')]},'projectId':{'type':Sequelize[_0x4eee('0x3')]}}; \ No newline at end of file +var _0xaa11=['TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x14cb16,_0x149cd8){var _0x392665=function(_0x149cb3){while(--_0x149cb3){_0x14cb16['push'](_0x14cb16['shift']());}};_0x392665(++_0x149cd8);}(_0xaa11,0x66));var _0x1aa1=function(_0x68a0b0,_0x2bba91){_0x68a0b0=_0x68a0b0-0x0;var _0x4b4ee6=_0xaa11[_0x68a0b0];return _0x4b4ee6;};'use strict';var Sequelize=require(_0x1aa1('0x0'));module[_0x1aa1('0x1')]={'integration':{'type':Sequelize[_0x1aa1('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x1aa1('0x2')]},'integrationId':{'type':Sequelize[_0x1aa1('0x3')]},'contacts':{'type':Sequelize[_0x1aa1('0x2')]},'uniqueid':{'type':Sequelize[_0x1aa1('0x2')]},'calleridnum':{'type':Sequelize[_0x1aa1('0x2')]},'calleridname':{'type':Sequelize[_0x1aa1('0x2')]},'queue':{'type':Sequelize[_0x1aa1('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1aa1('0x2')]},'agentcalledAt':{'type':Sequelize[_0x1aa1('0x4')]},'agentconnectAt':{'type':Sequelize[_0x1aa1('0x4')]},'holdtime':{'type':Sequelize[_0x1aa1('0x3')]},'agentcomplete':{'type':Sequelize[_0x1aa1('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x1aa1('0x4')]},'talktime':{'type':Sequelize[_0x1aa1('0x3')]},'agentacw':{'type':Sequelize[_0x1aa1('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1aa1('0x3')]},'reason':{'type':Sequelize[_0x1aa1('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1aa1('0x4')]},'agentdump':{'type':Sequelize[_0x1aa1('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1aa1('0x4')]},'lastevent':{'type':Sequelize[_0x1aa1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x1aa1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x1aa1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1aa1('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1aa1('0x2')]},'accountcode':{'type':Sequelize[_0x1aa1('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1aa1('0x2')]},'priority':{'type':Sequelize[_0x1aa1('0x2')]},'destchannel':{'type':Sequelize[_0x1aa1('0x2')]},'destchannelstate':{'type':Sequelize[_0x1aa1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x1aa1('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x1aa1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x1aa1('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x1aa1('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x1aa1('0x2')]},'destpriority':{'type':Sequelize[_0x1aa1('0x2')]},'destuniqueid':{'type':Sequelize[_0x1aa1('0x2')]},'messageId':{'type':Sequelize[_0x1aa1('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x1aa1('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x1aa1('0x2')]},'cc':{'type':Sequelize[_0x1aa1('0x2')]},'attachment':{'type':Sequelize[_0x1aa1('0x6')]},'html':{'type':Sequelize[_0x1aa1('0x6')]},'text':{'type':Sequelize[_0x1aa1('0x6')]},'status':{'type':Sequelize[_0x1aa1('0x7')](_0x1aa1('0x8'),_0x1aa1('0x9'),_0x1aa1('0xa'),_0x1aa1('0xb'))},'url':{'type':Sequelize[_0x1aa1('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x1aa1('0x2')]},'projectId':{'type':Sequelize[_0x1aa1('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c142090..a6a319e 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 _0xcdb0=['keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','options','find','create','body','update','params','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','end','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x443c84,_0x1a030d){var _0x1802ee=function(_0x198260){while(--_0x198260){_0x443c84['push'](_0x443c84['shift']());}};_0x1802ee(++_0x1a030d);}(_0xcdb0,0xfe));var _0x0cdb=function(_0x442a53,_0xed21ff){_0x442a53=_0x442a53-0x0;var _0x58e1b1=_0xcdb0[_0x442a53];return _0x58e1b1;};'use strict';var emlformat=require(_0x0cdb('0x0'));var rimraf=require(_0x0cdb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0cdb('0x2'));var moment=require('moment');var BPromise=require(_0x0cdb('0x3'));var Mustache=require(_0x0cdb('0x4'));var util=require(_0x0cdb('0x5'));var path=require(_0x0cdb('0x6'));var sox=require(_0x0cdb('0x7'));var csv=require(_0x0cdb('0x8'));var ejs=require(_0x0cdb('0x9'));var fs=require('fs');var fs_extra=require(_0x0cdb('0xa'));var _=require(_0x0cdb('0xb'));var squel=require(_0x0cdb('0xc'));var crypto=require('crypto');var jsforce=require(_0x0cdb('0xd'));var deskjs=require(_0x0cdb('0xe'));var toCsv=require(_0x0cdb('0x8'));var querystring=require(_0x0cdb('0xf'));var Papa=require(_0x0cdb('0x10'));var Redis=require('ioredis');var authService=require(_0x0cdb('0x11'));var qs=require(_0x0cdb('0x12'));var as=require(_0x0cdb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0cdb('0x14'));var utils=require(_0x0cdb('0x15'));var config=require(_0x0cdb('0x16'));var licenseUtil=require(_0x0cdb('0x17'));var db=require(_0x0cdb('0x18'))['db'];function respondWithStatusCode(_0x31cfd4,_0xed061a){_0xed061a=_0xed061a||0xcc;return function(_0x1d353d){if(_0x1d353d){return _0x31cfd4[_0x0cdb('0x19')](_0xed061a);}return _0x31cfd4[_0x0cdb('0x1a')](_0xed061a)['end']();};}function respondWithResult(_0x2c54ca,_0x4d5403){_0x4d5403=_0x4d5403||0xc8;return function(_0x55e29e){if(_0x55e29e){return _0x2c54ca[_0x0cdb('0x1a')](_0x4d5403)['json'](_0x55e29e);}};}function respondWithFilteredResult(_0x2ae353,_0x9baf82){return function(_0x43ae50){if(_0x43ae50){var _0x361fce=typeof _0x9baf82[_0x0cdb('0x1b')]===_0x0cdb('0x1c')&&typeof _0x9baf82[_0x0cdb('0x1d')]===_0x0cdb('0x1c');var _0x13cd50=_0x43ae50['count'];var _0x3f6411=_0x361fce?0x0:_0x9baf82['offset'];var _0x2547ae=_0x361fce?_0x43ae50[_0x0cdb('0x1e')]:_0x9baf82['offset']+_0x9baf82['limit'];var _0x2ddfc6;if(_0x2547ae>=_0x13cd50){_0x2547ae=_0x13cd50;_0x2ddfc6=0xc8;}else{_0x2ddfc6=0xce;}_0x2ae353['status'](_0x2ddfc6);return _0x2ae353[_0x0cdb('0x1f')](_0x0cdb('0x20'),_0x3f6411+'-'+_0x2547ae+'/'+_0x13cd50)[_0x0cdb('0x21')](_0x43ae50);}return null;};}function patchUpdates(_0x23f550){return function(_0x2b5204){try{jsonpatch[_0x0cdb('0x22')](_0x2b5204,_0x23f550,!![]);}catch(_0x25eca2){return BPromise[_0x0cdb('0x23')](_0x25eca2);}return _0x2b5204[_0x0cdb('0x24')]();};}function saveUpdates(_0x48830d,_0x1c4c4d){return function(_0x146217){if(_0x146217){return _0x146217['update'](_0x48830d)[_0x0cdb('0x25')](function(_0x29000a){return _0x29000a;});}return null;};}function removeEntity(_0x52cd96,_0x548ff4){return function(_0xc4b595){if(_0xc4b595){return _0xc4b595[_0x0cdb('0x26')]()[_0x0cdb('0x25')](function(){_0x52cd96[_0x0cdb('0x1a')](0xcc)[_0x0cdb('0x27')]();});}};}function handleEntityNotFound(_0x263f3e,_0x2cd1f7){return function(_0x110fa8){if(!_0x110fa8){_0x263f3e[_0x0cdb('0x19')](0x194);}return _0x110fa8;};}function handleError(_0x537cf2,_0x22ea68){_0x22ea68=_0x22ea68||0x1f4;return function(_0x276b23){logger['error'](_0x276b23['stack']);if(_0x276b23[_0x0cdb('0x28')]){delete _0x276b23[_0x0cdb('0x28')];}_0x537cf2[_0x0cdb('0x1a')](_0x22ea68)[_0x0cdb('0x29')](_0x276b23);};}exports['index']=function(_0x34134f,_0x27efe0){var _0x3ecc4a={},_0x3c990b={},_0xd0d1d7={'count':0x0,'rows':[]};var _0x16ef83=_[_0x0cdb('0x2a')](db[_0x0cdb('0x2b')][_0x0cdb('0x2c')],function(_0x10c3ae){return{'name':_0x10c3ae[_0x0cdb('0x2d')],'type':_0x10c3ae[_0x0cdb('0x2e')][_0x0cdb('0x2f')]};});_0x3c990b[_0x0cdb('0x30')]=_[_0x0cdb('0x2a')](_0x16ef83,_0x0cdb('0x28'));_0x3c990b[_0x0cdb('0x31')]=_[_0x0cdb('0x32')](_0x34134f[_0x0cdb('0x31')]);_0x3c990b[_0x0cdb('0x33')]=_[_0x0cdb('0x34')](_0x3c990b[_0x0cdb('0x30')],_0x3c990b[_0x0cdb('0x31')]);_0x3ecc4a[_0x0cdb('0x35')]=_[_0x0cdb('0x34')](_0x3c990b[_0x0cdb('0x30')],qs['fields'](_0x34134f[_0x0cdb('0x31')][_0x0cdb('0x36')]));_0x3ecc4a[_0x0cdb('0x35')]=_0x3ecc4a[_0x0cdb('0x35')][_0x0cdb('0x37')]?_0x3ecc4a[_0x0cdb('0x35')]:_0x3c990b['model'];if(!_0x34134f['query']['hasOwnProperty'](_0x0cdb('0x38'))){_0x3ecc4a['limit']=qs['limit'](_0x34134f['query'][_0x0cdb('0x1d')]);_0x3ecc4a[_0x0cdb('0x1b')]=qs[_0x0cdb('0x1b')](_0x34134f[_0x0cdb('0x31')][_0x0cdb('0x1b')]);}_0x3ecc4a[_0x0cdb('0x39')]=qs[_0x0cdb('0x3a')](_0x34134f[_0x0cdb('0x31')][_0x0cdb('0x3a')]);_0x3ecc4a[_0x0cdb('0x3b')]=qs['filters'](_[_0x0cdb('0x3c')](_0x34134f[_0x0cdb('0x31')],_0x3c990b[_0x0cdb('0x33')]),_0x16ef83);if(_0x34134f[_0x0cdb('0x31')][_0x0cdb('0x3d')]){_0x3ecc4a[_0x0cdb('0x3b')]=_['merge'](_0x3ecc4a[_0x0cdb('0x3b')],{'$or':_['map'](_0x16ef83,function(_0xe5db7d){if(_0xe5db7d[_0x0cdb('0x2e')]!==_0x0cdb('0x3e')){var _0x501ce5={};_0x501ce5[_0xe5db7d[_0x0cdb('0x28')]]={'$like':'%'+_0x34134f[_0x0cdb('0x31')]['filter']+'%'};return _0x501ce5;}})});}_0x3ecc4a=_[_0x0cdb('0x3f')]({},_0x3ecc4a,_0x34134f['options']);var _0x2f2793={'where':_0x3ecc4a[_0x0cdb('0x3b')]};return db['IntegrationReport'][_0x0cdb('0x1e')](_0x2f2793)[_0x0cdb('0x25')](function(_0x385448){_0xd0d1d7[_0x0cdb('0x1e')]=_0x385448;if(_0x34134f[_0x0cdb('0x31')][_0x0cdb('0x40')]){_0x3ecc4a[_0x0cdb('0x41')]=[{'all':!![]}];}return db['IntegrationReport'][_0x0cdb('0x42')](_0x3ecc4a);})[_0x0cdb('0x25')](function(_0x270a17){_0xd0d1d7[_0x0cdb('0x43')]=_0x270a17;return _0xd0d1d7;})[_0x0cdb('0x25')](respondWithFilteredResult(_0x27efe0,_0x3ecc4a))[_0x0cdb('0x44')](handleError(_0x27efe0,null));};exports['show']=function(_0x3e96d4,_0x30f40a){var _0x533437={'raw':![],'where':{'id':_0x3e96d4['params']['id']}},_0x4d2b73={};_0x4d2b73['model']=_[_0x0cdb('0x32')](db[_0x0cdb('0x2b')][_0x0cdb('0x2c')]);_0x4d2b73[_0x0cdb('0x31')]=_[_0x0cdb('0x32')](_0x3e96d4['query']);_0x4d2b73[_0x0cdb('0x33')]=_[_0x0cdb('0x34')](_0x4d2b73['model'],_0x4d2b73[_0x0cdb('0x31')]);_0x533437['attributes']=_['intersection'](_0x4d2b73[_0x0cdb('0x30')],qs[_0x0cdb('0x36')](_0x3e96d4[_0x0cdb('0x31')][_0x0cdb('0x36')]));_0x533437['attributes']=_0x533437[_0x0cdb('0x35')]['length']?_0x533437[_0x0cdb('0x35')]:_0x4d2b73[_0x0cdb('0x30')];if(_0x3e96d4[_0x0cdb('0x31')]['includeAll']){_0x533437[_0x0cdb('0x41')]=[{'all':!![]}];}_0x533437=_[_0x0cdb('0x3f')]({},_0x533437,_0x3e96d4[_0x0cdb('0x45')]);return db['IntegrationReport'][_0x0cdb('0x46')](_0x533437)[_0x0cdb('0x25')](handleEntityNotFound(_0x30f40a,null))[_0x0cdb('0x25')](respondWithResult(_0x30f40a,null))[_0x0cdb('0x44')](handleError(_0x30f40a,null));};exports[_0x0cdb('0x47')]=function(_0x4dc659,_0x413d80){return db[_0x0cdb('0x2b')]['create'](_0x4dc659[_0x0cdb('0x48')],{})[_0x0cdb('0x25')](respondWithResult(_0x413d80,0xc9))[_0x0cdb('0x44')](handleError(_0x413d80,null));};exports[_0x0cdb('0x49')]=function(_0x3aa94c,_0x2dd67b){if(_0x3aa94c[_0x0cdb('0x48')]['id']){delete _0x3aa94c['body']['id'];}return db[_0x0cdb('0x2b')]['find']({'where':{'id':_0x3aa94c['params']['id']}})[_0x0cdb('0x25')](handleEntityNotFound(_0x2dd67b,null))[_0x0cdb('0x25')](saveUpdates(_0x3aa94c[_0x0cdb('0x48')],null))['then'](respondWithResult(_0x2dd67b,null))[_0x0cdb('0x44')](handleError(_0x2dd67b,null));};exports[_0x0cdb('0x26')]=function(_0x5833eb,_0x4002cb){return db[_0x0cdb('0x2b')][_0x0cdb('0x46')]({'where':{'id':_0x5833eb[_0x0cdb('0x4a')]['id']}})[_0x0cdb('0x25')](handleEntityNotFound(_0x4002cb,null))[_0x0cdb('0x25')](removeEntity(_0x4002cb,null))[_0x0cdb('0x44')](handleError(_0x4002cb,null));};exports['describe']=function(_0x6224bc,_0x5774ce){return db[_0x0cdb('0x2b')][_0x0cdb('0x4b')]()[_0x0cdb('0x25')](respondWithResult(_0x5774ce,null))[_0x0cdb('0x44')](handleError(_0x5774ce,null));}; \ No newline at end of file +var _0xaea9=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','reject','update','then','destroy','end','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where'];(function(_0x1b7a6f,_0x5722ee){var _0x5dbd8e=function(_0x3413ec){while(--_0x3413ec){_0x1b7a6f['push'](_0x1b7a6f['shift']());}};_0x5dbd8e(++_0x5722ee);}(_0xaea9,0x1b4));var _0x9aea=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xaea9[_0x55f8b4];return _0x2475f9;};'use strict';var emlformat=require(_0x9aea('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9aea('0x1'));var moment=require('moment');var BPromise=require(_0x9aea('0x2'));var Mustache=require('mustache');var util=require(_0x9aea('0x3'));var path=require('path');var sox=require(_0x9aea('0x4'));var csv=require(_0x9aea('0x5'));var ejs=require(_0x9aea('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9aea('0x7'));var squel=require(_0x9aea('0x8'));var crypto=require(_0x9aea('0x9'));var jsforce=require(_0x9aea('0xa'));var deskjs=require(_0x9aea('0xb'));var toCsv=require(_0x9aea('0x5'));var querystring=require(_0x9aea('0xc'));var Papa=require('papaparse');var Redis=require(_0x9aea('0xd'));var authService=require(_0x9aea('0xe'));var qs=require(_0x9aea('0xf'));var as=require(_0x9aea('0x10'));var hardwareService=require(_0x9aea('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9aea('0x12'));var db=require(_0x9aea('0x13'))['db'];function respondWithStatusCode(_0x34d9da,_0x406c0f){_0x406c0f=_0x406c0f||0xcc;return function(_0x10c62c){if(_0x10c62c){return _0x34d9da[_0x9aea('0x14')](_0x406c0f);}return _0x34d9da[_0x9aea('0x15')](_0x406c0f)['end']();};}function respondWithResult(_0x56d43b,_0x257aca){_0x257aca=_0x257aca||0xc8;return function(_0x1cb47f){if(_0x1cb47f){return _0x56d43b[_0x9aea('0x15')](_0x257aca)[_0x9aea('0x16')](_0x1cb47f);}};}function respondWithFilteredResult(_0x33a4bd,_0x1234e7){return function(_0x3b782e){if(_0x3b782e){var _0x1b0837=typeof _0x1234e7[_0x9aea('0x17')]===_0x9aea('0x18')&&typeof _0x1234e7['limit']===_0x9aea('0x18');var _0x27458d=_0x3b782e[_0x9aea('0x19')];var _0x5e361b=_0x1b0837?0x0:_0x1234e7['offset'];var _0x49305d=_0x1b0837?_0x3b782e[_0x9aea('0x19')]:_0x1234e7[_0x9aea('0x17')]+_0x1234e7['limit'];var _0x1013ff;if(_0x49305d>=_0x27458d){_0x49305d=_0x27458d;_0x1013ff=0xc8;}else{_0x1013ff=0xce;}_0x33a4bd['status'](_0x1013ff);return _0x33a4bd['set']('Content-Range',_0x5e361b+'-'+_0x49305d+'/'+_0x27458d)[_0x9aea('0x16')](_0x3b782e);}return null;};}function patchUpdates(_0x1d716a){return function(_0x262572){try{jsonpatch['apply'](_0x262572,_0x1d716a,!![]);}catch(_0x27519d){return BPromise[_0x9aea('0x1a')](_0x27519d);}return _0x262572['save']();};}function saveUpdates(_0x5b815d,_0x5ca0f6){return function(_0x5c9dcb){if(_0x5c9dcb){return _0x5c9dcb[_0x9aea('0x1b')](_0x5b815d)[_0x9aea('0x1c')](function(_0x406676){return _0x406676;});}return null;};}function removeEntity(_0x36b47c,_0x48cdd9){return function(_0x22e073){if(_0x22e073){return _0x22e073[_0x9aea('0x1d')]()[_0x9aea('0x1c')](function(){_0x36b47c[_0x9aea('0x15')](0xcc)[_0x9aea('0x1e')]();});}};}function handleEntityNotFound(_0x2cd462,_0x4f8d4a){return function(_0x291447){if(!_0x291447){_0x2cd462[_0x9aea('0x14')](0x194);}return _0x291447;};}function handleError(_0x1a7d74,_0x124b54){_0x124b54=_0x124b54||0x1f4;return function(_0xaf9b87){logger[_0x9aea('0x1f')](_0xaf9b87[_0x9aea('0x20')]);if(_0xaf9b87[_0x9aea('0x21')]){delete _0xaf9b87[_0x9aea('0x21')];}_0x1a7d74[_0x9aea('0x15')](_0x124b54)['send'](_0xaf9b87);};}exports[_0x9aea('0x22')]=function(_0x509321,_0x3e4518){var _0x510ac6={},_0x3011b0={},_0x56abdb={'count':0x0,'rows':[]};var _0x2774cf=_[_0x9aea('0x23')](db[_0x9aea('0x24')][_0x9aea('0x25')],function(_0x2665b7){return{'name':_0x2665b7[_0x9aea('0x26')],'type':_0x2665b7[_0x9aea('0x27')][_0x9aea('0x28')]};});_0x3011b0[_0x9aea('0x29')]=_[_0x9aea('0x23')](_0x2774cf,_0x9aea('0x21'));_0x3011b0['query']=_[_0x9aea('0x2a')](_0x509321[_0x9aea('0x2b')]);_0x3011b0[_0x9aea('0x2c')]=_[_0x9aea('0x2d')](_0x3011b0[_0x9aea('0x29')],_0x3011b0[_0x9aea('0x2b')]);_0x510ac6['attributes']=_['intersection'](_0x3011b0[_0x9aea('0x29')],qs[_0x9aea('0x2e')](_0x509321[_0x9aea('0x2b')]['fields']));_0x510ac6[_0x9aea('0x2f')]=_0x510ac6['attributes'][_0x9aea('0x30')]?_0x510ac6[_0x9aea('0x2f')]:_0x3011b0['model'];if(!_0x509321['query']['hasOwnProperty'](_0x9aea('0x31'))){_0x510ac6[_0x9aea('0x32')]=qs[_0x9aea('0x32')](_0x509321[_0x9aea('0x2b')][_0x9aea('0x32')]);_0x510ac6[_0x9aea('0x17')]=qs[_0x9aea('0x17')](_0x509321[_0x9aea('0x2b')]['offset']);}_0x510ac6[_0x9aea('0x33')]=qs[_0x9aea('0x34')](_0x509321[_0x9aea('0x2b')][_0x9aea('0x34')]);_0x510ac6[_0x9aea('0x35')]=qs[_0x9aea('0x2c')](_[_0x9aea('0x36')](_0x509321[_0x9aea('0x2b')],_0x3011b0[_0x9aea('0x2c')]),_0x2774cf);if(_0x509321['query'][_0x9aea('0x37')]){_0x510ac6['where']=_[_0x9aea('0x38')](_0x510ac6[_0x9aea('0x35')],{'$or':_[_0x9aea('0x23')](_0x2774cf,function(_0x13117d){if(_0x13117d[_0x9aea('0x27')]!==_0x9aea('0x39')){var _0x5b0038={};_0x5b0038[_0x13117d['name']]={'$like':'%'+_0x509321['query'][_0x9aea('0x37')]+'%'};return _0x5b0038;}})});}_0x510ac6=_[_0x9aea('0x38')]({},_0x510ac6,_0x509321[_0x9aea('0x3a')]);var _0x59ab8d={'where':_0x510ac6[_0x9aea('0x35')]};return db[_0x9aea('0x24')][_0x9aea('0x19')](_0x59ab8d)[_0x9aea('0x1c')](function(_0x30a5ed){_0x56abdb[_0x9aea('0x19')]=_0x30a5ed;if(_0x509321['query'][_0x9aea('0x3b')]){_0x510ac6[_0x9aea('0x3c')]=[{'all':!![]}];}return db[_0x9aea('0x24')][_0x9aea('0x3d')](_0x510ac6);})[_0x9aea('0x1c')](function(_0x35ad56){_0x56abdb[_0x9aea('0x3e')]=_0x35ad56;return _0x56abdb;})['then'](respondWithFilteredResult(_0x3e4518,_0x510ac6))[_0x9aea('0x3f')](handleError(_0x3e4518,null));};exports[_0x9aea('0x40')]=function(_0x3dbbc2,_0x57ff82){var _0x17ffee={'raw':![],'where':{'id':_0x3dbbc2[_0x9aea('0x41')]['id']}},_0x4400c2={};_0x4400c2[_0x9aea('0x29')]=_[_0x9aea('0x2a')](db[_0x9aea('0x24')][_0x9aea('0x25')]);_0x4400c2[_0x9aea('0x2b')]=_[_0x9aea('0x2a')](_0x3dbbc2['query']);_0x4400c2[_0x9aea('0x2c')]=_[_0x9aea('0x2d')](_0x4400c2['model'],_0x4400c2[_0x9aea('0x2b')]);_0x17ffee[_0x9aea('0x2f')]=_[_0x9aea('0x2d')](_0x4400c2[_0x9aea('0x29')],qs[_0x9aea('0x2e')](_0x3dbbc2[_0x9aea('0x2b')][_0x9aea('0x2e')]));_0x17ffee[_0x9aea('0x2f')]=_0x17ffee[_0x9aea('0x2f')][_0x9aea('0x30')]?_0x17ffee[_0x9aea('0x2f')]:_0x4400c2[_0x9aea('0x29')];if(_0x3dbbc2[_0x9aea('0x2b')][_0x9aea('0x3b')]){_0x17ffee[_0x9aea('0x3c')]=[{'all':!![]}];}_0x17ffee=_[_0x9aea('0x38')]({},_0x17ffee,_0x3dbbc2[_0x9aea('0x3a')]);return db[_0x9aea('0x24')][_0x9aea('0x42')](_0x17ffee)[_0x9aea('0x1c')](handleEntityNotFound(_0x57ff82,null))[_0x9aea('0x1c')](respondWithResult(_0x57ff82,null))['catch'](handleError(_0x57ff82,null));};exports[_0x9aea('0x43')]=function(_0x51b202,_0x28395d){return db[_0x9aea('0x24')][_0x9aea('0x43')](_0x51b202[_0x9aea('0x44')],{})[_0x9aea('0x1c')](respondWithResult(_0x28395d,0xc9))[_0x9aea('0x3f')](handleError(_0x28395d,null));};exports[_0x9aea('0x1b')]=function(_0x48cfd4,_0x5926cd){if(_0x48cfd4[_0x9aea('0x44')]['id']){delete _0x48cfd4[_0x9aea('0x44')]['id'];}return db['IntegrationReport'][_0x9aea('0x42')]({'where':{'id':_0x48cfd4[_0x9aea('0x41')]['id']}})[_0x9aea('0x1c')](handleEntityNotFound(_0x5926cd,null))[_0x9aea('0x1c')](saveUpdates(_0x48cfd4[_0x9aea('0x44')],null))[_0x9aea('0x1c')](respondWithResult(_0x5926cd,null))['catch'](handleError(_0x5926cd,null));};exports[_0x9aea('0x1d')]=function(_0x4ea5fb,_0x4742d8){return db[_0x9aea('0x24')][_0x9aea('0x42')]({'where':{'id':_0x4ea5fb['params']['id']}})['then'](handleEntityNotFound(_0x4742d8,null))[_0x9aea('0x1c')](removeEntity(_0x4742d8,null))[_0x9aea('0x3f')](handleError(_0x4742d8,null));};exports[_0x9aea('0x45')]=function(_0x2b3a6d,_0x27428f){return db[_0x9aea('0x24')]['describe']()[_0x9aea('0x1c')](respondWithResult(_0x27428f,null))[_0x9aea('0x3f')](handleError(_0x27428f,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index d060a2d..aaa8ce9 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 _0xc0ec=['./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc0ec,0x161));var _0xcc0e=function(_0xbb4471,_0x317c03){_0xbb4471=_0xbb4471-0x0;var _0x3ae88c=_0xc0ec[_0xbb4471];return _0x3ae88c;};'use strict';var _=require(_0xcc0e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcc0e('0x1'));var moment=require(_0xcc0e('0x2'));var BPromise=require(_0xcc0e('0x3'));var rp=require(_0xcc0e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc0e('0x5'));var config=require(_0xcc0e('0x6'));var attributes=require(_0xcc0e('0x7'));module[_0xcc0e('0x8')]=function(_0x78800d,_0x573f45){return _0x78800d[_0xcc0e('0x9')](_0xcc0e('0xa'),attributes,{'tableName':_0xcc0e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7593=['exports','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./integrationReport.attributes'];(function(_0x3b4d20,_0x467664){var _0x20e29f=function(_0x299b1c){while(--_0x299b1c){_0x3b4d20['push'](_0x3b4d20['shift']());}};_0x20e29f(++_0x467664);}(_0x7593,0x122));var _0x3759=function(_0x5df61d,_0x158640){_0x5df61d=_0x5df61d-0x0;var _0x24cc4c=_0x7593[_0x5df61d];return _0x24cc4c;};'use strict';var _=require(_0x3759('0x0'));var util=require(_0x3759('0x1'));var logger=require(_0x3759('0x2'))(_0x3759('0x3'));var moment=require(_0x3759('0x4'));var BPromise=require(_0x3759('0x5'));var rp=require(_0x3759('0x6'));var fs=require('fs');var path=require(_0x3759('0x7'));var rimraf=require('rimraf');var config=require(_0x3759('0x8'));var attributes=require(_0x3759('0x9'));module[_0x3759('0xa')]=function(_0x397c72,_0x375978){return _0x397c72['define']('IntegrationReport',attributes,{'tableName':_0x3759('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index a7a6837..a338956 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 _0x0295=['client','http','then','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2ee836,_0x400be6){var _0x4bb285=function(_0x111f2d){while(--_0x111f2d){_0x2ee836['push'](_0x2ee836['shift']());}};_0x4bb285(++_0x400be6);}(_0x0295,0x1f0));var _0x5029=function(_0x58ae9f,_0xcaa7d7){_0x58ae9f=_0x58ae9f-0x0;var _0x4c966d=_0x0295[_0x58ae9f];return _0x4c966d;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('IntegrationReport,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0x7a54=['info','IntegrationReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x1d0dee,_0x53c79f){_0x1d0dee=_0x1d0dee-0x0;var _0x898fd2=_0x7a54[_0x1d0dee];return _0x898fd2;};'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')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 4a6da80..b1a9f7d 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 _0xa701=['util','connect-timeout','Router','fs-extra','../../components/auth/service','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer'];(function(_0x43b817,_0x2827e8){var _0x2bc359=function(_0x4fd4dc){while(--_0x4fd4dc){_0x43b817['push'](_0x43b817['shift']());}};_0x2bc359(++_0x2827e8);}(_0xa701,0x1cd));var _0x1a70=function(_0x3e058e,_0x413c0a){_0x3e058e=_0x3e058e-0x0;var _0x4ef1d3=_0xa701[_0x3e058e];return _0x4ef1d3;};'use strict';var multer=require(_0x1a70('0x0'));var util=require(_0x1a70('0x1'));var path=require('path');var timeout=require(_0x1a70('0x2'));var express=require('express');var router=express[_0x1a70('0x3')]();var fs_extra=require(_0x1a70('0x4'));var auth=require(_0x1a70('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a70('0x6'));router[_0x1a70('0x7')]('/',auth[_0x1a70('0x8')](),controller[_0x1a70('0x9')]);router[_0x1a70('0x7')](_0x1a70('0xa'),auth[_0x1a70('0x8')](),controller[_0x1a70('0xb')]);router[_0x1a70('0x7')](_0x1a70('0xc'),auth['isAuthenticated'](),controller[_0x1a70('0xd')]);router[_0x1a70('0xe')]('/',auth[_0x1a70('0x8')](),controller['create']);router[_0x1a70('0xe')](_0x1a70('0xc'),auth[_0x1a70('0x8')](),controller[_0x1a70('0xf')]);router[_0x1a70('0xe')](_0x1a70('0x10'),auth[_0x1a70('0x8')](),controller[_0x1a70('0x11')]);router[_0x1a70('0x12')]('/:id',auth[_0x1a70('0x8')](),controller[_0x1a70('0x13')]);router['delete'](_0x1a70('0xa'),auth[_0x1a70('0x8')](),controller[_0x1a70('0x14')]);module[_0x1a70('0x15')]=router; \ No newline at end of file +var _0x9917=['isAuthenticated','index','show','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get'];(function(_0x8456b9,_0x2f8ad3){var _0x3f1406=function(_0x217a92){while(--_0x217a92){_0x8456b9['push'](_0x8456b9['shift']());}};_0x3f1406(++_0x2f8ad3);}(_0x9917,0xe6));var _0x7991=function(_0x1899e0,_0x196575){_0x1899e0=_0x1899e0-0x0;var _0x5362c8=_0x9917[_0x1899e0];return _0x5362c8;};'use strict';var multer=require(_0x7991('0x0'));var util=require('util');var path=require(_0x7991('0x1'));var timeout=require(_0x7991('0x2'));var express=require(_0x7991('0x3'));var router=express['Router']();var fs_extra=require(_0x7991('0x4'));var auth=require(_0x7991('0x5'));var interaction=require(_0x7991('0x6'));var config=require(_0x7991('0x7'));var controller=require(_0x7991('0x8'));router[_0x7991('0x9')]('/',auth[_0x7991('0xa')](),controller[_0x7991('0xb')]);router[_0x7991('0x9')]('/:id',auth[_0x7991('0xa')](),controller[_0x7991('0xc')]);router['get'](_0x7991('0xd'),auth[_0x7991('0xa')](),controller['getIntervals']);router[_0x7991('0xe')]('/',auth[_0x7991('0xa')](),controller[_0x7991('0xf')]);router['post'](_0x7991('0xd'),auth[_0x7991('0xa')](),controller[_0x7991('0x10')]);router['post'](_0x7991('0x11'),auth[_0x7991('0xa')](),controller[_0x7991('0x12')]);router[_0x7991('0x13')](_0x7991('0x14'),auth[_0x7991('0xa')](),controller[_0x7991('0x15')]);router[_0x7991('0x16')](_0x7991('0x14'),auth[_0x7991('0xa')](),controller['destroy']);module[_0x7991('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 50b15d8..b49d556 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 _0x1eeb=['STRING','sequelize','exports'];(function(_0x21a32c,_0x1012b8){var _0x4a8933=function(_0x99421e){while(--_0x99421e){_0x21a32c['push'](_0x21a32c['shift']());}};_0x4a8933(++_0x1012b8);}(_0x1eeb,0x196));var _0xb1ee=function(_0x16f416,_0x5d381d){_0x16f416=_0x16f416-0x0;var _0x5c083e=_0x1eeb[_0x16f416];return _0x5c083e;};'use strict';var Sequelize=require(_0xb1ee('0x0'));module[_0xb1ee('0x1')]={'name':{'type':Sequelize[_0xb1ee('0x2')]},'description':{'type':Sequelize[_0xb1ee('0x2')]},'interval':{'type':Sequelize[_0xb1ee('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xef85=['sequelize','STRING'];(function(_0x35fdd8,_0x4054c2){var _0x722a45=function(_0x7746){while(--_0x7746){_0x35fdd8['push'](_0x35fdd8['shift']());}};_0x722a45(++_0x4054c2);}(_0xef85,0xc6));var _0x5ef8=function(_0xbca1df,_0x3c8453){_0xbca1df=_0xbca1df-0x0;var _0x2bb1cd=_0xef85[_0xbca1df];return _0x2bb1cd;};'use strict';var Sequelize=require(_0x5ef8('0x0'));module['exports']={'name':{'type':Sequelize[_0x5ef8('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5ef8('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 1ebd62c..7b9fa6b 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 _0xb606=['getIntervals','addIntervals','sequelize','transaction','IntervalId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','destroy','stack','name','index','map','Interval','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval'];(function(_0x5d7900,_0x15cc0e){var _0x59c314=function(_0x241f34){while(--_0x241f34){_0x5d7900['push'](_0x5d7900['shift']());}};_0x59c314(++_0x15cc0e);}(_0xb606,0x110));var _0x6b60=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb606[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x6b60('0x0'));var rimraf=require(_0x6b60('0x1'));var zipdir=require(_0x6b60('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b60('0x3'));var moment=require(_0x6b60('0x4'));var BPromise=require(_0x6b60('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6b60('0x6'));var sox=require('sox');var csv=require(_0x6b60('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6b60('0x8'));var crypto=require(_0x6b60('0x9'));var jsforce=require(_0x6b60('0xa'));var deskjs=require(_0x6b60('0xb'));var toCsv=require(_0x6b60('0x7'));var querystring=require('querystring');var Papa=require(_0x6b60('0xc'));var Redis=require(_0x6b60('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6b60('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b60('0xf'))(_0x6b60('0x10'));var utils=require(_0x6b60('0x11'));var config=require(_0x6b60('0x12'));var licenseUtil=require(_0x6b60('0x13'));var db=require('../../mysqldb')['db'];var extensions=require(_0x6b60('0x14'));function respondWithStatusCode(_0x396991,_0x4201c4){_0x4201c4=_0x4201c4||0xcc;return function(_0x2815ac){if(_0x2815ac){return _0x396991['sendStatus'](_0x4201c4);}return _0x396991[_0x6b60('0x15')](_0x4201c4)[_0x6b60('0x16')]();};}function respondWithResult(_0x30bd74,_0x7523c4){_0x7523c4=_0x7523c4||0xc8;return function(_0x8ff01f){if(_0x8ff01f){return _0x30bd74[_0x6b60('0x15')](_0x7523c4)[_0x6b60('0x17')](_0x8ff01f);}};}function respondWithFilteredResult(_0x127a1d,_0x1fe0fb){return function(_0xbeb7a2){if(_0xbeb7a2){var _0x567483=typeof _0x1fe0fb[_0x6b60('0x18')]===_0x6b60('0x19')&&typeof _0x1fe0fb['limit']===_0x6b60('0x19');var _0x49e869=_0xbeb7a2[_0x6b60('0x1a')];var _0x1a16bd=_0x567483?0x0:_0x1fe0fb['offset'];var _0x4b84f3=_0x567483?_0xbeb7a2[_0x6b60('0x1a')]:_0x1fe0fb['offset']+_0x1fe0fb[_0x6b60('0x1b')];var _0x13b862;if(_0x4b84f3>=_0x49e869){_0x4b84f3=_0x49e869;_0x13b862=0xc8;}else{_0x13b862=0xce;}_0x127a1d[_0x6b60('0x15')](_0x13b862);return _0x127a1d[_0x6b60('0x1c')](_0x6b60('0x1d'),_0x1a16bd+'-'+_0x4b84f3+'/'+_0x49e869)[_0x6b60('0x17')](_0xbeb7a2);}return null;};}function patchUpdates(_0x536ba2){return function(_0x55455c){try{jsonpatch[_0x6b60('0x1e')](_0x55455c,_0x536ba2,!![]);}catch(_0x228608){return BPromise[_0x6b60('0x1f')](_0x228608);}return _0x55455c[_0x6b60('0x20')]();};}function saveUpdates(_0x57df93,_0x554178){return function(_0x5d0cdc){if(_0x5d0cdc){return _0x5d0cdc[_0x6b60('0x21')](_0x57df93)[_0x6b60('0x22')](function(_0xcac2bc){return _0xcac2bc;});}return null;};}function removeEntity(_0x55ea5c,_0x5a7368){return function(_0x985d81){if(_0x985d81){return _0x985d81['destroy']()[_0x6b60('0x22')](function(){var _0x419706=_0x985d81[_0x6b60('0x23')]({'plain':!![]});var _0x479ce9=_0x6b60('0x24');return db[_0x6b60('0x25')][_0x6b60('0x26')]({'where':{'type':_0x479ce9,'resourceId':_0x419706['id']}})[_0x6b60('0x22')](function(){return _0x985d81;});})['then'](function(){_0x55ea5c[_0x6b60('0x15')](0xcc)[_0x6b60('0x16')]();});}};}function handleEntityNotFound(_0x4d8658,_0x240c83){return function(_0x240d91){if(!_0x240d91){_0x4d8658['sendStatus'](0x194);}return _0x240d91;};}function handleError(_0xfe4fb9,_0x304abe){_0x304abe=_0x304abe||0x1f4;return function(_0x4653b0){logger['error'](_0x4653b0[_0x6b60('0x27')]);if(_0x4653b0['name']){delete _0x4653b0[_0x6b60('0x28')];}_0xfe4fb9['status'](_0x304abe)['send'](_0x4653b0);};}exports[_0x6b60('0x29')]=function(_0x2ce04d,_0x18444a){var _0x2e0943={},_0xa01b04={},_0x3fe22e={'count':0x0,'rows':[]};var _0x2ddcb7=_[_0x6b60('0x2a')](db[_0x6b60('0x2b')]['rawAttributes'],function(_0x5cdb54){return{'name':_0x5cdb54[_0x6b60('0x2c')],'type':_0x5cdb54['type'][_0x6b60('0x2d')]};});_0xa01b04[_0x6b60('0x2e')]=_['map'](_0x2ddcb7,'name');_0xa01b04[_0x6b60('0x2f')]=_[_0x6b60('0x30')](_0x2ce04d[_0x6b60('0x2f')]);_0xa01b04[_0x6b60('0x31')]=_[_0x6b60('0x32')](_0xa01b04[_0x6b60('0x2e')],_0xa01b04[_0x6b60('0x2f')]);_0x2e0943['attributes']=_[_0x6b60('0x32')](_0xa01b04[_0x6b60('0x2e')],qs['fields'](_0x2ce04d[_0x6b60('0x2f')][_0x6b60('0x33')]));_0x2e0943['attributes']=_0x2e0943[_0x6b60('0x34')][_0x6b60('0x35')]?_0x2e0943[_0x6b60('0x34')]:_0xa01b04[_0x6b60('0x2e')];if(!_0x2ce04d[_0x6b60('0x2f')][_0x6b60('0x36')](_0x6b60('0x37'))){_0x2e0943[_0x6b60('0x1b')]=qs[_0x6b60('0x1b')](_0x2ce04d['query'][_0x6b60('0x1b')]);_0x2e0943[_0x6b60('0x18')]=qs[_0x6b60('0x18')](_0x2ce04d[_0x6b60('0x2f')][_0x6b60('0x18')]);}_0x2e0943[_0x6b60('0x38')]=qs[_0x6b60('0x39')](_0x2ce04d[_0x6b60('0x2f')]['sort']);_0x2e0943[_0x6b60('0x3a')]=qs[_0x6b60('0x31')](_[_0x6b60('0x3b')](_0x2ce04d['query'],_0xa01b04[_0x6b60('0x31')]),_0x2ddcb7);if(_0x2ce04d[_0x6b60('0x2f')][_0x6b60('0x3c')]){_0x2e0943[_0x6b60('0x3a')]=_[_0x6b60('0x3d')](_0x2e0943[_0x6b60('0x3a')],{'$or':_[_0x6b60('0x2a')](_0x2ddcb7,function(_0x1bbe82){if(_0x1bbe82[_0x6b60('0x3e')]!=='VIRTUAL'){var _0x6a1251={};_0x6a1251[_0x1bbe82[_0x6b60('0x28')]]={'$like':'%'+_0x2ce04d[_0x6b60('0x2f')][_0x6b60('0x3c')]+'%'};return _0x6a1251;}})});}_0x2e0943=_[_0x6b60('0x3d')]({},_0x2e0943,_0x2ce04d['options']);var _0x3c0ef4={'where':_0x2e0943[_0x6b60('0x3a')]};return db[_0x6b60('0x2b')][_0x6b60('0x1a')](_0x3c0ef4)['then'](function(_0x52cd0d){_0x3fe22e['count']=_0x52cd0d;if(_0x2ce04d[_0x6b60('0x2f')][_0x6b60('0x3f')]){_0x2e0943[_0x6b60('0x40')]=[{'all':!![]}];}return db[_0x6b60('0x2b')][_0x6b60('0x41')](_0x2e0943);})[_0x6b60('0x22')](function(_0xe0f36d){_0x3fe22e[_0x6b60('0x42')]=_0xe0f36d;return _0x3fe22e;})[_0x6b60('0x22')](respondWithFilteredResult(_0x18444a,_0x2e0943))[_0x6b60('0x43')](handleError(_0x18444a,null));};exports[_0x6b60('0x44')]=function(_0x371034,_0x9831a7){var _0x2cee01={'raw':!![],'where':{'id':_0x371034[_0x6b60('0x45')]['id']}},_0x17146f={};_0x17146f[_0x6b60('0x2e')]=_[_0x6b60('0x30')](db['Interval'][_0x6b60('0x46')]);_0x17146f[_0x6b60('0x2f')]=_['keys'](_0x371034[_0x6b60('0x2f')]);_0x17146f[_0x6b60('0x31')]=_[_0x6b60('0x32')](_0x17146f[_0x6b60('0x2e')],_0x17146f[_0x6b60('0x2f')]);_0x2cee01[_0x6b60('0x34')]=_[_0x6b60('0x32')](_0x17146f[_0x6b60('0x2e')],qs['fields'](_0x371034['query'][_0x6b60('0x33')]));_0x2cee01[_0x6b60('0x34')]=_0x2cee01['attributes']['length']?_0x2cee01['attributes']:_0x17146f[_0x6b60('0x2e')];if(_0x371034[_0x6b60('0x2f')][_0x6b60('0x3f')]){_0x2cee01[_0x6b60('0x40')]=[{'all':!![]}];}_0x2cee01=_[_0x6b60('0x3d')]({},_0x2cee01,_0x371034[_0x6b60('0x47')]);return db['Interval'][_0x6b60('0x48')](_0x2cee01)[_0x6b60('0x22')](handleEntityNotFound(_0x9831a7,null))[_0x6b60('0x22')](respondWithResult(_0x9831a7,null))[_0x6b60('0x43')](handleError(_0x9831a7,null));};exports[_0x6b60('0x49')]=function(_0x383f86,_0x2daa67){return db[_0x6b60('0x2b')]['create'](_0x383f86[_0x6b60('0x4a')],{})[_0x6b60('0x22')](function(_0x3ccb7b){var _0x3e089b=_0x383f86[_0x6b60('0x4b')][_0x6b60('0x23')]({'plain':!![]});if(!_0x3e089b)throw new Error(_0x6b60('0x4c'));if(_0x3e089b[_0x6b60('0x4d')]===_0x6b60('0x4b')){var _0x57db46=_0x3ccb7b[_0x6b60('0x23')]({'plain':!![]});var _0x278030=_0x6b60('0x24');return db[_0x6b60('0x4e')][_0x6b60('0x48')]({'where':{'name':_0x278030,'userProfileId':_0x3e089b[_0x6b60('0x4f')]},'raw':!![]})[_0x6b60('0x22')](function(_0x1bd0a8){if(_0x1bd0a8&&_0x1bd0a8[_0x6b60('0x50')]===0x0){return db[_0x6b60('0x25')][_0x6b60('0x49')]({'name':_0x57db46[_0x6b60('0x28')],'resourceId':_0x57db46['id'],'type':_0x1bd0a8[_0x6b60('0x28')],'sectionId':_0x1bd0a8['id']},{})['then'](function(){return _0x3ccb7b;});}else{return _0x3ccb7b;}})[_0x6b60('0x43')](function(_0xde0d16){logger[_0x6b60('0x51')](_0x6b60('0x52'),_0xde0d16);throw _0xde0d16;});}return _0x3ccb7b;})[_0x6b60('0x22')](respondWithResult(_0x2daa67,0xc9))['catch'](handleError(_0x2daa67,null));};exports['update']=function(_0x51bafb,_0x4b5be2){if(_0x51bafb['body']['id']){delete _0x51bafb[_0x6b60('0x4a')]['id'];}return db['Interval'][_0x6b60('0x48')]({'where':{'id':_0x51bafb[_0x6b60('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b5be2,null))[_0x6b60('0x22')](saveUpdates(_0x51bafb[_0x6b60('0x4a')],null))[_0x6b60('0x22')](respondWithResult(_0x4b5be2,null))[_0x6b60('0x43')](handleError(_0x4b5be2,null));};exports[_0x6b60('0x26')]=function(_0x428d59,_0x314d62){return db[_0x6b60('0x2b')]['find']({'where':{'id':_0x428d59[_0x6b60('0x45')]['id']}})[_0x6b60('0x22')](handleEntityNotFound(_0x314d62,null))[_0x6b60('0x22')](removeEntity(_0x314d62,null))['catch'](handleError(_0x314d62,null));};exports[_0x6b60('0x53')]=function(_0x3a322e,_0x324f09,_0x1041a4){if(_0x3a322e[_0x6b60('0x4a')]['id']){delete _0x3a322e[_0x6b60('0x4a')]['id'];}return db[_0x6b60('0x2b')]['find']({'where':{'id':_0x3a322e[_0x6b60('0x45')]['id']}})[_0x6b60('0x22')](handleEntityNotFound(_0x324f09,null))[_0x6b60('0x22')](function(_0x70bc3e){if(_0x70bc3e){_0x3a322e[_0x6b60('0x4a')]['IntervalId']=_0x70bc3e['id'];return db[_0x6b60('0x2b')][_0x6b60('0x49')](_0x3a322e[_0x6b60('0x4a')]);}})[_0x6b60('0x22')](respondWithResult(_0x324f09,null))[_0x6b60('0x43')](handleError(_0x324f09,null));};exports[_0x6b60('0x54')]=function(_0x3084ae,_0xbfbe8b,_0x4e62ad){var _0x265cf0={};var _0x5d4b7e={};var _0x325301;var _0xc6e134;return db[_0x6b60('0x2b')]['findOne']({'where':{'id':_0x3084ae[_0x6b60('0x45')]['id']}})['then'](handleEntityNotFound(_0xbfbe8b,null))[_0x6b60('0x22')](function(_0x2c3575){if(_0x2c3575){_0x325301=_0x2c3575;_0x5d4b7e['model']=_[_0x6b60('0x30')](db[_0x6b60('0x2b')]['rawAttributes']);_0x5d4b7e[_0x6b60('0x2f')]=_[_0x6b60('0x30')](_0x3084ae[_0x6b60('0x2f')]);_0x5d4b7e[_0x6b60('0x31')]=_[_0x6b60('0x32')](_0x5d4b7e[_0x6b60('0x2e')],_0x5d4b7e[_0x6b60('0x2f')]);_0x265cf0['attributes']=_['intersection'](_0x5d4b7e[_0x6b60('0x2e')],qs['fields'](_0x3084ae[_0x6b60('0x2f')]['fields']));_0x265cf0[_0x6b60('0x34')]=_0x265cf0['attributes'][_0x6b60('0x35')]?_0x265cf0[_0x6b60('0x34')]:_0x5d4b7e['model'];_0x265cf0[_0x6b60('0x38')]=qs[_0x6b60('0x39')](_0x3084ae[_0x6b60('0x2f')][_0x6b60('0x39')]);_0x265cf0[_0x6b60('0x3a')]=qs[_0x6b60('0x31')](_[_0x6b60('0x3b')](_0x3084ae['query'],_0x5d4b7e['filters']));if(_0x3084ae['query']['filter']){_0x265cf0[_0x6b60('0x3a')]=_[_0x6b60('0x3d')](_0x265cf0[_0x6b60('0x3a')],{'$or':_['map'](_0x265cf0[_0x6b60('0x34')],function(_0x1e6084){var _0x373e59={};_0x373e59[_0x1e6084]={'$like':'%'+_0x3084ae['query'][_0x6b60('0x3c')]+'%'};return _0x373e59;})});}_0x265cf0=_[_0x6b60('0x3d')]({},_0x265cf0,_0x3084ae[_0x6b60('0x47')]);return _0x325301['getIntervals'](_0x265cf0);}})[_0x6b60('0x22')](function(_0x333ae2){if(_0x333ae2){_0xc6e134=_0x333ae2['length'];if(!_0x3084ae['query'][_0x6b60('0x36')](_0x6b60('0x37'))){_0x265cf0['limit']=qs['limit'](_0x3084ae[_0x6b60('0x2f')][_0x6b60('0x1b')]);_0x265cf0[_0x6b60('0x18')]=qs[_0x6b60('0x18')](_0x3084ae['query'][_0x6b60('0x18')]);}return _0x325301[_0x6b60('0x54')](_0x265cf0);}})[_0x6b60('0x22')](function(_0x802305){if(_0x802305){return _0x802305?{'count':_0xc6e134,'rows':_0x802305}:null;}})[_0x6b60('0x22')](respondWithResult(_0xbfbe8b,null))[_0x6b60('0x43')](handleError(_0xbfbe8b,null));};exports[_0x6b60('0x55')]=function(_0x582654,_0xc0e5b8,_0x1e2407){return db[_0x6b60('0x2b')]['findOne']({'where':{'id':_0x582654[_0x6b60('0x45')]['id']}})[_0x6b60('0x22')](handleEntityNotFound(_0xc0e5b8,null))[_0x6b60('0x22')](function(_0x4e0f76){if(_0x4e0f76){return db[_0x6b60('0x56')][_0x6b60('0x57')](function(_0xc17836){return db[_0x6b60('0x2b')][_0x6b60('0x26')]({'where':{'IntervalId':_0x582654[_0x6b60('0x45')]['id']},'transaction':_0xc17836})[_0x6b60('0x22')](function(_0x49ec41){var _0x12a0a1=_[_0x6b60('0x2a')](_0x582654[_0x6b60('0x4a')],function(_0x2aa60d){delete _0x2aa60d['id'];_0x2aa60d[_0x6b60('0x58')]=_0x582654['params']['id'];return _0x2aa60d;});return db[_0x6b60('0x2b')]['bulkCreate'](_0x12a0a1,{'transaction':_0xc17836});});})[_0x6b60('0x22')](function(){return db[_0x6b60('0x2b')]['findAll']({'where':{'IntervalId':_0x582654[_0x6b60('0x45')]['id']}});});}})['then'](respondWithResult(_0xc0e5b8,null))[_0x6b60('0x43')](handleError(_0xc0e5b8,null));}; \ No newline at end of file +var _0xf366=['where','filters','pick','filter','merge','type','options','Interval','includeAll','include','findAll','catch','show','params','keys','find','body','user','role','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','rawAttributes','findOne','sequelize','transaction','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','update','destroy','get','Intervals','UserProfileResource','then','name','send','fieldName','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x45ea3c,_0x465a35){var _0x5bc6ba=function(_0x2c7ab9){while(--_0x2c7ab9){_0x45ea3c['push'](_0x45ea3c['shift']());}};_0x5bc6ba(++_0x465a35);}(_0xf366,0x1dd));var _0x6f36=function(_0x3a5276,_0x43ce45){_0x3a5276=_0x3a5276-0x0;var _0x293e8e=_0xf366[_0x3a5276];return _0x293e8e;};'use strict';var emlformat=require(_0x6f36('0x0'));var rimraf=require(_0x6f36('0x1'));var zipdir=require(_0x6f36('0x2'));var jsonpatch=require(_0x6f36('0x3'));var rp=require('request-promise');var moment=require(_0x6f36('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6f36('0x5'));var util=require(_0x6f36('0x6'));var path=require(_0x6f36('0x7'));var sox=require(_0x6f36('0x8'));var csv=require(_0x6f36('0x9'));var ejs=require(_0x6f36('0xa'));var fs=require('fs');var fs_extra=require(_0x6f36('0xb'));var _=require(_0x6f36('0xc'));var squel=require(_0x6f36('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6f36('0xe'));var toCsv=require(_0x6f36('0x9'));var querystring=require(_0x6f36('0xf'));var Papa=require(_0x6f36('0x10'));var Redis=require(_0x6f36('0x11'));var authService=require(_0x6f36('0x12'));var qs=require(_0x6f36('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f36('0x14'));var logger=require(_0x6f36('0x15'))(_0x6f36('0x16'));var utils=require(_0x6f36('0x17'));var config=require(_0x6f36('0x18'));var licenseUtil=require(_0x6f36('0x19'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0xc1fcc0,_0x1cf871){_0x1cf871=_0x1cf871||0xcc;return function(_0x4e6b93){if(_0x4e6b93){return _0xc1fcc0[_0x6f36('0x1a')](_0x1cf871);}return _0xc1fcc0[_0x6f36('0x1b')](_0x1cf871)[_0x6f36('0x1c')]();};}function respondWithResult(_0x2473d2,_0x3b453b){_0x3b453b=_0x3b453b||0xc8;return function(_0x4ef631){if(_0x4ef631){return _0x2473d2[_0x6f36('0x1b')](_0x3b453b)['json'](_0x4ef631);}};}function respondWithFilteredResult(_0x187771,_0x2510ef){return function(_0x3ccf20){if(_0x3ccf20){var _0x5be098=typeof _0x2510ef[_0x6f36('0x1d')]===_0x6f36('0x1e')&&typeof _0x2510ef[_0x6f36('0x1f')]==='undefined';var _0x77a7c0=_0x3ccf20[_0x6f36('0x20')];var _0x126282=_0x5be098?0x0:_0x2510ef['offset'];var _0x21b6f8=_0x5be098?_0x3ccf20[_0x6f36('0x20')]:_0x2510ef[_0x6f36('0x1d')]+_0x2510ef['limit'];var _0xef213;if(_0x21b6f8>=_0x77a7c0){_0x21b6f8=_0x77a7c0;_0xef213=0xc8;}else{_0xef213=0xce;}_0x187771['status'](_0xef213);return _0x187771[_0x6f36('0x21')]('Content-Range',_0x126282+'-'+_0x21b6f8+'/'+_0x77a7c0)[_0x6f36('0x22')](_0x3ccf20);}return null;};}function patchUpdates(_0x33cb22){return function(_0xf056dd){try{jsonpatch['apply'](_0xf056dd,_0x33cb22,!![]);}catch(_0x5a8434){return BPromise[_0x6f36('0x23')](_0x5a8434);}return _0xf056dd['save']();};}function saveUpdates(_0x4a3be0,_0x4a76c4){return function(_0x4151b9){if(_0x4151b9){return _0x4151b9[_0x6f36('0x24')](_0x4a3be0)['then'](function(_0x26b470){return _0x26b470;});}return null;};}function removeEntity(_0x30bed0,_0xa56d03){return function(_0x780bb3){if(_0x780bb3){return _0x780bb3[_0x6f36('0x25')]()['then'](function(){var _0x8d129f=_0x780bb3[_0x6f36('0x26')]({'plain':!![]});var _0xca19e8=_0x6f36('0x27');return db[_0x6f36('0x28')]['destroy']({'where':{'type':_0xca19e8,'resourceId':_0x8d129f['id']}})[_0x6f36('0x29')](function(){return _0x780bb3;});})['then'](function(){_0x30bed0[_0x6f36('0x1b')](0xcc)[_0x6f36('0x1c')]();});}};}function handleEntityNotFound(_0x3442c4,_0x482f15){return function(_0x4d8980){if(!_0x4d8980){_0x3442c4[_0x6f36('0x1a')](0x194);}return _0x4d8980;};}function handleError(_0x34397d,_0x20f9d8){_0x20f9d8=_0x20f9d8||0x1f4;return function(_0x4fcb61){logger['error'](_0x4fcb61['stack']);if(_0x4fcb61[_0x6f36('0x2a')]){delete _0x4fcb61[_0x6f36('0x2a')];}_0x34397d[_0x6f36('0x1b')](_0x20f9d8)[_0x6f36('0x2b')](_0x4fcb61);};}exports['index']=function(_0x5573fb,_0x573e6d){var _0x94ef11={},_0xc288fa={},_0x542c2e={'count':0x0,'rows':[]};var _0xb548ff=_['map'](db['Interval']['rawAttributes'],function(_0x4b9836){return{'name':_0x4b9836[_0x6f36('0x2c')],'type':_0x4b9836['type'][_0x6f36('0x2d')]};});_0xc288fa[_0x6f36('0x2e')]=_[_0x6f36('0x2f')](_0xb548ff,_0x6f36('0x2a'));_0xc288fa[_0x6f36('0x30')]=_['keys'](_0x5573fb[_0x6f36('0x30')]);_0xc288fa['filters']=_[_0x6f36('0x31')](_0xc288fa[_0x6f36('0x2e')],_0xc288fa[_0x6f36('0x30')]);_0x94ef11['attributes']=_[_0x6f36('0x31')](_0xc288fa[_0x6f36('0x2e')],qs[_0x6f36('0x32')](_0x5573fb[_0x6f36('0x30')][_0x6f36('0x32')]));_0x94ef11[_0x6f36('0x33')]=_0x94ef11[_0x6f36('0x33')][_0x6f36('0x34')]?_0x94ef11[_0x6f36('0x33')]:_0xc288fa[_0x6f36('0x2e')];if(!_0x5573fb[_0x6f36('0x30')][_0x6f36('0x35')](_0x6f36('0x36'))){_0x94ef11['limit']=qs[_0x6f36('0x1f')](_0x5573fb[_0x6f36('0x30')][_0x6f36('0x1f')]);_0x94ef11[_0x6f36('0x1d')]=qs[_0x6f36('0x1d')](_0x5573fb['query']['offset']);}_0x94ef11[_0x6f36('0x37')]=qs[_0x6f36('0x38')](_0x5573fb['query'][_0x6f36('0x38')]);_0x94ef11[_0x6f36('0x39')]=qs[_0x6f36('0x3a')](_[_0x6f36('0x3b')](_0x5573fb[_0x6f36('0x30')],_0xc288fa[_0x6f36('0x3a')]),_0xb548ff);if(_0x5573fb[_0x6f36('0x30')][_0x6f36('0x3c')]){_0x94ef11[_0x6f36('0x39')]=_[_0x6f36('0x3d')](_0x94ef11[_0x6f36('0x39')],{'$or':_[_0x6f36('0x2f')](_0xb548ff,function(_0x3b1061){if(_0x3b1061[_0x6f36('0x3e')]!=='VIRTUAL'){var _0x71bad2={};_0x71bad2[_0x3b1061[_0x6f36('0x2a')]]={'$like':'%'+_0x5573fb[_0x6f36('0x30')][_0x6f36('0x3c')]+'%'};return _0x71bad2;}})});}_0x94ef11=_[_0x6f36('0x3d')]({},_0x94ef11,_0x5573fb[_0x6f36('0x3f')]);var _0x5da005={'where':_0x94ef11[_0x6f36('0x39')]};return db[_0x6f36('0x40')][_0x6f36('0x20')](_0x5da005)[_0x6f36('0x29')](function(_0x148f9d){_0x542c2e[_0x6f36('0x20')]=_0x148f9d;if(_0x5573fb[_0x6f36('0x30')][_0x6f36('0x41')]){_0x94ef11[_0x6f36('0x42')]=[{'all':!![]}];}return db[_0x6f36('0x40')][_0x6f36('0x43')](_0x94ef11);})[_0x6f36('0x29')](function(_0x334a1e){_0x542c2e['rows']=_0x334a1e;return _0x542c2e;})['then'](respondWithFilteredResult(_0x573e6d,_0x94ef11))[_0x6f36('0x44')](handleError(_0x573e6d,null));};exports[_0x6f36('0x45')]=function(_0x17a454,_0x2ff7ed){var _0x4b202a={'raw':!![],'where':{'id':_0x17a454[_0x6f36('0x46')]['id']}},_0x43fb92={};_0x43fb92['model']=_[_0x6f36('0x47')](db[_0x6f36('0x40')]['rawAttributes']);_0x43fb92[_0x6f36('0x30')]=_[_0x6f36('0x47')](_0x17a454[_0x6f36('0x30')]);_0x43fb92[_0x6f36('0x3a')]=_['intersection'](_0x43fb92[_0x6f36('0x2e')],_0x43fb92[_0x6f36('0x30')]);_0x4b202a[_0x6f36('0x33')]=_['intersection'](_0x43fb92[_0x6f36('0x2e')],qs[_0x6f36('0x32')](_0x17a454[_0x6f36('0x30')][_0x6f36('0x32')]));_0x4b202a[_0x6f36('0x33')]=_0x4b202a[_0x6f36('0x33')]['length']?_0x4b202a['attributes']:_0x43fb92['model'];if(_0x17a454[_0x6f36('0x30')]['includeAll']){_0x4b202a[_0x6f36('0x42')]=[{'all':!![]}];}_0x4b202a=_['merge']({},_0x4b202a,_0x17a454['options']);return db[_0x6f36('0x40')][_0x6f36('0x48')](_0x4b202a)[_0x6f36('0x29')](handleEntityNotFound(_0x2ff7ed,null))[_0x6f36('0x29')](respondWithResult(_0x2ff7ed,null))['catch'](handleError(_0x2ff7ed,null));};exports['create']=function(_0x58522e,_0x276c37){return db[_0x6f36('0x40')]['create'](_0x58522e[_0x6f36('0x49')],{})[_0x6f36('0x29')](function(_0x53acfe){var _0x478a16=_0x58522e[_0x6f36('0x4a')][_0x6f36('0x26')]({'plain':!![]});if(!_0x478a16)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x478a16[_0x6f36('0x4b')]===_0x6f36('0x4a')){var _0x18026d=_0x53acfe['get']({'plain':!![]});var _0xd9a241=_0x6f36('0x27');return db[_0x6f36('0x4c')][_0x6f36('0x48')]({'where':{'name':_0xd9a241,'userProfileId':_0x478a16[_0x6f36('0x4d')]},'raw':!![]})['then'](function(_0xc5389b){if(_0xc5389b&&_0xc5389b[_0x6f36('0x4e')]===0x0){return db[_0x6f36('0x28')][_0x6f36('0x4f')]({'name':_0x18026d['name'],'resourceId':_0x18026d['id'],'type':_0xc5389b['name'],'sectionId':_0xc5389b['id']},{})['then'](function(){return _0x53acfe;});}else{return _0x53acfe;}})[_0x6f36('0x44')](function(_0x3e36b1){logger[_0x6f36('0x50')](_0x6f36('0x51'),_0x3e36b1);throw _0x3e36b1;});}return _0x53acfe;})[_0x6f36('0x29')](respondWithResult(_0x276c37,0xc9))[_0x6f36('0x44')](handleError(_0x276c37,null));};exports[_0x6f36('0x24')]=function(_0x3caa62,_0x1c7c48){if(_0x3caa62['body']['id']){delete _0x3caa62[_0x6f36('0x49')]['id'];}return db['Interval'][_0x6f36('0x48')]({'where':{'id':_0x3caa62['params']['id']}})[_0x6f36('0x29')](handleEntityNotFound(_0x1c7c48,null))[_0x6f36('0x29')](saveUpdates(_0x3caa62['body'],null))[_0x6f36('0x29')](respondWithResult(_0x1c7c48,null))[_0x6f36('0x44')](handleError(_0x1c7c48,null));};exports[_0x6f36('0x25')]=function(_0x33a3f7,_0x2e3156){return db[_0x6f36('0x40')]['find']({'where':{'id':_0x33a3f7[_0x6f36('0x46')]['id']}})[_0x6f36('0x29')](handleEntityNotFound(_0x2e3156,null))[_0x6f36('0x29')](removeEntity(_0x2e3156,null))[_0x6f36('0x44')](handleError(_0x2e3156,null));};exports[_0x6f36('0x52')]=function(_0x106337,_0x58e1a3,_0x5e31c3){if(_0x106337[_0x6f36('0x49')]['id']){delete _0x106337[_0x6f36('0x49')]['id'];}return db['Interval']['find']({'where':{'id':_0x106337[_0x6f36('0x46')]['id']}})['then'](handleEntityNotFound(_0x58e1a3,null))[_0x6f36('0x29')](function(_0x3bc4ef){if(_0x3bc4ef){_0x106337[_0x6f36('0x49')][_0x6f36('0x53')]=_0x3bc4ef['id'];return db[_0x6f36('0x40')][_0x6f36('0x4f')](_0x106337['body']);}})['then'](respondWithResult(_0x58e1a3,null))[_0x6f36('0x44')](handleError(_0x58e1a3,null));};exports[_0x6f36('0x54')]=function(_0x191ca4,_0x593a4c,_0x2f26a5){var _0x348470={};var _0x26268a={};var _0x5e70b7;var _0x2c1911;return db[_0x6f36('0x40')]['findOne']({'where':{'id':_0x191ca4[_0x6f36('0x46')]['id']}})[_0x6f36('0x29')](handleEntityNotFound(_0x593a4c,null))['then'](function(_0x54f66b){if(_0x54f66b){_0x5e70b7=_0x54f66b;_0x26268a['model']=_[_0x6f36('0x47')](db[_0x6f36('0x40')][_0x6f36('0x55')]);_0x26268a[_0x6f36('0x30')]=_[_0x6f36('0x47')](_0x191ca4[_0x6f36('0x30')]);_0x26268a[_0x6f36('0x3a')]=_['intersection'](_0x26268a[_0x6f36('0x2e')],_0x26268a[_0x6f36('0x30')]);_0x348470[_0x6f36('0x33')]=_[_0x6f36('0x31')](_0x26268a[_0x6f36('0x2e')],qs['fields'](_0x191ca4[_0x6f36('0x30')][_0x6f36('0x32')]));_0x348470[_0x6f36('0x33')]=_0x348470[_0x6f36('0x33')][_0x6f36('0x34')]?_0x348470[_0x6f36('0x33')]:_0x26268a[_0x6f36('0x2e')];_0x348470[_0x6f36('0x37')]=qs['sort'](_0x191ca4['query'][_0x6f36('0x38')]);_0x348470['where']=qs[_0x6f36('0x3a')](_[_0x6f36('0x3b')](_0x191ca4[_0x6f36('0x30')],_0x26268a['filters']));if(_0x191ca4[_0x6f36('0x30')][_0x6f36('0x3c')]){_0x348470[_0x6f36('0x39')]=_['merge'](_0x348470[_0x6f36('0x39')],{'$or':_[_0x6f36('0x2f')](_0x348470[_0x6f36('0x33')],function(_0x1147bb){var _0x54ca15={};_0x54ca15[_0x1147bb]={'$like':'%'+_0x191ca4[_0x6f36('0x30')][_0x6f36('0x3c')]+'%'};return _0x54ca15;})});}_0x348470=_[_0x6f36('0x3d')]({},_0x348470,_0x191ca4[_0x6f36('0x3f')]);return _0x5e70b7[_0x6f36('0x54')](_0x348470);}})['then'](function(_0x4024a5){if(_0x4024a5){_0x2c1911=_0x4024a5[_0x6f36('0x34')];if(!_0x191ca4[_0x6f36('0x30')]['hasOwnProperty']('nolimit')){_0x348470[_0x6f36('0x1f')]=qs[_0x6f36('0x1f')](_0x191ca4[_0x6f36('0x30')][_0x6f36('0x1f')]);_0x348470[_0x6f36('0x1d')]=qs['offset'](_0x191ca4[_0x6f36('0x30')][_0x6f36('0x1d')]);}return _0x5e70b7[_0x6f36('0x54')](_0x348470);}})[_0x6f36('0x29')](function(_0xa09d14){if(_0xa09d14){return _0xa09d14?{'count':_0x2c1911,'rows':_0xa09d14}:null;}})[_0x6f36('0x29')](respondWithResult(_0x593a4c,null))['catch'](handleError(_0x593a4c,null));};exports['addIntervals']=function(_0x4b250a,_0x4fc9df,_0x2f7e93){return db[_0x6f36('0x40')][_0x6f36('0x56')]({'where':{'id':_0x4b250a['params']['id']}})[_0x6f36('0x29')](handleEntityNotFound(_0x4fc9df,null))[_0x6f36('0x29')](function(_0x595020){if(_0x595020){return db[_0x6f36('0x57')][_0x6f36('0x58')](function(_0x69773a){return db[_0x6f36('0x40')]['destroy']({'where':{'IntervalId':_0x4b250a[_0x6f36('0x46')]['id']},'transaction':_0x69773a})[_0x6f36('0x29')](function(_0x4162bd){var _0x375dc5=_['map'](_0x4b250a[_0x6f36('0x49')],function(_0x5f5917){delete _0x5f5917['id'];_0x5f5917[_0x6f36('0x53')]=_0x4b250a[_0x6f36('0x46')]['id'];return _0x5f5917;});return db['Interval']['bulkCreate'](_0x375dc5,{'transaction':_0x69773a});});})['then'](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x4b250a['params']['id']}});});}})[_0x6f36('0x29')](respondWithResult(_0x4fc9df,null))['catch'](handleError(_0x4fc9df,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 84694e4..a098a71 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 _0xc408=['Interval','tools_intervals','rewrite','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./interval.attributes','exports','define'];(function(_0x22f75e,_0x4a9e06){var _0x1f6ab3=function(_0x1479d4){while(--_0x1479d4){_0x22f75e['push'](_0x22f75e['shift']());}};_0x1f6ab3(++_0x4a9e06);}(_0xc408,0x114));var _0x8c40=function(_0x1f6f30,_0x36b5ba){_0x1f6f30=_0x1f6f30-0x0;var _0x271d9f=_0xc408[_0x1f6f30];return _0x271d9f;};'use strict';var _=require(_0x8c40('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8c40('0x1'));var moment=require(_0x8c40('0x2'));var BPromise=require(_0x8c40('0x3'));var rp=require(_0x8c40('0x4'));var fs=require('fs');var path=require(_0x8c40('0x5'));var rimraf=require('rimraf');var config=require(_0x8c40('0x6'));var attributes=require(_0x8c40('0x7'));var extensions=require('../../components/extensions/rewrite');module[_0x8c40('0x8')]=function(_0x50cecd,_0x2d4ebb){return _0x50cecd[_0x8c40('0x9')](_0x8c40('0xa'),attributes,{'tableName':_0x8c40('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x454eb8,_0x2e37b4){extensions['rewrite'](_0x50cecd,_0x454eb8);},'afterBulkCreate':function(_0x382ac4,_0x5050f7,_0x16fdb8){_0x16fdb8();extensions[_0x8c40('0xc')](_0x50cecd,_0x382ac4[0x0]);},'afterUpdate':function(_0x16ad7b,_0x5cbf0f){extensions[_0x8c40('0xc')](_0x50cecd,_0x16ad7b);},'afterDestroy':function(_0x24ea41,_0x2ab821){extensions['rewrite'](_0x50cecd,_0x24ea41);}}});}; \ No newline at end of file +var _0x1377=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','exports','Interval','rewrite','lodash','util','../../config/logger'];(function(_0x260f96,_0xef220c){var _0x4cb97b=function(_0x14c5ce){while(--_0x14c5ce){_0x260f96['push'](_0x260f96['shift']());}};_0x4cb97b(++_0xef220c);}(_0x1377,0x101));var _0x7137=function(_0xf81ab2,_0x347423){_0xf81ab2=_0xf81ab2-0x0;var _0x4dd0ff=_0x1377[_0xf81ab2];return _0x4dd0ff;};'use strict';var _=require(_0x7137('0x0'));var util=require(_0x7137('0x1'));var logger=require(_0x7137('0x2'))('api');var moment=require(_0x7137('0x3'));var BPromise=require(_0x7137('0x4'));var rp=require(_0x7137('0x5'));var fs=require('fs');var path=require(_0x7137('0x6'));var rimraf=require(_0x7137('0x7'));var config=require(_0x7137('0x8'));var attributes=require(_0x7137('0x9'));var extensions=require('../../components/extensions/rewrite');module[_0x7137('0xa')]=function(_0x1fca09,_0x429ddf){return _0x1fca09['define'](_0x7137('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5bf077,_0x21be16){extensions[_0x7137('0xc')](_0x1fca09,_0x5bf077);},'afterBulkCreate':function(_0x2425ac,_0x52dfee,_0x4f82ba){_0x4f82ba();extensions[_0x7137('0xc')](_0x1fca09,_0x2425ac[0x0]);},'afterUpdate':function(_0x1d628c,_0x168d96){extensions['rewrite'](_0x1fca09,_0x1d628c);},'afterDestroy':function(_0x5a772d,_0x18861c){extensions[_0x7137('0xc')](_0x1fca09,_0x5a772d);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 98f8134..f43baab 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index b59feca..5a93c54 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 _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x48052c,_0x20219e){var _0x29bd1d=function(_0x566f38){while(--_0x566f38){_0x48052c['push'](_0x48052c['shift']());}};_0x29bd1d(++_0x20219e);}(_0x2032,0xd9));var _0x2203=function(_0x24d7d4,_0xe03b7e){_0x24d7d4=_0x24d7d4-0x0;var _0x34e748=_0x2032[_0x24d7d4];return _0x34e748;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x1d061e,_0x3c68c7){var _0x5aa7aa=function(_0x4b1ae1){while(--_0x4b1ae1){_0x1d061e['push'](_0x1d061e['shift']());}};_0x5aa7aa(++_0x3c68c7);}(_0xdb28,0x106));var _0x8db2=function(_0x4276d0,_0x5201cb){_0x4276d0=_0x4276d0-0x0;var _0x159dda=_0xdb28[_0x4276d0];return _0x159dda;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 341680a..3373c73 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 _0xd339=['api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','utf8','data','end','status','statusCode','json','parse','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https'];(function(_0x40eefb,_0x5c0ff0){var _0x4e424c=function(_0x50e0cf){while(--_0x50e0cf){_0x40eefb['push'](_0x40eefb['shift']());}};_0x4e424c(++_0x5c0ff0);}(_0xd339,0x155));var _0x9d33=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd339[_0x167cc1];return _0x10bc4b;};'use strict';var BPromise=require(_0x9d33('0x0'));var https=require(_0x9d33('0x1'));var logger=require('../../config/logger')(_0x9d33('0x2'));var USERNAME=_0x9d33('0x3');var PASSWORD=_0x9d33('0x4');function openIssue(_0x2fef82,_0x4fba14){var _0x3203e6={'fields':{'project':{'key':_0x2fef82[_0x9d33('0x5')]||_0x9d33('0x6')},'summary':(_0x2fef82[_0x9d33('0x7')]||_0x9d33('0x8'))+_0x9d33('0x9')+_0x2fef82['ip'],'description':_0x2fef82[_0x9d33('0xa')]||JSON[_0x9d33('0xb')](_0x2fef82),'issuetype':{'name':_0x2fef82[_0x9d33('0xc')]||_0x9d33('0xd')}}};_0x3203e6[_0x9d33('0xe')][_0x9d33('0xf')]=_0x2fef82[_0x9d33('0x10')];_0x3203e6[_0x9d33('0xe')][_0x9d33('0x11')]=_0x2fef82[_0x9d33('0x12')];_0x3203e6[_0x9d33('0xe')][_0x9d33('0x13')]=_0x2fef82[_0x9d33('0x14')];_0x3203e6[_0x9d33('0xe')][_0x9d33('0x15')]=_0x2fef82[_0x9d33('0x16')];_0x3203e6[_0x9d33('0xe')][_0x9d33('0x17')]=_0x2fef82[_0x9d33('0x18')];_0x3203e6[_0x9d33('0xe')][_0x9d33('0x19')]=_0x2fef82['ip'];var _0x155e7b={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x9d33('0x1a'),'method':_0x9d33('0x1b'),'timeout':0x4e20,'headers':{'Content-Type':_0x9d33('0x1c'),'Authorization':_0x9d33('0x1d')+new Buffer(USERNAME+':'+PASSWORD)[_0x9d33('0x1e')](_0x9d33('0x1f'))}};var _0x285a93=JSON['stringify'](_0x3203e6);var _0x30f709=https[_0x9d33('0x20')](_0x155e7b,function(_0x2c82ea){_0x2c82ea['setEncoding'](_0x9d33('0x21'));var _0x3bbb20='';_0x2c82ea['on'](_0x9d33('0x22'),function(_0x182abb){_0x3bbb20+=_0x182abb;});_0x2c82ea['on'](_0x9d33('0x23'),function(){if(_0x4fba14){return _0x4fba14[_0x9d33('0x24')](_0x2c82ea[_0x9d33('0x25')])[_0x9d33('0x26')](JSON[_0x9d33('0x27')](_0x3bbb20));}});});_0x30f709['on']('error',function(_0x455cb6){if(_0x4fba14){return _0x4fba14[_0x9d33('0x24')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x30f709[_0x9d33('0x28')](_0x285a93);_0x30f709[_0x9d33('0x23')]();}exports[_0x9d33('0x29')]=openIssue;exports[_0x9d33('0x2a')]=function(_0x5df25a,_0x11945e){_0x5df25a[_0x9d33('0x2b')]['ip']=_0x5df25a[_0x9d33('0x2c')][_0x9d33('0x2d')]||_0x5df25a[_0x9d33('0x2e')][_0x9d33('0x2f')]||_0x5df25a['socket'][_0x9d33('0x2f')]||_0x5df25a[_0x9d33('0x2e')][_0x9d33('0x30')][_0x9d33('0x2f')];return openIssue(_0x5df25a[_0x9d33('0x2b')],_0x11945e);}; \ No newline at end of file +var _0xabbf=['description','stringify','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','base64','setEncoding','utf8','data','statusCode','parse','status','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','../../config/logger','3eAmWpBVP0','Report','\x20from\x20'];(function(_0x4214d3,_0xfcc2b1){var _0x3385f3=function(_0x43d181){while(--_0x43d181){_0x4214d3['push'](_0x4214d3['shift']());}};_0x3385f3(++_0xfcc2b1);}(_0xabbf,0xcc));var _0xfabb=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0xabbf[_0x3712e2];return _0x1faff4;};'use strict';var BPromise=require(_0xfabb('0x0'));var https=require(_0xfabb('0x1'));var logger=require(_0xfabb('0x2'))('api');var USERNAME='support';var PASSWORD=_0xfabb('0x3');function openIssue(_0x170423,_0x261608){var _0x121a4a={'fields':{'project':{'key':_0x170423['key']||'MOTGUI'},'summary':(_0x170423['summary']||_0xfabb('0x4'))+_0xfabb('0x5')+_0x170423['ip'],'description':_0x170423[_0xfabb('0x6')]||JSON[_0xfabb('0x7')](_0x170423),'issuetype':{'name':_0x170423[_0xfabb('0x8')]||'Bug'}}};_0x121a4a[_0xfabb('0x9')][_0xfabb('0xa')]=_0x170423[_0xfabb('0xb')];_0x121a4a['fields'][_0xfabb('0xc')]=_0x170423[_0xfabb('0xd')];_0x121a4a[_0xfabb('0x9')]['customfield_11502']=_0x170423['newToken'];_0x121a4a[_0xfabb('0x9')]['customfield_11503']=_0x170423[_0xfabb('0xe')];_0x121a4a[_0xfabb('0x9')][_0xfabb('0xf')]=_0x170423[_0xfabb('0x10')];_0x121a4a[_0xfabb('0x9')][_0xfabb('0x11')]=_0x170423['ip'];var _0x11f350={'host':_0xfabb('0x12'),'port':0x1bb,'path':_0xfabb('0x13'),'method':_0xfabb('0x14'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xfabb('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0xfabb('0x16')](_0xfabb('0x17'))}};var _0x5d9753=JSON[_0xfabb('0x7')](_0x121a4a);var _0x4ab50c=https['request'](_0x11f350,function(_0x1bc2d7){_0x1bc2d7[_0xfabb('0x18')](_0xfabb('0x19'));var _0x245b09='';_0x1bc2d7['on'](_0xfabb('0x1a'),function(_0x3ee952){_0x245b09+=_0x3ee952;});_0x1bc2d7['on']('end',function(){if(_0x261608){return _0x261608['status'](_0x1bc2d7[_0xfabb('0x1b')])['json'](JSON[_0xfabb('0x1c')](_0x245b09));}});});_0x4ab50c['on']('error',function(_0x1a4916){if(_0x261608){return _0x261608[_0xfabb('0x1d')](0x1f4)[_0xfabb('0x1e')]({'errors':[{'message':_0xfabb('0x1f'),'type':_0xfabb('0x20')}]});}});_0x4ab50c[_0xfabb('0x21')](_0x5d9753);_0x4ab50c['end']();}exports[_0xfabb('0x22')]=openIssue;exports[_0xfabb('0x23')]=function(_0x36b0a3,_0x22b3c0){_0x36b0a3[_0xfabb('0x24')]['ip']=_0x36b0a3[_0xfabb('0x25')][_0xfabb('0x26')]||_0x36b0a3['connection'][_0xfabb('0x27')]||_0x36b0a3[_0xfabb('0x28')]['remoteAddress']||_0x36b0a3[_0xfabb('0x29')][_0xfabb('0x28')][_0xfabb('0x27')];return openIssue(_0x36b0a3[_0xfabb('0x24')],_0x22b3c0);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 59187c1..d3ba8a6 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 _0x4ea3=['multer','util','path','connect-timeout','Router','../../components/auth/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','post','update','destroy','exports'];(function(_0x5a9e32,_0x3197fd){var _0x521b3f=function(_0x55f4f9){while(--_0x55f4f9){_0x5a9e32['push'](_0x5a9e32['shift']());}};_0x521b3f(++_0x3197fd);}(_0x4ea3,0x70));var _0x34ea=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4ea3[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var path=require(_0x34ea('0x2'));var timeout=require(_0x34ea('0x3'));var express=require('express');var router=express[_0x34ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34ea('0x6'));router[_0x34ea('0x7')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0x9')]);router[_0x34ea('0x7')](_0x34ea('0xa'),auth[_0x34ea('0x8')](),controller['describe']);router[_0x34ea('0x7')](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller['show']);router[_0x34ea('0xc')]('/',auth[_0x34ea('0x8')](),controller['create']);router['put'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xd')]);router['delete'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xe')]);module[_0x34ea('0xf')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x42f6e8,_0x5295ca){var _0x535ec0=function(_0x152021){while(--_0x152021){_0x42f6e8['push'](_0x42f6e8['shift']());}};_0x535ec0(++_0x5295ca);}(_0xe706,0xa3));var _0x6e70=function(_0x1dc2b4,_0x573a04){_0x1dc2b4=_0x1dc2b4-0x0;var _0x18af92=_0xe706[_0x1dc2b4];return _0x18af92;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 4d6a5d5..da0d774 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(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7a54,0x106));var _0x47a5=function(_0xdcd877,_0x4e8bbe){_0xdcd877=_0xdcd877-0x0;var _0x129c5c=_0x7a54[_0xdcd877];return _0x129c5c;};'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(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7a54,0x106));var _0x47a5=function(_0x355798,_0x4887c7){_0x355798=_0x355798-0x0;var _0x1d9da7=_0x7a54[_0x355798];return _0x1d9da7;};'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 2933a12..77cd847 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 _0x2c8f=['then','destroy','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','show','params','length','find','catch','create','body','describe','rimraf','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update'];(function(_0x281a42,_0x149c67){var _0x45c755=function(_0x2baa89){while(--_0x2baa89){_0x281a42['push'](_0x281a42['shift']());}};_0x45c755(++_0x149c67);}(_0x2c8f,0x192));var _0xf2c8=function(_0xc1db34,_0x33af52){_0xc1db34=_0xc1db34-0x0;var _0xb37e7c=_0x2c8f[_0xc1db34];return _0xb37e7c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf2c8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf2c8('0x1'));var BPromise=require(_0xf2c8('0x2'));var Mustache=require(_0xf2c8('0x3'));var util=require('util');var path=require('path');var sox=require(_0xf2c8('0x4'));var csv=require(_0xf2c8('0x5'));var ejs=require(_0xf2c8('0x6'));var fs=require('fs');var fs_extra=require(_0xf2c8('0x7'));var _=require(_0xf2c8('0x8'));var squel=require('squel');var crypto=require(_0xf2c8('0x9'));var jsforce=require(_0xf2c8('0xa'));var deskjs=require(_0xf2c8('0xb'));var toCsv=require(_0xf2c8('0x5'));var querystring=require(_0xf2c8('0xc'));var Papa=require(_0xf2c8('0xd'));var Redis=require('ioredis');var authService=require(_0xf2c8('0xe'));var qs=require(_0xf2c8('0xf'));var as=require(_0xf2c8('0x10'));var hardwareService=require(_0xf2c8('0x11'));var logger=require(_0xf2c8('0x12'))(_0xf2c8('0x13'));var utils=require(_0xf2c8('0x14'));var config=require(_0xf2c8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf2c8('0x16'))['db'];function respondWithStatusCode(_0x5ce572,_0x10bc2c){_0x10bc2c=_0x10bc2c||0xcc;return function(_0x16b7a4){if(_0x16b7a4){return _0x5ce572[_0xf2c8('0x17')](_0x10bc2c);}return _0x5ce572[_0xf2c8('0x18')](_0x10bc2c)[_0xf2c8('0x19')]();};}function respondWithResult(_0x40849c,_0x54dd36){_0x54dd36=_0x54dd36||0xc8;return function(_0x3b86f0){if(_0x3b86f0){return _0x40849c[_0xf2c8('0x18')](_0x54dd36)[_0xf2c8('0x1a')](_0x3b86f0);}};}function respondWithFilteredResult(_0x34f9b1,_0x3ed09e){return function(_0x383af2){if(_0x383af2){var _0x1b8c5b=typeof _0x3ed09e['offset']===_0xf2c8('0x1b')&&typeof _0x3ed09e[_0xf2c8('0x1c')]===_0xf2c8('0x1b');var _0x31b8e0=_0x383af2[_0xf2c8('0x1d')];var _0x52e9d0=_0x1b8c5b?0x0:_0x3ed09e['offset'];var _0x104d9d=_0x1b8c5b?_0x383af2[_0xf2c8('0x1d')]:_0x3ed09e[_0xf2c8('0x1e')]+_0x3ed09e[_0xf2c8('0x1c')];var _0x516d99;if(_0x104d9d>=_0x31b8e0){_0x104d9d=_0x31b8e0;_0x516d99=0xc8;}else{_0x516d99=0xce;}_0x34f9b1[_0xf2c8('0x18')](_0x516d99);return _0x34f9b1[_0xf2c8('0x1f')](_0xf2c8('0x20'),_0x52e9d0+'-'+_0x104d9d+'/'+_0x31b8e0)['json'](_0x383af2);}return null;};}function patchUpdates(_0x4442f9){return function(_0x31008e){try{jsonpatch['apply'](_0x31008e,_0x4442f9,!![]);}catch(_0x5b1e44){return BPromise[_0xf2c8('0x21')](_0x5b1e44);}return _0x31008e[_0xf2c8('0x22')]();};}function saveUpdates(_0x98f9cb,_0x57affa){return function(_0xd2e728){if(_0xd2e728){return _0xd2e728[_0xf2c8('0x23')](_0x98f9cb)[_0xf2c8('0x24')](function(_0x239350){return _0x239350;});}return null;};}function removeEntity(_0x4ba1e0,_0x17956f){return function(_0xe5ff6c){if(_0xe5ff6c){return _0xe5ff6c[_0xf2c8('0x25')]()[_0xf2c8('0x24')](function(){_0x4ba1e0[_0xf2c8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x93707c,_0x54bbcb){return function(_0x3cd344){if(!_0x3cd344){_0x93707c[_0xf2c8('0x17')](0x194);}return _0x3cd344;};}function handleError(_0x27dc4f,_0x3bb777){_0x3bb777=_0x3bb777||0x1f4;return function(_0x1d2e74){logger[_0xf2c8('0x26')](_0x1d2e74[_0xf2c8('0x27')]);if(_0x1d2e74[_0xf2c8('0x28')]){delete _0x1d2e74[_0xf2c8('0x28')];}_0x27dc4f[_0xf2c8('0x18')](_0x3bb777)[_0xf2c8('0x29')](_0x1d2e74);};}exports[_0xf2c8('0x2a')]=function(_0x311349,_0x4e12a2){var _0x1cb979={},_0x5146e4={},_0x584587={'count':0x0,'rows':[]};var _0x3df45d=_['map'](db[_0xf2c8('0x2b')][_0xf2c8('0x2c')],function(_0x23de17){return{'name':_0x23de17[_0xf2c8('0x2d')],'type':_0x23de17[_0xf2c8('0x2e')][_0xf2c8('0x2f')]};});_0x5146e4[_0xf2c8('0x30')]=_['map'](_0x3df45d,_0xf2c8('0x28'));_0x5146e4[_0xf2c8('0x31')]=_[_0xf2c8('0x32')](_0x311349[_0xf2c8('0x31')]);_0x5146e4[_0xf2c8('0x33')]=_[_0xf2c8('0x34')](_0x5146e4['model'],_0x5146e4[_0xf2c8('0x31')]);_0x1cb979['attributes']=_[_0xf2c8('0x34')](_0x5146e4['model'],qs[_0xf2c8('0x35')](_0x311349[_0xf2c8('0x31')][_0xf2c8('0x35')]));_0x1cb979[_0xf2c8('0x36')]=_0x1cb979[_0xf2c8('0x36')]['length']?_0x1cb979[_0xf2c8('0x36')]:_0x5146e4[_0xf2c8('0x30')];if(!_0x311349['query'][_0xf2c8('0x37')](_0xf2c8('0x38'))){_0x1cb979['limit']=qs[_0xf2c8('0x1c')](_0x311349[_0xf2c8('0x31')][_0xf2c8('0x1c')]);_0x1cb979[_0xf2c8('0x1e')]=qs[_0xf2c8('0x1e')](_0x311349['query']['offset']);}_0x1cb979[_0xf2c8('0x39')]=qs[_0xf2c8('0x3a')](_0x311349[_0xf2c8('0x31')][_0xf2c8('0x3a')]);_0x1cb979[_0xf2c8('0x3b')]=qs[_0xf2c8('0x33')](_[_0xf2c8('0x3c')](_0x311349[_0xf2c8('0x31')],_0x5146e4['filters']),_0x3df45d);if(_0x311349[_0xf2c8('0x31')][_0xf2c8('0x3d')]){_0x1cb979[_0xf2c8('0x3b')]=_['merge'](_0x1cb979['where'],{'$or':_['map'](_0x3df45d,function(_0x5e646e){if(_0x5e646e[_0xf2c8('0x2e')]!=='VIRTUAL'){var _0x219318={};_0x219318[_0x5e646e['name']]={'$like':'%'+_0x311349[_0xf2c8('0x31')]['filter']+'%'};return _0x219318;}})});}_0x1cb979=_['merge']({},_0x1cb979,_0x311349[_0xf2c8('0x3e')]);var _0x523f92={'where':_0x1cb979['where']};return db[_0xf2c8('0x2b')][_0xf2c8('0x1d')](_0x523f92)['then'](function(_0x1f4115){_0x584587[_0xf2c8('0x1d')]=_0x1f4115;if(_0x311349[_0xf2c8('0x31')][_0xf2c8('0x3f')]){_0x1cb979[_0xf2c8('0x40')]=[{'all':!![]}];}return db[_0xf2c8('0x2b')]['findAll'](_0x1cb979);})['then'](function(_0x200920){_0x584587['rows']=_0x200920;return _0x584587;})[_0xf2c8('0x24')](respondWithFilteredResult(_0x4e12a2,_0x1cb979))['catch'](handleError(_0x4e12a2,null));};exports[_0xf2c8('0x41')]=function(_0x580def,_0x3e70eb){var _0x295910={'raw':!![],'where':{'id':_0x580def[_0xf2c8('0x42')]['id']}},_0x251e4c={};_0x251e4c['model']=_[_0xf2c8('0x32')](db[_0xf2c8('0x2b')]['rawAttributes']);_0x251e4c[_0xf2c8('0x31')]=_[_0xf2c8('0x32')](_0x580def[_0xf2c8('0x31')]);_0x251e4c[_0xf2c8('0x33')]=_[_0xf2c8('0x34')](_0x251e4c[_0xf2c8('0x30')],_0x251e4c[_0xf2c8('0x31')]);_0x295910['attributes']=_[_0xf2c8('0x34')](_0x251e4c[_0xf2c8('0x30')],qs[_0xf2c8('0x35')](_0x580def[_0xf2c8('0x31')]['fields']));_0x295910['attributes']=_0x295910[_0xf2c8('0x36')][_0xf2c8('0x43')]?_0x295910[_0xf2c8('0x36')]:_0x251e4c['model'];if(_0x580def[_0xf2c8('0x31')][_0xf2c8('0x3f')]){_0x295910['include']=[{'all':!![]}];}_0x295910=_['merge']({},_0x295910,_0x580def[_0xf2c8('0x3e')]);return db[_0xf2c8('0x2b')][_0xf2c8('0x44')](_0x295910)[_0xf2c8('0x24')](handleEntityNotFound(_0x3e70eb,null))['then'](respondWithResult(_0x3e70eb,null))[_0xf2c8('0x45')](handleError(_0x3e70eb,null));};exports[_0xf2c8('0x46')]=function(_0x18bbd9,_0x598997){return db[_0xf2c8('0x2b')][_0xf2c8('0x46')](_0x18bbd9[_0xf2c8('0x47')],{})['then'](respondWithResult(_0x598997,0xc9))[_0xf2c8('0x45')](handleError(_0x598997,null));};exports[_0xf2c8('0x23')]=function(_0x24d4a2,_0x3d90f5){if(_0x24d4a2[_0xf2c8('0x47')]['id']){delete _0x24d4a2['body']['id'];}return db[_0xf2c8('0x2b')]['find']({'where':{'id':_0x24d4a2['params']['id']}})[_0xf2c8('0x24')](handleEntityNotFound(_0x3d90f5,null))[_0xf2c8('0x24')](saveUpdates(_0x24d4a2[_0xf2c8('0x47')],null))[_0xf2c8('0x24')](respondWithResult(_0x3d90f5,null))[_0xf2c8('0x45')](handleError(_0x3d90f5,null));};exports['destroy']=function(_0x1c7fa5,_0x134077){return db[_0xf2c8('0x2b')][_0xf2c8('0x44')]({'where':{'id':_0x1c7fa5[_0xf2c8('0x42')]['id']}})[_0xf2c8('0x24')](handleEntityNotFound(_0x134077,null))['then'](removeEntity(_0x134077,null))['catch'](handleError(_0x134077,null));};exports[_0xf2c8('0x48')]=function(_0x334285,_0x372296){return db[_0xf2c8('0x2b')][_0xf2c8('0x48')]()[_0xf2c8('0x24')](respondWithResult(_0x372296,null))[_0xf2c8('0x45')](handleError(_0x372296,null));}; \ No newline at end of file +var _0x4e83=['fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x4e83,0x1ae));var _0x34e8=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0x4e83[_0x38b2d9];return _0x23a3e1;};'use strict';var emlformat=require(_0x34e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x34e8('0x1'));var jsonpatch=require(_0x34e8('0x2'));var rp=require(_0x34e8('0x3'));var moment=require(_0x34e8('0x4'));var BPromise=require(_0x34e8('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x34e8('0x6'));var ejs=require(_0x34e8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34e8('0x8'));var squel=require(_0x34e8('0x9'));var crypto=require(_0x34e8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x34e8('0xb'));var toCsv=require(_0x34e8('0x6'));var querystring=require(_0x34e8('0xc'));var Papa=require('papaparse');var Redis=require(_0x34e8('0xd'));var authService=require(_0x34e8('0xe'));var qs=require(_0x34e8('0xf'));var as=require(_0x34e8('0x10'));var hardwareService=require(_0x34e8('0x11'));var logger=require(_0x34e8('0x12'))(_0x34e8('0x13'));var utils=require(_0x34e8('0x14'));var config=require(_0x34e8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x34e8('0x16'))['db'];function respondWithStatusCode(_0x60b6b6,_0x516f49){_0x516f49=_0x516f49||0xcc;return function(_0x6454fd){if(_0x6454fd){return _0x60b6b6[_0x34e8('0x17')](_0x516f49);}return _0x60b6b6[_0x34e8('0x18')](_0x516f49)[_0x34e8('0x19')]();};}function respondWithResult(_0xc4ac78,_0x70f65a){_0x70f65a=_0x70f65a||0xc8;return function(_0x21f234){if(_0x21f234){return _0xc4ac78[_0x34e8('0x18')](_0x70f65a)[_0x34e8('0x1a')](_0x21f234);}};}function respondWithFilteredResult(_0x4c516a,_0xeb505){return function(_0x4447d3){if(_0x4447d3){var _0x36adfb=typeof _0xeb505[_0x34e8('0x1b')]===_0x34e8('0x1c')&&typeof _0xeb505['limit']===_0x34e8('0x1c');var _0x37b6ae=_0x4447d3[_0x34e8('0x1d')];var _0x708dd4=_0x36adfb?0x0:_0xeb505[_0x34e8('0x1b')];var _0x11543c=_0x36adfb?_0x4447d3[_0x34e8('0x1d')]:_0xeb505[_0x34e8('0x1b')]+_0xeb505[_0x34e8('0x1e')];var _0x19b9a4;if(_0x11543c>=_0x37b6ae){_0x11543c=_0x37b6ae;_0x19b9a4=0xc8;}else{_0x19b9a4=0xce;}_0x4c516a[_0x34e8('0x18')](_0x19b9a4);return _0x4c516a['set'](_0x34e8('0x1f'),_0x708dd4+'-'+_0x11543c+'/'+_0x37b6ae)[_0x34e8('0x1a')](_0x4447d3);}return null;};}function patchUpdates(_0xe42e15){return function(_0x8ecd4c){try{jsonpatch[_0x34e8('0x20')](_0x8ecd4c,_0xe42e15,!![]);}catch(_0x188055){return BPromise[_0x34e8('0x21')](_0x188055);}return _0x8ecd4c[_0x34e8('0x22')]();};}function saveUpdates(_0x4967f4,_0xc9fb93){return function(_0x20c7d3){if(_0x20c7d3){return _0x20c7d3['update'](_0x4967f4)[_0x34e8('0x23')](function(_0x592c0e){return _0x592c0e;});}return null;};}function removeEntity(_0x300b94,_0x381d0e){return function(_0x43c689){if(_0x43c689){return _0x43c689['destroy']()['then'](function(){_0x300b94[_0x34e8('0x18')](0xcc)[_0x34e8('0x19')]();});}};}function handleEntityNotFound(_0xb8c9f,_0x2dad57){return function(_0x2e29fb){if(!_0x2e29fb){_0xb8c9f[_0x34e8('0x17')](0x194);}return _0x2e29fb;};}function handleError(_0x31d68a,_0x5c93e5){_0x5c93e5=_0x5c93e5||0x1f4;return function(_0x29be75){logger[_0x34e8('0x24')](_0x29be75[_0x34e8('0x25')]);if(_0x29be75[_0x34e8('0x26')]){delete _0x29be75[_0x34e8('0x26')];}_0x31d68a[_0x34e8('0x18')](_0x5c93e5)[_0x34e8('0x27')](_0x29be75);};}exports[_0x34e8('0x28')]=function(_0x2b445a,_0x18490b){var _0x3f5421={},_0x6f4428={},_0x1df399={'count':0x0,'rows':[]};var _0x1e0d5e=_[_0x34e8('0x29')](db[_0x34e8('0x2a')][_0x34e8('0x2b')],function(_0x5c20db){return{'name':_0x5c20db[_0x34e8('0x2c')],'type':_0x5c20db[_0x34e8('0x2d')]['key']};});_0x6f4428[_0x34e8('0x2e')]=_[_0x34e8('0x29')](_0x1e0d5e,_0x34e8('0x26'));_0x6f4428[_0x34e8('0x2f')]=_[_0x34e8('0x30')](_0x2b445a[_0x34e8('0x2f')]);_0x6f4428[_0x34e8('0x31')]=_[_0x34e8('0x32')](_0x6f4428[_0x34e8('0x2e')],_0x6f4428[_0x34e8('0x2f')]);_0x3f5421[_0x34e8('0x33')]=_[_0x34e8('0x32')](_0x6f4428[_0x34e8('0x2e')],qs[_0x34e8('0x34')](_0x2b445a[_0x34e8('0x2f')][_0x34e8('0x34')]));_0x3f5421[_0x34e8('0x33')]=_0x3f5421['attributes'][_0x34e8('0x35')]?_0x3f5421[_0x34e8('0x33')]:_0x6f4428['model'];if(!_0x2b445a[_0x34e8('0x2f')][_0x34e8('0x36')](_0x34e8('0x37'))){_0x3f5421[_0x34e8('0x1e')]=qs[_0x34e8('0x1e')](_0x2b445a[_0x34e8('0x2f')][_0x34e8('0x1e')]);_0x3f5421['offset']=qs['offset'](_0x2b445a[_0x34e8('0x2f')][_0x34e8('0x1b')]);}_0x3f5421[_0x34e8('0x38')]=qs['sort'](_0x2b445a[_0x34e8('0x2f')][_0x34e8('0x39')]);_0x3f5421[_0x34e8('0x3a')]=qs[_0x34e8('0x31')](_[_0x34e8('0x3b')](_0x2b445a[_0x34e8('0x2f')],_0x6f4428[_0x34e8('0x31')]),_0x1e0d5e);if(_0x2b445a[_0x34e8('0x2f')]['filter']){_0x3f5421[_0x34e8('0x3a')]=_[_0x34e8('0x3c')](_0x3f5421[_0x34e8('0x3a')],{'$or':_['map'](_0x1e0d5e,function(_0x1caf4b){if(_0x1caf4b[_0x34e8('0x2d')]!=='VIRTUAL'){var _0x5d7ff7={};_0x5d7ff7[_0x1caf4b[_0x34e8('0x26')]]={'$like':'%'+_0x2b445a[_0x34e8('0x2f')]['filter']+'%'};return _0x5d7ff7;}})});}_0x3f5421=_[_0x34e8('0x3c')]({},_0x3f5421,_0x2b445a[_0x34e8('0x3d')]);var _0x29fb22={'where':_0x3f5421[_0x34e8('0x3a')]};return db[_0x34e8('0x2a')][_0x34e8('0x1d')](_0x29fb22)[_0x34e8('0x23')](function(_0x1221e2){_0x1df399[_0x34e8('0x1d')]=_0x1221e2;if(_0x2b445a['query']['includeAll']){_0x3f5421[_0x34e8('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x34e8('0x3f')](_0x3f5421);})[_0x34e8('0x23')](function(_0x29d2fb){_0x1df399[_0x34e8('0x40')]=_0x29d2fb;return _0x1df399;})['then'](respondWithFilteredResult(_0x18490b,_0x3f5421))[_0x34e8('0x41')](handleError(_0x18490b,null));};exports[_0x34e8('0x42')]=function(_0x18a158,_0x91a70f){var _0xb00838={'raw':!![],'where':{'id':_0x18a158[_0x34e8('0x43')]['id']}},_0x58b74f={};_0x58b74f['model']=_[_0x34e8('0x30')](db[_0x34e8('0x2a')]['rawAttributes']);_0x58b74f[_0x34e8('0x2f')]=_[_0x34e8('0x30')](_0x18a158[_0x34e8('0x2f')]);_0x58b74f[_0x34e8('0x31')]=_['intersection'](_0x58b74f[_0x34e8('0x2e')],_0x58b74f[_0x34e8('0x2f')]);_0xb00838['attributes']=_['intersection'](_0x58b74f[_0x34e8('0x2e')],qs['fields'](_0x18a158[_0x34e8('0x2f')]['fields']));_0xb00838[_0x34e8('0x33')]=_0xb00838[_0x34e8('0x33')]['length']?_0xb00838[_0x34e8('0x33')]:_0x58b74f['model'];if(_0x18a158[_0x34e8('0x2f')]['includeAll']){_0xb00838[_0x34e8('0x3e')]=[{'all':!![]}];}_0xb00838=_[_0x34e8('0x3c')]({},_0xb00838,_0x18a158[_0x34e8('0x3d')]);return db[_0x34e8('0x2a')][_0x34e8('0x44')](_0xb00838)['then'](handleEntityNotFound(_0x91a70f,null))['then'](respondWithResult(_0x91a70f,null))[_0x34e8('0x41')](handleError(_0x91a70f,null));};exports[_0x34e8('0x45')]=function(_0x49a755,_0x1cc23c){return db[_0x34e8('0x2a')][_0x34e8('0x45')](_0x49a755['body'],{})[_0x34e8('0x23')](respondWithResult(_0x1cc23c,0xc9))[_0x34e8('0x41')](handleError(_0x1cc23c,null));};exports['update']=function(_0x51a814,_0x2de2e9){if(_0x51a814['body']['id']){delete _0x51a814[_0x34e8('0x46')]['id'];}return db[_0x34e8('0x2a')][_0x34e8('0x44')]({'where':{'id':_0x51a814[_0x34e8('0x43')]['id']}})[_0x34e8('0x23')](handleEntityNotFound(_0x2de2e9,null))[_0x34e8('0x23')](saveUpdates(_0x51a814[_0x34e8('0x46')],null))[_0x34e8('0x23')](respondWithResult(_0x2de2e9,null))[_0x34e8('0x41')](handleError(_0x2de2e9,null));};exports['destroy']=function(_0x5a1a1e,_0x345e83){return db[_0x34e8('0x2a')][_0x34e8('0x44')]({'where':{'id':_0x5a1a1e[_0x34e8('0x43')]['id']}})[_0x34e8('0x23')](handleEntityNotFound(_0x345e83,null))[_0x34e8('0x23')](removeEntity(_0x345e83,null))[_0x34e8('0x41')](handleError(_0x345e83,null));};exports[_0x34e8('0x47')]=function(_0x2b70a7,_0x4bf30e){return db['JscriptyAnswerReport'][_0x34e8('0x47')]()[_0x34e8('0x23')](respondWithResult(_0x4bf30e,null))[_0x34e8('0x41')](handleError(_0x4bf30e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index fa2b26f..377ff81 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 _0x3469=['define','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x322296,_0x57eb19){var _0x432ea7=function(_0x4bd2b3){while(--_0x4bd2b3){_0x322296['push'](_0x322296['shift']());}};_0x432ea7(++_0x57eb19);}(_0x3469,0xfd));var _0x9346=function(_0x3752e7,_0x462d8a){_0x3752e7=_0x3752e7-0x0;var _0x6759fc=_0x3469[_0x3752e7];return _0x6759fc;};'use strict';var _=require(_0x9346('0x0'));var util=require(_0x9346('0x1'));var logger=require(_0x9346('0x2'))('api');var moment=require(_0x9346('0x3'));var BPromise=require(_0x9346('0x4'));var rp=require(_0x9346('0x5'));var fs=require('fs');var path=require(_0x9346('0x6'));var rimraf=require(_0x9346('0x7'));var config=require(_0x9346('0x8'));var attributes=require(_0x9346('0x9'));module[_0x9346('0xa')]=function(_0x67836f,_0x3a2351){return _0x67836f[_0x9346('0xb')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x552a=['bluebird','request-promise','path','../../config/environment','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment'];(function(_0x5880f3,_0x252e7c){var _0x4cbc4e=function(_0x15c941){while(--_0x15c941){_0x5880f3['push'](_0x5880f3['shift']());}};_0x4cbc4e(++_0x252e7c);}(_0x552a,0x140));var _0xa552=function(_0x1da496,_0x5e8dcb){_0x1da496=_0x1da496-0x0;var _0x252b54=_0x552a[_0x1da496];return _0x252b54;};'use strict';var _=require(_0xa552('0x0'));var util=require(_0xa552('0x1'));var logger=require(_0xa552('0x2'))('api');var moment=require(_0xa552('0x3'));var BPromise=require(_0xa552('0x4'));var rp=require(_0xa552('0x5'));var fs=require('fs');var path=require(_0xa552('0x6'));var rimraf=require('rimraf');var config=require(_0xa552('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xa552('0x8')]=function(_0x2f6417,_0x5ae7da){return _0x2f6417[_0xa552('0x9')](_0xa552('0xa'),attributes,{'tableName':_0xa552('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index a88d727..0aea379 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 _0x8431=['debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0x4a03a5,_0x385689){var _0x39747d=function(_0x3b30cc){while(--_0x3b30cc){_0x4a03a5['push'](_0x4a03a5['shift']());}};_0x39747d(++_0x385689);}(_0x8431,0x1a7));var _0x1843=function(_0x333191,_0x85fb2c){_0x333191=_0x333191-0x0;var _0x1b671f=_0x8431[_0x333191];return _0x1b671f;};'use strict';var _=require(_0x1843('0x0'));var util=require(_0x1843('0x1'));var moment=require(_0x1843('0x2'));var BPromise=require(_0x1843('0x3'));var rs=require(_0x1843('0x4'));var fs=require('fs');var Redis=require(_0x1843('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1843('0x6'));var logger=require(_0x1843('0x7'))('rpc');var config=require(_0x1843('0x8'));var jayson=require(_0x1843('0x9'));var client=jayson[_0x1843('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a2063,_0x3c5599,_0x5b84a1){return new BPromise(function(_0x208abe,_0x2b9cb5){return client[_0x1843('0xb')](_0x1a2063,_0x5b84a1)['then'](function(_0x54163b){logger[_0x1843('0xc')](_0x1843('0xd'),_0x3c5599,'request\x20sent');logger[_0x1843('0xe')](_0x1843('0xf'),_0x3c5599,_0x1843('0x10'),JSON[_0x1843('0x11')](_0x54163b));if(_0x54163b['error']){if(_0x54163b[_0x1843('0x12')][_0x1843('0x13')]===0x1f4){logger[_0x1843('0x12')](_0x1843('0xd'),_0x3c5599,_0x54163b['error'][_0x1843('0x14')]);return _0x2b9cb5(_0x54163b['error'][_0x1843('0x14')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x3c5599,_0x54163b[_0x1843('0x12')][_0x1843('0x14')]);return _0x208abe(_0x54163b['error']['message']);}else{logger[_0x1843('0xc')](_0x1843('0xd'),_0x3c5599,_0x1843('0x10'));_0x208abe(_0x54163b[_0x1843('0x15')]['message']);}})[_0x1843('0x16')](function(_0x2c2f5a){logger['error'](_0x1843('0xd'),_0x3c5599,_0x2c2f5a);_0x2b9cb5(_0x2c2f5a);});});} \ No newline at end of file +var _0x6b0c=['client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x2398ce,_0x1d0c47){var _0x5941e3=function(_0x145d4f){while(--_0x145d4f){_0x2398ce['push'](_0x2398ce['shift']());}};_0x5941e3(++_0x1d0c47);}(_0x6b0c,0x80));var _0xc6b0=function(_0x4e6f90,_0x146454){_0x4e6f90=_0x4e6f90-0x0;var _0x414961=_0x6b0c[_0x4e6f90];return _0x414961;};'use strict';var _=require(_0xc6b0('0x0'));var util=require(_0xc6b0('0x1'));var moment=require(_0xc6b0('0x2'));var BPromise=require(_0xc6b0('0x3'));var rs=require(_0xc6b0('0x4'));var fs=require('fs');var Redis=require(_0xc6b0('0x5'));var db=require(_0xc6b0('0x6'))['db'];var utils=require(_0xc6b0('0x7'));var logger=require('../../config/logger')(_0xc6b0('0x8'));var config=require('../../config/environment');var jayson=require(_0xc6b0('0x9'));var client=jayson[_0xc6b0('0xa')][_0xc6b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c640f,_0x6a63db,_0x3d29ac){return new BPromise(function(_0x2802ea,_0x3bab58){return client['request'](_0x4c640f,_0x3d29ac)[_0xc6b0('0xc')](function(_0x335cc7){logger[_0xc6b0('0xd')](_0xc6b0('0xe'),_0x6a63db,_0xc6b0('0xf'));logger['debug'](_0xc6b0('0x10'),_0x6a63db,_0xc6b0('0xf'),JSON[_0xc6b0('0x11')](_0x335cc7));if(_0x335cc7[_0xc6b0('0x12')]){if(_0x335cc7['error'][_0xc6b0('0x13')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x6a63db,_0x335cc7['error'][_0xc6b0('0x14')]);return _0x3bab58(_0x335cc7['error'][_0xc6b0('0x14')]);}logger[_0xc6b0('0x12')](_0xc6b0('0xe'),_0x6a63db,_0x335cc7[_0xc6b0('0x12')][_0xc6b0('0x14')]);return _0x2802ea(_0x335cc7[_0xc6b0('0x12')]['message']);}else{logger[_0xc6b0('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x6a63db,_0xc6b0('0xf'));_0x2802ea(_0x335cc7[_0xc6b0('0x15')][_0xc6b0('0x14')]);}})[_0xc6b0('0x16')](function(_0x43b808){logger[_0xc6b0('0x12')](_0xc6b0('0xe'),_0x6a63db,_0x43b808);_0x3bab58(_0x43b808);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index e72ed6e..919983f 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 _0x69f1=['create','/:id/clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post'];(function(_0x393cd1,_0x269f06){var _0x2c8a25=function(_0xca8caa){while(--_0xca8caa){_0x393cd1['push'](_0x393cd1['shift']());}};_0x2c8a25(++_0x269f06);}(_0x69f1,0x18d));var _0x169f=function(_0x343e6a,_0x4b6321){_0x343e6a=_0x343e6a-0x0;var _0x4bbc4b=_0x69f1[_0x343e6a];return _0x4bbc4b;};'use strict';var multer=require(_0x169f('0x0'));var util=require(_0x169f('0x1'));var path=require(_0x169f('0x2'));var timeout=require(_0x169f('0x3'));var express=require(_0x169f('0x4'));var router=express[_0x169f('0x5')]();var fs_extra=require(_0x169f('0x6'));var auth=require(_0x169f('0x7'));var interaction=require(_0x169f('0x8'));var config=require('../../config/environment');var controller=require(_0x169f('0x9'));router[_0x169f('0xa')]('/',auth[_0x169f('0xb')](),controller[_0x169f('0xc')]);router['get'](_0x169f('0xd'),auth[_0x169f('0xb')](),controller[_0x169f('0xe')]);router['get'](_0x169f('0xf'),auth['isAuthenticated'](),controller[_0x169f('0x10')]);router[_0x169f('0xa')](_0x169f('0x11'),auth[_0x169f('0xb')](),controller[_0x169f('0x12')]);router[_0x169f('0xa')](_0x169f('0x13'),auth[_0x169f('0xb')](),timeout(_0x169f('0x14')),controller[_0x169f('0x15')]);router[_0x169f('0x16')]('/',auth[_0x169f('0xb')](),controller[_0x169f('0x17')]);router[_0x169f('0x16')](_0x169f('0x18'),auth['isAuthenticated'](),controller['clone']);router[_0x169f('0x19')](_0x169f('0xd'),auth['isAuthenticated'](),controller[_0x169f('0x1a')]);router[_0x169f('0x1b')](_0x169f('0xd'),auth['isAuthenticated'](),controller[_0x169f('0x1c')]);module[_0x169f('0x1d')]=router; \ No newline at end of file +var _0xbc2e=['multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/sessions','/:id/answers','getAnswers','30s','post','/:id/clone','clone','update','destroy','exports'];(function(_0x518ba6,_0x2f55b3){var _0x319f35=function(_0x44be9a){while(--_0x44be9a){_0x518ba6['push'](_0x518ba6['shift']());}};_0x319f35(++_0x2f55b3);}(_0xbc2e,0x165));var _0xebc2=function(_0x2946d9,_0x16a127){_0x2946d9=_0x2946d9-0x0;var _0x3b2727=_0xbc2e[_0x2946d9];return _0x3b2727;};'use strict';var multer=require(_0xebc2('0x0'));var util=require(_0xebc2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xebc2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xebc2('0x3'));var interaction=require(_0xebc2('0x4'));var config=require(_0xebc2('0x5'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0xebc2('0x6')](),controller[_0xebc2('0x7')]);router[_0xebc2('0x8')](_0xebc2('0x9'),auth['isAuthenticated'](),controller[_0xebc2('0xa')]);router[_0xebc2('0x8')](_0xebc2('0xb'),auth['isAuthenticated'](),controller['getSessions']);router[_0xebc2('0x8')](_0xebc2('0xc'),auth[_0xebc2('0x6')](),controller[_0xebc2('0xd')]);router[_0xebc2('0x8')]('/:id/summary',auth[_0xebc2('0x6')](),timeout(_0xebc2('0xe')),controller['getSummary']);router[_0xebc2('0xf')]('/',auth[_0xebc2('0x6')](),controller['create']);router[_0xebc2('0xf')](_0xebc2('0x10'),auth[_0xebc2('0x6')](),controller[_0xebc2('0x11')]);router['put']('/:id',auth[_0xebc2('0x6')](),controller[_0xebc2('0x12')]);router['delete'](_0xebc2('0x9'),auth[_0xebc2('0x6')](),controller[_0xebc2('0x13')]);module[_0xebc2('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 4c7908f..22f7481 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 _0xa874=['name','TEXT','long','isObjectLike','setDataValue','stringify','formData','format','getDataValue','description','BOOLEAN','sequelize','lodash','exports'];(function(_0x5e5218,_0x4226ef){var _0x2dcd35=function(_0x11049f){while(--_0x11049f){_0x5e5218['push'](_0x5e5218['shift']());}};_0x2dcd35(++_0x4226ef);}(_0xa874,0x6d));var _0x4a87=function(_0x39eb5c,_0x1665bb){_0x39eb5c=_0x39eb5c-0x0;var _0x605ca=_0xa874[_0x39eb5c];return _0x605ca;};'use strict';var Sequelize=require(_0x4a87('0x0'));var _=require(_0x4a87('0x1'));var util=require('util');module[_0x4a87('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x4a87('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x4a87('0x4')](_0x4a87('0x5')),'set':function(_0x5690e3){if(_[_0x4a87('0x6')](_0x5690e3)){this[_0x4a87('0x7')]('formData',JSON[_0x4a87('0x8')](_0x5690e3));}else if(_['isString'](_0x5690e3)){this[_0x4a87('0x7')](_0x4a87('0x9'),_0x5690e3);}else{this[_0x4a87('0x7')](_0x4a87('0x9'),util[_0x4a87('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x4a87('0xb')]('name')||'',this[_0x4a87('0xb')](_0x4a87('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x4a87('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x4a87('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xb028=['description','sequelize','lodash','exports','name','STRING','TEXT','long','isObjectLike','formData','isString','setDataValue','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x35d239,_0x234a02){var _0x42f8fe=function(_0x17e9de){while(--_0x17e9de){_0x35d239['push'](_0x35d239['shift']());}};_0x42f8fe(++_0x234a02);}(_0xb028,0x1b3));var _0x8b02=function(_0x1741ba,_0x33116f){_0x1741ba=_0x1741ba-0x0;var _0x2a3110=_0xb028[_0x1741ba];return _0x2a3110;};'use strict';var Sequelize=require(_0x8b02('0x0'));var _=require(_0x8b02('0x1'));var util=require('util');module[_0x8b02('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x8b02('0x3')},'description':{'type':Sequelize[_0x8b02('0x4')]},'formData':{'type':Sequelize[_0x8b02('0x5')](_0x8b02('0x6')),'set':function(_0x450d82){if(_[_0x8b02('0x7')](_0x450d82)){this['setDataValue'](_0x8b02('0x8'),JSON['stringify'](_0x450d82));}else if(_[_0x8b02('0x9')](_0x450d82)){this[_0x8b02('0xa')]('formData',_0x450d82);}else{this['setDataValue'](_0x8b02('0x8'),util['format'](_0x8b02('0xb'),this[_0x8b02('0xc')]('name')||'',this[_0x8b02('0xc')](_0x8b02('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 762d37d..dec81de 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 _0x3aa2=['name','send','index','map','JscriptyProject','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','findAll','rows','params','rawAttributes','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','count','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','text/csv','download','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','update','then','destroy','Projects','UserProfileResource','error','stack'];(function(_0x89da48,_0x12f96c){var _0x5f4c9a=function(_0x2a9019){while(--_0x2a9019){_0x89da48['push'](_0x89da48['shift']());}};_0x5f4c9a(++_0x12f96c);}(_0x3aa2,0x13b));var _0x23aa=function(_0x51f84a,_0x445f17){_0x51f84a=_0x51f84a-0x0;var _0x4ba63d=_0x3aa2[_0x51f84a];return _0x4ba63d;};'use strict';var emlformat=require(_0x23aa('0x0'));var rimraf=require(_0x23aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x23aa('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x23aa('0x3'));var Mustache=require(_0x23aa('0x4'));var util=require('util');var path=require(_0x23aa('0x5'));var sox=require('sox');var csv=require(_0x23aa('0x6'));var ejs=require(_0x23aa('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x23aa('0x8'));var squel=require(_0x23aa('0x9'));var crypto=require(_0x23aa('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x23aa('0xb'));var toCsv=require(_0x23aa('0x6'));var querystring=require(_0x23aa('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x23aa('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x23aa('0xe'));var hardwareService=require(_0x23aa('0xf'));var logger=require(_0x23aa('0x10'))(_0x23aa('0x11'));var utils=require(_0x23aa('0x12'));var config=require(_0x23aa('0x13'));var licenseUtil=require(_0x23aa('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fdd70,_0x4f9c72){_0x4f9c72=_0x4f9c72||0xcc;return function(_0x1f71ef){if(_0x1f71ef){return _0x4fdd70[_0x23aa('0x15')](_0x4f9c72);}return _0x4fdd70[_0x23aa('0x16')](_0x4f9c72)[_0x23aa('0x17')]();};}function respondWithResult(_0xeab146,_0x284fab){_0x284fab=_0x284fab||0xc8;return function(_0x1e2f6e){if(_0x1e2f6e){return _0xeab146[_0x23aa('0x16')](_0x284fab)['json'](_0x1e2f6e);}};}function respondWithFilteredResult(_0x3df6e1,_0x4d83ca){return function(_0x5dacbe){if(_0x5dacbe){var _0x3cbbde=typeof _0x4d83ca[_0x23aa('0x18')]===_0x23aa('0x19')&&typeof _0x4d83ca[_0x23aa('0x1a')]===_0x23aa('0x19');var _0x34e977=_0x5dacbe['count'];var _0x2a2628=_0x3cbbde?0x0:_0x4d83ca[_0x23aa('0x18')];var _0x4ff449=_0x3cbbde?_0x5dacbe['count']:_0x4d83ca['offset']+_0x4d83ca['limit'];var _0x443933;if(_0x4ff449>=_0x34e977){_0x4ff449=_0x34e977;_0x443933=0xc8;}else{_0x443933=0xce;}_0x3df6e1[_0x23aa('0x16')](_0x443933);return _0x3df6e1[_0x23aa('0x1b')]('Content-Range',_0x2a2628+'-'+_0x4ff449+'/'+_0x34e977)[_0x23aa('0x1c')](_0x5dacbe);}return null;};}function patchUpdates(_0x140c66){return function(_0x550e1c){try{jsonpatch[_0x23aa('0x1d')](_0x550e1c,_0x140c66,!![]);}catch(_0x1f066f){return BPromise[_0x23aa('0x1e')](_0x1f066f);}return _0x550e1c[_0x23aa('0x1f')]();};}function saveUpdates(_0x106bde,_0x2a272f){return function(_0x474081){if(_0x474081){return _0x474081[_0x23aa('0x20')](_0x106bde)[_0x23aa('0x21')](function(_0x559af5){return _0x559af5;});}return null;};}function removeEntity(_0x319277,_0x3c79ce){return function(_0x2c76f4){if(_0x2c76f4){return _0x2c76f4[_0x23aa('0x22')]()['then'](function(){var _0x23771b=_0x2c76f4['get']({'plain':!![]});var _0x44b337=_0x23aa('0x23');return db[_0x23aa('0x24')]['destroy']({'where':{'type':_0x44b337,'resourceId':_0x23771b['id']}})[_0x23aa('0x21')](function(){return _0x2c76f4;});})[_0x23aa('0x21')](function(){_0x319277[_0x23aa('0x16')](0xcc)[_0x23aa('0x17')]();});}};}function handleEntityNotFound(_0x593354,_0x53ac30){return function(_0x492f0b){if(!_0x492f0b){_0x593354[_0x23aa('0x15')](0x194);}return _0x492f0b;};}function handleError(_0x2db1a0,_0x1fd4f1){_0x1fd4f1=_0x1fd4f1||0x1f4;return function(_0x7139ef){logger[_0x23aa('0x25')](_0x7139ef[_0x23aa('0x26')]);if(_0x7139ef[_0x23aa('0x27')]){delete _0x7139ef[_0x23aa('0x27')];}_0x2db1a0[_0x23aa('0x16')](_0x1fd4f1)[_0x23aa('0x28')](_0x7139ef);};}exports[_0x23aa('0x29')]=function(_0x379d64,_0x3a0231){var _0x577e54={},_0x5a21e1={},_0x496e0e={'count':0x0,'rows':[]};var _0x277811=_[_0x23aa('0x2a')](db[_0x23aa('0x2b')]['rawAttributes'],function(_0x5cc9c0){return{'name':_0x5cc9c0[_0x23aa('0x2c')],'type':_0x5cc9c0[_0x23aa('0x2d')][_0x23aa('0x2e')]};});_0x5a21e1['model']=_[_0x23aa('0x2a')](_0x277811,_0x23aa('0x27'));_0x5a21e1['query']=_[_0x23aa('0x2f')](_0x379d64[_0x23aa('0x30')]);_0x5a21e1['filters']=_[_0x23aa('0x31')](_0x5a21e1[_0x23aa('0x32')],_0x5a21e1['query']);_0x577e54[_0x23aa('0x33')]=_[_0x23aa('0x31')](_0x5a21e1[_0x23aa('0x32')],qs[_0x23aa('0x34')](_0x379d64[_0x23aa('0x30')][_0x23aa('0x34')]));_0x577e54[_0x23aa('0x33')]=_0x577e54['attributes'][_0x23aa('0x35')]?_0x577e54[_0x23aa('0x33')]:_0x5a21e1[_0x23aa('0x32')];if(!_0x379d64['query']['hasOwnProperty'](_0x23aa('0x36'))){_0x577e54[_0x23aa('0x1a')]=qs[_0x23aa('0x1a')](_0x379d64['query'][_0x23aa('0x1a')]);_0x577e54[_0x23aa('0x18')]=qs[_0x23aa('0x18')](_0x379d64[_0x23aa('0x30')][_0x23aa('0x18')]);}_0x577e54[_0x23aa('0x37')]=qs[_0x23aa('0x38')](_0x379d64[_0x23aa('0x30')][_0x23aa('0x38')]);_0x577e54[_0x23aa('0x39')]=qs[_0x23aa('0x3a')](_[_0x23aa('0x3b')](_0x379d64['query'],_0x5a21e1['filters']),_0x277811);if(_0x379d64[_0x23aa('0x30')]['filter']){_0x577e54['where']=_[_0x23aa('0x3c')](_0x577e54['where'],{'$or':_[_0x23aa('0x2a')](_0x277811,function(_0x2de69f){if(_0x2de69f[_0x23aa('0x2d')]!=='VIRTUAL'){var _0x360c46={};_0x360c46[_0x2de69f[_0x23aa('0x27')]]={'$like':'%'+_0x379d64[_0x23aa('0x30')][_0x23aa('0x3d')]+'%'};return _0x360c46;}})});}_0x577e54=_[_0x23aa('0x3c')]({},_0x577e54,_0x379d64[_0x23aa('0x3e')]);var _0x20b565={'where':_0x577e54['where']};return db[_0x23aa('0x2b')]['count'](_0x20b565)[_0x23aa('0x21')](function(_0x562573){_0x496e0e['count']=_0x562573;if(_0x379d64['query'][_0x23aa('0x3f')]){_0x577e54['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x23aa('0x40')](_0x577e54);})[_0x23aa('0x21')](function(_0x373353){_0x496e0e[_0x23aa('0x41')]=_0x373353;return _0x496e0e;})[_0x23aa('0x21')](respondWithFilteredResult(_0x3a0231,_0x577e54))['catch'](handleError(_0x3a0231,null));};exports['show']=function(_0x2d0548,_0x3a47dd){var _0x443671={'raw':![],'where':{'id':_0x2d0548[_0x23aa('0x42')]['id']}},_0x490c3e={};_0x490c3e['model']=_[_0x23aa('0x2f')](db[_0x23aa('0x2b')][_0x23aa('0x43')]);_0x490c3e['query']=_[_0x23aa('0x2f')](_0x2d0548[_0x23aa('0x30')]);_0x490c3e['filters']=_[_0x23aa('0x31')](_0x490c3e['model'],_0x490c3e[_0x23aa('0x30')]);_0x443671[_0x23aa('0x33')]=_[_0x23aa('0x31')](_0x490c3e[_0x23aa('0x32')],qs[_0x23aa('0x34')](_0x2d0548['query'][_0x23aa('0x34')]));_0x443671[_0x23aa('0x33')]=_0x443671['attributes'][_0x23aa('0x35')]?_0x443671[_0x23aa('0x33')]:_0x490c3e[_0x23aa('0x32')];if(_0x2d0548['query'][_0x23aa('0x3f')]){_0x443671['include']=[{'all':!![]}];}_0x443671=_[_0x23aa('0x3c')]({},_0x443671,_0x2d0548[_0x23aa('0x3e')]);return db[_0x23aa('0x2b')][_0x23aa('0x44')](_0x443671)[_0x23aa('0x21')](handleEntityNotFound(_0x3a47dd,null))['then'](respondWithResult(_0x3a47dd,null))[_0x23aa('0x45')](handleError(_0x3a47dd,null));};exports[_0x23aa('0x46')]=function(_0x5a6653,_0x7ab87f){return db[_0x23aa('0x2b')][_0x23aa('0x46')](_0x5a6653[_0x23aa('0x47')],{})[_0x23aa('0x21')](function(_0x572b42){var _0x13b8bd=_0x5a6653[_0x23aa('0x48')][_0x23aa('0x49')]({'plain':!![]});if(!_0x13b8bd)throw new Error(_0x23aa('0x4a'));if(_0x13b8bd[_0x23aa('0x4b')]===_0x23aa('0x48')){var _0x318fb3=_0x572b42[_0x23aa('0x49')]({'plain':!![]});var _0x5df566=_0x23aa('0x23');return db[_0x23aa('0x4c')][_0x23aa('0x44')]({'where':{'name':_0x5df566,'userProfileId':_0x13b8bd[_0x23aa('0x4d')]},'raw':!![]})['then'](function(_0x1d72bd){if(_0x1d72bd&&_0x1d72bd[_0x23aa('0x4e')]===0x0){return db[_0x23aa('0x24')][_0x23aa('0x46')]({'name':_0x318fb3['name'],'resourceId':_0x318fb3['id'],'type':_0x1d72bd['name'],'sectionId':_0x1d72bd['id']},{})[_0x23aa('0x21')](function(){return _0x572b42;});}else{return _0x572b42;}})[_0x23aa('0x45')](function(_0x3a9c00){logger[_0x23aa('0x25')](_0x23aa('0x4f'),_0x3a9c00);throw _0x3a9c00;});}return _0x572b42;})[_0x23aa('0x21')](respondWithResult(_0x7ab87f,0xc9))[_0x23aa('0x45')](handleError(_0x7ab87f,null));};exports[_0x23aa('0x50')]=function(_0x286d31,_0xc50546){var _0x1f34d0={'where':{'id':_0x286d31[_0x23aa('0x42')]['id']}},_0x243634={};_0x243634[_0x23aa('0x32')]=_[_0x23aa('0x2f')](db['JscriptyProject'][_0x23aa('0x43')]);_0x1f34d0[_0x23aa('0x33')]=_[_0x23aa('0x31')](_0x243634[_0x23aa('0x32')],qs[_0x23aa('0x34')](_0x286d31[_0x23aa('0x30')][_0x23aa('0x34')]));_0x1f34d0['attributes']=_0x1f34d0[_0x23aa('0x33')][_0x23aa('0x35')]?_0x1f34d0['attributes']:_0x243634[_0x23aa('0x32')];if(_0x286d31[_0x23aa('0x30')][_0x23aa('0x3f')]){_0x1f34d0[_0x23aa('0x51')]=[{'all':!![]}];}_0x1f34d0=_[_0x23aa('0x3c')]({},_0x1f34d0,_0x286d31[_0x23aa('0x3e')]);return db['JscriptyProject'][_0x23aa('0x44')](_0x1f34d0)[_0x23aa('0x21')](handleEntityNotFound(_0xc50546,null))[_0x23aa('0x21')](function(_0x3236be){if(_0x3236be){var _0x55a9f8=_0x3236be[_0x23aa('0x49')]({'plain':!![]});_0x55a9f8=qs[_0x23aa('0x52')](_0x55a9f8,['id',_0x23aa('0x53'),_0x23aa('0x54')]);_0x286d31[_0x23aa('0x47')]=_[_0x23aa('0x52')](_0x286d31[_0x23aa('0x47')],['id',_0x23aa('0x53'),_0x23aa('0x54')]);return db[_0x23aa('0x2b')][_0x23aa('0x46')](_[_0x23aa('0x3c')](_0x55a9f8,_0x286d31['body']),{'include':_0x286d31[_0x23aa('0x30')][_0x23aa('0x3f')]?[{'all':!![]}]:undefined})['then'](function(_0x840948){var _0x5811ed=_0x286d31[_0x23aa('0x48')]['get']({'plain':!![]});if(!_0x5811ed)throw new Error(_0x23aa('0x4a'));if(_0x5811ed[_0x23aa('0x4b')]===_0x23aa('0x48')){var _0x2e4d4e=_0x840948[_0x23aa('0x49')]({'plain':!![]});var _0xe5a61='Projects';return db[_0x23aa('0x4c')]['find']({'where':{'name':_0xe5a61,'userProfileId':_0x5811ed[_0x23aa('0x4d')]},'raw':!![]})[_0x23aa('0x21')](function(_0x4c71f0){if(_0x4c71f0&&_0x4c71f0[_0x23aa('0x4e')]===0x0){return db[_0x23aa('0x24')][_0x23aa('0x46')]({'name':_0x2e4d4e[_0x23aa('0x27')],'resourceId':_0x2e4d4e['id'],'type':_0x4c71f0['name'],'sectionId':_0x4c71f0['id']},{})[_0x23aa('0x21')](function(){return _0x840948;});}else{return _0x840948;}})[_0x23aa('0x45')](function(_0x13c3ce){logger[_0x23aa('0x25')](_0x23aa('0x4f'),_0x13c3ce);throw _0x13c3ce;});}return _0x840948;});}})['then'](respondWithResult(_0xc50546,0xc9))[_0x23aa('0x45')](handleError(_0xc50546,null));};exports['update']=function(_0x3a3ff4,_0x3f5c0c){if(_0x3a3ff4['body']['id']){delete _0x3a3ff4[_0x23aa('0x47')]['id'];}return db[_0x23aa('0x2b')][_0x23aa('0x44')]({'where':{'id':_0x3a3ff4[_0x23aa('0x42')]['id']}})[_0x23aa('0x21')](handleEntityNotFound(_0x3f5c0c,null))[_0x23aa('0x21')](saveUpdates(_0x3a3ff4[_0x23aa('0x47')],null))['then'](respondWithResult(_0x3f5c0c,null))[_0x23aa('0x45')](handleError(_0x3f5c0c,null));};exports[_0x23aa('0x22')]=function(_0x356fb5,_0x3d6162){return db[_0x23aa('0x2b')][_0x23aa('0x44')]({'where':{'id':_0x356fb5[_0x23aa('0x42')]['id']}})[_0x23aa('0x21')](handleEntityNotFound(_0x3d6162,null))[_0x23aa('0x21')](removeEntity(_0x3d6162,null))[_0x23aa('0x45')](handleError(_0x3d6162,null));};exports[_0x23aa('0x55')]=function(_0xba80a4,_0x473dd2,_0x426257){var _0x4b7004={'raw':!![],'where':{}};var _0x52ca5b={};var _0x5d2a66={'count':0x0,'rows':[]};return db[_0x23aa('0x2b')][_0x23aa('0x56')]({'where':{'id':_0xba80a4[_0x23aa('0x42')]['id']}})['then'](handleEntityNotFound(_0x473dd2,null))[_0x23aa('0x21')](function(_0x426e52){if(_0x426e52){_0x52ca5b['model']=_[_0x23aa('0x2f')](db[_0x23aa('0x57')][_0x23aa('0x43')]);_0x52ca5b[_0x23aa('0x30')]=_[_0x23aa('0x2f')](_0xba80a4[_0x23aa('0x30')]);_0x52ca5b[_0x23aa('0x3a')]=_[_0x23aa('0x31')](_0x52ca5b['model'],_0x52ca5b[_0x23aa('0x30')]);_0x4b7004[_0x23aa('0x33')]=_[_0x23aa('0x31')](_0x52ca5b['model'],qs[_0x23aa('0x34')](_0xba80a4[_0x23aa('0x30')][_0x23aa('0x34')]));_0x4b7004['attributes']=_0x4b7004[_0x23aa('0x33')][_0x23aa('0x35')]?_0x4b7004[_0x23aa('0x33')]:_0x52ca5b[_0x23aa('0x32')];if(!_0xba80a4[_0x23aa('0x30')][_0x23aa('0x58')]('nolimit')){_0x4b7004['limit']=qs['limit'](_0xba80a4[_0x23aa('0x30')][_0x23aa('0x1a')]);_0x4b7004[_0x23aa('0x18')]=qs[_0x23aa('0x18')](_0xba80a4[_0x23aa('0x30')]['offset']);}_0x4b7004['order']=qs[_0x23aa('0x38')](_0xba80a4[_0x23aa('0x30')]['sort']);_0x4b7004[_0x23aa('0x39')]=qs[_0x23aa('0x3a')](_['pick'](_0xba80a4[_0x23aa('0x30')],_0x52ca5b[_0x23aa('0x3a')]));_0x4b7004['where'][_0x23aa('0x59')]=_0x426e52['id'];if(_0xba80a4[_0x23aa('0x30')][_0x23aa('0x3d')]){_0x4b7004[_0x23aa('0x39')]=_[_0x23aa('0x3c')](_0x4b7004[_0x23aa('0x39')],{'$or':_[_0x23aa('0x2a')](_0x4b7004[_0x23aa('0x33')],function(_0x250ee6){var _0x47a81c={};_0x47a81c[_0x250ee6]={'$like':'%'+_0xba80a4[_0x23aa('0x30')][_0x23aa('0x3d')]+'%'};return _0x47a81c;})});}_0x4b7004=_[_0x23aa('0x3c')]({},_0x4b7004,_0xba80a4['options']);return db[_0x23aa('0x57')]['count']({'where':_0x4b7004[_0x23aa('0x39')]})[_0x23aa('0x21')](function(_0x5a1bc0){_0x5d2a66[_0x23aa('0x5a')]=_0x5a1bc0;if(_0xba80a4['query'][_0x23aa('0x3f')]){_0x4b7004[_0x23aa('0x51')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x23aa('0x40')](_0x4b7004);})['then'](function(_0x31fbcb){_0x5d2a66[_0x23aa('0x41')]=_0x31fbcb;return _0x5d2a66;});}})[_0x23aa('0x21')](respondWithFilteredResult(_0x473dd2,_0x4b7004))['catch'](handleError(_0x473dd2,null));};exports[_0x23aa('0x5b')]=function(_0xca3309,_0x1878c3,_0x32fa39){var _0x140aa7={'raw':!![],'where':{}};var _0x4b9128={};var _0x546f5c={'count':0x0,'rows':[]};return db[_0x23aa('0x2b')][_0x23aa('0x56')]({'where':{'id':_0xca3309['params']['id']}})[_0x23aa('0x21')](handleEntityNotFound(_0x1878c3,null))['then'](function(_0x4a17ce){if(_0x4a17ce){_0x4b9128['model']=_[_0x23aa('0x2f')](db[_0x23aa('0x5c')][_0x23aa('0x43')]);_0x4b9128[_0x23aa('0x30')]=_[_0x23aa('0x2f')](_0xca3309[_0x23aa('0x30')]);_0x4b9128[_0x23aa('0x3a')]=_[_0x23aa('0x31')](_0x4b9128[_0x23aa('0x32')],_0x4b9128[_0x23aa('0x30')]);_0x140aa7[_0x23aa('0x33')]=_[_0x23aa('0x31')](_0x4b9128[_0x23aa('0x32')],qs[_0x23aa('0x34')](_0xca3309[_0x23aa('0x30')][_0x23aa('0x34')]));_0x140aa7[_0x23aa('0x33')]=_0x140aa7[_0x23aa('0x33')]['length']?_0x140aa7[_0x23aa('0x33')]:_0x4b9128[_0x23aa('0x32')];if(!_0xca3309[_0x23aa('0x30')]['hasOwnProperty'](_0x23aa('0x36'))){_0x140aa7['limit']=qs['limit'](_0xca3309[_0x23aa('0x30')][_0x23aa('0x1a')]);_0x140aa7['offset']=qs[_0x23aa('0x18')](_0xca3309[_0x23aa('0x30')][_0x23aa('0x18')]);}_0x140aa7[_0x23aa('0x37')]=qs[_0x23aa('0x38')](_0xca3309[_0x23aa('0x30')]['sort']);_0x140aa7[_0x23aa('0x39')]=qs[_0x23aa('0x3a')](_['pick'](_0xca3309['query'],_0x4b9128[_0x23aa('0x3a')]));_0x140aa7[_0x23aa('0x39')][_0x23aa('0x59')]=_0x4a17ce['id'];if(_0xca3309[_0x23aa('0x30')][_0x23aa('0x3d')]){_0x140aa7['where']=_[_0x23aa('0x3c')](_0x140aa7[_0x23aa('0x39')],{'$or':_[_0x23aa('0x2a')](_0x140aa7[_0x23aa('0x33')],function(_0x246783){var _0x11e1bf={};_0x11e1bf[_0x246783]={'$like':'%'+_0xca3309[_0x23aa('0x30')][_0x23aa('0x3d')]+'%'};return _0x11e1bf;})});}_0x140aa7=_[_0x23aa('0x3c')]({},_0x140aa7,_0xca3309[_0x23aa('0x3e')]);return db[_0x23aa('0x5c')]['count']({'where':_0x140aa7[_0x23aa('0x39')]})[_0x23aa('0x21')](function(_0x241c05){_0x546f5c[_0x23aa('0x5a')]=_0x241c05;if(_0xca3309['query'][_0x23aa('0x3f')]){_0x140aa7['include']=[{'all':!![]}];}return db[_0x23aa('0x5c')][_0x23aa('0x40')](_0x140aa7);})[_0x23aa('0x21')](function(_0x12f8cc){_0x546f5c[_0x23aa('0x41')]=_0x12f8cc;return _0x546f5c;});}})[_0x23aa('0x21')](respondWithFilteredResult(_0x1878c3,_0x140aa7))['catch'](handleError(_0x1878c3,null));};function char(_0x3432c9){return _0x23aa('0x5d')===typeof _0x3432c9?String[_0x23aa('0x5e')]['apply'](null,arguments):_0x3432c9;}function needsEncapsulation(_0x218e3f){return!!_0x218e3f&&(_0x218e3f[_0x23aa('0x5f')]()['indexOf'](char(0xd))>=0x0||_0x218e3f[_0x23aa('0x5f')]()['indexOf'](char(0xa))>=0x0||_0x218e3f[_0x23aa('0x5f')]()[_0x23aa('0x60')](char(0x2c))>=0x0||_0x218e3f[_0x23aa('0x5f')]()[_0x23aa('0x60')](char(0x22))>=0x0);}function encapsulate(_0x5ac449){var _0x562c4b=char(0x22),_0x31786c='\x5c'+char(0x22),_0x35cf19=_0x5ac449[_0x23aa('0x5f')]()[_0x23aa('0x61')](new RegExp(_0x562c4b,'g'),_0x31786c);return _0x562c4b+_0x35cf19+_0x562c4b;}exports[_0x23aa('0x62')]=function(_0x100d1c,_0x760653,_0x3b0e30){var _0xb1a65e,_0x4f62b0;var _0x5ae573={'where':{'ProjectId':_0x100d1c['params']['id']}};if(_0x100d1c[_0x23aa('0x30')][_0x23aa('0x63')]){_0x5ae573[_0x23aa('0x39')][_0x23aa('0x64')]=JSON[_0x23aa('0x65')](_0x100d1c[_0x23aa('0x30')][_0x23aa('0x63')]);}return db[_0x23aa('0x57')][_0x23aa('0x40')](_0x5ae573)['then'](handleEntityNotFound(_0x760653,null))[_0x23aa('0x21')](function(_0x144272){if(_0x144272){_0xb1a65e=_0x144272;return db['JscriptyQuestionReport'][_0x23aa('0x40')]({'where':{'SessionId':{'$in':_[_0x23aa('0x2a')](_0xb1a65e,'id')},'ProjectId':_0x100d1c[_0x23aa('0x42')]['id']},'order':_0x23aa('0x66')});}})[_0x23aa('0x21')](handleEntityNotFound(_0x760653,null))[_0x23aa('0x21')](function(_0x1a705f){if(_0x1a705f){_0x4f62b0=_0x1a705f;var _0xfe136e={};for(var _0x2d5653=0x0,_0x1ff17d=_0x4f62b0['length'];_0x2d5653<_0x1ff17d;_0x2d5653++){if(!_0xfe136e['hasOwnProperty'](_0x4f62b0[_0x2d5653]['questionId'])){_0xfe136e[_0x4f62b0[_0x2d5653][_0x23aa('0x67')]]=needsEncapsulation(_0x4f62b0[_0x2d5653][_0x23aa('0x68')])?encapsulate(_0x4f62b0[_0x2d5653][_0x23aa('0x68')]):_0x4f62b0[_0x2d5653]['question'];}}var _0x5d44d8=[],_0x38b324={};for(var _0x4ebf65=0x0,_0x45f40c=_0xb1a65e[_0x23aa('0x35')];_0x4ebf65<_0x45f40c;_0x4ebf65++){_0x38b324={'ProjectId':_0x100d1c[_0x23aa('0x42')]['id'],'SessionId':_0xb1a65e[_0x4ebf65]['id'],'StartTime':moment(_0xb1a65e[_0x4ebf65][_0x23aa('0x64')])[_0x23aa('0x69')](_0x23aa('0x6a'))};for(var _0x542b08=0x0,_0x56d87c=_0x4f62b0[_0x23aa('0x35')];_0x542b08<_0x56d87c;_0x542b08++){if(_0x4f62b0[_0x542b08]['SessionId']==_0xb1a65e[_0x4ebf65]['id']&&_0xfe136e[_0x23aa('0x58')](_0x4f62b0[_0x542b08][_0x23aa('0x67')])){_0x38b324[_0xfe136e[_0x4f62b0[_0x542b08]['questionId']]]=_0x4f62b0[_0x542b08][_0x23aa('0x6b')];}}for(var _0x5ca828 in _0xfe136e){if(!_0x38b324[_0x23aa('0x58')](_0xfe136e[_0x5ca828])){_0x38b324[_0xfe136e[_0x5ca828]]=null;}}_0x5d44d8[_0x23aa('0x6c')](_0x38b324);}return _0x5d44d8;}})[_0x23aa('0x21')](function(_0x37dae8){if(!_[_0x23aa('0x6d')](_0x37dae8)){var _0x47c579=toCsv(_0x37dae8);var _0x4367fc=Date[_0x23aa('0x6e')]();fs[_0x23aa('0x6f')](util[_0x23aa('0x69')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x100d1c[_0x23aa('0x42')]['id'],_0x4367fc),_0x47c579);_0x760653['setHeader'](_0x23aa('0x70'),_0x23aa('0x71')+util[_0x23aa('0x69')](_0x23aa('0x72'),_0x100d1c[_0x23aa('0x42')]['id'],_0x4367fc));_0x760653[_0x23aa('0x73')]('Content-type',_0x23aa('0x74'));return _0x760653[_0x23aa('0x75')](util[_0x23aa('0x69')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x100d1c['params']['id'],_0x4367fc));}else{return _0x760653[_0x23aa('0x15')](0xcc);}})[_0x23aa('0x45')](handleError(_0x760653,null));}; \ No newline at end of file +var _0x1c7c=['moment','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','JscriptyProject','includeAll','include','findAll','rows','catch','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','user','role','getSessions','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push','now','writeFileSync','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c7c,0x164));var _0xc1c7=function(_0x469889,_0x2212b3){_0x469889=_0x469889-0x0;var _0x561030=_0x1c7c[_0x469889];return _0x561030;};'use strict';var emlformat=require(_0xc1c7('0x0'));var rimraf=require(_0xc1c7('0x1'));var zipdir=require(_0xc1c7('0x2'));var jsonpatch=require(_0xc1c7('0x3'));var rp=require('request-promise');var moment=require(_0xc1c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1c7('0x5'));var util=require(_0xc1c7('0x6'));var path=require(_0xc1c7('0x7'));var sox=require(_0xc1c7('0x8'));var csv=require(_0xc1c7('0x9'));var ejs=require(_0xc1c7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1c7('0xb'));var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0x9'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];function respondWithStatusCode(_0x44bf88,_0x376cab){_0x376cab=_0x376cab||0xcc;return function(_0x35feaa){if(_0x35feaa){return _0x44bf88[_0xc1c7('0x1b')](_0x376cab);}return _0x44bf88[_0xc1c7('0x1c')](_0x376cab)[_0xc1c7('0x1d')]();};}function respondWithResult(_0x1b57ab,_0xdfc7d9){_0xdfc7d9=_0xdfc7d9||0xc8;return function(_0x1b6905){if(_0x1b6905){return _0x1b57ab[_0xc1c7('0x1c')](_0xdfc7d9)[_0xc1c7('0x1e')](_0x1b6905);}};}function respondWithFilteredResult(_0x49576d,_0x3e1f0e){return function(_0x335600){if(_0x335600){var _0x21911c=typeof _0x3e1f0e['offset']===_0xc1c7('0x1f')&&typeof _0x3e1f0e[_0xc1c7('0x20')]===_0xc1c7('0x1f');var _0x39ac54=_0x335600[_0xc1c7('0x21')];var _0xb42702=_0x21911c?0x0:_0x3e1f0e[_0xc1c7('0x22')];var _0x2e93e5=_0x21911c?_0x335600['count']:_0x3e1f0e[_0xc1c7('0x22')]+_0x3e1f0e[_0xc1c7('0x20')];var _0x3ec66a;if(_0x2e93e5>=_0x39ac54){_0x2e93e5=_0x39ac54;_0x3ec66a=0xc8;}else{_0x3ec66a=0xce;}_0x49576d[_0xc1c7('0x1c')](_0x3ec66a);return _0x49576d['set'](_0xc1c7('0x23'),_0xb42702+'-'+_0x2e93e5+'/'+_0x39ac54)['json'](_0x335600);}return null;};}function patchUpdates(_0x5e7e4a){return function(_0x195c5f){try{jsonpatch['apply'](_0x195c5f,_0x5e7e4a,!![]);}catch(_0x5846f0){return BPromise[_0xc1c7('0x24')](_0x5846f0);}return _0x195c5f[_0xc1c7('0x25')]();};}function saveUpdates(_0x2f1b87,_0x4c6b34){return function(_0x813853){if(_0x813853){return _0x813853[_0xc1c7('0x26')](_0x2f1b87)[_0xc1c7('0x27')](function(_0x31a0e0){return _0x31a0e0;});}return null;};}function removeEntity(_0x2e64c4,_0x3a2483){return function(_0x3180fd){if(_0x3180fd){return _0x3180fd[_0xc1c7('0x28')]()[_0xc1c7('0x27')](function(){var _0x1540c1=_0x3180fd[_0xc1c7('0x29')]({'plain':!![]});var _0x363fbc=_0xc1c7('0x2a');return db[_0xc1c7('0x2b')][_0xc1c7('0x28')]({'where':{'type':_0x363fbc,'resourceId':_0x1540c1['id']}})[_0xc1c7('0x27')](function(){return _0x3180fd;});})['then'](function(){_0x2e64c4[_0xc1c7('0x1c')](0xcc)[_0xc1c7('0x1d')]();});}};}function handleEntityNotFound(_0x4e1721,_0x52a1d5){return function(_0x352f24){if(!_0x352f24){_0x4e1721['sendStatus'](0x194);}return _0x352f24;};}function handleError(_0x544fbb,_0x541f12){_0x541f12=_0x541f12||0x1f4;return function(_0x1b873c){logger[_0xc1c7('0x2c')](_0x1b873c[_0xc1c7('0x2d')]);if(_0x1b873c[_0xc1c7('0x2e')]){delete _0x1b873c['name'];}_0x544fbb['status'](_0x541f12)[_0xc1c7('0x2f')](_0x1b873c);};}exports[_0xc1c7('0x30')]=function(_0x9a0ab3,_0x3a786f){var _0x2e35f1={},_0x4968b0={},_0x50042f={'count':0x0,'rows':[]};var _0x125920=_[_0xc1c7('0x31')](db['JscriptyProject'][_0xc1c7('0x32')],function(_0x3cf425){return{'name':_0x3cf425[_0xc1c7('0x33')],'type':_0x3cf425[_0xc1c7('0x34')][_0xc1c7('0x35')]};});_0x4968b0[_0xc1c7('0x36')]=_[_0xc1c7('0x31')](_0x125920,'name');_0x4968b0[_0xc1c7('0x37')]=_[_0xc1c7('0x38')](_0x9a0ab3[_0xc1c7('0x37')]);_0x4968b0[_0xc1c7('0x39')]=_[_0xc1c7('0x3a')](_0x4968b0[_0xc1c7('0x36')],_0x4968b0[_0xc1c7('0x37')]);_0x2e35f1[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x4968b0['model'],qs['fields'](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x3c')]));_0x2e35f1[_0xc1c7('0x3b')]=_0x2e35f1[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x2e35f1[_0xc1c7('0x3b')]:_0x4968b0[_0xc1c7('0x36')];if(!_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x2e35f1[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x20')]);_0x2e35f1[_0xc1c7('0x22')]=qs[_0xc1c7('0x22')](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x22')]);}_0x2e35f1[_0xc1c7('0x40')]=qs[_0xc1c7('0x41')](_0x9a0ab3[_0xc1c7('0x37')]['sort']);_0x2e35f1['where']=qs['filters'](_[_0xc1c7('0x42')](_0x9a0ab3['query'],_0x4968b0['filters']),_0x125920);if(_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x43')]){_0x2e35f1[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x2e35f1['where'],{'$or':_[_0xc1c7('0x31')](_0x125920,function(_0x25e005){if(_0x25e005[_0xc1c7('0x34')]!==_0xc1c7('0x46')){var _0x1a395c={};_0x1a395c[_0x25e005[_0xc1c7('0x2e')]]={'$like':'%'+_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x43')]+'%'};return _0x1a395c;}})});}_0x2e35f1=_[_0xc1c7('0x45')]({},_0x2e35f1,_0x9a0ab3[_0xc1c7('0x47')]);var _0x955ba6={'where':_0x2e35f1[_0xc1c7('0x44')]};return db[_0xc1c7('0x48')]['count'](_0x955ba6)[_0xc1c7('0x27')](function(_0x412520){_0x50042f['count']=_0x412520;if(_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x2e35f1[_0xc1c7('0x4a')]=[{'all':!![]}];}return db[_0xc1c7('0x48')][_0xc1c7('0x4b')](_0x2e35f1);})[_0xc1c7('0x27')](function(_0xd5e06a){_0x50042f[_0xc1c7('0x4c')]=_0xd5e06a;return _0x50042f;})[_0xc1c7('0x27')](respondWithFilteredResult(_0x3a786f,_0x2e35f1))[_0xc1c7('0x4d')](handleError(_0x3a786f,null));};exports['show']=function(_0x14b61f,_0x16fbf5){var _0x519665={'raw':![],'where':{'id':_0x14b61f[_0xc1c7('0x4e')]['id']}},_0x4c6834={};_0x4c6834[_0xc1c7('0x36')]=_[_0xc1c7('0x38')](db[_0xc1c7('0x48')][_0xc1c7('0x32')]);_0x4c6834['query']=_[_0xc1c7('0x38')](_0x14b61f[_0xc1c7('0x37')]);_0x4c6834['filters']=_['intersection'](_0x4c6834['model'],_0x4c6834[_0xc1c7('0x37')]);_0x519665[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x4c6834['model'],qs[_0xc1c7('0x3c')](_0x14b61f[_0xc1c7('0x37')]['fields']));_0x519665[_0xc1c7('0x3b')]=_0x519665[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x519665[_0xc1c7('0x3b')]:_0x4c6834[_0xc1c7('0x36')];if(_0x14b61f[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x519665[_0xc1c7('0x4a')]=[{'all':!![]}];}_0x519665=_[_0xc1c7('0x45')]({},_0x519665,_0x14b61f[_0xc1c7('0x47')]);return db[_0xc1c7('0x48')][_0xc1c7('0x4f')](_0x519665)[_0xc1c7('0x27')](handleEntityNotFound(_0x16fbf5,null))[_0xc1c7('0x27')](respondWithResult(_0x16fbf5,null))[_0xc1c7('0x4d')](handleError(_0x16fbf5,null));};exports[_0xc1c7('0x50')]=function(_0x2967b7,_0x1addc8){return db['JscriptyProject'][_0xc1c7('0x50')](_0x2967b7['body'],{})[_0xc1c7('0x27')](function(_0x23f42f){var _0x2840a3=_0x2967b7['user'][_0xc1c7('0x29')]({'plain':!![]});if(!_0x2840a3)throw new Error(_0xc1c7('0x51'));if(_0x2840a3['role']==='user'){var _0x5c96cc=_0x23f42f[_0xc1c7('0x29')]({'plain':!![]});var _0x415416='Projects';return db[_0xc1c7('0x52')][_0xc1c7('0x4f')]({'where':{'name':_0x415416,'userProfileId':_0x2840a3[_0xc1c7('0x53')]},'raw':!![]})[_0xc1c7('0x27')](function(_0x37374c){if(_0x37374c&&_0x37374c[_0xc1c7('0x54')]===0x0){return db['UserProfileResource'][_0xc1c7('0x50')]({'name':_0x5c96cc['name'],'resourceId':_0x5c96cc['id'],'type':_0x37374c[_0xc1c7('0x2e')],'sectionId':_0x37374c['id']},{})[_0xc1c7('0x27')](function(){return _0x23f42f;});}else{return _0x23f42f;}})[_0xc1c7('0x4d')](function(_0x557cb6){logger[_0xc1c7('0x2c')](_0xc1c7('0x55'),_0x557cb6);throw _0x557cb6;});}return _0x23f42f;})[_0xc1c7('0x27')](respondWithResult(_0x1addc8,0xc9))[_0xc1c7('0x4d')](handleError(_0x1addc8,null));};exports[_0xc1c7('0x56')]=function(_0x45dfa2,_0x1dc39f){var _0x3eb3a5={'where':{'id':_0x45dfa2[_0xc1c7('0x4e')]['id']}},_0x5725af={};_0x5725af[_0xc1c7('0x36')]=_[_0xc1c7('0x38')](db['JscriptyProject']['rawAttributes']);_0x3eb3a5[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x5725af[_0xc1c7('0x36')],qs['fields'](_0x45dfa2[_0xc1c7('0x37')]['fields']));_0x3eb3a5[_0xc1c7('0x3b')]=_0x3eb3a5[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x3eb3a5[_0xc1c7('0x3b')]:_0x5725af[_0xc1c7('0x36')];if(_0x45dfa2[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x3eb3a5['include']=[{'all':!![]}];}_0x3eb3a5=_[_0xc1c7('0x45')]({},_0x3eb3a5,_0x45dfa2[_0xc1c7('0x47')]);return db[_0xc1c7('0x48')]['find'](_0x3eb3a5)[_0xc1c7('0x27')](handleEntityNotFound(_0x1dc39f,null))['then'](function(_0x4408fe){if(_0x4408fe){var _0x528986=_0x4408fe[_0xc1c7('0x29')]({'plain':!![]});_0x528986=qs[_0xc1c7('0x57')](_0x528986,['id',_0xc1c7('0x58'),_0xc1c7('0x59')]);_0x45dfa2[_0xc1c7('0x5a')]=_['omit'](_0x45dfa2['body'],['id','createdAt',_0xc1c7('0x59')]);return db[_0xc1c7('0x48')][_0xc1c7('0x50')](_[_0xc1c7('0x45')](_0x528986,_0x45dfa2[_0xc1c7('0x5a')]),{'include':_0x45dfa2[_0xc1c7('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0xc1c7('0x27')](function(_0xe5882){var _0x1c010a=_0x45dfa2[_0xc1c7('0x5b')]['get']({'plain':!![]});if(!_0x1c010a)throw new Error(_0xc1c7('0x51'));if(_0x1c010a[_0xc1c7('0x5c')]===_0xc1c7('0x5b')){var _0x5cb5e5=_0xe5882[_0xc1c7('0x29')]({'plain':!![]});var _0xb842a5=_0xc1c7('0x2a');return db[_0xc1c7('0x52')]['find']({'where':{'name':_0xb842a5,'userProfileId':_0x1c010a['userProfileId']},'raw':!![]})[_0xc1c7('0x27')](function(_0x203790){if(_0x203790&&_0x203790['autoAssociation']===0x0){return db[_0xc1c7('0x2b')][_0xc1c7('0x50')]({'name':_0x5cb5e5['name'],'resourceId':_0x5cb5e5['id'],'type':_0x203790[_0xc1c7('0x2e')],'sectionId':_0x203790['id']},{})[_0xc1c7('0x27')](function(){return _0xe5882;});}else{return _0xe5882;}})['catch'](function(_0x6b9337){logger[_0xc1c7('0x2c')](_0xc1c7('0x55'),_0x6b9337);throw _0x6b9337;});}return _0xe5882;});}})[_0xc1c7('0x27')](respondWithResult(_0x1dc39f,0xc9))[_0xc1c7('0x4d')](handleError(_0x1dc39f,null));};exports[_0xc1c7('0x26')]=function(_0x1ed9fc,_0x33104e){if(_0x1ed9fc[_0xc1c7('0x5a')]['id']){delete _0x1ed9fc[_0xc1c7('0x5a')]['id'];}return db[_0xc1c7('0x48')][_0xc1c7('0x4f')]({'where':{'id':_0x1ed9fc[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x33104e,null))[_0xc1c7('0x27')](saveUpdates(_0x1ed9fc[_0xc1c7('0x5a')],null))[_0xc1c7('0x27')](respondWithResult(_0x33104e,null))[_0xc1c7('0x4d')](handleError(_0x33104e,null));};exports[_0xc1c7('0x28')]=function(_0x44aeb5,_0x406b38){return db[_0xc1c7('0x48')][_0xc1c7('0x4f')]({'where':{'id':_0x44aeb5[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x406b38,null))[_0xc1c7('0x27')](removeEntity(_0x406b38,null))[_0xc1c7('0x4d')](handleError(_0x406b38,null));};exports[_0xc1c7('0x5d')]=function(_0x47d58e,_0x8c88c0,_0x244b8c){var _0x29067a={'raw':!![],'where':{}};var _0x3b3d50={};var _0x268de7={'count':0x0,'rows':[]};return db[_0xc1c7('0x48')][_0xc1c7('0x5e')]({'where':{'id':_0x47d58e[_0xc1c7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x8c88c0,null))[_0xc1c7('0x27')](function(_0x20cd61){if(_0x20cd61){_0x3b3d50[_0xc1c7('0x36')]=_[_0xc1c7('0x38')](db[_0xc1c7('0x5f')][_0xc1c7('0x32')]);_0x3b3d50[_0xc1c7('0x37')]=_[_0xc1c7('0x38')](_0x47d58e['query']);_0x3b3d50[_0xc1c7('0x39')]=_[_0xc1c7('0x3a')](_0x3b3d50[_0xc1c7('0x36')],_0x3b3d50[_0xc1c7('0x37')]);_0x29067a[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x3b3d50[_0xc1c7('0x36')],qs[_0xc1c7('0x3c')](_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x3c')]));_0x29067a[_0xc1c7('0x3b')]=_0x29067a[_0xc1c7('0x3b')]['length']?_0x29067a['attributes']:_0x3b3d50[_0xc1c7('0x36')];if(!_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x29067a[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x20')]);_0x29067a[_0xc1c7('0x22')]=qs[_0xc1c7('0x22')](_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x22')]);}_0x29067a[_0xc1c7('0x40')]=qs['sort'](_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x41')]);_0x29067a[_0xc1c7('0x44')]=qs['filters'](_['pick'](_0x47d58e['query'],_0x3b3d50[_0xc1c7('0x39')]));_0x29067a[_0xc1c7('0x44')]['ProjectId']=_0x20cd61['id'];if(_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x43')]){_0x29067a['where']=_['merge'](_0x29067a['where'],{'$or':_[_0xc1c7('0x31')](_0x29067a['attributes'],function(_0x219d44){var _0x3bc3aa={};_0x3bc3aa[_0x219d44]={'$like':'%'+_0x47d58e[_0xc1c7('0x37')]['filter']+'%'};return _0x3bc3aa;})});}_0x29067a=_[_0xc1c7('0x45')]({},_0x29067a,_0x47d58e['options']);return db[_0xc1c7('0x5f')][_0xc1c7('0x21')]({'where':_0x29067a['where']})[_0xc1c7('0x27')](function(_0x143c73){_0x268de7[_0xc1c7('0x21')]=_0x143c73;if(_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x29067a[_0xc1c7('0x4a')]=[{'all':!![]}];}return db[_0xc1c7('0x5f')][_0xc1c7('0x4b')](_0x29067a);})[_0xc1c7('0x27')](function(_0x3eba33){_0x268de7['rows']=_0x3eba33;return _0x268de7;});}})[_0xc1c7('0x27')](respondWithFilteredResult(_0x8c88c0,_0x29067a))[_0xc1c7('0x4d')](handleError(_0x8c88c0,null));};exports[_0xc1c7('0x60')]=function(_0x2c7e19,_0x54f90e,_0x204e89){var _0x12cb04={'raw':!![],'where':{}};var _0x47d2b0={};var _0x4eaa5c={'count':0x0,'rows':[]};return db[_0xc1c7('0x48')][_0xc1c7('0x5e')]({'where':{'id':_0x2c7e19[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x54f90e,null))[_0xc1c7('0x27')](function(_0x176603){if(_0x176603){_0x47d2b0['model']=_[_0xc1c7('0x38')](db[_0xc1c7('0x61')]['rawAttributes']);_0x47d2b0[_0xc1c7('0x37')]=_[_0xc1c7('0x38')](_0x2c7e19[_0xc1c7('0x37')]);_0x47d2b0[_0xc1c7('0x39')]=_[_0xc1c7('0x3a')](_0x47d2b0[_0xc1c7('0x36')],_0x47d2b0[_0xc1c7('0x37')]);_0x12cb04[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x47d2b0[_0xc1c7('0x36')],qs[_0xc1c7('0x3c')](_0x2c7e19[_0xc1c7('0x37')][_0xc1c7('0x3c')]));_0x12cb04[_0xc1c7('0x3b')]=_0x12cb04['attributes'][_0xc1c7('0x3d')]?_0x12cb04[_0xc1c7('0x3b')]:_0x47d2b0[_0xc1c7('0x36')];if(!_0x2c7e19[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x12cb04['limit']=qs[_0xc1c7('0x20')](_0x2c7e19[_0xc1c7('0x37')]['limit']);_0x12cb04['offset']=qs[_0xc1c7('0x22')](_0x2c7e19[_0xc1c7('0x37')][_0xc1c7('0x22')]);}_0x12cb04[_0xc1c7('0x40')]=qs[_0xc1c7('0x41')](_0x2c7e19[_0xc1c7('0x37')]['sort']);_0x12cb04[_0xc1c7('0x44')]=qs[_0xc1c7('0x39')](_[_0xc1c7('0x42')](_0x2c7e19[_0xc1c7('0x37')],_0x47d2b0['filters']));_0x12cb04[_0xc1c7('0x44')]['ProjectId']=_0x176603['id'];if(_0x2c7e19[_0xc1c7('0x37')]['filter']){_0x12cb04[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x12cb04['where'],{'$or':_[_0xc1c7('0x31')](_0x12cb04[_0xc1c7('0x3b')],function(_0x44aee1){var _0x3a8c16={};_0x3a8c16[_0x44aee1]={'$like':'%'+_0x2c7e19[_0xc1c7('0x37')][_0xc1c7('0x43')]+'%'};return _0x3a8c16;})});}_0x12cb04=_[_0xc1c7('0x45')]({},_0x12cb04,_0x2c7e19[_0xc1c7('0x47')]);return db[_0xc1c7('0x61')][_0xc1c7('0x21')]({'where':_0x12cb04[_0xc1c7('0x44')]})[_0xc1c7('0x27')](function(_0x3615a5){_0x4eaa5c[_0xc1c7('0x21')]=_0x3615a5;if(_0x2c7e19[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x12cb04[_0xc1c7('0x4a')]=[{'all':!![]}];}return db[_0xc1c7('0x61')][_0xc1c7('0x4b')](_0x12cb04);})['then'](function(_0x48cddc){_0x4eaa5c['rows']=_0x48cddc;return _0x4eaa5c;});}})[_0xc1c7('0x27')](respondWithFilteredResult(_0x54f90e,_0x12cb04))['catch'](handleError(_0x54f90e,null));};function char(_0x49c29b){return'number'===typeof _0x49c29b?String[_0xc1c7('0x62')][_0xc1c7('0x63')](null,arguments):_0x49c29b;}function needsEncapsulation(_0x56cd17){return!!_0x56cd17&&(_0x56cd17['toString']()['indexOf'](char(0xd))>=0x0||_0x56cd17[_0xc1c7('0x64')]()[_0xc1c7('0x65')](char(0xa))>=0x0||_0x56cd17[_0xc1c7('0x64')]()[_0xc1c7('0x65')](char(0x2c))>=0x0||_0x56cd17[_0xc1c7('0x64')]()[_0xc1c7('0x65')](char(0x22))>=0x0);}function encapsulate(_0x5650d7){var _0x3765e3=char(0x22),_0x12f753='\x5c'+char(0x22),_0x2b9cff=_0x5650d7['toString']()[_0xc1c7('0x66')](new RegExp(_0x3765e3,'g'),_0x12f753);return _0x3765e3+_0x2b9cff+_0x3765e3;}exports[_0xc1c7('0x67')]=function(_0x29da2a,_0x4bfa56,_0x451aec){var _0x3231c7,_0xb6be6a;var _0x3b86d1={'where':{'ProjectId':_0x29da2a[_0xc1c7('0x4e')]['id']}};if(_0x29da2a[_0xc1c7('0x37')][_0xc1c7('0x68')]){_0x3b86d1[_0xc1c7('0x44')]['starttime']=JSON['parse'](_0x29da2a[_0xc1c7('0x37')][_0xc1c7('0x68')]);}return db[_0xc1c7('0x5f')]['findAll'](_0x3b86d1)[_0xc1c7('0x27')](handleEntityNotFound(_0x4bfa56,null))[_0xc1c7('0x27')](function(_0x15aa30){if(_0x15aa30){_0x3231c7=_0x15aa30;return db[_0xc1c7('0x69')][_0xc1c7('0x4b')]({'where':{'SessionId':{'$in':_['map'](_0x3231c7,'id')},'ProjectId':_0x29da2a[_0xc1c7('0x4e')]['id']},'order':_0xc1c7('0x6a')});}})[_0xc1c7('0x27')](handleEntityNotFound(_0x4bfa56,null))[_0xc1c7('0x27')](function(_0x1646d5){if(_0x1646d5){_0xb6be6a=_0x1646d5;var _0xe8ef48={};for(var _0x71c071=0x0,_0x2b3016=_0xb6be6a[_0xc1c7('0x3d')];_0x71c071<_0x2b3016;_0x71c071++){if(!_0xe8ef48[_0xc1c7('0x3e')](_0xb6be6a[_0x71c071][_0xc1c7('0x6b')])){_0xe8ef48[_0xb6be6a[_0x71c071][_0xc1c7('0x6b')]]=needsEncapsulation(_0xb6be6a[_0x71c071][_0xc1c7('0x6c')])?encapsulate(_0xb6be6a[_0x71c071][_0xc1c7('0x6c')]):_0xb6be6a[_0x71c071][_0xc1c7('0x6c')];}}var _0x55197f=[],_0x2656a7={};for(var _0x6bbaf5=0x0,_0x11985b=_0x3231c7[_0xc1c7('0x3d')];_0x6bbaf5<_0x11985b;_0x6bbaf5++){_0x2656a7={'ProjectId':_0x29da2a[_0xc1c7('0x4e')]['id'],'SessionId':_0x3231c7[_0x6bbaf5]['id'],'StartTime':moment(_0x3231c7[_0x6bbaf5]['starttime'])[_0xc1c7('0x6d')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x29df03=0x0,_0x13700f=_0xb6be6a[_0xc1c7('0x3d')];_0x29df03<_0x13700f;_0x29df03++){if(_0xb6be6a[_0x29df03][_0xc1c7('0x6e')]==_0x3231c7[_0x6bbaf5]['id']&&_0xe8ef48['hasOwnProperty'](_0xb6be6a[_0x29df03][_0xc1c7('0x6b')])){_0x2656a7[_0xe8ef48[_0xb6be6a[_0x29df03]['questionId']]]=_0xb6be6a[_0x29df03][_0xc1c7('0x6f')];}}for(var _0x344a09 in _0xe8ef48){if(!_0x2656a7['hasOwnProperty'](_0xe8ef48[_0x344a09])){_0x2656a7[_0xe8ef48[_0x344a09]]=null;}}_0x55197f[_0xc1c7('0x70')](_0x2656a7);}return _0x55197f;}})[_0xc1c7('0x27')](function(_0x324a87){if(!_['isEmpty'](_0x324a87)){var _0xa64d7=toCsv(_0x324a87);var _0x415a0d=Date[_0xc1c7('0x71')]();fs[_0xc1c7('0x72')](util[_0xc1c7('0x6d')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x29da2a[_0xc1c7('0x4e')]['id'],_0x415a0d),_0xa64d7);_0x4bfa56['setHeader'](_0xc1c7('0x73'),'attachment;\x20filename='+util[_0xc1c7('0x6d')](_0xc1c7('0x74'),_0x29da2a[_0xc1c7('0x4e')]['id'],_0x415a0d));_0x4bfa56['setHeader'](_0xc1c7('0x75'),_0xc1c7('0x76'));return _0x4bfa56[_0xc1c7('0x77')](util[_0xc1c7('0x6d')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x29da2a[_0xc1c7('0x4e')]['id'],_0x415a0d));}else{return _0x4bfa56[_0xc1c7('0x1b')](0xcc);}})[_0xc1c7('0x4d')](handleError(_0x4bfa56,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index c1d6496..f99a5ae 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 _0x2830=['rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2276d2,_0x2c2aae){var _0x6fecf4=function(_0x59c210){while(--_0x59c210){_0x2276d2['push'](_0x2276d2['shift']());}};_0x6fecf4(++_0x2c2aae);}(_0x2830,0x117));var _0x0283=function(_0x2fb22b,_0xa4226e){_0x2fb22b=_0x2fb22b-0x0;var _0x14f065=_0x2830[_0x2fb22b];return _0x14f065;};'use strict';var _=require(_0x0283('0x0'));var util=require(_0x0283('0x1'));var logger=require(_0x0283('0x2'))(_0x0283('0x3'));var moment=require(_0x0283('0x4'));var BPromise=require(_0x0283('0x5'));var rp=require(_0x0283('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0283('0x7'));var config=require('../../config/environment');var attributes=require(_0x0283('0x8'));module[_0x0283('0x9')]=function(_0xc56cd7,_0x2125db){return _0xc56cd7[_0x0283('0xa')](_0x0283('0xb'),attributes,{'tableName':_0x0283('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96aa=['request-promise','path','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','api','moment','bluebird'];(function(_0x2b9bfe,_0x5b6168){var _0x5cfdfb=function(_0x4a8022){while(--_0x4a8022){_0x2b9bfe['push'](_0x2b9bfe['shift']());}};_0x5cfdfb(++_0x5b6168);}(_0x96aa,0x67));var _0xa96a=function(_0x42e565,_0x2bbfa3){_0x42e565=_0x42e565-0x0;var _0x1815e8=_0x96aa[_0x42e565];return _0x1815e8;};'use strict';var _=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var logger=require('../../config/logger')(_0xa96a('0x2'));var moment=require(_0xa96a('0x3'));var BPromise=require(_0xa96a('0x4'));var rp=require(_0xa96a('0x5'));var fs=require('fs');var path=require(_0xa96a('0x6'));var rimraf=require('rimraf');var config=require(_0xa96a('0x7'));var attributes=require(_0xa96a('0x8'));module['exports']=function(_0x464684,_0x2e9a41){return _0x464684[_0xa96a('0x9')](_0xa96a('0xa'),attributes,{'tableName':_0xa96a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 66a612f..832dfa1 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xac4a,0x13f));var _0xaac4=function(_0x1dab02,_0x599932){_0x1dab02=_0x1dab02-0x0;var _0x397132=_0xac4a[_0x1dab02];return _0x397132;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x316904,_0x1e8b77){var _0xfa9a21=function(_0x2b75ae){while(--_0x2b75ae){_0x316904['push'](_0x316904['shift']());}};_0xfa9a21(++_0x1e8b77);}(_0xda3f,0xec));var _0xfda3=function(_0x59d7aa,_0x1330c5){_0x59d7aa=_0x59d7aa-0x0;var _0x3d3f1e=_0xda3f[_0x59d7aa];return _0x3d3f1e;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 947580c..5d64e34 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 _0xa882=['create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0xa990b7,_0x26c527){var _0x52c99c=function(_0xf94328){while(--_0xf94328){_0xa990b7['push'](_0xa990b7['shift']());}};_0x52c99c(++_0x26c527);}(_0xa882,0x1e0));var _0x2a88=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xa882[_0x3826ad];return _0x17b900;};'use strict';var multer=require('multer');var util=require(_0x2a88('0x0'));var path=require(_0x2a88('0x1'));var timeout=require(_0x2a88('0x2'));var express=require(_0x2a88('0x3'));var router=express[_0x2a88('0x4')]();var fs_extra=require(_0x2a88('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2a88('0x6'));var config=require(_0x2a88('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0x2a88('0x8')]('/',auth[_0x2a88('0x9')](),controller['index']);router[_0x2a88('0x8')](_0x2a88('0xa'),auth[_0x2a88('0x9')](),controller[_0x2a88('0xb')]);router['get'](_0x2a88('0xc'),auth[_0x2a88('0x9')](),controller[_0x2a88('0xd')]);router['post']('/',auth[_0x2a88('0x9')](),controller[_0x2a88('0xe')]);router[_0x2a88('0xf')](_0x2a88('0xc'),auth[_0x2a88('0x9')](),controller['update']);router[_0x2a88('0x10')]('/:id',auth[_0x2a88('0x9')](),controller[_0x2a88('0x11')]);module[_0x2a88('0x12')]=router; \ No newline at end of file +var _0x8501=['multer','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/describe','describe','show','post','put','/:id','update','destroy','exports'];(function(_0x16b1b8,_0x432d03){var _0x558b1e=function(_0xf47f2f){while(--_0xf47f2f){_0x16b1b8['push'](_0x16b1b8['shift']());}};_0x558b1e(++_0x432d03);}(_0x8501,0x96));var _0x1850=function(_0x52949d,_0x5750ec){_0x52949d=_0x52949d-0x0;var _0x570250=_0x8501[_0x52949d];return _0x570250;};'use strict';var multer=require(_0x1850('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1850('0x1')]();var fs_extra=require(_0x1850('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1850('0x3'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0x1850('0x4')]('/',auth[_0x1850('0x5')](),controller['index']);router[_0x1850('0x4')](_0x1850('0x6'),auth['isAuthenticated'](),controller[_0x1850('0x7')]);router[_0x1850('0x4')]('/:id',auth[_0x1850('0x5')](),controller[_0x1850('0x8')]);router[_0x1850('0x9')]('/',auth[_0x1850('0x5')](),controller['create']);router[_0x1850('0xa')](_0x1850('0xb'),auth['isAuthenticated'](),controller[_0x1850('0xc')]);router['delete']('/:id',auth[_0x1850('0x5')](),controller[_0x1850('0xd')]);module[_0x1850('0xe')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index e264bec..2c824c3 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(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7a54,0x106));var _0x47a5=function(_0x32e801,_0x28f8a7){_0x32e801=_0x32e801-0x0;var _0x437eda=_0x7a54[_0x32e801];return _0x437eda;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x2e7d9c,_0x4b3bd7){_0x2e7d9c=_0x2e7d9c-0x0;var _0x295b81=_0x7a54[_0x2e7d9c];return _0x295b81;};'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 65aec30..e5ea60f 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 _0x1ab1=['eml-format','fast-json-patch','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','JscriptyQuestionReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','find','create','body','catch','describe'];(function(_0x250897,_0x50e64c){var _0x4463a1=function(_0x119bfe){while(--_0x119bfe){_0x250897['push'](_0x250897['shift']());}};_0x4463a1(++_0x50e64c);}(_0x1ab1,0x12c));var _0x11ab=function(_0x4c1cec,_0x34e24c){_0x4c1cec=_0x4c1cec-0x0;var _0x2bd2a9=_0x1ab1[_0x4c1cec];return _0x2bd2a9;};'use strict';var emlformat=require(_0x11ab('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x11ab('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x11ab('0x2'));var util=require('util');var path=require(_0x11ab('0x3'));var sox=require(_0x11ab('0x4'));var csv=require(_0x11ab('0x5'));var ejs=require(_0x11ab('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11ab('0x7'));var squel=require(_0x11ab('0x8'));var crypto=require(_0x11ab('0x9'));var jsforce=require(_0x11ab('0xa'));var deskjs=require(_0x11ab('0xb'));var toCsv=require(_0x11ab('0x5'));var querystring=require('querystring');var Papa=require(_0x11ab('0xc'));var Redis=require('ioredis');var authService=require(_0x11ab('0xd'));var qs=require(_0x11ab('0xe'));var as=require(_0x11ab('0xf'));var hardwareService=require(_0x11ab('0x10'));var logger=require('../../config/logger')(_0x11ab('0x11'));var utils=require(_0x11ab('0x12'));var config=require(_0x11ab('0x13'));var licenseUtil=require(_0x11ab('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49aaa8,_0x45202d){_0x45202d=_0x45202d||0xcc;return function(_0x2d772f){if(_0x2d772f){return _0x49aaa8[_0x11ab('0x15')](_0x45202d);}return _0x49aaa8[_0x11ab('0x16')](_0x45202d)[_0x11ab('0x17')]();};}function respondWithResult(_0x582630,_0x33b5a8){_0x33b5a8=_0x33b5a8||0xc8;return function(_0x43f5d6){if(_0x43f5d6){return _0x582630[_0x11ab('0x16')](_0x33b5a8)[_0x11ab('0x18')](_0x43f5d6);}};}function respondWithFilteredResult(_0x4bbcf1,_0x39277d){return function(_0x462486){if(_0x462486){var _0x2ab33d=typeof _0x39277d[_0x11ab('0x19')]===_0x11ab('0x1a')&&typeof _0x39277d[_0x11ab('0x1b')]===_0x11ab('0x1a');var _0x4f0ca2=_0x462486[_0x11ab('0x1c')];var _0x4786a7=_0x2ab33d?0x0:_0x39277d[_0x11ab('0x19')];var _0x2db61e=_0x2ab33d?_0x462486[_0x11ab('0x1c')]:_0x39277d[_0x11ab('0x19')]+_0x39277d[_0x11ab('0x1b')];var _0x513500;if(_0x2db61e>=_0x4f0ca2){_0x2db61e=_0x4f0ca2;_0x513500=0xc8;}else{_0x513500=0xce;}_0x4bbcf1[_0x11ab('0x16')](_0x513500);return _0x4bbcf1[_0x11ab('0x1d')](_0x11ab('0x1e'),_0x4786a7+'-'+_0x2db61e+'/'+_0x4f0ca2)[_0x11ab('0x18')](_0x462486);}return null;};}function patchUpdates(_0x31485c){return function(_0x4ace6f){try{jsonpatch['apply'](_0x4ace6f,_0x31485c,!![]);}catch(_0x25a57f){return BPromise[_0x11ab('0x1f')](_0x25a57f);}return _0x4ace6f[_0x11ab('0x20')]();};}function saveUpdates(_0x27fdfd,_0x22b406){return function(_0x333b18){if(_0x333b18){return _0x333b18[_0x11ab('0x21')](_0x27fdfd)['then'](function(_0x5d1c09){return _0x5d1c09;});}return null;};}function removeEntity(_0x3a6d34,_0x1ea334){return function(_0x1bae08){if(_0x1bae08){return _0x1bae08[_0x11ab('0x22')]()[_0x11ab('0x23')](function(){_0x3a6d34[_0x11ab('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x418271,_0x913abd){return function(_0x47cad2){if(!_0x47cad2){_0x418271[_0x11ab('0x15')](0x194);}return _0x47cad2;};}function handleError(_0x3aeaee,_0x572377){_0x572377=_0x572377||0x1f4;return function(_0x57fe61){logger[_0x11ab('0x24')](_0x57fe61[_0x11ab('0x25')]);if(_0x57fe61[_0x11ab('0x26')]){delete _0x57fe61[_0x11ab('0x26')];}_0x3aeaee[_0x11ab('0x16')](_0x572377)[_0x11ab('0x27')](_0x57fe61);};}exports[_0x11ab('0x28')]=function(_0x51aff0,_0x238aad){var _0x28aed6={},_0x2563d3={},_0x10a4f8={'count':0x0,'rows':[]};var _0x25fe55=_[_0x11ab('0x29')](db[_0x11ab('0x2a')]['rawAttributes'],function(_0x3689b9){return{'name':_0x3689b9[_0x11ab('0x2b')],'type':_0x3689b9[_0x11ab('0x2c')][_0x11ab('0x2d')]};});_0x2563d3[_0x11ab('0x2e')]=_[_0x11ab('0x29')](_0x25fe55,'name');_0x2563d3[_0x11ab('0x2f')]=_['keys'](_0x51aff0[_0x11ab('0x2f')]);_0x2563d3[_0x11ab('0x30')]=_[_0x11ab('0x31')](_0x2563d3[_0x11ab('0x2e')],_0x2563d3[_0x11ab('0x2f')]);_0x28aed6[_0x11ab('0x32')]=_['intersection'](_0x2563d3[_0x11ab('0x2e')],qs[_0x11ab('0x33')](_0x51aff0['query'][_0x11ab('0x33')]));_0x28aed6[_0x11ab('0x32')]=_0x28aed6[_0x11ab('0x32')][_0x11ab('0x34')]?_0x28aed6[_0x11ab('0x32')]:_0x2563d3['model'];if(!_0x51aff0[_0x11ab('0x2f')][_0x11ab('0x35')](_0x11ab('0x36'))){_0x28aed6[_0x11ab('0x1b')]=qs[_0x11ab('0x1b')](_0x51aff0[_0x11ab('0x2f')][_0x11ab('0x1b')]);_0x28aed6[_0x11ab('0x19')]=qs[_0x11ab('0x19')](_0x51aff0[_0x11ab('0x2f')]['offset']);}_0x28aed6[_0x11ab('0x37')]=qs['sort'](_0x51aff0[_0x11ab('0x2f')][_0x11ab('0x38')]);_0x28aed6['where']=qs[_0x11ab('0x30')](_[_0x11ab('0x39')](_0x51aff0['query'],_0x2563d3[_0x11ab('0x30')]),_0x25fe55);if(_0x51aff0[_0x11ab('0x2f')][_0x11ab('0x3a')]){_0x28aed6[_0x11ab('0x3b')]=_[_0x11ab('0x3c')](_0x28aed6[_0x11ab('0x3b')],{'$or':_[_0x11ab('0x29')](_0x25fe55,function(_0x339dbe){if(_0x339dbe[_0x11ab('0x2c')]!==_0x11ab('0x3d')){var _0x53e438={};_0x53e438[_0x339dbe[_0x11ab('0x26')]]={'$like':'%'+_0x51aff0[_0x11ab('0x2f')][_0x11ab('0x3a')]+'%'};return _0x53e438;}})});}_0x28aed6=_[_0x11ab('0x3c')]({},_0x28aed6,_0x51aff0[_0x11ab('0x3e')]);var _0x4fac78={'where':_0x28aed6[_0x11ab('0x3b')]};return db[_0x11ab('0x2a')]['count'](_0x4fac78)['then'](function(_0x3a3489){_0x10a4f8[_0x11ab('0x1c')]=_0x3a3489;if(_0x51aff0[_0x11ab('0x2f')]['includeAll']){_0x28aed6[_0x11ab('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x11ab('0x40')](_0x28aed6);})[_0x11ab('0x23')](function(_0x5c06f2){_0x10a4f8[_0x11ab('0x41')]=_0x5c06f2;return _0x10a4f8;})[_0x11ab('0x23')](respondWithFilteredResult(_0x238aad,_0x28aed6))['catch'](handleError(_0x238aad,null));};exports[_0x11ab('0x42')]=function(_0x41e33c,_0x1e808e){var _0x38f585={'raw':!![],'where':{'id':_0x41e33c[_0x11ab('0x43')]['id']}},_0x3af1b3={};_0x3af1b3[_0x11ab('0x2e')]=_[_0x11ab('0x44')](db[_0x11ab('0x2a')]['rawAttributes']);_0x3af1b3[_0x11ab('0x2f')]=_['keys'](_0x41e33c[_0x11ab('0x2f')]);_0x3af1b3[_0x11ab('0x30')]=_[_0x11ab('0x31')](_0x3af1b3[_0x11ab('0x2e')],_0x3af1b3['query']);_0x38f585['attributes']=_['intersection'](_0x3af1b3[_0x11ab('0x2e')],qs['fields'](_0x41e33c['query'][_0x11ab('0x33')]));_0x38f585[_0x11ab('0x32')]=_0x38f585[_0x11ab('0x32')][_0x11ab('0x34')]?_0x38f585['attributes']:_0x3af1b3['model'];if(_0x41e33c[_0x11ab('0x2f')][_0x11ab('0x45')]){_0x38f585[_0x11ab('0x3f')]=[{'all':!![]}];}_0x38f585=_['merge']({},_0x38f585,_0x41e33c['options']);return db[_0x11ab('0x2a')][_0x11ab('0x46')](_0x38f585)[_0x11ab('0x23')](handleEntityNotFound(_0x1e808e,null))[_0x11ab('0x23')](respondWithResult(_0x1e808e,null))['catch'](handleError(_0x1e808e,null));};exports[_0x11ab('0x47')]=function(_0x6ccb66,_0x268d0e){return db['JscriptyQuestionReport']['create'](_0x6ccb66['body'],{})[_0x11ab('0x23')](respondWithResult(_0x268d0e,0xc9))['catch'](handleError(_0x268d0e,null));};exports['update']=function(_0x2ef826,_0x3df075){if(_0x2ef826[_0x11ab('0x48')]['id']){delete _0x2ef826[_0x11ab('0x48')]['id'];}return db[_0x11ab('0x2a')]['find']({'where':{'id':_0x2ef826[_0x11ab('0x43')]['id']}})[_0x11ab('0x23')](handleEntityNotFound(_0x3df075,null))[_0x11ab('0x23')](saveUpdates(_0x2ef826['body'],null))[_0x11ab('0x23')](respondWithResult(_0x3df075,null))[_0x11ab('0x49')](handleError(_0x3df075,null));};exports[_0x11ab('0x22')]=function(_0x627714,_0x238de4){return db[_0x11ab('0x2a')][_0x11ab('0x46')]({'where':{'id':_0x627714['params']['id']}})['then'](handleEntityNotFound(_0x238de4,null))[_0x11ab('0x23')](removeEntity(_0x238de4,null))['catch'](handleError(_0x238de4,null));};exports[_0x11ab('0x4a')]=function(_0x39c72a,_0x501c9d){return db[_0x11ab('0x2a')][_0x11ab('0x4a')]()[_0x11ab('0x23')](respondWithResult(_0x501c9d,null))[_0x11ab('0x49')](handleError(_0x501c9d,null));}; \ No newline at end of file +var _0x276b=['limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','find','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0x451254,_0x494da1){var _0x262acb=function(_0x5af3e8){while(--_0x5af3e8){_0x451254['push'](_0x451254['shift']());}};_0x262acb(++_0x494da1);}(_0x276b,0x7c));var _0xb276=function(_0x4f1c24,_0x31a667){_0x4f1c24=_0x4f1c24-0x0;var _0x220baa=_0x276b[_0x4f1c24];return _0x220baa;};'use strict';var emlformat=require(_0xb276('0x0'));var rimraf=require(_0xb276('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb276('0x2'));var rp=require(_0xb276('0x3'));var moment=require(_0xb276('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb276('0x5'));var path=require(_0xb276('0x6'));var sox=require(_0xb276('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb276('0x8'));var _=require('lodash');var squel=require(_0xb276('0x9'));var crypto=require(_0xb276('0xa'));var jsforce=require(_0xb276('0xb'));var deskjs=require(_0xb276('0xc'));var toCsv=require(_0xb276('0xd'));var querystring=require(_0xb276('0xe'));var Papa=require('papaparse');var Redis=require(_0xb276('0xf'));var authService=require(_0xb276('0x10'));var qs=require(_0xb276('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb276('0x12'))('api');var utils=require(_0xb276('0x13'));var config=require(_0xb276('0x14'));var licenseUtil=require(_0xb276('0x15'));var db=require(_0xb276('0x16'))['db'];function respondWithStatusCode(_0x1896e7,_0x3ffd00){_0x3ffd00=_0x3ffd00||0xcc;return function(_0x22d861){if(_0x22d861){return _0x1896e7[_0xb276('0x17')](_0x3ffd00);}return _0x1896e7[_0xb276('0x18')](_0x3ffd00)[_0xb276('0x19')]();};}function respondWithResult(_0x1700da,_0x1ad578){_0x1ad578=_0x1ad578||0xc8;return function(_0x504643){if(_0x504643){return _0x1700da['status'](_0x1ad578)[_0xb276('0x1a')](_0x504643);}};}function respondWithFilteredResult(_0x2690d1,_0x3fd6a7){return function(_0x1dc5b7){if(_0x1dc5b7){var _0x3eaf7c=typeof _0x3fd6a7[_0xb276('0x1b')]===_0xb276('0x1c')&&typeof _0x3fd6a7['limit']==='undefined';var _0x2ae712=_0x1dc5b7[_0xb276('0x1d')];var _0x156849=_0x3eaf7c?0x0:_0x3fd6a7[_0xb276('0x1b')];var _0x4b2d43=_0x3eaf7c?_0x1dc5b7[_0xb276('0x1d')]:_0x3fd6a7[_0xb276('0x1b')]+_0x3fd6a7[_0xb276('0x1e')];var _0x57351f;if(_0x4b2d43>=_0x2ae712){_0x4b2d43=_0x2ae712;_0x57351f=0xc8;}else{_0x57351f=0xce;}_0x2690d1[_0xb276('0x18')](_0x57351f);return _0x2690d1[_0xb276('0x1f')](_0xb276('0x20'),_0x156849+'-'+_0x4b2d43+'/'+_0x2ae712)[_0xb276('0x1a')](_0x1dc5b7);}return null;};}function patchUpdates(_0xfed44a){return function(_0x413e00){try{jsonpatch[_0xb276('0x21')](_0x413e00,_0xfed44a,!![]);}catch(_0x42f0b9){return BPromise[_0xb276('0x22')](_0x42f0b9);}return _0x413e00[_0xb276('0x23')]();};}function saveUpdates(_0x502322,_0x4db267){return function(_0x2dd820){if(_0x2dd820){return _0x2dd820[_0xb276('0x24')](_0x502322)[_0xb276('0x25')](function(_0x90f9da){return _0x90f9da;});}return null;};}function removeEntity(_0x173bed,_0x44310e){return function(_0x447784){if(_0x447784){return _0x447784['destroy']()['then'](function(){_0x173bed[_0xb276('0x18')](0xcc)[_0xb276('0x19')]();});}};}function handleEntityNotFound(_0x2e4873,_0x17dab8){return function(_0x2db8c6){if(!_0x2db8c6){_0x2e4873[_0xb276('0x17')](0x194);}return _0x2db8c6;};}function handleError(_0x1e5ba0,_0x1b7811){_0x1b7811=_0x1b7811||0x1f4;return function(_0x2d87bc){logger[_0xb276('0x26')](_0x2d87bc[_0xb276('0x27')]);if(_0x2d87bc[_0xb276('0x28')]){delete _0x2d87bc[_0xb276('0x28')];}_0x1e5ba0[_0xb276('0x18')](_0x1b7811)[_0xb276('0x29')](_0x2d87bc);};}exports[_0xb276('0x2a')]=function(_0xcaf09,_0x206c77){var _0x17ed9b={},_0x386c89={},_0x59fc0c={'count':0x0,'rows':[]};var _0x41e458=_[_0xb276('0x2b')](db[_0xb276('0x2c')][_0xb276('0x2d')],function(_0x271f62){return{'name':_0x271f62[_0xb276('0x2e')],'type':_0x271f62[_0xb276('0x2f')][_0xb276('0x30')]};});_0x386c89['model']=_[_0xb276('0x2b')](_0x41e458,'name');_0x386c89['query']=_[_0xb276('0x31')](_0xcaf09[_0xb276('0x32')]);_0x386c89[_0xb276('0x33')]=_[_0xb276('0x34')](_0x386c89[_0xb276('0x35')],_0x386c89[_0xb276('0x32')]);_0x17ed9b[_0xb276('0x36')]=_['intersection'](_0x386c89[_0xb276('0x35')],qs[_0xb276('0x37')](_0xcaf09[_0xb276('0x32')][_0xb276('0x37')]));_0x17ed9b[_0xb276('0x36')]=_0x17ed9b[_0xb276('0x36')][_0xb276('0x38')]?_0x17ed9b[_0xb276('0x36')]:_0x386c89[_0xb276('0x35')];if(!_0xcaf09[_0xb276('0x32')][_0xb276('0x39')](_0xb276('0x3a'))){_0x17ed9b[_0xb276('0x1e')]=qs[_0xb276('0x1e')](_0xcaf09[_0xb276('0x32')][_0xb276('0x1e')]);_0x17ed9b[_0xb276('0x1b')]=qs[_0xb276('0x1b')](_0xcaf09[_0xb276('0x32')][_0xb276('0x1b')]);}_0x17ed9b[_0xb276('0x3b')]=qs[_0xb276('0x3c')](_0xcaf09[_0xb276('0x32')][_0xb276('0x3c')]);_0x17ed9b[_0xb276('0x3d')]=qs[_0xb276('0x33')](_['pick'](_0xcaf09[_0xb276('0x32')],_0x386c89[_0xb276('0x33')]),_0x41e458);if(_0xcaf09[_0xb276('0x32')]['filter']){_0x17ed9b['where']=_[_0xb276('0x3e')](_0x17ed9b[_0xb276('0x3d')],{'$or':_['map'](_0x41e458,function(_0x2c7af7){if(_0x2c7af7[_0xb276('0x2f')]!==_0xb276('0x3f')){var _0x110e38={};_0x110e38[_0x2c7af7[_0xb276('0x28')]]={'$like':'%'+_0xcaf09[_0xb276('0x32')][_0xb276('0x40')]+'%'};return _0x110e38;}})});}_0x17ed9b=_['merge']({},_0x17ed9b,_0xcaf09[_0xb276('0x41')]);var _0x1f1e5a={'where':_0x17ed9b[_0xb276('0x3d')]};return db[_0xb276('0x2c')][_0xb276('0x1d')](_0x1f1e5a)['then'](function(_0x23b3ee){_0x59fc0c[_0xb276('0x1d')]=_0x23b3ee;if(_0xcaf09[_0xb276('0x32')][_0xb276('0x42')]){_0x17ed9b[_0xb276('0x43')]=[{'all':!![]}];}return db[_0xb276('0x2c')]['findAll'](_0x17ed9b);})[_0xb276('0x25')](function(_0x14abee){_0x59fc0c[_0xb276('0x44')]=_0x14abee;return _0x59fc0c;})['then'](respondWithFilteredResult(_0x206c77,_0x17ed9b))[_0xb276('0x45')](handleError(_0x206c77,null));};exports[_0xb276('0x46')]=function(_0x245e09,_0x361cff){var _0x359a30={'raw':!![],'where':{'id':_0x245e09['params']['id']}},_0x322288={};_0x322288[_0xb276('0x35')]=_[_0xb276('0x31')](db[_0xb276('0x2c')]['rawAttributes']);_0x322288['query']=_[_0xb276('0x31')](_0x245e09['query']);_0x322288['filters']=_[_0xb276('0x34')](_0x322288['model'],_0x322288[_0xb276('0x32')]);_0x359a30['attributes']=_[_0xb276('0x34')](_0x322288['model'],qs[_0xb276('0x37')](_0x245e09['query']['fields']));_0x359a30[_0xb276('0x36')]=_0x359a30[_0xb276('0x36')][_0xb276('0x38')]?_0x359a30[_0xb276('0x36')]:_0x322288['model'];if(_0x245e09['query'][_0xb276('0x42')]){_0x359a30['include']=[{'all':!![]}];}_0x359a30=_[_0xb276('0x3e')]({},_0x359a30,_0x245e09[_0xb276('0x41')]);return db[_0xb276('0x2c')][_0xb276('0x47')](_0x359a30)['then'](handleEntityNotFound(_0x361cff,null))[_0xb276('0x25')](respondWithResult(_0x361cff,null))[_0xb276('0x45')](handleError(_0x361cff,null));};exports[_0xb276('0x48')]=function(_0x152c8d,_0x3524f6){return db[_0xb276('0x2c')][_0xb276('0x48')](_0x152c8d[_0xb276('0x49')],{})[_0xb276('0x25')](respondWithResult(_0x3524f6,0xc9))[_0xb276('0x45')](handleError(_0x3524f6,null));};exports[_0xb276('0x24')]=function(_0x387dc8,_0x45b0d2){if(_0x387dc8[_0xb276('0x49')]['id']){delete _0x387dc8[_0xb276('0x49')]['id'];}return db[_0xb276('0x2c')][_0xb276('0x47')]({'where':{'id':_0x387dc8[_0xb276('0x4a')]['id']}})[_0xb276('0x25')](handleEntityNotFound(_0x45b0d2,null))['then'](saveUpdates(_0x387dc8[_0xb276('0x49')],null))[_0xb276('0x25')](respondWithResult(_0x45b0d2,null))['catch'](handleError(_0x45b0d2,null));};exports[_0xb276('0x4b')]=function(_0x5769fc,_0x17a25c){return db[_0xb276('0x2c')][_0xb276('0x47')]({'where':{'id':_0x5769fc[_0xb276('0x4a')]['id']}})[_0xb276('0x25')](handleEntityNotFound(_0x17a25c,null))[_0xb276('0x25')](removeEntity(_0x17a25c,null))[_0xb276('0x45')](handleError(_0x17a25c,null));};exports[_0xb276('0x4c')]=function(_0xf30f0a,_0x3eb1b5){return db[_0xb276('0x2c')][_0xb276('0x4c')]()['then'](respondWithResult(_0x3eb1b5,null))[_0xb276('0x45')](handleError(_0x3eb1b5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index ef60628..ccb18d8 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 _0xbb30=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','api','request-promise','path','rimraf','../../config/environment','define'];(function(_0x12c27e,_0xdeaee6){var _0x25301b=function(_0x496b13){while(--_0x496b13){_0x12c27e['push'](_0x12c27e['shift']());}};_0x25301b(++_0xdeaee6);}(_0xbb30,0x19c));var _0x0bb3=function(_0x29d316,_0x41a9c){_0x29d316=_0x29d316-0x0;var _0x4fc3d6=_0xbb30[_0x29d316];return _0x4fc3d6;};'use strict';var _=require(_0x0bb3('0x0'));var util=require(_0x0bb3('0x1'));var logger=require('../../config/logger')(_0x0bb3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0bb3('0x3'));var fs=require('fs');var path=require(_0x0bb3('0x4'));var rimraf=require(_0x0bb3('0x5'));var config=require(_0x0bb3('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x2f53ef,_0x39cb61){return _0x2f53ef[_0x0bb3('0x7')](_0x0bb3('0x8'),attributes,{'tableName':_0x0bb3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf75d=['path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xf75d,0x13c));var _0xdf75=function(_0x508926,_0xa05b4f){_0x508926=_0x508926-0x0;var _0x49ab00=_0xf75d[_0x508926];return _0x49ab00;};'use strict';var _=require(_0xdf75('0x0'));var util=require(_0xdf75('0x1'));var logger=require(_0xdf75('0x2'))(_0xdf75('0x3'));var moment=require(_0xdf75('0x4'));var BPromise=require(_0xdf75('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf75('0x6'));var rimraf=require(_0xdf75('0x7'));var config=require(_0xdf75('0x8'));var attributes=require(_0xdf75('0x9'));module[_0xdf75('0xa')]=function(_0x5580b9,_0x27ca8f){return _0x5580b9[_0xdf75('0xb')](_0xdf75('0xc'),attributes,{'tableName':_0xdf75('0xd'),'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 4edb780..878c474 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 _0xf2a4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message','lodash','util','moment'];(function(_0x1da3b6,_0x4a0331){var _0xc9fc66=function(_0x350b23){while(--_0x350b23){_0x1da3b6['push'](_0x1da3b6['shift']());}};_0xc9fc66(++_0x4a0331);}(_0xf2a4,0x1b5));var _0x4f2a=function(_0x29300d,_0x1674b3){_0x29300d=_0x29300d-0x0;var _0x12d809=_0xf2a4[_0x29300d];return _0x12d809;};'use strict';var _=require(_0x4f2a('0x0'));var util=require(_0x4f2a('0x1'));var moment=require(_0x4f2a('0x2'));var BPromise=require(_0x4f2a('0x3'));var rs=require(_0x4f2a('0x4'));var fs=require('fs');var Redis=require(_0x4f2a('0x5'));var db=require(_0x4f2a('0x6'))['db'];var utils=require(_0x4f2a('0x7'));var logger=require(_0x4f2a('0x8'))(_0x4f2a('0x9'));var config=require(_0x4f2a('0xa'));var jayson=require(_0x4f2a('0xb'));var client=jayson[_0x4f2a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3db558,_0x20fce7,_0x41ebc5){return new BPromise(function(_0x209157,_0x3b03d9){return client[_0x4f2a('0xd')](_0x3db558,_0x41ebc5)['then'](function(_0x304bdb){logger[_0x4f2a('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x20fce7,_0x4f2a('0xf'));logger[_0x4f2a('0x10')](_0x4f2a('0x11'),_0x20fce7,_0x4f2a('0xf'),JSON[_0x4f2a('0x12')](_0x304bdb));if(_0x304bdb[_0x4f2a('0x13')]){if(_0x304bdb['error']['code']===0x1f4){logger[_0x4f2a('0x13')](_0x4f2a('0x14'),_0x20fce7,_0x304bdb['error'][_0x4f2a('0x15')]);return _0x3b03d9(_0x304bdb['error'][_0x4f2a('0x15')]);}logger[_0x4f2a('0x13')](_0x4f2a('0x14'),_0x20fce7,_0x304bdb[_0x4f2a('0x13')]['message']);return _0x209157(_0x304bdb[_0x4f2a('0x13')]['message']);}else{logger[_0x4f2a('0xe')](_0x4f2a('0x14'),_0x20fce7,_0x4f2a('0xf'));_0x209157(_0x304bdb['result'][_0x4f2a('0x15')]);}})['catch'](function(_0x19e27f){logger[_0x4f2a('0x13')](_0x4f2a('0x14'),_0x20fce7,_0x19e27f);_0x3b03d9(_0x19e27f);});});} \ No newline at end of file +var _0x830a=['request','then','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyQuestionReport,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x395c06,_0x47df99){var _0x44ef35=function(_0xe0c390){while(--_0xe0c390){_0x395c06['push'](_0x395c06['shift']());}};_0x44ef35(++_0x47df99);}(_0x830a,0x145));var _0xa830=function(_0x35ad1d,_0x139af2){_0x35ad1d=_0x35ad1d-0x0;var _0x178bde=_0x830a[_0x35ad1d];return _0x178bde;};'use strict';var _=require(_0xa830('0x0'));var util=require(_0xa830('0x1'));var moment=require(_0xa830('0x2'));var BPromise=require(_0xa830('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa830('0x4'));var db=require(_0xa830('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa830('0x6'))(_0xa830('0x7'));var config=require('../../config/environment');var jayson=require(_0xa830('0x8'));var client=jayson[_0xa830('0x9')][_0xa830('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x218a22,_0x1f33df,_0x295dc9){return new BPromise(function(_0x43c3c8,_0x12a4fc){return client[_0xa830('0xb')](_0x218a22,_0x295dc9)[_0xa830('0xc')](function(_0x1bc23d){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x1f33df,_0xa830('0xd'));logger[_0xa830('0xe')](_0xa830('0xf'),_0x1f33df,_0xa830('0xd'),JSON[_0xa830('0x10')](_0x1bc23d));if(_0x1bc23d[_0xa830('0x11')]){if(_0x1bc23d['error'][_0xa830('0x12')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x1f33df,_0x1bc23d['error'][_0xa830('0x13')]);return _0x12a4fc(_0x1bc23d[_0xa830('0x11')][_0xa830('0x13')]);}logger[_0xa830('0x11')](_0xa830('0x14'),_0x1f33df,_0x1bc23d[_0xa830('0x11')][_0xa830('0x13')]);return _0x43c3c8(_0x1bc23d[_0xa830('0x11')][_0xa830('0x13')]);}else{logger[_0xa830('0x15')](_0xa830('0x14'),_0x1f33df,_0xa830('0xd'));_0x43c3c8(_0x1bc23d[_0xa830('0x16')][_0xa830('0x13')]);}})[_0xa830('0x17')](function(_0x428e9e){logger[_0xa830('0x11')](_0xa830('0x14'),_0x1f33df,_0x428e9e);_0x12a4fc(_0x428e9e);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index de69eb5..2167ceb 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 _0xc487=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/questions','getQuestions','post'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xc487,0x174));var _0x7c48=function(_0x3f5b69,_0x29662b){_0x3f5b69=_0x3f5b69-0x0;var _0x210d91=_0xc487[_0x3f5b69];return _0x210d91;};'use strict';var multer=require(_0x7c48('0x0'));var util=require(_0x7c48('0x1'));var path=require(_0x7c48('0x2'));var timeout=require(_0x7c48('0x3'));var express=require(_0x7c48('0x4'));var router=express[_0x7c48('0x5')]();var fs_extra=require(_0x7c48('0x6'));var auth=require(_0x7c48('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7c48('0x8'));var controller=require(_0x7c48('0x9'));router[_0x7c48('0xa')]('/',auth[_0x7c48('0xb')](),controller[_0x7c48('0xc')]);router[_0x7c48('0xa')](_0x7c48('0xd'),auth[_0x7c48('0xb')](),controller['describe']);router[_0x7c48('0xa')](_0x7c48('0xe'),auth['isAuthenticated'](),controller[_0x7c48('0xf')]);router[_0x7c48('0xa')](_0x7c48('0x10'),auth[_0x7c48('0xb')](),controller[_0x7c48('0x11')]);router[_0x7c48('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7c48('0x13')]);router[_0x7c48('0x14')](_0x7c48('0xe'),auth[_0x7c48('0xb')](),controller[_0x7c48('0x15')]);module[_0x7c48('0x16')]=router; \ No newline at end of file +var _0xa0bb=['./jscriptySessionReport.controller','get','isAuthenticated','describe','/:id','show','/:id/questions','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x329d31,_0x14e8ae){var _0x4b3cfc=function(_0x1d2659){while(--_0x1d2659){_0x329d31['push'](_0x329d31['shift']());}};_0x4b3cfc(++_0x14e8ae);}(_0xa0bb,0x7a));var _0xba0b=function(_0x3d9c5d,_0x594ced){_0x3d9c5d=_0x3d9c5d-0x0;var _0x2cafb5=_0xa0bb[_0x3d9c5d];return _0x2cafb5;};'use strict';var multer=require(_0xba0b('0x0'));var util=require(_0xba0b('0x1'));var path=require(_0xba0b('0x2'));var timeout=require(_0xba0b('0x3'));var express=require(_0xba0b('0x4'));var router=express[_0xba0b('0x5')]();var fs_extra=require(_0xba0b('0x6'));var auth=require(_0xba0b('0x7'));var interaction=require(_0xba0b('0x8'));var config=require(_0xba0b('0x9'));var controller=require(_0xba0b('0xa'));router[_0xba0b('0xb')]('/',auth[_0xba0b('0xc')](),controller['index']);router['get']('/describe',auth[_0xba0b('0xc')](),controller[_0xba0b('0xd')]);router[_0xba0b('0xb')](_0xba0b('0xe'),auth[_0xba0b('0xc')](),controller[_0xba0b('0xf')]);router[_0xba0b('0xb')](_0xba0b('0x10'),auth[_0xba0b('0xc')](),controller['getQuestions']);router[_0xba0b('0x11')]('/',auth[_0xba0b('0xc')](),controller[_0xba0b('0x12')]);router['put'](_0xba0b('0xe'),auth[_0xba0b('0xc')](),controller[_0xba0b('0x13')]);router[_0xba0b('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xba0b('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index d9c91ec..2d795a5 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 _0x605b=['BOOLEAN','moment','sequelize','exports','DATE','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x50dd8b,_0x3921a2){var _0x32c09d=function(_0x24d93c){while(--_0x24d93c){_0x50dd8b['push'](_0x50dd8b['shift']());}};_0x32c09d(++_0x3921a2);}(_0x605b,0xf4));var _0xb605=function(_0x2e1bc8,_0x1b4056){_0x2e1bc8=_0x2e1bc8-0x0;var _0x3cc4a3=_0x605b[_0x2e1bc8];return _0x3cc4a3;};'use strict';var moment=require(_0xb605('0x0'));var Sequelize=require(_0xb605('0x1'));module[_0xb605('0x2')]={'starttime':{'type':Sequelize[_0xb605('0x3')],'set':function(_0x582237){this[_0xb605('0x4')]('starttime',_0x582237);this['setDataValue'](_0xb605('0x5'),moment()['format'](_0xb605('0x6')));}},'endtime':{'type':Sequelize[_0xb605('0x3')]},'membername':{'type':Sequelize[_0xb605('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb605('0x7')]},'uniqueid':{'type':Sequelize[_0xb605('0x7')]},'calleridname':{'type':Sequelize[_0xb605('0x7')]},'calleridnum':{'type':Sequelize[_0xb605('0x7')]},'completed':{'type':Sequelize[_0xb605('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x6219=['exports','DATE','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize'];(function(_0x5e7c14,_0x9b9484){var _0x48fb3b=function(_0x53bda0){while(--_0x53bda0){_0x5e7c14['push'](_0x5e7c14['shift']());}};_0x48fb3b(++_0x9b9484);}(_0x6219,0xc4));var _0x9621=function(_0x1f62c3,_0x1ff95b){_0x1f62c3=_0x1f62c3-0x0;var _0x385c1c=_0x6219[_0x1f62c3];return _0x385c1c;};'use strict';var moment=require(_0x9621('0x0'));var Sequelize=require(_0x9621('0x1'));module[_0x9621('0x2')]={'starttime':{'type':Sequelize[_0x9621('0x3')],'set':function(_0x195d9f){this[_0x9621('0x4')]('starttime',_0x195d9f);this[_0x9621('0x4')](_0x9621('0x5'),moment()['format'](_0x9621('0x6')));}},'endtime':{'type':Sequelize[_0x9621('0x3')]},'membername':{'type':Sequelize[_0x9621('0x7')]},'projectname':{'type':Sequelize[_0x9621('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9621('0x7')]},'calleridname':{'type':Sequelize[_0x9621('0x7')]},'calleridnum':{'type':Sequelize[_0x9621('0x7')]},'completed':{'type':Sequelize[_0x9621('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index a0a834c..ac17c5c 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 _0xfcc8=['sort','where','VIRTUAL','filter','merge','options','count','includeAll','findAll','rows','catch','params','keys','include','find','create','body','describe','getQuestions','findOne','pick','SessionId','JscriptyQuestionReport','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','apply','save','update','then','destroy','end','error','stack','name','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfcc8,0xf8));var _0x8fcc=function(_0x432142,_0x96530d){_0x432142=_0x432142-0x0;var _0x1352ac=_0xfcc8[_0x432142];return _0x1352ac;};'use strict';var emlformat=require(_0x8fcc('0x0'));var rimraf=require(_0x8fcc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8fcc('0x2'));var BPromise=require(_0x8fcc('0x3'));var Mustache=require(_0x8fcc('0x4'));var util=require(_0x8fcc('0x5'));var path=require(_0x8fcc('0x6'));var sox=require(_0x8fcc('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8fcc('0x8'));var _=require(_0x8fcc('0x9'));var squel=require('squel');var crypto=require(_0x8fcc('0xa'));var jsforce=require(_0x8fcc('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8fcc('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8fcc('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x8fcc('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8fcc('0xf'));var utils=require(_0x8fcc('0x10'));var config=require(_0x8fcc('0x11'));var licenseUtil=require(_0x8fcc('0x12'));var db=require(_0x8fcc('0x13'))['db'];function respondWithStatusCode(_0x2b2ea5,_0x5bb3ae){_0x5bb3ae=_0x5bb3ae||0xcc;return function(_0xb13353){if(_0xb13353){return _0x2b2ea5[_0x8fcc('0x14')](_0x5bb3ae);}return _0x2b2ea5['status'](_0x5bb3ae)['end']();};}function respondWithResult(_0x16a81c,_0x2dd739){_0x2dd739=_0x2dd739||0xc8;return function(_0x535316){if(_0x535316){return _0x16a81c[_0x8fcc('0x15')](_0x2dd739)[_0x8fcc('0x16')](_0x535316);}};}function respondWithFilteredResult(_0x1e8a23,_0x35fe3e){return function(_0x4a1f3c){if(_0x4a1f3c){var _0x2a8ff0=typeof _0x35fe3e[_0x8fcc('0x17')]===_0x8fcc('0x18')&&typeof _0x35fe3e['limit']===_0x8fcc('0x18');var _0x445e5f=_0x4a1f3c['count'];var _0x5dea68=_0x2a8ff0?0x0:_0x35fe3e[_0x8fcc('0x17')];var _0x76aafe=_0x2a8ff0?_0x4a1f3c['count']:_0x35fe3e[_0x8fcc('0x17')]+_0x35fe3e[_0x8fcc('0x19')];var _0x152da2;if(_0x76aafe>=_0x445e5f){_0x76aafe=_0x445e5f;_0x152da2=0xc8;}else{_0x152da2=0xce;}_0x1e8a23['status'](_0x152da2);return _0x1e8a23[_0x8fcc('0x1a')]('Content-Range',_0x5dea68+'-'+_0x76aafe+'/'+_0x445e5f)[_0x8fcc('0x16')](_0x4a1f3c);}return null;};}function patchUpdates(_0x5ef373){return function(_0x404998){try{jsonpatch[_0x8fcc('0x1b')](_0x404998,_0x5ef373,!![]);}catch(_0xd73a26){return BPromise['reject'](_0xd73a26);}return _0x404998[_0x8fcc('0x1c')]();};}function saveUpdates(_0x599c89,_0x51ebbe){return function(_0x58a361){if(_0x58a361){return _0x58a361[_0x8fcc('0x1d')](_0x599c89)[_0x8fcc('0x1e')](function(_0x353178){return _0x353178;});}return null;};}function removeEntity(_0x39d50f,_0x39ea91){return function(_0x4a473b){if(_0x4a473b){return _0x4a473b[_0x8fcc('0x1f')]()[_0x8fcc('0x1e')](function(){_0x39d50f['status'](0xcc)[_0x8fcc('0x20')]();});}};}function handleEntityNotFound(_0x5d571b,_0x595a13){return function(_0x547ec3){if(!_0x547ec3){_0x5d571b[_0x8fcc('0x14')](0x194);}return _0x547ec3;};}function handleError(_0x42f795,_0x254356){_0x254356=_0x254356||0x1f4;return function(_0x466490){logger[_0x8fcc('0x21')](_0x466490[_0x8fcc('0x22')]);if(_0x466490[_0x8fcc('0x23')]){delete _0x466490[_0x8fcc('0x23')];}_0x42f795[_0x8fcc('0x15')](_0x254356)['send'](_0x466490);};}exports[_0x8fcc('0x24')]=function(_0x5f3b72,_0x12ce6e){var _0x336d41={},_0x224fb1={},_0xe9036a={'count':0x0,'rows':[]};var _0x40ea75=_[_0x8fcc('0x25')](db[_0x8fcc('0x26')][_0x8fcc('0x27')],function(_0x8e59ac){return{'name':_0x8e59ac['fieldName'],'type':_0x8e59ac[_0x8fcc('0x28')][_0x8fcc('0x29')]};});_0x224fb1[_0x8fcc('0x2a')]=_[_0x8fcc('0x25')](_0x40ea75,_0x8fcc('0x23'));_0x224fb1[_0x8fcc('0x2b')]=_['keys'](_0x5f3b72[_0x8fcc('0x2b')]);_0x224fb1[_0x8fcc('0x2c')]=_[_0x8fcc('0x2d')](_0x224fb1[_0x8fcc('0x2a')],_0x224fb1[_0x8fcc('0x2b')]);_0x336d41[_0x8fcc('0x2e')]=_[_0x8fcc('0x2d')](_0x224fb1['model'],qs[_0x8fcc('0x2f')](_0x5f3b72[_0x8fcc('0x2b')]['fields']));_0x336d41[_0x8fcc('0x2e')]=_0x336d41[_0x8fcc('0x2e')][_0x8fcc('0x30')]?_0x336d41['attributes']:_0x224fb1[_0x8fcc('0x2a')];if(!_0x5f3b72[_0x8fcc('0x2b')][_0x8fcc('0x31')](_0x8fcc('0x32'))){_0x336d41[_0x8fcc('0x19')]=qs[_0x8fcc('0x19')](_0x5f3b72[_0x8fcc('0x2b')]['limit']);_0x336d41['offset']=qs[_0x8fcc('0x17')](_0x5f3b72[_0x8fcc('0x2b')][_0x8fcc('0x17')]);}_0x336d41[_0x8fcc('0x33')]=qs[_0x8fcc('0x34')](_0x5f3b72[_0x8fcc('0x2b')][_0x8fcc('0x34')]);_0x336d41[_0x8fcc('0x35')]=qs[_0x8fcc('0x2c')](_['pick'](_0x5f3b72[_0x8fcc('0x2b')],_0x224fb1[_0x8fcc('0x2c')]),_0x40ea75);if(_0x5f3b72[_0x8fcc('0x2b')]['filter']){_0x336d41['where']=_['merge'](_0x336d41[_0x8fcc('0x35')],{'$or':_[_0x8fcc('0x25')](_0x40ea75,function(_0x3a045a){if(_0x3a045a['type']!==_0x8fcc('0x36')){var _0x40f947={};_0x40f947[_0x3a045a[_0x8fcc('0x23')]]={'$like':'%'+_0x5f3b72[_0x8fcc('0x2b')][_0x8fcc('0x37')]+'%'};return _0x40f947;}})});}_0x336d41=_[_0x8fcc('0x38')]({},_0x336d41,_0x5f3b72[_0x8fcc('0x39')]);var _0x51b0ee={'where':_0x336d41[_0x8fcc('0x35')]};return db[_0x8fcc('0x26')][_0x8fcc('0x3a')](_0x51b0ee)[_0x8fcc('0x1e')](function(_0x359a8e){_0xe9036a[_0x8fcc('0x3a')]=_0x359a8e;if(_0x5f3b72[_0x8fcc('0x2b')][_0x8fcc('0x3b')]){_0x336d41['include']=[{'all':!![]}];}return db[_0x8fcc('0x26')][_0x8fcc('0x3c')](_0x336d41);})[_0x8fcc('0x1e')](function(_0xe232b1){_0xe9036a[_0x8fcc('0x3d')]=_0xe232b1;return _0xe9036a;})[_0x8fcc('0x1e')](respondWithFilteredResult(_0x12ce6e,_0x336d41))[_0x8fcc('0x3e')](handleError(_0x12ce6e,null));};exports['show']=function(_0x9d0890,_0x5c6219){var _0x4ed3a9={'raw':!![],'where':{'id':_0x9d0890[_0x8fcc('0x3f')]['id']}},_0x48942a={};_0x48942a[_0x8fcc('0x2a')]=_[_0x8fcc('0x40')](db[_0x8fcc('0x26')][_0x8fcc('0x27')]);_0x48942a['query']=_[_0x8fcc('0x40')](_0x9d0890['query']);_0x48942a[_0x8fcc('0x2c')]=_[_0x8fcc('0x2d')](_0x48942a[_0x8fcc('0x2a')],_0x48942a['query']);_0x4ed3a9['attributes']=_[_0x8fcc('0x2d')](_0x48942a['model'],qs[_0x8fcc('0x2f')](_0x9d0890['query'][_0x8fcc('0x2f')]));_0x4ed3a9[_0x8fcc('0x2e')]=_0x4ed3a9[_0x8fcc('0x2e')]['length']?_0x4ed3a9[_0x8fcc('0x2e')]:_0x48942a[_0x8fcc('0x2a')];if(_0x9d0890[_0x8fcc('0x2b')][_0x8fcc('0x3b')]){_0x4ed3a9[_0x8fcc('0x41')]=[{'all':!![]}];}_0x4ed3a9=_[_0x8fcc('0x38')]({},_0x4ed3a9,_0x9d0890['options']);return db[_0x8fcc('0x26')][_0x8fcc('0x42')](_0x4ed3a9)[_0x8fcc('0x1e')](handleEntityNotFound(_0x5c6219,null))[_0x8fcc('0x1e')](respondWithResult(_0x5c6219,null))[_0x8fcc('0x3e')](handleError(_0x5c6219,null));};exports[_0x8fcc('0x43')]=function(_0x416dd9,_0xaeebb){return db['JscriptySessionReport'][_0x8fcc('0x43')](_0x416dd9[_0x8fcc('0x44')],{})[_0x8fcc('0x1e')](respondWithResult(_0xaeebb,0xc9))[_0x8fcc('0x3e')](handleError(_0xaeebb,null));};exports[_0x8fcc('0x1d')]=function(_0x27fa57,_0x53de17){if(_0x27fa57[_0x8fcc('0x44')]['id']){delete _0x27fa57['body']['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x27fa57['params']['id']}})[_0x8fcc('0x1e')](handleEntityNotFound(_0x53de17,null))['then'](saveUpdates(_0x27fa57['body'],null))['then'](respondWithResult(_0x53de17,null))[_0x8fcc('0x3e')](handleError(_0x53de17,null));};exports[_0x8fcc('0x1f')]=function(_0x55b2b4,_0x280444){return db[_0x8fcc('0x26')][_0x8fcc('0x42')]({'where':{'id':_0x55b2b4[_0x8fcc('0x3f')]['id']}})[_0x8fcc('0x1e')](handleEntityNotFound(_0x280444,null))[_0x8fcc('0x1e')](removeEntity(_0x280444,null))[_0x8fcc('0x3e')](handleError(_0x280444,null));};exports[_0x8fcc('0x45')]=function(_0x211fa0,_0x4faf9d){return db[_0x8fcc('0x26')][_0x8fcc('0x45')]()[_0x8fcc('0x1e')](respondWithResult(_0x4faf9d,null))[_0x8fcc('0x3e')](handleError(_0x4faf9d,null));};exports[_0x8fcc('0x46')]=function(_0x4dae5b,_0x76f4da,_0xbdaf0){var _0xcaa509={'raw':!![],'where':{}};var _0xd1f5f2={};var _0x5c2043={'count':0x0,'rows':[]};return db[_0x8fcc('0x26')][_0x8fcc('0x47')]({'where':{'id':_0x4dae5b['params']['id']}})[_0x8fcc('0x1e')](handleEntityNotFound(_0x76f4da,null))[_0x8fcc('0x1e')](function(_0x420ffa){if(_0x420ffa){_0xd1f5f2[_0x8fcc('0x2a')]=_[_0x8fcc('0x40')](db['JscriptyQuestionReport']['rawAttributes']);_0xd1f5f2['query']=_['keys'](_0x4dae5b['query']);_0xd1f5f2[_0x8fcc('0x2c')]=_['intersection'](_0xd1f5f2[_0x8fcc('0x2a')],_0xd1f5f2[_0x8fcc('0x2b')]);_0xcaa509['attributes']=_[_0x8fcc('0x2d')](_0xd1f5f2[_0x8fcc('0x2a')],qs[_0x8fcc('0x2f')](_0x4dae5b[_0x8fcc('0x2b')][_0x8fcc('0x2f')]));_0xcaa509[_0x8fcc('0x2e')]=_0xcaa509[_0x8fcc('0x2e')]['length']?_0xcaa509[_0x8fcc('0x2e')]:_0xd1f5f2['model'];if(!_0x4dae5b[_0x8fcc('0x2b')][_0x8fcc('0x31')]('nolimit')){_0xcaa509[_0x8fcc('0x19')]=qs[_0x8fcc('0x19')](_0x4dae5b[_0x8fcc('0x2b')][_0x8fcc('0x19')]);_0xcaa509[_0x8fcc('0x17')]=qs[_0x8fcc('0x17')](_0x4dae5b[_0x8fcc('0x2b')][_0x8fcc('0x17')]);}_0xcaa509['order']=qs[_0x8fcc('0x34')](_0x4dae5b['query'][_0x8fcc('0x34')]);_0xcaa509[_0x8fcc('0x35')]=qs[_0x8fcc('0x2c')](_[_0x8fcc('0x48')](_0x4dae5b['query'],_0xd1f5f2[_0x8fcc('0x2c')]));_0xcaa509['where'][_0x8fcc('0x49')]=_0x420ffa['id'];if(_0x4dae5b[_0x8fcc('0x2b')][_0x8fcc('0x37')]){_0xcaa509[_0x8fcc('0x35')]=_[_0x8fcc('0x38')](_0xcaa509['where'],{'$or':_[_0x8fcc('0x25')](_0xcaa509[_0x8fcc('0x2e')],function(_0x2c301c){var _0x379a57={};_0x379a57[_0x2c301c]={'$like':'%'+_0x4dae5b['query'][_0x8fcc('0x37')]+'%'};return _0x379a57;})});}_0xcaa509=_[_0x8fcc('0x38')]({},_0xcaa509,_0x4dae5b[_0x8fcc('0x39')]);return db[_0x8fcc('0x4a')][_0x8fcc('0x3a')]({'where':_0xcaa509[_0x8fcc('0x35')]})[_0x8fcc('0x1e')](function(_0x448381){_0x5c2043[_0x8fcc('0x3a')]=_0x448381;if(_0x4dae5b['query'][_0x8fcc('0x3b')]){_0xcaa509[_0x8fcc('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0xcaa509);})[_0x8fcc('0x1e')](function(_0x3a28b8){_0x5c2043[_0x8fcc('0x3d')]=_0x3a28b8;return _0x5c2043;});}})['then'](respondWithFilteredResult(_0x76f4da,_0xcaa509))['catch'](handleError(_0x76f4da,null));}; \ No newline at end of file +var _0x3a8b=['fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x5150aa,_0x572726){var _0x17abee=function(_0x1a447c){while(--_0x1a447c){_0x5150aa['push'](_0x5150aa['shift']());}};_0x17abee(++_0x572726);}(_0x3a8b,0x9c));var _0xb3a8=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x3a8b[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require(_0xb3a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb3a8('0x1'));var jsonpatch=require(_0xb3a8('0x2'));var rp=require('request-promise');var moment=require(_0xb3a8('0x3'));var BPromise=require(_0xb3a8('0x4'));var Mustache=require(_0xb3a8('0x5'));var util=require(_0xb3a8('0x6'));var path=require('path');var sox=require(_0xb3a8('0x7'));var csv=require(_0xb3a8('0x8'));var ejs=require(_0xb3a8('0x9'));var fs=require('fs');var fs_extra=require(_0xb3a8('0xa'));var _=require(_0xb3a8('0xb'));var squel=require(_0xb3a8('0xc'));var crypto=require(_0xb3a8('0xd'));var jsforce=require(_0xb3a8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb3a8('0x8'));var querystring=require(_0xb3a8('0xf'));var Papa=require(_0xb3a8('0x10'));var Redis=require(_0xb3a8('0x11'));var authService=require(_0xb3a8('0x12'));var qs=require(_0xb3a8('0x13'));var as=require(_0xb3a8('0x14'));var hardwareService=require(_0xb3a8('0x15'));var logger=require(_0xb3a8('0x16'))(_0xb3a8('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb3a8('0x18'));var db=require(_0xb3a8('0x19'))['db'];function respondWithStatusCode(_0x5ce080,_0x1b5198){_0x1b5198=_0x1b5198||0xcc;return function(_0xba217f){if(_0xba217f){return _0x5ce080['sendStatus'](_0x1b5198);}return _0x5ce080[_0xb3a8('0x1a')](_0x1b5198)['end']();};}function respondWithResult(_0xfaf75a,_0x562a81){_0x562a81=_0x562a81||0xc8;return function(_0x19b3d5){if(_0x19b3d5){return _0xfaf75a[_0xb3a8('0x1a')](_0x562a81)[_0xb3a8('0x1b')](_0x19b3d5);}};}function respondWithFilteredResult(_0x14d060,_0x13140e){return function(_0x4bc9d1){if(_0x4bc9d1){var _0x1f36cc=typeof _0x13140e[_0xb3a8('0x1c')]==='undefined'&&typeof _0x13140e[_0xb3a8('0x1d')]===_0xb3a8('0x1e');var _0xfc3d04=_0x4bc9d1[_0xb3a8('0x1f')];var _0x4f9e12=_0x1f36cc?0x0:_0x13140e[_0xb3a8('0x1c')];var _0x4a6b5d=_0x1f36cc?_0x4bc9d1[_0xb3a8('0x1f')]:_0x13140e['offset']+_0x13140e[_0xb3a8('0x1d')];var _0x29f1ff;if(_0x4a6b5d>=_0xfc3d04){_0x4a6b5d=_0xfc3d04;_0x29f1ff=0xc8;}else{_0x29f1ff=0xce;}_0x14d060['status'](_0x29f1ff);return _0x14d060['set'](_0xb3a8('0x20'),_0x4f9e12+'-'+_0x4a6b5d+'/'+_0xfc3d04)['json'](_0x4bc9d1);}return null;};}function patchUpdates(_0x50f102){return function(_0x5e0dd4){try{jsonpatch[_0xb3a8('0x21')](_0x5e0dd4,_0x50f102,!![]);}catch(_0x4c5d93){return BPromise[_0xb3a8('0x22')](_0x4c5d93);}return _0x5e0dd4[_0xb3a8('0x23')]();};}function saveUpdates(_0xe1869c,_0x4599e0){return function(_0x97dbd){if(_0x97dbd){return _0x97dbd[_0xb3a8('0x24')](_0xe1869c)['then'](function(_0x130478){return _0x130478;});}return null;};}function removeEntity(_0x56bef7,_0x2fb7f6){return function(_0x342835){if(_0x342835){return _0x342835[_0xb3a8('0x25')]()[_0xb3a8('0x26')](function(){_0x56bef7[_0xb3a8('0x1a')](0xcc)[_0xb3a8('0x27')]();});}};}function handleEntityNotFound(_0xda79c4,_0x1ba1c9){return function(_0xc978db){if(!_0xc978db){_0xda79c4[_0xb3a8('0x28')](0x194);}return _0xc978db;};}function handleError(_0x473ea3,_0x482126){_0x482126=_0x482126||0x1f4;return function(_0x16e557){logger[_0xb3a8('0x29')](_0x16e557[_0xb3a8('0x2a')]);if(_0x16e557[_0xb3a8('0x2b')]){delete _0x16e557[_0xb3a8('0x2b')];}_0x473ea3[_0xb3a8('0x1a')](_0x482126)[_0xb3a8('0x2c')](_0x16e557);};}exports[_0xb3a8('0x2d')]=function(_0x19c265,_0x4b4503){var _0x4fa9ed={},_0x45217d={},_0x8f032d={'count':0x0,'rows':[]};var _0x232dd0=_[_0xb3a8('0x2e')](db[_0xb3a8('0x2f')][_0xb3a8('0x30')],function(_0x4a3995){return{'name':_0x4a3995[_0xb3a8('0x31')],'type':_0x4a3995[_0xb3a8('0x32')][_0xb3a8('0x33')]};});_0x45217d['model']=_['map'](_0x232dd0,_0xb3a8('0x2b'));_0x45217d['query']=_[_0xb3a8('0x34')](_0x19c265['query']);_0x45217d['filters']=_[_0xb3a8('0x35')](_0x45217d[_0xb3a8('0x36')],_0x45217d[_0xb3a8('0x37')]);_0x4fa9ed[_0xb3a8('0x38')]=_[_0xb3a8('0x35')](_0x45217d[_0xb3a8('0x36')],qs[_0xb3a8('0x39')](_0x19c265[_0xb3a8('0x37')]['fields']));_0x4fa9ed['attributes']=_0x4fa9ed['attributes'][_0xb3a8('0x3a')]?_0x4fa9ed[_0xb3a8('0x38')]:_0x45217d[_0xb3a8('0x36')];if(!_0x19c265[_0xb3a8('0x37')][_0xb3a8('0x3b')]('nolimit')){_0x4fa9ed[_0xb3a8('0x1d')]=qs[_0xb3a8('0x1d')](_0x19c265['query'][_0xb3a8('0x1d')]);_0x4fa9ed['offset']=qs[_0xb3a8('0x1c')](_0x19c265[_0xb3a8('0x37')]['offset']);}_0x4fa9ed[_0xb3a8('0x3c')]=qs[_0xb3a8('0x3d')](_0x19c265[_0xb3a8('0x37')][_0xb3a8('0x3d')]);_0x4fa9ed[_0xb3a8('0x3e')]=qs[_0xb3a8('0x3f')](_[_0xb3a8('0x40')](_0x19c265[_0xb3a8('0x37')],_0x45217d['filters']),_0x232dd0);if(_0x19c265[_0xb3a8('0x37')][_0xb3a8('0x41')]){_0x4fa9ed[_0xb3a8('0x3e')]=_['merge'](_0x4fa9ed[_0xb3a8('0x3e')],{'$or':_[_0xb3a8('0x2e')](_0x232dd0,function(_0x5a79cf){if(_0x5a79cf[_0xb3a8('0x32')]!=='VIRTUAL'){var _0x304f38={};_0x304f38[_0x5a79cf[_0xb3a8('0x2b')]]={'$like':'%'+_0x19c265[_0xb3a8('0x37')]['filter']+'%'};return _0x304f38;}})});}_0x4fa9ed=_[_0xb3a8('0x42')]({},_0x4fa9ed,_0x19c265[_0xb3a8('0x43')]);var _0x3dc277={'where':_0x4fa9ed[_0xb3a8('0x3e')]};return db[_0xb3a8('0x2f')][_0xb3a8('0x1f')](_0x3dc277)['then'](function(_0x5f04ba){_0x8f032d['count']=_0x5f04ba;if(_0x19c265[_0xb3a8('0x37')][_0xb3a8('0x44')]){_0x4fa9ed[_0xb3a8('0x45')]=[{'all':!![]}];}return db[_0xb3a8('0x2f')][_0xb3a8('0x46')](_0x4fa9ed);})[_0xb3a8('0x26')](function(_0x44a9b6){_0x8f032d[_0xb3a8('0x47')]=_0x44a9b6;return _0x8f032d;})[_0xb3a8('0x26')](respondWithFilteredResult(_0x4b4503,_0x4fa9ed))[_0xb3a8('0x48')](handleError(_0x4b4503,null));};exports[_0xb3a8('0x49')]=function(_0x3a7930,_0x506d97){var _0x55814a={'raw':!![],'where':{'id':_0x3a7930[_0xb3a8('0x4a')]['id']}},_0x1fe589={};_0x1fe589[_0xb3a8('0x36')]=_[_0xb3a8('0x34')](db[_0xb3a8('0x2f')][_0xb3a8('0x30')]);_0x1fe589[_0xb3a8('0x37')]=_[_0xb3a8('0x34')](_0x3a7930['query']);_0x1fe589['filters']=_[_0xb3a8('0x35')](_0x1fe589['model'],_0x1fe589[_0xb3a8('0x37')]);_0x55814a[_0xb3a8('0x38')]=_[_0xb3a8('0x35')](_0x1fe589[_0xb3a8('0x36')],qs['fields'](_0x3a7930['query'][_0xb3a8('0x39')]));_0x55814a[_0xb3a8('0x38')]=_0x55814a[_0xb3a8('0x38')]['length']?_0x55814a[_0xb3a8('0x38')]:_0x1fe589[_0xb3a8('0x36')];if(_0x3a7930[_0xb3a8('0x37')][_0xb3a8('0x44')]){_0x55814a[_0xb3a8('0x45')]=[{'all':!![]}];}_0x55814a=_[_0xb3a8('0x42')]({},_0x55814a,_0x3a7930[_0xb3a8('0x43')]);return db[_0xb3a8('0x2f')][_0xb3a8('0x4b')](_0x55814a)[_0xb3a8('0x26')](handleEntityNotFound(_0x506d97,null))[_0xb3a8('0x26')](respondWithResult(_0x506d97,null))['catch'](handleError(_0x506d97,null));};exports[_0xb3a8('0x4c')]=function(_0x32c5de,_0x1e705a){return db[_0xb3a8('0x2f')][_0xb3a8('0x4c')](_0x32c5de[_0xb3a8('0x4d')],{})[_0xb3a8('0x26')](respondWithResult(_0x1e705a,0xc9))['catch'](handleError(_0x1e705a,null));};exports[_0xb3a8('0x24')]=function(_0x15e427,_0x43cb8d){if(_0x15e427[_0xb3a8('0x4d')]['id']){delete _0x15e427[_0xb3a8('0x4d')]['id'];}return db[_0xb3a8('0x2f')][_0xb3a8('0x4b')]({'where':{'id':_0x15e427[_0xb3a8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x43cb8d,null))['then'](saveUpdates(_0x15e427[_0xb3a8('0x4d')],null))['then'](respondWithResult(_0x43cb8d,null))[_0xb3a8('0x48')](handleError(_0x43cb8d,null));};exports[_0xb3a8('0x25')]=function(_0x1fab6a,_0x11f584){return db['JscriptySessionReport'][_0xb3a8('0x4b')]({'where':{'id':_0x1fab6a[_0xb3a8('0x4a')]['id']}})[_0xb3a8('0x26')](handleEntityNotFound(_0x11f584,null))['then'](removeEntity(_0x11f584,null))[_0xb3a8('0x48')](handleError(_0x11f584,null));};exports[_0xb3a8('0x4e')]=function(_0x96e7b0,_0x3e8f3b){return db[_0xb3a8('0x2f')][_0xb3a8('0x4e')]()[_0xb3a8('0x26')](respondWithResult(_0x3e8f3b,null))[_0xb3a8('0x48')](handleError(_0x3e8f3b,null));};exports[_0xb3a8('0x4f')]=function(_0x1ebc08,_0x5d0bb3,_0xf9820a){var _0x17c9bd={'raw':!![],'where':{}};var _0x3feff7={};var _0x22de18={'count':0x0,'rows':[]};return db[_0xb3a8('0x2f')][_0xb3a8('0x50')]({'where':{'id':_0x1ebc08['params']['id']}})[_0xb3a8('0x26')](handleEntityNotFound(_0x5d0bb3,null))[_0xb3a8('0x26')](function(_0x32df8c){if(_0x32df8c){_0x3feff7[_0xb3a8('0x36')]=_[_0xb3a8('0x34')](db[_0xb3a8('0x51')]['rawAttributes']);_0x3feff7[_0xb3a8('0x37')]=_[_0xb3a8('0x34')](_0x1ebc08[_0xb3a8('0x37')]);_0x3feff7[_0xb3a8('0x3f')]=_[_0xb3a8('0x35')](_0x3feff7[_0xb3a8('0x36')],_0x3feff7['query']);_0x17c9bd[_0xb3a8('0x38')]=_['intersection'](_0x3feff7[_0xb3a8('0x36')],qs['fields'](_0x1ebc08[_0xb3a8('0x37')][_0xb3a8('0x39')]));_0x17c9bd[_0xb3a8('0x38')]=_0x17c9bd[_0xb3a8('0x38')][_0xb3a8('0x3a')]?_0x17c9bd[_0xb3a8('0x38')]:_0x3feff7[_0xb3a8('0x36')];if(!_0x1ebc08['query'][_0xb3a8('0x3b')](_0xb3a8('0x52'))){_0x17c9bd['limit']=qs[_0xb3a8('0x1d')](_0x1ebc08['query'][_0xb3a8('0x1d')]);_0x17c9bd[_0xb3a8('0x1c')]=qs[_0xb3a8('0x1c')](_0x1ebc08[_0xb3a8('0x37')][_0xb3a8('0x1c')]);}_0x17c9bd[_0xb3a8('0x3c')]=qs[_0xb3a8('0x3d')](_0x1ebc08[_0xb3a8('0x37')][_0xb3a8('0x3d')]);_0x17c9bd[_0xb3a8('0x3e')]=qs['filters'](_['pick'](_0x1ebc08[_0xb3a8('0x37')],_0x3feff7[_0xb3a8('0x3f')]));_0x17c9bd[_0xb3a8('0x3e')]['SessionId']=_0x32df8c['id'];if(_0x1ebc08['query'][_0xb3a8('0x41')]){_0x17c9bd[_0xb3a8('0x3e')]=_[_0xb3a8('0x42')](_0x17c9bd[_0xb3a8('0x3e')],{'$or':_[_0xb3a8('0x2e')](_0x17c9bd[_0xb3a8('0x38')],function(_0xda6565){var _0xfb9a6b={};_0xfb9a6b[_0xda6565]={'$like':'%'+_0x1ebc08[_0xb3a8('0x37')][_0xb3a8('0x41')]+'%'};return _0xfb9a6b;})});}_0x17c9bd=_[_0xb3a8('0x42')]({},_0x17c9bd,_0x1ebc08[_0xb3a8('0x43')]);return db[_0xb3a8('0x51')][_0xb3a8('0x1f')]({'where':_0x17c9bd[_0xb3a8('0x3e')]})['then'](function(_0x15496f){_0x22de18[_0xb3a8('0x1f')]=_0x15496f;if(_0x1ebc08[_0xb3a8('0x37')]['includeAll']){_0x17c9bd['include']=[{'all':!![]}];}return db[_0xb3a8('0x51')][_0xb3a8('0x46')](_0x17c9bd);})[_0xb3a8('0x26')](function(_0x33fd22){_0x22de18['rows']=_0x33fd22;return _0x22de18;});}})[_0xb3a8('0x26')](respondWithFilteredResult(_0x5d0bb3,_0x17c9bd))[_0xb3a8('0x48')](handleError(_0x5d0bb3,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 255873c..d559797 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 _0x7278=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports'];(function(_0x3b9e30,_0x32f96a){var _0x3a8b2c=function(_0x3e1a77){while(--_0x3e1a77){_0x3b9e30['push'](_0x3b9e30['shift']());}};_0x3a8b2c(++_0x32f96a);}(_0x7278,0x161));var _0x8727=function(_0x2708b2,_0x1332b2){_0x2708b2=_0x2708b2-0x0;var _0x38c2cd=_0x7278[_0x2708b2];return _0x38c2cd;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));module[_0x8727('0xa')]=function(_0x180b71,_0x5549d5){return _0x180b71[_0x8727('0xb')](_0x8727('0xc'),attributes,{'tableName':_0x8727('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['moment','request-promise','path','rimraf','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x5c9965,_0x4dca91){var _0x34f916=function(_0x436dce){while(--_0x436dce){_0x5c9965['push'](_0x5c9965['shift']());}};_0x34f916(++_0x4dca91);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x564c7b,_0x9fea9c){_0x564c7b=_0x564c7b-0x0;var _0x1a1fa4=_0xc1c6[_0x564c7b];return _0x1a1fa4;};'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('./jscriptySessionReport.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 0d4888d..105a96c 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 _0xd046=['ioredis','../../config/logger','../../config/environment','http','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xd046,0x129));var _0x6d04=function(_0x293681,_0x3bab78){_0x293681=_0x293681-0x0;var _0x4c090a=_0xd046[_0x293681];return _0x4c090a;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var moment=require(_0x6d04('0x1'));var BPromise=require(_0x6d04('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d04('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d04('0x4'))('rpc');var config=require(_0x6d04('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6d04('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1968c4,_0x4f83bc,_0x569c7b){return new BPromise(function(_0x2e2c01,_0x42aa22){return client['request'](_0x1968c4,_0x569c7b)['then'](function(_0x27a3d6){logger['info'](_0x6d04('0x7'),_0x4f83bc,'request\x20sent');logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4f83bc,_0x6d04('0x8'),JSON[_0x6d04('0x9')](_0x27a3d6));if(_0x27a3d6[_0x6d04('0xa')]){if(_0x27a3d6[_0x6d04('0xa')]['code']===0x1f4){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x42aa22(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x2e2c01(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}else{logger[_0x6d04('0xc')](_0x6d04('0x7'),_0x4f83bc,_0x6d04('0x8'));_0x2e2c01(_0x27a3d6[_0x6d04('0xd')][_0x6d04('0xb')]);}})[_0x6d04('0xe')](function(_0xed5538){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0xed5538);_0x42aa22(_0xed5538);});});} \ No newline at end of file +var _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x201c3d,_0x3958fa){var _0x49e93c=function(_0x55efe0){while(--_0x55efe0){_0x201c3d['push'](_0x201c3d['shift']());}};_0x49e93c(++_0x3958fa);}(_0x1623,0xab));var _0x3162=function(_0x5d8716,_0x433b80){_0x5d8716=_0x5d8716-0x0;var _0x57b83d=_0x1623[_0x5d8716];return _0x57b83d;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 0c336cd..3881b3b 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 _0xcc0b=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./license.controller','index','put','/:id','isAuthenticated','update','exports','multer','util','connect-timeout'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xcc0b,0xc0));var _0xbcc0=function(_0x4eaa4c,_0x2f7422){_0x4eaa4c=_0x4eaa4c-0x0;var _0x15aec6=_0xcc0b[_0x4eaa4c];return _0x15aec6;};'use strict';var multer=require(_0xbcc0('0x0'));var util=require(_0xbcc0('0x1'));var path=require('path');var timeout=require(_0xbcc0('0x2'));var express=require(_0xbcc0('0x3'));var router=express[_0xbcc0('0x4')]();var fs_extra=require(_0xbcc0('0x5'));var auth=require(_0xbcc0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbcc0('0x7'));var controller=require(_0xbcc0('0x8'));router['get']('/',controller[_0xbcc0('0x9')]);router[_0xbcc0('0xa')](_0xbcc0('0xb'),auth[_0xbcc0('0xc')](),controller[_0xbcc0('0xd')]);module[_0xbcc0('0xe')]=router; \ No newline at end of file +var _0x9f75=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','update','exports','multer','path'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0x9f75,0x15a));var _0x59f7=function(_0x26fe57,_0x3761dc){_0x26fe57=_0x26fe57-0x0;var _0x127267=_0x9f75[_0x26fe57];return _0x127267;};'use strict';var multer=require(_0x59f7('0x0'));var util=require('util');var path=require(_0x59f7('0x1'));var timeout=require(_0x59f7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x59f7('0x3'));var auth=require(_0x59f7('0x4'));var interaction=require(_0x59f7('0x5'));var config=require(_0x59f7('0x6'));var controller=require('./license.controller');router[_0x59f7('0x7')]('/',controller[_0x59f7('0x8')]);router['put']('/:id',auth[_0x59f7('0x9')](),controller[_0x59f7('0xa')]);module[_0x59f7('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index dc8f04f..e7a1f91 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 _0x2403=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x53d292,_0x5f15eb){var _0x1b0027=function(_0x2276d7){while(--_0x2276d7){_0x53d292['push'](_0x53d292['shift']());}};_0x1b0027(++_0x5f15eb);}(_0x2403,0x1b1));var _0x3240=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2403[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x3240('0x0'));module[_0x3240('0x1')]={'license':{'type':Sequelize[_0x3240('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x3240('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x3240('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc6e1=['STRING','INTEGER','sequelize','TEXT'];(function(_0x57aeda,_0x446504){var _0x139dec=function(_0x5bd869){while(--_0x5bd869){_0x57aeda['push'](_0x57aeda['shift']());}};_0x139dec(++_0x446504);}(_0xc6e1,0x126));var _0x1c6e=function(_0x5bd5bc,_0x4027d9){_0x5bd5bc=_0x5bd5bc-0x0;var _0x405214=_0xc6e1[_0x5bd5bc];return _0x405214;};'use strict';var Sequelize=require(_0x1c6e('0x0'));module['exports']={'license':{'type':Sequelize[_0x1c6e('0x1')]},'data1':{'type':Sequelize[_0x1c6e('0x2')]},'data2':{'type':Sequelize[_0x1c6e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x1c6e('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index b557095..89ccec0 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 _0x1261=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','index','model','License','query','intersection','fields','attributes','merge','options','getLicense','catch','body','find','params','get','key','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis'];(function(_0x58953b,_0x321ab8){var _0x4ef006=function(_0x30b448){while(--_0x30b448){_0x58953b['push'](_0x58953b['shift']());}};_0x4ef006(++_0x321ab8);}(_0x1261,0x144));var _0x1126=function(_0x1b45a1,_0x9dbb01){_0x1b45a1=_0x1b45a1-0x0;var _0x5e9b25=_0x1261[_0x1b45a1];return _0x5e9b25;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}var utilLicense=require('../../config/license/util');exports[_0x1126('0x29')]=function(_0x23d2bc,_0x4a334a){var _0x3fa694={'raw':!![],'where':{'id':0x1}},_0x4bf807={};_0x4bf807[_0x1126('0x2a')]=_['keys'](db[_0x1126('0x2b')]['rawAttributes']);_0x4bf807[_0x1126('0x2c')]=_['keys'](_0x23d2bc['query']);_0x4bf807['filters']=_[_0x1126('0x2d')](_0x4bf807[_0x1126('0x2a')],_0x4bf807[_0x1126('0x2c')]);_0x3fa694['attributes']=_[_0x1126('0x2d')](_0x4bf807[_0x1126('0x2a')],qs['fields'](_0x23d2bc[_0x1126('0x2c')][_0x1126('0x2e')]));_0x3fa694[_0x1126('0x2f')]=_0x3fa694[_0x1126('0x2f')]['length']?_0x3fa694['attributes']:_0x4bf807[_0x1126('0x2a')];_0x3fa694=_[_0x1126('0x30')]({},_0x3fa694,_0x23d2bc[_0x1126('0x31')]);return utilLicense[_0x1126('0x32')](_0x3fa694)['then'](respondWithResult(_0x4a334a,null))[_0x1126('0x33')](handleError(_0x4a334a,null));};exports[_0x1126('0x24')]=function(_0x313ebe,_0x22436c){if(_0x313ebe[_0x1126('0x34')]['id']){delete _0x313ebe['body']['id'];}return db[_0x1126('0x2b')][_0x1126('0x35')]({'where':{'id':_0x313ebe[_0x1126('0x36')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0x22436c,null))['then'](function(_0x4ca51c){var _0x22827a=_0x4ca51c[_0x1126('0x37')]({'plain':!![]});return utilLicense['checkLicense'](_0x22827a,_0x313ebe[_0x1126('0x34')][_0x1126('0x38')]);})[_0x1126('0x25')](function(_0x5c08b9){if(!_0x5c08b9['demo']){return saveUpdates(_0x313ebe[_0x1126('0x34')],null);}return _0x5c08b9;})[_0x1126('0x25')](respondWithResult(_0x22436c,null))[_0x1126('0x33')](handleError(_0x22436c,null));}; \ No newline at end of file +var _0x5fab=['checkLicense','key','demo','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','merge','then','catch','body','find','params'];(function(_0x4fd332,_0x33a45e){var _0x3d5795=function(_0x3d05b5){while(--_0x3d05b5){_0x4fd332['push'](_0x4fd332['shift']());}};_0x3d5795(++_0x33a45e);}(_0x5fab,0x177));var _0xb5fa=function(_0x36147b,_0x57f40b){_0x36147b=_0x36147b-0x0;var _0x141351=_0x5fab[_0x36147b];return _0x141351;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];function respondWithStatusCode(_0x4d3576,_0x2ad830){_0x2ad830=_0x2ad830||0xcc;return function(_0x3dad4d){if(_0x3dad4d){return _0x4d3576['sendStatus'](_0x2ad830);}return _0x4d3576[_0xb5fa('0x1a')](_0x2ad830)['end']();};}function respondWithResult(_0x265992,_0x3fc372){_0x3fc372=_0x3fc372||0xc8;return function(_0x40c914){if(_0x40c914){return _0x265992[_0xb5fa('0x1a')](_0x3fc372)[_0xb5fa('0x1b')](_0x40c914);}};}function respondWithFilteredResult(_0x5371cf,_0x567f31){return function(_0x38e964){if(_0x38e964){var _0x587043=typeof _0x567f31[_0xb5fa('0x1c')]===_0xb5fa('0x1d')&&typeof _0x567f31['limit']==='undefined';var _0x451a55=_0x38e964[_0xb5fa('0x1e')];var _0x32e9e5=_0x587043?0x0:_0x567f31[_0xb5fa('0x1c')];var _0x324ba5=_0x587043?_0x38e964[_0xb5fa('0x1e')]:_0x567f31[_0xb5fa('0x1c')]+_0x567f31[_0xb5fa('0x1f')];var _0xc14dc4;if(_0x324ba5>=_0x451a55){_0x324ba5=_0x451a55;_0xc14dc4=0xc8;}else{_0xc14dc4=0xce;}_0x5371cf[_0xb5fa('0x1a')](_0xc14dc4);return _0x5371cf[_0xb5fa('0x20')](_0xb5fa('0x21'),_0x32e9e5+'-'+_0x324ba5+'/'+_0x451a55)['json'](_0x38e964);}return null;};}function patchUpdates(_0x432bfa){return function(_0x519e20){try{jsonpatch[_0xb5fa('0x22')](_0x519e20,_0x432bfa,!![]);}catch(_0x4a6c04){return BPromise[_0xb5fa('0x23')](_0x4a6c04);}return _0x519e20[_0xb5fa('0x24')]();};}function saveUpdates(_0x4e05c0,_0x40dfdf){return function(_0x3a2ab9){if(_0x3a2ab9){return _0x3a2ab9[_0xb5fa('0x25')](_0x4e05c0)['then'](function(_0x32a85c){return _0x32a85c;});}return null;};}function removeEntity(_0xec108f,_0x444237){return function(_0x542348){if(_0x542348){return _0x542348[_0xb5fa('0x26')]()['then'](function(){_0xec108f[_0xb5fa('0x1a')](0xcc)[_0xb5fa('0x27')]();});}};}function handleEntityNotFound(_0x11053a,_0x543edf){return function(_0x2dbd22){if(!_0x2dbd22){_0x11053a[_0xb5fa('0x28')](0x194);}return _0x2dbd22;};}function handleError(_0x6a455c,_0x20d649){_0x20d649=_0x20d649||0x1f4;return function(_0x568870){logger['error'](_0x568870['stack']);if(_0x568870['name']){delete _0x568870[_0xb5fa('0x29')];}_0x6a455c[_0xb5fa('0x1a')](_0x20d649)[_0xb5fa('0x2a')](_0x568870);};}var utilLicense=require(_0xb5fa('0x18'));exports[_0xb5fa('0x2b')]=function(_0x3506a4,_0x358549){var _0x353314={'raw':!![],'where':{'id':0x1}},_0x409af9={};_0x409af9[_0xb5fa('0x2c')]=_[_0xb5fa('0x2d')](db[_0xb5fa('0x2e')][_0xb5fa('0x2f')]);_0x409af9[_0xb5fa('0x30')]=_[_0xb5fa('0x2d')](_0x3506a4[_0xb5fa('0x30')]);_0x409af9[_0xb5fa('0x31')]=_[_0xb5fa('0x32')](_0x409af9[_0xb5fa('0x2c')],_0x409af9[_0xb5fa('0x30')]);_0x353314[_0xb5fa('0x33')]=_[_0xb5fa('0x32')](_0x409af9[_0xb5fa('0x2c')],qs[_0xb5fa('0x34')](_0x3506a4['query'][_0xb5fa('0x34')]));_0x353314['attributes']=_0x353314['attributes']['length']?_0x353314[_0xb5fa('0x33')]:_0x409af9['model'];_0x353314=_[_0xb5fa('0x35')]({},_0x353314,_0x3506a4['options']);return utilLicense['getLicense'](_0x353314)[_0xb5fa('0x36')](respondWithResult(_0x358549,null))[_0xb5fa('0x37')](handleError(_0x358549,null));};exports['update']=function(_0x59f41d,_0x3d73c2){if(_0x59f41d[_0xb5fa('0x38')]['id']){delete _0x59f41d[_0xb5fa('0x38')]['id'];}return db['License'][_0xb5fa('0x39')]({'where':{'id':_0x59f41d[_0xb5fa('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3d73c2,null))[_0xb5fa('0x36')](function(_0x2056de){var _0x204d6b=_0x2056de['get']({'plain':!![]});return utilLicense[_0xb5fa('0x3b')](_0x204d6b,_0x59f41d[_0xb5fa('0x38')][_0xb5fa('0x3c')]);})['then'](function(_0x117694){if(!_0x117694[_0xb5fa('0x3d')]){return saveUpdates(_0x59f41d[_0xb5fa('0x38')],null);}return _0x117694;})[_0xb5fa('0x36')](respondWithResult(_0x3d73c2,null))['catch'](handleError(_0x3d73c2,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 50aaeed..98a0701 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 _0x40ca=['request-promise','path','rimraf','../../config/environment','./license.attributes','define','license','lodash','util','../../config/logger','api'];(function(_0x521b8a,_0xac9f6b){var _0x5d1ebf=function(_0x149cc3){while(--_0x149cc3){_0x521b8a['push'](_0x521b8a['shift']());}};_0x5d1ebf(++_0xac9f6b);}(_0x40ca,0xee));var _0xa40c=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x40ca[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0xa40c('0x0'));var util=require(_0xa40c('0x1'));var logger=require(_0xa40c('0x2'))(_0xa40c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa40c('0x4'));var fs=require('fs');var path=require(_0xa40c('0x5'));var rimraf=require(_0xa40c('0x6'));var config=require(_0xa40c('0x7'));var attributes=require(_0xa40c('0x8'));module['exports']=function(_0x3162fc,_0x82fef3){return _0x3162fc[_0xa40c('0x9')]('License',attributes,{'tableName':_0xa40c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f07=['bluebird','request-promise','path','../../config/environment','./license.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x33fc83,_0x1ff55c){var _0x19911d=function(_0x2da152){while(--_0x2da152){_0x33fc83['push'](_0x33fc83['shift']());}};_0x19911d(++_0x1ff55c);}(_0x6f07,0x14b));var _0x76f0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6f07[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x76f0('0x0'));var util=require(_0x76f0('0x1'));var logger=require(_0x76f0('0x2'))(_0x76f0('0x3'));var moment=require(_0x76f0('0x4'));var BPromise=require(_0x76f0('0x5'));var rp=require(_0x76f0('0x6'));var fs=require('fs');var path=require(_0x76f0('0x7'));var rimraf=require('rimraf');var config=require(_0x76f0('0x8'));var attributes=require(_0x76f0('0x9'));module[_0x76f0('0xa')]=function(_0x50e892,_0x12f7a0){return _0x50e892[_0x76f0('0xb')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 270d436..a9214a8 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 _0x62fc=['debug','License,\x20%s,\x20%s,\x20%s','error','message','result','util','bluebird','randomstring','ioredis','../../config/utils','http','then','info','License,\x20%s,\x20%s','request\x20sent'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x62fc,0x113));var _0xc62f=function(_0x584c9c,_0x3aa993){_0x584c9c=_0x584c9c-0x0;var _0x873851=_0x62fc[_0x584c9c];return _0x873851;};'use strict';var _=require('lodash');var util=require(_0xc62f('0x0'));var moment=require('moment');var BPromise=require(_0xc62f('0x1'));var rs=require(_0xc62f('0x2'));var fs=require('fs');var Redis=require(_0xc62f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc62f('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc62f('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x54a3ae,_0x106823,_0x8b58df){return new BPromise(function(_0x58c400,_0x484919){return client['request'](_0x54a3ae,_0x8b58df)[_0xc62f('0x6')](function(_0x3dbd96){logger[_0xc62f('0x7')](_0xc62f('0x8'),_0x106823,_0xc62f('0x9'));logger[_0xc62f('0xa')](_0xc62f('0xb'),_0x106823,'request\x20sent',JSON['stringify'](_0x3dbd96));if(_0x3dbd96[_0xc62f('0xc')]){if(_0x3dbd96[_0xc62f('0xc')]['code']===0x1f4){logger[_0xc62f('0xc')](_0xc62f('0x8'),_0x106823,_0x3dbd96[_0xc62f('0xc')][_0xc62f('0xd')]);return _0x484919(_0x3dbd96['error'][_0xc62f('0xd')]);}logger[_0xc62f('0xc')](_0xc62f('0x8'),_0x106823,_0x3dbd96[_0xc62f('0xc')]['message']);return _0x58c400(_0x3dbd96[_0xc62f('0xc')][_0xc62f('0xd')]);}else{logger[_0xc62f('0x7')]('License,\x20%s,\x20%s',_0x106823,_0xc62f('0x9'));_0x58c400(_0x3dbd96[_0xc62f('0xe')][_0xc62f('0xd')]);}})['catch'](function(_0x498cc3){logger[_0xc62f('0xc')]('License,\x20%s,\x20%s',_0x106823,_0x498cc3);_0x484919(_0x498cc3);});});} \ No newline at end of file +var _0x25b9=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','request\x20sent','debug','error','code','License,\x20%s,\x20%s','message','lodash','bluebird','randomstring','ioredis'];(function(_0x4b609c,_0x53d9aa){var _0x2335c3=function(_0xe0b977){while(--_0xe0b977){_0x4b609c['push'](_0x4b609c['shift']());}};_0x2335c3(++_0x53d9aa);}(_0x25b9,0xb7));var _0x925b=function(_0x2c23af,_0x1ef6ec){_0x2c23af=_0x2c23af-0x0;var _0x31d4f7=_0x25b9[_0x2c23af];return _0x31d4f7;};'use strict';var _=require(_0x925b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x925b('0x1'));var rs=require(_0x925b('0x2'));var fs=require('fs');var Redis=require(_0x925b('0x3'));var db=require(_0x925b('0x4'))['db'];var utils=require(_0x925b('0x5'));var logger=require(_0x925b('0x6'))(_0x925b('0x7'));var config=require('../../config/environment');var jayson=require(_0x925b('0x8'));var client=jayson[_0x925b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26e2f8,_0x1b3bcb,_0x237a34){return new BPromise(function(_0x356a13,_0xe646f1){return client['request'](_0x26e2f8,_0x237a34)['then'](function(_0x45ae70){logger[_0x925b('0xa')]('License,\x20%s,\x20%s',_0x1b3bcb,_0x925b('0xb'));logger[_0x925b('0xc')]('License,\x20%s,\x20%s,\x20%s',_0x1b3bcb,_0x925b('0xb'),JSON['stringify'](_0x45ae70));if(_0x45ae70[_0x925b('0xd')]){if(_0x45ae70[_0x925b('0xd')][_0x925b('0xe')]===0x1f4){logger['error'](_0x925b('0xf'),_0x1b3bcb,_0x45ae70[_0x925b('0xd')]['message']);return _0xe646f1(_0x45ae70[_0x925b('0xd')][_0x925b('0x10')]);}logger['error'](_0x925b('0xf'),_0x1b3bcb,_0x45ae70[_0x925b('0xd')]['message']);return _0x356a13(_0x45ae70['error'][_0x925b('0x10')]);}else{logger[_0x925b('0xa')](_0x925b('0xf'),_0x1b3bcb,'request\x20sent');_0x356a13(_0x45ae70['result']['message']);}})['catch'](function(_0x376914){logger[_0x925b('0xd')]('License,\x20%s,\x20%s',_0x1b3bcb,_0x376914);_0xe646f1(_0x376914);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index e004cae..3312668 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 _0x07d8=['/:id/dispositions','post','addAnswer','create','addImap','/:id/interactions','addInteraction','addApplications','/:id/send','send','addAgents','put','update','removeDispositions','removeAnswers','delete','removeImap','/:id/out_servers','removeSmtp','destroy','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','index','get','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents'];(function(_0x101dce,_0x3b887c){var _0x5a92bb=function(_0x5bac04){while(--_0x5bac04){_0x101dce['push'](_0x101dce['shift']());}};_0x5a92bb(++_0x3b887c);}(_0x07d8,0xab));var _0x807d=function(_0x346f68,_0xb45d9d){_0x346f68=_0x346f68-0x0;var _0x2d1803=_0x07d8[_0x346f68];return _0x2d1803;};'use strict';var multer=require(_0x807d('0x0'));var util=require('util');var path=require(_0x807d('0x1'));var timeout=require(_0x807d('0x2'));var express=require(_0x807d('0x3'));var router=express[_0x807d('0x4')]();var fs_extra=require(_0x807d('0x5'));var auth=require(_0x807d('0x6'));var interaction=require(_0x807d('0x7'));var config=require(_0x807d('0x8'));var controller=require(_0x807d('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x807d('0xa')]);router[_0x807d('0xb')]('/describe',auth[_0x807d('0xc')](),controller[_0x807d('0xd')]);router['get'](_0x807d('0xe'),auth[_0x807d('0xc')](),controller[_0x807d('0xf')]);router[_0x807d('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x807d('0x10')]);router[_0x807d('0xb')](_0x807d('0x11'),auth[_0x807d('0xc')](),controller[_0x807d('0x12')]);router[_0x807d('0xb')](_0x807d('0x13'),auth[_0x807d('0xc')](),controller['getImap']);router[_0x807d('0xb')]('/:id/out_servers',auth[_0x807d('0xc')](),controller[_0x807d('0x14')]);router[_0x807d('0xb')]('/:id/interactions',auth[_0x807d('0xc')](),controller[_0x807d('0x15')]);router[_0x807d('0xb')](_0x807d('0x16'),auth['isAuthenticated'](),controller[_0x807d('0x17')]);router[_0x807d('0xb')](_0x807d('0x18'),auth[_0x807d('0xc')](),controller['getMessages']);router[_0x807d('0xb')](_0x807d('0x19'),auth[_0x807d('0xc')](),controller[_0x807d('0x1a')]);router[_0x807d('0xb')](_0x807d('0x1b'),auth['isAuthenticated'](),controller[_0x807d('0x1c')]);router['post'](_0x807d('0x1d'),auth[_0x807d('0xc')](),controller['addDisposition']);router[_0x807d('0x1e')]('/:id/canned_answers',auth[_0x807d('0xc')](),controller[_0x807d('0x1f')]);router[_0x807d('0x1e')]('/',auth[_0x807d('0xc')](),controller[_0x807d('0x20')]);router['post']('/:id/in_servers',auth['isAuthenticated'](),controller[_0x807d('0x21')]);router[_0x807d('0x1e')]('/:id/out_servers',auth[_0x807d('0xc')](),controller['addSmtp']);router[_0x807d('0x1e')](_0x807d('0x22'),auth[_0x807d('0xc')](),controller[_0x807d('0x23')]);router['post']('/:id/applications',auth[_0x807d('0xc')](),controller[_0x807d('0x24')]);router['post'](_0x807d('0x25'),auth[_0x807d('0xc')](),controller[_0x807d('0x26')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x807d('0x27')]);router[_0x807d('0x28')](_0x807d('0xe'),auth[_0x807d('0xc')](),controller[_0x807d('0x29')]);router['delete'](_0x807d('0x1d'),auth[_0x807d('0xc')](),controller[_0x807d('0x2a')]);router['delete'](_0x807d('0x11'),auth['isAuthenticated'](),controller[_0x807d('0x2b')]);router[_0x807d('0x2c')]('/:id/in_servers',auth[_0x807d('0xc')](),controller[_0x807d('0x2d')]);router[_0x807d('0x2c')](_0x807d('0x2e'),auth['isAuthenticated'](),controller[_0x807d('0x2f')]);router[_0x807d('0x2c')]('/:id',auth[_0x807d('0xc')](),controller[_0x807d('0x30')]);router[_0x807d('0x2c')]('/:id/users',auth[_0x807d('0xc')](),controller[_0x807d('0x31')]);module['exports']=router; \ No newline at end of file +var _0x240f=['update','removeDispositions','delete','removeAnswers','removeImap','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','create','addSmtp','addInteraction','addApplications','/:id/send','/:id/users','addAgents','put'];(function(_0x23730a,_0x8aad83){var _0x1c5bb5=function(_0x4e95fc){while(--_0x4e95fc){_0x23730a['push'](_0x23730a['shift']());}};_0x1c5bb5(++_0x8aad83);}(_0x240f,0x12e));var _0xf240=function(_0x125c7b,_0x13929f){_0x125c7b=_0x125c7b-0x0;var _0xd7b82d=_0x240f[_0x125c7b];return _0xd7b82d;};'use strict';var multer=require(_0xf240('0x0'));var util=require(_0xf240('0x1'));var path=require(_0xf240('0x2'));var timeout=require(_0xf240('0x3'));var express=require('express');var router=express[_0xf240('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf240('0x5'));var config=require(_0xf240('0x6'));var controller=require(_0xf240('0x7'));router[_0xf240('0x8')]('/',auth[_0xf240('0x9')](),controller[_0xf240('0xa')]);router[_0xf240('0x8')](_0xf240('0xb'),auth['isAuthenticated'](),controller[_0xf240('0xc')]);router[_0xf240('0x8')](_0xf240('0xd'),auth['isAuthenticated'](),controller[_0xf240('0xe')]);router[_0xf240('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf240('0xf')]);router[_0xf240('0x8')]('/:id/canned_answers',auth[_0xf240('0x9')](),controller[_0xf240('0x10')]);router['get'](_0xf240('0x11'),auth[_0xf240('0x9')](),controller[_0xf240('0x12')]);router['get'](_0xf240('0x13'),auth[_0xf240('0x9')](),controller[_0xf240('0x14')]);router[_0xf240('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xf240('0x15')]);router[_0xf240('0x8')](_0xf240('0x16'),auth[_0xf240('0x9')](),controller[_0xf240('0x17')]);router['get'](_0xf240('0x18'),auth[_0xf240('0x9')](),controller[_0xf240('0x19')]);router[_0xf240('0x8')]('/:id/verify',auth['isAuthenticated'](),controller[_0xf240('0x1a')]);router['get']('/:id/users',auth[_0xf240('0x9')](),controller[_0xf240('0x1b')]);router[_0xf240('0x1c')](_0xf240('0x1d'),auth[_0xf240('0x9')](),controller[_0xf240('0x1e')]);router[_0xf240('0x1c')](_0xf240('0x1f'),auth['isAuthenticated'](),controller[_0xf240('0x20')]);router['post']('/',auth[_0xf240('0x9')](),controller[_0xf240('0x21')]);router[_0xf240('0x1c')](_0xf240('0x11'),auth[_0xf240('0x9')](),controller['addImap']);router[_0xf240('0x1c')](_0xf240('0x13'),auth['isAuthenticated'](),controller[_0xf240('0x22')]);router['post']('/:id/interactions',auth[_0xf240('0x9')](),controller[_0xf240('0x23')]);router[_0xf240('0x1c')](_0xf240('0x16'),auth[_0xf240('0x9')](),controller[_0xf240('0x24')]);router[_0xf240('0x1c')](_0xf240('0x25'),auth[_0xf240('0x9')](),controller['send']);router['post'](_0xf240('0x26'),auth[_0xf240('0x9')](),controller[_0xf240('0x27')]);router[_0xf240('0x28')]('/:id',auth[_0xf240('0x9')](),controller[_0xf240('0x29')]);router['delete']('/:id/dispositions',auth[_0xf240('0x9')](),controller[_0xf240('0x2a')]);router[_0xf240('0x2b')](_0xf240('0x1f'),auth[_0xf240('0x9')](),controller[_0xf240('0x2c')]);router['delete'](_0xf240('0x11'),auth[_0xf240('0x9')](),controller[_0xf240('0x2d')]);router[_0xf240('0x2b')](_0xf240('0x13'),auth['isAuthenticated'](),controller['removeSmtp']);router['delete'](_0xf240('0xd'),auth[_0xf240('0x9')](),controller[_0xf240('0x2e')]);router['delete'](_0xf240('0x26'),auth[_0xf240('0x9')](),controller[_0xf240('0x2f')]);module[_0xf240('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index e4d7343..cc08668 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 _0xb647=['STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','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','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports'];(function(_0x3645e5,_0x1e9457){var _0x25f856=function(_0x3be557){while(--_0x3be557){_0x3645e5['push'](_0x3645e5['shift']());}};_0x25f856(++_0x1e9457);}(_0xb647,0xdb));var _0x7b64=function(_0x6c65a4,_0x4f180a){_0x6c65a4=_0x6c65a4-0x0;var _0x2a2ce9=_0xb647[_0x6c65a4];return _0x2a2ce9;};'use strict';var Sequelize=require(_0x7b64('0x0'));module[_0x7b64('0x1')]={'description':{'type':Sequelize[_0x7b64('0x2')]},'name':{'type':Sequelize[_0x7b64('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x7b64('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x7b64('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7b64('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x7b64('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x7b64('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7b64('0x4')},'fontSize':{'type':Sequelize[_0x7b64('0x5')](0x2)[_0x7b64('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7b64('0x7')],'defaultValue':function(){return _0x7b64('0x8');}},'notificationSound':{'type':Sequelize[_0x7b64('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7b64('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7b64('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7b64('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7b64('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7b64('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7b64('0x9'),'set':function(_0xa72761){if(!_0xa72761)this['setDataValue'](_0x7b64('0xa'),null);this[_0x7b64('0xb')](_0x7b64('0xc'),_0xa72761);}}}; \ No newline at end of file +var _0x00bb=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x1188f2,_0x234698){var _0xfebdd=function(_0x3c2924){while(--_0x3c2924){_0x1188f2['push'](_0x1188f2['shift']());}};_0xfebdd(++_0x234698);}(_0x00bb,0x1d8));var _0xb00b=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x00bb[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'description':{'type':Sequelize[_0xb00b('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xb00b('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xb00b('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xb00b('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xb00b('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xb00b('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xb00b('0x4')],'defaultValue':function(){return _0xb00b('0x5');}},'notificationSound':{'type':Sequelize[_0xb00b('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb00b('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb00b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb00b('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb00b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb00b('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xb00b('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xb00b('0x3')],'defaultValue':![],'comment':_0xb00b('0x8'),'set':function(_0x48e125){if(!_0x48e125)this[_0xb00b('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x48e125);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 3459e5d..5c23b84 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 _0xad47=['service','role','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','true','send','split','CmList','Contacts','updatedAt','from','%s\x20<%s>','email','attachments','join','server/files/attachments','basename','auth','pass','secure','List\x20not\x20found','List','messageId','subject','out','Interaction','Messages','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','html-to-text','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','MailServerIn','Pause','attributes','find','body','describe','Disposition','create','getDispositions','order','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','key','ListId','isNil','active','description','cservice','user','cuser','password','cpassword','authentication','host','port'];(function(_0x107774,_0x1bdd3b){var _0x739849=function(_0x33da9b){while(--_0x33da9b){_0x107774['push'](_0x107774['shift']());}};_0x739849(++_0x1bdd3b);}(_0xad47,0x108));var _0x7ad4=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0xad47[_0x6e1239];return _0x418150;};'use strict';var emlformat=require(_0x7ad4('0x0'));var rimraf=require(_0x7ad4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ad4('0x2'));var rp=require(_0x7ad4('0x3'));var moment=require(_0x7ad4('0x4'));var BPromise=require(_0x7ad4('0x5'));var Mustache=require(_0x7ad4('0x6'));var util=require(_0x7ad4('0x7'));var path=require(_0x7ad4('0x8'));var sox=require(_0x7ad4('0x9'));var csv=require(_0x7ad4('0xa'));var ejs=require(_0x7ad4('0xb'));var fs=require('fs');var fs_extra=require(_0x7ad4('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7ad4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7ad4('0xe'));var toCsv=require(_0x7ad4('0xa'));var querystring=require(_0x7ad4('0xf'));var Papa=require(_0x7ad4('0x10'));var htmlToText=require(_0x7ad4('0x11'));var juice=require(_0x7ad4('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7ad4('0x13'));var as=require(_0x7ad4('0x14'));var hardwareService=require(_0x7ad4('0x15'));var logger=require('../../config/logger')(_0x7ad4('0x16'));var utils=require(_0x7ad4('0x17'));var config=require(_0x7ad4('0x18'));var licenseUtil=require(_0x7ad4('0x19'));var db=require(_0x7ad4('0x1a'))['db'];config[_0x7ad4('0x1b')]=_[_0x7ad4('0x1c')](config[_0x7ad4('0x1b')],{'host':_0x7ad4('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ad4('0x1b')]));require(_0x7ad4('0x1e'))[_0x7ad4('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7ad4('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x44b920,_0x7bfb1d,_0x1932da,_0x19aaf7){return new BPromise(function(_0x3e2664,_0x5bcbb8){var _0x51a2dc=_0x19aaf7||client;return _0x51a2dc['request'](_0x44b920,_0x1932da)[_0x7ad4('0x21')](function(_0x1f6a2f){logger[_0x7ad4('0x22')](_0x7ad4('0x23'),_0x7bfb1d,_0x7ad4('0x24'));logger['debug'](_0x7ad4('0x25'),_0x7bfb1d,_0x7ad4('0x24'),JSON[_0x7ad4('0x26')](_0x1f6a2f));if(_0x1f6a2f['error']){if(_0x1f6a2f[_0x7ad4('0x27')]['code']===0x1f4){logger['error'](_0x7ad4('0x23'),_0x7bfb1d,_0x1f6a2f[_0x7ad4('0x27')][_0x7ad4('0x28')]);return _0x5bcbb8(_0x1f6a2f[_0x7ad4('0x27')][_0x7ad4('0x28')]);}logger[_0x7ad4('0x27')](_0x7ad4('0x23'),_0x7bfb1d,_0x1f6a2f[_0x7ad4('0x27')][_0x7ad4('0x28')]);return _0x3e2664(_0x1f6a2f[_0x7ad4('0x27')][_0x7ad4('0x28')]);}else{logger['info'](_0x7ad4('0x23'),_0x7bfb1d,_0x7ad4('0x24'));_0x3e2664(_0x1f6a2f[_0x7ad4('0x29')][_0x7ad4('0x28')]);}})[_0x7ad4('0x2a')](function(_0x1097ac){logger['error'](_0x7ad4('0x23'),_0x7bfb1d,_0x1097ac);_0x5bcbb8(_0x1097ac);});});}function respondWithStatusCode(_0x474c82,_0x41151f){_0x41151f=_0x41151f||0xcc;return function(_0xecab97){if(_0xecab97){return _0x474c82[_0x7ad4('0x2b')](_0x41151f);}return _0x474c82[_0x7ad4('0x2c')](_0x41151f)[_0x7ad4('0x2d')]();};}function respondWithResult(_0x1c42c1,_0x80daf4){_0x80daf4=_0x80daf4||0xc8;return function(_0x6cb088){if(_0x6cb088){return _0x1c42c1[_0x7ad4('0x2c')](_0x80daf4)['json'](_0x6cb088);}};}function respondWithFilteredResult(_0x18ae1b,_0x42cafb){return function(_0x20b9bd){if(_0x20b9bd){var _0x195fd6=typeof _0x42cafb[_0x7ad4('0x2e')]===_0x7ad4('0x2f')&&typeof _0x42cafb['limit']===_0x7ad4('0x2f');var _0x46cfc3=_0x20b9bd['count'];var _0x28827d=_0x195fd6?0x0:_0x42cafb[_0x7ad4('0x2e')];var _0x5af6ee=_0x195fd6?_0x20b9bd[_0x7ad4('0x30')]:_0x42cafb[_0x7ad4('0x2e')]+_0x42cafb[_0x7ad4('0x31')];var _0x2930c1;if(_0x5af6ee>=_0x46cfc3){_0x5af6ee=_0x46cfc3;_0x2930c1=0xc8;}else{_0x2930c1=0xce;}_0x18ae1b[_0x7ad4('0x2c')](_0x2930c1);return _0x18ae1b[_0x7ad4('0x32')]('Content-Range',_0x28827d+'-'+_0x5af6ee+'/'+_0x46cfc3)[_0x7ad4('0x33')](_0x20b9bd);}return null;};}function patchUpdates(_0xbf928a){return function(_0x4a1a22){try{jsonpatch[_0x7ad4('0x34')](_0x4a1a22,_0xbf928a,!![]);}catch(_0x20ec42){return BPromise[_0x7ad4('0x35')](_0x20ec42);}return _0x4a1a22[_0x7ad4('0x36')]();};}function saveUpdates(_0x175192,_0x3e5f29){return function(_0x283f9c){if(_0x283f9c){return _0x283f9c[_0x7ad4('0x37')](_0x175192)[_0x7ad4('0x21')](function(_0x419ed3){return _0x419ed3;});}return null;};}function removeEntity(_0x430433,_0x309bdd){return function(_0x394688){if(_0x394688){return _0x394688[_0x7ad4('0x38')]()['then'](function(){var _0x19218b=_0x394688[_0x7ad4('0x39')]({'plain':!![]});var _0x36bd18=_0x7ad4('0x3a');return db[_0x7ad4('0x3b')][_0x7ad4('0x38')]({'where':{'type':_0x36bd18,'resourceId':_0x19218b['id']}})[_0x7ad4('0x21')](function(){return _0x394688;});})[_0x7ad4('0x21')](function(){_0x430433[_0x7ad4('0x2c')](0xcc)[_0x7ad4('0x2d')]();});}};}function handleEntityNotFound(_0x4808cd,_0x4303fc){return function(_0x232ec9){if(!_0x232ec9){_0x4808cd['sendStatus'](0x194);}return _0x232ec9;};}function handleError(_0x5d9653,_0x40fcb4){_0x40fcb4=_0x40fcb4||0x1f4;return function(_0x218510){logger['error'](_0x218510[_0x7ad4('0x3c')]);if(_0x218510[_0x7ad4('0x3d')]){delete _0x218510[_0x7ad4('0x3d')];}_0x5d9653['status'](_0x40fcb4)['send'](_0x218510);};}exports['index']=function(_0xc98e7c,_0x1dd234){var _0x3e3365={'include':[{'model':db['MailServerIn'],'as':_0x7ad4('0x3e')},{'model':db[_0x7ad4('0x3f')],'as':_0x7ad4('0x40')},{'model':db['Pause'],'as':_0x7ad4('0x41')}]},_0x2cc6c6={},_0x23ba85={'count':0x0,'rows':[]};var _0x1e170a=_[_0x7ad4('0x42')](db[_0x7ad4('0x43')][_0x7ad4('0x44')],function(_0x1da74b){return{'name':_0x1da74b[_0x7ad4('0x45')],'type':_0x1da74b['type']['key']};});_0x2cc6c6[_0x7ad4('0x46')]=_[_0x7ad4('0x42')](_0x1e170a,_0x7ad4('0x3d'));_0x2cc6c6[_0x7ad4('0x47')]=_[_0x7ad4('0x48')](_0xc98e7c[_0x7ad4('0x47')]);_0x2cc6c6[_0x7ad4('0x49')]=_[_0x7ad4('0x4a')](_0x2cc6c6[_0x7ad4('0x46')],_0x2cc6c6[_0x7ad4('0x47')]);_0x3e3365['attributes']=_[_0x7ad4('0x4a')](_0x2cc6c6[_0x7ad4('0x46')],qs[_0x7ad4('0x4b')](_0xc98e7c['query'][_0x7ad4('0x4b')]));_0x3e3365['attributes']=_0x3e3365['attributes'][_0x7ad4('0x4c')]?_0x3e3365['attributes']:_0x2cc6c6['model'];if(!_0xc98e7c[_0x7ad4('0x47')][_0x7ad4('0x4d')](_0x7ad4('0x4e'))){_0x3e3365[_0x7ad4('0x31')]=qs[_0x7ad4('0x31')](_0xc98e7c[_0x7ad4('0x47')]['limit']);_0x3e3365['offset']=qs[_0x7ad4('0x2e')](_0xc98e7c[_0x7ad4('0x47')][_0x7ad4('0x2e')]);}_0x3e3365['order']=qs[_0x7ad4('0x4f')](_0xc98e7c['query']['sort']);_0x3e3365['where']=qs['filters'](_[_0x7ad4('0x50')](_0xc98e7c[_0x7ad4('0x47')],_0x2cc6c6[_0x7ad4('0x49')]),_0x1e170a);if(_0xc98e7c[_0x7ad4('0x47')][_0x7ad4('0x51')]){_0x3e3365[_0x7ad4('0x52')]=_[_0x7ad4('0x53')](_0x3e3365[_0x7ad4('0x52')],{'$or':_['map'](_0x1e170a,function(_0x56d7e6){if(_0x56d7e6[_0x7ad4('0x54')]!==_0x7ad4('0x55')){var _0x11ca47={};_0x11ca47[_0x56d7e6[_0x7ad4('0x3d')]]={'$like':'%'+_0xc98e7c['query'][_0x7ad4('0x51')]+'%'};return _0x11ca47;}})});}_0x3e3365=_[_0x7ad4('0x53')]({},_0x3e3365,_0xc98e7c[_0x7ad4('0x56')]);var _0x3861ce={'where':_0x3e3365[_0x7ad4('0x52')]};return db[_0x7ad4('0x43')][_0x7ad4('0x30')](_0x3861ce)[_0x7ad4('0x21')](function(_0x168f50){_0x23ba85[_0x7ad4('0x30')]=_0x168f50;if(_0xc98e7c[_0x7ad4('0x47')][_0x7ad4('0x57')]){_0x3e3365[_0x7ad4('0x58')]=[{'all':!![]}];}return db[_0x7ad4('0x43')][_0x7ad4('0x59')](_0x3e3365);})[_0x7ad4('0x21')](function(_0x5047b4){_0x23ba85[_0x7ad4('0x5a')]=_0x5047b4;return _0x23ba85;})[_0x7ad4('0x21')](respondWithFilteredResult(_0x1dd234,_0x3e3365))[_0x7ad4('0x2a')](handleError(_0x1dd234,null));};exports[_0x7ad4('0x5b')]=function(_0x417ac8,_0x15bf9c){var _0xbe6040={'raw':![],'where':{'id':_0x417ac8[_0x7ad4('0x5c')]['id']},'include':[{'model':db[_0x7ad4('0x5d')],'as':_0x7ad4('0x3e')},{'model':db['MailServerOut'],'as':_0x7ad4('0x40')},{'model':db[_0x7ad4('0x5e')],'as':_0x7ad4('0x41')}]},_0x5d5a26={};_0x5d5a26[_0x7ad4('0x46')]=_['keys'](db[_0x7ad4('0x43')]['rawAttributes']);_0x5d5a26[_0x7ad4('0x47')]=_['keys'](_0x417ac8[_0x7ad4('0x47')]);_0x5d5a26['filters']=_[_0x7ad4('0x4a')](_0x5d5a26[_0x7ad4('0x46')],_0x5d5a26[_0x7ad4('0x47')]);_0xbe6040[_0x7ad4('0x5f')]=_[_0x7ad4('0x4a')](_0x5d5a26[_0x7ad4('0x46')],qs[_0x7ad4('0x4b')](_0x417ac8[_0x7ad4('0x47')][_0x7ad4('0x4b')]));_0xbe6040[_0x7ad4('0x5f')]=_0xbe6040[_0x7ad4('0x5f')][_0x7ad4('0x4c')]?_0xbe6040[_0x7ad4('0x5f')]:_0x5d5a26[_0x7ad4('0x46')];if(_0x417ac8[_0x7ad4('0x47')][_0x7ad4('0x57')]){_0xbe6040[_0x7ad4('0x58')]=[{'all':!![]}];}_0xbe6040=_[_0x7ad4('0x53')]({},_0xbe6040,_0x417ac8[_0x7ad4('0x56')]);return db[_0x7ad4('0x43')][_0x7ad4('0x60')](_0xbe6040)['then'](handleEntityNotFound(_0x15bf9c,null))[_0x7ad4('0x21')](respondWithResult(_0x15bf9c,null))[_0x7ad4('0x2a')](handleError(_0x15bf9c,null));};exports[_0x7ad4('0x37')]=function(_0x17e3a3,_0x160650){if(_0x17e3a3[_0x7ad4('0x61')]['id']){delete _0x17e3a3[_0x7ad4('0x61')]['id'];}return db['MailAccount'][_0x7ad4('0x60')]({'where':{'id':_0x17e3a3['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x7ad4('0x3e')},{'model':db[_0x7ad4('0x3f')],'as':_0x7ad4('0x40')},{'model':db[_0x7ad4('0x5e')],'as':_0x7ad4('0x41')}]})[_0x7ad4('0x21')](handleEntityNotFound(_0x160650,null))[_0x7ad4('0x21')](saveUpdates(_0x17e3a3[_0x7ad4('0x61')],null))['then'](function(_0x8a12f5){if(_0x8a12f5&&_0x17e3a3['body'][_0x7ad4('0x3e')]){return db[_0x7ad4('0x5d')][_0x7ad4('0x37')](_0x17e3a3[_0x7ad4('0x61')][_0x7ad4('0x3e')],{'where':{'MailAccountId':_0x8a12f5['id']}})[_0x7ad4('0x21')](function(){return _0x8a12f5;});}return _0x8a12f5;})[_0x7ad4('0x21')](function(_0x23f948){if(_0x23f948&&_0x17e3a3['body'][_0x7ad4('0x40')]){return db[_0x7ad4('0x3f')][_0x7ad4('0x37')](_0x17e3a3[_0x7ad4('0x61')][_0x7ad4('0x40')],{'where':{'MailAccountId':_0x23f948['id']}})['then'](function(){return _0x23f948;});}return _0x23f948;})[_0x7ad4('0x21')](respondWithResult(_0x160650,null))[_0x7ad4('0x2a')](handleError(_0x160650,null));};exports['describe']=function(_0x4fcee7,_0x1b4c90){return db[_0x7ad4('0x43')][_0x7ad4('0x62')]()[_0x7ad4('0x21')](respondWithResult(_0x1b4c90,null))[_0x7ad4('0x2a')](handleError(_0x1b4c90,null));};exports['addDisposition']=function(_0x5f50fa,_0x52855d,_0x33f91c){if(_0x5f50fa[_0x7ad4('0x61')]['id']){delete _0x5f50fa['body']['id'];}return db['MailAccount'][_0x7ad4('0x60')]({'where':{'id':_0x5f50fa[_0x7ad4('0x5c')]['id']}})[_0x7ad4('0x21')](handleEntityNotFound(_0x52855d,null))['then'](function(_0x8835bc){if(_0x8835bc){_0x5f50fa[_0x7ad4('0x61')]['MailAccountId']=_0x8835bc['id'];return db[_0x7ad4('0x63')][_0x7ad4('0x64')](_0x5f50fa['body']);}})[_0x7ad4('0x21')](respondWithResult(_0x52855d,null))[_0x7ad4('0x2a')](handleError(_0x52855d,null));};exports[_0x7ad4('0x65')]=function(_0x99cb04,_0x2e37a5,_0x2929e2){var _0x4c7300={'raw':![],'where':{}};var _0xdf3e39={};var _0x25061a={'count':0x0,'rows':[]};return db[_0x7ad4('0x43')]['findOne']({'where':{'id':_0x99cb04['params']['id']}})['then'](handleEntityNotFound(_0x2e37a5,null))[_0x7ad4('0x21')](function(_0x5212ec){if(_0x5212ec){_0xdf3e39[_0x7ad4('0x46')]=_[_0x7ad4('0x48')](db[_0x7ad4('0x63')][_0x7ad4('0x44')]);_0xdf3e39[_0x7ad4('0x47')]=_[_0x7ad4('0x48')](_0x99cb04[_0x7ad4('0x47')]);_0xdf3e39[_0x7ad4('0x49')]=_[_0x7ad4('0x4a')](_0xdf3e39['model'],_0xdf3e39[_0x7ad4('0x47')]);_0x4c7300[_0x7ad4('0x5f')]=_[_0x7ad4('0x4a')](_0xdf3e39[_0x7ad4('0x46')],qs[_0x7ad4('0x4b')](_0x99cb04['query'][_0x7ad4('0x4b')]));_0x4c7300[_0x7ad4('0x5f')]=_0x4c7300[_0x7ad4('0x5f')][_0x7ad4('0x4c')]?_0x4c7300['attributes']:_0xdf3e39['model'];if(!_0x99cb04[_0x7ad4('0x47')]['hasOwnProperty'](_0x7ad4('0x4e'))){_0x4c7300[_0x7ad4('0x31')]=qs[_0x7ad4('0x31')](_0x99cb04[_0x7ad4('0x47')][_0x7ad4('0x31')]);_0x4c7300['offset']=qs[_0x7ad4('0x2e')](_0x99cb04[_0x7ad4('0x47')][_0x7ad4('0x2e')]);}_0x4c7300[_0x7ad4('0x66')]=qs[_0x7ad4('0x4f')](_0x99cb04[_0x7ad4('0x47')][_0x7ad4('0x4f')]);_0x4c7300[_0x7ad4('0x52')]=qs[_0x7ad4('0x49')](_[_0x7ad4('0x50')](_0x99cb04[_0x7ad4('0x47')],_0xdf3e39[_0x7ad4('0x49')]));_0x4c7300['where'][_0x7ad4('0x67')]=_0x5212ec['id'];if(_0x99cb04[_0x7ad4('0x47')][_0x7ad4('0x51')]){_0x4c7300[_0x7ad4('0x52')]=_['merge'](_0x4c7300['where'],{'$or':_[_0x7ad4('0x42')](_0x4c7300[_0x7ad4('0x5f')],function(_0x32c532){var _0x802f5c={};_0x802f5c[_0x32c532]={'$like':'%'+_0x99cb04[_0x7ad4('0x47')][_0x7ad4('0x51')]+'%'};return _0x802f5c;})});}_0x4c7300=_[_0x7ad4('0x53')]({},_0x4c7300,_0x99cb04[_0x7ad4('0x56')]);return db[_0x7ad4('0x63')][_0x7ad4('0x30')]({'where':_0x4c7300[_0x7ad4('0x52')]})[_0x7ad4('0x21')](function(_0x558db6){_0x25061a[_0x7ad4('0x30')]=_0x558db6;if(_0x99cb04[_0x7ad4('0x47')][_0x7ad4('0x57')]){_0x4c7300[_0x7ad4('0x58')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x4c7300);})[_0x7ad4('0x21')](function(_0x131b05){_0x25061a[_0x7ad4('0x5a')]=_0x131b05;return _0x25061a;});}})['then'](respondWithFilteredResult(_0x2e37a5,_0x4c7300))[_0x7ad4('0x2a')](handleError(_0x2e37a5,null));};exports[_0x7ad4('0x68')]=function(_0x5e9dfc,_0x5944a7,_0x3855b6){return db['MailAccount'][_0x7ad4('0x60')]({'where':{'id':_0x5e9dfc[_0x7ad4('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5944a7,null))[_0x7ad4('0x21')](function(_0x4f796a){if(_0x4f796a){return _0x4f796a[_0x7ad4('0x68')](_0x5e9dfc[_0x7ad4('0x47')][_0x7ad4('0x69')]);}})['then'](respondWithStatusCode(_0x5944a7,null))[_0x7ad4('0x2a')](handleError(_0x5944a7,null));};exports[_0x7ad4('0x6a')]=function(_0x51cd7c,_0x5f5ca7,_0x211d20){if(_0x51cd7c[_0x7ad4('0x61')]['id']){delete _0x51cd7c['body']['id'];}return db[_0x7ad4('0x43')]['find']({'where':{'id':_0x51cd7c[_0x7ad4('0x5c')]['id']}})[_0x7ad4('0x21')](handleEntityNotFound(_0x5f5ca7,null))['then'](function(_0x5cd74d){if(_0x5cd74d){_0x51cd7c[_0x7ad4('0x61')][_0x7ad4('0x67')]=_0x5cd74d['id'];return db[_0x7ad4('0x6b')]['create'](_0x51cd7c[_0x7ad4('0x61')]);}})[_0x7ad4('0x21')](respondWithResult(_0x5f5ca7,null))[_0x7ad4('0x2a')](handleError(_0x5f5ca7,null));};exports[_0x7ad4('0x6c')]=function(_0xe7ae76,_0x2e5093,_0x47105a){var _0x5f1889={'raw':![],'where':{}};var _0x543202={};var _0x1ff832={'count':0x0,'rows':[]};return db[_0x7ad4('0x43')][_0x7ad4('0x6d')]({'where':{'id':_0xe7ae76[_0x7ad4('0x5c')]['id']}})[_0x7ad4('0x21')](handleEntityNotFound(_0x2e5093,null))[_0x7ad4('0x21')](function(_0x361530){if(_0x361530){_0x543202[_0x7ad4('0x46')]=_[_0x7ad4('0x48')](db[_0x7ad4('0x6b')]['rawAttributes']);_0x543202[_0x7ad4('0x47')]=_[_0x7ad4('0x48')](_0xe7ae76[_0x7ad4('0x47')]);_0x543202['filters']=_[_0x7ad4('0x4a')](_0x543202[_0x7ad4('0x46')],_0x543202['query']);_0x5f1889['attributes']=_[_0x7ad4('0x4a')](_0x543202[_0x7ad4('0x46')],qs[_0x7ad4('0x4b')](_0xe7ae76[_0x7ad4('0x47')][_0x7ad4('0x4b')]));_0x5f1889[_0x7ad4('0x5f')]=_0x5f1889[_0x7ad4('0x5f')]['length']?_0x5f1889[_0x7ad4('0x5f')]:_0x543202[_0x7ad4('0x46')];if(!_0xe7ae76['query'][_0x7ad4('0x4d')](_0x7ad4('0x4e'))){_0x5f1889[_0x7ad4('0x31')]=qs['limit'](_0xe7ae76[_0x7ad4('0x47')][_0x7ad4('0x31')]);_0x5f1889[_0x7ad4('0x2e')]=qs[_0x7ad4('0x2e')](_0xe7ae76[_0x7ad4('0x47')][_0x7ad4('0x2e')]);}_0x5f1889[_0x7ad4('0x66')]=qs[_0x7ad4('0x4f')](_0xe7ae76[_0x7ad4('0x47')]['sort']);_0x5f1889[_0x7ad4('0x52')]=qs[_0x7ad4('0x49')](_[_0x7ad4('0x50')](_0xe7ae76['query'],_0x543202[_0x7ad4('0x49')]));_0x5f1889[_0x7ad4('0x52')][_0x7ad4('0x67')]=_0x361530['id'];if(_0xe7ae76[_0x7ad4('0x47')][_0x7ad4('0x51')]){_0x5f1889[_0x7ad4('0x52')]=_[_0x7ad4('0x53')](_0x5f1889[_0x7ad4('0x52')],{'$or':_[_0x7ad4('0x42')](_0x5f1889[_0x7ad4('0x5f')],function(_0x1cef99){var _0x1f4632={};_0x1f4632[_0x1cef99]={'$like':'%'+_0xe7ae76[_0x7ad4('0x47')][_0x7ad4('0x51')]+'%'};return _0x1f4632;})});}_0x5f1889=_[_0x7ad4('0x53')]({},_0x5f1889,_0xe7ae76[_0x7ad4('0x56')]);return db[_0x7ad4('0x6b')][_0x7ad4('0x30')]({'where':_0x5f1889[_0x7ad4('0x52')]})[_0x7ad4('0x21')](function(_0x3dcd22){_0x1ff832['count']=_0x3dcd22;if(_0xe7ae76['query'][_0x7ad4('0x57')]){_0x5f1889[_0x7ad4('0x58')]=[{'all':!![]}];}return db[_0x7ad4('0x6b')]['findAll'](_0x5f1889);})['then'](function(_0x3644b7){_0x1ff832['rows']=_0x3644b7;return _0x1ff832;});}})['then'](respondWithFilteredResult(_0x2e5093,_0x5f1889))[_0x7ad4('0x2a')](handleError(_0x2e5093,null));};exports[_0x7ad4('0x6e')]=function(_0x570dc4,_0x31593e,_0x3b7e07){return db[_0x7ad4('0x43')]['find']({'where':{'id':_0x570dc4[_0x7ad4('0x5c')]['id']}})[_0x7ad4('0x21')](handleEntityNotFound(_0x31593e,null))[_0x7ad4('0x21')](function(_0x538c6f){if(_0x538c6f){return _0x538c6f['removeAnswers'](_0x570dc4[_0x7ad4('0x47')][_0x7ad4('0x69')]);}})[_0x7ad4('0x21')](respondWithStatusCode(_0x31593e,null))[_0x7ad4('0x2a')](handleError(_0x31593e,null));};exports['create']=function(_0x5458ec,_0x54c8f4){var _0x18456d={'name':_0x5458ec[_0x7ad4('0x61')][_0x7ad4('0x3d')],'key':_0x5458ec['body'][_0x7ad4('0x6f')],'email':_0x5458ec['body']['email'],'ListId':_0x5458ec[_0x7ad4('0x61')][_0x7ad4('0x70')],'active':!_[_0x7ad4('0x71')](_0x5458ec[_0x7ad4('0x61')][_0x7ad4('0x72')])?_0x5458ec[_0x7ad4('0x61')]['active']:!![],'description':_0x5458ec[_0x7ad4('0x61')][_0x7ad4('0x73')]||null,'Imap':{},'Smtp':{}};if(_[_0x7ad4('0x71')](_0x5458ec[_0x7ad4('0x61')][_0x7ad4('0x74')])){if(_0x5458ec[_0x7ad4('0x61')]['cauthentication']){_0x18456d[_0x7ad4('0x3e')]['user']=_0x18456d[_0x7ad4('0x40')][_0x7ad4('0x75')]=_0x5458ec[_0x7ad4('0x61')][_0x7ad4('0x76')];_0x18456d[_0x7ad4('0x3e')][_0x7ad4('0x77')]=_0x18456d[_0x7ad4('0x40')]['pass']=_0x5458ec[_0x7ad4('0x61')][_0x7ad4('0x78')];}else{_0x18456d[_0x7ad4('0x3e')][_0x7ad4('0x79')]=_0x18456d[_0x7ad4('0x40')][_0x7ad4('0x79')]=![];}_0x18456d['Imap']['host']=_0x5458ec['body'][_0x7ad4('0x3e')][_0x7ad4('0x7a')];_0x18456d[_0x7ad4('0x3e')]['port']=_0x5458ec['body'][_0x7ad4('0x3e')][_0x7ad4('0x7b')];_0x18456d[_0x7ad4('0x40')][_0x7ad4('0x7a')]=_0x5458ec[_0x7ad4('0x61')][_0x7ad4('0x40')][_0x7ad4('0x7a')];_0x18456d[_0x7ad4('0x40')]['port']=_0x5458ec['body'][_0x7ad4('0x40')][_0x7ad4('0x7b')];}else{_0x18456d['Imap']['service']=_0x18456d[_0x7ad4('0x40')][_0x7ad4('0x7c')]=_0x5458ec[_0x7ad4('0x61')]['cservice'];_0x18456d['Imap'][_0x7ad4('0x75')]=_0x18456d[_0x7ad4('0x40')]['user']=_0x5458ec[_0x7ad4('0x61')]['cuser'];_0x18456d[_0x7ad4('0x3e')][_0x7ad4('0x77')]=_0x18456d[_0x7ad4('0x40')]['pass']=_0x5458ec['body'][_0x7ad4('0x78')];}return db['MailAccount'][_0x7ad4('0x64')](_0x18456d,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0x7ad4('0x3e')}]})[_0x7ad4('0x21')](function(_0x4bff09){var _0x5bd3f1=_0x5458ec[_0x7ad4('0x75')][_0x7ad4('0x39')]({'plain':!![]});if(!_0x5bd3f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bd3f1[_0x7ad4('0x7d')]===_0x7ad4('0x75')){var _0x1443a4=_0x4bff09['get']({'plain':!![]});return db['UserProfileSection'][_0x7ad4('0x60')]({'where':{'name':_0x7ad4('0x3a'),'userProfileId':_0x5bd3f1['userProfileId']},'raw':!![]})['then'](function(_0x50904d){if(_0x50904d&&_0x50904d['autoAssociation']===0x0){return db[_0x7ad4('0x3b')][_0x7ad4('0x64')]({'name':_0x1443a4['name'],'resourceId':_0x1443a4['id'],'type':_0x50904d[_0x7ad4('0x3d')],'sectionId':_0x50904d['id']},{})['then'](function(){return _0x4bff09;});}else{return _0x4bff09;}})[_0x7ad4('0x2a')](function(_0x44a327){logger[_0x7ad4('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44a327);throw _0x44a327;});}return _0x4bff09;})['then'](respondWithResult(_0x54c8f4,0xc9))[_0x7ad4('0x2a')](handleError(_0x54c8f4,null));};exports[_0x7ad4('0x7e')]=function(_0x1733d1,_0x27070b,_0x4daefe){return db['MailAccount']['findOne']({'where':{'id':_0x1733d1[_0x7ad4('0x5c')]['id']}})[_0x7ad4('0x21')](handleEntityNotFound(_0x27070b,null))[_0x7ad4('0x21')](function(_0x31a0de){if(_0x31a0de){return _0x31a0de[_0x7ad4('0x7e')]();}return null;})['then'](respondWithResult(_0x27070b,null))[_0x7ad4('0x2a')](handleError(_0x27070b,null));};exports[_0x7ad4('0x7f')]=function(_0x464e02,_0x4dc528,_0xbaea0c){if(_0x464e02[_0x7ad4('0x61')]['id']){delete _0x464e02[_0x7ad4('0x61')]['id'];}return db[_0x7ad4('0x43')]['find']({'where':{'id':_0x464e02[_0x7ad4('0x5c')]['id']}})[_0x7ad4('0x21')](handleEntityNotFound(_0x4dc528,null))[_0x7ad4('0x21')](function(_0x8d29bc){if(_0x8d29bc){_0x464e02[_0x7ad4('0x61')][_0x7ad4('0x67')]=_0x8d29bc['id'];return db[_0x7ad4('0x5d')][_0x7ad4('0x64')](_0x464e02[_0x7ad4('0x61')]);}})[_0x7ad4('0x21')](respondWithResult(_0x4dc528,null))[_0x7ad4('0x2a')](handleError(_0x4dc528,null));};exports['removeImap']=function(_0x2134dd,_0x1e0408,_0x4266a2){return db[_0x7ad4('0x43')][_0x7ad4('0x6d')]({'where':{'id':_0x2134dd[_0x7ad4('0x5c')]['id']}})[_0x7ad4('0x21')](handleEntityNotFound(_0x1e0408,null))[_0x7ad4('0x21')](function(_0x4330f6){if(_0x4330f6){return _0x4330f6[_0x7ad4('0x80')](null);}return null;})[_0x7ad4('0x21')](respondWithStatusCode(_0x1e0408,null))[_0x7ad4('0x2a')](handleError(_0x1e0408,null));};exports[_0x7ad4('0x81')]=function(_0x34cfef,_0x22c63c,_0x4b9ba9){return db['MailAccount']['findOne']({'where':{'id':_0x34cfef['params']['id']}})[_0x7ad4('0x21')](handleEntityNotFound(_0x22c63c,null))[_0x7ad4('0x21')](function(_0x23b832){if(_0x23b832){return _0x23b832[_0x7ad4('0x81')]();}return null;})[_0x7ad4('0x21')](respondWithResult(_0x22c63c,null))['catch'](handleError(_0x22c63c,null));};exports[_0x7ad4('0x82')]=function(_0x34fabe,_0x47ab63,_0x2c0aef){if(_0x34fabe[_0x7ad4('0x61')]['id']){delete _0x34fabe['body']['id'];}return db[_0x7ad4('0x43')]['find']({'where':{'id':_0x34fabe['params']['id']}})['then'](handleEntityNotFound(_0x47ab63,null))[_0x7ad4('0x21')](function(_0x3bb3f4){if(_0x3bb3f4){_0x34fabe[_0x7ad4('0x61')][_0x7ad4('0x67')]=_0x3bb3f4['id'];return db[_0x7ad4('0x3f')][_0x7ad4('0x64')](_0x34fabe['body']);}})[_0x7ad4('0x21')](respondWithResult(_0x47ab63,null))[_0x7ad4('0x2a')](handleError(_0x47ab63,null));};exports[_0x7ad4('0x83')]=function(_0x2269a1,_0x46034d,_0x462d5c){return db[_0x7ad4('0x43')][_0x7ad4('0x6d')]({'where':{'id':_0x2269a1[_0x7ad4('0x5c')]['id']}})[_0x7ad4('0x21')](handleEntityNotFound(_0x46034d,null))[_0x7ad4('0x21')](function(_0x27697f){if(_0x27697f){return _0x27697f[_0x7ad4('0x84')](null);}return null;})[_0x7ad4('0x21')](respondWithStatusCode(_0x46034d,null))[_0x7ad4('0x2a')](handleError(_0x46034d,null));};exports[_0x7ad4('0x85')]=function(_0x20bf51,_0x17f535,_0x56f02f){return db[_0x7ad4('0x86')][_0x7ad4('0x60')]({'where':{'id':_0x20bf51['params']['id']}})[_0x7ad4('0x21')](handleEntityNotFound(_0x17f535,null))[_0x7ad4('0x21')](function(_0x299b68){if(_0x299b68){return _0x299b68[_0x7ad4('0x85')](_0x20bf51[_0x7ad4('0x61')][_0x7ad4('0x69')],_[_0x7ad4('0x87')](_0x20bf51[_0x7ad4('0x61')],[_0x7ad4('0x69'),'id'])||{});}})[_0x7ad4('0x21')](respondWithResult(_0x17f535,null))[_0x7ad4('0x2a')](handleError(_0x17f535,null));};exports[_0x7ad4('0x88')]=function(_0x271ea8,_0x4e8f8b,_0x48b9ce){var _0x3a1dcb={'raw':![],'where':{}};var _0x3411d6={};var _0x178922={'count':0x0,'rows':[]};return db[_0x7ad4('0x43')]['findOne']({'where':{'id':_0x271ea8['params']['id']}})['then'](handleEntityNotFound(_0x4e8f8b,null))[_0x7ad4('0x21')](function(_0x1719bf){if(_0x1719bf){_0x3411d6[_0x7ad4('0x46')]=_[_0x7ad4('0x48')](db[_0x7ad4('0x86')][_0x7ad4('0x44')]);_0x3411d6[_0x7ad4('0x47')]=_[_0x7ad4('0x48')](_0x271ea8[_0x7ad4('0x47')]);_0x3411d6['filters']=_[_0x7ad4('0x4a')](_0x3411d6[_0x7ad4('0x46')],_0x3411d6[_0x7ad4('0x47')]);_0x3a1dcb[_0x7ad4('0x5f')]=_[_0x7ad4('0x4a')](_0x3411d6[_0x7ad4('0x46')],qs[_0x7ad4('0x4b')](_0x271ea8['query'][_0x7ad4('0x4b')]));_0x3a1dcb[_0x7ad4('0x5f')]=_0x3a1dcb[_0x7ad4('0x5f')][_0x7ad4('0x4c')]?_0x3a1dcb[_0x7ad4('0x5f')]:_0x3411d6[_0x7ad4('0x46')];if(!_0x271ea8['query']['hasOwnProperty'](_0x7ad4('0x4e'))){_0x3a1dcb[_0x7ad4('0x31')]=qs['limit'](_0x271ea8[_0x7ad4('0x47')]['limit']);_0x3a1dcb[_0x7ad4('0x2e')]=qs[_0x7ad4('0x2e')](_0x271ea8['query'][_0x7ad4('0x2e')]);}_0x3a1dcb['order']=qs[_0x7ad4('0x4f')](_0x271ea8[_0x7ad4('0x47')][_0x7ad4('0x4f')]);_0x3a1dcb['where']=qs['filters'](_[_0x7ad4('0x50')](_0x271ea8[_0x7ad4('0x47')],_0x3411d6['filters']));_0x3a1dcb[_0x7ad4('0x52')][_0x7ad4('0x67')]=_0x1719bf['id'];if(_0x271ea8[_0x7ad4('0x47')][_0x7ad4('0x51')]){_0x3a1dcb['where']=_[_0x7ad4('0x53')](_0x3a1dcb[_0x7ad4('0x52')],{'$or':_[_0x7ad4('0x42')](_0x3a1dcb[_0x7ad4('0x5f')],function(_0x374b76){var _0xade53f={};_0xade53f[_0x374b76]={'$like':'%'+_0x271ea8[_0x7ad4('0x47')]['filter']+'%'};return _0xade53f;})});}_0x3a1dcb=_[_0x7ad4('0x53')]({},_0x3a1dcb,_0x271ea8[_0x7ad4('0x56')]);return db[_0x7ad4('0x86')]['count']({'where':_0x3a1dcb[_0x7ad4('0x52')]})['then'](function(_0x40e222){_0x178922[_0x7ad4('0x30')]=_0x40e222;if(_0x271ea8['query'][_0x7ad4('0x57')]){_0x3a1dcb[_0x7ad4('0x58')]=[{'model':db[_0x7ad4('0x89')],'as':_0x7ad4('0x8a'),'required':![]},{'model':db[_0x7ad4('0x8b')],'as':_0x7ad4('0x8c'),'attributes':[_0x7ad4('0x3d'),_0x7ad4('0x8d'),_0x7ad4('0x8e')],'required':![]},{'model':db['Tag'],'as':_0x7ad4('0x8f'),'attributes':['id',_0x7ad4('0x3d'),_0x7ad4('0x90')],'where':_0x271ea8[_0x7ad4('0x47')][_0x7ad4('0x91')]?{'id':_0x271ea8[_0x7ad4('0x47')]['tag']}:undefined,'required':_0x271ea8[_0x7ad4('0x47')][_0x7ad4('0x91')]?!![]:![]}];}return db[_0x7ad4('0x86')][_0x7ad4('0x59')](_0x3a1dcb);})[_0x7ad4('0x21')](function(_0x164e96){_0x178922['rows']=_0x164e96;return _0x178922;});}})['then'](respondWithFilteredResult(_0x4e8f8b,_0x3a1dcb))[_0x7ad4('0x2a')](handleError(_0x4e8f8b,null));};exports[_0x7ad4('0x92')]=function(_0x2ab063,_0x45bcdd,_0x96c5a){return db[_0x7ad4('0x43')]['findOne']({'where':{'id':_0x2ab063[_0x7ad4('0x5c')]['id']}})['then'](handleEntityNotFound(_0x45bcdd,null))[_0x7ad4('0x21')](function(_0x23c0b2){if(_0x23c0b2){return db[_0x7ad4('0x93')][_0x7ad4('0x94')](function(_0x1dbd0c){return db[_0x7ad4('0x95')][_0x7ad4('0x38')]({'where':{'MailAccountId':_0x2ab063[_0x7ad4('0x5c')]['id']},'transaction':_0x1dbd0c})[_0x7ad4('0x21')](function(_0x2d056c){var _0xb0d951=_[_0x7ad4('0x42')](_0x2ab063[_0x7ad4('0x61')],function(_0x342387){_0x342387[_0x7ad4('0x67')]=_0x2ab063[_0x7ad4('0x5c')]['id'];return _0x342387;});return db['MailApplication'][_0x7ad4('0x96')](_0xb0d951,{'transaction':_0x1dbd0c});});})[_0x7ad4('0x21')](function(){return db[_0x7ad4('0x95')][_0x7ad4('0x97')]({'where':{'MailAccountId':_0x2ab063[_0x7ad4('0x5c')]['id']},'order':_0x7ad4('0x98')});});}})[_0x7ad4('0x21')](respondWithResult(_0x45bcdd,null))[_0x7ad4('0x2a')](handleError(_0x45bcdd,null));};exports[_0x7ad4('0x99')]=function(_0x2c4c68,_0x31c890,_0x323242){var _0x45e663={};var _0x207c7e={};var _0x31a8d3;var _0x4b2ef3;return db['MailAccount']['findOne']({'where':{'id':_0x2c4c68['params']['id']}})[_0x7ad4('0x21')](handleEntityNotFound(_0x31c890,null))['then'](function(_0x3a7012){if(_0x3a7012){_0x31a8d3=_0x3a7012;_0x207c7e[_0x7ad4('0x46')]=_[_0x7ad4('0x48')](db[_0x7ad4('0x95')][_0x7ad4('0x44')]);_0x207c7e[_0x7ad4('0x47')]=_[_0x7ad4('0x48')](_0x2c4c68[_0x7ad4('0x47')]);_0x207c7e[_0x7ad4('0x49')]=_[_0x7ad4('0x4a')](_0x207c7e[_0x7ad4('0x46')],_0x207c7e[_0x7ad4('0x47')]);_0x45e663['attributes']=_[_0x7ad4('0x4a')](_0x207c7e[_0x7ad4('0x46')],qs['fields'](_0x2c4c68[_0x7ad4('0x47')]['fields']));_0x45e663['attributes']=_0x45e663['attributes'][_0x7ad4('0x4c')]?_0x45e663[_0x7ad4('0x5f')]:_0x207c7e[_0x7ad4('0x46')];_0x45e663[_0x7ad4('0x66')]=qs[_0x7ad4('0x4f')](_0x2c4c68['query']['sort']);_0x45e663[_0x7ad4('0x52')]=qs[_0x7ad4('0x49')](_[_0x7ad4('0x50')](_0x2c4c68['query'],_0x207c7e[_0x7ad4('0x49')]));if(_0x2c4c68['query']['filter']){_0x45e663[_0x7ad4('0x52')]=_['merge'](_0x45e663['where'],{'$or':_[_0x7ad4('0x42')](_0x45e663['attributes'],function(_0x47c8b0){var _0xf9f1ce={};_0xf9f1ce[_0x47c8b0]={'$like':'%'+_0x2c4c68[_0x7ad4('0x47')][_0x7ad4('0x51')]+'%'};return _0xf9f1ce;})});}_0x45e663=_['merge']({},_0x45e663,_0x2c4c68[_0x7ad4('0x56')]);return _0x31a8d3['getApplications'](_0x45e663);}})[_0x7ad4('0x21')](function(_0x2a2eda){if(_0x2a2eda){_0x4b2ef3=_0x2a2eda['length'];if(!_0x2c4c68[_0x7ad4('0x47')][_0x7ad4('0x4d')]('nolimit')){_0x45e663['limit']=qs['limit'](_0x2c4c68['query'][_0x7ad4('0x31')]);_0x45e663[_0x7ad4('0x2e')]=qs[_0x7ad4('0x2e')](_0x2c4c68[_0x7ad4('0x47')][_0x7ad4('0x2e')]);}return _0x31a8d3[_0x7ad4('0x99')](_0x45e663);}})['then'](function(_0x1cc560){if(_0x1cc560){return _0x1cc560?{'count':_0x4b2ef3,'rows':_0x1cc560}:null;}})['then'](respondWithResult(_0x31c890,null))[_0x7ad4('0x2a')](handleError(_0x31c890,null));};exports[_0x7ad4('0x9a')]=function(_0x1ab037,_0x2c24f8,_0x385022){var _0x4a3db1={'raw':!![],'where':{}};var _0x39862d={};var _0x1a073b={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1ab037[_0x7ad4('0x5c')]['id']}})[_0x7ad4('0x21')](handleEntityNotFound(_0x2c24f8,null))['then'](function(_0x4e6e8c){if(_0x4e6e8c){_0x39862d[_0x7ad4('0x46')]=_[_0x7ad4('0x48')](db[_0x7ad4('0x9b')]['rawAttributes']);_0x39862d[_0x7ad4('0x47')]=_['keys'](_0x1ab037[_0x7ad4('0x47')]);_0x39862d[_0x7ad4('0x49')]=_[_0x7ad4('0x4a')](_0x39862d[_0x7ad4('0x46')],_0x39862d['query']);_0x4a3db1[_0x7ad4('0x5f')]=_[_0x7ad4('0x4a')](_0x39862d[_0x7ad4('0x46')],qs[_0x7ad4('0x4b')](_0x1ab037['query'][_0x7ad4('0x4b')]));_0x4a3db1[_0x7ad4('0x5f')]=_0x4a3db1[_0x7ad4('0x5f')][_0x7ad4('0x4c')]?_0x4a3db1[_0x7ad4('0x5f')]:_0x39862d[_0x7ad4('0x46')];if(!_0x1ab037[_0x7ad4('0x47')][_0x7ad4('0x4d')](_0x7ad4('0x4e'))){_0x4a3db1[_0x7ad4('0x31')]=qs[_0x7ad4('0x31')](_0x1ab037['query'][_0x7ad4('0x31')]);_0x4a3db1[_0x7ad4('0x2e')]=qs[_0x7ad4('0x2e')](_0x1ab037[_0x7ad4('0x47')]['offset']);}_0x4a3db1[_0x7ad4('0x66')]=qs[_0x7ad4('0x4f')](_0x1ab037[_0x7ad4('0x47')][_0x7ad4('0x4f')]);_0x4a3db1[_0x7ad4('0x52')]=qs[_0x7ad4('0x49')](_[_0x7ad4('0x50')](_0x1ab037['query'],_0x39862d['filters']));_0x4a3db1[_0x7ad4('0x52')][_0x7ad4('0x67')]=_0x4e6e8c['id'];if(_0x1ab037[_0x7ad4('0x47')][_0x7ad4('0x51')]){_0x4a3db1[_0x7ad4('0x52')]=_[_0x7ad4('0x53')](_0x4a3db1[_0x7ad4('0x52')],{'$or':_[_0x7ad4('0x42')](_0x4a3db1[_0x7ad4('0x5f')],function(_0x25d908){var _0x4aa82b={};_0x4aa82b[_0x25d908]={'$like':'%'+_0x1ab037[_0x7ad4('0x47')][_0x7ad4('0x51')]+'%'};return _0x4aa82b;})});}if(_0x1ab037[_0x7ad4('0x47')][_0x7ad4('0x9c')]){var _0x510f36=_0x1ab037[_0x7ad4('0x47')]['$gte']['split'](',');var _0x3e8cd7={};_0x3e8cd7[_0x510f36[0x0]]={'$gte':moment(_0x510f36[0x1])[_0x7ad4('0x9d')](_0x7ad4('0x9e'))};_0x4a3db1['where']=_[_0x7ad4('0x53')](_0x4a3db1[_0x7ad4('0x52')],_0x3e8cd7);}_0x4a3db1=_['merge']({},_0x4a3db1,_0x1ab037[_0x7ad4('0x56')]);return db[_0x7ad4('0x9b')]['count']({'where':_0x4a3db1[_0x7ad4('0x52')]})[_0x7ad4('0x21')](function(_0x5db377){_0x1a073b[_0x7ad4('0x30')]=_0x5db377;if(_0x1ab037[_0x7ad4('0x47')][_0x7ad4('0x57')]){_0x4a3db1[_0x7ad4('0x58')]=[{'all':!![]}];}return db[_0x7ad4('0x9b')]['findAll'](_0x4a3db1);})['then'](function(_0x20657d){if(_0x1ab037[_0x7ad4('0x47')]['inlineCss']===_0x7ad4('0x9f')){for(var _0x21e131=0x0;_0x21e131<_0x20657d['length'];_0x21e131++){_0x20657d[_0x21e131][_0x7ad4('0x61')]=juice(_0x20657d[_0x21e131][_0x7ad4('0x61')]);}}_0x1a073b[_0x7ad4('0x5a')]=_0x20657d;return _0x1a073b;});}})[_0x7ad4('0x21')](respondWithFilteredResult(_0x2c24f8,_0x4a3db1))[_0x7ad4('0x2a')](handleError(_0x2c24f8,null));};exports[_0x7ad4('0xa0')]=function(_0x4d3e54,_0xac20e3,_0x2babdb){var _0x59fa11,_0x417ba2={},_0x3ec1c6;if(_0x4d3e54[_0x7ad4('0x61')]['to']){_0x3ec1c6=_0x4d3e54['body']['to'][_0x7ad4('0xa1')](',')[0x0];}return db['MailAccount'][_0x7ad4('0x60')]({'where':{'id':_0x4d3e54[_0x7ad4('0x5c')]['id']},'include':[{'model':db[_0x7ad4('0xa2')],'as':'List','include':[{'model':db[_0x7ad4('0x89')],'as':_0x7ad4('0xa3'),'where':{'email':_0x3ec1c6},'limit':0x1,'order':[[_0x7ad4('0xa4'),'DESC']]}]},{'model':db[_0x7ad4('0x3f')],'as':_0x7ad4('0x40'),'raw':!![]}]})[_0x7ad4('0x21')](handleEntityNotFound(_0xac20e3,null))[_0x7ad4('0x21')](function(_0x4138bb){if(_0x4138bb){_0x59fa11=_0x4138bb;if(_0x4138bb['Smtp']){if(_[_0x7ad4('0x71')](_0x4d3e54[_0x7ad4('0x61')][_0x7ad4('0xa5')])){_0x4d3e54['body'][_0x7ad4('0xa5')]=util[_0x7ad4('0x9d')](_0x7ad4('0xa6'),_0x4138bb[_0x7ad4('0x3d')],_0x4138bb[_0x7ad4('0xa7')]||_0x4138bb[_0x7ad4('0x40')][_0x7ad4('0x75')]);}if(_0x4d3e54[_0x7ad4('0x61')][_0x7ad4('0xa8')]&&_0x4d3e54[_0x7ad4('0x61')][_0x7ad4('0xa8')][_0x7ad4('0x4c')]){for(var _0x378301=0x0;_0x378301<_0x4d3e54[_0x7ad4('0x61')][_0x7ad4('0xa8')][_0x7ad4('0x4c')];_0x378301+=0x1){_0x4d3e54[_0x7ad4('0x61')]['attachments'][_0x378301]={'filename':_0x4d3e54[_0x7ad4('0x61')][_0x7ad4('0xa8')][_0x378301][_0x7ad4('0x3d')],'path':path[_0x7ad4('0xa9')](config['root'],_0x7ad4('0xaa'),_0x4d3e54[_0x7ad4('0x61')][_0x7ad4('0xa8')][_0x378301][_0x7ad4('0xab')])};}}var _0x44576e={'tls':{'rejectUnauthorized':![]}};if(_[_0x7ad4('0x71')](_0x4138bb[_0x7ad4('0x40')][_0x7ad4('0x7c')])){if(_0x4138bb['Smtp']['authentication']){_0x44576e[_0x7ad4('0xac')]={'user':_0x4138bb[_0x7ad4('0x40')][_0x7ad4('0x75')],'pass':_0x4138bb[_0x7ad4('0x40')][_0x7ad4('0xad')]};}_0x44576e[_0x7ad4('0x7a')]=_0x4138bb[_0x7ad4('0x40')]['host'];_0x44576e[_0x7ad4('0x7b')]=_0x4138bb[_0x7ad4('0x40')]['port'];_0x44576e[_0x7ad4('0xae')]=_0x4138bb['Smtp'][_0x7ad4('0xae')];}else{_0x44576e[_0x7ad4('0x7c')]=_0x4138bb[_0x7ad4('0x40')][_0x7ad4('0x7c')];_0x44576e[_0x7ad4('0xac')]={'user':_0x4138bb[_0x7ad4('0x40')][_0x7ad4('0x75')],'pass':_0x4138bb['Smtp']['pass']};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x44576e,'message':_0x4d3e54[_0x7ad4('0x61')]});}else{throw new Error(_0x7ad4('0xaf'));}}})[_0x7ad4('0x21')](function(_0x2c5e6){if(_0x2c5e6){_0x417ba2=_0x2c5e6;if(_0x59fa11['List']){if(_0x59fa11[_0x7ad4('0xb0')]['Contacts'][_0x7ad4('0x4c')]){return _0x59fa11[_0x7ad4('0xb0')][_0x7ad4('0xa3')][0x0];}else{return db[_0x7ad4('0x89')]['create'](_['defaults'](_0x4d3e54[_0x7ad4('0x61')],{'firstName':_0x4d3e54[_0x7ad4('0x61')]['to'],'email':_0x4d3e54[_0x7ad4('0x61')]['to'],'phone':_0x4d3e54['body']['to'],'ListId':_0x59fa11['ListId']}));}}else{throw new Error(_0x7ad4('0xaf'));}}})[_0x7ad4('0x21')](function(_0x2eab9b){if(_0x2eab9b){var _0x1a2e61={'UserId':_0x4d3e54['user']['id'],'ContactId':_0x2eab9b['id'],'MailAccountId':_0x59fa11['id'],'inReplyTo':_0x417ba2[_0x7ad4('0xb1')],'to':_0x4d3e54['body'][_0x7ad4('0xa5')],'cc':_0x4d3e54['body']['cc'],'subject':_0x4d3e54['body'][_0x7ad4('0xb2')],'attach':_0x4d3e54['body']['attach'],'firstMsgDirection':_0x7ad4('0xb3'),'lastMsgAt':moment()[_0x7ad4('0x9d')](_0x7ad4('0x9e')),'lastMsgDirection':'out','Messages':[_[_0x7ad4('0x53')](_0x4d3e54[_0x7ad4('0x61')],{'messageId':_0x417ba2[_0x7ad4('0xb1')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x59fa11['id'],'UserId':_0x4d3e54[_0x7ad4('0x75')]['id'],'ContactId':_0x2eab9b['id']})]};if(_0x4d3e54['body'][_0x7ad4('0xb4')]){_0x1a2e61=_[_0x7ad4('0x53')](_0x1a2e61,_0x4d3e54[_0x7ad4('0x61')][_0x7ad4('0xb4')]);}return db['MailInteraction']['create'](_0x1a2e61,{'include':[{'model':db[_0x7ad4('0x9b')],'as':_0x7ad4('0xb5')}]});}})[_0x7ad4('0x21')](respondWithResult(_0xac20e3,null))[_0x7ad4('0x2a')](handleError(_0xac20e3,null));};exports['verifySmtp']=function(_0x21d65f,_0x821d66,_0x3c1531){return db[_0x7ad4('0x43')][_0x7ad4('0x60')]({'where':{'id':_0x21d65f[_0x7ad4('0x5c')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x7ad4('0x40'),'raw':!![]}]})['then'](handleEntityNotFound(_0x821d66,null))[_0x7ad4('0x21')](function(_0x3ef626){if(_0x3ef626&&_0x3ef626['Smtp']){var _0x79e28={'id':_0x3ef626['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3ef626[_0x7ad4('0x40')][_0x7ad4('0x7c')]){_0x79e28[_0x7ad4('0x7c')]=_0x3ef626[_0x7ad4('0x40')]['service'];}else{_0x79e28['host']=_0x3ef626[_0x7ad4('0x40')]['host'];_0x79e28[_0x7ad4('0x7b')]=_0x3ef626[_0x7ad4('0x40')]['port'];_0x79e28[_0x7ad4('0xae')]=_0x3ef626[_0x7ad4('0x40')][_0x7ad4('0xae')];}if(_0x3ef626[_0x7ad4('0x40')][_0x7ad4('0x79')]){_0x79e28[_0x7ad4('0xac')]={'user':_0x3ef626[_0x7ad4('0x40')][_0x7ad4('0x75')],'pass':_0x3ef626[_0x7ad4('0x40')][_0x7ad4('0xad')]};}return respondWithRpcPromise(_0x7ad4('0xb6'),'verifySmtp',{'account':_0x79e28});}})['then'](respondWithResult(_0x821d66,null))[_0x7ad4('0x2a')](handleError(_0x821d66,null));};exports['destroy']=function(_0x48954a,_0x4f595f){return db[_0x7ad4('0x43')][_0x7ad4('0x60')]({'where':{'id':_0x48954a[_0x7ad4('0x5c')]['id']}})[_0x7ad4('0x21')](handleEntityNotFound(_0x4f595f,null))[_0x7ad4('0x21')](function(_0x3c2b78){if(_0x3c2b78&&_0x3c2b78[_0x7ad4('0x7c')]){throw new db[(_0x7ad4('0xb7'))][(_0x7ad4('0xb8'))](_0x7ad4('0xb9'));}return _0x3c2b78;})[_0x7ad4('0x21')](removeEntity(_0x4f595f,null))['catch'](handleError(_0x4f595f,null));};exports[_0x7ad4('0xba')]=function(_0xa256df,_0x106173,_0x10ce4b){return db[_0x7ad4('0x43')][_0x7ad4('0x60')]({'where':{'id':_0xa256df[_0x7ad4('0x5c')]['id']}})['then'](handleEntityNotFound(_0x106173,null))[_0x7ad4('0x21')](function(_0x432f00){if(_0x432f00){return _0x432f00[_0x7ad4('0xba')](_0xa256df[_0x7ad4('0x61')]['ids'],_[_0x7ad4('0x87')](_0xa256df[_0x7ad4('0x61')],['ids','id'])||{})[_0x7ad4('0xbb')](function(_0x6366ed){for(var _0x39d7d3=0x0;_0x39d7d3<_0xa256df['body'][_0x7ad4('0x69')][_0x7ad4('0x4c')];_0x39d7d3+=0x1){socket[_0x7ad4('0xbc')](_0x7ad4('0xbd'),{'UserId':Number(_0xa256df[_0x7ad4('0x61')][_0x7ad4('0x69')][_0x39d7d3]),'MailAccountId':Number(_0xa256df[_0x7ad4('0x5c')]['id'])});}return _0x6366ed;});}})[_0x7ad4('0x21')](respondWithResult(_0x106173,null))[_0x7ad4('0x2a')](handleError(_0x106173,null));};exports[_0x7ad4('0xbe')]=function(_0x396e28,_0x50bbbd,_0x958adf){return db[_0x7ad4('0x43')][_0x7ad4('0x60')]({'where':{'id':_0x396e28['params']['id']}})['then'](handleEntityNotFound(_0x50bbbd,null))[_0x7ad4('0x21')](function(_0x3101cb){if(_0x3101cb){return _0x3101cb['removeAgents'](_0x396e28['query'][_0x7ad4('0x69')])[_0x7ad4('0x21')](function(){if(_[_0x7ad4('0xbf')](_0x396e28[_0x7ad4('0x47')][_0x7ad4('0x69')])){for(var _0x2c4fec=0x0;_0x2c4fec<_0x396e28['query']['ids'][_0x7ad4('0x4c')];_0x2c4fec+=0x1){socket[_0x7ad4('0xbc')]('userMailAccount:remove',{'UserId':Number(_0x396e28[_0x7ad4('0x47')][_0x7ad4('0x69')][_0x2c4fec]),'MailAccountId':Number(_0x396e28[_0x7ad4('0x5c')]['id'])});}}else{socket[_0x7ad4('0xbc')](_0x7ad4('0xc0'),{'UserId':Number(_0x396e28['query'][_0x7ad4('0x69')]),'MailAccountId':Number(_0x396e28['params']['id'])});}});}})[_0x7ad4('0x21')](respondWithStatusCode(_0x50bbbd,null))['catch'](handleError(_0x50bbbd,null));};exports[_0x7ad4('0xc1')]=function(_0x26b440,_0x1cad12,_0x425079){var _0x1518ce={};var _0x280ae5={};var _0x3204f0;var _0xe4c34e;return db['MailAccount'][_0x7ad4('0x6d')]({'where':{'id':_0x26b440[_0x7ad4('0x5c')]['id']}})[_0x7ad4('0x21')](handleEntityNotFound(_0x1cad12,null))['then'](function(_0x1ae36f){if(_0x1ae36f){_0x3204f0=_0x1ae36f;_0x280ae5[_0x7ad4('0x46')]=_['keys'](db[_0x7ad4('0x8b')][_0x7ad4('0x44')]);_0x280ae5['query']=_['keys'](_0x26b440['query']);_0x280ae5[_0x7ad4('0x49')]=_[_0x7ad4('0x4a')](_0x280ae5[_0x7ad4('0x46')],_0x280ae5['query']);_0x1518ce[_0x7ad4('0x5f')]=_[_0x7ad4('0x4a')](_0x280ae5['model'],qs[_0x7ad4('0x4b')](_0x26b440[_0x7ad4('0x47')][_0x7ad4('0x4b')]));_0x1518ce['attributes']=_0x1518ce[_0x7ad4('0x5f')][_0x7ad4('0x4c')]?_0x1518ce['attributes']:_0x280ae5[_0x7ad4('0x46')];_0x1518ce[_0x7ad4('0x66')]=qs[_0x7ad4('0x4f')](_0x26b440[_0x7ad4('0x47')]['sort']);_0x1518ce[_0x7ad4('0x52')]=qs[_0x7ad4('0x49')](_[_0x7ad4('0x50')](_0x26b440['query'],_0x280ae5[_0x7ad4('0x49')]));if(_0x26b440[_0x7ad4('0x47')][_0x7ad4('0x51')]){_0x1518ce[_0x7ad4('0x52')]=_['merge'](_0x1518ce['where'],{'$or':_[_0x7ad4('0x42')](_0x1518ce['attributes'],function(_0x1748c4){var _0x1d7704={};_0x1d7704[_0x1748c4]={'$like':'%'+_0x26b440[_0x7ad4('0x47')][_0x7ad4('0x51')]+'%'};return _0x1d7704;})});}_0x1518ce=_['merge']({},_0x1518ce,_0x26b440['options']);return _0x3204f0[_0x7ad4('0xc1')](_0x1518ce);}})['then'](function(_0xdd0ac){if(_0xdd0ac){_0xe4c34e=_0xdd0ac[_0x7ad4('0x4c')];if(!_0x26b440['query'][_0x7ad4('0x4d')](_0x7ad4('0x4e'))){_0x1518ce[_0x7ad4('0x31')]=qs[_0x7ad4('0x31')](_0x26b440[_0x7ad4('0x47')][_0x7ad4('0x31')]);_0x1518ce[_0x7ad4('0x2e')]=qs[_0x7ad4('0x2e')](_0x26b440[_0x7ad4('0x47')][_0x7ad4('0x2e')]);}return _0x3204f0[_0x7ad4('0xc1')](_0x1518ce);}})[_0x7ad4('0x21')](function(_0x48cfeb){if(_0x48cfeb){return _0x48cfeb?{'count':_0xe4c34e,'rows':_0x48cfeb}:null;}})['then'](respondWithResult(_0x1cad12,null))[_0x7ad4('0x2a')](handleError(_0x1cad12,null));}; \ No newline at end of file +var _0xc1b4=['sendStatus','stack','name','send','index','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','MailServerIn','find','update','body','describe','addDisposition','create','getDispositions','findOne','Disposition','rawAttributes','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','pick','removeAnswers','key','email','ListId','description','isNil','cservice','cauthentication','user','cuser','password','authentication','port','host','service','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','getImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','Tag','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','Contacts','updatedAt','from','%s\x20<%s>','attachments','join','root','server/files/attachments','auth','pass','secure','SendMail','sendMail','List\x20not\x20found','List','CmContact','messageId','subject','attach','out','Interaction','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','MailAccounts','UserProfileResource'];(function(_0x152bdc,_0x3d0f53){var _0x514c4f=function(_0x4e4970){while(--_0x4e4970){_0x152bdc['push'](_0x152bdc['shift']());}};_0x514c4f(++_0x3d0f53);}(_0xc1b4,0x87));var _0x4c1b=function(_0x5aaf42,_0x2e14f2){_0x5aaf42=_0x5aaf42-0x0;var _0x547a37=_0xc1b4[_0x5aaf42];return _0x547a37;};'use strict';var emlformat=require(_0x4c1b('0x0'));var rimraf=require(_0x4c1b('0x1'));var zipdir=require(_0x4c1b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c1b('0x3'));var moment=require(_0x4c1b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4c1b('0x5'));var util=require(_0x4c1b('0x6'));var path=require(_0x4c1b('0x7'));var sox=require(_0x4c1b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c1b('0x9'));var squel=require(_0x4c1b('0xa'));var crypto=require(_0x4c1b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4c1b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require(_0x4c1b('0xd'));var juice=require(_0x4c1b('0xe'));var Redis=require(_0x4c1b('0xf'));var authService=require(_0x4c1b('0x10'));var qs=require(_0x4c1b('0x11'));var as=require(_0x4c1b('0x12'));var hardwareService=require(_0x4c1b('0x13'));var logger=require('../../config/logger')(_0x4c1b('0x14'));var utils=require(_0x4c1b('0x15'));var config=require(_0x4c1b('0x16'));var licenseUtil=require(_0x4c1b('0x17'));var db=require(_0x4c1b('0x18'))['db'];config[_0x4c1b('0x19')]=_[_0x4c1b('0x1a')](config[_0x4c1b('0x19')],{'host':_0x4c1b('0x1b'),'port':0x18eb});var socket=require(_0x4c1b('0x1c'))(new Redis(config[_0x4c1b('0x19')]));require(_0x4c1b('0x1d'))[_0x4c1b('0x1e')](socket);var jayson=require(_0x4c1b('0x1f'));var client=jayson[_0x4c1b('0x20')][_0x4c1b('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x2ef264,_0x4c92c2,_0xc78c6e,_0x59be0f){return new BPromise(function(_0x3d08be,_0x357160){var _0x49bdea=_0x59be0f||client;return _0x49bdea[_0x4c1b('0x22')](_0x2ef264,_0xc78c6e)[_0x4c1b('0x23')](function(_0x86f884){logger[_0x4c1b('0x24')](_0x4c1b('0x25'),_0x4c92c2,_0x4c1b('0x26'));logger[_0x4c1b('0x27')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x4c92c2,_0x4c1b('0x26'),JSON[_0x4c1b('0x28')](_0x86f884));if(_0x86f884['error']){if(_0x86f884[_0x4c1b('0x29')][_0x4c1b('0x2a')]===0x1f4){logger[_0x4c1b('0x29')](_0x4c1b('0x25'),_0x4c92c2,_0x86f884[_0x4c1b('0x29')][_0x4c1b('0x2b')]);return _0x357160(_0x86f884[_0x4c1b('0x29')]['message']);}logger['error'](_0x4c1b('0x25'),_0x4c92c2,_0x86f884['error'][_0x4c1b('0x2b')]);return _0x3d08be(_0x86f884[_0x4c1b('0x29')][_0x4c1b('0x2b')]);}else{logger[_0x4c1b('0x24')]('MailAccount,\x20%s,\x20%s',_0x4c92c2,_0x4c1b('0x26'));_0x3d08be(_0x86f884[_0x4c1b('0x2c')]['message']);}})[_0x4c1b('0x2d')](function(_0x3ba621){logger[_0x4c1b('0x29')](_0x4c1b('0x25'),_0x4c92c2,_0x3ba621);_0x357160(_0x3ba621);});});}function respondWithStatusCode(_0x517051,_0x5f16ef){_0x5f16ef=_0x5f16ef||0xcc;return function(_0x5ef9f8){if(_0x5ef9f8){return _0x517051['sendStatus'](_0x5f16ef);}return _0x517051[_0x4c1b('0x2e')](_0x5f16ef)[_0x4c1b('0x2f')]();};}function respondWithResult(_0x113446,_0x16f30a){_0x16f30a=_0x16f30a||0xc8;return function(_0x13a140){if(_0x13a140){return _0x113446[_0x4c1b('0x2e')](_0x16f30a)[_0x4c1b('0x30')](_0x13a140);}};}function respondWithFilteredResult(_0x5f3f06,_0x5cba9e){return function(_0x3e32c2){if(_0x3e32c2){var _0x34a4bb=typeof _0x5cba9e['offset']==='undefined'&&typeof _0x5cba9e['limit']===_0x4c1b('0x31');var _0x3244b5=_0x3e32c2[_0x4c1b('0x32')];var _0x562cc6=_0x34a4bb?0x0:_0x5cba9e[_0x4c1b('0x33')];var _0x13039f=_0x34a4bb?_0x3e32c2[_0x4c1b('0x32')]:_0x5cba9e[_0x4c1b('0x33')]+_0x5cba9e[_0x4c1b('0x34')];var _0x10e855;if(_0x13039f>=_0x3244b5){_0x13039f=_0x3244b5;_0x10e855=0xc8;}else{_0x10e855=0xce;}_0x5f3f06['status'](_0x10e855);return _0x5f3f06[_0x4c1b('0x35')](_0x4c1b('0x36'),_0x562cc6+'-'+_0x13039f+'/'+_0x3244b5)[_0x4c1b('0x30')](_0x3e32c2);}return null;};}function patchUpdates(_0x19c7b){return function(_0x216fc6){try{jsonpatch[_0x4c1b('0x37')](_0x216fc6,_0x19c7b,!![]);}catch(_0xf87415){return BPromise[_0x4c1b('0x38')](_0xf87415);}return _0x216fc6[_0x4c1b('0x39')]();};}function saveUpdates(_0x38bd0c,_0x324d5f){return function(_0x1c197c){if(_0x1c197c){return _0x1c197c['update'](_0x38bd0c)[_0x4c1b('0x23')](function(_0x183f1a){return _0x183f1a;});}return null;};}function removeEntity(_0x394ce4,_0x1bb79e){return function(_0x2ae75e){if(_0x2ae75e){return _0x2ae75e[_0x4c1b('0x3a')]()['then'](function(){var _0x59cc95=_0x2ae75e[_0x4c1b('0x3b')]({'plain':!![]});var _0x4a2e66=_0x4c1b('0x3c');return db[_0x4c1b('0x3d')][_0x4c1b('0x3a')]({'where':{'type':_0x4a2e66,'resourceId':_0x59cc95['id']}})[_0x4c1b('0x23')](function(){return _0x2ae75e;});})[_0x4c1b('0x23')](function(){_0x394ce4[_0x4c1b('0x2e')](0xcc)[_0x4c1b('0x2f')]();});}};}function handleEntityNotFound(_0x3ec050,_0x153bb2){return function(_0x1cf872){if(!_0x1cf872){_0x3ec050[_0x4c1b('0x3e')](0x194);}return _0x1cf872;};}function handleError(_0x516fe7,_0x1d568e){_0x1d568e=_0x1d568e||0x1f4;return function(_0x851198){logger['error'](_0x851198[_0x4c1b('0x3f')]);if(_0x851198[_0x4c1b('0x40')]){delete _0x851198['name'];}_0x516fe7[_0x4c1b('0x2e')](_0x1d568e)[_0x4c1b('0x41')](_0x851198);};}exports[_0x4c1b('0x42')]=function(_0x5c06c7,_0x26e973){var _0x3140a9={'include':[{'model':db['MailServerIn'],'as':_0x4c1b('0x43')},{'model':db[_0x4c1b('0x44')],'as':_0x4c1b('0x45')},{'model':db[_0x4c1b('0x46')],'as':_0x4c1b('0x47')}]},_0x247398={},_0x2740d6={'count':0x0,'rows':[]};var _0x5e3d64=_[_0x4c1b('0x48')](db[_0x4c1b('0x49')]['rawAttributes'],function(_0x1e699c){return{'name':_0x1e699c[_0x4c1b('0x4a')],'type':_0x1e699c[_0x4c1b('0x4b')]['key']};});_0x247398['model']=_[_0x4c1b('0x48')](_0x5e3d64,_0x4c1b('0x40'));_0x247398[_0x4c1b('0x4c')]=_[_0x4c1b('0x4d')](_0x5c06c7[_0x4c1b('0x4c')]);_0x247398['filters']=_['intersection'](_0x247398[_0x4c1b('0x4e')],_0x247398[_0x4c1b('0x4c')]);_0x3140a9[_0x4c1b('0x4f')]=_[_0x4c1b('0x50')](_0x247398['model'],qs[_0x4c1b('0x51')](_0x5c06c7[_0x4c1b('0x4c')][_0x4c1b('0x51')]));_0x3140a9[_0x4c1b('0x4f')]=_0x3140a9['attributes'][_0x4c1b('0x52')]?_0x3140a9[_0x4c1b('0x4f')]:_0x247398[_0x4c1b('0x4e')];if(!_0x5c06c7['query'][_0x4c1b('0x53')](_0x4c1b('0x54'))){_0x3140a9['limit']=qs[_0x4c1b('0x34')](_0x5c06c7[_0x4c1b('0x4c')][_0x4c1b('0x34')]);_0x3140a9[_0x4c1b('0x33')]=qs['offset'](_0x5c06c7[_0x4c1b('0x4c')][_0x4c1b('0x33')]);}_0x3140a9[_0x4c1b('0x55')]=qs['sort'](_0x5c06c7[_0x4c1b('0x4c')][_0x4c1b('0x56')]);_0x3140a9[_0x4c1b('0x57')]=qs[_0x4c1b('0x58')](_['pick'](_0x5c06c7[_0x4c1b('0x4c')],_0x247398['filters']),_0x5e3d64);if(_0x5c06c7[_0x4c1b('0x4c')][_0x4c1b('0x59')]){_0x3140a9[_0x4c1b('0x57')]=_[_0x4c1b('0x5a')](_0x3140a9[_0x4c1b('0x57')],{'$or':_[_0x4c1b('0x48')](_0x5e3d64,function(_0x152148){if(_0x152148['type']!==_0x4c1b('0x5b')){var _0x66860c={};_0x66860c[_0x152148[_0x4c1b('0x40')]]={'$like':'%'+_0x5c06c7[_0x4c1b('0x4c')]['filter']+'%'};return _0x66860c;}})});}_0x3140a9=_['merge']({},_0x3140a9,_0x5c06c7[_0x4c1b('0x5c')]);var _0x8631b3={'where':_0x3140a9[_0x4c1b('0x57')]};return db[_0x4c1b('0x49')][_0x4c1b('0x32')](_0x8631b3)['then'](function(_0x3bcb97){_0x2740d6['count']=_0x3bcb97;if(_0x5c06c7[_0x4c1b('0x4c')][_0x4c1b('0x5d')]){_0x3140a9[_0x4c1b('0x5e')]=[{'all':!![]}];}return db[_0x4c1b('0x49')][_0x4c1b('0x5f')](_0x3140a9);})['then'](function(_0x38ae34){_0x2740d6[_0x4c1b('0x60')]=_0x38ae34;return _0x2740d6;})[_0x4c1b('0x23')](respondWithFilteredResult(_0x26e973,_0x3140a9))[_0x4c1b('0x2d')](handleError(_0x26e973,null));};exports['show']=function(_0x26e785,_0x356d28){var _0x281165={'raw':![],'where':{'id':_0x26e785[_0x4c1b('0x61')]['id']},'include':[{'model':db[_0x4c1b('0x62')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x4c1b('0x45')},{'model':db[_0x4c1b('0x46')],'as':_0x4c1b('0x47')}]},_0x4966d3={};_0x4966d3['model']=_[_0x4c1b('0x4d')](db[_0x4c1b('0x49')]['rawAttributes']);_0x4966d3[_0x4c1b('0x4c')]=_[_0x4c1b('0x4d')](_0x26e785[_0x4c1b('0x4c')]);_0x4966d3[_0x4c1b('0x58')]=_['intersection'](_0x4966d3['model'],_0x4966d3[_0x4c1b('0x4c')]);_0x281165['attributes']=_[_0x4c1b('0x50')](_0x4966d3['model'],qs[_0x4c1b('0x51')](_0x26e785[_0x4c1b('0x4c')][_0x4c1b('0x51')]));_0x281165[_0x4c1b('0x4f')]=_0x281165[_0x4c1b('0x4f')][_0x4c1b('0x52')]?_0x281165[_0x4c1b('0x4f')]:_0x4966d3[_0x4c1b('0x4e')];if(_0x26e785[_0x4c1b('0x4c')]['includeAll']){_0x281165[_0x4c1b('0x5e')]=[{'all':!![]}];}_0x281165=_[_0x4c1b('0x5a')]({},_0x281165,_0x26e785[_0x4c1b('0x5c')]);return db[_0x4c1b('0x49')][_0x4c1b('0x63')](_0x281165)[_0x4c1b('0x23')](handleEntityNotFound(_0x356d28,null))[_0x4c1b('0x23')](respondWithResult(_0x356d28,null))[_0x4c1b('0x2d')](handleError(_0x356d28,null));};exports[_0x4c1b('0x64')]=function(_0x41d50e,_0x16e0a2){if(_0x41d50e[_0x4c1b('0x65')]['id']){delete _0x41d50e[_0x4c1b('0x65')]['id'];}return db[_0x4c1b('0x49')]['find']({'where':{'id':_0x41d50e[_0x4c1b('0x61')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x4c1b('0x43')},{'model':db[_0x4c1b('0x44')],'as':_0x4c1b('0x45')},{'model':db[_0x4c1b('0x46')],'as':_0x4c1b('0x47')}]})[_0x4c1b('0x23')](handleEntityNotFound(_0x16e0a2,null))[_0x4c1b('0x23')](saveUpdates(_0x41d50e[_0x4c1b('0x65')],null))[_0x4c1b('0x23')](function(_0x24aa46){if(_0x24aa46&&_0x41d50e[_0x4c1b('0x65')][_0x4c1b('0x43')]){return db[_0x4c1b('0x62')][_0x4c1b('0x64')](_0x41d50e[_0x4c1b('0x65')]['Imap'],{'where':{'MailAccountId':_0x24aa46['id']}})[_0x4c1b('0x23')](function(){return _0x24aa46;});}return _0x24aa46;})[_0x4c1b('0x23')](function(_0x1203b7){if(_0x1203b7&&_0x41d50e[_0x4c1b('0x65')][_0x4c1b('0x45')]){return db[_0x4c1b('0x44')]['update'](_0x41d50e[_0x4c1b('0x65')][_0x4c1b('0x45')],{'where':{'MailAccountId':_0x1203b7['id']}})[_0x4c1b('0x23')](function(){return _0x1203b7;});}return _0x1203b7;})[_0x4c1b('0x23')](respondWithResult(_0x16e0a2,null))[_0x4c1b('0x2d')](handleError(_0x16e0a2,null));};exports[_0x4c1b('0x66')]=function(_0x56c08a,_0x1599ca){return db[_0x4c1b('0x49')][_0x4c1b('0x66')]()[_0x4c1b('0x23')](respondWithResult(_0x1599ca,null))[_0x4c1b('0x2d')](handleError(_0x1599ca,null));};exports[_0x4c1b('0x67')]=function(_0x33e07c,_0x340e34,_0x456642){if(_0x33e07c[_0x4c1b('0x65')]['id']){delete _0x33e07c[_0x4c1b('0x65')]['id'];}return db[_0x4c1b('0x49')]['find']({'where':{'id':_0x33e07c[_0x4c1b('0x61')]['id']}})['then'](handleEntityNotFound(_0x340e34,null))[_0x4c1b('0x23')](function(_0x2b073f){if(_0x2b073f){_0x33e07c['body']['MailAccountId']=_0x2b073f['id'];return db['Disposition'][_0x4c1b('0x68')](_0x33e07c['body']);}})['then'](respondWithResult(_0x340e34,null))[_0x4c1b('0x2d')](handleError(_0x340e34,null));};exports[_0x4c1b('0x69')]=function(_0x2f2de2,_0x53ecf0,_0x4ff539){var _0x16ba42={'raw':![],'where':{}};var _0x270c97={};var _0x2e1019={'count':0x0,'rows':[]};return db[_0x4c1b('0x49')][_0x4c1b('0x6a')]({'where':{'id':_0x2f2de2['params']['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x53ecf0,null))[_0x4c1b('0x23')](function(_0x8ec6e1){if(_0x8ec6e1){_0x270c97[_0x4c1b('0x4e')]=_[_0x4c1b('0x4d')](db[_0x4c1b('0x6b')][_0x4c1b('0x6c')]);_0x270c97['query']=_[_0x4c1b('0x4d')](_0x2f2de2[_0x4c1b('0x4c')]);_0x270c97[_0x4c1b('0x58')]=_[_0x4c1b('0x50')](_0x270c97['model'],_0x270c97['query']);_0x16ba42[_0x4c1b('0x4f')]=_[_0x4c1b('0x50')](_0x270c97['model'],qs['fields'](_0x2f2de2[_0x4c1b('0x4c')][_0x4c1b('0x51')]));_0x16ba42['attributes']=_0x16ba42[_0x4c1b('0x4f')]['length']?_0x16ba42['attributes']:_0x270c97[_0x4c1b('0x4e')];if(!_0x2f2de2[_0x4c1b('0x4c')][_0x4c1b('0x53')](_0x4c1b('0x54'))){_0x16ba42[_0x4c1b('0x34')]=qs[_0x4c1b('0x34')](_0x2f2de2[_0x4c1b('0x4c')][_0x4c1b('0x34')]);_0x16ba42[_0x4c1b('0x33')]=qs[_0x4c1b('0x33')](_0x2f2de2['query']['offset']);}_0x16ba42[_0x4c1b('0x55')]=qs['sort'](_0x2f2de2[_0x4c1b('0x4c')]['sort']);_0x16ba42[_0x4c1b('0x57')]=qs['filters'](_['pick'](_0x2f2de2[_0x4c1b('0x4c')],_0x270c97['filters']));_0x16ba42[_0x4c1b('0x57')][_0x4c1b('0x6d')]=_0x8ec6e1['id'];if(_0x2f2de2[_0x4c1b('0x4c')][_0x4c1b('0x59')]){_0x16ba42[_0x4c1b('0x57')]=_[_0x4c1b('0x5a')](_0x16ba42['where'],{'$or':_[_0x4c1b('0x48')](_0x16ba42['attributes'],function(_0x547d54){var _0x4ab264={};_0x4ab264[_0x547d54]={'$like':'%'+_0x2f2de2[_0x4c1b('0x4c')][_0x4c1b('0x59')]+'%'};return _0x4ab264;})});}_0x16ba42=_[_0x4c1b('0x5a')]({},_0x16ba42,_0x2f2de2[_0x4c1b('0x5c')]);return db['Disposition'][_0x4c1b('0x32')]({'where':_0x16ba42[_0x4c1b('0x57')]})[_0x4c1b('0x23')](function(_0x4ec1c1){_0x2e1019[_0x4c1b('0x32')]=_0x4ec1c1;if(_0x2f2de2[_0x4c1b('0x4c')][_0x4c1b('0x5d')]){_0x16ba42['include']=[{'all':!![]}];}return db['Disposition'][_0x4c1b('0x5f')](_0x16ba42);})[_0x4c1b('0x23')](function(_0x5d8dd3){_0x2e1019[_0x4c1b('0x60')]=_0x5d8dd3;return _0x2e1019;});}})[_0x4c1b('0x23')](respondWithFilteredResult(_0x53ecf0,_0x16ba42))['catch'](handleError(_0x53ecf0,null));};exports[_0x4c1b('0x6e')]=function(_0x34fc5b,_0x195a65,_0x2f9f5d){return db[_0x4c1b('0x49')][_0x4c1b('0x63')]({'where':{'id':_0x34fc5b[_0x4c1b('0x61')]['id']}})['then'](handleEntityNotFound(_0x195a65,null))[_0x4c1b('0x23')](function(_0x3d3275){if(_0x3d3275){return _0x3d3275['removeDispositions'](_0x34fc5b[_0x4c1b('0x4c')][_0x4c1b('0x6f')]);}})[_0x4c1b('0x23')](respondWithStatusCode(_0x195a65,null))[_0x4c1b('0x2d')](handleError(_0x195a65,null));};exports[_0x4c1b('0x70')]=function(_0x35ad55,_0x260ada,_0x4f23d5){if(_0x35ad55['body']['id']){delete _0x35ad55['body']['id'];}return db[_0x4c1b('0x49')][_0x4c1b('0x63')]({'where':{'id':_0x35ad55['params']['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x260ada,null))[_0x4c1b('0x23')](function(_0x4eda8f){if(_0x4eda8f){_0x35ad55[_0x4c1b('0x65')]['MailAccountId']=_0x4eda8f['id'];return db[_0x4c1b('0x71')][_0x4c1b('0x68')](_0x35ad55['body']);}})[_0x4c1b('0x23')](respondWithResult(_0x260ada,null))['catch'](handleError(_0x260ada,null));};exports['getAnswers']=function(_0x293c31,_0x39b909,_0x3aeba4){var _0x41d31a={'raw':![],'where':{}};var _0x32c7c5={};var _0x40e1b6={'count':0x0,'rows':[]};return db[_0x4c1b('0x49')][_0x4c1b('0x6a')]({'where':{'id':_0x293c31[_0x4c1b('0x61')]['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x39b909,null))['then'](function(_0x4fe52b){if(_0x4fe52b){_0x32c7c5['model']=_['keys'](db[_0x4c1b('0x71')][_0x4c1b('0x6c')]);_0x32c7c5[_0x4c1b('0x4c')]=_['keys'](_0x293c31[_0x4c1b('0x4c')]);_0x32c7c5[_0x4c1b('0x58')]=_[_0x4c1b('0x50')](_0x32c7c5['model'],_0x32c7c5[_0x4c1b('0x4c')]);_0x41d31a[_0x4c1b('0x4f')]=_[_0x4c1b('0x50')](_0x32c7c5[_0x4c1b('0x4e')],qs[_0x4c1b('0x51')](_0x293c31[_0x4c1b('0x4c')]['fields']));_0x41d31a[_0x4c1b('0x4f')]=_0x41d31a['attributes'][_0x4c1b('0x52')]?_0x41d31a[_0x4c1b('0x4f')]:_0x32c7c5[_0x4c1b('0x4e')];if(!_0x293c31[_0x4c1b('0x4c')]['hasOwnProperty'](_0x4c1b('0x54'))){_0x41d31a[_0x4c1b('0x34')]=qs['limit'](_0x293c31[_0x4c1b('0x4c')]['limit']);_0x41d31a[_0x4c1b('0x33')]=qs[_0x4c1b('0x33')](_0x293c31[_0x4c1b('0x4c')][_0x4c1b('0x33')]);}_0x41d31a['order']=qs[_0x4c1b('0x56')](_0x293c31[_0x4c1b('0x4c')][_0x4c1b('0x56')]);_0x41d31a['where']=qs[_0x4c1b('0x58')](_[_0x4c1b('0x72')](_0x293c31[_0x4c1b('0x4c')],_0x32c7c5[_0x4c1b('0x58')]));_0x41d31a[_0x4c1b('0x57')]['MailAccountId']=_0x4fe52b['id'];if(_0x293c31[_0x4c1b('0x4c')]['filter']){_0x41d31a[_0x4c1b('0x57')]=_['merge'](_0x41d31a[_0x4c1b('0x57')],{'$or':_[_0x4c1b('0x48')](_0x41d31a[_0x4c1b('0x4f')],function(_0x40302f){var _0x14173f={};_0x14173f[_0x40302f]={'$like':'%'+_0x293c31[_0x4c1b('0x4c')]['filter']+'%'};return _0x14173f;})});}_0x41d31a=_[_0x4c1b('0x5a')]({},_0x41d31a,_0x293c31[_0x4c1b('0x5c')]);return db[_0x4c1b('0x71')]['count']({'where':_0x41d31a[_0x4c1b('0x57')]})[_0x4c1b('0x23')](function(_0x3b05fb){_0x40e1b6[_0x4c1b('0x32')]=_0x3b05fb;if(_0x293c31[_0x4c1b('0x4c')]['includeAll']){_0x41d31a[_0x4c1b('0x5e')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x41d31a);})[_0x4c1b('0x23')](function(_0x37cb8f){_0x40e1b6[_0x4c1b('0x60')]=_0x37cb8f;return _0x40e1b6;});}})['then'](respondWithFilteredResult(_0x39b909,_0x41d31a))[_0x4c1b('0x2d')](handleError(_0x39b909,null));};exports[_0x4c1b('0x73')]=function(_0x5ec3f4,_0x163a13,_0x5e6ca1){return db[_0x4c1b('0x49')]['find']({'where':{'id':_0x5ec3f4['params']['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x163a13,null))[_0x4c1b('0x23')](function(_0x4a281b){if(_0x4a281b){return _0x4a281b[_0x4c1b('0x73')](_0x5ec3f4['query'][_0x4c1b('0x6f')]);}})[_0x4c1b('0x23')](respondWithStatusCode(_0x163a13,null))[_0x4c1b('0x2d')](handleError(_0x163a13,null));};exports[_0x4c1b('0x68')]=function(_0x2c3502,_0x33418f){var _0x38faa7={'name':_0x2c3502['body']['name'],'key':_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x74')],'email':_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x75')],'ListId':_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x76')],'active':!_['isNil'](_0x2c3502[_0x4c1b('0x65')]['active'])?_0x2c3502['body']['active']:!![],'description':_0x2c3502['body'][_0x4c1b('0x77')]||null,'Imap':{},'Smtp':{}};if(_[_0x4c1b('0x78')](_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x79')])){if(_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x7a')]){_0x38faa7[_0x4c1b('0x43')]['user']=_0x38faa7[_0x4c1b('0x45')][_0x4c1b('0x7b')]=_0x2c3502['body'][_0x4c1b('0x7c')];_0x38faa7[_0x4c1b('0x43')][_0x4c1b('0x7d')]=_0x38faa7[_0x4c1b('0x45')]['pass']=_0x2c3502['body']['cpassword'];}else{_0x38faa7['Imap'][_0x4c1b('0x7e')]=_0x38faa7[_0x4c1b('0x45')][_0x4c1b('0x7e')]=![];}_0x38faa7[_0x4c1b('0x43')]['host']=_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x43')]['host'];_0x38faa7[_0x4c1b('0x43')]['port']=_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x43')][_0x4c1b('0x7f')];_0x38faa7[_0x4c1b('0x45')][_0x4c1b('0x80')]=_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x45')][_0x4c1b('0x80')];_0x38faa7[_0x4c1b('0x45')][_0x4c1b('0x7f')]=_0x2c3502[_0x4c1b('0x65')]['Smtp'][_0x4c1b('0x7f')];}else{_0x38faa7['Imap'][_0x4c1b('0x81')]=_0x38faa7['Smtp'][_0x4c1b('0x81')]=_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x79')];_0x38faa7[_0x4c1b('0x43')][_0x4c1b('0x7b')]=_0x38faa7['Smtp']['user']=_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x7c')];_0x38faa7['Imap']['password']=_0x38faa7['Smtp']['pass']=_0x2c3502['body'][_0x4c1b('0x82')];}return db[_0x4c1b('0x49')]['create'](_0x38faa7,{'include':[{'model':db[_0x4c1b('0x44')],'as':'Smtp'},{'model':db[_0x4c1b('0x62')],'as':'Imap'}]})[_0x4c1b('0x23')](function(_0x8b9d3c){var _0x1ea6b3=_0x2c3502[_0x4c1b('0x7b')][_0x4c1b('0x3b')]({'plain':!![]});if(!_0x1ea6b3)throw new Error(_0x4c1b('0x83'));if(_0x1ea6b3['role']===_0x4c1b('0x7b')){var _0x7692e=_0x8b9d3c[_0x4c1b('0x3b')]({'plain':!![]});return db['UserProfileSection'][_0x4c1b('0x63')]({'where':{'name':_0x4c1b('0x3c'),'userProfileId':_0x1ea6b3[_0x4c1b('0x84')]},'raw':!![]})[_0x4c1b('0x23')](function(_0x59fba4){if(_0x59fba4&&_0x59fba4['autoAssociation']===0x0){return db[_0x4c1b('0x3d')][_0x4c1b('0x68')]({'name':_0x7692e[_0x4c1b('0x40')],'resourceId':_0x7692e['id'],'type':_0x59fba4['name'],'sectionId':_0x59fba4['id']},{})[_0x4c1b('0x23')](function(){return _0x8b9d3c;});}else{return _0x8b9d3c;}})['catch'](function(_0x55cf3a){logger[_0x4c1b('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55cf3a);throw _0x55cf3a;});}return _0x8b9d3c;})['then'](respondWithResult(_0x33418f,0xc9))[_0x4c1b('0x2d')](handleError(_0x33418f,null));};exports[_0x4c1b('0x85')]=function(_0x12fc61,_0x4e0aff,_0x20a9bd){return db[_0x4c1b('0x49')][_0x4c1b('0x6a')]({'where':{'id':_0x12fc61[_0x4c1b('0x61')]['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x4e0aff,null))['then'](function(_0xba9ba1){if(_0xba9ba1){return _0xba9ba1[_0x4c1b('0x85')]();}return null;})[_0x4c1b('0x23')](respondWithResult(_0x4e0aff,null))[_0x4c1b('0x2d')](handleError(_0x4e0aff,null));};exports['addImap']=function(_0x373adc,_0x158fa0,_0x5a3bca){if(_0x373adc[_0x4c1b('0x65')]['id']){delete _0x373adc[_0x4c1b('0x65')]['id'];}return db[_0x4c1b('0x49')][_0x4c1b('0x63')]({'where':{'id':_0x373adc[_0x4c1b('0x61')]['id']}})['then'](handleEntityNotFound(_0x158fa0,null))[_0x4c1b('0x23')](function(_0x2d1275){if(_0x2d1275){_0x373adc[_0x4c1b('0x65')][_0x4c1b('0x6d')]=_0x2d1275['id'];return db['MailServerIn'][_0x4c1b('0x68')](_0x373adc['body']);}})[_0x4c1b('0x23')](respondWithResult(_0x158fa0,null))[_0x4c1b('0x2d')](handleError(_0x158fa0,null));};exports[_0x4c1b('0x86')]=function(_0x1a6043,_0x36b799,_0x2f18d1){return db[_0x4c1b('0x49')][_0x4c1b('0x6a')]({'where':{'id':_0x1a6043['params']['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x36b799,null))[_0x4c1b('0x23')](function(_0x189e6d){if(_0x189e6d){return _0x189e6d[_0x4c1b('0x87')](null);}return null;})[_0x4c1b('0x23')](respondWithStatusCode(_0x36b799,null))[_0x4c1b('0x2d')](handleError(_0x36b799,null));};exports[_0x4c1b('0x88')]=function(_0x46c9c2,_0x323b39,_0x5741fe){return db[_0x4c1b('0x49')][_0x4c1b('0x6a')]({'where':{'id':_0x46c9c2[_0x4c1b('0x61')]['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x323b39,null))[_0x4c1b('0x23')](function(_0x47f887){if(_0x47f887){return _0x47f887[_0x4c1b('0x88')]();}return null;})[_0x4c1b('0x23')](respondWithResult(_0x323b39,null))[_0x4c1b('0x2d')](handleError(_0x323b39,null));};exports[_0x4c1b('0x89')]=function(_0x227c24,_0x3af0ef,_0x34988f){if(_0x227c24['body']['id']){delete _0x227c24[_0x4c1b('0x65')]['id'];}return db['MailAccount'][_0x4c1b('0x63')]({'where':{'id':_0x227c24[_0x4c1b('0x61')]['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x3af0ef,null))[_0x4c1b('0x23')](function(_0x4eb783){if(_0x4eb783){_0x227c24[_0x4c1b('0x65')]['MailAccountId']=_0x4eb783['id'];return db['MailServerOut'][_0x4c1b('0x68')](_0x227c24[_0x4c1b('0x65')]);}})[_0x4c1b('0x23')](respondWithResult(_0x3af0ef,null))[_0x4c1b('0x2d')](handleError(_0x3af0ef,null));};exports['removeSmtp']=function(_0x2f5e52,_0x17ef14,_0x371bc3){return db['MailAccount'][_0x4c1b('0x6a')]({'where':{'id':_0x2f5e52[_0x4c1b('0x61')]['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x17ef14,null))[_0x4c1b('0x23')](function(_0x4d60b9){if(_0x4d60b9){return _0x4d60b9[_0x4c1b('0x8a')](null);}return null;})['then'](respondWithStatusCode(_0x17ef14,null))[_0x4c1b('0x2d')](handleError(_0x17ef14,null));};exports[_0x4c1b('0x8b')]=function(_0x2fd9a9,_0x372ac3,_0x1be14a){return db[_0x4c1b('0x8c')][_0x4c1b('0x63')]({'where':{'id':_0x2fd9a9['params']['id']}})['then'](handleEntityNotFound(_0x372ac3,null))[_0x4c1b('0x23')](function(_0x1543cd){if(_0x1543cd){return _0x1543cd['addInteraction'](_0x2fd9a9[_0x4c1b('0x65')][_0x4c1b('0x6f')],_[_0x4c1b('0x8d')](_0x2fd9a9['body'],[_0x4c1b('0x6f'),'id'])||{});}})[_0x4c1b('0x23')](respondWithResult(_0x372ac3,null))[_0x4c1b('0x2d')](handleError(_0x372ac3,null));};exports[_0x4c1b('0x8e')]=function(_0xd18207,_0x4d52a7,_0x385b4e){var _0x54d326={'raw':![],'where':{}};var _0x53cd91={};var _0x565587={'count':0x0,'rows':[]};return db[_0x4c1b('0x49')][_0x4c1b('0x6a')]({'where':{'id':_0xd18207['params']['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x4d52a7,null))['then'](function(_0xcb87e0){if(_0xcb87e0){_0x53cd91['model']=_[_0x4c1b('0x4d')](db[_0x4c1b('0x8c')]['rawAttributes']);_0x53cd91[_0x4c1b('0x4c')]=_['keys'](_0xd18207[_0x4c1b('0x4c')]);_0x53cd91[_0x4c1b('0x58')]=_[_0x4c1b('0x50')](_0x53cd91[_0x4c1b('0x4e')],_0x53cd91[_0x4c1b('0x4c')]);_0x54d326[_0x4c1b('0x4f')]=_['intersection'](_0x53cd91[_0x4c1b('0x4e')],qs[_0x4c1b('0x51')](_0xd18207[_0x4c1b('0x4c')][_0x4c1b('0x51')]));_0x54d326['attributes']=_0x54d326['attributes'][_0x4c1b('0x52')]?_0x54d326[_0x4c1b('0x4f')]:_0x53cd91[_0x4c1b('0x4e')];if(!_0xd18207[_0x4c1b('0x4c')][_0x4c1b('0x53')](_0x4c1b('0x54'))){_0x54d326['limit']=qs[_0x4c1b('0x34')](_0xd18207[_0x4c1b('0x4c')]['limit']);_0x54d326[_0x4c1b('0x33')]=qs['offset'](_0xd18207[_0x4c1b('0x4c')][_0x4c1b('0x33')]);}_0x54d326[_0x4c1b('0x55')]=qs[_0x4c1b('0x56')](_0xd18207['query']['sort']);_0x54d326[_0x4c1b('0x57')]=qs[_0x4c1b('0x58')](_[_0x4c1b('0x72')](_0xd18207[_0x4c1b('0x4c')],_0x53cd91[_0x4c1b('0x58')]));_0x54d326[_0x4c1b('0x57')][_0x4c1b('0x6d')]=_0xcb87e0['id'];if(_0xd18207[_0x4c1b('0x4c')][_0x4c1b('0x59')]){_0x54d326['where']=_['merge'](_0x54d326['where'],{'$or':_[_0x4c1b('0x48')](_0x54d326['attributes'],function(_0x15c01f){var _0x57e3fb={};_0x57e3fb[_0x15c01f]={'$like':'%'+_0xd18207['query'][_0x4c1b('0x59')]+'%'};return _0x57e3fb;})});}_0x54d326=_[_0x4c1b('0x5a')]({},_0x54d326,_0xd18207[_0x4c1b('0x5c')]);return db['MailInteraction'][_0x4c1b('0x32')]({'where':_0x54d326['where']})[_0x4c1b('0x23')](function(_0x1a4610){_0x565587['count']=_0x1a4610;if(_0xd18207['query']['includeAll']){_0x54d326[_0x4c1b('0x5e')]=[{'model':db['CmContact'],'as':_0x4c1b('0x8f'),'required':![]},{'model':db[_0x4c1b('0x90')],'as':_0x4c1b('0x91'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0x4c1b('0x92')],'as':'Tags','attributes':['id',_0x4c1b('0x40'),'color'],'where':_0xd18207[_0x4c1b('0x4c')]['tag']?{'id':_0xd18207[_0x4c1b('0x4c')]['tag']}:undefined,'required':_0xd18207[_0x4c1b('0x4c')][_0x4c1b('0x93')]?!![]:![]}];}return db[_0x4c1b('0x8c')]['findAll'](_0x54d326);})[_0x4c1b('0x23')](function(_0x211d25){_0x565587[_0x4c1b('0x60')]=_0x211d25;return _0x565587;});}})['then'](respondWithFilteredResult(_0x4d52a7,_0x54d326))[_0x4c1b('0x2d')](handleError(_0x4d52a7,null));};exports[_0x4c1b('0x94')]=function(_0x1ce312,_0x46873d,_0x21f0ff){return db[_0x4c1b('0x49')]['findOne']({'where':{'id':_0x1ce312[_0x4c1b('0x61')]['id']}})['then'](handleEntityNotFound(_0x46873d,null))[_0x4c1b('0x23')](function(_0x2028aa){if(_0x2028aa){return db[_0x4c1b('0x95')][_0x4c1b('0x96')](function(_0x78f493){return db['MailApplication'][_0x4c1b('0x3a')]({'where':{'MailAccountId':_0x1ce312['params']['id']},'transaction':_0x78f493})[_0x4c1b('0x23')](function(_0x55d757){var _0x1365a0=_[_0x4c1b('0x48')](_0x1ce312[_0x4c1b('0x65')],function(_0x36002e){_0x36002e[_0x4c1b('0x6d')]=_0x1ce312['params']['id'];return _0x36002e;});return db[_0x4c1b('0x97')][_0x4c1b('0x98')](_0x1365a0,{'transaction':_0x78f493});});})[_0x4c1b('0x23')](function(){return db[_0x4c1b('0x97')][_0x4c1b('0x99')]({'where':{'MailAccountId':_0x1ce312['params']['id']},'order':_0x4c1b('0x9a')});});}})[_0x4c1b('0x23')](respondWithResult(_0x46873d,null))[_0x4c1b('0x2d')](handleError(_0x46873d,null));};exports[_0x4c1b('0x9b')]=function(_0x1f1482,_0x2f518c,_0x81fcde){var _0x49d34b={};var _0x288501={};var _0x209c37;var _0x4a9d7e;return db['MailAccount']['findOne']({'where':{'id':_0x1f1482[_0x4c1b('0x61')]['id']}})['then'](handleEntityNotFound(_0x2f518c,null))[_0x4c1b('0x23')](function(_0x251c48){if(_0x251c48){_0x209c37=_0x251c48;_0x288501['model']=_[_0x4c1b('0x4d')](db[_0x4c1b('0x97')]['rawAttributes']);_0x288501[_0x4c1b('0x4c')]=_[_0x4c1b('0x4d')](_0x1f1482['query']);_0x288501[_0x4c1b('0x58')]=_[_0x4c1b('0x50')](_0x288501['model'],_0x288501['query']);_0x49d34b[_0x4c1b('0x4f')]=_[_0x4c1b('0x50')](_0x288501[_0x4c1b('0x4e')],qs[_0x4c1b('0x51')](_0x1f1482[_0x4c1b('0x4c')]['fields']));_0x49d34b['attributes']=_0x49d34b['attributes'][_0x4c1b('0x52')]?_0x49d34b[_0x4c1b('0x4f')]:_0x288501[_0x4c1b('0x4e')];_0x49d34b[_0x4c1b('0x55')]=qs[_0x4c1b('0x56')](_0x1f1482[_0x4c1b('0x4c')][_0x4c1b('0x56')]);_0x49d34b[_0x4c1b('0x57')]=qs[_0x4c1b('0x58')](_['pick'](_0x1f1482[_0x4c1b('0x4c')],_0x288501[_0x4c1b('0x58')]));if(_0x1f1482['query'][_0x4c1b('0x59')]){_0x49d34b[_0x4c1b('0x57')]=_['merge'](_0x49d34b[_0x4c1b('0x57')],{'$or':_['map'](_0x49d34b['attributes'],function(_0x55a6ba){var _0x26f391={};_0x26f391[_0x55a6ba]={'$like':'%'+_0x1f1482['query']['filter']+'%'};return _0x26f391;})});}_0x49d34b=_['merge']({},_0x49d34b,_0x1f1482['options']);return _0x209c37[_0x4c1b('0x9b')](_0x49d34b);}})[_0x4c1b('0x23')](function(_0xa63924){if(_0xa63924){_0x4a9d7e=_0xa63924[_0x4c1b('0x52')];if(!_0x1f1482['query'][_0x4c1b('0x53')](_0x4c1b('0x54'))){_0x49d34b['limit']=qs[_0x4c1b('0x34')](_0x1f1482[_0x4c1b('0x4c')][_0x4c1b('0x34')]);_0x49d34b['offset']=qs['offset'](_0x1f1482['query'][_0x4c1b('0x33')]);}return _0x209c37[_0x4c1b('0x9b')](_0x49d34b);}})[_0x4c1b('0x23')](function(_0x3cc525){if(_0x3cc525){return _0x3cc525?{'count':_0x4a9d7e,'rows':_0x3cc525}:null;}})[_0x4c1b('0x23')](respondWithResult(_0x2f518c,null))[_0x4c1b('0x2d')](handleError(_0x2f518c,null));};exports[_0x4c1b('0x9c')]=function(_0x26dd08,_0xe841ec,_0x4cac24){var _0x5e9c56={'raw':!![],'where':{}};var _0x180a1e={};var _0x3a107a={'count':0x0,'rows':[]};return db['MailAccount'][_0x4c1b('0x6a')]({'where':{'id':_0x26dd08[_0x4c1b('0x61')]['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0xe841ec,null))['then'](function(_0x346b6e){if(_0x346b6e){_0x180a1e[_0x4c1b('0x4e')]=_['keys'](db[_0x4c1b('0x9d')][_0x4c1b('0x6c')]);_0x180a1e[_0x4c1b('0x4c')]=_['keys'](_0x26dd08['query']);_0x180a1e[_0x4c1b('0x58')]=_[_0x4c1b('0x50')](_0x180a1e['model'],_0x180a1e['query']);_0x5e9c56['attributes']=_[_0x4c1b('0x50')](_0x180a1e[_0x4c1b('0x4e')],qs[_0x4c1b('0x51')](_0x26dd08[_0x4c1b('0x4c')][_0x4c1b('0x51')]));_0x5e9c56['attributes']=_0x5e9c56[_0x4c1b('0x4f')]['length']?_0x5e9c56[_0x4c1b('0x4f')]:_0x180a1e[_0x4c1b('0x4e')];if(!_0x26dd08[_0x4c1b('0x4c')][_0x4c1b('0x53')](_0x4c1b('0x54'))){_0x5e9c56['limit']=qs[_0x4c1b('0x34')](_0x26dd08['query'][_0x4c1b('0x34')]);_0x5e9c56[_0x4c1b('0x33')]=qs[_0x4c1b('0x33')](_0x26dd08[_0x4c1b('0x4c')][_0x4c1b('0x33')]);}_0x5e9c56[_0x4c1b('0x55')]=qs[_0x4c1b('0x56')](_0x26dd08['query'][_0x4c1b('0x56')]);_0x5e9c56['where']=qs[_0x4c1b('0x58')](_['pick'](_0x26dd08[_0x4c1b('0x4c')],_0x180a1e[_0x4c1b('0x58')]));_0x5e9c56[_0x4c1b('0x57')][_0x4c1b('0x6d')]=_0x346b6e['id'];if(_0x26dd08['query']['filter']){_0x5e9c56[_0x4c1b('0x57')]=_[_0x4c1b('0x5a')](_0x5e9c56[_0x4c1b('0x57')],{'$or':_['map'](_0x5e9c56[_0x4c1b('0x4f')],function(_0x4f3b86){var _0x38f368={};_0x38f368[_0x4f3b86]={'$like':'%'+_0x26dd08[_0x4c1b('0x4c')]['filter']+'%'};return _0x38f368;})});}if(_0x26dd08[_0x4c1b('0x4c')][_0x4c1b('0x9e')]){var _0x1ab512=_0x26dd08[_0x4c1b('0x4c')][_0x4c1b('0x9e')][_0x4c1b('0x9f')](',');var _0x24fe1d={};_0x24fe1d[_0x1ab512[0x0]]={'$gte':moment(_0x1ab512[0x1])[_0x4c1b('0xa0')](_0x4c1b('0xa1'))};_0x5e9c56[_0x4c1b('0x57')]=_['merge'](_0x5e9c56[_0x4c1b('0x57')],_0x24fe1d);}_0x5e9c56=_[_0x4c1b('0x5a')]({},_0x5e9c56,_0x26dd08[_0x4c1b('0x5c')]);return db[_0x4c1b('0x9d')]['count']({'where':_0x5e9c56[_0x4c1b('0x57')]})[_0x4c1b('0x23')](function(_0x1651ed){_0x3a107a['count']=_0x1651ed;if(_0x26dd08['query'][_0x4c1b('0x5d')]){_0x5e9c56[_0x4c1b('0x5e')]=[{'all':!![]}];}return db[_0x4c1b('0x9d')][_0x4c1b('0x5f')](_0x5e9c56);})[_0x4c1b('0x23')](function(_0x4f3d37){if(_0x26dd08['query'][_0x4c1b('0xa2')]===_0x4c1b('0xa3')){for(var _0x26bf55=0x0;_0x26bf55<_0x4f3d37['length'];_0x26bf55++){_0x4f3d37[_0x26bf55][_0x4c1b('0x65')]=juice(_0x4f3d37[_0x26bf55][_0x4c1b('0x65')]);}}_0x3a107a[_0x4c1b('0x60')]=_0x4f3d37;return _0x3a107a;});}})['then'](respondWithFilteredResult(_0xe841ec,_0x5e9c56))[_0x4c1b('0x2d')](handleError(_0xe841ec,null));};exports[_0x4c1b('0x41')]=function(_0x57d048,_0xc22a0a,_0x59e057){var _0x35f675,_0x1abb6d={},_0x31c8d0;if(_0x57d048[_0x4c1b('0x65')]['to']){_0x31c8d0=_0x57d048[_0x4c1b('0x65')]['to'][_0x4c1b('0x9f')](',')[0x0];}return db[_0x4c1b('0x49')]['find']({'where':{'id':_0x57d048[_0x4c1b('0x61')]['id']},'include':[{'model':db[_0x4c1b('0xa4')],'as':'List','include':[{'model':db['CmContact'],'as':_0x4c1b('0xa5'),'where':{'email':_0x31c8d0},'limit':0x1,'order':[[_0x4c1b('0xa6'),'DESC']]}]},{'model':db[_0x4c1b('0x44')],'as':_0x4c1b('0x45'),'raw':!![]}]})[_0x4c1b('0x23')](handleEntityNotFound(_0xc22a0a,null))[_0x4c1b('0x23')](function(_0x5eb46e){if(_0x5eb46e){_0x35f675=_0x5eb46e;if(_0x5eb46e[_0x4c1b('0x45')]){if(_[_0x4c1b('0x78')](_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xa7')])){_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xa7')]=util[_0x4c1b('0xa0')](_0x4c1b('0xa8'),_0x5eb46e[_0x4c1b('0x40')],_0x5eb46e[_0x4c1b('0x75')]||_0x5eb46e[_0x4c1b('0x45')][_0x4c1b('0x7b')]);}if(_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xa9')]&&_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xa9')][_0x4c1b('0x52')]){for(var _0x2894b1=0x0;_0x2894b1<_0x57d048['body'][_0x4c1b('0xa9')][_0x4c1b('0x52')];_0x2894b1+=0x1){_0x57d048['body'][_0x4c1b('0xa9')][_0x2894b1]={'filename':_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xa9')][_0x2894b1]['name'],'path':path[_0x4c1b('0xaa')](config[_0x4c1b('0xab')],_0x4c1b('0xac'),_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xa9')][_0x2894b1]['basename'])};}}var _0xe0732={'tls':{'rejectUnauthorized':![]}};if(_[_0x4c1b('0x78')](_0x5eb46e[_0x4c1b('0x45')][_0x4c1b('0x81')])){if(_0x5eb46e[_0x4c1b('0x45')]['authentication']){_0xe0732[_0x4c1b('0xad')]={'user':_0x5eb46e['Smtp'][_0x4c1b('0x7b')],'pass':_0x5eb46e[_0x4c1b('0x45')][_0x4c1b('0xae')]};}_0xe0732[_0x4c1b('0x80')]=_0x5eb46e[_0x4c1b('0x45')]['host'];_0xe0732[_0x4c1b('0x7f')]=_0x5eb46e['Smtp'][_0x4c1b('0x7f')];_0xe0732['secure']=_0x5eb46e['Smtp'][_0x4c1b('0xaf')];}else{_0xe0732[_0x4c1b('0x81')]=_0x5eb46e[_0x4c1b('0x45')][_0x4c1b('0x81')];_0xe0732[_0x4c1b('0xad')]={'user':_0x5eb46e[_0x4c1b('0x45')][_0x4c1b('0x7b')],'pass':_0x5eb46e[_0x4c1b('0x45')][_0x4c1b('0xae')]};}return respondWithRpcPromise(_0x4c1b('0xb0'),_0x4c1b('0xb1'),{'account':_0xe0732,'message':_0x57d048['body']});}else{throw new Error(_0x4c1b('0xb2'));}}})[_0x4c1b('0x23')](function(_0x90bbd9){if(_0x90bbd9){_0x1abb6d=_0x90bbd9;if(_0x35f675[_0x4c1b('0xb3')]){if(_0x35f675['List'][_0x4c1b('0xa5')]['length']){return _0x35f675['List'][_0x4c1b('0xa5')][0x0];}else{return db[_0x4c1b('0xb4')]['create'](_['defaults'](_0x57d048[_0x4c1b('0x65')],{'firstName':_0x57d048['body']['to'],'email':_0x57d048[_0x4c1b('0x65')]['to'],'phone':_0x57d048[_0x4c1b('0x65')]['to'],'ListId':_0x35f675[_0x4c1b('0x76')]}));}}else{throw new Error(_0x4c1b('0xb2'));}}})[_0x4c1b('0x23')](function(_0x4b4853){if(_0x4b4853){var _0x137302={'UserId':_0x57d048['user']['id'],'ContactId':_0x4b4853['id'],'MailAccountId':_0x35f675['id'],'inReplyTo':_0x1abb6d[_0x4c1b('0xb5')],'to':_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xa7')],'cc':_0x57d048[_0x4c1b('0x65')]['cc'],'subject':_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xb6')],'attach':_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xb7')],'firstMsgDirection':_0x4c1b('0xb8'),'lastMsgAt':moment()[_0x4c1b('0xa0')](_0x4c1b('0xa1')),'lastMsgDirection':_0x4c1b('0xb8'),'Messages':[_[_0x4c1b('0x5a')](_0x57d048['body'],{'messageId':_0x1abb6d[_0x4c1b('0xb5')],'sentAt':moment()['format'](_0x4c1b('0xa1')),'read':!![],'MailAccountId':_0x35f675['id'],'UserId':_0x57d048[_0x4c1b('0x7b')]['id'],'ContactId':_0x4b4853['id']})]};if(_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xb9')]){_0x137302=_[_0x4c1b('0x5a')](_0x137302,_0x57d048['body'][_0x4c1b('0xb9')]);}return db[_0x4c1b('0x8c')][_0x4c1b('0x68')](_0x137302,{'include':[{'model':db['MailMessage'],'as':_0x4c1b('0xba')}]});}})[_0x4c1b('0x23')](respondWithResult(_0xc22a0a,null))['catch'](handleError(_0xc22a0a,null));};exports[_0x4c1b('0xbb')]=function(_0xe9adeb,_0x28d420,_0x4e598a){return db['MailAccount']['find']({'where':{'id':_0xe9adeb[_0x4c1b('0x61')]['id']},'include':[{'model':db[_0x4c1b('0x44')],'as':'Smtp','raw':!![]}]})[_0x4c1b('0x23')](handleEntityNotFound(_0x28d420,null))[_0x4c1b('0x23')](function(_0x3fc015){if(_0x3fc015&&_0x3fc015[_0x4c1b('0x45')]){var _0x376fb0={'id':_0x3fc015['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3fc015[_0x4c1b('0x45')][_0x4c1b('0x81')]){_0x376fb0['service']=_0x3fc015[_0x4c1b('0x45')][_0x4c1b('0x81')];}else{_0x376fb0[_0x4c1b('0x80')]=_0x3fc015['Smtp'][_0x4c1b('0x80')];_0x376fb0['port']=_0x3fc015[_0x4c1b('0x45')][_0x4c1b('0x7f')];_0x376fb0[_0x4c1b('0xaf')]=_0x3fc015[_0x4c1b('0x45')]['secure'];}if(_0x3fc015['Smtp']['authentication']){_0x376fb0[_0x4c1b('0xad')]={'user':_0x3fc015[_0x4c1b('0x45')][_0x4c1b('0x7b')],'pass':_0x3fc015[_0x4c1b('0x45')]['pass']};}return respondWithRpcPromise('VerifySmtp',_0x4c1b('0xbb'),{'account':_0x376fb0});}})[_0x4c1b('0x23')](respondWithResult(_0x28d420,null))[_0x4c1b('0x2d')](handleError(_0x28d420,null));};exports[_0x4c1b('0x3a')]=function(_0x2a9c25,_0xa9197){return db['MailAccount'][_0x4c1b('0x63')]({'where':{'id':_0x2a9c25[_0x4c1b('0x61')]['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0xa9197,null))[_0x4c1b('0x23')](function(_0x4a5d4f){if(_0x4a5d4f&&_0x4a5d4f[_0x4c1b('0x81')]){throw new db[(_0x4c1b('0xbc'))][(_0x4c1b('0xbd'))](_0x4c1b('0xbe'));}return _0x4a5d4f;})[_0x4c1b('0x23')](removeEntity(_0xa9197,null))[_0x4c1b('0x2d')](handleError(_0xa9197,null));};exports[_0x4c1b('0xbf')]=function(_0x259928,_0x43813d,_0x103e7d){return db[_0x4c1b('0x49')][_0x4c1b('0x63')]({'where':{'id':_0x259928[_0x4c1b('0x61')]['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x43813d,null))['then'](function(_0x1d4fb1){if(_0x1d4fb1){return _0x1d4fb1[_0x4c1b('0xbf')](_0x259928[_0x4c1b('0x65')][_0x4c1b('0x6f')],_[_0x4c1b('0x8d')](_0x259928[_0x4c1b('0x65')],[_0x4c1b('0x6f'),'id'])||{})['spread'](function(_0x572372){for(var _0x3ac570=0x0;_0x3ac570<_0x259928[_0x4c1b('0x65')][_0x4c1b('0x6f')][_0x4c1b('0x52')];_0x3ac570+=0x1){socket[_0x4c1b('0xc0')]('userMailAccount:save',{'UserId':Number(_0x259928['body'][_0x4c1b('0x6f')][_0x3ac570]),'MailAccountId':Number(_0x259928[_0x4c1b('0x61')]['id'])});}return _0x572372;});}})[_0x4c1b('0x23')](respondWithResult(_0x43813d,null))[_0x4c1b('0x2d')](handleError(_0x43813d,null));};exports[_0x4c1b('0xc1')]=function(_0x94e19c,_0x2b2c99,_0x20e260){return db[_0x4c1b('0x49')][_0x4c1b('0x63')]({'where':{'id':_0x94e19c['params']['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x2b2c99,null))[_0x4c1b('0x23')](function(_0x2710a7){if(_0x2710a7){return _0x2710a7[_0x4c1b('0xc1')](_0x94e19c[_0x4c1b('0x4c')][_0x4c1b('0x6f')])[_0x4c1b('0x23')](function(){if(_[_0x4c1b('0xc2')](_0x94e19c[_0x4c1b('0x4c')][_0x4c1b('0x6f')])){for(var _0x114fa2=0x0;_0x114fa2<_0x94e19c[_0x4c1b('0x4c')]['ids'][_0x4c1b('0x52')];_0x114fa2+=0x1){socket[_0x4c1b('0xc0')](_0x4c1b('0xc3'),{'UserId':Number(_0x94e19c[_0x4c1b('0x4c')][_0x4c1b('0x6f')][_0x114fa2]),'MailAccountId':Number(_0x94e19c[_0x4c1b('0x61')]['id'])});}}else{socket[_0x4c1b('0xc0')](_0x4c1b('0xc3'),{'UserId':Number(_0x94e19c[_0x4c1b('0x4c')]['ids']),'MailAccountId':Number(_0x94e19c[_0x4c1b('0x61')]['id'])});}});}})[_0x4c1b('0x23')](respondWithStatusCode(_0x2b2c99,null))[_0x4c1b('0x2d')](handleError(_0x2b2c99,null));};exports[_0x4c1b('0xc4')]=function(_0x35ba8c,_0xccf973,_0x21ec00){var _0x473a27={};var _0x546a87={};var _0x244eb7;var _0x379c46;return db[_0x4c1b('0x49')][_0x4c1b('0x6a')]({'where':{'id':_0x35ba8c['params']['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0xccf973,null))['then'](function(_0x557d8d){if(_0x557d8d){_0x244eb7=_0x557d8d;_0x546a87['model']=_['keys'](db[_0x4c1b('0x90')][_0x4c1b('0x6c')]);_0x546a87[_0x4c1b('0x4c')]=_[_0x4c1b('0x4d')](_0x35ba8c[_0x4c1b('0x4c')]);_0x546a87['filters']=_[_0x4c1b('0x50')](_0x546a87['model'],_0x546a87[_0x4c1b('0x4c')]);_0x473a27[_0x4c1b('0x4f')]=_[_0x4c1b('0x50')](_0x546a87[_0x4c1b('0x4e')],qs['fields'](_0x35ba8c[_0x4c1b('0x4c')][_0x4c1b('0x51')]));_0x473a27[_0x4c1b('0x4f')]=_0x473a27['attributes'][_0x4c1b('0x52')]?_0x473a27[_0x4c1b('0x4f')]:_0x546a87['model'];_0x473a27['order']=qs['sort'](_0x35ba8c[_0x4c1b('0x4c')]['sort']);_0x473a27['where']=qs[_0x4c1b('0x58')](_[_0x4c1b('0x72')](_0x35ba8c['query'],_0x546a87[_0x4c1b('0x58')]));if(_0x35ba8c[_0x4c1b('0x4c')]['filter']){_0x473a27['where']=_[_0x4c1b('0x5a')](_0x473a27[_0x4c1b('0x57')],{'$or':_['map'](_0x473a27[_0x4c1b('0x4f')],function(_0x1868cc){var _0x288f55={};_0x288f55[_0x1868cc]={'$like':'%'+_0x35ba8c[_0x4c1b('0x4c')][_0x4c1b('0x59')]+'%'};return _0x288f55;})});}_0x473a27=_['merge']({},_0x473a27,_0x35ba8c['options']);return _0x244eb7[_0x4c1b('0xc4')](_0x473a27);}})[_0x4c1b('0x23')](function(_0x3c7ff9){if(_0x3c7ff9){_0x379c46=_0x3c7ff9['length'];if(!_0x35ba8c['query'][_0x4c1b('0x53')]('nolimit')){_0x473a27[_0x4c1b('0x34')]=qs['limit'](_0x35ba8c[_0x4c1b('0x4c')][_0x4c1b('0x34')]);_0x473a27['offset']=qs[_0x4c1b('0x33')](_0x35ba8c[_0x4c1b('0x4c')][_0x4c1b('0x33')]);}return _0x244eb7[_0x4c1b('0xc4')](_0x473a27);}})[_0x4c1b('0x23')](function(_0x137a78){if(_0x137a78){return _0x137a78?{'count':_0x379c46,'rows':_0x137a78}:null;}})['then'](respondWithResult(_0xccf973,null))[_0x4c1b('0x2d')](handleError(_0xccf973,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index dc7b613..fdcc37d 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 _0xa7c8=['hasOwnProperty','exports','events','MailAccount','setMaxListeners','save','remove','emit'];(function(_0x10909d,_0x1abd5e){var _0xa8c660=function(_0x33f47e){while(--_0x33f47e){_0x10909d['push'](_0x10909d['shift']());}};_0xa8c660(++_0x1abd5e);}(_0xa7c8,0x82));var _0x8a7c=function(_0x4e787a,_0x25eeed){_0x4e787a=_0x4e787a-0x0;var _0x46dd9e=_0xa7c8[_0x4e787a];return _0x46dd9e;};'use strict';var EventEmitter=require(_0x8a7c('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x8a7c('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x8a7c('0x2')](0x0);var events={'afterCreate':_0x8a7c('0x3'),'afterUpdate':'update','afterDestroy':_0x8a7c('0x4')};function emitEvent(_0x4d4eac){return function(_0xd11d72,_0x15003d,_0x3085c6){MailAccountEvents[_0x8a7c('0x5')](_0x4d4eac+':'+_0xd11d72['id'],_0xd11d72);MailAccountEvents['emit'](_0x4d4eac,_0xd11d72);_0x3085c6(null);};}for(var e in events){if(events[_0x8a7c('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x8a7c('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x043b=['../../mysqldb','save','update','remove','hook','exports','events'];(function(_0x31da28,_0x36983f){var _0x2539fe=function(_0x1980b3){while(--_0x1980b3){_0x31da28['push'](_0x31da28['shift']());}};_0x2539fe(++_0x36983f);}(_0x043b,0xa0));var _0xb043=function(_0xa1cb28,_0x101594){_0xa1cb28=_0xa1cb28-0x0;var _0x3a04cf=_0x043b[_0xa1cb28];return _0x3a04cf;};'use strict';var EventEmitter=require(_0xb043('0x0'));var MailAccount=require(_0xb043('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb043('0x2'),'afterUpdate':_0xb043('0x3'),'afterDestroy':_0xb043('0x4')};function emitEvent(_0x334a6c){return function(_0x2e1e4b,_0x213ee5,_0x29025b){MailAccountEvents['emit'](_0x334a6c+':'+_0x2e1e4b['id'],_0x2e1e4b);MailAccountEvents['emit'](_0x334a6c,_0x2e1e4b);_0x29025b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xb043('0x5')](e,emitEvent(event));}}module[_0xb043('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 4026d5f..9c9fcc7 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 _0x1cbd=['define','MailAccount','mail_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','exports'];(function(_0x5bcb8f,_0xe4008a){var _0x5f3ec7=function(_0x507186){while(--_0x507186){_0x5bcb8f['push'](_0x5bcb8f['shift']());}};_0x5f3ec7(++_0xe4008a);}(_0x1cbd,0x1bb));var _0xd1cb=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x1cbd[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0xd1cb('0x0'));var util=require(_0xd1cb('0x1'));var logger=require(_0xd1cb('0x2'))(_0xd1cb('0x3'));var moment=require('moment');var BPromise=require(_0xd1cb('0x4'));var rp=require(_0xd1cb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd1cb('0x6'));var config=require('../../config/environment');var attributes=require('./mailAccount.attributes');module[_0xd1cb('0x7')]=function(_0x41167e,_0x547b34){return _0x41167e[_0xd1cb('0x8')](_0xd1cb('0x9'),attributes,{'tableName':_0xd1cb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee2e=['util','api','moment','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','define','mail_accounts','lodash'];(function(_0x305bbf,_0x5647b3){var _0x4ed772=function(_0x3315ed){while(--_0x3315ed){_0x305bbf['push'](_0x305bbf['shift']());}};_0x4ed772(++_0x5647b3);}(_0xee2e,0x83));var _0xeee2=function(_0x223335,_0x4df342){_0x223335=_0x223335-0x0;var _0x3c9cd4=_0xee2e[_0x223335];return _0x3c9cd4;};'use strict';var _=require(_0xeee2('0x0'));var util=require(_0xeee2('0x1'));var logger=require('../../config/logger')(_0xeee2('0x2'));var moment=require(_0xeee2('0x3'));var BPromise=require('bluebird');var rp=require(_0xeee2('0x4'));var fs=require('fs');var path=require(_0xeee2('0x5'));var rimraf=require(_0xeee2('0x6'));var config=require(_0xeee2('0x7'));var attributes=require(_0xeee2('0x8'));module['exports']=function(_0x301426,_0x5b7d3c){return _0x301426[_0xeee2('0x9')]('MailAccount',attributes,{'tableName':_0xeee2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 5e2d979..3e654c6 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 _0xc2b1=['info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','raw','options','attributes','include','model','map','GetMailAccount','ShowMailAccount','find','where','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','MailAccount','account','CmList','Contacts','DESC','Applications','Smtp','omit','List','list','applications','orderBy','priority','asc','autoclose','push','length','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','Contact\x20not\x20found','spread','subject','interaction','get','created','MailMessage','originTo','originCc','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','agent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','register','request','then'];(function(_0x4c852b,_0x1a55ab){var _0x58fae4=function(_0x1cdc20){while(--_0x1cdc20){_0x4c852b['push'](_0x4c852b['shift']());}};_0x58fae4(++_0x1a55ab);}(_0xc2b1,0x192));var _0x1c2b=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0xc2b1[_0x1fcaf1];return _0x55f464;};'use strict';var _=require('lodash');var util=require(_0x1c2b('0x0'));var moment=require(_0x1c2b('0x1'));var BPromise=require(_0x1c2b('0x2'));var rs=require(_0x1c2b('0x3'));var fs=require('fs');var Redis=require(_0x1c2b('0x4'));var db=require(_0x1c2b('0x5'))['db'];var utils=require(_0x1c2b('0x6'));var logger=require(_0x1c2b('0x7'))(_0x1c2b('0x8'));var config=require(_0x1c2b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1c2b('0xa')][_0x1c2b('0xb')]({'port':0x232c});config['redis']=_[_0x1c2b('0xc')](config[_0x1c2b('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x1c2b('0xe'))(new Redis(config['redis']));require('./mailAccount.socket')[_0x1c2b('0xf')](socket);function respondWithRpcPromise(_0x3ad22e,_0x107bb0,_0x25e82f){return new BPromise(function(_0x5f456b,_0x1792b1){return client[_0x1c2b('0x10')](_0x3ad22e,_0x25e82f)[_0x1c2b('0x11')](function(_0x53ef5f){logger[_0x1c2b('0x12')](_0x1c2b('0x13'),_0x107bb0,_0x1c2b('0x14'));logger[_0x1c2b('0x15')](_0x1c2b('0x16'),_0x107bb0,_0x1c2b('0x14'),JSON[_0x1c2b('0x17')](_0x53ef5f));if(_0x53ef5f[_0x1c2b('0x18')]){if(_0x53ef5f[_0x1c2b('0x18')][_0x1c2b('0x19')]===0x1f4){logger[_0x1c2b('0x18')](_0x1c2b('0x13'),_0x107bb0,_0x53ef5f[_0x1c2b('0x18')][_0x1c2b('0x1a')]);return _0x1792b1(_0x53ef5f[_0x1c2b('0x18')][_0x1c2b('0x1a')]);}logger[_0x1c2b('0x18')](_0x1c2b('0x13'),_0x107bb0,_0x53ef5f['error']['message']);return _0x5f456b(_0x53ef5f['error'][_0x1c2b('0x1a')]);}else{logger[_0x1c2b('0x12')](_0x1c2b('0x13'),_0x107bb0,_0x1c2b('0x14'));_0x5f456b(_0x53ef5f[_0x1c2b('0x1b')]['message']);}})[_0x1c2b('0x1c')](function(_0x11eca5){logger['error'](_0x1c2b('0x13'),_0x107bb0,_0x11eca5);_0x1792b1(_0x11eca5);});});}exports['GetMailAccount']=function(_0x1dc380){var _0x391d15=this;return new Promise(function(_0x56c4bb,_0x4bb29d){return db['MailAccount'][_0x1c2b('0x1d')]({'raw':_0x1dc380['options']?_0x1dc380['options'][_0x1c2b('0x1e')]===undefined?!![]:![]:!![],'where':_0x1dc380[_0x1c2b('0x1f')]?_0x1dc380[_0x1c2b('0x1f')]['where']||null:null,'attributes':_0x1dc380['options']?_0x1dc380['options'][_0x1c2b('0x20')]||null:null,'limit':_0x1dc380[_0x1c2b('0x1f')]?_0x1dc380[_0x1c2b('0x1f')]['limit']||null:null,'include':_0x1dc380['options']?_0x1dc380[_0x1c2b('0x1f')][_0x1c2b('0x21')]?_['map'](_0x1dc380[_0x1c2b('0x1f')][_0x1c2b('0x21')],function(_0x29cc1d){return{'model':db[_0x29cc1d[_0x1c2b('0x22')]],'as':_0x29cc1d['as'],'attributes':_0x29cc1d['attributes'],'include':_0x29cc1d[_0x1c2b('0x21')]?_[_0x1c2b('0x23')](_0x29cc1d[_0x1c2b('0x21')],function(_0xdf1efb){return{'model':db[_0xdf1efb[_0x1c2b('0x22')]],'as':_0xdf1efb['as'],'attributes':_0xdf1efb['attributes'],'include':_0xdf1efb[_0x1c2b('0x21')]?_[_0x1c2b('0x23')](_0xdf1efb[_0x1c2b('0x21')],function(_0x5d65e0){return{'model':db[_0x5d65e0[_0x1c2b('0x22')]],'as':_0x5d65e0['as'],'attributes':_0x5d65e0[_0x1c2b('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1c2b('0x11')](function(_0x30b01f){logger[_0x1c2b('0x12')](_0x1c2b('0x24'),_0x1dc380);logger[_0x1c2b('0x15')](_0x1c2b('0x24'),_0x1dc380,JSON[_0x1c2b('0x17')](_0x30b01f));_0x56c4bb(_0x30b01f);})[_0x1c2b('0x1c')](function(_0x4403be){logger[_0x1c2b('0x18')](_0x1c2b('0x24'),_0x4403be[_0x1c2b('0x1a')],_0x1dc380);_0x4bb29d(_0x391d15['error'](0x1f4,_0x4403be[_0x1c2b('0x1a')]));});});};exports[_0x1c2b('0x25')]=function(_0x81f076){var _0x5a03bc=this;return new Promise(function(_0x543518,_0x43ec98){return db['MailAccount'][_0x1c2b('0x26')]({'raw':_0x81f076[_0x1c2b('0x1f')]?_0x81f076[_0x1c2b('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x81f076[_0x1c2b('0x1f')]?_0x81f076[_0x1c2b('0x1f')][_0x1c2b('0x27')]||null:null,'attributes':_0x81f076[_0x1c2b('0x1f')]?_0x81f076[_0x1c2b('0x1f')][_0x1c2b('0x20')]||null:null,'include':_0x81f076['options']?_0x81f076['options'][_0x1c2b('0x21')]?_[_0x1c2b('0x23')](_0x81f076['options'][_0x1c2b('0x21')],function(_0x5b99e4){return{'model':db[_0x5b99e4[_0x1c2b('0x22')]],'as':_0x5b99e4['as'],'attributes':_0x5b99e4[_0x1c2b('0x20')],'include':_0x5b99e4[_0x1c2b('0x21')]?_['map'](_0x5b99e4[_0x1c2b('0x21')],function(_0xa7dd13){return{'model':db[_0xa7dd13[_0x1c2b('0x22')]],'as':_0xa7dd13['as'],'attributes':_0xa7dd13['attributes'],'include':_0xa7dd13['include']?_[_0x1c2b('0x23')](_0xa7dd13[_0x1c2b('0x21')],function(_0x200013){return{'model':db[_0x200013['model']],'as':_0x200013['as'],'attributes':_0x200013['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c2b('0x11')](function(_0x1d4e56){logger['info']('ShowMailAccount',_0x81f076);logger[_0x1c2b('0x15')](_0x1c2b('0x25'),_0x81f076,JSON['stringify'](_0x1d4e56));_0x543518(_0x1d4e56);})['catch'](function(_0x238b5c){logger['error'](_0x1c2b('0x25'),_0x238b5c['message'],_0x81f076);_0x43ec98(_0x5a03bc[_0x1c2b('0x18')](0x1f4,_0x238b5c[_0x1c2b('0x1a')]));});});};exports['NotifyMailAccount']=function(_0x5045e2){var _0x354cf5=this;return new Promise(function(_0x25a8a1,_0x55a977){var _0x337dca={'body':_0x5045e2[_0x1c2b('0x28')],'channel':_0x1c2b('0x29')};var _0x1b620d=_[_0x1c2b('0x2a')](_[_0x1c2b('0x2b')](db[_0x1c2b('0x2c')][_0x1c2b('0x2d')]),[_0x1c2b('0x2e'),_0x1c2b('0x2f'),_0x1c2b('0x30'),_0x1c2b('0x31')]);var _0x772876=![];if(_0x5045e2[_0x1c2b('0x28')]['id']){delete _0x5045e2[_0x1c2b('0x28')]['id'];}if(_[_0x1c2b('0x32')](_0x5045e2[_0x1c2b('0x28')]['from'])){return _0x55a977(_0x354cf5[_0x1c2b('0x18')](0x1f4,_0x1c2b('0x33')));}if(_['isNil'](_0x5045e2[_0x1c2b('0x28')]['body'])||_0x5045e2['body'][_0x1c2b('0x28')]===''){return _0x55a977(_0x354cf5[_0x1c2b('0x18')](0x1f4,_0x1c2b('0x34')));}if(_['isNil'](_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x35')])){return _0x55a977(_0x354cf5['error'](0x1f4,_0x1c2b('0x36')+_0x1b620d));}if(!_[_0x1c2b('0x37')](_0x1b620d,_0x5045e2['body'][_0x1c2b('0x35')])){return _0x55a977(_0x354cf5['error'](0x1f4,_0x1c2b('0x38')+_0x1b620d));}var _0x3b6286={};_0x3b6286[_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x35')]]=_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x39')];return db[_0x1c2b('0x3a')][_0x1c2b('0x26')]({'where':{'id':_0x5045e2[_0x1c2b('0x3b')]['id']},'include':[{'model':db[_0x1c2b('0x3c')],'as':'List','include':[{'model':db['CmContact'],'as':_0x1c2b('0x3d'),'where':_0x3b6286,'limit':0x1,'order':[['updatedAt',_0x1c2b('0x3e')]]}]},{'model':db['MailApplication'],'as':_0x1c2b('0x3f')},{'model':db['MailServerOut'],'as':_0x1c2b('0x40')}]})[_0x1c2b('0x11')](function(_0x15a03a){if(_0x15a03a&&_0x15a03a['List']){var _0x162343=_0x15a03a['get']({'plain':!![]});_0x337dca[_0x1c2b('0x3b')]=_[_0x1c2b('0x41')](_0x162343,[_0x1c2b('0x3f'),_0x1c2b('0x42')]);_0x337dca['applications']=_0x162343['Applications'];_0x337dca[_0x1c2b('0x43')]=_0x162343[_0x1c2b('0x42')];_0x337dca[_0x1c2b('0x44')]=_[_0x1c2b('0x45')](_0x337dca[_0x1c2b('0x44')],[_0x1c2b('0x46')],[_0x1c2b('0x47')]);if(_0x337dca[_0x1c2b('0x3b')]&&_0x337dca['account'][_0x1c2b('0x48')]){_0x337dca['applications'][_0x1c2b('0x49')]({'id':0x0,'priority':_0x337dca['applications'][_0x1c2b('0x4a')]+0x1,'app':'close','appdata':_0x1c2b('0x48'),'interval':_0x1c2b('0x4b')});}if(_0x337dca[_0x1c2b('0x3b')][_0x1c2b('0x3f')]){delete _0x337dca[_0x1c2b('0x3b')][_0x1c2b('0x3f')];}if(_0x337dca[_0x1c2b('0x3b')][_0x1c2b('0x42')]){delete _0x337dca[_0x1c2b('0x3b')]['List'];}if(_0x162343[_0x1c2b('0x42')][_0x1c2b('0x3d')][_0x1c2b('0x4a')]){return _0x162343['List'][_0x1c2b('0x3d')][0x0];}var _0x5e178d=_[_0x1c2b('0xc')](_0x5045e2[_0x1c2b('0x28')],{'firstName':_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x39')],'ListId':_0x162343['ListId']});_0x5e178d[_0x5045e2[_0x1c2b('0x28')]['mapKey']]=_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x39')];return db[_0x1c2b('0x2c')][_0x1c2b('0x4c')](_0x5e178d);}else{throw new Error(_0x1c2b('0x4d'));}})[_0x1c2b('0x11')](function(_0x2b1fc5){_0x337dca[_0x1c2b('0x4e')]=_0x2b1fc5;if(_0x2b1fc5){if(!_0x5045e2['body']['message'][_0x1c2b('0x4f')]){_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x1a')]['messageId']=rs[_0x1c2b('0x50')]()+'\x20'+_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x1a')][_0x1c2b('0x39')];}var _0x117f54={'ContactId':_0x2b1fc5['id'],'MailAccountId':_0x5045e2[_0x1c2b('0x3b')]['id'],'inReplyTo':_0x5045e2['body'][_0x1c2b('0x1a')][_0x1c2b('0x4f')],'to':_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x1a')][_0x1c2b('0x39')],'cc':_0x5045e2[_0x1c2b('0x28')]['message']['cc'],'subject':_0x5045e2['body'][_0x1c2b('0x1a')]['subject'],'attach':_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x1a')][_0x1c2b('0x51')],'lastMsgAt':moment()[_0x1c2b('0x52')](_0x1c2b('0x53')),'lastMsgDirection':'in'};return db[_0x1c2b('0x54')]['find']({'where':{'closed':![],'MailAccountId':_0x5045e2[_0x1c2b('0x3b')]['id']},'include':[{'model':db['MailMessage'],'as':_0x1c2b('0x55'),'attributes':[_0x1c2b('0x4f')],'where':{'messageId':_0x5045e2['body']['message']['inReplyTo']}}]})[_0x1c2b('0x11')](function(_0x4d3e18){if(_0x4d3e18){return[_0x4d3e18,![]];}return db[_0x1c2b('0x54')]['create'](_0x117f54)[_0x1c2b('0x11')](function(_0x5b3f9d){return[_0x5b3f9d,!![]];});});}else{throw new Error(_0x1c2b('0x56'));}})[_0x1c2b('0x57')](function(_0x3dc830,_0x53489a){if(_0x3dc830){_0x772876=_0x53489a;if(!_0x53489a){return _0x3dc830['update']({'inReplyTo':_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x1a')][_0x1c2b('0x4f')],'to':_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x1a')][_0x1c2b('0x39')],'cc':_0x5045e2['body']['message']['cc'],'subject':_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x1a')][_0x1c2b('0x58')],'attach':_0x3dc830[_0x1c2b('0x51')]?_0x3dc830[_0x1c2b('0x51')]:_0x5045e2['body'][_0x1c2b('0x1a')][_0x1c2b('0x51')],'substatus':null,'substatusAt':moment()[_0x1c2b('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x1c2b('0x52')](_0x1c2b('0x53')),'lastMsgDirection':'in'});}else{return _0x3dc830;}}})[_0x1c2b('0x11')](function(_0x5e4778){_0x337dca[_0x1c2b('0x59')]=_0x5e4778[_0x1c2b('0x5a')]({'plain':!![]});_0x337dca[_0x1c2b('0x59')][_0x1c2b('0x5b')]=_0x772876;return db[_0x1c2b('0x5c')][_0x1c2b('0x4c')]({'body':_0x5045e2['body'][_0x1c2b('0x28')],'MailAccountId':_0x5045e2[_0x1c2b('0x3b')]['id'],'MailInteractionId':_0x5e4778['id'],'direction':'in','ContactId':_0x337dca[_0x1c2b('0x4e')]['id'],'messageId':_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x1a')]['messageId'],'from':_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x1a')][_0x1c2b('0x39')],'to':_0x5045e2[_0x1c2b('0x28')]['message']['to'],'cc':_0x5045e2[_0x1c2b('0x28')]['message']['cc'],'subject':_0x5045e2['body'][_0x1c2b('0x1a')]['subject'],'attach':_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x1a')]['attach'],'Attachments':_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x1a')]['attachments'],'originTo':_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x1a')][_0x1c2b('0x5d')],'originCc':_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x1a')][_0x1c2b('0x5e')],'bcc':_0x5045e2['body'][_0x1c2b('0x1a')]['bcc'],'ChatWebsiteId':_0x5045e2['body'][_0x1c2b('0x1a')]['ChatWebsiteId']||null,'originChannel':_0x5045e2[_0x1c2b('0x28')][_0x1c2b('0x1a')][_0x1c2b('0x5f')]||_0x1c2b('0x60'),'ChatOfflineMessageId':_0x5045e2['body'][_0x1c2b('0x1a')][_0x1c2b('0x61')]||null},{'include':[{'model':db[_0x1c2b('0x62')],'as':'Attachments'}]});})[_0x1c2b('0x11')](function(_0x747c47){_0x337dca[_0x1c2b('0x1a')]=_0x747c47;if(_0x337dca[_0x1c2b('0x59')][_0x1c2b('0x63')]){return db[_0x1c2b('0x64')]['find']({'attributes':['id',_0x1c2b('0x65')],'where':{'id':_0x337dca[_0x1c2b('0x59')]['UserId']}})[_0x1c2b('0x11')](function(_0x1ccaa1){if(_0x1ccaa1){_0x337dca[_0x1c2b('0x44')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1c2b('0x66'),'appdata':_0x1ccaa1[_0x1c2b('0x65')]+','+(_0x337dca['account']['waitForTheAssignedAgent']||0xa),'interval':_0x1c2b('0x4b')});}return respondWithRpcPromise(_0x1c2b('0x67'),_0x1c2b('0x68'),_0x337dca);});}return respondWithRpcPromise(_0x1c2b('0x67'),'startRouting',_0x337dca);})['then'](function(_0x6e3131){_0x25a8a1(_0x6e3131);})[_0x1c2b('0x1c')](function(_0x422ee7){_0x55a977(_0x354cf5['error'](0x1f4,_0x422ee7['message']));});});}; \ No newline at end of file +var _0xd9bb=['subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','interaction','created','attach','attachments','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','include','model','map','debug','find','ShowMailAccount','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','Contacts','DESC','MailApplication','Applications','Smtp','List','get','omit','applications','list','priority','asc','close','autoclose','*,*,*,*','length','defaults','create','contact','messageId','generate'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0xd9bb,0x85));var _0xbd9b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd9bb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbd9b('0x0'));var util=require(_0xbd9b('0x1'));var moment=require(_0xbd9b('0x2'));var BPromise=require(_0xbd9b('0x3'));var rs=require(_0xbd9b('0x4'));var fs=require('fs');var Redis=require(_0xbd9b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd9b('0x6'));var logger=require('../../config/logger')(_0xbd9b('0x7'));var config=require(_0xbd9b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbd9b('0x9')][_0xbd9b('0xa')]({'port':0x232c});config['redis']=_['defaults'](config[_0xbd9b('0xb')],{'host':_0xbd9b('0xc'),'port':0x18eb});var socket=require(_0xbd9b('0xd'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xbd9b('0xe')](socket);function respondWithRpcPromise(_0x59c606,_0x54fd4d,_0x201863){return new BPromise(function(_0x3d1ad5,_0x5a8372){return client[_0xbd9b('0xf')](_0x59c606,_0x201863)[_0xbd9b('0x10')](function(_0x239c87){logger[_0xbd9b('0x11')](_0xbd9b('0x12'),_0x54fd4d,_0xbd9b('0x13'));logger['debug'](_0xbd9b('0x14'),_0x54fd4d,_0xbd9b('0x13'),JSON[_0xbd9b('0x15')](_0x239c87));if(_0x239c87[_0xbd9b('0x16')]){if(_0x239c87[_0xbd9b('0x16')][_0xbd9b('0x17')]===0x1f4){logger[_0xbd9b('0x16')](_0xbd9b('0x12'),_0x54fd4d,_0x239c87[_0xbd9b('0x16')][_0xbd9b('0x18')]);return _0x5a8372(_0x239c87[_0xbd9b('0x16')][_0xbd9b('0x18')]);}logger[_0xbd9b('0x16')](_0xbd9b('0x12'),_0x54fd4d,_0x239c87[_0xbd9b('0x16')]['message']);return _0x3d1ad5(_0x239c87[_0xbd9b('0x16')][_0xbd9b('0x18')]);}else{logger[_0xbd9b('0x11')](_0xbd9b('0x12'),_0x54fd4d,_0xbd9b('0x13'));_0x3d1ad5(_0x239c87[_0xbd9b('0x19')][_0xbd9b('0x18')]);}})[_0xbd9b('0x1a')](function(_0x18397c){logger[_0xbd9b('0x16')]('MailAccount,\x20%s,\x20%s',_0x54fd4d,_0x18397c);_0x5a8372(_0x18397c);});});}exports[_0xbd9b('0x1b')]=function(_0x173f4d){var _0x4af110=this;return new Promise(function(_0x27391e,_0x1c1921){return db[_0xbd9b('0x1c')]['findAll']({'raw':_0x173f4d[_0xbd9b('0x1d')]?_0x173f4d[_0xbd9b('0x1d')][_0xbd9b('0x1e')]===undefined?!![]:![]:!![],'where':_0x173f4d[_0xbd9b('0x1d')]?_0x173f4d[_0xbd9b('0x1d')][_0xbd9b('0x1f')]||null:null,'attributes':_0x173f4d[_0xbd9b('0x1d')]?_0x173f4d[_0xbd9b('0x1d')][_0xbd9b('0x20')]||null:null,'limit':_0x173f4d[_0xbd9b('0x1d')]?_0x173f4d['options']['limit']||null:null,'include':_0x173f4d[_0xbd9b('0x1d')]?_0x173f4d[_0xbd9b('0x1d')][_0xbd9b('0x21')]?_['map'](_0x173f4d[_0xbd9b('0x1d')][_0xbd9b('0x21')],function(_0x362ba3){return{'model':db[_0x362ba3[_0xbd9b('0x22')]],'as':_0x362ba3['as'],'attributes':_0x362ba3['attributes'],'include':_0x362ba3[_0xbd9b('0x21')]?_[_0xbd9b('0x23')](_0x362ba3[_0xbd9b('0x21')],function(_0x5bba4f){return{'model':db[_0x5bba4f[_0xbd9b('0x22')]],'as':_0x5bba4f['as'],'attributes':_0x5bba4f[_0xbd9b('0x20')],'include':_0x5bba4f[_0xbd9b('0x21')]?_['map'](_0x5bba4f[_0xbd9b('0x21')],function(_0x5853d6){return{'model':db[_0x5853d6[_0xbd9b('0x22')]],'as':_0x5853d6['as'],'attributes':_0x5853d6[_0xbd9b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbd9b('0x10')](function(_0x1ec089){logger[_0xbd9b('0x11')]('GetMailAccount',_0x173f4d);logger[_0xbd9b('0x24')](_0xbd9b('0x1b'),_0x173f4d,JSON['stringify'](_0x1ec089));_0x27391e(_0x1ec089);})[_0xbd9b('0x1a')](function(_0x9d89bb){logger['error'](_0xbd9b('0x1b'),_0x9d89bb['message'],_0x173f4d);_0x1c1921(_0x4af110['error'](0x1f4,_0x9d89bb['message']));});});};exports['ShowMailAccount']=function(_0x36fb3c){var _0x511c8b=this;return new Promise(function(_0x93124d,_0x5a403c){return db[_0xbd9b('0x1c')][_0xbd9b('0x25')]({'raw':_0x36fb3c[_0xbd9b('0x1d')]?_0x36fb3c['options'][_0xbd9b('0x1e')]===undefined?!![]:![]:!![],'where':_0x36fb3c[_0xbd9b('0x1d')]?_0x36fb3c[_0xbd9b('0x1d')][_0xbd9b('0x1f')]||null:null,'attributes':_0x36fb3c['options']?_0x36fb3c[_0xbd9b('0x1d')][_0xbd9b('0x20')]||null:null,'include':_0x36fb3c[_0xbd9b('0x1d')]?_0x36fb3c[_0xbd9b('0x1d')][_0xbd9b('0x21')]?_[_0xbd9b('0x23')](_0x36fb3c[_0xbd9b('0x1d')]['include'],function(_0x51a548){return{'model':db[_0x51a548[_0xbd9b('0x22')]],'as':_0x51a548['as'],'attributes':_0x51a548[_0xbd9b('0x20')],'include':_0x51a548[_0xbd9b('0x21')]?_[_0xbd9b('0x23')](_0x51a548[_0xbd9b('0x21')],function(_0x49d4af){return{'model':db[_0x49d4af[_0xbd9b('0x22')]],'as':_0x49d4af['as'],'attributes':_0x49d4af[_0xbd9b('0x20')],'include':_0x49d4af[_0xbd9b('0x21')]?_[_0xbd9b('0x23')](_0x49d4af[_0xbd9b('0x21')],function(_0xd378ee){return{'model':db[_0xd378ee[_0xbd9b('0x22')]],'as':_0xd378ee['as'],'attributes':_0xd378ee[_0xbd9b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbd9b('0x10')](function(_0x29c4df){logger[_0xbd9b('0x11')](_0xbd9b('0x26'),_0x36fb3c);logger[_0xbd9b('0x24')](_0xbd9b('0x26'),_0x36fb3c,JSON[_0xbd9b('0x15')](_0x29c4df));_0x93124d(_0x29c4df);})[_0xbd9b('0x1a')](function(_0x1d20ca){logger['error'](_0xbd9b('0x26'),_0x1d20ca[_0xbd9b('0x18')],_0x36fb3c);_0x5a403c(_0x511c8b[_0xbd9b('0x16')](0x1f4,_0x1d20ca[_0xbd9b('0x18')]));});});};exports[_0xbd9b('0x27')]=function(_0x50be94){var _0x195abf=this;return new Promise(function(_0x1768a5,_0x3998e2){var _0x2ea7b7={'body':_0x50be94['body'],'channel':_0xbd9b('0x28')};var _0x4125b3=_[_0xbd9b('0x29')](_[_0xbd9b('0x2a')](db[_0xbd9b('0x2b')][_0xbd9b('0x2c')]),[_0xbd9b('0x2d'),_0xbd9b('0x2e'),_0xbd9b('0x2f'),_0xbd9b('0x30')]);var _0x4dc753=![];if(_0x50be94[_0xbd9b('0x31')]['id']){delete _0x50be94[_0xbd9b('0x31')]['id'];}if(_[_0xbd9b('0x32')](_0x50be94[_0xbd9b('0x31')]['from'])){return _0x3998e2(_0x195abf['error'](0x1f4,_0xbd9b('0x33')));}if(_['isNil'](_0x50be94[_0xbd9b('0x31')]['body'])||_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x31')]===''){return _0x3998e2(_0x195abf[_0xbd9b('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xbd9b('0x32')](_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x34')])){return _0x3998e2(_0x195abf[_0xbd9b('0x16')](0x1f4,_0xbd9b('0x35')+_0x4125b3));}if(!_['includes'](_0x4125b3,_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x34')])){return _0x3998e2(_0x195abf[_0xbd9b('0x16')](0x1f4,_0xbd9b('0x36')+_0x4125b3));}var _0x4f1807={};_0x4f1807[_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x34')]]=_0x50be94['body'][_0xbd9b('0x37')];return db['MailAccount']['find']({'where':{'id':_0x50be94[_0xbd9b('0x38')]['id']},'include':[{'model':db[_0xbd9b('0x39')],'as':'List','include':[{'model':db[_0xbd9b('0x2b')],'as':_0xbd9b('0x3a'),'where':_0x4f1807,'limit':0x1,'order':[['updatedAt',_0xbd9b('0x3b')]]}]},{'model':db[_0xbd9b('0x3c')],'as':_0xbd9b('0x3d')},{'model':db['MailServerOut'],'as':_0xbd9b('0x3e')}]})[_0xbd9b('0x10')](function(_0x3cbd7a){if(_0x3cbd7a&&_0x3cbd7a[_0xbd9b('0x3f')]){var _0x2efa09=_0x3cbd7a[_0xbd9b('0x40')]({'plain':!![]});_0x2ea7b7[_0xbd9b('0x38')]=_[_0xbd9b('0x41')](_0x2efa09,[_0xbd9b('0x3d'),_0xbd9b('0x3f')]);_0x2ea7b7[_0xbd9b('0x42')]=_0x2efa09[_0xbd9b('0x3d')];_0x2ea7b7[_0xbd9b('0x43')]=_0x2efa09[_0xbd9b('0x3f')];_0x2ea7b7[_0xbd9b('0x42')]=_['orderBy'](_0x2ea7b7[_0xbd9b('0x42')],[_0xbd9b('0x44')],[_0xbd9b('0x45')]);if(_0x2ea7b7[_0xbd9b('0x38')]&&_0x2ea7b7[_0xbd9b('0x38')]['autoclose']){_0x2ea7b7['applications']['push']({'id':0x0,'priority':_0x2ea7b7[_0xbd9b('0x42')]['length']+0x1,'app':_0xbd9b('0x46'),'appdata':_0xbd9b('0x47'),'interval':_0xbd9b('0x48')});}if(_0x2ea7b7[_0xbd9b('0x38')]['Applications']){delete _0x2ea7b7[_0xbd9b('0x38')][_0xbd9b('0x3d')];}if(_0x2ea7b7[_0xbd9b('0x38')][_0xbd9b('0x3f')]){delete _0x2ea7b7[_0xbd9b('0x38')]['List'];}if(_0x2efa09['List'][_0xbd9b('0x3a')][_0xbd9b('0x49')]){return _0x2efa09[_0xbd9b('0x3f')][_0xbd9b('0x3a')][0x0];}var _0x1edf28=_[_0xbd9b('0x4a')](_0x50be94[_0xbd9b('0x31')],{'firstName':_0x50be94['body'][_0xbd9b('0x37')],'ListId':_0x2efa09['ListId']});_0x1edf28[_0x50be94['body'][_0xbd9b('0x34')]]=_0x50be94['body'][_0xbd9b('0x37')];return db[_0xbd9b('0x2b')][_0xbd9b('0x4b')](_0x1edf28);}else{throw new Error('List\x20not\x20found');}})[_0xbd9b('0x10')](function(_0x27aec4){_0x2ea7b7[_0xbd9b('0x4c')]=_0x27aec4;if(_0x27aec4){if(!_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x4d')]){_0x50be94[_0xbd9b('0x31')]['message']['messageId']=rs[_0xbd9b('0x4e')]()+'\x20'+_0x50be94[_0xbd9b('0x31')]['message'][_0xbd9b('0x37')];}var _0x2fcb7a={'ContactId':_0x27aec4['id'],'MailAccountId':_0x50be94[_0xbd9b('0x38')]['id'],'inReplyTo':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x4d')],'to':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')]['from'],'cc':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')]['cc'],'subject':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x4f')],'attach':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')]['attach'],'lastMsgAt':moment()[_0xbd9b('0x50')](_0xbd9b('0x51')),'lastMsgDirection':'in'};return db[_0xbd9b('0x52')][_0xbd9b('0x25')]({'where':{'closed':![],'MailAccountId':_0x50be94['account']['id']},'include':[{'model':db[_0xbd9b('0x53')],'as':_0xbd9b('0x54'),'attributes':['messageId'],'where':{'messageId':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x55')]}}]})['then'](function(_0x400c73){if(_0x400c73){return[_0x400c73,![]];}return db[_0xbd9b('0x52')][_0xbd9b('0x4b')](_0x2fcb7a)[_0xbd9b('0x10')](function(_0x197695){return[_0x197695,!![]];});});}else{throw new Error(_0xbd9b('0x56'));}})['spread'](function(_0x3e6802,_0x4950f4){if(_0x3e6802){_0x4dc753=_0x4950f4;if(!_0x4950f4){return _0x3e6802[_0xbd9b('0x57')]({'inReplyTo':_0x50be94[_0xbd9b('0x31')]['message']['messageId'],'to':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x37')],'cc':_0x50be94['body'][_0xbd9b('0x18')]['cc'],'subject':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x4f')],'attach':_0x3e6802['attach']?_0x3e6802['attach']:_0x50be94['body'][_0xbd9b('0x18')]['attach'],'substatus':null,'substatusAt':moment()[_0xbd9b('0x50')](_0xbd9b('0x51')),'lastMsgAt':moment()[_0xbd9b('0x50')](_0xbd9b('0x51')),'lastMsgDirection':'in'});}else{return _0x3e6802;}}})[_0xbd9b('0x10')](function(_0x12d7c5){_0x2ea7b7[_0xbd9b('0x58')]=_0x12d7c5[_0xbd9b('0x40')]({'plain':!![]});_0x2ea7b7[_0xbd9b('0x58')][_0xbd9b('0x59')]=_0x4dc753;return db[_0xbd9b('0x53')]['create']({'body':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x31')],'MailAccountId':_0x50be94[_0xbd9b('0x38')]['id'],'MailInteractionId':_0x12d7c5['id'],'direction':'in','ContactId':_0x2ea7b7[_0xbd9b('0x4c')]['id'],'messageId':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x4d')],'from':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x37')],'to':_0x50be94['body']['message']['to'],'cc':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')]['cc'],'subject':_0x50be94[_0xbd9b('0x31')]['message'][_0xbd9b('0x4f')],'attach':_0x50be94[_0xbd9b('0x31')]['message'][_0xbd9b('0x5a')],'Attachments':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x5b')],'originTo':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')]['originTo'],'originCc':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x5c')],'bcc':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x5d')],'ChatWebsiteId':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x5e')]||null,'originChannel':_0x50be94[_0xbd9b('0x31')]['message'][_0xbd9b('0x5f')]||_0xbd9b('0x60'),'ChatOfflineMessageId':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x61')]||null},{'include':[{'model':db['Attachment'],'as':_0xbd9b('0x62')}]});})[_0xbd9b('0x10')](function(_0x41fa28){_0x2ea7b7[_0xbd9b('0x18')]=_0x41fa28;if(_0x2ea7b7['interaction'][_0xbd9b('0x63')]){return db[_0xbd9b('0x64')][_0xbd9b('0x25')]({'attributes':['id',_0xbd9b('0x65')],'where':{'id':_0x2ea7b7['interaction'][_0xbd9b('0x63')]}})[_0xbd9b('0x10')](function(_0x194ea5){if(_0x194ea5){_0x2ea7b7[_0xbd9b('0x42')][_0xbd9b('0x66')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x194ea5['name']+','+(_0x2ea7b7[_0xbd9b('0x38')][_0xbd9b('0x67')]||0xa),'interval':_0xbd9b('0x48')});}return respondWithRpcPromise(_0xbd9b('0x68'),_0xbd9b('0x69'),_0x2ea7b7);});}return respondWithRpcPromise(_0xbd9b('0x68'),_0xbd9b('0x69'),_0x2ea7b7);})[_0xbd9b('0x10')](function(_0x2d9a85){_0x1768a5(_0x2d9a85);})[_0xbd9b('0x1a')](function(_0x52ecba){_0x3998e2(_0x195abf[_0xbd9b('0x16')](0x1f4,_0x52ecba['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 9d93c12..2c6b611 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 _0x2f93=['./mailAccount.events','save','remove','update','emit','register','length'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x2f93,0x165));var _0x32f9=function(_0x364048,_0x34dea3){_0x364048=_0x364048-0x0;var _0x591678=_0x2f93[_0x364048];return _0x591678;};'use strict';var MailAccountEvents=require(_0x32f9('0x0'));var events=[_0x32f9('0x1'),_0x32f9('0x2'),_0x32f9('0x3')];function createListener(_0x32e9d9,_0x5aebd7){return function(_0x22a6eb){_0x5aebd7[_0x32f9('0x4')](_0x32e9d9,_0x22a6eb);};}function removeListener(_0x211167,_0x49a994){return function(){MailAccountEvents['removeListener'](_0x211167,_0x49a994);};}exports[_0x32f9('0x5')]=function(_0xdf007f){for(var _0x3e6fe3=0x0,_0x26391d=events[_0x32f9('0x6')];_0x3e6fe3<_0x26391d;_0x3e6fe3++){var _0x261707=events[_0x3e6fe3];var _0x4957d4=createListener('mailAccount:'+_0x261707,_0xdf007f);MailAccountEvents['on'](_0x261707,_0x4957d4);}}; \ No newline at end of file +var _0x62b8=['./mailAccount.events','save','update','emit','register','length','mailAccount:'];(function(_0x2f0057,_0x448b27){var _0x17f2c3=function(_0x12efc3){while(--_0x12efc3){_0x2f0057['push'](_0x2f0057['shift']());}};_0x17f2c3(++_0x448b27);}(_0x62b8,0x142));var _0x862b=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x62b8[_0x119d5a];return _0x15bff4;};'use strict';var MailAccountEvents=require(_0x862b('0x0'));var events=[_0x862b('0x1'),'remove',_0x862b('0x2')];function createListener(_0x52a853,_0x58ad1d){return function(_0x53d9e8){_0x58ad1d[_0x862b('0x3')](_0x52a853,_0x53d9e8);};}function removeListener(_0x179f02,_0x2dfb4b){return function(){MailAccountEvents['removeListener'](_0x179f02,_0x2dfb4b);};}exports[_0x862b('0x4')]=function(_0x3de814){for(var _0x5c8137=0x0,_0x58aa3b=events[_0x862b('0x5')];_0x5c8137<_0x58aa3b;_0x5c8137++){var _0x301f27=events[_0x5c8137];var _0x2a66d1=createListener(_0x862b('0x6')+_0x301f27,_0x3de814);MailAccountEvents['on'](_0x301f27,_0x2a66d1);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 58c8db1..8a39403 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 _0x15c7=['destroy','exports','multer','path','express','Router','fs-extra','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','update','delete'];(function(_0x2dbc9a,_0x2f6fea){var _0x508a2b=function(_0x47663f){while(--_0x47663f){_0x2dbc9a['push'](_0x2dbc9a['shift']());}};_0x508a2b(++_0x2f6fea);}(_0x15c7,0xc5));var _0x715c=function(_0x5f5c7a,_0x514950){_0x5f5c7a=_0x5f5c7a-0x0;var _0xa8f1e0=_0x15c7[_0x5f5c7a];return _0xa8f1e0;};'use strict';var multer=require(_0x715c('0x0'));var util=require('util');var path=require(_0x715c('0x1'));var timeout=require('connect-timeout');var express=require(_0x715c('0x2'));var router=express[_0x715c('0x3')]();var fs_extra=require(_0x715c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x715c('0x5'));var controller=require(_0x715c('0x6'));router[_0x715c('0x7')](_0x715c('0x8'),auth[_0x715c('0x9')](),controller[_0x715c('0xa')]);router['put'](_0x715c('0x8'),auth[_0x715c('0x9')](),controller[_0x715c('0xb')]);router[_0x715c('0xc')](_0x715c('0x8'),auth[_0x715c('0x9')](),controller[_0x715c('0xd')]);module[_0x715c('0xe')]=router; \ No newline at end of file +var _0xae7c=['destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete'];(function(_0x3d69f9,_0x24daed){var _0x386964=function(_0x2d04fe){while(--_0x2d04fe){_0x3d69f9['push'](_0x3d69f9['shift']());}};_0x386964(++_0x24daed);}(_0xae7c,0x1ef));var _0xcae7=function(_0x5c32ff,_0x29830e){_0x5c32ff=_0x5c32ff-0x0;var _0x1744b8=_0xae7c[_0x5c32ff];return _0x1744b8;};'use strict';var multer=require(_0xcae7('0x0'));var util=require('util');var path=require(_0xcae7('0x1'));var timeout=require(_0xcae7('0x2'));var express=require(_0xcae7('0x3'));var router=express['Router']();var fs_extra=require(_0xcae7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcae7('0x5'));var config=require(_0xcae7('0x6'));var controller=require(_0xcae7('0x7'));router[_0xcae7('0x8')](_0xcae7('0x9'),auth[_0xcae7('0xa')](),controller[_0xcae7('0xb')]);router[_0xcae7('0xc')](_0xcae7('0x9'),auth[_0xcae7('0xa')](),controller[_0xcae7('0xd')]);router[_0xcae7('0xe')](_0xcae7('0x9'),auth['isAuthenticated'](),controller[_0xcae7('0xf')]);module[_0xcae7('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 444e0ce..62f1828 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 _0xe5f1=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x546129,_0x3e1cf8){var _0x3398fc=function(_0xa879a){while(--_0xa879a){_0x546129['push'](_0x546129['shift']());}};_0x3398fc(++_0x3e1cf8);}(_0xe5f1,0xe3));var _0x1e5f=function(_0x31c98f,_0x5dec23){_0x31c98f=_0x31c98f-0x0;var _0x3f9d1e=_0xe5f1[_0x31c98f];return _0x3f9d1e;};'use strict';var Sequelize=require(_0x1e5f('0x0'));module[_0x1e5f('0x1')]={'priority':{'type':Sequelize[_0x1e5f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1e5f('0x3')],'allowNull':![],'defaultValue':_0x1e5f('0x4')},'appdata':{'type':Sequelize[_0x1e5f('0x5')]()},'description':{'type':Sequelize[_0x1e5f('0x3')]},'interval':{'type':Sequelize[_0x1e5f('0x3')],'defaultValue':_0x1e5f('0x6')}}; \ No newline at end of file +var _0x702c=['noop','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x5bb6f2,_0x2ee4eb){var _0xf5b571=function(_0xa801b3){while(--_0xa801b3){_0x5bb6f2['push'](_0x5bb6f2['shift']());}};_0xf5b571(++_0x2ee4eb);}(_0x702c,0x112));var _0xc702=function(_0x339202,_0x409b45){_0x339202=_0x339202-0x0;var _0x365e0b=_0x702c[_0x339202];return _0x365e0b;};'use strict';var Sequelize=require(_0xc702('0x0'));module[_0xc702('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc702('0x2')},'appdata':{'type':Sequelize[_0xc702('0x3')]()},'description':{'type':Sequelize[_0xc702('0x4')]},'interval':{'type':Sequelize[_0xc702('0x4')],'defaultValue':_0xc702('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index d9d8786..41befa9 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(_0x1ae8ab,_0x6e5c2a){var _0x1ad705=function(_0x1dfa15){while(--_0x1dfa15){_0x1ae8ab['push'](_0x1ae8ab['shift']());}};_0x1ad705(++_0x6e5c2a);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'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 _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x55695c,_0x1b581f){var _0xe22b98=function(_0x2faf57){while(--_0x2faf57){_0x55695c['push'](_0x55695c['shift']());}};_0xe22b98(++_0x1b581f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3ad6e3,_0x3ca9fa){_0x3ad6e3=_0x3ad6e3-0x0;var _0x3f4dbd=_0xb43b[_0x3ad6e3];return _0x3f4dbd;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index df6fd0f..37d52b7 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 _0x5fad=['request-promise','path','rimraf','../../config/environment','define','mail_applications','utf8mb4_unicode_ci','lodash','api','moment'];(function(_0x3c6ea9,_0x237a28){var _0x206566=function(_0xfe0123){while(--_0xfe0123){_0x3c6ea9['push'](_0x3c6ea9['shift']());}};_0x206566(++_0x237a28);}(_0x5fad,0x129));var _0xd5fa=function(_0xc4d9ac,_0x313006){_0xc4d9ac=_0xc4d9ac-0x0;var _0x17f386=_0x5fad[_0xc4d9ac];return _0x17f386;};'use strict';var _=require(_0xd5fa('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd5fa('0x1'));var moment=require(_0xd5fa('0x2'));var BPromise=require('bluebird');var rp=require(_0xd5fa('0x3'));var fs=require('fs');var path=require(_0xd5fa('0x4'));var rimraf=require(_0xd5fa('0x5'));var config=require(_0xd5fa('0x6'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x597cec,_0x44b764){return _0x597cec[_0xd5fa('0x7')]('MailApplication',attributes,{'tableName':_0xd5fa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd5fa('0x9')});}; \ No newline at end of file +var _0xe813=['api','moment','request-promise','path','../../config/environment','./mailApplication.attributes','define','mail_applications','utf8mb4_unicode_ci','util'];(function(_0x109070,_0x326fad){var _0x31b9bb=function(_0x2b757a){while(--_0x2b757a){_0x109070['push'](_0x109070['shift']());}};_0x31b9bb(++_0x326fad);}(_0xe813,0xdb));var _0x3e81=function(_0x1bc445,_0x2d6fe0){_0x1bc445=_0x1bc445-0x0;var _0x589e6b=_0xe813[_0x1bc445];return _0x589e6b;};'use strict';var _=require('lodash');var util=require(_0x3e81('0x0'));var logger=require('../../config/logger')(_0x3e81('0x1'));var moment=require(_0x3e81('0x2'));var BPromise=require('bluebird');var rp=require(_0x3e81('0x3'));var fs=require('fs');var path=require(_0x3e81('0x4'));var rimraf=require('rimraf');var config=require(_0x3e81('0x5'));var attributes=require(_0x3e81('0x6'));module['exports']=function(_0x5ef5cc,_0x2f81a1){return _0x5ef5cc[_0x3e81('0x7')]('MailApplication',attributes,{'tableName':_0x3e81('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3e81('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 32d8353..e995967 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 _0xa179=['../../config/logger','rpc','jayson/promise','http','then','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','info','result','catch','UpdateMailApplication','MailApplication','body','options','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x31f556,_0x124c89){var _0x60c50d=function(_0x47feb4){while(--_0x47feb4){_0x31f556['push'](_0x31f556['shift']());}};_0x60c50d(++_0x124c89);}(_0xa179,0x14a));var _0x9a17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa179[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9a17('0x0'));var BPromise=require(_0x9a17('0x1'));var rs=require(_0x9a17('0x2'));var fs=require('fs');var Redis=require(_0x9a17('0x3'));var db=require(_0x9a17('0x4'))['db'];var utils=require(_0x9a17('0x5'));var logger=require(_0x9a17('0x6'))(_0x9a17('0x7'));var config=require('../../config/environment');var jayson=require(_0x9a17('0x8'));var client=jayson['client'][_0x9a17('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eb8f6,_0x5e53c2,_0x508e4c){return new BPromise(function(_0x15c232,_0x21f9f4){return client['request'](_0x2eb8f6,_0x508e4c)[_0x9a17('0xa')](function(_0x720b4e){logger['info']('MailApplication,\x20%s,\x20%s',_0x5e53c2,_0x9a17('0xb'));logger[_0x9a17('0xc')](_0x9a17('0xd'),_0x5e53c2,_0x9a17('0xb'),JSON[_0x9a17('0xe')](_0x720b4e));if(_0x720b4e['error']){if(_0x720b4e[_0x9a17('0xf')][_0x9a17('0x10')]===0x1f4){logger['error'](_0x9a17('0x11'),_0x5e53c2,_0x720b4e[_0x9a17('0xf')][_0x9a17('0x12')]);return _0x21f9f4(_0x720b4e['error']['message']);}logger[_0x9a17('0xf')](_0x9a17('0x11'),_0x5e53c2,_0x720b4e[_0x9a17('0xf')][_0x9a17('0x12')]);return _0x15c232(_0x720b4e[_0x9a17('0xf')][_0x9a17('0x12')]);}else{logger[_0x9a17('0x13')](_0x9a17('0x11'),_0x5e53c2,'request\x20sent');_0x15c232(_0x720b4e[_0x9a17('0x14')]['message']);}})[_0x9a17('0x15')](function(_0x4ce53f){logger[_0x9a17('0xf')]('MailApplication,\x20%s,\x20%s',_0x5e53c2,_0x4ce53f);_0x21f9f4(_0x4ce53f);});});}exports[_0x9a17('0x16')]=function(_0x5dc162){var _0x491404=this;return new Promise(function(_0x43ea21,_0x4ab6f0){return db[_0x9a17('0x17')]['update'](_0x5dc162[_0x9a17('0x18')],{'raw':_0x5dc162[_0x9a17('0x19')]?_0x5dc162['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dc162[_0x9a17('0x19')]?_0x5dc162['options']['where']||null:null,'attributes':_0x5dc162['options']?_0x5dc162[_0x9a17('0x19')][_0x9a17('0x1a')]||null:null,'limit':_0x5dc162[_0x9a17('0x19')]?_0x5dc162[_0x9a17('0x19')][_0x9a17('0x1b')]||null:null})[_0x9a17('0xa')](function(_0x3165c6){logger[_0x9a17('0x13')]('UpdateMailApplication',_0x5dc162);logger[_0x9a17('0xc')]('UpdateMailApplication',_0x5dc162,JSON[_0x9a17('0xe')](_0x3165c6));_0x43ea21(_0x3165c6);})['catch'](function(_0x4e39d3){logger['error'](_0x9a17('0x16'),_0x4e39d3['message'],_0x5dc162);_0x4ab6f0(_0x491404[_0x9a17('0xf')](0x1f4,_0x4e39d3[_0x9a17('0x12')]));});});}; \ No newline at end of file +var _0xb745=['limit','UpdateMailApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','update','body','options','raw','where','attributes'];(function(_0x560a0d,_0x3f2fe2){var _0x1474eb=function(_0x3da663){while(--_0x3da663){_0x560a0d['push'](_0x560a0d['shift']());}};_0x1474eb(++_0x3f2fe2);}(_0xb745,0x198));var _0x5b74=function(_0x558414,_0x58ea6e){_0x558414=_0x558414-0x0;var _0x343829=_0xb745[_0x558414];return _0x343829;};'use strict';var _=require(_0x5b74('0x0'));var util=require(_0x5b74('0x1'));var moment=require(_0x5b74('0x2'));var BPromise=require(_0x5b74('0x3'));var rs=require(_0x5b74('0x4'));var fs=require('fs');var Redis=require(_0x5b74('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5b74('0x6'))('rpc');var config=require(_0x5b74('0x7'));var jayson=require(_0x5b74('0x8'));var client=jayson[_0x5b74('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54428d,_0x132c72,_0x57d540){return new BPromise(function(_0x1c9f49,_0x521a30){return client['request'](_0x54428d,_0x57d540)[_0x5b74('0xa')](function(_0x3bb7fe){logger['info'](_0x5b74('0xb'),_0x132c72,_0x5b74('0xc'));logger[_0x5b74('0xd')](_0x5b74('0xe'),_0x132c72,_0x5b74('0xc'),JSON[_0x5b74('0xf')](_0x3bb7fe));if(_0x3bb7fe[_0x5b74('0x10')]){if(_0x3bb7fe[_0x5b74('0x10')][_0x5b74('0x11')]===0x1f4){logger['error'](_0x5b74('0xb'),_0x132c72,_0x3bb7fe['error'][_0x5b74('0x12')]);return _0x521a30(_0x3bb7fe[_0x5b74('0x10')][_0x5b74('0x12')]);}logger[_0x5b74('0x10')](_0x5b74('0xb'),_0x132c72,_0x3bb7fe['error']['message']);return _0x1c9f49(_0x3bb7fe[_0x5b74('0x10')][_0x5b74('0x12')]);}else{logger[_0x5b74('0x13')]('MailApplication,\x20%s,\x20%s',_0x132c72,_0x5b74('0xc'));_0x1c9f49(_0x3bb7fe['result']['message']);}})[_0x5b74('0x14')](function(_0x171e23){logger[_0x5b74('0x10')](_0x5b74('0xb'),_0x132c72,_0x171e23);_0x521a30(_0x171e23);});});}exports['UpdateMailApplication']=function(_0x46b2e8){var _0x26a4a8=this;return new Promise(function(_0x4dcf98,_0x21fa4d){return db['MailApplication'][_0x5b74('0x15')](_0x46b2e8[_0x5b74('0x16')],{'raw':_0x46b2e8[_0x5b74('0x17')]?_0x46b2e8[_0x5b74('0x17')][_0x5b74('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46b2e8['options']?_0x46b2e8['options'][_0x5b74('0x19')]||null:null,'attributes':_0x46b2e8[_0x5b74('0x17')]?_0x46b2e8[_0x5b74('0x17')][_0x5b74('0x1a')]||null:null,'limit':_0x46b2e8[_0x5b74('0x17')]?_0x46b2e8[_0x5b74('0x17')][_0x5b74('0x1b')]||null:null})[_0x5b74('0xa')](function(_0x188233){logger[_0x5b74('0x13')](_0x5b74('0x1c'),_0x46b2e8);logger[_0x5b74('0xd')]('UpdateMailApplication',_0x46b2e8,JSON[_0x5b74('0xf')](_0x188233));_0x4dcf98(_0x188233);})[_0x5b74('0x14')](function(_0x541983){logger[_0x5b74('0x10')]('UpdateMailApplication',_0x541983[_0x5b74('0x12')],_0x46b2e8);_0x21fa4d(_0x26a4a8['error'](0x1f4,_0x541983[_0x5b74('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index b4c0b3a..6b71b5e 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 _0x514f=['index','/describe','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated'];(function(_0x23f614,_0x4d4f28){var _0x5970a4=function(_0x1da8a6){while(--_0x1da8a6){_0x23f614['push'](_0x23f614['shift']());}};_0x5970a4(++_0x4d4f28);}(_0x514f,0x6d));var _0xf514=function(_0x2e06e2,_0x1b3227){_0x2e06e2=_0x2e06e2-0x0;var _0x474ac1=_0x514f[_0x2e06e2];return _0x474ac1;};'use strict';var express=require(_0xf514('0x0'));var router=express[_0xf514('0x1')]();var auth=require(_0xf514('0x2'));var interaction=require(_0xf514('0x3'));var controller=require(_0xf514('0x4'));router[_0xf514('0x5')]('/',auth[_0xf514('0x6')](),controller[_0xf514('0x7')]);router[_0xf514('0x5')](_0xf514('0x8'),auth[_0xf514('0x6')](),controller[_0xf514('0x9')]);router[_0xf514('0x5')](_0xf514('0xa'),auth[_0xf514('0x6')](),controller[_0xf514('0xb')]);router['get'](_0xf514('0xc'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xf514('0xd'),auth[_0xf514('0x6')](),controller['download']);router[_0xf514('0xe')]('/',auth[_0xf514('0x6')](),controller[_0xf514('0xf')]);router['post'](_0xf514('0xc'),auth['isAuthenticated'](),controller[_0xf514('0x10')]);router[_0xf514('0xe')](_0xf514('0x11'),auth[_0xf514('0x6')](),interaction[_0xf514('0x12')](_0xf514('0x13'),_0xf514('0x14')),controller[_0xf514('0x15')]);router[_0xf514('0x16')](_0xf514('0xa'),auth['isAuthenticated'](),interaction['tracked'](_0xf514('0x13'),_0xf514('0x17')),controller[_0xf514('0x18')]);router[_0xf514('0x19')](_0xf514('0xa'),auth[_0xf514('0x6')](),interaction[_0xf514('0x12')](_0xf514('0x13'),_0xf514('0x1a')),controller[_0xf514('0x1b')]);router[_0xf514('0x19')](_0xf514('0x11'),auth[_0xf514('0x6')](),controller['removeTags']);module[_0xf514('0x1c')]=router; \ No newline at end of file +var _0x5d7b=['./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','tracked','mailinteraction:addtags','addTags','put','mail','update','delete','mailinteraction:destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3a7116,_0xa08349){var _0x5b53bb=function(_0x1ed39f){while(--_0x1ed39f){_0x3a7116['push'](_0x3a7116['shift']());}};_0x5b53bb(++_0xa08349);}(_0x5d7b,0x1e2));var _0xb5d7=function(_0x4f8cba,_0x51d42b){_0x4f8cba=_0x4f8cba-0x0;var _0xe240a6=_0x5d7b[_0x4f8cba];return _0xe240a6;};'use strict';var express=require(_0xb5d7('0x0'));var router=express[_0xb5d7('0x1')]();var auth=require(_0xb5d7('0x2'));var interaction=require(_0xb5d7('0x3'));var controller=require(_0xb5d7('0x4'));router[_0xb5d7('0x5')]('/',auth[_0xb5d7('0x6')](),controller[_0xb5d7('0x7')]);router['get'](_0xb5d7('0x8'),auth['isAuthenticated'](),controller[_0xb5d7('0x9')]);router[_0xb5d7('0x5')](_0xb5d7('0xa'),auth[_0xb5d7('0x6')](),controller[_0xb5d7('0xb')]);router['get']('/:id/messages',auth[_0xb5d7('0x6')](),controller[_0xb5d7('0xc')]);router[_0xb5d7('0x5')](_0xb5d7('0xd'),auth['isAuthenticated'](),controller[_0xb5d7('0xe')]);router[_0xb5d7('0xf')]('/',auth[_0xb5d7('0x6')](),controller[_0xb5d7('0x10')]);router['post'](_0xb5d7('0x11'),auth['isAuthenticated'](),controller['addMessage']);router[_0xb5d7('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xb5d7('0x12')]('mail',_0xb5d7('0x13')),controller[_0xb5d7('0x14')]);router[_0xb5d7('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0xb5d7('0x12')](_0xb5d7('0x16'),'mailinteraction:update'),controller[_0xb5d7('0x17')]);router[_0xb5d7('0x18')](_0xb5d7('0xa'),auth[_0xb5d7('0x6')](),interaction[_0xb5d7('0x12')](_0xb5d7('0x16'),_0xb5d7('0x19')),controller['destroy']);router[_0xb5d7('0x18')]('/:id/tags',auth[_0xb5d7('0x6')](),controller['removeTags']);module[_0xb5d7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 685ef86..d1fe9e0 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 _0x19e4=['sequelize','iconv','exports','DATE','STRING','TEXT','long','BOOLEAN','ENUM','out'];(function(_0x5deaf9,_0x41cab5){var _0x579fbc=function(_0x40da81){while(--_0x40da81){_0x5deaf9['push'](_0x5deaf9['shift']());}};_0x579fbc(++_0x41cab5);}(_0x19e4,0x1c2));var _0x419e=function(_0x5abca7,_0x41896d){_0x5abca7=_0x5abca7-0x0;var _0xc04692=_0x19e4[_0x5abca7];return _0xc04692;};'use strict';var Sequelize=require(_0x419e('0x0'));var iconv=require(_0x419e('0x1'));module[_0x419e('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x419e('0x3')]},'disposition':{'type':Sequelize[_0x419e('0x4')]},'secondDisposition':{'type':Sequelize[_0x419e('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x419e('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x419e('0x4')]},'cc':{'type':Sequelize[_0x419e('0x5')](_0x419e('0x6'))},'subject':{'type':Sequelize[_0x419e('0x5')]()},'attach':{'type':Sequelize[_0x419e('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x419e('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x419e('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x419e('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x419e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x419e('0x8')]('in',_0x419e('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x419e('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xfdc4=['ENUM','sequelize','BOOLEAN','DATE','STRING','TEXT','long','out'];(function(_0x1d6fb5,_0x431d48){var _0x24bded=function(_0x5b7a7e){while(--_0x5b7a7e){_0x1d6fb5['push'](_0x1d6fb5['shift']());}};_0x24bded(++_0x431d48);}(_0xfdc4,0x81));var _0x4fdc=function(_0x3bcfc1,_0x5c6979){_0x3bcfc1=_0x3bcfc1-0x0;var _0x270cea=_0xfdc4[_0x3bcfc1];return _0x270cea;};'use strict';var Sequelize=require(_0x4fdc('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x4fdc('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4fdc('0x2')]},'disposition':{'type':Sequelize[_0x4fdc('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4fdc('0x3')]},'note':{'type':Sequelize[_0x4fdc('0x3')]},'inReplyTo':{'type':Sequelize[_0x4fdc('0x3')](0x1fe)},'to':{'type':Sequelize[_0x4fdc('0x3')]},'cc':{'type':Sequelize[_0x4fdc('0x4')](_0x4fdc('0x5'))},'subject':{'type':Sequelize[_0x4fdc('0x4')]()},'attach':{'type':Sequelize[_0x4fdc('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x4fdc('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x4fdc('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4fdc('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4fdc('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4fdc('0x7')]('in',_0x4fdc('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 41c19ff..b325e60 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 _0xb10b=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','show','params','rawAttributes','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','-id','trimStart','plainBody','catch','index','map','MailInteraction','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','field','color','tools_tags','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','Contact.firstName','c.email'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xb10b,0x12a));var _0xbb10=function(_0x2068ee,_0x42966a){_0x2068ee=_0x2068ee-0x0;var _0xa36814=_0xb10b[_0x2068ee];return _0xa36814;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var BPromise=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var fs=require('fs');var _=require(_0xbb10('0x5'));var squel=require(_0xbb10('0x6'));var juice=require(_0xbb10('0x7'));var Redis=require(_0xbb10('0x8'));var qs=require(_0xbb10('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xbb10('0xa'))(_0xbb10('0xb'));var config=require('../../config/environment');var db=require(_0xbb10('0xc'))['db'];config[_0xbb10('0xd')]=_[_0xbb10('0xe')](config[_0xbb10('0xd')],{'host':_0xbb10('0xf'),'port':0x18eb});var socket=require(_0xbb10('0x10'))(new Redis(config[_0xbb10('0xd')]));require(_0xbb10('0x11'))['register'](socket);function respondWithStatusCode(_0x4e47f8,_0x20bd61){_0x20bd61=_0x20bd61||0xcc;return function(_0x118a74){if(_0x118a74){return _0x4e47f8[_0xbb10('0x12')](_0x20bd61);}return _0x4e47f8['status'](_0x20bd61)[_0xbb10('0x13')]();};}function respondWithResult(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xc8;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x14')](_0x44fb19)[_0xbb10('0x15')](_0x916a32);}};}function respondWithFilteredResult(_0x442548,_0x147230){return function(_0x58a612){if(_0x58a612){var _0x26e021=typeof _0x147230[_0xbb10('0x16')]===_0xbb10('0x17')&&typeof _0x147230[_0xbb10('0x18')]===_0xbb10('0x17');var _0x2f2ebf=_0x58a612[_0xbb10('0x19')];var _0x36b5e8=_0x26e021?0x0:_0x147230[_0xbb10('0x16')];var _0x2b184e=_0x26e021?_0x58a612['count']:_0x147230[_0xbb10('0x16')]+_0x147230[_0xbb10('0x18')];var _0x133ac2;if(_0x2b184e>=_0x2f2ebf){_0x2b184e=_0x2f2ebf;_0x133ac2=0xc8;}else{_0x133ac2=0xce;}_0x442548[_0xbb10('0x14')](_0x133ac2);return _0x442548[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x36b5e8+'-'+_0x2b184e+'/'+_0x2f2ebf)[_0xbb10('0x15')](_0x58a612);}return null;};}function saveUpdates(_0x30efc6){return function(_0xbf2906){if(_0xbf2906){return _0xbf2906[_0xbb10('0x1c')](_0x30efc6)['then'](function(_0x5ff0cf){return _0x5ff0cf;});}return null;};}function removeEntity(_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x1d')]()[_0xbb10('0x1e')](function(){_0x19f48d[_0xbb10('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f888){return function(_0x12ef77){if(!_0x12ef77){_0x12f888['sendStatus'](0x194);}return _0x12ef77;};}function handleError(_0x4c4b0d,_0x8e2b97){_0x8e2b97=_0x8e2b97||0x1f4;return function(_0x311abe){logger[_0xbb10('0x1f')](_0x311abe[_0xbb10('0x20')]);if(_0x311abe[_0xbb10('0x21')]){delete _0x311abe[_0xbb10('0x21')];}_0x4c4b0d[_0xbb10('0x14')](_0x8e2b97)[_0xbb10('0x22')](_0x311abe);};}function getInteractionUsers(_0x7f2377,_0x395404){return new BPromise(function(_0x3ba6cd,_0x26ad93){try{if(_0x395404[_0x7f2377['id']]){_0x7f2377['Users']=_['map'](_0x395404[_0x7f2377['id']],function(_0x4fb5e0){return{'id':_0x4fb5e0['id'],'fullname':_0x4fb5e0[_0xbb10('0x23')]};});}}catch(_0x3c5ae7){_0x26ad93(_0x3c5ae7);}_0x3ba6cd(_0x7f2377);});}function getInteractionTags(_0x2c89b9,_0x4e25ff){return new BPromise(function(_0x2fdde9,_0x24d586){try{if(_0x2c89b9[_0xbb10('0x24')]){_0x2c89b9[_0xbb10('0x25')]=[];_0x2c89b9[_0xbb10('0x24')][_0xbb10('0x26')](',')[_0xbb10('0x27')](function(_0x4aabb9){_0x2c89b9[_0xbb10('0x25')][_0xbb10('0x28')](_0x4e25ff[_0x4aabb9]);});}delete _0x2c89b9[_0xbb10('0x24')];}catch(_0x2e0249){_0x24d586(_0x2e0249);}_0x2fdde9(_0x2c89b9);});}function getLastMessageText(_0x1d30aa){return new BPromise(function(_0x2ff4c1,_0x5d5c80){return db[_0xbb10('0x29')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1d30aa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbb10('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xbb10('0x2b'),'raw':!![]})[_0xbb10('0x1e')](function(_0x1b59f9){if(_0x1b59f9&&_0x1b59f9['plainBody']){_0x1d30aa['lastMsgText']=_[_0xbb10('0x2c')](_0x1b59f9[_0xbb10('0x2d')]);}_0x2ff4c1(_0x1d30aa);})['catch'](function(_0x359ad4){_0x5d5c80(_0x359ad4);});});}function updateMailInteraction(_0x37dde7,_0x2f653f,_0x1c0b57,_0x37a83f){return new BPromise(function(_0x138bc6,_0xf85197){return getInteractionUsers(_0x37dde7,_0x1c0b57)['then'](function(_0x25acb3){return getInteractionTags(_0x25acb3,_0x2f653f);})[_0xbb10('0x1e')](function(_0x441d15){if(_0x37a83f){_0x138bc6(getLastMessageText(_0x441d15));}else{_0x138bc6(_0x441d15);}})[_0xbb10('0x2e')](function(_0xfb2c5e){_0xf85197(_0xfb2c5e);});});}exports[_0xbb10('0x2f')]=function(_0x188cbd,_0x10202c){var _0x3c8d7d={},_0x56943c={},_0x2b5352={'count':0x0,'rows':[]};var _0x150107=_[_0xbb10('0x30')](db[_0xbb10('0x31')]['rawAttributes'],function(_0x111762){return{'name':_0x111762['fieldName'],'type':_0x111762['type'][_0xbb10('0x32')]};});_0x56943c[_0xbb10('0x33')]=_[_0xbb10('0x30')](_0x150107,_0xbb10('0x21'));_0x56943c[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x188cbd['query']);_0x56943c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x56943c['model'],_0x56943c['query']);_0x3c8d7d['attributes']=_[_0xbb10('0x37')](_0x56943c[_0xbb10('0x33')],qs[_0xbb10('0x38')](_0x188cbd['query'][_0xbb10('0x38')]));_0x3c8d7d[_0xbb10('0x39')]=_0x3c8d7d[_0xbb10('0x39')]['length']?_0x3c8d7d[_0xbb10('0x39')]:_0x56943c[_0xbb10('0x33')];if(!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3a')]('nolimit')){_0x3c8d7d[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x188cbd['query'][_0xbb10('0x18')]);_0x3c8d7d[_0xbb10('0x16')]=qs[_0xbb10('0x16')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x16')]);}_0x3c8d7d[_0xbb10('0x3b')]=qs['sort'](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x3c8d7d[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x188cbd[_0xbb10('0x34')],_0x56943c[_0xbb10('0x36')]),_0x150107);var _0x23dc18=[];var _0x403beb=squel['select']()[_0xbb10('0x3e')]('id')[_0xbb10('0x3e')]('name')['field'](_0xbb10('0x3f'))['from'](_0xbb10('0x40'));var _0x180933=squel['select']()[_0xbb10('0x3e')](_0xbb10('0x41'))[_0xbb10('0x3e')]('u.fullname')[_0xbb10('0x3e')](_0xbb10('0x42'))[_0xbb10('0x43')](_0xbb10('0x44'),'ui')[_0xbb10('0x45')](_0xbb10('0x46'),'u',_0xbb10('0x47'));var _0x3efa96=squel[_0xbb10('0x48')]()[_0xbb10('0x43')](_0xbb10('0x49'),'i')[_0xbb10('0x45')]('cm_contacts','c',_0xbb10('0x4a'))[_0xbb10('0x45')]('users','o',_0xbb10('0x4b'))[_0xbb10('0x45')](_0xbb10('0x4c'),'a',_0xbb10('0x4d'))[_0xbb10('0x45')](_0xbb10('0x4e'),'me',_0xbb10('0x4f'))['left_join']('mail_interaction_has_tags','it',_0xbb10('0x50'))[_0xbb10('0x45')](_0xbb10('0x40'),'t','t.id\x20=\x20it.TagId');var _0x5f0c12=squel[_0xbb10('0x51')]();var _0x34cf4e=[];var _0x1bd054=squel[_0xbb10('0x51')]();var _0x10159b;if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]){_0x10159b=as[_0xbb10('0x53')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]);var _0x550111=_0x10159b['sqlOperator'];for(var _0x412e13=0x0;_0x412e13<_0x10159b[_0xbb10('0x54')][_0xbb10('0x55')];_0x412e13++){var _0xb014b0=_0x10159b[_0xbb10('0x54')][_0x412e13];var _0x440f9e='i';var _0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),_0xb014b0[_0xbb10('0x3e')]]);if(!_0x358e7e){switch(_0xb014b0[_0xbb10('0x3e')]){case _0xbb10('0x57'):if(_0xb014b0[_0xbb10('0x58')]==0x1){_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0[_0xbb10('0x3e')]+'`\x20=\x200');}else{_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0['field']+_0xbb10('0x5a'));}break;case _0xbb10('0x5b'):if(_0xb014b0[_0xbb10('0x5c')]===_0xbb10('0x5d')){if(_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')]('\x20')[_0xbb10('0x55')]>0x1){_0x5f0c12[_0x550111](_0xbb10('0x5e'),qs[_0xbb10('0x5f')](_0xb014b0[_0xbb10('0x58')]),null);}else{var _0x44a056='%'+_0xb014b0[_0xbb10('0x58')]+'%';_0x5f0c12[_0x550111](_0xbb10('0x60'),_0x44a056,_0x44a056,_0x44a056);}}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'ContactId']);_0xb014b0[_0xbb10('0x3e')]=_0xbb10('0x61');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')]['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);}break;case _0xbb10('0x65'):var _0x14fed3=_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')](',')[_0xbb10('0x30')](function(_0x12ec18){return Number(_0x12ec18);});_0x14fed3[_0xbb10('0x27')](function(_0x40c4fb){_0x1bd054['or'](_0xbb10('0x66'),'%,'+_0x40c4fb+',%');});_0x34cf4e=_[_0xbb10('0x67')](_0x34cf4e,_0x14fed3);break;case _0xbb10('0x68'):if(_0xb014b0['operator']==='$substring'){_0x5f0c12[_0x550111](_0xbb10('0x69'),'%'+_0xb014b0[_0xbb10('0x58')]+'%',null);}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'UserId']);_0xb014b0['field']=_0xbb10('0x6a');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}break;case _0xbb10('0x2d'):_0x155dc5=as[_0xbb10('0x62')]('me',null,_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5['value']['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);break;}}else{var _0x155dc5=as['buildExpression'](_0x440f9e,_0x358e7e['type'],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}}}else{var _0xa1bbd9=_(_0x188cbd[_0xbb10('0x34')])['keys']()['map'](function(_0x27d7b9){return _[_0xbb10('0x6c')](_0x150107,[_0xbb10('0x21'),_0x27d7b9])?_0x27d7b9:undefined;})[_0xbb10('0x6d')]()['value']();if(!_[_0xbb10('0x6e')](_0xa1bbd9)){_0xa1bbd9[_0xbb10('0x27')](function(_0xa7179d){if(_0xa7179d==='MailAccountId'){_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),[][_0xbb10('0x70')](_0x188cbd['query'][_0xa7179d]));}else if(_0xa7179d===_0xbb10('0x71')){var _0x31e85e=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])['$gte'];var _0x251417=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])[_0xbb10('0x73')];_0x3efa96['where'](_0xbb10('0x74'),_0x31e85e,_0x251417);}else{if(_0x188cbd[_0xbb10('0x34')][_0xa7179d]===_0xbb10('0x75')){_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x76'));}else{_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x77'),_0x188cbd['query'][_0xa7179d]);}}});}if(_0x188cbd['query']['read']){if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x78')]==0x1){_0x3efa96[_0xbb10('0x59')]('`unreadMessages`\x20=\x200');}else{_0x3efa96['having'](_0xbb10('0x79'));}}if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]){_0x34cf4e=_[_0xbb10('0x7b')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')])?_0x188cbd['query'][_0xbb10('0x7a')]:new Array(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]);_0x34cf4e[_0xbb10('0x27')](function(_0x2aaaa6){_0x1bd054['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2aaaa6+',%');});}if(_0x188cbd['query']['filter']){var _0x329da7=_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7c')][_0xbb10('0x7d')]('\x5c','\x5c\x5c')[_0xbb10('0x7d')](/'/g,'\x27\x27');if(qs[_0xbb10('0x7e')](_0x329da7)){_0x5f0c12['or']('i.id\x20LIKE\x20?',_0x329da7+'%');}else if(qs[_0xbb10('0x7f')](_0x329da7)){_0x5f0c12['or']('c.email\x20LIKE\x20?',_0x329da7+'%');}else{_0x5f0c12['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x329da7))['or'](_0xbb10('0x80'),qs[_0xbb10('0x5f')](_0x329da7));}}}_0x3efa96[_0xbb10('0x3d')](_0x5f0c12);_0x3efa96[_0xbb10('0x81')]('i.id');var _0x122d38={'type':db['Sequelize']['QueryTypes'][_0xbb10('0x82')],'raw':!![]};var _0xfe3db0=_0x3efa96[_0xbb10('0x83')]();_0xfe3db0[_0xbb10('0x3e')](_0xbb10('0x84'));_0xfe3db0['field'](_0xbb10('0x85'),_0xbb10('0x57'));if(_0x3c8d7d[_0xbb10('0x3b')]){_0x3c8d7d[_0xbb10('0x3b')][_0xbb10('0x27')](function(_0x27f42f){var _0x174395=_0x27f42f[0x0]==='contactName'?_0x27f42f[0x0]:'i.'+_0x27f42f[0x0];_0x3efa96[_0xbb10('0x3b')](_0x174395,_0x27f42f[0x1]===_0xbb10('0x86')?![]:!![]);});}if(!_[_0xbb10('0x6e')](_0x34cf4e)){_0x3efa96[_0xbb10('0x59')](_0x1bd054);_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x87'),_0x34cf4e);}BPromise[_0xbb10('0x88')]()[_0xbb10('0x1e')](function(){if(!_0x10159b){if(_0x188cbd['query'][_0xbb10('0x89')])return;_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8a'));_0x3efa96['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x188cbd['user'][_0xbb10('0x8b')]!=='agent')return;return _0x188cbd['user'][_0xbb10('0x8c')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x1e')](function(_0x33ff06){if(_[_0xbb10('0x6e')](_0x33ff06)){_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8d'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x8d'));}else{_0xfe3db0[_0xbb10('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0xbb10('0x30')](_0x33ff06,'id'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),_[_0xbb10('0x30')](_0x33ff06,'id'));}});})['then'](function(){if(_0x188cbd['user'][_0xbb10('0x8b')]===_0xbb10('0x8e')&&!_0x10159b&&!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x89')])return[];return db['sequelize'][_0xbb10('0x34')](_0xfe3db0[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0xf7b3e1){_0x2b5352[_0xbb10('0x19')]=_0xf7b3e1['length'];if(_0x2b5352['count']===0x0)return[];return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x403beb[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x256b35){_0x23dc18=_[_0xbb10('0x91')](_0x256b35,'id');_0x122d38=_['merge'](_0x122d38,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x38')]){_0x3c8d7d[_0xbb10('0x39')]['forEach'](function(_0x32d5a5){_0x3efa96[_0xbb10('0x3e')]('i.'+_0x32d5a5);});}else{_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x85'),_0xbb10('0x57'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x92'),_0xbb10('0x93'));_0x3efa96[_0xbb10('0x3e')]('a.mandatoryDisposition',_0xbb10('0x94'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x95'),_0xbb10('0x96'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x84'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x97'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x98'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x99'));_0x3efa96['field']('i.closedAt');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9a'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9b'));_0x3efa96[_0xbb10('0x3e')]('i.lastMsgDirection');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9c'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9d'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9e'));_0x3efa96['field'](_0xbb10('0x9f'));_0x3efa96[_0xbb10('0x3e')]('i.substatus');_0x3efa96[_0xbb10('0x3e')]('i.to');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa0'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa1'));_0x3efa96[_0xbb10('0x3e')]('i.UserId');_0x3efa96[_0xbb10('0x3e')]('c.firstName',_0xbb10('0xa2'));_0x3efa96[_0xbb10('0x3e')]('c.lastName','Contact.lastName');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa3'),_0xbb10('0xa4'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa5'),_0xbb10('0xa6'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa7'),_0xbb10('0xa8'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa9'),'Contact.fax');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xaa'),_0xbb10('0xab'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xac'),_0xbb10('0xad'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xae'),_0xbb10('0x24'));}if(_0x3c8d7d[_0xbb10('0x18')])_0x3efa96[_0xbb10('0x18')](_0x3c8d7d[_0xbb10('0x18')]);if(_0x3c8d7d['offset'])_0x3efa96[_0xbb10('0x16')](_0x3c8d7d['offset']);return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x3efa96[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0x38d369){if(_0x38d369['length']>0x0)_0x180933[_0xbb10('0x3d')](_0xbb10('0xaf'),_[_0xbb10('0x30')](_0x38d369,'id'));return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x180933[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x4bd470){var _0x5cc9d7=_[_0xbb10('0xb0')](_0x4bd470,_0xbb10('0xb1'));var _0x57d5a1=[];return db[_0xbb10('0xb2')][_0xbb10('0xb3')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xbb10('0x1e')](function(_0xaede56){var _0x5642c3=_0xaede56[_0xbb10('0xb4')];_0x38d369['forEach'](function(_0x34cec7){_0x57d5a1[_0xbb10('0x28')](updateMailInteraction(_0x34cec7,_0x23dc18,_0x5cc9d7,_0x5642c3));});return BPromise['all'](_0x57d5a1);});});});})[_0xbb10('0x1e')](function(_0x28cc74){_0x2b5352['rows']=_0x28cc74;return _0x2b5352;})['then'](respondWithFilteredResult(_0x10202c,_0x3c8d7d))[_0xbb10('0x2e')](handleError(_0x10202c,null));};exports[_0xbb10('0xb5')]=function(_0x3e0e34,_0x3299bc){var _0x3ceb77={'raw':![],'where':{'id':_0x3e0e34[_0xbb10('0xb6')]['id']}},_0x4c3bdc={};_0x4c3bdc[_0xbb10('0x33')]=_[_0xbb10('0x35')](db['MailInteraction'][_0xbb10('0xb7')]);_0x4c3bdc[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x3e0e34[_0xbb10('0x34')]);_0x4c3bdc[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x4c3bdc[_0xbb10('0x33')],_0x4c3bdc[_0xbb10('0x34')]);_0x3ceb77[_0xbb10('0x39')]=_['intersection'](_0x4c3bdc['model'],qs[_0xbb10('0x38')](_0x3e0e34[_0xbb10('0x34')][_0xbb10('0x38')]));_0x3ceb77[_0xbb10('0x39')]=_0x3ceb77[_0xbb10('0x39')][_0xbb10('0x55')]?_0x3ceb77[_0xbb10('0x39')]:_0x4c3bdc[_0xbb10('0x33')];if(_0x3e0e34[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x3ceb77[_0xbb10('0xb9')]=[{'all':!![]}];}_0x3ceb77=_[_0xbb10('0xba')]({},_0x3ceb77,_0x3e0e34[_0xbb10('0xbb')]);return db['MailInteraction'][_0xbb10('0x56')](_0x3ceb77)[_0xbb10('0x1e')](handleEntityNotFound(_0x3299bc,null))[_0xbb10('0x1e')](respondWithResult(_0x3299bc,null))[_0xbb10('0x2e')](handleError(_0x3299bc,null));};exports[_0xbb10('0xbc')]=function(_0xd9284e,_0x4258fc){return db[_0xbb10('0x31')][_0xbb10('0xbc')](_0xd9284e[_0xbb10('0xbd')],{})[_0xbb10('0x1e')](respondWithResult(_0x4258fc,0xc9))['catch'](handleError(_0x4258fc,null));};exports[_0xbb10('0x1c')]=function(_0x5e1ac5,_0x3faaca){if(_0x5e1ac5[_0xbb10('0xbd')]['id']){delete _0x5e1ac5[_0xbb10('0xbd')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5e1ac5[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3faaca,null))[_0xbb10('0x1e')](saveUpdates(_0x5e1ac5['body'],null))[_0xbb10('0x1e')](respondWithResult(_0x3faaca,null))[_0xbb10('0x2e')](handleError(_0x3faaca,null));};exports[_0xbb10('0x1d')]=function(_0x576bb6,_0x2b652c){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x576bb6[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2b652c,null))[_0xbb10('0x1e')](removeEntity(_0x2b652c,null))[_0xbb10('0x2e')](handleError(_0x2b652c,null));};exports[_0xbb10('0xbe')]=function(_0x589565,_0x3696b3){return db['MailInteraction'][_0xbb10('0xbe')]()[_0xbb10('0x1e')](respondWithResult(_0x3696b3,null))[_0xbb10('0x2e')](handleError(_0x3696b3,null));};exports[_0xbb10('0xbf')]=function(_0x44c229,_0x40271f){return db[_0xbb10('0x29')]['find']({'where':{'id':_0x44c229[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x40271f,null))['then'](function(_0x1513e0){if(_0x1513e0){return _0x1513e0[_0xbb10('0xbf')](_0x44c229[_0xbb10('0xbd')][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x44c229[_0xbb10('0xbd')],['ids','id'])||{});}})[_0xbb10('0x1e')](respondWithResult(_0x40271f,null))[_0xbb10('0x2e')](handleError(_0x40271f,null));};exports[_0xbb10('0xc2')]=function(_0xb1b7c8,_0x136520){var _0x28127c={'raw':![],'where':{}};var _0x528aff={};var _0xdfdc42={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0xb3')]({'where':{'id':_0xb1b7c8[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x136520,null))[_0xbb10('0x1e')](function(_0x2764e1){if(_0x2764e1){_0x528aff['model']=_[_0xbb10('0x35')](db['MailMessage'][_0xbb10('0xb7')]);_0x528aff['query']=_['keys'](_0xb1b7c8[_0xbb10('0x34')]);_0x528aff[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x528aff[_0xbb10('0x33')],_0x528aff[_0xbb10('0x34')]);_0x28127c['attributes']=_[_0xbb10('0x37')](_0x528aff['model'],qs['fields'](_0xb1b7c8['query'][_0xbb10('0x38')]));_0x28127c[_0xbb10('0x39')]=_0x28127c[_0xbb10('0x39')][_0xbb10('0x55')]?_0x28127c[_0xbb10('0x39')]:_0x528aff['model'];if(!_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3a')](_0xbb10('0xc3'))){_0x28127c[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x18')]);_0x28127c['offset']=qs['offset'](_0xb1b7c8['query'][_0xbb10('0x16')]);}_0x28127c[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x28127c[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_[_0xbb10('0xc4')](_0xb1b7c8[_0xbb10('0x34')],_0x528aff[_0xbb10('0x36')]));_0x28127c['where']['MailInteractionId']=_0x2764e1['id'];if(_0xb1b7c8['query'][_0xbb10('0x7c')]){_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c['where'],{'$or':_[_0xbb10('0x30')](_0x28127c[_0xbb10('0x39')],function(_0x2c638d){var _0x290280={};_0x290280[_0x2c638d]={'$like':'%'+_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x7c')]+'%'};return _0x290280;})});}if(_0xb1b7c8['query']['$gte']){var _0x356660=_0xb1b7c8['query'][_0xbb10('0xc5')][_0xbb10('0x26')](',');var _0x152ca9={};_0x152ca9[_0x356660[0x0]]={'$gte':moment(_0x356660[0x1])[_0xbb10('0xc6')](_0xbb10('0xc7'))};_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c[_0xbb10('0x3d')],_0x152ca9);}_0x28127c=_[_0xbb10('0xba')]({},_0x28127c,_0xb1b7c8[_0xbb10('0xbb')]);return db['MailMessage'][_0xbb10('0x19')]({'where':_0x28127c['where']})[_0xbb10('0x1e')](function(_0x5547fa){_0xdfdc42[_0xbb10('0x19')]=_0x5547fa;if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x28127c[_0xbb10('0xb9')]=[{'all':!![]}];}return db['MailMessage'][_0xbb10('0xc8')](_0x28127c);})['then'](function(_0xfe1154){if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xc9')]==='true'){for(var _0x298167=0x0;_0x298167<_0xfe1154[_0xbb10('0x55')];_0x298167++){_0xfe1154[_0x298167][_0xbb10('0xbd')]=juice(_0xfe1154[_0x298167][_0xbb10('0xbd')]);}}_0xdfdc42[_0xbb10('0xca')]=_0xfe1154;return _0xdfdc42;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x136520,_0x28127c))['catch'](handleError(_0x136520,null));};exports['addTags']=function(_0x522a88,_0x26a752){return db['MailInteraction'][_0xbb10('0x56')]({'where':{'id':_0x522a88['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x26a752,null))[_0xbb10('0x1e')](function(_0x385ad3){if(_0x385ad3){return _0x385ad3['setTags'](_0x522a88['body'][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x522a88[_0xbb10('0xbd')],['ids','id'])||{})[_0xbb10('0xcb')](function(){return db[_0xbb10('0x65')][_0xbb10('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x522a88['body'][_0xbb10('0xc0')]}});})['then'](function(_0x3dfbcd){socket[_0xbb10('0xcc')](_0xbb10('0xcd'),{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]});return{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]};});}})[_0xbb10('0x1e')](respondWithResult(_0x26a752,null))[_0xbb10('0x2e')](handleError(_0x26a752,null));};exports[_0xbb10('0xce')]=function(_0x2746eb,_0x431792){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x2746eb[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x431792,null))['then'](function(_0x14ef50){if(_0x14ef50){return _0x14ef50['removeTags'](_0x2746eb['query'][_0xbb10('0xc0')]);}})[_0xbb10('0x1e')](respondWithStatusCode(_0x431792,null))[_0xbb10('0x2e')](handleError(_0x431792,null));};exports[_0xbb10('0xcf')]=function(_0x99c4,_0x4ca4ce){var _0x161171=moment()[_0xbb10('0xd0')]()['toString']();var _0xa45726=path[_0xbb10('0xd1')](config['root'],_0xbb10('0xd2'),'files',_0xbb10('0xd3'));var _0x8e8049=path[_0xbb10('0xd1')](config[_0xbb10('0xd4')],_0xbb10('0xd2'),_0xbb10('0xd5'),_0xbb10('0xd6'));var _0x56f902=path[_0xbb10('0xd1')](_0xa45726,_0x161171);var _0x4720a1=util[_0xbb10('0xc6')](_0xbb10('0xd7'),_0x99c4[_0xbb10('0xb6')]['id'],_0x161171);var _0x1301e3=path['join'](_0xa45726,_0x4720a1);var _0x550301=[];if(_0x99c4['query'][_0xbb10('0xd6')]){_0x550301[_0xbb10('0x28')]({'model':db[_0xbb10('0xd8')],'as':_0xbb10('0xd9'),'raw':!![]});}var _0x57700b=[{'model':db[_0xbb10('0x29')],'as':_0xbb10('0xda'),'attributes':['id',_0xbb10('0xbd'),'from','to','cc','bcc',_0xbb10('0xdb'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb10('0x3c')]('id'),'include':_0x550301}];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x99c4[_0xbb10('0xb6')]['id']},'include':_0x57700b})[_0xbb10('0x1e')](handleEntityNotFound(_0x4ca4ce,null))[_0xbb10('0x1e')](function(_0x1fe250){if(_0x1fe250&&_0x1fe250['Messages']){var _0x424371=_0x1fe250[_0xbb10('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x56f902);return BPromise[_0xbb10('0xdd')](_0x424371[_0xbb10('0xda')],function(_0x32f261,_0x5b11a2){var _0x4b490a={'from':_0x32f261['from'],'to':_0x32f261['to'],'subject':_0x32f261[_0xbb10('0xdb')],'html':_0x32f261[_0xbb10('0xbd')],'headers':{'Date':moment(_0x32f261['createdAt'])[_0xbb10('0xc6')](_0xbb10('0xde'))},'attachments':[]};if(_0x32f261['cc']){_0x4b490a[_0xbb10('0xdf')]['Cc']=_0x32f261['cc'];}if(_0x32f261[_0xbb10('0xe0')]){_0x4b490a[_0xbb10('0xdf')][_0xbb10('0xe1')]=_0x32f261[_0xbb10('0xe0')];}return new BPromise(function(_0x48f0eb,_0x304603){if(_0x32f261['Attachments']){for(var _0x5a7c4e=0x0;_0x5a7c4e<_0x32f261['Attachments'][_0xbb10('0x55')];_0x5a7c4e++){var _0x572d73=_0x32f261['Attachments'][_0x5a7c4e];var _0x1f09f1=path['join'](_0x8e8049,_0x572d73[_0xbb10('0xe2')]);if(fs[_0xbb10('0xe3')](_0x1f09f1)){_0x4b490a[_0xbb10('0xd6')]['push']({'name':_0x572d73['name'],'contentType':_0x572d73[_0xbb10('0x63')],'data':fs['readFileSync'](_0x1f09f1)});}}}emlformat[_0xbb10('0xe4')](_0x4b490a,function(_0x211172,_0x589ecb){if(_0x211172)return _0x304603(_0x211172);fs['writeFileSync'](path[_0xbb10('0xd1')](_0x56f902,util[_0xbb10('0xc6')](_0xbb10('0xe5'),_0x5b11a2)),_0x589ecb);return _0x48f0eb(_0x589ecb);});});})['then'](function(){return new BPromise(function(_0x4f4aa8,_0x426a4f){zipdir(_0x56f902,{'saveTo':_0x1301e3},function(_0x22f153,_0x4d47cc){if(_0x22f153)return _0x426a4f(_0x22f153);return _0x4f4aa8(_0x4d47cc);});})[_0xbb10('0x1e')](function(){return new BPromise(function(_0x203e5a,_0xe88e90){rimraf(_0x56f902,function(_0x4845b5){if(_0x4845b5)_0xe88e90(_0x4845b5);return _0x203e5a();});});})[_0xbb10('0x1e')](function(){return _0x4ca4ce[_0xbb10('0xcf')](_0x1301e3,_0x4720a1,function(_0x166f4f){if(!_0x166f4f)fs[_0xbb10('0xe6')](_0x1301e3);});});});}else{return _0x4ca4ce[_0xbb10('0x12')](0xc8);}})[_0xbb10('0x2e')](handleError(_0x4ca4ce,null));}; \ No newline at end of file +var _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x16652e,_0x28a210){var _0x31d01e=function(_0x401ad8){while(--_0x401ad8){_0x16652e['push'](_0x16652e['shift']());}};_0x31d01e(++_0x28a210);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 7d26297..2fe0994 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 _0xdff0=['MailInteraction','MailMessage','setMaxListeners','update','remove','getUsers','setDataValue','Users','then','length','emit','hook','events','../../mysqldb'];(function(_0x185456,_0x1f4b1d){var _0x100dab=function(_0x42ec60){while(--_0x42ec60){_0x185456['push'](_0x185456['shift']());}};_0x100dab(++_0x1f4b1d);}(_0xdff0,0x1da));var _0x0dff=function(_0x4c7d7f,_0x1aa1de){_0x4c7d7f=_0x4c7d7f-0x0;var _0x3be225=_0xdff0[_0x4c7d7f];return _0x3be225;};'use strict';var EventEmitter=require(_0x0dff('0x0'));var MailInteraction=require(_0x0dff('0x1'))['db'][_0x0dff('0x2')];var MailMessage=require(_0x0dff('0x1'))['db'][_0x0dff('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x0dff('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0dff('0x5'),'afterDestroy':_0x0dff('0x6')};function emitEvent(_0x31217b){return function(_0x3ebf7b,_0x4a6d49,_0x40f6c6){_0x3ebf7b[_0x0dff('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x17be65){_0x3ebf7b[_0x0dff('0x8')](_0x0dff('0x9'),_0x17be65['map'](function(_0x26d7c7){return{'id':_0x26d7c7['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3ebf7b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0dff('0xa')](function(_0x15e522){_0x3ebf7b[_0x0dff('0x8')]('unreadMessages',_0x15e522[_0x0dff('0xb')]);MailInteractionEvents['emit'](_0x31217b+':'+_0x3ebf7b['id'],_0x3ebf7b);MailInteractionEvents[_0x0dff('0xc')](_0x31217b,_0x3ebf7b);_0x40f6c6(null);})['catch'](_0x40f6c6(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x0dff('0xd')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x13a3=['MailMessage','setMaxListeners','save','update','remove','Users','map','then','setDataValue','unreadMessages','length','emit','hook','exports','events','../../mysqldb','MailInteraction'];(function(_0x437fd2,_0x32f589){var _0x56de1b=function(_0x4b9cf9){while(--_0x4b9cf9){_0x437fd2['push'](_0x437fd2['shift']());}};_0x56de1b(++_0x32f589);}(_0x13a3,0x162));var _0x313a=function(_0x1d5d39,_0x5388c2){_0x1d5d39=_0x1d5d39-0x0;var _0x5ad1d0=_0x13a3[_0x1d5d39];return _0x5ad1d0;};'use strict';var EventEmitter=require(_0x313a('0x0'));var MailInteraction=require(_0x313a('0x1'))['db'][_0x313a('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x313a('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x313a('0x4')](0x0);var events={'afterCreate':_0x313a('0x5'),'afterUpdate':_0x313a('0x6'),'afterDestroy':_0x313a('0x7')};function emitEvent(_0x8310b1){return function(_0x3c3934,_0x13def8,_0x1eba8a){_0x3c3934['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x493152){_0x3c3934['setDataValue'](_0x313a('0x8'),_0x493152[_0x313a('0x9')](function(_0x24c434){return{'id':_0x24c434['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3c3934['id'],'direction':'in','read':![]},'raw':!![]});})[_0x313a('0xa')](function(_0x5874ed){_0x3c3934[_0x313a('0xb')](_0x313a('0xc'),_0x5874ed[_0x313a('0xd')]);MailInteractionEvents['emit'](_0x8310b1+':'+_0x3c3934['id'],_0x3c3934);MailInteractionEvents[_0x313a('0xe')](_0x8310b1,_0x3c3934);_0x1eba8a(null);})['catch'](_0x1eba8a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x313a('0xf')](e,emitEvent(event));}}module[_0x313a('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 41b8998..8e2b9ff 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 _0x1ef9=['./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','closed','format','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','closedAt','models','get','MailMessage','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2c4ab2,_0x54396e){var _0x1d7c45=function(_0x1b2959){while(--_0x1b2959){_0x2c4ab2['push'](_0x2c4ab2['shift']());}};_0x1d7c45(++_0x54396e);}(_0x1ef9,0x15f));var _0x91ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ef9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x91ef('0x0'));var util=require(_0x91ef('0x1'));var logger=require(_0x91ef('0x2'))(_0x91ef('0x3'));var moment=require(_0x91ef('0x4'));var BPromise=require(_0x91ef('0x5'));var rp=require(_0x91ef('0x6'));var fs=require('fs');var path=require(_0x91ef('0x7'));var rimraf=require(_0x91ef('0x8'));var config=require('../../config/environment');var attributes=require(_0x91ef('0x9'));module[_0x91ef('0xa')]=function(_0x140322,_0x34e450){return _0x140322[_0x91ef('0xb')](_0x91ef('0xc'),attributes,{'tableName':_0x91ef('0xd'),'paranoid':![],'indexes':[{'name':_0x91ef('0xe'),'fields':[_0x91ef('0xf'),'to'],'type':_0x91ef('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2c447a,_0x30b82d,_0xb3a69c){if(_0x2c447a['substatus']){_0x2c447a[_0x91ef('0x11')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2c447a[_0x91ef('0x12')]){_0x2c447a['closedAt']=moment()[_0x91ef('0x13')](_0x91ef('0x14'));}_0xb3a69c(null,_0x30b82d);},'beforeUpdate':function(_0x48b1a8,_0xb05294,_0x396521){if(_0x48b1a8[_0x91ef('0x15')](_0x91ef('0x16'))){_0x48b1a8[_0x91ef('0x11')]=_0x48b1a8['substatus']?moment()[_0x91ef('0x13')](_0x91ef('0x14')):null;}if(_0x48b1a8[_0x91ef('0x15')](_0x91ef('0x12'))){_0x48b1a8[_0x91ef('0x17')]=moment()[_0x91ef('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x48b1a8[_0x91ef('0x16')]=null;_0x48b1a8[_0x91ef('0x11')]=null;}_0x396521(null,_0x48b1a8);},'afterUpdate':function(_0x3add81,_0x18322f,_0x2f953e){var _0x53610f=_0x140322[_0x91ef('0x18')];var _0x137f9f=_0x3add81[_0x91ef('0x19')]({'plain':!![]});if(_0x137f9f[_0x91ef('0x12')]){return _0x53610f[_0x91ef('0x1a')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x137f9f['id']}})['then'](function(){_0x2f953e();})[_0x91ef('0x1b')](function(_0x16c5b1){_0x2f953e(_0x16c5b1);});}else{_0x2f953e();}}},'charset':_0x91ef('0x1c'),'collate':_0x91ef('0x1d')});}; \ No newline at end of file +var _0x84cb=['request-promise','path','exports','define','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','catch','utf8mb4','utf8mb4_unicode_ci','../../config/logger','bluebird'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0x84cb,0x18a));var _0xb84c=function(_0x5d0818,_0x188411){_0x5d0818=_0x5d0818-0x0;var _0x37fcdb=_0x84cb[_0x5d0818];return _0x37fcdb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb84c('0x0'))('api');var moment=require('moment');var BPromise=require(_0xb84c('0x1'));var rp=require(_0xb84c('0x2'));var fs=require('fs');var path=require(_0xb84c('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0xb84c('0x4')]=function(_0x2e011e,_0x1c8ef6){return _0x2e011e[_0xb84c('0x5')]('MailInteraction',attributes,{'tableName':_0xb84c('0x6'),'paranoid':![],'indexes':[{'name':_0xb84c('0x7'),'fields':['subject','to'],'type':_0xb84c('0x8')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x24cf3f,_0x460952,_0x20caba){if(_0x24cf3f[_0xb84c('0x9')]){_0x24cf3f[_0xb84c('0xa')]=moment()[_0xb84c('0xb')](_0xb84c('0xc'));}if(_0x24cf3f[_0xb84c('0xd')]){_0x24cf3f[_0xb84c('0xe')]=moment()[_0xb84c('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x20caba(null,_0x460952);},'beforeUpdate':function(_0x1784eb,_0x52a6fd,_0xd9b56e){if(_0x1784eb['changed'](_0xb84c('0x9'))){_0x1784eb[_0xb84c('0xa')]=_0x1784eb[_0xb84c('0x9')]?moment()['format'](_0xb84c('0xc')):null;}if(_0x1784eb[_0xb84c('0xf')](_0xb84c('0xd'))){_0x1784eb[_0xb84c('0xe')]=moment()[_0xb84c('0xb')](_0xb84c('0xc'));_0x1784eb[_0xb84c('0x9')]=null;_0x1784eb[_0xb84c('0xa')]=null;}_0xd9b56e(null,_0x1784eb);},'afterUpdate':function(_0x12aaf0,_0xf511c1,_0x14b670){var _0x9950d2=_0x2e011e[_0xb84c('0x10')];var _0x53d17b=_0x12aaf0[_0xb84c('0x11')]({'plain':!![]});if(_0x53d17b[_0xb84c('0xd')]){return _0x9950d2[_0xb84c('0x12')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x53d17b['id']}})['then'](function(){_0x14b670();})[_0xb84c('0x13')](function(_0x280fc1){_0x14b670(_0x280fc1);});}else{_0x14b670();}}},'charset':_0xb84c('0x14'),'collate':_0xb84c('0x15')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 96759de..2641dd8 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 _0xb7a7=['update','body','options','raw','attributes','limit','UpdateMailInteraction','MailInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x1e9bf5,_0x2b8466){var _0x3e43a0=function(_0x4f74dd){while(--_0x4f74dd){_0x1e9bf5['push'](_0x1e9bf5['shift']());}};_0x3e43a0(++_0x2b8466);}(_0xb7a7,0xaa));var _0x7b7a=function(_0xdcfd07,_0x39f0b2){_0xdcfd07=_0xdcfd07-0x0;var _0x3afe04=_0xb7a7[_0xdcfd07];return _0x3afe04;};'use strict';var _=require(_0x7b7a('0x0'));var util=require(_0x7b7a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b7a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b7a('0x3'));var logger=require(_0x7b7a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7b7a('0x5'));var client=jayson[_0x7b7a('0x6')]['http']({'port':0x232a});config[_0x7b7a('0x7')]=_[_0x7b7a('0x8')](config[_0x7b7a('0x7')],{'host':_0x7b7a('0x9'),'port':0x18eb});var socket=require(_0x7b7a('0xa'))(new Redis(config[_0x7b7a('0x7')]));require(_0x7b7a('0xb'))[_0x7b7a('0xc')](socket);function respondWithRpcPromise(_0x4e9655,_0x62b742,_0x2a061e){return new BPromise(function(_0x2f26fd,_0x4f5852){return client[_0x7b7a('0xd')](_0x4e9655,_0x2a061e)[_0x7b7a('0xe')](function(_0x36daf){logger[_0x7b7a('0xf')](_0x7b7a('0x10'),_0x62b742,_0x7b7a('0x11'));logger[_0x7b7a('0x12')](_0x7b7a('0x13'),_0x62b742,'request\x20sent',JSON[_0x7b7a('0x14')](_0x36daf));if(_0x36daf['error']){if(_0x36daf[_0x7b7a('0x15')]['code']===0x1f4){logger[_0x7b7a('0x15')](_0x7b7a('0x10'),_0x62b742,_0x36daf[_0x7b7a('0x15')][_0x7b7a('0x16')]);return _0x4f5852(_0x36daf[_0x7b7a('0x15')][_0x7b7a('0x16')]);}logger[_0x7b7a('0x15')]('MailInteraction,\x20%s,\x20%s',_0x62b742,_0x36daf[_0x7b7a('0x15')][_0x7b7a('0x16')]);return _0x2f26fd(_0x36daf[_0x7b7a('0x15')][_0x7b7a('0x16')]);}else{logger[_0x7b7a('0xf')](_0x7b7a('0x10'),_0x62b742,_0x7b7a('0x11'));_0x2f26fd(_0x36daf[_0x7b7a('0x17')][_0x7b7a('0x16')]);}})[_0x7b7a('0x18')](function(_0x31f030){logger['error'](_0x7b7a('0x10'),_0x62b742,_0x31f030);_0x4f5852(_0x31f030);});});}exports['UpdateMailInteraction']=function(_0x47c950){var _0x438477=this;return new Promise(function(_0x1b7884,_0x2b4164){return db['MailInteraction'][_0x7b7a('0x19')](_0x47c950[_0x7b7a('0x1a')],{'raw':_0x47c950['options']?_0x47c950[_0x7b7a('0x1b')][_0x7b7a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47c950['options']?_0x47c950['options']['where']||null:null,'attributes':_0x47c950[_0x7b7a('0x1b')]?_0x47c950['options'][_0x7b7a('0x1d')]||null:null,'limit':_0x47c950[_0x7b7a('0x1b')]?_0x47c950[_0x7b7a('0x1b')][_0x7b7a('0x1e')]||null:null})[_0x7b7a('0xe')](function(_0x56cb6e){logger[_0x7b7a('0xf')]('UpdateMailInteraction',_0x47c950);logger[_0x7b7a('0x12')](_0x7b7a('0x1f'),_0x47c950,JSON[_0x7b7a('0x14')](_0x56cb6e));_0x1b7884(_0x56cb6e);})[_0x7b7a('0x18')](function(_0x2175ed){logger['error'](_0x7b7a('0x1f'),_0x2175ed[_0x7b7a('0x16')],_0x47c950);_0x2b4164(_0x438477[_0x7b7a('0x15')](0x1f4,_0x2175ed['message']));});});};exports['AddTagsToMailInteraction']=function(_0x349291){return new Promise(function(_0x1ee51d,_0x1c27df){return db[_0x7b7a('0x20')][_0x7b7a('0x21')]({'where':_0x349291[_0x7b7a('0x1b')]?_0x349291['options']['where']||null:null})[_0x7b7a('0xe')](function(_0x59d5be){if(_0x59d5be){return _0x59d5be[_0x7b7a('0x22')](_0x349291[_0x7b7a('0x1a')]['ids'],_[_0x7b7a('0x23')](_0x349291[_0x7b7a('0x1a')],[_0x7b7a('0x24'),'id'])||{});}})[_0x7b7a('0x25')](function(_0x1ec1f1){logger[_0x7b7a('0xf')](_0x7b7a('0x26'),_0x349291);logger[_0x7b7a('0x12')](_0x7b7a('0x26'),_0x349291,JSON['stringify'](_0x1ec1f1));_0x1ee51d(_0x1ec1f1);})[_0x7b7a('0x18')](function(_0x39a69c){logger[_0x7b7a('0x15')](_0x7b7a('0x26'),_0x39a69c[_0x7b7a('0x16')],_0x349291);_0x1c27df(_this[_0x7b7a('0x15')](0x1f4,_0x39a69c[_0x7b7a('0x16')]));});});}; \ No newline at end of file +var _0x9d35=['result','UpdateMailInteraction','update','options','raw','where','attributes','limit','then','catch','AddTagsToMailInteraction','MailInteraction','find','addTags','body','ids','omit','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5acdd8,_0x5967ef){var _0x159510=function(_0x2fbf37){while(--_0x2fbf37){_0x5acdd8['push'](_0x5acdd8['shift']());}};_0x159510(++_0x5967ef);}(_0x9d35,0x174));var _0x59d3=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x9d35[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x59d3('0x0'));var util=require(_0x59d3('0x1'));var moment=require(_0x59d3('0x2'));var BPromise=require(_0x59d3('0x3'));var rs=require(_0x59d3('0x4'));var fs=require('fs');var Redis=require(_0x59d3('0x5'));var db=require(_0x59d3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x59d3('0x7'))(_0x59d3('0x8'));var config=require(_0x59d3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x59d3('0xa')]['http']({'port':0x232a});config[_0x59d3('0xb')]=_[_0x59d3('0xc')](config[_0x59d3('0xb')],{'host':_0x59d3('0xd'),'port':0x18eb});var socket=require(_0x59d3('0xe'))(new Redis(config[_0x59d3('0xb')]));require('./mailInteraction.socket')[_0x59d3('0xf')](socket);function respondWithRpcPromise(_0x473a07,_0x1ced67,_0x5d3bed){return new BPromise(function(_0xa51251,_0x544dba){return client['request'](_0x473a07,_0x5d3bed)['then'](function(_0x367ff7){logger[_0x59d3('0x10')](_0x59d3('0x11'),_0x1ced67,_0x59d3('0x12'));logger['debug'](_0x59d3('0x13'),_0x1ced67,'request\x20sent',JSON[_0x59d3('0x14')](_0x367ff7));if(_0x367ff7[_0x59d3('0x15')]){if(_0x367ff7[_0x59d3('0x15')][_0x59d3('0x16')]===0x1f4){logger[_0x59d3('0x15')](_0x59d3('0x11'),_0x1ced67,_0x367ff7[_0x59d3('0x15')][_0x59d3('0x17')]);return _0x544dba(_0x367ff7[_0x59d3('0x15')][_0x59d3('0x17')]);}logger[_0x59d3('0x15')](_0x59d3('0x11'),_0x1ced67,_0x367ff7['error'][_0x59d3('0x17')]);return _0xa51251(_0x367ff7[_0x59d3('0x15')][_0x59d3('0x17')]);}else{logger[_0x59d3('0x10')](_0x59d3('0x11'),_0x1ced67,_0x59d3('0x12'));_0xa51251(_0x367ff7[_0x59d3('0x18')]['message']);}})['catch'](function(_0x39fc89){logger[_0x59d3('0x15')](_0x59d3('0x11'),_0x1ced67,_0x39fc89);_0x544dba(_0x39fc89);});});}exports[_0x59d3('0x19')]=function(_0x3035f1){var _0xd4798e=this;return new Promise(function(_0x3d877b,_0x4cdfec){return db['MailInteraction'][_0x59d3('0x1a')](_0x3035f1['body'],{'raw':_0x3035f1[_0x59d3('0x1b')]?_0x3035f1[_0x59d3('0x1b')][_0x59d3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3035f1[_0x59d3('0x1b')]?_0x3035f1['options'][_0x59d3('0x1d')]||null:null,'attributes':_0x3035f1[_0x59d3('0x1b')]?_0x3035f1[_0x59d3('0x1b')][_0x59d3('0x1e')]||null:null,'limit':_0x3035f1['options']?_0x3035f1[_0x59d3('0x1b')][_0x59d3('0x1f')]||null:null})[_0x59d3('0x20')](function(_0xed7842){logger[_0x59d3('0x10')](_0x59d3('0x19'),_0x3035f1);logger['debug']('UpdateMailInteraction',_0x3035f1,JSON[_0x59d3('0x14')](_0xed7842));_0x3d877b(_0xed7842);})[_0x59d3('0x21')](function(_0x5ab4bf){logger[_0x59d3('0x15')](_0x59d3('0x19'),_0x5ab4bf[_0x59d3('0x17')],_0x3035f1);_0x4cdfec(_0xd4798e[_0x59d3('0x15')](0x1f4,_0x5ab4bf[_0x59d3('0x17')]));});});};exports[_0x59d3('0x22')]=function(_0x3d7e10){return new Promise(function(_0x2dce38,_0x378643){return db[_0x59d3('0x23')][_0x59d3('0x24')]({'where':_0x3d7e10[_0x59d3('0x1b')]?_0x3d7e10[_0x59d3('0x1b')][_0x59d3('0x1d')]||null:null})[_0x59d3('0x20')](function(_0x2aa888){if(_0x2aa888){return _0x2aa888[_0x59d3('0x25')](_0x3d7e10[_0x59d3('0x26')][_0x59d3('0x27')],_[_0x59d3('0x28')](_0x3d7e10[_0x59d3('0x26')],[_0x59d3('0x27'),'id'])||{});}})[_0x59d3('0x29')](function(_0x3f4620){logger[_0x59d3('0x10')](_0x59d3('0x2a'),_0x3d7e10);logger[_0x59d3('0x2b')](_0x59d3('0x2a'),_0x3d7e10,JSON[_0x59d3('0x14')](_0x3f4620));_0x2dce38(_0x3f4620);})[_0x59d3('0x21')](function(_0x573c66){logger[_0x59d3('0x15')]('AddTags',_0x573c66['message'],_0x3d7e10);_0x378643(_this['error'](0x1f4,_0x573c66['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 0f328af..1d5dcac 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 _0x4bb2=['emit','removeListener','register','length','./mailInteraction.events','save','update'];(function(_0x420244,_0x769d14){var _0x5327f5=function(_0x12ba1e){while(--_0x12ba1e){_0x420244['push'](_0x420244['shift']());}};_0x5327f5(++_0x769d14);}(_0x4bb2,0x90));var _0x24bb=function(_0x279129,_0x6e74d6){_0x279129=_0x279129-0x0;var _0xb9fed3=_0x4bb2[_0x279129];return _0xb9fed3;};'use strict';var MailInteractionEvents=require(_0x24bb('0x0'));var events=[_0x24bb('0x1'),'remove',_0x24bb('0x2')];function createListener(_0x5d9aba,_0x2ef258){return function(_0x4d3edb){_0x2ef258[_0x24bb('0x3')](_0x5d9aba,_0x4d3edb);};}function removeListener(_0x2ba628,_0x3af10c){return function(){MailInteractionEvents[_0x24bb('0x4')](_0x2ba628,_0x3af10c);};}exports[_0x24bb('0x5')]=function(_0x3a9b06){for(var _0xc92eae=0x0,_0xfcc311=events[_0x24bb('0x6')];_0xc92eae<_0xfcc311;_0xc92eae++){var _0x39fa67=events[_0xc92eae];var _0x1ff81a=createListener('mailInteraction:'+_0x39fa67,_0x3a9b06);MailInteractionEvents['on'](_0x39fa67,_0x1ff81a);}}; \ No newline at end of file +var _0x8fa9=['register','save','remove','emit','removeListener'];(function(_0x47a188,_0x478e68){var _0x36c294=function(_0x306920){while(--_0x306920){_0x47a188['push'](_0x47a188['shift']());}};_0x36c294(++_0x478e68);}(_0x8fa9,0x119));var _0x98fa=function(_0x1d09ae,_0x499e6f){_0x1d09ae=_0x1d09ae-0x0;var _0x22f895=_0x8fa9[_0x1d09ae];return _0x22f895;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x98fa('0x0'),_0x98fa('0x1'),'update'];function createListener(_0x4a90df,_0x54c8ac){return function(_0x5117aa){_0x54c8ac[_0x98fa('0x2')](_0x4a90df,_0x5117aa);};}function removeListener(_0x445730,_0x554f9b){return function(){MailInteractionEvents[_0x98fa('0x3')](_0x445730,_0x554f9b);};}exports[_0x98fa('0x4')]=function(_0x4ebebc){for(var _0x2a2d5e=0x0,_0x2f2d78=events['length'];_0x2a2d5e<_0x2f2d78;_0x2a2d5e++){var _0x4dab3b=events[_0x2a2d5e];var _0x46b99c=createListener('mailInteraction:'+_0x4dab3b,_0x4ebebc);MailInteractionEvents['on'](_0x4dab3b,_0x46b99c);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 45f87a8..1861822 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 _0x4746=['/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','download','mail','create','put'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x4746,0xc6));var _0x6474=function(_0x5a2167,_0x53cab9){_0x5a2167=_0x5a2167-0x0;var _0xb36ae1=_0x4746[_0x5a2167];return _0xb36ae1;};'use strict';var multer=require(_0x6474('0x0'));var util=require(_0x6474('0x1'));var path=require('path');var timeout=require(_0x6474('0x2'));var express=require('express');var router=express[_0x6474('0x3')]();var fs_extra=require(_0x6474('0x4'));var auth=require(_0x6474('0x5'));var interaction=require(_0x6474('0x6'));var config=require(_0x6474('0x7'));var controller=require('./mailMessage.controller');router[_0x6474('0x8')]('/',auth[_0x6474('0x9')](),controller['index']);router[_0x6474('0x8')](_0x6474('0xa'),auth[_0x6474('0x9')](),controller[_0x6474('0xb')]);router[_0x6474('0x8')](_0x6474('0xc'),auth['isAuthenticated'](),controller[_0x6474('0xd')]);router['get']('/:id/download',auth[_0x6474('0x9')](),controller[_0x6474('0xe')]);router['post']('/',auth[_0x6474('0x9')](),interaction['tracked'](_0x6474('0xf'),'mailmessage:create'),controller[_0x6474('0x10')]);router[_0x6474('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6474('0x11')](_0x6474('0x12'),auth[_0x6474('0x9')](),controller[_0x6474('0x13')]);router[_0x6474('0x11')](_0x6474('0x14'),auth[_0x6474('0x9')](),controller[_0x6474('0x15')]);router[_0x6474('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6474('0x17')]=router; \ No newline at end of file +var _0x60d7=['/:id','/:id/download','post','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe'];(function(_0x4417ef,_0x128047){var _0x4e0166=function(_0x43c091){while(--_0x43c091){_0x4417ef['push'](_0x4417ef['shift']());}};_0x4e0166(++_0x128047);}(_0x60d7,0x139));var _0x760d=function(_0x53a764,_0x50412a){_0x53a764=_0x53a764-0x0;var _0x2bbac0=_0x60d7[_0x53a764];return _0x2bbac0;};'use strict';var multer=require(_0x760d('0x0'));var util=require(_0x760d('0x1'));var path=require('path');var timeout=require(_0x760d('0x2'));var express=require('express');var router=express[_0x760d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x760d('0x4'));var interaction=require(_0x760d('0x5'));var config=require(_0x760d('0x6'));var controller=require(_0x760d('0x7'));router['get']('/',auth[_0x760d('0x8')](),controller[_0x760d('0x9')]);router[_0x760d('0xa')](_0x760d('0xb'),auth[_0x760d('0x8')](),controller['describe']);router[_0x760d('0xa')](_0x760d('0xc'),auth[_0x760d('0x8')](),controller['show']);router[_0x760d('0xa')](_0x760d('0xd'),auth[_0x760d('0x8')](),controller['download']);router[_0x760d('0xe')]('/',auth[_0x760d('0x8')](),interaction['tracked'](_0x760d('0xf'),_0x760d('0x10')),controller[_0x760d('0x11')]);router[_0x760d('0x12')](_0x760d('0xc'),auth[_0x760d('0x8')](),controller[_0x760d('0x13')]);router[_0x760d('0x12')](_0x760d('0x14'),auth[_0x760d('0x8')](),controller[_0x760d('0x15')]);router['put'](_0x760d('0x16'),auth['isAuthenticated'](),controller[_0x760d('0x17')]);router[_0x760d('0x18')](_0x760d('0xc'),auth[_0x760d('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index c0b21ab..6b00f5e 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 _0x7a71=['DATE','Email','Chat','sequelize','lodash','exports','long','TEXT','ENUM','STRING'];(function(_0x471ec3,_0x178679){var _0xa0ae14=function(_0x54e5a6){while(--_0x54e5a6){_0x471ec3['push'](_0x471ec3['shift']());}};_0xa0ae14(++_0x178679);}(_0x7a71,0xad));var _0x17a7=function(_0x56c93a,_0x2c7b32){_0x56c93a=_0x56c93a-0x0;var _0x44d8f0=_0x7a71[_0x56c93a];return _0x44d8f0;};'use strict';var Sequelize=require(_0x17a7('0x0'));var _=require(_0x17a7('0x1'));module[_0x17a7('0x2')]={'body':{'type':Sequelize['TEXT'](_0x17a7('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x17a7('0x4')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x17a7('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x17a7('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x17a7('0x3'))},'cc':{'type':Sequelize[_0x17a7('0x4')](_0x17a7('0x3'))},'bcc':{'type':Sequelize[_0x17a7('0x4')](_0x17a7('0x3'))},'subject':{'type':Sequelize[_0x17a7('0x4')]},'sentAt':{'type':Sequelize[_0x17a7('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x17a7('0x7')]},'originTo':{'type':Sequelize[_0x17a7('0x4')](_0x17a7('0x3'))},'originCc':{'type':Sequelize[_0x17a7('0x4')](_0x17a7('0x3'))},'originChannel':{'type':Sequelize[_0x17a7('0x5')](_0x17a7('0x8'),_0x17a7('0x9')),'defaultValue':_0x17a7('0x8'),'allowNull':![]}}; \ No newline at end of file +var _0xcc56=['STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long','BOOLEAN','ENUM','out'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xcc56,0x1a5));var _0x6cc5=function(_0x1e35bd,_0x40ee90){_0x1e35bd=_0x1e35bd-0x0;var _0x2c379d=_0xcc56[_0x1e35bd];return _0x2c379d;};'use strict';var Sequelize=require(_0x6cc5('0x0'));var _=require(_0x6cc5('0x1'));module[_0x6cc5('0x2')]={'body':{'type':Sequelize[_0x6cc5('0x3')](_0x6cc5('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x6cc5('0x3')]('medium')},'read':{'type':Sequelize[_0x6cc5('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6cc5('0x6')]('in',_0x6cc5('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x6cc5('0x8')]},'to':{'type':Sequelize[_0x6cc5('0x3')](_0x6cc5('0x4'))},'cc':{'type':Sequelize['TEXT'](_0x6cc5('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0x6cc5('0x4'))},'subject':{'type':Sequelize[_0x6cc5('0x3')]},'sentAt':{'type':Sequelize[_0x6cc5('0x9')]},'attach':{'type':Sequelize[_0x6cc5('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x6cc5('0x3')](_0x6cc5('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0x6cc5('0x4'))},'originChannel':{'type':Sequelize[_0x6cc5('0x6')](_0x6cc5('0xb'),_0x6cc5('0xc')),'defaultValue':_0x6cc5('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 9a796d4..bd28c03 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 _0xb14b=['MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','auth','user','pass','attachments','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','stringify','accept','mail','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE: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','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','format','channel','motionChannel','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','interface','event','fromString','rejectmessage','unix','toString','join','root','files','tmp','message-%s.eml','from','bcc','subject','Attachments','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','fieldName','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','filter','options','rows','show','params','include','find','body','describe','create','direction','secret'];(function(_0x34c682,_0x298df8){var _0x25ea93=function(_0x30ae5b){while(--_0x30ae5b){_0x34c682['push'](_0x34c682['shift']());}};_0x25ea93(++_0x298df8);}(_0xb14b,0xff));var _0xbb14=function(_0x4007bf,_0x16b623){_0x4007bf=_0x4007bf-0x0;var _0x5c9b51=_0xb14b[_0x4007bf];return _0x5c9b51;};'use strict';var emlformat=require(_0xbb14('0x0'));var moment=require(_0xbb14('0x1'));var BPromise=require(_0xbb14('0x2'));var util=require(_0xbb14('0x3'));var path=require(_0xbb14('0x4'));var fs=require('fs');var _=require(_0xbb14('0x5'));var Redis=require(_0xbb14('0x6'));var htmlToText=require(_0xbb14('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xbb14('0x8'))(_0xbb14('0x9'));var interaction_log=require(_0xbb14('0x8'))('mail-interactions');var config=require(_0xbb14('0xa'));var db=require(_0xbb14('0xb'))['db'];config[_0xbb14('0xc')]=_[_0xbb14('0xd')](config['redis'],{'host':_0xbb14('0xe'),'port':0x18eb});var socket=require(_0xbb14('0xf'))(new Redis(config[_0xbb14('0xc')]));require(_0xbb14('0x10'))['register'](socket);var jayson=require(_0xbb14('0x11'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0xbb14('0x12')][_0xbb14('0x13')]({'port':0x232b});var client9002=jayson['client'][_0xbb14('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x3f0408,_0x48f613,_0x1eacd9,_0x5c9a6b){return new BPromise(function(_0x2ca164,_0x12fb6d){var _0x4f2d5f=_0x5c9a6b||client;return _0x4f2d5f[_0xbb14('0x14')](_0x3f0408,_0x1eacd9)[_0xbb14('0x15')](function(_0x2adf8a){logger['info'](_0xbb14('0x16'),_0x48f613,'request\x20sent');logger['debug'](_0xbb14('0x17'),_0x48f613,_0xbb14('0x18'),JSON['stringify'](_0x2adf8a));if(_0x2adf8a['error']){if(_0x2adf8a[_0xbb14('0x19')]['code']===0x1f4){logger[_0xbb14('0x19')](_0xbb14('0x16'),_0x48f613,_0x2adf8a['error']['message']);return _0x12fb6d(_0x2adf8a[_0xbb14('0x19')][_0xbb14('0x1a')]);}logger[_0xbb14('0x19')](_0xbb14('0x16'),_0x48f613,_0x2adf8a['error'][_0xbb14('0x1a')]);return _0x2ca164(_0x2adf8a[_0xbb14('0x19')][_0xbb14('0x1a')]);}else{logger[_0xbb14('0x1b')](_0xbb14('0x16'),_0x48f613,_0xbb14('0x18'));_0x2ca164(_0x2adf8a[_0xbb14('0x1c')][_0xbb14('0x1a')]);}})[_0xbb14('0x1d')](function(_0x37fa76){logger['error'](_0xbb14('0x16'),_0x48f613,_0x37fa76);_0x12fb6d(_0x37fa76);});});}function respondWithResult(_0x5f178d,_0x8935e5){_0x8935e5=_0x8935e5||0xc8;return function(_0x1ef33d){if(_0x1ef33d){return _0x5f178d[_0xbb14('0x1e')](_0x8935e5)[_0xbb14('0x1f')](_0x1ef33d);}};}function respondWithFilteredResult(_0x27858d,_0x7224d6){return function(_0x61bfaf){if(_0x61bfaf){var _0x2ebf26=typeof _0x7224d6[_0xbb14('0x20')]==='undefined'&&typeof _0x7224d6[_0xbb14('0x21')]===_0xbb14('0x22');var _0x1b8ff8=_0x61bfaf[_0xbb14('0x23')];var _0x210764=_0x2ebf26?0x0:_0x7224d6['offset'];var _0x122fb8=_0x2ebf26?_0x61bfaf['count']:_0x7224d6[_0xbb14('0x20')]+_0x7224d6[_0xbb14('0x21')];var _0x572334;if(_0x122fb8>=_0x1b8ff8){_0x122fb8=_0x1b8ff8;_0x572334=0xc8;}else{_0x572334=0xce;}_0x27858d[_0xbb14('0x1e')](_0x572334);return _0x27858d[_0xbb14('0x24')](_0xbb14('0x25'),_0x210764+'-'+_0x122fb8+'/'+_0x1b8ff8)['json'](_0x61bfaf);}return null;};}function saveUpdates(_0x2d1352){return function(_0x9838c5){if(_0x9838c5){return _0x9838c5[_0xbb14('0x26')](_0x2d1352)[_0xbb14('0x15')](function(_0x12a9ec){return _0x12a9ec;});}return null;};}function removeEntity(_0x806c97){return function(_0x537ab4){if(_0x537ab4){return _0x537ab4[_0xbb14('0x27')]()[_0xbb14('0x15')](function(){_0x806c97['status'](0xcc)[_0xbb14('0x28')]();});}};}function handleEntityNotFound(_0x50a898){return function(_0xc79c34){if(!_0xc79c34){_0x50a898[_0xbb14('0x29')](0x194);}return _0xc79c34;};}function handleError(_0x21233d,_0x2e82da){_0x2e82da=_0x2e82da||0x1f4;return function(_0x52b06c){logger[_0xbb14('0x19')](_0x52b06c[_0xbb14('0x2a')]);if(_0x52b06c[_0xbb14('0x2b')]){delete _0x52b06c[_0xbb14('0x2b')];}_0x21233d[_0xbb14('0x1e')](_0x2e82da)[_0xbb14('0x2c')](_0x52b06c);};}exports[_0xbb14('0x2d')]=function(_0x4e322c,_0x3d0359){var _0x5da1a8={},_0x5c100a={},_0xbcb72b={'count':0x0,'rows':[]};var _0x58e87e=_['map'](db[_0xbb14('0x2e')][_0xbb14('0x2f')],function(_0x14a5d8){return{'name':_0x14a5d8[_0xbb14('0x30')],'type':_0x14a5d8['type'][_0xbb14('0x31')]};});_0x5c100a['model']=_[_0xbb14('0x32')](_0x58e87e,_0xbb14('0x2b'));_0x5c100a['query']=_['keys'](_0x4e322c[_0xbb14('0x33')]);_0x5c100a['filters']=_[_0xbb14('0x34')](_0x5c100a[_0xbb14('0x35')],_0x5c100a[_0xbb14('0x33')]);_0x5da1a8['attributes']=_[_0xbb14('0x34')](_0x5c100a[_0xbb14('0x35')],qs['fields'](_0x4e322c[_0xbb14('0x33')][_0xbb14('0x36')]));_0x5da1a8[_0xbb14('0x37')]=_0x5da1a8[_0xbb14('0x37')][_0xbb14('0x38')]?_0x5da1a8[_0xbb14('0x37')]:_0x5c100a[_0xbb14('0x35')];if(!_0x4e322c['query'][_0xbb14('0x39')](_0xbb14('0x3a'))){_0x5da1a8[_0xbb14('0x21')]=qs[_0xbb14('0x21')](_0x4e322c[_0xbb14('0x33')][_0xbb14('0x21')]);_0x5da1a8['offset']=qs[_0xbb14('0x20')](_0x4e322c[_0xbb14('0x33')][_0xbb14('0x20')]);}_0x5da1a8[_0xbb14('0x3b')]=qs[_0xbb14('0x3c')](_0x4e322c['query']['sort']);_0x5da1a8[_0xbb14('0x3d')]=qs['filters'](_['pick'](_0x4e322c[_0xbb14('0x33')],_0x5c100a[_0xbb14('0x3e')]),_0x58e87e);if(_0x4e322c[_0xbb14('0x33')]['filter']){_0x5da1a8[_0xbb14('0x3d')]=_[_0xbb14('0x3f')](_0x5da1a8[_0xbb14('0x3d')],{'$or':_[_0xbb14('0x32')](_0x58e87e,function(_0x5e15e4){if(_0x5e15e4[_0xbb14('0x40')]!=='VIRTUAL'){var _0xf41ef={};_0xf41ef[_0x5e15e4[_0xbb14('0x2b')]]={'$like':'%'+_0x4e322c[_0xbb14('0x33')][_0xbb14('0x41')]+'%'};return _0xf41ef;}})});}_0x5da1a8=_['merge']({},_0x5da1a8,_0x4e322c[_0xbb14('0x42')]);var _0x5b4f21={'where':_0x5da1a8['where']};return db['MailMessage']['count'](_0x5b4f21)['then'](function(_0x2e6ed4){_0xbcb72b[_0xbb14('0x23')]=_0x2e6ed4;if(_0x4e322c['query']['includeAll']){_0x5da1a8['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x5da1a8);})[_0xbb14('0x15')](function(_0x5662b5){_0xbcb72b[_0xbb14('0x43')]=_0x5662b5;return _0xbcb72b;})[_0xbb14('0x15')](respondWithFilteredResult(_0x3d0359,_0x5da1a8))[_0xbb14('0x1d')](handleError(_0x3d0359,null));};exports[_0xbb14('0x44')]=function(_0x4251bd,_0x524662){var _0x5b4ad9={'raw':!![],'where':{'id':_0x4251bd[_0xbb14('0x45')]['id']}},_0x195ea0={};_0x195ea0[_0xbb14('0x35')]=_['keys'](db[_0xbb14('0x2e')][_0xbb14('0x2f')]);_0x195ea0[_0xbb14('0x33')]=_['keys'](_0x4251bd[_0xbb14('0x33')]);_0x195ea0[_0xbb14('0x3e')]=_['intersection'](_0x195ea0[_0xbb14('0x35')],_0x195ea0[_0xbb14('0x33')]);_0x5b4ad9[_0xbb14('0x37')]=_[_0xbb14('0x34')](_0x195ea0[_0xbb14('0x35')],qs[_0xbb14('0x36')](_0x4251bd['query']['fields']));_0x5b4ad9[_0xbb14('0x37')]=_0x5b4ad9[_0xbb14('0x37')]['length']?_0x5b4ad9[_0xbb14('0x37')]:_0x195ea0[_0xbb14('0x35')];if(_0x4251bd[_0xbb14('0x33')]['includeAll']){_0x5b4ad9[_0xbb14('0x46')]=[{'all':!![]}];}_0x5b4ad9=_['merge']({},_0x5b4ad9,_0x4251bd['options']);return db[_0xbb14('0x2e')][_0xbb14('0x47')](_0x5b4ad9)['then'](handleEntityNotFound(_0x524662,null))[_0xbb14('0x15')](respondWithResult(_0x524662,null))['catch'](handleError(_0x524662,null));};exports['update']=function(_0x508454,_0x45d43b){if(_0x508454[_0xbb14('0x48')]['id']){delete _0x508454[_0xbb14('0x48')]['id'];}return db[_0xbb14('0x2e')][_0xbb14('0x47')]({'where':{'id':_0x508454[_0xbb14('0x45')]['id']}})['then'](handleEntityNotFound(_0x45d43b,null))[_0xbb14('0x15')](saveUpdates(_0x508454[_0xbb14('0x48')],null))[_0xbb14('0x15')](respondWithResult(_0x45d43b,null))['catch'](handleError(_0x45d43b,null));};exports[_0xbb14('0x27')]=function(_0x1f36a9,_0x237435){return db['MailMessage']['find']({'where':{'id':_0x1f36a9[_0xbb14('0x45')]['id']}})[_0xbb14('0x15')](handleEntityNotFound(_0x237435,null))[_0xbb14('0x15')](removeEntity(_0x237435,null))[_0xbb14('0x1d')](handleError(_0x237435,null));};exports['describe']=function(_0x5e997d,_0x3f3652){return db[_0xbb14('0x2e')][_0xbb14('0x49')]()[_0xbb14('0x15')](respondWithResult(_0x3f3652,null))[_0xbb14('0x1d')](handleError(_0x3f3652,null));};exports[_0xbb14('0x4a')]=function(_0x3956da,_0x2228a2){return db[_0xbb14('0x2e')][_0xbb14('0x4a')](_0x3956da['body'])[_0xbb14('0x15')](function(_0x4720a6){if(_0x4720a6){if(_0x4720a6[_0xbb14('0x4b')]==='out'&&!_0x4720a6[_0xbb14('0x4c')]){var _0x2eadae,_0x454fbe,_0x4518f4;if(_0x3956da['body']['to']){_0x454fbe=_0x3956da[_0xbb14('0x48')]['to']['split'](',')[0x0];}return db[_0xbb14('0x4d')][_0xbb14('0x4e')]({'where':{'id':_0x4720a6[_0xbb14('0x4f')]},'include':[{'model':db[_0xbb14('0x50')],'as':_0xbb14('0x51'),'include':[{'model':db[_0xbb14('0x52')],'as':_0xbb14('0x53'),'where':{'email':_0x454fbe},'limit':0x1,'order':[[_0xbb14('0x54'),_0xbb14('0x55')]]}]},{'model':db[_0xbb14('0x56')],'as':_0xbb14('0x57'),'raw':!![]}]})['then'](function(_0x4494ad){_0x2eadae=_0x4494ad;if(_0x2eadae&&_0x2eadae[_0xbb14('0x57')]){var _0x237375={'tls':{'rejectUnauthorized':![]}};if(_[_0xbb14('0x58')](_0x2eadae['Smtp'][_0xbb14('0x59')])){_0x237375['host']=_0x2eadae[_0xbb14('0x57')][_0xbb14('0x5a')];_0x237375[_0xbb14('0x5b')]=_0x2eadae['Smtp']['port'];_0x237375['secure']=_0x2eadae[_0xbb14('0x57')][_0xbb14('0x5c')];if(_0x2eadae[_0xbb14('0x57')]['authentication']){_0x237375[_0xbb14('0x5d')]={'user':_0x2eadae[_0xbb14('0x57')][_0xbb14('0x5e')],'pass':_0x2eadae[_0xbb14('0x57')][_0xbb14('0x5f')]};}}else{_0x237375['service']=_0x2eadae[_0xbb14('0x57')]['service'];_0x237375[_0xbb14('0x5d')]={'user':_0x2eadae[_0xbb14('0x57')][_0xbb14('0x5e')],'pass':_0x2eadae['Smtp'][_0xbb14('0x5f')]};_0x237375['secure']=_0x2eadae[_0xbb14('0x57')]['secure'];}if(_0x3956da['body'][_0xbb14('0x60')]&&_0x3956da['body']['attachments'][_0xbb14('0x38')]){for(var _0x9a0c80=0x0;_0x9a0c80<_0x3956da[_0xbb14('0x48')][_0xbb14('0x60')][_0xbb14('0x38')];_0x9a0c80+=0x1){_0x3956da['body'][_0xbb14('0x60')][_0x9a0c80]={'filename':_0x3956da[_0xbb14('0x48')][_0xbb14('0x60')][_0x9a0c80][_0xbb14('0x2b')],'path':path['join'](config['root'],_0xbb14('0x61'),_0x3956da['body'][_0xbb14('0x60')][_0x9a0c80][_0xbb14('0x62')])};}}_0x4518f4={'account':_0x237375,'message':_0x3956da[_0xbb14('0x48')]};return;}})[_0xbb14('0x15')](function(){if(_0x2eadae[_0xbb14('0x51')]){if(_0x2eadae[_0xbb14('0x51')][_0xbb14('0x53')][_0xbb14('0x38')]){return _0x2eadae[_0xbb14('0x51')]['Contacts'][0x0];}else{return db[_0xbb14('0x52')][_0xbb14('0x4a')](_[_0xbb14('0xd')](_0x3956da['body'],{'firstName':_0x3956da[_0xbb14('0x48')]['to'],'email':_0x3956da[_0xbb14('0x48')]['to'],'phone':_0x3956da[_0xbb14('0x48')]['to'],'ListId':_0x2eadae[_0xbb14('0x63')]}));}}else{throw new Error(_0xbb14('0x64'));}})[_0xbb14('0x15')](function(){if(_0x4518f4){return respondWithRpcPromise(_0xbb14('0x65'),_0xbb14('0x66'),_0x4518f4,client9003)[_0xbb14('0x15')](function(_0x937dce){return _0x4720a6[_0xbb14('0x26')]({'read':!![],'messageId':_0x937dce[_0xbb14('0x67')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xbb14('0x1d')](function(_0x4bd336){logger[_0xbb14('0x19')]('%s',JSON[_0xbb14('0x68')](_0x4bd336));return _0x4720a6;});}return _0x4720a6;});}return _0x4720a6;}})[_0xbb14('0x15')](respondWithResult(_0x2228a2,0xc9))[_0xbb14('0x1d')](handleError(_0x2228a2,null));};exports[_0xbb14('0x69')]=function(_0x11a5a0,_0x23e9a3){var _0x2f32e8={'agent':{},'channel':_0xbb14('0x6a')};if(_0x11a5a0[_0xbb14('0x48')]['id']){delete _0x11a5a0[_0xbb14('0x48')]['id'];}_0x11a5a0[_0xbb14('0x48')]['read']=!![];_0x11a5a0[_0xbb14('0x48')][_0xbb14('0x6b')]=moment()['format'](_0xbb14('0x6c'));_0x11a5a0[_0xbb14('0x48')]['UserId']=_0x11a5a0[_0xbb14('0x48')][_0xbb14('0x6d')]||_0x11a5a0[_0xbb14('0x5e')]['id'];_0x2f32e8['agent']['id']=_0x11a5a0[_0xbb14('0x48')][_0xbb14('0x6d')];return db['MailMessage'][_0xbb14('0x47')]({'where':{'id':_0x11a5a0[_0xbb14('0x45')]['id'],'UserId':null}})[_0xbb14('0x15')](handleEntityNotFound(_0x23e9a3,null))[_0xbb14('0x15')](saveUpdates(_0x11a5a0[_0xbb14('0x48')],null))[_0xbb14('0x15')](function(_0x19ea82){if(_0x19ea82){_0x2f32e8['message']=_0x19ea82[_0xbb14('0x6e')]({'plain':!![]});return db[_0xbb14('0x6f')][_0xbb14('0x47')]({'where':{'id':_0x19ea82[_0xbb14('0x70')]}});}return null;})[_0xbb14('0x15')](handleEntityNotFound(_0x23e9a3,null))[_0xbb14('0x15')](function(_0x988dea){if(_0x988dea){return _0x988dea[_0xbb14('0x26')]({'UserId':_0x11a5a0[_0xbb14('0x48')][_0xbb14('0x6d')],'read1stAt':_[_0xbb14('0x58')](_0x988dea[_0xbb14('0x71')])?moment()['format'](_0xbb14('0x6c')):undefined});}return null;})['then'](function(_0x2353e3){if(_0x2353e3){_0x2f32e8[_0xbb14('0x72')]=_0x2353e3['get']({'plain':!![]});interaction_log[_0xbb14('0x1b')](_0xbb14('0x73'),_0x11a5a0[_0xbb14('0x5e')]['id'],_0x11a5a0['user'][_0xbb14('0x2b')],_0x11a5a0['user']['role'],_0x2f32e8[_0xbb14('0x72')]['id'],_0x11a5a0[_0xbb14('0x48')]?JSON[_0xbb14('0x68')](_0x11a5a0[_0xbb14('0x48')]):_0xbb14('0x74'));return respondWithRpcPromise(_0xbb14('0x75'),_0xbb14('0x76'),_0x2f32e8);}return null;})[_0xbb14('0x15')](function(_0x46397e){var _0x450cb2=_0xbb14('0x77')+_0x46397e[_0xbb14('0x1a')][_0xbb14('0x78')];return db[_0xbb14('0x79')][_0xbb14('0x33')](_0x450cb2,{'type':db[_0xbb14('0x7a')][_0xbb14('0x7b')][_0xbb14('0x7c')],'raw':!![]})[_0xbb14('0x15')](function(_0xff0846){return _0xff0846;});})[_0xbb14('0x15')](function(_0x33ed97){if(_0x33ed97){_0x2f32e8[_0xbb14('0x1a')][_0xbb14('0x7d')]=_0x33ed97[0x0];if(!_0x11a5a0[_0xbb14('0x48')][_0xbb14('0x6d')])return;return db[_0xbb14('0x7e')][_0xbb14('0x47')]({'where':{'id':_0x11a5a0[_0xbb14('0x48')][_0xbb14('0x6d')],'role':_0xbb14('0x7f')},'attributes':['id',_0xbb14('0x2b'),_0xbb14('0x80'),_0xbb14('0x81'),_0xbb14('0x82')],'raw':!![]});}return null;})[_0xbb14('0x15')](function(_0x31fd0e){if(!_0x31fd0e)return null;_0x2f32e8[_0xbb14('0x1a')][_0xbb14('0x7f')]=_0x31fd0e;return _0x2f32e8;})['then'](function(_0x4acb2b){if(_0x4acb2b){if(_0x11a5a0[_0xbb14('0x48')][_0xbb14('0x83')]){_0x2f32e8[_0xbb14('0x1a')]['interface']=util[_0xbb14('0x84')]('SIP/%s',_0x11a5a0[_0xbb14('0x5e')][_0xbb14('0x2b')]);_0x2f32e8[_0xbb14('0x1a')][_0xbb14('0x85')]=_0x2f32e8[_0xbb14('0x85')];_0x2f32e8[_0xbb14('0x1a')][_0xbb14('0x86')]=_0x2f32e8['channel'];_0x2f32e8['message']['event']='accept';_0x2f32e8[_0xbb14('0x1a')]['body']=htmlToText['fromString'](_0x2f32e8[_0xbb14('0x1a')]['body']);return respondWithRpcPromise(_0xbb14('0x87'),_0xbb14('0x87'),{'event':_0xbb14('0x88'),'message':_0x2f32e8[_0xbb14('0x1a')]},client9002)[_0xbb14('0x15')](function(){return _0x2f32e8;});}return _0x2f32e8;}return null;})[_0xbb14('0x15')](respondWithResult(_0x23e9a3,null))['catch'](handleError(_0x23e9a3,null));};exports[_0xbb14('0x89')]=function(_0x595af2,_0x1c21f5){var _0x589edc={'agent':{},'channel':_0xbb14('0x6a')};if(_0x595af2['body']['id']){delete _0x595af2[_0xbb14('0x48')]['id'];}_0x595af2['body'][_0xbb14('0x6d')]=_0x595af2[_0xbb14('0x48')][_0xbb14('0x6d')]||_0x595af2[_0xbb14('0x5e')]['id'];_0x589edc[_0xbb14('0x7f')]['id']=_0x595af2[_0xbb14('0x48')]['UserId'];return db[_0xbb14('0x2e')][_0xbb14('0x47')]({'where':{'id':_0x595af2[_0xbb14('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1c21f5,null))['then'](function(_0x48209c){if(_0x48209c){_0x589edc[_0xbb14('0x1a')]=_0x48209c[_0xbb14('0x6e')]({'plain':!![]});return db[_0xbb14('0x6f')]['find']({'where':{'id':_0x48209c[_0xbb14('0x70')]}});}return null;})[_0xbb14('0x15')](handleEntityNotFound(_0x1c21f5,null))[_0xbb14('0x15')](function(_0x39c018){if(_0x39c018){_0x589edc['interaction']=_0x39c018[_0xbb14('0x6e')]({'plain':!![]});interaction_log['info'](_0xbb14('0x8a'),_0x595af2[_0xbb14('0x5e')]['id'],_0x595af2[_0xbb14('0x5e')][_0xbb14('0x2b')],_0x595af2[_0xbb14('0x5e')][_0xbb14('0x8b')],_0x589edc[_0xbb14('0x72')]['id'],_0x595af2[_0xbb14('0x48')]?JSON[_0xbb14('0x68')](_0x595af2[_0xbb14('0x48')]):_0xbb14('0x74'));return respondWithRpcPromise(_0xbb14('0x8c'),_0xbb14('0x8d'),_0x589edc);}return null;})[_0xbb14('0x15')](function(_0x5c6867){var _0x21adb8=_0xbb14('0x77')+_0x5c6867[_0xbb14('0x1a')][_0xbb14('0x78')];return db['sequelize'][_0xbb14('0x33')](_0x21adb8,{'type':db[_0xbb14('0x7a')][_0xbb14('0x7b')][_0xbb14('0x7c')],'raw':!![]})[_0xbb14('0x15')](function(_0x335afe){return _0x335afe;});})[_0xbb14('0x15')](function(_0x3e00e8){if(_0x3e00e8){_0x589edc[_0xbb14('0x1a')][_0xbb14('0x7d')]=_0x3e00e8[0x0];if(!_0x595af2[_0xbb14('0x48')][_0xbb14('0x6d')])return;return db['User'][_0xbb14('0x47')]({'where':{'id':_0x595af2[_0xbb14('0x48')][_0xbb14('0x6d')],'role':'agent'},'attributes':['id','name',_0xbb14('0x80'),_0xbb14('0x81'),'internal'],'raw':!![]});}return null;})[_0xbb14('0x15')](function(_0x2fc8d3){if(!_0x2fc8d3)return null;_0x589edc[_0xbb14('0x1a')][_0xbb14('0x7f')]=_0x2fc8d3;return _0x589edc;})[_0xbb14('0x15')](function(_0x240173){if(_0x240173){_0x240173['message'][_0xbb14('0x8e')]=util[_0xbb14('0x84')]('SIP/%s',_0x595af2[_0xbb14('0x5e')][_0xbb14('0x2b')]);_0x240173['message'][_0xbb14('0x85')]=_0x589edc[_0xbb14('0x85')];_0x240173[_0xbb14('0x1a')][_0xbb14('0x86')]=_0x589edc[_0xbb14('0x85')];_0x240173['message'][_0xbb14('0x8f')]=_0xbb14('0x89');_0x240173[_0xbb14('0x1a')][_0xbb14('0x48')]=htmlToText[_0xbb14('0x90')](_0x589edc[_0xbb14('0x1a')]['body']);respondWithRpcPromise(_0xbb14('0x87'),_0xbb14('0x87'),{'event':_0xbb14('0x91'),'message':_0x240173['message']},client9002);return _0x589edc;}return null;})[_0xbb14('0x15')](respondWithResult(_0x1c21f5,null))[_0xbb14('0x1d')](handleError(_0x1c21f5,null));};exports['download']=function(_0x3e92e0,_0x542382){var _0x1c5026=moment()[_0xbb14('0x92')]()[_0xbb14('0x93')]();var _0x2d743b=path[_0xbb14('0x94')](config[_0xbb14('0x95')],'server',_0xbb14('0x96'),_0xbb14('0x97'));var _0x3f5b3a=path['join'](config[_0xbb14('0x95')],'server','files','attachments');var _0x586ce1=util[_0xbb14('0x84')](_0xbb14('0x98'),_0x1c5026);return db[_0xbb14('0x2e')][_0xbb14('0x47')]({'where':{'id':_0x3e92e0[_0xbb14('0x45')]['id']},'attributes':['id',_0xbb14('0x48'),_0xbb14('0x99'),'to','cc',_0xbb14('0x9a'),_0xbb14('0x9b'),'createdAt'],'include':_0x3e92e0[_0xbb14('0x33')][_0xbb14('0x60')]?[{'model':db['Attachment'],'as':_0xbb14('0x9c')}]:undefined})[_0xbb14('0x15')](handleEntityNotFound(_0x542382,null))[_0xbb14('0x15')](function(_0x3e4d38){if(_0x3e4d38){var _0x3969a2=_0x3e4d38;var _0x180f39={'from':_0x3969a2[_0xbb14('0x99')],'to':_0x3969a2['to'],'subject':_0x3969a2[_0xbb14('0x9b')],'html':_0x3969a2['body'],'headers':{'Date':moment(_0x3969a2[_0xbb14('0x9d')])[_0xbb14('0x84')](_0xbb14('0x9e'))},'attachments':[]};if(_0x3e4d38['cc']){_0x180f39['headers']['Cc']=_0x3e4d38['cc'];}if(_0x3e4d38[_0xbb14('0x9a')]){_0x180f39[_0xbb14('0x9f')][_0xbb14('0xa0')]=_0x3e4d38[_0xbb14('0x9a')];}return new BPromise(function(_0x21f2a6,_0x41d519){if(_0x3e4d38[_0xbb14('0x9c')]){for(var _0x33da5a=0x0;_0x33da5a<_0x3e4d38[_0xbb14('0x9c')][_0xbb14('0x38')];_0x33da5a++){var _0x52ab80=_0x3e4d38[_0xbb14('0x9c')][_0x33da5a];var _0x9c3f50=path[_0xbb14('0x94')](_0x3f5b3a,_0x52ab80['basename']);if(fs['existsSync'](_0x9c3f50)){_0x180f39[_0xbb14('0x60')]['push']({'name':_0x52ab80['name'],'contentType':_0x52ab80[_0xbb14('0x40')],'data':fs[_0xbb14('0xa1')](_0x9c3f50)});}}}emlformat[_0xbb14('0xa2')](_0x180f39,function(_0x516076,_0x35bfb2){if(_0x516076)return _0x41d519(_0x516076);fs[_0xbb14('0xa3')](path[_0xbb14('0x94')](_0x2d743b,_0x586ce1),_0x35bfb2);return _0x21f2a6(_0x35bfb2);});});}})[_0xbb14('0x15')](function(_0x53e60c){if(_0x53e60c){return _0x542382[_0xbb14('0xa4')](path[_0xbb14('0x94')](_0x2d743b,_0x586ce1),_0x586ce1,function(_0x2f2ac2){if(!_0x2f2ac2)fs[_0xbb14('0xa5')](path[_0xbb14('0x94')](_0x2d743b,_0x586ce1));});}})[_0xbb14('0x1d')](handleError(_0x542382,null));}; \ No newline at end of file +var _0x20af=['sendStatus','stack','name','map','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','MailMessage','findAll','rows','show','params','keys','find','body','catch','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','QueryTypes','SELECT','contact','UserId','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','rejectmessage','unix','server','tmp','message-%s.eml','from','bcc','Attachment','Attachments','subject','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','download','eml-format','moment','bluebird','util','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end'];(function(_0x396910,_0x397bda){var _0x217d81=function(_0x1e6ab9){while(--_0x1e6ab9){_0x396910['push'](_0x396910['shift']());}};_0x217d81(++_0x397bda);}(_0x20af,0x7b));var _0xf20a=function(_0x302d9a,_0x5bcdcf){_0x302d9a=_0x302d9a-0x0;var _0x90b45=_0x20af[_0x302d9a];return _0x90b45;};'use strict';var emlformat=require(_0xf20a('0x0'));var moment=require(_0xf20a('0x1'));var BPromise=require(_0xf20a('0x2'));var util=require(_0xf20a('0x3'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0xf20a('0x4'));var htmlToText=require(_0xf20a('0x5'));var qs=require(_0xf20a('0x6'));var logger=require(_0xf20a('0x7'))(_0xf20a('0x8'));var interaction_log=require(_0xf20a('0x7'))('mail-interactions');var config=require(_0xf20a('0x9'));var db=require(_0xf20a('0xa'))['db'];config['redis']=_[_0xf20a('0xb')](config[_0xf20a('0xc')],{'host':_0xf20a('0xd'),'port':0x18eb});var socket=require(_0xf20a('0xe'))(new Redis(config[_0xf20a('0xc')]));require(_0xf20a('0xf'))[_0xf20a('0x10')](socket);var jayson=require(_0xf20a('0x11'));var client=jayson[_0xf20a('0x12')]['http']({'port':0x232c});var client9003=jayson[_0xf20a('0x12')]['http']({'port':0x232b});var client9002=jayson[_0xf20a('0x12')][_0xf20a('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x265b05,_0x5d19b1,_0x31572d,_0x283a75){return new BPromise(function(_0x4c14ae,_0x17132f){var _0x520708=_0x283a75||client;return _0x520708[_0xf20a('0x14')](_0x265b05,_0x31572d)['then'](function(_0x4d5075){logger[_0xf20a('0x15')](_0xf20a('0x16'),_0x5d19b1,_0xf20a('0x17'));logger[_0xf20a('0x18')](_0xf20a('0x19'),_0x5d19b1,'request\x20sent',JSON[_0xf20a('0x1a')](_0x4d5075));if(_0x4d5075['error']){if(_0x4d5075[_0xf20a('0x1b')][_0xf20a('0x1c')]===0x1f4){logger['error'](_0xf20a('0x16'),_0x5d19b1,_0x4d5075[_0xf20a('0x1b')]['message']);return _0x17132f(_0x4d5075[_0xf20a('0x1b')][_0xf20a('0x1d')]);}logger[_0xf20a('0x1b')](_0xf20a('0x16'),_0x5d19b1,_0x4d5075['error'][_0xf20a('0x1d')]);return _0x4c14ae(_0x4d5075[_0xf20a('0x1b')][_0xf20a('0x1d')]);}else{logger['info'](_0xf20a('0x16'),_0x5d19b1,_0xf20a('0x17'));_0x4c14ae(_0x4d5075[_0xf20a('0x1e')][_0xf20a('0x1d')]);}})['catch'](function(_0x3129fc){logger[_0xf20a('0x1b')](_0xf20a('0x16'),_0x5d19b1,_0x3129fc);_0x17132f(_0x3129fc);});});}function respondWithResult(_0x47392e,_0x251e43){_0x251e43=_0x251e43||0xc8;return function(_0x5e1967){if(_0x5e1967){return _0x47392e[_0xf20a('0x1f')](_0x251e43)[_0xf20a('0x20')](_0x5e1967);}};}function respondWithFilteredResult(_0x2252bc,_0x6a589b){return function(_0xb00c1c){if(_0xb00c1c){var _0x5e08f9=typeof _0x6a589b[_0xf20a('0x21')]===_0xf20a('0x22')&&typeof _0x6a589b['limit']===_0xf20a('0x22');var _0x4a1edb=_0xb00c1c['count'];var _0x2e7cfd=_0x5e08f9?0x0:_0x6a589b['offset'];var _0x2460ed=_0x5e08f9?_0xb00c1c[_0xf20a('0x23')]:_0x6a589b[_0xf20a('0x21')]+_0x6a589b[_0xf20a('0x24')];var _0x29cac3;if(_0x2460ed>=_0x4a1edb){_0x2460ed=_0x4a1edb;_0x29cac3=0xc8;}else{_0x29cac3=0xce;}_0x2252bc[_0xf20a('0x1f')](_0x29cac3);return _0x2252bc[_0xf20a('0x25')](_0xf20a('0x26'),_0x2e7cfd+'-'+_0x2460ed+'/'+_0x4a1edb)['json'](_0xb00c1c);}return null;};}function saveUpdates(_0x211f90){return function(_0x5e6aa6){if(_0x5e6aa6){return _0x5e6aa6[_0xf20a('0x27')](_0x211f90)[_0xf20a('0x28')](function(_0x20dbf1){return _0x20dbf1;});}return null;};}function removeEntity(_0x1d0286){return function(_0x2a95f8){if(_0x2a95f8){return _0x2a95f8[_0xf20a('0x29')]()[_0xf20a('0x28')](function(){_0x1d0286['status'](0xcc)[_0xf20a('0x2a')]();});}};}function handleEntityNotFound(_0x107179){return function(_0x3ae764){if(!_0x3ae764){_0x107179[_0xf20a('0x2b')](0x194);}return _0x3ae764;};}function handleError(_0x592f57,_0x536333){_0x536333=_0x536333||0x1f4;return function(_0x382e91){logger['error'](_0x382e91[_0xf20a('0x2c')]);if(_0x382e91[_0xf20a('0x2d')]){delete _0x382e91[_0xf20a('0x2d')];}_0x592f57[_0xf20a('0x1f')](_0x536333)['send'](_0x382e91);};}exports['index']=function(_0x46b219,_0x5ec3c4){var _0x247341={},_0x5f3b62={},_0x405329={'count':0x0,'rows':[]};var _0x456d18=_[_0xf20a('0x2e')](db['MailMessage'][_0xf20a('0x2f')],function(_0xce9dc){return{'name':_0xce9dc['fieldName'],'type':_0xce9dc['type']['key']};});_0x5f3b62[_0xf20a('0x30')]=_['map'](_0x456d18,'name');_0x5f3b62[_0xf20a('0x31')]=_['keys'](_0x46b219[_0xf20a('0x31')]);_0x5f3b62[_0xf20a('0x32')]=_[_0xf20a('0x33')](_0x5f3b62[_0xf20a('0x30')],_0x5f3b62[_0xf20a('0x31')]);_0x247341[_0xf20a('0x34')]=_[_0xf20a('0x33')](_0x5f3b62[_0xf20a('0x30')],qs['fields'](_0x46b219['query'][_0xf20a('0x35')]));_0x247341[_0xf20a('0x34')]=_0x247341[_0xf20a('0x34')][_0xf20a('0x36')]?_0x247341[_0xf20a('0x34')]:_0x5f3b62[_0xf20a('0x30')];if(!_0x46b219[_0xf20a('0x31')][_0xf20a('0x37')](_0xf20a('0x38'))){_0x247341[_0xf20a('0x24')]=qs['limit'](_0x46b219[_0xf20a('0x31')][_0xf20a('0x24')]);_0x247341[_0xf20a('0x21')]=qs[_0xf20a('0x21')](_0x46b219[_0xf20a('0x31')][_0xf20a('0x21')]);}_0x247341[_0xf20a('0x39')]=qs[_0xf20a('0x3a')](_0x46b219[_0xf20a('0x31')][_0xf20a('0x3a')]);_0x247341[_0xf20a('0x3b')]=qs['filters'](_['pick'](_0x46b219[_0xf20a('0x31')],_0x5f3b62[_0xf20a('0x32')]),_0x456d18);if(_0x46b219['query'][_0xf20a('0x3c')]){_0x247341[_0xf20a('0x3b')]=_['merge'](_0x247341[_0xf20a('0x3b')],{'$or':_[_0xf20a('0x2e')](_0x456d18,function(_0x2444e2){if(_0x2444e2[_0xf20a('0x3d')]!==_0xf20a('0x3e')){var _0x529784={};_0x529784[_0x2444e2['name']]={'$like':'%'+_0x46b219['query'][_0xf20a('0x3c')]+'%'};return _0x529784;}})});}_0x247341=_[_0xf20a('0x3f')]({},_0x247341,_0x46b219[_0xf20a('0x40')]);var _0xa3e9d0={'where':_0x247341[_0xf20a('0x3b')]};return db['MailMessage']['count'](_0xa3e9d0)[_0xf20a('0x28')](function(_0xad9ed6){_0x405329[_0xf20a('0x23')]=_0xad9ed6;if(_0x46b219[_0xf20a('0x31')][_0xf20a('0x41')]){_0x247341[_0xf20a('0x42')]=[{'all':!![]}];}return db[_0xf20a('0x43')][_0xf20a('0x44')](_0x247341);})[_0xf20a('0x28')](function(_0x1c0991){_0x405329[_0xf20a('0x45')]=_0x1c0991;return _0x405329;})[_0xf20a('0x28')](respondWithFilteredResult(_0x5ec3c4,_0x247341))['catch'](handleError(_0x5ec3c4,null));};exports[_0xf20a('0x46')]=function(_0x2f8a2c,_0x36bbe5){var _0x518788={'raw':!![],'where':{'id':_0x2f8a2c[_0xf20a('0x47')]['id']}},_0x144790={};_0x144790[_0xf20a('0x30')]=_[_0xf20a('0x48')](db['MailMessage'][_0xf20a('0x2f')]);_0x144790[_0xf20a('0x31')]=_[_0xf20a('0x48')](_0x2f8a2c[_0xf20a('0x31')]);_0x144790[_0xf20a('0x32')]=_[_0xf20a('0x33')](_0x144790['model'],_0x144790[_0xf20a('0x31')]);_0x518788[_0xf20a('0x34')]=_[_0xf20a('0x33')](_0x144790[_0xf20a('0x30')],qs[_0xf20a('0x35')](_0x2f8a2c[_0xf20a('0x31')][_0xf20a('0x35')]));_0x518788['attributes']=_0x518788[_0xf20a('0x34')][_0xf20a('0x36')]?_0x518788[_0xf20a('0x34')]:_0x144790[_0xf20a('0x30')];if(_0x2f8a2c[_0xf20a('0x31')][_0xf20a('0x41')]){_0x518788[_0xf20a('0x42')]=[{'all':!![]}];}_0x518788=_['merge']({},_0x518788,_0x2f8a2c[_0xf20a('0x40')]);return db[_0xf20a('0x43')][_0xf20a('0x49')](_0x518788)[_0xf20a('0x28')](handleEntityNotFound(_0x36bbe5,null))[_0xf20a('0x28')](respondWithResult(_0x36bbe5,null))['catch'](handleError(_0x36bbe5,null));};exports[_0xf20a('0x27')]=function(_0x4a18ae,_0x530d8b){if(_0x4a18ae[_0xf20a('0x4a')]['id']){delete _0x4a18ae[_0xf20a('0x4a')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x4a18ae[_0xf20a('0x47')]['id']}})[_0xf20a('0x28')](handleEntityNotFound(_0x530d8b,null))[_0xf20a('0x28')](saveUpdates(_0x4a18ae[_0xf20a('0x4a')],null))[_0xf20a('0x28')](respondWithResult(_0x530d8b,null))[_0xf20a('0x4b')](handleError(_0x530d8b,null));};exports[_0xf20a('0x29')]=function(_0x9191b0,_0x3cc842){return db[_0xf20a('0x43')][_0xf20a('0x49')]({'where':{'id':_0x9191b0[_0xf20a('0x47')]['id']}})[_0xf20a('0x28')](handleEntityNotFound(_0x3cc842,null))[_0xf20a('0x28')](removeEntity(_0x3cc842,null))['catch'](handleError(_0x3cc842,null));};exports[_0xf20a('0x4c')]=function(_0x246651,_0x74b995){return db[_0xf20a('0x43')][_0xf20a('0x4c')]()[_0xf20a('0x28')](respondWithResult(_0x74b995,null))[_0xf20a('0x4b')](handleError(_0x74b995,null));};exports[_0xf20a('0x4d')]=function(_0x3e2f98,_0x5c318a){return db['MailMessage'][_0xf20a('0x4d')](_0x3e2f98[_0xf20a('0x4a')])[_0xf20a('0x28')](function(_0xeed579){if(_0xeed579){if(_0xeed579[_0xf20a('0x4e')]===_0xf20a('0x4f')&&!_0xeed579[_0xf20a('0x50')]){var _0x51341d,_0x372128,_0x53b4d3;if(_0x3e2f98['body']['to']){_0x372128=_0x3e2f98['body']['to'][_0xf20a('0x51')](',')[0x0];}return db[_0xf20a('0x52')][_0xf20a('0x53')]({'where':{'id':_0xeed579[_0xf20a('0x54')]},'include':[{'model':db[_0xf20a('0x55')],'as':_0xf20a('0x56'),'include':[{'model':db[_0xf20a('0x57')],'as':_0xf20a('0x58'),'where':{'email':_0x372128},'limit':0x1,'order':[[_0xf20a('0x59'),_0xf20a('0x5a')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0xf20a('0x28')](function(_0x2008ec){_0x51341d=_0x2008ec;if(_0x51341d&&_0x51341d[_0xf20a('0x5b')]){var _0x3130df={'tls':{'rejectUnauthorized':![]}};if(_[_0xf20a('0x5c')](_0x51341d[_0xf20a('0x5b')][_0xf20a('0x5d')])){_0x3130df[_0xf20a('0x5e')]=_0x51341d['Smtp'][_0xf20a('0x5e')];_0x3130df['port']=_0x51341d[_0xf20a('0x5b')][_0xf20a('0x5f')];_0x3130df[_0xf20a('0x60')]=_0x51341d[_0xf20a('0x5b')][_0xf20a('0x60')];if(_0x51341d[_0xf20a('0x5b')][_0xf20a('0x61')]){_0x3130df[_0xf20a('0x62')]={'user':_0x51341d[_0xf20a('0x5b')][_0xf20a('0x63')],'pass':_0x51341d['Smtp'][_0xf20a('0x64')]};}}else{_0x3130df[_0xf20a('0x5d')]=_0x51341d[_0xf20a('0x5b')]['service'];_0x3130df[_0xf20a('0x62')]={'user':_0x51341d[_0xf20a('0x5b')][_0xf20a('0x63')],'pass':_0x51341d[_0xf20a('0x5b')]['pass']};_0x3130df[_0xf20a('0x60')]=_0x51341d[_0xf20a('0x5b')][_0xf20a('0x60')];}if(_0x3e2f98[_0xf20a('0x4a')][_0xf20a('0x65')]&&_0x3e2f98['body'][_0xf20a('0x65')][_0xf20a('0x36')]){for(var _0x4b3111=0x0;_0x4b3111<_0x3e2f98[_0xf20a('0x4a')][_0xf20a('0x65')][_0xf20a('0x36')];_0x4b3111+=0x1){_0x3e2f98[_0xf20a('0x4a')]['attachments'][_0x4b3111]={'filename':_0x3e2f98[_0xf20a('0x4a')]['attachments'][_0x4b3111][_0xf20a('0x2d')],'path':path[_0xf20a('0x66')](config['root'],_0xf20a('0x67'),_0x3e2f98['body'][_0xf20a('0x65')][_0x4b3111][_0xf20a('0x68')])};}}_0x53b4d3={'account':_0x3130df,'message':_0x3e2f98[_0xf20a('0x4a')]};return;}})[_0xf20a('0x28')](function(){if(_0x51341d[_0xf20a('0x56')]){if(_0x51341d[_0xf20a('0x56')][_0xf20a('0x58')]['length']){return _0x51341d[_0xf20a('0x56')][_0xf20a('0x58')][0x0];}else{return db[_0xf20a('0x57')][_0xf20a('0x4d')](_[_0xf20a('0xb')](_0x3e2f98[_0xf20a('0x4a')],{'firstName':_0x3e2f98[_0xf20a('0x4a')]['to'],'email':_0x3e2f98[_0xf20a('0x4a')]['to'],'phone':_0x3e2f98[_0xf20a('0x4a')]['to'],'ListId':_0x51341d[_0xf20a('0x69')]}));}}else{throw new Error(_0xf20a('0x6a'));}})[_0xf20a('0x28')](function(){if(_0x53b4d3){return respondWithRpcPromise(_0xf20a('0x6b'),_0xf20a('0x6c'),_0x53b4d3,client9003)['then'](function(_0x23f959){return _0xeed579[_0xf20a('0x27')]({'read':!![],'messageId':_0x23f959[_0xf20a('0x6d')],'sentAt':moment()[_0xf20a('0x6e')](_0xf20a('0x6f'))});})[_0xf20a('0x4b')](function(_0x35b156){logger[_0xf20a('0x1b')]('%s',JSON['stringify'](_0x35b156));return _0xeed579;});}return _0xeed579;});}return _0xeed579;}})[_0xf20a('0x28')](respondWithResult(_0x5c318a,0xc9))[_0xf20a('0x4b')](handleError(_0x5c318a,null));};exports[_0xf20a('0x70')]=function(_0x1be717,_0x5618de){var _0xe32b0f={'agent':{},'channel':_0xf20a('0x71')};if(_0x1be717[_0xf20a('0x4a')]['id']){delete _0x1be717['body']['id'];}_0x1be717['body'][_0xf20a('0x72')]=!![];_0x1be717['body'][_0xf20a('0x73')]=moment()[_0xf20a('0x6e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1be717[_0xf20a('0x4a')]['UserId']=_0x1be717['body']['UserId']||_0x1be717[_0xf20a('0x63')]['id'];_0xe32b0f['agent']['id']=_0x1be717[_0xf20a('0x4a')]['UserId'];return db[_0xf20a('0x43')][_0xf20a('0x49')]({'where':{'id':_0x1be717['params']['id'],'UserId':null}})[_0xf20a('0x28')](handleEntityNotFound(_0x5618de,null))[_0xf20a('0x28')](saveUpdates(_0x1be717['body'],null))[_0xf20a('0x28')](function(_0x2a1a2a){if(_0x2a1a2a){_0xe32b0f[_0xf20a('0x1d')]=_0x2a1a2a[_0xf20a('0x74')]({'plain':!![]});return db[_0xf20a('0x75')][_0xf20a('0x49')]({'where':{'id':_0x2a1a2a[_0xf20a('0x76')]}});}return null;})[_0xf20a('0x28')](handleEntityNotFound(_0x5618de,null))[_0xf20a('0x28')](function(_0x1be599){if(_0x1be599){return _0x1be599[_0xf20a('0x27')]({'UserId':_0x1be717[_0xf20a('0x4a')]['UserId'],'read1stAt':_['isNil'](_0x1be599[_0xf20a('0x77')])?moment()[_0xf20a('0x6e')](_0xf20a('0x6f')):undefined});}return null;})['then'](function(_0x47c0a0){if(_0x47c0a0){_0xe32b0f[_0xf20a('0x78')]=_0x47c0a0[_0xf20a('0x74')]({'plain':!![]});interaction_log[_0xf20a('0x15')](_0xf20a('0x79'),_0x1be717[_0xf20a('0x63')]['id'],_0x1be717['user'][_0xf20a('0x2d')],_0x1be717[_0xf20a('0x63')]['role'],_0xe32b0f['interaction']['id'],_0x1be717[_0xf20a('0x4a')]?JSON[_0xf20a('0x1a')](_0x1be717[_0xf20a('0x4a')]):'null');return respondWithRpcPromise(_0xf20a('0x7a'),_0xf20a('0x7b'),_0xe32b0f);}return null;})['then'](function(_0x4ec369){var _0x8db52e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4ec369['message']['ContactId'];return db['sequelize'][_0xf20a('0x31')](_0x8db52e,{'type':db['Sequelize'][_0xf20a('0x7c')][_0xf20a('0x7d')],'raw':!![]})[_0xf20a('0x28')](function(_0x2cbd5c){return _0x2cbd5c;});})[_0xf20a('0x28')](function(_0x1601dd){if(_0x1601dd){_0xe32b0f[_0xf20a('0x1d')][_0xf20a('0x7e')]=_0x1601dd[0x0];if(!_0x1be717[_0xf20a('0x4a')][_0xf20a('0x7f')])return;return db[_0xf20a('0x80')][_0xf20a('0x49')]({'where':{'id':_0x1be717[_0xf20a('0x4a')]['UserId'],'role':_0xf20a('0x81')},'attributes':['id',_0xf20a('0x2d'),_0xf20a('0x82'),_0xf20a('0x83'),_0xf20a('0x84')],'raw':!![]});}return null;})[_0xf20a('0x28')](function(_0x430787){if(!_0x430787)return null;_0xe32b0f[_0xf20a('0x1d')]['agent']=_0x430787;return _0xe32b0f;})[_0xf20a('0x28')](function(_0x164477){if(_0x164477){if(_0x1be717[_0xf20a('0x4a')][_0xf20a('0x85')]){_0xe32b0f[_0xf20a('0x1d')][_0xf20a('0x86')]=util[_0xf20a('0x6e')](_0xf20a('0x87'),_0x1be717['user']['name']);_0xe32b0f[_0xf20a('0x1d')][_0xf20a('0x88')]=_0xe32b0f[_0xf20a('0x88')];_0xe32b0f[_0xf20a('0x1d')][_0xf20a('0x89')]=_0xe32b0f['channel'];_0xe32b0f['message'][_0xf20a('0x8a')]='accept';_0xe32b0f[_0xf20a('0x1d')][_0xf20a('0x4a')]=htmlToText[_0xf20a('0x8b')](_0xe32b0f[_0xf20a('0x1d')][_0xf20a('0x4a')]);return respondWithRpcPromise(_0xf20a('0x8c'),'EventManager',{'event':_0xf20a('0x8d'),'message':_0xe32b0f[_0xf20a('0x1d')]},client9002)[_0xf20a('0x28')](function(){return _0xe32b0f;});}return _0xe32b0f;}return null;})[_0xf20a('0x28')](respondWithResult(_0x5618de,null))[_0xf20a('0x4b')](handleError(_0x5618de,null));};exports[_0xf20a('0x8e')]=function(_0x1f5d17,_0x15890f){var _0x3122e3={'agent':{},'channel':_0xf20a('0x71')};if(_0x1f5d17['body']['id']){delete _0x1f5d17['body']['id'];}_0x1f5d17[_0xf20a('0x4a')][_0xf20a('0x7f')]=_0x1f5d17[_0xf20a('0x4a')][_0xf20a('0x7f')]||_0x1f5d17[_0xf20a('0x63')]['id'];_0x3122e3[_0xf20a('0x81')]['id']=_0x1f5d17['body'][_0xf20a('0x7f')];return db[_0xf20a('0x43')][_0xf20a('0x49')]({'where':{'id':_0x1f5d17[_0xf20a('0x47')]['id'],'UserId':null}})[_0xf20a('0x28')](handleEntityNotFound(_0x15890f,null))[_0xf20a('0x28')](function(_0x1a308c){if(_0x1a308c){_0x3122e3['message']=_0x1a308c[_0xf20a('0x74')]({'plain':!![]});return db[_0xf20a('0x75')][_0xf20a('0x49')]({'where':{'id':_0x1a308c[_0xf20a('0x76')]}});}return null;})[_0xf20a('0x28')](handleEntityNotFound(_0x15890f,null))['then'](function(_0x58ef0c){if(_0x58ef0c){_0x3122e3[_0xf20a('0x78')]=_0x58ef0c['get']({'plain':!![]});interaction_log['info'](_0xf20a('0x8f'),_0x1f5d17[_0xf20a('0x63')]['id'],_0x1f5d17[_0xf20a('0x63')][_0xf20a('0x2d')],_0x1f5d17[_0xf20a('0x63')][_0xf20a('0x90')],_0x3122e3[_0xf20a('0x78')]['id'],_0x1f5d17[_0xf20a('0x4a')]?JSON[_0xf20a('0x1a')](_0x1f5d17[_0xf20a('0x4a')]):'null');return respondWithRpcPromise(_0xf20a('0x91'),_0xf20a('0x92'),_0x3122e3);}return null;})[_0xf20a('0x28')](function(_0x4e5e99){var _0x4e26a0=_0xf20a('0x93')+_0x4e5e99[_0xf20a('0x1d')]['ContactId'];return db['sequelize'][_0xf20a('0x31')](_0x4e26a0,{'type':db[_0xf20a('0x94')]['QueryTypes'][_0xf20a('0x7d')],'raw':!![]})[_0xf20a('0x28')](function(_0x32d716){return _0x32d716;});})[_0xf20a('0x28')](function(_0x363b67){if(_0x363b67){_0x3122e3[_0xf20a('0x1d')][_0xf20a('0x7e')]=_0x363b67[0x0];if(!_0x1f5d17[_0xf20a('0x4a')]['UserId'])return;return db['User'][_0xf20a('0x49')]({'where':{'id':_0x1f5d17[_0xf20a('0x4a')]['UserId'],'role':_0xf20a('0x81')},'attributes':['id',_0xf20a('0x2d'),_0xf20a('0x82'),_0xf20a('0x83'),'internal'],'raw':!![]});}return null;})['then'](function(_0x449720){if(!_0x449720)return null;_0x3122e3[_0xf20a('0x1d')][_0xf20a('0x81')]=_0x449720;return _0x3122e3;})[_0xf20a('0x28')](function(_0x4f26d9){if(_0x4f26d9){_0x4f26d9[_0xf20a('0x1d')][_0xf20a('0x86')]=util[_0xf20a('0x6e')]('SIP/%s',_0x1f5d17[_0xf20a('0x63')][_0xf20a('0x2d')]);_0x4f26d9[_0xf20a('0x1d')][_0xf20a('0x88')]=_0x3122e3[_0xf20a('0x88')];_0x4f26d9[_0xf20a('0x1d')][_0xf20a('0x89')]=_0x3122e3['channel'];_0x4f26d9[_0xf20a('0x1d')][_0xf20a('0x8a')]='reject';_0x4f26d9['message'][_0xf20a('0x4a')]=htmlToText[_0xf20a('0x8b')](_0x3122e3[_0xf20a('0x1d')][_0xf20a('0x4a')]);respondWithRpcPromise('EventManager',_0xf20a('0x8c'),{'event':_0xf20a('0x95'),'message':_0x4f26d9[_0xf20a('0x1d')]},client9002);return _0x3122e3;}return null;})[_0xf20a('0x28')](respondWithResult(_0x15890f,null))[_0xf20a('0x4b')](handleError(_0x15890f,null));};exports['download']=function(_0x37f2bd,_0x1dd9c3){var _0x3d4f69=moment()[_0xf20a('0x96')]()['toString']();var _0x52d5f4=path[_0xf20a('0x66')](config['root'],_0xf20a('0x97'),'files',_0xf20a('0x98'));var _0x5358dc=path[_0xf20a('0x66')](config['root'],_0xf20a('0x97'),'files',_0xf20a('0x65'));var _0x371032=util[_0xf20a('0x6e')](_0xf20a('0x99'),_0x3d4f69);return db[_0xf20a('0x43')][_0xf20a('0x49')]({'where':{'id':_0x37f2bd['params']['id']},'attributes':['id','body',_0xf20a('0x9a'),'to','cc',_0xf20a('0x9b'),'subject','createdAt'],'include':_0x37f2bd[_0xf20a('0x31')][_0xf20a('0x65')]?[{'model':db[_0xf20a('0x9c')],'as':_0xf20a('0x9d')}]:undefined})['then'](handleEntityNotFound(_0x1dd9c3,null))['then'](function(_0x2b97cf){if(_0x2b97cf){var _0x4626c4=_0x2b97cf;var _0x37947f={'from':_0x4626c4[_0xf20a('0x9a')],'to':_0x4626c4['to'],'subject':_0x4626c4[_0xf20a('0x9e')],'html':_0x4626c4[_0xf20a('0x4a')],'headers':{'Date':moment(_0x4626c4[_0xf20a('0x9f')])[_0xf20a('0x6e')](_0xf20a('0xa0'))},'attachments':[]};if(_0x2b97cf['cc']){_0x37947f[_0xf20a('0xa1')]['Cc']=_0x2b97cf['cc'];}if(_0x2b97cf[_0xf20a('0x9b')]){_0x37947f[_0xf20a('0xa1')][_0xf20a('0xa2')]=_0x2b97cf['bcc'];}return new BPromise(function(_0x570f0b,_0x1d4187){if(_0x2b97cf[_0xf20a('0x9d')]){for(var _0x1e6e6e=0x0;_0x1e6e6e<_0x2b97cf[_0xf20a('0x9d')][_0xf20a('0x36')];_0x1e6e6e++){var _0x2ff07a=_0x2b97cf[_0xf20a('0x9d')][_0x1e6e6e];var _0x590d07=path['join'](_0x5358dc,_0x2ff07a[_0xf20a('0x68')]);if(fs[_0xf20a('0xa3')](_0x590d07)){_0x37947f['attachments'][_0xf20a('0xa4')]({'name':_0x2ff07a[_0xf20a('0x2d')],'contentType':_0x2ff07a[_0xf20a('0x3d')],'data':fs['readFileSync'](_0x590d07)});}}}emlformat['build'](_0x37947f,function(_0x7dbaaf,_0xccfb88){if(_0x7dbaaf)return _0x1d4187(_0x7dbaaf);fs['writeFileSync'](path[_0xf20a('0x66')](_0x52d5f4,_0x371032),_0xccfb88);return _0x570f0b(_0xccfb88);});});}})[_0xf20a('0x28')](function(_0x2553d0){if(_0x2553d0){return _0x1dd9c3[_0xf20a('0xa5')](path[_0xf20a('0x66')](_0x52d5f4,_0x371032),_0x371032,function(_0x378983){if(!_0x378983)fs['unlinkSync'](path[_0xf20a('0x66')](_0x52d5f4,_0x371032));});}})[_0xf20a('0x4b')](handleError(_0x1dd9c3,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 9865e19..aacbcd7 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 _0x52f4=['hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2dfd40,_0x4f9e34){var _0x540008=function(_0x99ba53){while(--_0x99ba53){_0x2dfd40['push'](_0x2dfd40['shift']());}};_0x540008(++_0x4f9e34);}(_0x52f4,0x14c));var _0x452f=function(_0x15aa65,_0x248081){_0x15aa65=_0x15aa65-0x0;var _0x4a6989=_0x52f4[_0x15aa65];return _0x4a6989;};'use strict';var EventEmitter=require(_0x452f('0x0'));var MailMessage=require(_0x452f('0x1'))['db'][_0x452f('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x452f('0x3')](0x0);var events={'afterCreate':_0x452f('0x4'),'afterUpdate':'update','afterDestroy':_0x452f('0x5')};function emitEvent(_0x86d35d){return function(_0xb831ee,_0x4915b7,_0x1c2bf1){MailMessageEvents[_0x452f('0x6')](_0x86d35d+':'+_0xb831ee['id'],_0xb831ee);MailMessageEvents[_0x452f('0x6')](_0x86d35d,_0xb831ee);_0x1c2bf1(null);};}for(var e in events){if(events[_0x452f('0x7')](e)){var event=events[e];MailMessage[_0x452f('0x8')](e,emitEvent(event));}}module[_0x452f('0x9')]=MailMessageEvents; \ No newline at end of file +var _0xe898=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','update'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xe898,0x154));var _0x8e89=function(_0xf42142,_0x448cd8){_0xf42142=_0xf42142-0x0;var _0x195537=_0xe898[_0xf42142];return _0x195537;};'use strict';var EventEmitter=require(_0x8e89('0x0'));var MailMessage=require(_0x8e89('0x1'))['db'][_0x8e89('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8e89('0x3'),'afterDestroy':'remove'};function emitEvent(_0x57fac9){return function(_0x2c5cb1,_0x598b47,_0x52b28f){MailMessageEvents[_0x8e89('0x4')](_0x57fac9+':'+_0x2c5cb1['id'],_0x2c5cb1);MailMessageEvents[_0x8e89('0x4')](_0x57fac9,_0x2c5cb1);_0x52b28f(null);};}for(var e in events){if(events[_0x8e89('0x5')](e)){var event=events[e];MailMessage[_0x8e89('0x6')](e,emitEvent(event));}}module[_0x8e89('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 58dd6c1..dd33ffd 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 _0x7b17=['error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','fromString','get','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','catch'];(function(_0x13c315,_0x71739b){var _0x4a3246=function(_0x4d01bd){while(--_0x4d01bd){_0x13c315['push'](_0x13c315['shift']());}};_0x4a3246(++_0x71739b);}(_0x7b17,0x1e4));var _0x77b1=function(_0x28fbbf,_0x11f896){_0x28fbbf=_0x28fbbf-0x0;var _0x543af6=_0x7b17[_0x28fbbf];return _0x543af6;};'use strict';var _=require(_0x77b1('0x0'));var util=require(_0x77b1('0x1'));var logger=require(_0x77b1('0x2'))(_0x77b1('0x3'));var moment=require(_0x77b1('0x4'));var BPromise=require('bluebird');var rp=require(_0x77b1('0x5'));var htmlToText=require(_0x77b1('0x6'));var fs=require('fs');var path=require(_0x77b1('0x7'));var rimraf=require(_0x77b1('0x8'));var config=require(_0x77b1('0x9'));var attributes=require(_0x77b1('0xa'));module[_0x77b1('0xb')]=function(_0x6e30ec,_0x512986){return _0x6e30ec[_0x77b1('0xc')](_0x77b1('0xd'),attributes,{'tableName':_0x77b1('0xe'),'paranoid':![],'indexes':[{'name':_0x77b1('0xf'),'fields':[_0x77b1('0xf')]},{'name':_0x77b1('0x10'),'fields':['plainBody',_0x77b1('0x11')],'type':_0x77b1('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x52bc3d,_0x35e568,_0x2d24a0){if(_0x52bc3d[_0x77b1('0x13')]){_0x52bc3d[_0x77b1('0x14')]=htmlToText[_0x77b1('0x15')](_0x52bc3d[_0x77b1('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2d24a0(null,_0x35e568);},'afterCreate':function(_0xbd331a,_0x3863fd,_0x2391c7){var _0x4d996e=_0x6e30ec['models'];var _0x40203c=_0xbd331a[_0x77b1('0x16')]({'plain':!![]});if(_0x40203c[_0x77b1('0x17')][_0x77b1('0x18')]()==='in'||_0x40203c[_0x77b1('0x17')][_0x77b1('0x18')]()===_0x77b1('0x19')&&!_0x40203c[_0x77b1('0x1a')]&&!_['isNil'](_0x40203c[_0x77b1('0x1b')])){_0x4d996e[_0x77b1('0x1c')][_0x77b1('0x1d')]({'where':{'id':_0x40203c[_0x77b1('0x1e')]}})[_0x77b1('0x1f')](function(_0x5bcc0b){if(_0x5bcc0b){_0x5bcc0b['update']({'lastMsgAt':_0x40203c[_0x77b1('0x20')],'lastMsgDirection':_0x40203c['direction']['toLowerCase']()});}})[_0x77b1('0x21')](function(_0x4d3c97){console[_0x77b1('0x22')](_0x4d3c97);});}_0x2391c7();}},'charset':_0x77b1('0x23'),'collate':_0x77b1('0x24')});}; \ No newline at end of file +var _0x7725=['error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','get','toLowerCase','direction','out','secret','isNil','MailInteraction','findOne','MailInteractionId','then','update','catch'];(function(_0x3fd1b7,_0x397bfc){var _0x258057=function(_0x17b316){while(--_0x17b316){_0x3fd1b7['push'](_0x3fd1b7['shift']());}};_0x258057(++_0x397bfc);}(_0x7725,0xea));var _0x5772=function(_0xf0330b,_0x814253){_0xf0330b=_0xf0330b-0x0;var _0x538518=_0x7725[_0xf0330b];return _0x538518;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5772('0x0'))(_0x5772('0x1'));var moment=require(_0x5772('0x2'));var BPromise=require('bluebird');var rp=require(_0x5772('0x3'));var htmlToText=require(_0x5772('0x4'));var fs=require('fs');var path=require(_0x5772('0x5'));var rimraf=require(_0x5772('0x6'));var config=require(_0x5772('0x7'));var attributes=require(_0x5772('0x8'));module[_0x5772('0x9')]=function(_0x5d789e,_0x3ed448){return _0x5d789e[_0x5772('0xa')]('MailMessage',attributes,{'tableName':_0x5772('0xb'),'paranoid':![],'indexes':[{'name':_0x5772('0xc'),'fields':[_0x5772('0xc')]},{'name':_0x5772('0xd'),'fields':[_0x5772('0xe'),_0x5772('0xf')],'type':_0x5772('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1817af,_0x5723c3,_0x20105b){if(_0x1817af[_0x5772('0x11')]){_0x1817af['plainBody']=htmlToText['fromString'](_0x1817af[_0x5772('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x20105b(null,_0x5723c3);},'afterCreate':function(_0x45c0b2,_0x34b230,_0x481536){var _0x5c467b=_0x5d789e['models'];var _0x3ca732=_0x45c0b2[_0x5772('0x12')]({'plain':!![]});if(_0x3ca732['direction'][_0x5772('0x13')]()==='in'||_0x3ca732[_0x5772('0x14')][_0x5772('0x13')]()===_0x5772('0x15')&&!_0x3ca732[_0x5772('0x16')]&&!_[_0x5772('0x17')](_0x3ca732['UserId'])){_0x5c467b[_0x5772('0x18')][_0x5772('0x19')]({'where':{'id':_0x3ca732[_0x5772('0x1a')]}})[_0x5772('0x1b')](function(_0x565d36){if(_0x565d36){_0x565d36[_0x5772('0x1c')]({'lastMsgAt':_0x3ca732['createdAt'],'lastMsgDirection':_0x3ca732[_0x5772('0x14')]['toLowerCase']()});}})[_0x5772('0x1d')](function(_0x51800c){console[_0x5772('0x1e')](_0x51800c);});}_0x481536();}},'charset':_0x5772('0x1f'),'collate':_0x5772('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index efa22cf..2b22808 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 _0xefda=['redis','defaults','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4d093a,_0x15d59c){var _0x5d7227=function(_0x4e2fee){while(--_0x4e2fee){_0x4d093a['push'](_0x4d093a['shift']());}};_0x5d7227(++_0x15d59c);}(_0xefda,0x96));var _0xaefd=function(_0x10e68b,_0xda2b7f){_0x10e68b=_0x10e68b-0x0;var _0xca0db4=_0xefda[_0x10e68b];return _0xca0db4;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaefd('0x1'));var rs=require(_0xaefd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaefd('0x3'))['db'];var utils=require(_0xaefd('0x4'));var logger=require(_0xaefd('0x5'))(_0xaefd('0x6'));var config=require(_0xaefd('0x7'));var jayson=require(_0xaefd('0x8'));var client=jayson['client'][_0xaefd('0x9')]({'port':0x232a});config[_0xaefd('0xa')]=_[_0xaefd('0xb')](config[_0xaefd('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xaefd('0xc'))(new Redis(config[_0xaefd('0xa')]));require(_0xaefd('0xd'))['register'](socket);function respondWithRpcPromise(_0x48a255,_0x54a3b1,_0xa6239d){return new BPromise(function(_0x16b36e,_0x20135c){return client[_0xaefd('0xe')](_0x48a255,_0xa6239d)[_0xaefd('0xf')](function(_0x1e00fb){logger[_0xaefd('0x10')](_0xaefd('0x11'),_0x54a3b1,_0xaefd('0x12'));logger[_0xaefd('0x13')](_0xaefd('0x14'),_0x54a3b1,'request\x20sent',JSON[_0xaefd('0x15')](_0x1e00fb));if(_0x1e00fb['error']){if(_0x1e00fb[_0xaefd('0x16')][_0xaefd('0x17')]===0x1f4){logger[_0xaefd('0x16')](_0xaefd('0x11'),_0x54a3b1,_0x1e00fb['error'][_0xaefd('0x18')]);return _0x20135c(_0x1e00fb[_0xaefd('0x16')][_0xaefd('0x18')]);}logger[_0xaefd('0x16')](_0xaefd('0x11'),_0x54a3b1,_0x1e00fb[_0xaefd('0x16')][_0xaefd('0x18')]);return _0x16b36e(_0x1e00fb[_0xaefd('0x16')]['message']);}else{logger[_0xaefd('0x10')](_0xaefd('0x11'),_0x54a3b1,_0xaefd('0x12'));_0x16b36e(_0x1e00fb[_0xaefd('0x19')][_0xaefd('0x18')]);}})[_0xaefd('0x1a')](function(_0x516e84){logger[_0xaefd('0x16')](_0xaefd('0x11'),_0x54a3b1,_0x516e84);_0x20135c(_0x516e84);});});}exports[_0xaefd('0x1b')]=function(_0x1260dd){var _0x45ebf2=this;return new Promise(function(_0x1f302c,_0x5282ed){return db[_0xaefd('0x1c')][_0xaefd('0x1d')](_0x1260dd[_0xaefd('0x1e')],{'raw':_0x1260dd[_0xaefd('0x1f')]?_0x1260dd[_0xaefd('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5b9967){logger[_0xaefd('0x10')](_0xaefd('0x1b'),_0x1260dd);logger[_0xaefd('0x13')]('CreateMailMessage',_0x1260dd,JSON[_0xaefd('0x15')](_0x5b9967));_0x1f302c(_0x5b9967);})['catch'](function(_0x3deec8){logger[_0xaefd('0x16')](_0xaefd('0x1b'),_0x3deec8['message'],_0x1260dd);_0x5282ed(_0x45ebf2[_0xaefd('0x16')](0x1f4,_0x3deec8[_0xaefd('0x18')]));});});}; \ No newline at end of file +var _0x1c7c=['then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','CreateMailMessage','MailMessage','options','raw','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x264b03,_0x2249cb){var _0x3a99da=function(_0x25ec0e){while(--_0x25ec0e){_0x264b03['push'](_0x264b03['shift']());}};_0x3a99da(++_0x2249cb);}(_0x1c7c,0x164));var _0xc1c7=function(_0x5a08e9,_0x3dbdd3){_0x5a08e9=_0x5a08e9-0x0;var _0x5c76cf=_0x1c7c[_0x5a08e9];return _0x5c76cf;};'use strict';var _=require(_0xc1c7('0x0'));var util=require(_0xc1c7('0x1'));var moment=require(_0xc1c7('0x2'));var BPromise=require(_0xc1c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1c7('0x5'));var logger=require(_0xc1c7('0x6'))(_0xc1c7('0x7'));var config=require(_0xc1c7('0x8'));var jayson=require(_0xc1c7('0x9'));var client=jayson[_0xc1c7('0xa')][_0xc1c7('0xb')]({'port':0x232a});config[_0xc1c7('0xc')]=_[_0xc1c7('0xd')](config[_0xc1c7('0xc')],{'host':_0xc1c7('0xe'),'port':0x18eb});var socket=require(_0xc1c7('0xf'))(new Redis(config[_0xc1c7('0xc')]));require(_0xc1c7('0x10'))[_0xc1c7('0x11')](socket);function respondWithRpcPromise(_0x301abf,_0x25a669,_0x4df577){return new BPromise(function(_0x3b0748,_0x246ced){return client['request'](_0x301abf,_0x4df577)[_0xc1c7('0x12')](function(_0x5ac140){logger[_0xc1c7('0x13')]('MailMessage,\x20%s,\x20%s',_0x25a669,_0xc1c7('0x14'));logger[_0xc1c7('0x15')](_0xc1c7('0x16'),_0x25a669,_0xc1c7('0x14'),JSON[_0xc1c7('0x17')](_0x5ac140));if(_0x5ac140[_0xc1c7('0x18')]){if(_0x5ac140[_0xc1c7('0x18')][_0xc1c7('0x19')]===0x1f4){logger[_0xc1c7('0x18')](_0xc1c7('0x1a'),_0x25a669,_0x5ac140[_0xc1c7('0x18')][_0xc1c7('0x1b')]);return _0x246ced(_0x5ac140['error'][_0xc1c7('0x1b')]);}logger[_0xc1c7('0x18')](_0xc1c7('0x1a'),_0x25a669,_0x5ac140['error'][_0xc1c7('0x1b')]);return _0x3b0748(_0x5ac140[_0xc1c7('0x18')][_0xc1c7('0x1b')]);}else{logger[_0xc1c7('0x13')](_0xc1c7('0x1a'),_0x25a669,_0xc1c7('0x14'));_0x3b0748(_0x5ac140[_0xc1c7('0x1c')][_0xc1c7('0x1b')]);}})['catch'](function(_0x37d748){logger[_0xc1c7('0x18')](_0xc1c7('0x1a'),_0x25a669,_0x37d748);_0x246ced(_0x37d748);});});}exports[_0xc1c7('0x1d')]=function(_0x4b706e){var _0x124fd8=this;return new Promise(function(_0x4d6171,_0x5e7e4a){return db[_0xc1c7('0x1e')]['create'](_0x4b706e['body'],{'raw':_0x4b706e[_0xc1c7('0x1f')]?_0x4b706e[_0xc1c7('0x1f')][_0xc1c7('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x813853){logger[_0xc1c7('0x13')](_0xc1c7('0x1d'),_0x4b706e);logger[_0xc1c7('0x15')](_0xc1c7('0x1d'),_0x4b706e,JSON[_0xc1c7('0x17')](_0x813853));_0x4d6171(_0x813853);})[_0xc1c7('0x21')](function(_0x120168){logger[_0xc1c7('0x18')](_0xc1c7('0x1d'),_0x120168[_0xc1c7('0x1b')],_0x4b706e);_0x5e7e4a(_0x124fd8[_0xc1c7('0x18')](0x1f4,_0x120168[_0xc1c7('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 58bf47b..ddacd63 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 _0x1c57=['./mailMessage.events','remove','update','emit','register','length','mailMessage:'];(function(_0x2b57c5,_0x314d42){var _0x4c7590=function(_0x24b6ed){while(--_0x24b6ed){_0x2b57c5['push'](_0x2b57c5['shift']());}};_0x4c7590(++_0x314d42);}(_0x1c57,0xf5));var _0x71c5=function(_0x3d7641,_0x2129fe){_0x3d7641=_0x3d7641-0x0;var _0x3b49e9=_0x1c57[_0x3d7641];return _0x3b49e9;};'use strict';var MailMessageEvents=require(_0x71c5('0x0'));var events=['save',_0x71c5('0x1'),_0x71c5('0x2')];function createListener(_0x5aab1f,_0x429bca){return function(_0x4d02b1){_0x429bca[_0x71c5('0x3')](_0x5aab1f,_0x4d02b1);};}function removeListener(_0x1ac20f,_0x3a5c27){return function(){MailMessageEvents['removeListener'](_0x1ac20f,_0x3a5c27);};}exports[_0x71c5('0x4')]=function(_0x5e9700){for(var _0xa0ff77=0x0,_0x2d9d78=events[_0x71c5('0x5')];_0xa0ff77<_0x2d9d78;_0xa0ff77++){var _0x4b7338=events[_0xa0ff77];var _0x4f4009=createListener(_0x71c5('0x6')+_0x4b7338,_0x5e9700);MailMessageEvents['on'](_0x4b7338,_0x4f4009);}}; \ No newline at end of file +var _0x6c52=['register','length','mailMessage:','save','remove','update'];(function(_0x18e3e9,_0x15724c){var _0x253a72=function(_0x201454){while(--_0x201454){_0x18e3e9['push'](_0x18e3e9['shift']());}};_0x253a72(++_0x15724c);}(_0x6c52,0x1b3));var _0x26c5=function(_0x28fdc2,_0x298889){_0x28fdc2=_0x28fdc2-0x0;var _0x437735=_0x6c52[_0x28fdc2];return _0x437735;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x26c5('0x0'),_0x26c5('0x1'),_0x26c5('0x2')];function createListener(_0xd0e0e,_0x3ae944){return function(_0x403968){_0x3ae944['emit'](_0xd0e0e,_0x403968);};}function removeListener(_0x1ea950,_0x2f4c34){return function(){MailMessageEvents['removeListener'](_0x1ea950,_0x2f4c34);};}exports[_0x26c5('0x3')]=function(_0x2146cf){for(var _0x19c420=0x0,_0x1d9594=events[_0x26c5('0x4')];_0x19c420<_0x1d9594;_0x19c420++){var _0x41c356=events[_0x19c420];var _0x3ec8ba=createListener(_0x26c5('0x5')+_0x41c356,_0x2146cf);MailMessageEvents['on'](_0x41c356,_0x3ec8ba);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index c99675b..d86478f 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 _0x6284=['index','get','/:id/members','getTeams','getAgents','create','post','/:id/teams','addTeams','addAgents','put','/:id','update','delete','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated'];(function(_0x11ef6a,_0x4887bb){var _0x50e518=function(_0x2db696){while(--_0x2db696){_0x11ef6a['push'](_0x11ef6a['shift']());}};_0x50e518(++_0x4887bb);}(_0x6284,0x134));var _0x4628=function(_0x39fdcd,_0x22b54b){_0x39fdcd=_0x39fdcd-0x0;var _0x36707d=_0x6284[_0x39fdcd];return _0x36707d;};'use strict';var multer=require(_0x4628('0x0'));var util=require(_0x4628('0x1'));var path=require(_0x4628('0x2'));var timeout=require(_0x4628('0x3'));var express=require('express');var router=express[_0x4628('0x4')]();var fs_extra=require(_0x4628('0x5'));var auth=require(_0x4628('0x6'));var interaction=require(_0x4628('0x7'));var config=require(_0x4628('0x8'));var controller=require(_0x4628('0x9'));router['get']('/',auth[_0x4628('0xa')](),controller[_0x4628('0xb')]);router[_0x4628('0xc')]('/describe',auth[_0x4628('0xa')](),controller['describe']);router['get']('/:id',auth[_0x4628('0xa')](),controller['show']);router['get'](_0x4628('0xd'),auth['isAuthenticated'](),controller['getMembers']);router[_0x4628('0xc')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4628('0xe')]);router['get']('/:id/users',auth[_0x4628('0xa')](),controller[_0x4628('0xf')]);router['post']('/',auth[_0x4628('0xa')](),controller[_0x4628('0x10')]);router[_0x4628('0x11')](_0x4628('0x12'),auth[_0x4628('0xa')](),controller[_0x4628('0x13')]);router[_0x4628('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0x4628('0x14')]);router[_0x4628('0x15')](_0x4628('0x16'),auth[_0x4628('0xa')](),controller[_0x4628('0x17')]);router[_0x4628('0x18')](_0x4628('0x16'),auth['isAuthenticated'](),controller['destroy']);router[_0x4628('0x18')]('/:id/teams',auth[_0x4628('0xa')](),controller[_0x4628('0x19')]);router[_0x4628('0x18')](_0x4628('0x1a'),auth[_0x4628('0xa')](),controller[_0x4628('0x1b')]);module[_0x4628('0x1c')]=router; \ No newline at end of file +var _0xe722=['/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get'];(function(_0x500785,_0x5b1b06){var _0x5e9ea1=function(_0x17c0c2){while(--_0x17c0c2){_0x500785['push'](_0x500785['shift']());}};_0x5e9ea1(++_0x5b1b06);}(_0xe722,0x189));var _0x2e72=function(_0x323c4b,_0x281826){_0x323c4b=_0x323c4b-0x0;var _0x5264dd=_0xe722[_0x323c4b];return _0x5264dd;};'use strict';var multer=require(_0x2e72('0x0'));var util=require(_0x2e72('0x1'));var path=require(_0x2e72('0x2'));var timeout=require(_0x2e72('0x3'));var express=require(_0x2e72('0x4'));var router=express['Router']();var fs_extra=require(_0x2e72('0x5'));var auth=require(_0x2e72('0x6'));var interaction=require(_0x2e72('0x7'));var config=require(_0x2e72('0x8'));var controller=require(_0x2e72('0x9'));router['get']('/',auth[_0x2e72('0xa')](),controller[_0x2e72('0xb')]);router[_0x2e72('0xc')](_0x2e72('0xd'),auth[_0x2e72('0xa')](),controller['describe']);router[_0x2e72('0xc')](_0x2e72('0xe'),auth['isAuthenticated'](),controller[_0x2e72('0xf')]);router[_0x2e72('0xc')](_0x2e72('0x10'),auth[_0x2e72('0xa')](),controller[_0x2e72('0x11')]);router[_0x2e72('0xc')](_0x2e72('0x12'),auth['isAuthenticated'](),controller[_0x2e72('0x13')]);router[_0x2e72('0xc')](_0x2e72('0x14'),auth[_0x2e72('0xa')](),controller[_0x2e72('0x15')]);router[_0x2e72('0x16')]('/',auth[_0x2e72('0xa')](),controller['create']);router[_0x2e72('0x16')](_0x2e72('0x12'),auth[_0x2e72('0xa')](),controller[_0x2e72('0x17')]);router[_0x2e72('0x16')](_0x2e72('0x14'),auth[_0x2e72('0xa')](),controller['addAgents']);router[_0x2e72('0x18')]('/:id',auth[_0x2e72('0xa')](),controller['update']);router[_0x2e72('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x2e72('0x1a')]);router[_0x2e72('0x19')](_0x2e72('0x12'),auth[_0x2e72('0xa')](),controller[_0x2e72('0x1b')]);router[_0x2e72('0x19')]('/:id/users',auth[_0x2e72('0xa')](),controller['removeAgents']);module[_0x2e72('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index acb90d0..f10f673 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 _0x238c=['STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize'];(function(_0x3788f0,_0x562c63){var _0xee35e9=function(_0x3dc26f){while(--_0x3dc26f){_0x3788f0['push'](_0x3788f0['shift']());}};_0xee35e9(++_0x562c63);}(_0x238c,0x1f0));var _0xc238=function(_0x41eccd,_0x2052f4){_0x41eccd=_0x41eccd-0x0;var _0x4ebf84=_0x238c[_0x41eccd];return _0x4ebf84;};'use strict';var Sequelize=require(_0xc238('0x0'));module['exports']={'name':{'type':Sequelize[_0xc238('0x1')],'unique':_0xc238('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc238('0x1')]},'timeout':{'type':Sequelize[_0xc238('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc238('0x4')](_0xc238('0x5'),_0xc238('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x1336=['rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x3c0432,_0x1d6c64){var _0x33d2fd=function(_0x283aba){while(--_0x283aba){_0x3c0432['push'](_0x3c0432['shift']());}};_0x33d2fd(++_0x1d6c64);}(_0x1336,0x94));var _0x6133=function(_0x5e8bcf,_0xb28233){_0x5e8bcf=_0x5e8bcf-0x0;var _0x405093=_0x1336[_0x5e8bcf];return _0x405093;};'use strict';var Sequelize=require('sequelize');module[_0x6133('0x0')]={'name':{'type':Sequelize[_0x6133('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6133('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6133('0x2'),_0x6133('0x3'),_0x6133('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 966ba26..e6c08ff 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 _0x749e=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','include','rows','catch','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','length','order','UserMailQueue','findAll','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','transaction','each','findOrCreate','forEach','emit','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','compact','value','sequelize','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','userMailQueue:save','isArray','getAgents','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','MailQueues','UserProfileResource','stack','name','index','map','MailQueue','fieldName','type','key','model'];(function(_0x8dd39c,_0x16591d){var _0x5a1886=function(_0x40a796){while(--_0x40a796){_0x8dd39c['push'](_0x8dd39c['shift']());}};_0x5a1886(++_0x16591d);}(_0x749e,0x171));var _0xe749=function(_0x3223b3,_0x1674f9){_0x3223b3=_0x3223b3-0x0;var _0x5796a6=_0x749e[_0x3223b3];return _0x5796a6;};'use strict';var emlformat=require(_0xe749('0x0'));var rimraf=require(_0xe749('0x1'));var zipdir=require(_0xe749('0x2'));var jsonpatch=require(_0xe749('0x3'));var rp=require(_0xe749('0x4'));var moment=require('moment');var BPromise=require(_0xe749('0x5'));var Mustache=require(_0xe749('0x6'));var util=require(_0xe749('0x7'));var path=require(_0xe749('0x8'));var sox=require(_0xe749('0x9'));var csv=require(_0xe749('0xa'));var ejs=require(_0xe749('0xb'));var fs=require('fs');var fs_extra=require(_0xe749('0xc'));var _=require(_0xe749('0xd'));var squel=require(_0xe749('0xe'));var crypto=require(_0xe749('0xf'));var jsforce=require(_0xe749('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe749('0xa'));var querystring=require(_0xe749('0x11'));var Papa=require(_0xe749('0x12'));var Redis=require(_0xe749('0x13'));var authService=require(_0xe749('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe749('0x15'));var hardwareService=require(_0xe749('0x16'));var logger=require('../../config/logger')(_0xe749('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe749('0x18'));var db=require('../../mysqldb')['db'];config[_0xe749('0x19')]=_[_0xe749('0x1a')](config[_0xe749('0x19')],{'host':_0xe749('0x1b'),'port':0x18eb});var socket=require(_0xe749('0x1c'))(new Redis(config[_0xe749('0x19')]));require(_0xe749('0x1d'))['register'](socket);function respondWithStatusCode(_0x2066fb,_0x2ac324){_0x2ac324=_0x2ac324||0xcc;return function(_0x33106f){if(_0x33106f){return _0x2066fb[_0xe749('0x1e')](_0x2ac324);}return _0x2066fb[_0xe749('0x1f')](_0x2ac324)[_0xe749('0x20')]();};}function respondWithResult(_0x365446,_0x260859){_0x260859=_0x260859||0xc8;return function(_0x48cdfb){if(_0x48cdfb){return _0x365446['status'](_0x260859)[_0xe749('0x21')](_0x48cdfb);}};}function respondWithFilteredResult(_0x172c4a,_0x20f38a){return function(_0x14df3d){if(_0x14df3d){var _0x597020=typeof _0x20f38a[_0xe749('0x22')]===_0xe749('0x23')&&typeof _0x20f38a['limit']===_0xe749('0x23');var _0x5dfc0e=_0x14df3d[_0xe749('0x24')];var _0xdeee36=_0x597020?0x0:_0x20f38a[_0xe749('0x22')];var _0x1aa477=_0x597020?_0x14df3d[_0xe749('0x24')]:_0x20f38a[_0xe749('0x22')]+_0x20f38a[_0xe749('0x25')];var _0x3bfb04;if(_0x1aa477>=_0x5dfc0e){_0x1aa477=_0x5dfc0e;_0x3bfb04=0xc8;}else{_0x3bfb04=0xce;}_0x172c4a[_0xe749('0x1f')](_0x3bfb04);return _0x172c4a[_0xe749('0x26')](_0xe749('0x27'),_0xdeee36+'-'+_0x1aa477+'/'+_0x5dfc0e)[_0xe749('0x21')](_0x14df3d);}return null;};}function patchUpdates(_0x25f51c){return function(_0x32d196){try{jsonpatch[_0xe749('0x28')](_0x32d196,_0x25f51c,!![]);}catch(_0x5087d1){return BPromise[_0xe749('0x29')](_0x5087d1);}return _0x32d196[_0xe749('0x2a')]();};}function saveUpdates(_0x1d91c8,_0xf4f5c1){return function(_0x11febb){if(_0x11febb){return _0x11febb['update'](_0x1d91c8)[_0xe749('0x2b')](function(_0x48f95e){return _0x48f95e;});}return null;};}function removeEntity(_0x4b74a0,_0x253ded){return function(_0x3d89ee){if(_0x3d89ee){return _0x3d89ee[_0xe749('0x2c')]()[_0xe749('0x2b')](function(){var _0x599476=_0x3d89ee[_0xe749('0x2d')]({'plain':!![]});var _0x50323e=_0xe749('0x2e');return db[_0xe749('0x2f')][_0xe749('0x2c')]({'where':{'type':_0x50323e,'resourceId':_0x599476['id']}})['then'](function(){return _0x3d89ee;});})[_0xe749('0x2b')](function(){_0x4b74a0['status'](0xcc)[_0xe749('0x20')]();});}};}function handleEntityNotFound(_0x52f191,_0x5c4ab6){return function(_0x41ff98){if(!_0x41ff98){_0x52f191[_0xe749('0x1e')](0x194);}return _0x41ff98;};}function handleError(_0x390eee,_0x1f5d48){_0x1f5d48=_0x1f5d48||0x1f4;return function(_0x39f5da){logger['error'](_0x39f5da[_0xe749('0x30')]);if(_0x39f5da['name']){delete _0x39f5da[_0xe749('0x31')];}_0x390eee[_0xe749('0x1f')](_0x1f5d48)['send'](_0x39f5da);};}exports[_0xe749('0x32')]=function(_0x4542de,_0x4f3fe5){var _0x29d1a1={},_0x49ad60={},_0x4c0b1a={'count':0x0,'rows':[]};var _0x5297c8=_[_0xe749('0x33')](db[_0xe749('0x34')]['rawAttributes'],function(_0x2d8143){return{'name':_0x2d8143[_0xe749('0x35')],'type':_0x2d8143[_0xe749('0x36')][_0xe749('0x37')]};});_0x49ad60[_0xe749('0x38')]=_[_0xe749('0x33')](_0x5297c8,_0xe749('0x31'));_0x49ad60[_0xe749('0x39')]=_[_0xe749('0x3a')](_0x4542de[_0xe749('0x39')]);_0x49ad60[_0xe749('0x3b')]=_[_0xe749('0x3c')](_0x49ad60[_0xe749('0x38')],_0x49ad60[_0xe749('0x39')]);_0x29d1a1[_0xe749('0x3d')]=_['intersection'](_0x49ad60[_0xe749('0x38')],qs[_0xe749('0x3e')](_0x4542de[_0xe749('0x39')][_0xe749('0x3e')]));_0x29d1a1['attributes']=_0x29d1a1[_0xe749('0x3d')]['length']?_0x29d1a1['attributes']:_0x49ad60[_0xe749('0x38')];if(!_0x4542de['query'][_0xe749('0x3f')](_0xe749('0x40'))){_0x29d1a1[_0xe749('0x25')]=qs[_0xe749('0x25')](_0x4542de[_0xe749('0x39')]['limit']);_0x29d1a1[_0xe749('0x22')]=qs['offset'](_0x4542de['query'][_0xe749('0x22')]);}_0x29d1a1['order']=qs[_0xe749('0x41')](_0x4542de[_0xe749('0x39')][_0xe749('0x41')]);_0x29d1a1['where']=qs[_0xe749('0x3b')](_[_0xe749('0x42')](_0x4542de[_0xe749('0x39')],_0x49ad60[_0xe749('0x3b')]),_0x5297c8);if(_0x4542de[_0xe749('0x39')][_0xe749('0x43')]){_0x29d1a1['where']=_[_0xe749('0x44')](_0x29d1a1[_0xe749('0x45')],{'$or':_[_0xe749('0x33')](_0x5297c8,function(_0x277ca7){if(_0x277ca7[_0xe749('0x36')]!==_0xe749('0x46')){var _0xfae4b3={};_0xfae4b3[_0x277ca7[_0xe749('0x31')]]={'$like':'%'+_0x4542de[_0xe749('0x39')][_0xe749('0x43')]+'%'};return _0xfae4b3;}})});}_0x29d1a1=_[_0xe749('0x44')]({},_0x29d1a1,_0x4542de[_0xe749('0x47')]);var _0x287c21={'where':_0x29d1a1['where']};return db['MailQueue'][_0xe749('0x24')](_0x287c21)[_0xe749('0x2b')](function(_0x3892de){_0x4c0b1a[_0xe749('0x24')]=_0x3892de;if(_0x4542de[_0xe749('0x39')]['includeAll']){_0x29d1a1[_0xe749('0x48')]=[{'all':!![]}];}return db[_0xe749('0x34')]['findAll'](_0x29d1a1);})[_0xe749('0x2b')](function(_0x34e944){_0x4c0b1a[_0xe749('0x49')]=_0x34e944;return _0x4c0b1a;})[_0xe749('0x2b')](respondWithFilteredResult(_0x4f3fe5,_0x29d1a1))[_0xe749('0x4a')](handleError(_0x4f3fe5,null));};exports['show']=function(_0x4cfd71,_0x4d2597){var _0x27411d={'raw':!![],'where':{'id':_0x4cfd71['params']['id']}},_0x18d164={};_0x18d164['model']=_['keys'](db[_0xe749('0x34')][_0xe749('0x4b')]);_0x18d164['query']=_['keys'](_0x4cfd71[_0xe749('0x39')]);_0x18d164[_0xe749('0x3b')]=_[_0xe749('0x3c')](_0x18d164[_0xe749('0x38')],_0x18d164['query']);_0x27411d[_0xe749('0x3d')]=_[_0xe749('0x3c')](_0x18d164[_0xe749('0x38')],qs[_0xe749('0x3e')](_0x4cfd71[_0xe749('0x39')]['fields']));_0x27411d['attributes']=_0x27411d['attributes']['length']?_0x27411d[_0xe749('0x3d')]:_0x18d164[_0xe749('0x38')];if(_0x4cfd71[_0xe749('0x39')][_0xe749('0x4c')]){_0x27411d[_0xe749('0x48')]=[{'all':!![]}];}_0x27411d=_[_0xe749('0x44')]({},_0x27411d,_0x4cfd71[_0xe749('0x47')]);return db[_0xe749('0x34')][_0xe749('0x4d')](_0x27411d)[_0xe749('0x2b')](handleEntityNotFound(_0x4d2597,null))[_0xe749('0x2b')](respondWithResult(_0x4d2597,null))[_0xe749('0x4a')](handleError(_0x4d2597,null));};exports[_0xe749('0x4e')]=function(_0x3b4115,_0x1a2a8e){return db[_0xe749('0x34')][_0xe749('0x4e')](_0x3b4115[_0xe749('0x4f')],{})[_0xe749('0x2b')](function(_0xd2577d){var _0x1ec7c2=_0x3b4115[_0xe749('0x50')]['get']({'plain':!![]});if(!_0x1ec7c2)throw new Error(_0xe749('0x51'));if(_0x1ec7c2['role']===_0xe749('0x50')){var _0x337fd0=_0xd2577d[_0xe749('0x2d')]({'plain':!![]});var _0x5e572c=_0xe749('0x2e');return db[_0xe749('0x52')][_0xe749('0x4d')]({'where':{'name':_0x5e572c,'userProfileId':_0x1ec7c2['userProfileId']},'raw':!![]})[_0xe749('0x2b')](function(_0x3c647d){if(_0x3c647d&&_0x3c647d[_0xe749('0x53')]===0x0){return db[_0xe749('0x2f')][_0xe749('0x4e')]({'name':_0x337fd0['name'],'resourceId':_0x337fd0['id'],'type':_0x3c647d[_0xe749('0x31')],'sectionId':_0x3c647d['id']},{})[_0xe749('0x2b')](function(){return _0xd2577d;});}else{return _0xd2577d;}})['catch'](function(_0x2a0115){logger['error'](_0xe749('0x54'),_0x2a0115);throw _0x2a0115;});}return _0xd2577d;})[_0xe749('0x2b')](respondWithResult(_0x1a2a8e,0xc9))[_0xe749('0x4a')](handleError(_0x1a2a8e,null));};exports[_0xe749('0x55')]=function(_0x3285e4,_0xa8b968){if(_0x3285e4[_0xe749('0x4f')]['id']){delete _0x3285e4[_0xe749('0x4f')]['id'];}return db[_0xe749('0x34')][_0xe749('0x4d')]({'where':{'id':_0x3285e4['params']['id']}})[_0xe749('0x2b')](handleEntityNotFound(_0xa8b968,null))[_0xe749('0x2b')](saveUpdates(_0x3285e4[_0xe749('0x4f')],null))[_0xe749('0x2b')](respondWithResult(_0xa8b968,null))[_0xe749('0x4a')](handleError(_0xa8b968,null));};exports[_0xe749('0x2c')]=function(_0x24964f,_0x31de99){return db[_0xe749('0x34')][_0xe749('0x4d')]({'where':{'id':_0x24964f[_0xe749('0x56')]['id']}})[_0xe749('0x2b')](handleEntityNotFound(_0x31de99,null))['then'](removeEntity(_0x31de99,null))['catch'](handleError(_0x31de99,null));};exports[_0xe749('0x57')]=function(_0x2c5b2f,_0x1c4d27){return db[_0xe749('0x34')]['describe']()[_0xe749('0x2b')](respondWithResult(_0x1c4d27,null))[_0xe749('0x4a')](handleError(_0x1c4d27,null));};exports[_0xe749('0x58')]=function(_0x54c4f5,_0x1fe8d2,_0x5c5eef){var _0x22645a={'raw':!![],'where':{}},_0x571382={},_0x71842b;return db['MailQueue'][_0xe749('0x59')]({'where':{'id':_0x54c4f5['params']['id']}})['then'](handleEntityNotFound(_0x1fe8d2,null))['then'](function(_0x339111){if(_0x339111){_0x71842b=_0x339111['get']({'plain':!![]});_0x571382[_0xe749('0x38')]=_[_0xe749('0x3a')](db['UserMailQueue']['rawAttributes']);_0x571382[_0xe749('0x39')]=_[_0xe749('0x3a')](_0x54c4f5[_0xe749('0x39')]);_0x571382[_0xe749('0x3b')]=_[_0xe749('0x3c')](_0x571382[_0xe749('0x38')],_0x571382['query']);_0x22645a[_0xe749('0x3d')]=_[_0xe749('0x3c')](_0x571382[_0xe749('0x38')],qs['fields'](_0x54c4f5[_0xe749('0x39')]['fields']));_0x22645a[_0xe749('0x3d')]=_0x22645a[_0xe749('0x3d')][_0xe749('0x5a')]?_0x22645a['attributes']:_0x571382[_0xe749('0x38')];if(!_0x54c4f5[_0xe749('0x39')][_0xe749('0x3f')](_0xe749('0x40'))){_0x22645a['limit']=qs['limit'](_0x54c4f5[_0xe749('0x39')][_0xe749('0x25')]);_0x22645a[_0xe749('0x22')]=qs[_0xe749('0x22')](_0x54c4f5['query']['offset']);}_0x22645a[_0xe749('0x5b')]=qs[_0xe749('0x41')](_0x54c4f5[_0xe749('0x39')][_0xe749('0x41')]);_0x22645a[_0xe749('0x45')]=qs['filters'](_[_0xe749('0x42')](_0x54c4f5[_0xe749('0x39')],_0x571382[_0xe749('0x3b')]));_0x22645a[_0xe749('0x45')]['MailQueueId']=_0x339111['id'];if(_0x54c4f5[_0xe749('0x39')]['filter']){_0x22645a[_0xe749('0x45')]=_['merge'](_0x22645a[_0xe749('0x45')],{'$or':_[_0xe749('0x33')](_0x22645a[_0xe749('0x3d')],function(_0x57819f){var _0x4eb106={};_0x4eb106[_0x57819f]={'$like':'%'+_0x54c4f5[_0xe749('0x39')][_0xe749('0x43')]+'%'};return _0x4eb106;})});}_0x22645a=_[_0xe749('0x44')]({},_0x22645a,_0x54c4f5[_0xe749('0x47')]);return db[_0xe749('0x5c')][_0xe749('0x5d')](_0x22645a);}})[_0xe749('0x2b')](function(_0x5ad50b){if(_0x5ad50b){return db[_0xe749('0x5e')][_0xe749('0x5f')]({'where':{'id':_[_0xe749('0x33')](_0x5ad50b,'UserId'),'role':_0xe749('0x60')},'attributes':['id',_0xe749('0x31'),_0xe749('0x61'),_0xe749('0x62'),_0xe749('0x63')]});}})['then'](function(_0x13408c){if(_0x13408c){return{'count':_0x13408c[_0xe749('0x24')],'rows':_[_0xe749('0x33')](_0x13408c['rows'],function(_0x448dd9){return{'membername':_0x448dd9[_0xe749('0x31')],'UserId':_0x448dd9['id'],'queue_name':_0x71842b[_0xe749('0x31')],'MailQueueId':_0x71842b['id'],'interface':util[_0xe749('0x64')]('%s/%s',_0xe749('0x65'),_0x448dd9[_0xe749('0x31')]),'penalty':0x0,'paused':_0x448dd9[_0xe749('0x61')],'createdAt':_0x448dd9[_0xe749('0x63')],'updatedAt':_0x448dd9[_0xe749('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1fe8d2,_0x22645a))[_0xe749('0x4a')](handleError(_0x1fe8d2,null));};exports[_0xe749('0x66')]=function(_0x523635,_0x420215,_0x235f46){var _0x57de7e={};var _0xf1eb2d={};var _0x7068eb;var _0x26387a;return db[_0xe749('0x34')][_0xe749('0x59')]({'where':{'id':_0x523635['params']['id']}})[_0xe749('0x2b')](handleEntityNotFound(_0x420215,null))[_0xe749('0x2b')](function(_0x1da02e){if(_0x1da02e){_0x7068eb=_0x1da02e;_0xf1eb2d[_0xe749('0x38')]=_[_0xe749('0x3a')](db[_0xe749('0x67')]['rawAttributes']);_0xf1eb2d[_0xe749('0x39')]=_[_0xe749('0x3a')](_0x523635['query']);_0xf1eb2d[_0xe749('0x3b')]=_[_0xe749('0x3c')](_0xf1eb2d[_0xe749('0x38')],_0xf1eb2d[_0xe749('0x39')]);_0x57de7e[_0xe749('0x3d')]=_[_0xe749('0x3c')](_0xf1eb2d['model'],qs['fields'](_0x523635[_0xe749('0x39')][_0xe749('0x3e')]));_0x57de7e[_0xe749('0x3d')]=_0x57de7e['attributes'][_0xe749('0x5a')]?_0x57de7e['attributes']:_0xf1eb2d[_0xe749('0x38')];_0x57de7e[_0xe749('0x5b')]=qs[_0xe749('0x41')](_0x523635[_0xe749('0x39')][_0xe749('0x41')]);_0x57de7e[_0xe749('0x45')]=qs[_0xe749('0x3b')](_[_0xe749('0x42')](_0x523635['query'],_0xf1eb2d[_0xe749('0x3b')]));if(_0x523635[_0xe749('0x39')]['filter']){_0x57de7e['where']=_[_0xe749('0x44')](_0x57de7e[_0xe749('0x45')],{'$or':_[_0xe749('0x33')](_0x57de7e[_0xe749('0x3d')],function(_0x5b111d){var _0x56fa6c={};_0x56fa6c[_0x5b111d]={'$like':'%'+_0x523635[_0xe749('0x39')][_0xe749('0x43')]+'%'};return _0x56fa6c;})});}_0x57de7e=_['merge']({},_0x57de7e,_0x523635[_0xe749('0x47')]);return _0x7068eb[_0xe749('0x66')](_0x57de7e);}})['then'](function(_0x3a1e4f){if(_0x3a1e4f){_0x26387a=_0x3a1e4f[_0xe749('0x5a')];if(!_0x523635[_0xe749('0x39')][_0xe749('0x3f')](_0xe749('0x40'))){_0x57de7e[_0xe749('0x25')]=qs[_0xe749('0x25')](_0x523635[_0xe749('0x39')]['limit']);_0x57de7e[_0xe749('0x22')]=qs[_0xe749('0x22')](_0x523635[_0xe749('0x39')]['offset']);}return _0x7068eb[_0xe749('0x66')](_0x57de7e);}})[_0xe749('0x2b')](function(_0x21ea5e){if(_0x21ea5e){return _0x21ea5e?{'count':_0x26387a,'rows':_0x21ea5e}:null;}})[_0xe749('0x2b')](respondWithResult(_0x420215,null))['catch'](handleError(_0x420215,null));};exports[_0xe749('0x68')]=function(_0x58bef5,_0x156f4e,_0x5cdf50){var _0x3a4b76=_0x58bef5[_0xe749('0x4f')][_0xe749('0x69')];return db[_0xe749('0x67')][_0xe749('0x5d')]({'where':{'id':_0x3a4b76},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe749('0x6a'),'attributes':['id',_0xe749('0x31'),_0xe749('0x6b'),_0xe749('0x6c'),_0xe749('0x6d')],'raw':!![]}]})['then'](function(_0x65f0a5){if(_0x65f0a5){var _0x9c9812=_['flatMap'](_0x65f0a5,function(_0x5f3f4a){var _0x50a361=_0x5f3f4a[_0xe749('0x2d')]({'plain':!![]});return _0x50a361[_0xe749('0x6a')];});return db[_0xe749('0x34')][_0xe749('0x4d')]({'where':{'id':_0x58bef5[_0xe749('0x56')]['id']}})[_0xe749('0x2b')](function(_0xaf7318){return db['sequelize'][_0xe749('0x6e')](function(_0x242e69){return _0xaf7318[_0xe749('0x68')](_0x3a4b76,{'transaction':_0x242e69})['then'](function(){return BPromise[_0xe749('0x6f')](_0x9c9812,function(_0x1a2cca){return db[_0xe749('0x5c')][_0xe749('0x70')]({'where':{'UserId':_0x1a2cca['id'],'MailQueueId':_0x58bef5['params']['id']},'transaction':_0x242e69});});})['then'](function(){_0x9c9812[_0xe749('0x71')](function(_0x3a7609){socket[_0xe749('0x72')]('userMailQueue:save',{'UserId':_0x3a7609['id'],'MailQueueId':_0xaf7318['id']});});});});});}})['then'](respondWithStatusCode(_0x156f4e,null))[_0xe749('0x4a')](handleError(_0x156f4e,null));};exports['removeTeams']=function(_0x722f6b,_0x4dc68e,_0x5e221f){return db[_0xe749('0x67')][_0xe749('0x5d')]({'where':{'id':_0x722f6b[_0xe749('0x39')][_0xe749('0x69')]},'attributes':['id'],'include':[{'model':db[_0xe749('0x5e')],'as':_0xe749('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4dc68e,null))['then'](function(_0x23f478){var _0xc98dee=_[_0xe749('0x33')](_0x23f478,'id');var _0x3a3780=[];var _0x30998f=[];var _0x2983b8=squel[_0xe749('0x73')]();_0x2983b8[_0xe749('0x74')]('tq.TeamId')[_0xe749('0x75')](_0xe749('0x76'),'tq')[_0xe749('0x77')](_0xe749('0x78'),'ut',_0xe749('0x79'))[_0xe749('0x45')](_0xe749('0x7a'),_0x722f6b['params']['id']);for(var _0x14fd0d=0x0;_0x14fd0d<_0x23f478[_0xe749('0x5a')];_0x14fd0d+=0x1){let _0x1c9727=_0x23f478[_0x14fd0d];for(var _0x5bb50c=0x0;_0x5bb50c<_0x1c9727[_0xe749('0x6a')][_0xe749('0x5a')];_0x5bb50c+=0x1){let _0x163d8b=_0x1c9727[_0xe749('0x6a')][_0x5bb50c];var _0x433d55=_0x2983b8[_0xe749('0x7b')]();_0x433d55['where'](_0xe749('0x7c'),_0x163d8b['id']);_0x30998f[_0xe749('0x7d')](db['sequelize'][_0xe749('0x39')](_0x433d55[_0xe749('0x7e')](),{'type':db['sequelize'][_0xe749('0x7f')]['SELECT']})[_0xe749('0x2b')](function(_0x4e2bbe){if(_0x4e2bbe[_0xe749('0x5a')]===0x1){return _0x163d8b['id'];}else{var _0x2400cf=_['every'](_[_0xe749('0x33')](_0x4e2bbe,_0xe749('0x80')),function(_0x4b2e4c){return _[_0xe749('0x81')](_0xc98dee,_0x4b2e4c);});if(_0x2400cf){return _0x163d8b['id'];}}}));}}return BPromise['all'](_0x30998f)[_0xe749('0x2b')](function(_0x5268c4){_0x3a3780=_(_0x3a3780)['union'](_0x5268c4)[_0xe749('0x82')]()[_0xe749('0x83')]();return db[_0xe749('0x34')]['find']({'where':{'id':_0x722f6b[_0xe749('0x56')]['id']}})[_0xe749('0x2b')](function(_0xb2d2f4){return db[_0xe749('0x84')][_0xe749('0x6e')](function(_0x281b3d){return _0xb2d2f4[_0xe749('0x85')](_0x722f6b[_0xe749('0x39')]['ids'],{'transaction':_0x281b3d})['then'](function(){if(!_[_0xe749('0x86')](_0x3a3780)){return _0xb2d2f4[_0xe749('0x87')](_0x3a3780,{'transaction':_0x281b3d});}})[_0xe749('0x2b')](function(){_0x3a3780[_0xe749('0x71')](function(_0x427431){socket[_0xe749('0x72')](_0xe749('0x88'),{'UserId':_0x427431,'MailQueueId':_0xb2d2f4['id']});});});});});});})[_0xe749('0x2b')](respondWithStatusCode(_0x4dc68e,null))[_0xe749('0x4a')](handleError(_0x4dc68e,null));};exports['addAgents']=function(_0x217851,_0x311e36,_0x5b5449){return db[_0xe749('0x34')]['find']({'where':{'id':_0x217851[_0xe749('0x56')]['id']}})[_0xe749('0x2b')](handleEntityNotFound(_0x311e36,null))[_0xe749('0x2b')](function(_0x1ebbec){if(_0x1ebbec){return _0x1ebbec[_0xe749('0x89')](_0x217851[_0xe749('0x4f')][_0xe749('0x69')],_[_0xe749('0x8a')](_0x217851[_0xe749('0x4f')],['ids','id'])||{})['spread'](function(_0x56ae57){for(var _0x52c475=0x0;_0x52c475<_0x217851['body'][_0xe749('0x69')][_0xe749('0x5a')];_0x52c475+=0x1){socket[_0xe749('0x72')](_0xe749('0x8b'),{'UserId':Number(_0x217851[_0xe749('0x4f')][_0xe749('0x69')][_0x52c475]),'MailQueueId':Number(_0x217851[_0xe749('0x56')]['id'])});}return _0x56ae57;});}})[_0xe749('0x2b')](respondWithResult(_0x311e36,null))[_0xe749('0x4a')](handleError(_0x311e36,null));};exports[_0xe749('0x87')]=function(_0x24e7bb,_0x4def77,_0x50973e){return db[_0xe749('0x34')]['find']({'where':{'id':_0x24e7bb[_0xe749('0x56')]['id']}})[_0xe749('0x2b')](handleEntityNotFound(_0x4def77,null))['then'](function(_0x2fd666){if(_0x2fd666){return _0x2fd666[_0xe749('0x87')](_0x24e7bb['query'][_0xe749('0x69')])['then'](function(){if(_[_0xe749('0x8c')](_0x24e7bb[_0xe749('0x39')]['ids'])){for(var _0x157876=0x0;_0x157876<_0x24e7bb[_0xe749('0x39')][_0xe749('0x69')][_0xe749('0x5a')];_0x157876+=0x1){socket[_0xe749('0x72')](_0xe749('0x88'),{'UserId':Number(_0x24e7bb[_0xe749('0x39')]['ids'][_0x157876]),'MailQueueId':Number(_0x24e7bb[_0xe749('0x56')]['id'])});}}else{socket[_0xe749('0x72')](_0xe749('0x88'),{'UserId':Number(_0x24e7bb[_0xe749('0x39')][_0xe749('0x69')]),'MailQueueId':Number(_0x24e7bb[_0xe749('0x56')]['id'])});}});}})[_0xe749('0x2b')](respondWithStatusCode(_0x4def77,null))[_0xe749('0x4a')](handleError(_0x4def77,null));};exports['getAgents']=function(_0xa3237,_0xa0f5bc,_0x3a7227){var _0x46899d={};var _0x3b318b={};var _0x36bf97;var _0x1d5eb4;return db[_0xe749('0x34')][_0xe749('0x59')]({'where':{'id':_0xa3237[_0xe749('0x56')]['id']}})['then'](handleEntityNotFound(_0xa0f5bc,null))['then'](function(_0x5d9557){if(_0x5d9557){_0x36bf97=_0x5d9557;_0x3b318b[_0xe749('0x38')]=_[_0xe749('0x3a')](db[_0xe749('0x5e')][_0xe749('0x4b')]);_0x3b318b['query']=_[_0xe749('0x3a')](_0xa3237[_0xe749('0x39')]);_0x3b318b[_0xe749('0x3b')]=_[_0xe749('0x3c')](_0x3b318b[_0xe749('0x38')],_0x3b318b[_0xe749('0x39')]);_0x46899d['attributes']=_[_0xe749('0x3c')](_0x3b318b[_0xe749('0x38')],qs['fields'](_0xa3237[_0xe749('0x39')][_0xe749('0x3e')]));_0x46899d[_0xe749('0x3d')]=_0x46899d['attributes'][_0xe749('0x5a')]?_0x46899d[_0xe749('0x3d')]:_0x3b318b[_0xe749('0x38')];_0x46899d[_0xe749('0x5b')]=qs[_0xe749('0x41')](_0xa3237[_0xe749('0x39')][_0xe749('0x41')]);_0x46899d['where']=qs[_0xe749('0x3b')](_[_0xe749('0x42')](_0xa3237[_0xe749('0x39')],_0x3b318b[_0xe749('0x3b')]));if(_0xa3237['query'][_0xe749('0x43')]){_0x46899d[_0xe749('0x45')]=_['merge'](_0x46899d['where'],{'$or':_['map'](_0x46899d[_0xe749('0x3d')],function(_0x598388){var _0x2448cb={};_0x2448cb[_0x598388]={'$like':'%'+_0xa3237[_0xe749('0x39')]['filter']+'%'};return _0x2448cb;})});}_0x46899d=_[_0xe749('0x44')]({},_0x46899d,_0xa3237[_0xe749('0x47')]);return _0x36bf97[_0xe749('0x8d')](_0x46899d);}})[_0xe749('0x2b')](function(_0xb9fcd7){if(_0xb9fcd7){_0x1d5eb4=_0xb9fcd7[_0xe749('0x5a')];if(!_0xa3237['query'][_0xe749('0x3f')](_0xe749('0x40'))){_0x46899d[_0xe749('0x25')]=qs[_0xe749('0x25')](_0xa3237['query']['limit']);_0x46899d[_0xe749('0x22')]=qs[_0xe749('0x22')](_0xa3237[_0xe749('0x39')][_0xe749('0x22')]);}return _0x36bf97[_0xe749('0x8d')](_0x46899d);}})['then'](function(_0x15ab44){if(_0x15ab44){return _0x15ab44?{'count':_0x1d5eb4,'rows':_0x15ab44}:null;}})[_0xe749('0x2b')](respondWithResult(_0xa0f5bc,null))[_0xe749('0x4a')](handleError(_0xa0f5bc,null));}; \ No newline at end of file +var _0xd2bb=['userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','nolimit','order','MailQueueId','UserMailQueue','findAndCountAll','UserId','createdAt','rows','format','SIP','mailPause','updatedAt','getTeams','Team','addTeams','ids','User','online','flatMap','Agents','transaction','each','findOrCreate','forEach','userMailQueue:save','select','tq.TeamId','user_has_teams','MailQueueId\x20=\x20?','clone','sequelize','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','emit','userMailQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','./mailQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','MailQueues','UserProfileResource','destroy','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','sort','where','pick','filters','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x31b987,_0x271061){var _0x4017e9=function(_0x4e8dbf){while(--_0x4e8dbf){_0x31b987['push'](_0x31b987['shift']());}};_0x4017e9(++_0x271061);}(_0xd2bb,0x1d2));var _0xbd2b=function(_0x35f375,_0x4a8e2f){_0x35f375=_0x35f375-0x0;var _0x717af4=_0xd2bb[_0x35f375];return _0x717af4;};'use strict';var emlformat=require(_0xbd2b('0x0'));var rimraf=require(_0xbd2b('0x1'));var zipdir=require(_0xbd2b('0x2'));var jsonpatch=require(_0xbd2b('0x3'));var rp=require(_0xbd2b('0x4'));var moment=require('moment');var BPromise=require(_0xbd2b('0x5'));var Mustache=require('mustache');var util=require(_0xbd2b('0x6'));var path=require(_0xbd2b('0x7'));var sox=require(_0xbd2b('0x8'));var csv=require(_0xbd2b('0x9'));var ejs=require(_0xbd2b('0xa'));var fs=require('fs');var fs_extra=require(_0xbd2b('0xb'));var _=require('lodash');var squel=require(_0xbd2b('0xc'));var crypto=require(_0xbd2b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbd2b('0xe'));var toCsv=require(_0xbd2b('0x9'));var querystring=require('querystring');var Papa=require(_0xbd2b('0xf'));var Redis=require(_0xbd2b('0x10'));var authService=require(_0xbd2b('0x11'));var qs=require(_0xbd2b('0x12'));var as=require(_0xbd2b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbd2b('0x14'));var utils=require(_0xbd2b('0x15'));var config=require(_0xbd2b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xbd2b('0x17')](config['redis'],{'host':_0xbd2b('0x18'),'port':0x18eb});var socket=require(_0xbd2b('0x19'))(new Redis(config[_0xbd2b('0x1a')]));require(_0xbd2b('0x1b'))['register'](socket);function respondWithStatusCode(_0x41099e,_0x581b5f){_0x581b5f=_0x581b5f||0xcc;return function(_0x3a5372){if(_0x3a5372){return _0x41099e[_0xbd2b('0x1c')](_0x581b5f);}return _0x41099e[_0xbd2b('0x1d')](_0x581b5f)[_0xbd2b('0x1e')]();};}function respondWithResult(_0xe108d2,_0x4ae305){_0x4ae305=_0x4ae305||0xc8;return function(_0x4e87ce){if(_0x4e87ce){return _0xe108d2['status'](_0x4ae305)[_0xbd2b('0x1f')](_0x4e87ce);}};}function respondWithFilteredResult(_0x3bf12b,_0xe258a0){return function(_0x36856f){if(_0x36856f){var _0x13b14d=typeof _0xe258a0[_0xbd2b('0x20')]===_0xbd2b('0x21')&&typeof _0xe258a0[_0xbd2b('0x22')]===_0xbd2b('0x21');var _0xe0d937=_0x36856f[_0xbd2b('0x23')];var _0x508984=_0x13b14d?0x0:_0xe258a0[_0xbd2b('0x20')];var _0x2236de=_0x13b14d?_0x36856f['count']:_0xe258a0['offset']+_0xe258a0['limit'];var _0x5622ca;if(_0x2236de>=_0xe0d937){_0x2236de=_0xe0d937;_0x5622ca=0xc8;}else{_0x5622ca=0xce;}_0x3bf12b['status'](_0x5622ca);return _0x3bf12b[_0xbd2b('0x24')](_0xbd2b('0x25'),_0x508984+'-'+_0x2236de+'/'+_0xe0d937)[_0xbd2b('0x1f')](_0x36856f);}return null;};}function patchUpdates(_0x243832){return function(_0x4cd741){try{jsonpatch['apply'](_0x4cd741,_0x243832,!![]);}catch(_0x156beb){return BPromise[_0xbd2b('0x26')](_0x156beb);}return _0x4cd741[_0xbd2b('0x27')]();};}function saveUpdates(_0x5a324b,_0x3ea838){return function(_0x44eaaf){if(_0x44eaaf){return _0x44eaaf[_0xbd2b('0x28')](_0x5a324b)['then'](function(_0x341449){return _0x341449;});}return null;};}function removeEntity(_0x56a273,_0x24784a){return function(_0x4d44be){if(_0x4d44be){return _0x4d44be['destroy']()[_0xbd2b('0x29')](function(){var _0x442fd9=_0x4d44be[_0xbd2b('0x2a')]({'plain':!![]});var _0x4d85d6=_0xbd2b('0x2b');return db[_0xbd2b('0x2c')][_0xbd2b('0x2d')]({'where':{'type':_0x4d85d6,'resourceId':_0x442fd9['id']}})[_0xbd2b('0x29')](function(){return _0x4d44be;});})[_0xbd2b('0x29')](function(){_0x56a273[_0xbd2b('0x1d')](0xcc)[_0xbd2b('0x1e')]();});}};}function handleEntityNotFound(_0x5cab22,_0x82ccbd){return function(_0x2c8c89){if(!_0x2c8c89){_0x5cab22[_0xbd2b('0x1c')](0x194);}return _0x2c8c89;};}function handleError(_0x16cb19,_0x47c156){_0x47c156=_0x47c156||0x1f4;return function(_0x1b9d78){logger['error'](_0x1b9d78[_0xbd2b('0x2e')]);if(_0x1b9d78[_0xbd2b('0x2f')]){delete _0x1b9d78[_0xbd2b('0x2f')];}_0x16cb19[_0xbd2b('0x1d')](_0x47c156)[_0xbd2b('0x30')](_0x1b9d78);};}exports[_0xbd2b('0x31')]=function(_0x32e2da,_0x1a0e87){var _0x2a3954={},_0x708c7d={},_0x57b336={'count':0x0,'rows':[]};var _0x54f311=_[_0xbd2b('0x32')](db[_0xbd2b('0x33')][_0xbd2b('0x34')],function(_0x36fc1b){return{'name':_0x36fc1b[_0xbd2b('0x35')],'type':_0x36fc1b['type'][_0xbd2b('0x36')]};});_0x708c7d[_0xbd2b('0x37')]=_[_0xbd2b('0x32')](_0x54f311,'name');_0x708c7d[_0xbd2b('0x38')]=_[_0xbd2b('0x39')](_0x32e2da[_0xbd2b('0x38')]);_0x708c7d['filters']=_[_0xbd2b('0x3a')](_0x708c7d[_0xbd2b('0x37')],_0x708c7d[_0xbd2b('0x38')]);_0x2a3954[_0xbd2b('0x3b')]=_['intersection'](_0x708c7d[_0xbd2b('0x37')],qs[_0xbd2b('0x3c')](_0x32e2da['query']['fields']));_0x2a3954[_0xbd2b('0x3b')]=_0x2a3954['attributes'][_0xbd2b('0x3d')]?_0x2a3954['attributes']:_0x708c7d['model'];if(!_0x32e2da['query']['hasOwnProperty']('nolimit')){_0x2a3954[_0xbd2b('0x22')]=qs['limit'](_0x32e2da[_0xbd2b('0x38')][_0xbd2b('0x22')]);_0x2a3954[_0xbd2b('0x20')]=qs[_0xbd2b('0x20')](_0x32e2da[_0xbd2b('0x38')][_0xbd2b('0x20')]);}_0x2a3954['order']=qs[_0xbd2b('0x3e')](_0x32e2da[_0xbd2b('0x38')][_0xbd2b('0x3e')]);_0x2a3954[_0xbd2b('0x3f')]=qs['filters'](_[_0xbd2b('0x40')](_0x32e2da['query'],_0x708c7d[_0xbd2b('0x41')]),_0x54f311);if(_0x32e2da[_0xbd2b('0x38')]['filter']){_0x2a3954[_0xbd2b('0x3f')]=_['merge'](_0x2a3954[_0xbd2b('0x3f')],{'$or':_['map'](_0x54f311,function(_0xd18be8){if(_0xd18be8[_0xbd2b('0x42')]!==_0xbd2b('0x43')){var _0x27c158={};_0x27c158[_0xd18be8['name']]={'$like':'%'+_0x32e2da[_0xbd2b('0x38')][_0xbd2b('0x44')]+'%'};return _0x27c158;}})});}_0x2a3954=_['merge']({},_0x2a3954,_0x32e2da[_0xbd2b('0x45')]);var _0x26fada={'where':_0x2a3954[_0xbd2b('0x3f')]};return db[_0xbd2b('0x33')][_0xbd2b('0x23')](_0x26fada)['then'](function(_0xedf34){_0x57b336[_0xbd2b('0x23')]=_0xedf34;if(_0x32e2da[_0xbd2b('0x38')][_0xbd2b('0x46')]){_0x2a3954[_0xbd2b('0x47')]=[{'all':!![]}];}return db[_0xbd2b('0x33')][_0xbd2b('0x48')](_0x2a3954);})['then'](function(_0x4ee9c1){_0x57b336['rows']=_0x4ee9c1;return _0x57b336;})[_0xbd2b('0x29')](respondWithFilteredResult(_0x1a0e87,_0x2a3954))[_0xbd2b('0x49')](handleError(_0x1a0e87,null));};exports['show']=function(_0x13f401,_0x170aa5){var _0x42416a={'raw':!![],'where':{'id':_0x13f401[_0xbd2b('0x4a')]['id']}},_0x4e12f3={};_0x4e12f3['model']=_[_0xbd2b('0x39')](db['MailQueue'][_0xbd2b('0x34')]);_0x4e12f3[_0xbd2b('0x38')]=_['keys'](_0x13f401[_0xbd2b('0x38')]);_0x4e12f3[_0xbd2b('0x41')]=_['intersection'](_0x4e12f3[_0xbd2b('0x37')],_0x4e12f3[_0xbd2b('0x38')]);_0x42416a[_0xbd2b('0x3b')]=_[_0xbd2b('0x3a')](_0x4e12f3[_0xbd2b('0x37')],qs['fields'](_0x13f401['query'][_0xbd2b('0x3c')]));_0x42416a[_0xbd2b('0x3b')]=_0x42416a[_0xbd2b('0x3b')][_0xbd2b('0x3d')]?_0x42416a[_0xbd2b('0x3b')]:_0x4e12f3[_0xbd2b('0x37')];if(_0x13f401[_0xbd2b('0x38')][_0xbd2b('0x46')]){_0x42416a[_0xbd2b('0x47')]=[{'all':!![]}];}_0x42416a=_[_0xbd2b('0x4b')]({},_0x42416a,_0x13f401[_0xbd2b('0x45')]);return db['MailQueue'][_0xbd2b('0x4c')](_0x42416a)[_0xbd2b('0x29')](handleEntityNotFound(_0x170aa5,null))['then'](respondWithResult(_0x170aa5,null))[_0xbd2b('0x49')](handleError(_0x170aa5,null));};exports[_0xbd2b('0x4d')]=function(_0x1e26af,_0x99e555){return db[_0xbd2b('0x33')]['create'](_0x1e26af[_0xbd2b('0x4e')],{})[_0xbd2b('0x29')](function(_0x489c8f){var _0x156337=_0x1e26af[_0xbd2b('0x4f')][_0xbd2b('0x2a')]({'plain':!![]});if(!_0x156337)throw new Error(_0xbd2b('0x50'));if(_0x156337['role']==='user'){var _0x4f4756=_0x489c8f['get']({'plain':!![]});var _0x57bedc=_0xbd2b('0x2b');return db[_0xbd2b('0x51')][_0xbd2b('0x4c')]({'where':{'name':_0x57bedc,'userProfileId':_0x156337[_0xbd2b('0x52')]},'raw':!![]})['then'](function(_0x3939e0){if(_0x3939e0&&_0x3939e0[_0xbd2b('0x53')]===0x0){return db[_0xbd2b('0x2c')][_0xbd2b('0x4d')]({'name':_0x4f4756[_0xbd2b('0x2f')],'resourceId':_0x4f4756['id'],'type':_0x3939e0[_0xbd2b('0x2f')],'sectionId':_0x3939e0['id']},{})[_0xbd2b('0x29')](function(){return _0x489c8f;});}else{return _0x489c8f;}})[_0xbd2b('0x49')](function(_0x44db3d){logger[_0xbd2b('0x54')](_0xbd2b('0x55'),_0x44db3d);throw _0x44db3d;});}return _0x489c8f;})['then'](respondWithResult(_0x99e555,0xc9))[_0xbd2b('0x49')](handleError(_0x99e555,null));};exports['update']=function(_0x1a1ad1,_0x9a8bd){if(_0x1a1ad1[_0xbd2b('0x4e')]['id']){delete _0x1a1ad1[_0xbd2b('0x4e')]['id'];}return db[_0xbd2b('0x33')][_0xbd2b('0x4c')]({'where':{'id':_0x1a1ad1[_0xbd2b('0x4a')]['id']}})[_0xbd2b('0x29')](handleEntityNotFound(_0x9a8bd,null))[_0xbd2b('0x29')](saveUpdates(_0x1a1ad1['body'],null))[_0xbd2b('0x29')](respondWithResult(_0x9a8bd,null))[_0xbd2b('0x49')](handleError(_0x9a8bd,null));};exports[_0xbd2b('0x2d')]=function(_0x416c66,_0x2ee678){return db[_0xbd2b('0x33')][_0xbd2b('0x4c')]({'where':{'id':_0x416c66[_0xbd2b('0x4a')]['id']}})[_0xbd2b('0x29')](handleEntityNotFound(_0x2ee678,null))[_0xbd2b('0x29')](removeEntity(_0x2ee678,null))['catch'](handleError(_0x2ee678,null));};exports[_0xbd2b('0x56')]=function(_0x3dc6f9,_0x4f62cc){return db['MailQueue'][_0xbd2b('0x56')]()[_0xbd2b('0x29')](respondWithResult(_0x4f62cc,null))[_0xbd2b('0x49')](handleError(_0x4f62cc,null));};exports[_0xbd2b('0x57')]=function(_0x32d59f,_0x2e789a,_0x47986c){var _0x2b2ac5={'raw':!![],'where':{}},_0x29acab={},_0x3368ff;return db['MailQueue'][_0xbd2b('0x58')]({'where':{'id':_0x32d59f[_0xbd2b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2e789a,null))[_0xbd2b('0x29')](function(_0x2bfa0a){if(_0x2bfa0a){_0x3368ff=_0x2bfa0a['get']({'plain':!![]});_0x29acab['model']=_['keys'](db['UserMailQueue'][_0xbd2b('0x34')]);_0x29acab['query']=_[_0xbd2b('0x39')](_0x32d59f['query']);_0x29acab[_0xbd2b('0x41')]=_[_0xbd2b('0x3a')](_0x29acab[_0xbd2b('0x37')],_0x29acab[_0xbd2b('0x38')]);_0x2b2ac5[_0xbd2b('0x3b')]=_['intersection'](_0x29acab[_0xbd2b('0x37')],qs['fields'](_0x32d59f[_0xbd2b('0x38')][_0xbd2b('0x3c')]));_0x2b2ac5[_0xbd2b('0x3b')]=_0x2b2ac5['attributes']['length']?_0x2b2ac5[_0xbd2b('0x3b')]:_0x29acab[_0xbd2b('0x37')];if(!_0x32d59f['query'][_0xbd2b('0x59')](_0xbd2b('0x5a'))){_0x2b2ac5[_0xbd2b('0x22')]=qs['limit'](_0x32d59f['query'][_0xbd2b('0x22')]);_0x2b2ac5[_0xbd2b('0x20')]=qs['offset'](_0x32d59f[_0xbd2b('0x38')]['offset']);}_0x2b2ac5[_0xbd2b('0x5b')]=qs['sort'](_0x32d59f['query'][_0xbd2b('0x3e')]);_0x2b2ac5[_0xbd2b('0x3f')]=qs[_0xbd2b('0x41')](_['pick'](_0x32d59f['query'],_0x29acab[_0xbd2b('0x41')]));_0x2b2ac5['where'][_0xbd2b('0x5c')]=_0x2bfa0a['id'];if(_0x32d59f[_0xbd2b('0x38')][_0xbd2b('0x44')]){_0x2b2ac5[_0xbd2b('0x3f')]=_[_0xbd2b('0x4b')](_0x2b2ac5[_0xbd2b('0x3f')],{'$or':_[_0xbd2b('0x32')](_0x2b2ac5[_0xbd2b('0x3b')],function(_0x882166){var _0xdf1033={};_0xdf1033[_0x882166]={'$like':'%'+_0x32d59f[_0xbd2b('0x38')][_0xbd2b('0x44')]+'%'};return _0xdf1033;})});}_0x2b2ac5=_['merge']({},_0x2b2ac5,_0x32d59f[_0xbd2b('0x45')]);return db[_0xbd2b('0x5d')][_0xbd2b('0x48')](_0x2b2ac5);}})[_0xbd2b('0x29')](function(_0xc06bb9){if(_0xc06bb9){return db['User'][_0xbd2b('0x5e')]({'where':{'id':_[_0xbd2b('0x32')](_0xc06bb9,_0xbd2b('0x5f')),'role':'agent'},'attributes':['id','name','mailPause','updatedAt',_0xbd2b('0x60')]});}})['then'](function(_0x2d6ccc){if(_0x2d6ccc){return{'count':_0x2d6ccc[_0xbd2b('0x23')],'rows':_[_0xbd2b('0x32')](_0x2d6ccc[_0xbd2b('0x61')],function(_0x25faef){return{'membername':_0x25faef[_0xbd2b('0x2f')],'UserId':_0x25faef['id'],'queue_name':_0x3368ff[_0xbd2b('0x2f')],'MailQueueId':_0x3368ff['id'],'interface':util[_0xbd2b('0x62')]('%s/%s',_0xbd2b('0x63'),_0x25faef['name']),'penalty':0x0,'paused':_0x25faef[_0xbd2b('0x64')],'createdAt':_0x25faef[_0xbd2b('0x60')],'updatedAt':_0x25faef[_0xbd2b('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbd2b('0x29')](respondWithFilteredResult(_0x2e789a,_0x2b2ac5))['catch'](handleError(_0x2e789a,null));};exports[_0xbd2b('0x66')]=function(_0x71d405,_0x532ae1,_0x5f3d61){var _0x4b2387={};var _0x1a3169={};var _0x29e746;var _0x2b2702;return db[_0xbd2b('0x33')][_0xbd2b('0x58')]({'where':{'id':_0x71d405['params']['id']}})[_0xbd2b('0x29')](handleEntityNotFound(_0x532ae1,null))['then'](function(_0x25c0fc){if(_0x25c0fc){_0x29e746=_0x25c0fc;_0x1a3169[_0xbd2b('0x37')]=_[_0xbd2b('0x39')](db[_0xbd2b('0x67')][_0xbd2b('0x34')]);_0x1a3169[_0xbd2b('0x38')]=_[_0xbd2b('0x39')](_0x71d405[_0xbd2b('0x38')]);_0x1a3169[_0xbd2b('0x41')]=_[_0xbd2b('0x3a')](_0x1a3169[_0xbd2b('0x37')],_0x1a3169[_0xbd2b('0x38')]);_0x4b2387[_0xbd2b('0x3b')]=_[_0xbd2b('0x3a')](_0x1a3169['model'],qs[_0xbd2b('0x3c')](_0x71d405[_0xbd2b('0x38')][_0xbd2b('0x3c')]));_0x4b2387[_0xbd2b('0x3b')]=_0x4b2387['attributes'][_0xbd2b('0x3d')]?_0x4b2387[_0xbd2b('0x3b')]:_0x1a3169[_0xbd2b('0x37')];_0x4b2387[_0xbd2b('0x5b')]=qs[_0xbd2b('0x3e')](_0x71d405['query']['sort']);_0x4b2387[_0xbd2b('0x3f')]=qs[_0xbd2b('0x41')](_['pick'](_0x71d405[_0xbd2b('0x38')],_0x1a3169[_0xbd2b('0x41')]));if(_0x71d405[_0xbd2b('0x38')][_0xbd2b('0x44')]){_0x4b2387['where']=_['merge'](_0x4b2387[_0xbd2b('0x3f')],{'$or':_[_0xbd2b('0x32')](_0x4b2387[_0xbd2b('0x3b')],function(_0x54e838){var _0x3305bc={};_0x3305bc[_0x54e838]={'$like':'%'+_0x71d405[_0xbd2b('0x38')]['filter']+'%'};return _0x3305bc;})});}_0x4b2387=_[_0xbd2b('0x4b')]({},_0x4b2387,_0x71d405[_0xbd2b('0x45')]);return _0x29e746[_0xbd2b('0x66')](_0x4b2387);}})[_0xbd2b('0x29')](function(_0x379afe){if(_0x379afe){_0x2b2702=_0x379afe['length'];if(!_0x71d405[_0xbd2b('0x38')][_0xbd2b('0x59')]('nolimit')){_0x4b2387['limit']=qs[_0xbd2b('0x22')](_0x71d405[_0xbd2b('0x38')][_0xbd2b('0x22')]);_0x4b2387[_0xbd2b('0x20')]=qs['offset'](_0x71d405[_0xbd2b('0x38')][_0xbd2b('0x20')]);}return _0x29e746[_0xbd2b('0x66')](_0x4b2387);}})[_0xbd2b('0x29')](function(_0x2baad2){if(_0x2baad2){return _0x2baad2?{'count':_0x2b2702,'rows':_0x2baad2}:null;}})[_0xbd2b('0x29')](respondWithResult(_0x532ae1,null))[_0xbd2b('0x49')](handleError(_0x532ae1,null));};exports[_0xbd2b('0x68')]=function(_0x3e7ee2,_0x564690,_0x5caca7){var _0x2cec43=_0x3e7ee2['body'][_0xbd2b('0x69')];return db['Team'][_0xbd2b('0x48')]({'where':{'id':_0x2cec43},'attributes':['id'],'include':[{'model':db[_0xbd2b('0x6a')],'as':'Agents','attributes':['id',_0xbd2b('0x2f'),_0xbd2b('0x6b'),'voicePause','interface'],'raw':!![]}]})[_0xbd2b('0x29')](function(_0x7b2d46){if(_0x7b2d46){var _0x237df2=_[_0xbd2b('0x6c')](_0x7b2d46,function(_0xe2bd01){var _0x288293=_0xe2bd01['get']({'plain':!![]});return _0x288293[_0xbd2b('0x6d')];});return db[_0xbd2b('0x33')][_0xbd2b('0x4c')]({'where':{'id':_0x3e7ee2[_0xbd2b('0x4a')]['id']}})[_0xbd2b('0x29')](function(_0x293fd9){return db['sequelize'][_0xbd2b('0x6e')](function(_0x195c8a){return _0x293fd9[_0xbd2b('0x68')](_0x2cec43,{'transaction':_0x195c8a})[_0xbd2b('0x29')](function(){return BPromise[_0xbd2b('0x6f')](_0x237df2,function(_0x5dc8b7){return db['UserMailQueue'][_0xbd2b('0x70')]({'where':{'UserId':_0x5dc8b7['id'],'MailQueueId':_0x3e7ee2['params']['id']},'transaction':_0x195c8a});});})[_0xbd2b('0x29')](function(){_0x237df2[_0xbd2b('0x71')](function(_0x555b18){socket['emit'](_0xbd2b('0x72'),{'UserId':_0x555b18['id'],'MailQueueId':_0x293fd9['id']});});});});});}})['then'](respondWithStatusCode(_0x564690,null))[_0xbd2b('0x49')](handleError(_0x564690,null));};exports['removeTeams']=function(_0x5651d3,_0x4978a3,_0x300f47){return db[_0xbd2b('0x67')][_0xbd2b('0x48')]({'where':{'id':_0x5651d3[_0xbd2b('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0xbd2b('0x6a')],'as':_0xbd2b('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xbd2b('0x29')](handleEntityNotFound(_0x4978a3,null))[_0xbd2b('0x29')](function(_0xcb6aa){var _0x111896=_[_0xbd2b('0x32')](_0xcb6aa,'id');var _0x5d4717=[];var _0x3ba3ee=[];var _0x3df15e=squel[_0xbd2b('0x73')]();_0x3df15e['field'](_0xbd2b('0x74'))['from']('team_has_mail_queues','tq')['join'](_0xbd2b('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbd2b('0x3f')](_0xbd2b('0x76'),_0x5651d3[_0xbd2b('0x4a')]['id']);for(var _0x3c6bc8=0x0;_0x3c6bc8<_0xcb6aa[_0xbd2b('0x3d')];_0x3c6bc8+=0x1){let _0x1e5914=_0xcb6aa[_0x3c6bc8];for(var _0x159bae=0x0;_0x159bae<_0x1e5914['Agents'][_0xbd2b('0x3d')];_0x159bae+=0x1){let _0x1c565f=_0x1e5914[_0xbd2b('0x6d')][_0x159bae];var _0x1e6bdd=_0x3df15e[_0xbd2b('0x77')]();_0x1e6bdd[_0xbd2b('0x3f')]('ut.UserId\x20=\x20?',_0x1c565f['id']);_0x3ba3ee['push'](db[_0xbd2b('0x78')][_0xbd2b('0x38')](_0x1e6bdd['toString'](),{'type':db[_0xbd2b('0x78')][_0xbd2b('0x79')][_0xbd2b('0x7a')]})[_0xbd2b('0x29')](function(_0x933ee0){if(_0x933ee0['length']===0x1){return _0x1c565f['id'];}else{var _0x40d4c4=_[_0xbd2b('0x7b')](_[_0xbd2b('0x32')](_0x933ee0,'TeamId'),function(_0x4fe7c1){return _[_0xbd2b('0x7c')](_0x111896,_0x4fe7c1);});if(_0x40d4c4){return _0x1c565f['id'];}}}));}}return BPromise[_0xbd2b('0x7d')](_0x3ba3ee)[_0xbd2b('0x29')](function(_0x495eca){_0x5d4717=_(_0x5d4717)[_0xbd2b('0x7e')](_0x495eca)[_0xbd2b('0x7f')]()[_0xbd2b('0x80')]();return db[_0xbd2b('0x33')][_0xbd2b('0x4c')]({'where':{'id':_0x5651d3[_0xbd2b('0x4a')]['id']}})[_0xbd2b('0x29')](function(_0x42e4e6){return db[_0xbd2b('0x78')][_0xbd2b('0x6e')](function(_0x39bbfe){return _0x42e4e6['removeTeams'](_0x5651d3[_0xbd2b('0x38')][_0xbd2b('0x69')],{'transaction':_0x39bbfe})['then'](function(){if(!_[_0xbd2b('0x81')](_0x5d4717)){return _0x42e4e6['removeAgents'](_0x5d4717,{'transaction':_0x39bbfe});}})[_0xbd2b('0x29')](function(){_0x5d4717['forEach'](function(_0x45d4aa){socket[_0xbd2b('0x82')](_0xbd2b('0x83'),{'UserId':_0x45d4aa,'MailQueueId':_0x42e4e6['id']});});});});});});})[_0xbd2b('0x29')](respondWithStatusCode(_0x4978a3,null))[_0xbd2b('0x49')](handleError(_0x4978a3,null));};exports[_0xbd2b('0x84')]=function(_0xa6dcdf,_0x2934c9,_0x14c053){return db[_0xbd2b('0x33')][_0xbd2b('0x4c')]({'where':{'id':_0xa6dcdf[_0xbd2b('0x4a')]['id']}})[_0xbd2b('0x29')](handleEntityNotFound(_0x2934c9,null))['then'](function(_0x47c95f){if(_0x47c95f){return _0x47c95f['addAgents'](_0xa6dcdf[_0xbd2b('0x4e')][_0xbd2b('0x69')],_['omit'](_0xa6dcdf[_0xbd2b('0x4e')],[_0xbd2b('0x69'),'id'])||{})[_0xbd2b('0x85')](function(_0x1103e3){for(var _0x4a2f71=0x0;_0x4a2f71<_0xa6dcdf[_0xbd2b('0x4e')][_0xbd2b('0x69')]['length'];_0x4a2f71+=0x1){socket['emit'](_0xbd2b('0x72'),{'UserId':Number(_0xa6dcdf[_0xbd2b('0x4e')][_0xbd2b('0x69')][_0x4a2f71]),'MailQueueId':Number(_0xa6dcdf['params']['id'])});}return _0x1103e3;});}})[_0xbd2b('0x29')](respondWithResult(_0x2934c9,null))[_0xbd2b('0x49')](handleError(_0x2934c9,null));};exports[_0xbd2b('0x86')]=function(_0x7be52f,_0x2de838,_0x530693){return db[_0xbd2b('0x33')]['find']({'where':{'id':_0x7be52f[_0xbd2b('0x4a')]['id']}})[_0xbd2b('0x29')](handleEntityNotFound(_0x2de838,null))['then'](function(_0x14cda4){if(_0x14cda4){return _0x14cda4['removeAgents'](_0x7be52f[_0xbd2b('0x38')][_0xbd2b('0x69')])[_0xbd2b('0x29')](function(){if(_[_0xbd2b('0x87')](_0x7be52f[_0xbd2b('0x38')][_0xbd2b('0x69')])){for(var _0x1135ef=0x0;_0x1135ef<_0x7be52f[_0xbd2b('0x38')][_0xbd2b('0x69')][_0xbd2b('0x3d')];_0x1135ef+=0x1){socket[_0xbd2b('0x82')](_0xbd2b('0x83'),{'UserId':Number(_0x7be52f[_0xbd2b('0x38')][_0xbd2b('0x69')][_0x1135ef]),'MailQueueId':Number(_0x7be52f[_0xbd2b('0x4a')]['id'])});}}else{socket['emit'](_0xbd2b('0x83'),{'UserId':Number(_0x7be52f[_0xbd2b('0x38')][_0xbd2b('0x69')]),'MailQueueId':Number(_0x7be52f[_0xbd2b('0x4a')]['id'])});}});}})[_0xbd2b('0x29')](respondWithStatusCode(_0x2de838,null))['catch'](handleError(_0x2de838,null));};exports[_0xbd2b('0x88')]=function(_0x1a573f,_0x45aff5,_0x1c37a3){var _0xb2f8e={};var _0x5b9965={};var _0x21e8c4;var _0x1088d4;return db[_0xbd2b('0x33')]['findOne']({'where':{'id':_0x1a573f[_0xbd2b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x45aff5,null))[_0xbd2b('0x29')](function(_0x262996){if(_0x262996){_0x21e8c4=_0x262996;_0x5b9965[_0xbd2b('0x37')]=_[_0xbd2b('0x39')](db[_0xbd2b('0x6a')][_0xbd2b('0x34')]);_0x5b9965['query']=_['keys'](_0x1a573f['query']);_0x5b9965[_0xbd2b('0x41')]=_[_0xbd2b('0x3a')](_0x5b9965[_0xbd2b('0x37')],_0x5b9965[_0xbd2b('0x38')]);_0xb2f8e[_0xbd2b('0x3b')]=_['intersection'](_0x5b9965[_0xbd2b('0x37')],qs['fields'](_0x1a573f[_0xbd2b('0x38')][_0xbd2b('0x3c')]));_0xb2f8e[_0xbd2b('0x3b')]=_0xb2f8e[_0xbd2b('0x3b')][_0xbd2b('0x3d')]?_0xb2f8e[_0xbd2b('0x3b')]:_0x5b9965[_0xbd2b('0x37')];_0xb2f8e[_0xbd2b('0x5b')]=qs['sort'](_0x1a573f[_0xbd2b('0x38')]['sort']);_0xb2f8e['where']=qs['filters'](_[_0xbd2b('0x40')](_0x1a573f[_0xbd2b('0x38')],_0x5b9965[_0xbd2b('0x41')]));if(_0x1a573f[_0xbd2b('0x38')][_0xbd2b('0x44')]){_0xb2f8e['where']=_[_0xbd2b('0x4b')](_0xb2f8e[_0xbd2b('0x3f')],{'$or':_[_0xbd2b('0x32')](_0xb2f8e[_0xbd2b('0x3b')],function(_0xc83a22){var _0x426c14={};_0x426c14[_0xc83a22]={'$like':'%'+_0x1a573f[_0xbd2b('0x38')][_0xbd2b('0x44')]+'%'};return _0x426c14;})});}_0xb2f8e=_[_0xbd2b('0x4b')]({},_0xb2f8e,_0x1a573f['options']);return _0x21e8c4[_0xbd2b('0x88')](_0xb2f8e);}})['then'](function(_0x128cf4){if(_0x128cf4){_0x1088d4=_0x128cf4[_0xbd2b('0x3d')];if(!_0x1a573f['query'][_0xbd2b('0x59')]('nolimit')){_0xb2f8e[_0xbd2b('0x22')]=qs['limit'](_0x1a573f[_0xbd2b('0x38')][_0xbd2b('0x22')]);_0xb2f8e[_0xbd2b('0x20')]=qs[_0xbd2b('0x20')](_0x1a573f[_0xbd2b('0x38')][_0xbd2b('0x20')]);}return _0x21e8c4['getAgents'](_0xb2f8e);}})['then'](function(_0x5ea508){if(_0x5ea508){return _0x5ea508?{'count':_0x1088d4,'rows':_0x5ea508}:null;}})[_0xbd2b('0x29')](respondWithResult(_0x45aff5,null))['catch'](handleError(_0x45aff5,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index a261781..8a73e91 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 _0x02c2=['exports','MailQueue','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4d8b74,_0x539ff4){var _0x2f1d65=function(_0x3c95f6){while(--_0x3c95f6){_0x4d8b74['push'](_0x4d8b74['shift']());}};_0x2f1d65(++_0x539ff4);}(_0x02c2,0x139));var _0x202c=function(_0x54e098,_0x12a5bf){_0x54e098=_0x54e098-0x0;var _0x31500d=_0x02c2[_0x54e098];return _0x31500d;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0x202c('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x202c('0x1'),'afterUpdate':_0x202c('0x2'),'afterDestroy':_0x202c('0x3')};function emitEvent(_0x1b4f5a){return function(_0x919792,_0x4a31c0,_0x1b55e9){MailQueueEvents[_0x202c('0x4')](_0x1b4f5a+':'+_0x919792['id'],_0x919792);MailQueueEvents['emit'](_0x1b4f5a,_0x919792);_0x1b55e9(null);};}for(var e in events){if(events[_0x202c('0x5')](e)){var event=events[e];MailQueue[_0x202c('0x6')](e,emitEvent(event));}}module[_0x202c('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x3128=['emit','hasOwnProperty','exports','events','MailQueue','setMaxListeners','update'];(function(_0x15f21a,_0x20514d){var _0x8913b3=function(_0x7ddff8){while(--_0x7ddff8){_0x15f21a['push'](_0x15f21a['shift']());}};_0x8913b3(++_0x20514d);}(_0x3128,0xd5));var _0x8312=function(_0xd11385,_0x25b427){_0xd11385=_0xd11385-0x0;var _0xebebe8=_0x3128[_0xd11385];return _0xebebe8;};'use strict';var EventEmitter=require(_0x8312('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x8312('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x8312('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8312('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5e3dfe){return function(_0x59ed47,_0x3906f8,_0xd6b154){MailQueueEvents[_0x8312('0x4')](_0x5e3dfe+':'+_0x59ed47['id'],_0x59ed47);MailQueueEvents[_0x8312('0x4')](_0x5e3dfe,_0x59ed47);_0xd6b154(null);};}for(var e in events){if(events[_0x8312('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x8312('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 18cb45d..43a6f21 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 _0x75fe=['rimraf','define','MailQueue','mail_queues','lodash','util','api','moment','request-promise','path'];(function(_0x4ecc63,_0x349558){var _0xb906f7=function(_0x18a7f3){while(--_0x18a7f3){_0x4ecc63['push'](_0x4ecc63['shift']());}};_0xb906f7(++_0x349558);}(_0x75fe,0x126));var _0xe75f=function(_0x365707,_0x1d73bc){_0x365707=_0x365707-0x0;var _0xa6294=_0x75fe[_0x365707];return _0xa6294;};'use strict';var _=require(_0xe75f('0x0'));var util=require(_0xe75f('0x1'));var logger=require('../../config/logger')(_0xe75f('0x2'));var moment=require(_0xe75f('0x3'));var BPromise=require('bluebird');var rp=require(_0xe75f('0x4'));var fs=require('fs');var path=require(_0xe75f('0x5'));var rimraf=require(_0xe75f('0x6'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module['exports']=function(_0x257fd3,_0xbbf4ca){return _0x257fd3[_0xe75f('0x7')](_0xe75f('0x8'),attributes,{'tableName':_0xe75f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x266f=['bluebird','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','util','../../config/logger','api','moment'];(function(_0xdf21d2,_0x29c2c8){var _0x39c680=function(_0xc73199){while(--_0xc73199){_0xdf21d2['push'](_0xdf21d2['shift']());}};_0x39c680(++_0x29c2c8);}(_0x266f,0x1a9));var _0xf266=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x266f[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require('lodash');var util=require(_0xf266('0x0'));var logger=require(_0xf266('0x1'))(_0xf266('0x2'));var moment=require(_0xf266('0x3'));var BPromise=require(_0xf266('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf266('0x5'));var rimraf=require(_0xf266('0x6'));var config=require(_0xf266('0x7'));var attributes=require(_0xf266('0x8'));module[_0xf266('0x9')]=function(_0xea8b92,_0x4cd6d0){return _0xea8b92['define'](_0xf266('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index d37ed26..e3d8ee5 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 _0x790c=['attributes','stringify','MailQueue','where','map','ShowMailQueue','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','client','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetMailQueue','findAll','options','raw','include','model'];(function(_0x143281,_0x5ad502){var _0x3cc31f=function(_0x19f927){while(--_0x19f927){_0x143281['push'](_0x143281['shift']());}};_0x3cc31f(++_0x5ad502);}(_0x790c,0x102));var _0xc790=function(_0x18248c,_0x239171){_0x18248c=_0x18248c-0x0;var _0xabb0ba=_0x790c[_0x18248c];return _0xabb0ba;};'use strict';var _=require(_0xc790('0x0'));var util=require(_0xc790('0x1'));var moment=require(_0xc790('0x2'));var BPromise=require(_0xc790('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc790('0x4'))['db'];var utils=require(_0xc790('0x5'));var logger=require('../../config/logger')(_0xc790('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc790('0x7')]['http']({'port':0x232a});config[_0xc790('0x8')]=_['defaults'](config[_0xc790('0x8')],{'host':_0xc790('0x9'),'port':0x18eb});var socket=require(_0xc790('0xa'))(new Redis(config[_0xc790('0x8')]));require(_0xc790('0xb'))[_0xc790('0xc')](socket);function respondWithRpcPromise(_0x4fc1db,_0x3dc8bf,_0xe323df){return new BPromise(function(_0x47523c,_0xa22361){return client[_0xc790('0xd')](_0x4fc1db,_0xe323df)['then'](function(_0x5cb366){logger['info'](_0xc790('0xe'),_0x3dc8bf,_0xc790('0xf'));logger[_0xc790('0x10')](_0xc790('0x11'),_0x3dc8bf,_0xc790('0xf'),JSON['stringify'](_0x5cb366));if(_0x5cb366[_0xc790('0x12')]){if(_0x5cb366[_0xc790('0x12')][_0xc790('0x13')]===0x1f4){logger[_0xc790('0x12')](_0xc790('0xe'),_0x3dc8bf,_0x5cb366['error'][_0xc790('0x14')]);return _0xa22361(_0x5cb366['error']['message']);}logger[_0xc790('0x12')](_0xc790('0xe'),_0x3dc8bf,_0x5cb366[_0xc790('0x12')]['message']);return _0x47523c(_0x5cb366[_0xc790('0x12')][_0xc790('0x14')]);}else{logger[_0xc790('0x15')](_0xc790('0xe'),_0x3dc8bf,_0xc790('0xf'));_0x47523c(_0x5cb366[_0xc790('0x16')][_0xc790('0x14')]);}})[_0xc790('0x17')](function(_0x57c5f5){logger[_0xc790('0x12')](_0xc790('0xe'),_0x3dc8bf,_0x57c5f5);_0xa22361(_0x57c5f5);});});}exports[_0xc790('0x18')]=function(_0x3ec521){var _0x54a108=this;return new Promise(function(_0x20c70d,_0x4b592a){return db['MailQueue'][_0xc790('0x19')]({'raw':_0x3ec521['options']?_0x3ec521[_0xc790('0x1a')][_0xc790('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ec521[_0xc790('0x1a')]?_0x3ec521[_0xc790('0x1a')]['where']||null:null,'attributes':_0x3ec521['options']?_0x3ec521[_0xc790('0x1a')]['attributes']||null:null,'limit':_0x3ec521['options']?_0x3ec521[_0xc790('0x1a')]['limit']||null:null,'include':_0x3ec521[_0xc790('0x1a')]?_0x3ec521[_0xc790('0x1a')][_0xc790('0x1c')]?_['map'](_0x3ec521[_0xc790('0x1a')][_0xc790('0x1c')],function(_0x5d46fd){return{'model':db[_0x5d46fd[_0xc790('0x1d')]],'as':_0x5d46fd['as'],'attributes':_0x5d46fd[_0xc790('0x1e')],'include':_0x5d46fd['include']?_['map'](_0x5d46fd[_0xc790('0x1c')],function(_0x13705a){return{'model':db[_0x13705a[_0xc790('0x1d')]],'as':_0x13705a['as'],'attributes':_0x13705a['attributes'],'include':_0x13705a[_0xc790('0x1c')]?_['map'](_0x13705a['include'],function(_0x3ec750){return{'model':db[_0x3ec750[_0xc790('0x1d')]],'as':_0x3ec750['as'],'attributes':_0x3ec750[_0xc790('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d25fe){logger[_0xc790('0x15')](_0xc790('0x18'),_0x3ec521);logger['debug']('GetMailQueue',_0x3ec521,JSON[_0xc790('0x1f')](_0x3d25fe));_0x20c70d(_0x3d25fe);})[_0xc790('0x17')](function(_0x570479){logger['error'](_0xc790('0x18'),_0x570479[_0xc790('0x14')],_0x3ec521);_0x4b592a(_0x54a108[_0xc790('0x12')](0x1f4,_0x570479[_0xc790('0x14')]));});});};exports['ShowMailQueue']=function(_0x5c8768){var _0x4ff85d=this;return new Promise(function(_0x124abc,_0x3a9111){return db[_0xc790('0x20')]['find']({'raw':_0x5c8768[_0xc790('0x1a')]?_0x5c8768[_0xc790('0x1a')][_0xc790('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c8768['options']?_0x5c8768['options'][_0xc790('0x21')]||null:null,'attributes':_0x5c8768[_0xc790('0x1a')]?_0x5c8768['options'][_0xc790('0x1e')]||null:null,'include':_0x5c8768['options']?_0x5c8768[_0xc790('0x1a')][_0xc790('0x1c')]?_[_0xc790('0x22')](_0x5c8768[_0xc790('0x1a')]['include'],function(_0x1df6a7){return{'model':db[_0x1df6a7[_0xc790('0x1d')]],'as':_0x1df6a7['as'],'attributes':_0x1df6a7[_0xc790('0x1e')],'include':_0x1df6a7['include']?_['map'](_0x1df6a7['include'],function(_0x4175d8){return{'model':db[_0x4175d8[_0xc790('0x1d')]],'as':_0x4175d8['as'],'attributes':_0x4175d8[_0xc790('0x1e')],'include':_0x4175d8[_0xc790('0x1c')]?_['map'](_0x4175d8[_0xc790('0x1c')],function(_0x1bc6e6){return{'model':db[_0x1bc6e6[_0xc790('0x1d')]],'as':_0x1bc6e6['as'],'attributes':_0x1bc6e6[_0xc790('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3aeab9){logger['info']('ShowMailQueue',_0x5c8768);logger[_0xc790('0x10')](_0xc790('0x23'),_0x5c8768,JSON[_0xc790('0x1f')](_0x3aeab9));_0x124abc(_0x3aeab9);})[_0xc790('0x17')](function(_0x1e8750){logger[_0xc790('0x12')](_0xc790('0x23'),_0x1e8750[_0xc790('0x14')],_0x5c8768);_0x3a9111(_0x4ff85d[_0xc790('0x12')](0x1f4,_0x1e8750['message']));});});}; \ No newline at end of file +var _0x0ae3=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailQueue.socket','MailQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetMailQueue','ShowMailQueue','info','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x0ae3,0x99));var _0x30ae=function(_0x341858,_0x43b9b0){_0x341858=_0x341858-0x0;var _0x3c2fd5=_0x0ae3[_0x341858];return _0x3c2fd5;};'use strict';var _=require(_0x30ae('0x0'));var util=require('util');var moment=require(_0x30ae('0x1'));var BPromise=require(_0x30ae('0x2'));var rs=require(_0x30ae('0x3'));var fs=require('fs');var Redis=require(_0x30ae('0x4'));var db=require(_0x30ae('0x5'))['db'];var utils=require(_0x30ae('0x6'));var logger=require(_0x30ae('0x7'))(_0x30ae('0x8'));var config=require(_0x30ae('0x9'));var jayson=require(_0x30ae('0xa'));var client=jayson[_0x30ae('0xb')][_0x30ae('0xc')]({'port':0x232a});config[_0x30ae('0xd')]=_[_0x30ae('0xe')](config[_0x30ae('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x30ae('0xf'))(new Redis(config['redis']));require(_0x30ae('0x10'))['register'](socket);function respondWithRpcPromise(_0x228983,_0x2d3846,_0x497105){return new BPromise(function(_0x1ada33,_0x3a3a76){return client['request'](_0x228983,_0x497105)['then'](function(_0x3a66af){logger['info'](_0x30ae('0x11'),_0x2d3846,'request\x20sent');logger[_0x30ae('0x12')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2d3846,_0x30ae('0x13'),JSON['stringify'](_0x3a66af));if(_0x3a66af[_0x30ae('0x14')]){if(_0x3a66af['error'][_0x30ae('0x15')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x2d3846,_0x3a66af[_0x30ae('0x14')][_0x30ae('0x16')]);return _0x3a3a76(_0x3a66af['error'][_0x30ae('0x16')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x2d3846,_0x3a66af[_0x30ae('0x14')]['message']);return _0x1ada33(_0x3a66af[_0x30ae('0x14')]['message']);}else{logger['info'](_0x30ae('0x11'),_0x2d3846,_0x30ae('0x13'));_0x1ada33(_0x3a66af[_0x30ae('0x17')][_0x30ae('0x16')]);}})['catch'](function(_0x1d2fee){logger['error'](_0x30ae('0x11'),_0x2d3846,_0x1d2fee);_0x3a3a76(_0x1d2fee);});});}exports['GetMailQueue']=function(_0x21f558){var _0x57e4d0=this;return new Promise(function(_0x362e25,_0xfe743a){return db[_0x30ae('0x18')][_0x30ae('0x19')]({'raw':_0x21f558[_0x30ae('0x1a')]?_0x21f558['options'][_0x30ae('0x1b')]===undefined?!![]:![]:!![],'where':_0x21f558[_0x30ae('0x1a')]?_0x21f558[_0x30ae('0x1a')][_0x30ae('0x1c')]||null:null,'attributes':_0x21f558[_0x30ae('0x1a')]?_0x21f558[_0x30ae('0x1a')][_0x30ae('0x1d')]||null:null,'limit':_0x21f558[_0x30ae('0x1a')]?_0x21f558[_0x30ae('0x1a')][_0x30ae('0x1e')]||null:null,'include':_0x21f558[_0x30ae('0x1a')]?_0x21f558[_0x30ae('0x1a')][_0x30ae('0x1f')]?_[_0x30ae('0x20')](_0x21f558[_0x30ae('0x1a')][_0x30ae('0x1f')],function(_0xd6d455){return{'model':db[_0xd6d455[_0x30ae('0x21')]],'as':_0xd6d455['as'],'attributes':_0xd6d455[_0x30ae('0x1d')],'include':_0xd6d455[_0x30ae('0x1f')]?_[_0x30ae('0x20')](_0xd6d455[_0x30ae('0x1f')],function(_0x6003ab){return{'model':db[_0x6003ab[_0x30ae('0x21')]],'as':_0x6003ab['as'],'attributes':_0x6003ab[_0x30ae('0x1d')],'include':_0x6003ab['include']?_['map'](_0x6003ab[_0x30ae('0x1f')],function(_0x2e7987){return{'model':db[_0x2e7987[_0x30ae('0x21')]],'as':_0x2e7987['as'],'attributes':_0x2e7987[_0x30ae('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x30ae('0x22')](function(_0x55dacb){logger['info'](_0x30ae('0x23'),_0x21f558);logger[_0x30ae('0x12')](_0x30ae('0x23'),_0x21f558,JSON['stringify'](_0x55dacb));_0x362e25(_0x55dacb);})['catch'](function(_0x5f27f2){logger[_0x30ae('0x14')](_0x30ae('0x23'),_0x5f27f2['message'],_0x21f558);_0xfe743a(_0x57e4d0['error'](0x1f4,_0x5f27f2[_0x30ae('0x16')]));});});};exports[_0x30ae('0x24')]=function(_0x3203ed){var _0x4e2c3c=this;return new Promise(function(_0x304c84,_0x4916cf){return db[_0x30ae('0x18')]['find']({'raw':_0x3203ed[_0x30ae('0x1a')]?_0x3203ed[_0x30ae('0x1a')][_0x30ae('0x1b')]===undefined?!![]:![]:!![],'where':_0x3203ed['options']?_0x3203ed[_0x30ae('0x1a')]['where']||null:null,'attributes':_0x3203ed[_0x30ae('0x1a')]?_0x3203ed[_0x30ae('0x1a')][_0x30ae('0x1d')]||null:null,'include':_0x3203ed['options']?_0x3203ed[_0x30ae('0x1a')][_0x30ae('0x1f')]?_[_0x30ae('0x20')](_0x3203ed['options'][_0x30ae('0x1f')],function(_0x253533){return{'model':db[_0x253533[_0x30ae('0x21')]],'as':_0x253533['as'],'attributes':_0x253533[_0x30ae('0x1d')],'include':_0x253533['include']?_[_0x30ae('0x20')](_0x253533['include'],function(_0x1ef9e0){return{'model':db[_0x1ef9e0['model']],'as':_0x1ef9e0['as'],'attributes':_0x1ef9e0[_0x30ae('0x1d')],'include':_0x1ef9e0[_0x30ae('0x1f')]?_[_0x30ae('0x20')](_0x1ef9e0['include'],function(_0x73659c){return{'model':db[_0x73659c[_0x30ae('0x21')]],'as':_0x73659c['as'],'attributes':_0x73659c[_0x30ae('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x30ae('0x22')](function(_0x253af8){logger[_0x30ae('0x25')](_0x30ae('0x24'),_0x3203ed);logger[_0x30ae('0x12')](_0x30ae('0x24'),_0x3203ed,JSON[_0x30ae('0x26')](_0x253af8));_0x304c84(_0x253af8);})[_0x30ae('0x27')](function(_0x1632e0){logger[_0x30ae('0x14')](_0x30ae('0x24'),_0x1632e0[_0x30ae('0x16')],_0x3203ed);_0x4916cf(_0x4e2c3c[_0x30ae('0x14')](0x1f4,_0x1632e0[_0x30ae('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 0055ad2..7e52ecd 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 _0xa600=['remove','update','register','length','mailQueue:','./mailQueue.events','save'];(function(_0x10ec0f,_0x5ece09){var _0x1587ee=function(_0x54ac17){while(--_0x54ac17){_0x10ec0f['push'](_0x10ec0f['shift']());}};_0x1587ee(++_0x5ece09);}(_0xa600,0xa6));var _0x0a60=function(_0x3818c0,_0x542521){_0x3818c0=_0x3818c0-0x0;var _0x55ec33=_0xa600[_0x3818c0];return _0x55ec33;};'use strict';var MailQueueEvents=require(_0x0a60('0x0'));var events=[_0x0a60('0x1'),_0x0a60('0x2'),_0x0a60('0x3')];function createListener(_0x2b5a49,_0x1afd68){return function(_0x208705){_0x1afd68['emit'](_0x2b5a49,_0x208705);};}function removeListener(_0x195fca,_0x3e3fca){return function(){MailQueueEvents['removeListener'](_0x195fca,_0x3e3fca);};}exports[_0x0a60('0x4')]=function(_0x567613){for(var _0x4109c5=0x0,_0x58295d=events[_0x0a60('0x5')];_0x4109c5<_0x58295d;_0x4109c5++){var _0x59f86d=events[_0x4109c5];var _0x5f2c11=createListener(_0x0a60('0x6')+_0x59f86d,_0x567613);MailQueueEvents['on'](_0x59f86d,_0x5f2c11);}}; \ No newline at end of file +var _0x9809=['length','mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0x9809,0x1da));var _0x9980=function(_0x433695,_0x2fde12){_0x433695=_0x433695-0x0;var _0x26ae65=_0x9809[_0x433695];return _0x26ae65;};'use strict';var MailQueueEvents=require(_0x9980('0x0'));var events=[_0x9980('0x1'),_0x9980('0x2'),_0x9980('0x3')];function createListener(_0x14adcb,_0x1d5a4c){return function(_0x17b1c1){_0x1d5a4c[_0x9980('0x4')](_0x14adcb,_0x17b1c1);};}function removeListener(_0x64b7ec,_0xa65852){return function(){MailQueueEvents[_0x9980('0x5')](_0x64b7ec,_0xa65852);};}exports['register']=function(_0x4017d5){for(var _0x477af4=0x0,_0x55914b=events[_0x9980('0x6')];_0x477af4<_0x55914b;_0x477af4++){var _0x483a59=events[_0x477af4];var _0x283d1f=createListener(_0x9980('0x7')+_0x483a59,_0x4017d5);MailQueueEvents['on'](_0x483a59,_0x283d1f);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 571eeaf..09dfb01 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 _0xcc65=['../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x46df7f,_0x2ef4f2){var _0x7118c4=function(_0x3438e0){while(--_0x3438e0){_0x46df7f['push'](_0x46df7f['shift']());}};_0x7118c4(++_0x2ef4f2);}(_0xcc65,0x13d));var _0x5cc6=function(_0x1da5f4,_0x44bca7){_0x1da5f4=_0x1da5f4-0x0;var _0x58e944=_0xcc65[_0x1da5f4];return _0x58e944;};'use strict';var multer=require(_0x5cc6('0x0'));var util=require(_0x5cc6('0x1'));var path=require(_0x5cc6('0x2'));var timeout=require('connect-timeout');var express=require(_0x5cc6('0x3'));var router=express[_0x5cc6('0x4')]();var fs_extra=require(_0x5cc6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5cc6('0x6'));var controller=require(_0x5cc6('0x7'));router[_0x5cc6('0x8')]('/',auth[_0x5cc6('0x9')](),controller[_0x5cc6('0xa')]);router['get']('/describe',auth[_0x5cc6('0x9')](),controller[_0x5cc6('0xb')]);router[_0x5cc6('0x8')](_0x5cc6('0xc'),auth[_0x5cc6('0x9')](),controller[_0x5cc6('0xd')]);router[_0x5cc6('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5cc6('0xc'),auth[_0x5cc6('0x9')](),controller[_0x5cc6('0xf')]);router[_0x5cc6('0x10')](_0x5cc6('0xc'),auth[_0x5cc6('0x9')](),controller[_0x5cc6('0x11')]);module[_0x5cc6('0x12')]=router; \ No newline at end of file +var _0x8d95=['get','isAuthenticated','/describe','describe','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller'];(function(_0x21ceca,_0x1b8681){var _0x51d866=function(_0x3b1c32){while(--_0x3b1c32){_0x21ceca['push'](_0x21ceca['shift']());}};_0x51d866(++_0x1b8681);}(_0x8d95,0x83));var _0x58d9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8d95[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x58d9('0x0'));var util=require(_0x58d9('0x1'));var path=require('path');var timeout=require(_0x58d9('0x2'));var express=require(_0x58d9('0x3'));var router=express['Router']();var fs_extra=require(_0x58d9('0x4'));var auth=require(_0x58d9('0x5'));var interaction=require(_0x58d9('0x6'));var config=require(_0x58d9('0x7'));var controller=require(_0x58d9('0x8'));router[_0x58d9('0x9')]('/',auth[_0x58d9('0xa')](),controller['index']);router[_0x58d9('0x9')](_0x58d9('0xb'),auth[_0x58d9('0xa')](),controller[_0x58d9('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x58d9('0xa')](),controller[_0x58d9('0xd')]);router[_0x58d9('0xe')](_0x58d9('0xf'),auth[_0x58d9('0xa')](),controller[_0x58d9('0x10')]);router[_0x58d9('0x11')](_0x58d9('0xf'),auth[_0x58d9('0xa')](),controller[_0x58d9('0x12')]);module[_0x58d9('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 7d5bbbe..aa1723d 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 _0x9b5b=['STRING','moment','sequelize','DATE'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9b5b,0x1e1));var _0xb9b5=function(_0x44eb7f,_0x4c7c06){_0x44eb7f=_0x44eb7f-0x0;var _0x5af95a=_0x9b5b[_0x44eb7f];return _0x5af95a;};'use strict';var moment=require(_0xb9b5('0x0'));var Sequelize=require(_0xb9b5('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb9b5('0x2')]},'leaveAt':{'type':Sequelize[_0xb9b5('0x2')]},'acceptAt':{'type':Sequelize[_0xb9b5('0x2')]},'exitAt':{'type':Sequelize[_0xb9b5('0x2')]},'reason':{'type':Sequelize[_0xb9b5('0x3')]}}; \ No newline at end of file +var _0xdabe=['sequelize','exports','STRING','DATE'];(function(_0x1c6860,_0x2bec46){var _0x1c0962=function(_0x5088b8){while(--_0x5088b8){_0x1c6860['push'](_0x1c6860['shift']());}};_0x1c0962(++_0x2bec46);}(_0xdabe,0x1a8));var _0xedab=function(_0x1866b4,_0x157f8c){_0x1866b4=_0x1866b4-0x0;var _0x2fa262=_0xdabe[_0x1866b4];return _0x2fa262;};'use strict';var moment=require('moment');var Sequelize=require(_0xedab('0x0'));module[_0xedab('0x1')]={'uniqueid':{'type':Sequelize[_0xedab('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xedab('0x2')]},'joinAt':{'type':Sequelize[_0xedab('0x3')]},'leaveAt':{'type':Sequelize[_0xedab('0x3')]},'acceptAt':{'type':Sequelize[_0xedab('0x3')]},'exitAt':{'type':Sequelize[_0xedab('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 225a490..3742776 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 _0x430c=['status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','MailQueueReport','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','create','body','update','find','describe','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'];(function(_0x560485,_0x244601){var _0x3e7f69=function(_0x45529f){while(--_0x45529f){_0x560485['push'](_0x560485['shift']());}};_0x3e7f69(++_0x244601);}(_0x430c,0x1a1));var _0xc430=function(_0x2ff739,_0x1c8e0f){_0x2ff739=_0x2ff739-0x0;var _0x12dc13=_0x430c[_0x2ff739];return _0x12dc13;};'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['create']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')](_0x10db27[_0xc430('0x45')],{})['then'](respondWithResult(_0x4eafae,0xc9))[_0xc430('0x40')](handleError(_0x4eafae,null));};exports[_0xc430('0x46')]=function(_0x19e563,_0x549400){if(_0x19e563[_0xc430('0x45')]['id']){delete _0x19e563[_0xc430('0x45')]['id'];}return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x19e563[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x549400,null))[_0xc430('0x1e')](saveUpdates(_0x19e563['body'],null))[_0xc430('0x1e')](respondWithResult(_0x549400,null))[_0xc430('0x40')](handleError(_0x549400,null));};exports[_0xc430('0x1f')]=function(_0x4e9aff,_0x23cb41){return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x4e9aff[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x23cb41,null))[_0xc430('0x1e')](removeEntity(_0x23cb41,null))['catch'](handleError(_0x23cb41,null));};exports[_0xc430('0x48')]=function(_0x214954,_0x2a5143){return db[_0xc430('0x25')][_0xc430('0x48')]()[_0xc430('0x1e')](respondWithResult(_0x2a5143,null))['catch'](handleError(_0x2a5143,null));}; \ No newline at end of file +var _0xeb3b=['destroy','error','stack','name','send','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','MailQueueReport','rawAttributes','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','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','status','end','json','undefined','count','offset','limit','Content-Range','reject','save','then'];(function(_0x4e8c96,_0x17ad41){var _0x44daa4=function(_0x736d9d){while(--_0x736d9d){_0x4e8c96['push'](_0x4e8c96['shift']());}};_0x44daa4(++_0x17ad41);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x54aea3,_0xae7d81){_0x54aea3=_0x54aea3-0x0;var _0x21ae46=_0xeb3b[_0x54aea3];return _0x21ae46;};'use strict';var emlformat=require(_0xbeb3('0x0'));var rimraf=require(_0xbeb3('0x1'));var zipdir=require(_0xbeb3('0x2'));var jsonpatch=require(_0xbeb3('0x3'));var rp=require(_0xbeb3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbeb3('0x5'));var util=require('util');var path=require(_0xbeb3('0x6'));var sox=require('sox');var csv=require(_0xbeb3('0x7'));var ejs=require(_0xbeb3('0x8'));var fs=require('fs');var fs_extra=require(_0xbeb3('0x9'));var _=require(_0xbeb3('0xa'));var squel=require(_0xbeb3('0xb'));var crypto=require(_0xbeb3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbeb3('0xd'));var toCsv=require(_0xbeb3('0x7'));var querystring=require(_0xbeb3('0xe'));var Papa=require(_0xbeb3('0xf'));var Redis=require(_0xbeb3('0x10'));var authService=require(_0xbeb3('0x11'));var qs=require(_0xbeb3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbeb3('0x13'));var logger=require(_0xbeb3('0x14'))('api');var utils=require(_0xbeb3('0x15'));var config=require(_0xbeb3('0x16'));var licenseUtil=require(_0xbeb3('0x17'));var db=require(_0xbeb3('0x18'))['db'];function respondWithStatusCode(_0x19868e,_0x313296){_0x313296=_0x313296||0xcc;return function(_0x5b9ace){if(_0x5b9ace){return _0x19868e['sendStatus'](_0x313296);}return _0x19868e[_0xbeb3('0x19')](_0x313296)[_0xbeb3('0x1a')]();};}function respondWithResult(_0x5f521b,_0x4dfb28){_0x4dfb28=_0x4dfb28||0xc8;return function(_0xed9879){if(_0xed9879){return _0x5f521b[_0xbeb3('0x19')](_0x4dfb28)[_0xbeb3('0x1b')](_0xed9879);}};}function respondWithFilteredResult(_0x43d58a,_0x26daf2){return function(_0x535836){if(_0x535836){var _0x1aeaee=typeof _0x26daf2['offset']===_0xbeb3('0x1c')&&typeof _0x26daf2['limit']==='undefined';var _0x4f8481=_0x535836[_0xbeb3('0x1d')];var _0x44a4bb=_0x1aeaee?0x0:_0x26daf2[_0xbeb3('0x1e')];var _0x10b15d=_0x1aeaee?_0x535836['count']:_0x26daf2[_0xbeb3('0x1e')]+_0x26daf2[_0xbeb3('0x1f')];var _0xe2cc47;if(_0x10b15d>=_0x4f8481){_0x10b15d=_0x4f8481;_0xe2cc47=0xc8;}else{_0xe2cc47=0xce;}_0x43d58a['status'](_0xe2cc47);return _0x43d58a['set'](_0xbeb3('0x20'),_0x44a4bb+'-'+_0x10b15d+'/'+_0x4f8481)['json'](_0x535836);}return null;};}function patchUpdates(_0x1d917b){return function(_0x50b005){try{jsonpatch['apply'](_0x50b005,_0x1d917b,!![]);}catch(_0xfa2736){return BPromise[_0xbeb3('0x21')](_0xfa2736);}return _0x50b005[_0xbeb3('0x22')]();};}function saveUpdates(_0x4bd89e,_0x301899){return function(_0x18ea0f){if(_0x18ea0f){return _0x18ea0f['update'](_0x4bd89e)[_0xbeb3('0x23')](function(_0x366bdb){return _0x366bdb;});}return null;};}function removeEntity(_0x55a59d,_0xfc384a){return function(_0x278fe4){if(_0x278fe4){return _0x278fe4[_0xbeb3('0x24')]()[_0xbeb3('0x23')](function(){_0x55a59d[_0xbeb3('0x19')](0xcc)[_0xbeb3('0x1a')]();});}};}function handleEntityNotFound(_0x84921a,_0x340581){return function(_0x46fe17){if(!_0x46fe17){_0x84921a['sendStatus'](0x194);}return _0x46fe17;};}function handleError(_0x4e695e,_0x1f36b9){_0x1f36b9=_0x1f36b9||0x1f4;return function(_0x520116){logger[_0xbeb3('0x25')](_0x520116[_0xbeb3('0x26')]);if(_0x520116[_0xbeb3('0x27')]){delete _0x520116[_0xbeb3('0x27')];}_0x4e695e['status'](_0x1f36b9)[_0xbeb3('0x28')](_0x520116);};}exports['index']=function(_0x26cd8f,_0xab301c){var _0x5bd93d={},_0x483198={},_0x9b8f13={'count':0x0,'rows':[]};var _0x585c6f=_['map'](db['MailQueueReport']['rawAttributes'],function(_0xf5dbaf){return{'name':_0xf5dbaf['fieldName'],'type':_0xf5dbaf[_0xbeb3('0x29')][_0xbeb3('0x2a')]};});_0x483198[_0xbeb3('0x2b')]=_[_0xbeb3('0x2c')](_0x585c6f,_0xbeb3('0x27'));_0x483198[_0xbeb3('0x2d')]=_[_0xbeb3('0x2e')](_0x26cd8f[_0xbeb3('0x2d')]);_0x483198[_0xbeb3('0x2f')]=_[_0xbeb3('0x30')](_0x483198['model'],_0x483198[_0xbeb3('0x2d')]);_0x5bd93d[_0xbeb3('0x31')]=_['intersection'](_0x483198[_0xbeb3('0x2b')],qs[_0xbeb3('0x32')](_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x32')]));_0x5bd93d['attributes']=_0x5bd93d[_0xbeb3('0x31')][_0xbeb3('0x33')]?_0x5bd93d[_0xbeb3('0x31')]:_0x483198[_0xbeb3('0x2b')];if(!_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x34')](_0xbeb3('0x35'))){_0x5bd93d[_0xbeb3('0x1f')]=qs[_0xbeb3('0x1f')](_0x26cd8f['query'][_0xbeb3('0x1f')]);_0x5bd93d['offset']=qs[_0xbeb3('0x1e')](_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x1e')]);}_0x5bd93d[_0xbeb3('0x36')]=qs[_0xbeb3('0x37')](_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x37')]);_0x5bd93d[_0xbeb3('0x38')]=qs['filters'](_[_0xbeb3('0x39')](_0x26cd8f['query'],_0x483198['filters']),_0x585c6f);if(_0x26cd8f['query'][_0xbeb3('0x3a')]){_0x5bd93d[_0xbeb3('0x38')]=_[_0xbeb3('0x3b')](_0x5bd93d[_0xbeb3('0x38')],{'$or':_[_0xbeb3('0x2c')](_0x585c6f,function(_0x40f166){if(_0x40f166['type']!==_0xbeb3('0x3c')){var _0x40de8d={};_0x40de8d[_0x40f166[_0xbeb3('0x27')]]={'$like':'%'+_0x26cd8f['query']['filter']+'%'};return _0x40de8d;}})});}_0x5bd93d=_['merge']({},_0x5bd93d,_0x26cd8f[_0xbeb3('0x3d')]);var _0x2a8860={'where':_0x5bd93d[_0xbeb3('0x38')]};return db['MailQueueReport'][_0xbeb3('0x1d')](_0x2a8860)['then'](function(_0x1b6700){_0x9b8f13[_0xbeb3('0x1d')]=_0x1b6700;if(_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x3e')]){_0x5bd93d['include']=[{'all':!![]}];}return db['MailQueueReport'][_0xbeb3('0x3f')](_0x5bd93d);})[_0xbeb3('0x23')](function(_0x3d4262){_0x9b8f13[_0xbeb3('0x40')]=_0x3d4262;return _0x9b8f13;})[_0xbeb3('0x23')](respondWithFilteredResult(_0xab301c,_0x5bd93d))[_0xbeb3('0x41')](handleError(_0xab301c,null));};exports[_0xbeb3('0x42')]=function(_0x4606a6,_0x5758c6){var _0xfcb57f={'raw':!![],'where':{'id':_0x4606a6[_0xbeb3('0x43')]['id']}},_0x39f2d2={};_0x39f2d2[_0xbeb3('0x2b')]=_[_0xbeb3('0x2e')](db[_0xbeb3('0x44')][_0xbeb3('0x45')]);_0x39f2d2['query']=_[_0xbeb3('0x2e')](_0x4606a6[_0xbeb3('0x2d')]);_0x39f2d2[_0xbeb3('0x2f')]=_[_0xbeb3('0x30')](_0x39f2d2[_0xbeb3('0x2b')],_0x39f2d2[_0xbeb3('0x2d')]);_0xfcb57f[_0xbeb3('0x31')]=_[_0xbeb3('0x30')](_0x39f2d2[_0xbeb3('0x2b')],qs[_0xbeb3('0x32')](_0x4606a6[_0xbeb3('0x2d')][_0xbeb3('0x32')]));_0xfcb57f[_0xbeb3('0x31')]=_0xfcb57f['attributes'][_0xbeb3('0x33')]?_0xfcb57f[_0xbeb3('0x31')]:_0x39f2d2[_0xbeb3('0x2b')];if(_0x4606a6['query']['includeAll']){_0xfcb57f[_0xbeb3('0x46')]=[{'all':!![]}];}_0xfcb57f=_[_0xbeb3('0x3b')]({},_0xfcb57f,_0x4606a6[_0xbeb3('0x3d')]);return db[_0xbeb3('0x44')]['find'](_0xfcb57f)[_0xbeb3('0x23')](handleEntityNotFound(_0x5758c6,null))['then'](respondWithResult(_0x5758c6,null))['catch'](handleError(_0x5758c6,null));};exports[_0xbeb3('0x47')]=function(_0x393e60,_0x1ff297){return db[_0xbeb3('0x44')]['create'](_0x393e60[_0xbeb3('0x48')],{})[_0xbeb3('0x23')](respondWithResult(_0x1ff297,0xc9))[_0xbeb3('0x41')](handleError(_0x1ff297,null));};exports['update']=function(_0x3f93ab,_0x58c49f){if(_0x3f93ab['body']['id']){delete _0x3f93ab[_0xbeb3('0x48')]['id'];}return db[_0xbeb3('0x44')][_0xbeb3('0x49')]({'where':{'id':_0x3f93ab['params']['id']}})[_0xbeb3('0x23')](handleEntityNotFound(_0x58c49f,null))[_0xbeb3('0x23')](saveUpdates(_0x3f93ab[_0xbeb3('0x48')],null))['then'](respondWithResult(_0x58c49f,null))[_0xbeb3('0x41')](handleError(_0x58c49f,null));};exports['destroy']=function(_0x39605b,_0x4d8e21){return db[_0xbeb3('0x44')][_0xbeb3('0x49')]({'where':{'id':_0x39605b[_0xbeb3('0x43')]['id']}})[_0xbeb3('0x23')](handleEntityNotFound(_0x4d8e21,null))[_0xbeb3('0x23')](removeEntity(_0x4d8e21,null))[_0xbeb3('0x41')](handleError(_0x4d8e21,null));};exports[_0xbeb3('0x4a')]=function(_0x168434,_0x49fded){return db[_0xbeb3('0x44')][_0xbeb3('0x4a')]()[_0xbeb3('0x23')](respondWithResult(_0x49fded,null))[_0xbeb3('0x41')](handleError(_0x49fded,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 7f93c91..ede7f26 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 _0x622b=['./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x399bd4,_0x3c84ab){var _0x12d41b=function(_0x2341dc){while(--_0x2341dc){_0x399bd4['push'](_0x399bd4['shift']());}};_0x12d41b(++_0x3c84ab);}(_0x622b,0x123));var _0xb622=function(_0x1a9c75,_0xa83750){_0x1a9c75=_0x1a9c75-0x0;var _0xb2f37e=_0x622b[_0x1a9c75];return _0xb2f37e;};'use strict';var _=require(_0xb622('0x0'));var util=require(_0xb622('0x1'));var logger=require('../../config/logger')(_0xb622('0x2'));var moment=require(_0xb622('0x3'));var BPromise=require('bluebird');var rp=require(_0xb622('0x4'));var fs=require('fs');var path=require(_0xb622('0x5'));var rimraf=require(_0xb622('0x6'));var config=require(_0xb622('0x7'));var attributes=require(_0xb622('0x8'));module[_0xb622('0x9')]=function(_0x2ca557,_0x2e22e3){return _0x2ca557[_0xb622('0xa')](_0xb622('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb622('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf301=['report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport'];(function(_0x4c2348,_0x4a369b){var _0x4a3717=function(_0x43e9e5){while(--_0x43e9e5){_0x4c2348['push'](_0x4c2348['shift']());}};_0x4a3717(++_0x4a369b);}(_0xf301,0xe2));var _0x1f30=function(_0xa557d,_0x333655){_0xa557d=_0xa557d-0x0;var _0x5f3a1a=_0xf301[_0xa557d];return _0x5f3a1a;};'use strict';var _=require(_0x1f30('0x0'));var util=require(_0x1f30('0x1'));var logger=require(_0x1f30('0x2'))('api');var moment=require(_0x1f30('0x3'));var BPromise=require(_0x1f30('0x4'));var rp=require(_0x1f30('0x5'));var fs=require('fs');var path=require(_0x1f30('0x6'));var rimraf=require(_0x1f30('0x7'));var config=require(_0x1f30('0x8'));var attributes=require(_0x1f30('0x9'));module[_0x1f30('0xa')]=function(_0x2ebf98,_0x12fe2d){return _0x2ebf98['define'](_0x1f30('0xb'),attributes,{'tableName':_0x1f30('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1f30('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 808049c..d9a46f6 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x1938a1,_0x33eb34){var _0x3f8aa0=function(_0x131c44){while(--_0x131c44){_0x1938a1['push'](_0x1938a1['shift']());}};_0x3f8aa0(++_0x33eb34);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3fe7ee,_0x3442ba){_0x3fe7ee=_0x3fe7ee-0x0;var _0x5bab6f=_0x5f2f[_0x3fe7ee];return _0x5bab6f;};'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')]('MailQueueReport,\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);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ 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(_0x121eb4,_0x279712){var _0x1052ef=function(_0x565651){while(--_0x565651){_0x121eb4['push'](_0x121eb4['shift']());}};_0x1052ef(++_0x279712);}(_0xdb28,0x106));var _0x8db2=function(_0x2e8ffa,_0x22a845){_0x2e8ffa=_0x2e8ffa-0x0;var _0x3d25d3=_0xdb28[_0x2e8ffa];return _0x3d25d3;};'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 f7a5572..b68f838 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x28b5f6,_0x2b3749){var _0x40dc83=function(_0x563488){while(--_0x563488){_0x28b5f6['push'](_0x28b5f6['shift']());}};_0x40dc83(++_0x2b3749);}(_0x70e0,0x17b));var _0x070e=function(_0x2ce7f6,_0x1a83d6){_0x2ce7f6=_0x2ce7f6-0x0;var _0x178bcf=_0x70e0[_0x2ce7f6];return _0x178bcf;};'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(_0x3bd138,_0x3b58a6){var _0x58c6e3=function(_0x5aa7f3){while(--_0x5aa7f3){_0x3bd138['push'](_0x3bd138['shift']());}};_0x58c6e3(++_0x3b58a6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0xcb91[_0x340380];return _0x49ce1c;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index a64d39c..25be75b 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 _0xe812=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x8ebc7e,_0x467c1f){var _0x2bc89d=function(_0x47c0e6){while(--_0x47c0e6){_0x8ebc7e['push'](_0x8ebc7e['shift']());}};_0x2bc89d(++_0x467c1f);}(_0xe812,0x1f2));var _0x2e81=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe812[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module[_0x2e81('0x0')]={'description':{'type':Sequelize[_0x2e81('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x2e81('0x1')]},'password':{'type':Sequelize[_0x2e81('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x2e81('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x2e81('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x2e81('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x2e81('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x593e=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x593e,0xcb));var _0xe593=function(_0x40834e,_0x12993f){_0x40834e=_0x40834e-0x0;var _0xd2c6bf=_0x593e[_0x40834e];return _0xd2c6bf;};'use strict';var Sequelize=require(_0xe593('0x0'));module[_0xe593('0x1')]={'description':{'type':Sequelize[_0xe593('0x2')]},'host':{'type':Sequelize[_0xe593('0x2')]},'authentication':{'type':Sequelize[_0xe593('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xe593('0x2')]},'password':{'type':Sequelize[_0xe593('0x2')]},'port':{'type':Sequelize[_0xe593('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe593('0x2')],'defaultValue':_0xe593('0x5')},'connTimeout':{'type':Sequelize[_0xe593('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe593('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xe593('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 0f96b69..f698407 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 _0x18f5=['rimraf','./mailServerIn.attributes','MailServerIn','lodash','util','../../config/logger','api','bluebird','path'];(function(_0xf6763d,_0x1ee231){var _0x212ae2=function(_0x211ed2){while(--_0x211ed2){_0xf6763d['push'](_0xf6763d['shift']());}};_0x212ae2(++_0x1ee231);}(_0x18f5,0x66));var _0x518f=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x18f5[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x518f('0x0'));var util=require(_0x518f('0x1'));var logger=require(_0x518f('0x2'))(_0x518f('0x3'));var moment=require('moment');var BPromise=require(_0x518f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x518f('0x5'));var rimraf=require(_0x518f('0x6'));var config=require('../../config/environment');var attributes=require(_0x518f('0x7'));module['exports']=function(_0x25647f,_0x533f1a){return _0x25647f['define'](_0x518f('0x8'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe584=['mail_servers_in','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','MailServerIn'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xe584,0xbc));var _0x4e58=function(_0x435b2f,_0x4c44da){_0x435b2f=_0x435b2f-0x0;var _0x181648=_0xe584[_0x435b2f];return _0x181648;};'use strict';var _=require('lodash');var util=require(_0x4e58('0x0'));var logger=require(_0x4e58('0x1'))(_0x4e58('0x2'));var moment=require(_0x4e58('0x3'));var BPromise=require(_0x4e58('0x4'));var rp=require(_0x4e58('0x5'));var fs=require('fs');var path=require(_0x4e58('0x6'));var rimraf=require(_0x4e58('0x7'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x42c824,_0xe3a91b){return _0x42c824[_0x4e58('0x8')](_0x4e58('0x9'),attributes,{'tableName':_0x4e58('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 76b4e7f..8983a1a 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 _0x1801=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','MailServerIn','findAll','options','raw','attributes','include','map','model','GetMailServerIn','catch'];(function(_0x16b561,_0x5a914f){var _0x22599f=function(_0x27ce85){while(--_0x27ce85){_0x16b561['push'](_0x16b561['shift']());}};_0x22599f(++_0x5a914f);}(_0x1801,0xc6));var _0x1180=function(_0x4462fe,_0x443c9d){_0x4462fe=_0x4462fe-0x0;var _0x3dd926=_0x1801[_0x4462fe];return _0x3dd926;};'use strict';var _=require(_0x1180('0x0'));var util=require(_0x1180('0x1'));var moment=require(_0x1180('0x2'));var BPromise=require(_0x1180('0x3'));var rs=require(_0x1180('0x4'));var fs=require('fs');var Redis=require(_0x1180('0x5'));var db=require(_0x1180('0x6'))['db'];var utils=require(_0x1180('0x7'));var logger=require(_0x1180('0x8'))(_0x1180('0x9'));var config=require(_0x1180('0xa'));var jayson=require(_0x1180('0xb'));var client=jayson[_0x1180('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f12f5,_0x2b71c0,_0x593af5){return new BPromise(function(_0x53b4f6,_0x2b74b0){return client[_0x1180('0xd')](_0x2f12f5,_0x593af5)[_0x1180('0xe')](function(_0x1b77aa){logger[_0x1180('0xf')](_0x1180('0x10'),_0x2b71c0,_0x1180('0x11'));logger[_0x1180('0x12')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x2b71c0,_0x1180('0x11'),JSON[_0x1180('0x13')](_0x1b77aa));if(_0x1b77aa[_0x1180('0x14')]){if(_0x1b77aa[_0x1180('0x14')][_0x1180('0x15')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x2b71c0,_0x1b77aa[_0x1180('0x14')][_0x1180('0x16')]);return _0x2b74b0(_0x1b77aa[_0x1180('0x14')][_0x1180('0x16')]);}logger[_0x1180('0x14')](_0x1180('0x10'),_0x2b71c0,_0x1b77aa[_0x1180('0x14')][_0x1180('0x16')]);return _0x53b4f6(_0x1b77aa[_0x1180('0x14')][_0x1180('0x16')]);}else{logger[_0x1180('0xf')](_0x1180('0x10'),_0x2b71c0,_0x1180('0x11'));_0x53b4f6(_0x1b77aa['result']['message']);}})['catch'](function(_0x37c513){logger['error'](_0x1180('0x10'),_0x2b71c0,_0x37c513);_0x2b74b0(_0x37c513);});});}exports['GetMailServerIn']=function(_0x11d278){var _0x2d4714=this;return new Promise(function(_0x476375,_0x3c157c){return db[_0x1180('0x17')][_0x1180('0x18')]({'raw':_0x11d278[_0x1180('0x19')]?_0x11d278[_0x1180('0x19')][_0x1180('0x1a')]===undefined?!![]:![]:!![],'where':_0x11d278[_0x1180('0x19')]?_0x11d278[_0x1180('0x19')]['where']||null:null,'attributes':_0x11d278[_0x1180('0x19')]?_0x11d278[_0x1180('0x19')][_0x1180('0x1b')]||null:null,'limit':_0x11d278['options']?_0x11d278[_0x1180('0x19')]['limit']||null:null,'include':_0x11d278[_0x1180('0x19')]?_0x11d278[_0x1180('0x19')][_0x1180('0x1c')]?_[_0x1180('0x1d')](_0x11d278[_0x1180('0x19')]['include'],function(_0x276594){return{'model':db[_0x276594[_0x1180('0x1e')]],'as':_0x276594['as'],'attributes':_0x276594[_0x1180('0x1b')],'include':_0x276594[_0x1180('0x1c')]?_[_0x1180('0x1d')](_0x276594[_0x1180('0x1c')],function(_0x3586ff){return{'model':db[_0x3586ff[_0x1180('0x1e')]],'as':_0x3586ff['as'],'attributes':_0x3586ff['attributes'],'include':_0x3586ff[_0x1180('0x1c')]?_[_0x1180('0x1d')](_0x3586ff[_0x1180('0x1c')],function(_0x712441){return{'model':db[_0x712441[_0x1180('0x1e')]],'as':_0x712441['as'],'attributes':_0x712441['attributes']};}):[]};}):[]};}):[]:[]})[_0x1180('0xe')](function(_0x319426){logger[_0x1180('0xf')](_0x1180('0x1f'),_0x11d278);logger['debug'](_0x1180('0x1f'),_0x11d278,JSON[_0x1180('0x13')](_0x319426));_0x476375(_0x319426);})[_0x1180('0x20')](function(_0x9bec5f){logger[_0x1180('0x14')](_0x1180('0x1f'),_0x9bec5f['message'],_0x11d278);_0x3c157c(_0x2d4714['error'](0x1f4,_0x9bec5f[_0x1180('0x16')]));});});}; \ No newline at end of file +var _0xb821=['MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','MailServerIn','findAll','options','raw','where','attributes','limit','map','model','include','info','GetMailServerIn','catch','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x32a2cf,_0x20b153){var _0x250e9d=function(_0x506bf2){while(--_0x506bf2){_0x32a2cf['push'](_0x32a2cf['shift']());}};_0x250e9d(++_0x20b153);}(_0xb821,0xa7));var _0x1b82=function(_0x54b835,_0x32b109){_0x54b835=_0x54b835-0x0;var _0x385363=_0xb821[_0x54b835];return _0x385363;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});}exports['GetMailServerIn']=function(_0x514082){var _0x415dff=this;return new Promise(function(_0x5d66c3,_0x3def2d){return db[_0x1b82('0x11')][_0x1b82('0x12')]({'raw':_0x514082['options']?_0x514082[_0x1b82('0x13')][_0x1b82('0x14')]===undefined?!![]:![]:!![],'where':_0x514082[_0x1b82('0x13')]?_0x514082[_0x1b82('0x13')][_0x1b82('0x15')]||null:null,'attributes':_0x514082['options']?_0x514082[_0x1b82('0x13')][_0x1b82('0x16')]||null:null,'limit':_0x514082[_0x1b82('0x13')]?_0x514082[_0x1b82('0x13')][_0x1b82('0x17')]||null:null,'include':_0x514082[_0x1b82('0x13')]?_0x514082[_0x1b82('0x13')]['include']?_[_0x1b82('0x18')](_0x514082[_0x1b82('0x13')]['include'],function(_0x561d78){return{'model':db[_0x561d78[_0x1b82('0x19')]],'as':_0x561d78['as'],'attributes':_0x561d78[_0x1b82('0x16')],'include':_0x561d78['include']?_[_0x1b82('0x18')](_0x561d78['include'],function(_0x5cd458){return{'model':db[_0x5cd458['model']],'as':_0x5cd458['as'],'attributes':_0x5cd458[_0x1b82('0x16')],'include':_0x5cd458[_0x1b82('0x1a')]?_[_0x1b82('0x18')](_0x5cd458[_0x1b82('0x1a')],function(_0x548a3b){return{'model':db[_0x548a3b[_0x1b82('0x19')]],'as':_0x548a3b['as'],'attributes':_0x548a3b[_0x1b82('0x16')]};}):[]};}):[]};}):[]:[]})[_0x1b82('0x9')](function(_0x7455e8){logger[_0x1b82('0x1b')](_0x1b82('0x1c'),_0x514082);logger[_0x1b82('0xc')](_0x1b82('0x1c'),_0x514082,JSON[_0x1b82('0xe')](_0x7455e8));_0x5d66c3(_0x7455e8);})[_0x1b82('0x1d')](function(_0x2fe45d){logger[_0x1b82('0xf')](_0x1b82('0x1c'),_0x2fe45d['message'],_0x514082);_0x3def2d(_0x415dff[_0x1b82('0xf')](0x1f4,_0x2fe45d[_0x1b82('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 11f903c..b4f9bbc 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 36b5d08..325f493 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 _0x1b29=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x1b29,0x7f));var _0x91b2=function(_0xd80efe,_0x4fef1e){_0xd80efe=_0xd80efe-0x0;var _0xb4a752=_0x1b29[_0xd80efe];return _0xb4a752;};'use strict';var Sequelize=require(_0x91b2('0x0'));module[_0x91b2('0x1')]={'description':{'type':Sequelize[_0x91b2('0x2')]},'host':{'type':Sequelize[_0x91b2('0x2')]},'user':{'type':Sequelize[_0x91b2('0x2')]},'pass':{'type':Sequelize[_0x91b2('0x2')]},'port':{'type':Sequelize[_0x91b2('0x3')]},'secure':{'type':Sequelize[_0x91b2('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x91b2('0x2')]},'authentication':{'type':Sequelize[_0x91b2('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0295=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0xd40d77,_0x101b68){var _0x5f062a=function(_0x4a2a44){while(--_0x4a2a44){_0xd40d77['push'](_0xd40d77['shift']());}};_0x5f062a(++_0x101b68);}(_0x0295,0x1f0));var _0x5029=function(_0xf61586,_0x56b0c4){_0xf61586=_0xf61586-0x0;var _0x2b6eb3=_0x0295[_0xf61586];return _0x2b6eb3;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5029('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x5029('0x2')]},'secure':{'type':Sequelize[_0x5029('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x5029('0x1')]},'authentication':{'type':Sequelize[_0x5029('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index f7199d7..ca71fef 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 _0x2389=['params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/utils','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','MailServerOut','findAll','catch','show'];(function(_0x3c6178,_0xf58335){var _0x24b697=function(_0xbfcf71){while(--_0xbfcf71){_0x3c6178['push'](_0x3c6178['shift']());}};_0x24b697(++_0xf58335);}(_0x2389,0x121));var _0x9238=function(_0x5e76d2,_0x5ccd14){_0x5e76d2=_0x5e76d2-0x0;var _0x3cfd32=_0x2389[_0x5e76d2];return _0x3cfd32;};'use strict';var emlformat=require(_0x9238('0x0'));var rimraf=require(_0x9238('0x1'));var zipdir=require(_0x9238('0x2'));var jsonpatch=require(_0x9238('0x3'));var rp=require('request-promise');var moment=require(_0x9238('0x4'));var BPromise=require(_0x9238('0x5'));var Mustache=require('mustache');var util=require(_0x9238('0x6'));var path=require(_0x9238('0x7'));var sox=require('sox');var csv=require(_0x9238('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9238('0x9'));var squel=require(_0x9238('0xa'));var crypto=require(_0x9238('0xb'));var jsforce=require(_0x9238('0xc'));var deskjs=require(_0x9238('0xd'));var toCsv=require(_0x9238('0x8'));var querystring=require(_0x9238('0xe'));var Papa=require(_0x9238('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9238('0x10'))('api');var utils=require(_0x9238('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x111aae,_0x341dc9){_0x341dc9=_0x341dc9||0xcc;return function(_0x51f104){if(_0x51f104){return _0x111aae[_0x9238('0x12')](_0x341dc9);}return _0x111aae['status'](_0x341dc9)[_0x9238('0x13')]();};}function respondWithResult(_0xccdf38,_0x2cedf8){_0x2cedf8=_0x2cedf8||0xc8;return function(_0x4037fa){if(_0x4037fa){return _0xccdf38[_0x9238('0x14')](_0x2cedf8)[_0x9238('0x15')](_0x4037fa);}};}function respondWithFilteredResult(_0x373eda,_0x444fa4){return function(_0xb24675){if(_0xb24675){var _0x4e028e=typeof _0x444fa4[_0x9238('0x16')]===_0x9238('0x17')&&typeof _0x444fa4[_0x9238('0x18')]===_0x9238('0x17');var _0x17024f=_0xb24675[_0x9238('0x19')];var _0x592fe1=_0x4e028e?0x0:_0x444fa4[_0x9238('0x16')];var _0x47037d=_0x4e028e?_0xb24675[_0x9238('0x19')]:_0x444fa4[_0x9238('0x16')]+_0x444fa4[_0x9238('0x18')];var _0x249dc5;if(_0x47037d>=_0x17024f){_0x47037d=_0x17024f;_0x249dc5=0xc8;}else{_0x249dc5=0xce;}_0x373eda[_0x9238('0x14')](_0x249dc5);return _0x373eda[_0x9238('0x1a')](_0x9238('0x1b'),_0x592fe1+'-'+_0x47037d+'/'+_0x17024f)[_0x9238('0x15')](_0xb24675);}return null;};}function patchUpdates(_0x135471){return function(_0x5af52f){try{jsonpatch[_0x9238('0x1c')](_0x5af52f,_0x135471,!![]);}catch(_0x429595){return BPromise[_0x9238('0x1d')](_0x429595);}return _0x5af52f[_0x9238('0x1e')]();};}function saveUpdates(_0xa1c9a0,_0x4e5adb){return function(_0x2d9813){if(_0x2d9813){return _0x2d9813[_0x9238('0x1f')](_0xa1c9a0)['then'](function(_0x2138ba){return _0x2138ba;});}return null;};}function removeEntity(_0x51eaa2,_0x56739b){return function(_0x3e79fe){if(_0x3e79fe){return _0x3e79fe[_0x9238('0x20')]()[_0x9238('0x21')](function(){_0x51eaa2[_0x9238('0x14')](0xcc)[_0x9238('0x13')]();});}};}function handleEntityNotFound(_0x388f2e,_0x380e6b){return function(_0x39ce69){if(!_0x39ce69){_0x388f2e[_0x9238('0x12')](0x194);}return _0x39ce69;};}function handleError(_0x3b6f44,_0x3c3b34){_0x3c3b34=_0x3c3b34||0x1f4;return function(_0x5cbd2e){logger[_0x9238('0x22')](_0x5cbd2e[_0x9238('0x23')]);if(_0x5cbd2e[_0x9238('0x24')]){delete _0x5cbd2e[_0x9238('0x24')];}_0x3b6f44[_0x9238('0x14')](_0x3c3b34)[_0x9238('0x25')](_0x5cbd2e);};}exports[_0x9238('0x26')]=function(_0x499fa5,_0x5de533){var _0x58355f={},_0x2a1e96={},_0x36521c={'count':0x0,'rows':[]};var _0x12c222=_[_0x9238('0x27')](db['MailServerOut'][_0x9238('0x28')],function(_0x17c7c6){return{'name':_0x17c7c6[_0x9238('0x29')],'type':_0x17c7c6[_0x9238('0x2a')][_0x9238('0x2b')]};});_0x2a1e96[_0x9238('0x2c')]=_[_0x9238('0x27')](_0x12c222,_0x9238('0x24'));_0x2a1e96[_0x9238('0x2d')]=_[_0x9238('0x2e')](_0x499fa5[_0x9238('0x2d')]);_0x2a1e96[_0x9238('0x2f')]=_['intersection'](_0x2a1e96[_0x9238('0x2c')],_0x2a1e96['query']);_0x58355f['attributes']=_[_0x9238('0x30')](_0x2a1e96[_0x9238('0x2c')],qs[_0x9238('0x31')](_0x499fa5[_0x9238('0x2d')][_0x9238('0x31')]));_0x58355f[_0x9238('0x32')]=_0x58355f[_0x9238('0x32')][_0x9238('0x33')]?_0x58355f[_0x9238('0x32')]:_0x2a1e96[_0x9238('0x2c')];if(!_0x499fa5[_0x9238('0x2d')][_0x9238('0x34')](_0x9238('0x35'))){_0x58355f[_0x9238('0x18')]=qs[_0x9238('0x18')](_0x499fa5[_0x9238('0x2d')][_0x9238('0x18')]);_0x58355f['offset']=qs[_0x9238('0x16')](_0x499fa5['query']['offset']);}_0x58355f[_0x9238('0x36')]=qs[_0x9238('0x37')](_0x499fa5[_0x9238('0x2d')][_0x9238('0x37')]);_0x58355f[_0x9238('0x38')]=qs['filters'](_['pick'](_0x499fa5['query'],_0x2a1e96[_0x9238('0x2f')]),_0x12c222);if(_0x499fa5[_0x9238('0x2d')][_0x9238('0x39')]){_0x58355f[_0x9238('0x38')]=_[_0x9238('0x3a')](_0x58355f[_0x9238('0x38')],{'$or':_[_0x9238('0x27')](_0x12c222,function(_0x4b0fdb){if(_0x4b0fdb[_0x9238('0x2a')]!==_0x9238('0x3b')){var _0xccc3b2={};_0xccc3b2[_0x4b0fdb[_0x9238('0x24')]]={'$like':'%'+_0x499fa5[_0x9238('0x2d')][_0x9238('0x39')]+'%'};return _0xccc3b2;}})});}_0x58355f=_['merge']({},_0x58355f,_0x499fa5[_0x9238('0x3c')]);var _0x140eaa={'where':_0x58355f[_0x9238('0x38')]};return db['MailServerOut'][_0x9238('0x19')](_0x140eaa)[_0x9238('0x21')](function(_0x14806c){_0x36521c[_0x9238('0x19')]=_0x14806c;if(_0x499fa5[_0x9238('0x2d')]['includeAll']){_0x58355f[_0x9238('0x3d')]=[{'all':!![]}];}return db[_0x9238('0x3e')][_0x9238('0x3f')](_0x58355f);})['then'](function(_0x4ee4a4){_0x36521c['rows']=_0x4ee4a4;return _0x36521c;})[_0x9238('0x21')](respondWithFilteredResult(_0x5de533,_0x58355f))[_0x9238('0x40')](handleError(_0x5de533,null));};exports[_0x9238('0x41')]=function(_0x36dc60,_0x52eb78){var _0x39ccd9={'raw':!![],'where':{'id':_0x36dc60[_0x9238('0x42')]['id']}},_0x2456e1={};_0x2456e1[_0x9238('0x2c')]=_[_0x9238('0x2e')](db['MailServerOut'][_0x9238('0x28')]);_0x2456e1['query']=_[_0x9238('0x2e')](_0x36dc60['query']);_0x2456e1[_0x9238('0x2f')]=_['intersection'](_0x2456e1['model'],_0x2456e1[_0x9238('0x2d')]);_0x39ccd9[_0x9238('0x32')]=_['intersection'](_0x2456e1[_0x9238('0x2c')],qs[_0x9238('0x31')](_0x36dc60['query'][_0x9238('0x31')]));_0x39ccd9['attributes']=_0x39ccd9['attributes']['length']?_0x39ccd9[_0x9238('0x32')]:_0x2456e1[_0x9238('0x2c')];if(_0x36dc60[_0x9238('0x2d')][_0x9238('0x43')]){_0x39ccd9[_0x9238('0x3d')]=[{'all':!![]}];}_0x39ccd9=_['merge']({},_0x39ccd9,_0x36dc60[_0x9238('0x3c')]);return db['MailServerOut'][_0x9238('0x44')](_0x39ccd9)[_0x9238('0x21')](handleEntityNotFound(_0x52eb78,null))[_0x9238('0x21')](respondWithResult(_0x52eb78,null))[_0x9238('0x40')](handleError(_0x52eb78,null));};exports[_0x9238('0x45')]=function(_0x14afee,_0x89550e){return db[_0x9238('0x3e')][_0x9238('0x45')](_0x14afee['body'],{})[_0x9238('0x21')](respondWithResult(_0x89550e,0xc9))[_0x9238('0x40')](handleError(_0x89550e,null));};exports[_0x9238('0x1f')]=function(_0x18a87b,_0x1c782a){if(_0x18a87b[_0x9238('0x46')]['id']){delete _0x18a87b[_0x9238('0x46')]['id'];}return db[_0x9238('0x3e')][_0x9238('0x44')]({'where':{'id':_0x18a87b[_0x9238('0x42')]['id']}})[_0x9238('0x21')](handleEntityNotFound(_0x1c782a,null))[_0x9238('0x21')](saveUpdates(_0x18a87b[_0x9238('0x46')],null))[_0x9238('0x21')](respondWithResult(_0x1c782a,null))[_0x9238('0x40')](handleError(_0x1c782a,null));};exports[_0x9238('0x20')]=function(_0xe959b8,_0x22e30a){return db[_0x9238('0x3e')][_0x9238('0x44')]({'where':{'id':_0xe959b8[_0x9238('0x42')]['id']}})[_0x9238('0x21')](handleEntityNotFound(_0x22e30a,null))[_0x9238('0x21')](removeEntity(_0x22e30a,null))['catch'](handleError(_0x22e30a,null));}; \ No newline at end of file +var _0x1bd0=['map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','MailServerOut','findAll','rows','catch','show','includeAll','find','create','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','model'];(function(_0x5073c1,_0x3c0e62){var _0x2f3029=function(_0x246c4f){while(--_0x246c4f){_0x5073c1['push'](_0x5073c1['shift']());}};_0x2f3029(++_0x3c0e62);}(_0x1bd0,0xf7));var _0x01bd=function(_0x3d0002,_0xc001c7){_0x3d0002=_0x3d0002-0x0;var _0x286475=_0x1bd0[_0x3d0002];return _0x286475;};'use strict';var emlformat=require(_0x01bd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x01bd('0x1'));var rp=require(_0x01bd('0x2'));var moment=require(_0x01bd('0x3'));var BPromise=require(_0x01bd('0x4'));var Mustache=require(_0x01bd('0x5'));var util=require(_0x01bd('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x01bd('0x7'));var fs=require('fs');var fs_extra=require(_0x01bd('0x8'));var _=require(_0x01bd('0x9'));var squel=require('squel');var crypto=require(_0x01bd('0xa'));var jsforce=require(_0x01bd('0xb'));var deskjs=require(_0x01bd('0xc'));var toCsv=require(_0x01bd('0xd'));var querystring=require(_0x01bd('0xe'));var Papa=require(_0x01bd('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x01bd('0x10'));var as=require(_0x01bd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x01bd('0x12'))(_0x01bd('0x13'));var utils=require('../../config/utils');var config=require(_0x01bd('0x14'));var licenseUtil=require(_0x01bd('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2aca76,_0x236b72){_0x236b72=_0x236b72||0xcc;return function(_0x4ff028){if(_0x4ff028){return _0x2aca76[_0x01bd('0x16')](_0x236b72);}return _0x2aca76[_0x01bd('0x17')](_0x236b72)['end']();};}function respondWithResult(_0x28b40b,_0x4e0bd4){_0x4e0bd4=_0x4e0bd4||0xc8;return function(_0x143540){if(_0x143540){return _0x28b40b['status'](_0x4e0bd4)[_0x01bd('0x18')](_0x143540);}};}function respondWithFilteredResult(_0x3f626a,_0x4f5a40){return function(_0xff64cc){if(_0xff64cc){var _0x19a522=typeof _0x4f5a40[_0x01bd('0x19')]===_0x01bd('0x1a')&&typeof _0x4f5a40[_0x01bd('0x1b')]===_0x01bd('0x1a');var _0x92e851=_0xff64cc[_0x01bd('0x1c')];var _0x2ebdd6=_0x19a522?0x0:_0x4f5a40[_0x01bd('0x19')];var _0x4568f7=_0x19a522?_0xff64cc['count']:_0x4f5a40[_0x01bd('0x19')]+_0x4f5a40[_0x01bd('0x1b')];var _0x9a1231;if(_0x4568f7>=_0x92e851){_0x4568f7=_0x92e851;_0x9a1231=0xc8;}else{_0x9a1231=0xce;}_0x3f626a[_0x01bd('0x17')](_0x9a1231);return _0x3f626a['set'](_0x01bd('0x1d'),_0x2ebdd6+'-'+_0x4568f7+'/'+_0x92e851)[_0x01bd('0x18')](_0xff64cc);}return null;};}function patchUpdates(_0xaa8b3c){return function(_0x2473e3){try{jsonpatch[_0x01bd('0x1e')](_0x2473e3,_0xaa8b3c,!![]);}catch(_0x19fcfe){return BPromise[_0x01bd('0x1f')](_0x19fcfe);}return _0x2473e3[_0x01bd('0x20')]();};}function saveUpdates(_0x5e7469,_0x37a841){return function(_0x3c358b){if(_0x3c358b){return _0x3c358b[_0x01bd('0x21')](_0x5e7469)[_0x01bd('0x22')](function(_0xe2ae12){return _0xe2ae12;});}return null;};}function removeEntity(_0x349bba,_0x391433){return function(_0x14f4f5){if(_0x14f4f5){return _0x14f4f5[_0x01bd('0x23')]()['then'](function(){_0x349bba[_0x01bd('0x17')](0xcc)[_0x01bd('0x24')]();});}};}function handleEntityNotFound(_0x9f3970,_0x2d837f){return function(_0x596b9a){if(!_0x596b9a){_0x9f3970[_0x01bd('0x16')](0x194);}return _0x596b9a;};}function handleError(_0x284abe,_0x3a2640){_0x3a2640=_0x3a2640||0x1f4;return function(_0x371f8b){logger[_0x01bd('0x25')](_0x371f8b[_0x01bd('0x26')]);if(_0x371f8b[_0x01bd('0x27')]){delete _0x371f8b[_0x01bd('0x27')];}_0x284abe[_0x01bd('0x17')](_0x3a2640)['send'](_0x371f8b);};}exports[_0x01bd('0x28')]=function(_0x17ac2c,_0x121fd2){var _0x55310a={},_0x2aa83c={},_0x5619e1={'count':0x0,'rows':[]};var _0x1b9d10=_['map'](db['MailServerOut'][_0x01bd('0x29')],function(_0x349072){return{'name':_0x349072[_0x01bd('0x2a')],'type':_0x349072[_0x01bd('0x2b')]['key']};});_0x2aa83c[_0x01bd('0x2c')]=_[_0x01bd('0x2d')](_0x1b9d10,_0x01bd('0x27'));_0x2aa83c[_0x01bd('0x2e')]=_[_0x01bd('0x2f')](_0x17ac2c['query']);_0x2aa83c['filters']=_[_0x01bd('0x30')](_0x2aa83c[_0x01bd('0x2c')],_0x2aa83c[_0x01bd('0x2e')]);_0x55310a[_0x01bd('0x31')]=_[_0x01bd('0x30')](_0x2aa83c[_0x01bd('0x2c')],qs[_0x01bd('0x32')](_0x17ac2c[_0x01bd('0x2e')][_0x01bd('0x32')]));_0x55310a[_0x01bd('0x31')]=_0x55310a[_0x01bd('0x31')][_0x01bd('0x33')]?_0x55310a[_0x01bd('0x31')]:_0x2aa83c[_0x01bd('0x2c')];if(!_0x17ac2c[_0x01bd('0x2e')][_0x01bd('0x34')](_0x01bd('0x35'))){_0x55310a[_0x01bd('0x1b')]=qs['limit'](_0x17ac2c['query'][_0x01bd('0x1b')]);_0x55310a[_0x01bd('0x19')]=qs[_0x01bd('0x19')](_0x17ac2c[_0x01bd('0x2e')]['offset']);}_0x55310a['order']=qs['sort'](_0x17ac2c['query'][_0x01bd('0x36')]);_0x55310a[_0x01bd('0x37')]=qs[_0x01bd('0x38')](_[_0x01bd('0x39')](_0x17ac2c[_0x01bd('0x2e')],_0x2aa83c[_0x01bd('0x38')]),_0x1b9d10);if(_0x17ac2c[_0x01bd('0x2e')][_0x01bd('0x3a')]){_0x55310a['where']=_[_0x01bd('0x3b')](_0x55310a['where'],{'$or':_[_0x01bd('0x2d')](_0x1b9d10,function(_0x381b30){if(_0x381b30[_0x01bd('0x2b')]!==_0x01bd('0x3c')){var _0x5666a1={};_0x5666a1[_0x381b30[_0x01bd('0x27')]]={'$like':'%'+_0x17ac2c['query'][_0x01bd('0x3a')]+'%'};return _0x5666a1;}})});}_0x55310a=_[_0x01bd('0x3b')]({},_0x55310a,_0x17ac2c[_0x01bd('0x3d')]);var _0x2f4bd4={'where':_0x55310a['where']};return db['MailServerOut'][_0x01bd('0x1c')](_0x2f4bd4)[_0x01bd('0x22')](function(_0x35ed5f){_0x5619e1[_0x01bd('0x1c')]=_0x35ed5f;if(_0x17ac2c[_0x01bd('0x2e')]['includeAll']){_0x55310a[_0x01bd('0x3e')]=[{'all':!![]}];}return db[_0x01bd('0x3f')][_0x01bd('0x40')](_0x55310a);})[_0x01bd('0x22')](function(_0x20ed8a){_0x5619e1[_0x01bd('0x41')]=_0x20ed8a;return _0x5619e1;})[_0x01bd('0x22')](respondWithFilteredResult(_0x121fd2,_0x55310a))[_0x01bd('0x42')](handleError(_0x121fd2,null));};exports[_0x01bd('0x43')]=function(_0x412132,_0x829563){var _0x117530={'raw':!![],'where':{'id':_0x412132['params']['id']}},_0x2097ec={};_0x2097ec['model']=_[_0x01bd('0x2f')](db[_0x01bd('0x3f')][_0x01bd('0x29')]);_0x2097ec[_0x01bd('0x2e')]=_[_0x01bd('0x2f')](_0x412132[_0x01bd('0x2e')]);_0x2097ec['filters']=_[_0x01bd('0x30')](_0x2097ec[_0x01bd('0x2c')],_0x2097ec[_0x01bd('0x2e')]);_0x117530[_0x01bd('0x31')]=_[_0x01bd('0x30')](_0x2097ec['model'],qs[_0x01bd('0x32')](_0x412132[_0x01bd('0x2e')]['fields']));_0x117530[_0x01bd('0x31')]=_0x117530[_0x01bd('0x31')][_0x01bd('0x33')]?_0x117530[_0x01bd('0x31')]:_0x2097ec[_0x01bd('0x2c')];if(_0x412132['query'][_0x01bd('0x44')]){_0x117530['include']=[{'all':!![]}];}_0x117530=_['merge']({},_0x117530,_0x412132[_0x01bd('0x3d')]);return db['MailServerOut'][_0x01bd('0x45')](_0x117530)[_0x01bd('0x22')](handleEntityNotFound(_0x829563,null))[_0x01bd('0x22')](respondWithResult(_0x829563,null))[_0x01bd('0x42')](handleError(_0x829563,null));};exports[_0x01bd('0x46')]=function(_0x83c152,_0x23ecf7){return db[_0x01bd('0x3f')][_0x01bd('0x46')](_0x83c152[_0x01bd('0x47')],{})[_0x01bd('0x22')](respondWithResult(_0x23ecf7,0xc9))[_0x01bd('0x42')](handleError(_0x23ecf7,null));};exports[_0x01bd('0x21')]=function(_0x2ea854,_0x254549){if(_0x2ea854[_0x01bd('0x47')]['id']){delete _0x2ea854[_0x01bd('0x47')]['id'];}return db[_0x01bd('0x3f')][_0x01bd('0x45')]({'where':{'id':_0x2ea854[_0x01bd('0x48')]['id']}})['then'](handleEntityNotFound(_0x254549,null))[_0x01bd('0x22')](saveUpdates(_0x2ea854['body'],null))['then'](respondWithResult(_0x254549,null))[_0x01bd('0x42')](handleError(_0x254549,null));};exports[_0x01bd('0x23')]=function(_0x4b521f,_0x23aff1){return db[_0x01bd('0x3f')]['find']({'where':{'id':_0x4b521f['params']['id']}})[_0x01bd('0x22')](handleEntityNotFound(_0x23aff1,null))[_0x01bd('0x22')](removeEntity(_0x23aff1,null))['catch'](handleError(_0x23aff1,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 31dd392..d3acdea 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 _0x2705=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','lodash'];(function(_0x301da3,_0x42d24d){var _0x465048=function(_0x5bcf41){while(--_0x5bcf41){_0x301da3['push'](_0x301da3['shift']());}};_0x465048(++_0x42d24d);}(_0x2705,0x1b7));var _0x5270=function(_0x2976c5,_0x1065e1){_0x2976c5=_0x2976c5-0x0;var _0x1e404f=_0x2705[_0x2976c5];return _0x1e404f;};'use strict';var _=require(_0x5270('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5270('0x1'));var moment=require(_0x5270('0x2'));var BPromise=require(_0x5270('0x3'));var rp=require(_0x5270('0x4'));var fs=require('fs');var path=require(_0x5270('0x5'));var rimraf=require(_0x5270('0x6'));var config=require(_0x5270('0x7'));var attributes=require(_0x5270('0x8'));module[_0x5270('0x9')]=function(_0x56e1e0,_0xd26f25){return _0x56e1e0['define'](_0x5270('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d9a=['api','moment','bluebird','request-promise','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','../../config/logger'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x8d9a,0x1d2));var _0xa8d9=function(_0x32889b,_0x381a08){_0x32889b=_0x32889b-0x0;var _0xdc1a12=_0x8d9a[_0x32889b];return _0xdc1a12;};'use strict';var _=require(_0xa8d9('0x0'));var util=require('util');var logger=require(_0xa8d9('0x1'))(_0xa8d9('0x2'));var moment=require(_0xa8d9('0x3'));var BPromise=require(_0xa8d9('0x4'));var rp=require(_0xa8d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa8d9('0x6'));var attributes=require(_0xa8d9('0x7'));module[_0xa8d9('0x8')]=function(_0x2f2900,_0x2cbe68){return _0x2f2900[_0xa8d9('0x9')](_0xa8d9('0xa'),attributes,{'tableName':_0xa8d9('0xb'),'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 31202e1..cb3e02b 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x11fc21,_0x44172d){var _0x3829d1=function(_0x1c01c7){while(--_0x1c01c7){_0x11fc21['push'](_0x11fc21['shift']());}};_0x3829d1(++_0x44172d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _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(_0x2e4c1f,_0xf0766){var _0x5b1837=function(_0x1c455a){while(--_0x1c455a){_0x2e4c1f['push'](_0x2e4c1f['shift']());}};_0x5b1837(++_0xf0766);}(_0x1261,0x144));var _0x1126=function(_0x1e9992,_0x24a7db){_0x1e9992=_0x1e9992-0x0;var _0x4204e2=_0x1261[_0x1e9992];return _0x4204e2;};'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 6df241f..e61f897 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 _0x2122=['get','/describe','describe','/:id','show','post','create','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2122,0x105));var _0x2212=function(_0x47d606,_0x4fa6b6){_0x47d606=_0x47d606-0x0;var _0x1520be=_0x2122[_0x47d606];return _0x1520be;};'use strict';var multer=require('multer');var util=require(_0x2212('0x0'));var path=require(_0x2212('0x1'));var timeout=require(_0x2212('0x2'));var express=require(_0x2212('0x3'));var router=express[_0x2212('0x4')]();var fs_extra=require(_0x2212('0x5'));var auth=require(_0x2212('0x6'));var interaction=require(_0x2212('0x7'));var config=require(_0x2212('0x8'));var controller=require(_0x2212('0x9'));router['get']('/',auth[_0x2212('0xa')](),controller[_0x2212('0xb')]);router[_0x2212('0xc')](_0x2212('0xd'),auth['isAuthenticated'](),controller[_0x2212('0xe')]);router[_0x2212('0xc')](_0x2212('0xf'),auth[_0x2212('0xa')](),controller[_0x2212('0x10')]);router[_0x2212('0x11')]('/',auth['isAuthenticated'](),controller[_0x2212('0x12')]);router['put'](_0x2212('0xf'),auth['isAuthenticated'](),controller[_0x2212('0x13')]);router['delete'](_0x2212('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x2212('0x14')]=router; \ No newline at end of file +var _0x8057=['put','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x8057,0x8f));var _0x7805=function(_0x587004,_0x2540f8){_0x587004=_0x587004-0x0;var _0x46d357=_0x8057[_0x587004];return _0x46d357;};'use strict';var multer=require(_0x7805('0x0'));var util=require('util');var path=require(_0x7805('0x1'));var timeout=require(_0x7805('0x2'));var express=require(_0x7805('0x3'));var router=express[_0x7805('0x4')]();var fs_extra=require(_0x7805('0x5'));var auth=require(_0x7805('0x6'));var interaction=require(_0x7805('0x7'));var config=require(_0x7805('0x8'));var controller=require(_0x7805('0x9'));router[_0x7805('0xa')]('/',auth[_0x7805('0xb')](),controller[_0x7805('0xc')]);router['get']('/describe',auth[_0x7805('0xb')](),controller['describe']);router[_0x7805('0xa')](_0x7805('0xd'),auth['isAuthenticated'](),controller[_0x7805('0xe')]);router[_0x7805('0xf')]('/',auth[_0x7805('0xb')](),controller[_0x7805('0x10')]);router[_0x7805('0x11')](_0x7805('0xd'),auth[_0x7805('0xb')](),controller['update']);router['delete']('/:id',auth[_0x7805('0xb')](),controller[_0x7805('0x12')]);module[_0x7805('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 52554ca..7ddf51b 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 _0x236d=['sequelize','exports','name'];(function(_0x204ad4,_0x502841){var _0x50675f=function(_0x30ad49){while(--_0x30ad49){_0x204ad4['push'](_0x204ad4['shift']());}};_0x50675f(++_0x502841);}(_0x236d,0x7e));var _0xd236=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x236d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd236('0x0'));module[_0xd236('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd236('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3f8a=['name','sequelize','exports','STRING'];(function(_0x40f31a,_0x1fe2e8){var _0x49226b=function(_0x35ef44){while(--_0x35ef44){_0x40f31a['push'](_0x40f31a['shift']());}};_0x49226b(++_0x1fe2e8);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3ef5e4,_0x562317){_0x3ef5e4=_0x3ef5e4-0x0;var _0x10e5d3=_0x3f8a[_0x3ef5e4];return _0x10e5d3;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'unique':_0xa3f8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 697bd78..d375785 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 _0xb39b=['fieldName','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','rawAttributes','intersection','fields','find','create','body','update','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','MailSubstatus'];(function(_0x51232b,_0xa2b031){var _0x49f71d=function(_0x1cc5d6){while(--_0x1cc5d6){_0x51232b['push'](_0x51232b['shift']());}};_0x49f71d(++_0xa2b031);}(_0xb39b,0xae));var _0xbb39=function(_0x49a850,_0x34b712){_0x49a850=_0x49a850-0x0;var _0x30caea=_0xb39b[_0x49a850];return _0x30caea;};'use strict';var emlformat=require(_0xbb39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb39('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb39('0x2'));var moment=require('moment');var BPromise=require(_0xbb39('0x3'));var Mustache=require(_0xbb39('0x4'));var util=require(_0xbb39('0x5'));var path=require(_0xbb39('0x6'));var sox=require(_0xbb39('0x7'));var csv=require(_0xbb39('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbb39('0x9'));var crypto=require(_0xbb39('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbb39('0xb'));var toCsv=require(_0xbb39('0x8'));var querystring=require(_0xbb39('0xc'));var Papa=require('papaparse');var Redis=require(_0xbb39('0xd'));var authService=require(_0xbb39('0xe'));var qs=require(_0xbb39('0xf'));var as=require(_0xbb39('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb39('0x11'))(_0xbb39('0x12'));var utils=require(_0xbb39('0x13'));var config=require(_0xbb39('0x14'));var licenseUtil=require(_0xbb39('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fc76a,_0x1e7761){_0x1e7761=_0x1e7761||0xcc;return function(_0x1e0429){if(_0x1e0429){return _0x1fc76a[_0xbb39('0x16')](_0x1e7761);}return _0x1fc76a[_0xbb39('0x17')](_0x1e7761)[_0xbb39('0x18')]();};}function respondWithResult(_0x5cd91f,_0x38521d){_0x38521d=_0x38521d||0xc8;return function(_0x2c4152){if(_0x2c4152){return _0x5cd91f['status'](_0x38521d)[_0xbb39('0x19')](_0x2c4152);}};}function respondWithFilteredResult(_0x5c2a9e,_0x2cd2ed){return function(_0x48b63b){if(_0x48b63b){var _0x3da784=typeof _0x2cd2ed[_0xbb39('0x1a')]===_0xbb39('0x1b')&&typeof _0x2cd2ed[_0xbb39('0x1c')]===_0xbb39('0x1b');var _0x1a4087=_0x48b63b[_0xbb39('0x1d')];var _0x1368b2=_0x3da784?0x0:_0x2cd2ed[_0xbb39('0x1a')];var _0x273642=_0x3da784?_0x48b63b[_0xbb39('0x1d')]:_0x2cd2ed['offset']+_0x2cd2ed['limit'];var _0x573bfa;if(_0x273642>=_0x1a4087){_0x273642=_0x1a4087;_0x573bfa=0xc8;}else{_0x573bfa=0xce;}_0x5c2a9e[_0xbb39('0x17')](_0x573bfa);return _0x5c2a9e[_0xbb39('0x1e')](_0xbb39('0x1f'),_0x1368b2+'-'+_0x273642+'/'+_0x1a4087)[_0xbb39('0x19')](_0x48b63b);}return null;};}function patchUpdates(_0x498208){return function(_0x54f93b){try{jsonpatch[_0xbb39('0x20')](_0x54f93b,_0x498208,!![]);}catch(_0x452c53){return BPromise[_0xbb39('0x21')](_0x452c53);}return _0x54f93b['save']();};}function saveUpdates(_0x4e9821,_0x3d23cd){return function(_0x1508f6){if(_0x1508f6){return _0x1508f6['update'](_0x4e9821)[_0xbb39('0x22')](function(_0x3ca2cf){return _0x3ca2cf;});}return null;};}function removeEntity(_0x5cab6e,_0x12e3f0){return function(_0x3b7725){if(_0x3b7725){return _0x3b7725[_0xbb39('0x23')]()[_0xbb39('0x22')](function(){_0x5cab6e['status'](0xcc)[_0xbb39('0x18')]();});}};}function handleEntityNotFound(_0x33277b,_0x29a63b){return function(_0x331cd9){if(!_0x331cd9){_0x33277b['sendStatus'](0x194);}return _0x331cd9;};}function handleError(_0x3f5ef3,_0x4014c5){_0x4014c5=_0x4014c5||0x1f4;return function(_0x18bd9d){logger[_0xbb39('0x24')](_0x18bd9d['stack']);if(_0x18bd9d[_0xbb39('0x25')]){delete _0x18bd9d[_0xbb39('0x25')];}_0x3f5ef3[_0xbb39('0x17')](_0x4014c5)[_0xbb39('0x26')](_0x18bd9d);};}exports[_0xbb39('0x27')]=function(_0x2eec9c,_0x56c2e7){var _0x326c20={},_0x1c471c={},_0x6eec9d={'count':0x0,'rows':[]};var _0x1b0c84=_[_0xbb39('0x28')](db[_0xbb39('0x29')]['rawAttributes'],function(_0x2d8a44){return{'name':_0x2d8a44[_0xbb39('0x2a')],'type':_0x2d8a44['type']['key']};});_0x1c471c[_0xbb39('0x2b')]=_[_0xbb39('0x28')](_0x1b0c84,_0xbb39('0x25'));_0x1c471c[_0xbb39('0x2c')]=_[_0xbb39('0x2d')](_0x2eec9c[_0xbb39('0x2c')]);_0x1c471c[_0xbb39('0x2e')]=_['intersection'](_0x1c471c[_0xbb39('0x2b')],_0x1c471c['query']);_0x326c20['attributes']=_['intersection'](_0x1c471c[_0xbb39('0x2b')],qs['fields'](_0x2eec9c['query']['fields']));_0x326c20[_0xbb39('0x2f')]=_0x326c20[_0xbb39('0x2f')][_0xbb39('0x30')]?_0x326c20[_0xbb39('0x2f')]:_0x1c471c['model'];if(!_0x2eec9c[_0xbb39('0x2c')][_0xbb39('0x31')](_0xbb39('0x32'))){_0x326c20[_0xbb39('0x1c')]=qs[_0xbb39('0x1c')](_0x2eec9c[_0xbb39('0x2c')][_0xbb39('0x1c')]);_0x326c20[_0xbb39('0x1a')]=qs['offset'](_0x2eec9c[_0xbb39('0x2c')][_0xbb39('0x1a')]);}_0x326c20['order']=qs[_0xbb39('0x33')](_0x2eec9c['query'][_0xbb39('0x33')]);_0x326c20[_0xbb39('0x34')]=qs[_0xbb39('0x2e')](_[_0xbb39('0x35')](_0x2eec9c['query'],_0x1c471c['filters']),_0x1b0c84);if(_0x2eec9c[_0xbb39('0x2c')][_0xbb39('0x36')]){_0x326c20[_0xbb39('0x34')]=_[_0xbb39('0x37')](_0x326c20[_0xbb39('0x34')],{'$or':_[_0xbb39('0x28')](_0x1b0c84,function(_0x298932){if(_0x298932[_0xbb39('0x38')]!=='VIRTUAL'){var _0x5839d3={};_0x5839d3[_0x298932[_0xbb39('0x25')]]={'$like':'%'+_0x2eec9c[_0xbb39('0x2c')][_0xbb39('0x36')]+'%'};return _0x5839d3;}})});}_0x326c20=_['merge']({},_0x326c20,_0x2eec9c[_0xbb39('0x39')]);var _0x29635d={'where':_0x326c20['where']};return db[_0xbb39('0x29')]['count'](_0x29635d)['then'](function(_0x243cc1){_0x6eec9d[_0xbb39('0x1d')]=_0x243cc1;if(_0x2eec9c[_0xbb39('0x2c')][_0xbb39('0x3a')]){_0x326c20[_0xbb39('0x3b')]=[{'all':!![]}];}return db[_0xbb39('0x29')]['findAll'](_0x326c20);})[_0xbb39('0x22')](function(_0x4d3db8){_0x6eec9d[_0xbb39('0x3c')]=_0x4d3db8;return _0x6eec9d;})[_0xbb39('0x22')](respondWithFilteredResult(_0x56c2e7,_0x326c20))[_0xbb39('0x3d')](handleError(_0x56c2e7,null));};exports[_0xbb39('0x3e')]=function(_0x2d69ca,_0x9dbe82){var _0x54ee17={'raw':!![],'where':{'id':_0x2d69ca[_0xbb39('0x3f')]['id']}},_0x184b79={};_0x184b79[_0xbb39('0x2b')]=_[_0xbb39('0x2d')](db[_0xbb39('0x29')][_0xbb39('0x40')]);_0x184b79['query']=_[_0xbb39('0x2d')](_0x2d69ca[_0xbb39('0x2c')]);_0x184b79[_0xbb39('0x2e')]=_[_0xbb39('0x41')](_0x184b79[_0xbb39('0x2b')],_0x184b79[_0xbb39('0x2c')]);_0x54ee17['attributes']=_['intersection'](_0x184b79[_0xbb39('0x2b')],qs[_0xbb39('0x42')](_0x2d69ca[_0xbb39('0x2c')][_0xbb39('0x42')]));_0x54ee17['attributes']=_0x54ee17['attributes'][_0xbb39('0x30')]?_0x54ee17['attributes']:_0x184b79[_0xbb39('0x2b')];if(_0x2d69ca[_0xbb39('0x2c')][_0xbb39('0x3a')]){_0x54ee17[_0xbb39('0x3b')]=[{'all':!![]}];}_0x54ee17=_[_0xbb39('0x37')]({},_0x54ee17,_0x2d69ca[_0xbb39('0x39')]);return db[_0xbb39('0x29')][_0xbb39('0x43')](_0x54ee17)['then'](handleEntityNotFound(_0x9dbe82,null))[_0xbb39('0x22')](respondWithResult(_0x9dbe82,null))[_0xbb39('0x3d')](handleError(_0x9dbe82,null));};exports[_0xbb39('0x44')]=function(_0x37e4e8,_0x50d7e7){return db[_0xbb39('0x29')][_0xbb39('0x44')](_0x37e4e8[_0xbb39('0x45')],{})['then'](respondWithResult(_0x50d7e7,0xc9))[_0xbb39('0x3d')](handleError(_0x50d7e7,null));};exports[_0xbb39('0x46')]=function(_0x28c7e5,_0x532c60){if(_0x28c7e5['body']['id']){delete _0x28c7e5[_0xbb39('0x45')]['id'];}return db[_0xbb39('0x29')][_0xbb39('0x43')]({'where':{'id':_0x28c7e5['params']['id']}})[_0xbb39('0x22')](handleEntityNotFound(_0x532c60,null))[_0xbb39('0x22')](saveUpdates(_0x28c7e5['body'],null))[_0xbb39('0x22')](respondWithResult(_0x532c60,null))[_0xbb39('0x3d')](handleError(_0x532c60,null));};exports[_0xbb39('0x23')]=function(_0x407356,_0x55fef3){return db[_0xbb39('0x29')]['find']({'where':{'id':_0x407356['params']['id']}})[_0xbb39('0x22')](handleEntityNotFound(_0x55fef3,null))[_0xbb39('0x22')](removeEntity(_0x55fef3,null))[_0xbb39('0x3d')](handleError(_0x55fef3,null));};exports[_0xbb39('0x47')]=function(_0xe7dc1d,_0x1d4847){return db[_0xbb39('0x29')]['describe']()['then'](respondWithResult(_0x1d4847,null))[_0xbb39('0x3d')](handleError(_0x1d4847,null));}; \ No newline at end of file +var _0x77b3=['hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','MailSubstatus','count','includeAll','include','catch','params','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','Content-Range','json','apply','reject','save','update','then','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length'];(function(_0x21ef3c,_0x14fdfe){var _0x2f8c52=function(_0x31491f){while(--_0x31491f){_0x21ef3c['push'](_0x21ef3c['shift']());}};_0x2f8c52(++_0x14fdfe);}(_0x77b3,0xe4));var _0x377b=function(_0x2f727b,_0x33b2cd){_0x2f727b=_0x2f727b-0x0;var _0x260f8e=_0x77b3[_0x2f727b];return _0x260f8e;};'use strict';var emlformat=require(_0x377b('0x0'));var rimraf=require(_0x377b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x377b('0x2'));var moment=require(_0x377b('0x3'));var BPromise=require(_0x377b('0x4'));var Mustache=require(_0x377b('0x5'));var util=require(_0x377b('0x6'));var path=require(_0x377b('0x7'));var sox=require('sox');var csv=require(_0x377b('0x8'));var ejs=require(_0x377b('0x9'));var fs=require('fs');var fs_extra=require(_0x377b('0xa'));var _=require(_0x377b('0xb'));var squel=require('squel');var crypto=require(_0x377b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x377b('0xd'));var toCsv=require(_0x377b('0x8'));var querystring=require(_0x377b('0xe'));var Papa=require('papaparse');var Redis=require(_0x377b('0xf'));var authService=require(_0x377b('0x10'));var qs=require(_0x377b('0x11'));var as=require(_0x377b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x377b('0x13'));var utils=require(_0x377b('0x14'));var config=require(_0x377b('0x15'));var licenseUtil=require(_0x377b('0x16'));var db=require(_0x377b('0x17'))['db'];function respondWithStatusCode(_0x34583c,_0x3c7af4){_0x3c7af4=_0x3c7af4||0xcc;return function(_0x1d046f){if(_0x1d046f){return _0x34583c[_0x377b('0x18')](_0x3c7af4);}return _0x34583c['status'](_0x3c7af4)[_0x377b('0x19')]();};}function respondWithResult(_0x4e4204,_0x26e6f5){_0x26e6f5=_0x26e6f5||0xc8;return function(_0x59c69f){if(_0x59c69f){return _0x4e4204[_0x377b('0x1a')](_0x26e6f5)['json'](_0x59c69f);}};}function respondWithFilteredResult(_0x34b285,_0x16efac){return function(_0x146166){if(_0x146166){var _0x5a34ed=typeof _0x16efac[_0x377b('0x1b')]===_0x377b('0x1c')&&typeof _0x16efac[_0x377b('0x1d')]==='undefined';var _0x1ab2b6=_0x146166['count'];var _0x23cb80=_0x5a34ed?0x0:_0x16efac[_0x377b('0x1b')];var _0x5458a4=_0x5a34ed?_0x146166['count']:_0x16efac['offset']+_0x16efac[_0x377b('0x1d')];var _0x4ea74c;if(_0x5458a4>=_0x1ab2b6){_0x5458a4=_0x1ab2b6;_0x4ea74c=0xc8;}else{_0x4ea74c=0xce;}_0x34b285[_0x377b('0x1a')](_0x4ea74c);return _0x34b285['set'](_0x377b('0x1e'),_0x23cb80+'-'+_0x5458a4+'/'+_0x1ab2b6)[_0x377b('0x1f')](_0x146166);}return null;};}function patchUpdates(_0xeaa1ba){return function(_0x1652da){try{jsonpatch[_0x377b('0x20')](_0x1652da,_0xeaa1ba,!![]);}catch(_0x16a5d0){return BPromise[_0x377b('0x21')](_0x16a5d0);}return _0x1652da[_0x377b('0x22')]();};}function saveUpdates(_0x58d207,_0x204f5a){return function(_0x4caac7){if(_0x4caac7){return _0x4caac7[_0x377b('0x23')](_0x58d207)[_0x377b('0x24')](function(_0x244522){return _0x244522;});}return null;};}function removeEntity(_0x43994b,_0x3881c7){return function(_0x41b0ad){if(_0x41b0ad){return _0x41b0ad['destroy']()['then'](function(){_0x43994b['status'](0xcc)[_0x377b('0x19')]();});}};}function handleEntityNotFound(_0x17ba50,_0x171d6e){return function(_0x512c56){if(!_0x512c56){_0x17ba50[_0x377b('0x18')](0x194);}return _0x512c56;};}function handleError(_0x266e8d,_0x47eebb){_0x47eebb=_0x47eebb||0x1f4;return function(_0x3ce96c){logger['error'](_0x3ce96c[_0x377b('0x25')]);if(_0x3ce96c[_0x377b('0x26')]){delete _0x3ce96c[_0x377b('0x26')];}_0x266e8d['status'](_0x47eebb)[_0x377b('0x27')](_0x3ce96c);};}exports['index']=function(_0x1b77a0,_0x11908e){var _0x99bc13={},_0x3303e8={},_0xd3cc79={'count':0x0,'rows':[]};var _0x1d55fd=_[_0x377b('0x28')](db['MailSubstatus'][_0x377b('0x29')],function(_0x15ce1b){return{'name':_0x15ce1b[_0x377b('0x2a')],'type':_0x15ce1b[_0x377b('0x2b')]['key']};});_0x3303e8['model']=_[_0x377b('0x28')](_0x1d55fd,_0x377b('0x26'));_0x3303e8[_0x377b('0x2c')]=_[_0x377b('0x2d')](_0x1b77a0[_0x377b('0x2c')]);_0x3303e8[_0x377b('0x2e')]=_[_0x377b('0x2f')](_0x3303e8[_0x377b('0x30')],_0x3303e8[_0x377b('0x2c')]);_0x99bc13['attributes']=_[_0x377b('0x2f')](_0x3303e8[_0x377b('0x30')],qs[_0x377b('0x31')](_0x1b77a0[_0x377b('0x2c')][_0x377b('0x31')]));_0x99bc13['attributes']=_0x99bc13[_0x377b('0x32')][_0x377b('0x33')]?_0x99bc13[_0x377b('0x32')]:_0x3303e8[_0x377b('0x30')];if(!_0x1b77a0['query'][_0x377b('0x34')](_0x377b('0x35'))){_0x99bc13[_0x377b('0x1d')]=qs[_0x377b('0x1d')](_0x1b77a0[_0x377b('0x2c')][_0x377b('0x1d')]);_0x99bc13[_0x377b('0x1b')]=qs[_0x377b('0x1b')](_0x1b77a0[_0x377b('0x2c')]['offset']);}_0x99bc13[_0x377b('0x36')]=qs[_0x377b('0x37')](_0x1b77a0[_0x377b('0x2c')][_0x377b('0x37')]);_0x99bc13['where']=qs[_0x377b('0x2e')](_['pick'](_0x1b77a0[_0x377b('0x2c')],_0x3303e8[_0x377b('0x2e')]),_0x1d55fd);if(_0x1b77a0[_0x377b('0x2c')][_0x377b('0x38')]){_0x99bc13[_0x377b('0x39')]=_['merge'](_0x99bc13[_0x377b('0x39')],{'$or':_[_0x377b('0x28')](_0x1d55fd,function(_0x425fbd){if(_0x425fbd[_0x377b('0x2b')]!==_0x377b('0x3a')){var _0x1514c8={};_0x1514c8[_0x425fbd[_0x377b('0x26')]]={'$like':'%'+_0x1b77a0[_0x377b('0x2c')][_0x377b('0x38')]+'%'};return _0x1514c8;}})});}_0x99bc13=_['merge']({},_0x99bc13,_0x1b77a0[_0x377b('0x3b')]);var _0x56d37c={'where':_0x99bc13[_0x377b('0x39')]};return db[_0x377b('0x3c')][_0x377b('0x3d')](_0x56d37c)['then'](function(_0x23e101){_0xd3cc79[_0x377b('0x3d')]=_0x23e101;if(_0x1b77a0[_0x377b('0x2c')][_0x377b('0x3e')]){_0x99bc13[_0x377b('0x3f')]=[{'all':!![]}];}return db[_0x377b('0x3c')]['findAll'](_0x99bc13);})[_0x377b('0x24')](function(_0x2338ee){_0xd3cc79['rows']=_0x2338ee;return _0xd3cc79;})[_0x377b('0x24')](respondWithFilteredResult(_0x11908e,_0x99bc13))[_0x377b('0x40')](handleError(_0x11908e,null));};exports['show']=function(_0x11fcd4,_0x360f11){var _0x459df4={'raw':!![],'where':{'id':_0x11fcd4[_0x377b('0x41')]['id']}},_0x1e3916={};_0x1e3916[_0x377b('0x30')]=_[_0x377b('0x2d')](db[_0x377b('0x3c')][_0x377b('0x29')]);_0x1e3916[_0x377b('0x2c')]=_['keys'](_0x11fcd4['query']);_0x1e3916[_0x377b('0x2e')]=_[_0x377b('0x2f')](_0x1e3916['model'],_0x1e3916[_0x377b('0x2c')]);_0x459df4[_0x377b('0x32')]=_[_0x377b('0x2f')](_0x1e3916[_0x377b('0x30')],qs['fields'](_0x11fcd4[_0x377b('0x2c')][_0x377b('0x31')]));_0x459df4[_0x377b('0x32')]=_0x459df4[_0x377b('0x32')]['length']?_0x459df4[_0x377b('0x32')]:_0x1e3916[_0x377b('0x30')];if(_0x11fcd4['query'][_0x377b('0x3e')]){_0x459df4[_0x377b('0x3f')]=[{'all':!![]}];}_0x459df4=_['merge']({},_0x459df4,_0x11fcd4[_0x377b('0x3b')]);return db['MailSubstatus'][_0x377b('0x42')](_0x459df4)[_0x377b('0x24')](handleEntityNotFound(_0x360f11,null))[_0x377b('0x24')](respondWithResult(_0x360f11,null))[_0x377b('0x40')](handleError(_0x360f11,null));};exports[_0x377b('0x43')]=function(_0x3afeee,_0x1758cd){return db[_0x377b('0x3c')][_0x377b('0x43')](_0x3afeee[_0x377b('0x44')],{})['then'](respondWithResult(_0x1758cd,0xc9))[_0x377b('0x40')](handleError(_0x1758cd,null));};exports[_0x377b('0x23')]=function(_0x5261b5,_0x2741f6){if(_0x5261b5[_0x377b('0x44')]['id']){delete _0x5261b5['body']['id'];}return db[_0x377b('0x3c')][_0x377b('0x42')]({'where':{'id':_0x5261b5[_0x377b('0x41')]['id']}})[_0x377b('0x24')](handleEntityNotFound(_0x2741f6,null))['then'](saveUpdates(_0x5261b5[_0x377b('0x44')],null))[_0x377b('0x24')](respondWithResult(_0x2741f6,null))[_0x377b('0x40')](handleError(_0x2741f6,null));};exports['destroy']=function(_0x36ad4a,_0x12b236){return db['MailSubstatus'][_0x377b('0x42')]({'where':{'id':_0x36ad4a['params']['id']}})[_0x377b('0x24')](handleEntityNotFound(_0x12b236,null))[_0x377b('0x24')](removeEntity(_0x12b236,null))[_0x377b('0x40')](handleError(_0x12b236,null));};exports[_0x377b('0x45')]=function(_0x57b2f2,_0x3f6531){return db[_0x377b('0x3c')][_0x377b('0x45')]()['then'](respondWithResult(_0x3f6531,null))[_0x377b('0x40')](handleError(_0x3f6531,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 1feb349..e00b463 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 _0xc502=['MailSubstatus','mail_substatuses','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./mailSubstatus.attributes','exports','define'];(function(_0x46046b,_0xce2c78){var _0x4a4984=function(_0x1f031e){while(--_0x1f031e){_0x46046b['push'](_0x46046b['shift']());}};_0x4a4984(++_0xce2c78);}(_0xc502,0xf2));var _0x2c50=function(_0x5e6aad,_0x3cdddd){_0x5e6aad=_0x5e6aad-0x0;var _0x55deab=_0xc502[_0x5e6aad];return _0x55deab;};'use strict';var _=require('lodash');var util=require(_0x2c50('0x0'));var logger=require(_0x2c50('0x1'))('api');var moment=require(_0x2c50('0x2'));var BPromise=require(_0x2c50('0x3'));var rp=require(_0x2c50('0x4'));var fs=require('fs');var path=require(_0x2c50('0x5'));var rimraf=require(_0x2c50('0x6'));var config=require('../../config/environment');var attributes=require(_0x2c50('0x7'));module[_0x2c50('0x8')]=function(_0x86a060,_0x1f6070){return _0x86a060[_0x2c50('0x9')](_0x2c50('0xa'),attributes,{'tableName':_0x2c50('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35b5=['./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1b0391,_0x77f637){var _0x4e9765=function(_0x3af47a){while(--_0x3af47a){_0x1b0391['push'](_0x1b0391['shift']());}};_0x4e9765(++_0x77f637);}(_0x35b5,0xe6));var _0x535b=function(_0x2e30d7,_0x2dfa9c){_0x2e30d7=_0x2e30d7-0x0;var _0x49a35b=_0x35b5[_0x2e30d7];return _0x49a35b;};'use strict';var _=require(_0x535b('0x0'));var util=require(_0x535b('0x1'));var logger=require(_0x535b('0x2'))(_0x535b('0x3'));var moment=require(_0x535b('0x4'));var BPromise=require(_0x535b('0x5'));var rp=require(_0x535b('0x6'));var fs=require('fs');var path=require(_0x535b('0x7'));var rimraf=require(_0x535b('0x8'));var config=require(_0x535b('0x9'));var attributes=require(_0x535b('0xa'));module[_0x535b('0xb')]=function(_0x2962b0,_0x34b4c4){return _0x2962b0[_0x535b('0xc')](_0x535b('0xd'),attributes,{'tableName':_0x535b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index d888ab8..af8d1a1 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 _0xe86d=['code','MailSubstatus,\x20%s,\x20%s','message','result','catch','util','moment','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0xe86d,0x71));var _0xde86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe86d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xde86('0x0'));var moment=require(_0xde86('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xde86('0x2'));var logger=require(_0xde86('0x3'))('rpc');var config=require(_0xde86('0x4'));var jayson=require(_0xde86('0x5'));var client=jayson[_0xde86('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c01da,_0x57af4d,_0x42c9e5){return new BPromise(function(_0x2a506f,_0xb6ec07){return client[_0xde86('0x7')](_0x1c01da,_0x42c9e5)['then'](function(_0x3ec8de){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x57af4d,_0xde86('0x8'));logger[_0xde86('0x9')](_0xde86('0xa'),_0x57af4d,_0xde86('0x8'),JSON[_0xde86('0xb')](_0x3ec8de));if(_0x3ec8de['error']){if(_0x3ec8de[_0xde86('0xc')][_0xde86('0xd')]===0x1f4){logger[_0xde86('0xc')](_0xde86('0xe'),_0x57af4d,_0x3ec8de['error']['message']);return _0xb6ec07(_0x3ec8de[_0xde86('0xc')][_0xde86('0xf')]);}logger['error'](_0xde86('0xe'),_0x57af4d,_0x3ec8de['error'][_0xde86('0xf')]);return _0x2a506f(_0x3ec8de[_0xde86('0xc')][_0xde86('0xf')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x57af4d,_0xde86('0x8'));_0x2a506f(_0x3ec8de[_0xde86('0x10')][_0xde86('0xf')]);}})[_0xde86('0x11')](function(_0x1ad51e){logger['error'](_0xde86('0xe'),_0x57af4d,_0x1ad51e);_0xb6ec07(_0x1ad51e);});});} \ No newline at end of file +var _0x49aa=['rpc','jayson/promise','client','http','request','then','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','MailSubstatus,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3782f1,_0xdb9da7){var _0x59aa2c=function(_0x3ecfb1){while(--_0x3ecfb1){_0x3782f1['push'](_0x3782f1['shift']());}};_0x59aa2c(++_0xdb9da7);}(_0x49aa,0x1ad));var _0xa49a=function(_0x9a71e6,_0x17f10c){_0x9a71e6=_0x9a71e6-0x0;var _0x25f77c=_0x49aa[_0x9a71e6];return _0x25f77c;};'use strict';var _=require(_0xa49a('0x0'));var util=require(_0xa49a('0x1'));var moment=require(_0xa49a('0x2'));var BPromise=require(_0xa49a('0x3'));var rs=require(_0xa49a('0x4'));var fs=require('fs');var Redis=require(_0xa49a('0x5'));var db=require(_0xa49a('0x6'))['db'];var utils=require(_0xa49a('0x7'));var logger=require('../../config/logger')(_0xa49a('0x8'));var config=require('../../config/environment');var jayson=require(_0xa49a('0x9'));var client=jayson[_0xa49a('0xa')][_0xa49a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a7f10,_0x248133,_0x1976f7){return new BPromise(function(_0x168a39,_0x47bf72){return client[_0xa49a('0xc')](_0x3a7f10,_0x1976f7)[_0xa49a('0xd')](function(_0x4c3260){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x248133,_0xa49a('0xe'));logger['debug'](_0xa49a('0xf'),_0x248133,'request\x20sent',JSON['stringify'](_0x4c3260));if(_0x4c3260[_0xa49a('0x10')]){if(_0x4c3260['error'][_0xa49a('0x11')]===0x1f4){logger['error'](_0xa49a('0x12'),_0x248133,_0x4c3260[_0xa49a('0x10')][_0xa49a('0x13')]);return _0x47bf72(_0x4c3260['error'][_0xa49a('0x13')]);}logger[_0xa49a('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x248133,_0x4c3260[_0xa49a('0x10')]['message']);return _0x168a39(_0x4c3260['error']['message']);}else{logger[_0xa49a('0x14')](_0xa49a('0x12'),_0x248133,'request\x20sent');_0x168a39(_0x4c3260[_0xa49a('0x15')][_0xa49a('0x13')]);}})[_0xa49a('0x16')](function(_0x428cd0){logger[_0xa49a('0x10')](_0xa49a('0x12'),_0x248133,_0x428cd0);_0x47bf72(_0x428cd0);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 30144f7..f651957 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 _0x3af7=['/describe','describe','/:id','post','create','update','delete','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index'];(function(_0x1bba12,_0x5ae732){var _0x227069=function(_0x216614){while(--_0x216614){_0x1bba12['push'](_0x1bba12['shift']());}};_0x227069(++_0x5ae732);}(_0x3af7,0x73));var _0x73af=function(_0x373c76,_0x58d485){_0x373c76=_0x373c76-0x0;var _0x1a576c=_0x3af7[_0x373c76];return _0x1a576c;};'use strict';var multer=require(_0x73af('0x0'));var util=require(_0x73af('0x1'));var path=require(_0x73af('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x73af('0x3'));var auth=require(_0x73af('0x4'));var interaction=require(_0x73af('0x5'));var config=require(_0x73af('0x6'));var controller=require(_0x73af('0x7'));router[_0x73af('0x8')]('/',auth[_0x73af('0x9')](),controller[_0x73af('0xa')]);router[_0x73af('0x8')](_0x73af('0xb'),auth['isAuthenticated'](),controller[_0x73af('0xc')]);router[_0x73af('0x8')](_0x73af('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x73af('0xe')]('/',auth['isAuthenticated'](),controller[_0x73af('0xf')]);router['put'](_0x73af('0xd'),auth[_0x73af('0x9')](),controller[_0x73af('0x10')]);router[_0x73af('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8902=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x4b35b6,_0x297824){var _0x149c96=function(_0x5dd2bd){while(--_0x5dd2bd){_0x4b35b6['push'](_0x4b35b6['shift']());}};_0x149c96(++_0x297824);}(_0x8902,0x16f));var _0x2890=function(_0x53aba6,_0x174496){_0x53aba6=_0x53aba6-0x0;var _0x320506=_0x8902[_0x53aba6];return _0x320506;};'use strict';var multer=require(_0x2890('0x0'));var util=require(_0x2890('0x1'));var path=require(_0x2890('0x2'));var timeout=require('connect-timeout');var express=require(_0x2890('0x3'));var router=express[_0x2890('0x4')]();var fs_extra=require(_0x2890('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2890('0x6'));var config=require(_0x2890('0x7'));var controller=require('./mailTransferReport.controller');router[_0x2890('0x8')]('/',auth[_0x2890('0x9')](),controller[_0x2890('0xa')]);router[_0x2890('0x8')]('/describe',auth[_0x2890('0x9')](),controller[_0x2890('0xb')]);router['get'](_0x2890('0xc'),auth['isAuthenticated'](),controller[_0x2890('0xd')]);router[_0x2890('0xe')]('/',auth[_0x2890('0x9')](),controller[_0x2890('0xf')]);router[_0x2890('0x10')](_0x2890('0xc'),auth[_0x2890('0x9')](),controller[_0x2890('0x11')]);router[_0x2890('0x12')](_0x2890('0xc'),auth[_0x2890('0x9')](),controller[_0x2890('0x13')]);module[_0x2890('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 94d02ea..90a786d 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x18c494,_0x423ceb){var _0x3c925f=function(_0x46a991){while(--_0x46a991){_0x18c494['push'](_0x18c494['shift']());}};_0x3c925f(++_0x423ceb);}(_0x70e0,0x17b));var _0x070e=function(_0x485d48,_0x3fa6f5){_0x485d48=_0x485d48-0x0;var _0x23cdf3=_0x70e0[_0x485d48];return _0x23cdf3;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x2c684a,_0x1a8030){var _0xc553b7=function(_0x5227ac){while(--_0x5227ac){_0x2c684a['push'](_0x2c684a['shift']());}};_0xc553b7(++_0x1a8030);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 13dc610..8f5c5fb 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 _0xe90b=['name','send','index','map','MailTransferReport','rawAttributes','fieldName','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','findAll','rows','catch','show','params','includeAll','options','find','create','body','describe','rimraf','zip-dir','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/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack'];(function(_0x3934f8,_0x13da84){var _0x524334=function(_0x5982bb){while(--_0x5982bb){_0x3934f8['push'](_0x3934f8['shift']());}};_0x524334(++_0x13da84);}(_0xe90b,0x1a5));var _0xbe90=function(_0x21fccf,_0x5e80b6){_0x21fccf=_0x21fccf-0x0;var _0x2f990d=_0xe90b[_0x21fccf];return _0x2f990d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe90('0x0'));var zipdir=require(_0xbe90('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe90('0x2'));var moment=require(_0xbe90('0x3'));var BPromise=require(_0xbe90('0x4'));var Mustache=require('mustache');var util=require(_0xbe90('0x5'));var path=require(_0xbe90('0x6'));var sox=require(_0xbe90('0x7'));var csv=require(_0xbe90('0x8'));var ejs=require(_0xbe90('0x9'));var fs=require('fs');var fs_extra=require(_0xbe90('0xa'));var _=require(_0xbe90('0xb'));var squel=require(_0xbe90('0xc'));var crypto=require(_0xbe90('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbe90('0xe'));var toCsv=require(_0xbe90('0x8'));var querystring=require(_0xbe90('0xf'));var Papa=require(_0xbe90('0x10'));var Redis=require(_0xbe90('0x11'));var authService=require(_0xbe90('0x12'));var qs=require(_0xbe90('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe90('0x14'))(_0xbe90('0x15'));var utils=require(_0xbe90('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbe90('0x17'));var db=require(_0xbe90('0x18'))['db'];function respondWithStatusCode(_0x1dfdfc,_0x5dfa40){_0x5dfa40=_0x5dfa40||0xcc;return function(_0x4de59f){if(_0x4de59f){return _0x1dfdfc[_0xbe90('0x19')](_0x5dfa40);}return _0x1dfdfc[_0xbe90('0x1a')](_0x5dfa40)['end']();};}function respondWithResult(_0x5293be,_0x334802){_0x334802=_0x334802||0xc8;return function(_0x4ab6d5){if(_0x4ab6d5){return _0x5293be['status'](_0x334802)[_0xbe90('0x1b')](_0x4ab6d5);}};}function respondWithFilteredResult(_0x14e724,_0x3aff36){return function(_0x3e5b85){if(_0x3e5b85){var _0x4d6651=typeof _0x3aff36[_0xbe90('0x1c')]===_0xbe90('0x1d')&&typeof _0x3aff36[_0xbe90('0x1e')]===_0xbe90('0x1d');var _0x17aad2=_0x3e5b85[_0xbe90('0x1f')];var _0x5c521f=_0x4d6651?0x0:_0x3aff36[_0xbe90('0x1c')];var _0x11685b=_0x4d6651?_0x3e5b85['count']:_0x3aff36[_0xbe90('0x1c')]+_0x3aff36[_0xbe90('0x1e')];var _0x4c0d0c;if(_0x11685b>=_0x17aad2){_0x11685b=_0x17aad2;_0x4c0d0c=0xc8;}else{_0x4c0d0c=0xce;}_0x14e724[_0xbe90('0x1a')](_0x4c0d0c);return _0x14e724[_0xbe90('0x20')](_0xbe90('0x21'),_0x5c521f+'-'+_0x11685b+'/'+_0x17aad2)[_0xbe90('0x1b')](_0x3e5b85);}return null;};}function patchUpdates(_0x4b9d9f){return function(_0x54d1eb){try{jsonpatch['apply'](_0x54d1eb,_0x4b9d9f,!![]);}catch(_0x4e5f37){return BPromise[_0xbe90('0x22')](_0x4e5f37);}return _0x54d1eb[_0xbe90('0x23')]();};}function saveUpdates(_0x3b1b73,_0x20d387){return function(_0xaf6766){if(_0xaf6766){return _0xaf6766[_0xbe90('0x24')](_0x3b1b73)[_0xbe90('0x25')](function(_0x4ab116){return _0x4ab116;});}return null;};}function removeEntity(_0x3676b2,_0xafcb5){return function(_0x3dac90){if(_0x3dac90){return _0x3dac90[_0xbe90('0x26')]()[_0xbe90('0x25')](function(){_0x3676b2[_0xbe90('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14b2a2,_0x580371){return function(_0x179b31){if(!_0x179b31){_0x14b2a2['sendStatus'](0x194);}return _0x179b31;};}function handleError(_0x32a9e9,_0xfb54fa){_0xfb54fa=_0xfb54fa||0x1f4;return function(_0x4df056){logger[_0xbe90('0x27')](_0x4df056[_0xbe90('0x28')]);if(_0x4df056[_0xbe90('0x29')]){delete _0x4df056[_0xbe90('0x29')];}_0x32a9e9[_0xbe90('0x1a')](_0xfb54fa)[_0xbe90('0x2a')](_0x4df056);};}exports[_0xbe90('0x2b')]=function(_0x1a7223,_0x3f24f1){var _0x43f55f={},_0x268454={},_0x584f8e={'count':0x0,'rows':[]};var _0x1efd62=_[_0xbe90('0x2c')](db[_0xbe90('0x2d')][_0xbe90('0x2e')],function(_0x2f3d18){return{'name':_0x2f3d18[_0xbe90('0x2f')],'type':_0x2f3d18['type'][_0xbe90('0x30')]};});_0x268454['model']=_[_0xbe90('0x2c')](_0x1efd62,_0xbe90('0x29'));_0x268454['query']=_[_0xbe90('0x31')](_0x1a7223['query']);_0x268454[_0xbe90('0x32')]=_[_0xbe90('0x33')](_0x268454[_0xbe90('0x34')],_0x268454[_0xbe90('0x35')]);_0x43f55f[_0xbe90('0x36')]=_[_0xbe90('0x33')](_0x268454['model'],qs[_0xbe90('0x37')](_0x1a7223[_0xbe90('0x35')][_0xbe90('0x37')]));_0x43f55f[_0xbe90('0x36')]=_0x43f55f['attributes'][_0xbe90('0x38')]?_0x43f55f[_0xbe90('0x36')]:_0x268454[_0xbe90('0x34')];if(!_0x1a7223[_0xbe90('0x35')][_0xbe90('0x39')](_0xbe90('0x3a'))){_0x43f55f[_0xbe90('0x1e')]=qs['limit'](_0x1a7223[_0xbe90('0x35')][_0xbe90('0x1e')]);_0x43f55f['offset']=qs[_0xbe90('0x1c')](_0x1a7223[_0xbe90('0x35')][_0xbe90('0x1c')]);}_0x43f55f[_0xbe90('0x3b')]=qs['sort'](_0x1a7223['query'][_0xbe90('0x3c')]);_0x43f55f[_0xbe90('0x3d')]=qs[_0xbe90('0x32')](_['pick'](_0x1a7223['query'],_0x268454['filters']),_0x1efd62);if(_0x1a7223[_0xbe90('0x35')][_0xbe90('0x3e')]){_0x43f55f[_0xbe90('0x3d')]=_[_0xbe90('0x3f')](_0x43f55f[_0xbe90('0x3d')],{'$or':_[_0xbe90('0x2c')](_0x1efd62,function(_0x191ed4){if(_0x191ed4[_0xbe90('0x40')]!==_0xbe90('0x41')){var _0x1cac0f={};_0x1cac0f[_0x191ed4[_0xbe90('0x29')]]={'$like':'%'+_0x1a7223['query']['filter']+'%'};return _0x1cac0f;}})});}_0x43f55f=_[_0xbe90('0x3f')]({},_0x43f55f,_0x1a7223['options']);var _0x7f00aa={'where':_0x43f55f[_0xbe90('0x3d')]};return db['MailTransferReport'][_0xbe90('0x1f')](_0x7f00aa)[_0xbe90('0x25')](function(_0x4b0029){_0x584f8e[_0xbe90('0x1f')]=_0x4b0029;if(_0x1a7223[_0xbe90('0x35')]['includeAll']){_0x43f55f['include']=[{'all':!![]}];}return db['MailTransferReport'][_0xbe90('0x42')](_0x43f55f);})[_0xbe90('0x25')](function(_0x1e0e6b){_0x584f8e[_0xbe90('0x43')]=_0x1e0e6b;return _0x584f8e;})['then'](respondWithFilteredResult(_0x3f24f1,_0x43f55f))[_0xbe90('0x44')](handleError(_0x3f24f1,null));};exports[_0xbe90('0x45')]=function(_0x3130ec,_0x35c174){var _0x352232={'raw':!![],'where':{'id':_0x3130ec[_0xbe90('0x46')]['id']}},_0x3f5163={};_0x3f5163[_0xbe90('0x34')]=_[_0xbe90('0x31')](db[_0xbe90('0x2d')]['rawAttributes']);_0x3f5163[_0xbe90('0x35')]=_[_0xbe90('0x31')](_0x3130ec['query']);_0x3f5163[_0xbe90('0x32')]=_['intersection'](_0x3f5163[_0xbe90('0x34')],_0x3f5163[_0xbe90('0x35')]);_0x352232[_0xbe90('0x36')]=_['intersection'](_0x3f5163['model'],qs[_0xbe90('0x37')](_0x3130ec[_0xbe90('0x35')]['fields']));_0x352232[_0xbe90('0x36')]=_0x352232[_0xbe90('0x36')][_0xbe90('0x38')]?_0x352232[_0xbe90('0x36')]:_0x3f5163[_0xbe90('0x34')];if(_0x3130ec['query'][_0xbe90('0x47')]){_0x352232['include']=[{'all':!![]}];}_0x352232=_['merge']({},_0x352232,_0x3130ec[_0xbe90('0x48')]);return db[_0xbe90('0x2d')][_0xbe90('0x49')](_0x352232)[_0xbe90('0x25')](handleEntityNotFound(_0x35c174,null))['then'](respondWithResult(_0x35c174,null))[_0xbe90('0x44')](handleError(_0x35c174,null));};exports[_0xbe90('0x4a')]=function(_0x195c0b,_0x3b4b0c){return db['MailTransferReport']['create'](_0x195c0b[_0xbe90('0x4b')],{})[_0xbe90('0x25')](respondWithResult(_0x3b4b0c,0xc9))[_0xbe90('0x44')](handleError(_0x3b4b0c,null));};exports[_0xbe90('0x24')]=function(_0x17fe7b,_0xed291){if(_0x17fe7b['body']['id']){delete _0x17fe7b[_0xbe90('0x4b')]['id'];}return db[_0xbe90('0x2d')][_0xbe90('0x49')]({'where':{'id':_0x17fe7b[_0xbe90('0x46')]['id']}})['then'](handleEntityNotFound(_0xed291,null))['then'](saveUpdates(_0x17fe7b[_0xbe90('0x4b')],null))['then'](respondWithResult(_0xed291,null))['catch'](handleError(_0xed291,null));};exports[_0xbe90('0x26')]=function(_0xb3ffa0,_0x3342fb){return db[_0xbe90('0x2d')][_0xbe90('0x49')]({'where':{'id':_0xb3ffa0[_0xbe90('0x46')]['id']}})['then'](handleEntityNotFound(_0x3342fb,null))[_0xbe90('0x25')](removeEntity(_0x3342fb,null))[_0xbe90('0x44')](handleError(_0x3342fb,null));};exports[_0xbe90('0x4c')]=function(_0xef1868,_0x52bbd0){return db[_0xbe90('0x2d')]['describe']()['then'](respondWithResult(_0x52bbd0,null))[_0xbe90('0x44')](handleError(_0x52bbd0,null));}; \ No newline at end of file +var _0x5a22=['destroy','end','error','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a22,0x133));var _0x25a2=function(_0x22f75e,_0x4a9e06){_0x22f75e=_0x22f75e-0x0;var _0x1f6ab3=_0x5a22[_0x22f75e];return _0x1f6ab3;};'use strict';var emlformat=require(_0x25a2('0x0'));var rimraf=require(_0x25a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x25a2('0x2'));var moment=require(_0x25a2('0x3'));var BPromise=require(_0x25a2('0x4'));var Mustache=require(_0x25a2('0x5'));var util=require(_0x25a2('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x25a2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x25a2('0x8'));var jsforce=require(_0x25a2('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x25a2('0xa'));var Papa=require(_0x25a2('0xb'));var Redis=require(_0x25a2('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x25a2('0xd'));var as=require(_0x25a2('0xe'));var hardwareService=require(_0x25a2('0xf'));var logger=require(_0x25a2('0x10'))(_0x25a2('0x11'));var utils=require('../../config/utils');var config=require(_0x25a2('0x12'));var licenseUtil=require(_0x25a2('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x164f5d,_0x59de34){_0x59de34=_0x59de34||0xcc;return function(_0x2adadf){if(_0x2adadf){return _0x164f5d[_0x25a2('0x14')](_0x59de34);}return _0x164f5d[_0x25a2('0x15')](_0x59de34)['end']();};}function respondWithResult(_0x45b127,_0x2052c6){_0x2052c6=_0x2052c6||0xc8;return function(_0x5f3974){if(_0x5f3974){return _0x45b127['status'](_0x2052c6)[_0x25a2('0x16')](_0x5f3974);}};}function respondWithFilteredResult(_0x4fa26b,_0x47b5ac){return function(_0x5ec453){if(_0x5ec453){var _0x3c4b89=typeof _0x47b5ac[_0x25a2('0x17')]===_0x25a2('0x18')&&typeof _0x47b5ac[_0x25a2('0x19')]===_0x25a2('0x18');var _0xa26399=_0x5ec453[_0x25a2('0x1a')];var _0x316429=_0x3c4b89?0x0:_0x47b5ac[_0x25a2('0x17')];var _0x2bed02=_0x3c4b89?_0x5ec453[_0x25a2('0x1a')]:_0x47b5ac['offset']+_0x47b5ac[_0x25a2('0x19')];var _0x18888b;if(_0x2bed02>=_0xa26399){_0x2bed02=_0xa26399;_0x18888b=0xc8;}else{_0x18888b=0xce;}_0x4fa26b[_0x25a2('0x15')](_0x18888b);return _0x4fa26b[_0x25a2('0x1b')](_0x25a2('0x1c'),_0x316429+'-'+_0x2bed02+'/'+_0xa26399)['json'](_0x5ec453);}return null;};}function patchUpdates(_0x185de1){return function(_0x254a54){try{jsonpatch[_0x25a2('0x1d')](_0x254a54,_0x185de1,!![]);}catch(_0xf2ab2e){return BPromise[_0x25a2('0x1e')](_0xf2ab2e);}return _0x254a54['save']();};}function saveUpdates(_0x37adbb,_0x3b93f2){return function(_0x351afb){if(_0x351afb){return _0x351afb[_0x25a2('0x1f')](_0x37adbb)[_0x25a2('0x20')](function(_0x36db2c){return _0x36db2c;});}return null;};}function removeEntity(_0x3d0646,_0x4d3f63){return function(_0x1fd01e){if(_0x1fd01e){return _0x1fd01e[_0x25a2('0x21')]()[_0x25a2('0x20')](function(){_0x3d0646[_0x25a2('0x15')](0xcc)[_0x25a2('0x22')]();});}};}function handleEntityNotFound(_0x32c23e,_0x37caf9){return function(_0x1762ba){if(!_0x1762ba){_0x32c23e[_0x25a2('0x14')](0x194);}return _0x1762ba;};}function handleError(_0x3b4d9e,_0x163db1){_0x163db1=_0x163db1||0x1f4;return function(_0x594c96){logger[_0x25a2('0x23')](_0x594c96[_0x25a2('0x24')]);if(_0x594c96[_0x25a2('0x25')]){delete _0x594c96['name'];}_0x3b4d9e['status'](_0x163db1)[_0x25a2('0x26')](_0x594c96);};}exports['index']=function(_0x95f3f3,_0x4a8550){var _0x86efd3={},_0x3d73d7={},_0x178ffc={'count':0x0,'rows':[]};var _0x102c82=_[_0x25a2('0x27')](db[_0x25a2('0x28')][_0x25a2('0x29')],function(_0x425e69){return{'name':_0x425e69[_0x25a2('0x2a')],'type':_0x425e69[_0x25a2('0x2b')]['key']};});_0x3d73d7[_0x25a2('0x2c')]=_[_0x25a2('0x27')](_0x102c82,_0x25a2('0x25'));_0x3d73d7[_0x25a2('0x2d')]=_['keys'](_0x95f3f3['query']);_0x3d73d7['filters']=_[_0x25a2('0x2e')](_0x3d73d7[_0x25a2('0x2c')],_0x3d73d7['query']);_0x86efd3['attributes']=_[_0x25a2('0x2e')](_0x3d73d7[_0x25a2('0x2c')],qs[_0x25a2('0x2f')](_0x95f3f3['query'][_0x25a2('0x2f')]));_0x86efd3[_0x25a2('0x30')]=_0x86efd3[_0x25a2('0x30')][_0x25a2('0x31')]?_0x86efd3[_0x25a2('0x30')]:_0x3d73d7['model'];if(!_0x95f3f3['query'][_0x25a2('0x32')](_0x25a2('0x33'))){_0x86efd3['limit']=qs[_0x25a2('0x19')](_0x95f3f3[_0x25a2('0x2d')][_0x25a2('0x19')]);_0x86efd3[_0x25a2('0x17')]=qs[_0x25a2('0x17')](_0x95f3f3[_0x25a2('0x2d')][_0x25a2('0x17')]);}_0x86efd3['order']=qs[_0x25a2('0x34')](_0x95f3f3[_0x25a2('0x2d')]['sort']);_0x86efd3[_0x25a2('0x35')]=qs[_0x25a2('0x36')](_[_0x25a2('0x37')](_0x95f3f3[_0x25a2('0x2d')],_0x3d73d7['filters']),_0x102c82);if(_0x95f3f3[_0x25a2('0x2d')]['filter']){_0x86efd3[_0x25a2('0x35')]=_[_0x25a2('0x38')](_0x86efd3[_0x25a2('0x35')],{'$or':_['map'](_0x102c82,function(_0x4ee1f7){if(_0x4ee1f7[_0x25a2('0x2b')]!==_0x25a2('0x39')){var _0x4dd2ba={};_0x4dd2ba[_0x4ee1f7['name']]={'$like':'%'+_0x95f3f3[_0x25a2('0x2d')]['filter']+'%'};return _0x4dd2ba;}})});}_0x86efd3=_[_0x25a2('0x38')]({},_0x86efd3,_0x95f3f3[_0x25a2('0x3a')]);var _0x1d0b5d={'where':_0x86efd3[_0x25a2('0x35')]};return db['MailTransferReport'][_0x25a2('0x1a')](_0x1d0b5d)[_0x25a2('0x20')](function(_0x4f1c54){_0x178ffc[_0x25a2('0x1a')]=_0x4f1c54;if(_0x95f3f3['query'][_0x25a2('0x3b')]){_0x86efd3[_0x25a2('0x3c')]=[{'all':!![]}];}return db[_0x25a2('0x28')]['findAll'](_0x86efd3);})[_0x25a2('0x20')](function(_0x2db707){_0x178ffc[_0x25a2('0x3d')]=_0x2db707;return _0x178ffc;})[_0x25a2('0x20')](respondWithFilteredResult(_0x4a8550,_0x86efd3))[_0x25a2('0x3e')](handleError(_0x4a8550,null));};exports['show']=function(_0x171232,_0x397ae1){var _0x30537e={'raw':!![],'where':{'id':_0x171232[_0x25a2('0x3f')]['id']}},_0x357258={};_0x357258['model']=_[_0x25a2('0x40')](db[_0x25a2('0x28')][_0x25a2('0x29')]);_0x357258[_0x25a2('0x2d')]=_[_0x25a2('0x40')](_0x171232[_0x25a2('0x2d')]);_0x357258[_0x25a2('0x36')]=_[_0x25a2('0x2e')](_0x357258[_0x25a2('0x2c')],_0x357258[_0x25a2('0x2d')]);_0x30537e[_0x25a2('0x30')]=_['intersection'](_0x357258[_0x25a2('0x2c')],qs[_0x25a2('0x2f')](_0x171232['query'][_0x25a2('0x2f')]));_0x30537e[_0x25a2('0x30')]=_0x30537e[_0x25a2('0x30')][_0x25a2('0x31')]?_0x30537e[_0x25a2('0x30')]:_0x357258[_0x25a2('0x2c')];if(_0x171232[_0x25a2('0x2d')][_0x25a2('0x3b')]){_0x30537e[_0x25a2('0x3c')]=[{'all':!![]}];}_0x30537e=_['merge']({},_0x30537e,_0x171232[_0x25a2('0x3a')]);return db[_0x25a2('0x28')][_0x25a2('0x41')](_0x30537e)[_0x25a2('0x20')](handleEntityNotFound(_0x397ae1,null))[_0x25a2('0x20')](respondWithResult(_0x397ae1,null))['catch'](handleError(_0x397ae1,null));};exports['create']=function(_0x3022d5,_0x15189a){return db['MailTransferReport'][_0x25a2('0x42')](_0x3022d5['body'],{})[_0x25a2('0x20')](respondWithResult(_0x15189a,0xc9))['catch'](handleError(_0x15189a,null));};exports['update']=function(_0x578478,_0x475990){if(_0x578478[_0x25a2('0x43')]['id']){delete _0x578478[_0x25a2('0x43')]['id'];}return db[_0x25a2('0x28')][_0x25a2('0x41')]({'where':{'id':_0x578478[_0x25a2('0x3f')]['id']}})[_0x25a2('0x20')](handleEntityNotFound(_0x475990,null))[_0x25a2('0x20')](saveUpdates(_0x578478['body'],null))['then'](respondWithResult(_0x475990,null))[_0x25a2('0x3e')](handleError(_0x475990,null));};exports['destroy']=function(_0x484a7a,_0x9bd657){return db[_0x25a2('0x28')][_0x25a2('0x41')]({'where':{'id':_0x484a7a['params']['id']}})[_0x25a2('0x20')](handleEntityNotFound(_0x9bd657,null))[_0x25a2('0x20')](removeEntity(_0x9bd657,null))[_0x25a2('0x3e')](handleError(_0x9bd657,null));};exports['describe']=function(_0x4dbfb7,_0x2197a9){return db[_0x25a2('0x28')]['describe']()['then'](respondWithResult(_0x2197a9,null))[_0x25a2('0x3e')](handleError(_0x2197a9,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index f9ddc49..b281788 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 _0x938a=['exports','define','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','./mailTransferReport.attributes'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x938a,0x1f2));var _0xa938=function(_0x389e1e,_0xac0201){_0x389e1e=_0x389e1e-0x0;var _0x5c8033=_0x938a[_0x389e1e];return _0x5c8033;};'use strict';var _=require(_0xa938('0x0'));var util=require(_0xa938('0x1'));var logger=require(_0xa938('0x2'))(_0xa938('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa938('0x4'));var fs=require('fs');var path=require(_0xa938('0x5'));var rimraf=require(_0xa938('0x6'));var config=require('../../config/environment');var attributes=require(_0xa938('0x7'));module[_0xa938('0x8')]=function(_0x4ac3a2,_0x27efe9){return _0x4ac3a2[_0xa938('0x9')]('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa938('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe364=['path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','moment','request-promise'];(function(_0x6e64bc,_0x37f5d0){var _0x20c4b9=function(_0x4a8a36){while(--_0x4a8a36){_0x6e64bc['push'](_0x6e64bc['shift']());}};_0x20c4b9(++_0x37f5d0);}(_0xe364,0x1c3));var _0x4e36=function(_0x34e752,_0x32e2a2){_0x34e752=_0x34e752-0x0;var _0x7c6347=_0xe364[_0x34e752];return _0x7c6347;};'use strict';var _=require('lodash');var util=require(_0x4e36('0x0'));var logger=require(_0x4e36('0x1'))('api');var moment=require(_0x4e36('0x2'));var BPromise=require('bluebird');var rp=require(_0x4e36('0x3'));var fs=require('fs');var path=require(_0x4e36('0x4'));var rimraf=require(_0x4e36('0x5'));var config=require(_0x4e36('0x6'));var attributes=require(_0x4e36('0x7'));module[_0x4e36('0x8')]=function(_0x3c5e6b,_0x10019a){return _0x3c5e6b[_0x4e36('0x9')](_0x4e36('0xa'),attributes,{'tableName':_0x4e36('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4e36('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 4dff5fe..875ebf7 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 _0xe3bb=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x277ce4,_0x17d488){var _0x5255cf=function(_0x40d3f8){while(--_0x40d3f8){_0x277ce4['push'](_0x277ce4['shift']());}};_0x5255cf(++_0x17d488);}(_0xe3bb,0xa8));var _0xbe3b=function(_0x4d02cf,_0x245f68){_0x4d02cf=_0x4d02cf-0x0;var _0x543b18=_0xe3bb[_0x4d02cf];return _0x543b18;};'use strict';var _=require(_0xbe3b('0x0'));var util=require(_0xbe3b('0x1'));var moment=require('moment');var BPromise=require(_0xbe3b('0x2'));var rs=require(_0xbe3b('0x3'));var fs=require('fs');var Redis=require(_0xbe3b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe3b('0x5'));var logger=require(_0xbe3b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbe3b('0x7'));var client=jayson[_0xbe3b('0x8')][_0xbe3b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x454dcc,_0x1db051,_0x42a5e3){return new BPromise(function(_0x12cb7c,_0x386c6a){return client['request'](_0x454dcc,_0x42a5e3)[_0xbe3b('0xa')](function(_0x18e684){logger[_0xbe3b('0xb')](_0xbe3b('0xc'),_0x1db051,_0xbe3b('0xd'));logger[_0xbe3b('0xe')](_0xbe3b('0xf'),_0x1db051,'request\x20sent',JSON[_0xbe3b('0x10')](_0x18e684));if(_0x18e684['error']){if(_0x18e684[_0xbe3b('0x11')][_0xbe3b('0x12')]===0x1f4){logger['error'](_0xbe3b('0xc'),_0x1db051,_0x18e684[_0xbe3b('0x11')][_0xbe3b('0x13')]);return _0x386c6a(_0x18e684['error']['message']);}logger[_0xbe3b('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x1db051,_0x18e684[_0xbe3b('0x11')][_0xbe3b('0x13')]);return _0x12cb7c(_0x18e684[_0xbe3b('0x11')]['message']);}else{logger[_0xbe3b('0xb')](_0xbe3b('0xc'),_0x1db051,'request\x20sent');_0x12cb7c(_0x18e684['result'][_0xbe3b('0x13')]);}})[_0xbe3b('0x14')](function(_0x2100b0){logger[_0xbe3b('0x11')](_0xbe3b('0xc'),_0x1db051,_0x2100b0);_0x386c6a(_0x2100b0);});});} \ No newline at end of file +var _0xc90d=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash'];(function(_0x4f48f0,_0x1ccb32){var _0x255f7b=function(_0x13a95c){while(--_0x13a95c){_0x4f48f0['push'](_0x4f48f0['shift']());}};_0x255f7b(++_0x1ccb32);}(_0xc90d,0x1f3));var _0xdc90=function(_0x458f09,_0xf2ee90){_0x458f09=_0x458f09-0x0;var _0x1ca565=_0xc90d[_0x458f09];return _0x1ca565;};'use strict';var _=require(_0xdc90('0x0'));var util=require('util');var moment=require(_0xdc90('0x1'));var BPromise=require(_0xdc90('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc90('0x3'));var db=require(_0xdc90('0x4'))['db'];var utils=require(_0xdc90('0x5'));var logger=require(_0xdc90('0x6'))(_0xdc90('0x7'));var config=require('../../config/environment');var jayson=require(_0xdc90('0x8'));var client=jayson[_0xdc90('0x9')][_0xdc90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28cf0f,_0x5c9487,_0x2c4869){return new BPromise(function(_0x52b39d,_0x53e147){return client[_0xdc90('0xb')](_0x28cf0f,_0x2c4869)['then'](function(_0x5e25a0){logger[_0xdc90('0xc')](_0xdc90('0xd'),_0x5c9487,_0xdc90('0xe'));logger[_0xdc90('0xf')](_0xdc90('0x10'),_0x5c9487,'request\x20sent',JSON['stringify'](_0x5e25a0));if(_0x5e25a0[_0xdc90('0x11')]){if(_0x5e25a0[_0xdc90('0x11')]['code']===0x1f4){logger[_0xdc90('0x11')](_0xdc90('0xd'),_0x5c9487,_0x5e25a0[_0xdc90('0x11')]['message']);return _0x53e147(_0x5e25a0[_0xdc90('0x11')][_0xdc90('0x12')]);}logger[_0xdc90('0x11')](_0xdc90('0xd'),_0x5c9487,_0x5e25a0[_0xdc90('0x11')]['message']);return _0x52b39d(_0x5e25a0['error'][_0xdc90('0x12')]);}else{logger['info'](_0xdc90('0xd'),_0x5c9487,_0xdc90('0xe'));_0x52b39d(_0x5e25a0[_0xdc90('0x13')][_0xdc90('0x12')]);}})['catch'](function(_0x2a3681){logger[_0xdc90('0x11')](_0xdc90('0xd'),_0x5c9487,_0x2a3681);_0x53e147(_0x2a3681);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 4ad1d45..9027bc0 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 _0x193f=['get','/:id','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','/describe','describe'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0x193f,0x14b));var _0xf193=function(_0x5c811c,_0x313b25){_0x5c811c=_0x5c811c-0x0;var _0x5df3af=_0x193f[_0x5c811c];return _0x5df3af;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf193('0x0'));var timeout=require(_0xf193('0x1'));var express=require(_0xf193('0x2'));var router=express[_0xf193('0x3')]();var fs_extra=require(_0xf193('0x4'));var auth=require(_0xf193('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./memberReport.controller');router['get']('/',auth[_0xf193('0x6')](),controller['index']);router['get'](_0xf193('0x7'),auth['isAuthenticated'](),controller[_0xf193('0x8')]);router[_0xf193('0x9')](_0xf193('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf193('0x6')](),controller[_0xf193('0xb')]);router[_0xf193('0xc')](_0xf193('0xa'),auth['isAuthenticated'](),controller[_0xf193('0xd')]);router[_0xf193('0xe')](_0xf193('0xa'),auth[_0xf193('0x6')](),controller[_0xf193('0xf')]);module[_0xf193('0x10')]=router; \ No newline at end of file +var _0xb8d5=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','multer','path'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xb8d5,0xcf));var _0x5b8d=function(_0x655697,_0x1b33dd){_0x655697=_0x655697-0x0;var _0x4971cc=_0xb8d5[_0x655697];return _0x4971cc;};'use strict';var multer=require(_0x5b8d('0x0'));var util=require('util');var path=require(_0x5b8d('0x1'));var timeout=require(_0x5b8d('0x2'));var express=require(_0x5b8d('0x3'));var router=express['Router']();var fs_extra=require(_0x5b8d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5b8d('0x5'));var config=require(_0x5b8d('0x6'));var controller=require('./memberReport.controller');router[_0x5b8d('0x7')]('/',auth[_0x5b8d('0x8')](),controller[_0x5b8d('0x9')]);router[_0x5b8d('0x7')](_0x5b8d('0xa'),auth[_0x5b8d('0x8')](),controller[_0x5b8d('0xb')]);router[_0x5b8d('0x7')](_0x5b8d('0xc'),auth[_0x5b8d('0x8')](),controller[_0x5b8d('0xd')]);router[_0x5b8d('0xe')]('/',auth['isAuthenticated'](),controller[_0x5b8d('0xf')]);router[_0x5b8d('0x10')](_0x5b8d('0xc'),auth[_0x5b8d('0x8')](),controller['update']);router[_0x5b8d('0x11')](_0x5b8d('0xc'),auth[_0x5b8d('0x8')](),controller[_0x5b8d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 83df3c7..e51f66c 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 _0xe79f=['setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','seconds'];(function(_0x224aec,_0x3c6a17){var _0xe2a758=function(_0x4b8ce0){while(--_0x4b8ce0){_0x224aec['push'](_0x224aec['shift']());}};_0xe2a758(++_0x3c6a17);}(_0xe79f,0x13a));var _0xfe79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe79f[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xfe79('0x0'));var moment=require('moment');module[_0xfe79('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xfe79('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xfe79('0x3')},'duration':{'type':Sequelize[_0xfe79('0x4')]},'enterAt':{'type':Sequelize[_0xfe79('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x4b9553){var _0x26ea00=moment(_0x4b9553);var _0x3c06b8=moment(this['getDataValue'](_0xfe79('0x6')));var _0x2411bd=_0x26ea00['diff'](_0x3c06b8,_0xfe79('0x7'));this[_0xfe79('0x8')]('exitAt',_0x4b9553);this['setDataValue'](_0xfe79('0x9'),_0x2411bd||null);}},'data1':{'type':Sequelize[_0xfe79('0x2')],'comment':_0xfe79('0xa')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0xfe79('0xb')},'data4':{'type':Sequelize['STRING'],'comment':_0xfe79('0xc')},'data5':{'type':Sequelize[_0xfe79('0x2')],'comment':_0xfe79('0xd')},'role':{'type':Sequelize[_0xfe79('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xfe79('0x2')]}}; \ No newline at end of file +var _0x52b2=['talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]'];(function(_0x4e8318,_0x3fe0e6){var _0x30a40b=function(_0x37d390){while(--_0x37d390){_0x4e8318['push'](_0x4e8318['shift']());}};_0x30a40b(++_0x3fe0e6);}(_0x52b2,0x11e));var _0x252b=function(_0x1c6bd5,_0x29ad2f){_0x1c6bd5=_0x1c6bd5-0x0;var _0x4af65f=_0x52b2[_0x1c6bd5];return _0x4af65f;};'use strict';var Sequelize=require(_0x252b('0x0'));var moment=require(_0x252b('0x1'));module[_0x252b('0x2')]={'channel':{'type':Sequelize[_0x252b('0x3')]},'membername':{'type':Sequelize[_0x252b('0x3')]},'interface':{'type':Sequelize[_0x252b('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x252b('0x4'),'comment':_0x252b('0x5')},'duration':{'type':Sequelize[_0x252b('0x6')]},'enterAt':{'type':Sequelize[_0x252b('0x7')]},'exitAt':{'type':Sequelize[_0x252b('0x7')],'set':function(_0x571511){var _0x1025af=moment(_0x571511);var _0x409365=moment(this[_0x252b('0x8')](_0x252b('0x9')));var _0x147e21=_0x1025af[_0x252b('0xa')](_0x409365,'seconds');this[_0x252b('0xb')](_0x252b('0xc'),_0x571511);this['setDataValue'](_0x252b('0xd'),_0x147e21||null);}},'data1':{'type':Sequelize[_0x252b('0x3')],'comment':_0x252b('0xe')},'data2':{'type':Sequelize[_0x252b('0x3')],'comment':_0x252b('0xf')},'data3':{'type':Sequelize[_0x252b('0x3')],'comment':_0x252b('0x10')},'data4':{'type':Sequelize[_0x252b('0x3')],'comment':_0x252b('0x11')},'data5':{'type':Sequelize[_0x252b('0x3')],'comment':_0x252b('0x12')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x252b('0x6')]},'uniqueid':{'type':Sequelize[_0x252b('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 32ffb65..f95b24a 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 _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x57a343,_0x85c6a7){var _0x5c5ccf=function(_0x5d5c83){while(--_0x5d5c83){_0x57a343['push'](_0x57a343['shift']());}};_0x5c5ccf(++_0x85c6a7);}(_0x7217,0x19e));var _0x7721=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7217[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x16ee1c,_0x49a2bb){var _0x52474a=function(_0x3dbd06){while(--_0x3dbd06){_0x16ee1c['push'](_0x16ee1c['shift']());}};_0x52474a(++_0x49a2bb);}(_0x3e74,0x175));var _0x43e7=function(_0x516c7a,_0x52e8ab){_0x516c7a=_0x516c7a-0x0;var _0x3f1ead=_0x3e74[_0x516c7a];return _0x3f1ead;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 518ba35..3778146 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 _0x556b=['./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3691ff,_0x480bb2){var _0x5a44e2=function(_0x39feae){while(--_0x39feae){_0x3691ff['push'](_0x3691ff['shift']());}};_0x5a44e2(++_0x480bb2);}(_0x556b,0x1d7));var _0xb556=function(_0x33bde2,_0x117bcc){_0x33bde2=_0x33bde2-0x0;var _0x22d1b5=_0x556b[_0x33bde2];return _0x22d1b5;};'use strict';var _=require(_0xb556('0x0'));var util=require(_0xb556('0x1'));var logger=require(_0xb556('0x2'))(_0xb556('0x3'));var moment=require(_0xb556('0x4'));var BPromise=require('bluebird');var rp=require(_0xb556('0x5'));var fs=require('fs');var path=require(_0xb556('0x6'));var rimraf=require(_0xb556('0x7'));var config=require(_0xb556('0x8'));var attributes=require(_0xb556('0x9'));module['exports']=function(_0x4ee766,_0x52669f){return _0x4ee766[_0xb556('0xa')](_0xb556('0xb'),attributes,{'tableName':_0xb556('0xc'),'paranoid':![],'indexes':[{'name':_0xb556('0xd'),'fields':[_0xb556('0xe'),_0xb556('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x400f=['membername_interface','membername','interface','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member'];(function(_0x443dde,_0x4eb478){var _0x4b58cd=function(_0x20a78d){while(--_0x20a78d){_0x443dde['push'](_0x443dde['shift']());}};_0x4b58cd(++_0x4eb478);}(_0x400f,0x157));var _0xf400=function(_0x615e22,_0x504616){_0x615e22=_0x615e22-0x0;var _0x49589c=_0x400f[_0x615e22];return _0x49589c;};'use strict';var _=require(_0xf400('0x0'));var util=require(_0xf400('0x1'));var logger=require(_0xf400('0x2'))('api');var moment=require(_0xf400('0x3'));var BPromise=require(_0xf400('0x4'));var rp=require(_0xf400('0x5'));var fs=require('fs');var path=require(_0xf400('0x6'));var rimraf=require(_0xf400('0x7'));var config=require(_0xf400('0x8'));var attributes=require(_0xf400('0x9'));module[_0xf400('0xa')]=function(_0x6b1acb,_0xa5bd50){return _0x6b1acb[_0xf400('0xb')](_0xf400('0xc'),attributes,{'tableName':_0xf400('0xd'),'paranoid':![],'indexes':[{'name':_0xf400('0xe'),'fields':[_0xf400('0xf'),_0xf400('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index f52db43..25e7761 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 _0x1134=['rpc','jayson/promise','http','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','create','body','CreateMemberReport','UpdateMemberReport','update','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x32b30c,_0x2d5ec8){var _0xcfc212=function(_0x42e668){while(--_0x42e668){_0x32b30c['push'](_0x32b30c['shift']());}};_0xcfc212(++_0x2d5ec8);}(_0x1134,0x19c));var _0x4113=function(_0x4e0d87,_0x25b36a){_0x4e0d87=_0x4e0d87-0x0;var _0x1b5913=_0x1134[_0x4e0d87];return _0x1b5913;};'use strict';var _=require(_0x4113('0x0'));var util=require(_0x4113('0x1'));var moment=require('moment');var BPromise=require(_0x4113('0x2'));var rs=require(_0x4113('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4113('0x4'))['db'];var utils=require(_0x4113('0x5'));var logger=require('../../config/logger')(_0x4113('0x6'));var config=require('../../config/environment');var jayson=require(_0x4113('0x7'));var client=jayson['client'][_0x4113('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x493b42,_0xb1cea2,_0x28520f){return new BPromise(function(_0x3b6cc4,_0x11153c){return client[_0x4113('0x9')](_0x493b42,_0x28520f)[_0x4113('0xa')](function(_0x19c657){logger[_0x4113('0xb')]('MemberReport,\x20%s,\x20%s',_0xb1cea2,_0x4113('0xc'));logger[_0x4113('0xd')](_0x4113('0xe'),_0xb1cea2,_0x4113('0xc'),JSON[_0x4113('0xf')](_0x19c657));if(_0x19c657[_0x4113('0x10')]){if(_0x19c657[_0x4113('0x10')][_0x4113('0x11')]===0x1f4){logger[_0x4113('0x10')](_0x4113('0x12'),_0xb1cea2,_0x19c657['error']['message']);return _0x11153c(_0x19c657['error'][_0x4113('0x13')]);}logger[_0x4113('0x10')]('MemberReport,\x20%s,\x20%s',_0xb1cea2,_0x19c657['error'][_0x4113('0x13')]);return _0x3b6cc4(_0x19c657['error'][_0x4113('0x13')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0xb1cea2,_0x4113('0xc'));_0x3b6cc4(_0x19c657[_0x4113('0x14')][_0x4113('0x13')]);}})[_0x4113('0x15')](function(_0x21d732){logger[_0x4113('0x10')](_0x4113('0x12'),_0xb1cea2,_0x21d732);_0x11153c(_0x21d732);});});}exports[_0x4113('0x16')]=function(_0x1051d4){var _0x1cd9ae=this;return new Promise(function(_0x59b821,_0x41d58b){return db[_0x4113('0x17')][_0x4113('0x18')]({'raw':_0x1051d4[_0x4113('0x19')]?_0x1051d4[_0x4113('0x19')][_0x4113('0x1a')]===undefined?!![]:![]:!![],'where':_0x1051d4[_0x4113('0x19')]?_0x1051d4[_0x4113('0x19')][_0x4113('0x1b')]||null:null,'attributes':_0x1051d4['options']?_0x1051d4[_0x4113('0x19')][_0x4113('0x1c')]||null:null,'limit':_0x1051d4['options']?_0x1051d4['options'][_0x4113('0x1d')]||null:null,'include':_0x1051d4['options']?_0x1051d4[_0x4113('0x19')][_0x4113('0x1e')]?_[_0x4113('0x1f')](_0x1051d4['options'][_0x4113('0x1e')],function(_0x16b16c){return{'model':db[_0x16b16c[_0x4113('0x20')]],'as':_0x16b16c['as'],'attributes':_0x16b16c[_0x4113('0x1c')],'include':_0x16b16c[_0x4113('0x1e')]?_[_0x4113('0x1f')](_0x16b16c[_0x4113('0x1e')],function(_0x1c498a){return{'model':db[_0x1c498a[_0x4113('0x20')]],'as':_0x1c498a['as'],'attributes':_0x1c498a[_0x4113('0x1c')],'include':_0x1c498a[_0x4113('0x1e')]?_[_0x4113('0x1f')](_0x1c498a['include'],function(_0x44b317){return{'model':db[_0x44b317[_0x4113('0x20')]],'as':_0x44b317['as'],'attributes':_0x44b317['attributes']};}):[]};}):[]};}):[]:[]})[_0x4113('0xa')](function(_0x98d652){logger[_0x4113('0xb')](_0x4113('0x16'),_0x1051d4);logger[_0x4113('0xd')](_0x4113('0x16'),_0x1051d4,JSON[_0x4113('0xf')](_0x98d652));_0x59b821(_0x98d652);})[_0x4113('0x15')](function(_0x3f063f){logger[_0x4113('0x10')](_0x4113('0x16'),_0x3f063f[_0x4113('0x13')],_0x1051d4);_0x41d58b(_0x1cd9ae[_0x4113('0x10')](0x1f4,_0x3f063f[_0x4113('0x13')]));});});};exports['CreateMemberReport']=function(_0x1607a6){var _0xfeabfd=this;return new Promise(function(_0x4ecf29,_0x201966){return db[_0x4113('0x17')][_0x4113('0x21')](_0x1607a6[_0x4113('0x22')],{'raw':_0x1607a6['options']?_0x1607a6[_0x4113('0x19')][_0x4113('0x1a')]===undefined?!![]:![]:!![]})[_0x4113('0xa')](function(_0x2327db){logger[_0x4113('0xb')](_0x4113('0x23'),_0x1607a6);logger[_0x4113('0xd')](_0x4113('0x23'),_0x1607a6,JSON[_0x4113('0xf')](_0x2327db));_0x4ecf29(_0x2327db);})['catch'](function(_0x3ff5c9){logger['error'](_0x4113('0x23'),_0x3ff5c9[_0x4113('0x13')],_0x1607a6);_0x201966(_0xfeabfd[_0x4113('0x10')](0x1f4,_0x3ff5c9[_0x4113('0x13')]));});});};exports[_0x4113('0x24')]=function(_0x453d70){var _0x4bbda1=this;return new Promise(function(_0x1f63ec,_0x56ad93){return db[_0x4113('0x17')][_0x4113('0x25')](_0x453d70[_0x4113('0x22')],{'raw':_0x453d70['options']?_0x453d70[_0x4113('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x453d70[_0x4113('0x19')]?_0x453d70['options'][_0x4113('0x1b')]||null:null,'attributes':_0x453d70[_0x4113('0x19')]?_0x453d70['options']['attributes']||null:null,'limit':_0x453d70[_0x4113('0x19')]?_0x453d70[_0x4113('0x19')][_0x4113('0x1d')]||null:null})['then'](function(_0x590ef7){logger[_0x4113('0xb')](_0x4113('0x24'),_0x453d70);logger[_0x4113('0xd')](_0x4113('0x24'),_0x453d70,JSON[_0x4113('0xf')](_0x590ef7));_0x1f63ec(_0x590ef7);})['catch'](function(_0x407b01){logger[_0x4113('0x10')](_0x4113('0x24'),_0x407b01['message'],_0x453d70);_0x56ad93(_0x4bbda1[_0x4113('0x10')](0x1f4,_0x407b01[_0x4113('0x13')]));});});}; \ No newline at end of file +var _0x16d8=['map','include','model','CreateMemberReport','UpdateMemberReport','update','body','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','MemberReport,\x20%s,\x20%s','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit'];(function(_0x1520aa,_0x3fbc33){var _0x2425af=function(_0x5350c1){while(--_0x5350c1){_0x1520aa['push'](_0x1520aa['shift']());}};_0x2425af(++_0x3fbc33);}(_0x16d8,0xa3));var _0x816d=function(_0xeba7f0,_0x3d0001){_0xeba7f0=_0xeba7f0-0x0;var _0x4b3c12=_0x16d8[_0xeba7f0];return _0x4b3c12;};'use strict';var _=require('lodash');var util=require(_0x816d('0x0'));var moment=require(_0x816d('0x1'));var BPromise=require(_0x816d('0x2'));var rs=require(_0x816d('0x3'));var fs=require('fs');var Redis=require(_0x816d('0x4'));var db=require(_0x816d('0x5'))['db'];var utils=require(_0x816d('0x6'));var logger=require(_0x816d('0x7'))(_0x816d('0x8'));var config=require('../../config/environment');var jayson=require(_0x816d('0x9'));var client=jayson['client'][_0x816d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cde29,_0x2516ea,_0x2d51f2){return new BPromise(function(_0x44b1ba,_0x5cfc9d){return client[_0x816d('0xb')](_0x5cde29,_0x2d51f2)[_0x816d('0xc')](function(_0xda441e){logger['info']('MemberReport,\x20%s,\x20%s',_0x2516ea,'request\x20sent');logger[_0x816d('0xd')](_0x816d('0xe'),_0x2516ea,_0x816d('0xf'),JSON[_0x816d('0x10')](_0xda441e));if(_0xda441e['error']){if(_0xda441e[_0x816d('0x11')][_0x816d('0x12')]===0x1f4){logger[_0x816d('0x11')]('MemberReport,\x20%s,\x20%s',_0x2516ea,_0xda441e[_0x816d('0x11')][_0x816d('0x13')]);return _0x5cfc9d(_0xda441e['error'][_0x816d('0x13')]);}logger[_0x816d('0x11')]('MemberReport,\x20%s,\x20%s',_0x2516ea,_0xda441e[_0x816d('0x11')][_0x816d('0x13')]);return _0x44b1ba(_0xda441e['error'][_0x816d('0x13')]);}else{logger[_0x816d('0x14')](_0x816d('0x15'),_0x2516ea,_0x816d('0xf'));_0x44b1ba(_0xda441e[_0x816d('0x16')][_0x816d('0x13')]);}})[_0x816d('0x17')](function(_0x2a1be1){logger[_0x816d('0x11')]('MemberReport,\x20%s,\x20%s',_0x2516ea,_0x2a1be1);_0x5cfc9d(_0x2a1be1);});});}exports[_0x816d('0x18')]=function(_0x2cee1c){var _0x175e6d=this;return new Promise(function(_0x52be88,_0x839dcd){return db[_0x816d('0x19')][_0x816d('0x1a')]({'raw':_0x2cee1c[_0x816d('0x1b')]?_0x2cee1c[_0x816d('0x1b')][_0x816d('0x1c')]===undefined?!![]:![]:!![],'where':_0x2cee1c['options']?_0x2cee1c[_0x816d('0x1b')][_0x816d('0x1d')]||null:null,'attributes':_0x2cee1c[_0x816d('0x1b')]?_0x2cee1c[_0x816d('0x1b')][_0x816d('0x1e')]||null:null,'limit':_0x2cee1c[_0x816d('0x1b')]?_0x2cee1c[_0x816d('0x1b')][_0x816d('0x1f')]||null:null,'include':_0x2cee1c['options']?_0x2cee1c[_0x816d('0x1b')]['include']?_[_0x816d('0x20')](_0x2cee1c[_0x816d('0x1b')][_0x816d('0x21')],function(_0x22ee4c){return{'model':db[_0x22ee4c[_0x816d('0x22')]],'as':_0x22ee4c['as'],'attributes':_0x22ee4c[_0x816d('0x1e')],'include':_0x22ee4c[_0x816d('0x21')]?_[_0x816d('0x20')](_0x22ee4c[_0x816d('0x21')],function(_0x3d4410){return{'model':db[_0x3d4410[_0x816d('0x22')]],'as':_0x3d4410['as'],'attributes':_0x3d4410[_0x816d('0x1e')],'include':_0x3d4410[_0x816d('0x21')]?_[_0x816d('0x20')](_0x3d4410[_0x816d('0x21')],function(_0x19e167){return{'model':db[_0x19e167[_0x816d('0x22')]],'as':_0x19e167['as'],'attributes':_0x19e167['attributes']};}):[]};}):[]};}):[]:[]})[_0x816d('0xc')](function(_0x6a4acd){logger[_0x816d('0x14')](_0x816d('0x18'),_0x2cee1c);logger[_0x816d('0xd')]('GetMemberReport',_0x2cee1c,JSON['stringify'](_0x6a4acd));_0x52be88(_0x6a4acd);})['catch'](function(_0x45cd32){logger[_0x816d('0x11')](_0x816d('0x18'),_0x45cd32['message'],_0x2cee1c);_0x839dcd(_0x175e6d[_0x816d('0x11')](0x1f4,_0x45cd32[_0x816d('0x13')]));});});};exports[_0x816d('0x23')]=function(_0x510a6){var _0x548734=this;return new Promise(function(_0x3917a1,_0x1b74a7){return db[_0x816d('0x19')]['create'](_0x510a6['body'],{'raw':_0x510a6['options']?_0x510a6['options'][_0x816d('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x195481){logger[_0x816d('0x14')](_0x816d('0x23'),_0x510a6);logger[_0x816d('0xd')](_0x816d('0x23'),_0x510a6,JSON['stringify'](_0x195481));_0x3917a1(_0x195481);})['catch'](function(_0xd4c621){logger[_0x816d('0x11')](_0x816d('0x23'),_0xd4c621['message'],_0x510a6);_0x1b74a7(_0x548734[_0x816d('0x11')](0x1f4,_0xd4c621[_0x816d('0x13')]));});});};exports[_0x816d('0x24')]=function(_0x41ba53){var _0x58b868=this;return new Promise(function(_0x25b9c3,_0x236558){return db[_0x816d('0x19')][_0x816d('0x25')](_0x41ba53[_0x816d('0x26')],{'raw':_0x41ba53['options']?_0x41ba53[_0x816d('0x1b')][_0x816d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41ba53[_0x816d('0x1b')]?_0x41ba53[_0x816d('0x1b')][_0x816d('0x1d')]||null:null,'attributes':_0x41ba53[_0x816d('0x1b')]?_0x41ba53[_0x816d('0x1b')]['attributes']||null:null,'limit':_0x41ba53[_0x816d('0x1b')]?_0x41ba53[_0x816d('0x1b')][_0x816d('0x1f')]||null:null})[_0x816d('0xc')](function(_0x403ce7){logger[_0x816d('0x14')](_0x816d('0x24'),_0x41ba53);logger[_0x816d('0xd')](_0x816d('0x24'),_0x41ba53,JSON['stringify'](_0x403ce7));_0x25b9c3(_0x403ce7);})[_0x816d('0x17')](function(_0xb81152){logger[_0x816d('0x11')](_0x816d('0x24'),_0xb81152['message'],_0x41ba53);_0x236558(_0x58b868[_0x816d('0x11')](0x1f4,_0xb81152[_0x816d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 423865c..865bb61 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 _0x7736=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x7736,0x84));var _0x6773=function(_0x3914c9,_0x351966){_0x3914c9=_0x3914c9-0x0;var _0x4982bc=_0x7736[_0x3914c9];return _0x4982bc;};'use strict';var multer=require(_0x6773('0x0'));var util=require(_0x6773('0x1'));var path=require(_0x6773('0x2'));var timeout=require(_0x6773('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6773('0x4'));var auth=require(_0x6773('0x5'));var interaction=require(_0x6773('0x6'));var config=require(_0x6773('0x7'));var controller=require(_0x6773('0x8'));router[_0x6773('0x9')]('/',controller[_0x6773('0xa')]);module['exports']=router; \ No newline at end of file +var _0xfd64=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','util','path'];(function(_0x486a99,_0x3a5941){var _0x5f171f=function(_0x5bd3ca){while(--_0x5bd3ca){_0x486a99['push'](_0x486a99['shift']());}};_0x5f171f(++_0x3a5941);}(_0xfd64,0x1c5));var _0x4fd6=function(_0x3bf8ac,_0x358931){_0x3bf8ac=_0x3bf8ac-0x0;var _0x2cc39b=_0xfd64[_0x3bf8ac];return _0x2cc39b;};'use strict';var multer=require('multer');var util=require(_0x4fd6('0x0'));var path=require(_0x4fd6('0x1'));var timeout=require(_0x4fd6('0x2'));var express=require(_0x4fd6('0x3'));var router=express[_0x4fd6('0x4')]();var fs_extra=require(_0x4fd6('0x5'));var auth=require(_0x4fd6('0x6'));var interaction=require(_0x4fd6('0x7'));var config=require(_0x4fd6('0x8'));var controller=require(_0x4fd6('0x9'));router[_0x4fd6('0xa')]('/',controller[_0x4fd6('0xb')]);module[_0x4fd6('0xc')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 32f8c1f..cb8b27c 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 _0xff10=['exports','STRING','version','sequelize'];(function(_0x4c4e02,_0x1fcc31){var _0x30f280=function(_0xb70768){while(--_0xb70768){_0x4c4e02['push'](_0x4c4e02['shift']());}};_0x30f280(++_0x1fcc31);}(_0xff10,0x67));var _0x0ff1=function(_0x46a30d,_0x34b9ad){_0x46a30d=_0x46a30d-0x0;var _0x3d1914=_0xff10[_0x46a30d];return _0x3d1914;};'use strict';var Sequelize=require(_0x0ff1('0x0'));module[_0x0ff1('0x1')]={'version':{'type':Sequelize[_0x0ff1('0x2')],'unique':_0x0ff1('0x3')}}; \ No newline at end of file +var _0x9133=['version','sequelize','exports','STRING'];(function(_0xf16836,_0x1ca05e){var _0x1ee290=function(_0x11af9a){while(--_0x11af9a){_0xf16836['push'](_0xf16836['shift']());}};_0x1ee290(++_0x1ca05e);}(_0x9133,0x199));var _0x3913=function(_0x13c4f8,_0x433521){_0x13c4f8=_0x13c4f8-0x0;var _0x5a8f4b=_0x9133[_0x13c4f8];return _0x5a8f4b;};'use strict';var Sequelize=require(_0x3913('0x0'));module[_0x3913('0x1')]={'version':{'type':Sequelize[_0x3913('0x2')],'unique':_0x3913('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 4c6635f..83cf94c 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 _0x250c=['nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','findAll','rows','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','save','update','destroy','end','error','name','index','map','Migration','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x347399,_0x42bbda){var _0x24e7be=function(_0x33fdc){while(--_0x33fdc){_0x347399['push'](_0x347399['shift']());}};_0x24e7be(++_0x42bbda);}(_0x250c,0x191));var _0xc250=function(_0x51c3c7,_0x36cf14){_0x51c3c7=_0x51c3c7-0x0;var _0x5a9e12=_0x250c[_0x51c3c7];return _0x5a9e12;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc250('0x0'));var zipdir=require(_0xc250('0x1'));var jsonpatch=require(_0xc250('0x2'));var rp=require(_0xc250('0x3'));var moment=require(_0xc250('0x4'));var BPromise=require(_0xc250('0x5'));var Mustache=require(_0xc250('0x6'));var util=require(_0xc250('0x7'));var path=require('path');var sox=require(_0xc250('0x8'));var csv=require(_0xc250('0x9'));var ejs=require(_0xc250('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc250('0xb'));var crypto=require(_0xc250('0xc'));var jsforce=require(_0xc250('0xd'));var deskjs=require(_0xc250('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc250('0xf'));var Papa=require(_0xc250('0x10'));var Redis=require(_0xc250('0x11'));var authService=require(_0xc250('0x12'));var qs=require(_0xc250('0x13'));var as=require(_0xc250('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc250('0x15'))(_0xc250('0x16'));var utils=require('../../config/utils');var config=require(_0xc250('0x17'));var licenseUtil=require(_0xc250('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e94ba,_0x2f2553){_0x2f2553=_0x2f2553||0xcc;return function(_0xcbde7a){if(_0xcbde7a){return _0x1e94ba[_0xc250('0x19')](_0x2f2553);}return _0x1e94ba[_0xc250('0x1a')](_0x2f2553)['end']();};}function respondWithResult(_0x1e81e6,_0x403cbf){_0x403cbf=_0x403cbf||0xc8;return function(_0x23989d){if(_0x23989d){return _0x1e81e6[_0xc250('0x1a')](_0x403cbf)[_0xc250('0x1b')](_0x23989d);}};}function respondWithFilteredResult(_0x21279c,_0x317960){return function(_0x4e4902){if(_0x4e4902){var _0x1751f5=typeof _0x317960[_0xc250('0x1c')]==='undefined'&&typeof _0x317960['limit']==='undefined';var _0x43d238=_0x4e4902[_0xc250('0x1d')];var _0x37a7d3=_0x1751f5?0x0:_0x317960[_0xc250('0x1c')];var _0x4d3d39=_0x1751f5?_0x4e4902[_0xc250('0x1d')]:_0x317960['offset']+_0x317960[_0xc250('0x1e')];var _0x179e64;if(_0x4d3d39>=_0x43d238){_0x4d3d39=_0x43d238;_0x179e64=0xc8;}else{_0x179e64=0xce;}_0x21279c[_0xc250('0x1a')](_0x179e64);return _0x21279c[_0xc250('0x1f')](_0xc250('0x20'),_0x37a7d3+'-'+_0x4d3d39+'/'+_0x43d238)[_0xc250('0x1b')](_0x4e4902);}return null;};}function patchUpdates(_0x355b44){return function(_0x22aebc){try{jsonpatch[_0xc250('0x21')](_0x22aebc,_0x355b44,!![]);}catch(_0x3cd269){return BPromise['reject'](_0x3cd269);}return _0x22aebc[_0xc250('0x22')]();};}function saveUpdates(_0x2be506,_0x2d50c3){return function(_0x3cd30c){if(_0x3cd30c){return _0x3cd30c[_0xc250('0x23')](_0x2be506)['then'](function(_0x177e76){return _0x177e76;});}return null;};}function removeEntity(_0x4657d7,_0x107e90){return function(_0x2e3f3a){if(_0x2e3f3a){return _0x2e3f3a[_0xc250('0x24')]()['then'](function(){_0x4657d7[_0xc250('0x1a')](0xcc)[_0xc250('0x25')]();});}};}function handleEntityNotFound(_0x3c4a2e,_0x2101c7){return function(_0x3d36cb){if(!_0x3d36cb){_0x3c4a2e[_0xc250('0x19')](0x194);}return _0x3d36cb;};}function handleError(_0x4fcea7,_0x312408){_0x312408=_0x312408||0x1f4;return function(_0x3a1c4c){logger[_0xc250('0x26')](_0x3a1c4c['stack']);if(_0x3a1c4c[_0xc250('0x27')]){delete _0x3a1c4c[_0xc250('0x27')];}_0x4fcea7['status'](_0x312408)['send'](_0x3a1c4c);};}exports[_0xc250('0x28')]=function(_0x67b253,_0x47005b){var _0x31e400={},_0x2c977e={},_0x2118bd={'count':0x0,'rows':[]};var _0xbc879b=_[_0xc250('0x29')](db[_0xc250('0x2a')][_0xc250('0x2b')],function(_0x14a89a){return{'name':_0x14a89a['fieldName'],'type':_0x14a89a[_0xc250('0x2c')][_0xc250('0x2d')]};});_0x2c977e['model']=_['map'](_0xbc879b,'name');_0x2c977e['query']=_['keys'](_0x67b253[_0xc250('0x2e')]);_0x2c977e[_0xc250('0x2f')]=_[_0xc250('0x30')](_0x2c977e[_0xc250('0x31')],_0x2c977e['query']);_0x31e400[_0xc250('0x32')]=_[_0xc250('0x30')](_0x2c977e['model'],qs[_0xc250('0x33')](_0x67b253[_0xc250('0x2e')][_0xc250('0x33')]));_0x31e400['attributes']=_0x31e400[_0xc250('0x32')][_0xc250('0x34')]?_0x31e400[_0xc250('0x32')]:_0x2c977e['model'];if(!_0x67b253[_0xc250('0x2e')][_0xc250('0x35')](_0xc250('0x36'))){_0x31e400[_0xc250('0x1e')]=qs[_0xc250('0x1e')](_0x67b253[_0xc250('0x2e')][_0xc250('0x1e')]);_0x31e400[_0xc250('0x1c')]=qs[_0xc250('0x1c')](_0x67b253[_0xc250('0x2e')]['offset']);}_0x31e400[_0xc250('0x37')]=qs['sort'](_0x67b253[_0xc250('0x2e')][_0xc250('0x38')]);_0x31e400['where']=qs['filters'](_[_0xc250('0x39')](_0x67b253['query'],_0x2c977e[_0xc250('0x2f')]),_0xbc879b);if(_0x67b253['query'][_0xc250('0x3a')]){_0x31e400[_0xc250('0x3b')]=_[_0xc250('0x3c')](_0x31e400[_0xc250('0x3b')],{'$or':_[_0xc250('0x29')](_0xbc879b,function(_0x5aa784){if(_0x5aa784[_0xc250('0x2c')]!==_0xc250('0x3d')){var _0x1f00ec={};_0x1f00ec[_0x5aa784[_0xc250('0x27')]]={'$like':'%'+_0x67b253['query'][_0xc250('0x3a')]+'%'};return _0x1f00ec;}})});}_0x31e400=_['merge']({},_0x31e400,_0x67b253['options']);var _0x405ec1={'where':_0x31e400[_0xc250('0x3b')]};return db['Migration']['count'](_0x405ec1)[_0xc250('0x3e')](function(_0x326a41){_0x2118bd[_0xc250('0x1d')]=_0x326a41;if(_0x67b253['query']['includeAll']){_0x31e400['include']=[{'all':!![]}];}return db[_0xc250('0x2a')][_0xc250('0x3f')](_0x31e400);})[_0xc250('0x3e')](function(_0x120daa){_0x2118bd[_0xc250('0x40')]=_0x120daa;return _0x2118bd;})[_0xc250('0x3e')](respondWithFilteredResult(_0x47005b,_0x31e400))['catch'](handleError(_0x47005b,null));}; \ No newline at end of file +var _0x2d20=['json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','limit','count','offset','set'];(function(_0x1414b3,_0x477031){var _0x5761ab=function(_0x4017cd){while(--_0x4017cd){_0x1414b3['push'](_0x1414b3['shift']());}};_0x5761ab(++_0x477031);}(_0x2d20,0x6c));var _0x02d2=function(_0x525dad,_0x4603bb){_0x525dad=_0x525dad-0x0;var _0x33b8f8=_0x2d20[_0x525dad];return _0x33b8f8;};'use strict';var emlformat=require(_0x02d2('0x0'));var rimraf=require(_0x02d2('0x1'));var zipdir=require(_0x02d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x02d2('0x3'));var moment=require(_0x02d2('0x4'));var BPromise=require(_0x02d2('0x5'));var Mustache=require(_0x02d2('0x6'));var util=require(_0x02d2('0x7'));var path=require(_0x02d2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x02d2('0x9'));var fs=require('fs');var fs_extra=require(_0x02d2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x02d2('0xb'));var jsforce=require(_0x02d2('0xc'));var deskjs=require(_0x02d2('0xd'));var toCsv=require(_0x02d2('0xe'));var querystring=require(_0x02d2('0xf'));var Papa=require(_0x02d2('0x10'));var Redis=require(_0x02d2('0x11'));var authService=require(_0x02d2('0x12'));var qs=require(_0x02d2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x02d2('0x14'));var logger=require(_0x02d2('0x15'))(_0x02d2('0x16'));var utils=require(_0x02d2('0x17'));var config=require(_0x02d2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x253db9,_0x3c6811){_0x3c6811=_0x3c6811||0xcc;return function(_0x26f201){if(_0x26f201){return _0x253db9[_0x02d2('0x19')](_0x3c6811);}return _0x253db9[_0x02d2('0x1a')](_0x3c6811)[_0x02d2('0x1b')]();};}function respondWithResult(_0x1de7e7,_0x5e49f2){_0x5e49f2=_0x5e49f2||0xc8;return function(_0x1cccb3){if(_0x1cccb3){return _0x1de7e7['status'](_0x5e49f2)['json'](_0x1cccb3);}};}function respondWithFilteredResult(_0x4598e9,_0x4e0728){return function(_0xb8bfb9){if(_0xb8bfb9){var _0x1d1370=typeof _0x4e0728['offset']==='undefined'&&typeof _0x4e0728[_0x02d2('0x1c')]==='undefined';var _0x535daa=_0xb8bfb9[_0x02d2('0x1d')];var _0x47c521=_0x1d1370?0x0:_0x4e0728[_0x02d2('0x1e')];var _0x162592=_0x1d1370?_0xb8bfb9['count']:_0x4e0728['offset']+_0x4e0728[_0x02d2('0x1c')];var _0x1c77ba;if(_0x162592>=_0x535daa){_0x162592=_0x535daa;_0x1c77ba=0xc8;}else{_0x1c77ba=0xce;}_0x4598e9[_0x02d2('0x1a')](_0x1c77ba);return _0x4598e9[_0x02d2('0x1f')]('Content-Range',_0x47c521+'-'+_0x162592+'/'+_0x535daa)[_0x02d2('0x20')](_0xb8bfb9);}return null;};}function patchUpdates(_0x1619ef){return function(_0x38e838){try{jsonpatch[_0x02d2('0x21')](_0x38e838,_0x1619ef,!![]);}catch(_0x2e39d5){return BPromise[_0x02d2('0x22')](_0x2e39d5);}return _0x38e838[_0x02d2('0x23')]();};}function saveUpdates(_0x4253ad,_0x1420b3){return function(_0x2b1386){if(_0x2b1386){return _0x2b1386[_0x02d2('0x24')](_0x4253ad)[_0x02d2('0x25')](function(_0x1dd833){return _0x1dd833;});}return null;};}function removeEntity(_0x5d7f6c,_0x5abbb6){return function(_0x490e18){if(_0x490e18){return _0x490e18[_0x02d2('0x26')]()[_0x02d2('0x25')](function(){_0x5d7f6c[_0x02d2('0x1a')](0xcc)[_0x02d2('0x1b')]();});}};}function handleEntityNotFound(_0x17a99d,_0x505ad8){return function(_0xfab672){if(!_0xfab672){_0x17a99d['sendStatus'](0x194);}return _0xfab672;};}function handleError(_0xb593bf,_0x2f3768){_0x2f3768=_0x2f3768||0x1f4;return function(_0x1b3336){logger[_0x02d2('0x27')](_0x1b3336[_0x02d2('0x28')]);if(_0x1b3336[_0x02d2('0x29')]){delete _0x1b3336[_0x02d2('0x29')];}_0xb593bf['status'](_0x2f3768)[_0x02d2('0x2a')](_0x1b3336);};}exports[_0x02d2('0x2b')]=function(_0x1807a5,_0x240a23){var _0x25148f={},_0x5176a5={},_0x51a879={'count':0x0,'rows':[]};var _0x1a77be=_[_0x02d2('0x2c')](db[_0x02d2('0x2d')][_0x02d2('0x2e')],function(_0xbac831){return{'name':_0xbac831[_0x02d2('0x2f')],'type':_0xbac831['type'][_0x02d2('0x30')]};});_0x5176a5[_0x02d2('0x31')]=_[_0x02d2('0x2c')](_0x1a77be,'name');_0x5176a5[_0x02d2('0x32')]=_[_0x02d2('0x33')](_0x1807a5[_0x02d2('0x32')]);_0x5176a5['filters']=_[_0x02d2('0x34')](_0x5176a5['model'],_0x5176a5[_0x02d2('0x32')]);_0x25148f['attributes']=_[_0x02d2('0x34')](_0x5176a5['model'],qs['fields'](_0x1807a5['query'][_0x02d2('0x35')]));_0x25148f[_0x02d2('0x36')]=_0x25148f[_0x02d2('0x36')]['length']?_0x25148f['attributes']:_0x5176a5['model'];if(!_0x1807a5['query'][_0x02d2('0x37')](_0x02d2('0x38'))){_0x25148f[_0x02d2('0x1c')]=qs[_0x02d2('0x1c')](_0x1807a5[_0x02d2('0x32')]['limit']);_0x25148f[_0x02d2('0x1e')]=qs[_0x02d2('0x1e')](_0x1807a5[_0x02d2('0x32')]['offset']);}_0x25148f[_0x02d2('0x39')]=qs[_0x02d2('0x3a')](_0x1807a5[_0x02d2('0x32')][_0x02d2('0x3a')]);_0x25148f[_0x02d2('0x3b')]=qs['filters'](_[_0x02d2('0x3c')](_0x1807a5[_0x02d2('0x32')],_0x5176a5[_0x02d2('0x3d')]),_0x1a77be);if(_0x1807a5[_0x02d2('0x32')][_0x02d2('0x3e')]){_0x25148f[_0x02d2('0x3b')]=_[_0x02d2('0x3f')](_0x25148f['where'],{'$or':_['map'](_0x1a77be,function(_0x2494c0){if(_0x2494c0['type']!==_0x02d2('0x40')){var _0xd003f7={};_0xd003f7[_0x2494c0['name']]={'$like':'%'+_0x1807a5[_0x02d2('0x32')][_0x02d2('0x3e')]+'%'};return _0xd003f7;}})});}_0x25148f=_[_0x02d2('0x3f')]({},_0x25148f,_0x1807a5[_0x02d2('0x41')]);var _0x2380a6={'where':_0x25148f['where']};return db['Migration'][_0x02d2('0x1d')](_0x2380a6)['then'](function(_0x35b530){_0x51a879['count']=_0x35b530;if(_0x1807a5['query'][_0x02d2('0x42')]){_0x25148f['include']=[{'all':!![]}];}return db[_0x02d2('0x2d')][_0x02d2('0x43')](_0x25148f);})[_0x02d2('0x25')](function(_0x20d93d){_0x51a879[_0x02d2('0x44')]=_0x20d93d;return _0x51a879;})[_0x02d2('0x25')](respondWithFilteredResult(_0x240a23,_0x25148f))[_0x02d2('0x45')](handleError(_0x240a23,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index e62ffe2..bf4d9ed 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 _0xe06d=['Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./migration.attributes','exports','define'];(function(_0x2c53e9,_0x468731){var _0x5aa68b=function(_0x2e09bc){while(--_0x2e09bc){_0x2c53e9['push'](_0x2c53e9['shift']());}};_0x5aa68b(++_0x468731);}(_0xe06d,0x136));var _0xde06=function(_0x266798,_0x33dce3){_0x266798=_0x266798-0x0;var _0x59bb05=_0xe06d[_0x266798];return _0x59bb05;};'use strict';var _=require(_0xde06('0x0'));var util=require(_0xde06('0x1'));var logger=require(_0xde06('0x2'))(_0xde06('0x3'));var moment=require(_0xde06('0x4'));var BPromise=require(_0xde06('0x5'));var rp=require(_0xde06('0x6'));var fs=require('fs');var path=require(_0xde06('0x7'));var rimraf=require('rimraf');var config=require(_0xde06('0x8'));var attributes=require(_0xde06('0x9'));module[_0xde06('0xa')]=function(_0xe112cc,_0x279342){return _0xe112cc[_0xde06('0xb')](_0xde06('0xc'),attributes,{'tableName':_0xde06('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2473=['./migration.attributes','exports','migrations','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x2473,0x137));var _0x3247=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2473[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x3247('0x0'));var util=require(_0x3247('0x1'));var logger=require('../../config/logger')(_0x3247('0x2'));var moment=require(_0x3247('0x3'));var BPromise=require(_0x3247('0x4'));var rp=require(_0x3247('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3247('0x6'));var config=require(_0x3247('0x7'));var attributes=require(_0x3247('0x8'));module[_0x3247('0x9')]=function(_0x2038cf,_0x10a9dc){return _0x2038cf['define']('Migration',attributes,{'tableName':_0x3247('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 710ea76..865e9df 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 _0xab26=['message','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2ad02b,_0x45c42){var _0x466a9e=function(_0x27c4ee){while(--_0x27c4ee){_0x2ad02b['push'](_0x2ad02b['shift']());}};_0x466a9e(++_0x45c42);}(_0xab26,0xd2));var _0x6ab2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xab26[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x6ab2('0x0'));var util=require(_0x6ab2('0x1'));var moment=require(_0x6ab2('0x2'));var BPromise=require('bluebird');var rs=require(_0x6ab2('0x3'));var fs=require('fs');var Redis=require(_0x6ab2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ab2('0x5'))('rpc');var config=require(_0x6ab2('0x6'));var jayson=require(_0x6ab2('0x7'));var client=jayson[_0x6ab2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41643a,_0x337cdf,_0x54bf93){return new BPromise(function(_0x140cc1,_0x3157f1){return client[_0x6ab2('0x9')](_0x41643a,_0x54bf93)[_0x6ab2('0xa')](function(_0x3bb68b){logger[_0x6ab2('0xb')](_0x6ab2('0xc'),_0x337cdf,_0x6ab2('0xd'));logger[_0x6ab2('0xe')](_0x6ab2('0xf'),_0x337cdf,_0x6ab2('0xd'),JSON['stringify'](_0x3bb68b));if(_0x3bb68b[_0x6ab2('0x10')]){if(_0x3bb68b[_0x6ab2('0x10')][_0x6ab2('0x11')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x337cdf,_0x3bb68b[_0x6ab2('0x10')][_0x6ab2('0x12')]);return _0x3157f1(_0x3bb68b[_0x6ab2('0x10')][_0x6ab2('0x12')]);}logger[_0x6ab2('0x10')](_0x6ab2('0xc'),_0x337cdf,_0x3bb68b[_0x6ab2('0x10')][_0x6ab2('0x12')]);return _0x140cc1(_0x3bb68b['error'][_0x6ab2('0x12')]);}else{logger['info'](_0x6ab2('0xc'),_0x337cdf,_0x6ab2('0xd'));_0x140cc1(_0x3bb68b['result']['message']);}})['catch'](function(_0x2adc75){logger[_0x6ab2('0x10')](_0x6ab2('0xc'),_0x337cdf,_0x2adc75);_0x3157f1(_0x2adc75);});});} \ No newline at end of file +var _0x00b3=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x4a151d,_0x3b1d73){var _0x4c2e94=function(_0xcd729){while(--_0xcd729){_0x4a151d['push'](_0x4a151d['shift']());}};_0x4c2e94(++_0x3b1d73);}(_0x00b3,0x17a));var _0x300b=function(_0x4ca99e,_0x243705){_0x4ca99e=_0x4ca99e-0x0;var _0xd9dd70=_0x00b3[_0x4ca99e];return _0xd9dd70;};'use strict';var _=require('lodash');var util=require(_0x300b('0x0'));var moment=require(_0x300b('0x1'));var BPromise=require(_0x300b('0x2'));var rs=require(_0x300b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x300b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x300b('0x5'))('rpc');var config=require(_0x300b('0x6'));var jayson=require(_0x300b('0x7'));var client=jayson[_0x300b('0x8')][_0x300b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af470,_0x5dabb9,_0x30b3fe){return new BPromise(function(_0x590c4d,_0x5e283c){return client[_0x300b('0xa')](_0x5af470,_0x30b3fe)[_0x300b('0xb')](function(_0x457aa3){logger['info'](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));logger[_0x300b('0xe')](_0x300b('0xf'),_0x5dabb9,'request\x20sent',JSON[_0x300b('0x10')](_0x457aa3));if(_0x457aa3[_0x300b('0x11')]){if(_0x457aa3[_0x300b('0x11')]['code']===0x1f4){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);return _0x5e283c(_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);}logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3['error']['message']);return _0x590c4d(_0x457aa3['error']['message']);}else{logger[_0x300b('0x13')](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));_0x590c4d(_0x457aa3[_0x300b('0x14')]['message']);}})['catch'](function(_0x35b1d7){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x35b1d7);_0x5e283c(_0x35b1d7);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 0f95ed8..426fd81 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 _0x2499=['isAuthenticated','/:id','show','post','create','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2499,0x7d));var _0x9249=function(_0x481e8b,_0x317abe){_0x481e8b=_0x481e8b-0x0;var _0xd2c0b1=_0x2499[_0x481e8b];return _0xd2c0b1;};'use strict';var multer=require(_0x9249('0x0'));var util=require(_0x9249('0x1'));var path=require(_0x9249('0x2'));var timeout=require(_0x9249('0x3'));var express=require(_0x9249('0x4'));var router=express['Router']();var fs_extra=require(_0x9249('0x5'));var auth=require(_0x9249('0x6'));var interaction=require(_0x9249('0x7'));var config=require('../../config/environment');var controller=require(_0x9249('0x8'));router[_0x9249('0x9')]('/',auth[_0x9249('0xa')](),controller['index']);router[_0x9249('0x9')](_0x9249('0xb'),auth[_0x9249('0xa')](),controller[_0x9249('0xc')]);router[_0x9249('0xd')]('/',auth[_0x9249('0xa')](),controller[_0x9249('0xe')]);router['put'](_0x9249('0xb'),auth[_0x9249('0xa')](),controller['update']);router['delete'](_0x9249('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x36e0=['Router','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index','/:id','create','put','destroy','exports','multer','util','connect-timeout','express'];(function(_0x1190c3,_0x47c90c){var _0x5c94d8=function(_0x559543){while(--_0x559543){_0x1190c3['push'](_0x1190c3['shift']());}};_0x5c94d8(++_0x47c90c);}(_0x36e0,0x15c));var _0x036e=function(_0xf6a090,_0x1cd396){_0xf6a090=_0xf6a090-0x0;var _0x35f264=_0x36e0[_0xf6a090];return _0x35f264;};'use strict';var multer=require(_0x036e('0x0'));var util=require(_0x036e('0x1'));var path=require('path');var timeout=require(_0x036e('0x2'));var express=require(_0x036e('0x3'));var router=express[_0x036e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x036e('0x5'));var interaction=require(_0x036e('0x6'));var config=require('../../config/environment');var controller=require(_0x036e('0x7'));router[_0x036e('0x8')]('/',auth[_0x036e('0x9')](),controller[_0x036e('0xa')]);router[_0x036e('0x8')](_0x036e('0xb'),auth[_0x036e('0x9')](),controller['show']);router['post']('/',auth[_0x036e('0x9')](),controller[_0x036e('0xc')]);router[_0x036e('0xd')](_0x036e('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x036e('0xb'),auth[_0x036e('0x9')](),controller[_0x036e('0xe')]);module[_0x036e('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index f70ce5e..7348c75 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 _0x61a5=['STRING','localnet','externip','stun','turn'];(function(_0x28ebfe,_0x1589a5){var _0x3e9d6e=function(_0x136f82){while(--_0x136f82){_0x28ebfe['push'](_0x28ebfe['shift']());}};_0x3e9d6e(++_0x1589a5);}(_0x61a5,0xb5));var _0x561a=function(_0x216f7d,_0x496249){_0x216f7d=_0x216f7d-0x0;var _0xc49d7f=_0x61a5[_0x216f7d];return _0xc49d7f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x561a('0x0'),_0x561a('0x1'),_0x561a('0x2'),_0x561a('0x3'))},'value':{'type':Sequelize[_0x561a('0x4')]},'username':{'type':Sequelize[_0x561a('0x4')]},'password':{'type':Sequelize[_0x561a('0x4')]}}; \ No newline at end of file +var _0x98d1=['sequelize','ENUM','localnet','externip','stun','turn','STRING'];(function(_0x1fca6c,_0x2bbb55){var _0x4583de=function(_0x3cba69){while(--_0x3cba69){_0x1fca6c['push'](_0x1fca6c['shift']());}};_0x4583de(++_0x2bbb55);}(_0x98d1,0x165));var _0x198d=function(_0x2dcd4d,_0x537fd4){_0x2dcd4d=_0x2dcd4d-0x0;var _0x344adc=_0x98d1[_0x2dcd4d];return _0x344adc;};'use strict';var Sequelize=require(_0x198d('0x0'));module['exports']={'type':{'type':Sequelize[_0x198d('0x1')](_0x198d('0x2'),_0x198d('0x3'),_0x198d('0x4'),_0x198d('0x5'))},'value':{'type':Sequelize[_0x198d('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x198d('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index fac90d2..f840c7a 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 _0x2ffa=['length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','show','options','find','sequelize','transaction','create','body','findAll','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','res_stun_monitor.so','TURN','Reload','root','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','/etc/asterisk/stun_xcally.conf','/etc/asterisk/turn_xcally.conf','format','params','destroy','server/files/templates/turn_multiple.ejs','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','apply','end','stack','name','send','Network','rawAttributes','fieldName','type','model','map','keys','filters','intersection','attributes','query','fields'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x2ffa,0x16e));var _0xa2ff=function(_0x230cb4,_0x22bc66){_0x230cb4=_0x230cb4-0x0;var _0x3fb8ae=_0x2ffa[_0x230cb4];return _0x3fb8ae;};'use strict';var emlformat=require(_0xa2ff('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa2ff('0x1'));var moment=require(_0xa2ff('0x2'));var BPromise=require(_0xa2ff('0x3'));var Mustache=require(_0xa2ff('0x4'));var util=require(_0xa2ff('0x5'));var path=require(_0xa2ff('0x6'));var sox=require(_0xa2ff('0x7'));var csv=require(_0xa2ff('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa2ff('0x9'));var _=require(_0xa2ff('0xa'));var squel=require(_0xa2ff('0xb'));var crypto=require(_0xa2ff('0xc'));var jsforce=require(_0xa2ff('0xd'));var deskjs=require(_0xa2ff('0xe'));var toCsv=require(_0xa2ff('0x8'));var querystring=require(_0xa2ff('0xf'));var Papa=require(_0xa2ff('0x10'));var Redis=require(_0xa2ff('0x11'));var authService=require(_0xa2ff('0x12'));var qs=require(_0xa2ff('0x13'));var as=require(_0xa2ff('0x14'));var hardwareService=require(_0xa2ff('0x15'));var logger=require(_0xa2ff('0x16'))(_0xa2ff('0x17'));var utils=require(_0xa2ff('0x18'));var config=require(_0xa2ff('0x19'));var licenseUtil=require(_0xa2ff('0x1a'));var db=require(_0xa2ff('0x1b'))['db'];var jayson=require(_0xa2ff('0x1c'));var client=jayson[_0xa2ff('0x1d')][_0xa2ff('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x13c19f,_0x2b770c,_0x596227,_0x5e3720){return new BPromise(function(_0x42e074,_0x1c7577){var _0x47eff7=_0x5e3720||client;return _0x47eff7[_0xa2ff('0x1f')](_0x13c19f,_0x596227)[_0xa2ff('0x20')](function(_0x48d2a0){logger['info'](_0xa2ff('0x21'),_0x2b770c,_0xa2ff('0x22'));logger['debug'](_0xa2ff('0x23'),_0x2b770c,_0xa2ff('0x22'),JSON[_0xa2ff('0x24')](_0x48d2a0));if(_0x48d2a0['error']){if(_0x48d2a0[_0xa2ff('0x25')][_0xa2ff('0x26')]===0x1f4){logger['error'](_0xa2ff('0x21'),_0x2b770c,_0x48d2a0[_0xa2ff('0x25')][_0xa2ff('0x27')]);return _0x1c7577(_0x48d2a0[_0xa2ff('0x25')][_0xa2ff('0x27')]);}logger[_0xa2ff('0x25')](_0xa2ff('0x21'),_0x2b770c,_0x48d2a0[_0xa2ff('0x25')][_0xa2ff('0x27')]);return _0x42e074(_0x48d2a0[_0xa2ff('0x25')][_0xa2ff('0x27')]);}else{logger['info'](_0xa2ff('0x21'),_0x2b770c,_0xa2ff('0x22'));_0x42e074(_0x48d2a0[_0xa2ff('0x28')][_0xa2ff('0x27')]);}})[_0xa2ff('0x29')](function(_0x3c0c65){logger[_0xa2ff('0x25')](_0xa2ff('0x21'),_0x2b770c,_0x3c0c65);_0x1c7577(_0x3c0c65);});});}function respondWithStatusCode(_0x229e42,_0x418369){_0x418369=_0x418369||0xcc;return function(_0x4ee337){if(_0x4ee337){return _0x229e42[_0xa2ff('0x2a')](_0x418369);}return _0x229e42[_0xa2ff('0x2b')](_0x418369)['end']();};}function respondWithResult(_0x2eddaa,_0x25816a){_0x25816a=_0x25816a||0xc8;return function(_0x30fca9){if(_0x30fca9){return _0x2eddaa[_0xa2ff('0x2b')](_0x25816a)['json'](_0x30fca9);}};}function respondWithFilteredResult(_0x830c6b,_0xddc662){return function(_0x128658){if(_0x128658){var _0x1e6109=typeof _0xddc662[_0xa2ff('0x2c')]==='undefined'&&typeof _0xddc662['limit']==='undefined';var _0x459ca9=_0x128658['count'];var _0x9da704=_0x1e6109?0x0:_0xddc662[_0xa2ff('0x2c')];var _0x160025=_0x1e6109?_0x128658['count']:_0xddc662[_0xa2ff('0x2c')]+_0xddc662['limit'];var _0x2d6112;if(_0x160025>=_0x459ca9){_0x160025=_0x459ca9;_0x2d6112=0xc8;}else{_0x2d6112=0xce;}_0x830c6b[_0xa2ff('0x2b')](_0x2d6112);return _0x830c6b['set']('Content-Range',_0x9da704+'-'+_0x160025+'/'+_0x459ca9)['json'](_0x128658);}return null;};}function patchUpdates(_0x9d5a43){return function(_0x49ad75){try{jsonpatch[_0xa2ff('0x2d')](_0x49ad75,_0x9d5a43,!![]);}catch(_0x4ecf71){return BPromise['reject'](_0x4ecf71);}return _0x49ad75['save']();};}function saveUpdates(_0xb43678,_0x56db9a){return function(_0xd5b4fb){if(_0xd5b4fb){return _0xd5b4fb['update'](_0xb43678)[_0xa2ff('0x20')](function(_0x254f51){return _0x254f51;});}return null;};}function removeEntity(_0x4bfe01,_0x578458){return function(_0x58f0ad){if(_0x58f0ad){return _0x58f0ad['destroy']()['then'](function(){_0x4bfe01[_0xa2ff('0x2b')](0xcc)[_0xa2ff('0x2e')]();});}};}function handleEntityNotFound(_0x598134,_0x2f4c00){return function(_0x3cfad9){if(!_0x3cfad9){_0x598134[_0xa2ff('0x2a')](0x194);}return _0x3cfad9;};}function handleError(_0x1a42f1,_0x18446e){_0x18446e=_0x18446e||0x1f4;return function(_0x42179f){logger[_0xa2ff('0x25')](_0x42179f[_0xa2ff('0x2f')]);if(_0x42179f[_0xa2ff('0x30')]){delete _0x42179f['name'];}_0x1a42f1[_0xa2ff('0x2b')](_0x18446e)[_0xa2ff('0x31')](_0x42179f);};}exports['index']=function(_0x3a10ac,_0x39a610){var _0x517356={},_0x40d96d={},_0x2aa649={'count':0x0,'rows':[]};var _0x921953=_['map'](db[_0xa2ff('0x32')][_0xa2ff('0x33')],function(_0x28e12d){return{'name':_0x28e12d[_0xa2ff('0x34')],'type':_0x28e12d[_0xa2ff('0x35')]['key']};});_0x40d96d[_0xa2ff('0x36')]=_[_0xa2ff('0x37')](_0x921953,'name');_0x40d96d['query']=_[_0xa2ff('0x38')](_0x3a10ac['query']);_0x40d96d[_0xa2ff('0x39')]=_[_0xa2ff('0x3a')](_0x40d96d['model'],_0x40d96d['query']);_0x517356[_0xa2ff('0x3b')]=_[_0xa2ff('0x3a')](_0x40d96d[_0xa2ff('0x36')],qs['fields'](_0x3a10ac[_0xa2ff('0x3c')][_0xa2ff('0x3d')]));_0x517356[_0xa2ff('0x3b')]=_0x517356['attributes'][_0xa2ff('0x3e')]?_0x517356[_0xa2ff('0x3b')]:_0x40d96d[_0xa2ff('0x36')];if(!_0x3a10ac[_0xa2ff('0x3c')][_0xa2ff('0x3f')]('nolimit')){_0x517356['limit']=qs[_0xa2ff('0x40')](_0x3a10ac['query']['limit']);_0x517356['offset']=qs[_0xa2ff('0x2c')](_0x3a10ac['query']['offset']);}_0x517356[_0xa2ff('0x41')]=qs[_0xa2ff('0x42')](_0x3a10ac['query'][_0xa2ff('0x42')]);_0x517356[_0xa2ff('0x43')]=qs[_0xa2ff('0x39')](_[_0xa2ff('0x44')](_0x3a10ac[_0xa2ff('0x3c')],_0x40d96d[_0xa2ff('0x39')]),_0x921953);if(_0x3a10ac['query'][_0xa2ff('0x45')]){_0x517356[_0xa2ff('0x43')]=_[_0xa2ff('0x46')](_0x517356[_0xa2ff('0x43')],{'$or':_['map'](_0x921953,function(_0x5726a7){if(_0x5726a7['type']!==_0xa2ff('0x47')){var _0x30a1d3={};_0x30a1d3[_0x5726a7[_0xa2ff('0x30')]]={'$like':'%'+_0x3a10ac[_0xa2ff('0x3c')][_0xa2ff('0x45')]+'%'};return _0x30a1d3;}})});}_0x517356=_[_0xa2ff('0x46')]({},_0x517356,_0x3a10ac['options']);var _0x33396d={'where':_0x517356[_0xa2ff('0x43')]};return db[_0xa2ff('0x32')][_0xa2ff('0x48')](_0x33396d)[_0xa2ff('0x20')](function(_0x43c02b){_0x2aa649[_0xa2ff('0x48')]=_0x43c02b;if(_0x3a10ac[_0xa2ff('0x3c')][_0xa2ff('0x49')]){_0x517356[_0xa2ff('0x4a')]=[{'all':!![]}];}return db[_0xa2ff('0x32')]['findAll'](_0x517356);})['then'](function(_0x9cdce){_0x2aa649[_0xa2ff('0x4b')]=_0x9cdce;return _0x2aa649;})[_0xa2ff('0x20')](respondWithFilteredResult(_0x39a610,_0x517356))[_0xa2ff('0x29')](handleError(_0x39a610,null));};exports[_0xa2ff('0x4c')]=function(_0x5bc89f,_0xc10bd7){var _0xcdff63={'raw':!![],'where':{'id':_0x5bc89f['params']['id']}},_0x1af0d5={};_0x1af0d5[_0xa2ff('0x36')]=_[_0xa2ff('0x38')](db[_0xa2ff('0x32')]['rawAttributes']);_0x1af0d5[_0xa2ff('0x3c')]=_[_0xa2ff('0x38')](_0x5bc89f[_0xa2ff('0x3c')]);_0x1af0d5[_0xa2ff('0x39')]=_[_0xa2ff('0x3a')](_0x1af0d5[_0xa2ff('0x36')],_0x1af0d5['query']);_0xcdff63['attributes']=_[_0xa2ff('0x3a')](_0x1af0d5['model'],qs[_0xa2ff('0x3d')](_0x5bc89f[_0xa2ff('0x3c')][_0xa2ff('0x3d')]));_0xcdff63['attributes']=_0xcdff63[_0xa2ff('0x3b')]['length']?_0xcdff63['attributes']:_0x1af0d5[_0xa2ff('0x36')];if(_0x5bc89f[_0xa2ff('0x3c')][_0xa2ff('0x49')]){_0xcdff63['include']=[{'all':!![]}];}_0xcdff63=_['merge']({},_0xcdff63,_0x5bc89f[_0xa2ff('0x4d')]);return db[_0xa2ff('0x32')][_0xa2ff('0x4e')](_0xcdff63)['then'](handleEntityNotFound(_0xc10bd7,null))[_0xa2ff('0x20')](respondWithResult(_0xc10bd7,null))[_0xa2ff('0x29')](handleError(_0xc10bd7,null));};exports['create']=function(_0x56e988,_0x3b9374,_0x15e289){var _0x58bb4b;return db[_0xa2ff('0x4f')][_0xa2ff('0x50')](function(_0x4bd34d){return db['Network'][_0xa2ff('0x51')](_0x56e988[_0xa2ff('0x52')],{'raw':!![]})[_0xa2ff('0x20')](function(_0x29f61b){_0x58bb4b=_0x29f61b;return db[_0xa2ff('0x32')][_0xa2ff('0x53')]({'where':{'type':_0x56e988[_0xa2ff('0x52')][_0xa2ff('0x35')]},'raw':!![]});})[_0xa2ff('0x20')](function(_0x303faf){if(_0x58bb4b['type'][_0xa2ff('0x54')]()==_0xa2ff('0x55')){var _0x54e58c=fs[_0xa2ff('0x56')](path[_0xa2ff('0x57')](config['root'],_0xa2ff('0x58')),_0xa2ff('0x59'));var _0x3bd8a1=ejs[_0xa2ff('0x5a')](_0x54e58c,{'networks':_0x303faf||[]});fs[_0xa2ff('0x5b')]('/etc/asterisk/stun_xcally.conf',_0x3bd8a1);return respondWithRpcPromise('Reload','create',{'module':_0xa2ff('0x5c')});}else if(_0x58bb4b[_0xa2ff('0x35')]['toUpperCase']()==_0xa2ff('0x5d')){var _0x18cbc8=fs[_0xa2ff('0x56')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0xa2ff('0x59'));var _0x26a7b8=ejs['render'](_0x18cbc8,{'networks':_0x303faf||[]});fs[_0xa2ff('0x5b')]('/etc/asterisk/turn_xcally.conf',_0x26a7b8);return respondWithRpcPromise(_0xa2ff('0x5e'),_0xa2ff('0x51'),{'module':'res_stun_monitor.so'});}else{var _0x13d86c=fs[_0xa2ff('0x56')](path['join'](config[_0xa2ff('0x5f')],_0xa2ff('0x60')),'utf8');var _0x599625=ejs['render'](_0x13d86c,{'networks':_0x303faf||[]});fs[_0xa2ff('0x5b')](util['format'](_0xa2ff('0x61'),_0x56e988['body']['type'][_0xa2ff('0x62')]()),_0x599625);return respondWithRpcPromise(_0xa2ff('0x5e'),_0xa2ff('0x51'),{'module':_0xa2ff('0x63')});}return null;})[_0xa2ff('0x20')](function(){return _0x58bb4b;});})['then'](respondWithResult(_0x3b9374,0xc9))[_0xa2ff('0x29')](handleError(_0x3b9374,null));};exports[_0xa2ff('0x64')]=function(_0x423d5e,_0x589832,_0x348255){var _0x205dc4;return db[_0xa2ff('0x4f')]['transaction'](function(_0x4b503c){return db[_0xa2ff('0x32')]['find']({'where':{'id':_0x423d5e['params']['id']}})[_0xa2ff('0x20')](handleEntityNotFound(_0x589832,null))[_0xa2ff('0x20')](saveUpdates(_0x423d5e[_0xa2ff('0x52')],null))['then'](function(_0x211a5c){if(_0x211a5c){_0x205dc4=_0x211a5c;return db[_0xa2ff('0x32')][_0xa2ff('0x53')]({'where':{'type':_0x205dc4[_0xa2ff('0x35')]},'raw':!![]});}return null;})[_0xa2ff('0x20')](function(_0x451ea3){if(_0x205dc4[_0xa2ff('0x35')][_0xa2ff('0x54')]()=='STUN'){var _0x806799=fs[_0xa2ff('0x56')](path[_0xa2ff('0x57')](config[_0xa2ff('0x5f')],_0xa2ff('0x58')),_0xa2ff('0x59'));var _0x2b40b7=ejs[_0xa2ff('0x5a')](_0x806799,{'networks':_0x451ea3||[]});fs[_0xa2ff('0x5b')](_0xa2ff('0x65'),_0x2b40b7);return respondWithRpcPromise(_0xa2ff('0x5e'),_0xa2ff('0x64'),{'module':_0xa2ff('0x5c')});}else if(_0x205dc4[_0xa2ff('0x35')][_0xa2ff('0x54')]()==_0xa2ff('0x5d')){var _0x174f13=fs['readFileSync'](path[_0xa2ff('0x57')](config[_0xa2ff('0x5f')],'server/files/templates/turn_multiple.ejs'),_0xa2ff('0x59'));var _0x102416=ejs['render'](_0x174f13,{'networks':_0x451ea3||[]});fs[_0xa2ff('0x5b')](_0xa2ff('0x66'),_0x102416);return respondWithRpcPromise(_0xa2ff('0x5e'),_0xa2ff('0x64'),{'module':_0xa2ff('0x5c')});}else{var _0x5a0b91=fs['readFileSync'](path['join'](config[_0xa2ff('0x5f')],_0xa2ff('0x60')),_0xa2ff('0x59'));var _0x292789=ejs[_0xa2ff('0x5a')](_0x5a0b91,{'networks':_0x451ea3||[]});fs['writeFileSync'](util[_0xa2ff('0x67')](_0xa2ff('0x61'),_0x423d5e[_0xa2ff('0x52')][_0xa2ff('0x35')][_0xa2ff('0x62')]()),_0x292789);return respondWithRpcPromise(_0xa2ff('0x5e'),_0xa2ff('0x64'),{'module':'chan_sip.so'});}return null;})[_0xa2ff('0x20')](function(_0x240aa6){if(_0x240aa6){return _0x205dc4;}return null;});})['then'](respondWithResult(_0x589832,null))[_0xa2ff('0x29')](handleError(_0x589832,null));};exports['destroy']=function(_0x5240c2,_0x74ec9a,_0x5ec91d){var _0x369338;return db[_0xa2ff('0x32')][_0xa2ff('0x4e')]({'where':{'id':_0x5240c2[_0xa2ff('0x68')]['id']}})[_0xa2ff('0x20')](function(_0x5c151e){_0x369338=_0x5c151e;return _0x5c151e;})['then'](handleEntityNotFound(_0x74ec9a,null))[_0xa2ff('0x20')](removeEntity(_0x74ec9a,null))[_0xa2ff('0x20')](function(){if(_0x369338){return db[_0xa2ff('0x32')][_0xa2ff('0x53')]({'where':{'type':_0x369338[_0xa2ff('0x35')]},'raw':!![]});}})['then'](function(_0x1042dc){if(_0x369338[_0xa2ff('0x35')]['toUpperCase']()==_0xa2ff('0x55')){var _0xff1b0a=fs[_0xa2ff('0x56')](path[_0xa2ff('0x57')](config[_0xa2ff('0x5f')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x936fad=ejs[_0xa2ff('0x5a')](_0xff1b0a,{'networks':_0x1042dc||[]});fs[_0xa2ff('0x5b')](_0xa2ff('0x65'),_0x936fad);return respondWithRpcPromise(_0xa2ff('0x5e'),_0xa2ff('0x69'),{'module':_0xa2ff('0x5c')});}else if(_0x369338[_0xa2ff('0x35')][_0xa2ff('0x54')]()==_0xa2ff('0x5d')){var _0x57e4ba=fs[_0xa2ff('0x56')](path['join'](config[_0xa2ff('0x5f')],_0xa2ff('0x6a')),_0xa2ff('0x59'));var _0xe0648=ejs[_0xa2ff('0x5a')](_0x57e4ba,{'networks':_0x1042dc||[]});fs[_0xa2ff('0x5b')]('/etc/asterisk/turn_xcally.conf',_0xe0648);return respondWithRpcPromise(_0xa2ff('0x5e'),'destroy',{'module':_0xa2ff('0x5c')});}else{var _0x3f726b=fs['readFileSync'](path[_0xa2ff('0x57')](config[_0xa2ff('0x5f')],'server/files/templates/network.ejs'),_0xa2ff('0x59'));var _0x53d22d=ejs[_0xa2ff('0x5a')](_0x3f726b,{'networks':_0x1042dc||[]});fs[_0xa2ff('0x5b')](util['format'](_0xa2ff('0x61'),_0x5240c2[_0xa2ff('0x52')][_0xa2ff('0x35')][_0xa2ff('0x62')]()),_0x53d22d);return respondWithRpcPromise(_0xa2ff('0x5e'),'destroy',{'module':_0xa2ff('0x63')});}return null;})['catch'](handleError(_0x74ec9a,null));}; \ No newline at end of file +var _0x6208=['undefined','limit','count','Content-Range','apply','update','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','rows','show','params','keys','includeAll','find','sequelize','transaction','create','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','chan_sip.so','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','destroy','findAll','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset'];(function(_0x2b47ad,_0x55c7cc){var _0x1a2426=function(_0x47285b){while(--_0x47285b){_0x2b47ad['push'](_0x2b47ad['shift']());}};_0x1a2426(++_0x55c7cc);}(_0x6208,0x17d));var _0x8620=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0x6208[_0x2932cf];return _0x1711dd;};'use strict';var emlformat=require(_0x8620('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8620('0x1'));var jsonpatch=require(_0x8620('0x2'));var rp=require('request-promise');var moment=require(_0x8620('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8620('0x4'));var util=require(_0x8620('0x5'));var path=require(_0x8620('0x6'));var sox=require(_0x8620('0x7'));var csv=require(_0x8620('0x8'));var ejs=require(_0x8620('0x9'));var fs=require('fs');var fs_extra=require(_0x8620('0xa'));var _=require('lodash');var squel=require(_0x8620('0xb'));var crypto=require(_0x8620('0xc'));var jsforce=require(_0x8620('0xd'));var deskjs=require(_0x8620('0xe'));var toCsv=require(_0x8620('0x8'));var querystring=require(_0x8620('0xf'));var Papa=require(_0x8620('0x10'));var Redis=require(_0x8620('0x11'));var authService=require(_0x8620('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8620('0x13'));var hardwareService=require(_0x8620('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x8620('0x15'));var config=require(_0x8620('0x16'));var licenseUtil=require(_0x8620('0x17'));var db=require(_0x8620('0x18'))['db'];var jayson=require(_0x8620('0x19'));var client=jayson[_0x8620('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc51dc4,_0x5a1f8f,_0xdfa354,_0x2747b3){return new BPromise(function(_0x2490bb,_0x1e6721){var _0x592551=_0x2747b3||client;return _0x592551[_0x8620('0x1b')](_0xc51dc4,_0xdfa354)[_0x8620('0x1c')](function(_0x5908c0){logger['info'](_0x8620('0x1d'),_0x5a1f8f,_0x8620('0x1e'));logger['debug'](_0x8620('0x1f'),_0x5a1f8f,'request\x20sent',JSON[_0x8620('0x20')](_0x5908c0));if(_0x5908c0[_0x8620('0x21')]){if(_0x5908c0[_0x8620('0x21')][_0x8620('0x22')]===0x1f4){logger[_0x8620('0x21')](_0x8620('0x1d'),_0x5a1f8f,_0x5908c0[_0x8620('0x21')][_0x8620('0x23')]);return _0x1e6721(_0x5908c0[_0x8620('0x21')][_0x8620('0x23')]);}logger[_0x8620('0x21')](_0x8620('0x1d'),_0x5a1f8f,_0x5908c0[_0x8620('0x21')][_0x8620('0x23')]);return _0x2490bb(_0x5908c0[_0x8620('0x21')][_0x8620('0x23')]);}else{logger[_0x8620('0x24')](_0x8620('0x1d'),_0x5a1f8f,_0x8620('0x1e'));_0x2490bb(_0x5908c0[_0x8620('0x25')]['message']);}})[_0x8620('0x26')](function(_0x3e3f59){logger[_0x8620('0x21')](_0x8620('0x1d'),_0x5a1f8f,_0x3e3f59);_0x1e6721(_0x3e3f59);});});}function respondWithStatusCode(_0xca485e,_0x291e6b){_0x291e6b=_0x291e6b||0xcc;return function(_0x28c3e1){if(_0x28c3e1){return _0xca485e[_0x8620('0x27')](_0x291e6b);}return _0xca485e[_0x8620('0x28')](_0x291e6b)['end']();};}function respondWithResult(_0x4d03cb,_0x5b9e92){_0x5b9e92=_0x5b9e92||0xc8;return function(_0x42a703){if(_0x42a703){return _0x4d03cb[_0x8620('0x28')](_0x5b9e92)[_0x8620('0x29')](_0x42a703);}};}function respondWithFilteredResult(_0x56cf13,_0x2d8cbd){return function(_0x2671fb){if(_0x2671fb){var _0x9943f4=typeof _0x2d8cbd[_0x8620('0x2a')]===_0x8620('0x2b')&&typeof _0x2d8cbd[_0x8620('0x2c')]===_0x8620('0x2b');var _0x5e515c=_0x2671fb[_0x8620('0x2d')];var _0x524fc5=_0x9943f4?0x0:_0x2d8cbd[_0x8620('0x2a')];var _0x40e639=_0x9943f4?_0x2671fb[_0x8620('0x2d')]:_0x2d8cbd['offset']+_0x2d8cbd[_0x8620('0x2c')];var _0x4c48c0;if(_0x40e639>=_0x5e515c){_0x40e639=_0x5e515c;_0x4c48c0=0xc8;}else{_0x4c48c0=0xce;}_0x56cf13[_0x8620('0x28')](_0x4c48c0);return _0x56cf13['set'](_0x8620('0x2e'),_0x524fc5+'-'+_0x40e639+'/'+_0x5e515c)[_0x8620('0x29')](_0x2671fb);}return null;};}function patchUpdates(_0xc1af2b){return function(_0x21eea2){try{jsonpatch[_0x8620('0x2f')](_0x21eea2,_0xc1af2b,!![]);}catch(_0x3d9300){return BPromise['reject'](_0x3d9300);}return _0x21eea2['save']();};}function saveUpdates(_0x5d6693,_0x5d2032){return function(_0x1b919f){if(_0x1b919f){return _0x1b919f[_0x8620('0x30')](_0x5d6693)[_0x8620('0x1c')](function(_0x4e9d1d){return _0x4e9d1d;});}return null;};}function removeEntity(_0x5ec975,_0x572fc2){return function(_0x2f5697){if(_0x2f5697){return _0x2f5697['destroy']()['then'](function(){_0x5ec975['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x132b39,_0x1d527f){return function(_0x119866){if(!_0x119866){_0x132b39[_0x8620('0x27')](0x194);}return _0x119866;};}function handleError(_0x3dd626,_0x24dad0){_0x24dad0=_0x24dad0||0x1f4;return function(_0x202b91){logger[_0x8620('0x21')](_0x202b91[_0x8620('0x31')]);if(_0x202b91['name']){delete _0x202b91[_0x8620('0x32')];}_0x3dd626[_0x8620('0x28')](_0x24dad0)[_0x8620('0x33')](_0x202b91);};}exports[_0x8620('0x34')]=function(_0x597a18,_0x454f34){var _0x2cc394={},_0x22a325={},_0x40b0f7={'count':0x0,'rows':[]};var _0x1cff9f=_[_0x8620('0x35')](db[_0x8620('0x36')][_0x8620('0x37')],function(_0x3aee4a){return{'name':_0x3aee4a[_0x8620('0x38')],'type':_0x3aee4a[_0x8620('0x39')][_0x8620('0x3a')]};});_0x22a325[_0x8620('0x3b')]=_[_0x8620('0x35')](_0x1cff9f,_0x8620('0x32'));_0x22a325[_0x8620('0x3c')]=_['keys'](_0x597a18[_0x8620('0x3c')]);_0x22a325[_0x8620('0x3d')]=_['intersection'](_0x22a325['model'],_0x22a325[_0x8620('0x3c')]);_0x2cc394[_0x8620('0x3e')]=_[_0x8620('0x3f')](_0x22a325[_0x8620('0x3b')],qs[_0x8620('0x40')](_0x597a18['query'][_0x8620('0x40')]));_0x2cc394[_0x8620('0x3e')]=_0x2cc394[_0x8620('0x3e')]['length']?_0x2cc394[_0x8620('0x3e')]:_0x22a325[_0x8620('0x3b')];if(!_0x597a18['query'][_0x8620('0x41')](_0x8620('0x42'))){_0x2cc394['limit']=qs[_0x8620('0x2c')](_0x597a18[_0x8620('0x3c')]['limit']);_0x2cc394[_0x8620('0x2a')]=qs[_0x8620('0x2a')](_0x597a18['query'][_0x8620('0x2a')]);}_0x2cc394['order']=qs[_0x8620('0x43')](_0x597a18[_0x8620('0x3c')]['sort']);_0x2cc394[_0x8620('0x44')]=qs['filters'](_[_0x8620('0x45')](_0x597a18[_0x8620('0x3c')],_0x22a325[_0x8620('0x3d')]),_0x1cff9f);if(_0x597a18['query'][_0x8620('0x46')]){_0x2cc394['where']=_[_0x8620('0x47')](_0x2cc394[_0x8620('0x44')],{'$or':_[_0x8620('0x35')](_0x1cff9f,function(_0xff849a){if(_0xff849a[_0x8620('0x39')]!=='VIRTUAL'){var _0x35bee2={};_0x35bee2[_0xff849a[_0x8620('0x32')]]={'$like':'%'+_0x597a18[_0x8620('0x3c')]['filter']+'%'};return _0x35bee2;}})});}_0x2cc394=_[_0x8620('0x47')]({},_0x2cc394,_0x597a18[_0x8620('0x48')]);var _0x473dc1={'where':_0x2cc394['where']};return db[_0x8620('0x36')][_0x8620('0x2d')](_0x473dc1)[_0x8620('0x1c')](function(_0x375b96){_0x40b0f7['count']=_0x375b96;if(_0x597a18[_0x8620('0x3c')]['includeAll']){_0x2cc394[_0x8620('0x49')]=[{'all':!![]}];}return db[_0x8620('0x36')]['findAll'](_0x2cc394);})[_0x8620('0x1c')](function(_0x1091fe){_0x40b0f7[_0x8620('0x4a')]=_0x1091fe;return _0x40b0f7;})[_0x8620('0x1c')](respondWithFilteredResult(_0x454f34,_0x2cc394))[_0x8620('0x26')](handleError(_0x454f34,null));};exports[_0x8620('0x4b')]=function(_0x3a3358,_0x5b9fff){var _0x2d8ea9={'raw':!![],'where':{'id':_0x3a3358[_0x8620('0x4c')]['id']}},_0x4d5861={};_0x4d5861[_0x8620('0x3b')]=_['keys'](db['Network'][_0x8620('0x37')]);_0x4d5861[_0x8620('0x3c')]=_[_0x8620('0x4d')](_0x3a3358[_0x8620('0x3c')]);_0x4d5861[_0x8620('0x3d')]=_[_0x8620('0x3f')](_0x4d5861[_0x8620('0x3b')],_0x4d5861['query']);_0x2d8ea9[_0x8620('0x3e')]=_[_0x8620('0x3f')](_0x4d5861[_0x8620('0x3b')],qs[_0x8620('0x40')](_0x3a3358['query'][_0x8620('0x40')]));_0x2d8ea9[_0x8620('0x3e')]=_0x2d8ea9[_0x8620('0x3e')]['length']?_0x2d8ea9[_0x8620('0x3e')]:_0x4d5861['model'];if(_0x3a3358['query'][_0x8620('0x4e')]){_0x2d8ea9[_0x8620('0x49')]=[{'all':!![]}];}_0x2d8ea9=_[_0x8620('0x47')]({},_0x2d8ea9,_0x3a3358[_0x8620('0x48')]);return db[_0x8620('0x36')][_0x8620('0x4f')](_0x2d8ea9)[_0x8620('0x1c')](handleEntityNotFound(_0x5b9fff,null))['then'](respondWithResult(_0x5b9fff,null))[_0x8620('0x26')](handleError(_0x5b9fff,null));};exports['create']=function(_0x4ae682,_0x194c9c,_0x3f2411){var _0x1c00da;return db[_0x8620('0x50')][_0x8620('0x51')](function(_0x25c5d7){return db[_0x8620('0x36')][_0x8620('0x52')](_0x4ae682[_0x8620('0x53')],{'raw':!![]})[_0x8620('0x1c')](function(_0x36f8eb){_0x1c00da=_0x36f8eb;return db[_0x8620('0x36')]['findAll']({'where':{'type':_0x4ae682[_0x8620('0x53')]['type']},'raw':!![]});})[_0x8620('0x1c')](function(_0x2e88e1){if(_0x1c00da['type'][_0x8620('0x54')]()==_0x8620('0x55')){var _0x314ce3=fs[_0x8620('0x56')](path['join'](config[_0x8620('0x57')],_0x8620('0x58')),_0x8620('0x59'));var _0x2ef201=ejs[_0x8620('0x5a')](_0x314ce3,{'networks':_0x2e88e1||[]});fs[_0x8620('0x5b')](_0x8620('0x5c'),_0x2ef201);return respondWithRpcPromise(_0x8620('0x5d'),_0x8620('0x52'),{'module':_0x8620('0x5e')});}else if(_0x1c00da['type']['toUpperCase']()==_0x8620('0x5f')){var _0x11648a=fs[_0x8620('0x56')](path[_0x8620('0x60')](config['root'],_0x8620('0x61')),'utf8');var _0x1da705=ejs[_0x8620('0x5a')](_0x11648a,{'networks':_0x2e88e1||[]});fs[_0x8620('0x5b')](_0x8620('0x62'),_0x1da705);return respondWithRpcPromise(_0x8620('0x5d'),_0x8620('0x52'),{'module':_0x8620('0x5e')});}else{var _0xb507cd=fs[_0x8620('0x56')](path[_0x8620('0x60')](config[_0x8620('0x57')],_0x8620('0x63')),_0x8620('0x59'));var _0x7f8dfd=ejs[_0x8620('0x5a')](_0xb507cd,{'networks':_0x2e88e1||[]});fs[_0x8620('0x5b')](util[_0x8620('0x64')]('/etc/asterisk/sip_xcally_%s.conf',_0x4ae682[_0x8620('0x53')][_0x8620('0x39')]['toLowerCase']()),_0x7f8dfd);return respondWithRpcPromise(_0x8620('0x5d'),_0x8620('0x52'),{'module':_0x8620('0x65')});}return null;})[_0x8620('0x1c')](function(){return _0x1c00da;});})[_0x8620('0x1c')](respondWithResult(_0x194c9c,0xc9))[_0x8620('0x26')](handleError(_0x194c9c,null));};exports[_0x8620('0x30')]=function(_0x5007b3,_0x516476,_0x580560){var _0x26aa8b;return db['sequelize'][_0x8620('0x51')](function(_0x2846d9){return db['Network'][_0x8620('0x4f')]({'where':{'id':_0x5007b3[_0x8620('0x4c')]['id']}})[_0x8620('0x1c')](handleEntityNotFound(_0x516476,null))['then'](saveUpdates(_0x5007b3[_0x8620('0x53')],null))['then'](function(_0x53cf47){if(_0x53cf47){_0x26aa8b=_0x53cf47;return db[_0x8620('0x36')]['findAll']({'where':{'type':_0x26aa8b[_0x8620('0x39')]},'raw':!![]});}return null;})[_0x8620('0x1c')](function(_0x2b4c72){if(_0x26aa8b[_0x8620('0x39')][_0x8620('0x54')]()==_0x8620('0x55')){var _0x535717=fs[_0x8620('0x56')](path[_0x8620('0x60')](config[_0x8620('0x57')],_0x8620('0x58')),_0x8620('0x59'));var _0x312df6=ejs[_0x8620('0x5a')](_0x535717,{'networks':_0x2b4c72||[]});fs[_0x8620('0x5b')]('/etc/asterisk/stun_xcally.conf',_0x312df6);return respondWithRpcPromise(_0x8620('0x5d'),_0x8620('0x30'),{'module':_0x8620('0x5e')});}else if(_0x26aa8b[_0x8620('0x39')][_0x8620('0x54')]()==_0x8620('0x5f')){var _0x28e533=fs[_0x8620('0x56')](path[_0x8620('0x60')](config['root'],_0x8620('0x61')),_0x8620('0x59'));var _0x1c06ce=ejs[_0x8620('0x5a')](_0x28e533,{'networks':_0x2b4c72||[]});fs[_0x8620('0x5b')](_0x8620('0x62'),_0x1c06ce);return respondWithRpcPromise(_0x8620('0x5d'),'update',{'module':_0x8620('0x5e')});}else{var _0x4bb535=fs[_0x8620('0x56')](path['join'](config[_0x8620('0x57')],_0x8620('0x63')),_0x8620('0x59'));var _0x5e0e37=ejs[_0x8620('0x5a')](_0x4bb535,{'networks':_0x2b4c72||[]});fs[_0x8620('0x5b')](util[_0x8620('0x64')](_0x8620('0x66'),_0x5007b3['body'][_0x8620('0x39')][_0x8620('0x67')]()),_0x5e0e37);return respondWithRpcPromise(_0x8620('0x5d'),_0x8620('0x30'),{'module':'chan_sip.so'});}return null;})[_0x8620('0x1c')](function(_0xc9c5a){if(_0xc9c5a){return _0x26aa8b;}return null;});})['then'](respondWithResult(_0x516476,null))[_0x8620('0x26')](handleError(_0x516476,null));};exports[_0x8620('0x68')]=function(_0x5b398d,_0x4e803b,_0x1d3d74){var _0x1f03f1;return db['Network'][_0x8620('0x4f')]({'where':{'id':_0x5b398d[_0x8620('0x4c')]['id']}})[_0x8620('0x1c')](function(_0x50081a){_0x1f03f1=_0x50081a;return _0x50081a;})['then'](handleEntityNotFound(_0x4e803b,null))[_0x8620('0x1c')](removeEntity(_0x4e803b,null))[_0x8620('0x1c')](function(){if(_0x1f03f1){return db[_0x8620('0x36')][_0x8620('0x69')]({'where':{'type':_0x1f03f1[_0x8620('0x39')]},'raw':!![]});}})[_0x8620('0x1c')](function(_0x4138bd){if(_0x1f03f1['type'][_0x8620('0x54')]()==_0x8620('0x55')){var _0x5f0644=fs[_0x8620('0x56')](path[_0x8620('0x60')](config[_0x8620('0x57')],_0x8620('0x58')),_0x8620('0x59'));var _0x24d037=ejs[_0x8620('0x5a')](_0x5f0644,{'networks':_0x4138bd||[]});fs[_0x8620('0x5b')](_0x8620('0x5c'),_0x24d037);return respondWithRpcPromise(_0x8620('0x5d'),_0x8620('0x68'),{'module':'res_stun_monitor.so'});}else if(_0x1f03f1[_0x8620('0x39')][_0x8620('0x54')]()==_0x8620('0x5f')){var _0x21bc2b=fs[_0x8620('0x56')](path[_0x8620('0x60')](config[_0x8620('0x57')],_0x8620('0x61')),_0x8620('0x59'));var _0x2dc67a=ejs['render'](_0x21bc2b,{'networks':_0x4138bd||[]});fs['writeFileSync'](_0x8620('0x62'),_0x2dc67a);return respondWithRpcPromise(_0x8620('0x5d'),_0x8620('0x68'),{'module':_0x8620('0x5e')});}else{var _0x13c095=fs[_0x8620('0x56')](path[_0x8620('0x60')](config[_0x8620('0x57')],_0x8620('0x63')),_0x8620('0x59'));var _0x1e5a97=ejs[_0x8620('0x5a')](_0x13c095,{'networks':_0x4138bd||[]});fs[_0x8620('0x5b')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x5b398d['body'][_0x8620('0x39')][_0x8620('0x67')]()),_0x1e5a97);return respondWithRpcPromise(_0x8620('0x5d'),_0x8620('0x68'),{'module':_0x8620('0x65')});}return null;})[_0x8620('0x26')](handleError(_0x4e803b,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 8996033..bb61154 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 _0xa0bc=['request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','util','../../config/logger','moment','bluebird'];(function(_0x4606c3,_0xf18809){var _0x20f7aa=function(_0x82f34a){while(--_0x82f34a){_0x4606c3['push'](_0x4606c3['shift']());}};_0x20f7aa(++_0xf18809);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xca0b('0x0'));var logger=require(_0xca0b('0x1'))('api');var moment=require(_0xca0b('0x2'));var BPromise=require(_0xca0b('0x3'));var rp=require(_0xca0b('0x4'));var fs=require('fs');var path=require(_0xca0b('0x5'));var rimraf=require(_0xca0b('0x6'));var config=require(_0xca0b('0x7'));var attributes=require(_0xca0b('0x8'));module[_0xca0b('0x9')]=function(_0x3cb084,_0x1aac00){return _0x3cb084[_0xca0b('0xa')](_0xca0b('0xb'),attributes,{'tableName':_0xca0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x049e=['Network','network','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x4871ae,_0x37f505){var _0xdda31f=function(_0x84a296){while(--_0x84a296){_0x4871ae['push'](_0x4871ae['shift']());}};_0xdda31f(++_0x37f505);}(_0x049e,0x16a));var _0xe049=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x049e[_0x2eb5bc];return _0x51c7b1;};'use strict';var _=require(_0xe049('0x0'));var util=require(_0xe049('0x1'));var logger=require('../../config/logger')(_0xe049('0x2'));var moment=require('moment');var BPromise=require(_0xe049('0x3'));var rp=require(_0xe049('0x4'));var fs=require('fs');var path=require(_0xe049('0x5'));var rimraf=require(_0xe049('0x6'));var config=require(_0xe049('0x7'));var attributes=require('./network.attributes');module[_0xe049('0x8')]=function(_0x196af2,_0x22e8f5){return _0x196af2[_0xe049('0x9')](_0xe049('0xa'),attributes,{'tableName':_0xe049('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 058064e..5f7fe24 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(_0x27abcc,_0x39df84){var _0x35f117=function(_0x383fbb){while(--_0x383fbb){_0x27abcc['push'](_0x27abcc['shift']());}};_0x35f117(++_0x39df84);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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(_0x24462a,_0x59592d){var _0x513bc8=function(_0x25ee5a){while(--_0x25ee5a){_0x24462a['push'](_0x24462a['shift']());}};_0x513bc8(++_0x59592d);}(_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 2303632..60f625d 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 _0x7fba=['destroy','removeDispositions','removeAnswers','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','/:id/notify','notify','addAgents','send','put','/:id','update','delete'];(function(_0x124db3,_0x2e82fe){var _0x2eb716=function(_0x827864){while(--_0x827864){_0x124db3['push'](_0x124db3['shift']());}};_0x2eb716(++_0x2e82fe);}(_0x7fba,0xc2));var _0xa7fb=function(_0x4c912e,_0x27299d){_0x4c912e=_0x4c912e-0x0;var _0x2fa424=_0x7fba[_0x4c912e];return _0x2fa424;};'use strict';var multer=require(_0xa7fb('0x0'));var util=require(_0xa7fb('0x1'));var path=require(_0xa7fb('0x2'));var timeout=require('connect-timeout');var express=require(_0xa7fb('0x3'));var router=express[_0xa7fb('0x4')]();var fs_extra=require(_0xa7fb('0x5'));var auth=require(_0xa7fb('0x6'));var interaction=require(_0xa7fb('0x7'));var config=require(_0xa7fb('0x8'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0xa7fb('0x9')](),controller[_0xa7fb('0xa')]);router['get'](_0xa7fb('0xb'),auth[_0xa7fb('0x9')](),controller[_0xa7fb('0xc')]);router[_0xa7fb('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xa7fb('0xe')]);router[_0xa7fb('0xd')](_0xa7fb('0xf'),auth[_0xa7fb('0x9')](),controller[_0xa7fb('0x10')]);router[_0xa7fb('0xd')](_0xa7fb('0x11'),auth[_0xa7fb('0x9')](),controller[_0xa7fb('0x12')]);router[_0xa7fb('0xd')](_0xa7fb('0x13'),auth[_0xa7fb('0x9')](),controller[_0xa7fb('0x14')]);router[_0xa7fb('0xd')](_0xa7fb('0x15'),auth['isAuthenticated'](),controller[_0xa7fb('0x16')]);router[_0xa7fb('0xd')](_0xa7fb('0x17'),auth[_0xa7fb('0x9')](),controller[_0xa7fb('0x18')]);router[_0xa7fb('0x19')]('/',auth[_0xa7fb('0x9')](),controller['create']);router['post'](_0xa7fb('0xf'),auth[_0xa7fb('0x9')](),controller['addDisposition']);router[_0xa7fb('0x19')](_0xa7fb('0x11'),auth[_0xa7fb('0x9')](),controller['addAnswer']);router[_0xa7fb('0x19')](_0xa7fb('0x1a'),controller[_0xa7fb('0x1b')]);router[_0xa7fb('0x19')]('/:id/applications',auth[_0xa7fb('0x9')](),controller['addApplications']);router['post'](_0xa7fb('0x17'),auth[_0xa7fb('0x9')](),controller[_0xa7fb('0x1c')]);router[_0xa7fb('0x19')]('/:id/send',auth['isAuthenticated'](),controller[_0xa7fb('0x1d')]);router[_0xa7fb('0x1e')](_0xa7fb('0x1f'),auth[_0xa7fb('0x9')](),controller[_0xa7fb('0x20')]);router[_0xa7fb('0x21')]('/:id',auth['isAuthenticated'](),controller[_0xa7fb('0x22')]);router['delete'](_0xa7fb('0xf'),auth[_0xa7fb('0x9')](),controller[_0xa7fb('0x23')]);router['delete'](_0xa7fb('0x11'),auth['isAuthenticated'](),controller[_0xa7fb('0x24')]);router['delete']('/:id/users',auth[_0xa7fb('0x9')](),controller['removeAgents']);module[_0xa7fb('0x25')]=router; \ No newline at end of file +var _0xdd3c=['/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getAgents','post','create','/:id/dispositions','addDisposition','/:id/notify','/:id/applications','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','getDispositions'];(function(_0x58bec1,_0x42c53f){var _0x16439f=function(_0x19b7ec){while(--_0x19b7ec){_0x58bec1['push'](_0x58bec1['shift']());}};_0x16439f(++_0x42c53f);}(_0xdd3c,0x1de));var _0xcdd3=function(_0xc5cabc,_0x446fe3){_0xc5cabc=_0xc5cabc-0x0;var _0x3cd09c=_0xdd3c[_0xc5cabc];return _0x3cd09c;};'use strict';var multer=require(_0xcdd3('0x0'));var util=require(_0xcdd3('0x1'));var path=require('path');var timeout=require(_0xcdd3('0x2'));var express=require(_0xcdd3('0x3'));var router=express[_0xcdd3('0x4')]();var fs_extra=require(_0xcdd3('0x5'));var auth=require(_0xcdd3('0x6'));var interaction=require(_0xcdd3('0x7'));var config=require('../../config/environment');var controller=require(_0xcdd3('0x8'));router[_0xcdd3('0x9')]('/',auth[_0xcdd3('0xa')](),controller[_0xcdd3('0xb')]);router[_0xcdd3('0x9')](_0xcdd3('0xc'),auth[_0xcdd3('0xa')](),controller[_0xcdd3('0xd')]);router[_0xcdd3('0x9')](_0xcdd3('0xe'),auth[_0xcdd3('0xa')](),controller['show']);router[_0xcdd3('0x9')]('/:id/dispositions',auth[_0xcdd3('0xa')](),controller[_0xcdd3('0xf')]);router[_0xcdd3('0x9')](_0xcdd3('0x10'),auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x11')]);router[_0xcdd3('0x9')]('/:id/applications',auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x12')]);router[_0xcdd3('0x9')](_0xcdd3('0x13'),auth[_0xcdd3('0xa')](),controller['getInteractions']);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xcdd3('0x14')]);router[_0xcdd3('0x15')]('/',auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x16')]);router[_0xcdd3('0x15')](_0xcdd3('0x17'),auth['isAuthenticated'](),controller[_0xcdd3('0x18')]);router[_0xcdd3('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0xcdd3('0x15')](_0xcdd3('0x19'),controller['notify']);router[_0xcdd3('0x15')](_0xcdd3('0x1a'),auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x1b')]);router['post']('/:id/users',auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x1c')]);router['post'](_0xcdd3('0x1d'),auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x1e')]);router[_0xcdd3('0x1f')](_0xcdd3('0xe'),auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x20')]);router[_0xcdd3('0x21')](_0xcdd3('0xe'),auth['isAuthenticated'](),controller[_0xcdd3('0x22')]);router[_0xcdd3('0x21')]('/:id/dispositions',auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x23')]);router[_0xcdd3('0x21')](_0xcdd3('0x10'),auth[_0xcdd3('0xa')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x24')]);module[_0xcdd3('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 9fe5544..e2a6d17 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 _0x5340=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x3e6c0c,_0x297673){var _0x13bbcd=function(_0x59ec0e){while(--_0x59ec0e){_0x3e6c0c['push'](_0x3e6c0c['shift']());}};_0x13bbcd(++_0x297673);}(_0x5340,0xd4));var _0x0534=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5340[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x0534('0x0'));module[_0x0534('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0534('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x0534('0x3')],'defaultValue':function(){return rs[_0x0534('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x0534('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0534('0x5')],'defaultValue':function(){return _0x0534('0x6');}},'notificationSound':{'type':Sequelize[_0x0534('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0534('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0534('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x0534('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0534('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0534('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0534('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0534('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x0534('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x0534('0x7')],'defaultValue':![],'comment':_0x0534('0xa'),'set':function(_0x241dab){if(!_0x241dab)this[_0x0534('0xb')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x0534('0xc'),_0x241dab);}}}; \ No newline at end of file +var _0x0c9f=['generate','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','sequelize','name','STRING'];(function(_0x3994eb,_0x1fb318){var _0x534f74=function(_0x55ba6c){while(--_0x55ba6c){_0x3994eb['push'](_0x3994eb['shift']());}};_0x534f74(++_0x1fb318);}(_0x0c9f,0x75));var _0xf0c9=function(_0x28c411,_0x14716b){_0x28c411=_0x28c411-0x0;var _0x4cf8be=_0x0c9f[_0x28c411];return _0x4cf8be;};'use strict';var Sequelize=require(_0xf0c9('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xf0c9('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xf0c9('0x2')]},'token':{'type':Sequelize[_0xf0c9('0x2')],'defaultValue':function(){return rs[_0xf0c9('0x3')]();}},'replyUri':{'type':Sequelize[_0xf0c9('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xf0c9('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf0c9('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf0c9('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf0c9('0x2')]},'queueTransfer':{'type':Sequelize[_0xf0c9('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf0c9('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf0c9('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf0c9('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xf0c9('0x6')},'mandatoryDisposition':{'type':Sequelize[_0xf0c9('0x4')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2996e9){if(!_0x2996e9)this[_0xf0c9('0x7')]('mandatoryDispositionPauseId',null);this[_0xf0c9('0x7')]('mandatoryDisposition',_0x2996e9);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index ee24db0..9be27dc 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 _0x3dd5=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','OpenchannelAccountId','Disposition','create','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','Applications','account','list','applications','priority','asc','contact','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','lastName','messageId','interaction','created','autoclose','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','Start','startRouting','EventManager','sequelize','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','fullname','Tag','tag','addAgents','omit','userOpenchannelAccount:save','isArray','emit','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','get','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3dd5,0x129));var _0x53dd=function(_0x230c3e,_0x44938e){_0x230c3e=_0x230c3e-0x0;var _0x354241=_0x3dd5[_0x230c3e];return _0x354241;};'use strict';var emlformat=require(_0x53dd('0x0'));var rimraf=require(_0x53dd('0x1'));var zipdir=require(_0x53dd('0x2'));var jsonpatch=require(_0x53dd('0x3'));var rp=require(_0x53dd('0x4'));var moment=require('moment');var BPromise=require(_0x53dd('0x5'));var Mustache=require(_0x53dd('0x6'));var util=require('util');var path=require(_0x53dd('0x7'));var sox=require(_0x53dd('0x8'));var csv=require(_0x53dd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53dd('0xa'));var _=require(_0x53dd('0xb'));var squel=require('squel');var crypto=require(_0x53dd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x53dd('0xd'));var toCsv=require(_0x53dd('0x9'));var querystring=require(_0x53dd('0xe'));var Papa=require(_0x53dd('0xf'));var Redis=require(_0x53dd('0x10'));var authService=require(_0x53dd('0x11'));var qs=require(_0x53dd('0x12'));var as=require(_0x53dd('0x13'));var hardwareService=require(_0x53dd('0x14'));var logger=require(_0x53dd('0x15'))(_0x53dd('0x16'));var utils=require(_0x53dd('0x17'));var config=require(_0x53dd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x53dd('0x19'))['db'];config['redis']=_[_0x53dd('0x1a')](config[_0x53dd('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x53dd('0x1c'))(new Redis(config['redis']));require(_0x53dd('0x1d'))['register'](socket);var jayson=require(_0x53dd('0x1e'));var client=jayson[_0x53dd('0x1f')][_0x53dd('0x20')]({'port':0x232c});var client9002=jayson[_0x53dd('0x1f')][_0x53dd('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2d24b0,_0x516c2c,_0x3a7423,_0x54eb00){return new BPromise(function(_0x32031c,_0x422516){var _0x2c3e9f=_0x54eb00||client;return _0x2c3e9f[_0x53dd('0x21')](_0x2d24b0,_0x3a7423)['then'](function(_0x5c4743){logger[_0x53dd('0x22')](_0x53dd('0x23'),_0x516c2c,'request\x20sent');logger[_0x53dd('0x24')](_0x53dd('0x25'),_0x516c2c,_0x53dd('0x26'),JSON[_0x53dd('0x27')](_0x5c4743));if(_0x5c4743[_0x53dd('0x28')]){if(_0x5c4743[_0x53dd('0x28')][_0x53dd('0x29')]===0x1f4){logger[_0x53dd('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x516c2c,_0x5c4743[_0x53dd('0x28')][_0x53dd('0x2a')]);return _0x422516(_0x5c4743['error']['message']);}logger[_0x53dd('0x28')](_0x53dd('0x23'),_0x516c2c,_0x5c4743[_0x53dd('0x28')]['message']);return _0x32031c(_0x5c4743[_0x53dd('0x28')][_0x53dd('0x2a')]);}else{logger[_0x53dd('0x22')](_0x53dd('0x23'),_0x516c2c,'request\x20sent');_0x32031c(_0x5c4743['result'][_0x53dd('0x2a')]);}})[_0x53dd('0x2b')](function(_0x330de4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x516c2c,_0x330de4);_0x422516(_0x330de4);});});}function respondWithStatusCode(_0x32d1a6,_0x1310e8){_0x1310e8=_0x1310e8||0xcc;return function(_0x25aa23){if(_0x25aa23){return _0x32d1a6[_0x53dd('0x2c')](_0x1310e8);}return _0x32d1a6[_0x53dd('0x2d')](_0x1310e8)[_0x53dd('0x2e')]();};}function respondWithResult(_0x17fd7c,_0x42d527){_0x42d527=_0x42d527||0xc8;return function(_0x4e9ce4){if(_0x4e9ce4){return _0x17fd7c[_0x53dd('0x2d')](_0x42d527)['json'](_0x4e9ce4);}};}function respondWithFilteredResult(_0x5cfec6,_0x291c89){return function(_0x523fbc){if(_0x523fbc){var _0x5a6683=typeof _0x291c89[_0x53dd('0x2f')]===_0x53dd('0x30')&&typeof _0x291c89[_0x53dd('0x31')]==='undefined';var _0x2cb26a=_0x523fbc[_0x53dd('0x32')];var _0x12a541=_0x5a6683?0x0:_0x291c89[_0x53dd('0x2f')];var _0x16a620=_0x5a6683?_0x523fbc['count']:_0x291c89[_0x53dd('0x2f')]+_0x291c89[_0x53dd('0x31')];var _0xf288e3;if(_0x16a620>=_0x2cb26a){_0x16a620=_0x2cb26a;_0xf288e3=0xc8;}else{_0xf288e3=0xce;}_0x5cfec6[_0x53dd('0x2d')](_0xf288e3);return _0x5cfec6[_0x53dd('0x33')](_0x53dd('0x34'),_0x12a541+'-'+_0x16a620+'/'+_0x2cb26a)[_0x53dd('0x35')](_0x523fbc);}return null;};}function patchUpdates(_0x278ce5){return function(_0xd64ca3){try{jsonpatch[_0x53dd('0x36')](_0xd64ca3,_0x278ce5,!![]);}catch(_0x2a26ac){return BPromise['reject'](_0x2a26ac);}return _0xd64ca3[_0x53dd('0x37')]();};}function saveUpdates(_0x1c4de4,_0x29eeab){return function(_0x512213){if(_0x512213){return _0x512213[_0x53dd('0x38')](_0x1c4de4)['then'](function(_0x385cfb){return _0x385cfb;});}return null;};}function removeEntity(_0x53a0b9,_0x526d11){return function(_0xfdec9a){if(_0xfdec9a){return _0xfdec9a[_0x53dd('0x39')]()[_0x53dd('0x3a')](function(){var _0x2a4115=_0xfdec9a[_0x53dd('0x3b')]({'plain':!![]});var _0x3eb1fb='OpenchannelAccounts';return db[_0x53dd('0x3c')]['destroy']({'where':{'type':_0x3eb1fb,'resourceId':_0x2a4115['id']}})[_0x53dd('0x3a')](function(){return _0xfdec9a;});})[_0x53dd('0x3a')](function(){_0x53a0b9['status'](0xcc)[_0x53dd('0x2e')]();});}};}function handleEntityNotFound(_0x4a9041,_0x5ae4e5){return function(_0x37748b){if(!_0x37748b){_0x4a9041[_0x53dd('0x2c')](0x194);}return _0x37748b;};}function handleError(_0x22bfff,_0x466ed8){_0x466ed8=_0x466ed8||0x1f4;return function(_0x5b106a){logger['error'](_0x5b106a[_0x53dd('0x3d')]);if(_0x5b106a[_0x53dd('0x3e')]){delete _0x5b106a[_0x53dd('0x3e')];}_0x22bfff[_0x53dd('0x2d')](_0x466ed8)[_0x53dd('0x3f')](_0x5b106a);};}exports[_0x53dd('0x40')]=function(_0x13ab94,_0x2e2fe2){var _0x47e8f9={'include':[{'model':db['Pause'],'as':_0x53dd('0x41')}]},_0x27c6f7={},_0x286567={'count':0x0,'rows':[]};var _0x36099d=_[_0x53dd('0x42')](db[_0x53dd('0x43')][_0x53dd('0x44')],function(_0x455a83){return{'name':_0x455a83[_0x53dd('0x45')],'type':_0x455a83[_0x53dd('0x46')][_0x53dd('0x47')]};});_0x27c6f7[_0x53dd('0x48')]=_[_0x53dd('0x42')](_0x36099d,'name');_0x27c6f7['query']=_[_0x53dd('0x49')](_0x13ab94[_0x53dd('0x4a')]);_0x27c6f7[_0x53dd('0x4b')]=_['intersection'](_0x27c6f7['model'],_0x27c6f7[_0x53dd('0x4a')]);_0x47e8f9[_0x53dd('0x4c')]=_[_0x53dd('0x4d')](_0x27c6f7['model'],qs['fields'](_0x13ab94[_0x53dd('0x4a')][_0x53dd('0x4e')]));_0x47e8f9[_0x53dd('0x4c')]=_0x47e8f9[_0x53dd('0x4c')][_0x53dd('0x4f')]?_0x47e8f9[_0x53dd('0x4c')]:_0x27c6f7[_0x53dd('0x48')];if(!_0x13ab94[_0x53dd('0x4a')][_0x53dd('0x50')](_0x53dd('0x51'))){_0x47e8f9['limit']=qs[_0x53dd('0x31')](_0x13ab94[_0x53dd('0x4a')][_0x53dd('0x31')]);_0x47e8f9[_0x53dd('0x2f')]=qs[_0x53dd('0x2f')](_0x13ab94['query'][_0x53dd('0x2f')]);}_0x47e8f9[_0x53dd('0x52')]=qs[_0x53dd('0x53')](_0x13ab94[_0x53dd('0x4a')][_0x53dd('0x53')]);_0x47e8f9[_0x53dd('0x54')]=qs['filters'](_[_0x53dd('0x55')](_0x13ab94['query'],_0x27c6f7['filters']),_0x36099d);if(_0x13ab94[_0x53dd('0x4a')]['filter']){_0x47e8f9[_0x53dd('0x54')]=_[_0x53dd('0x56')](_0x47e8f9[_0x53dd('0x54')],{'$or':_[_0x53dd('0x42')](_0x36099d,function(_0x196da0){if(_0x196da0['type']!==_0x53dd('0x57')){var _0x5b8232={};_0x5b8232[_0x196da0[_0x53dd('0x3e')]]={'$like':'%'+_0x13ab94['query'][_0x53dd('0x58')]+'%'};return _0x5b8232;}})});}_0x47e8f9=_['merge']({},_0x47e8f9,_0x13ab94[_0x53dd('0x59')]);var _0x3d36e3={'where':_0x47e8f9[_0x53dd('0x54')]};return db[_0x53dd('0x43')][_0x53dd('0x32')](_0x3d36e3)[_0x53dd('0x3a')](function(_0x1c33b9){_0x286567['count']=_0x1c33b9;if(_0x13ab94[_0x53dd('0x4a')][_0x53dd('0x5a')]){_0x47e8f9[_0x53dd('0x5b')]=[{'all':!![]}];}return db[_0x53dd('0x43')][_0x53dd('0x5c')](_0x47e8f9);})[_0x53dd('0x3a')](function(_0x487a2d){_0x286567[_0x53dd('0x5d')]=_0x487a2d;return _0x286567;})[_0x53dd('0x3a')](respondWithFilteredResult(_0x2e2fe2,_0x47e8f9))[_0x53dd('0x2b')](handleError(_0x2e2fe2,null));};exports[_0x53dd('0x5e')]=function(_0x157421,_0x10bb4c){var _0x672933={'raw':![],'where':{'id':_0x157421[_0x53dd('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0x53dd('0x41')}]},_0x3e84ca={};_0x3e84ca['model']=_[_0x53dd('0x49')](db['OpenchannelAccount'][_0x53dd('0x44')]);_0x3e84ca[_0x53dd('0x4a')]=_[_0x53dd('0x49')](_0x157421[_0x53dd('0x4a')]);_0x3e84ca[_0x53dd('0x4b')]=_[_0x53dd('0x4d')](_0x3e84ca[_0x53dd('0x48')],_0x3e84ca[_0x53dd('0x4a')]);_0x672933[_0x53dd('0x4c')]=_[_0x53dd('0x4d')](_0x3e84ca[_0x53dd('0x48')],qs['fields'](_0x157421[_0x53dd('0x4a')][_0x53dd('0x4e')]));_0x672933['attributes']=_0x672933[_0x53dd('0x4c')][_0x53dd('0x4f')]?_0x672933[_0x53dd('0x4c')]:_0x3e84ca[_0x53dd('0x48')];if(_0x157421['query'][_0x53dd('0x5a')]){_0x672933[_0x53dd('0x5b')]=[{'all':!![]}];}_0x672933=_[_0x53dd('0x56')]({},_0x672933,_0x157421['options']);return db[_0x53dd('0x43')][_0x53dd('0x60')](_0x672933)[_0x53dd('0x3a')](handleEntityNotFound(_0x10bb4c,null))[_0x53dd('0x3a')](respondWithResult(_0x10bb4c,null))[_0x53dd('0x2b')](handleError(_0x10bb4c,null));};exports['create']=function(_0x149624,_0x31812f){return db[_0x53dd('0x43')]['create'](_0x149624[_0x53dd('0x61')],{})['then'](function(_0x1204d5){var _0x4b532c=_0x149624['user'][_0x53dd('0x3b')]({'plain':!![]});if(!_0x4b532c)throw new Error(_0x53dd('0x62'));if(_0x4b532c[_0x53dd('0x63')]===_0x53dd('0x64')){var _0x2ca729=_0x1204d5[_0x53dd('0x3b')]({'plain':!![]});var _0x12fda0='OpenchannelAccounts';return db['UserProfileSection'][_0x53dd('0x60')]({'where':{'name':_0x12fda0,'userProfileId':_0x4b532c[_0x53dd('0x65')]},'raw':!![]})[_0x53dd('0x3a')](function(_0x5b1c66){if(_0x5b1c66&&_0x5b1c66['autoAssociation']===0x0){return db[_0x53dd('0x3c')]['create']({'name':_0x2ca729[_0x53dd('0x3e')],'resourceId':_0x2ca729['id'],'type':_0x5b1c66[_0x53dd('0x3e')],'sectionId':_0x5b1c66['id']},{})[_0x53dd('0x3a')](function(){return _0x1204d5;});}else{return _0x1204d5;}})[_0x53dd('0x2b')](function(_0x380ad9){logger[_0x53dd('0x28')](_0x53dd('0x66'),_0x380ad9);throw _0x380ad9;});}return _0x1204d5;})[_0x53dd('0x3a')](respondWithResult(_0x31812f,0xc9))[_0x53dd('0x2b')](handleError(_0x31812f,null));};exports['update']=function(_0x24fd90,_0x484924){if(_0x24fd90['body']['id']){delete _0x24fd90[_0x53dd('0x61')]['id'];}return db[_0x53dd('0x43')][_0x53dd('0x60')]({'where':{'id':_0x24fd90[_0x53dd('0x5f')]['id']},'include':[{'model':db[_0x53dd('0x67')],'as':_0x53dd('0x41')}]})[_0x53dd('0x3a')](handleEntityNotFound(_0x484924,null))[_0x53dd('0x3a')](saveUpdates(_0x24fd90['body'],null))[_0x53dd('0x3a')](respondWithResult(_0x484924,null))[_0x53dd('0x2b')](handleError(_0x484924,null));};exports['destroy']=function(_0x3ce404,_0x4d69ea){return db[_0x53dd('0x43')][_0x53dd('0x60')]({'where':{'id':_0x3ce404[_0x53dd('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4d69ea,null))[_0x53dd('0x3a')](removeEntity(_0x4d69ea,null))[_0x53dd('0x2b')](handleError(_0x4d69ea,null));};exports[_0x53dd('0x68')]=function(_0x124061,_0x3b06d7){return db[_0x53dd('0x43')][_0x53dd('0x68')]()['then'](respondWithResult(_0x3b06d7,null))['catch'](handleError(_0x3b06d7,null));};exports[_0x53dd('0x69')]=function(_0x36861e,_0x221159,_0x19f17b){if(_0x36861e[_0x53dd('0x61')]['id']){delete _0x36861e['body']['id'];}return db[_0x53dd('0x43')]['find']({'where':{'id':_0x36861e['params']['id']}})[_0x53dd('0x3a')](handleEntityNotFound(_0x221159,null))[_0x53dd('0x3a')](function(_0x320929){if(_0x320929){_0x36861e[_0x53dd('0x61')][_0x53dd('0x6a')]=_0x320929['id'];return db[_0x53dd('0x6b')][_0x53dd('0x6c')](_0x36861e[_0x53dd('0x61')]);}})[_0x53dd('0x3a')](respondWithResult(_0x221159,null))['catch'](handleError(_0x221159,null));};exports['getDispositions']=function(_0x185eac,_0x39afe7,_0x11ea42){var _0x52bed3={'raw':![],'where':{}};var _0x2171be={};var _0x5d6436={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x53dd('0x6d')]({'where':{'id':_0x185eac['params']['id']}})[_0x53dd('0x3a')](handleEntityNotFound(_0x39afe7,null))[_0x53dd('0x3a')](function(_0x5cdf0c){if(_0x5cdf0c){_0x2171be['model']=_['keys'](db[_0x53dd('0x6b')]['rawAttributes']);_0x2171be[_0x53dd('0x4a')]=_[_0x53dd('0x49')](_0x185eac['query']);_0x2171be[_0x53dd('0x4b')]=_[_0x53dd('0x4d')](_0x2171be[_0x53dd('0x48')],_0x2171be['query']);_0x52bed3['attributes']=_[_0x53dd('0x4d')](_0x2171be[_0x53dd('0x48')],qs[_0x53dd('0x4e')](_0x185eac[_0x53dd('0x4a')][_0x53dd('0x4e')]));_0x52bed3['attributes']=_0x52bed3[_0x53dd('0x4c')][_0x53dd('0x4f')]?_0x52bed3['attributes']:_0x2171be['model'];if(!_0x185eac[_0x53dd('0x4a')]['hasOwnProperty'](_0x53dd('0x51'))){_0x52bed3[_0x53dd('0x31')]=qs['limit'](_0x185eac[_0x53dd('0x4a')]['limit']);_0x52bed3[_0x53dd('0x2f')]=qs['offset'](_0x185eac[_0x53dd('0x4a')][_0x53dd('0x2f')]);}_0x52bed3[_0x53dd('0x52')]=qs[_0x53dd('0x53')](_0x185eac[_0x53dd('0x4a')][_0x53dd('0x53')]);_0x52bed3[_0x53dd('0x54')]=qs[_0x53dd('0x4b')](_[_0x53dd('0x55')](_0x185eac[_0x53dd('0x4a')],_0x2171be[_0x53dd('0x4b')]));_0x52bed3['where']['OpenchannelAccountId']=_0x5cdf0c['id'];if(_0x185eac[_0x53dd('0x4a')][_0x53dd('0x58')]){_0x52bed3[_0x53dd('0x54')]=_[_0x53dd('0x56')](_0x52bed3[_0x53dd('0x54')],{'$or':_[_0x53dd('0x42')](_0x52bed3[_0x53dd('0x4c')],function(_0x11ec22){var _0x258869={};_0x258869[_0x11ec22]={'$like':'%'+_0x185eac[_0x53dd('0x4a')][_0x53dd('0x58')]+'%'};return _0x258869;})});}_0x52bed3=_[_0x53dd('0x56')]({},_0x52bed3,_0x185eac[_0x53dd('0x59')]);return db[_0x53dd('0x6b')][_0x53dd('0x32')]({'where':_0x52bed3[_0x53dd('0x54')]})[_0x53dd('0x3a')](function(_0x3c3a72){_0x5d6436[_0x53dd('0x32')]=_0x3c3a72;if(_0x185eac['query'][_0x53dd('0x5a')]){_0x52bed3[_0x53dd('0x5b')]=[{'all':!![]}];}return db[_0x53dd('0x6b')][_0x53dd('0x5c')](_0x52bed3);})[_0x53dd('0x3a')](function(_0x376614){_0x5d6436[_0x53dd('0x5d')]=_0x376614;return _0x5d6436;});}})[_0x53dd('0x3a')](respondWithFilteredResult(_0x39afe7,_0x52bed3))['catch'](handleError(_0x39afe7,null));};exports[_0x53dd('0x6e')]=function(_0x10a32a,_0x70c99a,_0x3fb7a9){return db['OpenchannelAccount']['find']({'where':{'id':_0x10a32a[_0x53dd('0x5f')]['id']}})[_0x53dd('0x3a')](handleEntityNotFound(_0x70c99a,null))[_0x53dd('0x3a')](function(_0x2537f3){if(_0x2537f3){return _0x2537f3[_0x53dd('0x6e')](_0x10a32a['query'][_0x53dd('0x6f')]);}})['then'](respondWithStatusCode(_0x70c99a,null))[_0x53dd('0x2b')](handleError(_0x70c99a,null));};exports[_0x53dd('0x70')]=function(_0x3cec57,_0x2d0b92,_0x3670c3){if(_0x3cec57[_0x53dd('0x61')]['id']){delete _0x3cec57[_0x53dd('0x61')]['id'];}return db['OpenchannelAccount'][_0x53dd('0x60')]({'where':{'id':_0x3cec57[_0x53dd('0x5f')]['id']}})[_0x53dd('0x3a')](handleEntityNotFound(_0x2d0b92,null))['then'](function(_0x107557){if(_0x107557){_0x3cec57[_0x53dd('0x61')]['OpenchannelAccountId']=_0x107557['id'];return db['CannedAnswer'][_0x53dd('0x6c')](_0x3cec57[_0x53dd('0x61')]);}})[_0x53dd('0x3a')](respondWithResult(_0x2d0b92,null))[_0x53dd('0x2b')](handleError(_0x2d0b92,null));};exports['getAnswers']=function(_0x1c4218,_0x4941a0,_0x2fcdc2){var _0x23b01c={'raw':![],'where':{}};var _0x20b76a={};var _0x13ca88={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x53dd('0x6d')]({'where':{'id':_0x1c4218[_0x53dd('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4941a0,null))['then'](function(_0x593da1){if(_0x593da1){_0x20b76a[_0x53dd('0x48')]=_[_0x53dd('0x49')](db[_0x53dd('0x71')][_0x53dd('0x44')]);_0x20b76a[_0x53dd('0x4a')]=_[_0x53dd('0x49')](_0x1c4218[_0x53dd('0x4a')]);_0x20b76a[_0x53dd('0x4b')]=_[_0x53dd('0x4d')](_0x20b76a[_0x53dd('0x48')],_0x20b76a[_0x53dd('0x4a')]);_0x23b01c[_0x53dd('0x4c')]=_[_0x53dd('0x4d')](_0x20b76a['model'],qs['fields'](_0x1c4218['query'][_0x53dd('0x4e')]));_0x23b01c[_0x53dd('0x4c')]=_0x23b01c[_0x53dd('0x4c')][_0x53dd('0x4f')]?_0x23b01c[_0x53dd('0x4c')]:_0x20b76a[_0x53dd('0x48')];if(!_0x1c4218[_0x53dd('0x4a')][_0x53dd('0x50')](_0x53dd('0x51'))){_0x23b01c[_0x53dd('0x31')]=qs[_0x53dd('0x31')](_0x1c4218[_0x53dd('0x4a')][_0x53dd('0x31')]);_0x23b01c['offset']=qs[_0x53dd('0x2f')](_0x1c4218[_0x53dd('0x4a')]['offset']);}_0x23b01c['order']=qs[_0x53dd('0x53')](_0x1c4218[_0x53dd('0x4a')][_0x53dd('0x53')]);_0x23b01c[_0x53dd('0x54')]=qs['filters'](_['pick'](_0x1c4218[_0x53dd('0x4a')],_0x20b76a['filters']));_0x23b01c[_0x53dd('0x54')][_0x53dd('0x6a')]=_0x593da1['id'];if(_0x1c4218[_0x53dd('0x4a')][_0x53dd('0x58')]){_0x23b01c[_0x53dd('0x54')]=_['merge'](_0x23b01c[_0x53dd('0x54')],{'$or':_[_0x53dd('0x42')](_0x23b01c[_0x53dd('0x4c')],function(_0x2e8fd9){var _0x1a83bb={};_0x1a83bb[_0x2e8fd9]={'$like':'%'+_0x1c4218[_0x53dd('0x4a')][_0x53dd('0x58')]+'%'};return _0x1a83bb;})});}_0x23b01c=_[_0x53dd('0x56')]({},_0x23b01c,_0x1c4218[_0x53dd('0x59')]);return db[_0x53dd('0x71')]['count']({'where':_0x23b01c[_0x53dd('0x54')]})[_0x53dd('0x3a')](function(_0x253f90){_0x13ca88[_0x53dd('0x32')]=_0x253f90;if(_0x1c4218['query'][_0x53dd('0x5a')]){_0x23b01c[_0x53dd('0x5b')]=[{'all':!![]}];}return db[_0x53dd('0x71')][_0x53dd('0x5c')](_0x23b01c);})['then'](function(_0x4bb71e){_0x13ca88[_0x53dd('0x5d')]=_0x4bb71e;return _0x13ca88;});}})['then'](respondWithFilteredResult(_0x4941a0,_0x23b01c))[_0x53dd('0x2b')](handleError(_0x4941a0,null));};exports[_0x53dd('0x72')]=function(_0x334ebf,_0x3c373a,_0x54efe4){return db[_0x53dd('0x43')][_0x53dd('0x60')]({'where':{'id':_0x334ebf['params']['id']}})[_0x53dd('0x3a')](handleEntityNotFound(_0x3c373a,null))[_0x53dd('0x3a')](function(_0x4baf4b){if(_0x4baf4b){return _0x4baf4b['removeAnswers'](_0x334ebf[_0x53dd('0x4a')]['ids']);}})['then'](respondWithStatusCode(_0x3c373a,null))[_0x53dd('0x2b')](handleError(_0x3c373a,null));};exports[_0x53dd('0x73')]=function(_0x4a1f88,_0x216114,_0x34b392){var _0x38a690={'body':_0x4a1f88['body'],'channel':_0x53dd('0x74')};var _0x43e8e8=[];var _0x2a1d05=[];var _0x2e2a37={};var _0x36561d=![];return db[_0x53dd('0x75')][_0x53dd('0x68')]()['then'](function(_0x34ae41){if(!_0x34ae41){throw new db[(_0x53dd('0x76'))]['ValidationError'](_0x53dd('0x77'));}_0x43e8e8=_['difference'](_['keys'](_0x34ae41),[_0x53dd('0x78'),_0x53dd('0x79')]);_0x2a1d05=_[_0x53dd('0x7a')](_[_0x53dd('0x49')](_0x34ae41),['createdAt','updatedAt',_0x53dd('0x7b'),_0x53dd('0x7c')]);if(_0x4a1f88[_0x53dd('0x61')]['id']){delete _0x4a1f88[_0x53dd('0x61')]['id'];}if(_[_0x53dd('0x7d')](_0x4a1f88[_0x53dd('0x61')][_0x53dd('0x7e')])){throw new db[(_0x53dd('0x76'))][(_0x53dd('0x7f'))](_0x53dd('0x80'));}if(_['isNil'](_0x4a1f88[_0x53dd('0x61')][_0x53dd('0x61')])||_0x4a1f88[_0x53dd('0x61')][_0x53dd('0x61')]===''){throw new db['Sequelize'][(_0x53dd('0x7f'))](_0x53dd('0x81'));}if(_[_0x53dd('0x7d')](_0x4a1f88[_0x53dd('0x61')][_0x53dd('0x82')])){throw new db[(_0x53dd('0x76'))][(_0x53dd('0x7f'))](_0x53dd('0x83')+_0x2a1d05);}if(!_[_0x53dd('0x84')](_0x2a1d05,_0x4a1f88[_0x53dd('0x61')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x53dd('0x85')+_0x2a1d05);}_0x2e2a37[_0x4a1f88[_0x53dd('0x61')][_0x53dd('0x82')]]=_0x4a1f88[_0x53dd('0x61')][_0x53dd('0x7e')];})[_0x53dd('0x3a')](function(){return db[_0x53dd('0x43')][_0x53dd('0x60')]({'where':{'id':_0x4a1f88['params']['id']},'include':[{'model':db['CmList'],'as':_0x53dd('0x86'),'include':[{'model':db['CmContact'],'as':_0x53dd('0x87'),'where':_0x2e2a37,'limit':0x1,'order':[[_0x53dd('0x79'),_0x53dd('0x88')]]}]},{'model':db['OpenchannelApplication'],'as':_0x53dd('0x89')}]});})[_0x53dd('0x3a')](handleEntityNotFound(_0x216114,null))[_0x53dd('0x3a')](function(_0x4e90e4){if(_0x4e90e4&&_0x4e90e4['List']){_0x38a690[_0x53dd('0x8a')]=_0x4e90e4;_0x38a690['applications']=_0x4e90e4[_0x53dd('0x89')];_0x38a690[_0x53dd('0x8b')]=_0x4e90e4[_0x53dd('0x86')];_0x38a690[_0x53dd('0x8c')]=_['orderBy'](_0x38a690[_0x53dd('0x8c')],[_0x53dd('0x8d')],[_0x53dd('0x8e')]);if(_0x38a690[_0x53dd('0x8a')][_0x53dd('0x89')]){delete _0x38a690[_0x53dd('0x8a')][_0x53dd('0x89')];}if(_0x38a690['account'][_0x53dd('0x86')]&&_0x38a690['account'][_0x53dd('0x86')][_0x53dd('0x87')]['length']){return _0x38a690[_0x53dd('0x8a')][_0x53dd('0x86')]['Contacts'][0x0];}var _0x5d758f=_[_0x53dd('0x1a')](_0x4a1f88['body'],{'firstName':_0x4a1f88[_0x53dd('0x61')][_0x53dd('0x7e')],'ListId':_0x4e90e4[_0x53dd('0x7c')]});_0x5d758f[_0x4a1f88[_0x53dd('0x61')]['mapKey']]=_0x4a1f88[_0x53dd('0x61')][_0x53dd('0x7e')];return db[_0x53dd('0x75')][_0x53dd('0x6c')](_0x5d758f,{'fields':_0x43e8e8,'raw':!![]});}})['then'](handleEntityNotFound(_0x216114,null))[_0x53dd('0x3a')](function(_0x4f0e27){_0x38a690[_0x53dd('0x8f')]=_0x4f0e27;if(_0x4f0e27){var _0x502314={'ContactId':_0x4f0e27['id'],'OpenchannelAccountId':_0x4a1f88[_0x53dd('0x5f')]['id'],'from':(_0x4f0e27['firstName']||'')+'\x20'+(_0x4f0e27['lastName']||'')};var _0x4fa940={'OpenchannelAccountId':_0x4a1f88['params']['id'],'closed':![]};if(_0x4a1f88[_0x53dd('0x61')]['threadId']){_0x4fa940[_0x53dd('0x90')]=_0x4a1f88[_0x53dd('0x61')][_0x53dd('0x90')];return db[_0x53dd('0x91')][_0x53dd('0x60')]({'where':_0x4fa940})[_0x53dd('0x3a')](function(_0x1f6288){if(_0x1f6288){return[_0x1f6288,![]];}_0x502314[_0x53dd('0x90')]=_0x4a1f88['body'][_0x53dd('0x90')];_0x502314[_0x53dd('0x92')]=_0x4a1f88[_0x53dd('0x61')]['externalUrl'];return db[_0x53dd('0x91')][_0x53dd('0x6c')](_0x502314)['then'](function(_0x1517c1){return[_0x1517c1,!![]];});});}else{_0x4fa940['threadId']=null;}_0x4fa940[_0x53dd('0x93')]=_0x4f0e27['id'];return db['OpenchannelInteraction']['find']({'where':_0x4fa940})[_0x53dd('0x3a')](function(_0x35c270){if(_0x35c270){return[_0x35c270,![]];}return db[_0x53dd('0x91')]['create'](_0x502314)['then'](function(_0x3784c2){return[_0x3784c2,!![]];});});}})[_0x53dd('0x94')](function(_0x23bf12,_0x5debe4){if(_0x23bf12){_0x36561d=_0x5debe4;if(!_0x5debe4){var _0xf5832e={'from':(_0x38a690[_0x53dd('0x8f')][_0x53dd('0x95')]||'')+'\x20'+(_0x38a690[_0x53dd('0x8f')][_0x53dd('0x96')]||'')};if(_0x4a1f88[_0x53dd('0x61')][_0x53dd('0x90')]&&_0x4a1f88[_0x53dd('0x61')][_0x53dd('0x97')]&&_0x4a1f88[_0x53dd('0x61')][_0x53dd('0x90')]!=_0x4a1f88[_0x53dd('0x61')][_0x53dd('0x97')]){_0xf5832e['threadId']=_0x4a1f88[_0x53dd('0x61')][_0x53dd('0x97')];}return _0x23bf12['update'](_0xf5832e);}else{return _0x23bf12;}}})['then'](function(_0x55f353){_0x38a690[_0x53dd('0x98')]=_0x55f353[_0x53dd('0x3b')]({'plain':!![]});_0x38a690[_0x53dd('0x98')]['created']=_0x36561d;if(_0x38a690[_0x53dd('0x98')][_0x53dd('0x99')]){if(_0x38a690['account'][_0x53dd('0x9a')]){_0x38a690[_0x53dd('0x8c')][_0x53dd('0x9b')]({'id':0x0,'priority':_0x38a690['applications']['length']+0x1,'app':_0x53dd('0x9c'),'appdata':'unmanaged','interval':_0x53dd('0x9d')});}}return db[_0x53dd('0x9e')][_0x53dd('0x6c')]({'body':_0x4a1f88[_0x53dd('0x61')][_0x53dd('0x61')],'OpenchannelAccountId':_0x4a1f88[_0x53dd('0x5f')]['id'],'OpenchannelInteractionId':_0x55f353['id'],'direction':'in','ContactId':_0x38a690[_0x53dd('0x8f')]['id'],'AttachmentId':_0x4a1f88[_0x53dd('0x61')][_0x53dd('0x9f')]});})[_0x53dd('0x3a')](function(_0x2111dd){_0x38a690[_0x53dd('0x2a')]=_0x2111dd;if(_0x38a690[_0x53dd('0x98')][_0x53dd('0xa0')]){return db[_0x53dd('0xa1')][_0x53dd('0x60')]({'attributes':['id',_0x53dd('0x3e')],'where':{'id':_0x38a690[_0x53dd('0x98')]['UserId']}})[_0x53dd('0x3a')](function(_0x42bfff){if(_0x42bfff){_0x38a690[_0x53dd('0x8c')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x42bfff['name']+','+(_0x38a690[_0x53dd('0x8a')][_0x53dd('0xa2')]||0xa),'interval':_0x53dd('0x9d')});_0x38a690['forcedOwnership']=![];}return respondWithRpcPromise(_0x53dd('0xa3'),_0x53dd('0xa4'),_0x38a690);});}return respondWithRpcPromise(_0x53dd('0xa3'),'startRouting',_0x38a690);})[_0x53dd('0x3a')](function(_0x419794){respondWithRpcPromise(_0x53dd('0xa5'),_0x53dd('0xa5'),{'event':_0x53dd('0x73'),'message':_0x419794},client9002);return _0x419794;})[_0x53dd('0x3a')](respondWithResult(_0x216114,null))[_0x53dd('0x2b')](handleError(_0x216114,null));};exports['addApplications']=function(_0x26c5b1,_0x264c53,_0x241bf7){return db['OpenchannelAccount'][_0x53dd('0x6d')]({'where':{'id':_0x26c5b1[_0x53dd('0x5f')]['id']}})[_0x53dd('0x3a')](handleEntityNotFound(_0x264c53,null))[_0x53dd('0x3a')](function(_0x5574e3){if(_0x5574e3){return db[_0x53dd('0xa6')][_0x53dd('0xa7')](function(_0x38d5a2){return db['OpenchannelApplication'][_0x53dd('0x39')]({'where':{'OpenchannelAccountId':_0x26c5b1[_0x53dd('0x5f')]['id']},'transaction':_0x38d5a2})[_0x53dd('0x3a')](function(_0x3a447e){var _0x1c0b17=_['map'](_0x26c5b1[_0x53dd('0x61')],function(_0x553fde){_0x553fde[_0x53dd('0x6a')]=_0x26c5b1[_0x53dd('0x5f')]['id'];return _0x553fde;});return db[_0x53dd('0xa8')][_0x53dd('0xa9')](_0x1c0b17,{'transaction':_0x38d5a2});});})[_0x53dd('0x3a')](function(){return db[_0x53dd('0xa8')][_0x53dd('0xaa')]({'where':{'OpenchannelAccountId':_0x26c5b1[_0x53dd('0x5f')]['id']},'order':'priority'});});}})[_0x53dd('0x3a')](respondWithResult(_0x264c53,null))['catch'](handleError(_0x264c53,null));};exports[_0x53dd('0xab')]=function(_0x7cecaa,_0xcee383,_0x37c60e){var _0x426dc4={};var _0xf35984={};var _0x55c250;var _0x2dd6e4;return db[_0x53dd('0x43')][_0x53dd('0x6d')]({'where':{'id':_0x7cecaa[_0x53dd('0x5f')]['id']}})[_0x53dd('0x3a')](handleEntityNotFound(_0xcee383,null))[_0x53dd('0x3a')](function(_0x3cb388){if(_0x3cb388){_0x55c250=_0x3cb388;_0xf35984['model']=_[_0x53dd('0x49')](db[_0x53dd('0xa8')]['rawAttributes']);_0xf35984[_0x53dd('0x4a')]=_[_0x53dd('0x49')](_0x7cecaa[_0x53dd('0x4a')]);_0xf35984[_0x53dd('0x4b')]=_[_0x53dd('0x4d')](_0xf35984[_0x53dd('0x48')],_0xf35984['query']);_0x426dc4[_0x53dd('0x4c')]=_[_0x53dd('0x4d')](_0xf35984[_0x53dd('0x48')],qs[_0x53dd('0x4e')](_0x7cecaa[_0x53dd('0x4a')][_0x53dd('0x4e')]));_0x426dc4[_0x53dd('0x4c')]=_0x426dc4[_0x53dd('0x4c')][_0x53dd('0x4f')]?_0x426dc4[_0x53dd('0x4c')]:_0xf35984[_0x53dd('0x48')];_0x426dc4['order']=qs[_0x53dd('0x53')](_0x7cecaa[_0x53dd('0x4a')][_0x53dd('0x53')]);_0x426dc4['where']=qs[_0x53dd('0x4b')](_[_0x53dd('0x55')](_0x7cecaa[_0x53dd('0x4a')],_0xf35984[_0x53dd('0x4b')]));if(_0x7cecaa[_0x53dd('0x4a')][_0x53dd('0x58')]){_0x426dc4[_0x53dd('0x54')]=_[_0x53dd('0x56')](_0x426dc4[_0x53dd('0x54')],{'$or':_[_0x53dd('0x42')](_0x426dc4[_0x53dd('0x4c')],function(_0x278c3d){var _0x5cc569={};_0x5cc569[_0x278c3d]={'$like':'%'+_0x7cecaa[_0x53dd('0x4a')][_0x53dd('0x58')]+'%'};return _0x5cc569;})});}_0x426dc4=_[_0x53dd('0x56')]({},_0x426dc4,_0x7cecaa[_0x53dd('0x59')]);return _0x55c250[_0x53dd('0xab')](_0x426dc4);}})[_0x53dd('0x3a')](function(_0x2b95aa){if(_0x2b95aa){_0x2dd6e4=_0x2b95aa['length'];if(!_0x7cecaa[_0x53dd('0x4a')]['hasOwnProperty']('nolimit')){_0x426dc4['limit']=qs[_0x53dd('0x31')](_0x7cecaa[_0x53dd('0x4a')][_0x53dd('0x31')]);_0x426dc4['offset']=qs[_0x53dd('0x2f')](_0x7cecaa[_0x53dd('0x4a')][_0x53dd('0x2f')]);}return _0x55c250[_0x53dd('0xab')](_0x426dc4);}})[_0x53dd('0x3a')](function(_0x5bd3b8){if(_0x5bd3b8){return _0x5bd3b8?{'count':_0x2dd6e4,'rows':_0x5bd3b8}:null;}})[_0x53dd('0x3a')](respondWithResult(_0xcee383,null))[_0x53dd('0x2b')](handleError(_0xcee383,null));};exports[_0x53dd('0xac')]=function(_0x599c3a,_0x20c08a,_0x5c1ada){var _0x22fc3d={'raw':![],'where':{}};var _0x1f6b7f={};var _0x19bab8={'count':0x0,'rows':[]};return db[_0x53dd('0x43')][_0x53dd('0x6d')]({'where':{'id':_0x599c3a['params']['id']}})[_0x53dd('0x3a')](handleEntityNotFound(_0x20c08a,null))[_0x53dd('0x3a')](function(_0x42e420){if(_0x42e420){_0x1f6b7f['model']=_[_0x53dd('0x49')](db[_0x53dd('0x91')][_0x53dd('0x44')]);_0x1f6b7f[_0x53dd('0x4a')]=_[_0x53dd('0x49')](_0x599c3a['query']);_0x1f6b7f[_0x53dd('0x4b')]=_[_0x53dd('0x4d')](_0x1f6b7f[_0x53dd('0x48')],_0x1f6b7f['query']);_0x22fc3d[_0x53dd('0x4c')]=_[_0x53dd('0x4d')](_0x1f6b7f[_0x53dd('0x48')],qs[_0x53dd('0x4e')](_0x599c3a[_0x53dd('0x4a')][_0x53dd('0x4e')]));_0x22fc3d[_0x53dd('0x4c')]=_0x22fc3d[_0x53dd('0x4c')][_0x53dd('0x4f')]?_0x22fc3d[_0x53dd('0x4c')]:_0x1f6b7f['model'];if(!_0x599c3a['query'][_0x53dd('0x50')](_0x53dd('0x51'))){_0x22fc3d[_0x53dd('0x31')]=qs['limit'](_0x599c3a[_0x53dd('0x4a')][_0x53dd('0x31')]);_0x22fc3d[_0x53dd('0x2f')]=qs['offset'](_0x599c3a['query'][_0x53dd('0x2f')]);}_0x22fc3d[_0x53dd('0x52')]=qs['sort'](_0x599c3a[_0x53dd('0x4a')][_0x53dd('0x53')]);_0x22fc3d[_0x53dd('0x54')]=qs[_0x53dd('0x4b')](_[_0x53dd('0x55')](_0x599c3a[_0x53dd('0x4a')],_0x1f6b7f['filters']));_0x22fc3d[_0x53dd('0x54')]['OpenchannelAccountId']=_0x42e420['id'];if(_0x599c3a['query']['filter']){_0x22fc3d[_0x53dd('0x54')]=_['merge'](_0x22fc3d[_0x53dd('0x54')],{'$or':_[_0x53dd('0x42')](_0x22fc3d[_0x53dd('0x4c')],function(_0x25927a){var _0x4d70ec={};_0x4d70ec[_0x25927a]={'$like':'%'+_0x599c3a[_0x53dd('0x4a')][_0x53dd('0x58')]+'%'};return _0x4d70ec;})});}_0x22fc3d=_[_0x53dd('0x56')]({},_0x22fc3d,_0x599c3a[_0x53dd('0x59')]);return db[_0x53dd('0x91')][_0x53dd('0x32')]({'where':_0x22fc3d[_0x53dd('0x54')]})[_0x53dd('0x3a')](function(_0x6342ea){_0x19bab8[_0x53dd('0x32')]=_0x6342ea;if(_0x599c3a[_0x53dd('0x4a')][_0x53dd('0x5a')]){_0x22fc3d[_0x53dd('0x5b')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x53dd('0xa1')],'as':'Owner','attributes':[_0x53dd('0x3e'),_0x53dd('0xad'),'internal'],'required':![]},{'model':db[_0x53dd('0xae')],'as':'Tags','attributes':['id',_0x53dd('0x3e'),'color'],'where':_0x599c3a[_0x53dd('0x4a')][_0x53dd('0xaf')]?{'id':_0x599c3a['query'][_0x53dd('0xaf')]}:undefined,'required':_0x599c3a['query']['tag']?!![]:![]}];}return db[_0x53dd('0x91')][_0x53dd('0x5c')](_0x22fc3d);})[_0x53dd('0x3a')](function(_0x3b1c45){_0x19bab8[_0x53dd('0x5d')]=_0x3b1c45;return _0x19bab8;});}})[_0x53dd('0x3a')](respondWithFilteredResult(_0x20c08a,_0x22fc3d))[_0x53dd('0x2b')](handleError(_0x20c08a,null));};exports[_0x53dd('0xb0')]=function(_0x4fe0c5,_0x451098,_0x468ce5){return db[_0x53dd('0x43')][_0x53dd('0x60')]({'where':{'id':_0x4fe0c5[_0x53dd('0x5f')]['id']}})[_0x53dd('0x3a')](handleEntityNotFound(_0x451098,null))[_0x53dd('0x3a')](function(_0x2f1556){if(_0x2f1556){return _0x2f1556['addAgents'](_0x4fe0c5[_0x53dd('0x61')][_0x53dd('0x6f')],_[_0x53dd('0xb1')](_0x4fe0c5[_0x53dd('0x61')],[_0x53dd('0x6f'),'id'])||{})[_0x53dd('0x94')](function(_0xcf9ebb){for(var _0x3f064b=0x0;_0x3f064b<_0x4fe0c5[_0x53dd('0x61')][_0x53dd('0x6f')][_0x53dd('0x4f')];_0x3f064b+=0x1){socket['emit'](_0x53dd('0xb2'),{'UserId':Number(_0x4fe0c5[_0x53dd('0x61')][_0x53dd('0x6f')][_0x3f064b]),'OpenchannelAccountId':Number(_0x4fe0c5[_0x53dd('0x5f')]['id'])});}return _0xcf9ebb;});}})['then'](respondWithResult(_0x451098,null))['catch'](handleError(_0x451098,null));};exports['removeAgents']=function(_0x1324e9,_0x42e9f7,_0x1701fd){return db[_0x53dd('0x43')][_0x53dd('0x60')]({'where':{'id':_0x1324e9['params']['id']}})['then'](handleEntityNotFound(_0x42e9f7,null))['then'](function(_0x195129){if(_0x195129){return _0x195129['removeAgents'](_0x1324e9['query']['ids'])[_0x53dd('0x3a')](function(){if(_[_0x53dd('0xb3')](_0x1324e9[_0x53dd('0x4a')][_0x53dd('0x6f')])){for(var _0x12ae2d=0x0;_0x12ae2d<_0x1324e9[_0x53dd('0x4a')][_0x53dd('0x6f')]['length'];_0x12ae2d+=0x1){socket[_0x53dd('0xb4')](_0x53dd('0xb5'),{'UserId':Number(_0x1324e9[_0x53dd('0x4a')][_0x53dd('0x6f')][_0x12ae2d]),'OpenchannelAccountId':Number(_0x1324e9[_0x53dd('0x5f')]['id'])});}}else{socket[_0x53dd('0xb4')](_0x53dd('0xb5'),{'UserId':Number(_0x1324e9[_0x53dd('0x4a')][_0x53dd('0x6f')]),'OpenchannelAccountId':Number(_0x1324e9[_0x53dd('0x5f')]['id'])});}});}})[_0x53dd('0x3a')](respondWithStatusCode(_0x42e9f7,null))[_0x53dd('0x2b')](handleError(_0x42e9f7,null));};exports[_0x53dd('0xb6')]=function(_0x4adce6,_0x4f8d62,_0x55f637){var _0x41536d={};var _0x4461cc={};var _0x4faa65;var _0x35284c;return db[_0x53dd('0x43')]['findOne']({'where':{'id':_0x4adce6['params']['id']}})[_0x53dd('0x3a')](handleEntityNotFound(_0x4f8d62,null))['then'](function(_0x1962de){if(_0x1962de){_0x4faa65=_0x1962de;_0x4461cc[_0x53dd('0x48')]=_['keys'](db[_0x53dd('0xa1')][_0x53dd('0x44')]);_0x4461cc[_0x53dd('0x4a')]=_['keys'](_0x4adce6['query']);_0x4461cc[_0x53dd('0x4b')]=_['intersection'](_0x4461cc[_0x53dd('0x48')],_0x4461cc[_0x53dd('0x4a')]);_0x41536d['attributes']=_[_0x53dd('0x4d')](_0x4461cc[_0x53dd('0x48')],qs[_0x53dd('0x4e')](_0x4adce6[_0x53dd('0x4a')][_0x53dd('0x4e')]));_0x41536d[_0x53dd('0x4c')]=_0x41536d[_0x53dd('0x4c')]['length']?_0x41536d[_0x53dd('0x4c')]:_0x4461cc[_0x53dd('0x48')];_0x41536d[_0x53dd('0x52')]=qs[_0x53dd('0x53')](_0x4adce6[_0x53dd('0x4a')]['sort']);_0x41536d[_0x53dd('0x54')]=qs[_0x53dd('0x4b')](_[_0x53dd('0x55')](_0x4adce6[_0x53dd('0x4a')],_0x4461cc[_0x53dd('0x4b')]));if(_0x4adce6[_0x53dd('0x4a')][_0x53dd('0x58')]){_0x41536d[_0x53dd('0x54')]=_[_0x53dd('0x56')](_0x41536d[_0x53dd('0x54')],{'$or':_[_0x53dd('0x42')](_0x41536d[_0x53dd('0x4c')],function(_0x1d6678){var _0x29a721={};_0x29a721[_0x1d6678]={'$like':'%'+_0x4adce6[_0x53dd('0x4a')][_0x53dd('0x58')]+'%'};return _0x29a721;})});}_0x41536d=_[_0x53dd('0x56')]({},_0x41536d,_0x4adce6[_0x53dd('0x59')]);return _0x4faa65[_0x53dd('0xb6')](_0x41536d);}})[_0x53dd('0x3a')](function(_0x359560){if(_0x359560){_0x35284c=_0x359560['length'];if(!_0x4adce6[_0x53dd('0x4a')]['hasOwnProperty'](_0x53dd('0x51'))){_0x41536d[_0x53dd('0x31')]=qs[_0x53dd('0x31')](_0x4adce6[_0x53dd('0x4a')][_0x53dd('0x31')]);_0x41536d[_0x53dd('0x2f')]=qs['offset'](_0x4adce6[_0x53dd('0x4a')]['offset']);}return _0x4faa65['getAgents'](_0x41536d);}})[_0x53dd('0x3a')](function(_0x4229e7){if(_0x4229e7){return _0x4229e7?{'count':_0x35284c,'rows':_0x4229e7}:null;}})[_0x53dd('0x3a')](respondWithResult(_0x4f8d62,null))[_0x53dd('0x2b')](handleError(_0x4f8d62,null));};exports[_0x53dd('0x3f')]=function(_0x19bca7,_0x246356,_0x1c5861){var _0x230874,_0x2e4ee9,_0x580ead;if(_['isNil'](_0x19bca7[_0x53dd('0x61')][_0x53dd('0x61')])||_0x19bca7[_0x53dd('0x61')][_0x53dd('0x61')]===''){throw new db[(_0x53dd('0x76'))][(_0x53dd('0x7f'))](_0x53dd('0x81'));}if(_['isNil'](_0x19bca7['body']['to'])){}_0x230874=_0x19bca7[_0x53dd('0x61')]['to'];return db[_0x53dd('0x43')][_0x53dd('0x6d')]({'where':{'id':_0x19bca7[_0x53dd('0x5f')]['id']}})[_0x53dd('0x3a')](handleEntityNotFound(_0x246356,null))[_0x53dd('0x3a')](function(_0x5593dc){if(_0x5593dc){return db['OpenchannelAccount'][_0x53dd('0x60')]({'where':{'id':_0x5593dc['id']},'include':[{'model':db[_0x53dd('0xb7')],'as':_0x53dd('0x86'),'include':[{'model':db[_0x53dd('0x75')],'as':_0x53dd('0x87'),'where':{[_0x5593dc[_0x53dd('0x82')]]:_0x230874},'limit':0x1,'order':[['updatedAt',_0x53dd('0x88')]]}]}]})[_0x53dd('0x3a')](handleEntityNotFound(_0x246356,null))[_0x53dd('0x3a')](function(_0x5f236a){if(_0x5f236a&&_0x5f236a['List']){_0x2e4ee9=_0x5f236a[_0x53dd('0x3b')]({'plain':!![]});if(_0x2e4ee9[_0x53dd('0x86')]&&_0x2e4ee9[_0x53dd('0x86')][_0x53dd('0x87')][_0x53dd('0x4f')]){return _0x2e4ee9[_0x53dd('0x86')][_0x53dd('0x87')][0x0];}return db[_0x53dd('0x75')][_0x53dd('0x6c')](_[_0x53dd('0x1a')](_0x19bca7[_0x53dd('0x61')],{'firstName':_0x230874,[_0x5f236a[_0x53dd('0x82')]]:_0x230874,'phone':_0x230874,'ListId':_0x2e4ee9[_0x53dd('0x7c')]}));}})[_0x53dd('0x3a')](handleEntityNotFound(_0x246356,null))[_0x53dd('0x3a')](function(_0x4c7850){if(_0x4c7850){_0x580ead=_0x4c7850;return db[_0x53dd('0x91')][_0x53dd('0x60')]({'where':{'ContactId':_0x580ead['id'],'closed':![],'OpenchannelAccountId':_0x2e4ee9['id']}})[_0x53dd('0x3a')](function(_0x49fa19){if(_0x49fa19){return[_0x49fa19,![]];}return db[_0x53dd('0x91')][_0x53dd('0x6c')]({'UserId':_0x19bca7['user']['id'],'ContactId':_0x580ead['id'],'OpenchannelAccountId':_0x2e4ee9['id'],'lastMsgDirection':_0x53dd('0xb8'),'Messages':[_['merge'](_0x19bca7[_0x53dd('0x61')],{'read':![],'body':_0x19bca7[_0x53dd('0x61')][_0x53dd('0x61')],'OpenchannelAccountId':_0x2e4ee9['id'],'UserId':_0x19bca7[_0x53dd('0x64')]['id'],'ContactId':_0x580ead['id']})]},{'include':[{'model':db[_0x53dd('0x9e')],'as':_0x53dd('0xb9')}]})[_0x53dd('0x3a')](function(_0x3e1c07){return[_0x3e1c07,!![]];});});}})[_0x53dd('0x94')](function(_0x45c85f,_0x8878c9){if(_0x8878c9){return _0x45c85f;}return db[_0x53dd('0x9e')][_0x53dd('0x6c')](_[_0x53dd('0x56')](_0x19bca7['body'],{'read':![],'body':_0x19bca7['body'][_0x53dd('0x61')],'OpenchannelAccountId':_0x2e4ee9['id'],'OpenchannelInteractionId':_0x45c85f['id'],'UserId':_0x19bca7[_0x53dd('0x64')]['id'],'ContactId':_0x580ead['id']}))[_0x53dd('0x3a')](function(_0x1c9365){_0x45c85f[_0x53dd('0xba')][_0x53dd('0xb9')]=[];_0x45c85f[_0x53dd('0xba')]['Messages'][_0x53dd('0x9b')](_0x1c9365[_0x53dd('0xba')]);return _0x45c85f;});});}})[_0x53dd('0x3a')](respondWithResult(_0x246356,null))['catch'](handleError(_0x246356,null));}; \ No newline at end of file +var _0x62b3=['localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','params','keys','fields','includeAll','find','create','body','user','get','role','OpenchannelAccounts','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','getDispositions','findOne','Disposition','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','ValidationError','difference','createdAt','updatedAt','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','Contacts','DESC','Applications','account','applications','list','orderBy','priority','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','messageId','interaction','created','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','spread','emit','isArray','userOpenchannelAccount:remove','getAgents','send','CmList','out','Messages','dataValues','push','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis'];(function(_0x295551,_0x163f59){var _0x2c10b4=function(_0x2c65b7){while(--_0x2c65b7){_0x295551['push'](_0x295551['shift']());}};_0x2c10b4(++_0x163f59);}(_0x62b3,0x15b));var _0x362b=function(_0x2190c3,_0x8bd37e){_0x2190c3=_0x2190c3-0x0;var _0x38aae3=_0x62b3[_0x2190c3];return _0x38aae3;};'use strict';var emlformat=require(_0x362b('0x0'));var rimraf=require(_0x362b('0x1'));var zipdir=require(_0x362b('0x2'));var jsonpatch=require(_0x362b('0x3'));var rp=require(_0x362b('0x4'));var moment=require(_0x362b('0x5'));var BPromise=require(_0x362b('0x6'));var Mustache=require(_0x362b('0x7'));var util=require(_0x362b('0x8'));var path=require(_0x362b('0x9'));var sox=require('sox');var csv=require(_0x362b('0xa'));var ejs=require(_0x362b('0xb'));var fs=require('fs');var fs_extra=require(_0x362b('0xc'));var _=require(_0x362b('0xd'));var squel=require(_0x362b('0xe'));var crypto=require(_0x362b('0xf'));var jsforce=require(_0x362b('0x10'));var deskjs=require(_0x362b('0x11'));var toCsv=require('to-csv');var querystring=require(_0x362b('0x12'));var Papa=require(_0x362b('0x13'));var Redis=require(_0x362b('0x14'));var authService=require(_0x362b('0x15'));var qs=require(_0x362b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x362b('0x17'));var config=require(_0x362b('0x18'));var licenseUtil=require(_0x362b('0x19'));var db=require(_0x362b('0x1a'))['db'];config['redis']=_[_0x362b('0x1b')](config[_0x362b('0x1c')],{'host':_0x362b('0x1d'),'port':0x18eb});var socket=require(_0x362b('0x1e'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x362b('0x1f')](socket);var jayson=require(_0x362b('0x20'));var client=jayson[_0x362b('0x21')][_0x362b('0x22')]({'port':0x232c});var client9002=jayson[_0x362b('0x21')][_0x362b('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x5f44cb,_0x10e407,_0x4f92bc,_0x50fff5){return new BPromise(function(_0x3c154b,_0x27a4ac){var _0x183569=_0x50fff5||client;return _0x183569[_0x362b('0x23')](_0x5f44cb,_0x4f92bc)['then'](function(_0x51205d){logger[_0x362b('0x24')](_0x362b('0x25'),_0x10e407,_0x362b('0x26'));logger[_0x362b('0x27')](_0x362b('0x28'),_0x10e407,_0x362b('0x26'),JSON[_0x362b('0x29')](_0x51205d));if(_0x51205d['error']){if(_0x51205d['error'][_0x362b('0x2a')]===0x1f4){logger[_0x362b('0x2b')](_0x362b('0x25'),_0x10e407,_0x51205d['error'][_0x362b('0x2c')]);return _0x27a4ac(_0x51205d['error'][_0x362b('0x2c')]);}logger['error'](_0x362b('0x25'),_0x10e407,_0x51205d[_0x362b('0x2b')][_0x362b('0x2c')]);return _0x3c154b(_0x51205d['error'][_0x362b('0x2c')]);}else{logger[_0x362b('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x10e407,_0x362b('0x26'));_0x3c154b(_0x51205d[_0x362b('0x2d')]['message']);}})[_0x362b('0x2e')](function(_0x14b5dd){logger[_0x362b('0x2b')](_0x362b('0x25'),_0x10e407,_0x14b5dd);_0x27a4ac(_0x14b5dd);});});}function respondWithStatusCode(_0x5944d8,_0x3021da){_0x3021da=_0x3021da||0xcc;return function(_0x51ca00){if(_0x51ca00){return _0x5944d8[_0x362b('0x2f')](_0x3021da);}return _0x5944d8[_0x362b('0x30')](_0x3021da)['end']();};}function respondWithResult(_0x399e2e,_0x5adc4f){_0x5adc4f=_0x5adc4f||0xc8;return function(_0x4e1aab){if(_0x4e1aab){return _0x399e2e[_0x362b('0x30')](_0x5adc4f)['json'](_0x4e1aab);}};}function respondWithFilteredResult(_0x274719,_0x453405){return function(_0x49c1b1){if(_0x49c1b1){var _0x45c5f6=typeof _0x453405[_0x362b('0x31')]===_0x362b('0x32')&&typeof _0x453405[_0x362b('0x33')]===_0x362b('0x32');var _0x2a5a81=_0x49c1b1[_0x362b('0x34')];var _0x546c30=_0x45c5f6?0x0:_0x453405['offset'];var _0x23ce96=_0x45c5f6?_0x49c1b1[_0x362b('0x34')]:_0x453405['offset']+_0x453405['limit'];var _0x4e329a;if(_0x23ce96>=_0x2a5a81){_0x23ce96=_0x2a5a81;_0x4e329a=0xc8;}else{_0x4e329a=0xce;}_0x274719[_0x362b('0x30')](_0x4e329a);return _0x274719[_0x362b('0x35')]('Content-Range',_0x546c30+'-'+_0x23ce96+'/'+_0x2a5a81)['json'](_0x49c1b1);}return null;};}function patchUpdates(_0xb787ae){return function(_0x2ef340){try{jsonpatch[_0x362b('0x36')](_0x2ef340,_0xb787ae,!![]);}catch(_0x45a107){return BPromise[_0x362b('0x37')](_0x45a107);}return _0x2ef340[_0x362b('0x38')]();};}function saveUpdates(_0x318181,_0x10ca43){return function(_0x34c9f6){if(_0x34c9f6){return _0x34c9f6[_0x362b('0x39')](_0x318181)['then'](function(_0x498a7c){return _0x498a7c;});}return null;};}function removeEntity(_0x5e0b08,_0x870cfd){return function(_0x50f2ef){if(_0x50f2ef){return _0x50f2ef['destroy']()[_0x362b('0x3a')](function(){var _0x2e6976=_0x50f2ef['get']({'plain':!![]});var _0x5ef31d='OpenchannelAccounts';return db['UserProfileResource'][_0x362b('0x3b')]({'where':{'type':_0x5ef31d,'resourceId':_0x2e6976['id']}})[_0x362b('0x3a')](function(){return _0x50f2ef;});})['then'](function(){_0x5e0b08[_0x362b('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3195ea,_0x4fcbbd){return function(_0x251ba3){if(!_0x251ba3){_0x3195ea[_0x362b('0x2f')](0x194);}return _0x251ba3;};}function handleError(_0x5bef4a,_0x3b18f7){_0x3b18f7=_0x3b18f7||0x1f4;return function(_0xd7ef73){logger[_0x362b('0x2b')](_0xd7ef73[_0x362b('0x3c')]);if(_0xd7ef73[_0x362b('0x3d')]){delete _0xd7ef73[_0x362b('0x3d')];}_0x5bef4a[_0x362b('0x30')](_0x3b18f7)['send'](_0xd7ef73);};}exports[_0x362b('0x3e')]=function(_0x54eb35,_0xfe2e43){var _0x8f5d67={'include':[{'model':db[_0x362b('0x3f')],'as':_0x362b('0x40')}]},_0xbf6ac2={},_0x18a09e={'count':0x0,'rows':[]};var _0x56715a=_['map'](db[_0x362b('0x41')][_0x362b('0x42')],function(_0x42e201){return{'name':_0x42e201['fieldName'],'type':_0x42e201[_0x362b('0x43')]['key']};});_0xbf6ac2[_0x362b('0x44')]=_[_0x362b('0x45')](_0x56715a,_0x362b('0x3d'));_0xbf6ac2[_0x362b('0x46')]=_['keys'](_0x54eb35[_0x362b('0x46')]);_0xbf6ac2[_0x362b('0x47')]=_[_0x362b('0x48')](_0xbf6ac2[_0x362b('0x44')],_0xbf6ac2[_0x362b('0x46')]);_0x8f5d67[_0x362b('0x49')]=_[_0x362b('0x48')](_0xbf6ac2['model'],qs['fields'](_0x54eb35['query']['fields']));_0x8f5d67['attributes']=_0x8f5d67[_0x362b('0x49')][_0x362b('0x4a')]?_0x8f5d67[_0x362b('0x49')]:_0xbf6ac2[_0x362b('0x44')];if(!_0x54eb35[_0x362b('0x46')][_0x362b('0x4b')](_0x362b('0x4c'))){_0x8f5d67['limit']=qs[_0x362b('0x33')](_0x54eb35[_0x362b('0x46')]['limit']);_0x8f5d67[_0x362b('0x31')]=qs[_0x362b('0x31')](_0x54eb35[_0x362b('0x46')][_0x362b('0x31')]);}_0x8f5d67['order']=qs['sort'](_0x54eb35[_0x362b('0x46')][_0x362b('0x4d')]);_0x8f5d67[_0x362b('0x4e')]=qs[_0x362b('0x47')](_[_0x362b('0x4f')](_0x54eb35[_0x362b('0x46')],_0xbf6ac2[_0x362b('0x47')]),_0x56715a);if(_0x54eb35['query'][_0x362b('0x50')]){_0x8f5d67[_0x362b('0x4e')]=_['merge'](_0x8f5d67['where'],{'$or':_[_0x362b('0x45')](_0x56715a,function(_0x2e859c){if(_0x2e859c[_0x362b('0x43')]!==_0x362b('0x51')){var _0x179bc2={};_0x179bc2[_0x2e859c[_0x362b('0x3d')]]={'$like':'%'+_0x54eb35['query'][_0x362b('0x50')]+'%'};return _0x179bc2;}})});}_0x8f5d67=_[_0x362b('0x52')]({},_0x8f5d67,_0x54eb35[_0x362b('0x53')]);var _0x7b5745={'where':_0x8f5d67[_0x362b('0x4e')]};return db[_0x362b('0x41')][_0x362b('0x34')](_0x7b5745)['then'](function(_0x4695de){_0x18a09e[_0x362b('0x34')]=_0x4695de;if(_0x54eb35[_0x362b('0x46')]['includeAll']){_0x8f5d67[_0x362b('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x362b('0x55')](_0x8f5d67);})['then'](function(_0x5e735b){_0x18a09e[_0x362b('0x56')]=_0x5e735b;return _0x18a09e;})['then'](respondWithFilteredResult(_0xfe2e43,_0x8f5d67))[_0x362b('0x2e')](handleError(_0xfe2e43,null));};exports['show']=function(_0xeb703d,_0x2f3a1a){var _0x375d08={'raw':![],'where':{'id':_0xeb703d[_0x362b('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x362b('0x40')}]},_0x58e68b={};_0x58e68b[_0x362b('0x44')]=_[_0x362b('0x58')](db['OpenchannelAccount']['rawAttributes']);_0x58e68b['query']=_[_0x362b('0x58')](_0xeb703d[_0x362b('0x46')]);_0x58e68b['filters']=_[_0x362b('0x48')](_0x58e68b[_0x362b('0x44')],_0x58e68b[_0x362b('0x46')]);_0x375d08['attributes']=_['intersection'](_0x58e68b[_0x362b('0x44')],qs[_0x362b('0x59')](_0xeb703d[_0x362b('0x46')][_0x362b('0x59')]));_0x375d08[_0x362b('0x49')]=_0x375d08[_0x362b('0x49')]['length']?_0x375d08[_0x362b('0x49')]:_0x58e68b[_0x362b('0x44')];if(_0xeb703d[_0x362b('0x46')][_0x362b('0x5a')]){_0x375d08['include']=[{'all':!![]}];}_0x375d08=_[_0x362b('0x52')]({},_0x375d08,_0xeb703d[_0x362b('0x53')]);return db[_0x362b('0x41')][_0x362b('0x5b')](_0x375d08)[_0x362b('0x3a')](handleEntityNotFound(_0x2f3a1a,null))[_0x362b('0x3a')](respondWithResult(_0x2f3a1a,null))['catch'](handleError(_0x2f3a1a,null));};exports[_0x362b('0x5c')]=function(_0xbfd0d,_0x23ce09){return db['OpenchannelAccount'][_0x362b('0x5c')](_0xbfd0d[_0x362b('0x5d')],{})[_0x362b('0x3a')](function(_0x344281){var _0x36d6f2=_0xbfd0d[_0x362b('0x5e')][_0x362b('0x5f')]({'plain':!![]});if(!_0x36d6f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36d6f2[_0x362b('0x60')]===_0x362b('0x5e')){var _0x245fe7=_0x344281[_0x362b('0x5f')]({'plain':!![]});var _0x1fa92d=_0x362b('0x61');return db['UserProfileSection']['find']({'where':{'name':_0x1fa92d,'userProfileId':_0x36d6f2['userProfileId']},'raw':!![]})['then'](function(_0xcb339c){if(_0xcb339c&&_0xcb339c[_0x362b('0x62')]===0x0){return db[_0x362b('0x63')]['create']({'name':_0x245fe7[_0x362b('0x3d')],'resourceId':_0x245fe7['id'],'type':_0xcb339c[_0x362b('0x3d')],'sectionId':_0xcb339c['id']},{})[_0x362b('0x3a')](function(){return _0x344281;});}else{return _0x344281;}})['catch'](function(_0x4e39e6){logger[_0x362b('0x2b')](_0x362b('0x64'),_0x4e39e6);throw _0x4e39e6;});}return _0x344281;})[_0x362b('0x3a')](respondWithResult(_0x23ce09,0xc9))[_0x362b('0x2e')](handleError(_0x23ce09,null));};exports[_0x362b('0x39')]=function(_0x215861,_0x59ad45){if(_0x215861[_0x362b('0x5d')]['id']){delete _0x215861[_0x362b('0x5d')]['id'];}return db[_0x362b('0x41')][_0x362b('0x5b')]({'where':{'id':_0x215861[_0x362b('0x57')]['id']},'include':[{'model':db[_0x362b('0x3f')],'as':'mandatoryDispositionPause'}]})[_0x362b('0x3a')](handleEntityNotFound(_0x59ad45,null))[_0x362b('0x3a')](saveUpdates(_0x215861[_0x362b('0x5d')],null))[_0x362b('0x3a')](respondWithResult(_0x59ad45,null))[_0x362b('0x2e')](handleError(_0x59ad45,null));};exports[_0x362b('0x3b')]=function(_0x11378b,_0x57fc46){return db['OpenchannelAccount'][_0x362b('0x5b')]({'where':{'id':_0x11378b[_0x362b('0x57')]['id']}})['then'](handleEntityNotFound(_0x57fc46,null))['then'](removeEntity(_0x57fc46,null))['catch'](handleError(_0x57fc46,null));};exports['describe']=function(_0x37a8b9,_0x2ede61){return db[_0x362b('0x41')][_0x362b('0x65')]()['then'](respondWithResult(_0x2ede61,null))[_0x362b('0x2e')](handleError(_0x2ede61,null));};exports['addDisposition']=function(_0x490c95,_0x4ba06e,_0x478100){if(_0x490c95[_0x362b('0x5d')]['id']){delete _0x490c95['body']['id'];}return db[_0x362b('0x41')]['find']({'where':{'id':_0x490c95['params']['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x4ba06e,null))[_0x362b('0x3a')](function(_0x57dffe){if(_0x57dffe){_0x490c95[_0x362b('0x5d')][_0x362b('0x66')]=_0x57dffe['id'];return db['Disposition']['create'](_0x490c95[_0x362b('0x5d')]);}})[_0x362b('0x3a')](respondWithResult(_0x4ba06e,null))[_0x362b('0x2e')](handleError(_0x4ba06e,null));};exports[_0x362b('0x67')]=function(_0x743201,_0x348372,_0x37297f){var _0x250a4e={'raw':![],'where':{}};var _0x1a1792={};var _0x19c2f0={'count':0x0,'rows':[]};return db[_0x362b('0x41')][_0x362b('0x68')]({'where':{'id':_0x743201[_0x362b('0x57')]['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x348372,null))[_0x362b('0x3a')](function(_0x16b487){if(_0x16b487){_0x1a1792['model']=_['keys'](db[_0x362b('0x69')][_0x362b('0x42')]);_0x1a1792[_0x362b('0x46')]=_[_0x362b('0x58')](_0x743201[_0x362b('0x46')]);_0x1a1792[_0x362b('0x47')]=_[_0x362b('0x48')](_0x1a1792['model'],_0x1a1792[_0x362b('0x46')]);_0x250a4e['attributes']=_[_0x362b('0x48')](_0x1a1792[_0x362b('0x44')],qs[_0x362b('0x59')](_0x743201[_0x362b('0x46')][_0x362b('0x59')]));_0x250a4e['attributes']=_0x250a4e[_0x362b('0x49')][_0x362b('0x4a')]?_0x250a4e[_0x362b('0x49')]:_0x1a1792[_0x362b('0x44')];if(!_0x743201[_0x362b('0x46')][_0x362b('0x4b')](_0x362b('0x4c'))){_0x250a4e['limit']=qs[_0x362b('0x33')](_0x743201[_0x362b('0x46')]['limit']);_0x250a4e[_0x362b('0x31')]=qs[_0x362b('0x31')](_0x743201['query'][_0x362b('0x31')]);}_0x250a4e[_0x362b('0x6a')]=qs['sort'](_0x743201['query']['sort']);_0x250a4e[_0x362b('0x4e')]=qs[_0x362b('0x47')](_[_0x362b('0x4f')](_0x743201[_0x362b('0x46')],_0x1a1792[_0x362b('0x47')]));_0x250a4e['where']['OpenchannelAccountId']=_0x16b487['id'];if(_0x743201[_0x362b('0x46')][_0x362b('0x50')]){_0x250a4e['where']=_['merge'](_0x250a4e[_0x362b('0x4e')],{'$or':_[_0x362b('0x45')](_0x250a4e[_0x362b('0x49')],function(_0x1ac01c){var _0x1c0064={};_0x1c0064[_0x1ac01c]={'$like':'%'+_0x743201['query'][_0x362b('0x50')]+'%'};return _0x1c0064;})});}_0x250a4e=_[_0x362b('0x52')]({},_0x250a4e,_0x743201[_0x362b('0x53')]);return db['Disposition'][_0x362b('0x34')]({'where':_0x250a4e[_0x362b('0x4e')]})[_0x362b('0x3a')](function(_0x213fe5){_0x19c2f0[_0x362b('0x34')]=_0x213fe5;if(_0x743201['query'][_0x362b('0x5a')]){_0x250a4e['include']=[{'all':!![]}];}return db['Disposition'][_0x362b('0x55')](_0x250a4e);})['then'](function(_0x48b2d4){_0x19c2f0[_0x362b('0x56')]=_0x48b2d4;return _0x19c2f0;});}})[_0x362b('0x3a')](respondWithFilteredResult(_0x348372,_0x250a4e))['catch'](handleError(_0x348372,null));};exports[_0x362b('0x6b')]=function(_0x2172c4,_0x31fbae,_0x298934){return db[_0x362b('0x41')][_0x362b('0x5b')]({'where':{'id':_0x2172c4[_0x362b('0x57')]['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x31fbae,null))[_0x362b('0x3a')](function(_0x47460b){if(_0x47460b){return _0x47460b[_0x362b('0x6b')](_0x2172c4['query'][_0x362b('0x6c')]);}})[_0x362b('0x3a')](respondWithStatusCode(_0x31fbae,null))['catch'](handleError(_0x31fbae,null));};exports[_0x362b('0x6d')]=function(_0x2c607e,_0xc3868e,_0x257d10){if(_0x2c607e['body']['id']){delete _0x2c607e[_0x362b('0x5d')]['id'];}return db[_0x362b('0x41')][_0x362b('0x5b')]({'where':{'id':_0x2c607e[_0x362b('0x57')]['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0xc3868e,null))[_0x362b('0x3a')](function(_0x4e23d1){if(_0x4e23d1){_0x2c607e['body'][_0x362b('0x66')]=_0x4e23d1['id'];return db[_0x362b('0x6e')][_0x362b('0x5c')](_0x2c607e[_0x362b('0x5d')]);}})['then'](respondWithResult(_0xc3868e,null))[_0x362b('0x2e')](handleError(_0xc3868e,null));};exports[_0x362b('0x6f')]=function(_0x2bf8d3,_0x8f72a9,_0x4fc390){var _0x30c441={'raw':![],'where':{}};var _0x11b4da={};var _0x171c92={'count':0x0,'rows':[]};return db[_0x362b('0x41')][_0x362b('0x68')]({'where':{'id':_0x2bf8d3[_0x362b('0x57')]['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x8f72a9,null))[_0x362b('0x3a')](function(_0x5ab696){if(_0x5ab696){_0x11b4da['model']=_[_0x362b('0x58')](db[_0x362b('0x6e')][_0x362b('0x42')]);_0x11b4da['query']=_['keys'](_0x2bf8d3[_0x362b('0x46')]);_0x11b4da['filters']=_[_0x362b('0x48')](_0x11b4da['model'],_0x11b4da[_0x362b('0x46')]);_0x30c441[_0x362b('0x49')]=_[_0x362b('0x48')](_0x11b4da[_0x362b('0x44')],qs[_0x362b('0x59')](_0x2bf8d3[_0x362b('0x46')]['fields']));_0x30c441[_0x362b('0x49')]=_0x30c441[_0x362b('0x49')]['length']?_0x30c441[_0x362b('0x49')]:_0x11b4da[_0x362b('0x44')];if(!_0x2bf8d3['query'][_0x362b('0x4b')]('nolimit')){_0x30c441[_0x362b('0x33')]=qs[_0x362b('0x33')](_0x2bf8d3['query'][_0x362b('0x33')]);_0x30c441[_0x362b('0x31')]=qs['offset'](_0x2bf8d3[_0x362b('0x46')][_0x362b('0x31')]);}_0x30c441['order']=qs['sort'](_0x2bf8d3['query'][_0x362b('0x4d')]);_0x30c441[_0x362b('0x4e')]=qs[_0x362b('0x47')](_[_0x362b('0x4f')](_0x2bf8d3[_0x362b('0x46')],_0x11b4da[_0x362b('0x47')]));_0x30c441['where']['OpenchannelAccountId']=_0x5ab696['id'];if(_0x2bf8d3[_0x362b('0x46')][_0x362b('0x50')]){_0x30c441['where']=_[_0x362b('0x52')](_0x30c441['where'],{'$or':_[_0x362b('0x45')](_0x30c441[_0x362b('0x49')],function(_0x272b7b){var _0x1b2469={};_0x1b2469[_0x272b7b]={'$like':'%'+_0x2bf8d3[_0x362b('0x46')]['filter']+'%'};return _0x1b2469;})});}_0x30c441=_[_0x362b('0x52')]({},_0x30c441,_0x2bf8d3[_0x362b('0x53')]);return db[_0x362b('0x6e')][_0x362b('0x34')]({'where':_0x30c441['where']})[_0x362b('0x3a')](function(_0x19673c){_0x171c92[_0x362b('0x34')]=_0x19673c;if(_0x2bf8d3['query'][_0x362b('0x5a')]){_0x30c441[_0x362b('0x54')]=[{'all':!![]}];}return db[_0x362b('0x6e')][_0x362b('0x55')](_0x30c441);})['then'](function(_0x5bf971){_0x171c92[_0x362b('0x56')]=_0x5bf971;return _0x171c92;});}})[_0x362b('0x3a')](respondWithFilteredResult(_0x8f72a9,_0x30c441))[_0x362b('0x2e')](handleError(_0x8f72a9,null));};exports[_0x362b('0x70')]=function(_0xf1b48a,_0x477389,_0x37250c){return db[_0x362b('0x41')][_0x362b('0x5b')]({'where':{'id':_0xf1b48a['params']['id']}})['then'](handleEntityNotFound(_0x477389,null))[_0x362b('0x3a')](function(_0x39fcd9){if(_0x39fcd9){return _0x39fcd9[_0x362b('0x70')](_0xf1b48a[_0x362b('0x46')][_0x362b('0x6c')]);}})['then'](respondWithStatusCode(_0x477389,null))[_0x362b('0x2e')](handleError(_0x477389,null));};exports[_0x362b('0x71')]=function(_0x1e2ccc,_0x489e9c,_0x44f2b2){var _0x39f5f2={'body':_0x1e2ccc['body'],'channel':_0x362b('0x72')};var _0x28f2f5=[];var _0x31006b=[];var _0x159656={};var _0x38b060=![];return db['CmContact'][_0x362b('0x65')]()[_0x362b('0x3a')](function(_0x37abc7){if(!_0x37abc7){throw new db['Sequelize'][(_0x362b('0x73'))]('no\x20available\x20attributes');}_0x28f2f5=_[_0x362b('0x74')](_[_0x362b('0x58')](_0x37abc7),[_0x362b('0x75'),'updatedAt']);_0x31006b=_[_0x362b('0x74')](_['keys'](_0x37abc7),[_0x362b('0x75'),_0x362b('0x76'),'CompanyId',_0x362b('0x77')]);if(_0x1e2ccc[_0x362b('0x5d')]['id']){delete _0x1e2ccc[_0x362b('0x5d')]['id'];}if(_[_0x362b('0x78')](_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x79')])){throw new db[(_0x362b('0x7a'))]['ValidationError'](_0x362b('0x7b'));}if(_[_0x362b('0x78')](_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x5d')])||_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x5d')]===''){throw new db[(_0x362b('0x7a'))][(_0x362b('0x73'))](_0x362b('0x7c'));}if(_['isNil'](_0x1e2ccc[_0x362b('0x5d')]['mapKey'])){throw new db['Sequelize'][(_0x362b('0x73'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x31006b);}if(!_[_0x362b('0x7d')](_0x31006b,_0x1e2ccc['body'][_0x362b('0x7e')])){throw new db[(_0x362b('0x7a'))][(_0x362b('0x73'))](_0x362b('0x7f')+_0x31006b);}_0x159656[_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x7e')]]=_0x1e2ccc['body'][_0x362b('0x79')];})[_0x362b('0x3a')](function(){return db[_0x362b('0x41')]['find']({'where':{'id':_0x1e2ccc[_0x362b('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0x362b('0x80'),'include':[{'model':db[_0x362b('0x81')],'as':_0x362b('0x82'),'where':_0x159656,'limit':0x1,'order':[[_0x362b('0x76'),_0x362b('0x83')]]}]},{'model':db['OpenchannelApplication'],'as':_0x362b('0x84')}]});})[_0x362b('0x3a')](handleEntityNotFound(_0x489e9c,null))[_0x362b('0x3a')](function(_0x595c7d){if(_0x595c7d&&_0x595c7d[_0x362b('0x80')]){_0x39f5f2[_0x362b('0x85')]=_0x595c7d;_0x39f5f2[_0x362b('0x86')]=_0x595c7d['Applications'];_0x39f5f2[_0x362b('0x87')]=_0x595c7d[_0x362b('0x80')];_0x39f5f2[_0x362b('0x86')]=_[_0x362b('0x88')](_0x39f5f2[_0x362b('0x86')],[_0x362b('0x89')],['asc']);if(_0x39f5f2['account']['Applications']){delete _0x39f5f2[_0x362b('0x85')][_0x362b('0x84')];}if(_0x39f5f2[_0x362b('0x85')]['List']&&_0x39f5f2[_0x362b('0x85')][_0x362b('0x80')]['Contacts']['length']){return _0x39f5f2['account'][_0x362b('0x80')]['Contacts'][0x0];}var _0x48d3bc=_[_0x362b('0x1b')](_0x1e2ccc['body'],{'firstName':_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x79')],'ListId':_0x595c7d[_0x362b('0x77')]});_0x48d3bc[_0x1e2ccc[_0x362b('0x5d')]['mapKey']]=_0x1e2ccc['body'][_0x362b('0x79')];return db[_0x362b('0x81')][_0x362b('0x5c')](_0x48d3bc,{'fields':_0x28f2f5,'raw':!![]});}})[_0x362b('0x3a')](handleEntityNotFound(_0x489e9c,null))[_0x362b('0x3a')](function(_0x130f59){_0x39f5f2[_0x362b('0x8a')]=_0x130f59;if(_0x130f59){var _0x1881f5={'ContactId':_0x130f59['id'],'OpenchannelAccountId':_0x1e2ccc['params']['id'],'from':(_0x130f59[_0x362b('0x8b')]||'')+'\x20'+(_0x130f59[_0x362b('0x8c')]||'')};var _0x663b62={'OpenchannelAccountId':_0x1e2ccc[_0x362b('0x57')]['id'],'closed':![]};if(_0x1e2ccc[_0x362b('0x5d')]['threadId']){_0x663b62['threadId']=_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x8d')];return db['OpenchannelInteraction']['find']({'where':_0x663b62})[_0x362b('0x3a')](function(_0x3b8461){if(_0x3b8461){return[_0x3b8461,![]];}_0x1881f5[_0x362b('0x8d')]=_0x1e2ccc[_0x362b('0x5d')]['threadId'];_0x1881f5[_0x362b('0x8e')]=_0x1e2ccc[_0x362b('0x5d')]['externalUrl'];return db[_0x362b('0x8f')][_0x362b('0x5c')](_0x1881f5)['then'](function(_0x25e766){return[_0x25e766,!![]];});});}else{_0x663b62[_0x362b('0x8d')]=null;}_0x663b62[_0x362b('0x90')]=_0x130f59['id'];return db[_0x362b('0x8f')][_0x362b('0x5b')]({'where':_0x663b62})[_0x362b('0x3a')](function(_0x517409){if(_0x517409){return[_0x517409,![]];}return db[_0x362b('0x8f')][_0x362b('0x5c')](_0x1881f5)[_0x362b('0x3a')](function(_0x385dee){return[_0x385dee,!![]];});});}})['spread'](function(_0x51880b,_0x4d740a){if(_0x51880b){_0x38b060=_0x4d740a;if(!_0x4d740a){var _0x168e2b={'from':(_0x39f5f2[_0x362b('0x8a')]['firstName']||'')+'\x20'+(_0x39f5f2[_0x362b('0x8a')]['lastName']||'')};if(_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x8d')]&&_0x1e2ccc[_0x362b('0x5d')]['messageId']&&_0x1e2ccc['body'][_0x362b('0x8d')]!=_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x91')]){_0x168e2b[_0x362b('0x8d')]=_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x91')];}return _0x51880b[_0x362b('0x39')](_0x168e2b);}else{return _0x51880b;}}})[_0x362b('0x3a')](function(_0x13a0ab){_0x39f5f2[_0x362b('0x92')]=_0x13a0ab['get']({'plain':!![]});_0x39f5f2[_0x362b('0x92')][_0x362b('0x93')]=_0x38b060;if(_0x39f5f2[_0x362b('0x92')][_0x362b('0x93')]){if(_0x39f5f2['account']['autoclose']){_0x39f5f2['applications']['push']({'id':0x0,'priority':_0x39f5f2[_0x362b('0x86')]['length']+0x1,'app':'close','appdata':_0x362b('0x94'),'interval':_0x362b('0x95')});}}return db[_0x362b('0x96')][_0x362b('0x5c')]({'body':_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x5d')],'OpenchannelAccountId':_0x1e2ccc[_0x362b('0x57')]['id'],'OpenchannelInteractionId':_0x13a0ab['id'],'direction':'in','ContactId':_0x39f5f2[_0x362b('0x8a')]['id'],'AttachmentId':_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x97')]});})[_0x362b('0x3a')](function(_0x33f7b3){_0x39f5f2[_0x362b('0x2c')]=_0x33f7b3;if(_0x39f5f2[_0x362b('0x92')][_0x362b('0x98')]){return db[_0x362b('0x99')][_0x362b('0x5b')]({'attributes':['id','name'],'where':{'id':_0x39f5f2[_0x362b('0x92')][_0x362b('0x98')]}})[_0x362b('0x3a')](function(_0x3a99f3){if(_0x3a99f3){_0x39f5f2[_0x362b('0x86')]['unshift']({'id':0x0,'priority':0x0,'app':_0x362b('0x9a'),'appdata':_0x3a99f3[_0x362b('0x3d')]+','+(_0x39f5f2[_0x362b('0x85')][_0x362b('0x9b')]||0xa),'interval':_0x362b('0x95')});_0x39f5f2[_0x362b('0x9c')]=![];}return respondWithRpcPromise(_0x362b('0x9d'),_0x362b('0x9e'),_0x39f5f2);});}return respondWithRpcPromise(_0x362b('0x9d'),_0x362b('0x9e'),_0x39f5f2);})[_0x362b('0x3a')](function(_0x367bfc){respondWithRpcPromise(_0x362b('0x9f'),'EventManager',{'event':_0x362b('0x71'),'message':_0x367bfc},client9002);return _0x367bfc;})[_0x362b('0x3a')](respondWithResult(_0x489e9c,null))[_0x362b('0x2e')](handleError(_0x489e9c,null));};exports[_0x362b('0xa0')]=function(_0x43021d,_0x34a213,_0xec3f1b){return db[_0x362b('0x41')][_0x362b('0x68')]({'where':{'id':_0x43021d['params']['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x34a213,null))[_0x362b('0x3a')](function(_0x3b3754){if(_0x3b3754){return db[_0x362b('0xa1')][_0x362b('0xa2')](function(_0x36656b){return db[_0x362b('0xa3')][_0x362b('0x3b')]({'where':{'OpenchannelAccountId':_0x43021d[_0x362b('0x57')]['id']},'transaction':_0x36656b})[_0x362b('0x3a')](function(_0x42d5f1){var _0x5bd388=_['map'](_0x43021d[_0x362b('0x5d')],function(_0x2b8157){_0x2b8157[_0x362b('0x66')]=_0x43021d['params']['id'];return _0x2b8157;});return db[_0x362b('0xa3')][_0x362b('0xa4')](_0x5bd388,{'transaction':_0x36656b});});})[_0x362b('0x3a')](function(){return db['OpenchannelApplication'][_0x362b('0xa5')]({'where':{'OpenchannelAccountId':_0x43021d[_0x362b('0x57')]['id']},'order':_0x362b('0x89')});});}})[_0x362b('0x3a')](respondWithResult(_0x34a213,null))[_0x362b('0x2e')](handleError(_0x34a213,null));};exports['getApplications']=function(_0x4d2145,_0x40d269,_0xfa4673){var _0x55e4be={};var _0x3ceb77={};var _0x155e9d;var _0x2abfa0;return db[_0x362b('0x41')][_0x362b('0x68')]({'where':{'id':_0x4d2145[_0x362b('0x57')]['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x40d269,null))['then'](function(_0x2b2386){if(_0x2b2386){_0x155e9d=_0x2b2386;_0x3ceb77['model']=_[_0x362b('0x58')](db[_0x362b('0xa3')][_0x362b('0x42')]);_0x3ceb77[_0x362b('0x46')]=_[_0x362b('0x58')](_0x4d2145[_0x362b('0x46')]);_0x3ceb77[_0x362b('0x47')]=_[_0x362b('0x48')](_0x3ceb77[_0x362b('0x44')],_0x3ceb77[_0x362b('0x46')]);_0x55e4be['attributes']=_[_0x362b('0x48')](_0x3ceb77[_0x362b('0x44')],qs[_0x362b('0x59')](_0x4d2145[_0x362b('0x46')][_0x362b('0x59')]));_0x55e4be[_0x362b('0x49')]=_0x55e4be[_0x362b('0x49')][_0x362b('0x4a')]?_0x55e4be[_0x362b('0x49')]:_0x3ceb77[_0x362b('0x44')];_0x55e4be[_0x362b('0x6a')]=qs[_0x362b('0x4d')](_0x4d2145[_0x362b('0x46')]['sort']);_0x55e4be[_0x362b('0x4e')]=qs[_0x362b('0x47')](_[_0x362b('0x4f')](_0x4d2145[_0x362b('0x46')],_0x3ceb77['filters']));if(_0x4d2145[_0x362b('0x46')]['filter']){_0x55e4be[_0x362b('0x4e')]=_[_0x362b('0x52')](_0x55e4be['where'],{'$or':_['map'](_0x55e4be['attributes'],function(_0xafe935){var _0x5c1eff={};_0x5c1eff[_0xafe935]={'$like':'%'+_0x4d2145[_0x362b('0x46')][_0x362b('0x50')]+'%'};return _0x5c1eff;})});}_0x55e4be=_[_0x362b('0x52')]({},_0x55e4be,_0x4d2145[_0x362b('0x53')]);return _0x155e9d[_0x362b('0xa6')](_0x55e4be);}})[_0x362b('0x3a')](function(_0x2ac0c1){if(_0x2ac0c1){_0x2abfa0=_0x2ac0c1['length'];if(!_0x4d2145[_0x362b('0x46')][_0x362b('0x4b')](_0x362b('0x4c'))){_0x55e4be[_0x362b('0x33')]=qs[_0x362b('0x33')](_0x4d2145[_0x362b('0x46')][_0x362b('0x33')]);_0x55e4be[_0x362b('0x31')]=qs[_0x362b('0x31')](_0x4d2145[_0x362b('0x46')][_0x362b('0x31')]);}return _0x155e9d[_0x362b('0xa6')](_0x55e4be);}})[_0x362b('0x3a')](function(_0x19f349){if(_0x19f349){return _0x19f349?{'count':_0x2abfa0,'rows':_0x19f349}:null;}})[_0x362b('0x3a')](respondWithResult(_0x40d269,null))[_0x362b('0x2e')](handleError(_0x40d269,null));};exports[_0x362b('0xa7')]=function(_0x3faf62,_0x2e33fb,_0x330c1c){var _0x2f1514={'raw':![],'where':{}};var _0x1c6d9e={};var _0x2d4179={'count':0x0,'rows':[]};return db[_0x362b('0x41')][_0x362b('0x68')]({'where':{'id':_0x3faf62[_0x362b('0x57')]['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x2e33fb,null))[_0x362b('0x3a')](function(_0x26cb63){if(_0x26cb63){_0x1c6d9e[_0x362b('0x44')]=_[_0x362b('0x58')](db['OpenchannelInteraction'][_0x362b('0x42')]);_0x1c6d9e[_0x362b('0x46')]=_[_0x362b('0x58')](_0x3faf62[_0x362b('0x46')]);_0x1c6d9e['filters']=_[_0x362b('0x48')](_0x1c6d9e[_0x362b('0x44')],_0x1c6d9e[_0x362b('0x46')]);_0x2f1514[_0x362b('0x49')]=_['intersection'](_0x1c6d9e[_0x362b('0x44')],qs['fields'](_0x3faf62['query']['fields']));_0x2f1514[_0x362b('0x49')]=_0x2f1514[_0x362b('0x49')]['length']?_0x2f1514['attributes']:_0x1c6d9e['model'];if(!_0x3faf62[_0x362b('0x46')][_0x362b('0x4b')](_0x362b('0x4c'))){_0x2f1514[_0x362b('0x33')]=qs[_0x362b('0x33')](_0x3faf62[_0x362b('0x46')]['limit']);_0x2f1514[_0x362b('0x31')]=qs['offset'](_0x3faf62[_0x362b('0x46')][_0x362b('0x31')]);}_0x2f1514['order']=qs[_0x362b('0x4d')](_0x3faf62[_0x362b('0x46')]['sort']);_0x2f1514[_0x362b('0x4e')]=qs[_0x362b('0x47')](_[_0x362b('0x4f')](_0x3faf62[_0x362b('0x46')],_0x1c6d9e['filters']));_0x2f1514[_0x362b('0x4e')]['OpenchannelAccountId']=_0x26cb63['id'];if(_0x3faf62['query'][_0x362b('0x50')]){_0x2f1514[_0x362b('0x4e')]=_[_0x362b('0x52')](_0x2f1514[_0x362b('0x4e')],{'$or':_['map'](_0x2f1514[_0x362b('0x49')],function(_0x9d1d48){var _0x5cf693={};_0x5cf693[_0x9d1d48]={'$like':'%'+_0x3faf62[_0x362b('0x46')][_0x362b('0x50')]+'%'};return _0x5cf693;})});}_0x2f1514=_[_0x362b('0x52')]({},_0x2f1514,_0x3faf62[_0x362b('0x53')]);return db[_0x362b('0x8f')][_0x362b('0x34')]({'where':_0x2f1514['where']})[_0x362b('0x3a')](function(_0x118375){_0x2d4179['count']=_0x118375;if(_0x3faf62[_0x362b('0x46')]['includeAll']){_0x2f1514['include']=[{'model':db[_0x362b('0x81')],'as':_0x362b('0xa8'),'required':![]},{'model':db[_0x362b('0x99')],'as':_0x362b('0xa9'),'attributes':[_0x362b('0x3d'),_0x362b('0xaa'),'internal'],'required':![]},{'model':db[_0x362b('0xab')],'as':_0x362b('0xac'),'attributes':['id','name',_0x362b('0xad')],'where':_0x3faf62[_0x362b('0x46')][_0x362b('0xae')]?{'id':_0x3faf62[_0x362b('0x46')][_0x362b('0xae')]}:undefined,'required':_0x3faf62[_0x362b('0x46')]['tag']?!![]:![]}];}return db[_0x362b('0x8f')][_0x362b('0x55')](_0x2f1514);})[_0x362b('0x3a')](function(_0x3fb574){_0x2d4179['rows']=_0x3fb574;return _0x2d4179;});}})[_0x362b('0x3a')](respondWithFilteredResult(_0x2e33fb,_0x2f1514))[_0x362b('0x2e')](handleError(_0x2e33fb,null));};exports[_0x362b('0xaf')]=function(_0x5d376e,_0x30fcd8,_0xa3a3cd){return db[_0x362b('0x41')][_0x362b('0x5b')]({'where':{'id':_0x5d376e[_0x362b('0x57')]['id']}})['then'](handleEntityNotFound(_0x30fcd8,null))[_0x362b('0x3a')](function(_0x538daa){if(_0x538daa){return _0x538daa[_0x362b('0xaf')](_0x5d376e[_0x362b('0x5d')][_0x362b('0x6c')],_[_0x362b('0xb0')](_0x5d376e[_0x362b('0x5d')],[_0x362b('0x6c'),'id'])||{})[_0x362b('0xb1')](function(_0x570b0a){for(var _0x14a286=0x0;_0x14a286<_0x5d376e[_0x362b('0x5d')][_0x362b('0x6c')][_0x362b('0x4a')];_0x14a286+=0x1){socket[_0x362b('0xb2')]('userOpenchannelAccount:save',{'UserId':Number(_0x5d376e[_0x362b('0x5d')][_0x362b('0x6c')][_0x14a286]),'OpenchannelAccountId':Number(_0x5d376e[_0x362b('0x57')]['id'])});}return _0x570b0a;});}})[_0x362b('0x3a')](respondWithResult(_0x30fcd8,null))[_0x362b('0x2e')](handleError(_0x30fcd8,null));};exports['removeAgents']=function(_0x4b38d7,_0x330faa,_0xace1f9){return db['OpenchannelAccount']['find']({'where':{'id':_0x4b38d7[_0x362b('0x57')]['id']}})['then'](handleEntityNotFound(_0x330faa,null))[_0x362b('0x3a')](function(_0x2ab6cc){if(_0x2ab6cc){return _0x2ab6cc['removeAgents'](_0x4b38d7[_0x362b('0x46')]['ids'])[_0x362b('0x3a')](function(){if(_[_0x362b('0xb3')](_0x4b38d7[_0x362b('0x46')][_0x362b('0x6c')])){for(var _0x392ed8=0x0;_0x392ed8<_0x4b38d7['query']['ids'][_0x362b('0x4a')];_0x392ed8+=0x1){socket[_0x362b('0xb2')](_0x362b('0xb4'),{'UserId':Number(_0x4b38d7[_0x362b('0x46')][_0x362b('0x6c')][_0x392ed8]),'OpenchannelAccountId':Number(_0x4b38d7[_0x362b('0x57')]['id'])});}}else{socket[_0x362b('0xb2')](_0x362b('0xb4'),{'UserId':Number(_0x4b38d7[_0x362b('0x46')]['ids']),'OpenchannelAccountId':Number(_0x4b38d7[_0x362b('0x57')]['id'])});}});}})[_0x362b('0x3a')](respondWithStatusCode(_0x330faa,null))[_0x362b('0x2e')](handleError(_0x330faa,null));};exports['getAgents']=function(_0x1279e5,_0x12a04a,_0x55f49a){var _0x2c5ffb={};var _0x3e3e11={};var _0x549f05;var _0x33bf64;return db['OpenchannelAccount'][_0x362b('0x68')]({'where':{'id':_0x1279e5['params']['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x12a04a,null))['then'](function(_0x2cd252){if(_0x2cd252){_0x549f05=_0x2cd252;_0x3e3e11[_0x362b('0x44')]=_['keys'](db['User'][_0x362b('0x42')]);_0x3e3e11[_0x362b('0x46')]=_[_0x362b('0x58')](_0x1279e5[_0x362b('0x46')]);_0x3e3e11[_0x362b('0x47')]=_['intersection'](_0x3e3e11[_0x362b('0x44')],_0x3e3e11['query']);_0x2c5ffb[_0x362b('0x49')]=_[_0x362b('0x48')](_0x3e3e11['model'],qs['fields'](_0x1279e5[_0x362b('0x46')][_0x362b('0x59')]));_0x2c5ffb[_0x362b('0x49')]=_0x2c5ffb['attributes']['length']?_0x2c5ffb[_0x362b('0x49')]:_0x3e3e11[_0x362b('0x44')];_0x2c5ffb['order']=qs[_0x362b('0x4d')](_0x1279e5['query']['sort']);_0x2c5ffb[_0x362b('0x4e')]=qs[_0x362b('0x47')](_[_0x362b('0x4f')](_0x1279e5[_0x362b('0x46')],_0x3e3e11[_0x362b('0x47')]));if(_0x1279e5[_0x362b('0x46')][_0x362b('0x50')]){_0x2c5ffb[_0x362b('0x4e')]=_[_0x362b('0x52')](_0x2c5ffb[_0x362b('0x4e')],{'$or':_[_0x362b('0x45')](_0x2c5ffb[_0x362b('0x49')],function(_0x4a2144){var _0x478d98={};_0x478d98[_0x4a2144]={'$like':'%'+_0x1279e5[_0x362b('0x46')]['filter']+'%'};return _0x478d98;})});}_0x2c5ffb=_['merge']({},_0x2c5ffb,_0x1279e5[_0x362b('0x53')]);return _0x549f05[_0x362b('0xb5')](_0x2c5ffb);}})[_0x362b('0x3a')](function(_0x43c2eb){if(_0x43c2eb){_0x33bf64=_0x43c2eb[_0x362b('0x4a')];if(!_0x1279e5[_0x362b('0x46')][_0x362b('0x4b')](_0x362b('0x4c'))){_0x2c5ffb[_0x362b('0x33')]=qs['limit'](_0x1279e5['query']['limit']);_0x2c5ffb[_0x362b('0x31')]=qs[_0x362b('0x31')](_0x1279e5[_0x362b('0x46')][_0x362b('0x31')]);}return _0x549f05[_0x362b('0xb5')](_0x2c5ffb);}})['then'](function(_0x15c99c){if(_0x15c99c){return _0x15c99c?{'count':_0x33bf64,'rows':_0x15c99c}:null;}})[_0x362b('0x3a')](respondWithResult(_0x12a04a,null))[_0x362b('0x2e')](handleError(_0x12a04a,null));};exports[_0x362b('0xb6')]=function(_0x22ccdf,_0x1f9be8,_0x1cb893){var _0x2b4af4,_0x2205e8,_0x433e55;if(_[_0x362b('0x78')](_0x22ccdf['body']['body'])||_0x22ccdf[_0x362b('0x5d')]['body']===''){throw new db['Sequelize'][(_0x362b('0x73'))](_0x362b('0x7c'));}if(_[_0x362b('0x78')](_0x22ccdf[_0x362b('0x5d')]['to'])){}_0x2b4af4=_0x22ccdf['body']['to'];return db['OpenchannelAccount'][_0x362b('0x68')]({'where':{'id':_0x22ccdf[_0x362b('0x57')]['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x1f9be8,null))[_0x362b('0x3a')](function(_0x4ebf12){if(_0x4ebf12){return db[_0x362b('0x41')][_0x362b('0x5b')]({'where':{'id':_0x4ebf12['id']},'include':[{'model':db[_0x362b('0xb7')],'as':'List','include':[{'model':db['CmContact'],'as':_0x362b('0x82'),'where':{[_0x4ebf12[_0x362b('0x7e')]]:_0x2b4af4},'limit':0x1,'order':[['updatedAt',_0x362b('0x83')]]}]}]})[_0x362b('0x3a')](handleEntityNotFound(_0x1f9be8,null))['then'](function(_0x4eb18c){if(_0x4eb18c&&_0x4eb18c['List']){_0x2205e8=_0x4eb18c['get']({'plain':!![]});if(_0x2205e8[_0x362b('0x80')]&&_0x2205e8['List']['Contacts'][_0x362b('0x4a')]){return _0x2205e8['List']['Contacts'][0x0];}return db[_0x362b('0x81')][_0x362b('0x5c')](_[_0x362b('0x1b')](_0x22ccdf[_0x362b('0x5d')],{'firstName':_0x2b4af4,[_0x4eb18c['mapKey']]:_0x2b4af4,'phone':_0x2b4af4,'ListId':_0x2205e8[_0x362b('0x77')]}));}})[_0x362b('0x3a')](handleEntityNotFound(_0x1f9be8,null))['then'](function(_0x41a56){if(_0x41a56){_0x433e55=_0x41a56;return db[_0x362b('0x8f')][_0x362b('0x5b')]({'where':{'ContactId':_0x433e55['id'],'closed':![],'OpenchannelAccountId':_0x2205e8['id']}})[_0x362b('0x3a')](function(_0x143452){if(_0x143452){return[_0x143452,![]];}return db[_0x362b('0x8f')][_0x362b('0x5c')]({'UserId':_0x22ccdf[_0x362b('0x5e')]['id'],'ContactId':_0x433e55['id'],'OpenchannelAccountId':_0x2205e8['id'],'lastMsgDirection':_0x362b('0xb8'),'Messages':[_[_0x362b('0x52')](_0x22ccdf[_0x362b('0x5d')],{'read':![],'body':_0x22ccdf[_0x362b('0x5d')][_0x362b('0x5d')],'OpenchannelAccountId':_0x2205e8['id'],'UserId':_0x22ccdf['user']['id'],'ContactId':_0x433e55['id']})]},{'include':[{'model':db[_0x362b('0x96')],'as':_0x362b('0xb9')}]})[_0x362b('0x3a')](function(_0x3f3862){return[_0x3f3862,!![]];});});}})[_0x362b('0xb1')](function(_0x4d1771,_0x3bd928){if(_0x3bd928){return _0x4d1771;}return db[_0x362b('0x96')][_0x362b('0x5c')](_[_0x362b('0x52')](_0x22ccdf[_0x362b('0x5d')],{'read':![],'body':_0x22ccdf[_0x362b('0x5d')]['body'],'OpenchannelAccountId':_0x2205e8['id'],'OpenchannelInteractionId':_0x4d1771['id'],'UserId':_0x22ccdf[_0x362b('0x5e')]['id'],'ContactId':_0x433e55['id']}))[_0x362b('0x3a')](function(_0x13ab49){_0x4d1771[_0x362b('0xba')][_0x362b('0xb9')]=[];_0x4d1771[_0x362b('0xba')]['Messages'][_0x362b('0xbb')](_0x13ab49['dataValues']);return _0x4d1771;});});}})[_0x362b('0x3a')](respondWithResult(_0x1f9be8,null))[_0x362b('0x2e')](handleError(_0x1f9be8,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index ef55937..f239984 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 _0x4483=['../../mysqldb','OpenchannelAccount','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4483,0x1a3));var _0x3448=function(_0xe716a4,_0xb96909){_0xe716a4=_0xe716a4-0x0;var _0x262332=_0x4483[_0xe716a4];return _0x262332;};'use strict';var EventEmitter=require(_0x3448('0x0'));var OpenchannelAccount=require(_0x3448('0x1'))['db'][_0x3448('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3448('0x3'),'afterUpdate':_0x3448('0x4'),'afterDestroy':_0x3448('0x5')};function emitEvent(_0x3a7178){return function(_0xef1a93,_0x5f5163,_0xeb5b8){OpenchannelAccountEvents[_0x3448('0x6')](_0x3a7178+':'+_0xef1a93['id'],_0xef1a93);OpenchannelAccountEvents[_0x3448('0x6')](_0x3a7178,_0xef1a93);_0xeb5b8(null);};}for(var e in events){if(events[_0x3448('0x7')](e)){var event=events[e];OpenchannelAccount[_0x3448('0x8')](e,emitEvent(event));}}module[_0x3448('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x750a=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x469f97,_0x1d2bd0){var _0x557d30=function(_0xe4d2a5){while(--_0xe4d2a5){_0x469f97['push'](_0x469f97['shift']());}};_0x557d30(++_0x1d2bd0);}(_0x750a,0x140));var _0xa750=function(_0x4cdb27,_0x2a6406){_0x4cdb27=_0x4cdb27-0x0;var _0x1a17aa=_0x750a[_0x4cdb27];return _0x1a17aa;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xa750('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa750('0x1'),'afterUpdate':_0xa750('0x2'),'afterDestroy':_0xa750('0x3')};function emitEvent(_0x19bd5f){return function(_0x457cae,_0x43d704,_0x562911){OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f+':'+_0x457cae['id'],_0x457cae);OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f,_0x457cae);_0x562911(null);};}for(var e in events){if(events[_0xa750('0x5')](e)){var event=events[e];OpenchannelAccount[_0xa750('0x6')](e,emitEvent(event));}}module[_0xa750('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 8b67d5d..c87a14a 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(_0x39f311,_0x5a3c72){var _0x2e9358=function(_0x43d1af){while(--_0x43d1af){_0x39f311['push'](_0x39f311['shift']());}};_0x2e9358(++_0x5a3c72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x4e0951,_0x394141){var _0x5d2567=function(_0x20ca59){while(--_0x20ca59){_0x4e0951['push'](_0x4e0951['shift']());}};_0x5d2567(++_0x394141);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 b7bec3a..0fd3de6 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 _0xc29b=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x432e48,_0x5f1404){var _0x26e67a=function(_0x53a7b4){while(--_0x53a7b4){_0x432e48['push'](_0x432e48['shift']());}};_0x26e67a(++_0x5f1404);}(_0xc29b,0x12d));var _0xbc29=function(_0x21ce62,_0x5d6a0f){_0x21ce62=_0x21ce62-0x0;var _0xa4508a=_0xc29b[_0x21ce62];return _0xa4508a;};'use strict';var _=require(_0xbc29('0x0'));var util=require(_0xbc29('0x1'));var moment=require(_0xbc29('0x2'));var BPromise=require('bluebird');var rs=require(_0xbc29('0x3'));var fs=require('fs');var Redis=require(_0xbc29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc29('0x5'));var logger=require(_0xbc29('0x6'))(_0xbc29('0x7'));var config=require(_0xbc29('0x8'));var jayson=require(_0xbc29('0x9'));var client=jayson[_0xbc29('0xa')][_0xbc29('0xb')]({'port':0x232a});config[_0xbc29('0xc')]=_[_0xbc29('0xd')](config[_0xbc29('0xc')],{'host':_0xbc29('0xe'),'port':0x18eb});var socket=require(_0xbc29('0xf'))(new Redis(config[_0xbc29('0xc')]));require(_0xbc29('0x10'))[_0xbc29('0x11')](socket);function respondWithRpcPromise(_0x36d1e3,_0x13a581,_0x2f591c){return new BPromise(function(_0x35ece9,_0x2710ad){return client['request'](_0x36d1e3,_0x2f591c)[_0xbc29('0x12')](function(_0x888953){logger[_0xbc29('0x13')](_0xbc29('0x14'),_0x13a581,_0xbc29('0x15'));logger[_0xbc29('0x16')](_0xbc29('0x17'),_0x13a581,'request\x20sent',JSON[_0xbc29('0x18')](_0x888953));if(_0x888953[_0xbc29('0x19')]){if(_0x888953[_0xbc29('0x19')]['code']===0x1f4){logger['error'](_0xbc29('0x14'),_0x13a581,_0x888953['error'][_0xbc29('0x1a')]);return _0x2710ad(_0x888953[_0xbc29('0x19')][_0xbc29('0x1a')]);}logger['error'](_0xbc29('0x14'),_0x13a581,_0x888953['error'][_0xbc29('0x1a')]);return _0x35ece9(_0x888953[_0xbc29('0x19')][_0xbc29('0x1a')]);}else{logger[_0xbc29('0x13')](_0xbc29('0x14'),_0x13a581,_0xbc29('0x15'));_0x35ece9(_0x888953['result'][_0xbc29('0x1a')]);}})[_0xbc29('0x1b')](function(_0x4eadbe){logger['error'](_0xbc29('0x14'),_0x13a581,_0x4eadbe);_0x2710ad(_0x4eadbe);});});} \ No newline at end of file +var _0x9d5b=['register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./openchannelAccount.socket'];(function(_0x2855f3,_0x1f19db){var _0x562e6a=function(_0x55a4b1){while(--_0x55a4b1){_0x2855f3['push'](_0x2855f3['shift']());}};_0x562e6a(++_0x1f19db);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x3aff82,_0x28e6af){_0x3aff82=_0x3aff82-0x0;var _0x2f7576=_0x9d5b[_0x3aff82];return _0x2f7576;};'use strict';var _=require('lodash');var util=require(_0xb9d5('0x0'));var moment=require(_0xb9d5('0x1'));var BPromise=require(_0xb9d5('0x2'));var rs=require(_0xb9d5('0x3'));var fs=require('fs');var Redis=require(_0xb9d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9d5('0x5'));var logger=require('../../config/logger')(_0xb9d5('0x6'));var config=require(_0xb9d5('0x7'));var jayson=require(_0xb9d5('0x8'));var client=jayson[_0xb9d5('0x9')][_0xb9d5('0xa')]({'port':0x232a});config['redis']=_[_0xb9d5('0xb')](config[_0xb9d5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb9d5('0xd'))(new Redis(config[_0xb9d5('0xc')]));require(_0xb9d5('0xe'))[_0xb9d5('0xf')](socket);function respondWithRpcPromise(_0x5d0fc6,_0x1aec1b,_0x1ae073){return new BPromise(function(_0x4c1ce3,_0x35d69f){return client[_0xb9d5('0x10')](_0x5d0fc6,_0x1ae073)[_0xb9d5('0x11')](function(_0x422b36){logger[_0xb9d5('0x12')](_0xb9d5('0x13'),_0x1aec1b,_0xb9d5('0x14'));logger[_0xb9d5('0x15')](_0xb9d5('0x16'),_0x1aec1b,_0xb9d5('0x14'),JSON[_0xb9d5('0x17')](_0x422b36));if(_0x422b36['error']){if(_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x19')]===0x1f4){logger['error'](_0xb9d5('0x13'),_0x1aec1b,_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x1a')]);return _0x35d69f(_0x422b36['error'][_0xb9d5('0x1a')]);}logger[_0xb9d5('0x18')](_0xb9d5('0x13'),_0x1aec1b,_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x1a')]);return _0x4c1ce3(_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x1a')]);}else{logger[_0xb9d5('0x12')](_0xb9d5('0x13'),_0x1aec1b,_0xb9d5('0x14'));_0x4c1ce3(_0x422b36[_0xb9d5('0x1b')][_0xb9d5('0x1a')]);}})[_0xb9d5('0x1c')](function(_0x171487){logger['error'](_0xb9d5('0x13'),_0x1aec1b,_0x171487);_0x35d69f(_0x171487);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index b585982..a37abf4 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 _0xf109=['remove','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf109,0xce));var _0x9f10=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xf109[_0x178e48];return _0x440d7e;};'use strict';var OpenchannelAccountEvents=require(_0x9f10('0x0'));var events=[_0x9f10('0x1'),_0x9f10('0x2'),'update'];function createListener(_0x5b381d,_0x4cbc7a){return function(_0x3659ce){_0x4cbc7a[_0x9f10('0x3')](_0x5b381d,_0x3659ce);};}function removeListener(_0x74d0ee,_0x26f01c){return function(){OpenchannelAccountEvents[_0x9f10('0x4')](_0x74d0ee,_0x26f01c);};}exports[_0x9f10('0x5')]=function(_0x408fe8){for(var _0xd3137b=0x0,_0x227a29=events[_0x9f10('0x6')];_0xd3137b<_0x227a29;_0xd3137b++){var _0x3fd82f=events[_0xd3137b];var _0x5c8719=createListener(_0x9f10('0x7')+_0x3fd82f,_0x408fe8);OpenchannelAccountEvents['on'](_0x3fd82f,_0x5c8719);}}; \ No newline at end of file +var _0x795a=['save','remove','emit','removeListener','register','length'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0x795a,0xa2));var _0xa795=function(_0x1691de,_0x285686){_0x1691de=_0x1691de-0x0;var _0x8611ac=_0x795a[_0x1691de];return _0x8611ac;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xa795('0x0'),_0xa795('0x1'),'update'];function createListener(_0x285f44,_0x4e8f61){return function(_0x237618){_0x4e8f61[_0xa795('0x2')](_0x285f44,_0x237618);};}function removeListener(_0x4ce3a0,_0x4f7e4e){return function(){OpenchannelAccountEvents[_0xa795('0x3')](_0x4ce3a0,_0x4f7e4e);};}exports[_0xa795('0x4')]=function(_0x26a4f2){for(var _0x2efc9b=0x0,_0x553cf3=events[_0xa795('0x5')];_0x2efc9b<_0x553cf3;_0x2efc9b++){var _0x58d69c=events[_0x2efc9b];var _0x36a3a9=createListener('openchannelAccount:'+_0x58d69c,_0x26a4f2);OpenchannelAccountEvents['on'](_0x58d69c,_0x36a3a9);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index b2af962..e2e0657 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 _0x8134=['/:id','show','create','put','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x8134,0xb6));var _0x4813=function(_0xb27302,_0x280ed8){_0xb27302=_0xb27302-0x0;var _0x43e8c9=_0x8134[_0xb27302];return _0x43e8c9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4813('0x0'));var timeout=require(_0x4813('0x1'));var express=require(_0x4813('0x2'));var router=express['Router']();var fs_extra=require(_0x4813('0x3'));var auth=require(_0x4813('0x4'));var interaction=require(_0x4813('0x5'));var config=require(_0x4813('0x6'));var controller=require(_0x4813('0x7'));router['get']('/',auth[_0x4813('0x8')](),controller[_0x4813('0x9')]);router['get'](_0x4813('0xa'),auth[_0x4813('0x8')](),controller[_0x4813('0xb')]);router['post']('/',auth[_0x4813('0x8')](),controller[_0x4813('0xc')]);router[_0x4813('0xd')](_0x4813('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4813('0xa'),auth[_0x4813('0x8')](),controller[_0x4813('0xe')]);module[_0x4813('0xf')]=router; \ No newline at end of file +var _0xa07f=['multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','isAuthenticated','show','create','/:id','update','delete','destroy','exports'];(function(_0x5cdd3b,_0xfda807){var _0x53d8e7=function(_0x5d7f01){while(--_0x5d7f01){_0x5cdd3b['push'](_0x5cdd3b['shift']());}};_0x53d8e7(++_0xfda807);}(_0xa07f,0x1b0));var _0xfa07=function(_0x16c598,_0x1ab9bb){_0x16c598=_0x16c598-0x0;var _0x2013b8=_0xa07f[_0x16c598];return _0x2013b8;};'use strict';var multer=require(_0xfa07('0x0'));var util=require(_0xfa07('0x1'));var path=require(_0xfa07('0x2'));var timeout=require(_0xfa07('0x3'));var express=require('express');var router=express[_0xfa07('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfa07('0x5'));var config=require(_0xfa07('0x6'));var controller=require(_0xfa07('0x7'));router[_0xfa07('0x8')]('/',auth['isAuthenticated'](),controller[_0xfa07('0x9')]);router[_0xfa07('0x8')]('/:id',auth[_0xfa07('0xa')](),controller[_0xfa07('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfa07('0xc')]);router['put'](_0xfa07('0xd'),auth[_0xfa07('0xa')](),controller[_0xfa07('0xe')]);router[_0xfa07('0xf')](_0xfa07('0xd'),auth[_0xfa07('0xa')](),controller[_0xfa07('0x10')]);module[_0xfa07('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index a7444e1..15d31a0 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 _0x7645=['sequelize','STRING','noop','TEXT','*,*,*,*'];(function(_0x2458da,_0x134760){var _0x17c06b=function(_0xc689b3){while(--_0xc689b3){_0x2458da['push'](_0x2458da['shift']());}};_0x17c06b(++_0x134760);}(_0x7645,0x13b));var _0x5764=function(_0x1eb81d,_0x257dfd){_0x1eb81d=_0x1eb81d-0x0;var _0x5566ae=_0x7645[_0x1eb81d];return _0x5566ae;};'use strict';var Sequelize=require(_0x5764('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5764('0x1')],'allowNull':![],'defaultValue':_0x5764('0x2')},'appdata':{'type':Sequelize[_0x5764('0x3')]()},'description':{'type':Sequelize[_0x5764('0x1')]},'interval':{'type':Sequelize[_0x5764('0x1')],'defaultValue':_0x5764('0x4')}}; \ No newline at end of file +var _0xeeb4=['STRING','sequelize','noop','TEXT'];(function(_0x2839a5,_0x1c13cc){var _0x5ee410=function(_0x26947b){while(--_0x26947b){_0x2839a5['push'](_0x2839a5['shift']());}};_0x5ee410(++_0x1c13cc);}(_0xeeb4,0x125));var _0x4eeb=function(_0x5b3f61,_0x5bdade){_0x5b3f61=_0x5b3f61-0x0;var _0x246e19=_0xeeb4[_0x5b3f61];return _0x246e19;};'use strict';var Sequelize=require(_0x4eeb('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4eeb('0x1')},'appdata':{'type':Sequelize[_0x4eeb('0x2')]()},'description':{'type':Sequelize[_0x4eeb('0x3')]},'interval':{'type':Sequelize[_0x4eeb('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 3388c59..b9be730 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 _0xa6ea=['order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','map','OpenchannelApplication','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit'];(function(_0xdc3756,_0x12752e){var _0x3047ec=function(_0x1e8ab7){while(--_0x1e8ab7){_0xdc3756['push'](_0xdc3756['shift']());}};_0x3047ec(++_0x12752e);}(_0xa6ea,0xa1));var _0xaa6e=function(_0x52687f,_0x42b4c2){_0x52687f=_0x52687f-0x0;var _0xad7571=_0xa6ea[_0x52687f];return _0xad7571;};'use strict';var emlformat=require(_0xaa6e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaa6e('0x1'));var jsonpatch=require(_0xaa6e('0x2'));var rp=require(_0xaa6e('0x3'));var moment=require('moment');var BPromise=require(_0xaa6e('0x4'));var Mustache=require(_0xaa6e('0x5'));var util=require(_0xaa6e('0x6'));var path=require(_0xaa6e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaa6e('0x8'));var fs=require('fs');var fs_extra=require(_0xaa6e('0x9'));var _=require(_0xaa6e('0xa'));var squel=require(_0xaa6e('0xb'));var crypto=require(_0xaa6e('0xc'));var jsforce=require(_0xaa6e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa6e('0xe'));var querystring=require(_0xaa6e('0xf'));var Papa=require('papaparse');var Redis=require(_0xaa6e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xaa6e('0x11'));var as=require(_0xaa6e('0x12'));var hardwareService=require(_0xaa6e('0x13'));var logger=require(_0xaa6e('0x14'))('api');var utils=require(_0xaa6e('0x15'));var config=require(_0xaa6e('0x16'));var licenseUtil=require(_0xaa6e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a7fe9,_0x240af5){_0x240af5=_0x240af5||0xcc;return function(_0x1b34e7){if(_0x1b34e7){return _0x1a7fe9['sendStatus'](_0x240af5);}return _0x1a7fe9['status'](_0x240af5)[_0xaa6e('0x18')]();};}function respondWithResult(_0x2c6d26,_0x2dabf3){_0x2dabf3=_0x2dabf3||0xc8;return function(_0x38e6ba){if(_0x38e6ba){return _0x2c6d26[_0xaa6e('0x19')](_0x2dabf3)[_0xaa6e('0x1a')](_0x38e6ba);}};}function respondWithFilteredResult(_0x29ec5f,_0x396753){return function(_0x442bd7){if(_0x442bd7){var _0x23b074=typeof _0x396753[_0xaa6e('0x1b')]==='undefined'&&typeof _0x396753[_0xaa6e('0x1c')]===_0xaa6e('0x1d');var _0x254cff=_0x442bd7[_0xaa6e('0x1e')];var _0x419ecd=_0x23b074?0x0:_0x396753[_0xaa6e('0x1b')];var _0x43bb84=_0x23b074?_0x442bd7[_0xaa6e('0x1e')]:_0x396753[_0xaa6e('0x1b')]+_0x396753[_0xaa6e('0x1c')];var _0x41fc55;if(_0x43bb84>=_0x254cff){_0x43bb84=_0x254cff;_0x41fc55=0xc8;}else{_0x41fc55=0xce;}_0x29ec5f[_0xaa6e('0x19')](_0x41fc55);return _0x29ec5f[_0xaa6e('0x1f')]('Content-Range',_0x419ecd+'-'+_0x43bb84+'/'+_0x254cff)[_0xaa6e('0x1a')](_0x442bd7);}return null;};}function patchUpdates(_0x3f714b){return function(_0x59f401){try{jsonpatch[_0xaa6e('0x20')](_0x59f401,_0x3f714b,!![]);}catch(_0xc24892){return BPromise[_0xaa6e('0x21')](_0xc24892);}return _0x59f401[_0xaa6e('0x22')]();};}function saveUpdates(_0x476e97,_0x33bbcf){return function(_0x2362d8){if(_0x2362d8){return _0x2362d8['update'](_0x476e97)[_0xaa6e('0x23')](function(_0x495c35){return _0x495c35;});}return null;};}function removeEntity(_0x2e1f7c,_0x1e30ed){return function(_0x5a32ee){if(_0x5a32ee){return _0x5a32ee[_0xaa6e('0x24')]()['then'](function(){_0x2e1f7c[_0xaa6e('0x19')](0xcc)[_0xaa6e('0x18')]();});}};}function handleEntityNotFound(_0x4482bd,_0x209973){return function(_0x1dd90f){if(!_0x1dd90f){_0x4482bd[_0xaa6e('0x25')](0x194);}return _0x1dd90f;};}function handleError(_0x181140,_0x5e9f88){_0x5e9f88=_0x5e9f88||0x1f4;return function(_0x29437a){logger[_0xaa6e('0x26')](_0x29437a[_0xaa6e('0x27')]);if(_0x29437a['name']){delete _0x29437a[_0xaa6e('0x28')];}_0x181140[_0xaa6e('0x19')](_0x5e9f88)['send'](_0x29437a);};}exports[_0xaa6e('0x29')]=function(_0x2f5282,_0x38d9b8){var _0x5e80c4={},_0x5d771c={},_0x3675cd={'count':0x0,'rows':[]};var _0x2416b9=_[_0xaa6e('0x2a')](db[_0xaa6e('0x2b')][_0xaa6e('0x2c')],function(_0x20cacb){return{'name':_0x20cacb['fieldName'],'type':_0x20cacb[_0xaa6e('0x2d')][_0xaa6e('0x2e')]};});_0x5d771c['model']=_[_0xaa6e('0x2a')](_0x2416b9,_0xaa6e('0x28'));_0x5d771c[_0xaa6e('0x2f')]=_[_0xaa6e('0x30')](_0x2f5282[_0xaa6e('0x2f')]);_0x5d771c[_0xaa6e('0x31')]=_[_0xaa6e('0x32')](_0x5d771c['model'],_0x5d771c[_0xaa6e('0x2f')]);_0x5e80c4['attributes']=_['intersection'](_0x5d771c[_0xaa6e('0x33')],qs[_0xaa6e('0x34')](_0x2f5282['query']['fields']));_0x5e80c4['attributes']=_0x5e80c4['attributes']['length']?_0x5e80c4[_0xaa6e('0x35')]:_0x5d771c[_0xaa6e('0x33')];if(!_0x2f5282[_0xaa6e('0x2f')]['hasOwnProperty'](_0xaa6e('0x36'))){_0x5e80c4[_0xaa6e('0x1c')]=qs['limit'](_0x2f5282['query'][_0xaa6e('0x1c')]);_0x5e80c4[_0xaa6e('0x1b')]=qs[_0xaa6e('0x1b')](_0x2f5282['query'][_0xaa6e('0x1b')]);}_0x5e80c4[_0xaa6e('0x37')]=qs[_0xaa6e('0x38')](_0x2f5282[_0xaa6e('0x2f')][_0xaa6e('0x38')]);_0x5e80c4[_0xaa6e('0x39')]=qs[_0xaa6e('0x31')](_[_0xaa6e('0x3a')](_0x2f5282[_0xaa6e('0x2f')],_0x5d771c[_0xaa6e('0x31')]),_0x2416b9);if(_0x2f5282[_0xaa6e('0x2f')][_0xaa6e('0x3b')]){_0x5e80c4['where']=_[_0xaa6e('0x3c')](_0x5e80c4[_0xaa6e('0x39')],{'$or':_[_0xaa6e('0x2a')](_0x2416b9,function(_0x32006d){if(_0x32006d[_0xaa6e('0x2d')]!==_0xaa6e('0x3d')){var _0x15ca31={};_0x15ca31[_0x32006d[_0xaa6e('0x28')]]={'$like':'%'+_0x2f5282[_0xaa6e('0x2f')]['filter']+'%'};return _0x15ca31;}})});}_0x5e80c4=_[_0xaa6e('0x3c')]({},_0x5e80c4,_0x2f5282['options']);var _0x3edf82={'where':_0x5e80c4[_0xaa6e('0x39')]};return db[_0xaa6e('0x2b')][_0xaa6e('0x1e')](_0x3edf82)[_0xaa6e('0x23')](function(_0x4864a1){_0x3675cd[_0xaa6e('0x1e')]=_0x4864a1;if(_0x2f5282[_0xaa6e('0x2f')][_0xaa6e('0x3e')]){_0x5e80c4[_0xaa6e('0x3f')]=[{'all':!![]}];}return db[_0xaa6e('0x2b')]['findAll'](_0x5e80c4);})[_0xaa6e('0x23')](function(_0x4c929f){_0x3675cd[_0xaa6e('0x40')]=_0x4c929f;return _0x3675cd;})['then'](respondWithFilteredResult(_0x38d9b8,_0x5e80c4))[_0xaa6e('0x41')](handleError(_0x38d9b8,null));};exports[_0xaa6e('0x42')]=function(_0x1195bd,_0x50787e){var _0x57ed58={'raw':!![],'where':{'id':_0x1195bd[_0xaa6e('0x43')]['id']}},_0x40d3f2={};_0x40d3f2[_0xaa6e('0x33')]=_['keys'](db[_0xaa6e('0x2b')][_0xaa6e('0x2c')]);_0x40d3f2[_0xaa6e('0x2f')]=_[_0xaa6e('0x30')](_0x1195bd[_0xaa6e('0x2f')]);_0x40d3f2[_0xaa6e('0x31')]=_[_0xaa6e('0x32')](_0x40d3f2['model'],_0x40d3f2['query']);_0x57ed58['attributes']=_['intersection'](_0x40d3f2['model'],qs[_0xaa6e('0x34')](_0x1195bd[_0xaa6e('0x2f')][_0xaa6e('0x34')]));_0x57ed58[_0xaa6e('0x35')]=_0x57ed58[_0xaa6e('0x35')]['length']?_0x57ed58[_0xaa6e('0x35')]:_0x40d3f2[_0xaa6e('0x33')];if(_0x1195bd[_0xaa6e('0x2f')][_0xaa6e('0x3e')]){_0x57ed58[_0xaa6e('0x3f')]=[{'all':!![]}];}_0x57ed58=_[_0xaa6e('0x3c')]({},_0x57ed58,_0x1195bd[_0xaa6e('0x44')]);return db[_0xaa6e('0x2b')][_0xaa6e('0x45')](_0x57ed58)['then'](handleEntityNotFound(_0x50787e,null))[_0xaa6e('0x23')](respondWithResult(_0x50787e,null))[_0xaa6e('0x41')](handleError(_0x50787e,null));};exports[_0xaa6e('0x46')]=function(_0x84cb31,_0x439255){return db['OpenchannelApplication']['create'](_0x84cb31[_0xaa6e('0x47')],{})[_0xaa6e('0x23')](respondWithResult(_0x439255,0xc9))[_0xaa6e('0x41')](handleError(_0x439255,null));};exports['update']=function(_0x1f8aa9,_0x4d74ad){if(_0x1f8aa9[_0xaa6e('0x47')]['id']){delete _0x1f8aa9[_0xaa6e('0x47')]['id'];}return db[_0xaa6e('0x2b')]['find']({'where':{'id':_0x1f8aa9[_0xaa6e('0x43')]['id']}})[_0xaa6e('0x23')](handleEntityNotFound(_0x4d74ad,null))['then'](saveUpdates(_0x1f8aa9[_0xaa6e('0x47')],null))[_0xaa6e('0x23')](respondWithResult(_0x4d74ad,null))[_0xaa6e('0x41')](handleError(_0x4d74ad,null));};exports[_0xaa6e('0x24')]=function(_0x5e89bc,_0xadd9e0){return db['OpenchannelApplication'][_0xaa6e('0x45')]({'where':{'id':_0x5e89bc[_0xaa6e('0x43')]['id']}})['then'](handleEntityNotFound(_0xadd9e0,null))[_0xaa6e('0x23')](removeEntity(_0xadd9e0,null))[_0xaa6e('0x41')](handleError(_0xadd9e0,null));}; \ No newline at end of file +var _0xc153=['includeAll','findAll','rows','catch','show','params','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x5cbaaf,_0x299426){var _0x246e96=function(_0x4fc39c){while(--_0x4fc39c){_0x5cbaaf['push'](_0x5cbaaf['shift']());}};_0x246e96(++_0x299426);}(_0xc153,0x17c));var _0x3c15=function(_0x515aa,_0x57cedb){_0x515aa=_0x515aa-0x0;var _0x5476e2=_0xc153[_0x515aa];return _0x5476e2;};'use strict';var emlformat=require(_0x3c15('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3c15('0x1'));var jsonpatch=require(_0x3c15('0x2'));var rp=require(_0x3c15('0x3'));var moment=require('moment');var BPromise=require(_0x3c15('0x4'));var Mustache=require(_0x3c15('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3c15('0x6'));var csv=require(_0x3c15('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c15('0x8'));var _=require(_0x3c15('0x9'));var squel=require('squel');var crypto=require(_0x3c15('0xa'));var jsforce=require(_0x3c15('0xb'));var deskjs=require(_0x3c15('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3c15('0xd'));var Papa=require(_0x3c15('0xe'));var Redis=require(_0x3c15('0xf'));var authService=require(_0x3c15('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3c15('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c15('0x12'))(_0x3c15('0x13'));var utils=require(_0x3c15('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3c15('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8a0ec7,_0x2c1e42){_0x2c1e42=_0x2c1e42||0xcc;return function(_0x5cfe19){if(_0x5cfe19){return _0x8a0ec7[_0x3c15('0x16')](_0x2c1e42);}return _0x8a0ec7['status'](_0x2c1e42)['end']();};}function respondWithResult(_0x5ea38d,_0x2d897e){_0x2d897e=_0x2d897e||0xc8;return function(_0x5a213c){if(_0x5a213c){return _0x5ea38d[_0x3c15('0x17')](_0x2d897e)[_0x3c15('0x18')](_0x5a213c);}};}function respondWithFilteredResult(_0x22c4d5,_0x49df9a){return function(_0x426cf0){if(_0x426cf0){var _0x5403ca=typeof _0x49df9a[_0x3c15('0x19')]===_0x3c15('0x1a')&&typeof _0x49df9a[_0x3c15('0x1b')]===_0x3c15('0x1a');var _0x2e8ac3=_0x426cf0[_0x3c15('0x1c')];var _0x43e23e=_0x5403ca?0x0:_0x49df9a['offset'];var _0x3ab792=_0x5403ca?_0x426cf0['count']:_0x49df9a[_0x3c15('0x19')]+_0x49df9a[_0x3c15('0x1b')];var _0xea5a54;if(_0x3ab792>=_0x2e8ac3){_0x3ab792=_0x2e8ac3;_0xea5a54=0xc8;}else{_0xea5a54=0xce;}_0x22c4d5[_0x3c15('0x17')](_0xea5a54);return _0x22c4d5[_0x3c15('0x1d')](_0x3c15('0x1e'),_0x43e23e+'-'+_0x3ab792+'/'+_0x2e8ac3)[_0x3c15('0x18')](_0x426cf0);}return null;};}function patchUpdates(_0x209b96){return function(_0x18db8e){try{jsonpatch[_0x3c15('0x1f')](_0x18db8e,_0x209b96,!![]);}catch(_0x75386c){return BPromise[_0x3c15('0x20')](_0x75386c);}return _0x18db8e['save']();};}function saveUpdates(_0x3a7158,_0x4a91df){return function(_0x5f1c05){if(_0x5f1c05){return _0x5f1c05[_0x3c15('0x21')](_0x3a7158)[_0x3c15('0x22')](function(_0x71522c){return _0x71522c;});}return null;};}function removeEntity(_0x24a006,_0x3ab6d2){return function(_0x427f79){if(_0x427f79){return _0x427f79[_0x3c15('0x23')]()[_0x3c15('0x22')](function(){_0x24a006[_0x3c15('0x17')](0xcc)[_0x3c15('0x24')]();});}};}function handleEntityNotFound(_0x4dac96,_0x786c08){return function(_0x5ca2c5){if(!_0x5ca2c5){_0x4dac96[_0x3c15('0x16')](0x194);}return _0x5ca2c5;};}function handleError(_0x4d87cc,_0x2f6a7d){_0x2f6a7d=_0x2f6a7d||0x1f4;return function(_0x357a16){logger[_0x3c15('0x25')](_0x357a16[_0x3c15('0x26')]);if(_0x357a16[_0x3c15('0x27')]){delete _0x357a16[_0x3c15('0x27')];}_0x4d87cc['status'](_0x2f6a7d)[_0x3c15('0x28')](_0x357a16);};}exports[_0x3c15('0x29')]=function(_0x186b18,_0x472dc8){var _0x43f6cc={},_0x1e112a={},_0xc79ec3={'count':0x0,'rows':[]};var _0x1dc453=_[_0x3c15('0x2a')](db[_0x3c15('0x2b')][_0x3c15('0x2c')],function(_0x7879dc){return{'name':_0x7879dc[_0x3c15('0x2d')],'type':_0x7879dc[_0x3c15('0x2e')][_0x3c15('0x2f')]};});_0x1e112a[_0x3c15('0x30')]=_['map'](_0x1dc453,'name');_0x1e112a[_0x3c15('0x31')]=_[_0x3c15('0x32')](_0x186b18[_0x3c15('0x31')]);_0x1e112a[_0x3c15('0x33')]=_['intersection'](_0x1e112a[_0x3c15('0x30')],_0x1e112a[_0x3c15('0x31')]);_0x43f6cc[_0x3c15('0x34')]=_[_0x3c15('0x35')](_0x1e112a[_0x3c15('0x30')],qs[_0x3c15('0x36')](_0x186b18['query']['fields']));_0x43f6cc[_0x3c15('0x34')]=_0x43f6cc['attributes'][_0x3c15('0x37')]?_0x43f6cc[_0x3c15('0x34')]:_0x1e112a[_0x3c15('0x30')];if(!_0x186b18[_0x3c15('0x31')][_0x3c15('0x38')](_0x3c15('0x39'))){_0x43f6cc[_0x3c15('0x1b')]=qs[_0x3c15('0x1b')](_0x186b18[_0x3c15('0x31')]['limit']);_0x43f6cc[_0x3c15('0x19')]=qs['offset'](_0x186b18[_0x3c15('0x31')]['offset']);}_0x43f6cc['order']=qs[_0x3c15('0x3a')](_0x186b18[_0x3c15('0x31')][_0x3c15('0x3a')]);_0x43f6cc[_0x3c15('0x3b')]=qs[_0x3c15('0x33')](_[_0x3c15('0x3c')](_0x186b18['query'],_0x1e112a['filters']),_0x1dc453);if(_0x186b18[_0x3c15('0x31')][_0x3c15('0x3d')]){_0x43f6cc[_0x3c15('0x3b')]=_[_0x3c15('0x3e')](_0x43f6cc[_0x3c15('0x3b')],{'$or':_[_0x3c15('0x2a')](_0x1dc453,function(_0x2aca44){if(_0x2aca44[_0x3c15('0x2e')]!==_0x3c15('0x3f')){var _0x11c27d={};_0x11c27d[_0x2aca44['name']]={'$like':'%'+_0x186b18[_0x3c15('0x31')][_0x3c15('0x3d')]+'%'};return _0x11c27d;}})});}_0x43f6cc=_[_0x3c15('0x3e')]({},_0x43f6cc,_0x186b18['options']);var _0x55a9c6={'where':_0x43f6cc[_0x3c15('0x3b')]};return db[_0x3c15('0x2b')]['count'](_0x55a9c6)['then'](function(_0x29f659){_0xc79ec3[_0x3c15('0x1c')]=_0x29f659;if(_0x186b18[_0x3c15('0x31')][_0x3c15('0x40')]){_0x43f6cc['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x3c15('0x41')](_0x43f6cc);})['then'](function(_0x5260c7){_0xc79ec3[_0x3c15('0x42')]=_0x5260c7;return _0xc79ec3;})[_0x3c15('0x22')](respondWithFilteredResult(_0x472dc8,_0x43f6cc))[_0x3c15('0x43')](handleError(_0x472dc8,null));};exports[_0x3c15('0x44')]=function(_0x662ea6,_0x4d1218){var _0x17b2e3={'raw':!![],'where':{'id':_0x662ea6[_0x3c15('0x45')]['id']}},_0x52f4b6={};_0x52f4b6[_0x3c15('0x30')]=_['keys'](db[_0x3c15('0x2b')]['rawAttributes']);_0x52f4b6['query']=_[_0x3c15('0x32')](_0x662ea6[_0x3c15('0x31')]);_0x52f4b6[_0x3c15('0x33')]=_[_0x3c15('0x35')](_0x52f4b6['model'],_0x52f4b6[_0x3c15('0x31')]);_0x17b2e3[_0x3c15('0x34')]=_['intersection'](_0x52f4b6['model'],qs['fields'](_0x662ea6[_0x3c15('0x31')]['fields']));_0x17b2e3[_0x3c15('0x34')]=_0x17b2e3[_0x3c15('0x34')]['length']?_0x17b2e3[_0x3c15('0x34')]:_0x52f4b6['model'];if(_0x662ea6[_0x3c15('0x31')][_0x3c15('0x40')]){_0x17b2e3['include']=[{'all':!![]}];}_0x17b2e3=_[_0x3c15('0x3e')]({},_0x17b2e3,_0x662ea6[_0x3c15('0x46')]);return db[_0x3c15('0x2b')][_0x3c15('0x47')](_0x17b2e3)[_0x3c15('0x22')](handleEntityNotFound(_0x4d1218,null))[_0x3c15('0x22')](respondWithResult(_0x4d1218,null))[_0x3c15('0x43')](handleError(_0x4d1218,null));};exports['create']=function(_0x45dfc7,_0x543e3d){return db[_0x3c15('0x2b')][_0x3c15('0x48')](_0x45dfc7[_0x3c15('0x49')],{})['then'](respondWithResult(_0x543e3d,0xc9))['catch'](handleError(_0x543e3d,null));};exports[_0x3c15('0x21')]=function(_0x57bd65,_0x5ae4ac){if(_0x57bd65['body']['id']){delete _0x57bd65[_0x3c15('0x49')]['id'];}return db[_0x3c15('0x2b')]['find']({'where':{'id':_0x57bd65['params']['id']}})[_0x3c15('0x22')](handleEntityNotFound(_0x5ae4ac,null))['then'](saveUpdates(_0x57bd65[_0x3c15('0x49')],null))['then'](respondWithResult(_0x5ae4ac,null))[_0x3c15('0x43')](handleError(_0x5ae4ac,null));};exports[_0x3c15('0x23')]=function(_0x211850,_0x81fdaf){return db[_0x3c15('0x2b')][_0x3c15('0x47')]({'where':{'id':_0x211850[_0x3c15('0x45')]['id']}})['then'](handleEntityNotFound(_0x81fdaf,null))[_0x3c15('0x22')](removeEntity(_0x81fdaf,null))['catch'](handleError(_0x81fdaf,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 065372b..2c3b345 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 _0x56ea=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','util','../../config/logger','api'];(function(_0x394939,_0x5336bf){var _0x5b3e63=function(_0x3e1580){while(--_0x3e1580){_0x394939['push'](_0x394939['shift']());}};_0x5b3e63(++_0x5336bf);}(_0x56ea,0x185));var _0xa56e=function(_0x17784a,_0x42fe44){_0x17784a=_0x17784a-0x0;var _0x41aded=_0x56ea[_0x17784a];return _0x41aded;};'use strict';var _=require('lodash');var util=require(_0xa56e('0x0'));var logger=require(_0xa56e('0x1'))(_0xa56e('0x2'));var moment=require(_0xa56e('0x3'));var BPromise=require(_0xa56e('0x4'));var rp=require(_0xa56e('0x5'));var fs=require('fs');var path=require(_0xa56e('0x6'));var rimraf=require(_0xa56e('0x7'));var config=require(_0xa56e('0x8'));var attributes=require(_0xa56e('0x9'));module[_0xa56e('0xa')]=function(_0x4e8283,_0x1f38e3){return _0x4e8283[_0xa56e('0xb')](_0xa56e('0xc'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa56e('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6a62=['../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x2447a6,_0x43740d){var _0x5a1aac=function(_0x9e7ae5){while(--_0x9e7ae5){_0x2447a6['push'](_0x2447a6['shift']());}};_0x5a1aac(++_0x43740d);}(_0x6a62,0x116));var _0x26a6=function(_0x168342,_0x1d02a0){_0x168342=_0x168342-0x0;var _0x23452a=_0x6a62[_0x168342];return _0x23452a;};'use strict';var _=require(_0x26a6('0x0'));var util=require(_0x26a6('0x1'));var logger=require(_0x26a6('0x2'))(_0x26a6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x26a6('0x4'));var fs=require('fs');var path=require(_0x26a6('0x5'));var rimraf=require(_0x26a6('0x6'));var config=require(_0x26a6('0x7'));var attributes=require(_0x26a6('0x8'));module[_0x26a6('0x9')]=function(_0x3d9ef1,_0x34d1f6){return _0x3d9ef1[_0x26a6('0xa')](_0x26a6('0xb'),attributes,{'tableName':_0x26a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x26a6('0xd'),'collate':_0x26a6('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index d6ae7b8..7903c74 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 _0x6066=['raw','attributes','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options'];(function(_0x1cc961,_0x2c42ee){var _0x471d86=function(_0x44e422){while(--_0x44e422){_0x1cc961['push'](_0x1cc961['shift']());}};_0x471d86(++_0x2c42ee);}(_0x6066,0x108));var _0x6606=function(_0x2d364e,_0x301c5e){_0x2d364e=_0x2d364e-0x0;var _0x1b9312=_0x6066[_0x2d364e];return _0x1b9312;};'use strict';var _=require(_0x6606('0x0'));var util=require(_0x6606('0x1'));var moment=require(_0x6606('0x2'));var BPromise=require('bluebird');var rs=require(_0x6606('0x3'));var fs=require('fs');var Redis=require(_0x6606('0x4'));var db=require(_0x6606('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6606('0x6'))(_0x6606('0x7'));var config=require(_0x6606('0x8'));var jayson=require(_0x6606('0x9'));var client=jayson[_0x6606('0xa')][_0x6606('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54eb5f,_0x5f502c,_0x1b3bbd){return new BPromise(function(_0x5308ff,_0x3f39f1){return client[_0x6606('0xc')](_0x54eb5f,_0x1b3bbd)[_0x6606('0xd')](function(_0xbb6811){logger['info'](_0x6606('0xe'),_0x5f502c,_0x6606('0xf'));logger[_0x6606('0x10')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x5f502c,'request\x20sent',JSON['stringify'](_0xbb6811));if(_0xbb6811[_0x6606('0x11')]){if(_0xbb6811['error']['code']===0x1f4){logger[_0x6606('0x11')](_0x6606('0xe'),_0x5f502c,_0xbb6811['error'][_0x6606('0x12')]);return _0x3f39f1(_0xbb6811[_0x6606('0x11')][_0x6606('0x12')]);}logger[_0x6606('0x11')](_0x6606('0xe'),_0x5f502c,_0xbb6811['error'][_0x6606('0x12')]);return _0x5308ff(_0xbb6811['error'][_0x6606('0x12')]);}else{logger[_0x6606('0x13')](_0x6606('0xe'),_0x5f502c,'request\x20sent');_0x5308ff(_0xbb6811[_0x6606('0x14')][_0x6606('0x12')]);}})[_0x6606('0x15')](function(_0x35509b){logger[_0x6606('0x11')](_0x6606('0xe'),_0x5f502c,_0x35509b);_0x3f39f1(_0x35509b);});});}exports[_0x6606('0x16')]=function(_0x4ab0df){var _0x388d0a=this;return new Promise(function(_0x5c9f1e,_0x2a655e){return db[_0x6606('0x17')]['update'](_0x4ab0df[_0x6606('0x18')],{'raw':_0x4ab0df[_0x6606('0x19')]?_0x4ab0df[_0x6606('0x19')][_0x6606('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ab0df['options']?_0x4ab0df[_0x6606('0x19')]['where']||null:null,'attributes':_0x4ab0df[_0x6606('0x19')]?_0x4ab0df[_0x6606('0x19')][_0x6606('0x1b')]||null:null,'limit':_0x4ab0df[_0x6606('0x19')]?_0x4ab0df['options']['limit']||null:null})[_0x6606('0xd')](function(_0xde74d3){logger[_0x6606('0x13')]('UpdateOpenchannelApplication',_0x4ab0df);logger['debug'](_0x6606('0x16'),_0x4ab0df,JSON[_0x6606('0x1c')](_0xde74d3));_0x5c9f1e(_0xde74d3);})[_0x6606('0x15')](function(_0x405d5d){logger[_0x6606('0x11')](_0x6606('0x16'),_0x405d5d[_0x6606('0x12')],_0x4ab0df);_0x2a655e(_0x388d0a[_0x6606('0x11')](0x1f4,_0x405d5d[_0x6606('0x12')]));});});}; \ No newline at end of file +var _0x97f9=['rpc','../../config/environment','jayson/promise','http','request','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','limit','then','lodash','util','moment','bluebird','ioredis'];(function(_0x4cec38,_0x2a7b0a){var _0x3f3ea2=function(_0xa47495){while(--_0xa47495){_0x4cec38['push'](_0x4cec38['shift']());}};_0x3f3ea2(++_0x2a7b0a);}(_0x97f9,0x1db));var _0x997f=function(_0xbc9b5b,_0xbc64d){_0xbc9b5b=_0xbc9b5b-0x0;var _0x54ab52=_0x97f9[_0xbc9b5b];return _0x54ab52;};'use strict';var _=require(_0x997f('0x0'));var util=require(_0x997f('0x1'));var moment=require(_0x997f('0x2'));var BPromise=require(_0x997f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x997f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x997f('0x5'));var config=require(_0x997f('0x6'));var jayson=require(_0x997f('0x7'));var client=jayson['client'][_0x997f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2079e5,_0x46823,_0x5903b4){return new BPromise(function(_0x239206,_0x3fcbc8){return client[_0x997f('0x9')](_0x2079e5,_0x5903b4)['then'](function(_0x1fd5ee){logger['info'](_0x997f('0xa'),_0x46823,_0x997f('0xb'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x46823,_0x997f('0xb'),JSON[_0x997f('0xc')](_0x1fd5ee));if(_0x1fd5ee[_0x997f('0xd')]){if(_0x1fd5ee[_0x997f('0xd')][_0x997f('0xe')]===0x1f4){logger[_0x997f('0xd')](_0x997f('0xa'),_0x46823,_0x1fd5ee['error']['message']);return _0x3fcbc8(_0x1fd5ee[_0x997f('0xd')][_0x997f('0xf')]);}logger[_0x997f('0xd')](_0x997f('0xa'),_0x46823,_0x1fd5ee['error']['message']);return _0x239206(_0x1fd5ee[_0x997f('0xd')][_0x997f('0xf')]);}else{logger['info'](_0x997f('0xa'),_0x46823,_0x997f('0xb'));_0x239206(_0x1fd5ee['result'][_0x997f('0xf')]);}})['catch'](function(_0x2c0370){logger[_0x997f('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x46823,_0x2c0370);_0x3fcbc8(_0x2c0370);});});}exports[_0x997f('0x10')]=function(_0x19e54b){var _0x4b90df=this;return new Promise(function(_0x15a448,_0x5c450b){return db[_0x997f('0x11')][_0x997f('0x12')](_0x19e54b['body'],{'raw':_0x19e54b['options']?_0x19e54b[_0x997f('0x13')][_0x997f('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19e54b[_0x997f('0x13')]?_0x19e54b['options'][_0x997f('0x15')]||null:null,'attributes':_0x19e54b[_0x997f('0x13')]?_0x19e54b[_0x997f('0x13')]['attributes']||null:null,'limit':_0x19e54b[_0x997f('0x13')]?_0x19e54b[_0x997f('0x13')][_0x997f('0x16')]||null:null})[_0x997f('0x17')](function(_0x5f1bff){logger['info'](_0x997f('0x10'),_0x19e54b);logger['debug']('UpdateOpenchannelApplication',_0x19e54b,JSON[_0x997f('0xc')](_0x5f1bff));_0x15a448(_0x5f1bff);})['catch'](function(_0x1c44fc){logger[_0x997f('0xd')]('UpdateOpenchannelApplication',_0x1c44fc[_0x997f('0xf')],_0x19e54b);_0x5c450b(_0x4b90df[_0x997f('0xd')](0x1f4,_0x1c44fc['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 94a12bf..d7a7432 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 _0xf065=['addTags','openchannel','openchannelinteraction:update','delete','openchannelinteraction:destroy','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags'];(function(_0x590b61,_0x4c4335){var _0x1a14dc=function(_0x2ff4f6){while(--_0x2ff4f6){_0x590b61['push'](_0x590b61['shift']());}};_0x1a14dc(++_0x4c4335);}(_0xf065,0x10b));var _0x5f06=function(_0x46b4d1,_0x3e5f9b){_0x46b4d1=_0x46b4d1-0x0;var _0x290ff4=_0xf065[_0x46b4d1];return _0x290ff4;};'use strict';var multer=require('multer');var util=require(_0x5f06('0x0'));var path=require(_0x5f06('0x1'));var timeout=require(_0x5f06('0x2'));var express=require(_0x5f06('0x3'));var router=express[_0x5f06('0x4')]();var fs_extra=require(_0x5f06('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5f06('0x6'));var config=require(_0x5f06('0x7'));var controller=require(_0x5f06('0x8'));router[_0x5f06('0x9')]('/',auth[_0x5f06('0xa')](),controller['index']);router[_0x5f06('0x9')](_0x5f06('0xb'),auth[_0x5f06('0xa')](),controller[_0x5f06('0xc')]);router['get'](_0x5f06('0xd'),auth[_0x5f06('0xa')](),controller['show']);router[_0x5f06('0x9')](_0x5f06('0xe'),auth[_0x5f06('0xa')](),controller[_0x5f06('0xf')]);router['get']('/:id/download',auth[_0x5f06('0xa')](),controller[_0x5f06('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5f06('0x11')]);router[_0x5f06('0x12')](_0x5f06('0xe'),auth[_0x5f06('0xa')](),controller[_0x5f06('0x13')]);router[_0x5f06('0x12')](_0x5f06('0x14'),auth['isAuthenticated'](),interaction[_0x5f06('0x15')]('openchannel',_0x5f06('0x16')),controller[_0x5f06('0x17')]);router['put'](_0x5f06('0xd'),auth[_0x5f06('0xa')](),interaction['tracked'](_0x5f06('0x18'),_0x5f06('0x19')),controller['update']);router[_0x5f06('0x1a')]('/:id',auth[_0x5f06('0xa')](),interaction[_0x5f06('0x15')]('openchannel',_0x5f06('0x1b')),controller['destroy']);router[_0x5f06('0x1a')](_0x5f06('0x14'),auth[_0x5f06('0xa')](),controller[_0x5f06('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x3764=['../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:destroy','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x8ada96,_0x3a8434){var _0x1d97aa=function(_0x4a7862){while(--_0x4a7862){_0x8ada96['push'](_0x8ada96['shift']());}};_0x1d97aa(++_0x3a8434);}(_0x3764,0x70));var _0x4376=function(_0x3979c6,_0x2a6197){_0x3979c6=_0x3979c6-0x0;var _0x102daf=_0x3764[_0x3979c6];return _0x102daf;};'use strict';var multer=require(_0x4376('0x0'));var util=require(_0x4376('0x1'));var path=require(_0x4376('0x2'));var timeout=require('connect-timeout');var express=require(_0x4376('0x3'));var router=express[_0x4376('0x4')]();var fs_extra=require(_0x4376('0x5'));var auth=require(_0x4376('0x6'));var interaction=require(_0x4376('0x7'));var config=require(_0x4376('0x8'));var controller=require('./openchannelInteraction.controller');router[_0x4376('0x9')]('/',auth[_0x4376('0xa')](),controller[_0x4376('0xb')]);router[_0x4376('0x9')]('/describe',auth[_0x4376('0xa')](),controller[_0x4376('0xc')]);router[_0x4376('0x9')](_0x4376('0xd'),auth[_0x4376('0xa')](),controller[_0x4376('0xe')]);router[_0x4376('0x9')](_0x4376('0xf'),auth[_0x4376('0xa')](),controller[_0x4376('0x10')]);router[_0x4376('0x9')](_0x4376('0x11'),auth[_0x4376('0xa')](),controller[_0x4376('0x12')]);router['post']('/',auth[_0x4376('0xa')](),controller[_0x4376('0x13')]);router[_0x4376('0x14')]('/:id/messages',auth[_0x4376('0xa')](),controller[_0x4376('0x15')]);router[_0x4376('0x14')](_0x4376('0x16'),auth[_0x4376('0xa')](),interaction[_0x4376('0x17')](_0x4376('0x18'),_0x4376('0x19')),controller['addTags']);router[_0x4376('0x1a')]('/:id',auth[_0x4376('0xa')](),interaction[_0x4376('0x17')](_0x4376('0x18'),'openchannelinteraction:update'),controller['update']);router['delete'](_0x4376('0xd'),auth[_0x4376('0xa')](),interaction[_0x4376('0x17')](_0x4376('0x18'),_0x4376('0x1b')),controller['destroy']);router[_0x4376('0x1c')](_0x4376('0x16'),auth[_0x4376('0xa')](),controller['removeTags']);module[_0x4376('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 961dd36..e56c391 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 _0x5127=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x101dc2,_0x3b6930){var _0x1f1537=function(_0x2421ca){while(--_0x2421ca){_0x101dc2['push'](_0x101dc2['shift']());}};_0x1f1537(++_0x3b6930);}(_0x5127,0x64));var _0x7512=function(_0x275caa,_0x166d5e){_0x275caa=_0x275caa-0x0;var _0x28d670=_0x5127[_0x275caa];return _0x28d670;};'use strict';var Sequelize=require(_0x7512('0x0'));module[_0x7512('0x1')]={'closed':{'type':Sequelize[_0x7512('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7512('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7512('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7512('0x4')]},'note':{'type':Sequelize[_0x7512('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x7512('0x4')]},'externalUrl':{'type':Sequelize[_0x7512('0x4')]},'lastMsgAt':{'type':Sequelize[_0x7512('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7512('0x5')]('in',_0x7512('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x7512('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4944=['out','sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0xb70f60,_0x3b97c6){var _0x251460=function(_0xaad499){while(--_0xaad499){_0xb70f60['push'](_0xb70f60['shift']());}};_0x251460(++_0x3b97c6);}(_0x4944,0x6d));var _0x4494=function(_0x515837,_0x6ed7ac){_0x515837=_0x515837-0x0;var _0x2d1734=_0x4944[_0x515837];return _0x2d1734;};'use strict';var Sequelize=require(_0x4494('0x0'));module['exports']={'closed':{'type':Sequelize[_0x4494('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4494('0x2')]},'disposition':{'type':Sequelize[_0x4494('0x3')]},'secondDisposition':{'type':Sequelize[_0x4494('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4494('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x4494('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x4494('0x3')]},'lastMsgAt':{'type':Sequelize[_0x4494('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4494('0x4')]('in',_0x4494('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x4494('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x4494('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index b798981..594e174 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 _0x1ec0=['path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','Users','map','fullname','Tags','TagIds','forEach','push','catch','OpenchannelInteraction','rawAttributes','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','select','from','tools_tags','field','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','buildExpression','start','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$lte','null','read','`unreadMessages`\x20=\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','params','includeAll','include','create','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','merge','findAll','addTags','setTags','color','emit','openchannelInteractionTags:save','removeTags','join','tmp','root','server','attachments','CmContact','lastName','Attachment','Messages','direction','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','disposition','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','secret','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','eml-format','rimraf','zip-dir','request-promise','bluebird','util'];(function(_0x217028,_0x5b93e9){var _0x356c3f=function(_0x90e9f6){while(--_0x90e9f6){_0x217028['push'](_0x217028['shift']());}};_0x356c3f(++_0x5b93e9);}(_0x1ec0,0xe7));var _0x01ec=function(_0x56ab0c,_0x156cc6){_0x56ab0c=_0x56ab0c-0x0;var _0x25dc7a=_0x1ec0[_0x56ab0c];return _0x25dc7a;};'use strict';var emlformat=require(_0x01ec('0x0'));var rimraf=require(_0x01ec('0x1'));var zipdir=require(_0x01ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x01ec('0x3'));var moment=require('moment');var BPromise=require(_0x01ec('0x4'));var Mustache=require('mustache');var util=require(_0x01ec('0x5'));var path=require(_0x01ec('0x6'));var sox=require(_0x01ec('0x7'));var csv=require(_0x01ec('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x01ec('0x9'));var _=require(_0x01ec('0xa'));var squel=require('squel');var crypto=require(_0x01ec('0xb'));var jsforce=require(_0x01ec('0xc'));var deskjs=require(_0x01ec('0xd'));var toCsv=require(_0x01ec('0x8'));var querystring=require(_0x01ec('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x01ec('0xf'));var qs=require(_0x01ec('0x10'));var as=require(_0x01ec('0x11'));var pdf=require(_0x01ec('0x12'));var hardwareService=require(_0x01ec('0x13'));var logger=require(_0x01ec('0x14'))(_0x01ec('0x15'));var utils=require(_0x01ec('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x01ec('0x17'));var db=require(_0x01ec('0x18'))['db'];config[_0x01ec('0x19')]=_['defaults'](config[_0x01ec('0x19')],{'host':_0x01ec('0x1a'),'port':0x18eb});var socket=require(_0x01ec('0x1b'))(new Redis(config[_0x01ec('0x19')]));require(_0x01ec('0x1c'))[_0x01ec('0x1d')](socket);function respondWithStatusCode(_0x25b230,_0x575ce8){_0x575ce8=_0x575ce8||0xcc;return function(_0x2c1d85){if(_0x2c1d85){return _0x25b230[_0x01ec('0x1e')](_0x575ce8);}return _0x25b230[_0x01ec('0x1f')](_0x575ce8)[_0x01ec('0x20')]();};}function respondWithResult(_0x3cea31,_0x39c331){_0x39c331=_0x39c331||0xc8;return function(_0x4de6d1){if(_0x4de6d1){return _0x3cea31['status'](_0x39c331)[_0x01ec('0x21')](_0x4de6d1);}};}function respondWithFilteredResult(_0x1bbc98,_0x5e87e7){return function(_0x470a0b){if(_0x470a0b){var _0x135c5e=typeof _0x5e87e7[_0x01ec('0x22')]===_0x01ec('0x23')&&typeof _0x5e87e7[_0x01ec('0x24')]==='undefined';var _0x33b69c=_0x470a0b[_0x01ec('0x25')];var _0x4beef6=_0x135c5e?0x0:_0x5e87e7[_0x01ec('0x22')];var _0x3e3e6e=_0x135c5e?_0x470a0b['count']:_0x5e87e7['offset']+_0x5e87e7['limit'];var _0x40b07a;if(_0x3e3e6e>=_0x33b69c){_0x3e3e6e=_0x33b69c;_0x40b07a=0xc8;}else{_0x40b07a=0xce;}_0x1bbc98[_0x01ec('0x1f')](_0x40b07a);return _0x1bbc98[_0x01ec('0x26')](_0x01ec('0x27'),_0x4beef6+'-'+_0x3e3e6e+'/'+_0x33b69c)[_0x01ec('0x21')](_0x470a0b);}return null;};}function patchUpdates(_0xd61f97){return function(_0x51186d){try{jsonpatch['apply'](_0x51186d,_0xd61f97,!![]);}catch(_0xb442fd){return BPromise['reject'](_0xb442fd);}return _0x51186d['save']();};}function saveUpdates(_0x44990e,_0x36f2e1){return function(_0x36f15c){if(_0x36f15c){return _0x36f15c[_0x01ec('0x28')](_0x44990e)['then'](function(_0x368ebd){return _0x368ebd;});}return null;};}function removeEntity(_0x4de375,_0x17fce7){return function(_0x3af493){if(_0x3af493){return _0x3af493['destroy']()[_0x01ec('0x29')](function(){_0x4de375[_0x01ec('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x121a1a,_0x5cc526){return function(_0x59fb9d){if(!_0x59fb9d){_0x121a1a[_0x01ec('0x1e')](0x194);}return _0x59fb9d;};}function handleError(_0x1f5790,_0x3dc448){_0x3dc448=_0x3dc448||0x1f4;return function(_0x1a9a79){logger[_0x01ec('0x2a')](_0x1a9a79[_0x01ec('0x2b')]);if(_0x1a9a79[_0x01ec('0x2c')]){delete _0x1a9a79['name'];}_0x1f5790[_0x01ec('0x1f')](_0x3dc448)[_0x01ec('0x2d')](_0x1a9a79);};}function getInteractionUsers(_0x1f591e,_0x1911c0){return new BPromise(function(_0x483678,_0x171020){try{if(_0x1911c0[_0x1f591e['id']]){_0x1f591e[_0x01ec('0x2e')]=_[_0x01ec('0x2f')](_0x1911c0[_0x1f591e['id']],function(_0x7d61d9){return{'id':_0x7d61d9['id'],'fullname':_0x7d61d9[_0x01ec('0x30')]};});}}catch(_0x3a8bb8){_0x171020(_0x3a8bb8);}_0x483678(_0x1f591e);});}function getInteractionTags(_0x520c37,_0x7a222d){return new BPromise(function(_0x5199b7,_0xd2bb14){try{if(_0x520c37['TagIds']){_0x520c37[_0x01ec('0x31')]=[];_0x520c37[_0x01ec('0x32')]['split'](',')[_0x01ec('0x33')](function(_0x3b6eb6){_0x520c37['Tags'][_0x01ec('0x34')](_0x7a222d[_0x3b6eb6]);});}delete _0x520c37[_0x01ec('0x32')];}catch(_0x218a0c){_0xd2bb14(_0x218a0c);}_0x5199b7(_0x520c37);});}function updateOpenchannelInteraction(_0x233e19,_0x40837c,_0x310e23){return new BPromise(function(_0x5117d6,_0x144761){return getInteractionUsers(_0x233e19,_0x310e23)[_0x01ec('0x29')](function(_0x30aeb9){return getInteractionTags(_0x30aeb9,_0x40837c);})[_0x01ec('0x29')](function(_0x132531){_0x5117d6(_0x132531);})[_0x01ec('0x35')](function(_0x3aff25){_0x144761(_0x3aff25);});});}exports['index']=function(_0x344f66,_0x4ed76d){var _0x51f0c2={},_0x1f4500={},_0xfaf213={'count':0x0,'rows':[]};var _0x2da346=_['map'](db[_0x01ec('0x36')][_0x01ec('0x37')],function(_0x154642){return{'name':_0x154642['fieldName'],'type':_0x154642[_0x01ec('0x38')][_0x01ec('0x39')]};});_0x1f4500['model']=_['map'](_0x2da346,_0x01ec('0x2c'));_0x1f4500['query']=_[_0x01ec('0x3a')](_0x344f66[_0x01ec('0x3b')]);_0x1f4500['filters']=_[_0x01ec('0x3c')](_0x1f4500[_0x01ec('0x3d')],_0x1f4500[_0x01ec('0x3b')]);_0x51f0c2[_0x01ec('0x3e')]=_[_0x01ec('0x3c')](_0x1f4500[_0x01ec('0x3d')],qs[_0x01ec('0x3f')](_0x344f66[_0x01ec('0x3b')][_0x01ec('0x3f')]));_0x51f0c2[_0x01ec('0x3e')]=_0x51f0c2['attributes'][_0x01ec('0x40')]?_0x51f0c2[_0x01ec('0x3e')]:_0x1f4500[_0x01ec('0x3d')];if(!_0x344f66[_0x01ec('0x3b')][_0x01ec('0x41')](_0x01ec('0x42'))){_0x51f0c2[_0x01ec('0x24')]=qs[_0x01ec('0x24')](_0x344f66['query']['limit']);_0x51f0c2[_0x01ec('0x22')]=qs['offset'](_0x344f66[_0x01ec('0x3b')][_0x01ec('0x22')]);}_0x51f0c2[_0x01ec('0x43')]=qs[_0x01ec('0x44')](_0x344f66[_0x01ec('0x3b')]['sort']);_0x51f0c2[_0x01ec('0x45')]=qs[_0x01ec('0x46')](_['pick'](_0x344f66['query'],_0x1f4500[_0x01ec('0x46')]),_0x2da346);var _0x2b2e5c=[];var _0xccc2d=squel[_0x01ec('0x47')]()['field']('id')['field'](_0x01ec('0x2c'))['field']('color')[_0x01ec('0x48')](_0x01ec('0x49'));var _0x9c9d1d=squel[_0x01ec('0x47')]()[_0x01ec('0x4a')](_0x01ec('0x4b'))[_0x01ec('0x4a')](_0x01ec('0x4c'))['field'](_0x01ec('0x4d'))[_0x01ec('0x48')](_0x01ec('0x4e'),'ui')['left_join'](_0x01ec('0x4f'),'u',_0x01ec('0x50'));var _0x117472=squel[_0x01ec('0x47')]()['from'](_0x01ec('0x51'),'i')[_0x01ec('0x52')](_0x01ec('0x53'),'c',_0x01ec('0x54'))[_0x01ec('0x52')](_0x01ec('0x4f'),'o',_0x01ec('0x55'))[_0x01ec('0x52')](_0x01ec('0x56'),'a',_0x01ec('0x57'))[_0x01ec('0x52')](_0x01ec('0x58'),'me',_0x01ec('0x59'))[_0x01ec('0x52')](_0x01ec('0x5a'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x01ec('0x52')](_0x01ec('0x49'),'t','t.id\x20=\x20it.TagId');var _0x4b85f1=squel[_0x01ec('0x5b')]();var _0x5e742f=[];var _0x5a962d=squel[_0x01ec('0x5b')]();var _0x406ed6;if(_0x344f66[_0x01ec('0x3b')][_0x01ec('0x5c')]){_0x406ed6=as[_0x01ec('0x5d')](_0x344f66[_0x01ec('0x3b')][_0x01ec('0x5c')]);var _0x545e03=_0x406ed6['sqlOperator'];for(var _0x453549=0x0;_0x453549<_0x406ed6['conditions'][_0x01ec('0x40')];_0x453549++){var _0x34f9aa=_0x406ed6[_0x01ec('0x5e')][_0x453549];var _0x43b24a='i';var _0x4855d2=_[_0x01ec('0x5f')](_0x2da346,['name',_0x34f9aa[_0x01ec('0x4a')]]);if(!_0x4855d2){switch(_0x34f9aa[_0x01ec('0x4a')]){case _0x01ec('0x60'):if(_0x34f9aa[_0x01ec('0x61')]==0x1){_0x117472[_0x01ec('0x62')]('`'+_0x34f9aa[_0x01ec('0x4a')]+'`\x20=\x200');}else{_0x117472[_0x01ec('0x62')]('`'+_0x34f9aa['field']+_0x01ec('0x63'));}break;case _0x01ec('0x64'):if(_0x34f9aa[_0x01ec('0x65')]==='$substring'){if(_0x34f9aa['value'][_0x01ec('0x66')]('\x20')[_0x01ec('0x40')]>0x1){_0x4b85f1[_0x545e03](_0x01ec('0x67'),qs[_0x01ec('0x68')](_0x34f9aa[_0x01ec('0x61')]),null);}else{var _0x29a2c2='%'+_0x34f9aa[_0x01ec('0x61')]+'%';_0x4b85f1[_0x545e03](_0x01ec('0x69'),_0x29a2c2,_0x29a2c2,_0x29a2c2);}}else{_0x4855d2=_['find'](_0x2da346,[_0x01ec('0x2c'),_0x01ec('0x6a')]);_0x34f9aa[_0x01ec('0x4a')]=_0x01ec('0x6a');_0x5d9f03=as['buildExpression'](_0x43b24a,_0x4855d2[_0x01ec('0x38')],_0x34f9aa);_0x4b85f1[_0x545e03](_0x5d9f03[_0x01ec('0x6b')],_0x5d9f03[_0x01ec('0x61')]['start'],_0x5d9f03[_0x01ec('0x61')][_0x01ec('0x20')]);}break;case _0x01ec('0x6c'):var _0x2572ef=_0x34f9aa[_0x01ec('0x61')][_0x01ec('0x66')](',')[_0x01ec('0x2f')](function(_0x4dc458){return Number(_0x4dc458);});_0x2572ef[_0x01ec('0x33')](function(_0x456957){_0x5a962d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x456957+',%');});_0x5e742f=_['union'](_0x5e742f,_0x2572ef);break;case _0x01ec('0x6d'):if(_0x34f9aa[_0x01ec('0x65')]===_0x01ec('0x6e')){_0x4b85f1[_0x545e03](_0x01ec('0x6f'),'%'+_0x34f9aa['value']+'%',null);}else{_0x4855d2=_[_0x01ec('0x5f')](_0x2da346,[_0x01ec('0x2c'),_0x01ec('0x70')]);_0x34f9aa['field']=_0x01ec('0x70');_0x5d9f03=as['buildExpression'](_0x43b24a,_0x4855d2[_0x01ec('0x38')],_0x34f9aa);_0x4b85f1[_0x545e03](_0x5d9f03[_0x01ec('0x6b')],_0x5d9f03[_0x01ec('0x61')]['start'],_0x5d9f03[_0x01ec('0x61')][_0x01ec('0x20')]);}break;case _0x01ec('0x71'):_0x5d9f03=as[_0x01ec('0x72')]('me',null,_0x34f9aa);_0x4b85f1[_0x545e03](_0x5d9f03['text'],_0x5d9f03[_0x01ec('0x61')][_0x01ec('0x73')],_0x5d9f03[_0x01ec('0x61')][_0x01ec('0x20')]);break;}}else{var _0x5d9f03=as[_0x01ec('0x72')](_0x43b24a,_0x4855d2[_0x01ec('0x38')],_0x34f9aa);_0x4b85f1[_0x545e03](_0x5d9f03[_0x01ec('0x6b')],_0x5d9f03[_0x01ec('0x61')][_0x01ec('0x73')],_0x5d9f03[_0x01ec('0x61')][_0x01ec('0x20')]);}}}else{var _0x513dca=_(_0x344f66[_0x01ec('0x3b')])[_0x01ec('0x3a')]()[_0x01ec('0x2f')](function(_0x4d1c9b){return _[_0x01ec('0x74')](_0x2da346,[_0x01ec('0x2c'),_0x4d1c9b])?_0x4d1c9b:undefined;})[_0x01ec('0x75')]()[_0x01ec('0x61')]();if(!_[_0x01ec('0x76')](_0x513dca)){_0x513dca[_0x01ec('0x33')](function(_0xcd0731){if(_0xcd0731===_0x01ec('0x77')){_0x117472[_0x01ec('0x45')](_0x01ec('0x78'),[]['concat'](_0x344f66['query'][_0xcd0731]));}else if(_0xcd0731===_0x01ec('0x79')){var _0x326d7b=JSON[_0x01ec('0x7a')](_0x344f66['query'][_0xcd0731])['$gte'];var _0x13b867=JSON[_0x01ec('0x7a')](_0x344f66[_0x01ec('0x3b')][_0xcd0731])[_0x01ec('0x7b')];_0x117472['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x326d7b,_0x13b867);}else{if(_0x344f66['query'][_0xcd0731]===_0x01ec('0x7c')){_0x117472[_0x01ec('0x45')]('i.'+_0xcd0731+'\x20IS\x20NULL');}else{_0x117472[_0x01ec('0x45')]('i.'+_0xcd0731+'\x20=\x20?',_0x344f66['query'][_0xcd0731]);}}});}if(_0x344f66[_0x01ec('0x3b')][_0x01ec('0x7d')]){if(_0x344f66['query']['read']==0x1){_0x117472['having'](_0x01ec('0x7e'));}else{_0x117472[_0x01ec('0x62')]('`unreadMessages`\x20>\x200');}}if(_0x344f66[_0x01ec('0x3b')]['tag']){_0x5e742f=_[_0x01ec('0x7f')](_0x344f66['query'][_0x01ec('0x80')])?_0x344f66[_0x01ec('0x3b')][_0x01ec('0x80')]:new Array(_0x344f66[_0x01ec('0x3b')][_0x01ec('0x80')]);_0x5e742f[_0x01ec('0x33')](function(_0x551998){_0x5a962d['or'](_0x01ec('0x81'),'%,'+_0x551998+',%');});}if(_0x344f66[_0x01ec('0x3b')][_0x01ec('0x82')]){var _0x2f68d7=_0x344f66[_0x01ec('0x3b')][_0x01ec('0x82')][_0x01ec('0x83')]('\x5c','\x5c\x5c')[_0x01ec('0x83')](/'/g,'\x27\x27');if(qs[_0x01ec('0x84')](_0x2f68d7)){_0x4b85f1['or']('i.id\x20LIKE\x20?',_0x2f68d7+'%');}else{_0x4b85f1['or'](_0x01ec('0x85'),qs[_0x01ec('0x68')](_0x2f68d7))['or'](_0x01ec('0x86'),_0x2f68d7+'%')['or'](_0x01ec('0x87'),_0x2f68d7+'%');}}}_0x117472[_0x01ec('0x45')](_0x4b85f1);_0x117472[_0x01ec('0x88')]('i.id');var _0x15d64c={'type':db[_0x01ec('0x89')][_0x01ec('0x8a')][_0x01ec('0x8b')],'raw':!![]};var _0x323243=_0x117472[_0x01ec('0x8c')]();_0x323243[_0x01ec('0x4a')](_0x01ec('0x8d'));_0x323243['field'](_0x01ec('0x8e'),_0x01ec('0x60'));if(_0x51f0c2['order']){_0x51f0c2[_0x01ec('0x43')]['forEach'](function(_0xa395ec){var _0x4e47ab=_0xa395ec[0x0]===_0x01ec('0x8f')?_0xa395ec[0x0]:'i.'+_0xa395ec[0x0];_0x117472['order'](_0x4e47ab,_0xa395ec[0x1]===_0x01ec('0x90')?![]:!![]);});}if(!_[_0x01ec('0x76')](_0x5e742f)){_0x117472['having'](_0x5a962d);_0x323243[_0x01ec('0x45')](_0x01ec('0x91'),_0x5e742f);}BPromise[_0x01ec('0x92')]()[_0x01ec('0x29')](function(){if(!_0x406ed6){if(_0x344f66[_0x01ec('0x3b')][_0x01ec('0x77')])return;_0x323243['where'](_0x01ec('0x93'));_0x117472['where'](_0x01ec('0x93'));return;}if(_0x344f66[_0x01ec('0x94')][_0x01ec('0x95')]!==_0x01ec('0x96'))return;return _0x344f66[_0x01ec('0x94')][_0x01ec('0x97')]({'attributes':['id'],'raw':!![]})[_0x01ec('0x29')](function(_0x1b3ca7){if(_[_0x01ec('0x76')](_0x1b3ca7)){_0x323243[_0x01ec('0x45')](_0x01ec('0x98'));_0x117472['where'](_0x01ec('0x98'));}else{_0x323243[_0x01ec('0x45')](_0x01ec('0x78'),_['map'](_0x1b3ca7,'id'));_0x117472[_0x01ec('0x45')](_0x01ec('0x78'),_[_0x01ec('0x2f')](_0x1b3ca7,'id'));}});})['then'](function(){if(_0x344f66[_0x01ec('0x94')][_0x01ec('0x95')]===_0x01ec('0x96')&&!_0x406ed6&&!_0x344f66['query']['OpenchannelAccountId'])return[];return db[_0x01ec('0x99')]['query'](_0x323243[_0x01ec('0x9a')](),_0x15d64c);})[_0x01ec('0x29')](function(_0x4e6b64){_0xfaf213[_0x01ec('0x25')]=_0x4e6b64[_0x01ec('0x40')];if(_0xfaf213[_0x01ec('0x25')]===0x0)return[];return db[_0x01ec('0x99')][_0x01ec('0x3b')](_0xccc2d[_0x01ec('0x9a')](),_0x15d64c)[_0x01ec('0x29')](function(_0x44d277){_0x2b2e5c=_['keyBy'](_0x44d277,'id');_0x15d64c=_['merge'](_0x15d64c,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x344f66[_0x01ec('0x3b')][_0x01ec('0x3f')]){_0x51f0c2[_0x01ec('0x3e')][_0x01ec('0x33')](function(_0x5711e0){_0x117472[_0x01ec('0x4a')]('i.'+_0x5711e0);});}else{_0x117472[_0x01ec('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x01ec('0x60'));_0x117472[_0x01ec('0x4a')](_0x01ec('0x9b'),'Account.key');_0x117472[_0x01ec('0x4a')]('a.mandatoryDisposition',_0x01ec('0x9c'));_0x117472['field'](_0x01ec('0x9d'),_0x01ec('0x8f'));_0x117472['field'](_0x01ec('0x9e'));_0x117472['field'](_0x01ec('0x9f'),_0x01ec('0xa0'));_0x117472[_0x01ec('0x4a')]('c.lastName',_0x01ec('0xa1'));_0x117472[_0x01ec('0x4a')](_0x01ec('0xa2'),_0x01ec('0xa3'));_0x117472[_0x01ec('0x4a')](_0x01ec('0xa4'),_0x01ec('0xa5'));_0x117472['field'](_0x01ec('0xa6'),_0x01ec('0xa7'));_0x117472[_0x01ec('0x4a')](_0x01ec('0xa8'),_0x01ec('0xa9'));_0x117472[_0x01ec('0x4a')]('o.fullname',_0x01ec('0xaa'));_0x117472[_0x01ec('0x4a')](_0x01ec('0xab'),_0x01ec('0xac'));_0x117472[_0x01ec('0x4a')](_0x01ec('0xad'),'TagIds');}if(_0x51f0c2['limit'])_0x117472[_0x01ec('0x24')](_0x51f0c2[_0x01ec('0x24')]);if(_0x51f0c2[_0x01ec('0x22')])_0x117472['offset'](_0x51f0c2[_0x01ec('0x22')]);return db['sequelize']['query'](_0x117472['toString'](),_0x15d64c);})[_0x01ec('0x29')](function(_0x49249b){if(_0x49249b[_0x01ec('0x40')]>0x0)_0x9c9d1d['where'](_0x01ec('0xae'),_[_0x01ec('0x2f')](_0x49249b,'id'));return db['sequelize'][_0x01ec('0x3b')](_0x9c9d1d[_0x01ec('0x9a')](),_0x15d64c)[_0x01ec('0x29')](function(_0x2ae770){var _0x317c66=_[_0x01ec('0xaf')](_0x2ae770,_0x01ec('0xb0'));var _0x5c551a=[];_0x49249b[_0x01ec('0x33')](function(_0x54cd5d){_0x5c551a[_0x01ec('0x34')](updateOpenchannelInteraction(_0x54cd5d,_0x2b2e5c,_0x317c66));});return BPromise[_0x01ec('0xb1')](_0x5c551a);});});})[_0x01ec('0x29')](function(_0x54bb3b){_0xfaf213[_0x01ec('0xb2')]=_0x54bb3b;return _0xfaf213;})[_0x01ec('0x29')](respondWithFilteredResult(_0x4ed76d,_0x51f0c2))[_0x01ec('0x35')](handleError(_0x4ed76d,null));};exports['show']=function(_0x1afe98,_0x518a51){var _0x3c0d29={};if(_0x1afe98[_0x01ec('0x3b')][_0x01ec('0x38')]&&_0x1afe98[_0x01ec('0x3b')][_0x01ec('0x38')]==='from'){_0x3c0d29[_0x01ec('0x48')]=_0x1afe98[_0x01ec('0xb3')]['id'];}else{_0x3c0d29['id']=_0x1afe98[_0x01ec('0xb3')]['id'];}var _0x7db42d={'raw':![],'where':_0x3c0d29},_0x38b4c8={};_0x38b4c8[_0x01ec('0x3d')]=_['keys'](db[_0x01ec('0x36')]['rawAttributes']);_0x38b4c8[_0x01ec('0x3b')]=_['keys'](_0x1afe98[_0x01ec('0x3b')]);_0x38b4c8[_0x01ec('0x46')]=_[_0x01ec('0x3c')](_0x38b4c8['model'],_0x38b4c8[_0x01ec('0x3b')]);_0x7db42d[_0x01ec('0x3e')]=_['intersection'](_0x38b4c8[_0x01ec('0x3d')],qs['fields'](_0x1afe98['query'][_0x01ec('0x3f')]));_0x7db42d[_0x01ec('0x3e')]=_0x7db42d[_0x01ec('0x3e')]['length']?_0x7db42d[_0x01ec('0x3e')]:_0x38b4c8[_0x01ec('0x3d')];if(_0x1afe98[_0x01ec('0x3b')][_0x01ec('0xb4')]){_0x7db42d[_0x01ec('0xb5')]=[{'all':!![]}];}_0x7db42d=_['merge']({},_0x7db42d,_0x1afe98['options']);return db['OpenchannelInteraction']['find'](_0x7db42d)['then'](handleEntityNotFound(_0x518a51,null))[_0x01ec('0x29')](respondWithResult(_0x518a51,null))[_0x01ec('0x35')](handleError(_0x518a51,null));};exports[_0x01ec('0xb6')]=function(_0xb24255,_0x4506c8){return db[_0x01ec('0x36')]['create'](_0xb24255[_0x01ec('0x71')],{})[_0x01ec('0x29')](respondWithResult(_0x4506c8,0xc9))[_0x01ec('0x35')](handleError(_0x4506c8,null));};exports[_0x01ec('0x28')]=function(_0x336a5d,_0x149afd){if(_0x336a5d[_0x01ec('0x71')]['id']){delete _0x336a5d['body']['id'];}return db[_0x01ec('0x36')][_0x01ec('0x5f')]({'where':{'id':_0x336a5d[_0x01ec('0xb3')]['id']}})[_0x01ec('0x29')](handleEntityNotFound(_0x149afd,null))[_0x01ec('0x29')](saveUpdates(_0x336a5d[_0x01ec('0x71')],null))[_0x01ec('0x29')](respondWithResult(_0x149afd,null))[_0x01ec('0x35')](handleError(_0x149afd,null));};exports['destroy']=function(_0x35f4a5,_0x15f766){return db['OpenchannelInteraction'][_0x01ec('0x5f')]({'where':{'id':_0x35f4a5['params']['id']}})[_0x01ec('0x29')](handleEntityNotFound(_0x15f766,null))[_0x01ec('0x29')](removeEntity(_0x15f766,null))[_0x01ec('0x35')](handleError(_0x15f766,null));};exports[_0x01ec('0xb7')]=function(_0x2b3277,_0x369420){return db['OpenchannelInteraction'][_0x01ec('0xb7')]()[_0x01ec('0x29')](respondWithResult(_0x369420,null))['catch'](handleError(_0x369420,null));};exports[_0x01ec('0xb8')]=function(_0x58b7e9,_0x170ec1,_0x3bb4b7){return db[_0x01ec('0xb9')][_0x01ec('0x5f')]({'where':{'id':_0x58b7e9[_0x01ec('0xb3')]['id']}})[_0x01ec('0x29')](handleEntityNotFound(_0x170ec1,null))[_0x01ec('0x29')](function(_0x53e830){if(_0x53e830){return _0x53e830[_0x01ec('0xb8')](_0x58b7e9['body']['ids'],_[_0x01ec('0xba')](_0x58b7e9[_0x01ec('0x71')],[_0x01ec('0xbb'),'id'])||{});}})['then'](respondWithResult(_0x170ec1,null))[_0x01ec('0x35')](handleError(_0x170ec1,null));};exports[_0x01ec('0xbc')]=function(_0x33aaf8,_0x2de084,_0x4a895d){var _0x25845a={'raw':![],'where':{}};var _0x4f2b3f={};var _0x230649={'count':0x0,'rows':[]};return db[_0x01ec('0x36')]['findOne']({'where':{'id':_0x33aaf8[_0x01ec('0xb3')]['id']}})[_0x01ec('0x29')](handleEntityNotFound(_0x2de084,null))[_0x01ec('0x29')](function(_0x5cd340){if(_0x5cd340){_0x4f2b3f['model']=_[_0x01ec('0x3a')](db[_0x01ec('0xb9')][_0x01ec('0x37')]);_0x4f2b3f['query']=_[_0x01ec('0x3a')](_0x33aaf8[_0x01ec('0x3b')]);_0x4f2b3f['filters']=_[_0x01ec('0x3c')](_0x4f2b3f['model'],_0x4f2b3f[_0x01ec('0x3b')]);_0x25845a['attributes']=_[_0x01ec('0x3c')](_0x4f2b3f[_0x01ec('0x3d')],qs['fields'](_0x33aaf8[_0x01ec('0x3b')]['fields']));_0x25845a[_0x01ec('0x3e')]=_0x25845a[_0x01ec('0x3e')]['length']?_0x25845a['attributes']:_0x4f2b3f[_0x01ec('0x3d')];if(!_0x33aaf8[_0x01ec('0x3b')]['hasOwnProperty'](_0x01ec('0x42'))){_0x25845a[_0x01ec('0x24')]=qs[_0x01ec('0x24')](_0x33aaf8[_0x01ec('0x3b')][_0x01ec('0x24')]);_0x25845a[_0x01ec('0x22')]=qs[_0x01ec('0x22')](_0x33aaf8[_0x01ec('0x3b')]['offset']);}_0x25845a['order']=qs[_0x01ec('0x44')](_0x33aaf8[_0x01ec('0x3b')]['sort']);_0x25845a[_0x01ec('0x45')]=qs[_0x01ec('0x46')](_[_0x01ec('0xbd')](_0x33aaf8[_0x01ec('0x3b')],_0x4f2b3f[_0x01ec('0x46')]));_0x25845a[_0x01ec('0x45')][_0x01ec('0xb0')]=_0x5cd340['id'];if(_0x33aaf8[_0x01ec('0x3b')][_0x01ec('0x82')]){_0x25845a[_0x01ec('0x45')]=_['merge'](_0x25845a[_0x01ec('0x45')],{'$or':_[_0x01ec('0x2f')](_0x25845a[_0x01ec('0x3e')],function(_0x5515c3){var _0x11ee31={};_0x11ee31[_0x5515c3]={'$like':'%'+_0x33aaf8[_0x01ec('0x3b')][_0x01ec('0x82')]+'%'};return _0x11ee31;})});}if(_0x33aaf8[_0x01ec('0x3b')][_0x01ec('0xbe')]){var _0x1d8da9=_0x33aaf8['query'][_0x01ec('0xbe')][_0x01ec('0x66')](',');var _0x1eb021={};_0x1eb021[_0x1d8da9[0x0]]={'$gte':moment(_0x1d8da9[0x1])[_0x01ec('0xbf')](_0x01ec('0xc0'))};_0x25845a['where']=_[_0x01ec('0xc1')](_0x25845a[_0x01ec('0x45')],_0x1eb021);}_0x25845a=_[_0x01ec('0xc1')]({},_0x25845a,_0x33aaf8['options']);return db[_0x01ec('0xb9')][_0x01ec('0x25')]({'where':_0x25845a[_0x01ec('0x45')]})[_0x01ec('0x29')](function(_0x3ce80e){_0x230649[_0x01ec('0x25')]=_0x3ce80e;if(_0x33aaf8[_0x01ec('0x3b')][_0x01ec('0xb4')]){_0x25845a[_0x01ec('0xb5')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x01ec('0xc2')](_0x25845a);})[_0x01ec('0x29')](function(_0x14c1bd){_0x230649[_0x01ec('0xb2')]=_0x14c1bd;return _0x230649;});}})[_0x01ec('0x29')](respondWithFilteredResult(_0x2de084,_0x25845a))[_0x01ec('0x35')](handleError(_0x2de084,null));};exports[_0x01ec('0xc3')]=function(_0xb429dd,_0x22c134,_0x1c7cbc){return db['OpenchannelInteraction'][_0x01ec('0x5f')]({'where':{'id':_0xb429dd[_0x01ec('0xb3')]['id']}})[_0x01ec('0x29')](handleEntityNotFound(_0x22c134,null))[_0x01ec('0x29')](function(_0x452e30){if(_0x452e30){return _0x452e30[_0x01ec('0xc4')](_0xb429dd['body'][_0x01ec('0xbb')],_[_0x01ec('0xba')](_0xb429dd[_0x01ec('0x71')],['ids','id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id','name',_0x01ec('0xc5')],'where':{'id':_0xb429dd[_0x01ec('0x71')][_0x01ec('0xbb')]}});})[_0x01ec('0x29')](function(_0x5a701c){socket[_0x01ec('0xc6')](_0x01ec('0xc7'),{'id':Number(_0xb429dd[_0x01ec('0xb3')]['id']),'tags':_0x5a701c||[]});return{'id':Number(_0xb429dd[_0x01ec('0xb3')]['id']),'tags':_0x5a701c||[]};});}})[_0x01ec('0x29')](respondWithResult(_0x22c134,null))['catch'](handleError(_0x22c134,null));};exports[_0x01ec('0xc8')]=function(_0xa5cd5,_0x296db6,_0x1743f9){return db[_0x01ec('0x36')]['find']({'where':{'id':_0xa5cd5[_0x01ec('0xb3')]['id']}})['then'](handleEntityNotFound(_0x296db6,null))[_0x01ec('0x29')](function(_0xdfc12){if(_0xdfc12){return _0xdfc12['removeTags'](_0xa5cd5['query'][_0x01ec('0xbb')]);}})[_0x01ec('0x29')](respondWithStatusCode(_0x296db6,null))[_0x01ec('0x35')](handleError(_0x296db6,null));};exports['download']=function(_0x495f7e,_0x1e89b1){var _0x2c1ba3=moment()['unix']()[_0x01ec('0x9a')]();var _0x69036a=path[_0x01ec('0xc9')](config['root'],'server','files',_0x01ec('0xca'));var _0x4bd981=path[_0x01ec('0xc9')](config[_0x01ec('0xcb')],_0x01ec('0xcc'),'files',_0x01ec('0xcd'));var _0x317a38=path['join'](_0x69036a,_0x2c1ba3);var _0x553f82=util[_0x01ec('0xbf')]('transcript-%d-%s.zip',_0x495f7e[_0x01ec('0xb3')]['id'],_0x2c1ba3);var _0xb0b3dd=path['join'](_0x69036a,_0x553f82);var _0x43a7a4=[];_0x43a7a4[_0x01ec('0x34')]({'model':db[_0x01ec('0x6d')],'as':'User','attributes':['id',_0x01ec('0x30')],'raw':!![]});_0x43a7a4[_0x01ec('0x34')]({'model':db[_0x01ec('0xce')],'as':'Contact','attributes':['id','firstName',_0x01ec('0xcf')],'raw':!![]});if(_0x495f7e[_0x01ec('0x3b')]['attachments']){_0x43a7a4['push']({'model':db[_0x01ec('0xd0')],'as':_0x01ec('0xd0'),'raw':!![]});}var _0x38375d=[{'model':db[_0x01ec('0xb9')],'as':_0x01ec('0xd1'),'attributes':['id',_0x01ec('0x71'),_0x01ec('0x79'),_0x01ec('0xd2'),'secret','read'],'include':_0x43a7a4}];_0x38375d[_0x01ec('0x34')]({'model':db[_0x01ec('0xd3')],'as':_0x01ec('0xd4'),'attributes':['id','name']});_0x38375d['push']({'model':db[_0x01ec('0x6d')],'as':_0x01ec('0xd5'),'attributes':['id',_0x01ec('0x30')]});return db[_0x01ec('0x36')][_0x01ec('0x5f')]({'where':{'id':_0x495f7e[_0x01ec('0xb3')]['id']},'include':_0x38375d})['then'](handleEntityNotFound(_0x1e89b1,null))[_0x01ec('0x29')](function(_0x517729){if(_0x517729){var _0x5eb9da=_0x517729[_0x01ec('0xd6')]({'plain':!![]});fs[_0x01ec('0xd7')](_0x317a38);var _0x44a1de={'channel':_0x01ec('0xd8'),'account':_0x5eb9da['Account'][_0x01ec('0x2c')],'agent':_0x5eb9da[_0x01ec('0xd5')]?_0x5eb9da[_0x01ec('0xd5')][_0x01ec('0x30')]:_0x01ec('0xd9'),'createdAt':moment(_0x5eb9da['createdAt'])[_0x01ec('0xbf')](_0x01ec('0xc0'))[_0x01ec('0x9a')](),'closedAt':_0x5eb9da['closed']?moment(_0x5eb9da['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x01ec('0x9a')]():'','disposition':_0x5eb9da[_0x01ec('0xda')],'visibility':_0x5eb9da['threadId']?'Public':_0x01ec('0xdb'),'messages':_(_0x5eb9da['Messages'])[_0x01ec('0x82')]({'secret':![]})['map'](function(_0x1fe06b){if(_0x1fe06b[_0x01ec('0xd0')]){var _0x4aae7f=path['join'](_0x4bd981,_0x1fe06b[_0x01ec('0xd0')][_0x01ec('0xdc')]);if(fs[_0x01ec('0xdd')](_0x4aae7f)){fs[_0x01ec('0xde')](_0x4aae7f)[_0x01ec('0xdf')](fs[_0x01ec('0xe0')](path[_0x01ec('0xc9')](_0x317a38,_0x1fe06b[_0x01ec('0xd0')]['basename'])));}}return{'date':moment(_0x1fe06b[_0x01ec('0x79')])[_0x01ec('0xbf')](_0x01ec('0xc0'))[_0x01ec('0x9a')](),'sender':_0x1fe06b[_0x01ec('0xd2')]===_0x01ec('0xe1')?_0x1fe06b[_0x01ec('0x6d')]?_0x1fe06b['User'][_0x01ec('0x30')]:_0x01ec('0xe2'):_0x1fe06b['Contact'][_0x01ec('0xe3')]+(_0x1fe06b[_0x01ec('0x64')]['lastName']?'\x20'+_0x1fe06b['Contact'][_0x01ec('0xcf')]:''),'body':_0x1fe06b[_0x01ec('0xd0')]?_0x1fe06b[_0x01ec('0xd0')]['basename']:_0x1fe06b[_0x01ec('0x71')],'direction':_0x1fe06b[_0x01ec('0xd2')]===_0x01ec('0xe1')?'A':'C','secret':_0x1fe06b[_0x01ec('0xe4')],'read':_0x1fe06b[_0x01ec('0x7d')],'attachment':_0x1fe06b[_0x01ec('0xd0')]};})['value']()};return ejs[_0x01ec('0xe5')](path[_0x01ec('0xc9')](config[_0x01ec('0xcb')],_0x01ec('0xcc'),'views',_0x01ec('0xe6')),{'interaction':_0x44a1de})[_0x01ec('0x29')](function(_0x32d94d){var _0xe8e3b0=path['join'](_0x317a38,_0x01ec('0xe7')+_0x5eb9da['id']+'-'+_0x2c1ba3+_0x01ec('0xe8'));var _0x3f5d77={'path':_0xe8e3b0,'channel':_0x01ec('0xd8'),'interactionId':_0x5eb9da['id']};return pdf[_0x01ec('0xe9')](_0x32d94d,_0x3f5d77);})[_0x01ec('0x29')](function(){return new BPromise(function(_0x1f804c,_0x4f1399){zipdir(_0x317a38,{'saveTo':_0xb0b3dd},function(_0x5057a7,_0x316a0e){if(_0x5057a7)return _0x4f1399(_0x5057a7);return _0x1f804c(_0x316a0e);});})[_0x01ec('0x29')](function(){return new BPromise(function(_0x392ce6,_0x909595){rimraf(_0x317a38,function(_0x584242){if(_0x584242)_0x909595(_0x584242);return _0x392ce6();});});})[_0x01ec('0x29')](function(){return _0x1e89b1[_0x01ec('0xea')](_0xb0b3dd,_0x553f82,function(_0x4731cf){if(_0x4731cf){console[_0x01ec('0xeb')](_0x01ec('0xec'),_0x4731cf);}else{fs['unlinkSync'](_0xb0b3dd);}});});});}else{return _0x1e89b1[_0x01ec('0x1e')](0xc8);}})[_0x01ec('0x35')](handleError(_0x1e89b1,null));}; \ No newline at end of file +var _0x29e0=['spread','Tag','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','CmContact','firstName','lastName','Attachment','Messages','direction','OpenchannelAccount','Owner','mkdirSync','Openchannel','N.A.','closed','closedAt','threadId','Public','Private','basename','existsSync','pipe','createWriteStream','out','secret','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','stack','name','Users','map','fullname','split','forEach','Tags','TagIds','catch','OpenchannelInteraction','rawAttributes','type','key','query','keys','model','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filters','select','field','color','tools_tags','u.id','u.fullname','from','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','left_join','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','some','compact','isEmpty','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','t.id\x20IN\x20?','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','user','agent','sequelize','toString','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','OpenchannelInteractionId','all','show','params','fields','includeAll','merge','options','create','body','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x29e0,0x117));var _0x029e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x029e('0x0'));var rimraf=require(_0x029e('0x1'));var zipdir=require(_0x029e('0x2'));var jsonpatch=require(_0x029e('0x3'));var rp=require(_0x029e('0x4'));var moment=require(_0x029e('0x5'));var BPromise=require(_0x029e('0x6'));var Mustache=require(_0x029e('0x7'));var util=require(_0x029e('0x8'));var path=require(_0x029e('0x9'));var sox=require(_0x029e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x029e('0xb'));var _=require(_0x029e('0xc'));var squel=require('squel');var crypto=require(_0x029e('0xd'));var jsforce=require(_0x029e('0xe'));var deskjs=require(_0x029e('0xf'));var toCsv=require(_0x029e('0x10'));var querystring=require(_0x029e('0x11'));var Papa=require(_0x029e('0x12'));var Redis=require(_0x029e('0x13'));var authService=require(_0x029e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x029e('0x15'));var pdf=require(_0x029e('0x16'));var hardwareService=require(_0x029e('0x17'));var logger=require(_0x029e('0x18'))(_0x029e('0x19'));var utils=require(_0x029e('0x1a'));var config=require(_0x029e('0x1b'));var licenseUtil=require(_0x029e('0x1c'));var db=require(_0x029e('0x1d'))['db'];config[_0x029e('0x1e')]=_[_0x029e('0x1f')](config[_0x029e('0x1e')],{'host':_0x029e('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x029e('0x1e')]));require(_0x029e('0x21'))[_0x029e('0x22')](socket);function respondWithStatusCode(_0x4a8914,_0x11eab3){_0x11eab3=_0x11eab3||0xcc;return function(_0x311834){if(_0x311834){return _0x4a8914[_0x029e('0x23')](_0x11eab3);}return _0x4a8914[_0x029e('0x24')](_0x11eab3)[_0x029e('0x25')]();};}function respondWithResult(_0x54ef54,_0x261489){_0x261489=_0x261489||0xc8;return function(_0x5613bf){if(_0x5613bf){return _0x54ef54['status'](_0x261489)[_0x029e('0x26')](_0x5613bf);}};}function respondWithFilteredResult(_0xc22c3a,_0x2d362d){return function(_0x52384d){if(_0x52384d){var _0xba84bc=typeof _0x2d362d[_0x029e('0x27')]===_0x029e('0x28')&&typeof _0x2d362d[_0x029e('0x29')]===_0x029e('0x28');var _0xf4bd10=_0x52384d[_0x029e('0x2a')];var _0x4ea2fa=_0xba84bc?0x0:_0x2d362d[_0x029e('0x27')];var _0x4f2e86=_0xba84bc?_0x52384d['count']:_0x2d362d[_0x029e('0x27')]+_0x2d362d[_0x029e('0x29')];var _0x4ce66d;if(_0x4f2e86>=_0xf4bd10){_0x4f2e86=_0xf4bd10;_0x4ce66d=0xc8;}else{_0x4ce66d=0xce;}_0xc22c3a[_0x029e('0x24')](_0x4ce66d);return _0xc22c3a[_0x029e('0x2b')](_0x029e('0x2c'),_0x4ea2fa+'-'+_0x4f2e86+'/'+_0xf4bd10)['json'](_0x52384d);}return null;};}function patchUpdates(_0x4308fb){return function(_0x2d2758){try{jsonpatch[_0x029e('0x2d')](_0x2d2758,_0x4308fb,!![]);}catch(_0x35f98e){return BPromise['reject'](_0x35f98e);}return _0x2d2758['save']();};}function saveUpdates(_0x281ca7,_0x58bd88){return function(_0x19d803){if(_0x19d803){return _0x19d803[_0x029e('0x2e')](_0x281ca7)[_0x029e('0x2f')](function(_0x1df2ef){return _0x1df2ef;});}return null;};}function removeEntity(_0x5d0ffb,_0x434717){return function(_0x4336ac){if(_0x4336ac){return _0x4336ac[_0x029e('0x30')]()['then'](function(){_0x5d0ffb[_0x029e('0x24')](0xcc)[_0x029e('0x25')]();});}};}function handleEntityNotFound(_0x5e459c,_0x1e542c){return function(_0x29ef67){if(!_0x29ef67){_0x5e459c[_0x029e('0x23')](0x194);}return _0x29ef67;};}function handleError(_0x5ae45b,_0xab1de6){_0xab1de6=_0xab1de6||0x1f4;return function(_0x5e96a6){logger['error'](_0x5e96a6[_0x029e('0x31')]);if(_0x5e96a6[_0x029e('0x32')]){delete _0x5e96a6[_0x029e('0x32')];}_0x5ae45b[_0x029e('0x24')](_0xab1de6)['send'](_0x5e96a6);};}function getInteractionUsers(_0x60883,_0x26e30d){return new BPromise(function(_0xc19756,_0x4f5230){try{if(_0x26e30d[_0x60883['id']]){_0x60883[_0x029e('0x33')]=_[_0x029e('0x34')](_0x26e30d[_0x60883['id']],function(_0x1a1c7d){return{'id':_0x1a1c7d['id'],'fullname':_0x1a1c7d[_0x029e('0x35')]};});}}catch(_0x298d0c){_0x4f5230(_0x298d0c);}_0xc19756(_0x60883);});}function getInteractionTags(_0x2709b1,_0x1fee58){return new BPromise(function(_0x1dc6e1,_0x5ba765){try{if(_0x2709b1['TagIds']){_0x2709b1['Tags']=[];_0x2709b1['TagIds'][_0x029e('0x36')](',')[_0x029e('0x37')](function(_0x4e83b2){_0x2709b1[_0x029e('0x38')]['push'](_0x1fee58[_0x4e83b2]);});}delete _0x2709b1[_0x029e('0x39')];}catch(_0x13d850){_0x5ba765(_0x13d850);}_0x1dc6e1(_0x2709b1);});}function updateOpenchannelInteraction(_0x1a2fca,_0x15f6b9,_0x3d4b1b){return new BPromise(function(_0x12ba13,_0x169ceb){return getInteractionUsers(_0x1a2fca,_0x3d4b1b)[_0x029e('0x2f')](function(_0x3870c0){return getInteractionTags(_0x3870c0,_0x15f6b9);})['then'](function(_0x2a3bc2){_0x12ba13(_0x2a3bc2);})[_0x029e('0x3a')](function(_0x6fb20e){_0x169ceb(_0x6fb20e);});});}exports['index']=function(_0x1a8f28,_0x326f06){var _0x4aeb3f={},_0x51532b={},_0x5b78eb={'count':0x0,'rows':[]};var _0x131f12=_[_0x029e('0x34')](db[_0x029e('0x3b')][_0x029e('0x3c')],function(_0x1541f9){return{'name':_0x1541f9['fieldName'],'type':_0x1541f9[_0x029e('0x3d')][_0x029e('0x3e')]};});_0x51532b['model']=_[_0x029e('0x34')](_0x131f12,_0x029e('0x32'));_0x51532b[_0x029e('0x3f')]=_[_0x029e('0x40')](_0x1a8f28[_0x029e('0x3f')]);_0x51532b['filters']=_['intersection'](_0x51532b[_0x029e('0x41')],_0x51532b[_0x029e('0x3f')]);_0x4aeb3f[_0x029e('0x42')]=_[_0x029e('0x43')](_0x51532b['model'],qs['fields'](_0x1a8f28[_0x029e('0x3f')]['fields']));_0x4aeb3f[_0x029e('0x42')]=_0x4aeb3f[_0x029e('0x42')]['length']?_0x4aeb3f[_0x029e('0x42')]:_0x51532b[_0x029e('0x41')];if(!_0x1a8f28[_0x029e('0x3f')][_0x029e('0x44')](_0x029e('0x45'))){_0x4aeb3f['limit']=qs[_0x029e('0x29')](_0x1a8f28['query'][_0x029e('0x29')]);_0x4aeb3f[_0x029e('0x27')]=qs[_0x029e('0x27')](_0x1a8f28['query'][_0x029e('0x27')]);}_0x4aeb3f[_0x029e('0x46')]=qs[_0x029e('0x47')](_0x1a8f28[_0x029e('0x3f')][_0x029e('0x47')]);_0x4aeb3f[_0x029e('0x48')]=qs['filters'](_[_0x029e('0x49')](_0x1a8f28[_0x029e('0x3f')],_0x51532b[_0x029e('0x4a')]),_0x131f12);var _0x388c98=[];var _0x2743d0=squel[_0x029e('0x4b')]()['field']('id')[_0x029e('0x4c')](_0x029e('0x32'))[_0x029e('0x4c')](_0x029e('0x4d'))['from'](_0x029e('0x4e'));var _0x6bf545=squel['select']()[_0x029e('0x4c')](_0x029e('0x4f'))[_0x029e('0x4c')](_0x029e('0x50'))[_0x029e('0x4c')]('ui.OpenchannelInteractionId')[_0x029e('0x51')](_0x029e('0x52'),'ui')['left_join'](_0x029e('0x53'),'u',_0x029e('0x54'));var _0x2c32cd=squel['select']()['from']('openchannel_interactions','i')['left_join'](_0x029e('0x55'),'c',_0x029e('0x56'))['left_join'](_0x029e('0x53'),'o',_0x029e('0x57'))[_0x029e('0x58')](_0x029e('0x59'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0x029e('0x58')](_0x029e('0x5a'),'me',_0x029e('0x5b'))[_0x029e('0x58')](_0x029e('0x5c'),'it',_0x029e('0x5d'))[_0x029e('0x58')](_0x029e('0x4e'),'t','t.id\x20=\x20it.TagId');var _0x160ba0=squel[_0x029e('0x5e')]();var _0x503b88=[];var _0x19a7e2=squel[_0x029e('0x5e')]();var _0x930809;if(_0x1a8f28['query'][_0x029e('0x5f')]){_0x930809=as[_0x029e('0x60')](_0x1a8f28[_0x029e('0x3f')][_0x029e('0x5f')]);var _0x3b2205=_0x930809['sqlOperator'];for(var _0x2b32ba=0x0;_0x2b32ba<_0x930809[_0x029e('0x61')][_0x029e('0x62')];_0x2b32ba++){var _0xb434d0=_0x930809['conditions'][_0x2b32ba];var _0x52a7c7='i';var _0x200064=_[_0x029e('0x63')](_0x131f12,[_0x029e('0x32'),_0xb434d0[_0x029e('0x4c')]]);if(!_0x200064){switch(_0xb434d0[_0x029e('0x4c')]){case _0x029e('0x64'):if(_0xb434d0[_0x029e('0x65')]==0x1){_0x2c32cd[_0x029e('0x66')]('`'+_0xb434d0[_0x029e('0x4c')]+_0x029e('0x67'));}else{_0x2c32cd['having']('`'+_0xb434d0[_0x029e('0x4c')]+_0x029e('0x68'));}break;case _0x029e('0x69'):if(_0xb434d0[_0x029e('0x6a')]===_0x029e('0x6b')){if(_0xb434d0[_0x029e('0x65')][_0x029e('0x36')]('\x20')['length']>0x1){_0x160ba0[_0x3b2205](_0x029e('0x6c'),qs[_0x029e('0x6d')](_0xb434d0[_0x029e('0x65')]),null);}else{var _0xab1e5a='%'+_0xb434d0[_0x029e('0x65')]+'%';_0x160ba0[_0x3b2205](_0x029e('0x6e'),_0xab1e5a,_0xab1e5a,_0xab1e5a);}}else{_0x200064=_[_0x029e('0x63')](_0x131f12,['name',_0x029e('0x6f')]);_0xb434d0[_0x029e('0x4c')]=_0x029e('0x6f');_0x2b0a43=as[_0x029e('0x70')](_0x52a7c7,_0x200064[_0x029e('0x3d')],_0xb434d0);_0x160ba0[_0x3b2205](_0x2b0a43[_0x029e('0x71')],_0x2b0a43[_0x029e('0x65')][_0x029e('0x72')],_0x2b0a43[_0x029e('0x65')][_0x029e('0x25')]);}break;case'Tag':var _0xdbd85=_0xb434d0['value'][_0x029e('0x36')](',')[_0x029e('0x34')](function(_0x57493f){return Number(_0x57493f);});_0xdbd85[_0x029e('0x37')](function(_0x3e8855){_0x19a7e2['or'](_0x029e('0x73'),'%,'+_0x3e8855+',%');});_0x503b88=_[_0x029e('0x74')](_0x503b88,_0xdbd85);break;case _0x029e('0x75'):if(_0xb434d0['operator']===_0x029e('0x6b')){_0x160ba0[_0x3b2205]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xb434d0[_0x029e('0x65')]+'%',null);}else{_0x200064=_[_0x029e('0x63')](_0x131f12,[_0x029e('0x32'),_0x029e('0x76')]);_0xb434d0[_0x029e('0x4c')]='UserId';_0x2b0a43=as[_0x029e('0x70')](_0x52a7c7,_0x200064[_0x029e('0x3d')],_0xb434d0);_0x160ba0[_0x3b2205](_0x2b0a43['text'],_0x2b0a43[_0x029e('0x65')][_0x029e('0x72')],_0x2b0a43[_0x029e('0x65')][_0x029e('0x25')]);}break;case'body':_0x2b0a43=as['buildExpression']('me',null,_0xb434d0);_0x160ba0[_0x3b2205](_0x2b0a43[_0x029e('0x71')],_0x2b0a43[_0x029e('0x65')][_0x029e('0x72')],_0x2b0a43[_0x029e('0x65')][_0x029e('0x25')]);break;}}else{var _0x2b0a43=as[_0x029e('0x70')](_0x52a7c7,_0x200064[_0x029e('0x3d')],_0xb434d0);_0x160ba0[_0x3b2205](_0x2b0a43['text'],_0x2b0a43[_0x029e('0x65')][_0x029e('0x72')],_0x2b0a43[_0x029e('0x65')]['end']);}}}else{var _0x27ff12=_(_0x1a8f28[_0x029e('0x3f')])[_0x029e('0x40')]()[_0x029e('0x34')](function(_0x4a1558){return _[_0x029e('0x77')](_0x131f12,[_0x029e('0x32'),_0x4a1558])?_0x4a1558:undefined;})[_0x029e('0x78')]()[_0x029e('0x65')]();if(!_[_0x029e('0x79')](_0x27ff12)){_0x27ff12['forEach'](function(_0x29afa7){if(_0x29afa7==='OpenchannelAccountId'){_0x2c32cd[_0x029e('0x48')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x029e('0x7a')](_0x1a8f28[_0x029e('0x3f')][_0x29afa7]));}else if(_0x29afa7===_0x029e('0x7b')){var _0x418c2a=JSON[_0x029e('0x7c')](_0x1a8f28[_0x029e('0x3f')][_0x29afa7])[_0x029e('0x7d')];var _0x54d3f7=JSON[_0x029e('0x7c')](_0x1a8f28[_0x029e('0x3f')][_0x29afa7])[_0x029e('0x7e')];_0x2c32cd['where'](_0x029e('0x7f'),_0x418c2a,_0x54d3f7);}else{if(_0x1a8f28[_0x029e('0x3f')][_0x29afa7]===_0x029e('0x80')){_0x2c32cd[_0x029e('0x48')]('i.'+_0x29afa7+_0x029e('0x81'));}else{_0x2c32cd[_0x029e('0x48')]('i.'+_0x29afa7+_0x029e('0x82'),_0x1a8f28['query'][_0x29afa7]);}}});}if(_0x1a8f28['query']['read']){if(_0x1a8f28[_0x029e('0x3f')][_0x029e('0x83')]==0x1){_0x2c32cd[_0x029e('0x66')](_0x029e('0x84'));}else{_0x2c32cd[_0x029e('0x66')]('`unreadMessages`\x20>\x200');}}if(_0x1a8f28[_0x029e('0x3f')][_0x029e('0x85')]){_0x503b88=_[_0x029e('0x86')](_0x1a8f28[_0x029e('0x3f')][_0x029e('0x85')])?_0x1a8f28['query']['tag']:new Array(_0x1a8f28[_0x029e('0x3f')][_0x029e('0x85')]);_0x503b88[_0x029e('0x37')](function(_0x5216f8){_0x19a7e2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5216f8+',%');});}if(_0x1a8f28[_0x029e('0x3f')]['filter']){var _0x3dbfbd=_0x1a8f28[_0x029e('0x3f')][_0x029e('0x87')]['replace']('\x5c','\x5c\x5c')[_0x029e('0x88')](/'/g,'\x27\x27');if(qs[_0x029e('0x89')](_0x3dbfbd)){_0x160ba0['or'](_0x029e('0x8a'),_0x3dbfbd+'%');}else{_0x160ba0['or'](_0x029e('0x8b'),qs[_0x029e('0x6d')](_0x3dbfbd))['or']('i.from\x20LIKE\x20?',_0x3dbfbd+'%')['or'](_0x029e('0x8c'),_0x3dbfbd+'%');}}}_0x2c32cd[_0x029e('0x48')](_0x160ba0);_0x2c32cd['group'](_0x029e('0x8d'));var _0x218b75={'type':db[_0x029e('0x8e')][_0x029e('0x8f')][_0x029e('0x90')],'raw':!![]};var _0x30ae2e=_0x2c32cd[_0x029e('0x91')]();_0x30ae2e['field']('i.id');_0x30ae2e[_0x029e('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x4aeb3f['order']){_0x4aeb3f[_0x029e('0x46')][_0x029e('0x37')](function(_0x3e5a30){var _0x651032=_0x3e5a30[0x0]==='contactName'?_0x3e5a30[0x0]:'i.'+_0x3e5a30[0x0];_0x2c32cd[_0x029e('0x46')](_0x651032,_0x3e5a30[0x1]==='DESC'?![]:!![]);});}if(!_[_0x029e('0x79')](_0x503b88)){_0x2c32cd[_0x029e('0x66')](_0x19a7e2);_0x30ae2e[_0x029e('0x48')](_0x029e('0x92'),_0x503b88);}BPromise['resolve']()['then'](function(){if(!_0x930809){if(_0x1a8f28[_0x029e('0x3f')][_0x029e('0x93')])return;_0x30ae2e[_0x029e('0x48')](_0x029e('0x94'));_0x2c32cd[_0x029e('0x48')](_0x029e('0x94'));return;}if(_0x1a8f28['user'][_0x029e('0x95')]!=='agent')return;return _0x1a8f28['user'][_0x029e('0x96')]({'attributes':['id'],'raw':!![]})[_0x029e('0x2f')](function(_0x533b04){if(_[_0x029e('0x79')](_0x533b04)){_0x30ae2e['where'](_0x029e('0x97'));_0x2c32cd[_0x029e('0x48')](_0x029e('0x97'));}else{_0x30ae2e['where'](_0x029e('0x98'),_[_0x029e('0x34')](_0x533b04,'id'));_0x2c32cd[_0x029e('0x48')](_0x029e('0x98'),_[_0x029e('0x34')](_0x533b04,'id'));}});})['then'](function(){if(_0x1a8f28[_0x029e('0x99')][_0x029e('0x95')]===_0x029e('0x9a')&&!_0x930809&&!_0x1a8f28[_0x029e('0x3f')]['OpenchannelAccountId'])return[];return db[_0x029e('0x9b')][_0x029e('0x3f')](_0x30ae2e[_0x029e('0x9c')](),_0x218b75);})[_0x029e('0x2f')](function(_0x2dd112){_0x5b78eb['count']=_0x2dd112['length'];if(_0x5b78eb[_0x029e('0x2a')]===0x0)return[];return db[_0x029e('0x9b')][_0x029e('0x3f')](_0x2743d0[_0x029e('0x9c')](),_0x218b75)['then'](function(_0x147e40){_0x388c98=_['keyBy'](_0x147e40,'id');_0x218b75=_['merge'](_0x218b75,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1a8f28['query']['fields']){_0x4aeb3f[_0x029e('0x42')][_0x029e('0x37')](function(_0x2b8aad){_0x2c32cd[_0x029e('0x4c')]('i.'+_0x2b8aad);});}else{_0x2c32cd[_0x029e('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x029e('0x64'));_0x2c32cd[_0x029e('0x4c')]('a.key',_0x029e('0x9d'));_0x2c32cd[_0x029e('0x4c')](_0x029e('0x9e'),'Account.mandatoryDisposition');_0x2c32cd[_0x029e('0x4c')](_0x029e('0x9f'),_0x029e('0xa0'));_0x2c32cd['field']('i.*');_0x2c32cd[_0x029e('0x4c')](_0x029e('0xa1'),_0x029e('0xa2'));_0x2c32cd[_0x029e('0x4c')](_0x029e('0xa3'),_0x029e('0xa4'));_0x2c32cd[_0x029e('0x4c')](_0x029e('0xa5'),_0x029e('0xa6'));_0x2c32cd[_0x029e('0x4c')]('c.phone',_0x029e('0xa7'));_0x2c32cd[_0x029e('0x4c')](_0x029e('0xa8'),'Contact.mobile');_0x2c32cd[_0x029e('0x4c')](_0x029e('0xa9'),_0x029e('0xaa'));_0x2c32cd[_0x029e('0x4c')](_0x029e('0xab'),_0x029e('0xac'));_0x2c32cd[_0x029e('0x4c')]('o.internal','Owner.internal');_0x2c32cd[_0x029e('0x4c')](_0x029e('0xad'),'TagIds');}if(_0x4aeb3f['limit'])_0x2c32cd[_0x029e('0x29')](_0x4aeb3f[_0x029e('0x29')]);if(_0x4aeb3f['offset'])_0x2c32cd[_0x029e('0x27')](_0x4aeb3f[_0x029e('0x27')]);return db[_0x029e('0x9b')][_0x029e('0x3f')](_0x2c32cd[_0x029e('0x9c')](),_0x218b75);})[_0x029e('0x2f')](function(_0xe80a2f){if(_0xe80a2f[_0x029e('0x62')]>0x0)_0x6bf545[_0x029e('0x48')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x029e('0x34')](_0xe80a2f,'id'));return db[_0x029e('0x9b')][_0x029e('0x3f')](_0x6bf545[_0x029e('0x9c')](),_0x218b75)[_0x029e('0x2f')](function(_0x176f5d){var _0x34f7cb=_[_0x029e('0xae')](_0x176f5d,_0x029e('0xaf'));var _0x2ca41c=[];_0xe80a2f[_0x029e('0x37')](function(_0x55488a){_0x2ca41c['push'](updateOpenchannelInteraction(_0x55488a,_0x388c98,_0x34f7cb));});return BPromise[_0x029e('0xb0')](_0x2ca41c);});});})[_0x029e('0x2f')](function(_0x4d4294){_0x5b78eb['rows']=_0x4d4294;return _0x5b78eb;})['then'](respondWithFilteredResult(_0x326f06,_0x4aeb3f))[_0x029e('0x3a')](handleError(_0x326f06,null));};exports[_0x029e('0xb1')]=function(_0x321c5b,_0x44b8ef){var _0x3b5dfb={};if(_0x321c5b[_0x029e('0x3f')][_0x029e('0x3d')]&&_0x321c5b['query'][_0x029e('0x3d')]===_0x029e('0x51')){_0x3b5dfb[_0x029e('0x51')]=_0x321c5b[_0x029e('0xb2')]['id'];}else{_0x3b5dfb['id']=_0x321c5b[_0x029e('0xb2')]['id'];}var _0x305c20={'raw':![],'where':_0x3b5dfb},_0x5f3a0e={};_0x5f3a0e[_0x029e('0x41')]=_['keys'](db[_0x029e('0x3b')]['rawAttributes']);_0x5f3a0e[_0x029e('0x3f')]=_['keys'](_0x321c5b[_0x029e('0x3f')]);_0x5f3a0e[_0x029e('0x4a')]=_['intersection'](_0x5f3a0e[_0x029e('0x41')],_0x5f3a0e[_0x029e('0x3f')]);_0x305c20['attributes']=_[_0x029e('0x43')](_0x5f3a0e['model'],qs[_0x029e('0xb3')](_0x321c5b[_0x029e('0x3f')][_0x029e('0xb3')]));_0x305c20[_0x029e('0x42')]=_0x305c20[_0x029e('0x42')]['length']?_0x305c20[_0x029e('0x42')]:_0x5f3a0e[_0x029e('0x41')];if(_0x321c5b[_0x029e('0x3f')][_0x029e('0xb4')]){_0x305c20['include']=[{'all':!![]}];}_0x305c20=_[_0x029e('0xb5')]({},_0x305c20,_0x321c5b[_0x029e('0xb6')]);return db[_0x029e('0x3b')]['find'](_0x305c20)['then'](handleEntityNotFound(_0x44b8ef,null))[_0x029e('0x2f')](respondWithResult(_0x44b8ef,null))['catch'](handleError(_0x44b8ef,null));};exports['create']=function(_0x380e83,_0x26d346){return db['OpenchannelInteraction'][_0x029e('0xb7')](_0x380e83[_0x029e('0xb8')],{})[_0x029e('0x2f')](respondWithResult(_0x26d346,0xc9))[_0x029e('0x3a')](handleError(_0x26d346,null));};exports[_0x029e('0x2e')]=function(_0x17e329,_0x23da5c){if(_0x17e329[_0x029e('0xb8')]['id']){delete _0x17e329[_0x029e('0xb8')]['id'];}return db['OpenchannelInteraction'][_0x029e('0x63')]({'where':{'id':_0x17e329[_0x029e('0xb2')]['id']}})[_0x029e('0x2f')](handleEntityNotFound(_0x23da5c,null))[_0x029e('0x2f')](saveUpdates(_0x17e329[_0x029e('0xb8')],null))[_0x029e('0x2f')](respondWithResult(_0x23da5c,null))[_0x029e('0x3a')](handleError(_0x23da5c,null));};exports[_0x029e('0x30')]=function(_0x3c3e8d,_0x369a12){return db[_0x029e('0x3b')][_0x029e('0x63')]({'where':{'id':_0x3c3e8d[_0x029e('0xb2')]['id']}})[_0x029e('0x2f')](handleEntityNotFound(_0x369a12,null))[_0x029e('0x2f')](removeEntity(_0x369a12,null))[_0x029e('0x3a')](handleError(_0x369a12,null));};exports[_0x029e('0xb9')]=function(_0x243d79,_0x4ca07e){return db[_0x029e('0x3b')][_0x029e('0xb9')]()[_0x029e('0x2f')](respondWithResult(_0x4ca07e,null))[_0x029e('0x3a')](handleError(_0x4ca07e,null));};exports[_0x029e('0xba')]=function(_0x4a7a70,_0x26a984,_0x15dddd){return db[_0x029e('0xbb')]['find']({'where':{'id':_0x4a7a70[_0x029e('0xb2')]['id']}})[_0x029e('0x2f')](handleEntityNotFound(_0x26a984,null))[_0x029e('0x2f')](function(_0x16ec42){if(_0x16ec42){return _0x16ec42[_0x029e('0xba')](_0x4a7a70['body']['ids'],_[_0x029e('0xbc')](_0x4a7a70[_0x029e('0xb8')],[_0x029e('0xbd'),'id'])||{});}})[_0x029e('0x2f')](respondWithResult(_0x26a984,null))['catch'](handleError(_0x26a984,null));};exports[_0x029e('0xbe')]=function(_0x4ceefd,_0x165fe4,_0x490990){var _0x25595c={'raw':![],'where':{}};var _0x4d9fd0={};var _0x590048={'count':0x0,'rows':[]};return db[_0x029e('0x3b')][_0x029e('0xbf')]({'where':{'id':_0x4ceefd[_0x029e('0xb2')]['id']}})[_0x029e('0x2f')](handleEntityNotFound(_0x165fe4,null))['then'](function(_0x5b618e){if(_0x5b618e){_0x4d9fd0[_0x029e('0x41')]=_[_0x029e('0x40')](db[_0x029e('0xbb')][_0x029e('0x3c')]);_0x4d9fd0[_0x029e('0x3f')]=_['keys'](_0x4ceefd[_0x029e('0x3f')]);_0x4d9fd0['filters']=_[_0x029e('0x43')](_0x4d9fd0[_0x029e('0x41')],_0x4d9fd0['query']);_0x25595c[_0x029e('0x42')]=_['intersection'](_0x4d9fd0[_0x029e('0x41')],qs[_0x029e('0xb3')](_0x4ceefd[_0x029e('0x3f')][_0x029e('0xb3')]));_0x25595c[_0x029e('0x42')]=_0x25595c[_0x029e('0x42')][_0x029e('0x62')]?_0x25595c[_0x029e('0x42')]:_0x4d9fd0['model'];if(!_0x4ceefd[_0x029e('0x3f')][_0x029e('0x44')](_0x029e('0x45'))){_0x25595c['limit']=qs[_0x029e('0x29')](_0x4ceefd[_0x029e('0x3f')][_0x029e('0x29')]);_0x25595c[_0x029e('0x27')]=qs[_0x029e('0x27')](_0x4ceefd['query'][_0x029e('0x27')]);}_0x25595c[_0x029e('0x46')]=qs[_0x029e('0x47')](_0x4ceefd[_0x029e('0x3f')][_0x029e('0x47')]);_0x25595c[_0x029e('0x48')]=qs[_0x029e('0x4a')](_['pick'](_0x4ceefd[_0x029e('0x3f')],_0x4d9fd0['filters']));_0x25595c['where'][_0x029e('0xaf')]=_0x5b618e['id'];if(_0x4ceefd[_0x029e('0x3f')][_0x029e('0x87')]){_0x25595c['where']=_[_0x029e('0xb5')](_0x25595c[_0x029e('0x48')],{'$or':_['map'](_0x25595c[_0x029e('0x42')],function(_0x36cde4){var _0xa667c5={};_0xa667c5[_0x36cde4]={'$like':'%'+_0x4ceefd[_0x029e('0x3f')][_0x029e('0x87')]+'%'};return _0xa667c5;})});}if(_0x4ceefd[_0x029e('0x3f')][_0x029e('0x7d')]){var _0x48fcd0=_0x4ceefd[_0x029e('0x3f')][_0x029e('0x7d')][_0x029e('0x36')](',');var _0x46cbf1={};_0x46cbf1[_0x48fcd0[0x0]]={'$gte':moment(_0x48fcd0[0x1])[_0x029e('0xc0')](_0x029e('0xc1'))};_0x25595c['where']=_[_0x029e('0xb5')](_0x25595c[_0x029e('0x48')],_0x46cbf1);}_0x25595c=_[_0x029e('0xb5')]({},_0x25595c,_0x4ceefd[_0x029e('0xb6')]);return db[_0x029e('0xbb')]['count']({'where':_0x25595c['where']})[_0x029e('0x2f')](function(_0x4ce21e){_0x590048[_0x029e('0x2a')]=_0x4ce21e;if(_0x4ceefd[_0x029e('0x3f')][_0x029e('0xb4')]){_0x25595c[_0x029e('0xc2')]=[{'all':!![]}];}return db[_0x029e('0xbb')]['findAll'](_0x25595c);})['then'](function(_0x57ce56){_0x590048['rows']=_0x57ce56;return _0x590048;});}})[_0x029e('0x2f')](respondWithFilteredResult(_0x165fe4,_0x25595c))[_0x029e('0x3a')](handleError(_0x165fe4,null));};exports[_0x029e('0xc3')]=function(_0x64c38d,_0x52a447,_0x22d09d){return db['OpenchannelInteraction'][_0x029e('0x63')]({'where':{'id':_0x64c38d[_0x029e('0xb2')]['id']}})[_0x029e('0x2f')](handleEntityNotFound(_0x52a447,null))[_0x029e('0x2f')](function(_0x40ce30){if(_0x40ce30){return _0x40ce30[_0x029e('0xc4')](_0x64c38d[_0x029e('0xb8')][_0x029e('0xbd')],_[_0x029e('0xbc')](_0x64c38d[_0x029e('0xb8')],[_0x029e('0xbd'),'id'])||{})[_0x029e('0xc5')](function(){return db[_0x029e('0xc6')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x64c38d[_0x029e('0xb8')][_0x029e('0xbd')]}});})['then'](function(_0x41ac30){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x64c38d[_0x029e('0xb2')]['id']),'tags':_0x41ac30||[]});return{'id':Number(_0x64c38d['params']['id']),'tags':_0x41ac30||[]};});}})[_0x029e('0x2f')](respondWithResult(_0x52a447,null))[_0x029e('0x3a')](handleError(_0x52a447,null));};exports['removeTags']=function(_0x2c12fa,_0x3736f4,_0x8e298){return db['OpenchannelInteraction']['find']({'where':{'id':_0x2c12fa[_0x029e('0xb2')]['id']}})['then'](handleEntityNotFound(_0x3736f4,null))[_0x029e('0x2f')](function(_0x183d53){if(_0x183d53){return _0x183d53[_0x029e('0xc7')](_0x2c12fa[_0x029e('0x3f')][_0x029e('0xbd')]);}})[_0x029e('0x2f')](respondWithStatusCode(_0x3736f4,null))[_0x029e('0x3a')](handleError(_0x3736f4,null));};exports[_0x029e('0xc8')]=function(_0x4a6330,_0x5f4aca){var _0x681b60=moment()[_0x029e('0xc9')]()['toString']();var _0x4c62f2=path[_0x029e('0xca')](config[_0x029e('0xcb')],_0x029e('0xcc'),_0x029e('0xcd'),_0x029e('0xce'));var _0x3c7c8e=path[_0x029e('0xca')](config[_0x029e('0xcb')],_0x029e('0xcc'),'files',_0x029e('0xcf'));var _0x10feaa=path[_0x029e('0xca')](_0x4c62f2,_0x681b60);var _0x455af6=util[_0x029e('0xc0')](_0x029e('0xd0'),_0x4a6330['params']['id'],_0x681b60);var _0x2fcaaa=path[_0x029e('0xca')](_0x4c62f2,_0x455af6);var _0x1a15dd=[];_0x1a15dd['push']({'model':db[_0x029e('0x75')],'as':_0x029e('0x75'),'attributes':['id',_0x029e('0x35')],'raw':!![]});_0x1a15dd[_0x029e('0xd1')]({'model':db[_0x029e('0xd2')],'as':_0x029e('0x69'),'attributes':['id',_0x029e('0xd3'),_0x029e('0xd4')],'raw':!![]});if(_0x4a6330[_0x029e('0x3f')][_0x029e('0xcf')]){_0x1a15dd[_0x029e('0xd1')]({'model':db['Attachment'],'as':_0x029e('0xd5'),'raw':!![]});}var _0x4cc623=[{'model':db['OpenchannelMessage'],'as':_0x029e('0xd6'),'attributes':['id',_0x029e('0xb8'),_0x029e('0x7b'),_0x029e('0xd7'),'secret',_0x029e('0x83')],'include':_0x1a15dd}];_0x4cc623[_0x029e('0xd1')]({'model':db[_0x029e('0xd8')],'as':'Account','attributes':['id',_0x029e('0x32')]});_0x4cc623['push']({'model':db['User'],'as':_0x029e('0xd9'),'attributes':['id',_0x029e('0x35')]});return db[_0x029e('0x3b')][_0x029e('0x63')]({'where':{'id':_0x4a6330[_0x029e('0xb2')]['id']},'include':_0x4cc623})[_0x029e('0x2f')](handleEntityNotFound(_0x5f4aca,null))[_0x029e('0x2f')](function(_0x4f7cf3){if(_0x4f7cf3){var _0x561c6b=_0x4f7cf3['get']({'plain':!![]});fs[_0x029e('0xda')](_0x10feaa);var _0x1d6bae={'channel':_0x029e('0xdb'),'account':_0x561c6b['Account'][_0x029e('0x32')],'agent':_0x561c6b['Owner']?_0x561c6b['Owner'][_0x029e('0x35')]:_0x029e('0xdc'),'createdAt':moment(_0x561c6b[_0x029e('0x7b')])['format'](_0x029e('0xc1'))[_0x029e('0x9c')](),'closedAt':_0x561c6b[_0x029e('0xdd')]?moment(_0x561c6b[_0x029e('0xde')])[_0x029e('0xc0')](_0x029e('0xc1'))[_0x029e('0x9c')]():'','disposition':_0x561c6b['disposition'],'visibility':_0x561c6b[_0x029e('0xdf')]?_0x029e('0xe0'):_0x029e('0xe1'),'messages':_(_0x561c6b[_0x029e('0xd6')])[_0x029e('0x87')]({'secret':![]})['map'](function(_0x5322e0){if(_0x5322e0[_0x029e('0xd5')]){var _0x18fb39=path[_0x029e('0xca')](_0x3c7c8e,_0x5322e0['Attachment'][_0x029e('0xe2')]);if(fs[_0x029e('0xe3')](_0x18fb39)){fs['createReadStream'](_0x18fb39)[_0x029e('0xe4')](fs[_0x029e('0xe5')](path[_0x029e('0xca')](_0x10feaa,_0x5322e0['Attachment']['basename'])));}}return{'date':moment(_0x5322e0[_0x029e('0x7b')])[_0x029e('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')[_0x029e('0x9c')](),'sender':_0x5322e0['direction']===_0x029e('0xe6')?_0x5322e0[_0x029e('0x75')]?_0x5322e0['User'][_0x029e('0x35')]:'System':_0x5322e0[_0x029e('0x69')][_0x029e('0xd3')]+(_0x5322e0[_0x029e('0x69')][_0x029e('0xd4')]?'\x20'+_0x5322e0['Contact'][_0x029e('0xd4')]:''),'body':_0x5322e0['Attachment']?_0x5322e0[_0x029e('0xd5')][_0x029e('0xe2')]:_0x5322e0[_0x029e('0xb8')],'direction':_0x5322e0[_0x029e('0xd7')]==='out'?'A':'C','secret':_0x5322e0[_0x029e('0xe7')],'read':_0x5322e0['read'],'attachment':_0x5322e0[_0x029e('0xd5')]};})['value']()};return ejs[_0x029e('0xe8')](path[_0x029e('0xca')](config[_0x029e('0xcb')],_0x029e('0xcc'),_0x029e('0xe9'),_0x029e('0xea')),{'interaction':_0x1d6bae})['then'](function(_0x431979){var _0x177de7=path['join'](_0x10feaa,_0x029e('0xeb')+_0x561c6b['id']+'-'+_0x681b60+'.pdf');var _0x396204={'path':_0x177de7,'channel':_0x029e('0xdb'),'interactionId':_0x561c6b['id']};return pdf[_0x029e('0xec')](_0x431979,_0x396204);})[_0x029e('0x2f')](function(){return new BPromise(function(_0x4d14e8,_0x5e8ffe){zipdir(_0x10feaa,{'saveTo':_0x2fcaaa},function(_0x1fba0c,_0x4b42e9){if(_0x1fba0c)return _0x5e8ffe(_0x1fba0c);return _0x4d14e8(_0x4b42e9);});})[_0x029e('0x2f')](function(){return new BPromise(function(_0x59804a,_0x5b125e){rimraf(_0x10feaa,function(_0x403b24){if(_0x403b24)_0x5b125e(_0x403b24);return _0x59804a();});});})[_0x029e('0x2f')](function(){return _0x5f4aca['download'](_0x2fcaaa,_0x455af6,function(_0x23ec1c){if(_0x23ec1c){console[_0x029e('0xed')]('err',_0x23ec1c);}else{fs['unlinkSync'](_0x2fcaaa);}});});});}else{return _0x5f4aca[_0x029e('0x23')](0xc8);}})['catch'](handleError(_0x5f4aca,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index c50faff..503f26d 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 _0x5f06=['update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save'];(function(_0x142a07,_0x251e3c){var _0x101b6d=function(_0xcc9433){while(--_0xcc9433){_0x142a07['push'](_0x142a07['shift']());}};_0x101b6d(++_0x251e3c);}(_0x5f06,0x80));var _0x65f0=function(_0x3258aa,_0x30824e){_0x3258aa=_0x3258aa-0x0;var _0x573095=_0x5f06[_0x3258aa];return _0x573095;};'use strict';var EventEmitter=require(_0x65f0('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x65f0('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x65f0('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x65f0('0x3')](0x0);var events={'afterCreate':_0x65f0('0x4'),'afterUpdate':_0x65f0('0x5'),'afterDestroy':_0x65f0('0x6')};function emitEvent(_0x155f3c){return function(_0x41a647,_0x3383af,_0x1bb93d){_0x41a647[_0x65f0('0x7')]({'attributes':['id'],'raw':!![]})[_0x65f0('0x8')](function(_0x299b45){_0x41a647[_0x65f0('0x9')]('Users',_0x299b45[_0x65f0('0xa')](function(_0x28f31d){return{'id':_0x28f31d['id']};}));return OpenchannelMessage[_0x65f0('0xb')]({'where':{'OpenchannelInteractionId':_0x41a647['id'],'direction':'in','read':![]},'raw':!![]});})[_0x65f0('0x8')](function(_0x336fca){_0x41a647[_0x65f0('0x9')](_0x65f0('0xc'),_0x336fca[_0x65f0('0xd')]);OpenchannelInteractionEvents['emit'](_0x155f3c+':'+_0x41a647['id'],_0x41a647);OpenchannelInteractionEvents[_0x65f0('0xe')](_0x155f3c,_0x41a647);_0x1bb93d(null);})[_0x65f0('0xf')](_0x1bb93d(null));};}for(var e in events){if(events[_0x65f0('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x65f0('0x11')](e,emitEvent(event));}}module[_0x65f0('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x1962=['Users','map','findAll','length','emit','catch','hasOwnProperty','hook','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','setDataValue'];(function(_0x116538,_0x2fc73c){var _0x277543=function(_0x2d6730){while(--_0x2d6730){_0x116538['push'](_0x116538['shift']());}};_0x277543(++_0x2fc73c);}(_0x1962,0xe9));var _0x2196=function(_0x2c84e5,_0x58a7c7){_0x2c84e5=_0x2c84e5-0x0;var _0x4990ec=_0x1962[_0x2c84e5];return _0x4990ec;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x2196('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x2196('0x0'))['db'][_0x2196('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x2196('0x2')](0x0);var events={'afterCreate':_0x2196('0x3'),'afterUpdate':_0x2196('0x4'),'afterDestroy':'remove'};function emitEvent(_0x55431e){return function(_0x7b6f22,_0x44e86e,_0x1177a1){_0x7b6f22[_0x2196('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2c3ee9){_0x7b6f22[_0x2196('0x6')](_0x2196('0x7'),_0x2c3ee9[_0x2196('0x8')](function(_0x4efcba){return{'id':_0x4efcba['id']};}));return OpenchannelMessage[_0x2196('0x9')]({'where':{'OpenchannelInteractionId':_0x7b6f22['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xe9c7ea){_0x7b6f22[_0x2196('0x6')]('unreadMessages',_0xe9c7ea[_0x2196('0xa')]);OpenchannelInteractionEvents[_0x2196('0xb')](_0x55431e+':'+_0x7b6f22['id'],_0x7b6f22);OpenchannelInteractionEvents[_0x2196('0xb')](_0x55431e,_0x7b6f22);_0x1177a1(null);})[_0x2196('0xc')](_0x1177a1(null));};}for(var e in events){if(events[_0x2196('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x2196('0xe')](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 c0cb13f..e035cc5 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 _0x7301=['openchannel_interactions','utf8mb4','changed','closedAt','format','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0x4e947a,_0x136edf){var _0x578773=function(_0x2d530b){while(--_0x2d530b){_0x4e947a['push'](_0x4e947a['shift']());}};_0x578773(++_0x136edf);}(_0x7301,0x104));var _0x1730=function(_0x3c35f6,_0x2e9b4c){_0x3c35f6=_0x3c35f6-0x0;var _0x36f2dd=_0x7301[_0x3c35f6];return _0x36f2dd;};'use strict';var _=require('lodash');var util=require(_0x1730('0x0'));var logger=require(_0x1730('0x1'))(_0x1730('0x2'));var moment=require(_0x1730('0x3'));var BPromise=require(_0x1730('0x4'));var rp=require(_0x1730('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1730('0x6'));var config=require(_0x1730('0x7'));var attributes=require(_0x1730('0x8'));module[_0x1730('0x9')]=function(_0x5dcc91,_0x63a161){return _0x5dcc91[_0x1730('0xa')](_0x1730('0xb'),attributes,{'tableName':_0x1730('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1730('0xd'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x3ecfbf,_0x37314c,_0x92dea4){if(_0x3ecfbf[_0x1730('0xe')]('closed')){_0x3ecfbf[_0x1730('0xf')]=moment()[_0x1730('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x92dea4(null,_0x3ecfbf);}}});}; \ No newline at end of file +var _0x1fe0=['lodash','util','api','moment','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format'];(function(_0x333829,_0x1b5e6c){var _0x1902f6=function(_0x5dc738){while(--_0x5dc738){_0x333829['push'](_0x333829['shift']());}};_0x1902f6(++_0x1b5e6c);}(_0x1fe0,0x1e0));var _0x01fe=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x1fe0[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0x01fe('0x0'));var util=require(_0x01fe('0x1'));var logger=require('../../config/logger')(_0x01fe('0x2'));var moment=require(_0x01fe('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x01fe('0x4'));var rimraf=require(_0x01fe('0x5'));var config=require(_0x01fe('0x6'));var attributes=require(_0x01fe('0x7'));module['exports']=function(_0x581298,_0x557f15){return _0x581298[_0x01fe('0x8')](_0x01fe('0x9'),attributes,{'tableName':_0x01fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x01fe('0xb'),'collate':_0x01fe('0xc'),'hooks':{'beforeUpdate':function(_0x188768,_0x38128a,_0xeef864){if(_0x188768[_0x01fe('0xd')]('closed')){_0x188768[_0x01fe('0xe')]=moment()[_0x01fe('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0xeef864(null,_0x188768);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 9c3a39d..5992825 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 _0x2180=['redis','defaults','localhost','socket.io-emitter','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','attributes','limit','then','stringify','AddTagsToOpenchannelInteraction','where','addTags','body','ids','omit','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0xde404a,_0x54444b){var _0x30727d=function(_0x59a9fe){while(--_0x59a9fe){_0xde404a['push'](_0xde404a['shift']());}};_0x30727d(++_0x54444b);}(_0x2180,0xf8));var _0x0218=function(_0x203d64,_0x1ec79c){_0x203d64=_0x203d64-0x0;var _0x462ab3=_0x2180[_0x203d64];return _0x462ab3;};'use strict';var _=require(_0x0218('0x0'));var util=require(_0x0218('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0218('0x2'));var fs=require('fs');var Redis=require(_0x0218('0x3'));var db=require(_0x0218('0x4'))['db'];var utils=require(_0x0218('0x5'));var logger=require(_0x0218('0x6'))(_0x0218('0x7'));var config=require(_0x0218('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0218('0x9')]['http']({'port':0x232a});config[_0x0218('0xa')]=_[_0x0218('0xb')](config[_0x0218('0xa')],{'host':_0x0218('0xc'),'port':0x18eb});var socket=require(_0x0218('0xd'))(new Redis(config[_0x0218('0xa')]));require('./openchannelInteraction.socket')[_0x0218('0xe')](socket);function respondWithRpcPromise(_0x383755,_0x54895c,_0x16a7c4){return new BPromise(function(_0x1e9afc,_0x2c8f14){return client[_0x0218('0xf')](_0x383755,_0x16a7c4)['then'](function(_0x251978){logger[_0x0218('0x10')](_0x0218('0x11'),_0x54895c,'request\x20sent');logger[_0x0218('0x12')](_0x0218('0x13'),_0x54895c,_0x0218('0x14'),JSON['stringify'](_0x251978));if(_0x251978['error']){if(_0x251978[_0x0218('0x15')][_0x0218('0x16')]===0x1f4){logger[_0x0218('0x15')](_0x0218('0x11'),_0x54895c,_0x251978['error'][_0x0218('0x17')]);return _0x2c8f14(_0x251978[_0x0218('0x15')][_0x0218('0x17')]);}logger[_0x0218('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x54895c,_0x251978[_0x0218('0x15')]['message']);return _0x1e9afc(_0x251978[_0x0218('0x15')][_0x0218('0x17')]);}else{logger['info'](_0x0218('0x11'),_0x54895c,_0x0218('0x14'));_0x1e9afc(_0x251978[_0x0218('0x18')][_0x0218('0x17')]);}})[_0x0218('0x19')](function(_0x492a10){logger[_0x0218('0x15')](_0x0218('0x11'),_0x54895c,_0x492a10);_0x2c8f14(_0x492a10);});});}exports[_0x0218('0x1a')]=function(_0x3974c9){var _0x3129f2=this;return new Promise(function(_0x396440,_0x39f68a){return db[_0x0218('0x1b')][_0x0218('0x1c')](_0x3974c9['body'],{'raw':_0x3974c9[_0x0218('0x1d')]?_0x3974c9[_0x0218('0x1d')][_0x0218('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3974c9[_0x0218('0x1d')]?_0x3974c9[_0x0218('0x1d')]['where']||null:null,'attributes':_0x3974c9[_0x0218('0x1d')]?_0x3974c9[_0x0218('0x1d')][_0x0218('0x1f')]||null:null,'limit':_0x3974c9[_0x0218('0x1d')]?_0x3974c9['options'][_0x0218('0x20')]||null:null})[_0x0218('0x21')](function(_0x4549d6){logger[_0x0218('0x10')]('UpdateOpenchannelInteraction',_0x3974c9);logger[_0x0218('0x12')](_0x0218('0x1a'),_0x3974c9,JSON[_0x0218('0x22')](_0x4549d6));_0x396440(_0x4549d6);})[_0x0218('0x19')](function(_0x5b8e19){logger[_0x0218('0x15')](_0x0218('0x1a'),_0x5b8e19[_0x0218('0x17')],_0x3974c9);_0x39f68a(_0x3129f2['error'](0x1f4,_0x5b8e19['message']));});});};exports[_0x0218('0x23')]=function(_0x36e96d){return new Promise(function(_0x573f12,_0x5cde08){return db[_0x0218('0x1b')]['find']({'where':_0x36e96d['options']?_0x36e96d[_0x0218('0x1d')][_0x0218('0x24')]||null:null})[_0x0218('0x21')](function(_0x5d30ed){if(_0x5d30ed){return _0x5d30ed[_0x0218('0x25')](_0x36e96d[_0x0218('0x26')][_0x0218('0x27')],_[_0x0218('0x28')](_0x36e96d[_0x0218('0x26')],[_0x0218('0x27'),'id'])||{});}})[_0x0218('0x29')](function(_0x4393a8){logger['info'](_0x0218('0x2a'),_0x36e96d);logger[_0x0218('0x12')](_0x0218('0x2a'),_0x36e96d,JSON['stringify'](_0x4393a8));_0x573f12(_0x4393a8);})[_0x0218('0x19')](function(_0x18efe1){logger[_0x0218('0x15')](_0x0218('0x2a'),_0x18efe1[_0x0218('0x17')],_0x36e96d);_0x5cde08(_this[_0x0218('0x15')](0x1f4,_0x18efe1[_0x0218('0x17')]));});});}; \ No newline at end of file +var _0x0907=['debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','find','addTags','ids','spread','AddTags','lodash','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0x0907,0xcd));var _0x7090=function(_0xee8882,_0x2dc81f){_0xee8882=_0xee8882-0x0;var _0x317486=_0x0907[_0xee8882];return _0x317486;};'use strict';var _=require(_0x7090('0x0'));var util=require('util');var moment=require(_0x7090('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7090('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7090('0x3'));var logger=require(_0x7090('0x4'))('rpc');var config=require(_0x7090('0x5'));var jayson=require(_0x7090('0x6'));var client=jayson[_0x7090('0x7')][_0x7090('0x8')]({'port':0x232a});config[_0x7090('0x9')]=_[_0x7090('0xa')](config[_0x7090('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7090('0xb'))['register'](socket);function respondWithRpcPromise(_0x183e9e,_0x9684f8,_0x218f12){return new BPromise(function(_0x30a9e1,_0x4be2ad){return client[_0x7090('0xc')](_0x183e9e,_0x218f12)[_0x7090('0xd')](function(_0x4cad9){logger[_0x7090('0xe')](_0x7090('0xf'),_0x9684f8,_0x7090('0x10'));logger[_0x7090('0x11')](_0x7090('0x12'),_0x9684f8,_0x7090('0x10'),JSON[_0x7090('0x13')](_0x4cad9));if(_0x4cad9[_0x7090('0x14')]){if(_0x4cad9[_0x7090('0x14')][_0x7090('0x15')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x9684f8,_0x4cad9[_0x7090('0x14')]['message']);return _0x4be2ad(_0x4cad9['error'][_0x7090('0x16')]);}logger['error'](_0x7090('0xf'),_0x9684f8,_0x4cad9[_0x7090('0x14')][_0x7090('0x16')]);return _0x30a9e1(_0x4cad9['error'][_0x7090('0x16')]);}else{logger[_0x7090('0xe')]('OpenchannelInteraction,\x20%s,\x20%s',_0x9684f8,_0x7090('0x10'));_0x30a9e1(_0x4cad9[_0x7090('0x17')]['message']);}})[_0x7090('0x18')](function(_0x333d43){logger[_0x7090('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x9684f8,_0x333d43);_0x4be2ad(_0x333d43);});});}exports[_0x7090('0x19')]=function(_0x147b61){var _0x59e505=this;return new Promise(function(_0x18960a,_0x31466c){return db[_0x7090('0x1a')][_0x7090('0x1b')](_0x147b61[_0x7090('0x1c')],{'raw':_0x147b61[_0x7090('0x1d')]?_0x147b61[_0x7090('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x147b61[_0x7090('0x1d')]?_0x147b61['options'][_0x7090('0x1e')]||null:null,'attributes':_0x147b61[_0x7090('0x1d')]?_0x147b61[_0x7090('0x1d')][_0x7090('0x1f')]||null:null,'limit':_0x147b61[_0x7090('0x1d')]?_0x147b61[_0x7090('0x1d')]['limit']||null:null})[_0x7090('0xd')](function(_0x224849){logger['info'](_0x7090('0x19'),_0x147b61);logger['debug']('UpdateOpenchannelInteraction',_0x147b61,JSON[_0x7090('0x13')](_0x224849));_0x18960a(_0x224849);})[_0x7090('0x18')](function(_0x129eeb){logger['error'](_0x7090('0x19'),_0x129eeb[_0x7090('0x16')],_0x147b61);_0x31466c(_0x59e505[_0x7090('0x14')](0x1f4,_0x129eeb[_0x7090('0x16')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x27ed20){return new Promise(function(_0x1290b9,_0x379316){return db[_0x7090('0x1a')][_0x7090('0x20')]({'where':_0x27ed20[_0x7090('0x1d')]?_0x27ed20[_0x7090('0x1d')][_0x7090('0x1e')]||null:null})['then'](function(_0x468576){if(_0x468576){return _0x468576[_0x7090('0x21')](_0x27ed20[_0x7090('0x1c')][_0x7090('0x22')],_['omit'](_0x27ed20[_0x7090('0x1c')],[_0x7090('0x22'),'id'])||{});}})[_0x7090('0x23')](function(_0x315efa){logger['info'](_0x7090('0x24'),_0x27ed20);logger[_0x7090('0x11')](_0x7090('0x24'),_0x27ed20,JSON[_0x7090('0x13')](_0x315efa));_0x1290b9(_0x315efa);})[_0x7090('0x18')](function(_0x447c5e){logger[_0x7090('0x14')](_0x7090('0x24'),_0x447c5e[_0x7090('0x16')],_0x27ed20);_0x379316(_this['error'](0x1f4,_0x447c5e[_0x7090('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index bcb4f64..b5f8c72 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 _0xb95c=['openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','length'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xb95c,0xd3));var _0xcb95=function(_0x1b999c,_0x13f1a7){_0x1b999c=_0x1b999c-0x0;var _0x235a0b=_0xb95c[_0x1b999c];return _0x235a0b;};'use strict';var OpenchannelInteractionEvents=require(_0xcb95('0x0'));var events=[_0xcb95('0x1'),_0xcb95('0x2'),_0xcb95('0x3')];function createListener(_0xf0c925,_0x338a17){return function(_0x1a506d){_0x338a17[_0xcb95('0x4')](_0xf0c925,_0x1a506d);};}function removeListener(_0x82a263,_0x1197e2){return function(){OpenchannelInteractionEvents['removeListener'](_0x82a263,_0x1197e2);};}exports['register']=function(_0x2ba88d){for(var _0x33e1e3=0x0,_0x124708=events[_0xcb95('0x5')];_0x33e1e3<_0x124708;_0x33e1e3++){var _0xba37e2=events[_0x33e1e3];var _0x22c94c=createListener(_0xcb95('0x6')+_0xba37e2,_0x2ba88d);OpenchannelInteractionEvents['on'](_0xba37e2,_0x22c94c);}}; \ No newline at end of file +var _0x2a3b=['update','emit','removeListener','register','length','openchannelInteraction:','remove'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2a3b,0x109));var _0xb2a3=function(_0x2a4cdf,_0x411c4b){_0x2a4cdf=_0x2a4cdf-0x0;var _0x2fe1cd=_0x2a3b[_0x2a4cdf];return _0x2fe1cd;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0xb2a3('0x0'),_0xb2a3('0x1')];function createListener(_0x539448,_0x32149c){return function(_0x3f66f2){_0x32149c[_0xb2a3('0x2')](_0x539448,_0x3f66f2);};}function removeListener(_0x2c8074,_0x1d4869){return function(){OpenchannelInteractionEvents[_0xb2a3('0x3')](_0x2c8074,_0x1d4869);};}exports[_0xb2a3('0x4')]=function(_0xcf0db6){for(var _0x14d488=0x0,_0x520091=events[_0xb2a3('0x5')];_0x14d488<_0x520091;_0x14d488++){var _0x469f13=events[_0x14d488];var _0x8a89cc=createListener(_0xb2a3('0x6')+_0x469f13,_0xcf0db6);OpenchannelInteractionEvents['on'](_0x469f13,_0x8a89cc);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 9c46917..0a22a5a 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 _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x70df03,_0x49dbe6){var _0x536af1=function(_0x552c15){while(--_0x552c15){_0x70df03['push'](_0x70df03['shift']());}};_0x536af1(++_0x49dbe6);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e0,0x17b));var _0x070e=function(_0x81ba5f,_0x35e0d0){_0x81ba5f=_0x81ba5f-0x0;var _0x2b518b=_0x70e0[_0x81ba5f];return _0x2b518b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 409796e..697d502 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 _0x6e6c=['exports','medium','BOOLEAN','out','DATE','TEXT','sequelize'];(function(_0x4a40ae,_0x4866ae){var _0x1a91b4=function(_0x1af540){while(--_0x1af540){_0x4a40ae['push'](_0x4a40ae['shift']());}};_0x1a91b4(++_0x4866ae);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc6e6('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc6e6('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc6e6('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xc6e6('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc6e6('0x6')]}}; \ No newline at end of file +var _0xefe2=['TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0xefe2,0xd9));var _0x2efe=function(_0x3eb800,_0x263792){_0x3eb800=_0x3eb800-0x0;var _0x32b52f=_0xefe2[_0x3eb800];return _0x32b52f;};'use strict';var Sequelize=require(_0x2efe('0x0'));module[_0x2efe('0x1')]={'body':{'type':Sequelize['TEXT'](_0x2efe('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2efe('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2efe('0x4')]('in','out'),'defaultValue':_0x2efe('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2efe('0x6')]},'providerName':{'type':Sequelize[_0x2efe('0x7')]},'providerResponse':{'type':Sequelize[_0x2efe('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 421a6e8..50045f6 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 _0x378f=['update','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','intersection','model','fields','query','attributes','length','hasOwnProperty','nolimit','where','filters','pick','merge','VIRTUAL','filter','count','includeAll','findAll','rows','keys','include','options','catch','create','body','find','params','destroy','describe','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','user','UserId','OpenchannelInteraction','OpenchannelInteractionId','isNil','format','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','ContactId','sequelize','QueryTypes','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save'];(function(_0x54143b,_0x821add){var _0x38c63f=function(_0x5d64f6){while(--_0x5d64f6){_0x54143b['push'](_0x54143b['shift']());}};_0x38c63f(++_0x821add);}(_0x378f,0xc9));var _0xf378=function(_0x431fed,_0x503554){_0x431fed=_0x431fed-0x0;var _0x4ad399=_0x378f[_0x431fed];return _0x4ad399;};'use strict';var emlformat=require(_0xf378('0x0'));var rimraf=require(_0xf378('0x1'));var zipdir=require(_0xf378('0x2'));var jsonpatch=require(_0xf378('0x3'));var rp=require('request-promise');var moment=require(_0xf378('0x4'));var BPromise=require(_0xf378('0x5'));var Mustache=require('mustache');var util=require(_0xf378('0x6'));var path=require(_0xf378('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf378('0x8'));var _=require(_0xf378('0x9'));var squel=require(_0xf378('0xa'));var crypto=require('crypto');var jsforce=require(_0xf378('0xb'));var deskjs=require(_0xf378('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf378('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf378('0xe'));var logger=require(_0xf378('0xf'))(_0xf378('0x10'));var utils=require(_0xf378('0x11'));var config=require(_0xf378('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xf378('0x13'))['db'];config[_0xf378('0x14')]=_[_0xf378('0x15')](config[_0xf378('0x14')],{'host':_0xf378('0x16'),'port':0x18eb});var socket=require(_0xf378('0x17'))(new Redis(config[_0xf378('0x14')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xf378('0x18')][_0xf378('0x19')]({'port':0x232c});var client9002=jayson['client'][_0xf378('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x16063a,_0x4640dc,_0x174fcd,_0x34fcff){return new BPromise(function(_0x3d97c6,_0x434272){var _0x44f860=_0x34fcff||client;return _0x44f860[_0xf378('0x1a')](_0x16063a,_0x174fcd)[_0xf378('0x1b')](function(_0x201aad){logger[_0xf378('0x1c')](_0xf378('0x1d'),_0x4640dc,_0xf378('0x1e'));logger[_0xf378('0x1f')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x4640dc,_0xf378('0x1e'),JSON[_0xf378('0x20')](_0x201aad));if(_0x201aad[_0xf378('0x21')]){if(_0x201aad[_0xf378('0x21')][_0xf378('0x22')]===0x1f4){logger[_0xf378('0x21')](_0xf378('0x1d'),_0x4640dc,_0x201aad[_0xf378('0x21')][_0xf378('0x23')]);return _0x434272(_0x201aad[_0xf378('0x21')]['message']);}logger[_0xf378('0x21')](_0xf378('0x1d'),_0x4640dc,_0x201aad[_0xf378('0x21')]['message']);return _0x3d97c6(_0x201aad['error'][_0xf378('0x23')]);}else{logger[_0xf378('0x1c')](_0xf378('0x1d'),_0x4640dc,_0xf378('0x1e'));_0x3d97c6(_0x201aad[_0xf378('0x24')][_0xf378('0x23')]);}})['catch'](function(_0x164953){logger[_0xf378('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x4640dc,_0x164953);_0x434272(_0x164953);});});}function respondWithStatusCode(_0x225d3a,_0x219cac){_0x219cac=_0x219cac||0xcc;return function(_0x5f5ddd){if(_0x5f5ddd){return _0x225d3a[_0xf378('0x25')](_0x219cac);}return _0x225d3a[_0xf378('0x26')](_0x219cac)[_0xf378('0x27')]();};}function respondWithResult(_0x4e5f80,_0xce22a7){_0xce22a7=_0xce22a7||0xc8;return function(_0x1fec17){if(_0x1fec17){return _0x4e5f80['status'](_0xce22a7)[_0xf378('0x28')](_0x1fec17);}};}function respondWithFilteredResult(_0x1e8094,_0x37287b){return function(_0x34bf3d){if(_0x34bf3d){var _0x5b35aa=typeof _0x37287b[_0xf378('0x29')]===_0xf378('0x2a')&&typeof _0x37287b[_0xf378('0x2b')]===_0xf378('0x2a');var _0x127034=_0x34bf3d['count'];var _0x73ed42=_0x5b35aa?0x0:_0x37287b[_0xf378('0x29')];var _0x136314=_0x5b35aa?_0x34bf3d['count']:_0x37287b[_0xf378('0x29')]+_0x37287b[_0xf378('0x2b')];var _0x39dc5a;if(_0x136314>=_0x127034){_0x136314=_0x127034;_0x39dc5a=0xc8;}else{_0x39dc5a=0xce;}_0x1e8094[_0xf378('0x26')](_0x39dc5a);return _0x1e8094[_0xf378('0x2c')](_0xf378('0x2d'),_0x73ed42+'-'+_0x136314+'/'+_0x127034)[_0xf378('0x28')](_0x34bf3d);}return null;};}function patchUpdates(_0x2e1a1f){return function(_0x521d35){try{jsonpatch[_0xf378('0x2e')](_0x521d35,_0x2e1a1f,!![]);}catch(_0x1999bb){return BPromise[_0xf378('0x2f')](_0x1999bb);}return _0x521d35[_0xf378('0x30')]();};}function saveUpdates(_0x5de3fd,_0x598192){return function(_0x5ccbce){if(_0x5ccbce){return _0x5ccbce[_0xf378('0x31')](_0x5de3fd)[_0xf378('0x1b')](function(_0x2dcb5c){return _0x2dcb5c;});}return null;};}function removeEntity(_0x354317,_0x1fe090){return function(_0x33e5ad){if(_0x33e5ad){return _0x33e5ad['destroy']()['then'](function(){_0x354317[_0xf378('0x26')](0xcc)[_0xf378('0x27')]();});}};}function handleEntityNotFound(_0x5da545,_0x44f5f6){return function(_0x494b1e){if(!_0x494b1e){_0x5da545[_0xf378('0x25')](0x194);}return _0x494b1e;};}function handleError(_0x3f5b19,_0x29e0fd){_0x29e0fd=_0x29e0fd||0x1f4;return function(_0xe1ef73){logger['error'](_0xe1ef73[_0xf378('0x32')]);if(_0xe1ef73[_0xf378('0x33')]){delete _0xe1ef73[_0xf378('0x33')];}_0x3f5b19[_0xf378('0x26')](_0x29e0fd)[_0xf378('0x34')](_0xe1ef73);};}exports['index']=function(_0x327dab,_0x1fdf1e){var _0x2eeb12={},_0x4dd4fe={},_0x5d69c3={'count':0x0,'rows':[]};var _0x5d4386=_[_0xf378('0x35')](db[_0xf378('0x36')][_0xf378('0x37')],function(_0x592d56){return{'name':_0x592d56[_0xf378('0x38')],'type':_0x592d56[_0xf378('0x39')][_0xf378('0x3a')]};});_0x4dd4fe['model']=_['map'](_0x5d4386,_0xf378('0x33'));_0x4dd4fe['query']=_['keys'](_0x327dab['query']);_0x4dd4fe['filters']=_[_0xf378('0x3b')](_0x4dd4fe[_0xf378('0x3c')],_0x4dd4fe['query']);_0x2eeb12['attributes']=_[_0xf378('0x3b')](_0x4dd4fe[_0xf378('0x3c')],qs[_0xf378('0x3d')](_0x327dab[_0xf378('0x3e')]['fields']));_0x2eeb12[_0xf378('0x3f')]=_0x2eeb12['attributes'][_0xf378('0x40')]?_0x2eeb12['attributes']:_0x4dd4fe[_0xf378('0x3c')];if(!_0x327dab[_0xf378('0x3e')][_0xf378('0x41')](_0xf378('0x42'))){_0x2eeb12[_0xf378('0x2b')]=qs[_0xf378('0x2b')](_0x327dab['query'][_0xf378('0x2b')]);_0x2eeb12[_0xf378('0x29')]=qs['offset'](_0x327dab[_0xf378('0x3e')][_0xf378('0x29')]);}_0x2eeb12['order']=qs['sort'](_0x327dab['query']['sort']);_0x2eeb12[_0xf378('0x43')]=qs[_0xf378('0x44')](_[_0xf378('0x45')](_0x327dab[_0xf378('0x3e')],_0x4dd4fe[_0xf378('0x44')]),_0x5d4386);if(_0x327dab[_0xf378('0x3e')]['filter']){_0x2eeb12['where']=_[_0xf378('0x46')](_0x2eeb12[_0xf378('0x43')],{'$or':_['map'](_0x5d4386,function(_0x6c0f97){if(_0x6c0f97['type']!==_0xf378('0x47')){var _0x408bc7={};_0x408bc7[_0x6c0f97[_0xf378('0x33')]]={'$like':'%'+_0x327dab[_0xf378('0x3e')][_0xf378('0x48')]+'%'};return _0x408bc7;}})});}_0x2eeb12=_[_0xf378('0x46')]({},_0x2eeb12,_0x327dab['options']);var _0x1a482c={'where':_0x2eeb12[_0xf378('0x43')]};return db[_0xf378('0x36')][_0xf378('0x49')](_0x1a482c)['then'](function(_0x4f1a44){_0x5d69c3[_0xf378('0x49')]=_0x4f1a44;if(_0x327dab['query'][_0xf378('0x4a')]){_0x2eeb12['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xf378('0x4b')](_0x2eeb12);})[_0xf378('0x1b')](function(_0x1fb6da){_0x5d69c3[_0xf378('0x4c')]=_0x1fb6da;return _0x5d69c3;})[_0xf378('0x1b')](respondWithFilteredResult(_0x1fdf1e,_0x2eeb12))['catch'](handleError(_0x1fdf1e,null));};exports['show']=function(_0x5f2250,_0x3b0d96){var _0x4299fd={'raw':!![],'where':{'id':_0x5f2250['params']['id']}},_0x15b21c={};_0x15b21c[_0xf378('0x3c')]=_[_0xf378('0x4d')](db[_0xf378('0x36')]['rawAttributes']);_0x15b21c['query']=_[_0xf378('0x4d')](_0x5f2250['query']);_0x15b21c[_0xf378('0x44')]=_['intersection'](_0x15b21c[_0xf378('0x3c')],_0x15b21c[_0xf378('0x3e')]);_0x4299fd[_0xf378('0x3f')]=_[_0xf378('0x3b')](_0x15b21c[_0xf378('0x3c')],qs[_0xf378('0x3d')](_0x5f2250[_0xf378('0x3e')]['fields']));_0x4299fd['attributes']=_0x4299fd[_0xf378('0x3f')][_0xf378('0x40')]?_0x4299fd[_0xf378('0x3f')]:_0x15b21c[_0xf378('0x3c')];if(_0x5f2250[_0xf378('0x3e')]['includeAll']){_0x4299fd[_0xf378('0x4e')]=[{'all':!![]}];}_0x4299fd=_[_0xf378('0x46')]({},_0x4299fd,_0x5f2250[_0xf378('0x4f')]);return db[_0xf378('0x36')]['find'](_0x4299fd)[_0xf378('0x1b')](handleEntityNotFound(_0x3b0d96,null))['then'](respondWithResult(_0x3b0d96,null))[_0xf378('0x50')](handleError(_0x3b0d96,null));};exports[_0xf378('0x51')]=function(_0x2b6959,_0x51a11d){return db[_0xf378('0x36')]['create'](_0x2b6959[_0xf378('0x52')],{})[_0xf378('0x1b')](respondWithResult(_0x51a11d,0xc9))[_0xf378('0x50')](handleError(_0x51a11d,null));};exports[_0xf378('0x31')]=function(_0x52a17d,_0x168341){if(_0x52a17d[_0xf378('0x52')]['id']){delete _0x52a17d[_0xf378('0x52')]['id'];}return db['OpenchannelMessage'][_0xf378('0x53')]({'where':{'id':_0x52a17d[_0xf378('0x54')]['id']}})['then'](handleEntityNotFound(_0x168341,null))['then'](saveUpdates(_0x52a17d[_0xf378('0x52')],null))['then'](respondWithResult(_0x168341,null))[_0xf378('0x50')](handleError(_0x168341,null));};exports[_0xf378('0x55')]=function(_0x3d0780,_0x6b4fab){return db[_0xf378('0x36')][_0xf378('0x53')]({'where':{'id':_0x3d0780[_0xf378('0x54')]['id']}})[_0xf378('0x1b')](handleEntityNotFound(_0x6b4fab,null))[_0xf378('0x1b')](removeEntity(_0x6b4fab,null))[_0xf378('0x50')](handleError(_0x6b4fab,null));};exports[_0xf378('0x56')]=function(_0x481212,_0x390e85){return db['OpenchannelMessage'][_0xf378('0x56')]()[_0xf378('0x1b')](respondWithResult(_0x390e85,null))[_0xf378('0x50')](handleError(_0x390e85,null));};var interaction_log=require(_0xf378('0xf'))(_0xf378('0x57'));exports[_0xf378('0x58')]=function(_0x53ddf9,_0x502e7b,_0x5f4505){var _0x2a97ea={'agent':{},'channel':_0xf378('0x59')};if(_0x53ddf9['body']['id']){delete _0x53ddf9[_0xf378('0x52')]['id'];}_0x53ddf9[_0xf378('0x52')][_0xf378('0x5a')]=!![];_0x53ddf9['body'][_0xf378('0x5b')]=moment()['format'](_0xf378('0x5c'));_0x53ddf9[_0xf378('0x52')]['UserId']=_0x53ddf9['body']['UserId']||_0x53ddf9[_0xf378('0x5d')]['id'];_0x2a97ea['agent']['id']=_0x53ddf9[_0xf378('0x52')][_0xf378('0x5e')];return db['OpenchannelMessage'][_0xf378('0x53')]({'where':{'id':_0x53ddf9['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x502e7b,null))[_0xf378('0x1b')](saveUpdates(_0x53ddf9[_0xf378('0x52')],null))[_0xf378('0x1b')](function(_0x34dc60){if(_0x34dc60){_0x2a97ea[_0xf378('0x23')]=_0x34dc60['get']({'plain':!![]});return db[_0xf378('0x5f')][_0xf378('0x53')]({'where':{'id':_0x34dc60[_0xf378('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x502e7b,null))[_0xf378('0x1b')](function(_0xa6cb01){if(_0xa6cb01){return _0xa6cb01[_0xf378('0x31')]({'UserId':_0x53ddf9[_0xf378('0x52')][_0xf378('0x5e')],'read1stAt':_[_0xf378('0x61')](_0xa6cb01['read1stAt'])?moment()[_0xf378('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf378('0x1b')](function(_0x21697c){if(_0x21697c){_0x2a97ea[_0xf378('0x63')]=_0x21697c[_0xf378('0x64')]({'plain':!![]});interaction_log[_0xf378('0x1c')](_0xf378('0x65'),_0x53ddf9[_0xf378('0x5d')]['id'],_0x53ddf9[_0xf378('0x5d')][_0xf378('0x33')],_0x53ddf9['user'][_0xf378('0x66')],_0x2a97ea[_0xf378('0x63')]['id'],_0x53ddf9[_0xf378('0x52')]?JSON[_0xf378('0x20')](_0x53ddf9[_0xf378('0x52')]):_0xf378('0x67'));return respondWithRpcPromise('AcceptMessage',_0xf378('0x68'),_0x2a97ea);}return null;})['then'](function(_0x3339d9){var _0x9fbd7=_0xf378('0x69')+_0x3339d9[_0xf378('0x23')]['ContactId'];return db['sequelize']['query'](_0x9fbd7,{'type':db[_0xf378('0x6a')]['QueryTypes'][_0xf378('0x6b')],'raw':!![]})[_0xf378('0x1b')](function(_0x3f1fd0){return _0x3f1fd0;});})['then'](function(_0x488cc4){if(_0x488cc4){_0x2a97ea[_0xf378('0x23')][_0xf378('0x6c')]=_0x488cc4[0x0];if(!_0x53ddf9[_0xf378('0x52')][_0xf378('0x5e')])return;return db[_0xf378('0x6d')]['find']({'where':{'id':_0x53ddf9['body'][_0xf378('0x5e')],'role':_0xf378('0x6e')},'attributes':['id',_0xf378('0x33'),_0xf378('0x6f'),_0xf378('0x70'),_0xf378('0x71')],'raw':!![]});}return null;})['then'](function(_0x5aa707){if(!_0x5aa707)return null;_0x2a97ea[_0xf378('0x23')]['agent']=_0x5aa707;return _0x2a97ea;})[_0xf378('0x1b')](function(_0x3ae9da){if(_0x3ae9da){if(_0x53ddf9[_0xf378('0x52')][_0xf378('0x72')]){_0x2a97ea[_0xf378('0x23')][_0xf378('0x73')]=util['format'](_0xf378('0x74'),_0x53ddf9[_0xf378('0x5d')][_0xf378('0x33')]);_0x2a97ea[_0xf378('0x23')][_0xf378('0x75')]=_0x2a97ea[_0xf378('0x75')];_0x2a97ea[_0xf378('0x23')][_0xf378('0x76')]=_0x2a97ea[_0xf378('0x75')];_0x2a97ea[_0xf378('0x23')][_0xf378('0x77')]=_0xf378('0x58');return respondWithRpcPromise(_0xf378('0x78'),'EventManager',{'event':'acceptmessage','message':_0x2a97ea['message']},client9002)[_0xf378('0x1b')](function(){return _0x2a97ea;});}return _0x2a97ea;}return null;})[_0xf378('0x1b')](respondWithResult(_0x502e7b,null))['catch'](handleError(_0x502e7b,null));};var interaction_log=require(_0xf378('0xf'))(_0xf378('0x57'));exports[_0xf378('0x2f')]=function(_0x3e5dc3,_0xa81720,_0x111c0e){var _0x7e36eb={'agent':{},'channel':_0xf378('0x59')};if(_0x3e5dc3[_0xf378('0x52')]['id']){delete _0x3e5dc3['body']['id'];}_0x3e5dc3['body']['UserId']=_0x3e5dc3[_0xf378('0x52')][_0xf378('0x5e')]||_0x3e5dc3['user']['id'];_0x7e36eb['agent']['id']=_0x3e5dc3[_0xf378('0x52')][_0xf378('0x5e')];return db[_0xf378('0x36')]['find']({'where':{'id':_0x3e5dc3[_0xf378('0x54')]['id'],'UserId':null}})[_0xf378('0x1b')](handleEntityNotFound(_0xa81720,null))['then'](function(_0x3d7342){if(_0x3d7342){_0x7e36eb[_0xf378('0x23')]=_0x3d7342['get']({'plain':!![]});return db[_0xf378('0x5f')][_0xf378('0x53')]({'where':{'id':_0x3d7342[_0xf378('0x60')]}});}return null;})[_0xf378('0x1b')](handleEntityNotFound(_0xa81720,null))['then'](function(_0x270fad){if(_0x270fad){_0x7e36eb[_0xf378('0x63')]=_0x270fad['get']({'plain':!![]});interaction_log[_0xf378('0x1c')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3e5dc3[_0xf378('0x5d')]['id'],_0x3e5dc3[_0xf378('0x5d')]['name'],_0x3e5dc3[_0xf378('0x5d')][_0xf378('0x66')],_0x7e36eb['interaction']['id'],_0x3e5dc3[_0xf378('0x52')]?JSON['stringify'](_0x3e5dc3[_0xf378('0x52')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x7e36eb);}return null;})[_0xf378('0x1b')](function(_0x23320a){var _0x45923e=_0xf378('0x69')+_0x23320a['message'][_0xf378('0x79')];return db[_0xf378('0x7a')][_0xf378('0x3e')](_0x45923e,{'type':db['Sequelize'][_0xf378('0x7b')][_0xf378('0x6b')],'raw':!![]})[_0xf378('0x1b')](function(_0x8c250b){return _0x8c250b;});})[_0xf378('0x1b')](function(_0x180bb4){if(_0x180bb4){_0x7e36eb[_0xf378('0x23')][_0xf378('0x6c')]=_0x180bb4[0x0];if(!_0x3e5dc3[_0xf378('0x52')][_0xf378('0x5e')])return;return db[_0xf378('0x6d')][_0xf378('0x53')]({'where':{'id':_0x3e5dc3[_0xf378('0x52')]['UserId'],'role':'agent'},'attributes':['id','name',_0xf378('0x6f'),_0xf378('0x70'),'internal'],'raw':!![]});}return null;})[_0xf378('0x1b')](function(_0x3a7085){if(!_0x3a7085)return null;_0x7e36eb[_0xf378('0x23')][_0xf378('0x6e')]=_0x3a7085;return _0x7e36eb;})[_0xf378('0x1b')](function(_0x363fd7){if(_0x363fd7){_0x363fd7[_0xf378('0x23')][_0xf378('0x73')]=util['format'](_0xf378('0x74'),_0x3e5dc3[_0xf378('0x5d')][_0xf378('0x33')]);_0x363fd7['message'][_0xf378('0x75')]=_0x7e36eb['channel'];_0x363fd7[_0xf378('0x23')]['motionChannel']=_0x7e36eb['channel'];_0x363fd7[_0xf378('0x23')]['event']=_0xf378('0x2f');respondWithRpcPromise(_0xf378('0x78'),_0xf378('0x78'),{'event':_0xf378('0x7c'),'message':_0x363fd7[_0xf378('0x23')]},client9002);return _0x7e36eb;}return null;})[_0xf378('0x1b')](respondWithResult(_0xa81720,null))[_0xf378('0x50')](handleError(_0xa81720,null));}; \ No newline at end of file +var _0x09f3=['sort','where','pick','merge','type','options','includeAll','include','findAll','rows','show','params','fields','length','find','catch','body','describe','openchannel-interactions','accept','openchannel','readAt','format','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','reject','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','destroy','stack','name','index','map','OpenchannelMessage','rawAttributes','key','keys','filters','model','attributes','intersection','query','hasOwnProperty','order'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x09f3,0x1c5));var _0x309f=function(_0x19997d,_0x2c92a4){_0x19997d=_0x19997d-0x0;var _0x49be7f=_0x09f3[_0x19997d];return _0x49be7f;};'use strict';var emlformat=require(_0x309f('0x0'));var rimraf=require(_0x309f('0x1'));var zipdir=require(_0x309f('0x2'));var jsonpatch=require(_0x309f('0x3'));var rp=require(_0x309f('0x4'));var moment=require(_0x309f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x309f('0x6'));var util=require('util');var path=require(_0x309f('0x7'));var sox=require(_0x309f('0x8'));var csv=require(_0x309f('0x9'));var ejs=require(_0x309f('0xa'));var fs=require('fs');var fs_extra=require(_0x309f('0xb'));var _=require(_0x309f('0xc'));var squel=require(_0x309f('0xd'));var crypto=require('crypto');var jsforce=require(_0x309f('0xe'));var deskjs=require(_0x309f('0xf'));var toCsv=require(_0x309f('0x9'));var querystring=require(_0x309f('0x10'));var Papa=require(_0x309f('0x11'));var Redis=require('ioredis');var authService=require(_0x309f('0x12'));var qs=require(_0x309f('0x13'));var as=require(_0x309f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x309f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x309f('0x16'));var db=require(_0x309f('0x17'))['db'];config[_0x309f('0x18')]=_[_0x309f('0x19')](config[_0x309f('0x18')],{'host':_0x309f('0x1a'),'port':0x18eb});var socket=require(_0x309f('0x1b'))(new Redis(config[_0x309f('0x18')]));require(_0x309f('0x1c'))[_0x309f('0x1d')](socket);var jayson=require(_0x309f('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x309f('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32e07d,_0xe7817c,_0x5a7364,_0x1645a6){return new BPromise(function(_0x337eb3,_0x4817c4){var _0x12a65a=_0x1645a6||client;return _0x12a65a[_0x309f('0x20')](_0x32e07d,_0x5a7364)[_0x309f('0x21')](function(_0x1a548a){logger[_0x309f('0x22')](_0x309f('0x23'),_0xe7817c,'request\x20sent');logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xe7817c,'request\x20sent',JSON[_0x309f('0x24')](_0x1a548a));if(_0x1a548a[_0x309f('0x25')]){if(_0x1a548a[_0x309f('0x25')][_0x309f('0x26')]===0x1f4){logger[_0x309f('0x25')](_0x309f('0x23'),_0xe7817c,_0x1a548a[_0x309f('0x25')]['message']);return _0x4817c4(_0x1a548a[_0x309f('0x25')][_0x309f('0x27')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xe7817c,_0x1a548a[_0x309f('0x25')][_0x309f('0x27')]);return _0x337eb3(_0x1a548a[_0x309f('0x25')]['message']);}else{logger[_0x309f('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0xe7817c,_0x309f('0x28'));_0x337eb3(_0x1a548a[_0x309f('0x29')][_0x309f('0x27')]);}})['catch'](function(_0x358769){logger['error'](_0x309f('0x23'),_0xe7817c,_0x358769);_0x4817c4(_0x358769);});});}function respondWithStatusCode(_0x5dd63f,_0x482b7e){_0x482b7e=_0x482b7e||0xcc;return function(_0x3c5016){if(_0x3c5016){return _0x5dd63f[_0x309f('0x2a')](_0x482b7e);}return _0x5dd63f['status'](_0x482b7e)[_0x309f('0x2b')]();};}function respondWithResult(_0x6559ca,_0x551b38){_0x551b38=_0x551b38||0xc8;return function(_0x103ec9){if(_0x103ec9){return _0x6559ca[_0x309f('0x2c')](_0x551b38)['json'](_0x103ec9);}};}function respondWithFilteredResult(_0xeddd52,_0x12806a){return function(_0x1cd5de){if(_0x1cd5de){var _0x56cd95=typeof _0x12806a[_0x309f('0x2d')]==='undefined'&&typeof _0x12806a['limit']===_0x309f('0x2e');var _0x5329df=_0x1cd5de[_0x309f('0x2f')];var _0x5d0bb9=_0x56cd95?0x0:_0x12806a[_0x309f('0x2d')];var _0x341a92=_0x56cd95?_0x1cd5de['count']:_0x12806a[_0x309f('0x2d')]+_0x12806a[_0x309f('0x30')];var _0x2bc487;if(_0x341a92>=_0x5329df){_0x341a92=_0x5329df;_0x2bc487=0xc8;}else{_0x2bc487=0xce;}_0xeddd52[_0x309f('0x2c')](_0x2bc487);return _0xeddd52[_0x309f('0x31')](_0x309f('0x32'),_0x5d0bb9+'-'+_0x341a92+'/'+_0x5329df)[_0x309f('0x33')](_0x1cd5de);}return null;};}function patchUpdates(_0x416d0f){return function(_0x3f99bb){try{jsonpatch[_0x309f('0x34')](_0x3f99bb,_0x416d0f,!![]);}catch(_0x2f8e85){return BPromise['reject'](_0x2f8e85);}return _0x3f99bb[_0x309f('0x35')]();};}function saveUpdates(_0x62f311,_0x312bf8){return function(_0x592cee){if(_0x592cee){return _0x592cee[_0x309f('0x36')](_0x62f311)[_0x309f('0x21')](function(_0xccbe3){return _0xccbe3;});}return null;};}function removeEntity(_0x50029c,_0x5f2b81){return function(_0x451ccf){if(_0x451ccf){return _0x451ccf[_0x309f('0x37')]()[_0x309f('0x21')](function(){_0x50029c[_0x309f('0x2c')](0xcc)[_0x309f('0x2b')]();});}};}function handleEntityNotFound(_0x554c53,_0x5e65df){return function(_0x3ed577){if(!_0x3ed577){_0x554c53['sendStatus'](0x194);}return _0x3ed577;};}function handleError(_0xe3682f,_0x513efe){_0x513efe=_0x513efe||0x1f4;return function(_0x1d0474){logger['error'](_0x1d0474[_0x309f('0x38')]);if(_0x1d0474[_0x309f('0x39')]){delete _0x1d0474[_0x309f('0x39')];}_0xe3682f['status'](_0x513efe)['send'](_0x1d0474);};}exports[_0x309f('0x3a')]=function(_0x23712e,_0x51b55b){var _0x3ed090={},_0x1f120a={},_0x1212d8={'count':0x0,'rows':[]};var _0x59bce4=_[_0x309f('0x3b')](db[_0x309f('0x3c')][_0x309f('0x3d')],function(_0x9d8132){return{'name':_0x9d8132['fieldName'],'type':_0x9d8132['type'][_0x309f('0x3e')]};});_0x1f120a['model']=_['map'](_0x59bce4,_0x309f('0x39'));_0x1f120a['query']=_[_0x309f('0x3f')](_0x23712e['query']);_0x1f120a[_0x309f('0x40')]=_['intersection'](_0x1f120a[_0x309f('0x41')],_0x1f120a['query']);_0x3ed090[_0x309f('0x42')]=_[_0x309f('0x43')](_0x1f120a[_0x309f('0x41')],qs['fields'](_0x23712e[_0x309f('0x44')]['fields']));_0x3ed090[_0x309f('0x42')]=_0x3ed090[_0x309f('0x42')]['length']?_0x3ed090[_0x309f('0x42')]:_0x1f120a[_0x309f('0x41')];if(!_0x23712e[_0x309f('0x44')][_0x309f('0x45')]('nolimit')){_0x3ed090[_0x309f('0x30')]=qs[_0x309f('0x30')](_0x23712e[_0x309f('0x44')][_0x309f('0x30')]);_0x3ed090['offset']=qs[_0x309f('0x2d')](_0x23712e[_0x309f('0x44')]['offset']);}_0x3ed090[_0x309f('0x46')]=qs['sort'](_0x23712e['query'][_0x309f('0x47')]);_0x3ed090[_0x309f('0x48')]=qs[_0x309f('0x40')](_[_0x309f('0x49')](_0x23712e[_0x309f('0x44')],_0x1f120a[_0x309f('0x40')]),_0x59bce4);if(_0x23712e['query']['filter']){_0x3ed090[_0x309f('0x48')]=_[_0x309f('0x4a')](_0x3ed090['where'],{'$or':_[_0x309f('0x3b')](_0x59bce4,function(_0x4e5262){if(_0x4e5262[_0x309f('0x4b')]!=='VIRTUAL'){var _0x16aa73={};_0x16aa73[_0x4e5262[_0x309f('0x39')]]={'$like':'%'+_0x23712e[_0x309f('0x44')]['filter']+'%'};return _0x16aa73;}})});}_0x3ed090=_[_0x309f('0x4a')]({},_0x3ed090,_0x23712e[_0x309f('0x4c')]);var _0x3a0e24={'where':_0x3ed090['where']};return db['OpenchannelMessage'][_0x309f('0x2f')](_0x3a0e24)[_0x309f('0x21')](function(_0x554ad1){_0x1212d8['count']=_0x554ad1;if(_0x23712e[_0x309f('0x44')][_0x309f('0x4d')]){_0x3ed090[_0x309f('0x4e')]=[{'all':!![]}];}return db[_0x309f('0x3c')][_0x309f('0x4f')](_0x3ed090);})[_0x309f('0x21')](function(_0x48bb43){_0x1212d8[_0x309f('0x50')]=_0x48bb43;return _0x1212d8;})[_0x309f('0x21')](respondWithFilteredResult(_0x51b55b,_0x3ed090))['catch'](handleError(_0x51b55b,null));};exports[_0x309f('0x51')]=function(_0x4f16d4,_0x231ac1){var _0x2a4dc2={'raw':!![],'where':{'id':_0x4f16d4[_0x309f('0x52')]['id']}},_0x3206d9={};_0x3206d9['model']=_[_0x309f('0x3f')](db[_0x309f('0x3c')]['rawAttributes']);_0x3206d9[_0x309f('0x44')]=_[_0x309f('0x3f')](_0x4f16d4['query']);_0x3206d9[_0x309f('0x40')]=_[_0x309f('0x43')](_0x3206d9[_0x309f('0x41')],_0x3206d9[_0x309f('0x44')]);_0x2a4dc2[_0x309f('0x42')]=_[_0x309f('0x43')](_0x3206d9[_0x309f('0x41')],qs[_0x309f('0x53')](_0x4f16d4[_0x309f('0x44')][_0x309f('0x53')]));_0x2a4dc2[_0x309f('0x42')]=_0x2a4dc2[_0x309f('0x42')][_0x309f('0x54')]?_0x2a4dc2[_0x309f('0x42')]:_0x3206d9[_0x309f('0x41')];if(_0x4f16d4['query'][_0x309f('0x4d')]){_0x2a4dc2[_0x309f('0x4e')]=[{'all':!![]}];}_0x2a4dc2=_[_0x309f('0x4a')]({},_0x2a4dc2,_0x4f16d4[_0x309f('0x4c')]);return db['OpenchannelMessage'][_0x309f('0x55')](_0x2a4dc2)[_0x309f('0x21')](handleEntityNotFound(_0x231ac1,null))[_0x309f('0x21')](respondWithResult(_0x231ac1,null))[_0x309f('0x56')](handleError(_0x231ac1,null));};exports['create']=function(_0x3f6473,_0x200e3b){return db[_0x309f('0x3c')]['create'](_0x3f6473[_0x309f('0x57')],{})[_0x309f('0x21')](respondWithResult(_0x200e3b,0xc9))[_0x309f('0x56')](handleError(_0x200e3b,null));};exports['update']=function(_0x3f428f,_0x2dc669){if(_0x3f428f[_0x309f('0x57')]['id']){delete _0x3f428f[_0x309f('0x57')]['id'];}return db[_0x309f('0x3c')][_0x309f('0x55')]({'where':{'id':_0x3f428f['params']['id']}})['then'](handleEntityNotFound(_0x2dc669,null))[_0x309f('0x21')](saveUpdates(_0x3f428f['body'],null))[_0x309f('0x21')](respondWithResult(_0x2dc669,null))[_0x309f('0x56')](handleError(_0x2dc669,null));};exports['destroy']=function(_0x3d9075,_0x12d019){return db[_0x309f('0x3c')]['find']({'where':{'id':_0x3d9075['params']['id']}})[_0x309f('0x21')](handleEntityNotFound(_0x12d019,null))[_0x309f('0x21')](removeEntity(_0x12d019,null))[_0x309f('0x56')](handleError(_0x12d019,null));};exports[_0x309f('0x58')]=function(_0x414b39,_0x4969aa){return db[_0x309f('0x3c')][_0x309f('0x58')]()['then'](respondWithResult(_0x4969aa,null))[_0x309f('0x56')](handleError(_0x4969aa,null));};var interaction_log=require('../../config/logger')(_0x309f('0x59'));exports[_0x309f('0x5a')]=function(_0x5f3213,_0x37eea0,_0x4c24d2){var _0x3d56ad={'agent':{},'channel':_0x309f('0x5b')};if(_0x5f3213[_0x309f('0x57')]['id']){delete _0x5f3213['body']['id'];}_0x5f3213[_0x309f('0x57')]['read']=!![];_0x5f3213[_0x309f('0x57')][_0x309f('0x5c')]=moment()[_0x309f('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x5f3213['body'][_0x309f('0x5e')]=_0x5f3213[_0x309f('0x57')]['UserId']||_0x5f3213[_0x309f('0x5f')]['id'];_0x3d56ad[_0x309f('0x60')]['id']=_0x5f3213[_0x309f('0x57')][_0x309f('0x5e')];return db[_0x309f('0x3c')]['find']({'where':{'id':_0x5f3213['params']['id'],'UserId':null}})[_0x309f('0x21')](handleEntityNotFound(_0x37eea0,null))[_0x309f('0x21')](saveUpdates(_0x5f3213['body'],null))[_0x309f('0x21')](function(_0x51218d){if(_0x51218d){_0x3d56ad[_0x309f('0x27')]=_0x51218d['get']({'plain':!![]});return db[_0x309f('0x61')]['find']({'where':{'id':_0x51218d[_0x309f('0x62')]}});}return null;})[_0x309f('0x21')](handleEntityNotFound(_0x37eea0,null))[_0x309f('0x21')](function(_0x4ac202){if(_0x4ac202){return _0x4ac202[_0x309f('0x36')]({'UserId':_0x5f3213[_0x309f('0x57')][_0x309f('0x5e')],'read1stAt':_[_0x309f('0x63')](_0x4ac202['read1stAt'])?moment()[_0x309f('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4ea683){if(_0x4ea683){_0x3d56ad[_0x309f('0x64')]=_0x4ea683['get']({'plain':!![]});interaction_log[_0x309f('0x22')](_0x309f('0x65'),_0x5f3213[_0x309f('0x5f')]['id'],_0x5f3213[_0x309f('0x5f')][_0x309f('0x39')],_0x5f3213[_0x309f('0x5f')][_0x309f('0x66')],_0x3d56ad[_0x309f('0x64')]['id'],_0x5f3213[_0x309f('0x57')]?JSON[_0x309f('0x24')](_0x5f3213[_0x309f('0x57')]):_0x309f('0x67'));return respondWithRpcPromise(_0x309f('0x68'),_0x309f('0x69'),_0x3d56ad);}return null;})[_0x309f('0x21')](function(_0x29b94b){var _0x9b8ea=_0x309f('0x6a')+_0x29b94b['message'][_0x309f('0x6b')];return db[_0x309f('0x6c')][_0x309f('0x44')](_0x9b8ea,{'type':db['Sequelize'][_0x309f('0x6d')]['SELECT'],'raw':!![]})[_0x309f('0x21')](function(_0x47a1ed){return _0x47a1ed;});})['then'](function(_0xe5cc8){if(_0xe5cc8){_0x3d56ad[_0x309f('0x27')][_0x309f('0x6e')]=_0xe5cc8[0x0];if(!_0x5f3213['body']['UserId'])return;return db[_0x309f('0x6f')][_0x309f('0x55')]({'where':{'id':_0x5f3213[_0x309f('0x57')][_0x309f('0x5e')],'role':'agent'},'attributes':['id',_0x309f('0x39'),_0x309f('0x70'),_0x309f('0x71'),_0x309f('0x72')],'raw':!![]});}return null;})[_0x309f('0x21')](function(_0x53af10){if(!_0x53af10)return null;_0x3d56ad[_0x309f('0x27')]['agent']=_0x53af10;return _0x3d56ad;})[_0x309f('0x21')](function(_0x1078d8){if(_0x1078d8){if(_0x5f3213[_0x309f('0x57')][_0x309f('0x73')]){_0x3d56ad[_0x309f('0x27')][_0x309f('0x74')]=util[_0x309f('0x5d')](_0x309f('0x75'),_0x5f3213['user'][_0x309f('0x39')]);_0x3d56ad[_0x309f('0x27')][_0x309f('0x76')]=_0x3d56ad[_0x309f('0x76')];_0x3d56ad[_0x309f('0x27')][_0x309f('0x77')]=_0x3d56ad['channel'];_0x3d56ad['message'][_0x309f('0x78')]=_0x309f('0x5a');return respondWithRpcPromise(_0x309f('0x79'),_0x309f('0x79'),{'event':_0x309f('0x7a'),'message':_0x3d56ad[_0x309f('0x27')]},client9002)['then'](function(){return _0x3d56ad;});}return _0x3d56ad;}return null;})[_0x309f('0x21')](respondWithResult(_0x37eea0,null))['catch'](handleError(_0x37eea0,null));};var interaction_log=require(_0x309f('0x7b'))('openchannel-interactions');exports[_0x309f('0x7c')]=function(_0x554c28,_0x2c235b,_0x5d0690){var _0x5d623c={'agent':{},'channel':_0x309f('0x5b')};if(_0x554c28[_0x309f('0x57')]['id']){delete _0x554c28['body']['id'];}_0x554c28['body']['UserId']=_0x554c28[_0x309f('0x57')]['UserId']||_0x554c28[_0x309f('0x5f')]['id'];_0x5d623c[_0x309f('0x60')]['id']=_0x554c28[_0x309f('0x57')][_0x309f('0x5e')];return db[_0x309f('0x3c')][_0x309f('0x55')]({'where':{'id':_0x554c28['params']['id'],'UserId':null}})[_0x309f('0x21')](handleEntityNotFound(_0x2c235b,null))['then'](function(_0x3ac82d){if(_0x3ac82d){_0x5d623c['message']=_0x3ac82d[_0x309f('0x7d')]({'plain':!![]});return db[_0x309f('0x61')][_0x309f('0x55')]({'where':{'id':_0x3ac82d[_0x309f('0x62')]}});}return null;})[_0x309f('0x21')](handleEntityNotFound(_0x2c235b,null))[_0x309f('0x21')](function(_0x17aa16){if(_0x17aa16){_0x5d623c[_0x309f('0x64')]=_0x17aa16[_0x309f('0x7d')]({'plain':!![]});interaction_log[_0x309f('0x22')](_0x309f('0x7e'),_0x554c28[_0x309f('0x5f')]['id'],_0x554c28[_0x309f('0x5f')][_0x309f('0x39')],_0x554c28[_0x309f('0x5f')][_0x309f('0x66')],_0x5d623c['interaction']['id'],_0x554c28[_0x309f('0x57')]?JSON[_0x309f('0x24')](_0x554c28[_0x309f('0x57')]):_0x309f('0x67'));return respondWithRpcPromise(_0x309f('0x7f'),_0x309f('0x80'),_0x5d623c);}return null;})[_0x309f('0x21')](function(_0x5617ad){var _0x276674='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5617ad[_0x309f('0x27')][_0x309f('0x6b')];return db['sequelize']['query'](_0x276674,{'type':db['Sequelize'][_0x309f('0x6d')][_0x309f('0x81')],'raw':!![]})[_0x309f('0x21')](function(_0x24e660){return _0x24e660;});})['then'](function(_0x51a67b){if(_0x51a67b){_0x5d623c['message'][_0x309f('0x6e')]=_0x51a67b[0x0];if(!_0x554c28['body'][_0x309f('0x5e')])return;return db[_0x309f('0x6f')][_0x309f('0x55')]({'where':{'id':_0x554c28[_0x309f('0x57')][_0x309f('0x5e')],'role':_0x309f('0x60')},'attributes':['id',_0x309f('0x39'),'fullname',_0x309f('0x71'),_0x309f('0x72')],'raw':!![]});}return null;})[_0x309f('0x21')](function(_0x3ddbd5){if(!_0x3ddbd5)return null;_0x5d623c['message'][_0x309f('0x60')]=_0x3ddbd5;return _0x5d623c;})['then'](function(_0x11f274){if(_0x11f274){_0x11f274[_0x309f('0x27')][_0x309f('0x74')]=util[_0x309f('0x5d')]('SIP/%s',_0x554c28[_0x309f('0x5f')][_0x309f('0x39')]);_0x11f274[_0x309f('0x27')][_0x309f('0x76')]=_0x5d623c[_0x309f('0x76')];_0x11f274[_0x309f('0x27')][_0x309f('0x77')]=_0x5d623c['channel'];_0x11f274[_0x309f('0x27')][_0x309f('0x78')]=_0x309f('0x7c');respondWithRpcPromise('EventManager','EventManager',{'event':_0x309f('0x82'),'message':_0x11f274['message']},client9002);return _0x5d623c;}return null;})[_0x309f('0x21')](respondWithResult(_0x2c235b,null))[_0x309f('0x56')](handleError(_0x2c235b,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 6555d6d..b4756ef 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 _0x37e7=['remove','emit','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x37e7,0x81));var _0x737e=function(_0x59c8b1,_0x1cb5a4){_0x59c8b1=_0x59c8b1-0x0;var _0x44f1f6=_0x37e7[_0x59c8b1];return _0x44f1f6;};'use strict';var EventEmitter=require(_0x737e('0x0'));var OpenchannelMessage=require(_0x737e('0x1'))['db'][_0x737e('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x737e('0x3')](0x0);var events={'afterCreate':_0x737e('0x4'),'afterUpdate':_0x737e('0x5'),'afterDestroy':_0x737e('0x6')};function emitEvent(_0x79c16e){return function(_0xa6e853,_0x1f0b37,_0x53a15d){OpenchannelMessageEvents['emit'](_0x79c16e+':'+_0xa6e853['id'],_0xa6e853);OpenchannelMessageEvents[_0x737e('0x7')](_0x79c16e,_0xa6e853);_0x53a15d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x737e('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x1076=['emit','exports','../../mysqldb','setMaxListeners','update','remove'];(function(_0x4bcbc2,_0x46cbff){var _0xe5b888=function(_0xd3a99d){while(--_0xd3a99d){_0x4bcbc2['push'](_0x4bcbc2['shift']());}};_0xe5b888(++_0x46cbff);}(_0x1076,0xec));var _0x6107=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x1076[_0x20a558];return _0x53d3f7;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x6107('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6107('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6107('0x2'),'afterDestroy':_0x6107('0x3')};function emitEvent(_0x479094){return function(_0x2b33e2,_0x2a0b13,_0x577d12){OpenchannelMessageEvents[_0x6107('0x4')](_0x479094+':'+_0x2b33e2['id'],_0x2b33e2);OpenchannelMessageEvents[_0x6107('0x4')](_0x479094,_0x2b33e2);_0x577d12(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x6107('0x5')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index e5f8086..1bd9b5a 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 _0x087b=['threadId','OpenchannelInteraction','error','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch','out','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','GET','POST','Message\x20%d\x20forwarded\x20to\x20%s'];(function(_0x431a60,_0x4a6f04){var _0x4432ad=function(_0x58c1e2){while(--_0x58c1e2){_0x431a60['push'](_0x431a60['shift']());}};_0x4432ad(++_0x4a6f04);}(_0x087b,0x11a));var _0xb087=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x087b[_0x344a3f];return _0x264712;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb087('0x2'));var BPromise=require('bluebird');var rp=require(_0xb087('0x3'));var fs=require('fs');var path=require(_0xb087('0x4'));var rimraf=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var attributes=require(_0xb087('0x7'));module[_0xb087('0x8')]=function(_0x40156d,_0x17d6e8){return _0x40156d[_0xb087('0x9')](_0xb087('0xa'),attributes,{'tableName':_0xb087('0xb'),'paranoid':![],'indexes':[{'name':_0xb087('0xc'),'fields':[_0xb087('0xd')],'type':_0xb087('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f14bc,_0x23cdd7,_0x379041){var _0x583d25=_0x40156d[_0xb087('0xf')];var _0x108451=_0x2f14bc[_0xb087('0x10')]({'plain':!![]});if(_0x108451[_0xb087('0x11')][_0xb087('0x12')]()==='in'||_0x108451[_0xb087('0x11')][_0xb087('0x12')]()==='out'&&!_0x108451[_0xb087('0x13')]&&!_[_0xb087('0x14')](_0x108451[_0xb087('0x15')])){_0x583d25['OpenchannelInteraction'][_0xb087('0x16')]({'where':{'id':_0x108451[_0xb087('0x17')]}})[_0xb087('0x18')](function(_0x46410b){if(_0x46410b){_0x46410b[_0xb087('0x19')]({'lastMsgAt':_0x108451[_0xb087('0x1a')],'lastMsgDirection':_0x108451[_0xb087('0x11')][_0xb087('0x12')]()});}})[_0xb087('0x1b')](function(_0x16d0b7){console['error'](_0x16d0b7);});}if(_0x108451[_0xb087('0x11')]===_0xb087('0x1c')&&!_0x108451['secret']){var _0xcc4426;_0x583d25[_0xb087('0x1d')][_0xb087('0x1e')]()['then'](function(_0x330005){return _0x583d25[_0xb087('0x1f')][_0xb087('0x20')]({'where':{'id':_0x108451[_0xb087('0x21')]},'include':[{'model':_0x583d25['OpenchannelInteraction'],'as':_0xb087('0x22'),'where':{'id':_0x108451[_0xb087('0x17')]},'limit':0x1,'include':[{'model':_0x583d25[_0xb087('0x1d')],'as':_0xb087('0x23'),'attributes':_['keys'](_0x330005)}]}]});})['then'](function(_0x5ea3dc){_0xcc4426=_0x5ea3dc['get']({'plain':!![]});if(_0xcc4426&&_0xcc4426[_0xb087('0x24')]){logger[_0xb087('0x25')](_0xb087('0x26'),_0xb087('0x27'),util[_0xb087('0x28')](_0xb087('0x29'),_0x108451['id'],_0xcc4426[_0xb087('0x24')]));if(_0xcc4426['Interactions']&&_0xcc4426[_0xb087('0x22')][_0xb087('0x2a')]){_0x108451[_0xb087('0x2b')]=_[_0xb087('0x2c')](_0xcc4426[_0xb087('0x22')][0x0],'Contact');_0x108451[_0xb087('0x23')]=_0xcc4426[_0xb087('0x22')][0x0]['Contact'];}var _0x23cdd7={'method':'POST','uri':encodeURI(_0xcc4426['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x23cdd7['method']){case _0xb087('0x2d'):_0x23cdd7['qs']=_0x108451;break;case _0xb087('0x2e'):_0x23cdd7[_0xb087('0xd')]=_0x108451;break;}return rp(_0x23cdd7)[_0xb087('0x18')](function(_0xd9ec66){logger[_0xb087('0x25')](_0xb087('0x26'),_0xb087('0x27'),util[_0xb087('0x28')](_0xb087('0x2f'),_0x108451['id'],_0xcc4426[_0xb087('0x24')]));if(_0xd9ec66[_0xb087('0xd')][_0xb087('0x30')]&&_0xd9ec66[_0xb087('0xd')]['threadId']!=_0x108451[_0xb087('0x2b')][_0xb087('0x30')]){return _0x583d25[_0xb087('0x31')][_0xb087('0x19')]({'threadId':_0xd9ec66[_0xb087('0xd')][_0xb087('0x30')]},{'logging':!![],'where':{'id':_0x108451[_0xb087('0x2b')]['id']}});}else{return;}})[_0xb087('0x18')](function(){return _0x2f14bc['update']({'read':!![]});})['catch'](function(_0x3f9311){logger[_0xb087('0x32')]('OpenchannelMessage,\x20%s,\x20%s',_0xb087('0x27'),util[_0xb087('0x33')](_0x3f9311,{'showHidden':![],'depth':null}));_0x379041();});}else{_0x379041();}})[_0xb087('0x34')](function(){_0x379041();});}else{_0x379041();}}},'charset':_0xb087('0x35'),'collate':_0xb087('0x36')});}; \ No newline at end of file +var _0x4fc2=['length','omit','Contact','POST','method','OpenchannelMessage,\x20%s,\x20%s','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','finally','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','keys','info','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','replyUri'];(function(_0x20092b,_0x1feed5){var _0x507104=function(_0x31b87a){while(--_0x31b87a){_0x20092b['push'](_0x20092b['shift']());}};_0x507104(++_0x1feed5);}(_0x4fc2,0x111));var _0x24fc=function(_0x32a22d,_0x17b134){_0x32a22d=_0x32a22d-0x0;var _0x302d10=_0x4fc2[_0x32a22d];return _0x302d10;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'paranoid':![],'indexes':[{'name':_0x24fc('0xb'),'fields':[_0x24fc('0xc')],'type':_0x24fc('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47349b,_0x5afdf1,_0x44caca){var _0x1819a5=_0x26fcc6[_0x24fc('0xe')];var _0x133438=_0x47349b[_0x24fc('0xf')]({'plain':!![]});if(_0x133438[_0x24fc('0x10')][_0x24fc('0x11')]()==='in'||_0x133438[_0x24fc('0x10')]['toLowerCase']()===_0x24fc('0x12')&&!_0x133438[_0x24fc('0x13')]&&!_['isNil'](_0x133438[_0x24fc('0x14')])){_0x1819a5[_0x24fc('0x15')][_0x24fc('0x16')]({'where':{'id':_0x133438[_0x24fc('0x17')]}})[_0x24fc('0x18')](function(_0x326276){if(_0x326276){_0x326276['update']({'lastMsgAt':_0x133438[_0x24fc('0x19')],'lastMsgDirection':_0x133438[_0x24fc('0x10')][_0x24fc('0x11')]()});}})[_0x24fc('0x1a')](function(_0x4acd36){console[_0x24fc('0x1b')](_0x4acd36);});}if(_0x133438['direction']===_0x24fc('0x12')&&!_0x133438[_0x24fc('0x13')]){var _0x218fb6;_0x1819a5[_0x24fc('0x1c')][_0x24fc('0x1d')]()['then'](function(_0x23873c){return _0x1819a5[_0x24fc('0x1e')][_0x24fc('0x1f')]({'where':{'id':_0x133438[_0x24fc('0x20')]},'include':[{'model':_0x1819a5['OpenchannelInteraction'],'as':_0x24fc('0x21'),'where':{'id':_0x133438[_0x24fc('0x17')]},'limit':0x1,'include':[{'model':_0x1819a5[_0x24fc('0x1c')],'as':'Contact','attributes':_[_0x24fc('0x22')](_0x23873c)}]}]});})[_0x24fc('0x18')](function(_0xbf1d6b){_0x218fb6=_0xbf1d6b[_0x24fc('0xf')]({'plain':!![]});if(_0x218fb6&&_0x218fb6['replyUri']){logger[_0x24fc('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x24fc('0x24'),util['format'](_0x24fc('0x25'),_0x133438['id'],_0x218fb6[_0x24fc('0x26')]));if(_0x218fb6[_0x24fc('0x21')]&&_0x218fb6['Interactions'][_0x24fc('0x27')]){_0x133438['Interaction']=_[_0x24fc('0x28')](_0x218fb6[_0x24fc('0x21')][0x0],_0x24fc('0x29'));_0x133438[_0x24fc('0x29')]=_0x218fb6[_0x24fc('0x21')][0x0][_0x24fc('0x29')];}var _0x5afdf1={'method':_0x24fc('0x2a'),'uri':encodeURI(_0x218fb6[_0x24fc('0x26')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5afdf1[_0x24fc('0x2b')]){case'GET':_0x5afdf1['qs']=_0x133438;break;case _0x24fc('0x2a'):_0x5afdf1[_0x24fc('0xc')]=_0x133438;break;}return rp(_0x5afdf1)[_0x24fc('0x18')](function(_0x5bb4c8){logger[_0x24fc('0x23')](_0x24fc('0x2c'),_0x24fc('0x24'),util[_0x24fc('0x2d')](_0x24fc('0x2e'),_0x133438['id'],_0x218fb6[_0x24fc('0x26')]));if(_0x5bb4c8['body'][_0x24fc('0x2f')]&&_0x5bb4c8[_0x24fc('0xc')][_0x24fc('0x2f')]!=_0x133438[_0x24fc('0x30')][_0x24fc('0x2f')]){return _0x1819a5['OpenchannelInteraction']['update']({'threadId':_0x5bb4c8['body'][_0x24fc('0x2f')]},{'logging':!![],'where':{'id':_0x133438['Interaction']['id']}});}else{return;}})[_0x24fc('0x18')](function(){return _0x47349b[_0x24fc('0x31')]({'read':!![]});})[_0x24fc('0x1a')](function(_0x2086c0){logger['error'](_0x24fc('0x2c'),_0x24fc('0x24'),util['inspect'](_0x2086c0,{'showHidden':![],'depth':null}));_0x44caca();});}else{_0x44caca();}})[_0x24fc('0x32')](function(){_0x44caca();});}else{_0x44caca();}}},'charset':_0x24fc('0x33'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index ec3bf90..baaf4e9 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 _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(_0x281edd,_0x554bec){var _0x209b40=function(_0x45785d){while(--_0x45785d){_0x281edd['push'](_0x281edd['shift']());}};_0x209b40(++_0x554bec);}(_0x1261,0x144));var _0x1126=function(_0x2c2781,_0x5f1153){_0x2c2781=_0x2c2781-0x0;var _0x3fe469=_0x1261[_0x2c2781];return _0x3fe469;};'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 +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x30fd9d,_0x2856a0){var _0x5dae2d=function(_0x50218a){while(--_0x50218a){_0x30fd9d['push'](_0x30fd9d['shift']());}};_0x5dae2d(++_0x2856a0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5972de,_0x2b786b){_0x5972de=_0x5972de-0x0;var _0x5d1f41=_0x5f2f[_0x5972de];return _0x5d1f41;};'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});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index c9dd52c..edc2fcc 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 _0x4044=['emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove','update'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x4044,0xcb));var _0x4404=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x4044[_0x465028];return _0xb783d4;};'use strict';var OpenchannelMessageEvents=require(_0x4404('0x0'));var events=[_0x4404('0x1'),_0x4404('0x2'),_0x4404('0x3')];function createListener(_0x2c42f8,_0x44573d){return function(_0x2a9c6a){_0x44573d[_0x4404('0x4')](_0x2c42f8,_0x2a9c6a);};}function removeListener(_0x3ea96c,_0x9a4fdc){return function(){OpenchannelMessageEvents[_0x4404('0x5')](_0x3ea96c,_0x9a4fdc);};}exports[_0x4404('0x6')]=function(_0x53cef4){for(var _0x4f8263=0x0,_0x110490=events[_0x4404('0x7')];_0x4f8263<_0x110490;_0x4f8263++){var _0x50c7de=events[_0x4f8263];var _0x7cd5a5=createListener(_0x4404('0x8')+_0x50c7de,_0x53cef4);OpenchannelMessageEvents['on'](_0x50c7de,_0x7cd5a5);}}; \ No newline at end of file +var _0x5c97=['register','remove','update','emit','removeListener'];(function(_0x3020fe,_0x2d8bb2){var _0x5cbbac=function(_0xeb968a){while(--_0xeb968a){_0x3020fe['push'](_0x3020fe['shift']());}};_0x5cbbac(++_0x2d8bb2);}(_0x5c97,0x164));var _0x75c9=function(_0x2fb561,_0x579dbf){_0x2fb561=_0x2fb561-0x0;var _0x2b7be3=_0x5c97[_0x2fb561];return _0x2b7be3;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x75c9('0x0'),_0x75c9('0x1')];function createListener(_0x31eafa,_0x565899){return function(_0x5ee6ee){_0x565899[_0x75c9('0x2')](_0x31eafa,_0x5ee6ee);};}function removeListener(_0x4b27b9,_0x42b013){return function(){OpenchannelMessageEvents[_0x75c9('0x3')](_0x4b27b9,_0x42b013);};}exports[_0x75c9('0x4')]=function(_0x5a8382){for(var _0x593294=0x0,_0x53b999=events['length'];_0x593294<_0x53b999;_0x593294++){var _0xda1364=events[_0x593294];var _0x59ed56=createListener('openchannelMessage:'+_0xda1364,_0x5a8382);OpenchannelMessageEvents['on'](_0xda1364,_0x59ed56);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index c6bdf85..9913f09 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 _0x0605=['getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','index','/describe','isAuthenticated','describe','get','/:id','show','/:id/members'];(function(_0x26cc16,_0x4c174f){var _0x345e3e=function(_0x14b4f8){while(--_0x14b4f8){_0x26cc16['push'](_0x26cc16['shift']());}};_0x345e3e(++_0x4c174f);}(_0x0605,0x164));var _0x5060=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x0605[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require('multer');var util=require(_0x5060('0x0'));var path=require(_0x5060('0x1'));var timeout=require(_0x5060('0x2'));var express=require(_0x5060('0x3'));var router=express[_0x5060('0x4')]();var fs_extra=require(_0x5060('0x5'));var auth=require(_0x5060('0x6'));var interaction=require(_0x5060('0x7'));var config=require(_0x5060('0x8'));var controller=require(_0x5060('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x5060('0xa')]);router['get'](_0x5060('0xb'),auth[_0x5060('0xc')](),controller[_0x5060('0xd')]);router[_0x5060('0xe')](_0x5060('0xf'),auth['isAuthenticated'](),controller[_0x5060('0x10')]);router[_0x5060('0xe')](_0x5060('0x11'),auth[_0x5060('0xc')](),controller[_0x5060('0x12')]);router['get'](_0x5060('0x13'),auth[_0x5060('0xc')](),controller[_0x5060('0x14')]);router[_0x5060('0xe')]('/:id/users',auth[_0x5060('0xc')](),controller[_0x5060('0x15')]);router[_0x5060('0x16')]('/',auth[_0x5060('0xc')](),controller[_0x5060('0x17')]);router['post'](_0x5060('0x13'),auth[_0x5060('0xc')](),controller[_0x5060('0x18')]);router[_0x5060('0x16')](_0x5060('0x19'),auth[_0x5060('0xc')](),controller[_0x5060('0x1a')]);router[_0x5060('0x1b')]('/:id',auth[_0x5060('0xc')](),controller[_0x5060('0x1c')]);router['delete'](_0x5060('0xf'),auth['isAuthenticated'](),controller[_0x5060('0x1d')]);router[_0x5060('0x1e')](_0x5060('0x13'),auth['isAuthenticated'](),controller[_0x5060('0x1f')]);router['delete']('/:id/users',auth[_0x5060('0xc')](),controller[_0x5060('0x20')]);module[_0x5060('0x21')]=router; \ No newline at end of file +var _0x72ad=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','get','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents'];(function(_0xa2f83b,_0x1cddc2){var _0x2302ee=function(_0x189bf9){while(--_0x189bf9){_0xa2f83b['push'](_0xa2f83b['shift']());}};_0x2302ee(++_0x1cddc2);}(_0x72ad,0x10f));var _0xd72a=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x72ad[_0x292f93];return _0x5a94b1;};'use strict';var multer=require(_0xd72a('0x0'));var util=require(_0xd72a('0x1'));var path=require(_0xd72a('0x2'));var timeout=require('connect-timeout');var express=require(_0xd72a('0x3'));var router=express['Router']();var fs_extra=require(_0xd72a('0x4'));var auth=require(_0xd72a('0x5'));var interaction=require(_0xd72a('0x6'));var config=require(_0xd72a('0x7'));var controller=require(_0xd72a('0x8'));router['get']('/',auth[_0xd72a('0x9')](),controller['index']);router[_0xd72a('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xd72a('0xb')]);router[_0xd72a('0xa')](_0xd72a('0xc'),auth[_0xd72a('0x9')](),controller[_0xd72a('0xd')]);router['get'](_0xd72a('0xe'),auth[_0xd72a('0x9')](),controller[_0xd72a('0xf')]);router[_0xd72a('0xa')](_0xd72a('0x10'),auth[_0xd72a('0x9')](),controller[_0xd72a('0x11')]);router[_0xd72a('0xa')](_0xd72a('0x12'),auth[_0xd72a('0x9')](),controller[_0xd72a('0x13')]);router[_0xd72a('0x14')]('/',auth['isAuthenticated'](),controller[_0xd72a('0x15')]);router[_0xd72a('0x14')](_0xd72a('0x10'),auth[_0xd72a('0x9')](),controller[_0xd72a('0x16')]);router[_0xd72a('0x14')](_0xd72a('0x12'),auth[_0xd72a('0x9')](),controller[_0xd72a('0x17')]);router['put'](_0xd72a('0xc'),auth[_0xd72a('0x9')](),controller[_0xd72a('0x18')]);router[_0xd72a('0x19')](_0xd72a('0xc'),auth['isAuthenticated'](),controller[_0xd72a('0x1a')]);router[_0xd72a('0x19')](_0xd72a('0x10'),auth[_0xd72a('0x9')](),controller[_0xd72a('0x1b')]);router[_0xd72a('0x19')](_0xd72a('0x12'),auth[_0xd72a('0x9')](),controller[_0xd72a('0x1c')]);module[_0xd72a('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index e467d7c..4e82dde 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 _0x5c6b=['INTEGER','rrmemory','beepall','roundrobin','STRING','name'];(function(_0x22d72b,_0x112e6d){var _0x35f65f=function(_0x23d67f){while(--_0x23d67f){_0x22d72b['push'](_0x22d72b['shift']());}};_0x35f65f(++_0x112e6d);}(_0x5c6b,0x88));var _0xb5c6=function(_0x59f081,_0x4e1075){_0x59f081=_0x59f081-0x0;var _0x2dbe0c=_0x5c6b[_0x59f081];return _0x2dbe0c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb5c6('0x0')],'unique':_0xb5c6('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb5c6('0x0')]},'timeout':{'type':Sequelize[_0xb5c6('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb5c6('0x3'),_0xb5c6('0x4'),_0xb5c6('0x5'))}}; \ No newline at end of file +var _0xafa8=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','STRING','name'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xafa8,0xe4));var _0x8afa=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0xafa8[_0x3d4876];return _0x58ca9d;};'use strict';var Sequelize=require(_0x8afa('0x0'));module['exports']={'name':{'type':Sequelize[_0x8afa('0x1')],'unique':_0x8afa('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8afa('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8afa('0x4')](_0x8afa('0x5'),'beepall',_0x8afa('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index e2f38e9..c1f4c97 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 _0x4f0e=['api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','json','limit','undefined','count','offset','status','Content-Range','apply','reject','update','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','OpenchannelQueue','findAll','rows','catch','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','params','describe','getMembers','findOne','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','voicePause','interface','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','all','union','compact','transaction','isEmpty','removeAgents','forEach','addAgents','spread','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x221927,_0x1cd547){var _0x5c7399=function(_0x19b6ca){while(--_0x19b6ca){_0x221927['push'](_0x221927['shift']());}};_0x5c7399(++_0x1cd547);}(_0x4f0e,0xfe));var _0xe4f0=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x4f0e[_0x1abb09];return _0xea1c07;};'use strict';var emlformat=require(_0xe4f0('0x0'));var rimraf=require(_0xe4f0('0x1'));var zipdir=require(_0xe4f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe4f0('0x3'));var moment=require(_0xe4f0('0x4'));var BPromise=require(_0xe4f0('0x5'));var Mustache=require(_0xe4f0('0x6'));var util=require(_0xe4f0('0x7'));var path=require('path');var sox=require(_0xe4f0('0x8'));var csv=require(_0xe4f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4f0('0xa'));var _=require(_0xe4f0('0xb'));var squel=require('squel');var crypto=require(_0xe4f0('0xc'));var jsforce=require(_0xe4f0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe4f0('0x9'));var querystring=require(_0xe4f0('0xe'));var Papa=require(_0xe4f0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe4f0('0x10'));var as=require(_0xe4f0('0x11'));var hardwareService=require(_0xe4f0('0x12'));var logger=require(_0xe4f0('0x13'))(_0xe4f0('0x14'));var utils=require('../../config/utils');var config=require(_0xe4f0('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4f0('0x16'))['db'];config[_0xe4f0('0x17')]=_[_0xe4f0('0x18')](config[_0xe4f0('0x17')],{'host':_0xe4f0('0x19'),'port':0x18eb});var socket=require(_0xe4f0('0x1a'))(new Redis(config[_0xe4f0('0x17')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x195ded,_0x1cf360){_0x1cf360=_0x1cf360||0xcc;return function(_0x4ac5c2){if(_0x4ac5c2){return _0x195ded[_0xe4f0('0x1b')](_0x1cf360);}return _0x195ded['status'](_0x1cf360)[_0xe4f0('0x1c')]();};}function respondWithResult(_0x29b3c2,_0x4b1fb8){_0x4b1fb8=_0x4b1fb8||0xc8;return function(_0x3c8981){if(_0x3c8981){return _0x29b3c2['status'](_0x4b1fb8)[_0xe4f0('0x1d')](_0x3c8981);}};}function respondWithFilteredResult(_0x390601,_0xa2f8b6){return function(_0x42204e){if(_0x42204e){var _0x1083bc=typeof _0xa2f8b6['offset']==='undefined'&&typeof _0xa2f8b6[_0xe4f0('0x1e')]===_0xe4f0('0x1f');var _0x1f0bb7=_0x42204e[_0xe4f0('0x20')];var _0x20c582=_0x1083bc?0x0:_0xa2f8b6[_0xe4f0('0x21')];var _0xbf8da4=_0x1083bc?_0x42204e[_0xe4f0('0x20')]:_0xa2f8b6[_0xe4f0('0x21')]+_0xa2f8b6[_0xe4f0('0x1e')];var _0x5a3e49;if(_0xbf8da4>=_0x1f0bb7){_0xbf8da4=_0x1f0bb7;_0x5a3e49=0xc8;}else{_0x5a3e49=0xce;}_0x390601[_0xe4f0('0x22')](_0x5a3e49);return _0x390601['set'](_0xe4f0('0x23'),_0x20c582+'-'+_0xbf8da4+'/'+_0x1f0bb7)[_0xe4f0('0x1d')](_0x42204e);}return null;};}function patchUpdates(_0x36fa84){return function(_0x237ad7){try{jsonpatch[_0xe4f0('0x24')](_0x237ad7,_0x36fa84,!![]);}catch(_0x179786){return BPromise[_0xe4f0('0x25')](_0x179786);}return _0x237ad7['save']();};}function saveUpdates(_0x15dc97,_0x20ce63){return function(_0xdc5684){if(_0xdc5684){return _0xdc5684[_0xe4f0('0x26')](_0x15dc97)[_0xe4f0('0x27')](function(_0x139c0a){return _0x139c0a;});}return null;};}function removeEntity(_0x16874a,_0xc1196e){return function(_0x5de87a){if(_0x5de87a){return _0x5de87a[_0xe4f0('0x28')]()[_0xe4f0('0x27')](function(){var _0x41294d=_0x5de87a['get']({'plain':!![]});var _0x5e443d=_0xe4f0('0x29');return db[_0xe4f0('0x2a')]['destroy']({'where':{'type':_0x5e443d,'resourceId':_0x41294d['id']}})[_0xe4f0('0x27')](function(){return _0x5de87a;});})[_0xe4f0('0x27')](function(){_0x16874a[_0xe4f0('0x22')](0xcc)[_0xe4f0('0x1c')]();});}};}function handleEntityNotFound(_0x16fc30,_0x4fedc1){return function(_0x27af5e){if(!_0x27af5e){_0x16fc30[_0xe4f0('0x1b')](0x194);}return _0x27af5e;};}function handleError(_0x34216a,_0x55d5c3){_0x55d5c3=_0x55d5c3||0x1f4;return function(_0x20518d){logger[_0xe4f0('0x2b')](_0x20518d[_0xe4f0('0x2c')]);if(_0x20518d['name']){delete _0x20518d[_0xe4f0('0x2d')];}_0x34216a['status'](_0x55d5c3)['send'](_0x20518d);};}exports['index']=function(_0x3992b1,_0x50ff20){var _0x4b78c4={},_0x2de523={},_0x281b6b={'count':0x0,'rows':[]};var _0x2c014e=_[_0xe4f0('0x2e')](db['OpenchannelQueue'][_0xe4f0('0x2f')],function(_0x56f342){return{'name':_0x56f342[_0xe4f0('0x30')],'type':_0x56f342[_0xe4f0('0x31')][_0xe4f0('0x32')]};});_0x2de523[_0xe4f0('0x33')]=_[_0xe4f0('0x2e')](_0x2c014e,_0xe4f0('0x2d'));_0x2de523[_0xe4f0('0x34')]=_[_0xe4f0('0x35')](_0x3992b1[_0xe4f0('0x34')]);_0x2de523[_0xe4f0('0x36')]=_[_0xe4f0('0x37')](_0x2de523['model'],_0x2de523[_0xe4f0('0x34')]);_0x4b78c4[_0xe4f0('0x38')]=_[_0xe4f0('0x37')](_0x2de523[_0xe4f0('0x33')],qs[_0xe4f0('0x39')](_0x3992b1[_0xe4f0('0x34')][_0xe4f0('0x39')]));_0x4b78c4[_0xe4f0('0x38')]=_0x4b78c4['attributes'][_0xe4f0('0x3a')]?_0x4b78c4[_0xe4f0('0x38')]:_0x2de523[_0xe4f0('0x33')];if(!_0x3992b1[_0xe4f0('0x34')][_0xe4f0('0x3b')](_0xe4f0('0x3c'))){_0x4b78c4[_0xe4f0('0x1e')]=qs[_0xe4f0('0x1e')](_0x3992b1[_0xe4f0('0x34')][_0xe4f0('0x1e')]);_0x4b78c4[_0xe4f0('0x21')]=qs[_0xe4f0('0x21')](_0x3992b1['query'][_0xe4f0('0x21')]);}_0x4b78c4[_0xe4f0('0x3d')]=qs[_0xe4f0('0x3e')](_0x3992b1[_0xe4f0('0x34')][_0xe4f0('0x3e')]);_0x4b78c4[_0xe4f0('0x3f')]=qs['filters'](_[_0xe4f0('0x40')](_0x3992b1[_0xe4f0('0x34')],_0x2de523['filters']),_0x2c014e);if(_0x3992b1[_0xe4f0('0x34')][_0xe4f0('0x41')]){_0x4b78c4[_0xe4f0('0x3f')]=_[_0xe4f0('0x42')](_0x4b78c4[_0xe4f0('0x3f')],{'$or':_['map'](_0x2c014e,function(_0x58ed61){if(_0x58ed61[_0xe4f0('0x31')]!==_0xe4f0('0x43')){var _0x5d4d6e={};_0x5d4d6e[_0x58ed61[_0xe4f0('0x2d')]]={'$like':'%'+_0x3992b1[_0xe4f0('0x34')]['filter']+'%'};return _0x5d4d6e;}})});}_0x4b78c4=_[_0xe4f0('0x42')]({},_0x4b78c4,_0x3992b1[_0xe4f0('0x44')]);var _0x52d9be={'where':_0x4b78c4[_0xe4f0('0x3f')]};return db['OpenchannelQueue'][_0xe4f0('0x20')](_0x52d9be)[_0xe4f0('0x27')](function(_0x1741bb){_0x281b6b[_0xe4f0('0x20')]=_0x1741bb;if(_0x3992b1[_0xe4f0('0x34')]['includeAll']){_0x4b78c4[_0xe4f0('0x45')]=[{'all':!![]}];}return db[_0xe4f0('0x46')][_0xe4f0('0x47')](_0x4b78c4);})[_0xe4f0('0x27')](function(_0x4b4c5b){_0x281b6b[_0xe4f0('0x48')]=_0x4b4c5b;return _0x281b6b;})[_0xe4f0('0x27')](respondWithFilteredResult(_0x50ff20,_0x4b78c4))[_0xe4f0('0x49')](handleError(_0x50ff20,null));};exports['show']=function(_0x36093b,_0x323fd2){var _0x4bdf2b={'raw':!![],'where':{'id':_0x36093b['params']['id']}},_0x2ba228={};_0x2ba228[_0xe4f0('0x33')]=_[_0xe4f0('0x35')](db[_0xe4f0('0x46')][_0xe4f0('0x2f')]);_0x2ba228[_0xe4f0('0x34')]=_[_0xe4f0('0x35')](_0x36093b['query']);_0x2ba228[_0xe4f0('0x36')]=_['intersection'](_0x2ba228['model'],_0x2ba228[_0xe4f0('0x34')]);_0x4bdf2b['attributes']=_[_0xe4f0('0x37')](_0x2ba228[_0xe4f0('0x33')],qs[_0xe4f0('0x39')](_0x36093b[_0xe4f0('0x34')][_0xe4f0('0x39')]));_0x4bdf2b[_0xe4f0('0x38')]=_0x4bdf2b[_0xe4f0('0x38')][_0xe4f0('0x3a')]?_0x4bdf2b[_0xe4f0('0x38')]:_0x2ba228[_0xe4f0('0x33')];if(_0x36093b[_0xe4f0('0x34')]['includeAll']){_0x4bdf2b[_0xe4f0('0x45')]=[{'all':!![]}];}_0x4bdf2b=_['merge']({},_0x4bdf2b,_0x36093b['options']);return db[_0xe4f0('0x46')][_0xe4f0('0x4a')](_0x4bdf2b)[_0xe4f0('0x27')](handleEntityNotFound(_0x323fd2,null))[_0xe4f0('0x27')](respondWithResult(_0x323fd2,null))[_0xe4f0('0x49')](handleError(_0x323fd2,null));};exports[_0xe4f0('0x4b')]=function(_0x3d5359,_0x4be6f6){return db[_0xe4f0('0x46')]['create'](_0x3d5359['body'],{})[_0xe4f0('0x27')](function(_0x4e5dac){var _0x521d22=_0x3d5359[_0xe4f0('0x4c')][_0xe4f0('0x4d')]({'plain':!![]});if(!_0x521d22)throw new Error(_0xe4f0('0x4e'));if(_0x521d22[_0xe4f0('0x4f')]===_0xe4f0('0x4c')){var _0x2662a0=_0x4e5dac['get']({'plain':!![]});var _0x3ddba7=_0xe4f0('0x29');return db[_0xe4f0('0x50')][_0xe4f0('0x4a')]({'where':{'name':_0x3ddba7,'userProfileId':_0x521d22[_0xe4f0('0x51')]},'raw':!![]})[_0xe4f0('0x27')](function(_0x42d20a){if(_0x42d20a&&_0x42d20a[_0xe4f0('0x52')]===0x0){return db[_0xe4f0('0x2a')][_0xe4f0('0x4b')]({'name':_0x2662a0[_0xe4f0('0x2d')],'resourceId':_0x2662a0['id'],'type':_0x42d20a[_0xe4f0('0x2d')],'sectionId':_0x42d20a['id']},{})[_0xe4f0('0x27')](function(){return _0x4e5dac;});}else{return _0x4e5dac;}})['catch'](function(_0x4cbcd7){logger[_0xe4f0('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cbcd7);throw _0x4cbcd7;});}return _0x4e5dac;})[_0xe4f0('0x27')](respondWithResult(_0x4be6f6,0xc9))[_0xe4f0('0x49')](handleError(_0x4be6f6,null));};exports[_0xe4f0('0x26')]=function(_0x48272a,_0x182a93){if(_0x48272a['body']['id']){delete _0x48272a[_0xe4f0('0x53')]['id'];}return db['OpenchannelQueue'][_0xe4f0('0x4a')]({'where':{'id':_0x48272a[_0xe4f0('0x54')]['id']}})['then'](handleEntityNotFound(_0x182a93,null))[_0xe4f0('0x27')](saveUpdates(_0x48272a['body'],null))[_0xe4f0('0x27')](respondWithResult(_0x182a93,null))[_0xe4f0('0x49')](handleError(_0x182a93,null));};exports['destroy']=function(_0x289e6b,_0xdc10e6){return db[_0xe4f0('0x46')]['find']({'where':{'id':_0x289e6b[_0xe4f0('0x54')]['id']}})[_0xe4f0('0x27')](handleEntityNotFound(_0xdc10e6,null))[_0xe4f0('0x27')](removeEntity(_0xdc10e6,null))[_0xe4f0('0x49')](handleError(_0xdc10e6,null));};exports['describe']=function(_0x16c3d4,_0x40f532){return db['OpenchannelQueue'][_0xe4f0('0x55')]()['then'](respondWithResult(_0x40f532,null))['catch'](handleError(_0x40f532,null));};exports[_0xe4f0('0x56')]=function(_0x197629,_0x503ee9,_0x246675){var _0x4ac807={'raw':!![],'where':{}},_0x151b32={},_0x55657e;return db[_0xe4f0('0x46')][_0xe4f0('0x57')]({'where':{'id':_0x197629['params']['id']}})[_0xe4f0('0x27')](handleEntityNotFound(_0x503ee9,null))[_0xe4f0('0x27')](function(_0x1f5fae){if(_0x1f5fae){_0x55657e=_0x1f5fae[_0xe4f0('0x4d')]({'plain':!![]});_0x151b32[_0xe4f0('0x33')]=_['keys'](db['UserOpenchannelQueue'][_0xe4f0('0x2f')]);_0x151b32[_0xe4f0('0x34')]=_[_0xe4f0('0x35')](_0x197629[_0xe4f0('0x34')]);_0x151b32[_0xe4f0('0x36')]=_[_0xe4f0('0x37')](_0x151b32[_0xe4f0('0x33')],_0x151b32[_0xe4f0('0x34')]);_0x4ac807['attributes']=_[_0xe4f0('0x37')](_0x151b32[_0xe4f0('0x33')],qs[_0xe4f0('0x39')](_0x197629['query']['fields']));_0x4ac807[_0xe4f0('0x38')]=_0x4ac807[_0xe4f0('0x38')]['length']?_0x4ac807[_0xe4f0('0x38')]:_0x151b32[_0xe4f0('0x33')];if(!_0x197629['query'][_0xe4f0('0x3b')](_0xe4f0('0x3c'))){_0x4ac807['limit']=qs[_0xe4f0('0x1e')](_0x197629[_0xe4f0('0x34')][_0xe4f0('0x1e')]);_0x4ac807['offset']=qs['offset'](_0x197629[_0xe4f0('0x34')][_0xe4f0('0x21')]);}_0x4ac807[_0xe4f0('0x3d')]=qs[_0xe4f0('0x3e')](_0x197629['query'][_0xe4f0('0x3e')]);_0x4ac807[_0xe4f0('0x3f')]=qs[_0xe4f0('0x36')](_['pick'](_0x197629[_0xe4f0('0x34')],_0x151b32['filters']));_0x4ac807['where'][_0xe4f0('0x58')]=_0x1f5fae['id'];if(_0x197629[_0xe4f0('0x34')][_0xe4f0('0x41')]){_0x4ac807[_0xe4f0('0x3f')]=_[_0xe4f0('0x42')](_0x4ac807[_0xe4f0('0x3f')],{'$or':_['map'](_0x4ac807[_0xe4f0('0x38')],function(_0x373fc2){var _0x46d632={};_0x46d632[_0x373fc2]={'$like':'%'+_0x197629[_0xe4f0('0x34')][_0xe4f0('0x41')]+'%'};return _0x46d632;})});}_0x4ac807=_[_0xe4f0('0x42')]({},_0x4ac807,_0x197629[_0xe4f0('0x44')]);return db[_0xe4f0('0x59')]['findAll'](_0x4ac807);}})[_0xe4f0('0x27')](function(_0x3b27e4){if(_0x3b27e4){return db[_0xe4f0('0x5a')][_0xe4f0('0x5b')]({'where':{'id':_[_0xe4f0('0x2e')](_0x3b27e4,_0xe4f0('0x5c')),'role':_0xe4f0('0x5d')},'attributes':['id',_0xe4f0('0x2d'),_0xe4f0('0x5e'),'updatedAt',_0xe4f0('0x5f')]});}})[_0xe4f0('0x27')](function(_0x1f15ec){if(_0x1f15ec){return{'count':_0x1f15ec[_0xe4f0('0x20')],'rows':_[_0xe4f0('0x2e')](_0x1f15ec['rows'],function(_0xad5514){return{'membername':_0xad5514['name'],'UserId':_0xad5514['id'],'queue_name':_0x55657e[_0xe4f0('0x2d')],'OpenchannelQueueId':_0x55657e['id'],'interface':util['format'](_0xe4f0('0x60'),_0xe4f0('0x61'),_0xad5514[_0xe4f0('0x2d')]),'penalty':0x0,'paused':_0xad5514[_0xe4f0('0x5e')],'createdAt':_0xad5514[_0xe4f0('0x5f')],'updatedAt':_0xad5514['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x503ee9,_0x4ac807))[_0xe4f0('0x49')](handleError(_0x503ee9,null));};exports['getTeams']=function(_0x4176af,_0x39b368,_0x356898){var _0x5b168e={};var _0x4bdd61={};var _0x302989;var _0x41fbb8;return db[_0xe4f0('0x46')][_0xe4f0('0x57')]({'where':{'id':_0x4176af[_0xe4f0('0x54')]['id']}})[_0xe4f0('0x27')](handleEntityNotFound(_0x39b368,null))[_0xe4f0('0x27')](function(_0x41bed6){if(_0x41bed6){_0x302989=_0x41bed6;_0x4bdd61[_0xe4f0('0x33')]=_[_0xe4f0('0x35')](db[_0xe4f0('0x62')][_0xe4f0('0x2f')]);_0x4bdd61[_0xe4f0('0x34')]=_[_0xe4f0('0x35')](_0x4176af[_0xe4f0('0x34')]);_0x4bdd61['filters']=_['intersection'](_0x4bdd61['model'],_0x4bdd61['query']);_0x5b168e['attributes']=_[_0xe4f0('0x37')](_0x4bdd61[_0xe4f0('0x33')],qs[_0xe4f0('0x39')](_0x4176af[_0xe4f0('0x34')][_0xe4f0('0x39')]));_0x5b168e['attributes']=_0x5b168e[_0xe4f0('0x38')]['length']?_0x5b168e['attributes']:_0x4bdd61['model'];_0x5b168e[_0xe4f0('0x3d')]=qs[_0xe4f0('0x3e')](_0x4176af[_0xe4f0('0x34')][_0xe4f0('0x3e')]);_0x5b168e['where']=qs[_0xe4f0('0x36')](_[_0xe4f0('0x40')](_0x4176af['query'],_0x4bdd61[_0xe4f0('0x36')]));if(_0x4176af[_0xe4f0('0x34')][_0xe4f0('0x41')]){_0x5b168e[_0xe4f0('0x3f')]=_['merge'](_0x5b168e[_0xe4f0('0x3f')],{'$or':_[_0xe4f0('0x2e')](_0x5b168e[_0xe4f0('0x38')],function(_0x5d5b2f){var _0x2e81f9={};_0x2e81f9[_0x5d5b2f]={'$like':'%'+_0x4176af['query']['filter']+'%'};return _0x2e81f9;})});}_0x5b168e=_[_0xe4f0('0x42')]({},_0x5b168e,_0x4176af[_0xe4f0('0x44')]);return _0x302989[_0xe4f0('0x63')](_0x5b168e);}})[_0xe4f0('0x27')](function(_0x1e4beb){if(_0x1e4beb){_0x41fbb8=_0x1e4beb[_0xe4f0('0x3a')];if(!_0x4176af[_0xe4f0('0x34')][_0xe4f0('0x3b')](_0xe4f0('0x3c'))){_0x5b168e[_0xe4f0('0x1e')]=qs[_0xe4f0('0x1e')](_0x4176af[_0xe4f0('0x34')][_0xe4f0('0x1e')]);_0x5b168e['offset']=qs[_0xe4f0('0x21')](_0x4176af['query']['offset']);}return _0x302989[_0xe4f0('0x63')](_0x5b168e);}})['then'](function(_0x53bdab){if(_0x53bdab){return _0x53bdab?{'count':_0x41fbb8,'rows':_0x53bdab}:null;}})[_0xe4f0('0x27')](respondWithResult(_0x39b368,null))[_0xe4f0('0x49')](handleError(_0x39b368,null));};exports[_0xe4f0('0x64')]=function(_0x5ca3ba,_0x1c3bcb,_0x46ccfa){var _0x1f2ada=_0x5ca3ba[_0xe4f0('0x53')][_0xe4f0('0x65')];return db[_0xe4f0('0x62')][_0xe4f0('0x47')]({'where':{'id':_0x1f2ada},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe4f0('0x66'),'attributes':['id',_0xe4f0('0x2d'),'online',_0xe4f0('0x67'),_0xe4f0('0x68')],'raw':!![]}]})[_0xe4f0('0x27')](function(_0x5b6ccc){if(_0x5b6ccc){var _0x338f23=_['flatMap'](_0x5b6ccc,function(_0x24ba50){var _0x186047=_0x24ba50[_0xe4f0('0x4d')]({'plain':!![]});return _0x186047['Agents'];});return db['OpenchannelQueue'][_0xe4f0('0x4a')]({'where':{'id':_0x5ca3ba[_0xe4f0('0x54')]['id']}})['then'](function(_0xd04fde){return db['sequelize']['transaction'](function(_0x2e44db){return _0xd04fde[_0xe4f0('0x64')](_0x1f2ada,{'transaction':_0x2e44db})[_0xe4f0('0x27')](function(){return BPromise[_0xe4f0('0x69')](_0x338f23,function(_0xa8d4f0){return db[_0xe4f0('0x59')][_0xe4f0('0x6a')]({'where':{'UserId':_0xa8d4f0['id'],'OpenchannelQueueId':_0x5ca3ba[_0xe4f0('0x54')]['id']},'transaction':_0x2e44db});});})['then'](function(){_0x338f23['forEach'](function(_0x589ef9){socket[_0xe4f0('0x6b')](_0xe4f0('0x6c'),{'UserId':_0x589ef9['id'],'OpenchannelQueueId':_0xd04fde['id']});});});});});}})['then'](respondWithStatusCode(_0x1c3bcb,null))[_0xe4f0('0x49')](handleError(_0x1c3bcb,null));};exports[_0xe4f0('0x6d')]=function(_0x3972ad,_0x5cc8a3,_0x4d6fa3){return db['Team'][_0xe4f0('0x47')]({'where':{'id':_0x3972ad[_0xe4f0('0x34')][_0xe4f0('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe4f0('0x66'),'attributes':['id'],'raw':!![]}]})[_0xe4f0('0x27')](handleEntityNotFound(_0x5cc8a3,null))[_0xe4f0('0x27')](function(_0x3350dd){var _0x405825=_[_0xe4f0('0x2e')](_0x3350dd,'id');var _0x565f4a=[];var _0x343f15=[];var _0x330fc5=squel[_0xe4f0('0x6e')]();_0x330fc5['field'](_0xe4f0('0x6f'))[_0xe4f0('0x70')](_0xe4f0('0x71'),'tq')[_0xe4f0('0x72')](_0xe4f0('0x73'),'ut',_0xe4f0('0x74'))[_0xe4f0('0x3f')]('OpenchannelQueueId\x20=\x20?',_0x3972ad[_0xe4f0('0x54')]['id']);for(var _0x320b8e=0x0;_0x320b8e<_0x3350dd['length'];_0x320b8e+=0x1){let _0x55fa09=_0x3350dd[_0x320b8e];for(var _0x322355=0x0;_0x322355<_0x55fa09[_0xe4f0('0x66')][_0xe4f0('0x3a')];_0x322355+=0x1){let _0x503cfc=_0x55fa09[_0xe4f0('0x66')][_0x322355];var _0x235c39=_0x330fc5[_0xe4f0('0x75')]();_0x235c39[_0xe4f0('0x3f')](_0xe4f0('0x76'),_0x503cfc['id']);_0x343f15[_0xe4f0('0x77')](db[_0xe4f0('0x78')][_0xe4f0('0x34')](_0x235c39[_0xe4f0('0x79')](),{'type':db[_0xe4f0('0x78')]['QueryTypes'][_0xe4f0('0x7a')]})['then'](function(_0xdf8325){if(_0xdf8325[_0xe4f0('0x3a')]===0x1){return _0x503cfc['id'];}else{var _0xf384cd=_[_0xe4f0('0x7b')](_[_0xe4f0('0x2e')](_0xdf8325,_0xe4f0('0x7c')),function(_0xceba05){return _['includes'](_0x405825,_0xceba05);});if(_0xf384cd){return _0x503cfc['id'];}}}));}}return BPromise[_0xe4f0('0x7d')](_0x343f15)[_0xe4f0('0x27')](function(_0x1ac49c){_0x565f4a=_(_0x565f4a)[_0xe4f0('0x7e')](_0x1ac49c)[_0xe4f0('0x7f')]()['value']();return db['OpenchannelQueue'][_0xe4f0('0x4a')]({'where':{'id':_0x3972ad['params']['id']}})['then'](function(_0x3f9559){return db[_0xe4f0('0x78')][_0xe4f0('0x80')](function(_0x251e49){return _0x3f9559[_0xe4f0('0x6d')](_0x3972ad[_0xe4f0('0x34')][_0xe4f0('0x65')],{'transaction':_0x251e49})[_0xe4f0('0x27')](function(){if(!_[_0xe4f0('0x81')](_0x565f4a)){return _0x3f9559[_0xe4f0('0x82')](_0x565f4a,{'transaction':_0x251e49});}})[_0xe4f0('0x27')](function(){_0x565f4a[_0xe4f0('0x83')](function(_0x25d437){socket[_0xe4f0('0x6b')]('userOpenchannelQueue:remove',{'UserId':_0x25d437,'OpenchannelQueueId':_0x3f9559['id']});});});});});});})[_0xe4f0('0x27')](respondWithStatusCode(_0x5cc8a3,null))[_0xe4f0('0x49')](handleError(_0x5cc8a3,null));};exports[_0xe4f0('0x84')]=function(_0x34a6b7,_0x4a193b,_0x280929){return db[_0xe4f0('0x46')][_0xe4f0('0x4a')]({'where':{'id':_0x34a6b7[_0xe4f0('0x54')]['id']}})[_0xe4f0('0x27')](handleEntityNotFound(_0x4a193b,null))[_0xe4f0('0x27')](function(_0x272abd){if(_0x272abd){return _0x272abd[_0xe4f0('0x84')](_0x34a6b7[_0xe4f0('0x53')][_0xe4f0('0x65')],_['omit'](_0x34a6b7[_0xe4f0('0x53')],[_0xe4f0('0x65'),'id'])||{})[_0xe4f0('0x85')](function(_0x13efad){for(var _0x2d3317=0x0;_0x2d3317<_0x34a6b7[_0xe4f0('0x53')]['ids'][_0xe4f0('0x3a')];_0x2d3317+=0x1){socket[_0xe4f0('0x6b')](_0xe4f0('0x6c'),{'UserId':Number(_0x34a6b7[_0xe4f0('0x53')][_0xe4f0('0x65')][_0x2d3317]),'OpenchannelQueueId':Number(_0x34a6b7['params']['id'])});}return _0x13efad;});}})['then'](respondWithResult(_0x4a193b,null))[_0xe4f0('0x49')](handleError(_0x4a193b,null));};exports[_0xe4f0('0x82')]=function(_0x4023c0,_0x4f81f7,_0x538a05){return db['OpenchannelQueue'][_0xe4f0('0x4a')]({'where':{'id':_0x4023c0[_0xe4f0('0x54')]['id']}})[_0xe4f0('0x27')](handleEntityNotFound(_0x4f81f7,null))[_0xe4f0('0x27')](function(_0x110e88){if(_0x110e88){return _0x110e88[_0xe4f0('0x82')](_0x4023c0[_0xe4f0('0x34')]['ids'])['then'](function(){if(_[_0xe4f0('0x86')](_0x4023c0[_0xe4f0('0x34')][_0xe4f0('0x65')])){for(var _0x3b8d5c=0x0;_0x3b8d5c<_0x4023c0['query']['ids'][_0xe4f0('0x3a')];_0x3b8d5c+=0x1){socket[_0xe4f0('0x6b')](_0xe4f0('0x87'),{'UserId':Number(_0x4023c0[_0xe4f0('0x34')][_0xe4f0('0x65')][_0x3b8d5c]),'OpenchannelQueueId':Number(_0x4023c0[_0xe4f0('0x54')]['id'])});}}else{socket[_0xe4f0('0x6b')](_0xe4f0('0x87'),{'UserId':Number(_0x4023c0[_0xe4f0('0x34')][_0xe4f0('0x65')]),'OpenchannelQueueId':Number(_0x4023c0[_0xe4f0('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x4f81f7,null))['catch'](handleError(_0x4f81f7,null));};exports[_0xe4f0('0x88')]=function(_0x5b35e8,_0x507aa5,_0x4c620b){var _0x211387={};var _0x7a63fe={};var _0x43fc13;var _0xc4a73e;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x5b35e8[_0xe4f0('0x54')]['id']}})['then'](handleEntityNotFound(_0x507aa5,null))['then'](function(_0x5d9f88){if(_0x5d9f88){_0x43fc13=_0x5d9f88;_0x7a63fe['model']=_[_0xe4f0('0x35')](db['User'][_0xe4f0('0x2f')]);_0x7a63fe[_0xe4f0('0x34')]=_[_0xe4f0('0x35')](_0x5b35e8[_0xe4f0('0x34')]);_0x7a63fe[_0xe4f0('0x36')]=_[_0xe4f0('0x37')](_0x7a63fe[_0xe4f0('0x33')],_0x7a63fe[_0xe4f0('0x34')]);_0x211387[_0xe4f0('0x38')]=_['intersection'](_0x7a63fe['model'],qs[_0xe4f0('0x39')](_0x5b35e8[_0xe4f0('0x34')][_0xe4f0('0x39')]));_0x211387[_0xe4f0('0x38')]=_0x211387['attributes']['length']?_0x211387[_0xe4f0('0x38')]:_0x7a63fe[_0xe4f0('0x33')];_0x211387[_0xe4f0('0x3d')]=qs['sort'](_0x5b35e8[_0xe4f0('0x34')][_0xe4f0('0x3e')]);_0x211387[_0xe4f0('0x3f')]=qs[_0xe4f0('0x36')](_[_0xe4f0('0x40')](_0x5b35e8[_0xe4f0('0x34')],_0x7a63fe['filters']));if(_0x5b35e8['query'][_0xe4f0('0x41')]){_0x211387[_0xe4f0('0x3f')]=_[_0xe4f0('0x42')](_0x211387[_0xe4f0('0x3f')],{'$or':_['map'](_0x211387[_0xe4f0('0x38')],function(_0x3040a4){var _0x4cdd87={};_0x4cdd87[_0x3040a4]={'$like':'%'+_0x5b35e8[_0xe4f0('0x34')][_0xe4f0('0x41')]+'%'};return _0x4cdd87;})});}_0x211387=_['merge']({},_0x211387,_0x5b35e8[_0xe4f0('0x44')]);return _0x43fc13['getAgents'](_0x211387);}})['then'](function(_0x8a7a08){if(_0x8a7a08){_0xc4a73e=_0x8a7a08[_0xe4f0('0x3a')];if(!_0x5b35e8[_0xe4f0('0x34')][_0xe4f0('0x3b')]('nolimit')){_0x211387[_0xe4f0('0x1e')]=qs['limit'](_0x5b35e8[_0xe4f0('0x34')][_0xe4f0('0x1e')]);_0x211387[_0xe4f0('0x21')]=qs[_0xe4f0('0x21')](_0x5b35e8[_0xe4f0('0x34')][_0xe4f0('0x21')]);}return _0x43fc13[_0xe4f0('0x88')](_0x211387);}})[_0xe4f0('0x27')](function(_0x5045b7){if(_0x5045b7){return _0x5045b7?{'count':_0xc4a73e,'rows':_0x5045b7}:null;}})[_0xe4f0('0x27')](respondWithResult(_0x507aa5,null))[_0xe4f0('0x49')](handleError(_0x507aa5,null));}; \ No newline at end of file +var _0x136d=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','UserOpenchannelQueue','OpenchannelQueueId','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','ids','select','tq.TeamId','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','isArray','getAgents','eml-format','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','OpenchannelQueue','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','catch','create'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x136d,0xc3));var _0xd136=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x136d[_0x166d93];return _0xba708;};'use strict';var emlformat=require(_0xd136('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd136('0x1'));var rp=require('request-promise');var moment=require(_0xd136('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd136('0x3'));var path=require(_0xd136('0x4'));var sox=require(_0xd136('0x5'));var csv=require(_0xd136('0x6'));var ejs=require(_0xd136('0x7'));var fs=require('fs');var fs_extra=require(_0xd136('0x8'));var _=require('lodash');var squel=require(_0xd136('0x9'));var crypto=require('crypto');var jsforce=require(_0xd136('0xa'));var deskjs=require(_0xd136('0xb'));var toCsv=require(_0xd136('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd136('0xc'));var authService=require(_0xd136('0xd'));var qs=require(_0xd136('0xe'));var as=require(_0xd136('0xf'));var hardwareService=require(_0xd136('0x10'));var logger=require(_0xd136('0x11'))(_0xd136('0x12'));var utils=require(_0xd136('0x13'));var config=require(_0xd136('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd136('0x15'))['db'];config[_0xd136('0x16')]=_['defaults'](config['redis'],{'host':_0xd136('0x17'),'port':0x18eb});var socket=require(_0xd136('0x18'))(new Redis(config[_0xd136('0x16')]));require(_0xd136('0x19'))[_0xd136('0x1a')](socket);function respondWithStatusCode(_0x2a23a5,_0xc85ab8){_0xc85ab8=_0xc85ab8||0xcc;return function(_0x2aab1e){if(_0x2aab1e){return _0x2a23a5[_0xd136('0x1b')](_0xc85ab8);}return _0x2a23a5['status'](_0xc85ab8)[_0xd136('0x1c')]();};}function respondWithResult(_0x1c7e30,_0x340b80){_0x340b80=_0x340b80||0xc8;return function(_0x44767e){if(_0x44767e){return _0x1c7e30['status'](_0x340b80)[_0xd136('0x1d')](_0x44767e);}};}function respondWithFilteredResult(_0xb24620,_0x3992c8){return function(_0x2960b4){if(_0x2960b4){var _0x44b991=typeof _0x3992c8[_0xd136('0x1e')]===_0xd136('0x1f')&&typeof _0x3992c8[_0xd136('0x20')]===_0xd136('0x1f');var _0x377ada=_0x2960b4[_0xd136('0x21')];var _0xd91129=_0x44b991?0x0:_0x3992c8[_0xd136('0x1e')];var _0x159315=_0x44b991?_0x2960b4[_0xd136('0x21')]:_0x3992c8[_0xd136('0x1e')]+_0x3992c8[_0xd136('0x20')];var _0x592039;if(_0x159315>=_0x377ada){_0x159315=_0x377ada;_0x592039=0xc8;}else{_0x592039=0xce;}_0xb24620['status'](_0x592039);return _0xb24620[_0xd136('0x22')](_0xd136('0x23'),_0xd91129+'-'+_0x159315+'/'+_0x377ada)[_0xd136('0x1d')](_0x2960b4);}return null;};}function patchUpdates(_0xd1ac3e){return function(_0x129314){try{jsonpatch['apply'](_0x129314,_0xd1ac3e,!![]);}catch(_0x55ff0e){return BPromise[_0xd136('0x24')](_0x55ff0e);}return _0x129314[_0xd136('0x25')]();};}function saveUpdates(_0x31c092,_0x40ff03){return function(_0x207cde){if(_0x207cde){return _0x207cde[_0xd136('0x26')](_0x31c092)[_0xd136('0x27')](function(_0xc8906c){return _0xc8906c;});}return null;};}function removeEntity(_0x565ef8,_0xba0d7e){return function(_0x100ef0){if(_0x100ef0){return _0x100ef0[_0xd136('0x28')]()[_0xd136('0x27')](function(){var _0x21f1b3=_0x100ef0[_0xd136('0x29')]({'plain':!![]});var _0x4e95a3='OpenchannelQueues';return db[_0xd136('0x2a')][_0xd136('0x28')]({'where':{'type':_0x4e95a3,'resourceId':_0x21f1b3['id']}})[_0xd136('0x27')](function(){return _0x100ef0;});})[_0xd136('0x27')](function(){_0x565ef8['status'](0xcc)[_0xd136('0x1c')]();});}};}function handleEntityNotFound(_0x2d6903,_0x14dd3f){return function(_0x2ef8f5){if(!_0x2ef8f5){_0x2d6903[_0xd136('0x1b')](0x194);}return _0x2ef8f5;};}function handleError(_0x5d0f4d,_0xb61512){_0xb61512=_0xb61512||0x1f4;return function(_0x4f9fcb){logger[_0xd136('0x2b')](_0x4f9fcb[_0xd136('0x2c')]);if(_0x4f9fcb[_0xd136('0x2d')]){delete _0x4f9fcb[_0xd136('0x2d')];}_0x5d0f4d['status'](_0xb61512)[_0xd136('0x2e')](_0x4f9fcb);};}exports['index']=function(_0x551105,_0x5a16a6){var _0x1c6f05={},_0x320ccd={},_0x48361e={'count':0x0,'rows':[]};var _0x20c676=_['map'](db[_0xd136('0x2f')][_0xd136('0x30')],function(_0xb88258){return{'name':_0xb88258['fieldName'],'type':_0xb88258[_0xd136('0x31')]['key']};});_0x320ccd[_0xd136('0x32')]=_[_0xd136('0x33')](_0x20c676,'name');_0x320ccd[_0xd136('0x34')]=_[_0xd136('0x35')](_0x551105[_0xd136('0x34')]);_0x320ccd[_0xd136('0x36')]=_[_0xd136('0x37')](_0x320ccd[_0xd136('0x32')],_0x320ccd['query']);_0x1c6f05[_0xd136('0x38')]=_[_0xd136('0x37')](_0x320ccd['model'],qs['fields'](_0x551105['query'][_0xd136('0x39')]));_0x1c6f05['attributes']=_0x1c6f05[_0xd136('0x38')][_0xd136('0x3a')]?_0x1c6f05[_0xd136('0x38')]:_0x320ccd[_0xd136('0x32')];if(!_0x551105[_0xd136('0x34')][_0xd136('0x3b')](_0xd136('0x3c'))){_0x1c6f05[_0xd136('0x20')]=qs[_0xd136('0x20')](_0x551105[_0xd136('0x34')][_0xd136('0x20')]);_0x1c6f05[_0xd136('0x1e')]=qs[_0xd136('0x1e')](_0x551105['query'][_0xd136('0x1e')]);}_0x1c6f05[_0xd136('0x3d')]=qs[_0xd136('0x3e')](_0x551105[_0xd136('0x34')][_0xd136('0x3e')]);_0x1c6f05[_0xd136('0x3f')]=qs['filters'](_[_0xd136('0x40')](_0x551105[_0xd136('0x34')],_0x320ccd[_0xd136('0x36')]),_0x20c676);if(_0x551105[_0xd136('0x34')]['filter']){_0x1c6f05[_0xd136('0x3f')]=_[_0xd136('0x41')](_0x1c6f05[_0xd136('0x3f')],{'$or':_[_0xd136('0x33')](_0x20c676,function(_0x12a26e){if(_0x12a26e[_0xd136('0x31')]!==_0xd136('0x42')){var _0x55a04d={};_0x55a04d[_0x12a26e['name']]={'$like':'%'+_0x551105[_0xd136('0x34')][_0xd136('0x43')]+'%'};return _0x55a04d;}})});}_0x1c6f05=_[_0xd136('0x41')]({},_0x1c6f05,_0x551105[_0xd136('0x44')]);var _0x526d20={'where':_0x1c6f05[_0xd136('0x3f')]};return db['OpenchannelQueue'][_0xd136('0x21')](_0x526d20)['then'](function(_0x66751a){_0x48361e['count']=_0x66751a;if(_0x551105[_0xd136('0x34')][_0xd136('0x45')]){_0x1c6f05[_0xd136('0x46')]=[{'all':!![]}];}return db[_0xd136('0x2f')][_0xd136('0x47')](_0x1c6f05);})[_0xd136('0x27')](function(_0x22a644){_0x48361e[_0xd136('0x48')]=_0x22a644;return _0x48361e;})[_0xd136('0x27')](respondWithFilteredResult(_0x5a16a6,_0x1c6f05))['catch'](handleError(_0x5a16a6,null));};exports[_0xd136('0x49')]=function(_0x5542cc,_0x4d5a05){var _0x25e043={'raw':!![],'where':{'id':_0x5542cc[_0xd136('0x4a')]['id']}},_0x2ab8ee={};_0x2ab8ee[_0xd136('0x32')]=_[_0xd136('0x35')](db[_0xd136('0x2f')][_0xd136('0x30')]);_0x2ab8ee[_0xd136('0x34')]=_[_0xd136('0x35')](_0x5542cc[_0xd136('0x34')]);_0x2ab8ee[_0xd136('0x36')]=_[_0xd136('0x37')](_0x2ab8ee[_0xd136('0x32')],_0x2ab8ee[_0xd136('0x34')]);_0x25e043[_0xd136('0x38')]=_[_0xd136('0x37')](_0x2ab8ee['model'],qs[_0xd136('0x39')](_0x5542cc[_0xd136('0x34')][_0xd136('0x39')]));_0x25e043['attributes']=_0x25e043['attributes']['length']?_0x25e043[_0xd136('0x38')]:_0x2ab8ee[_0xd136('0x32')];if(_0x5542cc[_0xd136('0x34')][_0xd136('0x45')]){_0x25e043[_0xd136('0x46')]=[{'all':!![]}];}_0x25e043=_[_0xd136('0x41')]({},_0x25e043,_0x5542cc[_0xd136('0x44')]);return db[_0xd136('0x2f')]['find'](_0x25e043)['then'](handleEntityNotFound(_0x4d5a05,null))[_0xd136('0x27')](respondWithResult(_0x4d5a05,null))[_0xd136('0x4b')](handleError(_0x4d5a05,null));};exports[_0xd136('0x4c')]=function(_0x2142be,_0x33ffdf){return db[_0xd136('0x2f')][_0xd136('0x4c')](_0x2142be[_0xd136('0x4d')],{})[_0xd136('0x27')](function(_0x4ce743){var _0x144028=_0x2142be[_0xd136('0x4e')][_0xd136('0x29')]({'plain':!![]});if(!_0x144028)throw new Error(_0xd136('0x4f'));if(_0x144028[_0xd136('0x50')]==='user'){var _0x5d9b7e=_0x4ce743[_0xd136('0x29')]({'plain':!![]});var _0x26e4ea=_0xd136('0x51');return db[_0xd136('0x52')]['find']({'where':{'name':_0x26e4ea,'userProfileId':_0x144028[_0xd136('0x53')]},'raw':!![]})[_0xd136('0x27')](function(_0x2a828d){if(_0x2a828d&&_0x2a828d[_0xd136('0x54')]===0x0){return db[_0xd136('0x2a')][_0xd136('0x4c')]({'name':_0x5d9b7e[_0xd136('0x2d')],'resourceId':_0x5d9b7e['id'],'type':_0x2a828d[_0xd136('0x2d')],'sectionId':_0x2a828d['id']},{})[_0xd136('0x27')](function(){return _0x4ce743;});}else{return _0x4ce743;}})['catch'](function(_0xa08cda){logger[_0xd136('0x2b')](_0xd136('0x55'),_0xa08cda);throw _0xa08cda;});}return _0x4ce743;})[_0xd136('0x27')](respondWithResult(_0x33ffdf,0xc9))[_0xd136('0x4b')](handleError(_0x33ffdf,null));};exports[_0xd136('0x26')]=function(_0x2252ce,_0x3c73f8){if(_0x2252ce['body']['id']){delete _0x2252ce[_0xd136('0x4d')]['id'];}return db[_0xd136('0x2f')][_0xd136('0x56')]({'where':{'id':_0x2252ce[_0xd136('0x4a')]['id']}})[_0xd136('0x27')](handleEntityNotFound(_0x3c73f8,null))[_0xd136('0x27')](saveUpdates(_0x2252ce[_0xd136('0x4d')],null))[_0xd136('0x27')](respondWithResult(_0x3c73f8,null))[_0xd136('0x4b')](handleError(_0x3c73f8,null));};exports['destroy']=function(_0x3d58ea,_0x5ea9e8){return db[_0xd136('0x2f')]['find']({'where':{'id':_0x3d58ea['params']['id']}})['then'](handleEntityNotFound(_0x5ea9e8,null))['then'](removeEntity(_0x5ea9e8,null))[_0xd136('0x4b')](handleError(_0x5ea9e8,null));};exports['describe']=function(_0x3edfc1,_0x50fc59){return db['OpenchannelQueue'][_0xd136('0x57')]()[_0xd136('0x27')](respondWithResult(_0x50fc59,null))[_0xd136('0x4b')](handleError(_0x50fc59,null));};exports[_0xd136('0x58')]=function(_0x31d24c,_0x57c1a5,_0x3ce058){var _0x1a0633={'raw':!![],'where':{}},_0x592684={},_0x172dab;return db[_0xd136('0x2f')]['findOne']({'where':{'id':_0x31d24c[_0xd136('0x4a')]['id']}})[_0xd136('0x27')](handleEntityNotFound(_0x57c1a5,null))[_0xd136('0x27')](function(_0x185776){if(_0x185776){_0x172dab=_0x185776['get']({'plain':!![]});_0x592684['model']=_[_0xd136('0x35')](db[_0xd136('0x59')]['rawAttributes']);_0x592684[_0xd136('0x34')]=_[_0xd136('0x35')](_0x31d24c['query']);_0x592684[_0xd136('0x36')]=_[_0xd136('0x37')](_0x592684[_0xd136('0x32')],_0x592684[_0xd136('0x34')]);_0x1a0633[_0xd136('0x38')]=_[_0xd136('0x37')](_0x592684[_0xd136('0x32')],qs[_0xd136('0x39')](_0x31d24c[_0xd136('0x34')][_0xd136('0x39')]));_0x1a0633[_0xd136('0x38')]=_0x1a0633[_0xd136('0x38')]['length']?_0x1a0633[_0xd136('0x38')]:_0x592684[_0xd136('0x32')];if(!_0x31d24c[_0xd136('0x34')]['hasOwnProperty'](_0xd136('0x3c'))){_0x1a0633[_0xd136('0x20')]=qs[_0xd136('0x20')](_0x31d24c[_0xd136('0x34')][_0xd136('0x20')]);_0x1a0633[_0xd136('0x1e')]=qs[_0xd136('0x1e')](_0x31d24c[_0xd136('0x34')][_0xd136('0x1e')]);}_0x1a0633[_0xd136('0x3d')]=qs[_0xd136('0x3e')](_0x31d24c[_0xd136('0x34')][_0xd136('0x3e')]);_0x1a0633[_0xd136('0x3f')]=qs[_0xd136('0x36')](_['pick'](_0x31d24c[_0xd136('0x34')],_0x592684['filters']));_0x1a0633[_0xd136('0x3f')][_0xd136('0x5a')]=_0x185776['id'];if(_0x31d24c[_0xd136('0x34')]['filter']){_0x1a0633['where']=_[_0xd136('0x41')](_0x1a0633['where'],{'$or':_['map'](_0x1a0633[_0xd136('0x38')],function(_0x3763dd){var _0x2aca2a={};_0x2aca2a[_0x3763dd]={'$like':'%'+_0x31d24c[_0xd136('0x34')]['filter']+'%'};return _0x2aca2a;})});}_0x1a0633=_['merge']({},_0x1a0633,_0x31d24c[_0xd136('0x44')]);return db['UserOpenchannelQueue'][_0xd136('0x47')](_0x1a0633);}})[_0xd136('0x27')](function(_0x4300f5){if(_0x4300f5){return db[_0xd136('0x5b')]['findAndCountAll']({'where':{'id':_['map'](_0x4300f5,_0xd136('0x5c')),'role':_0xd136('0x5d')},'attributes':['id',_0xd136('0x2d'),_0xd136('0x5e'),_0xd136('0x5f'),_0xd136('0x60')]});}})[_0xd136('0x27')](function(_0x4ad64e){if(_0x4ad64e){return{'count':_0x4ad64e[_0xd136('0x21')],'rows':_[_0xd136('0x33')](_0x4ad64e['rows'],function(_0x37b677){return{'membername':_0x37b677[_0xd136('0x2d')],'UserId':_0x37b677['id'],'queue_name':_0x172dab[_0xd136('0x2d')],'OpenchannelQueueId':_0x172dab['id'],'interface':util[_0xd136('0x61')](_0xd136('0x62'),_0xd136('0x63'),_0x37b677['name']),'penalty':0x0,'paused':_0x37b677[_0xd136('0x5e')],'createdAt':_0x37b677[_0xd136('0x60')],'updatedAt':_0x37b677[_0xd136('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd136('0x27')](respondWithFilteredResult(_0x57c1a5,_0x1a0633))[_0xd136('0x4b')](handleError(_0x57c1a5,null));};exports['getTeams']=function(_0x16f298,_0x535a52,_0x2e6398){var _0x3b4d43={};var _0xc02455={};var _0x17662f;var _0x5d41f3;return db[_0xd136('0x2f')]['findOne']({'where':{'id':_0x16f298[_0xd136('0x4a')]['id']}})[_0xd136('0x27')](handleEntityNotFound(_0x535a52,null))[_0xd136('0x27')](function(_0x217682){if(_0x217682){_0x17662f=_0x217682;_0xc02455[_0xd136('0x32')]=_[_0xd136('0x35')](db['Team'][_0xd136('0x30')]);_0xc02455['query']=_[_0xd136('0x35')](_0x16f298[_0xd136('0x34')]);_0xc02455[_0xd136('0x36')]=_[_0xd136('0x37')](_0xc02455['model'],_0xc02455[_0xd136('0x34')]);_0x3b4d43[_0xd136('0x38')]=_[_0xd136('0x37')](_0xc02455[_0xd136('0x32')],qs['fields'](_0x16f298[_0xd136('0x34')][_0xd136('0x39')]));_0x3b4d43[_0xd136('0x38')]=_0x3b4d43['attributes'][_0xd136('0x3a')]?_0x3b4d43[_0xd136('0x38')]:_0xc02455[_0xd136('0x32')];_0x3b4d43[_0xd136('0x3d')]=qs[_0xd136('0x3e')](_0x16f298['query'][_0xd136('0x3e')]);_0x3b4d43[_0xd136('0x3f')]=qs[_0xd136('0x36')](_[_0xd136('0x40')](_0x16f298[_0xd136('0x34')],_0xc02455[_0xd136('0x36')]));if(_0x16f298[_0xd136('0x34')][_0xd136('0x43')]){_0x3b4d43[_0xd136('0x3f')]=_[_0xd136('0x41')](_0x3b4d43[_0xd136('0x3f')],{'$or':_['map'](_0x3b4d43[_0xd136('0x38')],function(_0x30a848){var _0x4dda21={};_0x4dda21[_0x30a848]={'$like':'%'+_0x16f298[_0xd136('0x34')][_0xd136('0x43')]+'%'};return _0x4dda21;})});}_0x3b4d43=_['merge']({},_0x3b4d43,_0x16f298[_0xd136('0x44')]);return _0x17662f[_0xd136('0x64')](_0x3b4d43);}})[_0xd136('0x27')](function(_0xb8a6ee){if(_0xb8a6ee){_0x5d41f3=_0xb8a6ee[_0xd136('0x3a')];if(!_0x16f298[_0xd136('0x34')][_0xd136('0x3b')]('nolimit')){_0x3b4d43['limit']=qs[_0xd136('0x20')](_0x16f298[_0xd136('0x34')][_0xd136('0x20')]);_0x3b4d43[_0xd136('0x1e')]=qs[_0xd136('0x1e')](_0x16f298[_0xd136('0x34')][_0xd136('0x1e')]);}return _0x17662f[_0xd136('0x64')](_0x3b4d43);}})[_0xd136('0x27')](function(_0x4889e0){if(_0x4889e0){return _0x4889e0?{'count':_0x5d41f3,'rows':_0x4889e0}:null;}})[_0xd136('0x27')](respondWithResult(_0x535a52,null))[_0xd136('0x4b')](handleError(_0x535a52,null));};exports[_0xd136('0x65')]=function(_0x2b0e7d,_0x21f4cc,_0x23ad51){var _0x3f7211=_0x2b0e7d[_0xd136('0x4d')]['ids'];return db['Team'][_0xd136('0x47')]({'where':{'id':_0x3f7211},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd136('0x66'),'attributes':['id','name','online',_0xd136('0x67'),_0xd136('0x68')],'raw':!![]}]})[_0xd136('0x27')](function(_0xfca8e){if(_0xfca8e){var _0xfc985c=_[_0xd136('0x69')](_0xfca8e,function(_0x8de6ea){var _0x11016c=_0x8de6ea[_0xd136('0x29')]({'plain':!![]});return _0x11016c['Agents'];});return db['OpenchannelQueue'][_0xd136('0x56')]({'where':{'id':_0x2b0e7d[_0xd136('0x4a')]['id']}})['then'](function(_0x51eada){return db[_0xd136('0x6a')][_0xd136('0x6b')](function(_0x379253){return _0x51eada[_0xd136('0x65')](_0x3f7211,{'transaction':_0x379253})[_0xd136('0x27')](function(){return BPromise[_0xd136('0x6c')](_0xfc985c,function(_0x3e1eea){return db[_0xd136('0x59')][_0xd136('0x6d')]({'where':{'UserId':_0x3e1eea['id'],'OpenchannelQueueId':_0x2b0e7d[_0xd136('0x4a')]['id']},'transaction':_0x379253});});})[_0xd136('0x27')](function(){_0xfc985c['forEach'](function(_0x13d147){socket[_0xd136('0x6e')](_0xd136('0x6f'),{'UserId':_0x13d147['id'],'OpenchannelQueueId':_0x51eada['id']});});});});});}})[_0xd136('0x27')](respondWithStatusCode(_0x21f4cc,null))[_0xd136('0x4b')](handleError(_0x21f4cc,null));};exports[_0xd136('0x70')]=function(_0x1afc94,_0xd7b13e,_0x13598f){return db['Team']['findAll']({'where':{'id':_0x1afc94[_0xd136('0x34')][_0xd136('0x71')]},'attributes':['id'],'include':[{'model':db[_0xd136('0x5b')],'as':_0xd136('0x66'),'attributes':['id'],'raw':!![]}]})[_0xd136('0x27')](handleEntityNotFound(_0xd7b13e,null))[_0xd136('0x27')](function(_0x3c979f){var _0x4f7d05=_[_0xd136('0x33')](_0x3c979f,'id');var _0x58bbb9=[];var _0x4e73e5=[];var _0x547e1d=squel[_0xd136('0x72')]();_0x547e1d['field'](_0xd136('0x73'))['from'](_0xd136('0x74'),'tq')['join'](_0xd136('0x75'),'ut',_0xd136('0x76'))[_0xd136('0x3f')](_0xd136('0x77'),_0x1afc94[_0xd136('0x4a')]['id']);for(var _0x5226d1=0x0;_0x5226d1<_0x3c979f[_0xd136('0x3a')];_0x5226d1+=0x1){let _0x331cca=_0x3c979f[_0x5226d1];for(var _0x33a571=0x0;_0x33a571<_0x331cca['Agents'][_0xd136('0x3a')];_0x33a571+=0x1){let _0x1290bd=_0x331cca[_0xd136('0x66')][_0x33a571];var _0x2e634d=_0x547e1d[_0xd136('0x78')]();_0x2e634d[_0xd136('0x3f')](_0xd136('0x79'),_0x1290bd['id']);_0x4e73e5[_0xd136('0x7a')](db['sequelize']['query'](_0x2e634d['toString'](),{'type':db[_0xd136('0x6a')][_0xd136('0x7b')]['SELECT']})[_0xd136('0x27')](function(_0x194af4){if(_0x194af4[_0xd136('0x3a')]===0x1){return _0x1290bd['id'];}else{var _0x310954=_[_0xd136('0x7c')](_[_0xd136('0x33')](_0x194af4,_0xd136('0x7d')),function(_0x57ce09){return _[_0xd136('0x7e')](_0x4f7d05,_0x57ce09);});if(_0x310954){return _0x1290bd['id'];}}}));}}return BPromise[_0xd136('0x7f')](_0x4e73e5)[_0xd136('0x27')](function(_0x44fe69){_0x58bbb9=_(_0x58bbb9)['union'](_0x44fe69)[_0xd136('0x80')]()[_0xd136('0x81')]();return db['OpenchannelQueue'][_0xd136('0x56')]({'where':{'id':_0x1afc94[_0xd136('0x4a')]['id']}})[_0xd136('0x27')](function(_0x46a61a){return db[_0xd136('0x6a')][_0xd136('0x6b')](function(_0x4f8c51){return _0x46a61a[_0xd136('0x70')](_0x1afc94[_0xd136('0x34')][_0xd136('0x71')],{'transaction':_0x4f8c51})['then'](function(){if(!_[_0xd136('0x82')](_0x58bbb9)){return _0x46a61a[_0xd136('0x83')](_0x58bbb9,{'transaction':_0x4f8c51});}})[_0xd136('0x27')](function(){_0x58bbb9['forEach'](function(_0x1e550f){socket[_0xd136('0x6e')](_0xd136('0x84'),{'UserId':_0x1e550f,'OpenchannelQueueId':_0x46a61a['id']});});});});});});})[_0xd136('0x27')](respondWithStatusCode(_0xd7b13e,null))['catch'](handleError(_0xd7b13e,null));};exports[_0xd136('0x85')]=function(_0x4fa845,_0x1315f9,_0x15570c){return db[_0xd136('0x2f')][_0xd136('0x56')]({'where':{'id':_0x4fa845[_0xd136('0x4a')]['id']}})[_0xd136('0x27')](handleEntityNotFound(_0x1315f9,null))[_0xd136('0x27')](function(_0xbaffd4){if(_0xbaffd4){return _0xbaffd4['addAgents'](_0x4fa845[_0xd136('0x4d')][_0xd136('0x71')],_['omit'](_0x4fa845[_0xd136('0x4d')],['ids','id'])||{})['spread'](function(_0x50d7dd){for(var _0xf3902c=0x0;_0xf3902c<_0x4fa845[_0xd136('0x4d')][_0xd136('0x71')]['length'];_0xf3902c+=0x1){socket['emit'](_0xd136('0x6f'),{'UserId':Number(_0x4fa845[_0xd136('0x4d')]['ids'][_0xf3902c]),'OpenchannelQueueId':Number(_0x4fa845['params']['id'])});}return _0x50d7dd;});}})['then'](respondWithResult(_0x1315f9,null))[_0xd136('0x4b')](handleError(_0x1315f9,null));};exports[_0xd136('0x83')]=function(_0xfe95a2,_0x5d26c5,_0x1cb474){return db['OpenchannelQueue'][_0xd136('0x56')]({'where':{'id':_0xfe95a2['params']['id']}})[_0xd136('0x27')](handleEntityNotFound(_0x5d26c5,null))[_0xd136('0x27')](function(_0x366d42){if(_0x366d42){return _0x366d42['removeAgents'](_0xfe95a2[_0xd136('0x34')][_0xd136('0x71')])[_0xd136('0x27')](function(){if(_[_0xd136('0x86')](_0xfe95a2[_0xd136('0x34')][_0xd136('0x71')])){for(var _0x332c75=0x0;_0x332c75<_0xfe95a2['query'][_0xd136('0x71')][_0xd136('0x3a')];_0x332c75+=0x1){socket['emit'](_0xd136('0x84'),{'UserId':Number(_0xfe95a2['query'][_0xd136('0x71')][_0x332c75]),'OpenchannelQueueId':Number(_0xfe95a2[_0xd136('0x4a')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0xfe95a2['query']['ids']),'OpenchannelQueueId':Number(_0xfe95a2[_0xd136('0x4a')]['id'])});}});}})[_0xd136('0x27')](respondWithStatusCode(_0x5d26c5,null))['catch'](handleError(_0x5d26c5,null));};exports[_0xd136('0x87')]=function(_0x1c6565,_0x5d2ffb,_0x14a5b3){var _0x2fe260={};var _0x31cbe2={};var _0x4454a5;var _0x573332;return db[_0xd136('0x2f')]['findOne']({'where':{'id':_0x1c6565[_0xd136('0x4a')]['id']}})[_0xd136('0x27')](handleEntityNotFound(_0x5d2ffb,null))[_0xd136('0x27')](function(_0x343acf){if(_0x343acf){_0x4454a5=_0x343acf;_0x31cbe2[_0xd136('0x32')]=_[_0xd136('0x35')](db[_0xd136('0x5b')][_0xd136('0x30')]);_0x31cbe2[_0xd136('0x34')]=_[_0xd136('0x35')](_0x1c6565[_0xd136('0x34')]);_0x31cbe2[_0xd136('0x36')]=_['intersection'](_0x31cbe2['model'],_0x31cbe2[_0xd136('0x34')]);_0x2fe260['attributes']=_[_0xd136('0x37')](_0x31cbe2[_0xd136('0x32')],qs[_0xd136('0x39')](_0x1c6565['query'][_0xd136('0x39')]));_0x2fe260[_0xd136('0x38')]=_0x2fe260[_0xd136('0x38')][_0xd136('0x3a')]?_0x2fe260[_0xd136('0x38')]:_0x31cbe2[_0xd136('0x32')];_0x2fe260[_0xd136('0x3d')]=qs['sort'](_0x1c6565[_0xd136('0x34')][_0xd136('0x3e')]);_0x2fe260[_0xd136('0x3f')]=qs[_0xd136('0x36')](_[_0xd136('0x40')](_0x1c6565[_0xd136('0x34')],_0x31cbe2[_0xd136('0x36')]));if(_0x1c6565['query']['filter']){_0x2fe260[_0xd136('0x3f')]=_[_0xd136('0x41')](_0x2fe260[_0xd136('0x3f')],{'$or':_[_0xd136('0x33')](_0x2fe260[_0xd136('0x38')],function(_0xdea290){var _0x44a1d3={};_0x44a1d3[_0xdea290]={'$like':'%'+_0x1c6565[_0xd136('0x34')][_0xd136('0x43')]+'%'};return _0x44a1d3;})});}_0x2fe260=_[_0xd136('0x41')]({},_0x2fe260,_0x1c6565[_0xd136('0x44')]);return _0x4454a5['getAgents'](_0x2fe260);}})['then'](function(_0x2984f3){if(_0x2984f3){_0x573332=_0x2984f3[_0xd136('0x3a')];if(!_0x1c6565[_0xd136('0x34')][_0xd136('0x3b')](_0xd136('0x3c'))){_0x2fe260[_0xd136('0x20')]=qs[_0xd136('0x20')](_0x1c6565[_0xd136('0x34')][_0xd136('0x20')]);_0x2fe260[_0xd136('0x1e')]=qs['offset'](_0x1c6565[_0xd136('0x34')][_0xd136('0x1e')]);}return _0x4454a5[_0xd136('0x87')](_0x2fe260);}})[_0xd136('0x27')](function(_0x4f7b7f){if(_0x4f7b7f){return _0x4f7b7f?{'count':_0x573332,'rows':_0x4f7b7f}:null;}})['then'](respondWithResult(_0x5d2ffb,null))[_0xd136('0x4b')](handleError(_0x5d2ffb,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index e2d260c..f2f35fc 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 _0x8c7b=['events','../../mysqldb','OpenchannelQueue','save','update','remove','emit','hook','exports'];(function(_0x3438cf,_0x73b174){var _0x278698=function(_0xbba932){while(--_0xbba932){_0x3438cf['push'](_0x3438cf['shift']());}};_0x278698(++_0x73b174);}(_0x8c7b,0x99));var _0xb8c7=function(_0x36ca62,_0x443499){_0x36ca62=_0x36ca62-0x0;var _0x306ae0=_0x8c7b[_0x36ca62];return _0x306ae0;};'use strict';var EventEmitter=require(_0xb8c7('0x0'));var OpenchannelQueue=require(_0xb8c7('0x1'))['db'][_0xb8c7('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb8c7('0x3'),'afterUpdate':_0xb8c7('0x4'),'afterDestroy':_0xb8c7('0x5')};function emitEvent(_0x2b0e9c){return function(_0x435d79,_0x283c71,_0x65f445){OpenchannelQueueEvents['emit'](_0x2b0e9c+':'+_0x435d79['id'],_0x435d79);OpenchannelQueueEvents[_0xb8c7('0x6')](_0x2b0e9c,_0x435d79);_0x65f445(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xb8c7('0x7')](e,emitEvent(event));}}module[_0xb8c7('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x621f=['save','update','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelQueue','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x621f,0xed));var _0xf621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x621f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xf621('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xf621('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xf621('0x2')](0x0);var events={'afterCreate':_0xf621('0x3'),'afterUpdate':_0xf621('0x4'),'afterDestroy':_0xf621('0x5')};function emitEvent(_0x48ec83){return function(_0x4cc792,_0x48a1e1,_0x371494){OpenchannelQueueEvents[_0xf621('0x6')](_0x48ec83+':'+_0x4cc792['id'],_0x4cc792);OpenchannelQueueEvents[_0xf621('0x6')](_0x48ec83,_0x4cc792);_0x371494(null);};}for(var e in events){if(events[_0xf621('0x7')](e)){var event=events[e];OpenchannelQueue[_0xf621('0x8')](e,emitEvent(event));}}module[_0xf621('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 2789a9a..843e205 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 _0xed59=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','moment'];(function(_0x3ac312,_0x5d3903){var _0x36b673=function(_0x254b25){while(--_0x254b25){_0x3ac312['push'](_0x3ac312['shift']());}};_0x36b673(++_0x5d3903);}(_0xed59,0xcd));var _0x9ed5=function(_0x3b25b0,_0x5e6737){_0x3b25b0=_0x3b25b0-0x0;var _0x3f34b1=_0xed59[_0x3b25b0];return _0x3f34b1;};'use strict';var _=require(_0x9ed5('0x0'));var util=require(_0x9ed5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9ed5('0x2'));var BPromise=require(_0x9ed5('0x3'));var rp=require(_0x9ed5('0x4'));var fs=require('fs');var path=require(_0x9ed5('0x5'));var rimraf=require(_0x9ed5('0x6'));var config=require(_0x9ed5('0x7'));var attributes=require(_0x9ed5('0x8'));module[_0x9ed5('0x9')]=function(_0x3dfc21,_0x1b857e){return _0x3dfc21[_0x9ed5('0xa')](_0x9ed5('0xb'),attributes,{'tableName':_0x9ed5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1db2=['path','rimraf','../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','../../config/logger','moment','bluebird','request-promise'];(function(_0x5a7cd0,_0x24a81d){var _0x4ab236=function(_0x29c69e){while(--_0x29c69e){_0x5a7cd0['push'](_0x5a7cd0['shift']());}};_0x4ab236(++_0x24a81d);}(_0x1db2,0x6a));var _0x21db=function(_0x35ec08,_0x2461c7){_0x35ec08=_0x35ec08-0x0;var _0x51310d=_0x1db2[_0x35ec08];return _0x51310d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x21db('0x0'))('api');var moment=require(_0x21db('0x1'));var BPromise=require(_0x21db('0x2'));var rp=require(_0x21db('0x3'));var fs=require('fs');var path=require(_0x21db('0x4'));var rimraf=require(_0x21db('0x5'));var config=require(_0x21db('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0x21db('0x7')]=function(_0x326582,_0x4375ed){return _0x326582[_0x21db('0x8')](_0x21db('0x9'),attributes,{'tableName':_0x21db('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 7b31e14..42f2be3 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 _0x7bfc=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','options','where','attributes','limit','map','include','model','GetOpenchannelQueue','debug','OpenchannelQueue','find','raw','ShowOpenchannelQueue','lodash'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x7bfc,0xe3));var _0xc7bf=function(_0x364e1d,_0xf1faa0){_0x364e1d=_0x364e1d-0x0;var _0x3ad644=_0x7bfc[_0x364e1d];return _0x3ad644;};'use strict';var _=require(_0xc7bf('0x0'));var util=require('util');var moment=require(_0xc7bf('0x1'));var BPromise=require(_0xc7bf('0x2'));var rs=require(_0xc7bf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7bf('0x4'))['db'];var utils=require(_0xc7bf('0x5'));var logger=require(_0xc7bf('0x6'))(_0xc7bf('0x7'));var config=require(_0xc7bf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc7bf('0x9')][_0xc7bf('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc7bf('0xb')],{'host':_0xc7bf('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc7bf('0xb')]));require(_0xc7bf('0xd'))['register'](socket);function respondWithRpcPromise(_0x51e572,_0x193361,_0x39aca2){return new BPromise(function(_0x4e03c7,_0x328c35){return client[_0xc7bf('0xe')](_0x51e572,_0x39aca2)[_0xc7bf('0xf')](function(_0x445f72){logger[_0xc7bf('0x10')](_0xc7bf('0x11'),_0x193361,_0xc7bf('0x12'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x193361,_0xc7bf('0x12'),JSON[_0xc7bf('0x13')](_0x445f72));if(_0x445f72[_0xc7bf('0x14')]){if(_0x445f72[_0xc7bf('0x14')][_0xc7bf('0x15')]===0x1f4){logger['error'](_0xc7bf('0x11'),_0x193361,_0x445f72[_0xc7bf('0x14')][_0xc7bf('0x16')]);return _0x328c35(_0x445f72[_0xc7bf('0x14')][_0xc7bf('0x16')]);}logger[_0xc7bf('0x14')](_0xc7bf('0x11'),_0x193361,_0x445f72[_0xc7bf('0x14')][_0xc7bf('0x16')]);return _0x4e03c7(_0x445f72[_0xc7bf('0x14')][_0xc7bf('0x16')]);}else{logger[_0xc7bf('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x193361,_0xc7bf('0x12'));_0x4e03c7(_0x445f72[_0xc7bf('0x17')][_0xc7bf('0x16')]);}})[_0xc7bf('0x18')](function(_0x23346d){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x193361,_0x23346d);_0x328c35(_0x23346d);});});}exports['GetOpenchannelQueue']=function(_0x5cd191){var _0x4040ed=this;return new Promise(function(_0x127dfa,_0x5038aa){return db['OpenchannelQueue']['findAll']({'raw':_0x5cd191[_0xc7bf('0x19')]?_0x5cd191[_0xc7bf('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5cd191['options']?_0x5cd191['options'][_0xc7bf('0x1a')]||null:null,'attributes':_0x5cd191[_0xc7bf('0x19')]?_0x5cd191[_0xc7bf('0x19')][_0xc7bf('0x1b')]||null:null,'limit':_0x5cd191[_0xc7bf('0x19')]?_0x5cd191[_0xc7bf('0x19')][_0xc7bf('0x1c')]||null:null,'include':_0x5cd191[_0xc7bf('0x19')]?_0x5cd191[_0xc7bf('0x19')]['include']?_[_0xc7bf('0x1d')](_0x5cd191[_0xc7bf('0x19')]['include'],function(_0x4ba680){return{'model':db[_0x4ba680['model']],'as':_0x4ba680['as'],'attributes':_0x4ba680['attributes'],'include':_0x4ba680[_0xc7bf('0x1e')]?_[_0xc7bf('0x1d')](_0x4ba680[_0xc7bf('0x1e')],function(_0x34e7da){return{'model':db[_0x34e7da['model']],'as':_0x34e7da['as'],'attributes':_0x34e7da[_0xc7bf('0x1b')],'include':_0x34e7da[_0xc7bf('0x1e')]?_[_0xc7bf('0x1d')](_0x34e7da[_0xc7bf('0x1e')],function(_0x5eca95){return{'model':db[_0x5eca95[_0xc7bf('0x1f')]],'as':_0x5eca95['as'],'attributes':_0x5eca95[_0xc7bf('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a2934){logger[_0xc7bf('0x10')](_0xc7bf('0x20'),_0x5cd191);logger[_0xc7bf('0x21')](_0xc7bf('0x20'),_0x5cd191,JSON['stringify'](_0x1a2934));_0x127dfa(_0x1a2934);})['catch'](function(_0x29834c){logger[_0xc7bf('0x14')](_0xc7bf('0x20'),_0x29834c['message'],_0x5cd191);_0x5038aa(_0x4040ed[_0xc7bf('0x14')](0x1f4,_0x29834c[_0xc7bf('0x16')]));});});};exports['ShowOpenchannelQueue']=function(_0x170cb4){var _0x2310b2=this;return new Promise(function(_0x1c40dd,_0x3951e8){return db[_0xc7bf('0x22')][_0xc7bf('0x23')]({'raw':_0x170cb4[_0xc7bf('0x19')]?_0x170cb4[_0xc7bf('0x19')][_0xc7bf('0x24')]===undefined?!![]:![]:!![],'where':_0x170cb4[_0xc7bf('0x19')]?_0x170cb4['options'][_0xc7bf('0x1a')]||null:null,'attributes':_0x170cb4['options']?_0x170cb4[_0xc7bf('0x19')][_0xc7bf('0x1b')]||null:null,'include':_0x170cb4['options']?_0x170cb4[_0xc7bf('0x19')][_0xc7bf('0x1e')]?_['map'](_0x170cb4['options'][_0xc7bf('0x1e')],function(_0xf9872){return{'model':db[_0xf9872['model']],'as':_0xf9872['as'],'attributes':_0xf9872['attributes'],'include':_0xf9872[_0xc7bf('0x1e')]?_[_0xc7bf('0x1d')](_0xf9872['include'],function(_0x3ac17f){return{'model':db[_0x3ac17f[_0xc7bf('0x1f')]],'as':_0x3ac17f['as'],'attributes':_0x3ac17f[_0xc7bf('0x1b')],'include':_0x3ac17f['include']?_['map'](_0x3ac17f[_0xc7bf('0x1e')],function(_0x1f4a78){return{'model':db[_0x1f4a78[_0xc7bf('0x1f')]],'as':_0x1f4a78['as'],'attributes':_0x1f4a78[_0xc7bf('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x556b1d){logger[_0xc7bf('0x10')]('ShowOpenchannelQueue',_0x170cb4);logger[_0xc7bf('0x21')](_0xc7bf('0x25'),_0x170cb4,JSON[_0xc7bf('0x13')](_0x556b1d));_0x1c40dd(_0x556b1d);})['catch'](function(_0x211afb){logger[_0xc7bf('0x14')](_0xc7bf('0x25'),_0x211afb[_0xc7bf('0x16')],_0x170cb4);_0x3951e8(_0x2310b2[_0xc7bf('0x14')](0x1f4,_0x211afb[_0xc7bf('0x16')]));});});}; \ No newline at end of file +var _0xed29=['findAll','options','where','limit','include','attributes','map','debug','stringify','ShowOpenchannelQueue','find','raw','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','redis','localhost','register','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue'];(function(_0x1251a7,_0x3a990e){var _0x1ea38c=function(_0x59235d){while(--_0x59235d){_0x1251a7['push'](_0x1251a7['shift']());}};_0x1ea38c(++_0x3a990e);}(_0xed29,0xc1));var _0x9ed2=function(_0x257a0,_0x42d2b4){_0x257a0=_0x257a0-0x0;var _0x8a44ed=_0xed29[_0x257a0];return _0x8a44ed;};'use strict';var _=require(_0x9ed2('0x0'));var util=require('util');var moment=require(_0x9ed2('0x1'));var BPromise=require(_0x9ed2('0x2'));var rs=require(_0x9ed2('0x3'));var fs=require('fs');var Redis=require(_0x9ed2('0x4'));var db=require(_0x9ed2('0x5'))['db'];var utils=require(_0x9ed2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9ed2('0x7')][_0x9ed2('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9ed2('0x9')],{'host':_0x9ed2('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x9ed2('0xb')](socket);function respondWithRpcPromise(_0xb3ba4f,_0x4ad5a3,_0x53a304){return new BPromise(function(_0x3198ad,_0x3ba29a){return client['request'](_0xb3ba4f,_0x53a304)[_0x9ed2('0xc')](function(_0x4ecc81){logger['info'](_0x9ed2('0xd'),_0x4ad5a3,_0x9ed2('0xe'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4ad5a3,_0x9ed2('0xe'),JSON['stringify'](_0x4ecc81));if(_0x4ecc81[_0x9ed2('0xf')]){if(_0x4ecc81[_0x9ed2('0xf')][_0x9ed2('0x10')]===0x1f4){logger[_0x9ed2('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x4ad5a3,_0x4ecc81['error'][_0x9ed2('0x11')]);return _0x3ba29a(_0x4ecc81[_0x9ed2('0xf')]['message']);}logger['error'](_0x9ed2('0xd'),_0x4ad5a3,_0x4ecc81[_0x9ed2('0xf')][_0x9ed2('0x11')]);return _0x3198ad(_0x4ecc81['error'][_0x9ed2('0x11')]);}else{logger[_0x9ed2('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x4ad5a3,_0x9ed2('0xe'));_0x3198ad(_0x4ecc81[_0x9ed2('0x13')]['message']);}})[_0x9ed2('0x14')](function(_0x1b7d9f){logger['error'](_0x9ed2('0xd'),_0x4ad5a3,_0x1b7d9f);_0x3ba29a(_0x1b7d9f);});});}exports[_0x9ed2('0x15')]=function(_0x3aa45c){var _0x10fc68=this;return new Promise(function(_0x3a842a,_0xc7582d){return db[_0x9ed2('0x16')][_0x9ed2('0x17')]({'raw':_0x3aa45c[_0x9ed2('0x18')]?_0x3aa45c[_0x9ed2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3aa45c[_0x9ed2('0x18')]?_0x3aa45c[_0x9ed2('0x18')][_0x9ed2('0x19')]||null:null,'attributes':_0x3aa45c[_0x9ed2('0x18')]?_0x3aa45c[_0x9ed2('0x18')]['attributes']||null:null,'limit':_0x3aa45c['options']?_0x3aa45c[_0x9ed2('0x18')][_0x9ed2('0x1a')]||null:null,'include':_0x3aa45c[_0x9ed2('0x18')]?_0x3aa45c['options'][_0x9ed2('0x1b')]?_['map'](_0x3aa45c[_0x9ed2('0x18')][_0x9ed2('0x1b')],function(_0x5b0a3b){return{'model':db[_0x5b0a3b['model']],'as':_0x5b0a3b['as'],'attributes':_0x5b0a3b[_0x9ed2('0x1c')],'include':_0x5b0a3b[_0x9ed2('0x1b')]?_['map'](_0x5b0a3b[_0x9ed2('0x1b')],function(_0x42fb4c){return{'model':db[_0x42fb4c['model']],'as':_0x42fb4c['as'],'attributes':_0x42fb4c[_0x9ed2('0x1c')],'include':_0x42fb4c[_0x9ed2('0x1b')]?_[_0x9ed2('0x1d')](_0x42fb4c['include'],function(_0x1205ff){return{'model':db[_0x1205ff['model']],'as':_0x1205ff['as'],'attributes':_0x1205ff[_0x9ed2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9ed2('0xc')](function(_0x85aadd){logger[_0x9ed2('0x12')](_0x9ed2('0x15'),_0x3aa45c);logger[_0x9ed2('0x1e')](_0x9ed2('0x15'),_0x3aa45c,JSON[_0x9ed2('0x1f')](_0x85aadd));_0x3a842a(_0x85aadd);})[_0x9ed2('0x14')](function(_0xef00f4){logger[_0x9ed2('0xf')](_0x9ed2('0x15'),_0xef00f4[_0x9ed2('0x11')],_0x3aa45c);_0xc7582d(_0x10fc68[_0x9ed2('0xf')](0x1f4,_0xef00f4[_0x9ed2('0x11')]));});});};exports[_0x9ed2('0x20')]=function(_0x48569f){var _0x13a5e2=this;return new Promise(function(_0x44b637,_0x3a3061){return db['OpenchannelQueue'][_0x9ed2('0x21')]({'raw':_0x48569f[_0x9ed2('0x18')]?_0x48569f[_0x9ed2('0x18')][_0x9ed2('0x22')]===undefined?!![]:![]:!![],'where':_0x48569f[_0x9ed2('0x18')]?_0x48569f[_0x9ed2('0x18')][_0x9ed2('0x19')]||null:null,'attributes':_0x48569f['options']?_0x48569f[_0x9ed2('0x18')][_0x9ed2('0x1c')]||null:null,'include':_0x48569f[_0x9ed2('0x18')]?_0x48569f[_0x9ed2('0x18')][_0x9ed2('0x1b')]?_[_0x9ed2('0x1d')](_0x48569f['options']['include'],function(_0x59ba62){return{'model':db[_0x59ba62[_0x9ed2('0x23')]],'as':_0x59ba62['as'],'attributes':_0x59ba62['attributes'],'include':_0x59ba62[_0x9ed2('0x1b')]?_[_0x9ed2('0x1d')](_0x59ba62[_0x9ed2('0x1b')],function(_0x3db250){return{'model':db[_0x3db250[_0x9ed2('0x23')]],'as':_0x3db250['as'],'attributes':_0x3db250[_0x9ed2('0x1c')],'include':_0x3db250['include']?_[_0x9ed2('0x1d')](_0x3db250[_0x9ed2('0x1b')],function(_0x1e9043){return{'model':db[_0x1e9043[_0x9ed2('0x23')]],'as':_0x1e9043['as'],'attributes':_0x1e9043[_0x9ed2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a0bc6){logger[_0x9ed2('0x12')]('ShowOpenchannelQueue',_0x48569f);logger[_0x9ed2('0x1e')]('ShowOpenchannelQueue',_0x48569f,JSON[_0x9ed2('0x1f')](_0x4a0bc6));_0x44b637(_0x4a0bc6);})[_0x9ed2('0x14')](function(_0x20e4d4){logger[_0x9ed2('0xf')](_0x9ed2('0x20'),_0x20e4d4['message'],_0x48569f);_0x3a3061(_0x13a5e2[_0x9ed2('0xf')](0x1f4,_0x20e4d4[_0x9ed2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 6913474..a669284 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 _0xf3cb=['length','openchannelQueue:','save','remove','update','emit','removeListener','register'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf3cb,0x1a2));var _0xbf3c=function(_0x257dd1,_0x35ce94){_0x257dd1=_0x257dd1-0x0;var _0x41130d=_0xf3cb[_0x257dd1];return _0x41130d;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xbf3c('0x0'),_0xbf3c('0x1'),_0xbf3c('0x2')];function createListener(_0x16c956,_0x4af37e){return function(_0x30ca07){_0x4af37e[_0xbf3c('0x3')](_0x16c956,_0x30ca07);};}function removeListener(_0x37faa9,_0x1d784c){return function(){OpenchannelQueueEvents[_0xbf3c('0x4')](_0x37faa9,_0x1d784c);};}exports[_0xbf3c('0x5')]=function(_0x5ae470){for(var _0x3cf9c5=0x0,_0xd6b750=events[_0xbf3c('0x6')];_0x3cf9c5<_0xd6b750;_0x3cf9c5++){var _0x23fd5d=events[_0x3cf9c5];var _0x57e621=createListener(_0xbf3c('0x7')+_0x23fd5d,_0x5ae470);OpenchannelQueueEvents['on'](_0x23fd5d,_0x57e621);}}; \ No newline at end of file +var _0x8a48=['update','removeListener','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x3ddda7,_0x39eaf3){var _0x38f5b4=function(_0x49be31){while(--_0x49be31){_0x3ddda7['push'](_0x3ddda7['shift']());}};_0x38f5b4(++_0x39eaf3);}(_0x8a48,0xeb));var _0x88a4=function(_0x5d8e34,_0x4c8d47){_0x5d8e34=_0x5d8e34-0x0;var _0x1dfc15=_0x8a48[_0x5d8e34];return _0x1dfc15;};'use strict';var OpenchannelQueueEvents=require(_0x88a4('0x0'));var events=[_0x88a4('0x1'),_0x88a4('0x2'),_0x88a4('0x3')];function createListener(_0x188229,_0x23f187){return function(_0x361247){_0x23f187['emit'](_0x188229,_0x361247);};}function removeListener(_0x220751,_0x346fe3){return function(){OpenchannelQueueEvents[_0x88a4('0x4')](_0x220751,_0x346fe3);};}exports['register']=function(_0x43cc51){for(var _0x117b94=0x0,_0x47b5c2=events[_0x88a4('0x5')];_0x117b94<_0x47b5c2;_0x117b94++){var _0x125fdb=events[_0x117b94];var _0x5318dd=createListener(_0x88a4('0x6')+_0x125fdb,_0x43cc51);OpenchannelQueueEvents['on'](_0x125fdb,_0x5318dd);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 8521082..e61d71c 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 _0x205a=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x205a,0x9a));var _0xa205=function(_0x2be475,_0x58b009){_0x2be475=_0x2be475-0x0;var _0x12b191=_0x205a[_0x2be475];return _0x12b191;};'use strict';var multer=require(_0xa205('0x0'));var util=require(_0xa205('0x1'));var path=require(_0xa205('0x2'));var timeout=require(_0xa205('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa205('0x4'));var interaction=require(_0xa205('0x5'));var config=require(_0xa205('0x6'));var controller=require(_0xa205('0x7'));router[_0xa205('0x8')]('/',auth[_0xa205('0x9')](),controller[_0xa205('0xa')]);router[_0xa205('0x8')](_0xa205('0xb'),auth['isAuthenticated'](),controller[_0xa205('0xc')]);router['get'](_0xa205('0xd'),auth[_0xa205('0x9')](),controller[_0xa205('0xe')]);router[_0xa205('0xf')]('/',auth[_0xa205('0x9')](),controller[_0xa205('0x10')]);router[_0xa205('0x11')](_0xa205('0xd'),auth[_0xa205('0x9')](),controller[_0xa205('0x12')]);router[_0xa205('0x13')](_0xa205('0xd'),auth['isAuthenticated'](),controller[_0xa205('0x14')]);module[_0xa205('0x15')]=router; \ No newline at end of file +var _0x87c8=['/describe','/:id','show','create','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','./openchannelQueueReport.controller','get','isAuthenticated','index'];(function(_0x290de6,_0x110fc3){var _0x2f6624=function(_0xf5c137){while(--_0xf5c137){_0x290de6['push'](_0x290de6['shift']());}};_0x2f6624(++_0x110fc3);}(_0x87c8,0x196));var _0x887c=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x87c8[_0x54d4a8];return _0x3b321b;};'use strict';var multer=require(_0x887c('0x0'));var util=require(_0x887c('0x1'));var path=require(_0x887c('0x2'));var timeout=require('connect-timeout');var express=require(_0x887c('0x3'));var router=express['Router']();var fs_extra=require(_0x887c('0x4'));var auth=require(_0x887c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x887c('0x6'));router[_0x887c('0x7')]('/',auth[_0x887c('0x8')](),controller[_0x887c('0x9')]);router[_0x887c('0x7')](_0x887c('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x887c('0xb'),auth[_0x887c('0x8')](),controller[_0x887c('0xc')]);router['post']('/',auth[_0x887c('0x8')](),controller[_0x887c('0xd')]);router['put'](_0x887c('0xb'),auth[_0x887c('0x8')](),controller['update']);router[_0x887c('0xe')](_0x887c('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x887c('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 827ec09..16d5d36 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 _0x5920=['moment','sequelize','STRING','DATE'];(function(_0x396c12,_0x112294){var _0x24a768=function(_0x20678f){while(--_0x20678f){_0x396c12['push'](_0x396c12['shift']());}};_0x24a768(++_0x112294);}(_0x5920,0x13c));var _0x0592=function(_0x28d105,_0xcb4ebe){_0x28d105=_0x28d105-0x0;var _0x41c06c=_0x5920[_0x28d105];return _0x41c06c;};'use strict';var moment=require(_0x0592('0x0'));var Sequelize=require(_0x0592('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0592('0x2')]},'joinAt':{'type':Sequelize[_0x0592('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x0592('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0592('0x2')]}}; \ No newline at end of file +var _0xc99e=['moment','sequelize','STRING','DATE'];(function(_0x5ef6a2,_0x19c424){var _0x4aa800=function(_0x494a5d){while(--_0x494a5d){_0x5ef6a2['push'](_0x5ef6a2['shift']());}};_0x4aa800(++_0x19c424);}(_0xc99e,0x1d8));var _0xec99=function(_0xcfd59b,_0x59b11a){_0xcfd59b=_0xcfd59b-0x0;var _0x330e81=_0xc99e[_0xcfd59b];return _0x330e81;};'use strict';var moment=require(_0xec99('0x0'));var Sequelize=require(_0xec99('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xec99('0x2')]},'joinAt':{'type':Sequelize[_0xec99('0x3')]},'leaveAt':{'type':Sequelize[_0xec99('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xec99('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 5943f9a..04b06b3 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 _0xb99d=['apply','reject','then','error','name','index','OpenchannelQueueReport','rawAttributes','type','key','model','map','keys','filters','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','fields','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','Content-Range'];(function(_0x330ac6,_0x3adc83){var _0x59b845=function(_0x191b10){while(--_0x191b10){_0x330ac6['push'](_0x330ac6['shift']());}};_0x59b845(++_0x3adc83);}(_0xb99d,0x1c5));var _0xdb99=function(_0x3c63b3,_0x5668c2){_0x3c63b3=_0x3c63b3-0x0;var _0x27236d=_0xb99d[_0x3c63b3];return _0x27236d;};'use strict';var emlformat=require(_0xdb99('0x0'));var rimraf=require(_0xdb99('0x1'));var zipdir=require(_0xdb99('0x2'));var jsonpatch=require(_0xdb99('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdb99('0x4'));var Mustache=require(_0xdb99('0x5'));var util=require('util');var path=require(_0xdb99('0x6'));var sox=require(_0xdb99('0x7'));var csv=require(_0xdb99('0x8'));var ejs=require(_0xdb99('0x9'));var fs=require('fs');var fs_extra=require(_0xdb99('0xa'));var _=require(_0xdb99('0xb'));var squel=require(_0xdb99('0xc'));var crypto=require(_0xdb99('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdb99('0x8'));var querystring=require(_0xdb99('0xe'));var Papa=require(_0xdb99('0xf'));var Redis=require(_0xdb99('0x10'));var authService=require(_0xdb99('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdb99('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb99('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xdb99('0x14'));var licenseUtil=require(_0xdb99('0x15'));var db=require(_0xdb99('0x16'))['db'];function respondWithStatusCode(_0x5399fb,_0x555ff7){_0x555ff7=_0x555ff7||0xcc;return function(_0x5dd107){if(_0x5dd107){return _0x5399fb['sendStatus'](_0x555ff7);}return _0x5399fb['status'](_0x555ff7)[_0xdb99('0x17')]();};}function respondWithResult(_0x2bc1ca,_0x873ebf){_0x873ebf=_0x873ebf||0xc8;return function(_0x386622){if(_0x386622){return _0x2bc1ca[_0xdb99('0x18')](_0x873ebf)['json'](_0x386622);}};}function respondWithFilteredResult(_0x1df7b7,_0x5e9a8b){return function(_0x4a989d){if(_0x4a989d){var _0x35f521=typeof _0x5e9a8b['offset']===_0xdb99('0x19')&&typeof _0x5e9a8b[_0xdb99('0x1a')]===_0xdb99('0x19');var _0x2eef73=_0x4a989d[_0xdb99('0x1b')];var _0x1fd6bc=_0x35f521?0x0:_0x5e9a8b['offset'];var _0x5ed094=_0x35f521?_0x4a989d[_0xdb99('0x1b')]:_0x5e9a8b[_0xdb99('0x1c')]+_0x5e9a8b['limit'];var _0x17ce10;if(_0x5ed094>=_0x2eef73){_0x5ed094=_0x2eef73;_0x17ce10=0xc8;}else{_0x17ce10=0xce;}_0x1df7b7[_0xdb99('0x18')](_0x17ce10);return _0x1df7b7['set'](_0xdb99('0x1d'),_0x1fd6bc+'-'+_0x5ed094+'/'+_0x2eef73)['json'](_0x4a989d);}return null;};}function patchUpdates(_0x527ef5){return function(_0x3b9349){try{jsonpatch[_0xdb99('0x1e')](_0x3b9349,_0x527ef5,!![]);}catch(_0x1bb2a5){return BPromise[_0xdb99('0x1f')](_0x1bb2a5);}return _0x3b9349['save']();};}function saveUpdates(_0x46c416,_0x419df6){return function(_0xe01e7e){if(_0xe01e7e){return _0xe01e7e['update'](_0x46c416)[_0xdb99('0x20')](function(_0x4d2937){return _0x4d2937;});}return null;};}function removeEntity(_0x51d880,_0xa81f5){return function(_0x20276d){if(_0x20276d){return _0x20276d['destroy']()['then'](function(){_0x51d880[_0xdb99('0x18')](0xcc)[_0xdb99('0x17')]();});}};}function handleEntityNotFound(_0x12e43a,_0x281ed7){return function(_0x396909){if(!_0x396909){_0x12e43a['sendStatus'](0x194);}return _0x396909;};}function handleError(_0x409eb6,_0x3f7d27){_0x3f7d27=_0x3f7d27||0x1f4;return function(_0x5141d2){logger[_0xdb99('0x21')](_0x5141d2['stack']);if(_0x5141d2[_0xdb99('0x22')]){delete _0x5141d2[_0xdb99('0x22')];}_0x409eb6['status'](_0x3f7d27)['send'](_0x5141d2);};}exports[_0xdb99('0x23')]=function(_0xeede48,_0x3a18c3){var _0x20646e={},_0x4f1122={},_0x631364={'count':0x0,'rows':[]};var _0x324edd=_['map'](db[_0xdb99('0x24')][_0xdb99('0x25')],function(_0x4f150b){return{'name':_0x4f150b['fieldName'],'type':_0x4f150b[_0xdb99('0x26')][_0xdb99('0x27')]};});_0x4f1122[_0xdb99('0x28')]=_[_0xdb99('0x29')](_0x324edd,_0xdb99('0x22'));_0x4f1122['query']=_[_0xdb99('0x2a')](_0xeede48['query']);_0x4f1122[_0xdb99('0x2b')]=_['intersection'](_0x4f1122[_0xdb99('0x28')],_0x4f1122[_0xdb99('0x2c')]);_0x20646e['attributes']=_[_0xdb99('0x2d')](_0x4f1122[_0xdb99('0x28')],qs['fields'](_0xeede48[_0xdb99('0x2c')]['fields']));_0x20646e[_0xdb99('0x2e')]=_0x20646e[_0xdb99('0x2e')][_0xdb99('0x2f')]?_0x20646e[_0xdb99('0x2e')]:_0x4f1122[_0xdb99('0x28')];if(!_0xeede48[_0xdb99('0x2c')][_0xdb99('0x30')](_0xdb99('0x31'))){_0x20646e['limit']=qs[_0xdb99('0x1a')](_0xeede48[_0xdb99('0x2c')][_0xdb99('0x1a')]);_0x20646e[_0xdb99('0x1c')]=qs[_0xdb99('0x1c')](_0xeede48[_0xdb99('0x2c')][_0xdb99('0x1c')]);}_0x20646e[_0xdb99('0x32')]=qs['sort'](_0xeede48[_0xdb99('0x2c')][_0xdb99('0x33')]);_0x20646e[_0xdb99('0x34')]=qs[_0xdb99('0x2b')](_[_0xdb99('0x35')](_0xeede48[_0xdb99('0x2c')],_0x4f1122[_0xdb99('0x2b')]),_0x324edd);if(_0xeede48[_0xdb99('0x2c')][_0xdb99('0x36')]){_0x20646e[_0xdb99('0x34')]=_[_0xdb99('0x37')](_0x20646e[_0xdb99('0x34')],{'$or':_[_0xdb99('0x29')](_0x324edd,function(_0x23515d){if(_0x23515d[_0xdb99('0x26')]!==_0xdb99('0x38')){var _0x49627e={};_0x49627e[_0x23515d[_0xdb99('0x22')]]={'$like':'%'+_0xeede48['query'][_0xdb99('0x36')]+'%'};return _0x49627e;}})});}_0x20646e=_[_0xdb99('0x37')]({},_0x20646e,_0xeede48[_0xdb99('0x39')]);var _0x1722d5={'where':_0x20646e[_0xdb99('0x34')]};return db[_0xdb99('0x24')][_0xdb99('0x1b')](_0x1722d5)[_0xdb99('0x20')](function(_0x444e34){_0x631364[_0xdb99('0x1b')]=_0x444e34;if(_0xeede48[_0xdb99('0x2c')][_0xdb99('0x3a')]){_0x20646e['include']=[{'all':!![]}];}return db[_0xdb99('0x24')]['findAll'](_0x20646e);})[_0xdb99('0x20')](function(_0x4f1bb2){_0x631364[_0xdb99('0x3b')]=_0x4f1bb2;return _0x631364;})[_0xdb99('0x20')](respondWithFilteredResult(_0x3a18c3,_0x20646e))[_0xdb99('0x3c')](handleError(_0x3a18c3,null));};exports[_0xdb99('0x3d')]=function(_0x1a9f1b,_0xf9362c){var _0x2b3bb2={'raw':!![],'where':{'id':_0x1a9f1b[_0xdb99('0x3e')]['id']}},_0x5b3791={};_0x5b3791[_0xdb99('0x28')]=_['keys'](db['OpenchannelQueueReport']['rawAttributes']);_0x5b3791[_0xdb99('0x2c')]=_['keys'](_0x1a9f1b[_0xdb99('0x2c')]);_0x5b3791[_0xdb99('0x2b')]=_[_0xdb99('0x2d')](_0x5b3791[_0xdb99('0x28')],_0x5b3791['query']);_0x2b3bb2['attributes']=_[_0xdb99('0x2d')](_0x5b3791['model'],qs[_0xdb99('0x3f')](_0x1a9f1b['query'][_0xdb99('0x3f')]));_0x2b3bb2['attributes']=_0x2b3bb2['attributes'][_0xdb99('0x2f')]?_0x2b3bb2[_0xdb99('0x2e')]:_0x5b3791['model'];if(_0x1a9f1b[_0xdb99('0x2c')][_0xdb99('0x3a')]){_0x2b3bb2['include']=[{'all':!![]}];}_0x2b3bb2=_['merge']({},_0x2b3bb2,_0x1a9f1b['options']);return db[_0xdb99('0x24')][_0xdb99('0x40')](_0x2b3bb2)[_0xdb99('0x20')](handleEntityNotFound(_0xf9362c,null))['then'](respondWithResult(_0xf9362c,null))['catch'](handleError(_0xf9362c,null));};exports[_0xdb99('0x41')]=function(_0x406eb1,_0x3b5c0c){return db[_0xdb99('0x24')][_0xdb99('0x41')](_0x406eb1[_0xdb99('0x42')],{})[_0xdb99('0x20')](respondWithResult(_0x3b5c0c,0xc9))[_0xdb99('0x3c')](handleError(_0x3b5c0c,null));};exports['update']=function(_0x22901b,_0x1dd232){if(_0x22901b[_0xdb99('0x42')]['id']){delete _0x22901b['body']['id'];}return db[_0xdb99('0x24')][_0xdb99('0x40')]({'where':{'id':_0x22901b[_0xdb99('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1dd232,null))[_0xdb99('0x20')](saveUpdates(_0x22901b[_0xdb99('0x42')],null))[_0xdb99('0x20')](respondWithResult(_0x1dd232,null))[_0xdb99('0x3c')](handleError(_0x1dd232,null));};exports[_0xdb99('0x43')]=function(_0x385405,_0x2140b8){return db[_0xdb99('0x24')][_0xdb99('0x40')]({'where':{'id':_0x385405['params']['id']}})[_0xdb99('0x20')](handleEntityNotFound(_0x2140b8,null))['then'](removeEntity(_0x2140b8,null))[_0xdb99('0x3c')](handleError(_0x2140b8,null));};exports['describe']=function(_0x3bfd07,_0x2fefab){return db[_0xdb99('0x24')][_0xdb99('0x44')]()[_0xdb99('0x20')](respondWithResult(_0x2fefab,null))[_0xdb99('0x3c')](handleError(_0x2fefab,null));}; \ No newline at end of file +var _0x8ce2=['findAll','params','rawAttributes','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','OpenchannelQueueReport','fieldName','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','map','type','VIRTUAL','options','includeAll','include'];(function(_0x15a729,_0x5aa380){var _0x3bb94d=function(_0x3df862){while(--_0x3df862){_0x15a729['push'](_0x15a729['shift']());}};_0x3bb94d(++_0x5aa380);}(_0x8ce2,0x15c));var _0x28ce=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x8ce2[_0x481bf7];return _0x461787;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28ce('0x0'));var zipdir=require(_0x28ce('0x1'));var jsonpatch=require(_0x28ce('0x2'));var rp=require(_0x28ce('0x3'));var moment=require(_0x28ce('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x28ce('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x28ce('0x6'));var _=require(_0x28ce('0x7'));var squel=require(_0x28ce('0x8'));var crypto=require(_0x28ce('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x28ce('0xa'));var toCsv=require(_0x28ce('0xb'));var querystring=require(_0x28ce('0xc'));var Papa=require(_0x28ce('0xd'));var Redis=require(_0x28ce('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x28ce('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28ce('0x10'));var logger=require(_0x28ce('0x11'))(_0x28ce('0x12'));var utils=require(_0x28ce('0x13'));var config=require(_0x28ce('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x28ce('0x15'))['db'];function respondWithStatusCode(_0x2ab15d,_0x3ecf1b){_0x3ecf1b=_0x3ecf1b||0xcc;return function(_0x3c9236){if(_0x3c9236){return _0x2ab15d['sendStatus'](_0x3ecf1b);}return _0x2ab15d[_0x28ce('0x16')](_0x3ecf1b)[_0x28ce('0x17')]();};}function respondWithResult(_0x5855f4,_0x5d63b0){_0x5d63b0=_0x5d63b0||0xc8;return function(_0x16c4fb){if(_0x16c4fb){return _0x5855f4[_0x28ce('0x16')](_0x5d63b0)['json'](_0x16c4fb);}};}function respondWithFilteredResult(_0x22fbb8,_0x468623){return function(_0xe0d158){if(_0xe0d158){var _0x54f637=typeof _0x468623['offset']==='undefined'&&typeof _0x468623['limit']===_0x28ce('0x18');var _0x5085fe=_0xe0d158[_0x28ce('0x19')];var _0x5b0418=_0x54f637?0x0:_0x468623[_0x28ce('0x1a')];var _0x2fe9ce=_0x54f637?_0xe0d158[_0x28ce('0x19')]:_0x468623['offset']+_0x468623[_0x28ce('0x1b')];var _0x5ea370;if(_0x2fe9ce>=_0x5085fe){_0x2fe9ce=_0x5085fe;_0x5ea370=0xc8;}else{_0x5ea370=0xce;}_0x22fbb8[_0x28ce('0x16')](_0x5ea370);return _0x22fbb8['set'](_0x28ce('0x1c'),_0x5b0418+'-'+_0x2fe9ce+'/'+_0x5085fe)['json'](_0xe0d158);}return null;};}function patchUpdates(_0x2f3842){return function(_0x2fda78){try{jsonpatch[_0x28ce('0x1d')](_0x2fda78,_0x2f3842,!![]);}catch(_0xe5d00a){return BPromise[_0x28ce('0x1e')](_0xe5d00a);}return _0x2fda78[_0x28ce('0x1f')]();};}function saveUpdates(_0x3d633b,_0x34f492){return function(_0x2cd37c){if(_0x2cd37c){return _0x2cd37c[_0x28ce('0x20')](_0x3d633b)[_0x28ce('0x21')](function(_0x211f26){return _0x211f26;});}return null;};}function removeEntity(_0x4f989a,_0xa1f18a){return function(_0x2481d4){if(_0x2481d4){return _0x2481d4[_0x28ce('0x22')]()[_0x28ce('0x21')](function(){_0x4f989a[_0x28ce('0x16')](0xcc)[_0x28ce('0x17')]();});}};}function handleEntityNotFound(_0x3006ad,_0x3296a6){return function(_0x386c12){if(!_0x386c12){_0x3006ad[_0x28ce('0x23')](0x194);}return _0x386c12;};}function handleError(_0x291d8d,_0x16cc2f){_0x16cc2f=_0x16cc2f||0x1f4;return function(_0x57069e){logger['error'](_0x57069e[_0x28ce('0x24')]);if(_0x57069e[_0x28ce('0x25')]){delete _0x57069e['name'];}_0x291d8d[_0x28ce('0x16')](_0x16cc2f)['send'](_0x57069e);};}exports[_0x28ce('0x26')]=function(_0x573964,_0x41ffb8){var _0x3657a0={},_0x4ec9bf={},_0x5be4a6={'count':0x0,'rows':[]};var _0x30df7f=_['map'](db[_0x28ce('0x27')]['rawAttributes'],function(_0x34d608){return{'name':_0x34d608[_0x28ce('0x28')],'type':_0x34d608['type'][_0x28ce('0x29')]};});_0x4ec9bf[_0x28ce('0x2a')]=_['map'](_0x30df7f,_0x28ce('0x25'));_0x4ec9bf[_0x28ce('0x2b')]=_['keys'](_0x573964[_0x28ce('0x2b')]);_0x4ec9bf[_0x28ce('0x2c')]=_[_0x28ce('0x2d')](_0x4ec9bf[_0x28ce('0x2a')],_0x4ec9bf[_0x28ce('0x2b')]);_0x3657a0[_0x28ce('0x2e')]=_[_0x28ce('0x2d')](_0x4ec9bf['model'],qs[_0x28ce('0x2f')](_0x573964['query'][_0x28ce('0x2f')]));_0x3657a0[_0x28ce('0x2e')]=_0x3657a0['attributes'][_0x28ce('0x30')]?_0x3657a0[_0x28ce('0x2e')]:_0x4ec9bf[_0x28ce('0x2a')];if(!_0x573964['query']['hasOwnProperty']('nolimit')){_0x3657a0[_0x28ce('0x1b')]=qs[_0x28ce('0x1b')](_0x573964[_0x28ce('0x2b')][_0x28ce('0x1b')]);_0x3657a0[_0x28ce('0x1a')]=qs['offset'](_0x573964[_0x28ce('0x2b')][_0x28ce('0x1a')]);}_0x3657a0[_0x28ce('0x31')]=qs[_0x28ce('0x32')](_0x573964[_0x28ce('0x2b')]['sort']);_0x3657a0[_0x28ce('0x33')]=qs[_0x28ce('0x2c')](_['pick'](_0x573964[_0x28ce('0x2b')],_0x4ec9bf[_0x28ce('0x2c')]),_0x30df7f);if(_0x573964[_0x28ce('0x2b')][_0x28ce('0x34')]){_0x3657a0[_0x28ce('0x33')]=_[_0x28ce('0x35')](_0x3657a0['where'],{'$or':_[_0x28ce('0x36')](_0x30df7f,function(_0x3949d5){if(_0x3949d5[_0x28ce('0x37')]!==_0x28ce('0x38')){var _0x3c3b63={};_0x3c3b63[_0x3949d5[_0x28ce('0x25')]]={'$like':'%'+_0x573964['query'][_0x28ce('0x34')]+'%'};return _0x3c3b63;}})});}_0x3657a0=_[_0x28ce('0x35')]({},_0x3657a0,_0x573964[_0x28ce('0x39')]);var _0x5d424b={'where':_0x3657a0['where']};return db[_0x28ce('0x27')]['count'](_0x5d424b)[_0x28ce('0x21')](function(_0xf9a32){_0x5be4a6[_0x28ce('0x19')]=_0xf9a32;if(_0x573964[_0x28ce('0x2b')][_0x28ce('0x3a')]){_0x3657a0[_0x28ce('0x3b')]=[{'all':!![]}];}return db[_0x28ce('0x27')][_0x28ce('0x3c')](_0x3657a0);})[_0x28ce('0x21')](function(_0x532863){_0x5be4a6['rows']=_0x532863;return _0x5be4a6;})[_0x28ce('0x21')](respondWithFilteredResult(_0x41ffb8,_0x3657a0))['catch'](handleError(_0x41ffb8,null));};exports['show']=function(_0x284d49,_0x31c6cf){var _0x4309c7={'raw':!![],'where':{'id':_0x284d49[_0x28ce('0x3d')]['id']}},_0x3e1483={};_0x3e1483[_0x28ce('0x2a')]=_['keys'](db[_0x28ce('0x27')][_0x28ce('0x3e')]);_0x3e1483[_0x28ce('0x2b')]=_['keys'](_0x284d49['query']);_0x3e1483['filters']=_[_0x28ce('0x2d')](_0x3e1483['model'],_0x3e1483[_0x28ce('0x2b')]);_0x4309c7['attributes']=_[_0x28ce('0x2d')](_0x3e1483[_0x28ce('0x2a')],qs[_0x28ce('0x2f')](_0x284d49[_0x28ce('0x2b')][_0x28ce('0x2f')]));_0x4309c7['attributes']=_0x4309c7[_0x28ce('0x2e')][_0x28ce('0x30')]?_0x4309c7[_0x28ce('0x2e')]:_0x3e1483[_0x28ce('0x2a')];if(_0x284d49[_0x28ce('0x2b')][_0x28ce('0x3a')]){_0x4309c7['include']=[{'all':!![]}];}_0x4309c7=_[_0x28ce('0x35')]({},_0x4309c7,_0x284d49['options']);return db['OpenchannelQueueReport'][_0x28ce('0x3f')](_0x4309c7)['then'](handleEntityNotFound(_0x31c6cf,null))[_0x28ce('0x21')](respondWithResult(_0x31c6cf,null))[_0x28ce('0x40')](handleError(_0x31c6cf,null));};exports[_0x28ce('0x41')]=function(_0x1959e5,_0x28cff1){return db[_0x28ce('0x27')][_0x28ce('0x41')](_0x1959e5[_0x28ce('0x42')],{})[_0x28ce('0x21')](respondWithResult(_0x28cff1,0xc9))[_0x28ce('0x40')](handleError(_0x28cff1,null));};exports[_0x28ce('0x20')]=function(_0x316eb0,_0x349a06){if(_0x316eb0[_0x28ce('0x42')]['id']){delete _0x316eb0[_0x28ce('0x42')]['id'];}return db['OpenchannelQueueReport'][_0x28ce('0x3f')]({'where':{'id':_0x316eb0[_0x28ce('0x3d')]['id']}})[_0x28ce('0x21')](handleEntityNotFound(_0x349a06,null))[_0x28ce('0x21')](saveUpdates(_0x316eb0['body'],null))['then'](respondWithResult(_0x349a06,null))[_0x28ce('0x40')](handleError(_0x349a06,null));};exports[_0x28ce('0x22')]=function(_0x567773,_0x26c61c){return db[_0x28ce('0x27')][_0x28ce('0x3f')]({'where':{'id':_0x567773[_0x28ce('0x3d')]['id']}})[_0x28ce('0x21')](handleEntityNotFound(_0x26c61c,null))['then'](removeEntity(_0x26c61c,null))[_0x28ce('0x40')](handleError(_0x26c61c,null));};exports['describe']=function(_0x26d3aa,_0x9aa9f6){return db[_0x28ce('0x27')][_0x28ce('0x43')]()[_0x28ce('0x21')](respondWithResult(_0x9aa9f6,null))[_0x28ce('0x40')](handleError(_0x9aa9f6,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 199642a..0e877a3 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(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x814b,0x1a2));var _0xb814=function(_0x491faa,_0x4f2907){_0x491faa=_0x491faa-0x0;var _0x414440=_0x814b[_0x491faa];return _0x414440;};'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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x337000,_0x5632dc){var _0x2bf2ec=function(_0x4660cb){while(--_0x4660cb){_0x337000['push'](_0x337000['shift']());}};_0x2bf2ec(++_0x5632dc);}(_0x1261,0x144));var _0x1126=function(_0x53f897,_0x539857){_0x53f897=_0x53f897-0x0;var _0x6879f8=_0x1261[_0x53f897];return _0x6879f8;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 38fd7c9..bb4389d 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 _0x3c66=['request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','OpenchannelQueueReport','options','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','body','raw','attributes','limit','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2f8437,_0x206ece){var _0x5079f5=function(_0x4fe111){while(--_0x4fe111){_0x2f8437['push'](_0x2f8437['shift']());}};_0x5079f5(++_0x206ece);}(_0x3c66,0x8b));var _0x63c6=function(_0x61bd02,_0x171b8c){_0x61bd02=_0x61bd02-0x0;var _0x5c7b71=_0x3c66[_0x61bd02];return _0x5c7b71;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x63c6('0x0'));var rs=require(_0x63c6('0x1'));var fs=require('fs');var Redis=require(_0x63c6('0x2'));var db=require(_0x63c6('0x3'))['db'];var utils=require(_0x63c6('0x4'));var logger=require(_0x63c6('0x5'))(_0x63c6('0x6'));var config=require(_0x63c6('0x7'));var jayson=require(_0x63c6('0x8'));var client=jayson[_0x63c6('0x9')][_0x63c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b33e8,_0x47b438,_0x232099){return new BPromise(function(_0x50ff5c,_0x44e826){return client[_0x63c6('0xb')](_0x2b33e8,_0x232099)['then'](function(_0x386110){logger[_0x63c6('0xc')](_0x63c6('0xd'),_0x47b438,_0x63c6('0xe'));logger[_0x63c6('0xf')](_0x63c6('0x10'),_0x47b438,'request\x20sent',JSON[_0x63c6('0x11')](_0x386110));if(_0x386110[_0x63c6('0x12')]){if(_0x386110[_0x63c6('0x12')]['code']===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x47b438,_0x386110['error']['message']);return _0x44e826(_0x386110['error'][_0x63c6('0x13')]);}logger[_0x63c6('0x12')](_0x63c6('0xd'),_0x47b438,_0x386110[_0x63c6('0x12')][_0x63c6('0x13')]);return _0x50ff5c(_0x386110['error'][_0x63c6('0x13')]);}else{logger[_0x63c6('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x47b438,_0x63c6('0xe'));_0x50ff5c(_0x386110['result']['message']);}})[_0x63c6('0x14')](function(_0x571022){logger[_0x63c6('0x12')](_0x63c6('0xd'),_0x47b438,_0x571022);_0x44e826(_0x571022);});});}exports['CreateOpenchannelQueueReport']=function(_0xd5a3b5){var _0x2bbda5=this;return new Promise(function(_0x377f6e,_0x35ee57){return db[_0x63c6('0x15')]['create'](_0xd5a3b5['body'],{'raw':_0xd5a3b5['options']?_0xd5a3b5[_0x63c6('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xb7ba4f){logger[_0x63c6('0xc')]('CreateOpenchannelQueueReport',_0xd5a3b5);logger[_0x63c6('0xf')](_0x63c6('0x17'),_0xd5a3b5,JSON[_0x63c6('0x11')](_0xb7ba4f));_0x377f6e(_0xb7ba4f);})[_0x63c6('0x14')](function(_0x430a6e){logger['error'](_0x63c6('0x17'),_0x430a6e[_0x63c6('0x13')],_0xd5a3b5);_0x35ee57(_0x2bbda5[_0x63c6('0x12')](0x1f4,_0x430a6e[_0x63c6('0x13')]));});});};exports[_0x63c6('0x18')]=function(_0x2d72c9){var _0x2d2316=this;return new Promise(function(_0x2e3580,_0x4c0d24){return db[_0x63c6('0x15')][_0x63c6('0x19')](_0x2d72c9[_0x63c6('0x1a')],{'raw':_0x2d72c9['options']?_0x2d72c9['options'][_0x63c6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d72c9['options']?_0x2d72c9[_0x63c6('0x16')]['where']||null:null,'attributes':_0x2d72c9['options']?_0x2d72c9[_0x63c6('0x16')][_0x63c6('0x1c')]||null:null,'limit':_0x2d72c9[_0x63c6('0x16')]?_0x2d72c9['options'][_0x63c6('0x1d')]||null:null})['then'](function(_0x1c6a20){logger[_0x63c6('0xc')](_0x63c6('0x18'),_0x2d72c9);logger[_0x63c6('0xf')](_0x63c6('0x18'),_0x2d72c9,JSON[_0x63c6('0x11')](_0x1c6a20));_0x2e3580(_0x1c6a20);})[_0x63c6('0x14')](function(_0xccd510){logger['error'](_0x63c6('0x18'),_0xccd510[_0x63c6('0x13')],_0x2d72c9);_0x4c0d24(_0x2d2316[_0x63c6('0x12')](0x1f4,_0xccd510[_0x63c6('0x13')]));});});}; \ No newline at end of file +var _0x6a95=['request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then','UpdateOpenchannelQueueReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x4f6880,_0x34d7cd){var _0x586dd0=function(_0x581ee4){while(--_0x581ee4){_0x4f6880['push'](_0x4f6880['shift']());}};_0x586dd0(++_0x34d7cd);}(_0x6a95,0x1db));var _0x56a9=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x6a95[_0x32d457];return _0x338386;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56a9('0x7'));var config=require(_0x56a9('0x8'));var jayson=require(_0x56a9('0x9'));var client=jayson[_0x56a9('0xa')][_0x56a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x365093,_0xd8aa7c,_0x5d3e80){return new BPromise(function(_0x5f0dcb,_0x3ac626){return client[_0x56a9('0xc')](_0x365093,_0x5d3e80)['then'](function(_0xe4b98c){logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));logger[_0x56a9('0x10')](_0x56a9('0x11'),_0xd8aa7c,_0x56a9('0xf'),JSON[_0x56a9('0x12')](_0xe4b98c));if(_0xe4b98c[_0x56a9('0x13')]){if(_0xe4b98c['error'][_0x56a9('0x14')]===0x1f4){logger['error'](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x3ac626(_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);}logger[_0x56a9('0x13')](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x5f0dcb(_0xe4b98c['error']['message']);}else{logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));_0x5f0dcb(_0xe4b98c[_0x56a9('0x16')]['message']);}})[_0x56a9('0x17')](function(_0x4853a3){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xd8aa7c,_0x4853a3);_0x3ac626(_0x4853a3);});});}exports[_0x56a9('0x18')]=function(_0x576bdf){var _0x59c0ec=this;return new Promise(function(_0x105fe5,_0x459a87){return db[_0x56a9('0x19')][_0x56a9('0x1a')](_0x576bdf[_0x56a9('0x1b')],{'raw':_0x576bdf[_0x56a9('0x1c')]?_0x576bdf[_0x56a9('0x1c')][_0x56a9('0x1d')]===undefined?!![]:![]:!![]})[_0x56a9('0x1e')](function(_0x5f145f){logger['info'](_0x56a9('0x18'),_0x576bdf);logger[_0x56a9('0x10')](_0x56a9('0x18'),_0x576bdf,JSON[_0x56a9('0x12')](_0x5f145f));_0x105fe5(_0x5f145f);})['catch'](function(_0x6100fe){logger[_0x56a9('0x13')](_0x56a9('0x18'),_0x6100fe[_0x56a9('0x15')],_0x576bdf);_0x459a87(_0x59c0ec['error'](0x1f4,_0x6100fe[_0x56a9('0x15')]));});});};exports[_0x56a9('0x1f')]=function(_0x21ab38){var _0xd029f7=this;return new Promise(function(_0x497d31,_0x52016c){return db[_0x56a9('0x19')][_0x56a9('0x20')](_0x21ab38[_0x56a9('0x1b')],{'raw':_0x21ab38['options']?_0x21ab38[_0x56a9('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21ab38[_0x56a9('0x1c')]?_0x21ab38[_0x56a9('0x1c')][_0x56a9('0x21')]||null:null,'attributes':_0x21ab38[_0x56a9('0x1c')]?_0x21ab38[_0x56a9('0x1c')][_0x56a9('0x22')]||null:null,'limit':_0x21ab38[_0x56a9('0x1c')]?_0x21ab38[_0x56a9('0x1c')]['limit']||null:null})[_0x56a9('0x1e')](function(_0x2bb1eb){logger['info'](_0x56a9('0x1f'),_0x21ab38);logger['debug']('UpdateOpenchannelQueueReport',_0x21ab38,JSON[_0x56a9('0x12')](_0x2bb1eb));_0x497d31(_0x2bb1eb);})['catch'](function(_0x2f933a){logger[_0x56a9('0x13')](_0x56a9('0x1f'),_0x2f933a[_0x56a9('0x15')],_0x21ab38);_0x52016c(_0xd029f7['error'](0x1f4,_0x2f933a[_0x56a9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index a3c3dfd..6a5c40f 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 _0xa68e=['./openchannelTransferReport.controller','isAuthenticated','get','/describe','/:id','show','post','put','update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x22b9c0,_0x5dac0a){var _0x4b6a80=function(_0x237a8d){while(--_0x237a8d){_0x22b9c0['push'](_0x22b9c0['shift']());}};_0x4b6a80(++_0x5dac0a);}(_0xa68e,0x77));var _0xea68=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0xa68e[_0x4358f5];return _0x4d8104;};'use strict';var multer=require(_0xea68('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xea68('0x1'));var express=require(_0xea68('0x2'));var router=express['Router']();var fs_extra=require(_0xea68('0x3'));var auth=require(_0xea68('0x4'));var interaction=require(_0xea68('0x5'));var config=require(_0xea68('0x6'));var controller=require(_0xea68('0x7'));router['get']('/',auth[_0xea68('0x8')](),controller['index']);router[_0xea68('0x9')](_0xea68('0xa'),auth[_0xea68('0x8')](),controller['describe']);router[_0xea68('0x9')](_0xea68('0xb'),auth[_0xea68('0x8')](),controller[_0xea68('0xc')]);router[_0xea68('0xd')]('/',auth[_0xea68('0x8')](),controller['create']);router[_0xea68('0xe')](_0xea68('0xb'),auth['isAuthenticated'](),controller[_0xea68('0xf')]);router[_0xea68('0x10')]('/:id',auth[_0xea68('0x8')](),controller['destroy']);module[_0xea68('0x11')]=router; \ No newline at end of file +var _0xfd77=['/describe','/:id','show','put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index'];(function(_0x221549,_0x3c0d19){var _0x45c389=function(_0x3abba5){while(--_0x3abba5){_0x221549['push'](_0x221549['shift']());}};_0x45c389(++_0x3c0d19);}(_0xfd77,0x15d));var _0x7fd7=function(_0x210bf8,_0x2f2446){_0x210bf8=_0x210bf8-0x0;var _0x1ed644=_0xfd77[_0x210bf8];return _0x1ed644;};'use strict';var multer=require(_0x7fd7('0x0'));var util=require('util');var path=require(_0x7fd7('0x1'));var timeout=require('connect-timeout');var express=require(_0x7fd7('0x2'));var router=express[_0x7fd7('0x3')]();var fs_extra=require(_0x7fd7('0x4'));var auth=require(_0x7fd7('0x5'));var interaction=require(_0x7fd7('0x6'));var config=require('../../config/environment');var controller=require(_0x7fd7('0x7'));router[_0x7fd7('0x8')]('/',auth[_0x7fd7('0x9')](),controller[_0x7fd7('0xa')]);router[_0x7fd7('0x8')](_0x7fd7('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x7fd7('0x8')](_0x7fd7('0xc'),auth[_0x7fd7('0x9')](),controller[_0x7fd7('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7fd7('0xe')](_0x7fd7('0xc'),auth[_0x7fd7('0x9')](),controller[_0x7fd7('0xf')]);router['delete'](_0x7fd7('0xc'),auth[_0x7fd7('0x9')](),controller[_0x7fd7('0x10')]);module[_0x7fd7('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 74ce2c0..ac10515 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x331b08,_0x2c5937){var _0x5034d9=function(_0x2c916a){while(--_0x2c916a){_0x331b08['push'](_0x331b08['shift']());}};_0x5034d9(++_0x2c5937);}(_0x54ef,0x112));var _0xf54e=function(_0x4c2378,_0x52b8c7){_0x4c2378=_0x4c2378-0x0;var _0x59b839=_0x54ef[_0x4c2378];return _0x59b839;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x5eb9e3,_0x50ef15){var _0x58e936=function(_0x516c27){while(--_0x516c27){_0x5eb9e3['push'](_0x5eb9e3['shift']());}};_0x58e936(++_0x50ef15);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x40f991,_0x576819){_0x40f991=_0x40f991-0x0;var _0x38eca2=_0xf3cd[_0x40f991];return _0x38eca2;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 345cae4..e218301 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 _0xa9e4=['update','destroy','error','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','then','count','include','OpenchannelTransferReport','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save'];(function(_0x1c4195,_0x1c5027){var _0x315e15=function(_0x4614cc){while(--_0x4614cc){_0x1c4195['push'](_0x1c4195['shift']());}};_0x315e15(++_0x1c5027);}(_0xa9e4,0xbb));var _0x4a9e=function(_0x2236a0,_0x4031a7){_0x2236a0=_0x2236a0-0x0;var _0x1d94d6=_0xa9e4[_0x2236a0];return _0x1d94d6;};'use strict';var emlformat=require(_0x4a9e('0x0'));var rimraf=require(_0x4a9e('0x1'));var zipdir=require(_0x4a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4a9e('0x3'));var moment=require('moment');var BPromise=require(_0x4a9e('0x4'));var Mustache=require(_0x4a9e('0x5'));var util=require(_0x4a9e('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4a9e('0x7'));var fs=require('fs');var fs_extra=require(_0x4a9e('0x8'));var _=require('lodash');var squel=require(_0x4a9e('0x9'));var crypto=require(_0x4a9e('0xa'));var jsforce=require(_0x4a9e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4a9e('0xc'));var Redis=require(_0x4a9e('0xd'));var authService=require(_0x4a9e('0xe'));var qs=require(_0x4a9e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a9e('0x10'))(_0x4a9e('0x11'));var utils=require(_0x4a9e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x4a9e('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b6f41,_0x5ab13f){_0x5ab13f=_0x5ab13f||0xcc;return function(_0xc0cc4b){if(_0xc0cc4b){return _0x5b6f41[_0x4a9e('0x14')](_0x5ab13f);}return _0x5b6f41[_0x4a9e('0x15')](_0x5ab13f)[_0x4a9e('0x16')]();};}function respondWithResult(_0x15aa48,_0x31c8c3){_0x31c8c3=_0x31c8c3||0xc8;return function(_0x2bb55e){if(_0x2bb55e){return _0x15aa48[_0x4a9e('0x15')](_0x31c8c3)[_0x4a9e('0x17')](_0x2bb55e);}};}function respondWithFilteredResult(_0x300608,_0xfa3d1e){return function(_0x2f14fb){if(_0x2f14fb){var _0x3ce9ab=typeof _0xfa3d1e['offset']===_0x4a9e('0x18')&&typeof _0xfa3d1e[_0x4a9e('0x19')]===_0x4a9e('0x18');var _0x14a87b=_0x2f14fb['count'];var _0x20ede5=_0x3ce9ab?0x0:_0xfa3d1e[_0x4a9e('0x1a')];var _0x272944=_0x3ce9ab?_0x2f14fb['count']:_0xfa3d1e['offset']+_0xfa3d1e['limit'];var _0x28e745;if(_0x272944>=_0x14a87b){_0x272944=_0x14a87b;_0x28e745=0xc8;}else{_0x28e745=0xce;}_0x300608[_0x4a9e('0x15')](_0x28e745);return _0x300608[_0x4a9e('0x1b')](_0x4a9e('0x1c'),_0x20ede5+'-'+_0x272944+'/'+_0x14a87b)[_0x4a9e('0x17')](_0x2f14fb);}return null;};}function patchUpdates(_0x4bba6e){return function(_0x36f613){try{jsonpatch[_0x4a9e('0x1d')](_0x36f613,_0x4bba6e,!![]);}catch(_0x3dce83){return BPromise[_0x4a9e('0x1e')](_0x3dce83);}return _0x36f613[_0x4a9e('0x1f')]();};}function saveUpdates(_0x4467bc,_0x378142){return function(_0x297b75){if(_0x297b75){return _0x297b75[_0x4a9e('0x20')](_0x4467bc)['then'](function(_0x5d9577){return _0x5d9577;});}return null;};}function removeEntity(_0x509abc,_0x1d96a7){return function(_0xe0ab1c){if(_0xe0ab1c){return _0xe0ab1c[_0x4a9e('0x21')]()['then'](function(){_0x509abc[_0x4a9e('0x15')](0xcc)[_0x4a9e('0x16')]();});}};}function handleEntityNotFound(_0x3f0555,_0x1f8440){return function(_0x402e6d){if(!_0x402e6d){_0x3f0555[_0x4a9e('0x14')](0x194);}return _0x402e6d;};}function handleError(_0x28a837,_0x262d9b){_0x262d9b=_0x262d9b||0x1f4;return function(_0x651398){logger[_0x4a9e('0x22')](_0x651398['stack']);if(_0x651398[_0x4a9e('0x23')]){delete _0x651398['name'];}_0x28a837[_0x4a9e('0x15')](_0x262d9b)[_0x4a9e('0x24')](_0x651398);};}exports['index']=function(_0x251379,_0x198caa){var _0x7b0b9c={},_0x5dc179={},_0x569335={'count':0x0,'rows':[]};var _0x34a4a0=_[_0x4a9e('0x25')](db['OpenchannelTransferReport'][_0x4a9e('0x26')],function(_0x9e9f77){return{'name':_0x9e9f77[_0x4a9e('0x27')],'type':_0x9e9f77['type'][_0x4a9e('0x28')]};});_0x5dc179[_0x4a9e('0x29')]=_['map'](_0x34a4a0,_0x4a9e('0x23'));_0x5dc179[_0x4a9e('0x2a')]=_[_0x4a9e('0x2b')](_0x251379['query']);_0x5dc179[_0x4a9e('0x2c')]=_[_0x4a9e('0x2d')](_0x5dc179[_0x4a9e('0x29')],_0x5dc179[_0x4a9e('0x2a')]);_0x7b0b9c[_0x4a9e('0x2e')]=_[_0x4a9e('0x2d')](_0x5dc179[_0x4a9e('0x29')],qs[_0x4a9e('0x2f')](_0x251379[_0x4a9e('0x2a')]['fields']));_0x7b0b9c[_0x4a9e('0x2e')]=_0x7b0b9c[_0x4a9e('0x2e')][_0x4a9e('0x30')]?_0x7b0b9c['attributes']:_0x5dc179[_0x4a9e('0x29')];if(!_0x251379['query'][_0x4a9e('0x31')](_0x4a9e('0x32'))){_0x7b0b9c[_0x4a9e('0x19')]=qs[_0x4a9e('0x19')](_0x251379[_0x4a9e('0x2a')]['limit']);_0x7b0b9c['offset']=qs[_0x4a9e('0x1a')](_0x251379['query'][_0x4a9e('0x1a')]);}_0x7b0b9c[_0x4a9e('0x33')]=qs[_0x4a9e('0x34')](_0x251379[_0x4a9e('0x2a')]['sort']);_0x7b0b9c[_0x4a9e('0x35')]=qs[_0x4a9e('0x2c')](_[_0x4a9e('0x36')](_0x251379[_0x4a9e('0x2a')],_0x5dc179['filters']),_0x34a4a0);if(_0x251379[_0x4a9e('0x2a')]['filter']){_0x7b0b9c[_0x4a9e('0x35')]=_[_0x4a9e('0x37')](_0x7b0b9c[_0x4a9e('0x35')],{'$or':_[_0x4a9e('0x25')](_0x34a4a0,function(_0x10c28d){if(_0x10c28d[_0x4a9e('0x38')]!==_0x4a9e('0x39')){var _0x396467={};_0x396467[_0x10c28d['name']]={'$like':'%'+_0x251379['query'][_0x4a9e('0x3a')]+'%'};return _0x396467;}})});}_0x7b0b9c=_[_0x4a9e('0x37')]({},_0x7b0b9c,_0x251379[_0x4a9e('0x3b')]);var _0x1f2676={'where':_0x7b0b9c['where']};return db['OpenchannelTransferReport']['count'](_0x1f2676)[_0x4a9e('0x3c')](function(_0x60bb1e){_0x569335[_0x4a9e('0x3d')]=_0x60bb1e;if(_0x251379['query']['includeAll']){_0x7b0b9c[_0x4a9e('0x3e')]=[{'all':!![]}];}return db[_0x4a9e('0x3f')][_0x4a9e('0x40')](_0x7b0b9c);})[_0x4a9e('0x3c')](function(_0x16e363){_0x569335[_0x4a9e('0x41')]=_0x16e363;return _0x569335;})[_0x4a9e('0x3c')](respondWithFilteredResult(_0x198caa,_0x7b0b9c))[_0x4a9e('0x42')](handleError(_0x198caa,null));};exports[_0x4a9e('0x43')]=function(_0x4d5e54,_0x1cefae){var _0x3ce7b5={'raw':!![],'where':{'id':_0x4d5e54['params']['id']}},_0x2d7e17={};_0x2d7e17[_0x4a9e('0x29')]=_[_0x4a9e('0x2b')](db[_0x4a9e('0x3f')][_0x4a9e('0x26')]);_0x2d7e17[_0x4a9e('0x2a')]=_['keys'](_0x4d5e54['query']);_0x2d7e17[_0x4a9e('0x2c')]=_[_0x4a9e('0x2d')](_0x2d7e17[_0x4a9e('0x29')],_0x2d7e17['query']);_0x3ce7b5[_0x4a9e('0x2e')]=_[_0x4a9e('0x2d')](_0x2d7e17[_0x4a9e('0x29')],qs['fields'](_0x4d5e54[_0x4a9e('0x2a')][_0x4a9e('0x2f')]));_0x3ce7b5[_0x4a9e('0x2e')]=_0x3ce7b5['attributes']['length']?_0x3ce7b5['attributes']:_0x2d7e17[_0x4a9e('0x29')];if(_0x4d5e54['query']['includeAll']){_0x3ce7b5['include']=[{'all':!![]}];}_0x3ce7b5=_['merge']({},_0x3ce7b5,_0x4d5e54['options']);return db[_0x4a9e('0x3f')][_0x4a9e('0x44')](_0x3ce7b5)[_0x4a9e('0x3c')](handleEntityNotFound(_0x1cefae,null))[_0x4a9e('0x3c')](respondWithResult(_0x1cefae,null))['catch'](handleError(_0x1cefae,null));};exports['create']=function(_0x59c431,_0x469bc0){return db[_0x4a9e('0x3f')][_0x4a9e('0x45')](_0x59c431[_0x4a9e('0x46')],{})[_0x4a9e('0x3c')](respondWithResult(_0x469bc0,0xc9))[_0x4a9e('0x42')](handleError(_0x469bc0,null));};exports['update']=function(_0x56c532,_0x551f4d){if(_0x56c532['body']['id']){delete _0x56c532[_0x4a9e('0x46')]['id'];}return db[_0x4a9e('0x3f')]['find']({'where':{'id':_0x56c532['params']['id']}})['then'](handleEntityNotFound(_0x551f4d,null))[_0x4a9e('0x3c')](saveUpdates(_0x56c532[_0x4a9e('0x46')],null))[_0x4a9e('0x3c')](respondWithResult(_0x551f4d,null))[_0x4a9e('0x42')](handleError(_0x551f4d,null));};exports[_0x4a9e('0x21')]=function(_0x182278,_0x794e44){return db[_0x4a9e('0x3f')][_0x4a9e('0x44')]({'where':{'id':_0x182278[_0x4a9e('0x47')]['id']}})[_0x4a9e('0x3c')](handleEntityNotFound(_0x794e44,null))['then'](removeEntity(_0x794e44,null))['catch'](handleError(_0x794e44,null));};exports[_0x4a9e('0x48')]=function(_0x54b7ea,_0x148da1){return db[_0x4a9e('0x3f')][_0x4a9e('0x48')]()[_0x4a9e('0x3c')](respondWithResult(_0x148da1,null))['catch'](handleError(_0x148da1,null));}; \ No newline at end of file +var _0x21f1=['stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','OpenchannelTransferReport','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../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','Content-Range','json','apply','save','update','then','error'];(function(_0x1df270,_0x4a8f8e){var _0x224d09=function(_0x3eedde){while(--_0x3eedde){_0x1df270['push'](_0x1df270['shift']());}};_0x224d09(++_0x4a8f8e);}(_0x21f1,0x10e));var _0x121f=function(_0x3313a8,_0x17e212){_0x3313a8=_0x3313a8-0x0;var _0x262dfe=_0x21f1[_0x3313a8];return _0x262dfe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x121f('0x0'));var zipdir=require(_0x121f('0x1'));var jsonpatch=require(_0x121f('0x2'));var rp=require(_0x121f('0x3'));var moment=require('moment');var BPromise=require(_0x121f('0x4'));var Mustache=require(_0x121f('0x5'));var util=require(_0x121f('0x6'));var path=require(_0x121f('0x7'));var sox=require(_0x121f('0x8'));var csv=require(_0x121f('0x9'));var ejs=require(_0x121f('0xa'));var fs=require('fs');var fs_extra=require(_0x121f('0xb'));var _=require(_0x121f('0xc'));var squel=require(_0x121f('0xd'));var crypto=require(_0x121f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x121f('0xf'));var toCsv=require(_0x121f('0x9'));var querystring=require('querystring');var Papa=require(_0x121f('0x10'));var Redis=require(_0x121f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x121f('0x12'));var as=require(_0x121f('0x13'));var hardwareService=require(_0x121f('0x14'));var logger=require(_0x121f('0x15'))(_0x121f('0x16'));var utils=require(_0x121f('0x17'));var config=require(_0x121f('0x18'));var licenseUtil=require(_0x121f('0x19'));var db=require(_0x121f('0x1a'))['db'];function respondWithStatusCode(_0x548a05,_0x4a225d){_0x4a225d=_0x4a225d||0xcc;return function(_0x29f4d8){if(_0x29f4d8){return _0x548a05[_0x121f('0x1b')](_0x4a225d);}return _0x548a05[_0x121f('0x1c')](_0x4a225d)[_0x121f('0x1d')]();};}function respondWithResult(_0x74c841,_0xd0e1fa){_0xd0e1fa=_0xd0e1fa||0xc8;return function(_0x3819a4){if(_0x3819a4){return _0x74c841[_0x121f('0x1c')](_0xd0e1fa)['json'](_0x3819a4);}};}function respondWithFilteredResult(_0x43b21b,_0x5e0fb5){return function(_0x282917){if(_0x282917){var _0xa54e83=typeof _0x5e0fb5[_0x121f('0x1e')]===_0x121f('0x1f')&&typeof _0x5e0fb5[_0x121f('0x20')]===_0x121f('0x1f');var _0x35d790=_0x282917[_0x121f('0x21')];var _0x1ec887=_0xa54e83?0x0:_0x5e0fb5['offset'];var _0x3ff4df=_0xa54e83?_0x282917[_0x121f('0x21')]:_0x5e0fb5[_0x121f('0x1e')]+_0x5e0fb5[_0x121f('0x20')];var _0x4bde4e;if(_0x3ff4df>=_0x35d790){_0x3ff4df=_0x35d790;_0x4bde4e=0xc8;}else{_0x4bde4e=0xce;}_0x43b21b[_0x121f('0x1c')](_0x4bde4e);return _0x43b21b[_0x121f('0x22')](_0x121f('0x23'),_0x1ec887+'-'+_0x3ff4df+'/'+_0x35d790)[_0x121f('0x24')](_0x282917);}return null;};}function patchUpdates(_0x45e3d9){return function(_0x62f73c){try{jsonpatch[_0x121f('0x25')](_0x62f73c,_0x45e3d9,!![]);}catch(_0xe86239){return BPromise['reject'](_0xe86239);}return _0x62f73c[_0x121f('0x26')]();};}function saveUpdates(_0x42aff5,_0x42604a){return function(_0x45ad5d){if(_0x45ad5d){return _0x45ad5d[_0x121f('0x27')](_0x42aff5)['then'](function(_0x59f313){return _0x59f313;});}return null;};}function removeEntity(_0x158815,_0x41b7f3){return function(_0x3059ee){if(_0x3059ee){return _0x3059ee['destroy']()[_0x121f('0x28')](function(){_0x158815['status'](0xcc)[_0x121f('0x1d')]();});}};}function handleEntityNotFound(_0x2433a0,_0x2b0a0f){return function(_0x1e8c51){if(!_0x1e8c51){_0x2433a0['sendStatus'](0x194);}return _0x1e8c51;};}function handleError(_0x4a4454,_0x230e1c){_0x230e1c=_0x230e1c||0x1f4;return function(_0x4908be){logger[_0x121f('0x29')](_0x4908be[_0x121f('0x2a')]);if(_0x4908be['name']){delete _0x4908be[_0x121f('0x2b')];}_0x4a4454[_0x121f('0x1c')](_0x230e1c)['send'](_0x4908be);};}exports[_0x121f('0x2c')]=function(_0x57a242,_0x117004){var _0x68914c={},_0x5a0443={},_0x5c28cc={'count':0x0,'rows':[]};var _0x28ecad=_[_0x121f('0x2d')](db['OpenchannelTransferReport'][_0x121f('0x2e')],function(_0x2a6b21){return{'name':_0x2a6b21[_0x121f('0x2f')],'type':_0x2a6b21[_0x121f('0x30')][_0x121f('0x31')]};});_0x5a0443[_0x121f('0x32')]=_['map'](_0x28ecad,_0x121f('0x2b'));_0x5a0443[_0x121f('0x33')]=_[_0x121f('0x34')](_0x57a242['query']);_0x5a0443[_0x121f('0x35')]=_[_0x121f('0x36')](_0x5a0443[_0x121f('0x32')],_0x5a0443[_0x121f('0x33')]);_0x68914c['attributes']=_[_0x121f('0x36')](_0x5a0443[_0x121f('0x32')],qs[_0x121f('0x37')](_0x57a242[_0x121f('0x33')][_0x121f('0x37')]));_0x68914c[_0x121f('0x38')]=_0x68914c[_0x121f('0x38')][_0x121f('0x39')]?_0x68914c[_0x121f('0x38')]:_0x5a0443['model'];if(!_0x57a242[_0x121f('0x33')][_0x121f('0x3a')]('nolimit')){_0x68914c['limit']=qs[_0x121f('0x20')](_0x57a242[_0x121f('0x33')][_0x121f('0x20')]);_0x68914c[_0x121f('0x1e')]=qs['offset'](_0x57a242['query']['offset']);}_0x68914c[_0x121f('0x3b')]=qs[_0x121f('0x3c')](_0x57a242['query'][_0x121f('0x3c')]);_0x68914c['where']=qs[_0x121f('0x35')](_[_0x121f('0x3d')](_0x57a242[_0x121f('0x33')],_0x5a0443[_0x121f('0x35')]),_0x28ecad);if(_0x57a242[_0x121f('0x33')][_0x121f('0x3e')]){_0x68914c[_0x121f('0x3f')]=_['merge'](_0x68914c[_0x121f('0x3f')],{'$or':_[_0x121f('0x2d')](_0x28ecad,function(_0x49a586){if(_0x49a586[_0x121f('0x30')]!=='VIRTUAL'){var _0x263052={};_0x263052[_0x49a586[_0x121f('0x2b')]]={'$like':'%'+_0x57a242[_0x121f('0x33')][_0x121f('0x3e')]+'%'};return _0x263052;}})});}_0x68914c=_[_0x121f('0x40')]({},_0x68914c,_0x57a242[_0x121f('0x41')]);var _0x3f6b3a={'where':_0x68914c[_0x121f('0x3f')]};return db[_0x121f('0x42')][_0x121f('0x21')](_0x3f6b3a)[_0x121f('0x28')](function(_0x15873){_0x5c28cc[_0x121f('0x21')]=_0x15873;if(_0x57a242[_0x121f('0x33')]['includeAll']){_0x68914c[_0x121f('0x43')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x121f('0x44')](_0x68914c);})['then'](function(_0xea7ba0){_0x5c28cc[_0x121f('0x45')]=_0xea7ba0;return _0x5c28cc;})[_0x121f('0x28')](respondWithFilteredResult(_0x117004,_0x68914c))[_0x121f('0x46')](handleError(_0x117004,null));};exports[_0x121f('0x47')]=function(_0x5a31d3,_0x6bd0ff){var _0x35050c={'raw':!![],'where':{'id':_0x5a31d3[_0x121f('0x48')]['id']}},_0x1f3960={};_0x1f3960[_0x121f('0x32')]=_[_0x121f('0x34')](db[_0x121f('0x42')][_0x121f('0x2e')]);_0x1f3960[_0x121f('0x33')]=_[_0x121f('0x34')](_0x5a31d3[_0x121f('0x33')]);_0x1f3960[_0x121f('0x35')]=_[_0x121f('0x36')](_0x1f3960['model'],_0x1f3960['query']);_0x35050c[_0x121f('0x38')]=_['intersection'](_0x1f3960[_0x121f('0x32')],qs['fields'](_0x5a31d3[_0x121f('0x33')][_0x121f('0x37')]));_0x35050c[_0x121f('0x38')]=_0x35050c['attributes'][_0x121f('0x39')]?_0x35050c[_0x121f('0x38')]:_0x1f3960[_0x121f('0x32')];if(_0x5a31d3[_0x121f('0x33')]['includeAll']){_0x35050c['include']=[{'all':!![]}];}_0x35050c=_[_0x121f('0x40')]({},_0x35050c,_0x5a31d3[_0x121f('0x41')]);return db[_0x121f('0x42')][_0x121f('0x49')](_0x35050c)[_0x121f('0x28')](handleEntityNotFound(_0x6bd0ff,null))[_0x121f('0x28')](respondWithResult(_0x6bd0ff,null))[_0x121f('0x46')](handleError(_0x6bd0ff,null));};exports[_0x121f('0x4a')]=function(_0xfb201,_0x2f65b7){return db[_0x121f('0x42')][_0x121f('0x4a')](_0xfb201[_0x121f('0x4b')],{})[_0x121f('0x28')](respondWithResult(_0x2f65b7,0xc9))['catch'](handleError(_0x2f65b7,null));};exports[_0x121f('0x27')]=function(_0x1ee411,_0xaf4e39){if(_0x1ee411['body']['id']){delete _0x1ee411[_0x121f('0x4b')]['id'];}return db[_0x121f('0x42')]['find']({'where':{'id':_0x1ee411[_0x121f('0x48')]['id']}})['then'](handleEntityNotFound(_0xaf4e39,null))['then'](saveUpdates(_0x1ee411[_0x121f('0x4b')],null))['then'](respondWithResult(_0xaf4e39,null))['catch'](handleError(_0xaf4e39,null));};exports[_0x121f('0x4c')]=function(_0x492285,_0x327aab){return db['OpenchannelTransferReport'][_0x121f('0x49')]({'where':{'id':_0x492285['params']['id']}})[_0x121f('0x28')](handleEntityNotFound(_0x327aab,null))[_0x121f('0x28')](removeEntity(_0x327aab,null))[_0x121f('0x46')](handleError(_0x327aab,null));};exports['describe']=function(_0xef4998,_0x3798a2){return db['OpenchannelTransferReport'][_0x121f('0x4d')]()[_0x121f('0x28')](respondWithResult(_0x3798a2,null))['catch'](handleError(_0x3798a2,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 94e41c0..d8a9117 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 _0xebdf=['../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','request-promise','rimraf'];(function(_0x455eff,_0x4f5c87){var _0xfcdadc=function(_0x47ca98){while(--_0x47ca98){_0x455eff['push'](_0x455eff['shift']());}};_0xfcdadc(++_0x4f5c87);}(_0xebdf,0x10e));var _0xfebd=function(_0x44ae0b,_0x3e9865){_0x44ae0b=_0x44ae0b-0x0;var _0x69232a=_0xebdf[_0x44ae0b];return _0x69232a;};'use strict';var _=require('lodash');var util=require(_0xfebd('0x0'));var logger=require(_0xfebd('0x1'))(_0xfebd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfebd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfebd('0x4'));var config=require(_0xfebd('0x5'));var attributes=require(_0xfebd('0x6'));module[_0xfebd('0x7')]=function(_0x2936c2,_0x1f111f){return _0x2936c2['define'](_0xfebd('0x8'),attributes,{'tableName':_0xfebd('0x9'),'paranoid':![],'indexes':[{'name':_0xfebd('0xa'),'fields':[_0xfebd('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa581=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x563a3c,_0x2de16d){var _0x226d5a=function(_0xfac336){while(--_0xfac336){_0x563a3c['push'](_0x563a3c['shift']());}};_0x226d5a(++_0x2de16d);}(_0xa581,0x1ec));var _0x1a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa581[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1a58('0x0'));var util=require(_0x1a58('0x1'));var logger=require(_0x1a58('0x2'))(_0x1a58('0x3'));var moment=require(_0x1a58('0x4'));var BPromise=require(_0x1a58('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1a58('0x6'));var config=require(_0x1a58('0x7'));var attributes=require(_0x1a58('0x8'));module['exports']=function(_0xb43fe7,_0x4783f0){return _0xb43fe7[_0x1a58('0x9')](_0x1a58('0xa'),attributes,{'tableName':_0x1a58('0xb'),'paranoid':![],'indexes':[{'name':_0x1a58('0xc'),'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 95c0f43..a9ad028 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 _0xf041=['OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x43a284,_0x3e27a7){var _0x5272c1=function(_0x13aded){while(--_0x13aded){_0x43a284['push'](_0x43a284['shift']());}};_0x5272c1(++_0x3e27a7);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1f04('0x0'));var BPromise=require(_0x1f04('0x1'));var rs=require(_0x1f04('0x2'));var fs=require('fs');var Redis=require(_0x1f04('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f04('0x4'));var logger=require('../../config/logger')(_0x1f04('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1f04('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c3f90,_0x165bb1,_0x12897f){return new BPromise(function(_0x1c7a8a,_0x5c48e4){return client[_0x1f04('0x7')](_0x2c3f90,_0x12897f)[_0x1f04('0x8')](function(_0x3bcdde){logger[_0x1f04('0x9')](_0x1f04('0xa'),_0x165bb1,_0x1f04('0xb'));logger[_0x1f04('0xc')](_0x1f04('0xd'),_0x165bb1,'request\x20sent',JSON['stringify'](_0x3bcdde));if(_0x3bcdde[_0x1f04('0xe')]){if(_0x3bcdde[_0x1f04('0xe')][_0x1f04('0xf')]===0x1f4){logger[_0x1f04('0xe')](_0x1f04('0xa'),_0x165bb1,_0x3bcdde[_0x1f04('0xe')][_0x1f04('0x10')]);return _0x5c48e4(_0x3bcdde[_0x1f04('0xe')][_0x1f04('0x10')]);}logger[_0x1f04('0xe')](_0x1f04('0xa'),_0x165bb1,_0x3bcdde['error']['message']);return _0x1c7a8a(_0x3bcdde[_0x1f04('0xe')][_0x1f04('0x10')]);}else{logger[_0x1f04('0x9')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x165bb1,_0x1f04('0xb'));_0x1c7a8a(_0x3bcdde['result'][_0x1f04('0x10')]);}})[_0x1f04('0x11')](function(_0x28c094){logger[_0x1f04('0xe')](_0x1f04('0xa'),_0x165bb1,_0x28c094);_0x5c48e4(_0x28c094);});});} \ No newline at end of file +var _0x1354=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1354,0x95));var _0x4135=function(_0x147c96,_0x309657){_0x147c96=_0x147c96-0x0;var _0x4ec711=_0x1354[_0x147c96];return _0x4ec711;};'use strict';var _=require(_0x4135('0x0'));var util=require(_0x4135('0x1'));var moment=require(_0x4135('0x2'));var BPromise=require(_0x4135('0x3'));var rs=require(_0x4135('0x4'));var fs=require('fs');var Redis=require(_0x4135('0x5'));var db=require(_0x4135('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4135('0x7'))(_0x4135('0x8'));var config=require(_0x4135('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4135('0xa')][_0x4135('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e355d,_0x419ad4,_0x1dcce0){return new BPromise(function(_0x3e7ae3,_0x50ef3f){return client[_0x4135('0xc')](_0x5e355d,_0x1dcce0)['then'](function(_0x365d9b){logger[_0x4135('0xd')](_0x4135('0xe'),_0x419ad4,_0x4135('0xf'));logger['debug'](_0x4135('0x10'),_0x419ad4,'request\x20sent',JSON['stringify'](_0x365d9b));if(_0x365d9b[_0x4135('0x11')]){if(_0x365d9b[_0x4135('0x11')][_0x4135('0x12')]===0x1f4){logger['error'](_0x4135('0xe'),_0x419ad4,_0x365d9b[_0x4135('0x11')][_0x4135('0x13')]);return _0x50ef3f(_0x365d9b[_0x4135('0x11')][_0x4135('0x13')]);}logger[_0x4135('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x419ad4,_0x365d9b['error'][_0x4135('0x13')]);return _0x3e7ae3(_0x365d9b[_0x4135('0x11')][_0x4135('0x13')]);}else{logger[_0x4135('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x419ad4,_0x4135('0xf'));_0x3e7ae3(_0x365d9b[_0x4135('0x14')]['message']);}})['catch'](function(_0x32b4db){logger['error'](_0x4135('0xe'),_0x419ad4,_0x32b4db);_0x50ef3f(_0x32b4db);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 6f07e5d..5a773ab 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 _0x48ef=['create','put','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x1d609d,_0x3cd046){var _0x4a8a7b=function(_0x1e6ad6){while(--_0x1e6ad6){_0x1d609d['push'](_0x1d609d['shift']());}};_0x4a8a7b(++_0x3cd046);}(_0x48ef,0x9d));var _0xf48e=function(_0x255227,_0x2063b0){_0x255227=_0x255227-0x0;var _0x43a3e4=_0x48ef[_0x255227];return _0x43a3e4;};'use strict';var multer=require(_0xf48e('0x0'));var util=require(_0xf48e('0x1'));var path=require('path');var timeout=require(_0xf48e('0x2'));var express=require(_0xf48e('0x3'));var router=express['Router']();var fs_extra=require(_0xf48e('0x4'));var auth=require(_0xf48e('0x5'));var interaction=require(_0xf48e('0x6'));var config=require(_0xf48e('0x7'));var controller=require('./pause.controller');router[_0xf48e('0x8')]('/',auth[_0xf48e('0x9')](),controller[_0xf48e('0xa')]);router[_0xf48e('0x8')](_0xf48e('0xb'),auth['isAuthenticated'](),controller[_0xf48e('0xc')]);router[_0xf48e('0xd')]('/',auth[_0xf48e('0x9')](),controller[_0xf48e('0xe')]);router[_0xf48e('0xf')](_0xf48e('0xb'),auth[_0xf48e('0x9')](),controller[_0xf48e('0x10')]);router['delete'](_0xf48e('0xb'),auth['isAuthenticated'](),controller[_0xf48e('0x11')]);module[_0xf48e('0x12')]=router; \ No newline at end of file +var _0x3236=['index','/:id','show','post','isAuthenticated','put','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x4fd5d3,_0x214090){var _0xf62a8b=function(_0x500b1e){while(--_0x500b1e){_0x4fd5d3['push'](_0x4fd5d3['shift']());}};_0xf62a8b(++_0x214090);}(_0x3236,0x69));var _0x6323=function(_0x325814,_0x5632f5){_0x325814=_0x325814-0x0;var _0x2cdf3e=_0x3236[_0x325814];return _0x2cdf3e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6323('0x0'));var timeout=require(_0x6323('0x1'));var express=require('express');var router=express[_0x6323('0x2')]();var fs_extra=require(_0x6323('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6323('0x4'));var config=require(_0x6323('0x5'));var controller=require('./pause.controller');router[_0x6323('0x6')]('/',auth['isAuthenticated'](),controller[_0x6323('0x7')]);router['get'](_0x6323('0x8'),auth['isAuthenticated'](),controller[_0x6323('0x9')]);router[_0x6323('0xa')]('/',auth[_0x6323('0xb')](),controller['create']);router[_0x6323('0xc')]('/:id',auth[_0x6323('0xb')](),controller['update']);router[_0x6323('0xd')](_0x6323('0x8'),auth['isAuthenticated'](),controller[_0x6323('0xe')]);module[_0x6323('0xf')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 23e19e6..6ac58d6 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 _0x6f31=['name','exports','STRING'];(function(_0x5d58ff,_0x893d00){var _0x22c12e=function(_0x588109){while(--_0x588109){_0x5d58ff['push'](_0x5d58ff['shift']());}};_0x22c12e(++_0x893d00);}(_0x6f31,0x1cc));var _0x16f3=function(_0x50bdf5,_0x18ec97){_0x50bdf5=_0x50bdf5-0x0;var _0x36bbe1=_0x6f31[_0x50bdf5];return _0x36bbe1;};'use strict';var Sequelize=require('sequelize');module[_0x16f3('0x0')]={'name':{'type':Sequelize[_0x16f3('0x1')],'unique':_0x16f3('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x16f3('0x1')]}}; \ No newline at end of file +var _0xf8c3=['sequelize','exports','STRING'];(function(_0x4c91da,_0x4bbebb){var _0x172d2a=function(_0x3465b2){while(--_0x3465b2){_0x4c91da['push'](_0x4c91da['shift']());}};_0x172d2a(++_0x4bbebb);}(_0xf8c3,0xa8));var _0x3f8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf8c3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3f8c('0x0'));module[_0x3f8c('0x1')]={'name':{'type':Sequelize[_0x3f8c('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 871fae5..5abe503 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 _0x1fb5=['query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','merge','Pause','includeAll','include','rows','catch','show','fields','length','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','get','Pauses','UserProfileResource','end','stack','name','send','index','rawAttributes','fieldName','type','model','map'];(function(_0x217a22,_0x5d23c2){var _0x2a67b0=function(_0x3af162){while(--_0x3af162){_0x217a22['push'](_0x217a22['shift']());}};_0x2a67b0(++_0x5d23c2);}(_0x1fb5,0xc7));var _0x51fb=function(_0x2f21d8,_0x22b8c6){_0x2f21d8=_0x2f21d8-0x0;var _0x44f4da=_0x1fb5[_0x2f21d8];return _0x44f4da;};'use strict';var emlformat=require(_0x51fb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x51fb('0x1'));var rp=require(_0x51fb('0x2'));var moment=require(_0x51fb('0x3'));var BPromise=require(_0x51fb('0x4'));var Mustache=require(_0x51fb('0x5'));var util=require('util');var path=require(_0x51fb('0x6'));var sox=require(_0x51fb('0x7'));var csv=require(_0x51fb('0x8'));var ejs=require(_0x51fb('0x9'));var fs=require('fs');var fs_extra=require(_0x51fb('0xa'));var _=require(_0x51fb('0xb'));var squel=require('squel');var crypto=require(_0x51fb('0xc'));var jsforce=require(_0x51fb('0xd'));var deskjs=require(_0x51fb('0xe'));var toCsv=require(_0x51fb('0x8'));var querystring=require(_0x51fb('0xf'));var Papa=require(_0x51fb('0x10'));var Redis=require(_0x51fb('0x11'));var authService=require(_0x51fb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x51fb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x51fb('0x14'))(_0x51fb('0x15'));var utils=require(_0x51fb('0x16'));var config=require(_0x51fb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x51fb('0x18'))['db'];function respondWithStatusCode(_0x1b233c,_0x50594b){_0x50594b=_0x50594b||0xcc;return function(_0x525776){if(_0x525776){return _0x1b233c[_0x51fb('0x19')](_0x50594b);}return _0x1b233c[_0x51fb('0x1a')](_0x50594b)['end']();};}function respondWithResult(_0x3f010a,_0x5c2701){_0x5c2701=_0x5c2701||0xc8;return function(_0x5e4982){if(_0x5e4982){return _0x3f010a[_0x51fb('0x1a')](_0x5c2701)['json'](_0x5e4982);}};}function respondWithFilteredResult(_0x552e01,_0x35675b){return function(_0xf7e48f){if(_0xf7e48f){var _0x14d8f7=typeof _0x35675b[_0x51fb('0x1b')]==='undefined'&&typeof _0x35675b[_0x51fb('0x1c')]===_0x51fb('0x1d');var _0x4daa6e=_0xf7e48f[_0x51fb('0x1e')];var _0x45a3e8=_0x14d8f7?0x0:_0x35675b[_0x51fb('0x1b')];var _0x36bb49=_0x14d8f7?_0xf7e48f[_0x51fb('0x1e')]:_0x35675b[_0x51fb('0x1b')]+_0x35675b[_0x51fb('0x1c')];var _0x57813c;if(_0x36bb49>=_0x4daa6e){_0x36bb49=_0x4daa6e;_0x57813c=0xc8;}else{_0x57813c=0xce;}_0x552e01[_0x51fb('0x1a')](_0x57813c);return _0x552e01[_0x51fb('0x1f')](_0x51fb('0x20'),_0x45a3e8+'-'+_0x36bb49+'/'+_0x4daa6e)['json'](_0xf7e48f);}return null;};}function patchUpdates(_0x51fc8a){return function(_0x3dfe6f){try{jsonpatch['apply'](_0x3dfe6f,_0x51fc8a,!![]);}catch(_0x33bb3c){return BPromise[_0x51fb('0x21')](_0x33bb3c);}return _0x3dfe6f['save']();};}function saveUpdates(_0x5abeb3,_0x1601b3){return function(_0x3c85b6){if(_0x3c85b6){return _0x3c85b6[_0x51fb('0x22')](_0x5abeb3)[_0x51fb('0x23')](function(_0x147989){return _0x147989;});}return null;};}function removeEntity(_0x4d52e1,_0x5c4ea3){return function(_0x3a7c33){if(_0x3a7c33){return _0x3a7c33[_0x51fb('0x24')]()[_0x51fb('0x23')](function(){var _0x5aebd6=_0x3a7c33[_0x51fb('0x25')]({'plain':!![]});var _0x126387=_0x51fb('0x26');return db[_0x51fb('0x27')][_0x51fb('0x24')]({'where':{'type':_0x126387,'resourceId':_0x5aebd6['id']}})['then'](function(){return _0x3a7c33;});})['then'](function(){_0x4d52e1['status'](0xcc)[_0x51fb('0x28')]();});}};}function handleEntityNotFound(_0x4f4967,_0x3e22b9){return function(_0x2a42e9){if(!_0x2a42e9){_0x4f4967[_0x51fb('0x19')](0x194);}return _0x2a42e9;};}function handleError(_0x59920e,_0x126188){_0x126188=_0x126188||0x1f4;return function(_0x505094){logger['error'](_0x505094[_0x51fb('0x29')]);if(_0x505094[_0x51fb('0x2a')]){delete _0x505094['name'];}_0x59920e[_0x51fb('0x1a')](_0x126188)[_0x51fb('0x2b')](_0x505094);};}exports[_0x51fb('0x2c')]=function(_0x5363a3,_0xecafc){var _0x3e7bfc={},_0x54c40a={},_0x3eb402={'count':0x0,'rows':[]};var _0x3feadc=_['map'](db['Pause'][_0x51fb('0x2d')],function(_0x376e76){return{'name':_0x376e76[_0x51fb('0x2e')],'type':_0x376e76[_0x51fb('0x2f')]['key']};});_0x54c40a[_0x51fb('0x30')]=_[_0x51fb('0x31')](_0x3feadc,_0x51fb('0x2a'));_0x54c40a[_0x51fb('0x32')]=_[_0x51fb('0x33')](_0x5363a3[_0x51fb('0x32')]);_0x54c40a[_0x51fb('0x34')]=_['intersection'](_0x54c40a['model'],_0x54c40a['query']);_0x3e7bfc[_0x51fb('0x35')]=_[_0x51fb('0x36')](_0x54c40a['model'],qs['fields'](_0x5363a3[_0x51fb('0x32')]['fields']));_0x3e7bfc['attributes']=_0x3e7bfc['attributes']['length']?_0x3e7bfc[_0x51fb('0x35')]:_0x54c40a[_0x51fb('0x30')];if(!_0x5363a3['query'][_0x51fb('0x37')](_0x51fb('0x38'))){_0x3e7bfc[_0x51fb('0x1c')]=qs['limit'](_0x5363a3[_0x51fb('0x32')][_0x51fb('0x1c')]);_0x3e7bfc[_0x51fb('0x1b')]=qs[_0x51fb('0x1b')](_0x5363a3[_0x51fb('0x32')][_0x51fb('0x1b')]);}_0x3e7bfc[_0x51fb('0x39')]=qs[_0x51fb('0x3a')](_0x5363a3[_0x51fb('0x32')][_0x51fb('0x3a')]);_0x3e7bfc[_0x51fb('0x3b')]=qs['filters'](_[_0x51fb('0x3c')](_0x5363a3['query'],_0x54c40a['filters']),_0x3feadc);if(_0x5363a3[_0x51fb('0x32')]['filter']){_0x3e7bfc[_0x51fb('0x3b')]=_[_0x51fb('0x3d')](_0x3e7bfc[_0x51fb('0x3b')],{'$or':_['map'](_0x3feadc,function(_0x27b540){if(_0x27b540[_0x51fb('0x2f')]!=='VIRTUAL'){var _0x18a79f={};_0x18a79f[_0x27b540[_0x51fb('0x2a')]]={'$like':'%'+_0x5363a3[_0x51fb('0x32')]['filter']+'%'};return _0x18a79f;}})});}_0x3e7bfc=_[_0x51fb('0x3d')]({},_0x3e7bfc,_0x5363a3['options']);var _0x2233ff={'where':_0x3e7bfc['where']};return db[_0x51fb('0x3e')][_0x51fb('0x1e')](_0x2233ff)[_0x51fb('0x23')](function(_0x4f01dc){_0x3eb402[_0x51fb('0x1e')]=_0x4f01dc;if(_0x5363a3[_0x51fb('0x32')][_0x51fb('0x3f')]){_0x3e7bfc[_0x51fb('0x40')]=[{'all':!![]}];}return db[_0x51fb('0x3e')]['findAll'](_0x3e7bfc);})['then'](function(_0x2a389c){_0x3eb402[_0x51fb('0x41')]=_0x2a389c;return _0x3eb402;})[_0x51fb('0x23')](respondWithFilteredResult(_0xecafc,_0x3e7bfc))[_0x51fb('0x42')](handleError(_0xecafc,null));};exports[_0x51fb('0x43')]=function(_0x15ec35,_0x3e5674){var _0x27f4d0={'raw':!![],'where':{'id':_0x15ec35['params']['id']}},_0x3f4309={};_0x3f4309['model']=_['keys'](db[_0x51fb('0x3e')]['rawAttributes']);_0x3f4309[_0x51fb('0x32')]=_[_0x51fb('0x33')](_0x15ec35[_0x51fb('0x32')]);_0x3f4309[_0x51fb('0x34')]=_[_0x51fb('0x36')](_0x3f4309[_0x51fb('0x30')],_0x3f4309[_0x51fb('0x32')]);_0x27f4d0[_0x51fb('0x35')]=_[_0x51fb('0x36')](_0x3f4309[_0x51fb('0x30')],qs['fields'](_0x15ec35['query'][_0x51fb('0x44')]));_0x27f4d0[_0x51fb('0x35')]=_0x27f4d0[_0x51fb('0x35')][_0x51fb('0x45')]?_0x27f4d0[_0x51fb('0x35')]:_0x3f4309[_0x51fb('0x30')];if(_0x15ec35[_0x51fb('0x32')][_0x51fb('0x3f')]){_0x27f4d0[_0x51fb('0x40')]=[{'all':!![]}];}_0x27f4d0=_[_0x51fb('0x3d')]({},_0x27f4d0,_0x15ec35[_0x51fb('0x46')]);return db[_0x51fb('0x3e')]['find'](_0x27f4d0)['then'](handleEntityNotFound(_0x3e5674,null))[_0x51fb('0x23')](respondWithResult(_0x3e5674,null))['catch'](handleError(_0x3e5674,null));};exports['create']=function(_0x1672a6,_0x5a92a3){return db[_0x51fb('0x3e')][_0x51fb('0x47')](_0x1672a6[_0x51fb('0x48')],{})[_0x51fb('0x23')](function(_0x139061){var _0x36d093=_0x1672a6['user'][_0x51fb('0x25')]({'plain':!![]});if(!_0x36d093)throw new Error(_0x51fb('0x49'));if(_0x36d093[_0x51fb('0x4a')]===_0x51fb('0x4b')){var _0x1fc943=_0x139061[_0x51fb('0x25')]({'plain':!![]});var _0x53352d=_0x51fb('0x26');return db[_0x51fb('0x4c')][_0x51fb('0x4d')]({'where':{'name':_0x53352d,'userProfileId':_0x36d093[_0x51fb('0x4e')]},'raw':!![]})[_0x51fb('0x23')](function(_0x171951){if(_0x171951&&_0x171951[_0x51fb('0x4f')]===0x0){return db['UserProfileResource'][_0x51fb('0x47')]({'name':_0x1fc943[_0x51fb('0x2a')],'resourceId':_0x1fc943['id'],'type':_0x171951['name'],'sectionId':_0x171951['id']},{})['then'](function(){return _0x139061;});}else{return _0x139061;}})[_0x51fb('0x42')](function(_0x1f709c){logger[_0x51fb('0x50')](_0x51fb('0x51'),_0x1f709c);throw _0x1f709c;});}return _0x139061;})[_0x51fb('0x23')](respondWithResult(_0x5a92a3,0xc9))[_0x51fb('0x42')](handleError(_0x5a92a3,null));};exports[_0x51fb('0x22')]=function(_0x138a98,_0x574539){if(_0x138a98[_0x51fb('0x48')]['id']){delete _0x138a98['body']['id'];}return db['Pause'][_0x51fb('0x4d')]({'where':{'id':_0x138a98[_0x51fb('0x52')]['id']}})[_0x51fb('0x23')](handleEntityNotFound(_0x574539,null))[_0x51fb('0x23')](saveUpdates(_0x138a98['body'],null))[_0x51fb('0x23')](respondWithResult(_0x574539,null))[_0x51fb('0x42')](handleError(_0x574539,null));};exports['destroy']=function(_0x3efa33,_0x5e39b6){return db[_0x51fb('0x3e')][_0x51fb('0x4d')]({'where':{'id':_0x3efa33['params']['id']}})[_0x51fb('0x23')](handleEntityNotFound(_0x5e39b6,null))['then'](removeEntity(_0x5e39b6,null))[_0x51fb('0x42')](handleError(_0x5e39b6,null));}; \ No newline at end of file +var _0x5eff=['where','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','order','sort'];(function(_0x4ac48d,_0x171a68){var _0x7537af=function(_0x1c6ca6){while(--_0x1c6ca6){_0x4ac48d['push'](_0x4ac48d['shift']());}};_0x7537af(++_0x171a68);}(_0x5eff,0x160));var _0xf5ef=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x5eff[_0x4d613c];return _0x301fe3;};'use strict';var emlformat=require(_0xf5ef('0x0'));var rimraf=require(_0xf5ef('0x1'));var zipdir=require(_0xf5ef('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf5ef('0x3'));var BPromise=require(_0xf5ef('0x4'));var Mustache=require(_0xf5ef('0x5'));var util=require('util');var path=require(_0xf5ef('0x6'));var sox=require(_0xf5ef('0x7'));var csv=require(_0xf5ef('0x8'));var ejs=require(_0xf5ef('0x9'));var fs=require('fs');var fs_extra=require(_0xf5ef('0xa'));var _=require(_0xf5ef('0xb'));var squel=require(_0xf5ef('0xc'));var crypto=require(_0xf5ef('0xd'));var jsforce=require(_0xf5ef('0xe'));var deskjs=require(_0xf5ef('0xf'));var toCsv=require(_0xf5ef('0x8'));var querystring=require(_0xf5ef('0x10'));var Papa=require(_0xf5ef('0x11'));var Redis=require('ioredis');var authService=require(_0xf5ef('0x12'));var qs=require(_0xf5ef('0x13'));var as=require(_0xf5ef('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5ef('0x15'))(_0xf5ef('0x16'));var utils=require(_0xf5ef('0x17'));var config=require(_0xf5ef('0x18'));var licenseUtil=require(_0xf5ef('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x530264,_0x26ab96){_0x26ab96=_0x26ab96||0xcc;return function(_0x27a396){if(_0x27a396){return _0x530264[_0xf5ef('0x1a')](_0x26ab96);}return _0x530264[_0xf5ef('0x1b')](_0x26ab96)[_0xf5ef('0x1c')]();};}function respondWithResult(_0x16861a,_0x5eb4cf){_0x5eb4cf=_0x5eb4cf||0xc8;return function(_0x5adc1b){if(_0x5adc1b){return _0x16861a[_0xf5ef('0x1b')](_0x5eb4cf)[_0xf5ef('0x1d')](_0x5adc1b);}};}function respondWithFilteredResult(_0x2200c7,_0x4ba9fa){return function(_0x567ef3){if(_0x567ef3){var _0x2eaedb=typeof _0x4ba9fa[_0xf5ef('0x1e')]===_0xf5ef('0x1f')&&typeof _0x4ba9fa[_0xf5ef('0x20')]===_0xf5ef('0x1f');var _0xa5ed3f=_0x567ef3['count'];var _0x52b939=_0x2eaedb?0x0:_0x4ba9fa[_0xf5ef('0x1e')];var _0x178b07=_0x2eaedb?_0x567ef3[_0xf5ef('0x21')]:_0x4ba9fa[_0xf5ef('0x1e')]+_0x4ba9fa[_0xf5ef('0x20')];var _0x2f3de8;if(_0x178b07>=_0xa5ed3f){_0x178b07=_0xa5ed3f;_0x2f3de8=0xc8;}else{_0x2f3de8=0xce;}_0x2200c7[_0xf5ef('0x1b')](_0x2f3de8);return _0x2200c7[_0xf5ef('0x22')](_0xf5ef('0x23'),_0x52b939+'-'+_0x178b07+'/'+_0xa5ed3f)[_0xf5ef('0x1d')](_0x567ef3);}return null;};}function patchUpdates(_0x2166f6){return function(_0x3cfa25){try{jsonpatch['apply'](_0x3cfa25,_0x2166f6,!![]);}catch(_0x12f6d4){return BPromise[_0xf5ef('0x24')](_0x12f6d4);}return _0x3cfa25[_0xf5ef('0x25')]();};}function saveUpdates(_0x45e4e4,_0x10b384){return function(_0x34592d){if(_0x34592d){return _0x34592d[_0xf5ef('0x26')](_0x45e4e4)[_0xf5ef('0x27')](function(_0x2b5a47){return _0x2b5a47;});}return null;};}function removeEntity(_0x2fc03a,_0x569f41){return function(_0x434075){if(_0x434075){return _0x434075[_0xf5ef('0x28')]()['then'](function(){var _0x1e89af=_0x434075['get']({'plain':!![]});var _0x5be3f7=_0xf5ef('0x29');return db[_0xf5ef('0x2a')]['destroy']({'where':{'type':_0x5be3f7,'resourceId':_0x1e89af['id']}})['then'](function(){return _0x434075;});})[_0xf5ef('0x27')](function(){_0x2fc03a['status'](0xcc)[_0xf5ef('0x1c')]();});}};}function handleEntityNotFound(_0x5354a4,_0x28200e){return function(_0x3a514a){if(!_0x3a514a){_0x5354a4['sendStatus'](0x194);}return _0x3a514a;};}function handleError(_0x5a5edd,_0x5082d7){_0x5082d7=_0x5082d7||0x1f4;return function(_0x3ac1d5){logger[_0xf5ef('0x2b')](_0x3ac1d5[_0xf5ef('0x2c')]);if(_0x3ac1d5[_0xf5ef('0x2d')]){delete _0x3ac1d5[_0xf5ef('0x2d')];}_0x5a5edd['status'](_0x5082d7)[_0xf5ef('0x2e')](_0x3ac1d5);};}exports[_0xf5ef('0x2f')]=function(_0x2bdfa9,_0xc0c700){var _0x48f135={},_0x2d32a5={},_0x3ae7d8={'count':0x0,'rows':[]};var _0x5e5136=_[_0xf5ef('0x30')](db[_0xf5ef('0x31')][_0xf5ef('0x32')],function(_0x5320b2){return{'name':_0x5320b2[_0xf5ef('0x33')],'type':_0x5320b2[_0xf5ef('0x34')][_0xf5ef('0x35')]};});_0x2d32a5['model']=_[_0xf5ef('0x30')](_0x5e5136,'name');_0x2d32a5[_0xf5ef('0x36')]=_['keys'](_0x2bdfa9[_0xf5ef('0x36')]);_0x2d32a5[_0xf5ef('0x37')]=_[_0xf5ef('0x38')](_0x2d32a5['model'],_0x2d32a5['query']);_0x48f135[_0xf5ef('0x39')]=_[_0xf5ef('0x38')](_0x2d32a5[_0xf5ef('0x3a')],qs[_0xf5ef('0x3b')](_0x2bdfa9[_0xf5ef('0x36')][_0xf5ef('0x3b')]));_0x48f135[_0xf5ef('0x39')]=_0x48f135['attributes'][_0xf5ef('0x3c')]?_0x48f135[_0xf5ef('0x39')]:_0x2d32a5['model'];if(!_0x2bdfa9['query']['hasOwnProperty']('nolimit')){_0x48f135['limit']=qs[_0xf5ef('0x20')](_0x2bdfa9[_0xf5ef('0x36')][_0xf5ef('0x20')]);_0x48f135[_0xf5ef('0x1e')]=qs[_0xf5ef('0x1e')](_0x2bdfa9[_0xf5ef('0x36')][_0xf5ef('0x1e')]);}_0x48f135[_0xf5ef('0x3d')]=qs[_0xf5ef('0x3e')](_0x2bdfa9[_0xf5ef('0x36')][_0xf5ef('0x3e')]);_0x48f135[_0xf5ef('0x3f')]=qs[_0xf5ef('0x37')](_[_0xf5ef('0x40')](_0x2bdfa9[_0xf5ef('0x36')],_0x2d32a5[_0xf5ef('0x37')]),_0x5e5136);if(_0x2bdfa9[_0xf5ef('0x36')][_0xf5ef('0x41')]){_0x48f135[_0xf5ef('0x3f')]=_['merge'](_0x48f135[_0xf5ef('0x3f')],{'$or':_[_0xf5ef('0x30')](_0x5e5136,function(_0x4412f3){if(_0x4412f3[_0xf5ef('0x34')]!==_0xf5ef('0x42')){var _0x295187={};_0x295187[_0x4412f3[_0xf5ef('0x2d')]]={'$like':'%'+_0x2bdfa9[_0xf5ef('0x36')][_0xf5ef('0x41')]+'%'};return _0x295187;}})});}_0x48f135=_[_0xf5ef('0x43')]({},_0x48f135,_0x2bdfa9[_0xf5ef('0x44')]);var _0x557224={'where':_0x48f135[_0xf5ef('0x3f')]};return db[_0xf5ef('0x31')][_0xf5ef('0x21')](_0x557224)['then'](function(_0x22972c){_0x3ae7d8[_0xf5ef('0x21')]=_0x22972c;if(_0x2bdfa9['query']['includeAll']){_0x48f135[_0xf5ef('0x45')]=[{'all':!![]}];}return db[_0xf5ef('0x31')]['findAll'](_0x48f135);})[_0xf5ef('0x27')](function(_0x835cfc){_0x3ae7d8[_0xf5ef('0x46')]=_0x835cfc;return _0x3ae7d8;})['then'](respondWithFilteredResult(_0xc0c700,_0x48f135))[_0xf5ef('0x47')](handleError(_0xc0c700,null));};exports[_0xf5ef('0x48')]=function(_0x3cb195,_0xf3d0e9){var _0x13ce32={'raw':!![],'where':{'id':_0x3cb195[_0xf5ef('0x49')]['id']}},_0x4ad9a2={};_0x4ad9a2[_0xf5ef('0x3a')]=_[_0xf5ef('0x4a')](db[_0xf5ef('0x31')][_0xf5ef('0x32')]);_0x4ad9a2[_0xf5ef('0x36')]=_['keys'](_0x3cb195[_0xf5ef('0x36')]);_0x4ad9a2[_0xf5ef('0x37')]=_[_0xf5ef('0x38')](_0x4ad9a2['model'],_0x4ad9a2[_0xf5ef('0x36')]);_0x13ce32['attributes']=_['intersection'](_0x4ad9a2['model'],qs[_0xf5ef('0x3b')](_0x3cb195[_0xf5ef('0x36')]['fields']));_0x13ce32['attributes']=_0x13ce32[_0xf5ef('0x39')]['length']?_0x13ce32[_0xf5ef('0x39')]:_0x4ad9a2[_0xf5ef('0x3a')];if(_0x3cb195[_0xf5ef('0x36')]['includeAll']){_0x13ce32[_0xf5ef('0x45')]=[{'all':!![]}];}_0x13ce32=_['merge']({},_0x13ce32,_0x3cb195[_0xf5ef('0x44')]);return db['Pause'][_0xf5ef('0x4b')](_0x13ce32)['then'](handleEntityNotFound(_0xf3d0e9,null))['then'](respondWithResult(_0xf3d0e9,null))[_0xf5ef('0x47')](handleError(_0xf3d0e9,null));};exports[_0xf5ef('0x4c')]=function(_0x2c2393,_0x28efdb){return db[_0xf5ef('0x31')]['create'](_0x2c2393[_0xf5ef('0x4d')],{})[_0xf5ef('0x27')](function(_0x5c4602){var _0x5e4a32=_0x2c2393[_0xf5ef('0x4e')][_0xf5ef('0x4f')]({'plain':!![]});if(!_0x5e4a32)throw new Error(_0xf5ef('0x50'));if(_0x5e4a32['role']===_0xf5ef('0x4e')){var _0x3f56e1=_0x5c4602['get']({'plain':!![]});var _0x219350='Pauses';return db['UserProfileSection'][_0xf5ef('0x4b')]({'where':{'name':_0x219350,'userProfileId':_0x5e4a32[_0xf5ef('0x51')]},'raw':!![]})[_0xf5ef('0x27')](function(_0x4ecfa0){if(_0x4ecfa0&&_0x4ecfa0[_0xf5ef('0x52')]===0x0){return db[_0xf5ef('0x2a')][_0xf5ef('0x4c')]({'name':_0x3f56e1['name'],'resourceId':_0x3f56e1['id'],'type':_0x4ecfa0[_0xf5ef('0x2d')],'sectionId':_0x4ecfa0['id']},{})['then'](function(){return _0x5c4602;});}else{return _0x5c4602;}})[_0xf5ef('0x47')](function(_0x3f7f7a){logger[_0xf5ef('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f7f7a);throw _0x3f7f7a;});}return _0x5c4602;})[_0xf5ef('0x27')](respondWithResult(_0x28efdb,0xc9))[_0xf5ef('0x47')](handleError(_0x28efdb,null));};exports[_0xf5ef('0x26')]=function(_0x3657e5,_0x26ce67){if(_0x3657e5['body']['id']){delete _0x3657e5[_0xf5ef('0x4d')]['id'];}return db['Pause'][_0xf5ef('0x4b')]({'where':{'id':_0x3657e5[_0xf5ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x26ce67,null))[_0xf5ef('0x27')](saveUpdates(_0x3657e5['body'],null))['then'](respondWithResult(_0x26ce67,null))[_0xf5ef('0x47')](handleError(_0x26ce67,null));};exports[_0xf5ef('0x28')]=function(_0x7a56de,_0x7118f5){return db[_0xf5ef('0x31')][_0xf5ef('0x4b')]({'where':{'id':_0x7a56de[_0xf5ef('0x49')]['id']}})[_0xf5ef('0x27')](handleEntityNotFound(_0x7118f5,null))[_0xf5ef('0x27')](removeEntity(_0x7118f5,null))[_0xf5ef('0x47')](handleError(_0x7118f5,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 2669d1e..1bf2ef1 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 _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x26d13f,_0xc069c6){var _0x24474e=function(_0x3cb94a){while(--_0x3cb94a){_0x26d13f['push'](_0x26d13f['shift']());}};_0x24474e(++_0xc069c6);}(_0x814b,0x1a2));var _0xb814=function(_0x2fdee1,_0x466858){_0x2fdee1=_0x2fdee1-0x0;var _0x2c5533=_0x814b[_0x2fdee1];return _0x2c5533;};'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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x3104ae,_0x2ba4bf){var _0x306c53=function(_0xef4612){while(--_0xef4612){_0x3104ae['push'](_0x3104ae['shift']());}};_0x306c53(++_0x2ba4bf);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5f2593,_0x2943d9){_0x5f2593=_0x5f2593-0x0;var _0x2fe505=_0x8ef6[_0x5f2593];return _0x2fe505;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'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 15e3424..99ca48b 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(_0x48e8f7,_0x4e42b4){var _0x2dadef=function(_0x12081b){while(--_0x12081b){_0x48e8f7['push'](_0x48e8f7['shift']());}};_0x2dadef(++_0x4e42b4);}(_0x7a54,0x106));var _0x47a5=function(_0x4932d0,_0x190373){_0x4932d0=_0x4932d0-0x0;var _0x396ab9=_0x7a54[_0x4932d0];return _0x396ab9;};'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(_0x26ec53,_0x26a758){var _0x571005=function(_0x103bcd){while(--_0x103bcd){_0x26ec53['push'](_0x26ec53['shift']());}};_0x571005(++_0x26a758);}(_0x7a54,0x106));var _0x47a5=function(_0x5b63b3,_0x1e77cd){_0x5b63b3=_0x5b63b3-0x0;var _0x5b5ff7=_0x7a54[_0x5b63b3];return _0x5b5ff7;};'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 94891f6..4b210a4 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 _0xcea2=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','get','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','server/files/plugins','originalname','replace','format','%s-%s%s','extname','post','single','file','upload','put','update','delete','multer','path'];(function(_0x380a7e,_0x1bbdc4){var _0x4ec06b=function(_0x2636a5){while(--_0x2636a5){_0x380a7e['push'](_0x380a7e['shift']());}};_0x4ec06b(++_0x1bbdc4);}(_0xcea2,0x15a));var _0x2cea=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xcea2[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x2cea('0x0'));var util=require('util');var path=require(_0x2cea('0x1'));var timeout=require('connect-timeout');var express=require(_0x2cea('0x2'));var router=express[_0x2cea('0x3')]();var fs_extra=require(_0x2cea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var controller=require(_0x2cea('0x7'));router['get']('/',auth[_0x2cea('0x8')](),controller['index']);router[_0x2cea('0x9')](_0x2cea('0xa'),controller[_0x2cea('0xb')]);router[_0x2cea('0x9')](_0x2cea('0xc'),auth[_0x2cea('0x8')](),controller['show']);router[_0x2cea('0x9')](_0x2cea('0xd'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xe')]);var upload=multer({'storage':multer[_0x2cea('0xf')]({'destination':function(_0x439c4d,_0x4298a4,_0x1c9142){_0x1c9142(null,path['join'](config['root'],_0x2cea('0x10')));},'filename':function(_0x2db0ff,_0x528c1d,_0x4bd265){_0x528c1d[_0x2cea('0x11')]=_0x528c1d['originalname'][_0x2cea('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bd265(null,util[_0x2cea('0x13')](_0x2cea('0x14'),path['basename'](_0x528c1d['originalname'],path['extname'](_0x528c1d[_0x2cea('0x11')])),Date['now'](),path[_0x2cea('0x15')](_0x528c1d[_0x2cea('0x11')])));}})});router[_0x2cea('0x16')]('/',upload[_0x2cea('0x17')](_0x2cea('0x18')),controller[_0x2cea('0x19')]);router[_0x2cea('0x16')](_0x2cea('0xa'),controller['webhookPost']);router[_0x2cea('0x1a')](_0x2cea('0xc'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x1b')]);router[_0x2cea('0x1c')](_0x2cea('0xc'),auth['isAuthenticated'](),controller[_0x2cea('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xc3b5=['server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','webhookPost','/:id','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/webhook','webhookGet','show','/:id/download','download','diskStorage','root'];(function(_0x5a2358,_0x16bfff){var _0x2be9f1=function(_0x953797){while(--_0x953797){_0x5a2358['push'](_0x5a2358['shift']());}};_0x2be9f1(++_0x16bfff);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x135a51,_0x1842de){_0x135a51=_0x135a51-0x0;var _0x5dce00=_0xc3b5[_0x135a51];return _0x5dce00;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c3b('0x0'));var timeout=require(_0x5c3b('0x1'));var express=require(_0x5c3b('0x2'));var router=express[_0x5c3b('0x3')]();var fs_extra=require(_0x5c3b('0x4'));var auth=require(_0x5c3b('0x5'));var interaction=require(_0x5c3b('0x6'));var config=require(_0x5c3b('0x7'));var controller=require('./plugin.controller');router[_0x5c3b('0x8')]('/',auth[_0x5c3b('0x9')](),controller['index']);router[_0x5c3b('0x8')](_0x5c3b('0xa'),controller[_0x5c3b('0xb')]);router[_0x5c3b('0x8')]('/:id',auth[_0x5c3b('0x9')](),controller[_0x5c3b('0xc')]);router[_0x5c3b('0x8')](_0x5c3b('0xd'),auth['isAuthenticated'](),controller[_0x5c3b('0xe')]);var upload=multer({'storage':multer[_0x5c3b('0xf')]({'destination':function(_0x30ceca,_0x2e894a,_0x363c3d){_0x363c3d(null,path['join'](config[_0x5c3b('0x10')],_0x5c3b('0x11')));},'filename':function(_0x589c36,_0x1b2815,_0x3b953d){_0x1b2815['originalname']=_0x1b2815[_0x5c3b('0x12')][_0x5c3b('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3b953d(null,util[_0x5c3b('0x14')](_0x5c3b('0x15'),path[_0x5c3b('0x16')](_0x1b2815[_0x5c3b('0x12')],path[_0x5c3b('0x17')](_0x1b2815['originalname'])),Date[_0x5c3b('0x18')](),path['extname'](_0x1b2815['originalname'])));}})});router[_0x5c3b('0x19')]('/',upload[_0x5c3b('0x1a')](_0x5c3b('0x1b')),controller['upload']);router[_0x5c3b('0x19')](_0x5c3b('0xa'),controller[_0x5c3b('0x1c')]);router['put'](_0x5c3b('0x1d'),auth[_0x5c3b('0x9')](),controller['update']);router[_0x5c3b('0x1e')](_0x5c3b('0x1d'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0x1e')]);module[_0x5c3b('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 4973811..95d95e9 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 _0xd877=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','STRING','html','TEXT'];(function(_0x8d8402,_0x4f3bc6){var _0xe93976=function(_0x48d24c){while(--_0x48d24c){_0x8d8402['push'](_0x8d8402['shift']());}};_0xe93976(++_0x4f3bc6);}(_0xd877,0xcf));var _0x7d87=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xd877[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7d87('0x0')]},'type':{'type':Sequelize['ENUM'](_0x7d87('0x1'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x7d87('0x2')]},'path':{'type':Sequelize[_0x7d87('0x0')],'comment':_0x7d87('0x3')},'active':{'type':Sequelize[_0x7d87('0x4')],'defaultValue':0x0,'comment':_0x7d87('0x5')},'sidebar':{'type':Sequelize['ENUM'](_0x7d87('0x6'),_0x7d87('0x7'),_0x7d87('0x8'),_0x7d87('0x9')),'defaultValue':_0x7d87('0x8'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x7d87('0x0')]},'adminUrl':{'type':Sequelize[_0x7d87('0x0')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x7d87('0x0')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0436=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script','TEXT'];(function(_0x59ddcb,_0x1add6f){var _0x348f84=function(_0x2fd3e6){while(--_0x2fd3e6){_0x59ddcb['push'](_0x59ddcb['shift']());}};_0x348f84(++_0x1add6f);}(_0x0436,0x96));var _0x6043=function(_0x21799b,_0x4694af){_0x21799b=_0x21799b-0x0;var _0x317530=_0x0436[_0x21799b];return _0x317530;};'use strict';var Sequelize=require(_0x6043('0x0'));module[_0x6043('0x1')]={'name':{'type':Sequelize[_0x6043('0x2')]},'type':{'type':Sequelize['ENUM'](_0x6043('0x3'),_0x6043('0x4'))},'description':{'type':Sequelize[_0x6043('0x5')]},'version':{'type':Sequelize[_0x6043('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x6043('0x6')},'active':{'type':Sequelize[_0x6043('0x7')],'defaultValue':0x0,'comment':_0x6043('0x8')},'sidebar':{'type':Sequelize[_0x6043('0x9')](_0x6043('0xa'),'agentOnly',_0x6043('0xb'),'never'),'defaultValue':_0x6043('0xb'),'comment':_0x6043('0xc')},'icon':{'type':Sequelize[_0x6043('0x2')]},'adminUrl':{'type':Sequelize[_0x6043('0x2')]},'agentUrl':{'type':Sequelize[_0x6043('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x6043('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 908c444..30c538f 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 _0x9659=['rows','catch','params','includeAll','include','find','download','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','agent','create','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','encoding','%s%s','headers','content-length','content-type','statusCode','body','webhookPost','resolve','hostname','method','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','Plugins','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','options','Plugin','findAll'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0x9659,0x112));var _0x9965=function(_0x167eaa,_0x2730a3){_0x167eaa=_0x167eaa-0x0;var _0x41d4ae=_0x9659[_0x167eaa];return _0x41d4ae;};'use strict';var emlformat=require(_0x9965('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9965('0x1'));var jsonpatch=require(_0x9965('0x2'));var rp=require('request-promise');var moment=require(_0x9965('0x3'));var BPromise=require(_0x9965('0x4'));var Mustache=require('mustache');var util=require(_0x9965('0x5'));var path=require(_0x9965('0x6'));var sox=require(_0x9965('0x7'));var csv=require(_0x9965('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9965('0x9'));var _=require('lodash');var squel=require(_0x9965('0xa'));var crypto=require(_0x9965('0xb'));var jsforce=require(_0x9965('0xc'));var deskjs=require(_0x9965('0xd'));var toCsv=require(_0x9965('0x8'));var querystring=require('querystring');var Papa=require(_0x9965('0xe'));var extract=require(_0x9965('0xf'));var rimraf=require(_0x9965('0x10'));var archiver=require(_0x9965('0x11'));var Redis=require(_0x9965('0x12'));var authService=require(_0x9965('0x13'));var qs=require(_0x9965('0x14'));var as=require(_0x9965('0x15'));var hardwareService=require(_0x9965('0x16'));var logger=require(_0x9965('0x17'))(_0x9965('0x18'));var utils=require('../../config/utils');var config=require(_0x9965('0x19'));var licenseUtil=require(_0x9965('0x1a'));var db=require(_0x9965('0x1b'))['db'];config[_0x9965('0x1c')]=_[_0x9965('0x1d')](config[_0x9965('0x1c')],{'host':_0x9965('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9965('0x1f'))['register'](socket);function respondWithStatusCode(_0xb4054d,_0x2ab4da){_0x2ab4da=_0x2ab4da||0xcc;return function(_0x27fd3a){if(_0x27fd3a){return _0xb4054d[_0x9965('0x20')](_0x2ab4da);}return _0xb4054d[_0x9965('0x21')](_0x2ab4da)[_0x9965('0x22')]();};}function respondWithResult(_0xb3c121,_0x8b1a93){_0x8b1a93=_0x8b1a93||0xc8;return function(_0x53e71c){if(_0x53e71c){return _0xb3c121[_0x9965('0x21')](_0x8b1a93)[_0x9965('0x23')](_0x53e71c);}};}function respondWithFilteredResult(_0x2182fa,_0x4014e3){return function(_0x324b15){if(_0x324b15){var _0x30b2ae=typeof _0x4014e3[_0x9965('0x24')]===_0x9965('0x25')&&typeof _0x4014e3['limit']===_0x9965('0x25');var _0x8f8b84=_0x324b15[_0x9965('0x26')];var _0x17d3a5=_0x30b2ae?0x0:_0x4014e3[_0x9965('0x24')];var _0x59752e=_0x30b2ae?_0x324b15[_0x9965('0x26')]:_0x4014e3[_0x9965('0x24')]+_0x4014e3[_0x9965('0x27')];var _0x119bae;if(_0x59752e>=_0x8f8b84){_0x59752e=_0x8f8b84;_0x119bae=0xc8;}else{_0x119bae=0xce;}_0x2182fa[_0x9965('0x21')](_0x119bae);return _0x2182fa[_0x9965('0x28')]('Content-Range',_0x17d3a5+'-'+_0x59752e+'/'+_0x8f8b84)[_0x9965('0x23')](_0x324b15);}return null;};}function patchUpdates(_0x324ff0){return function(_0x11110b){try{jsonpatch['apply'](_0x11110b,_0x324ff0,!![]);}catch(_0x242d3f){return BPromise[_0x9965('0x29')](_0x242d3f);}return _0x11110b[_0x9965('0x2a')]();};}function saveUpdates(_0x5ebf00,_0x3a169b){return function(_0x1ffc43){if(_0x1ffc43){return _0x1ffc43[_0x9965('0x2b')](_0x5ebf00)[_0x9965('0x2c')](function(_0x1be652){return _0x1be652;});}return null;};}function removeEntity(_0x477088,_0xc9817f){return function(_0x11f9ee){if(_0x11f9ee){return _0x11f9ee[_0x9965('0x2d')]()[_0x9965('0x2c')](function(){var _0x63b184=_0x11f9ee['get']({'plain':!![]});var _0x1bdf9d=_0x9965('0x2e');return db[_0x9965('0x2f')][_0x9965('0x2d')]({'where':{'type':_0x1bdf9d,'resourceId':_0x63b184['id']}})[_0x9965('0x2c')](function(){return _0x11f9ee;});})[_0x9965('0x2c')](function(){_0x477088[_0x9965('0x21')](0xcc)[_0x9965('0x22')]();});}};}function handleEntityNotFound(_0x343446,_0x51a140){return function(_0x4093bd){if(!_0x4093bd){_0x343446[_0x9965('0x20')](0x194);}return _0x4093bd;};}function handleError(_0x232466,_0x2722ca){_0x2722ca=_0x2722ca||0x1f4;return function(_0x318733){logger[_0x9965('0x30')](_0x318733[_0x9965('0x31')]);if(_0x318733[_0x9965('0x32')]){delete _0x318733[_0x9965('0x32')];}_0x232466[_0x9965('0x21')](_0x2722ca)[_0x9965('0x33')](_0x318733);};}exports[_0x9965('0x34')]=function(_0xf77b28,_0x519b83){var _0x5871a8={},_0x7edcee={},_0x41534e={'count':0x0,'rows':[]};var _0x5da294=_[_0x9965('0x35')](db['Plugin'][_0x9965('0x36')],function(_0x4109dd){return{'name':_0x4109dd[_0x9965('0x37')],'type':_0x4109dd[_0x9965('0x38')][_0x9965('0x39')]};});_0x7edcee['model']=_[_0x9965('0x35')](_0x5da294,_0x9965('0x32'));_0x7edcee[_0x9965('0x3a')]=_[_0x9965('0x3b')](_0xf77b28['query']);_0x7edcee['filters']=_[_0x9965('0x3c')](_0x7edcee[_0x9965('0x3d')],_0x7edcee[_0x9965('0x3a')]);_0x5871a8[_0x9965('0x3e')]=_[_0x9965('0x3c')](_0x7edcee['model'],qs[_0x9965('0x3f')](_0xf77b28[_0x9965('0x3a')]['fields']));_0x5871a8[_0x9965('0x3e')]=_0x5871a8[_0x9965('0x3e')][_0x9965('0x40')]?_0x5871a8['attributes']:_0x7edcee[_0x9965('0x3d')];if(!_0xf77b28[_0x9965('0x3a')][_0x9965('0x41')](_0x9965('0x42'))){_0x5871a8[_0x9965('0x27')]=qs[_0x9965('0x27')](_0xf77b28['query'][_0x9965('0x27')]);_0x5871a8[_0x9965('0x24')]=qs['offset'](_0xf77b28[_0x9965('0x3a')][_0x9965('0x24')]);}_0x5871a8['order']=qs[_0x9965('0x43')](_0xf77b28['query'][_0x9965('0x43')]);_0x5871a8['where']=qs['filters'](_[_0x9965('0x44')](_0xf77b28[_0x9965('0x3a')],_0x7edcee[_0x9965('0x45')]),_0x5da294);if(_0xf77b28[_0x9965('0x3a')][_0x9965('0x46')]){_0x5871a8[_0x9965('0x47')]=_[_0x9965('0x48')](_0x5871a8[_0x9965('0x47')],{'$or':_[_0x9965('0x35')](_0x5da294,function(_0x36e697){if(_0x36e697[_0x9965('0x38')]!=='VIRTUAL'){var _0xac9d88={};_0xac9d88[_0x36e697[_0x9965('0x32')]]={'$like':'%'+_0xf77b28[_0x9965('0x3a')]['filter']+'%'};return _0xac9d88;}})});}_0x5871a8=_[_0x9965('0x48')]({},_0x5871a8,_0xf77b28[_0x9965('0x49')]);var _0x53714c={'where':_0x5871a8[_0x9965('0x47')]};return db[_0x9965('0x4a')][_0x9965('0x26')](_0x53714c)[_0x9965('0x2c')](function(_0x4b8a40){_0x41534e[_0x9965('0x26')]=_0x4b8a40;if(_0xf77b28[_0x9965('0x3a')]['includeAll']){_0x5871a8['include']=[{'all':!![]}];}return db[_0x9965('0x4a')][_0x9965('0x4b')](_0x5871a8);})['then'](function(_0x50ce62){_0x41534e[_0x9965('0x4c')]=_0x50ce62;return _0x41534e;})[_0x9965('0x2c')](respondWithFilteredResult(_0x519b83,_0x5871a8))[_0x9965('0x4d')](handleError(_0x519b83,null));};exports['show']=function(_0xabf1e9,_0x1834e7){var _0x367064={'raw':!![],'where':{'id':_0xabf1e9[_0x9965('0x4e')]['id']}},_0x5d9e85={};_0x5d9e85[_0x9965('0x3d')]=_[_0x9965('0x3b')](db[_0x9965('0x4a')][_0x9965('0x36')]);_0x5d9e85['query']=_[_0x9965('0x3b')](_0xabf1e9['query']);_0x5d9e85[_0x9965('0x45')]=_[_0x9965('0x3c')](_0x5d9e85[_0x9965('0x3d')],_0x5d9e85[_0x9965('0x3a')]);_0x367064[_0x9965('0x3e')]=_[_0x9965('0x3c')](_0x5d9e85[_0x9965('0x3d')],qs[_0x9965('0x3f')](_0xabf1e9[_0x9965('0x3a')]['fields']));_0x367064['attributes']=_0x367064[_0x9965('0x3e')][_0x9965('0x40')]?_0x367064[_0x9965('0x3e')]:_0x5d9e85[_0x9965('0x3d')];if(_0xabf1e9[_0x9965('0x3a')][_0x9965('0x4f')]){_0x367064[_0x9965('0x50')]=[{'all':!![]}];}_0x367064=_[_0x9965('0x48')]({},_0x367064,_0xabf1e9[_0x9965('0x49')]);return db[_0x9965('0x4a')][_0x9965('0x51')](_0x367064)[_0x9965('0x2c')](handleEntityNotFound(_0x1834e7,null))['then'](respondWithResult(_0x1834e7,null))[_0x9965('0x4d')](handleError(_0x1834e7,null));};exports[_0x9965('0x52')]=function(_0x1f1c6d,_0x2c5029,_0x177023){return db[_0x9965('0x4a')][_0x9965('0x51')]({'where':{'id':_0x1f1c6d[_0x9965('0x4e')]['id']},'attributes':[_0x9965('0x32'),_0x9965('0x6')],'raw':!![]})[_0x9965('0x2c')](handleEntityNotFound(_0x2c5029,null))[_0x9965('0x2c')](function(_0x2d18d7){if(_0x2d18d7){var _0x558201=path['join'](config[_0x9965('0x53')],_0x9965('0x54'),util[_0x9965('0x55')](_0x9965('0x56'),path['basename'](_0x2d18d7[_0x9965('0x6')])));var _0x26909b=fs[_0x9965('0x57')](_0x558201);var _0x79488f=archiver(_0x9965('0x58'),{'zlib':{'level':0x9}});_0x79488f['on'](_0x9965('0x59'),function(_0x5e702e){if(_0x5e702e[_0x9965('0x5a')]===_0x9965('0x5b')){logger[_0x9965('0x30')](_0x5e702e);}else{throw new db[(_0x9965('0x5c'))][(_0x9965('0x5d'))](_0x9965('0x5e'));}});_0x79488f['on']('error',function(_0x2bf7f2){throw new db[(_0x9965('0x5c'))][(_0x9965('0x5d'))](_0x9965('0x5e'));});_0x79488f[_0x9965('0x5f')](_0x26909b);_0x79488f[_0x9965('0x60')](_0x9965('0x61'),{'cwd':path[_0x9965('0x62')](config[_0x9965('0x53')],_0x9965('0x54'),path[_0x9965('0x63')](_0x2d18d7[_0x9965('0x6')])),'ignore':[path[_0x9965('0x62')](path[_0x9965('0x64')](_0x2d18d7[_0x9965('0x6')]),_0x9965('0x65')),path[_0x9965('0x62')](path['basename'](_0x2d18d7[_0x9965('0x6')]),_0x9965('0x66'))],'nodir':!![]})[_0x9965('0x67')]();_0x26909b['on'](_0x9965('0x68'),function(){if(!fs[_0x9965('0x69')](_0x558201)){throw new db['Sequelize'][(_0x9965('0x5d'))](_0x9965('0x6a'));}return _0x2c5029[_0x9965('0x52')](_0x558201,util[_0x9965('0x55')](_0x9965('0x56'),path[_0x9965('0x64')](_0x2d18d7[_0x9965('0x6')])),function(_0x331c54){if(_0x331c54){throw new db['Sequelize']['Error'](_0x9965('0x6b'));}fs['unlinkSync'](_0x558201);logger[_0x9965('0x6c')](_0x9965('0x6d'));logger[_0x9965('0x6c')]('Temporary\x20file\x20removed');});});}return null;})[_0x9965('0x4d')](handleError(_0x2c5029,null));};exports['upload']=function(_0x3ed994,_0x611dbc,_0x138b35){var _0x45f851=path[_0x9965('0x64')](_0x3ed994[_0x9965('0x6e')]['filename'],path[_0x9965('0x6f')](_0x3ed994[_0x9965('0x6e')][_0x9965('0x70')]));var _0x23195c=path[_0x9965('0x62')](config[_0x9965('0x53')],_0x9965('0x54'),_0x3ed994[_0x9965('0x6e')][_0x9965('0x70')]);var _0x5c506d=path['join'](config[_0x9965('0x53')],_0x9965('0x54'),_0x45f851);logger[_0x9965('0x6c')](_0x9965('0x71'),_0x23195c);logger[_0x9965('0x6c')](_0x9965('0x72'),_0x5c506d);try{fs['chmodSync'](_0x23195c,parseInt(_0x9965('0x73'),0x8));extract(_0x23195c,{'dir':_0x5c506d},function(_0x417da1){if(_0x417da1){logger[_0x9965('0x30')](_0x417da1);handleError(_0x417da1,!![]);};var _0x397dab=fs[_0x9965('0x74')](_0x5c506d);if(_0x397dab[_0x9965('0x40')]>0x1){removeReferences(_0x23195c,_0x5c506d);logger[_0x9965('0x30')](_0x9965('0x75'));return _0x138b35(new Error(_0x9965('0x75')));}var _0x404460=fs['lstatSync'](path['join'](_0x5c506d,_0x397dab[0x0]));if(_0x404460[_0x9965('0x76')]()){removeReferences(_0x23195c,_0x5c506d);logger['error'](_0x9965('0x75'));return _0x138b35(new Error('Invalid\x20plugin\x20structure'));}if(_0x404460[_0x9965('0x77')]()){var _0xe48cfb=fs['readdirSync'](path['join'](_0x5c506d,_0x397dab[0x0]));if(_0xe48cfb[_0x9965('0x40')]===0x0){removeReferences(_0x23195c,_0x5c506d);logger['error'](_0x9965('0x75'));return _0x138b35(new Error('Invalid\x20plugin\x20structure'));}var _0x40b210=_0xe48cfb[_0x9965('0x78')](function(_0x4f269c){return _0x4f269c===_0x9965('0x79');});if(!_0x40b210){return _0x138b35(new Error(_0x9965('0x7a')));}var _0x1bcc62=fs[_0x9965('0x7b')](path['join'](_0x5c506d,_0x397dab[0x0],_0x9965('0x79')));var _0x3015ed=JSON[_0x9965('0x7c')](_0x1bcc62);if('undefined'==typeof _0x3015ed['name']){return _0x138b35(new Error(_0x9965('0x7d')));}if(_0x9965('0x25')==typeof _0x3015ed[_0x9965('0x38')]){return _0x138b35(new Error(_0x9965('0x7e')));}if(_0x9965('0x25')==typeof _0x3015ed[_0x9965('0x7f')]){return _0x138b35(new Error(_0x9965('0x80')));}if(_0x9965('0x25')==typeof _0x3015ed[_0x9965('0x81')]){return _0x138b35(new Error(_0x9965('0x82')));}if(_0x3015ed[_0x9965('0x38')]===_0x9965('0x83')){if('undefined'==typeof _0x3015ed['parameters'][_0x9965('0x84')]){return _0x138b35(new Error(_0x9965('0x85')));}if(_0x9965('0x25')==typeof _0x3015ed['parameters'][_0x9965('0x84')][_0x9965('0x86')]&&_0x9965('0x25')==typeof _0x3015ed[_0x9965('0x81')][_0x9965('0x84')]['agent']){return _0x138b35(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x3015ed['type']===_0x9965('0x87')){if(_0x9965('0x25')==typeof _0x3015ed['parameters'][_0x9965('0x88')]){return _0x138b35(new Error(_0x9965('0x89')));}if(_0x9965('0x25')==typeof _0x3015ed[_0x9965('0x81')][_0x9965('0x8a')]){return _0x138b35(new Error(_0x9965('0x8b')));}}else{return _0x138b35(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x336275=_0x3015ed[_0x9965('0x32')];var _0x157899=_0x3015ed[_0x9965('0x8c')];var _0x355f6e=_0x3015ed[_0x9965('0x38')];var _0x2b8e2f=_0x3015ed[_0x9965('0x8d')]?_0x3015ed[_0x9965('0x8d')]:_0x9965('0x8e');var _0x19e4a8=_0x3015ed[_0x9965('0x8f')]?_0x3015ed[_0x9965('0x8f')]:'icon-apps';var _0x4938ea='';var _0x28eb0b='';var _0xa905f3='';var _0x618159='';var _0x520044=_0x3015ed[_0x9965('0x7f')];if(_0x355f6e===_0x9965('0x83')){if('undefined'!=typeof _0x3015ed[_0x9965('0x81')]['views'][_0x9965('0x86')]){var _0xa766e4=_0x3015ed[_0x9965('0x81')][_0x9965('0x84')][_0x9965('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x9965('0x90')](_0xa766e4)){_0x4938ea=path[_0x9965('0x62')]('plugins',_0x45f851,_0x397dab[0x0],_0xa766e4);}else{_0x4938ea=_0xa766e4;}}else{logger[_0x9965('0x6c')](_0x9965('0x91'));}if(_0x9965('0x25')!=typeof _0x3015ed[_0x9965('0x81')][_0x9965('0x84')]['agent']){var _0x30cdd7=_0x3015ed[_0x9965('0x81')][_0x9965('0x84')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9965('0x90')](_0x30cdd7)){_0x28eb0b=path['join'](_0x9965('0x92'),_0x45f851,_0x397dab[0x0],_0x30cdd7);}else{_0x28eb0b=_0x30cdd7;}}else{logger['info'](_0x9965('0x93'));}}else if(_0x355f6e===_0x9965('0x87')){_0xa905f3=_0x3015ed[_0x9965('0x81')][_0x9965('0x88')];_0x618159=_0x3015ed['parameters'][_0x9965('0x8a')];if(_0x9965('0x25')!=typeof _0x3015ed['parameters'][_0x9965('0x84')]){if('undefined'!=typeof _0x3015ed['parameters']['views'][_0x9965('0x86')]){var _0xa766e4=_0x3015ed['parameters'][_0x9965('0x84')][_0x9965('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x9965('0x90')](_0xa766e4)){_0x4938ea=path[_0x9965('0x62')](_0x9965('0x92'),_0x45f851,_0x397dab[0x0],_0xa766e4);}else{_0x4938ea=_0xa766e4;}}if(_0x9965('0x25')!=typeof _0x3015ed[_0x9965('0x81')][_0x9965('0x84')]['agent']){var _0x30cdd7=_0x3015ed['parameters'][_0x9965('0x84')][_0x9965('0x94')];if(!/^(f|ht)tps?:\/\//i['test'](_0x30cdd7)){_0x28eb0b=path[_0x9965('0x62')](_0x9965('0x92'),_0x45f851,_0x397dab[0x0],_0x30cdd7);}else{_0x28eb0b=_0x30cdd7;}}}}var _0x79321c={'name':_0x336275,'description':_0x157899,'path':path['join'](_0x45f851,_0x397dab[0x0]),'type':_0x355f6e,'sidebar':_0x2b8e2f,'icon':_0x19e4a8,'adminUrl':_0x4938ea,'agentUrl':_0x28eb0b,'scriptName':_0xa905f3,'scriptPath':_0x618159,'version':_0x520044};removeReferences(_0x23195c,null);return db[_0x9965('0x4a')][_0x9965('0x95')](_0x79321c)[_0x9965('0x2c')](function(_0x3e9e4c){var _0x4d4b4d={'role':_0x3ed994['body'][_0x9965('0x96')],'userProfileId':_0x3ed994['body']['userProfileId']};if(!_0x4d4b4d)throw new Error(_0x9965('0x97'));if(_0x4d4b4d['role']==='user'){var _0x25ff99=_0x3e9e4c[_0x9965('0x98')]({'plain':!![]});return db['UserProfileSection'][_0x9965('0x51')]({'where':{'name':'Plugins','userProfileId':_0x4d4b4d[_0x9965('0x99')]},'raw':!![]})[_0x9965('0x2c')](function(_0x5122c5){if(_0x5122c5&&_0x5122c5[_0x9965('0x9a')]===0x0){return db['UserProfileResource']['create']({'name':_0x25ff99[_0x9965('0x32')],'resourceId':_0x25ff99['id'],'type':_0x5122c5[_0x9965('0x32')],'sectionId':_0x5122c5['id']},{})[_0x9965('0x2c')](function(){return _0x3e9e4c;});}else{return _0x3e9e4c;}})[_0x9965('0x4d')](function(_0x1dc10b){logger['error'](_0x9965('0x9b'),_0x1dc10b);throw _0x1dc10b;});}return _0x3e9e4c;})[_0x9965('0x2c')](respondWithResult(_0x611dbc,null))[_0x9965('0x4d')](handleError(_0x611dbc,null));}});}catch(_0x27534c){_0x611dbc[_0x9965('0x21')](0x1f4)[_0x9965('0x33')](_0x27534c);}};function removeReferences(_0x495457,_0x5d8fdb){try{if(_0x495457){fs[_0x9965('0x9c')](_0x495457);logger['info'](_0x9965('0x9d'));}if(_0x5d8fdb){rimraf(_0x5d8fdb,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x47ab22){logger[_0x9965('0x30')](_0x47ab22);}}exports[_0x9965('0x2b')]=function(_0x4317e4,_0x72d6ec,_0x355465){return db[_0x9965('0x4a')][_0x9965('0x51')]({'where':{'id':_0x4317e4[_0x9965('0x4e')]['id']}})[_0x9965('0x2c')](handleEntityNotFound(_0x72d6ec,null))[_0x9965('0x2c')](saveUpdates(_0x4317e4['body'],null))[_0x9965('0x2c')](respondWithResult(_0x72d6ec,null))['catch'](handleError(_0x72d6ec,null));};exports[_0x9965('0x9e')]=function(_0x2480e7,_0x4ce636,_0x5102d3){return db['Plugin']['find']({'where':{'id':_0x2480e7[_0x9965('0x4e')]['id']}})[_0x9965('0x2c')](function(_0x4c8012){if(_0x4c8012){return _0x4c8012[_0x9965('0x2d')]();}})[_0x9965('0x2c')](function(_0x3453ec){rimraf(path[_0x9965('0x62')](config[_0x9965('0x53')],_0x9965('0x54'),path[_0x9965('0x63')](_0x3453ec[_0x9965('0x6')])),function(){});return _0x3453ec;})[_0x9965('0x2c')](handleEntityNotFound(_0x4ce636,null))['then'](respondWithStatusCode(_0x4ce636,null))[_0x9965('0x4d')](handleError(_0x4ce636,null));};exports[_0x9965('0x9f')]=function(_0xcaffbc,_0x4b5f97,_0x4acff2){return BPromise['resolve']()[_0x9965('0x2c')](function(){if(!_0xcaffbc[_0x9965('0x3a')][_0x9965('0x6')]){throw new Error(_0x9965('0xa0'));}if(!_0xcaffbc[_0x9965('0x3a')][_0x9965('0xa1')]){throw new Error(_0x9965('0xa2'));}var _0x4672d6=_0xcaffbc[_0x9965('0x3a')]['hostname']?_0xcaffbc['query']['hostname']+':'+_0xcaffbc[_0x9965('0x3a')][_0x9965('0xa1')]:_0x9965('0xa3')+_0xcaffbc[_0x9965('0x3a')]['port'];var _0x363970=_0xcaffbc['query'][_0x9965('0x23')]?_0xcaffbc[_0x9965('0x3a')][_0x9965('0x23')]:!![];var _0x33ec47=_0xcaffbc[_0x9965('0x3a')]['encoding']?_0xcaffbc[_0x9965('0x3a')][_0x9965('0xa4')]:null;var _0xf262b5={'method':_0xcaffbc['method'],'uri':util['format'](_0x9965('0xa5'),_0x4672d6,_0xcaffbc['query'][_0x9965('0x6')]),'json':_0x363970,'resolveWithFullResponse':!![],'encoding':_0x33ec47,'qs':_0xcaffbc['query']};if(_0xcaffbc['headers']){_0xf262b5[_0x9965('0xa6')]=_0xcaffbc[_0x9965('0xa6')];if(_0xf262b5['headers'][_0x9965('0xa7')]){delete _0xf262b5[_0x9965('0xa6')][_0x9965('0xa7')];}}if(_0xf262b5[_0x9965('0xa6')][_0x9965('0xa8')]){delete _0xf262b5[_0x9965('0xa6')][_0x9965('0xa8')];}return rp(_0xf262b5);})[_0x9965('0x2c')](function(_0x2683c1){if(_0x2683c1){_0x4b5f97['set'](_0x2683c1[_0x9965('0xa6')]);logger[_0x9965('0x6c')](_0x2683c1['body']);if(_['endsWith'](_0xcaffbc['query']['path'],'download')&&_0x2683c1[_0x9965('0xa9')]==0x1f4){return _0x4b5f97[_0x9965('0x20')](_0x2683c1[_0x9965('0xa9')]);}else{return _0x4b5f97[_0x9965('0x21')](_0x2683c1[_0x9965('0xa9')])[_0x9965('0x33')](_0x2683c1[_0x9965('0xaa')]);}}else{return _0x4b5f97['sendStatus'](0xc8);}})[_0x9965('0x4d')](handleError(_0x4b5f97,null));};exports[_0x9965('0xab')]=function(_0x34d0d1,_0x14fa59,_0x43aaba){return BPromise[_0x9965('0xac')]()['then'](function(){if(!_0x34d0d1[_0x9965('0x3a')]['path']){throw new Error(_0x9965('0xa0'));}if(!_0x34d0d1['query'][_0x9965('0xa1')]){throw new Error(_0x9965('0xa2'));}var _0x1176f5=_0x34d0d1[_0x9965('0x3a')][_0x9965('0xad')]?_0x34d0d1[_0x9965('0x3a')][_0x9965('0xad')]+':'+_0x34d0d1[_0x9965('0x3a')]['port']:_0x9965('0xa3')+_0x34d0d1['query'][_0x9965('0xa1')];var _0x193017=_0x34d0d1[_0x9965('0x3a')]['json']?_0x34d0d1['query'][_0x9965('0x23')]:!![];var _0x55c8bd=_0x34d0d1[_0x9965('0x3a')][_0x9965('0xa4')]?_0x34d0d1[_0x9965('0x3a')][_0x9965('0xa4')]:null;var _0x51f97d={'method':_0x34d0d1[_0x9965('0xae')],'uri':util[_0x9965('0x55')](_0x9965('0xa5'),_0x1176f5,_0x34d0d1['query'][_0x9965('0x6')]),'json':_0x193017,'resolveWithFullResponse':!![],'encoding':_0x55c8bd,'body':_0x34d0d1['body']};if(_0x34d0d1[_0x9965('0xa6')]){_0x51f97d[_0x9965('0xa6')]=_0x34d0d1[_0x9965('0xa6')];if(_0x51f97d[_0x9965('0xa6')][_0x9965('0xa7')]){delete _0x51f97d['headers'][_0x9965('0xa7')];}}if(_0x51f97d[_0x9965('0xa6')][_0x9965('0xa8')]){delete _0x51f97d[_0x9965('0xa6')][_0x9965('0xa8')];}return rp(_0x51f97d);})[_0x9965('0x2c')](function(_0x2c6513){if(_0x2c6513){_0x14fa59[_0x9965('0x28')](_0x2c6513[_0x9965('0xa6')]);logger[_0x9965('0x6c')](_0x2c6513[_0x9965('0xaa')]);return _0x14fa59[_0x9965('0x21')](_0x2c6513[_0x9965('0xa9')])[_0x9965('0x33')](_0x2c6513[_0x9965('0xaa')]);}else{return _0x14fa59[_0x9965('0x20')](0xc8);}})['catch'](handleError(_0x14fa59,null));}; \ No newline at end of file +var _0xce44=['sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','node_modules/**/*','attachments/**/*','finalize','close','existsSync','download','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','icon-apps','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','body','role','user','get','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','method','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','Plugins','UserProfileResource','destroy','error','stack','send','index','Plugin','rawAttributes','fieldName','type','key','model','map','name','query','filters','intersection','attributes','fields','nolimit'];(function(_0x392ea9,_0xfe8969){var _0x389de4=function(_0xf1362f){while(--_0xf1362f){_0x392ea9['push'](_0x392ea9['shift']());}};_0x389de4(++_0xfe8969);}(_0xce44,0x1c5));var _0x4ce4=function(_0x5be264,_0x3d8605){_0x5be264=_0x5be264-0x0;var _0x149d49=_0xce44[_0x5be264];return _0x149d49;};'use strict';var emlformat=require(_0x4ce4('0x0'));var rimraf=require(_0x4ce4('0x1'));var zipdir=require(_0x4ce4('0x2'));var jsonpatch=require(_0x4ce4('0x3'));var rp=require(_0x4ce4('0x4'));var moment=require(_0x4ce4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4ce4('0x6'));var util=require(_0x4ce4('0x7'));var path=require(_0x4ce4('0x8'));var sox=require(_0x4ce4('0x9'));var csv=require('to-csv');var ejs=require(_0x4ce4('0xa'));var fs=require('fs');var fs_extra=require(_0x4ce4('0xb'));var _=require(_0x4ce4('0xc'));var squel=require(_0x4ce4('0xd'));var crypto=require(_0x4ce4('0xe'));var jsforce=require(_0x4ce4('0xf'));var deskjs=require(_0x4ce4('0x10'));var toCsv=require(_0x4ce4('0x11'));var querystring=require('querystring');var Papa=require(_0x4ce4('0x12'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x4ce4('0x13'));var authService=require(_0x4ce4('0x14'));var qs=require(_0x4ce4('0x15'));var as=require(_0x4ce4('0x16'));var hardwareService=require(_0x4ce4('0x17'));var logger=require(_0x4ce4('0x18'))(_0x4ce4('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4ce4('0x1a'));var db=require(_0x4ce4('0x1b'))['db'];config['redis']=_[_0x4ce4('0x1c')](config[_0x4ce4('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4ce4('0x1e'))[_0x4ce4('0x1f')](socket);function respondWithStatusCode(_0x6cf56d,_0x4c3c6c){_0x4c3c6c=_0x4c3c6c||0xcc;return function(_0x104a77){if(_0x104a77){return _0x6cf56d[_0x4ce4('0x20')](_0x4c3c6c);}return _0x6cf56d[_0x4ce4('0x21')](_0x4c3c6c)[_0x4ce4('0x22')]();};}function respondWithResult(_0x5f2273,_0x143852){_0x143852=_0x143852||0xc8;return function(_0x102025){if(_0x102025){return _0x5f2273[_0x4ce4('0x21')](_0x143852)[_0x4ce4('0x23')](_0x102025);}};}function respondWithFilteredResult(_0x94d218,_0x4b7738){return function(_0x35aa0d){if(_0x35aa0d){var _0x531c5d=typeof _0x4b7738[_0x4ce4('0x24')]===_0x4ce4('0x25')&&typeof _0x4b7738['limit']===_0x4ce4('0x25');var _0x1233b3=_0x35aa0d[_0x4ce4('0x26')];var _0x373fba=_0x531c5d?0x0:_0x4b7738['offset'];var _0x3ade13=_0x531c5d?_0x35aa0d[_0x4ce4('0x26')]:_0x4b7738[_0x4ce4('0x24')]+_0x4b7738[_0x4ce4('0x27')];var _0x50994e;if(_0x3ade13>=_0x1233b3){_0x3ade13=_0x1233b3;_0x50994e=0xc8;}else{_0x50994e=0xce;}_0x94d218[_0x4ce4('0x21')](_0x50994e);return _0x94d218['set']('Content-Range',_0x373fba+'-'+_0x3ade13+'/'+_0x1233b3)[_0x4ce4('0x23')](_0x35aa0d);}return null;};}function patchUpdates(_0x191600){return function(_0x14a091){try{jsonpatch[_0x4ce4('0x28')](_0x14a091,_0x191600,!![]);}catch(_0x5637ed){return BPromise[_0x4ce4('0x29')](_0x5637ed);}return _0x14a091[_0x4ce4('0x2a')]();};}function saveUpdates(_0x3c9e11,_0x5eadd0){return function(_0x2b740e){if(_0x2b740e){return _0x2b740e[_0x4ce4('0x2b')](_0x3c9e11)[_0x4ce4('0x2c')](function(_0x557524){return _0x557524;});}return null;};}function removeEntity(_0x18ed49,_0x1399d2){return function(_0x54eb48){if(_0x54eb48){return _0x54eb48['destroy']()['then'](function(){var _0x396ccd=_0x54eb48['get']({'plain':!![]});var _0x48d2e2=_0x4ce4('0x2d');return db[_0x4ce4('0x2e')][_0x4ce4('0x2f')]({'where':{'type':_0x48d2e2,'resourceId':_0x396ccd['id']}})[_0x4ce4('0x2c')](function(){return _0x54eb48;});})[_0x4ce4('0x2c')](function(){_0x18ed49[_0x4ce4('0x21')](0xcc)[_0x4ce4('0x22')]();});}};}function handleEntityNotFound(_0x4dc283,_0x3e0c25){return function(_0x49a675){if(!_0x49a675){_0x4dc283[_0x4ce4('0x20')](0x194);}return _0x49a675;};}function handleError(_0x2dc11a,_0x5bce35){_0x5bce35=_0x5bce35||0x1f4;return function(_0x27960d){logger[_0x4ce4('0x30')](_0x27960d[_0x4ce4('0x31')]);if(_0x27960d['name']){delete _0x27960d['name'];}_0x2dc11a[_0x4ce4('0x21')](_0x5bce35)[_0x4ce4('0x32')](_0x27960d);};}exports[_0x4ce4('0x33')]=function(_0x224f85,_0x11d55e){var _0x48e7fb={},_0x331a7f={},_0x22a509={'count':0x0,'rows':[]};var _0x2fea89=_['map'](db[_0x4ce4('0x34')][_0x4ce4('0x35')],function(_0x2f4062){return{'name':_0x2f4062[_0x4ce4('0x36')],'type':_0x2f4062[_0x4ce4('0x37')][_0x4ce4('0x38')]};});_0x331a7f[_0x4ce4('0x39')]=_[_0x4ce4('0x3a')](_0x2fea89,_0x4ce4('0x3b'));_0x331a7f[_0x4ce4('0x3c')]=_['keys'](_0x224f85['query']);_0x331a7f[_0x4ce4('0x3d')]=_[_0x4ce4('0x3e')](_0x331a7f[_0x4ce4('0x39')],_0x331a7f[_0x4ce4('0x3c')]);_0x48e7fb[_0x4ce4('0x3f')]=_[_0x4ce4('0x3e')](_0x331a7f[_0x4ce4('0x39')],qs[_0x4ce4('0x40')](_0x224f85[_0x4ce4('0x3c')][_0x4ce4('0x40')]));_0x48e7fb[_0x4ce4('0x3f')]=_0x48e7fb[_0x4ce4('0x3f')]['length']?_0x48e7fb[_0x4ce4('0x3f')]:_0x331a7f[_0x4ce4('0x39')];if(!_0x224f85[_0x4ce4('0x3c')]['hasOwnProperty'](_0x4ce4('0x41'))){_0x48e7fb['limit']=qs[_0x4ce4('0x27')](_0x224f85[_0x4ce4('0x3c')]['limit']);_0x48e7fb[_0x4ce4('0x24')]=qs[_0x4ce4('0x24')](_0x224f85[_0x4ce4('0x3c')][_0x4ce4('0x24')]);}_0x48e7fb['order']=qs[_0x4ce4('0x42')](_0x224f85[_0x4ce4('0x3c')][_0x4ce4('0x42')]);_0x48e7fb[_0x4ce4('0x43')]=qs['filters'](_['pick'](_0x224f85[_0x4ce4('0x3c')],_0x331a7f[_0x4ce4('0x3d')]),_0x2fea89);if(_0x224f85[_0x4ce4('0x3c')][_0x4ce4('0x44')]){_0x48e7fb[_0x4ce4('0x43')]=_[_0x4ce4('0x45')](_0x48e7fb['where'],{'$or':_[_0x4ce4('0x3a')](_0x2fea89,function(_0x388ce1){if(_0x388ce1[_0x4ce4('0x37')]!==_0x4ce4('0x46')){var _0x446e5d={};_0x446e5d[_0x388ce1['name']]={'$like':'%'+_0x224f85[_0x4ce4('0x3c')][_0x4ce4('0x44')]+'%'};return _0x446e5d;}})});}_0x48e7fb=_[_0x4ce4('0x45')]({},_0x48e7fb,_0x224f85[_0x4ce4('0x47')]);var _0x10c34b={'where':_0x48e7fb[_0x4ce4('0x43')]};return db[_0x4ce4('0x34')]['count'](_0x10c34b)['then'](function(_0x2696bb){_0x22a509[_0x4ce4('0x26')]=_0x2696bb;if(_0x224f85[_0x4ce4('0x3c')][_0x4ce4('0x48')]){_0x48e7fb[_0x4ce4('0x49')]=[{'all':!![]}];}return db[_0x4ce4('0x34')][_0x4ce4('0x4a')](_0x48e7fb);})[_0x4ce4('0x2c')](function(_0x4f3208){_0x22a509[_0x4ce4('0x4b')]=_0x4f3208;return _0x22a509;})['then'](respondWithFilteredResult(_0x11d55e,_0x48e7fb))[_0x4ce4('0x4c')](handleError(_0x11d55e,null));};exports[_0x4ce4('0x4d')]=function(_0x44f839,_0x8c5a93){var _0x4e88bd={'raw':!![],'where':{'id':_0x44f839[_0x4ce4('0x4e')]['id']}},_0x4edee1={};_0x4edee1[_0x4ce4('0x39')]=_[_0x4ce4('0x4f')](db[_0x4ce4('0x34')][_0x4ce4('0x35')]);_0x4edee1[_0x4ce4('0x3c')]=_[_0x4ce4('0x4f')](_0x44f839[_0x4ce4('0x3c')]);_0x4edee1[_0x4ce4('0x3d')]=_[_0x4ce4('0x3e')](_0x4edee1[_0x4ce4('0x39')],_0x4edee1[_0x4ce4('0x3c')]);_0x4e88bd[_0x4ce4('0x3f')]=_[_0x4ce4('0x3e')](_0x4edee1['model'],qs['fields'](_0x44f839[_0x4ce4('0x3c')][_0x4ce4('0x40')]));_0x4e88bd[_0x4ce4('0x3f')]=_0x4e88bd['attributes'][_0x4ce4('0x50')]?_0x4e88bd['attributes']:_0x4edee1[_0x4ce4('0x39')];if(_0x44f839['query']['includeAll']){_0x4e88bd[_0x4ce4('0x49')]=[{'all':!![]}];}_0x4e88bd=_[_0x4ce4('0x45')]({},_0x4e88bd,_0x44f839[_0x4ce4('0x47')]);return db[_0x4ce4('0x34')][_0x4ce4('0x51')](_0x4e88bd)[_0x4ce4('0x2c')](handleEntityNotFound(_0x8c5a93,null))[_0x4ce4('0x2c')](respondWithResult(_0x8c5a93,null))[_0x4ce4('0x4c')](handleError(_0x8c5a93,null));};exports['download']=function(_0x32eb7f,_0x1b4b60,_0x105649){return db[_0x4ce4('0x34')][_0x4ce4('0x51')]({'where':{'id':_0x32eb7f[_0x4ce4('0x4e')]['id']},'attributes':[_0x4ce4('0x3b'),_0x4ce4('0x8')],'raw':!![]})[_0x4ce4('0x2c')](handleEntityNotFound(_0x1b4b60,null))['then'](function(_0x567c58){if(_0x567c58){var _0x290b64=path[_0x4ce4('0x52')](config[_0x4ce4('0x53')],_0x4ce4('0x54'),util[_0x4ce4('0x55')](_0x4ce4('0x56'),path[_0x4ce4('0x57')](_0x567c58[_0x4ce4('0x8')])));var _0x5a0c07=fs[_0x4ce4('0x58')](_0x290b64);var _0x18f0e0=archiver(_0x4ce4('0x59'),{'zlib':{'level':0x9}});_0x18f0e0['on'](_0x4ce4('0x5a'),function(_0x3e2be2){if(_0x3e2be2[_0x4ce4('0x5b')]===_0x4ce4('0x5c')){logger[_0x4ce4('0x30')](_0x3e2be2);}else{throw new db[(_0x4ce4('0x5d'))][(_0x4ce4('0x5e'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x18f0e0['on'](_0x4ce4('0x30'),function(_0x12c958){throw new db[(_0x4ce4('0x5d'))]['Error'](_0x4ce4('0x5f'));});_0x18f0e0[_0x4ce4('0x60')](_0x5a0c07);_0x18f0e0[_0x4ce4('0x61')](_0x4ce4('0x62'),{'cwd':path[_0x4ce4('0x52')](config['root'],'server/files/plugins',path['dirname'](_0x567c58['path'])),'ignore':[path['join'](path['basename'](_0x567c58[_0x4ce4('0x8')]),_0x4ce4('0x63')),path['join'](path[_0x4ce4('0x57')](_0x567c58[_0x4ce4('0x8')]),_0x4ce4('0x64'))],'nodir':!![]})[_0x4ce4('0x65')]();_0x5a0c07['on'](_0x4ce4('0x66'),function(){if(!fs[_0x4ce4('0x67')](_0x290b64)){throw new db[(_0x4ce4('0x5d'))][(_0x4ce4('0x5e'))]('Plugin\x20not\x20found');}return _0x1b4b60[_0x4ce4('0x68')](_0x290b64,util['format']('%s.zip',path[_0x4ce4('0x57')](_0x567c58[_0x4ce4('0x8')])),function(_0xbfae00){if(_0xbfae00){throw new db[(_0x4ce4('0x5d'))][(_0x4ce4('0x5e'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x290b64);logger[_0x4ce4('0x69')](_0x4ce4('0x6a'));logger['info'](_0x4ce4('0x6b'));});});}return null;})[_0x4ce4('0x4c')](handleError(_0x1b4b60,null));};exports[_0x4ce4('0x6c')]=function(_0x2682b9,_0x3e2708,_0x2e74ec){var _0x12189c=path[_0x4ce4('0x57')](_0x2682b9[_0x4ce4('0x6d')][_0x4ce4('0x6e')],path['extname'](_0x2682b9[_0x4ce4('0x6d')][_0x4ce4('0x6e')]));var _0x2a36ce=path[_0x4ce4('0x52')](config[_0x4ce4('0x53')],_0x4ce4('0x54'),_0x2682b9[_0x4ce4('0x6d')][_0x4ce4('0x6e')]);var _0x423b7d=path['join'](config[_0x4ce4('0x53')],_0x4ce4('0x54'),_0x12189c);logger[_0x4ce4('0x69')]('Plugin\x20upload\x20filepath:\x20%s',_0x2a36ce);logger[_0x4ce4('0x69')]('Plugin\x20upload\x20destination:\x20%s',_0x423b7d);try{fs[_0x4ce4('0x6f')](_0x2a36ce,parseInt(_0x4ce4('0x70'),0x8));extract(_0x2a36ce,{'dir':_0x423b7d},function(_0x58a4d2){if(_0x58a4d2){logger[_0x4ce4('0x30')](_0x58a4d2);handleError(_0x58a4d2,!![]);};var _0x2c2295=fs['readdirSync'](_0x423b7d);if(_0x2c2295['length']>0x1){removeReferences(_0x2a36ce,_0x423b7d);logger[_0x4ce4('0x30')](_0x4ce4('0x71'));return _0x2e74ec(new Error(_0x4ce4('0x71')));}var _0x4df067=fs[_0x4ce4('0x72')](path[_0x4ce4('0x52')](_0x423b7d,_0x2c2295[0x0]));if(_0x4df067[_0x4ce4('0x73')]()){removeReferences(_0x2a36ce,_0x423b7d);logger[_0x4ce4('0x30')](_0x4ce4('0x71'));return _0x2e74ec(new Error('Invalid\x20plugin\x20structure'));}if(_0x4df067[_0x4ce4('0x74')]()){var _0x102ca7=fs[_0x4ce4('0x75')](path['join'](_0x423b7d,_0x2c2295[0x0]));if(_0x102ca7['length']===0x0){removeReferences(_0x2a36ce,_0x423b7d);logger['error'](_0x4ce4('0x71'));return _0x2e74ec(new Error(_0x4ce4('0x71')));}var _0x5ecd05=_0x102ca7[_0x4ce4('0x76')](function(_0x30910b){return _0x30910b===_0x4ce4('0x77');});if(!_0x5ecd05){return _0x2e74ec(new Error(_0x4ce4('0x78')));}var _0x50562a=fs[_0x4ce4('0x79')](path['join'](_0x423b7d,_0x2c2295[0x0],_0x4ce4('0x77')));var _0x289e35=JSON['parse'](_0x50562a);if(_0x4ce4('0x25')==typeof _0x289e35[_0x4ce4('0x3b')]){return _0x2e74ec(new Error(_0x4ce4('0x7a')));}if('undefined'==typeof _0x289e35[_0x4ce4('0x37')]){return _0x2e74ec(new Error(_0x4ce4('0x7b')));}if('undefined'==typeof _0x289e35['version']){return _0x2e74ec(new Error(_0x4ce4('0x7c')));}if(_0x4ce4('0x25')==typeof _0x289e35[_0x4ce4('0x7d')]){return _0x2e74ec(new Error(_0x4ce4('0x7e')));}if(_0x289e35[_0x4ce4('0x37')]==='html'){if(_0x4ce4('0x25')==typeof _0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x7f')]){return _0x2e74ec(new Error(_0x4ce4('0x80')));}if('undefined'==typeof _0x289e35['parameters'][_0x4ce4('0x7f')][_0x4ce4('0x81')]&&_0x4ce4('0x25')==typeof _0x289e35[_0x4ce4('0x7d')]['views'][_0x4ce4('0x82')]){return _0x2e74ec(new Error(_0x4ce4('0x83')));}}else if(_0x289e35[_0x4ce4('0x37')]===_0x4ce4('0x84')){if('undefined'==typeof _0x289e35['parameters'][_0x4ce4('0x85')]){return _0x2e74ec(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x4ce4('0x25')==typeof _0x289e35['parameters'][_0x4ce4('0x86')]){return _0x2e74ec(new Error(_0x4ce4('0x87')));}}else{return _0x2e74ec(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x51b22b=_0x289e35['name'];var _0x2efd8a=_0x289e35['description'];var _0x54e340=_0x289e35['type'];var _0x3a6158=_0x289e35[_0x4ce4('0x88')]?_0x289e35[_0x4ce4('0x88')]:_0x4ce4('0x89');var _0x30cf97=_0x289e35['icon']?_0x289e35[_0x4ce4('0x8a')]:_0x4ce4('0x8b');var _0x50dad1='';var _0x51c610='';var _0x526551='';var _0x53bae5='';var _0x507692=_0x289e35[_0x4ce4('0x8c')];if(_0x54e340==='html'){if('undefined'!=typeof _0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x7f')][_0x4ce4('0x81')]){var _0x23d9eb=_0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x7f')][_0x4ce4('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x4ce4('0x8d')](_0x23d9eb)){_0x50dad1=path['join'](_0x4ce4('0x8e'),_0x12189c,_0x2c2295[0x0],_0x23d9eb);}else{_0x50dad1=_0x23d9eb;}}else{logger[_0x4ce4('0x69')](_0x4ce4('0x8f'));}if('undefined'!=typeof _0x289e35['parameters'][_0x4ce4('0x7f')]['agent']){var _0x15a3cd=_0x289e35[_0x4ce4('0x7d')]['views'][_0x4ce4('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x15a3cd)){_0x51c610=path[_0x4ce4('0x52')](_0x4ce4('0x8e'),_0x12189c,_0x2c2295[0x0],_0x15a3cd);}else{_0x51c610=_0x15a3cd;}}else{logger[_0x4ce4('0x69')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x54e340===_0x4ce4('0x84')){_0x526551=_0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x85')];_0x53bae5=_0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x86')];if('undefined'!=typeof _0x289e35[_0x4ce4('0x7d')]['views']){if(_0x4ce4('0x25')!=typeof _0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x7f')][_0x4ce4('0x81')]){var _0x23d9eb=_0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x7f')][_0x4ce4('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x4ce4('0x8d')](_0x23d9eb)){_0x50dad1=path[_0x4ce4('0x52')]('plugins',_0x12189c,_0x2c2295[0x0],_0x23d9eb);}else{_0x50dad1=_0x23d9eb;}}if(_0x4ce4('0x25')!=typeof _0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x7f')][_0x4ce4('0x82')]){var _0x15a3cd=_0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x7f')][_0x4ce4('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x4ce4('0x8d')](_0x15a3cd)){_0x51c610=path[_0x4ce4('0x52')](_0x4ce4('0x8e'),_0x12189c,_0x2c2295[0x0],_0x15a3cd);}else{_0x51c610=_0x15a3cd;}}}}var _0x451406={'name':_0x51b22b,'description':_0x2efd8a,'path':path[_0x4ce4('0x52')](_0x12189c,_0x2c2295[0x0]),'type':_0x54e340,'sidebar':_0x3a6158,'icon':_0x30cf97,'adminUrl':_0x50dad1,'agentUrl':_0x51c610,'scriptName':_0x526551,'scriptPath':_0x53bae5,'version':_0x507692};removeReferences(_0x2a36ce,null);return db[_0x4ce4('0x34')]['create'](_0x451406)[_0x4ce4('0x2c')](function(_0xc37dfe){var _0x5aeffd={'role':_0x2682b9[_0x4ce4('0x90')][_0x4ce4('0x91')],'userProfileId':_0x2682b9['body']['userProfileId']};if(!_0x5aeffd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5aeffd[_0x4ce4('0x91')]===_0x4ce4('0x92')){var _0x30b94d=_0xc37dfe[_0x4ce4('0x93')]({'plain':!![]});return db[_0x4ce4('0x94')][_0x4ce4('0x51')]({'where':{'name':'Plugins','userProfileId':_0x5aeffd['userProfileId']},'raw':!![]})['then'](function(_0x51469d){if(_0x51469d&&_0x51469d['autoAssociation']===0x0){return db[_0x4ce4('0x2e')][_0x4ce4('0x95')]({'name':_0x30b94d[_0x4ce4('0x3b')],'resourceId':_0x30b94d['id'],'type':_0x51469d[_0x4ce4('0x3b')],'sectionId':_0x51469d['id']},{})[_0x4ce4('0x2c')](function(){return _0xc37dfe;});}else{return _0xc37dfe;}})['catch'](function(_0x4f972a){logger[_0x4ce4('0x30')](_0x4ce4('0x96'),_0x4f972a);throw _0x4f972a;});}return _0xc37dfe;})['then'](respondWithResult(_0x3e2708,null))['catch'](handleError(_0x3e2708,null));}});}catch(_0x2e2225){_0x3e2708[_0x4ce4('0x21')](0x1f4)[_0x4ce4('0x32')](_0x2e2225);}};function removeReferences(_0xd2f275,_0x2b6021){try{if(_0xd2f275){fs[_0x4ce4('0x97')](_0xd2f275);logger[_0x4ce4('0x69')](_0x4ce4('0x98'));}if(_0x2b6021){rimraf(_0x2b6021,function(){});logger[_0x4ce4('0x69')](_0x4ce4('0x99'));}}catch(_0x34e11f){logger[_0x4ce4('0x30')](_0x34e11f);}}exports[_0x4ce4('0x2b')]=function(_0x1cf67d,_0x34d0c4,_0x54028c){return db['Plugin'][_0x4ce4('0x51')]({'where':{'id':_0x1cf67d[_0x4ce4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x34d0c4,null))['then'](saveUpdates(_0x1cf67d[_0x4ce4('0x90')],null))[_0x4ce4('0x2c')](respondWithResult(_0x34d0c4,null))['catch'](handleError(_0x34d0c4,null));};exports[_0x4ce4('0x9a')]=function(_0x30c0b7,_0x2a7d97,_0x179264){return db[_0x4ce4('0x34')]['find']({'where':{'id':_0x30c0b7['params']['id']}})[_0x4ce4('0x2c')](function(_0xa932e){if(_0xa932e){return _0xa932e[_0x4ce4('0x2f')]();}})[_0x4ce4('0x2c')](function(_0xf46b16){rimraf(path[_0x4ce4('0x52')](config[_0x4ce4('0x53')],_0x4ce4('0x54'),path[_0x4ce4('0x9b')](_0xf46b16['path'])),function(){});return _0xf46b16;})['then'](handleEntityNotFound(_0x2a7d97,null))['then'](respondWithStatusCode(_0x2a7d97,null))['catch'](handleError(_0x2a7d97,null));};exports[_0x4ce4('0x9c')]=function(_0x3dc7b0,_0x3253e5,_0xd6e682){return BPromise[_0x4ce4('0x9d')]()[_0x4ce4('0x2c')](function(){if(!_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0x8')]){throw new Error(_0x4ce4('0x9e'));}if(!_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0x9f')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5ea98e=_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0xa0')]?_0x3dc7b0['query'][_0x4ce4('0xa0')]+':'+_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0x9f')]:_0x4ce4('0xa1')+_0x3dc7b0[_0x4ce4('0x3c')]['port'];var _0x40ea24=_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0x23')]?_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0x23')]:!![];var _0x5230f5=_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0xa2')]?_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0xa2')]:null;var _0x5df219={'method':_0x3dc7b0['method'],'uri':util[_0x4ce4('0x55')]('%s%s',_0x5ea98e,_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0x8')]),'json':_0x40ea24,'resolveWithFullResponse':!![],'encoding':_0x5230f5,'qs':_0x3dc7b0['query']};if(_0x3dc7b0[_0x4ce4('0xa3')]){_0x5df219['headers']=_0x3dc7b0[_0x4ce4('0xa3')];if(_0x5df219[_0x4ce4('0xa3')][_0x4ce4('0xa4')]){delete _0x5df219[_0x4ce4('0xa3')][_0x4ce4('0xa4')];}}if(_0x5df219['headers'][_0x4ce4('0xa5')]){delete _0x5df219[_0x4ce4('0xa3')]['content-type'];}return rp(_0x5df219);})[_0x4ce4('0x2c')](function(_0x435ead){if(_0x435ead){_0x3253e5[_0x4ce4('0xa6')](_0x435ead[_0x4ce4('0xa3')]);logger[_0x4ce4('0x69')](_0x435ead[_0x4ce4('0x90')]);if(_[_0x4ce4('0xa7')](_0x3dc7b0[_0x4ce4('0x3c')]['path'],_0x4ce4('0x68'))&&_0x435ead[_0x4ce4('0xa8')]==0x1f4){return _0x3253e5[_0x4ce4('0x20')](_0x435ead[_0x4ce4('0xa8')]);}else{return _0x3253e5[_0x4ce4('0x21')](_0x435ead[_0x4ce4('0xa8')])[_0x4ce4('0x32')](_0x435ead['body']);}}else{return _0x3253e5[_0x4ce4('0x20')](0xc8);}})[_0x4ce4('0x4c')](handleError(_0x3253e5,null));};exports[_0x4ce4('0xa9')]=function(_0x233a87,_0x5523e1,_0x254765){return BPromise[_0x4ce4('0x9d')]()[_0x4ce4('0x2c')](function(){if(!_0x233a87[_0x4ce4('0x3c')]['path']){throw new Error(_0x4ce4('0x9e'));}if(!_0x233a87[_0x4ce4('0x3c')][_0x4ce4('0x9f')]){throw new Error(_0x4ce4('0xaa'));}var _0x4f66ec=_0x233a87[_0x4ce4('0x3c')][_0x4ce4('0xa0')]?_0x233a87[_0x4ce4('0x3c')][_0x4ce4('0xa0')]+':'+_0x233a87['query'][_0x4ce4('0x9f')]:_0x4ce4('0xa1')+_0x233a87['query'][_0x4ce4('0x9f')];var _0x298690=_0x233a87['query'][_0x4ce4('0x23')]?_0x233a87['query']['json']:!![];var _0x18adbc=_0x233a87[_0x4ce4('0x3c')][_0x4ce4('0xa2')]?_0x233a87[_0x4ce4('0x3c')]['encoding']:null;var _0x282733={'method':_0x233a87[_0x4ce4('0xab')],'uri':util[_0x4ce4('0x55')](_0x4ce4('0xac'),_0x4f66ec,_0x233a87['query'][_0x4ce4('0x8')]),'json':_0x298690,'resolveWithFullResponse':!![],'encoding':_0x18adbc,'body':_0x233a87[_0x4ce4('0x90')]};if(_0x233a87[_0x4ce4('0xa3')]){_0x282733[_0x4ce4('0xa3')]=_0x233a87[_0x4ce4('0xa3')];if(_0x282733[_0x4ce4('0xa3')][_0x4ce4('0xa4')]){delete _0x282733['headers'][_0x4ce4('0xa4')];}}if(_0x282733['headers'][_0x4ce4('0xa5')]){delete _0x282733[_0x4ce4('0xa3')]['content-type'];}return rp(_0x282733);})[_0x4ce4('0x2c')](function(_0x1d86ec){if(_0x1d86ec){_0x5523e1[_0x4ce4('0xa6')](_0x1d86ec[_0x4ce4('0xa3')]);logger[_0x4ce4('0x69')](_0x1d86ec[_0x4ce4('0x90')]);return _0x5523e1[_0x4ce4('0x21')](_0x1d86ec['statusCode'])[_0x4ce4('0x32')](_0x1d86ec[_0x4ce4('0x90')]);}else{return _0x5523e1[_0x4ce4('0x20')](0xc8);}})['catch'](handleError(_0x5523e1,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 0f9f21c..ec24f5e 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 _0x6144=['events','../../mysqldb','Plugin','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x3335aa,_0x4d4f0b){var _0xe56c67=function(_0x57b959){while(--_0x57b959){_0x3335aa['push'](_0x3335aa['shift']());}};_0xe56c67(++_0x4d4f0b);}(_0x6144,0x99));var _0x4614=function(_0x5454bb,_0x1a1f26){_0x5454bb=_0x5454bb-0x0;var _0x4aa426=_0x6144[_0x5454bb];return _0x4aa426;};'use strict';var EventEmitter=require(_0x4614('0x0'));var Plugin=require(_0x4614('0x1'))['db'][_0x4614('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x4614('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4614('0x4'),'afterDestroy':_0x4614('0x5')};function emitEvent(_0x4249c0){return function(_0x254bb6,_0x5ac7b6,_0xf5ca61){PluginEvents[_0x4614('0x6')](_0x4249c0+':'+_0x254bb6['id'],_0x254bb6);PluginEvents[_0x4614('0x6')](_0x4249c0,_0x254bb6);_0xf5ca61(null);};}for(var e in events){if(events[_0x4614('0x7')](e)){var event=events[e];Plugin[_0x4614('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xf981=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xf981,0xe6));var _0x1f98=function(_0x23d366,_0x43733a){_0x23d366=_0x23d366-0x0;var _0x486eee=_0xf981[_0x23d366];return _0x486eee;};'use strict';var EventEmitter=require(_0x1f98('0x0'));var Plugin=require(_0x1f98('0x1'))['db'][_0x1f98('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x1f98('0x3')](0x0);var events={'afterCreate':_0x1f98('0x4'),'afterUpdate':_0x1f98('0x5'),'afterDestroy':_0x1f98('0x6')};function emitEvent(_0xd68165){return function(_0x562a81,_0x14da55,_0x15c6fa){PluginEvents[_0x1f98('0x7')](_0xd68165+':'+_0x562a81['id'],_0x562a81);PluginEvents[_0x1f98('0x7')](_0xd68165,_0x562a81);_0x15c6fa(null);};}for(var e in events){if(events[_0x1f98('0x8')](e)){var event=events[e];Plugin['hook'](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 a558d70..8525179 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 _0xacc6=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./plugin.attributes','exports','define','plugins','lodash'];(function(_0x2c1ddd,_0x2a667f){var _0x49fa39=function(_0x581c2d){while(--_0x581c2d){_0x2c1ddd['push'](_0x2c1ddd['shift']());}};_0x49fa39(++_0x2a667f);}(_0xacc6,0x11d));var _0x6acc=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0xacc6[_0x31b5b2];return _0x364f13;};'use strict';var _=require(_0x6acc('0x0'));var util=require(_0x6acc('0x1'));var logger=require(_0x6acc('0x2'))(_0x6acc('0x3'));var moment=require(_0x6acc('0x4'));var BPromise=require(_0x6acc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6acc('0x6'));var rimraf=require(_0x6acc('0x7'));var config=require(_0x6acc('0x8'));var attributes=require(_0x6acc('0x9'));module[_0x6acc('0xa')]=function(_0x21cc28,_0x21ca1b){return _0x21cc28[_0x6acc('0xb')]('Plugin',attributes,{'tableName':_0x6acc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb2=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','Plugin','plugins'];(function(_0x5d8ad5,_0x95ec33){var _0x1240ce=function(_0x2c7698){while(--_0x2c7698){_0x5d8ad5['push'](_0x5d8ad5['shift']());}};_0x1240ce(++_0x95ec33);}(_0xadb2,0x70));var _0x2adb=function(_0x40d347,_0x15582f){_0x40d347=_0x40d347-0x0;var _0x1175b7=_0xadb2[_0x40d347];return _0x1175b7;};'use strict';var _=require(_0x2adb('0x0'));var util=require(_0x2adb('0x1'));var logger=require(_0x2adb('0x2'))(_0x2adb('0x3'));var moment=require(_0x2adb('0x4'));var BPromise=require(_0x2adb('0x5'));var rp=require(_0x2adb('0x6'));var fs=require('fs');var path=require(_0x2adb('0x7'));var rimraf=require(_0x2adb('0x8'));var config=require(_0x2adb('0x9'));var attributes=require(_0x2adb('0xa'));module[_0x2adb('0xb')]=function(_0x58ff65,_0xecfe4e){return _0x58ff65['define'](_0x2adb('0xc'),attributes,{'tableName':_0x2adb('0xd'),'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 ac3ee88..5c5b1c5 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 _0xe6b6=['randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','redis','./plugin.socket','register','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreatePlugin','Plugin','create','body','options','info','util','moment'];(function(_0x1699e9,_0x1f2652){var _0x14b104=function(_0x319079){while(--_0x319079){_0x1699e9['push'](_0x1699e9['shift']());}};_0x14b104(++_0x1f2652);}(_0xe6b6,0x150));var _0x6e6b=function(_0x11995e,_0x5de068){_0x11995e=_0x11995e-0x0;var _0x5d0d10=_0xe6b6[_0x11995e];return _0x5d0d10;};'use strict';var _=require('lodash');var util=require(_0x6e6b('0x0'));var moment=require(_0x6e6b('0x1'));var BPromise=require('bluebird');var rs=require(_0x6e6b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6e6b('0x3'));var logger=require('../../config/logger')(_0x6e6b('0x4'));var config=require(_0x6e6b('0x5'));var jayson=require(_0x6e6b('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x6e6b('0x7')]=_['defaults'](config[_0x6e6b('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6e6b('0x7')]));require(_0x6e6b('0x8'))[_0x6e6b('0x9')](socket);function respondWithRpcPromise(_0x10688d,_0x4a6e85,_0x32f148){return new BPromise(function(_0x20ae79,_0x5a9a76){return client['request'](_0x10688d,_0x32f148)[_0x6e6b('0xa')](function(_0x27e4fc){logger['info'](_0x6e6b('0xb'),_0x4a6e85,_0x6e6b('0xc'));logger[_0x6e6b('0xd')](_0x6e6b('0xe'),_0x4a6e85,_0x6e6b('0xc'),JSON[_0x6e6b('0xf')](_0x27e4fc));if(_0x27e4fc[_0x6e6b('0x10')]){if(_0x27e4fc[_0x6e6b('0x10')]['code']===0x1f4){logger[_0x6e6b('0x10')](_0x6e6b('0xb'),_0x4a6e85,_0x27e4fc['error']['message']);return _0x5a9a76(_0x27e4fc['error']['message']);}logger[_0x6e6b('0x10')]('Plugin,\x20%s,\x20%s',_0x4a6e85,_0x27e4fc[_0x6e6b('0x10')][_0x6e6b('0x11')]);return _0x20ae79(_0x27e4fc['error']['message']);}else{logger['info'](_0x6e6b('0xb'),_0x4a6e85,_0x6e6b('0xc'));_0x20ae79(_0x27e4fc[_0x6e6b('0x12')][_0x6e6b('0x11')]);}})[_0x6e6b('0x13')](function(_0x20581b){logger[_0x6e6b('0x10')](_0x6e6b('0xb'),_0x4a6e85,_0x20581b);_0x5a9a76(_0x20581b);});});}exports[_0x6e6b('0x14')]=function(_0x32b04f){var _0x35571b=this;return new Promise(function(_0x5d5d6d,_0x254521){return db[_0x6e6b('0x15')][_0x6e6b('0x16')](_0x32b04f[_0x6e6b('0x17')],{'raw':_0x32b04f[_0x6e6b('0x18')]?_0x32b04f[_0x6e6b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x6e6b('0xa')](function(_0x2c97a1){logger[_0x6e6b('0x19')](_0x6e6b('0x14'),_0x32b04f);logger[_0x6e6b('0xd')](_0x6e6b('0x14'),_0x32b04f,JSON[_0x6e6b('0xf')](_0x2c97a1));_0x5d5d6d(_0x2c97a1);})['catch'](function(_0x5c0d77){logger[_0x6e6b('0x10')](_0x6e6b('0x14'),_0x5c0d77[_0x6e6b('0x11')],_0x32b04f);_0x254521(_0x35571b[_0x6e6b('0x10')](0x1f4,_0x5c0d77[_0x6e6b('0x11')]));});});}; \ No newline at end of file +var _0x71a0=['request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Plugin,\x20%s,\x20%s','result','CreatePlugin','Plugin','create','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./plugin.socket','register','then','info'];(function(_0xb366e8,_0x57ee03){var _0x20096f=function(_0xc95063){while(--_0xc95063){_0xb366e8['push'](_0xb366e8['shift']());}};_0x20096f(++_0x57ee03);}(_0x71a0,0xba));var _0x071a=function(_0x417a69,_0xef3d6d){_0x417a69=_0x417a69-0x0;var _0x457632=_0x71a0[_0x417a69];return _0x457632;};'use strict';var _=require('lodash');var util=require(_0x071a('0x0'));var moment=require(_0x071a('0x1'));var BPromise=require(_0x071a('0x2'));var rs=require(_0x071a('0x3'));var fs=require('fs');var Redis=require(_0x071a('0x4'));var db=require(_0x071a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x071a('0x6'))(_0x071a('0x7'));var config=require('../../config/environment');var jayson=require(_0x071a('0x8'));var client=jayson[_0x071a('0x9')][_0x071a('0xa')]({'port':0x232a});config[_0x071a('0xb')]=_[_0x071a('0xc')](config['redis'],{'host':_0x071a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x071a('0xb')]));require(_0x071a('0xe'))[_0x071a('0xf')](socket);function respondWithRpcPromise(_0x4c3e4e,_0x49e975,_0xb0258a){return new BPromise(function(_0x4903d6,_0x11687e){return client['request'](_0x4c3e4e,_0xb0258a)[_0x071a('0x10')](function(_0x1ffd79){logger[_0x071a('0x11')]('Plugin,\x20%s,\x20%s',_0x49e975,_0x071a('0x12'));logger[_0x071a('0x13')](_0x071a('0x14'),_0x49e975,_0x071a('0x12'),JSON[_0x071a('0x15')](_0x1ffd79));if(_0x1ffd79[_0x071a('0x16')]){if(_0x1ffd79[_0x071a('0x16')][_0x071a('0x17')]===0x1f4){logger[_0x071a('0x16')]('Plugin,\x20%s,\x20%s',_0x49e975,_0x1ffd79[_0x071a('0x16')][_0x071a('0x18')]);return _0x11687e(_0x1ffd79[_0x071a('0x16')][_0x071a('0x18')]);}logger[_0x071a('0x16')]('Plugin,\x20%s,\x20%s',_0x49e975,_0x1ffd79[_0x071a('0x16')][_0x071a('0x18')]);return _0x4903d6(_0x1ffd79['error'][_0x071a('0x18')]);}else{logger['info'](_0x071a('0x19'),_0x49e975,_0x071a('0x12'));_0x4903d6(_0x1ffd79[_0x071a('0x1a')][_0x071a('0x18')]);}})['catch'](function(_0x2687bd){logger[_0x071a('0x16')](_0x071a('0x19'),_0x49e975,_0x2687bd);_0x11687e(_0x2687bd);});});}exports[_0x071a('0x1b')]=function(_0x4823a7){var _0x28652a=this;return new Promise(function(_0x15684e,_0x3be8df){return db[_0x071a('0x1c')][_0x071a('0x1d')](_0x4823a7[_0x071a('0x1e')],{'raw':_0x4823a7[_0x071a('0x1f')]?_0x4823a7['options'][_0x071a('0x20')]===undefined?!![]:![]:!![]})[_0x071a('0x10')](function(_0x83367e){logger['info'](_0x071a('0x1b'),_0x4823a7);logger[_0x071a('0x13')](_0x071a('0x1b'),_0x4823a7,JSON[_0x071a('0x15')](_0x83367e));_0x15684e(_0x83367e);})[_0x071a('0x21')](function(_0x36a589){logger[_0x071a('0x16')](_0x071a('0x1b'),_0x36a589[_0x071a('0x18')],_0x4823a7);_0x3be8df(_0x28652a[_0x071a('0x16')](0x1f4,_0x36a589[_0x071a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index cb51300..54595bc 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 _0x8775=['length','./plugin.events','remove','removeListener','register'];(function(_0x4af446,_0x559fe9){var _0x3afa6b=function(_0x1c306a){while(--_0x1c306a){_0x4af446['push'](_0x4af446['shift']());}};_0x3afa6b(++_0x559fe9);}(_0x8775,0x15f));var _0x5877=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x8775[_0x1265ed];return _0x5ac459;};'use strict';var PluginEvents=require(_0x5877('0x0'));var events=['save',_0x5877('0x1'),'update'];function createListener(_0x57ac72,_0x57e9f7){return function(_0x4b1f9b){_0x57e9f7['emit'](_0x57ac72,_0x4b1f9b);};}function removeListener(_0x344924,_0x2ebc46){return function(){PluginEvents[_0x5877('0x2')](_0x344924,_0x2ebc46);};}exports[_0x5877('0x3')]=function(_0x50d21e){for(var _0x202ac7=0x0,_0x53c10d=events[_0x5877('0x4')];_0x202ac7<_0x53c10d;_0x202ac7++){var _0x1b1493=events[_0x202ac7];var _0x4ccd0d=createListener('plugin:'+_0x1b1493,_0x50d21e);PluginEvents['on'](_0x1b1493,_0x4ccd0d);}}; \ No newline at end of file +var _0x4434=['remove','emit','removeListener','register','plugin:'];(function(_0x2efaa3,_0x5f255b){var _0x49a48f=function(_0x54922d){while(--_0x54922d){_0x2efaa3['push'](_0x2efaa3['shift']());}};_0x49a48f(++_0x5f255b);}(_0x4434,0xa0));var _0x4443=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4434[_0x4b369d];return _0x571a98;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0x4443('0x0'),'update'];function createListener(_0x1824b6,_0x2a19c8){return function(_0xe35fa){_0x2a19c8[_0x4443('0x1')](_0x1824b6,_0xe35fa);};}function removeListener(_0x531dad,_0x27869d){return function(){PluginEvents[_0x4443('0x2')](_0x531dad,_0x27869d);};}exports[_0x4443('0x3')]=function(_0x33cfc2){for(var _0x230f87=0x0,_0x422dbc=events['length'];_0x230f87<_0x422dbc;_0x230f87++){var _0x5c79f1=events[_0x230f87];var _0x134c06=createListener(_0x4443('0x4')+_0x5c79f1,_0x33cfc2);PluginEvents['on'](_0x5c79f1,_0x134c06);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b10cbec..3d929cd 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(_0x243092,_0x2b2a3a){var _0x228392=function(_0x5752a2){while(--_0x5752a2){_0x243092['push'](_0x243092['shift']());}};_0x228392(++_0x2b2a3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./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(_0x280018,_0x54f59e){var _0x13152d=function(_0x3b8a61){while(--_0x3b8a61){_0x280018['push'](_0x280018['shift']());}};_0x13152d(++_0x54f59e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 2fbf757..d7da791 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 _0xb332=['dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty','Unknown\x20id','lodash','../../config/logger','api','child_process','bluebird','sendStatus','error','stack','name','status','send','npm\x20install','info','list','reject','motion2','length','then','catch','show','params','create','body','script','join','../../files/plugins','cwd','chdir'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb332,0xd9));var _0x2b33=function(_0x12ddb2,_0x5ad61e){_0x12ddb2=_0x12ddb2-0x0;var _0x10b6dd=_0xb332[_0x12ddb2];return _0x10b6dd;};'use strict';var _=require(_0x2b33('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x2b33('0x1'))(_0x2b33('0x2'));var path=require('path');var exec=require(_0x2b33('0x3'))['exec'];var BPromise=require(_0x2b33('0x4'));function handleEntityNotFound(_0x4c6634,_0x34b111){return function(_0x5e5e86){if(!_0x5e5e86){_0x4c6634[_0x2b33('0x5')](0x194);;}return _0x5e5e86;};}function respondWithResult(_0x22d66,_0x478214){_0x478214=_0x478214||0xc8;return function(_0x461d44){if(_0x461d44){return _0x22d66['status'](_0x478214)['json'](_0x461d44);}return null;};}function handleError(_0x4302b7,_0x5f29ab){_0x5f29ab=_0x5f29ab||0x1f4;return function(_0xb3aeab){logger[_0x2b33('0x6')](_0xb3aeab[_0x2b33('0x7')]);if(_0xb3aeab[_0x2b33('0x8')]){delete _0xb3aeab['name'];}_0x4302b7[_0x2b33('0x9')](_0x5f29ab)[_0x2b33('0xa')](_0xb3aeab);};}function execChildProcess(){return new BPromise(function(_0x1be19d,_0x1d83a6){exec(_0x2b33('0xb'),function(_0xf1e5e5,_0x5251b,_0x2b106e){logger[_0x2b33('0xc')](_0x5251b);logger[_0x2b33('0xc')](_0x2b106e);if(_0xf1e5e5){logger[_0x2b33('0x6')](_0xf1e5e5);return _0x1d83a6(_0xf1e5e5);}return _0x1be19d(_0x5251b);});});}exports['index']=function(_0x183773,_0xa44d45){return pm2[_0x2b33('0xd')]()['then'](function(_0x173c75){if(_0x173c75){var _0x4d39db=_[_0x2b33('0xe')](_0x173c75,function(_0x17292f){return _0x17292f[_0x2b33('0x8')]==='express'||_0x17292f['name']===_0x2b33('0xf');});return{'rows':_0x4d39db,'count':_0x4d39db[_0x2b33('0x10')]};}return null;})[_0x2b33('0x11')](respondWithResult(_0xa44d45,null))[_0x2b33('0x12')](handleError(_0xa44d45,null));};exports[_0x2b33('0x13')]=function(_0x4d69d0,_0x554ab3){return pm2['describe'](_0x4d69d0[_0x2b33('0x14')]['id'])['then'](respondWithResult(_0x554ab3,null))['then'](handleEntityNotFound(_0x554ab3,null))[_0x2b33('0x12')](handleError(_0x554ab3,null));};exports[_0x2b33('0x15')]=function(_0x205d8f,_0x539c5f){if(_0x205d8f[_0x2b33('0x16')]['name']&&_0x205d8f[_0x2b33('0x16')][_0x2b33('0x17')]){var _0x8c8dc2=path[_0x2b33('0x18')](__dirname,_0x2b33('0x19'),_0x205d8f[_0x2b33('0x16')][_0x2b33('0x17')]);var _0x4fb725=process[_0x2b33('0x1a')]();process[_0x2b33('0x1b')](path[_0x2b33('0x1c')](_0x8c8dc2));return execChildProcess()[_0x2b33('0x11')](function(_0x58998e){process[_0x2b33('0x1b')](_0x4fb725);return pm2[_0x2b33('0x1d')]({'name':_0x205d8f[_0x2b33('0x16')]['name'],'script':_0x8c8dc2});})[_0x2b33('0x11')](function(_0x1b9a48){pm2[_0x2b33('0x1e')]();return _0x1b9a48[0x0];})[_0x2b33('0x11')](respondWithResult(_0x539c5f,0xc9))['catch'](handleError(_0x539c5f,null));}else{return _0x539c5f[_0x2b33('0x9')](0x1f4)['send']({'message':_0x2b33('0x1f')});}};exports['update']=function(_0x2e74d0,_0x341e0e){if(_0x2e74d0['body']['id']){delete _0x2e74d0[_0x2b33('0x16')]['id'];}var _0x53c2ad={'online':_0x2b33('0x20'),'stopped':'stop'};if(_0x53c2ad[_0x2b33('0x21')](_0x2e74d0[_0x2b33('0x16')][_0x2b33('0x9')])){return pm2[_0x53c2ad[_0x2e74d0[_0x2b33('0x16')][_0x2b33('0x9')]]](_0x2e74d0[_0x2b33('0x14')]['id'])[_0x2b33('0x11')](respondWithResult(_0x341e0e,0xc8))[_0x2b33('0x12')](handleError(_0x341e0e,null));}else{return _0x341e0e[_0x2b33('0x9')](0x1f4)[_0x2b33('0xa')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x106ea0,_0x2a081c){if(_0x106ea0[_0x2b33('0x16')]['id']){delete _0x106ea0[_0x2b33('0x16')]['id'];}if(_0x106ea0[_0x2b33('0x14')]['id']){return pm2['delete'](_0x106ea0['params']['id'])[_0x2b33('0x11')](function(_0x3d2aaa){pm2[_0x2b33('0x1e')]();return _0x3d2aaa[0x0];})[_0x2b33('0x11')](respondWithResult(_0x2a081c,null))[_0x2b33('0x12')](handleError(_0x2a081c,null));}else{return _0x2a081c[_0x2b33('0x9')](0x1f4)['send']({'message':_0x2b33('0x22')});}}; \ No newline at end of file +var _0x0fd9=['error','index','list','reject','express','then','catch','describe','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','hasOwnProperty','Unknown\x20status','params','Unknown\x20id','../../config/pm2','../../config/logger','api','path','bluebird','sendStatus','status','stack','name','send','npm\x20install','info'];(function(_0x510ffc,_0x1faa19){var _0xf4ef62=function(_0x1fec4d){while(--_0x1fec4d){_0x510ffc['push'](_0x510ffc['shift']());}};_0xf4ef62(++_0x1faa19);}(_0x0fd9,0xa3));var _0x90fd=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x0fd9[_0x519756];return _0x37047e;};'use strict';var _=require('lodash');var pm2=require(_0x90fd('0x0'));var logger=require(_0x90fd('0x1'))(_0x90fd('0x2'));var path=require(_0x90fd('0x3'));var exec=require('child_process')['exec'];var BPromise=require(_0x90fd('0x4'));function handleEntityNotFound(_0x2a5f76,_0xb7cf6){return function(_0x37a8be){if(!_0x37a8be){_0x2a5f76[_0x90fd('0x5')](0x194);;}return _0x37a8be;};}function respondWithResult(_0x23e11b,_0x5e2107){_0x5e2107=_0x5e2107||0xc8;return function(_0x4ff2d4){if(_0x4ff2d4){return _0x23e11b[_0x90fd('0x6')](_0x5e2107)['json'](_0x4ff2d4);}return null;};}function handleError(_0x5a604a,_0x2acef7){_0x2acef7=_0x2acef7||0x1f4;return function(_0x1becf2){logger['error'](_0x1becf2[_0x90fd('0x7')]);if(_0x1becf2[_0x90fd('0x8')]){delete _0x1becf2[_0x90fd('0x8')];}_0x5a604a[_0x90fd('0x6')](_0x2acef7)[_0x90fd('0x9')](_0x1becf2);};}function execChildProcess(){return new BPromise(function(_0x3be346,_0x2aae77){exec(_0x90fd('0xa'),function(_0x3c541e,_0x48943e,_0x23c417){logger[_0x90fd('0xb')](_0x48943e);logger['info'](_0x23c417);if(_0x3c541e){logger[_0x90fd('0xc')](_0x3c541e);return _0x2aae77(_0x3c541e);}return _0x3be346(_0x48943e);});});}exports[_0x90fd('0xd')]=function(_0x19a594,_0x5f28ab){return pm2[_0x90fd('0xe')]()['then'](function(_0x1cae40){if(_0x1cae40){var _0xb402d9=_[_0x90fd('0xf')](_0x1cae40,function(_0x1b3f3b){return _0x1b3f3b[_0x90fd('0x8')]===_0x90fd('0x10')||_0x1b3f3b[_0x90fd('0x8')]==='motion2';});return{'rows':_0xb402d9,'count':_0xb402d9['length']};}return null;})[_0x90fd('0x11')](respondWithResult(_0x5f28ab,null))[_0x90fd('0x12')](handleError(_0x5f28ab,null));};exports['show']=function(_0x130489,_0x13a694){return pm2[_0x90fd('0x13')](_0x130489['params']['id'])[_0x90fd('0x11')](respondWithResult(_0x13a694,null))[_0x90fd('0x11')](handleEntityNotFound(_0x13a694,null))[_0x90fd('0x12')](handleError(_0x13a694,null));};exports[_0x90fd('0x14')]=function(_0x251957,_0x58866f){if(_0x251957[_0x90fd('0x15')][_0x90fd('0x8')]&&_0x251957[_0x90fd('0x15')][_0x90fd('0x16')]){var _0x19e79b=path[_0x90fd('0x17')](__dirname,_0x90fd('0x18'),_0x251957[_0x90fd('0x15')][_0x90fd('0x16')]);var _0x493c26=process[_0x90fd('0x19')]();process[_0x90fd('0x1a')](path[_0x90fd('0x1b')](_0x19e79b));return execChildProcess()[_0x90fd('0x11')](function(_0x411a6a){process[_0x90fd('0x1a')](_0x493c26);return pm2[_0x90fd('0x1c')]({'name':_0x251957[_0x90fd('0x15')]['name'],'script':_0x19e79b});})[_0x90fd('0x11')](function(_0x52b066){pm2[_0x90fd('0x1d')]();return _0x52b066[0x0];})[_0x90fd('0x11')](respondWithResult(_0x58866f,0xc9))[_0x90fd('0x12')](handleError(_0x58866f,null));}else{return _0x58866f[_0x90fd('0x6')](0x1f4)[_0x90fd('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x90fd('0x1e')]=function(_0xe333f0,_0x2fffe6){if(_0xe333f0[_0x90fd('0x15')]['id']){delete _0xe333f0[_0x90fd('0x15')]['id'];}var _0x428bc2={'online':'restart','stopped':'stop'};if(_0x428bc2[_0x90fd('0x1f')](_0xe333f0[_0x90fd('0x15')][_0x90fd('0x6')])){return pm2[_0x428bc2[_0xe333f0[_0x90fd('0x15')][_0x90fd('0x6')]]](_0xe333f0['params']['id'])['then'](respondWithResult(_0x2fffe6,0xc8))[_0x90fd('0x12')](handleError(_0x2fffe6,null));}else{return _0x2fffe6[_0x90fd('0x6')](0x1f4)[_0x90fd('0x9')]({'message':_0x90fd('0x20')});}};exports['destroy']=function(_0x59aede,_0x12dea4){if(_0x59aede[_0x90fd('0x15')]['id']){delete _0x59aede[_0x90fd('0x15')]['id'];}if(_0x59aede[_0x90fd('0x21')]['id']){return pm2['delete'](_0x59aede[_0x90fd('0x21')]['id'])[_0x90fd('0x11')](function(_0x7fb8bc){pm2[_0x90fd('0x1d')]();return _0x7fb8bc[0x0];})[_0x90fd('0x11')](respondWithResult(_0x12dea4,null))[_0x90fd('0x12')](handleError(_0x12dea4,null));}else{return _0x12dea4[_0x90fd('0x6')](0x1f4)[_0x90fd('0x9')]({'message':_0x90fd('0x22')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 6d8dda6..e7705c4 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 _0x4a08=['exports','express','../../components/auth/service','./realtime.controller','get','getQueues'];(function(_0x8efceb,_0x163aaa){var _0x26b6fd=function(_0x41205d){while(--_0x41205d){_0x8efceb['push'](_0x8efceb['shift']());}};_0x26b6fd(++_0x163aaa);}(_0x4a08,0x11b));var _0x84a0=function(_0x4b0e15,_0x3616af){_0x4b0e15=_0x4b0e15-0x0;var _0x13fae3=_0x4a08[_0x4b0e15];return _0x13fae3;};'use strict';var express=require(_0x84a0('0x0'));var router=express['Router']();var auth=require(_0x84a0('0x1'));var controller=require(_0x84a0('0x2'));router[_0x84a0('0x3')]('/queues',auth['isAuthenticated'](),controller[_0x84a0('0x4')]);module[_0x84a0('0x5')]=router; \ No newline at end of file +var _0xf5b6=['get','/queues','getQueues','exports','../../components/auth/service','./realtime.controller'];(function(_0x3c1b2d,_0x23b1b9){var _0x412475=function(_0x1245ad){while(--_0x1245ad){_0x3c1b2d['push'](_0x3c1b2d['shift']());}};_0x412475(++_0x23b1b9);}(_0xf5b6,0x1b4));var _0x6f5b=function(_0x390cc,_0x153450){_0x390cc=_0x390cc-0x0;var _0x1ab51c=_0xf5b6[_0x390cc];return _0x1ab51c;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x6f5b('0x0'));var controller=require(_0x6f5b('0x1'));router[_0x6f5b('0x2')](_0x6f5b('0x3'),auth['isAuthenticated'](),controller[_0x6f5b('0x4')]);module[_0x6f5b('0x5')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 31aafb3..e29b7ee 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 _0x0295=['getOptions','user','role','QueueCampaigns','startCase','Queues','filter','UserProfile','getResources','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','talking','outbound','push','pTalking','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','rows','get','paused','loggedInDb','waiting','find','pick','getMembers','length','UserId','online','User','Queue','Pause','findAll','QueueId','map','agent','agents','all','catch','util','../../components/parsers/qs','../../mysqldb','client','http','undefined','count','offset','limit','status','set','Content-Range','name','send','getQueues','mail','chat','sms','openchannel','fax','whatsapp','voice','resolve','then','query','channel','includes','toLowerCase','rawAttributes','fieldName','type','key'];(function(_0x257eca,_0x516bf9){var _0xb8a3d3=function(_0x8a9dbb){while(--_0x8a9dbb){_0x257eca['push'](_0x257eca['shift']());}};_0xb8a3d3(++_0x516bf9);}(_0x0295,0x1f0));var _0x5029=function(_0x2f6e47,_0x40ba6b){_0x2f6e47=_0x2f6e47-0x0;var _0x29c331=_0x0295[_0x2f6e47];return _0x29c331;};'use strict';var util=require(_0x5029('0x0'));var _=require('lodash');var jayson=require('jayson/promise');var qs=require(_0x5029('0x1'));var logger=require('../../config/logger')('api');var db=require(_0x5029('0x2'))['db'];var client=jayson[_0x5029('0x3')][_0x5029('0x4')]({'port':0x232a});var routingClient=jayson[_0x5029('0x3')][_0x5029('0x4')]({'port':0x232c});function respondWithFilteredResult(_0x69a497,_0x200217){return function(_0x215955){if(_0x215955){var _0x5b3cd=typeof _0x200217['offset']==='undefined'&&typeof _0x200217['limit']===_0x5029('0x5');var _0x4fef7a=_0x215955[_0x5029('0x6')];var _0x5bccfc=_0x5b3cd?0x0:_0x200217[_0x5029('0x7')];var _0x520bc3=_0x5b3cd?_0x215955[_0x5029('0x6')]:_0x200217[_0x5029('0x7')]+_0x200217[_0x5029('0x8')];var _0x52fa95;if(_0x520bc3>=_0x4fef7a){_0x520bc3=_0x4fef7a;_0x52fa95=0xc8;}else{_0x52fa95=0xce;}_0x69a497[_0x5029('0x9')](_0x52fa95);return _0x69a497[_0x5029('0xa')](_0x5029('0xb'),_0x5bccfc+'-'+_0x520bc3+'/'+_0x4fef7a)['json'](_0x215955);}return null;};}function handleError(_0x3bc005,_0x2442b2){_0x2442b2=_0x2442b2||0x1f4;return function(_0x4cced9){logger['error'](_0x4cced9['stack']);if(_0x4cced9['name']){delete _0x4cced9[_0x5029('0xc')];}_0x3bc005[_0x5029('0x9')](_0x2442b2)[_0x5029('0xd')](_0x4cced9);};}exports[_0x5029('0xe')]=function(_0x2c0b33,_0x11c24b){var _0xe278b7=[_0x5029('0xf'),_0x5029('0x10'),_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),_0x5029('0x14'),_0x5029('0x15')];var _0x343918={'count':0x0,'rows':[]},_0x4f7ab4={},_0x1ed567;Promise[_0x5029('0x16')]()[_0x5029('0x17')](function(){if(_0x2c0b33[_0x5029('0x18')][_0x5029('0x19')]){if(!_[_0x5029('0x1a')](_0xe278b7,_0x2c0b33[_0x5029('0x18')]['channel'][_0x5029('0x1b')]()))throw new Error('Invalid\x20channel');_0x1ed567=_0x2c0b33[_0x5029('0x18')][_0x5029('0x19')][_0x5029('0x1b')]();}var _0x3cf0fb=_['startCase'](_0x1ed567)+'Queue';var _0x4c9184=_['map'](db[_0x3cf0fb][_0x5029('0x1c')],function(_0x853a34){return{'name':_0x853a34[_0x5029('0x1d')],'type':_0x853a34[_0x5029('0x1e')][_0x5029('0x1f')]};});_0x4f7ab4=qs[_0x5029('0x20')](_0x4c9184,_0x2c0b33);if(_0x2c0b33[_0x5029('0x21')][_0x5029('0x22')]===_0x5029('0x21')){var _0x4ceaae={'params':{'id':_0x2c0b33['user']['userProfileId']},'query':{'section':_0x1ed567===_0x5029('0x15')&&_0x2c0b33[_0x5029('0x18')]['type']==='outbound'?_0x5029('0x23'):_[_0x5029('0x24')](_0x1ed567)+_0x5029('0x25'),'type':_0x2c0b33['query'][_0x5029('0x1e')],'nolimit':!![],'sort':_0x5029('0xc'),'filter':_0x2c0b33['query'][_0x5029('0x26')]}};return db[_0x5029('0x27')][_0x5029('0x28')](_0x4ceaae);}return db[_0x3cf0fb]['findAndCountAll'](_0x4f7ab4);})[_0x5029('0x17')](function(_0x251f99){_0x343918[_0x5029('0x6')]=_0x251f99['count'];var _0x2cedf6=_0x1ed567===_0x5029('0x15')?client:routingClient;return _0x2cedf6['request'](_[_0x5029('0x24')](_0x1ed567)+_0x5029('0x25'),_0x2c0b33)[_0x5029('0x17')](function(_0x1c3dd9){if(_0x1c3dd9[_0x5029('0x29')])throw new Error(util[_0x5029('0x2a')](_0x5029('0x2b'),_0x1ed567));var _0x465153=_0x1c3dd9[_0x5029('0x2c')];var _0x22559a=[_0x5029('0x2d'),_0x5029('0x2e'),'waiting',_0x5029('0x2f'),'paused'];if(_0x1ed567===_0x5029('0x15')&&_0x2c0b33['query']['type']===_0x5029('0x30')){_0x22559a[_0x5029('0x31')](_0x5029('0x32'),'originated',_0x5029('0x33'),_0x5029('0x34'),_0x5029('0x35'),_0x5029('0x36'),_0x5029('0x37'),_0x5029('0x38'),_0x5029('0x39'),_0x5029('0x3a'),_0x5029('0x3b'),'erlangBusyFactor',_0x5029('0x3c'),_0x5029('0x3d'),_0x5029('0x3e'),_0x5029('0x3f'),'predictiveIntervalTotalCalls',_0x5029('0x40'),_0x5029('0x41'),_0x5029('0x42'),'predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime');}var _0x2d1ccb=_0x251f99[_0x5029('0x43')]['map'](function(_0x57784c){var _0x9656f2=_0x57784c[_0x5029('0x44')]({'plain':!![]});_0x9656f2[_0x5029('0x45')]=0x0;_0x9656f2[_0x5029('0x46')]=0x0;_0x9656f2[_0x5029('0x2d')]=0x0;_0x9656f2[_0x5029('0x2e')]=0x0;_0x9656f2[_0x5029('0x45')]=0x0;_0x9656f2[_0x5029('0x47')]=0x0;if(_0x1ed567===_0x5029('0x15')){_0x9656f2[_0x5029('0x2f')]=0x0;if(_0x2c0b33[_0x5029('0x18')][_0x5029('0x1e')]===_0x5029('0x30')){_0x9656f2[_0x5029('0x32')]=0x0;_0x9656f2['originated']=0x0;}}_0x9656f2['agents']=[];var _0x73797c=_[_0x5029('0x48')](_0x465153[_0x5029('0x43')],['id',_0x9656f2['id']]);if(_0x73797c)_['merge'](_0x9656f2,_[_0x5029('0x49')](_0x73797c,_0x22559a));if(_0x1ed567===_0x5029('0x15')){return _0x57784c['getAgents']({'attributes':['id',_0x5029('0xc'),'online'],'joinTableAttributes':[],'raw':!![]})[_0x5029('0x17')](function(_0x5653cb){return _0x57784c[_0x5029('0x4a')]({'raw':!![]})[_0x5029('0x17')](function(_0x24a18d){for(var _0x78768=0x0;_0x78768<_0x5653cb[_0x5029('0x4b')];_0x78768++){var _0x2c490b=_[_0x5029('0x48')](_0x24a18d,[_0x5029('0x4c'),_0x5653cb[_0x78768]['id']]);var _0x2ae047={'id':_0x5653cb[_0x78768]['id'],'name':_0x5653cb[_0x78768]['name'],'online':Boolean(_0x5653cb[_0x78768][_0x5029('0x4d')]),'paused':_0x2c490b?Boolean(_0x2c490b[_0x5029('0x45')]):![]};if(_0x2ae047[_0x5029('0x4d')])_0x9656f2[_0x5029('0x46')]++;if(_0x2ae047[_0x5029('0x45')])_0x9656f2[_0x5029('0x45')]++;_0x9656f2['agents'][_0x5029('0x31')](_0x2ae047);}return _0x9656f2;});});}else{var _0xa1580a=_0x5029('0x4e')+_[_0x5029('0x24')](_0x1ed567)+_0x5029('0x4f');var _0x4c859e=_0x1ed567+_0x5029('0x50');return db[_0xa1580a][_0x5029('0x51')]({'where':{[_[_0x5029('0x24')](_0x1ed567)+_0x5029('0x52')]:_0x57784c['id']},'raw':!![]})[_0x5029('0x17')](function(_0x128aff){return db[_0x5029('0x4e')][_0x5029('0x51')]({'attributes':['id',_0x5029('0xc'),'online',_0x4c859e],'where':{'id':_[_0x5029('0x53')](_0x128aff,_0x5029('0x4c')),'role':_0x5029('0x54')},'raw':!![]});})[_0x5029('0x17')](function(_0x4e3905){for(var _0x50d7c2=0x0;_0x50d7c2<_0x4e3905[_0x5029('0x4b')];_0x50d7c2++){var _0x6185aa={'id':_0x4e3905[_0x50d7c2]['id'],'name':_0x4e3905[_0x50d7c2][_0x5029('0xc')],'online':Boolean(_0x4e3905[_0x50d7c2][_0x5029('0x4d')]),'paused':Boolean(_0x4e3905[_0x50d7c2][_0x4c859e])};if(_0x6185aa[_0x5029('0x4d')])_0x9656f2[_0x5029('0x46')]++;if(_0x6185aa[_0x5029('0x45')])_0x9656f2[_0x5029('0x45')]++;_0x9656f2[_0x5029('0x55')][_0x5029('0x31')](_0x6185aa);}return _0x9656f2;});}});return Promise[_0x5029('0x56')](_0x2d1ccb);});})[_0x5029('0x17')](function(_0x449ef5){_0x343918[_0x5029('0x43')]=_0x449ef5;return _0x343918;})[_0x5029('0x17')](respondWithFilteredResult(_0x11c24b,_0x4f7ab4))[_0x5029('0x57')](handleError(_0x11c24b,null));}; \ No newline at end of file +var _0x5334=['Queues','UserProfile','findAndCountAll','voice','request','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','waiting','talking','paused','push','pTalking','originated','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','map','get','agents','pick','getAgents','online','getMembers','length','UserId','loggedInDb','User','Pause','findAll','catch','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','../../mysqldb','http','client','limit','undefined','count','offset','status','Content-Range','error','name','send','mail','chat','openchannel','fax','whatsapp','resolve','query','channel','toLowerCase','startCase','Queue','rawAttributes','fieldName','getOptions','user','userProfileId','type','outbound','QueueCampaigns'];(function(_0x57c6c1,_0x359351){var _0x1b1e7c=function(_0x3b7542){while(--_0x3b7542){_0x57c6c1['push'](_0x57c6c1['shift']());}};_0x1b1e7c(++_0x359351);}(_0x5334,0x84));var _0x4533=function(_0x345e6a,_0x16ef53){_0x345e6a=_0x345e6a-0x0;var _0x186d5b=_0x5334[_0x345e6a];return _0x186d5b;};'use strict';var util=require(_0x4533('0x0'));var _=require(_0x4533('0x1'));var jayson=require(_0x4533('0x2'));var qs=require(_0x4533('0x3'));var logger=require(_0x4533('0x4'))('api');var db=require(_0x4533('0x5'))['db'];var client=jayson['client'][_0x4533('0x6')]({'port':0x232a});var routingClient=jayson[_0x4533('0x7')]['http']({'port':0x232c});function respondWithFilteredResult(_0x4a576a,_0x51b4ce){return function(_0x201673){if(_0x201673){var _0x4dea06=typeof _0x51b4ce['offset']==='undefined'&&typeof _0x51b4ce[_0x4533('0x8')]===_0x4533('0x9');var _0x300877=_0x201673[_0x4533('0xa')];var _0x31018b=_0x4dea06?0x0:_0x51b4ce[_0x4533('0xb')];var _0xd417=_0x4dea06?_0x201673['count']:_0x51b4ce[_0x4533('0xb')]+_0x51b4ce[_0x4533('0x8')];var _0x1b52ee;if(_0xd417>=_0x300877){_0xd417=_0x300877;_0x1b52ee=0xc8;}else{_0x1b52ee=0xce;}_0x4a576a[_0x4533('0xc')](_0x1b52ee);return _0x4a576a['set'](_0x4533('0xd'),_0x31018b+'-'+_0xd417+'/'+_0x300877)['json'](_0x201673);}return null;};}function handleError(_0xc63e3,_0x439210){_0x439210=_0x439210||0x1f4;return function(_0x45ba67){logger[_0x4533('0xe')](_0x45ba67['stack']);if(_0x45ba67[_0x4533('0xf')]){delete _0x45ba67[_0x4533('0xf')];}_0xc63e3[_0x4533('0xc')](_0x439210)[_0x4533('0x10')](_0x45ba67);};}exports['getQueues']=function(_0xe47213,_0x573d84){var _0x4c703c=[_0x4533('0x11'),_0x4533('0x12'),'sms',_0x4533('0x13'),_0x4533('0x14'),_0x4533('0x15'),'voice'];var _0x3ed873={'count':0x0,'rows':[]},_0x4f732e={},_0x3ddb36;Promise[_0x4533('0x16')]()['then'](function(){if(_0xe47213[_0x4533('0x17')]['channel']){if(!_['includes'](_0x4c703c,_0xe47213[_0x4533('0x17')][_0x4533('0x18')]['toLowerCase']()))throw new Error('Invalid\x20channel');_0x3ddb36=_0xe47213[_0x4533('0x17')][_0x4533('0x18')][_0x4533('0x19')]();}var _0x1b08fa=_[_0x4533('0x1a')](_0x3ddb36)+_0x4533('0x1b');var _0x12adde=_['map'](db[_0x1b08fa][_0x4533('0x1c')],function(_0xd55c04){return{'name':_0xd55c04[_0x4533('0x1d')],'type':_0xd55c04['type']['key']};});_0x4f732e=qs[_0x4533('0x1e')](_0x12adde,_0xe47213);if(_0xe47213[_0x4533('0x1f')]['role']==='user'){var _0x307bdd={'params':{'id':_0xe47213[_0x4533('0x1f')][_0x4533('0x20')]},'query':{'section':_0x3ddb36==='voice'&&_0xe47213[_0x4533('0x17')][_0x4533('0x21')]===_0x4533('0x22')?_0x4533('0x23'):_[_0x4533('0x1a')](_0x3ddb36)+_0x4533('0x24'),'type':_0xe47213[_0x4533('0x17')][_0x4533('0x21')],'nolimit':!![],'sort':_0x4533('0xf'),'filter':_0xe47213['query']['filter']}};return db[_0x4533('0x25')]['getResources'](_0x307bdd);}return db[_0x1b08fa][_0x4533('0x26')](_0x4f732e);})['then'](function(_0x159fea){_0x3ed873[_0x4533('0xa')]=_0x159fea[_0x4533('0xa')];var _0x4300c1=_0x3ddb36===_0x4533('0x27')?client:routingClient;return _0x4300c1[_0x4533('0x28')](_[_0x4533('0x1a')](_0x3ddb36)+_0x4533('0x24'),_0xe47213)[_0x4533('0x29')](function(_0x43682f){if(_0x43682f[_0x4533('0xe')])throw new Error(util[_0x4533('0x2a')](_0x4533('0x2b'),_0x3ddb36));var _0x5bea54=_0x43682f[_0x4533('0x2c')];var _0x50e1b8=[_0x4533('0x2d'),_0x4533('0x2e'),_0x4533('0x2f'),_0x4533('0x30'),_0x4533('0x31')];if(_0x3ddb36===_0x4533('0x27')&&_0xe47213[_0x4533('0x17')][_0x4533('0x21')]===_0x4533('0x22')){_0x50e1b8[_0x4533('0x32')](_0x4533('0x33'),_0x4533('0x34'),'message',_0x4533('0x35'),_0x4533('0x36'),_0x4533('0x37'),_0x4533('0x38'),_0x4533('0x39'),'erlangCalls',_0x4533('0x3a'),_0x4533('0x3b'),_0x4533('0x3c'),_0x4533('0x3d'),_0x4533('0x3e'),_0x4533('0x3f'),'predictiveIntervalAvailable',_0x4533('0x40'),_0x4533('0x41'),'predictiveIntervalDroppedCallsTimeout',_0x4533('0x42'),_0x4533('0x43'),_0x4533('0x44'));}var _0x2f4943=_0x159fea[_0x4533('0x45')][_0x4533('0x46')](function(_0x424924){var _0x603753=_0x424924[_0x4533('0x47')]({'plain':!![]});_0x603753[_0x4533('0x31')]=0x0;_0x603753['loggedInDb']=0x0;_0x603753[_0x4533('0x2d')]=0x0;_0x603753[_0x4533('0x2e')]=0x0;_0x603753[_0x4533('0x31')]=0x0;_0x603753[_0x4533('0x2f')]=0x0;if(_0x3ddb36===_0x4533('0x27')){_0x603753[_0x4533('0x30')]=0x0;if(_0xe47213[_0x4533('0x17')][_0x4533('0x21')]===_0x4533('0x22')){_0x603753[_0x4533('0x33')]=0x0;_0x603753[_0x4533('0x34')]=0x0;}}_0x603753[_0x4533('0x48')]=[];var _0x495c26=_['find'](_0x5bea54[_0x4533('0x45')],['id',_0x603753['id']]);if(_0x495c26)_['merge'](_0x603753,_[_0x4533('0x49')](_0x495c26,_0x50e1b8));if(_0x3ddb36===_0x4533('0x27')){return _0x424924[_0x4533('0x4a')]({'attributes':['id',_0x4533('0xf'),_0x4533('0x4b')],'joinTableAttributes':[],'raw':!![]})[_0x4533('0x29')](function(_0x2df795){return _0x424924[_0x4533('0x4c')]({'raw':!![]})[_0x4533('0x29')](function(_0x44e754){for(var _0x44013d=0x0;_0x44013d<_0x2df795[_0x4533('0x4d')];_0x44013d++){var _0x10c03f=_['find'](_0x44e754,[_0x4533('0x4e'),_0x2df795[_0x44013d]['id']]);var _0x556dd9={'id':_0x2df795[_0x44013d]['id'],'name':_0x2df795[_0x44013d]['name'],'online':Boolean(_0x2df795[_0x44013d]['online']),'paused':_0x10c03f?Boolean(_0x10c03f['paused']):![]};if(_0x556dd9[_0x4533('0x4b')])_0x603753[_0x4533('0x4f')]++;if(_0x556dd9[_0x4533('0x31')])_0x603753[_0x4533('0x31')]++;_0x603753['agents'][_0x4533('0x32')](_0x556dd9);}return _0x603753;});});}else{var _0x369284=_0x4533('0x50')+_[_0x4533('0x1a')](_0x3ddb36)+_0x4533('0x1b');var _0x24e8de=_0x3ddb36+_0x4533('0x51');return db[_0x369284]['findAll']({'where':{[_[_0x4533('0x1a')](_0x3ddb36)+'QueueId']:_0x424924['id']},'raw':!![]})['then'](function(_0xbd54df){return db[_0x4533('0x50')][_0x4533('0x52')]({'attributes':['id',_0x4533('0xf'),'online',_0x24e8de],'where':{'id':_['map'](_0xbd54df,_0x4533('0x4e')),'role':'agent'},'raw':!![]});})[_0x4533('0x29')](function(_0x45b729){for(var _0x4e46c5=0x0;_0x4e46c5<_0x45b729['length'];_0x4e46c5++){var _0x55901c={'id':_0x45b729[_0x4e46c5]['id'],'name':_0x45b729[_0x4e46c5]['name'],'online':Boolean(_0x45b729[_0x4e46c5]['online']),'paused':Boolean(_0x45b729[_0x4e46c5][_0x24e8de])};if(_0x55901c[_0x4533('0x4b')])_0x603753['loggedInDb']++;if(_0x55901c[_0x4533('0x31')])_0x603753['paused']++;_0x603753[_0x4533('0x48')]['push'](_0x55901c);}return _0x603753;});}});return Promise['all'](_0x2f4943);});})[_0x4533('0x29')](function(_0x503eb4){_0x3ed873[_0x4533('0x45')]=_0x503eb4;return _0x3ed873;})['then'](respondWithFilteredResult(_0x573d84,_0x4f732e))[_0x4533('0x53')](handleError(_0x573d84,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 414924a..82f7d3c 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x406738,_0x3dbc07){var _0x3a76ca=function(_0x3307c7){while(--_0x3307c7){_0x406738['push'](_0x406738['shift']());}};_0x3a76ca(++_0x3dbc07);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x265094,_0x18c961){var _0x71f9c2=function(_0x548e38){while(--_0x548e38){_0x265094['push'](_0x265094['shift']());}};_0x71f9c2(++_0x18c961);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 785d6a4..7b45a3b 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 _0x0272=['INTEGER','sequelize','exports','STRING','DATE'];(function(_0x2bf9fe,_0x2014e4){var _0x599bfd=function(_0x24f2ab){while(--_0x24f2ab){_0x2bf9fe['push'](_0x2bf9fe['shift']());}};_0x599bfd(++_0x2014e4);}(_0x0272,0x15a));var _0x2027=function(_0x4dce28,_0x553b6f){_0x4dce28=_0x4dce28-0x0;var _0xf13e62=_0x0272[_0x4dce28];return _0xf13e62;};'use strict';var Sequelize=require(_0x2027('0x0'));module[_0x2027('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x2027('0x2')]},'scheduledat':{'type':Sequelize[_0x2027('0x3')]},'uniqueid':{'type':Sequelize[_0x2027('0x2')]},'starttime':{'type':Sequelize[_0x2027('0x3')]},'responsetime':{'type':Sequelize[_0x2027('0x3')]},'ringtime':{'type':Sequelize[_0x2027('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2027('0x2')]}}; \ No newline at end of file +var _0x5496=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x3182f0,_0x22236d){var _0x5adfc1=function(_0x28f6e5){while(--_0x28f6e5){_0x3182f0['push'](_0x3182f0['shift']());}};_0x5adfc1(++_0x22236d);}(_0x5496,0x175));var _0x6549=function(_0x35f73b,_0x1f48da){_0x35f73b=_0x35f73b-0x0;var _0x33e129=_0x5496[_0x35f73b];return _0x33e129;};'use strict';var Sequelize=require(_0x6549('0x0'));module[_0x6549('0x1')]={'state':{'type':Sequelize[_0x6549('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6549('0x3')]},'scheduledat':{'type':Sequelize[_0x6549('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6549('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x6549('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6549('0x3')]},'campaigntype':{'type':Sequelize[_0x6549('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 64bcf3c..a139442 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 _0xb7b7=['ReportAgentPreview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7b7,0x175));var _0x7b7b=function(_0x5cbc72,_0x372ed6){_0x5cbc72=_0x5cbc72-0x0;var _0x598352=_0xb7b7[_0x5cbc72];return _0x598352;};'use strict';var _=require(_0x7b7b('0x0'));var util=require(_0x7b7b('0x1'));var logger=require(_0x7b7b('0x2'))(_0x7b7b('0x3'));var moment=require(_0x7b7b('0x4'));var BPromise=require(_0x7b7b('0x5'));var rp=require(_0x7b7b('0x6'));var fs=require('fs');var path=require(_0x7b7b('0x7'));var rimraf=require('rimraf');var config=require(_0x7b7b('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0x7b7b('0x9')]=function(_0x43e4b9,_0x580663){return _0x43e4b9[_0x7b7b('0xa')](_0x7b7b('0xb'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89b2=['define','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','exports'];(function(_0x491296,_0x26fef2){var _0x1b0f2b=function(_0x29391b){while(--_0x29391b){_0x491296['push'](_0x491296['shift']());}};_0x1b0f2b(++_0x26fef2);}(_0x89b2,0xd3));var _0x289b=function(_0x7472aa,_0x3971a1){_0x7472aa=_0x7472aa-0x0;var _0x12e552=_0x89b2[_0x7472aa];return _0x12e552;};'use strict';var _=require('lodash');var util=require(_0x289b('0x0'));var logger=require(_0x289b('0x1'))('api');var moment=require(_0x289b('0x2'));var BPromise=require(_0x289b('0x3'));var rp=require(_0x289b('0x4'));var fs=require('fs');var path=require(_0x289b('0x5'));var rimraf=require(_0x289b('0x6'));var config=require('../../config/environment');var attributes=require(_0x289b('0x7'));module[_0x289b('0x8')]=function(_0x269c10,_0x2717a2){return _0x269c10[_0x289b('0x9')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','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 0ca65e1..b832fa4 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 _0x9a3c=['ReportAgentPreview','create','body','options','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ReportAgentPreview,\x20%s,\x20%s','result','catch'];(function(_0x1acb0b,_0x437eee){var _0x4b682d=function(_0x2eb2ac){while(--_0x2eb2ac){_0x1acb0b['push'](_0x1acb0b['shift']());}};_0x4b682d(++_0x437eee);}(_0x9a3c,0x10a));var _0xc9a3=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x9a3c[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0xc9a3('0x0'));var util=require(_0xc9a3('0x1'));var moment=require(_0xc9a3('0x2'));var BPromise=require(_0xc9a3('0x3'));var rs=require(_0xc9a3('0x4'));var fs=require('fs');var Redis=require(_0xc9a3('0x5'));var db=require(_0xc9a3('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc9a3('0x7'));var config=require(_0xc9a3('0x8'));var jayson=require(_0xc9a3('0x9'));var client=jayson['client'][_0xc9a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fc3ad,_0x3a9895,_0x18a28e){return new BPromise(function(_0x2382c6,_0x4f9131){return client[_0xc9a3('0xb')](_0x4fc3ad,_0x18a28e)[_0xc9a3('0xc')](function(_0xa95a23){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x3a9895,_0xc9a3('0xd'));logger[_0xc9a3('0xe')](_0xc9a3('0xf'),_0x3a9895,_0xc9a3('0xd'),JSON[_0xc9a3('0x10')](_0xa95a23));if(_0xa95a23[_0xc9a3('0x11')]){if(_0xa95a23[_0xc9a3('0x11')][_0xc9a3('0x12')]===0x1f4){logger[_0xc9a3('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x3a9895,_0xa95a23[_0xc9a3('0x11')]['message']);return _0x4f9131(_0xa95a23[_0xc9a3('0x11')][_0xc9a3('0x13')]);}logger[_0xc9a3('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x3a9895,_0xa95a23['error'][_0xc9a3('0x13')]);return _0x2382c6(_0xa95a23['error']['message']);}else{logger[_0xc9a3('0x14')](_0xc9a3('0x15'),_0x3a9895,_0xc9a3('0xd'));_0x2382c6(_0xa95a23[_0xc9a3('0x16')]['message']);}})[_0xc9a3('0x17')](function(_0x22e3fd){logger[_0xc9a3('0x11')](_0xc9a3('0x15'),_0x3a9895,_0x22e3fd);_0x4f9131(_0x22e3fd);});});}exports['CreateReportAgentPreview']=function(_0x452db5){var _0x3119b1=this;return new Promise(function(_0x20ba0f,_0x2e5e23){return db[_0xc9a3('0x18')][_0xc9a3('0x19')](_0x452db5[_0xc9a3('0x1a')],{'raw':_0x452db5[_0xc9a3('0x1b')]?_0x452db5[_0xc9a3('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xc9a3('0xc')](function(_0x2f3090){logger[_0xc9a3('0x14')](_0xc9a3('0x1c'),_0x452db5);logger[_0xc9a3('0xe')](_0xc9a3('0x1c'),_0x452db5,JSON[_0xc9a3('0x10')](_0x2f3090));_0x20ba0f(_0x2f3090);})[_0xc9a3('0x17')](function(_0x5aba46){logger[_0xc9a3('0x11')](_0xc9a3('0x1c'),_0x5aba46[_0xc9a3('0x13')],_0x452db5);_0x2e5e23(_0x3119b1['error'](0x1f4,_0x5aba46[_0xc9a3('0x13')]));});});}; \ No newline at end of file +var _0x8263=['options','raw','then','CreateReportAgentPreview','stringify','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ReportAgentPreview'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8263,0x1a9));var _0x3826=function(_0x2b9d86,_0x57629b){_0x2b9d86=_0x2b9d86-0x0;var _0x352b60=_0x8263[_0x2b9d86];return _0x352b60;};'use strict';var _=require(_0x3826('0x0'));var util=require('util');var moment=require(_0x3826('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3826('0x2'));var db=require(_0x3826('0x3'))['db'];var utils=require(_0x3826('0x4'));var logger=require(_0x3826('0x5'))(_0x3826('0x6'));var config=require(_0x3826('0x7'));var jayson=require(_0x3826('0x8'));var client=jayson[_0x3826('0x9')][_0x3826('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31f77e,_0x40fa61,_0x4e58f8){return new BPromise(function(_0x4160e5,_0x1cbf90){return client[_0x3826('0xb')](_0x31f77e,_0x4e58f8)['then'](function(_0xc74ed7){logger[_0x3826('0xc')](_0x3826('0xd'),_0x40fa61,_0x3826('0xe'));logger[_0x3826('0xf')](_0x3826('0x10'),_0x40fa61,_0x3826('0xe'),JSON['stringify'](_0xc74ed7));if(_0xc74ed7[_0x3826('0x11')]){if(_0xc74ed7[_0x3826('0x11')][_0x3826('0x12')]===0x1f4){logger['error'](_0x3826('0xd'),_0x40fa61,_0xc74ed7['error'][_0x3826('0x13')]);return _0x1cbf90(_0xc74ed7[_0x3826('0x11')][_0x3826('0x13')]);}logger[_0x3826('0x11')](_0x3826('0xd'),_0x40fa61,_0xc74ed7[_0x3826('0x11')]['message']);return _0x4160e5(_0xc74ed7[_0x3826('0x11')]['message']);}else{logger[_0x3826('0xc')](_0x3826('0xd'),_0x40fa61,_0x3826('0xe'));_0x4160e5(_0xc74ed7[_0x3826('0x14')][_0x3826('0x13')]);}})[_0x3826('0x15')](function(_0x4d4f0d){logger[_0x3826('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x40fa61,_0x4d4f0d);_0x1cbf90(_0x4d4f0d);});});}exports['CreateReportAgentPreview']=function(_0x49df41){var _0x1d42a3=this;return new Promise(function(_0x1e8e1e,_0x4d5df5){return db[_0x3826('0x16')]['create'](_0x49df41['body'],{'raw':_0x49df41[_0x3826('0x17')]?_0x49df41[_0x3826('0x17')][_0x3826('0x18')]===undefined?!![]:![]:!![]})[_0x3826('0x19')](function(_0x38df5e){logger['info'](_0x3826('0x1a'),_0x49df41);logger['debug']('CreateReportAgentPreview',_0x49df41,JSON[_0x3826('0x1b')](_0x38df5e));_0x1e8e1e(_0x38df5e);})[_0x3826('0x15')](function(_0x33d2e0){logger[_0x3826('0x11')](_0x3826('0x1a'),_0x33d2e0[_0x3826('0x13')],_0x49df41);_0x4d5df5(_0x1d42a3[_0x3826('0x11')](0x1f4,_0x33d2e0['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 3b99c07..a98cdc8 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 _0xe2fa=['agents','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','post','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','sms','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','exports','path','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/fax/queues','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','put','/outbound','/outbound/channels'];(function(_0x19128e,_0xb4b8b9){var _0x398f53=function(_0x2197c3){while(--_0x2197c3){_0x19128e['push'](_0x19128e['shift']());}};_0x398f53(++_0xb4b8b9);}(_0xe2fa,0x1e0));var _0xae2f=function(_0x5ee2c2,_0x309674){_0x5ee2c2=_0x5ee2c2-0x0;var _0x418e62=_0xe2fa[_0x5ee2c2];return _0x418e62;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xae2f('0x0'));var express=require('express');var router=express[_0xae2f('0x1')]();var auth=require(_0xae2f('0x2'));var controller=require(_0xae2f('0x3'));router[_0xae2f('0x4')]('/voice/channels',auth[_0xae2f('0x5')](),controller[_0xae2f('0x6')]);router[_0xae2f('0x4')](_0xae2f('0x7'),auth['isAuthenticated'](),controller[_0xae2f('0x8')]);router[_0xae2f('0x4')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0xae2f('0x9')]);router[_0xae2f('0x4')](_0xae2f('0xa'),auth[_0xae2f('0x5')](),controller[_0xae2f('0xb')]);router[_0xae2f('0x4')](_0xae2f('0xc'),auth[_0xae2f('0x5')](),controller['chatQueues']);router[_0xae2f('0x4')](_0xae2f('0xd'),auth[_0xae2f('0x5')](),controller[_0xae2f('0xe')]);router[_0xae2f('0x4')]('/mail/accounts',auth[_0xae2f('0x5')](),controller[_0xae2f('0xf')]);router['get'](_0xae2f('0x10'),auth[_0xae2f('0x5')](),controller['openchannelQueues']);router[_0xae2f('0x4')](_0xae2f('0x11'),auth['isAuthenticated'](),controller[_0xae2f('0x12')]);router[_0xae2f('0x4')]('/whatsapp/queues',auth[_0xae2f('0x5')](),controller['whatsappQueues']);router[_0xae2f('0x4')](_0xae2f('0x13'),auth['isAuthenticated'](),controller['faxQueues']);router['get']('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0xae2f('0x14')]);router['get'](_0xae2f('0x15'),auth[_0xae2f('0x5')](),controller['voiceQueuesChannels']);router['get'](_0xae2f('0x16'),auth[_0xae2f('0x5')](),controller[_0xae2f('0x17')]);router[_0xae2f('0x4')](_0xae2f('0x18'),auth[_0xae2f('0x5')](),controller[_0xae2f('0x19')]);router[_0xae2f('0x4')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xae2f('0x5')](),controller[_0xae2f('0x1a')]);router['get'](_0xae2f('0x1b'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0xae2f('0x1c')]('/voice/queues/:id',auth[_0xae2f('0x5')](),controller['updateVoiceQueue']);router[_0xae2f('0x4')](_0xae2f('0x1d'),auth[_0xae2f('0x5')](),controller['outbound']);router[_0xae2f('0x4')](_0xae2f('0x1e'),auth[_0xae2f('0x5')](),controller['outboundChannels']);router[_0xae2f('0x4')]('/agents',auth[_0xae2f('0x5')](),controller[_0xae2f('0x1f')]);router[_0xae2f('0x1c')](_0xae2f('0x20'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0xae2f('0x4')](_0xae2f('0x21'),auth['isAuthenticated'](),controller[_0xae2f('0x22')]);router[_0xae2f('0x4')](_0xae2f('0x23'),auth['isAuthenticated'](),controller[_0xae2f('0x24')]);router[_0xae2f('0x4')](_0xae2f('0x25'),auth[_0xae2f('0x5')](),controller[_0xae2f('0x26')]);router['get'](_0xae2f('0x27'),auth['isAuthenticated'](),controller['faxAccounts']);router[_0xae2f('0x4')](_0xae2f('0x28'),auth[_0xae2f('0x5')](),controller[_0xae2f('0x29')]);router[_0xae2f('0x4')](_0xae2f('0x2a'),auth[_0xae2f('0x5')](),controller['mailQueuesWaitingInteractions']);router['get'](_0xae2f('0x2b'),auth[_0xae2f('0x5')](),controller[_0xae2f('0x2c')]);router[_0xae2f('0x4')](_0xae2f('0x2d'),auth[_0xae2f('0x5')](),controller[_0xae2f('0x2e')]);router[_0xae2f('0x4')](_0xae2f('0x2f'),auth[_0xae2f('0x5')](),controller[_0xae2f('0x30')]);router[_0xae2f('0x4')](_0xae2f('0x31'),auth['isAuthenticated'](),controller[_0xae2f('0x32')]);router[_0xae2f('0x4')](_0xae2f('0x33'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router['post'](_0xae2f('0x34'),auth[_0xae2f('0x5')](),controller[_0xae2f('0x35')](_0xae2f('0x36')));router[_0xae2f('0x4')]('/mail/queues/:id',auth[_0xae2f('0x5')](),controller[_0xae2f('0x37')]);router[_0xae2f('0x38')](_0xae2f('0x39'),auth[_0xae2f('0x5')](),controller[_0xae2f('0x35')](_0xae2f('0x3a')));router[_0xae2f('0x4')]('/chat/queues/:id',auth[_0xae2f('0x5')](),controller[_0xae2f('0x3b')]);router[_0xae2f('0x38')](_0xae2f('0x3c'),auth[_0xae2f('0x5')](),controller[_0xae2f('0x35')](_0xae2f('0x3d')));router[_0xae2f('0x4')](_0xae2f('0x3e'),auth['isAuthenticated'](),controller[_0xae2f('0x3f')]);router[_0xae2f('0x38')](_0xae2f('0x40'),auth[_0xae2f('0x5')](),controller[_0xae2f('0x35')](_0xae2f('0x41')));router[_0xae2f('0x4')](_0xae2f('0x42'),auth[_0xae2f('0x5')](),controller['showOpenchannelQueues']);router[_0xae2f('0x38')]('/sms/queues/:id/notify',auth[_0xae2f('0x5')](),controller[_0xae2f('0x35')](_0xae2f('0x43')));router[_0xae2f('0x38')](_0xae2f('0x44'),auth['isAuthenticated'](),controller[_0xae2f('0x35')]('whatsapp'));router['get']('/sms/queues/:id',auth[_0xae2f('0x5')](),controller[_0xae2f('0x45')]);router[_0xae2f('0x4')](_0xae2f('0x46'),auth[_0xae2f('0x5')](),controller['showWhatsappQueues']);router[_0xae2f('0x38')](_0xae2f('0x47'),auth[_0xae2f('0x5')](),controller['agentNotify']);module[_0xae2f('0x48')]=router; \ No newline at end of file +var _0x1c90=['/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id','/chat/queues/:id/notify','queueNotify','chat','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/agents/:id/notify','agentNotify','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions'];(function(_0x4b9d40,_0x66094f){var _0x4d69ba=function(_0x5ad45b){while(--_0x5ad45b){_0x4b9d40['push'](_0x4b9d40['shift']());}};_0x4d69ba(++_0x66094f);}(_0x1c90,0x188));var _0x01c9=function(_0x529d20,_0x2cc420){_0x529d20=_0x529d20-0x0;var _0x18bc73=_0x1c90[_0x529d20];return _0x18bc73;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x01c9('0x0'));var express=require('express');var router=express[_0x01c9('0x1')]();var auth=require(_0x01c9('0x2'));var controller=require(_0x01c9('0x3'));router[_0x01c9('0x4')](_0x01c9('0x5'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x7')]);router[_0x01c9('0x4')](_0x01c9('0x8'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x9')]);router['get'](_0x01c9('0xa'),auth[_0x01c9('0x6')](),controller[_0x01c9('0xb')]);router[_0x01c9('0x4')](_0x01c9('0xc'),auth['isAuthenticated'](),controller[_0x01c9('0xd')]);router[_0x01c9('0x4')](_0x01c9('0xe'),auth[_0x01c9('0x6')](),controller[_0x01c9('0xf')]);router[_0x01c9('0x4')]('/mail/queues',auth[_0x01c9('0x6')](),controller[_0x01c9('0x10')]);router[_0x01c9('0x4')]('/mail/accounts',auth['isAuthenticated'](),controller[_0x01c9('0x11')]);router[_0x01c9('0x4')](_0x01c9('0x12'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x13')]);router[_0x01c9('0x4')](_0x01c9('0x14'),auth[_0x01c9('0x6')](),controller['smsQueues']);router[_0x01c9('0x4')](_0x01c9('0x15'),auth[_0x01c9('0x6')](),controller['whatsappQueues']);router[_0x01c9('0x4')](_0x01c9('0x16'),auth['isAuthenticated'](),controller[_0x01c9('0x17')]);router[_0x01c9('0x4')](_0x01c9('0x18'),auth['isAuthenticated'](),controller[_0x01c9('0x19')]);router[_0x01c9('0x4')]('/voice/queues/channels',auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0x01c9('0x4')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x01c9('0x1a')]);router['get'](_0x01c9('0x1b'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x1c')]);router[_0x01c9('0x4')](_0x01c9('0x1d'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x1e')]);router['get'](_0x01c9('0x1f'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x20')]);router[_0x01c9('0x21')](_0x01c9('0x1f'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x22')]);router[_0x01c9('0x4')]('/outbound',auth[_0x01c9('0x6')](),controller['outbound']);router[_0x01c9('0x4')](_0x01c9('0x23'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x24')]);router['get'](_0x01c9('0x25'),auth['isAuthenticated'](),controller[_0x01c9('0x26')]);router['put'](_0x01c9('0x27'),auth['isAuthenticated'](),controller[_0x01c9('0x28')]);router[_0x01c9('0x4')](_0x01c9('0x29'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x2a')]);router[_0x01c9('0x4')](_0x01c9('0x2b'),auth[_0x01c9('0x6')](),controller['trunks']);router['get']('/campaigns',auth['isAuthenticated'](),controller['campaigns']);router[_0x01c9('0x4')]('/fax/accounts',auth[_0x01c9('0x6')](),controller['faxAccounts']);router[_0x01c9('0x4')](_0x01c9('0x2c'),auth[_0x01c9('0x6')](),controller['chatQueuesWaitingInteractions']);router[_0x01c9('0x4')](_0x01c9('0x2d'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x2e')]);router[_0x01c9('0x4')](_0x01c9('0x2f'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x30')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x01c9('0x6')](),controller[_0x01c9('0x31')]);router[_0x01c9('0x4')](_0x01c9('0x32'),auth['isAuthenticated'](),controller[_0x01c9('0x33')]);router[_0x01c9('0x4')](_0x01c9('0x34'),auth['isAuthenticated'](),controller[_0x01c9('0x35')]);router['get'](_0x01c9('0x36'),auth['isAuthenticated'](),controller[_0x01c9('0x37')]);router[_0x01c9('0x38')]('/mail/queues/:id/notify',auth[_0x01c9('0x6')](),controller['queueNotify']('mail'));router['get'](_0x01c9('0x39'),auth[_0x01c9('0x6')](),controller['showMailQueues']);router[_0x01c9('0x38')](_0x01c9('0x3a'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x3b')](_0x01c9('0x3c')));router['get']('/chat/queues/:id',auth[_0x01c9('0x6')](),controller[_0x01c9('0x3d')]);router[_0x01c9('0x38')](_0x01c9('0x3e'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x3b')]('fax'));router[_0x01c9('0x4')](_0x01c9('0x3f'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x40')]);router[_0x01c9('0x38')]('/openchannel/queues/:id/notify',auth[_0x01c9('0x6')](),controller[_0x01c9('0x3b')]('openchannel'));router[_0x01c9('0x4')](_0x01c9('0x41'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0x01c9('0x38')](_0x01c9('0x42'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x3b')](_0x01c9('0x43')));router['post'](_0x01c9('0x44'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x3b')](_0x01c9('0x45')));router[_0x01c9('0x4')](_0x01c9('0x46'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x47')]);router[_0x01c9('0x4')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0x01c9('0x38')](_0x01c9('0x48'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x49')]);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 451c131..21813f5 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 _0x7da7=['value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','isNil','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','From','QueueId','TransferReport','create','Start','Account','queue','agentNotify','channel','User','Agent\x20not\x20found','InteractionId','bluebird','moment','lodash','../../config/logger','api','client','http','request','error','message','catch','status','json','name','send','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','VoiceChannelStopMixMonitor','params','then','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agentCapacity','interaction','user','hasOwnProperty','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','MemberReport','findOrCreate','SIP/%s','INTERACTION','agent','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','showWhatsappQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq'];(function(_0x1558ab,_0x39d1de){var _0x53b64a=function(_0x4771ed){while(--_0x4771ed){_0x1558ab['push'](_0x1558ab['shift']());}};_0x53b64a(++_0x39d1de);}(_0x7da7,0x10d));var _0x77da=function(_0x172660,_0x260d9b){_0x172660=_0x172660-0x0;var _0x83204f=_0x7da7[_0x172660];return _0x83204f;};'use strict';var BPromise=require(_0x77da('0x0'));var moment=require(_0x77da('0x1'));var _=require(_0x77da('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x77da('0x3'))(_0x77da('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x77da('0x5')][_0x77da('0x6')]({'port':0x232a});var mailClient=jayson['client'][_0x77da('0x6')]({'port':0x232b});var routingClient=jayson[_0x77da('0x5')]['http']({'port':0x232c});function respondWithRpcPromise(_0x30afe0,_0x47cf1d,_0x1191de){return new BPromise(function(_0x13992e,_0x37c5ab){var _0x910e5b=_0x1191de?_0x1191de:amiClient;return _0x910e5b[_0x77da('0x7')](_0x30afe0,_0x47cf1d)['then'](function(_0x40c86e){if(_0x40c86e[_0x77da('0x8')]){if(_0x40c86e[_0x77da('0x8')]['code']===0x1f4){return _0x37c5ab(_0x40c86e[_0x77da('0x8')][_0x77da('0x9')]);}return _0x13992e(_0x40c86e[_0x77da('0x8')][_0x77da('0x9')]);}else{_0x13992e(_0x40c86e['result']);}})[_0x77da('0xa')](function(_0x3bcea0){_0x37c5ab(_0x3bcea0);});});}function respondWithResult(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xc8;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0xb')](_0x5d6e2f)[_0x77da('0xc')](_0x4a7748);}return _0x2acc65['sendStatus'](0x194);};}function handleError(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0x1f4;return function(_0x355719){logger[_0x77da('0x8')](_0x355719['stack']);if(_0x355719[_0x77da('0xd')]){delete _0x355719['name'];}_0x3b0ff2[_0x77da('0xb')](_0x369df0)[_0x77da('0xe')](_0x355719);};}function findById(_0x1b0e17){return function(_0x4500c4){if(!_['isNil'](_0x1b0e17)&&!_['isNil'](_0x4500c4)&&!_['isNil'](_0x4500c4['rows'])){return _[_0x77da('0xf')](_0x4500c4[_0x77da('0x10')],function(_0x289887){return _0x289887['id']==_0x1b0e17;});}return null;};}exports[_0x77da('0x11')]=function(_0x19a00c,_0x12d2b1){return respondWithRpcPromise(_0x77da('0x12'),_0x19a00c[_0x77da('0x13')])['then'](respondWithResult(_0x12d2b1,null))['catch'](handleError(_0x12d2b1,null));};exports[_0x77da('0x14')]=function(_0x4d1512,_0x507979){return respondWithRpcPromise(_0x77da('0x15'),_[_0x77da('0x16')](_0x4d1512[_0x77da('0x13')],_0x4d1512['params']))['then'](respondWithResult(_0x507979,null))[_0x77da('0xa')](handleError(_0x507979,null));};exports['voiceChannelStopMixMonitor']=function(_0x175ac4,_0x1c27aa){return respondWithRpcPromise(_0x77da('0x17'),_[_0x77da('0x16')](_0x175ac4[_0x77da('0x13')],_0x175ac4[_0x77da('0x18')]))[_0x77da('0x19')](respondWithResult(_0x1c27aa,null))['catch'](handleError(_0x1c27aa,null));};exports['voiceQueues']=function(_0xfd160,_0x2d009f){return respondWithRpcPromise(_0x77da('0x1a'),_0xfd160[_0x77da('0x13')])['then'](respondWithResult(_0x2d009f,null))[_0x77da('0xa')](handleError(_0x2d009f,null));};exports[_0x77da('0x1b')]=function(_0x470c9f,_0x36115b){return respondWithRpcPromise(_0x77da('0x1a'),_0x470c9f['query'])[_0x77da('0x19')](findById(_0x470c9f[_0x77da('0x18')]['id']))[_0x77da('0x19')](respondWithResult(_0x36115b,null))[_0x77da('0xa')](handleError(_0x36115b,null));};exports['updateVoiceQueue']=function(_0x5b4638,_0x4d395a){return respondWithRpcPromise(_0x77da('0x1c'),_[_0x77da('0x16')](_0x5b4638[_0x77da('0x1d')],_0x5b4638[_0x77da('0x18')]))[_0x77da('0x19')](respondWithResult(_0x4d395a,null))['catch'](handleError(_0x4d395a,null));};exports[_0x77da('0x1e')]=function(_0x26f5a0,_0x356bfb){return respondWithRpcPromise(_0x77da('0x1f'),_[_0x77da('0x16')](_0x26f5a0[_0x77da('0x13')],_0x26f5a0['params']))[_0x77da('0x19')](respondWithResult(_0x356bfb,null))[_0x77da('0xa')](handleError(_0x356bfb,null));};exports[_0x77da('0x20')]=function(_0x38643a,_0x3c3c64){return respondWithRpcPromise(_0x77da('0x21'),_0x38643a[_0x77da('0x13')])[_0x77da('0x19')](respondWithResult(_0x3c3c64,null))['catch'](handleError(_0x3c3c64,null));};exports['voiceQueuesChannel']=function(_0x1366b4,_0x8e6181){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x77da('0x16')](_0x1366b4[_0x77da('0x13')],_0x1366b4[_0x77da('0x18')]))[_0x77da('0x19')](respondWithResult(_0x8e6181,null))[_0x77da('0xa')](handleError(_0x8e6181,null));};exports[_0x77da('0x22')]=function(_0x20d1cc,_0x5c4a03){return respondWithRpcPromise(_0x77da('0x23'),_['merge'](_0x20d1cc['query'],_0x20d1cc['params']))[_0x77da('0x19')](respondWithResult(_0x5c4a03,null))['catch'](handleError(_0x5c4a03,null));};exports[_0x77da('0x24')]=function(_0xdac1a4,_0xce9df2){return respondWithRpcPromise(_0x77da('0x25'),_[_0x77da('0x16')](_0xdac1a4[_0x77da('0x13')],_0xdac1a4[_0x77da('0x18')]))['then'](respondWithResult(_0xce9df2,null))[_0x77da('0xa')](handleError(_0xce9df2,null));};exports[_0x77da('0x26')]=function(_0x1ca53a,_0x32785f){return respondWithRpcPromise(_0x77da('0x27'),_0x1ca53a[_0x77da('0x13')])['then'](respondWithResult(_0x32785f,null))[_0x77da('0xa')](handleError(_0x32785f,null));};exports[_0x77da('0x28')]=function(_0x2cd190,_0x4d04cd){return respondWithRpcPromise(_0x77da('0x29'),_0x2cd190['query'])['then'](respondWithResult(_0x4d04cd,null))['catch'](handleError(_0x4d04cd,null));};exports['agents']=function(_0x19f9f7,_0x1adba5){var _0xebdea1;return respondWithRpcPromise('Agents',_0x19f9f7[_0x77da('0x13')])['then'](function(_0xf79c20){_0xebdea1=_0xf79c20;return respondWithRpcPromise('Agents',_0x19f9f7[_0x77da('0x13')],routingClient);})[_0x77da('0x19')](function(_0x290667){return _[_0x77da('0x16')]({},_0x290667,_0xebdea1);})[_0x77da('0x19')](respondWithResult(_0x1adba5,null))['catch'](handleError(_0x1adba5,null));};exports[_0x77da('0x2a')]=function(_0x1f48bd,_0x44717a){if(_0x1f48bd[_0x77da('0x1d')]&&_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')]&&_0x1f48bd['user']&&_0x1f48bd[_0x77da('0x2c')][_0x77da('0xd')]){for(var _0x21de41 in _0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')]){if(_0x1f48bd[_0x77da('0x1d')]['interaction'][_0x77da('0x2d')](_0x21de41)){db['MemberReport'][_0x77da('0x2e')]({'where':{'channel':_0x21de41,'membername':_0x1f48bd[_0x77da('0x2c')][_0x77da('0xd')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')][_0x21de41]&&_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')][_0x21de41][_0x77da('0x2f')]?{'$notIn':_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')][_0x21de41]}:{'$ne':null}}})[_0x77da('0x19')](function(_0x1bb77c){var _0x5964da=moment()[_0x77da('0x30')](_0x77da('0x31'));for(var _0x46f289=0x0,_0x287cf0=_0x1bb77c[_0x77da('0x2f')];_0x46f289<_0x287cf0;_0x46f289+=0x1){_0x1bb77c[_0x46f289][_0x77da('0x32')]({'exitAt':_0x5964da});}});for(var _0x558023=0x0;_0x558023<_0x1f48bd['body'][_0x77da('0x2b')][_0x21de41][_0x77da('0x2f')];_0x558023+=0x1){db[_0x77da('0x33')][_0x77da('0x34')]({'where':{'channel':_0x21de41,'membername':_0x1f48bd[_0x77da('0x2c')][_0x77da('0xd')],'type':'INTERACTION','uniqueid':_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')][_0x21de41][_0x558023],'exitAt':null},'defaults':{'channel':_0x21de41,'membername':_0x1f48bd[_0x77da('0x2c')][_0x77da('0xd')],'interface':_['isNil'](_0x1f48bd[_0x77da('0x2c')]['interface'])?util['format'](_0x77da('0x35'),_0x1f48bd[_0x77da('0x2c')][_0x77da('0xd')]):_0x1f48bd[_0x77da('0x2c')]['interface'],'type':_0x77da('0x36'),'enterAt':moment()[_0x77da('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x77da('0x37'),'internal':_0x1f48bd[_0x77da('0x2c')]['internal'],'uniqueid':_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')][_0x21de41][_0x558023]}});}}}}return respondWithRpcPromise(_0x77da('0x38'),{'id':_0x1f48bd[_0x77da('0x18')]['id'],'capacity':_0x1f48bd[_0x77da('0x1d')][_0x77da('0x39')]},routingClient)[_0x77da('0x19')](respondWithResult(_0x44717a,null))[_0x77da('0xa')](handleError(_0x44717a,null));};exports[_0x77da('0x3a')]=function(_0x3a34a8,_0x52aa0a){return respondWithRpcPromise(_0x77da('0x3b'),_0x3a34a8['query'])[_0x77da('0x19')](respondWithResult(_0x52aa0a,null))[_0x77da('0xa')](handleError(_0x52aa0a,null));};exports[_0x77da('0x3c')]=function(_0x2eca67,_0x374179){return respondWithRpcPromise(_0x77da('0x3d'),_0x2eca67[_0x77da('0x13')])['then'](respondWithResult(_0x374179,null))[_0x77da('0xa')](handleError(_0x374179,null));};exports[_0x77da('0x3e')]=function(_0x1a7115,_0x353be9){return respondWithRpcPromise('Campaigns',_0x1a7115[_0x77da('0x13')])[_0x77da('0x19')](respondWithResult(_0x353be9,null))[_0x77da('0xa')](handleError(_0x353be9,null));};exports['chatQueues']=function(_0x5a7ba7,_0x332763){return respondWithRpcPromise(_0x77da('0x3f'),_0x5a7ba7[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x332763,null))[_0x77da('0xa')](handleError(_0x332763,null));};exports['showChatQueues']=function(_0x50437b,_0x365e91){return respondWithRpcPromise(_0x77da('0x3f'),_0x50437b['query'],routingClient)[_0x77da('0x19')](findById(_0x50437b[_0x77da('0x18')]['id']))[_0x77da('0x19')](respondWithResult(_0x365e91,null))['catch'](handleError(_0x365e91,null));};exports[_0x77da('0x40')]=function(_0x111260,_0x5a5309){return respondWithRpcPromise(_0x77da('0x41'),_0x111260[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x5a5309,null))[_0x77da('0xa')](handleError(_0x5a5309,null));};exports[_0x77da('0x42')]=function(_0x99ac27,_0x1dc4ab){return respondWithRpcPromise(_0x77da('0x41'),_0x99ac27[_0x77da('0x13')],routingClient)['then'](findById(_0x99ac27[_0x77da('0x18')]['id']))[_0x77da('0x19')](respondWithResult(_0x1dc4ab,null))[_0x77da('0xa')](handleError(_0x1dc4ab,null));};exports[_0x77da('0x43')]=function(_0x329c6b,_0x3a0160){return respondWithRpcPromise('MailAccounts',_0x329c6b[_0x77da('0x13')],mailClient)[_0x77da('0x19')](respondWithResult(_0x3a0160,null))[_0x77da('0xa')](handleError(_0x3a0160,null));};exports['openchannelQueues']=function(_0x3e5dd9,_0x2f7cd8){return respondWithRpcPromise(_0x77da('0x44'),_0x3e5dd9[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x2f7cd8,null))[_0x77da('0xa')](handleError(_0x2f7cd8,null));};exports[_0x77da('0x45')]=function(_0x53a9ee,_0x100094){return respondWithRpcPromise('OpenchannelQueues',_0x53a9ee[_0x77da('0x13')],routingClient)[_0x77da('0x19')](findById(_0x53a9ee[_0x77da('0x18')]['id']))['then'](respondWithResult(_0x100094,null))[_0x77da('0xa')](handleError(_0x100094,null));};exports[_0x77da('0x46')]=function(_0x282481,_0x30ea29){return respondWithRpcPromise('SmsQueues',_0x282481['query'],routingClient)['then'](respondWithResult(_0x30ea29,null))[_0x77da('0xa')](handleError(_0x30ea29,null));};exports[_0x77da('0x47')]=function(_0x2c4d7c,_0x2c7c8e){return respondWithRpcPromise(_0x77da('0x48'),_0x2c4d7c[_0x77da('0x13')],routingClient)[_0x77da('0x19')](findById(_0x2c4d7c[_0x77da('0x18')]['id']))[_0x77da('0x19')](respondWithResult(_0x2c7c8e,null))[_0x77da('0xa')](handleError(_0x2c7c8e,null));};exports['whatsappQueues']=function(_0x3028ca,_0x6dd79f){return respondWithRpcPromise('WhatsappQueues',_0x3028ca['query'],routingClient)[_0x77da('0x19')](respondWithResult(_0x6dd79f,null))['catch'](handleError(_0x6dd79f,null));};exports[_0x77da('0x49')]=function(_0x1adab0,_0x1ff554){return respondWithRpcPromise('WhatsappQueues',_0x1adab0[_0x77da('0x13')],routingClient)[_0x77da('0x19')](findById(_0x1adab0[_0x77da('0x18')]['id']))[_0x77da('0x19')](respondWithResult(_0x1ff554,null))[_0x77da('0xa')](handleError(_0x1ff554,null));};exports['faxQueues']=function(_0x1f4c49,_0x20a636){return respondWithRpcPromise('FaxQueues',_0x1f4c49[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x20a636,null))[_0x77da('0xa')](handleError(_0x20a636,null));};exports[_0x77da('0x4a')]=function(_0x14496e,_0xdf9393){return respondWithRpcPromise(_0x77da('0x4b'),_0x14496e['query'],routingClient)[_0x77da('0x19')](findById(_0x14496e['params']['id']))[_0x77da('0x19')](respondWithResult(_0xdf9393,null))[_0x77da('0xa')](handleError(_0xdf9393,null));};exports[_0x77da('0x4c')]=function(_0x19b514,_0x470619){return respondWithRpcPromise(_0x77da('0x4d'),_0x19b514[_0x77da('0x13')])[_0x77da('0x19')](respondWithResult(_0x470619,null))[_0x77da('0xa')](handleError(_0x470619,null));};exports[_0x77da('0x4e')]=function(_0x3c9ca7,_0x19065e){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x3c9ca7[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x19065e,null))[_0x77da('0xa')](handleError(_0x19065e,null));};exports[_0x77da('0x4f')]=function(_0x57b710,_0x293b5c){return respondWithRpcPromise(_0x77da('0x50'),_0x57b710[_0x77da('0x13')],routingClient)['then'](respondWithResult(_0x293b5c,null))[_0x77da('0xa')](handleError(_0x293b5c,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x579314,_0x2a4f85){return respondWithRpcPromise(_0x77da('0x51'),_0x579314[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x2a4f85,null))[_0x77da('0xa')](handleError(_0x2a4f85,null));};exports[_0x77da('0x52')]=function(_0x14dec8,_0xf95d48){return respondWithRpcPromise(_0x77da('0x51'),_0x14dec8['query'],routingClient)[_0x77da('0x19')](function(_0xfcf09c){if(_0x14dec8[_0x77da('0x13')][_0x77da('0x53')]!==undefined){var _0x17175=_(_0xfcf09c['rows'])[_0x77da('0x54')]([_0x14dec8[_0x77da('0x13')][_0x77da('0x53')],_0x14dec8[_0x77da('0x18')]['id']])[_0x77da('0x55')](_0x77da('0x56'))[_0x77da('0x57')]()[_0x77da('0x58')]();return _0xfcf09c[_0x77da('0x10')][_0x77da('0x54')](function(_0x4df868){return _0x17175['indexOf'](_0x4df868['queue_id'])>-0x1;});}else{return _0xfcf09c[_0x77da('0x10')][_0x77da('0x54')](function(_0x41fb81){return _0x41fb81['queue_id']===parseInt(_0x14dec8['params']['id']);});}})[_0x77da('0x19')](respondWithResult(_0xf95d48,null))[_0x77da('0xa')](handleError(_0xf95d48,null));};exports[_0x77da('0x59')]=function(_0x3a42e5,_0x1a92fd){return respondWithRpcPromise(_0x77da('0x5a'),_0x3a42e5[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x1a92fd,null))[_0x77da('0xa')](handleError(_0x1a92fd,null));};exports[_0x77da('0x5b')]=function(_0x27a462,_0x4cbd40){return respondWithRpcPromise(_0x77da('0x5c'),_0x27a462['query'],routingClient)['then'](respondWithResult(_0x4cbd40,null))[_0x77da('0xa')](handleError(_0x4cbd40,null));};exports['faxQueuesWaitingInteractions']=function(_0x4f9121,_0x22de60){return respondWithRpcPromise(_0x77da('0x5d'),_0x4f9121[_0x77da('0x13')],routingClient)['then'](respondWithResult(_0x22de60,null))['catch'](handleError(_0x22de60,null));};exports[_0x77da('0x5e')]=function(_0x4f1ae0){return function(_0x278f20,_0x1b85aa){var _0x554c44,_0x31834a;var _0x505520=_[_0x77da('0x5f')](_0x4f1ae0);var _0x45b0a5=_0x4f1ae0===_0x77da('0x60')?_0x77da('0x61'):'Account';return db[_0x505520+_0x77da('0x62')][_0x77da('0x63')]({'raw':!![],'where':{'id':_0x278f20[_0x77da('0x18')]['id']}})[_0x77da('0x19')](function(_0x3fd7c8){if(_[_0x77da('0x64')](_0x3fd7c8)){throw new Error(_0x505520+_0x77da('0x65'));}_0x554c44=_0x3fd7c8;return db[_0x505520+'Message']['findOne']({'where':{'id':_0x278f20[_0x77da('0x1d')][_0x77da('0x66')]},'include':[{'model':db[_0x505520+_0x77da('0x67')],'as':'Interaction'},{'model':db[_0x505520+_0x45b0a5],'as':'Account'}]});})['then'](function(_0x5aaafb){if(_[_0x77da('0x64')](_0x5aaafb)){throw new Error(_0x505520+_0x77da('0x68'));}_0x31834a=_0x5aaafb;return _0x5aaafb[_0x77da('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x1636d6={'uniqueid':_0x4f1ae0+'.'+_0x31834a['id']+'.'+_0x31834a['Interaction']['id'],'FromUserId':_0x278f20[_0x77da('0x2c')]['id'],'type':'queue'};_0x1636d6[_0x505520+_0x77da('0x6a')]=_0x31834a['id'];_0x1636d6[_0x505520+'InteractionId']=_0x31834a[_0x77da('0x67')]['id'];_0x1636d6[_0x77da('0x6b')+_0x505520+_0x45b0a5+'Id']=_0x31834a['Account']['id'];_0x1636d6['To'+_0x505520+_0x77da('0x6c')]=_0x554c44['id'];return db[_0x505520+_0x77da('0x6d')][_0x77da('0x6e')](_0x1636d6);})[_0x77da('0x19')](function(){return respondWithRpcPromise(_0x77da('0x6f'),{'channel':_0x4f1ae0,'interaction':_0x31834a[_0x77da('0x67')],'message':_0x31834a,'account':_0x31834a[_0x77da('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':_0x77da('0x71'),'appdata':_0x554c44[_0x77da('0xd')]+','+(_0x31834a['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x77da('0x19')](respondWithResult(_0x1b85aa,null))[_0x77da('0xa')](handleError(_0x1b85aa,null));};};exports[_0x77da('0x72')]=function(_0x56efcf,_0x186d22){var _0x52638b,_0x5e93b1;if(_[_0x77da('0x64')](_0x56efcf[_0x77da('0x1d')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x3c0cde=_0x56efcf[_0x77da('0x1d')][_0x77da('0x73')];var _0x5d9750=_[_0x77da('0x5f')](_0x3c0cde);var _0x5384d2=_0x3c0cde===_0x77da('0x60')?_0x77da('0x61'):_0x77da('0x70');return db[_0x77da('0x74')][_0x77da('0x63')]({'raw':!![],'where':{'id':_0x56efcf[_0x77da('0x18')]['id'],'role':'agent'}})[_0x77da('0x19')](function(_0x2410ae){if(_[_0x77da('0x64')](_0x2410ae)){throw new Error(_0x77da('0x75'));}_0x52638b=_0x2410ae;return db[_0x5d9750+'Message'][_0x77da('0x63')]({'where':{'id':_0x56efcf['body'][_0x77da('0x66')]},'include':[{'model':db[_0x5d9750+_0x77da('0x67')],'as':_0x77da('0x67')},{'model':db[_0x5d9750+_0x5384d2],'as':_0x77da('0x70')}]});})[_0x77da('0x19')](function(_0x2c3bcc){if(_[_0x77da('0x64')](_0x2c3bcc)){throw new Error(_0x5d9750+_0x77da('0x68'));}_0x5e93b1=_0x2c3bcc;return _0x2c3bcc['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x77da('0x19')](function(){var _0x3132f0={'uniqueid':_0x3c0cde+'.'+_0x5e93b1['id']+'.'+_0x5e93b1[_0x77da('0x67')]['id'],'FromUserId':_0x56efcf[_0x77da('0x2c')]['id'],'type':_0x77da('0x71'),'ToUserId':_0x52638b['id']};_0x3132f0[_0x5d9750+_0x77da('0x6a')]=_0x5e93b1['id'];_0x3132f0[_0x5d9750+_0x77da('0x76')]=_0x5e93b1[_0x77da('0x67')]['id'];_0x3132f0['From'+_0x5d9750+_0x5384d2+'Id']=_0x5e93b1['Account']['id'];return db[_0x5d9750+_0x77da('0x6d')][_0x77da('0x6e')](_0x3132f0);})[_0x77da('0x19')](function(){return respondWithRpcPromise('Start',{'channel':_0x3c0cde,'interaction':_0x5e93b1[_0x77da('0x67')],'message':_0x5e93b1,'account':_0x5e93b1['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x77da('0x37'),'appdata':_0x52638b[_0x77da('0xd')]+','+(_0x5e93b1[_0x77da('0x70')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x77da('0x19')](respondWithResult(_0x186d22,null))['catch'](handleError(_0x186d22,null));}; \ No newline at end of file +var _0xeec6=['YYYY-MM-DD\x20HH:mm:ss','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','update','queue','InteractionId','From','QueueId','TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','\x20Message\x20not\x20found','bluebird','moment','lodash','util','../../config/logger','api','jayson/promise','client','http','request','then','error','message','result','status','sendStatus','stack','name','send','isNil','find','rows','VoiceChannels','query','catch','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','interaction','hasOwnProperty','MemberReport','INTERACTION','length','format','SIP/%s','interface'];(function(_0x340c91,_0x468c49){var _0x408fc3=function(_0x439277){while(--_0x439277){_0x340c91['push'](_0x340c91['shift']());}};_0x408fc3(++_0x468c49);}(_0xeec6,0x1c2));var _0x6eec=function(_0x7b173,_0x539d7f){_0x7b173=_0x7b173-0x0;var _0x1c598c=_0xeec6[_0x7b173];return _0x1c598c;};'use strict';var BPromise=require(_0x6eec('0x0'));var moment=require(_0x6eec('0x1'));var _=require(_0x6eec('0x2'));var util=require(_0x6eec('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x6eec('0x4'))(_0x6eec('0x5'));var jayson=require(_0x6eec('0x6'));var amiClient=jayson[_0x6eec('0x7')][_0x6eec('0x8')]({'port':0x232a});var mailClient=jayson[_0x6eec('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0x6eec('0x7')][_0x6eec('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){var _0x56e849=_0x1c810e?_0x1c810e:amiClient;return _0x56e849[_0x6eec('0x9')](_0x48064a,_0x5a5e47)[_0x6eec('0xa')](function(_0x1c774d){if(_0x1c774d['error']){if(_0x1c774d['error']['code']===0x1f4){return _0x834c2(_0x1c774d[_0x6eec('0xb')][_0x6eec('0xc')]);}return _0x3443c2(_0x1c774d['error']['message']);}else{_0x3443c2(_0x1c774d[_0x6eec('0xd')]);}})['catch'](function(_0x3091d0){_0x834c2(_0x3091d0);});});}function respondWithResult(_0x3387c2,_0x162db1){_0x162db1=_0x162db1||0xc8;return function(_0x3fe94b){if(_0x3fe94b){return _0x3387c2[_0x6eec('0xe')](_0x162db1)['json'](_0x3fe94b);}return _0x3387c2[_0x6eec('0xf')](0x194);};}function handleError(_0x3b2972,_0x462dbb){_0x462dbb=_0x462dbb||0x1f4;return function(_0xc35914){logger[_0x6eec('0xb')](_0xc35914[_0x6eec('0x10')]);if(_0xc35914[_0x6eec('0x11')]){delete _0xc35914[_0x6eec('0x11')];}_0x3b2972[_0x6eec('0xe')](_0x462dbb)[_0x6eec('0x12')](_0xc35914);};}function findById(_0x5e2a9b){return function(_0x3c0c1b){if(!_['isNil'](_0x5e2a9b)&&!_[_0x6eec('0x13')](_0x3c0c1b)&&!_[_0x6eec('0x13')](_0x3c0c1b['rows'])){return _[_0x6eec('0x14')](_0x3c0c1b[_0x6eec('0x15')],function(_0xb1eab7){return _0xb1eab7['id']==_0x5e2a9b;});}return null;};}exports['voiceChannels']=function(_0x87f3be,_0x1ed94c){return respondWithRpcPromise(_0x6eec('0x16'),_0x87f3be[_0x6eec('0x17')])[_0x6eec('0xa')](respondWithResult(_0x1ed94c,null))[_0x6eec('0x18')](handleError(_0x1ed94c,null));};exports['voiceChannelMixMonitor']=function(_0x328693,_0x2f843e){return respondWithRpcPromise(_0x6eec('0x19'),_[_0x6eec('0x1a')](_0x328693[_0x6eec('0x17')],_0x328693[_0x6eec('0x1b')]))['then'](respondWithResult(_0x2f843e,null))[_0x6eec('0x18')](handleError(_0x2f843e,null));};exports[_0x6eec('0x1c')]=function(_0x285d41,_0x27785a){return respondWithRpcPromise(_0x6eec('0x1d'),_[_0x6eec('0x1a')](_0x285d41['query'],_0x285d41[_0x6eec('0x1b')]))[_0x6eec('0xa')](respondWithResult(_0x27785a,null))[_0x6eec('0x18')](handleError(_0x27785a,null));};exports[_0x6eec('0x1e')]=function(_0x1d2be9,_0x1f386c){return respondWithRpcPromise(_0x6eec('0x1f'),_0x1d2be9[_0x6eec('0x17')])[_0x6eec('0xa')](respondWithResult(_0x1f386c,null))['catch'](handleError(_0x1f386c,null));};exports[_0x6eec('0x20')]=function(_0x44b31c,_0x30eb98){return respondWithRpcPromise(_0x6eec('0x1f'),_0x44b31c['query'])[_0x6eec('0xa')](findById(_0x44b31c[_0x6eec('0x1b')]['id']))['then'](respondWithResult(_0x30eb98,null))['catch'](handleError(_0x30eb98,null));};exports[_0x6eec('0x21')]=function(_0x47ed95,_0x20a130){return respondWithRpcPromise(_0x6eec('0x22'),_[_0x6eec('0x1a')](_0x47ed95[_0x6eec('0x23')],_0x47ed95[_0x6eec('0x1b')]))[_0x6eec('0xa')](respondWithResult(_0x20a130,null))[_0x6eec('0x18')](handleError(_0x20a130,null));};exports[_0x6eec('0x24')]=function(_0x1abd19,_0x414f5b){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x6eec('0x1a')](_0x1abd19['query'],_0x1abd19[_0x6eec('0x1b')]))[_0x6eec('0xa')](respondWithResult(_0x414f5b,null))[_0x6eec('0x18')](handleError(_0x414f5b,null));};exports['voiceQueuesChannels']=function(_0x57b40b,_0x508735){return respondWithRpcPromise(_0x6eec('0x25'),_0x57b40b[_0x6eec('0x17')])[_0x6eec('0xa')](respondWithResult(_0x508735,null))[_0x6eec('0x18')](handleError(_0x508735,null));};exports[_0x6eec('0x26')]=function(_0x23547d,_0x22e0cb){return respondWithRpcPromise(_0x6eec('0x27'),_[_0x6eec('0x1a')](_0x23547d[_0x6eec('0x17')],_0x23547d[_0x6eec('0x1b')]))[_0x6eec('0xa')](respondWithResult(_0x22e0cb,null))['catch'](handleError(_0x22e0cb,null));};exports[_0x6eec('0x28')]=function(_0x361ab7,_0x2c83d1){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x6eec('0x1a')](_0x361ab7[_0x6eec('0x17')],_0x361ab7[_0x6eec('0x1b')]))[_0x6eec('0xa')](respondWithResult(_0x2c83d1,null))[_0x6eec('0x18')](handleError(_0x2c83d1,null));};exports[_0x6eec('0x29')]=function(_0x4a7699,_0x45cfb6){return respondWithRpcPromise(_0x6eec('0x2a'),_[_0x6eec('0x1a')](_0x4a7699['query'],_0x4a7699['params']))[_0x6eec('0xa')](respondWithResult(_0x45cfb6,null))[_0x6eec('0x18')](handleError(_0x45cfb6,null));};exports[_0x6eec('0x2b')]=function(_0x3f79d1,_0x402bac){return respondWithRpcPromise('Outbound',_0x3f79d1[_0x6eec('0x17')])[_0x6eec('0xa')](respondWithResult(_0x402bac,null))[_0x6eec('0x18')](handleError(_0x402bac,null));};exports[_0x6eec('0x2c')]=function(_0x15918c,_0x2be999){return respondWithRpcPromise(_0x6eec('0x2d'),_0x15918c[_0x6eec('0x17')])['then'](respondWithResult(_0x2be999,null))[_0x6eec('0x18')](handleError(_0x2be999,null));};exports[_0x6eec('0x2e')]=function(_0x4d30c9,_0x5b3283){var _0x160fc0;return respondWithRpcPromise(_0x6eec('0x2f'),_0x4d30c9[_0x6eec('0x17')])[_0x6eec('0xa')](function(_0x4cb50e){_0x160fc0=_0x4cb50e;return respondWithRpcPromise('Agents',_0x4d30c9[_0x6eec('0x17')],routingClient);})['then'](function(_0x5ac8b2){return _[_0x6eec('0x1a')]({},_0x5ac8b2,_0x160fc0);})[_0x6eec('0xa')](respondWithResult(_0x5b3283,null))[_0x6eec('0x18')](handleError(_0x5b3283,null));};exports[_0x6eec('0x30')]=function(_0x25d3f3,_0x58dfe7){if(_0x25d3f3[_0x6eec('0x23')]&&_0x25d3f3[_0x6eec('0x23')]['interaction']&&_0x25d3f3[_0x6eec('0x31')]&&_0x25d3f3[_0x6eec('0x31')]['name']){for(var _0x2d39bf in _0x25d3f3[_0x6eec('0x23')]['interaction']){if(_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x32')][_0x6eec('0x33')](_0x2d39bf)){db[_0x6eec('0x34')]['findAll']({'where':{'channel':_0x2d39bf,'membername':_0x25d3f3[_0x6eec('0x31')][_0x6eec('0x11')],'type':_0x6eec('0x35'),'exitAt':null,'uniqueid':_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x32')][_0x2d39bf]&&_0x25d3f3['body']['interaction'][_0x2d39bf][_0x6eec('0x36')]?{'$notIn':_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x32')][_0x2d39bf]}:{'$ne':null}}})[_0x6eec('0xa')](function(_0x44c7b8){var _0x59d7a7=moment()[_0x6eec('0x37')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x20524a=0x0,_0x408295=_0x44c7b8[_0x6eec('0x36')];_0x20524a<_0x408295;_0x20524a+=0x1){_0x44c7b8[_0x20524a]['updateAttributes']({'exitAt':_0x59d7a7});}});for(var _0x2b83f2=0x0;_0x2b83f2<_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x32')][_0x2d39bf][_0x6eec('0x36')];_0x2b83f2+=0x1){db[_0x6eec('0x34')]['findOrCreate']({'where':{'channel':_0x2d39bf,'membername':_0x25d3f3[_0x6eec('0x31')]['name'],'type':'INTERACTION','uniqueid':_0x25d3f3[_0x6eec('0x23')]['interaction'][_0x2d39bf][_0x2b83f2],'exitAt':null},'defaults':{'channel':_0x2d39bf,'membername':_0x25d3f3[_0x6eec('0x31')][_0x6eec('0x11')],'interface':_[_0x6eec('0x13')](_0x25d3f3['user']['interface'])?util[_0x6eec('0x37')](_0x6eec('0x38'),_0x25d3f3[_0x6eec('0x31')][_0x6eec('0x11')]):_0x25d3f3[_0x6eec('0x31')][_0x6eec('0x39')],'type':_0x6eec('0x35'),'enterAt':moment()[_0x6eec('0x37')](_0x6eec('0x3a')),'role':_0x6eec('0x3b'),'internal':_0x25d3f3['user']['internal'],'uniqueid':_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x32')][_0x2d39bf][_0x2b83f2]}});}}}}return respondWithRpcPromise(_0x6eec('0x3c'),{'id':_0x25d3f3['params']['id'],'capacity':_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x3d')]},routingClient)[_0x6eec('0xa')](respondWithResult(_0x58dfe7,null))[_0x6eec('0x18')](handleError(_0x58dfe7,null));};exports[_0x6eec('0x3e')]=function(_0x43f77a,_0x10c10a){return respondWithRpcPromise(_0x6eec('0x3f'),_0x43f77a['query'])[_0x6eec('0xa')](respondWithResult(_0x10c10a,null))[_0x6eec('0x18')](handleError(_0x10c10a,null));};exports[_0x6eec('0x40')]=function(_0x3e77f3,_0x490d27){return respondWithRpcPromise('Trunks',_0x3e77f3['query'])[_0x6eec('0xa')](respondWithResult(_0x490d27,null))[_0x6eec('0x18')](handleError(_0x490d27,null));};exports[_0x6eec('0x41')]=function(_0x1de626,_0x5178f5){return respondWithRpcPromise('Campaigns',_0x1de626[_0x6eec('0x17')])[_0x6eec('0xa')](respondWithResult(_0x5178f5,null))[_0x6eec('0x18')](handleError(_0x5178f5,null));};exports['chatQueues']=function(_0x238605,_0x35f411){return respondWithRpcPromise(_0x6eec('0x42'),_0x238605[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x35f411,null))[_0x6eec('0x18')](handleError(_0x35f411,null));};exports[_0x6eec('0x43')]=function(_0x19fe55,_0x45fed3){return respondWithRpcPromise('ChatQueues',_0x19fe55[_0x6eec('0x17')],routingClient)['then'](findById(_0x19fe55[_0x6eec('0x1b')]['id']))[_0x6eec('0xa')](respondWithResult(_0x45fed3,null))[_0x6eec('0x18')](handleError(_0x45fed3,null));};exports[_0x6eec('0x44')]=function(_0x248d76,_0x360176){return respondWithRpcPromise(_0x6eec('0x45'),_0x248d76['query'],routingClient)[_0x6eec('0xa')](respondWithResult(_0x360176,null))['catch'](handleError(_0x360176,null));};exports[_0x6eec('0x46')]=function(_0x5c905f,_0x237324){return respondWithRpcPromise(_0x6eec('0x45'),_0x5c905f[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](findById(_0x5c905f[_0x6eec('0x1b')]['id']))[_0x6eec('0xa')](respondWithResult(_0x237324,null))[_0x6eec('0x18')](handleError(_0x237324,null));};exports[_0x6eec('0x47')]=function(_0x130002,_0x4114d1){return respondWithRpcPromise('MailAccounts',_0x130002['query'],mailClient)[_0x6eec('0xa')](respondWithResult(_0x4114d1,null))[_0x6eec('0x18')](handleError(_0x4114d1,null));};exports[_0x6eec('0x48')]=function(_0x2c0644,_0x20b040){return respondWithRpcPromise('OpenchannelQueues',_0x2c0644[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x20b040,null))['catch'](handleError(_0x20b040,null));};exports['showOpenchannelQueues']=function(_0x5dc8b3,_0xaa2a15){return respondWithRpcPromise(_0x6eec('0x49'),_0x5dc8b3['query'],routingClient)[_0x6eec('0xa')](findById(_0x5dc8b3[_0x6eec('0x1b')]['id']))['then'](respondWithResult(_0xaa2a15,null))[_0x6eec('0x18')](handleError(_0xaa2a15,null));};exports[_0x6eec('0x4a')]=function(_0xc852b3,_0x3c1f77){return respondWithRpcPromise('SmsQueues',_0xc852b3['query'],routingClient)[_0x6eec('0xa')](respondWithResult(_0x3c1f77,null))[_0x6eec('0x18')](handleError(_0x3c1f77,null));};exports[_0x6eec('0x4b')]=function(_0x19ca46,_0x34c4b4){return respondWithRpcPromise(_0x6eec('0x4c'),_0x19ca46[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](findById(_0x19ca46[_0x6eec('0x1b')]['id']))[_0x6eec('0xa')](respondWithResult(_0x34c4b4,null))[_0x6eec('0x18')](handleError(_0x34c4b4,null));};exports[_0x6eec('0x4d')]=function(_0x2799ca,_0x386a67){return respondWithRpcPromise(_0x6eec('0x4e'),_0x2799ca[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x386a67,null))['catch'](handleError(_0x386a67,null));};exports[_0x6eec('0x4f')]=function(_0x2236f7,_0x48bb52){return respondWithRpcPromise(_0x6eec('0x4e'),_0x2236f7[_0x6eec('0x17')],routingClient)['then'](findById(_0x2236f7[_0x6eec('0x1b')]['id']))[_0x6eec('0xa')](respondWithResult(_0x48bb52,null))[_0x6eec('0x18')](handleError(_0x48bb52,null));};exports[_0x6eec('0x50')]=function(_0x4c73f2,_0x40a81a){return respondWithRpcPromise(_0x6eec('0x51'),_0x4c73f2[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x40a81a,null))[_0x6eec('0x18')](handleError(_0x40a81a,null));};exports[_0x6eec('0x52')]=function(_0x5ae0a0,_0x1ed47e){return respondWithRpcPromise('FaxQueues',_0x5ae0a0[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](findById(_0x5ae0a0[_0x6eec('0x1b')]['id']))[_0x6eec('0xa')](respondWithResult(_0x1ed47e,null))[_0x6eec('0x18')](handleError(_0x1ed47e,null));};exports[_0x6eec('0x53')]=function(_0x404b64,_0x2ea7fe){return respondWithRpcPromise(_0x6eec('0x54'),_0x404b64['query'])[_0x6eec('0xa')](respondWithResult(_0x2ea7fe,null))[_0x6eec('0x18')](handleError(_0x2ea7fe,null));};exports[_0x6eec('0x55')]=function(_0x4eef6e,_0x19f8e2){return respondWithRpcPromise(_0x6eec('0x56'),_0x4eef6e['query'],routingClient)[_0x6eec('0xa')](respondWithResult(_0x19f8e2,null))[_0x6eec('0x18')](handleError(_0x19f8e2,null));};exports[_0x6eec('0x57')]=function(_0x18e62b,_0x266689){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x18e62b[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x266689,null))[_0x6eec('0x18')](handleError(_0x266689,null));};exports[_0x6eec('0x58')]=function(_0x3894dc,_0x56483b){return respondWithRpcPromise(_0x6eec('0x59'),_0x3894dc[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x56483b,null))[_0x6eec('0x18')](handleError(_0x56483b,null));};exports[_0x6eec('0x5a')]=function(_0x232b3a,_0x7dd5d1){return respondWithRpcPromise(_0x6eec('0x59'),_0x232b3a['query'],routingClient)[_0x6eec('0xa')](function(_0x59341a){if(_0x232b3a[_0x6eec('0x17')][_0x6eec('0x5b')]!==undefined){var _0x7a7288=_(_0x59341a[_0x6eec('0x15')])['filter']([_0x232b3a[_0x6eec('0x17')]['type'],_0x232b3a[_0x6eec('0x1b')]['id']])[_0x6eec('0x5c')](_0x6eec('0x5d'))[_0x6eec('0x5e')]()['value']();return _0x59341a['rows']['filter'](function(_0x1158b1){return _0x7a7288[_0x6eec('0x5f')](_0x1158b1[_0x6eec('0x5d')])>-0x1;});}else{return _0x59341a[_0x6eec('0x15')]['filter'](function(_0x44302a){return _0x44302a['queue_id']===parseInt(_0x232b3a[_0x6eec('0x1b')]['id']);});}})[_0x6eec('0xa')](respondWithResult(_0x7dd5d1,null))['catch'](handleError(_0x7dd5d1,null));};exports[_0x6eec('0x60')]=function(_0x2f9e8a,_0x333280){return respondWithRpcPromise(_0x6eec('0x61'),_0x2f9e8a[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x333280,null))['catch'](handleError(_0x333280,null));};exports[_0x6eec('0x62')]=function(_0x5aa2f3,_0x64c2ef){return respondWithRpcPromise(_0x6eec('0x63'),_0x5aa2f3['query'],routingClient)[_0x6eec('0xa')](respondWithResult(_0x64c2ef,null))['catch'](handleError(_0x64c2ef,null));};exports[_0x6eec('0x64')]=function(_0x1d1683,_0x8a4166){return respondWithRpcPromise(_0x6eec('0x65'),_0x1d1683['query'],routingClient)[_0x6eec('0xa')](respondWithResult(_0x8a4166,null))['catch'](handleError(_0x8a4166,null));};exports[_0x6eec('0x66')]=function(_0x2c0a85){return function(_0x51560c,_0x3dcf9d){var _0x435562,_0x3a90cd;var _0x328f28=_[_0x6eec('0x67')](_0x2c0a85);var _0x514e15=_0x2c0a85===_0x6eec('0x68')?_0x6eec('0x69'):_0x6eec('0x6a');return db[_0x328f28+_0x6eec('0x6b')][_0x6eec('0x6c')]({'raw':!![],'where':{'id':_0x51560c[_0x6eec('0x1b')]['id']}})['then'](function(_0x4a3af3){if(_[_0x6eec('0x13')](_0x4a3af3)){throw new Error(_0x328f28+_0x6eec('0x6d'));}_0x435562=_0x4a3af3;return db[_0x328f28+'Message']['findOne']({'where':{'id':_0x51560c[_0x6eec('0x23')][_0x6eec('0x6e')]},'include':[{'model':db[_0x328f28+'Interaction'],'as':_0x6eec('0x6f')},{'model':db[_0x328f28+_0x514e15],'as':_0x6eec('0x6a')}]});})[_0x6eec('0xa')](function(_0x5042a0){if(_[_0x6eec('0x13')](_0x5042a0)){throw new Error(_0x328f28+'\x20Message\x20not\x20found');}_0x3a90cd=_0x5042a0;return _0x5042a0[_0x6eec('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6eec('0xa')](function(){var _0x585432={'uniqueid':_0x2c0a85+'.'+_0x3a90cd['id']+'.'+_0x3a90cd[_0x6eec('0x6f')]['id'],'FromUserId':_0x51560c[_0x6eec('0x31')]['id'],'type':_0x6eec('0x71')};_0x585432[_0x328f28+'MessageId']=_0x3a90cd['id'];_0x585432[_0x328f28+_0x6eec('0x72')]=_0x3a90cd[_0x6eec('0x6f')]['id'];_0x585432[_0x6eec('0x73')+_0x328f28+_0x514e15+'Id']=_0x3a90cd[_0x6eec('0x6a')]['id'];_0x585432['To'+_0x328f28+_0x6eec('0x74')]=_0x435562['id'];return db[_0x328f28+_0x6eec('0x75')]['create'](_0x585432);})[_0x6eec('0xa')](function(){return respondWithRpcPromise(_0x6eec('0x76'),{'channel':_0x2c0a85,'interaction':_0x3a90cd[_0x6eec('0x6f')],'message':_0x3a90cd,'account':_0x3a90cd[_0x6eec('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6eec('0x71'),'appdata':_0x435562[_0x6eec('0x11')]+','+(_0x3a90cd[_0x6eec('0x6a')][_0x6eec('0x77')]||0x12c),'interval':_0x6eec('0x78')}]},routingClient);})[_0x6eec('0xa')](respondWithResult(_0x3dcf9d,null))[_0x6eec('0x18')](handleError(_0x3dcf9d,null));};};exports[_0x6eec('0x79')]=function(_0x56043a,_0x1419e0){var _0x1d6604,_0x10fad1;if(_[_0x6eec('0x13')](_0x56043a[_0x6eec('0x23')][_0x6eec('0x7a')])){throw new Error(_0x6eec('0x7b'));}var _0xa94ada=_0x56043a[_0x6eec('0x23')][_0x6eec('0x7a')];var _0xaddba4=_[_0x6eec('0x67')](_0xa94ada);var _0x89aace=_0xa94ada===_0x6eec('0x68')?_0x6eec('0x69'):'Account';return db[_0x6eec('0x7c')]['findOne']({'raw':!![],'where':{'id':_0x56043a[_0x6eec('0x1b')]['id'],'role':_0x6eec('0x3b')}})[_0x6eec('0xa')](function(_0x2607ca){if(_['isNil'](_0x2607ca)){throw new Error(_0x6eec('0x7d'));}_0x1d6604=_0x2607ca;return db[_0xaddba4+'Message'][_0x6eec('0x6c')]({'where':{'id':_0x56043a[_0x6eec('0x23')][_0x6eec('0x6e')]},'include':[{'model':db[_0xaddba4+_0x6eec('0x6f')],'as':_0x6eec('0x6f')},{'model':db[_0xaddba4+_0x89aace],'as':_0x6eec('0x6a')}]});})['then'](function(_0x2888f4){if(_[_0x6eec('0x13')](_0x2888f4)){throw new Error(_0xaddba4+_0x6eec('0x7e'));}_0x10fad1=_0x2888f4;return _0x2888f4[_0x6eec('0x70')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5229db={'uniqueid':_0xa94ada+'.'+_0x10fad1['id']+'.'+_0x10fad1[_0x6eec('0x6f')]['id'],'FromUserId':_0x56043a[_0x6eec('0x31')]['id'],'type':'queue','ToUserId':_0x1d6604['id']};_0x5229db[_0xaddba4+'MessageId']=_0x10fad1['id'];_0x5229db[_0xaddba4+_0x6eec('0x72')]=_0x10fad1[_0x6eec('0x6f')]['id'];_0x5229db['From'+_0xaddba4+_0x89aace+'Id']=_0x10fad1[_0x6eec('0x6a')]['id'];return db[_0xaddba4+_0x6eec('0x75')]['create'](_0x5229db);})[_0x6eec('0xa')](function(){return respondWithRpcPromise(_0x6eec('0x76'),{'channel':_0xa94ada,'interaction':_0x10fad1[_0x6eec('0x6f')],'message':_0x10fad1,'account':_0x10fad1['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x1d6604['name']+','+(_0x10fad1[_0x6eec('0x6a')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x6eec('0xa')](respondWithResult(_0x1419e0,null))['catch'](handleError(_0x1419e0,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index a45c692..18c6180 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 _0x5f90=['./schedule.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2dc3c9,_0x7a5149){var _0x30b9b4=function(_0x308a3f){while(--_0x308a3f){_0x2dc3c9['push'](_0x2dc3c9['shift']());}};_0x30b9b4(++_0x7a5149);}(_0x5f90,0x171));var _0x05f9=function(_0x1345df,_0xd09e36){_0x1345df=_0x1345df-0x0;var _0x4820a0=_0x5f90[_0x1345df];return _0x4820a0;};'use strict';var multer=require('multer');var util=require(_0x05f9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x05f9('0x1'));var router=express[_0x05f9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x05f9('0x3'));var interaction=require(_0x05f9('0x4'));var config=require('../../config/environment');var controller=require(_0x05f9('0x5'));router['get']('/',auth[_0x05f9('0x6')](),controller[_0x05f9('0x7')]);router['get'](_0x05f9('0x8'),auth[_0x05f9('0x6')](),controller[_0x05f9('0x9')]);router['get']('/:id/run',auth[_0x05f9('0x6')](),controller['run']);router[_0x05f9('0xa')]('/',auth[_0x05f9('0x6')](),controller[_0x05f9('0xb')]);router[_0x05f9('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x05f9('0xd')]);router[_0x05f9('0xe')]('/:id',auth[_0x05f9('0x6')](),controller[_0x05f9('0xf')]);module[_0x05f9('0x10')]=router; \ No newline at end of file +var _0x2980=['isAuthenticated','index','/:id','show','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x558036,_0x43e87b){var _0x2dd321=function(_0x4f2c54){while(--_0x4f2c54){_0x558036['push'](_0x558036['shift']());}};_0x2dd321(++_0x43e87b);}(_0x2980,0x148));var _0x0298=function(_0x4b5d59,_0x44858f){_0x4b5d59=_0x4b5d59-0x0;var _0x204914=_0x2980[_0x4b5d59];return _0x204914;};'use strict';var multer=require(_0x0298('0x0'));var util=require(_0x0298('0x1'));var path=require('path');var timeout=require(_0x0298('0x2'));var express=require('express');var router=express[_0x0298('0x3')]();var fs_extra=require(_0x0298('0x4'));var auth=require(_0x0298('0x5'));var interaction=require(_0x0298('0x6'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x0298('0x7')]('/',auth[_0x0298('0x8')](),controller[_0x0298('0x9')]);router[_0x0298('0x7')](_0x0298('0xa'),auth[_0x0298('0x8')](),controller[_0x0298('0xb')]);router[_0x0298('0x7')]('/:id/run',auth['isAuthenticated'](),controller['run']);router['post']('/',auth[_0x0298('0x8')](),controller['create']);router[_0x0298('0xc')]('/:id',auth[_0x0298('0x8')](),controller['update']);router[_0x0298('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x0298('0xe')]);module[_0x0298('0xf')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 89c1123..0a50f47 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 _0xd57d=['exports','STRING','BOOLEAN','DATE','ENUM','years','quarters','months','weeks','days','hours','minutes','csv','pdf','xlsx','default','TEXT','sequelize'];(function(_0x1cac65,_0x88bae3){var _0x2167be=function(_0x1dd533){while(--_0x1dd533){_0x1cac65['push'](_0x1cac65['shift']());}};_0x2167be(++_0x88bae3);}(_0xd57d,0x18b));var _0xdd57=function(_0x255c88,_0x1494a4){_0x255c88=_0x255c88-0x0;var _0x268761=_0xd57d[_0x255c88];return _0x268761;};'use strict';var Sequelize=require(_0xdd57('0x0'));module[_0xdd57('0x1')]={'name':{'type':Sequelize[_0xdd57('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdd57('0x2')]},'active':{'type':Sequelize[_0xdd57('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xdd57('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xdd57('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xdd57('0x5')](_0xdd57('0x6'),_0xdd57('0x7'),_0xdd57('0x8'),_0xdd57('0x9'),_0xdd57('0xa'),_0xdd57('0xb'),_0xdd57('0xc')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xdd57('0x5')](_0xdd57('0xd'),_0xdd57('0xe'),_0xdd57('0xf')),'allowNull':![],'defaultValue':_0xdd57('0xd')},'type':{'type':Sequelize['ENUM']('custom',_0xdd57('0x10')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xdd57('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xdd57('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf10f=['days','hours','csv','pdf','ENUM','custom','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','years','quarters','months'];(function(_0x22c118,_0x3aae97){var _0x5e3267=function(_0x45cce0){while(--_0x45cce0){_0x22c118['push'](_0x22c118['shift']());}};_0x5e3267(++_0x3aae97);}(_0xf10f,0x19b));var _0xff10=function(_0x4c2f84,_0x30efcb){_0x4c2f84=_0x4c2f84-0x0;var _0xe4e65f=_0xf10f[_0x4c2f84];return _0xe4e65f;};'use strict';var Sequelize=require(_0xff10('0x0'));module[_0xff10('0x1')]={'name':{'type':Sequelize[_0xff10('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xff10('0x2')]},'active':{'type':Sequelize[_0xff10('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xff10('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xff10('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xff10('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xff10('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xff10('0x6'),_0xff10('0x7'),_0xff10('0x8'),'weeks',_0xff10('0x9'),_0xff10('0xa'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0xff10('0xb'),_0xff10('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0xff10('0xb')},'type':{'type':Sequelize[_0xff10('0xd')](_0xff10('0xe'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xff10('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xff10('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xff10('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 6dde14a..f36d193 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 _0x8d9d=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','Schedule','findAll','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','run','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','stack','name','send','map'];(function(_0x3b8388,_0x5eda81){var _0x2bde29=function(_0x51009a){while(--_0x51009a){_0x3b8388['push'](_0x3b8388['shift']());}};_0x2bde29(++_0x5eda81);}(_0x8d9d,0x1bd));var _0xd8d9=function(_0x5cfe7f,_0x4bb924){_0x5cfe7f=_0x5cfe7f-0x0;var _0x59f200=_0x8d9d[_0x5cfe7f];return _0x59f200;};'use strict';var emlformat=require(_0xd8d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8d9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd8d9('0x2'));var moment=require('moment');var BPromise=require(_0xd8d9('0x3'));var Mustache=require(_0xd8d9('0x4'));var util=require(_0xd8d9('0x5'));var path=require('path');var sox=require(_0xd8d9('0x6'));var csv=require(_0xd8d9('0x7'));var ejs=require(_0xd8d9('0x8'));var fs=require('fs');var fs_extra=require(_0xd8d9('0x9'));var _=require(_0xd8d9('0xa'));var squel=require(_0xd8d9('0xb'));var crypto=require(_0xd8d9('0xc'));var jsforce=require(_0xd8d9('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd8d9('0xe'));var Papa=require(_0xd8d9('0xf'));var Redis=require(_0xd8d9('0x10'));var authService=require(_0xd8d9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd8d9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd8d9('0x13'))(_0xd8d9('0x14'));var utils=require(_0xd8d9('0x15'));var config=require(_0xd8d9('0x16'));var licenseUtil=require(_0xd8d9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b5427,_0x3414e8){_0x3414e8=_0x3414e8||0xcc;return function(_0x3da3e0){if(_0x3da3e0){return _0x3b5427[_0xd8d9('0x18')](_0x3414e8);}return _0x3b5427['status'](_0x3414e8)[_0xd8d9('0x19')]();};}function respondWithResult(_0x12ed04,_0x1b9fcf){_0x1b9fcf=_0x1b9fcf||0xc8;return function(_0x701473){if(_0x701473){return _0x12ed04[_0xd8d9('0x1a')](_0x1b9fcf)[_0xd8d9('0x1b')](_0x701473);}};}function respondWithFilteredResult(_0x4062b8,_0x182839){return function(_0x5f1795){if(_0x5f1795){var _0x315b97=typeof _0x182839[_0xd8d9('0x1c')]===_0xd8d9('0x1d')&&typeof _0x182839[_0xd8d9('0x1e')]==='undefined';var _0x5de5e0=_0x5f1795[_0xd8d9('0x1f')];var _0x450dde=_0x315b97?0x0:_0x182839['offset'];var _0x2ffc9b=_0x315b97?_0x5f1795[_0xd8d9('0x1f')]:_0x182839[_0xd8d9('0x1c')]+_0x182839['limit'];var _0x3dcc22;if(_0x2ffc9b>=_0x5de5e0){_0x2ffc9b=_0x5de5e0;_0x3dcc22=0xc8;}else{_0x3dcc22=0xce;}_0x4062b8[_0xd8d9('0x1a')](_0x3dcc22);return _0x4062b8[_0xd8d9('0x20')](_0xd8d9('0x21'),_0x450dde+'-'+_0x2ffc9b+'/'+_0x5de5e0)[_0xd8d9('0x1b')](_0x5f1795);}return null;};}function patchUpdates(_0x129252){return function(_0xa20a53){try{jsonpatch[_0xd8d9('0x22')](_0xa20a53,_0x129252,!![]);}catch(_0x4132dd){return BPromise[_0xd8d9('0x23')](_0x4132dd);}return _0xa20a53[_0xd8d9('0x24')]();};}function saveUpdates(_0x1ec575,_0x2bc039){return function(_0x1118c7){if(_0x1118c7){return _0x1118c7[_0xd8d9('0x25')](_0x1ec575)[_0xd8d9('0x26')](function(_0x339c77){return _0x339c77;});}return null;};}function removeEntity(_0x592a99,_0x457be2){return function(_0x4ce9bf){if(_0x4ce9bf){return _0x4ce9bf[_0xd8d9('0x27')]()[_0xd8d9('0x26')](function(){var _0x14be2d=_0x4ce9bf[_0xd8d9('0x28')]({'plain':!![]});var _0x172cfe=_0xd8d9('0x29');return db[_0xd8d9('0x2a')][_0xd8d9('0x27')]({'where':{'type':_0x172cfe,'resourceId':_0x14be2d['id']}})[_0xd8d9('0x26')](function(){return _0x4ce9bf;});})[_0xd8d9('0x26')](function(){_0x592a99['status'](0xcc)[_0xd8d9('0x19')]();});}};}function handleEntityNotFound(_0x41df42,_0x2e9961){return function(_0x2825f9){if(!_0x2825f9){_0x41df42[_0xd8d9('0x18')](0x194);}return _0x2825f9;};}function handleError(_0x158f7f,_0x4ae887){_0x4ae887=_0x4ae887||0x1f4;return function(_0x36851e){logger['error'](_0x36851e[_0xd8d9('0x2b')]);if(_0x36851e[_0xd8d9('0x2c')]){delete _0x36851e['name'];}_0x158f7f[_0xd8d9('0x1a')](_0x4ae887)[_0xd8d9('0x2d')](_0x36851e);};}exports['index']=function(_0x489bc2,_0x6f4a46){var _0xd12593={},_0x496b79={},_0x37b0b4={'count':0x0,'rows':[]};var _0x334d39=_[_0xd8d9('0x2e')](db['Schedule'][_0xd8d9('0x2f')],function(_0x17e599){return{'name':_0x17e599[_0xd8d9('0x30')],'type':_0x17e599[_0xd8d9('0x31')][_0xd8d9('0x32')]};});_0x496b79[_0xd8d9('0x33')]=_[_0xd8d9('0x2e')](_0x334d39,'name');_0x496b79[_0xd8d9('0x34')]=_[_0xd8d9('0x35')](_0x489bc2[_0xd8d9('0x34')]);_0x496b79[_0xd8d9('0x36')]=_[_0xd8d9('0x37')](_0x496b79[_0xd8d9('0x33')],_0x496b79[_0xd8d9('0x34')]);_0xd12593[_0xd8d9('0x38')]=_[_0xd8d9('0x37')](_0x496b79[_0xd8d9('0x33')],qs[_0xd8d9('0x39')](_0x489bc2[_0xd8d9('0x34')][_0xd8d9('0x39')]));_0xd12593['attributes']=_0xd12593[_0xd8d9('0x38')][_0xd8d9('0x3a')]?_0xd12593[_0xd8d9('0x38')]:_0x496b79[_0xd8d9('0x33')];if(!_0x489bc2[_0xd8d9('0x34')][_0xd8d9('0x3b')]('nolimit')){_0xd12593[_0xd8d9('0x1e')]=qs[_0xd8d9('0x1e')](_0x489bc2[_0xd8d9('0x34')]['limit']);_0xd12593['offset']=qs[_0xd8d9('0x1c')](_0x489bc2[_0xd8d9('0x34')][_0xd8d9('0x1c')]);}_0xd12593[_0xd8d9('0x3c')]=qs['sort'](_0x489bc2[_0xd8d9('0x34')][_0xd8d9('0x3d')]);_0xd12593['where']=qs[_0xd8d9('0x36')](_[_0xd8d9('0x3e')](_0x489bc2[_0xd8d9('0x34')],_0x496b79[_0xd8d9('0x36')]),_0x334d39);if(_0x489bc2[_0xd8d9('0x34')][_0xd8d9('0x3f')]){_0xd12593[_0xd8d9('0x40')]=_[_0xd8d9('0x41')](_0xd12593['where'],{'$or':_[_0xd8d9('0x2e')](_0x334d39,function(_0x34355c){if(_0x34355c[_0xd8d9('0x31')]!==_0xd8d9('0x42')){var _0x38de2a={};_0x38de2a[_0x34355c[_0xd8d9('0x2c')]]={'$like':'%'+_0x489bc2[_0xd8d9('0x34')][_0xd8d9('0x3f')]+'%'};return _0x38de2a;}})});}_0xd12593=_[_0xd8d9('0x41')]({},_0xd12593,_0x489bc2['options']);var _0x56a3d3={'where':_0xd12593[_0xd8d9('0x40')]};return db['Schedule']['count'](_0x56a3d3)[_0xd8d9('0x26')](function(_0x253699){_0x37b0b4[_0xd8d9('0x1f')]=_0x253699;if(_0x489bc2[_0xd8d9('0x34')][_0xd8d9('0x43')]){_0xd12593['include']=[{'all':!![]}];}return db[_0xd8d9('0x44')][_0xd8d9('0x45')](_0xd12593);})['then'](function(_0x381a18){_0x37b0b4[_0xd8d9('0x46')]=_0x381a18;return _0x37b0b4;})[_0xd8d9('0x26')](respondWithFilteredResult(_0x6f4a46,_0xd12593))[_0xd8d9('0x47')](handleError(_0x6f4a46,null));};exports['show']=function(_0x587a90,_0x4c8af2){var _0x38bc13={'raw':![],'where':{'id':_0x587a90[_0xd8d9('0x48')]['id']}},_0x30c6c9={};_0x30c6c9[_0xd8d9('0x33')]=_[_0xd8d9('0x35')](db['Schedule'][_0xd8d9('0x2f')]);_0x30c6c9['query']=_['keys'](_0x587a90[_0xd8d9('0x34')]);_0x30c6c9[_0xd8d9('0x36')]=_['intersection'](_0x30c6c9[_0xd8d9('0x33')],_0x30c6c9[_0xd8d9('0x34')]);_0x38bc13[_0xd8d9('0x38')]=_['intersection'](_0x30c6c9[_0xd8d9('0x33')],qs[_0xd8d9('0x39')](_0x587a90[_0xd8d9('0x34')][_0xd8d9('0x39')]));_0x38bc13['attributes']=_0x38bc13['attributes'][_0xd8d9('0x3a')]?_0x38bc13[_0xd8d9('0x38')]:_0x30c6c9['model'];if(_0x587a90[_0xd8d9('0x34')][_0xd8d9('0x43')]){_0x38bc13['include']=[{'all':!![]}];}_0x38bc13=_[_0xd8d9('0x41')]({},_0x38bc13,_0x587a90['options']);return db['Schedule'][_0xd8d9('0x49')](_0x38bc13)[_0xd8d9('0x26')](handleEntityNotFound(_0x4c8af2,null))[_0xd8d9('0x26')](respondWithResult(_0x4c8af2,null))[_0xd8d9('0x47')](handleError(_0x4c8af2,null));};exports[_0xd8d9('0x4a')]=function(_0x2b8c99,_0x28b13f){return db['Schedule'][_0xd8d9('0x4a')](_0x2b8c99[_0xd8d9('0x4b')],{})['then'](function(_0x3c3845){var _0x3afd50=_0x2b8c99['user'][_0xd8d9('0x28')]({'plain':!![]});if(!_0x3afd50)throw new Error(_0xd8d9('0x4c'));if(_0x3afd50[_0xd8d9('0x4d')]==='user'){var _0x4d28b5=_0x3c3845[_0xd8d9('0x28')]({'plain':!![]});var _0x25f4dc=_0xd8d9('0x29');return db[_0xd8d9('0x4e')][_0xd8d9('0x49')]({'where':{'name':_0x25f4dc,'userProfileId':_0x3afd50[_0xd8d9('0x4f')]},'raw':!![]})[_0xd8d9('0x26')](function(_0x1530c0){if(_0x1530c0&&_0x1530c0['autoAssociation']===0x0){return db[_0xd8d9('0x2a')][_0xd8d9('0x4a')]({'name':_0x4d28b5[_0xd8d9('0x2c')],'resourceId':_0x4d28b5['id'],'type':_0x1530c0[_0xd8d9('0x2c')],'sectionId':_0x1530c0['id']},{})['then'](function(){return _0x3c3845;});}else{return _0x3c3845;}})['catch'](function(_0x16340b){logger[_0xd8d9('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16340b);throw _0x16340b;});}return _0x3c3845;})[_0xd8d9('0x26')](respondWithResult(_0x28b13f,0xc9))[_0xd8d9('0x47')](handleError(_0x28b13f,null));};exports['update']=function(_0x467f95,_0x208db9){if(_0x467f95['body']['id']){delete _0x467f95[_0xd8d9('0x4b')]['id'];}return db[_0xd8d9('0x44')][_0xd8d9('0x49')]({'where':{'id':_0x467f95['params']['id']}})[_0xd8d9('0x26')](handleEntityNotFound(_0x208db9,null))[_0xd8d9('0x26')](saveUpdates(_0x467f95[_0xd8d9('0x4b')],null))['then'](respondWithResult(_0x208db9,null))[_0xd8d9('0x47')](handleError(_0x208db9,null));};exports['destroy']=function(_0x388f76,_0x598859){return db['Schedule']['find']({'where':{'id':_0x388f76[_0xd8d9('0x48')]['id']}})[_0xd8d9('0x26')](handleEntityNotFound(_0x598859,null))['then'](removeEntity(_0x598859,null))[_0xd8d9('0x47')](handleError(_0x598859,null));};exports[_0xd8d9('0x51')]=function(_0x5cb432,_0x681f53,_0x17b134){var _0x448163=require('../../config/schedule');return db[_0xd8d9('0x44')][_0xd8d9('0x49')]({'where':{'id':_0x5cb432['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x681f53,null))[_0xd8d9('0x26')](function(){_0x448163[_0xd8d9('0x51')](_0x5cb432[_0xd8d9('0x48')]['id']);})['then'](respondWithStatusCode(_0x681f53,null))['catch'](handleError(_0x681f53,null));}; \ No newline at end of file +var _0x0072=['apply','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Schedule','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x27fec2,_0x1d8bd2){var _0x38f21e=function(_0x37452b){while(--_0x37452b){_0x27fec2['push'](_0x27fec2['shift']());}};_0x38f21e(++_0x1d8bd2);}(_0x0072,0x18f));var _0x2007=function(_0x54c2f1,_0x3f7f64){_0x54c2f1=_0x54c2f1-0x0;var _0x40ae59=_0x0072[_0x54c2f1];return _0x40ae59;};'use strict';var emlformat=require(_0x2007('0x0'));var rimraf=require(_0x2007('0x1'));var zipdir=require(_0x2007('0x2'));var jsonpatch=require(_0x2007('0x3'));var rp=require(_0x2007('0x4'));var moment=require(_0x2007('0x5'));var BPromise=require(_0x2007('0x6'));var Mustache=require(_0x2007('0x7'));var util=require(_0x2007('0x8'));var path=require(_0x2007('0x9'));var sox=require(_0x2007('0xa'));var csv=require(_0x2007('0xb'));var ejs=require(_0x2007('0xc'));var fs=require('fs');var fs_extra=require(_0x2007('0xd'));var _=require('lodash');var squel=require(_0x2007('0xe'));var crypto=require('crypto');var jsforce=require(_0x2007('0xf'));var deskjs=require(_0x2007('0x10'));var toCsv=require(_0x2007('0xb'));var querystring=require(_0x2007('0x11'));var Papa=require('papaparse');var Redis=require(_0x2007('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2007('0x13'));var as=require(_0x2007('0x14'));var hardwareService=require(_0x2007('0x15'));var logger=require(_0x2007('0x16'))(_0x2007('0x17'));var utils=require(_0x2007('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2007('0x19'));var db=require(_0x2007('0x1a'))['db'];function respondWithStatusCode(_0x49bd41,_0x1be923){_0x1be923=_0x1be923||0xcc;return function(_0xccb881){if(_0xccb881){return _0x49bd41[_0x2007('0x1b')](_0x1be923);}return _0x49bd41[_0x2007('0x1c')](_0x1be923)[_0x2007('0x1d')]();};}function respondWithResult(_0x109822,_0x3dde62){_0x3dde62=_0x3dde62||0xc8;return function(_0x502cef){if(_0x502cef){return _0x109822[_0x2007('0x1c')](_0x3dde62)[_0x2007('0x1e')](_0x502cef);}};}function respondWithFilteredResult(_0x5c07ab,_0x2f9dd3){return function(_0x743dc5){if(_0x743dc5){var _0x2a2988=typeof _0x2f9dd3[_0x2007('0x1f')]===_0x2007('0x20')&&typeof _0x2f9dd3[_0x2007('0x21')]===_0x2007('0x20');var _0x8cbf3a=_0x743dc5[_0x2007('0x22')];var _0x5385ab=_0x2a2988?0x0:_0x2f9dd3[_0x2007('0x1f')];var _0x3888af=_0x2a2988?_0x743dc5[_0x2007('0x22')]:_0x2f9dd3['offset']+_0x2f9dd3['limit'];var _0x5ee14c;if(_0x3888af>=_0x8cbf3a){_0x3888af=_0x8cbf3a;_0x5ee14c=0xc8;}else{_0x5ee14c=0xce;}_0x5c07ab[_0x2007('0x1c')](_0x5ee14c);return _0x5c07ab[_0x2007('0x23')]('Content-Range',_0x5385ab+'-'+_0x3888af+'/'+_0x8cbf3a)[_0x2007('0x1e')](_0x743dc5);}return null;};}function patchUpdates(_0x4fe3b7){return function(_0x2a925f){try{jsonpatch[_0x2007('0x24')](_0x2a925f,_0x4fe3b7,!![]);}catch(_0x4308c9){return BPromise['reject'](_0x4308c9);}return _0x2a925f[_0x2007('0x25')]();};}function saveUpdates(_0x23dfa0,_0x137553){return function(_0x61aa23){if(_0x61aa23){return _0x61aa23[_0x2007('0x26')](_0x23dfa0)[_0x2007('0x27')](function(_0x48203d){return _0x48203d;});}return null;};}function removeEntity(_0xdf1a00,_0x43e7e9){return function(_0x610b7c){if(_0x610b7c){return _0x610b7c[_0x2007('0x28')]()['then'](function(){var _0x44bc2f=_0x610b7c[_0x2007('0x29')]({'plain':!![]});var _0x526c48=_0x2007('0x2a');return db[_0x2007('0x2b')]['destroy']({'where':{'type':_0x526c48,'resourceId':_0x44bc2f['id']}})[_0x2007('0x27')](function(){return _0x610b7c;});})[_0x2007('0x27')](function(){_0xdf1a00[_0x2007('0x1c')](0xcc)[_0x2007('0x1d')]();});}};}function handleEntityNotFound(_0x47fac6,_0x19b72c){return function(_0x3d79ec){if(!_0x3d79ec){_0x47fac6[_0x2007('0x1b')](0x194);}return _0x3d79ec;};}function handleError(_0x3dbb6e,_0x1f3a25){_0x1f3a25=_0x1f3a25||0x1f4;return function(_0x5dd5e1){logger[_0x2007('0x2c')](_0x5dd5e1[_0x2007('0x2d')]);if(_0x5dd5e1[_0x2007('0x2e')]){delete _0x5dd5e1[_0x2007('0x2e')];}_0x3dbb6e['status'](_0x1f3a25)[_0x2007('0x2f')](_0x5dd5e1);};}exports['index']=function(_0x1d8b9c,_0x32a978){var _0x62152={},_0x1d00b9={},_0x202149={'count':0x0,'rows':[]};var _0x169e01=_[_0x2007('0x30')](db['Schedule'][_0x2007('0x31')],function(_0x2966d7){return{'name':_0x2966d7['fieldName'],'type':_0x2966d7[_0x2007('0x32')]['key']};});_0x1d00b9[_0x2007('0x33')]=_[_0x2007('0x30')](_0x169e01,_0x2007('0x2e'));_0x1d00b9[_0x2007('0x34')]=_[_0x2007('0x35')](_0x1d8b9c[_0x2007('0x34')]);_0x1d00b9[_0x2007('0x36')]=_[_0x2007('0x37')](_0x1d00b9[_0x2007('0x33')],_0x1d00b9[_0x2007('0x34')]);_0x62152[_0x2007('0x38')]=_[_0x2007('0x37')](_0x1d00b9['model'],qs[_0x2007('0x39')](_0x1d8b9c[_0x2007('0x34')][_0x2007('0x39')]));_0x62152['attributes']=_0x62152['attributes']['length']?_0x62152[_0x2007('0x38')]:_0x1d00b9[_0x2007('0x33')];if(!_0x1d8b9c[_0x2007('0x34')][_0x2007('0x3a')](_0x2007('0x3b'))){_0x62152['limit']=qs[_0x2007('0x21')](_0x1d8b9c['query'][_0x2007('0x21')]);_0x62152[_0x2007('0x1f')]=qs[_0x2007('0x1f')](_0x1d8b9c[_0x2007('0x34')][_0x2007('0x1f')]);}_0x62152[_0x2007('0x3c')]=qs[_0x2007('0x3d')](_0x1d8b9c[_0x2007('0x34')][_0x2007('0x3d')]);_0x62152[_0x2007('0x3e')]=qs[_0x2007('0x36')](_['pick'](_0x1d8b9c[_0x2007('0x34')],_0x1d00b9[_0x2007('0x36')]),_0x169e01);if(_0x1d8b9c[_0x2007('0x34')][_0x2007('0x3f')]){_0x62152[_0x2007('0x3e')]=_[_0x2007('0x40')](_0x62152[_0x2007('0x3e')],{'$or':_['map'](_0x169e01,function(_0x16fcef){if(_0x16fcef[_0x2007('0x32')]!==_0x2007('0x41')){var _0x19fdf1={};_0x19fdf1[_0x16fcef['name']]={'$like':'%'+_0x1d8b9c[_0x2007('0x34')][_0x2007('0x3f')]+'%'};return _0x19fdf1;}})});}_0x62152=_[_0x2007('0x40')]({},_0x62152,_0x1d8b9c[_0x2007('0x42')]);var _0x283467={'where':_0x62152[_0x2007('0x3e')]};return db[_0x2007('0x43')][_0x2007('0x22')](_0x283467)[_0x2007('0x27')](function(_0x50081b){_0x202149[_0x2007('0x22')]=_0x50081b;if(_0x1d8b9c['query'][_0x2007('0x44')]){_0x62152[_0x2007('0x45')]=[{'all':!![]}];}return db[_0x2007('0x43')][_0x2007('0x46')](_0x62152);})[_0x2007('0x27')](function(_0x4d3dcd){_0x202149[_0x2007('0x47')]=_0x4d3dcd;return _0x202149;})['then'](respondWithFilteredResult(_0x32a978,_0x62152))[_0x2007('0x48')](handleError(_0x32a978,null));};exports[_0x2007('0x49')]=function(_0x19e63b,_0x1e3b31){var _0x212409={'raw':![],'where':{'id':_0x19e63b[_0x2007('0x4a')]['id']}},_0x3b8db6={};_0x3b8db6[_0x2007('0x33')]=_['keys'](db[_0x2007('0x43')]['rawAttributes']);_0x3b8db6['query']=_[_0x2007('0x35')](_0x19e63b[_0x2007('0x34')]);_0x3b8db6[_0x2007('0x36')]=_[_0x2007('0x37')](_0x3b8db6['model'],_0x3b8db6['query']);_0x212409['attributes']=_[_0x2007('0x37')](_0x3b8db6[_0x2007('0x33')],qs['fields'](_0x19e63b[_0x2007('0x34')]['fields']));_0x212409['attributes']=_0x212409[_0x2007('0x38')][_0x2007('0x4b')]?_0x212409[_0x2007('0x38')]:_0x3b8db6[_0x2007('0x33')];if(_0x19e63b[_0x2007('0x34')][_0x2007('0x44')]){_0x212409[_0x2007('0x45')]=[{'all':!![]}];}_0x212409=_[_0x2007('0x40')]({},_0x212409,_0x19e63b['options']);return db[_0x2007('0x43')][_0x2007('0x4c')](_0x212409)[_0x2007('0x27')](handleEntityNotFound(_0x1e3b31,null))[_0x2007('0x27')](respondWithResult(_0x1e3b31,null))[_0x2007('0x48')](handleError(_0x1e3b31,null));};exports[_0x2007('0x4d')]=function(_0x57091d,_0x23d8b7){return db['Schedule']['create'](_0x57091d[_0x2007('0x4e')],{})[_0x2007('0x27')](function(_0x5e00e1){var _0x31d0c2=_0x57091d['user']['get']({'plain':!![]});if(!_0x31d0c2)throw new Error(_0x2007('0x4f'));if(_0x31d0c2[_0x2007('0x50')]===_0x2007('0x51')){var _0xf8f4d4=_0x5e00e1[_0x2007('0x29')]({'plain':!![]});var _0x371006=_0x2007('0x2a');return db[_0x2007('0x52')]['find']({'where':{'name':_0x371006,'userProfileId':_0x31d0c2[_0x2007('0x53')]},'raw':!![]})[_0x2007('0x27')](function(_0x463198){if(_0x463198&&_0x463198['autoAssociation']===0x0){return db[_0x2007('0x2b')][_0x2007('0x4d')]({'name':_0xf8f4d4['name'],'resourceId':_0xf8f4d4['id'],'type':_0x463198[_0x2007('0x2e')],'sectionId':_0x463198['id']},{})[_0x2007('0x27')](function(){return _0x5e00e1;});}else{return _0x5e00e1;}})[_0x2007('0x48')](function(_0x447f39){logger['error'](_0x2007('0x54'),_0x447f39);throw _0x447f39;});}return _0x5e00e1;})['then'](respondWithResult(_0x23d8b7,0xc9))[_0x2007('0x48')](handleError(_0x23d8b7,null));};exports[_0x2007('0x26')]=function(_0x9217e2,_0x387120){if(_0x9217e2[_0x2007('0x4e')]['id']){delete _0x9217e2[_0x2007('0x4e')]['id'];}return db[_0x2007('0x43')][_0x2007('0x4c')]({'where':{'id':_0x9217e2[_0x2007('0x4a')]['id']}})['then'](handleEntityNotFound(_0x387120,null))[_0x2007('0x27')](saveUpdates(_0x9217e2[_0x2007('0x4e')],null))['then'](respondWithResult(_0x387120,null))['catch'](handleError(_0x387120,null));};exports[_0x2007('0x28')]=function(_0x169b9a,_0x1539bb){return db[_0x2007('0x43')][_0x2007('0x4c')]({'where':{'id':_0x169b9a[_0x2007('0x4a')]['id']}})[_0x2007('0x27')](handleEntityNotFound(_0x1539bb,null))[_0x2007('0x27')](removeEntity(_0x1539bb,null))['catch'](handleError(_0x1539bb,null));};exports[_0x2007('0x55')]=function(_0x3fdbda,_0x5d1fec,_0x4a06ca){var _0x2d5bd=require(_0x2007('0x56'));return db[_0x2007('0x43')][_0x2007('0x4c')]({'where':{'id':_0x3fdbda[_0x2007('0x4a')]['id']},'raw':!![]})[_0x2007('0x27')](handleEntityNotFound(_0x5d1fec,null))[_0x2007('0x27')](function(){_0x2d5bd[_0x2007('0x55')](_0x3fdbda[_0x2007('0x4a')]['id']);})['then'](respondWithStatusCode(_0x5d1fec,null))['catch'](handleError(_0x5d1fec,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 4cf6d76..ef96b0e 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 _0xc75e=['exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xc75e,0xa9));var _0xec75=function(_0x3cab77,_0x5a0b79){_0x3cab77=_0x3cab77-0x0;var _0x2c7e2c=_0xc75e[_0x3cab77];return _0x2c7e2c;};'use strict';var _=require(_0xec75('0x0'));var util=require(_0xec75('0x1'));var logger=require(_0xec75('0x2'))(_0xec75('0x3'));var moment=require(_0xec75('0x4'));var BPromise=require(_0xec75('0x5'));var rp=require(_0xec75('0x6'));var fs=require('fs');var path=require(_0xec75('0x7'));var rimraf=require(_0xec75('0x8'));var config=require(_0xec75('0x9'));var attributes=require(_0xec75('0xa'));module[_0xec75('0xb')]=function(_0x4e8259,_0x4d4cec){return _0x4e8259[_0xec75('0xc')](_0xec75('0xd'),attributes,{'tableName':_0xec75('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa368=['rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4bbc77,_0xf21f8c){var _0x1cf33f=function(_0x7f0ac5){while(--_0x7f0ac5){_0x4bbc77['push'](_0x4bbc77['shift']());}};_0x1cf33f(++_0xf21f8c);}(_0xa368,0x1e7));var _0x8a36=function(_0x8f5b71,_0x5ce395){_0x8f5b71=_0x8f5b71-0x0;var _0x448cbb=_0xa368[_0x8f5b71];return _0x448cbb;};'use strict';var _=require(_0x8a36('0x0'));var util=require(_0x8a36('0x1'));var logger=require(_0x8a36('0x2'))(_0x8a36('0x3'));var moment=require(_0x8a36('0x4'));var BPromise=require(_0x8a36('0x5'));var rp=require(_0x8a36('0x6'));var fs=require('fs');var path=require(_0x8a36('0x7'));var rimraf=require(_0x8a36('0x8'));var config=require(_0x8a36('0x9'));var attributes=require(_0x8a36('0xa'));module[_0x8a36('0xb')]=function(_0x1746c8,_0x4c2a02){return _0x1746c8[_0x8a36('0xc')](_0x8a36('0xd'),attributes,{'tableName':_0x8a36('0xe'),'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 1c89e68..d8e20d9 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 _0xb7b5=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x3022db,_0x8d7f2f){var _0x5ed072=function(_0x3dbd22){while(--_0x3dbd22){_0x3022db['push'](_0x3022db['shift']());}};_0x5ed072(++_0x8d7f2f);}(_0xb7b5,0x121));var _0x5b7b=function(_0x1b125e,_0x34ca02){_0x1b125e=_0x1b125e-0x0;var _0x22981f=_0xb7b5[_0x1b125e];return _0x22981f;};'use strict';var _=require(_0x5b7b('0x0'));var util=require(_0x5b7b('0x1'));var moment=require('moment');var BPromise=require(_0x5b7b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b7b('0x3'));var db=require(_0x5b7b('0x4'))['db'];var utils=require(_0x5b7b('0x5'));var logger=require(_0x5b7b('0x6'))(_0x5b7b('0x7'));var config=require('../../config/environment');var jayson=require(_0x5b7b('0x8'));var client=jayson[_0x5b7b('0x9')][_0x5b7b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40d385,_0x37e4e5,_0x53dc38){return new BPromise(function(_0x153f34,_0x1f1b2b){return client[_0x5b7b('0xb')](_0x40d385,_0x53dc38)[_0x5b7b('0xc')](function(_0x56e772){logger[_0x5b7b('0xd')](_0x5b7b('0xe'),_0x37e4e5,_0x5b7b('0xf'));logger['debug'](_0x5b7b('0x10'),_0x37e4e5,_0x5b7b('0xf'),JSON[_0x5b7b('0x11')](_0x56e772));if(_0x56e772[_0x5b7b('0x12')]){if(_0x56e772[_0x5b7b('0x12')][_0x5b7b('0x13')]===0x1f4){logger[_0x5b7b('0x12')]('Schedule,\x20%s,\x20%s',_0x37e4e5,_0x56e772['error'][_0x5b7b('0x14')]);return _0x1f1b2b(_0x56e772[_0x5b7b('0x12')]['message']);}logger[_0x5b7b('0x12')]('Schedule,\x20%s,\x20%s',_0x37e4e5,_0x56e772[_0x5b7b('0x12')]['message']);return _0x153f34(_0x56e772[_0x5b7b('0x12')][_0x5b7b('0x14')]);}else{logger[_0x5b7b('0xd')](_0x5b7b('0xe'),_0x37e4e5,_0x5b7b('0xf'));_0x153f34(_0x56e772['result'][_0x5b7b('0x14')]);}})['catch'](function(_0x2dc844){logger[_0x5b7b('0x12')](_0x5b7b('0xe'),_0x37e4e5,_0x2dc844);_0x1f1b2b(_0x2dc844);});});} \ No newline at end of file +var _0xfbb4=['jayson/promise','http','request','then','info','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x3cc2f9,_0xdd8f64){var _0x30304b=function(_0x48b4ae){while(--_0x48b4ae){_0x3cc2f9['push'](_0x3cc2f9['shift']());}};_0x30304b(++_0xdd8f64);}(_0xfbb4,0xe1));var _0x4fbb=function(_0x11f522,_0x4433ef){_0x11f522=_0x11f522-0x0;var _0x3f1d6e=_0xfbb4[_0x11f522];return _0x3f1d6e;};'use strict';var _=require(_0x4fbb('0x0'));var util=require('util');var moment=require(_0x4fbb('0x1'));var BPromise=require('bluebird');var rs=require(_0x4fbb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4fbb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4fbb('0x4'))(_0x4fbb('0x5'));var config=require('../../config/environment');var jayson=require(_0x4fbb('0x6'));var client=jayson['client'][_0x4fbb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3de0e6,_0x7db1ea,_0x1322e6){return new BPromise(function(_0x510282,_0x23680d){return client[_0x4fbb('0x8')](_0x3de0e6,_0x1322e6)[_0x4fbb('0x9')](function(_0x53fe9f){logger[_0x4fbb('0xa')]('Schedule,\x20%s,\x20%s',_0x7db1ea,'request\x20sent');logger[_0x4fbb('0xb')](_0x4fbb('0xc'),_0x7db1ea,'request\x20sent',JSON[_0x4fbb('0xd')](_0x53fe9f));if(_0x53fe9f[_0x4fbb('0xe')]){if(_0x53fe9f[_0x4fbb('0xe')][_0x4fbb('0xf')]===0x1f4){logger[_0x4fbb('0xe')](_0x4fbb('0x10'),_0x7db1ea,_0x53fe9f[_0x4fbb('0xe')]['message']);return _0x23680d(_0x53fe9f[_0x4fbb('0xe')][_0x4fbb('0x11')]);}logger[_0x4fbb('0xe')](_0x4fbb('0x10'),_0x7db1ea,_0x53fe9f[_0x4fbb('0xe')][_0x4fbb('0x11')]);return _0x510282(_0x53fe9f[_0x4fbb('0xe')]['message']);}else{logger['info'](_0x4fbb('0x10'),_0x7db1ea,_0x4fbb('0x12'));_0x510282(_0x53fe9f[_0x4fbb('0x13')][_0x4fbb('0x11')]);}})[_0x4fbb('0x14')](function(_0x277ace){logger[_0x4fbb('0xe')](_0x4fbb('0x10'),_0x7db1ea,_0x277ace);_0x23680d(_0x277ace);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index acab1de..19be1dc 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 _0x782f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','/:id','/:id/download','download','post','create','put','update','destroy','exports','path'];(function(_0xb37b81,_0x2bfe66){var _0x2a038e=function(_0xfe9fb4){while(--_0xfe9fb4){_0xb37b81['push'](_0xb37b81['shift']());}};_0x2a038e(++_0x2bfe66);}(_0x782f,0x153));var _0xf782=function(_0x44f861,_0x4dbc21){_0x44f861=_0x44f861-0x0;var _0x1f9eb4=_0x782f[_0x44f861];return _0x1f9eb4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf782('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf782('0x1')]();var fs_extra=require(_0xf782('0x2'));var auth=require(_0xf782('0x3'));var interaction=require(_0xf782('0x4'));var config=require('../../config/environment');var controller=require(_0xf782('0x5'));router[_0xf782('0x6')]('/',auth[_0xf782('0x7')](),controller['index']);router[_0xf782('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xf782('0x6')](_0xf782('0x8'),auth[_0xf782('0x7')](),controller['show']);router[_0xf782('0x6')](_0xf782('0x9'),auth[_0xf782('0x7')](),controller[_0xf782('0xa')]);router[_0xf782('0xb')]('/',auth[_0xf782('0x7')](),controller[_0xf782('0xc')]);router[_0xf782('0xd')](_0xf782('0x8'),auth[_0xf782('0x7')](),controller[_0xf782('0xe')]);router['delete'](_0xf782('0x8'),auth[_0xf782('0x7')](),controller[_0xf782('0xf')]);module[_0xf782('0x10')]=router; \ No newline at end of file +var _0xbba0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x26c9fb,_0x4282e2){var _0x3210a8=function(_0x594f6d){while(--_0x594f6d){_0x26c9fb['push'](_0x26c9fb['shift']());}};_0x3210a8(++_0x4282e2);}(_0xbba0,0x7a));var _0x0bba=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xbba0[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require(_0x0bba('0x0'));var path=require(_0x0bba('0x1'));var timeout=require(_0x0bba('0x2'));var express=require(_0x0bba('0x3'));var router=express[_0x0bba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0bba('0x5'));var interaction=require(_0x0bba('0x6'));var config=require(_0x0bba('0x7'));var controller=require('./screenRecording.controller');router[_0x0bba('0x8')]('/',auth[_0x0bba('0x9')](),controller[_0x0bba('0xa')]);router['get']('/describe',auth[_0x0bba('0x9')](),controller[_0x0bba('0xb')]);router['get'](_0x0bba('0xc'),auth['isAuthenticated'](),controller[_0x0bba('0xd')]);router[_0x0bba('0x8')](_0x0bba('0xe'),auth['isAuthenticated'](),controller[_0x0bba('0xf')]);router['post']('/',auth[_0x0bba('0x9')](),controller['create']);router[_0x0bba('0x10')](_0x0bba('0xc'),auth['isAuthenticated'](),controller[_0x0bba('0x11')]);router[_0x0bba('0x12')](_0x0bba('0xc'),auth[_0x0bba('0x9')](),controller[_0x0bba('0x13')]);module[_0x0bba('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 cfbeaff..f3fbdfe 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 _0x79d7=['VIRTUAL','getDataValue','value','STRING','replace','setDataValue','startedAt','subtract','closedAt','duration','format','toString','DATE','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','path','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79d7,0x9c));var _0x779d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x79d7[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x779d('0x0'));var moment=require('moment');var path=require(_0x779d('0x1'));var config=require(_0x779d('0x2'));module[_0x779d('0x3')]={'format':{'type':Sequelize[_0x779d('0x4')],'get':function(){return this[_0x779d('0x5')](_0x779d('0x6'))?path['extname'](this[_0x779d('0x5')](_0x779d('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x779d('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x227c87){var _0x4c7fb4=_0x227c87[_0x779d('0x8')](/\\/g,'/');this[_0x779d('0x9')]('value',_0x4c7fb4);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x5b4ef2){this[_0x779d('0x9')](_0x779d('0xa'),moment()[_0x779d('0xb')](_0x5b4ef2,'ms'));this['setDataValue'](_0x779d('0xc'),moment());this['setDataValue'](_0x779d('0xd'),_0x5b4ef2);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x779d('0x5')](_0x779d('0xa')))[_0x779d('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x779d('0xf')]();}},'closedAt':{'type':Sequelize[_0x779d('0x10')],'get':function(){return moment(this[_0x779d('0x5')](_0x779d('0xc')))[_0x779d('0xe')](_0x779d('0x11'))['toString']();}},'createdAt':{'type':Sequelize[_0x779d('0x10')],'get':function(){return moment(this[_0x779d('0x5')](_0x779d('0x12')))[_0x779d('0xe')](_0x779d('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0x779d('0x10')],'get':function(){return moment(this[_0x779d('0x5')](_0x779d('0x13')))['format'](_0x779d('0x11'))[_0x779d('0xf')]();}}}; \ No newline at end of file +var _0x96f2=['startedAt','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','sequelize','path','../../config/environment','exports','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER'];(function(_0x2ac3dd,_0x3bc187){var _0x487a05=function(_0x40bce1){while(--_0x40bce1){_0x2ac3dd['push'](_0x2ac3dd['shift']());}};_0x487a05(++_0x3bc187);}(_0x96f2,0xb0));var _0x296f=function(_0x377755,_0x5b6a25){_0x377755=_0x377755-0x0;var _0x22ab73=_0x96f2[_0x377755];return _0x22ab73;};'use strict';var Sequelize=require(_0x296f('0x0'));var moment=require('moment');var path=require(_0x296f('0x1'));var config=require(_0x296f('0x2'));module[_0x296f('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x296f('0x4')](_0x296f('0x5'))?path[_0x296f('0x6')](this['getDataValue'](_0x296f('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x296f('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x164031){var _0x1d019f=_0x164031[_0x296f('0x8')](/\\/g,'/');this[_0x296f('0x9')](_0x296f('0x5'),_0x1d019f);}},'rating':{'type':Sequelize[_0x296f('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x296f('0xa')],'set':function(_0x3ea699){this[_0x296f('0x9')](_0x296f('0xb'),moment()['subtract'](_0x3ea699,'ms'));this[_0x296f('0x9')](_0x296f('0xc'),moment());this[_0x296f('0x9')]('duration',_0x3ea699);}},'startedAt':{'type':Sequelize[_0x296f('0xd')],'get':function(){return moment(this[_0x296f('0x4')](_0x296f('0xb')))[_0x296f('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x296f('0x4')](_0x296f('0xc')))[_0x296f('0xe')](_0x296f('0xf'))['toString']();}},'createdAt':{'type':Sequelize[_0x296f('0xd')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x296f('0xe')](_0x296f('0xf'))[_0x296f('0x10')]();}},'updatedAt':{'type':Sequelize[_0x296f('0xd')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0x296f('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x296f('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index c2920be..8d15e9b 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 _0x5c12=['undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','filter','include','rows','catch','keys','includeAll','options','find','create','body','createdAt','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','limit'];(function(_0x12c4ec,_0x145225){var _0x14fde2=function(_0x48e007){while(--_0x48e007){_0x12c4ec['push'](_0x12c4ec['shift']());}};_0x14fde2(++_0x145225);}(_0x5c12,0x188));var _0x25c1=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x5c12[_0x57fa33];return _0x12e724;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25c1('0x0'));var zipdir=require(_0x25c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25c1('0x2'));var moment=require(_0x25c1('0x3'));var BPromise=require(_0x25c1('0x4'));var Mustache=require(_0x25c1('0x5'));var util=require(_0x25c1('0x6'));var path=require(_0x25c1('0x7'));var sox=require(_0x25c1('0x8'));var csv=require('to-csv');var ejs=require(_0x25c1('0x9'));var fs=require('fs');var fs_extra=require(_0x25c1('0xa'));var _=require(_0x25c1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x25c1('0xc'));var deskjs=require(_0x25c1('0xd'));var toCsv=require(_0x25c1('0xe'));var querystring=require(_0x25c1('0xf'));var Papa=require(_0x25c1('0x10'));var Redis=require('ioredis');var authService=require(_0x25c1('0x11'));var qs=require(_0x25c1('0x12'));var as=require(_0x25c1('0x13'));var hardwareService=require(_0x25c1('0x14'));var logger=require(_0x25c1('0x15'))('api');var utils=require(_0x25c1('0x16'));var config=require(_0x25c1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x25c1('0x18'))['db'];function respondWithStatusCode(_0x209af5,_0x323d3c){_0x323d3c=_0x323d3c||0xcc;return function(_0x329ba9){if(_0x329ba9){return _0x209af5['sendStatus'](_0x323d3c);}return _0x209af5['status'](_0x323d3c)['end']();};}function respondWithResult(_0x54f6f4,_0x3ef429){_0x3ef429=_0x3ef429||0xc8;return function(_0x1412ed){if(_0x1412ed){return _0x54f6f4[_0x25c1('0x19')](_0x3ef429)[_0x25c1('0x1a')](_0x1412ed);}};}function respondWithFilteredResult(_0x17a032,_0x4ea926){return function(_0x4638f0){if(_0x4638f0){var _0x55b62d=typeof _0x4ea926['offset']==='undefined'&&typeof _0x4ea926[_0x25c1('0x1b')]===_0x25c1('0x1c');var _0x4dc64b=_0x4638f0['count'];var _0x61a29f=_0x55b62d?0x0:_0x4ea926['offset'];var _0x7175d4=_0x55b62d?_0x4638f0[_0x25c1('0x1d')]:_0x4ea926['offset']+_0x4ea926['limit'];var _0x542768;if(_0x7175d4>=_0x4dc64b){_0x7175d4=_0x4dc64b;_0x542768=0xc8;}else{_0x542768=0xce;}_0x17a032[_0x25c1('0x19')](_0x542768);return _0x17a032[_0x25c1('0x1e')](_0x25c1('0x1f'),_0x61a29f+'-'+_0x7175d4+'/'+_0x4dc64b)[_0x25c1('0x1a')](_0x4638f0);}return null;};}function patchUpdates(_0x481c12){return function(_0x119639){try{jsonpatch[_0x25c1('0x20')](_0x119639,_0x481c12,!![]);}catch(_0x34454a){return BPromise[_0x25c1('0x21')](_0x34454a);}return _0x119639['save']();};}function saveUpdates(_0x4c3259,_0x2a8a84){return function(_0xac3335){if(_0xac3335){return _0xac3335[_0x25c1('0x22')](_0x4c3259)[_0x25c1('0x23')](function(_0x15cf2f){return _0x15cf2f;});}return null;};}function removeEntity(_0x1a4b89,_0x2ba595){return function(_0x324ea9){if(_0x324ea9){return _0x324ea9[_0x25c1('0x24')]()[_0x25c1('0x23')](function(){_0x1a4b89[_0x25c1('0x19')](0xcc)[_0x25c1('0x25')]();});}};}function handleEntityNotFound(_0x399d72,_0x4915cc){return function(_0x2dadae){if(!_0x2dadae){_0x399d72[_0x25c1('0x26')](0x194);}return _0x2dadae;};}function handleError(_0x1b1c96,_0x1fb59f){_0x1fb59f=_0x1fb59f||0x1f4;return function(_0x21fdb8){logger[_0x25c1('0x27')](_0x21fdb8['stack']);if(_0x21fdb8[_0x25c1('0x28')]){delete _0x21fdb8[_0x25c1('0x28')];}_0x1b1c96[_0x25c1('0x19')](_0x1fb59f)[_0x25c1('0x29')](_0x21fdb8);};}exports[_0x25c1('0x2a')]=function(_0x193a68,_0x5c56ab){var _0x1e498={},_0x478f1e={},_0x76b360={'count':0x0,'rows':[]};var _0x31c153=_[_0x25c1('0x2b')](db[_0x25c1('0x2c')][_0x25c1('0x2d')],function(_0x21069c){return{'name':_0x21069c[_0x25c1('0x2e')],'type':_0x21069c[_0x25c1('0x2f')][_0x25c1('0x30')]};});_0x478f1e['model']=_[_0x25c1('0x31')](_['map'](_0x31c153,'name'),[_0x25c1('0x32')]);_0x478f1e[_0x25c1('0x33')]=_['keys'](_0x193a68[_0x25c1('0x33')]);_0x478f1e['filters']=_[_0x25c1('0x34')](_0x478f1e['model'],_0x478f1e[_0x25c1('0x33')]);_0x1e498[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x478f1e[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1e498[_0x25c1('0x35')]=_0x1e498['attributes'][_0x25c1('0x38')]?_0x1e498['attributes']:_0x478f1e[_0x25c1('0x36')];if(!_0x193a68['query'][_0x25c1('0x39')](_0x25c1('0x3a'))){_0x1e498[_0x25c1('0x1b')]=qs[_0x25c1('0x1b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x1b')]);_0x1e498[_0x25c1('0x3b')]=qs[_0x25c1('0x3b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3b')]);}_0x1e498[_0x25c1('0x3c')]=qs[_0x25c1('0x3d')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3d')]);_0x1e498[_0x25c1('0x3e')]=qs[_0x25c1('0x3f')](_[_0x25c1('0x40')](_0x193a68[_0x25c1('0x33')],_0x478f1e[_0x25c1('0x3f')]),_0x31c153);if(_0x193a68[_0x25c1('0x33')]['filter']){_0x1e498[_0x25c1('0x3e')]=_[_0x25c1('0x41')](_0x1e498['where'],{'$or':_[_0x25c1('0x2b')](_0x31c153,function(_0x5eca99){if(_0x5eca99[_0x25c1('0x2f')]!=='VIRTUAL'){var _0x4326fb={};_0x4326fb[_0x5eca99[_0x25c1('0x28')]]={'$like':'%'+_0x193a68[_0x25c1('0x33')][_0x25c1('0x42')]+'%'};return _0x4326fb;}})});}_0x1e498=_[_0x25c1('0x41')]({},_0x1e498,_0x193a68['options']);var _0x1fe6d7={'where':_0x1e498['where']};return db[_0x25c1('0x2c')][_0x25c1('0x1d')](_0x1fe6d7)[_0x25c1('0x23')](function(_0x17fc23){_0x76b360['count']=_0x17fc23;if(_0x193a68['query']['includeAll']){_0x1e498[_0x25c1('0x43')]=[{'all':!![]}];}return db[_0x25c1('0x2c')]['findAll'](_0x1e498);})[_0x25c1('0x23')](function(_0x58792d){_0x76b360[_0x25c1('0x44')]=_0x58792d;return _0x76b360;})[_0x25c1('0x23')](respondWithFilteredResult(_0x5c56ab,_0x1e498))[_0x25c1('0x45')](handleError(_0x5c56ab,null));};exports['show']=function(_0x5502c1,_0x53f87b){var _0x1b1d17={'raw':![],'where':{'id':_0x5502c1['params']['id']}},_0x3cf9c0={};_0x3cf9c0[_0x25c1('0x36')]=_[_0x25c1('0x46')](db[_0x25c1('0x2c')]['rawAttributes']);_0x3cf9c0['query']=_['keys'](_0x5502c1['query']);_0x3cf9c0[_0x25c1('0x3f')]=_[_0x25c1('0x34')](_0x3cf9c0['model'],_0x3cf9c0[_0x25c1('0x33')]);_0x1b1d17[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x3cf9c0[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x5502c1[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1b1d17['attributes']=_0x1b1d17['attributes'][_0x25c1('0x38')]?_0x1b1d17[_0x25c1('0x35')]:_0x3cf9c0[_0x25c1('0x36')];if(_0x5502c1['query'][_0x25c1('0x47')]){_0x1b1d17[_0x25c1('0x43')]=[{'all':!![]}];}_0x1b1d17=_[_0x25c1('0x41')]({},_0x1b1d17,_0x5502c1[_0x25c1('0x48')]);return db['ScreenRecording'][_0x25c1('0x49')](_0x1b1d17)[_0x25c1('0x23')](handleEntityNotFound(_0x53f87b,null))[_0x25c1('0x23')](respondWithResult(_0x53f87b,null))[_0x25c1('0x45')](handleError(_0x53f87b,null));};exports['create']=function(_0x59e96b,_0x13ac06){return db[_0x25c1('0x2c')][_0x25c1('0x4a')](_0x59e96b[_0x25c1('0x4b')],{})['then'](respondWithResult(_0x13ac06,0xc9))[_0x25c1('0x45')](handleError(_0x13ac06,null));};exports[_0x25c1('0x22')]=function(_0x5770dd,_0x102f5){if(_0x5770dd[_0x25c1('0x4b')]['id']){delete _0x5770dd[_0x25c1('0x4b')]['id'];}delete _0x5770dd[_0x25c1('0x4b')]['duration'];delete _0x5770dd['body'][_0x25c1('0x4c')];delete _0x5770dd[_0x25c1('0x4b')][_0x25c1('0x4d')];delete _0x5770dd['body'][_0x25c1('0x4e')];return db[_0x25c1('0x2c')]['find']({'where':{'id':_0x5770dd[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](handleEntityNotFound(_0x102f5,null))[_0x25c1('0x23')](saveUpdates(_0x5770dd[_0x25c1('0x4b')],null))[_0x25c1('0x23')](respondWithResult(_0x102f5,null))[_0x25c1('0x45')](handleError(_0x102f5,null));};exports[_0x25c1('0x50')]=function(_0x5102a0,_0x5344da){return db['ScreenRecording'][_0x25c1('0x50')]()['then'](respondWithResult(_0x5344da,null))[_0x25c1('0x45')](handleError(_0x5344da,null));};exports[_0x25c1('0x51')]=function(_0x42fd6e,_0x153603,_0x40fe57){var _0x1b72e5=require('../../components/encryptor');var _0x4a876b=![];var _0x68e295={};if(_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]&&_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]==='uniqueid'){_0x68e295[_0x25c1('0x52')]=_0x42fd6e[_0x25c1('0x4f')]['id'];}else{_0x68e295['id']=_0x42fd6e[_0x25c1('0x4f')]['id'];}return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':_0x68e295,'attributes':['id','value'],'raw':!![]})[_0x25c1('0x23')](handleEntityNotFound(_0x153603,null))[_0x25c1('0x23')](function(_0x49b192){if(_0x49b192){var _0x1341d2=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x49b192[_0x25c1('0x4e')]);var _0x3d051a=util['format'](_0x25c1('0x56'),_0x1341d2);if(fs[_0x25c1('0x57')](_0x3d051a)){_0x4a876b=!![];return _0x1b72e5[_0x25c1('0x58')](_0x3d051a,_0x1341d2,config[_0x25c1('0x59')][_0x25c1('0x5a')])[_0x25c1('0x23')](function(){return _0x49b192;});}return _0x49b192;}})[_0x25c1('0x23')](function(_0x5d54cd){if(_0x5d54cd){var _0x321833=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x5d54cd[_0x25c1('0x4e')]);if(!fs[_0x25c1('0x57')](_0x321833)){throw new db['Sequelize'][(_0x25c1('0x5b'))](_0x25c1('0x5c'));}if(_0x5d54cd[_0x25c1('0x5d')]){return _0x153603[_0x25c1('0x51')](_0x321833,_0x5d54cd[_0x25c1('0x5d')]+path[_0x25c1('0x5e')](_0x321833),function(){if(_0x4a876b){fs[_0x25c1('0x5f')](_0x321833);}});}else{return _0x153603['download'](_0x321833,function(_0x44efc9){if(_0x4a876b){fs['unlink'](_0x321833);}});}}})[_0x25c1('0x45')](function(_0x24568c){if(_0x24568c[_0x25c1('0x60')]===_0x25c1('0x5c')){_0x153603[_0x25c1('0x19')](0x194)[_0x25c1('0x29')](_0x25c1('0x61'));}else{return handleError(_0x153603,null);}});};exports[_0x25c1('0x24')]=function(_0x4c435c,_0x7dbbe1){return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':{'id':_0x4c435c[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](function(_0x338f70){if(_[_0x25c1('0x62')](_0x338f70)){throw new ReferenceError('Entity\x20not\x20found');}return _0x338f70;})[_0x25c1('0x23')](function(_0x51e747){var _0x5e1517=path['join'](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x51e747[_0x25c1('0x4e')]);logger[_0x25c1('0x63')](_0x25c1('0x64'),_0x5e1517);if(!_['isNil'](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}_0x5e1517=_0x5e1517+_0x25c1('0x68');if(!_[_0x25c1('0x62')](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}return _0x51e747;})[_0x25c1('0x23')](function(_0x425f3e){if(!_0x425f3e)throw new InternalError();return _0x425f3e['destroy']();})[_0x25c1('0x23')](function(){_0x7dbbe1['status'](0xcc)[_0x25c1('0x25')]();})['catch'](handleError(_0x7dbbe1,null));}; \ No newline at end of file +var _0xe14b=['include','findAll','catch','show','fields','length','includeAll','find','create','body','duration','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x567c05,_0xc4a6df){var _0x4a4111=function(_0x2b6935){while(--_0x2b6935){_0x567c05['push'](_0x567c05['shift']());}};_0x4a4111(++_0xc4a6df);}(_0xe14b,0x93));var _0xbe14=function(_0x5aba66,_0x7cfe5b){_0x5aba66=_0x5aba66-0x0;var _0x2b5ceb=_0xe14b[_0x5aba66];return _0x2b5ceb;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){_0x3d3608['status'](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x5fa043,_0x1ee9c1){return function(_0x39cc81){if(!_0x39cc81){_0x5fa043[_0xbe14('0x16')](0x194);}return _0x39cc81;};}function handleError(_0x2703f5,_0x55d001){_0x55d001=_0x55d001||0x1f4;return function(_0x1822e0){logger[_0xbe14('0x23')](_0x1822e0[_0xbe14('0x24')]);if(_0x1822e0[_0xbe14('0x25')]){delete _0x1822e0['name'];}_0x2703f5[_0xbe14('0x17')](_0x55d001)[_0xbe14('0x26')](_0x1822e0);};}exports['index']=function(_0x3c3613,_0x3b3e84){var _0x1c7cc7={},_0x19252f={},_0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x2a')],'type':_0x16a159[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x19252f[_0xbe14('0x2d')]=_[_0xbe14('0x2e')](_[_0xbe14('0x27')](_0x36d4b2,_0xbe14('0x25')),[_0xbe14('0x2f')]);_0x19252f[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x3c3613['query']);_0x19252f[_0xbe14('0x32')]=_['intersection'](_0x19252f['model'],_0x19252f[_0xbe14('0x30')]);_0x1c7cc7['attributes']=_[_0xbe14('0x33')](_0x19252f[_0xbe14('0x2d')],qs['fields'](_0x3c3613['query']['fields']));_0x1c7cc7[_0xbe14('0x34')]=_0x1c7cc7[_0xbe14('0x34')]['length']?_0x1c7cc7[_0xbe14('0x34')]:_0x19252f[_0xbe14('0x2d')];if(!_0x3c3613[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x1c7cc7['limit']=qs['limit'](_0x3c3613[_0xbe14('0x30')]['limit']);_0x1c7cc7['offset']=qs['offset'](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x1c')]);}_0x1c7cc7[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x38')]);_0x1c7cc7[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x3c3613[_0xbe14('0x30')],_0x19252f[_0xbe14('0x32')]),_0x36d4b2);if(_0x3c3613[_0xbe14('0x30')]['filter']){_0x1c7cc7['where']=_[_0xbe14('0x3b')](_0x1c7cc7[_0xbe14('0x39')],{'$or':_[_0xbe14('0x27')](_0x36d4b2,function(_0x520e09){if(_0x520e09[_0xbe14('0x2b')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x25')]]={'$like':'%'+_0x3c3613[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x1c7cc7=_[_0xbe14('0x3b')]({},_0x1c7cc7,_0x3c3613[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x1c7cc7['where']};return db[_0xbe14('0x28')][_0xbe14('0x1b')](_0x1b2608)[_0xbe14('0x22')](function(_0x1b3118){_0x34d648[_0xbe14('0x1b')]=_0x1b3118;if(_0x3c3613[_0xbe14('0x30')]['includeAll']){_0x1c7cc7[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x28')][_0xbe14('0x40')](_0x1c7cc7);})[_0xbe14('0x22')](function(_0x5cf713){_0x34d648['rows']=_0x5cf713;return _0x34d648;})[_0xbe14('0x22')](respondWithFilteredResult(_0x3b3e84,_0x1c7cc7))[_0xbe14('0x41')](handleError(_0x3b3e84,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2d')]=_[_0xbe14('0x31')](db[_0xbe14('0x28')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2d')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['ScreenRecording'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x22')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['ScreenRecording']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x22')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0xca8cdb,_0x5d3726){if(_0xca8cdb[_0xbe14('0x48')]['id']){delete _0xca8cdb[_0xbe14('0x48')]['id'];}delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x49')];delete _0xca8cdb[_0xbe14('0x48')]['createdAt'];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4a')];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4b')];return db[_0xbe14('0x28')]['find']({'where':{'id':_0xca8cdb[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x5d3726,null))[_0xbe14('0x22')](saveUpdates(_0xca8cdb[_0xbe14('0x48')],null))[_0xbe14('0x22')](respondWithResult(_0x5d3726,null))[_0xbe14('0x41')](handleError(_0x5d3726,null));};exports['describe']=function(_0x5aeea9,_0x3a49f7){return db[_0xbe14('0x28')][_0xbe14('0x4d')]()['then'](respondWithResult(_0x3a49f7,null))['catch'](handleError(_0x3a49f7,null));};exports[_0xbe14('0x4e')]=function(_0x134878,_0x50d78f,_0x339a86){var _0x32496a=require('../../components/encryptor');var _0x28f995=![];var _0x4a40d2={};if(_0x134878[_0xbe14('0x30')][_0xbe14('0x2b')]&&_0x134878[_0xbe14('0x30')]['type']===_0xbe14('0x4f')){_0x4a40d2[_0xbe14('0x4f')]=_0x134878['params']['id'];}else{_0x4a40d2['id']=_0x134878[_0xbe14('0x4c')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':_0x4a40d2,'attributes':['id',_0xbe14('0x4b')],'raw':!![]})[_0xbe14('0x22')](handleEntityNotFound(_0x50d78f,null))['then'](function(_0x42a346){if(_0x42a346){var _0x34cd66=path[_0xbe14('0x50')](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x42a346[_0xbe14('0x4b')]);var _0x1dd6c7=util['format'](_0xbe14('0x53'),_0x34cd66);if(fs[_0xbe14('0x54')](_0x1dd6c7)){_0x28f995=!![];return _0x32496a[_0xbe14('0x55')](_0x1dd6c7,_0x34cd66,config[_0xbe14('0x56')][_0xbe14('0x57')])[_0xbe14('0x22')](function(){return _0x42a346;});}return _0x42a346;}})[_0xbe14('0x22')](function(_0x32df3c){if(_0x32df3c){var _0x285b6e=path[_0xbe14('0x50')](config[_0xbe14('0x51')],'server/files/screen_recordings',_0x32df3c['value']);if(!fs['existsSync'](_0x285b6e)){throw new db[(_0xbe14('0x58'))][(_0xbe14('0x59'))](_0xbe14('0x5a'));}if(_0x32df3c[_0xbe14('0x5b')]){return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,_0x32df3c[_0xbe14('0x5b')]+path[_0xbe14('0x5c')](_0x285b6e),function(){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}else{return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,function(_0x451b0b){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}}})[_0xbe14('0x41')](function(_0x2088e4){if(_0x2088e4[_0xbe14('0x5e')]===_0xbe14('0x5a')){_0x50d78f[_0xbe14('0x17')](0x194)[_0xbe14('0x26')](_0xbe14('0x5f'));}else{return handleError(_0x50d78f,null);}});};exports[_0xbe14('0x60')]=function(_0x1a945b,_0x5f394c){return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':{'id':_0x1a945b[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](function(_0x3ee6b7){if(_[_0xbe14('0x61')](_0x3ee6b7)){throw new ReferenceError(_0xbe14('0x62'));}return _0x3ee6b7;})[_0xbe14('0x22')](function(_0x23cb36){var _0x100d43=path['join'](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x23cb36[_0xbe14('0x4b')]);logger[_0xbe14('0x63')](_0xbe14('0x64'),_0x100d43);if(!_['isNil'](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs['unlinkSync'](_0x100d43);}_0x100d43=_0x100d43+_0xbe14('0x67');if(!_[_0xbe14('0x61')](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs[_0xbe14('0x68')](_0x100d43);}return _0x23cb36;})['then'](function(_0x1bb588){if(!_0x1bb588)throw new InternalError();return _0x1bb588[_0xbe14('0x60')]();})[_0xbe14('0x22')](function(){_0x5f394c[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();})[_0xbe14('0x41')](handleError(_0x5f394c,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 7fc48c1..12decbc 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 _0x2f52=['ScreenRecording','screen_recordings','interactionid','util','api','moment','path','rimraf','./screenRecording.attributes'];(function(_0x1a788b,_0x4002c2){var _0x1fef28=function(_0x333d72){while(--_0x333d72){_0x1a788b['push'](_0x1a788b['shift']());}};_0x1fef28(++_0x4002c2);}(_0x2f52,0x186));var _0x22f5=function(_0x5875ad,_0x3597b8){_0x5875ad=_0x5875ad-0x0;var _0x32a922=_0x2f52[_0x5875ad];return _0x32a922;};'use strict';var _=require('lodash');var util=require(_0x22f5('0x0'));var logger=require('../../config/logger')(_0x22f5('0x1'));var moment=require(_0x22f5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x22f5('0x3'));var rimraf=require(_0x22f5('0x4'));var config=require('../../config/environment');var attributes=require(_0x22f5('0x5'));module['exports']=function(_0x3ca35b,_0x597043){return _0x3ca35b['define'](_0x22f5('0x6'),attributes,{'tableName':_0x22f5('0x7'),'paranoid':![],'indexes':[{'name':_0x22f5('0x8'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x73b5=['rimraf','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','path'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x73b5,0x19c));var _0x573b=function(_0x44d8f3,_0x45af3c){_0x44d8f3=_0x44d8f3-0x0;var _0x14d137=_0x73b5[_0x44d8f3];return _0x14d137;};'use strict';var _=require(_0x573b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x573b('0x1'));var rimraf=require(_0x573b('0x2'));var config=require(_0x573b('0x3'));var attributes=require(_0x573b('0x4'));module[_0x573b('0x5')]=function(_0x4f2ff6,_0x40baa0){return _0x4f2ff6[_0x573b('0x6')]('ScreenRecording',attributes,{'tableName':_0x573b('0x7'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x573b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 37daaf0..ce1ddc1 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 _0xa1e1=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','ScreenRecording,\x20%s,\x20%s','info'];(function(_0x421b7d,_0x2826e5){var _0x1d3266=function(_0x40041b){while(--_0x40041b){_0x421b7d['push'](_0x421b7d['shift']());}};_0x1d3266(++_0x2826e5);}(_0xa1e1,0x78));var _0x1a1e=function(_0x2798a7,_0x5c0299){_0x2798a7=_0x2798a7-0x0;var _0x59ca88=_0xa1e1[_0x2798a7];return _0x59ca88;};'use strict';var _=require(_0x1a1e('0x0'));var util=require(_0x1a1e('0x1'));var moment=require('moment');var BPromise=require(_0x1a1e('0x2'));var rs=require(_0x1a1e('0x3'));var fs=require('fs');var Redis=require(_0x1a1e('0x4'));var db=require(_0x1a1e('0x5'))['db'];var utils=require(_0x1a1e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1a1e('0x7'));var jayson=require(_0x1a1e('0x8'));var client=jayson[_0x1a1e('0x9')][_0x1a1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d506b,_0x54acaa,_0x5d8a33){return new BPromise(function(_0x5de90d,_0x5ab402){return client[_0x1a1e('0xb')](_0x2d506b,_0x5d8a33)['then'](function(_0x1bca2a){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x54acaa,_0x1a1e('0xc'));logger[_0x1a1e('0xd')](_0x1a1e('0xe'),_0x54acaa,_0x1a1e('0xc'),JSON['stringify'](_0x1bca2a));if(_0x1bca2a['error']){if(_0x1bca2a[_0x1a1e('0xf')][_0x1a1e('0x10')]===0x1f4){logger[_0x1a1e('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x54acaa,_0x1bca2a[_0x1a1e('0xf')][_0x1a1e('0x11')]);return _0x5ab402(_0x1bca2a['error'][_0x1a1e('0x11')]);}logger[_0x1a1e('0xf')](_0x1a1e('0x12'),_0x54acaa,_0x1bca2a[_0x1a1e('0xf')][_0x1a1e('0x11')]);return _0x5de90d(_0x1bca2a[_0x1a1e('0xf')][_0x1a1e('0x11')]);}else{logger[_0x1a1e('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x54acaa,_0x1a1e('0xc'));_0x5de90d(_0x1bca2a['result']['message']);}})['catch'](function(_0x16a88e){logger[_0x1a1e('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x54acaa,_0x16a88e);_0x5ab402(_0x16a88e);});});} \ No newline at end of file +var _0x7182=['code','message','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x43cdc9,_0x35df2a){var _0x2933e0=function(_0x480a54){while(--_0x480a54){_0x43cdc9['push'](_0x43cdc9['shift']());}};_0x2933e0(++_0x35df2a);}(_0x7182,0xf9));var _0x2718=function(_0x48fdeb,_0x16b150){_0x48fdeb=_0x48fdeb-0x0;var _0x311289=_0x7182[_0x48fdeb];return _0x311289;};'use strict';var _=require('lodash');var util=require(_0x2718('0x0'));var moment=require(_0x2718('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2718('0x2'));var db=require(_0x2718('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2718('0x4'))('rpc');var config=require(_0x2718('0x5'));var jayson=require(_0x2718('0x6'));var client=jayson['client'][_0x2718('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x27b2c9,_0x34756b,_0x5729a5){return new BPromise(function(_0x2aff71,_0x57578f){return client[_0x2718('0x8')](_0x27b2c9,_0x5729a5)[_0x2718('0x9')](function(_0x42ba7a){logger[_0x2718('0xa')](_0x2718('0xb'),_0x34756b,_0x2718('0xc'));logger[_0x2718('0xd')](_0x2718('0xe'),_0x34756b,_0x2718('0xc'),JSON[_0x2718('0xf')](_0x42ba7a));if(_0x42ba7a[_0x2718('0x10')]){if(_0x42ba7a[_0x2718('0x10')][_0x2718('0x11')]===0x1f4){logger['error'](_0x2718('0xb'),_0x34756b,_0x42ba7a[_0x2718('0x10')][_0x2718('0x12')]);return _0x57578f(_0x42ba7a[_0x2718('0x10')][_0x2718('0x12')]);}logger[_0x2718('0x10')](_0x2718('0xb'),_0x34756b,_0x42ba7a[_0x2718('0x10')][_0x2718('0x12')]);return _0x2aff71(_0x42ba7a[_0x2718('0x10')]['message']);}else{logger[_0x2718('0xa')](_0x2718('0xb'),_0x34756b,_0x2718('0xc'));_0x2aff71(_0x42ba7a['result'][_0x2718('0x12')]);}})['catch'](function(_0x41ad8a){logger[_0x2718('0x10')](_0x2718('0xb'),_0x34756b,_0x41ad8a);_0x57578f(_0x41ad8a);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 344f6f7..c2c409f 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 _0x223f=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','logologin','addLogoLogin','preferred','addPreferred','addFavicon','update','multer'];(function(_0x6da0a4,_0x45595b){var _0x5cd603=function(_0x40c93e){while(--_0x40c93e){_0x6da0a4['push'](_0x6da0a4['shift']());}};_0x5cd603(++_0x45595b);}(_0x223f,0xd6));var _0xf223=function(_0x54b157,_0x163793){_0x54b157=_0x54b157-0x0;var _0x15bf4a=_0x223f[_0x54b157];return _0x15bf4a;};'use strict';var multer=require(_0xf223('0x0'));var util=require(_0xf223('0x1'));var path=require(_0xf223('0x2'));var timeout=require('connect-timeout');var express=require(_0xf223('0x3'));var router=express[_0xf223('0x4')]();var fs_extra=require(_0xf223('0x5'));var auth=require(_0xf223('0x6'));var interaction=require(_0xf223('0x7'));var config=require(_0xf223('0x8'));var controller=require('./setting.controller');router[_0xf223('0x9')]('/',auth[_0xf223('0xa')](),controller[_0xf223('0xb')]);router[_0xf223('0x9')](_0xf223('0xc'),controller[_0xf223('0xd')]);router[_0xf223('0x9')](_0xf223('0xe'),controller['show']);router[_0xf223('0x9')](_0xf223('0xf'),controller[_0xf223('0x10')]);router[_0xf223('0x9')](_0xf223('0x11'),controller[_0xf223('0x12')]);router['get'](_0xf223('0x13'),controller['gdpr']);router[_0xf223('0x9')](_0xf223('0x14'),controller[_0xf223('0x15')]);router[_0xf223('0x9')](_0xf223('0x16'),controller[_0xf223('0x17')]);var upload=multer({'storage':multer[_0xf223('0x18')]({'destination':function(_0x3d00df,_0x4079c7,_0x534805){_0x534805(null,path[_0xf223('0x19')](config[_0xf223('0x1a')],_0xf223('0x1b')));},'filename':function(_0x3a6920,_0x4cf51e,_0x1369cd){_0x1369cd(null,util[_0xf223('0x1c')](_0xf223('0x1d'),_0xf223('0x1e'),path[_0xf223('0x1f')](_0x4cf51e[_0xf223('0x20')])));}})});router[_0xf223('0x21')](_0xf223('0xf'),upload[_0xf223('0x22')](_0xf223('0x23')),controller[_0xf223('0x24')]);var upload=multer({'storage':multer[_0xf223('0x18')]({'destination':function(_0x3bcd14,_0x248ae3,_0x3439a6){_0x3439a6(null,path[_0xf223('0x19')](config[_0xf223('0x1a')],_0xf223('0x1b')));},'filename':function(_0x6e36bb,_0x4457cf,_0x463105){_0x463105(null,util[_0xf223('0x1c')]('%s%s',_0xf223('0x25'),path[_0xf223('0x1f')](_0x4457cf[_0xf223('0x20')])));}})});router[_0xf223('0x21')]('/:id/logo_login',upload[_0xf223('0x22')](_0xf223('0x23')),controller[_0xf223('0x26')]);var upload=multer({'storage':multer[_0xf223('0x18')]({'destination':function(_0x25da08,_0x1e4c60,_0x393e9f){_0x393e9f(null,path['join'](config[_0xf223('0x1a')],_0xf223('0x1b')));},'filename':function(_0x3348d1,_0x5db1e0,_0xe1c863){_0xe1c863(null,util[_0xf223('0x1c')](_0xf223('0x1d'),_0xf223('0x27'),path[_0xf223('0x1f')](_0x5db1e0[_0xf223('0x20')])));}})});router[_0xf223('0x21')](_0xf223('0x14'),upload[_0xf223('0x22')](_0xf223('0x23')),controller[_0xf223('0x28')]);var upload=multer({'storage':multer[_0xf223('0x18')]({'destination':function(_0x3679e9,_0x3bd4d4,_0x24ad84){_0x24ad84(null,path[_0xf223('0x19')](config[_0xf223('0x1a')],_0xf223('0x1b')));},'filename':function(_0x4010b8,_0x556301,_0x4e3d24){_0x4e3d24(null,util['format'](_0xf223('0x1d'),'favicon',path[_0xf223('0x1f')](_0x556301[_0xf223('0x20')])));}})});router[_0xf223('0x21')](_0xf223('0x16'),upload[_0xf223('0x22')](_0xf223('0x23')),controller[_0xf223('0x29')]);router['put']('/:id',auth[_0xf223('0xa')](),controller[_0xf223('0x2a')]);module['exports']=router; \ No newline at end of file +var _0x0864=['gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','format','%s%s','logo','extname','originalname','post','file','addLogo','server/files/images/logos/','logologin','single','addLogoLogin','preferred','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr'];(function(_0x5007b5,_0x2f194c){var _0x2436ca=function(_0x5f05fd){while(--_0x5f05fd){_0x5007b5['push'](_0x5007b5['shift']());}};_0x2436ca(++_0x2f194c);}(_0x0864,0x188));var _0x4086=function(_0x3a3569,_0x136294){_0x3a3569=_0x3a3569-0x0;var _0x100f11=_0x0864[_0x3a3569];return _0x100f11;};'use strict';var multer=require(_0x4086('0x0'));var util=require(_0x4086('0x1'));var path=require(_0x4086('0x2'));var timeout=require('connect-timeout');var express=require(_0x4086('0x3'));var router=express[_0x4086('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4086('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4086('0x6'));var controller=require('./setting.controller');router[_0x4086('0x7')]('/',auth[_0x4086('0x8')](),controller[_0x4086('0x9')]);router[_0x4086('0x7')](_0x4086('0xa'),controller[_0x4086('0xb')]);router[_0x4086('0x7')](_0x4086('0xc'),controller[_0x4086('0xd')]);router[_0x4086('0x7')](_0x4086('0xe'),controller['getLogo']);router[_0x4086('0x7')](_0x4086('0xf'),controller[_0x4086('0x10')]);router[_0x4086('0x7')](_0x4086('0x11'),controller[_0x4086('0x12')]);router[_0x4086('0x7')](_0x4086('0x13'),controller[_0x4086('0x14')]);router[_0x4086('0x7')](_0x4086('0x15'),controller['getFavicon']);var upload=multer({'storage':multer[_0x4086('0x16')]({'destination':function(_0x425a57,_0x195ba0,_0x3e9950){_0x3e9950(null,path[_0x4086('0x17')](config[_0x4086('0x18')],'server/files/images/logos/'));},'filename':function(_0x1ce9cf,_0x212738,_0x320082){_0x320082(null,util[_0x4086('0x19')](_0x4086('0x1a'),_0x4086('0x1b'),path[_0x4086('0x1c')](_0x212738[_0x4086('0x1d')])));}})});router[_0x4086('0x1e')](_0x4086('0xe'),upload['single'](_0x4086('0x1f')),controller[_0x4086('0x20')]);var upload=multer({'storage':multer[_0x4086('0x16')]({'destination':function(_0x195df3,_0xfcca39,_0x35d7be){_0x35d7be(null,path['join'](config['root'],_0x4086('0x21')));},'filename':function(_0x5740b9,_0x4c055d,_0x207a4f){_0x207a4f(null,util[_0x4086('0x19')]('%s%s',_0x4086('0x22'),path['extname'](_0x4c055d[_0x4086('0x1d')])));}})});router['post'](_0x4086('0xf'),upload[_0x4086('0x23')](_0x4086('0x1f')),controller[_0x4086('0x24')]);var upload=multer({'storage':multer[_0x4086('0x16')]({'destination':function(_0x4a7e97,_0x5926d8,_0x48eccc){_0x48eccc(null,path[_0x4086('0x17')](config[_0x4086('0x18')],'server/files/images/logos/'));},'filename':function(_0x44e9ac,_0x475d86,_0x51796a){_0x51796a(null,util[_0x4086('0x19')](_0x4086('0x1a'),_0x4086('0x25'),path[_0x4086('0x1c')](_0x475d86[_0x4086('0x1d')])));}})});router[_0x4086('0x1e')](_0x4086('0x13'),upload[_0x4086('0x23')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0x4086('0x16')]({'destination':function(_0x21fd9e,_0x45d911,_0x994823){_0x994823(null,path['join'](config[_0x4086('0x18')],'server/files/images/logos/'));},'filename':function(_0xcb06e3,_0x1fe04c,_0x1c6bad){_0x1c6bad(null,util[_0x4086('0x19')](_0x4086('0x1a'),'favicon',path[_0x4086('0x1c')](_0x1fe04c[_0x4086('0x1d')])));}})});router[_0x4086('0x1e')](_0x4086('0x15'),upload[_0x4086('0x23')](_0x4086('0x1f')),controller['addFavicon']);router[_0x4086('0x26')]('/:id',auth[_0x4086('0x8')](),controller[_0x4086('0x27')]);module[_0x4086('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 3d1eed5..508402c 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 _0xadb5=['https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','exports','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x1f0724,_0x3a58bf){var _0x253ffb=function(_0x3b4c72){while(--_0x3b4c72){_0x1f0724['push'](_0x1f0724['shift']());}};_0x253ffb(++_0x3a58bf);}(_0xadb5,0xad));var _0x5adb=function(_0x427882,_0x414021){_0x427882=_0x427882-0x0;var _0x44a8fe=_0xadb5[_0x427882];return _0x44a8fe;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x5adb('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5adb('0x2')](0xb),'unique':_0x5adb('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':_0x5adb('0x5')},'logo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5adb('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnusername':{'type':Sequelize[_0x5adb('0x4')]},'turnpassword':{'type':Sequelize[_0x5adb('0x4')]},'pageTitle':{'type':Sequelize[_0x5adb('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5adb('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x5adb('0x7')},'enableEmailPreview':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5adb('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5adb('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x5adb('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5adb('0x2')]},'transcribeRegion':{'type':Sequelize[_0x5adb('0x4')]},'sentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5adb('0x2')]},'sentimentRegion':{'type':Sequelize[_0x5adb('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x5adb('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x5adb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x5f2f=['INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','alternate','UNSIGNED','sequelize','exports'];(function(_0x16fcc1,_0x3320a8){var _0x3a930a=function(_0x150d6f){while(--_0x150d6f){_0x16fcc1['push'](_0x16fcc1['shift']());}};_0x3a930a(++_0x3320a8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x13a33f,_0x4c6994){_0x13a33f=_0x13a33f-0x0;var _0x44a275=_0x5f2f[_0x13a33f];return _0x44a275;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'min_internal':{'type':Sequelize[_0xf5f2('0x2')](0xb),'unique':_0xf5f2('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xf5f2('0x2')](0xb),'unique':_0xf5f2('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf5f2('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xf5f2('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xf5f2('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xf5f2('0x5')]},'turnaddr':{'type':Sequelize[_0xf5f2('0x5')]},'turnusername':{'type':Sequelize[_0xf5f2('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xf5f2('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':_0xf5f2('0x7')},'chatTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xf5f2('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xf5f2('0x2')]},'transcribeRegion':{'type':Sequelize[_0xf5f2('0x5')]},'sentiment':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xf5f2('0x2')]},'sentimentRegion':{'type':Sequelize[_0xf5f2('0x5')]},'language':{'type':Sequelize[_0xf5f2('0x5')]},'bucket':{'type':Sequelize[_0xf5f2('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xf5f2('0x2')](0x2)[_0xf5f2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xf5f2('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xf5f2('0x2')](0x2)[_0xf5f2('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 07a2393..80117cc 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 _0x7c55=['ValidationError','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','Setting,\x20%s,\x20%s','result','catch','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','Setting','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','params','keys','options','find','body','file','logo','filename','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultLoginLogo','defaultPreferred','join','toLower','root','default_logo.svg','default','custom','existsSync','Sequelize','getLogoLogin','getLicense','defaultLogo','defaultFavicon','default_loginLogo.svg','upperFirst'];(function(_0x839119,_0x5a2220){var _0x21c211=function(_0x3a1591){while(--_0x3a1591){_0x839119['push'](_0x839119['shift']());}};_0x21c211(++_0x5a2220);}(_0x7c55,0x180));var _0x57c5=function(_0x4ba6e8,_0x3414b3){_0x4ba6e8=_0x4ba6e8-0x0;var _0x40589b=_0x7c55[_0x4ba6e8];return _0x40589b;};'use strict';var emlformat=require(_0x57c5('0x0'));var rimraf=require(_0x57c5('0x1'));var zipdir=require(_0x57c5('0x2'));var jsonpatch=require(_0x57c5('0x3'));var rp=require(_0x57c5('0x4'));var moment=require('moment');var BPromise=require(_0x57c5('0x5'));var Mustache=require('mustache');var util=require(_0x57c5('0x6'));var path=require(_0x57c5('0x7'));var sox=require(_0x57c5('0x8'));var csv=require(_0x57c5('0x9'));var ejs=require(_0x57c5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x57c5('0xb'));var deskjs=require(_0x57c5('0xc'));var toCsv=require(_0x57c5('0x9'));var querystring=require(_0x57c5('0xd'));var Papa=require(_0x57c5('0xe'));var Redis=require('ioredis');var authService=require(_0x57c5('0xf'));var qs=require(_0x57c5('0x10'));var as=require(_0x57c5('0x11'));var hardwareService=require(_0x57c5('0x12'));var logger=require('../../config/logger')(_0x57c5('0x13'));var utils=require('../../config/utils');var config=require(_0x57c5('0x14'));var licenseUtil=require(_0x57c5('0x15'));var db=require(_0x57c5('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x57c5('0x17')][_0x57c5('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4fa944,_0x312134,_0x3e0174,_0xdc2558){return new BPromise(function(_0x41abfc,_0x7e565b){var _0x94d3a6=_0xdc2558||client;return _0x94d3a6[_0x57c5('0x19')](_0x4fa944,_0x3e0174)[_0x57c5('0x1a')](function(_0x45f9c3){logger[_0x57c5('0x1b')]('Setting,\x20%s,\x20%s',_0x312134,_0x57c5('0x1c'));logger['debug'](_0x57c5('0x1d'),_0x312134,'request\x20sent',JSON[_0x57c5('0x1e')](_0x45f9c3));if(_0x45f9c3[_0x57c5('0x1f')]){if(_0x45f9c3[_0x57c5('0x1f')]['code']===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x312134,_0x45f9c3['error'][_0x57c5('0x20')]);return _0x7e565b(_0x45f9c3[_0x57c5('0x1f')]['message']);}logger[_0x57c5('0x1f')](_0x57c5('0x21'),_0x312134,_0x45f9c3[_0x57c5('0x1f')]['message']);return _0x41abfc(_0x45f9c3[_0x57c5('0x1f')][_0x57c5('0x20')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x312134,'request\x20sent');_0x41abfc(_0x45f9c3[_0x57c5('0x22')][_0x57c5('0x20')]);}})[_0x57c5('0x23')](function(_0x4aee53){logger[_0x57c5('0x1f')](_0x57c5('0x21'),_0x312134,_0x4aee53);_0x7e565b(_0x4aee53);});});}function respondWithStatusCode(_0x423d1d,_0x5bb917){_0x5bb917=_0x5bb917||0xcc;return function(_0x1c45f1){if(_0x1c45f1){return _0x423d1d[_0x57c5('0x24')](_0x5bb917);}return _0x423d1d[_0x57c5('0x25')](_0x5bb917)['end']();};}function respondWithResult(_0x55665d,_0x1ba80e){_0x1ba80e=_0x1ba80e||0xc8;return function(_0x48500a){if(_0x48500a){return _0x55665d[_0x57c5('0x25')](_0x1ba80e)[_0x57c5('0x26')](_0x48500a);}};}function respondWithFilteredResult(_0x2ad75f,_0x5462c2){return function(_0x3155e0){if(_0x3155e0){var _0x12c3d2=typeof _0x5462c2['offset']==='undefined'&&typeof _0x5462c2[_0x57c5('0x27')]===_0x57c5('0x28');var _0x5224a3=_0x3155e0[_0x57c5('0x29')];var _0x50f538=_0x12c3d2?0x0:_0x5462c2['offset'];var _0x5f5d60=_0x12c3d2?_0x3155e0[_0x57c5('0x29')]:_0x5462c2[_0x57c5('0x2a')]+_0x5462c2[_0x57c5('0x27')];var _0xa1dc09;if(_0x5f5d60>=_0x5224a3){_0x5f5d60=_0x5224a3;_0xa1dc09=0xc8;}else{_0xa1dc09=0xce;}_0x2ad75f['status'](_0xa1dc09);return _0x2ad75f[_0x57c5('0x2b')](_0x57c5('0x2c'),_0x50f538+'-'+_0x5f5d60+'/'+_0x5224a3)[_0x57c5('0x26')](_0x3155e0);}return null;};}function patchUpdates(_0x1caf77){return function(_0x9ba9a9){try{jsonpatch[_0x57c5('0x2d')](_0x9ba9a9,_0x1caf77,!![]);}catch(_0x311cbb){return BPromise[_0x57c5('0x2e')](_0x311cbb);}return _0x9ba9a9[_0x57c5('0x2f')]();};}function saveUpdates(_0x32e894,_0x5a264b){return function(_0x3f8610){if(_0x3f8610){return _0x3f8610[_0x57c5('0x30')](_0x32e894)['then'](function(_0x48eae0){return _0x48eae0;});}return null;};}function removeEntity(_0x442cf3,_0x332b61){return function(_0x23d803){if(_0x23d803){return _0x23d803[_0x57c5('0x31')]()[_0x57c5('0x1a')](function(){_0x442cf3['status'](0xcc)[_0x57c5('0x32')]();});}};}function handleEntityNotFound(_0x3778dc,_0x1c4315){return function(_0x195b2f){if(!_0x195b2f){_0x3778dc['sendStatus'](0x194);}return _0x195b2f;};}function handleError(_0x1a73ad,_0x20d8f8){_0x20d8f8=_0x20d8f8||0x1f4;return function(_0x3ba0b2){logger[_0x57c5('0x1f')](_0x3ba0b2[_0x57c5('0x33')]);if(_0x3ba0b2['name']){delete _0x3ba0b2[_0x57c5('0x34')];}_0x1a73ad['status'](_0x20d8f8)[_0x57c5('0x35')](_0x3ba0b2);};}exports[_0x57c5('0x36')]=function(_0x502e4b,_0x5a31d5){var _0x5689e7={},_0x46f98d={},_0x386a01={'count':0x0,'rows':[]};var _0x17f855=_[_0x57c5('0x37')](db[_0x57c5('0x38')][_0x57c5('0x39')],function(_0x4f4533){return{'name':_0x4f4533[_0x57c5('0x3a')],'type':_0x4f4533['type'][_0x57c5('0x3b')]};});_0x46f98d[_0x57c5('0x3c')]=_[_0x57c5('0x37')](_0x17f855,_0x57c5('0x34'));_0x46f98d[_0x57c5('0x3d')]=_['keys'](_0x502e4b[_0x57c5('0x3d')]);_0x46f98d[_0x57c5('0x3e')]=_[_0x57c5('0x3f')](_0x46f98d[_0x57c5('0x3c')],_0x46f98d[_0x57c5('0x3d')]);_0x5689e7[_0x57c5('0x40')]=_[_0x57c5('0x3f')](_0x46f98d['model'],qs[_0x57c5('0x41')](_0x502e4b[_0x57c5('0x3d')][_0x57c5('0x41')]));_0x5689e7[_0x57c5('0x40')]=_0x5689e7['attributes'][_0x57c5('0x42')]?_0x5689e7[_0x57c5('0x40')]:_0x46f98d[_0x57c5('0x3c')];if(!_0x502e4b[_0x57c5('0x3d')][_0x57c5('0x43')]('nolimit')){_0x5689e7[_0x57c5('0x27')]=qs[_0x57c5('0x27')](_0x502e4b[_0x57c5('0x3d')][_0x57c5('0x27')]);_0x5689e7[_0x57c5('0x2a')]=qs[_0x57c5('0x2a')](_0x502e4b['query'][_0x57c5('0x2a')]);}_0x5689e7[_0x57c5('0x44')]=qs[_0x57c5('0x45')](_0x502e4b[_0x57c5('0x3d')]['sort']);_0x5689e7[_0x57c5('0x46')]=qs[_0x57c5('0x3e')](_[_0x57c5('0x47')](_0x502e4b[_0x57c5('0x3d')],_0x46f98d['filters']),_0x17f855);if(_0x502e4b[_0x57c5('0x3d')][_0x57c5('0x48')]){_0x5689e7[_0x57c5('0x46')]=_[_0x57c5('0x49')](_0x5689e7[_0x57c5('0x46')],{'$or':_[_0x57c5('0x37')](_0x17f855,function(_0x1fb5f6){if(_0x1fb5f6[_0x57c5('0x4a')]!=='VIRTUAL'){var _0x328732={};_0x328732[_0x1fb5f6[_0x57c5('0x34')]]={'$like':'%'+_0x502e4b[_0x57c5('0x3d')][_0x57c5('0x48')]+'%'};return _0x328732;}})});}_0x5689e7=_[_0x57c5('0x49')]({},_0x5689e7,_0x502e4b['options']);var _0x2d1116={'where':_0x5689e7['where']};return db[_0x57c5('0x38')][_0x57c5('0x29')](_0x2d1116)['then'](function(_0x5a618d){_0x386a01[_0x57c5('0x29')]=_0x5a618d;if(_0x502e4b[_0x57c5('0x3d')][_0x57c5('0x4b')]){_0x5689e7[_0x57c5('0x4c')]=[{'all':!![]}];}return db[_0x57c5('0x38')][_0x57c5('0x4d')](_0x5689e7);})[_0x57c5('0x1a')](function(_0x37bdb7){_0x386a01[_0x57c5('0x4e')]=_0x37bdb7;return _0x386a01;})[_0x57c5('0x1a')](respondWithFilteredResult(_0x5a31d5,_0x5689e7))[_0x57c5('0x23')](handleError(_0x5a31d5,null));};exports['show']=function(_0x2db665,_0x4eebf5){var _0x13da7f={'raw':![],'where':{'id':_0x2db665[_0x57c5('0x4f')]['id']}},_0x23f24c={};_0x23f24c[_0x57c5('0x3c')]=_[_0x57c5('0x50')](db[_0x57c5('0x38')][_0x57c5('0x39')]);_0x23f24c[_0x57c5('0x3d')]=_[_0x57c5('0x50')](_0x2db665[_0x57c5('0x3d')]);_0x23f24c[_0x57c5('0x3e')]=_[_0x57c5('0x3f')](_0x23f24c[_0x57c5('0x3c')],_0x23f24c['query']);_0x13da7f[_0x57c5('0x40')]=_[_0x57c5('0x3f')](_0x23f24c['model'],qs[_0x57c5('0x41')](_0x2db665[_0x57c5('0x3d')]['fields']));_0x13da7f['attributes']=_0x13da7f['attributes']['length']?_0x13da7f[_0x57c5('0x40')]:_0x23f24c['model'];if(_0x2db665[_0x57c5('0x3d')][_0x57c5('0x4b')]){_0x13da7f['include']=[{'all':!![]}];}_0x13da7f=_[_0x57c5('0x49')]({},_0x13da7f,_0x2db665[_0x57c5('0x51')]);return db[_0x57c5('0x38')][_0x57c5('0x52')](_0x13da7f)[_0x57c5('0x1a')](handleEntityNotFound(_0x4eebf5,null))[_0x57c5('0x1a')](respondWithResult(_0x4eebf5,null))[_0x57c5('0x23')](handleError(_0x4eebf5,null));};exports[_0x57c5('0x30')]=function(_0x4e5183,_0x2eea5d){if(_0x4e5183[_0x57c5('0x53')]['id']){delete _0x4e5183[_0x57c5('0x53')]['id'];}return db[_0x57c5('0x38')]['find']({'where':{'id':_0x4e5183['params']['id']}})[_0x57c5('0x1a')](handleEntityNotFound(_0x2eea5d,null))['then'](saveUpdates(_0x4e5183[_0x57c5('0x53')],null))[_0x57c5('0x1a')](respondWithResult(_0x2eea5d,null))[_0x57c5('0x23')](handleError(_0x2eea5d,null));};exports['addLogo']=function(_0x4b8b2f,_0x238451,_0x162fac){if(_0x4b8b2f[_0x57c5('0x54')]&&_0x4b8b2f['file']['filename']){_0x4b8b2f[_0x57c5('0x53')][_0x57c5('0x55')]=_0x4b8b2f['file']['filename'];}return db[_0x57c5('0x38')]['find']({'where':{'id':_0x4b8b2f['params']['id']}})[_0x57c5('0x1a')](handleEntityNotFound(_0x238451,null))['then'](saveUpdates(_0x4b8b2f['body'],null))[_0x57c5('0x1a')](respondWithResult(_0x238451,null))[_0x57c5('0x23')](handleError(_0x238451,null));};exports['addLogoLogin']=function(_0x4d0ad3,_0x38bb8e,_0xbb82cf){if(_0x4d0ad3[_0x57c5('0x54')]&&_0x4d0ad3[_0x57c5('0x54')][_0x57c5('0x56')]){_0x4d0ad3[_0x57c5('0x53')][_0x57c5('0x57')]=_0x4d0ad3[_0x57c5('0x54')][_0x57c5('0x56')];}return db[_0x57c5('0x38')]['find']({'where':{'id':_0x4d0ad3[_0x57c5('0x4f')]['id']}})[_0x57c5('0x1a')](handleEntityNotFound(_0x38bb8e,null))[_0x57c5('0x1a')](saveUpdates(_0x4d0ad3['body'],null))[_0x57c5('0x1a')](respondWithResult(_0x38bb8e,null))['catch'](handleError(_0x38bb8e,null));};var utilLicense=require(_0x57c5('0x15'));exports[_0x57c5('0x58')]=function(_0xdcb375,_0x30c60c,_0x316653){var _0x66802c=_0x57c5('0x59');var _0x1c93b5={'custom':![]};return utilLicense['getLicense']()[_0x57c5('0x1a')](function(_0x1b25a3){if(_0x1b25a3){_0x1c93b5=_0x1b25a3;}return db[_0x57c5('0x38')]['find']({'where':{'id':_0xdcb375[_0x57c5('0x4f')]['id']},'attributes':['logo',_0x57c5('0x57'),_0x57c5('0x5a'),_0x57c5('0x5b'),'defaultLogo',_0x57c5('0x5c'),_0x57c5('0x5d'),'defaultFavicon'],'raw':!![]});})[_0x57c5('0x1a')](handleEntityNotFound(_0x30c60c,null))['then'](function(_0x30612b){if(_0x30612b){var _0x50f343=_0x30612b[_0x57c5('0x55')]&&fs['existsSync'](path[_0x57c5('0x5e')](config['root'],_0x66802c,_[_0x57c5('0x5f')](_0x30612b['logo'])))?path[_0x57c5('0x5e')](config[_0x57c5('0x60')],_0x66802c,_[_0x57c5('0x5f')](_0x30612b[_0x57c5('0x55')])):path[_0x57c5('0x5e')](config[_0x57c5('0x60')],_0x66802c,_[_0x57c5('0x5f')](_0x57c5('0x61')));var _0x2e116f=_0x57c5('0x62')+_['upperFirst'](_0x57c5('0x55'));if(_0x30612b[_0x2e116f]||!_0x1c93b5[_0x57c5('0x63')]){_0x50f343=path['join'](config[_0x57c5('0x60')],_0x66802c,_[_0x57c5('0x5f')](_0x57c5('0x61')));}if(!fs[_0x57c5('0x64')](_0x50f343)){throw new db[(_0x57c5('0x65'))]['ValidationError'](_['upperFirst'](_0x57c5('0x55'))+'\x20not\x20found');}return _0x30c60c['download'](_0x50f343);}})['catch'](handleError(_0x30c60c,null));};var utilLicense=require(_0x57c5('0x15'));exports[_0x57c5('0x66')]=function(_0x283e32,_0x133eda,_0xb2fa77){var _0x58b627='server/files/images/logos';var _0x567b8d={'custom':![]};return utilLicense[_0x57c5('0x67')]()[_0x57c5('0x1a')](function(_0x2cf4a7){if(_0x2cf4a7){_0x567b8d=_0x2cf4a7;}return db['Setting']['find']({'where':{'id':_0x283e32[_0x57c5('0x4f')]['id']},'attributes':[_0x57c5('0x55'),_0x57c5('0x57'),_0x57c5('0x5a'),_0x57c5('0x5b'),_0x57c5('0x68'),_0x57c5('0x5c'),_0x57c5('0x5d'),_0x57c5('0x69')],'raw':!![]});})[_0x57c5('0x1a')](handleEntityNotFound(_0x133eda,null))['then'](function(_0x4f9ae1){if(_0x4f9ae1){var _0x16a84a=_0x4f9ae1[_0x57c5('0x57')]&&fs[_0x57c5('0x64')](path[_0x57c5('0x5e')](config[_0x57c5('0x60')],_0x58b627,_[_0x57c5('0x5f')](_0x4f9ae1['loginLogo'])))?path[_0x57c5('0x5e')](config[_0x57c5('0x60')],_0x58b627,_[_0x57c5('0x5f')](_0x4f9ae1['loginLogo'])):path[_0x57c5('0x5e')](config[_0x57c5('0x60')],_0x58b627,_[_0x57c5('0x5f')](_0x57c5('0x6a')));var _0x5743de=_0x57c5('0x62')+_[_0x57c5('0x6b')]('loginLogo');if(_0x4f9ae1[_0x5743de]||!_0x567b8d[_0x57c5('0x63')]){_0x16a84a=path['join'](config['root'],_0x58b627,_[_0x57c5('0x5f')](_0x57c5('0x6a')));}if(!fs[_0x57c5('0x64')](_0x16a84a)){throw new db[(_0x57c5('0x65'))][(_0x57c5('0x6c'))](_[_0x57c5('0x6b')]('loginLogo')+'\x20not\x20found');}return _0x133eda[_0x57c5('0x6d')](_0x16a84a);}})['catch'](handleError(_0x133eda,null));};exports[_0x57c5('0x6e')]=function(_0x384f6c,_0x4e46fa){return db[_0x57c5('0x38')]['find']({'where':{'id':_0x384f6c[_0x57c5('0x4f')]['id']},'attributes':[_0x57c5('0x6f')]})[_0x57c5('0x1a')](respondWithResult(_0x4e46fa,null))[_0x57c5('0x23')](handleError(_0x4e46fa,null));};exports[_0x57c5('0x70')]=function(_0x3f1e61,_0x536679,_0x469789){if(_0x3f1e61[_0x57c5('0x54')]&&_0x3f1e61['file'][_0x57c5('0x56')]){_0x3f1e61[_0x57c5('0x53')][_0x57c5('0x5a')]=_0x3f1e61[_0x57c5('0x54')]['filename'];}return db['Setting'][_0x57c5('0x52')]({'where':{'id':_0x3f1e61[_0x57c5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x536679,null))[_0x57c5('0x1a')](saveUpdates(_0x3f1e61[_0x57c5('0x53')],null))[_0x57c5('0x1a')](respondWithResult(_0x536679,null))[_0x57c5('0x23')](handleError(_0x536679,null));};var utilLicense=require(_0x57c5('0x15'));exports[_0x57c5('0x71')]=function(_0x90bd32,_0x42e8a7,_0x4137af){var _0x4bab5b=_0x57c5('0x59');var _0x4f0e7e={'custom':![]};return utilLicense[_0x57c5('0x67')]()[_0x57c5('0x1a')](function(_0xa96a31){if(_0xa96a31){_0x4f0e7e=_0xa96a31;}return db[_0x57c5('0x38')][_0x57c5('0x52')]({'where':{'id':_0x90bd32[_0x57c5('0x4f')]['id']},'attributes':[_0x57c5('0x55'),_0x57c5('0x57'),_0x57c5('0x5a'),_0x57c5('0x5b'),'defaultLogo',_0x57c5('0x5c'),'defaultPreferred',_0x57c5('0x69')],'raw':!![]});})[_0x57c5('0x1a')](handleEntityNotFound(_0x42e8a7,null))[_0x57c5('0x1a')](function(_0x596a0b){if(_0x596a0b){var _0x2ac43c=_0x596a0b['preferred']&&fs[_0x57c5('0x64')](path[_0x57c5('0x5e')](config['root'],_0x4bab5b,_[_0x57c5('0x5f')](_0x596a0b[_0x57c5('0x5a')])))?path[_0x57c5('0x5e')](config[_0x57c5('0x60')],_0x4bab5b,_[_0x57c5('0x5f')](_0x596a0b[_0x57c5('0x5a')])):path[_0x57c5('0x5e')](config[_0x57c5('0x60')],_0x4bab5b,_[_0x57c5('0x5f')](_0x57c5('0x72')));var _0x204ab5=_0x57c5('0x62')+_[_0x57c5('0x6b')](_0x57c5('0x5a'));if(_0x596a0b[_0x204ab5]||!_0x4f0e7e[_0x57c5('0x63')]||!_0x4f0e7e[_0x57c5('0x5a')]){_0x2ac43c=path[_0x57c5('0x5e')](config[_0x57c5('0x60')],_0x4bab5b,_[_0x57c5('0x5f')](_0x57c5('0x72')));}if(!fs[_0x57c5('0x64')](_0x2ac43c)){throw new db[(_0x57c5('0x65'))][(_0x57c5('0x6c'))](_['upperFirst'](_0x57c5('0x5a'))+_0x57c5('0x73'));}return _0x42e8a7['download'](_0x2ac43c);}})['catch'](handleError(_0x42e8a7,null));};exports[_0x57c5('0x74')]=function(_0x4f347b,_0xac48e4,_0x51e771){if(_0x4f347b[_0x57c5('0x54')]&&_0x4f347b[_0x57c5('0x54')][_0x57c5('0x56')]){_0x4f347b[_0x57c5('0x53')][_0x57c5('0x5b')]=_0x4f347b[_0x57c5('0x54')][_0x57c5('0x56')];}return db[_0x57c5('0x38')][_0x57c5('0x52')]({'where':{'id':_0x4f347b[_0x57c5('0x4f')]['id']}})[_0x57c5('0x1a')](handleEntityNotFound(_0xac48e4,null))[_0x57c5('0x1a')](saveUpdates(_0x4f347b[_0x57c5('0x53')],null))[_0x57c5('0x1a')](respondWithResult(_0xac48e4,null))['catch'](handleError(_0xac48e4,null));};var utilLicense=require(_0x57c5('0x15'));exports[_0x57c5('0x75')]=function(_0x4f29bd,_0x13b9ef,_0xdd91a1){var _0x2d14e2=_0x57c5('0x59');var _0x3e8c62={'custom':![]};return utilLicense[_0x57c5('0x67')]()[_0x57c5('0x1a')](function(_0x37b0a7){if(_0x37b0a7){_0x3e8c62=_0x37b0a7;}return db[_0x57c5('0x38')]['find']({'where':{'id':_0x4f29bd['params']['id']},'attributes':[_0x57c5('0x55'),_0x57c5('0x57'),'preferred',_0x57c5('0x5b'),_0x57c5('0x68'),_0x57c5('0x5c'),_0x57c5('0x5d'),_0x57c5('0x69')],'raw':!![]});})[_0x57c5('0x1a')](handleEntityNotFound(_0x13b9ef,null))[_0x57c5('0x1a')](function(_0xdc10ec){if(_0xdc10ec){var _0x5da5f0=_0xdc10ec[_0x57c5('0x5b')]&&fs['existsSync'](path['join'](config[_0x57c5('0x60')],_0x2d14e2,_['toLower'](_0xdc10ec[_0x57c5('0x5b')])))?path[_0x57c5('0x5e')](config[_0x57c5('0x60')],_0x2d14e2,_['toLower'](_0xdc10ec[_0x57c5('0x5b')])):path[_0x57c5('0x5e')](config[_0x57c5('0x60')],_0x2d14e2,_['toLower'](_0x57c5('0x76')));var _0x219071=_0x57c5('0x62')+_[_0x57c5('0x6b')](_0x57c5('0x5b'));if(_0xdc10ec[_0x219071]||!_0x3e8c62[_0x57c5('0x63')]){_0x5da5f0=path[_0x57c5('0x5e')](config[_0x57c5('0x60')],_0x2d14e2,_[_0x57c5('0x5f')]('default_favicon.ico'));}if(!fs[_0x57c5('0x64')](_0x5da5f0)){throw new db[(_0x57c5('0x65'))][(_0x57c5('0x6c'))](_[_0x57c5('0x6b')]('favicon')+_0x57c5('0x73'));}return _0x13b9ef['download'](_0x5da5f0);}})['catch'](handleError(_0x13b9ef,null));};exports[_0x57c5('0x77')]=function(_0x2f690f,_0x1481ef){var _0x242468={'offset':moment()[_0x57c5('0x78')]()};_0x242468[_0x57c5('0x79')]=moment()[_0x57c5('0x78')](_0x242468[_0x57c5('0x2a')])['format'](_0x57c5('0x7a'));return _0x1481ef['status'](0xc8)['send'](_0x242468);}; \ No newline at end of file +var _0x79e5=['rimraf','zip-dir','request-promise','moment','bluebird','path','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','Setting','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','update','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','custom','ValidationError','upperFirst','\x20not\x20found','download','defaultFavicon','default_loginLogo.svg','Sequelize','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x79e5,0x79));var _0x579e=function(_0x2b17e6,_0x5cd5ad){_0x2b17e6=_0x2b17e6-0x0;var _0x246aac=_0x79e5[_0x2b17e6];return _0x246aac;};'use strict';var emlformat=require(_0x579e('0x0'));var rimraf=require(_0x579e('0x1'));var zipdir=require(_0x579e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x579e('0x3'));var moment=require(_0x579e('0x4'));var BPromise=require(_0x579e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x579e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x579e('0x7'));var squel=require(_0x579e('0x8'));var crypto=require(_0x579e('0x9'));var jsforce=require(_0x579e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x579e('0xb'));var querystring=require(_0x579e('0xc'));var Papa=require('papaparse');var Redis=require(_0x579e('0xd'));var authService=require(_0x579e('0xe'));var qs=require(_0x579e('0xf'));var as=require(_0x579e('0x10'));var hardwareService=require(_0x579e('0x11'));var logger=require(_0x579e('0x12'))(_0x579e('0x13'));var utils=require(_0x579e('0x14'));var config=require(_0x579e('0x15'));var licenseUtil=require(_0x579e('0x16'));var db=require(_0x579e('0x17'))['db'];var jayson=require(_0x579e('0x18'));var client=jayson[_0x579e('0x19')][_0x579e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xe45d7c,_0x16ddb6,_0x339cac,_0x3d84d0){return new BPromise(function(_0xdcb9fa,_0x1d712a){var _0x159767=_0x3d84d0||client;return _0x159767['request'](_0xe45d7c,_0x339cac)['then'](function(_0x52a897){logger['info'](_0x579e('0x1b'),_0x16ddb6,'request\x20sent');logger['debug'](_0x579e('0x1c'),_0x16ddb6,_0x579e('0x1d'),JSON[_0x579e('0x1e')](_0x52a897));if(_0x52a897[_0x579e('0x1f')]){if(_0x52a897[_0x579e('0x1f')][_0x579e('0x20')]===0x1f4){logger[_0x579e('0x1f')](_0x579e('0x1b'),_0x16ddb6,_0x52a897['error'][_0x579e('0x21')]);return _0x1d712a(_0x52a897[_0x579e('0x1f')]['message']);}logger['error'](_0x579e('0x1b'),_0x16ddb6,_0x52a897[_0x579e('0x1f')][_0x579e('0x21')]);return _0xdcb9fa(_0x52a897[_0x579e('0x1f')][_0x579e('0x21')]);}else{logger[_0x579e('0x22')]('Setting,\x20%s,\x20%s',_0x16ddb6,_0x579e('0x1d'));_0xdcb9fa(_0x52a897[_0x579e('0x23')][_0x579e('0x21')]);}})['catch'](function(_0x4e1faf){logger[_0x579e('0x1f')](_0x579e('0x1b'),_0x16ddb6,_0x4e1faf);_0x1d712a(_0x4e1faf);});});}function respondWithStatusCode(_0x3c24eb,_0x392750){_0x392750=_0x392750||0xcc;return function(_0x5766e5){if(_0x5766e5){return _0x3c24eb[_0x579e('0x24')](_0x392750);}return _0x3c24eb['status'](_0x392750)[_0x579e('0x25')]();};}function respondWithResult(_0x37f5c8,_0x540065){_0x540065=_0x540065||0xc8;return function(_0x1f874){if(_0x1f874){return _0x37f5c8[_0x579e('0x26')](_0x540065)[_0x579e('0x27')](_0x1f874);}};}function respondWithFilteredResult(_0x46c305,_0x3e6f55){return function(_0x345e79){if(_0x345e79){var _0xab79f0=typeof _0x3e6f55[_0x579e('0x28')]==='undefined'&&typeof _0x3e6f55[_0x579e('0x29')]===_0x579e('0x2a');var _0x2da33b=_0x345e79[_0x579e('0x2b')];var _0xf91d53=_0xab79f0?0x0:_0x3e6f55[_0x579e('0x28')];var _0x3a512e=_0xab79f0?_0x345e79[_0x579e('0x2b')]:_0x3e6f55['offset']+_0x3e6f55[_0x579e('0x29')];var _0x536fb7;if(_0x3a512e>=_0x2da33b){_0x3a512e=_0x2da33b;_0x536fb7=0xc8;}else{_0x536fb7=0xce;}_0x46c305[_0x579e('0x26')](_0x536fb7);return _0x46c305[_0x579e('0x2c')](_0x579e('0x2d'),_0xf91d53+'-'+_0x3a512e+'/'+_0x2da33b)[_0x579e('0x27')](_0x345e79);}return null;};}function patchUpdates(_0xc8d69){return function(_0x452423){try{jsonpatch[_0x579e('0x2e')](_0x452423,_0xc8d69,!![]);}catch(_0x542a7f){return BPromise[_0x579e('0x2f')](_0x542a7f);}return _0x452423[_0x579e('0x30')]();};}function saveUpdates(_0x531229,_0x98f151){return function(_0x23138f){if(_0x23138f){return _0x23138f['update'](_0x531229)[_0x579e('0x31')](function(_0x6ca2b8){return _0x6ca2b8;});}return null;};}function removeEntity(_0x1ea184,_0x4ee13d){return function(_0x4b38a5){if(_0x4b38a5){return _0x4b38a5[_0x579e('0x32')]()[_0x579e('0x31')](function(){_0x1ea184[_0x579e('0x26')](0xcc)[_0x579e('0x25')]();});}};}function handleEntityNotFound(_0x144e3a,_0x465509){return function(_0x2f6057){if(!_0x2f6057){_0x144e3a['sendStatus'](0x194);}return _0x2f6057;};}function handleError(_0x9f9562,_0x18bb47){_0x18bb47=_0x18bb47||0x1f4;return function(_0x33d060){logger[_0x579e('0x1f')](_0x33d060[_0x579e('0x33')]);if(_0x33d060[_0x579e('0x34')]){delete _0x33d060[_0x579e('0x34')];}_0x9f9562[_0x579e('0x26')](_0x18bb47)[_0x579e('0x35')](_0x33d060);};}exports['index']=function(_0x1e9764,_0x2caa25){var _0x853791={},_0x4287ee={},_0x2cdc79={'count':0x0,'rows':[]};var _0x68acf6=_[_0x579e('0x36')](db[_0x579e('0x37')][_0x579e('0x38')],function(_0x5a4916){return{'name':_0x5a4916[_0x579e('0x39')],'type':_0x5a4916[_0x579e('0x3a')]['key']};});_0x4287ee[_0x579e('0x3b')]=_[_0x579e('0x36')](_0x68acf6,'name');_0x4287ee[_0x579e('0x3c')]=_[_0x579e('0x3d')](_0x1e9764[_0x579e('0x3c')]);_0x4287ee[_0x579e('0x3e')]=_[_0x579e('0x3f')](_0x4287ee[_0x579e('0x3b')],_0x4287ee[_0x579e('0x3c')]);_0x853791[_0x579e('0x40')]=_[_0x579e('0x3f')](_0x4287ee[_0x579e('0x3b')],qs[_0x579e('0x41')](_0x1e9764[_0x579e('0x3c')][_0x579e('0x41')]));_0x853791['attributes']=_0x853791[_0x579e('0x40')][_0x579e('0x42')]?_0x853791[_0x579e('0x40')]:_0x4287ee['model'];if(!_0x1e9764[_0x579e('0x3c')]['hasOwnProperty'](_0x579e('0x43'))){_0x853791[_0x579e('0x29')]=qs[_0x579e('0x29')](_0x1e9764[_0x579e('0x3c')][_0x579e('0x29')]);_0x853791['offset']=qs[_0x579e('0x28')](_0x1e9764[_0x579e('0x3c')][_0x579e('0x28')]);}_0x853791[_0x579e('0x44')]=qs['sort'](_0x1e9764[_0x579e('0x3c')][_0x579e('0x45')]);_0x853791['where']=qs['filters'](_[_0x579e('0x46')](_0x1e9764[_0x579e('0x3c')],_0x4287ee[_0x579e('0x3e')]),_0x68acf6);if(_0x1e9764[_0x579e('0x3c')][_0x579e('0x47')]){_0x853791[_0x579e('0x48')]=_[_0x579e('0x49')](_0x853791['where'],{'$or':_[_0x579e('0x36')](_0x68acf6,function(_0xbde074){if(_0xbde074[_0x579e('0x3a')]!==_0x579e('0x4a')){var _0xa1b8fa={};_0xa1b8fa[_0xbde074[_0x579e('0x34')]]={'$like':'%'+_0x1e9764[_0x579e('0x3c')][_0x579e('0x47')]+'%'};return _0xa1b8fa;}})});}_0x853791=_[_0x579e('0x49')]({},_0x853791,_0x1e9764[_0x579e('0x4b')]);var _0x51d19={'where':_0x853791[_0x579e('0x48')]};return db[_0x579e('0x37')][_0x579e('0x2b')](_0x51d19)['then'](function(_0x207128){_0x2cdc79['count']=_0x207128;if(_0x1e9764[_0x579e('0x3c')]['includeAll']){_0x853791[_0x579e('0x4c')]=[{'all':!![]}];}return db[_0x579e('0x37')][_0x579e('0x4d')](_0x853791);})[_0x579e('0x31')](function(_0x1011c9){_0x2cdc79[_0x579e('0x4e')]=_0x1011c9;return _0x2cdc79;})[_0x579e('0x31')](respondWithFilteredResult(_0x2caa25,_0x853791))[_0x579e('0x4f')](handleError(_0x2caa25,null));};exports[_0x579e('0x50')]=function(_0x45fa06,_0x4499c6){var _0x3e8cdd={'raw':![],'where':{'id':_0x45fa06[_0x579e('0x51')]['id']}},_0x4277e8={};_0x4277e8[_0x579e('0x3b')]=_[_0x579e('0x3d')](db[_0x579e('0x37')][_0x579e('0x38')]);_0x4277e8[_0x579e('0x3c')]=_['keys'](_0x45fa06[_0x579e('0x3c')]);_0x4277e8['filters']=_[_0x579e('0x3f')](_0x4277e8[_0x579e('0x3b')],_0x4277e8[_0x579e('0x3c')]);_0x3e8cdd[_0x579e('0x40')]=_[_0x579e('0x3f')](_0x4277e8[_0x579e('0x3b')],qs[_0x579e('0x41')](_0x45fa06[_0x579e('0x3c')][_0x579e('0x41')]));_0x3e8cdd[_0x579e('0x40')]=_0x3e8cdd['attributes'][_0x579e('0x42')]?_0x3e8cdd[_0x579e('0x40')]:_0x4277e8[_0x579e('0x3b')];if(_0x45fa06[_0x579e('0x3c')][_0x579e('0x52')]){_0x3e8cdd[_0x579e('0x4c')]=[{'all':!![]}];}_0x3e8cdd=_[_0x579e('0x49')]({},_0x3e8cdd,_0x45fa06[_0x579e('0x4b')]);return db[_0x579e('0x37')][_0x579e('0x53')](_0x3e8cdd)['then'](handleEntityNotFound(_0x4499c6,null))[_0x579e('0x31')](respondWithResult(_0x4499c6,null))[_0x579e('0x4f')](handleError(_0x4499c6,null));};exports[_0x579e('0x54')]=function(_0x4ce021,_0x10f119){if(_0x4ce021[_0x579e('0x55')]['id']){delete _0x4ce021[_0x579e('0x55')]['id'];}return db['Setting']['find']({'where':{'id':_0x4ce021[_0x579e('0x51')]['id']}})['then'](handleEntityNotFound(_0x10f119,null))[_0x579e('0x31')](saveUpdates(_0x4ce021['body'],null))['then'](respondWithResult(_0x10f119,null))['catch'](handleError(_0x10f119,null));};exports[_0x579e('0x56')]=function(_0x531d51,_0x2950ce,_0x3acdb2){if(_0x531d51[_0x579e('0x57')]&&_0x531d51[_0x579e('0x57')][_0x579e('0x58')]){_0x531d51['body'][_0x579e('0x59')]=_0x531d51[_0x579e('0x57')]['filename'];}return db[_0x579e('0x37')][_0x579e('0x53')]({'where':{'id':_0x531d51[_0x579e('0x51')]['id']}})[_0x579e('0x31')](handleEntityNotFound(_0x2950ce,null))[_0x579e('0x31')](saveUpdates(_0x531d51[_0x579e('0x55')],null))[_0x579e('0x31')](respondWithResult(_0x2950ce,null))[_0x579e('0x4f')](handleError(_0x2950ce,null));};exports[_0x579e('0x5a')]=function(_0x2d31ba,_0x837a53,_0x1f2417){if(_0x2d31ba['file']&&_0x2d31ba['file'][_0x579e('0x58')]){_0x2d31ba['body'][_0x579e('0x5b')]=_0x2d31ba[_0x579e('0x57')][_0x579e('0x58')];}return db[_0x579e('0x37')][_0x579e('0x53')]({'where':{'id':_0x2d31ba['params']['id']}})[_0x579e('0x31')](handleEntityNotFound(_0x837a53,null))['then'](saveUpdates(_0x2d31ba['body'],null))[_0x579e('0x31')](respondWithResult(_0x837a53,null))['catch'](handleError(_0x837a53,null));};var utilLicense=require(_0x579e('0x16'));exports['getLogo']=function(_0x565fc5,_0x5a8f68,_0x91a04a){var _0x46d446=_0x579e('0x5c');var _0x15fcc9={'custom':![]};return utilLicense[_0x579e('0x5d')]()['then'](function(_0x58953d){if(_0x58953d){_0x15fcc9=_0x58953d;}return db[_0x579e('0x37')][_0x579e('0x53')]({'where':{'id':_0x565fc5['params']['id']},'attributes':[_0x579e('0x59'),'loginLogo',_0x579e('0x5e'),_0x579e('0x5f'),_0x579e('0x60'),_0x579e('0x61'),_0x579e('0x62'),'defaultFavicon'],'raw':!![]});})[_0x579e('0x31')](handleEntityNotFound(_0x5a8f68,null))[_0x579e('0x31')](function(_0x20c397){if(_0x20c397){var _0x2aecb6=_0x20c397[_0x579e('0x59')]&&fs[_0x579e('0x63')](path[_0x579e('0x64')](config['root'],_0x46d446,_['toLower'](_0x20c397[_0x579e('0x59')])))?path[_0x579e('0x64')](config[_0x579e('0x65')],_0x46d446,_[_0x579e('0x66')](_0x20c397[_0x579e('0x59')])):path[_0x579e('0x64')](config['root'],_0x46d446,_[_0x579e('0x66')](_0x579e('0x67')));var _0x431a3e=_0x579e('0x68')+_['upperFirst']('logo');if(_0x20c397[_0x431a3e]||!_0x15fcc9[_0x579e('0x69')]){_0x2aecb6=path[_0x579e('0x64')](config[_0x579e('0x65')],_0x46d446,_[_0x579e('0x66')](_0x579e('0x67')));}if(!fs['existsSync'](_0x2aecb6)){throw new db['Sequelize'][(_0x579e('0x6a'))](_[_0x579e('0x6b')](_0x579e('0x59'))+_0x579e('0x6c'));}return _0x5a8f68[_0x579e('0x6d')](_0x2aecb6);}})[_0x579e('0x4f')](handleError(_0x5a8f68,null));};var utilLicense=require(_0x579e('0x16'));exports['getLogoLogin']=function(_0x5d834f,_0xefd5c2,_0x6e74ea){var _0x3b5db5=_0x579e('0x5c');var _0x4b1c0a={'custom':![]};return utilLicense[_0x579e('0x5d')]()[_0x579e('0x31')](function(_0x2b4736){if(_0x2b4736){_0x4b1c0a=_0x2b4736;}return db[_0x579e('0x37')][_0x579e('0x53')]({'where':{'id':_0x5d834f[_0x579e('0x51')]['id']},'attributes':['logo',_0x579e('0x5b'),_0x579e('0x5e'),'favicon',_0x579e('0x60'),'defaultLoginLogo',_0x579e('0x62'),_0x579e('0x6e')],'raw':!![]});})[_0x579e('0x31')](handleEntityNotFound(_0xefd5c2,null))[_0x579e('0x31')](function(_0x47d658){if(_0x47d658){var _0x3b2d76=_0x47d658[_0x579e('0x5b')]&&fs[_0x579e('0x63')](path[_0x579e('0x64')](config[_0x579e('0x65')],_0x3b5db5,_['toLower'](_0x47d658['loginLogo'])))?path['join'](config[_0x579e('0x65')],_0x3b5db5,_[_0x579e('0x66')](_0x47d658['loginLogo'])):path[_0x579e('0x64')](config['root'],_0x3b5db5,_[_0x579e('0x66')](_0x579e('0x6f')));var _0x71a47=_0x579e('0x68')+_[_0x579e('0x6b')](_0x579e('0x5b'));if(_0x47d658[_0x71a47]||!_0x4b1c0a[_0x579e('0x69')]){_0x3b2d76=path[_0x579e('0x64')](config['root'],_0x3b5db5,_[_0x579e('0x66')](_0x579e('0x6f')));}if(!fs['existsSync'](_0x3b2d76)){throw new db[(_0x579e('0x70'))][(_0x579e('0x6a'))](_[_0x579e('0x6b')](_0x579e('0x5b'))+_0x579e('0x6c'));}return _0xefd5c2[_0x579e('0x6d')](_0x3b2d76);}})[_0x579e('0x4f')](handleError(_0xefd5c2,null));};exports['gdpr']=function(_0x2c6e60,_0x14d4ae){return db[_0x579e('0x37')][_0x579e('0x53')]({'where':{'id':_0x2c6e60[_0x579e('0x51')]['id']},'attributes':['securePassword']})[_0x579e('0x31')](respondWithResult(_0x14d4ae,null))['catch'](handleError(_0x14d4ae,null));};exports[_0x579e('0x71')]=function(_0x2097a1,_0x18f18f,_0x21ad18){if(_0x2097a1[_0x579e('0x57')]&&_0x2097a1[_0x579e('0x57')][_0x579e('0x58')]){_0x2097a1['body'][_0x579e('0x5e')]=_0x2097a1['file']['filename'];}return db[_0x579e('0x37')]['find']({'where':{'id':_0x2097a1[_0x579e('0x51')]['id']}})['then'](handleEntityNotFound(_0x18f18f,null))[_0x579e('0x31')](saveUpdates(_0x2097a1[_0x579e('0x55')],null))['then'](respondWithResult(_0x18f18f,null))['catch'](handleError(_0x18f18f,null));};var utilLicense=require('../../config/license/util');exports[_0x579e('0x72')]=function(_0x1f720e,_0x5be127,_0x576654){var _0x19d02d=_0x579e('0x5c');var _0x49cc9f={'custom':![]};return utilLicense[_0x579e('0x5d')]()['then'](function(_0x846f65){if(_0x846f65){_0x49cc9f=_0x846f65;}return db[_0x579e('0x37')][_0x579e('0x53')]({'where':{'id':_0x1f720e['params']['id']},'attributes':[_0x579e('0x59'),_0x579e('0x5b'),_0x579e('0x5e'),_0x579e('0x5f'),_0x579e('0x60'),_0x579e('0x61'),_0x579e('0x62'),_0x579e('0x6e')],'raw':!![]});})[_0x579e('0x31')](handleEntityNotFound(_0x5be127,null))[_0x579e('0x31')](function(_0x5439f6){if(_0x5439f6){var _0x130cc4=_0x5439f6['preferred']&&fs[_0x579e('0x63')](path['join'](config[_0x579e('0x65')],_0x19d02d,_[_0x579e('0x66')](_0x5439f6[_0x579e('0x5e')])))?path['join'](config[_0x579e('0x65')],_0x19d02d,_[_0x579e('0x66')](_0x5439f6[_0x579e('0x5e')])):path['join'](config[_0x579e('0x65')],_0x19d02d,_['toLower'](_0x579e('0x73')));var _0x41004a='default'+_['upperFirst'](_0x579e('0x5e'));if(_0x5439f6[_0x41004a]||!_0x49cc9f[_0x579e('0x69')]||!_0x49cc9f[_0x579e('0x5e')]){_0x130cc4=path[_0x579e('0x64')](config[_0x579e('0x65')],_0x19d02d,_[_0x579e('0x66')](_0x579e('0x73')));}if(!fs[_0x579e('0x63')](_0x130cc4)){throw new db['Sequelize']['ValidationError'](_[_0x579e('0x6b')](_0x579e('0x5e'))+_0x579e('0x6c'));}return _0x5be127['download'](_0x130cc4);}})[_0x579e('0x4f')](handleError(_0x5be127,null));};exports[_0x579e('0x74')]=function(_0x361643,_0x3e5cab,_0x585d25){if(_0x361643['file']&&_0x361643[_0x579e('0x57')][_0x579e('0x58')]){_0x361643[_0x579e('0x55')][_0x579e('0x5f')]=_0x361643['file'][_0x579e('0x58')];}return db[_0x579e('0x37')][_0x579e('0x53')]({'where':{'id':_0x361643['params']['id']}})[_0x579e('0x31')](handleEntityNotFound(_0x3e5cab,null))[_0x579e('0x31')](saveUpdates(_0x361643['body'],null))['then'](respondWithResult(_0x3e5cab,null))[_0x579e('0x4f')](handleError(_0x3e5cab,null));};var utilLicense=require(_0x579e('0x16'));exports[_0x579e('0x75')]=function(_0x5345fc,_0x59dc93,_0x5b06bd){var _0x590ab3='server/files/images/logos';var _0x37933b={'custom':![]};return utilLicense['getLicense']()[_0x579e('0x31')](function(_0x14cd9d){if(_0x14cd9d){_0x37933b=_0x14cd9d;}return db['Setting'][_0x579e('0x53')]({'where':{'id':_0x5345fc[_0x579e('0x51')]['id']},'attributes':[_0x579e('0x59'),_0x579e('0x5b'),'preferred',_0x579e('0x5f'),_0x579e('0x60'),_0x579e('0x61'),_0x579e('0x62'),'defaultFavicon'],'raw':!![]});})[_0x579e('0x31')](handleEntityNotFound(_0x59dc93,null))[_0x579e('0x31')](function(_0x1253c0){if(_0x1253c0){var _0x578807=_0x1253c0[_0x579e('0x5f')]&&fs[_0x579e('0x63')](path[_0x579e('0x64')](config[_0x579e('0x65')],_0x590ab3,_['toLower'](_0x1253c0[_0x579e('0x5f')])))?path[_0x579e('0x64')](config[_0x579e('0x65')],_0x590ab3,_[_0x579e('0x66')](_0x1253c0[_0x579e('0x5f')])):path['join'](config[_0x579e('0x65')],_0x590ab3,_['toLower'](_0x579e('0x76')));var _0x1ea5d1='default'+_[_0x579e('0x6b')](_0x579e('0x5f'));if(_0x1253c0[_0x1ea5d1]||!_0x37933b[_0x579e('0x69')]){_0x578807=path[_0x579e('0x64')](config[_0x579e('0x65')],_0x590ab3,_[_0x579e('0x66')]('default_favicon.ico'));}if(!fs[_0x579e('0x63')](_0x578807)){throw new db[(_0x579e('0x70'))][(_0x579e('0x6a'))](_[_0x579e('0x6b')](_0x579e('0x5f'))+_0x579e('0x6c'));}return _0x59dc93['download'](_0x578807);}})[_0x579e('0x4f')](handleError(_0x59dc93,null));};exports['getDate']=function(_0x432633,_0x140487){var _0x51906e={'offset':moment()[_0x579e('0x77')]()};_0x51906e['now']=moment()[_0x579e('0x77')](_0x51906e[_0x579e('0x28')])[_0x579e('0x78')](_0x579e('0x79'));return _0x140487[_0x579e('0x26')](0xc8)[_0x579e('0x35')](_0x51906e);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 19e0e93..a084200 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x23a541,_0x441e0f){var _0x514b04=function(_0x54062d){while(--_0x54062d){_0x23a541['push'](_0x23a541['shift']());}};_0x514b04(++_0x441e0f);}(_0x34e8,0x12c));var _0x834e=function(_0x32da14,_0x3c06af){_0x32da14=_0x32da14-0x0;var _0x209e2c=_0x34e8[_0x32da14];return _0x209e2c;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x279368,_0x41c002){var _0x40b6d0=function(_0x493776){while(--_0x493776){_0x279368['push'](_0x279368['shift']());}};_0x40b6d0(++_0x41c002);}(_0x55ca,0x126));var _0xa55c=function(_0x1d291d,_0x17314a){_0x1d291d=_0x1d291d-0x0;var _0x44cc4e=_0x55ca[_0x1d291d];return _0x44cc4e;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index c0a4bba..63a12da 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 _0x5ad4=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSetting','find','options','raw','where','attributes','include','map','model','util','randomstring','ioredis','../../config/logger'];(function(_0x2bb2ae,_0x59475c){var _0x33bbd8=function(_0x4e8fdf){while(--_0x4e8fdf){_0x2bb2ae['push'](_0x2bb2ae['shift']());}};_0x33bbd8(++_0x59475c);}(_0x5ad4,0xce));var _0x45ad=function(_0x5f486e,_0x47599d){_0x5f486e=_0x5f486e-0x0;var _0x39dff7=_0x5ad4[_0x5f486e];return _0x39dff7;};'use strict';var _=require('lodash');var util=require(_0x45ad('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x45ad('0x1'));var fs=require('fs');var Redis=require(_0x45ad('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x45ad('0x3'))(_0x45ad('0x4'));var config=require(_0x45ad('0x5'));var jayson=require(_0x45ad('0x6'));var client=jayson[_0x45ad('0x7')][_0x45ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56728e,_0x446915,_0x991ad6){return new BPromise(function(_0x5c715e,_0x915533){return client[_0x45ad('0x9')](_0x56728e,_0x991ad6)[_0x45ad('0xa')](function(_0x5a539){logger[_0x45ad('0xb')](_0x45ad('0xc'),_0x446915,_0x45ad('0xd'));logger[_0x45ad('0xe')](_0x45ad('0xf'),_0x446915,'request\x20sent',JSON[_0x45ad('0x10')](_0x5a539));if(_0x5a539['error']){if(_0x5a539[_0x45ad('0x11')]['code']===0x1f4){logger[_0x45ad('0x11')](_0x45ad('0xc'),_0x446915,_0x5a539[_0x45ad('0x11')][_0x45ad('0x12')]);return _0x915533(_0x5a539[_0x45ad('0x11')][_0x45ad('0x12')]);}logger[_0x45ad('0x11')](_0x45ad('0xc'),_0x446915,_0x5a539[_0x45ad('0x11')]['message']);return _0x5c715e(_0x5a539[_0x45ad('0x11')][_0x45ad('0x12')]);}else{logger[_0x45ad('0xb')](_0x45ad('0xc'),_0x446915,_0x45ad('0xd'));_0x5c715e(_0x5a539[_0x45ad('0x13')]['message']);}})[_0x45ad('0x14')](function(_0x20361f){logger[_0x45ad('0x11')](_0x45ad('0xc'),_0x446915,_0x20361f);_0x915533(_0x20361f);});});}exports[_0x45ad('0x15')]=function(_0x7d65c){var _0x1e81f3=this;return new Promise(function(_0x2f3151,_0x49c241){return db['Setting'][_0x45ad('0x16')]({'raw':_0x7d65c['options']?_0x7d65c[_0x45ad('0x17')][_0x45ad('0x18')]===undefined?!![]:![]:!![],'where':_0x7d65c[_0x45ad('0x17')]?_0x7d65c[_0x45ad('0x17')][_0x45ad('0x19')]||null:null,'attributes':_0x7d65c[_0x45ad('0x17')]?_0x7d65c['options'][_0x45ad('0x1a')]||null:null,'include':_0x7d65c[_0x45ad('0x17')]?_0x7d65c[_0x45ad('0x17')][_0x45ad('0x1b')]?_[_0x45ad('0x1c')](_0x7d65c['options'][_0x45ad('0x1b')],function(_0x4b9712){return{'model':db[_0x4b9712['model']],'as':_0x4b9712['as'],'attributes':_0x4b9712['attributes'],'include':_0x4b9712[_0x45ad('0x1b')]?_[_0x45ad('0x1c')](_0x4b9712['include'],function(_0x20c792){return{'model':db[_0x20c792['model']],'as':_0x20c792['as'],'attributes':_0x20c792['attributes'],'include':_0x20c792['include']?_[_0x45ad('0x1c')](_0x20c792['include'],function(_0x18b20c){return{'model':db[_0x18b20c[_0x45ad('0x1d')]],'as':_0x18b20c['as'],'attributes':_0x18b20c[_0x45ad('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x45ad('0xa')](function(_0x4e3240){logger['info']('ShowSetting',_0x7d65c);logger[_0x45ad('0xe')](_0x45ad('0x15'),_0x7d65c,JSON[_0x45ad('0x10')](_0x4e3240));_0x2f3151(_0x4e3240);})[_0x45ad('0x14')](function(_0x23f003){logger[_0x45ad('0x11')](_0x45ad('0x15'),_0x23f003['message'],_0x7d65c);_0x49c241(_0x1e81f3[_0x45ad('0x11')](0x1f4,_0x23f003[_0x45ad('0x12')]));});});}; \ No newline at end of file +var _0xace2=['code','message','catch','ShowSetting','Setting','options','where','attributes','include','map','model','info','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x7f351a,_0x529c4c){var _0x43c2e8=function(_0x3400ce){while(--_0x3400ce){_0x7f351a['push'](_0x7f351a['shift']());}};_0x43c2e8(++_0x529c4c);}(_0xace2,0xa2));var _0x2ace=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0xace2[_0x218994];return _0x3f350b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2ace('0x0'));var BPromise=require(_0x2ace('0x1'));var rs=require(_0x2ace('0x2'));var fs=require('fs');var Redis=require(_0x2ace('0x3'));var db=require(_0x2ace('0x4'))['db'];var utils=require(_0x2ace('0x5'));var logger=require(_0x2ace('0x6'))(_0x2ace('0x7'));var config=require('../../config/environment');var jayson=require(_0x2ace('0x8'));var client=jayson[_0x2ace('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53616f,_0x22e534,_0x179a24){return new BPromise(function(_0x330b09,_0x2a2b14){return client[_0x2ace('0xa')](_0x53616f,_0x179a24)[_0x2ace('0xb')](function(_0x22b8f6){logger['info'](_0x2ace('0xc'),_0x22e534,_0x2ace('0xd'));logger[_0x2ace('0xe')](_0x2ace('0xf'),_0x22e534,_0x2ace('0xd'),JSON[_0x2ace('0x10')](_0x22b8f6));if(_0x22b8f6[_0x2ace('0x11')]){if(_0x22b8f6['error'][_0x2ace('0x12')]===0x1f4){logger[_0x2ace('0x11')]('Setting,\x20%s,\x20%s',_0x22e534,_0x22b8f6[_0x2ace('0x11')][_0x2ace('0x13')]);return _0x2a2b14(_0x22b8f6[_0x2ace('0x11')][_0x2ace('0x13')]);}logger[_0x2ace('0x11')]('Setting,\x20%s,\x20%s',_0x22e534,_0x22b8f6[_0x2ace('0x11')][_0x2ace('0x13')]);return _0x330b09(_0x22b8f6[_0x2ace('0x11')][_0x2ace('0x13')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x22e534,_0x2ace('0xd'));_0x330b09(_0x22b8f6['result'][_0x2ace('0x13')]);}})[_0x2ace('0x14')](function(_0x5ec323){logger[_0x2ace('0x11')]('Setting,\x20%s,\x20%s',_0x22e534,_0x5ec323);_0x2a2b14(_0x5ec323);});});}exports[_0x2ace('0x15')]=function(_0xcba9f7){var _0x81752c=this;return new Promise(function(_0x2b6248,_0x501a14){return db[_0x2ace('0x16')]['find']({'raw':_0xcba9f7['options']?_0xcba9f7[_0x2ace('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xcba9f7['options']?_0xcba9f7[_0x2ace('0x17')][_0x2ace('0x18')]||null:null,'attributes':_0xcba9f7[_0x2ace('0x17')]?_0xcba9f7[_0x2ace('0x17')][_0x2ace('0x19')]||null:null,'include':_0xcba9f7[_0x2ace('0x17')]?_0xcba9f7[_0x2ace('0x17')][_0x2ace('0x1a')]?_['map'](_0xcba9f7['options'][_0x2ace('0x1a')],function(_0x345350){return{'model':db[_0x345350['model']],'as':_0x345350['as'],'attributes':_0x345350[_0x2ace('0x19')],'include':_0x345350['include']?_[_0x2ace('0x1b')](_0x345350[_0x2ace('0x1a')],function(_0x3366a0){return{'model':db[_0x3366a0[_0x2ace('0x1c')]],'as':_0x3366a0['as'],'attributes':_0x3366a0['attributes'],'include':_0x3366a0[_0x2ace('0x1a')]?_['map'](_0x3366a0[_0x2ace('0x1a')],function(_0x2a7214){return{'model':db[_0x2a7214[_0x2ace('0x1c')]],'as':_0x2a7214['as'],'attributes':_0x2a7214['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ace('0xb')](function(_0x2dec28){logger[_0x2ace('0x1d')](_0x2ace('0x15'),_0xcba9f7);logger[_0x2ace('0xe')](_0x2ace('0x15'),_0xcba9f7,JSON[_0x2ace('0x10')](_0x2dec28));_0x2b6248(_0x2dec28);})[_0x2ace('0x14')](function(_0x48f82d){logger[_0x2ace('0x11')](_0x2ace('0x15'),_0x48f82d[_0x2ace('0x13')],_0xcba9f7);_0x501a14(_0x81752c['error'](0x1f4,_0x48f82d[_0x2ace('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 658b776..ad49b97 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 _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x1dd4a4,_0x6da9eb){var _0x4ea652=function(_0x5a4d8d){while(--_0x5a4d8d){_0x1dd4a4['push'](_0x1dd4a4['shift']());}};_0x4ea652(++_0x6da9eb);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file +var _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0x2d3a7a,_0x546f6b){var _0x3974be=function(_0x58fff9){while(--_0x58fff9){_0x2d3a7a['push'](_0x2d3a7a['shift']());}};_0x3974be(++_0x546f6b);}(_0x6aa7,0x178));var _0x76aa=function(_0x30e7fc,_0x473f93){_0x30e7fc=_0x30e7fc-0x0;var _0x51d333=_0x6aa7[_0x30e7fc];return _0x51d333;};'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('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('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 baecb8d..67d7b5b 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 _0x0377=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x2cab40,_0x3b9185){var _0x33aa52=function(_0x530a33){while(--_0x530a33){_0x2cab40['push'](_0x2cab40['shift']());}};_0x33aa52(++_0x3b9185);}(_0x0377,0x13f));var _0x7037=function(_0x673584,_0x189b1d){_0x673584=_0x673584-0x0;var _0x4a9e83=_0x0377[_0x673584];return _0x4a9e83;};'use strict';var Sequelize=require(_0x7037('0x0'));var rs=require(_0x7037('0x1'));module[_0x7037('0x2')]={'name':{'type':Sequelize[_0x7037('0x3')],'unique':_0x7037('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x7037('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x7037('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x7037('0x3')],'defaultValue':function(){return rs[_0x7037('0x5')]();}},'phone':{'type':Sequelize[_0x7037('0x3')]},'type':{'type':Sequelize[_0x7037('0x6')](_0x7037('0x7'),'skebby','connectel',_0x7037('0x8'),_0x7037('0x9'),_0x7037('0xa'),'bandwidth',_0x7037('0xb'),_0x7037('0xc'),_0x7037('0xd'))},'accountSid':{'type':Sequelize[_0x7037('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x7037('0x3')]},'smsMethod':{'type':Sequelize[_0x7037('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7037('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x7037('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x7037('0x3')]},'deliveryReport':{'type':Sequelize[_0x7037('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x7037('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7037('0xf')],'defaultValue':function(){return _0x7037('0x10');}},'notificationSound':{'type':Sequelize[_0x7037('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7037('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7037('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7037('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7037('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7037('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x7037('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7037('0x12'),'set':function(_0x19bd07){if(!_0x19bd07)this[_0x7037('0x13')](_0x7037('0x14'),null);this[_0x7037('0x13')]('mandatoryDisposition',_0x19bd07);}}}; \ No newline at end of file +var _0x2fb1=['skebby','connectel','clickatell','bandwidth','csc','infobip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','ENUM'];(function(_0x100402,_0x1b61cb){var _0x5d2d56=function(_0xf8898c){while(--_0xf8898c){_0x100402['push'](_0x100402['shift']());}};_0x5d2d56(++_0x1b61cb);}(_0x2fb1,0x13c));var _0x12fb=function(_0x39257a,_0x17f3ee){_0x39257a=_0x39257a-0x0;var _0x1f1c41=_0x2fb1[_0x39257a];return _0x1f1c41;};'use strict';var Sequelize=require(_0x12fb('0x0'));var rs=require(_0x12fb('0x1'));module['exports']={'name':{'type':Sequelize[_0x12fb('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x12fb('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x12fb('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x12fb('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x12fb('0x3')]('twilio',_0x12fb('0x4'),_0x12fb('0x5'),'clicksend','plivo',_0x12fb('0x6'),_0x12fb('0x7'),_0x12fb('0x8'),_0x12fb('0x9'),'intelepeer')},'accountSid':{'type':Sequelize[_0x12fb('0x2')]},'authId':{'type':Sequelize[_0x12fb('0x2')]},'authToken':{'type':Sequelize[_0x12fb('0x2')]},'smsMethod':{'type':Sequelize[_0x12fb('0x3')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x12fb('0x2')]},'applicationId':{'type':Sequelize[_0x12fb('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x12fb('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x12fb('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x12fb('0xa');}},'notificationSound':{'type':Sequelize[_0x12fb('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x12fb('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x12fb('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x12fb('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x12fb('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x12fb('0xc')],'comment':_0x12fb('0xd')},'mandatoryDisposition':{'type':Sequelize[_0x12fb('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x495666){if(!_0x495666)this[_0x12fb('0xe')]('mandatoryDispositionPauseId',null);this[_0x12fb('0xe')](_0x12fb('0xf'),_0x495666);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 18e8559..ef7cb4c 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 _0xd02b=['requestid','statusInt','status_code','groupName','DELIVERED','bandwidth','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','get','SmsAccounts','UserProfileResource','destroy','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SmsAccount','include','rows','catch','show','params','Pause','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findAll','removeDispositions','ids','addAnswer','findOne','CannedAnswer','notify','SmsApplication','Applications','applications','orderBy','priority','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','connectel','clicksend','message_id','From','Text','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','text','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','contact','SmsInteraction','interaction','created','push','unmanaged','*,*,*,*','SmsMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','entity\x20found','debug','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','fullname','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id'];(function(_0x590d73,_0x2800c9){var _0x5c9a8a=function(_0x3efd08){while(--_0x3efd08){_0x590d73['push'](_0x590d73['shift']());}};_0x5c9a8a(++_0x2800c9);}(_0xd02b,0x1d8));var _0xbd02=function(_0x453b3f,_0x4ccaf8){_0x453b3f=_0x453b3f-0x0;var _0x4e224a=_0xd02b[_0x453b3f];return _0x4e224a;};'use strict';var emlformat=require(_0xbd02('0x0'));var rimraf=require(_0xbd02('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd02('0x2'));var rp=require(_0xbd02('0x3'));var moment=require(_0xbd02('0x4'));var BPromise=require(_0xbd02('0x5'));var Mustache=require(_0xbd02('0x6'));var util=require(_0xbd02('0x7'));var path=require(_0xbd02('0x8'));var sox=require(_0xbd02('0x9'));var csv=require(_0xbd02('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd02('0xb'));var squel=require('squel');var crypto=require(_0xbd02('0xc'));var jsforce=require(_0xbd02('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd02('0xe'));var Redis=require('ioredis');var authService=require(_0xbd02('0xf'));var qs=require(_0xbd02('0x10'));var as=require(_0xbd02('0x11'));var hardwareService=require(_0xbd02('0x12'));var logger=require(_0xbd02('0x13'))(_0xbd02('0x14'));var utils=require(_0xbd02('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbd02('0x16'));var db=require('../../mysqldb')['db'];config[_0xbd02('0x17')]=_[_0xbd02('0x18')](config['redis'],{'host':_0xbd02('0x19'),'port':0x18eb});var socket=require(_0xbd02('0x1a'))(new Redis(config[_0xbd02('0x17')]));require(_0xbd02('0x1b'))[_0xbd02('0x1c')](socket);var jayson=require(_0xbd02('0x1d'));var client=jayson[_0xbd02('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x248f34,_0x1a1fcc,_0xf14b07,_0x1cfa19){return new BPromise(function(_0x59cac6,_0x45e598){var _0x21a9f5=_0x1cfa19||client;return _0x21a9f5[_0xbd02('0x1f')](_0x248f34,_0xf14b07)['then'](function(_0x51c5f3){logger[_0xbd02('0x20')]('SmsAccount,\x20%s,\x20%s',_0x1a1fcc,_0xbd02('0x21'));logger['debug'](_0xbd02('0x22'),_0x1a1fcc,'request\x20sent',JSON['stringify'](_0x51c5f3));if(_0x51c5f3[_0xbd02('0x23')]){if(_0x51c5f3['error'][_0xbd02('0x24')]===0x1f4){logger[_0xbd02('0x23')](_0xbd02('0x25'),_0x1a1fcc,_0x51c5f3[_0xbd02('0x23')][_0xbd02('0x26')]);return _0x45e598(_0x51c5f3[_0xbd02('0x23')][_0xbd02('0x26')]);}logger[_0xbd02('0x23')](_0xbd02('0x25'),_0x1a1fcc,_0x51c5f3[_0xbd02('0x23')][_0xbd02('0x26')]);return _0x59cac6(_0x51c5f3[_0xbd02('0x23')][_0xbd02('0x26')]);}else{logger[_0xbd02('0x20')](_0xbd02('0x25'),_0x1a1fcc,_0xbd02('0x21'));_0x59cac6(_0x51c5f3['result']['message']);}})['catch'](function(_0x23f952){logger[_0xbd02('0x23')](_0xbd02('0x25'),_0x1a1fcc,_0x23f952);_0x45e598(_0x23f952);});});}function respondWithStatusCode(_0x4f1eba,_0x32992f){_0x32992f=_0x32992f||0xcc;return function(_0x275261){if(_0x275261){return _0x4f1eba[_0xbd02('0x27')](_0x32992f);}return _0x4f1eba[_0xbd02('0x28')](_0x32992f)[_0xbd02('0x29')]();};}function respondWithResult(_0x39384e,_0x261f8b){_0x261f8b=_0x261f8b||0xc8;return function(_0x1352dc){if(_0x1352dc){return _0x39384e['status'](_0x261f8b)['json'](_0x1352dc);}};}function respondWithFilteredResult(_0x93eb4b,_0x13b4be){return function(_0xb39753){if(_0xb39753){var _0x17ed69=typeof _0x13b4be[_0xbd02('0x2a')]===_0xbd02('0x2b')&&typeof _0x13b4be['limit']===_0xbd02('0x2b');var _0xa81c04=_0xb39753[_0xbd02('0x2c')];var _0x30c0ae=_0x17ed69?0x0:_0x13b4be[_0xbd02('0x2a')];var _0x57ba91=_0x17ed69?_0xb39753[_0xbd02('0x2c')]:_0x13b4be[_0xbd02('0x2a')]+_0x13b4be[_0xbd02('0x2d')];var _0x26ae17;if(_0x57ba91>=_0xa81c04){_0x57ba91=_0xa81c04;_0x26ae17=0xc8;}else{_0x26ae17=0xce;}_0x93eb4b[_0xbd02('0x28')](_0x26ae17);return _0x93eb4b[_0xbd02('0x2e')](_0xbd02('0x2f'),_0x30c0ae+'-'+_0x57ba91+'/'+_0xa81c04)[_0xbd02('0x30')](_0xb39753);}return null;};}function patchUpdates(_0x558328){return function(_0x40cdaf){try{jsonpatch[_0xbd02('0x31')](_0x40cdaf,_0x558328,!![]);}catch(_0x2f568){return BPromise[_0xbd02('0x32')](_0x2f568);}return _0x40cdaf[_0xbd02('0x33')]();};}function saveUpdates(_0x3d2af6,_0x43eff8){return function(_0x26913f){if(_0x26913f){return _0x26913f['update'](_0x3d2af6)[_0xbd02('0x34')](function(_0xb2f3c5){return _0xb2f3c5;});}return null;};}function removeEntity(_0x463404,_0x267050){return function(_0x1e2ac0){if(_0x1e2ac0){return _0x1e2ac0['destroy']()['then'](function(){var _0x580884=_0x1e2ac0[_0xbd02('0x35')]({'plain':!![]});var _0x4a7827=_0xbd02('0x36');return db[_0xbd02('0x37')][_0xbd02('0x38')]({'where':{'type':_0x4a7827,'resourceId':_0x580884['id']}})[_0xbd02('0x34')](function(){return _0x1e2ac0;});})['then'](function(){_0x463404[_0xbd02('0x28')](0xcc)[_0xbd02('0x29')]();});}};}function handleEntityNotFound(_0x3ca649,_0x1df6a2){return function(_0x1feb85){if(!_0x1feb85){_0x3ca649[_0xbd02('0x27')](0x194);}return _0x1feb85;};}function handleError(_0xdef9ef,_0x4bf2d3){_0x4bf2d3=_0x4bf2d3||0x1f4;return function(_0x40f3ff){logger[_0xbd02('0x23')](_0x40f3ff[_0xbd02('0x39')]);if(_0x40f3ff[_0xbd02('0x3a')]){delete _0x40f3ff[_0xbd02('0x3a')];}_0xdef9ef[_0xbd02('0x28')](_0x4bf2d3)[_0xbd02('0x3b')](_0x40f3ff);};}exports[_0xbd02('0x3c')]=function(_0x1f76a6,_0x3ea3b7){var _0x2b9b95={'include':[{'model':db['Pause'],'as':_0xbd02('0x3d')}]},_0x36a451={},_0x167966={'count':0x0,'rows':[]};var _0x3254ab=_[_0xbd02('0x3e')](db['SmsAccount'][_0xbd02('0x3f')],function(_0x1ceeea){return{'name':_0x1ceeea[_0xbd02('0x40')],'type':_0x1ceeea[_0xbd02('0x41')][_0xbd02('0x42')]};});_0x36a451[_0xbd02('0x43')]=_[_0xbd02('0x3e')](_0x3254ab,'name');_0x36a451[_0xbd02('0x44')]=_[_0xbd02('0x45')](_0x1f76a6[_0xbd02('0x44')]);_0x36a451[_0xbd02('0x46')]=_['intersection'](_0x36a451['model'],_0x36a451['query']);_0x2b9b95[_0xbd02('0x47')]=_[_0xbd02('0x48')](_0x36a451[_0xbd02('0x43')],qs[_0xbd02('0x49')](_0x1f76a6[_0xbd02('0x44')][_0xbd02('0x49')]));_0x2b9b95[_0xbd02('0x47')]=_0x2b9b95[_0xbd02('0x47')][_0xbd02('0x4a')]?_0x2b9b95['attributes']:_0x36a451[_0xbd02('0x43')];if(!_0x1f76a6[_0xbd02('0x44')][_0xbd02('0x4b')](_0xbd02('0x4c'))){_0x2b9b95['limit']=qs['limit'](_0x1f76a6['query']['limit']);_0x2b9b95[_0xbd02('0x2a')]=qs['offset'](_0x1f76a6[_0xbd02('0x44')][_0xbd02('0x2a')]);}_0x2b9b95[_0xbd02('0x4d')]=qs[_0xbd02('0x4e')](_0x1f76a6[_0xbd02('0x44')][_0xbd02('0x4e')]);_0x2b9b95[_0xbd02('0x4f')]=qs[_0xbd02('0x46')](_[_0xbd02('0x50')](_0x1f76a6[_0xbd02('0x44')],_0x36a451[_0xbd02('0x46')]),_0x3254ab);if(_0x1f76a6[_0xbd02('0x44')]['filter']){_0x2b9b95[_0xbd02('0x4f')]=_[_0xbd02('0x51')](_0x2b9b95[_0xbd02('0x4f')],{'$or':_[_0xbd02('0x3e')](_0x3254ab,function(_0x3b2b50){if(_0x3b2b50[_0xbd02('0x41')]!==_0xbd02('0x52')){var _0x38401c={};_0x38401c[_0x3b2b50['name']]={'$like':'%'+_0x1f76a6[_0xbd02('0x44')][_0xbd02('0x53')]+'%'};return _0x38401c;}})});}_0x2b9b95=_[_0xbd02('0x51')]({},_0x2b9b95,_0x1f76a6[_0xbd02('0x54')]);var _0x53165b={'where':_0x2b9b95[_0xbd02('0x4f')]};return db[_0xbd02('0x55')][_0xbd02('0x2c')](_0x53165b)['then'](function(_0x56915e){_0x167966[_0xbd02('0x2c')]=_0x56915e;if(_0x1f76a6[_0xbd02('0x44')]['includeAll']){_0x2b9b95[_0xbd02('0x56')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x2b9b95);})[_0xbd02('0x34')](function(_0x2f0244){_0x167966[_0xbd02('0x57')]=_0x2f0244;return _0x167966;})[_0xbd02('0x34')](respondWithFilteredResult(_0x3ea3b7,_0x2b9b95))[_0xbd02('0x58')](handleError(_0x3ea3b7,null));};exports[_0xbd02('0x59')]=function(_0x5295d3,_0x48582){var _0x2ee126={'raw':![],'where':{'id':_0x5295d3[_0xbd02('0x5a')]['id']},'include':[{'model':db[_0xbd02('0x5b')],'as':_0xbd02('0x3d')}]},_0x2fff8d={};_0x2fff8d['model']=_[_0xbd02('0x45')](db['SmsAccount'][_0xbd02('0x3f')]);_0x2fff8d[_0xbd02('0x44')]=_[_0xbd02('0x45')](_0x5295d3['query']);_0x2fff8d['filters']=_[_0xbd02('0x48')](_0x2fff8d['model'],_0x2fff8d[_0xbd02('0x44')]);_0x2ee126['attributes']=_[_0xbd02('0x48')](_0x2fff8d[_0xbd02('0x43')],qs[_0xbd02('0x49')](_0x5295d3[_0xbd02('0x44')][_0xbd02('0x49')]));_0x2ee126[_0xbd02('0x47')]=_0x2ee126['attributes'][_0xbd02('0x4a')]?_0x2ee126[_0xbd02('0x47')]:_0x2fff8d['model'];if(_0x5295d3[_0xbd02('0x44')][_0xbd02('0x5c')]){_0x2ee126['include']=[{'all':!![]}];}_0x2ee126=_[_0xbd02('0x51')]({},_0x2ee126,_0x5295d3[_0xbd02('0x54')]);return db[_0xbd02('0x55')][_0xbd02('0x5d')](_0x2ee126)['then'](handleEntityNotFound(_0x48582,null))[_0xbd02('0x34')](respondWithResult(_0x48582,null))[_0xbd02('0x58')](handleError(_0x48582,null));};exports[_0xbd02('0x5e')]=function(_0x16c2d6,_0x36677e){return db[_0xbd02('0x55')][_0xbd02('0x5e')](_0x16c2d6[_0xbd02('0x5f')],{})[_0xbd02('0x34')](function(_0x3c1418){var _0x5e9566=_0x16c2d6[_0xbd02('0x60')]['get']({'plain':!![]});if(!_0x5e9566)throw new Error(_0xbd02('0x61'));if(_0x5e9566[_0xbd02('0x62')]===_0xbd02('0x60')){var _0x1cc3a9=_0x3c1418[_0xbd02('0x35')]({'plain':!![]});var _0x53f186='SmsAccounts';return db['UserProfileSection'][_0xbd02('0x5d')]({'where':{'name':_0x53f186,'userProfileId':_0x5e9566[_0xbd02('0x63')]},'raw':!![]})[_0xbd02('0x34')](function(_0x21707e){if(_0x21707e&&_0x21707e[_0xbd02('0x64')]===0x0){return db[_0xbd02('0x37')][_0xbd02('0x5e')]({'name':_0x1cc3a9[_0xbd02('0x3a')],'resourceId':_0x1cc3a9['id'],'type':_0x21707e[_0xbd02('0x3a')],'sectionId':_0x21707e['id']},{})[_0xbd02('0x34')](function(){return _0x3c1418;});}else{return _0x3c1418;}})['catch'](function(_0xb94957){logger['error'](_0xbd02('0x65'),_0xb94957);throw _0xb94957;});}return _0x3c1418;})['then'](respondWithResult(_0x36677e,0xc9))['catch'](handleError(_0x36677e,null));};exports[_0xbd02('0x66')]=function(_0x4b4b5a,_0x398b95){if(_0x4b4b5a['body']['id']){delete _0x4b4b5a[_0xbd02('0x5f')]['id'];}return db[_0xbd02('0x55')][_0xbd02('0x5d')]({'where':{'id':_0x4b4b5a[_0xbd02('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xbd02('0x34')](handleEntityNotFound(_0x398b95,null))[_0xbd02('0x34')](saveUpdates(_0x4b4b5a[_0xbd02('0x5f')],null))[_0xbd02('0x34')](respondWithResult(_0x398b95,null))[_0xbd02('0x58')](handleError(_0x398b95,null));};exports[_0xbd02('0x38')]=function(_0x3d8181,_0x3eeeb8){return db[_0xbd02('0x55')][_0xbd02('0x5d')]({'where':{'id':_0x3d8181[_0xbd02('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3eeeb8,null))[_0xbd02('0x34')](removeEntity(_0x3eeeb8,null))[_0xbd02('0x58')](handleError(_0x3eeeb8,null));};exports[_0xbd02('0x67')]=function(_0x4ee9f6,_0x241c8e){return db['SmsAccount'][_0xbd02('0x67')]()['then'](respondWithResult(_0x241c8e,null))[_0xbd02('0x58')](handleError(_0x241c8e,null));};exports[_0xbd02('0x68')]=function(_0x489a51,_0x5e39d2,_0x2977db){if(_0x489a51['body']['id']){delete _0x489a51['body']['id'];}return db['SmsAccount'][_0xbd02('0x5d')]({'where':{'id':_0x489a51[_0xbd02('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5e39d2,null))[_0xbd02('0x34')](function(_0x43369c){if(_0x43369c){_0x489a51[_0xbd02('0x5f')][_0xbd02('0x69')]=_0x43369c['id'];return db[_0xbd02('0x6a')]['create'](_0x489a51['body']);}})[_0xbd02('0x34')](respondWithResult(_0x5e39d2,null))[_0xbd02('0x58')](handleError(_0x5e39d2,null));};exports[_0xbd02('0x6b')]=function(_0x4227f6,_0x548ec4,_0x3fe9ee){var _0x3fc9f3={'raw':![],'where':{}};var _0x4fccb0={};var _0x2e8d83={'count':0x0,'rows':[]};return db[_0xbd02('0x55')]['findOne']({'where':{'id':_0x4227f6[_0xbd02('0x5a')]['id']}})[_0xbd02('0x34')](handleEntityNotFound(_0x548ec4,null))['then'](function(_0x2f7e1a){if(_0x2f7e1a){_0x4fccb0['model']=_[_0xbd02('0x45')](db[_0xbd02('0x6a')]['rawAttributes']);_0x4fccb0[_0xbd02('0x44')]=_['keys'](_0x4227f6[_0xbd02('0x44')]);_0x4fccb0[_0xbd02('0x46')]=_[_0xbd02('0x48')](_0x4fccb0[_0xbd02('0x43')],_0x4fccb0[_0xbd02('0x44')]);_0x3fc9f3[_0xbd02('0x47')]=_['intersection'](_0x4fccb0[_0xbd02('0x43')],qs[_0xbd02('0x49')](_0x4227f6[_0xbd02('0x44')]['fields']));_0x3fc9f3[_0xbd02('0x47')]=_0x3fc9f3[_0xbd02('0x47')][_0xbd02('0x4a')]?_0x3fc9f3['attributes']:_0x4fccb0[_0xbd02('0x43')];if(!_0x4227f6['query'][_0xbd02('0x4b')]('nolimit')){_0x3fc9f3[_0xbd02('0x2d')]=qs[_0xbd02('0x2d')](_0x4227f6[_0xbd02('0x44')][_0xbd02('0x2d')]);_0x3fc9f3['offset']=qs[_0xbd02('0x2a')](_0x4227f6['query'][_0xbd02('0x2a')]);}_0x3fc9f3[_0xbd02('0x4d')]=qs[_0xbd02('0x4e')](_0x4227f6[_0xbd02('0x44')]['sort']);_0x3fc9f3['where']=qs[_0xbd02('0x46')](_['pick'](_0x4227f6[_0xbd02('0x44')],_0x4fccb0[_0xbd02('0x46')]));_0x3fc9f3[_0xbd02('0x4f')][_0xbd02('0x69')]=_0x2f7e1a['id'];if(_0x4227f6[_0xbd02('0x44')]['filter']){_0x3fc9f3['where']=_[_0xbd02('0x51')](_0x3fc9f3[_0xbd02('0x4f')],{'$or':_[_0xbd02('0x3e')](_0x3fc9f3[_0xbd02('0x47')],function(_0xb4a17){var _0x15b501={};_0x15b501[_0xb4a17]={'$like':'%'+_0x4227f6[_0xbd02('0x44')][_0xbd02('0x53')]+'%'};return _0x15b501;})});}_0x3fc9f3=_[_0xbd02('0x51')]({},_0x3fc9f3,_0x4227f6[_0xbd02('0x54')]);return db[_0xbd02('0x6a')]['count']({'where':_0x3fc9f3[_0xbd02('0x4f')]})[_0xbd02('0x34')](function(_0x5aa378){_0x2e8d83['count']=_0x5aa378;if(_0x4227f6['query'][_0xbd02('0x5c')]){_0x3fc9f3[_0xbd02('0x56')]=[{'all':!![]}];}return db[_0xbd02('0x6a')][_0xbd02('0x6c')](_0x3fc9f3);})[_0xbd02('0x34')](function(_0x12ea6f){_0x2e8d83[_0xbd02('0x57')]=_0x12ea6f;return _0x2e8d83;});}})[_0xbd02('0x34')](respondWithFilteredResult(_0x548ec4,_0x3fc9f3))['catch'](handleError(_0x548ec4,null));};exports[_0xbd02('0x6d')]=function(_0x2c85d3,_0x51471e,_0x209abe){return db[_0xbd02('0x55')]['find']({'where':{'id':_0x2c85d3['params']['id']}})[_0xbd02('0x34')](handleEntityNotFound(_0x51471e,null))['then'](function(_0xcc5d4f){if(_0xcc5d4f){return _0xcc5d4f[_0xbd02('0x6d')](_0x2c85d3[_0xbd02('0x44')][_0xbd02('0x6e')]);}})['then'](respondWithStatusCode(_0x51471e,null))[_0xbd02('0x58')](handleError(_0x51471e,null));};exports[_0xbd02('0x6f')]=function(_0x21f3ad,_0x2ce2f8,_0x3b3349){if(_0x21f3ad[_0xbd02('0x5f')]['id']){delete _0x21f3ad[_0xbd02('0x5f')]['id'];}return db[_0xbd02('0x55')][_0xbd02('0x5d')]({'where':{'id':_0x21f3ad[_0xbd02('0x5a')]['id']}})[_0xbd02('0x34')](handleEntityNotFound(_0x2ce2f8,null))['then'](function(_0x264125){if(_0x264125){_0x21f3ad[_0xbd02('0x5f')]['SmsAccountId']=_0x264125['id'];return db['CannedAnswer'][_0xbd02('0x5e')](_0x21f3ad['body']);}})[_0xbd02('0x34')](respondWithResult(_0x2ce2f8,null))[_0xbd02('0x58')](handleError(_0x2ce2f8,null));};exports['getAnswers']=function(_0x5a72f9,_0x5157fd,_0xcdc70d){var _0x24bb79={'raw':![],'where':{}};var _0x830250={};var _0x2a877e={'count':0x0,'rows':[]};return db[_0xbd02('0x55')][_0xbd02('0x70')]({'where':{'id':_0x5a72f9['params']['id']}})['then'](handleEntityNotFound(_0x5157fd,null))[_0xbd02('0x34')](function(_0x31fb2f){if(_0x31fb2f){_0x830250[_0xbd02('0x43')]=_[_0xbd02('0x45')](db[_0xbd02('0x71')][_0xbd02('0x3f')]);_0x830250['query']=_[_0xbd02('0x45')](_0x5a72f9[_0xbd02('0x44')]);_0x830250[_0xbd02('0x46')]=_[_0xbd02('0x48')](_0x830250[_0xbd02('0x43')],_0x830250['query']);_0x24bb79[_0xbd02('0x47')]=_[_0xbd02('0x48')](_0x830250['model'],qs[_0xbd02('0x49')](_0x5a72f9[_0xbd02('0x44')]['fields']));_0x24bb79[_0xbd02('0x47')]=_0x24bb79[_0xbd02('0x47')]['length']?_0x24bb79[_0xbd02('0x47')]:_0x830250['model'];if(!_0x5a72f9[_0xbd02('0x44')]['hasOwnProperty'](_0xbd02('0x4c'))){_0x24bb79[_0xbd02('0x2d')]=qs['limit'](_0x5a72f9[_0xbd02('0x44')][_0xbd02('0x2d')]);_0x24bb79['offset']=qs[_0xbd02('0x2a')](_0x5a72f9[_0xbd02('0x44')][_0xbd02('0x2a')]);}_0x24bb79[_0xbd02('0x4d')]=qs['sort'](_0x5a72f9['query'][_0xbd02('0x4e')]);_0x24bb79[_0xbd02('0x4f')]=qs[_0xbd02('0x46')](_[_0xbd02('0x50')](_0x5a72f9[_0xbd02('0x44')],_0x830250[_0xbd02('0x46')]));_0x24bb79[_0xbd02('0x4f')][_0xbd02('0x69')]=_0x31fb2f['id'];if(_0x5a72f9[_0xbd02('0x44')][_0xbd02('0x53')]){_0x24bb79['where']=_[_0xbd02('0x51')](_0x24bb79[_0xbd02('0x4f')],{'$or':_['map'](_0x24bb79[_0xbd02('0x47')],function(_0xb2bfab){var _0x400d72={};_0x400d72[_0xb2bfab]={'$like':'%'+_0x5a72f9[_0xbd02('0x44')][_0xbd02('0x53')]+'%'};return _0x400d72;})});}_0x24bb79=_[_0xbd02('0x51')]({},_0x24bb79,_0x5a72f9[_0xbd02('0x54')]);return db[_0xbd02('0x71')]['count']({'where':_0x24bb79['where']})[_0xbd02('0x34')](function(_0x194f24){_0x2a877e['count']=_0x194f24;if(_0x5a72f9[_0xbd02('0x44')]['includeAll']){_0x24bb79[_0xbd02('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0xbd02('0x6c')](_0x24bb79);})[_0xbd02('0x34')](function(_0x1ec363){_0x2a877e['rows']=_0x1ec363;return _0x2a877e;});}})['then'](respondWithFilteredResult(_0x5157fd,_0x24bb79))[_0xbd02('0x58')](handleError(_0x5157fd,null));};exports['removeAnswers']=function(_0x466981,_0x1f70f8,_0xac842f){return db[_0xbd02('0x55')]['find']({'where':{'id':_0x466981[_0xbd02('0x5a')]['id']}})[_0xbd02('0x34')](handleEntityNotFound(_0x1f70f8,null))[_0xbd02('0x34')](function(_0x267ff3){if(_0x267ff3){return _0x267ff3['removeAnswers'](_0x466981[_0xbd02('0x44')]['ids']);}})[_0xbd02('0x34')](respondWithStatusCode(_0x1f70f8,null))[_0xbd02('0x58')](handleError(_0x1f70f8,null));};exports[_0xbd02('0x72')]=function(_0x55613d,_0x33f697,_0x1ea5e1){var _0x5ce0f9={'channel':'sms'};var _0x33ac37=[];var _0x1d6c6a=[];var _0x4a29af={};return db[_0xbd02('0x55')][_0xbd02('0x5d')]({'where':{'id':_0x55613d[_0xbd02('0x5a')]['id']},'include':[{'model':db[_0xbd02('0x73')],'as':_0xbd02('0x74')}]})['then'](handleEntityNotFound(_0x33f697,null))[_0xbd02('0x34')](function(_0x4688fa){_0x5ce0f9['account']=_0x4688fa;_0x5ce0f9[_0xbd02('0x75')]=_[_0xbd02('0x76')](_0x4688fa[_0xbd02('0x74')],[_0xbd02('0x77')],['asc']);if(_0x5ce0f9[_0xbd02('0x78')]['Applications']){delete _0x5ce0f9[_0xbd02('0x78')][_0xbd02('0x74')];}return db[_0xbd02('0x79')][_0xbd02('0x67')]();})['then'](function(_0x460b67){if(!_0x460b67){throw new db[(_0xbd02('0x7a'))][(_0xbd02('0x7b'))](_0xbd02('0x7c'));}_0x33ac37=_[_0xbd02('0x7d')](_[_0xbd02('0x45')](_0x460b67),[_0xbd02('0x7e'),_0xbd02('0x7f')]);_0x1d6c6a=_[_0xbd02('0x7d')](_[_0xbd02('0x45')](_0x460b67),[_0xbd02('0x7e'),'updatedAt',_0xbd02('0x80'),_0xbd02('0x81')]);_0x5ce0f9[_0xbd02('0x5f')]={'mapKey':_0xbd02('0x82')};if(_0x5ce0f9[_0xbd02('0x78')][_0xbd02('0x41')]){switch(_0x5ce0f9[_0xbd02('0x78')][_0xbd02('0x41')]){case _0xbd02('0x83'):_0x5ce0f9['body'][_0xbd02('0x84')]=_0x55613d[_0xbd02('0x5f')]['From'];_0x5ce0f9['body']['body']=_0x55613d[_0xbd02('0x5f')][_0xbd02('0x85')];_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x86')]=_0x55613d[_0xbd02('0x5f')][_0xbd02('0x87')];break;case _0xbd02('0x88'):_0x5ce0f9['body'][_0xbd02('0x84')]='+'+_0x55613d[_0xbd02('0x5f')]['sender'];_0x5ce0f9[_0xbd02('0x5f')]['body']=_0x55613d[_0xbd02('0x5f')]['text'];break;case _0xbd02('0x89'):_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x84')]=_0x55613d[_0xbd02('0x5f')][_0xbd02('0x84')];_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x5f')]=_0x55613d['body'][_0xbd02('0x26')];break;case _0xbd02('0x8a'):_0x5ce0f9['body'][_0xbd02('0x84')]=_0x55613d[_0xbd02('0x5f')][_0xbd02('0x84')];_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x5f')]=_0x55613d[_0xbd02('0x5f')][_0xbd02('0x5f')];_0x5ce0f9[_0xbd02('0x5f')]['messageId']=_0x55613d[_0xbd02('0x5f')][_0xbd02('0x8b')];break;case'plivo':_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x84')]=_0x55613d['body'][_0xbd02('0x8c')];_0x5ce0f9[_0xbd02('0x5f')]['body']=_0x55613d['body'][_0xbd02('0x8d')];_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x86')]=_0x55613d[_0xbd02('0x5f')][_0xbd02('0x8e')];break;case _0xbd02('0x8f'):_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x84')]='+'+_0x55613d[_0xbd02('0x5f')]['results'][0x0]['from'];_0x5ce0f9[_0xbd02('0x5f')]['body']=_0x55613d[_0xbd02('0x5f')][_0xbd02('0x90')][0x0]['text'];_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x86')]=_0x55613d[_0xbd02('0x5f')]['results'][0x0][_0xbd02('0x86')];break;case _0xbd02('0x91'):_0x5ce0f9['body']['from']=_0x55613d[_0xbd02('0x5f')][_0xbd02('0x92')];_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x5f')]=_0x55613d[_0xbd02('0x5f')]['segmentedMessage']['message'];break;case _0xbd02('0x93'):_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x84')]=_0x55613d['body'][_0xbd02('0x94')];_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x5f')]=_0x55613d[_0xbd02('0x5f')]['text'];_0x5ce0f9['body'][_0xbd02('0x86')]=_0x55613d['body'][_0xbd02('0x95')];break;case'bandwidth':_0x5ce0f9['body'][_0xbd02('0x86')]=_0x55613d['body'][0x0]['message']['id'];_0x5ce0f9[_0xbd02('0x5f')]['from']=_0x55613d[_0xbd02('0x5f')][0x0][_0xbd02('0x26')][_0xbd02('0x84')];_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x5f')]=_0x55613d[_0xbd02('0x5f')][0x0][_0xbd02('0x26')][_0xbd02('0x96')];break;case _0xbd02('0x97'):_0x5ce0f9['body'][_0xbd02('0x84')]=_0x55613d[_0xbd02('0x5f')]['from'];_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x5f')]=_0x55613d[_0xbd02('0x5f')][_0xbd02('0x26')];_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x86')]=_0x55613d['body'][_0xbd02('0x98')];break;}}if(_0x5ce0f9[_0xbd02('0x5f')]['id']){delete _0x5ce0f9[_0xbd02('0x5f')]['id'];}if(_[_0xbd02('0x99')](_0x5ce0f9[_0xbd02('0x5f')]['from'])){throw new db[(_0xbd02('0x7a'))]['ValidationError'](_0xbd02('0x9a'));}if(_['isNil'](_0x5ce0f9[_0xbd02('0x5f')]['body'])||_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x5f')]===''){throw new db[(_0xbd02('0x7a'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbd02('0x99')](_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x9b')])){throw new db[(_0xbd02('0x7a'))][(_0xbd02('0x7b'))](_0xbd02('0x9c')+_0x1d6c6a);}if(!_[_0xbd02('0x9d')](_0x1d6c6a,_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x9b')])){throw new db[(_0xbd02('0x7a'))]['ValidationError'](_0xbd02('0x9e')+_0x1d6c6a);}_0x4a29af[_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x9b')]]=_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x84')];return db['CmList']['find']({'where':{'id':_0x5ce0f9['account'][_0xbd02('0x81')]},'include':[{'model':db[_0xbd02('0x79')],'as':_0xbd02('0x9f'),'where':_0x4a29af,'limit':0x1,'order':[['updatedAt',_0xbd02('0xa0')]]}]});})[_0xbd02('0x34')](handleEntityNotFound(_0x33f697,null))[_0xbd02('0x34')](function(_0x377bf1){if(_0x377bf1){_0x5ce0f9[_0xbd02('0xa1')]=_['omit'](_0x377bf1,[_0xbd02('0x9f')]);if(_0x377bf1[_0xbd02('0x9f')]['length']){return _0x377bf1[_0xbd02('0x9f')][0x0];}var _0x1045d2=_[_0xbd02('0x18')](_0x5ce0f9[_0xbd02('0x5f')],{'firstName':_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x84')],'ListId':_0x377bf1['id']});_0x1045d2[_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x9b')]]=_0x5ce0f9['body'][_0xbd02('0x84')];return db[_0xbd02('0x79')][_0xbd02('0x5e')](_0x1045d2,{'fields':_0x33ac37,'raw':!![]});}})['then'](handleEntityNotFound(_0x33f697,null))[_0xbd02('0x34')](function(_0x9c1d02){if(_0x9c1d02){_0x5ce0f9[_0xbd02('0xa2')]=_0x9c1d02;var _0x447c4b={'ContactId':_0x9c1d02['id'],'phone':_0x5ce0f9['body'][_0xbd02('0x84')],'SmsAccountId':_0x55613d['params']['id']};var _0x46b1d7={'ContactId':_0x9c1d02['id'],'SmsAccountId':_0x55613d[_0xbd02('0x5a')]['id'],'closed':![]};return db[_0xbd02('0xa3')]['find']({'where':_0x46b1d7})[_0xbd02('0x34')](function(_0x106a3d){if(_0x106a3d){return[_0x106a3d,![]];}return db[_0xbd02('0xa3')][_0xbd02('0x5e')](_0x447c4b)[_0xbd02('0x34')](function(_0x4af978){return[_0x4af978,!![]];});});}})['spread'](function(_0x11f5a6,_0x2d3bba){_0x5ce0f9[_0xbd02('0xa4')]=_0x11f5a6[_0xbd02('0x35')]({'plain':!![]});_0x5ce0f9[_0xbd02('0xa4')][_0xbd02('0xa5')]=![];if(_0x2d3bba){if(_0x5ce0f9[_0xbd02('0x78')]['autoclose']){_0x5ce0f9['applications'][_0xbd02('0xa6')]({'id':0x0,'priority':_0x5ce0f9[_0xbd02('0x75')][_0xbd02('0x4a')]+0x1,'app':'close','appdata':_0xbd02('0xa7'),'interval':_0xbd02('0xa8')});}_0x5ce0f9['interaction']['created']=!![];}return db[_0xbd02('0xa9')][_0xbd02('0x5e')]({'phone':_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x84')],'messageId':_0x5ce0f9[_0xbd02('0x5f')]['messageId'],'body':_0x5ce0f9[_0xbd02('0x5f')][_0xbd02('0x5f')],'SmsAccountId':_0x55613d[_0xbd02('0x5a')]['id'],'SmsInteractionId':_0x11f5a6['id'],'direction':'in','ContactId':_0x11f5a6['ContactId'],'AttachmentId':_0x5ce0f9[_0xbd02('0x5f')]['AttachmentId']});})[_0xbd02('0x34')](function(_0x1170ea){_0x5ce0f9['message']=_0x1170ea;if(_0x5ce0f9['interaction'][_0xbd02('0xaa')]){return db[_0xbd02('0xab')]['find']({'attributes':['id',_0xbd02('0x3a')],'where':{'id':_0x5ce0f9[_0xbd02('0xa4')][_0xbd02('0xaa')]}})['then'](function(_0x433628){if(_0x433628){_0x5ce0f9['applications'][_0xbd02('0xac')]({'id':0x0,'priority':0x0,'app':_0xbd02('0xad'),'appdata':_0x433628[_0xbd02('0x3a')]+','+(_0x5ce0f9[_0xbd02('0x78')][_0xbd02('0xae')]||0xa),'interval':_0xbd02('0xa8')});}return respondWithRpcPromise('Start',_0xbd02('0xaf'),_0x5ce0f9);});}return respondWithRpcPromise('Start',_0xbd02('0xaf'),_0x5ce0f9);})[_0xbd02('0x34')](function(_0x2acebc){if(_0x2acebc){var _0x372f0a=0xc8;var _0x10780d='receiveMessage';logger[_0xbd02('0x20')](_0xbd02('0x22'),_0x10780d,_0x372f0a,_0xbd02('0xb0'));logger[_0xbd02('0xb1')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x10780d,_0x372f0a,_0xbd02('0xb0'),JSON[_0xbd02('0xb2')](_0x2acebc));if(_0x5ce0f9[_0xbd02('0x78')][_0xbd02('0x41')]===_0xbd02('0x83')){return _0x33f697[_0xbd02('0x28')](_0x372f0a)[_0xbd02('0x2e')](_0xbd02('0xb3'),_0xbd02('0xb4'))[_0xbd02('0x3b')]('\x0a');}else{return _0x33f697['status'](_0x372f0a)[_0xbd02('0x30')](_0x2acebc);}}})[_0xbd02('0x58')](handleError(_0x33f697,null));};exports[_0xbd02('0xb5')]=function(_0xdf2ee9,_0xdf79cd,_0x3d0af1){return db['SmsAccount'][_0xbd02('0x70')]({'where':{'id':_0xdf2ee9[_0xbd02('0x5a')]['id']}})['then'](handleEntityNotFound(_0xdf79cd,null))['then'](function(_0x254586){if(_0x254586){return db[_0xbd02('0xb6')][_0xbd02('0xb7')](function(_0x6a6a86){return db[_0xbd02('0x73')][_0xbd02('0x38')]({'where':{'SmsAccountId':_0xdf2ee9[_0xbd02('0x5a')]['id']},'transaction':_0x6a6a86})[_0xbd02('0x34')](function(_0x565668){var _0x38b2bb=_[_0xbd02('0x3e')](_0xdf2ee9[_0xbd02('0x5f')],function(_0x3b05b5){_0x3b05b5['SmsAccountId']=_0xdf2ee9['params']['id'];return _0x3b05b5;});return db['SmsApplication'][_0xbd02('0xb8')](_0x38b2bb,{'transaction':_0x6a6a86});});})['then'](function(){return db[_0xbd02('0x73')][_0xbd02('0xb9')]({'where':{'SmsAccountId':_0xdf2ee9['params']['id']},'order':_0xbd02('0x77')});});}})[_0xbd02('0x34')](respondWithResult(_0xdf79cd,null))[_0xbd02('0x58')](handleError(_0xdf79cd,null));};exports[_0xbd02('0xba')]=function(_0xed060f,_0x11c1e1,_0x4cfe14){var _0x68e18f={};var _0x3053be={};var _0x129d5f;var _0x36d7d7;return db[_0xbd02('0x55')]['findOne']({'where':{'id':_0xed060f[_0xbd02('0x5a')]['id']}})['then'](handleEntityNotFound(_0x11c1e1,null))[_0xbd02('0x34')](function(_0x43b091){if(_0x43b091){_0x129d5f=_0x43b091;_0x3053be[_0xbd02('0x43')]=_['keys'](db[_0xbd02('0x73')]['rawAttributes']);_0x3053be[_0xbd02('0x44')]=_['keys'](_0xed060f[_0xbd02('0x44')]);_0x3053be[_0xbd02('0x46')]=_[_0xbd02('0x48')](_0x3053be['model'],_0x3053be[_0xbd02('0x44')]);_0x68e18f[_0xbd02('0x47')]=_[_0xbd02('0x48')](_0x3053be[_0xbd02('0x43')],qs[_0xbd02('0x49')](_0xed060f[_0xbd02('0x44')][_0xbd02('0x49')]));_0x68e18f[_0xbd02('0x47')]=_0x68e18f[_0xbd02('0x47')]['length']?_0x68e18f[_0xbd02('0x47')]:_0x3053be[_0xbd02('0x43')];_0x68e18f['order']=qs[_0xbd02('0x4e')](_0xed060f[_0xbd02('0x44')][_0xbd02('0x4e')]);_0x68e18f['where']=qs[_0xbd02('0x46')](_[_0xbd02('0x50')](_0xed060f[_0xbd02('0x44')],_0x3053be[_0xbd02('0x46')]));if(_0xed060f[_0xbd02('0x44')][_0xbd02('0x53')]){_0x68e18f['where']=_[_0xbd02('0x51')](_0x68e18f['where'],{'$or':_[_0xbd02('0x3e')](_0x68e18f[_0xbd02('0x47')],function(_0xe96f81){var _0x277565={};_0x277565[_0xe96f81]={'$like':'%'+_0xed060f[_0xbd02('0x44')][_0xbd02('0x53')]+'%'};return _0x277565;})});}_0x68e18f=_[_0xbd02('0x51')]({},_0x68e18f,_0xed060f[_0xbd02('0x54')]);return _0x129d5f['getApplications'](_0x68e18f);}})[_0xbd02('0x34')](function(_0x34e7a4){if(_0x34e7a4){_0x36d7d7=_0x34e7a4['length'];if(!_0xed060f[_0xbd02('0x44')][_0xbd02('0x4b')]('nolimit')){_0x68e18f[_0xbd02('0x2d')]=qs[_0xbd02('0x2d')](_0xed060f[_0xbd02('0x44')][_0xbd02('0x2d')]);_0x68e18f[_0xbd02('0x2a')]=qs[_0xbd02('0x2a')](_0xed060f[_0xbd02('0x44')][_0xbd02('0x2a')]);}return _0x129d5f[_0xbd02('0xba')](_0x68e18f);}})[_0xbd02('0x34')](function(_0x49f2a9){if(_0x49f2a9){return _0x49f2a9?{'count':_0x36d7d7,'rows':_0x49f2a9}:null;}})[_0xbd02('0x34')](respondWithResult(_0x11c1e1,null))[_0xbd02('0x58')](handleError(_0x11c1e1,null));};exports[_0xbd02('0xbb')]=function(_0x379386,_0x31e201,_0x49c23d){var _0x818331={'raw':![],'where':{}};var _0x3b8bd1={};var _0x29b51e={'count':0x0,'rows':[]};return db[_0xbd02('0x55')][_0xbd02('0x70')]({'where':{'id':_0x379386['params']['id']}})[_0xbd02('0x34')](handleEntityNotFound(_0x31e201,null))[_0xbd02('0x34')](function(_0x3646d1){if(_0x3646d1){_0x3b8bd1[_0xbd02('0x43')]=_[_0xbd02('0x45')](db[_0xbd02('0xa3')][_0xbd02('0x3f')]);_0x3b8bd1[_0xbd02('0x44')]=_[_0xbd02('0x45')](_0x379386['query']);_0x3b8bd1['filters']=_[_0xbd02('0x48')](_0x3b8bd1[_0xbd02('0x43')],_0x3b8bd1[_0xbd02('0x44')]);_0x818331[_0xbd02('0x47')]=_['intersection'](_0x3b8bd1[_0xbd02('0x43')],qs[_0xbd02('0x49')](_0x379386['query'][_0xbd02('0x49')]));_0x818331[_0xbd02('0x47')]=_0x818331[_0xbd02('0x47')][_0xbd02('0x4a')]?_0x818331[_0xbd02('0x47')]:_0x3b8bd1['model'];if(!_0x379386['query'][_0xbd02('0x4b')](_0xbd02('0x4c'))){_0x818331[_0xbd02('0x2d')]=qs['limit'](_0x379386[_0xbd02('0x44')][_0xbd02('0x2d')]);_0x818331[_0xbd02('0x2a')]=qs[_0xbd02('0x2a')](_0x379386['query'][_0xbd02('0x2a')]);}_0x818331['order']=qs['sort'](_0x379386['query']['sort']);_0x818331[_0xbd02('0x4f')]=qs[_0xbd02('0x46')](_[_0xbd02('0x50')](_0x379386[_0xbd02('0x44')],_0x3b8bd1[_0xbd02('0x46')]));_0x818331[_0xbd02('0x4f')][_0xbd02('0x69')]=_0x3646d1['id'];if(_0x379386['query']['filter']){_0x818331[_0xbd02('0x4f')]=_['merge'](_0x818331[_0xbd02('0x4f')],{'$or':_[_0xbd02('0x3e')](_0x818331[_0xbd02('0x47')],function(_0xa67f11){var _0x452257={};_0x452257[_0xa67f11]={'$like':'%'+_0x379386[_0xbd02('0x44')]['filter']+'%'};return _0x452257;})});}_0x818331=_[_0xbd02('0x51')]({},_0x818331,_0x379386[_0xbd02('0x54')]);return db[_0xbd02('0xa3')][_0xbd02('0x2c')]({'where':_0x818331['where']})[_0xbd02('0x34')](function(_0x54de59){_0x29b51e[_0xbd02('0x2c')]=_0x54de59;if(_0x379386[_0xbd02('0x44')][_0xbd02('0x5c')]){_0x818331[_0xbd02('0x56')]=[{'model':db[_0xbd02('0x79')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xbd02('0x3a'),_0xbd02('0xbc'),'internal'],'required':![]},{'model':db[_0xbd02('0xbd')],'as':_0xbd02('0xbe'),'attributes':['id',_0xbd02('0x3a'),_0xbd02('0xbf')],'where':_0x379386[_0xbd02('0x44')][_0xbd02('0xc0')]?{'id':_0x379386['query'][_0xbd02('0xc0')]}:undefined,'required':_0x379386[_0xbd02('0x44')][_0xbd02('0xc0')]?!![]:![]}];}return db[_0xbd02('0xa3')][_0xbd02('0x6c')](_0x818331);})['then'](function(_0x4ff2a8){_0x29b51e[_0xbd02('0x57')]=_0x4ff2a8;return _0x29b51e;});}})['then'](respondWithFilteredResult(_0x31e201,_0x818331))[_0xbd02('0x58')](handleError(_0x31e201,null));};exports[_0xbd02('0x3b')]=function(_0x54726f,_0x9a09f2,_0x16a1c9){var _0x22cab8,_0x50e0c2,_0x39c177;if(_[_0xbd02('0x99')](_0x54726f[_0xbd02('0x5f')][_0xbd02('0x5f')])||_0x54726f[_0xbd02('0x5f')][_0xbd02('0x5f')]===''){throw new db[(_0xbd02('0x7a'))]['ValidationError'](_0xbd02('0xc1'));}if(_[_0xbd02('0x99')](_0x54726f['body']['to'])){throw new db['Sequelize']['ValidationError'](_0xbd02('0xc2'));}_0x22cab8=_0x54726f[_0xbd02('0x5f')]['to'];return db[_0xbd02('0x55')][_0xbd02('0x5d')]({'where':{'id':_0x54726f[_0xbd02('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0xbd02('0xc3'),'include':[{'model':db[_0xbd02('0x79')],'as':_0xbd02('0x9f'),'where':{'mobile':_0x22cab8},'limit':0x1,'order':[[_0xbd02('0x7f'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x9a09f2,null))[_0xbd02('0x34')](function(_0x184c6f){if(_0x184c6f&&_0x184c6f[_0xbd02('0xc3')]){_0x50e0c2=_0x184c6f[_0xbd02('0x35')]({'plain':!![]});if(_0x50e0c2[_0xbd02('0xc3')]&&_0x50e0c2[_0xbd02('0xc3')][_0xbd02('0x9f')][_0xbd02('0x4a')]){return _0x50e0c2['List'][_0xbd02('0x9f')][0x0];}return db[_0xbd02('0x79')][_0xbd02('0x5e')](_[_0xbd02('0x18')](_0x54726f['body'],{'firstName':_0x22cab8,'mobile':_0x22cab8,'phone':_0x22cab8,'ListId':_0x50e0c2['ListId']}));}})['then'](handleEntityNotFound(_0x9a09f2,null))[_0xbd02('0x34')](function(_0x5c457c){if(_0x5c457c){_0x39c177=_0x5c457c;return db[_0xbd02('0xa3')][_0xbd02('0x5d')]({'where':{'ContactId':_0x39c177['id'],'closed':![],'SmsAccountId':_0x50e0c2['id']}})[_0xbd02('0x34')](function(_0x253899){if(_0x253899){return[_0x253899,![]];}return db[_0xbd02('0xa3')][_0xbd02('0x5e')]({'UserId':_0x54726f[_0xbd02('0x60')]['id'],'ContactId':_0x39c177['id'],'SmsAccountId':_0x50e0c2['id'],'phone':_0x22cab8,'firstMsgDirection':_0xbd02('0xc4'),'Messages':[_[_0xbd02('0x51')](_0x54726f[_0xbd02('0x5f')],{'read':![],'body':_0x54726f[_0xbd02('0x5f')]['body'],'phone':_0x22cab8,'SmsAccountId':_0x50e0c2['id'],'UserId':_0x54726f[_0xbd02('0x60')]['id'],'ContactId':_0x39c177['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xbd02('0xc5')}]})['then'](function(_0x2a1784){return[_0x2a1784,!![]];});});}})[_0xbd02('0xc6')](function(_0x5762b9,_0x579c5c){if(_0x579c5c){return _0x5762b9;}return db[_0xbd02('0xa9')][_0xbd02('0x5e')](_[_0xbd02('0x51')](_0x54726f[_0xbd02('0x5f')],{'read':![],'body':_0x54726f[_0xbd02('0x5f')][_0xbd02('0x5f')],'phone':_0x22cab8,'SmsAccountId':_0x50e0c2['id'],'SmsInteractionId':_0x5762b9['id'],'UserId':_0x54726f['user']['id'],'ContactId':_0x39c177['id']}))[_0xbd02('0x34')](function(_0x487a11){_0x5762b9[_0xbd02('0xc7')]['Messages']=[];_0x5762b9[_0xbd02('0xc7')][_0xbd02('0xc5')][_0xbd02('0xa6')](_0x487a11[_0xbd02('0xc7')]);return _0x5762b9;});})[_0xbd02('0x34')](respondWithResult(_0x9a09f2,null))['catch'](handleError(_0x9a09f2,null));};exports[_0xbd02('0x28')]=function(_0x17a12c,_0x33b124,_0x187acc){if(_0x17a12c[_0xbd02('0x5f')]['id']){delete _0x17a12c[_0xbd02('0x5f')]['id'];}var _0x5a2d04,_0x1e5580,_0x47966d;return db[_0xbd02('0x55')][_0xbd02('0x5d')]({'where':{'id':_0x17a12c[_0xbd02('0x5a')]['id']}})['then'](handleEntityNotFound(_0x33b124,null))[_0xbd02('0x34')](function(_0x311c1c){if(_0x311c1c){_0x47966d=_0x311c1c;logger[_0xbd02('0xb1')](_0xbd02('0x22'),_0xbd02('0x28'),_0xbd02('0xc8'),_0x311c1c[_0xbd02('0x41')],util[_0xbd02('0xc9')](_0x17a12c[_0xbd02('0x5f')],{'showHidden':![],'depth':null}));switch(_0x311c1c['type']){case'skebby':if(_0x17a12c['body']['skebby_dispatch_id']&&_0x17a12c[_0xbd02('0x5f')][_0xbd02('0x28')]){_0x1e5580=_0x17a12c[_0xbd02('0x5f')][_0xbd02('0x28')];return db[_0xbd02('0xa9')][_0xbd02('0x5d')]({'where':{'messageId':_0x17a12c[_0xbd02('0x5f')][_0xbd02('0xca')]}});}break;case _0xbd02('0x89'):if(_0x17a12c[_0xbd02('0x5f')][_0xbd02('0xcb')]&&_0x17a12c[_0xbd02('0x5f')][_0xbd02('0xcc')]){_0x1e5580=_0x17a12c['body']['statusInt'];return db[_0xbd02('0xa9')]['find']({'where':{'messageId':_0x17a12c[_0xbd02('0x5f')][_0xbd02('0xcb')]}});}break;case _0xbd02('0x8a'):if(_0x17a12c[_0xbd02('0x5f')]['message_id']&&_0x17a12c['body']['status_code']){_0x1e5580=_0x17a12c[_0xbd02('0x5f')][_0xbd02('0xcd')];return db[_0xbd02('0xa9')]['find']({'where':{'messageId':_0x17a12c[_0xbd02('0x5f')][_0xbd02('0x8b')]}});}break;case _0xbd02('0x8f'):var _0x5cebce=_0x17a12c[_0xbd02('0x5f')][_0xbd02('0x90')][0x0];if(_0x5cebce[_0xbd02('0x86')]&&_0x5cebce[_0xbd02('0x28')][_0xbd02('0xce')]===_0xbd02('0xcf')){_0x1e5580=_0x5cebce[_0xbd02('0x28')][_0xbd02('0xce')];return db[_0xbd02('0xa9')][_0xbd02('0x5d')]({'where':{'messageId':_0x5cebce[_0xbd02('0x86')]}});}break;case _0xbd02('0x93'):if(_0x17a12c[_0xbd02('0x5f')][_0xbd02('0x86')]&&_0x17a12c[_0xbd02('0x5f')][_0xbd02('0x28')]){_0x1e5580=_0x17a12c[_0xbd02('0x5f')][_0xbd02('0x28')];return db['SmsMessage'][_0xbd02('0x5d')]({'where':{'messageId':_0x17a12c[_0xbd02('0x5f')][_0xbd02('0x86')]}});}break;case _0xbd02('0xd0'):if(_0x17a12c[_0xbd02('0x5f')][0x0][_0xbd02('0x26')]['id']){_0x1e5580=_0x17a12c['body'][0x0]['type'];return db['SmsMessage'][_0xbd02('0x5d')]({'where':{'messageId':_0x17a12c[_0xbd02('0x5f')][0x0][_0xbd02('0x26')]['id']}});}break;case _0xbd02('0x97'):if(_0x17a12c[_0xbd02('0x5f')][_0xbd02('0xd1')]&&_0x17a12c[_0xbd02('0x5f')][_0xbd02('0x28')]){_0x1e5580=_0x17a12c[_0xbd02('0x5f')][_0xbd02('0x28')];return db['SmsMessage'][_0xbd02('0x5d')]({'where':{'messageId':_0x17a12c[_0xbd02('0x5f')][_0xbd02('0xd1')]}});}break;}}})[_0xbd02('0x34')](handleEntityNotFound(_0x33b124,null))[_0xbd02('0x34')](function(_0x45dddd){if(_0x45dddd){_0x5a2d04=_0x45dddd;switch(_0x47966d[_0xbd02('0x41')]){case _0xbd02('0x88'):if(_0x1e5580===_0xbd02('0xcf')){return _0x5a2d04[_0xbd02('0x66')]({'read':!![]});}else{logger[_0xbd02('0x23')](_0xbd02('0x22'),_0xbd02('0x28'),_0xbd02('0x88'),util[_0xbd02('0xc9')](_0x17a12c['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x1e5580==='1'){return _0x5a2d04['update']({'read':!![]});}else{logger[_0xbd02('0x23')](_0xbd02('0x22'),_0xbd02('0x28'),'skebby',util[_0xbd02('0xc9')](_0x17a12c[_0xbd02('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xbd02('0x8a'):if(!_0x17a12c[_0xbd02('0x5f')]['error_code']&&_0x1e5580>=0xc8&&_0x1e5580<=0xce){return _0x5a2d04[_0xbd02('0x66')]({'read':!![]});}else{logger[_0xbd02('0x23')](_0xbd02('0x22'),_0xbd02('0x28'),'clicksend',util[_0xbd02('0xc9')](_0x17a12c[_0xbd02('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xbd02('0x8f'):var _0x3983c9=_0x17a12c[_0xbd02('0x5f')][_0xbd02('0x90')][0x0];if(_0x3983c9[_0xbd02('0x28')][_0xbd02('0xce')]===_0xbd02('0xcf')){return _0x5a2d04[_0xbd02('0x66')]({'read':!![]});}else{logger[_0xbd02('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xbd02('0x8f'),util[_0xbd02('0xc9')](_0x17a12c[_0xbd02('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xbd02('0x93'):if(_0x1e5580==_0xbd02('0xd2')||_0x1e5580==_0xbd02('0xd3')){return _0x5a2d04[_0xbd02('0x66')]({'read':!![]});}else{logger[_0xbd02('0x23')](_0xbd02('0x22'),'status','clickatell',util['inspect'](_0x17a12c[_0xbd02('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xbd02('0xd0'):if(_0x1e5580==_0xbd02('0xd4')){return _0x5a2d04['update']({'read':!![]});}else{logger[_0xbd02('0x23')](_0xbd02('0x22'),'status',_0xbd02('0xd0'),util[_0xbd02('0xc9')](_0x17a12c[_0xbd02('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xbd02('0x97'):if(_0x1e5580===_0xbd02('0xd5')||_0x1e5580===_0xbd02('0xd6')){return _0x5a2d04['update']({'read':!![]});}else{logger[_0xbd02('0x23')](_0xbd02('0x22'),_0xbd02('0x28'),_0xbd02('0x97'),util[_0xbd02('0xc9')](_0x17a12c[_0xbd02('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x5a2d04;}})[_0xbd02('0x34')](respondWithResult(_0x33b124,null))[_0xbd02('0x58')](handleError(_0x33b124,null));};exports[_0xbd02('0xd7')]=function(_0x56e3c7,_0x4478fb,_0x313d47){var _0x57e4ac,_0x11de74,_0x57816c;return db[_0xbd02('0x55')]['find']({'where':{'id':_0x56e3c7[_0xbd02('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4478fb,null))[_0xbd02('0x34')](function(_0x1b769a){if(_0x1b769a){_0x57816c=_0x1b769a;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbd02('0x28'),'received\x20delivery\x20report\x20from',_0x1b769a[_0xbd02('0x41')],util[_0xbd02('0xc9')](_0x56e3c7[_0xbd02('0x44')],{'showHidden':![],'depth':null}));switch(_0x1b769a[_0xbd02('0x41')]){case _0xbd02('0x91'):if(_0x56e3c7[_0xbd02('0x44')][_0xbd02('0xd8')]&&_0x56e3c7['query'][_0xbd02('0xd9')]){_0x11de74=_0x56e3c7[_0xbd02('0x44')][_0xbd02('0xd9')];return db['SmsMessage']['find']({'where':{'messageId':_0x56e3c7[_0xbd02('0x44')][_0xbd02('0xd8')]}});}break;}}})[_0xbd02('0x34')](handleEntityNotFound(_0x4478fb,null))[_0xbd02('0x34')](function(_0xa7355a){if(_0xa7355a){_0x57e4ac=_0xa7355a;switch(_0x57816c[_0xbd02('0x41')]){case _0xbd02('0x91'):if(_0x11de74==='2'||_0x11de74==='6'){return _0x57e4ac[_0xbd02('0x66')]({'read':!![]});}else{logger[_0xbd02('0x23')](_0xbd02('0x22'),_0xbd02('0x28'),_0xbd02('0x91'),util[_0xbd02('0xc9')](_0x56e3c7[_0xbd02('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x57e4ac;}})[_0xbd02('0x34')](respondWithResult(_0x4478fb,null))[_0xbd02('0x58')](handleError(_0x4478fb,null));};exports[_0xbd02('0xda')]=function(_0x373231,_0x1f0337,_0x157ee7){return db[_0xbd02('0x55')][_0xbd02('0x5d')]({'where':{'id':_0x373231[_0xbd02('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1f0337,null))[_0xbd02('0x34')](function(_0x1900ae){if(_0x1900ae){return _0x1900ae[_0xbd02('0xda')](_0x373231[_0xbd02('0x5f')][_0xbd02('0x6e')],_['omit'](_0x373231[_0xbd02('0x5f')],['ids','id'])||{})['spread'](function(_0x25a567){for(var _0x1abbc1=0x0;_0x1abbc1<_0x373231[_0xbd02('0x5f')][_0xbd02('0x6e')][_0xbd02('0x4a')];_0x1abbc1+=0x1){socket[_0xbd02('0xdb')](_0xbd02('0xdc'),{'UserId':Number(_0x373231[_0xbd02('0x5f')][_0xbd02('0x6e')][_0x1abbc1]),'SmsAccountId':Number(_0x373231['params']['id'])});}return _0x25a567;});}})['then'](respondWithResult(_0x1f0337,null))[_0xbd02('0x58')](handleError(_0x1f0337,null));};exports[_0xbd02('0xdd')]=function(_0x9d236f,_0x225376,_0x3cd5cb){return db['SmsAccount'][_0xbd02('0x5d')]({'where':{'id':_0x9d236f['params']['id']}})['then'](handleEntityNotFound(_0x225376,null))[_0xbd02('0x34')](function(_0x2b728a){if(_0x2b728a){return _0x2b728a[_0xbd02('0xdd')](_0x9d236f[_0xbd02('0x44')][_0xbd02('0x6e')])[_0xbd02('0x34')](function(){if(_[_0xbd02('0xde')](_0x9d236f[_0xbd02('0x44')][_0xbd02('0x6e')])){for(var _0x31723c=0x0;_0x31723c<_0x9d236f[_0xbd02('0x44')]['ids'][_0xbd02('0x4a')];_0x31723c+=0x1){socket[_0xbd02('0xdb')](_0xbd02('0xdf'),{'UserId':Number(_0x9d236f[_0xbd02('0x44')][_0xbd02('0x6e')][_0x31723c]),'SmsAccountId':Number(_0x9d236f[_0xbd02('0x5a')]['id'])});}}else{socket[_0xbd02('0xdb')]('userSmsAccount:remove',{'UserId':Number(_0x9d236f[_0xbd02('0x44')][_0xbd02('0x6e')]),'SmsAccountId':Number(_0x9d236f[_0xbd02('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x225376,null))[_0xbd02('0x58')](handleError(_0x225376,null));};exports[_0xbd02('0xe0')]=function(_0x34da9d,_0x518e92,_0x2b46be){var _0x49907e={};var _0x587152={};var _0x5bbbf7;var _0x1d3573;return db[_0xbd02('0x55')][_0xbd02('0x70')]({'where':{'id':_0x34da9d[_0xbd02('0x5a')]['id']}})[_0xbd02('0x34')](handleEntityNotFound(_0x518e92,null))[_0xbd02('0x34')](function(_0x18398d){if(_0x18398d){_0x5bbbf7=_0x18398d;_0x587152[_0xbd02('0x43')]=_['keys'](db[_0xbd02('0xab')]['rawAttributes']);_0x587152[_0xbd02('0x44')]=_[_0xbd02('0x45')](_0x34da9d[_0xbd02('0x44')]);_0x587152['filters']=_[_0xbd02('0x48')](_0x587152[_0xbd02('0x43')],_0x587152[_0xbd02('0x44')]);_0x49907e[_0xbd02('0x47')]=_[_0xbd02('0x48')](_0x587152[_0xbd02('0x43')],qs['fields'](_0x34da9d['query']['fields']));_0x49907e[_0xbd02('0x47')]=_0x49907e[_0xbd02('0x47')][_0xbd02('0x4a')]?_0x49907e[_0xbd02('0x47')]:_0x587152['model'];_0x49907e[_0xbd02('0x4d')]=qs[_0xbd02('0x4e')](_0x34da9d[_0xbd02('0x44')][_0xbd02('0x4e')]);_0x49907e[_0xbd02('0x4f')]=qs[_0xbd02('0x46')](_[_0xbd02('0x50')](_0x34da9d[_0xbd02('0x44')],_0x587152['filters']));if(_0x34da9d[_0xbd02('0x44')][_0xbd02('0x53')]){_0x49907e[_0xbd02('0x4f')]=_['merge'](_0x49907e[_0xbd02('0x4f')],{'$or':_['map'](_0x49907e[_0xbd02('0x47')],function(_0x5544f8){var _0x165c4b={};_0x165c4b[_0x5544f8]={'$like':'%'+_0x34da9d[_0xbd02('0x44')][_0xbd02('0x53')]+'%'};return _0x165c4b;})});}_0x49907e=_[_0xbd02('0x51')]({},_0x49907e,_0x34da9d['options']);return _0x5bbbf7[_0xbd02('0xe0')](_0x49907e);}})['then'](function(_0x1a0077){if(_0x1a0077){_0x1d3573=_0x1a0077[_0xbd02('0x4a')];if(!_0x34da9d[_0xbd02('0x44')]['hasOwnProperty'](_0xbd02('0x4c'))){_0x49907e[_0xbd02('0x2d')]=qs[_0xbd02('0x2d')](_0x34da9d['query'][_0xbd02('0x2d')]);_0x49907e[_0xbd02('0x2a')]=qs[_0xbd02('0x2a')](_0x34da9d[_0xbd02('0x44')][_0xbd02('0x2a')]);}return _0x5bbbf7[_0xbd02('0xe0')](_0x49907e);}})[_0xbd02('0x34')](function(_0x346dbd){if(_0x346dbd){return _0x346dbd?{'count':_0x1d3573,'rows':_0x346dbd}:null;}})[_0xbd02('0x34')](respondWithResult(_0x518e92,null))['catch'](handleError(_0x518e92,null));}; \ No newline at end of file +var _0x370a=['SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','out','dataValues','Messages','debug','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','redif','error_code','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','received\x20delivery\x20report\x20from','state','message-id','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','user','role','UserProfileSection','autoAssociation','describe','addDisposition','Disposition','getDispositions','findOne','SmsAccountId','filter','removeDispositions','ids','CannedAnswer','removeAnswers','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x370a,0x11a));var _0xa370=function(_0x14ed98,_0x54c2e4){_0x14ed98=_0x14ed98-0x0;var _0x2c28d7=_0x370a[_0x14ed98];return _0x2c28d7;};'use strict';var emlformat=require(_0xa370('0x0'));var rimraf=require(_0xa370('0x1'));var zipdir=require(_0xa370('0x2'));var jsonpatch=require(_0xa370('0x3'));var rp=require(_0xa370('0x4'));var moment=require(_0xa370('0x5'));var BPromise=require(_0xa370('0x6'));var Mustache=require('mustache');var util=require(_0xa370('0x7'));var path=require('path');var sox=require(_0xa370('0x8'));var csv=require(_0xa370('0x9'));var ejs=require(_0xa370('0xa'));var fs=require('fs');var fs_extra=require(_0xa370('0xb'));var _=require(_0xa370('0xc'));var squel=require(_0xa370('0xd'));var crypto=require(_0xa370('0xe'));var jsforce=require(_0xa370('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa370('0x9'));var querystring=require(_0xa370('0x10'));var Papa=require(_0xa370('0x11'));var Redis=require(_0xa370('0x12'));var authService=require(_0xa370('0x13'));var qs=require(_0xa370('0x14'));var as=require(_0xa370('0x15'));var hardwareService=require(_0xa370('0x16'));var logger=require(_0xa370('0x17'))('api');var utils=require(_0xa370('0x18'));var config=require(_0xa370('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa370('0x1a')]=_[_0xa370('0x1b')](config[_0xa370('0x1a')],{'host':_0xa370('0x1c'),'port':0x18eb});var socket=require(_0xa370('0x1d'))(new Redis(config[_0xa370('0x1a')]));require(_0xa370('0x1e'))[_0xa370('0x1f')](socket);var jayson=require(_0xa370('0x20'));var client=jayson[_0xa370('0x21')][_0xa370('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x7d3e8c,_0x221f52,_0x1abeb1,_0x160660){return new BPromise(function(_0x35fb25,_0x5277d8){var _0x2ba470=_0x160660||client;return _0x2ba470[_0xa370('0x23')](_0x7d3e8c,_0x1abeb1)[_0xa370('0x24')](function(_0x332abf){logger[_0xa370('0x25')](_0xa370('0x26'),_0x221f52,_0xa370('0x27'));logger['debug'](_0xa370('0x28'),_0x221f52,_0xa370('0x27'),JSON[_0xa370('0x29')](_0x332abf));if(_0x332abf[_0xa370('0x2a')]){if(_0x332abf[_0xa370('0x2a')][_0xa370('0x2b')]===0x1f4){logger[_0xa370('0x2a')](_0xa370('0x26'),_0x221f52,_0x332abf[_0xa370('0x2a')][_0xa370('0x2c')]);return _0x5277d8(_0x332abf['error'][_0xa370('0x2c')]);}logger[_0xa370('0x2a')](_0xa370('0x26'),_0x221f52,_0x332abf[_0xa370('0x2a')]['message']);return _0x35fb25(_0x332abf['error'][_0xa370('0x2c')]);}else{logger[_0xa370('0x25')]('SmsAccount,\x20%s,\x20%s',_0x221f52,_0xa370('0x27'));_0x35fb25(_0x332abf[_0xa370('0x2d')]['message']);}})['catch'](function(_0x155f5f){logger[_0xa370('0x2a')]('SmsAccount,\x20%s,\x20%s',_0x221f52,_0x155f5f);_0x5277d8(_0x155f5f);});});}function respondWithStatusCode(_0x48a891,_0x4dc29d){_0x4dc29d=_0x4dc29d||0xcc;return function(_0x4723bd){if(_0x4723bd){return _0x48a891['sendStatus'](_0x4dc29d);}return _0x48a891[_0xa370('0x2e')](_0x4dc29d)[_0xa370('0x2f')]();};}function respondWithResult(_0x28de4b,_0x4082f9){_0x4082f9=_0x4082f9||0xc8;return function(_0x159875){if(_0x159875){return _0x28de4b['status'](_0x4082f9)['json'](_0x159875);}};}function respondWithFilteredResult(_0x52979e,_0x4069c7){return function(_0x234c6d){if(_0x234c6d){var _0xf020af=typeof _0x4069c7[_0xa370('0x30')]===_0xa370('0x31')&&typeof _0x4069c7[_0xa370('0x32')]===_0xa370('0x31');var _0x1d5fd7=_0x234c6d[_0xa370('0x33')];var _0x4d9806=_0xf020af?0x0:_0x4069c7[_0xa370('0x30')];var _0x308faf=_0xf020af?_0x234c6d[_0xa370('0x33')]:_0x4069c7[_0xa370('0x30')]+_0x4069c7[_0xa370('0x32')];var _0x220a8c;if(_0x308faf>=_0x1d5fd7){_0x308faf=_0x1d5fd7;_0x220a8c=0xc8;}else{_0x220a8c=0xce;}_0x52979e[_0xa370('0x2e')](_0x220a8c);return _0x52979e[_0xa370('0x34')](_0xa370('0x35'),_0x4d9806+'-'+_0x308faf+'/'+_0x1d5fd7)[_0xa370('0x36')](_0x234c6d);}return null;};}function patchUpdates(_0x328c74){return function(_0xffa43e){try{jsonpatch[_0xa370('0x37')](_0xffa43e,_0x328c74,!![]);}catch(_0x21f5b7){return BPromise[_0xa370('0x38')](_0x21f5b7);}return _0xffa43e[_0xa370('0x39')]();};}function saveUpdates(_0x5a0a1b,_0x48fa7a){return function(_0x2968f9){if(_0x2968f9){return _0x2968f9[_0xa370('0x3a')](_0x5a0a1b)[_0xa370('0x24')](function(_0x292b69){return _0x292b69;});}return null;};}function removeEntity(_0x44ab33,_0x345e6f){return function(_0x35058d){if(_0x35058d){return _0x35058d[_0xa370('0x3b')]()['then'](function(){var _0x801c5f=_0x35058d[_0xa370('0x3c')]({'plain':!![]});var _0x28d4b4='SmsAccounts';return db[_0xa370('0x3d')][_0xa370('0x3b')]({'where':{'type':_0x28d4b4,'resourceId':_0x801c5f['id']}})[_0xa370('0x24')](function(){return _0x35058d;});})[_0xa370('0x24')](function(){_0x44ab33[_0xa370('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c019f,_0x1a9536){return function(_0x202660){if(!_0x202660){_0x5c019f[_0xa370('0x3e')](0x194);}return _0x202660;};}function handleError(_0x1e8ba1,_0x5da0b2){_0x5da0b2=_0x5da0b2||0x1f4;return function(_0x45d37b){logger['error'](_0x45d37b[_0xa370('0x3f')]);if(_0x45d37b[_0xa370('0x40')]){delete _0x45d37b[_0xa370('0x40')];}_0x1e8ba1[_0xa370('0x2e')](_0x5da0b2)[_0xa370('0x41')](_0x45d37b);};}exports[_0xa370('0x42')]=function(_0x16a33b,_0x401866){var _0x189232={'include':[{'model':db[_0xa370('0x43')],'as':_0xa370('0x44')}]},_0x5725e9={},_0x415c9e={'count':0x0,'rows':[]};var _0xefdb1d=_[_0xa370('0x45')](db[_0xa370('0x46')][_0xa370('0x47')],function(_0x34e486){return{'name':_0x34e486[_0xa370('0x48')],'type':_0x34e486['type'][_0xa370('0x49')]};});_0x5725e9[_0xa370('0x4a')]=_[_0xa370('0x45')](_0xefdb1d,'name');_0x5725e9[_0xa370('0x4b')]=_[_0xa370('0x4c')](_0x16a33b[_0xa370('0x4b')]);_0x5725e9['filters']=_[_0xa370('0x4d')](_0x5725e9[_0xa370('0x4a')],_0x5725e9[_0xa370('0x4b')]);_0x189232['attributes']=_[_0xa370('0x4d')](_0x5725e9['model'],qs[_0xa370('0x4e')](_0x16a33b[_0xa370('0x4b')][_0xa370('0x4e')]));_0x189232[_0xa370('0x4f')]=_0x189232[_0xa370('0x4f')][_0xa370('0x50')]?_0x189232[_0xa370('0x4f')]:_0x5725e9[_0xa370('0x4a')];if(!_0x16a33b[_0xa370('0x4b')][_0xa370('0x51')](_0xa370('0x52'))){_0x189232['limit']=qs['limit'](_0x16a33b['query'][_0xa370('0x32')]);_0x189232[_0xa370('0x30')]=qs[_0xa370('0x30')](_0x16a33b['query']['offset']);}_0x189232[_0xa370('0x53')]=qs[_0xa370('0x54')](_0x16a33b['query'][_0xa370('0x54')]);_0x189232[_0xa370('0x55')]=qs[_0xa370('0x56')](_[_0xa370('0x57')](_0x16a33b[_0xa370('0x4b')],_0x5725e9[_0xa370('0x56')]),_0xefdb1d);if(_0x16a33b['query']['filter']){_0x189232[_0xa370('0x55')]=_['merge'](_0x189232[_0xa370('0x55')],{'$or':_[_0xa370('0x45')](_0xefdb1d,function(_0x4d7f26){if(_0x4d7f26[_0xa370('0x58')]!==_0xa370('0x59')){var _0x1e6f52={};_0x1e6f52[_0x4d7f26[_0xa370('0x40')]]={'$like':'%'+_0x16a33b['query']['filter']+'%'};return _0x1e6f52;}})});}_0x189232=_['merge']({},_0x189232,_0x16a33b[_0xa370('0x5a')]);var _0x24a8c4={'where':_0x189232[_0xa370('0x55')]};return db['SmsAccount']['count'](_0x24a8c4)[_0xa370('0x24')](function(_0x37f73a){_0x415c9e[_0xa370('0x33')]=_0x37f73a;if(_0x16a33b['query'][_0xa370('0x5b')]){_0x189232[_0xa370('0x5c')]=[{'all':!![]}];}return db[_0xa370('0x46')][_0xa370('0x5d')](_0x189232);})['then'](function(_0x5157b1){_0x415c9e[_0xa370('0x5e')]=_0x5157b1;return _0x415c9e;})[_0xa370('0x24')](respondWithFilteredResult(_0x401866,_0x189232))['catch'](handleError(_0x401866,null));};exports[_0xa370('0x5f')]=function(_0x1a7f67,_0x1b4e59){var _0x2847f1={'raw':![],'where':{'id':_0x1a7f67[_0xa370('0x60')]['id']},'include':[{'model':db['Pause'],'as':_0xa370('0x44')}]},_0x3cba59={};_0x3cba59['model']=_[_0xa370('0x4c')](db[_0xa370('0x46')][_0xa370('0x47')]);_0x3cba59[_0xa370('0x4b')]=_[_0xa370('0x4c')](_0x1a7f67[_0xa370('0x4b')]);_0x3cba59[_0xa370('0x56')]=_['intersection'](_0x3cba59[_0xa370('0x4a')],_0x3cba59[_0xa370('0x4b')]);_0x2847f1[_0xa370('0x4f')]=_[_0xa370('0x4d')](_0x3cba59[_0xa370('0x4a')],qs[_0xa370('0x4e')](_0x1a7f67[_0xa370('0x4b')]['fields']));_0x2847f1[_0xa370('0x4f')]=_0x2847f1['attributes'][_0xa370('0x50')]?_0x2847f1[_0xa370('0x4f')]:_0x3cba59[_0xa370('0x4a')];if(_0x1a7f67[_0xa370('0x4b')][_0xa370('0x5b')]){_0x2847f1[_0xa370('0x5c')]=[{'all':!![]}];}_0x2847f1=_[_0xa370('0x61')]({},_0x2847f1,_0x1a7f67[_0xa370('0x5a')]);return db['SmsAccount'][_0xa370('0x62')](_0x2847f1)[_0xa370('0x24')](handleEntityNotFound(_0x1b4e59,null))[_0xa370('0x24')](respondWithResult(_0x1b4e59,null))[_0xa370('0x63')](handleError(_0x1b4e59,null));};exports[_0xa370('0x64')]=function(_0x4d9fb9,_0x23af71){return db['SmsAccount'][_0xa370('0x64')](_0x4d9fb9[_0xa370('0x65')],{})[_0xa370('0x24')](function(_0x5ac370){var _0x47d5d5=_0x4d9fb9[_0xa370('0x66')]['get']({'plain':!![]});if(!_0x47d5d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47d5d5[_0xa370('0x67')]===_0xa370('0x66')){var _0x7c2d30=_0x5ac370[_0xa370('0x3c')]({'plain':!![]});var _0x44b60a='SmsAccounts';return db[_0xa370('0x68')]['find']({'where':{'name':_0x44b60a,'userProfileId':_0x47d5d5['userProfileId']},'raw':!![]})[_0xa370('0x24')](function(_0x56f790){if(_0x56f790&&_0x56f790[_0xa370('0x69')]===0x0){return db['UserProfileResource'][_0xa370('0x64')]({'name':_0x7c2d30[_0xa370('0x40')],'resourceId':_0x7c2d30['id'],'type':_0x56f790[_0xa370('0x40')],'sectionId':_0x56f790['id']},{})['then'](function(){return _0x5ac370;});}else{return _0x5ac370;}})[_0xa370('0x63')](function(_0x452fda){logger[_0xa370('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x452fda);throw _0x452fda;});}return _0x5ac370;})[_0xa370('0x24')](respondWithResult(_0x23af71,0xc9))[_0xa370('0x63')](handleError(_0x23af71,null));};exports[_0xa370('0x3a')]=function(_0x598f4e,_0x37a159){if(_0x598f4e[_0xa370('0x65')]['id']){delete _0x598f4e[_0xa370('0x65')]['id'];}return db[_0xa370('0x46')][_0xa370('0x62')]({'where':{'id':_0x598f4e['params']['id']},'include':[{'model':db['Pause'],'as':_0xa370('0x44')}]})[_0xa370('0x24')](handleEntityNotFound(_0x37a159,null))[_0xa370('0x24')](saveUpdates(_0x598f4e[_0xa370('0x65')],null))[_0xa370('0x24')](respondWithResult(_0x37a159,null))[_0xa370('0x63')](handleError(_0x37a159,null));};exports['destroy']=function(_0x30ce5a,_0x51506c){return db[_0xa370('0x46')][_0xa370('0x62')]({'where':{'id':_0x30ce5a[_0xa370('0x60')]['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x51506c,null))['then'](removeEntity(_0x51506c,null))[_0xa370('0x63')](handleError(_0x51506c,null));};exports[_0xa370('0x6a')]=function(_0x5a6dfa,_0x1da824){return db[_0xa370('0x46')][_0xa370('0x6a')]()[_0xa370('0x24')](respondWithResult(_0x1da824,null))['catch'](handleError(_0x1da824,null));};exports[_0xa370('0x6b')]=function(_0x140843,_0x5908c4,_0x4e9866){if(_0x140843[_0xa370('0x65')]['id']){delete _0x140843[_0xa370('0x65')]['id'];}return db['SmsAccount'][_0xa370('0x62')]({'where':{'id':_0x140843['params']['id']}})['then'](handleEntityNotFound(_0x5908c4,null))['then'](function(_0x8f0342){if(_0x8f0342){_0x140843['body']['SmsAccountId']=_0x8f0342['id'];return db[_0xa370('0x6c')][_0xa370('0x64')](_0x140843['body']);}})[_0xa370('0x24')](respondWithResult(_0x5908c4,null))[_0xa370('0x63')](handleError(_0x5908c4,null));};exports[_0xa370('0x6d')]=function(_0x203ad9,_0x200973,_0xeda51e){var _0x463dfc={'raw':![],'where':{}};var _0x467d32={};var _0x177ded={'count':0x0,'rows':[]};return db[_0xa370('0x46')][_0xa370('0x6e')]({'where':{'id':_0x203ad9[_0xa370('0x60')]['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x200973,null))['then'](function(_0x28d2b1){if(_0x28d2b1){_0x467d32[_0xa370('0x4a')]=_[_0xa370('0x4c')](db[_0xa370('0x6c')][_0xa370('0x47')]);_0x467d32['query']=_['keys'](_0x203ad9[_0xa370('0x4b')]);_0x467d32[_0xa370('0x56')]=_[_0xa370('0x4d')](_0x467d32[_0xa370('0x4a')],_0x467d32[_0xa370('0x4b')]);_0x463dfc[_0xa370('0x4f')]=_['intersection'](_0x467d32['model'],qs[_0xa370('0x4e')](_0x203ad9[_0xa370('0x4b')][_0xa370('0x4e')]));_0x463dfc['attributes']=_0x463dfc[_0xa370('0x4f')][_0xa370('0x50')]?_0x463dfc[_0xa370('0x4f')]:_0x467d32[_0xa370('0x4a')];if(!_0x203ad9[_0xa370('0x4b')][_0xa370('0x51')](_0xa370('0x52'))){_0x463dfc[_0xa370('0x32')]=qs[_0xa370('0x32')](_0x203ad9[_0xa370('0x4b')][_0xa370('0x32')]);_0x463dfc['offset']=qs[_0xa370('0x30')](_0x203ad9[_0xa370('0x4b')]['offset']);}_0x463dfc[_0xa370('0x53')]=qs[_0xa370('0x54')](_0x203ad9['query']['sort']);_0x463dfc[_0xa370('0x55')]=qs[_0xa370('0x56')](_[_0xa370('0x57')](_0x203ad9[_0xa370('0x4b')],_0x467d32['filters']));_0x463dfc[_0xa370('0x55')][_0xa370('0x6f')]=_0x28d2b1['id'];if(_0x203ad9[_0xa370('0x4b')][_0xa370('0x70')]){_0x463dfc[_0xa370('0x55')]=_[_0xa370('0x61')](_0x463dfc['where'],{'$or':_[_0xa370('0x45')](_0x463dfc[_0xa370('0x4f')],function(_0x4c9aa9){var _0x35f6e5={};_0x35f6e5[_0x4c9aa9]={'$like':'%'+_0x203ad9[_0xa370('0x4b')][_0xa370('0x70')]+'%'};return _0x35f6e5;})});}_0x463dfc=_[_0xa370('0x61')]({},_0x463dfc,_0x203ad9[_0xa370('0x5a')]);return db[_0xa370('0x6c')][_0xa370('0x33')]({'where':_0x463dfc[_0xa370('0x55')]})['then'](function(_0x6dc8a2){_0x177ded[_0xa370('0x33')]=_0x6dc8a2;if(_0x203ad9[_0xa370('0x4b')][_0xa370('0x5b')]){_0x463dfc[_0xa370('0x5c')]=[{'all':!![]}];}return db[_0xa370('0x6c')][_0xa370('0x5d')](_0x463dfc);})[_0xa370('0x24')](function(_0xf5e2d5){_0x177ded['rows']=_0xf5e2d5;return _0x177ded;});}})[_0xa370('0x24')](respondWithFilteredResult(_0x200973,_0x463dfc))[_0xa370('0x63')](handleError(_0x200973,null));};exports[_0xa370('0x71')]=function(_0x15176b,_0x37efc2,_0x16bcd3){return db[_0xa370('0x46')][_0xa370('0x62')]({'where':{'id':_0x15176b[_0xa370('0x60')]['id']}})['then'](handleEntityNotFound(_0x37efc2,null))['then'](function(_0x372714){if(_0x372714){return _0x372714[_0xa370('0x71')](_0x15176b['query'][_0xa370('0x72')]);}})[_0xa370('0x24')](respondWithStatusCode(_0x37efc2,null))[_0xa370('0x63')](handleError(_0x37efc2,null));};exports['addAnswer']=function(_0x218669,_0x55410e,_0x133102){if(_0x218669[_0xa370('0x65')]['id']){delete _0x218669[_0xa370('0x65')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x218669[_0xa370('0x60')]['id']}})['then'](handleEntityNotFound(_0x55410e,null))[_0xa370('0x24')](function(_0x106a82){if(_0x106a82){_0x218669[_0xa370('0x65')][_0xa370('0x6f')]=_0x106a82['id'];return db[_0xa370('0x73')][_0xa370('0x64')](_0x218669[_0xa370('0x65')]);}})[_0xa370('0x24')](respondWithResult(_0x55410e,null))[_0xa370('0x63')](handleError(_0x55410e,null));};exports['getAnswers']=function(_0x2893f0,_0x4f4c4e,_0x58158b){var _0x4870e8={'raw':![],'where':{}};var _0x357a05={};var _0x174028={'count':0x0,'rows':[]};return db[_0xa370('0x46')]['findOne']({'where':{'id':_0x2893f0[_0xa370('0x60')]['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x4f4c4e,null))[_0xa370('0x24')](function(_0x33644c){if(_0x33644c){_0x357a05['model']=_['keys'](db['CannedAnswer'][_0xa370('0x47')]);_0x357a05[_0xa370('0x4b')]=_[_0xa370('0x4c')](_0x2893f0['query']);_0x357a05['filters']=_[_0xa370('0x4d')](_0x357a05['model'],_0x357a05[_0xa370('0x4b')]);_0x4870e8[_0xa370('0x4f')]=_[_0xa370('0x4d')](_0x357a05['model'],qs[_0xa370('0x4e')](_0x2893f0[_0xa370('0x4b')][_0xa370('0x4e')]));_0x4870e8[_0xa370('0x4f')]=_0x4870e8[_0xa370('0x4f')][_0xa370('0x50')]?_0x4870e8[_0xa370('0x4f')]:_0x357a05[_0xa370('0x4a')];if(!_0x2893f0[_0xa370('0x4b')]['hasOwnProperty']('nolimit')){_0x4870e8[_0xa370('0x32')]=qs[_0xa370('0x32')](_0x2893f0[_0xa370('0x4b')][_0xa370('0x32')]);_0x4870e8['offset']=qs[_0xa370('0x30')](_0x2893f0['query'][_0xa370('0x30')]);}_0x4870e8[_0xa370('0x53')]=qs['sort'](_0x2893f0[_0xa370('0x4b')][_0xa370('0x54')]);_0x4870e8[_0xa370('0x55')]=qs[_0xa370('0x56')](_[_0xa370('0x57')](_0x2893f0[_0xa370('0x4b')],_0x357a05[_0xa370('0x56')]));_0x4870e8[_0xa370('0x55')][_0xa370('0x6f')]=_0x33644c['id'];if(_0x2893f0['query'][_0xa370('0x70')]){_0x4870e8[_0xa370('0x55')]=_[_0xa370('0x61')](_0x4870e8['where'],{'$or':_['map'](_0x4870e8['attributes'],function(_0x4ea159){var _0x2a6c8c={};_0x2a6c8c[_0x4ea159]={'$like':'%'+_0x2893f0[_0xa370('0x4b')]['filter']+'%'};return _0x2a6c8c;})});}_0x4870e8=_[_0xa370('0x61')]({},_0x4870e8,_0x2893f0[_0xa370('0x5a')]);return db['CannedAnswer'][_0xa370('0x33')]({'where':_0x4870e8[_0xa370('0x55')]})[_0xa370('0x24')](function(_0x900d2c){_0x174028[_0xa370('0x33')]=_0x900d2c;if(_0x2893f0[_0xa370('0x4b')]['includeAll']){_0x4870e8[_0xa370('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa370('0x5d')](_0x4870e8);})[_0xa370('0x24')](function(_0x6157dc){_0x174028[_0xa370('0x5e')]=_0x6157dc;return _0x174028;});}})[_0xa370('0x24')](respondWithFilteredResult(_0x4f4c4e,_0x4870e8))[_0xa370('0x63')](handleError(_0x4f4c4e,null));};exports[_0xa370('0x74')]=function(_0x57be59,_0x422797,_0x1db566){return db[_0xa370('0x46')]['find']({'where':{'id':_0x57be59[_0xa370('0x60')]['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x422797,null))[_0xa370('0x24')](function(_0x11c102){if(_0x11c102){return _0x11c102[_0xa370('0x74')](_0x57be59[_0xa370('0x4b')][_0xa370('0x72')]);}})[_0xa370('0x24')](respondWithStatusCode(_0x422797,null))[_0xa370('0x63')](handleError(_0x422797,null));};exports['notify']=function(_0x597f1f,_0x3fb7a8,_0x152b37){var _0x4d13d6={'channel':'sms'};var _0x290060=[];var _0x5074f3=[];var _0x706fec={};return db['SmsAccount'][_0xa370('0x62')]({'where':{'id':_0x597f1f[_0xa370('0x60')]['id']},'include':[{'model':db[_0xa370('0x75')],'as':_0xa370('0x76')}]})[_0xa370('0x24')](handleEntityNotFound(_0x3fb7a8,null))[_0xa370('0x24')](function(_0x1cbd39){_0x4d13d6[_0xa370('0x77')]=_0x1cbd39;_0x4d13d6[_0xa370('0x78')]=_[_0xa370('0x79')](_0x1cbd39[_0xa370('0x76')],[_0xa370('0x7a')],[_0xa370('0x7b')]);if(_0x4d13d6['account'][_0xa370('0x76')]){delete _0x4d13d6[_0xa370('0x77')][_0xa370('0x76')];}return db[_0xa370('0x7c')][_0xa370('0x6a')]();})[_0xa370('0x24')](function(_0x301e15){if(!_0x301e15){throw new db[(_0xa370('0x7d'))][(_0xa370('0x7e'))]('no\x20available\x20attributes');}_0x290060=_[_0xa370('0x7f')](_[_0xa370('0x4c')](_0x301e15),[_0xa370('0x80'),_0xa370('0x81')]);_0x5074f3=_[_0xa370('0x7f')](_[_0xa370('0x4c')](_0x301e15),[_0xa370('0x80'),_0xa370('0x81'),_0xa370('0x82'),_0xa370('0x83')]);_0x4d13d6[_0xa370('0x65')]={'mapKey':_0xa370('0x84')};if(_0x4d13d6[_0xa370('0x77')][_0xa370('0x58')]){switch(_0x4d13d6['account'][_0xa370('0x58')]){case _0xa370('0x85'):_0x4d13d6[_0xa370('0x65')][_0xa370('0x86')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x87')];_0x4d13d6[_0xa370('0x65')]['body']=_0x597f1f['body'][_0xa370('0x88')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x89')]=_0x597f1f['body'][_0xa370('0x8a')];break;case _0xa370('0x8b'):_0x4d13d6[_0xa370('0x65')][_0xa370('0x86')]='+'+_0x597f1f['body'][_0xa370('0x8c')];_0x4d13d6[_0xa370('0x65')]['body']=_0x597f1f[_0xa370('0x65')][_0xa370('0x8d')];break;case _0xa370('0x8e'):_0x4d13d6['body'][_0xa370('0x86')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x86')];_0x4d13d6[_0xa370('0x65')]['body']=_0x597f1f[_0xa370('0x65')][_0xa370('0x2c')];break;case _0xa370('0x8f'):_0x4d13d6[_0xa370('0x65')]['from']=_0x597f1f[_0xa370('0x65')][_0xa370('0x86')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x65')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x65')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x89')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x90')];break;case'plivo':_0x4d13d6[_0xa370('0x65')][_0xa370('0x86')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x87')];_0x4d13d6[_0xa370('0x65')]['body']=_0x597f1f[_0xa370('0x65')][_0xa370('0x91')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x89')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x92')];break;case _0xa370('0x93'):_0x4d13d6[_0xa370('0x65')]['from']='+'+_0x597f1f['body'][_0xa370('0x94')][0x0][_0xa370('0x86')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x65')]=_0x597f1f[_0xa370('0x65')]['results'][0x0][_0xa370('0x8d')];_0x4d13d6['body']['messageId']=_0x597f1f[_0xa370('0x65')]['results'][0x0][_0xa370('0x89')];break;case _0xa370('0x95'):_0x4d13d6['body'][_0xa370('0x86')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x96')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x65')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x97')][_0xa370('0x2c')];break;case _0xa370('0x98'):_0x4d13d6['body'][_0xa370('0x86')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x99')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x65')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x8d')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x89')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x9a')];break;case _0xa370('0x9b'):_0x4d13d6[_0xa370('0x65')][_0xa370('0x89')]=_0x597f1f[_0xa370('0x65')][0x0][_0xa370('0x2c')]['id'];_0x4d13d6['body'][_0xa370('0x86')]=_0x597f1f[_0xa370('0x65')][0x0][_0xa370('0x2c')][_0xa370('0x86')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x65')]=_0x597f1f[_0xa370('0x65')][0x0]['message'][_0xa370('0x8d')];break;case _0xa370('0x9c'):_0x4d13d6[_0xa370('0x65')][_0xa370('0x86')]=_0x597f1f['body']['from'];_0x4d13d6[_0xa370('0x65')][_0xa370('0x65')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x2c')];_0x4d13d6[_0xa370('0x65')]['messageId']=_0x597f1f[_0xa370('0x65')][_0xa370('0x9d')];break;}}if(_0x4d13d6['body']['id']){delete _0x4d13d6[_0xa370('0x65')]['id'];}if(_['isNil'](_0x4d13d6[_0xa370('0x65')][_0xa370('0x86')])){throw new db['Sequelize']['ValidationError'](_0xa370('0x9e'));}if(_[_0xa370('0x9f')](_0x4d13d6['body'][_0xa370('0x65')])||_0x4d13d6[_0xa370('0x65')]['body']===''){throw new db['Sequelize']['ValidationError'](_0xa370('0xa0'));}if(_[_0xa370('0x9f')](_0x4d13d6[_0xa370('0x65')][_0xa370('0xa1')])){throw new db[(_0xa370('0x7d'))][(_0xa370('0x7e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5074f3);}if(!_[_0xa370('0xa2')](_0x5074f3,_0x4d13d6[_0xa370('0x65')][_0xa370('0xa1')])){throw new db[(_0xa370('0x7d'))][(_0xa370('0x7e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5074f3);}_0x706fec[_0x4d13d6[_0xa370('0x65')]['mapKey']]=_0x4d13d6[_0xa370('0x65')][_0xa370('0x86')];return db[_0xa370('0xa3')][_0xa370('0x62')]({'where':{'id':_0x4d13d6['account'][_0xa370('0x83')]},'include':[{'model':db[_0xa370('0x7c')],'as':'Contacts','where':_0x706fec,'limit':0x1,'order':[[_0xa370('0x81'),_0xa370('0xa4')]]}]});})[_0xa370('0x24')](handleEntityNotFound(_0x3fb7a8,null))[_0xa370('0x24')](function(_0x1e3205){if(_0x1e3205){_0x4d13d6[_0xa370('0xa5')]=_[_0xa370('0xa6')](_0x1e3205,['Contacts']);if(_0x1e3205[_0xa370('0xa7')][_0xa370('0x50')]){return _0x1e3205[_0xa370('0xa7')][0x0];}var _0xa1bf0f=_[_0xa370('0x1b')](_0x4d13d6[_0xa370('0x65')],{'firstName':_0x4d13d6[_0xa370('0x65')]['from'],'ListId':_0x1e3205['id']});_0xa1bf0f[_0x4d13d6[_0xa370('0x65')][_0xa370('0xa1')]]=_0x4d13d6[_0xa370('0x65')]['from'];return db[_0xa370('0x7c')][_0xa370('0x64')](_0xa1bf0f,{'fields':_0x290060,'raw':!![]});}})[_0xa370('0x24')](handleEntityNotFound(_0x3fb7a8,null))[_0xa370('0x24')](function(_0x384411){if(_0x384411){_0x4d13d6[_0xa370('0xa8')]=_0x384411;var _0x140771={'ContactId':_0x384411['id'],'phone':_0x4d13d6['body'][_0xa370('0x86')],'SmsAccountId':_0x597f1f[_0xa370('0x60')]['id']};var _0x33b4be={'ContactId':_0x384411['id'],'SmsAccountId':_0x597f1f[_0xa370('0x60')]['id'],'closed':![]};return db['SmsInteraction'][_0xa370('0x62')]({'where':_0x33b4be})[_0xa370('0x24')](function(_0x18c459){if(_0x18c459){return[_0x18c459,![]];}return db[_0xa370('0xa9')][_0xa370('0x64')](_0x140771)['then'](function(_0x5adf9a){return[_0x5adf9a,!![]];});});}})[_0xa370('0xaa')](function(_0xf80e0f,_0x2f873b){_0x4d13d6[_0xa370('0xab')]=_0xf80e0f['get']({'plain':!![]});_0x4d13d6[_0xa370('0xab')][_0xa370('0xac')]=![];if(_0x2f873b){if(_0x4d13d6[_0xa370('0x77')][_0xa370('0xad')]){_0x4d13d6[_0xa370('0x78')][_0xa370('0xae')]({'id':0x0,'priority':_0x4d13d6[_0xa370('0x78')]['length']+0x1,'app':_0xa370('0xaf'),'appdata':_0xa370('0xb0'),'interval':_0xa370('0xb1')});}_0x4d13d6[_0xa370('0xab')]['created']=!![];}return db[_0xa370('0xb2')]['create']({'phone':_0x4d13d6['body']['from'],'messageId':_0x4d13d6[_0xa370('0x65')]['messageId'],'body':_0x4d13d6[_0xa370('0x65')]['body'],'SmsAccountId':_0x597f1f[_0xa370('0x60')]['id'],'SmsInteractionId':_0xf80e0f['id'],'direction':'in','ContactId':_0xf80e0f[_0xa370('0xb3')],'AttachmentId':_0x4d13d6[_0xa370('0x65')][_0xa370('0xb4')]});})[_0xa370('0x24')](function(_0x2cf83e){_0x4d13d6['message']=_0x2cf83e;if(_0x4d13d6['interaction'][_0xa370('0xb5')]){return db[_0xa370('0xb6')][_0xa370('0x62')]({'attributes':['id','name'],'where':{'id':_0x4d13d6['interaction'][_0xa370('0xb5')]}})[_0xa370('0x24')](function(_0x534300){if(_0x534300){_0x4d13d6[_0xa370('0x78')][_0xa370('0xb7')]({'id':0x0,'priority':0x0,'app':_0xa370('0xb8'),'appdata':_0x534300['name']+','+(_0x4d13d6[_0xa370('0x77')][_0xa370('0xb9')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xa370('0xba'),_0xa370('0xbb'),_0x4d13d6);});}return respondWithRpcPromise('Start',_0xa370('0xbb'),_0x4d13d6);})[_0xa370('0x24')](function(_0x41083d){if(_0x41083d){var _0x5728d0=0xc8;var _0x1f3372=_0xa370('0xbc');logger[_0xa370('0x25')](_0xa370('0x28'),_0x1f3372,_0x5728d0,_0xa370('0xbd'));logger['debug'](_0xa370('0xbe'),_0x1f3372,_0x5728d0,_0xa370('0xbd'),JSON[_0xa370('0x29')](_0x41083d));if(_0x4d13d6[_0xa370('0x77')][_0xa370('0x58')]==='twilio'){return _0x3fb7a8[_0xa370('0x2e')](_0x5728d0)[_0xa370('0x34')]('Content-Type','text/xml')[_0xa370('0x41')](_0xa370('0xbf'));}else{return _0x3fb7a8[_0xa370('0x2e')](_0x5728d0)[_0xa370('0x36')](_0x41083d);}}})['catch'](handleError(_0x3fb7a8,null));};exports[_0xa370('0xc0')]=function(_0x491496,_0x100cf5,_0x28818d){return db[_0xa370('0x46')][_0xa370('0x6e')]({'where':{'id':_0x491496[_0xa370('0x60')]['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x100cf5,null))[_0xa370('0x24')](function(_0x3435e1){if(_0x3435e1){return db['sequelize'][_0xa370('0xc1')](function(_0x326080){return db['SmsApplication'][_0xa370('0x3b')]({'where':{'SmsAccountId':_0x491496[_0xa370('0x60')]['id']},'transaction':_0x326080})['then'](function(_0x2830d1){var _0x3cb58c=_['map'](_0x491496['body'],function(_0x2a297e){_0x2a297e[_0xa370('0x6f')]=_0x491496[_0xa370('0x60')]['id'];return _0x2a297e;});return db[_0xa370('0x75')][_0xa370('0xc2')](_0x3cb58c,{'transaction':_0x326080});});})['then'](function(){return db[_0xa370('0x75')][_0xa370('0xc3')]({'where':{'SmsAccountId':_0x491496['params']['id']},'order':_0xa370('0x7a')});});}})[_0xa370('0x24')](respondWithResult(_0x100cf5,null))[_0xa370('0x63')](handleError(_0x100cf5,null));};exports['getApplications']=function(_0x4776b9,_0x1afa8f,_0x53731e){var _0x2aa2d0={};var _0x3685ed={};var _0x2b6409;var _0x48aa23;return db[_0xa370('0x46')]['findOne']({'where':{'id':_0x4776b9['params']['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x1afa8f,null))[_0xa370('0x24')](function(_0x2dda63){if(_0x2dda63){_0x2b6409=_0x2dda63;_0x3685ed[_0xa370('0x4a')]=_[_0xa370('0x4c')](db[_0xa370('0x75')][_0xa370('0x47')]);_0x3685ed[_0xa370('0x4b')]=_[_0xa370('0x4c')](_0x4776b9[_0xa370('0x4b')]);_0x3685ed[_0xa370('0x56')]=_[_0xa370('0x4d')](_0x3685ed['model'],_0x3685ed[_0xa370('0x4b')]);_0x2aa2d0[_0xa370('0x4f')]=_[_0xa370('0x4d')](_0x3685ed[_0xa370('0x4a')],qs[_0xa370('0x4e')](_0x4776b9[_0xa370('0x4b')][_0xa370('0x4e')]));_0x2aa2d0[_0xa370('0x4f')]=_0x2aa2d0['attributes'][_0xa370('0x50')]?_0x2aa2d0['attributes']:_0x3685ed[_0xa370('0x4a')];_0x2aa2d0['order']=qs[_0xa370('0x54')](_0x4776b9[_0xa370('0x4b')]['sort']);_0x2aa2d0[_0xa370('0x55')]=qs[_0xa370('0x56')](_[_0xa370('0x57')](_0x4776b9['query'],_0x3685ed['filters']));if(_0x4776b9[_0xa370('0x4b')][_0xa370('0x70')]){_0x2aa2d0[_0xa370('0x55')]=_['merge'](_0x2aa2d0[_0xa370('0x55')],{'$or':_[_0xa370('0x45')](_0x2aa2d0['attributes'],function(_0x414712){var _0x126766={};_0x126766[_0x414712]={'$like':'%'+_0x4776b9['query'][_0xa370('0x70')]+'%'};return _0x126766;})});}_0x2aa2d0=_['merge']({},_0x2aa2d0,_0x4776b9['options']);return _0x2b6409[_0xa370('0xc4')](_0x2aa2d0);}})[_0xa370('0x24')](function(_0xea3fc){if(_0xea3fc){_0x48aa23=_0xea3fc[_0xa370('0x50')];if(!_0x4776b9[_0xa370('0x4b')]['hasOwnProperty'](_0xa370('0x52'))){_0x2aa2d0[_0xa370('0x32')]=qs[_0xa370('0x32')](_0x4776b9[_0xa370('0x4b')][_0xa370('0x32')]);_0x2aa2d0[_0xa370('0x30')]=qs['offset'](_0x4776b9[_0xa370('0x4b')]['offset']);}return _0x2b6409[_0xa370('0xc4')](_0x2aa2d0);}})[_0xa370('0x24')](function(_0x1eb0f0){if(_0x1eb0f0){return _0x1eb0f0?{'count':_0x48aa23,'rows':_0x1eb0f0}:null;}})['then'](respondWithResult(_0x1afa8f,null))['catch'](handleError(_0x1afa8f,null));};exports['getInteractions']=function(_0x36705b,_0x5c115d,_0x5b4622){var _0xbacec6={'raw':![],'where':{}};var _0x578fcc={};var _0x4a0c73={'count':0x0,'rows':[]};return db['SmsAccount'][_0xa370('0x6e')]({'where':{'id':_0x36705b['params']['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x5c115d,null))[_0xa370('0x24')](function(_0x34dd44){if(_0x34dd44){_0x578fcc[_0xa370('0x4a')]=_[_0xa370('0x4c')](db['SmsInteraction'][_0xa370('0x47')]);_0x578fcc['query']=_[_0xa370('0x4c')](_0x36705b[_0xa370('0x4b')]);_0x578fcc[_0xa370('0x56')]=_[_0xa370('0x4d')](_0x578fcc[_0xa370('0x4a')],_0x578fcc[_0xa370('0x4b')]);_0xbacec6[_0xa370('0x4f')]=_[_0xa370('0x4d')](_0x578fcc[_0xa370('0x4a')],qs[_0xa370('0x4e')](_0x36705b[_0xa370('0x4b')][_0xa370('0x4e')]));_0xbacec6[_0xa370('0x4f')]=_0xbacec6[_0xa370('0x4f')][_0xa370('0x50')]?_0xbacec6[_0xa370('0x4f')]:_0x578fcc['model'];if(!_0x36705b['query'][_0xa370('0x51')](_0xa370('0x52'))){_0xbacec6[_0xa370('0x32')]=qs[_0xa370('0x32')](_0x36705b[_0xa370('0x4b')]['limit']);_0xbacec6['offset']=qs[_0xa370('0x30')](_0x36705b[_0xa370('0x4b')][_0xa370('0x30')]);}_0xbacec6[_0xa370('0x53')]=qs['sort'](_0x36705b[_0xa370('0x4b')][_0xa370('0x54')]);_0xbacec6[_0xa370('0x55')]=qs[_0xa370('0x56')](_[_0xa370('0x57')](_0x36705b['query'],_0x578fcc['filters']));_0xbacec6[_0xa370('0x55')][_0xa370('0x6f')]=_0x34dd44['id'];if(_0x36705b[_0xa370('0x4b')]['filter']){_0xbacec6[_0xa370('0x55')]=_[_0xa370('0x61')](_0xbacec6[_0xa370('0x55')],{'$or':_[_0xa370('0x45')](_0xbacec6[_0xa370('0x4f')],function(_0x2a44c5){var _0x434bff={};_0x434bff[_0x2a44c5]={'$like':'%'+_0x36705b[_0xa370('0x4b')][_0xa370('0x70')]+'%'};return _0x434bff;})});}_0xbacec6=_[_0xa370('0x61')]({},_0xbacec6,_0x36705b[_0xa370('0x5a')]);return db[_0xa370('0xa9')][_0xa370('0x33')]({'where':_0xbacec6[_0xa370('0x55')]})[_0xa370('0x24')](function(_0x2ac612){_0x4a0c73['count']=_0x2ac612;if(_0x36705b['query'][_0xa370('0x5b')]){_0xbacec6['include']=[{'model':db['CmContact'],'as':_0xa370('0xc5'),'required':![]},{'model':db[_0xa370('0xb6')],'as':_0xa370('0xc6'),'attributes':[_0xa370('0x40'),_0xa370('0xc7'),_0xa370('0xc8')],'required':![]},{'model':db[_0xa370('0xc9')],'as':'Tags','attributes':['id',_0xa370('0x40'),_0xa370('0xca')],'where':_0x36705b[_0xa370('0x4b')][_0xa370('0xcb')]?{'id':_0x36705b[_0xa370('0x4b')]['tag']}:undefined,'required':_0x36705b[_0xa370('0x4b')][_0xa370('0xcb')]?!![]:![]}];}return db[_0xa370('0xa9')][_0xa370('0x5d')](_0xbacec6);})[_0xa370('0x24')](function(_0x296d10){_0x4a0c73[_0xa370('0x5e')]=_0x296d10;return _0x4a0c73;});}})['then'](respondWithFilteredResult(_0x5c115d,_0xbacec6))[_0xa370('0x63')](handleError(_0x5c115d,null));};exports['send']=function(_0x41ee17,_0x29ac0d,_0x2f1fe4){var _0x38eb5c,_0x2cc3bd,_0x74b097;if(_[_0xa370('0x9f')](_0x41ee17[_0xa370('0x65')][_0xa370('0x65')])||_0x41ee17['body'][_0xa370('0x65')]===''){throw new db[(_0xa370('0x7d'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa370('0x9f')](_0x41ee17[_0xa370('0x65')]['to'])){throw new db[(_0xa370('0x7d'))][(_0xa370('0x7e'))](_0xa370('0xcc'));}_0x38eb5c=_0x41ee17[_0xa370('0x65')]['to'];return db[_0xa370('0x46')][_0xa370('0x62')]({'where':{'id':_0x41ee17[_0xa370('0x60')]['id']},'include':[{'model':db[_0xa370('0xa3')],'as':_0xa370('0xcd'),'include':[{'model':db['CmContact'],'as':_0xa370('0xa7'),'where':{'mobile':_0x38eb5c},'limit':0x1,'order':[['updatedAt',_0xa370('0xa4')]]}]}]})[_0xa370('0x24')](handleEntityNotFound(_0x29ac0d,null))[_0xa370('0x24')](function(_0x1882d5){if(_0x1882d5&&_0x1882d5[_0xa370('0xcd')]){_0x2cc3bd=_0x1882d5[_0xa370('0x3c')]({'plain':!![]});if(_0x2cc3bd[_0xa370('0xcd')]&&_0x2cc3bd[_0xa370('0xcd')][_0xa370('0xa7')]['length']){return _0x2cc3bd[_0xa370('0xcd')][_0xa370('0xa7')][0x0];}return db[_0xa370('0x7c')][_0xa370('0x64')](_[_0xa370('0x1b')](_0x41ee17['body'],{'firstName':_0x38eb5c,'mobile':_0x38eb5c,'phone':_0x38eb5c,'ListId':_0x2cc3bd[_0xa370('0x83')]}));}})[_0xa370('0x24')](handleEntityNotFound(_0x29ac0d,null))[_0xa370('0x24')](function(_0x16b44b){if(_0x16b44b){_0x74b097=_0x16b44b;return db['SmsInteraction'][_0xa370('0x62')]({'where':{'ContactId':_0x74b097['id'],'closed':![],'SmsAccountId':_0x2cc3bd['id']}})['then'](function(_0x10b957){if(_0x10b957){return[_0x10b957,![]];}return db['SmsInteraction'][_0xa370('0x64')]({'UserId':_0x41ee17['user']['id'],'ContactId':_0x74b097['id'],'SmsAccountId':_0x2cc3bd['id'],'phone':_0x38eb5c,'firstMsgDirection':_0xa370('0xce'),'Messages':[_[_0xa370('0x61')](_0x41ee17[_0xa370('0x65')],{'read':![],'body':_0x41ee17[_0xa370('0x65')][_0xa370('0x65')],'phone':_0x38eb5c,'SmsAccountId':_0x2cc3bd['id'],'UserId':_0x41ee17['user']['id'],'ContactId':_0x74b097['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0xa370('0x24')](function(_0x2e90e6){return[_0x2e90e6,!![]];});});}})[_0xa370('0xaa')](function(_0x16958c,_0x34affb){if(_0x34affb){return _0x16958c;}return db[_0xa370('0xb2')][_0xa370('0x64')](_['merge'](_0x41ee17[_0xa370('0x65')],{'read':![],'body':_0x41ee17[_0xa370('0x65')]['body'],'phone':_0x38eb5c,'SmsAccountId':_0x2cc3bd['id'],'SmsInteractionId':_0x16958c['id'],'UserId':_0x41ee17[_0xa370('0x66')]['id'],'ContactId':_0x74b097['id']}))[_0xa370('0x24')](function(_0x4ae5c9){_0x16958c[_0xa370('0xcf')][_0xa370('0xd0')]=[];_0x16958c['dataValues'][_0xa370('0xd0')]['push'](_0x4ae5c9['dataValues']);return _0x16958c;});})[_0xa370('0x24')](respondWithResult(_0x29ac0d,null))[_0xa370('0x63')](handleError(_0x29ac0d,null));};exports[_0xa370('0x2e')]=function(_0x54be0c,_0x5f04bf,_0x135126){if(_0x54be0c['body']['id']){delete _0x54be0c[_0xa370('0x65')]['id'];}var _0x356dce,_0x167775,_0x1685f6;return db[_0xa370('0x46')][_0xa370('0x62')]({'where':{'id':_0x54be0c['params']['id']}})['then'](handleEntityNotFound(_0x5f04bf,null))[_0xa370('0x24')](function(_0x24878c){if(_0x24878c){_0x1685f6=_0x24878c;logger[_0xa370('0xd1')](_0xa370('0x28'),_0xa370('0x2e'),'received\x20delivery\x20report\x20from',_0x24878c[_0xa370('0x58')],util[_0xa370('0xd2')](_0x54be0c[_0xa370('0x65')],{'showHidden':![],'depth':null}));switch(_0x24878c[_0xa370('0x58')]){case _0xa370('0x8b'):if(_0x54be0c[_0xa370('0x65')][_0xa370('0xd3')]&&_0x54be0c[_0xa370('0x65')][_0xa370('0x2e')]){_0x167775=_0x54be0c[_0xa370('0x65')][_0xa370('0x2e')];return db['SmsMessage']['find']({'where':{'messageId':_0x54be0c[_0xa370('0x65')][_0xa370('0xd3')]}});}break;case _0xa370('0x8e'):if(_0x54be0c['body'][_0xa370('0xd4')]&&_0x54be0c[_0xa370('0x65')][_0xa370('0xd5')]){_0x167775=_0x54be0c[_0xa370('0x65')][_0xa370('0xd5')];return db[_0xa370('0xb2')][_0xa370('0x62')]({'where':{'messageId':_0x54be0c['body'][_0xa370('0xd4')]}});}break;case _0xa370('0x8f'):if(_0x54be0c[_0xa370('0x65')][_0xa370('0x90')]&&_0x54be0c[_0xa370('0x65')][_0xa370('0xd6')]){_0x167775=_0x54be0c[_0xa370('0x65')][_0xa370('0xd6')];return db[_0xa370('0xb2')]['find']({'where':{'messageId':_0x54be0c[_0xa370('0x65')]['message_id']}});}break;case _0xa370('0x93'):var _0x398008=_0x54be0c[_0xa370('0x65')]['results'][0x0];if(_0x398008['messageId']&&_0x398008[_0xa370('0x2e')][_0xa370('0xd7')]==='DELIVERED'){_0x167775=_0x398008['status']['groupName'];return db[_0xa370('0xb2')][_0xa370('0x62')]({'where':{'messageId':_0x398008[_0xa370('0x89')]}});}break;case'clickatell':if(_0x54be0c[_0xa370('0x65')][_0xa370('0x89')]&&_0x54be0c[_0xa370('0x65')]['status']){_0x167775=_0x54be0c[_0xa370('0x65')][_0xa370('0x2e')];return db['SmsMessage'][_0xa370('0x62')]({'where':{'messageId':_0x54be0c['body'][_0xa370('0x89')]}});}break;case _0xa370('0x9b'):if(_0x54be0c[_0xa370('0x65')][0x0][_0xa370('0x2c')]['id']){_0x167775=_0x54be0c['body'][0x0]['type'];return db[_0xa370('0xb2')]['find']({'where':{'messageId':_0x54be0c[_0xa370('0x65')][0x0]['message']['id']}});}break;case _0xa370('0x9c'):if(_0x54be0c[_0xa370('0x65')][_0xa370('0xd8')]&&_0x54be0c[_0xa370('0x65')][_0xa370('0x2e')]){_0x167775=_0x54be0c[_0xa370('0x65')][_0xa370('0x2e')];return db['SmsMessage']['find']({'where':{'messageId':_0x54be0c[_0xa370('0x65')]['redif']}});}break;}}})[_0xa370('0x24')](handleEntityNotFound(_0x5f04bf,null))['then'](function(_0x43014a){if(_0x43014a){_0x356dce=_0x43014a;switch(_0x1685f6[_0xa370('0x58')]){case _0xa370('0x8b'):if(_0x167775==='DELIVERED'){return _0x356dce['update']({'read':!![]});}else{logger[_0xa370('0x2a')](_0xa370('0x28'),_0xa370('0x2e'),'skebby',util['inspect'](_0x54be0c['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x167775==='1'){return _0x356dce[_0xa370('0x3a')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa370('0x2e'),_0xa370('0x8b'),util[_0xa370('0xd2')](_0x54be0c['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x54be0c[_0xa370('0x65')][_0xa370('0xd9')]&&_0x167775>=0xc8&&_0x167775<=0xce){return _0x356dce['update']({'read':!![]});}else{logger[_0xa370('0x2a')](_0xa370('0x28'),'status',_0xa370('0x8f'),util[_0xa370('0xd2')](_0x54be0c[_0xa370('0x65')],{'showHidden':![],'depth':null}));}break;case _0xa370('0x93'):var _0x42bcdf=_0x54be0c['body'][_0xa370('0x94')][0x0];if(_0x42bcdf[_0xa370('0x2e')][_0xa370('0xd7')]===_0xa370('0xda')){return _0x356dce[_0xa370('0x3a')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa370('0x2e'),_0xa370('0x93'),util[_0xa370('0xd2')](_0x54be0c[_0xa370('0x65')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x167775==_0xa370('0xdb')||_0x167775==_0xa370('0xdc')){return _0x356dce[_0xa370('0x3a')]({'read':!![]});}else{logger[_0xa370('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa370('0x2e'),_0xa370('0x98'),util[_0xa370('0xd2')](_0x54be0c[_0xa370('0x65')],{'showHidden':![],'depth':null}));}break;case _0xa370('0x9b'):if(_0x167775==_0xa370('0xdd')){return _0x356dce[_0xa370('0x3a')]({'read':!![]});}else{logger[_0xa370('0x2a')](_0xa370('0x28'),_0xa370('0x2e'),_0xa370('0x9b'),util['inspect'](_0x54be0c['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x167775===_0xa370('0xde')||_0x167775===_0xa370('0xdf')){return _0x356dce['update']({'read':!![]});}else{logger[_0xa370('0x2a')](_0xa370('0x28'),'status',_0xa370('0x9c'),util[_0xa370('0xd2')](_0x54be0c['body'],{'showHidden':![],'depth':null}));}break;}return _0x356dce;}})[_0xa370('0x24')](respondWithResult(_0x5f04bf,null))[_0xa370('0x63')](handleError(_0x5f04bf,null));};exports['statusGet']=function(_0x558ff6,_0xe30b55,_0x2f18c3){var _0x3ca58e,_0x1976e0,_0x4a38f2;return db[_0xa370('0x46')][_0xa370('0x62')]({'where':{'id':_0x558ff6['params']['id']}})['then'](handleEntityNotFound(_0xe30b55,null))[_0xa370('0x24')](function(_0x5de016){if(_0x5de016){_0x4a38f2=_0x5de016;logger[_0xa370('0xd1')](_0xa370('0x28'),_0xa370('0x2e'),_0xa370('0xe0'),_0x5de016[_0xa370('0x58')],util[_0xa370('0xd2')](_0x558ff6[_0xa370('0x4b')],{'showHidden':![],'depth':null}));switch(_0x5de016['type']){case _0xa370('0x95'):if(_0x558ff6[_0xa370('0x4b')]['message-id']&&_0x558ff6['query'][_0xa370('0xe1')]){_0x1976e0=_0x558ff6[_0xa370('0x4b')]['state'];return db[_0xa370('0xb2')][_0xa370('0x62')]({'where':{'messageId':_0x558ff6[_0xa370('0x4b')][_0xa370('0xe2')]}});}break;}}})[_0xa370('0x24')](handleEntityNotFound(_0xe30b55,null))[_0xa370('0x24')](function(_0x2e00da){if(_0x2e00da){_0x3ca58e=_0x2e00da;switch(_0x4a38f2['type']){case _0xa370('0x95'):if(_0x1976e0==='2'||_0x1976e0==='6'){return _0x3ca58e[_0xa370('0x3a')]({'read':!![]});}else{logger[_0xa370('0x2a')](_0xa370('0x28'),_0xa370('0x2e'),_0xa370('0x95'),util['inspect'](_0x558ff6['query'],{'showHidden':![],'depth':null}));};break;}return _0x3ca58e;}})[_0xa370('0x24')](respondWithResult(_0xe30b55,null))[_0xa370('0x63')](handleError(_0xe30b55,null));};exports['addAgents']=function(_0x3fcdc0,_0x21a3b0,_0x354017){return db[_0xa370('0x46')][_0xa370('0x62')]({'where':{'id':_0x3fcdc0[_0xa370('0x60')]['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x21a3b0,null))['then'](function(_0x16591b){if(_0x16591b){return _0x16591b['addAgents'](_0x3fcdc0[_0xa370('0x65')]['ids'],_[_0xa370('0xa6')](_0x3fcdc0[_0xa370('0x65')],['ids','id'])||{})[_0xa370('0xaa')](function(_0x331c84){for(var _0x39d1f2=0x0;_0x39d1f2<_0x3fcdc0['body'][_0xa370('0x72')][_0xa370('0x50')];_0x39d1f2+=0x1){socket[_0xa370('0xe3')]('userSmsAccount:save',{'UserId':Number(_0x3fcdc0[_0xa370('0x65')][_0xa370('0x72')][_0x39d1f2]),'SmsAccountId':Number(_0x3fcdc0[_0xa370('0x60')]['id'])});}return _0x331c84;});}})[_0xa370('0x24')](respondWithResult(_0x21a3b0,null))['catch'](handleError(_0x21a3b0,null));};exports['removeAgents']=function(_0x3ab1df,_0x3a8eea,_0x2eedf6){return db['SmsAccount'][_0xa370('0x62')]({'where':{'id':_0x3ab1df[_0xa370('0x60')]['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x3a8eea,null))[_0xa370('0x24')](function(_0x2a693d){if(_0x2a693d){return _0x2a693d['removeAgents'](_0x3ab1df[_0xa370('0x4b')]['ids'])[_0xa370('0x24')](function(){if(_['isArray'](_0x3ab1df['query']['ids'])){for(var _0x18972e=0x0;_0x18972e<_0x3ab1df['query'][_0xa370('0x72')][_0xa370('0x50')];_0x18972e+=0x1){socket[_0xa370('0xe3')](_0xa370('0xe4'),{'UserId':Number(_0x3ab1df[_0xa370('0x4b')][_0xa370('0x72')][_0x18972e]),'SmsAccountId':Number(_0x3ab1df[_0xa370('0x60')]['id'])});}}else{socket[_0xa370('0xe3')](_0xa370('0xe4'),{'UserId':Number(_0x3ab1df[_0xa370('0x4b')][_0xa370('0x72')]),'SmsAccountId':Number(_0x3ab1df[_0xa370('0x60')]['id'])});}});}})[_0xa370('0x24')](respondWithStatusCode(_0x3a8eea,null))[_0xa370('0x63')](handleError(_0x3a8eea,null));};exports[_0xa370('0xe5')]=function(_0x478560,_0x13b0f0,_0x1826e8){var _0x313148={};var _0xf68afc={};var _0x13597e;var _0xd88ce8;return db[_0xa370('0x46')]['findOne']({'where':{'id':_0x478560['params']['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x13b0f0,null))['then'](function(_0x7eecba){if(_0x7eecba){_0x13597e=_0x7eecba;_0xf68afc[_0xa370('0x4a')]=_[_0xa370('0x4c')](db[_0xa370('0xb6')]['rawAttributes']);_0xf68afc[_0xa370('0x4b')]=_['keys'](_0x478560['query']);_0xf68afc[_0xa370('0x56')]=_[_0xa370('0x4d')](_0xf68afc[_0xa370('0x4a')],_0xf68afc[_0xa370('0x4b')]);_0x313148[_0xa370('0x4f')]=_[_0xa370('0x4d')](_0xf68afc[_0xa370('0x4a')],qs[_0xa370('0x4e')](_0x478560['query'][_0xa370('0x4e')]));_0x313148[_0xa370('0x4f')]=_0x313148[_0xa370('0x4f')][_0xa370('0x50')]?_0x313148[_0xa370('0x4f')]:_0xf68afc['model'];_0x313148[_0xa370('0x53')]=qs[_0xa370('0x54')](_0x478560[_0xa370('0x4b')][_0xa370('0x54')]);_0x313148[_0xa370('0x55')]=qs['filters'](_[_0xa370('0x57')](_0x478560['query'],_0xf68afc[_0xa370('0x56')]));if(_0x478560[_0xa370('0x4b')][_0xa370('0x70')]){_0x313148[_0xa370('0x55')]=_[_0xa370('0x61')](_0x313148[_0xa370('0x55')],{'$or':_[_0xa370('0x45')](_0x313148['attributes'],function(_0xbcb6e4){var _0x4624da={};_0x4624da[_0xbcb6e4]={'$like':'%'+_0x478560[_0xa370('0x4b')][_0xa370('0x70')]+'%'};return _0x4624da;})});}_0x313148=_['merge']({},_0x313148,_0x478560[_0xa370('0x5a')]);return _0x13597e[_0xa370('0xe5')](_0x313148);}})[_0xa370('0x24')](function(_0x17a11b){if(_0x17a11b){_0xd88ce8=_0x17a11b[_0xa370('0x50')];if(!_0x478560[_0xa370('0x4b')][_0xa370('0x51')](_0xa370('0x52'))){_0x313148[_0xa370('0x32')]=qs[_0xa370('0x32')](_0x478560[_0xa370('0x4b')][_0xa370('0x32')]);_0x313148['offset']=qs[_0xa370('0x30')](_0x478560[_0xa370('0x4b')][_0xa370('0x30')]);}return _0x13597e[_0xa370('0xe5')](_0x313148);}})['then'](function(_0x378bff){if(_0x378bff){return _0x378bff?{'count':_0xd88ce8,'rows':_0x378bff}:null;}})[_0xa370('0x24')](respondWithResult(_0x13b0f0,null))['catch'](handleError(_0x13b0f0,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 948e910..513ea5b 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 _0x9e31=['setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x45d0a8,_0x402166){var _0x47bf43=function(_0x25185e){while(--_0x25185e){_0x45d0a8['push'](_0x45d0a8['shift']());}};_0x47bf43(++_0x402166);}(_0x9e31,0x141));var _0x19e3=function(_0x3d7a03,_0xff1b43){_0x3d7a03=_0x3d7a03-0x0;var _0x5a6749=_0x9e31[_0x3d7a03];return _0x5a6749;};'use strict';var EventEmitter=require(_0x19e3('0x0'));var SmsAccount=require(_0x19e3('0x1'))['db'][_0x19e3('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x19e3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x19e3('0x4'),'afterDestroy':_0x19e3('0x5')};function emitEvent(_0x39b0ed){return function(_0x3bda06,_0x40258b,_0x27ca76){SmsAccountEvents[_0x19e3('0x6')](_0x39b0ed+':'+_0x3bda06['id'],_0x3bda06);SmsAccountEvents[_0x19e3('0x6')](_0x39b0ed,_0x3bda06);_0x27ca76(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x19e3('0x7')](e,emitEvent(event));}}module[_0x19e3('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xd228=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x7a78d7,_0x2ad978){var _0x5b05d1=function(_0x302516){while(--_0x302516){_0x7a78d7['push'](_0x7a78d7['shift']());}};_0x5b05d1(++_0x2ad978);}(_0xd228,0x110));var _0x8d22=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xd228[_0x1abb09];return _0xea1c07;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x8d22('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8d22('0x1')](0x0);var events={'afterCreate':_0x8d22('0x2'),'afterUpdate':_0x8d22('0x3'),'afterDestroy':_0x8d22('0x4')};function emitEvent(_0x3c7959){return function(_0x25646d,_0x5707ba,_0x543f3a){SmsAccountEvents[_0x8d22('0x5')](_0x3c7959+':'+_0x25646d['id'],_0x25646d);SmsAccountEvents[_0x8d22('0x5')](_0x3c7959,_0x25646d);_0x543f3a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x8d22('0x6')](e,emitEvent(event));}}module[_0x8d22('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index ebc2886..f7c7b62 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 _0x1d54=['request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x488304,_0x5b5b0e){var _0x51f958=function(_0xdc55ce){while(--_0xdc55ce){_0x488304['push'](_0x488304['shift']());}};_0x51f958(++_0x5b5b0e);}(_0x1d54,0x1ad));var _0x41d5=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0x1d54[_0x1cd674];return _0x27928f;};'use strict';var _=require(_0x41d5('0x0'));var util=require(_0x41d5('0x1'));var logger=require(_0x41d5('0x2'))(_0x41d5('0x3'));var moment=require(_0x41d5('0x4'));var BPromise=require('bluebird');var rp=require(_0x41d5('0x5'));var fs=require('fs');var path=require(_0x41d5('0x6'));var rimraf=require(_0x41d5('0x7'));var config=require(_0x41d5('0x8'));var attributes=require(_0x41d5('0x9'));module[_0x41d5('0xa')]=function(_0x501040,_0x530f42){return _0x501040[_0x41d5('0xb')](_0x41d5('0xc'),attributes,{'tableName':_0x41d5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4539=['define','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0x1d086f,_0x10d8c9){var _0x3a2538=function(_0x4c54b0){while(--_0x4c54b0){_0x1d086f['push'](_0x1d086f['shift']());}};_0x3a2538(++_0x10d8c9);}(_0x4539,0xf1));var _0x9453=function(_0xfb2ed7,_0x3feb22){_0xfb2ed7=_0xfb2ed7-0x0;var _0x2f0abb=_0x4539[_0xfb2ed7];return _0x2f0abb;};'use strict';var _=require(_0x9453('0x0'));var util=require(_0x9453('0x1'));var logger=require(_0x9453('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9453('0x3'));var rp=require(_0x9453('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9453('0x5'));var config=require(_0x9453('0x6'));var attributes=require(_0x9453('0x7'));module[_0x9453('0x8')]=function(_0x2b0a7d,_0x3b7ed1){return _0x2b0a7d[_0x9453('0x9')]('SmsAccount',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 8bd1b03..bc240e3 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 _0x413d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','find','options','raw','where','attributes','include','model','map','ShowSmsAccount','lodash','util'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x413d,0xca));var _0xd413=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x413d[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0xd413('0x0'));var util=require(_0xd413('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd413('0x2'));var logger=require(_0xd413('0x3'))(_0xd413('0x4'));var config=require(_0xd413('0x5'));var jayson=require(_0xd413('0x6'));var client=jayson['client'][_0xd413('0x7')]({'port':0x232a});config[_0xd413('0x8')]=_['defaults'](config['redis'],{'host':_0xd413('0x9'),'port':0x18eb});var socket=require(_0xd413('0xa'))(new Redis(config[_0xd413('0x8')]));require(_0xd413('0xb'))[_0xd413('0xc')](socket);function respondWithRpcPromise(_0x1c591f,_0x3ba077,_0x3f4f0e){return new BPromise(function(_0x33a137,_0xfd176c){return client[_0xd413('0xd')](_0x1c591f,_0x3f4f0e)[_0xd413('0xe')](function(_0x3bc1ae){logger['info'](_0xd413('0xf'),_0x3ba077,'request\x20sent');logger[_0xd413('0x10')](_0xd413('0x11'),_0x3ba077,_0xd413('0x12'),JSON[_0xd413('0x13')](_0x3bc1ae));if(_0x3bc1ae[_0xd413('0x14')]){if(_0x3bc1ae[_0xd413('0x14')]['code']===0x1f4){logger[_0xd413('0x14')](_0xd413('0xf'),_0x3ba077,_0x3bc1ae['error'][_0xd413('0x15')]);return _0xfd176c(_0x3bc1ae[_0xd413('0x14')][_0xd413('0x15')]);}logger[_0xd413('0x14')]('SmsAccount,\x20%s,\x20%s',_0x3ba077,_0x3bc1ae[_0xd413('0x14')][_0xd413('0x15')]);return _0x33a137(_0x3bc1ae['error'][_0xd413('0x15')]);}else{logger[_0xd413('0x16')](_0xd413('0xf'),_0x3ba077,'request\x20sent');_0x33a137(_0x3bc1ae[_0xd413('0x17')][_0xd413('0x15')]);}})[_0xd413('0x18')](function(_0x7feb9a){logger[_0xd413('0x14')](_0xd413('0xf'),_0x3ba077,_0x7feb9a);_0xfd176c(_0x7feb9a);});});}exports['ShowSmsAccount']=function(_0x4d0dce){var _0x571fce=this;return new Promise(function(_0x35b50c,_0x2705b4){return db['SmsAccount'][_0xd413('0x19')]({'raw':_0x4d0dce[_0xd413('0x1a')]?_0x4d0dce['options'][_0xd413('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d0dce[_0xd413('0x1a')]?_0x4d0dce[_0xd413('0x1a')][_0xd413('0x1c')]||null:null,'attributes':_0x4d0dce['options']?_0x4d0dce[_0xd413('0x1a')][_0xd413('0x1d')]||null:null,'include':_0x4d0dce['options']?_0x4d0dce[_0xd413('0x1a')][_0xd413('0x1e')]?_['map'](_0x4d0dce['options'][_0xd413('0x1e')],function(_0x471457){return{'model':db[_0x471457[_0xd413('0x1f')]],'as':_0x471457['as'],'attributes':_0x471457[_0xd413('0x1d')],'include':_0x471457[_0xd413('0x1e')]?_['map'](_0x471457[_0xd413('0x1e')],function(_0x3769f6){return{'model':db[_0x3769f6[_0xd413('0x1f')]],'as':_0x3769f6['as'],'attributes':_0x3769f6[_0xd413('0x1d')],'include':_0x3769f6[_0xd413('0x1e')]?_[_0xd413('0x20')](_0x3769f6[_0xd413('0x1e')],function(_0xc1e353){return{'model':db[_0xc1e353[_0xd413('0x1f')]],'as':_0xc1e353['as'],'attributes':_0xc1e353[_0xd413('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x121dda){logger[_0xd413('0x16')](_0xd413('0x21'),_0x4d0dce);logger[_0xd413('0x10')](_0xd413('0x21'),_0x4d0dce,JSON[_0xd413('0x13')](_0x121dda));_0x35b50c(_0x121dda);})[_0xd413('0x18')](function(_0x1b2cb9){logger['error']('ShowSmsAccount',_0x1b2cb9['message'],_0x4d0dce);_0x2705b4(_0x571fce[_0xd413('0x14')](0x1f4,_0x1b2cb9[_0xd413('0x15')]));});});}; \ No newline at end of file +var _0x8fe9=['include','map','attributes','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where'];(function(_0x379cb2,_0x5aa51e){var _0x10efa6=function(_0x9e7c7c){while(--_0x9e7c7c){_0x379cb2['push'](_0x379cb2['shift']());}};_0x10efa6(++_0x5aa51e);}(_0x8fe9,0x73));var _0x98fe=function(_0x367361,_0x311488){_0x367361=_0x367361-0x0;var _0x195d2d=_0x8fe9[_0x367361];return _0x195d2d;};'use strict';var _=require(_0x98fe('0x0'));var util=require(_0x98fe('0x1'));var moment=require('moment');var BPromise=require(_0x98fe('0x2'));var rs=require(_0x98fe('0x3'));var fs=require('fs');var Redis=require(_0x98fe('0x4'));var db=require(_0x98fe('0x5'))['db'];var utils=require(_0x98fe('0x6'));var logger=require('../../config/logger')(_0x98fe('0x7'));var config=require('../../config/environment');var jayson=require(_0x98fe('0x8'));var client=jayson[_0x98fe('0x9')][_0x98fe('0xa')]({'port':0x232a});config[_0x98fe('0xb')]=_[_0x98fe('0xc')](config[_0x98fe('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x98fe('0xd'))(new Redis(config[_0x98fe('0xb')]));require(_0x98fe('0xe'))[_0x98fe('0xf')](socket);function respondWithRpcPromise(_0x401571,_0x357a54,_0x25d11a){return new BPromise(function(_0x3cc706,_0x3a3613){return client['request'](_0x401571,_0x25d11a)[_0x98fe('0x10')](function(_0x45ce48){logger[_0x98fe('0x11')](_0x98fe('0x12'),_0x357a54,'request\x20sent');logger[_0x98fe('0x13')](_0x98fe('0x14'),_0x357a54,_0x98fe('0x15'),JSON[_0x98fe('0x16')](_0x45ce48));if(_0x45ce48[_0x98fe('0x17')]){if(_0x45ce48[_0x98fe('0x17')]['code']===0x1f4){logger[_0x98fe('0x17')](_0x98fe('0x12'),_0x357a54,_0x45ce48[_0x98fe('0x17')]['message']);return _0x3a3613(_0x45ce48[_0x98fe('0x17')][_0x98fe('0x18')]);}logger['error'](_0x98fe('0x12'),_0x357a54,_0x45ce48[_0x98fe('0x17')][_0x98fe('0x18')]);return _0x3cc706(_0x45ce48['error']['message']);}else{logger[_0x98fe('0x11')](_0x98fe('0x12'),_0x357a54,_0x98fe('0x15'));_0x3cc706(_0x45ce48[_0x98fe('0x19')]['message']);}})[_0x98fe('0x1a')](function(_0x505b48){logger[_0x98fe('0x17')](_0x98fe('0x12'),_0x357a54,_0x505b48);_0x3a3613(_0x505b48);});});}exports[_0x98fe('0x1b')]=function(_0x2c1340){var _0x1eb25d=this;return new Promise(function(_0x2905ff,_0x241345){return db[_0x98fe('0x1c')][_0x98fe('0x1d')]({'raw':_0x2c1340[_0x98fe('0x1e')]?_0x2c1340[_0x98fe('0x1e')][_0x98fe('0x1f')]===undefined?!![]:![]:!![],'where':_0x2c1340[_0x98fe('0x1e')]?_0x2c1340[_0x98fe('0x1e')][_0x98fe('0x20')]||null:null,'attributes':_0x2c1340[_0x98fe('0x1e')]?_0x2c1340[_0x98fe('0x1e')]['attributes']||null:null,'include':_0x2c1340[_0x98fe('0x1e')]?_0x2c1340[_0x98fe('0x1e')][_0x98fe('0x21')]?_[_0x98fe('0x22')](_0x2c1340['options'][_0x98fe('0x21')],function(_0x5ad128){return{'model':db[_0x5ad128['model']],'as':_0x5ad128['as'],'attributes':_0x5ad128[_0x98fe('0x23')],'include':_0x5ad128[_0x98fe('0x21')]?_['map'](_0x5ad128[_0x98fe('0x21')],function(_0x44e19c){return{'model':db[_0x44e19c[_0x98fe('0x24')]],'as':_0x44e19c['as'],'attributes':_0x44e19c['attributes'],'include':_0x44e19c['include']?_[_0x98fe('0x22')](_0x44e19c['include'],function(_0x58c8e7){return{'model':db[_0x58c8e7[_0x98fe('0x24')]],'as':_0x58c8e7['as'],'attributes':_0x58c8e7[_0x98fe('0x23')]};}):[]};}):[]};}):[]:[]})[_0x98fe('0x10')](function(_0x22bf4c){logger[_0x98fe('0x11')](_0x98fe('0x1b'),_0x2c1340);logger['debug'](_0x98fe('0x1b'),_0x2c1340,JSON[_0x98fe('0x16')](_0x22bf4c));_0x2905ff(_0x22bf4c);})[_0x98fe('0x1a')](function(_0x3977eb){logger[_0x98fe('0x17')](_0x98fe('0x1b'),_0x3977eb[_0x98fe('0x18')],_0x2c1340);_0x241345(_0x1eb25d[_0x98fe('0x17')](0x1f4,_0x3977eb[_0x98fe('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 8fd93c5..338918f 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 001bb49..3564f9b 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x2952ee,_0x5901df){var _0x26ed1d=function(_0x471a48){while(--_0x471a48){_0x2952ee['push'](_0x2952ee['shift']());}};_0x26ed1d(++_0x5901df);}(_0x3e74,0x175));var _0x43e7=function(_0x20d4aa,_0x5590e0){_0x20d4aa=_0x20d4aa-0x0;var _0x47012e=_0x3e74[_0x20d4aa];return _0x47012e;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x54f1dc,_0x863c6b){var _0x257fcb=function(_0x19079c){while(--_0x19079c){_0x54f1dc['push'](_0x54f1dc['shift']());}};_0x257fcb(++_0x863c6b);}(_0x3e74,0x175));var _0x43e7=function(_0x347c8c,_0x584c6b){_0x347c8c=_0x347c8c-0x0;var _0x1e9223=_0x3e74[_0x347c8c];return _0x1e9223;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index ff33b8f..f2c541e 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 _0x05cc=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x5e07a7,_0x1438b3){var _0x22ced5=function(_0x7c975b){while(--_0x7c975b){_0x5e07a7['push'](_0x5e07a7['shift']());}};_0x22ced5(++_0x1438b3);}(_0x05cc,0x19b));var _0xc05c=function(_0x53b7d9,_0x3b8436){_0x53b7d9=_0x53b7d9-0x0;var _0x1c30f0=_0x05cc[_0x53b7d9];return _0x1c30f0;};'use strict';var Sequelize=require(_0xc05c('0x0'));module[_0xc05c('0x1')]={'priority':{'type':Sequelize[_0xc05c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc05c('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xc05c('0x4')]()},'description':{'type':Sequelize[_0xc05c('0x3')]},'interval':{'type':Sequelize[_0xc05c('0x3')],'defaultValue':_0xc05c('0x5')}}; \ No newline at end of file +var _0x489a=['*,*,*,*','sequelize','INTEGER','noop','STRING'];(function(_0x1e37e8,_0x18a60c){var _0x494689=function(_0x469944){while(--_0x469944){_0x1e37e8['push'](_0x1e37e8['shift']());}};_0x494689(++_0x18a60c);}(_0x489a,0x123));var _0xa489=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x489a[_0x351509];return _0x4e9861;};'use strict';var Sequelize=require(_0xa489('0x0'));module['exports']={'priority':{'type':Sequelize[_0xa489('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa489('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa489('0x3')]},'interval':{'type':Sequelize[_0xa489('0x3')],'defaultValue':_0xa489('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 09a4e1b..3eb1586 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 _0xabe3=['destroy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','SmsApplication','rawAttributes','type','model','query','intersection','fields','attributes','length','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','rows','catch','show','keys','merge','options','find','create','body','params'];(function(_0x451e96,_0x2c8989){var _0x227c95=function(_0x36376c){while(--_0x36376c){_0x451e96['push'](_0x451e96['shift']());}};_0x227c95(++_0x2c8989);}(_0xabe3,0x1eb));var _0x3abe=function(_0x577f91,_0x16d3cd){_0x577f91=_0x577f91-0x0;var _0x3a7144=_0xabe3[_0x577f91];return _0x3a7144;};'use strict';var emlformat=require(_0x3abe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3abe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3abe('0x2'));var moment=require(_0x3abe('0x3'));var BPromise=require(_0x3abe('0x4'));var Mustache=require(_0x3abe('0x5'));var util=require('util');var path=require(_0x3abe('0x6'));var sox=require(_0x3abe('0x7'));var csv=require(_0x3abe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3abe('0x9'));var squel=require(_0x3abe('0xa'));var crypto=require(_0x3abe('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3abe('0xc'));var toCsv=require(_0x3abe('0x8'));var querystring=require(_0x3abe('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3abe('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3abe('0xf'));var hardwareService=require(_0x3abe('0x10'));var logger=require('../../config/logger')(_0x3abe('0x11'));var utils=require(_0x3abe('0x12'));var config=require(_0x3abe('0x13'));var licenseUtil=require(_0x3abe('0x14'));var db=require(_0x3abe('0x15'))['db'];function respondWithStatusCode(_0x3fe7fb,_0xa40a02){_0xa40a02=_0xa40a02||0xcc;return function(_0x58e7f9){if(_0x58e7f9){return _0x3fe7fb['sendStatus'](_0xa40a02);}return _0x3fe7fb[_0x3abe('0x16')](_0xa40a02)[_0x3abe('0x17')]();};}function respondWithResult(_0x3e0fb3,_0x275f3f){_0x275f3f=_0x275f3f||0xc8;return function(_0x2236d7){if(_0x2236d7){return _0x3e0fb3[_0x3abe('0x16')](_0x275f3f)[_0x3abe('0x18')](_0x2236d7);}};}function respondWithFilteredResult(_0x2e87df,_0x1279b8){return function(_0x1bc3a0){if(_0x1bc3a0){var _0x39a969=typeof _0x1279b8['offset']===_0x3abe('0x19')&&typeof _0x1279b8[_0x3abe('0x1a')]==='undefined';var _0x5014a1=_0x1bc3a0[_0x3abe('0x1b')];var _0x4b0f95=_0x39a969?0x0:_0x1279b8[_0x3abe('0x1c')];var _0x458519=_0x39a969?_0x1bc3a0[_0x3abe('0x1b')]:_0x1279b8['offset']+_0x1279b8[_0x3abe('0x1a')];var _0x33c42f;if(_0x458519>=_0x5014a1){_0x458519=_0x5014a1;_0x33c42f=0xc8;}else{_0x33c42f=0xce;}_0x2e87df['status'](_0x33c42f);return _0x2e87df[_0x3abe('0x1d')](_0x3abe('0x1e'),_0x4b0f95+'-'+_0x458519+'/'+_0x5014a1)[_0x3abe('0x18')](_0x1bc3a0);}return null;};}function patchUpdates(_0x48f0ba){return function(_0x577642){try{jsonpatch[_0x3abe('0x1f')](_0x577642,_0x48f0ba,!![]);}catch(_0x1a7cab){return BPromise[_0x3abe('0x20')](_0x1a7cab);}return _0x577642[_0x3abe('0x21')]();};}function saveUpdates(_0x28bf63,_0xbf6161){return function(_0x51aadc){if(_0x51aadc){return _0x51aadc['update'](_0x28bf63)[_0x3abe('0x22')](function(_0x29b421){return _0x29b421;});}return null;};}function removeEntity(_0x1d2af7,_0x5a89b3){return function(_0x4e091e){if(_0x4e091e){return _0x4e091e['destroy']()[_0x3abe('0x22')](function(){_0x1d2af7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x510ba5,_0x3f6c9d){return function(_0x502a9a){if(!_0x502a9a){_0x510ba5[_0x3abe('0x23')](0x194);}return _0x502a9a;};}function handleError(_0x28506a,_0xe0da19){_0xe0da19=_0xe0da19||0x1f4;return function(_0x25b191){logger[_0x3abe('0x24')](_0x25b191[_0x3abe('0x25')]);if(_0x25b191[_0x3abe('0x26')]){delete _0x25b191[_0x3abe('0x26')];}_0x28506a['status'](_0xe0da19)[_0x3abe('0x27')](_0x25b191);};}exports[_0x3abe('0x28')]=function(_0x5d4370,_0x52e79f){var _0x55b7c={},_0x277339={},_0x6d60b9={'count':0x0,'rows':[]};var _0x1f8aaa=_[_0x3abe('0x29')](db[_0x3abe('0x2a')][_0x3abe('0x2b')],function(_0x2bdf26){return{'name':_0x2bdf26['fieldName'],'type':_0x2bdf26[_0x3abe('0x2c')]['key']};});_0x277339[_0x3abe('0x2d')]=_[_0x3abe('0x29')](_0x1f8aaa,'name');_0x277339[_0x3abe('0x2e')]=_['keys'](_0x5d4370['query']);_0x277339['filters']=_[_0x3abe('0x2f')](_0x277339[_0x3abe('0x2d')],_0x277339[_0x3abe('0x2e')]);_0x55b7c['attributes']=_['intersection'](_0x277339[_0x3abe('0x2d')],qs[_0x3abe('0x30')](_0x5d4370['query'][_0x3abe('0x30')]));_0x55b7c[_0x3abe('0x31')]=_0x55b7c[_0x3abe('0x31')][_0x3abe('0x32')]?_0x55b7c[_0x3abe('0x31')]:_0x277339[_0x3abe('0x2d')];if(!_0x5d4370[_0x3abe('0x2e')]['hasOwnProperty']('nolimit')){_0x55b7c['limit']=qs[_0x3abe('0x1a')](_0x5d4370[_0x3abe('0x2e')][_0x3abe('0x1a')]);_0x55b7c[_0x3abe('0x1c')]=qs[_0x3abe('0x1c')](_0x5d4370[_0x3abe('0x2e')][_0x3abe('0x1c')]);}_0x55b7c['order']=qs[_0x3abe('0x33')](_0x5d4370['query'][_0x3abe('0x33')]);_0x55b7c[_0x3abe('0x34')]=qs[_0x3abe('0x35')](_[_0x3abe('0x36')](_0x5d4370[_0x3abe('0x2e')],_0x277339[_0x3abe('0x35')]),_0x1f8aaa);if(_0x5d4370[_0x3abe('0x2e')][_0x3abe('0x37')]){_0x55b7c[_0x3abe('0x34')]=_['merge'](_0x55b7c[_0x3abe('0x34')],{'$or':_[_0x3abe('0x29')](_0x1f8aaa,function(_0x4b0f97){if(_0x4b0f97['type']!==_0x3abe('0x38')){var _0x506cc6={};_0x506cc6[_0x4b0f97[_0x3abe('0x26')]]={'$like':'%'+_0x5d4370[_0x3abe('0x2e')][_0x3abe('0x37')]+'%'};return _0x506cc6;}})});}_0x55b7c=_['merge']({},_0x55b7c,_0x5d4370['options']);var _0x5e2c07={'where':_0x55b7c[_0x3abe('0x34')]};return db[_0x3abe('0x2a')][_0x3abe('0x1b')](_0x5e2c07)[_0x3abe('0x22')](function(_0x50891d){_0x6d60b9[_0x3abe('0x1b')]=_0x50891d;if(_0x5d4370['query'][_0x3abe('0x39')]){_0x55b7c[_0x3abe('0x3a')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x55b7c);})[_0x3abe('0x22')](function(_0x1ca58a){_0x6d60b9[_0x3abe('0x3b')]=_0x1ca58a;return _0x6d60b9;})[_0x3abe('0x22')](respondWithFilteredResult(_0x52e79f,_0x55b7c))[_0x3abe('0x3c')](handleError(_0x52e79f,null));};exports[_0x3abe('0x3d')]=function(_0x5c94ea,_0x328c58){var _0x4f3b44={'raw':!![],'where':{'id':_0x5c94ea['params']['id']}},_0x1be8ce={};_0x1be8ce['model']=_[_0x3abe('0x3e')](db[_0x3abe('0x2a')][_0x3abe('0x2b')]);_0x1be8ce[_0x3abe('0x2e')]=_[_0x3abe('0x3e')](_0x5c94ea[_0x3abe('0x2e')]);_0x1be8ce['filters']=_[_0x3abe('0x2f')](_0x1be8ce[_0x3abe('0x2d')],_0x1be8ce[_0x3abe('0x2e')]);_0x4f3b44['attributes']=_[_0x3abe('0x2f')](_0x1be8ce[_0x3abe('0x2d')],qs['fields'](_0x5c94ea[_0x3abe('0x2e')]['fields']));_0x4f3b44[_0x3abe('0x31')]=_0x4f3b44[_0x3abe('0x31')][_0x3abe('0x32')]?_0x4f3b44[_0x3abe('0x31')]:_0x1be8ce['model'];if(_0x5c94ea[_0x3abe('0x2e')][_0x3abe('0x39')]){_0x4f3b44[_0x3abe('0x3a')]=[{'all':!![]}];}_0x4f3b44=_[_0x3abe('0x3f')]({},_0x4f3b44,_0x5c94ea[_0x3abe('0x40')]);return db['SmsApplication'][_0x3abe('0x41')](_0x4f3b44)[_0x3abe('0x22')](handleEntityNotFound(_0x328c58,null))[_0x3abe('0x22')](respondWithResult(_0x328c58,null))['catch'](handleError(_0x328c58,null));};exports[_0x3abe('0x42')]=function(_0x50379e,_0xd888cc){return db[_0x3abe('0x2a')][_0x3abe('0x42')](_0x50379e['body'],{})[_0x3abe('0x22')](respondWithResult(_0xd888cc,0xc9))[_0x3abe('0x3c')](handleError(_0xd888cc,null));};exports['update']=function(_0x22c412,_0xc63184){if(_0x22c412[_0x3abe('0x43')]['id']){delete _0x22c412['body']['id'];}return db[_0x3abe('0x2a')][_0x3abe('0x41')]({'where':{'id':_0x22c412[_0x3abe('0x44')]['id']}})[_0x3abe('0x22')](handleEntityNotFound(_0xc63184,null))['then'](saveUpdates(_0x22c412[_0x3abe('0x43')],null))['then'](respondWithResult(_0xc63184,null))[_0x3abe('0x3c')](handleError(_0xc63184,null));};exports[_0x3abe('0x45')]=function(_0x5f1281,_0x2f8379){return db[_0x3abe('0x2a')]['find']({'where':{'id':_0x5f1281[_0x3abe('0x44')]['id']}})['then'](handleEntityNotFound(_0x2f8379,null))[_0x3abe('0x22')](removeEntity(_0x2f8379,null))[_0x3abe('0x3c')](handleError(_0x2f8379,null));}; \ No newline at end of file +var _0x4b5e=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','error','name','send','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','SmsApplication','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x2b051e,_0x3c8d8e){var _0x2d5b3c=function(_0x1ae393){while(--_0x1ae393){_0x2b051e['push'](_0x2b051e['shift']());}};_0x2d5b3c(++_0x3c8d8e);}(_0x4b5e,0x179));var _0xe4b5=function(_0x14e36b,_0x569c2a){_0x14e36b=_0x14e36b-0x0;var _0x11bcd5=_0x4b5e[_0x14e36b];return _0x11bcd5;};'use strict';var emlformat=require(_0xe4b5('0x0'));var rimraf=require(_0xe4b5('0x1'));var zipdir=require(_0xe4b5('0x2'));var jsonpatch=require(_0xe4b5('0x3'));var rp=require(_0xe4b5('0x4'));var moment=require(_0xe4b5('0x5'));var BPromise=require(_0xe4b5('0x6'));var Mustache=require(_0xe4b5('0x7'));var util=require('util');var path=require(_0xe4b5('0x8'));var sox=require(_0xe4b5('0x9'));var csv=require(_0xe4b5('0xa'));var ejs=require(_0xe4b5('0xb'));var fs=require('fs');var fs_extra=require(_0xe4b5('0xc'));var _=require(_0xe4b5('0xd'));var squel=require(_0xe4b5('0xe'));var crypto=require(_0xe4b5('0xf'));var jsforce=require(_0xe4b5('0x10'));var deskjs=require(_0xe4b5('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe4b5('0x12'));var Papa=require(_0xe4b5('0x13'));var Redis=require('ioredis');var authService=require(_0xe4b5('0x14'));var qs=require(_0xe4b5('0x15'));var as=require(_0xe4b5('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe4b5('0x17'))(_0xe4b5('0x18'));var utils=require(_0xe4b5('0x19'));var config=require(_0xe4b5('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4b5('0x1b'))['db'];function respondWithStatusCode(_0x214e83,_0x160ac5){_0x160ac5=_0x160ac5||0xcc;return function(_0x17698f){if(_0x17698f){return _0x214e83[_0xe4b5('0x1c')](_0x160ac5);}return _0x214e83[_0xe4b5('0x1d')](_0x160ac5)['end']();};}function respondWithResult(_0x11c53a,_0x2c0fc0){_0x2c0fc0=_0x2c0fc0||0xc8;return function(_0x181d35){if(_0x181d35){return _0x11c53a[_0xe4b5('0x1d')](_0x2c0fc0)[_0xe4b5('0x1e')](_0x181d35);}};}function respondWithFilteredResult(_0xc4ec19,_0x2b1648){return function(_0x3ed54a){if(_0x3ed54a){var _0x16d417=typeof _0x2b1648[_0xe4b5('0x1f')]===_0xe4b5('0x20')&&typeof _0x2b1648[_0xe4b5('0x21')]===_0xe4b5('0x20');var _0x1143dc=_0x3ed54a[_0xe4b5('0x22')];var _0x5a0261=_0x16d417?0x0:_0x2b1648[_0xe4b5('0x1f')];var _0x2c462c=_0x16d417?_0x3ed54a['count']:_0x2b1648['offset']+_0x2b1648[_0xe4b5('0x21')];var _0x38cc9d;if(_0x2c462c>=_0x1143dc){_0x2c462c=_0x1143dc;_0x38cc9d=0xc8;}else{_0x38cc9d=0xce;}_0xc4ec19[_0xe4b5('0x1d')](_0x38cc9d);return _0xc4ec19[_0xe4b5('0x23')]('Content-Range',_0x5a0261+'-'+_0x2c462c+'/'+_0x1143dc)[_0xe4b5('0x1e')](_0x3ed54a);}return null;};}function patchUpdates(_0x273f89){return function(_0x8dac5d){try{jsonpatch[_0xe4b5('0x24')](_0x8dac5d,_0x273f89,!![]);}catch(_0x22309d){return BPromise[_0xe4b5('0x25')](_0x22309d);}return _0x8dac5d[_0xe4b5('0x26')]();};}function saveUpdates(_0x591722,_0x240d65){return function(_0x42c82f){if(_0x42c82f){return _0x42c82f['update'](_0x591722)[_0xe4b5('0x27')](function(_0x84b031){return _0x84b031;});}return null;};}function removeEntity(_0x5a8da1,_0x1dd94e){return function(_0x4d7539){if(_0x4d7539){return _0x4d7539[_0xe4b5('0x28')]()['then'](function(){_0x5a8da1[_0xe4b5('0x1d')](0xcc)[_0xe4b5('0x29')]();});}};}function handleEntityNotFound(_0x10c669,_0x52c1cd){return function(_0x2d5f10){if(!_0x2d5f10){_0x10c669['sendStatus'](0x194);}return _0x2d5f10;};}function handleError(_0x5b7fd0,_0x22f96b){_0x22f96b=_0x22f96b||0x1f4;return function(_0x17ae35){logger[_0xe4b5('0x2a')](_0x17ae35['stack']);if(_0x17ae35[_0xe4b5('0x2b')]){delete _0x17ae35[_0xe4b5('0x2b')];}_0x5b7fd0[_0xe4b5('0x1d')](_0x22f96b)[_0xe4b5('0x2c')](_0x17ae35);};}exports['index']=function(_0x52b366,_0x1dad60){var _0x1342d5={},_0x374650={},_0xe74b97={'count':0x0,'rows':[]};var _0x8e2cb8=_['map'](db['SmsApplication']['rawAttributes'],function(_0x2c2529){return{'name':_0x2c2529[_0xe4b5('0x2d')],'type':_0x2c2529[_0xe4b5('0x2e')][_0xe4b5('0x2f')]};});_0x374650[_0xe4b5('0x30')]=_[_0xe4b5('0x31')](_0x8e2cb8,'name');_0x374650[_0xe4b5('0x32')]=_[_0xe4b5('0x33')](_0x52b366[_0xe4b5('0x32')]);_0x374650['filters']=_[_0xe4b5('0x34')](_0x374650[_0xe4b5('0x30')],_0x374650[_0xe4b5('0x32')]);_0x1342d5[_0xe4b5('0x35')]=_['intersection'](_0x374650[_0xe4b5('0x30')],qs[_0xe4b5('0x36')](_0x52b366[_0xe4b5('0x32')]['fields']));_0x1342d5['attributes']=_0x1342d5['attributes'][_0xe4b5('0x37')]?_0x1342d5[_0xe4b5('0x35')]:_0x374650[_0xe4b5('0x30')];if(!_0x52b366[_0xe4b5('0x32')][_0xe4b5('0x38')](_0xe4b5('0x39'))){_0x1342d5[_0xe4b5('0x21')]=qs[_0xe4b5('0x21')](_0x52b366['query']['limit']);_0x1342d5[_0xe4b5('0x1f')]=qs[_0xe4b5('0x1f')](_0x52b366[_0xe4b5('0x32')][_0xe4b5('0x1f')]);}_0x1342d5['order']=qs['sort'](_0x52b366[_0xe4b5('0x32')][_0xe4b5('0x3a')]);_0x1342d5[_0xe4b5('0x3b')]=qs[_0xe4b5('0x3c')](_[_0xe4b5('0x3d')](_0x52b366[_0xe4b5('0x32')],_0x374650[_0xe4b5('0x3c')]),_0x8e2cb8);if(_0x52b366['query'][_0xe4b5('0x3e')]){_0x1342d5['where']=_['merge'](_0x1342d5[_0xe4b5('0x3b')],{'$or':_['map'](_0x8e2cb8,function(_0x414aef){if(_0x414aef['type']!=='VIRTUAL'){var _0x34a004={};_0x34a004[_0x414aef[_0xe4b5('0x2b')]]={'$like':'%'+_0x52b366[_0xe4b5('0x32')][_0xe4b5('0x3e')]+'%'};return _0x34a004;}})});}_0x1342d5=_[_0xe4b5('0x3f')]({},_0x1342d5,_0x52b366[_0xe4b5('0x40')]);var _0x4ba56a={'where':_0x1342d5[_0xe4b5('0x3b')]};return db[_0xe4b5('0x41')]['count'](_0x4ba56a)[_0xe4b5('0x27')](function(_0x544312){_0xe74b97[_0xe4b5('0x22')]=_0x544312;if(_0x52b366[_0xe4b5('0x32')][_0xe4b5('0x42')]){_0x1342d5['include']=[{'all':!![]}];}return db[_0xe4b5('0x41')][_0xe4b5('0x43')](_0x1342d5);})[_0xe4b5('0x27')](function(_0x550940){_0xe74b97[_0xe4b5('0x44')]=_0x550940;return _0xe74b97;})[_0xe4b5('0x27')](respondWithFilteredResult(_0x1dad60,_0x1342d5))[_0xe4b5('0x45')](handleError(_0x1dad60,null));};exports[_0xe4b5('0x46')]=function(_0x3845d5,_0x127938){var _0x508497={'raw':!![],'where':{'id':_0x3845d5[_0xe4b5('0x47')]['id']}},_0x442b17={};_0x442b17[_0xe4b5('0x30')]=_[_0xe4b5('0x33')](db[_0xe4b5('0x41')][_0xe4b5('0x48')]);_0x442b17['query']=_['keys'](_0x3845d5[_0xe4b5('0x32')]);_0x442b17['filters']=_[_0xe4b5('0x34')](_0x442b17[_0xe4b5('0x30')],_0x442b17[_0xe4b5('0x32')]);_0x508497[_0xe4b5('0x35')]=_[_0xe4b5('0x34')](_0x442b17[_0xe4b5('0x30')],qs[_0xe4b5('0x36')](_0x3845d5[_0xe4b5('0x32')][_0xe4b5('0x36')]));_0x508497['attributes']=_0x508497[_0xe4b5('0x35')][_0xe4b5('0x37')]?_0x508497[_0xe4b5('0x35')]:_0x442b17[_0xe4b5('0x30')];if(_0x3845d5['query'][_0xe4b5('0x42')]){_0x508497[_0xe4b5('0x49')]=[{'all':!![]}];}_0x508497=_[_0xe4b5('0x3f')]({},_0x508497,_0x3845d5['options']);return db[_0xe4b5('0x41')][_0xe4b5('0x4a')](_0x508497)[_0xe4b5('0x27')](handleEntityNotFound(_0x127938,null))[_0xe4b5('0x27')](respondWithResult(_0x127938,null))[_0xe4b5('0x45')](handleError(_0x127938,null));};exports[_0xe4b5('0x4b')]=function(_0xae28b,_0x2b6fdf){return db[_0xe4b5('0x41')][_0xe4b5('0x4b')](_0xae28b[_0xe4b5('0x4c')],{})[_0xe4b5('0x27')](respondWithResult(_0x2b6fdf,0xc9))['catch'](handleError(_0x2b6fdf,null));};exports[_0xe4b5('0x4d')]=function(_0x11a69a,_0x147fb3){if(_0x11a69a['body']['id']){delete _0x11a69a[_0xe4b5('0x4c')]['id'];}return db['SmsApplication'][_0xe4b5('0x4a')]({'where':{'id':_0x11a69a['params']['id']}})['then'](handleEntityNotFound(_0x147fb3,null))[_0xe4b5('0x27')](saveUpdates(_0x11a69a['body'],null))[_0xe4b5('0x27')](respondWithResult(_0x147fb3,null))[_0xe4b5('0x45')](handleError(_0x147fb3,null));};exports[_0xe4b5('0x28')]=function(_0x566418,_0x313739){return db[_0xe4b5('0x41')][_0xe4b5('0x4a')]({'where':{'id':_0x566418[_0xe4b5('0x47')]['id']}})[_0xe4b5('0x27')](handleEntityNotFound(_0x313739,null))['then'](removeEntity(_0x313739,null))[_0xe4b5('0x45')](handleError(_0x313739,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 59fd1cd..94ab610 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 _0xa01c=['utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./smsApplication.attributes','exports','SmsApplication'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xa01c,0x14b));var _0xca01=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa01c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xca01('0x0'));var util=require(_0xca01('0x1'));var logger=require(_0xca01('0x2'))('api');var moment=require('moment');var BPromise=require(_0xca01('0x3'));var rp=require(_0xca01('0x4'));var fs=require('fs');var path=require(_0xca01('0x5'));var rimraf=require(_0xca01('0x6'));var config=require('../../config/environment');var attributes=require(_0xca01('0x7'));module[_0xca01('0x8')]=function(_0x2afdbc,_0x41ec54){return _0x2afdbc['define'](_0xca01('0x9'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xca01('0xa')});}; \ No newline at end of file +var _0xf8db=['exports','define','sms_applications','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xf8db,0x16b));var _0xbf8d=function(_0x35ad6e,_0x40ad3d){_0x35ad6e=_0x35ad6e-0x0;var _0x1e49ef=_0xf8db[_0x35ad6e];return _0x1e49ef;};'use strict';var _=require(_0xbf8d('0x0'));var util=require('util');var logger=require(_0xbf8d('0x1'))(_0xbf8d('0x2'));var moment=require(_0xbf8d('0x3'));var BPromise=require(_0xbf8d('0x4'));var rp=require(_0xbf8d('0x5'));var fs=require('fs');var path=require(_0xbf8d('0x6'));var rimraf=require('rimraf');var config=require(_0xbf8d('0x7'));var attributes=require(_0xbf8d('0x8'));module[_0xbf8d('0x9')]=function(_0x44c765,_0x288269){return _0x44c765[_0xbf8d('0xa')]('SmsApplication',attributes,{'tableName':_0xbf8d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 5e20b6b..590f11a 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 _0xa467=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xa467,0x143));var _0x7a46=function(_0x2cbe8e,_0x409898){_0x2cbe8e=_0x2cbe8e-0x0;var _0x59e85f=_0xa467[_0x2cbe8e];return _0x59e85f;};'use strict';var _=require(_0x7a46('0x0'));var util=require(_0x7a46('0x1'));var moment=require(_0x7a46('0x2'));var BPromise=require(_0x7a46('0x3'));var rs=require(_0x7a46('0x4'));var fs=require('fs');var Redis=require(_0x7a46('0x5'));var db=require(_0x7a46('0x6'))['db'];var utils=require(_0x7a46('0x7'));var logger=require(_0x7a46('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7a46('0x9'));var client=jayson[_0x7a46('0xa')][_0x7a46('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x463cdf,_0x6d8fce,_0x550c38){return new BPromise(function(_0x341d9e,_0x1f8b07){return client[_0x7a46('0xc')](_0x463cdf,_0x550c38)[_0x7a46('0xd')](function(_0x382b56){logger[_0x7a46('0xe')]('SmsApplication,\x20%s,\x20%s',_0x6d8fce,_0x7a46('0xf'));logger['debug'](_0x7a46('0x10'),_0x6d8fce,'request\x20sent',JSON[_0x7a46('0x11')](_0x382b56));if(_0x382b56[_0x7a46('0x12')]){if(_0x382b56[_0x7a46('0x12')][_0x7a46('0x13')]===0x1f4){logger[_0x7a46('0x12')]('SmsApplication,\x20%s,\x20%s',_0x6d8fce,_0x382b56[_0x7a46('0x12')][_0x7a46('0x14')]);return _0x1f8b07(_0x382b56[_0x7a46('0x12')][_0x7a46('0x14')]);}logger[_0x7a46('0x12')]('SmsApplication,\x20%s,\x20%s',_0x6d8fce,_0x382b56[_0x7a46('0x12')]['message']);return _0x341d9e(_0x382b56['error'][_0x7a46('0x14')]);}else{logger[_0x7a46('0xe')]('SmsApplication,\x20%s,\x20%s',_0x6d8fce,_0x7a46('0xf'));_0x341d9e(_0x382b56['result'][_0x7a46('0x14')]);}})[_0x7a46('0x15')](function(_0x50e40e){logger[_0x7a46('0x12')]('SmsApplication,\x20%s,\x20%s',_0x6d8fce,_0x50e40e);_0x1f8b07(_0x50e40e);});});} \ No newline at end of file +var _0x11c8=['jayson/promise','client','request\x20sent','debug','stringify','error','code','message','info','SmsApplication,\x20%s,\x20%s','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x11c8,0x19a));var _0x811c=function(_0x37bab4,_0x4fa85e){_0x37bab4=_0x37bab4-0x0;var _0x336d20=_0x11c8[_0x37bab4];return _0x336d20;};'use strict';var _=require('lodash');var util=require(_0x811c('0x0'));var moment=require(_0x811c('0x1'));var BPromise=require('bluebird');var rs=require(_0x811c('0x2'));var fs=require('fs');var Redis=require(_0x811c('0x3'));var db=require(_0x811c('0x4'))['db'];var utils=require(_0x811c('0x5'));var logger=require(_0x811c('0x6'))(_0x811c('0x7'));var config=require('../../config/environment');var jayson=require(_0x811c('0x8'));var client=jayson[_0x811c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x126cc2,_0x8af784,_0x13a95a){return new BPromise(function(_0x3e81ac,_0x57a92d){return client['request'](_0x126cc2,_0x13a95a)['then'](function(_0x5be7fc){logger['info']('SmsApplication,\x20%s,\x20%s',_0x8af784,_0x811c('0xa'));logger[_0x811c('0xb')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x8af784,_0x811c('0xa'),JSON[_0x811c('0xc')](_0x5be7fc));if(_0x5be7fc[_0x811c('0xd')]){if(_0x5be7fc[_0x811c('0xd')][_0x811c('0xe')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x8af784,_0x5be7fc[_0x811c('0xd')]['message']);return _0x57a92d(_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x8af784,_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);return _0x3e81ac(_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);}else{logger[_0x811c('0x10')](_0x811c('0x11'),_0x8af784,'request\x20sent');_0x3e81ac(_0x5be7fc['result'][_0x811c('0xf')]);}})[_0x811c('0x12')](function(_0x3b0895){logger[_0x811c('0xd')](_0x811c('0x11'),_0x8af784,_0x3b0895);_0x57a92d(_0x3b0895);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 837c690..1e80df2 100644 --- a/server/api/smsInteraction/index.js +++ b/server/api/smsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['/:id/tags','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','sms','smsinteraction:addtags','tracked','smsinteraction:update','update','delete','destroy'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xda3f,0xec));var _0xfda3=function(_0x1e558d,_0x54ad3e){_0x1e558d=_0x1e558d-0x0;var _0x1aff32=_0xda3f[_0x1e558d];return _0x1aff32;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./smsInteraction.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0x5')]('/:id/download',auth[_0xfda3('0x6')](),controller[_0xfda3('0xd')]);router[_0xfda3('0xe')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xf')]);router['post'](_0xfda3('0xb'),auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0xe')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xfda3('0x11'),_0xfda3('0x12')),controller['addTags']);router['put']('/:id',auth[_0xfda3('0x6')](),interaction[_0xfda3('0x13')](_0xfda3('0x11'),_0xfda3('0x14')),controller[_0xfda3('0x15')]);router[_0xfda3('0x16')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),interaction[_0xfda3('0x13')](_0xfda3('0x11'),'smsinteraction:destroy'),controller[_0xfda3('0x17')]);router[_0xfda3('0x16')](_0xfda3('0x18'),auth[_0xfda3('0x6')](),controller['removeTags']);module[_0xfda3('0x19')]=router; \ No newline at end of file +var _0xda3f=['/:id/tags','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','sms','smsinteraction:addtags','tracked','smsinteraction:update','update','delete','destroy'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xda3f,0xec));var _0xfda3=function(_0x5ad5aa,_0x392091){_0x5ad5aa=_0x5ad5aa-0x0;var _0x49680e=_0xda3f[_0x5ad5aa];return _0x49680e;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./smsInteraction.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0x5')]('/:id/download',auth[_0xfda3('0x6')](),controller[_0xfda3('0xd')]);router[_0xfda3('0xe')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xf')]);router['post'](_0xfda3('0xb'),auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0xe')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xfda3('0x11'),_0xfda3('0x12')),controller['addTags']);router['put']('/:id',auth[_0xfda3('0x6')](),interaction[_0xfda3('0x13')](_0xfda3('0x11'),_0xfda3('0x14')),controller[_0xfda3('0x15')]);router[_0xfda3('0x16')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),interaction[_0xfda3('0x13')](_0xfda3('0x11'),'smsinteraction:destroy'),controller[_0xfda3('0x17')]);router[_0xfda3('0x16')](_0xfda3('0x18'),auth[_0xfda3('0x6')](),controller['removeTags']);module[_0xfda3('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 6142da4..a33beba 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 _0x3eea=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x4deb08,_0x3de22d){var _0x32eab5=function(_0x1d8cdd){while(--_0x1d8cdd){_0x4deb08['push'](_0x4deb08['shift']());}};_0x32eab5(++_0x3de22d);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x47d1cd,_0x11486b){_0x47d1cd=_0x47d1cd-0x0;var _0x536d74=_0x3eea[_0x47d1cd];return _0x536d74;};'use strict';var Sequelize=require(_0xa3ee('0x0'));var moment=require('moment');module[_0xa3ee('0x1')]={'closed':{'type':Sequelize[_0xa3ee('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa3ee('0x3')]},'disposition':{'type':Sequelize[_0xa3ee('0x4')]},'secondDisposition':{'type':Sequelize[_0xa3ee('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa3ee('0x4')]},'note':{'type':Sequelize[_0xa3ee('0x4')]},'phone':{'type':Sequelize[_0xa3ee('0x4')]},'read1stAt':{'type':Sequelize[_0xa3ee('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa3ee('0x5')]('in',_0xa3ee('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa3ee('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6dfa=['STRING','ENUM','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x6dfa,0x7b));var _0xa6df=function(_0x4e5567,_0x4dddcd){_0x4e5567=_0x4e5567-0x0;var _0x25c533=_0x6dfa[_0x4e5567];return _0x25c533;};'use strict';var Sequelize=require(_0xa6df('0x0'));var moment=require(_0xa6df('0x1'));module[_0xa6df('0x2')]={'closed':{'type':Sequelize[_0xa6df('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa6df('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa6df('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa6df('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa6df('0x6')]('in',_0xa6df('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa6df('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xa6df('0x6')]('in',_0xa6df('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa6df('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 6736883..ec31387 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 _0x93ed=['transcript-%d-%s.zip','User','CmContact','lastName','Messages','direction','secret','SmsAccount','Owner','mkdirSync','Sms','Account','N.A.','closed','closedAt','out','renderFile','views','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','Tags','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','field','from','tools_tags','select','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','start','Tag','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','some','isEmpty','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','agent','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','show','params','keys','options','create','body','find','describe','addMessage','omit','ids','findOne','SmsMessage','merge','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','rows','setTags','spread','color','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format'];(function(_0x372284,_0x365d9c){var _0x219dce=function(_0x537869){while(--_0x537869){_0x372284['push'](_0x372284['shift']());}};_0x219dce(++_0x365d9c);}(_0x93ed,0xfe));var _0xd93e=function(_0x526074,_0x5e5d09){_0x526074=_0x526074-0x0;var _0x83c6c8=_0x93ed[_0x526074];return _0x83c6c8;};'use strict';var emlformat=require(_0xd93e('0x0'));var rimraf=require(_0xd93e('0x1'));var zipdir=require(_0xd93e('0x2'));var jsonpatch=require(_0xd93e('0x3'));var rp=require(_0xd93e('0x4'));var moment=require('moment');var BPromise=require(_0xd93e('0x5'));var Mustache=require('mustache');var util=require(_0xd93e('0x6'));var path=require(_0xd93e('0x7'));var sox=require('sox');var csv=require(_0xd93e('0x8'));var ejs=require(_0xd93e('0x9'));var fs=require('fs');var fs_extra=require(_0xd93e('0xa'));var _=require(_0xd93e('0xb'));var squel=require(_0xd93e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd93e('0xd'));var toCsv=require(_0xd93e('0x8'));var querystring=require(_0xd93e('0xe'));var Papa=require(_0xd93e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd93e('0x10'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xd93e('0x11'));var hardwareService=require(_0xd93e('0x12'));var logger=require(_0xd93e('0x13'))(_0xd93e('0x14'));var utils=require(_0xd93e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd93e('0x16'));var db=require(_0xd93e('0x17'))['db'];config[_0xd93e('0x18')]=_[_0xd93e('0x19')](config[_0xd93e('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')[_0xd93e('0x1a')](socket);function respondWithStatusCode(_0x42eea7,_0x148a40){_0x148a40=_0x148a40||0xcc;return function(_0x4e1ce2){if(_0x4e1ce2){return _0x42eea7[_0xd93e('0x1b')](_0x148a40);}return _0x42eea7['status'](_0x148a40)[_0xd93e('0x1c')]();};}function respondWithResult(_0x164238,_0x846531){_0x846531=_0x846531||0xc8;return function(_0x1ba021){if(_0x1ba021){return _0x164238[_0xd93e('0x1d')](_0x846531)[_0xd93e('0x1e')](_0x1ba021);}};}function respondWithFilteredResult(_0x433ced,_0x54b6a1){return function(_0x50c196){if(_0x50c196){var _0x54d919=typeof _0x54b6a1[_0xd93e('0x1f')]===_0xd93e('0x20')&&typeof _0x54b6a1[_0xd93e('0x21')]==='undefined';var _0x4c1d3a=_0x50c196[_0xd93e('0x22')];var _0x316a4f=_0x54d919?0x0:_0x54b6a1[_0xd93e('0x1f')];var _0x235687=_0x54d919?_0x50c196['count']:_0x54b6a1[_0xd93e('0x1f')]+_0x54b6a1[_0xd93e('0x21')];var _0x336e14;if(_0x235687>=_0x4c1d3a){_0x235687=_0x4c1d3a;_0x336e14=0xc8;}else{_0x336e14=0xce;}_0x433ced[_0xd93e('0x1d')](_0x336e14);return _0x433ced[_0xd93e('0x23')]('Content-Range',_0x316a4f+'-'+_0x235687+'/'+_0x4c1d3a)['json'](_0x50c196);}return null;};}function patchUpdates(_0x287e01){return function(_0x3e818e){try{jsonpatch[_0xd93e('0x24')](_0x3e818e,_0x287e01,!![]);}catch(_0xe5553f){return BPromise[_0xd93e('0x25')](_0xe5553f);}return _0x3e818e[_0xd93e('0x26')]();};}function saveUpdates(_0xa0bcbe,_0x3bae5b){return function(_0x47487c){if(_0x47487c){return _0x47487c[_0xd93e('0x27')](_0xa0bcbe)[_0xd93e('0x28')](function(_0x538a3e){return _0x538a3e;});}return null;};}function removeEntity(_0xf6c667,_0x50eec4){return function(_0x4fd87e){if(_0x4fd87e){return _0x4fd87e[_0xd93e('0x29')]()[_0xd93e('0x28')](function(){_0xf6c667['status'](0xcc)[_0xd93e('0x1c')]();});}};}function handleEntityNotFound(_0x3de014,_0xa21e2d){return function(_0x49ae2c){if(!_0x49ae2c){_0x3de014[_0xd93e('0x1b')](0x194);}return _0x49ae2c;};}function handleError(_0xa6e556,_0x5a5f48){_0x5a5f48=_0x5a5f48||0x1f4;return function(_0x2bff6e){logger[_0xd93e('0x2a')](_0x2bff6e[_0xd93e('0x2b')]);if(_0x2bff6e[_0xd93e('0x2c')]){delete _0x2bff6e['name'];}_0xa6e556['status'](_0x5a5f48)['send'](_0x2bff6e);};}function getInteractionUsers(_0x149209,_0x3baf51){return new BPromise(function(_0x23c1b4,_0x23de8e){try{if(_0x3baf51[_0x149209['id']]){_0x149209[_0xd93e('0x2d')]=_[_0xd93e('0x2e')](_0x3baf51[_0x149209['id']],function(_0x5d8785){return{'id':_0x5d8785['id'],'fullname':_0x5d8785[_0xd93e('0x2f')]};});}}catch(_0x48289c){_0x23de8e(_0x48289c);}_0x23c1b4(_0x149209);});}function getInteractionTags(_0x3581d0,_0x1f8b40){return new BPromise(function(_0x91e442,_0x682ba6){try{if(_0x3581d0[_0xd93e('0x30')]){_0x3581d0['Tags']=[];_0x3581d0['TagIds']['split'](',')['forEach'](function(_0x52df22){_0x3581d0[_0xd93e('0x31')][_0xd93e('0x32')](_0x1f8b40[_0x52df22]);});}delete _0x3581d0[_0xd93e('0x30')];}catch(_0x589412){_0x682ba6(_0x589412);}_0x91e442(_0x3581d0);});}function updateSmsInteraction(_0x210e99,_0x59b772,_0x599f40){return new BPromise(function(_0x136176,_0x45a3b6){return getInteractionUsers(_0x210e99,_0x599f40)[_0xd93e('0x28')](function(_0x3bdd38){return getInteractionTags(_0x3bdd38,_0x59b772);})['then'](function(_0x481921){_0x136176(_0x481921);})[_0xd93e('0x33')](function(_0x18e59e){_0x45a3b6(_0x18e59e);});});}exports[_0xd93e('0x34')]=function(_0x578c0d,_0x2d5a0c){var _0xd74f43={},_0x4f79d4={},_0x5082cc={'count':0x0,'rows':[]};var _0x4e3abe=_[_0xd93e('0x2e')](db[_0xd93e('0x35')][_0xd93e('0x36')],function(_0x4455dd){return{'name':_0x4455dd[_0xd93e('0x37')],'type':_0x4455dd[_0xd93e('0x38')][_0xd93e('0x39')]};});_0x4f79d4['model']=_[_0xd93e('0x2e')](_0x4e3abe,'name');_0x4f79d4[_0xd93e('0x3a')]=_['keys'](_0x578c0d[_0xd93e('0x3a')]);_0x4f79d4[_0xd93e('0x3b')]=_['intersection'](_0x4f79d4[_0xd93e('0x3c')],_0x4f79d4[_0xd93e('0x3a')]);_0xd74f43['attributes']=_[_0xd93e('0x3d')](_0x4f79d4[_0xd93e('0x3c')],qs[_0xd93e('0x3e')](_0x578c0d['query']['fields']));_0xd74f43['attributes']=_0xd74f43[_0xd93e('0x3f')][_0xd93e('0x40')]?_0xd74f43[_0xd93e('0x3f')]:_0x4f79d4[_0xd93e('0x3c')];if(!_0x578c0d[_0xd93e('0x3a')][_0xd93e('0x41')](_0xd93e('0x42'))){_0xd74f43[_0xd93e('0x21')]=qs['limit'](_0x578c0d[_0xd93e('0x3a')]['limit']);_0xd74f43[_0xd93e('0x1f')]=qs[_0xd93e('0x1f')](_0x578c0d['query'][_0xd93e('0x1f')]);}_0xd74f43[_0xd93e('0x43')]=qs[_0xd93e('0x44')](_0x578c0d[_0xd93e('0x3a')][_0xd93e('0x44')]);_0xd74f43['where']=qs[_0xd93e('0x3b')](_[_0xd93e('0x45')](_0x578c0d[_0xd93e('0x3a')],_0x4f79d4['filters']),_0x4e3abe);var _0x21ea5a=[];var _0x59add6=squel['select']()[_0xd93e('0x46')]('id')[_0xd93e('0x46')](_0xd93e('0x2c'))['field']('color')[_0xd93e('0x47')](_0xd93e('0x48'));var _0x1c04b9=squel[_0xd93e('0x49')]()['field']('u.id')[_0xd93e('0x46')](_0xd93e('0x4a'))[_0xd93e('0x46')](_0xd93e('0x4b'))[_0xd93e('0x47')](_0xd93e('0x4c'),'ui')[_0xd93e('0x4d')](_0xd93e('0x4e'),'u',_0xd93e('0x4f'));var _0x4638b4=squel[_0xd93e('0x49')]()[_0xd93e('0x47')](_0xd93e('0x50'),'i')[_0xd93e('0x4d')](_0xd93e('0x51'),'c',_0xd93e('0x52'))['left_join'](_0xd93e('0x4e'),'o',_0xd93e('0x53'))[_0xd93e('0x4d')](_0xd93e('0x54'),'a','a.id\x20=\x20i.SmsAccountId')[_0xd93e('0x4d')]('sms_messages','me',_0xd93e('0x55'))[_0xd93e('0x4d')](_0xd93e('0x56'),'it',_0xd93e('0x57'))[_0xd93e('0x4d')]('tools_tags','t',_0xd93e('0x58'));var _0x419004=squel[_0xd93e('0x59')]();var _0x1cc0cd=[];var _0xddb2ad=squel['expr']();var _0x1d552d;if(_0x578c0d[_0xd93e('0x3a')][_0xd93e('0x5a')]){_0x1d552d=as[_0xd93e('0x5b')](_0x578c0d['query']['search']);var _0x169e2b=_0x1d552d[_0xd93e('0x5c')];for(var _0x3a23ad=0x0;_0x3a23ad<_0x1d552d[_0xd93e('0x5d')][_0xd93e('0x40')];_0x3a23ad++){var _0x1cc130=_0x1d552d[_0xd93e('0x5d')][_0x3a23ad];var _0x15f2c1='i';var _0x56be38=_['find'](_0x4e3abe,[_0xd93e('0x2c'),_0x1cc130['field']]);if(!_0x56be38){switch(_0x1cc130[_0xd93e('0x46')]){case _0xd93e('0x5e'):if(_0x1cc130[_0xd93e('0x5f')]==0x1){_0x4638b4[_0xd93e('0x60')]('`'+_0x1cc130[_0xd93e('0x46')]+'`\x20=\x200');}else{_0x4638b4[_0xd93e('0x60')]('`'+_0x1cc130['field']+_0xd93e('0x61'));}break;case _0xd93e('0x62'):if(_0x1cc130[_0xd93e('0x63')]==='$substring'){if(_0x1cc130[_0xd93e('0x5f')]['split']('\x20')['length']>0x1){_0x419004[_0x169e2b](_0xd93e('0x64'),qs[_0xd93e('0x65')](_0x1cc130[_0xd93e('0x5f')]),null);}else{var _0x355401='%'+_0x1cc130[_0xd93e('0x5f')]+'%';_0x419004[_0x169e2b]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x355401,_0x355401,_0x355401);}}else{_0x56be38=_['find'](_0x4e3abe,['name','ContactId']);_0x1cc130[_0xd93e('0x46')]=_0xd93e('0x66');_0x55b6d7=as['buildExpression'](_0x15f2c1,_0x56be38[_0xd93e('0x38')],_0x1cc130);_0x419004[_0x169e2b](_0x55b6d7['text'],_0x55b6d7[_0xd93e('0x5f')][_0xd93e('0x67')],_0x55b6d7[_0xd93e('0x5f')][_0xd93e('0x1c')]);}break;case _0xd93e('0x68'):var _0x3bdba9=_0x1cc130[_0xd93e('0x5f')][_0xd93e('0x69')](',')['map'](function(_0x1d4a87){return Number(_0x1d4a87);});_0x3bdba9[_0xd93e('0x6a')](function(_0x3fe032){_0xddb2ad['or'](_0xd93e('0x6b'),'%,'+_0x3fe032+',%');});_0x1cc0cd=_[_0xd93e('0x6c')](_0x1cc0cd,_0x3bdba9);break;case'User':if(_0x1cc130[_0xd93e('0x63')]===_0xd93e('0x6d')){_0x419004[_0x169e2b](_0xd93e('0x6e'),'%'+_0x1cc130[_0xd93e('0x5f')]+'%',null);}else{_0x56be38=_['find'](_0x4e3abe,['name',_0xd93e('0x6f')]);_0x1cc130[_0xd93e('0x46')]=_0xd93e('0x6f');_0x55b6d7=as[_0xd93e('0x70')](_0x15f2c1,_0x56be38[_0xd93e('0x38')],_0x1cc130);_0x419004[_0x169e2b](_0x55b6d7[_0xd93e('0x71')],_0x55b6d7[_0xd93e('0x5f')]['start'],_0x55b6d7[_0xd93e('0x5f')][_0xd93e('0x1c')]);}break;case'body':_0x55b6d7=as[_0xd93e('0x70')]('me',null,_0x1cc130);_0x419004[_0x169e2b](_0x55b6d7['text'],_0x55b6d7[_0xd93e('0x5f')][_0xd93e('0x67')],_0x55b6d7[_0xd93e('0x5f')][_0xd93e('0x1c')]);break;}}else{var _0x55b6d7=as[_0xd93e('0x70')](_0x15f2c1,_0x56be38[_0xd93e('0x38')],_0x1cc130);_0x419004[_0x169e2b](_0x55b6d7['text'],_0x55b6d7[_0xd93e('0x5f')]['start'],_0x55b6d7[_0xd93e('0x5f')][_0xd93e('0x1c')]);}}}else{var _0x261902=_(_0x578c0d['query'])['keys']()[_0xd93e('0x2e')](function(_0x5214e8){return _[_0xd93e('0x72')](_0x4e3abe,[_0xd93e('0x2c'),_0x5214e8])?_0x5214e8:undefined;})['compact']()[_0xd93e('0x5f')]();if(!_[_0xd93e('0x73')](_0x261902)){_0x261902[_0xd93e('0x6a')](function(_0x1a84f1){if(_0x1a84f1==='SmsAccountId'){_0x4638b4[_0xd93e('0x74')](_0xd93e('0x75'),[][_0xd93e('0x76')](_0x578c0d['query'][_0x1a84f1]));}else if(_0x1a84f1===_0xd93e('0x77')){var _0x5bc5b7=JSON[_0xd93e('0x78')](_0x578c0d[_0xd93e('0x3a')][_0x1a84f1])[_0xd93e('0x79')];var _0x4dd2b3=JSON[_0xd93e('0x78')](_0x578c0d[_0xd93e('0x3a')][_0x1a84f1])[_0xd93e('0x7a')];_0x4638b4[_0xd93e('0x74')](_0xd93e('0x7b'),_0x5bc5b7,_0x4dd2b3);}else{if(_0x578c0d[_0xd93e('0x3a')][_0x1a84f1]===_0xd93e('0x7c')){_0x4638b4[_0xd93e('0x74')]('i.'+_0x1a84f1+_0xd93e('0x7d'));}else{_0x4638b4[_0xd93e('0x74')]('i.'+_0x1a84f1+_0xd93e('0x7e'),_0x578c0d['query'][_0x1a84f1]);}}});}if(_0x578c0d[_0xd93e('0x3a')][_0xd93e('0x7f')]){if(_0x578c0d[_0xd93e('0x3a')][_0xd93e('0x7f')]==0x1){_0x4638b4[_0xd93e('0x60')]('`unreadMessages`\x20=\x200');}else{_0x4638b4[_0xd93e('0x60')](_0xd93e('0x80'));}}if(_0x578c0d[_0xd93e('0x3a')][_0xd93e('0x81')]){_0x1cc0cd=_['isArray'](_0x578c0d[_0xd93e('0x3a')][_0xd93e('0x81')])?_0x578c0d[_0xd93e('0x3a')]['tag']:new Array(_0x578c0d[_0xd93e('0x3a')][_0xd93e('0x81')]);_0x1cc0cd[_0xd93e('0x6a')](function(_0x28e260){_0xddb2ad['or'](_0xd93e('0x6b'),'%,'+_0x28e260+',%');});}if(_0x578c0d[_0xd93e('0x3a')][_0xd93e('0x82')]){var _0x25e15f=_0x578c0d[_0xd93e('0x3a')]['filter'][_0xd93e('0x83')]('\x5c','\x5c\x5c')[_0xd93e('0x83')](/'/g,'\x27\x27');if(qs[_0xd93e('0x84')](_0x25e15f)){_0x419004['or'](_0xd93e('0x85'),_0x25e15f+'%')['or'](_0xd93e('0x86'),_0x25e15f+'%');}else{_0x419004['or'](_0xd93e('0x87'),qs[_0xd93e('0x65')](_0x25e15f))['or'](_0xd93e('0x88'),_0x25e15f+'%');}}}_0x4638b4[_0xd93e('0x74')](_0x419004);_0x4638b4[_0xd93e('0x89')](_0xd93e('0x8a'));var _0x2f2a74={'type':db['Sequelize'][_0xd93e('0x8b')][_0xd93e('0x8c')],'raw':!![]};var _0x422592=_0x4638b4['clone']();_0x422592[_0xd93e('0x46')](_0xd93e('0x8a'));_0x422592[_0xd93e('0x46')](_0xd93e('0x8d'),_0xd93e('0x5e'));if(_0xd74f43[_0xd93e('0x43')]){_0xd74f43[_0xd93e('0x43')]['forEach'](function(_0x350e09){var _0x3a8874=_0x350e09[0x0]===_0xd93e('0x8e')?_0x350e09[0x0]:'i.'+_0x350e09[0x0];_0x4638b4[_0xd93e('0x43')](_0x3a8874,_0x350e09[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x1cc0cd)){_0x4638b4[_0xd93e('0x60')](_0xddb2ad);_0x422592[_0xd93e('0x74')](_0xd93e('0x8f'),_0x1cc0cd);}BPromise[_0xd93e('0x90')]()['then'](function(){if(!_0x1d552d){if(_0x578c0d[_0xd93e('0x3a')]['SmsAccountId'])return;_0x422592[_0xd93e('0x74')](_0xd93e('0x91'));_0x4638b4[_0xd93e('0x74')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x578c0d[_0xd93e('0x92')][_0xd93e('0x93')]!=='agent')return;return _0x578c0d[_0xd93e('0x92')][_0xd93e('0x94')]({'attributes':['id'],'raw':!![]})[_0xd93e('0x28')](function(_0x3abbfe){if(_[_0xd93e('0x73')](_0x3abbfe)){_0x422592[_0xd93e('0x74')](_0xd93e('0x95'));_0x4638b4[_0xd93e('0x74')](_0xd93e('0x95'));}else{_0x422592[_0xd93e('0x74')](_0xd93e('0x75'),_[_0xd93e('0x2e')](_0x3abbfe,'id'));_0x4638b4[_0xd93e('0x74')](_0xd93e('0x75'),_[_0xd93e('0x2e')](_0x3abbfe,'id'));}});})[_0xd93e('0x28')](function(){if(_0x578c0d[_0xd93e('0x92')][_0xd93e('0x93')]===_0xd93e('0x96')&&!_0x1d552d&&!_0x578c0d[_0xd93e('0x3a')]['SmsAccountId'])return[];return db['sequelize'][_0xd93e('0x3a')](_0x422592[_0xd93e('0x97')](),_0x2f2a74);})[_0xd93e('0x28')](function(_0x3f58e2){_0x5082cc[_0xd93e('0x22')]=_0x3f58e2[_0xd93e('0x40')];if(_0x5082cc['count']===0x0)return[];return db['sequelize'][_0xd93e('0x3a')](_0x59add6[_0xd93e('0x97')](),_0x2f2a74)['then'](function(_0x5378ac){_0x21ea5a=_[_0xd93e('0x98')](_0x5378ac,'id');_0x2f2a74=_['merge'](_0x2f2a74,{'model':db[_0xd93e('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x578c0d[_0xd93e('0x3a')][_0xd93e('0x3e')]){_0xd74f43['attributes']['forEach'](function(_0x2f55ee){_0x4638b4[_0xd93e('0x46')]('i.'+_0x2f55ee);});}else{_0x4638b4['field'](_0xd93e('0x8d'),'unreadMessages');_0x4638b4['field'](_0xd93e('0x99'),_0xd93e('0x9a'));_0x4638b4['field'](_0xd93e('0x9b'),_0xd93e('0x9c'));_0x4638b4['field']('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',_0xd93e('0x8e'));_0x4638b4[_0xd93e('0x46')](_0xd93e('0x9d'));_0x4638b4['field'](_0xd93e('0x9e'),_0xd93e('0x9f'));_0x4638b4['field'](_0xd93e('0xa0'),_0xd93e('0xa1'));_0x4638b4['field']('c.email',_0xd93e('0xa2'));_0x4638b4[_0xd93e('0x46')]('c.phone','Contact.phone');_0x4638b4[_0xd93e('0x46')](_0xd93e('0xa3'),_0xd93e('0xa4'));_0x4638b4['field'](_0xd93e('0xa5'),_0xd93e('0xa6'));_0x4638b4['field'](_0xd93e('0xa7'),'Owner.fullname');_0x4638b4[_0xd93e('0x46')]('o.internal',_0xd93e('0xa8'));_0x4638b4[_0xd93e('0x46')](_0xd93e('0xa9'),_0xd93e('0x30'));}if(_0xd74f43[_0xd93e('0x21')])_0x4638b4['limit'](_0xd74f43[_0xd93e('0x21')]);if(_0xd74f43[_0xd93e('0x1f')])_0x4638b4[_0xd93e('0x1f')](_0xd74f43[_0xd93e('0x1f')]);return db[_0xd93e('0xaa')][_0xd93e('0x3a')](_0x4638b4['toString'](),_0x2f2a74);})[_0xd93e('0x28')](function(_0x11b5a7){if(_0x11b5a7[_0xd93e('0x40')]>0x0)_0x1c04b9[_0xd93e('0x74')](_0xd93e('0xab'),_[_0xd93e('0x2e')](_0x11b5a7,'id'));return db[_0xd93e('0xaa')][_0xd93e('0x3a')](_0x1c04b9[_0xd93e('0x97')](),_0x2f2a74)[_0xd93e('0x28')](function(_0xf347d8){var _0x17b798=_[_0xd93e('0xac')](_0xf347d8,_0xd93e('0xad'));var _0x3492b7=[];_0x11b5a7['forEach'](function(_0x490103){_0x3492b7[_0xd93e('0x32')](updateSmsInteraction(_0x490103,_0x21ea5a,_0x17b798));});return BPromise[_0xd93e('0xae')](_0x3492b7);});});})[_0xd93e('0x28')](function(_0x2fe957){_0x5082cc['rows']=_0x2fe957;return _0x5082cc;})[_0xd93e('0x28')](respondWithFilteredResult(_0x2d5a0c,_0xd74f43))[_0xd93e('0x33')](handleError(_0x2d5a0c,null));};exports[_0xd93e('0xaf')]=function(_0x482906,_0x27a3b8){var _0x220e1e={'raw':![],'where':{'id':_0x482906[_0xd93e('0xb0')]['id']}},_0x3ade8f={};_0x3ade8f['model']=_[_0xd93e('0xb1')](db[_0xd93e('0x35')]['rawAttributes']);_0x3ade8f[_0xd93e('0x3a')]=_[_0xd93e('0xb1')](_0x482906[_0xd93e('0x3a')]);_0x3ade8f[_0xd93e('0x3b')]=_[_0xd93e('0x3d')](_0x3ade8f[_0xd93e('0x3c')],_0x3ade8f[_0xd93e('0x3a')]);_0x220e1e['attributes']=_[_0xd93e('0x3d')](_0x3ade8f[_0xd93e('0x3c')],qs[_0xd93e('0x3e')](_0x482906[_0xd93e('0x3a')][_0xd93e('0x3e')]));_0x220e1e['attributes']=_0x220e1e[_0xd93e('0x3f')]['length']?_0x220e1e[_0xd93e('0x3f')]:_0x3ade8f[_0xd93e('0x3c')];if(_0x482906[_0xd93e('0x3a')]['includeAll']){_0x220e1e['include']=[{'all':!![]}];}_0x220e1e=_['merge']({},_0x220e1e,_0x482906[_0xd93e('0xb2')]);return db[_0xd93e('0x35')]['find'](_0x220e1e)['then'](handleEntityNotFound(_0x27a3b8,null))[_0xd93e('0x28')](respondWithResult(_0x27a3b8,null))[_0xd93e('0x33')](handleError(_0x27a3b8,null));};exports[_0xd93e('0xb3')]=function(_0x3c937e,_0x246717){return db[_0xd93e('0x35')]['create'](_0x3c937e['body'],{})[_0xd93e('0x28')](respondWithResult(_0x246717,0xc9))[_0xd93e('0x33')](handleError(_0x246717,null));};exports[_0xd93e('0x27')]=function(_0x46fef5,_0x2c6345){if(_0x46fef5[_0xd93e('0xb4')]['id']){delete _0x46fef5[_0xd93e('0xb4')]['id'];}return db[_0xd93e('0x35')][_0xd93e('0xb5')]({'where':{'id':_0x46fef5[_0xd93e('0xb0')]['id']}})[_0xd93e('0x28')](handleEntityNotFound(_0x2c6345,null))[_0xd93e('0x28')](saveUpdates(_0x46fef5['body'],null))[_0xd93e('0x28')](respondWithResult(_0x2c6345,null))[_0xd93e('0x33')](handleError(_0x2c6345,null));};exports['destroy']=function(_0x55cf15,_0x3ce116){return db[_0xd93e('0x35')][_0xd93e('0xb5')]({'where':{'id':_0x55cf15[_0xd93e('0xb0')]['id']}})[_0xd93e('0x28')](handleEntityNotFound(_0x3ce116,null))['then'](removeEntity(_0x3ce116,null))[_0xd93e('0x33')](handleError(_0x3ce116,null));};exports[_0xd93e('0xb6')]=function(_0xfa5615,_0x43ea80){return db['SmsInteraction'][_0xd93e('0xb6')]()[_0xd93e('0x28')](respondWithResult(_0x43ea80,null))['catch'](handleError(_0x43ea80,null));};exports[_0xd93e('0xb7')]=function(_0x354a99,_0x841ecb,_0x1e1494){return db['SmsMessage'][_0xd93e('0xb5')]({'where':{'id':_0x354a99['params']['id']}})[_0xd93e('0x28')](handleEntityNotFound(_0x841ecb,null))[_0xd93e('0x28')](function(_0x5b92b7){if(_0x5b92b7){return _0x5b92b7[_0xd93e('0xb7')](_0x354a99['body']['ids'],_[_0xd93e('0xb8')](_0x354a99[_0xd93e('0xb4')],[_0xd93e('0xb9'),'id'])||{});}})[_0xd93e('0x28')](respondWithResult(_0x841ecb,null))[_0xd93e('0x33')](handleError(_0x841ecb,null));};exports['getMessages']=function(_0x2756a7,_0xcb0595,_0xfdc623){var _0x58bc2b={'raw':![],'where':{}};var _0x51bfa7={};var _0x5d3ecd={'count':0x0,'rows':[]};return db[_0xd93e('0x35')][_0xd93e('0xba')]({'where':{'id':_0x2756a7[_0xd93e('0xb0')]['id']}})[_0xd93e('0x28')](handleEntityNotFound(_0xcb0595,null))[_0xd93e('0x28')](function(_0x4abb3a){if(_0x4abb3a){_0x51bfa7['model']=_[_0xd93e('0xb1')](db[_0xd93e('0xbb')][_0xd93e('0x36')]);_0x51bfa7[_0xd93e('0x3a')]=_[_0xd93e('0xb1')](_0x2756a7[_0xd93e('0x3a')]);_0x51bfa7[_0xd93e('0x3b')]=_[_0xd93e('0x3d')](_0x51bfa7['model'],_0x51bfa7[_0xd93e('0x3a')]);_0x58bc2b['attributes']=_['intersection'](_0x51bfa7[_0xd93e('0x3c')],qs[_0xd93e('0x3e')](_0x2756a7[_0xd93e('0x3a')][_0xd93e('0x3e')]));_0x58bc2b[_0xd93e('0x3f')]=_0x58bc2b[_0xd93e('0x3f')][_0xd93e('0x40')]?_0x58bc2b['attributes']:_0x51bfa7[_0xd93e('0x3c')];if(!_0x2756a7[_0xd93e('0x3a')][_0xd93e('0x41')](_0xd93e('0x42'))){_0x58bc2b['limit']=qs[_0xd93e('0x21')](_0x2756a7[_0xd93e('0x3a')][_0xd93e('0x21')]);_0x58bc2b['offset']=qs['offset'](_0x2756a7[_0xd93e('0x3a')][_0xd93e('0x1f')]);}_0x58bc2b[_0xd93e('0x43')]=qs[_0xd93e('0x44')](_0x2756a7[_0xd93e('0x3a')]['sort']);_0x58bc2b[_0xd93e('0x74')]=qs['filters'](_[_0xd93e('0x45')](_0x2756a7[_0xd93e('0x3a')],_0x51bfa7[_0xd93e('0x3b')]));_0x58bc2b[_0xd93e('0x74')][_0xd93e('0xad')]=_0x4abb3a['id'];if(_0x2756a7[_0xd93e('0x3a')][_0xd93e('0x82')]){_0x58bc2b[_0xd93e('0x74')]=_[_0xd93e('0xbc')](_0x58bc2b['where'],{'$or':_[_0xd93e('0x2e')](_0x58bc2b[_0xd93e('0x3f')],function(_0x58ccc4){var _0x3aa9da={};_0x3aa9da[_0x58ccc4]={'$like':'%'+_0x2756a7[_0xd93e('0x3a')][_0xd93e('0x82')]+'%'};return _0x3aa9da;})});}if(_0x2756a7[_0xd93e('0x3a')]['$gte']){var _0x5da0bc=_0x2756a7['query'][_0xd93e('0x79')][_0xd93e('0x69')](',');var _0x39fcc4={};_0x39fcc4[_0x5da0bc[0x0]]={'$gte':moment(_0x5da0bc[0x1])['format'](_0xd93e('0xbd'))};_0x58bc2b[_0xd93e('0x74')]=_['merge'](_0x58bc2b[_0xd93e('0x74')],_0x39fcc4);}_0x58bc2b=_['merge']({},_0x58bc2b,_0x2756a7[_0xd93e('0xb2')]);return db[_0xd93e('0xbb')][_0xd93e('0x22')]({'where':_0x58bc2b[_0xd93e('0x74')]})[_0xd93e('0x28')](function(_0x1fa0b4){_0x5d3ecd['count']=_0x1fa0b4;if(_0x2756a7['query'][_0xd93e('0xbe')]){_0x58bc2b[_0xd93e('0xbf')]=[{'all':!![]}];}return db[_0xd93e('0xbb')][_0xd93e('0xc0')](_0x58bc2b);})[_0xd93e('0x28')](function(_0x22afef){_0x5d3ecd[_0xd93e('0xc1')]=_0x22afef;return _0x5d3ecd;});}})[_0xd93e('0x28')](respondWithFilteredResult(_0xcb0595,_0x58bc2b))[_0xd93e('0x33')](handleError(_0xcb0595,null));};exports['addTags']=function(_0x1800e6,_0x270ad1,_0x2b08c2){return db[_0xd93e('0x35')][_0xd93e('0xb5')]({'where':{'id':_0x1800e6[_0xd93e('0xb0')]['id']}})['then'](handleEntityNotFound(_0x270ad1,null))[_0xd93e('0x28')](function(_0x28cef8){if(_0x28cef8){return _0x28cef8[_0xd93e('0xc2')](_0x1800e6[_0xd93e('0xb4')]['ids'],_[_0xd93e('0xb8')](_0x1800e6[_0xd93e('0xb4')],[_0xd93e('0xb9'),'id'])||{})[_0xd93e('0xc3')](function(){return db[_0xd93e('0x68')][_0xd93e('0xc0')]({'attributes':['id',_0xd93e('0x2c'),_0xd93e('0xc4')],'where':{'id':_0x1800e6[_0xd93e('0xb4')][_0xd93e('0xb9')]}});})[_0xd93e('0x28')](function(_0x3b9cfc){socket['emit'](_0xd93e('0xc5'),{'id':Number(_0x1800e6[_0xd93e('0xb0')]['id']),'tags':_0x3b9cfc||[]});return{'id':Number(_0x1800e6[_0xd93e('0xb0')]['id']),'tags':_0x3b9cfc||[]};});}})[_0xd93e('0x28')](respondWithResult(_0x270ad1,null))[_0xd93e('0x33')](handleError(_0x270ad1,null));};exports['removeTags']=function(_0x584b53,_0x23e910,_0x441ff2){return db[_0xd93e('0x35')][_0xd93e('0xb5')]({'where':{'id':_0x584b53[_0xd93e('0xb0')]['id']}})[_0xd93e('0x28')](handleEntityNotFound(_0x23e910,null))[_0xd93e('0x28')](function(_0x478e02){if(_0x478e02){return _0x478e02[_0xd93e('0xc6')](_0x584b53[_0xd93e('0x3a')][_0xd93e('0xb9')]);}})[_0xd93e('0x28')](respondWithStatusCode(_0x23e910,null))['catch'](handleError(_0x23e910,null));};exports[_0xd93e('0xc7')]=function(_0x109130,_0x521fc3){var _0x24bc67=moment()[_0xd93e('0xc8')]()['toString']();var _0x549a55=path[_0xd93e('0xc9')](config[_0xd93e('0xca')],_0xd93e('0xcb'),_0xd93e('0xcc'),_0xd93e('0xcd'));var _0x325d80=path[_0xd93e('0xc9')](config[_0xd93e('0xca')],'server',_0xd93e('0xcc'),_0xd93e('0xce'));var _0x413c48=path[_0xd93e('0xc9')](_0x549a55,_0x24bc67);var _0x11d362=util[_0xd93e('0xcf')](_0xd93e('0xd0'),_0x109130[_0xd93e('0xb0')]['id'],_0x24bc67);var _0x2ca7bb=path['join'](_0x549a55,_0x11d362);var _0x25ee99=[];_0x25ee99[_0xd93e('0x32')]({'model':db[_0xd93e('0xd1')],'as':'User','attributes':['id',_0xd93e('0x2f')],'raw':!![]});_0x25ee99[_0xd93e('0x32')]({'model':db[_0xd93e('0xd2')],'as':'Contact','attributes':['id','firstName',_0xd93e('0xd3')],'raw':!![]});var _0x47cc89=[{'model':db[_0xd93e('0xbb')],'as':_0xd93e('0xd4'),'attributes':['id',_0xd93e('0xb4'),_0xd93e('0x77'),_0xd93e('0xd5'),_0xd93e('0xd6'),_0xd93e('0x7f')],'include':_0x25ee99}];_0x47cc89[_0xd93e('0x32')]({'model':db[_0xd93e('0xd7')],'as':'Account','attributes':['id',_0xd93e('0x2c')]});_0x47cc89[_0xd93e('0x32')]({'model':db[_0xd93e('0xd1')],'as':_0xd93e('0xd8'),'attributes':['id','fullname']});return db[_0xd93e('0x35')][_0xd93e('0xb5')]({'where':{'id':_0x109130[_0xd93e('0xb0')]['id']},'include':_0x47cc89})[_0xd93e('0x28')](handleEntityNotFound(_0x521fc3,null))[_0xd93e('0x28')](function(_0x47238e){if(_0x47238e){var _0x5d4d90=_0x47238e['get']({'plain':!![]});fs[_0xd93e('0xd9')](_0x413c48);var _0x26fc63={'channel':_0xd93e('0xda'),'account':_0x5d4d90[_0xd93e('0xdb')][_0xd93e('0x2c')],'agent':_0x5d4d90[_0xd93e('0xd8')]?_0x5d4d90[_0xd93e('0xd8')][_0xd93e('0x2f')]:_0xd93e('0xdc'),'createdAt':moment(_0x5d4d90[_0xd93e('0x77')])['format'](_0xd93e('0xbd'))[_0xd93e('0x97')](),'closedAt':_0x5d4d90[_0xd93e('0xdd')]?moment(_0x5d4d90[_0xd93e('0xde')])['format'](_0xd93e('0xbd'))[_0xd93e('0x97')]():'','disposition':_0x5d4d90['disposition'],'messages':_(_0x5d4d90[_0xd93e('0xd4')])[_0xd93e('0x82')]({'secret':![]})[_0xd93e('0x2e')](function(_0x465cea){return{'date':moment(_0x465cea[_0xd93e('0x77')])[_0xd93e('0xcf')](_0xd93e('0xbd'))[_0xd93e('0x97')](),'sender':_0x465cea[_0xd93e('0xd5')]===_0xd93e('0xdf')?_0x465cea[_0xd93e('0xd1')]?_0x465cea[_0xd93e('0xd1')][_0xd93e('0x2f')]:'System':_0x465cea[_0xd93e('0x62')]['firstName']+(_0x465cea[_0xd93e('0x62')][_0xd93e('0xd3')]?'\x20'+_0x465cea['Contact'][_0xd93e('0xd3')]:''),'body':_0x465cea[_0xd93e('0xb4')],'direction':_0x465cea['direction']==='out'?'A':'C','secret':_0x465cea['secret'],'read':_0x465cea[_0xd93e('0x7f')]};})[_0xd93e('0x5f')]()};return ejs[_0xd93e('0xe0')](path[_0xd93e('0xc9')](config[_0xd93e('0xca')],_0xd93e('0xcb'),_0xd93e('0xe1'),'downloadInteraction.ejs'),{'interaction':_0x26fc63})[_0xd93e('0x28')](function(_0x4f1fed){var _0x2d893b=path[_0xd93e('0xc9')](_0x413c48,_0xd93e('0xe2')+_0x5d4d90['id']+'-'+_0x24bc67+_0xd93e('0xe3'));var _0xa84ba1={'path':_0x2d893b,'channel':_0xd93e('0xda'),'interactionId':_0x5d4d90['id']};return pdf['createPdfFromHTML'](_0x4f1fed,_0xa84ba1);})[_0xd93e('0x28')](function(){return new BPromise(function(_0x2bd9a4,_0xb3be9e){zipdir(_0x413c48,{'saveTo':_0x2ca7bb},function(_0x1c57d2,_0x5119c7){if(_0x1c57d2)return _0xb3be9e(_0x1c57d2);return _0x2bd9a4(_0x5119c7);});})[_0xd93e('0x28')](function(){return new BPromise(function(_0x3d2c6a,_0x407e05){rimraf(_0x413c48,function(_0x3e216c){if(_0x3e216c)_0x407e05(_0x3e216c);return _0x3d2c6a();});});})['then'](function(){return _0x521fc3[_0xd93e('0xc7')](_0x2ca7bb,_0x11d362,function(_0x461ec6){if(_0x461ec6){console[_0xd93e('0xe4')](_0xd93e('0xe5'),_0x461ec6);}else{fs[_0xd93e('0xe6')](_0x2ca7bb);}});});});}else{return _0x521fc3[_0xd93e('0x1b')](0xc8);}})[_0xd93e('0x33')](handleError(_0x521fc3,null));}; \ No newline at end of file +var _0xceb0=['value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','clone','order','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','i.SmsAccountId\x20IS\x20NULL','agent','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','sequelize','groupBy','SmsInteractionId','all','rows','SmsInteraction','includeAll','options','create','body','update','params','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','pick','filter','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','root','server','files','attachments','join','User','CmContact','lastName','Messages','SmsAccount','Account','get','Sms','Owner','N.A.','closed','closedAt','disposition','direction','out','firstName','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','select','field','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages'];(function(_0x47cde9,_0x19d013){var _0x26fdf1=function(_0x32fb69){while(--_0x32fb69){_0x47cde9['push'](_0x47cde9['shift']());}};_0x26fdf1(++_0x19d013);}(_0xceb0,0x173));var _0x0ceb=function(_0x103bff,_0x55040a){_0x103bff=_0x103bff-0x0;var _0x3844fe=_0xceb0[_0x103bff];return _0x3844fe;};'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(_0x0ceb('0x0'));var moment=require('moment');var BPromise=require(_0x0ceb('0x1'));var Mustache=require(_0x0ceb('0x2'));var util=require(_0x0ceb('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x0ceb('0x4'));var ejs=require(_0x0ceb('0x5'));var fs=require('fs');var fs_extra=require(_0x0ceb('0x6'));var _=require('lodash');var squel=require(_0x0ceb('0x7'));var crypto=require(_0x0ceb('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x0ceb('0x9'));var toCsv=require('to-csv');var querystring=require(_0x0ceb('0xa'));var Papa=require(_0x0ceb('0xb'));var Redis=require(_0x0ceb('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0ceb('0xd'));var pdf=require(_0x0ceb('0xe'));var hardwareService=require(_0x0ceb('0xf'));var logger=require(_0x0ceb('0x10'))(_0x0ceb('0x11'));var utils=require(_0x0ceb('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0ceb('0x13'));var db=require(_0x0ceb('0x14'))['db'];config[_0x0ceb('0x15')]=_[_0x0ceb('0x16')](config[_0x0ceb('0x15')],{'host':_0x0ceb('0x17'),'port':0x18eb});var socket=require(_0x0ceb('0x18'))(new Redis(config['redis']));require(_0x0ceb('0x19'))['register'](socket);function respondWithStatusCode(_0x55620b,_0x440f0e){_0x440f0e=_0x440f0e||0xcc;return function(_0x2e6128){if(_0x2e6128){return _0x55620b[_0x0ceb('0x1a')](_0x440f0e);}return _0x55620b['status'](_0x440f0e)[_0x0ceb('0x1b')]();};}function respondWithResult(_0xc02d04,_0x58d580){_0x58d580=_0x58d580||0xc8;return function(_0x1dc6f5){if(_0x1dc6f5){return _0xc02d04[_0x0ceb('0x1c')](_0x58d580)[_0x0ceb('0x1d')](_0x1dc6f5);}};}function respondWithFilteredResult(_0x436a7c,_0x18bed1){return function(_0x27fbeb){if(_0x27fbeb){var _0x2c5a89=typeof _0x18bed1[_0x0ceb('0x1e')]===_0x0ceb('0x1f')&&typeof _0x18bed1[_0x0ceb('0x20')]===_0x0ceb('0x1f');var _0x18f845=_0x27fbeb[_0x0ceb('0x21')];var _0x3988f6=_0x2c5a89?0x0:_0x18bed1[_0x0ceb('0x1e')];var _0x3dd970=_0x2c5a89?_0x27fbeb[_0x0ceb('0x21')]:_0x18bed1['offset']+_0x18bed1['limit'];var _0x25c48a;if(_0x3dd970>=_0x18f845){_0x3dd970=_0x18f845;_0x25c48a=0xc8;}else{_0x25c48a=0xce;}_0x436a7c[_0x0ceb('0x1c')](_0x25c48a);return _0x436a7c['set'](_0x0ceb('0x22'),_0x3988f6+'-'+_0x3dd970+'/'+_0x18f845)['json'](_0x27fbeb);}return null;};}function patchUpdates(_0x38a716){return function(_0xc2b85c){try{jsonpatch[_0x0ceb('0x23')](_0xc2b85c,_0x38a716,!![]);}catch(_0x17efd7){return BPromise[_0x0ceb('0x24')](_0x17efd7);}return _0xc2b85c['save']();};}function saveUpdates(_0x5c41dd,_0x4d29f5){return function(_0x1a1ab3){if(_0x1a1ab3){return _0x1a1ab3['update'](_0x5c41dd)[_0x0ceb('0x25')](function(_0x4c3e4c){return _0x4c3e4c;});}return null;};}function removeEntity(_0x45f2fe,_0xa8be2a){return function(_0x120a47){if(_0x120a47){return _0x120a47[_0x0ceb('0x26')]()['then'](function(){_0x45f2fe[_0x0ceb('0x1c')](0xcc)[_0x0ceb('0x1b')]();});}};}function handleEntityNotFound(_0x15a556,_0x1451d3){return function(_0x2432a8){if(!_0x2432a8){_0x15a556['sendStatus'](0x194);}return _0x2432a8;};}function handleError(_0x2de4f3,_0x3792bb){_0x3792bb=_0x3792bb||0x1f4;return function(_0x3c934b){logger[_0x0ceb('0x27')](_0x3c934b[_0x0ceb('0x28')]);if(_0x3c934b[_0x0ceb('0x29')]){delete _0x3c934b['name'];}_0x2de4f3[_0x0ceb('0x1c')](_0x3792bb)[_0x0ceb('0x2a')](_0x3c934b);};}function getInteractionUsers(_0x1b5337,_0x385d68){return new BPromise(function(_0x331e98,_0x128102){try{if(_0x385d68[_0x1b5337['id']]){_0x1b5337[_0x0ceb('0x2b')]=_[_0x0ceb('0x2c')](_0x385d68[_0x1b5337['id']],function(_0x34a0b3){return{'id':_0x34a0b3['id'],'fullname':_0x34a0b3[_0x0ceb('0x2d')]};});}}catch(_0x5196ad){_0x128102(_0x5196ad);}_0x331e98(_0x1b5337);});}function getInteractionTags(_0x503d0c,_0x3ee0e1){return new BPromise(function(_0x5b121e,_0x2f2b8e){try{if(_0x503d0c[_0x0ceb('0x2e')]){_0x503d0c[_0x0ceb('0x2f')]=[];_0x503d0c['TagIds'][_0x0ceb('0x30')](',')[_0x0ceb('0x31')](function(_0x1725fe){_0x503d0c[_0x0ceb('0x2f')][_0x0ceb('0x32')](_0x3ee0e1[_0x1725fe]);});}delete _0x503d0c[_0x0ceb('0x2e')];}catch(_0x33ab80){_0x2f2b8e(_0x33ab80);}_0x5b121e(_0x503d0c);});}function updateSmsInteraction(_0x1eb2a8,_0x2ad461,_0x3dadbd){return new BPromise(function(_0x133e81,_0x116a47){return getInteractionUsers(_0x1eb2a8,_0x3dadbd)[_0x0ceb('0x25')](function(_0x540851){return getInteractionTags(_0x540851,_0x2ad461);})[_0x0ceb('0x25')](function(_0x39e7e1){_0x133e81(_0x39e7e1);})[_0x0ceb('0x33')](function(_0x6be70d){_0x116a47(_0x6be70d);});});}exports[_0x0ceb('0x34')]=function(_0xa808dc,_0x56182f){var _0x44806d={},_0x48bf08={},_0x4938e2={'count':0x0,'rows':[]};var _0x5e440a=_[_0x0ceb('0x2c')](db['SmsInteraction'][_0x0ceb('0x35')],function(_0x2f5e8a){return{'name':_0x2f5e8a['fieldName'],'type':_0x2f5e8a[_0x0ceb('0x36')][_0x0ceb('0x37')]};});_0x48bf08[_0x0ceb('0x38')]=_['map'](_0x5e440a,_0x0ceb('0x29'));_0x48bf08[_0x0ceb('0x39')]=_[_0x0ceb('0x3a')](_0xa808dc[_0x0ceb('0x39')]);_0x48bf08[_0x0ceb('0x3b')]=_[_0x0ceb('0x3c')](_0x48bf08[_0x0ceb('0x38')],_0x48bf08[_0x0ceb('0x39')]);_0x44806d[_0x0ceb('0x3d')]=_[_0x0ceb('0x3c')](_0x48bf08[_0x0ceb('0x38')],qs[_0x0ceb('0x3e')](_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x3e')]));_0x44806d[_0x0ceb('0x3d')]=_0x44806d[_0x0ceb('0x3d')][_0x0ceb('0x3f')]?_0x44806d[_0x0ceb('0x3d')]:_0x48bf08[_0x0ceb('0x38')];if(!_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x40')](_0x0ceb('0x41'))){_0x44806d[_0x0ceb('0x20')]=qs[_0x0ceb('0x20')](_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x20')]);_0x44806d[_0x0ceb('0x1e')]=qs[_0x0ceb('0x1e')](_0xa808dc['query'][_0x0ceb('0x1e')]);}_0x44806d['order']=qs['sort'](_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x42')]);_0x44806d[_0x0ceb('0x43')]=qs['filters'](_['pick'](_0xa808dc[_0x0ceb('0x39')],_0x48bf08[_0x0ceb('0x3b')]),_0x5e440a);var _0x2cb999=[];var _0x17ab4a=squel[_0x0ceb('0x44')]()[_0x0ceb('0x45')]('id')[_0x0ceb('0x45')](_0x0ceb('0x29'))[_0x0ceb('0x45')]('color')[_0x0ceb('0x46')](_0x0ceb('0x47'));var _0x252daf=squel[_0x0ceb('0x44')]()['field'](_0x0ceb('0x48'))['field'](_0x0ceb('0x49'))['field'](_0x0ceb('0x4a'))[_0x0ceb('0x46')](_0x0ceb('0x4b'),'ui')[_0x0ceb('0x4c')](_0x0ceb('0x4d'),'u',_0x0ceb('0x4e'));var _0x6273bb=squel[_0x0ceb('0x44')]()['from'](_0x0ceb('0x4f'),'i')[_0x0ceb('0x4c')]('cm_contacts','c',_0x0ceb('0x50'))[_0x0ceb('0x4c')](_0x0ceb('0x4d'),'o',_0x0ceb('0x51'))[_0x0ceb('0x4c')]('sms_accounts','a',_0x0ceb('0x52'))[_0x0ceb('0x4c')](_0x0ceb('0x53'),'me',_0x0ceb('0x54'))[_0x0ceb('0x4c')](_0x0ceb('0x55'),'it',_0x0ceb('0x56'))[_0x0ceb('0x4c')](_0x0ceb('0x47'),'t','t.id\x20=\x20it.TagId');var _0x1f5e16=squel[_0x0ceb('0x57')]();var _0x264d7b=[];var _0x42d723=squel['expr']();var _0x4aef77;if(_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x58')]){_0x4aef77=as[_0x0ceb('0x59')](_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x58')]);var _0x59606a=_0x4aef77[_0x0ceb('0x5a')];for(var _0x6c1b83=0x0;_0x6c1b83<_0x4aef77['conditions']['length'];_0x6c1b83++){var _0x483570=_0x4aef77[_0x0ceb('0x5b')][_0x6c1b83];var _0x33a79b='i';var _0x13fa76=_['find'](_0x5e440a,[_0x0ceb('0x29'),_0x483570[_0x0ceb('0x45')]]);if(!_0x13fa76){switch(_0x483570['field']){case _0x0ceb('0x5c'):if(_0x483570[_0x0ceb('0x5d')]==0x1){_0x6273bb[_0x0ceb('0x5e')]('`'+_0x483570['field']+_0x0ceb('0x5f'));}else{_0x6273bb['having']('`'+_0x483570[_0x0ceb('0x45')]+_0x0ceb('0x60'));}break;case _0x0ceb('0x61'):if(_0x483570[_0x0ceb('0x62')]===_0x0ceb('0x63')){if(_0x483570['value'][_0x0ceb('0x30')]('\x20')[_0x0ceb('0x3f')]>0x1){_0x1f5e16[_0x59606a](_0x0ceb('0x64'),qs[_0x0ceb('0x65')](_0x483570[_0x0ceb('0x5d')]),null);}else{var _0x17369d='%'+_0x483570[_0x0ceb('0x5d')]+'%';_0x1f5e16[_0x59606a](_0x0ceb('0x66'),_0x17369d,_0x17369d,_0x17369d);}}else{_0x13fa76=_[_0x0ceb('0x67')](_0x5e440a,[_0x0ceb('0x29'),'ContactId']);_0x483570[_0x0ceb('0x45')]=_0x0ceb('0x68');_0x511f1c=as[_0x0ceb('0x69')](_0x33a79b,_0x13fa76[_0x0ceb('0x36')],_0x483570);_0x1f5e16[_0x59606a](_0x511f1c[_0x0ceb('0x6a')],_0x511f1c[_0x0ceb('0x5d')][_0x0ceb('0x6b')],_0x511f1c['value'][_0x0ceb('0x1b')]);}break;case _0x0ceb('0x6c'):var _0x3dd2d5=_0x483570[_0x0ceb('0x5d')][_0x0ceb('0x30')](',')[_0x0ceb('0x2c')](function(_0x472b5c){return Number(_0x472b5c);});_0x3dd2d5[_0x0ceb('0x31')](function(_0x2bbd32){_0x42d723['or'](_0x0ceb('0x6d'),'%,'+_0x2bbd32+',%');});_0x264d7b=_[_0x0ceb('0x6e')](_0x264d7b,_0x3dd2d5);break;case'User':if(_0x483570[_0x0ceb('0x62')]===_0x0ceb('0x63')){_0x1f5e16[_0x59606a](_0x0ceb('0x6f'),'%'+_0x483570[_0x0ceb('0x5d')]+'%',null);}else{_0x13fa76=_[_0x0ceb('0x67')](_0x5e440a,['name',_0x0ceb('0x70')]);_0x483570[_0x0ceb('0x45')]='UserId';_0x511f1c=as[_0x0ceb('0x69')](_0x33a79b,_0x13fa76['type'],_0x483570);_0x1f5e16[_0x59606a](_0x511f1c[_0x0ceb('0x6a')],_0x511f1c[_0x0ceb('0x5d')][_0x0ceb('0x6b')],_0x511f1c[_0x0ceb('0x5d')][_0x0ceb('0x1b')]);}break;case'body':_0x511f1c=as[_0x0ceb('0x69')]('me',null,_0x483570);_0x1f5e16[_0x59606a](_0x511f1c[_0x0ceb('0x6a')],_0x511f1c[_0x0ceb('0x5d')][_0x0ceb('0x6b')],_0x511f1c[_0x0ceb('0x5d')][_0x0ceb('0x1b')]);break;}}else{var _0x511f1c=as[_0x0ceb('0x69')](_0x33a79b,_0x13fa76[_0x0ceb('0x36')],_0x483570);_0x1f5e16[_0x59606a](_0x511f1c[_0x0ceb('0x6a')],_0x511f1c[_0x0ceb('0x5d')]['start'],_0x511f1c['value'][_0x0ceb('0x1b')]);}}}else{var _0x44f321=_(_0xa808dc[_0x0ceb('0x39')])[_0x0ceb('0x3a')]()[_0x0ceb('0x2c')](function(_0x27bc5e){return _[_0x0ceb('0x71')](_0x5e440a,['name',_0x27bc5e])?_0x27bc5e:undefined;})[_0x0ceb('0x72')]()[_0x0ceb('0x5d')]();if(!_[_0x0ceb('0x73')](_0x44f321)){_0x44f321[_0x0ceb('0x31')](function(_0x21f437){if(_0x21f437===_0x0ceb('0x74')){_0x6273bb[_0x0ceb('0x43')](_0x0ceb('0x75'),[][_0x0ceb('0x76')](_0xa808dc[_0x0ceb('0x39')][_0x21f437]));}else if(_0x21f437===_0x0ceb('0x77')){var _0x56e3a8=JSON[_0x0ceb('0x78')](_0xa808dc[_0x0ceb('0x39')][_0x21f437])[_0x0ceb('0x79')];var _0x12ea30=JSON[_0x0ceb('0x78')](_0xa808dc[_0x0ceb('0x39')][_0x21f437])[_0x0ceb('0x7a')];_0x6273bb['where'](_0x0ceb('0x7b'),_0x56e3a8,_0x12ea30);}else{if(_0xa808dc[_0x0ceb('0x39')][_0x21f437]===_0x0ceb('0x7c')){_0x6273bb['where']('i.'+_0x21f437+_0x0ceb('0x7d'));}else{_0x6273bb[_0x0ceb('0x43')]('i.'+_0x21f437+_0x0ceb('0x7e'),_0xa808dc[_0x0ceb('0x39')][_0x21f437]);}}});}if(_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x7f')]){if(_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x7f')]==0x1){_0x6273bb[_0x0ceb('0x5e')](_0x0ceb('0x80'));}else{_0x6273bb['having'](_0x0ceb('0x81'));}}if(_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x82')]){_0x264d7b=_['isArray'](_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x82')])?_0xa808dc[_0x0ceb('0x39')]['tag']:new Array(_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x82')]);_0x264d7b[_0x0ceb('0x31')](function(_0x21a177){_0x42d723['or'](_0x0ceb('0x6d'),'%,'+_0x21a177+',%');});}if(_0xa808dc['query']['filter']){var _0x58ec94=_0xa808dc[_0x0ceb('0x39')]['filter'][_0x0ceb('0x83')]('\x5c','\x5c\x5c')[_0x0ceb('0x83')](/'/g,'\x27\x27');if(qs[_0x0ceb('0x84')](_0x58ec94)){_0x1f5e16['or'](_0x0ceb('0x85'),_0x58ec94+'%')['or']('i.phone\x20LIKE\x20?',_0x58ec94+'%');}else{_0x1f5e16['or'](_0x0ceb('0x86'),qs[_0x0ceb('0x65')](_0x58ec94))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x58ec94+'%');}}}_0x6273bb[_0x0ceb('0x43')](_0x1f5e16);_0x6273bb['group'](_0x0ceb('0x87'));var _0x339198={'type':db[_0x0ceb('0x88')][_0x0ceb('0x89')]['SELECT'],'raw':!![]};var _0x5839d8=_0x6273bb[_0x0ceb('0x8a')]();_0x5839d8[_0x0ceb('0x45')]('i.id');_0x5839d8[_0x0ceb('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0ceb('0x5c'));if(_0x44806d[_0x0ceb('0x8b')]){_0x44806d[_0x0ceb('0x8b')][_0x0ceb('0x31')](function(_0x2e1fff){var _0x45a8c4=_0x2e1fff[0x0]==='contactName'?_0x2e1fff[0x0]:'i.'+_0x2e1fff[0x0];_0x6273bb[_0x0ceb('0x8b')](_0x45a8c4,_0x2e1fff[0x1]===_0x0ceb('0x8c')?![]:!![]);});}if(!_[_0x0ceb('0x73')](_0x264d7b)){_0x6273bb[_0x0ceb('0x5e')](_0x42d723);_0x5839d8[_0x0ceb('0x43')](_0x0ceb('0x8d'),_0x264d7b);}BPromise[_0x0ceb('0x8e')]()[_0x0ceb('0x25')](function(){if(!_0x4aef77){if(_0xa808dc['query'][_0x0ceb('0x74')])return;_0x5839d8[_0x0ceb('0x43')](_0x0ceb('0x8f'));_0x6273bb['where'](_0x0ceb('0x8f'));return;}if(_0xa808dc[_0x0ceb('0x90')][_0x0ceb('0x91')]!=='agent')return;return _0xa808dc[_0x0ceb('0x90')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x33ba4d){if(_[_0x0ceb('0x73')](_0x33ba4d)){_0x5839d8['where'](_0x0ceb('0x92'));_0x6273bb[_0x0ceb('0x43')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x5839d8[_0x0ceb('0x43')](_0x0ceb('0x75'),_['map'](_0x33ba4d,'id'));_0x6273bb['where'](_0x0ceb('0x75'),_[_0x0ceb('0x2c')](_0x33ba4d,'id'));}});})[_0x0ceb('0x25')](function(){if(_0xa808dc[_0x0ceb('0x90')][_0x0ceb('0x91')]===_0x0ceb('0x93')&&!_0x4aef77&&!_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x74')])return[];return db['sequelize'][_0x0ceb('0x39')](_0x5839d8[_0x0ceb('0x94')](),_0x339198);})[_0x0ceb('0x25')](function(_0x31b748){_0x4938e2[_0x0ceb('0x21')]=_0x31b748[_0x0ceb('0x3f')];if(_0x4938e2[_0x0ceb('0x21')]===0x0)return[];return db['sequelize'][_0x0ceb('0x39')](_0x17ab4a[_0x0ceb('0x94')](),_0x339198)[_0x0ceb('0x25')](function(_0x30b2b8){_0x2cb999=_[_0x0ceb('0x95')](_0x30b2b8,'id');_0x339198=_[_0x0ceb('0x96')](_0x339198,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x3e')]){_0x44806d[_0x0ceb('0x3d')][_0x0ceb('0x31')](function(_0x1bf592){_0x6273bb[_0x0ceb('0x45')]('i.'+_0x1bf592);});}else{_0x6273bb['field'](_0x0ceb('0x97'),_0x0ceb('0x5c'));_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0x98'),_0x0ceb('0x99'));_0x6273bb['field'](_0x0ceb('0x9a'),'Account.mandatoryDisposition');_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0x9b'),_0x0ceb('0x9c'));_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0x9d'));_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0x9e'),_0x0ceb('0x9f'));_0x6273bb[_0x0ceb('0x45')]('c.lastName',_0x0ceb('0xa0'));_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0xa1'),_0x0ceb('0xa2'));_0x6273bb[_0x0ceb('0x45')]('c.phone',_0x0ceb('0xa3'));_0x6273bb[_0x0ceb('0x45')]('c.mobile','Contact.mobile');_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0xa4'),_0x0ceb('0xa5'));_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0xa6'),_0x0ceb('0xa7'));_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0xa8'),_0x0ceb('0xa9'));_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0xaa'),'TagIds');}if(_0x44806d['limit'])_0x6273bb['limit'](_0x44806d[_0x0ceb('0x20')]);if(_0x44806d[_0x0ceb('0x1e')])_0x6273bb[_0x0ceb('0x1e')](_0x44806d[_0x0ceb('0x1e')]);return db['sequelize'][_0x0ceb('0x39')](_0x6273bb[_0x0ceb('0x94')](),_0x339198);})[_0x0ceb('0x25')](function(_0x88170a){if(_0x88170a[_0x0ceb('0x3f')]>0x0)_0x252daf[_0x0ceb('0x43')](_0x0ceb('0xab'),_[_0x0ceb('0x2c')](_0x88170a,'id'));return db[_0x0ceb('0xac')][_0x0ceb('0x39')](_0x252daf[_0x0ceb('0x94')](),_0x339198)[_0x0ceb('0x25')](function(_0x1b57db){var _0x480465=_[_0x0ceb('0xad')](_0x1b57db,_0x0ceb('0xae'));var _0x3af9de=[];_0x88170a[_0x0ceb('0x31')](function(_0x1235ba){_0x3af9de['push'](updateSmsInteraction(_0x1235ba,_0x2cb999,_0x480465));});return BPromise[_0x0ceb('0xaf')](_0x3af9de);});});})['then'](function(_0x83108d){_0x4938e2[_0x0ceb('0xb0')]=_0x83108d;return _0x4938e2;})[_0x0ceb('0x25')](respondWithFilteredResult(_0x56182f,_0x44806d))[_0x0ceb('0x33')](handleError(_0x56182f,null));};exports['show']=function(_0x959dfa,_0x2d863c){var _0x3a2979={'raw':![],'where':{'id':_0x959dfa['params']['id']}},_0x44e70f={};_0x44e70f[_0x0ceb('0x38')]=_['keys'](db[_0x0ceb('0xb1')]['rawAttributes']);_0x44e70f[_0x0ceb('0x39')]=_['keys'](_0x959dfa[_0x0ceb('0x39')]);_0x44e70f[_0x0ceb('0x3b')]=_['intersection'](_0x44e70f[_0x0ceb('0x38')],_0x44e70f['query']);_0x3a2979[_0x0ceb('0x3d')]=_[_0x0ceb('0x3c')](_0x44e70f[_0x0ceb('0x38')],qs[_0x0ceb('0x3e')](_0x959dfa[_0x0ceb('0x39')][_0x0ceb('0x3e')]));_0x3a2979[_0x0ceb('0x3d')]=_0x3a2979[_0x0ceb('0x3d')]['length']?_0x3a2979[_0x0ceb('0x3d')]:_0x44e70f['model'];if(_0x959dfa[_0x0ceb('0x39')][_0x0ceb('0xb2')]){_0x3a2979['include']=[{'all':!![]}];}_0x3a2979=_[_0x0ceb('0x96')]({},_0x3a2979,_0x959dfa[_0x0ceb('0xb3')]);return db[_0x0ceb('0xb1')][_0x0ceb('0x67')](_0x3a2979)[_0x0ceb('0x25')](handleEntityNotFound(_0x2d863c,null))[_0x0ceb('0x25')](respondWithResult(_0x2d863c,null))[_0x0ceb('0x33')](handleError(_0x2d863c,null));};exports[_0x0ceb('0xb4')]=function(_0x38bc57,_0x428c2b){return db['SmsInteraction'][_0x0ceb('0xb4')](_0x38bc57[_0x0ceb('0xb5')],{})[_0x0ceb('0x25')](respondWithResult(_0x428c2b,0xc9))[_0x0ceb('0x33')](handleError(_0x428c2b,null));};exports[_0x0ceb('0xb6')]=function(_0x5599c0,_0x3a2b20){if(_0x5599c0[_0x0ceb('0xb5')]['id']){delete _0x5599c0[_0x0ceb('0xb5')]['id'];}return db[_0x0ceb('0xb1')][_0x0ceb('0x67')]({'where':{'id':_0x5599c0[_0x0ceb('0xb7')]['id']}})['then'](handleEntityNotFound(_0x3a2b20,null))[_0x0ceb('0x25')](saveUpdates(_0x5599c0[_0x0ceb('0xb5')],null))[_0x0ceb('0x25')](respondWithResult(_0x3a2b20,null))[_0x0ceb('0x33')](handleError(_0x3a2b20,null));};exports['destroy']=function(_0x5b4af6,_0x1acb0c){return db[_0x0ceb('0xb1')][_0x0ceb('0x67')]({'where':{'id':_0x5b4af6[_0x0ceb('0xb7')]['id']}})[_0x0ceb('0x25')](handleEntityNotFound(_0x1acb0c,null))[_0x0ceb('0x25')](removeEntity(_0x1acb0c,null))[_0x0ceb('0x33')](handleError(_0x1acb0c,null));};exports[_0x0ceb('0xb8')]=function(_0x55a75b,_0x25064d){return db[_0x0ceb('0xb1')][_0x0ceb('0xb8')]()[_0x0ceb('0x25')](respondWithResult(_0x25064d,null))['catch'](handleError(_0x25064d,null));};exports[_0x0ceb('0xb9')]=function(_0x281fef,_0x4b4dcc,_0x281781){return db['SmsMessage'][_0x0ceb('0x67')]({'where':{'id':_0x281fef[_0x0ceb('0xb7')]['id']}})[_0x0ceb('0x25')](handleEntityNotFound(_0x4b4dcc,null))[_0x0ceb('0x25')](function(_0x10fa3c){if(_0x10fa3c){return _0x10fa3c[_0x0ceb('0xb9')](_0x281fef['body'][_0x0ceb('0xba')],_[_0x0ceb('0xbb')](_0x281fef['body'],[_0x0ceb('0xba'),'id'])||{});}})[_0x0ceb('0x25')](respondWithResult(_0x4b4dcc,null))['catch'](handleError(_0x4b4dcc,null));};exports[_0x0ceb('0xbc')]=function(_0x30e92d,_0x802af8,_0x33b71e){var _0x309a9c={'raw':![],'where':{}};var _0x6ecc59={};var _0x4f42c0={'count':0x0,'rows':[]};return db[_0x0ceb('0xb1')][_0x0ceb('0xbd')]({'where':{'id':_0x30e92d[_0x0ceb('0xb7')]['id']}})[_0x0ceb('0x25')](handleEntityNotFound(_0x802af8,null))[_0x0ceb('0x25')](function(_0x5dd644){if(_0x5dd644){_0x6ecc59[_0x0ceb('0x38')]=_['keys'](db[_0x0ceb('0xbe')]['rawAttributes']);_0x6ecc59[_0x0ceb('0x39')]=_[_0x0ceb('0x3a')](_0x30e92d[_0x0ceb('0x39')]);_0x6ecc59[_0x0ceb('0x3b')]=_['intersection'](_0x6ecc59[_0x0ceb('0x38')],_0x6ecc59[_0x0ceb('0x39')]);_0x309a9c['attributes']=_['intersection'](_0x6ecc59[_0x0ceb('0x38')],qs[_0x0ceb('0x3e')](_0x30e92d[_0x0ceb('0x39')][_0x0ceb('0x3e')]));_0x309a9c[_0x0ceb('0x3d')]=_0x309a9c[_0x0ceb('0x3d')][_0x0ceb('0x3f')]?_0x309a9c[_0x0ceb('0x3d')]:_0x6ecc59['model'];if(!_0x30e92d[_0x0ceb('0x39')][_0x0ceb('0x40')](_0x0ceb('0x41'))){_0x309a9c[_0x0ceb('0x20')]=qs[_0x0ceb('0x20')](_0x30e92d['query'][_0x0ceb('0x20')]);_0x309a9c[_0x0ceb('0x1e')]=qs['offset'](_0x30e92d[_0x0ceb('0x39')][_0x0ceb('0x1e')]);}_0x309a9c[_0x0ceb('0x8b')]=qs[_0x0ceb('0x42')](_0x30e92d['query']['sort']);_0x309a9c[_0x0ceb('0x43')]=qs[_0x0ceb('0x3b')](_[_0x0ceb('0xbf')](_0x30e92d['query'],_0x6ecc59[_0x0ceb('0x3b')]));_0x309a9c[_0x0ceb('0x43')][_0x0ceb('0xae')]=_0x5dd644['id'];if(_0x30e92d['query'][_0x0ceb('0xc0')]){_0x309a9c[_0x0ceb('0x43')]=_[_0x0ceb('0x96')](_0x309a9c[_0x0ceb('0x43')],{'$or':_[_0x0ceb('0x2c')](_0x309a9c['attributes'],function(_0x21854e){var _0x314ca8={};_0x314ca8[_0x21854e]={'$like':'%'+_0x30e92d[_0x0ceb('0x39')][_0x0ceb('0xc0')]+'%'};return _0x314ca8;})});}if(_0x30e92d[_0x0ceb('0x39')][_0x0ceb('0x79')]){var _0x2a174b=_0x30e92d[_0x0ceb('0x39')][_0x0ceb('0x79')][_0x0ceb('0x30')](',');var _0x68f149={};_0x68f149[_0x2a174b[0x0]]={'$gte':moment(_0x2a174b[0x1])[_0x0ceb('0xc1')](_0x0ceb('0xc2'))};_0x309a9c['where']=_[_0x0ceb('0x96')](_0x309a9c[_0x0ceb('0x43')],_0x68f149);}_0x309a9c=_['merge']({},_0x309a9c,_0x30e92d['options']);return db[_0x0ceb('0xbe')][_0x0ceb('0x21')]({'where':_0x309a9c[_0x0ceb('0x43')]})[_0x0ceb('0x25')](function(_0xf2dab2){_0x4f42c0['count']=_0xf2dab2;if(_0x30e92d[_0x0ceb('0x39')][_0x0ceb('0xb2')]){_0x309a9c[_0x0ceb('0xc3')]=[{'all':!![]}];}return db['SmsMessage'][_0x0ceb('0xc4')](_0x309a9c);})['then'](function(_0x3163ec){_0x4f42c0[_0x0ceb('0xb0')]=_0x3163ec;return _0x4f42c0;});}})[_0x0ceb('0x25')](respondWithFilteredResult(_0x802af8,_0x309a9c))[_0x0ceb('0x33')](handleError(_0x802af8,null));};exports[_0x0ceb('0xc5')]=function(_0xbad546,_0x1c28de,_0x1be9b9){return db['SmsInteraction'][_0x0ceb('0x67')]({'where':{'id':_0xbad546[_0x0ceb('0xb7')]['id']}})[_0x0ceb('0x25')](handleEntityNotFound(_0x1c28de,null))[_0x0ceb('0x25')](function(_0x1bac42){if(_0x1bac42){return _0x1bac42[_0x0ceb('0xc6')](_0xbad546[_0x0ceb('0xb5')][_0x0ceb('0xba')],_[_0x0ceb('0xbb')](_0xbad546['body'],[_0x0ceb('0xba'),'id'])||{})[_0x0ceb('0xc7')](function(){return db[_0x0ceb('0x6c')]['findAll']({'attributes':['id',_0x0ceb('0x29'),'color'],'where':{'id':_0xbad546[_0x0ceb('0xb5')][_0x0ceb('0xba')]}});})['then'](function(_0x3963cb){socket[_0x0ceb('0xc8')](_0x0ceb('0xc9'),{'id':Number(_0xbad546[_0x0ceb('0xb7')]['id']),'tags':_0x3963cb||[]});return{'id':Number(_0xbad546['params']['id']),'tags':_0x3963cb||[]};});}})[_0x0ceb('0x25')](respondWithResult(_0x1c28de,null))[_0x0ceb('0x33')](handleError(_0x1c28de,null));};exports[_0x0ceb('0xca')]=function(_0x54e3f8,_0x590bc6,_0xb4ab9f){return db[_0x0ceb('0xb1')][_0x0ceb('0x67')]({'where':{'id':_0x54e3f8[_0x0ceb('0xb7')]['id']}})[_0x0ceb('0x25')](handleEntityNotFound(_0x590bc6,null))['then'](function(_0xa64391){if(_0xa64391){return _0xa64391['removeTags'](_0x54e3f8[_0x0ceb('0x39')][_0x0ceb('0xba')]);}})[_0x0ceb('0x25')](respondWithStatusCode(_0x590bc6,null))['catch'](handleError(_0x590bc6,null));};exports[_0x0ceb('0xcb')]=function(_0x446aad,_0x54ac00){var _0x453dc9=moment()['unix']()[_0x0ceb('0x94')]();var _0x5c0bdd=path['join'](config[_0x0ceb('0xcc')],_0x0ceb('0xcd'),_0x0ceb('0xce'),'tmp');var _0x35e0af=path['join'](config['root'],_0x0ceb('0xcd'),_0x0ceb('0xce'),_0x0ceb('0xcf'));var _0x5c6d3f=path[_0x0ceb('0xd0')](_0x5c0bdd,_0x453dc9);var _0x2bbffb=util[_0x0ceb('0xc1')]('transcript-%d-%s.zip',_0x446aad[_0x0ceb('0xb7')]['id'],_0x453dc9);var _0x3f070c=path[_0x0ceb('0xd0')](_0x5c0bdd,_0x2bbffb);var _0x36c720=[];_0x36c720['push']({'model':db[_0x0ceb('0xd1')],'as':_0x0ceb('0xd1'),'attributes':['id',_0x0ceb('0x2d')],'raw':!![]});_0x36c720[_0x0ceb('0x32')]({'model':db[_0x0ceb('0xd2')],'as':_0x0ceb('0x61'),'attributes':['id','firstName',_0x0ceb('0xd3')],'raw':!![]});var _0x358779=[{'model':db['SmsMessage'],'as':_0x0ceb('0xd4'),'attributes':['id','body',_0x0ceb('0x77'),'direction','secret','read'],'include':_0x36c720}];_0x358779[_0x0ceb('0x32')]({'model':db[_0x0ceb('0xd5')],'as':_0x0ceb('0xd6'),'attributes':['id',_0x0ceb('0x29')]});_0x358779['push']({'model':db[_0x0ceb('0xd1')],'as':'Owner','attributes':['id',_0x0ceb('0x2d')]});return db['SmsInteraction'][_0x0ceb('0x67')]({'where':{'id':_0x446aad[_0x0ceb('0xb7')]['id']},'include':_0x358779})[_0x0ceb('0x25')](handleEntityNotFound(_0x54ac00,null))[_0x0ceb('0x25')](function(_0x41de22){if(_0x41de22){var _0x39e586=_0x41de22[_0x0ceb('0xd7')]({'plain':!![]});fs['mkdirSync'](_0x5c6d3f);var _0x2a967c={'channel':_0x0ceb('0xd8'),'account':_0x39e586[_0x0ceb('0xd6')][_0x0ceb('0x29')],'agent':_0x39e586[_0x0ceb('0xd9')]?_0x39e586['Owner'][_0x0ceb('0x2d')]:_0x0ceb('0xda'),'createdAt':moment(_0x39e586['createdAt'])['format'](_0x0ceb('0xc2'))[_0x0ceb('0x94')](),'closedAt':_0x39e586[_0x0ceb('0xdb')]?moment(_0x39e586[_0x0ceb('0xdc')])[_0x0ceb('0xc1')](_0x0ceb('0xc2'))[_0x0ceb('0x94')]():'','disposition':_0x39e586[_0x0ceb('0xdd')],'messages':_(_0x39e586['Messages'])[_0x0ceb('0xc0')]({'secret':![]})[_0x0ceb('0x2c')](function(_0x3782b2){return{'date':moment(_0x3782b2['createdAt'])['format'](_0x0ceb('0xc2'))[_0x0ceb('0x94')](),'sender':_0x3782b2[_0x0ceb('0xde')]===_0x0ceb('0xdf')?_0x3782b2[_0x0ceb('0xd1')]?_0x3782b2[_0x0ceb('0xd1')][_0x0ceb('0x2d')]:'System':_0x3782b2[_0x0ceb('0x61')][_0x0ceb('0xe0')]+(_0x3782b2[_0x0ceb('0x61')][_0x0ceb('0xd3')]?'\x20'+_0x3782b2[_0x0ceb('0x61')]['lastName']:''),'body':_0x3782b2[_0x0ceb('0xb5')],'direction':_0x3782b2[_0x0ceb('0xde')]===_0x0ceb('0xdf')?'A':'C','secret':_0x3782b2['secret'],'read':_0x3782b2[_0x0ceb('0x7f')]};})[_0x0ceb('0x5d')]()};return ejs['renderFile'](path['join'](config[_0x0ceb('0xcc')],'server',_0x0ceb('0xe1'),_0x0ceb('0xe2')),{'interaction':_0x2a967c})[_0x0ceb('0x25')](function(_0x5ed271){var _0x17fd66=path[_0x0ceb('0xd0')](_0x5c6d3f,'transcript-'+_0x39e586['id']+'-'+_0x453dc9+_0x0ceb('0xe3'));var _0x1e1e69={'path':_0x17fd66,'channel':_0x0ceb('0xd8'),'interactionId':_0x39e586['id']};return pdf[_0x0ceb('0xe4')](_0x5ed271,_0x1e1e69);})['then'](function(){return new BPromise(function(_0x3b3046,_0x4e92f1){zipdir(_0x5c6d3f,{'saveTo':_0x3f070c},function(_0x1c7b1b,_0x4ade28){if(_0x1c7b1b)return _0x4e92f1(_0x1c7b1b);return _0x3b3046(_0x4ade28);});})[_0x0ceb('0x25')](function(){return new BPromise(function(_0x367d43,_0x258761){rimraf(_0x5c6d3f,function(_0x34dd93){if(_0x34dd93)_0x258761(_0x34dd93);return _0x367d43();});});})['then'](function(){return _0x54ac00[_0x0ceb('0xcb')](_0x3f070c,_0x2bbffb,function(_0x1e48c1){if(_0x1e48c1){console[_0x0ceb('0xe5')](_0x0ceb('0xe6'),_0x1e48c1);}else{fs[_0x0ceb('0xe7')](_0x3f070c);}});});});}else{return _0x54ac00[_0x0ceb('0x1a')](0xc8);}})[_0x0ceb('0x33')](handleError(_0x54ac00,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 6f2c838..dd0ccf6 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 _0x6d11=['../../mysqldb','SmsInteraction','SmsMessage','save','update','getUsers','then','setDataValue','findAll','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0xa529a1,_0xaf990c){var _0x2a7c4c=function(_0x2ea77d){while(--_0x2ea77d){_0xa529a1['push'](_0xa529a1['shift']());}};_0x2a7c4c(++_0xaf990c);}(_0x6d11,0xbf));var _0x16d1=function(_0x26bd8e,_0x2a9fdf){_0x26bd8e=_0x26bd8e-0x0;var _0x3a659d=_0x6d11[_0x26bd8e];return _0x3a659d;};'use strict';var EventEmitter=require(_0x16d1('0x0'));var SmsInteraction=require(_0x16d1('0x1'))['db'][_0x16d1('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x16d1('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x16d1('0x4'),'afterUpdate':_0x16d1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x48754e){return function(_0x3e0e86,_0x46f7d7,_0x3eb9e2){_0x3e0e86[_0x16d1('0x6')]({'attributes':['id'],'raw':!![]})[_0x16d1('0x7')](function(_0x150217){_0x3e0e86[_0x16d1('0x8')]('Users',_0x150217['map'](function(_0x4fca47){return{'id':_0x4fca47['id']};}));return SmsMessage[_0x16d1('0x9')]({'where':{'SmsInteractionId':_0x3e0e86['id'],'direction':'in','read':![]},'raw':!![]});})[_0x16d1('0x7')](function(_0xe67758){_0x3e0e86[_0x16d1('0x8')]('unreadMessages',_0xe67758[_0x16d1('0xa')]);SmsInteractionEvents[_0x16d1('0xb')](_0x48754e+':'+_0x3e0e86['id'],_0x3e0e86);SmsInteractionEvents[_0x16d1('0xb')](_0x48754e,_0x3e0e86);_0x3eb9e2(null);})[_0x16d1('0xc')](_0x3eb9e2(null));};}for(var e in events){if(events[_0x16d1('0xd')](e)){var event=events[e];SmsInteraction[_0x16d1('0xe')](e,emitEvent(event));}}module[_0x16d1('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x7916=['Users','findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','SmsInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers'];(function(_0x5d93a4,_0x10fca8){var _0x17b491=function(_0x29189b){while(--_0x29189b){_0x5d93a4['push'](_0x5d93a4['shift']());}};_0x17b491(++_0x10fca8);}(_0x7916,0x128));var _0x6791=function(_0x361187,_0x373ef2){_0x361187=_0x361187-0x0;var _0x432f46=_0x7916[_0x361187];return _0x432f46;};'use strict';var EventEmitter=require(_0x6791('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x6791('0x1')];var SmsMessage=require(_0x6791('0x2'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x6791('0x3')](0x0);var events={'afterCreate':_0x6791('0x4'),'afterUpdate':_0x6791('0x5'),'afterDestroy':_0x6791('0x6')};function emitEvent(_0x5e6303){return function(_0xe98396,_0x5a5726,_0x3ca328){_0xe98396[_0x6791('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x8b85ff){_0xe98396['setDataValue'](_0x6791('0x8'),_0x8b85ff['map'](function(_0x4ef65f){return{'id':_0x4ef65f['id']};}));return SmsMessage[_0x6791('0x9')]({'where':{'SmsInteractionId':_0xe98396['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6791('0xa')](function(_0x579950){_0xe98396[_0x6791('0xb')](_0x6791('0xc'),_0x579950[_0x6791('0xd')]);SmsInteractionEvents['emit'](_0x5e6303+':'+_0xe98396['id'],_0xe98396);SmsInteractionEvents[_0x6791('0xe')](_0x5e6303,_0xe98396);_0x3ca328(null);})[_0x6791('0xf')](_0x3ca328(null));};}for(var e in events){if(events[_0x6791('0x10')](e)){var event=events[e];SmsInteraction[_0x6791('0x11')](e,emitEvent(event));}}module[_0x6791('0x12')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index ec53053..cf7d967 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 _0x0834=['rimraf','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x189544,_0x260aa6){var _0x34050b=function(_0x31f0a2){while(--_0x31f0a2){_0x189544['push'](_0x189544['shift']());}};_0x34050b(++_0x260aa6);}(_0x0834,0x88));var _0x4083=function(_0x23ae42,_0x4f72ae){_0x23ae42=_0x23ae42-0x0;var _0x8a6bdc=_0x0834[_0x23ae42];return _0x8a6bdc;};'use strict';var _=require(_0x4083('0x0'));var util=require(_0x4083('0x1'));var logger=require(_0x4083('0x2'))(_0x4083('0x3'));var moment=require(_0x4083('0x4'));var BPromise=require(_0x4083('0x5'));var rp=require(_0x4083('0x6'));var fs=require('fs');var path=require(_0x4083('0x7'));var rimraf=require(_0x4083('0x8'));var config=require('../../config/environment');var attributes=require(_0x4083('0x9'));module['exports']=function(_0x45543b,_0x4d2750){return _0x45543b[_0x4083('0xa')](_0x4083('0xb'),attributes,{'tableName':_0x4083('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x19b7d7,_0x4728ec,_0x591d16){if(_0x19b7d7[_0x4083('0xd')](_0x4083('0xe'))){_0x19b7d7[_0x4083('0xf')]=moment()[_0x4083('0x10')](_0x4083('0x11'));}_0x591d16(null,_0x19b7d7);}}});}; \ No newline at end of file +var _0x2dab=['path','../../config/environment','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x51376f,_0x3dbff2){var _0x4514e2=function(_0x22b21e){while(--_0x22b21e){_0x51376f['push'](_0x51376f['shift']());}};_0x4514e2(++_0x3dbff2);}(_0x2dab,0x176));var _0xb2da=function(_0x33c9ee,_0x2ee0da){_0x33c9ee=_0x33c9ee-0x0;var _0x20d5fd=_0x2dab[_0x33c9ee];return _0x20d5fd;};'use strict';var _=require(_0xb2da('0x0'));var util=require(_0xb2da('0x1'));var logger=require(_0xb2da('0x2'))(_0xb2da('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2da('0x4'));var rimraf=require('rimraf');var config=require(_0xb2da('0x5'));var attributes=require('./smsInteraction.attributes');module[_0xb2da('0x6')]=function(_0x290964,_0x1e7f1d){return _0x290964[_0xb2da('0x7')](_0xb2da('0x8'),attributes,{'tableName':_0xb2da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1c5e87,_0xdd5946,_0x44b653){if(_0x1c5e87[_0xb2da('0xa')](_0xb2da('0xb'))){_0x1c5e87[_0xb2da('0xc')]=moment()['format'](_0xb2da('0xd'));}_0x44b653(null,_0x1c5e87);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 3bba05e..d4a5ffe 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 _0x9c9f=['AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','client','redis','defaults','localhost','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateSmsInteraction','update','body','options','AddTagsToSmsInteraction','addTags','ids','omit','spread'];(function(_0x47b49b,_0x3f713b){var _0x18e9c8=function(_0x57727d){while(--_0x57727d){_0x47b49b['push'](_0x47b49b['shift']());}};_0x18e9c8(++_0x3f713b);}(_0x9c9f,0x67));var _0xf9c9=function(_0x534925,_0x501132){_0x534925=_0x534925-0x0;var _0x3f2960=_0x9c9f[_0x534925];return _0x3f2960;};'use strict';var _=require(_0xf9c9('0x0'));var util=require(_0xf9c9('0x1'));var moment=require(_0xf9c9('0x2'));var BPromise=require(_0xf9c9('0x3'));var rs=require(_0xf9c9('0x4'));var fs=require('fs');var Redis=require(_0xf9c9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf9c9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf9c9('0x7')]['http']({'port':0x232a});config[_0xf9c9('0x8')]=_[_0xf9c9('0x9')](config[_0xf9c9('0x8')],{'host':_0xf9c9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf9c9('0x8')]));require('./smsInteraction.socket')[_0xf9c9('0xb')](socket);function respondWithRpcPromise(_0x4ef94d,_0xe2fc93,_0x544fd0){return new BPromise(function(_0x173a80,_0x30f647){return client[_0xf9c9('0xc')](_0x4ef94d,_0x544fd0)[_0xf9c9('0xd')](function(_0xd5f85b){logger[_0xf9c9('0xe')](_0xf9c9('0xf'),_0xe2fc93,_0xf9c9('0x10'));logger[_0xf9c9('0x11')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0xe2fc93,_0xf9c9('0x10'),JSON[_0xf9c9('0x12')](_0xd5f85b));if(_0xd5f85b[_0xf9c9('0x13')]){if(_0xd5f85b[_0xf9c9('0x13')][_0xf9c9('0x14')]===0x1f4){logger[_0xf9c9('0x13')](_0xf9c9('0xf'),_0xe2fc93,_0xd5f85b[_0xf9c9('0x13')][_0xf9c9('0x15')]);return _0x30f647(_0xd5f85b['error'][_0xf9c9('0x15')]);}logger[_0xf9c9('0x13')]('SmsInteraction,\x20%s,\x20%s',_0xe2fc93,_0xd5f85b[_0xf9c9('0x13')]['message']);return _0x173a80(_0xd5f85b[_0xf9c9('0x13')]['message']);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0xe2fc93,_0xf9c9('0x10'));_0x173a80(_0xd5f85b[_0xf9c9('0x16')][_0xf9c9('0x15')]);}})[_0xf9c9('0x17')](function(_0x5e2d16){logger[_0xf9c9('0x13')]('SmsInteraction,\x20%s,\x20%s',_0xe2fc93,_0x5e2d16);_0x30f647(_0x5e2d16);});});}exports[_0xf9c9('0x18')]=function(_0x4e1979){var _0x555c02=this;return new Promise(function(_0x3bf9bd,_0x52d8e5){return db['SmsInteraction'][_0xf9c9('0x19')](_0x4e1979[_0xf9c9('0x1a')],{'raw':_0x4e1979['options']?_0x4e1979['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e1979[_0xf9c9('0x1b')]?_0x4e1979[_0xf9c9('0x1b')]['where']||null:null,'attributes':_0x4e1979[_0xf9c9('0x1b')]?_0x4e1979[_0xf9c9('0x1b')]['attributes']||null:null,'limit':_0x4e1979[_0xf9c9('0x1b')]?_0x4e1979[_0xf9c9('0x1b')]['limit']||null:null})[_0xf9c9('0xd')](function(_0x856924){logger[_0xf9c9('0xe')](_0xf9c9('0x18'),_0x4e1979);logger['debug'](_0xf9c9('0x18'),_0x4e1979,JSON[_0xf9c9('0x12')](_0x856924));_0x3bf9bd(_0x856924);})[_0xf9c9('0x17')](function(_0x56f72f){logger[_0xf9c9('0x13')](_0xf9c9('0x18'),_0x56f72f['message'],_0x4e1979);_0x52d8e5(_0x555c02[_0xf9c9('0x13')](0x1f4,_0x56f72f['message']));});});};exports[_0xf9c9('0x1c')]=function(_0x193544){return new Promise(function(_0x42b75a,_0x2fae46){return db['SmsInteraction']['find']({'where':_0x193544['options']?_0x193544[_0xf9c9('0x1b')]['where']||null:null})[_0xf9c9('0xd')](function(_0xea69ee){if(_0xea69ee){return _0xea69ee[_0xf9c9('0x1d')](_0x193544[_0xf9c9('0x1a')][_0xf9c9('0x1e')],_[_0xf9c9('0x1f')](_0x193544[_0xf9c9('0x1a')],[_0xf9c9('0x1e'),'id'])||{});}})[_0xf9c9('0x20')](function(_0x4b620d){logger[_0xf9c9('0xe')](_0xf9c9('0x21'),_0x193544);logger[_0xf9c9('0x11')](_0xf9c9('0x21'),_0x193544,JSON[_0xf9c9('0x12')](_0x4b620d));_0x42b75a(_0x4b620d);})[_0xf9c9('0x17')](function(_0x28e078){logger[_0xf9c9('0x13')](_0xf9c9('0x21'),_0x28e078[_0xf9c9('0x15')],_0x193544);_0x2fae46(_this['error'](0x1f4,_0x28e078[_0xf9c9('0x15')]));});});}; \ No newline at end of file +var _0xd1df=['find','addTags','ids','omit','AddTags','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./smsInteraction.socket','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','catch','AddTagsToSmsInteraction'];(function(_0x3352e6,_0x3e7124){var _0x495c46=function(_0x4517da){while(--_0x4517da){_0x3352e6['push'](_0x3352e6['shift']());}};_0x495c46(++_0x3e7124);}(_0xd1df,0x18b));var _0xfd1d=function(_0x32175a,_0x1c0f1d){_0x32175a=_0x32175a-0x0;var _0x3180f5=_0xd1df[_0x32175a];return _0x3180f5;};'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(_0xfd1d('0x0'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd1d('0x1'));var logger=require(_0xfd1d('0x2'))(_0xfd1d('0x3'));var config=require(_0xfd1d('0x4'));var jayson=require(_0xfd1d('0x5'));var client=jayson[_0xfd1d('0x6')][_0xfd1d('0x7')]({'port':0x232a});config['redis']=_[_0xfd1d('0x8')](config[_0xfd1d('0x9')],{'host':_0xfd1d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfd1d('0xb'))['register'](socket);function respondWithRpcPromise(_0x2779e0,_0x5c8659,_0xbe4512){return new BPromise(function(_0x911df,_0x3d5525){return client[_0xfd1d('0xc')](_0x2779e0,_0xbe4512)[_0xfd1d('0xd')](function(_0x1b695b){logger['info'](_0xfd1d('0xe'),_0x5c8659,_0xfd1d('0xf'));logger[_0xfd1d('0x10')](_0xfd1d('0x11'),_0x5c8659,_0xfd1d('0xf'),JSON[_0xfd1d('0x12')](_0x1b695b));if(_0x1b695b['error']){if(_0x1b695b[_0xfd1d('0x13')][_0xfd1d('0x14')]===0x1f4){logger[_0xfd1d('0x13')](_0xfd1d('0xe'),_0x5c8659,_0x1b695b[_0xfd1d('0x13')][_0xfd1d('0x15')]);return _0x3d5525(_0x1b695b[_0xfd1d('0x13')]['message']);}logger[_0xfd1d('0x13')](_0xfd1d('0xe'),_0x5c8659,_0x1b695b[_0xfd1d('0x13')][_0xfd1d('0x15')]);return _0x911df(_0x1b695b[_0xfd1d('0x13')][_0xfd1d('0x15')]);}else{logger[_0xfd1d('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x5c8659,_0xfd1d('0xf'));_0x911df(_0x1b695b[_0xfd1d('0x17')][_0xfd1d('0x15')]);}})['catch'](function(_0x4105a7){logger[_0xfd1d('0x13')](_0xfd1d('0xe'),_0x5c8659,_0x4105a7);_0x3d5525(_0x4105a7);});});}exports[_0xfd1d('0x18')]=function(_0x3580d4){var _0x405353=this;return new Promise(function(_0x330069,_0x2b9252){return db[_0xfd1d('0x19')][_0xfd1d('0x1a')](_0x3580d4[_0xfd1d('0x1b')],{'raw':_0x3580d4[_0xfd1d('0x1c')]?_0x3580d4[_0xfd1d('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3580d4['options']?_0x3580d4[_0xfd1d('0x1c')][_0xfd1d('0x1d')]||null:null,'attributes':_0x3580d4[_0xfd1d('0x1c')]?_0x3580d4[_0xfd1d('0x1c')][_0xfd1d('0x1e')]||null:null,'limit':_0x3580d4[_0xfd1d('0x1c')]?_0x3580d4['options'][_0xfd1d('0x1f')]||null:null})[_0xfd1d('0xd')](function(_0x390b95){logger[_0xfd1d('0x16')](_0xfd1d('0x18'),_0x3580d4);logger['debug'](_0xfd1d('0x18'),_0x3580d4,JSON[_0xfd1d('0x12')](_0x390b95));_0x330069(_0x390b95);})[_0xfd1d('0x20')](function(_0x2a6dff){logger['error'](_0xfd1d('0x18'),_0x2a6dff[_0xfd1d('0x15')],_0x3580d4);_0x2b9252(_0x405353[_0xfd1d('0x13')](0x1f4,_0x2a6dff[_0xfd1d('0x15')]));});});};exports[_0xfd1d('0x21')]=function(_0x1de989){return new Promise(function(_0x3c7f35,_0x43c4e2){return db['SmsInteraction'][_0xfd1d('0x22')]({'where':_0x1de989[_0xfd1d('0x1c')]?_0x1de989[_0xfd1d('0x1c')]['where']||null:null})[_0xfd1d('0xd')](function(_0x2d4deb){if(_0x2d4deb){return _0x2d4deb[_0xfd1d('0x23')](_0x1de989[_0xfd1d('0x1b')][_0xfd1d('0x24')],_[_0xfd1d('0x25')](_0x1de989[_0xfd1d('0x1b')],['ids','id'])||{});}})['spread'](function(_0x1a593f){logger[_0xfd1d('0x16')](_0xfd1d('0x26'),_0x1de989);logger[_0xfd1d('0x10')](_0xfd1d('0x26'),_0x1de989,JSON[_0xfd1d('0x12')](_0x1a593f));_0x3c7f35(_0x1a593f);})[_0xfd1d('0x20')](function(_0x5cf061){logger['error'](_0xfd1d('0x26'),_0x5cf061[_0xfd1d('0x15')],_0x1de989);_0x43c4e2(_this[_0xfd1d('0x13')](0x1f4,_0x5cf061[_0xfd1d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index c9bddfb..4cdf09d 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 _0x487c=['length','smsInteraction:','./smsInteraction.events','remove','update','emit','register'];(function(_0x1653b1,_0x35b7d1){var _0x3e0b17=function(_0x5f21fc){while(--_0x5f21fc){_0x1653b1['push'](_0x1653b1['shift']());}};_0x3e0b17(++_0x35b7d1);}(_0x487c,0x87));var _0xc487=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x487c[_0x278e3c];return _0x3e2d9b;};'use strict';var SmsInteractionEvents=require(_0xc487('0x0'));var events=['save',_0xc487('0x1'),_0xc487('0x2')];function createListener(_0x1281f9,_0x12cc4f){return function(_0x3153a8){_0x12cc4f[_0xc487('0x3')](_0x1281f9,_0x3153a8);};}function removeListener(_0x3e3a2b,_0x3a587f){return function(){SmsInteractionEvents['removeListener'](_0x3e3a2b,_0x3a587f);};}exports[_0xc487('0x4')]=function(_0x2c4780){for(var _0x584bad=0x0,_0x230494=events[_0xc487('0x5')];_0x584bad<_0x230494;_0x584bad++){var _0x604cb2=events[_0x584bad];var _0x10e48a=createListener(_0xc487('0x6')+_0x604cb2,_0x2c4780);SmsInteractionEvents['on'](_0x604cb2,_0x10e48a);}}; \ No newline at end of file +var _0xdd02=['register','smsInteraction:','remove','update','emit','removeListener'];(function(_0x5d30ba,_0x4e82e1){var _0xa46114=function(_0x50c6ca){while(--_0x50c6ca){_0x5d30ba['push'](_0x5d30ba['shift']());}};_0xa46114(++_0x4e82e1);}(_0xdd02,0x134));var _0x2dd0=function(_0x2d8970,_0xb4c57){_0x2d8970=_0x2d8970-0x0;var _0x1841dd=_0xdd02[_0x2d8970];return _0x1841dd;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0x2dd0('0x0'),_0x2dd0('0x1')];function createListener(_0x471afb,_0x2760da){return function(_0x4fa7a7){_0x2760da[_0x2dd0('0x2')](_0x471afb,_0x4fa7a7);};}function removeListener(_0x3aa3f4,_0x100c95){return function(){SmsInteractionEvents[_0x2dd0('0x3')](_0x3aa3f4,_0x100c95);};}exports[_0x2dd0('0x4')]=function(_0x42abab){for(var _0x460efb=0x0,_0x1ecf97=events['length'];_0x460efb<_0x1ecf97;_0x460efb++){var _0x539c0c=events[_0x460efb];var _0x103a9c=createListener(_0x2dd0('0x5')+_0x539c0c,_0x42abab);SmsInteractionEvents['on'](_0x539c0c,_0x103a9c);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 573259f..1482df0 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 _0xbdcf=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','destroy','exports','multer','path','connect-timeout','express'];(function(_0x14c982,_0x1c2afa){var _0x5e48e1=function(_0x3b0bea){while(--_0x3b0bea){_0x14c982['push'](_0x14c982['shift']());}};_0x5e48e1(++_0x1c2afa);}(_0xbdcf,0x173));var _0xfbdc=function(_0x4fdb23,_0x289f13){_0x4fdb23=_0x4fdb23-0x0;var _0x389ac5=_0xbdcf[_0x4fdb23];return _0x389ac5;};'use strict';var multer=require(_0xfbdc('0x0'));var util=require('util');var path=require(_0xfbdc('0x1'));var timeout=require(_0xfbdc('0x2'));var express=require(_0xfbdc('0x3'));var router=express[_0xfbdc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfbdc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfbdc('0x6'));var controller=require('./smsMessage.controller');router[_0xfbdc('0x7')]('/',auth[_0xfbdc('0x8')](),controller['index']);router[_0xfbdc('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xfbdc('0x9')]);router[_0xfbdc('0x7')](_0xfbdc('0xa'),auth[_0xfbdc('0x8')](),controller[_0xfbdc('0xb')]);router[_0xfbdc('0xc')]('/',auth[_0xfbdc('0x8')](),interaction['tracked'](_0xfbdc('0xd'),_0xfbdc('0xe')),controller[_0xfbdc('0xf')]);router[_0xfbdc('0xc')](_0xfbdc('0x10'),controller[_0xfbdc('0x11')]);router[_0xfbdc('0x12')](_0xfbdc('0xa'),auth['isAuthenticated'](),controller[_0xfbdc('0x13')]);router[_0xfbdc('0x12')](_0xfbdc('0x14'),auth[_0xfbdc('0x8')](),controller[_0xfbdc('0x15')]);router[_0xfbdc('0x12')](_0xfbdc('0x16'),auth[_0xfbdc('0x8')](),controller['reject']);router['delete'](_0xfbdc('0xa'),auth[_0xfbdc('0x8')](),controller[_0xfbdc('0x17')]);module[_0xfbdc('0x18')]=router; \ No newline at end of file +var _0x75d4=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','describe','show','post','isAuthenticated','tracked','sms','smsmessage:create','create','/:id/status','put','/:id','update','/:id/accept'];(function(_0xdea57b,_0x4edb9f){var _0x2e398c=function(_0xbba711){while(--_0xbba711){_0xdea57b['push'](_0xdea57b['shift']());}};_0x2e398c(++_0x4edb9f);}(_0x75d4,0x16e));var _0x475d=function(_0x4bad1d,_0x1172c7){_0x4bad1d=_0x4bad1d-0x0;var _0x1edd20=_0x75d4[_0x4bad1d];return _0x1edd20;};'use strict';var multer=require(_0x475d('0x0'));var util=require(_0x475d('0x1'));var path=require(_0x475d('0x2'));var timeout=require(_0x475d('0x3'));var express=require(_0x475d('0x4'));var router=express[_0x475d('0x5')]();var fs_extra=require(_0x475d('0x6'));var auth=require(_0x475d('0x7'));var interaction=require(_0x475d('0x8'));var config=require(_0x475d('0x9'));var controller=require('./smsMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x475d('0xa')]);router[_0x475d('0xb')](_0x475d('0xc'),auth['isAuthenticated'](),controller[_0x475d('0xd')]);router[_0x475d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x475d('0xe')]);router[_0x475d('0xf')]('/',auth[_0x475d('0x10')](),interaction[_0x475d('0x11')](_0x475d('0x12'),_0x475d('0x13')),controller[_0x475d('0x14')]);router[_0x475d('0xf')](_0x475d('0x15'),controller['status']);router[_0x475d('0x16')](_0x475d('0x17'),auth[_0x475d('0x10')](),controller[_0x475d('0x18')]);router[_0x475d('0x16')](_0x475d('0x19'),auth['isAuthenticated'](),controller['accept']);router['put']('/:id/reject',auth[_0x475d('0x10')](),controller['reject']);router['delete'](_0x475d('0x17'),auth[_0x475d('0x10')](),controller[_0x475d('0x1a')]);module[_0x475d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 495c097..14ddfac 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 _0x5101=['exports','TEXT','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5101,0x137));var _0x1510=function(_0x2da5e3,_0x125f09){_0x2da5e3=_0x2da5e3-0x0;var _0x20e6ee=_0x5101[_0x2da5e3];return _0x20e6ee;};'use strict';var Sequelize=require(_0x1510('0x0'));module[_0x1510('0x1')]={'body':{'type':Sequelize[_0x1510('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1510('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1510('0x4')]('in',_0x1510('0x5')),'defaultValue':_0x1510('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1510('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x1510('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1510('0x6')]},'providerResponse':{'type':Sequelize[_0x1510('0x2')]}}; \ No newline at end of file +var _0xe2ae=['BOOLEAN','TEXT','exports','medium','ENUM','out','STRING','DATE'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xe2ae,0x82));var _0xee2a=function(_0x1f64be,_0x1c37e5){_0x1f64be=_0x1f64be-0x0;var _0x151cfb=_0xe2ae[_0x1f64be];return _0x151cfb;};'use strict';var Sequelize=require('sequelize');module[_0xee2a('0x0')]={'body':{'type':Sequelize['TEXT'](_0xee2a('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xee2a('0x2')]('in',_0xee2a('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xee2a('0x4')](0xbe)},'phone':{'type':Sequelize[_0xee2a('0x4')]},'readAt':{'type':Sequelize[_0xee2a('0x5')]},'secret':{'type':Sequelize[_0xee2a('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xee2a('0x4')]},'providerResponse':{'type':Sequelize[_0xee2a('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 1f31efa..3791b27 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 _0x2b47=['findAll','rows','show','params','length','find','create','body','update','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','contact','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','plivio','infobip','results','groupName','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','end','sendStatus','stack','name','send','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x57cc32,_0xf29926){var _0x27d3ad=function(_0x1c1869){while(--_0x1c1869){_0x57cc32['push'](_0x57cc32['shift']());}};_0x27d3ad(++_0xf29926);}(_0x2b47,0x177));var _0x72b4=function(_0x2120e5,_0x4f4b95){_0x2120e5=_0x2120e5-0x0;var _0x22ba48=_0x2b47[_0x2120e5];return _0x22ba48;};'use strict';var emlformat=require(_0x72b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x72b4('0x1'));var jsonpatch=require(_0x72b4('0x2'));var rp=require(_0x72b4('0x3'));var moment=require('moment');var BPromise=require(_0x72b4('0x4'));var Mustache=require(_0x72b4('0x5'));var util=require(_0x72b4('0x6'));var path=require(_0x72b4('0x7'));var sox=require(_0x72b4('0x8'));var csv=require(_0x72b4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72b4('0xa'));var _=require('lodash');var squel=require(_0x72b4('0xb'));var crypto=require(_0x72b4('0xc'));var jsforce=require(_0x72b4('0xd'));var deskjs=require(_0x72b4('0xe'));var toCsv=require(_0x72b4('0x9'));var querystring=require(_0x72b4('0xf'));var Papa=require(_0x72b4('0x10'));var Redis=require(_0x72b4('0x11'));var authService=require(_0x72b4('0x12'));var qs=require(_0x72b4('0x13'));var as=require(_0x72b4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x72b4('0x15'))(_0x72b4('0x16'));var utils=require(_0x72b4('0x17'));var config=require(_0x72b4('0x18'));var licenseUtil=require(_0x72b4('0x19'));var db=require(_0x72b4('0x1a'))['db'];config[_0x72b4('0x1b')]=_[_0x72b4('0x1c')](config[_0x72b4('0x1b')],{'host':_0x72b4('0x1d'),'port':0x18eb});var socket=require(_0x72b4('0x1e'))(new Redis(config['redis']));require(_0x72b4('0x1f'))[_0x72b4('0x20')](socket);var jayson=require(_0x72b4('0x21'));var client=jayson[_0x72b4('0x22')]['http']({'port':0x232c});var client9002=jayson['client'][_0x72b4('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x5c7c36,_0x21ff7d,_0x2d4fd0,_0x5ac4fc){return new BPromise(function(_0x2a9c37,_0x3cb2dc){var _0x3318fc=_0x5ac4fc||client;return _0x3318fc[_0x72b4('0x24')](_0x5c7c36,_0x2d4fd0)[_0x72b4('0x25')](function(_0x334910){logger[_0x72b4('0x26')](_0x72b4('0x27'),_0x21ff7d,_0x72b4('0x28'));logger['debug'](_0x72b4('0x29'),_0x21ff7d,'request\x20sent',JSON[_0x72b4('0x2a')](_0x334910));if(_0x334910[_0x72b4('0x2b')]){if(_0x334910['error'][_0x72b4('0x2c')]===0x1f4){logger[_0x72b4('0x2b')]('SmsMessage,\x20%s,\x20%s',_0x21ff7d,_0x334910[_0x72b4('0x2b')]['message']);return _0x3cb2dc(_0x334910[_0x72b4('0x2b')]['message']);}logger['error'](_0x72b4('0x27'),_0x21ff7d,_0x334910['error'][_0x72b4('0x2d')]);return _0x2a9c37(_0x334910[_0x72b4('0x2b')][_0x72b4('0x2d')]);}else{logger['info'](_0x72b4('0x27'),_0x21ff7d,_0x72b4('0x28'));_0x2a9c37(_0x334910[_0x72b4('0x2e')]['message']);}})[_0x72b4('0x2f')](function(_0x10df07){logger[_0x72b4('0x2b')](_0x72b4('0x27'),_0x21ff7d,_0x10df07);_0x3cb2dc(_0x10df07);});});}function respondWithStatusCode(_0x393eef,_0x29d6fc){_0x29d6fc=_0x29d6fc||0xcc;return function(_0x245ed0){if(_0x245ed0){return _0x393eef['sendStatus'](_0x29d6fc);}return _0x393eef[_0x72b4('0x30')](_0x29d6fc)['end']();};}function respondWithResult(_0x32c0ab,_0x20bcb0){_0x20bcb0=_0x20bcb0||0xc8;return function(_0x3489bc){if(_0x3489bc){return _0x32c0ab[_0x72b4('0x30')](_0x20bcb0)[_0x72b4('0x31')](_0x3489bc);}};}function respondWithFilteredResult(_0x3c7167,_0x5c3ac8){return function(_0x3a5a55){if(_0x3a5a55){var _0x67f244=typeof _0x5c3ac8[_0x72b4('0x32')]===_0x72b4('0x33')&&typeof _0x5c3ac8[_0x72b4('0x34')]===_0x72b4('0x33');var _0x28c7ce=_0x3a5a55[_0x72b4('0x35')];var _0x5554cb=_0x67f244?0x0:_0x5c3ac8[_0x72b4('0x32')];var _0x16eef5=_0x67f244?_0x3a5a55['count']:_0x5c3ac8[_0x72b4('0x32')]+_0x5c3ac8[_0x72b4('0x34')];var _0x366b76;if(_0x16eef5>=_0x28c7ce){_0x16eef5=_0x28c7ce;_0x366b76=0xc8;}else{_0x366b76=0xce;}_0x3c7167[_0x72b4('0x30')](_0x366b76);return _0x3c7167[_0x72b4('0x36')](_0x72b4('0x37'),_0x5554cb+'-'+_0x16eef5+'/'+_0x28c7ce)[_0x72b4('0x31')](_0x3a5a55);}return null;};}function patchUpdates(_0x469e31){return function(_0x29ecd7){try{jsonpatch[_0x72b4('0x38')](_0x29ecd7,_0x469e31,!![]);}catch(_0x36311b){return BPromise[_0x72b4('0x39')](_0x36311b);}return _0x29ecd7[_0x72b4('0x3a')]();};}function saveUpdates(_0x3ad6a5,_0x189f93){return function(_0x5d805d){if(_0x5d805d){return _0x5d805d['update'](_0x3ad6a5)['then'](function(_0x14b77c){return _0x14b77c;});}return null;};}function removeEntity(_0x503442,_0xaae20e){return function(_0x59dcf8){if(_0x59dcf8){return _0x59dcf8[_0x72b4('0x3b')]()[_0x72b4('0x25')](function(){_0x503442[_0x72b4('0x30')](0xcc)[_0x72b4('0x3c')]();});}};}function handleEntityNotFound(_0x47d5a4,_0x14a6d6){return function(_0xfb8f0b){if(!_0xfb8f0b){_0x47d5a4[_0x72b4('0x3d')](0x194);}return _0xfb8f0b;};}function handleError(_0x2289c8,_0x366403){_0x366403=_0x366403||0x1f4;return function(_0x22c56c){logger[_0x72b4('0x2b')](_0x22c56c[_0x72b4('0x3e')]);if(_0x22c56c[_0x72b4('0x3f')]){delete _0x22c56c['name'];}_0x2289c8['status'](_0x366403)[_0x72b4('0x40')](_0x22c56c);};}exports['index']=function(_0x4efe29,_0x3d5811){var _0x5edb79={},_0x3f0055={},_0x324314={'count':0x0,'rows':[]};var _0x6227e=_[_0x72b4('0x41')](db[_0x72b4('0x42')][_0x72b4('0x43')],function(_0x271c8d){return{'name':_0x271c8d[_0x72b4('0x44')],'type':_0x271c8d[_0x72b4('0x45')][_0x72b4('0x46')]};});_0x3f0055[_0x72b4('0x47')]=_[_0x72b4('0x41')](_0x6227e,_0x72b4('0x3f'));_0x3f0055[_0x72b4('0x48')]=_['keys'](_0x4efe29[_0x72b4('0x48')]);_0x3f0055[_0x72b4('0x49')]=_['intersection'](_0x3f0055[_0x72b4('0x47')],_0x3f0055[_0x72b4('0x48')]);_0x5edb79[_0x72b4('0x4a')]=_[_0x72b4('0x4b')](_0x3f0055['model'],qs[_0x72b4('0x4c')](_0x4efe29[_0x72b4('0x48')][_0x72b4('0x4c')]));_0x5edb79[_0x72b4('0x4a')]=_0x5edb79[_0x72b4('0x4a')]['length']?_0x5edb79['attributes']:_0x3f0055[_0x72b4('0x47')];if(!_0x4efe29[_0x72b4('0x48')]['hasOwnProperty'](_0x72b4('0x4d'))){_0x5edb79['limit']=qs[_0x72b4('0x34')](_0x4efe29['query']['limit']);_0x5edb79[_0x72b4('0x32')]=qs[_0x72b4('0x32')](_0x4efe29['query'][_0x72b4('0x32')]);}_0x5edb79[_0x72b4('0x4e')]=qs['sort'](_0x4efe29[_0x72b4('0x48')][_0x72b4('0x4f')]);_0x5edb79[_0x72b4('0x50')]=qs[_0x72b4('0x49')](_[_0x72b4('0x51')](_0x4efe29['query'],_0x3f0055['filters']),_0x6227e);if(_0x4efe29[_0x72b4('0x48')][_0x72b4('0x52')]){_0x5edb79[_0x72b4('0x50')]=_[_0x72b4('0x53')](_0x5edb79[_0x72b4('0x50')],{'$or':_['map'](_0x6227e,function(_0x585ac0){if(_0x585ac0[_0x72b4('0x45')]!==_0x72b4('0x54')){var _0x2d0b8b={};_0x2d0b8b[_0x585ac0[_0x72b4('0x3f')]]={'$like':'%'+_0x4efe29['query'][_0x72b4('0x52')]+'%'};return _0x2d0b8b;}})});}_0x5edb79=_[_0x72b4('0x53')]({},_0x5edb79,_0x4efe29[_0x72b4('0x55')]);var _0x2177ac={'where':_0x5edb79['where']};return db[_0x72b4('0x42')][_0x72b4('0x35')](_0x2177ac)[_0x72b4('0x25')](function(_0x59ee6f){_0x324314[_0x72b4('0x35')]=_0x59ee6f;if(_0x4efe29[_0x72b4('0x48')][_0x72b4('0x56')]){_0x5edb79['include']=[{'all':!![]}];}return db['SmsMessage'][_0x72b4('0x57')](_0x5edb79);})[_0x72b4('0x25')](function(_0x4c93c6){_0x324314[_0x72b4('0x58')]=_0x4c93c6;return _0x324314;})[_0x72b4('0x25')](respondWithFilteredResult(_0x3d5811,_0x5edb79))[_0x72b4('0x2f')](handleError(_0x3d5811,null));};exports[_0x72b4('0x59')]=function(_0xd6edfe,_0x515bcf){var _0xe177f={'raw':!![],'where':{'id':_0xd6edfe[_0x72b4('0x5a')]['id']}},_0x4cb9be={};_0x4cb9be['model']=_['keys'](db[_0x72b4('0x42')]['rawAttributes']);_0x4cb9be[_0x72b4('0x48')]=_['keys'](_0xd6edfe[_0x72b4('0x48')]);_0x4cb9be[_0x72b4('0x49')]=_[_0x72b4('0x4b')](_0x4cb9be[_0x72b4('0x47')],_0x4cb9be[_0x72b4('0x48')]);_0xe177f[_0x72b4('0x4a')]=_[_0x72b4('0x4b')](_0x4cb9be['model'],qs[_0x72b4('0x4c')](_0xd6edfe[_0x72b4('0x48')]['fields']));_0xe177f[_0x72b4('0x4a')]=_0xe177f['attributes'][_0x72b4('0x5b')]?_0xe177f[_0x72b4('0x4a')]:_0x4cb9be['model'];if(_0xd6edfe['query'][_0x72b4('0x56')]){_0xe177f['include']=[{'all':!![]}];}_0xe177f=_[_0x72b4('0x53')]({},_0xe177f,_0xd6edfe['options']);return db['SmsMessage'][_0x72b4('0x5c')](_0xe177f)[_0x72b4('0x25')](handleEntityNotFound(_0x515bcf,null))['then'](respondWithResult(_0x515bcf,null))[_0x72b4('0x2f')](handleError(_0x515bcf,null));};exports[_0x72b4('0x5d')]=function(_0x1ca327,_0x1bd4e9){return db[_0x72b4('0x42')][_0x72b4('0x5d')](_0x1ca327[_0x72b4('0x5e')],{})[_0x72b4('0x25')](respondWithResult(_0x1bd4e9,0xc9))[_0x72b4('0x2f')](handleError(_0x1bd4e9,null));};exports[_0x72b4('0x5f')]=function(_0x4843b2,_0x532b95){if(_0x4843b2[_0x72b4('0x5e')]['id']){delete _0x4843b2[_0x72b4('0x5e')]['id'];}return db['SmsMessage'][_0x72b4('0x5c')]({'where':{'id':_0x4843b2['params']['id']}})[_0x72b4('0x25')](handleEntityNotFound(_0x532b95,null))[_0x72b4('0x25')](saveUpdates(_0x4843b2[_0x72b4('0x5e')],null))[_0x72b4('0x25')](respondWithResult(_0x532b95,null))[_0x72b4('0x2f')](handleError(_0x532b95,null));};exports[_0x72b4('0x3b')]=function(_0x49fed0,_0x2c0df3){return db[_0x72b4('0x42')][_0x72b4('0x5c')]({'where':{'id':_0x49fed0[_0x72b4('0x5a')]['id']}})[_0x72b4('0x25')](handleEntityNotFound(_0x2c0df3,null))[_0x72b4('0x25')](removeEntity(_0x2c0df3,null))[_0x72b4('0x2f')](handleError(_0x2c0df3,null));};exports[_0x72b4('0x60')]=function(_0x20011d,_0x1f48d2){return db[_0x72b4('0x42')][_0x72b4('0x60')]()[_0x72b4('0x25')](respondWithResult(_0x1f48d2,null))['catch'](handleError(_0x1f48d2,null));};var interaction_log=require(_0x72b4('0x15'))('sms-interactions');exports[_0x72b4('0x61')]=function(_0x520da2,_0x5290e3,_0x3c6819){var _0x1dd783={'agent':{},'channel':'sms'};if(_0x520da2[_0x72b4('0x5e')]['id']){delete _0x520da2[_0x72b4('0x5e')]['id'];}_0x520da2[_0x72b4('0x5e')][_0x72b4('0x62')]=!![];_0x520da2[_0x72b4('0x5e')][_0x72b4('0x63')]=moment()[_0x72b4('0x64')](_0x72b4('0x65'));_0x520da2[_0x72b4('0x5e')][_0x72b4('0x66')]=_0x520da2['body']['UserId']||_0x520da2[_0x72b4('0x67')]['id'];_0x1dd783[_0x72b4('0x68')]['id']=_0x520da2[_0x72b4('0x5e')][_0x72b4('0x66')];return db[_0x72b4('0x42')][_0x72b4('0x5c')]({'where':{'id':_0x520da2['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5290e3,null))['then'](saveUpdates(_0x520da2[_0x72b4('0x5e')],null))['then'](function(_0x1f9f9b){if(_0x1f9f9b){_0x1dd783[_0x72b4('0x2d')]=_0x1f9f9b[_0x72b4('0x69')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x1f9f9b['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5290e3,null))[_0x72b4('0x25')](function(_0x257c74){if(_0x257c74){return _0x257c74[_0x72b4('0x5f')]({'UserId':_0x520da2[_0x72b4('0x5e')][_0x72b4('0x66')],'read1stAt':_[_0x72b4('0x6a')](_0x257c74[_0x72b4('0x6b')])?moment()['format'](_0x72b4('0x65')):undefined});}return null;})[_0x72b4('0x25')](function(_0xf90022){if(_0xf90022){_0x1dd783[_0x72b4('0x6c')]=_0xf90022[_0x72b4('0x69')]({'plain':!![]});interaction_log[_0x72b4('0x26')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x520da2[_0x72b4('0x67')]['id'],_0x520da2[_0x72b4('0x67')]['name'],_0x520da2['user'][_0x72b4('0x6d')],_0x1dd783[_0x72b4('0x6c')]['id'],_0x520da2[_0x72b4('0x5e')]?JSON['stringify'](_0x520da2[_0x72b4('0x5e')]):_0x72b4('0x6e'));return respondWithRpcPromise(_0x72b4('0x6f'),_0x72b4('0x70'),_0x1dd783);}return null;})[_0x72b4('0x25')](function(_0x4a2fc5){var _0x302124=_0x72b4('0x71')+_0x4a2fc5['message'][_0x72b4('0x72')];return db[_0x72b4('0x73')][_0x72b4('0x48')](_0x302124,{'type':db[_0x72b4('0x74')][_0x72b4('0x75')][_0x72b4('0x76')],'raw':!![]})[_0x72b4('0x25')](function(_0x7e2268){return _0x7e2268;});})['then'](function(_0x3f69d0){if(_0x3f69d0){_0x1dd783[_0x72b4('0x2d')]['contact']=_0x3f69d0[0x0];if(!_0x520da2[_0x72b4('0x5e')][_0x72b4('0x66')])return;return db['User'][_0x72b4('0x5c')]({'where':{'id':_0x520da2[_0x72b4('0x5e')][_0x72b4('0x66')],'role':_0x72b4('0x68')},'attributes':['id','name',_0x72b4('0x77'),_0x72b4('0x78'),_0x72b4('0x79')],'raw':!![]});}return null;})['then'](function(_0x4d7462){if(!_0x4d7462)return null;_0x1dd783[_0x72b4('0x2d')][_0x72b4('0x68')]=_0x4d7462;return _0x1dd783;})[_0x72b4('0x25')](function(_0x1bdbde){if(_0x1bdbde){if(_0x520da2[_0x72b4('0x5e')]['manual']){_0x1dd783[_0x72b4('0x2d')][_0x72b4('0x7a')]=util[_0x72b4('0x64')](_0x72b4('0x7b'),_0x520da2['user'][_0x72b4('0x3f')]);_0x1dd783[_0x72b4('0x2d')][_0x72b4('0x7c')]=_0x1dd783[_0x72b4('0x7c')];_0x1dd783['message'][_0x72b4('0x7d')]=_0x1dd783[_0x72b4('0x7c')];_0x1dd783['message'][_0x72b4('0x7e')]=_0x72b4('0x61');return respondWithRpcPromise('EventManager',_0x72b4('0x7f'),{'event':_0x72b4('0x80'),'message':_0x1dd783[_0x72b4('0x2d')]},client9002)[_0x72b4('0x25')](function(){return _0x1dd783;});}return _0x1dd783;}return null;})[_0x72b4('0x25')](respondWithResult(_0x5290e3,null))[_0x72b4('0x2f')](handleError(_0x5290e3,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x72b4('0x39')]=function(_0x4cdd06,_0xcc9db6,_0x18d5dc){var _0x3fed16={'agent':{},'channel':_0x72b4('0x81')};if(_0x4cdd06[_0x72b4('0x5e')]['id']){delete _0x4cdd06['body']['id'];}_0x4cdd06[_0x72b4('0x5e')][_0x72b4('0x66')]=_0x4cdd06[_0x72b4('0x5e')][_0x72b4('0x66')]||_0x4cdd06[_0x72b4('0x67')]['id'];_0x3fed16['agent']['id']=_0x4cdd06[_0x72b4('0x5e')][_0x72b4('0x66')];return db[_0x72b4('0x42')][_0x72b4('0x5c')]({'where':{'id':_0x4cdd06[_0x72b4('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xcc9db6,null))[_0x72b4('0x25')](function(_0x35463d){if(_0x35463d){_0x3fed16[_0x72b4('0x2d')]=_0x35463d['get']({'plain':!![]});return db[_0x72b4('0x82')][_0x72b4('0x5c')]({'where':{'id':_0x35463d[_0x72b4('0x83')]}});}return null;})[_0x72b4('0x25')](handleEntityNotFound(_0xcc9db6,null))[_0x72b4('0x25')](function(_0x4045d3){if(_0x4045d3){_0x3fed16[_0x72b4('0x6c')]=_0x4045d3[_0x72b4('0x69')]({'plain':!![]});interaction_log[_0x72b4('0x26')](_0x72b4('0x84'),_0x4cdd06['user']['id'],_0x4cdd06[_0x72b4('0x67')][_0x72b4('0x3f')],_0x4cdd06[_0x72b4('0x67')]['role'],_0x3fed16['interaction']['id'],_0x4cdd06[_0x72b4('0x5e')]?JSON[_0x72b4('0x2a')](_0x4cdd06['body']):_0x72b4('0x6e'));return respondWithRpcPromise(_0x72b4('0x85'),'rejectMessage',_0x3fed16);}return null;})['then'](function(_0x11cc95){var _0x3f8803=_0x72b4('0x71')+_0x11cc95['message'][_0x72b4('0x72')];return db[_0x72b4('0x73')][_0x72b4('0x48')](_0x3f8803,{'type':db[_0x72b4('0x74')][_0x72b4('0x75')][_0x72b4('0x76')],'raw':!![]})[_0x72b4('0x25')](function(_0x1c688c){return _0x1c688c;});})['then'](function(_0x5e3aab){if(_0x5e3aab){_0x3fed16[_0x72b4('0x2d')][_0x72b4('0x86')]=_0x5e3aab[0x0];if(!_0x4cdd06[_0x72b4('0x5e')][_0x72b4('0x66')])return;return db['User'][_0x72b4('0x5c')]({'where':{'id':_0x4cdd06[_0x72b4('0x5e')][_0x72b4('0x66')],'role':_0x72b4('0x68')},'attributes':['id',_0x72b4('0x3f'),_0x72b4('0x77'),_0x72b4('0x78'),_0x72b4('0x79')],'raw':!![]});}return null;})[_0x72b4('0x25')](function(_0x2266e2){if(!_0x2266e2)return null;_0x3fed16[_0x72b4('0x2d')][_0x72b4('0x68')]=_0x2266e2;return _0x3fed16;})['then'](function(_0x32320c){if(_0x32320c){_0x32320c[_0x72b4('0x2d')][_0x72b4('0x7a')]=util[_0x72b4('0x64')](_0x72b4('0x7b'),_0x4cdd06[_0x72b4('0x67')]['name']);_0x32320c[_0x72b4('0x2d')][_0x72b4('0x7c')]=_0x3fed16[_0x72b4('0x7c')];_0x32320c['message'][_0x72b4('0x7d')]=_0x3fed16[_0x72b4('0x7c')];_0x32320c['message'][_0x72b4('0x7e')]='reject';respondWithRpcPromise(_0x72b4('0x7f'),_0x72b4('0x7f'),{'event':_0x72b4('0x87'),'message':_0x32320c[_0x72b4('0x2d')]},client9002);return _0x3fed16;}return null;})[_0x72b4('0x25')](respondWithResult(_0xcc9db6,null))['catch'](handleError(_0xcc9db6,null));};exports[_0x72b4('0x30')]=function(_0x494c31,_0x104ba8,_0x1067b2){if(_0x494c31['body']['id']){delete _0x494c31[_0x72b4('0x5e')]['id'];}var _0xf81464;return db[_0x72b4('0x42')][_0x72b4('0x5c')]({'where':{'id':_0x494c31[_0x72b4('0x5a')]['id']}})[_0x72b4('0x25')](handleEntityNotFound(_0x104ba8,null))[_0x72b4('0x25')](function(_0x182beb){if(_0x182beb){_0xf81464=_0x182beb;return db[_0x72b4('0x88')][_0x72b4('0x5c')]({'where':{'id':_0x182beb[_0x72b4('0x89')]}});}})['then'](handleEntityNotFound(_0x104ba8,null))[_0x72b4('0x25')](function(_0x14c381){if(_0x14c381){logger[_0x72b4('0x8a')](_0x72b4('0x29'),'status',_0x72b4('0x8b'),_0x14c381['type'],util[_0x72b4('0x8c')](_0x494c31[_0x72b4('0x5e')],{'showHidden':![],'depth':null}));switch(_0x14c381[_0x72b4('0x45')]){case _0x72b4('0x8d'):if(_0x494c31['body'][_0x72b4('0x8e')]&&_0x494c31[_0x72b4('0x5e')][_0x72b4('0x8e')]===_0xf81464[_0x72b4('0x8f')]){return _0xf81464['update']({'read':!![]});}else{logger[_0x72b4('0x2b')](_0x72b4('0x90'),_0x72b4('0x30'),_0x72b4('0x8d'),util[_0x72b4('0x8c')](_0x494c31[_0x72b4('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x72b4('0x91'):if(_0x494c31[_0x72b4('0x5e')][_0x72b4('0x92')]&&_0x494c31['body'][_0x72b4('0x92')]===_0xf81464['messageId']&&_[_0x72b4('0x93')](['sent',_0x72b4('0x94')],_0x494c31[_0x72b4('0x5e')][_0x72b4('0x95')])>=0x0){return _0xf81464[_0x72b4('0x5f')]({'read':!![]});}else{logger[_0x72b4('0x2b')](_0x72b4('0x90'),_0x72b4('0x30'),_0x72b4('0x96'),util[_0x72b4('0x8c')](_0x494c31[_0x72b4('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x72b4('0x97'):var _0x172c50=_0x494c31['body'][_0x72b4('0x98')][0x0];if(_0x172c50[_0x72b4('0x30')][_0x72b4('0x99')]==='DELIVERED'){return _0xf81464[_0x72b4('0x5f')]({'read':!![]});}else{logger[_0x72b4('0x2b')](_0x72b4('0x90'),'status',_0x72b4('0x97'),util['inspect'](_0x494c31[_0x72b4('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0xf81464;}})[_0x72b4('0x25')](respondWithResult(_0x104ba8,null))[_0x72b4('0x2f')](handleError(_0x104ba8,null));}; \ No newline at end of file +var _0x1b0e=['sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','destroy','name','send','index','SmsMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','find','create','body','params','describe','sms-interactions','accept','sms','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','update','isNil','read1stAt','format','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','SIP/%s','channel','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','internal','motionChannel','event','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','inspect','plivo','MessageUUID'];(function(_0x2d7dbe,_0x933ff5){var _0x279e5a=function(_0x405b4d){while(--_0x405b4d){_0x2d7dbe['push'](_0x2d7dbe['shift']());}};_0x279e5a(++_0x933ff5);}(_0x1b0e,0x132));var _0xe1b0=function(_0xa4af61,_0xf3637f){_0xa4af61=_0xa4af61-0x0;var _0x476989=_0x1b0e[_0xa4af61];return _0x476989;};'use strict';var emlformat=require(_0xe1b0('0x0'));var rimraf=require(_0xe1b0('0x1'));var zipdir=require(_0xe1b0('0x2'));var jsonpatch=require(_0xe1b0('0x3'));var rp=require(_0xe1b0('0x4'));var moment=require(_0xe1b0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe1b0('0x6'));var path=require(_0xe1b0('0x7'));var sox=require('sox');var csv=require(_0xe1b0('0x8'));var ejs=require(_0xe1b0('0x9'));var fs=require('fs');var fs_extra=require(_0xe1b0('0xa'));var _=require('lodash');var squel=require(_0xe1b0('0xb'));var crypto=require(_0xe1b0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe1b0('0xd'));var toCsv=require(_0xe1b0('0x8'));var querystring=require(_0xe1b0('0xe'));var Papa=require(_0xe1b0('0xf'));var Redis=require(_0xe1b0('0x10'));var authService=require(_0xe1b0('0x11'));var qs=require(_0xe1b0('0x12'));var as=require(_0xe1b0('0x13'));var hardwareService=require(_0xe1b0('0x14'));var logger=require(_0xe1b0('0x15'))('api');var utils=require(_0xe1b0('0x16'));var config=require(_0xe1b0('0x17'));var licenseUtil=require(_0xe1b0('0x18'));var db=require(_0xe1b0('0x19'))['db'];config[_0xe1b0('0x1a')]=_[_0xe1b0('0x1b')](config[_0xe1b0('0x1a')],{'host':_0xe1b0('0x1c'),'port':0x18eb});var socket=require(_0xe1b0('0x1d'))(new Redis(config['redis']));require(_0xe1b0('0x1e'))[_0xe1b0('0x1f')](socket);var jayson=require(_0xe1b0('0x20'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xe1b0('0x21')][_0xe1b0('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2b32b5,_0x3d3c2e,_0x23efb3,_0x10f27d){return new BPromise(function(_0x5dfd78,_0x36e930){var _0x36af39=_0x10f27d||client;return _0x36af39[_0xe1b0('0x23')](_0x2b32b5,_0x23efb3)[_0xe1b0('0x24')](function(_0x349f90){logger['info']('SmsMessage,\x20%s,\x20%s',_0x3d3c2e,'request\x20sent');logger[_0xe1b0('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3d3c2e,_0xe1b0('0x26'),JSON[_0xe1b0('0x27')](_0x349f90));if(_0x349f90[_0xe1b0('0x28')]){if(_0x349f90['error'][_0xe1b0('0x29')]===0x1f4){logger[_0xe1b0('0x28')]('SmsMessage,\x20%s,\x20%s',_0x3d3c2e,_0x349f90[_0xe1b0('0x28')][_0xe1b0('0x2a')]);return _0x36e930(_0x349f90[_0xe1b0('0x28')]['message']);}logger[_0xe1b0('0x28')]('SmsMessage,\x20%s,\x20%s',_0x3d3c2e,_0x349f90['error']['message']);return _0x5dfd78(_0x349f90['error'][_0xe1b0('0x2a')]);}else{logger['info'](_0xe1b0('0x2b'),_0x3d3c2e,_0xe1b0('0x26'));_0x5dfd78(_0x349f90[_0xe1b0('0x2c')]['message']);}})[_0xe1b0('0x2d')](function(_0x3ef159){logger['error'](_0xe1b0('0x2b'),_0x3d3c2e,_0x3ef159);_0x36e930(_0x3ef159);});});}function respondWithStatusCode(_0xb541ea,_0x42fd93){_0x42fd93=_0x42fd93||0xcc;return function(_0x213e7e){if(_0x213e7e){return _0xb541ea[_0xe1b0('0x2e')](_0x42fd93);}return _0xb541ea['status'](_0x42fd93)[_0xe1b0('0x2f')]();};}function respondWithResult(_0x2bb865,_0x1a30d0){_0x1a30d0=_0x1a30d0||0xc8;return function(_0x14fcc4){if(_0x14fcc4){return _0x2bb865[_0xe1b0('0x30')](_0x1a30d0)[_0xe1b0('0x31')](_0x14fcc4);}};}function respondWithFilteredResult(_0x13dc9d,_0x1c19cd){return function(_0x5ea3fe){if(_0x5ea3fe){var _0x2f7b35=typeof _0x1c19cd[_0xe1b0('0x32')]==='undefined'&&typeof _0x1c19cd[_0xe1b0('0x33')]===_0xe1b0('0x34');var _0x4a01d8=_0x5ea3fe['count'];var _0x5cc8e3=_0x2f7b35?0x0:_0x1c19cd[_0xe1b0('0x32')];var _0x3f2f25=_0x2f7b35?_0x5ea3fe[_0xe1b0('0x35')]:_0x1c19cd[_0xe1b0('0x32')]+_0x1c19cd[_0xe1b0('0x33')];var _0x3f6577;if(_0x3f2f25>=_0x4a01d8){_0x3f2f25=_0x4a01d8;_0x3f6577=0xc8;}else{_0x3f6577=0xce;}_0x13dc9d['status'](_0x3f6577);return _0x13dc9d['set'](_0xe1b0('0x36'),_0x5cc8e3+'-'+_0x3f2f25+'/'+_0x4a01d8)[_0xe1b0('0x31')](_0x5ea3fe);}return null;};}function patchUpdates(_0xaf1d7a){return function(_0x18cf32){try{jsonpatch[_0xe1b0('0x37')](_0x18cf32,_0xaf1d7a,!![]);}catch(_0x12cfb8){return BPromise[_0xe1b0('0x38')](_0x12cfb8);}return _0x18cf32[_0xe1b0('0x39')]();};}function saveUpdates(_0x736dd7,_0xa3b6e3){return function(_0x57403f){if(_0x57403f){return _0x57403f['update'](_0x736dd7)['then'](function(_0x8ca16a){return _0x8ca16a;});}return null;};}function removeEntity(_0x536450,_0x43fc52){return function(_0x23aeae){if(_0x23aeae){return _0x23aeae[_0xe1b0('0x3a')]()[_0xe1b0('0x24')](function(){_0x536450[_0xe1b0('0x30')](0xcc)[_0xe1b0('0x2f')]();});}};}function handleEntityNotFound(_0x31d3df,_0x4ac0da){return function(_0x52155d){if(!_0x52155d){_0x31d3df['sendStatus'](0x194);}return _0x52155d;};}function handleError(_0x261002,_0x504523){_0x504523=_0x504523||0x1f4;return function(_0x12c2be){logger['error'](_0x12c2be['stack']);if(_0x12c2be['name']){delete _0x12c2be[_0xe1b0('0x3b')];}_0x261002[_0xe1b0('0x30')](_0x504523)[_0xe1b0('0x3c')](_0x12c2be);};}exports[_0xe1b0('0x3d')]=function(_0x15fd34,_0x3766bf){var _0x4b448e={},_0x54e0b9={},_0x3b22f3={'count':0x0,'rows':[]};var _0x410119=_['map'](db[_0xe1b0('0x3e')][_0xe1b0('0x3f')],function(_0x449df2){return{'name':_0x449df2[_0xe1b0('0x40')],'type':_0x449df2[_0xe1b0('0x41')][_0xe1b0('0x42')]};});_0x54e0b9[_0xe1b0('0x43')]=_[_0xe1b0('0x44')](_0x410119,_0xe1b0('0x3b'));_0x54e0b9[_0xe1b0('0x45')]=_[_0xe1b0('0x46')](_0x15fd34[_0xe1b0('0x45')]);_0x54e0b9[_0xe1b0('0x47')]=_[_0xe1b0('0x48')](_0x54e0b9[_0xe1b0('0x43')],_0x54e0b9['query']);_0x4b448e[_0xe1b0('0x49')]=_[_0xe1b0('0x48')](_0x54e0b9[_0xe1b0('0x43')],qs[_0xe1b0('0x4a')](_0x15fd34[_0xe1b0('0x45')][_0xe1b0('0x4a')]));_0x4b448e[_0xe1b0('0x49')]=_0x4b448e[_0xe1b0('0x49')][_0xe1b0('0x4b')]?_0x4b448e[_0xe1b0('0x49')]:_0x54e0b9[_0xe1b0('0x43')];if(!_0x15fd34[_0xe1b0('0x45')]['hasOwnProperty'](_0xe1b0('0x4c'))){_0x4b448e['limit']=qs[_0xe1b0('0x33')](_0x15fd34[_0xe1b0('0x45')][_0xe1b0('0x33')]);_0x4b448e[_0xe1b0('0x32')]=qs[_0xe1b0('0x32')](_0x15fd34[_0xe1b0('0x45')]['offset']);}_0x4b448e[_0xe1b0('0x4d')]=qs[_0xe1b0('0x4e')](_0x15fd34['query']['sort']);_0x4b448e[_0xe1b0('0x4f')]=qs[_0xe1b0('0x47')](_[_0xe1b0('0x50')](_0x15fd34[_0xe1b0('0x45')],_0x54e0b9['filters']),_0x410119);if(_0x15fd34[_0xe1b0('0x45')]['filter']){_0x4b448e[_0xe1b0('0x4f')]=_[_0xe1b0('0x51')](_0x4b448e[_0xe1b0('0x4f')],{'$or':_[_0xe1b0('0x44')](_0x410119,function(_0x59ab53){if(_0x59ab53['type']!==_0xe1b0('0x52')){var _0x5b28eb={};_0x5b28eb[_0x59ab53[_0xe1b0('0x3b')]]={'$like':'%'+_0x15fd34[_0xe1b0('0x45')][_0xe1b0('0x53')]+'%'};return _0x5b28eb;}})});}_0x4b448e=_[_0xe1b0('0x51')]({},_0x4b448e,_0x15fd34[_0xe1b0('0x54')]);var _0x3f0bee={'where':_0x4b448e[_0xe1b0('0x4f')]};return db[_0xe1b0('0x3e')][_0xe1b0('0x35')](_0x3f0bee)[_0xe1b0('0x24')](function(_0x2b2890){_0x3b22f3[_0xe1b0('0x35')]=_0x2b2890;if(_0x15fd34[_0xe1b0('0x45')][_0xe1b0('0x55')]){_0x4b448e[_0xe1b0('0x56')]=[{'all':!![]}];}return db[_0xe1b0('0x3e')][_0xe1b0('0x57')](_0x4b448e);})[_0xe1b0('0x24')](function(_0x12f000){_0x3b22f3['rows']=_0x12f000;return _0x3b22f3;})[_0xe1b0('0x24')](respondWithFilteredResult(_0x3766bf,_0x4b448e))[_0xe1b0('0x2d')](handleError(_0x3766bf,null));};exports[_0xe1b0('0x58')]=function(_0x2179a3,_0x4f93a9){var _0x41194d={'raw':!![],'where':{'id':_0x2179a3['params']['id']}},_0x28473={};_0x28473['model']=_[_0xe1b0('0x46')](db['SmsMessage']['rawAttributes']);_0x28473[_0xe1b0('0x45')]=_[_0xe1b0('0x46')](_0x2179a3[_0xe1b0('0x45')]);_0x28473['filters']=_['intersection'](_0x28473[_0xe1b0('0x43')],_0x28473['query']);_0x41194d[_0xe1b0('0x49')]=_[_0xe1b0('0x48')](_0x28473[_0xe1b0('0x43')],qs[_0xe1b0('0x4a')](_0x2179a3[_0xe1b0('0x45')]['fields']));_0x41194d[_0xe1b0('0x49')]=_0x41194d['attributes'][_0xe1b0('0x4b')]?_0x41194d[_0xe1b0('0x49')]:_0x28473['model'];if(_0x2179a3[_0xe1b0('0x45')][_0xe1b0('0x55')]){_0x41194d[_0xe1b0('0x56')]=[{'all':!![]}];}_0x41194d=_['merge']({},_0x41194d,_0x2179a3['options']);return db[_0xe1b0('0x3e')][_0xe1b0('0x59')](_0x41194d)[_0xe1b0('0x24')](handleEntityNotFound(_0x4f93a9,null))[_0xe1b0('0x24')](respondWithResult(_0x4f93a9,null))[_0xe1b0('0x2d')](handleError(_0x4f93a9,null));};exports[_0xe1b0('0x5a')]=function(_0x4e4bf3,_0x8156d1){return db['SmsMessage'][_0xe1b0('0x5a')](_0x4e4bf3[_0xe1b0('0x5b')],{})[_0xe1b0('0x24')](respondWithResult(_0x8156d1,0xc9))[_0xe1b0('0x2d')](handleError(_0x8156d1,null));};exports['update']=function(_0x457907,_0x4c3881){if(_0x457907[_0xe1b0('0x5b')]['id']){delete _0x457907[_0xe1b0('0x5b')]['id'];}return db['SmsMessage'][_0xe1b0('0x59')]({'where':{'id':_0x457907[_0xe1b0('0x5c')]['id']}})[_0xe1b0('0x24')](handleEntityNotFound(_0x4c3881,null))[_0xe1b0('0x24')](saveUpdates(_0x457907[_0xe1b0('0x5b')],null))['then'](respondWithResult(_0x4c3881,null))[_0xe1b0('0x2d')](handleError(_0x4c3881,null));};exports[_0xe1b0('0x3a')]=function(_0x11eedb,_0x31dc3e){return db[_0xe1b0('0x3e')][_0xe1b0('0x59')]({'where':{'id':_0x11eedb[_0xe1b0('0x5c')]['id']}})[_0xe1b0('0x24')](handleEntityNotFound(_0x31dc3e,null))['then'](removeEntity(_0x31dc3e,null))['catch'](handleError(_0x31dc3e,null));};exports[_0xe1b0('0x5d')]=function(_0x32403b,_0x132f47){return db[_0xe1b0('0x3e')][_0xe1b0('0x5d')]()[_0xe1b0('0x24')](respondWithResult(_0x132f47,null))['catch'](handleError(_0x132f47,null));};var interaction_log=require(_0xe1b0('0x15'))(_0xe1b0('0x5e'));exports[_0xe1b0('0x5f')]=function(_0x10e25f,_0x1275e5,_0x3ade51){var _0x5dfa02={'agent':{},'channel':_0xe1b0('0x60')};if(_0x10e25f[_0xe1b0('0x5b')]['id']){delete _0x10e25f[_0xe1b0('0x5b')]['id'];}_0x10e25f[_0xe1b0('0x5b')]['read']=!![];_0x10e25f[_0xe1b0('0x5b')][_0xe1b0('0x61')]=moment()['format'](_0xe1b0('0x62'));_0x10e25f[_0xe1b0('0x5b')][_0xe1b0('0x63')]=_0x10e25f[_0xe1b0('0x5b')][_0xe1b0('0x63')]||_0x10e25f[_0xe1b0('0x64')]['id'];_0x5dfa02[_0xe1b0('0x65')]['id']=_0x10e25f[_0xe1b0('0x5b')]['UserId'];return db[_0xe1b0('0x3e')][_0xe1b0('0x59')]({'where':{'id':_0x10e25f[_0xe1b0('0x5c')]['id'],'UserId':null}})[_0xe1b0('0x24')](handleEntityNotFound(_0x1275e5,null))[_0xe1b0('0x24')](saveUpdates(_0x10e25f[_0xe1b0('0x5b')],null))['then'](function(_0x5534b0){if(_0x5534b0){_0x5dfa02[_0xe1b0('0x2a')]=_0x5534b0[_0xe1b0('0x66')]({'plain':!![]});return db[_0xe1b0('0x67')][_0xe1b0('0x59')]({'where':{'id':_0x5534b0[_0xe1b0('0x68')]}});}return null;})[_0xe1b0('0x24')](handleEntityNotFound(_0x1275e5,null))[_0xe1b0('0x24')](function(_0x511f85){if(_0x511f85){return _0x511f85[_0xe1b0('0x69')]({'UserId':_0x10e25f[_0xe1b0('0x5b')][_0xe1b0('0x63')],'read1stAt':_[_0xe1b0('0x6a')](_0x511f85[_0xe1b0('0x6b')])?moment()[_0xe1b0('0x6c')](_0xe1b0('0x62')):undefined});}return null;})[_0xe1b0('0x24')](function(_0x3fcfa2){if(_0x3fcfa2){_0x5dfa02['interaction']=_0x3fcfa2[_0xe1b0('0x66')]({'plain':!![]});interaction_log[_0xe1b0('0x6d')](_0xe1b0('0x6e'),_0x10e25f[_0xe1b0('0x64')]['id'],_0x10e25f[_0xe1b0('0x64')][_0xe1b0('0x3b')],_0x10e25f[_0xe1b0('0x64')][_0xe1b0('0x6f')],_0x5dfa02[_0xe1b0('0x70')]['id'],_0x10e25f[_0xe1b0('0x5b')]?JSON[_0xe1b0('0x27')](_0x10e25f['body']):_0xe1b0('0x71'));return respondWithRpcPromise(_0xe1b0('0x72'),'acceptMessage',_0x5dfa02);}return null;})[_0xe1b0('0x24')](function(_0x20e6e7){var _0x182060=_0xe1b0('0x73')+_0x20e6e7[_0xe1b0('0x2a')][_0xe1b0('0x74')];return db['sequelize']['query'](_0x182060,{'type':db[_0xe1b0('0x75')][_0xe1b0('0x76')][_0xe1b0('0x77')],'raw':!![]})['then'](function(_0x580202){return _0x580202;});})[_0xe1b0('0x24')](function(_0x1e1fcd){if(_0x1e1fcd){_0x5dfa02[_0xe1b0('0x2a')][_0xe1b0('0x78')]=_0x1e1fcd[0x0];if(!_0x10e25f[_0xe1b0('0x5b')][_0xe1b0('0x63')])return;return db[_0xe1b0('0x79')][_0xe1b0('0x59')]({'where':{'id':_0x10e25f[_0xe1b0('0x5b')][_0xe1b0('0x63')],'role':_0xe1b0('0x65')},'attributes':['id',_0xe1b0('0x3b'),_0xe1b0('0x7a'),_0xe1b0('0x7b'),'internal'],'raw':!![]});}return null;})[_0xe1b0('0x24')](function(_0x2c3ed1){if(!_0x2c3ed1)return null;_0x5dfa02[_0xe1b0('0x2a')][_0xe1b0('0x65')]=_0x2c3ed1;return _0x5dfa02;})[_0xe1b0('0x24')](function(_0x28a827){if(_0x28a827){if(_0x10e25f[_0xe1b0('0x5b')][_0xe1b0('0x7c')]){_0x5dfa02[_0xe1b0('0x2a')]['interface']=util['format'](_0xe1b0('0x7d'),_0x10e25f['user'][_0xe1b0('0x3b')]);_0x5dfa02[_0xe1b0('0x2a')][_0xe1b0('0x7e')]=_0x5dfa02[_0xe1b0('0x7e')];_0x5dfa02['message']['motionChannel']=_0x5dfa02['channel'];_0x5dfa02[_0xe1b0('0x2a')]['event']='accept';return respondWithRpcPromise(_0xe1b0('0x7f'),_0xe1b0('0x7f'),{'event':_0xe1b0('0x80'),'message':_0x5dfa02['message']},client9002)[_0xe1b0('0x24')](function(){return _0x5dfa02;});}return _0x5dfa02;}return null;})['then'](respondWithResult(_0x1275e5,null))[_0xe1b0('0x2d')](handleError(_0x1275e5,null));};var interaction_log=require(_0xe1b0('0x15'))('sms-interactions');exports[_0xe1b0('0x38')]=function(_0x5336e3,_0xed0e3a,_0x50125e){var _0x1a57aa={'agent':{},'channel':_0xe1b0('0x60')};if(_0x5336e3['body']['id']){delete _0x5336e3['body']['id'];}_0x5336e3['body'][_0xe1b0('0x63')]=_0x5336e3[_0xe1b0('0x5b')]['UserId']||_0x5336e3[_0xe1b0('0x64')]['id'];_0x1a57aa[_0xe1b0('0x65')]['id']=_0x5336e3[_0xe1b0('0x5b')][_0xe1b0('0x63')];return db[_0xe1b0('0x3e')]['find']({'where':{'id':_0x5336e3[_0xe1b0('0x5c')]['id'],'UserId':null}})[_0xe1b0('0x24')](handleEntityNotFound(_0xed0e3a,null))['then'](function(_0x1b7abc){if(_0x1b7abc){_0x1a57aa['message']=_0x1b7abc[_0xe1b0('0x66')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x1b7abc['SmsInteractionId']}});}return null;})[_0xe1b0('0x24')](handleEntityNotFound(_0xed0e3a,null))[_0xe1b0('0x24')](function(_0x30b2fa){if(_0x30b2fa){_0x1a57aa['interaction']=_0x30b2fa[_0xe1b0('0x66')]({'plain':!![]});interaction_log['info'](_0xe1b0('0x81'),_0x5336e3[_0xe1b0('0x64')]['id'],_0x5336e3[_0xe1b0('0x64')][_0xe1b0('0x3b')],_0x5336e3[_0xe1b0('0x64')]['role'],_0x1a57aa[_0xe1b0('0x70')]['id'],_0x5336e3[_0xe1b0('0x5b')]?JSON[_0xe1b0('0x27')](_0x5336e3[_0xe1b0('0x5b')]):_0xe1b0('0x71'));return respondWithRpcPromise('RejectMessage',_0xe1b0('0x82'),_0x1a57aa);}return null;})[_0xe1b0('0x24')](function(_0xa1f961){var _0x33eb04=_0xe1b0('0x73')+_0xa1f961[_0xe1b0('0x2a')]['ContactId'];return db[_0xe1b0('0x83')][_0xe1b0('0x45')](_0x33eb04,{'type':db[_0xe1b0('0x75')][_0xe1b0('0x76')][_0xe1b0('0x77')],'raw':!![]})[_0xe1b0('0x24')](function(_0x2be2f2){return _0x2be2f2;});})['then'](function(_0x495bfa){if(_0x495bfa){_0x1a57aa['message'][_0xe1b0('0x78')]=_0x495bfa[0x0];if(!_0x5336e3[_0xe1b0('0x5b')]['UserId'])return;return db['User'][_0xe1b0('0x59')]({'where':{'id':_0x5336e3[_0xe1b0('0x5b')][_0xe1b0('0x63')],'role':_0xe1b0('0x65')},'attributes':['id','name',_0xe1b0('0x7a'),'email',_0xe1b0('0x84')],'raw':!![]});}return null;})[_0xe1b0('0x24')](function(_0xf1aba8){if(!_0xf1aba8)return null;_0x1a57aa[_0xe1b0('0x2a')][_0xe1b0('0x65')]=_0xf1aba8;return _0x1a57aa;})[_0xe1b0('0x24')](function(_0x1293ab){if(_0x1293ab){_0x1293ab[_0xe1b0('0x2a')]['interface']=util[_0xe1b0('0x6c')]('SIP/%s',_0x5336e3[_0xe1b0('0x64')]['name']);_0x1293ab['message'][_0xe1b0('0x7e')]=_0x1a57aa[_0xe1b0('0x7e')];_0x1293ab[_0xe1b0('0x2a')][_0xe1b0('0x85')]=_0x1a57aa[_0xe1b0('0x7e')];_0x1293ab['message'][_0xe1b0('0x86')]='reject';respondWithRpcPromise(_0xe1b0('0x7f'),'EventManager',{'event':_0xe1b0('0x87'),'message':_0x1293ab[_0xe1b0('0x2a')]},client9002);return _0x1a57aa;}return null;})[_0xe1b0('0x24')](respondWithResult(_0xed0e3a,null))[_0xe1b0('0x2d')](handleError(_0xed0e3a,null));};exports[_0xe1b0('0x30')]=function(_0x3df14e,_0x3886de,_0x48360e){if(_0x3df14e[_0xe1b0('0x5b')]['id']){delete _0x3df14e[_0xe1b0('0x5b')]['id'];}var _0x52c278;return db[_0xe1b0('0x3e')]['find']({'where':{'id':_0x3df14e['params']['id']}})['then'](handleEntityNotFound(_0x3886de,null))[_0xe1b0('0x24')](function(_0x21161d){if(_0x21161d){_0x52c278=_0x21161d;return db[_0xe1b0('0x88')]['find']({'where':{'id':_0x21161d['SmsAccountId']}});}})[_0xe1b0('0x24')](handleEntityNotFound(_0x3886de,null))[_0xe1b0('0x24')](function(_0x1feb74){if(_0x1feb74){logger[_0xe1b0('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe1b0('0x30'),_0xe1b0('0x89'),_0x1feb74[_0xe1b0('0x41')],util['inspect'](_0x3df14e[_0xe1b0('0x5b')],{'showHidden':![],'depth':null}));switch(_0x1feb74[_0xe1b0('0x41')]){case _0xe1b0('0x8a'):if(_0x3df14e[_0xe1b0('0x5b')][_0xe1b0('0x8b')]&&_0x3df14e[_0xe1b0('0x5b')][_0xe1b0('0x8b')]===_0x52c278[_0xe1b0('0x8c')]){return _0x52c278[_0xe1b0('0x69')]({'read':!![]});}else{logger[_0xe1b0('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0xe1b0('0x8d')](_0x3df14e[_0xe1b0('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe1b0('0x8e'):if(_0x3df14e['body'][_0xe1b0('0x8f')]&&_0x3df14e['body']['MessageUUID']===_0x52c278[_0xe1b0('0x8c')]&&_['indexOf']([_0xe1b0('0x90'),_0xe1b0('0x91')],_0x3df14e[_0xe1b0('0x5b')]['Status'])>=0x0){return _0x52c278[_0xe1b0('0x69')]({'read':!![]});}else{logger[_0xe1b0('0x28')](_0xe1b0('0x92'),'status','plivio',util[_0xe1b0('0x8d')](_0x3df14e[_0xe1b0('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe1b0('0x93'):var _0x4343df=_0x3df14e[_0xe1b0('0x5b')]['results'][0x0];if(_0x4343df[_0xe1b0('0x30')][_0xe1b0('0x94')]===_0xe1b0('0x95')){return _0x52c278['update']({'read':!![]});}else{logger[_0xe1b0('0x28')](_0xe1b0('0x92'),_0xe1b0('0x30'),_0xe1b0('0x93'),util['inspect'](_0x3df14e[_0xe1b0('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x52c278;}})[_0xe1b0('0x24')](respondWithResult(_0x3886de,null))[_0xe1b0('0x2d')](handleError(_0x3886de,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 5cfad2d..bda0506 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 _0x0859=['save','update','remove','emit','exports','events','../../mysqldb','setMaxListeners'];(function(_0x333443,_0x4e0342){var _0x50acfb=function(_0x427e1e){while(--_0x427e1e){_0x333443['push'](_0x333443['shift']());}};_0x50acfb(++_0x4e0342);}(_0x0859,0xfd));var _0x9085=function(_0x5e8d74,_0x2171c9){_0x5e8d74=_0x5e8d74-0x0;var _0x244d9e=_0x0859[_0x5e8d74];return _0x244d9e;};'use strict';var EventEmitter=require(_0x9085('0x0'));var SmsMessage=require(_0x9085('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x9085('0x2')](0x0);var events={'afterCreate':_0x9085('0x3'),'afterUpdate':_0x9085('0x4'),'afterDestroy':_0x9085('0x5')};function emitEvent(_0x72dea0){return function(_0x6e3a10,_0x56d114,_0x5b2409){SmsMessageEvents[_0x9085('0x6')](_0x72dea0+':'+_0x6e3a10['id'],_0x6e3a10);SmsMessageEvents[_0x9085('0x6')](_0x72dea0,_0x6e3a10);_0x5b2409(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x9085('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x5e49=['hook','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x17bfea,_0x1be4f8){var _0x130fd0=function(_0x21b6d4){while(--_0x21b6d4){_0x17bfea['push'](_0x17bfea['shift']());}};_0x130fd0(++_0x1be4f8);}(_0x5e49,0x94));var _0x95e4=function(_0x522df5,_0x3364ae){_0x522df5=_0x522df5-0x0;var _0x3fffd4=_0x5e49[_0x522df5];return _0x3fffd4;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x95e4('0x0')](0x0);var events={'afterCreate':_0x95e4('0x1'),'afterUpdate':_0x95e4('0x2'),'afterDestroy':_0x95e4('0x3')};function emitEvent(_0x12dc1f){return function(_0x6829ee,_0x5ee877,_0x1454eb){SmsMessageEvents['emit'](_0x12dc1f+':'+_0x6829ee['id'],_0x6829ee);SmsMessageEvents[_0x95e4('0x4')](_0x12dc1f,_0x6829ee);_0x1454eb(null);};}for(var e in events){if(events[_0x95e4('0x5')](e)){var event=events[e];SmsMessage[_0x95e4('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index a05a85a..99c9b03 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 _0xd136=['hex','signature=','/external/get/send.php?','csc','Missing\x20parameters:\x20apiKey','apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','then','update','createdAt','catch','error','SmsAccount','find','type','twilio','accountSid','authToken','phone','messages','create','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','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','internal_order_id','deliveryReport','read','afterCreate','inspect','Missing\x20parameters:\x20username,\x20password','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','authId','toString','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','remote','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','login','text','timestamp','keys','sort','createHash','md5'];(function(_0x210f63,_0x3f44c5){var _0x305133=function(_0x41402a){while(--_0x41402a){_0x210f63['push'](_0x210f63['shift']());}};_0x305133(++_0x3f44c5);}(_0xd136,0x94));var _0x6d13=function(_0x4b403b,_0x6b5c2e){_0x4b403b=_0x4b403b-0x0;var _0x5583e1=_0xd136[_0x4b403b];return _0x5583e1;};'use strict';var _=require('lodash');var util=require(_0x6d13('0x0'));var logger=require(_0x6d13('0x1'))('api');var moment=require(_0x6d13('0x2'));var BPromise=require(_0x6d13('0x3'));var rp=require(_0x6d13('0x4'));var fs=require('fs');var path=require(_0x6d13('0x5'));var rimraf=require(_0x6d13('0x6'));var config=require(_0x6d13('0x7'));var attributes=require(_0x6d13('0x8'));module[_0x6d13('0x9')]=function(_0x147026,_0x4aabef){return _0x147026[_0x6d13('0xa')](_0x6d13('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x6d13('0xc')]},{'name':_0x6d13('0xd'),'fields':[_0x6d13('0xe')],'type':_0x6d13('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c8282,_0x4f494b,_0x1a3613){var _0x600fa9=_0x147026[_0x6d13('0x10')];var _0x571572=_0x5c8282['get']({'plain':!![]});if(_0x571572[_0x6d13('0x11')][_0x6d13('0x12')]()==='in'||_0x571572[_0x6d13('0x11')]['toLowerCase']()===_0x6d13('0x13')&&!_0x571572[_0x6d13('0x14')]&&!_[_0x6d13('0x15')](_0x571572[_0x6d13('0x16')])){_0x600fa9['SmsInteraction']['findOne']({'where':{'id':_0x571572['SmsInteractionId']}})[_0x6d13('0x17')](function(_0x10709d){if(_0x10709d){_0x10709d[_0x6d13('0x18')]({'lastMsgAt':_0x571572[_0x6d13('0x19')],'lastMsgDirection':_0x571572[_0x6d13('0x11')]['toLowerCase']()});}})[_0x6d13('0x1a')](function(_0x405368){console[_0x6d13('0x1b')](_0x405368);});}if(_0x571572[_0x6d13('0x11')]===_0x6d13('0x13')&&!_0x571572[_0x6d13('0x14')]){var _0xb17857;_0x600fa9[_0x6d13('0x1c')][_0x6d13('0x1d')]({'where':{'id':_0x571572['SmsAccountId']},'raw':!![]})[_0x6d13('0x17')](function(_0x269f27){_0xb17857=_0x269f27;if(_0xb17857&&_0xb17857[_0x6d13('0x1e')]){switch(_0xb17857[_0x6d13('0x1e')]){case _0x6d13('0x1f'):var _0x223eb4=require(_0x6d13('0x1f'));if(_0xb17857[_0x6d13('0x20')]&&_0xb17857[_0x6d13('0x21')]&&_0xb17857[_0x6d13('0x22')]){var _0x40f629=new _0x223eb4(_0xb17857[_0x6d13('0x20')],_0xb17857[_0x6d13('0x21')]);_0x40f629[_0x6d13('0x23')][_0x6d13('0x24')]({'body':_0x571572[_0x6d13('0xe')],'to':_0x571572['phone'],'from':_0xb17857[_0x6d13('0x22')],'statusCallback':_0xb17857['remote']+_0x6d13('0x25')+_0x571572['id']+_0x6d13('0x26')+_0xb17857[_0x6d13('0x27')]})['then'](function(_0x1b0f94){if(_0x1b0f94[_0x6d13('0x28')]){return _0x5c8282[_0x6d13('0x18')]({'messageId':_0x1b0f94[_0x6d13('0x28')]});}})[_0x6d13('0x1a')](function(_0x361432){logger[_0x6d13('0x1b')](_0x6d13('0x29'),'afterCreate',_0x6d13('0x1f'),util['inspect'](_0x361432,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6d13('0x29'),'afterCreate',_0x6d13('0x1f'),_0x6d13('0x2a'));}break;case _0x6d13('0x2b'):var _0x49e74a=_0x6d13('0x2c');if(_0xb17857[_0x6d13('0x2d')]&&_0xb17857['password']){var _0x2fcdfd={'recipient':[_0x571572[_0x6d13('0x22')]],'message':_0x571572[_0x6d13('0xe')],'message_type':_0xb17857[_0x6d13('0x2e')]};if(_0xb17857[_0x6d13('0x2e')]&&_0xb17857[_0x6d13('0x2e')]!=='SI'){_0x2fcdfd[_0x6d13('0x2f')]=_0xb17857[_0x6d13('0x22')];}var _0x2b6791={'url':_0x49e74a+_0x6d13('0x30')+_0xb17857[_0x6d13('0x2d')]+'&password='+_0xb17857[_0x6d13('0x31')],'method':_0x6d13('0x32')};rp(_0x2b6791)[_0x6d13('0x17')](function(_0x58ab35){var _0xc5f9ef=_0x58ab35[_0x6d13('0x33')](';');var _0x2fd8b1={'user_key':_0xc5f9ef[0x0],'session_key':_0xc5f9ef[0x1]};_0x2b6791={'url':_0x49e74a+_0x6d13('0x34'),'method':_0x6d13('0x35'),'headers':{'user_key':_0x2fd8b1[_0x6d13('0x36')],'Session_key':_0x2fd8b1[_0x6d13('0x37')]},'json':!![],'body':_0x2fcdfd};return rp(_0x2b6791);})['then'](function(_0x2f447f){if(_0x2f447f['total_sent']>=0x1){var _0x25a257={'messageId':_0x2f447f[_0x6d13('0x38')]};if(_0xb17857[_0x6d13('0x2e')]!=='GP'||!_0xb17857[_0x6d13('0x39')]){_0x25a257[_0x6d13('0x3a')]=!![];}return _0x5c8282[_0x6d13('0x18')](_0x25a257);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d13('0x3b'),_0x6d13('0x2b'),util[_0x6d13('0x3c')](_0x2f447f,{'showHidden':![],'depth':null}));}})[_0x6d13('0x1a')](function(_0xc2cfd5){return logger[_0x6d13('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d13('0x3b'),_0x6d13('0x2b'),util[_0x6d13('0x3c')](_0xc2cfd5,{'showHidden':![],'depth':null}));});}else{logger[_0x6d13('0x1b')](_0x6d13('0x29'),_0x6d13('0x3b'),_0x6d13('0x2b'),_0x6d13('0x3d'));}break;case _0x6d13('0x3e'):if(_0xb17857[_0x6d13('0x21')]){var _0x311038={'recipient':_0x571572['phone'],'message':_0x571572[_0x6d13('0xe')],'sender':_0xb17857['senderString']||_0xb17857['phone'],'authorization':_0xb17857[_0x6d13('0x21')]};var _0x4f494b={'method':_0x6d13('0x35'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x311038,'json':!![]};rp(_0x4f494b)[_0x6d13('0x17')](function(_0x3c5b61){var _0x392519={'messageId':_0x3c5b61['requestid']};if(!_0xb17857[_0x6d13('0x39')]){_0x392519['read']=!![];}return _0x5c8282[_0x6d13('0x18')](_0x392519);})['catch'](function(_0x4f55ff){logger[_0x6d13('0x1b')](_0x6d13('0x29'),'afterCreate','connectel',util[_0x6d13('0x3c')](_0x4f55ff,{'showHidden':![],'depth':null}));});}else{logger[_0x6d13('0x1b')](_0x6d13('0x29'),_0x6d13('0x3b'),'connectel',_0x6d13('0x3f'));}break;case _0x6d13('0x40'):if(_0xb17857['username']&&_0xb17857[_0x6d13('0x31')]){var _0x311038={'messages':[{'source':_0x6d13('0x41'),'to':_0x571572[_0x6d13('0x22')],'body':_0x571572[_0x6d13('0xe')],'from':_0xb17857[_0x6d13('0x42')]||_0xb17857[_0x6d13('0x22')]}]};var _0x14ec6e=util[_0x6d13('0x43')](_0x6d13('0x44'),_0xb17857[_0x6d13('0x2d')],_0xb17857[_0x6d13('0x31')]);var _0x4f494b={'method':_0x6d13('0x35'),'uri':_0x6d13('0x45'),'body':_0x311038,'headers':{'Authorization':util['format'](_0x6d13('0x46'),new Buffer(_0x14ec6e)['toString'](_0x6d13('0x47')))},'json':!![]};rp(_0x4f494b)[_0x6d13('0x17')](function(_0x223b03){if(_0x223b03[_0x6d13('0x48')]>=0xc8&&_0x223b03[_0x6d13('0x48')]<=0xce){if(_0x223b03[_0x6d13('0x49')]&&_0x223b03[_0x6d13('0x49')][_0x6d13('0x4a')]>0x0){var _0x59f7e2=_[_0x6d13('0x4b')](_0x223b03['data'][_0x6d13('0x23')]);var _0x33e827={'messageId':_0x59f7e2[_0x6d13('0x4c')]};if(!_0xb17857[_0x6d13('0x39')]){_0x33e827[_0x6d13('0x3a')]=!![];}return _0x5c8282[_0x6d13('0x18')](_0x33e827);}else{logger[_0x6d13('0x1b')](_0x6d13('0x29'),_0x6d13('0x3b'),_0x6d13('0x4d'),util[_0x6d13('0x3c')](_0x223b03,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x6d13('0x29'),_0x6d13('0x3b'),_0x6d13('0x4d'),util['inspect'](_0x223b03,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2c40df){logger[_0x6d13('0x1b')](_0x6d13('0x29'),'afterCreate',_0x6d13('0x4d'),util[_0x6d13('0x3c')](_0x2c40df,{'showHidden':![],'depth':null}));});}else{logger[_0x6d13('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d13('0x3b'),_0x6d13('0x4d'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0xb17857[_0x6d13('0x4e')]&&_0xb17857[_0x6d13('0x21')]){var _0x311038={'dst':_0x571572[_0x6d13('0x22')],'text':_0x571572[_0x6d13('0xe')],'src':_0xb17857[_0x6d13('0x42')]||_0xb17857['phone'],'url':_0xb17857['remote']+_0x6d13('0x25')+_0x571572['id']+_0x6d13('0x26')+_0xb17857[_0x6d13('0x27')]};var _0x14ec6e=util[_0x6d13('0x43')]('%s:%s',_0xb17857[_0x6d13('0x4e')],_0xb17857['authToken']);var _0x4f494b={'method':_0x6d13('0x35'),'uri':util[_0x6d13('0x43')]('https://api.plivo.com/v1/Account/%s/Message/',_0xb17857[_0x6d13('0x4e')]),'body':_0x311038,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x14ec6e)[_0x6d13('0x4f')]('base64'))},'json':!![]};rp(_0x4f494b)[_0x6d13('0x17')](function(_0x4a6a5b){var _0x13c342={'messageId':_0x4a6a5b['message_uuid'][0x0]};return _0x5c8282[_0x6d13('0x18')](_0x13c342);})[_0x6d13('0x1a')](function(_0x52e23d){logger[_0x6d13('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d13('0x3b'),_0x6d13('0x50'),util[_0x6d13('0x3c')](_0x52e23d,{'showHidden':![],'depth':null}));});}else{logger[_0x6d13('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d13('0x3b'),_0x6d13('0x50'),_0x6d13('0x51'));}break;case _0x6d13('0x52'):if(_0xb17857[_0x6d13('0x2d')]&&_0xb17857[_0x6d13('0x31')]){if(_0xb17857[_0x6d13('0x53')]){var _0x1e95e6={'method':'POST','uri':_0xb17857[_0x6d13('0x53')]+_0x6d13('0x54'),'body':{'username':_0xb17857[_0x6d13('0x2d')],'password':_0xb17857['password']},'json':!![]};return rp(_0x1e95e6)[_0x6d13('0x17')](function(_0x1755de){var _0x3b3a8b={'method':'POST','uri':_0xb17857[_0x6d13('0x53')]+_0x6d13('0x55'),'body':{'messages':[{'from':_0xb17857[_0x6d13('0x22')],'destinations':[{'to':_0x571572[_0x6d13('0x22')]}],'text':_0x571572[_0x6d13('0xe')],'notifyUrl':_0xb17857[_0x6d13('0x56')]+_0x6d13('0x25')+_0x571572['id']+_0x6d13('0x26')+_0xb17857['token'],'notifyContentType':_0x6d13('0x57'),'callbackData':_0xb17857[_0x6d13('0x22')]+';'+_0x571572[_0x6d13('0xe')]}]},'headers':{'Authorization':_0x6d13('0x58')+_0x1755de[_0x6d13('0x27')]},'json':!![]};return rp(_0x3b3a8b)[_0x6d13('0x17')](function(_0x15408d){if(_0x15408d[_0x6d13('0x23')]){var _0x1eee9e={'messageId':_0x15408d[_0x6d13('0x23')][0x0][_0x6d13('0xc')]};if(!_0xb17857[_0x6d13('0x39')]){_0x1eee9e['read']=!![];}return _0x5c8282[_0x6d13('0x18')](_0x1eee9e);}else{return logger[_0x6d13('0x1b')](_0x6d13('0x29'),_0x6d13('0x3b'),_0x6d13('0x52'),util[_0x6d13('0x3c')](_0x15408d,{'showHidden':![],'depth':null}));}});})[_0x6d13('0x1a')](function(_0x4a1630){return logger[_0x6d13('0x1b')](_0x6d13('0x29'),'afterCreate',_0x6d13('0x52'),util[_0x6d13('0x3c')](_0x4a1630,{'showHidden':![],'depth':null}));});}else{logger[_0x6d13('0x1b')](_0x6d13('0x29'),_0x6d13('0x3b'),_0x6d13('0x52'),_0x6d13('0x59'));}}else{logger[_0x6d13('0x1b')](_0x6d13('0x29'),_0x6d13('0x3b'),_0x6d13('0x52'),_0x6d13('0x3d'));}break;case'csc':var _0x2759c7=require(_0x6d13('0x5a'));if(_0xb17857['apiKey']){var _0x3dcaec={};_0x3dcaec[_0x6d13('0x5b')]=_0xb17857['username'];_0x3dcaec['phone']=_0x571572[_0x6d13('0x22')];_0x3dcaec[_0x6d13('0x2f')]=_0xb17857['phone'];_0x3dcaec[_0x6d13('0x5c')]=_0x571572[_0x6d13('0xe')];_0x3dcaec[_0x6d13('0x5d')]=+new Date();var _0x23d4d7='';var _0xf2c3f7='';var _0x2bf0fc=Object[_0x6d13('0x5e')](_0x3dcaec);_0x2bf0fc[_0x6d13('0x5f')]();for(var _0x3fc679=0x0;_0x3fc679<_0x2bf0fc['length'];_0x3fc679++){if(_0x23d4d7!=''){_0x23d4d7+='&';}_0x23d4d7+=_0x2bf0fc[_0x3fc679]+'='+encodeURIComponent(_0x3dcaec[_0x2bf0fc[_0x3fc679]]);_0xf2c3f7+=_0x3dcaec[_0x2bf0fc[_0x3fc679]];}_0xf2c3f7+=_0xb17857['apiKey'];_0xf2c3f7=_0x2759c7[_0x6d13('0x60')](_0x6d13('0x61'))[_0x6d13('0x18')](_0xf2c3f7)['digest'](_0x6d13('0x62'));if(_0x23d4d7!==''){_0x23d4d7+='&';}_0x23d4d7+=_0x6d13('0x63')+_0xf2c3f7;var _0x2b6791={'method':_0x6d13('0x32'),'uri':_0xb17857['baseUrl']+_0x6d13('0x64')+_0x23d4d7,'json':!![]};return rp(_0x2b6791)[_0x6d13('0x17')](function(_0x20ce5f){var _0x5560d3=Object['keys'](_0x20ce5f);if(_0x20ce5f[_0x5560d3[0x0]][_0x6d13('0x1b')]&&parseInt(_0x20ce5f[_0x5560d3[0x0]]['error'])===0x0){var _0x428aa8={'messageId':_0x20ce5f[_0x5560d3[0x0]]['id_sms']};if(!_0xb17857[_0x6d13('0x39')]){_0x428aa8[_0x6d13('0x3a')]=!![];}return _0x5c8282[_0x6d13('0x18')](_0x428aa8);}else{return logger['error'](_0x6d13('0x29'),'afterCreate',_0x6d13('0x65'),util[_0x6d13('0x3c')](_0x20ce5f['error'],{'showHidden':![],'depth':null}));}})[_0x6d13('0x1a')](function(_0x279a5e){return logger[_0x6d13('0x1b')](_0x6d13('0x29'),'afterCreate',_0x6d13('0x65'),util[_0x6d13('0x3c')](_0x279a5e,{'showHidden':![],'depth':null}));});}else{logger[_0x6d13('0x1b')](_0x6d13('0x29'),'afterCreate',_0x6d13('0x65'),_0x6d13('0x66'));}break;case'clickatell':if(_0xb17857[_0x6d13('0x67')]){var _0x57d963={'method':_0x6d13('0x35'),'uri':_0x6d13('0x68'),'headers':{'Authorization':_0xb17857[_0x6d13('0x67')]},'body':{'content':_0x571572[_0x6d13('0xe')],'to':[_0x571572[_0x6d13('0x22')]],'from':_0xb17857['phone'],'binary':![],'clientMessageId':_0x6d13('0x69'),'charset':'UTF-8'},'json':!![]};rp(_0x57d963)['then'](function(_0x16b384){if(!_0x16b384[_0x6d13('0x1b')]){var _0x337404={'messageId':_0x16b384[_0x6d13('0x23')][0x0][_0x6d13('0x6a')]};if(!_0xb17857[_0x6d13('0x39')]){_0x337404[_0x6d13('0x3a')]=!![];}return _0x5c8282['update'](_0x337404);}else{return logger[_0x6d13('0x1b')](_0x6d13('0x29'),'afterCreate',_0x6d13('0x6b'),util[_0x6d13('0x3c')](_0x16b384[_0x6d13('0x1b')],{'showHidden':![],'depth':null}));}})[_0x6d13('0x1a')](function(_0x439f22){return logger['error'](_0x6d13('0x29'),_0x6d13('0x3b'),_0x6d13('0x6b'),util[_0x6d13('0x3c')](_0x439f22,{'showHidden':![],'depth':null}));});}else{logger[_0x6d13('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d13('0x3b'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0x6d13('0x6c'):if(_0xb17857[_0x6d13('0x2d')]&&_0xb17857[_0x6d13('0x31')]){var _0x14ec6e=util[_0x6d13('0x43')](_0x6d13('0x44'),_0xb17857['username'],_0xb17857[_0x6d13('0x31')]);var _0x4f494b={'method':_0x6d13('0x35'),'uri':_0x6d13('0x6d')+_0xb17857[_0x6d13('0x6e')]+_0x6d13('0x6f'),'body':{'to':[_0x571572[_0x6d13('0x22')]],'text':_0x571572[_0x6d13('0xe')],'from':_0xb17857[_0x6d13('0x22')],'applicationId':_0xb17857[_0x6d13('0x70')]},'headers':{'Authorization':util[_0x6d13('0x43')]('Basic\x20%s',new Buffer(_0x14ec6e)[_0x6d13('0x4f')](_0x6d13('0x47')))},'json':!![]};rp(_0x4f494b)['then'](function(_0x13326b){if(_0x13326b['id']){var _0x2978da={'messageId':_0x13326b['id']};return _0x5c8282['update'](_0x2978da);}else{logger[_0x6d13('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d13('0x3b'),'bandwidth',util['inspect'](_0x13326b,{'showHidden':![],'depth':null}));}})[_0x6d13('0x1a')](function(_0xc79821){logger[_0x6d13('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d13('0x3b'),'bandwidth',util[_0x6d13('0x3c')](_0xc79821,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6d13('0x29'),_0x6d13('0x3b'),'bandwidth',_0x6d13('0x3d'));}break;case _0x6d13('0x71'):if(_0xb17857[_0x6d13('0x67')]){var _0x5f3631={};var _0x2b6791={'method':_0x6d13('0x35'),'uri':_0x6d13('0x72'),'headers':{'Authorization':'Bearer\x20'+_0xb17857[_0x6d13('0x67')],'Content-Type':_0x6d13('0x57')},'body':{'from':_0xb17857[_0x6d13('0x22')],'to':_0x571572['phone'],'text':_0x571572[_0x6d13('0xe')]},'json':!![]};return rp(_0x2b6791)['then'](function(_0x108372){if(_0x108372[_0x6d13('0x73')]==0xca){_0x5f3631[_0x6d13('0x74')]=_0x108372;var _0x3350e1={'method':'POST','uri':_0x6d13('0x75'),'headers':{'Authorization':'Bearer\x20'+_0xb17857['apiKey'],'Content-Type':_0x6d13('0x57')},'body':{'refid':_0x5f3631[_0x6d13('0x74')][_0x6d13('0x76')]},'json':!![]};return rp(_0x3350e1)[_0x6d13('0x17')](function(_0x5181b3){_0x5f3631[_0x6d13('0x77')]=_0x5181b3;var _0x499652={'messageId':_0x5f3631[_0x6d13('0x74')][_0x6d13('0x76')],'read':!![]};return _0x5c8282[_0x6d13('0x18')](_0x499652);});}else{return logger[_0x6d13('0x1b')](_0x6d13('0x29'),_0x6d13('0x3b'),_0x6d13('0x71'),util[_0x6d13('0x3c')](_0x108372,{'showHidden':![],'depth':null}));}})[_0x6d13('0x1a')](function(_0x4b10c4){return logger[_0x6d13('0x1b')](_0x6d13('0x29'),_0x6d13('0x3b'),'intelepeer',util['inspect'](_0x4b10c4,{'showHidden':![],'depth':null}));});}else{return logger[_0x6d13('0x1b')](_0x6d13('0x29'),_0x6d13('0x3b'),_0x6d13('0x71'),_0x6d13('0x78'));}break;}}})[_0x6d13('0x79')](function(){_0x1a3613();});}else{_0x1a3613();}}},'charset':_0x6d13('0x7a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x195e=['bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','status','intelepeer','Token\x20not\x20received','finally','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','get','direction','toLowerCase','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','createdAt','error','out','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','phone','remote','/api/sms/messages/','/status?token=','token','sid','update','catch','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','body','smsMethod','sender','login?username=','GET','sms','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','Basic\x20%s','toString','base64','http_code','queued_count','data','message_id','clickSend','plivo','%s:%s','authId','POST','https://api.plivo.com/v1/Account/%s/Message/','infobip','baseUrl','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','keys','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid'];(function(_0x5ef9ea,_0x1ab4e7){var _0x361389=function(_0x39aeb5){while(--_0x39aeb5){_0x5ef9ea['push'](_0x5ef9ea['shift']());}};_0x361389(++_0x1ab4e7);}(_0x195e,0xfb));var _0xe195=function(_0x49109e,_0x28a7aa){_0x49109e=_0x49109e-0x0;var _0x2dbaf7=_0x195e[_0x49109e];return _0x2dbaf7;};'use strict';var _=require(_0xe195('0x0'));var util=require(_0xe195('0x1'));var logger=require(_0xe195('0x2'))(_0xe195('0x3'));var moment=require(_0xe195('0x4'));var BPromise=require(_0xe195('0x5'));var rp=require(_0xe195('0x6'));var fs=require('fs');var path=require(_0xe195('0x7'));var rimraf=require(_0xe195('0x8'));var config=require(_0xe195('0x9'));var attributes=require(_0xe195('0xa'));module[_0xe195('0xb')]=function(_0x11cc55,_0x595c13){return _0x11cc55[_0xe195('0xc')](_0xe195('0xd'),attributes,{'tableName':_0xe195('0xe'),'paranoid':![],'indexes':[{'name':_0xe195('0xf'),'fields':[_0xe195('0xf')]},{'name':'fti_sms_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3bf721,_0x3a7b4e,_0x1d8102){var _0xb606ec=_0x11cc55['models'];var _0x26ab2f=_0x3bf721[_0xe195('0x10')]({'plain':!![]});if(_0x26ab2f[_0xe195('0x11')]['toLowerCase']()==='in'||_0x26ab2f[_0xe195('0x11')][_0xe195('0x12')]()==='out'&&!_0x26ab2f[_0xe195('0x13')]&&!_[_0xe195('0x14')](_0x26ab2f[_0xe195('0x15')])){_0xb606ec[_0xe195('0x16')]['findOne']({'where':{'id':_0x26ab2f[_0xe195('0x17')]}})[_0xe195('0x18')](function(_0x555a6a){if(_0x555a6a){_0x555a6a['update']({'lastMsgAt':_0x26ab2f[_0xe195('0x19')],'lastMsgDirection':_0x26ab2f['direction'][_0xe195('0x12')]()});}})['catch'](function(_0x534879){console[_0xe195('0x1a')](_0x534879);});}if(_0x26ab2f[_0xe195('0x11')]===_0xe195('0x1b')&&!_0x26ab2f[_0xe195('0x13')]){var _0x3a042f;_0xb606ec[_0xe195('0x1c')][_0xe195('0x1d')]({'where':{'id':_0x26ab2f[_0xe195('0x1e')]},'raw':!![]})[_0xe195('0x18')](function(_0x25818c){_0x3a042f=_0x25818c;if(_0x3a042f&&_0x3a042f['type']){switch(_0x3a042f[_0xe195('0x1f')]){case _0xe195('0x20'):var _0xdf735a=require(_0xe195('0x20'));if(_0x3a042f[_0xe195('0x21')]&&_0x3a042f[_0xe195('0x22')]&&_0x3a042f['phone']){var _0x1c5ac8=new _0xdf735a(_0x3a042f[_0xe195('0x21')],_0x3a042f[_0xe195('0x22')]);_0x1c5ac8[_0xe195('0x23')]['create']({'body':_0x26ab2f['body'],'to':_0x26ab2f['phone'],'from':_0x3a042f[_0xe195('0x24')],'statusCallback':_0x3a042f[_0xe195('0x25')]+_0xe195('0x26')+_0x26ab2f['id']+_0xe195('0x27')+_0x3a042f[_0xe195('0x28')]})[_0xe195('0x18')](function(_0x40c6a2){if(_0x40c6a2[_0xe195('0x29')]){return _0x3bf721[_0xe195('0x2a')]({'messageId':_0x40c6a2[_0xe195('0x29')]});}})[_0xe195('0x2b')](function(_0x55be2d){logger[_0xe195('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe195('0x2c'),_0xe195('0x20'),util[_0xe195('0x2d')](_0x55be2d,{'showHidden':![],'depth':null}));});}else{logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x20'),_0xe195('0x2f'));}break;case _0xe195('0x30'):var _0x1f1ca7='https://api.skebby.it/API/v1.0/REST/';if(_0x3a042f[_0xe195('0x31')]&&_0x3a042f[_0xe195('0x32')]){var _0x3199d0={'recipient':[_0x26ab2f[_0xe195('0x24')]],'message':_0x26ab2f[_0xe195('0x33')],'message_type':_0x3a042f['smsMethod']};if(_0x3a042f['smsMethod']&&_0x3a042f[_0xe195('0x34')]!=='SI'){_0x3199d0[_0xe195('0x35')]=_0x3a042f[_0xe195('0x24')];}var _0x8c6186={'url':_0x1f1ca7+_0xe195('0x36')+_0x3a042f[_0xe195('0x31')]+'&password='+_0x3a042f[_0xe195('0x32')],'method':_0xe195('0x37')};rp(_0x8c6186)[_0xe195('0x18')](function(_0x59b3bf){var _0x2b399e=_0x59b3bf['split'](';');var _0xca299f={'user_key':_0x2b399e[0x0],'session_key':_0x2b399e[0x1]};_0x8c6186={'url':_0x1f1ca7+_0xe195('0x38'),'method':'POST','headers':{'user_key':_0xca299f[_0xe195('0x39')],'Session_key':_0xca299f[_0xe195('0x3a')]},'json':!![],'body':_0x3199d0};return rp(_0x8c6186);})[_0xe195('0x18')](function(_0x47d184){if(_0x47d184[_0xe195('0x3b')]>=0x1){var _0x1a57d6={'messageId':_0x47d184[_0xe195('0x3c')]};if(_0x3a042f[_0xe195('0x34')]!=='GP'||!_0x3a042f[_0xe195('0x3d')]){_0x1a57d6[_0xe195('0x3e')]=!![];}return _0x3bf721['update'](_0x1a57d6);}else{return logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x30'),util[_0xe195('0x2d')](_0x47d184,{'showHidden':![],'depth':null}));}})[_0xe195('0x2b')](function(_0x22c79a){return logger['error'](_0xe195('0x2e'),_0xe195('0x2c'),'skebby',util[_0xe195('0x2d')](_0x22c79a,{'showHidden':![],'depth':null}));});}else{logger[_0xe195('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe195('0x2c'),'skebby',_0xe195('0x3f'));}break;case _0xe195('0x40'):if(_0x3a042f[_0xe195('0x22')]){var _0x1714fa={'recipient':_0x26ab2f[_0xe195('0x24')],'message':_0x26ab2f[_0xe195('0x33')],'sender':_0x3a042f['senderString']||_0x3a042f[_0xe195('0x24')],'authorization':_0x3a042f[_0xe195('0x22')]};var _0x3a7b4e={'method':'POST','uri':_0xe195('0x41'),'body':_0x1714fa,'json':!![]};rp(_0x3a7b4e)[_0xe195('0x18')](function(_0x5207e3){var _0x2abd78={'messageId':_0x5207e3[_0xe195('0x42')]};if(!_0x3a042f['deliveryReport']){_0x2abd78[_0xe195('0x3e')]=!![];}return _0x3bf721[_0xe195('0x2a')](_0x2abd78);})[_0xe195('0x2b')](function(_0x57f25f){logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x40'),util[_0xe195('0x2d')](_0x57f25f,{'showHidden':![],'depth':null}));});}else{logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x40'),_0xe195('0x43'));}break;case _0xe195('0x44'):if(_0x3a042f[_0xe195('0x31')]&&_0x3a042f['password']){var _0x1714fa={'messages':[{'source':_0xe195('0x45'),'to':_0x26ab2f[_0xe195('0x24')],'body':_0x26ab2f[_0xe195('0x33')],'from':_0x3a042f[_0xe195('0x46')]||_0x3a042f['phone']}]};var _0x3ebf77=util['format']('%s:%s',_0x3a042f[_0xe195('0x31')],_0x3a042f['password']);var _0x3a7b4e={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x1714fa,'headers':{'Authorization':util[_0xe195('0x47')](_0xe195('0x48'),new Buffer(_0x3ebf77)[_0xe195('0x49')](_0xe195('0x4a')))},'json':!![]};rp(_0x3a7b4e)[_0xe195('0x18')](function(_0x411b0d){if(_0x411b0d[_0xe195('0x4b')]>=0xc8&&_0x411b0d[_0xe195('0x4b')]<=0xce){if(_0x411b0d['data']&&_0x411b0d['data'][_0xe195('0x4c')]>0x0){var _0x1b7e8c=_['head'](_0x411b0d[_0xe195('0x4d')][_0xe195('0x23')]);var _0x106c79={'messageId':_0x1b7e8c[_0xe195('0x4e')]};if(!_0x3a042f[_0xe195('0x3d')]){_0x106c79[_0xe195('0x3e')]=!![];}return _0x3bf721[_0xe195('0x2a')](_0x106c79);}else{logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x4f'),util[_0xe195('0x2d')](_0x411b0d,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x4f'),util[_0xe195('0x2d')](_0x411b0d,{'showHidden':![],'depth':null}));}})[_0xe195('0x2b')](function(_0x289782){logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x4f'),util[_0xe195('0x2d')](_0x289782,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe195('0x2e'),'afterCreate',_0xe195('0x4f'),_0xe195('0x3f'));}break;case _0xe195('0x50'):if(_0x3a042f['authId']&&_0x3a042f['authToken']){var _0x1714fa={'dst':_0x26ab2f[_0xe195('0x24')],'text':_0x26ab2f[_0xe195('0x33')],'src':_0x3a042f[_0xe195('0x46')]||_0x3a042f[_0xe195('0x24')],'url':_0x3a042f[_0xe195('0x25')]+_0xe195('0x26')+_0x26ab2f['id']+_0xe195('0x27')+_0x3a042f[_0xe195('0x28')]};var _0x3ebf77=util[_0xe195('0x47')](_0xe195('0x51'),_0x3a042f[_0xe195('0x52')],_0x3a042f[_0xe195('0x22')]);var _0x3a7b4e={'method':_0xe195('0x53'),'uri':util[_0xe195('0x47')](_0xe195('0x54'),_0x3a042f[_0xe195('0x52')]),'body':_0x1714fa,'headers':{'Authorization':util['format'](_0xe195('0x48'),new Buffer(_0x3ebf77)[_0xe195('0x49')](_0xe195('0x4a')))},'json':!![]};rp(_0x3a7b4e)[_0xe195('0x18')](function(_0x397bd1){var _0x36dc3e={'messageId':_0x397bd1['message_uuid'][0x0]};return _0x3bf721['update'](_0x36dc3e);})[_0xe195('0x2b')](function(_0xe88992){logger[_0xe195('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe195('0x2c'),_0xe195('0x50'),util['inspect'](_0xe88992,{'showHidden':![],'depth':null}));});}else{logger[_0xe195('0x1a')](_0xe195('0x2e'),'afterCreate',_0xe195('0x50'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xe195('0x55'):if(_0x3a042f[_0xe195('0x31')]&&_0x3a042f[_0xe195('0x32')]){if(_0x3a042f[_0xe195('0x56')]){var _0x43b5b2={'method':_0xe195('0x53'),'uri':_0x3a042f[_0xe195('0x56')]+'/auth/1/session','body':{'username':_0x3a042f[_0xe195('0x31')],'password':_0x3a042f[_0xe195('0x32')]},'json':!![]};return rp(_0x43b5b2)[_0xe195('0x18')](function(_0x46719a){var _0x2ff60c={'method':_0xe195('0x53'),'uri':_0x3a042f[_0xe195('0x56')]+_0xe195('0x57'),'body':{'messages':[{'from':_0x3a042f[_0xe195('0x24')],'destinations':[{'to':_0x26ab2f[_0xe195('0x24')]}],'text':_0x26ab2f[_0xe195('0x33')],'notifyUrl':_0x3a042f[_0xe195('0x25')]+_0xe195('0x26')+_0x26ab2f['id']+_0xe195('0x27')+_0x3a042f[_0xe195('0x28')],'notifyContentType':'application/json','callbackData':_0x3a042f[_0xe195('0x24')]+';'+_0x26ab2f[_0xe195('0x33')]}]},'headers':{'Authorization':_0xe195('0x58')+_0x46719a[_0xe195('0x28')]},'json':!![]};return rp(_0x2ff60c)[_0xe195('0x18')](function(_0x564f4a){if(_0x564f4a[_0xe195('0x23')]){var _0x943e1={'messageId':_0x564f4a[_0xe195('0x23')][0x0][_0xe195('0xf')]};if(!_0x3a042f[_0xe195('0x3d')]){_0x943e1[_0xe195('0x3e')]=!![];}return _0x3bf721[_0xe195('0x2a')](_0x943e1);}else{return logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x55'),util[_0xe195('0x2d')](_0x564f4a,{'showHidden':![],'depth':null}));}});})[_0xe195('0x2b')](function(_0x3b204a){return logger['error'](_0xe195('0x2e'),'afterCreate',_0xe195('0x55'),util['inspect'](_0x3b204a,{'showHidden':![],'depth':null}));});}else{logger[_0xe195('0x1a')](_0xe195('0x2e'),'afterCreate','infobip',_0xe195('0x59'));}}else{logger[_0xe195('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe195('0x2c'),_0xe195('0x55'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xe195('0x5a'):var _0x6a16ab=require(_0xe195('0x5b'));if(_0x3a042f[_0xe195('0x5c')]){var _0x59a266={};_0x59a266['login']=_0x3a042f['username'];_0x59a266[_0xe195('0x24')]=_0x26ab2f['phone'];_0x59a266['sender']=_0x3a042f[_0xe195('0x24')];_0x59a266[_0xe195('0x5d')]=_0x26ab2f[_0xe195('0x33')];_0x59a266['timestamp']=+new Date();var _0x48f7db='';var _0x184efe='';var _0x46f1a2=Object[_0xe195('0x5e')](_0x59a266);_0x46f1a2['sort']();for(var _0x20dca8=0x0;_0x20dca8<_0x46f1a2[_0xe195('0x5f')];_0x20dca8++){if(_0x48f7db!=''){_0x48f7db+='&';}_0x48f7db+=_0x46f1a2[_0x20dca8]+'='+encodeURIComponent(_0x59a266[_0x46f1a2[_0x20dca8]]);_0x184efe+=_0x59a266[_0x46f1a2[_0x20dca8]];}_0x184efe+=_0x3a042f[_0xe195('0x5c')];_0x184efe=_0x6a16ab[_0xe195('0x60')](_0xe195('0x61'))[_0xe195('0x2a')](_0x184efe)[_0xe195('0x62')](_0xe195('0x63'));if(_0x48f7db!==''){_0x48f7db+='&';}_0x48f7db+=_0xe195('0x64')+_0x184efe;var _0x8c6186={'method':'GET','uri':_0x3a042f[_0xe195('0x56')]+_0xe195('0x65')+_0x48f7db,'json':!![]};return rp(_0x8c6186)[_0xe195('0x18')](function(_0x8c1a4a){var _0x50c4e1=Object[_0xe195('0x5e')](_0x8c1a4a);if(_0x8c1a4a[_0x50c4e1[0x0]][_0xe195('0x1a')]&&parseInt(_0x8c1a4a[_0x50c4e1[0x0]][_0xe195('0x1a')])===0x0){var _0x14ba3c={'messageId':_0x8c1a4a[_0x50c4e1[0x0]][_0xe195('0x66')]};if(!_0x3a042f[_0xe195('0x3d')]){_0x14ba3c[_0xe195('0x3e')]=!![];}return _0x3bf721['update'](_0x14ba3c);}else{return logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x5a'),util['inspect'](_0x8c1a4a['error'],{'showHidden':![],'depth':null}));}})[_0xe195('0x2b')](function(_0x366cb5){return logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x5a'),util['inspect'](_0x366cb5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x5a'),_0xe195('0x67'));}break;case _0xe195('0x68'):if(_0x3a042f[_0xe195('0x5c')]){var _0x1aac2b={'method':_0xe195('0x53'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3a042f[_0xe195('0x5c')]},'body':{'content':_0x26ab2f[_0xe195('0x33')],'to':[_0x26ab2f[_0xe195('0x24')]],'from':_0x3a042f[_0xe195('0x24')],'binary':![],'clientMessageId':_0xe195('0x69'),'charset':'UTF-8'},'json':!![]};rp(_0x1aac2b)[_0xe195('0x18')](function(_0x314896){if(!_0x314896['error']){var _0x120e9e={'messageId':_0x314896[_0xe195('0x23')][0x0]['apiMessageId']};if(!_0x3a042f[_0xe195('0x3d')]){_0x120e9e[_0xe195('0x3e')]=!![];}return _0x3bf721['update'](_0x120e9e);}else{return logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x68'),util[_0xe195('0x2d')](_0x314896[_0xe195('0x1a')],{'showHidden':![],'depth':null}));}})[_0xe195('0x2b')](function(_0x371db2){return logger[_0xe195('0x1a')](_0xe195('0x2e'),'afterCreate',_0xe195('0x68'),util['inspect'](_0x371db2,{'showHidden':![],'depth':null}));});}else{logger[_0xe195('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe195('0x68'),_0xe195('0x67'));}break;case _0xe195('0x6a'):if(_0x3a042f['username']&&_0x3a042f[_0xe195('0x32')]){var _0x3ebf77=util[_0xe195('0x47')](_0xe195('0x51'),_0x3a042f[_0xe195('0x31')],_0x3a042f[_0xe195('0x32')]);var _0x3a7b4e={'method':_0xe195('0x53'),'uri':_0xe195('0x6b')+_0x3a042f[_0xe195('0x6c')]+_0xe195('0x6d'),'body':{'to':[_0x26ab2f[_0xe195('0x24')]],'text':_0x26ab2f['body'],'from':_0x3a042f[_0xe195('0x24')],'applicationId':_0x3a042f['applicationId']},'headers':{'Authorization':util[_0xe195('0x47')](_0xe195('0x48'),new Buffer(_0x3ebf77)[_0xe195('0x49')](_0xe195('0x4a')))},'json':!![]};rp(_0x3a7b4e)[_0xe195('0x18')](function(_0x35819b){if(_0x35819b['id']){var _0x3a5f1c={'messageId':_0x35819b['id']};return _0x3bf721[_0xe195('0x2a')](_0x3a5f1c);}else{logger[_0xe195('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe195('0x2c'),_0xe195('0x6a'),util[_0xe195('0x2d')](_0x35819b,{'showHidden':![],'depth':null}));}})[_0xe195('0x2b')](function(_0xdeef1d){logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),'bandwidth',util[_0xe195('0x2d')](_0xdeef1d,{'showHidden':![],'depth':null}));});}else{logger[_0xe195('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe195('0x2c'),'bandwidth',_0xe195('0x3f'));}break;case'intelepeer':if(_0x3a042f[_0xe195('0x5c')]){var _0x5319f6={};var _0x8c6186={'method':_0xe195('0x53'),'uri':_0xe195('0x6e'),'headers':{'Authorization':_0xe195('0x6f')+_0x3a042f['apiKey'],'Content-Type':_0xe195('0x70')},'body':{'from':_0x3a042f[_0xe195('0x24')],'to':_0x26ab2f[_0xe195('0x24')],'text':_0x26ab2f[_0xe195('0x33')]},'json':!![]};return rp(_0x8c6186)[_0xe195('0x18')](function(_0x37fbb9){if(_0x37fbb9[_0xe195('0x71')]==0xca){_0x5319f6[_0xe195('0x72')]=_0x37fbb9;var _0x33d278={'method':_0xe195('0x53'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x3a042f[_0xe195('0x5c')],'Content-Type':'application/json'},'body':{'refid':_0x5319f6[_0xe195('0x72')]['refid']},'json':!![]};return rp(_0x33d278)[_0xe195('0x18')](function(_0x45806b){_0x5319f6[_0xe195('0x73')]=_0x45806b;var _0x35da17={'messageId':_0x5319f6[_0xe195('0x72')]['refid'],'read':!![]};return _0x3bf721[_0xe195('0x2a')](_0x35da17);});}else{return logger[_0xe195('0x1a')](_0xe195('0x2e'),'afterCreate',_0xe195('0x74'),util[_0xe195('0x2d')](_0x37fbb9,{'showHidden':![],'depth':null}));}})[_0xe195('0x2b')](function(_0x1a3411){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe195('0x2c'),'intelepeer',util[_0xe195('0x2d')](_0x1a3411,{'showHidden':![],'depth':null}));});}else{return logger[_0xe195('0x1a')](_0xe195('0x2e'),'afterCreate',_0xe195('0x74'),_0xe195('0x75'));}break;}}})[_0xe195('0x76')](function(){_0x1d8102();});}else{_0x1d8102();}}},'charset':'utf8mb4','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 b78edb9..90f1526 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 _0xbf3a=['options','raw','then','debug','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateSmsMessage','SmsMessage'];(function(_0x4f332d,_0x229c32){var _0x561a9a=function(_0x208c08){while(--_0x208c08){_0x4f332d['push'](_0x4f332d['shift']());}};_0x561a9a(++_0x229c32);}(_0xbf3a,0x1e4));var _0xabf3=function(_0xcf4569,_0x1ce755){_0xcf4569=_0xcf4569-0x0;var _0x7fef=_0xbf3a[_0xcf4569];return _0x7fef;};'use strict';var _=require('lodash');var util=require(_0xabf3('0x0'));var moment=require(_0xabf3('0x1'));var BPromise=require('bluebird');var rs=require(_0xabf3('0x2'));var fs=require('fs');var Redis=require(_0xabf3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xabf3('0x4'));var logger=require(_0xabf3('0x5'))(_0xabf3('0x6'));var config=require(_0xabf3('0x7'));var jayson=require(_0xabf3('0x8'));var client=jayson[_0xabf3('0x9')]['http']({'port':0x232a});config[_0xabf3('0xa')]=_[_0xabf3('0xb')](config['redis'],{'host':_0xabf3('0xc'),'port':0x18eb});var socket=require(_0xabf3('0xd'))(new Redis(config[_0xabf3('0xa')]));require(_0xabf3('0xe'))[_0xabf3('0xf')](socket);function respondWithRpcPromise(_0x317e46,_0x2b0e32,_0x5c345e){return new BPromise(function(_0x194e7a,_0x411d3b){return client['request'](_0x317e46,_0x5c345e)['then'](function(_0x430194){logger['info'](_0xabf3('0x10'),_0x2b0e32,_0xabf3('0x11'));logger['debug'](_0xabf3('0x12'),_0x2b0e32,_0xabf3('0x11'),JSON[_0xabf3('0x13')](_0x430194));if(_0x430194[_0xabf3('0x14')]){if(_0x430194[_0xabf3('0x14')]['code']===0x1f4){logger[_0xabf3('0x14')]('SmsMessage,\x20%s,\x20%s',_0x2b0e32,_0x430194[_0xabf3('0x14')][_0xabf3('0x15')]);return _0x411d3b(_0x430194['error'][_0xabf3('0x15')]);}logger[_0xabf3('0x14')](_0xabf3('0x10'),_0x2b0e32,_0x430194[_0xabf3('0x14')]['message']);return _0x194e7a(_0x430194['error'][_0xabf3('0x15')]);}else{logger[_0xabf3('0x16')](_0xabf3('0x10'),_0x2b0e32,_0xabf3('0x11'));_0x194e7a(_0x430194['result'][_0xabf3('0x15')]);}})[_0xabf3('0x17')](function(_0x72ee57){logger[_0xabf3('0x14')]('SmsMessage,\x20%s,\x20%s',_0x2b0e32,_0x72ee57);_0x411d3b(_0x72ee57);});});}exports[_0xabf3('0x18')]=function(_0x1a2493){var _0x2ff401=this;return new Promise(function(_0x31aaa1,_0x1aa4fc){return db[_0xabf3('0x19')]['create'](_0x1a2493['body'],{'raw':_0x1a2493[_0xabf3('0x1a')]?_0x1a2493[_0xabf3('0x1a')][_0xabf3('0x1b')]===undefined?!![]:![]:!![]})[_0xabf3('0x1c')](function(_0x2164b3){logger['info']('CreateSmsMessage',_0x1a2493);logger[_0xabf3('0x1d')](_0xabf3('0x18'),_0x1a2493,JSON['stringify'](_0x2164b3));_0x31aaa1(_0x2164b3);})[_0xabf3('0x17')](function(_0x560dec){logger[_0xabf3('0x14')](_0xabf3('0x18'),_0x560dec['message'],_0x1a2493);_0x1aa4fc(_0x2ff401['error'](0x1f4,_0x560dec[_0xabf3('0x15')]));});});}; \ No newline at end of file +var _0xb110=['localhost','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0xb110,0xe7));var _0x0b11=function(_0x4a232,_0x1e0ad8){_0x4a232=_0x4a232-0x0;var _0x4fc120=_0xb110[_0x4a232];return _0x4fc120;};'use strict';var _=require(_0x0b11('0x0'));var util=require(_0x0b11('0x1'));var moment=require(_0x0b11('0x2'));var BPromise=require(_0x0b11('0x3'));var rs=require(_0x0b11('0x4'));var fs=require('fs');var Redis=require(_0x0b11('0x5'));var db=require(_0x0b11('0x6'))['db'];var utils=require(_0x0b11('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0b11('0x8'));var jayson=require(_0x0b11('0x9'));var client=jayson[_0x0b11('0xa')][_0x0b11('0xb')]({'port':0x232a});config[_0x0b11('0xc')]=_[_0x0b11('0xd')](config[_0x0b11('0xc')],{'host':_0x0b11('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0b11('0xc')]));require('./smsMessage.socket')[_0x0b11('0xf')](socket);function respondWithRpcPromise(_0xd716ec,_0x2a13a3,_0x3f6f30){return new BPromise(function(_0x339840,_0x44189a){return client[_0x0b11('0x10')](_0xd716ec,_0x3f6f30)[_0x0b11('0x11')](function(_0x2dd237){logger['info'](_0x0b11('0x12'),_0x2a13a3,_0x0b11('0x13'));logger[_0x0b11('0x14')](_0x0b11('0x15'),_0x2a13a3,_0x0b11('0x13'),JSON[_0x0b11('0x16')](_0x2dd237));if(_0x2dd237[_0x0b11('0x17')]){if(_0x2dd237[_0x0b11('0x17')][_0x0b11('0x18')]===0x1f4){logger[_0x0b11('0x17')](_0x0b11('0x12'),_0x2a13a3,_0x2dd237[_0x0b11('0x17')][_0x0b11('0x19')]);return _0x44189a(_0x2dd237['error']['message']);}logger[_0x0b11('0x17')](_0x0b11('0x12'),_0x2a13a3,_0x2dd237['error'][_0x0b11('0x19')]);return _0x339840(_0x2dd237[_0x0b11('0x17')]['message']);}else{logger[_0x0b11('0x1a')](_0x0b11('0x12'),_0x2a13a3,_0x0b11('0x13'));_0x339840(_0x2dd237[_0x0b11('0x1b')][_0x0b11('0x19')]);}})[_0x0b11('0x1c')](function(_0xa4d14e){logger[_0x0b11('0x17')](_0x0b11('0x12'),_0x2a13a3,_0xa4d14e);_0x44189a(_0xa4d14e);});});}exports[_0x0b11('0x1d')]=function(_0x4556d2){var _0xc0c8c4=this;return new Promise(function(_0x5e081b,_0x54e7e2){return db[_0x0b11('0x1e')][_0x0b11('0x1f')](_0x4556d2[_0x0b11('0x20')],{'raw':_0x4556d2['options']?_0x4556d2[_0x0b11('0x21')][_0x0b11('0x22')]===undefined?!![]:![]:!![]})[_0x0b11('0x11')](function(_0x3df0cf){logger[_0x0b11('0x1a')](_0x0b11('0x1d'),_0x4556d2);logger[_0x0b11('0x14')](_0x0b11('0x1d'),_0x4556d2,JSON[_0x0b11('0x16')](_0x3df0cf));_0x5e081b(_0x3df0cf);})[_0x0b11('0x1c')](function(_0x4e6f04){logger['error'](_0x0b11('0x1d'),_0x4e6f04[_0x0b11('0x19')],_0x4556d2);_0x54e7e2(_0xc0c8c4[_0x0b11('0x17')](0x1f4,_0x4e6f04[_0x0b11('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 029dc8f..77780b7 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 _0x5158=['remove','removeListener','register','length','smsMessage:','./smsMessage.events','save'];(function(_0xdc9193,_0x1a93a8){var _0x2ce194=function(_0x360059){while(--_0x360059){_0xdc9193['push'](_0xdc9193['shift']());}};_0x2ce194(++_0x1a93a8);}(_0x5158,0x155));var _0x8515=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x5158[_0x5f309e];return _0x487b5e;};'use strict';var SmsMessageEvents=require(_0x8515('0x0'));var events=[_0x8515('0x1'),_0x8515('0x2'),'update'];function createListener(_0x36fb95,_0x19ea69){return function(_0x2d0726){_0x19ea69['emit'](_0x36fb95,_0x2d0726);};}function removeListener(_0x5638ba,_0x46427e){return function(){SmsMessageEvents[_0x8515('0x3')](_0x5638ba,_0x46427e);};}exports[_0x8515('0x4')]=function(_0x74e158){for(var _0x207a05=0x0,_0x39d2f5=events[_0x8515('0x5')];_0x207a05<_0x39d2f5;_0x207a05++){var _0x4a682c=events[_0x207a05];var _0x96f10e=createListener(_0x8515('0x6')+_0x4a682c,_0x74e158);SmsMessageEvents['on'](_0x4a682c,_0x96f10e);}}; \ No newline at end of file +var _0x08a8=['remove','update','removeListener','register','length','smsMessage:','./smsMessage.events','save'];(function(_0x4c38fb,_0x167177){var _0x2c1eb8=function(_0x1f4691){while(--_0x1f4691){_0x4c38fb['push'](_0x4c38fb['shift']());}};_0x2c1eb8(++_0x167177);}(_0x08a8,0x1de));var _0x808a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x08a8[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require(_0x808a('0x0'));var events=[_0x808a('0x1'),_0x808a('0x2'),_0x808a('0x3')];function createListener(_0x21eac8,_0x6344fd){return function(_0x10dfb7){_0x6344fd['emit'](_0x21eac8,_0x10dfb7);};}function removeListener(_0x493620,_0xaa74f1){return function(){SmsMessageEvents[_0x808a('0x4')](_0x493620,_0xaa74f1);};}exports[_0x808a('0x5')]=function(_0x952c7a){for(var _0x599435=0x0,_0x1eacf6=events[_0x808a('0x6')];_0x599435<_0x1eacf6;_0x599435++){var _0x6de170=events[_0x599435];var _0x3c864f=createListener(_0x808a('0x7')+_0x6de170,_0x952c7a);SmsMessageEvents['on'](_0x6de170,_0x3c864f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index f84ed69..8c709e1 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 _0xbd5b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe','get','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x5c63d8,_0x2842f1){var _0x2ea4a6=function(_0x3d7153){while(--_0x3d7153){_0x5c63d8['push'](_0x5c63d8['shift']());}};_0x2ea4a6(++_0x2842f1);}(_0xbd5b,0x9f));var _0xbbd5=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0xbd5b[_0x211632];return _0x5a1da1;};'use strict';var multer=require('multer');var util=require(_0xbbd5('0x0'));var path=require(_0xbbd5('0x1'));var timeout=require(_0xbbd5('0x2'));var express=require('express');var router=express[_0xbbd5('0x3')]();var fs_extra=require(_0xbbd5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbbd5('0x5'));var config=require(_0xbbd5('0x6'));var controller=require('./smsQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbbd5('0x7')]);router['get'](_0xbbd5('0x8'),auth[_0xbbd5('0x9')](),controller[_0xbbd5('0xa')]);router[_0xbbd5('0xb')](_0xbbd5('0xc'),auth[_0xbbd5('0x9')](),controller[_0xbbd5('0xd')]);router[_0xbbd5('0xb')](_0xbbd5('0xe'),auth[_0xbbd5('0x9')](),controller[_0xbbd5('0xf')]);router[_0xbbd5('0xb')](_0xbbd5('0x10'),auth[_0xbbd5('0x9')](),controller[_0xbbd5('0x11')]);router[_0xbbd5('0xb')](_0xbbd5('0x12'),auth[_0xbbd5('0x9')](),controller[_0xbbd5('0x13')]);router[_0xbbd5('0x14')]('/',auth[_0xbbd5('0x9')](),controller['create']);router['post'](_0xbbd5('0x10'),auth[_0xbbd5('0x9')](),controller[_0xbbd5('0x15')]);router[_0xbbd5('0x14')](_0xbbd5('0x12'),auth[_0xbbd5('0x9')](),controller[_0xbbd5('0x16')]);router[_0xbbd5('0x17')](_0xbbd5('0xc'),auth[_0xbbd5('0x9')](),controller[_0xbbd5('0x18')]);router[_0xbbd5('0x19')](_0xbbd5('0xc'),auth[_0xbbd5('0x9')](),controller[_0xbbd5('0x1a')]);router['delete'](_0xbbd5('0x10'),auth[_0xbbd5('0x9')](),controller[_0xbbd5('0x1b')]);router[_0xbbd5('0x19')](_0xbbd5('0x12'),auth['isAuthenticated'](),controller[_0xbbd5('0x1c')]);module[_0xbbd5('0x1d')]=router; \ No newline at end of file +var _0xea8e=['create','post','addTeams','addAgents','update','delete','destroy','removeAgents','multer','path','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xea8e,0xb8));var _0xeea8=function(_0x2eb4c0,_0x5806ec){_0x2eb4c0=_0x2eb4c0-0x0;var _0x272172=_0xea8e[_0x2eb4c0];return _0x272172;};'use strict';var multer=require(_0xeea8('0x0'));var util=require('util');var path=require(_0xeea8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xeea8('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xeea8('0x3'));var config=require(_0xeea8('0x4'));var controller=require(_0xeea8('0x5'));router[_0xeea8('0x6')]('/',auth[_0xeea8('0x7')](),controller['index']);router[_0xeea8('0x6')]('/describe',auth[_0xeea8('0x7')](),controller['describe']);router[_0xeea8('0x6')](_0xeea8('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xeea8('0x6')](_0xeea8('0x9'),auth['isAuthenticated'](),controller[_0xeea8('0xa')]);router[_0xeea8('0x6')](_0xeea8('0xb'),auth[_0xeea8('0x7')](),controller['getTeams']);router[_0xeea8('0x6')](_0xeea8('0xc'),auth[_0xeea8('0x7')](),controller[_0xeea8('0xd')]);router['post']('/',auth[_0xeea8('0x7')](),controller[_0xeea8('0xe')]);router[_0xeea8('0xf')](_0xeea8('0xb'),auth[_0xeea8('0x7')](),controller[_0xeea8('0x10')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xeea8('0x11')]);router['put'](_0xeea8('0x8'),auth['isAuthenticated'](),controller[_0xeea8('0x12')]);router[_0xeea8('0x13')](_0xeea8('0x8'),auth[_0xeea8('0x7')](),controller[_0xeea8('0x14')]);router[_0xeea8('0x13')]('/:id/teams',auth[_0xeea8('0x7')](),controller['removeTeams']);router[_0xeea8('0x13')](_0xeea8('0xc'),auth['isAuthenticated'](),controller[_0xeea8('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 7c44334..16e5b5a 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 _0x03df=['rrmemory','beepall','sequelize','exports','name','STRING','INTEGER','ENUM'];(function(_0x466e31,_0x155c23){var _0x278df7=function(_0x30e4bf){while(--_0x30e4bf){_0x466e31['push'](_0x466e31['shift']());}};_0x278df7(++_0x155c23);}(_0x03df,0x102));var _0xf03d=function(_0x3fb0fe,_0x1cbd7e){_0x3fb0fe=_0x3fb0fe-0x0;var _0x2e81c2=_0x03df[_0x3fb0fe];return _0x2e81c2;};'use strict';var Sequelize=require(_0xf03d('0x0'));module[_0xf03d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf03d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf03d('0x3')]},'timeout':{'type':Sequelize[_0xf03d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf03d('0x5')](_0xf03d('0x6'),_0xf03d('0x7'),'roundrobin')}}; \ No newline at end of file +var _0xc76b=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x403443,_0x305524){var _0x2a5d14=function(_0x326066){while(--_0x326066){_0x403443['push'](_0x403443['shift']());}};_0x2a5d14(++_0x305524);}(_0xc76b,0x1a2));var _0xbc76=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xc76b[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0xbc76('0x0'));module[_0xbc76('0x1')]={'name':{'type':Sequelize[_0xbc76('0x2')],'unique':_0xbc76('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbc76('0x2')]},'timeout':{'type':Sequelize[_0xbc76('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbc76('0x5')]('rrmemory',_0xbc76('0x6'),_0xbc76('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 81a84fe..178ecfe 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 _0x98ef=['count','offset','set','Content-Range','apply','reject','then','destroy','get','SmsQueues','UserProfileResource','error','stack','send','index','map','SmsQueue','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserSmsQueue','order','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','createdAt','format','SIP','updatedAt','getTeams','rawAttributes','addTeams','Team','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','removeTeams','ids','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','userSmsQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit'];(function(_0x385359,_0x325c57){var _0x2ea4dd=function(_0x1bcf4f){while(--_0x1bcf4f){_0x385359['push'](_0x385359['shift']());}};_0x2ea4dd(++_0x325c57);}(_0x98ef,0x197));var _0xf98e=function(_0x3df01a,_0x1bb532){_0x3df01a=_0x3df01a-0x0;var _0x3a0b91=_0x98ef[_0x3df01a];return _0x3a0b91;};'use strict';var emlformat=require(_0xf98e('0x0'));var rimraf=require(_0xf98e('0x1'));var zipdir=require(_0xf98e('0x2'));var jsonpatch=require(_0xf98e('0x3'));var rp=require(_0xf98e('0x4'));var moment=require(_0xf98e('0x5'));var BPromise=require(_0xf98e('0x6'));var Mustache=require(_0xf98e('0x7'));var util=require(_0xf98e('0x8'));var path=require(_0xf98e('0x9'));var sox=require(_0xf98e('0xa'));var csv=require(_0xf98e('0xb'));var ejs=require(_0xf98e('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf98e('0xd'));var squel=require(_0xf98e('0xe'));var crypto=require('crypto');var jsforce=require(_0xf98e('0xf'));var deskjs=require(_0xf98e('0x10'));var toCsv=require(_0xf98e('0xb'));var querystring=require(_0xf98e('0x11'));var Papa=require(_0xf98e('0x12'));var Redis=require(_0xf98e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf98e('0x14'));var as=require(_0xf98e('0x15'));var hardwareService=require(_0xf98e('0x16'));var logger=require(_0xf98e('0x17'))('api');var utils=require(_0xf98e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf98e('0x19'));var db=require(_0xf98e('0x1a'))['db'];config['redis']=_['defaults'](config[_0xf98e('0x1b')],{'host':_0xf98e('0x1c'),'port':0x18eb});var socket=require(_0xf98e('0x1d'))(new Redis(config[_0xf98e('0x1b')]));require('./smsQueue.socket')[_0xf98e('0x1e')](socket);function respondWithStatusCode(_0x201b9b,_0x92ea3f){_0x92ea3f=_0x92ea3f||0xcc;return function(_0xae1833){if(_0xae1833){return _0x201b9b[_0xf98e('0x1f')](_0x92ea3f);}return _0x201b9b[_0xf98e('0x20')](_0x92ea3f)[_0xf98e('0x21')]();};}function respondWithResult(_0x3e6b30,_0xa05101){_0xa05101=_0xa05101||0xc8;return function(_0x5bb263){if(_0x5bb263){return _0x3e6b30[_0xf98e('0x20')](_0xa05101)[_0xf98e('0x22')](_0x5bb263);}};}function respondWithFilteredResult(_0x219fc8,_0x402fe1){return function(_0x2de0a7){if(_0x2de0a7){var _0x47ef26=typeof _0x402fe1['offset']===_0xf98e('0x23')&&typeof _0x402fe1[_0xf98e('0x24')]==='undefined';var _0x350359=_0x2de0a7['count'];var _0x4b974d=_0x47ef26?0x0:_0x402fe1['offset'];var _0x180930=_0x47ef26?_0x2de0a7[_0xf98e('0x25')]:_0x402fe1[_0xf98e('0x26')]+_0x402fe1[_0xf98e('0x24')];var _0x210e1a;if(_0x180930>=_0x350359){_0x180930=_0x350359;_0x210e1a=0xc8;}else{_0x210e1a=0xce;}_0x219fc8[_0xf98e('0x20')](_0x210e1a);return _0x219fc8[_0xf98e('0x27')](_0xf98e('0x28'),_0x4b974d+'-'+_0x180930+'/'+_0x350359)[_0xf98e('0x22')](_0x2de0a7);}return null;};}function patchUpdates(_0x199687){return function(_0x1c36e5){try{jsonpatch[_0xf98e('0x29')](_0x1c36e5,_0x199687,!![]);}catch(_0x5d6b52){return BPromise[_0xf98e('0x2a')](_0x5d6b52);}return _0x1c36e5['save']();};}function saveUpdates(_0x46cad5,_0x1a11a4){return function(_0x34f91e){if(_0x34f91e){return _0x34f91e['update'](_0x46cad5)[_0xf98e('0x2b')](function(_0x9b6370){return _0x9b6370;});}return null;};}function removeEntity(_0x354e86,_0x4bf941){return function(_0x3d501c){if(_0x3d501c){return _0x3d501c[_0xf98e('0x2c')]()['then'](function(){var _0x19085d=_0x3d501c[_0xf98e('0x2d')]({'plain':!![]});var _0x501117=_0xf98e('0x2e');return db[_0xf98e('0x2f')][_0xf98e('0x2c')]({'where':{'type':_0x501117,'resourceId':_0x19085d['id']}})[_0xf98e('0x2b')](function(){return _0x3d501c;});})[_0xf98e('0x2b')](function(){_0x354e86['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d5dc6,_0x233dac){return function(_0x56a116){if(!_0x56a116){_0x2d5dc6[_0xf98e('0x1f')](0x194);}return _0x56a116;};}function handleError(_0x417375,_0x38330c){_0x38330c=_0x38330c||0x1f4;return function(_0x3fac65){logger[_0xf98e('0x30')](_0x3fac65[_0xf98e('0x31')]);if(_0x3fac65['name']){delete _0x3fac65['name'];}_0x417375[_0xf98e('0x20')](_0x38330c)[_0xf98e('0x32')](_0x3fac65);};}exports[_0xf98e('0x33')]=function(_0x1f9c4a,_0x546066){var _0x1ca773={},_0x5c23b2={},_0x42ec99={'count':0x0,'rows':[]};var _0x2b51ef=_[_0xf98e('0x34')](db[_0xf98e('0x35')]['rawAttributes'],function(_0x106144){return{'name':_0x106144[_0xf98e('0x36')],'type':_0x106144[_0xf98e('0x37')][_0xf98e('0x38')]};});_0x5c23b2['model']=_[_0xf98e('0x34')](_0x2b51ef,'name');_0x5c23b2[_0xf98e('0x39')]=_[_0xf98e('0x3a')](_0x1f9c4a[_0xf98e('0x39')]);_0x5c23b2[_0xf98e('0x3b')]=_[_0xf98e('0x3c')](_0x5c23b2[_0xf98e('0x3d')],_0x5c23b2[_0xf98e('0x39')]);_0x1ca773[_0xf98e('0x3e')]=_[_0xf98e('0x3c')](_0x5c23b2[_0xf98e('0x3d')],qs[_0xf98e('0x3f')](_0x1f9c4a['query']['fields']));_0x1ca773[_0xf98e('0x3e')]=_0x1ca773[_0xf98e('0x3e')][_0xf98e('0x40')]?_0x1ca773[_0xf98e('0x3e')]:_0x5c23b2[_0xf98e('0x3d')];if(!_0x1f9c4a[_0xf98e('0x39')][_0xf98e('0x41')](_0xf98e('0x42'))){_0x1ca773[_0xf98e('0x24')]=qs[_0xf98e('0x24')](_0x1f9c4a[_0xf98e('0x39')][_0xf98e('0x24')]);_0x1ca773['offset']=qs[_0xf98e('0x26')](_0x1f9c4a[_0xf98e('0x39')][_0xf98e('0x26')]);}_0x1ca773['order']=qs[_0xf98e('0x43')](_0x1f9c4a[_0xf98e('0x39')]['sort']);_0x1ca773[_0xf98e('0x44')]=qs[_0xf98e('0x3b')](_[_0xf98e('0x45')](_0x1f9c4a[_0xf98e('0x39')],_0x5c23b2[_0xf98e('0x3b')]),_0x2b51ef);if(_0x1f9c4a['query'][_0xf98e('0x46')]){_0x1ca773[_0xf98e('0x44')]=_[_0xf98e('0x47')](_0x1ca773[_0xf98e('0x44')],{'$or':_[_0xf98e('0x34')](_0x2b51ef,function(_0x164d36){if(_0x164d36['type']!==_0xf98e('0x48')){var _0x1a61e5={};_0x1a61e5[_0x164d36[_0xf98e('0x49')]]={'$like':'%'+_0x1f9c4a[_0xf98e('0x39')][_0xf98e('0x46')]+'%'};return _0x1a61e5;}})});}_0x1ca773=_[_0xf98e('0x47')]({},_0x1ca773,_0x1f9c4a['options']);var _0x1f1471={'where':_0x1ca773[_0xf98e('0x44')]};return db[_0xf98e('0x35')][_0xf98e('0x25')](_0x1f1471)[_0xf98e('0x2b')](function(_0x9c3093){_0x42ec99['count']=_0x9c3093;if(_0x1f9c4a[_0xf98e('0x39')]['includeAll']){_0x1ca773[_0xf98e('0x4a')]=[{'all':!![]}];}return db[_0xf98e('0x35')][_0xf98e('0x4b')](_0x1ca773);})['then'](function(_0x5ede2d){_0x42ec99[_0xf98e('0x4c')]=_0x5ede2d;return _0x42ec99;})['then'](respondWithFilteredResult(_0x546066,_0x1ca773))[_0xf98e('0x4d')](handleError(_0x546066,null));};exports[_0xf98e('0x4e')]=function(_0xf4a128,_0x15ccee){var _0x1701a3={'raw':!![],'where':{'id':_0xf4a128[_0xf98e('0x4f')]['id']}},_0x143a04={};_0x143a04[_0xf98e('0x3d')]=_[_0xf98e('0x3a')](db[_0xf98e('0x35')]['rawAttributes']);_0x143a04[_0xf98e('0x39')]=_[_0xf98e('0x3a')](_0xf4a128[_0xf98e('0x39')]);_0x143a04[_0xf98e('0x3b')]=_[_0xf98e('0x3c')](_0x143a04[_0xf98e('0x3d')],_0x143a04[_0xf98e('0x39')]);_0x1701a3[_0xf98e('0x3e')]=_['intersection'](_0x143a04[_0xf98e('0x3d')],qs[_0xf98e('0x3f')](_0xf4a128[_0xf98e('0x39')]['fields']));_0x1701a3[_0xf98e('0x3e')]=_0x1701a3['attributes'][_0xf98e('0x40')]?_0x1701a3[_0xf98e('0x3e')]:_0x143a04[_0xf98e('0x3d')];if(_0xf4a128[_0xf98e('0x39')][_0xf98e('0x50')]){_0x1701a3['include']=[{'all':!![]}];}_0x1701a3=_[_0xf98e('0x47')]({},_0x1701a3,_0xf4a128[_0xf98e('0x51')]);return db[_0xf98e('0x35')]['find'](_0x1701a3)[_0xf98e('0x2b')](handleEntityNotFound(_0x15ccee,null))[_0xf98e('0x2b')](respondWithResult(_0x15ccee,null))[_0xf98e('0x4d')](handleError(_0x15ccee,null));};exports[_0xf98e('0x52')]=function(_0x3e9267,_0x3ece36){return db[_0xf98e('0x35')][_0xf98e('0x52')](_0x3e9267[_0xf98e('0x53')],{})[_0xf98e('0x2b')](function(_0x1dd755){var _0x4e2be3=_0x3e9267[_0xf98e('0x54')][_0xf98e('0x2d')]({'plain':!![]});if(!_0x4e2be3)throw new Error(_0xf98e('0x55'));if(_0x4e2be3[_0xf98e('0x56')]===_0xf98e('0x54')){var _0x329659=_0x1dd755[_0xf98e('0x2d')]({'plain':!![]});var _0x10b425='SmsQueues';return db[_0xf98e('0x57')][_0xf98e('0x58')]({'where':{'name':_0x10b425,'userProfileId':_0x4e2be3['userProfileId']},'raw':!![]})['then'](function(_0x2838cb){if(_0x2838cb&&_0x2838cb[_0xf98e('0x59')]===0x0){return db[_0xf98e('0x2f')][_0xf98e('0x52')]({'name':_0x329659['name'],'resourceId':_0x329659['id'],'type':_0x2838cb[_0xf98e('0x49')],'sectionId':_0x2838cb['id']},{})[_0xf98e('0x2b')](function(){return _0x1dd755;});}else{return _0x1dd755;}})[_0xf98e('0x4d')](function(_0x7a5c7c){logger[_0xf98e('0x30')](_0xf98e('0x5a'),_0x7a5c7c);throw _0x7a5c7c;});}return _0x1dd755;})[_0xf98e('0x2b')](respondWithResult(_0x3ece36,0xc9))['catch'](handleError(_0x3ece36,null));};exports[_0xf98e('0x5b')]=function(_0x5bf139,_0x352e80){if(_0x5bf139['body']['id']){delete _0x5bf139[_0xf98e('0x53')]['id'];}return db[_0xf98e('0x35')][_0xf98e('0x58')]({'where':{'id':_0x5bf139[_0xf98e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x352e80,null))['then'](saveUpdates(_0x5bf139[_0xf98e('0x53')],null))[_0xf98e('0x2b')](respondWithResult(_0x352e80,null))[_0xf98e('0x4d')](handleError(_0x352e80,null));};exports[_0xf98e('0x2c')]=function(_0x55fc9f,_0x193b8f){return db[_0xf98e('0x35')][_0xf98e('0x58')]({'where':{'id':_0x55fc9f[_0xf98e('0x4f')]['id']}})[_0xf98e('0x2b')](handleEntityNotFound(_0x193b8f,null))[_0xf98e('0x2b')](removeEntity(_0x193b8f,null))[_0xf98e('0x4d')](handleError(_0x193b8f,null));};exports[_0xf98e('0x5c')]=function(_0x3d3f25,_0x56d298){return db[_0xf98e('0x35')][_0xf98e('0x5c')]()[_0xf98e('0x2b')](respondWithResult(_0x56d298,null))['catch'](handleError(_0x56d298,null));};exports[_0xf98e('0x5d')]=function(_0x24aaaa,_0x369fba,_0x70d67){var _0x14fe46={'raw':!![],'where':{}},_0x23985e={},_0x55b380;return db[_0xf98e('0x35')][_0xf98e('0x5e')]({'where':{'id':_0x24aaaa['params']['id']}})[_0xf98e('0x2b')](handleEntityNotFound(_0x369fba,null))[_0xf98e('0x2b')](function(_0x281d1a){if(_0x281d1a){_0x55b380=_0x281d1a['get']({'plain':!![]});_0x23985e[_0xf98e('0x3d')]=_[_0xf98e('0x3a')](db[_0xf98e('0x5f')]['rawAttributes']);_0x23985e[_0xf98e('0x39')]=_[_0xf98e('0x3a')](_0x24aaaa[_0xf98e('0x39')]);_0x23985e[_0xf98e('0x3b')]=_[_0xf98e('0x3c')](_0x23985e[_0xf98e('0x3d')],_0x23985e[_0xf98e('0x39')]);_0x14fe46['attributes']=_[_0xf98e('0x3c')](_0x23985e[_0xf98e('0x3d')],qs[_0xf98e('0x3f')](_0x24aaaa[_0xf98e('0x39')][_0xf98e('0x3f')]));_0x14fe46['attributes']=_0x14fe46[_0xf98e('0x3e')][_0xf98e('0x40')]?_0x14fe46[_0xf98e('0x3e')]:_0x23985e[_0xf98e('0x3d')];if(!_0x24aaaa['query']['hasOwnProperty'](_0xf98e('0x42'))){_0x14fe46[_0xf98e('0x24')]=qs['limit'](_0x24aaaa[_0xf98e('0x39')][_0xf98e('0x24')]);_0x14fe46[_0xf98e('0x26')]=qs[_0xf98e('0x26')](_0x24aaaa['query'][_0xf98e('0x26')]);}_0x14fe46[_0xf98e('0x60')]=qs['sort'](_0x24aaaa['query'][_0xf98e('0x43')]);_0x14fe46[_0xf98e('0x44')]=qs[_0xf98e('0x3b')](_[_0xf98e('0x45')](_0x24aaaa[_0xf98e('0x39')],_0x23985e['filters']));_0x14fe46[_0xf98e('0x44')][_0xf98e('0x61')]=_0x281d1a['id'];if(_0x24aaaa[_0xf98e('0x39')][_0xf98e('0x46')]){_0x14fe46[_0xf98e('0x44')]=_[_0xf98e('0x47')](_0x14fe46[_0xf98e('0x44')],{'$or':_['map'](_0x14fe46[_0xf98e('0x3e')],function(_0x58b402){var _0x4edef0={};_0x4edef0[_0x58b402]={'$like':'%'+_0x24aaaa[_0xf98e('0x39')][_0xf98e('0x46')]+'%'};return _0x4edef0;})});}_0x14fe46=_[_0xf98e('0x47')]({},_0x14fe46,_0x24aaaa[_0xf98e('0x51')]);return db['UserSmsQueue']['findAll'](_0x14fe46);}})[_0xf98e('0x2b')](function(_0x1621eb){if(_0x1621eb){return db[_0xf98e('0x62')][_0xf98e('0x63')]({'where':{'id':_[_0xf98e('0x34')](_0x1621eb,_0xf98e('0x64')),'role':_0xf98e('0x65')},'attributes':['id',_0xf98e('0x49'),_0xf98e('0x66'),'updatedAt',_0xf98e('0x67')]});}})[_0xf98e('0x2b')](function(_0x3be614){if(_0x3be614){return{'count':_0x3be614['count'],'rows':_['map'](_0x3be614['rows'],function(_0x3cddf9){return{'membername':_0x3cddf9['name'],'UserId':_0x3cddf9['id'],'queue_name':_0x55b380[_0xf98e('0x49')],'SmsQueueId':_0x55b380['id'],'interface':util[_0xf98e('0x68')]('%s/%s',_0xf98e('0x69'),_0x3cddf9[_0xf98e('0x49')]),'penalty':0x0,'paused':_0x3cddf9[_0xf98e('0x66')],'createdAt':_0x3cddf9[_0xf98e('0x67')],'updatedAt':_0x3cddf9[_0xf98e('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x369fba,_0x14fe46))[_0xf98e('0x4d')](handleError(_0x369fba,null));};exports[_0xf98e('0x6b')]=function(_0x2b10ed,_0x44c353,_0x5f28d3){var _0x5bf4bb={};var _0x55f1e9={};var _0x5cc426;var _0x2ceaa5;return db['SmsQueue'][_0xf98e('0x5e')]({'where':{'id':_0x2b10ed['params']['id']}})['then'](handleEntityNotFound(_0x44c353,null))[_0xf98e('0x2b')](function(_0x4c2a80){if(_0x4c2a80){_0x5cc426=_0x4c2a80;_0x55f1e9[_0xf98e('0x3d')]=_[_0xf98e('0x3a')](db['Team'][_0xf98e('0x6c')]);_0x55f1e9[_0xf98e('0x39')]=_[_0xf98e('0x3a')](_0x2b10ed['query']);_0x55f1e9[_0xf98e('0x3b')]=_[_0xf98e('0x3c')](_0x55f1e9[_0xf98e('0x3d')],_0x55f1e9[_0xf98e('0x39')]);_0x5bf4bb[_0xf98e('0x3e')]=_[_0xf98e('0x3c')](_0x55f1e9['model'],qs['fields'](_0x2b10ed['query'][_0xf98e('0x3f')]));_0x5bf4bb[_0xf98e('0x3e')]=_0x5bf4bb['attributes'][_0xf98e('0x40')]?_0x5bf4bb[_0xf98e('0x3e')]:_0x55f1e9['model'];_0x5bf4bb[_0xf98e('0x60')]=qs[_0xf98e('0x43')](_0x2b10ed[_0xf98e('0x39')][_0xf98e('0x43')]);_0x5bf4bb[_0xf98e('0x44')]=qs[_0xf98e('0x3b')](_[_0xf98e('0x45')](_0x2b10ed['query'],_0x55f1e9[_0xf98e('0x3b')]));if(_0x2b10ed[_0xf98e('0x39')][_0xf98e('0x46')]){_0x5bf4bb['where']=_[_0xf98e('0x47')](_0x5bf4bb[_0xf98e('0x44')],{'$or':_[_0xf98e('0x34')](_0x5bf4bb[_0xf98e('0x3e')],function(_0x47c62f){var _0x379765={};_0x379765[_0x47c62f]={'$like':'%'+_0x2b10ed['query']['filter']+'%'};return _0x379765;})});}_0x5bf4bb=_[_0xf98e('0x47')]({},_0x5bf4bb,_0x2b10ed[_0xf98e('0x51')]);return _0x5cc426[_0xf98e('0x6b')](_0x5bf4bb);}})['then'](function(_0x14599f){if(_0x14599f){_0x2ceaa5=_0x14599f[_0xf98e('0x40')];if(!_0x2b10ed[_0xf98e('0x39')][_0xf98e('0x41')]('nolimit')){_0x5bf4bb[_0xf98e('0x24')]=qs[_0xf98e('0x24')](_0x2b10ed[_0xf98e('0x39')][_0xf98e('0x24')]);_0x5bf4bb[_0xf98e('0x26')]=qs[_0xf98e('0x26')](_0x2b10ed[_0xf98e('0x39')][_0xf98e('0x26')]);}return _0x5cc426[_0xf98e('0x6b')](_0x5bf4bb);}})['then'](function(_0x48312c){if(_0x48312c){return _0x48312c?{'count':_0x2ceaa5,'rows':_0x48312c}:null;}})[_0xf98e('0x2b')](respondWithResult(_0x44c353,null))[_0xf98e('0x4d')](handleError(_0x44c353,null));};exports[_0xf98e('0x6d')]=function(_0x11015d,_0x3f10d4,_0x4c065e){var _0x5bef77=_0x11015d[_0xf98e('0x53')]['ids'];return db[_0xf98e('0x6e')][_0xf98e('0x4b')]({'where':{'id':_0x5bef77},'attributes':['id'],'include':[{'model':db[_0xf98e('0x62')],'as':_0xf98e('0x6f'),'attributes':['id',_0xf98e('0x49'),_0xf98e('0x70'),'voicePause',_0xf98e('0x71')],'raw':!![]}]})['then'](function(_0x316416){if(_0x316416){var _0x2935be=_[_0xf98e('0x72')](_0x316416,function(_0x481a88){var _0x498e02=_0x481a88[_0xf98e('0x2d')]({'plain':!![]});return _0x498e02[_0xf98e('0x6f')];});return db['SmsQueue'][_0xf98e('0x58')]({'where':{'id':_0x11015d[_0xf98e('0x4f')]['id']}})[_0xf98e('0x2b')](function(_0x1461ac){return db[_0xf98e('0x73')][_0xf98e('0x74')](function(_0x28dcc3){return _0x1461ac[_0xf98e('0x6d')](_0x5bef77,{'transaction':_0x28dcc3})['then'](function(){return BPromise[_0xf98e('0x75')](_0x2935be,function(_0x45ffcd){return db[_0xf98e('0x5f')][_0xf98e('0x76')]({'where':{'UserId':_0x45ffcd['id'],'SmsQueueId':_0x11015d['params']['id']},'transaction':_0x28dcc3});});})[_0xf98e('0x2b')](function(){_0x2935be['forEach'](function(_0x26be99){socket[_0xf98e('0x77')]('userSmsQueue:save',{'UserId':_0x26be99['id'],'SmsQueueId':_0x1461ac['id']});});});});});}})[_0xf98e('0x2b')](respondWithStatusCode(_0x3f10d4,null))[_0xf98e('0x4d')](handleError(_0x3f10d4,null));};exports['removeTeams']=function(_0x1ef166,_0x38bd18,_0x27955b){return db[_0xf98e('0x6e')][_0xf98e('0x4b')]({'where':{'id':_0x1ef166[_0xf98e('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0xf98e('0x62')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x38bd18,null))['then'](function(_0x56b9f){var _0x1b893f=_[_0xf98e('0x34')](_0x56b9f,'id');var _0x1c90aa=[];var _0x64b369=[];var _0xa73d00=squel[_0xf98e('0x78')]();_0xa73d00[_0xf98e('0x79')](_0xf98e('0x7a'))[_0xf98e('0x7b')]('team_has_sms_queues','tq')['join'](_0xf98e('0x7c'),'ut',_0xf98e('0x7d'))[_0xf98e('0x44')](_0xf98e('0x7e'),_0x1ef166[_0xf98e('0x4f')]['id']);for(var _0x4f3b2f=0x0;_0x4f3b2f<_0x56b9f[_0xf98e('0x40')];_0x4f3b2f+=0x1){let _0x20cf95=_0x56b9f[_0x4f3b2f];for(var _0x112fc7=0x0;_0x112fc7<_0x20cf95[_0xf98e('0x6f')][_0xf98e('0x40')];_0x112fc7+=0x1){let _0x55f0a3=_0x20cf95[_0xf98e('0x6f')][_0x112fc7];var _0x28963d=_0xa73d00[_0xf98e('0x7f')]();_0x28963d['where'](_0xf98e('0x80'),_0x55f0a3['id']);_0x64b369[_0xf98e('0x81')](db['sequelize']['query'](_0x28963d[_0xf98e('0x82')](),{'type':db[_0xf98e('0x73')][_0xf98e('0x83')][_0xf98e('0x84')]})['then'](function(_0x2b9b8c){if(_0x2b9b8c[_0xf98e('0x40')]===0x1){return _0x55f0a3['id'];}else{var _0x17ff3f=_[_0xf98e('0x85')](_[_0xf98e('0x34')](_0x2b9b8c,_0xf98e('0x86')),function(_0x30ac45){return _[_0xf98e('0x87')](_0x1b893f,_0x30ac45);});if(_0x17ff3f){return _0x55f0a3['id'];}}}));}}return BPromise[_0xf98e('0x88')](_0x64b369)['then'](function(_0xabaa97){_0x1c90aa=_(_0x1c90aa)['union'](_0xabaa97)[_0xf98e('0x89')]()['value']();return db[_0xf98e('0x35')]['find']({'where':{'id':_0x1ef166[_0xf98e('0x4f')]['id']}})[_0xf98e('0x2b')](function(_0x3d6b73){return db[_0xf98e('0x73')]['transaction'](function(_0x7a498b){return _0x3d6b73[_0xf98e('0x8a')](_0x1ef166['query'][_0xf98e('0x8b')],{'transaction':_0x7a498b})[_0xf98e('0x2b')](function(){if(!_['isEmpty'](_0x1c90aa)){return _0x3d6b73[_0xf98e('0x8c')](_0x1c90aa,{'transaction':_0x7a498b});}})[_0xf98e('0x2b')](function(){_0x1c90aa[_0xf98e('0x8d')](function(_0x40ea77){socket[_0xf98e('0x77')](_0xf98e('0x8e'),{'UserId':_0x40ea77,'SmsQueueId':_0x3d6b73['id']});});});});});});})[_0xf98e('0x2b')](respondWithStatusCode(_0x38bd18,null))[_0xf98e('0x4d')](handleError(_0x38bd18,null));};exports[_0xf98e('0x8f')]=function(_0x374538,_0x41078a,_0x3c650e){return db[_0xf98e('0x35')][_0xf98e('0x58')]({'where':{'id':_0x374538[_0xf98e('0x4f')]['id']}})[_0xf98e('0x2b')](handleEntityNotFound(_0x41078a,null))[_0xf98e('0x2b')](function(_0x3f6110){if(_0x3f6110){return _0x3f6110['addAgents'](_0x374538[_0xf98e('0x53')][_0xf98e('0x8b')],_[_0xf98e('0x90')](_0x374538[_0xf98e('0x53')],[_0xf98e('0x8b'),'id'])||{})['spread'](function(_0x19bc3e){for(var _0x3ffdcb=0x0;_0x3ffdcb<_0x374538[_0xf98e('0x53')]['ids'][_0xf98e('0x40')];_0x3ffdcb+=0x1){socket[_0xf98e('0x77')](_0xf98e('0x91'),{'UserId':Number(_0x374538[_0xf98e('0x53')][_0xf98e('0x8b')][_0x3ffdcb]),'SmsQueueId':Number(_0x374538['params']['id'])});}return _0x19bc3e;});}})[_0xf98e('0x2b')](respondWithResult(_0x41078a,null))['catch'](handleError(_0x41078a,null));};exports[_0xf98e('0x8c')]=function(_0x50d88c,_0x434707,_0x13e50c){return db[_0xf98e('0x35')][_0xf98e('0x58')]({'where':{'id':_0x50d88c['params']['id']}})[_0xf98e('0x2b')](handleEntityNotFound(_0x434707,null))[_0xf98e('0x2b')](function(_0x59a019){if(_0x59a019){return _0x59a019[_0xf98e('0x8c')](_0x50d88c[_0xf98e('0x39')][_0xf98e('0x8b')])[_0xf98e('0x2b')](function(){if(_[_0xf98e('0x92')](_0x50d88c[_0xf98e('0x39')][_0xf98e('0x8b')])){for(var _0x2ac420=0x0;_0x2ac420<_0x50d88c[_0xf98e('0x39')][_0xf98e('0x8b')][_0xf98e('0x40')];_0x2ac420+=0x1){socket[_0xf98e('0x77')](_0xf98e('0x8e'),{'UserId':Number(_0x50d88c['query'][_0xf98e('0x8b')][_0x2ac420]),'SmsQueueId':Number(_0x50d88c[_0xf98e('0x4f')]['id'])});}}else{socket[_0xf98e('0x77')]('userSmsQueue:remove',{'UserId':Number(_0x50d88c[_0xf98e('0x39')][_0xf98e('0x8b')]),'SmsQueueId':Number(_0x50d88c[_0xf98e('0x4f')]['id'])});}});}})[_0xf98e('0x2b')](respondWithStatusCode(_0x434707,null))['catch'](handleError(_0x434707,null));};exports[_0xf98e('0x93')]=function(_0x63ecdb,_0x4b51a6,_0x1a83dc){var _0x1ccf9a={};var _0x37ceff={};var _0x20b93a;var _0x1eb96d;return db[_0xf98e('0x35')][_0xf98e('0x5e')]({'where':{'id':_0x63ecdb[_0xf98e('0x4f')]['id']}})[_0xf98e('0x2b')](handleEntityNotFound(_0x4b51a6,null))[_0xf98e('0x2b')](function(_0x13efcd){if(_0x13efcd){_0x20b93a=_0x13efcd;_0x37ceff[_0xf98e('0x3d')]=_[_0xf98e('0x3a')](db['User']['rawAttributes']);_0x37ceff[_0xf98e('0x39')]=_[_0xf98e('0x3a')](_0x63ecdb[_0xf98e('0x39')]);_0x37ceff['filters']=_['intersection'](_0x37ceff[_0xf98e('0x3d')],_0x37ceff[_0xf98e('0x39')]);_0x1ccf9a[_0xf98e('0x3e')]=_[_0xf98e('0x3c')](_0x37ceff[_0xf98e('0x3d')],qs[_0xf98e('0x3f')](_0x63ecdb[_0xf98e('0x39')][_0xf98e('0x3f')]));_0x1ccf9a[_0xf98e('0x3e')]=_0x1ccf9a['attributes']['length']?_0x1ccf9a[_0xf98e('0x3e')]:_0x37ceff['model'];_0x1ccf9a[_0xf98e('0x60')]=qs[_0xf98e('0x43')](_0x63ecdb[_0xf98e('0x39')][_0xf98e('0x43')]);_0x1ccf9a[_0xf98e('0x44')]=qs['filters'](_[_0xf98e('0x45')](_0x63ecdb[_0xf98e('0x39')],_0x37ceff[_0xf98e('0x3b')]));if(_0x63ecdb[_0xf98e('0x39')][_0xf98e('0x46')]){_0x1ccf9a['where']=_[_0xf98e('0x47')](_0x1ccf9a[_0xf98e('0x44')],{'$or':_[_0xf98e('0x34')](_0x1ccf9a[_0xf98e('0x3e')],function(_0xf65d6){var _0x869aec={};_0x869aec[_0xf65d6]={'$like':'%'+_0x63ecdb[_0xf98e('0x39')][_0xf98e('0x46')]+'%'};return _0x869aec;})});}_0x1ccf9a=_[_0xf98e('0x47')]({},_0x1ccf9a,_0x63ecdb[_0xf98e('0x51')]);return _0x20b93a[_0xf98e('0x93')](_0x1ccf9a);}})['then'](function(_0x57a9cd){if(_0x57a9cd){_0x1eb96d=_0x57a9cd['length'];if(!_0x63ecdb[_0xf98e('0x39')][_0xf98e('0x41')](_0xf98e('0x42'))){_0x1ccf9a[_0xf98e('0x24')]=qs[_0xf98e('0x24')](_0x63ecdb[_0xf98e('0x39')]['limit']);_0x1ccf9a[_0xf98e('0x26')]=qs[_0xf98e('0x26')](_0x63ecdb[_0xf98e('0x39')][_0xf98e('0x26')]);}return _0x20b93a['getAgents'](_0x1ccf9a);}})[_0xf98e('0x2b')](function(_0x4730ee){if(_0x4730ee){return _0x4730ee?{'count':_0x1eb96d,'rows':_0x4730ee}:null;}})['then'](respondWithResult(_0x4b51a6,null))[_0xf98e('0x4d')](handleError(_0x4b51a6,null));}; \ No newline at end of file +var _0xbd4e=['find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserSmsQueue','nolimit','pick','findAndCountAll','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','User','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','compact','value','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues'];(function(_0x49df93,_0x2bb7ac){var _0x471bac=function(_0x3dbdc5){while(--_0x3dbdc5){_0x49df93['push'](_0x49df93['shift']());}};_0x471bac(++_0x2bb7ac);}(_0xbd4e,0x1cb));var _0xebd4=function(_0x8c062e,_0xe1cb5d){_0x8c062e=_0x8c062e-0x0;var _0x2351c8=_0xbd4e[_0x8c062e];return _0x2351c8;};'use strict';var emlformat=require(_0xebd4('0x0'));var rimraf=require(_0xebd4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebd4('0x2'));var rp=require(_0xebd4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xebd4('0x4'));var util=require('util');var path=require(_0xebd4('0x5'));var sox=require(_0xebd4('0x6'));var csv=require('to-csv');var ejs=require(_0xebd4('0x7'));var fs=require('fs');var fs_extra=require(_0xebd4('0x8'));var _=require('lodash');var squel=require(_0xebd4('0x9'));var crypto=require(_0xebd4('0xa'));var jsforce=require(_0xebd4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xebd4('0xc'));var Papa=require(_0xebd4('0xd'));var Redis=require('ioredis');var authService=require(_0xebd4('0xe'));var qs=require(_0xebd4('0xf'));var as=require(_0xebd4('0x10'));var hardwareService=require(_0xebd4('0x11'));var logger=require(_0xebd4('0x12'))(_0xebd4('0x13'));var utils=require(_0xebd4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xebd4('0x15'));var db=require('../../mysqldb')['db'];config[_0xebd4('0x16')]=_[_0xebd4('0x17')](config['redis'],{'host':_0xebd4('0x18'),'port':0x18eb});var socket=require(_0xebd4('0x19'))(new Redis(config[_0xebd4('0x16')]));require('./smsQueue.socket')[_0xebd4('0x1a')](socket);function respondWithStatusCode(_0x398811,_0x389963){_0x389963=_0x389963||0xcc;return function(_0x37b9e7){if(_0x37b9e7){return _0x398811[_0xebd4('0x1b')](_0x389963);}return _0x398811[_0xebd4('0x1c')](_0x389963)[_0xebd4('0x1d')]();};}function respondWithResult(_0x4095b1,_0x3c30dd){_0x3c30dd=_0x3c30dd||0xc8;return function(_0x358980){if(_0x358980){return _0x4095b1[_0xebd4('0x1c')](_0x3c30dd)[_0xebd4('0x1e')](_0x358980);}};}function respondWithFilteredResult(_0x2a807b,_0x524204){return function(_0x20cd97){if(_0x20cd97){var _0x20c97f=typeof _0x524204[_0xebd4('0x1f')]===_0xebd4('0x20')&&typeof _0x524204['limit']===_0xebd4('0x20');var _0xd16066=_0x20cd97[_0xebd4('0x21')];var _0x3e3b03=_0x20c97f?0x0:_0x524204[_0xebd4('0x1f')];var _0x5975bf=_0x20c97f?_0x20cd97['count']:_0x524204[_0xebd4('0x1f')]+_0x524204['limit'];var _0x54119b;if(_0x5975bf>=_0xd16066){_0x5975bf=_0xd16066;_0x54119b=0xc8;}else{_0x54119b=0xce;}_0x2a807b[_0xebd4('0x1c')](_0x54119b);return _0x2a807b[_0xebd4('0x22')](_0xebd4('0x23'),_0x3e3b03+'-'+_0x5975bf+'/'+_0xd16066)[_0xebd4('0x1e')](_0x20cd97);}return null;};}function patchUpdates(_0x3b1cdc){return function(_0x4dcd55){try{jsonpatch[_0xebd4('0x24')](_0x4dcd55,_0x3b1cdc,!![]);}catch(_0x42d1b0){return BPromise[_0xebd4('0x25')](_0x42d1b0);}return _0x4dcd55[_0xebd4('0x26')]();};}function saveUpdates(_0xe2e559,_0x1ed549){return function(_0x4c9778){if(_0x4c9778){return _0x4c9778['update'](_0xe2e559)[_0xebd4('0x27')](function(_0x1649ff){return _0x1649ff;});}return null;};}function removeEntity(_0x1b4d10,_0x25c44f){return function(_0x200108){if(_0x200108){return _0x200108[_0xebd4('0x28')]()[_0xebd4('0x27')](function(){var _0x86bb7f=_0x200108[_0xebd4('0x29')]({'plain':!![]});var _0x13001e='SmsQueues';return db[_0xebd4('0x2a')][_0xebd4('0x28')]({'where':{'type':_0x13001e,'resourceId':_0x86bb7f['id']}})[_0xebd4('0x27')](function(){return _0x200108;});})['then'](function(){_0x1b4d10[_0xebd4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x335957,_0x197dd0){return function(_0x233f4b){if(!_0x233f4b){_0x335957[_0xebd4('0x1b')](0x194);}return _0x233f4b;};}function handleError(_0x4d121d,_0x44002d){_0x44002d=_0x44002d||0x1f4;return function(_0x2553b1){logger[_0xebd4('0x2b')](_0x2553b1['stack']);if(_0x2553b1[_0xebd4('0x2c')]){delete _0x2553b1[_0xebd4('0x2c')];}_0x4d121d[_0xebd4('0x1c')](_0x44002d)[_0xebd4('0x2d')](_0x2553b1);};}exports[_0xebd4('0x2e')]=function(_0x392429,_0xfc5591){var _0x3c45a5={},_0xa95c48={},_0x587aba={'count':0x0,'rows':[]};var _0x23c060=_[_0xebd4('0x2f')](db[_0xebd4('0x30')][_0xebd4('0x31')],function(_0x599323){return{'name':_0x599323[_0xebd4('0x32')],'type':_0x599323[_0xebd4('0x33')][_0xebd4('0x34')]};});_0xa95c48[_0xebd4('0x35')]=_['map'](_0x23c060,_0xebd4('0x2c'));_0xa95c48[_0xebd4('0x36')]=_[_0xebd4('0x37')](_0x392429['query']);_0xa95c48[_0xebd4('0x38')]=_[_0xebd4('0x39')](_0xa95c48[_0xebd4('0x35')],_0xa95c48[_0xebd4('0x36')]);_0x3c45a5[_0xebd4('0x3a')]=_[_0xebd4('0x39')](_0xa95c48['model'],qs[_0xebd4('0x3b')](_0x392429[_0xebd4('0x36')][_0xebd4('0x3b')]));_0x3c45a5[_0xebd4('0x3a')]=_0x3c45a5[_0xebd4('0x3a')]['length']?_0x3c45a5[_0xebd4('0x3a')]:_0xa95c48[_0xebd4('0x35')];if(!_0x392429[_0xebd4('0x36')][_0xebd4('0x3c')]('nolimit')){_0x3c45a5[_0xebd4('0x3d')]=qs[_0xebd4('0x3d')](_0x392429['query'][_0xebd4('0x3d')]);_0x3c45a5[_0xebd4('0x1f')]=qs[_0xebd4('0x1f')](_0x392429['query'][_0xebd4('0x1f')]);}_0x3c45a5[_0xebd4('0x3e')]=qs[_0xebd4('0x3f')](_0x392429[_0xebd4('0x36')][_0xebd4('0x3f')]);_0x3c45a5[_0xebd4('0x40')]=qs[_0xebd4('0x38')](_['pick'](_0x392429[_0xebd4('0x36')],_0xa95c48['filters']),_0x23c060);if(_0x392429[_0xebd4('0x36')][_0xebd4('0x41')]){_0x3c45a5[_0xebd4('0x40')]=_[_0xebd4('0x42')](_0x3c45a5[_0xebd4('0x40')],{'$or':_[_0xebd4('0x2f')](_0x23c060,function(_0x26f910){if(_0x26f910[_0xebd4('0x33')]!=='VIRTUAL'){var _0x3447d3={};_0x3447d3[_0x26f910[_0xebd4('0x2c')]]={'$like':'%'+_0x392429[_0xebd4('0x36')][_0xebd4('0x41')]+'%'};return _0x3447d3;}})});}_0x3c45a5=_['merge']({},_0x3c45a5,_0x392429[_0xebd4('0x43')]);var _0x449aa5={'where':_0x3c45a5['where']};return db[_0xebd4('0x30')][_0xebd4('0x21')](_0x449aa5)[_0xebd4('0x27')](function(_0x2e752d){_0x587aba[_0xebd4('0x21')]=_0x2e752d;if(_0x392429[_0xebd4('0x36')][_0xebd4('0x44')]){_0x3c45a5[_0xebd4('0x45')]=[{'all':!![]}];}return db[_0xebd4('0x30')][_0xebd4('0x46')](_0x3c45a5);})[_0xebd4('0x27')](function(_0x2cc595){_0x587aba[_0xebd4('0x47')]=_0x2cc595;return _0x587aba;})[_0xebd4('0x27')](respondWithFilteredResult(_0xfc5591,_0x3c45a5))[_0xebd4('0x48')](handleError(_0xfc5591,null));};exports['show']=function(_0x184d30,_0x292806){var _0xe7b641={'raw':!![],'where':{'id':_0x184d30[_0xebd4('0x49')]['id']}},_0x4466a7={};_0x4466a7[_0xebd4('0x35')]=_[_0xebd4('0x37')](db[_0xebd4('0x30')]['rawAttributes']);_0x4466a7[_0xebd4('0x36')]=_[_0xebd4('0x37')](_0x184d30[_0xebd4('0x36')]);_0x4466a7['filters']=_[_0xebd4('0x39')](_0x4466a7[_0xebd4('0x35')],_0x4466a7['query']);_0xe7b641[_0xebd4('0x3a')]=_[_0xebd4('0x39')](_0x4466a7['model'],qs[_0xebd4('0x3b')](_0x184d30[_0xebd4('0x36')]['fields']));_0xe7b641[_0xebd4('0x3a')]=_0xe7b641[_0xebd4('0x3a')][_0xebd4('0x4a')]?_0xe7b641[_0xebd4('0x3a')]:_0x4466a7[_0xebd4('0x35')];if(_0x184d30[_0xebd4('0x36')]['includeAll']){_0xe7b641[_0xebd4('0x45')]=[{'all':!![]}];}_0xe7b641=_[_0xebd4('0x42')]({},_0xe7b641,_0x184d30[_0xebd4('0x43')]);return db['SmsQueue']['find'](_0xe7b641)[_0xebd4('0x27')](handleEntityNotFound(_0x292806,null))['then'](respondWithResult(_0x292806,null))[_0xebd4('0x48')](handleError(_0x292806,null));};exports[_0xebd4('0x4b')]=function(_0x4db572,_0xfbbf87){return db['SmsQueue'][_0xebd4('0x4b')](_0x4db572[_0xebd4('0x4c')],{})[_0xebd4('0x27')](function(_0x2ee537){var _0x45ec6b=_0x4db572[_0xebd4('0x4d')][_0xebd4('0x29')]({'plain':!![]});if(!_0x45ec6b)throw new Error(_0xebd4('0x4e'));if(_0x45ec6b[_0xebd4('0x4f')]===_0xebd4('0x4d')){var _0x3d8d9a=_0x2ee537[_0xebd4('0x29')]({'plain':!![]});var _0x13c8ad=_0xebd4('0x50');return db['UserProfileSection'][_0xebd4('0x51')]({'where':{'name':_0x13c8ad,'userProfileId':_0x45ec6b[_0xebd4('0x52')]},'raw':!![]})['then'](function(_0x4edae9){if(_0x4edae9&&_0x4edae9['autoAssociation']===0x0){return db[_0xebd4('0x2a')][_0xebd4('0x4b')]({'name':_0x3d8d9a[_0xebd4('0x2c')],'resourceId':_0x3d8d9a['id'],'type':_0x4edae9[_0xebd4('0x2c')],'sectionId':_0x4edae9['id']},{})[_0xebd4('0x27')](function(){return _0x2ee537;});}else{return _0x2ee537;}})['catch'](function(_0x103682){logger[_0xebd4('0x2b')](_0xebd4('0x53'),_0x103682);throw _0x103682;});}return _0x2ee537;})['then'](respondWithResult(_0xfbbf87,0xc9))[_0xebd4('0x48')](handleError(_0xfbbf87,null));};exports[_0xebd4('0x54')]=function(_0x47f740,_0x862ed8){if(_0x47f740[_0xebd4('0x4c')]['id']){delete _0x47f740[_0xebd4('0x4c')]['id'];}return db[_0xebd4('0x30')][_0xebd4('0x51')]({'where':{'id':_0x47f740[_0xebd4('0x49')]['id']}})['then'](handleEntityNotFound(_0x862ed8,null))[_0xebd4('0x27')](saveUpdates(_0x47f740[_0xebd4('0x4c')],null))['then'](respondWithResult(_0x862ed8,null))[_0xebd4('0x48')](handleError(_0x862ed8,null));};exports[_0xebd4('0x28')]=function(_0xdcaacd,_0x50b666){return db['SmsQueue'][_0xebd4('0x51')]({'where':{'id':_0xdcaacd[_0xebd4('0x49')]['id']}})[_0xebd4('0x27')](handleEntityNotFound(_0x50b666,null))[_0xebd4('0x27')](removeEntity(_0x50b666,null))[_0xebd4('0x48')](handleError(_0x50b666,null));};exports['describe']=function(_0x23a793,_0x488a8a){return db[_0xebd4('0x30')][_0xebd4('0x55')]()[_0xebd4('0x27')](respondWithResult(_0x488a8a,null))[_0xebd4('0x48')](handleError(_0x488a8a,null));};exports[_0xebd4('0x56')]=function(_0x2b5169,_0x47ca77,_0x245999){var _0x1d8fbd={'raw':!![],'where':{}},_0x562951={},_0x4b4e64;return db[_0xebd4('0x30')][_0xebd4('0x57')]({'where':{'id':_0x2b5169['params']['id']}})['then'](handleEntityNotFound(_0x47ca77,null))[_0xebd4('0x27')](function(_0x17cea8){if(_0x17cea8){_0x4b4e64=_0x17cea8[_0xebd4('0x29')]({'plain':!![]});_0x562951[_0xebd4('0x35')]=_['keys'](db[_0xebd4('0x58')][_0xebd4('0x31')]);_0x562951[_0xebd4('0x36')]=_[_0xebd4('0x37')](_0x2b5169[_0xebd4('0x36')]);_0x562951['filters']=_[_0xebd4('0x39')](_0x562951[_0xebd4('0x35')],_0x562951[_0xebd4('0x36')]);_0x1d8fbd['attributes']=_[_0xebd4('0x39')](_0x562951[_0xebd4('0x35')],qs[_0xebd4('0x3b')](_0x2b5169[_0xebd4('0x36')][_0xebd4('0x3b')]));_0x1d8fbd[_0xebd4('0x3a')]=_0x1d8fbd['attributes'][_0xebd4('0x4a')]?_0x1d8fbd[_0xebd4('0x3a')]:_0x562951[_0xebd4('0x35')];if(!_0x2b5169[_0xebd4('0x36')]['hasOwnProperty'](_0xebd4('0x59'))){_0x1d8fbd[_0xebd4('0x3d')]=qs[_0xebd4('0x3d')](_0x2b5169[_0xebd4('0x36')][_0xebd4('0x3d')]);_0x1d8fbd['offset']=qs['offset'](_0x2b5169['query'][_0xebd4('0x1f')]);}_0x1d8fbd[_0xebd4('0x3e')]=qs['sort'](_0x2b5169['query'][_0xebd4('0x3f')]);_0x1d8fbd['where']=qs[_0xebd4('0x38')](_[_0xebd4('0x5a')](_0x2b5169[_0xebd4('0x36')],_0x562951['filters']));_0x1d8fbd[_0xebd4('0x40')]['SmsQueueId']=_0x17cea8['id'];if(_0x2b5169[_0xebd4('0x36')]['filter']){_0x1d8fbd['where']=_[_0xebd4('0x42')](_0x1d8fbd[_0xebd4('0x40')],{'$or':_['map'](_0x1d8fbd[_0xebd4('0x3a')],function(_0x31475a){var _0x29df2d={};_0x29df2d[_0x31475a]={'$like':'%'+_0x2b5169['query'][_0xebd4('0x41')]+'%'};return _0x29df2d;})});}_0x1d8fbd=_[_0xebd4('0x42')]({},_0x1d8fbd,_0x2b5169[_0xebd4('0x43')]);return db[_0xebd4('0x58')][_0xebd4('0x46')](_0x1d8fbd);}})['then'](function(_0x8ad2f2){if(_0x8ad2f2){return db['User'][_0xebd4('0x5b')]({'where':{'id':_['map'](_0x8ad2f2,'UserId'),'role':_0xebd4('0x5c')},'attributes':['id',_0xebd4('0x2c'),_0xebd4('0x5d'),_0xebd4('0x5e'),_0xebd4('0x5f')]});}})['then'](function(_0x324523){if(_0x324523){return{'count':_0x324523[_0xebd4('0x21')],'rows':_[_0xebd4('0x2f')](_0x324523[_0xebd4('0x47')],function(_0xe07585){return{'membername':_0xe07585[_0xebd4('0x2c')],'UserId':_0xe07585['id'],'queue_name':_0x4b4e64[_0xebd4('0x2c')],'SmsQueueId':_0x4b4e64['id'],'interface':util[_0xebd4('0x60')](_0xebd4('0x61'),_0xebd4('0x62'),_0xe07585[_0xebd4('0x2c')]),'penalty':0x0,'paused':_0xe07585[_0xebd4('0x5d')],'createdAt':_0xe07585['createdAt'],'updatedAt':_0xe07585['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xebd4('0x27')](respondWithFilteredResult(_0x47ca77,_0x1d8fbd))[_0xebd4('0x48')](handleError(_0x47ca77,null));};exports['getTeams']=function(_0x41db45,_0x189dce,_0xba5425){var _0x50d313={};var _0x1e144a={};var _0x519b80;var _0x5ac21a;return db[_0xebd4('0x30')][_0xebd4('0x57')]({'where':{'id':_0x41db45['params']['id']}})[_0xebd4('0x27')](handleEntityNotFound(_0x189dce,null))[_0xebd4('0x27')](function(_0x5c865b){if(_0x5c865b){_0x519b80=_0x5c865b;_0x1e144a[_0xebd4('0x35')]=_[_0xebd4('0x37')](db[_0xebd4('0x63')][_0xebd4('0x31')]);_0x1e144a[_0xebd4('0x36')]=_[_0xebd4('0x37')](_0x41db45[_0xebd4('0x36')]);_0x1e144a['filters']=_[_0xebd4('0x39')](_0x1e144a['model'],_0x1e144a[_0xebd4('0x36')]);_0x50d313['attributes']=_[_0xebd4('0x39')](_0x1e144a[_0xebd4('0x35')],qs[_0xebd4('0x3b')](_0x41db45[_0xebd4('0x36')]['fields']));_0x50d313[_0xebd4('0x3a')]=_0x50d313[_0xebd4('0x3a')][_0xebd4('0x4a')]?_0x50d313['attributes']:_0x1e144a[_0xebd4('0x35')];_0x50d313['order']=qs[_0xebd4('0x3f')](_0x41db45[_0xebd4('0x36')][_0xebd4('0x3f')]);_0x50d313[_0xebd4('0x40')]=qs[_0xebd4('0x38')](_[_0xebd4('0x5a')](_0x41db45[_0xebd4('0x36')],_0x1e144a[_0xebd4('0x38')]));if(_0x41db45[_0xebd4('0x36')][_0xebd4('0x41')]){_0x50d313[_0xebd4('0x40')]=_[_0xebd4('0x42')](_0x50d313[_0xebd4('0x40')],{'$or':_[_0xebd4('0x2f')](_0x50d313['attributes'],function(_0x44a771){var _0x2b79ff={};_0x2b79ff[_0x44a771]={'$like':'%'+_0x41db45[_0xebd4('0x36')][_0xebd4('0x41')]+'%'};return _0x2b79ff;})});}_0x50d313=_[_0xebd4('0x42')]({},_0x50d313,_0x41db45[_0xebd4('0x43')]);return _0x519b80[_0xebd4('0x64')](_0x50d313);}})[_0xebd4('0x27')](function(_0x42ab5b){if(_0x42ab5b){_0x5ac21a=_0x42ab5b[_0xebd4('0x4a')];if(!_0x41db45[_0xebd4('0x36')][_0xebd4('0x3c')]('nolimit')){_0x50d313[_0xebd4('0x3d')]=qs[_0xebd4('0x3d')](_0x41db45[_0xebd4('0x36')]['limit']);_0x50d313[_0xebd4('0x1f')]=qs['offset'](_0x41db45[_0xebd4('0x36')][_0xebd4('0x1f')]);}return _0x519b80[_0xebd4('0x64')](_0x50d313);}})[_0xebd4('0x27')](function(_0x49afdf){if(_0x49afdf){return _0x49afdf?{'count':_0x5ac21a,'rows':_0x49afdf}:null;}})[_0xebd4('0x27')](respondWithResult(_0x189dce,null))['catch'](handleError(_0x189dce,null));};exports[_0xebd4('0x65')]=function(_0x3bf01a,_0x484968,_0x136334){var _0x28eb2f=_0x3bf01a[_0xebd4('0x4c')][_0xebd4('0x66')];return db['Team'][_0xebd4('0x46')]({'where':{'id':_0x28eb2f},'attributes':['id'],'include':[{'model':db[_0xebd4('0x67')],'as':_0xebd4('0x68'),'attributes':['id',_0xebd4('0x2c'),'online',_0xebd4('0x69'),_0xebd4('0x6a')],'raw':!![]}]})[_0xebd4('0x27')](function(_0x74e1c7){if(_0x74e1c7){var _0x3fd69d=_[_0xebd4('0x6b')](_0x74e1c7,function(_0x10f757){var _0x15fed1=_0x10f757[_0xebd4('0x29')]({'plain':!![]});return _0x15fed1['Agents'];});return db[_0xebd4('0x30')][_0xebd4('0x51')]({'where':{'id':_0x3bf01a[_0xebd4('0x49')]['id']}})['then'](function(_0x537de3){return db[_0xebd4('0x6c')]['transaction'](function(_0x5af329){return _0x537de3[_0xebd4('0x65')](_0x28eb2f,{'transaction':_0x5af329})[_0xebd4('0x27')](function(){return BPromise[_0xebd4('0x6d')](_0x3fd69d,function(_0x53fe51){return db[_0xebd4('0x58')][_0xebd4('0x6e')]({'where':{'UserId':_0x53fe51['id'],'SmsQueueId':_0x3bf01a[_0xebd4('0x49')]['id']},'transaction':_0x5af329});});})[_0xebd4('0x27')](function(){_0x3fd69d['forEach'](function(_0x5402eb){socket['emit'](_0xebd4('0x6f'),{'UserId':_0x5402eb['id'],'SmsQueueId':_0x537de3['id']});});});});});}})[_0xebd4('0x27')](respondWithStatusCode(_0x484968,null))['catch'](handleError(_0x484968,null));};exports[_0xebd4('0x70')]=function(_0x45236a,_0x46fa66,_0x4b4081){return db['Team'][_0xebd4('0x46')]({'where':{'id':_0x45236a[_0xebd4('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xebd4('0x67')],'as':_0xebd4('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x46fa66,null))[_0xebd4('0x27')](function(_0x1ea26e){var _0x261403=_['map'](_0x1ea26e,'id');var _0x259c71=[];var _0x157c61=[];var _0x415bbc=squel[_0xebd4('0x71')]();_0x415bbc[_0xebd4('0x72')](_0xebd4('0x73'))[_0xebd4('0x74')](_0xebd4('0x75'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xebd4('0x40')]('SmsQueueId\x20=\x20?',_0x45236a['params']['id']);for(var _0x27ec86=0x0;_0x27ec86<_0x1ea26e['length'];_0x27ec86+=0x1){let _0x39fed7=_0x1ea26e[_0x27ec86];for(var _0x55a65d=0x0;_0x55a65d<_0x39fed7[_0xebd4('0x68')][_0xebd4('0x4a')];_0x55a65d+=0x1){let _0x489784=_0x39fed7[_0xebd4('0x68')][_0x55a65d];var _0x1b22e4=_0x415bbc[_0xebd4('0x76')]();_0x1b22e4['where'](_0xebd4('0x77'),_0x489784['id']);_0x157c61['push'](db[_0xebd4('0x6c')][_0xebd4('0x36')](_0x1b22e4[_0xebd4('0x78')](),{'type':db[_0xebd4('0x6c')][_0xebd4('0x79')][_0xebd4('0x7a')]})[_0xebd4('0x27')](function(_0x151290){if(_0x151290[_0xebd4('0x4a')]===0x1){return _0x489784['id'];}else{var _0x4614b1=_[_0xebd4('0x7b')](_['map'](_0x151290,_0xebd4('0x7c')),function(_0x1debe6){return _[_0xebd4('0x7d')](_0x261403,_0x1debe6);});if(_0x4614b1){return _0x489784['id'];}}}));}}return BPromise['all'](_0x157c61)['then'](function(_0x99b678){_0x259c71=_(_0x259c71)['union'](_0x99b678)[_0xebd4('0x7e')]()[_0xebd4('0x7f')]();return db[_0xebd4('0x30')]['find']({'where':{'id':_0x45236a['params']['id']}})[_0xebd4('0x27')](function(_0x1dbc32){return db[_0xebd4('0x6c')][_0xebd4('0x80')](function(_0x381dda){return _0x1dbc32['removeTeams'](_0x45236a[_0xebd4('0x36')][_0xebd4('0x66')],{'transaction':_0x381dda})['then'](function(){if(!_[_0xebd4('0x81')](_0x259c71)){return _0x1dbc32[_0xebd4('0x82')](_0x259c71,{'transaction':_0x381dda});}})[_0xebd4('0x27')](function(){_0x259c71['forEach'](function(_0x22b1b4){socket['emit'](_0xebd4('0x83'),{'UserId':_0x22b1b4,'SmsQueueId':_0x1dbc32['id']});});});});});});})[_0xebd4('0x27')](respondWithStatusCode(_0x46fa66,null))[_0xebd4('0x48')](handleError(_0x46fa66,null));};exports[_0xebd4('0x84')]=function(_0x30bb48,_0x67ff26,_0x3f7d1b){return db[_0xebd4('0x30')][_0xebd4('0x51')]({'where':{'id':_0x30bb48[_0xebd4('0x49')]['id']}})['then'](handleEntityNotFound(_0x67ff26,null))[_0xebd4('0x27')](function(_0x4699d5){if(_0x4699d5){return _0x4699d5[_0xebd4('0x84')](_0x30bb48[_0xebd4('0x4c')][_0xebd4('0x66')],_[_0xebd4('0x85')](_0x30bb48[_0xebd4('0x4c')],[_0xebd4('0x66'),'id'])||{})['spread'](function(_0x49f77b){for(var _0x3159a6=0x0;_0x3159a6<_0x30bb48['body'][_0xebd4('0x66')][_0xebd4('0x4a')];_0x3159a6+=0x1){socket['emit'](_0xebd4('0x6f'),{'UserId':Number(_0x30bb48[_0xebd4('0x4c')]['ids'][_0x3159a6]),'SmsQueueId':Number(_0x30bb48[_0xebd4('0x49')]['id'])});}return _0x49f77b;});}})[_0xebd4('0x27')](respondWithResult(_0x67ff26,null))['catch'](handleError(_0x67ff26,null));};exports[_0xebd4('0x82')]=function(_0x36eb82,_0x593381,_0x502dcc){return db['SmsQueue']['find']({'where':{'id':_0x36eb82[_0xebd4('0x49')]['id']}})[_0xebd4('0x27')](handleEntityNotFound(_0x593381,null))[_0xebd4('0x27')](function(_0x48a7ce){if(_0x48a7ce){return _0x48a7ce[_0xebd4('0x82')](_0x36eb82[_0xebd4('0x36')]['ids'])[_0xebd4('0x27')](function(){if(_['isArray'](_0x36eb82['query'][_0xebd4('0x66')])){for(var _0x4e4733=0x0;_0x4e4733<_0x36eb82['query'][_0xebd4('0x66')][_0xebd4('0x4a')];_0x4e4733+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x36eb82[_0xebd4('0x36')][_0xebd4('0x66')][_0x4e4733]),'SmsQueueId':Number(_0x36eb82[_0xebd4('0x49')]['id'])});}}else{socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x36eb82[_0xebd4('0x36')][_0xebd4('0x66')]),'SmsQueueId':Number(_0x36eb82[_0xebd4('0x49')]['id'])});}});}})[_0xebd4('0x27')](respondWithStatusCode(_0x593381,null))[_0xebd4('0x48')](handleError(_0x593381,null));};exports[_0xebd4('0x86')]=function(_0x118331,_0x355ecc,_0x24fa06){var _0x23ff0d={};var _0x20c3e3={};var _0x263e43;var _0x27c0bc;return db[_0xebd4('0x30')][_0xebd4('0x57')]({'where':{'id':_0x118331['params']['id']}})[_0xebd4('0x27')](handleEntityNotFound(_0x355ecc,null))[_0xebd4('0x27')](function(_0x1eea67){if(_0x1eea67){_0x263e43=_0x1eea67;_0x20c3e3[_0xebd4('0x35')]=_[_0xebd4('0x37')](db[_0xebd4('0x67')][_0xebd4('0x31')]);_0x20c3e3['query']=_[_0xebd4('0x37')](_0x118331[_0xebd4('0x36')]);_0x20c3e3[_0xebd4('0x38')]=_[_0xebd4('0x39')](_0x20c3e3['model'],_0x20c3e3[_0xebd4('0x36')]);_0x23ff0d[_0xebd4('0x3a')]=_[_0xebd4('0x39')](_0x20c3e3[_0xebd4('0x35')],qs[_0xebd4('0x3b')](_0x118331[_0xebd4('0x36')][_0xebd4('0x3b')]));_0x23ff0d[_0xebd4('0x3a')]=_0x23ff0d['attributes']['length']?_0x23ff0d[_0xebd4('0x3a')]:_0x20c3e3[_0xebd4('0x35')];_0x23ff0d['order']=qs[_0xebd4('0x3f')](_0x118331[_0xebd4('0x36')]['sort']);_0x23ff0d[_0xebd4('0x40')]=qs[_0xebd4('0x38')](_[_0xebd4('0x5a')](_0x118331['query'],_0x20c3e3['filters']));if(_0x118331['query'][_0xebd4('0x41')]){_0x23ff0d[_0xebd4('0x40')]=_[_0xebd4('0x42')](_0x23ff0d[_0xebd4('0x40')],{'$or':_[_0xebd4('0x2f')](_0x23ff0d[_0xebd4('0x3a')],function(_0x4d10cb){var _0x5367f9={};_0x5367f9[_0x4d10cb]={'$like':'%'+_0x118331[_0xebd4('0x36')][_0xebd4('0x41')]+'%'};return _0x5367f9;})});}_0x23ff0d=_[_0xebd4('0x42')]({},_0x23ff0d,_0x118331[_0xebd4('0x43')]);return _0x263e43[_0xebd4('0x86')](_0x23ff0d);}})[_0xebd4('0x27')](function(_0x50026e){if(_0x50026e){_0x27c0bc=_0x50026e[_0xebd4('0x4a')];if(!_0x118331[_0xebd4('0x36')][_0xebd4('0x3c')](_0xebd4('0x59'))){_0x23ff0d[_0xebd4('0x3d')]=qs[_0xebd4('0x3d')](_0x118331[_0xebd4('0x36')][_0xebd4('0x3d')]);_0x23ff0d[_0xebd4('0x1f')]=qs[_0xebd4('0x1f')](_0x118331[_0xebd4('0x36')][_0xebd4('0x1f')]);}return _0x263e43['getAgents'](_0x23ff0d);}})[_0xebd4('0x27')](function(_0x1b753a){if(_0x1b753a){return _0x1b753a?{'count':_0x27c0bc,'rows':_0x1b753a}:null;}})[_0xebd4('0x27')](respondWithResult(_0x355ecc,null))[_0xebd4('0x48')](handleError(_0x355ecc,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 70b5aea..1884eca 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 _0x36e8=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x4b18ea,_0x2c070a){var _0x28ec1c=function(_0x251208){while(--_0x251208){_0x4b18ea['push'](_0x4b18ea['shift']());}};_0x28ec1c(++_0x2c070a);}(_0x36e8,0x103));var _0x836e=function(_0x38ca68,_0x5cf8ce){_0x38ca68=_0x38ca68-0x0;var _0x207b47=_0x36e8[_0x38ca68];return _0x207b47;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x836e('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x836e('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x836e('0x2'),'afterDestroy':_0x836e('0x3')};function emitEvent(_0x11b332){return function(_0x239f93,_0xe5937f,_0x748a7f){SmsQueueEvents[_0x836e('0x4')](_0x11b332+':'+_0x239f93['id'],_0x239f93);SmsQueueEvents[_0x836e('0x4')](_0x11b332,_0x239f93);_0x748a7f(null);};}for(var e in events){if(events[_0x836e('0x5')](e)){var event=events[e];SmsQueue[_0x836e('0x6')](e,emitEvent(event));}}module[_0x836e('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0xfdf2=['events','setMaxListeners','save','update','emit','hook','exports'];(function(_0x1b3a09,_0x20c774){var _0x357bb8=function(_0xd7c6d2){while(--_0xd7c6d2){_0x1b3a09['push'](_0x1b3a09['shift']());}};_0x357bb8(++_0x20c774);}(_0xfdf2,0x1f1));var _0x2fdf=function(_0x116b3d,_0x4a6e8b){_0x116b3d=_0x116b3d-0x0;var _0x1a2fe7=_0xfdf2[_0x116b3d];return _0x1a2fe7;};'use strict';var EventEmitter=require(_0x2fdf('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2fdf('0x1')](0x0);var events={'afterCreate':_0x2fdf('0x2'),'afterUpdate':_0x2fdf('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5f1faf){return function(_0x48b862,_0x440100,_0x101638){SmsQueueEvents[_0x2fdf('0x4')](_0x5f1faf+':'+_0x48b862['id'],_0x48b862);SmsQueueEvents[_0x2fdf('0x4')](_0x5f1faf,_0x48b862);_0x101638(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x2fdf('0x5')](e,emitEvent(event));}}module[_0x2fdf('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 921831b..875cc24 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 _0x7d52=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','lodash','util','../../config/logger'];(function(_0xdad237,_0x361a1d){var _0x15c575=function(_0x8db2f6){while(--_0x8db2f6){_0xdad237['push'](_0xdad237['shift']());}};_0x15c575(++_0x361a1d);}(_0x7d52,0x19f));var _0x27d5=function(_0xe442a6,_0x28b2e8){_0xe442a6=_0xe442a6-0x0;var _0x221d20=_0x7d52[_0xe442a6];return _0x221d20;};'use strict';var _=require(_0x27d5('0x0'));var util=require(_0x27d5('0x1'));var logger=require(_0x27d5('0x2'))('api');var moment=require(_0x27d5('0x3'));var BPromise=require(_0x27d5('0x4'));var rp=require(_0x27d5('0x5'));var fs=require('fs');var path=require(_0x27d5('0x6'));var rimraf=require(_0x27d5('0x7'));var config=require(_0x27d5('0x8'));var attributes=require(_0x27d5('0x9'));module[_0x27d5('0xa')]=function(_0x52f699,_0x4595b5){return _0x52f699['define']('SmsQueue',attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5811=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','sms_queues','lodash'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x5811,0x175));var _0x1581=function(_0x258760,_0x55a0b5){_0x258760=_0x258760-0x0;var _0x2d3296=_0x5811[_0x258760];return _0x2d3296;};'use strict';var _=require(_0x1581('0x0'));var util=require(_0x1581('0x1'));var logger=require('../../config/logger')(_0x1581('0x2'));var moment=require(_0x1581('0x3'));var BPromise=require(_0x1581('0x4'));var rp=require(_0x1581('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1581('0x6'));var config=require(_0x1581('0x7'));var attributes=require('./smsQueue.attributes');module[_0x1581('0x8')]=function(_0x1ed23f,_0x16cd6c){return _0x1ed23f[_0x1581('0x9')]('SmsQueue',attributes,{'tableName':_0x1581('0xa'),'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 1f1c846..3a81f06 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 _0xa759=['debug','request\x20sent','stringify','error','message','result','catch','SmsQueue','options','where','attributes','include','map','model','GetSmsQueue','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','rpc','jayson/promise','http','defaults','redis','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s'];(function(_0x3986ec,_0x2ba0f3){var _0x875441=function(_0x187f0b){while(--_0x187f0b){_0x3986ec['push'](_0x3986ec['shift']());}};_0x875441(++_0x2ba0f3);}(_0xa759,0xb5));var _0x9a75=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0xa759[_0x5c2a2b];return _0x19921f;};'use strict';var _=require(_0x9a75('0x0'));var util=require(_0x9a75('0x1'));var moment=require(_0x9a75('0x2'));var BPromise=require(_0x9a75('0x3'));var rs=require(_0x9a75('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9a75('0x5'));var config=require('../../config/environment');var jayson=require(_0x9a75('0x6'));var client=jayson['client'][_0x9a75('0x7')]({'port':0x232a});config['redis']=_[_0x9a75('0x8')](config[_0x9a75('0x9')],{'host':_0x9a75('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a75('0x9')]));require(_0x9a75('0xb'))[_0x9a75('0xc')](socket);function respondWithRpcPromise(_0x62734b,_0x2e256b,_0x47d6e5){return new BPromise(function(_0x254ff1,_0x25781f){return client[_0x9a75('0xd')](_0x62734b,_0x47d6e5)[_0x9a75('0xe')](function(_0x490a3e){logger[_0x9a75('0xf')](_0x9a75('0x10'),_0x2e256b,'request\x20sent');logger[_0x9a75('0x11')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x2e256b,_0x9a75('0x12'),JSON[_0x9a75('0x13')](_0x490a3e));if(_0x490a3e['error']){if(_0x490a3e[_0x9a75('0x14')]['code']===0x1f4){logger[_0x9a75('0x14')]('SmsQueue,\x20%s,\x20%s',_0x2e256b,_0x490a3e[_0x9a75('0x14')][_0x9a75('0x15')]);return _0x25781f(_0x490a3e['error'][_0x9a75('0x15')]);}logger[_0x9a75('0x14')](_0x9a75('0x10'),_0x2e256b,_0x490a3e[_0x9a75('0x14')][_0x9a75('0x15')]);return _0x254ff1(_0x490a3e[_0x9a75('0x14')][_0x9a75('0x15')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x2e256b,_0x9a75('0x12'));_0x254ff1(_0x490a3e[_0x9a75('0x16')][_0x9a75('0x15')]);}})[_0x9a75('0x17')](function(_0x43d08f){logger[_0x9a75('0x14')](_0x9a75('0x10'),_0x2e256b,_0x43d08f);_0x25781f(_0x43d08f);});});}exports['GetSmsQueue']=function(_0x2f4f16){var _0x989db1=this;return new Promise(function(_0x58b10d,_0x1bde9b){return db[_0x9a75('0x18')]['findAll']({'raw':_0x2f4f16['options']?_0x2f4f16['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f4f16[_0x9a75('0x19')]?_0x2f4f16[_0x9a75('0x19')][_0x9a75('0x1a')]||null:null,'attributes':_0x2f4f16[_0x9a75('0x19')]?_0x2f4f16[_0x9a75('0x19')][_0x9a75('0x1b')]||null:null,'limit':_0x2f4f16[_0x9a75('0x19')]?_0x2f4f16['options']['limit']||null:null,'include':_0x2f4f16['options']?_0x2f4f16[_0x9a75('0x19')][_0x9a75('0x1c')]?_[_0x9a75('0x1d')](_0x2f4f16['options']['include'],function(_0x45844e){return{'model':db[_0x45844e[_0x9a75('0x1e')]],'as':_0x45844e['as'],'attributes':_0x45844e[_0x9a75('0x1b')],'include':_0x45844e[_0x9a75('0x1c')]?_['map'](_0x45844e[_0x9a75('0x1c')],function(_0x48ab81){return{'model':db[_0x48ab81['model']],'as':_0x48ab81['as'],'attributes':_0x48ab81[_0x9a75('0x1b')],'include':_0x48ab81['include']?_['map'](_0x48ab81[_0x9a75('0x1c')],function(_0x482c68){return{'model':db[_0x482c68[_0x9a75('0x1e')]],'as':_0x482c68['as'],'attributes':_0x482c68['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x289c7d){logger[_0x9a75('0xf')](_0x9a75('0x1f'),_0x2f4f16);logger[_0x9a75('0x11')](_0x9a75('0x1f'),_0x2f4f16,JSON['stringify'](_0x289c7d));_0x58b10d(_0x289c7d);})[_0x9a75('0x17')](function(_0x37be30){logger[_0x9a75('0x14')](_0x9a75('0x1f'),_0x37be30[_0x9a75('0x15')],_0x2f4f16);_0x1bde9b(_0x989db1['error'](0x1f4,_0x37be30[_0x9a75('0x15')]));});});};exports[_0x9a75('0x20')]=function(_0xd1dd9f){var _0x246cf2=this;return new Promise(function(_0x398dfe,_0x6b202){return db['SmsQueue']['find']({'raw':_0xd1dd9f[_0x9a75('0x19')]?_0xd1dd9f[_0x9a75('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xd1dd9f[_0x9a75('0x19')]?_0xd1dd9f[_0x9a75('0x19')][_0x9a75('0x1a')]||null:null,'attributes':_0xd1dd9f[_0x9a75('0x19')]?_0xd1dd9f['options'][_0x9a75('0x1b')]||null:null,'include':_0xd1dd9f['options']?_0xd1dd9f['options'][_0x9a75('0x1c')]?_[_0x9a75('0x1d')](_0xd1dd9f[_0x9a75('0x19')][_0x9a75('0x1c')],function(_0x1e3c05){return{'model':db[_0x1e3c05[_0x9a75('0x1e')]],'as':_0x1e3c05['as'],'attributes':_0x1e3c05[_0x9a75('0x1b')],'include':_0x1e3c05['include']?_[_0x9a75('0x1d')](_0x1e3c05[_0x9a75('0x1c')],function(_0x2b5b15){return{'model':db[_0x2b5b15[_0x9a75('0x1e')]],'as':_0x2b5b15['as'],'attributes':_0x2b5b15[_0x9a75('0x1b')],'include':_0x2b5b15[_0x9a75('0x1c')]?_[_0x9a75('0x1d')](_0x2b5b15[_0x9a75('0x1c')],function(_0x475398){return{'model':db[_0x475398[_0x9a75('0x1e')]],'as':_0x475398['as'],'attributes':_0x475398['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a75('0xe')](function(_0x44e526){logger[_0x9a75('0xf')](_0x9a75('0x20'),_0xd1dd9f);logger['debug'](_0x9a75('0x20'),_0xd1dd9f,JSON[_0x9a75('0x13')](_0x44e526));_0x398dfe(_0x44e526);})[_0x9a75('0x17')](function(_0x56da74){logger['error'](_0x9a75('0x20'),_0x56da74[_0x9a75('0x15')],_0xd1dd9f);_0x6b202(_0x246cf2[_0x9a75('0x14')](0x1f4,_0x56da74[_0x9a75('0x15')]));});});}; \ No newline at end of file +var _0x25e3=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','include','map','model','debug','ShowSmsQueue','where','lodash'];(function(_0x2de21f,_0x48c48c){var _0x29864f=function(_0x2e2305){while(--_0x2e2305){_0x2de21f['push'](_0x2de21f['shift']());}};_0x29864f(++_0x48c48c);}(_0x25e3,0x1eb));var _0x325e=function(_0x3657a4,_0x560336){_0x3657a4=_0x3657a4-0x0;var _0x33b41a=_0x25e3[_0x3657a4];return _0x33b41a;};'use strict';var _=require(_0x325e('0x0'));var util=require(_0x325e('0x1'));var moment=require(_0x325e('0x2'));var BPromise=require(_0x325e('0x3'));var rs=require(_0x325e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x325e('0x5'));var logger=require(_0x325e('0x6'))(_0x325e('0x7'));var config=require(_0x325e('0x8'));var jayson=require(_0x325e('0x9'));var client=jayson[_0x325e('0xa')][_0x325e('0xb')]({'port':0x232a});config[_0x325e('0xc')]=_[_0x325e('0xd')](config[_0x325e('0xc')],{'host':_0x325e('0xe'),'port':0x18eb});var socket=require(_0x325e('0xf'))(new Redis(config[_0x325e('0xc')]));require(_0x325e('0x10'))[_0x325e('0x11')](socket);function respondWithRpcPromise(_0x7f34cc,_0x1ec811,_0x539b92){return new BPromise(function(_0xe4845e,_0xc4f1ff){return client[_0x325e('0x12')](_0x7f34cc,_0x539b92)[_0x325e('0x13')](function(_0x192584){logger[_0x325e('0x14')](_0x325e('0x15'),_0x1ec811,'request\x20sent');logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x1ec811,'request\x20sent',JSON[_0x325e('0x16')](_0x192584));if(_0x192584['error']){if(_0x192584[_0x325e('0x17')]['code']===0x1f4){logger[_0x325e('0x17')](_0x325e('0x15'),_0x1ec811,_0x192584[_0x325e('0x17')][_0x325e('0x18')]);return _0xc4f1ff(_0x192584['error']['message']);}logger['error'](_0x325e('0x15'),_0x1ec811,_0x192584[_0x325e('0x17')][_0x325e('0x18')]);return _0xe4845e(_0x192584['error'][_0x325e('0x18')]);}else{logger[_0x325e('0x14')](_0x325e('0x15'),_0x1ec811,_0x325e('0x19'));_0xe4845e(_0x192584[_0x325e('0x1a')][_0x325e('0x18')]);}})[_0x325e('0x1b')](function(_0x292414){logger[_0x325e('0x17')](_0x325e('0x15'),_0x1ec811,_0x292414);_0xc4f1ff(_0x292414);});});}exports[_0x325e('0x1c')]=function(_0x584590){var _0x365219=this;return new Promise(function(_0x12be0a,_0x451e86){return db[_0x325e('0x1d')][_0x325e('0x1e')]({'raw':_0x584590[_0x325e('0x1f')]?_0x584590[_0x325e('0x1f')][_0x325e('0x20')]===undefined?!![]:![]:!![],'where':_0x584590[_0x325e('0x1f')]?_0x584590[_0x325e('0x1f')]['where']||null:null,'attributes':_0x584590['options']?_0x584590[_0x325e('0x1f')][_0x325e('0x21')]||null:null,'limit':_0x584590['options']?_0x584590['options'][_0x325e('0x22')]||null:null,'include':_0x584590['options']?_0x584590['options'][_0x325e('0x23')]?_[_0x325e('0x24')](_0x584590[_0x325e('0x1f')][_0x325e('0x23')],function(_0x185dc1){return{'model':db[_0x185dc1[_0x325e('0x25')]],'as':_0x185dc1['as'],'attributes':_0x185dc1[_0x325e('0x21')],'include':_0x185dc1[_0x325e('0x23')]?_['map'](_0x185dc1[_0x325e('0x23')],function(_0x72c81c){return{'model':db[_0x72c81c[_0x325e('0x25')]],'as':_0x72c81c['as'],'attributes':_0x72c81c[_0x325e('0x21')],'include':_0x72c81c['include']?_[_0x325e('0x24')](_0x72c81c['include'],function(_0x3e4405){return{'model':db[_0x3e4405[_0x325e('0x25')]],'as':_0x3e4405['as'],'attributes':_0x3e4405['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xac853d){logger[_0x325e('0x14')](_0x325e('0x1c'),_0x584590);logger[_0x325e('0x26')](_0x325e('0x1c'),_0x584590,JSON[_0x325e('0x16')](_0xac853d));_0x12be0a(_0xac853d);})[_0x325e('0x1b')](function(_0x4e40f5){logger[_0x325e('0x17')](_0x325e('0x1c'),_0x4e40f5[_0x325e('0x18')],_0x584590);_0x451e86(_0x365219[_0x325e('0x17')](0x1f4,_0x4e40f5[_0x325e('0x18')]));});});};exports[_0x325e('0x27')]=function(_0x50729b){var _0x5c0fa4=this;return new Promise(function(_0x46fa98,_0x1ebcc7){return db[_0x325e('0x1d')]['find']({'raw':_0x50729b[_0x325e('0x1f')]?_0x50729b['options'][_0x325e('0x20')]===undefined?!![]:![]:!![],'where':_0x50729b[_0x325e('0x1f')]?_0x50729b[_0x325e('0x1f')][_0x325e('0x28')]||null:null,'attributes':_0x50729b['options']?_0x50729b['options'][_0x325e('0x21')]||null:null,'include':_0x50729b[_0x325e('0x1f')]?_0x50729b['options'][_0x325e('0x23')]?_['map'](_0x50729b[_0x325e('0x1f')][_0x325e('0x23')],function(_0x3d16cf){return{'model':db[_0x3d16cf[_0x325e('0x25')]],'as':_0x3d16cf['as'],'attributes':_0x3d16cf[_0x325e('0x21')],'include':_0x3d16cf[_0x325e('0x23')]?_[_0x325e('0x24')](_0x3d16cf['include'],function(_0x38b4a3){return{'model':db[_0x38b4a3[_0x325e('0x25')]],'as':_0x38b4a3['as'],'attributes':_0x38b4a3[_0x325e('0x21')],'include':_0x38b4a3[_0x325e('0x23')]?_[_0x325e('0x24')](_0x38b4a3[_0x325e('0x23')],function(_0x177237){return{'model':db[_0x177237[_0x325e('0x25')]],'as':_0x177237['as'],'attributes':_0x177237[_0x325e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x325e('0x13')](function(_0x5ece9d){logger[_0x325e('0x14')](_0x325e('0x27'),_0x50729b);logger['debug'](_0x325e('0x27'),_0x50729b,JSON[_0x325e('0x16')](_0x5ece9d));_0x46fa98(_0x5ece9d);})[_0x325e('0x1b')](function(_0x47cee7){logger['error']('ShowSmsQueue',_0x47cee7[_0x325e('0x18')],_0x50729b);_0x1ebcc7(_0x5c0fa4[_0x325e('0x17')](0x1f4,_0x47cee7[_0x325e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 0b66a49..a9faa42 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 _0x0a21=['save','remove','update','emit','removeListener','smsQueue:','./smsQueue.events'];(function(_0x2f14a4,_0x4b6232){var _0x480637=function(_0x3663c){while(--_0x3663c){_0x2f14a4['push'](_0x2f14a4['shift']());}};_0x480637(++_0x4b6232);}(_0x0a21,0xbc));var _0x10a2=function(_0x35a965,_0x4fce0a){_0x35a965=_0x35a965-0x0;var _0x575e84=_0x0a21[_0x35a965];return _0x575e84;};'use strict';var SmsQueueEvents=require(_0x10a2('0x0'));var events=[_0x10a2('0x1'),_0x10a2('0x2'),_0x10a2('0x3')];function createListener(_0x4f5f2e,_0x39e79e){return function(_0x4a6299){_0x39e79e[_0x10a2('0x4')](_0x4f5f2e,_0x4a6299);};}function removeListener(_0x1b61e5,_0x486a8c){return function(){SmsQueueEvents[_0x10a2('0x5')](_0x1b61e5,_0x486a8c);};}exports['register']=function(_0x18ec44){for(var _0xec208b=0x0,_0x22c360=events['length'];_0xec208b<_0x22c360;_0xec208b++){var _0x384f80=events[_0xec208b];var _0x3c4fa7=createListener(_0x10a2('0x6')+_0x384f80,_0x18ec44);SmsQueueEvents['on'](_0x384f80,_0x3c4fa7);}}; \ No newline at end of file +var _0x3e1b=['removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x30d219,_0x2d05f4){var _0x4ad9df=function(_0x47f736){while(--_0x47f736){_0x30d219['push'](_0x30d219['shift']());}};_0x4ad9df(++_0x2d05f4);}(_0x3e1b,0x8c));var _0xb3e1=function(_0x135931,_0x20ff12){_0x135931=_0x135931-0x0;var _0xd06c48=_0x3e1b[_0x135931];return _0xd06c48;};'use strict';var SmsQueueEvents=require(_0xb3e1('0x0'));var events=[_0xb3e1('0x1'),_0xb3e1('0x2'),_0xb3e1('0x3')];function createListener(_0x1cd052,_0x4913a1){return function(_0x2bb03d){_0x4913a1['emit'](_0x1cd052,_0x2bb03d);};}function removeListener(_0x8ca57d,_0x24d717){return function(){SmsQueueEvents[_0xb3e1('0x4')](_0x8ca57d,_0x24d717);};}exports[_0xb3e1('0x5')]=function(_0x17eb37){for(var _0x22e753=0x0,_0x1f95e1=events[_0xb3e1('0x6')];_0x22e753<_0x1f95e1;_0x22e753++){var _0x1d417b=events[_0x22e753];var _0x4f3ccf=createListener(_0xb3e1('0x7')+_0x1d417b,_0x17eb37);SmsQueueEvents['on'](_0x1d417b,_0x4f3ccf);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 2015ec8..e5928b3 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 _0x8f9d=['/:id','show','create','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe'];(function(_0x484cac,_0x30ad3a){var _0x1d6e77=function(_0x4f5f16){while(--_0x4f5f16){_0x484cac['push'](_0x484cac['shift']());}};_0x1d6e77(++_0x30ad3a);}(_0x8f9d,0x93));var _0xd8f9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f9d[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xd8f9('0x0'));var util=require('util');var path=require(_0xd8f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f9('0x2'));var router=express[_0xd8f9('0x3')]();var fs_extra=require(_0xd8f9('0x4'));var auth=require(_0xd8f9('0x5'));var interaction=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var controller=require(_0xd8f9('0x8'));router['get']('/',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xa')]);router[_0xd8f9('0xb')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller['describe']);router[_0xd8f9('0xb')](_0xd8f9('0xd'),auth['isAuthenticated'](),controller[_0xd8f9('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd8f9('0xf')]);router[_0xd8f9('0x10')](_0xd8f9('0xd'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x11')]);router[_0xd8f9('0x12')](_0xd8f9('0xd'),auth['isAuthenticated'](),controller[_0xd8f9('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6003=['delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','index','isAuthenticated','show','post','put','/:id','update'];(function(_0x3540de,_0x13a960){var _0x5a1c49=function(_0x170437){while(--_0x170437){_0x3540de['push'](_0x3540de['shift']());}};_0x5a1c49(++_0x13a960);}(_0x6003,0xae));var _0x3600=function(_0x163c28,_0xcb1fc5){_0x163c28=_0x163c28-0x0;var _0x389bd8=_0x6003[_0x163c28];return _0x389bd8;};'use strict';var multer=require(_0x3600('0x0'));var util=require(_0x3600('0x1'));var path=require(_0x3600('0x2'));var timeout=require(_0x3600('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3600('0x4'));var auth=require(_0x3600('0x5'));var interaction=require(_0x3600('0x6'));var config=require('../../config/environment');var controller=require(_0x3600('0x7'));router[_0x3600('0x8')]('/',auth['isAuthenticated'](),controller[_0x3600('0x9')]);router['get']('/describe',auth[_0x3600('0xa')](),controller['describe']);router[_0x3600('0x8')]('/:id',auth[_0x3600('0xa')](),controller[_0x3600('0xb')]);router[_0x3600('0xc')]('/',auth[_0x3600('0xa')](),controller['create']);router[_0x3600('0xd')](_0x3600('0xe'),auth[_0x3600('0xa')](),controller[_0x3600('0xf')]);router[_0x3600('0x10')](_0x3600('0xe'),auth[_0x3600('0xa')](),controller[_0x3600('0x11')]);module[_0x3600('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 2ec36a8..6d4c3a6 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 _0x9b1a=['STRING','DATE','moment','sequelize','exports'];(function(_0x46368d,_0xe608d0){var _0x5efc16=function(_0xafa889){while(--_0xafa889){_0x46368d['push'](_0x46368d['shift']());}};_0x5efc16(++_0xe608d0);}(_0x9b1a,0x66));var _0xa9b1=function(_0x4503df,_0xfec122){_0x4503df=_0x4503df-0x0;var _0x3f1b2b=_0x9b1a[_0x4503df];return _0x3f1b2b;};'use strict';var moment=require(_0xa9b1('0x0'));var Sequelize=require(_0xa9b1('0x1'));module[_0xa9b1('0x2')]={'uniqueid':{'type':Sequelize[_0xa9b1('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa9b1('0x3')]},'joinAt':{'type':Sequelize[_0xa9b1('0x4')]},'leaveAt':{'type':Sequelize[_0xa9b1('0x4')]},'acceptAt':{'type':Sequelize[_0xa9b1('0x4')]},'exitAt':{'type':Sequelize[_0xa9b1('0x4')]},'reason':{'type':Sequelize[_0xa9b1('0x3')]}}; \ No newline at end of file +var _0x25dd=['sequelize','exports','STRING','DATE'];(function(_0xe39824,_0xbdf61f){var _0x4bc31e=function(_0x594760){while(--_0x594760){_0xe39824['push'](_0xe39824['shift']());}};_0x4bc31e(++_0xbdf61f);}(_0x25dd,0x90));var _0xd25d=function(_0x367fdc,_0x71f9cd){_0x367fdc=_0x367fdc-0x0;var _0x75c4ff=_0x25dd[_0x367fdc];return _0x75c4ff;};'use strict';var moment=require('moment');var Sequelize=require(_0xd25d('0x0'));module[_0xd25d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd25d('0x2')]},'joinAt':{'type':Sequelize[_0xd25d('0x3')]},'leaveAt':{'type':Sequelize[_0xd25d('0x3')]},'acceptAt':{'type':Sequelize[_0xd25d('0x3')]},'exitAt':{'type':Sequelize[_0xd25d('0x3')]},'reason':{'type':Sequelize[_0xd25d('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 09c6be9..1c50663 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 _0x1f72=['then','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','SmsQueueReport','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x5cbac5,_0x8f8a26){var _0x4513a4=function(_0x3742b0){while(--_0x3742b0){_0x5cbac5['push'](_0x5cbac5['shift']());}};_0x4513a4(++_0x8f8a26);}(_0x1f72,0xc1));var _0x21f7=function(_0x2a1537,_0x8a7ffd){_0x2a1537=_0x2a1537-0x0;var _0x12563a=_0x1f72[_0x2a1537];return _0x12563a;};'use strict';var emlformat=require(_0x21f7('0x0'));var rimraf=require(_0x21f7('0x1'));var zipdir=require(_0x21f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21f7('0x3'));var moment=require(_0x21f7('0x4'));var BPromise=require(_0x21f7('0x5'));var Mustache=require(_0x21f7('0x6'));var util=require(_0x21f7('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x21f7('0x8'));var ejs=require(_0x21f7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x21f7('0xa'));var crypto=require(_0x21f7('0xb'));var jsforce=require(_0x21f7('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x21f7('0xd'));var Papa=require('papaparse');var Redis=require(_0x21f7('0xe'));var authService=require(_0x21f7('0xf'));var qs=require(_0x21f7('0x10'));var as=require(_0x21f7('0x11'));var hardwareService=require(_0x21f7('0x12'));var logger=require('../../config/logger')(_0x21f7('0x13'));var utils=require(_0x21f7('0x14'));var config=require(_0x21f7('0x15'));var licenseUtil=require(_0x21f7('0x16'));var db=require(_0x21f7('0x17'))['db'];function respondWithStatusCode(_0x23ab91,_0x5a0303){_0x5a0303=_0x5a0303||0xcc;return function(_0x4c5540){if(_0x4c5540){return _0x23ab91[_0x21f7('0x18')](_0x5a0303);}return _0x23ab91[_0x21f7('0x19')](_0x5a0303)[_0x21f7('0x1a')]();};}function respondWithResult(_0x597b04,_0x1fa784){_0x1fa784=_0x1fa784||0xc8;return function(_0x24ce42){if(_0x24ce42){return _0x597b04[_0x21f7('0x19')](_0x1fa784)[_0x21f7('0x1b')](_0x24ce42);}};}function respondWithFilteredResult(_0x39b78c,_0x3ac592){return function(_0x3bf361){if(_0x3bf361){var _0x360547=typeof _0x3ac592[_0x21f7('0x1c')]===_0x21f7('0x1d')&&typeof _0x3ac592[_0x21f7('0x1e')]==='undefined';var _0x1785b9=_0x3bf361[_0x21f7('0x1f')];var _0x5950dd=_0x360547?0x0:_0x3ac592[_0x21f7('0x1c')];var _0x1603fc=_0x360547?_0x3bf361['count']:_0x3ac592['offset']+_0x3ac592[_0x21f7('0x1e')];var _0x3c72f1;if(_0x1603fc>=_0x1785b9){_0x1603fc=_0x1785b9;_0x3c72f1=0xc8;}else{_0x3c72f1=0xce;}_0x39b78c[_0x21f7('0x19')](_0x3c72f1);return _0x39b78c[_0x21f7('0x20')](_0x21f7('0x21'),_0x5950dd+'-'+_0x1603fc+'/'+_0x1785b9)[_0x21f7('0x1b')](_0x3bf361);}return null;};}function patchUpdates(_0x147b0d){return function(_0xdd860b){try{jsonpatch[_0x21f7('0x22')](_0xdd860b,_0x147b0d,!![]);}catch(_0x33c858){return BPromise[_0x21f7('0x23')](_0x33c858);}return _0xdd860b[_0x21f7('0x24')]();};}function saveUpdates(_0xd2637f,_0x36c203){return function(_0x2278a8){if(_0x2278a8){return _0x2278a8[_0x21f7('0x25')](_0xd2637f)[_0x21f7('0x26')](function(_0xa04849){return _0xa04849;});}return null;};}function removeEntity(_0x370bfc,_0x3b3306){return function(_0x2ee345){if(_0x2ee345){return _0x2ee345['destroy']()[_0x21f7('0x26')](function(){_0x370bfc[_0x21f7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2776c8,_0x33216c){return function(_0x3a3160){if(!_0x3a3160){_0x2776c8[_0x21f7('0x18')](0x194);}return _0x3a3160;};}function handleError(_0x34c64c,_0x2c5259){_0x2c5259=_0x2c5259||0x1f4;return function(_0x5063fc){logger[_0x21f7('0x27')](_0x5063fc[_0x21f7('0x28')]);if(_0x5063fc[_0x21f7('0x29')]){delete _0x5063fc[_0x21f7('0x29')];}_0x34c64c[_0x21f7('0x19')](_0x2c5259)[_0x21f7('0x2a')](_0x5063fc);};}exports[_0x21f7('0x2b')]=function(_0x47132e,_0x1169d2){var _0x23ac06={},_0x3cea0a={},_0x30c5f0={'count':0x0,'rows':[]};var _0x148caf=_[_0x21f7('0x2c')](db['SmsQueueReport']['rawAttributes'],function(_0x5bef02){return{'name':_0x5bef02[_0x21f7('0x2d')],'type':_0x5bef02[_0x21f7('0x2e')][_0x21f7('0x2f')]};});_0x3cea0a[_0x21f7('0x30')]=_[_0x21f7('0x2c')](_0x148caf,_0x21f7('0x29'));_0x3cea0a[_0x21f7('0x31')]=_[_0x21f7('0x32')](_0x47132e[_0x21f7('0x31')]);_0x3cea0a[_0x21f7('0x33')]=_[_0x21f7('0x34')](_0x3cea0a[_0x21f7('0x30')],_0x3cea0a[_0x21f7('0x31')]);_0x23ac06[_0x21f7('0x35')]=_[_0x21f7('0x34')](_0x3cea0a[_0x21f7('0x30')],qs['fields'](_0x47132e[_0x21f7('0x31')][_0x21f7('0x36')]));_0x23ac06[_0x21f7('0x35')]=_0x23ac06[_0x21f7('0x35')][_0x21f7('0x37')]?_0x23ac06[_0x21f7('0x35')]:_0x3cea0a[_0x21f7('0x30')];if(!_0x47132e[_0x21f7('0x31')]['hasOwnProperty'](_0x21f7('0x38'))){_0x23ac06[_0x21f7('0x1e')]=qs[_0x21f7('0x1e')](_0x47132e[_0x21f7('0x31')][_0x21f7('0x1e')]);_0x23ac06['offset']=qs[_0x21f7('0x1c')](_0x47132e[_0x21f7('0x31')][_0x21f7('0x1c')]);}_0x23ac06[_0x21f7('0x39')]=qs[_0x21f7('0x3a')](_0x47132e['query'][_0x21f7('0x3a')]);_0x23ac06[_0x21f7('0x3b')]=qs[_0x21f7('0x33')](_[_0x21f7('0x3c')](_0x47132e[_0x21f7('0x31')],_0x3cea0a[_0x21f7('0x33')]),_0x148caf);if(_0x47132e[_0x21f7('0x31')]['filter']){_0x23ac06['where']=_[_0x21f7('0x3d')](_0x23ac06['where'],{'$or':_['map'](_0x148caf,function(_0x43ee18){if(_0x43ee18[_0x21f7('0x2e')]!=='VIRTUAL'){var _0x2d6f60={};_0x2d6f60[_0x43ee18[_0x21f7('0x29')]]={'$like':'%'+_0x47132e[_0x21f7('0x31')][_0x21f7('0x3e')]+'%'};return _0x2d6f60;}})});}_0x23ac06=_[_0x21f7('0x3d')]({},_0x23ac06,_0x47132e[_0x21f7('0x3f')]);var _0x5bec7e={'where':_0x23ac06[_0x21f7('0x3b')]};return db[_0x21f7('0x40')][_0x21f7('0x1f')](_0x5bec7e)[_0x21f7('0x26')](function(_0x3d0372){_0x30c5f0[_0x21f7('0x1f')]=_0x3d0372;if(_0x47132e[_0x21f7('0x31')]['includeAll']){_0x23ac06[_0x21f7('0x41')]=[{'all':!![]}];}return db[_0x21f7('0x40')][_0x21f7('0x42')](_0x23ac06);})[_0x21f7('0x26')](function(_0x46ac56){_0x30c5f0['rows']=_0x46ac56;return _0x30c5f0;})[_0x21f7('0x26')](respondWithFilteredResult(_0x1169d2,_0x23ac06))[_0x21f7('0x43')](handleError(_0x1169d2,null));};exports[_0x21f7('0x44')]=function(_0x4b5693,_0x5f3db8){var _0x6a3717={'raw':!![],'where':{'id':_0x4b5693[_0x21f7('0x45')]['id']}},_0x32e54c={};_0x32e54c[_0x21f7('0x30')]=_[_0x21f7('0x32')](db['SmsQueueReport'][_0x21f7('0x46')]);_0x32e54c[_0x21f7('0x31')]=_['keys'](_0x4b5693['query']);_0x32e54c[_0x21f7('0x33')]=_[_0x21f7('0x34')](_0x32e54c['model'],_0x32e54c[_0x21f7('0x31')]);_0x6a3717[_0x21f7('0x35')]=_[_0x21f7('0x34')](_0x32e54c[_0x21f7('0x30')],qs[_0x21f7('0x36')](_0x4b5693[_0x21f7('0x31')][_0x21f7('0x36')]));_0x6a3717[_0x21f7('0x35')]=_0x6a3717[_0x21f7('0x35')][_0x21f7('0x37')]?_0x6a3717[_0x21f7('0x35')]:_0x32e54c[_0x21f7('0x30')];if(_0x4b5693['query'][_0x21f7('0x47')]){_0x6a3717[_0x21f7('0x41')]=[{'all':!![]}];}_0x6a3717=_[_0x21f7('0x3d')]({},_0x6a3717,_0x4b5693['options']);return db[_0x21f7('0x40')][_0x21f7('0x48')](_0x6a3717)[_0x21f7('0x26')](handleEntityNotFound(_0x5f3db8,null))[_0x21f7('0x26')](respondWithResult(_0x5f3db8,null))[_0x21f7('0x43')](handleError(_0x5f3db8,null));};exports[_0x21f7('0x49')]=function(_0x448ce6,_0x4c483b){return db['SmsQueueReport']['create'](_0x448ce6[_0x21f7('0x4a')],{})['then'](respondWithResult(_0x4c483b,0xc9))[_0x21f7('0x43')](handleError(_0x4c483b,null));};exports[_0x21f7('0x25')]=function(_0x1439ba,_0x2f25f6){if(_0x1439ba[_0x21f7('0x4a')]['id']){delete _0x1439ba[_0x21f7('0x4a')]['id'];}return db['SmsQueueReport'][_0x21f7('0x48')]({'where':{'id':_0x1439ba[_0x21f7('0x45')]['id']}})[_0x21f7('0x26')](handleEntityNotFound(_0x2f25f6,null))[_0x21f7('0x26')](saveUpdates(_0x1439ba[_0x21f7('0x4a')],null))[_0x21f7('0x26')](respondWithResult(_0x2f25f6,null))[_0x21f7('0x43')](handleError(_0x2f25f6,null));};exports[_0x21f7('0x4b')]=function(_0x4389a8,_0x376d04){return db[_0x21f7('0x40')][_0x21f7('0x48')]({'where':{'id':_0x4389a8['params']['id']}})[_0x21f7('0x26')](handleEntityNotFound(_0x376d04,null))[_0x21f7('0x26')](removeEntity(_0x376d04,null))[_0x21f7('0x43')](handleError(_0x376d04,null));};exports[_0x21f7('0x4c')]=function(_0x2c6080,_0x21278b){return db[_0x21f7('0x40')][_0x21f7('0x4c')]()['then'](respondWithResult(_0x21278b,null))[_0x21f7('0x43')](handleError(_0x21278b,null));}; \ No newline at end of file +var _0x1df4=['set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','SmsQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','catch','create','find','params','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x1df4,0x77));var _0x41df=function(_0x441b71,_0x137953){_0x441b71=_0x441b71-0x0;var _0x30691a=_0x1df4[_0x441b71];return _0x30691a;};'use strict';var emlformat=require(_0x41df('0x0'));var rimraf=require(_0x41df('0x1'));var zipdir=require(_0x41df('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x41df('0x3'));var moment=require(_0x41df('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x41df('0x5'));var util=require(_0x41df('0x6'));var path=require(_0x41df('0x7'));var sox=require(_0x41df('0x8'));var csv=require(_0x41df('0x9'));var ejs=require(_0x41df('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41df('0xb'));var squel=require(_0x41df('0xc'));var crypto=require(_0x41df('0xd'));var jsforce=require(_0x41df('0xe'));var deskjs=require(_0x41df('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x41df('0x10'));var Redis=require(_0x41df('0x11'));var authService=require(_0x41df('0x12'));var qs=require(_0x41df('0x13'));var as=require(_0x41df('0x14'));var hardwareService=require(_0x41df('0x15'));var logger=require('../../config/logger')(_0x41df('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x41df('0x17'));var db=require(_0x41df('0x18'))['db'];function respondWithStatusCode(_0x225595,_0x16daa0){_0x16daa0=_0x16daa0||0xcc;return function(_0x2dd2b1){if(_0x2dd2b1){return _0x225595[_0x41df('0x19')](_0x16daa0);}return _0x225595['status'](_0x16daa0)[_0x41df('0x1a')]();};}function respondWithResult(_0x17358a,_0x1df598){_0x1df598=_0x1df598||0xc8;return function(_0x37ae0f){if(_0x37ae0f){return _0x17358a[_0x41df('0x1b')](_0x1df598)[_0x41df('0x1c')](_0x37ae0f);}};}function respondWithFilteredResult(_0x37d04b,_0x3b73a6){return function(_0x5d579b){if(_0x5d579b){var _0x74aa9c=typeof _0x3b73a6['offset']===_0x41df('0x1d')&&typeof _0x3b73a6['limit']===_0x41df('0x1d');var _0x2a7cae=_0x5d579b[_0x41df('0x1e')];var _0x49ba86=_0x74aa9c?0x0:_0x3b73a6[_0x41df('0x1f')];var _0x27ed72=_0x74aa9c?_0x5d579b[_0x41df('0x1e')]:_0x3b73a6['offset']+_0x3b73a6[_0x41df('0x20')];var _0x2ad096;if(_0x27ed72>=_0x2a7cae){_0x27ed72=_0x2a7cae;_0x2ad096=0xc8;}else{_0x2ad096=0xce;}_0x37d04b['status'](_0x2ad096);return _0x37d04b[_0x41df('0x21')](_0x41df('0x22'),_0x49ba86+'-'+_0x27ed72+'/'+_0x2a7cae)[_0x41df('0x1c')](_0x5d579b);}return null;};}function patchUpdates(_0x520b63){return function(_0xef927d){try{jsonpatch[_0x41df('0x23')](_0xef927d,_0x520b63,!![]);}catch(_0x36f067){return BPromise[_0x41df('0x24')](_0x36f067);}return _0xef927d[_0x41df('0x25')]();};}function saveUpdates(_0x5dc0f0,_0xf6a9cd){return function(_0x490d51){if(_0x490d51){return _0x490d51[_0x41df('0x26')](_0x5dc0f0)[_0x41df('0x27')](function(_0x314c51){return _0x314c51;});}return null;};}function removeEntity(_0x4ca9d3,_0x54c1a2){return function(_0x281031){if(_0x281031){return _0x281031[_0x41df('0x28')]()[_0x41df('0x27')](function(){_0x4ca9d3[_0x41df('0x1b')](0xcc)[_0x41df('0x1a')]();});}};}function handleEntityNotFound(_0x907a0a,_0x1344ae){return function(_0x25ebb8){if(!_0x25ebb8){_0x907a0a[_0x41df('0x19')](0x194);}return _0x25ebb8;};}function handleError(_0x21bb51,_0x5e8c8c){_0x5e8c8c=_0x5e8c8c||0x1f4;return function(_0x55b70b){logger[_0x41df('0x29')](_0x55b70b['stack']);if(_0x55b70b[_0x41df('0x2a')]){delete _0x55b70b[_0x41df('0x2a')];}_0x21bb51[_0x41df('0x1b')](_0x5e8c8c)['send'](_0x55b70b);};}exports[_0x41df('0x2b')]=function(_0x233c5a,_0x1fc50d){var _0x13c14c={},_0x501c3a={},_0x3060e7={'count':0x0,'rows':[]};var _0xbbc3ff=_[_0x41df('0x2c')](db[_0x41df('0x2d')]['rawAttributes'],function(_0x24b8e5){return{'name':_0x24b8e5[_0x41df('0x2e')],'type':_0x24b8e5[_0x41df('0x2f')]['key']};});_0x501c3a[_0x41df('0x30')]=_[_0x41df('0x2c')](_0xbbc3ff,_0x41df('0x2a'));_0x501c3a[_0x41df('0x31')]=_[_0x41df('0x32')](_0x233c5a[_0x41df('0x31')]);_0x501c3a[_0x41df('0x33')]=_[_0x41df('0x34')](_0x501c3a[_0x41df('0x30')],_0x501c3a['query']);_0x13c14c[_0x41df('0x35')]=_[_0x41df('0x34')](_0x501c3a['model'],qs['fields'](_0x233c5a[_0x41df('0x31')][_0x41df('0x36')]));_0x13c14c['attributes']=_0x13c14c['attributes'][_0x41df('0x37')]?_0x13c14c[_0x41df('0x35')]:_0x501c3a[_0x41df('0x30')];if(!_0x233c5a[_0x41df('0x31')][_0x41df('0x38')](_0x41df('0x39'))){_0x13c14c[_0x41df('0x20')]=qs[_0x41df('0x20')](_0x233c5a[_0x41df('0x31')][_0x41df('0x20')]);_0x13c14c[_0x41df('0x1f')]=qs[_0x41df('0x1f')](_0x233c5a[_0x41df('0x31')][_0x41df('0x1f')]);}_0x13c14c[_0x41df('0x3a')]=qs['sort'](_0x233c5a[_0x41df('0x31')]['sort']);_0x13c14c[_0x41df('0x3b')]=qs[_0x41df('0x33')](_['pick'](_0x233c5a[_0x41df('0x31')],_0x501c3a[_0x41df('0x33')]),_0xbbc3ff);if(_0x233c5a[_0x41df('0x31')][_0x41df('0x3c')]){_0x13c14c[_0x41df('0x3b')]=_[_0x41df('0x3d')](_0x13c14c[_0x41df('0x3b')],{'$or':_[_0x41df('0x2c')](_0xbbc3ff,function(_0xa2d297){if(_0xa2d297[_0x41df('0x2f')]!==_0x41df('0x3e')){var _0x692b8={};_0x692b8[_0xa2d297['name']]={'$like':'%'+_0x233c5a[_0x41df('0x31')][_0x41df('0x3c')]+'%'};return _0x692b8;}})});}_0x13c14c=_[_0x41df('0x3d')]({},_0x13c14c,_0x233c5a[_0x41df('0x3f')]);var _0x5c0413={'where':_0x13c14c['where']};return db[_0x41df('0x2d')]['count'](_0x5c0413)['then'](function(_0x4f30a0){_0x3060e7[_0x41df('0x1e')]=_0x4f30a0;if(_0x233c5a[_0x41df('0x31')][_0x41df('0x40')]){_0x13c14c[_0x41df('0x41')]=[{'all':!![]}];}return db[_0x41df('0x2d')][_0x41df('0x42')](_0x13c14c);})['then'](function(_0x1f3d14){_0x3060e7[_0x41df('0x43')]=_0x1f3d14;return _0x3060e7;})[_0x41df('0x27')](respondWithFilteredResult(_0x1fc50d,_0x13c14c))['catch'](handleError(_0x1fc50d,null));};exports[_0x41df('0x44')]=function(_0x2a6d20,_0x5c8d51){var _0x3a8172={'raw':!![],'where':{'id':_0x2a6d20['params']['id']}},_0x3aa58d={};_0x3aa58d[_0x41df('0x30')]=_[_0x41df('0x32')](db[_0x41df('0x2d')][_0x41df('0x45')]);_0x3aa58d[_0x41df('0x31')]=_[_0x41df('0x32')](_0x2a6d20[_0x41df('0x31')]);_0x3aa58d[_0x41df('0x33')]=_[_0x41df('0x34')](_0x3aa58d[_0x41df('0x30')],_0x3aa58d['query']);_0x3a8172[_0x41df('0x35')]=_[_0x41df('0x34')](_0x3aa58d[_0x41df('0x30')],qs[_0x41df('0x36')](_0x2a6d20[_0x41df('0x31')][_0x41df('0x36')]));_0x3a8172[_0x41df('0x35')]=_0x3a8172[_0x41df('0x35')][_0x41df('0x37')]?_0x3a8172[_0x41df('0x35')]:_0x3aa58d['model'];if(_0x2a6d20['query'][_0x41df('0x40')]){_0x3a8172[_0x41df('0x41')]=[{'all':!![]}];}_0x3a8172=_['merge']({},_0x3a8172,_0x2a6d20[_0x41df('0x3f')]);return db[_0x41df('0x2d')]['find'](_0x3a8172)[_0x41df('0x27')](handleEntityNotFound(_0x5c8d51,null))[_0x41df('0x27')](respondWithResult(_0x5c8d51,null))[_0x41df('0x46')](handleError(_0x5c8d51,null));};exports[_0x41df('0x47')]=function(_0x331fba,_0x5a7398){return db[_0x41df('0x2d')][_0x41df('0x47')](_0x331fba['body'],{})[_0x41df('0x27')](respondWithResult(_0x5a7398,0xc9))[_0x41df('0x46')](handleError(_0x5a7398,null));};exports[_0x41df('0x26')]=function(_0x54132f,_0x548011){if(_0x54132f['body']['id']){delete _0x54132f['body']['id'];}return db[_0x41df('0x2d')][_0x41df('0x48')]({'where':{'id':_0x54132f[_0x41df('0x49')]['id']}})[_0x41df('0x27')](handleEntityNotFound(_0x548011,null))['then'](saveUpdates(_0x54132f[_0x41df('0x4a')],null))[_0x41df('0x27')](respondWithResult(_0x548011,null))['catch'](handleError(_0x548011,null));};exports[_0x41df('0x28')]=function(_0x183e3d,_0x3d756a){return db[_0x41df('0x2d')][_0x41df('0x48')]({'where':{'id':_0x183e3d['params']['id']}})['then'](handleEntityNotFound(_0x3d756a,null))[_0x41df('0x27')](removeEntity(_0x3d756a,null))[_0x41df('0x46')](handleError(_0x3d756a,null));};exports[_0x41df('0x4b')]=function(_0x3defa1,_0x6dc695){return db[_0x41df('0x2d')]['describe']()[_0x41df('0x27')](respondWithResult(_0x6dc695,null))[_0x41df('0x46')](handleError(_0x6dc695,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index d3f8c7c..1f58da7 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(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_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 _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x23e4c0,_0x32473b){var _0x5bc685=function(_0x381972){while(--_0x381972){_0x23e4c0['push'](_0x23e4c0['shift']());}};_0x5bc685(++_0x32473b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index e4c38fa..0771d1c 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 _0x32eb=['code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','SmsQueueReport','CreateSmsQueueReport','UpdateSmsQueueReport','update','body','options','raw','attributes','limit','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error'];(function(_0x539b3f,_0x5c3701){var _0x27c39b=function(_0x466d75){while(--_0x466d75){_0x539b3f['push'](_0x539b3f['shift']());}};_0x27c39b(++_0x5c3701);}(_0x32eb,0x1ee));var _0xb32e=function(_0x1b95a1,_0x529852){_0x1b95a1=_0x1b95a1-0x0;var _0x57aef1=_0x32eb[_0x1b95a1];return _0x57aef1;};'use strict';var _=require(_0xb32e('0x0'));var util=require(_0xb32e('0x1'));var moment=require(_0xb32e('0x2'));var BPromise=require('bluebird');var rs=require(_0xb32e('0x3'));var fs=require('fs');var Redis=require(_0xb32e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb32e('0x5'));var logger=require(_0xb32e('0x6'))(_0xb32e('0x7'));var config=require(_0xb32e('0x8'));var jayson=require(_0xb32e('0x9'));var client=jayson[_0xb32e('0xa')][_0xb32e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xba2233,_0x11a9c,_0x9cc615){return new BPromise(function(_0x56c6e1,_0x2a158f){return client[_0xb32e('0xc')](_0xba2233,_0x9cc615)[_0xb32e('0xd')](function(_0x5d4d25){logger[_0xb32e('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x11a9c,_0xb32e('0xf'));logger[_0xb32e('0x10')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x11a9c,_0xb32e('0xf'),JSON['stringify'](_0x5d4d25));if(_0x5d4d25[_0xb32e('0x11')]){if(_0x5d4d25[_0xb32e('0x11')][_0xb32e('0x12')]===0x1f4){logger[_0xb32e('0x11')](_0xb32e('0x13'),_0x11a9c,_0x5d4d25[_0xb32e('0x11')][_0xb32e('0x14')]);return _0x2a158f(_0x5d4d25[_0xb32e('0x11')][_0xb32e('0x14')]);}logger[_0xb32e('0x11')](_0xb32e('0x13'),_0x11a9c,_0x5d4d25[_0xb32e('0x11')]['message']);return _0x56c6e1(_0x5d4d25[_0xb32e('0x11')][_0xb32e('0x14')]);}else{logger['info'](_0xb32e('0x13'),_0x11a9c,_0xb32e('0xf'));_0x56c6e1(_0x5d4d25[_0xb32e('0x15')][_0xb32e('0x14')]);}})[_0xb32e('0x16')](function(_0x5db5a6){logger[_0xb32e('0x11')](_0xb32e('0x13'),_0x11a9c,_0x5db5a6);_0x2a158f(_0x5db5a6);});});}exports['CreateSmsQueueReport']=function(_0x5c93e4){var _0x52b374=this;return new Promise(function(_0x26bd90,_0x31ebf8){return db[_0xb32e('0x17')]['create'](_0x5c93e4['body'],{'raw':_0x5c93e4['options']?_0x5c93e4['options']['raw']===undefined?!![]:![]:!![]})[_0xb32e('0xd')](function(_0x5c6e70){logger['info'](_0xb32e('0x18'),_0x5c93e4);logger[_0xb32e('0x10')](_0xb32e('0x18'),_0x5c93e4,JSON['stringify'](_0x5c6e70));_0x26bd90(_0x5c6e70);})[_0xb32e('0x16')](function(_0x57fe20){logger[_0xb32e('0x11')]('CreateSmsQueueReport',_0x57fe20[_0xb32e('0x14')],_0x5c93e4);_0x31ebf8(_0x52b374[_0xb32e('0x11')](0x1f4,_0x57fe20[_0xb32e('0x14')]));});});};exports[_0xb32e('0x19')]=function(_0x97e4f3){var _0x20029e=this;return new Promise(function(_0x194adf,_0x2d8083){return db[_0xb32e('0x17')][_0xb32e('0x1a')](_0x97e4f3[_0xb32e('0x1b')],{'raw':_0x97e4f3['options']?_0x97e4f3[_0xb32e('0x1c')][_0xb32e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x97e4f3[_0xb32e('0x1c')]?_0x97e4f3[_0xb32e('0x1c')]['where']||null:null,'attributes':_0x97e4f3[_0xb32e('0x1c')]?_0x97e4f3['options'][_0xb32e('0x1e')]||null:null,'limit':_0x97e4f3[_0xb32e('0x1c')]?_0x97e4f3[_0xb32e('0x1c')][_0xb32e('0x1f')]||null:null})[_0xb32e('0xd')](function(_0x1d2cd7){logger[_0xb32e('0xe')](_0xb32e('0x19'),_0x97e4f3);logger[_0xb32e('0x10')](_0xb32e('0x19'),_0x97e4f3,JSON['stringify'](_0x1d2cd7));_0x194adf(_0x1d2cd7);})[_0xb32e('0x16')](function(_0xcf74bf){logger[_0xb32e('0x11')](_0xb32e('0x19'),_0xcf74bf[_0xb32e('0x14')],_0x97e4f3);_0x2d8083(_0x20029e[_0xb32e('0x11')](0x1f4,_0xcf74bf['message']));});});}; \ No newline at end of file +var _0xb90a=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','body','options','raw','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes'];(function(_0x2165e5,_0x353e27){var _0x3a29df=function(_0x29730d){while(--_0x29730d){_0x2165e5['push'](_0x2165e5['shift']());}};_0x3a29df(++_0x353e27);}(_0xb90a,0xf0));var _0xab90=function(_0x27d341,_0x4f5479){_0x27d341=_0x27d341-0x0;var _0x422a93=_0xb90a[_0x27d341];return _0x422a93;};'use strict';var _=require(_0xab90('0x0'));var util=require(_0xab90('0x1'));var moment=require('moment');var BPromise=require(_0xab90('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab90('0x3'));var db=require(_0xab90('0x4'))['db'];var utils=require(_0xab90('0x5'));var logger=require(_0xab90('0x6'))(_0xab90('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xab90('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58e40a,_0x46fc6d,_0x57a4df){return new BPromise(function(_0x552a3d,_0x390f56){return client[_0xab90('0x9')](_0x58e40a,_0x57a4df)[_0xab90('0xa')](function(_0x4c8c3d){logger[_0xab90('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x46fc6d,_0xab90('0xc'));logger[_0xab90('0xd')](_0xab90('0xe'),_0x46fc6d,_0xab90('0xc'),JSON[_0xab90('0xf')](_0x4c8c3d));if(_0x4c8c3d[_0xab90('0x10')]){if(_0x4c8c3d[_0xab90('0x10')]['code']===0x1f4){logger[_0xab90('0x10')](_0xab90('0x11'),_0x46fc6d,_0x4c8c3d[_0xab90('0x10')]['message']);return _0x390f56(_0x4c8c3d[_0xab90('0x10')][_0xab90('0x12')]);}logger['error'](_0xab90('0x11'),_0x46fc6d,_0x4c8c3d['error'][_0xab90('0x12')]);return _0x552a3d(_0x4c8c3d[_0xab90('0x10')]['message']);}else{logger['info'](_0xab90('0x11'),_0x46fc6d,_0xab90('0xc'));_0x552a3d(_0x4c8c3d[_0xab90('0x13')][_0xab90('0x12')]);}})[_0xab90('0x14')](function(_0x513abc){logger['error'](_0xab90('0x11'),_0x46fc6d,_0x513abc);_0x390f56(_0x513abc);});});}exports[_0xab90('0x15')]=function(_0x3f0e22){var _0x1bce88=this;return new Promise(function(_0x7b102d,_0x1fe225){return db['SmsQueueReport']['create'](_0x3f0e22[_0xab90('0x16')],{'raw':_0x3f0e22[_0xab90('0x17')]?_0x3f0e22['options'][_0xab90('0x18')]===undefined?!![]:![]:!![]})[_0xab90('0xa')](function(_0x3013ad){logger[_0xab90('0xb')](_0xab90('0x15'),_0x3f0e22);logger['debug'](_0xab90('0x15'),_0x3f0e22,JSON[_0xab90('0xf')](_0x3013ad));_0x7b102d(_0x3013ad);})[_0xab90('0x14')](function(_0x4dc351){logger['error']('CreateSmsQueueReport',_0x4dc351[_0xab90('0x12')],_0x3f0e22);_0x1fe225(_0x1bce88[_0xab90('0x10')](0x1f4,_0x4dc351[_0xab90('0x12')]));});});};exports[_0xab90('0x19')]=function(_0x3ef4bb){var _0xc2ced8=this;return new Promise(function(_0x597520,_0x529e5b){return db[_0xab90('0x1a')][_0xab90('0x1b')](_0x3ef4bb[_0xab90('0x16')],{'raw':_0x3ef4bb[_0xab90('0x17')]?_0x3ef4bb[_0xab90('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ef4bb[_0xab90('0x17')]?_0x3ef4bb['options'][_0xab90('0x1c')]||null:null,'attributes':_0x3ef4bb['options']?_0x3ef4bb[_0xab90('0x17')][_0xab90('0x1d')]||null:null,'limit':_0x3ef4bb[_0xab90('0x17')]?_0x3ef4bb[_0xab90('0x17')]['limit']||null:null})['then'](function(_0x384c29){logger[_0xab90('0xb')]('UpdateSmsQueueReport',_0x3ef4bb);logger[_0xab90('0xd')](_0xab90('0x19'),_0x3ef4bb,JSON[_0xab90('0xf')](_0x384c29));_0x597520(_0x384c29);})[_0xab90('0x14')](function(_0x2a7d32){logger[_0xab90('0x10')](_0xab90('0x19'),_0x2a7d32[_0xab90('0x12')],_0x3ef4bb);_0x529e5b(_0xc2ced8[_0xab90('0x10')](0x1f4,_0x2a7d32[_0xab90('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 9a224ff..ac921ac 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 _0x02a7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','post','put','update','destroy','exports','util','express','Router','fs-extra'];(function(_0x3baa81,_0x22e700){var _0x2e077a=function(_0x10268b){while(--_0x10268b){_0x3baa81['push'](_0x3baa81['shift']());}};_0x2e077a(++_0x22e700);}(_0x02a7,0x7a));var _0x702a=function(_0x108369,_0x5e50d9){_0x108369=_0x108369-0x0;var _0x4df9a7=_0x02a7[_0x108369];return _0x4df9a7;};'use strict';var multer=require('multer');var util=require(_0x702a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x702a('0x1'));var router=express[_0x702a('0x2')]();var fs_extra=require(_0x702a('0x3'));var auth=require(_0x702a('0x4'));var interaction=require(_0x702a('0x5'));var config=require(_0x702a('0x6'));var controller=require(_0x702a('0x7'));router['get']('/',auth[_0x702a('0x8')](),controller['index']);router[_0x702a('0x9')](_0x702a('0xa'),auth[_0x702a('0x8')](),controller[_0x702a('0xb')]);router[_0x702a('0x9')](_0x702a('0xc'),auth[_0x702a('0x8')](),controller['show']);router[_0x702a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x702a('0xe')](_0x702a('0xc'),auth[_0x702a('0x8')](),controller[_0x702a('0xf')]);router['delete'](_0x702a('0xc'),auth[_0x702a('0x8')](),controller[_0x702a('0x10')]);module[_0x702a('0x11')]=router; \ No newline at end of file +var _0xe015=['../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','describe','get','/:id','show','put','update','multer','util','path','Router','../../components/auth/service'];(function(_0x454108,_0x41f787){var _0xb86ac1=function(_0x485880){while(--_0x485880){_0x454108['push'](_0x454108['shift']());}};_0xb86ac1(++_0x41f787);}(_0xe015,0x13b));var _0x5e01=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xe015[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var path=require(_0x5e01('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e01('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5e01('0x4'));var interaction=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var controller=require(_0x5e01('0x7'));router['get']('/',auth[_0x5e01('0x8')](),controller[_0x5e01('0x9')]);router['get']('/describe',auth[_0x5e01('0x8')](),controller[_0x5e01('0xa')]);router[_0x5e01('0xb')](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller[_0x5e01('0xd')]);router['post']('/',auth[_0x5e01('0x8')](),controller['create']);router[_0x5e01('0xe')]('/:id',auth[_0x5e01('0x8')](),controller[_0x5e01('0xf')]);router['delete'](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 39266c1..2f4a9f7 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x298c4a,_0x38c569){var _0x1f0b54=function(_0x5a6ffe){while(--_0x5a6ffe){_0x298c4a['push'](_0x298c4a['shift']());}};_0x1f0b54(++_0x38c569);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x00bb[_0x5b561d];return _0x431060;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x1efa5c,_0x4deafb){var _0x4f8376=function(_0x132a82){while(--_0x132a82){_0x1efa5c['push'](_0x1efa5c['shift']());}};_0x4f8376(++_0x4deafb);}(_0x54ef,0x112));var _0xf54e=function(_0xa88782,_0x369e79){_0xa88782=_0xa88782-0x0;var _0x590843=_0x54ef[_0xa88782];return _0x590843;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 10252b2..547e790 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 _0x29c7=['destroy','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','where','merge','options','includeAll','include','rows','catch','show','length','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then'];(function(_0x576adf,_0x32b849){var _0x31f9c5=function(_0x28372f){while(--_0x28372f){_0x576adf['push'](_0x576adf['shift']());}};_0x31f9c5(++_0x32b849);}(_0x29c7,0x68));var _0x729c=function(_0xc5e77f,_0x4f377e){_0xc5e77f=_0xc5e77f-0x0;var _0x416a3d=_0x29c7[_0xc5e77f];return _0x416a3d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x729c('0x0'));var zipdir=require(_0x729c('0x1'));var jsonpatch=require(_0x729c('0x2'));var rp=require(_0x729c('0x3'));var moment=require(_0x729c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x729c('0x5'));var util=require('util');var path=require('path');var sox=require(_0x729c('0x6'));var csv=require('to-csv');var ejs=require(_0x729c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x729c('0x8'));var crypto=require('crypto');var jsforce=require(_0x729c('0x9'));var deskjs=require(_0x729c('0xa'));var toCsv=require(_0x729c('0xb'));var querystring=require(_0x729c('0xc'));var Papa=require(_0x729c('0xd'));var Redis=require(_0x729c('0xe'));var authService=require(_0x729c('0xf'));var qs=require(_0x729c('0x10'));var as=require(_0x729c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x729c('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x729c('0x13'));var db=require(_0x729c('0x14'))['db'];function respondWithStatusCode(_0x14491c,_0x41f75b){_0x41f75b=_0x41f75b||0xcc;return function(_0x3ca477){if(_0x3ca477){return _0x14491c[_0x729c('0x15')](_0x41f75b);}return _0x14491c[_0x729c('0x16')](_0x41f75b)[_0x729c('0x17')]();};}function respondWithResult(_0xf2efdd,_0x21a8bc){_0x21a8bc=_0x21a8bc||0xc8;return function(_0x3593e2){if(_0x3593e2){return _0xf2efdd['status'](_0x21a8bc)[_0x729c('0x18')](_0x3593e2);}};}function respondWithFilteredResult(_0x6eadf0,_0x2df3d2){return function(_0x2c5232){if(_0x2c5232){var _0x359e84=typeof _0x2df3d2[_0x729c('0x19')]===_0x729c('0x1a')&&typeof _0x2df3d2['limit']===_0x729c('0x1a');var _0x2861e2=_0x2c5232[_0x729c('0x1b')];var _0x17bf93=_0x359e84?0x0:_0x2df3d2['offset'];var _0x5db9e0=_0x359e84?_0x2c5232[_0x729c('0x1b')]:_0x2df3d2[_0x729c('0x19')]+_0x2df3d2[_0x729c('0x1c')];var _0x19629c;if(_0x5db9e0>=_0x2861e2){_0x5db9e0=_0x2861e2;_0x19629c=0xc8;}else{_0x19629c=0xce;}_0x6eadf0[_0x729c('0x16')](_0x19629c);return _0x6eadf0[_0x729c('0x1d')](_0x729c('0x1e'),_0x17bf93+'-'+_0x5db9e0+'/'+_0x2861e2)[_0x729c('0x18')](_0x2c5232);}return null;};}function patchUpdates(_0x16df94){return function(_0x47ed46){try{jsonpatch['apply'](_0x47ed46,_0x16df94,!![]);}catch(_0x5f4ae7){return BPromise[_0x729c('0x1f')](_0x5f4ae7);}return _0x47ed46['save']();};}function saveUpdates(_0x3615c5,_0x41e5be){return function(_0x3c0235){if(_0x3c0235){return _0x3c0235[_0x729c('0x20')](_0x3615c5)[_0x729c('0x21')](function(_0x69c89){return _0x69c89;});}return null;};}function removeEntity(_0x2a737f,_0x28ffc8){return function(_0x43f568){if(_0x43f568){return _0x43f568[_0x729c('0x22')]()[_0x729c('0x21')](function(){_0x2a737f[_0x729c('0x16')](0xcc)[_0x729c('0x17')]();});}};}function handleEntityNotFound(_0x2c6ee3,_0x4a60ca){return function(_0xb76c8a){if(!_0xb76c8a){_0x2c6ee3[_0x729c('0x15')](0x194);}return _0xb76c8a;};}function handleError(_0x206a4d,_0xc419ec){_0xc419ec=_0xc419ec||0x1f4;return function(_0x5da62c){logger['error'](_0x5da62c[_0x729c('0x23')]);if(_0x5da62c[_0x729c('0x24')]){delete _0x5da62c['name'];}_0x206a4d[_0x729c('0x16')](_0xc419ec)[_0x729c('0x25')](_0x5da62c);};}exports['index']=function(_0xdb1cfb,_0x1a6a96){var _0x31d85e={},_0x2a9972={},_0x3aab11={'count':0x0,'rows':[]};var _0x558f9f=_[_0x729c('0x26')](db[_0x729c('0x27')][_0x729c('0x28')],function(_0x224d6a){return{'name':_0x224d6a[_0x729c('0x29')],'type':_0x224d6a[_0x729c('0x2a')][_0x729c('0x2b')]};});_0x2a9972[_0x729c('0x2c')]=_[_0x729c('0x26')](_0x558f9f,_0x729c('0x24'));_0x2a9972['query']=_[_0x729c('0x2d')](_0xdb1cfb[_0x729c('0x2e')]);_0x2a9972[_0x729c('0x2f')]=_[_0x729c('0x30')](_0x2a9972['model'],_0x2a9972['query']);_0x31d85e[_0x729c('0x31')]=_[_0x729c('0x30')](_0x2a9972[_0x729c('0x2c')],qs[_0x729c('0x32')](_0xdb1cfb[_0x729c('0x2e')]['fields']));_0x31d85e[_0x729c('0x31')]=_0x31d85e[_0x729c('0x31')]['length']?_0x31d85e['attributes']:_0x2a9972[_0x729c('0x2c')];if(!_0xdb1cfb[_0x729c('0x2e')]['hasOwnProperty'](_0x729c('0x33'))){_0x31d85e[_0x729c('0x1c')]=qs[_0x729c('0x1c')](_0xdb1cfb['query'][_0x729c('0x1c')]);_0x31d85e[_0x729c('0x19')]=qs['offset'](_0xdb1cfb[_0x729c('0x2e')][_0x729c('0x19')]);}_0x31d85e[_0x729c('0x34')]=qs[_0x729c('0x35')](_0xdb1cfb[_0x729c('0x2e')][_0x729c('0x35')]);_0x31d85e['where']=qs[_0x729c('0x2f')](_[_0x729c('0x36')](_0xdb1cfb['query'],_0x2a9972[_0x729c('0x2f')]),_0x558f9f);if(_0xdb1cfb[_0x729c('0x2e')]['filter']){_0x31d85e[_0x729c('0x37')]=_[_0x729c('0x38')](_0x31d85e[_0x729c('0x37')],{'$or':_['map'](_0x558f9f,function(_0x441c0e){if(_0x441c0e['type']!=='VIRTUAL'){var _0xb531ca={};_0xb531ca[_0x441c0e[_0x729c('0x24')]]={'$like':'%'+_0xdb1cfb[_0x729c('0x2e')]['filter']+'%'};return _0xb531ca;}})});}_0x31d85e=_[_0x729c('0x38')]({},_0x31d85e,_0xdb1cfb[_0x729c('0x39')]);var _0x5ebcd5={'where':_0x31d85e['where']};return db['SmsTransferReport']['count'](_0x5ebcd5)[_0x729c('0x21')](function(_0x5d8371){_0x3aab11[_0x729c('0x1b')]=_0x5d8371;if(_0xdb1cfb[_0x729c('0x2e')][_0x729c('0x3a')]){_0x31d85e[_0x729c('0x3b')]=[{'all':!![]}];}return db[_0x729c('0x27')]['findAll'](_0x31d85e);})[_0x729c('0x21')](function(_0x5bcbb5){_0x3aab11[_0x729c('0x3c')]=_0x5bcbb5;return _0x3aab11;})['then'](respondWithFilteredResult(_0x1a6a96,_0x31d85e))[_0x729c('0x3d')](handleError(_0x1a6a96,null));};exports[_0x729c('0x3e')]=function(_0x1df2cd,_0x752e03){var _0x298950={'raw':!![],'where':{'id':_0x1df2cd['params']['id']}},_0x4336ac={};_0x4336ac['model']=_[_0x729c('0x2d')](db['SmsTransferReport'][_0x729c('0x28')]);_0x4336ac[_0x729c('0x2e')]=_['keys'](_0x1df2cd['query']);_0x4336ac['filters']=_[_0x729c('0x30')](_0x4336ac['model'],_0x4336ac[_0x729c('0x2e')]);_0x298950[_0x729c('0x31')]=_[_0x729c('0x30')](_0x4336ac['model'],qs[_0x729c('0x32')](_0x1df2cd[_0x729c('0x2e')][_0x729c('0x32')]));_0x298950[_0x729c('0x31')]=_0x298950[_0x729c('0x31')][_0x729c('0x3f')]?_0x298950[_0x729c('0x31')]:_0x4336ac['model'];if(_0x1df2cd[_0x729c('0x2e')]['includeAll']){_0x298950[_0x729c('0x3b')]=[{'all':!![]}];}_0x298950=_[_0x729c('0x38')]({},_0x298950,_0x1df2cd['options']);return db[_0x729c('0x27')][_0x729c('0x40')](_0x298950)[_0x729c('0x21')](handleEntityNotFound(_0x752e03,null))[_0x729c('0x21')](respondWithResult(_0x752e03,null))['catch'](handleError(_0x752e03,null));};exports['create']=function(_0x583e3b,_0x767588){return db[_0x729c('0x27')][_0x729c('0x41')](_0x583e3b['body'],{})['then'](respondWithResult(_0x767588,0xc9))[_0x729c('0x3d')](handleError(_0x767588,null));};exports[_0x729c('0x20')]=function(_0x7c4c0,_0x4ff382){if(_0x7c4c0['body']['id']){delete _0x7c4c0[_0x729c('0x42')]['id'];}return db[_0x729c('0x27')]['find']({'where':{'id':_0x7c4c0['params']['id']}})[_0x729c('0x21')](handleEntityNotFound(_0x4ff382,null))[_0x729c('0x21')](saveUpdates(_0x7c4c0[_0x729c('0x42')],null))['then'](respondWithResult(_0x4ff382,null))[_0x729c('0x3d')](handleError(_0x4ff382,null));};exports[_0x729c('0x22')]=function(_0x57f31f,_0x11d664){return db[_0x729c('0x27')]['find']({'where':{'id':_0x57f31f[_0x729c('0x43')]['id']}})[_0x729c('0x21')](handleEntityNotFound(_0x11d664,null))['then'](removeEntity(_0x11d664,null))[_0x729c('0x3d')](handleError(_0x11d664,null));};exports['describe']=function(_0x590d31,_0x21f361){return db[_0x729c('0x27')][_0x729c('0x44')]()[_0x729c('0x21')](respondWithResult(_0x21f361,null))[_0x729c('0x3d')](handleError(_0x21f361,null));}; \ No newline at end of file +var _0xe66b=['key','model','keys','filters','attributes','intersection','query','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','Content-Range','reject','save','then','destroy','stack','name','send','index','map','SmsTransferReport','rawAttributes','type'];(function(_0x323479,_0x321fd8){var _0x3068bf=function(_0x10f708){while(--_0x10f708){_0x323479['push'](_0x323479['shift']());}};_0x3068bf(++_0x321fd8);}(_0xe66b,0x17a));var _0xbe66=function(_0x2d5acf,_0x12ffe0){_0x2d5acf=_0x2d5acf-0x0;var _0x5de124=_0xe66b[_0x2d5acf];return _0x5de124;};'use strict';var emlformat=require(_0xbe66('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe66('0x1'));var jsonpatch=require(_0xbe66('0x2'));var rp=require(_0xbe66('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbe66('0x4'));var util=require('util');var path=require(_0xbe66('0x5'));var sox=require(_0xbe66('0x6'));var csv=require(_0xbe66('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe66('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbe66('0x9'));var jsforce=require(_0xbe66('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xbe66('0x7'));var querystring=require(_0xbe66('0xb'));var Papa=require(_0xbe66('0xc'));var Redis=require(_0xbe66('0xd'));var authService=require(_0xbe66('0xe'));var qs=require(_0xbe66('0xf'));var as=require(_0xbe66('0x10'));var hardwareService=require(_0xbe66('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xbe66('0x12'));var config=require(_0xbe66('0x13'));var licenseUtil=require(_0xbe66('0x14'));var db=require(_0xbe66('0x15'))['db'];function respondWithStatusCode(_0x59d785,_0x536218){_0x536218=_0x536218||0xcc;return function(_0x39d8f1){if(_0x39d8f1){return _0x59d785[_0xbe66('0x16')](_0x536218);}return _0x59d785[_0xbe66('0x17')](_0x536218)[_0xbe66('0x18')]();};}function respondWithResult(_0x3168a5,_0x34e9b3){_0x34e9b3=_0x34e9b3||0xc8;return function(_0x34e87f){if(_0x34e87f){return _0x3168a5[_0xbe66('0x17')](_0x34e9b3)[_0xbe66('0x19')](_0x34e87f);}};}function respondWithFilteredResult(_0x221c1e,_0x469a31){return function(_0x55a321){if(_0x55a321){var _0x445419=typeof _0x469a31['offset']==='undefined'&&typeof _0x469a31[_0xbe66('0x1a')]==='undefined';var _0x33be69=_0x55a321[_0xbe66('0x1b')];var _0x45372d=_0x445419?0x0:_0x469a31[_0xbe66('0x1c')];var _0x3faa2c=_0x445419?_0x55a321[_0xbe66('0x1b')]:_0x469a31[_0xbe66('0x1c')]+_0x469a31['limit'];var _0x479ab2;if(_0x3faa2c>=_0x33be69){_0x3faa2c=_0x33be69;_0x479ab2=0xc8;}else{_0x479ab2=0xce;}_0x221c1e['status'](_0x479ab2);return _0x221c1e['set'](_0xbe66('0x1d'),_0x45372d+'-'+_0x3faa2c+'/'+_0x33be69)[_0xbe66('0x19')](_0x55a321);}return null;};}function patchUpdates(_0x222826){return function(_0x46a726){try{jsonpatch['apply'](_0x46a726,_0x222826,!![]);}catch(_0x46c08d){return BPromise[_0xbe66('0x1e')](_0x46c08d);}return _0x46a726[_0xbe66('0x1f')]();};}function saveUpdates(_0x3c6d,_0x50aef9){return function(_0x51cb5f){if(_0x51cb5f){return _0x51cb5f['update'](_0x3c6d)[_0xbe66('0x20')](function(_0x52f323){return _0x52f323;});}return null;};}function removeEntity(_0x1f8625,_0x34076a){return function(_0x4a1ee8){if(_0x4a1ee8){return _0x4a1ee8[_0xbe66('0x21')]()[_0xbe66('0x20')](function(){_0x1f8625[_0xbe66('0x17')](0xcc)[_0xbe66('0x18')]();});}};}function handleEntityNotFound(_0x3af6ef,_0x4d1fb9){return function(_0xa1c38b){if(!_0xa1c38b){_0x3af6ef['sendStatus'](0x194);}return _0xa1c38b;};}function handleError(_0x1df144,_0x591713){_0x591713=_0x591713||0x1f4;return function(_0x124882){logger['error'](_0x124882[_0xbe66('0x22')]);if(_0x124882['name']){delete _0x124882[_0xbe66('0x23')];}_0x1df144[_0xbe66('0x17')](_0x591713)[_0xbe66('0x24')](_0x124882);};}exports[_0xbe66('0x25')]=function(_0x26802a,_0xb46ffc){var _0x5d2d54={},_0xc96767={},_0x1fa7e4={'count':0x0,'rows':[]};var _0x541491=_[_0xbe66('0x26')](db[_0xbe66('0x27')][_0xbe66('0x28')],function(_0x2253a4){return{'name':_0x2253a4['fieldName'],'type':_0x2253a4[_0xbe66('0x29')][_0xbe66('0x2a')]};});_0xc96767[_0xbe66('0x2b')]=_['map'](_0x541491,_0xbe66('0x23'));_0xc96767['query']=_[_0xbe66('0x2c')](_0x26802a['query']);_0xc96767[_0xbe66('0x2d')]=_['intersection'](_0xc96767['model'],_0xc96767['query']);_0x5d2d54[_0xbe66('0x2e')]=_[_0xbe66('0x2f')](_0xc96767[_0xbe66('0x2b')],qs['fields'](_0x26802a[_0xbe66('0x30')][_0xbe66('0x31')]));_0x5d2d54[_0xbe66('0x2e')]=_0x5d2d54['attributes'][_0xbe66('0x32')]?_0x5d2d54['attributes']:_0xc96767[_0xbe66('0x2b')];if(!_0x26802a[_0xbe66('0x30')]['hasOwnProperty'](_0xbe66('0x33'))){_0x5d2d54['limit']=qs[_0xbe66('0x1a')](_0x26802a[_0xbe66('0x30')]['limit']);_0x5d2d54[_0xbe66('0x1c')]=qs[_0xbe66('0x1c')](_0x26802a[_0xbe66('0x30')][_0xbe66('0x1c')]);}_0x5d2d54[_0xbe66('0x34')]=qs['sort'](_0x26802a[_0xbe66('0x30')][_0xbe66('0x35')]);_0x5d2d54['where']=qs['filters'](_['pick'](_0x26802a[_0xbe66('0x30')],_0xc96767[_0xbe66('0x2d')]),_0x541491);if(_0x26802a[_0xbe66('0x30')][_0xbe66('0x36')]){_0x5d2d54[_0xbe66('0x37')]=_['merge'](_0x5d2d54[_0xbe66('0x37')],{'$or':_[_0xbe66('0x26')](_0x541491,function(_0x2d9ca6){if(_0x2d9ca6[_0xbe66('0x29')]!==_0xbe66('0x38')){var _0x724c53={};_0x724c53[_0x2d9ca6[_0xbe66('0x23')]]={'$like':'%'+_0x26802a[_0xbe66('0x30')]['filter']+'%'};return _0x724c53;}})});}_0x5d2d54=_[_0xbe66('0x39')]({},_0x5d2d54,_0x26802a[_0xbe66('0x3a')]);var _0x45e8d1={'where':_0x5d2d54[_0xbe66('0x37')]};return db['SmsTransferReport'][_0xbe66('0x1b')](_0x45e8d1)[_0xbe66('0x20')](function(_0x20aca5){_0x1fa7e4[_0xbe66('0x1b')]=_0x20aca5;if(_0x26802a[_0xbe66('0x30')][_0xbe66('0x3b')]){_0x5d2d54[_0xbe66('0x3c')]=[{'all':!![]}];}return db[_0xbe66('0x27')][_0xbe66('0x3d')](_0x5d2d54);})[_0xbe66('0x20')](function(_0x9c7004){_0x1fa7e4[_0xbe66('0x3e')]=_0x9c7004;return _0x1fa7e4;})['then'](respondWithFilteredResult(_0xb46ffc,_0x5d2d54))['catch'](handleError(_0xb46ffc,null));};exports[_0xbe66('0x3f')]=function(_0x36e0b1,_0x2ee8dc){var _0x460093={'raw':!![],'where':{'id':_0x36e0b1[_0xbe66('0x40')]['id']}},_0xc33302={};_0xc33302[_0xbe66('0x2b')]=_[_0xbe66('0x2c')](db[_0xbe66('0x27')][_0xbe66('0x28')]);_0xc33302[_0xbe66('0x30')]=_[_0xbe66('0x2c')](_0x36e0b1[_0xbe66('0x30')]);_0xc33302[_0xbe66('0x2d')]=_['intersection'](_0xc33302[_0xbe66('0x2b')],_0xc33302[_0xbe66('0x30')]);_0x460093[_0xbe66('0x2e')]=_[_0xbe66('0x2f')](_0xc33302[_0xbe66('0x2b')],qs[_0xbe66('0x31')](_0x36e0b1[_0xbe66('0x30')][_0xbe66('0x31')]));_0x460093[_0xbe66('0x2e')]=_0x460093[_0xbe66('0x2e')][_0xbe66('0x32')]?_0x460093[_0xbe66('0x2e')]:_0xc33302[_0xbe66('0x2b')];if(_0x36e0b1[_0xbe66('0x30')][_0xbe66('0x3b')]){_0x460093[_0xbe66('0x3c')]=[{'all':!![]}];}_0x460093=_[_0xbe66('0x39')]({},_0x460093,_0x36e0b1['options']);return db[_0xbe66('0x27')][_0xbe66('0x41')](_0x460093)[_0xbe66('0x20')](handleEntityNotFound(_0x2ee8dc,null))[_0xbe66('0x20')](respondWithResult(_0x2ee8dc,null))[_0xbe66('0x42')](handleError(_0x2ee8dc,null));};exports[_0xbe66('0x43')]=function(_0x43dce5,_0x4e722f){return db[_0xbe66('0x27')][_0xbe66('0x43')](_0x43dce5[_0xbe66('0x44')],{})['then'](respondWithResult(_0x4e722f,0xc9))[_0xbe66('0x42')](handleError(_0x4e722f,null));};exports['update']=function(_0x63a94e,_0x533255){if(_0x63a94e['body']['id']){delete _0x63a94e[_0xbe66('0x44')]['id'];}return db[_0xbe66('0x27')][_0xbe66('0x41')]({'where':{'id':_0x63a94e['params']['id']}})[_0xbe66('0x20')](handleEntityNotFound(_0x533255,null))['then'](saveUpdates(_0x63a94e[_0xbe66('0x44')],null))[_0xbe66('0x20')](respondWithResult(_0x533255,null))['catch'](handleError(_0x533255,null));};exports['destroy']=function(_0x1da6a6,_0x50fd0a){return db['SmsTransferReport'][_0xbe66('0x41')]({'where':{'id':_0x1da6a6['params']['id']}})[_0xbe66('0x20')](handleEntityNotFound(_0x50fd0a,null))[_0xbe66('0x20')](removeEntity(_0x50fd0a,null))[_0xbe66('0x42')](handleError(_0x50fd0a,null));};exports[_0xbe66('0x45')]=function(_0x2dedeb,_0xe2a788){return db['SmsTransferReport'][_0xbe66('0x45')]()[_0xbe66('0x20')](respondWithResult(_0xe2a788,null))[_0xbe66('0x42')](handleError(_0xe2a788,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 19336b3..167727d 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 _0x1a1c=['path','rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x57ea2b,_0x459fbc){var _0x8171b9=function(_0x10723e){while(--_0x10723e){_0x57ea2b['push'](_0x57ea2b['shift']());}};_0x8171b9(++_0x459fbc);}(_0x1a1c,0xfe));var _0xc1a1=function(_0x4dbd05,_0xfcdd00){_0x4dbd05=_0x4dbd05-0x0;var _0x4b2c58=_0x1a1c[_0x4dbd05];return _0x4b2c58;};'use strict';var _=require(_0xc1a1('0x0'));var util=require(_0xc1a1('0x1'));var logger=require(_0xc1a1('0x2'))(_0xc1a1('0x3'));var moment=require('moment');var BPromise=require(_0xc1a1('0x4'));var rp=require(_0xc1a1('0x5'));var fs=require('fs');var path=require(_0xc1a1('0x6'));var rimraf=require(_0xc1a1('0x7'));var config=require(_0xc1a1('0x8'));var attributes=require(_0xc1a1('0x9'));module['exports']=function(_0x58fee4,_0x29822f){return _0x58fee4[_0xc1a1('0xa')](_0xc1a1('0xb'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xc1a1('0xc'),'fields':[_0xc1a1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f4e=['../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2b55b5,_0x78505e){var _0x103d28=function(_0x5095a2){while(--_0x5095a2){_0x2b55b5['push'](_0x2b55b5['shift']());}};_0x103d28(++_0x78505e);}(_0x8f4e,0x149));var _0xe8f4=function(_0x5dc568,_0x599a62){_0x5dc568=_0x5dc568-0x0;var _0x354212=_0x8f4e[_0x5dc568];return _0x354212;};'use strict';var _=require(_0xe8f4('0x0'));var util=require('util');var logger=require(_0xe8f4('0x1'))(_0xe8f4('0x2'));var moment=require(_0xe8f4('0x3'));var BPromise=require('bluebird');var rp=require(_0xe8f4('0x4'));var fs=require('fs');var path=require(_0xe8f4('0x5'));var rimraf=require(_0xe8f4('0x6'));var config=require(_0xe8f4('0x7'));var attributes=require(_0xe8f4('0x8'));module[_0xe8f4('0x9')]=function(_0x4d2238,_0x37c911){return _0x4d2238[_0xe8f4('0xa')](_0xe8f4('0xb'),attributes,{'tableName':_0xe8f4('0xc'),'paranoid':![],'indexes':[{'name':_0xe8f4('0xd'),'fields':[_0xe8f4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index b5930f1..441d24e 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 _0x2cd3=['request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x23b1d5,_0x3043fa){var _0x3f5702=function(_0xc9b7eb){while(--_0xc9b7eb){_0x23b1d5['push'](_0x23b1d5['shift']());}};_0x3f5702(++_0x3043fa);}(_0x2cd3,0xf1));var _0x32cd=function(_0x3f4cd0,_0x303070){_0x3f4cd0=_0x3f4cd0-0x0;var _0x3f9f01=_0x2cd3[_0x3f4cd0];return _0x3f9f01;};'use strict';var _=require(_0x32cd('0x0'));var util=require('util');var moment=require(_0x32cd('0x1'));var BPromise=require(_0x32cd('0x2'));var rs=require(_0x32cd('0x3'));var fs=require('fs');var Redis=require(_0x32cd('0x4'));var db=require(_0x32cd('0x5'))['db'];var utils=require(_0x32cd('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x32cd('0x7'));var jayson=require(_0x32cd('0x8'));var client=jayson[_0x32cd('0x9')][_0x32cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41784f,_0x43eb37,_0x1bbf19){return new BPromise(function(_0x27797f,_0x2d60fa){return client[_0x32cd('0xb')](_0x41784f,_0x1bbf19)[_0x32cd('0xc')](function(_0x192cf4){logger[_0x32cd('0xd')](_0x32cd('0xe'),_0x43eb37,_0x32cd('0xf'));logger[_0x32cd('0x10')](_0x32cd('0x11'),_0x43eb37,_0x32cd('0xf'),JSON['stringify'](_0x192cf4));if(_0x192cf4['error']){if(_0x192cf4[_0x32cd('0x12')]['code']===0x1f4){logger['error'](_0x32cd('0xe'),_0x43eb37,_0x192cf4[_0x32cd('0x12')][_0x32cd('0x13')]);return _0x2d60fa(_0x192cf4[_0x32cd('0x12')][_0x32cd('0x13')]);}logger[_0x32cd('0x12')](_0x32cd('0xe'),_0x43eb37,_0x192cf4['error']['message']);return _0x27797f(_0x192cf4[_0x32cd('0x12')][_0x32cd('0x13')]);}else{logger[_0x32cd('0xd')](_0x32cd('0xe'),_0x43eb37,'request\x20sent');_0x27797f(_0x192cf4[_0x32cd('0x14')]['message']);}})['catch'](function(_0x3de693){logger[_0x32cd('0x12')](_0x32cd('0xe'),_0x43eb37,_0x3de693);_0x2d60fa(_0x3de693);});});} \ No newline at end of file +var _0xa7dc=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x1290cd,_0x21aefa){var _0x22e1c3=function(_0x55fc23){while(--_0x55fc23){_0x1290cd['push'](_0x1290cd['shift']());}};_0x22e1c3(++_0x21aefa);}(_0xa7dc,0x11d));var _0xca7d=function(_0x3970e2,_0x131481){_0x3970e2=_0x3970e2-0x0;var _0x4e7588=_0xa7dc[_0x3970e2];return _0x4e7588;};'use strict';var _=require(_0xca7d('0x0'));var util=require(_0xca7d('0x1'));var moment=require(_0xca7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xca7d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca7d('0x4'))['db'];var utils=require(_0xca7d('0x5'));var logger=require(_0xca7d('0x6'))(_0xca7d('0x7'));var config=require(_0xca7d('0x8'));var jayson=require(_0xca7d('0x9'));var client=jayson[_0xca7d('0xa')][_0xca7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5073dd,_0x22223d,_0x820afa){return new BPromise(function(_0x4d5bc7,_0x2920bd){return client[_0xca7d('0xc')](_0x5073dd,_0x820afa)[_0xca7d('0xd')](function(_0x5236ce){logger[_0xca7d('0xe')](_0xca7d('0xf'),_0x22223d,_0xca7d('0x10'));logger[_0xca7d('0x11')](_0xca7d('0x12'),_0x22223d,'request\x20sent',JSON[_0xca7d('0x13')](_0x5236ce));if(_0x5236ce['error']){if(_0x5236ce[_0xca7d('0x14')]['code']===0x1f4){logger[_0xca7d('0x14')](_0xca7d('0xf'),_0x22223d,_0x5236ce[_0xca7d('0x14')][_0xca7d('0x15')]);return _0x2920bd(_0x5236ce['error']['message']);}logger['error'](_0xca7d('0xf'),_0x22223d,_0x5236ce[_0xca7d('0x14')][_0xca7d('0x15')]);return _0x4d5bc7(_0x5236ce[_0xca7d('0x14')][_0xca7d('0x15')]);}else{logger[_0xca7d('0xe')](_0xca7d('0xf'),_0x22223d,_0xca7d('0x10'));_0x4d5bc7(_0x5236ce[_0xca7d('0x16')][_0xca7d('0x15')]);}})[_0xca7d('0x17')](function(_0x245c7c){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x22223d,_0x245c7c);_0x2920bd(_0x245c7c);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index c16bde5..bad5d07 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 _0xd9d8=['./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','now','extname','single','create','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3477c4,_0x309176){var _0xb1b1b5=function(_0x497eeb){while(--_0x497eeb){_0x3477c4['push'](_0x3477c4['shift']());}};_0xb1b1b5(++_0x309176);}(_0xd9d8,0x1e8));var _0x8d9d=function(_0xb1bc,_0x1d3718){_0xb1bc=_0xb1bc-0x0;var _0x47ced2=_0xd9d8[_0xb1bc];return _0x47ced2;};'use strict';var multer=require(_0x8d9d('0x0'));var util=require(_0x8d9d('0x1'));var path=require(_0x8d9d('0x2'));var timeout=require(_0x8d9d('0x3'));var express=require('express');var router=express[_0x8d9d('0x4')]();var fs_extra=require(_0x8d9d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8d9d('0x6'));var config=require(_0x8d9d('0x7'));var controller=require(_0x8d9d('0x8'));router[_0x8d9d('0x9')]('/',auth['isAuthenticated'](),controller[_0x8d9d('0xa')]);router[_0x8d9d('0x9')](_0x8d9d('0xb'),auth[_0x8d9d('0xc')](),controller[_0x8d9d('0xd')]);router['get'](_0x8d9d('0xe'),auth[_0x8d9d('0xc')](),controller[_0x8d9d('0xf')]);var upload=multer({'storage':multer[_0x8d9d('0x10')]({'destination':function(_0x39296b,_0x57ceb6,_0x38d0a4){_0x38d0a4(null,path[_0x8d9d('0x11')](config[_0x8d9d('0x12')],'server/files/sounds/original/'));},'filename':function(_0x9dc44f,_0x4b2cc5,_0x9b1640){_0x4b2cc5[_0x8d9d('0x13')]=_0x4b2cc5[_0x8d9d('0x13')][_0x8d9d('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x9b1640(null,util[_0x8d9d('0x15')](_0x8d9d('0x16'),path[_0x8d9d('0x17')](_0x4b2cc5[_0x8d9d('0x13')],path['extname'](_0x4b2cc5['originalname'])),Date[_0x8d9d('0x18')](),path[_0x8d9d('0x19')](_0x4b2cc5[_0x8d9d('0x13')])));}})});router['post']('/',upload[_0x8d9d('0x1a')]('file'),controller[_0x8d9d('0x1b')]);router['put'](_0x8d9d('0xb'),auth[_0x8d9d('0xc')](),controller[_0x8d9d('0x1c')]);router[_0x8d9d('0x1d')](_0x8d9d('0xb'),auth['isAuthenticated'](),controller['delete']);module[_0x8d9d('0x1e')]=router; \ No newline at end of file +var _0x87dd=['multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','download','join','originalname','replace','%s-%s%s','extname','now','post','single','file','create','put','update','delete','exports'];(function(_0x3a0234,_0x568a58){var _0x3b6f13=function(_0x2cbc49){while(--_0x2cbc49){_0x3a0234['push'](_0x3a0234['shift']());}};_0x3b6f13(++_0x568a58);}(_0x87dd,0x104));var _0xd87d=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0x87dd[_0x1344d6];return _0xf45b24;};'use strict';var multer=require(_0xd87d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd87d('0x1'));var express=require('express');var router=express[_0xd87d('0x2')]();var fs_extra=require(_0xd87d('0x3'));var auth=require(_0xd87d('0x4'));var interaction=require(_0xd87d('0x5'));var config=require(_0xd87d('0x6'));var controller=require(_0xd87d('0x7'));router[_0xd87d('0x8')]('/',auth[_0xd87d('0x9')](),controller['index']);router[_0xd87d('0x8')](_0xd87d('0xa'),auth[_0xd87d('0x9')](),controller['show']);router[_0xd87d('0x8')]('/:id/download',auth[_0xd87d('0x9')](),controller[_0xd87d('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5a2ca4,_0x131e4e,_0xb83dd3){_0xb83dd3(null,path[_0xd87d('0xc')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x36659c,_0x5e6db2,_0xadf557){_0x5e6db2[_0xd87d('0xd')]=_0x5e6db2[_0xd87d('0xd')][_0xd87d('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xadf557(null,util['format'](_0xd87d('0xf'),path['basename'](_0x5e6db2[_0xd87d('0xd')],path[_0xd87d('0x10')](_0x5e6db2[_0xd87d('0xd')])),Date[_0xd87d('0x11')](),path[_0xd87d('0x10')](_0x5e6db2['originalname'])));}})});router[_0xd87d('0x12')]('/',upload[_0xd87d('0x13')](_0xd87d('0x14')),controller[_0xd87d('0x15')]);router[_0xd87d('0x16')]('/:id',auth[_0xd87d('0x9')](),controller[_0xd87d('0x17')]);router[_0xd87d('0x18')](_0xd87d('0xa'),auth['isAuthenticated'](),controller[_0xd87d('0x18')]);module[_0xd87d('0x19')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index c5b1d06..514464d 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 _0x7cb3=['BIGINT','sequelize','STRING','name','FLOAT','INTEGER'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x7cb3,0x145));var _0x37cb=function(_0x31a4c9,_0x5a2335){_0x31a4c9=_0x31a4c9-0x0;var _0xcaf78e=_0x7cb3[_0x31a4c9];return _0xcaf78e;};'use strict';var Sequelize=require(_0x37cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x37cb('0x1')],'unique':_0x37cb('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x37cb('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x37cb('0x1')]},'original_format':{'type':Sequelize[_0x37cb('0x1')]},'original_duration':{'type':Sequelize[_0x37cb('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x37cb('0x4')]},'original_bitRate':{'type':Sequelize[_0x37cb('0x5')]},'original_sampleRate':{'type':Sequelize[_0x37cb('0x4')]},'converted_format':{'type':Sequelize[_0x37cb('0x1')]},'converted_duration':{'type':Sequelize[_0x37cb('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x37cb('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x37cb('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x37cb('0x4')]}}; \ No newline at end of file +var _0x5c82=['BIGINT','INTEGER','sequelize','exports','STRING','FLOAT'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5c82,0x16a));var _0x25c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c82[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x25c8('0x0'));module[_0x25c8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x25c8('0x2')]},'display_name':{'type':Sequelize[_0x25c8('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x25c8('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x25c8('0x3')]},'original_sampleCount':{'type':Sequelize[_0x25c8('0x4')]},'original_channelCount':{'type':Sequelize[_0x25c8('0x5')]},'original_bitRate':{'type':Sequelize[_0x25c8('0x4')]},'original_sampleRate':{'type':Sequelize[_0x25c8('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x25c8('0x5')]},'converted_bitRate':{'type':Sequelize[_0x25c8('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x25c8('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index eba91e1..73a726a 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 _0xf7ca=['hasOwnProperty','limit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','options','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','download','format','%s.%s','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','sampleRate','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','start','update','delete','original_format','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','set','Content-Range','apply','reject','save','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length'];(function(_0x13eea8,_0x5ed8b2){var _0x255a29=function(_0x2fa27e){while(--_0x2fa27e){_0x13eea8['push'](_0x13eea8['shift']());}};_0x255a29(++_0x5ed8b2);}(_0xf7ca,0x1bc));var _0xaf7c=function(_0x37a958,_0x4046f9){_0x37a958=_0x37a958-0x0;var _0x12cb9e=_0xf7ca[_0x37a958];return _0x12cb9e;};'use strict';var emlformat=require(_0xaf7c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaf7c('0x1'));var jsonpatch=require(_0xaf7c('0x2'));var rp=require(_0xaf7c('0x3'));var moment=require('moment');var BPromise=require(_0xaf7c('0x4'));var Mustache=require('mustache');var util=require(_0xaf7c('0x5'));var path=require(_0xaf7c('0x6'));var sox=require(_0xaf7c('0x7'));var csv=require(_0xaf7c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf7c('0x9'));var _=require(_0xaf7c('0xa'));var squel=require(_0xaf7c('0xb'));var crypto=require(_0xaf7c('0xc'));var jsforce=require(_0xaf7c('0xd'));var deskjs=require(_0xaf7c('0xe'));var toCsv=require(_0xaf7c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaf7c('0xf'));var as=require(_0xaf7c('0x10'));var hardwareService=require(_0xaf7c('0x11'));var logger=require(_0xaf7c('0x12'))('api');var utils=require(_0xaf7c('0x13'));var config=require(_0xaf7c('0x14'));var licenseUtil=require(_0xaf7c('0x15'));var db=require(_0xaf7c('0x16'))['db'];function respondWithStatusCode(_0x63aeaf,_0x523383){_0x523383=_0x523383||0xcc;return function(_0xe26843){if(_0xe26843){return _0x63aeaf[_0xaf7c('0x17')](_0x523383);}return _0x63aeaf[_0xaf7c('0x18')](_0x523383)[_0xaf7c('0x19')]();};}function respondWithResult(_0x43694c,_0x540b07){_0x540b07=_0x540b07||0xc8;return function(_0x44a693){if(_0x44a693){return _0x43694c[_0xaf7c('0x18')](_0x540b07)[_0xaf7c('0x1a')](_0x44a693);}};}function respondWithFilteredResult(_0x23796f,_0x5687fc){return function(_0x46ddda){if(_0x46ddda){var _0x3b8c21=typeof _0x5687fc[_0xaf7c('0x1b')]==='undefined'&&typeof _0x5687fc['limit']==='undefined';var _0x16ee3b=_0x46ddda[_0xaf7c('0x1c')];var _0x1e8262=_0x3b8c21?0x0:_0x5687fc[_0xaf7c('0x1b')];var _0x455184=_0x3b8c21?_0x46ddda[_0xaf7c('0x1c')]:_0x5687fc[_0xaf7c('0x1b')]+_0x5687fc['limit'];var _0x39f708;if(_0x455184>=_0x16ee3b){_0x455184=_0x16ee3b;_0x39f708=0xc8;}else{_0x39f708=0xce;}_0x23796f[_0xaf7c('0x18')](_0x39f708);return _0x23796f[_0xaf7c('0x1d')](_0xaf7c('0x1e'),_0x1e8262+'-'+_0x455184+'/'+_0x16ee3b)[_0xaf7c('0x1a')](_0x46ddda);}return null;};}function patchUpdates(_0x5b7869){return function(_0x5ab717){try{jsonpatch[_0xaf7c('0x1f')](_0x5ab717,_0x5b7869,!![]);}catch(_0x2c3dbc){return BPromise[_0xaf7c('0x20')](_0x2c3dbc);}return _0x5ab717[_0xaf7c('0x21')]();};}function saveUpdates(_0x1a3598,_0x278936){return function(_0x32c0f2){if(_0x32c0f2){return _0x32c0f2['update'](_0x1a3598)[_0xaf7c('0x22')](function(_0x162857){return _0x162857;});}return null;};}function removeEntity(_0x2b98cc,_0x3c8d38){return function(_0x4bacfc){if(_0x4bacfc){return _0x4bacfc[_0xaf7c('0x23')]()[_0xaf7c('0x22')](function(){var _0x1d34cd=_0x4bacfc[_0xaf7c('0x24')]({'plain':!![]});var _0x4d545c=_0xaf7c('0x25');return db[_0xaf7c('0x26')][_0xaf7c('0x23')]({'where':{'type':_0x4d545c,'resourceId':_0x1d34cd['id']}})['then'](function(){return _0x4bacfc;});})['then'](function(){_0x2b98cc[_0xaf7c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d603b,_0x51cbb3){return function(_0x4d9ef8){if(!_0x4d9ef8){_0x2d603b[_0xaf7c('0x17')](0x194);}return _0x4d9ef8;};}function handleError(_0x34fbd2,_0x13ca07){_0x13ca07=_0x13ca07||0x1f4;return function(_0x2260e6){logger[_0xaf7c('0x27')](_0x2260e6[_0xaf7c('0x28')]);if(_0x2260e6[_0xaf7c('0x29')]){delete _0x2260e6[_0xaf7c('0x29')];}_0x34fbd2[_0xaf7c('0x18')](_0x13ca07)[_0xaf7c('0x2a')](_0x2260e6);};}exports[_0xaf7c('0x2b')]=function(_0x164dcc,_0x4faea7){var _0x50dd51={},_0x2a3cb2={},_0x389036={'count':0x0,'rows':[]};var _0x508f0f=_[_0xaf7c('0x2c')](db[_0xaf7c('0x2d')][_0xaf7c('0x2e')],function(_0x79e983){return{'name':_0x79e983[_0xaf7c('0x2f')],'type':_0x79e983['type'][_0xaf7c('0x30')]};});_0x2a3cb2[_0xaf7c('0x31')]=_[_0xaf7c('0x2c')](_0x508f0f,_0xaf7c('0x29'));_0x2a3cb2[_0xaf7c('0x32')]=_[_0xaf7c('0x33')](_0x164dcc['query']);_0x2a3cb2['filters']=_[_0xaf7c('0x34')](_0x2a3cb2[_0xaf7c('0x31')],_0x2a3cb2['query']);_0x50dd51[_0xaf7c('0x35')]=_[_0xaf7c('0x34')](_0x2a3cb2[_0xaf7c('0x31')],qs[_0xaf7c('0x36')](_0x164dcc[_0xaf7c('0x32')][_0xaf7c('0x36')]));_0x50dd51[_0xaf7c('0x35')]=_0x50dd51['attributes'][_0xaf7c('0x37')]?_0x50dd51[_0xaf7c('0x35')]:_0x2a3cb2[_0xaf7c('0x31')];if(!_0x164dcc[_0xaf7c('0x32')][_0xaf7c('0x38')]('nolimit')){_0x50dd51[_0xaf7c('0x39')]=qs[_0xaf7c('0x39')](_0x164dcc['query'][_0xaf7c('0x39')]);_0x50dd51['offset']=qs['offset'](_0x164dcc[_0xaf7c('0x32')][_0xaf7c('0x1b')]);}_0x50dd51[_0xaf7c('0x3a')]=qs[_0xaf7c('0x3b')](_0x164dcc['query'][_0xaf7c('0x3b')]);_0x50dd51[_0xaf7c('0x3c')]=qs[_0xaf7c('0x3d')](_[_0xaf7c('0x3e')](_0x164dcc['query'],_0x2a3cb2[_0xaf7c('0x3d')]),_0x508f0f);if(_0x164dcc[_0xaf7c('0x32')][_0xaf7c('0x3f')]){_0x50dd51[_0xaf7c('0x3c')]=_['merge'](_0x50dd51[_0xaf7c('0x3c')],{'$or':_[_0xaf7c('0x2c')](_0x508f0f,function(_0x427701){if(_0x427701[_0xaf7c('0x40')]!==_0xaf7c('0x41')){var _0x292795={};_0x292795[_0x427701[_0xaf7c('0x29')]]={'$like':'%'+_0x164dcc[_0xaf7c('0x32')][_0xaf7c('0x3f')]+'%'};return _0x292795;}})});}_0x50dd51=_[_0xaf7c('0x42')]({},_0x50dd51,_0x164dcc['options']);var _0x1417a3={'where':_0x50dd51[_0xaf7c('0x3c')]};return db[_0xaf7c('0x2d')][_0xaf7c('0x1c')](_0x1417a3)[_0xaf7c('0x22')](function(_0xe54019){_0x389036[_0xaf7c('0x1c')]=_0xe54019;if(_0x164dcc[_0xaf7c('0x32')][_0xaf7c('0x43')]){_0x50dd51[_0xaf7c('0x44')]=[{'all':!![]}];}return db[_0xaf7c('0x2d')][_0xaf7c('0x45')](_0x50dd51);})[_0xaf7c('0x22')](function(_0xb67ff7){_0x389036[_0xaf7c('0x46')]=_0xb67ff7;return _0x389036;})[_0xaf7c('0x22')](respondWithFilteredResult(_0x4faea7,_0x50dd51))[_0xaf7c('0x47')](handleError(_0x4faea7,null));};exports['show']=function(_0x46bb4b,_0x1530fa){var _0x5b1b07={'raw':!![],'where':{'id':_0x46bb4b[_0xaf7c('0x48')]['id']}},_0x10fbdb={};_0x10fbdb['model']=_['keys'](db[_0xaf7c('0x2d')]['rawAttributes']);_0x10fbdb[_0xaf7c('0x32')]=_[_0xaf7c('0x33')](_0x46bb4b[_0xaf7c('0x32')]);_0x10fbdb['filters']=_['intersection'](_0x10fbdb[_0xaf7c('0x31')],_0x10fbdb[_0xaf7c('0x32')]);_0x5b1b07[_0xaf7c('0x35')]=_[_0xaf7c('0x34')](_0x10fbdb[_0xaf7c('0x31')],qs[_0xaf7c('0x36')](_0x46bb4b[_0xaf7c('0x32')][_0xaf7c('0x36')]));_0x5b1b07['attributes']=_0x5b1b07[_0xaf7c('0x35')][_0xaf7c('0x37')]?_0x5b1b07[_0xaf7c('0x35')]:_0x10fbdb['model'];if(_0x46bb4b[_0xaf7c('0x32')][_0xaf7c('0x43')]){_0x5b1b07[_0xaf7c('0x44')]=[{'all':!![]}];}_0x5b1b07=_['merge']({},_0x5b1b07,_0x46bb4b[_0xaf7c('0x49')]);return db[_0xaf7c('0x2d')][_0xaf7c('0x4a')](_0x5b1b07)[_0xaf7c('0x22')](handleEntityNotFound(_0x1530fa,null))[_0xaf7c('0x22')](respondWithResult(_0x1530fa,null))[_0xaf7c('0x47')](handleError(_0x1530fa,null));};exports['download']=function(_0x75dc4b,_0x34524a,_0x3af5a9){return db[_0xaf7c('0x2d')][_0xaf7c('0x4a')]({'where':{'id':_0x75dc4b[_0xaf7c('0x48')]['id']},'attributes':[_0xaf7c('0x29'),_0xaf7c('0x4b'),_0xaf7c('0x4c')],'raw':!![]})[_0xaf7c('0x22')](handleEntityNotFound(_0x34524a,null))[_0xaf7c('0x22')](function(_0x490eaf){if(_0x490eaf){if(!fs[_0xaf7c('0x4d')](path[_0xaf7c('0x4e')](config[_0xaf7c('0x4f')],_0xaf7c('0x50'),_0x490eaf['save_name']+'.'+_0x490eaf[_0xaf7c('0x4c')]))){throw new db[(_0xaf7c('0x51'))][(_0xaf7c('0x52'))]('Sound\x20not\x20found');}return _0x34524a[_0xaf7c('0x53')](path[_0xaf7c('0x4e')](config['root'],'server/files/sounds/converted',util[_0xaf7c('0x54')](_0xaf7c('0x55'),_0x490eaf['save_name'],_0x490eaf['converted_format'])),util[_0xaf7c('0x54')](_0xaf7c('0x55'),_0x490eaf[_0xaf7c('0x29')],_0x490eaf['converted_format']));}return null;})['catch'](handleError(_0x34524a,null));};exports['create']=function(_0x46ce4d,_0x282795,_0x3e1335){var _0x5b2fbc={'name':path['basename'](_0x46ce4d[_0xaf7c('0x56')][_0xaf7c('0x57')],path[_0xaf7c('0x58')](_0x46ce4d[_0xaf7c('0x56')][_0xaf7c('0x57')])),'save_name':path[_0xaf7c('0x59')](_0x46ce4d[_0xaf7c('0x56')][_0xaf7c('0x5a')],path[_0xaf7c('0x58')](_0x46ce4d[_0xaf7c('0x56')]['filename'])),'original_format':path[_0xaf7c('0x58')](_0x46ce4d[_0xaf7c('0x56')]['originalname'])[_0xaf7c('0x5b')](0x1),'converted_format':_0xaf7c('0x5c')};var _0x25ed6a=path['join'](config[_0xaf7c('0x4f')],_0xaf7c('0x5d'),_0x46ce4d[_0xaf7c('0x56')][_0xaf7c('0x5a')]);var _0x33dbf0=path['join'](config['root'],_0xaf7c('0x50'),util['format'](_0xaf7c('0x55'),path[_0xaf7c('0x59')](_0x46ce4d['file']['filename'],path[_0xaf7c('0x58')](_0x46ce4d['file'][_0xaf7c('0x5a')])),_0x5b2fbc['converted_format']));logger[_0xaf7c('0x5e')](_0xaf7c('0x5f'),_0x25ed6a);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x33dbf0);try{fs[_0xaf7c('0x60')](_0x25ed6a,parseInt(_0xaf7c('0x61'),0x8));var _0x135fe5=sox['transcode'](_0x25ed6a,_0x33dbf0,{'sampleRate':0x1f40,'format':_0xaf7c('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x135fe5['on']('error',function(_0x5590dc){fs['unlinkSync'](_0x25ed6a);_0x282795[_0xaf7c('0x18')](0x1f4)['send'](_0x5590dc);});_0x135fe5['on'](_0xaf7c('0x62'),function(_0x39b21b){_0x5b2fbc[_0xaf7c('0x63')]=isNaN(_0x39b21b[_0xaf7c('0x64')])?null:_0x39b21b['duration']*0x3e8;_0x5b2fbc[_0xaf7c('0x65')]=isNaN(_0x39b21b['sampleCount'])?null:_0x39b21b[_0xaf7c('0x66')];_0x5b2fbc[_0xaf7c('0x67')]=isNaN(_0x39b21b[_0xaf7c('0x68')])?null:_0x39b21b['channelCount'];_0x5b2fbc[_0xaf7c('0x69')]=isNaN(_0x39b21b[_0xaf7c('0x6a')])?null:_0x39b21b[_0xaf7c('0x6a')];_0x5b2fbc['original_sampleRate']=isNaN(_0x39b21b['sampleRate'])?null:_0x39b21b['sampleRate'];});_0x135fe5['on'](_0xaf7c('0x6b'),function(_0x360ae0){_0x5b2fbc[_0xaf7c('0x6c')]=isNaN(_0x360ae0['duration'])?null:_0x360ae0['duration']*0x3e8;_0x5b2fbc[_0xaf7c('0x6d')]=isNaN(_0x360ae0[_0xaf7c('0x66')])?null:_0x360ae0[_0xaf7c('0x66')];_0x5b2fbc[_0xaf7c('0x6e')]=isNaN(_0x360ae0[_0xaf7c('0x68')])?null:_0x360ae0['channelCount'];_0x5b2fbc[_0xaf7c('0x6f')]=isNaN(_0x360ae0[_0xaf7c('0x6a')])?null:_0x360ae0[_0xaf7c('0x6a')];_0x5b2fbc[_0xaf7c('0x70')]=isNaN(_0x360ae0[_0xaf7c('0x71')])?null:_0x360ae0['sampleRate'];});_0x135fe5['on'](_0xaf7c('0x19'),function(){fs[_0xaf7c('0x60')](_0x33dbf0,parseInt(_0xaf7c('0x61'),0x8));return db[_0xaf7c('0x2d')][_0xaf7c('0x72')](_0x5b2fbc)['then'](function(_0x1c2521){var _0x383062={'role':_0x46ce4d['body']['role'],'userProfileId':_0x46ce4d[_0xaf7c('0x73')][_0xaf7c('0x74')]};if(!_0x383062)throw new Error(_0xaf7c('0x75'));if(_0x383062[_0xaf7c('0x76')]==='user'){var _0x338b2f=_0x1c2521[_0xaf7c('0x24')]({'plain':!![]});return db['UserProfileSection'][_0xaf7c('0x4a')]({'where':{'name':_0xaf7c('0x25'),'userProfileId':_0x383062['userProfileId']},'raw':!![]})[_0xaf7c('0x22')](function(_0xd7242c){if(_0xd7242c&&_0xd7242c[_0xaf7c('0x77')]===0x0){return db[_0xaf7c('0x26')][_0xaf7c('0x72')]({'name':_0x338b2f[_0xaf7c('0x29')],'resourceId':_0x338b2f['id'],'type':_0xd7242c[_0xaf7c('0x29')],'sectionId':_0xd7242c['id']},{})[_0xaf7c('0x22')](function(){return _0x1c2521;});}else{return _0x1c2521;}})['catch'](function(_0x3a97ff){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a97ff);throw _0x3a97ff;});}return _0x1c2521;})[_0xaf7c('0x22')](respondWithResult(_0x282795,null))['catch'](handleError(_0x282795,null));});_0x135fe5[_0xaf7c('0x78')]();}catch(_0xc36db1){_0x282795['status'](0x1f4)[_0xaf7c('0x2a')](_0xc36db1);}};exports[_0xaf7c('0x79')]=function(_0x25a2e0,_0x605484,_0x19bc3e){return db['Sound'][_0xaf7c('0x4a')]({'where':{'id':_0x25a2e0[_0xaf7c('0x48')]['id']}})[_0xaf7c('0x22')](handleEntityNotFound(_0x605484,null))['then'](saveUpdates(_['pick'](_0x25a2e0[_0xaf7c('0x73')],[_0xaf7c('0x29'),'description']),null))[_0xaf7c('0x22')](respondWithResult(_0x605484,null))[_0xaf7c('0x47')](handleError(_0x605484,null));};exports[_0xaf7c('0x7a')]=function(_0x4eaaa5,_0x37a5b1,_0x1693a6){return db[_0xaf7c('0x2d')]['find']({'where':{'id':_0x4eaaa5[_0xaf7c('0x48')]['id']}})[_0xaf7c('0x22')](function(_0x19bf30){if(_0x19bf30){return _0x19bf30[_0xaf7c('0x23')]();}})[_0xaf7c('0x22')](function(_0x19fbea){var _0x4a3533=path[_0xaf7c('0x4e')](config[_0xaf7c('0x4f')],_0xaf7c('0x5d'),util[_0xaf7c('0x54')](_0xaf7c('0x55'),_0x19fbea[_0xaf7c('0x4b')],_0x19fbea[_0xaf7c('0x7b')]));var _0x25ac88=path[_0xaf7c('0x4e')](config[_0xaf7c('0x4f')],_0xaf7c('0x50'),util[_0xaf7c('0x54')](_0xaf7c('0x55'),_0x19fbea[_0xaf7c('0x4b')],_0x19fbea['converted_format']));fs[_0xaf7c('0x7c')](_0x4a3533);fs['unlinkSync'](_0x25ac88);return _0x19fbea;})[_0xaf7c('0x22')](function(_0x4de120){if(_0x4de120){return _0x37a5b1[_0xaf7c('0x18')](0xcc)[_0xaf7c('0x19')]();}})[_0xaf7c('0x22')](handleEntityNotFound(_0x37a5b1,null))['catch'](handleError(_0x37a5b1,null));}; \ No newline at end of file +var _0x9d33=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','then','destroy','Sounds','UserProfileResource','stack','name','send','index','Sound','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','type','filter','options','include','findAll','rows','show','params','includeAll','merge','find','download','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','catch','create','basename','file','originalname','extname','substring','wav','filename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','error','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','start','update','description','delete','original_format','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis'];(function(_0x56a22b,_0x26ceeb){var _0x1ee847=function(_0x581b44){while(--_0x581b44){_0x56a22b['push'](_0x56a22b['shift']());}};_0x1ee847(++_0x26ceeb);}(_0x9d33,0x16c));var _0x39d3=function(_0x5315b8,_0x4501a0){_0x5315b8=_0x5315b8-0x0;var _0x4c6ffc=_0x9d33[_0x5315b8];return _0x4c6ffc;};'use strict';var emlformat=require(_0x39d3('0x0'));var rimraf=require(_0x39d3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x39d3('0x2'));var rp=require(_0x39d3('0x3'));var moment=require(_0x39d3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x39d3('0x5'));var util=require(_0x39d3('0x6'));var path=require(_0x39d3('0x7'));var sox=require(_0x39d3('0x8'));var csv=require(_0x39d3('0x9'));var ejs=require(_0x39d3('0xa'));var fs=require('fs');var fs_extra=require(_0x39d3('0xb'));var _=require(_0x39d3('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x39d3('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x39d3('0xe'));var Papa=require(_0x39d3('0xf'));var Redis=require(_0x39d3('0x10'));var authService=require(_0x39d3('0x11'));var qs=require(_0x39d3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x39d3('0x13'));var logger=require('../../config/logger')(_0x39d3('0x14'));var utils=require(_0x39d3('0x15'));var config=require(_0x39d3('0x16'));var licenseUtil=require(_0x39d3('0x17'));var db=require(_0x39d3('0x18'))['db'];function respondWithStatusCode(_0x1bf705,_0x21a4c5){_0x21a4c5=_0x21a4c5||0xcc;return function(_0x1d19be){if(_0x1d19be){return _0x1bf705[_0x39d3('0x19')](_0x21a4c5);}return _0x1bf705[_0x39d3('0x1a')](_0x21a4c5)[_0x39d3('0x1b')]();};}function respondWithResult(_0x1cb904,_0x2d0af7){_0x2d0af7=_0x2d0af7||0xc8;return function(_0x147df7){if(_0x147df7){return _0x1cb904[_0x39d3('0x1a')](_0x2d0af7)[_0x39d3('0x1c')](_0x147df7);}};}function respondWithFilteredResult(_0x49c3c3,_0x2e0b3b){return function(_0x14c466){if(_0x14c466){var _0x8d178a=typeof _0x2e0b3b[_0x39d3('0x1d')]===_0x39d3('0x1e')&&typeof _0x2e0b3b['limit']==='undefined';var _0xf827fe=_0x14c466[_0x39d3('0x1f')];var _0x2d52b5=_0x8d178a?0x0:_0x2e0b3b['offset'];var _0x26d84e=_0x8d178a?_0x14c466[_0x39d3('0x1f')]:_0x2e0b3b['offset']+_0x2e0b3b['limit'];var _0x4dac52;if(_0x26d84e>=_0xf827fe){_0x26d84e=_0xf827fe;_0x4dac52=0xc8;}else{_0x4dac52=0xce;}_0x49c3c3['status'](_0x4dac52);return _0x49c3c3[_0x39d3('0x20')](_0x39d3('0x21'),_0x2d52b5+'-'+_0x26d84e+'/'+_0xf827fe)['json'](_0x14c466);}return null;};}function patchUpdates(_0x3bea69){return function(_0x6a6780){try{jsonpatch['apply'](_0x6a6780,_0x3bea69,!![]);}catch(_0x32527f){return BPromise[_0x39d3('0x22')](_0x32527f);}return _0x6a6780[_0x39d3('0x23')]();};}function saveUpdates(_0x335d61,_0x2ddd2a){return function(_0x315d96){if(_0x315d96){return _0x315d96['update'](_0x335d61)[_0x39d3('0x24')](function(_0x5b6691){return _0x5b6691;});}return null;};}function removeEntity(_0x47068c,_0x4c9d15){return function(_0x1aaab2){if(_0x1aaab2){return _0x1aaab2[_0x39d3('0x25')]()[_0x39d3('0x24')](function(){var _0x109eaa=_0x1aaab2['get']({'plain':!![]});var _0x3fa465=_0x39d3('0x26');return db[_0x39d3('0x27')][_0x39d3('0x25')]({'where':{'type':_0x3fa465,'resourceId':_0x109eaa['id']}})['then'](function(){return _0x1aaab2;});})[_0x39d3('0x24')](function(){_0x47068c['status'](0xcc)[_0x39d3('0x1b')]();});}};}function handleEntityNotFound(_0x5b4eaf,_0x35a504){return function(_0x5be084){if(!_0x5be084){_0x5b4eaf[_0x39d3('0x19')](0x194);}return _0x5be084;};}function handleError(_0x4a032d,_0x17022b){_0x17022b=_0x17022b||0x1f4;return function(_0x5e57aa){logger['error'](_0x5e57aa[_0x39d3('0x28')]);if(_0x5e57aa[_0x39d3('0x29')]){delete _0x5e57aa[_0x39d3('0x29')];}_0x4a032d[_0x39d3('0x1a')](_0x17022b)[_0x39d3('0x2a')](_0x5e57aa);};}exports[_0x39d3('0x2b')]=function(_0xb31d7f,_0x4c1979){var _0x325d47={},_0x1e6950={},_0x14e9ff={'count':0x0,'rows':[]};var _0x49a550=_['map'](db[_0x39d3('0x2c')][_0x39d3('0x2d')],function(_0x625d6){return{'name':_0x625d6['fieldName'],'type':_0x625d6['type'][_0x39d3('0x2e')]};});_0x1e6950[_0x39d3('0x2f')]=_['map'](_0x49a550,_0x39d3('0x29'));_0x1e6950[_0x39d3('0x30')]=_[_0x39d3('0x31')](_0xb31d7f[_0x39d3('0x30')]);_0x1e6950[_0x39d3('0x32')]=_[_0x39d3('0x33')](_0x1e6950[_0x39d3('0x2f')],_0x1e6950[_0x39d3('0x30')]);_0x325d47[_0x39d3('0x34')]=_[_0x39d3('0x33')](_0x1e6950['model'],qs[_0x39d3('0x35')](_0xb31d7f[_0x39d3('0x30')][_0x39d3('0x35')]));_0x325d47['attributes']=_0x325d47[_0x39d3('0x34')][_0x39d3('0x36')]?_0x325d47[_0x39d3('0x34')]:_0x1e6950['model'];if(!_0xb31d7f[_0x39d3('0x30')][_0x39d3('0x37')](_0x39d3('0x38'))){_0x325d47[_0x39d3('0x39')]=qs[_0x39d3('0x39')](_0xb31d7f[_0x39d3('0x30')][_0x39d3('0x39')]);_0x325d47['offset']=qs[_0x39d3('0x1d')](_0xb31d7f['query']['offset']);}_0x325d47['order']=qs[_0x39d3('0x3a')](_0xb31d7f[_0x39d3('0x30')][_0x39d3('0x3a')]);_0x325d47[_0x39d3('0x3b')]=qs['filters'](_[_0x39d3('0x3c')](_0xb31d7f[_0x39d3('0x30')],_0x1e6950['filters']),_0x49a550);if(_0xb31d7f[_0x39d3('0x30')]['filter']){_0x325d47['where']=_['merge'](_0x325d47[_0x39d3('0x3b')],{'$or':_['map'](_0x49a550,function(_0x199d4a){if(_0x199d4a[_0x39d3('0x3d')]!=='VIRTUAL'){var _0x12cdf1={};_0x12cdf1[_0x199d4a[_0x39d3('0x29')]]={'$like':'%'+_0xb31d7f[_0x39d3('0x30')][_0x39d3('0x3e')]+'%'};return _0x12cdf1;}})});}_0x325d47=_['merge']({},_0x325d47,_0xb31d7f[_0x39d3('0x3f')]);var _0x4be6f6={'where':_0x325d47[_0x39d3('0x3b')]};return db[_0x39d3('0x2c')][_0x39d3('0x1f')](_0x4be6f6)[_0x39d3('0x24')](function(_0x15b2a5){_0x14e9ff['count']=_0x15b2a5;if(_0xb31d7f[_0x39d3('0x30')]['includeAll']){_0x325d47[_0x39d3('0x40')]=[{'all':!![]}];}return db[_0x39d3('0x2c')][_0x39d3('0x41')](_0x325d47);})[_0x39d3('0x24')](function(_0x3a3c56){_0x14e9ff[_0x39d3('0x42')]=_0x3a3c56;return _0x14e9ff;})[_0x39d3('0x24')](respondWithFilteredResult(_0x4c1979,_0x325d47))['catch'](handleError(_0x4c1979,null));};exports[_0x39d3('0x43')]=function(_0x329a04,_0xa01209){var _0x5e56b2={'raw':!![],'where':{'id':_0x329a04[_0x39d3('0x44')]['id']}},_0x1fbbef={};_0x1fbbef[_0x39d3('0x2f')]=_[_0x39d3('0x31')](db[_0x39d3('0x2c')][_0x39d3('0x2d')]);_0x1fbbef[_0x39d3('0x30')]=_['keys'](_0x329a04[_0x39d3('0x30')]);_0x1fbbef[_0x39d3('0x32')]=_[_0x39d3('0x33')](_0x1fbbef[_0x39d3('0x2f')],_0x1fbbef[_0x39d3('0x30')]);_0x5e56b2[_0x39d3('0x34')]=_[_0x39d3('0x33')](_0x1fbbef[_0x39d3('0x2f')],qs['fields'](_0x329a04[_0x39d3('0x30')][_0x39d3('0x35')]));_0x5e56b2[_0x39d3('0x34')]=_0x5e56b2[_0x39d3('0x34')][_0x39d3('0x36')]?_0x5e56b2[_0x39d3('0x34')]:_0x1fbbef[_0x39d3('0x2f')];if(_0x329a04[_0x39d3('0x30')][_0x39d3('0x45')]){_0x5e56b2[_0x39d3('0x40')]=[{'all':!![]}];}_0x5e56b2=_[_0x39d3('0x46')]({},_0x5e56b2,_0x329a04[_0x39d3('0x3f')]);return db['Sound'][_0x39d3('0x47')](_0x5e56b2)[_0x39d3('0x24')](handleEntityNotFound(_0xa01209,null))[_0x39d3('0x24')](respondWithResult(_0xa01209,null))['catch'](handleError(_0xa01209,null));};exports[_0x39d3('0x48')]=function(_0x4438c3,_0x387994,_0x442bf4){return db['Sound'][_0x39d3('0x47')]({'where':{'id':_0x4438c3['params']['id']},'attributes':['name',_0x39d3('0x49'),_0x39d3('0x4a')],'raw':!![]})[_0x39d3('0x24')](handleEntityNotFound(_0x387994,null))['then'](function(_0x49056e){if(_0x49056e){if(!fs['existsSync'](path[_0x39d3('0x4b')](config[_0x39d3('0x4c')],_0x39d3('0x4d'),_0x49056e[_0x39d3('0x49')]+'.'+_0x49056e[_0x39d3('0x4a')]))){throw new db[(_0x39d3('0x4e'))][(_0x39d3('0x4f'))](_0x39d3('0x50'));}return _0x387994[_0x39d3('0x48')](path[_0x39d3('0x4b')](config['root'],'server/files/sounds/converted',util['format'](_0x39d3('0x51'),_0x49056e[_0x39d3('0x49')],_0x49056e[_0x39d3('0x4a')])),util[_0x39d3('0x52')](_0x39d3('0x51'),_0x49056e[_0x39d3('0x29')],_0x49056e[_0x39d3('0x4a')]));}return null;})[_0x39d3('0x53')](handleError(_0x387994,null));};exports[_0x39d3('0x54')]=function(_0x4715c0,_0xab0b56,_0x1a0734){var _0x2fcb4b={'name':path[_0x39d3('0x55')](_0x4715c0[_0x39d3('0x56')][_0x39d3('0x57')],path[_0x39d3('0x58')](_0x4715c0[_0x39d3('0x56')]['originalname'])),'save_name':path[_0x39d3('0x55')](_0x4715c0['file']['filename'],path[_0x39d3('0x58')](_0x4715c0[_0x39d3('0x56')]['filename'])),'original_format':path[_0x39d3('0x58')](_0x4715c0[_0x39d3('0x56')]['originalname'])[_0x39d3('0x59')](0x1),'converted_format':_0x39d3('0x5a')};var _0x265867=path[_0x39d3('0x4b')](config[_0x39d3('0x4c')],'server/files/sounds/original',_0x4715c0[_0x39d3('0x56')][_0x39d3('0x5b')]);var _0xf688fc=path[_0x39d3('0x4b')](config[_0x39d3('0x4c')],_0x39d3('0x4d'),util[_0x39d3('0x52')](_0x39d3('0x51'),path[_0x39d3('0x55')](_0x4715c0[_0x39d3('0x56')]['filename'],path[_0x39d3('0x58')](_0x4715c0['file'][_0x39d3('0x5b')])),_0x2fcb4b[_0x39d3('0x4a')]));logger[_0x39d3('0x5c')](_0x39d3('0x5d'),_0x265867);logger['info'](_0x39d3('0x5e'),_0xf688fc);try{fs[_0x39d3('0x5f')](_0x265867,parseInt('0777',0x8));var _0x594bb8=sox[_0x39d3('0x60')](_0x265867,_0xf688fc,{'sampleRate':0x1f40,'format':_0x39d3('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x594bb8['on'](_0x39d3('0x61'),function(_0x4c5a2c){fs[_0x39d3('0x62')](_0x265867);_0xab0b56[_0x39d3('0x1a')](0x1f4)[_0x39d3('0x2a')](_0x4c5a2c);});_0x594bb8['on']('src',function(_0x1f9509){_0x2fcb4b[_0x39d3('0x63')]=isNaN(_0x1f9509[_0x39d3('0x64')])?null:_0x1f9509[_0x39d3('0x64')]*0x3e8;_0x2fcb4b[_0x39d3('0x65')]=isNaN(_0x1f9509[_0x39d3('0x66')])?null:_0x1f9509[_0x39d3('0x66')];_0x2fcb4b[_0x39d3('0x67')]=isNaN(_0x1f9509[_0x39d3('0x68')])?null:_0x1f9509[_0x39d3('0x68')];_0x2fcb4b['original_bitRate']=isNaN(_0x1f9509['bitRate'])?null:_0x1f9509[_0x39d3('0x69')];_0x2fcb4b['original_sampleRate']=isNaN(_0x1f9509['sampleRate'])?null:_0x1f9509[_0x39d3('0x6a')];});_0x594bb8['on'](_0x39d3('0x6b'),function(_0x5ee67a){_0x2fcb4b[_0x39d3('0x6c')]=isNaN(_0x5ee67a[_0x39d3('0x64')])?null:_0x5ee67a[_0x39d3('0x64')]*0x3e8;_0x2fcb4b[_0x39d3('0x6d')]=isNaN(_0x5ee67a[_0x39d3('0x66')])?null:_0x5ee67a['sampleCount'];_0x2fcb4b[_0x39d3('0x6e')]=isNaN(_0x5ee67a[_0x39d3('0x68')])?null:_0x5ee67a[_0x39d3('0x68')];_0x2fcb4b[_0x39d3('0x6f')]=isNaN(_0x5ee67a['bitRate'])?null:_0x5ee67a[_0x39d3('0x69')];_0x2fcb4b[_0x39d3('0x70')]=isNaN(_0x5ee67a[_0x39d3('0x6a')])?null:_0x5ee67a[_0x39d3('0x6a')];});_0x594bb8['on'](_0x39d3('0x1b'),function(){fs[_0x39d3('0x5f')](_0xf688fc,parseInt(_0x39d3('0x71'),0x8));return db[_0x39d3('0x2c')][_0x39d3('0x54')](_0x2fcb4b)[_0x39d3('0x24')](function(_0x1c5231){var _0x584c5f={'role':_0x4715c0[_0x39d3('0x72')][_0x39d3('0x73')],'userProfileId':_0x4715c0['body']['userProfileId']};if(!_0x584c5f)throw new Error(_0x39d3('0x74'));if(_0x584c5f['role']===_0x39d3('0x75')){var _0x239f44=_0x1c5231[_0x39d3('0x76')]({'plain':!![]});return db[_0x39d3('0x77')][_0x39d3('0x47')]({'where':{'name':_0x39d3('0x26'),'userProfileId':_0x584c5f[_0x39d3('0x78')]},'raw':!![]})[_0x39d3('0x24')](function(_0x464301){if(_0x464301&&_0x464301[_0x39d3('0x79')]===0x0){return db['UserProfileResource'][_0x39d3('0x54')]({'name':_0x239f44[_0x39d3('0x29')],'resourceId':_0x239f44['id'],'type':_0x464301[_0x39d3('0x29')],'sectionId':_0x464301['id']},{})[_0x39d3('0x24')](function(){return _0x1c5231;});}else{return _0x1c5231;}})[_0x39d3('0x53')](function(_0x144cd9){logger[_0x39d3('0x61')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x144cd9);throw _0x144cd9;});}return _0x1c5231;})[_0x39d3('0x24')](respondWithResult(_0xab0b56,null))['catch'](handleError(_0xab0b56,null));});_0x594bb8[_0x39d3('0x7a')]();}catch(_0x7e6c44){_0xab0b56[_0x39d3('0x1a')](0x1f4)['send'](_0x7e6c44);}};exports[_0x39d3('0x7b')]=function(_0x828442,_0x2bcc38,_0x3461a9){return db[_0x39d3('0x2c')][_0x39d3('0x47')]({'where':{'id':_0x828442['params']['id']}})[_0x39d3('0x24')](handleEntityNotFound(_0x2bcc38,null))[_0x39d3('0x24')](saveUpdates(_[_0x39d3('0x3c')](_0x828442['body'],['name',_0x39d3('0x7c')]),null))[_0x39d3('0x24')](respondWithResult(_0x2bcc38,null))['catch'](handleError(_0x2bcc38,null));};exports[_0x39d3('0x7d')]=function(_0x264c41,_0x549831,_0x45afc5){return db[_0x39d3('0x2c')][_0x39d3('0x47')]({'where':{'id':_0x264c41[_0x39d3('0x44')]['id']}})['then'](function(_0x192952){if(_0x192952){return _0x192952['destroy']();}})[_0x39d3('0x24')](function(_0x29fc8e){var _0x5d7d8c=path['join'](config[_0x39d3('0x4c')],'server/files/sounds/original',util[_0x39d3('0x52')](_0x39d3('0x51'),_0x29fc8e[_0x39d3('0x49')],_0x29fc8e[_0x39d3('0x7e')]));var _0xafd356=path[_0x39d3('0x4b')](config[_0x39d3('0x4c')],_0x39d3('0x4d'),util[_0x39d3('0x52')](_0x39d3('0x51'),_0x29fc8e[_0x39d3('0x49')],_0x29fc8e['converted_format']));fs[_0x39d3('0x62')](_0x5d7d8c);fs['unlinkSync'](_0xafd356);return _0x29fc8e;})[_0x39d3('0x24')](function(_0x5e3dbc){if(_0x5e3dbc){return _0x549831[_0x39d3('0x1a')](0xcc)[_0x39d3('0x1b')]();}})[_0x39d3('0x24')](handleEntityNotFound(_0x549831,null))['catch'](handleError(_0x549831,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 2551448..0028b0f 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 _0xf531=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds'];(function(_0x48abb2,_0x434377){var _0x8f1020=function(_0x584675){while(--_0x584675){_0x48abb2['push'](_0x48abb2['shift']());}};_0x8f1020(++_0x434377);}(_0xf531,0xb6));var _0x1f53=function(_0x3ee80f,_0x2629e6){_0x3ee80f=_0x3ee80f-0x0;var _0x2c6605=_0xf531[_0x3ee80f];return _0x2c6605;};'use strict';var _=require(_0x1f53('0x0'));var util=require(_0x1f53('0x1'));var logger=require(_0x1f53('0x2'))(_0x1f53('0x3'));var moment=require('moment');var BPromise=require(_0x1f53('0x4'));var rp=require(_0x1f53('0x5'));var fs=require('fs');var path=require(_0x1f53('0x6'));var rimraf=require(_0x1f53('0x7'));var config=require(_0x1f53('0x8'));var attributes=require(_0x1f53('0x9'));module[_0x1f53('0xa')]=function(_0x7046f5,_0x44fc76){return _0x7046f5[_0x1f53('0xb')](_0x1f53('0xc'),attributes,{'tableName':_0x1f53('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa082=['../../config/logger','api','bluebird','path','rimraf','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util'];(function(_0x2a6c09,_0x10a508){var _0x1e6fab=function(_0x38daca){while(--_0x38daca){_0x2a6c09['push'](_0x2a6c09['shift']());}};_0x1e6fab(++_0x10a508);}(_0xa082,0x18a));var _0x2a08=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa082[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x2a08('0x0'));var util=require(_0x2a08('0x1'));var logger=require(_0x2a08('0x2'))(_0x2a08('0x3'));var moment=require('moment');var BPromise=require(_0x2a08('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a08('0x5'));var rimraf=require(_0x2a08('0x6'));var config=require('../../config/environment');var attributes=require(_0x2a08('0x7'));module[_0x2a08('0x8')]=function(_0x27d9f0,_0x3b9560){return _0x27d9f0[_0x2a08('0x9')](_0x2a08('0xa'),attributes,{'tableName':_0x2a08('0xb'),'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 69e2b30..400df7f 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 _0x540e=['../../config/utils','rpc','../../config/environment','jayson/promise','http','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ShowSound','find','options','raw','where','include','model','map','attributes','then','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x48cd3b,_0x5d5909){var _0x39f6ec=function(_0xe8268){while(--_0xe8268){_0x48cd3b['push'](_0x48cd3b['shift']());}};_0x39f6ec(++_0x5d5909);}(_0x540e,0x127));var _0xe540=function(_0x1137ac,_0x353892){_0x1137ac=_0x1137ac-0x0;var _0x2ac89b=_0x540e[_0x1137ac];return _0x2ac89b;};'use strict';var _=require('lodash');var util=require(_0xe540('0x0'));var moment=require(_0xe540('0x1'));var BPromise=require('bluebird');var rs=require(_0xe540('0x2'));var fs=require('fs');var Redis=require(_0xe540('0x3'));var db=require(_0xe540('0x4'))['db'];var utils=require(_0xe540('0x5'));var logger=require('../../config/logger')(_0xe540('0x6'));var config=require(_0xe540('0x7'));var jayson=require(_0xe540('0x8'));var client=jayson['client'][_0xe540('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c8f5b,_0x427d05,_0x43014f){return new BPromise(function(_0x5a6a45,_0x54a823){return client['request'](_0x3c8f5b,_0x43014f)['then'](function(_0x5b63e1){logger[_0xe540('0xa')](_0xe540('0xb'),_0x427d05,'request\x20sent');logger[_0xe540('0xc')](_0xe540('0xd'),_0x427d05,_0xe540('0xe'),JSON[_0xe540('0xf')](_0x5b63e1));if(_0x5b63e1[_0xe540('0x10')]){if(_0x5b63e1[_0xe540('0x10')][_0xe540('0x11')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x427d05,_0x5b63e1['error'][_0xe540('0x12')]);return _0x54a823(_0x5b63e1[_0xe540('0x10')][_0xe540('0x12')]);}logger[_0xe540('0x10')](_0xe540('0xb'),_0x427d05,_0x5b63e1[_0xe540('0x10')][_0xe540('0x12')]);return _0x5a6a45(_0x5b63e1[_0xe540('0x10')]['message']);}else{logger['info'](_0xe540('0xb'),_0x427d05,'request\x20sent');_0x5a6a45(_0x5b63e1['result'][_0xe540('0x12')]);}})[_0xe540('0x13')](function(_0x59ab88){logger[_0xe540('0x10')]('Sound,\x20%s,\x20%s',_0x427d05,_0x59ab88);_0x54a823(_0x59ab88);});});}exports[_0xe540('0x14')]=function(_0x39a01b){var _0x19658a=this;return new Promise(function(_0x448c94,_0x364d42){return db['Sound'][_0xe540('0x15')]({'raw':_0x39a01b['options']?_0x39a01b[_0xe540('0x16')][_0xe540('0x17')]===undefined?!![]:![]:!![],'where':_0x39a01b[_0xe540('0x16')]?_0x39a01b[_0xe540('0x16')][_0xe540('0x18')]||null:null,'attributes':_0x39a01b[_0xe540('0x16')]?_0x39a01b[_0xe540('0x16')]['attributes']||null:null,'include':_0x39a01b[_0xe540('0x16')]?_0x39a01b[_0xe540('0x16')]['include']?_['map'](_0x39a01b[_0xe540('0x16')][_0xe540('0x19')],function(_0x1ca256){return{'model':db[_0x1ca256[_0xe540('0x1a')]],'as':_0x1ca256['as'],'attributes':_0x1ca256['attributes'],'include':_0x1ca256['include']?_[_0xe540('0x1b')](_0x1ca256[_0xe540('0x19')],function(_0x2c4e82){return{'model':db[_0x2c4e82[_0xe540('0x1a')]],'as':_0x2c4e82['as'],'attributes':_0x2c4e82['attributes'],'include':_0x2c4e82['include']?_[_0xe540('0x1b')](_0x2c4e82['include'],function(_0x205099){return{'model':db[_0x205099[_0xe540('0x1a')]],'as':_0x205099['as'],'attributes':_0x205099[_0xe540('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe540('0x1d')](function(_0x193399){logger[_0xe540('0xa')]('ShowSound',_0x39a01b);logger[_0xe540('0xc')](_0xe540('0x14'),_0x39a01b,JSON[_0xe540('0xf')](_0x193399));_0x448c94(_0x193399);})[_0xe540('0x13')](function(_0x280336){logger[_0xe540('0x10')](_0xe540('0x14'),_0x280336[_0xe540('0x12')],_0x39a01b);_0x364d42(_0x19658a['error'](0x1f4,_0x280336[_0xe540('0x12')]));});});}; \ No newline at end of file +var _0x93c3=['../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','message','result','ShowSound','Sound','find','options','where','map','include','model','attributes','debug','stringify','catch','util','randomstring','ioredis','rpc'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x93c3,0x114));var _0x393c=function(_0x1e5f54,_0x3e165a){_0x1e5f54=_0x1e5f54-0x0;var _0xe3fb73=_0x93c3[_0x1e5f54];return _0xe3fb73;};'use strict';var _=require('lodash');var util=require(_0x393c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x393c('0x1'));var fs=require('fs');var Redis=require(_0x393c('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x393c('0x3'));var config=require(_0x393c('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x393c('0x5')][_0x393c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2ed830,_0x414e2f,_0x11c73d){return new BPromise(function(_0x28a2df,_0x49db85){return client[_0x393c('0x7')](_0x2ed830,_0x11c73d)[_0x393c('0x8')](function(_0x498748){logger[_0x393c('0x9')](_0x393c('0xa'),_0x414e2f,_0x393c('0xb'));logger['debug'](_0x393c('0xc'),_0x414e2f,'request\x20sent',JSON['stringify'](_0x498748));if(_0x498748[_0x393c('0xd')]){if(_0x498748['error']['code']===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x414e2f,_0x498748[_0x393c('0xd')][_0x393c('0xe')]);return _0x49db85(_0x498748[_0x393c('0xd')]['message']);}logger[_0x393c('0xd')]('Sound,\x20%s,\x20%s',_0x414e2f,_0x498748[_0x393c('0xd')][_0x393c('0xe')]);return _0x28a2df(_0x498748[_0x393c('0xd')][_0x393c('0xe')]);}else{logger[_0x393c('0x9')](_0x393c('0xa'),_0x414e2f,'request\x20sent');_0x28a2df(_0x498748[_0x393c('0xf')][_0x393c('0xe')]);}})['catch'](function(_0x4407ef){logger['error'](_0x393c('0xa'),_0x414e2f,_0x4407ef);_0x49db85(_0x4407ef);});});}exports[_0x393c('0x10')]=function(_0x1c4d4d){var _0xbbcf26=this;return new Promise(function(_0x435e5f,_0x5dbed6){return db[_0x393c('0x11')][_0x393c('0x12')]({'raw':_0x1c4d4d[_0x393c('0x13')]?_0x1c4d4d['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c4d4d[_0x393c('0x13')]?_0x1c4d4d[_0x393c('0x13')][_0x393c('0x14')]||null:null,'attributes':_0x1c4d4d['options']?_0x1c4d4d[_0x393c('0x13')]['attributes']||null:null,'include':_0x1c4d4d[_0x393c('0x13')]?_0x1c4d4d[_0x393c('0x13')]['include']?_[_0x393c('0x15')](_0x1c4d4d[_0x393c('0x13')][_0x393c('0x16')],function(_0x415497){return{'model':db[_0x415497[_0x393c('0x17')]],'as':_0x415497['as'],'attributes':_0x415497[_0x393c('0x18')],'include':_0x415497['include']?_[_0x393c('0x15')](_0x415497[_0x393c('0x16')],function(_0x3548ca){return{'model':db[_0x3548ca[_0x393c('0x17')]],'as':_0x3548ca['as'],'attributes':_0x3548ca[_0x393c('0x18')],'include':_0x3548ca[_0x393c('0x16')]?_['map'](_0x3548ca[_0x393c('0x16')],function(_0x594876){return{'model':db[_0x594876[_0x393c('0x17')]],'as':_0x594876['as'],'attributes':_0x594876[_0x393c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x393c('0x8')](function(_0x11a98c){logger['info']('ShowSound',_0x1c4d4d);logger[_0x393c('0x19')](_0x393c('0x10'),_0x1c4d4d,JSON[_0x393c('0x1a')](_0x11a98c));_0x435e5f(_0x11a98c);})[_0x393c('0x1b')](function(_0x57d977){logger[_0x393c('0xd')]('ShowSound',_0x57d977[_0x393c('0xe')],_0x1c4d4d);_0x5dbed6(_0xbbcf26[_0x393c('0xd')](0x1f4,_0x57d977[_0x393c('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index dedaf2b..bd6f227 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 _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x111ccc,_0x4f5094){var _0x5bd2a5=function(_0x3a31dd){while(--_0x3a31dd){_0x111ccc['push'](_0x111ccc['shift']());}};_0x5bd2a5(++_0x4f5094);}(_0x4fc2,0x111));var _0x24fc=function(_0xbcd8d9,_0x16451e){_0xbcd8d9=_0xbcd8d9-0x0;var _0x4e7d8f=_0x4fc2[_0xbcd8d9];return _0x4e7d8f;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file +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(_0x48f2b7,_0x40f214){var _0x54506f=function(_0x193c0a){while(--_0x193c0a){_0x48f2b7['push'](_0x48f2b7['shift']());}};_0x54506f(++_0x40f214);}(_0x2032,0xd9));var _0x2203=function(_0x2dcdf2,_0x3e8c81){_0x2dcdf2=_0x2dcdf2-0x0;var _0x53da97=_0x2032[_0x2dcdf2];return _0x53da97;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index cdba5e6..b87e894 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 _0xbdeb=['sequelize','exports','STRING','ENUM','out'];(function(_0x585d5d,_0x430011){var _0x1260d4=function(_0x4eca80){while(--_0x4eca80){_0x585d5d['push'](_0x585d5d['shift']());}};_0x1260d4(++_0x430011);}(_0xbdeb,0x18b));var _0xbbde=function(_0x2329f8,_0x3bbf48){_0x2329f8=_0x2329f8-0x0;var _0x287755=_0xbdeb[_0x2329f8];return _0x287755;};'use strict';var Sequelize=require(_0xbbde('0x0'));module[_0xbbde('0x1')]={'uniqueid':{'type':Sequelize[_0xbbde('0x2')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xbbde('0x3')]('in',_0xbbde('0x4')),'defaultValue':_0xbbde('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9aab=['sequelize','STRING','TEXT','ENUM','out'];(function(_0x1a8d04,_0xa353b5){var _0x22b930=function(_0x212136){while(--_0x212136){_0x1a8d04['push'](_0x1a8d04['shift']());}};_0x22b930(++_0xa353b5);}(_0x9aab,0x177));var _0xb9aa=function(_0x1b9cba,_0x24af7d){_0x1b9cba=_0x1b9cba-0x0;var _0x3e68a0=_0x9aab[_0x1b9cba];return _0x3e68a0;};'use strict';var Sequelize=require(_0xb9aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb9aa('0x1')]},'body':{'type':Sequelize[_0xb9aa('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xb9aa('0x3')]('in','out'),'defaultValue':_0xb9aa('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xb9aa('0x1')]},'providerResponse':{'type':Sequelize[_0xb9aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index ed9e5dc..83caa72 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 _0x2581=['save','update','destroy','then','error','name','send','map','SquareMessage','rawAttributes','fieldName','key','model','attributes','intersection','fields','query','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','keys','length','find','create','body','params','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x336a3f,_0x2bca8d){var _0x214ede=function(_0x2b776e){while(--_0x2b776e){_0x336a3f['push'](_0x336a3f['shift']());}};_0x214ede(++_0x2bca8d);}(_0x2581,0x72));var _0x1258=function(_0xc09131,_0x4f9acd){_0xc09131=_0xc09131-0x0;var _0x5c1f50=_0x2581[_0xc09131];return _0x5c1f50;};'use strict';var emlformat=require(_0x1258('0x0'));var rimraf=require(_0x1258('0x1'));var zipdir=require(_0x1258('0x2'));var jsonpatch=require(_0x1258('0x3'));var rp=require(_0x1258('0x4'));var moment=require(_0x1258('0x5'));var BPromise=require(_0x1258('0x6'));var Mustache=require(_0x1258('0x7'));var util=require(_0x1258('0x8'));var path=require(_0x1258('0x9'));var sox=require('sox');var csv=require(_0x1258('0xa'));var ejs=require(_0x1258('0xb'));var fs=require('fs');var fs_extra=require(_0x1258('0xc'));var _=require(_0x1258('0xd'));var squel=require(_0x1258('0xe'));var crypto=require(_0x1258('0xf'));var jsforce=require(_0x1258('0x10'));var deskjs=require(_0x1258('0x11'));var toCsv=require(_0x1258('0xa'));var querystring=require(_0x1258('0x12'));var Papa=require('papaparse');var Redis=require(_0x1258('0x13'));var authService=require(_0x1258('0x14'));var qs=require(_0x1258('0x15'));var as=require(_0x1258('0x16'));var hardwareService=require(_0x1258('0x17'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1258('0x18'));var licenseUtil=require(_0x1258('0x19'));var db=require(_0x1258('0x1a'))['db'];function respondWithStatusCode(_0xba91e2,_0x142f95){_0x142f95=_0x142f95||0xcc;return function(_0x4c6e14){if(_0x4c6e14){return _0xba91e2[_0x1258('0x1b')](_0x142f95);}return _0xba91e2[_0x1258('0x1c')](_0x142f95)['end']();};}function respondWithResult(_0xb93845,_0x2b7b5c){_0x2b7b5c=_0x2b7b5c||0xc8;return function(_0xf8f5be){if(_0xf8f5be){return _0xb93845[_0x1258('0x1c')](_0x2b7b5c)[_0x1258('0x1d')](_0xf8f5be);}};}function respondWithFilteredResult(_0x5b51f3,_0x2e1069){return function(_0x33c34a){if(_0x33c34a){var _0xe61944=typeof _0x2e1069[_0x1258('0x1e')]===_0x1258('0x1f')&&typeof _0x2e1069[_0x1258('0x20')]==='undefined';var _0x162315=_0x33c34a['count'];var _0x38605b=_0xe61944?0x0:_0x2e1069[_0x1258('0x1e')];var _0x297108=_0xe61944?_0x33c34a[_0x1258('0x21')]:_0x2e1069['offset']+_0x2e1069[_0x1258('0x20')];var _0x11b4e4;if(_0x297108>=_0x162315){_0x297108=_0x162315;_0x11b4e4=0xc8;}else{_0x11b4e4=0xce;}_0x5b51f3['status'](_0x11b4e4);return _0x5b51f3[_0x1258('0x22')](_0x1258('0x23'),_0x38605b+'-'+_0x297108+'/'+_0x162315)[_0x1258('0x1d')](_0x33c34a);}return null;};}function patchUpdates(_0x1cb060){return function(_0x5928f3){try{jsonpatch[_0x1258('0x24')](_0x5928f3,_0x1cb060,!![]);}catch(_0x4f1d41){return BPromise[_0x1258('0x25')](_0x4f1d41);}return _0x5928f3[_0x1258('0x26')]();};}function saveUpdates(_0x46700c,_0x190489){return function(_0x3e541d){if(_0x3e541d){return _0x3e541d[_0x1258('0x27')](_0x46700c)['then'](function(_0x4bb110){return _0x4bb110;});}return null;};}function removeEntity(_0x850c24,_0x204c26){return function(_0x4a468a){if(_0x4a468a){return _0x4a468a[_0x1258('0x28')]()[_0x1258('0x29')](function(){_0x850c24[_0x1258('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a5a96,_0x5524bf){return function(_0x2aa934){if(!_0x2aa934){_0x4a5a96[_0x1258('0x1b')](0x194);}return _0x2aa934;};}function handleError(_0x261b39,_0x554df4){_0x554df4=_0x554df4||0x1f4;return function(_0xb84c8c){logger[_0x1258('0x2a')](_0xb84c8c['stack']);if(_0xb84c8c[_0x1258('0x2b')]){delete _0xb84c8c[_0x1258('0x2b')];}_0x261b39[_0x1258('0x1c')](_0x554df4)[_0x1258('0x2c')](_0xb84c8c);};}exports['index']=function(_0x14b023,_0xe097e9){var _0x9d470d={},_0x59e40b={},_0x4f85fd={'count':0x0,'rows':[]};var _0x540295=_[_0x1258('0x2d')](db[_0x1258('0x2e')][_0x1258('0x2f')],function(_0x15b5d6){return{'name':_0x15b5d6[_0x1258('0x30')],'type':_0x15b5d6['type'][_0x1258('0x31')]};});_0x59e40b[_0x1258('0x32')]=_['map'](_0x540295,'name');_0x59e40b['query']=_['keys'](_0x14b023['query']);_0x59e40b['filters']=_['intersection'](_0x59e40b['model'],_0x59e40b['query']);_0x9d470d[_0x1258('0x33')]=_[_0x1258('0x34')](_0x59e40b[_0x1258('0x32')],qs[_0x1258('0x35')](_0x14b023[_0x1258('0x36')][_0x1258('0x35')]));_0x9d470d[_0x1258('0x33')]=_0x9d470d[_0x1258('0x33')]['length']?_0x9d470d[_0x1258('0x33')]:_0x59e40b['model'];if(!_0x14b023[_0x1258('0x36')][_0x1258('0x37')](_0x1258('0x38'))){_0x9d470d[_0x1258('0x20')]=qs[_0x1258('0x20')](_0x14b023['query'][_0x1258('0x20')]);_0x9d470d['offset']=qs['offset'](_0x14b023[_0x1258('0x36')][_0x1258('0x1e')]);}_0x9d470d[_0x1258('0x39')]=qs[_0x1258('0x3a')](_0x14b023['query'][_0x1258('0x3a')]);_0x9d470d[_0x1258('0x3b')]=qs[_0x1258('0x3c')](_['pick'](_0x14b023[_0x1258('0x36')],_0x59e40b['filters']),_0x540295);if(_0x14b023['query'][_0x1258('0x3d')]){_0x9d470d['where']=_[_0x1258('0x3e')](_0x9d470d[_0x1258('0x3b')],{'$or':_[_0x1258('0x2d')](_0x540295,function(_0x32a79d){if(_0x32a79d[_0x1258('0x3f')]!==_0x1258('0x40')){var _0x568da9={};_0x568da9[_0x32a79d[_0x1258('0x2b')]]={'$like':'%'+_0x14b023[_0x1258('0x36')][_0x1258('0x3d')]+'%'};return _0x568da9;}})});}_0x9d470d=_[_0x1258('0x3e')]({},_0x9d470d,_0x14b023[_0x1258('0x41')]);var _0x1fbd28={'where':_0x9d470d['where']};return db[_0x1258('0x2e')]['count'](_0x1fbd28)[_0x1258('0x29')](function(_0x262c60){_0x4f85fd[_0x1258('0x21')]=_0x262c60;if(_0x14b023[_0x1258('0x36')][_0x1258('0x42')]){_0x9d470d[_0x1258('0x43')]=[{'all':!![]}];}return db[_0x1258('0x2e')][_0x1258('0x44')](_0x9d470d);})[_0x1258('0x29')](function(_0x596c8b){_0x4f85fd['rows']=_0x596c8b;return _0x4f85fd;})[_0x1258('0x29')](respondWithFilteredResult(_0xe097e9,_0x9d470d))[_0x1258('0x45')](handleError(_0xe097e9,null));};exports['show']=function(_0x285c7e,_0x2c98e0){var _0x489732={'raw':!![],'where':{'id':_0x285c7e['params']['id']}},_0x31e6a4={};_0x31e6a4[_0x1258('0x32')]=_[_0x1258('0x46')](db['SquareMessage'][_0x1258('0x2f')]);_0x31e6a4[_0x1258('0x36')]=_['keys'](_0x285c7e[_0x1258('0x36')]);_0x31e6a4['filters']=_[_0x1258('0x34')](_0x31e6a4['model'],_0x31e6a4[_0x1258('0x36')]);_0x489732[_0x1258('0x33')]=_[_0x1258('0x34')](_0x31e6a4['model'],qs[_0x1258('0x35')](_0x285c7e[_0x1258('0x36')][_0x1258('0x35')]));_0x489732[_0x1258('0x33')]=_0x489732[_0x1258('0x33')][_0x1258('0x47')]?_0x489732[_0x1258('0x33')]:_0x31e6a4[_0x1258('0x32')];if(_0x285c7e[_0x1258('0x36')]['includeAll']){_0x489732[_0x1258('0x43')]=[{'all':!![]}];}_0x489732=_[_0x1258('0x3e')]({},_0x489732,_0x285c7e['options']);return db[_0x1258('0x2e')][_0x1258('0x48')](_0x489732)[_0x1258('0x29')](handleEntityNotFound(_0x2c98e0,null))['then'](respondWithResult(_0x2c98e0,null))[_0x1258('0x45')](handleError(_0x2c98e0,null));};exports[_0x1258('0x49')]=function(_0x262c15,_0x5747fd){return db[_0x1258('0x2e')][_0x1258('0x49')](_0x262c15[_0x1258('0x4a')],{})[_0x1258('0x29')](respondWithResult(_0x5747fd,0xc9))[_0x1258('0x45')](handleError(_0x5747fd,null));};exports['update']=function(_0x3eb3d5,_0x1ae376){if(_0x3eb3d5['body']['id']){delete _0x3eb3d5['body']['id'];}return db['SquareMessage']['find']({'where':{'id':_0x3eb3d5[_0x1258('0x4b')]['id']}})[_0x1258('0x29')](handleEntityNotFound(_0x1ae376,null))[_0x1258('0x29')](saveUpdates(_0x3eb3d5[_0x1258('0x4a')],null))[_0x1258('0x29')](respondWithResult(_0x1ae376,null))[_0x1258('0x45')](handleError(_0x1ae376,null));};exports[_0x1258('0x28')]=function(_0x1fad57,_0x4dfc64){return db[_0x1258('0x2e')][_0x1258('0x48')]({'where':{'id':_0x1fad57[_0x1258('0x4b')]['id']}})[_0x1258('0x29')](handleEntityNotFound(_0x4dfc64,null))['then'](removeEntity(_0x4dfc64,null))['catch'](handleError(_0x4dfc64,null));}; \ No newline at end of file +var _0xe3cc=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','length','hasOwnProperty','nolimit','sort','pick','filter','VIRTUAL','merge','where','SquareMessage','then','includeAll','include','rows','catch','show','fields','options','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5a3f92,_0x23e7df){var _0x467063=function(_0x387be4){while(--_0x387be4){_0x5a3f92['push'](_0x5a3f92['shift']());}};_0x467063(++_0x23e7df);}(_0xe3cc,0x122));var _0xce3c=function(_0x4ace43,_0x282aa5){_0x4ace43=_0x4ace43-0x0;var _0x1f56e0=_0xe3cc[_0x4ace43];return _0x1f56e0;};'use strict';var emlformat=require(_0xce3c('0x0'));var rimraf=require(_0xce3c('0x1'));var zipdir=require(_0xce3c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce3c('0x3'));var moment=require(_0xce3c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xce3c('0x5'));var util=require(_0xce3c('0x6'));var path=require(_0xce3c('0x7'));var sox=require(_0xce3c('0x8'));var csv=require(_0xce3c('0x9'));var ejs=require(_0xce3c('0xa'));var fs=require('fs');var fs_extra=require(_0xce3c('0xb'));var _=require(_0xce3c('0xc'));var squel=require('squel');var crypto=require(_0xce3c('0xd'));var jsforce=require(_0xce3c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xce3c('0x9'));var querystring=require(_0xce3c('0xf'));var Papa=require(_0xce3c('0x10'));var Redis=require('ioredis');var authService=require(_0xce3c('0x11'));var qs=require(_0xce3c('0x12'));var as=require(_0xce3c('0x13'));var hardwareService=require(_0xce3c('0x14'));var logger=require(_0xce3c('0x15'))(_0xce3c('0x16'));var utils=require(_0xce3c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xce3c('0x18'));var db=require(_0xce3c('0x19'))['db'];function respondWithStatusCode(_0xf2acbb,_0x54ffd0){_0x54ffd0=_0x54ffd0||0xcc;return function(_0x53f8b1){if(_0x53f8b1){return _0xf2acbb[_0xce3c('0x1a')](_0x54ffd0);}return _0xf2acbb[_0xce3c('0x1b')](_0x54ffd0)[_0xce3c('0x1c')]();};}function respondWithResult(_0x77cfc1,_0xa8f1e3){_0xa8f1e3=_0xa8f1e3||0xc8;return function(_0xe0b74e){if(_0xe0b74e){return _0x77cfc1[_0xce3c('0x1b')](_0xa8f1e3)[_0xce3c('0x1d')](_0xe0b74e);}};}function respondWithFilteredResult(_0x5f2cbc,_0x4872ca){return function(_0x922b9e){if(_0x922b9e){var _0x75c781=typeof _0x4872ca[_0xce3c('0x1e')]===_0xce3c('0x1f')&&typeof _0x4872ca[_0xce3c('0x20')]===_0xce3c('0x1f');var _0x1c8b5b=_0x922b9e[_0xce3c('0x21')];var _0x501347=_0x75c781?0x0:_0x4872ca[_0xce3c('0x1e')];var _0x1422a3=_0x75c781?_0x922b9e['count']:_0x4872ca['offset']+_0x4872ca[_0xce3c('0x20')];var _0x415c04;if(_0x1422a3>=_0x1c8b5b){_0x1422a3=_0x1c8b5b;_0x415c04=0xc8;}else{_0x415c04=0xce;}_0x5f2cbc[_0xce3c('0x1b')](_0x415c04);return _0x5f2cbc[_0xce3c('0x22')](_0xce3c('0x23'),_0x501347+'-'+_0x1422a3+'/'+_0x1c8b5b)[_0xce3c('0x1d')](_0x922b9e);}return null;};}function patchUpdates(_0x16493e){return function(_0x1ab31e){try{jsonpatch[_0xce3c('0x24')](_0x1ab31e,_0x16493e,!![]);}catch(_0x50bf35){return BPromise[_0xce3c('0x25')](_0x50bf35);}return _0x1ab31e[_0xce3c('0x26')]();};}function saveUpdates(_0x671df2,_0x5de340){return function(_0x371445){if(_0x371445){return _0x371445[_0xce3c('0x27')](_0x671df2)['then'](function(_0x4fa0e3){return _0x4fa0e3;});}return null;};}function removeEntity(_0x51856b,_0x3ccb78){return function(_0x2d6051){if(_0x2d6051){return _0x2d6051[_0xce3c('0x28')]()['then'](function(){_0x51856b[_0xce3c('0x1b')](0xcc)[_0xce3c('0x1c')]();});}};}function handleEntityNotFound(_0x323c88,_0x5ae16f){return function(_0x2fca5d){if(!_0x2fca5d){_0x323c88[_0xce3c('0x1a')](0x194);}return _0x2fca5d;};}function handleError(_0x584067,_0x40bf24){_0x40bf24=_0x40bf24||0x1f4;return function(_0x56294f){logger[_0xce3c('0x29')](_0x56294f[_0xce3c('0x2a')]);if(_0x56294f[_0xce3c('0x2b')]){delete _0x56294f[_0xce3c('0x2b')];}_0x584067[_0xce3c('0x1b')](_0x40bf24)[_0xce3c('0x2c')](_0x56294f);};}exports[_0xce3c('0x2d')]=function(_0x174bb1,_0xfdc4ea){var _0x17dfd8={},_0x593033={},_0x36d803={'count':0x0,'rows':[]};var _0x3f1ba6=_[_0xce3c('0x2e')](db['SquareMessage'][_0xce3c('0x2f')],function(_0x1c9e3a){return{'name':_0x1c9e3a[_0xce3c('0x30')],'type':_0x1c9e3a[_0xce3c('0x31')]['key']};});_0x593033[_0xce3c('0x32')]=_[_0xce3c('0x2e')](_0x3f1ba6,_0xce3c('0x2b'));_0x593033['query']=_[_0xce3c('0x33')](_0x174bb1['query']);_0x593033[_0xce3c('0x34')]=_['intersection'](_0x593033[_0xce3c('0x32')],_0x593033[_0xce3c('0x35')]);_0x17dfd8[_0xce3c('0x36')]=_[_0xce3c('0x37')](_0x593033[_0xce3c('0x32')],qs['fields'](_0x174bb1['query']['fields']));_0x17dfd8['attributes']=_0x17dfd8[_0xce3c('0x36')][_0xce3c('0x38')]?_0x17dfd8['attributes']:_0x593033[_0xce3c('0x32')];if(!_0x174bb1[_0xce3c('0x35')][_0xce3c('0x39')](_0xce3c('0x3a'))){_0x17dfd8[_0xce3c('0x20')]=qs['limit'](_0x174bb1[_0xce3c('0x35')]['limit']);_0x17dfd8[_0xce3c('0x1e')]=qs[_0xce3c('0x1e')](_0x174bb1[_0xce3c('0x35')]['offset']);}_0x17dfd8['order']=qs[_0xce3c('0x3b')](_0x174bb1[_0xce3c('0x35')]['sort']);_0x17dfd8['where']=qs['filters'](_[_0xce3c('0x3c')](_0x174bb1[_0xce3c('0x35')],_0x593033[_0xce3c('0x34')]),_0x3f1ba6);if(_0x174bb1[_0xce3c('0x35')][_0xce3c('0x3d')]){_0x17dfd8['where']=_['merge'](_0x17dfd8['where'],{'$or':_[_0xce3c('0x2e')](_0x3f1ba6,function(_0x29287e){if(_0x29287e[_0xce3c('0x31')]!==_0xce3c('0x3e')){var _0x113ae2={};_0x113ae2[_0x29287e[_0xce3c('0x2b')]]={'$like':'%'+_0x174bb1[_0xce3c('0x35')]['filter']+'%'};return _0x113ae2;}})});}_0x17dfd8=_[_0xce3c('0x3f')]({},_0x17dfd8,_0x174bb1['options']);var _0x4bbf83={'where':_0x17dfd8[_0xce3c('0x40')]};return db[_0xce3c('0x41')][_0xce3c('0x21')](_0x4bbf83)[_0xce3c('0x42')](function(_0x3d30c2){_0x36d803[_0xce3c('0x21')]=_0x3d30c2;if(_0x174bb1['query'][_0xce3c('0x43')]){_0x17dfd8[_0xce3c('0x44')]=[{'all':!![]}];}return db[_0xce3c('0x41')]['findAll'](_0x17dfd8);})[_0xce3c('0x42')](function(_0x50d5b1){_0x36d803[_0xce3c('0x45')]=_0x50d5b1;return _0x36d803;})[_0xce3c('0x42')](respondWithFilteredResult(_0xfdc4ea,_0x17dfd8))[_0xce3c('0x46')](handleError(_0xfdc4ea,null));};exports[_0xce3c('0x47')]=function(_0x47078f,_0x4b654a){var _0x3bd3b0={'raw':!![],'where':{'id':_0x47078f['params']['id']}},_0x3bc770={};_0x3bc770[_0xce3c('0x32')]=_['keys'](db[_0xce3c('0x41')][_0xce3c('0x2f')]);_0x3bc770['query']=_['keys'](_0x47078f[_0xce3c('0x35')]);_0x3bc770['filters']=_[_0xce3c('0x37')](_0x3bc770['model'],_0x3bc770['query']);_0x3bd3b0[_0xce3c('0x36')]=_['intersection'](_0x3bc770['model'],qs[_0xce3c('0x48')](_0x47078f[_0xce3c('0x35')]['fields']));_0x3bd3b0[_0xce3c('0x36')]=_0x3bd3b0['attributes'][_0xce3c('0x38')]?_0x3bd3b0['attributes']:_0x3bc770[_0xce3c('0x32')];if(_0x47078f['query'][_0xce3c('0x43')]){_0x3bd3b0[_0xce3c('0x44')]=[{'all':!![]}];}_0x3bd3b0=_[_0xce3c('0x3f')]({},_0x3bd3b0,_0x47078f[_0xce3c('0x49')]);return db['SquareMessage'][_0xce3c('0x4a')](_0x3bd3b0)['then'](handleEntityNotFound(_0x4b654a,null))['then'](respondWithResult(_0x4b654a,null))[_0xce3c('0x46')](handleError(_0x4b654a,null));};exports[_0xce3c('0x4b')]=function(_0x39ef8d,_0x3f1648){return db[_0xce3c('0x41')][_0xce3c('0x4b')](_0x39ef8d[_0xce3c('0x4c')],{})[_0xce3c('0x42')](respondWithResult(_0x3f1648,0xc9))[_0xce3c('0x46')](handleError(_0x3f1648,null));};exports[_0xce3c('0x27')]=function(_0x36251e,_0x133a54){if(_0x36251e[_0xce3c('0x4c')]['id']){delete _0x36251e[_0xce3c('0x4c')]['id'];}return db[_0xce3c('0x41')][_0xce3c('0x4a')]({'where':{'id':_0x36251e[_0xce3c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x133a54,null))['then'](saveUpdates(_0x36251e[_0xce3c('0x4c')],null))[_0xce3c('0x42')](respondWithResult(_0x133a54,null))['catch'](handleError(_0x133a54,null));};exports[_0xce3c('0x28')]=function(_0x2e9aa5,_0x54f171){return db[_0xce3c('0x41')][_0xce3c('0x4a')]({'where':{'id':_0x2e9aa5[_0xce3c('0x4d')]['id']}})[_0xce3c('0x42')](handleEntityNotFound(_0x54f171,null))[_0xce3c('0x42')](removeEntity(_0x54f171,null))[_0xce3c('0x46')](handleError(_0x54f171,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index e36c1a3..9854125 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 _0xdab0=['../../config/environment','./squareMessage.attributes','exports','square_messages','util','../../config/logger','api','moment','bluebird','path'];(function(_0x26a082,_0x124abc){var _0x263788=function(_0x512402){while(--_0x512402){_0x26a082['push'](_0x26a082['shift']());}};_0x263788(++_0x124abc);}(_0xdab0,0x112));var _0x0dab=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xdab0[_0x45783c];return _0x1161da;};'use strict';var _=require('lodash');var util=require(_0x0dab('0x0'));var logger=require(_0x0dab('0x1'))(_0x0dab('0x2'));var moment=require(_0x0dab('0x3'));var BPromise=require(_0x0dab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0dab('0x5'));var rimraf=require('rimraf');var config=require(_0x0dab('0x6'));var attributes=require(_0x0dab('0x7'));module[_0x0dab('0x8')]=function(_0x1c7e59,_0x311b9e){return _0x1c7e59['define']('SquareMessage',attributes,{'tableName':_0x0dab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e28=['SquareMessage','square_messages','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x4da29a,_0x8f7125){var _0x58a2cc=function(_0x1c16c3){while(--_0x1c16c3){_0x4da29a['push'](_0x4da29a['shift']());}};_0x58a2cc(++_0x8f7125);}(_0x2e28,0xe9));var _0x82e2=function(_0x5a31b6,_0x58f421){_0x5a31b6=_0x5a31b6-0x0;var _0x1c3523=_0x2e28[_0x5a31b6];return _0x1c3523;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x82e2('0x0'))(_0x82e2('0x1'));var moment=require(_0x82e2('0x2'));var BPromise=require(_0x82e2('0x3'));var rp=require(_0x82e2('0x4'));var fs=require('fs');var path=require(_0x82e2('0x5'));var rimraf=require(_0x82e2('0x6'));var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0x82e2('0x7')]=function(_0x452166,_0x417c73){return _0x452166[_0x82e2('0x8')](_0x82e2('0x9'),attributes,{'tableName':_0x82e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 0957ace..1c55b72 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 _0x3ca8=['request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareMessage','SquareMessage','create','options','raw','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','SquareMessage,\x20%s,\x20%s'];(function(_0xa42d8f,_0xfd92f){var _0x5be6cd=function(_0x93d8c9){while(--_0x93d8c9){_0xa42d8f['push'](_0xa42d8f['shift']());}};_0x5be6cd(++_0xfd92f);}(_0x3ca8,0x1c2));var _0x83ca=function(_0x2ebffe,_0x1d8598){_0x2ebffe=_0x2ebffe-0x0;var _0x4a218e=_0x3ca8[_0x2ebffe];return _0x4a218e;};'use strict';var _=require(_0x83ca('0x0'));var util=require(_0x83ca('0x1'));var moment=require(_0x83ca('0x2'));var BPromise=require(_0x83ca('0x3'));var rs=require(_0x83ca('0x4'));var fs=require('fs');var Redis=require(_0x83ca('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x83ca('0x6'));var logger=require(_0x83ca('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x83ca('0x8'));var client=jayson[_0x83ca('0x9')][_0x83ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x346cf3,_0x4698c5,_0x1001cf){return new BPromise(function(_0x4571ce,_0x2ddf90){return client[_0x83ca('0xb')](_0x346cf3,_0x1001cf)['then'](function(_0x44e94b){logger[_0x83ca('0xc')](_0x83ca('0xd'),_0x4698c5,_0x83ca('0xe'));logger[_0x83ca('0xf')](_0x83ca('0x10'),_0x4698c5,_0x83ca('0xe'),JSON[_0x83ca('0x11')](_0x44e94b));if(_0x44e94b[_0x83ca('0x12')]){if(_0x44e94b[_0x83ca('0x12')][_0x83ca('0x13')]===0x1f4){logger[_0x83ca('0x12')](_0x83ca('0xd'),_0x4698c5,_0x44e94b[_0x83ca('0x12')]['message']);return _0x2ddf90(_0x44e94b[_0x83ca('0x12')][_0x83ca('0x14')]);}logger['error'](_0x83ca('0xd'),_0x4698c5,_0x44e94b[_0x83ca('0x12')][_0x83ca('0x14')]);return _0x4571ce(_0x44e94b[_0x83ca('0x12')][_0x83ca('0x14')]);}else{logger['info'](_0x83ca('0xd'),_0x4698c5,_0x83ca('0xe'));_0x4571ce(_0x44e94b[_0x83ca('0x15')]['message']);}})['catch'](function(_0x54970d){logger[_0x83ca('0x12')](_0x83ca('0xd'),_0x4698c5,_0x54970d);_0x2ddf90(_0x54970d);});});}exports[_0x83ca('0x16')]=function(_0x3776cc){var _0xcbc9d7=this;return new Promise(function(_0x8df34d,_0x9366f7){return db[_0x83ca('0x17')][_0x83ca('0x18')](_0x3776cc['body'],{'raw':_0x3776cc[_0x83ca('0x19')]?_0x3776cc[_0x83ca('0x19')][_0x83ca('0x1a')]===undefined?!![]:![]:!![]})[_0x83ca('0x1b')](function(_0x24cc22){logger[_0x83ca('0xc')](_0x83ca('0x16'),_0x3776cc);logger[_0x83ca('0xf')](_0x83ca('0x16'),_0x3776cc,JSON[_0x83ca('0x11')](_0x24cc22));_0x8df34d(_0x24cc22);})[_0x83ca('0x1c')](function(_0x48026a){logger[_0x83ca('0x12')](_0x83ca('0x16'),_0x48026a[_0x83ca('0x14')],_0x3776cc);_0x9366f7(_0xcbc9d7[_0x83ca('0x12')](0x1f4,_0x48026a[_0x83ca('0x14')]));});});}; \ No newline at end of file +var _0x8ff0=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSquareMessage','create','body','options','debug','lodash','util','moment'];(function(_0x8c7475,_0x3d805f){var _0x175b4c=function(_0x5180b9){while(--_0x5180b9){_0x8c7475['push'](_0x8c7475['shift']());}};_0x175b4c(++_0x3d805f);}(_0x8ff0,0x193));var _0x08ff=function(_0x4ac48d,_0x171a68){_0x4ac48d=_0x4ac48d-0x0;var _0x7537af=_0x8ff0[_0x4ac48d];return _0x7537af;};'use strict';var _=require(_0x08ff('0x0'));var util=require(_0x08ff('0x1'));var moment=require(_0x08ff('0x2'));var BPromise=require(_0x08ff('0x3'));var rs=require(_0x08ff('0x4'));var fs=require('fs');var Redis=require(_0x08ff('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x08ff('0x6'));var logger=require(_0x08ff('0x7'))(_0x08ff('0x8'));var config=require(_0x08ff('0x9'));var jayson=require(_0x08ff('0xa'));var client=jayson[_0x08ff('0xb')][_0x08ff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x25f86e,_0x6b4b98,_0x4b070e){return new BPromise(function(_0x30269e,_0x2649ec){return client[_0x08ff('0xd')](_0x25f86e,_0x4b070e)[_0x08ff('0xe')](function(_0x1270cd){logger[_0x08ff('0xf')](_0x08ff('0x10'),_0x6b4b98,'request\x20sent');logger['debug'](_0x08ff('0x11'),_0x6b4b98,_0x08ff('0x12'),JSON[_0x08ff('0x13')](_0x1270cd));if(_0x1270cd[_0x08ff('0x14')]){if(_0x1270cd[_0x08ff('0x14')][_0x08ff('0x15')]===0x1f4){logger[_0x08ff('0x14')](_0x08ff('0x10'),_0x6b4b98,_0x1270cd['error'][_0x08ff('0x16')]);return _0x2649ec(_0x1270cd[_0x08ff('0x14')][_0x08ff('0x16')]);}logger[_0x08ff('0x14')](_0x08ff('0x10'),_0x6b4b98,_0x1270cd['error'][_0x08ff('0x16')]);return _0x30269e(_0x1270cd['error'][_0x08ff('0x16')]);}else{logger[_0x08ff('0xf')](_0x08ff('0x10'),_0x6b4b98,_0x08ff('0x12'));_0x30269e(_0x1270cd[_0x08ff('0x17')]['message']);}})['catch'](function(_0x1f7320){logger[_0x08ff('0x14')]('SquareMessage,\x20%s,\x20%s',_0x6b4b98,_0x1f7320);_0x2649ec(_0x1f7320);});});}exports[_0x08ff('0x18')]=function(_0x5bd51e){var _0x2dcab0=this;return new Promise(function(_0x1f99f5,_0x34e4b5){return db['SquareMessage'][_0x08ff('0x19')](_0x5bd51e[_0x08ff('0x1a')],{'raw':_0x5bd51e[_0x08ff('0x1b')]?_0x5bd51e[_0x08ff('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x08ff('0xe')](function(_0x9da1b8){logger[_0x08ff('0xf')](_0x08ff('0x18'),_0x5bd51e);logger[_0x08ff('0x1c')](_0x08ff('0x18'),_0x5bd51e,JSON[_0x08ff('0x13')](_0x9da1b8));_0x1f99f5(_0x9da1b8);})['catch'](function(_0x2040c4){logger[_0x08ff('0x14')](_0x08ff('0x18'),_0x2040c4[_0x08ff('0x16')],_0x5bd51e);_0x34e4b5(_0x2dcab0['error'](0x1f4,_0x2040c4[_0x08ff('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 907df13..d10cde5 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 _0x30f8=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','isAuthenticated','15s','post','update','delete','destroy'];(function(_0x574561,_0x553319){var _0x56ce60=function(_0x1ce56f){while(--_0x1ce56f){_0x574561['push'](_0x574561['shift']());}};_0x56ce60(++_0x553319);}(_0x30f8,0x1cf));var _0x830f=function(_0x29cef6,_0x116724){_0x29cef6=_0x29cef6-0x0;var _0x604a3b=_0x30f8[_0x29cef6];return _0x604a3b;};'use strict';var multer=require(_0x830f('0x0'));var util=require(_0x830f('0x1'));var path=require(_0x830f('0x2'));var timeout=require(_0x830f('0x3'));var express=require(_0x830f('0x4'));var router=express[_0x830f('0x5')]();var fs_extra=require(_0x830f('0x6'));var auth=require(_0x830f('0x7'));var interaction=require(_0x830f('0x8'));var config=require(_0x830f('0x9'));var controller=require(_0x830f('0xa'));router[_0x830f('0xb')]('/',auth['isAuthenticated'](),controller[_0x830f('0xc')]);router[_0x830f('0xb')](_0x830f('0xd'),auth[_0x830f('0xe')](),controller['show']);router[_0x830f('0xb')]('/:id/test',auth[_0x830f('0xe')](),timeout(_0x830f('0xf')),controller['test']);router[_0x830f('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x830f('0xe')](),controller[_0x830f('0x11')]);router[_0x830f('0x12')](_0x830f('0xd'),auth[_0x830f('0xe')](),controller[_0x830f('0x13')]);module[_0x830f('0x14')]=router; \ No newline at end of file +var _0x66d5=['get','isAuthenticated','index','show','/:id/test','15s','test','post','create','/:id','update','delete','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x66d5,0xad));var _0x566d=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x66d5[_0x235482];return _0x5f5bea;};'use strict';var multer=require(_0x566d('0x0'));var util=require(_0x566d('0x1'));var path=require(_0x566d('0x2'));var timeout=require(_0x566d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x566d('0x4'));var config=require(_0x566d('0x5'));var controller=require(_0x566d('0x6'));router[_0x566d('0x7')]('/',auth[_0x566d('0x8')](),controller[_0x566d('0x9')]);router[_0x566d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x566d('0xa')]);router[_0x566d('0x7')](_0x566d('0xb'),auth[_0x566d('0x8')](),timeout(_0x566d('0xc')),controller[_0x566d('0xd')]);router[_0x566d('0xe')]('/',auth['isAuthenticated'](),controller[_0x566d('0xf')]);router['put'](_0x566d('0x10'),auth[_0x566d('0x8')](),controller[_0x566d('0x11')]);router[_0x566d('0x12')](_0x566d('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x566d('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 2aac731..dfadd8e 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 _0xe227=['STRING','name'];(function(_0x256f6f,_0x3b2646){var _0x1510fd=function(_0x2f5d75){while(--_0x2f5d75){_0x256f6f['push'](_0x256f6f['shift']());}};_0x1510fd(++_0x3b2646);}(_0xe227,0x1af));var _0x7e22=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xe227[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x7e22('0x0'),'allowNull':![]},'dsn':{'type':Sequelize[_0x7e22('0x1')]},'description':{'type':Sequelize[_0x7e22('0x1')]}}; \ No newline at end of file +var _0xe692=['STRING','sequelize','exports','name'];(function(_0x5218e9,_0x23292a){var _0x3959f3=function(_0xbb7c85){while(--_0xbb7c85){_0x5218e9['push'](_0x5218e9['shift']());}};_0x3959f3(++_0x23292a);}(_0xe692,0x11d));var _0x2e69=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xe692[_0x49d41c];return _0xb64c5f;};'use strict';var Sequelize=require(_0x2e69('0x0'));module[_0x2e69('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2e69('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2e69('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 5f3efa9..a983177 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 _0x778f=['user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','dsn','odbc','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','get','ODBC','UserProfileResource','destroy','error','name','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','SquareOdbc','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x778f,0x15b));var _0xf778=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x778f[_0x2e4e19];return _0x9ba20b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf778('0x0'));var jsonpatch=require(_0xf778('0x1'));var rp=require(_0xf778('0x2'));var moment=require(_0xf778('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf778('0x4'));var util=require(_0xf778('0x5'));var path=require(_0xf778('0x6'));var sox=require('sox');var csv=require(_0xf778('0x7'));var ejs=require(_0xf778('0x8'));var fs=require('fs');var fs_extra=require(_0xf778('0x9'));var _=require(_0xf778('0xa'));var squel=require(_0xf778('0xb'));var crypto=require(_0xf778('0xc'));var jsforce=require(_0xf778('0xd'));var deskjs=require(_0xf778('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf778('0xf'));var Papa=require('papaparse');var Redis=require(_0xf778('0x10'));var authService=require(_0xf778('0x11'));var qs=require(_0xf778('0x12'));var as=require(_0xf778('0x13'));var hardwareService=require(_0xf778('0x14'));var logger=require(_0xf778('0x15'))(_0xf778('0x16'));var utils=require(_0xf778('0x17'));var config=require(_0xf778('0x18'));var licenseUtil=require(_0xf778('0x19'));var db=require(_0xf778('0x1a'))['db'];function respondWithStatusCode(_0x5d7892,_0x3adbb1){_0x3adbb1=_0x3adbb1||0xcc;return function(_0x4a7143){if(_0x4a7143){return _0x5d7892[_0xf778('0x1b')](_0x3adbb1);}return _0x5d7892[_0xf778('0x1c')](_0x3adbb1)[_0xf778('0x1d')]();};}function respondWithResult(_0x4ac5d4,_0x4bc167){_0x4bc167=_0x4bc167||0xc8;return function(_0x52fe1e){if(_0x52fe1e){return _0x4ac5d4[_0xf778('0x1c')](_0x4bc167)['json'](_0x52fe1e);}};}function respondWithFilteredResult(_0x43bced,_0x47f43f){return function(_0x9bd208){if(_0x9bd208){var _0x3c05dc=typeof _0x47f43f[_0xf778('0x1e')]===_0xf778('0x1f')&&typeof _0x47f43f[_0xf778('0x20')]===_0xf778('0x1f');var _0x10de41=_0x9bd208[_0xf778('0x21')];var _0x5909bb=_0x3c05dc?0x0:_0x47f43f[_0xf778('0x1e')];var _0x125902=_0x3c05dc?_0x9bd208['count']:_0x47f43f[_0xf778('0x1e')]+_0x47f43f['limit'];var _0x1f7592;if(_0x125902>=_0x10de41){_0x125902=_0x10de41;_0x1f7592=0xc8;}else{_0x1f7592=0xce;}_0x43bced['status'](_0x1f7592);return _0x43bced['set'](_0xf778('0x22'),_0x5909bb+'-'+_0x125902+'/'+_0x10de41)[_0xf778('0x23')](_0x9bd208);}return null;};}function patchUpdates(_0x1ae54f){return function(_0x4209f7){try{jsonpatch[_0xf778('0x24')](_0x4209f7,_0x1ae54f,!![]);}catch(_0x158131){return BPromise['reject'](_0x158131);}return _0x4209f7[_0xf778('0x25')]();};}function saveUpdates(_0x5a9213,_0x497501){return function(_0x150657){if(_0x150657){return _0x150657[_0xf778('0x26')](_0x5a9213)[_0xf778('0x27')](function(_0x1360ff){return _0x1360ff;});}return null;};}function removeEntity(_0xc98541,_0xf4e45e){return function(_0x9feacc){if(_0x9feacc){return _0x9feacc['destroy']()[_0xf778('0x27')](function(){var _0x159953=_0x9feacc[_0xf778('0x28')]({'plain':!![]});var _0x366965=_0xf778('0x29');return db[_0xf778('0x2a')][_0xf778('0x2b')]({'where':{'type':_0x366965,'resourceId':_0x159953['id']}})[_0xf778('0x27')](function(){return _0x9feacc;});})[_0xf778('0x27')](function(){_0xc98541[_0xf778('0x1c')](0xcc)[_0xf778('0x1d')]();});}};}function handleEntityNotFound(_0x1bf86c,_0x2aaa6e){return function(_0x2fd02c){if(!_0x2fd02c){_0x1bf86c[_0xf778('0x1b')](0x194);}return _0x2fd02c;};}function handleError(_0x380341,_0x27a809){_0x27a809=_0x27a809||0x1f4;return function(_0x47a521){logger[_0xf778('0x2c')](_0x47a521['stack']);if(_0x47a521[_0xf778('0x2d')]){delete _0x47a521['name'];}_0x380341['status'](_0x27a809)['send'](_0x47a521);};}exports[_0xf778('0x2e')]=function(_0x63dd28,_0x289df6){var _0x1d1ad6={},_0x45aaee={},_0x51b4c0={'count':0x0,'rows':[]};var _0x145d12=_[_0xf778('0x2f')](db['SquareOdbc'][_0xf778('0x30')],function(_0x55fc98){return{'name':_0x55fc98['fieldName'],'type':_0x55fc98[_0xf778('0x31')]['key']};});_0x45aaee[_0xf778('0x32')]=_[_0xf778('0x2f')](_0x145d12,_0xf778('0x2d'));_0x45aaee[_0xf778('0x33')]=_[_0xf778('0x34')](_0x63dd28[_0xf778('0x33')]);_0x45aaee['filters']=_[_0xf778('0x35')](_0x45aaee[_0xf778('0x32')],_0x45aaee['query']);_0x1d1ad6[_0xf778('0x36')]=_[_0xf778('0x35')](_0x45aaee['model'],qs[_0xf778('0x37')](_0x63dd28[_0xf778('0x33')][_0xf778('0x37')]));_0x1d1ad6[_0xf778('0x36')]=_0x1d1ad6[_0xf778('0x36')][_0xf778('0x38')]?_0x1d1ad6[_0xf778('0x36')]:_0x45aaee[_0xf778('0x32')];if(!_0x63dd28[_0xf778('0x33')][_0xf778('0x39')](_0xf778('0x3a'))){_0x1d1ad6[_0xf778('0x20')]=qs[_0xf778('0x20')](_0x63dd28[_0xf778('0x33')]['limit']);_0x1d1ad6[_0xf778('0x1e')]=qs['offset'](_0x63dd28['query'][_0xf778('0x1e')]);}_0x1d1ad6[_0xf778('0x3b')]=qs[_0xf778('0x3c')](_0x63dd28[_0xf778('0x33')]['sort']);_0x1d1ad6[_0xf778('0x3d')]=qs[_0xf778('0x3e')](_[_0xf778('0x3f')](_0x63dd28[_0xf778('0x33')],_0x45aaee[_0xf778('0x3e')]),_0x145d12);if(_0x63dd28['query'][_0xf778('0x40')]){_0x1d1ad6[_0xf778('0x3d')]=_[_0xf778('0x41')](_0x1d1ad6[_0xf778('0x3d')],{'$or':_[_0xf778('0x2f')](_0x145d12,function(_0x3cc091){if(_0x3cc091[_0xf778('0x31')]!==_0xf778('0x42')){var _0x424576={};_0x424576[_0x3cc091[_0xf778('0x2d')]]={'$like':'%'+_0x63dd28['query'][_0xf778('0x40')]+'%'};return _0x424576;}})});}_0x1d1ad6=_[_0xf778('0x41')]({},_0x1d1ad6,_0x63dd28['options']);var _0x3248e1={'where':_0x1d1ad6[_0xf778('0x3d')]};return db['SquareOdbc']['count'](_0x3248e1)[_0xf778('0x27')](function(_0x3582a1){_0x51b4c0['count']=_0x3582a1;if(_0x63dd28[_0xf778('0x33')][_0xf778('0x43')]){_0x1d1ad6[_0xf778('0x44')]=[{'all':!![]}];}return db['SquareOdbc'][_0xf778('0x45')](_0x1d1ad6);})['then'](function(_0xf2cfc){_0x51b4c0['rows']=_0xf2cfc;return _0x51b4c0;})[_0xf778('0x27')](respondWithFilteredResult(_0x289df6,_0x1d1ad6))['catch'](handleError(_0x289df6,null));};exports[_0xf778('0x46')]=function(_0x2d2c48,_0x35e19c){var _0x503b5c={'raw':!![],'where':{'id':_0x2d2c48[_0xf778('0x47')]['id']}},_0x1091ff={};_0x1091ff[_0xf778('0x32')]=_[_0xf778('0x34')](db[_0xf778('0x48')][_0xf778('0x30')]);_0x1091ff[_0xf778('0x33')]=_[_0xf778('0x34')](_0x2d2c48['query']);_0x1091ff['filters']=_[_0xf778('0x35')](_0x1091ff[_0xf778('0x32')],_0x1091ff[_0xf778('0x33')]);_0x503b5c[_0xf778('0x36')]=_[_0xf778('0x35')](_0x1091ff[_0xf778('0x32')],qs[_0xf778('0x37')](_0x2d2c48[_0xf778('0x33')][_0xf778('0x37')]));_0x503b5c['attributes']=_0x503b5c[_0xf778('0x36')][_0xf778('0x38')]?_0x503b5c[_0xf778('0x36')]:_0x1091ff['model'];if(_0x2d2c48[_0xf778('0x33')][_0xf778('0x43')]){_0x503b5c[_0xf778('0x44')]=[{'all':!![]}];}_0x503b5c=_[_0xf778('0x41')]({},_0x503b5c,_0x2d2c48[_0xf778('0x49')]);return db[_0xf778('0x48')][_0xf778('0x4a')](_0x503b5c)[_0xf778('0x27')](handleEntityNotFound(_0x35e19c,null))['then'](respondWithResult(_0x35e19c,null))[_0xf778('0x4b')](handleError(_0x35e19c,null));};exports[_0xf778('0x4c')]=function(_0x52b57e,_0x39a66c){return db[_0xf778('0x48')][_0xf778('0x4c')](_0x52b57e['body'],{})[_0xf778('0x27')](function(_0x48ad63){var _0x416606=_0x52b57e['user'][_0xf778('0x28')]({'plain':!![]});if(!_0x416606)throw new Error(_0xf778('0x4d'));if(_0x416606['role']===_0xf778('0x4e')){var _0x47001f=_0x48ad63[_0xf778('0x28')]({'plain':!![]});var _0x58195b=_0xf778('0x29');return db['UserProfileSection'][_0xf778('0x4a')]({'where':{'name':_0x58195b,'userProfileId':_0x416606[_0xf778('0x4f')]},'raw':!![]})['then'](function(_0x5aad06){if(_0x5aad06&&_0x5aad06[_0xf778('0x50')]===0x0){return db[_0xf778('0x2a')][_0xf778('0x4c')]({'name':_0x47001f[_0xf778('0x2d')],'resourceId':_0x47001f['id'],'type':_0x5aad06[_0xf778('0x2d')],'sectionId':_0x5aad06['id']},{})[_0xf778('0x27')](function(){return _0x48ad63;});}else{return _0x48ad63;}})[_0xf778('0x4b')](function(_0xd76287){logger[_0xf778('0x2c')](_0xf778('0x51'),_0xd76287);throw _0xd76287;});}return _0x48ad63;})[_0xf778('0x27')](respondWithResult(_0x39a66c,0xc9))[_0xf778('0x4b')](handleError(_0x39a66c,null));};exports[_0xf778('0x26')]=function(_0xeb122c,_0x18e735){if(_0xeb122c['body']['id']){delete _0xeb122c['body']['id'];}return db['SquareOdbc'][_0xf778('0x4a')]({'where':{'id':_0xeb122c[_0xf778('0x47')]['id']}})[_0xf778('0x27')](handleEntityNotFound(_0x18e735,null))[_0xf778('0x27')](saveUpdates(_0xeb122c[_0xf778('0x52')],null))[_0xf778('0x27')](respondWithResult(_0x18e735,null))[_0xf778('0x4b')](handleError(_0x18e735,null));};exports[_0xf778('0x2b')]=function(_0x4e15e1,_0x2cb421){return db[_0xf778('0x48')][_0xf778('0x4a')]({'where':{'id':_0x4e15e1[_0xf778('0x47')]['id']}})[_0xf778('0x27')](handleEntityNotFound(_0x2cb421,null))[_0xf778('0x27')](removeEntity(_0x2cb421,null))[_0xf778('0x4b')](handleError(_0x2cb421,null));};exports['test']=function(_0x287943,_0x450249,_0x4b7e71){var _0x23c121;return db[_0xf778('0x48')][_0xf778('0x4a')]({'where':{'id':_0x287943[_0xf778('0x47')]['id']},'attributes':['id',_0xf778('0x53')]})[_0xf778('0x27')](handleEntityNotFound(_0x450249,null))[_0xf778('0x27')](function(_0x3829e7){if(_0x3829e7){var _0xc95a9c=require(_0xf778('0x54'))();_0xc95a9c['openSync'](_0x3829e7[_0xf778('0x53')]);_0xc95a9c['closeSync']();return _0x3829e7;}})['then'](respondWithResult(_0x450249,null))[_0xf778('0x4b')](handleError(_0x450249,null));}; \ No newline at end of file +var _0x7508=['includeAll','findAll','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','ODBC','UserProfileResource','destroy','error','stack','name','send','index','SquareOdbc','rawAttributes','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','where','filter','type','VIRTUAL','merge','options'];(function(_0x1fee31,_0x3ede88){var _0x376024=function(_0x290554){while(--_0x290554){_0x1fee31['push'](_0x1fee31['shift']());}};_0x376024(++_0x3ede88);}(_0x7508,0x1c5));var _0x8750=function(_0x34ea52,_0x1bf87e){_0x34ea52=_0x34ea52-0x0;var _0x2c3e42=_0x7508[_0x34ea52];return _0x2c3e42;};'use strict';var emlformat=require(_0x8750('0x0'));var rimraf=require(_0x8750('0x1'));var zipdir=require(_0x8750('0x2'));var jsonpatch=require(_0x8750('0x3'));var rp=require(_0x8750('0x4'));var moment=require(_0x8750('0x5'));var BPromise=require(_0x8750('0x6'));var Mustache=require(_0x8750('0x7'));var util=require(_0x8750('0x8'));var path=require(_0x8750('0x9'));var sox=require(_0x8750('0xa'));var csv=require(_0x8750('0xb'));var ejs=require(_0x8750('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8750('0xd'));var jsforce=require(_0x8750('0xe'));var deskjs=require(_0x8750('0xf'));var toCsv=require(_0x8750('0xb'));var querystring=require(_0x8750('0x10'));var Papa=require(_0x8750('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8750('0x12'));var as=require(_0x8750('0x13'));var hardwareService=require(_0x8750('0x14'));var logger=require(_0x8750('0x15'))('api');var utils=require(_0x8750('0x16'));var config=require(_0x8750('0x17'));var licenseUtil=require(_0x8750('0x18'));var db=require(_0x8750('0x19'))['db'];function respondWithStatusCode(_0x3155c9,_0x3c115d){_0x3c115d=_0x3c115d||0xcc;return function(_0xb2ceed){if(_0xb2ceed){return _0x3155c9['sendStatus'](_0x3c115d);}return _0x3155c9[_0x8750('0x1a')](_0x3c115d)[_0x8750('0x1b')]();};}function respondWithResult(_0x2408e2,_0x5c3e4c){_0x5c3e4c=_0x5c3e4c||0xc8;return function(_0x39f1cd){if(_0x39f1cd){return _0x2408e2[_0x8750('0x1a')](_0x5c3e4c)[_0x8750('0x1c')](_0x39f1cd);}};}function respondWithFilteredResult(_0x371962,_0x4bb00f){return function(_0xc48beb){if(_0xc48beb){var _0x241d22=typeof _0x4bb00f[_0x8750('0x1d')]===_0x8750('0x1e')&&typeof _0x4bb00f[_0x8750('0x1f')]==='undefined';var _0x4e864b=_0xc48beb['count'];var _0x49f006=_0x241d22?0x0:_0x4bb00f[_0x8750('0x1d')];var _0x41c756=_0x241d22?_0xc48beb[_0x8750('0x20')]:_0x4bb00f[_0x8750('0x1d')]+_0x4bb00f['limit'];var _0x1369eb;if(_0x41c756>=_0x4e864b){_0x41c756=_0x4e864b;_0x1369eb=0xc8;}else{_0x1369eb=0xce;}_0x371962[_0x8750('0x1a')](_0x1369eb);return _0x371962[_0x8750('0x21')](_0x8750('0x22'),_0x49f006+'-'+_0x41c756+'/'+_0x4e864b)[_0x8750('0x1c')](_0xc48beb);}return null;};}function patchUpdates(_0x116783){return function(_0x489fb6){try{jsonpatch[_0x8750('0x23')](_0x489fb6,_0x116783,!![]);}catch(_0x4725a5){return BPromise[_0x8750('0x24')](_0x4725a5);}return _0x489fb6[_0x8750('0x25')]();};}function saveUpdates(_0xeee3be,_0x5f7071){return function(_0x2efdec){if(_0x2efdec){return _0x2efdec[_0x8750('0x26')](_0xeee3be)[_0x8750('0x27')](function(_0x38a60a){return _0x38a60a;});}return null;};}function removeEntity(_0x3f1e78,_0x170755){return function(_0x355a18){if(_0x355a18){return _0x355a18['destroy']()[_0x8750('0x27')](function(){var _0x2be98b=_0x355a18[_0x8750('0x28')]({'plain':!![]});var _0x2000e6=_0x8750('0x29');return db[_0x8750('0x2a')][_0x8750('0x2b')]({'where':{'type':_0x2000e6,'resourceId':_0x2be98b['id']}})[_0x8750('0x27')](function(){return _0x355a18;});})[_0x8750('0x27')](function(){_0x3f1e78['status'](0xcc)[_0x8750('0x1b')]();});}};}function handleEntityNotFound(_0x368593,_0x25b838){return function(_0x5d261e){if(!_0x5d261e){_0x368593['sendStatus'](0x194);}return _0x5d261e;};}function handleError(_0x26365f,_0x157bef){_0x157bef=_0x157bef||0x1f4;return function(_0x593bb9){logger[_0x8750('0x2c')](_0x593bb9[_0x8750('0x2d')]);if(_0x593bb9[_0x8750('0x2e')]){delete _0x593bb9['name'];}_0x26365f['status'](_0x157bef)[_0x8750('0x2f')](_0x593bb9);};}exports[_0x8750('0x30')]=function(_0x116646,_0x17a101){var _0x39a002={},_0x4b2238={},_0x58bd99={'count':0x0,'rows':[]};var _0x3f607c=_['map'](db[_0x8750('0x31')][_0x8750('0x32')],function(_0x59fc7a){return{'name':_0x59fc7a['fieldName'],'type':_0x59fc7a['type'][_0x8750('0x33')]};});_0x4b2238['model']=_[_0x8750('0x34')](_0x3f607c,_0x8750('0x2e'));_0x4b2238[_0x8750('0x35')]=_[_0x8750('0x36')](_0x116646[_0x8750('0x35')]);_0x4b2238[_0x8750('0x37')]=_[_0x8750('0x38')](_0x4b2238[_0x8750('0x39')],_0x4b2238[_0x8750('0x35')]);_0x39a002[_0x8750('0x3a')]=_[_0x8750('0x38')](_0x4b2238[_0x8750('0x39')],qs[_0x8750('0x3b')](_0x116646['query'][_0x8750('0x3b')]));_0x39a002[_0x8750('0x3a')]=_0x39a002['attributes'][_0x8750('0x3c')]?_0x39a002[_0x8750('0x3a')]:_0x4b2238[_0x8750('0x39')];if(!_0x116646[_0x8750('0x35')][_0x8750('0x3d')]('nolimit')){_0x39a002['limit']=qs['limit'](_0x116646[_0x8750('0x35')]['limit']);_0x39a002[_0x8750('0x1d')]=qs['offset'](_0x116646['query']['offset']);}_0x39a002[_0x8750('0x3e')]=qs['sort'](_0x116646[_0x8750('0x35')]['sort']);_0x39a002[_0x8750('0x3f')]=qs[_0x8750('0x37')](_['pick'](_0x116646[_0x8750('0x35')],_0x4b2238['filters']),_0x3f607c);if(_0x116646[_0x8750('0x35')][_0x8750('0x40')]){_0x39a002[_0x8750('0x3f')]=_['merge'](_0x39a002[_0x8750('0x3f')],{'$or':_[_0x8750('0x34')](_0x3f607c,function(_0x1543f5){if(_0x1543f5[_0x8750('0x41')]!==_0x8750('0x42')){var _0xbdfb1f={};_0xbdfb1f[_0x1543f5['name']]={'$like':'%'+_0x116646[_0x8750('0x35')][_0x8750('0x40')]+'%'};return _0xbdfb1f;}})});}_0x39a002=_[_0x8750('0x43')]({},_0x39a002,_0x116646[_0x8750('0x44')]);var _0x23747e={'where':_0x39a002[_0x8750('0x3f')]};return db['SquareOdbc']['count'](_0x23747e)[_0x8750('0x27')](function(_0x3eed97){_0x58bd99['count']=_0x3eed97;if(_0x116646[_0x8750('0x35')][_0x8750('0x45')]){_0x39a002['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x8750('0x46')](_0x39a002);})[_0x8750('0x27')](function(_0x52fe8e){_0x58bd99['rows']=_0x52fe8e;return _0x58bd99;})['then'](respondWithFilteredResult(_0x17a101,_0x39a002))[_0x8750('0x47')](handleError(_0x17a101,null));};exports['show']=function(_0x544237,_0x5d9418){var _0xba8703={'raw':!![],'where':{'id':_0x544237[_0x8750('0x48')]['id']}},_0x304c04={};_0x304c04[_0x8750('0x39')]=_['keys'](db[_0x8750('0x31')]['rawAttributes']);_0x304c04[_0x8750('0x35')]=_[_0x8750('0x36')](_0x544237[_0x8750('0x35')]);_0x304c04[_0x8750('0x37')]=_['intersection'](_0x304c04['model'],_0x304c04[_0x8750('0x35')]);_0xba8703[_0x8750('0x3a')]=_[_0x8750('0x38')](_0x304c04[_0x8750('0x39')],qs['fields'](_0x544237[_0x8750('0x35')][_0x8750('0x3b')]));_0xba8703[_0x8750('0x3a')]=_0xba8703[_0x8750('0x3a')]['length']?_0xba8703[_0x8750('0x3a')]:_0x304c04[_0x8750('0x39')];if(_0x544237[_0x8750('0x35')][_0x8750('0x45')]){_0xba8703[_0x8750('0x49')]=[{'all':!![]}];}_0xba8703=_[_0x8750('0x43')]({},_0xba8703,_0x544237['options']);return db[_0x8750('0x31')][_0x8750('0x4a')](_0xba8703)[_0x8750('0x27')](handleEntityNotFound(_0x5d9418,null))[_0x8750('0x27')](respondWithResult(_0x5d9418,null))[_0x8750('0x47')](handleError(_0x5d9418,null));};exports[_0x8750('0x4b')]=function(_0x17f526,_0x54d05a){return db['SquareOdbc'][_0x8750('0x4b')](_0x17f526[_0x8750('0x4c')],{})['then'](function(_0x41e510){var _0x11fc53=_0x17f526[_0x8750('0x4d')]['get']({'plain':!![]});if(!_0x11fc53)throw new Error(_0x8750('0x4e'));if(_0x11fc53[_0x8750('0x4f')]===_0x8750('0x4d')){var _0x693487=_0x41e510[_0x8750('0x28')]({'plain':!![]});var _0x1aae9a=_0x8750('0x29');return db[_0x8750('0x50')]['find']({'where':{'name':_0x1aae9a,'userProfileId':_0x11fc53[_0x8750('0x51')]},'raw':!![]})[_0x8750('0x27')](function(_0x4c8f83){if(_0x4c8f83&&_0x4c8f83[_0x8750('0x52')]===0x0){return db[_0x8750('0x2a')][_0x8750('0x4b')]({'name':_0x693487['name'],'resourceId':_0x693487['id'],'type':_0x4c8f83[_0x8750('0x2e')],'sectionId':_0x4c8f83['id']},{})['then'](function(){return _0x41e510;});}else{return _0x41e510;}})[_0x8750('0x47')](function(_0x1d64c1){logger[_0x8750('0x2c')](_0x8750('0x53'),_0x1d64c1);throw _0x1d64c1;});}return _0x41e510;})[_0x8750('0x27')](respondWithResult(_0x54d05a,0xc9))[_0x8750('0x47')](handleError(_0x54d05a,null));};exports['update']=function(_0x3732be,_0x35c4a8){if(_0x3732be[_0x8750('0x4c')]['id']){delete _0x3732be[_0x8750('0x4c')]['id'];}return db['SquareOdbc'][_0x8750('0x4a')]({'where':{'id':_0x3732be[_0x8750('0x48')]['id']}})[_0x8750('0x27')](handleEntityNotFound(_0x35c4a8,null))[_0x8750('0x27')](saveUpdates(_0x3732be[_0x8750('0x4c')],null))['then'](respondWithResult(_0x35c4a8,null))['catch'](handleError(_0x35c4a8,null));};exports[_0x8750('0x2b')]=function(_0xe60830,_0x378839){return db[_0x8750('0x31')][_0x8750('0x4a')]({'where':{'id':_0xe60830['params']['id']}})[_0x8750('0x27')](handleEntityNotFound(_0x378839,null))[_0x8750('0x27')](removeEntity(_0x378839,null))[_0x8750('0x47')](handleError(_0x378839,null));};exports[_0x8750('0x54')]=function(_0x3590f6,_0x20f106,_0x24efce){var _0x467a92;return db[_0x8750('0x31')][_0x8750('0x4a')]({'where':{'id':_0x3590f6[_0x8750('0x48')]['id']},'attributes':['id',_0x8750('0x55')]})['then'](handleEntityNotFound(_0x20f106,null))[_0x8750('0x27')](function(_0x396b34){if(_0x396b34){var _0x5e99fb=require(_0x8750('0x56'))();_0x5e99fb['openSync'](_0x396b34[_0x8750('0x55')]);_0x5e99fb['closeSync']();return _0x396b34;}})[_0x8750('0x27')](respondWithResult(_0x20f106,null))['catch'](handleError(_0x20f106,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 3d60f5d..699ca01 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 _0x16d0=['moment','bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','lodash','util','../../config/logger','api'];(function(_0x5a8f7d,_0x3bd3e4){var _0x22c30f=function(_0x3a4f9d){while(--_0x3a4f9d){_0x5a8f7d['push'](_0x5a8f7d['shift']());}};_0x22c30f(++_0x3bd3e4);}(_0x16d0,0x8b));var _0x016d=function(_0x1984cf,_0x5edc54){_0x1984cf=_0x1984cf-0x0;var _0x26aa98=_0x16d0[_0x1984cf];return _0x26aa98;};'use strict';var _=require(_0x016d('0x0'));var util=require(_0x016d('0x1'));var logger=require(_0x016d('0x2'))(_0x016d('0x3'));var moment=require(_0x016d('0x4'));var BPromise=require(_0x016d('0x5'));var rp=require(_0x016d('0x6'));var fs=require('fs');var path=require(_0x016d('0x7'));var rimraf=require('rimraf');var config=require(_0x016d('0x8'));var attributes=require(_0x016d('0x9'));module[_0x016d('0xa')]=function(_0x1e1b55,_0x10d521){return _0x1e1b55[_0x016d('0xb')]('SquareOdbc',attributes,{'tableName':_0x016d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ee9=['SquareOdbc','square_odbc','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x585700,_0x2761a7){var _0x2278f9=function(_0x61fa20){while(--_0x61fa20){_0x585700['push'](_0x585700['shift']());}};_0x2278f9(++_0x2761a7);}(_0x5ee9,0x120));var _0x95ee=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5ee9[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x95ee('0x0'));var util=require(_0x95ee('0x1'));var logger=require(_0x95ee('0x2'))('api');var moment=require(_0x95ee('0x3'));var BPromise=require('bluebird');var rp=require(_0x95ee('0x4'));var fs=require('fs');var path=require(_0x95ee('0x5'));var rimraf=require(_0x95ee('0x6'));var config=require(_0x95ee('0x7'));var attributes=require(_0x95ee('0x8'));module[_0x95ee('0x9')]=function(_0x375155,_0x2bde5c){return _0x375155[_0x95ee('0xa')](_0x95ee('0xb'),attributes,{'tableName':_0x95ee('0xc'),'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 9e99fe7..0875ed4 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 _0x9b4f=['jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','ShowSquareOdbc','find','options','where','include','map','model','attributes','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment'];(function(_0x51afd2,_0x1c238c){var _0x30a347=function(_0x5cca66){while(--_0x5cca66){_0x51afd2['push'](_0x51afd2['shift']());}};_0x30a347(++_0x1c238c);}(_0x9b4f,0xc3));var _0xf9b4=function(_0x2b18b5,_0x3c4d7b){_0x2b18b5=_0x2b18b5-0x0;var _0x1cbe11=_0x9b4f[_0x2b18b5];return _0x1cbe11;};'use strict';var _=require(_0xf9b4('0x0'));var util=require(_0xf9b4('0x1'));var moment=require(_0xf9b4('0x2'));var BPromise=require(_0xf9b4('0x3'));var rs=require(_0xf9b4('0x4'));var fs=require('fs');var Redis=require(_0xf9b4('0x5'));var db=require(_0xf9b4('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf9b4('0x7'));var jayson=require(_0xf9b4('0x8'));var client=jayson[_0xf9b4('0x9')][_0xf9b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x301602,_0x30fc84,_0x3c6f45){return new BPromise(function(_0x56866a,_0x375eb1){return client[_0xf9b4('0xb')](_0x301602,_0x3c6f45)[_0xf9b4('0xc')](function(_0x1584ca){logger['info'](_0xf9b4('0xd'),_0x30fc84,_0xf9b4('0xe'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x30fc84,_0xf9b4('0xe'),JSON['stringify'](_0x1584ca));if(_0x1584ca[_0xf9b4('0xf')]){if(_0x1584ca[_0xf9b4('0xf')]['code']===0x1f4){logger[_0xf9b4('0xf')](_0xf9b4('0xd'),_0x30fc84,_0x1584ca[_0xf9b4('0xf')][_0xf9b4('0x10')]);return _0x375eb1(_0x1584ca[_0xf9b4('0xf')][_0xf9b4('0x10')]);}logger['error'](_0xf9b4('0xd'),_0x30fc84,_0x1584ca[_0xf9b4('0xf')][_0xf9b4('0x10')]);return _0x56866a(_0x1584ca[_0xf9b4('0xf')][_0xf9b4('0x10')]);}else{logger[_0xf9b4('0x11')](_0xf9b4('0xd'),_0x30fc84,_0xf9b4('0xe'));_0x56866a(_0x1584ca[_0xf9b4('0x12')]['message']);}})[_0xf9b4('0x13')](function(_0x20a210){logger[_0xf9b4('0xf')](_0xf9b4('0xd'),_0x30fc84,_0x20a210);_0x375eb1(_0x20a210);});});}exports[_0xf9b4('0x14')]=function(_0x5731ec){var _0x2a1508=this;return new Promise(function(_0x2ae70a,_0x24e2ea){return db['SquareOdbc'][_0xf9b4('0x15')]({'raw':_0x5731ec[_0xf9b4('0x16')]?_0x5731ec[_0xf9b4('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5731ec[_0xf9b4('0x16')]?_0x5731ec[_0xf9b4('0x16')][_0xf9b4('0x17')]||null:null,'attributes':_0x5731ec[_0xf9b4('0x16')]?_0x5731ec[_0xf9b4('0x16')]['attributes']||null:null,'include':_0x5731ec[_0xf9b4('0x16')]?_0x5731ec[_0xf9b4('0x16')][_0xf9b4('0x18')]?_[_0xf9b4('0x19')](_0x5731ec[_0xf9b4('0x16')][_0xf9b4('0x18')],function(_0x12c4b7){return{'model':db[_0x12c4b7[_0xf9b4('0x1a')]],'as':_0x12c4b7['as'],'attributes':_0x12c4b7['attributes'],'include':_0x12c4b7[_0xf9b4('0x18')]?_[_0xf9b4('0x19')](_0x12c4b7['include'],function(_0xf7ad8f){return{'model':db[_0xf7ad8f['model']],'as':_0xf7ad8f['as'],'attributes':_0xf7ad8f[_0xf9b4('0x1b')],'include':_0xf7ad8f[_0xf9b4('0x18')]?_[_0xf9b4('0x19')](_0xf7ad8f['include'],function(_0x4b284b){return{'model':db[_0x4b284b[_0xf9b4('0x1a')]],'as':_0x4b284b['as'],'attributes':_0x4b284b[_0xf9b4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf9b4('0xc')](function(_0x2bac0d){logger[_0xf9b4('0x11')](_0xf9b4('0x14'),_0x5731ec);logger['debug']('ShowSquareOdbc',_0x5731ec,JSON[_0xf9b4('0x1c')](_0x2bac0d));_0x2ae70a(_0x2bac0d);})[_0xf9b4('0x13')](function(_0x3846c6){logger['error']('ShowSquareOdbc',_0x3846c6[_0xf9b4('0x10')],_0x5731ec);_0x24e2ea(_0x2a1508[_0xf9b4('0xf')](0x1f4,_0x3846c6[_0xf9b4('0x10')]));});});}; \ No newline at end of file +var _0x453b=['SquareOdbc,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','SquareOdbc','find','options','raw','include','map','attributes','model','debug','ShowSquareOdbc','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x453b,0x185));var _0xb453=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x453b[_0xcd0918];return _0x250704;};'use strict';var _=require('lodash');var util=require(_0xb453('0x0'));var moment=require('moment');var BPromise=require(_0xb453('0x1'));var rs=require(_0xb453('0x2'));var fs=require('fs');var Redis=require(_0xb453('0x3'));var db=require(_0xb453('0x4'))['db'];var utils=require(_0xb453('0x5'));var logger=require(_0xb453('0x6'))('rpc');var config=require(_0xb453('0x7'));var jayson=require(_0xb453('0x8'));var client=jayson[_0xb453('0x9')][_0xb453('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x846d9c,_0x39c512,_0x7efd6e){return new BPromise(function(_0x1cdf77,_0x5a1feb){return client[_0xb453('0xb')](_0x846d9c,_0x7efd6e)[_0xb453('0xc')](function(_0x499060){logger[_0xb453('0xd')](_0xb453('0xe'),_0x39c512,_0xb453('0xf'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x39c512,_0xb453('0xf'),JSON[_0xb453('0x10')](_0x499060));if(_0x499060[_0xb453('0x11')]){if(_0x499060[_0xb453('0x11')][_0xb453('0x12')]===0x1f4){logger['error'](_0xb453('0xe'),_0x39c512,_0x499060[_0xb453('0x11')][_0xb453('0x13')]);return _0x5a1feb(_0x499060[_0xb453('0x11')][_0xb453('0x13')]);}logger[_0xb453('0x11')](_0xb453('0xe'),_0x39c512,_0x499060[_0xb453('0x11')][_0xb453('0x13')]);return _0x1cdf77(_0x499060[_0xb453('0x11')][_0xb453('0x13')]);}else{logger[_0xb453('0xd')](_0xb453('0xe'),_0x39c512,_0xb453('0xf'));_0x1cdf77(_0x499060['result'][_0xb453('0x13')]);}})[_0xb453('0x14')](function(_0x2a12d9){logger[_0xb453('0x11')](_0xb453('0xe'),_0x39c512,_0x2a12d9);_0x5a1feb(_0x2a12d9);});});}exports['ShowSquareOdbc']=function(_0x595e46){var _0x2d9c63=this;return new Promise(function(_0x4f4561,_0x14bd12){return db[_0xb453('0x15')][_0xb453('0x16')]({'raw':_0x595e46[_0xb453('0x17')]?_0x595e46[_0xb453('0x17')][_0xb453('0x18')]===undefined?!![]:![]:!![],'where':_0x595e46['options']?_0x595e46[_0xb453('0x17')]['where']||null:null,'attributes':_0x595e46[_0xb453('0x17')]?_0x595e46['options']['attributes']||null:null,'include':_0x595e46[_0xb453('0x17')]?_0x595e46['options'][_0xb453('0x19')]?_[_0xb453('0x1a')](_0x595e46[_0xb453('0x17')][_0xb453('0x19')],function(_0xffece){return{'model':db[_0xffece['model']],'as':_0xffece['as'],'attributes':_0xffece[_0xb453('0x1b')],'include':_0xffece[_0xb453('0x19')]?_[_0xb453('0x1a')](_0xffece[_0xb453('0x19')],function(_0x3d3cc3){return{'model':db[_0x3d3cc3[_0xb453('0x1c')]],'as':_0x3d3cc3['as'],'attributes':_0x3d3cc3['attributes'],'include':_0x3d3cc3['include']?_[_0xb453('0x1a')](_0x3d3cc3[_0xb453('0x19')],function(_0x18ae24){return{'model':db[_0x18ae24[_0xb453('0x1c')]],'as':_0x18ae24['as'],'attributes':_0x18ae24[_0xb453('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb453('0xc')](function(_0xc682b6){logger['info']('ShowSquareOdbc',_0x595e46);logger[_0xb453('0x1d')]('ShowSquareOdbc',_0x595e46,JSON[_0xb453('0x10')](_0xc682b6));_0x4f4561(_0xc682b6);})[_0xb453('0x14')](function(_0x20cca0){logger[_0xb453('0x11')](_0xb453('0x1e'),_0x20cca0['message'],_0x595e46);_0x14bd12(_0x2d9c63['error'](0x1f4,_0x20cca0[_0xb453('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index a527f19..8e9d35c 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 _0xe493=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','getUsers','post','create','/:id/users','addUsers','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x2d6b24,_0x588802){var _0x3c9f62=function(_0x133787){while(--_0x133787){_0x2d6b24['push'](_0x2d6b24['shift']());}};_0x3c9f62(++_0x588802);}(_0xe493,0x7e));var _0x3e49=function(_0xaac2bb,_0x5829a4){_0xaac2bb=_0xaac2bb-0x0;var _0x226c65=_0xe493[_0xaac2bb];return _0x226c65;};'use strict';var multer=require(_0x3e49('0x0'));var util=require(_0x3e49('0x1'));var path=require(_0x3e49('0x2'));var timeout=require(_0x3e49('0x3'));var express=require(_0x3e49('0x4'));var router=express['Router']();var fs_extra=require(_0x3e49('0x5'));var auth=require(_0x3e49('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3e49('0x7'));var controller=require('./squareProject.controller');router[_0x3e49('0x8')]('/',auth[_0x3e49('0x9')](),controller[_0x3e49('0xa')]);router[_0x3e49('0x8')](_0x3e49('0xb'),auth[_0x3e49('0x9')](),controller['show']);router['get']('/:id/users',auth[_0x3e49('0x9')](),controller[_0x3e49('0xc')]);router[_0x3e49('0xd')]('/',auth[_0x3e49('0x9')](),controller[_0x3e49('0xe')]);router[_0x3e49('0xd')](_0x3e49('0xf'),auth[_0x3e49('0x9')](),controller[_0x3e49('0x10')]);router[_0x3e49('0x11')](_0x3e49('0xb'),auth['isAuthenticated'](),controller[_0x3e49('0x12')]);router[_0x3e49('0x13')]('/:id',auth[_0x3e49('0x9')](),controller[_0x3e49('0x14')]);router['delete'](_0x3e49('0xf'),auth[_0x3e49('0x9')](),controller['removeUsers']);module[_0x3e49('0x15')]=router; \ No newline at end of file +var _0xef6a=['../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/users','getUsers','create','post','put','update','delete','destroy','multer','util','path','Router','../../components/auth/service'];(function(_0x2f6822,_0x11935a){var _0x58665f=function(_0x15c47e){while(--_0x15c47e){_0x2f6822['push'](_0x2f6822['shift']());}};_0x58665f(++_0x11935a);}(_0xef6a,0x1e9));var _0xaef6=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xef6a[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0xaef6('0x0'));var util=require(_0xaef6('0x1'));var path=require(_0xaef6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaef6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xaef6('0x4'));var interaction=require(_0xaef6('0x5'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router['get']('/',auth[_0xaef6('0x6')](),controller[_0xaef6('0x7')]);router[_0xaef6('0x8')](_0xaef6('0x9'),auth[_0xaef6('0x6')](),controller[_0xaef6('0xa')]);router[_0xaef6('0x8')](_0xaef6('0xb'),auth['isAuthenticated'](),controller[_0xaef6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaef6('0xd')]);router[_0xaef6('0xe')]('/:id/users',auth[_0xaef6('0x6')](),controller['addUsers']);router[_0xaef6('0xf')](_0xaef6('0x9'),auth[_0xaef6('0x6')](),controller[_0xaef6('0x10')]);router[_0xaef6('0x11')](_0xaef6('0x9'),auth[_0xaef6('0x6')](),controller[_0xaef6('0x12')]);router[_0xaef6('0x11')](_0xaef6('0xb'),auth[_0xaef6('0x6')](),controller['removeUsers']);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 9b6e464..d4cef59 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 _0x8b5f=['TEXT','long','getDataValue','preproduction','toString','utf8','BLOB','production','DATE','STRING','name'];(function(_0x4b92fb,_0x252729){var _0x19b28c=function(_0x5ba703){while(--_0x5ba703){_0x4b92fb['push'](_0x4b92fb['shift']());}};_0x19b28c(++_0x252729);}(_0x8b5f,0x106));var _0xf8b5=function(_0x36d511,_0x54b1e1){_0x36d511=_0x36d511-0x0;var _0x58ea7b=_0x8b5f[_0x36d511];return _0x58ea7b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf8b5('0x0')],'unique':_0xf8b5('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xf8b5('0x2')]},'preproduction':{'type':Sequelize['BLOB'](_0xf8b5('0x3')),'get':function(){if(this[_0xf8b5('0x4')](_0xf8b5('0x5'))){return this[_0xf8b5('0x4')](_0xf8b5('0x5'))[_0xf8b5('0x6')](_0xf8b5('0x7'));}}},'production':{'type':Sequelize[_0xf8b5('0x8')](_0xf8b5('0x3')),'get':function(){if(this[_0xf8b5('0x4')](_0xf8b5('0x9'))){return this[_0xf8b5('0x4')](_0xf8b5('0x9'))[_0xf8b5('0x6')]('utf8');}}},'savedAt':{'type':Sequelize[_0xf8b5('0xa')]},'publishedAt':{'type':Sequelize[_0xf8b5('0xa')]}}; \ No newline at end of file +var _0xba38=['utf8','BLOB','production','DATE','exports','STRING','name','TEXT','long','getDataValue','preproduction','toString'];(function(_0x1a60c8,_0x5bf187){var _0x5046a8=function(_0x1995b2){while(--_0x1995b2){_0x1a60c8['push'](_0x1a60c8['shift']());}};_0x5046a8(++_0x5bf187);}(_0xba38,0x190));var _0x8ba3=function(_0x3fa2a1,_0x43b91a){_0x3fa2a1=_0x3fa2a1-0x0;var _0x888218=_0xba38[_0x3fa2a1];return _0x888218;};'use strict';var Sequelize=require('sequelize');module[_0x8ba3('0x0')]={'name':{'type':Sequelize[_0x8ba3('0x1')],'unique':_0x8ba3('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x8ba3('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0x8ba3('0x4')),'get':function(){if(this[_0x8ba3('0x5')](_0x8ba3('0x6'))){return this[_0x8ba3('0x5')](_0x8ba3('0x6'))[_0x8ba3('0x7')](_0x8ba3('0x8'));}}},'production':{'type':Sequelize[_0x8ba3('0x9')](_0x8ba3('0x4')),'get':function(){if(this[_0x8ba3('0x5')](_0x8ba3('0xa'))){return this[_0x8ba3('0x5')]('production')[_0x8ba3('0x7')](_0x8ba3('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x8ba3('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 979d865..f071973 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 _0x4ed6=['nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','removeUsers','emit','userSquareProject:remove','findOne','order','getUsers','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','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','then','SquareProjects','UserProfileResource','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty'];(function(_0x205081,_0x46c72d){var _0x8b1110=function(_0x454a6b){while(--_0x454a6b){_0x205081['push'](_0x205081['shift']());}};_0x8b1110(++_0x46c72d);}(_0x4ed6,0x15a));var _0x64ed=function(_0x5566ca,_0x296ea6){_0x5566ca=_0x5566ca-0x0;var _0x3eb22d=_0x4ed6[_0x5566ca];return _0x3eb22d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x64ed('0x0'));var zipdir=require(_0x64ed('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x64ed('0x2'));var moment=require(_0x64ed('0x3'));var BPromise=require(_0x64ed('0x4'));var Mustache=require(_0x64ed('0x5'));var util=require(_0x64ed('0x6'));var path=require(_0x64ed('0x7'));var sox=require(_0x64ed('0x8'));var csv=require(_0x64ed('0x9'));var ejs=require(_0x64ed('0xa'));var fs=require('fs');var fs_extra=require(_0x64ed('0xb'));var _=require(_0x64ed('0xc'));var squel=require(_0x64ed('0xd'));var crypto=require(_0x64ed('0xe'));var jsforce=require(_0x64ed('0xf'));var deskjs=require(_0x64ed('0x10'));var toCsv=require('to-csv');var querystring=require(_0x64ed('0x11'));var Papa=require(_0x64ed('0x12'));var Redis=require(_0x64ed('0x13'));var authService=require(_0x64ed('0x14'));var qs=require(_0x64ed('0x15'));var as=require(_0x64ed('0x16'));var hardwareService=require(_0x64ed('0x17'));var logger=require('../../config/logger')(_0x64ed('0x18'));var utils=require(_0x64ed('0x19'));var config=require(_0x64ed('0x1a'));var licenseUtil=require(_0x64ed('0x1b'));var db=require('../../mysqldb')['db'];config[_0x64ed('0x1c')]=_[_0x64ed('0x1d')](config[_0x64ed('0x1c')],{'host':_0x64ed('0x1e'),'port':0x18eb});var socket=require(_0x64ed('0x1f'))(new Redis(config[_0x64ed('0x1c')]));require(_0x64ed('0x20'))[_0x64ed('0x21')](socket);function respondWithStatusCode(_0x23700b,_0x275580){_0x275580=_0x275580||0xcc;return function(_0x1f906e){if(_0x1f906e){return _0x23700b[_0x64ed('0x22')](_0x275580);}return _0x23700b[_0x64ed('0x23')](_0x275580)[_0x64ed('0x24')]();};}function respondWithResult(_0x5b7598,_0xce6176){_0xce6176=_0xce6176||0xc8;return function(_0x91afa3){if(_0x91afa3){return _0x5b7598[_0x64ed('0x23')](_0xce6176)[_0x64ed('0x25')](_0x91afa3);}};}function respondWithFilteredResult(_0x22b6c7,_0x54d70f){return function(_0x634585){if(_0x634585){var _0x826b6e=typeof _0x54d70f['offset']===_0x64ed('0x26')&&typeof _0x54d70f[_0x64ed('0x27')]===_0x64ed('0x26');var _0x4fd0c7=_0x634585[_0x64ed('0x28')];var _0x37fac5=_0x826b6e?0x0:_0x54d70f[_0x64ed('0x29')];var _0x568faf=_0x826b6e?_0x634585[_0x64ed('0x28')]:_0x54d70f[_0x64ed('0x29')]+_0x54d70f[_0x64ed('0x27')];var _0x4999e8;if(_0x568faf>=_0x4fd0c7){_0x568faf=_0x4fd0c7;_0x4999e8=0xc8;}else{_0x4999e8=0xce;}_0x22b6c7[_0x64ed('0x23')](_0x4999e8);return _0x22b6c7[_0x64ed('0x2a')](_0x64ed('0x2b'),_0x37fac5+'-'+_0x568faf+'/'+_0x4fd0c7)[_0x64ed('0x25')](_0x634585);}return null;};}function patchUpdates(_0x1da7dd){return function(_0x150452){try{jsonpatch[_0x64ed('0x2c')](_0x150452,_0x1da7dd,!![]);}catch(_0x1a9af8){return BPromise[_0x64ed('0x2d')](_0x1a9af8);}return _0x150452['save']();};}function saveUpdates(_0x29af42,_0x56bb40){return function(_0x3d0325){if(_0x3d0325){return _0x3d0325['update'](_0x29af42)['then'](function(_0x5d1157){return _0x5d1157;});}return null;};}function removeEntity(_0xfbdfe3,_0x33711f){return function(_0xf93a50){if(_0xf93a50){return _0xf93a50[_0x64ed('0x2e')]()[_0x64ed('0x2f')](function(){var _0x269bb2=_0xf93a50['get']({'plain':!![]});var _0x229fb5=_0x64ed('0x30');return db[_0x64ed('0x31')][_0x64ed('0x2e')]({'where':{'type':_0x229fb5,'resourceId':_0x269bb2['id']}})[_0x64ed('0x2f')](function(){return _0xf93a50;});})['then'](function(){_0xfbdfe3['status'](0xcc)[_0x64ed('0x24')]();});}};}function handleEntityNotFound(_0x4d7c70,_0x49f347){return function(_0x11ab31){if(!_0x11ab31){_0x4d7c70[_0x64ed('0x22')](0x194);}return _0x11ab31;};}function handleError(_0x19450b,_0x3c1551){_0x3c1551=_0x3c1551||0x1f4;return function(_0x44b889){logger['error'](_0x44b889[_0x64ed('0x32')]);if(_0x44b889['name']){delete _0x44b889[_0x64ed('0x33')];}_0x19450b['status'](_0x3c1551)[_0x64ed('0x34')](_0x44b889);};}exports[_0x64ed('0x35')]=function(_0x256c66,_0x230e62){var _0x55b40d={},_0x3c7063={},_0x3c8979={'count':0x0,'rows':[]};var _0x1b1048=_[_0x64ed('0x36')](db[_0x64ed('0x37')][_0x64ed('0x38')],function(_0x2d3ac0){return{'name':_0x2d3ac0[_0x64ed('0x39')],'type':_0x2d3ac0[_0x64ed('0x3a')]['key']};});_0x3c7063[_0x64ed('0x3b')]=_['map'](_0x1b1048,'name');_0x3c7063[_0x64ed('0x3c')]=_[_0x64ed('0x3d')](_0x256c66['query']);_0x3c7063['filters']=_[_0x64ed('0x3e')](_0x3c7063[_0x64ed('0x3b')],_0x3c7063[_0x64ed('0x3c')]);_0x55b40d['attributes']=_[_0x64ed('0x3e')](_0x3c7063[_0x64ed('0x3b')],qs['fields'](_0x256c66['query'][_0x64ed('0x3f')]));_0x55b40d[_0x64ed('0x40')]=_0x55b40d['attributes']['length']?_0x55b40d[_0x64ed('0x40')]:_0x3c7063[_0x64ed('0x3b')];if(!_0x256c66[_0x64ed('0x3c')][_0x64ed('0x41')](_0x64ed('0x42'))){_0x55b40d['limit']=qs[_0x64ed('0x27')](_0x256c66[_0x64ed('0x3c')][_0x64ed('0x27')]);_0x55b40d['offset']=qs[_0x64ed('0x29')](_0x256c66['query']['offset']);}_0x55b40d['order']=qs[_0x64ed('0x43')](_0x256c66['query']['sort']);_0x55b40d[_0x64ed('0x44')]=qs[_0x64ed('0x45')](_[_0x64ed('0x46')](_0x256c66[_0x64ed('0x3c')],_0x3c7063[_0x64ed('0x45')]),_0x1b1048);if(_0x256c66[_0x64ed('0x3c')]['filter']){_0x55b40d[_0x64ed('0x44')]=_[_0x64ed('0x47')](_0x55b40d[_0x64ed('0x44')],{'$or':_[_0x64ed('0x36')](_0x1b1048,function(_0x46ba65){if(_0x46ba65[_0x64ed('0x3a')]!==_0x64ed('0x48')){var _0x3cefd0={};_0x3cefd0[_0x46ba65[_0x64ed('0x33')]]={'$like':'%'+_0x256c66[_0x64ed('0x3c')][_0x64ed('0x49')]+'%'};return _0x3cefd0;}})});}_0x55b40d=_[_0x64ed('0x47')]({},_0x55b40d,_0x256c66[_0x64ed('0x4a')]);var _0x34ab5b={'where':_0x55b40d[_0x64ed('0x44')]};return db[_0x64ed('0x37')][_0x64ed('0x28')](_0x34ab5b)['then'](function(_0x17ca7e){_0x3c8979[_0x64ed('0x28')]=_0x17ca7e;if(_0x256c66[_0x64ed('0x3c')][_0x64ed('0x4b')]){_0x55b40d['include']=[{'all':!![]}];}return db[_0x64ed('0x37')][_0x64ed('0x4c')](_0x55b40d);})[_0x64ed('0x2f')](function(_0x145017){_0x3c8979[_0x64ed('0x4d')]=_0x145017;return _0x3c8979;})[_0x64ed('0x2f')](respondWithFilteredResult(_0x230e62,_0x55b40d))[_0x64ed('0x4e')](handleError(_0x230e62,null));};exports[_0x64ed('0x4f')]=function(_0x1e614c,_0xeafb7b){var _0x563a77={'raw':![],'where':{'id':_0x1e614c[_0x64ed('0x50')]['id']}},_0x166014={};_0x166014[_0x64ed('0x3b')]=_[_0x64ed('0x3d')](db[_0x64ed('0x37')]['rawAttributes']);_0x166014['query']=_[_0x64ed('0x3d')](_0x1e614c[_0x64ed('0x3c')]);_0x166014[_0x64ed('0x45')]=_[_0x64ed('0x3e')](_0x166014['model'],_0x166014[_0x64ed('0x3c')]);_0x563a77['attributes']=_[_0x64ed('0x3e')](_0x166014[_0x64ed('0x3b')],qs[_0x64ed('0x3f')](_0x1e614c['query'][_0x64ed('0x3f')]));_0x563a77[_0x64ed('0x40')]=_0x563a77[_0x64ed('0x40')][_0x64ed('0x51')]?_0x563a77['attributes']:_0x166014[_0x64ed('0x3b')];if(_0x1e614c[_0x64ed('0x3c')][_0x64ed('0x4b')]){_0x563a77[_0x64ed('0x52')]=[{'all':!![]}];}_0x563a77=_[_0x64ed('0x47')]({},_0x563a77,_0x1e614c['options']);return db[_0x64ed('0x37')]['find'](_0x563a77)['then'](handleEntityNotFound(_0xeafb7b,null))[_0x64ed('0x2f')](respondWithResult(_0xeafb7b,null))[_0x64ed('0x4e')](handleError(_0xeafb7b,null));};exports['create']=function(_0x22bc89,_0x4f5749){return db['SquareProject'][_0x64ed('0x53')](_0x22bc89[_0x64ed('0x54')],{})['then'](function(_0xa359b6){var _0x65c1a7=_0x22bc89[_0x64ed('0x55')][_0x64ed('0x56')]({'plain':!![]});if(!_0x65c1a7)throw new Error(_0x64ed('0x57'));if(_0x65c1a7[_0x64ed('0x58')]==='user'){var _0x10f502=_0xa359b6['get']({'plain':!![]});var _0x2d5650=_0x64ed('0x30');return db[_0x64ed('0x59')][_0x64ed('0x5a')]({'where':{'name':_0x2d5650,'userProfileId':_0x65c1a7[_0x64ed('0x5b')]},'raw':!![]})[_0x64ed('0x2f')](function(_0x56e27c){if(_0x56e27c&&_0x56e27c[_0x64ed('0x5c')]===0x0){return db['UserProfileResource'][_0x64ed('0x53')]({'name':_0x10f502[_0x64ed('0x33')],'resourceId':_0x10f502['id'],'type':_0x56e27c[_0x64ed('0x33')],'sectionId':_0x56e27c['id']},{})[_0x64ed('0x2f')](function(){return _0xa359b6;});}else{return _0xa359b6;}})[_0x64ed('0x4e')](function(_0x424332){logger['error'](_0x64ed('0x5d'),_0x424332);throw _0x424332;});}return _0xa359b6;})[_0x64ed('0x2f')](respondWithResult(_0x4f5749,0xc9))['catch'](handleError(_0x4f5749,null));};exports[_0x64ed('0x5e')]=function(_0x2d1c3a,_0x108cf8){if(_0x2d1c3a[_0x64ed('0x54')]['id']){delete _0x2d1c3a[_0x64ed('0x54')]['id'];}return db['SquareProject'][_0x64ed('0x5a')]({'where':{'id':_0x2d1c3a[_0x64ed('0x50')]['id']}})['then'](handleEntityNotFound(_0x108cf8,null))[_0x64ed('0x2f')](saveUpdates(_0x2d1c3a['body'],null))[_0x64ed('0x2f')](respondWithResult(_0x108cf8,null))[_0x64ed('0x4e')](handleError(_0x108cf8,null));};exports[_0x64ed('0x2e')]=function(_0x1bee8a,_0x2947bb){return db[_0x64ed('0x37')][_0x64ed('0x5a')]({'where':{'id':_0x1bee8a['params']['id']}})[_0x64ed('0x2f')](handleEntityNotFound(_0x2947bb,null))[_0x64ed('0x2f')](removeEntity(_0x2947bb,null))[_0x64ed('0x4e')](handleError(_0x2947bb,null));};exports[_0x64ed('0x5f')]=function(_0x582625,_0x5d02a8,_0x3b311a){return db['SquareProject'][_0x64ed('0x5a')]({'where':{'id':_0x582625[_0x64ed('0x50')]['id']}})['then'](handleEntityNotFound(_0x5d02a8,null))[_0x64ed('0x2f')](function(_0xc5a1c7){if(_0xc5a1c7){return _0xc5a1c7[_0x64ed('0x5f')](_0x582625[_0x64ed('0x54')][_0x64ed('0x60')],_['omit'](_0x582625[_0x64ed('0x54')],[_0x64ed('0x60'),'id'])||{});}})['then'](respondWithResult(_0x5d02a8,null))[_0x64ed('0x4e')](handleError(_0x5d02a8,null));};exports['removeUsers']=function(_0x5861f1,_0x311b4e,_0x172693){return db[_0x64ed('0x37')]['find']({'where':{'id':_0x5861f1[_0x64ed('0x50')]['id']}})[_0x64ed('0x2f')](handleEntityNotFound(_0x311b4e,null))[_0x64ed('0x2f')](function(_0x4abbf5){if(_0x4abbf5){return _0x4abbf5[_0x64ed('0x61')](_0x5861f1[_0x64ed('0x3c')][_0x64ed('0x60')])[_0x64ed('0x2f')](function(){if(_['isArray'](_0x5861f1[_0x64ed('0x3c')][_0x64ed('0x60')])){for(var _0x2ab58b=0x0;_0x2ab58b<_0x5861f1['query'][_0x64ed('0x60')][_0x64ed('0x51')];_0x2ab58b+=0x1){socket[_0x64ed('0x62')](_0x64ed('0x63'),{'UserId':Number(_0x5861f1[_0x64ed('0x3c')][_0x64ed('0x60')][_0x2ab58b]),'SquareProjectId':Number(_0x5861f1[_0x64ed('0x50')]['id'])});}}else{socket['emit'](_0x64ed('0x63'),{'UserId':Number(_0x5861f1[_0x64ed('0x3c')][_0x64ed('0x60')]),'SquareProjectId':Number(_0x5861f1[_0x64ed('0x50')]['id'])});}});}})[_0x64ed('0x2f')](respondWithStatusCode(_0x311b4e,null))[_0x64ed('0x4e')](handleError(_0x311b4e,null));};exports['getUsers']=function(_0x4a1e0a,_0x5dbd38,_0x5aebd6){var _0xa44ae9={};var _0x42efd0={};var _0xe788c9;var _0x52fe91;return db[_0x64ed('0x37')][_0x64ed('0x64')]({'where':{'id':_0x4a1e0a['params']['id']}})[_0x64ed('0x2f')](handleEntityNotFound(_0x5dbd38,null))[_0x64ed('0x2f')](function(_0x1dfd44){if(_0x1dfd44){_0xe788c9=_0x1dfd44;_0x42efd0['model']=_[_0x64ed('0x3d')](db['User'][_0x64ed('0x38')]);_0x42efd0[_0x64ed('0x3c')]=_['keys'](_0x4a1e0a[_0x64ed('0x3c')]);_0x42efd0[_0x64ed('0x45')]=_[_0x64ed('0x3e')](_0x42efd0['model'],_0x42efd0[_0x64ed('0x3c')]);_0xa44ae9[_0x64ed('0x40')]=_[_0x64ed('0x3e')](_0x42efd0['model'],qs['fields'](_0x4a1e0a[_0x64ed('0x3c')][_0x64ed('0x3f')]));_0xa44ae9['attributes']=_0xa44ae9['attributes']['length']?_0xa44ae9[_0x64ed('0x40')]:_0x42efd0[_0x64ed('0x3b')];_0xa44ae9[_0x64ed('0x65')]=qs[_0x64ed('0x43')](_0x4a1e0a[_0x64ed('0x3c')]['sort']);_0xa44ae9[_0x64ed('0x44')]=qs[_0x64ed('0x45')](_[_0x64ed('0x46')](_0x4a1e0a[_0x64ed('0x3c')],_0x42efd0['filters']));if(_0x4a1e0a[_0x64ed('0x3c')][_0x64ed('0x49')]){_0xa44ae9[_0x64ed('0x44')]=_['merge'](_0xa44ae9[_0x64ed('0x44')],{'$or':_[_0x64ed('0x36')](_0xa44ae9[_0x64ed('0x40')],function(_0x33ec55){var _0x51c56b={};_0x51c56b[_0x33ec55]={'$like':'%'+_0x4a1e0a['query'][_0x64ed('0x49')]+'%'};return _0x51c56b;})});}_0xa44ae9=_['merge']({},_0xa44ae9,_0x4a1e0a['options']);return _0xe788c9[_0x64ed('0x66')](_0xa44ae9);}})['then'](function(_0xf8e303){if(_0xf8e303){_0x52fe91=_0xf8e303[_0x64ed('0x51')];if(!_0x4a1e0a[_0x64ed('0x3c')][_0x64ed('0x41')](_0x64ed('0x42'))){_0xa44ae9[_0x64ed('0x27')]=qs[_0x64ed('0x27')](_0x4a1e0a[_0x64ed('0x3c')][_0x64ed('0x27')]);_0xa44ae9[_0x64ed('0x29')]=qs['offset'](_0x4a1e0a[_0x64ed('0x3c')][_0x64ed('0x29')]);}return _0xe788c9[_0x64ed('0x66')](_0xa44ae9);}})[_0x64ed('0x2f')](function(_0x35cc45){if(_0x35cc45){return _0x35cc45?{'count':_0x52fe91,'rows':_0x35cc45}:null;}})[_0x64ed('0x2f')](respondWithResult(_0x5dbd38,null))[_0x64ed('0x4e')](handleError(_0x5dbd38,null));}; \ No newline at end of file +var _0xe616=['query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','params','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','User','options','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','get','SquareProjects','error','name','send','index','map','SquareProject','rawAttributes','fieldName','key','model'];(function(_0x291d5c,_0x384244){var _0x9a75ff=function(_0x58ea4f){while(--_0x58ea4f){_0x291d5c['push'](_0x291d5c['shift']());}};_0x9a75ff(++_0x384244);}(_0xe616,0x1b6));var _0x6e61=function(_0x50be03,_0x10e55f){_0x50be03=_0x50be03-0x0;var _0x5364e7=_0xe616[_0x50be03];return _0x5364e7;};'use strict';var emlformat=require(_0x6e61('0x0'));var rimraf=require(_0x6e61('0x1'));var zipdir=require(_0x6e61('0x2'));var jsonpatch=require(_0x6e61('0x3'));var rp=require('request-promise');var moment=require(_0x6e61('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6e61('0x5'));var util=require('util');var path=require(_0x6e61('0x6'));var sox=require(_0x6e61('0x7'));var csv=require(_0x6e61('0x8'));var ejs=require(_0x6e61('0x9'));var fs=require('fs');var fs_extra=require(_0x6e61('0xa'));var _=require('lodash');var squel=require(_0x6e61('0xb'));var crypto=require(_0x6e61('0xc'));var jsforce=require(_0x6e61('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6e61('0xe'));var Papa=require(_0x6e61('0xf'));var Redis=require(_0x6e61('0x10'));var authService=require(_0x6e61('0x11'));var qs=require(_0x6e61('0x12'));var as=require(_0x6e61('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e61('0x14'))(_0x6e61('0x15'));var utils=require(_0x6e61('0x16'));var config=require(_0x6e61('0x17'));var licenseUtil=require(_0x6e61('0x18'));var db=require(_0x6e61('0x19'))['db'];config[_0x6e61('0x1a')]=_[_0x6e61('0x1b')](config[_0x6e61('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x6e61('0x1c'))(new Redis(config[_0x6e61('0x1a')]));require(_0x6e61('0x1d'))[_0x6e61('0x1e')](socket);function respondWithStatusCode(_0x268bba,_0x544cc3){_0x544cc3=_0x544cc3||0xcc;return function(_0x1c7bb4){if(_0x1c7bb4){return _0x268bba[_0x6e61('0x1f')](_0x544cc3);}return _0x268bba[_0x6e61('0x20')](_0x544cc3)[_0x6e61('0x21')]();};}function respondWithResult(_0x2c2239,_0x51ca22){_0x51ca22=_0x51ca22||0xc8;return function(_0x2e5010){if(_0x2e5010){return _0x2c2239[_0x6e61('0x20')](_0x51ca22)[_0x6e61('0x22')](_0x2e5010);}};}function respondWithFilteredResult(_0x78158,_0x2dbafc){return function(_0xfd0f27){if(_0xfd0f27){var _0x379b6e=typeof _0x2dbafc[_0x6e61('0x23')]==='undefined'&&typeof _0x2dbafc[_0x6e61('0x24')]===_0x6e61('0x25');var _0x20473e=_0xfd0f27['count'];var _0x11fca8=_0x379b6e?0x0:_0x2dbafc[_0x6e61('0x23')];var _0x174f31=_0x379b6e?_0xfd0f27[_0x6e61('0x26')]:_0x2dbafc[_0x6e61('0x23')]+_0x2dbafc[_0x6e61('0x24')];var _0x4c0a99;if(_0x174f31>=_0x20473e){_0x174f31=_0x20473e;_0x4c0a99=0xc8;}else{_0x4c0a99=0xce;}_0x78158[_0x6e61('0x20')](_0x4c0a99);return _0x78158['set'](_0x6e61('0x27'),_0x11fca8+'-'+_0x174f31+'/'+_0x20473e)[_0x6e61('0x22')](_0xfd0f27);}return null;};}function patchUpdates(_0x1c6be4){return function(_0x3732bc){try{jsonpatch[_0x6e61('0x28')](_0x3732bc,_0x1c6be4,!![]);}catch(_0x5f5b5c){return BPromise[_0x6e61('0x29')](_0x5f5b5c);}return _0x3732bc['save']();};}function saveUpdates(_0x1a238c,_0x3017f7){return function(_0x5a94cd){if(_0x5a94cd){return _0x5a94cd[_0x6e61('0x2a')](_0x1a238c)[_0x6e61('0x2b')](function(_0xc9b3ab){return _0xc9b3ab;});}return null;};}function removeEntity(_0x45f57d,_0x262782){return function(_0x45c860){if(_0x45c860){return _0x45c860[_0x6e61('0x2c')]()[_0x6e61('0x2b')](function(){var _0x2f59a9=_0x45c860[_0x6e61('0x2d')]({'plain':!![]});var _0x3a2911=_0x6e61('0x2e');return db['UserProfileResource'][_0x6e61('0x2c')]({'where':{'type':_0x3a2911,'resourceId':_0x2f59a9['id']}})['then'](function(){return _0x45c860;});})[_0x6e61('0x2b')](function(){_0x45f57d[_0x6e61('0x20')](0xcc)[_0x6e61('0x21')]();});}};}function handleEntityNotFound(_0x2de987,_0x46436c){return function(_0x10e96d){if(!_0x10e96d){_0x2de987['sendStatus'](0x194);}return _0x10e96d;};}function handleError(_0x51fb4f,_0x44f422){_0x44f422=_0x44f422||0x1f4;return function(_0x26c5bd){logger[_0x6e61('0x2f')](_0x26c5bd['stack']);if(_0x26c5bd[_0x6e61('0x30')]){delete _0x26c5bd[_0x6e61('0x30')];}_0x51fb4f[_0x6e61('0x20')](_0x44f422)[_0x6e61('0x31')](_0x26c5bd);};}exports[_0x6e61('0x32')]=function(_0x646a22,_0x2f89d7){var _0x40d10b={},_0x32f40d={},_0x4603fd={'count':0x0,'rows':[]};var _0x2bfbbd=_[_0x6e61('0x33')](db[_0x6e61('0x34')][_0x6e61('0x35')],function(_0x126b08){return{'name':_0x126b08[_0x6e61('0x36')],'type':_0x126b08['type'][_0x6e61('0x37')]};});_0x32f40d[_0x6e61('0x38')]=_[_0x6e61('0x33')](_0x2bfbbd,'name');_0x32f40d[_0x6e61('0x39')]=_[_0x6e61('0x3a')](_0x646a22[_0x6e61('0x39')]);_0x32f40d[_0x6e61('0x3b')]=_[_0x6e61('0x3c')](_0x32f40d[_0x6e61('0x38')],_0x32f40d[_0x6e61('0x39')]);_0x40d10b[_0x6e61('0x3d')]=_[_0x6e61('0x3c')](_0x32f40d[_0x6e61('0x38')],qs['fields'](_0x646a22['query'][_0x6e61('0x3e')]));_0x40d10b[_0x6e61('0x3d')]=_0x40d10b[_0x6e61('0x3d')][_0x6e61('0x3f')]?_0x40d10b[_0x6e61('0x3d')]:_0x32f40d[_0x6e61('0x38')];if(!_0x646a22[_0x6e61('0x39')]['hasOwnProperty']('nolimit')){_0x40d10b[_0x6e61('0x24')]=qs['limit'](_0x646a22[_0x6e61('0x39')]['limit']);_0x40d10b[_0x6e61('0x23')]=qs[_0x6e61('0x23')](_0x646a22[_0x6e61('0x39')][_0x6e61('0x23')]);}_0x40d10b[_0x6e61('0x40')]=qs[_0x6e61('0x41')](_0x646a22[_0x6e61('0x39')]['sort']);_0x40d10b[_0x6e61('0x42')]=qs['filters'](_[_0x6e61('0x43')](_0x646a22[_0x6e61('0x39')],_0x32f40d[_0x6e61('0x3b')]),_0x2bfbbd);if(_0x646a22[_0x6e61('0x39')][_0x6e61('0x44')]){_0x40d10b[_0x6e61('0x42')]=_['merge'](_0x40d10b['where'],{'$or':_[_0x6e61('0x33')](_0x2bfbbd,function(_0x31985b){if(_0x31985b['type']!==_0x6e61('0x45')){var _0x19e2ff={};_0x19e2ff[_0x31985b[_0x6e61('0x30')]]={'$like':'%'+_0x646a22['query'][_0x6e61('0x44')]+'%'};return _0x19e2ff;}})});}_0x40d10b=_[_0x6e61('0x46')]({},_0x40d10b,_0x646a22['options']);var _0xf360e={'where':_0x40d10b[_0x6e61('0x42')]};return db[_0x6e61('0x34')][_0x6e61('0x26')](_0xf360e)[_0x6e61('0x2b')](function(_0x49b26d){_0x4603fd['count']=_0x49b26d;if(_0x646a22['query'][_0x6e61('0x47')]){_0x40d10b['include']=[{'all':!![]}];}return db[_0x6e61('0x34')][_0x6e61('0x48')](_0x40d10b);})[_0x6e61('0x2b')](function(_0x42fe67){_0x4603fd[_0x6e61('0x49')]=_0x42fe67;return _0x4603fd;})[_0x6e61('0x2b')](respondWithFilteredResult(_0x2f89d7,_0x40d10b))['catch'](handleError(_0x2f89d7,null));};exports['show']=function(_0x52dd81,_0x389902){var _0x41d2e8={'raw':![],'where':{'id':_0x52dd81[_0x6e61('0x4a')]['id']}},_0x14e836={};_0x14e836[_0x6e61('0x38')]=_[_0x6e61('0x3a')](db['SquareProject']['rawAttributes']);_0x14e836['query']=_[_0x6e61('0x3a')](_0x52dd81['query']);_0x14e836[_0x6e61('0x3b')]=_[_0x6e61('0x3c')](_0x14e836[_0x6e61('0x38')],_0x14e836[_0x6e61('0x39')]);_0x41d2e8[_0x6e61('0x3d')]=_[_0x6e61('0x3c')](_0x14e836[_0x6e61('0x38')],qs['fields'](_0x52dd81[_0x6e61('0x39')][_0x6e61('0x3e')]));_0x41d2e8[_0x6e61('0x3d')]=_0x41d2e8[_0x6e61('0x3d')][_0x6e61('0x3f')]?_0x41d2e8[_0x6e61('0x3d')]:_0x14e836[_0x6e61('0x38')];if(_0x52dd81['query'][_0x6e61('0x47')]){_0x41d2e8[_0x6e61('0x4b')]=[{'all':!![]}];}_0x41d2e8=_[_0x6e61('0x46')]({},_0x41d2e8,_0x52dd81['options']);return db[_0x6e61('0x34')][_0x6e61('0x4c')](_0x41d2e8)[_0x6e61('0x2b')](handleEntityNotFound(_0x389902,null))['then'](respondWithResult(_0x389902,null))[_0x6e61('0x4d')](handleError(_0x389902,null));};exports[_0x6e61('0x4e')]=function(_0x19803,_0x2cfa26){return db[_0x6e61('0x34')][_0x6e61('0x4e')](_0x19803[_0x6e61('0x4f')],{})[_0x6e61('0x2b')](function(_0x3c1424){var _0x4057d0=_0x19803['user'][_0x6e61('0x2d')]({'plain':!![]});if(!_0x4057d0)throw new Error(_0x6e61('0x50'));if(_0x4057d0['role']===_0x6e61('0x51')){var _0x30bee8=_0x3c1424[_0x6e61('0x2d')]({'plain':!![]});var _0x3cedbc=_0x6e61('0x2e');return db[_0x6e61('0x52')][_0x6e61('0x4c')]({'where':{'name':_0x3cedbc,'userProfileId':_0x4057d0[_0x6e61('0x53')]},'raw':!![]})[_0x6e61('0x2b')](function(_0x41bcc2){if(_0x41bcc2&&_0x41bcc2[_0x6e61('0x54')]===0x0){return db[_0x6e61('0x55')][_0x6e61('0x4e')]({'name':_0x30bee8[_0x6e61('0x30')],'resourceId':_0x30bee8['id'],'type':_0x41bcc2['name'],'sectionId':_0x41bcc2['id']},{})[_0x6e61('0x2b')](function(){return _0x3c1424;});}else{return _0x3c1424;}})[_0x6e61('0x4d')](function(_0x4a735e){logger['error'](_0x6e61('0x56'),_0x4a735e);throw _0x4a735e;});}return _0x3c1424;})[_0x6e61('0x2b')](respondWithResult(_0x2cfa26,0xc9))[_0x6e61('0x4d')](handleError(_0x2cfa26,null));};exports[_0x6e61('0x2a')]=function(_0x37e631,_0x33a8af){if(_0x37e631['body']['id']){delete _0x37e631[_0x6e61('0x4f')]['id'];}return db[_0x6e61('0x34')][_0x6e61('0x4c')]({'where':{'id':_0x37e631['params']['id']}})[_0x6e61('0x2b')](handleEntityNotFound(_0x33a8af,null))['then'](saveUpdates(_0x37e631['body'],null))[_0x6e61('0x2b')](respondWithResult(_0x33a8af,null))[_0x6e61('0x4d')](handleError(_0x33a8af,null));};exports['destroy']=function(_0x517b24,_0x3161c5){return db[_0x6e61('0x34')][_0x6e61('0x4c')]({'where':{'id':_0x517b24['params']['id']}})[_0x6e61('0x2b')](handleEntityNotFound(_0x3161c5,null))[_0x6e61('0x2b')](removeEntity(_0x3161c5,null))['catch'](handleError(_0x3161c5,null));};exports[_0x6e61('0x57')]=function(_0x1e6a4b,_0x37bc4e,_0x5be2c6){return db[_0x6e61('0x34')][_0x6e61('0x4c')]({'where':{'id':_0x1e6a4b['params']['id']}})['then'](handleEntityNotFound(_0x37bc4e,null))[_0x6e61('0x2b')](function(_0x2e746d){if(_0x2e746d){return _0x2e746d[_0x6e61('0x57')](_0x1e6a4b[_0x6e61('0x4f')][_0x6e61('0x58')],_['omit'](_0x1e6a4b[_0x6e61('0x4f')],['ids','id'])||{});}})[_0x6e61('0x2b')](respondWithResult(_0x37bc4e,null))['catch'](handleError(_0x37bc4e,null));};exports['removeUsers']=function(_0x150faf,_0x4d06ab,_0x2bea1d){return db['SquareProject']['find']({'where':{'id':_0x150faf[_0x6e61('0x4a')]['id']}})[_0x6e61('0x2b')](handleEntityNotFound(_0x4d06ab,null))['then'](function(_0x58d0d6){if(_0x58d0d6){return _0x58d0d6[_0x6e61('0x59')](_0x150faf['query'][_0x6e61('0x58')])['then'](function(){if(_[_0x6e61('0x5a')](_0x150faf[_0x6e61('0x39')][_0x6e61('0x58')])){for(var _0x4f9a1c=0x0;_0x4f9a1c<_0x150faf[_0x6e61('0x39')][_0x6e61('0x58')][_0x6e61('0x3f')];_0x4f9a1c+=0x1){socket['emit'](_0x6e61('0x5b'),{'UserId':Number(_0x150faf[_0x6e61('0x39')]['ids'][_0x4f9a1c]),'SquareProjectId':Number(_0x150faf[_0x6e61('0x4a')]['id'])});}}else{socket[_0x6e61('0x5c')](_0x6e61('0x5b'),{'UserId':Number(_0x150faf[_0x6e61('0x39')][_0x6e61('0x58')]),'SquareProjectId':Number(_0x150faf[_0x6e61('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x4d06ab,null))['catch'](handleError(_0x4d06ab,null));};exports[_0x6e61('0x5d')]=function(_0x45ac38,_0x382511,_0x41d800){var _0x1dcffc={};var _0x4edf1e={};var _0x1af98a;var _0x4c7d63;return db['SquareProject'][_0x6e61('0x5e')]({'where':{'id':_0x45ac38[_0x6e61('0x4a')]['id']}})[_0x6e61('0x2b')](handleEntityNotFound(_0x382511,null))['then'](function(_0x5e2f39){if(_0x5e2f39){_0x1af98a=_0x5e2f39;_0x4edf1e[_0x6e61('0x38')]=_['keys'](db[_0x6e61('0x5f')][_0x6e61('0x35')]);_0x4edf1e['query']=_[_0x6e61('0x3a')](_0x45ac38['query']);_0x4edf1e[_0x6e61('0x3b')]=_[_0x6e61('0x3c')](_0x4edf1e['model'],_0x4edf1e['query']);_0x1dcffc[_0x6e61('0x3d')]=_[_0x6e61('0x3c')](_0x4edf1e['model'],qs[_0x6e61('0x3e')](_0x45ac38[_0x6e61('0x39')][_0x6e61('0x3e')]));_0x1dcffc[_0x6e61('0x3d')]=_0x1dcffc[_0x6e61('0x3d')][_0x6e61('0x3f')]?_0x1dcffc[_0x6e61('0x3d')]:_0x4edf1e[_0x6e61('0x38')];_0x1dcffc[_0x6e61('0x40')]=qs[_0x6e61('0x41')](_0x45ac38[_0x6e61('0x39')][_0x6e61('0x41')]);_0x1dcffc[_0x6e61('0x42')]=qs['filters'](_['pick'](_0x45ac38[_0x6e61('0x39')],_0x4edf1e[_0x6e61('0x3b')]));if(_0x45ac38[_0x6e61('0x39')]['filter']){_0x1dcffc[_0x6e61('0x42')]=_[_0x6e61('0x46')](_0x1dcffc[_0x6e61('0x42')],{'$or':_[_0x6e61('0x33')](_0x1dcffc[_0x6e61('0x3d')],function(_0x907be8){var _0x36793e={};_0x36793e[_0x907be8]={'$like':'%'+_0x45ac38[_0x6e61('0x39')][_0x6e61('0x44')]+'%'};return _0x36793e;})});}_0x1dcffc=_[_0x6e61('0x46')]({},_0x1dcffc,_0x45ac38[_0x6e61('0x60')]);return _0x1af98a[_0x6e61('0x5d')](_0x1dcffc);}})['then'](function(_0x4eb787){if(_0x4eb787){_0x4c7d63=_0x4eb787[_0x6e61('0x3f')];if(!_0x45ac38[_0x6e61('0x39')][_0x6e61('0x61')](_0x6e61('0x62'))){_0x1dcffc[_0x6e61('0x24')]=qs[_0x6e61('0x24')](_0x45ac38[_0x6e61('0x39')][_0x6e61('0x24')]);_0x1dcffc['offset']=qs[_0x6e61('0x23')](_0x45ac38['query']['offset']);}return _0x1af98a[_0x6e61('0x5d')](_0x1dcffc);}})[_0x6e61('0x2b')](function(_0x326c72){if(_0x326c72){return _0x326c72?{'count':_0x4c7d63,'rows':_0x326c72}:null;}})[_0x6e61('0x2b')](respondWithResult(_0x382511,null))['catch'](handleError(_0x382511,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index f1aa560..e3a7269 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 _0x1fa6=['SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xe7908d,_0x38c980){var _0x58d6c7=function(_0x11ac1c){while(--_0x11ac1c){_0xe7908d['push'](_0xe7908d['shift']());}};_0x58d6c7(++_0x38c980);}(_0x1fa6,0xc4));var _0x61fa=function(_0x35f5bb,_0x3397a9){_0x35f5bb=_0x35f5bb-0x0;var _0xa1be91=_0x1fa6[_0x35f5bb];return _0xa1be91;};'use strict';var EventEmitter=require(_0x61fa('0x0'));var SquareProject=require(_0x61fa('0x1'))['db'][_0x61fa('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x61fa('0x3')](0x0);var events={'afterCreate':_0x61fa('0x4'),'afterUpdate':_0x61fa('0x5'),'afterDestroy':_0x61fa('0x6')};function emitEvent(_0x4b0b7b){return function(_0x1203c2,_0x19ec57,_0xc6b8cc){SquareProjectEvents[_0x61fa('0x7')](_0x4b0b7b+':'+_0x1203c2['id'],_0x1203c2);SquareProjectEvents[_0x61fa('0x7')](_0x4b0b7b,_0x1203c2);_0xc6b8cc(null);};}for(var e in events){if(events[_0x61fa('0x8')](e)){var event=events[e];SquareProject[_0x61fa('0x9')](e,emitEvent(event));}}module[_0x61fa('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0x2ace=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x32b8a9,_0x59d62b){var _0x40105c=function(_0x54c048){while(--_0x54c048){_0x32b8a9['push'](_0x32b8a9['shift']());}};_0x40105c(++_0x59d62b);}(_0x2ace,0x1ec));var _0xe2ac=function(_0x22f5ea,_0x3a6a30){_0x22f5ea=_0x22f5ea-0x0;var _0xe5955=_0x2ace[_0x22f5ea];return _0xe5955;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xe2ac('0x0'))['db'][_0xe2ac('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xe2ac('0x2')](0x0);var events={'afterCreate':_0xe2ac('0x3'),'afterUpdate':_0xe2ac('0x4'),'afterDestroy':_0xe2ac('0x5')};function emitEvent(_0x395503){return function(_0x29c68d,_0x2c8878,_0x55715c){SquareProjectEvents[_0xe2ac('0x6')](_0x395503+':'+_0x29c68d['id'],_0x29c68d);SquareProjectEvents['emit'](_0x395503,_0x29c68d);_0x55715c(null);};}for(var e in events){if(events[_0xe2ac('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xe2ac('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index dba8692..862c533 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 _0x0a6e=['format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','define','SquareProject','square_projects','changed','preproduction','savedAt'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0x0a6e,0x1ad));var _0xe0a6=function(_0x4ca95f,_0x98da4){_0x4ca95f=_0x4ca95f-0x0;var _0x49a240=_0x0a6e[_0x4ca95f];return _0x49a240;};'use strict';var _=require(_0xe0a6('0x0'));var util=require(_0xe0a6('0x1'));var logger=require(_0xe0a6('0x2'))('api');var moment=require(_0xe0a6('0x3'));var BPromise=require(_0xe0a6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0a6('0x5'));var rimraf=require('rimraf');var config=require(_0xe0a6('0x6'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x3b4f81,_0x15461f){return _0x3b4f81[_0xe0a6('0x7')](_0xe0a6('0x8'),attributes,{'tableName':_0xe0a6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e9918,_0x2b90d5,_0x488e8c){if(_0x4e9918[_0xe0a6('0xa')](_0xe0a6('0xb'))){_0x4e9918[_0xe0a6('0xc')]=moment()[_0xe0a6('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4e9918[_0xe0a6('0xa')](_0xe0a6('0xe'))){_0x4e9918[_0xe0a6('0xf')]=moment()[_0xe0a6('0xd')](_0xe0a6('0x10'));}_0x488e8c(null,_0x4e9918);}}});}; \ No newline at end of file +var _0x5c67=['rimraf','exports','define','SquareProject','square_projects','changed','preproduction','format','production','publishedAt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5c67,0xfa));var _0x75c6=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x5c67[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x75c6('0x0'));var util=require(_0x75c6('0x1'));var logger=require(_0x75c6('0x2'))(_0x75c6('0x3'));var moment=require(_0x75c6('0x4'));var BPromise=require(_0x75c6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x75c6('0x6'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0x75c6('0x7')]=function(_0x13279a,_0x4e77d8){return _0x13279a[_0x75c6('0x8')](_0x75c6('0x9'),attributes,{'tableName':_0x75c6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d604c,_0x51d012,_0x4da744){if(_0x3d604c[_0x75c6('0xb')](_0x75c6('0xc'))){_0x3d604c['savedAt']=moment()[_0x75c6('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3d604c['changed'](_0x75c6('0xe'))){_0x3d604c[_0x75c6('0xf')]=moment()[_0x75c6('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4da744(null,_0x3d604c);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index cfcfaa1..0b1bebb 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 _0xd716=['register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','SquareProject','find','options','where','attributes','include','map','model','then','ShowSquareProject','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./squareProject.socket'];(function(_0x125425,_0x4b6bab){var _0xd04dc4=function(_0x37fc01){while(--_0x37fc01){_0x125425['push'](_0x125425['shift']());}};_0xd04dc4(++_0x4b6bab);}(_0xd716,0x1a1));var _0x6d71=function(_0x4ddfc9,_0x23f05f){_0x4ddfc9=_0x4ddfc9-0x0;var _0x47da83=_0xd716[_0x4ddfc9];return _0x47da83;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6d71('0x0'));var BPromise=require(_0x6d71('0x1'));var rs=require(_0x6d71('0x2'));var fs=require('fs');var Redis=require(_0x6d71('0x3'));var db=require(_0x6d71('0x4'))['db'];var utils=require(_0x6d71('0x5'));var logger=require(_0x6d71('0x6'))(_0x6d71('0x7'));var config=require(_0x6d71('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d71('0x9')][_0x6d71('0xa')]({'port':0x232a});config[_0x6d71('0xb')]=_[_0x6d71('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6d71('0xd'))(new Redis(config[_0x6d71('0xb')]));require(_0x6d71('0xe'))[_0x6d71('0xf')](socket);function respondWithRpcPromise(_0x1dd59f,_0x3fc884,_0x5e4ceb){return new BPromise(function(_0x3d93af,_0x4864a4){return client[_0x6d71('0x10')](_0x1dd59f,_0x5e4ceb)['then'](function(_0x27950e){logger[_0x6d71('0x11')](_0x6d71('0x12'),_0x3fc884,_0x6d71('0x13'));logger['debug']('SquareProject,\x20%s,\x20%s,\x20%s',_0x3fc884,_0x6d71('0x13'),JSON[_0x6d71('0x14')](_0x27950e));if(_0x27950e[_0x6d71('0x15')]){if(_0x27950e[_0x6d71('0x15')]['code']===0x1f4){logger[_0x6d71('0x15')](_0x6d71('0x12'),_0x3fc884,_0x27950e['error'][_0x6d71('0x16')]);return _0x4864a4(_0x27950e[_0x6d71('0x15')][_0x6d71('0x16')]);}logger[_0x6d71('0x15')](_0x6d71('0x12'),_0x3fc884,_0x27950e[_0x6d71('0x15')][_0x6d71('0x16')]);return _0x3d93af(_0x27950e[_0x6d71('0x15')][_0x6d71('0x16')]);}else{logger['info'](_0x6d71('0x12'),_0x3fc884,_0x6d71('0x13'));_0x3d93af(_0x27950e[_0x6d71('0x17')]['message']);}})[_0x6d71('0x18')](function(_0x106ba5){logger['error'](_0x6d71('0x12'),_0x3fc884,_0x106ba5);_0x4864a4(_0x106ba5);});});}exports['ShowSquareProject']=function(_0x313eb4){var _0x5f32f1=this;return new Promise(function(_0x4f68d0,_0x253977){return db[_0x6d71('0x19')][_0x6d71('0x1a')]({'raw':_0x313eb4['options']?_0x313eb4[_0x6d71('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x313eb4[_0x6d71('0x1b')]?_0x313eb4['options'][_0x6d71('0x1c')]||null:null,'attributes':_0x313eb4[_0x6d71('0x1b')]?_0x313eb4['options'][_0x6d71('0x1d')]||null:null,'include':_0x313eb4[_0x6d71('0x1b')]?_0x313eb4[_0x6d71('0x1b')][_0x6d71('0x1e')]?_[_0x6d71('0x1f')](_0x313eb4['options'][_0x6d71('0x1e')],function(_0x1ce66e){return{'model':db[_0x1ce66e[_0x6d71('0x20')]],'as':_0x1ce66e['as'],'attributes':_0x1ce66e[_0x6d71('0x1d')],'include':_0x1ce66e[_0x6d71('0x1e')]?_[_0x6d71('0x1f')](_0x1ce66e[_0x6d71('0x1e')],function(_0xa2093c){return{'model':db[_0xa2093c[_0x6d71('0x20')]],'as':_0xa2093c['as'],'attributes':_0xa2093c[_0x6d71('0x1d')],'include':_0xa2093c[_0x6d71('0x1e')]?_[_0x6d71('0x1f')](_0xa2093c[_0x6d71('0x1e')],function(_0x34a4e0){return{'model':db[_0x34a4e0[_0x6d71('0x20')]],'as':_0x34a4e0['as'],'attributes':_0x34a4e0[_0x6d71('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6d71('0x21')](function(_0x426949){logger[_0x6d71('0x11')](_0x6d71('0x22'),_0x313eb4);logger[_0x6d71('0x23')](_0x6d71('0x22'),_0x313eb4,JSON[_0x6d71('0x14')](_0x426949));_0x4f68d0(_0x426949);})[_0x6d71('0x18')](function(_0x3e0b43){logger[_0x6d71('0x15')]('ShowSquareProject',_0x3e0b43[_0x6d71('0x16')],_0x313eb4);_0x253977(_0x5f32f1[_0x6d71('0x15')](0x1f4,_0x3e0b43[_0x6d71('0x16')]));});});}; \ No newline at end of file +var _0x1409=['message','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','then','stringify','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','info','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1409,0x177));var _0x9140=function(_0x1ebc14,_0x27b39b){_0x1ebc14=_0x1ebc14-0x0;var _0x487fc5=_0x1409[_0x1ebc14];return _0x487fc5;};'use strict';var _=require('lodash');var util=require(_0x9140('0x0'));var moment=require(_0x9140('0x1'));var BPromise=require('bluebird');var rs=require(_0x9140('0x2'));var fs=require('fs');var Redis=require(_0x9140('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9140('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9140('0x5'));var jayson=require(_0x9140('0x6'));var client=jayson[_0x9140('0x7')]['http']({'port':0x232a});config[_0x9140('0x8')]=_[_0x9140('0x9')](config[_0x9140('0x8')],{'host':_0x9140('0xa'),'port':0x18eb});var socket=require(_0x9140('0xb'))(new Redis(config[_0x9140('0x8')]));require(_0x9140('0xc'))[_0x9140('0xd')](socket);function respondWithRpcPromise(_0x4c0c40,_0x267e36,_0x286766){return new BPromise(function(_0x59dd4e,_0x16b422){return client['request'](_0x4c0c40,_0x286766)['then'](function(_0x10dbc1){logger[_0x9140('0xe')](_0x9140('0xf'),_0x267e36,'request\x20sent');logger[_0x9140('0x10')](_0x9140('0x11'),_0x267e36,_0x9140('0x12'),JSON['stringify'](_0x10dbc1));if(_0x10dbc1[_0x9140('0x13')]){if(_0x10dbc1[_0x9140('0x13')][_0x9140('0x14')]===0x1f4){logger[_0x9140('0x13')](_0x9140('0xf'),_0x267e36,_0x10dbc1['error'][_0x9140('0x15')]);return _0x16b422(_0x10dbc1[_0x9140('0x13')]['message']);}logger[_0x9140('0x13')](_0x9140('0xf'),_0x267e36,_0x10dbc1['error'][_0x9140('0x15')]);return _0x59dd4e(_0x10dbc1[_0x9140('0x13')]['message']);}else{logger[_0x9140('0xe')](_0x9140('0xf'),_0x267e36,'request\x20sent');_0x59dd4e(_0x10dbc1[_0x9140('0x16')]['message']);}})[_0x9140('0x17')](function(_0xf2cb42){logger[_0x9140('0x13')](_0x9140('0xf'),_0x267e36,_0xf2cb42);_0x16b422(_0xf2cb42);});});}exports[_0x9140('0x18')]=function(_0x2821b2){var _0x2f2aa5=this;return new Promise(function(_0x5bbba5,_0x5b25e9){return db[_0x9140('0x19')][_0x9140('0x1a')]({'raw':_0x2821b2[_0x9140('0x1b')]?_0x2821b2[_0x9140('0x1b')][_0x9140('0x1c')]===undefined?!![]:![]:!![],'where':_0x2821b2[_0x9140('0x1b')]?_0x2821b2['options'][_0x9140('0x1d')]||null:null,'attributes':_0x2821b2[_0x9140('0x1b')]?_0x2821b2['options'][_0x9140('0x1e')]||null:null,'include':_0x2821b2[_0x9140('0x1b')]?_0x2821b2[_0x9140('0x1b')][_0x9140('0x1f')]?_[_0x9140('0x20')](_0x2821b2[_0x9140('0x1b')][_0x9140('0x1f')],function(_0x12200b){return{'model':db[_0x12200b['model']],'as':_0x12200b['as'],'attributes':_0x12200b[_0x9140('0x1e')],'include':_0x12200b[_0x9140('0x1f')]?_[_0x9140('0x20')](_0x12200b['include'],function(_0x5e22e2){return{'model':db[_0x5e22e2[_0x9140('0x21')]],'as':_0x5e22e2['as'],'attributes':_0x5e22e2[_0x9140('0x1e')],'include':_0x5e22e2['include']?_['map'](_0x5e22e2['include'],function(_0x49f720){return{'model':db[_0x49f720['model']],'as':_0x49f720['as'],'attributes':_0x49f720[_0x9140('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9140('0x22')](function(_0x12ab63){logger[_0x9140('0xe')]('ShowSquareProject',_0x2821b2);logger[_0x9140('0x10')]('ShowSquareProject',_0x2821b2,JSON[_0x9140('0x23')](_0x12ab63));_0x5bbba5(_0x12ab63);})[_0x9140('0x17')](function(_0x2aceac){logger[_0x9140('0x13')]('ShowSquareProject',_0x2aceac[_0x9140('0x15')],_0x2821b2);_0x5b25e9(_0x2f2aa5['error'](0x1f4,_0x2aceac[_0x9140('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index c030b3f..638b662 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 _0x78cd=['register','squareProject:','./squareProject.events','save','remove','update','removeListener'];(function(_0x545c46,_0xd964b8){var _0x5d61cf=function(_0x5320c2){while(--_0x5320c2){_0x545c46['push'](_0x545c46['shift']());}};_0x5d61cf(++_0xd964b8);}(_0x78cd,0x1e5));var _0xd78c=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x78cd[_0x4d8ed9];return _0x1e2140;};'use strict';var SquareProjectEvents=require(_0xd78c('0x0'));var events=[_0xd78c('0x1'),_0xd78c('0x2'),_0xd78c('0x3')];function createListener(_0x57d064,_0x372bbb){return function(_0x47be25){_0x372bbb['emit'](_0x57d064,_0x47be25);};}function removeListener(_0x3c7b18,_0x38c4e6){return function(){SquareProjectEvents[_0xd78c('0x4')](_0x3c7b18,_0x38c4e6);};}exports[_0xd78c('0x5')]=function(_0x4e3d9b){for(var _0x4d2f17=0x0,_0x45c47a=events['length'];_0x4d2f17<_0x45c47a;_0x4d2f17++){var _0x1beb29=events[_0x4d2f17];var _0x5bbb78=createListener(_0xd78c('0x6')+_0x1beb29,_0x4e3d9b);SquareProjectEvents['on'](_0x1beb29,_0x5bbb78);}}; \ No newline at end of file +var _0x8f76=['register','length','squareProject:','./squareProject.events','save','remove','emit','removeListener'];(function(_0x2e6dee,_0x1a61b0){var _0x47706=function(_0x365546){while(--_0x365546){_0x2e6dee['push'](_0x2e6dee['shift']());}};_0x47706(++_0x1a61b0);}(_0x8f76,0x12b));var _0x68f7=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x8f76[_0x24237f];return _0x48298e;};'use strict';var SquareProjectEvents=require(_0x68f7('0x0'));var events=[_0x68f7('0x1'),_0x68f7('0x2'),'update'];function createListener(_0x571914,_0x3ca007){return function(_0x2f0c23){_0x3ca007[_0x68f7('0x3')](_0x571914,_0x2f0c23);};}function removeListener(_0x6fa541,_0x15d8de){return function(){SquareProjectEvents[_0x68f7('0x4')](_0x6fa541,_0x15d8de);};}exports[_0x68f7('0x5')]=function(_0x581380){for(var _0x2f469e=0x0,_0x10a3ff=events[_0x68f7('0x6')];_0x2f469e<_0x10a3ff;_0x2f469e++){var _0x27f8c3=events[_0x2f469e];var _0x287ef4=createListener(_0x68f7('0x7')+_0x27f8c3,_0x581380);SquareProjectEvents['on'](_0x27f8c3,_0x287ef4);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index dd3a22a..9f5675f 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 _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x1936eb,_0x1a8925){var _0x4a5c1f=function(_0x32728e){while(--_0x32728e){_0x1936eb['push'](_0x1936eb['shift']());}};_0x4a5c1f(++_0x1a8925);}(_0xabce,0x103));var _0xeabc=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xabce[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file +var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x4b3374,_0x5513b9){var _0x513512=function(_0x56ce2a){while(--_0x56ce2a){_0x4b3374['push'](_0x4b3374['shift']());}};_0x513512(++_0x5513b9);}(_0xabce,0x103));var _0xeabc=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xabce[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 665fec5..3846923 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 _0x2d17=['VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d17,0x17e));var _0x72d1=function(_0x8e9467,_0x47db3c){_0x8e9467=_0x8e9467-0x0;var _0x29e139=_0x2d17[_0x8e9467];return _0x29e139;};'use strict';var Sequelize=require(_0x72d1('0x0'));module[_0x72d1('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x72d1('0x2')]},'calleridname':{'type':Sequelize[_0x72d1('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x72d1('0x2')]},'priority':{'type':Sequelize[_0x72d1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x72d1('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x72d1('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x72d1('0x2')]},'format':{'type':Sequelize[_0x72d1('0x3')],'get':function(){var _0x5b40a9='';var _0x477264=this[_0x72d1('0x4')](_0x72d1('0x5'));if(_0x477264){_0x5b40a9=_0x477264['substring'](_0x477264[_0x72d1('0x6')]('.'));}return _0x5b40a9;}}}; \ No newline at end of file +var _0xb458=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x5abdaa,_0x3f6517){var _0x3e7f09=function(_0x1124ff){while(--_0x1124ff){_0x5abdaa['push'](_0x5abdaa['shift']());}};_0x3e7f09(++_0x3f6517);}(_0xb458,0x103));var _0x8b45=function(_0x1663c8,_0x31aaeb){_0x1663c8=_0x1663c8-0x0;var _0x1a10d6=_0xb458[_0x1663c8];return _0x1a10d6;};'use strict';var Sequelize=require(_0x8b45('0x0'));module[_0x8b45('0x1')]={'uniqueid':{'type':Sequelize[_0x8b45('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8b45('0x2')]},'extension':{'type':Sequelize[_0x8b45('0x2')]},'priority':{'type':Sequelize[_0x8b45('0x2')]},'accountcode':{'type':Sequelize[_0x8b45('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x8b45('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x8b45('0x2')]},'format':{'type':Sequelize[_0x8b45('0x3')],'get':function(){var _0x2daa9a='';var _0x3a8ccb=this[_0x8b45('0x4')]('savePath');if(_0x3a8ccb){_0x2daa9a=_0x3a8ccb[_0x8b45('0x5')](_0x3a8ccb[_0x8b45('0x6')]('.'));}return _0x2daa9a;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index da6faca..d8951c4 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 _0xe519=['body','find','download','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','extname','unlink','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','save','update','then','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','length','includeAll','create'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0xe519,0x19d));var _0x9e51=function(_0x214994,_0x4307b3){_0x214994=_0x214994-0x0;var _0x1a95db=_0xe519[_0x214994];return _0x1a95db;};'use strict';var emlformat=require(_0x9e51('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e51('0x1'));var jsonpatch=require(_0x9e51('0x2'));var rp=require(_0x9e51('0x3'));var moment=require('moment');var BPromise=require(_0x9e51('0x4'));var Mustache=require('mustache');var util=require(_0x9e51('0x5'));var path=require(_0x9e51('0x6'));var sox=require(_0x9e51('0x7'));var csv=require(_0x9e51('0x8'));var ejs=require(_0x9e51('0x9'));var fs=require('fs');var fs_extra=require(_0x9e51('0xa'));var _=require(_0x9e51('0xb'));var squel=require('squel');var crypto=require(_0x9e51('0xc'));var jsforce=require(_0x9e51('0xd'));var deskjs=require(_0x9e51('0xe'));var toCsv=require(_0x9e51('0x8'));var querystring=require('querystring');var Papa=require(_0x9e51('0xf'));var Redis=require('ioredis');var authService=require(_0x9e51('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e51('0x11'));var logger=require(_0x9e51('0x12'))('api');var utils=require(_0x9e51('0x13'));var config=require(_0x9e51('0x14'));var licenseUtil=require(_0x9e51('0x15'));var db=require(_0x9e51('0x16'))['db'];function respondWithStatusCode(_0x2dc205,_0x305790){_0x305790=_0x305790||0xcc;return function(_0x502574){if(_0x502574){return _0x2dc205[_0x9e51('0x17')](_0x305790);}return _0x2dc205[_0x9e51('0x18')](_0x305790)[_0x9e51('0x19')]();};}function respondWithResult(_0x373ac8,_0x4d0a20){_0x4d0a20=_0x4d0a20||0xc8;return function(_0x2c26a0){if(_0x2c26a0){return _0x373ac8['status'](_0x4d0a20)['json'](_0x2c26a0);}};}function respondWithFilteredResult(_0x12d96e,_0x3f80ac){return function(_0x44d9b2){if(_0x44d9b2){var _0x1aacb8=typeof _0x3f80ac[_0x9e51('0x1a')]==='undefined'&&typeof _0x3f80ac[_0x9e51('0x1b')]===_0x9e51('0x1c');var _0x34efc3=_0x44d9b2[_0x9e51('0x1d')];var _0x5e0cd4=_0x1aacb8?0x0:_0x3f80ac[_0x9e51('0x1a')];var _0x4d6214=_0x1aacb8?_0x44d9b2[_0x9e51('0x1d')]:_0x3f80ac[_0x9e51('0x1a')]+_0x3f80ac[_0x9e51('0x1b')];var _0x5703ea;if(_0x4d6214>=_0x34efc3){_0x4d6214=_0x34efc3;_0x5703ea=0xc8;}else{_0x5703ea=0xce;}_0x12d96e[_0x9e51('0x18')](_0x5703ea);return _0x12d96e['set'](_0x9e51('0x1e'),_0x5e0cd4+'-'+_0x4d6214+'/'+_0x34efc3)[_0x9e51('0x1f')](_0x44d9b2);}return null;};}function patchUpdates(_0x4b4b81){return function(_0x26cd7a){try{jsonpatch[_0x9e51('0x20')](_0x26cd7a,_0x4b4b81,!![]);}catch(_0x3efa3e){return BPromise['reject'](_0x3efa3e);}return _0x26cd7a[_0x9e51('0x21')]();};}function saveUpdates(_0x9e578c,_0x57d6d4){return function(_0x50754a){if(_0x50754a){return _0x50754a[_0x9e51('0x22')](_0x9e578c)[_0x9e51('0x23')](function(_0x2fa84b){return _0x2fa84b;});}return null;};}function removeEntity(_0x3252d7,_0xbaf11b){return function(_0x5f2a1e){if(_0x5f2a1e){return _0x5f2a1e['destroy']()[_0x9e51('0x23')](function(){_0x3252d7[_0x9e51('0x18')](0xcc)[_0x9e51('0x19')]();});}};}function handleEntityNotFound(_0x2ba038,_0xd80041){return function(_0x4accb5){if(!_0x4accb5){_0x2ba038['sendStatus'](0x194);}return _0x4accb5;};}function handleError(_0x45d904,_0x455c30){_0x455c30=_0x455c30||0x1f4;return function(_0x50892f){logger['error'](_0x50892f[_0x9e51('0x24')]);if(_0x50892f[_0x9e51('0x25')]){delete _0x50892f[_0x9e51('0x25')];}_0x45d904[_0x9e51('0x18')](_0x455c30)[_0x9e51('0x26')](_0x50892f);};}exports[_0x9e51('0x27')]=function(_0x35819f,_0xda878){var _0x328eed={},_0x1ed7e7={},_0x335fed={'count':0x0,'rows':[]};var _0x5abdfb=_[_0x9e51('0x28')](db[_0x9e51('0x29')][_0x9e51('0x2a')],function(_0x202b42){return{'name':_0x202b42[_0x9e51('0x2b')],'type':_0x202b42[_0x9e51('0x2c')][_0x9e51('0x2d')]};});_0x1ed7e7['model']=_[_0x9e51('0x28')](_0x5abdfb,_0x9e51('0x25'));_0x1ed7e7[_0x9e51('0x2e')]=_[_0x9e51('0x2f')](_0x35819f[_0x9e51('0x2e')]);_0x1ed7e7[_0x9e51('0x30')]=_[_0x9e51('0x31')](_0x1ed7e7[_0x9e51('0x32')],_0x1ed7e7['query']);_0x328eed[_0x9e51('0x33')]=_[_0x9e51('0x31')](_0x1ed7e7[_0x9e51('0x32')],qs[_0x9e51('0x34')](_0x35819f['query'][_0x9e51('0x34')]));_0x328eed[_0x9e51('0x33')]=_0x328eed[_0x9e51('0x33')]['length']?_0x328eed[_0x9e51('0x33')]:_0x1ed7e7[_0x9e51('0x32')];if(!_0x35819f[_0x9e51('0x2e')][_0x9e51('0x35')](_0x9e51('0x36'))){_0x328eed[_0x9e51('0x1b')]=qs[_0x9e51('0x1b')](_0x35819f[_0x9e51('0x2e')][_0x9e51('0x1b')]);_0x328eed[_0x9e51('0x1a')]=qs['offset'](_0x35819f['query'][_0x9e51('0x1a')]);}_0x328eed[_0x9e51('0x37')]=qs['sort'](_0x35819f[_0x9e51('0x2e')][_0x9e51('0x38')]);_0x328eed[_0x9e51('0x39')]=qs['filters'](_[_0x9e51('0x3a')](_0x35819f['query'],_0x1ed7e7[_0x9e51('0x30')]),_0x5abdfb);if(_0x35819f[_0x9e51('0x2e')][_0x9e51('0x3b')]){_0x328eed[_0x9e51('0x39')]=_['merge'](_0x328eed['where'],{'$or':_[_0x9e51('0x28')](_0x5abdfb,function(_0x12e952){if(_0x12e952[_0x9e51('0x2c')]!==_0x9e51('0x3c')){var _0x481dfd={};_0x481dfd[_0x12e952[_0x9e51('0x25')]]={'$like':'%'+_0x35819f['query'][_0x9e51('0x3b')]+'%'};return _0x481dfd;}})});}_0x328eed=_[_0x9e51('0x3d')]({},_0x328eed,_0x35819f[_0x9e51('0x3e')]);var _0x2b1f34={'where':_0x328eed[_0x9e51('0x39')]};return db[_0x9e51('0x29')][_0x9e51('0x1d')](_0x2b1f34)[_0x9e51('0x23')](function(_0x269c5b){_0x335fed[_0x9e51('0x1d')]=_0x269c5b;if(_0x35819f['query']['includeAll']){_0x328eed[_0x9e51('0x3f')]=[{'all':!![]}];}return db[_0x9e51('0x29')][_0x9e51('0x40')](_0x328eed);})[_0x9e51('0x23')](function(_0x3b2ed6){_0x335fed[_0x9e51('0x41')]=_0x3b2ed6;return _0x335fed;})['then'](respondWithFilteredResult(_0xda878,_0x328eed))[_0x9e51('0x42')](handleError(_0xda878,null));};exports[_0x9e51('0x43')]=function(_0x38ca87,_0x4deaa5){var _0x186adc={'raw':!![],'where':{'id':_0x38ca87[_0x9e51('0x44')]['id']}},_0x4633ed={};_0x4633ed[_0x9e51('0x32')]=_['keys'](db[_0x9e51('0x29')]['rawAttributes']);_0x4633ed[_0x9e51('0x2e')]=_[_0x9e51('0x2f')](_0x38ca87['query']);_0x4633ed['filters']=_[_0x9e51('0x31')](_0x4633ed[_0x9e51('0x32')],_0x4633ed[_0x9e51('0x2e')]);_0x186adc[_0x9e51('0x33')]=_[_0x9e51('0x31')](_0x4633ed[_0x9e51('0x32')],qs[_0x9e51('0x34')](_0x38ca87[_0x9e51('0x2e')][_0x9e51('0x34')]));_0x186adc[_0x9e51('0x33')]=_0x186adc[_0x9e51('0x33')][_0x9e51('0x45')]?_0x186adc['attributes']:_0x4633ed[_0x9e51('0x32')];if(_0x38ca87[_0x9e51('0x2e')][_0x9e51('0x46')]){_0x186adc[_0x9e51('0x3f')]=[{'all':!![]}];}_0x186adc=_['merge']({},_0x186adc,_0x38ca87[_0x9e51('0x3e')]);return db[_0x9e51('0x29')]['find'](_0x186adc)[_0x9e51('0x23')](handleEntityNotFound(_0x4deaa5,null))[_0x9e51('0x23')](respondWithResult(_0x4deaa5,null))['catch'](handleError(_0x4deaa5,null));};exports[_0x9e51('0x47')]=function(_0x56eedf,_0x57080b){return db[_0x9e51('0x29')][_0x9e51('0x47')](_0x56eedf[_0x9e51('0x48')],{})[_0x9e51('0x23')](respondWithResult(_0x57080b,0xc9))[_0x9e51('0x42')](handleError(_0x57080b,null));};exports[_0x9e51('0x22')]=function(_0x1a76fa,_0x3db70a){if(_0x1a76fa[_0x9e51('0x48')]['id']){delete _0x1a76fa[_0x9e51('0x48')]['id'];}return db[_0x9e51('0x29')][_0x9e51('0x49')]({'where':{'id':_0x1a76fa[_0x9e51('0x44')]['id']}})[_0x9e51('0x23')](handleEntityNotFound(_0x3db70a,null))[_0x9e51('0x23')](saveUpdates(_0x1a76fa[_0x9e51('0x48')],null))[_0x9e51('0x23')](respondWithResult(_0x3db70a,null))[_0x9e51('0x42')](handleError(_0x3db70a,null));};exports[_0x9e51('0x4a')]=function(_0x2c769f,_0x3a897a,_0x7c1f0f){var _0x436f9f=require(_0x9e51('0x4b'));var _0x45940a=![];var _0x1a7fe9={};if(_0x2c769f[_0x9e51('0x2e')]['type']&&_0x2c769f['query'][_0x9e51('0x2c')]===_0x9e51('0x4c')){_0x1a7fe9['uniqueid']=_0x2c769f[_0x9e51('0x44')]['id'];}else{_0x1a7fe9['id']=_0x2c769f[_0x9e51('0x44')]['id'];}return db['SquareRecording'][_0x9e51('0x49')]({'where':_0x1a7fe9,'attributes':['id','savePath',_0x9e51('0x4d')],'raw':!![]})[_0x9e51('0x23')](handleEntityNotFound(_0x3a897a,null))['then'](function(_0x44a9e8){if(_0x44a9e8){var _0x588a49=_0x44a9e8[_0x9e51('0x4e')];var _0x347fba=util[_0x9e51('0x4f')](_0x9e51('0x50'),_0x588a49);if(fs[_0x9e51('0x51')](_0x347fba)){_0x45940a=!![];return _0x436f9f[_0x9e51('0x52')](_0x347fba,_0x588a49,config[_0x9e51('0x53')][_0x9e51('0x54')])[_0x9e51('0x23')](function(){return _0x44a9e8;});}return _0x44a9e8;}})[_0x9e51('0x23')](function(_0x325759){if(_0x325759){var _0x34cb40=_0x325759[_0x9e51('0x4e')];if(!fs['existsSync'](_0x34cb40)){throw new db[(_0x9e51('0x55'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x325759['filename']){return _0x3a897a[_0x9e51('0x4a')](_0x34cb40,_0x325759['filename']+path[_0x9e51('0x56')](_0x34cb40),function(){if(_0x45940a){fs[_0x9e51('0x57')](_0x34cb40);}});}else{return _0x3a897a['download'](_0x34cb40,function(_0x587c72){if(_0x45940a){fs[_0x9e51('0x57')](_0x34cb40);}});}}})[_0x9e51('0x42')](function(_0x1f3482){if(_0x1f3482['message']==='SquareRecording\x20not\x20found'){_0x3a897a[_0x9e51('0x18')](0x194)[_0x9e51('0x26')](_0x9e51('0x58'));}else{return handleError(_0x3a897a,null);}});};exports['destroy']=function(_0x54313a,_0x5dada0){return db[_0x9e51('0x29')]['find']({'where':{'id':_0x54313a['params']['id']}})[_0x9e51('0x23')](function(_0x3194e2){if(_['isNil'](_0x3194e2)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3194e2;})[_0x9e51('0x23')](function(_0x194ad1){var _0x1c7437=_0x194ad1['savePath'];logger[_0x9e51('0x59')](_0x9e51('0x5a'),_0x1c7437);if(!_[_0x9e51('0x5b')](_0x194ad1[_0x9e51('0x4e')])&&fs[_0x9e51('0x51')](_0x1c7437)){logger[_0x9e51('0x59')](_0x9e51('0x5c')+_0x1c7437+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x9e51('0x5d')](_0x1c7437);}_0x1c7437=_0x1c7437+_0x9e51('0x5e');if(!_['isNil'](_0x194ad1[_0x9e51('0x4e')])&&fs[_0x9e51('0x51')](_0x1c7437)){logger[_0x9e51('0x59')]('File:\x20\x22'+_0x1c7437+_0x9e51('0x5f'));fs['unlinkSync'](_0x1c7437);}return _0x194ad1;})[_0x9e51('0x23')](function(_0x3267e9){if(!_0x3267e9)throw new InternalError();return _0x3267e9[_0x9e51('0x60')]();})[_0x9e51('0x23')](function(){_0x5dada0['status'](0xcc)[_0x9e51('0x19')]();})[_0x9e51('0x42')](handleError(_0x5dada0,null));}; \ No newline at end of file +var _0xdab7=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll','include','findAll','rawAttributes','find','catch','create','body','params','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','unlink','SquareRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir'];(function(_0x54a212,_0x548a3b){var _0x466fb5=function(_0x5b3d3e){while(--_0x5b3d3e){_0x54a212['push'](_0x54a212['shift']());}};_0x466fb5(++_0x548a3b);}(_0xdab7,0x129));var _0x7dab=function(_0xa7a66c,_0x41046c){_0xa7a66c=_0xa7a66c-0x0;var _0x553382=_0xdab7[_0xa7a66c];return _0x553382;};'use strict';var emlformat=require(_0x7dab('0x0'));var rimraf=require(_0x7dab('0x1'));var zipdir=require(_0x7dab('0x2'));var jsonpatch=require(_0x7dab('0x3'));var rp=require(_0x7dab('0x4'));var moment=require(_0x7dab('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7dab('0x6'));var util=require(_0x7dab('0x7'));var path=require(_0x7dab('0x8'));var sox=require(_0x7dab('0x9'));var csv=require(_0x7dab('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7dab('0xb'));var _=require(_0x7dab('0xc'));var squel=require(_0x7dab('0xd'));var crypto=require('crypto');var jsforce=require(_0x7dab('0xe'));var deskjs=require(_0x7dab('0xf'));var toCsv=require(_0x7dab('0xa'));var querystring=require(_0x7dab('0x10'));var Papa=require(_0x7dab('0x11'));var Redis=require('ioredis');var authService=require(_0x7dab('0x12'));var qs=require(_0x7dab('0x13'));var as=require(_0x7dab('0x14'));var hardwareService=require(_0x7dab('0x15'));var logger=require(_0x7dab('0x16'))(_0x7dab('0x17'));var utils=require(_0x7dab('0x18'));var config=require(_0x7dab('0x19'));var licenseUtil=require(_0x7dab('0x1a'));var db=require(_0x7dab('0x1b'))['db'];function respondWithStatusCode(_0x420436,_0x59cffd){_0x59cffd=_0x59cffd||0xcc;return function(_0x17e8b7){if(_0x17e8b7){return _0x420436[_0x7dab('0x1c')](_0x59cffd);}return _0x420436['status'](_0x59cffd)[_0x7dab('0x1d')]();};}function respondWithResult(_0x2eefb7,_0x4090da){_0x4090da=_0x4090da||0xc8;return function(_0x409276){if(_0x409276){return _0x2eefb7[_0x7dab('0x1e')](_0x4090da)[_0x7dab('0x1f')](_0x409276);}};}function respondWithFilteredResult(_0x389e7f,_0x14210b){return function(_0x63f1a1){if(_0x63f1a1){var _0x5149c7=typeof _0x14210b[_0x7dab('0x20')]===_0x7dab('0x21')&&typeof _0x14210b[_0x7dab('0x22')]==='undefined';var _0x1ccd64=_0x63f1a1[_0x7dab('0x23')];var _0x19244f=_0x5149c7?0x0:_0x14210b['offset'];var _0x4c7cab=_0x5149c7?_0x63f1a1[_0x7dab('0x23')]:_0x14210b['offset']+_0x14210b[_0x7dab('0x22')];var _0x271dbd;if(_0x4c7cab>=_0x1ccd64){_0x4c7cab=_0x1ccd64;_0x271dbd=0xc8;}else{_0x271dbd=0xce;}_0x389e7f[_0x7dab('0x1e')](_0x271dbd);return _0x389e7f[_0x7dab('0x24')](_0x7dab('0x25'),_0x19244f+'-'+_0x4c7cab+'/'+_0x1ccd64)[_0x7dab('0x1f')](_0x63f1a1);}return null;};}function patchUpdates(_0x8ef182){return function(_0x5d60b0){try{jsonpatch[_0x7dab('0x26')](_0x5d60b0,_0x8ef182,!![]);}catch(_0x364306){return BPromise[_0x7dab('0x27')](_0x364306);}return _0x5d60b0[_0x7dab('0x28')]();};}function saveUpdates(_0x3d9fb2,_0x5cdc39){return function(_0x1a8a62){if(_0x1a8a62){return _0x1a8a62[_0x7dab('0x29')](_0x3d9fb2)[_0x7dab('0x2a')](function(_0x37e3dd){return _0x37e3dd;});}return null;};}function removeEntity(_0x2f6a13,_0x424379){return function(_0x27c0cd){if(_0x27c0cd){return _0x27c0cd[_0x7dab('0x2b')]()[_0x7dab('0x2a')](function(){_0x2f6a13[_0x7dab('0x1e')](0xcc)[_0x7dab('0x1d')]();});}};}function handleEntityNotFound(_0x2ca4aa,_0x701ca6){return function(_0x2f6720){if(!_0x2f6720){_0x2ca4aa[_0x7dab('0x1c')](0x194);}return _0x2f6720;};}function handleError(_0x2b3ba7,_0x3041d4){_0x3041d4=_0x3041d4||0x1f4;return function(_0x421cb6){logger['error'](_0x421cb6['stack']);if(_0x421cb6[_0x7dab('0x2c')]){delete _0x421cb6[_0x7dab('0x2c')];}_0x2b3ba7['status'](_0x3041d4)[_0x7dab('0x2d')](_0x421cb6);};}exports[_0x7dab('0x2e')]=function(_0x1b0ff0,_0x45464f){var _0x49b58c={},_0x5a13e6={},_0x34d9a6={'count':0x0,'rows':[]};var _0x17d4c0=_[_0x7dab('0x2f')](db['SquareRecording']['rawAttributes'],function(_0x3d394d){return{'name':_0x3d394d['fieldName'],'type':_0x3d394d[_0x7dab('0x30')][_0x7dab('0x31')]};});_0x5a13e6[_0x7dab('0x32')]=_[_0x7dab('0x2f')](_0x17d4c0,_0x7dab('0x2c'));_0x5a13e6['query']=_[_0x7dab('0x33')](_0x1b0ff0[_0x7dab('0x34')]);_0x5a13e6['filters']=_[_0x7dab('0x35')](_0x5a13e6[_0x7dab('0x32')],_0x5a13e6['query']);_0x49b58c[_0x7dab('0x36')]=_['intersection'](_0x5a13e6['model'],qs[_0x7dab('0x37')](_0x1b0ff0[_0x7dab('0x34')]['fields']));_0x49b58c['attributes']=_0x49b58c[_0x7dab('0x36')][_0x7dab('0x38')]?_0x49b58c[_0x7dab('0x36')]:_0x5a13e6['model'];if(!_0x1b0ff0[_0x7dab('0x34')][_0x7dab('0x39')]('nolimit')){_0x49b58c[_0x7dab('0x22')]=qs[_0x7dab('0x22')](_0x1b0ff0[_0x7dab('0x34')][_0x7dab('0x22')]);_0x49b58c['offset']=qs['offset'](_0x1b0ff0['query'][_0x7dab('0x20')]);}_0x49b58c[_0x7dab('0x3a')]=qs[_0x7dab('0x3b')](_0x1b0ff0[_0x7dab('0x34')]['sort']);_0x49b58c[_0x7dab('0x3c')]=qs[_0x7dab('0x3d')](_[_0x7dab('0x3e')](_0x1b0ff0[_0x7dab('0x34')],_0x5a13e6[_0x7dab('0x3d')]),_0x17d4c0);if(_0x1b0ff0[_0x7dab('0x34')][_0x7dab('0x3f')]){_0x49b58c[_0x7dab('0x3c')]=_[_0x7dab('0x40')](_0x49b58c[_0x7dab('0x3c')],{'$or':_[_0x7dab('0x2f')](_0x17d4c0,function(_0x41f7d0){if(_0x41f7d0[_0x7dab('0x30')]!==_0x7dab('0x41')){var _0x3f3c4e={};_0x3f3c4e[_0x41f7d0[_0x7dab('0x2c')]]={'$like':'%'+_0x1b0ff0[_0x7dab('0x34')][_0x7dab('0x3f')]+'%'};return _0x3f3c4e;}})});}_0x49b58c=_[_0x7dab('0x40')]({},_0x49b58c,_0x1b0ff0[_0x7dab('0x42')]);var _0x94439d={'where':_0x49b58c[_0x7dab('0x3c')]};return db[_0x7dab('0x43')]['count'](_0x94439d)[_0x7dab('0x2a')](function(_0x2e4141){_0x34d9a6[_0x7dab('0x23')]=_0x2e4141;if(_0x1b0ff0[_0x7dab('0x34')][_0x7dab('0x44')]){_0x49b58c[_0x7dab('0x45')]=[{'all':!![]}];}return db[_0x7dab('0x43')][_0x7dab('0x46')](_0x49b58c);})['then'](function(_0x148ee2){_0x34d9a6['rows']=_0x148ee2;return _0x34d9a6;})[_0x7dab('0x2a')](respondWithFilteredResult(_0x45464f,_0x49b58c))['catch'](handleError(_0x45464f,null));};exports['show']=function(_0x11c85b,_0x8f0f9b){var _0x224675={'raw':!![],'where':{'id':_0x11c85b['params']['id']}},_0x32923e={};_0x32923e['model']=_[_0x7dab('0x33')](db['SquareRecording'][_0x7dab('0x47')]);_0x32923e[_0x7dab('0x34')]=_['keys'](_0x11c85b[_0x7dab('0x34')]);_0x32923e[_0x7dab('0x3d')]=_[_0x7dab('0x35')](_0x32923e['model'],_0x32923e['query']);_0x224675[_0x7dab('0x36')]=_['intersection'](_0x32923e[_0x7dab('0x32')],qs[_0x7dab('0x37')](_0x11c85b[_0x7dab('0x34')][_0x7dab('0x37')]));_0x224675['attributes']=_0x224675[_0x7dab('0x36')][_0x7dab('0x38')]?_0x224675[_0x7dab('0x36')]:_0x32923e[_0x7dab('0x32')];if(_0x11c85b['query'][_0x7dab('0x44')]){_0x224675[_0x7dab('0x45')]=[{'all':!![]}];}_0x224675=_['merge']({},_0x224675,_0x11c85b[_0x7dab('0x42')]);return db[_0x7dab('0x43')][_0x7dab('0x48')](_0x224675)[_0x7dab('0x2a')](handleEntityNotFound(_0x8f0f9b,null))[_0x7dab('0x2a')](respondWithResult(_0x8f0f9b,null))[_0x7dab('0x49')](handleError(_0x8f0f9b,null));};exports['create']=function(_0x8cc289,_0x1fb669){return db[_0x7dab('0x43')][_0x7dab('0x4a')](_0x8cc289['body'],{})[_0x7dab('0x2a')](respondWithResult(_0x1fb669,0xc9))[_0x7dab('0x49')](handleError(_0x1fb669,null));};exports[_0x7dab('0x29')]=function(_0x4cc57f,_0x5ed152){if(_0x4cc57f[_0x7dab('0x4b')]['id']){delete _0x4cc57f[_0x7dab('0x4b')]['id'];}return db[_0x7dab('0x43')]['find']({'where':{'id':_0x4cc57f[_0x7dab('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5ed152,null))[_0x7dab('0x2a')](saveUpdates(_0x4cc57f['body'],null))['then'](respondWithResult(_0x5ed152,null))[_0x7dab('0x49')](handleError(_0x5ed152,null));};exports[_0x7dab('0x4d')]=function(_0x159ed4,_0x248d77,_0x2ca8d5){var _0x5f5972=require(_0x7dab('0x4e'));var _0x10cf49=![];var _0x2da7ca={};if(_0x159ed4[_0x7dab('0x34')][_0x7dab('0x30')]&&_0x159ed4[_0x7dab('0x34')]['type']===_0x7dab('0x4f')){_0x2da7ca['uniqueid']=_0x159ed4[_0x7dab('0x4c')]['id'];}else{_0x2da7ca['id']=_0x159ed4[_0x7dab('0x4c')]['id'];}return db[_0x7dab('0x43')]['find']({'where':_0x2da7ca,'attributes':['id',_0x7dab('0x50'),_0x7dab('0x51')],'raw':!![]})[_0x7dab('0x2a')](handleEntityNotFound(_0x248d77,null))[_0x7dab('0x2a')](function(_0x40f5c5){if(_0x40f5c5){var _0x373b21=_0x40f5c5[_0x7dab('0x50')];var _0x4b23aa=util[_0x7dab('0x52')](_0x7dab('0x53'),_0x373b21);if(fs[_0x7dab('0x54')](_0x4b23aa)){_0x10cf49=!![];return _0x5f5972[_0x7dab('0x55')](_0x4b23aa,_0x373b21,config[_0x7dab('0x56')][_0x7dab('0x57')])[_0x7dab('0x2a')](function(){return _0x40f5c5;});}return _0x40f5c5;}})[_0x7dab('0x2a')](function(_0x3b65f0){if(_0x3b65f0){var _0x58c656=_0x3b65f0['savePath'];if(!fs['existsSync'](_0x58c656)){throw new db['Sequelize'][(_0x7dab('0x58'))]('SquareRecording\x20not\x20found');}if(_0x3b65f0['filename']){return _0x248d77[_0x7dab('0x4d')](_0x58c656,_0x3b65f0[_0x7dab('0x51')]+path['extname'](_0x58c656),function(){if(_0x10cf49){fs[_0x7dab('0x59')](_0x58c656);}});}else{return _0x248d77[_0x7dab('0x4d')](_0x58c656,function(_0xf0550d){if(_0x10cf49){fs[_0x7dab('0x59')](_0x58c656);}});}}})[_0x7dab('0x49')](function(_0x580234){if(_0x580234['message']===_0x7dab('0x5a')){_0x248d77[_0x7dab('0x1e')](0x194)[_0x7dab('0x2d')](_0x7dab('0x5b'));}else{return handleError(_0x248d77,null);}});};exports['destroy']=function(_0x5bf8b8,_0x19a870){return db[_0x7dab('0x43')]['find']({'where':{'id':_0x5bf8b8[_0x7dab('0x4c')]['id']}})[_0x7dab('0x2a')](function(_0x1d10a8){if(_[_0x7dab('0x5c')](_0x1d10a8)){throw new ReferenceError(_0x7dab('0x5d'));}return _0x1d10a8;})['then'](function(_0x1643f2){var _0x9f7433=_0x1643f2[_0x7dab('0x50')];logger[_0x7dab('0x5e')](_0x7dab('0x5f'),_0x9f7433);if(!_[_0x7dab('0x5c')](_0x1643f2[_0x7dab('0x50')])&&fs[_0x7dab('0x54')](_0x9f7433)){logger['info'](_0x7dab('0x60')+_0x9f7433+_0x7dab('0x61'));fs[_0x7dab('0x62')](_0x9f7433);}_0x9f7433=_0x9f7433+_0x7dab('0x63');if(!_[_0x7dab('0x5c')](_0x1643f2[_0x7dab('0x50')])&&fs[_0x7dab('0x54')](_0x9f7433)){logger[_0x7dab('0x5e')](_0x7dab('0x60')+_0x9f7433+_0x7dab('0x61'));fs['unlinkSync'](_0x9f7433);}return _0x1643f2;})['then'](function(_0x2ac988){if(!_0x2ac988)throw new InternalError();return _0x2ac988[_0x7dab('0x2b')]();})[_0x7dab('0x2a')](function(){_0x19a870[_0x7dab('0x1e')](0xcc)['end']();})['catch'](handleError(_0x19a870,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 14c7a0d..b4ca7d0 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 _0xc2c7=['rimraf','exports','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5a2cfc,_0x21ab69){var _0x3d774e=function(_0x210ed1){while(--_0x210ed1){_0x5a2cfc['push'](_0x5a2cfc['shift']());}};_0x3d774e(++_0x21ab69);}(_0xc2c7,0x134));var _0x7c2c=function(_0x4f3aa8,_0x4729a1){_0x4f3aa8=_0x4f3aa8-0x0;var _0x4b21f8=_0xc2c7[_0x4f3aa8];return _0x4b21f8;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var logger=require(_0x7c2c('0x1'))(_0x7c2c('0x2'));var moment=require(_0x7c2c('0x3'));var BPromise=require(_0x7c2c('0x4'));var rp=require(_0x7c2c('0x5'));var fs=require('fs');var path=require(_0x7c2c('0x6'));var rimraf=require(_0x7c2c('0x7'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0x7c2c('0x8')]=function(_0x42ecc9,_0x23c038){return _0x42ecc9['define']('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7096=['exports','define','SquareRecording','square_recordings','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0x7096,0x10c));var _0x6709=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x7096[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 1b61b04..c29c832 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 _0x89a7=['code','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1ceedc,_0x17e4c9){var _0xfef10d=function(_0x2b7883){while(--_0x2b7883){_0x1ceedc['push'](_0x1ceedc['shift']());}};_0xfef10d(++_0x17e4c9);}(_0x89a7,0x1ea));var _0x789a=function(_0x3baf38,_0x56ad28){_0x3baf38=_0x3baf38-0x0;var _0x2283c3=_0x89a7[_0x3baf38];return _0x2283c3;};'use strict';var _=require('lodash');var util=require(_0x789a('0x0'));var moment=require(_0x789a('0x1'));var BPromise=require(_0x789a('0x2'));var rs=require(_0x789a('0x3'));var fs=require('fs');var Redis=require(_0x789a('0x4'));var db=require(_0x789a('0x5'))['db'];var utils=require(_0x789a('0x6'));var logger=require(_0x789a('0x7'))(_0x789a('0x8'));var config=require(_0x789a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x789a('0xa')][_0x789a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13194a,_0x5ef76a,_0x5458a4){return new BPromise(function(_0x5ebaa7,_0x1e6eeb){return client[_0x789a('0xc')](_0x13194a,_0x5458a4)[_0x789a('0xd')](function(_0x575241){logger[_0x789a('0xe')]('SquareRecording,\x20%s,\x20%s',_0x5ef76a,_0x789a('0xf'));logger[_0x789a('0x10')](_0x789a('0x11'),_0x5ef76a,_0x789a('0xf'),JSON[_0x789a('0x12')](_0x575241));if(_0x575241[_0x789a('0x13')]){if(_0x575241['error'][_0x789a('0x14')]===0x1f4){logger['error'](_0x789a('0x15'),_0x5ef76a,_0x575241[_0x789a('0x13')]['message']);return _0x1e6eeb(_0x575241[_0x789a('0x13')][_0x789a('0x16')]);}logger[_0x789a('0x13')](_0x789a('0x15'),_0x5ef76a,_0x575241[_0x789a('0x13')]['message']);return _0x5ebaa7(_0x575241[_0x789a('0x13')][_0x789a('0x16')]);}else{logger[_0x789a('0xe')]('SquareRecording,\x20%s,\x20%s',_0x5ef76a,_0x789a('0xf'));_0x5ebaa7(_0x575241[_0x789a('0x17')][_0x789a('0x16')]);}})[_0x789a('0x18')](function(_0x5565e6){logger[_0x789a('0x13')](_0x789a('0x15'),_0x5ef76a,_0x5565e6);_0x1e6eeb(_0x5565e6);});});}exports[_0x789a('0x19')]=function(_0x1c022f){var _0x47e981=this;return new Promise(function(_0x192c82,_0x8d6829){return db['SquareRecording'][_0x789a('0x1a')](_0x1c022f[_0x789a('0x1b')],{'raw':_0x1c022f[_0x789a('0x1c')]?_0x1c022f['options'][_0x789a('0x1d')]===undefined?!![]:![]:!![]})[_0x789a('0xd')](function(_0x49f04f){logger[_0x789a('0xe')](_0x789a('0x19'),_0x1c022f);logger[_0x789a('0x10')]('CreateSquareRecording',_0x1c022f,JSON['stringify'](_0x49f04f));_0x192c82(_0x49f04f);})['catch'](function(_0x299f0d){logger[_0x789a('0x13')](_0x789a('0x19'),_0x299f0d[_0x789a('0x16')],_0x1c022f);_0x8d6829(_0x47e981[_0x789a('0x13')](0x1f4,_0x299f0d[_0x789a('0x16')]));});});}; \ No newline at end of file +var _0x683c=['CreateSquareRecording','SquareRecording','create','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3ecbdc,_0x3a71fe){var _0xad4dea=function(_0x3275a0){while(--_0x3275a0){_0x3ecbdc['push'](_0x3ecbdc['shift']());}};_0xad4dea(++_0x3a71fe);}(_0x683c,0x8c));var _0xc683=function(_0x2468c7,_0xaf4c81){_0x2468c7=_0x2468c7-0x0;var _0x11c7eb=_0x683c[_0x2468c7];return _0x11c7eb;};'use strict';var _=require(_0xc683('0x0'));var util=require('util');var moment=require(_0xc683('0x1'));var BPromise=require(_0xc683('0x2'));var rs=require(_0xc683('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc683('0x4'))['db'];var utils=require(_0xc683('0x5'));var logger=require(_0xc683('0x6'))(_0xc683('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc683('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7f6408,_0xa6ba2,_0x14ff70){return new BPromise(function(_0x289a0,_0x4f981c){return client[_0xc683('0x9')](_0x7f6408,_0x14ff70)[_0xc683('0xa')](function(_0x32bd8d){logger[_0xc683('0xb')](_0xc683('0xc'),_0xa6ba2,_0xc683('0xd'));logger[_0xc683('0xe')](_0xc683('0xf'),_0xa6ba2,_0xc683('0xd'),JSON[_0xc683('0x10')](_0x32bd8d));if(_0x32bd8d[_0xc683('0x11')]){if(_0x32bd8d[_0xc683('0x11')][_0xc683('0x12')]===0x1f4){logger[_0xc683('0x11')](_0xc683('0xc'),_0xa6ba2,_0x32bd8d['error']['message']);return _0x4f981c(_0x32bd8d['error'][_0xc683('0x13')]);}logger[_0xc683('0x11')](_0xc683('0xc'),_0xa6ba2,_0x32bd8d[_0xc683('0x11')][_0xc683('0x13')]);return _0x289a0(_0x32bd8d[_0xc683('0x11')][_0xc683('0x13')]);}else{logger['info'](_0xc683('0xc'),_0xa6ba2,'request\x20sent');_0x289a0(_0x32bd8d[_0xc683('0x14')][_0xc683('0x13')]);}})[_0xc683('0x15')](function(_0x388a36){logger[_0xc683('0x11')]('SquareRecording,\x20%s,\x20%s',_0xa6ba2,_0x388a36);_0x4f981c(_0x388a36);});});}exports[_0xc683('0x16')]=function(_0x24b9b3){var _0x23be92=this;return new Promise(function(_0x2b3f3d,_0xc3d4a1){return db[_0xc683('0x17')][_0xc683('0x18')](_0x24b9b3['body'],{'raw':_0x24b9b3[_0xc683('0x19')]?_0x24b9b3['options'][_0xc683('0x1a')]===undefined?!![]:![]:!![]})[_0xc683('0xa')](function(_0x135101){logger[_0xc683('0xb')]('CreateSquareRecording',_0x24b9b3);logger['debug'](_0xc683('0x16'),_0x24b9b3,JSON[_0xc683('0x10')](_0x135101));_0x2b3f3d(_0x135101);})['catch'](function(_0x3b83fd){logger[_0xc683('0x11')]('CreateSquareRecording',_0x3b83fd[_0xc683('0x13')],_0x24b9b3);_0xc3d4a1(_0x23be92[_0xc683('0x11')](0x1f4,_0x3b83fd[_0xc683('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 46f1928..2b2793c 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 _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(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0xfb23c5,_0x2c2e87){var _0x406576=function(_0x2c7f34){while(--_0x2c7f34){_0xfb23c5['push'](_0xfb23c5['shift']());}};_0x406576(++_0x2c2e87);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 00a9b86..e5c56c9 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 _0xd868=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x4662a1,_0x256cff){var _0x16ebc3=function(_0x197740){while(--_0x197740){_0x4662a1['push'](_0x4662a1['shift']());}};_0x16ebc3(++_0x256cff);}(_0xd868,0xf9));var _0x8d86=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xd868[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require(_0x8d86('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x8d86('0x1')]},'request':{'type':Sequelize[_0x8d86('0x1')]},'channel':{'type':Sequelize[_0x8d86('0x1')]},'language':{'type':Sequelize[_0x8d86('0x1')]},'type':{'type':Sequelize[_0x8d86('0x1')]},'uniqueid':{'type':Sequelize[_0x8d86('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x8d86('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x8d86('0x1')]},'callingani2':{'type':Sequelize[_0x8d86('0x1')]},'callington':{'type':Sequelize[_0x8d86('0x1')]},'callingtns':{'type':Sequelize[_0x8d86('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x8d86('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x8d86('0x1')]},'enhanced':{'type':Sequelize[_0x8d86('0x1')]},'accountcode':{'type':Sequelize[_0x8d86('0x1')]},'threadid':{'type':Sequelize[_0x8d86('0x1')]},'project_name':{'type':Sequelize[_0x8d86('0x1')]},'joinAt':{'type':Sequelize[_0x8d86('0x2')]},'leaveAt':{'type':Sequelize[_0x8d86('0x2')]},'bot':{'type':Sequelize[_0x8d86('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf971=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x2215cd,_0x58c76c){var _0x34a5ba=function(_0x4fff1f){while(--_0x4fff1f){_0x2215cd['push'](_0x2215cd['shift']());}};_0x34a5ba(++_0x58c76c);}(_0xf971,0x7c));var _0x1f97=function(_0x4515b1,_0x14735b){_0x4515b1=_0x4515b1-0x0;var _0x2edeee=_0xf971[_0x4515b1];return _0x2edeee;};'use strict';var Sequelize=require(_0x1f97('0x0'));module[_0x1f97('0x1')]={'network':{'type':Sequelize[_0x1f97('0x2')]},'network_script':{'type':Sequelize[_0x1f97('0x2')]},'request':{'type':Sequelize[_0x1f97('0x2')]},'channel':{'type':Sequelize[_0x1f97('0x2')]},'language':{'type':Sequelize[_0x1f97('0x2')]},'type':{'type':Sequelize[_0x1f97('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x1f97('0x2')]},'callerid':{'type':Sequelize[_0x1f97('0x2')]},'calleridname':{'type':Sequelize[_0x1f97('0x2')]},'callingpres':{'type':Sequelize[_0x1f97('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x1f97('0x2')]},'callingtns':{'type':Sequelize[_0x1f97('0x2')]},'dnid':{'type':Sequelize[_0x1f97('0x2')]},'rdnis':{'type':Sequelize[_0x1f97('0x2')]},'context':{'type':Sequelize[_0x1f97('0x2')]},'extension':{'type':Sequelize[_0x1f97('0x2')]},'priority':{'type':Sequelize[_0x1f97('0x2')]},'enhanced':{'type':Sequelize[_0x1f97('0x2')]},'accountcode':{'type':Sequelize[_0x1f97('0x2')]},'threadid':{'type':Sequelize[_0x1f97('0x2')]},'project_name':{'type':Sequelize[_0x1f97('0x2')]},'joinAt':{'type':Sequelize[_0x1f97('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x1f97('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 dea515a..15b72f4 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 _0x0f8a=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x57000c,_0x4e5015){var _0x475aa1=function(_0x260c32){while(--_0x260c32){_0x57000c['push'](_0x57000c['shift']());}};_0x475aa1(++_0x4e5015);}(_0x0f8a,0x1d4));var _0xa0f8=function(_0x3542f9,_0x3ade8e){_0x3542f9=_0x3542f9-0x0;var _0x2dcbb4=_0x0f8a[_0x3542f9];return _0x2dcbb4;};'use strict';var emlformat=require(_0xa0f8('0x0'));var rimraf=require(_0xa0f8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa0f8('0x2'));var rp=require('request-promise');var moment=require(_0xa0f8('0x3'));var BPromise=require(_0xa0f8('0x4'));var Mustache=require(_0xa0f8('0x5'));var util=require(_0xa0f8('0x6'));var path=require('path');var sox=require(_0xa0f8('0x7'));var csv=require('to-csv');var ejs=require(_0xa0f8('0x8'));var fs=require('fs');var fs_extra=require(_0xa0f8('0x9'));var _=require(_0xa0f8('0xa'));var squel=require(_0xa0f8('0xb'));var crypto=require(_0xa0f8('0xc'));var jsforce=require(_0xa0f8('0xd'));var deskjs=require(_0xa0f8('0xe'));var toCsv=require(_0xa0f8('0xf'));var querystring=require(_0xa0f8('0x10'));var Papa=require(_0xa0f8('0x11'));var Redis=require(_0xa0f8('0x12'));var authService=require(_0xa0f8('0x13'));var qs=require(_0xa0f8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa0f8('0x15'));var logger=require(_0xa0f8('0x16'))(_0xa0f8('0x17'));var utils=require('../../config/utils');var config=require(_0xa0f8('0x18'));var licenseUtil=require(_0xa0f8('0x19'));var db=require(_0xa0f8('0x1a'))['db'];function respondWithStatusCode(_0xbf3a71,_0x4e8486){_0x4e8486=_0x4e8486||0xcc;return function(_0x519cea){if(_0x519cea){return _0xbf3a71[_0xa0f8('0x1b')](_0x4e8486);}return _0xbf3a71[_0xa0f8('0x1c')](_0x4e8486)[_0xa0f8('0x1d')]();};}function respondWithResult(_0x2ea2fa,_0x2a10a4){_0x2a10a4=_0x2a10a4||0xc8;return function(_0x2bc109){if(_0x2bc109){return _0x2ea2fa[_0xa0f8('0x1c')](_0x2a10a4)[_0xa0f8('0x1e')](_0x2bc109);}};}function respondWithFilteredResult(_0x5231d0,_0x9a48a8){return function(_0x14c490){if(_0x14c490){var _0x34aeae=typeof _0x9a48a8['offset']===_0xa0f8('0x1f')&&typeof _0x9a48a8[_0xa0f8('0x20')]===_0xa0f8('0x1f');var _0x12f22f=_0x14c490['count'];var _0x3b0b2b=_0x34aeae?0x0:_0x9a48a8[_0xa0f8('0x21')];var _0x34720d=_0x34aeae?_0x14c490[_0xa0f8('0x22')]:_0x9a48a8[_0xa0f8('0x21')]+_0x9a48a8[_0xa0f8('0x20')];var _0x4a1c41;if(_0x34720d>=_0x12f22f){_0x34720d=_0x12f22f;_0x4a1c41=0xc8;}else{_0x4a1c41=0xce;}_0x5231d0[_0xa0f8('0x1c')](_0x4a1c41);return _0x5231d0[_0xa0f8('0x23')](_0xa0f8('0x24'),_0x3b0b2b+'-'+_0x34720d+'/'+_0x12f22f)['json'](_0x14c490);}return null;};}function patchUpdates(_0x319607){return function(_0x1686ad){try{jsonpatch[_0xa0f8('0x25')](_0x1686ad,_0x319607,!![]);}catch(_0x36ec08){return BPromise[_0xa0f8('0x26')](_0x36ec08);}return _0x1686ad[_0xa0f8('0x27')]();};}function saveUpdates(_0xe33108,_0x367a42){return function(_0x2a220f){if(_0x2a220f){return _0x2a220f[_0xa0f8('0x28')](_0xe33108)[_0xa0f8('0x29')](function(_0x9a001e){return _0x9a001e;});}return null;};}function removeEntity(_0x337aa7,_0x5195fa){return function(_0x341626){if(_0x341626){return _0x341626[_0xa0f8('0x2a')]()['then'](function(){_0x337aa7[_0xa0f8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x496f45,_0x3af2d0){return function(_0x191ebc){if(!_0x191ebc){_0x496f45['sendStatus'](0x194);}return _0x191ebc;};}function handleError(_0x2986b6,_0x5a6194){_0x5a6194=_0x5a6194||0x1f4;return function(_0x147af5){logger[_0xa0f8('0x2b')](_0x147af5[_0xa0f8('0x2c')]);if(_0x147af5['name']){delete _0x147af5[_0xa0f8('0x2d')];}_0x2986b6['status'](_0x5a6194)[_0xa0f8('0x2e')](_0x147af5);};}exports[_0xa0f8('0x2f')]=function(_0x4caa88,_0x6a885d){var _0x243b64={},_0xbad7c9={},_0x2a2000={'count':0x0,'rows':[]};var _0x533850=_[_0xa0f8('0x30')](db[_0xa0f8('0x31')][_0xa0f8('0x32')],function(_0x5d834e){return{'name':_0x5d834e[_0xa0f8('0x33')],'type':_0x5d834e[_0xa0f8('0x34')][_0xa0f8('0x35')]};});_0xbad7c9[_0xa0f8('0x36')]=_[_0xa0f8('0x30')](_0x533850,_0xa0f8('0x2d'));_0xbad7c9[_0xa0f8('0x37')]=_[_0xa0f8('0x38')](_0x4caa88[_0xa0f8('0x37')]);_0xbad7c9[_0xa0f8('0x39')]=_[_0xa0f8('0x3a')](_0xbad7c9[_0xa0f8('0x36')],_0xbad7c9['query']);_0x243b64[_0xa0f8('0x3b')]=_[_0xa0f8('0x3a')](_0xbad7c9['model'],qs[_0xa0f8('0x3c')](_0x4caa88[_0xa0f8('0x37')]['fields']));_0x243b64[_0xa0f8('0x3b')]=_0x243b64['attributes'][_0xa0f8('0x3d')]?_0x243b64[_0xa0f8('0x3b')]:_0xbad7c9['model'];if(!_0x4caa88[_0xa0f8('0x37')][_0xa0f8('0x3e')]('nolimit')){_0x243b64[_0xa0f8('0x20')]=qs[_0xa0f8('0x20')](_0x4caa88['query'][_0xa0f8('0x20')]);_0x243b64[_0xa0f8('0x21')]=qs['offset'](_0x4caa88[_0xa0f8('0x37')]['offset']);}_0x243b64[_0xa0f8('0x3f')]=qs[_0xa0f8('0x40')](_0x4caa88[_0xa0f8('0x37')]['sort']);_0x243b64['where']=qs[_0xa0f8('0x39')](_[_0xa0f8('0x41')](_0x4caa88['query'],_0xbad7c9['filters']),_0x533850);if(_0x4caa88[_0xa0f8('0x37')][_0xa0f8('0x42')]){_0x243b64[_0xa0f8('0x43')]=_['merge'](_0x243b64['where'],{'$or':_[_0xa0f8('0x30')](_0x533850,function(_0x2b5b43){if(_0x2b5b43['type']!==_0xa0f8('0x44')){var _0xe97ba={};_0xe97ba[_0x2b5b43['name']]={'$like':'%'+_0x4caa88[_0xa0f8('0x37')]['filter']+'%'};return _0xe97ba;}})});}_0x243b64=_[_0xa0f8('0x45')]({},_0x243b64,_0x4caa88['options']);var _0x5d364c={'where':_0x243b64[_0xa0f8('0x43')]};return db[_0xa0f8('0x31')]['count'](_0x5d364c)[_0xa0f8('0x29')](function(_0x56b653){_0x2a2000[_0xa0f8('0x22')]=_0x56b653;if(_0x4caa88[_0xa0f8('0x37')]['includeAll']){_0x243b64[_0xa0f8('0x46')]=[{'all':!![]}];}return db[_0xa0f8('0x31')][_0xa0f8('0x47')](_0x243b64);})[_0xa0f8('0x29')](function(_0x4e6517){_0x2a2000[_0xa0f8('0x48')]=_0x4e6517;return _0x2a2000;})[_0xa0f8('0x29')](respondWithFilteredResult(_0x6a885d,_0x243b64))[_0xa0f8('0x49')](handleError(_0x6a885d,null));};exports[_0xa0f8('0x4a')]=function(_0x2953f4,_0x6e9238){var _0xfbe03={'raw':!![],'where':{'id':_0x2953f4['params']['id']}},_0xab843f={};_0xab843f[_0xa0f8('0x36')]=_[_0xa0f8('0x38')](db['SquareReport']['rawAttributes']);_0xab843f['query']=_[_0xa0f8('0x38')](_0x2953f4[_0xa0f8('0x37')]);_0xab843f[_0xa0f8('0x39')]=_[_0xa0f8('0x3a')](_0xab843f[_0xa0f8('0x36')],_0xab843f[_0xa0f8('0x37')]);_0xfbe03[_0xa0f8('0x3b')]=_[_0xa0f8('0x3a')](_0xab843f[_0xa0f8('0x36')],qs[_0xa0f8('0x3c')](_0x2953f4[_0xa0f8('0x37')][_0xa0f8('0x3c')]));_0xfbe03[_0xa0f8('0x3b')]=_0xfbe03[_0xa0f8('0x3b')][_0xa0f8('0x3d')]?_0xfbe03[_0xa0f8('0x3b')]:_0xab843f[_0xa0f8('0x36')];if(_0x2953f4['query'][_0xa0f8('0x4b')]){_0xfbe03[_0xa0f8('0x46')]=[{'all':!![]}];}_0xfbe03=_[_0xa0f8('0x45')]({},_0xfbe03,_0x2953f4[_0xa0f8('0x4c')]);return db['SquareReport'][_0xa0f8('0x4d')](_0xfbe03)['then'](handleEntityNotFound(_0x6e9238,null))[_0xa0f8('0x29')](respondWithResult(_0x6e9238,null))[_0xa0f8('0x49')](handleError(_0x6e9238,null));};exports[_0xa0f8('0x4e')]=function(_0x48a2c7,_0x3f2d2e){return db['SquareReport'][_0xa0f8('0x4e')](_0x48a2c7[_0xa0f8('0x4f')],{})['then'](respondWithResult(_0x3f2d2e,0xc9))['catch'](handleError(_0x3f2d2e,null));};exports[_0xa0f8('0x28')]=function(_0x255a1c,_0x2d29b8){if(_0x255a1c['body']['id']){delete _0x255a1c[_0xa0f8('0x4f')]['id'];}return db[_0xa0f8('0x31')]['find']({'where':{'id':_0x255a1c['params']['id']}})[_0xa0f8('0x29')](handleEntityNotFound(_0x2d29b8,null))[_0xa0f8('0x29')](saveUpdates(_0x255a1c[_0xa0f8('0x4f')],null))['then'](respondWithResult(_0x2d29b8,null))[_0xa0f8('0x49')](handleError(_0x2d29b8,null));};exports[_0xa0f8('0x2a')]=function(_0x5f5905,_0x21354e){return db['SquareReport'][_0xa0f8('0x4d')]({'where':{'id':_0x5f5905[_0xa0f8('0x50')]['id']}})[_0xa0f8('0x29')](handleEntityNotFound(_0x21354e,null))[_0xa0f8('0x29')](removeEntity(_0x21354e,null))[_0xa0f8('0x49')](handleError(_0x21354e,null));};exports[_0xa0f8('0x51')]=function(_0x783eed,_0x53792c){return db['SquareReport'][_0xa0f8('0x51')]()[_0xa0f8('0x29')](respondWithResult(_0x53792c,null))[_0xa0f8('0x49')](handleError(_0x53792c,null));}; \ No newline at end of file +var _0x31ad=['sort','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','error','stack','name','map','SquareReport','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x42ac42,_0x6e6a4b){var _0x50dc84=function(_0x38b450){while(--_0x38b450){_0x42ac42['push'](_0x42ac42['shift']());}};_0x50dc84(++_0x6e6a4b);}(_0x31ad,0xa0));var _0xd31a=function(_0x4802c1,_0x5dcfdf){_0x4802c1=_0x4802c1-0x0;var _0x136243=_0x31ad[_0x4802c1];return _0x136243;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd31a('0x0'));var zipdir=require(_0xd31a('0x1'));var jsonpatch=require(_0xd31a('0x2'));var rp=require(_0xd31a('0x3'));var moment=require('moment');var BPromise=require(_0xd31a('0x4'));var Mustache=require(_0xd31a('0x5'));var util=require(_0xd31a('0x6'));var path=require(_0xd31a('0x7'));var sox=require(_0xd31a('0x8'));var csv=require(_0xd31a('0x9'));var ejs=require(_0xd31a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd31a('0xb'));var squel=require('squel');var crypto=require(_0xd31a('0xc'));var jsforce=require(_0xd31a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd31a('0x9'));var querystring=require(_0xd31a('0xe'));var Papa=require('papaparse');var Redis=require(_0xd31a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd31a('0x10'));var as=require(_0xd31a('0x11'));var hardwareService=require(_0xd31a('0x12'));var logger=require(_0xd31a('0x13'))(_0xd31a('0x14'));var utils=require('../../config/utils');var config=require(_0xd31a('0x15'));var licenseUtil=require(_0xd31a('0x16'));var db=require(_0xd31a('0x17'))['db'];function respondWithStatusCode(_0x14cf15,_0xdbc2ce){_0xdbc2ce=_0xdbc2ce||0xcc;return function(_0x4df883){if(_0x4df883){return _0x14cf15[_0xd31a('0x18')](_0xdbc2ce);}return _0x14cf15[_0xd31a('0x19')](_0xdbc2ce)[_0xd31a('0x1a')]();};}function respondWithResult(_0x2c67a6,_0x2c8b6f){_0x2c8b6f=_0x2c8b6f||0xc8;return function(_0x23afa8){if(_0x23afa8){return _0x2c67a6[_0xd31a('0x19')](_0x2c8b6f)[_0xd31a('0x1b')](_0x23afa8);}};}function respondWithFilteredResult(_0xf044df,_0x3aac29){return function(_0xe4ada5){if(_0xe4ada5){var _0x160799=typeof _0x3aac29['offset']===_0xd31a('0x1c')&&typeof _0x3aac29[_0xd31a('0x1d')]===_0xd31a('0x1c');var _0x2f1e30=_0xe4ada5[_0xd31a('0x1e')];var _0x28d950=_0x160799?0x0:_0x3aac29['offset'];var _0x8cbdcc=_0x160799?_0xe4ada5['count']:_0x3aac29[_0xd31a('0x1f')]+_0x3aac29['limit'];var _0x31f65f;if(_0x8cbdcc>=_0x2f1e30){_0x8cbdcc=_0x2f1e30;_0x31f65f=0xc8;}else{_0x31f65f=0xce;}_0xf044df[_0xd31a('0x19')](_0x31f65f);return _0xf044df[_0xd31a('0x20')]('Content-Range',_0x28d950+'-'+_0x8cbdcc+'/'+_0x2f1e30)[_0xd31a('0x1b')](_0xe4ada5);}return null;};}function patchUpdates(_0x31b45f){return function(_0x42d401){try{jsonpatch[_0xd31a('0x21')](_0x42d401,_0x31b45f,!![]);}catch(_0x5dae49){return BPromise[_0xd31a('0x22')](_0x5dae49);}return _0x42d401['save']();};}function saveUpdates(_0x57717d,_0x48f629){return function(_0x259e6f){if(_0x259e6f){return _0x259e6f[_0xd31a('0x23')](_0x57717d)[_0xd31a('0x24')](function(_0x376ae9){return _0x376ae9;});}return null;};}function removeEntity(_0x49ac14,_0x520209){return function(_0x4c48d6){if(_0x4c48d6){return _0x4c48d6[_0xd31a('0x25')]()[_0xd31a('0x24')](function(){_0x49ac14['status'](0xcc)[_0xd31a('0x1a')]();});}};}function handleEntityNotFound(_0x3f43b6,_0x504c0e){return function(_0x472eb3){if(!_0x472eb3){_0x3f43b6['sendStatus'](0x194);}return _0x472eb3;};}function handleError(_0x3cf610,_0x5b80ea){_0x5b80ea=_0x5b80ea||0x1f4;return function(_0x366ed5){logger[_0xd31a('0x26')](_0x366ed5[_0xd31a('0x27')]);if(_0x366ed5[_0xd31a('0x28')]){delete _0x366ed5[_0xd31a('0x28')];}_0x3cf610[_0xd31a('0x19')](_0x5b80ea)['send'](_0x366ed5);};}exports['index']=function(_0x5612a2,_0x2c288c){var _0x14a40b={},_0x1db1ad={},_0x37ec0a={'count':0x0,'rows':[]};var _0x548566=_[_0xd31a('0x29')](db[_0xd31a('0x2a')][_0xd31a('0x2b')],function(_0x1eb250){return{'name':_0x1eb250['fieldName'],'type':_0x1eb250[_0xd31a('0x2c')][_0xd31a('0x2d')]};});_0x1db1ad['model']=_[_0xd31a('0x29')](_0x548566,_0xd31a('0x28'));_0x1db1ad[_0xd31a('0x2e')]=_['keys'](_0x5612a2[_0xd31a('0x2e')]);_0x1db1ad[_0xd31a('0x2f')]=_[_0xd31a('0x30')](_0x1db1ad[_0xd31a('0x31')],_0x1db1ad['query']);_0x14a40b['attributes']=_[_0xd31a('0x30')](_0x1db1ad[_0xd31a('0x31')],qs['fields'](_0x5612a2[_0xd31a('0x2e')][_0xd31a('0x32')]));_0x14a40b['attributes']=_0x14a40b[_0xd31a('0x33')][_0xd31a('0x34')]?_0x14a40b['attributes']:_0x1db1ad[_0xd31a('0x31')];if(!_0x5612a2[_0xd31a('0x2e')][_0xd31a('0x35')](_0xd31a('0x36'))){_0x14a40b[_0xd31a('0x1d')]=qs[_0xd31a('0x1d')](_0x5612a2[_0xd31a('0x2e')][_0xd31a('0x1d')]);_0x14a40b[_0xd31a('0x1f')]=qs[_0xd31a('0x1f')](_0x5612a2[_0xd31a('0x2e')][_0xd31a('0x1f')]);}_0x14a40b[_0xd31a('0x37')]=qs[_0xd31a('0x38')](_0x5612a2[_0xd31a('0x2e')][_0xd31a('0x38')]);_0x14a40b['where']=qs['filters'](_[_0xd31a('0x39')](_0x5612a2[_0xd31a('0x2e')],_0x1db1ad['filters']),_0x548566);if(_0x5612a2[_0xd31a('0x2e')][_0xd31a('0x3a')]){_0x14a40b['where']=_[_0xd31a('0x3b')](_0x14a40b['where'],{'$or':_[_0xd31a('0x29')](_0x548566,function(_0x3a817e){if(_0x3a817e[_0xd31a('0x2c')]!=='VIRTUAL'){var _0x2716b9={};_0x2716b9[_0x3a817e[_0xd31a('0x28')]]={'$like':'%'+_0x5612a2['query']['filter']+'%'};return _0x2716b9;}})});}_0x14a40b=_[_0xd31a('0x3b')]({},_0x14a40b,_0x5612a2[_0xd31a('0x3c')]);var _0x42891a={'where':_0x14a40b['where']};return db[_0xd31a('0x2a')][_0xd31a('0x1e')](_0x42891a)[_0xd31a('0x24')](function(_0x5eaac0){_0x37ec0a[_0xd31a('0x1e')]=_0x5eaac0;if(_0x5612a2[_0xd31a('0x2e')][_0xd31a('0x3d')]){_0x14a40b[_0xd31a('0x3e')]=[{'all':!![]}];}return db['SquareReport'][_0xd31a('0x3f')](_0x14a40b);})['then'](function(_0x138795){_0x37ec0a[_0xd31a('0x40')]=_0x138795;return _0x37ec0a;})[_0xd31a('0x24')](respondWithFilteredResult(_0x2c288c,_0x14a40b))['catch'](handleError(_0x2c288c,null));};exports[_0xd31a('0x41')]=function(_0x3a3591,_0x32ac48){var _0x24cb63={'raw':!![],'where':{'id':_0x3a3591[_0xd31a('0x42')]['id']}},_0x5a0258={};_0x5a0258['model']=_[_0xd31a('0x43')](db[_0xd31a('0x2a')][_0xd31a('0x2b')]);_0x5a0258['query']=_[_0xd31a('0x43')](_0x3a3591['query']);_0x5a0258['filters']=_[_0xd31a('0x30')](_0x5a0258['model'],_0x5a0258[_0xd31a('0x2e')]);_0x24cb63['attributes']=_[_0xd31a('0x30')](_0x5a0258[_0xd31a('0x31')],qs[_0xd31a('0x32')](_0x3a3591[_0xd31a('0x2e')]['fields']));_0x24cb63[_0xd31a('0x33')]=_0x24cb63[_0xd31a('0x33')][_0xd31a('0x34')]?_0x24cb63[_0xd31a('0x33')]:_0x5a0258[_0xd31a('0x31')];if(_0x3a3591[_0xd31a('0x2e')]['includeAll']){_0x24cb63[_0xd31a('0x3e')]=[{'all':!![]}];}_0x24cb63=_['merge']({},_0x24cb63,_0x3a3591['options']);return db[_0xd31a('0x2a')]['find'](_0x24cb63)[_0xd31a('0x24')](handleEntityNotFound(_0x32ac48,null))['then'](respondWithResult(_0x32ac48,null))[_0xd31a('0x44')](handleError(_0x32ac48,null));};exports[_0xd31a('0x45')]=function(_0x24ed17,_0x40c37c){return db['SquareReport'][_0xd31a('0x45')](_0x24ed17[_0xd31a('0x46')],{})[_0xd31a('0x24')](respondWithResult(_0x40c37c,0xc9))[_0xd31a('0x44')](handleError(_0x40c37c,null));};exports[_0xd31a('0x23')]=function(_0x572617,_0x36a732){if(_0x572617[_0xd31a('0x46')]['id']){delete _0x572617[_0xd31a('0x46')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x572617['params']['id']}})['then'](handleEntityNotFound(_0x36a732,null))[_0xd31a('0x24')](saveUpdates(_0x572617['body'],null))[_0xd31a('0x24')](respondWithResult(_0x36a732,null))[_0xd31a('0x44')](handleError(_0x36a732,null));};exports[_0xd31a('0x25')]=function(_0xaa36f3,_0x306b36){return db[_0xd31a('0x2a')]['find']({'where':{'id':_0xaa36f3['params']['id']}})[_0xd31a('0x24')](handleEntityNotFound(_0x306b36,null))[_0xd31a('0x24')](removeEntity(_0x306b36,null))[_0xd31a('0x44')](handleError(_0x306b36,null));};exports[_0xd31a('0x47')]=function(_0x3a162b,_0x371529){return db['SquareReport'][_0xd31a('0x47')]()[_0xd31a('0x24')](respondWithResult(_0x371529,null))[_0xd31a('0x44')](handleError(_0x371529,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 0c9cf7b..a901095 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 _0x388c=['./squareReport.attributes','exports','define','SquareReport','uid_pname','project_name','leaveAt','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x123c09,_0x44fe60){var _0x3cbf7a=function(_0x2b2042){while(--_0x2b2042){_0x123c09['push'](_0x123c09['shift']());}};_0x3cbf7a(++_0x44fe60);}(_0x388c,0xe4));var _0xc388=function(_0x59f9e6,_0x1485df){_0x59f9e6=_0x59f9e6-0x0;var _0x415f6c=_0x388c[_0x59f9e6];return _0x415f6c;};'use strict';var _=require(_0xc388('0x0'));var util=require('util');var logger=require(_0xc388('0x1'))(_0xc388('0x2'));var moment=require('moment');var BPromise=require(_0xc388('0x3'));var rp=require(_0xc388('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc388('0x5'));var config=require('../../config/environment');var attributes=require(_0xc388('0x6'));module[_0xc388('0x7')]=function(_0x30d9a7,_0x2d9184){return _0x30d9a7[_0xc388('0x8')](_0xc388('0x9'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xc388('0xa'),'fields':['uniqueid',_0xc388('0xb')]},{'name':_0xc388('0xc'),'fields':[_0xc388('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x81ae=['lodash','util','api','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','report_square','uniqueid','project_name','leaveAt'];(function(_0x3fa9ce,_0x2bed6c){var _0x495007=function(_0x36401e){while(--_0x36401e){_0x3fa9ce['push'](_0x3fa9ce['shift']());}};_0x495007(++_0x2bed6c);}(_0x81ae,0x111));var _0xe81a=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x81ae[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xe81a('0x0'));var util=require(_0xe81a('0x1'));var logger=require('../../config/logger')(_0xe81a('0x2'));var moment=require('moment');var BPromise=require(_0xe81a('0x3'));var rp=require(_0xe81a('0x4'));var fs=require('fs');var path=require(_0xe81a('0x5'));var rimraf=require('rimraf');var config=require(_0xe81a('0x6'));var attributes=require(_0xe81a('0x7'));module[_0xe81a('0x8')]=function(_0x2d5b16,_0x515680){return _0x2d5b16['define']('SquareReport',attributes,{'tableName':_0xe81a('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xe81a('0xa'),_0xe81a('0xb')]},{'name':_0xe81a('0xc'),'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 7412373..7194422 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 _0x4bbd=['../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','CreateSquareReport','SquareReport','create','body','options','raw','then','catch','UpdateSquareReport','attributes','limit','util','bluebird','ioredis','../../config/utils'];(function(_0x20e62e,_0x39ad84){var _0x408c13=function(_0x5bb2cf){while(--_0x5bb2cf){_0x20e62e['push'](_0x20e62e['shift']());}};_0x408c13(++_0x39ad84);}(_0x4bbd,0xb6));var _0xd4bb=function(_0x3f390d,_0x308196){_0x3f390d=_0x3f390d-0x0;var _0x386e54=_0x4bbd[_0x3f390d];return _0x386e54;};'use strict';var _=require('lodash');var util=require(_0xd4bb('0x0'));var moment=require('moment');var BPromise=require(_0xd4bb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4bb('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd4bb('0x3'));var logger=require(_0xd4bb('0x4'))('rpc');var config=require(_0xd4bb('0x5'));var jayson=require(_0xd4bb('0x6'));var client=jayson[_0xd4bb('0x7')][_0xd4bb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dd22c,_0x5873b6,_0x4e8aa8){return new BPromise(function(_0x44d0d5,_0x5c55e5){return client[_0xd4bb('0x9')](_0x3dd22c,_0x4e8aa8)['then'](function(_0x41bf4e){logger[_0xd4bb('0xa')]('SquareReport,\x20%s,\x20%s',_0x5873b6,_0xd4bb('0xb'));logger[_0xd4bb('0xc')](_0xd4bb('0xd'),_0x5873b6,'request\x20sent',JSON[_0xd4bb('0xe')](_0x41bf4e));if(_0x41bf4e[_0xd4bb('0xf')]){if(_0x41bf4e['error'][_0xd4bb('0x10')]===0x1f4){logger['error'](_0xd4bb('0x11'),_0x5873b6,_0x41bf4e['error']['message']);return _0x5c55e5(_0x41bf4e[_0xd4bb('0xf')][_0xd4bb('0x12')]);}logger[_0xd4bb('0xf')](_0xd4bb('0x11'),_0x5873b6,_0x41bf4e['error'][_0xd4bb('0x12')]);return _0x44d0d5(_0x41bf4e[_0xd4bb('0xf')][_0xd4bb('0x12')]);}else{logger[_0xd4bb('0xa')](_0xd4bb('0x11'),_0x5873b6,_0xd4bb('0xb'));_0x44d0d5(_0x41bf4e[_0xd4bb('0x13')][_0xd4bb('0x12')]);}})['catch'](function(_0x52e413){logger[_0xd4bb('0xf')](_0xd4bb('0x11'),_0x5873b6,_0x52e413);_0x5c55e5(_0x52e413);});});}exports[_0xd4bb('0x14')]=function(_0x83e99e){var _0x44bd0d=this;return new Promise(function(_0xdf4f0f,_0x847903){return db[_0xd4bb('0x15')][_0xd4bb('0x16')](_0x83e99e[_0xd4bb('0x17')],{'raw':_0x83e99e[_0xd4bb('0x18')]?_0x83e99e[_0xd4bb('0x18')][_0xd4bb('0x19')]===undefined?!![]:![]:!![]})[_0xd4bb('0x1a')](function(_0x261013){logger[_0xd4bb('0xa')]('CreateSquareReport',_0x83e99e);logger[_0xd4bb('0xc')](_0xd4bb('0x14'),_0x83e99e,JSON[_0xd4bb('0xe')](_0x261013));_0xdf4f0f(_0x261013);})[_0xd4bb('0x1b')](function(_0x262895){logger[_0xd4bb('0xf')](_0xd4bb('0x14'),_0x262895[_0xd4bb('0x12')],_0x83e99e);_0x847903(_0x44bd0d[_0xd4bb('0xf')](0x1f4,_0x262895['message']));});});};exports[_0xd4bb('0x1c')]=function(_0xa21e34){var _0x109831=this;return new Promise(function(_0x110a53,_0x53e5a4){return db[_0xd4bb('0x15')]['update'](_0xa21e34['body'],{'raw':_0xa21e34['options']?_0xa21e34[_0xd4bb('0x18')][_0xd4bb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa21e34['options']?_0xa21e34[_0xd4bb('0x18')]['where']||null:null,'attributes':_0xa21e34[_0xd4bb('0x18')]?_0xa21e34['options'][_0xd4bb('0x1d')]||null:null,'limit':_0xa21e34[_0xd4bb('0x18')]?_0xa21e34[_0xd4bb('0x18')][_0xd4bb('0x1e')]||null:null})[_0xd4bb('0x1a')](function(_0x4304f5){logger[_0xd4bb('0xa')](_0xd4bb('0x1c'),_0xa21e34);logger[_0xd4bb('0xc')]('UpdateSquareReport',_0xa21e34,JSON[_0xd4bb('0xe')](_0x4304f5));_0x110a53(_0x4304f5);})[_0xd4bb('0x1b')](function(_0x5c423){logger[_0xd4bb('0xf')](_0xd4bb('0x1c'),_0x5c423[_0xd4bb('0x12')],_0xa21e34);_0x53e5a4(_0x109831[_0xd4bb('0xf')](0x1f4,_0x5c423[_0xd4bb('0x12')]));});});}; \ No newline at end of file +var _0x2ec1=['SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','body','options','raw','UpdateSquareReport','where','attributes','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info'];(function(_0x493c97,_0x317a51){var _0x22ec93=function(_0x675b09){while(--_0x675b09){_0x493c97['push'](_0x493c97['shift']());}};_0x22ec93(++_0x317a51);}(_0x2ec1,0x19a));var _0x12ec=function(_0x356beb,_0x308032){_0x356beb=_0x356beb-0x0;var _0x4e2281=_0x2ec1[_0x356beb];return _0x4e2281;};'use strict';var _=require(_0x12ec('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x12ec('0x1'));var db=require(_0x12ec('0x2'))['db'];var utils=require(_0x12ec('0x3'));var logger=require(_0x12ec('0x4'))('rpc');var config=require(_0x12ec('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x12ec('0x6')][_0x12ec('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x18dd9d,_0xed5e2,_0x3004cd){return new BPromise(function(_0x57e993,_0x31fea1){return client['request'](_0x18dd9d,_0x3004cd)[_0x12ec('0x8')](function(_0x6da373){logger[_0x12ec('0x9')](_0x12ec('0xa'),_0xed5e2,'request\x20sent');logger[_0x12ec('0xb')](_0x12ec('0xc'),_0xed5e2,_0x12ec('0xd'),JSON[_0x12ec('0xe')](_0x6da373));if(_0x6da373['error']){if(_0x6da373[_0x12ec('0xf')][_0x12ec('0x10')]===0x1f4){logger[_0x12ec('0xf')](_0x12ec('0xa'),_0xed5e2,_0x6da373['error']['message']);return _0x31fea1(_0x6da373[_0x12ec('0xf')][_0x12ec('0x11')]);}logger[_0x12ec('0xf')](_0x12ec('0xa'),_0xed5e2,_0x6da373[_0x12ec('0xf')][_0x12ec('0x11')]);return _0x57e993(_0x6da373['error'][_0x12ec('0x11')]);}else{logger[_0x12ec('0x9')](_0x12ec('0xa'),_0xed5e2,_0x12ec('0xd'));_0x57e993(_0x6da373[_0x12ec('0x12')][_0x12ec('0x11')]);}})[_0x12ec('0x13')](function(_0xae6105){logger[_0x12ec('0xf')]('SquareReport,\x20%s,\x20%s',_0xed5e2,_0xae6105);_0x31fea1(_0xae6105);});});}exports[_0x12ec('0x14')]=function(_0x1e9dac){var _0x17a69=this;return new Promise(function(_0x42565f,_0x3c96f4){return db[_0x12ec('0x15')]['create'](_0x1e9dac[_0x12ec('0x16')],{'raw':_0x1e9dac['options']?_0x1e9dac[_0x12ec('0x17')][_0x12ec('0x18')]===undefined?!![]:![]:!![]})[_0x12ec('0x8')](function(_0x4e9473){logger[_0x12ec('0x9')](_0x12ec('0x14'),_0x1e9dac);logger[_0x12ec('0xb')]('CreateSquareReport',_0x1e9dac,JSON[_0x12ec('0xe')](_0x4e9473));_0x42565f(_0x4e9473);})[_0x12ec('0x13')](function(_0x4539e3){logger['error']('CreateSquareReport',_0x4539e3['message'],_0x1e9dac);_0x3c96f4(_0x17a69['error'](0x1f4,_0x4539e3['message']));});});};exports[_0x12ec('0x19')]=function(_0x38c0f0){var _0x4a4052=this;return new Promise(function(_0x547ad6,_0x4ac4d8){return db[_0x12ec('0x15')]['update'](_0x38c0f0[_0x12ec('0x16')],{'raw':_0x38c0f0[_0x12ec('0x17')]?_0x38c0f0[_0x12ec('0x17')][_0x12ec('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38c0f0['options']?_0x38c0f0['options'][_0x12ec('0x1a')]||null:null,'attributes':_0x38c0f0[_0x12ec('0x17')]?_0x38c0f0[_0x12ec('0x17')][_0x12ec('0x1b')]||null:null,'limit':_0x38c0f0[_0x12ec('0x17')]?_0x38c0f0[_0x12ec('0x17')]['limit']||null:null})[_0x12ec('0x8')](function(_0x41f030){logger[_0x12ec('0x9')](_0x12ec('0x19'),_0x38c0f0);logger[_0x12ec('0xb')](_0x12ec('0x19'),_0x38c0f0,JSON[_0x12ec('0xe')](_0x41f030));_0x547ad6(_0x41f030);})[_0x12ec('0x13')](function(_0x524c96){logger['error']('UpdateSquareReport',_0x524c96['message'],_0x38c0f0);_0x4ac4d8(_0x4a4052[_0x12ec('0xf')](0x1f4,_0x524c96[_0x12ec('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 6bb06f8..bada6b7 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 _0x66b7=['describe','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareReportDetail.controller','get','index','/describe'];(function(_0x5c275e,_0x518298){var _0x5f1a1e=function(_0x1d0532){while(--_0x1d0532){_0x5c275e['push'](_0x5c275e['shift']());}};_0x5f1a1e(++_0x518298);}(_0x66b7,0x1c0));var _0x766b=function(_0x496c03,_0x469a38){_0x496c03=_0x496c03-0x0;var _0x5eccc5=_0x66b7[_0x496c03];return _0x5eccc5;};'use strict';var multer=require(_0x766b('0x0'));var util=require(_0x766b('0x1'));var path=require(_0x766b('0x2'));var timeout=require(_0x766b('0x3'));var express=require(_0x766b('0x4'));var router=express[_0x766b('0x5')]();var fs_extra=require(_0x766b('0x6'));var auth=require(_0x766b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x766b('0x8'));router[_0x766b('0x9')]('/',auth['isAuthenticated'](),controller[_0x766b('0xa')]);router['get'](_0x766b('0xb'),auth['isAuthenticated'](),controller[_0x766b('0xc')]);router[_0x766b('0x9')]('/:id',auth[_0x766b('0xd')](),controller[_0x766b('0xe')]);router[_0x766b('0xf')]('/',auth[_0x766b('0xd')](),controller[_0x766b('0x10')]);router[_0x766b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x766b('0x12')]);router[_0x766b('0x13')](_0x766b('0x14'),auth[_0x766b('0xd')](),controller[_0x766b('0x15')]);module[_0x766b('0x16')]=router; \ No newline at end of file +var _0x4f41=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','util','path','Router','fs-extra'];(function(_0x419ab2,_0x2a7e6d){var _0x173304=function(_0x3c6049){while(--_0x3c6049){_0x419ab2['push'](_0x419ab2['shift']());}};_0x173304(++_0x2a7e6d);}(_0x4f41,0xd4));var _0x14f4=function(_0x3d0098,_0x22ee82){_0x3d0098=_0x3d0098-0x0;var _0x3ef587=_0x4f41[_0x3d0098];return _0x3ef587;};'use strict';var multer=require('multer');var util=require(_0x14f4('0x0'));var path=require(_0x14f4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x14f4('0x2')]();var fs_extra=require(_0x14f4('0x3'));var auth=require(_0x14f4('0x4'));var interaction=require(_0x14f4('0x5'));var config=require(_0x14f4('0x6'));var controller=require('./squareReportDetail.controller');router[_0x14f4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x14f4('0x7')](_0x14f4('0x8'),auth[_0x14f4('0x9')](),controller['describe']);router['get'](_0x14f4('0xa'),auth[_0x14f4('0x9')](),controller[_0x14f4('0xb')]);router[_0x14f4('0xc')]('/',auth[_0x14f4('0x9')](),controller['create']);router[_0x14f4('0xd')](_0x14f4('0xa'),auth[_0x14f4('0x9')](),controller[_0x14f4('0xe')]);router[_0x14f4('0xf')](_0x14f4('0xa'),auth['isAuthenticated'](),controller[_0x14f4('0x10')]);module[_0x14f4('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 6a7e941..8d356cb 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 _0x2cf7=['exports','STRING','TEXT','sequelize'];(function(_0x5c10ea,_0x4f5640){var _0x58b180=function(_0x17a81c){while(--_0x17a81c){_0x5c10ea['push'](_0x5c10ea['shift']());}};_0x58b180(++_0x4f5640);}(_0x2cf7,0x1d3));var _0x72cf=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x2cf7[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0x72cf('0x0'));module[_0x72cf('0x1')]={'uniqueid':{'type':Sequelize[_0x72cf('0x2')]},'node':{'type':Sequelize[_0x72cf('0x2')]},'application':{'type':Sequelize[_0x72cf('0x2')]},'data':{'type':Sequelize[_0x72cf('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x72cf('0x2')]}}; \ No newline at end of file +var _0xce8e=['sequelize','exports','STRING','TEXT'];(function(_0x451217,_0x2f896b){var _0x5060a3=function(_0x494679){while(--_0x494679){_0x451217['push'](_0x451217['shift']());}};_0x5060a3(++_0x2f896b);}(_0xce8e,0x1f4));var _0xece8=function(_0x59c8c8,_0x87d8de){_0x59c8c8=_0x59c8c8-0x0;var _0x20d93f=_0xce8e[_0x59c8c8];return _0x20d93f;};'use strict';var Sequelize=require(_0xece8('0x0'));module[_0xece8('0x1')]={'uniqueid':{'type':Sequelize[_0xece8('0x2')]},'node':{'type':Sequelize[_0xece8('0x2')]},'application':{'type':Sequelize[_0xece8('0x2')]},'data':{'type':Sequelize[_0xece8('0x3')]},'project_name':{'type':Sequelize[_0xece8('0x2')]},'callerid':{'type':Sequelize[_0xece8('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index a460c6f..1353d31 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 _0x85ac=['send','index','SquareDetailsReport','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','params','length','options','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','apply','save','destroy','then','error','stack','name'];(function(_0x3f2e3b,_0x25f3c4){var _0x57e2d7=function(_0x4330d4){while(--_0x4330d4){_0x3f2e3b['push'](_0x3f2e3b['shift']());}};_0x57e2d7(++_0x25f3c4);}(_0x85ac,0x1f3));var _0xc85a=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x85ac[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0xc85a('0x0'));var rimraf=require(_0xc85a('0x1'));var zipdir=require(_0xc85a('0x2'));var jsonpatch=require(_0xc85a('0x3'));var rp=require(_0xc85a('0x4'));var moment=require(_0xc85a('0x5'));var BPromise=require(_0xc85a('0x6'));var Mustache=require(_0xc85a('0x7'));var util=require(_0xc85a('0x8'));var path=require(_0xc85a('0x9'));var sox=require(_0xc85a('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc85a('0xb'));var _=require(_0xc85a('0xc'));var squel=require(_0xc85a('0xd'));var crypto=require(_0xc85a('0xe'));var jsforce=require(_0xc85a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc85a('0x10'));var querystring=require(_0xc85a('0x11'));var Papa=require(_0xc85a('0x12'));var Redis=require('ioredis');var authService=require(_0xc85a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc85a('0x14'));var hardwareService=require(_0xc85a('0x15'));var logger=require('../../config/logger')(_0xc85a('0x16'));var utils=require(_0xc85a('0x17'));var config=require(_0xc85a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc85a('0x19'))['db'];function respondWithStatusCode(_0x48f718,_0x437e1a){_0x437e1a=_0x437e1a||0xcc;return function(_0x3b2ea2){if(_0x3b2ea2){return _0x48f718[_0xc85a('0x1a')](_0x437e1a);}return _0x48f718[_0xc85a('0x1b')](_0x437e1a)['end']();};}function respondWithResult(_0x25b429,_0x16cd60){_0x16cd60=_0x16cd60||0xc8;return function(_0x214e50){if(_0x214e50){return _0x25b429['status'](_0x16cd60)[_0xc85a('0x1c')](_0x214e50);}};}function respondWithFilteredResult(_0x24c538,_0x1d21c4){return function(_0x243817){if(_0x243817){var _0x21e6cb=typeof _0x1d21c4[_0xc85a('0x1d')]===_0xc85a('0x1e')&&typeof _0x1d21c4['limit']===_0xc85a('0x1e');var _0x564d62=_0x243817[_0xc85a('0x1f')];var _0x13e72b=_0x21e6cb?0x0:_0x1d21c4['offset'];var _0x1ab48c=_0x21e6cb?_0x243817[_0xc85a('0x1f')]:_0x1d21c4[_0xc85a('0x1d')]+_0x1d21c4['limit'];var _0x19b6bf;if(_0x1ab48c>=_0x564d62){_0x1ab48c=_0x564d62;_0x19b6bf=0xc8;}else{_0x19b6bf=0xce;}_0x24c538[_0xc85a('0x1b')](_0x19b6bf);return _0x24c538[_0xc85a('0x20')]('Content-Range',_0x13e72b+'-'+_0x1ab48c+'/'+_0x564d62)[_0xc85a('0x1c')](_0x243817);}return null;};}function patchUpdates(_0x9cf4a9){return function(_0x368076){try{jsonpatch[_0xc85a('0x21')](_0x368076,_0x9cf4a9,!![]);}catch(_0x1db109){return BPromise['reject'](_0x1db109);}return _0x368076[_0xc85a('0x22')]();};}function saveUpdates(_0x33b4d9,_0x4d9b28){return function(_0x15f1e4){if(_0x15f1e4){return _0x15f1e4['update'](_0x33b4d9)['then'](function(_0x1022c8){return _0x1022c8;});}return null;};}function removeEntity(_0xf29f04,_0x5d797c){return function(_0x233286){if(_0x233286){return _0x233286[_0xc85a('0x23')]()[_0xc85a('0x24')](function(){_0xf29f04[_0xc85a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1402f5,_0x5a8e9a){return function(_0x161481){if(!_0x161481){_0x1402f5[_0xc85a('0x1a')](0x194);}return _0x161481;};}function handleError(_0x932c2f,_0x86ae8){_0x86ae8=_0x86ae8||0x1f4;return function(_0x3969dc){logger[_0xc85a('0x25')](_0x3969dc[_0xc85a('0x26')]);if(_0x3969dc['name']){delete _0x3969dc[_0xc85a('0x27')];}_0x932c2f[_0xc85a('0x1b')](_0x86ae8)[_0xc85a('0x28')](_0x3969dc);};}exports[_0xc85a('0x29')]=function(_0x905054,_0x549ef7){var _0x4ff26e={},_0x364c99={},_0x52b4e2={'count':0x0,'rows':[]};var _0xea65a=_['map'](db[_0xc85a('0x2a')][_0xc85a('0x2b')],function(_0x56ecac){return{'name':_0x56ecac[_0xc85a('0x2c')],'type':_0x56ecac[_0xc85a('0x2d')][_0xc85a('0x2e')]};});_0x364c99['model']=_[_0xc85a('0x2f')](_0xea65a,_0xc85a('0x27'));_0x364c99['query']=_[_0xc85a('0x30')](_0x905054[_0xc85a('0x31')]);_0x364c99[_0xc85a('0x32')]=_[_0xc85a('0x33')](_0x364c99['model'],_0x364c99['query']);_0x4ff26e[_0xc85a('0x34')]=_[_0xc85a('0x33')](_0x364c99[_0xc85a('0x35')],qs['fields'](_0x905054[_0xc85a('0x31')][_0xc85a('0x36')]));_0x4ff26e['attributes']=_0x4ff26e['attributes']['length']?_0x4ff26e[_0xc85a('0x34')]:_0x364c99[_0xc85a('0x35')];if(!_0x905054[_0xc85a('0x31')][_0xc85a('0x37')](_0xc85a('0x38'))){_0x4ff26e[_0xc85a('0x39')]=qs[_0xc85a('0x39')](_0x905054[_0xc85a('0x31')][_0xc85a('0x39')]);_0x4ff26e[_0xc85a('0x1d')]=qs[_0xc85a('0x1d')](_0x905054[_0xc85a('0x31')][_0xc85a('0x1d')]);}_0x4ff26e[_0xc85a('0x3a')]=qs[_0xc85a('0x3b')](_0x905054[_0xc85a('0x31')]['sort']);_0x4ff26e[_0xc85a('0x3c')]=qs['filters'](_[_0xc85a('0x3d')](_0x905054[_0xc85a('0x31')],_0x364c99['filters']),_0xea65a);if(_0x905054[_0xc85a('0x31')]['filter']){_0x4ff26e['where']=_['merge'](_0x4ff26e['where'],{'$or':_['map'](_0xea65a,function(_0x95d772){if(_0x95d772['type']!==_0xc85a('0x3e')){var _0x44f9e4={};_0x44f9e4[_0x95d772[_0xc85a('0x27')]]={'$like':'%'+_0x905054[_0xc85a('0x31')][_0xc85a('0x3f')]+'%'};return _0x44f9e4;}})});}_0x4ff26e=_[_0xc85a('0x40')]({},_0x4ff26e,_0x905054['options']);var _0x16d1f8={'where':_0x4ff26e[_0xc85a('0x3c')]};return db[_0xc85a('0x2a')][_0xc85a('0x1f')](_0x16d1f8)['then'](function(_0x82bca1){_0x52b4e2[_0xc85a('0x1f')]=_0x82bca1;if(_0x905054[_0xc85a('0x31')][_0xc85a('0x41')]){_0x4ff26e[_0xc85a('0x42')]=[{'all':!![]}];}return db[_0xc85a('0x2a')][_0xc85a('0x43')](_0x4ff26e);})[_0xc85a('0x24')](function(_0x164001){_0x52b4e2['rows']=_0x164001;return _0x52b4e2;})[_0xc85a('0x24')](respondWithFilteredResult(_0x549ef7,_0x4ff26e))[_0xc85a('0x44')](handleError(_0x549ef7,null));};exports[_0xc85a('0x45')]=function(_0x2df406,_0x5bab6c){var _0x80b5c7={'raw':!![],'where':{'id':_0x2df406[_0xc85a('0x46')]['id']}},_0x4b4b86={};_0x4b4b86[_0xc85a('0x35')]=_[_0xc85a('0x30')](db[_0xc85a('0x2a')]['rawAttributes']);_0x4b4b86[_0xc85a('0x31')]=_[_0xc85a('0x30')](_0x2df406[_0xc85a('0x31')]);_0x4b4b86[_0xc85a('0x32')]=_[_0xc85a('0x33')](_0x4b4b86[_0xc85a('0x35')],_0x4b4b86[_0xc85a('0x31')]);_0x80b5c7[_0xc85a('0x34')]=_[_0xc85a('0x33')](_0x4b4b86[_0xc85a('0x35')],qs[_0xc85a('0x36')](_0x2df406[_0xc85a('0x31')][_0xc85a('0x36')]));_0x80b5c7[_0xc85a('0x34')]=_0x80b5c7[_0xc85a('0x34')][_0xc85a('0x47')]?_0x80b5c7[_0xc85a('0x34')]:_0x4b4b86[_0xc85a('0x35')];if(_0x2df406[_0xc85a('0x31')][_0xc85a('0x41')]){_0x80b5c7[_0xc85a('0x42')]=[{'all':!![]}];}_0x80b5c7=_['merge']({},_0x80b5c7,_0x2df406[_0xc85a('0x48')]);return db['SquareDetailsReport'][_0xc85a('0x49')](_0x80b5c7)[_0xc85a('0x24')](handleEntityNotFound(_0x5bab6c,null))[_0xc85a('0x24')](respondWithResult(_0x5bab6c,null))['catch'](handleError(_0x5bab6c,null));};exports['create']=function(_0x1e3936,_0x5609b3){return db['SquareDetailsReport'][_0xc85a('0x4a')](_0x1e3936['body'],{})[_0xc85a('0x24')](respondWithResult(_0x5609b3,0xc9))[_0xc85a('0x44')](handleError(_0x5609b3,null));};exports[_0xc85a('0x4b')]=function(_0x3ecdd1,_0x1d7695){if(_0x3ecdd1[_0xc85a('0x4c')]['id']){delete _0x3ecdd1[_0xc85a('0x4c')]['id'];}return db[_0xc85a('0x2a')][_0xc85a('0x49')]({'where':{'id':_0x3ecdd1['params']['id']}})[_0xc85a('0x24')](handleEntityNotFound(_0x1d7695,null))['then'](saveUpdates(_0x3ecdd1['body'],null))[_0xc85a('0x24')](respondWithResult(_0x1d7695,null))[_0xc85a('0x44')](handleError(_0x1d7695,null));};exports[_0xc85a('0x23')]=function(_0x12261c,_0x5e9d04){return db[_0xc85a('0x2a')][_0xc85a('0x49')]({'where':{'id':_0x12261c['params']['id']}})['then'](handleEntityNotFound(_0x5e9d04,null))[_0xc85a('0x24')](removeEntity(_0x5e9d04,null))[_0xc85a('0x44')](handleError(_0x5e9d04,null));};exports['describe']=function(_0x3b7b43,_0x2f19bd){return db[_0xc85a('0x2a')]['describe']()[_0xc85a('0x24')](respondWithResult(_0x2f19bd,null))[_0xc85a('0x44')](handleError(_0x2f19bd,null));}; \ No newline at end of file +var _0x92ab=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','SquareDetailsReport','findAll','rows','catch','show','options','create','update','body','find','params','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','query','keys'];(function(_0x39f375,_0x3aa8ec){var _0x463f93=function(_0x290215){while(--_0x290215){_0x39f375['push'](_0x39f375['shift']());}};_0x463f93(++_0x3aa8ec);}(_0x92ab,0x193));var _0xb92a=function(_0x14712c,_0x5920f5){_0x14712c=_0x14712c-0x0;var _0x58f6a0=_0x92ab[_0x14712c];return _0x58f6a0;};'use strict';var emlformat=require(_0xb92a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb92a('0x1'));var rp=require(_0xb92a('0x2'));var moment=require('moment');var BPromise=require(_0xb92a('0x3'));var Mustache=require(_0xb92a('0x4'));var util=require(_0xb92a('0x5'));var path=require(_0xb92a('0x6'));var sox=require(_0xb92a('0x7'));var csv=require('to-csv');var ejs=require(_0xb92a('0x8'));var fs=require('fs');var fs_extra=require(_0xb92a('0x9'));var _=require('lodash');var squel=require(_0xb92a('0xa'));var crypto=require(_0xb92a('0xb'));var jsforce=require(_0xb92a('0xc'));var deskjs=require(_0xb92a('0xd'));var toCsv=require(_0xb92a('0xe'));var querystring=require(_0xb92a('0xf'));var Papa=require(_0xb92a('0x10'));var Redis=require(_0xb92a('0x11'));var authService=require(_0xb92a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb92a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb92a('0x14'));var utils=require(_0xb92a('0x15'));var config=require(_0xb92a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb92a('0x17'))['db'];function respondWithStatusCode(_0xd1170,_0x372eb4){_0x372eb4=_0x372eb4||0xcc;return function(_0x3a292b){if(_0x3a292b){return _0xd1170[_0xb92a('0x18')](_0x372eb4);}return _0xd1170[_0xb92a('0x19')](_0x372eb4)['end']();};}function respondWithResult(_0x207880,_0x3271b4){_0x3271b4=_0x3271b4||0xc8;return function(_0x2b6fae){if(_0x2b6fae){return _0x207880[_0xb92a('0x19')](_0x3271b4)[_0xb92a('0x1a')](_0x2b6fae);}};}function respondWithFilteredResult(_0x3a4dd2,_0x48df29){return function(_0x5c7b4b){if(_0x5c7b4b){var _0x3e49c8=typeof _0x48df29[_0xb92a('0x1b')]===_0xb92a('0x1c')&&typeof _0x48df29[_0xb92a('0x1d')]===_0xb92a('0x1c');var _0x5c368b=_0x5c7b4b[_0xb92a('0x1e')];var _0x254704=_0x3e49c8?0x0:_0x48df29[_0xb92a('0x1b')];var _0xf5040d=_0x3e49c8?_0x5c7b4b['count']:_0x48df29[_0xb92a('0x1b')]+_0x48df29[_0xb92a('0x1d')];var _0x538f5f;if(_0xf5040d>=_0x5c368b){_0xf5040d=_0x5c368b;_0x538f5f=0xc8;}else{_0x538f5f=0xce;}_0x3a4dd2[_0xb92a('0x19')](_0x538f5f);return _0x3a4dd2['set']('Content-Range',_0x254704+'-'+_0xf5040d+'/'+_0x5c368b)['json'](_0x5c7b4b);}return null;};}function patchUpdates(_0x5be50f){return function(_0x2a6d9e){try{jsonpatch[_0xb92a('0x1f')](_0x2a6d9e,_0x5be50f,!![]);}catch(_0x453e2e){return BPromise['reject'](_0x453e2e);}return _0x2a6d9e[_0xb92a('0x20')]();};}function saveUpdates(_0x21440d,_0x190118){return function(_0x39fe42){if(_0x39fe42){return _0x39fe42['update'](_0x21440d)[_0xb92a('0x21')](function(_0x2ae348){return _0x2ae348;});}return null;};}function removeEntity(_0x597258,_0x38a1d7){return function(_0x210e0f){if(_0x210e0f){return _0x210e0f[_0xb92a('0x22')]()[_0xb92a('0x21')](function(){_0x597258[_0xb92a('0x19')](0xcc)[_0xb92a('0x23')]();});}};}function handleEntityNotFound(_0x5b7f77,_0x12249b){return function(_0x29805a){if(!_0x29805a){_0x5b7f77[_0xb92a('0x18')](0x194);}return _0x29805a;};}function handleError(_0x33ab7f,_0x1b4f1b){_0x1b4f1b=_0x1b4f1b||0x1f4;return function(_0xfc464c){logger[_0xb92a('0x24')](_0xfc464c[_0xb92a('0x25')]);if(_0xfc464c[_0xb92a('0x26')]){delete _0xfc464c[_0xb92a('0x26')];}_0x33ab7f[_0xb92a('0x19')](_0x1b4f1b)[_0xb92a('0x27')](_0xfc464c);};}exports[_0xb92a('0x28')]=function(_0x27473b,_0x568ca8){var _0x5eb49d={},_0x38ecc3={},_0x43d97a={'count':0x0,'rows':[]};var _0x4c1155=_[_0xb92a('0x29')](db['SquareDetailsReport'][_0xb92a('0x2a')],function(_0x5580a8){return{'name':_0x5580a8['fieldName'],'type':_0x5580a8[_0xb92a('0x2b')][_0xb92a('0x2c')]};});_0x38ecc3['model']=_['map'](_0x4c1155,_0xb92a('0x26'));_0x38ecc3[_0xb92a('0x2d')]=_[_0xb92a('0x2e')](_0x27473b[_0xb92a('0x2d')]);_0x38ecc3['filters']=_[_0xb92a('0x2f')](_0x38ecc3[_0xb92a('0x30')],_0x38ecc3[_0xb92a('0x2d')]);_0x5eb49d[_0xb92a('0x31')]=_[_0xb92a('0x2f')](_0x38ecc3[_0xb92a('0x30')],qs[_0xb92a('0x32')](_0x27473b['query']['fields']));_0x5eb49d[_0xb92a('0x31')]=_0x5eb49d['attributes'][_0xb92a('0x33')]?_0x5eb49d[_0xb92a('0x31')]:_0x38ecc3[_0xb92a('0x30')];if(!_0x27473b[_0xb92a('0x2d')][_0xb92a('0x34')](_0xb92a('0x35'))){_0x5eb49d[_0xb92a('0x1d')]=qs[_0xb92a('0x1d')](_0x27473b[_0xb92a('0x2d')][_0xb92a('0x1d')]);_0x5eb49d[_0xb92a('0x1b')]=qs['offset'](_0x27473b[_0xb92a('0x2d')][_0xb92a('0x1b')]);}_0x5eb49d[_0xb92a('0x36')]=qs[_0xb92a('0x37')](_0x27473b[_0xb92a('0x2d')]['sort']);_0x5eb49d[_0xb92a('0x38')]=qs[_0xb92a('0x39')](_['pick'](_0x27473b[_0xb92a('0x2d')],_0x38ecc3[_0xb92a('0x39')]),_0x4c1155);if(_0x27473b[_0xb92a('0x2d')][_0xb92a('0x3a')]){_0x5eb49d['where']=_[_0xb92a('0x3b')](_0x5eb49d['where'],{'$or':_[_0xb92a('0x29')](_0x4c1155,function(_0x49aa58){if(_0x49aa58[_0xb92a('0x2b')]!==_0xb92a('0x3c')){var _0x509749={};_0x509749[_0x49aa58['name']]={'$like':'%'+_0x27473b[_0xb92a('0x2d')][_0xb92a('0x3a')]+'%'};return _0x509749;}})});}_0x5eb49d=_['merge']({},_0x5eb49d,_0x27473b['options']);var _0xcff970={'where':_0x5eb49d[_0xb92a('0x38')]};return db['SquareDetailsReport'][_0xb92a('0x1e')](_0xcff970)['then'](function(_0xc7189b){_0x43d97a[_0xb92a('0x1e')]=_0xc7189b;if(_0x27473b[_0xb92a('0x2d')][_0xb92a('0x3d')]){_0x5eb49d[_0xb92a('0x3e')]=[{'all':!![]}];}return db[_0xb92a('0x3f')][_0xb92a('0x40')](_0x5eb49d);})[_0xb92a('0x21')](function(_0xd3e280){_0x43d97a[_0xb92a('0x41')]=_0xd3e280;return _0x43d97a;})[_0xb92a('0x21')](respondWithFilteredResult(_0x568ca8,_0x5eb49d))[_0xb92a('0x42')](handleError(_0x568ca8,null));};exports[_0xb92a('0x43')]=function(_0x5640a8,_0x26fe14){var _0x12759b={'raw':!![],'where':{'id':_0x5640a8['params']['id']}},_0x325e4a={};_0x325e4a['model']=_['keys'](db[_0xb92a('0x3f')][_0xb92a('0x2a')]);_0x325e4a[_0xb92a('0x2d')]=_[_0xb92a('0x2e')](_0x5640a8[_0xb92a('0x2d')]);_0x325e4a['filters']=_[_0xb92a('0x2f')](_0x325e4a['model'],_0x325e4a['query']);_0x12759b['attributes']=_[_0xb92a('0x2f')](_0x325e4a[_0xb92a('0x30')],qs['fields'](_0x5640a8[_0xb92a('0x2d')][_0xb92a('0x32')]));_0x12759b[_0xb92a('0x31')]=_0x12759b['attributes'][_0xb92a('0x33')]?_0x12759b[_0xb92a('0x31')]:_0x325e4a[_0xb92a('0x30')];if(_0x5640a8[_0xb92a('0x2d')][_0xb92a('0x3d')]){_0x12759b[_0xb92a('0x3e')]=[{'all':!![]}];}_0x12759b=_['merge']({},_0x12759b,_0x5640a8[_0xb92a('0x44')]);return db[_0xb92a('0x3f')]['find'](_0x12759b)['then'](handleEntityNotFound(_0x26fe14,null))[_0xb92a('0x21')](respondWithResult(_0x26fe14,null))['catch'](handleError(_0x26fe14,null));};exports[_0xb92a('0x45')]=function(_0x5a04b3,_0x3f6cda){return db[_0xb92a('0x3f')][_0xb92a('0x45')](_0x5a04b3['body'],{})[_0xb92a('0x21')](respondWithResult(_0x3f6cda,0xc9))[_0xb92a('0x42')](handleError(_0x3f6cda,null));};exports[_0xb92a('0x46')]=function(_0x2a1d67,_0x44f62b){if(_0x2a1d67['body']['id']){delete _0x2a1d67[_0xb92a('0x47')]['id'];}return db[_0xb92a('0x3f')][_0xb92a('0x48')]({'where':{'id':_0x2a1d67[_0xb92a('0x49')]['id']}})['then'](handleEntityNotFound(_0x44f62b,null))['then'](saveUpdates(_0x2a1d67[_0xb92a('0x47')],null))['then'](respondWithResult(_0x44f62b,null))['catch'](handleError(_0x44f62b,null));};exports[_0xb92a('0x22')]=function(_0x5598af,_0x8b6a4f){return db[_0xb92a('0x3f')][_0xb92a('0x48')]({'where':{'id':_0x5598af[_0xb92a('0x49')]['id']}})[_0xb92a('0x21')](handleEntityNotFound(_0x8b6a4f,null))['then'](removeEntity(_0x8b6a4f,null))[_0xb92a('0x42')](handleError(_0x8b6a4f,null));};exports[_0xb92a('0x4a')]=function(_0x5513cf,_0x352f4d){return db[_0xb92a('0x3f')][_0xb92a('0x4a')]()[_0xb92a('0x21')](respondWithResult(_0x352f4d,null))[_0xb92a('0x42')](handleError(_0x352f4d,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 340d021..c74a677 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 _0xf931=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x4241ba,_0x53ce49){var _0x2641ad=function(_0xf8ada3){while(--_0xf8ada3){_0x4241ba['push'](_0x4241ba['shift']());}};_0x2641ad(++_0x53ce49);}(_0xf931,0xb6));var _0x1f93=function(_0x167fb4,_0x4955de){_0x167fb4=_0x167fb4-0x0;var _0x51a385=_0xf931[_0x167fb4];return _0x51a385;};'use strict';var _=require(_0x1f93('0x0'));var util=require(_0x1f93('0x1'));var logger=require(_0x1f93('0x2'))(_0x1f93('0x3'));var moment=require(_0x1f93('0x4'));var BPromise=require('bluebird');var rp=require(_0x1f93('0x5'));var fs=require('fs');var path=require(_0x1f93('0x6'));var rimraf=require(_0x1f93('0x7'));var config=require('../../config/environment');var attributes=require(_0x1f93('0x8'));module[_0x1f93('0x9')]=function(_0x25e32b,_0x439631){return _0x25e32b[_0x1f93('0xa')](_0x1f93('0xb'),attributes,{'tableName':_0x1f93('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51c4=['exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./squareReportDetail.attributes'];(function(_0x58f0e2,_0x5d1967){var _0x58953d=function(_0x48abca){while(--_0x48abca){_0x58f0e2['push'](_0x58f0e2['shift']());}};_0x58953d(++_0x5d1967);}(_0x51c4,0x13c));var _0x451c=function(_0xeef2f6,_0x4ea4bc){_0xeef2f6=_0xeef2f6-0x0;var _0x33413e=_0x51c4[_0xeef2f6];return _0x33413e;};'use strict';var _=require(_0x451c('0x0'));var util=require(_0x451c('0x1'));var logger=require(_0x451c('0x2'))(_0x451c('0x3'));var moment=require(_0x451c('0x4'));var BPromise=require('bluebird');var rp=require(_0x451c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x451c('0x6'));var config=require('../../config/environment');var attributes=require(_0x451c('0x7'));module[_0x451c('0x8')]=function(_0xcc191b,_0x2da6dd){return _0xcc191b[_0x451c('0x9')](_0x451c('0xa'),attributes,{'tableName':_0x451c('0xb'),'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 3b1fe4e..41259b8 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 _0x02a7=['http','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x02a7,0x1a6));var _0x702a=function(_0x44d87c,_0x4d3bc7){_0x44d87c=_0x44d87c-0x0;var _0xc19004=_0x02a7[_0x44d87c];return _0xc19004;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var moment=require(_0x702a('0x1'));var BPromise=require(_0x702a('0x2'));var rs=require(_0x702a('0x3'));var fs=require('fs');var Redis=require(_0x702a('0x4'));var db=require(_0x702a('0x5'))['db'];var utils=require(_0x702a('0x6'));var logger=require(_0x702a('0x7'))(_0x702a('0x8'));var config=require(_0x702a('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x702a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b6736,_0x27bfc7,_0x3f5ff8){return new BPromise(function(_0x51bf52,_0x562fdb){return client['request'](_0x4b6736,_0x3f5ff8)['then'](function(_0x3cb569){logger[_0x702a('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x27bfc7,_0x702a('0xc'));logger[_0x702a('0xd')](_0x702a('0xe'),_0x27bfc7,_0x702a('0xc'),JSON[_0x702a('0xf')](_0x3cb569));if(_0x3cb569[_0x702a('0x10')]){if(_0x3cb569[_0x702a('0x10')][_0x702a('0x11')]===0x1f4){logger['error'](_0x702a('0x12'),_0x27bfc7,_0x3cb569[_0x702a('0x10')][_0x702a('0x13')]);return _0x562fdb(_0x3cb569[_0x702a('0x10')]['message']);}logger[_0x702a('0x10')](_0x702a('0x12'),_0x27bfc7,_0x3cb569[_0x702a('0x10')][_0x702a('0x13')]);return _0x51bf52(_0x3cb569[_0x702a('0x10')]['message']);}else{logger[_0x702a('0xb')](_0x702a('0x12'),_0x27bfc7,_0x702a('0xc'));_0x51bf52(_0x3cb569[_0x702a('0x14')][_0x702a('0x13')]);}})[_0x702a('0x15')](function(_0x451881){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x27bfc7,_0x451881);_0x562fdb(_0x451881);});});}exports[_0x702a('0x16')]=function(_0x340dc2){var _0x2071ad=this;return new Promise(function(_0x3d1550,_0x1885eb){return db['SquareDetailsReport'][_0x702a('0x17')](_0x340dc2[_0x702a('0x18')],{'raw':_0x340dc2[_0x702a('0x19')]?_0x340dc2[_0x702a('0x19')][_0x702a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5b2998){logger['info'](_0x702a('0x16'),_0x340dc2);logger['debug'](_0x702a('0x16'),_0x340dc2,JSON[_0x702a('0xf')](_0x5b2998));_0x3d1550(_0x5b2998);})['catch'](function(_0x2ca064){logger[_0x702a('0x10')](_0x702a('0x16'),_0x2ca064[_0x702a('0x13')],_0x340dc2);_0x1885eb(_0x2071ad[_0x702a('0x10')](0x1f4,_0x2ca064['message']));});});}; \ No newline at end of file +var _0x8f4c=['SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x94787e,_0xbab744){var _0xabcd2d=function(_0x58d498){while(--_0x58d498){_0x94787e['push'](_0x94787e['shift']());}};_0xabcd2d(++_0xbab744);}(_0x8f4c,0x113));var _0xc8f4=function(_0x409186,_0x4b8b73){_0x409186=_0x409186-0x0;var _0x3deb43=_0x8f4c[_0x409186];return _0x3deb43;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')](_0x108076[_0xc8f4('0x1a')],{'raw':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![]})[_0xc8f4('0xb')](function(_0x5f3264){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON[_0xc8f4('0x10')](_0x5f3264));_0x4763c1(_0x5f3264);})[_0xc8f4('0x16')](function(_0xaeee7d){logger[_0xc8f4('0x11')]('CreateSquareDetailsReport',_0xaeee7d[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0xaeee7d[_0xc8f4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index be57409..798c8a3 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 _0xa689=['Router','../../components/auth/service','get','isAuthenticated','index','exports'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xa689,0x1e6));var _0x9a68=function(_0x4dd71c,_0x23a24e){_0x4dd71c=_0x4dd71c-0x0;var _0x8e4e36=_0xa689[_0x4dd71c];return _0x8e4e36;};'use strict';var express=require('express');var router=express[_0x9a68('0x0')]();var auth=require(_0x9a68('0x1'));var controller=require('./system.controller');router[_0x9a68('0x2')]('/',auth[_0x9a68('0x3')](),controller[_0x9a68('0x4')]);router['get']('/process/:pid/kill',auth[_0x9a68('0x3')](),controller['killProcess']);module[_0x9a68('0x5')]=router; \ No newline at end of file +var _0x7e2e=['/process/:pid/kill','killProcess','express','get','isAuthenticated','index'];(function(_0x3fecfe,_0x627ab1){var _0x3a98e7=function(_0x5e7930){while(--_0x5e7930){_0x3fecfe['push'](_0x3fecfe['shift']());}};_0x3a98e7(++_0x627ab1);}(_0x7e2e,0x1f4));var _0xe7e2=function(_0x353494,_0x2b392e){_0x353494=_0x353494-0x0;var _0x460b53=_0x7e2e[_0x353494];return _0x460b53;};'use strict';var express=require(_0xe7e2('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0xe7e2('0x1')]('/',auth[_0xe7e2('0x2')](),controller[_0xe7e2('0x3')]);router[_0xe7e2('0x1')](_0xe7e2('0x4'),auth['isAuthenticated'](),controller[_0xe7e2('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 8b5b806..442cc3b 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 _0xb209=['SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','then','json','catch','killProcess','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','pid'];(function(_0x185b17,_0x5c458b){var _0x3f7835=function(_0x412ee9){while(--_0x412ee9){_0x185b17['push'](_0x185b17['shift']());}};_0x3f7835(++_0x5c458b);}(_0xb209,0x16e));var _0x9b20=function(_0x11b8c2,_0x3b9aab){_0x11b8c2=_0x11b8c2-0x0;var _0x3e9e85=_0xb209[_0x11b8c2];return _0x3e9e85;};'use strict';var info=require(_0x9b20('0x0'));var exec=require('child_process')[_0x9b20('0x1')];var logger=require(_0x9b20('0x2'))(_0x9b20('0x3'));var util=require(_0x9b20('0x4'));var BPromise=require(_0x9b20('0x5'));var _=require(_0x9b20('0x6'));function handleError(_0x2a5b29,_0x2f7339,_0x36da5c){_0x2f7339=_0x2f7339||0x1f4;return function(_0x3873c3){logger[_0x9b20('0x7')](_0x9b20('0x8'),_0x36da5c,_0x2f7339,util[_0x9b20('0x9')](_0x3873c3,{'showHidden':![],'depth':null}));delete _0x3873c3[_0x9b20('0xa')];_0x2a5b29[_0x9b20('0xb')](_0x2f7339)[_0x9b20('0xc')](_0x3873c3);};}exports['index']=function(_0x8bfb14,_0x81afe){return info[_0x9b20('0xd')]()[_0x9b20('0xe')](function(_0x5d4c7c){return _0x81afe[_0x9b20('0xb')](0xc8)[_0x9b20('0xf')](_0x5d4c7c);})[_0x9b20('0x10')](function(_0x491ea9){return _0x81afe[_0x9b20('0xb')](0x1f4)[_0x9b20('0xf')](_0x491ea9);});};exports[_0x9b20('0x11')]=function(_0x324468,_0x1d4e6d){var _0x27f07=['components/import/cm'];return new BPromise(function(_0x9c5615,_0x167c7c){return exec(util['format'](_0x9b20('0x12'),_0x324468[_0x9b20('0x13')]['pid']),function(_0x597360,_0x140f99,_0x4d01c0){if(_0x597360){return _0x167c7c(_0x597360);}return _0x9c5615(_0x140f99);});})[_0x9b20('0xe')](function(_0x2036f8){var _0x38efc6=![];var _0x14028a=_0x2036f8[_0x9b20('0x14')](/\n/);for(var _0x5977ad=0x0,_0x3cdc95=_0x27f07[_0x9b20('0x15')];_0x5977ad<_0x3cdc95,_0x38efc6===![];_0x5977ad+=0x1){if(_0x2036f8[_0x9b20('0x16')](_0x27f07[_0x5977ad])>=0x0){_0x38efc6=!![];}}if(!_0x38efc6){throw new Error(util[_0x9b20('0x17')](_0x9b20('0x18'),_0x324468[_0x9b20('0x13')][_0x9b20('0x19')]));}process['kill'](_0x324468[_0x9b20('0x13')][_0x9b20('0x19')],_0x9b20('0x1a'));return _0x1d4e6d[_0x9b20('0xb')](0xc8)[_0x9b20('0xf')]({'message':util[_0x9b20('0x17')](_0x9b20('0x1b'),_0x324468['params']['pid'])});})['catch'](handleError(_0x1d4e6d,null,_0x9b20('0x11')));}; \ No newline at end of file +var _0xe3e0=['lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','index','getAllData','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','exec','../../config/logger','api','util','bluebird'];(function(_0x188dbb,_0x6e70f6){var _0x4aa74e=function(_0x254111){while(--_0x254111){_0x188dbb['push'](_0x188dbb['shift']());}};_0x4aa74e(++_0x6e70f6);}(_0xe3e0,0x1aa));var _0x0e3e=function(_0x566bdf,_0x1f4861){_0x566bdf=_0x566bdf-0x0;var _0x331215=_0xe3e0[_0x566bdf];return _0x331215;};'use strict';var info=require(_0x0e3e('0x0'));var exec=require('child_process')[_0x0e3e('0x1')];var logger=require(_0x0e3e('0x2'))(_0x0e3e('0x3'));var util=require(_0x0e3e('0x4'));var BPromise=require(_0x0e3e('0x5'));var _=require(_0x0e3e('0x6'));function handleError(_0x5899cc,_0x2e7a26,_0x24a874){_0x2e7a26=_0x2e7a26||0x1f4;return function(_0x43d132){logger[_0x0e3e('0x7')](_0x0e3e('0x8'),_0x24a874,_0x2e7a26,util['inspect'](_0x43d132,{'showHidden':![],'depth':null}));delete _0x43d132['name'];_0x5899cc[_0x0e3e('0x9')](_0x2e7a26)['send'](_0x43d132);};}exports[_0x0e3e('0xa')]=function(_0x4ca2a6,_0xc3c126){return info[_0x0e3e('0xb')]()[_0x0e3e('0xc')](function(_0x2101a1){return _0xc3c126[_0x0e3e('0x9')](0xc8)[_0x0e3e('0xd')](_0x2101a1);})['catch'](function(_0x3bd044){return _0xc3c126[_0x0e3e('0x9')](0x1f4)['json'](_0x3bd044);});};exports[_0x0e3e('0xe')]=function(_0x157b14,_0x6bbaa2){var _0x3a18b0=[_0x0e3e('0xf')];return new BPromise(function(_0x44fc4f,_0x7d8e62){return exec(util[_0x0e3e('0x10')](_0x0e3e('0x11'),_0x157b14[_0x0e3e('0x12')]['pid']),function(_0x1d1aaa,_0x4f2cfe,_0x4e5e4e){if(_0x1d1aaa){return _0x7d8e62(_0x1d1aaa);}return _0x44fc4f(_0x4f2cfe);});})[_0x0e3e('0xc')](function(_0x1234be){var _0x2fa5d0=![];var _0x58055e=_0x1234be['split'](/\n/);for(var _0x56fbb4=0x0,_0x4cfa31=_0x3a18b0[_0x0e3e('0x13')];_0x56fbb4<_0x4cfa31,_0x2fa5d0===![];_0x56fbb4+=0x1){if(_0x1234be[_0x0e3e('0x14')](_0x3a18b0[_0x56fbb4])>=0x0){_0x2fa5d0=!![];}}if(!_0x2fa5d0){throw new Error(util['format'](_0x0e3e('0x15'),_0x157b14[_0x0e3e('0x12')][_0x0e3e('0x16')]));}process[_0x0e3e('0x17')](_0x157b14[_0x0e3e('0x12')][_0x0e3e('0x16')],_0x0e3e('0x18'));return _0x6bbaa2[_0x0e3e('0x9')](0xc8)[_0x0e3e('0xd')]({'message':util[_0x0e3e('0x10')](_0x0e3e('0x19'),_0x157b14[_0x0e3e('0x12')]['pid'])});})[_0x0e3e('0x1a')](handleError(_0x6bbaa2,null,_0x0e3e('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 1357fd5..c720b92 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 _0x52c3=['put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','post','create'];(function(_0x1c3907,_0x41e1a7){var _0x27fcd6=function(_0x11dddf){while(--_0x11dddf){_0x1c3907['push'](_0x1c3907['shift']());}};_0x27fcd6(++_0x41e1a7);}(_0x52c3,0x94));var _0x352c=function(_0x40911a,_0x55ec99){_0x40911a=_0x40911a-0x0;var _0x27e8e3=_0x52c3[_0x40911a];return _0x27e8e3;};'use strict';var multer=require(_0x352c('0x0'));var util=require(_0x352c('0x1'));var path=require('path');var timeout=require(_0x352c('0x2'));var express=require(_0x352c('0x3'));var router=express[_0x352c('0x4')]();var fs_extra=require(_0x352c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x352c('0x6'));var config=require(_0x352c('0x7'));var controller=require(_0x352c('0x8'));router[_0x352c('0x9')]('/',auth[_0x352c('0xa')](),controller['index']);router[_0x352c('0x9')](_0x352c('0xb'),auth[_0x352c('0xa')](),controller['show']);router[_0x352c('0xc')]('/',auth[_0x352c('0xa')](),controller[_0x352c('0xd')]);router[_0x352c('0xe')](_0x352c('0xb'),auth['isAuthenticated'](),controller[_0x352c('0xf')]);router[_0x352c('0x10')](_0x352c('0xb'),auth[_0x352c('0xa')](),controller[_0x352c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1046=['put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','isAuthenticated','post','create'];(function(_0x4ed315,_0x1e35e1){var _0x11a63d=function(_0x13494f){while(--_0x13494f){_0x4ed315['push'](_0x4ed315['shift']());}};_0x11a63d(++_0x1e35e1);}(_0x1046,0x134));var _0x6104=function(_0xdc14d6,_0x4627d7){_0xdc14d6=_0xdc14d6-0x0;var _0x3caed4=_0x1046[_0xdc14d6];return _0x3caed4;};'use strict';var multer=require(_0x6104('0x0'));var util=require('util');var path=require(_0x6104('0x1'));var timeout=require(_0x6104('0x2'));var express=require(_0x6104('0x3'));var router=express[_0x6104('0x4')]();var fs_extra=require(_0x6104('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6104('0x6'));var config=require(_0x6104('0x7'));var controller=require(_0x6104('0x8'));router[_0x6104('0x9')]('/',auth['isAuthenticated'](),controller[_0x6104('0xa')]);router[_0x6104('0x9')](_0x6104('0xb'),auth[_0x6104('0xc')](),controller['show']);router[_0x6104('0xd')]('/',auth['isAuthenticated'](),controller[_0x6104('0xe')]);router[_0x6104('0xf')](_0x6104('0xb'),auth[_0x6104('0xc')](),controller[_0x6104('0x10')]);router[_0x6104('0x11')](_0x6104('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x6104('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 7bad101..72ef4a6 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 _0xab26=['STRING','#0091EA','sequelize','exports'];(function(_0x2118ad,_0xe8e3fd){var _0x4b5715=function(_0x399f72){while(--_0x399f72){_0x2118ad['push'](_0x2118ad['shift']());}};_0x4b5715(++_0xe8e3fd);}(_0xab26,0xd2));var _0x6ab2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xab26[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x6ab2('0x0'));module[_0x6ab2('0x1')]={'name':{'type':Sequelize[_0x6ab2('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x6ab2('0x2')],'defaultValue':_0x6ab2('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5eb8=['name','#0091EA','STRING'];(function(_0x4bbb10,_0x417407){var _0x513ac6=function(_0x234b31){while(--_0x234b31){_0x4bbb10['push'](_0x4bbb10['shift']());}};_0x513ac6(++_0x417407);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4b7b9b,_0xa4aff9){_0x4b7b9b=_0x4b7b9b-0x0;var _0x3be710=_0x5eb8[_0x4b7b9b];return _0x3be710;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x85eb('0x0')],'unique':_0x85eb('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':_0x85eb('0x2')},'description':{'type':Sequelize[_0x85eb('0x0')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 68b9a2b..ce714e1 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 _0x0624=['count','offset','set','json','apply','reject','save','then','get','Tags','UserProfileResource','destroy','end','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','findAll','rows','show','params','include','Tag','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','body','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit'];(function(_0x238884,_0x2a7847){var _0xf9f3d5=function(_0x20d8f2){while(--_0x20d8f2){_0x238884['push'](_0x238884['shift']());}};_0xf9f3d5(++_0x2a7847);}(_0x0624,0x132));var _0x4062=function(_0x4b657f,_0x4d0e28){_0x4b657f=_0x4b657f-0x0;var _0x322334=_0x0624[_0x4b657f];return _0x322334;};'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(_0x4062('0x0'));var moment=require(_0x4062('0x1'));var BPromise=require(_0x4062('0x2'));var Mustache=require(_0x4062('0x3'));var util=require(_0x4062('0x4'));var path=require(_0x4062('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4062('0x6'));var fs=require('fs');var fs_extra=require(_0x4062('0x7'));var _=require(_0x4062('0x8'));var squel=require(_0x4062('0x9'));var crypto=require(_0x4062('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4062('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4062('0xc'));var Papa=require(_0x4062('0xd'));var Redis=require(_0x4062('0xe'));var authService=require(_0x4062('0xf'));var qs=require(_0x4062('0x10'));var as=require(_0x4062('0x11'));var hardwareService=require(_0x4062('0x12'));var logger=require('../../config/logger')(_0x4062('0x13'));var utils=require('../../config/utils');var config=require(_0x4062('0x14'));var licenseUtil=require(_0x4062('0x15'));var db=require(_0x4062('0x16'))['db'];function respondWithStatusCode(_0x3146e2,_0x160b6d){_0x160b6d=_0x160b6d||0xcc;return function(_0x57e04b){if(_0x57e04b){return _0x3146e2[_0x4062('0x17')](_0x160b6d);}return _0x3146e2[_0x4062('0x18')](_0x160b6d)['end']();};}function respondWithResult(_0x32ced6,_0x42859d){_0x42859d=_0x42859d||0xc8;return function(_0x95bb42){if(_0x95bb42){return _0x32ced6['status'](_0x42859d)['json'](_0x95bb42);}};}function respondWithFilteredResult(_0x25a717,_0x467ac7){return function(_0x48ea2b){if(_0x48ea2b){var _0x4d7166=typeof _0x467ac7['offset']==='undefined'&&typeof _0x467ac7[_0x4062('0x19')]==='undefined';var _0x2efc3c=_0x48ea2b[_0x4062('0x1a')];var _0x3d14bb=_0x4d7166?0x0:_0x467ac7[_0x4062('0x1b')];var _0x2a04c7=_0x4d7166?_0x48ea2b[_0x4062('0x1a')]:_0x467ac7[_0x4062('0x1b')]+_0x467ac7['limit'];var _0x324bb3;if(_0x2a04c7>=_0x2efc3c){_0x2a04c7=_0x2efc3c;_0x324bb3=0xc8;}else{_0x324bb3=0xce;}_0x25a717['status'](_0x324bb3);return _0x25a717[_0x4062('0x1c')]('Content-Range',_0x3d14bb+'-'+_0x2a04c7+'/'+_0x2efc3c)[_0x4062('0x1d')](_0x48ea2b);}return null;};}function patchUpdates(_0x31777f){return function(_0x12c6a3){try{jsonpatch[_0x4062('0x1e')](_0x12c6a3,_0x31777f,!![]);}catch(_0x3cb45d){return BPromise[_0x4062('0x1f')](_0x3cb45d);}return _0x12c6a3[_0x4062('0x20')]();};}function saveUpdates(_0x341310,_0xc6c0ba){return function(_0x53648a){if(_0x53648a){return _0x53648a['update'](_0x341310)[_0x4062('0x21')](function(_0xc5e4a0){return _0xc5e4a0;});}return null;};}function removeEntity(_0x23f81c,_0x1fa194){return function(_0x59d19f){if(_0x59d19f){return _0x59d19f['destroy']()['then'](function(){var _0x11e837=_0x59d19f[_0x4062('0x22')]({'plain':!![]});var _0x11b962=_0x4062('0x23');return db[_0x4062('0x24')][_0x4062('0x25')]({'where':{'type':_0x11b962,'resourceId':_0x11e837['id']}})['then'](function(){return _0x59d19f;});})[_0x4062('0x21')](function(){_0x23f81c[_0x4062('0x18')](0xcc)[_0x4062('0x26')]();});}};}function handleEntityNotFound(_0x28e9e4,_0xb7f7c7){return function(_0x5934d2){if(!_0x5934d2){_0x28e9e4[_0x4062('0x17')](0x194);}return _0x5934d2;};}function handleError(_0x4a0312,_0x4de5c0){_0x4de5c0=_0x4de5c0||0x1f4;return function(_0x391065){logger['error'](_0x391065[_0x4062('0x27')]);if(_0x391065[_0x4062('0x28')]){delete _0x391065[_0x4062('0x28')];}_0x4a0312[_0x4062('0x18')](_0x4de5c0)[_0x4062('0x29')](_0x391065);};}exports[_0x4062('0x2a')]=function(_0xd818bc,_0x253bcf){var _0x5f569c={},_0x592fca={},_0x51de11={'count':0x0,'rows':[]};var _0x70dfdc=_[_0x4062('0x2b')](db['Tag'][_0x4062('0x2c')],function(_0x5ad1a3){return{'name':_0x5ad1a3['fieldName'],'type':_0x5ad1a3['type'][_0x4062('0x2d')]};});_0x592fca[_0x4062('0x2e')]=_[_0x4062('0x2b')](_0x70dfdc,_0x4062('0x28'));_0x592fca[_0x4062('0x2f')]=_[_0x4062('0x30')](_0xd818bc[_0x4062('0x2f')]);_0x592fca[_0x4062('0x31')]=_[_0x4062('0x32')](_0x592fca[_0x4062('0x2e')],_0x592fca[_0x4062('0x2f')]);_0x5f569c[_0x4062('0x33')]=_['intersection'](_0x592fca[_0x4062('0x2e')],qs['fields'](_0xd818bc[_0x4062('0x2f')][_0x4062('0x34')]));_0x5f569c[_0x4062('0x33')]=_0x5f569c['attributes'][_0x4062('0x35')]?_0x5f569c[_0x4062('0x33')]:_0x592fca[_0x4062('0x2e')];if(!_0xd818bc[_0x4062('0x2f')][_0x4062('0x36')](_0x4062('0x37'))){_0x5f569c[_0x4062('0x19')]=qs[_0x4062('0x19')](_0xd818bc[_0x4062('0x2f')]['limit']);_0x5f569c[_0x4062('0x1b')]=qs[_0x4062('0x1b')](_0xd818bc[_0x4062('0x2f')][_0x4062('0x1b')]);}_0x5f569c[_0x4062('0x38')]=qs[_0x4062('0x39')](_0xd818bc['query'][_0x4062('0x39')]);_0x5f569c[_0x4062('0x3a')]=qs[_0x4062('0x31')](_[_0x4062('0x3b')](_0xd818bc[_0x4062('0x2f')],_0x592fca['filters']),_0x70dfdc);if(_0xd818bc['query'][_0x4062('0x3c')]){_0x5f569c[_0x4062('0x3a')]=_['merge'](_0x5f569c[_0x4062('0x3a')],{'$or':_[_0x4062('0x2b')](_0x70dfdc,function(_0x3d4fab){if(_0x3d4fab[_0x4062('0x3d')]!==_0x4062('0x3e')){var _0x218864={};_0x218864[_0x3d4fab[_0x4062('0x28')]]={'$like':'%'+_0xd818bc[_0x4062('0x2f')][_0x4062('0x3c')]+'%'};return _0x218864;}})});}_0x5f569c=_[_0x4062('0x3f')]({},_0x5f569c,_0xd818bc['options']);var _0x32debb={'where':_0x5f569c[_0x4062('0x3a')]};return db['Tag']['count'](_0x32debb)['then'](function(_0x3e903b){_0x51de11[_0x4062('0x1a')]=_0x3e903b;if(_0xd818bc[_0x4062('0x2f')][_0x4062('0x40')]){_0x5f569c['include']=[{'all':!![]}];}return db['Tag'][_0x4062('0x41')](_0x5f569c);})[_0x4062('0x21')](function(_0x39c9ef){_0x51de11[_0x4062('0x42')]=_0x39c9ef;return _0x51de11;})['then'](respondWithFilteredResult(_0x253bcf,_0x5f569c))['catch'](handleError(_0x253bcf,null));};exports[_0x4062('0x43')]=function(_0x2ac3b5,_0x1c4259){var _0x1b3897={'raw':!![],'where':{'id':_0x2ac3b5[_0x4062('0x44')]['id']}},_0x9ab8ac={};_0x9ab8ac[_0x4062('0x2e')]=_[_0x4062('0x30')](db['Tag'][_0x4062('0x2c')]);_0x9ab8ac[_0x4062('0x2f')]=_[_0x4062('0x30')](_0x2ac3b5['query']);_0x9ab8ac[_0x4062('0x31')]=_['intersection'](_0x9ab8ac['model'],_0x9ab8ac[_0x4062('0x2f')]);_0x1b3897[_0x4062('0x33')]=_['intersection'](_0x9ab8ac[_0x4062('0x2e')],qs[_0x4062('0x34')](_0x2ac3b5[_0x4062('0x2f')][_0x4062('0x34')]));_0x1b3897[_0x4062('0x33')]=_0x1b3897['attributes']['length']?_0x1b3897[_0x4062('0x33')]:_0x9ab8ac[_0x4062('0x2e')];if(_0x2ac3b5[_0x4062('0x2f')]['includeAll']){_0x1b3897[_0x4062('0x45')]=[{'all':!![]}];}_0x1b3897=_[_0x4062('0x3f')]({},_0x1b3897,_0x2ac3b5['options']);return db[_0x4062('0x46')][_0x4062('0x47')](_0x1b3897)['then'](handleEntityNotFound(_0x1c4259,null))['then'](respondWithResult(_0x1c4259,null))['catch'](handleError(_0x1c4259,null));};exports[_0x4062('0x48')]=function(_0x560b20,_0x58921a){return db[_0x4062('0x46')]['create'](_0x560b20['body'],{})[_0x4062('0x21')](function(_0x15819a){var _0x1f6df9=_0x560b20['user'][_0x4062('0x22')]({'plain':!![]});if(!_0x1f6df9)throw new Error(_0x4062('0x49'));if(_0x1f6df9[_0x4062('0x4a')]==='user'){var _0x5c75b6=_0x15819a[_0x4062('0x22')]({'plain':!![]});var _0x1e9b7a='Tags';return db[_0x4062('0x4b')][_0x4062('0x47')]({'where':{'name':_0x1e9b7a,'userProfileId':_0x1f6df9[_0x4062('0x4c')]},'raw':!![]})['then'](function(_0x53729d){if(_0x53729d&&_0x53729d[_0x4062('0x4d')]===0x0){return db[_0x4062('0x24')][_0x4062('0x48')]({'name':_0x5c75b6[_0x4062('0x28')],'resourceId':_0x5c75b6['id'],'type':_0x53729d[_0x4062('0x28')],'sectionId':_0x53729d['id']},{})['then'](function(){return _0x15819a;});}else{return _0x15819a;}})['catch'](function(_0x6797c6){logger[_0x4062('0x4e')](_0x4062('0x4f'),_0x6797c6);throw _0x6797c6;});}return _0x15819a;})[_0x4062('0x21')](respondWithResult(_0x58921a,0xc9))[_0x4062('0x50')](handleError(_0x58921a,null));};exports[_0x4062('0x51')]=function(_0x2180ae,_0x2afcc7){if(_0x2180ae[_0x4062('0x52')]['id']){delete _0x2180ae[_0x4062('0x52')]['id'];}return db[_0x4062('0x46')][_0x4062('0x47')]({'where':{'id':_0x2180ae['params']['id']}})[_0x4062('0x21')](handleEntityNotFound(_0x2afcc7,null))[_0x4062('0x21')](saveUpdates(_0x2180ae['body'],null))[_0x4062('0x21')](respondWithResult(_0x2afcc7,null))[_0x4062('0x50')](handleError(_0x2afcc7,null));};exports['destroy']=function(_0x24e98c,_0x5c76e7){return db['Tag'][_0x4062('0x47')]({'where':{'id':_0x24e98c[_0x4062('0x44')]['id']}})[_0x4062('0x21')](handleEntityNotFound(_0x5c76e7,null))[_0x4062('0x21')](removeEntity(_0x5c76e7,null))[_0x4062('0x50')](handleError(_0x5c76e7,null));}; \ No newline at end of file +var _0xa75b=['rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','reject','then','destroy','get','Tags','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Tag'];(function(_0x859359,_0x312a9e){var _0x843f52=function(_0x30bd39){while(--_0x30bd39){_0x859359['push'](_0x859359['shift']());}};_0x843f52(++_0x312a9e);}(_0xa75b,0x170));var _0xba75=function(_0x17f40c,_0x12dd76){_0x17f40c=_0x17f40c-0x0;var _0x48d526=_0xa75b[_0x17f40c];return _0x48d526;};'use strict';var emlformat=require(_0xba75('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xba75('0x1'));var rp=require(_0xba75('0x2'));var moment=require(_0xba75('0x3'));var BPromise=require(_0xba75('0x4'));var Mustache=require(_0xba75('0x5'));var util=require(_0xba75('0x6'));var path=require(_0xba75('0x7'));var sox=require(_0xba75('0x8'));var csv=require(_0xba75('0x9'));var ejs=require(_0xba75('0xa'));var fs=require('fs');var fs_extra=require(_0xba75('0xb'));var _=require(_0xba75('0xc'));var squel=require(_0xba75('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba75('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba75('0xf'));var Redis=require('ioredis');var authService=require(_0xba75('0x10'));var qs=require(_0xba75('0x11'));var as=require(_0xba75('0x12'));var hardwareService=require(_0xba75('0x13'));var logger=require(_0xba75('0x14'))(_0xba75('0x15'));var utils=require(_0xba75('0x16'));var config=require(_0xba75('0x17'));var licenseUtil=require(_0xba75('0x18'));var db=require(_0xba75('0x19'))['db'];function respondWithStatusCode(_0x8116d8,_0x1ed697){_0x1ed697=_0x1ed697||0xcc;return function(_0x50db90){if(_0x50db90){return _0x8116d8['sendStatus'](_0x1ed697);}return _0x8116d8[_0xba75('0x1a')](_0x1ed697)['end']();};}function respondWithResult(_0x2f141a,_0x2df615){_0x2df615=_0x2df615||0xc8;return function(_0xa27f76){if(_0xa27f76){return _0x2f141a[_0xba75('0x1a')](_0x2df615)['json'](_0xa27f76);}};}function respondWithFilteredResult(_0x31b3b3,_0x18bab2){return function(_0x256678){if(_0x256678){var _0x4028f9=typeof _0x18bab2[_0xba75('0x1b')]==='undefined'&&typeof _0x18bab2[_0xba75('0x1c')]===_0xba75('0x1d');var _0x14bd83=_0x256678['count'];var _0x2822af=_0x4028f9?0x0:_0x18bab2[_0xba75('0x1b')];var _0xc4bf17=_0x4028f9?_0x256678[_0xba75('0x1e')]:_0x18bab2[_0xba75('0x1b')]+_0x18bab2[_0xba75('0x1c')];var _0x5811cb;if(_0xc4bf17>=_0x14bd83){_0xc4bf17=_0x14bd83;_0x5811cb=0xc8;}else{_0x5811cb=0xce;}_0x31b3b3[_0xba75('0x1a')](_0x5811cb);return _0x31b3b3[_0xba75('0x1f')]('Content-Range',_0x2822af+'-'+_0xc4bf17+'/'+_0x14bd83)['json'](_0x256678);}return null;};}function patchUpdates(_0x35ffd2){return function(_0x31bc33){try{jsonpatch['apply'](_0x31bc33,_0x35ffd2,!![]);}catch(_0x48206c){return BPromise[_0xba75('0x20')](_0x48206c);}return _0x31bc33['save']();};}function saveUpdates(_0x1b8a36,_0x2ece41){return function(_0x19b2d7){if(_0x19b2d7){return _0x19b2d7['update'](_0x1b8a36)[_0xba75('0x21')](function(_0x221d5e){return _0x221d5e;});}return null;};}function removeEntity(_0x139fa4,_0x3e9bd9){return function(_0x14c54b){if(_0x14c54b){return _0x14c54b[_0xba75('0x22')]()['then'](function(){var _0x246c48=_0x14c54b[_0xba75('0x23')]({'plain':!![]});var _0xe579fb=_0xba75('0x24');return db[_0xba75('0x25')][_0xba75('0x22')]({'where':{'type':_0xe579fb,'resourceId':_0x246c48['id']}})[_0xba75('0x21')](function(){return _0x14c54b;});})[_0xba75('0x21')](function(){_0x139fa4[_0xba75('0x1a')](0xcc)[_0xba75('0x26')]();});}};}function handleEntityNotFound(_0x47ddff,_0x4c8d02){return function(_0x4e1987){if(!_0x4e1987){_0x47ddff[_0xba75('0x27')](0x194);}return _0x4e1987;};}function handleError(_0x4856be,_0x42cefb){_0x42cefb=_0x42cefb||0x1f4;return function(_0x58ea2d){logger[_0xba75('0x28')](_0x58ea2d[_0xba75('0x29')]);if(_0x58ea2d[_0xba75('0x2a')]){delete _0x58ea2d['name'];}_0x4856be[_0xba75('0x1a')](_0x42cefb)[_0xba75('0x2b')](_0x58ea2d);};}exports[_0xba75('0x2c')]=function(_0x2808f0,_0x5d9f78){var _0x4791a5={},_0x200715={},_0x481a04={'count':0x0,'rows':[]};var _0x5a85ee=_[_0xba75('0x2d')](db[_0xba75('0x2e')][_0xba75('0x2f')],function(_0x4b4d69){return{'name':_0x4b4d69[_0xba75('0x30')],'type':_0x4b4d69[_0xba75('0x31')]['key']};});_0x200715[_0xba75('0x32')]=_[_0xba75('0x2d')](_0x5a85ee,_0xba75('0x2a'));_0x200715[_0xba75('0x33')]=_['keys'](_0x2808f0[_0xba75('0x33')]);_0x200715[_0xba75('0x34')]=_['intersection'](_0x200715[_0xba75('0x32')],_0x200715[_0xba75('0x33')]);_0x4791a5[_0xba75('0x35')]=_['intersection'](_0x200715[_0xba75('0x32')],qs[_0xba75('0x36')](_0x2808f0[_0xba75('0x33')][_0xba75('0x36')]));_0x4791a5[_0xba75('0x35')]=_0x4791a5[_0xba75('0x35')][_0xba75('0x37')]?_0x4791a5['attributes']:_0x200715['model'];if(!_0x2808f0[_0xba75('0x33')][_0xba75('0x38')](_0xba75('0x39'))){_0x4791a5['limit']=qs[_0xba75('0x1c')](_0x2808f0[_0xba75('0x33')]['limit']);_0x4791a5['offset']=qs[_0xba75('0x1b')](_0x2808f0[_0xba75('0x33')][_0xba75('0x1b')]);}_0x4791a5[_0xba75('0x3a')]=qs[_0xba75('0x3b')](_0x2808f0['query']['sort']);_0x4791a5[_0xba75('0x3c')]=qs[_0xba75('0x34')](_[_0xba75('0x3d')](_0x2808f0[_0xba75('0x33')],_0x200715[_0xba75('0x34')]),_0x5a85ee);if(_0x2808f0[_0xba75('0x33')][_0xba75('0x3e')]){_0x4791a5['where']=_[_0xba75('0x3f')](_0x4791a5[_0xba75('0x3c')],{'$or':_['map'](_0x5a85ee,function(_0x1f28e8){if(_0x1f28e8[_0xba75('0x31')]!==_0xba75('0x40')){var _0x45d8cd={};_0x45d8cd[_0x1f28e8[_0xba75('0x2a')]]={'$like':'%'+_0x2808f0[_0xba75('0x33')][_0xba75('0x3e')]+'%'};return _0x45d8cd;}})});}_0x4791a5=_['merge']({},_0x4791a5,_0x2808f0[_0xba75('0x41')]);var _0x59d005={'where':_0x4791a5[_0xba75('0x3c')]};return db['Tag'][_0xba75('0x1e')](_0x59d005)[_0xba75('0x21')](function(_0x9c32ad){_0x481a04[_0xba75('0x1e')]=_0x9c32ad;if(_0x2808f0[_0xba75('0x33')][_0xba75('0x42')]){_0x4791a5[_0xba75('0x43')]=[{'all':!![]}];}return db[_0xba75('0x2e')][_0xba75('0x44')](_0x4791a5);})['then'](function(_0x30b5f0){_0x481a04[_0xba75('0x45')]=_0x30b5f0;return _0x481a04;})['then'](respondWithFilteredResult(_0x5d9f78,_0x4791a5))[_0xba75('0x46')](handleError(_0x5d9f78,null));};exports[_0xba75('0x47')]=function(_0x1130ac,_0x5bf935){var _0x5043a5={'raw':!![],'where':{'id':_0x1130ac['params']['id']}},_0x5c6491={};_0x5c6491[_0xba75('0x32')]=_['keys'](db[_0xba75('0x2e')][_0xba75('0x2f')]);_0x5c6491[_0xba75('0x33')]=_[_0xba75('0x48')](_0x1130ac[_0xba75('0x33')]);_0x5c6491['filters']=_['intersection'](_0x5c6491[_0xba75('0x32')],_0x5c6491['query']);_0x5043a5[_0xba75('0x35')]=_['intersection'](_0x5c6491[_0xba75('0x32')],qs[_0xba75('0x36')](_0x1130ac[_0xba75('0x33')][_0xba75('0x36')]));_0x5043a5['attributes']=_0x5043a5[_0xba75('0x35')][_0xba75('0x37')]?_0x5043a5[_0xba75('0x35')]:_0x5c6491[_0xba75('0x32')];if(_0x1130ac[_0xba75('0x33')][_0xba75('0x42')]){_0x5043a5[_0xba75('0x43')]=[{'all':!![]}];}_0x5043a5=_[_0xba75('0x3f')]({},_0x5043a5,_0x1130ac['options']);return db[_0xba75('0x2e')][_0xba75('0x49')](_0x5043a5)[_0xba75('0x21')](handleEntityNotFound(_0x5bf935,null))[_0xba75('0x21')](respondWithResult(_0x5bf935,null))[_0xba75('0x46')](handleError(_0x5bf935,null));};exports['create']=function(_0x2a1f84,_0x25ae33){return db[_0xba75('0x2e')][_0xba75('0x4a')](_0x2a1f84[_0xba75('0x4b')],{})[_0xba75('0x21')](function(_0x2c9085){var _0x5dc5f8=_0x2a1f84[_0xba75('0x4c')][_0xba75('0x23')]({'plain':!![]});if(!_0x5dc5f8)throw new Error(_0xba75('0x4d'));if(_0x5dc5f8['role']===_0xba75('0x4c')){var _0x29b4fc=_0x2c9085['get']({'plain':!![]});var _0x4d7e7e=_0xba75('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x4d7e7e,'userProfileId':_0x5dc5f8[_0xba75('0x4e')]},'raw':!![]})['then'](function(_0xbb87b9){if(_0xbb87b9&&_0xbb87b9[_0xba75('0x4f')]===0x0){return db[_0xba75('0x25')][_0xba75('0x4a')]({'name':_0x29b4fc[_0xba75('0x2a')],'resourceId':_0x29b4fc['id'],'type':_0xbb87b9['name'],'sectionId':_0xbb87b9['id']},{})[_0xba75('0x21')](function(){return _0x2c9085;});}else{return _0x2c9085;}})[_0xba75('0x46')](function(_0x57aaa6){logger[_0xba75('0x28')](_0xba75('0x50'),_0x57aaa6);throw _0x57aaa6;});}return _0x2c9085;})[_0xba75('0x21')](respondWithResult(_0x25ae33,0xc9))[_0xba75('0x46')](handleError(_0x25ae33,null));};exports[_0xba75('0x51')]=function(_0x52b2c9,_0x43f4b7){if(_0x52b2c9[_0xba75('0x4b')]['id']){delete _0x52b2c9['body']['id'];}return db[_0xba75('0x2e')][_0xba75('0x49')]({'where':{'id':_0x52b2c9[_0xba75('0x52')]['id']}})[_0xba75('0x21')](handleEntityNotFound(_0x43f4b7,null))[_0xba75('0x21')](saveUpdates(_0x52b2c9[_0xba75('0x4b')],null))['then'](respondWithResult(_0x43f4b7,null))[_0xba75('0x46')](handleError(_0x43f4b7,null));};exports[_0xba75('0x22')]=function(_0x361efb,_0x429e26){return db[_0xba75('0x2e')][_0xba75('0x49')]({'where':{'id':_0x361efb['params']['id']}})['then'](handleEntityNotFound(_0x429e26,null))['then'](removeEntity(_0x429e26,null))['catch'](handleError(_0x429e26,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index bbefed1..4240855 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 _0x2bb9=['tools_tags','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define','Tag'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x2bb9,0x11f));var _0x92bb=function(_0x151edd,_0x5b2228){_0x151edd=_0x151edd-0x0;var _0x233982=_0x2bb9[_0x151edd];return _0x233982;};'use strict';var _=require('lodash');var util=require(_0x92bb('0x0'));var logger=require(_0x92bb('0x1'))(_0x92bb('0x2'));var moment=require(_0x92bb('0x3'));var BPromise=require(_0x92bb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92bb('0x5'));var rimraf=require(_0x92bb('0x6'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x92bb('0x7')]=function(_0x504d23,_0x1ce7d6){return _0x504d23[_0x92bb('0x8')](_0x92bb('0x9'),attributes,{'tableName':_0x92bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda3d=['moment','bluebird','request-promise','rimraf','./tag.attributes','Tag','tools_tags','../../config/logger'];(function(_0x249a1c,_0xa648f8){var _0x47ffba=function(_0x577461){while(--_0x577461){_0x249a1c['push'](_0x249a1c['shift']());}};_0x47ffba(++_0xa648f8);}(_0xda3d,0x1d7));var _0xdda3=function(_0x322f55,_0x2addc8){_0x322f55=_0x322f55-0x0;var _0x2c2640=_0xda3d[_0x322f55];return _0x2c2640;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdda3('0x0'))('api');var moment=require(_0xdda3('0x1'));var BPromise=require(_0xdda3('0x2'));var rp=require(_0xdda3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdda3('0x4'));var config=require('../../config/environment');var attributes=require(_0xdda3('0x5'));module['exports']=function(_0x15ada4,_0x5ac6f5){return _0x15ada4['define'](_0xdda3('0x6'),attributes,{'tableName':_0xdda3('0x7'),'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 0bb322f..5236427 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 _0xc3fe=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc3fe,0xff));var _0xec3f=function(_0x3ecd80,_0x4f26f1){_0x3ecd80=_0x3ecd80-0x0;var _0x2904b2=_0xc3fe[_0x3ecd80];return _0x2904b2;};'use strict';var _=require(_0xec3f('0x0'));var util=require(_0xec3f('0x1'));var moment=require(_0xec3f('0x2'));var BPromise=require('bluebird');var rs=require(_0xec3f('0x3'));var fs=require('fs');var Redis=require(_0xec3f('0x4'));var db=require(_0xec3f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec3f('0x6'))(_0xec3f('0x7'));var config=require(_0xec3f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xec3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b0b84,_0x526183,_0x503775){return new BPromise(function(_0xcb8557,_0x5df7fc){return client[_0xec3f('0xa')](_0x3b0b84,_0x503775)[_0xec3f('0xb')](function(_0x12a7c5){logger[_0xec3f('0xc')]('Tag,\x20%s,\x20%s',_0x526183,_0xec3f('0xd'));logger[_0xec3f('0xe')](_0xec3f('0xf'),_0x526183,_0xec3f('0xd'),JSON[_0xec3f('0x10')](_0x12a7c5));if(_0x12a7c5[_0xec3f('0x11')]){if(_0x12a7c5['error'][_0xec3f('0x12')]===0x1f4){logger[_0xec3f('0x11')](_0xec3f('0x13'),_0x526183,_0x12a7c5['error']['message']);return _0x5df7fc(_0x12a7c5[_0xec3f('0x11')]['message']);}logger['error'](_0xec3f('0x13'),_0x526183,_0x12a7c5[_0xec3f('0x11')][_0xec3f('0x14')]);return _0xcb8557(_0x12a7c5['error']['message']);}else{logger[_0xec3f('0xc')]('Tag,\x20%s,\x20%s',_0x526183,_0xec3f('0xd'));_0xcb8557(_0x12a7c5[_0xec3f('0x15')]['message']);}})[_0xec3f('0x16')](function(_0xb8ee6f){logger[_0xec3f('0x11')](_0xec3f('0x13'),_0x526183,_0xb8ee6f);_0x5df7fc(_0xb8ee6f);});});} \ No newline at end of file +var _0xfa2b=['jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x41767f,_0x2505c0){var _0x162611=function(_0x28ea64){while(--_0x28ea64){_0x41767f['push'](_0x41767f['shift']());}};_0x162611(++_0x2505c0);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x9abf91,_0x5ac968){_0x9abf91=_0x9abf91-0x0;var _0x18be07=_0xfa2b[_0x9abf91];return _0x18be07;};'use strict';var _=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var moment=require(_0xbfa2('0x2'));var BPromise=require(_0xbfa2('0x3'));var rs=require(_0xbfa2('0x4'));var fs=require('fs');var Redis=require(_0xbfa2('0x5'));var db=require(_0xbfa2('0x6'))['db'];var utils=require(_0xbfa2('0x7'));var logger=require(_0xbfa2('0x8'))(_0xbfa2('0x9'));var config=require(_0xbfa2('0xa'));var jayson=require(_0xbfa2('0xb'));var client=jayson[_0xbfa2('0xc')][_0xbfa2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x26ed93,_0x26e9bf,_0x4cd9ae){return new BPromise(function(_0x46a151,_0x4f17e6){return client[_0xbfa2('0xe')](_0x26ed93,_0x4cd9ae)[_0xbfa2('0xf')](function(_0x1b1c13){logger[_0xbfa2('0x10')](_0xbfa2('0x11'),_0x26e9bf,_0xbfa2('0x12'));logger[_0xbfa2('0x13')](_0xbfa2('0x14'),_0x26e9bf,_0xbfa2('0x12'),JSON['stringify'](_0x1b1c13));if(_0x1b1c13['error']){if(_0x1b1c13['error'][_0xbfa2('0x15')]===0x1f4){logger[_0xbfa2('0x16')](_0xbfa2('0x11'),_0x26e9bf,_0x1b1c13[_0xbfa2('0x16')][_0xbfa2('0x17')]);return _0x4f17e6(_0x1b1c13[_0xbfa2('0x16')]['message']);}logger[_0xbfa2('0x16')](_0xbfa2('0x11'),_0x26e9bf,_0x1b1c13[_0xbfa2('0x16')][_0xbfa2('0x17')]);return _0x46a151(_0x1b1c13[_0xbfa2('0x16')]['message']);}else{logger[_0xbfa2('0x10')]('Tag,\x20%s,\x20%s',_0x26e9bf,'request\x20sent');_0x46a151(_0x1b1c13[_0xbfa2('0x18')]['message']);}})['catch'](function(_0xab2c91){logger[_0xbfa2('0x16')]('Tag,\x20%s,\x20%s',_0x26e9bf,_0xab2c91);_0x4f17e6(_0xab2c91);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index e8f6e7e..879593a 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 72e23ec..639913f 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(_0x4cc3ff,_0x4cef1d){var _0x74bff9=function(_0x485314){while(--_0x485314){_0x4cc3ff['push'](_0x4cc3ff['shift']());}};_0x74bff9(++_0x4cef1d);}(_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 _0x0713=['STRING','name'];(function(_0x269988,_0x6c5940){var _0x172812=function(_0x3ccac5){while(--_0x3ccac5){_0x269988['push'](_0x269988['shift']());}};_0x172812(++_0x6c5940);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 660aedc..cc3579c 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 _0xd5c2=['order','sort','where','pick','filter','merge','VIRTUAL','Team','includeAll','include','findAll','rows','show','keys','length','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','toLowerCase','Queue','capitalize','addQueues','removeQueues','remove','Queues','ids','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','through','penalty','QueueId','TeamVoiceQueue','findOrCreate','emit','Queue:save','User','online','voicePause','interface','upsert','format','SIP/%s','all','VoicePrefixId','spread','removeAgents','transaction','parse','Queue:remove','UserVoiceQueueRt','TeamVoicePrefix','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./team.socket','register','sendStatus','status','end','offset','undefined','limit','count','json','reject','save','update','then','destroy','get','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x12c33f,_0x3deb1a){var _0x58f363=function(_0x15d209){while(--_0x15d209){_0x12c33f['push'](_0x12c33f['shift']());}};_0x58f363(++_0x3deb1a);}(_0xd5c2,0xd6));var _0x2d5c=function(_0x321c62,_0x3db3a6){_0x321c62=_0x321c62-0x0;var _0x3f187b=_0xd5c2[_0x321c62];return _0x3f187b;};'use strict';var emlformat=require(_0x2d5c('0x0'));var rimraf=require(_0x2d5c('0x1'));var zipdir=require(_0x2d5c('0x2'));var jsonpatch=require(_0x2d5c('0x3'));var rp=require(_0x2d5c('0x4'));var moment=require(_0x2d5c('0x5'));var BPromise=require(_0x2d5c('0x6'));var Mustache=require(_0x2d5c('0x7'));var util=require(_0x2d5c('0x8'));var path=require(_0x2d5c('0x9'));var sox=require(_0x2d5c('0xa'));var csv=require('to-csv');var ejs=require(_0x2d5c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2d5c('0xc'));var crypto=require(_0x2d5c('0xd'));var jsforce=require(_0x2d5c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2d5c('0xf'));var Papa=require(_0x2d5c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2d5c('0x11'));var as=require(_0x2d5c('0x12'));var hardwareService=require(_0x2d5c('0x13'));var logger=require('../../config/logger')(_0x2d5c('0x14'));var utils=require(_0x2d5c('0x15'));var config=require(_0x2d5c('0x16'));var licenseUtil=require(_0x2d5c('0x17'));var db=require(_0x2d5c('0x18'))['db'];config['redis']=_[_0x2d5c('0x19')](config[_0x2d5c('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2d5c('0x1a')]));require(_0x2d5c('0x1b'))[_0x2d5c('0x1c')](socket);function respondWithStatusCode(_0x126677,_0x10e85d){_0x10e85d=_0x10e85d||0xcc;return function(_0x53dad4){if(_0x53dad4){return _0x126677[_0x2d5c('0x1d')](_0x10e85d);}return _0x126677[_0x2d5c('0x1e')](_0x10e85d)[_0x2d5c('0x1f')]();};}function respondWithResult(_0xd39464,_0xe9d69b){_0xe9d69b=_0xe9d69b||0xc8;return function(_0x34e9fe){if(_0x34e9fe){return _0xd39464[_0x2d5c('0x1e')](_0xe9d69b)['json'](_0x34e9fe);}};}function respondWithFilteredResult(_0x39fecd,_0x38a13d){return function(_0x2f46a6){if(_0x2f46a6){var _0x4db102=typeof _0x38a13d[_0x2d5c('0x20')]===_0x2d5c('0x21')&&typeof _0x38a13d[_0x2d5c('0x22')]===_0x2d5c('0x21');var _0xa872d7=_0x2f46a6[_0x2d5c('0x23')];var _0x4a6b13=_0x4db102?0x0:_0x38a13d[_0x2d5c('0x20')];var _0x515f8f=_0x4db102?_0x2f46a6[_0x2d5c('0x23')]:_0x38a13d[_0x2d5c('0x20')]+_0x38a13d[_0x2d5c('0x22')];var _0x158dbd;if(_0x515f8f>=_0xa872d7){_0x515f8f=_0xa872d7;_0x158dbd=0xc8;}else{_0x158dbd=0xce;}_0x39fecd['status'](_0x158dbd);return _0x39fecd['set']('Content-Range',_0x4a6b13+'-'+_0x515f8f+'/'+_0xa872d7)[_0x2d5c('0x24')](_0x2f46a6);}return null;};}function patchUpdates(_0x53d541){return function(_0x8b5b09){try{jsonpatch['apply'](_0x8b5b09,_0x53d541,!![]);}catch(_0x2b514c){return BPromise[_0x2d5c('0x25')](_0x2b514c);}return _0x8b5b09[_0x2d5c('0x26')]();};}function saveUpdates(_0x44c9da,_0x179821){return function(_0x5223cc){if(_0x5223cc){return _0x5223cc[_0x2d5c('0x27')](_0x44c9da)[_0x2d5c('0x28')](function(_0x477987){return _0x477987;});}return null;};}function removeEntity(_0x403414,_0x29b992){return function(_0x5144e9){if(_0x5144e9){return _0x5144e9[_0x2d5c('0x29')]()['then'](function(){var _0x262ae6=_0x5144e9[_0x2d5c('0x2a')]({'plain':!![]});var _0x52afa9='Teams';return db[_0x2d5c('0x2b')][_0x2d5c('0x29')]({'where':{'type':_0x52afa9,'resourceId':_0x262ae6['id']}})['then'](function(){return _0x5144e9;});})[_0x2d5c('0x28')](function(){_0x403414[_0x2d5c('0x1e')](0xcc)[_0x2d5c('0x1f')]();});}};}function handleEntityNotFound(_0x2e1c53,_0x4b48f6){return function(_0x2b30ff){if(!_0x2b30ff){_0x2e1c53[_0x2d5c('0x1d')](0x194);}return _0x2b30ff;};}function handleError(_0x187aa5,_0x3b8285){_0x3b8285=_0x3b8285||0x1f4;return function(_0x59a765){logger['error'](_0x59a765['stack']);if(_0x59a765[_0x2d5c('0x2c')]){delete _0x59a765[_0x2d5c('0x2c')];}_0x187aa5[_0x2d5c('0x1e')](_0x3b8285)[_0x2d5c('0x2d')](_0x59a765);};}exports[_0x2d5c('0x2e')]=function(_0x9425fe,_0x5acaf5){var _0x2fa14c={},_0xeced92={},_0x7e4d47={'count':0x0,'rows':[]};var _0x191bdf=_[_0x2d5c('0x2f')](db['Team'][_0x2d5c('0x30')],function(_0x45e690){return{'name':_0x45e690[_0x2d5c('0x31')],'type':_0x45e690[_0x2d5c('0x32')][_0x2d5c('0x33')]};});_0xeced92[_0x2d5c('0x34')]=_[_0x2d5c('0x2f')](_0x191bdf,_0x2d5c('0x2c'));_0xeced92[_0x2d5c('0x35')]=_['keys'](_0x9425fe[_0x2d5c('0x35')]);_0xeced92[_0x2d5c('0x36')]=_[_0x2d5c('0x37')](_0xeced92[_0x2d5c('0x34')],_0xeced92[_0x2d5c('0x35')]);_0x2fa14c[_0x2d5c('0x38')]=_[_0x2d5c('0x37')](_0xeced92['model'],qs[_0x2d5c('0x39')](_0x9425fe[_0x2d5c('0x35')][_0x2d5c('0x39')]));_0x2fa14c[_0x2d5c('0x38')]=_0x2fa14c[_0x2d5c('0x38')]['length']?_0x2fa14c[_0x2d5c('0x38')]:_0xeced92[_0x2d5c('0x34')];if(!_0x9425fe[_0x2d5c('0x35')][_0x2d5c('0x3a')](_0x2d5c('0x3b'))){_0x2fa14c[_0x2d5c('0x22')]=qs[_0x2d5c('0x22')](_0x9425fe[_0x2d5c('0x35')][_0x2d5c('0x22')]);_0x2fa14c[_0x2d5c('0x20')]=qs[_0x2d5c('0x20')](_0x9425fe[_0x2d5c('0x35')][_0x2d5c('0x20')]);}_0x2fa14c[_0x2d5c('0x3c')]=qs[_0x2d5c('0x3d')](_0x9425fe['query'][_0x2d5c('0x3d')]);_0x2fa14c[_0x2d5c('0x3e')]=qs['filters'](_[_0x2d5c('0x3f')](_0x9425fe[_0x2d5c('0x35')],_0xeced92[_0x2d5c('0x36')]),_0x191bdf);if(_0x9425fe['query'][_0x2d5c('0x40')]){_0x2fa14c[_0x2d5c('0x3e')]=_[_0x2d5c('0x41')](_0x2fa14c[_0x2d5c('0x3e')],{'$or':_[_0x2d5c('0x2f')](_0x191bdf,function(_0x59301a){if(_0x59301a[_0x2d5c('0x32')]!==_0x2d5c('0x42')){var _0x19a5fd={};_0x19a5fd[_0x59301a[_0x2d5c('0x2c')]]={'$like':'%'+_0x9425fe[_0x2d5c('0x35')][_0x2d5c('0x40')]+'%'};return _0x19a5fd;}})});}_0x2fa14c=_[_0x2d5c('0x41')]({},_0x2fa14c,_0x9425fe['options']);var _0x2f1404={'where':_0x2fa14c[_0x2d5c('0x3e')]};return db[_0x2d5c('0x43')][_0x2d5c('0x23')](_0x2f1404)[_0x2d5c('0x28')](function(_0x45cd35){_0x7e4d47[_0x2d5c('0x23')]=_0x45cd35;if(_0x9425fe['query'][_0x2d5c('0x44')]){_0x2fa14c[_0x2d5c('0x45')]=[{'all':!![]}];}return db[_0x2d5c('0x43')][_0x2d5c('0x46')](_0x2fa14c);})['then'](function(_0x127e3d){_0x7e4d47[_0x2d5c('0x47')]=_0x127e3d;return _0x7e4d47;})['then'](respondWithFilteredResult(_0x5acaf5,_0x2fa14c))['catch'](handleError(_0x5acaf5,null));};exports[_0x2d5c('0x48')]=function(_0x1d3200,_0x38c630){var _0x6dc86b={'raw':![],'where':{'id':_0x1d3200['params']['id']}},_0x43f688={};_0x43f688[_0x2d5c('0x34')]=_[_0x2d5c('0x49')](db[_0x2d5c('0x43')][_0x2d5c('0x30')]);_0x43f688[_0x2d5c('0x35')]=_['keys'](_0x1d3200[_0x2d5c('0x35')]);_0x43f688['filters']=_['intersection'](_0x43f688['model'],_0x43f688[_0x2d5c('0x35')]);_0x6dc86b['attributes']=_['intersection'](_0x43f688['model'],qs['fields'](_0x1d3200[_0x2d5c('0x35')][_0x2d5c('0x39')]));_0x6dc86b[_0x2d5c('0x38')]=_0x6dc86b['attributes'][_0x2d5c('0x4a')]?_0x6dc86b[_0x2d5c('0x38')]:_0x43f688['model'];if(_0x1d3200['query'][_0x2d5c('0x44')]){_0x6dc86b[_0x2d5c('0x45')]=[{'all':!![]}];}_0x6dc86b=_[_0x2d5c('0x41')]({},_0x6dc86b,_0x1d3200[_0x2d5c('0x4b')]);return db[_0x2d5c('0x43')][_0x2d5c('0x4c')](_0x6dc86b)[_0x2d5c('0x28')](handleEntityNotFound(_0x38c630,null))[_0x2d5c('0x28')](respondWithResult(_0x38c630,null))[_0x2d5c('0x4d')](handleError(_0x38c630,null));};exports[_0x2d5c('0x4e')]=function(_0x433677,_0x35174f){return db[_0x2d5c('0x43')][_0x2d5c('0x4e')](_0x433677[_0x2d5c('0x4f')],{})[_0x2d5c('0x28')](function(_0x1bc6f9){var _0xe12563=_0x433677[_0x2d5c('0x50')][_0x2d5c('0x2a')]({'plain':!![]});if(!_0xe12563)throw new Error(_0x2d5c('0x51'));if(_0xe12563[_0x2d5c('0x52')]===_0x2d5c('0x50')){var _0x25413e=_0x1bc6f9[_0x2d5c('0x2a')]({'plain':!![]});var _0x3de33c=_0x2d5c('0x53');return db[_0x2d5c('0x54')]['find']({'where':{'name':_0x3de33c,'userProfileId':_0xe12563[_0x2d5c('0x55')]},'raw':!![]})[_0x2d5c('0x28')](function(_0x41eb7d){if(_0x41eb7d&&_0x41eb7d['autoAssociation']===0x0){return db[_0x2d5c('0x2b')][_0x2d5c('0x4e')]({'name':_0x25413e['name'],'resourceId':_0x25413e['id'],'type':_0x41eb7d[_0x2d5c('0x2c')],'sectionId':_0x41eb7d['id']},{})[_0x2d5c('0x28')](function(){return _0x1bc6f9;});}else{return _0x1bc6f9;}})[_0x2d5c('0x4d')](function(_0x53626a){logger[_0x2d5c('0x56')](_0x2d5c('0x57'),_0x53626a);throw _0x53626a;});}return _0x1bc6f9;})[_0x2d5c('0x28')](respondWithResult(_0x35174f,0xc9))[_0x2d5c('0x4d')](handleError(_0x35174f,null));};exports[_0x2d5c('0x27')]=function(_0x3569b7,_0x671ea6){if(_0x3569b7[_0x2d5c('0x4f')]['id']){delete _0x3569b7['body']['id'];}return db['Team'][_0x2d5c('0x4c')]({'where':{'id':_0x3569b7[_0x2d5c('0x58')]['id']}})['then'](handleEntityNotFound(_0x671ea6,null))[_0x2d5c('0x28')](saveUpdates(_0x3569b7['body'],null))[_0x2d5c('0x28')](respondWithResult(_0x671ea6,null))['catch'](handleError(_0x671ea6,null));};exports[_0x2d5c('0x29')]=function(_0x5a34eb,_0x416a40){return db['Team'][_0x2d5c('0x4c')]({'where':{'id':_0x5a34eb[_0x2d5c('0x58')]['id']}})[_0x2d5c('0x28')](handleEntityNotFound(_0x416a40,null))[_0x2d5c('0x28')](removeEntity(_0x416a40,null))[_0x2d5c('0x4d')](handleError(_0x416a40,null));};exports[_0x2d5c('0x59')]=function(_0x4165b3,_0x4595c9,_0x2cf299){return db[_0x2d5c('0x43')][_0x2d5c('0x5a')]({'where':{'id':_0x4165b3['params']['id']}})['then'](handleEntityNotFound(_0x4595c9,null))[_0x2d5c('0x28')](function(_0x5728bc){if(!_0x4165b3[_0x2d5c('0x35')][_0x2d5c('0x5b')]||!utils[_0x2d5c('0x5c')](_0x4165b3[_0x2d5c('0x35')][_0x2d5c('0x5b')])){throw new db[(_0x2d5c('0x5d'))][(_0x2d5c('0x5e'))](_0x2d5c('0x5f'));}var _0x118c1c={};var _0x3f5bd8={};_0x3f5bd8['model']=_[_0x2d5c('0x49')](db[_['capitalize'](_0x4165b3[_0x2d5c('0x35')][_0x2d5c('0x5b')][_0x2d5c('0x60')]())+_0x2d5c('0x61')][_0x2d5c('0x30')]);_0x3f5bd8[_0x2d5c('0x35')]=_[_0x2d5c('0x49')](_0x4165b3['query']);_0x3f5bd8[_0x2d5c('0x36')]=_[_0x2d5c('0x37')](_0x3f5bd8[_0x2d5c('0x34')],_0x3f5bd8[_0x2d5c('0x35')]);_0x118c1c[_0x2d5c('0x38')]=_[_0x2d5c('0x37')](_0x3f5bd8[_0x2d5c('0x34')],qs['fields'](_0x4165b3[_0x2d5c('0x35')]['fields']));_0x118c1c[_0x2d5c('0x38')]=_0x118c1c[_0x2d5c('0x38')][_0x2d5c('0x4a')]?_0x118c1c['attributes']:_0x3f5bd8[_0x2d5c('0x34')];_0x118c1c[_0x2d5c('0x22')]=qs['limit'](_0x4165b3[_0x2d5c('0x35')][_0x2d5c('0x22')]);_0x118c1c['offset']=qs[_0x2d5c('0x20')](_0x4165b3['query'][_0x2d5c('0x20')]);_0x118c1c[_0x2d5c('0x3c')]=qs[_0x2d5c('0x3d')](_0x4165b3[_0x2d5c('0x35')][_0x2d5c('0x3d')]);_0x118c1c[_0x2d5c('0x3e')]=qs[_0x2d5c('0x36')](_[_0x2d5c('0x3f')](_0x4165b3[_0x2d5c('0x35')],_0x3f5bd8[_0x2d5c('0x36')]));_0x118c1c=_[_0x2d5c('0x41')]({},_0x118c1c,_0x4165b3['options']);return _0x5728bc[_0x2d5c('0x2a')+_[_0x2d5c('0x62')](_0x4165b3['query'][_0x2d5c('0x5b')]['toLowerCase']())+'Queues'](_0x118c1c);})['then'](respondWithResult(_0x4595c9,null))[_0x2d5c('0x4d')](handleError(_0x4595c9,null));};exports[_0x2d5c('0x63')]=function(_0xa23a7f,_0x167c03,_0x1c20ef){return db['Team']['findOne']({'where':{'id':_0xa23a7f[_0x2d5c('0x58')]['id']}})[_0x2d5c('0x28')](function(_0x5d5e0e){if(_0x5d5e0e){if(!_0xa23a7f[_0x2d5c('0x4f')]['channel']||!utils[_0x2d5c('0x5c')](_0xa23a7f[_0x2d5c('0x4f')][_0x2d5c('0x5b')])){throw new db['Sequelize'][(_0x2d5c('0x5e'))]('Unknown\x20channel');}return _0x5d5e0e['add'+_[_0x2d5c('0x62')](_0xa23a7f[_0x2d5c('0x4f')][_0x2d5c('0x5b')][_0x2d5c('0x60')]())+'Queues'](_0xa23a7f['body']['ids']);}return null;})['then'](handleEntityNotFound(_0x167c03,null))[_0x2d5c('0x28')](respondWithStatusCode(_0x167c03,null))[_0x2d5c('0x4d')](handleError(_0x167c03,null));};exports[_0x2d5c('0x64')]=function(_0x12189d,_0x3dfd35,_0xd6eb19){return db[_0x2d5c('0x43')][_0x2d5c('0x5a')]({'where':{'id':_0x12189d[_0x2d5c('0x58')]['id']}})[_0x2d5c('0x28')](function(_0x4539cd){if(_0x4539cd){if(!_0x12189d[_0x2d5c('0x35')][_0x2d5c('0x5b')]||!utils[_0x2d5c('0x5c')](_0x12189d[_0x2d5c('0x35')]['channel'])){throw new db[(_0x2d5c('0x5d'))][(_0x2d5c('0x5e'))](_0x2d5c('0x5f'));}return _0x4539cd[_0x2d5c('0x65')+_[_0x2d5c('0x62')](_0x12189d[_0x2d5c('0x35')][_0x2d5c('0x5b')][_0x2d5c('0x60')]())+_0x2d5c('0x66')](_0x12189d['query'][_0x2d5c('0x67')]);}return null;})[_0x2d5c('0x28')](handleEntityNotFound(_0x3dfd35,null))[_0x2d5c('0x28')](respondWithStatusCode(_0x3dfd35,null))[_0x2d5c('0x4d')](handleError(_0x3dfd35,null));};exports[_0x2d5c('0x68')]=function(_0x540677,_0x6acdd9){return db[_0x2d5c('0x43')][_0x2d5c('0x4c')]({'where':{'id':_0x540677[_0x2d5c('0x58')]['id']}})[_0x2d5c('0x28')](handleEntityNotFound(_0x6acdd9,null))[_0x2d5c('0x28')](function(_0x2140e0){if(_0x2140e0){var _0x315dc3=[_0x2d5c('0x69'),_0x2d5c('0x6a'),_0x2d5c('0x6b'),_0x2d5c('0x6c'),_0x2d5c('0x6d'),_0x2d5c('0x6e'),_0x2d5c('0x6f')];return db[_0x2d5c('0x70')]['transaction'](function(_0x139c77){var _0x4a5d66=_['map'](_0x315dc3,function(_0x3f1c07){var _0x1bdace={'attributes':['id',_0x2d5c('0x2c')]};if(_0x3f1c07===_0x2d5c('0x69')){_0x1bdace[_0x2d5c('0x71')]={'attributes':[_0x2d5c('0x72')]};}return _0x2140e0['get'+_0x3f1c07+_0x2d5c('0x66')](_0x1bdace)['then'](function(_0x590566){var _0x4f2974=_[_0x2d5c('0x2f')](_0x590566,function(_0x16a65c){var _0x483f9a=_['map'](_0x540677[_0x2d5c('0x4f')][_0x2d5c('0x67')],function(_0x21a5ab){var _0x1153cf={'where':{'UserId':_0x21a5ab,[_0x3f1c07+_0x2d5c('0x73')]:_0x16a65c['id']},'transaction':_0x139c77};if(_0x3f1c07==='Voice'){_0x1153cf[_0x2d5c('0x19')]={'penalty':_0x16a65c[_0x2d5c('0x74')][_0x2d5c('0x72')]};}return db['User'+_0x3f1c07+'Queue'][_0x2d5c('0x75')](_0x1153cf)[_0x2d5c('0x28')](function(){socket[_0x2d5c('0x76')](_0x2d5c('0x50')+_0x3f1c07+_0x2d5c('0x77'),{'UserId':_0x21a5ab,[_0x3f1c07+_0x2d5c('0x73')]:_0x16a65c['id']});if(_0x3f1c07!==_0x2d5c('0x69'))return;return db[_0x2d5c('0x78')]['findAll']({'where':{'id':_0x540677[_0x2d5c('0x4f')][_0x2d5c('0x67')],'online':0x1},'attributes':['id',_0x2d5c('0x2c'),_0x2d5c('0x79'),_0x2d5c('0x7a'),_0x2d5c('0x7b')],'raw':!![]})['then'](function(_0x325a31){var _0x17f696=_['map'](_0x325a31,function(_0x3fae90){return db['UserVoiceQueueRt'][_0x2d5c('0x7c')]({'membername':_0x3fae90[_0x2d5c('0x2c')],'UserId':_0x3fae90['id'],'queue_name':_0x16a65c[_0x2d5c('0x2c')],'VoiceQueueId':_0x16a65c['id'],'interface':_['isNil'](_0x3fae90[_0x2d5c('0x7b')])?util[_0x2d5c('0x7d')](_0x2d5c('0x7e'),_0x3fae90['name']):_0x3fae90['interface'],'paused':_0x3fae90[_0x2d5c('0x7a')]||![],'penalty':_0x16a65c['TeamVoiceQueue'][_0x2d5c('0x72')]},{'transaction':_0x139c77});});return Promise[_0x2d5c('0x7f')](_0x17f696);});});});return Promise[_0x2d5c('0x7f')](_0x483f9a);});return Promise[_0x2d5c('0x7f')](_0x4f2974);})[_0x2d5c('0x28')](function(){var _0x5a6fc8=JSON['parse']('['+_0x540677[_0x2d5c('0x4f')][_0x2d5c('0x67')]+']');db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x540677[_0x2d5c('0x58')]['id']}})[_0x2d5c('0x28')](function(_0x534bc0){if(_0x534bc0){for(var _0x3fcd3e=0x0;_0x3fcd3e<_0x5a6fc8['length'];_0x3fcd3e++){var _0x5727a9=_0x5a6fc8[_0x3fcd3e];db['UserVoicePrefix'][_0x2d5c('0x7c')]({'UserId':_0x5727a9,'VoicePrefixId':_0x534bc0[_0x2d5c('0x80')]});}}});});});return Promise[_0x2d5c('0x7f')](_0x4a5d66)[_0x2d5c('0x28')](function(){return _0x2140e0[_0x2d5c('0x68')](_0x540677[_0x2d5c('0x4f')][_0x2d5c('0x67')],{'transaction':_0x139c77})[_0x2d5c('0x81')](function(_0x1ef600){return _0x1ef600;});});});}})[_0x2d5c('0x28')](respondWithResult(_0x6acdd9,null))[_0x2d5c('0x4d')](handleError(_0x6acdd9,null));};exports[_0x2d5c('0x82')]=function(_0x393360,_0x6c4e91){return db[_0x2d5c('0x43')][_0x2d5c('0x4c')]({'where':{'id':_0x393360[_0x2d5c('0x58')]['id']}})[_0x2d5c('0x28')](handleEntityNotFound(_0x6c4e91,null))[_0x2d5c('0x28')](function(_0x7c3fad){if(_0x7c3fad){var _0x467258=[_0x2d5c('0x69'),_0x2d5c('0x6a'),_0x2d5c('0x6b'),_0x2d5c('0x6c'),_0x2d5c('0x6d'),_0x2d5c('0x6e'),_0x2d5c('0x6f')];return db['sequelize'][_0x2d5c('0x83')](function(_0x4211c0){var _0x923b6e=_[_0x2d5c('0x2f')](_0x467258,function(_0x595412){var _0xdb2e5b={'attributes':['id',_0x2d5c('0x2c')]};return _0x7c3fad[_0x2d5c('0x2a')+_0x595412+_0x2d5c('0x66')](_0xdb2e5b)[_0x2d5c('0x28')](function(_0x148119){var _0x4f1c73=_[_0x2d5c('0x2f')](_0x148119,function(_0x4a6713){return _0x4a6713['removeAgents'](_0x393360['query'][_0x2d5c('0x67')],{'transaction':_0x4211c0})[_0x2d5c('0x28')](function(){var _0x194498=JSON[_0x2d5c('0x84')]('['+_0x393360['query'][_0x2d5c('0x67')]+']');var _0x108b86=_[_0x2d5c('0x2f')](_0x194498,function(_0xd5db53){socket[_0x2d5c('0x76')](_0x2d5c('0x50')+_0x595412+_0x2d5c('0x85'),{'UserId':Number(_0xd5db53),[_0x595412+_0x2d5c('0x73')]:_0x4a6713['id']});if(_0x595412!==_0x2d5c('0x69'))return;return db[_0x2d5c('0x86')][_0x2d5c('0x29')]({'where':{'VoiceQueueId':_0x4a6713['id'],'UserId':_0xd5db53},'transaction':_0x4211c0});});return Promise[_0x2d5c('0x7f')](_0x108b86);});});return Promise[_0x2d5c('0x7f')](_0x4f1c73);});});return Promise[_0x2d5c('0x7f')](_0x923b6e)[_0x2d5c('0x28')](function(){return _0x7c3fad[_0x2d5c('0x82')](_0x393360['query'][_0x2d5c('0x67')],{'transaction':_0x4211c0});})[_0x2d5c('0x28')](function(){var _0x2a44ac=JSON[_0x2d5c('0x84')]('['+_0x393360[_0x2d5c('0x35')]['ids']+']');db[_0x2d5c('0x87')][_0x2d5c('0x5a')]({'where':{'teamId':_0x393360[_0x2d5c('0x58')]['id']}})['then'](function(_0x638b79){if(_0x638b79){for(var _0x58c7f8=0x0;_0x58c7f8<_0x2a44ac[_0x2d5c('0x4a')];_0x58c7f8++){var _0x35c84c=_0x2a44ac[_0x58c7f8];db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x35c84c,'VoicePrefixId':_0x638b79[_0x2d5c('0x80')]}});}}});});});}})['then'](respondWithStatusCode(_0x6c4e91,null))[_0x2d5c('0x4d')](handleError(_0x6c4e91,null));};exports[_0x2d5c('0x88')]=function(_0x36e33,_0x5ee02d,_0x1310f5){var _0x4dcafa={};var _0x55e1ef={};var _0x2d4402;var _0x401cd3;return db[_0x2d5c('0x43')][_0x2d5c('0x5a')]({'where':{'id':_0x36e33[_0x2d5c('0x58')]['id']}})[_0x2d5c('0x28')](handleEntityNotFound(_0x5ee02d,null))[_0x2d5c('0x28')](function(_0x10a3ae){if(_0x10a3ae){_0x2d4402=_0x10a3ae;_0x55e1ef[_0x2d5c('0x34')]=_['keys'](db[_0x2d5c('0x78')][_0x2d5c('0x30')]);_0x55e1ef[_0x2d5c('0x35')]=_[_0x2d5c('0x49')](_0x36e33[_0x2d5c('0x35')]);_0x55e1ef[_0x2d5c('0x36')]=_['intersection'](_0x55e1ef[_0x2d5c('0x34')],_0x55e1ef['query']);_0x4dcafa[_0x2d5c('0x38')]=_[_0x2d5c('0x37')](_0x55e1ef[_0x2d5c('0x34')],qs['fields'](_0x36e33[_0x2d5c('0x35')][_0x2d5c('0x39')]));_0x4dcafa['attributes']=_0x4dcafa[_0x2d5c('0x38')][_0x2d5c('0x4a')]?_0x4dcafa['attributes']:_0x55e1ef[_0x2d5c('0x34')];_0x4dcafa['order']=qs[_0x2d5c('0x3d')](_0x36e33[_0x2d5c('0x35')][_0x2d5c('0x3d')]);_0x4dcafa['where']=qs['filters'](_[_0x2d5c('0x3f')](_0x36e33['query'],_0x55e1ef[_0x2d5c('0x36')]));if(_0x36e33[_0x2d5c('0x35')][_0x2d5c('0x40')]){_0x4dcafa['where']=_[_0x2d5c('0x41')](_0x4dcafa[_0x2d5c('0x3e')],{'$or':_['map'](_0x4dcafa[_0x2d5c('0x38')],function(_0x31b856){var _0x24cd60={};_0x24cd60[_0x31b856]={'$like':'%'+_0x36e33[_0x2d5c('0x35')][_0x2d5c('0x40')]+'%'};return _0x24cd60;})});}_0x4dcafa=_[_0x2d5c('0x41')]({},_0x4dcafa,_0x36e33[_0x2d5c('0x4b')]);return _0x2d4402[_0x2d5c('0x88')](_0x4dcafa);}})['then'](function(_0x2a9121){if(_0x2a9121){_0x401cd3=_0x2a9121['length'];if(!_0x36e33[_0x2d5c('0x35')][_0x2d5c('0x3a')](_0x2d5c('0x3b'))){_0x4dcafa[_0x2d5c('0x22')]=qs[_0x2d5c('0x22')](_0x36e33[_0x2d5c('0x35')][_0x2d5c('0x22')]);_0x4dcafa[_0x2d5c('0x20')]=qs[_0x2d5c('0x20')](_0x36e33['query']['offset']);}return _0x2d4402['getAgents'](_0x4dcafa);}})['then'](function(_0x2c295e){if(_0x2c295e){return _0x2c295e?{'count':_0x401cd3,'rows':_0x2c295e}:null;}})[_0x2d5c('0x28')](respondWithResult(_0x5ee02d,null))[_0x2d5c('0x4d')](handleError(_0x5ee02d,null));}; \ No newline at end of file +var _0x45d6=['undefined','count','offset','limit','set','apply','reject','save','then','destroy','get','Teams','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','length','includeAll','include','find','create','Team','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getQueues','channel','ValidationError','Unknown\x20channel','toLowerCase','Queue','pick','capitalize','addQueues','findOne','isValidChannel','Sequelize','add','Queues','ids','addAgents','Chat','Sms','Fax','Openchannel','sequelize','transaction','Voice','penalty','QueueId','TeamVoiceQueue','User','Queue:save','online','interface','upsert','isNil','SIP/%s','voicePause','all','parse','VoicePrefixId','spread','Mail','Whatsapp','removeAgents','emit','Queue:remove','UserVoicePrefix','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json'];(function(_0x3ac72d,_0x591c5d){var _0x19273a=function(_0x46967b){while(--_0x46967b){_0x3ac72d['push'](_0x3ac72d['shift']());}};_0x19273a(++_0x591c5d);}(_0x45d6,0xef));var _0x645d=function(_0x55c9ee,_0x26882){_0x55c9ee=_0x55c9ee-0x0;var _0x2adba0=_0x45d6[_0x55c9ee];return _0x2adba0;};'use strict';var emlformat=require(_0x645d('0x0'));var rimraf=require(_0x645d('0x1'));var zipdir=require(_0x645d('0x2'));var jsonpatch=require(_0x645d('0x3'));var rp=require(_0x645d('0x4'));var moment=require(_0x645d('0x5'));var BPromise=require(_0x645d('0x6'));var Mustache=require(_0x645d('0x7'));var util=require(_0x645d('0x8'));var path=require(_0x645d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x645d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x645d('0xb'));var squel=require(_0x645d('0xc'));var crypto=require(_0x645d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x645d('0xe'));var toCsv=require(_0x645d('0xf'));var querystring=require('querystring');var Papa=require(_0x645d('0x10'));var Redis=require('ioredis');var authService=require(_0x645d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x645d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x645d('0x13'));var utils=require(_0x645d('0x14'));var config=require(_0x645d('0x15'));var licenseUtil=require(_0x645d('0x16'));var db=require('../../mysqldb')['db'];config[_0x645d('0x17')]=_[_0x645d('0x18')](config[_0x645d('0x17')],{'host':_0x645d('0x19'),'port':0x18eb});var socket=require(_0x645d('0x1a'))(new Redis(config['redis']));require('./team.socket')[_0x645d('0x1b')](socket);function respondWithStatusCode(_0x4284a5,_0x4c2242){_0x4c2242=_0x4c2242||0xcc;return function(_0x393ec2){if(_0x393ec2){return _0x4284a5[_0x645d('0x1c')](_0x4c2242);}return _0x4284a5[_0x645d('0x1d')](_0x4c2242)['end']();};}function respondWithResult(_0x413080,_0x4956a5){_0x4956a5=_0x4956a5||0xc8;return function(_0x5e4f69){if(_0x5e4f69){return _0x413080[_0x645d('0x1d')](_0x4956a5)[_0x645d('0x1e')](_0x5e4f69);}};}function respondWithFilteredResult(_0x4587df,_0xd1cacd){return function(_0x279a3c){if(_0x279a3c){var _0x148b88=typeof _0xd1cacd['offset']===_0x645d('0x1f')&&typeof _0xd1cacd['limit']===_0x645d('0x1f');var _0x8404cf=_0x279a3c[_0x645d('0x20')];var _0x3a9c18=_0x148b88?0x0:_0xd1cacd[_0x645d('0x21')];var _0x223dbe=_0x148b88?_0x279a3c['count']:_0xd1cacd[_0x645d('0x21')]+_0xd1cacd[_0x645d('0x22')];var _0x494784;if(_0x223dbe>=_0x8404cf){_0x223dbe=_0x8404cf;_0x494784=0xc8;}else{_0x494784=0xce;}_0x4587df[_0x645d('0x1d')](_0x494784);return _0x4587df[_0x645d('0x23')]('Content-Range',_0x3a9c18+'-'+_0x223dbe+'/'+_0x8404cf)['json'](_0x279a3c);}return null;};}function patchUpdates(_0x591cbf){return function(_0x31926a){try{jsonpatch[_0x645d('0x24')](_0x31926a,_0x591cbf,!![]);}catch(_0xe4519e){return BPromise[_0x645d('0x25')](_0xe4519e);}return _0x31926a[_0x645d('0x26')]();};}function saveUpdates(_0x14f0a2,_0xf11518){return function(_0x83842f){if(_0x83842f){return _0x83842f['update'](_0x14f0a2)[_0x645d('0x27')](function(_0x23fe9f){return _0x23fe9f;});}return null;};}function removeEntity(_0x4f782f,_0x332174){return function(_0x1fab1f){if(_0x1fab1f){return _0x1fab1f[_0x645d('0x28')]()[_0x645d('0x27')](function(){var _0x2d1141=_0x1fab1f[_0x645d('0x29')]({'plain':!![]});var _0x19d49b=_0x645d('0x2a');return db[_0x645d('0x2b')]['destroy']({'where':{'type':_0x19d49b,'resourceId':_0x2d1141['id']}})[_0x645d('0x27')](function(){return _0x1fab1f;});})['then'](function(){_0x4f782f[_0x645d('0x1d')](0xcc)[_0x645d('0x2c')]();});}};}function handleEntityNotFound(_0x56d414,_0xbbe12d){return function(_0x1c9037){if(!_0x1c9037){_0x56d414[_0x645d('0x1c')](0x194);}return _0x1c9037;};}function handleError(_0x327b24,_0x366cd0){_0x366cd0=_0x366cd0||0x1f4;return function(_0x52c4c5){logger[_0x645d('0x2d')](_0x52c4c5[_0x645d('0x2e')]);if(_0x52c4c5[_0x645d('0x2f')]){delete _0x52c4c5['name'];}_0x327b24[_0x645d('0x1d')](_0x366cd0)[_0x645d('0x30')](_0x52c4c5);};}exports[_0x645d('0x31')]=function(_0x5a914e,_0x1a3d73){var _0x24405d={},_0x508323={},_0xe082c4={'count':0x0,'rows':[]};var _0x47b6eb=_[_0x645d('0x32')](db['Team'][_0x645d('0x33')],function(_0x56fcf7){return{'name':_0x56fcf7[_0x645d('0x34')],'type':_0x56fcf7['type'][_0x645d('0x35')]};});_0x508323['model']=_[_0x645d('0x32')](_0x47b6eb,_0x645d('0x2f'));_0x508323[_0x645d('0x36')]=_['keys'](_0x5a914e[_0x645d('0x36')]);_0x508323['filters']=_[_0x645d('0x37')](_0x508323[_0x645d('0x38')],_0x508323[_0x645d('0x36')]);_0x24405d['attributes']=_[_0x645d('0x37')](_0x508323[_0x645d('0x38')],qs[_0x645d('0x39')](_0x5a914e[_0x645d('0x36')][_0x645d('0x39')]));_0x24405d[_0x645d('0x3a')]=_0x24405d[_0x645d('0x3a')]['length']?_0x24405d[_0x645d('0x3a')]:_0x508323[_0x645d('0x38')];if(!_0x5a914e[_0x645d('0x36')][_0x645d('0x3b')](_0x645d('0x3c'))){_0x24405d[_0x645d('0x22')]=qs['limit'](_0x5a914e[_0x645d('0x36')][_0x645d('0x22')]);_0x24405d['offset']=qs['offset'](_0x5a914e[_0x645d('0x36')][_0x645d('0x21')]);}_0x24405d[_0x645d('0x3d')]=qs[_0x645d('0x3e')](_0x5a914e['query']['sort']);_0x24405d[_0x645d('0x3f')]=qs[_0x645d('0x40')](_['pick'](_0x5a914e[_0x645d('0x36')],_0x508323[_0x645d('0x40')]),_0x47b6eb);if(_0x5a914e[_0x645d('0x36')][_0x645d('0x41')]){_0x24405d['where']=_[_0x645d('0x42')](_0x24405d[_0x645d('0x3f')],{'$or':_['map'](_0x47b6eb,function(_0x4dacbe){if(_0x4dacbe['type']!==_0x645d('0x43')){var _0xe57cfa={};_0xe57cfa[_0x4dacbe[_0x645d('0x2f')]]={'$like':'%'+_0x5a914e['query'][_0x645d('0x41')]+'%'};return _0xe57cfa;}})});}_0x24405d=_[_0x645d('0x42')]({},_0x24405d,_0x5a914e[_0x645d('0x44')]);var _0x1304d6={'where':_0x24405d[_0x645d('0x3f')]};return db['Team'][_0x645d('0x20')](_0x1304d6)[_0x645d('0x27')](function(_0x52109e){_0xe082c4[_0x645d('0x20')]=_0x52109e;if(_0x5a914e[_0x645d('0x36')]['includeAll']){_0x24405d['include']=[{'all':!![]}];}return db['Team'][_0x645d('0x45')](_0x24405d);})[_0x645d('0x27')](function(_0x4f5b07){_0xe082c4[_0x645d('0x46')]=_0x4f5b07;return _0xe082c4;})[_0x645d('0x27')](respondWithFilteredResult(_0x1a3d73,_0x24405d))[_0x645d('0x47')](handleError(_0x1a3d73,null));};exports[_0x645d('0x48')]=function(_0x2c8d10,_0x2e52d0){var _0x211b0d={'raw':![],'where':{'id':_0x2c8d10[_0x645d('0x49')]['id']}},_0x7743c1={};_0x7743c1['model']=_[_0x645d('0x4a')](db['Team']['rawAttributes']);_0x7743c1[_0x645d('0x36')]=_[_0x645d('0x4a')](_0x2c8d10[_0x645d('0x36')]);_0x7743c1[_0x645d('0x40')]=_[_0x645d('0x37')](_0x7743c1[_0x645d('0x38')],_0x7743c1[_0x645d('0x36')]);_0x211b0d['attributes']=_[_0x645d('0x37')](_0x7743c1[_0x645d('0x38')],qs[_0x645d('0x39')](_0x2c8d10[_0x645d('0x36')][_0x645d('0x39')]));_0x211b0d[_0x645d('0x3a')]=_0x211b0d[_0x645d('0x3a')][_0x645d('0x4b')]?_0x211b0d[_0x645d('0x3a')]:_0x7743c1['model'];if(_0x2c8d10[_0x645d('0x36')][_0x645d('0x4c')]){_0x211b0d[_0x645d('0x4d')]=[{'all':!![]}];}_0x211b0d=_['merge']({},_0x211b0d,_0x2c8d10[_0x645d('0x44')]);return db['Team'][_0x645d('0x4e')](_0x211b0d)['then'](handleEntityNotFound(_0x2e52d0,null))[_0x645d('0x27')](respondWithResult(_0x2e52d0,null))[_0x645d('0x47')](handleError(_0x2e52d0,null));};exports[_0x645d('0x4f')]=function(_0x5a8261,_0x2902fb){return db[_0x645d('0x50')]['create'](_0x5a8261[_0x645d('0x51')],{})[_0x645d('0x27')](function(_0x587dd3){var _0x3ef32e=_0x5a8261[_0x645d('0x52')][_0x645d('0x29')]({'plain':!![]});if(!_0x3ef32e)throw new Error(_0x645d('0x53'));if(_0x3ef32e[_0x645d('0x54')]==='user'){var _0x1b895a=_0x587dd3['get']({'plain':!![]});var _0x1415f0=_0x645d('0x2a');return db[_0x645d('0x55')][_0x645d('0x4e')]({'where':{'name':_0x1415f0,'userProfileId':_0x3ef32e[_0x645d('0x56')]},'raw':!![]})[_0x645d('0x27')](function(_0x5852f9){if(_0x5852f9&&_0x5852f9[_0x645d('0x57')]===0x0){return db[_0x645d('0x2b')][_0x645d('0x4f')]({'name':_0x1b895a[_0x645d('0x2f')],'resourceId':_0x1b895a['id'],'type':_0x5852f9[_0x645d('0x2f')],'sectionId':_0x5852f9['id']},{})[_0x645d('0x27')](function(){return _0x587dd3;});}else{return _0x587dd3;}})['catch'](function(_0x27fede){logger['error'](_0x645d('0x58'),_0x27fede);throw _0x27fede;});}return _0x587dd3;})['then'](respondWithResult(_0x2902fb,0xc9))[_0x645d('0x47')](handleError(_0x2902fb,null));};exports[_0x645d('0x59')]=function(_0x2a42bb,_0x255333){if(_0x2a42bb[_0x645d('0x51')]['id']){delete _0x2a42bb[_0x645d('0x51')]['id'];}return db[_0x645d('0x50')]['find']({'where':{'id':_0x2a42bb[_0x645d('0x49')]['id']}})[_0x645d('0x27')](handleEntityNotFound(_0x255333,null))[_0x645d('0x27')](saveUpdates(_0x2a42bb[_0x645d('0x51')],null))[_0x645d('0x27')](respondWithResult(_0x255333,null))['catch'](handleError(_0x255333,null));};exports[_0x645d('0x28')]=function(_0x239d86,_0x5a1473){return db[_0x645d('0x50')]['find']({'where':{'id':_0x239d86['params']['id']}})[_0x645d('0x27')](handleEntityNotFound(_0x5a1473,null))[_0x645d('0x27')](removeEntity(_0x5a1473,null))['catch'](handleError(_0x5a1473,null));};exports[_0x645d('0x5a')]=function(_0x5df7b2,_0x41fda4,_0x28d509){return db[_0x645d('0x50')]['findOne']({'where':{'id':_0x5df7b2[_0x645d('0x49')]['id']}})[_0x645d('0x27')](handleEntityNotFound(_0x41fda4,null))[_0x645d('0x27')](function(_0x3cdb00){if(!_0x5df7b2[_0x645d('0x36')][_0x645d('0x5b')]||!utils['isValidChannel'](_0x5df7b2[_0x645d('0x36')][_0x645d('0x5b')])){throw new db['Sequelize'][(_0x645d('0x5c'))](_0x645d('0x5d'));}var _0x3570c7={};var _0x1030db={};_0x1030db[_0x645d('0x38')]=_['keys'](db[_['capitalize'](_0x5df7b2[_0x645d('0x36')]['channel'][_0x645d('0x5e')]())+_0x645d('0x5f')][_0x645d('0x33')]);_0x1030db[_0x645d('0x36')]=_['keys'](_0x5df7b2[_0x645d('0x36')]);_0x1030db[_0x645d('0x40')]=_['intersection'](_0x1030db[_0x645d('0x38')],_0x1030db[_0x645d('0x36')]);_0x3570c7[_0x645d('0x3a')]=_[_0x645d('0x37')](_0x1030db[_0x645d('0x38')],qs['fields'](_0x5df7b2[_0x645d('0x36')]['fields']));_0x3570c7[_0x645d('0x3a')]=_0x3570c7[_0x645d('0x3a')][_0x645d('0x4b')]?_0x3570c7[_0x645d('0x3a')]:_0x1030db[_0x645d('0x38')];_0x3570c7[_0x645d('0x22')]=qs[_0x645d('0x22')](_0x5df7b2[_0x645d('0x36')][_0x645d('0x22')]);_0x3570c7[_0x645d('0x21')]=qs['offset'](_0x5df7b2[_0x645d('0x36')]['offset']);_0x3570c7['order']=qs['sort'](_0x5df7b2['query']['sort']);_0x3570c7[_0x645d('0x3f')]=qs[_0x645d('0x40')](_[_0x645d('0x60')](_0x5df7b2['query'],_0x1030db['filters']));_0x3570c7=_['merge']({},_0x3570c7,_0x5df7b2[_0x645d('0x44')]);return _0x3cdb00[_0x645d('0x29')+_[_0x645d('0x61')](_0x5df7b2[_0x645d('0x36')][_0x645d('0x5b')][_0x645d('0x5e')]())+'Queues'](_0x3570c7);})[_0x645d('0x27')](respondWithResult(_0x41fda4,null))[_0x645d('0x47')](handleError(_0x41fda4,null));};exports[_0x645d('0x62')]=function(_0x4fc063,_0x3abfdc,_0x4da432){return db[_0x645d('0x50')][_0x645d('0x63')]({'where':{'id':_0x4fc063[_0x645d('0x49')]['id']}})[_0x645d('0x27')](function(_0x659189){if(_0x659189){if(!_0x4fc063['body'][_0x645d('0x5b')]||!utils[_0x645d('0x64')](_0x4fc063[_0x645d('0x51')][_0x645d('0x5b')])){throw new db[(_0x645d('0x65'))][(_0x645d('0x5c'))]('Unknown\x20channel');}return _0x659189[_0x645d('0x66')+_[_0x645d('0x61')](_0x4fc063[_0x645d('0x51')]['channel'][_0x645d('0x5e')]())+_0x645d('0x67')](_0x4fc063[_0x645d('0x51')][_0x645d('0x68')]);}return null;})[_0x645d('0x27')](handleEntityNotFound(_0x3abfdc,null))[_0x645d('0x27')](respondWithStatusCode(_0x3abfdc,null))[_0x645d('0x47')](handleError(_0x3abfdc,null));};exports['removeQueues']=function(_0x2604d2,_0x190877,_0x2f1dec){return db[_0x645d('0x50')]['findOne']({'where':{'id':_0x2604d2['params']['id']}})[_0x645d('0x27')](function(_0x2ddb0e){if(_0x2ddb0e){if(!_0x2604d2[_0x645d('0x36')][_0x645d('0x5b')]||!utils[_0x645d('0x64')](_0x2604d2[_0x645d('0x36')][_0x645d('0x5b')])){throw new db[(_0x645d('0x65'))][(_0x645d('0x5c'))](_0x645d('0x5d'));}return _0x2ddb0e['remove'+_[_0x645d('0x61')](_0x2604d2[_0x645d('0x36')][_0x645d('0x5b')][_0x645d('0x5e')]())+'Queues'](_0x2604d2[_0x645d('0x36')][_0x645d('0x68')]);}return null;})[_0x645d('0x27')](handleEntityNotFound(_0x190877,null))[_0x645d('0x27')](respondWithStatusCode(_0x190877,null))[_0x645d('0x47')](handleError(_0x190877,null));};exports[_0x645d('0x69')]=function(_0x46cf10,_0x29cf7a){return db['Team'][_0x645d('0x4e')]({'where':{'id':_0x46cf10['params']['id']}})[_0x645d('0x27')](handleEntityNotFound(_0x29cf7a,null))[_0x645d('0x27')](function(_0x59907e){if(_0x59907e){var _0x176752=['Voice',_0x645d('0x6a'),'Mail',_0x645d('0x6b'),_0x645d('0x6c'),_0x645d('0x6d'),'Whatsapp'];return db[_0x645d('0x6e')][_0x645d('0x6f')](function(_0x134179){var _0x321d3a=_[_0x645d('0x32')](_0x176752,function(_0xdd0aeb){var _0x5b413b={'attributes':['id',_0x645d('0x2f')]};if(_0xdd0aeb===_0x645d('0x70')){_0x5b413b['through']={'attributes':[_0x645d('0x71')]};}return _0x59907e[_0x645d('0x29')+_0xdd0aeb+_0x645d('0x67')](_0x5b413b)[_0x645d('0x27')](function(_0x47102e){var _0x3d35dd=_[_0x645d('0x32')](_0x47102e,function(_0x31e498){var _0xc38a65=_[_0x645d('0x32')](_0x46cf10['body']['ids'],function(_0x11a905){var _0x57120c={'where':{'UserId':_0x11a905,[_0xdd0aeb+_0x645d('0x72')]:_0x31e498['id']},'transaction':_0x134179};if(_0xdd0aeb==='Voice'){_0x57120c[_0x645d('0x18')]={'penalty':_0x31e498[_0x645d('0x73')][_0x645d('0x71')]};}return db[_0x645d('0x74')+_0xdd0aeb+'Queue']['findOrCreate'](_0x57120c)[_0x645d('0x27')](function(){socket['emit'](_0x645d('0x52')+_0xdd0aeb+_0x645d('0x75'),{'UserId':_0x11a905,[_0xdd0aeb+_0x645d('0x72')]:_0x31e498['id']});if(_0xdd0aeb!==_0x645d('0x70'))return;return db['User']['findAll']({'where':{'id':_0x46cf10[_0x645d('0x51')][_0x645d('0x68')],'online':0x1},'attributes':['id',_0x645d('0x2f'),_0x645d('0x76'),'voicePause',_0x645d('0x77')],'raw':!![]})[_0x645d('0x27')](function(_0x23ebe2){var _0x20ef8e=_['map'](_0x23ebe2,function(_0x38ca0a){return db['UserVoiceQueueRt'][_0x645d('0x78')]({'membername':_0x38ca0a[_0x645d('0x2f')],'UserId':_0x38ca0a['id'],'queue_name':_0x31e498[_0x645d('0x2f')],'VoiceQueueId':_0x31e498['id'],'interface':_[_0x645d('0x79')](_0x38ca0a[_0x645d('0x77')])?util['format'](_0x645d('0x7a'),_0x38ca0a[_0x645d('0x2f')]):_0x38ca0a[_0x645d('0x77')],'paused':_0x38ca0a[_0x645d('0x7b')]||![],'penalty':_0x31e498['TeamVoiceQueue'][_0x645d('0x71')]},{'transaction':_0x134179});});return Promise[_0x645d('0x7c')](_0x20ef8e);});});});return Promise[_0x645d('0x7c')](_0xc38a65);});return Promise[_0x645d('0x7c')](_0x3d35dd);})[_0x645d('0x27')](function(){var _0x2e08a0=JSON[_0x645d('0x7d')]('['+_0x46cf10[_0x645d('0x51')]['ids']+']');db['TeamVoicePrefix'][_0x645d('0x63')]({'where':{'teamId':_0x46cf10[_0x645d('0x49')]['id']}})[_0x645d('0x27')](function(_0x42d34a){if(_0x42d34a){for(var _0x13e81e=0x0;_0x13e81e<_0x2e08a0[_0x645d('0x4b')];_0x13e81e++){var _0xb3dcbd=_0x2e08a0[_0x13e81e];db['UserVoicePrefix'][_0x645d('0x78')]({'UserId':_0xb3dcbd,'VoicePrefixId':_0x42d34a[_0x645d('0x7e')]});}}});});});return Promise[_0x645d('0x7c')](_0x321d3a)['then'](function(){return _0x59907e[_0x645d('0x69')](_0x46cf10[_0x645d('0x51')][_0x645d('0x68')],{'transaction':_0x134179})[_0x645d('0x7f')](function(_0x338cc0){return _0x338cc0;});});});}})['then'](respondWithResult(_0x29cf7a,null))['catch'](handleError(_0x29cf7a,null));};exports['removeAgents']=function(_0x4a4c50,_0x4b07c5){return db[_0x645d('0x50')][_0x645d('0x4e')]({'where':{'id':_0x4a4c50[_0x645d('0x49')]['id']}})[_0x645d('0x27')](handleEntityNotFound(_0x4b07c5,null))['then'](function(_0x3eaa83){if(_0x3eaa83){var _0x1430c8=['Voice','Chat',_0x645d('0x80'),'Sms',_0x645d('0x6c'),'Openchannel',_0x645d('0x81')];return db[_0x645d('0x6e')]['transaction'](function(_0x2835f9){var _0xa35c02=_[_0x645d('0x32')](_0x1430c8,function(_0x37322b){var _0x383c8f={'attributes':['id',_0x645d('0x2f')]};return _0x3eaa83[_0x645d('0x29')+_0x37322b+_0x645d('0x67')](_0x383c8f)[_0x645d('0x27')](function(_0x208fb0){var _0x58698b=_[_0x645d('0x32')](_0x208fb0,function(_0x32f51e){return _0x32f51e[_0x645d('0x82')](_0x4a4c50[_0x645d('0x36')][_0x645d('0x68')],{'transaction':_0x2835f9})['then'](function(){var _0x39d59=JSON[_0x645d('0x7d')]('['+_0x4a4c50[_0x645d('0x36')][_0x645d('0x68')]+']');var _0xac5af1=_['map'](_0x39d59,function(_0x283be5){socket[_0x645d('0x83')]('user'+_0x37322b+_0x645d('0x84'),{'UserId':Number(_0x283be5),[_0x37322b+_0x645d('0x72')]:_0x32f51e['id']});if(_0x37322b!==_0x645d('0x70'))return;return db['UserVoiceQueueRt'][_0x645d('0x28')]({'where':{'VoiceQueueId':_0x32f51e['id'],'UserId':_0x283be5},'transaction':_0x2835f9});});return Promise['all'](_0xac5af1);});});return Promise[_0x645d('0x7c')](_0x58698b);});});return Promise[_0x645d('0x7c')](_0xa35c02)['then'](function(){return _0x3eaa83[_0x645d('0x82')](_0x4a4c50['query']['ids'],{'transaction':_0x2835f9});})[_0x645d('0x27')](function(){var _0x3995b2=JSON['parse']('['+_0x4a4c50[_0x645d('0x36')][_0x645d('0x68')]+']');db['TeamVoicePrefix'][_0x645d('0x63')]({'where':{'teamId':_0x4a4c50[_0x645d('0x49')]['id']}})['then'](function(_0x39c613){if(_0x39c613){for(var _0x6b257b=0x0;_0x6b257b<_0x3995b2[_0x645d('0x4b')];_0x6b257b++){var _0x2e1242=_0x3995b2[_0x6b257b];db[_0x645d('0x85')][_0x645d('0x28')]({'where':{'UserId':_0x2e1242,'VoicePrefixId':_0x39c613['VoicePrefixId']}});}}});});});}})['then'](respondWithStatusCode(_0x4b07c5,null))[_0x645d('0x47')](handleError(_0x4b07c5,null));};exports['getAgents']=function(_0x1fc006,_0x26bb8f,_0x25f399){var _0xedc183={};var _0x5e73aa={};var _0x3130b1;var _0x3390a1;return db[_0x645d('0x50')][_0x645d('0x63')]({'where':{'id':_0x1fc006[_0x645d('0x49')]['id']}})[_0x645d('0x27')](handleEntityNotFound(_0x26bb8f,null))[_0x645d('0x27')](function(_0x413a9b){if(_0x413a9b){_0x3130b1=_0x413a9b;_0x5e73aa['model']=_[_0x645d('0x4a')](db[_0x645d('0x74')][_0x645d('0x33')]);_0x5e73aa['query']=_[_0x645d('0x4a')](_0x1fc006['query']);_0x5e73aa[_0x645d('0x40')]=_['intersection'](_0x5e73aa[_0x645d('0x38')],_0x5e73aa['query']);_0xedc183['attributes']=_[_0x645d('0x37')](_0x5e73aa[_0x645d('0x38')],qs[_0x645d('0x39')](_0x1fc006[_0x645d('0x36')]['fields']));_0xedc183[_0x645d('0x3a')]=_0xedc183[_0x645d('0x3a')][_0x645d('0x4b')]?_0xedc183[_0x645d('0x3a')]:_0x5e73aa[_0x645d('0x38')];_0xedc183[_0x645d('0x3d')]=qs['sort'](_0x1fc006[_0x645d('0x36')][_0x645d('0x3e')]);_0xedc183['where']=qs['filters'](_[_0x645d('0x60')](_0x1fc006[_0x645d('0x36')],_0x5e73aa[_0x645d('0x40')]));if(_0x1fc006[_0x645d('0x36')]['filter']){_0xedc183['where']=_[_0x645d('0x42')](_0xedc183[_0x645d('0x3f')],{'$or':_[_0x645d('0x32')](_0xedc183[_0x645d('0x3a')],function(_0x504cf5){var _0x4715f0={};_0x4715f0[_0x504cf5]={'$like':'%'+_0x1fc006['query'][_0x645d('0x41')]+'%'};return _0x4715f0;})});}_0xedc183=_['merge']({},_0xedc183,_0x1fc006[_0x645d('0x44')]);return _0x3130b1[_0x645d('0x86')](_0xedc183);}})[_0x645d('0x27')](function(_0x34430f){if(_0x34430f){_0x3390a1=_0x34430f[_0x645d('0x4b')];if(!_0x1fc006[_0x645d('0x36')][_0x645d('0x3b')]('nolimit')){_0xedc183[_0x645d('0x22')]=qs[_0x645d('0x22')](_0x1fc006[_0x645d('0x36')][_0x645d('0x22')]);_0xedc183[_0x645d('0x21')]=qs[_0x645d('0x21')](_0x1fc006[_0x645d('0x36')][_0x645d('0x21')]);}return _0x3130b1[_0x645d('0x86')](_0xedc183);}})[_0x645d('0x27')](function(_0x2d9d86){if(_0x2d9d86){return _0x2d9d86?{'count':_0x3390a1,'rows':_0x2d9d86}:null;}})[_0x645d('0x27')](respondWithResult(_0x26bb8f,null))[_0x645d('0x47')](handleError(_0x26bb8f,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index d7b2801..66d7b58 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 _0x8257=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','Team','setMaxListeners'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x8257,0x15b));var _0x7825=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0x8257[_0x1dd532];return _0x3732aa;};'use strict';var EventEmitter=require(_0x7825('0x0'));var Team=require(_0x7825('0x1'))['db'][_0x7825('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x7825('0x3')](0x0);var events={'afterCreate':_0x7825('0x4'),'afterUpdate':_0x7825('0x5'),'afterDestroy':_0x7825('0x6')};function emitEvent(_0x1bb176){return function(_0x42717d,_0x314682,_0x2d309c){TeamEvents['emit'](_0x1bb176+':'+_0x42717d['id'],_0x42717d);TeamEvents[_0x7825('0x7')](_0x1bb176,_0x42717d);_0x2d309c(null);};}for(var e in events){if(events[_0x7825('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x570a=['exports','Team','setMaxListeners','update','remove','emit','hook'];(function(_0x29d705,_0x7f11ef){var _0x54dc0e=function(_0x4b002e){while(--_0x4b002e){_0x29d705['push'](_0x29d705['shift']());}};_0x54dc0e(++_0x7f11ef);}(_0x570a,0x104));var _0xa570=function(_0x27c8be,_0x6d9118){_0x27c8be=_0x27c8be-0x0;var _0x49de1c=_0x570a[_0x27c8be];return _0x49de1c;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0xa570('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0xa570('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa570('0x2'),'afterDestroy':_0xa570('0x3')};function emitEvent(_0x41fa70){return function(_0x3cdd38,_0x23f3bc,_0x35ee0b){TeamEvents[_0xa570('0x4')](_0x41fa70+':'+_0x3cdd38['id'],_0x3cdd38);TeamEvents[_0xa570('0x4')](_0x41fa70,_0x3cdd38);_0x35ee0b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xa570('0x5')](e,emitEvent(event));}}module[_0xa570('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 e0349d7..bf55b0c 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 _0x826b=['path','rimraf','../../config/environment','exports','define','Team','lodash','../../config/logger','api','request-promise'];(function(_0xdc7d3c,_0x1c6f4e){var _0x249b37=function(_0x3d9007){while(--_0x3d9007){_0xdc7d3c['push'](_0xdc7d3c['shift']());}};_0x249b37(++_0x1c6f4e);}(_0x826b,0x15a));var _0xb826=function(_0x49ef34,_0x2146b8){_0x49ef34=_0x49ef34-0x0;var _0x2cafa8=_0x826b[_0x49ef34];return _0x2cafa8;};'use strict';var _=require(_0xb826('0x0'));var util=require('util');var logger=require(_0xb826('0x1'))(_0xb826('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb826('0x3'));var fs=require('fs');var path=require(_0xb826('0x4'));var rimraf=require(_0xb826('0x5'));var config=require(_0xb826('0x6'));var attributes=require('./team.attributes');module[_0xb826('0x7')]=function(_0x43f90e,_0x3f1660){return _0x43f90e[_0xb826('0x8')](_0xb826('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1606=['exports','define','Team','teams','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x284da5,_0x58a5ee){var _0x36be98=function(_0x164326){while(--_0x164326){_0x284da5['push'](_0x284da5['shift']());}};_0x36be98(++_0x58a5ee);}(_0x1606,0x1d8));var _0x6160=function(_0x5c4b4b,_0x87a94){_0x5c4b4b=_0x5c4b4b-0x0;var _0x1d39a4=_0x1606[_0x5c4b4b];return _0x1d39a4;};'use strict';var _=require(_0x6160('0x0'));var util=require(_0x6160('0x1'));var logger=require(_0x6160('0x2'))(_0x6160('0x3'));var moment=require(_0x6160('0x4'));var BPromise=require(_0x6160('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6160('0x6'));var rimraf=require(_0x6160('0x7'));var config=require(_0x6160('0x8'));var attributes=require('./team.attributes');module[_0x6160('0x9')]=function(_0x355630,_0xe7ea90){return _0x355630[_0x6160('0xa')](_0x6160('0xb'),attributes,{'tableName':_0x6160('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 720d4d9..1434f18 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 _0x3533=['./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter'];(function(_0x24358a,_0x5bd61a){var _0x2fa140=function(_0x2dd1f1){while(--_0x2dd1f1){_0x24358a['push'](_0x24358a['shift']());}};_0x2fa140(++_0x5bd61a);}(_0x3533,0x6c));var _0x3353=function(_0xdc9390,_0x2c102f){_0xdc9390=_0xdc9390-0x0;var _0x2c28ff=_0x3533[_0xdc9390];return _0x2c28ff;};'use strict';var _=require('lodash');var util=require(_0x3353('0x0'));var moment=require(_0x3353('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3353('0x2'))['db'];var utils=require(_0x3353('0x3'));var logger=require(_0x3353('0x4'))(_0x3353('0x5'));var config=require(_0x3353('0x6'));var jayson=require(_0x3353('0x7'));var client=jayson[_0x3353('0x8')]['http']({'port':0x232a});config[_0x3353('0x9')]=_[_0x3353('0xa')](config[_0x3353('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3353('0xb'))(new Redis(config[_0x3353('0x9')]));require(_0x3353('0xc'))[_0x3353('0xd')](socket);function respondWithRpcPromise(_0x3be479,_0xa91d98,_0x5148dd){return new BPromise(function(_0x3315e1,_0x351d13){return client['request'](_0x3be479,_0x5148dd)[_0x3353('0xe')](function(_0x3e3299){logger[_0x3353('0xf')](_0x3353('0x10'),_0xa91d98,_0x3353('0x11'));logger['debug'](_0x3353('0x12'),_0xa91d98,_0x3353('0x11'),JSON['stringify'](_0x3e3299));if(_0x3e3299[_0x3353('0x13')]){if(_0x3e3299['error'][_0x3353('0x14')]===0x1f4){logger[_0x3353('0x13')]('Team,\x20%s,\x20%s',_0xa91d98,_0x3e3299[_0x3353('0x13')]['message']);return _0x351d13(_0x3e3299[_0x3353('0x13')][_0x3353('0x15')]);}logger[_0x3353('0x13')](_0x3353('0x10'),_0xa91d98,_0x3e3299[_0x3353('0x13')]['message']);return _0x3315e1(_0x3e3299[_0x3353('0x13')]['message']);}else{logger['info'](_0x3353('0x10'),_0xa91d98,_0x3353('0x11'));_0x3315e1(_0x3e3299[_0x3353('0x16')]['message']);}})[_0x3353('0x17')](function(_0x192cd3){logger[_0x3353('0x13')](_0x3353('0x10'),_0xa91d98,_0x192cd3);_0x351d13(_0x192cd3);});});} \ No newline at end of file +var _0xa96b=['bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x1ce20c,_0x42d6c5){var _0x5a38b5=function(_0xd6585b){while(--_0xd6585b){_0x1ce20c['push'](_0x1ce20c['shift']());}};_0x5a38b5(++_0x42d6c5);}(_0xa96b,0x19e));var _0xba96=function(_0x55f5d7,_0x178e01){_0x55f5d7=_0x55f5d7-0x0;var _0x3bbba9=_0xa96b[_0x55f5d7];return _0x3bbba9;};'use strict';var _=require(_0xba96('0x0'));var util=require(_0xba96('0x1'));var moment=require('moment');var BPromise=require(_0xba96('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba96('0x3'));var db=require(_0xba96('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xba96('0x5'))('rpc');var config=require(_0xba96('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xba96('0x7')][_0xba96('0x8')]({'port':0x232a});config[_0xba96('0x9')]=_['defaults'](config[_0xba96('0x9')],{'host':_0xba96('0xa'),'port':0x18eb});var socket=require(_0xba96('0xb'))(new Redis(config[_0xba96('0x9')]));require(_0xba96('0xc'))[_0xba96('0xd')](socket);function respondWithRpcPromise(_0x26a487,_0xc86a1c,_0x4c8d44){return new BPromise(function(_0x55d4dc,_0x4a9089){return client[_0xba96('0xe')](_0x26a487,_0x4c8d44)[_0xba96('0xf')](function(_0xac050f){logger['info'](_0xba96('0x10'),_0xc86a1c,_0xba96('0x11'));logger['debug'](_0xba96('0x12'),_0xc86a1c,_0xba96('0x11'),JSON[_0xba96('0x13')](_0xac050f));if(_0xac050f['error']){if(_0xac050f[_0xba96('0x14')][_0xba96('0x15')]===0x1f4){logger['error'](_0xba96('0x10'),_0xc86a1c,_0xac050f[_0xba96('0x14')]['message']);return _0x4a9089(_0xac050f[_0xba96('0x14')][_0xba96('0x16')]);}logger[_0xba96('0x14')](_0xba96('0x10'),_0xc86a1c,_0xac050f[_0xba96('0x14')]['message']);return _0x55d4dc(_0xac050f[_0xba96('0x14')][_0xba96('0x16')]);}else{logger[_0xba96('0x17')](_0xba96('0x10'),_0xc86a1c,'request\x20sent');_0x55d4dc(_0xac050f[_0xba96('0x18')]['message']);}})[_0xba96('0x19')](function(_0x39aef6){logger[_0xba96('0x14')](_0xba96('0x10'),_0xc86a1c,_0x39aef6);_0x4a9089(_0x39aef6);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 23e62cd..3c450fc 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 _0xf150=['removeListener','register','length','./team.events','save','remove','emit'];(function(_0x2c851f,_0x43a758){var _0x57b529=function(_0x32f262){while(--_0x32f262){_0x2c851f['push'](_0x2c851f['shift']());}};_0x57b529(++_0x43a758);}(_0xf150,0x106));var _0x0f15=function(_0x54ffb5,_0x4ec3b5){_0x54ffb5=_0x54ffb5-0x0;var _0x3e6be3=_0xf150[_0x54ffb5];return _0x3e6be3;};'use strict';var TeamEvents=require(_0x0f15('0x0'));var events=[_0x0f15('0x1'),_0x0f15('0x2'),'update'];function createListener(_0x8dac99,_0x3a7b85){return function(_0xfb631c){_0x3a7b85[_0x0f15('0x3')](_0x8dac99,_0xfb631c);};}function removeListener(_0x2d4deb,_0x45e819){return function(){TeamEvents[_0x0f15('0x4')](_0x2d4deb,_0x45e819);};}exports[_0x0f15('0x5')]=function(_0x55717b){for(var _0x4c3c3d=0x0,_0x1d8a90=events[_0x0f15('0x6')];_0x4c3c3d<_0x1d8a90;_0x4c3c3d++){var _0x2c603d=events[_0x4c3c3d];var _0x3928e2=createListener('team:'+_0x2c603d,_0x55717b);TeamEvents['on'](_0x2c603d,_0x3928e2);}}; \ No newline at end of file +var _0xe730=['length','team:','./team.events','save','remove','update','removeListener','register'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0xe730,0xf2));var _0x0e73=function(_0x469862,_0x338e7e){_0x469862=_0x469862-0x0;var _0x2932a0=_0xe730[_0x469862];return _0x2932a0;};'use strict';var TeamEvents=require(_0x0e73('0x0'));var events=[_0x0e73('0x1'),_0x0e73('0x2'),_0x0e73('0x3')];function createListener(_0x1fc2c3,_0xeab993){return function(_0x5c46c1){_0xeab993['emit'](_0x1fc2c3,_0x5c46c1);};}function removeListener(_0x7b553,_0x126201){return function(){TeamEvents[_0x0e73('0x4')](_0x7b553,_0x126201);};}exports[_0x0e73('0x5')]=function(_0xf2384b){for(var _0xa6d3e8=0x0,_0x379bb2=events[_0x0e73('0x6')];_0xa6d3e8<_0x379bb2;_0xa6d3e8++){var _0x109c42=events[_0xa6d3e8];var _0x18c043=createListener(_0x0e73('0x7')+_0x109c42,_0xf2384b);TeamEvents['on'](_0x109c42,_0x18c043);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/index.js b/server/api/teamVoicePrefix/index.js index 3f50ba6..b6a5e1d 100644 --- a/server/api/teamVoicePrefix/index.js +++ b/server/api/teamVoicePrefix/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2bbc8c,_0x3ecd37){var _0x2de871=function(_0x4ae0b1){while(--_0x4ae0b1){_0x2bbc8c['push'](_0x2bbc8c['shift']());}};_0x2de871(++_0x3ecd37);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0xcb91[_0x378b4];return _0x11d07b;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x38b7e8,_0x38b739){var _0x300e6e=function(_0x1fcd5e){while(--_0x1fcd5e){_0x38b7e8['push'](_0x38b7e8['shift']());}};_0x300e6e(++_0x38b739);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0xcb91[_0x35fabd];return _0x61a8ee;};'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/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 9cacb62..516dffc 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 _0xbf02=['INTEGER','sequelize','exports'];(function(_0x16de8f,_0x486994){var _0x545a7b=function(_0x41cead){while(--_0x41cead){_0x16de8f['push'](_0x16de8f['shift']());}};_0x545a7b(++_0x486994);}(_0xbf02,0x139));var _0x2bf0=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xbf02[_0x2dadb9];return _0x2f0097;};'use strict';var Sequelize=require(_0x2bf0('0x0'));module[_0x2bf0('0x1')]={'TeamId':{'type':Sequelize[_0x2bf0('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x2bf0('0x2')]}}; \ No newline at end of file +var _0x6b1c=['INTEGER','sequelize'];(function(_0x581126,_0x1dbe32){var _0x87f92f=function(_0x131cb9){while(--_0x131cb9){_0x581126['push'](_0x581126['shift']());}};_0x87f92f(++_0x1dbe32);}(_0x6b1c,0xf3));var _0xc6b1=function(_0x138f30,_0x28b343){_0x138f30=_0x138f30-0x0;var _0x363b58=_0x6b1c[_0x138f30];return _0x363b58;};'use strict';var Sequelize=require(_0xc6b1('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xc6b1('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xc6b1('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 90c752e..d04d527 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 _0x88c3=['../../config/logger','bluebird','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x2b7c23,_0x439863){var _0x5b8f82=function(_0x53b762){while(--_0x53b762){_0x2b7c23['push'](_0x2b7c23['shift']());}};_0x5b8f82(++_0x439863);}(_0x88c3,0x1ee));var _0x388c=function(_0x4475c9,_0xc98b93){_0x4475c9=_0x4475c9-0x0;var _0xc90b0d=_0x88c3[_0x4475c9];return _0xc90b0d;};'use strict';var _=require(_0x388c('0x0'));var util=require('util');var logger=require(_0x388c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x388c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x388c('0x3'));var config=require(_0x388c('0x4'));var attributes=require(_0x388c('0x5'));module[_0x388c('0x6')]=function(_0x28ed4d,_0x23199c){return _0x28ed4d['define'](_0x388c('0x7'),attributes,{'tableName':_0x388c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f59=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','define','lodash'];(function(_0x1ef700,_0x1e3f8b){var _0x3ce59b=function(_0x5c432d){while(--_0x5c432d){_0x1ef700['push'](_0x1ef700['shift']());}};_0x3ce59b(++_0x1e3f8b);}(_0x8f59,0x11d));var _0x98f5=function(_0x19cd2a,_0x52bf9e){_0x19cd2a=_0x19cd2a-0x0;var _0x41f8b7=_0x8f59[_0x19cd2a];return _0x41f8b7;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var logger=require(_0x98f5('0x2'))(_0x98f5('0x3'));var moment=require(_0x98f5('0x4'));var BPromise=require(_0x98f5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98f5('0x6'));var rimraf=require(_0x98f5('0x7'));var config=require(_0x98f5('0x8'));var attributes=require(_0x98f5('0x9'));module['exports']=function(_0xdcce7a,_0x358618){return _0xdcce7a[_0x98f5('0xa')]('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js b/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js index 8bbec0d..62ec30f 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c7d=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','TeamVoicePrefix,\x20%s,\x20%s','request\x20sent','debug','TeamVoicePrefix,\x20%s,\x20%s,\x20%s','code'];(function(_0x533bcc,_0x1ba26f){var _0x364d38=function(_0xeec8d4){while(--_0xeec8d4){_0x533bcc['push'](_0x533bcc['shift']());}};_0x364d38(++_0x1ba26f);}(_0x8c7d,0x164));var _0xd8c7=function(_0x4e5d31,_0x44b4db){_0x4e5d31=_0x4e5d31-0x0;var _0x4c4aa0=_0x8c7d[_0x4e5d31];return _0x4c4aa0;};'use strict';var _=require(_0xd8c7('0x0'));var util=require('util');var moment=require(_0xd8c7('0x1'));var BPromise=require(_0xd8c7('0x2'));var rs=require(_0xd8c7('0x3'));var fs=require('fs');var Redis=require(_0xd8c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8c7('0x5'));var logger=require(_0xd8c7('0x6'))(_0xd8c7('0x7'));var config=require(_0xd8c7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd8c7('0x9')][_0xd8c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22cb6d,_0x362d93,_0x31d4fb){return new BPromise(function(_0x3c31b0,_0x424a2a){return client[_0xd8c7('0xb')](_0x22cb6d,_0x31d4fb)['then'](function(_0x5897f0){logger[_0xd8c7('0xc')](_0xd8c7('0xd'),_0x362d93,_0xd8c7('0xe'));logger[_0xd8c7('0xf')](_0xd8c7('0x10'),_0x362d93,_0xd8c7('0xe'),JSON['stringify'](_0x5897f0));if(_0x5897f0['error']){if(_0x5897f0['error'][_0xd8c7('0x11')]===0x1f4){logger[_0xd8c7('0x12')](_0xd8c7('0xd'),_0x362d93,_0x5897f0[_0xd8c7('0x12')][_0xd8c7('0x13')]);return _0x424a2a(_0x5897f0[_0xd8c7('0x12')]['message']);}logger[_0xd8c7('0x12')](_0xd8c7('0xd'),_0x362d93,_0x5897f0[_0xd8c7('0x12')][_0xd8c7('0x13')]);return _0x3c31b0(_0x5897f0[_0xd8c7('0x12')][_0xd8c7('0x13')]);}else{logger[_0xd8c7('0xc')](_0xd8c7('0xd'),_0x362d93,_0xd8c7('0xe'));_0x3c31b0(_0x5897f0[_0xd8c7('0x14')][_0xd8c7('0x13')]);}})[_0xd8c7('0x15')](function(_0x5df2c6){logger[_0xd8c7('0x12')](_0xd8c7('0xd'),_0x362d93,_0x5df2c6);_0x424a2a(_0x5df2c6);});});} \ No newline at end of file +var _0x77f6=['then','info','TeamVoicePrefix,\x20%s,\x20%s','request\x20sent','TeamVoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x77f6,0x81));var _0x677f=function(_0x4a47e7,_0x111d41){_0x4a47e7=_0x4a47e7-0x0;var _0xe1d3f2=_0x77f6[_0x4a47e7];return _0xe1d3f2;};'use strict';var _=require(_0x677f('0x0'));var util=require(_0x677f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x677f('0x2'));var fs=require('fs');var Redis=require(_0x677f('0x3'));var db=require(_0x677f('0x4'))['db'];var utils=require(_0x677f('0x5'));var logger=require(_0x677f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x677f('0x7'));var client=jayson[_0x677f('0x8')][_0x677f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a553b,_0x127857,_0x1677d8){return new BPromise(function(_0x1c1d91,_0x5342af){return client[_0x677f('0xa')](_0x4a553b,_0x1677d8)[_0x677f('0xb')](function(_0xf6329d){logger[_0x677f('0xc')](_0x677f('0xd'),_0x127857,_0x677f('0xe'));logger['debug'](_0x677f('0xf'),_0x127857,_0x677f('0xe'),JSON[_0x677f('0x10')](_0xf6329d));if(_0xf6329d['error']){if(_0xf6329d[_0x677f('0x11')]['code']===0x1f4){logger[_0x677f('0x11')](_0x677f('0xd'),_0x127857,_0xf6329d[_0x677f('0x11')][_0x677f('0x12')]);return _0x5342af(_0xf6329d[_0x677f('0x11')]['message']);}logger[_0x677f('0x11')]('TeamVoicePrefix,\x20%s,\x20%s',_0x127857,_0xf6329d[_0x677f('0x11')][_0x677f('0x12')]);return _0x1c1d91(_0xf6329d[_0x677f('0x11')][_0x677f('0x12')]);}else{logger[_0x677f('0xc')](_0x677f('0xd'),_0x127857,'request\x20sent');_0x1c1d91(_0xf6329d[_0x677f('0x13')][_0x677f('0x12')]);}})['catch'](function(_0x2bdeea){logger[_0x677f('0x11')](_0x677f('0xd'),_0x127857,_0x2bdeea);_0x5342af(_0x2bdeea);});});} \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 5638046..13c9f1d 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x15cc0e,_0xd52b89){var _0x51c6c8=function(_0x220bd1){while(--_0x220bd1){_0x15cc0e['push'](_0x15cc0e['shift']());}};_0x51c6c8(++_0xd52b89);}(_0xe706,0xa3));var _0x6e70=function(_0x419715,_0x221336){_0x419715=_0x419715-0x0;var _0x274fbd=_0xe706[_0x419715];return _0x274fbd;};'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(_0x3c3ec7,_0x309339){var _0x23e52c=function(_0x34cd19){while(--_0x34cd19){_0x3c3ec7['push'](_0x3c3ec7['shift']());}};_0x23e52c(++_0x309339);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index f66ffd5..8e55077 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 _0xc853=['sequelize','INTEGER'];(function(_0x52a8da,_0x5d9213){var _0x5e9460=function(_0x191193){while(--_0x191193){_0x52a8da['push'](_0x52a8da['shift']());}};_0x5e9460(++_0x5d9213);}(_0xc853,0x1c6));var _0x3c85=function(_0x34a597,_0x339ddc){_0x34a597=_0x34a597-0x0;var _0x35531f=_0xc853[_0x34a597];return _0x35531f;};'use strict';var Sequelize=require(_0x3c85('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3c85('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb144=['sequelize'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0xb144,0x146));var _0x4b14=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb144[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x4b14('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 ed0814b..2938a92 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 _0xe5b3=['request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','util','../../config/logger','api','moment','bluebird'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2c5b18,_0x580447){_0x2c5b18=_0x2c5b18-0x0;var _0x562362=_0xe5b3[_0x2c5b18];return _0x562362;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var fs=require('fs');var path=require(_0x3e5b('0x6'));var rimraf=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var attributes=require(_0x3e5b('0x9'));module[_0x3e5b('0xa')]=function(_0x54e1fb,_0x174923){return _0x54e1fb[_0x3e5b('0xb')]('TeamVoiceQueue',attributes,{'tableName':_0x3e5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d6d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger'];(function(_0xc197eb,_0x35dc61){var _0x4be264=function(_0x5dd38a){while(--_0x5dd38a){_0xc197eb['push'](_0xc197eb['shift']());}};_0x4be264(++_0x35dc61);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x25a787,_0x6926e7){_0x25a787=_0x25a787-0x0;var _0x37712a=_0x3d6d[_0x25a787];return _0x37712a;};'use strict';var _=require(_0xd3d6('0x0'));var util=require(_0xd3d6('0x1'));var logger=require(_0xd3d6('0x2'))(_0xd3d6('0x3'));var moment=require(_0xd3d6('0x4'));var BPromise=require(_0xd3d6('0x5'));var rp=require(_0xd3d6('0x6'));var fs=require('fs');var path=require(_0xd3d6('0x7'));var rimraf=require(_0xd3d6('0x8'));var config=require(_0xd3d6('0x9'));var attributes=require(_0xd3d6('0xa'));module['exports']=function(_0x5400f8,_0x3f36){return _0x5400f8[_0xd3d6('0xb')](_0xd3d6('0xc'),attributes,{'tableName':_0xd3d6('0xd'),'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 6aa443f..5df974f 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 _0x2c50=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5d6e35,_0x4d1ac0){var _0x5d7ada=function(_0x2f7dd3){while(--_0x2f7dd3){_0x5d6e35['push'](_0x5d6e35['shift']());}};_0x5d7ada(++_0x4d1ac0);}(_0x2c50,0xa8));var _0x02c5=function(_0x2e76a7,_0x23871a){_0x2e76a7=_0x2e76a7-0x0;var _0x454cde=_0x2c50[_0x2e76a7];return _0x454cde;};'use strict';var _=require(_0x02c5('0x0'));var util=require('util');var moment=require(_0x02c5('0x1'));var BPromise=require(_0x02c5('0x2'));var rs=require(_0x02c5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02c5('0x4'))['db'];var utils=require(_0x02c5('0x5'));var logger=require(_0x02c5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x02c5('0x7'));var client=jayson[_0x02c5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ebe4d,_0x57a5c3,_0x1dedfb){return new BPromise(function(_0x55f62d,_0x5de4ab){return client['request'](_0x5ebe4d,_0x1dedfb)[_0x02c5('0x9')](function(_0x513e5a){logger[_0x02c5('0xa')](_0x02c5('0xb'),_0x57a5c3,_0x02c5('0xc'));logger[_0x02c5('0xd')](_0x02c5('0xe'),_0x57a5c3,_0x02c5('0xc'),JSON[_0x02c5('0xf')](_0x513e5a));if(_0x513e5a['error']){if(_0x513e5a[_0x02c5('0x10')][_0x02c5('0x11')]===0x1f4){logger[_0x02c5('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x57a5c3,_0x513e5a['error'][_0x02c5('0x12')]);return _0x5de4ab(_0x513e5a['error'][_0x02c5('0x12')]);}logger[_0x02c5('0x10')](_0x02c5('0xb'),_0x57a5c3,_0x513e5a['error'][_0x02c5('0x12')]);return _0x55f62d(_0x513e5a[_0x02c5('0x10')][_0x02c5('0x12')]);}else{logger['info'](_0x02c5('0xb'),_0x57a5c3,_0x02c5('0xc'));_0x55f62d(_0x513e5a[_0x02c5('0x13')][_0x02c5('0x12')]);}})[_0x02c5('0x14')](function(_0x161c1c){logger[_0x02c5('0x10')](_0x02c5('0xb'),_0x57a5c3,_0x161c1c);_0x5de4ab(_0x161c1c);});});} \ No newline at end of file +var _0x502a=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x502a,0xd8));var _0xa502=function(_0x149aa5,_0x467cb8){_0x149aa5=_0x149aa5-0x0;var _0x4cfb0a=_0x502a[_0x149aa5];return _0x4cfb0a;};'use strict';var _=require(_0xa502('0x0'));var util=require(_0xa502('0x1'));var moment=require('moment');var BPromise=require(_0xa502('0x2'));var rs=require(_0xa502('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa502('0x4'));var logger=require('../../config/logger')(_0xa502('0x5'));var config=require(_0xa502('0x6'));var jayson=require(_0xa502('0x7'));var client=jayson[_0xa502('0x8')][_0xa502('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x489407,_0x329022,_0x29fb03){return new BPromise(function(_0x4d30f2,_0x4e4e5d){return client[_0xa502('0xa')](_0x489407,_0x29fb03)[_0xa502('0xb')](function(_0x5251fa){logger[_0xa502('0xc')](_0xa502('0xd'),_0x329022,_0xa502('0xe'));logger['debug'](_0xa502('0xf'),_0x329022,_0xa502('0xe'),JSON[_0xa502('0x10')](_0x5251fa));if(_0x5251fa['error']){if(_0x5251fa[_0xa502('0x11')][_0xa502('0x12')]===0x1f4){logger['error'](_0xa502('0xd'),_0x329022,_0x5251fa[_0xa502('0x11')]['message']);return _0x4e4e5d(_0x5251fa[_0xa502('0x11')][_0xa502('0x13')]);}logger[_0xa502('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x329022,_0x5251fa[_0xa502('0x11')][_0xa502('0x13')]);return _0x4d30f2(_0x5251fa[_0xa502('0x11')]['message']);}else{logger[_0xa502('0xc')](_0xa502('0xd'),_0x329022,_0xa502('0xe'));_0x4d30f2(_0x5251fa[_0xa502('0x14')][_0xa502('0x13')]);}})[_0xa502('0x15')](function(_0x3107a0){logger[_0xa502('0x11')](_0xa502('0xd'),_0x329022,_0x3107a0);_0x4e4e5d(_0x3107a0);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 923b5a2..25adc03 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 _0x7880=['path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer'];(function(_0xdae845,_0x3f4dd5){var _0x55a1cc=function(_0x12b4a3){while(--_0x12b4a3){_0xdae845['push'](_0xdae845['shift']());}};_0x55a1cc(++_0x3f4dd5);}(_0x7880,0x10f));var _0x0788=function(_0x48478f,_0x537acd){_0x48478f=_0x48478f-0x0;var _0x10af50=_0x7880[_0x48478f];return _0x10af50;};'use strict';var multer=require(_0x0788('0x0'));var util=require('util');var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0788('0x6'));var controller=require('./template.controller');router[_0x0788('0x7')]('/',auth[_0x0788('0x8')](),controller[_0x0788('0x9')]);router['get'](_0x0788('0xa'),auth[_0x0788('0x8')](),controller['show']);router[_0x0788('0xb')]('/',auth[_0x0788('0x8')](),controller[_0x0788('0xc')]);router[_0x0788('0xd')](_0x0788('0xa'),auth[_0x0788('0x8')](),controller[_0x0788('0xe')]);router[_0x0788('0xf')](_0x0788('0xa'),auth[_0x0788('0x8')](),controller[_0x0788('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7bd0=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports'];(function(_0xc2fcdb,_0x5e225a){var _0x4d7af3=function(_0x56d8eb){while(--_0x56d8eb){_0xc2fcdb['push'](_0xc2fcdb['shift']());}};_0x4d7af3(++_0x5e225a);}(_0x7bd0,0x111));var _0x07bd=function(_0x15a8fa,_0x4652b2){_0x15a8fa=_0x15a8fa-0x0;var _0x1355c2=_0x7bd0[_0x15a8fa];return _0x1355c2;};'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['post']('/',auth[_0x07bd('0xb')](),controller[_0x07bd('0xf')]);router[_0x07bd('0x10')]('/:id',auth[_0x07bd('0xb')](),controller[_0x07bd('0x11')]);router[_0x07bd('0x12')](_0x07bd('0xd'),auth['isAuthenticated'](),controller[_0x07bd('0x13')]);module[_0x07bd('0x14')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index d65f1ee..28e4c9e 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 _0x4130=['TEXT','sequelize','exports','STRING'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0x4130,0x12d));var _0x0413=function(_0x33934b,_0x52f16c){_0x33934b=_0x33934b-0x0;var _0x549d62=_0x4130[_0x33934b];return _0x549d62;};'use strict';var Sequelize=require(_0x0413('0x0'));module[_0x0413('0x1')]={'name':{'type':Sequelize[_0x0413('0x2')]},'description':{'type':Sequelize[_0x0413('0x2')]},'html':{'type':Sequelize[_0x0413('0x3')]}}; \ No newline at end of file +var _0x04a3=['TEXT','sequelize','exports','STRING'];(function(_0x5de0c4,_0xacc4ce){var _0x55759a=function(_0x42e643){while(--_0x42e643){_0x5de0c4['push'](_0x5de0c4['shift']());}};_0x55759a(++_0xacc4ce);}(_0x04a3,0xb9));var _0x304a=function(_0x52b474,_0x3ca29d){_0x52b474=_0x52b474-0x0;var _0xb08603=_0x04a3[_0x52b474];return _0xb08603;};'use strict';var Sequelize=require(_0x304a('0x0'));module[_0x304a('0x1')]={'name':{'type':Sequelize[_0x304a('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x304a('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 236aa92..a10d6b0 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 _0x5fbd=['query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','destroy','then','get','UserProfileResource','name','send','index','Template','rawAttributes','fieldName','key','model','map'];(function(_0xa6857,_0x1645e2){var _0x2abc24=function(_0x5d4396){while(--_0x5d4396){_0xa6857['push'](_0xa6857['shift']());}};_0x2abc24(++_0x1645e2);}(_0x5fbd,0xc4));var _0xd5fb=function(_0x2f93dd,_0x54a159){_0x2f93dd=_0x2f93dd-0x0;var _0x40e66c=_0x5fbd[_0x2f93dd];return _0x40e66c;};'use strict';var emlformat=require(_0xd5fb('0x0'));var rimraf=require(_0xd5fb('0x1'));var zipdir=require(_0xd5fb('0x2'));var jsonpatch=require(_0xd5fb('0x3'));var rp=require('request-promise');var moment=require(_0xd5fb('0x4'));var BPromise=require(_0xd5fb('0x5'));var Mustache=require(_0xd5fb('0x6'));var util=require(_0xd5fb('0x7'));var path=require('path');var sox=require(_0xd5fb('0x8'));var csv=require(_0xd5fb('0x9'));var ejs=require(_0xd5fb('0xa'));var fs=require('fs');var fs_extra=require(_0xd5fb('0xb'));var _=require(_0xd5fb('0xc'));var squel=require('squel');var crypto=require(_0xd5fb('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd5fb('0x9'));var querystring=require('querystring');var Papa=require(_0xd5fb('0xe'));var Redis=require('ioredis');var authService=require(_0xd5fb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd5fb('0x10'));var hardwareService=require(_0xd5fb('0x11'));var logger=require('../../config/logger')(_0xd5fb('0x12'));var utils=require(_0xd5fb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd5fb('0x14'));var db=require(_0xd5fb('0x15'))['db'];function respondWithStatusCode(_0x510ab9,_0x4bcfb4){_0x4bcfb4=_0x4bcfb4||0xcc;return function(_0x30b755){if(_0x30b755){return _0x510ab9[_0xd5fb('0x16')](_0x4bcfb4);}return _0x510ab9['status'](_0x4bcfb4)[_0xd5fb('0x17')]();};}function respondWithResult(_0x2a0b03,_0x84b555){_0x84b555=_0x84b555||0xc8;return function(_0x33a2b0){if(_0x33a2b0){return _0x2a0b03[_0xd5fb('0x18')](_0x84b555)[_0xd5fb('0x19')](_0x33a2b0);}};}function respondWithFilteredResult(_0x25e365,_0x30ada4){return function(_0x2d63cd){if(_0x2d63cd){var _0x33a5df=typeof _0x30ada4['offset']==='undefined'&&typeof _0x30ada4['limit']===_0xd5fb('0x1a');var _0x161063=_0x2d63cd[_0xd5fb('0x1b')];var _0xf054f=_0x33a5df?0x0:_0x30ada4[_0xd5fb('0x1c')];var _0x48f7b3=_0x33a5df?_0x2d63cd[_0xd5fb('0x1b')]:_0x30ada4[_0xd5fb('0x1c')]+_0x30ada4[_0xd5fb('0x1d')];var _0x180c7e;if(_0x48f7b3>=_0x161063){_0x48f7b3=_0x161063;_0x180c7e=0xc8;}else{_0x180c7e=0xce;}_0x25e365[_0xd5fb('0x18')](_0x180c7e);return _0x25e365[_0xd5fb('0x1e')](_0xd5fb('0x1f'),_0xf054f+'-'+_0x48f7b3+'/'+_0x161063)[_0xd5fb('0x19')](_0x2d63cd);}return null;};}function patchUpdates(_0x47c264){return function(_0x5b36c6){try{jsonpatch[_0xd5fb('0x20')](_0x5b36c6,_0x47c264,!![]);}catch(_0x3d6985){return BPromise['reject'](_0x3d6985);}return _0x5b36c6[_0xd5fb('0x21')]();};}function saveUpdates(_0x5c953a,_0x36a1d1){return function(_0x48897c){if(_0x48897c){return _0x48897c['update'](_0x5c953a)['then'](function(_0x476f4a){return _0x476f4a;});}return null;};}function removeEntity(_0x3ff483,_0xad01c9){return function(_0x4fb8f){if(_0x4fb8f){return _0x4fb8f[_0xd5fb('0x22')]()[_0xd5fb('0x23')](function(){var _0x789b0e=_0x4fb8f[_0xd5fb('0x24')]({'plain':!![]});var _0x374cbc='Templates';return db[_0xd5fb('0x25')]['destroy']({'where':{'type':_0x374cbc,'resourceId':_0x789b0e['id']}})[_0xd5fb('0x23')](function(){return _0x4fb8f;});})[_0xd5fb('0x23')](function(){_0x3ff483['status'](0xcc)[_0xd5fb('0x17')]();});}};}function handleEntityNotFound(_0x34065e,_0x299829){return function(_0x18208d){if(!_0x18208d){_0x34065e[_0xd5fb('0x16')](0x194);}return _0x18208d;};}function handleError(_0xc7c087,_0x166e6a){_0x166e6a=_0x166e6a||0x1f4;return function(_0x11ce21){logger['error'](_0x11ce21['stack']);if(_0x11ce21[_0xd5fb('0x26')]){delete _0x11ce21['name'];}_0xc7c087[_0xd5fb('0x18')](_0x166e6a)[_0xd5fb('0x27')](_0x11ce21);};}exports[_0xd5fb('0x28')]=function(_0x1ba9b4,_0x283504){var _0x1c79ff={},_0x36d40c={},_0x3bfbb5={'count':0x0,'rows':[]};var _0x4c8f66=_['map'](db[_0xd5fb('0x29')][_0xd5fb('0x2a')],function(_0x1065a9){return{'name':_0x1065a9[_0xd5fb('0x2b')],'type':_0x1065a9['type'][_0xd5fb('0x2c')]};});_0x36d40c[_0xd5fb('0x2d')]=_[_0xd5fb('0x2e')](_0x4c8f66,_0xd5fb('0x26'));_0x36d40c[_0xd5fb('0x2f')]=_[_0xd5fb('0x30')](_0x1ba9b4[_0xd5fb('0x2f')]);_0x36d40c[_0xd5fb('0x31')]=_[_0xd5fb('0x32')](_0x36d40c[_0xd5fb('0x2d')],_0x36d40c[_0xd5fb('0x2f')]);_0x1c79ff[_0xd5fb('0x33')]=_[_0xd5fb('0x32')](_0x36d40c['model'],qs[_0xd5fb('0x34')](_0x1ba9b4[_0xd5fb('0x2f')][_0xd5fb('0x34')]));_0x1c79ff['attributes']=_0x1c79ff[_0xd5fb('0x33')][_0xd5fb('0x35')]?_0x1c79ff['attributes']:_0x36d40c['model'];if(!_0x1ba9b4['query']['hasOwnProperty'](_0xd5fb('0x36'))){_0x1c79ff[_0xd5fb('0x1d')]=qs['limit'](_0x1ba9b4[_0xd5fb('0x2f')]['limit']);_0x1c79ff[_0xd5fb('0x1c')]=qs[_0xd5fb('0x1c')](_0x1ba9b4[_0xd5fb('0x2f')][_0xd5fb('0x1c')]);}_0x1c79ff['order']=qs['sort'](_0x1ba9b4[_0xd5fb('0x2f')][_0xd5fb('0x37')]);_0x1c79ff[_0xd5fb('0x38')]=qs['filters'](_[_0xd5fb('0x39')](_0x1ba9b4[_0xd5fb('0x2f')],_0x36d40c['filters']),_0x4c8f66);if(_0x1ba9b4[_0xd5fb('0x2f')][_0xd5fb('0x3a')]){_0x1c79ff['where']=_[_0xd5fb('0x3b')](_0x1c79ff[_0xd5fb('0x38')],{'$or':_[_0xd5fb('0x2e')](_0x4c8f66,function(_0x45b191){if(_0x45b191[_0xd5fb('0x3c')]!==_0xd5fb('0x3d')){var _0x3a2695={};_0x3a2695[_0x45b191[_0xd5fb('0x26')]]={'$like':'%'+_0x1ba9b4['query'][_0xd5fb('0x3a')]+'%'};return _0x3a2695;}})});}_0x1c79ff=_[_0xd5fb('0x3b')]({},_0x1c79ff,_0x1ba9b4[_0xd5fb('0x3e')]);var _0x4f1677={'where':_0x1c79ff[_0xd5fb('0x38')]};return db['Template'][_0xd5fb('0x1b')](_0x4f1677)[_0xd5fb('0x23')](function(_0x4a59ce){_0x3bfbb5[_0xd5fb('0x1b')]=_0x4a59ce;if(_0x1ba9b4[_0xd5fb('0x2f')]['includeAll']){_0x1c79ff[_0xd5fb('0x3f')]=[{'all':!![]}];}return db[_0xd5fb('0x29')][_0xd5fb('0x40')](_0x1c79ff);})[_0xd5fb('0x23')](function(_0x1b21f9){_0x3bfbb5[_0xd5fb('0x41')]=_0x1b21f9;return _0x3bfbb5;})['then'](respondWithFilteredResult(_0x283504,_0x1c79ff))[_0xd5fb('0x42')](handleError(_0x283504,null));};exports[_0xd5fb('0x43')]=function(_0x1815a6,_0x32a2a8){var _0x306a3a={'raw':!![],'where':{'id':_0x1815a6[_0xd5fb('0x44')]['id']}},_0x220d62={};_0x220d62[_0xd5fb('0x2d')]=_[_0xd5fb('0x30')](db[_0xd5fb('0x29')][_0xd5fb('0x2a')]);_0x220d62[_0xd5fb('0x2f')]=_[_0xd5fb('0x30')](_0x1815a6['query']);_0x220d62['filters']=_[_0xd5fb('0x32')](_0x220d62[_0xd5fb('0x2d')],_0x220d62[_0xd5fb('0x2f')]);_0x306a3a['attributes']=_[_0xd5fb('0x32')](_0x220d62[_0xd5fb('0x2d')],qs['fields'](_0x1815a6['query'][_0xd5fb('0x34')]));_0x306a3a[_0xd5fb('0x33')]=_0x306a3a[_0xd5fb('0x33')][_0xd5fb('0x35')]?_0x306a3a[_0xd5fb('0x33')]:_0x220d62[_0xd5fb('0x2d')];if(_0x1815a6['query'][_0xd5fb('0x45')]){_0x306a3a[_0xd5fb('0x3f')]=[{'all':!![]}];}_0x306a3a=_[_0xd5fb('0x3b')]({},_0x306a3a,_0x1815a6[_0xd5fb('0x3e')]);return db[_0xd5fb('0x29')]['find'](_0x306a3a)[_0xd5fb('0x23')](handleEntityNotFound(_0x32a2a8,null))[_0xd5fb('0x23')](respondWithResult(_0x32a2a8,null))[_0xd5fb('0x42')](handleError(_0x32a2a8,null));};exports['create']=function(_0x31bd69,_0x40195a){return db[_0xd5fb('0x29')][_0xd5fb('0x46')](_0x31bd69[_0xd5fb('0x47')],{})[_0xd5fb('0x23')](function(_0x7ae473){var _0x2515c8=_0x31bd69[_0xd5fb('0x48')][_0xd5fb('0x24')]({'plain':!![]});if(!_0x2515c8)throw new Error(_0xd5fb('0x49'));if(_0x2515c8[_0xd5fb('0x4a')]==='user'){var _0x4d62f5=_0x7ae473['get']({'plain':!![]});var _0x52dd9a='Templates';return db['UserProfileSection'][_0xd5fb('0x4b')]({'where':{'name':_0x52dd9a,'userProfileId':_0x2515c8[_0xd5fb('0x4c')]},'raw':!![]})[_0xd5fb('0x23')](function(_0x2d2ed1){if(_0x2d2ed1&&_0x2d2ed1[_0xd5fb('0x4d')]===0x0){return db[_0xd5fb('0x25')][_0xd5fb('0x46')]({'name':_0x4d62f5[_0xd5fb('0x26')],'resourceId':_0x4d62f5['id'],'type':_0x2d2ed1[_0xd5fb('0x26')],'sectionId':_0x2d2ed1['id']},{})[_0xd5fb('0x23')](function(){return _0x7ae473;});}else{return _0x7ae473;}})[_0xd5fb('0x42')](function(_0x12bb14){logger[_0xd5fb('0x4e')](_0xd5fb('0x4f'),_0x12bb14);throw _0x12bb14;});}return _0x7ae473;})[_0xd5fb('0x23')](respondWithResult(_0x40195a,0xc9))[_0xd5fb('0x42')](handleError(_0x40195a,null));};exports[_0xd5fb('0x50')]=function(_0xe7cd52,_0x31f01b){if(_0xe7cd52[_0xd5fb('0x47')]['id']){delete _0xe7cd52[_0xd5fb('0x47')]['id'];}return db[_0xd5fb('0x29')][_0xd5fb('0x4b')]({'where':{'id':_0xe7cd52[_0xd5fb('0x44')]['id']}})[_0xd5fb('0x23')](handleEntityNotFound(_0x31f01b,null))[_0xd5fb('0x23')](saveUpdates(_0xe7cd52['body'],null))['then'](respondWithResult(_0x31f01b,null))['catch'](handleError(_0x31f01b,null));};exports[_0xd5fb('0x22')]=function(_0x353f54,_0x3ac963){return db['Template'][_0xd5fb('0x4b')]({'where':{'id':_0x353f54['params']['id']}})[_0xd5fb('0x23')](handleEntityNotFound(_0x3ac963,null))['then'](removeEntity(_0x3ac963,null))[_0xd5fb('0x42')](handleError(_0x3ac963,null));}; \ No newline at end of file +var _0x5c9b=['VIRTUAL','includeAll','include','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','update','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','apply','save','then','destroy','get','Templates','UserProfileResource','end','error','stack','name','send','Template','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge'];(function(_0x174140,_0x49b247){var _0x47e433=function(_0x314a69){while(--_0x314a69){_0x174140['push'](_0x174140['shift']());}};_0x47e433(++_0x49b247);}(_0x5c9b,0xa9));var _0xb5c9=function(_0xa01014,_0x2e8db9){_0xa01014=_0xa01014-0x0;var _0x14ce65=_0x5c9b[_0xa01014];return _0x14ce65;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5c9('0x0'));var zipdir=require(_0xb5c9('0x1'));var jsonpatch=require(_0xb5c9('0x2'));var rp=require(_0xb5c9('0x3'));var moment=require(_0xb5c9('0x4'));var BPromise=require(_0xb5c9('0x5'));var Mustache=require(_0xb5c9('0x6'));var util=require(_0xb5c9('0x7'));var path=require(_0xb5c9('0x8'));var sox=require(_0xb5c9('0x9'));var csv=require('to-csv');var ejs=require(_0xb5c9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb5c9('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb5c9('0xc'));var Papa=require('papaparse');var Redis=require(_0xb5c9('0xd'));var authService=require(_0xb5c9('0xe'));var qs=require(_0xb5c9('0xf'));var as=require(_0xb5c9('0x10'));var hardwareService=require(_0xb5c9('0x11'));var logger=require(_0xb5c9('0x12'))(_0xb5c9('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb5c9('0x14'));var db=require(_0xb5c9('0x15'))['db'];function respondWithStatusCode(_0x27803a,_0x453b7c){_0x453b7c=_0x453b7c||0xcc;return function(_0x21eb8e){if(_0x21eb8e){return _0x27803a[_0xb5c9('0x16')](_0x453b7c);}return _0x27803a[_0xb5c9('0x17')](_0x453b7c)['end']();};}function respondWithResult(_0x505ccd,_0x86f1dd){_0x86f1dd=_0x86f1dd||0xc8;return function(_0x250525){if(_0x250525){return _0x505ccd[_0xb5c9('0x17')](_0x86f1dd)[_0xb5c9('0x18')](_0x250525);}};}function respondWithFilteredResult(_0x1934ec,_0x196618){return function(_0x5371d1){if(_0x5371d1){var _0x4e4020=typeof _0x196618[_0xb5c9('0x19')]==='undefined'&&typeof _0x196618['limit']===_0xb5c9('0x1a');var _0x15bc9a=_0x5371d1[_0xb5c9('0x1b')];var _0x31c924=_0x4e4020?0x0:_0x196618[_0xb5c9('0x19')];var _0x7ba57c=_0x4e4020?_0x5371d1['count']:_0x196618['offset']+_0x196618['limit'];var _0x13ce6c;if(_0x7ba57c>=_0x15bc9a){_0x7ba57c=_0x15bc9a;_0x13ce6c=0xc8;}else{_0x13ce6c=0xce;}_0x1934ec['status'](_0x13ce6c);return _0x1934ec[_0xb5c9('0x1c')]('Content-Range',_0x31c924+'-'+_0x7ba57c+'/'+_0x15bc9a)[_0xb5c9('0x18')](_0x5371d1);}return null;};}function patchUpdates(_0x306021){return function(_0x1e7fc7){try{jsonpatch[_0xb5c9('0x1d')](_0x1e7fc7,_0x306021,!![]);}catch(_0x1d1980){return BPromise['reject'](_0x1d1980);}return _0x1e7fc7[_0xb5c9('0x1e')]();};}function saveUpdates(_0x351f2b,_0x386b55){return function(_0x4658d8){if(_0x4658d8){return _0x4658d8['update'](_0x351f2b)[_0xb5c9('0x1f')](function(_0x1d2819){return _0x1d2819;});}return null;};}function removeEntity(_0x31850c,_0x343e18){return function(_0x5042aa){if(_0x5042aa){return _0x5042aa[_0xb5c9('0x20')]()[_0xb5c9('0x1f')](function(){var _0x4b2dee=_0x5042aa[_0xb5c9('0x21')]({'plain':!![]});var _0x2ac4d4=_0xb5c9('0x22');return db[_0xb5c9('0x23')][_0xb5c9('0x20')]({'where':{'type':_0x2ac4d4,'resourceId':_0x4b2dee['id']}})['then'](function(){return _0x5042aa;});})['then'](function(){_0x31850c['status'](0xcc)[_0xb5c9('0x24')]();});}};}function handleEntityNotFound(_0x13a306,_0x3f9c8b){return function(_0x46e911){if(!_0x46e911){_0x13a306[_0xb5c9('0x16')](0x194);}return _0x46e911;};}function handleError(_0x240444,_0x1b465a){_0x1b465a=_0x1b465a||0x1f4;return function(_0x8a7a1f){logger[_0xb5c9('0x25')](_0x8a7a1f[_0xb5c9('0x26')]);if(_0x8a7a1f[_0xb5c9('0x27')]){delete _0x8a7a1f[_0xb5c9('0x27')];}_0x240444[_0xb5c9('0x17')](_0x1b465a)[_0xb5c9('0x28')](_0x8a7a1f);};}exports['index']=function(_0x4dfce3,_0x4e0113){var _0x6d0918={},_0x669093={},_0x53bdd2={'count':0x0,'rows':[]};var _0x1a21e0=_['map'](db[_0xb5c9('0x29')][_0xb5c9('0x2a')],function(_0x32baff){return{'name':_0x32baff[_0xb5c9('0x2b')],'type':_0x32baff[_0xb5c9('0x2c')]['key']};});_0x669093['model']=_[_0xb5c9('0x2d')](_0x1a21e0,_0xb5c9('0x27'));_0x669093[_0xb5c9('0x2e')]=_[_0xb5c9('0x2f')](_0x4dfce3['query']);_0x669093[_0xb5c9('0x30')]=_[_0xb5c9('0x31')](_0x669093[_0xb5c9('0x32')],_0x669093[_0xb5c9('0x2e')]);_0x6d0918[_0xb5c9('0x33')]=_[_0xb5c9('0x31')](_0x669093[_0xb5c9('0x32')],qs[_0xb5c9('0x34')](_0x4dfce3['query'][_0xb5c9('0x34')]));_0x6d0918[_0xb5c9('0x33')]=_0x6d0918[_0xb5c9('0x33')][_0xb5c9('0x35')]?_0x6d0918[_0xb5c9('0x33')]:_0x669093[_0xb5c9('0x32')];if(!_0x4dfce3['query'][_0xb5c9('0x36')](_0xb5c9('0x37'))){_0x6d0918[_0xb5c9('0x38')]=qs[_0xb5c9('0x38')](_0x4dfce3[_0xb5c9('0x2e')]['limit']);_0x6d0918[_0xb5c9('0x19')]=qs['offset'](_0x4dfce3[_0xb5c9('0x2e')][_0xb5c9('0x19')]);}_0x6d0918[_0xb5c9('0x39')]=qs['sort'](_0x4dfce3[_0xb5c9('0x2e')][_0xb5c9('0x3a')]);_0x6d0918[_0xb5c9('0x3b')]=qs['filters'](_['pick'](_0x4dfce3['query'],_0x669093[_0xb5c9('0x30')]),_0x1a21e0);if(_0x4dfce3[_0xb5c9('0x2e')][_0xb5c9('0x3c')]){_0x6d0918[_0xb5c9('0x3b')]=_[_0xb5c9('0x3d')](_0x6d0918[_0xb5c9('0x3b')],{'$or':_['map'](_0x1a21e0,function(_0x1c5b5d){if(_0x1c5b5d['type']!==_0xb5c9('0x3e')){var _0x39c657={};_0x39c657[_0x1c5b5d[_0xb5c9('0x27')]]={'$like':'%'+_0x4dfce3[_0xb5c9('0x2e')][_0xb5c9('0x3c')]+'%'};return _0x39c657;}})});}_0x6d0918=_['merge']({},_0x6d0918,_0x4dfce3['options']);var _0x3c6fe1={'where':_0x6d0918[_0xb5c9('0x3b')]};return db[_0xb5c9('0x29')][_0xb5c9('0x1b')](_0x3c6fe1)[_0xb5c9('0x1f')](function(_0x2935a8){_0x53bdd2[_0xb5c9('0x1b')]=_0x2935a8;if(_0x4dfce3[_0xb5c9('0x2e')][_0xb5c9('0x3f')]){_0x6d0918[_0xb5c9('0x40')]=[{'all':!![]}];}return db['Template']['findAll'](_0x6d0918);})[_0xb5c9('0x1f')](function(_0x3186e9){_0x53bdd2[_0xb5c9('0x41')]=_0x3186e9;return _0x53bdd2;})[_0xb5c9('0x1f')](respondWithFilteredResult(_0x4e0113,_0x6d0918))[_0xb5c9('0x42')](handleError(_0x4e0113,null));};exports[_0xb5c9('0x43')]=function(_0x472067,_0x398c8c){var _0x336350={'raw':!![],'where':{'id':_0x472067[_0xb5c9('0x44')]['id']}},_0x246bb1={};_0x246bb1[_0xb5c9('0x32')]=_[_0xb5c9('0x2f')](db[_0xb5c9('0x29')][_0xb5c9('0x2a')]);_0x246bb1[_0xb5c9('0x2e')]=_[_0xb5c9('0x2f')](_0x472067[_0xb5c9('0x2e')]);_0x246bb1['filters']=_[_0xb5c9('0x31')](_0x246bb1[_0xb5c9('0x32')],_0x246bb1['query']);_0x336350['attributes']=_[_0xb5c9('0x31')](_0x246bb1[_0xb5c9('0x32')],qs[_0xb5c9('0x34')](_0x472067['query']['fields']));_0x336350[_0xb5c9('0x33')]=_0x336350['attributes']['length']?_0x336350[_0xb5c9('0x33')]:_0x246bb1[_0xb5c9('0x32')];if(_0x472067['query'][_0xb5c9('0x3f')]){_0x336350[_0xb5c9('0x40')]=[{'all':!![]}];}_0x336350=_[_0xb5c9('0x3d')]({},_0x336350,_0x472067['options']);return db[_0xb5c9('0x29')]['find'](_0x336350)[_0xb5c9('0x1f')](handleEntityNotFound(_0x398c8c,null))['then'](respondWithResult(_0x398c8c,null))['catch'](handleError(_0x398c8c,null));};exports['create']=function(_0x1e531e,_0x5eed59){return db[_0xb5c9('0x29')][_0xb5c9('0x45')](_0x1e531e['body'],{})[_0xb5c9('0x1f')](function(_0xaee827){var _0x243079=_0x1e531e[_0xb5c9('0x46')][_0xb5c9('0x21')]({'plain':!![]});if(!_0x243079)throw new Error(_0xb5c9('0x47'));if(_0x243079[_0xb5c9('0x48')]===_0xb5c9('0x46')){var _0x4bb8c5=_0xaee827[_0xb5c9('0x21')]({'plain':!![]});var _0x4e4b5a=_0xb5c9('0x22');return db[_0xb5c9('0x49')][_0xb5c9('0x4a')]({'where':{'name':_0x4e4b5a,'userProfileId':_0x243079['userProfileId']},'raw':!![]})[_0xb5c9('0x1f')](function(_0x30c75d){if(_0x30c75d&&_0x30c75d['autoAssociation']===0x0){return db[_0xb5c9('0x23')][_0xb5c9('0x45')]({'name':_0x4bb8c5[_0xb5c9('0x27')],'resourceId':_0x4bb8c5['id'],'type':_0x30c75d[_0xb5c9('0x27')],'sectionId':_0x30c75d['id']},{})['then'](function(){return _0xaee827;});}else{return _0xaee827;}})[_0xb5c9('0x42')](function(_0x443da1){logger[_0xb5c9('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x443da1);throw _0x443da1;});}return _0xaee827;})[_0xb5c9('0x1f')](respondWithResult(_0x5eed59,0xc9))[_0xb5c9('0x42')](handleError(_0x5eed59,null));};exports[_0xb5c9('0x4b')]=function(_0x2079bc,_0x4da277){if(_0x2079bc[_0xb5c9('0x4c')]['id']){delete _0x2079bc[_0xb5c9('0x4c')]['id'];}return db[_0xb5c9('0x29')][_0xb5c9('0x4a')]({'where':{'id':_0x2079bc[_0xb5c9('0x44')]['id']}})[_0xb5c9('0x1f')](handleEntityNotFound(_0x4da277,null))['then'](saveUpdates(_0x2079bc[_0xb5c9('0x4c')],null))[_0xb5c9('0x1f')](respondWithResult(_0x4da277,null))[_0xb5c9('0x42')](handleError(_0x4da277,null));};exports[_0xb5c9('0x20')]=function(_0x419f0c,_0x1b966b){return db[_0xb5c9('0x29')][_0xb5c9('0x4a')]({'where':{'id':_0x419f0c[_0xb5c9('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b966b,null))['then'](removeEntity(_0x1b966b,null))['catch'](handleError(_0x1b966b,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index dd0c28a..21b360d 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 _0x4ffa=['lodash','../../config/logger','api','moment','bluebird','rimraf','./template.attributes','exports','Template','tools_templates'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4ffa,0x8c));var _0xa4ff=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4ffa[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa4ff('0x0'));var util=require('util');var logger=require(_0xa4ff('0x1'))(_0xa4ff('0x2'));var moment=require(_0xa4ff('0x3'));var BPromise=require(_0xa4ff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa4ff('0x5'));var config=require('../../config/environment');var attributes=require(_0xa4ff('0x6'));module[_0xa4ff('0x7')]=function(_0x54e718,_0x4ce433){return _0x54e718['define'](_0xa4ff('0x8'),attributes,{'tableName':_0xa4ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6044=['moment','bluebird','path','rimraf','../../config/environment','./template.attributes','define','tools_templates','lodash','util','api'];(function(_0x163cc4,_0x17323f){var _0x4742a8=function(_0x5ac07d){while(--_0x5ac07d){_0x163cc4['push'](_0x163cc4['shift']());}};_0x4742a8(++_0x17323f);}(_0x6044,0x147));var _0x4604=function(_0x2f420f,_0x4b0d1d){_0x2f420f=_0x2f420f-0x0;var _0xa1d160=_0x6044[_0x2f420f];return _0xa1d160;};'use strict';var _=require(_0x4604('0x0'));var util=require(_0x4604('0x1'));var logger=require('../../config/logger')(_0x4604('0x2'));var moment=require(_0x4604('0x3'));var BPromise=require(_0x4604('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4604('0x5'));var rimraf=require(_0x4604('0x6'));var config=require(_0x4604('0x7'));var attributes=require(_0x4604('0x8'));module['exports']=function(_0xede36e,_0x2126f5){return _0xede36e[_0x4604('0x9')]('Template',attributes,{'tableName':_0x4604('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index e46280a..69768aa 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 _0xf538=['Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','model','map','then','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0xf538,0x13e));var _0x8f53=function(_0x99ad77,_0x38599c){_0x99ad77=_0x99ad77-0x0;var _0x5a8acf=_0xf538[_0x99ad77];return _0x5a8acf;};'use strict';var _=require(_0x8f53('0x0'));var util=require('util');var moment=require(_0x8f53('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f53('0x2'));var fs=require('fs');var Redis=require(_0x8f53('0x3'));var db=require(_0x8f53('0x4'))['db'];var utils=require(_0x8f53('0x5'));var logger=require('../../config/logger')(_0x8f53('0x6'));var config=require('../../config/environment');var jayson=require(_0x8f53('0x7'));var client=jayson[_0x8f53('0x8')][_0x8f53('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b4c56,_0x1e4178,_0x509254){return new BPromise(function(_0x3f1b1b,_0x346925){return client[_0x8f53('0xa')](_0x3b4c56,_0x509254)['then'](function(_0x317054){logger[_0x8f53('0xb')](_0x8f53('0xc'),_0x1e4178,_0x8f53('0xd'));logger['debug'](_0x8f53('0xe'),_0x1e4178,_0x8f53('0xd'),JSON[_0x8f53('0xf')](_0x317054));if(_0x317054[_0x8f53('0x10')]){if(_0x317054[_0x8f53('0x10')]['code']===0x1f4){logger['error'](_0x8f53('0xc'),_0x1e4178,_0x317054[_0x8f53('0x10')][_0x8f53('0x11')]);return _0x346925(_0x317054['error'][_0x8f53('0x11')]);}logger[_0x8f53('0x10')](_0x8f53('0xc'),_0x1e4178,_0x317054[_0x8f53('0x10')]['message']);return _0x3f1b1b(_0x317054[_0x8f53('0x10')][_0x8f53('0x11')]);}else{logger[_0x8f53('0xb')](_0x8f53('0xc'),_0x1e4178,_0x8f53('0xd'));_0x3f1b1b(_0x317054[_0x8f53('0x12')][_0x8f53('0x11')]);}})[_0x8f53('0x13')](function(_0x4259db){logger[_0x8f53('0x10')](_0x8f53('0xc'),_0x1e4178,_0x4259db);_0x346925(_0x4259db);});});}exports[_0x8f53('0x14')]=function(_0x3a7f3c){var _0x2478f9=this;return new Promise(function(_0x1fd657,_0x177cc9){return db[_0x8f53('0x15')][_0x8f53('0x16')]({'raw':_0x3a7f3c['options']?_0x3a7f3c[_0x8f53('0x17')][_0x8f53('0x18')]===undefined?!![]:![]:!![],'where':_0x3a7f3c[_0x8f53('0x17')]?_0x3a7f3c[_0x8f53('0x17')][_0x8f53('0x19')]||null:null,'attributes':_0x3a7f3c[_0x8f53('0x17')]?_0x3a7f3c[_0x8f53('0x17')][_0x8f53('0x1a')]||null:null,'limit':_0x3a7f3c[_0x8f53('0x17')]?_0x3a7f3c[_0x8f53('0x17')][_0x8f53('0x1b')]||null:null,'include':_0x3a7f3c[_0x8f53('0x17')]?_0x3a7f3c[_0x8f53('0x17')][_0x8f53('0x1c')]?_['map'](_0x3a7f3c[_0x8f53('0x17')][_0x8f53('0x1c')],function(_0x1dbe78){return{'model':db[_0x1dbe78[_0x8f53('0x1d')]],'as':_0x1dbe78['as'],'attributes':_0x1dbe78[_0x8f53('0x1a')],'include':_0x1dbe78[_0x8f53('0x1c')]?_[_0x8f53('0x1e')](_0x1dbe78[_0x8f53('0x1c')],function(_0x2473f3){return{'model':db[_0x2473f3[_0x8f53('0x1d')]],'as':_0x2473f3['as'],'attributes':_0x2473f3[_0x8f53('0x1a')],'include':_0x2473f3[_0x8f53('0x1c')]?_['map'](_0x2473f3[_0x8f53('0x1c')],function(_0x5ee006){return{'model':db[_0x5ee006[_0x8f53('0x1d')]],'as':_0x5ee006['as'],'attributes':_0x5ee006[_0x8f53('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8f53('0x1f')](function(_0x29b469){logger[_0x8f53('0xb')]('GetTemplate',_0x3a7f3c);logger[_0x8f53('0x20')](_0x8f53('0x14'),_0x3a7f3c,JSON[_0x8f53('0xf')](_0x29b469));_0x1fd657(_0x29b469);})[_0x8f53('0x13')](function(_0x46f631){logger[_0x8f53('0x10')](_0x8f53('0x14'),_0x46f631[_0x8f53('0x11')],_0x3a7f3c);_0x177cc9(_0x2478f9[_0x8f53('0x10')](0x1f4,_0x46f631[_0x8f53('0x11')]));});});}; \ No newline at end of file +var _0xf4b6=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','Template','findAll','options','raw','where','attributes','limit','include','map','model','then','GetTemplate','debug','lodash','moment','bluebird','../../mysqldb'];(function(_0x44e700,_0x487889){var _0x1d15c0=function(_0x22f443){while(--_0x22f443){_0x44e700['push'](_0x44e700['shift']());}};_0x1d15c0(++_0x487889);}(_0xf4b6,0x1a9));var _0x6f4b=function(_0x67bee4,_0x1d2f1e){_0x67bee4=_0x67bee4-0x0;var _0x3f80bf=_0xf4b6[_0x67bee4];return _0x3f80bf;};'use strict';var _=require(_0x6f4b('0x0'));var util=require('util');var moment=require(_0x6f4b('0x1'));var BPromise=require(_0x6f4b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f4b('0x3'))['db'];var utils=require(_0x6f4b('0x4'));var logger=require(_0x6f4b('0x5'))(_0x6f4b('0x6'));var config=require('../../config/environment');var jayson=require(_0x6f4b('0x7'));var client=jayson[_0x6f4b('0x8')][_0x6f4b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x161cc9,_0x2d5ee1,_0x59d2fe){return new BPromise(function(_0x25ad8f,_0x365230){return client[_0x6f4b('0xa')](_0x161cc9,_0x59d2fe)['then'](function(_0x4b7d48){logger['info'](_0x6f4b('0xb'),_0x2d5ee1,'request\x20sent');logger['debug'](_0x6f4b('0xc'),_0x2d5ee1,_0x6f4b('0xd'),JSON[_0x6f4b('0xe')](_0x4b7d48));if(_0x4b7d48['error']){if(_0x4b7d48[_0x6f4b('0xf')]['code']===0x1f4){logger[_0x6f4b('0xf')]('Template,\x20%s,\x20%s',_0x2d5ee1,_0x4b7d48['error'][_0x6f4b('0x10')]);return _0x365230(_0x4b7d48[_0x6f4b('0xf')][_0x6f4b('0x10')]);}logger['error'](_0x6f4b('0xb'),_0x2d5ee1,_0x4b7d48[_0x6f4b('0xf')][_0x6f4b('0x10')]);return _0x25ad8f(_0x4b7d48['error']['message']);}else{logger[_0x6f4b('0x11')](_0x6f4b('0xb'),_0x2d5ee1,'request\x20sent');_0x25ad8f(_0x4b7d48[_0x6f4b('0x12')][_0x6f4b('0x10')]);}})[_0x6f4b('0x13')](function(_0x192605){logger['error'](_0x6f4b('0xb'),_0x2d5ee1,_0x192605);_0x365230(_0x192605);});});}exports['GetTemplate']=function(_0xf82712){var _0x2c47fc=this;return new Promise(function(_0x2493d2,_0x3f1684){return db[_0x6f4b('0x14')][_0x6f4b('0x15')]({'raw':_0xf82712[_0x6f4b('0x16')]?_0xf82712[_0x6f4b('0x16')][_0x6f4b('0x17')]===undefined?!![]:![]:!![],'where':_0xf82712[_0x6f4b('0x16')]?_0xf82712[_0x6f4b('0x16')][_0x6f4b('0x18')]||null:null,'attributes':_0xf82712[_0x6f4b('0x16')]?_0xf82712['options'][_0x6f4b('0x19')]||null:null,'limit':_0xf82712[_0x6f4b('0x16')]?_0xf82712['options'][_0x6f4b('0x1a')]||null:null,'include':_0xf82712[_0x6f4b('0x16')]?_0xf82712[_0x6f4b('0x16')][_0x6f4b('0x1b')]?_[_0x6f4b('0x1c')](_0xf82712[_0x6f4b('0x16')][_0x6f4b('0x1b')],function(_0x2411a9){return{'model':db[_0x2411a9[_0x6f4b('0x1d')]],'as':_0x2411a9['as'],'attributes':_0x2411a9[_0x6f4b('0x19')],'include':_0x2411a9[_0x6f4b('0x1b')]?_[_0x6f4b('0x1c')](_0x2411a9[_0x6f4b('0x1b')],function(_0x2031ed){return{'model':db[_0x2031ed[_0x6f4b('0x1d')]],'as':_0x2031ed['as'],'attributes':_0x2031ed[_0x6f4b('0x19')],'include':_0x2031ed[_0x6f4b('0x1b')]?_[_0x6f4b('0x1c')](_0x2031ed['include'],function(_0x30df43){return{'model':db[_0x30df43[_0x6f4b('0x1d')]],'as':_0x30df43['as'],'attributes':_0x30df43[_0x6f4b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6f4b('0x1e')](function(_0x15a41a){logger[_0x6f4b('0x11')](_0x6f4b('0x1f'),_0xf82712);logger[_0x6f4b('0x20')](_0x6f4b('0x1f'),_0xf82712,JSON[_0x6f4b('0xe')](_0x15a41a));_0x2493d2(_0x15a41a);})[_0x6f4b('0x13')](function(_0x1d58b4){logger[_0x6f4b('0xf')]('GetTemplate',_0x1d58b4[_0x6f4b('0x10')],_0xf82712);_0x3f1684(_0x2c47fc[_0x6f4b('0xf')](0x1f4,_0x1d58b4[_0x6f4b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index af04011..f463d21 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 _0xc42f=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAnyCondition','addAction','/:id'];(function(_0x5a2a75,_0xe3a29e){var _0x4109c3=function(_0x5b77f8){while(--_0x5b77f8){_0x5a2a75['push'](_0x5a2a75['shift']());}};_0x4109c3(++_0xe3a29e);}(_0xc42f,0x1e0));var _0xfc42=function(_0x2c93b9,_0xffe2f){_0x2c93b9=_0x2c93b9-0x0;var _0x3a0fdd=_0xc42f[_0x2c93b9];return _0x3a0fdd;};'use strict';var multer=require(_0xfc42('0x0'));var util=require(_0xfc42('0x1'));var path=require('path');var timeout=require(_0xfc42('0x2'));var express=require(_0xfc42('0x3'));var router=express[_0xfc42('0x4')]();var fs_extra=require(_0xfc42('0x5'));var auth=require(_0xfc42('0x6'));var interaction=require(_0xfc42('0x7'));var config=require(_0xfc42('0x8'));var controller=require(_0xfc42('0x9'));router[_0xfc42('0xa')]('/',auth[_0xfc42('0xb')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xfc42('0xc')]);router[_0xfc42('0xa')]('/:id/all_conditions',auth[_0xfc42('0xb')](),controller[_0xfc42('0xd')]);router[_0xfc42('0xa')](_0xfc42('0xe'),auth[_0xfc42('0xb')](),controller[_0xfc42('0xf')]);router[_0xfc42('0xa')](_0xfc42('0x10'),auth[_0xfc42('0xb')](),controller[_0xfc42('0x11')]);router[_0xfc42('0x12')]('/',auth[_0xfc42('0xb')](),controller[_0xfc42('0x13')]);router[_0xfc42('0x12')](_0xfc42('0x14'),auth[_0xfc42('0xb')](),controller['addAllCondition']);router['post'](_0xfc42('0xe'),auth[_0xfc42('0xb')](),controller[_0xfc42('0x15')]);router['post']('/:id/actions',auth[_0xfc42('0xb')](),controller[_0xfc42('0x16')]);router['put'](_0xfc42('0x17'),auth[_0xfc42('0xb')](),controller[_0xfc42('0x18')]);router[_0xfc42('0x19')](_0xfc42('0x17'),auth[_0xfc42('0xb')](),controller[_0xfc42('0x1a')]);module[_0xfc42('0x1b')]=router; \ No newline at end of file +var _0x8bc9=['fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','addAction','put','update','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x1db088,_0x2c7046){var _0x1bd9d8=function(_0x52f6f1){while(--_0x52f6f1){_0x1db088['push'](_0x1db088['shift']());}};_0x1bd9d8(++_0x2c7046);}(_0x8bc9,0x1bb));var _0x98bc=function(_0x3720f5,_0x5c8957){_0x3720f5=_0x3720f5-0x0;var _0x2bd688=_0x8bc9[_0x3720f5];return _0x2bd688;};'use strict';var multer=require(_0x98bc('0x0'));var util=require(_0x98bc('0x1'));var path=require(_0x98bc('0x2'));var timeout=require(_0x98bc('0x3'));var express=require('express');var router=express[_0x98bc('0x4')]();var fs_extra=require(_0x98bc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x98bc('0x6'));var config=require(_0x98bc('0x7'));var controller=require(_0x98bc('0x8'));router[_0x98bc('0x9')]('/',auth['isAuthenticated'](),controller[_0x98bc('0xa')]);router[_0x98bc('0x9')](_0x98bc('0xb'),auth[_0x98bc('0xc')](),controller['show']);router['get']('/:id/all_conditions',auth[_0x98bc('0xc')](),controller[_0x98bc('0xd')]);router['get'](_0x98bc('0xe'),auth[_0x98bc('0xc')](),controller[_0x98bc('0xf')]);router[_0x98bc('0x9')](_0x98bc('0x10'),auth[_0x98bc('0xc')](),controller[_0x98bc('0x11')]);router[_0x98bc('0x12')]('/',auth[_0x98bc('0xc')](),controller[_0x98bc('0x13')]);router[_0x98bc('0x12')](_0x98bc('0x14'),auth[_0x98bc('0xc')](),controller[_0x98bc('0x15')]);router[_0x98bc('0x12')](_0x98bc('0xe'),auth[_0x98bc('0xc')](),controller[_0x98bc('0x16')]);router[_0x98bc('0x12')](_0x98bc('0x10'),auth['isAuthenticated'](),controller[_0x98bc('0x17')]);router[_0x98bc('0x18')]('/:id',auth[_0x98bc('0xc')](),controller[_0x98bc('0x19')]);router['delete'](_0x98bc('0xb'),auth['isAuthenticated'](),controller[_0x98bc('0x1a')]);module[_0x98bc('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 9df9efc..7277e46 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 _0xbd54=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xbd54,0x17b));var _0x4bd5=function(_0x2a390b,_0xf49f9b){_0x2a390b=_0x2a390b-0x0;var _0x5df10a=_0xbd54[_0x2a390b];return _0x5df10a;};'use strict';var Sequelize=require(_0x4bd5('0x0'));module[_0x4bd5('0x1')]={'name':{'type':Sequelize[_0x4bd5('0x2')]},'channel':{'type':Sequelize[_0x4bd5('0x2')]},'description':{'type':Sequelize[_0x4bd5('0x2')]},'status':{'type':Sequelize[_0x4bd5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8d19=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4eb889,_0x13b842){var _0x3f2955=function(_0x98bed8){while(--_0x98bed8){_0x4eb889['push'](_0x4eb889['shift']());}};_0x3f2955(++_0x13b842);}(_0x8d19,0x142));var _0x98d1=function(_0x2118ad,_0xe8e3fd){_0x2118ad=_0x2118ad-0x0;var _0x4b5715=_0x8d19[_0x2118ad];return _0x4b5715;};'use strict';var Sequelize=require(_0x98d1('0x0'));module[_0x98d1('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x98d1('0x2')]},'description':{'type':Sequelize[_0x98d1('0x2')]},'status':{'type':Sequelize[_0x98d1('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 1b64918..3a3d773 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 _0x1f9a=['filter','Trigger','includeAll','include','rows','catch','show','params','keys','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','userProfileId','autoAssociation','UserProfileResource','body','addAllCondition','Condition','TriggerAnyId','findOne','hasOwnProperty','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x17a754,_0x5f1052){var _0x545d3e=function(_0x24ec39){while(--_0x24ec39){_0x17a754['push'](_0x17a754['shift']());}};_0x545d3e(++_0x5f1052);}(_0x1f9a,0xd6));var _0xa1f9=function(_0x1c0fc4,_0x263f65){_0x1c0fc4=_0x1c0fc4-0x0;var _0x2f2164=_0x1f9a[_0x1c0fc4];return _0x2f2164;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa1f9('0x0'));var jsonpatch=require(_0xa1f9('0x1'));var rp=require('request-promise');var moment=require(_0xa1f9('0x2'));var BPromise=require(_0xa1f9('0x3'));var Mustache=require(_0xa1f9('0x4'));var util=require(_0xa1f9('0x5'));var path=require('path');var sox=require(_0xa1f9('0x6'));var csv=require('to-csv');var ejs=require(_0xa1f9('0x7'));var fs=require('fs');var fs_extra=require(_0xa1f9('0x8'));var _=require(_0xa1f9('0x9'));var squel=require(_0xa1f9('0xa'));var crypto=require(_0xa1f9('0xb'));var jsforce=require(_0xa1f9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa1f9('0xd'));var querystring=require('querystring');var Papa=require(_0xa1f9('0xe'));var Redis=require(_0xa1f9('0xf'));var authService=require(_0xa1f9('0x10'));var qs=require(_0xa1f9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1f9('0x12'));var logger=require(_0xa1f9('0x13'))(_0xa1f9('0x14'));var utils=require('../../config/utils');var config=require(_0xa1f9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1f9('0x16'))['db'];function respondWithStatusCode(_0x30d696,_0x2be8c6){_0x2be8c6=_0x2be8c6||0xcc;return function(_0x2b83b0){if(_0x2b83b0){return _0x30d696['sendStatus'](_0x2be8c6);}return _0x30d696[_0xa1f9('0x17')](_0x2be8c6)[_0xa1f9('0x18')]();};}function respondWithResult(_0x4ce4b2,_0xf91fdd){_0xf91fdd=_0xf91fdd||0xc8;return function(_0x235432){if(_0x235432){return _0x4ce4b2[_0xa1f9('0x17')](_0xf91fdd)['json'](_0x235432);}};}function respondWithFilteredResult(_0x2a2465,_0x2ae277){return function(_0x8c6417){if(_0x8c6417){var _0xedec96=typeof _0x2ae277[_0xa1f9('0x19')]===_0xa1f9('0x1a')&&typeof _0x2ae277[_0xa1f9('0x1b')]===_0xa1f9('0x1a');var _0x22fe2f=_0x8c6417[_0xa1f9('0x1c')];var _0x5bf6eb=_0xedec96?0x0:_0x2ae277[_0xa1f9('0x19')];var _0x490743=_0xedec96?_0x8c6417[_0xa1f9('0x1c')]:_0x2ae277[_0xa1f9('0x19')]+_0x2ae277[_0xa1f9('0x1b')];var _0x528d6f;if(_0x490743>=_0x22fe2f){_0x490743=_0x22fe2f;_0x528d6f=0xc8;}else{_0x528d6f=0xce;}_0x2a2465[_0xa1f9('0x17')](_0x528d6f);return _0x2a2465[_0xa1f9('0x1d')](_0xa1f9('0x1e'),_0x5bf6eb+'-'+_0x490743+'/'+_0x22fe2f)[_0xa1f9('0x1f')](_0x8c6417);}return null;};}function patchUpdates(_0xf00fd9){return function(_0x2aa3c3){try{jsonpatch[_0xa1f9('0x20')](_0x2aa3c3,_0xf00fd9,!![]);}catch(_0x1a150c){return BPromise['reject'](_0x1a150c);}return _0x2aa3c3[_0xa1f9('0x21')]();};}function saveUpdates(_0x2ad23c,_0x1c2a1a){return function(_0xa7f7d3){if(_0xa7f7d3){return _0xa7f7d3[_0xa1f9('0x22')](_0x2ad23c)[_0xa1f9('0x23')](function(_0x2e21f1){return _0x2e21f1;});}return null;};}function removeEntity(_0xed12ec,_0x363e55){return function(_0x4e01c5){if(_0x4e01c5){return _0x4e01c5[_0xa1f9('0x24')]()['then'](function(){var _0x26cf8e=_0x4e01c5[_0xa1f9('0x25')]({'plain':!![]});var _0x440654='Triggers';return db['UserProfileResource']['destroy']({'where':{'type':_0x440654,'resourceId':_0x26cf8e['id']}})['then'](function(){return _0x4e01c5;});})[_0xa1f9('0x23')](function(){_0xed12ec[_0xa1f9('0x17')](0xcc)[_0xa1f9('0x18')]();});}};}function handleEntityNotFound(_0x482b5b,_0x249e95){return function(_0x69f6e8){if(!_0x69f6e8){_0x482b5b['sendStatus'](0x194);}return _0x69f6e8;};}function handleError(_0x39dca4,_0x140655){_0x140655=_0x140655||0x1f4;return function(_0x257cbb){logger[_0xa1f9('0x26')](_0x257cbb[_0xa1f9('0x27')]);if(_0x257cbb[_0xa1f9('0x28')]){delete _0x257cbb['name'];}_0x39dca4[_0xa1f9('0x17')](_0x140655)[_0xa1f9('0x29')](_0x257cbb);};}exports[_0xa1f9('0x2a')]=function(_0x109b64,_0x12016d){var _0x2d4983={},_0x1b0fcc={},_0x5b1d56={'count':0x0,'rows':[]};var _0x318223=_[_0xa1f9('0x2b')](db['Trigger'][_0xa1f9('0x2c')],function(_0xce0fc4){return{'name':_0xce0fc4[_0xa1f9('0x2d')],'type':_0xce0fc4[_0xa1f9('0x2e')][_0xa1f9('0x2f')]};});_0x1b0fcc[_0xa1f9('0x30')]=_[_0xa1f9('0x2b')](_0x318223,_0xa1f9('0x28'));_0x1b0fcc['query']=_['keys'](_0x109b64[_0xa1f9('0x31')]);_0x1b0fcc[_0xa1f9('0x32')]=_[_0xa1f9('0x33')](_0x1b0fcc['model'],_0x1b0fcc[_0xa1f9('0x31')]);_0x2d4983[_0xa1f9('0x34')]=_[_0xa1f9('0x33')](_0x1b0fcc['model'],qs[_0xa1f9('0x35')](_0x109b64[_0xa1f9('0x31')][_0xa1f9('0x35')]));_0x2d4983[_0xa1f9('0x34')]=_0x2d4983[_0xa1f9('0x34')][_0xa1f9('0x36')]?_0x2d4983[_0xa1f9('0x34')]:_0x1b0fcc[_0xa1f9('0x30')];if(!_0x109b64[_0xa1f9('0x31')]['hasOwnProperty'](_0xa1f9('0x37'))){_0x2d4983[_0xa1f9('0x1b')]=qs[_0xa1f9('0x1b')](_0x109b64[_0xa1f9('0x31')]['limit']);_0x2d4983[_0xa1f9('0x19')]=qs[_0xa1f9('0x19')](_0x109b64[_0xa1f9('0x31')][_0xa1f9('0x19')]);}_0x2d4983[_0xa1f9('0x38')]=qs[_0xa1f9('0x39')](_0x109b64[_0xa1f9('0x31')][_0xa1f9('0x39')]);_0x2d4983[_0xa1f9('0x3a')]=qs[_0xa1f9('0x32')](_[_0xa1f9('0x3b')](_0x109b64[_0xa1f9('0x31')],_0x1b0fcc[_0xa1f9('0x32')]),_0x318223);if(_0x109b64['query']['filter']){_0x2d4983[_0xa1f9('0x3a')]=_[_0xa1f9('0x3c')](_0x2d4983[_0xa1f9('0x3a')],{'$or':_[_0xa1f9('0x2b')](_0x318223,function(_0x11273f){if(_0x11273f[_0xa1f9('0x2e')]!==_0xa1f9('0x3d')){var _0x2549a4={};_0x2549a4[_0x11273f[_0xa1f9('0x28')]]={'$like':'%'+_0x109b64['query'][_0xa1f9('0x3e')]+'%'};return _0x2549a4;}})});}_0x2d4983=_[_0xa1f9('0x3c')]({},_0x2d4983,_0x109b64['options']);var _0x2017af={'where':_0x2d4983[_0xa1f9('0x3a')]};return db[_0xa1f9('0x3f')]['count'](_0x2017af)['then'](function(_0x155d7d){_0x5b1d56[_0xa1f9('0x1c')]=_0x155d7d;if(_0x109b64[_0xa1f9('0x31')][_0xa1f9('0x40')]){_0x2d4983[_0xa1f9('0x41')]=[{'all':!![]}];}return db[_0xa1f9('0x3f')]['findAll'](_0x2d4983);})[_0xa1f9('0x23')](function(_0x2871e1){_0x5b1d56[_0xa1f9('0x42')]=_0x2871e1;return _0x5b1d56;})[_0xa1f9('0x23')](respondWithFilteredResult(_0x12016d,_0x2d4983))[_0xa1f9('0x43')](handleError(_0x12016d,null));};exports[_0xa1f9('0x44')]=function(_0x10c372,_0x1204f1){var _0x56d30a={'raw':![],'where':{'id':_0x10c372[_0xa1f9('0x45')]['id']}},_0x568684={};_0x568684[_0xa1f9('0x30')]=_[_0xa1f9('0x46')](db['Trigger'][_0xa1f9('0x2c')]);_0x568684[_0xa1f9('0x31')]=_[_0xa1f9('0x46')](_0x10c372[_0xa1f9('0x31')]);_0x568684[_0xa1f9('0x32')]=_[_0xa1f9('0x33')](_0x568684[_0xa1f9('0x30')],_0x568684[_0xa1f9('0x31')]);_0x56d30a[_0xa1f9('0x34')]=_[_0xa1f9('0x33')](_0x568684[_0xa1f9('0x30')],qs['fields'](_0x10c372['query']['fields']));_0x56d30a['attributes']=_0x56d30a[_0xa1f9('0x34')]['length']?_0x56d30a['attributes']:_0x568684['model'];if(_0x10c372[_0xa1f9('0x31')][_0xa1f9('0x40')]){_0x56d30a[_0xa1f9('0x41')]=[{'all':!![]}];}_0x56d30a=_[_0xa1f9('0x3c')]({},_0x56d30a,_0x10c372[_0xa1f9('0x47')]);return db['Trigger'][_0xa1f9('0x48')](_0x56d30a)[_0xa1f9('0x23')](handleEntityNotFound(_0x1204f1,null))['then'](respondWithResult(_0x1204f1,null))[_0xa1f9('0x43')](handleError(_0x1204f1,null));};exports[_0xa1f9('0x49')]=function(_0xa2f119,_0x3db57c){return db['Trigger']['create'](_0xa2f119['body'],{})[_0xa1f9('0x23')](function(_0x18ec63){var _0x4da253=_0xa2f119['user'][_0xa1f9('0x25')]({'plain':!![]});if(!_0x4da253)throw new Error(_0xa1f9('0x4a'));if(_0x4da253[_0xa1f9('0x4b')]==='user'){var _0x1ff664=_0x18ec63[_0xa1f9('0x25')]({'plain':!![]});var _0x35f866=_0xa1f9('0x4c');return db['UserProfileSection'][_0xa1f9('0x48')]({'where':{'name':_0x35f866,'userProfileId':_0x4da253[_0xa1f9('0x4d')]},'raw':!![]})[_0xa1f9('0x23')](function(_0x4ce15a){if(_0x4ce15a&&_0x4ce15a[_0xa1f9('0x4e')]===0x0){return db[_0xa1f9('0x4f')][_0xa1f9('0x49')]({'name':_0x1ff664[_0xa1f9('0x28')],'resourceId':_0x1ff664['id'],'type':_0x4ce15a[_0xa1f9('0x28')],'sectionId':_0x4ce15a['id']},{})[_0xa1f9('0x23')](function(){return _0x18ec63;});}else{return _0x18ec63;}})['catch'](function(_0x2491fa){logger[_0xa1f9('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2491fa);throw _0x2491fa;});}return _0x18ec63;})[_0xa1f9('0x23')](respondWithResult(_0x3db57c,0xc9))['catch'](handleError(_0x3db57c,null));};exports['update']=function(_0x429494,_0x4a76a6){if(_0x429494[_0xa1f9('0x50')]['id']){delete _0x429494[_0xa1f9('0x50')]['id'];}return db[_0xa1f9('0x3f')][_0xa1f9('0x48')]({'where':{'id':_0x429494[_0xa1f9('0x45')]['id']}})[_0xa1f9('0x23')](handleEntityNotFound(_0x4a76a6,null))[_0xa1f9('0x23')](saveUpdates(_0x429494['body'],null))['then'](respondWithResult(_0x4a76a6,null))['catch'](handleError(_0x4a76a6,null));};exports[_0xa1f9('0x24')]=function(_0x42e192,_0x448a39){return db[_0xa1f9('0x3f')][_0xa1f9('0x48')]({'where':{'id':_0x42e192[_0xa1f9('0x45')]['id']}})[_0xa1f9('0x23')](handleEntityNotFound(_0x448a39,null))['then'](removeEntity(_0x448a39,null))[_0xa1f9('0x43')](handleError(_0x448a39,null));};exports[_0xa1f9('0x51')]=function(_0x3c63ad,_0x492896,_0x53834a){if(_0x3c63ad[_0xa1f9('0x50')]['id']){delete _0x3c63ad[_0xa1f9('0x50')]['id'];}return db[_0xa1f9('0x3f')]['find']({'where':{'id':_0x3c63ad[_0xa1f9('0x45')]['id']}})[_0xa1f9('0x23')](handleEntityNotFound(_0x492896,null))[_0xa1f9('0x23')](function(_0x17cbd4){if(_0x17cbd4){_0x3c63ad[_0xa1f9('0x50')]['TriggerAllId']=_0x17cbd4['id'];return db[_0xa1f9('0x52')][_0xa1f9('0x49')](_0x3c63ad['body']);}})[_0xa1f9('0x23')](respondWithResult(_0x492896,null))['catch'](handleError(_0x492896,null));};exports['addAnyCondition']=function(_0xe6b38,_0x2d9373,_0xb4c483){if(_0xe6b38[_0xa1f9('0x50')]['id']){delete _0xe6b38[_0xa1f9('0x50')]['id'];}return db['Trigger'][_0xa1f9('0x48')]({'where':{'id':_0xe6b38[_0xa1f9('0x45')]['id']}})[_0xa1f9('0x23')](handleEntityNotFound(_0x2d9373,null))[_0xa1f9('0x23')](function(_0x320bd5){if(_0x320bd5){_0xe6b38[_0xa1f9('0x50')][_0xa1f9('0x53')]=_0x320bd5['id'];return db[_0xa1f9('0x52')][_0xa1f9('0x49')](_0xe6b38[_0xa1f9('0x50')]);}})['then'](respondWithResult(_0x2d9373,null))[_0xa1f9('0x43')](handleError(_0x2d9373,null));};exports['getAllConditions']=function(_0x3f92ad,_0x54fa37,_0x1414ff){var _0x5dec42={};var _0x234ab6={};var _0xb81f80;var _0x5b07fb;return db[_0xa1f9('0x3f')][_0xa1f9('0x54')]({'where':{'id':_0x3f92ad[_0xa1f9('0x45')]['id']}})[_0xa1f9('0x23')](handleEntityNotFound(_0x54fa37,null))[_0xa1f9('0x23')](function(_0x3adfcd){if(_0x3adfcd){_0xb81f80=_0x3adfcd;_0x234ab6[_0xa1f9('0x30')]=_[_0xa1f9('0x46')](db[_0xa1f9('0x52')][_0xa1f9('0x2c')]);_0x234ab6['query']=_['keys'](_0x3f92ad[_0xa1f9('0x31')]);_0x234ab6[_0xa1f9('0x32')]=_[_0xa1f9('0x33')](_0x234ab6[_0xa1f9('0x30')],_0x234ab6[_0xa1f9('0x31')]);_0x5dec42[_0xa1f9('0x34')]=_[_0xa1f9('0x33')](_0x234ab6[_0xa1f9('0x30')],qs[_0xa1f9('0x35')](_0x3f92ad[_0xa1f9('0x31')][_0xa1f9('0x35')]));_0x5dec42['attributes']=_0x5dec42[_0xa1f9('0x34')]['length']?_0x5dec42[_0xa1f9('0x34')]:_0x234ab6[_0xa1f9('0x30')];_0x5dec42[_0xa1f9('0x38')]=qs['sort'](_0x3f92ad['query']['sort']);_0x5dec42['where']=qs['filters'](_[_0xa1f9('0x3b')](_0x3f92ad[_0xa1f9('0x31')],_0x234ab6['filters']));if(_0x3f92ad[_0xa1f9('0x31')][_0xa1f9('0x3e')]){_0x5dec42[_0xa1f9('0x3a')]=_[_0xa1f9('0x3c')](_0x5dec42[_0xa1f9('0x3a')],{'$or':_[_0xa1f9('0x2b')](_0x5dec42[_0xa1f9('0x34')],function(_0x36a9bf){var _0x49f6fa={};_0x49f6fa[_0x36a9bf]={'$like':'%'+_0x3f92ad[_0xa1f9('0x31')][_0xa1f9('0x3e')]+'%'};return _0x49f6fa;})});}_0x5dec42=_['merge']({},_0x5dec42,_0x3f92ad[_0xa1f9('0x47')]);return _0xb81f80['getAllConditions'](_0x5dec42);}})[_0xa1f9('0x23')](function(_0x5dffb1){if(_0x5dffb1){_0x5b07fb=_0x5dffb1[_0xa1f9('0x36')];if(!_0x3f92ad['query'][_0xa1f9('0x55')](_0xa1f9('0x37'))){_0x5dec42[_0xa1f9('0x1b')]=qs[_0xa1f9('0x1b')](_0x3f92ad[_0xa1f9('0x31')]['limit']);_0x5dec42[_0xa1f9('0x19')]=qs[_0xa1f9('0x19')](_0x3f92ad['query'][_0xa1f9('0x19')]);}return _0xb81f80[_0xa1f9('0x56')](_0x5dec42);}})['then'](function(_0x4fdd69){if(_0x4fdd69){return _0x4fdd69?{'count':_0x5b07fb,'rows':_0x4fdd69}:null;}})['then'](respondWithResult(_0x54fa37,null))[_0xa1f9('0x43')](handleError(_0x54fa37,null));};exports[_0xa1f9('0x57')]=function(_0x167475,_0x2d208a,_0x1188b6){var _0xae901e={};var _0x19aa48={};var _0x153594;var _0x40a541;return db['Trigger'][_0xa1f9('0x54')]({'where':{'id':_0x167475[_0xa1f9('0x45')]['id']}})[_0xa1f9('0x23')](handleEntityNotFound(_0x2d208a,null))[_0xa1f9('0x23')](function(_0x57db8f){if(_0x57db8f){_0x153594=_0x57db8f;_0x19aa48[_0xa1f9('0x30')]=_[_0xa1f9('0x46')](db['Condition'][_0xa1f9('0x2c')]);_0x19aa48['query']=_[_0xa1f9('0x46')](_0x167475['query']);_0x19aa48['filters']=_['intersection'](_0x19aa48[_0xa1f9('0x30')],_0x19aa48[_0xa1f9('0x31')]);_0xae901e[_0xa1f9('0x34')]=_[_0xa1f9('0x33')](_0x19aa48['model'],qs[_0xa1f9('0x35')](_0x167475['query']['fields']));_0xae901e['attributes']=_0xae901e[_0xa1f9('0x34')][_0xa1f9('0x36')]?_0xae901e[_0xa1f9('0x34')]:_0x19aa48['model'];_0xae901e[_0xa1f9('0x38')]=qs[_0xa1f9('0x39')](_0x167475[_0xa1f9('0x31')][_0xa1f9('0x39')]);_0xae901e['where']=qs[_0xa1f9('0x32')](_['pick'](_0x167475[_0xa1f9('0x31')],_0x19aa48[_0xa1f9('0x32')]));if(_0x167475[_0xa1f9('0x31')][_0xa1f9('0x3e')]){_0xae901e[_0xa1f9('0x3a')]=_[_0xa1f9('0x3c')](_0xae901e[_0xa1f9('0x3a')],{'$or':_['map'](_0xae901e[_0xa1f9('0x34')],function(_0x3b31ff){var _0x3914c9={};_0x3914c9[_0x3b31ff]={'$like':'%'+_0x167475[_0xa1f9('0x31')]['filter']+'%'};return _0x3914c9;})});}_0xae901e=_[_0xa1f9('0x3c')]({},_0xae901e,_0x167475[_0xa1f9('0x47')]);return _0x153594[_0xa1f9('0x57')](_0xae901e);}})[_0xa1f9('0x23')](function(_0x259129){if(_0x259129){_0x40a541=_0x259129[_0xa1f9('0x36')];if(!_0x167475[_0xa1f9('0x31')][_0xa1f9('0x55')](_0xa1f9('0x37'))){_0xae901e[_0xa1f9('0x1b')]=qs['limit'](_0x167475[_0xa1f9('0x31')][_0xa1f9('0x1b')]);_0xae901e[_0xa1f9('0x19')]=qs[_0xa1f9('0x19')](_0x167475['query'][_0xa1f9('0x19')]);}return _0x153594[_0xa1f9('0x57')](_0xae901e);}})['then'](function(_0x45f84d){if(_0x45f84d){return _0x45f84d?{'count':_0x40a541,'rows':_0x45f84d}:null;}})[_0xa1f9('0x23')](respondWithResult(_0x2d208a,null))['catch'](handleError(_0x2d208a,null));};exports[_0xa1f9('0x58')]=function(_0x211281,_0x33db3c,_0x5dbe0f){if(_0x211281[_0xa1f9('0x50')]['id']){delete _0x211281[_0xa1f9('0x50')]['id'];}return db[_0xa1f9('0x3f')][_0xa1f9('0x48')]({'where':{'id':_0x211281[_0xa1f9('0x45')]['id']}})['then'](handleEntityNotFound(_0x33db3c,null))[_0xa1f9('0x23')](function(_0x26145c){if(_0x26145c){_0x211281[_0xa1f9('0x50')][_0xa1f9('0x59')]=_0x26145c['id'];return db[_0xa1f9('0x5a')]['create'](_0x211281['body']);}})[_0xa1f9('0x23')](respondWithResult(_0x33db3c,null))[_0xa1f9('0x43')](handleError(_0x33db3c,null));};exports[_0xa1f9('0x5b')]=function(_0x224954,_0x36bf35,_0x3de8cc){var _0x13c4e8={};var _0x41c85e={};var _0x4c12d9;var _0xaf19f6;return db['Trigger'][_0xa1f9('0x54')]({'where':{'id':_0x224954[_0xa1f9('0x45')]['id']}})['then'](handleEntityNotFound(_0x36bf35,null))[_0xa1f9('0x23')](function(_0x45c33b){if(_0x45c33b){_0x4c12d9=_0x45c33b;_0x41c85e[_0xa1f9('0x30')]=_['keys'](db[_0xa1f9('0x5a')][_0xa1f9('0x2c')]);_0x41c85e[_0xa1f9('0x31')]=_['keys'](_0x224954[_0xa1f9('0x31')]);_0x41c85e['filters']=_[_0xa1f9('0x33')](_0x41c85e['model'],_0x41c85e[_0xa1f9('0x31')]);_0x13c4e8[_0xa1f9('0x34')]=_[_0xa1f9('0x33')](_0x41c85e['model'],qs['fields'](_0x224954['query']['fields']));_0x13c4e8[_0xa1f9('0x34')]=_0x13c4e8[_0xa1f9('0x34')][_0xa1f9('0x36')]?_0x13c4e8[_0xa1f9('0x34')]:_0x41c85e['model'];_0x13c4e8[_0xa1f9('0x38')]=qs[_0xa1f9('0x39')](_0x224954['query'][_0xa1f9('0x39')]);_0x13c4e8[_0xa1f9('0x3a')]=qs[_0xa1f9('0x32')](_[_0xa1f9('0x3b')](_0x224954[_0xa1f9('0x31')],_0x41c85e['filters']));if(_0x224954[_0xa1f9('0x31')]['filter']){_0x13c4e8[_0xa1f9('0x3a')]=_[_0xa1f9('0x3c')](_0x13c4e8[_0xa1f9('0x3a')],{'$or':_['map'](_0x13c4e8[_0xa1f9('0x34')],function(_0x2fcfa1){var _0x1372d1={};_0x1372d1[_0x2fcfa1]={'$like':'%'+_0x224954[_0xa1f9('0x31')][_0xa1f9('0x3e')]+'%'};return _0x1372d1;})});}_0x13c4e8=_[_0xa1f9('0x3c')]({},_0x13c4e8,_0x224954[_0xa1f9('0x47')]);return _0x4c12d9[_0xa1f9('0x5b')](_0x13c4e8);}})[_0xa1f9('0x23')](function(_0x401d25){if(_0x401d25){_0xaf19f6=_0x401d25['length'];if(!_0x224954['query'][_0xa1f9('0x55')](_0xa1f9('0x37'))){_0x13c4e8[_0xa1f9('0x1b')]=qs[_0xa1f9('0x1b')](_0x224954[_0xa1f9('0x31')][_0xa1f9('0x1b')]);_0x13c4e8[_0xa1f9('0x19')]=qs[_0xa1f9('0x19')](_0x224954[_0xa1f9('0x31')]['offset']);}return _0x4c12d9['getActions'](_0x13c4e8);}})[_0xa1f9('0x23')](function(_0x487a92){if(_0x487a92){return _0x487a92?{'count':_0xaf19f6,'rows':_0x487a92}:null;}})[_0xa1f9('0x23')](respondWithResult(_0x36bf35,null))[_0xa1f9('0x43')](handleError(_0x36bf35,null));}; \ No newline at end of file +var _0x5470=['TriggerAnyId','getAllConditions','length','nolimit','getAnyConditions','findOne','addAction','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','sendStatus','error','name','send','map','Trigger','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','params'];(function(_0x1409c8,_0x2e7f4b){var _0x33f6de=function(_0x3aa586){while(--_0x3aa586){_0x1409c8['push'](_0x1409c8['shift']());}};_0x33f6de(++_0x2e7f4b);}(_0x5470,0x68));var _0x0547=function(_0x165e93,_0x472309){_0x165e93=_0x165e93-0x0;var _0x479df6=_0x5470[_0x165e93];return _0x479df6;};'use strict';var emlformat=require(_0x0547('0x0'));var rimraf=require(_0x0547('0x1'));var zipdir=require(_0x0547('0x2'));var jsonpatch=require(_0x0547('0x3'));var rp=require(_0x0547('0x4'));var moment=require(_0x0547('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0547('0x6'));var path=require(_0x0547('0x7'));var sox=require(_0x0547('0x8'));var csv=require('to-csv');var ejs=require(_0x0547('0x9'));var fs=require('fs');var fs_extra=require(_0x0547('0xa'));var _=require('lodash');var squel=require(_0x0547('0xb'));var crypto=require(_0x0547('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0547('0xd'));var querystring=require(_0x0547('0xe'));var Papa=require(_0x0547('0xf'));var Redis=require(_0x0547('0x10'));var authService=require(_0x0547('0x11'));var qs=require(_0x0547('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0547('0x13'));var logger=require(_0x0547('0x14'))(_0x0547('0x15'));var utils=require(_0x0547('0x16'));var config=require(_0x0547('0x17'));var licenseUtil=require(_0x0547('0x18'));var db=require(_0x0547('0x19'))['db'];function respondWithStatusCode(_0x284a46,_0x15495f){_0x15495f=_0x15495f||0xcc;return function(_0x45140b){if(_0x45140b){return _0x284a46['sendStatus'](_0x15495f);}return _0x284a46['status'](_0x15495f)[_0x0547('0x1a')]();};}function respondWithResult(_0x287b5e,_0x27e3fd){_0x27e3fd=_0x27e3fd||0xc8;return function(_0x641168){if(_0x641168){return _0x287b5e[_0x0547('0x1b')](_0x27e3fd)['json'](_0x641168);}};}function respondWithFilteredResult(_0x34d8d3,_0x34be84){return function(_0x2f6c24){if(_0x2f6c24){var _0x559f85=typeof _0x34be84[_0x0547('0x1c')]==='undefined'&&typeof _0x34be84[_0x0547('0x1d')]===_0x0547('0x1e');var _0xcdebdd=_0x2f6c24[_0x0547('0x1f')];var _0x21e38c=_0x559f85?0x0:_0x34be84[_0x0547('0x1c')];var _0x36b9de=_0x559f85?_0x2f6c24['count']:_0x34be84[_0x0547('0x1c')]+_0x34be84[_0x0547('0x1d')];var _0x3ba8f0;if(_0x36b9de>=_0xcdebdd){_0x36b9de=_0xcdebdd;_0x3ba8f0=0xc8;}else{_0x3ba8f0=0xce;}_0x34d8d3[_0x0547('0x1b')](_0x3ba8f0);return _0x34d8d3['set'](_0x0547('0x20'),_0x21e38c+'-'+_0x36b9de+'/'+_0xcdebdd)['json'](_0x2f6c24);}return null;};}function patchUpdates(_0x13b639){return function(_0xe5f02b){try{jsonpatch[_0x0547('0x21')](_0xe5f02b,_0x13b639,!![]);}catch(_0x2ce4fa){return BPromise[_0x0547('0x22')](_0x2ce4fa);}return _0xe5f02b[_0x0547('0x23')]();};}function saveUpdates(_0x544070,_0x55f5d8){return function(_0xa90659){if(_0xa90659){return _0xa90659[_0x0547('0x24')](_0x544070)[_0x0547('0x25')](function(_0x12f6b2){return _0x12f6b2;});}return null;};}function removeEntity(_0x12afca,_0x143913){return function(_0x39b941){if(_0x39b941){return _0x39b941[_0x0547('0x26')]()[_0x0547('0x25')](function(){var _0x4d2bad=_0x39b941[_0x0547('0x27')]({'plain':!![]});var _0x330172=_0x0547('0x28');return db[_0x0547('0x29')]['destroy']({'where':{'type':_0x330172,'resourceId':_0x4d2bad['id']}})[_0x0547('0x25')](function(){return _0x39b941;});})['then'](function(){_0x12afca[_0x0547('0x1b')](0xcc)[_0x0547('0x1a')]();});}};}function handleEntityNotFound(_0x515144,_0x5a8248){return function(_0x5e8783){if(!_0x5e8783){_0x515144[_0x0547('0x2a')](0x194);}return _0x5e8783;};}function handleError(_0x1dd877,_0x482e7f){_0x482e7f=_0x482e7f||0x1f4;return function(_0x117a42){logger[_0x0547('0x2b')](_0x117a42['stack']);if(_0x117a42['name']){delete _0x117a42[_0x0547('0x2c')];}_0x1dd877[_0x0547('0x1b')](_0x482e7f)[_0x0547('0x2d')](_0x117a42);};}exports['index']=function(_0x5430f2,_0xa539b9){var _0x41b3b8={},_0x29c93e={},_0x270bcd={'count':0x0,'rows':[]};var _0x1a999c=_[_0x0547('0x2e')](db[_0x0547('0x2f')]['rawAttributes'],function(_0x3d5663){return{'name':_0x3d5663['fieldName'],'type':_0x3d5663[_0x0547('0x30')]['key']};});_0x29c93e['model']=_['map'](_0x1a999c,_0x0547('0x2c'));_0x29c93e[_0x0547('0x31')]=_[_0x0547('0x32')](_0x5430f2['query']);_0x29c93e[_0x0547('0x33')]=_[_0x0547('0x34')](_0x29c93e[_0x0547('0x35')],_0x29c93e[_0x0547('0x31')]);_0x41b3b8[_0x0547('0x36')]=_['intersection'](_0x29c93e[_0x0547('0x35')],qs[_0x0547('0x37')](_0x5430f2['query'][_0x0547('0x37')]));_0x41b3b8[_0x0547('0x36')]=_0x41b3b8[_0x0547('0x36')]['length']?_0x41b3b8[_0x0547('0x36')]:_0x29c93e[_0x0547('0x35')];if(!_0x5430f2[_0x0547('0x31')][_0x0547('0x38')]('nolimit')){_0x41b3b8['limit']=qs[_0x0547('0x1d')](_0x5430f2['query']['limit']);_0x41b3b8['offset']=qs['offset'](_0x5430f2[_0x0547('0x31')][_0x0547('0x1c')]);}_0x41b3b8[_0x0547('0x39')]=qs['sort'](_0x5430f2['query'][_0x0547('0x3a')]);_0x41b3b8[_0x0547('0x3b')]=qs[_0x0547('0x33')](_[_0x0547('0x3c')](_0x5430f2[_0x0547('0x31')],_0x29c93e[_0x0547('0x33')]),_0x1a999c);if(_0x5430f2['query'][_0x0547('0x3d')]){_0x41b3b8[_0x0547('0x3b')]=_['merge'](_0x41b3b8[_0x0547('0x3b')],{'$or':_[_0x0547('0x2e')](_0x1a999c,function(_0x205f57){if(_0x205f57[_0x0547('0x30')]!==_0x0547('0x3e')){var _0x4231ac={};_0x4231ac[_0x205f57['name']]={'$like':'%'+_0x5430f2['query'][_0x0547('0x3d')]+'%'};return _0x4231ac;}})});}_0x41b3b8=_[_0x0547('0x3f')]({},_0x41b3b8,_0x5430f2[_0x0547('0x40')]);var _0x4e9503={'where':_0x41b3b8[_0x0547('0x3b')]};return db['Trigger'][_0x0547('0x1f')](_0x4e9503)['then'](function(_0x5ac701){_0x270bcd['count']=_0x5ac701;if(_0x5430f2[_0x0547('0x31')]['includeAll']){_0x41b3b8['include']=[{'all':!![]}];}return db[_0x0547('0x2f')][_0x0547('0x41')](_0x41b3b8);})['then'](function(_0x21e4b0){_0x270bcd[_0x0547('0x42')]=_0x21e4b0;return _0x270bcd;})[_0x0547('0x25')](respondWithFilteredResult(_0xa539b9,_0x41b3b8))[_0x0547('0x43')](handleError(_0xa539b9,null));};exports[_0x0547('0x44')]=function(_0x5ece0a,_0x41eaed){var _0x36f0fa={'raw':![],'where':{'id':_0x5ece0a['params']['id']}},_0x3af3ac={};_0x3af3ac[_0x0547('0x35')]=_['keys'](db[_0x0547('0x2f')][_0x0547('0x45')]);_0x3af3ac[_0x0547('0x31')]=_[_0x0547('0x32')](_0x5ece0a['query']);_0x3af3ac['filters']=_[_0x0547('0x34')](_0x3af3ac[_0x0547('0x35')],_0x3af3ac[_0x0547('0x31')]);_0x36f0fa[_0x0547('0x36')]=_[_0x0547('0x34')](_0x3af3ac[_0x0547('0x35')],qs[_0x0547('0x37')](_0x5ece0a[_0x0547('0x31')]['fields']));_0x36f0fa[_0x0547('0x36')]=_0x36f0fa[_0x0547('0x36')]['length']?_0x36f0fa[_0x0547('0x36')]:_0x3af3ac['model'];if(_0x5ece0a[_0x0547('0x31')]['includeAll']){_0x36f0fa[_0x0547('0x46')]=[{'all':!![]}];}_0x36f0fa=_[_0x0547('0x3f')]({},_0x36f0fa,_0x5ece0a[_0x0547('0x40')]);return db[_0x0547('0x2f')][_0x0547('0x47')](_0x36f0fa)['then'](handleEntityNotFound(_0x41eaed,null))[_0x0547('0x25')](respondWithResult(_0x41eaed,null))[_0x0547('0x43')](handleError(_0x41eaed,null));};exports[_0x0547('0x48')]=function(_0x557e90,_0x553c2d){return db[_0x0547('0x2f')][_0x0547('0x48')](_0x557e90[_0x0547('0x49')],{})[_0x0547('0x25')](function(_0x5bde69){var _0x427031=_0x557e90[_0x0547('0x4a')][_0x0547('0x27')]({'plain':!![]});if(!_0x427031)throw new Error(_0x0547('0x4b'));if(_0x427031[_0x0547('0x4c')]==='user'){var _0x44db53=_0x5bde69[_0x0547('0x27')]({'plain':!![]});var _0x510a7e=_0x0547('0x28');return db[_0x0547('0x4d')][_0x0547('0x47')]({'where':{'name':_0x510a7e,'userProfileId':_0x427031[_0x0547('0x4e')]},'raw':!![]})[_0x0547('0x25')](function(_0x49f69d){if(_0x49f69d&&_0x49f69d[_0x0547('0x4f')]===0x0){return db[_0x0547('0x29')][_0x0547('0x48')]({'name':_0x44db53[_0x0547('0x2c')],'resourceId':_0x44db53['id'],'type':_0x49f69d['name'],'sectionId':_0x49f69d['id']},{})[_0x0547('0x25')](function(){return _0x5bde69;});}else{return _0x5bde69;}})[_0x0547('0x43')](function(_0x2b33b0){logger[_0x0547('0x2b')](_0x0547('0x50'),_0x2b33b0);throw _0x2b33b0;});}return _0x5bde69;})[_0x0547('0x25')](respondWithResult(_0x553c2d,0xc9))['catch'](handleError(_0x553c2d,null));};exports[_0x0547('0x24')]=function(_0xe36536,_0x12e392){if(_0xe36536[_0x0547('0x49')]['id']){delete _0xe36536[_0x0547('0x49')]['id'];}return db[_0x0547('0x2f')]['find']({'where':{'id':_0xe36536['params']['id']}})['then'](handleEntityNotFound(_0x12e392,null))[_0x0547('0x25')](saveUpdates(_0xe36536[_0x0547('0x49')],null))[_0x0547('0x25')](respondWithResult(_0x12e392,null))[_0x0547('0x43')](handleError(_0x12e392,null));};exports[_0x0547('0x26')]=function(_0x3f24e7,_0x3697c5){return db[_0x0547('0x2f')]['find']({'where':{'id':_0x3f24e7['params']['id']}})[_0x0547('0x25')](handleEntityNotFound(_0x3697c5,null))[_0x0547('0x25')](removeEntity(_0x3697c5,null))[_0x0547('0x43')](handleError(_0x3697c5,null));};exports[_0x0547('0x51')]=function(_0x30eb1b,_0x3b212a,_0x4384f4){if(_0x30eb1b[_0x0547('0x49')]['id']){delete _0x30eb1b[_0x0547('0x49')]['id'];}return db[_0x0547('0x2f')][_0x0547('0x47')]({'where':{'id':_0x30eb1b['params']['id']}})[_0x0547('0x25')](handleEntityNotFound(_0x3b212a,null))[_0x0547('0x25')](function(_0x365ee3){if(_0x365ee3){_0x30eb1b[_0x0547('0x49')][_0x0547('0x52')]=_0x365ee3['id'];return db[_0x0547('0x53')][_0x0547('0x48')](_0x30eb1b['body']);}})[_0x0547('0x25')](respondWithResult(_0x3b212a,null))['catch'](handleError(_0x3b212a,null));};exports[_0x0547('0x54')]=function(_0xe4d33,_0x2cb8f2,_0xd9d69a){if(_0xe4d33[_0x0547('0x49')]['id']){delete _0xe4d33[_0x0547('0x49')]['id'];}return db[_0x0547('0x2f')][_0x0547('0x47')]({'where':{'id':_0xe4d33[_0x0547('0x55')]['id']}})[_0x0547('0x25')](handleEntityNotFound(_0x2cb8f2,null))['then'](function(_0x93cbe6){if(_0x93cbe6){_0xe4d33[_0x0547('0x49')][_0x0547('0x56')]=_0x93cbe6['id'];return db['Condition'][_0x0547('0x48')](_0xe4d33[_0x0547('0x49')]);}})[_0x0547('0x25')](respondWithResult(_0x2cb8f2,null))[_0x0547('0x43')](handleError(_0x2cb8f2,null));};exports[_0x0547('0x57')]=function(_0x30ee0f,_0x17cd3a,_0x1f5b67){var _0x487920={};var _0x1587ab={};var _0x92d0f0;var _0xf74840;return db['Trigger']['findOne']({'where':{'id':_0x30ee0f[_0x0547('0x55')]['id']}})[_0x0547('0x25')](handleEntityNotFound(_0x17cd3a,null))[_0x0547('0x25')](function(_0x13af50){if(_0x13af50){_0x92d0f0=_0x13af50;_0x1587ab[_0x0547('0x35')]=_[_0x0547('0x32')](db[_0x0547('0x53')][_0x0547('0x45')]);_0x1587ab[_0x0547('0x31')]=_[_0x0547('0x32')](_0x30ee0f[_0x0547('0x31')]);_0x1587ab[_0x0547('0x33')]=_['intersection'](_0x1587ab[_0x0547('0x35')],_0x1587ab[_0x0547('0x31')]);_0x487920['attributes']=_['intersection'](_0x1587ab[_0x0547('0x35')],qs[_0x0547('0x37')](_0x30ee0f[_0x0547('0x31')][_0x0547('0x37')]));_0x487920[_0x0547('0x36')]=_0x487920['attributes'][_0x0547('0x58')]?_0x487920['attributes']:_0x1587ab['model'];_0x487920[_0x0547('0x39')]=qs['sort'](_0x30ee0f[_0x0547('0x31')][_0x0547('0x3a')]);_0x487920[_0x0547('0x3b')]=qs[_0x0547('0x33')](_[_0x0547('0x3c')](_0x30ee0f[_0x0547('0x31')],_0x1587ab[_0x0547('0x33')]));if(_0x30ee0f['query'][_0x0547('0x3d')]){_0x487920[_0x0547('0x3b')]=_[_0x0547('0x3f')](_0x487920[_0x0547('0x3b')],{'$or':_[_0x0547('0x2e')](_0x487920[_0x0547('0x36')],function(_0x346ddc){var _0x39d048={};_0x39d048[_0x346ddc]={'$like':'%'+_0x30ee0f['query'][_0x0547('0x3d')]+'%'};return _0x39d048;})});}_0x487920=_[_0x0547('0x3f')]({},_0x487920,_0x30ee0f[_0x0547('0x40')]);return _0x92d0f0[_0x0547('0x57')](_0x487920);}})[_0x0547('0x25')](function(_0x41f293){if(_0x41f293){_0xf74840=_0x41f293[_0x0547('0x58')];if(!_0x30ee0f[_0x0547('0x31')][_0x0547('0x38')](_0x0547('0x59'))){_0x487920[_0x0547('0x1d')]=qs[_0x0547('0x1d')](_0x30ee0f[_0x0547('0x31')][_0x0547('0x1d')]);_0x487920[_0x0547('0x1c')]=qs[_0x0547('0x1c')](_0x30ee0f[_0x0547('0x31')][_0x0547('0x1c')]);}return _0x92d0f0['getAllConditions'](_0x487920);}})[_0x0547('0x25')](function(_0x4b1435){if(_0x4b1435){return _0x4b1435?{'count':_0xf74840,'rows':_0x4b1435}:null;}})[_0x0547('0x25')](respondWithResult(_0x17cd3a,null))[_0x0547('0x43')](handleError(_0x17cd3a,null));};exports[_0x0547('0x5a')]=function(_0x46dd5e,_0x1586d1,_0x156ba9){var _0xf1d98b={};var _0x55a9b4={};var _0x2cb911;var _0x4c66cd;return db[_0x0547('0x2f')][_0x0547('0x5b')]({'where':{'id':_0x46dd5e[_0x0547('0x55')]['id']}})['then'](handleEntityNotFound(_0x1586d1,null))['then'](function(_0x2b3cc4){if(_0x2b3cc4){_0x2cb911=_0x2b3cc4;_0x55a9b4['model']=_[_0x0547('0x32')](db[_0x0547('0x53')][_0x0547('0x45')]);_0x55a9b4[_0x0547('0x31')]=_[_0x0547('0x32')](_0x46dd5e[_0x0547('0x31')]);_0x55a9b4[_0x0547('0x33')]=_['intersection'](_0x55a9b4[_0x0547('0x35')],_0x55a9b4[_0x0547('0x31')]);_0xf1d98b['attributes']=_['intersection'](_0x55a9b4[_0x0547('0x35')],qs['fields'](_0x46dd5e[_0x0547('0x31')][_0x0547('0x37')]));_0xf1d98b[_0x0547('0x36')]=_0xf1d98b[_0x0547('0x36')][_0x0547('0x58')]?_0xf1d98b[_0x0547('0x36')]:_0x55a9b4[_0x0547('0x35')];_0xf1d98b['order']=qs['sort'](_0x46dd5e[_0x0547('0x31')][_0x0547('0x3a')]);_0xf1d98b['where']=qs[_0x0547('0x33')](_[_0x0547('0x3c')](_0x46dd5e[_0x0547('0x31')],_0x55a9b4[_0x0547('0x33')]));if(_0x46dd5e[_0x0547('0x31')]['filter']){_0xf1d98b[_0x0547('0x3b')]=_[_0x0547('0x3f')](_0xf1d98b[_0x0547('0x3b')],{'$or':_['map'](_0xf1d98b[_0x0547('0x36')],function(_0x5bcabc){var _0x14f481={};_0x14f481[_0x5bcabc]={'$like':'%'+_0x46dd5e['query']['filter']+'%'};return _0x14f481;})});}_0xf1d98b=_[_0x0547('0x3f')]({},_0xf1d98b,_0x46dd5e[_0x0547('0x40')]);return _0x2cb911[_0x0547('0x5a')](_0xf1d98b);}})[_0x0547('0x25')](function(_0x39217d){if(_0x39217d){_0x4c66cd=_0x39217d['length'];if(!_0x46dd5e[_0x0547('0x31')][_0x0547('0x38')](_0x0547('0x59'))){_0xf1d98b[_0x0547('0x1d')]=qs[_0x0547('0x1d')](_0x46dd5e[_0x0547('0x31')][_0x0547('0x1d')]);_0xf1d98b['offset']=qs[_0x0547('0x1c')](_0x46dd5e['query']['offset']);}return _0x2cb911[_0x0547('0x5a')](_0xf1d98b);}})['then'](function(_0x25ffb5){if(_0x25ffb5){return _0x25ffb5?{'count':_0x4c66cd,'rows':_0x25ffb5}:null;}})[_0x0547('0x25')](respondWithResult(_0x1586d1,null))[_0x0547('0x43')](handleError(_0x1586d1,null));};exports[_0x0547('0x5c')]=function(_0x501361,_0x218c8e,_0x508b72){if(_0x501361[_0x0547('0x49')]['id']){delete _0x501361[_0x0547('0x49')]['id'];}return db[_0x0547('0x2f')][_0x0547('0x47')]({'where':{'id':_0x501361['params']['id']}})[_0x0547('0x25')](handleEntityNotFound(_0x218c8e,null))[_0x0547('0x25')](function(_0x10ee3e){if(_0x10ee3e){_0x501361[_0x0547('0x49')]['TriggerId']=_0x10ee3e['id'];return db['Action'][_0x0547('0x48')](_0x501361[_0x0547('0x49')]);}})[_0x0547('0x25')](respondWithResult(_0x218c8e,null))[_0x0547('0x43')](handleError(_0x218c8e,null));};exports[_0x0547('0x5d')]=function(_0x537a0c,_0x39df70,_0x4f3507){var _0x1b8e13={};var _0x43f4ab={};var _0x2d9735;var _0x2119d4;return db['Trigger'][_0x0547('0x5b')]({'where':{'id':_0x537a0c[_0x0547('0x55')]['id']}})[_0x0547('0x25')](handleEntityNotFound(_0x39df70,null))[_0x0547('0x25')](function(_0x45bb95){if(_0x45bb95){_0x2d9735=_0x45bb95;_0x43f4ab[_0x0547('0x35')]=_[_0x0547('0x32')](db[_0x0547('0x5e')][_0x0547('0x45')]);_0x43f4ab['query']=_[_0x0547('0x32')](_0x537a0c[_0x0547('0x31')]);_0x43f4ab[_0x0547('0x33')]=_[_0x0547('0x34')](_0x43f4ab[_0x0547('0x35')],_0x43f4ab['query']);_0x1b8e13[_0x0547('0x36')]=_['intersection'](_0x43f4ab[_0x0547('0x35')],qs[_0x0547('0x37')](_0x537a0c[_0x0547('0x31')][_0x0547('0x37')]));_0x1b8e13[_0x0547('0x36')]=_0x1b8e13[_0x0547('0x36')][_0x0547('0x58')]?_0x1b8e13[_0x0547('0x36')]:_0x43f4ab[_0x0547('0x35')];_0x1b8e13['order']=qs[_0x0547('0x3a')](_0x537a0c[_0x0547('0x31')]['sort']);_0x1b8e13[_0x0547('0x3b')]=qs[_0x0547('0x33')](_[_0x0547('0x3c')](_0x537a0c[_0x0547('0x31')],_0x43f4ab[_0x0547('0x33')]));if(_0x537a0c[_0x0547('0x31')][_0x0547('0x3d')]){_0x1b8e13[_0x0547('0x3b')]=_[_0x0547('0x3f')](_0x1b8e13[_0x0547('0x3b')],{'$or':_['map'](_0x1b8e13['attributes'],function(_0x370497){var _0x48b39e={};_0x48b39e[_0x370497]={'$like':'%'+_0x537a0c[_0x0547('0x31')][_0x0547('0x3d')]+'%'};return _0x48b39e;})});}_0x1b8e13=_[_0x0547('0x3f')]({},_0x1b8e13,_0x537a0c[_0x0547('0x40')]);return _0x2d9735[_0x0547('0x5d')](_0x1b8e13);}})[_0x0547('0x25')](function(_0x3eecf7){if(_0x3eecf7){_0x2119d4=_0x3eecf7[_0x0547('0x58')];if(!_0x537a0c[_0x0547('0x31')][_0x0547('0x38')](_0x0547('0x59'))){_0x1b8e13[_0x0547('0x1d')]=qs[_0x0547('0x1d')](_0x537a0c[_0x0547('0x31')][_0x0547('0x1d')]);_0x1b8e13['offset']=qs['offset'](_0x537a0c[_0x0547('0x31')][_0x0547('0x1c')]);}return _0x2d9735['getActions'](_0x1b8e13);}})[_0x0547('0x25')](function(_0x245f7c){if(_0x245f7c){return _0x245f7c?{'count':_0x2119d4,'rows':_0x245f7c}:null;}})['then'](respondWithResult(_0x39df70,null))['catch'](handleError(_0x39df70,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index d970aea..c27e775 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 _0xf874=['request-promise','path','rimraf','./trigger.attributes','exports','lodash','../../config/logger','api','moment','bluebird'];(function(_0xe6e134,_0x38fabb){var _0x2ea5ad=function(_0x13f75a){while(--_0x13f75a){_0xe6e134['push'](_0xe6e134['shift']());}};_0x2ea5ad(++_0x38fabb);}(_0xf874,0x177));var _0x4f87=function(_0x4cbf88,_0x3664c8){_0x4cbf88=_0x4cbf88-0x0;var _0x2d6d8c=_0xf874[_0x4cbf88];return _0x2d6d8c;};'use strict';var _=require(_0x4f87('0x0'));var util=require('util');var logger=require(_0x4f87('0x1'))(_0x4f87('0x2'));var moment=require(_0x4f87('0x3'));var BPromise=require(_0x4f87('0x4'));var rp=require(_0x4f87('0x5'));var fs=require('fs');var path=require(_0x4f87('0x6'));var rimraf=require(_0x4f87('0x7'));var config=require('../../config/environment');var attributes=require(_0x4f87('0x8'));module[_0x4f87('0x9')]=function(_0x5d9a23,_0x50bcb8){return _0x5d9a23['define']('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79a8=['define','Trigger','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./trigger.attributes','exports'];(function(_0x39ff36,_0x5c1ce7){var _0x193380=function(_0x353520){while(--_0x353520){_0x39ff36['push'](_0x39ff36['shift']());}};_0x193380(++_0x5c1ce7);}(_0x79a8,0x1d0));var _0x879a=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x79a8[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x879a('0x0'));var util=require('util');var logger=require(_0x879a('0x1'))(_0x879a('0x2'));var moment=require(_0x879a('0x3'));var BPromise=require('bluebird');var rp=require(_0x879a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x879a('0x5'));var config=require(_0x879a('0x6'));var attributes=require(_0x879a('0x7'));module[_0x879a('0x8')]=function(_0x1808f1,_0x3cb89c){return _0x1808f1[_0x879a('0x9')](_0x879a('0xa'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 085ab5d..176426d 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 _0x6b93=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTrigger','Trigger','options','raw','where','limit','include','map','attributes','model','debug','ShowTrigger','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x22dd93,_0x10f076){var _0x5d835c=function(_0x5c5a6a){while(--_0x5c5a6a){_0x22dd93['push'](_0x22dd93['shift']());}};_0x5d835c(++_0x10f076);}(_0x6b93,0x121));var _0x36b9=function(_0x3cec40,_0x2ce0a9){_0x3cec40=_0x3cec40-0x0;var _0x315f09=_0x6b93[_0x3cec40];return _0x315f09;};'use strict';var _=require(_0x36b9('0x0'));var util=require(_0x36b9('0x1'));var moment=require(_0x36b9('0x2'));var BPromise=require(_0x36b9('0x3'));var rs=require(_0x36b9('0x4'));var fs=require('fs');var Redis=require(_0x36b9('0x5'));var db=require(_0x36b9('0x6'))['db'];var utils=require(_0x36b9('0x7'));var logger=require(_0x36b9('0x8'))('rpc');var config=require(_0x36b9('0x9'));var jayson=require(_0x36b9('0xa'));var client=jayson[_0x36b9('0xb')][_0x36b9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33a976,_0x333c4b,_0xabc474){return new BPromise(function(_0x244709,_0x5c2fed){return client[_0x36b9('0xd')](_0x33a976,_0xabc474)['then'](function(_0x32d8df){logger[_0x36b9('0xe')](_0x36b9('0xf'),_0x333c4b,_0x36b9('0x10'));logger['debug'](_0x36b9('0x11'),_0x333c4b,_0x36b9('0x10'),JSON[_0x36b9('0x12')](_0x32d8df));if(_0x32d8df[_0x36b9('0x13')]){if(_0x32d8df[_0x36b9('0x13')]['code']===0x1f4){logger[_0x36b9('0x13')](_0x36b9('0xf'),_0x333c4b,_0x32d8df[_0x36b9('0x13')][_0x36b9('0x14')]);return _0x5c2fed(_0x32d8df[_0x36b9('0x13')][_0x36b9('0x14')]);}logger[_0x36b9('0x13')](_0x36b9('0xf'),_0x333c4b,_0x32d8df[_0x36b9('0x13')][_0x36b9('0x14')]);return _0x244709(_0x32d8df['error'][_0x36b9('0x14')]);}else{logger[_0x36b9('0xe')](_0x36b9('0xf'),_0x333c4b,_0x36b9('0x10'));_0x244709(_0x32d8df[_0x36b9('0x15')][_0x36b9('0x14')]);}})[_0x36b9('0x16')](function(_0x3ff38c){logger[_0x36b9('0x13')](_0x36b9('0xf'),_0x333c4b,_0x3ff38c);_0x5c2fed(_0x3ff38c);});});}exports[_0x36b9('0x17')]=function(_0x5b405f){var _0xbb6530=this;return new Promise(function(_0x347e7e,_0x3752d2){return db[_0x36b9('0x18')]['findAll']({'raw':_0x5b405f[_0x36b9('0x19')]?_0x5b405f[_0x36b9('0x19')][_0x36b9('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b405f[_0x36b9('0x19')]?_0x5b405f['options'][_0x36b9('0x1b')]||null:null,'attributes':_0x5b405f[_0x36b9('0x19')]?_0x5b405f['options']['attributes']||null:null,'limit':_0x5b405f['options']?_0x5b405f['options'][_0x36b9('0x1c')]||null:null,'include':_0x5b405f[_0x36b9('0x19')]?_0x5b405f[_0x36b9('0x19')][_0x36b9('0x1d')]?_[_0x36b9('0x1e')](_0x5b405f['options'][_0x36b9('0x1d')],function(_0x1404c1){return{'model':db[_0x1404c1['model']],'as':_0x1404c1['as'],'attributes':_0x1404c1[_0x36b9('0x1f')],'include':_0x1404c1[_0x36b9('0x1d')]?_[_0x36b9('0x1e')](_0x1404c1[_0x36b9('0x1d')],function(_0xeff369){return{'model':db[_0xeff369[_0x36b9('0x20')]],'as':_0xeff369['as'],'attributes':_0xeff369['attributes'],'include':_0xeff369[_0x36b9('0x1d')]?_[_0x36b9('0x1e')](_0xeff369[_0x36b9('0x1d')],function(_0x5f804c){return{'model':db[_0x5f804c[_0x36b9('0x20')]],'as':_0x5f804c['as'],'attributes':_0x5f804c[_0x36b9('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ac08f){logger[_0x36b9('0xe')](_0x36b9('0x17'),_0x5b405f);logger[_0x36b9('0x21')]('GetTrigger',_0x5b405f,JSON[_0x36b9('0x12')](_0x2ac08f));_0x347e7e(_0x2ac08f);})[_0x36b9('0x16')](function(_0x2ce7f6){logger['error'](_0x36b9('0x17'),_0x2ce7f6['message'],_0x5b405f);_0x3752d2(_0xbb6530['error'](0x1f4,_0x2ce7f6[_0x36b9('0x14')]));});});};exports[_0x36b9('0x22')]=function(_0x217e9c){var _0x28d0f8=this;return new Promise(function(_0x43756c,_0x4724cd){return db[_0x36b9('0x18')][_0x36b9('0x23')]({'raw':_0x217e9c[_0x36b9('0x19')]?_0x217e9c['options'][_0x36b9('0x1a')]===undefined?!![]:![]:!![],'where':_0x217e9c[_0x36b9('0x19')]?_0x217e9c[_0x36b9('0x19')][_0x36b9('0x1b')]||null:null,'attributes':_0x217e9c[_0x36b9('0x19')]?_0x217e9c[_0x36b9('0x19')][_0x36b9('0x1f')]||null:null,'include':_0x217e9c[_0x36b9('0x19')]?_0x217e9c[_0x36b9('0x19')][_0x36b9('0x1d')]?_[_0x36b9('0x1e')](_0x217e9c[_0x36b9('0x19')][_0x36b9('0x1d')],function(_0x5b1af4){return{'model':db[_0x5b1af4[_0x36b9('0x20')]],'as':_0x5b1af4['as'],'attributes':_0x5b1af4['attributes'],'include':_0x5b1af4[_0x36b9('0x1d')]?_[_0x36b9('0x1e')](_0x5b1af4['include'],function(_0x209219){return{'model':db[_0x209219[_0x36b9('0x20')]],'as':_0x209219['as'],'attributes':_0x209219[_0x36b9('0x1f')],'include':_0x209219['include']?_['map'](_0x209219[_0x36b9('0x1d')],function(_0x199933){return{'model':db[_0x199933[_0x36b9('0x20')]],'as':_0x199933['as'],'attributes':_0x199933[_0x36b9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x36b9('0x24')](function(_0x34af4f){logger[_0x36b9('0xe')](_0x36b9('0x22'),_0x217e9c);logger['debug']('ShowTrigger',_0x217e9c,JSON[_0x36b9('0x12')](_0x34af4f));_0x43756c(_0x34af4f);})[_0x36b9('0x16')](function(_0x21b3db){logger[_0x36b9('0x13')]('ShowTrigger',_0x21b3db[_0x36b9('0x14')],_0x217e9c);_0x4724cd(_0x28d0f8[_0x36b9('0x13')](0x1f4,_0x21b3db[_0x36b9('0x14')]));});});}; \ No newline at end of file +var _0x8de0=['rpc','../../config/environment','jayson/promise','request','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','error','code','Trigger,\x20%s,\x20%s','message','info','result','catch','Trigger','findAll','options','raw','attributes','include','model','map','then','GetTrigger','debug','stringify','ShowTrigger','where','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3a8db5,_0x31cff7){var _0x2c03cd=function(_0x47dba0){while(--_0x47dba0){_0x3a8db5['push'](_0x3a8db5['shift']());}};_0x2c03cd(++_0x31cff7);}(_0x8de0,0x102));var _0x08de=function(_0xa091ec,_0x1cf122){_0xa091ec=_0xa091ec-0x0;var _0x834bd4=_0x8de0[_0xa091ec];return _0x834bd4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x08de('0x0'));var BPromise=require(_0x08de('0x1'));var rs=require(_0x08de('0x2'));var fs=require('fs');var Redis=require(_0x08de('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x08de('0x4'));var logger=require(_0x08de('0x5'))(_0x08de('0x6'));var config=require(_0x08de('0x7'));var jayson=require(_0x08de('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa1e64,_0x191488,_0x398539){return new BPromise(function(_0x3ae1c6,_0x421c4a){return client[_0x08de('0x9')](_0xa1e64,_0x398539)['then'](function(_0x5ca898){logger['info']('Trigger,\x20%s,\x20%s',_0x191488,_0x08de('0xa'));logger['debug'](_0x08de('0xb'),_0x191488,_0x08de('0xa'),JSON['stringify'](_0x5ca898));if(_0x5ca898[_0x08de('0xc')]){if(_0x5ca898[_0x08de('0xc')][_0x08de('0xd')]===0x1f4){logger['error'](_0x08de('0xe'),_0x191488,_0x5ca898[_0x08de('0xc')][_0x08de('0xf')]);return _0x421c4a(_0x5ca898['error']['message']);}logger[_0x08de('0xc')](_0x08de('0xe'),_0x191488,_0x5ca898[_0x08de('0xc')]['message']);return _0x3ae1c6(_0x5ca898[_0x08de('0xc')][_0x08de('0xf')]);}else{logger[_0x08de('0x10')](_0x08de('0xe'),_0x191488,_0x08de('0xa'));_0x3ae1c6(_0x5ca898[_0x08de('0x11')][_0x08de('0xf')]);}})[_0x08de('0x12')](function(_0x38abf4){logger[_0x08de('0xc')](_0x08de('0xe'),_0x191488,_0x38abf4);_0x421c4a(_0x38abf4);});});}exports['GetTrigger']=function(_0x16986c){var _0xc53440=this;return new Promise(function(_0x3cdc05,_0x39773c){return db[_0x08de('0x13')][_0x08de('0x14')]({'raw':_0x16986c[_0x08de('0x15')]?_0x16986c[_0x08de('0x15')][_0x08de('0x16')]===undefined?!![]:![]:!![],'where':_0x16986c[_0x08de('0x15')]?_0x16986c[_0x08de('0x15')]['where']||null:null,'attributes':_0x16986c['options']?_0x16986c[_0x08de('0x15')][_0x08de('0x17')]||null:null,'limit':_0x16986c[_0x08de('0x15')]?_0x16986c['options']['limit']||null:null,'include':_0x16986c[_0x08de('0x15')]?_0x16986c[_0x08de('0x15')][_0x08de('0x18')]?_['map'](_0x16986c[_0x08de('0x15')]['include'],function(_0x4f978c){return{'model':db[_0x4f978c[_0x08de('0x19')]],'as':_0x4f978c['as'],'attributes':_0x4f978c[_0x08de('0x17')],'include':_0x4f978c[_0x08de('0x18')]?_[_0x08de('0x1a')](_0x4f978c[_0x08de('0x18')],function(_0xbdbfc1){return{'model':db[_0xbdbfc1[_0x08de('0x19')]],'as':_0xbdbfc1['as'],'attributes':_0xbdbfc1[_0x08de('0x17')],'include':_0xbdbfc1[_0x08de('0x18')]?_[_0x08de('0x1a')](_0xbdbfc1[_0x08de('0x18')],function(_0x232f66){return{'model':db[_0x232f66[_0x08de('0x19')]],'as':_0x232f66['as'],'attributes':_0x232f66[_0x08de('0x17')]};}):[]};}):[]};}):[]:[]})[_0x08de('0x1b')](function(_0x430088){logger[_0x08de('0x10')](_0x08de('0x1c'),_0x16986c);logger[_0x08de('0x1d')](_0x08de('0x1c'),_0x16986c,JSON[_0x08de('0x1e')](_0x430088));_0x3cdc05(_0x430088);})['catch'](function(_0x5e827a){logger[_0x08de('0xc')](_0x08de('0x1c'),_0x5e827a[_0x08de('0xf')],_0x16986c);_0x39773c(_0xc53440[_0x08de('0xc')](0x1f4,_0x5e827a[_0x08de('0xf')]));});});};exports[_0x08de('0x1f')]=function(_0x330067){var _0x5ed7d4=this;return new Promise(function(_0x455772,_0x37d321){return db[_0x08de('0x13')]['find']({'raw':_0x330067['options']?_0x330067[_0x08de('0x15')][_0x08de('0x16')]===undefined?!![]:![]:!![],'where':_0x330067[_0x08de('0x15')]?_0x330067[_0x08de('0x15')][_0x08de('0x20')]||null:null,'attributes':_0x330067['options']?_0x330067[_0x08de('0x15')]['attributes']||null:null,'include':_0x330067[_0x08de('0x15')]?_0x330067[_0x08de('0x15')][_0x08de('0x18')]?_['map'](_0x330067['options'][_0x08de('0x18')],function(_0x16353d){return{'model':db[_0x16353d[_0x08de('0x19')]],'as':_0x16353d['as'],'attributes':_0x16353d[_0x08de('0x17')],'include':_0x16353d['include']?_[_0x08de('0x1a')](_0x16353d[_0x08de('0x18')],function(_0x20f11d){return{'model':db[_0x20f11d[_0x08de('0x19')]],'as':_0x20f11d['as'],'attributes':_0x20f11d[_0x08de('0x17')],'include':_0x20f11d[_0x08de('0x18')]?_[_0x08de('0x1a')](_0x20f11d[_0x08de('0x18')],function(_0x15523f){return{'model':db[_0x15523f['model']],'as':_0x15523f['as'],'attributes':_0x15523f[_0x08de('0x17')]};}):[]};}):[]};}):[]:[]})[_0x08de('0x1b')](function(_0x1297b4){logger[_0x08de('0x10')](_0x08de('0x1f'),_0x330067);logger[_0x08de('0x1d')](_0x08de('0x1f'),_0x330067,JSON[_0x08de('0x1e')](_0x1297b4));_0x455772(_0x1297b4);})[_0x08de('0x12')](function(_0x451b5e){logger[_0x08de('0xc')]('ShowTrigger',_0x451b5e['message'],_0x330067);_0x37d321(_0x5ed7d4[_0x08de('0xc')](0x1f4,_0x451b5e[_0x08de('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index ac6afac..94028f9 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 _0x90a8=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','clone','post','create','put','delete','destroy'];(function(_0x395b8e,_0x5dc10a){var _0x242d83=function(_0x3d0984){while(--_0x3d0984){_0x395b8e['push'](_0x395b8e['shift']());}};_0x242d83(++_0x5dc10a);}(_0x90a8,0xeb));var _0x890a=function(_0x1266bb,_0x233ff5){_0x1266bb=_0x1266bb-0x0;var _0x5eab84=_0x90a8[_0x1266bb];return _0x5eab84;};'use strict';var multer=require(_0x890a('0x0'));var util=require('util');var path=require(_0x890a('0x1'));var timeout=require(_0x890a('0x2'));var express=require(_0x890a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x890a('0x4'));var interaction=require(_0x890a('0x5'));var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0x890a('0x6')]('/',auth['isAuthenticated'](),controller[_0x890a('0x7')]);router[_0x890a('0x6')](_0x890a('0x8'),auth[_0x890a('0x9')](),controller[_0x890a('0xa')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x890a('0xb')]);router[_0x890a('0xc')]('/',auth['isAuthenticated'](),controller[_0x890a('0xd')]);router[_0x890a('0xe')](_0x890a('0x8'),auth[_0x890a('0x9')](),controller['update']);router[_0x890a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x890a('0x10')]);module[_0x890a('0x11')]=router; \ No newline at end of file +var _0xfd8e=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','show','post','/:id/clone','clone'];(function(_0x44e8ec,_0x3f3b56){var _0xfd4a09=function(_0x143b94){while(--_0x143b94){_0x44e8ec['push'](_0x44e8ec['shift']());}};_0xfd4a09(++_0x3f3b56);}(_0xfd8e,0x73));var _0xefd8=function(_0x1f9fae,_0x108bf2){_0x1f9fae=_0x1f9fae-0x0;var _0x491b82=_0xfd8e[_0x1f9fae];return _0x491b82;};'use strict';var multer=require(_0xefd8('0x0'));var util=require(_0xefd8('0x1'));var path=require(_0xefd8('0x2'));var timeout=require(_0xefd8('0x3'));var express=require(_0xefd8('0x4'));var router=express['Router']();var fs_extra=require(_0xefd8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xefd8('0x6'));var config=require(_0xefd8('0x7'));var controller=require(_0xefd8('0x8'));router[_0xefd8('0x9')]('/',auth['isAuthenticated'](),controller[_0xefd8('0xa')]);router['get'](_0xefd8('0xb'),auth[_0xefd8('0xc')](),controller[_0xefd8('0xd')]);router[_0xefd8('0xe')](_0xefd8('0xf'),auth[_0xefd8('0xc')](),controller[_0xefd8('0x10')]);router[_0xefd8('0xe')]('/',auth[_0xefd8('0xc')](),controller[_0xefd8('0x11')]);router['put']('/:id',auth[_0xefd8('0xc')](),controller[_0xefd8('0x12')]);router[_0xefd8('0x13')](_0xefd8('0xb'),auth[_0xefd8('0xc')](),controller[_0xefd8('0x14')]);module[_0xefd8('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 29e8b17..4604ffc 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 _0xca5a=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','INTEGER','always','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','BOOLEAN','sequelize','exports','name','ENUM','friend','user','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','outgoing','nat','all','ulaw;alaw;gsm','allow','port,invite','insecure'];(function(_0x1c8f47,_0x1af9c4){var _0x2977fc=function(_0x3380ca){while(--_0x3380ca){_0x1c8f47['push'](_0x1c8f47['shift']());}};_0x2977fc(++_0x1af9c4);}(_0xca5a,0x72));var _0xaca5=function(_0xd8d758,_0x153ed5){_0xd8d758=_0xd8d758-0x0;var _0x55628d=_0xca5a[_0xd8d758];return _0x55628d;};'use strict';var Sequelize=require(_0xaca5('0x0'));module[_0xaca5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xaca5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x4'),_0xaca5('0x5'),_0xaca5('0x6')),'allowNull':![],'defaultValue':_0xaca5('0x4')},'context':{'type':Sequelize[_0xaca5('0x7')],'allowNull':![],'defaultValue':_0xaca5('0x8')},'callingpres':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x9'),'ALLOWED_PASSED_SCREEN',_0xaca5('0xa'),_0xaca5('0xb'),_0xaca5('0xc'),_0xaca5('0xd'),_0xaca5('0xe'),'PROHIB')},'deny':{'type':Sequelize[_0xaca5('0x7')]},'permit':{'type':Sequelize[_0xaca5('0x7')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xaca5('0x7')]},'remotesecret':{'type':Sequelize[_0xaca5('0x7')]},'transport':{'type':Sequelize[_0xaca5('0x7')],'defaultValue':_0xaca5('0xf'),'set':function(_0x5cc3c7){this[_0xaca5('0x10')](_0xaca5('0x11'),_0x5cc3c7?_0x5cc3c7[_0xaca5('0x12')](','):null);},'get':function(){return this[_0xaca5('0x13')]('transport')?this['getDataValue'](_0xaca5('0x11'))[_0xaca5('0x14')](','):null;},'comment':_0xaca5('0x15')},'dtmfmode':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x16'),_0xaca5('0x17'),_0xaca5('0x18'),'inband',_0xaca5('0x19')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x1a'),'no',_0xaca5('0x1b'),_0xaca5('0x1c'),_0xaca5('0x1d')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xaca5('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xaca5('0x7')]},'directmediadeny':{'type':Sequelize[_0xaca5('0x7')]},'nat':{'type':Sequelize[_0xaca5('0x7')],'defaultValue':'force_rport,comedia','set':function(_0x541d81){this[_0xaca5('0x10')](_0xaca5('0x1e'),_0x541d81?_0x541d81['join'](','):null);},'get':function(){return this[_0xaca5('0x13')](_0xaca5('0x1e'))?this[_0xaca5('0x13')](_0xaca5('0x1e'))[_0xaca5('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xaca5('0x7')]},'language':{'type':Sequelize[_0xaca5('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xaca5('0x7')],'defaultValue':_0xaca5('0x1f')},'allow':{'type':Sequelize[_0xaca5('0x7')],'allowNull':![],'defaultValue':_0xaca5('0x20'),'set':function(_0x355df4){this[_0xaca5('0x10')](_0xaca5('0x21'),_0x355df4?_0x355df4[_0xaca5('0x12')](';'):_0xaca5('0x20'));},'get':function(){return this[_0xaca5('0x13')]('allow')?this[_0xaca5('0x13')](_0xaca5('0x21'))[_0xaca5('0x14')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xaca5('0x1a'),'no')},'insecure':{'type':Sequelize[_0xaca5('0x7')],'defaultValue':_0xaca5('0x22'),'set':function(_0x593756){this[_0xaca5('0x10')](_0xaca5('0x23'),_0x593756?_0x593756['join'](','):null);},'get':function(){return this['getDataValue'](_0xaca5('0x23'))?this[_0xaca5('0x13')](_0xaca5('0x23'))[_0xaca5('0x14')](','):null;},'comment':_0xaca5('0x24')},'trustrpid':{'type':Sequelize[_0xaca5('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xaca5('0x3')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x1a'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xaca5('0x7')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xaca5('0x25')},'amaflags':{'type':Sequelize[_0xaca5('0x7')]},'callcounter':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x1a'),'no'),'defaultValue':_0xaca5('0x1a')},'busylevel':{'type':Sequelize[_0xaca5('0x26')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0xaca5('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0xaca5('0x7')]},'template':{'type':Sequelize[_0xaca5('0x7')]},'videosupport':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x1a'),'no',_0xaca5('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xaca5('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x1a'),'no')},'mailbox':{'type':Sequelize[_0xaca5('0x7')]},'session_timers':{'type':Sequelize[_0xaca5('0x3')]('accept','refuse','originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xaca5('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x28'),_0xaca5('0x29')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xaca5('0x7')]},'fromdomain':{'type':Sequelize[_0xaca5('0x7')]},'fromuser':{'type':Sequelize[_0xaca5('0x7')]},'port':{'type':Sequelize[_0xaca5('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xaca5('0x1a'),'no'),'defaultValue':_0xaca5('0x1a')},'keepalive':{'type':Sequelize[_0xaca5('0x26')](0xb)},'defaultip':{'type':Sequelize[_0xaca5('0x7')]},'defaultuser':{'type':Sequelize[_0xaca5('0x7')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xaca5('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xaca5('0x26')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xaca5('0x1a'),'no',_0xaca5('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xaca5('0x7')]},'callbackextension':{'type':Sequelize[_0xaca5('0x7')]},'timert1':{'type':Sequelize[_0xaca5('0x26')](0xb)},'timerb':{'type':Sequelize[_0xaca5('0x26')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xaca5('0x7')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xaca5('0x7')]},'use_q850_reason':{'type':Sequelize[_0xaca5('0x7')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xaca5('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x1a'),'no')},'force_avp':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x1a'),'no')},'icesupport':{'type':Sequelize[_0xaca5('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xaca5('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x1a'),'no',_0xaca5('0x2b'),_0xaca5('0x2c'))},'dtlsrekey':{'type':Sequelize[_0xaca5('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0xaca5('0x7')]},'dtlsprivatekey':{'type':Sequelize[_0xaca5('0x7')]},'dtlscipher':{'type':Sequelize[_0xaca5('0x7')]},'dtlscafile':{'type':Sequelize[_0xaca5('0x7')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x2d'),_0xaca5('0x2e'),_0xaca5('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xaca5('0x7')]},'usereqphone':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xaca5('0x7')]},'call_limit':{'type':Sequelize[_0xaca5('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0xaca5('0x3')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xaca5('0x7')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xaca5('0x7')]},'description':{'type':Sequelize[_0xaca5('0x7')]},'host':{'type':Sequelize[_0xaca5('0x7')],'defaultValue':_0xaca5('0x30')},'canreinvite':{'type':Sequelize[_0xaca5('0x3')](_0xaca5('0x1a'),'no',_0xaca5('0x1b'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xaca5('0x7')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xaca5('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xaca5('0x7')],'defaultValue':'no'}}; \ No newline at end of file +var _0x3d43=['yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','never','INTEGER','always','accept','refuse','originate','uac','uas','passive','actpass','BOOLEAN','exports','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto'];(function(_0x3754bf,_0x2d60fe){var _0x341082=function(_0x8e900c){while(--_0x8e900c){_0x3754bf['push'](_0x3754bf['shift']());}};_0x341082(++_0x2d60fe);}(_0x3d43,0xa6));var _0x33d4=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x3d43[_0x35e92e];return _0x1205a8;};'use strict';var Sequelize=require('sequelize');module[_0x33d4('0x0')]={'name':{'type':Sequelize[_0x33d4('0x1')],'allowNull':![],'unique':_0x33d4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x4'),'user',_0x33d4('0x5')),'allowNull':![],'defaultValue':_0x33d4('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x33d4('0x6')},'callingpres':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x7'),_0x33d4('0x8'),_0x33d4('0x9'),_0x33d4('0xa'),'PROHIB_NOT_SCREENED',_0x33d4('0xb'),_0x33d4('0xc'),_0x33d4('0xd'))},'deny':{'type':Sequelize[_0x33d4('0x1')]},'permit':{'type':Sequelize[_0x33d4('0x1')]},'secret':{'type':Sequelize[_0x33d4('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x33d4('0x1')]},'transport':{'type':Sequelize[_0x33d4('0x1')],'defaultValue':_0x33d4('0xe'),'set':function(_0x6d3e9f){this[_0x33d4('0xf')](_0x33d4('0x10'),_0x6d3e9f?_0x6d3e9f[_0x33d4('0x11')](','):null);},'get':function(){return this[_0x33d4('0x12')](_0x33d4('0x10'))?this[_0x33d4('0x12')](_0x33d4('0x10'))[_0x33d4('0x13')](','):null;},'comment':_0x33d4('0x14')},'dtmfmode':{'type':Sequelize['ENUM'](_0x33d4('0x15'),_0x33d4('0x16'),_0x33d4('0x17'),_0x33d4('0x18'),_0x33d4('0x19')),'defaultValue':_0x33d4('0x15')},'directmedia':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no',_0x33d4('0x1b'),_0x33d4('0x1c'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x33d4('0x1')]},'directmediadeny':{'type':Sequelize[_0x33d4('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x33d4('0x1d'),'set':function(_0x58e1ec){this[_0x33d4('0xf')](_0x33d4('0x1e'),_0x58e1ec?_0x58e1ec[_0x33d4('0x11')](','):null);},'get':function(){return this[_0x33d4('0x12')](_0x33d4('0x1e'))?this['getDataValue']('nat')['split'](','):null;},'comment':_0x33d4('0x1f')},'callgroup':{'type':Sequelize[_0x33d4('0x1')]},'namedcallgroup':{'type':Sequelize[_0x33d4('0x1')]},'pickupgroup':{'type':Sequelize[_0x33d4('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x33d4('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x33d4('0x20')},'allow':{'type':Sequelize[_0x33d4('0x1')],'allowNull':![],'defaultValue':_0x33d4('0x21'),'set':function(_0x4c256c){this['setDataValue']('allow',_0x4c256c?_0x4c256c['join'](';'):_0x33d4('0x21'));},'get':function(){return this[_0x33d4('0x12')](_0x33d4('0x22'))?this[_0x33d4('0x12')]('allow')[_0x33d4('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x33d4('0x23'),'set':function(_0x27fb2b){this['setDataValue'](_0x33d4('0x24'),_0x27fb2b?_0x27fb2b[_0x33d4('0x11')](','):null);},'get':function(){return this[_0x33d4('0x12')](_0x33d4('0x24'))?this['getDataValue'](_0x33d4('0x24'))[_0x33d4('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x33d4('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no',_0x33d4('0x25'))},'promiscredir':{'type':Sequelize['ENUM'](_0x33d4('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x33d4('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x33d4('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x33d4('0x1a'),'no'),'defaultValue':_0x33d4('0x1a')},'busylevel':{'type':Sequelize[_0x33d4('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x33d4('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0x33d4('0x1')]},'template':{'type':Sequelize[_0x33d4('0x1')]},'videosupport':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no',_0x33d4('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x33d4('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'mailbox':{'type':Sequelize[_0x33d4('0x1')]},'session_timers':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x28'),_0x33d4('0x29'),_0x33d4('0x2a'))},'session_expires':{'type':Sequelize[_0x33d4('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x33d4('0x2b'),_0x33d4('0x2c')),'defaultValue':_0x33d4('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x33d4('0x1')]},'regexten':{'type':Sequelize[_0x33d4('0x1')]},'fromdomain':{'type':Sequelize[_0x33d4('0x1')]},'fromuser':{'type':Sequelize[_0x33d4('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x33d4('0x3')]('yes','no'),'defaultValue':_0x33d4('0x1a')},'keepalive':{'type':Sequelize[_0x33d4('0x26')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x33d4('0x1')]},'rtptimeout':{'type':Sequelize[_0x33d4('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x33d4('0x26')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x33d4('0x1a'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x33d4('0x1')]},'callbackextension':{'type':Sequelize[_0x33d4('0x1')]},'timert1':{'type':Sequelize[_0x33d4('0x26')](0xb)},'timerb':{'type':Sequelize[_0x33d4('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x33d4('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x33d4('0x1')]},'contactdeny':{'type':Sequelize[_0x33d4('0x1')]},'contactacl':{'type':Sequelize[_0x33d4('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x33d4('0x1')]},'use_q850_reason':{'type':Sequelize[_0x33d4('0x1')]},'maxforwards':{'type':Sequelize[_0x33d4('0x26')](0xb)},'encryption':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x33d4('0x1a'),'no')},'icesupport':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0x33d4('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x33d4('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x33d4('0x1')]},'dtlscipher':{'type':Sequelize[_0x33d4('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x33d4('0x1')]},'dtlssetup':{'type':Sequelize[_0x33d4('0x3')]('active',_0x33d4('0x2d'),_0x33d4('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x33d4('0x1')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x33d4('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x33d4('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'vmexten':{'type':Sequelize[_0x33d4('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x33d4('0x1')]},'parkinglot':{'type':Sequelize[_0x33d4('0x1')]},'description':{'type':Sequelize[_0x33d4('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x33d4('0x1b'),_0x33d4('0x1c'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x33d4('0x1')]},'active':{'type':Sequelize[_0x33d4('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x33d4('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 5a48461..6dc9a4a 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 _0x9c44=['key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','clone','find','omit','createdAt','body','updatedAt','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','params','/etc/asterisk/sip_xcally_registers.conf','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','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','get','Trunks','destroy','stack','name','send','index','Trunk','rawAttributes','fieldName','type'];(function(_0x23e3eb,_0x419ae8){var _0x1c9ab6=function(_0x3922a2){while(--_0x3922a2){_0x23e3eb['push'](_0x23e3eb['shift']());}};_0x1c9ab6(++_0x419ae8);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'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'];var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x16')][_0x49c4('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5f2fd9,_0x1909fe,_0x280996,_0x21f15a){return new BPromise(function(_0x2decee,_0x12777c){var _0x18211c=_0x21f15a||client;return _0x18211c[_0x49c4('0x18')](_0x5f2fd9,_0x280996)[_0x49c4('0x19')](function(_0x58d177){logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));logger[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x1909fe,'request\x20sent',JSON[_0x49c4('0x1f')](_0x58d177));if(_0x58d177[_0x49c4('0x20')]){if(_0x58d177['error']['code']===0x1f4){logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')]['message']);return _0x12777c(_0x58d177[_0x49c4('0x20')]['message']);}logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);return _0x2decee(_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);}else{logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));_0x2decee(_0x58d177['result']['message']);}})['catch'](function(_0x1c99b1){logger['error']('Trunk,\x20%s,\x20%s',_0x1909fe,_0x1c99b1);_0x12777c(_0x1c99b1);});});}function respondWithStatusCode(_0x2263ae,_0x15581b){_0x15581b=_0x15581b||0xcc;return function(_0x26c640){if(_0x26c640){return _0x2263ae[_0x49c4('0x22')](_0x15581b);}return _0x2263ae['status'](_0x15581b)['end']();};}function respondWithResult(_0x180276,_0x9cb797){_0x9cb797=_0x9cb797||0xc8;return function(_0x565423){if(_0x565423){return _0x180276[_0x49c4('0x23')](_0x9cb797)[_0x49c4('0x24')](_0x565423);}};}function respondWithFilteredResult(_0x210159,_0xa7a826){return function(_0x531d92){if(_0x531d92){var _0x543ea2=typeof _0xa7a826[_0x49c4('0x25')]==='undefined'&&typeof _0xa7a826[_0x49c4('0x26')]===_0x49c4('0x27');var _0x3f1708=_0x531d92[_0x49c4('0x28')];var _0x5987ae=_0x543ea2?0x0:_0xa7a826[_0x49c4('0x25')];var _0x2b2793=_0x543ea2?_0x531d92[_0x49c4('0x28')]:_0xa7a826[_0x49c4('0x25')]+_0xa7a826[_0x49c4('0x26')];var _0x29f835;if(_0x2b2793>=_0x3f1708){_0x2b2793=_0x3f1708;_0x29f835=0xc8;}else{_0x29f835=0xce;}_0x210159[_0x49c4('0x23')](_0x29f835);return _0x210159[_0x49c4('0x29')](_0x49c4('0x2a'),_0x5987ae+'-'+_0x2b2793+'/'+_0x3f1708)[_0x49c4('0x24')](_0x531d92);}return null;};}function patchUpdates(_0x46f7ea){return function(_0x4ea6ea){try{jsonpatch['apply'](_0x4ea6ea,_0x46f7ea,!![]);}catch(_0x59eb84){return BPromise[_0x49c4('0x2b')](_0x59eb84);}return _0x4ea6ea[_0x49c4('0x2c')]();};}function saveUpdates(_0x1eb035,_0x27e467){return function(_0x28eb47){if(_0x28eb47){return _0x28eb47['update'](_0x1eb035)[_0x49c4('0x19')](function(_0x116eb4){return _0x116eb4;});}return null;};}function removeEntity(_0x2e7a69,_0x24bba9){return function(_0x58e252){if(_0x58e252){return _0x58e252['destroy']()[_0x49c4('0x19')](function(){var _0x9a1bed=_0x58e252[_0x49c4('0x2d')]({'plain':!![]});var _0x13b3b4=_0x49c4('0x2e');return db['UserProfileResource'][_0x49c4('0x2f')]({'where':{'type':_0x13b3b4,'resourceId':_0x9a1bed['id']}})[_0x49c4('0x19')](function(){return _0x58e252;});})[_0x49c4('0x19')](function(){_0x2e7a69['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x85dce2,_0x1991e9){return function(_0x3bec0a){if(!_0x3bec0a){_0x85dce2[_0x49c4('0x22')](0x194);}return _0x3bec0a;};}function handleError(_0x2b45a1,_0x2cf897){_0x2cf897=_0x2cf897||0x1f4;return function(_0x1d1557){logger[_0x49c4('0x20')](_0x1d1557[_0x49c4('0x30')]);if(_0x1d1557['name']){delete _0x1d1557[_0x49c4('0x31')];}_0x2b45a1['status'](_0x2cf897)[_0x49c4('0x32')](_0x1d1557);};}exports[_0x49c4('0x33')]=function(_0x2625a6,_0x1c2830){var _0x4ed4f8={},_0x335f0c={},_0x31f3ff={'count':0x0,'rows':[]};var _0x1c910a=_['map'](db[_0x49c4('0x34')][_0x49c4('0x35')],function(_0x178987){return{'name':_0x178987[_0x49c4('0x36')],'type':_0x178987[_0x49c4('0x37')][_0x49c4('0x38')]};});_0x335f0c[_0x49c4('0x39')]=_[_0x49c4('0x3a')](_0x1c910a,_0x49c4('0x31'));_0x335f0c[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2625a6['query']);_0x335f0c[_0x49c4('0x3d')]=_[_0x49c4('0x3e')](_0x335f0c[_0x49c4('0x39')],_0x335f0c[_0x49c4('0x3b')]);_0x4ed4f8[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x335f0c[_0x49c4('0x39')],qs[_0x49c4('0x40')](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x40')]));_0x4ed4f8[_0x49c4('0x3f')]=_0x4ed4f8[_0x49c4('0x3f')][_0x49c4('0x41')]?_0x4ed4f8['attributes']:_0x335f0c[_0x49c4('0x39')];if(!_0x2625a6['query'][_0x49c4('0x42')](_0x49c4('0x43'))){_0x4ed4f8[_0x49c4('0x26')]=qs[_0x49c4('0x26')](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x26')]);_0x4ed4f8['offset']=qs['offset'](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x25')]);}_0x4ed4f8[_0x49c4('0x44')]=qs[_0x49c4('0x45')](_0x2625a6['query'][_0x49c4('0x45')]);_0x4ed4f8[_0x49c4('0x46')]=qs[_0x49c4('0x3d')](_[_0x49c4('0x47')](_0x2625a6[_0x49c4('0x3b')],_0x335f0c[_0x49c4('0x3d')]),_0x1c910a);if(_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x48')]){_0x4ed4f8[_0x49c4('0x46')]=_['merge'](_0x4ed4f8[_0x49c4('0x46')],{'$or':_['map'](_0x1c910a,function(_0x33696e){if(_0x33696e[_0x49c4('0x37')]!==_0x49c4('0x49')){var _0x258abe={};_0x258abe[_0x33696e[_0x49c4('0x31')]]={'$like':'%'+_0x2625a6['query'][_0x49c4('0x48')]+'%'};return _0x258abe;}})});}_0x4ed4f8=_[_0x49c4('0x4a')]({},_0x4ed4f8,_0x2625a6[_0x49c4('0x4b')]);var _0x254d07={'where':_0x4ed4f8[_0x49c4('0x46')]};return db[_0x49c4('0x34')][_0x49c4('0x28')](_0x254d07)['then'](function(_0x3bac1b){_0x31f3ff['count']=_0x3bac1b;if(_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x4c')]){_0x4ed4f8[_0x49c4('0x4d')]=[{'all':!![]}];}return db[_0x49c4('0x34')][_0x49c4('0x4e')](_0x4ed4f8);})[_0x49c4('0x19')](function(_0x2c6be1){_0x31f3ff['rows']=_0x2c6be1;return _0x31f3ff;})[_0x49c4('0x19')](respondWithFilteredResult(_0x1c2830,_0x4ed4f8))[_0x49c4('0x4f')](handleError(_0x1c2830,null));};exports['show']=function(_0x1e1ac4,_0xaece5f){var _0xfbe179={'raw':![],'where':{'id':_0x1e1ac4['params']['id']}},_0x242afc={};_0x242afc['model']=_[_0x49c4('0x3c')](db['Trunk'][_0x49c4('0x35')]);_0x242afc[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x1e1ac4[_0x49c4('0x3b')]);_0x242afc[_0x49c4('0x3d')]=_[_0x49c4('0x3e')](_0x242afc[_0x49c4('0x39')],_0x242afc['query']);_0xfbe179[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x242afc[_0x49c4('0x39')],qs[_0x49c4('0x40')](_0x1e1ac4[_0x49c4('0x3b')][_0x49c4('0x40')]));_0xfbe179[_0x49c4('0x3f')]=_0xfbe179[_0x49c4('0x3f')][_0x49c4('0x41')]?_0xfbe179[_0x49c4('0x3f')]:_0x242afc['model'];if(_0x1e1ac4['query'][_0x49c4('0x4c')]){_0xfbe179[_0x49c4('0x4d')]=[{'all':!![]}];}_0xfbe179=_['merge']({},_0xfbe179,_0x1e1ac4['options']);return db[_0x49c4('0x34')]['find'](_0xfbe179)['then'](handleEntityNotFound(_0xaece5f,null))[_0x49c4('0x19')](respondWithResult(_0xaece5f,null))[_0x49c4('0x4f')](handleError(_0xaece5f,null));};exports[_0x49c4('0x50')]=function(_0x38c480,_0x2884ca){var _0x16949a={'where':{'id':_0x38c480['params']['id']}},_0x35724e={};_0x35724e[_0x49c4('0x39')]=_[_0x49c4('0x3c')](db[_0x49c4('0x34')][_0x49c4('0x35')]);_0x16949a[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x35724e['model'],qs['fields'](_0x38c480[_0x49c4('0x3b')][_0x49c4('0x40')]));_0x16949a[_0x49c4('0x3f')]=_0x16949a[_0x49c4('0x3f')][_0x49c4('0x41')]?_0x16949a[_0x49c4('0x3f')]:_0x35724e[_0x49c4('0x39')];if(_0x38c480['query'][_0x49c4('0x4c')]){_0x16949a[_0x49c4('0x4d')]=[{'all':!![]}];}_0x16949a=_['merge']({},_0x16949a,_0x38c480[_0x49c4('0x4b')]);return db['Trunk'][_0x49c4('0x51')](_0x16949a)[_0x49c4('0x19')](handleEntityNotFound(_0x2884ca,null))[_0x49c4('0x19')](function(_0x2fe89a){if(_0x2fe89a){var _0x845f7e=_0x2fe89a[_0x49c4('0x2d')]({'plain':!![]});_0x845f7e=qs[_0x49c4('0x52')](_0x845f7e,['id',_0x49c4('0x53'),'updatedAt']);_0x38c480[_0x49c4('0x54')]=_[_0x49c4('0x52')](_0x38c480['body'],['id',_0x49c4('0x53'),_0x49c4('0x55')]);return db['Trunk'][_0x49c4('0x56')](_[_0x49c4('0x4a')](_0x845f7e,_0x38c480['body']),{'include':_0x38c480['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0xc43386){var _0x54947d=_0x38c480[_0x49c4('0x57')][_0x49c4('0x2d')]({'plain':!![]});if(!_0x54947d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54947d[_0x49c4('0x58')]===_0x49c4('0x57')){var _0x5ac9f0=_0xc43386[_0x49c4('0x2d')]({'plain':!![]});var _0x3dcf4c=_0x49c4('0x2e');return db[_0x49c4('0x59')]['find']({'where':{'name':_0x3dcf4c,'userProfileId':_0x54947d[_0x49c4('0x5a')]},'raw':!![]})[_0x49c4('0x19')](function(_0x3cc604){if(_0x3cc604&&_0x3cc604[_0x49c4('0x5b')]===0x0){return db['UserProfileResource'][_0x49c4('0x56')]({'name':_0x5ac9f0['name'],'resourceId':_0x5ac9f0['id'],'type':_0x3cc604['name'],'sectionId':_0x3cc604['id']},{})['then'](function(){return _0xc43386;});}else{return _0xc43386;}})['catch'](function(_0x302251){logger[_0x49c4('0x20')](_0x49c4('0x5c'),_0x302251);throw _0x302251;});}return _0xc43386;});}})[_0x49c4('0x19')](respondWithResult(_0x2884ca,0xc9))['catch'](handleError(_0x2884ca,null));};exports['create']=function(_0x340523,_0x109b81,_0x342326){var _0x295ad0;return db[_0x49c4('0x34')][_0x49c4('0x56')](_0x340523[_0x49c4('0x54')],{'raw':!![]})[_0x49c4('0x19')](function(_0x4d49e0){_0x295ad0=_0x4d49e0;return db[_0x49c4('0x34')]['findAll']({'raw':!![]});})[_0x49c4('0x19')](function(_0x264902){var _0x1a5d4c=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x60')),_0x49c4('0x61'));var _0x13d951=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x62')),_0x49c4('0x61'));var _0x2d5f63=ejs[_0x49c4('0x63')](_0x1a5d4c,{'trunks':_0x264902||[]});fs[_0x49c4('0x64')](_0x49c4('0x65'),_0x2d5f63);if(_0x295ad0['registry']){var _0x5ec201=ejs[_0x49c4('0x63')](_0x13d951,{'trunks':_0x264902||[]});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x5ec201);}})[_0x49c4('0x19')](function(){return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x56'),{'module':_0x49c4('0x67')});})['then'](function(){var _0x5a14a5=_0x340523['user'][_0x49c4('0x2d')]({'plain':!![]});if(!_0x5a14a5)throw new Error(_0x49c4('0x68'));if(_0x5a14a5[_0x49c4('0x58')]===_0x49c4('0x57')){var _0x118fc4=_0x295ad0[_0x49c4('0x2d')]({'plain':!![]});return db[_0x49c4('0x59')][_0x49c4('0x51')]({'where':{'name':_0x49c4('0x2e'),'userProfileId':_0x5a14a5['userProfileId']},'raw':!![]})[_0x49c4('0x19')](function(_0x10fb84){if(_0x10fb84&&_0x10fb84[_0x49c4('0x5b')]===0x0){return db['UserProfileResource'][_0x49c4('0x56')]({'name':_0x118fc4[_0x49c4('0x31')],'resourceId':_0x118fc4['id'],'type':_0x10fb84[_0x49c4('0x31')],'sectionId':_0x10fb84['id']},{})[_0x49c4('0x19')](function(){return _0x295ad0;});}else{return _0x295ad0;}})[_0x49c4('0x4f')](function(_0x2fd749){logger[_0x49c4('0x20')](_0x49c4('0x5c'),_0x2fd749);throw _0x2fd749;});}return _0x295ad0;})['then'](respondWithResult(_0x109b81,0xc9))[_0x49c4('0x4f')](handleError(_0x109b81,null));};exports[_0x49c4('0x69')]=function(_0x85540f,_0x18e82b,_0x1e948a){var _0x4a204d;return db['Trunk'][_0x49c4('0x51')]({'where':{'id':_0x85540f['params']['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x18e82b,null))['then'](saveUpdates(_0x85540f[_0x49c4('0x54')],null))[_0x49c4('0x19')](function(_0x3b03dd){if(_0x3b03dd){_0x4a204d=_0x3b03dd;return db[_0x49c4('0x34')]['findAll']({'raw':!![]});}})[_0x49c4('0x19')](function(_0x38d7d3){if(_0x38d7d3){var _0x2ceada=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x60')),_0x49c4('0x61'));var _0x46477f=fs[_0x49c4('0x5d')](path['join'](config[_0x49c4('0x5f')],_0x49c4('0x62')),'utf8');var _0x15bee0=ejs['render'](_0x2ceada,{'trunks':_0x38d7d3||[]});fs[_0x49c4('0x64')](_0x49c4('0x65'),_0x15bee0);var _0x1f14a6=ejs[_0x49c4('0x63')](_0x46477f,{'trunks':_0x38d7d3||[]});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x1f14a6);return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x69'),{'module':'chan_sip.so'});}return null;})[_0x49c4('0x19')](function(_0x167e41){if(_0x167e41){return _0x4a204d;}})['then'](respondWithResult(_0x18e82b,null))[_0x49c4('0x4f')](handleError(_0x18e82b,null));};exports[_0x49c4('0x2f')]=function(_0x57b137,_0x37fef1,_0x993d00){var _0x25989a;return db[_0x49c4('0x34')]['find']({'where':{'id':_0x57b137[_0x49c4('0x6a')]['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x37fef1,null))['then'](removeEntity(_0x37fef1,null))[_0x49c4('0x19')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x49c4('0x19')](function(_0x507078){var _0x50fd24=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config['root'],_0x49c4('0x60')),'utf8');var _0x578f4b=fs['readFileSync'](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x62')),_0x49c4('0x61'));var _0x4a5f0b=ejs['render'](_0x50fd24,{'trunks':_0x507078});var _0x348693=ejs['render'](_0x578f4b,{'trunks':_0x507078});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a5f0b);fs[_0x49c4('0x64')](_0x49c4('0x6b'),_0x348693);return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x2f'),{'module':_0x49c4('0x67')});})[_0x49c4('0x4f')](handleError(_0x37fef1,null));}; \ No newline at end of file +var _0x00bb=['includeAll','findAll','rows','params','find','clone','rawAttributes','include','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','jayson/promise','client','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Trunk,\x20%s,\x20%s','result','catch','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Trunks','UserProfileResource','status','stack','name','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x254b72,_0xa2262){var _0x554582=function(_0x135917){while(--_0x135917){_0x254b72['push'](_0x254b72['shift']());}};_0x554582(++_0xa2262);}(_0x00bb,0x1d8));var _0xb00b=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x00bb[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];var jayson=require(_0xb00b('0x15'));var client=jayson[_0xb00b('0x16')][_0xb00b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xef5d52,_0x1f1c1d,_0x4ada81,_0x218de2){return new BPromise(function(_0xb0d42e,_0x482fe6){var _0x88d95e=_0x218de2||client;return _0x88d95e[_0xb00b('0x18')](_0xef5d52,_0x4ada81)['then'](function(_0x5da36b){logger[_0xb00b('0x19')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,'request\x20sent');logger[_0xb00b('0x1a')](_0xb00b('0x1b'),_0x1f1c1d,_0xb00b('0x1c'),JSON[_0xb00b('0x1d')](_0x5da36b));if(_0x5da36b['error']){if(_0x5da36b[_0xb00b('0x1e')]['code']===0x1f4){logger[_0xb00b('0x1e')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0x482fe6(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0xb0d42e(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}else{logger[_0xb00b('0x19')](_0xb00b('0x20'),_0x1f1c1d,'request\x20sent');_0xb0d42e(_0x5da36b[_0xb00b('0x21')]['message']);}})[_0xb00b('0x22')](function(_0x121ec7){logger['error'](_0xb00b('0x20'),_0x1f1c1d,_0x121ec7);_0x482fe6(_0x121ec7);});});}function respondWithStatusCode(_0x2896d1,_0x520444){_0x520444=_0x520444||0xcc;return function(_0x3ab3cc){if(_0x3ab3cc){return _0x2896d1[_0xb00b('0x23')](_0x520444);}return _0x2896d1['status'](_0x520444)[_0xb00b('0x24')]();};}function respondWithResult(_0x243fdb,_0x3c9500){_0x3c9500=_0x3c9500||0xc8;return function(_0x8caadf){if(_0x8caadf){return _0x243fdb['status'](_0x3c9500)['json'](_0x8caadf);}};}function respondWithFilteredResult(_0x3785e9,_0x490380){return function(_0x550587){if(_0x550587){var _0x4a635e=typeof _0x490380[_0xb00b('0x25')]===_0xb00b('0x26')&&typeof _0x490380[_0xb00b('0x27')]===_0xb00b('0x26');var _0x1f14fa=_0x550587[_0xb00b('0x28')];var _0x15d3b9=_0x4a635e?0x0:_0x490380['offset'];var _0x22c22d=_0x4a635e?_0x550587['count']:_0x490380[_0xb00b('0x25')]+_0x490380[_0xb00b('0x27')];var _0x5424ca;if(_0x22c22d>=_0x1f14fa){_0x22c22d=_0x1f14fa;_0x5424ca=0xc8;}else{_0x5424ca=0xce;}_0x3785e9['status'](_0x5424ca);return _0x3785e9[_0xb00b('0x29')](_0xb00b('0x2a'),_0x15d3b9+'-'+_0x22c22d+'/'+_0x1f14fa)[_0xb00b('0x2b')](_0x550587);}return null;};}function patchUpdates(_0x183233){return function(_0x303625){try{jsonpatch[_0xb00b('0x2c')](_0x303625,_0x183233,!![]);}catch(_0x2e160a){return BPromise[_0xb00b('0x2d')](_0x2e160a);}return _0x303625[_0xb00b('0x2e')]();};}function saveUpdates(_0x54e247,_0x2b5f41){return function(_0x44918d){if(_0x44918d){return _0x44918d['update'](_0x54e247)[_0xb00b('0x2f')](function(_0x2f3b37){return _0x2f3b37;});}return null;};}function removeEntity(_0x5a5e5a,_0x456241){return function(_0x4d2ee5){if(_0x4d2ee5){return _0x4d2ee5[_0xb00b('0x30')]()[_0xb00b('0x2f')](function(){var _0x322879=_0x4d2ee5[_0xb00b('0x31')]({'plain':!![]});var _0x338864=_0xb00b('0x32');return db[_0xb00b('0x33')]['destroy']({'where':{'type':_0x338864,'resourceId':_0x322879['id']}})['then'](function(){return _0x4d2ee5;});})['then'](function(){_0x5a5e5a[_0xb00b('0x34')](0xcc)[_0xb00b('0x24')]();});}};}function handleEntityNotFound(_0x45dcda,_0x2589cb){return function(_0x5cfa60){if(!_0x5cfa60){_0x45dcda[_0xb00b('0x23')](0x194);}return _0x5cfa60;};}function handleError(_0x266f8e,_0x341f46){_0x341f46=_0x341f46||0x1f4;return function(_0x1c7a9f){logger[_0xb00b('0x1e')](_0x1c7a9f[_0xb00b('0x35')]);if(_0x1c7a9f[_0xb00b('0x36')]){delete _0x1c7a9f[_0xb00b('0x36')];}_0x266f8e['status'](_0x341f46)['send'](_0x1c7a9f);};}exports[_0xb00b('0x37')]=function(_0x56022e,_0x1c8258){var _0x1c5400={},_0x29579b={},_0x45ca74={'count':0x0,'rows':[]};var _0x37c017=_[_0xb00b('0x38')](db[_0xb00b('0x39')]['rawAttributes'],function(_0x35f1ca){return{'name':_0x35f1ca[_0xb00b('0x3a')],'type':_0x35f1ca[_0xb00b('0x3b')][_0xb00b('0x3c')]};});_0x29579b[_0xb00b('0x3d')]=_[_0xb00b('0x38')](_0x37c017,'name');_0x29579b[_0xb00b('0x3e')]=_[_0xb00b('0x3f')](_0x56022e['query']);_0x29579b[_0xb00b('0x40')]=_[_0xb00b('0x41')](_0x29579b[_0xb00b('0x3d')],_0x29579b[_0xb00b('0x3e')]);_0x1c5400[_0xb00b('0x42')]=_['intersection'](_0x29579b[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x1c5400['attributes']=_0x1c5400['attributes'][_0xb00b('0x44')]?_0x1c5400[_0xb00b('0x42')]:_0x29579b[_0xb00b('0x3d')];if(!_0x56022e[_0xb00b('0x3e')][_0xb00b('0x45')](_0xb00b('0x46'))){_0x1c5400[_0xb00b('0x27')]=qs['limit'](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x27')]);_0x1c5400[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x25')]);}_0x1c5400[_0xb00b('0x47')]=qs[_0xb00b('0x48')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x48')]);_0x1c5400[_0xb00b('0x49')]=qs[_0xb00b('0x40')](_['pick'](_0x56022e[_0xb00b('0x3e')],_0x29579b[_0xb00b('0x40')]),_0x37c017);if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4a')]){_0x1c5400[_0xb00b('0x49')]=_[_0xb00b('0x4b')](_0x1c5400[_0xb00b('0x49')],{'$or':_[_0xb00b('0x38')](_0x37c017,function(_0x10ba60){if(_0x10ba60[_0xb00b('0x3b')]!==_0xb00b('0x4c')){var _0x3b3031={};_0x3b3031[_0x10ba60['name']]={'$like':'%'+_0x56022e['query']['filter']+'%'};return _0x3b3031;}})});}_0x1c5400=_[_0xb00b('0x4b')]({},_0x1c5400,_0x56022e[_0xb00b('0x4d')]);var _0x481154={'where':_0x1c5400[_0xb00b('0x49')]};return db[_0xb00b('0x39')][_0xb00b('0x28')](_0x481154)[_0xb00b('0x2f')](function(_0x4b62b3){_0x45ca74['count']=_0x4b62b3;if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x1c5400['include']=[{'all':!![]}];}return db['Trunk'][_0xb00b('0x4f')](_0x1c5400);})[_0xb00b('0x2f')](function(_0x4e0be4){_0x45ca74[_0xb00b('0x50')]=_0x4e0be4;return _0x45ca74;})['then'](respondWithFilteredResult(_0x1c8258,_0x1c5400))['catch'](handleError(_0x1c8258,null));};exports['show']=function(_0x465d90,_0x481515){var _0x1f7b86={'raw':![],'where':{'id':_0x465d90[_0xb00b('0x51')]['id']}},_0x3178aa={};_0x3178aa[_0xb00b('0x3d')]=_[_0xb00b('0x3f')](db[_0xb00b('0x39')]['rawAttributes']);_0x3178aa['query']=_[_0xb00b('0x3f')](_0x465d90[_0xb00b('0x3e')]);_0x3178aa['filters']=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],_0x3178aa['query']);_0x1f7b86[_0xb00b('0x42')]=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],qs['fields'](_0x465d90['query'][_0xb00b('0x43')]));_0x1f7b86[_0xb00b('0x42')]=_0x1f7b86[_0xb00b('0x42')][_0xb00b('0x44')]?_0x1f7b86['attributes']:_0x3178aa[_0xb00b('0x3d')];if(_0x465d90[_0xb00b('0x3e')]['includeAll']){_0x1f7b86['include']=[{'all':!![]}];}_0x1f7b86=_[_0xb00b('0x4b')]({},_0x1f7b86,_0x465d90['options']);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x1f7b86)[_0xb00b('0x2f')](handleEntityNotFound(_0x481515,null))[_0xb00b('0x2f')](respondWithResult(_0x481515,null))[_0xb00b('0x22')](handleError(_0x481515,null));};exports[_0xb00b('0x53')]=function(_0x5a3b85,_0x5d52a5){var _0x51c9e3={'where':{'id':_0x5a3b85[_0xb00b('0x51')]['id']}},_0x37d4d2={};_0x37d4d2[_0xb00b('0x3d')]=_['keys'](db[_0xb00b('0x39')][_0xb00b('0x54')]);_0x51c9e3[_0xb00b('0x42')]=_['intersection'](_0x37d4d2[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x51c9e3[_0xb00b('0x42')]=_0x51c9e3[_0xb00b('0x42')][_0xb00b('0x44')]?_0x51c9e3[_0xb00b('0x42')]:_0x37d4d2['model'];if(_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x51c9e3[_0xb00b('0x55')]=[{'all':!![]}];}_0x51c9e3=_['merge']({},_0x51c9e3,_0x5a3b85[_0xb00b('0x4d')]);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x51c9e3)[_0xb00b('0x2f')](handleEntityNotFound(_0x5d52a5,null))[_0xb00b('0x2f')](function(_0x4bfe0b){if(_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b[_0xb00b('0x31')]({'plain':!![]});_0xfd4ecc=qs[_0xb00b('0x56')](_0xfd4ecc,['id',_0xb00b('0x57'),'updatedAt']);_0x5a3b85[_0xb00b('0x58')]=_[_0xb00b('0x56')](_0x5a3b85[_0xb00b('0x58')],['id',_0xb00b('0x57'),_0xb00b('0x59')]);return db[_0xb00b('0x39')][_0xb00b('0x5a')](_['merge'](_0xfd4ecc,_0x5a3b85[_0xb00b('0x58')]),{'include':_0x5a3b85['query'][_0xb00b('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x3b3272){var _0x530d4a=_0x5a3b85[_0xb00b('0x5b')]['get']({'plain':!![]});if(!_0x530d4a)throw new Error(_0xb00b('0x5c'));if(_0x530d4a[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x4d1cec=_0x3b3272['get']({'plain':!![]});var _0x4f7a59=_0xb00b('0x32');return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0x4f7a59,'userProfileId':_0x530d4a['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37ae88){if(_0x37ae88&&_0x37ae88[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x4d1cec['name'],'resourceId':_0x4d1cec['id'],'type':_0x37ae88[_0xb00b('0x36')],'sectionId':_0x37ae88['id']},{})[_0xb00b('0x2f')](function(){return _0x3b3272;});}else{return _0x3b3272;}})['catch'](function(_0xe1316d){logger[_0xb00b('0x1e')](_0xb00b('0x60'),_0xe1316d);throw _0xe1316d;});}return _0x3b3272;});}})['then'](respondWithResult(_0x5d52a5,0xc9))['catch'](handleError(_0x5d52a5,null));};exports[_0xb00b('0x5a')]=function(_0x188da7,_0x23762e,_0x49f0a2){var _0x5aac5f;return db['Trunk']['create'](_0x188da7[_0xb00b('0x58')],{'raw':!![]})['then'](function(_0x2434a0){_0x5aac5f=_0x2434a0;return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x1e7f3a){var _0x2d21ec=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0x3d4482=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config[_0xb00b('0x65')],_0xb00b('0x66')),'utf8');var _0x27b3ae=ejs[_0xb00b('0x67')](_0x2d21ec,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x27b3ae);if(_0x5aac5f[_0xb00b('0x6a')]){var _0x432b68=ejs[_0xb00b('0x67')](_0x3d4482,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x432b68);}})[_0xb00b('0x2f')](function(){return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x5a'),{'module':_0xb00b('0x6c')});})[_0xb00b('0x2f')](function(){var _0xfb2b68=_0x188da7[_0xb00b('0x5b')][_0xb00b('0x31')]({'plain':!![]});if(!_0xfb2b68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfb2b68[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x7803a0=_0x5aac5f[_0xb00b('0x31')]({'plain':!![]});return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0xb00b('0x32'),'userProfileId':_0xfb2b68['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37a4c0){if(_0x37a4c0&&_0x37a4c0[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x7803a0[_0xb00b('0x36')],'resourceId':_0x7803a0['id'],'type':_0x37a4c0['name'],'sectionId':_0x37a4c0['id']},{})[_0xb00b('0x2f')](function(){return _0x5aac5f;});}else{return _0x5aac5f;}})['catch'](function(_0x135cbf){logger['error'](_0xb00b('0x60'),_0x135cbf);throw _0x135cbf;});}return _0x5aac5f;})[_0xb00b('0x2f')](respondWithResult(_0x23762e,0xc9))[_0xb00b('0x22')](handleError(_0x23762e,null));};exports['update']=function(_0x5287cc,_0x9ad1c6,_0x3c4850){var _0x33a483;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0x5287cc[_0xb00b('0x51')]['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x9ad1c6,null))[_0xb00b('0x2f')](saveUpdates(_0x5287cc[_0xb00b('0x58')],null))[_0xb00b('0x2f')](function(_0x257430){if(_0x257430){_0x33a483=_0x257430;return db[_0xb00b('0x39')][_0xb00b('0x4f')]({'raw':!![]});}})[_0xb00b('0x2f')](function(_0x4eb17d){if(_0x4eb17d){var _0x59503c=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],'server/files/templates/trunk.ejs'),_0xb00b('0x64'));var _0x391e98=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],_0xb00b('0x66')),_0xb00b('0x64'));var _0x45c9cd=ejs[_0xb00b('0x67')](_0x59503c,{'trunks':_0x4eb17d||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x45c9cd);var _0x4a9125=ejs[_0xb00b('0x67')](_0x391e98,{'trunks':_0x4eb17d||[]});fs['writeFileSync'](_0xb00b('0x6d'),_0x4a9125);return respondWithRpcPromise(_0xb00b('0x6b'),'update',{'module':_0xb00b('0x6c')});}return null;})[_0xb00b('0x2f')](function(_0xe80a21){if(_0xe80a21){return _0x33a483;}})[_0xb00b('0x2f')](respondWithResult(_0x9ad1c6,null))[_0xb00b('0x22')](handleError(_0x9ad1c6,null));};exports[_0xb00b('0x30')]=function(_0xc41c1f,_0x2423b2,_0x36ba5c){var _0x383d16;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0xc41c1f['params']['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x2423b2,null))[_0xb00b('0x2f')](removeEntity(_0x2423b2,null))[_0xb00b('0x2f')](function(){return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x17503d){var _0x32508b=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0xa4fe1e=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],'server/files/templates/registry.ejs'),_0xb00b('0x64'));var _0x202d5f=ejs[_0xb00b('0x67')](_0x32508b,{'trunks':_0x17503d});var _0x165442=ejs[_0xb00b('0x67')](_0xa4fe1e,{'trunks':_0x17503d});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x202d5f);fs[_0xb00b('0x68')](_0xb00b('0x6d'),_0x165442);return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x30'),{'module':'chan_sip.so'});})[_0xb00b('0x22')](handleError(_0x2423b2,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 8a326bf..d34fb8e 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 _0xb2c4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','lodash','util','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2c4,0xed));var _0x4b2c=function(_0x1d3fdc,_0x2b5c54){_0x1d3fdc=_0x1d3fdc-0x0;var _0x128bb0=_0xb2c4[_0x1d3fdc];return _0x128bb0;};'use strict';var _=require(_0x4b2c('0x0'));var util=require(_0x4b2c('0x1'));var logger=require('../../config/logger')(_0x4b2c('0x2'));var moment=require(_0x4b2c('0x3'));var BPromise=require(_0x4b2c('0x4'));var rp=require(_0x4b2c('0x5'));var fs=require('fs');var path=require(_0x4b2c('0x6'));var rimraf=require(_0x4b2c('0x7'));var config=require(_0x4b2c('0x8'));var attributes=require(_0x4b2c('0x9'));module[_0x4b2c('0xa')]=function(_0x51cdf8,_0x39f447){return _0x51cdf8['define'](_0x4b2c('0xb'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a61=['bluebird','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','api'];(function(_0x26d016,_0x14d83d){var _0x14bdbb=function(_0x80f52e){while(--_0x80f52e){_0x26d016['push'](_0x26d016['shift']());}};_0x14bdbb(++_0x14d83d);}(_0x5a61,0x195));var _0x15a6=function(_0x1f0e4e,_0x3f1426){_0x1f0e4e=_0x1f0e4e-0x0;var _0x5c5564=_0x5a61[_0x1f0e4e];return _0x5c5564;};'use strict';var _=require(_0x15a6('0x0'));var util=require(_0x15a6('0x1'));var logger=require('../../config/logger')(_0x15a6('0x2'));var moment=require('moment');var BPromise=require(_0x15a6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x15a6('0x4'));var rimraf=require(_0x15a6('0x5'));var config=require(_0x15a6('0x6'));var attributes=require(_0x15a6('0x7'));module[_0x15a6('0x8')]=function(_0x4b4e95,_0x2070fc){return _0x4b4e95[_0x15a6('0x9')](_0x15a6('0xa'),attributes,{'tableName':_0x15a6('0xb'),'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 a5e5689..bbb2b30 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 _0xd646=['limit','include','map','model','then','ShowTrunk','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes'];(function(_0x11b35f,_0x48cebc){var _0x360197=function(_0x3354b9){while(--_0x3354b9){_0x11b35f['push'](_0x11b35f['shift']());}};_0x360197(++_0x48cebc);}(_0xd646,0x1c3));var _0x6d64=function(_0x22093a,_0xa7acf1){_0x22093a=_0x22093a-0x0;var _0x2f4989=_0xd646[_0x22093a];return _0x2f4989;};'use strict';var _=require(_0x6d64('0x0'));var util=require(_0x6d64('0x1'));var moment=require(_0x6d64('0x2'));var BPromise=require(_0x6d64('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d64('0x4'));var db=require(_0x6d64('0x5'))['db'];var utils=require(_0x6d64('0x6'));var logger=require(_0x6d64('0x7'))(_0x6d64('0x8'));var config=require(_0x6d64('0x9'));var jayson=require(_0x6d64('0xa'));var client=jayson['client'][_0x6d64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3cf03e,_0x3e2d24,_0x339da9){return new BPromise(function(_0x542324,_0x45530d){return client[_0x6d64('0xc')](_0x3cf03e,_0x339da9)['then'](function(_0x593cad){logger[_0x6d64('0xd')](_0x6d64('0xe'),_0x3e2d24,_0x6d64('0xf'));logger[_0x6d64('0x10')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3e2d24,_0x6d64('0xf'),JSON[_0x6d64('0x11')](_0x593cad));if(_0x593cad[_0x6d64('0x12')]){if(_0x593cad[_0x6d64('0x12')][_0x6d64('0x13')]===0x1f4){logger['error'](_0x6d64('0xe'),_0x3e2d24,_0x593cad['error'][_0x6d64('0x14')]);return _0x45530d(_0x593cad[_0x6d64('0x12')][_0x6d64('0x14')]);}logger[_0x6d64('0x12')](_0x6d64('0xe'),_0x3e2d24,_0x593cad['error'][_0x6d64('0x14')]);return _0x542324(_0x593cad[_0x6d64('0x12')][_0x6d64('0x14')]);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x3e2d24,_0x6d64('0xf'));_0x542324(_0x593cad[_0x6d64('0x15')][_0x6d64('0x14')]);}})[_0x6d64('0x16')](function(_0x384d1f){logger['error'](_0x6d64('0xe'),_0x3e2d24,_0x384d1f);_0x45530d(_0x384d1f);});});}exports[_0x6d64('0x17')]=function(_0x240c89){var _0x10d424=this;return new Promise(function(_0x3fd9c1,_0x15d505){return db[_0x6d64('0x18')][_0x6d64('0x19')]({'raw':_0x240c89[_0x6d64('0x1a')]?_0x240c89['options'][_0x6d64('0x1b')]===undefined?!![]:![]:!![],'where':_0x240c89[_0x6d64('0x1a')]?_0x240c89[_0x6d64('0x1a')][_0x6d64('0x1c')]||null:null,'attributes':_0x240c89[_0x6d64('0x1a')]?_0x240c89[_0x6d64('0x1a')][_0x6d64('0x1d')]||null:null,'limit':_0x240c89['options']?_0x240c89['options'][_0x6d64('0x1e')]||null:null,'include':_0x240c89[_0x6d64('0x1a')]?_0x240c89[_0x6d64('0x1a')][_0x6d64('0x1f')]?_[_0x6d64('0x20')](_0x240c89[_0x6d64('0x1a')][_0x6d64('0x1f')],function(_0x244a27){return{'model':db[_0x244a27['model']],'as':_0x244a27['as'],'attributes':_0x244a27[_0x6d64('0x1d')],'include':_0x244a27[_0x6d64('0x1f')]?_[_0x6d64('0x20')](_0x244a27['include'],function(_0x363ed0){return{'model':db[_0x363ed0[_0x6d64('0x21')]],'as':_0x363ed0['as'],'attributes':_0x363ed0[_0x6d64('0x1d')],'include':_0x363ed0['include']?_[_0x6d64('0x20')](_0x363ed0[_0x6d64('0x1f')],function(_0x586ee5){return{'model':db[_0x586ee5[_0x6d64('0x21')]],'as':_0x586ee5['as'],'attributes':_0x586ee5['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d64('0x22')](function(_0x1380ab){logger['info'](_0x6d64('0x17'),_0x240c89);logger[_0x6d64('0x10')](_0x6d64('0x17'),_0x240c89,JSON['stringify'](_0x1380ab));_0x3fd9c1(_0x1380ab);})['catch'](function(_0x4e5538){logger[_0x6d64('0x12')](_0x6d64('0x17'),_0x4e5538[_0x6d64('0x14')],_0x240c89);_0x15d505(_0x10d424[_0x6d64('0x12')](0x1f4,_0x4e5538[_0x6d64('0x14')]));});});};exports[_0x6d64('0x23')]=function(_0x15d2bf){var _0x2ef50f=this;return new Promise(function(_0x18c706,_0x3d1760){return db['Trunk'][_0x6d64('0x24')]({'raw':_0x15d2bf[_0x6d64('0x1a')]?_0x15d2bf[_0x6d64('0x1a')][_0x6d64('0x1b')]===undefined?!![]:![]:!![],'where':_0x15d2bf[_0x6d64('0x1a')]?_0x15d2bf[_0x6d64('0x1a')][_0x6d64('0x1c')]||null:null,'attributes':_0x15d2bf['options']?_0x15d2bf['options']['attributes']||null:null,'include':_0x15d2bf['options']?_0x15d2bf[_0x6d64('0x1a')]['include']?_[_0x6d64('0x20')](_0x15d2bf[_0x6d64('0x1a')][_0x6d64('0x1f')],function(_0x47dfde){return{'model':db[_0x47dfde[_0x6d64('0x21')]],'as':_0x47dfde['as'],'attributes':_0x47dfde[_0x6d64('0x1d')],'include':_0x47dfde[_0x6d64('0x1f')]?_['map'](_0x47dfde[_0x6d64('0x1f')],function(_0x3889bc){return{'model':db[_0x3889bc[_0x6d64('0x21')]],'as':_0x3889bc['as'],'attributes':_0x3889bc[_0x6d64('0x1d')],'include':_0x3889bc[_0x6d64('0x1f')]?_[_0x6d64('0x20')](_0x3889bc[_0x6d64('0x1f')],function(_0x3d1b7d){return{'model':db[_0x3d1b7d[_0x6d64('0x21')]],'as':_0x3d1b7d['as'],'attributes':_0x3d1b7d[_0x6d64('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14a07f){logger[_0x6d64('0xd')](_0x6d64('0x23'),_0x15d2bf);logger[_0x6d64('0x10')](_0x6d64('0x23'),_0x15d2bf,JSON['stringify'](_0x14a07f));_0x18c706(_0x14a07f);})[_0x6d64('0x16')](function(_0x363f14){logger[_0x6d64('0x12')]('ShowTrunk',_0x363f14['message'],_0x15d2bf);_0x3d1760(_0x2ef50f[_0x6d64('0x12')](0x1f4,_0x363f14[_0x6d64('0x14')]));});});}; \ No newline at end of file +var _0x3750=['limit','include','map','model','then','GetTrunk','stringify','ShowTrunk','attributes','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','findAll','options','raw','where'];(function(_0x3452a8,_0x4bfaa4){var _0x233814=function(_0x40b537){while(--_0x40b537){_0x3452a8['push'](_0x3452a8['shift']());}};_0x233814(++_0x4bfaa4);}(_0x3750,0x6c));var _0x0375=function(_0x195c21,_0x332612){_0x195c21=_0x195c21-0x0;var _0x3576a8=_0x3750[_0x195c21];return _0x3576a8;};'use strict';var _=require('lodash');var util=require(_0x0375('0x0'));var moment=require(_0x0375('0x1'));var BPromise=require(_0x0375('0x2'));var rs=require(_0x0375('0x3'));var fs=require('fs');var Redis=require(_0x0375('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0375('0x5'));var logger=require(_0x0375('0x6'))(_0x0375('0x7'));var config=require(_0x0375('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0375('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c3545,_0x1b863a,_0x311bb9){return new BPromise(function(_0x5a3145,_0x32b3ef){return client[_0x0375('0xa')](_0x2c3545,_0x311bb9)['then'](function(_0x222cbe){logger[_0x0375('0xb')](_0x0375('0xc'),_0x1b863a,'request\x20sent');logger[_0x0375('0xd')](_0x0375('0xe'),_0x1b863a,_0x0375('0xf'),JSON['stringify'](_0x222cbe));if(_0x222cbe[_0x0375('0x10')]){if(_0x222cbe[_0x0375('0x10')]['code']===0x1f4){logger[_0x0375('0x10')](_0x0375('0xc'),_0x1b863a,_0x222cbe[_0x0375('0x10')]['message']);return _0x32b3ef(_0x222cbe[_0x0375('0x10')][_0x0375('0x11')]);}logger[_0x0375('0x10')](_0x0375('0xc'),_0x1b863a,_0x222cbe[_0x0375('0x10')]['message']);return _0x5a3145(_0x222cbe[_0x0375('0x10')][_0x0375('0x11')]);}else{logger[_0x0375('0xb')](_0x0375('0xc'),_0x1b863a,'request\x20sent');_0x5a3145(_0x222cbe[_0x0375('0x12')][_0x0375('0x11')]);}})[_0x0375('0x13')](function(_0x56b107){logger[_0x0375('0x10')]('Trunk,\x20%s,\x20%s',_0x1b863a,_0x56b107);_0x32b3ef(_0x56b107);});});}exports['GetTrunk']=function(_0x51f4af){var _0x2b511f=this;return new Promise(function(_0x2f7129,_0x44f374){return db['Trunk'][_0x0375('0x14')]({'raw':_0x51f4af['options']?_0x51f4af[_0x0375('0x15')][_0x0375('0x16')]===undefined?!![]:![]:!![],'where':_0x51f4af[_0x0375('0x15')]?_0x51f4af[_0x0375('0x15')][_0x0375('0x17')]||null:null,'attributes':_0x51f4af[_0x0375('0x15')]?_0x51f4af[_0x0375('0x15')]['attributes']||null:null,'limit':_0x51f4af[_0x0375('0x15')]?_0x51f4af[_0x0375('0x15')][_0x0375('0x18')]||null:null,'include':_0x51f4af[_0x0375('0x15')]?_0x51f4af[_0x0375('0x15')][_0x0375('0x19')]?_[_0x0375('0x1a')](_0x51f4af[_0x0375('0x15')][_0x0375('0x19')],function(_0x59f8fa){return{'model':db[_0x59f8fa['model']],'as':_0x59f8fa['as'],'attributes':_0x59f8fa['attributes'],'include':_0x59f8fa[_0x0375('0x19')]?_[_0x0375('0x1a')](_0x59f8fa[_0x0375('0x19')],function(_0x2b354a){return{'model':db[_0x2b354a[_0x0375('0x1b')]],'as':_0x2b354a['as'],'attributes':_0x2b354a['attributes'],'include':_0x2b354a[_0x0375('0x19')]?_['map'](_0x2b354a[_0x0375('0x19')],function(_0x1fec17){return{'model':db[_0x1fec17[_0x0375('0x1b')]],'as':_0x1fec17['as'],'attributes':_0x1fec17['attributes']};}):[]};}):[]};}):[]:[]})[_0x0375('0x1c')](function(_0x4769fe){logger[_0x0375('0xb')](_0x0375('0x1d'),_0x51f4af);logger[_0x0375('0xd')](_0x0375('0x1d'),_0x51f4af,JSON[_0x0375('0x1e')](_0x4769fe));_0x2f7129(_0x4769fe);})['catch'](function(_0x3548b6){logger[_0x0375('0x10')](_0x0375('0x1d'),_0x3548b6['message'],_0x51f4af);_0x44f374(_0x2b511f['error'](0x1f4,_0x3548b6[_0x0375('0x11')]));});});};exports[_0x0375('0x1f')]=function(_0x17e96f){var _0x40e184=this;return new Promise(function(_0x349a3e,_0x2e5df7){return db['Trunk']['find']({'raw':_0x17e96f[_0x0375('0x15')]?_0x17e96f[_0x0375('0x15')][_0x0375('0x16')]===undefined?!![]:![]:!![],'where':_0x17e96f[_0x0375('0x15')]?_0x17e96f[_0x0375('0x15')][_0x0375('0x17')]||null:null,'attributes':_0x17e96f[_0x0375('0x15')]?_0x17e96f[_0x0375('0x15')][_0x0375('0x20')]||null:null,'include':_0x17e96f[_0x0375('0x15')]?_0x17e96f[_0x0375('0x15')][_0x0375('0x19')]?_[_0x0375('0x1a')](_0x17e96f[_0x0375('0x15')][_0x0375('0x19')],function(_0x570143){return{'model':db[_0x570143[_0x0375('0x1b')]],'as':_0x570143['as'],'attributes':_0x570143[_0x0375('0x20')],'include':_0x570143[_0x0375('0x19')]?_['map'](_0x570143['include'],function(_0x419494){return{'model':db[_0x419494[_0x0375('0x1b')]],'as':_0x419494['as'],'attributes':_0x419494['attributes'],'include':_0x419494['include']?_[_0x0375('0x1a')](_0x419494[_0x0375('0x19')],function(_0x3e4adc){return{'model':db[_0x3e4adc[_0x0375('0x1b')]],'as':_0x3e4adc['as'],'attributes':_0x3e4adc['attributes']};}):[]};}):[]};}):[]:[]})[_0x0375('0x1c')](function(_0x18197b){logger[_0x0375('0xb')]('ShowTrunk',_0x17e96f);logger[_0x0375('0xd')](_0x0375('0x1f'),_0x17e96f,JSON[_0x0375('0x1e')](_0x18197b));_0x349a3e(_0x18197b);})[_0x0375('0x13')](function(_0x412269){logger[_0x0375('0x10')](_0x0375('0x1f'),_0x412269['message'],_0x17e96f);_0x2e5df7(_0x40e184[_0x0375('0x10')](0x1f4,_0x412269['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 2d80738..88389f0 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 _0x75f8=['/:id/unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','update','removeQueues','delete','removeTeams','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/whoami','whoami','/presence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/queues','/:id/queues_rt','getGroups','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','getScheduledCalls','post','/:id/contacts','addContacts','create','bulkCreate','addQueues','diskStorage','root','server/files/images/','originalname','single','addAvatar','/:id/login','login','/:id/pause','pause'];(function(_0x4f9db8,_0x379b61){var _0x2f0b28=function(_0x42414d){while(--_0x42414d){_0x4f9db8['push'](_0x4f9db8['shift']());}};_0x2f0b28(++_0x379b61);}(_0x75f8,0x1da));var _0x875f=function(_0x3f9ac2,_0x1b670b){_0x3f9ac2=_0x3f9ac2-0x0;var _0xe6a436=_0x75f8[_0x3f9ac2];return _0xe6a436;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x875f('0x0'));var timeout=require(_0x875f('0x1'));var express=require(_0x875f('0x2'));var router=express[_0x875f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x875f('0x4'));var interaction=require(_0x875f('0x5'));var config=require(_0x875f('0x6'));var controller=require('./user.controller');router[_0x875f('0x7')]('/',auth['isAuthenticated'](),controller[_0x875f('0x8')]);router['get']('/describe',auth[_0x875f('0x9')](),controller[_0x875f('0xa')]);router[_0x875f('0x7')](_0x875f('0xb'),auth['isAuthenticated'](),controller[_0x875f('0xc')]);router[_0x875f('0x7')](_0x875f('0xd'),auth[_0x875f('0x9')](),controller['getPresence']);router[_0x875f('0x7')](_0x875f('0xe'),auth[_0x875f('0x9')](),controller[_0x875f('0xf')]);router['get'](_0x875f('0x10'),controller[_0x875f('0x11')]);router[_0x875f('0x7')](_0x875f('0x12'),auth[_0x875f('0x9')](),controller[_0x875f('0x13')]);router[_0x875f('0x7')]('/:id/contacts',auth[_0x875f('0x9')](),controller['getContacts']);router['get'](_0x875f('0x14'),auth[_0x875f('0x9')](),controller['getQueues']);router[_0x875f('0x7')](_0x875f('0x15'),auth[_0x875f('0x9')](),controller['getVoiceQueuesRt']);router[_0x875f('0x7')]('/:id/groups',auth['isAuthenticated'](),controller[_0x875f('0x16')]);router[_0x875f('0x7')]('/:id/recordings',auth[_0x875f('0x9')](),controller['getRecordings']);router[_0x875f('0x7')](_0x875f('0x17'),auth['isAuthenticated'](),controller[_0x875f('0x18')]);router[_0x875f('0x7')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x875f('0x19')]);router[_0x875f('0x7')](_0x875f('0x1a'),auth['isAuthenticated'](),controller[_0x875f('0x1b')]);router['get'](_0x875f('0x1c'),auth[_0x875f('0x9')](),controller['getMailInteractions']);router[_0x875f('0x7')](_0x875f('0x1d'),auth['isAuthenticated'](),controller[_0x875f('0x1e')]);router[_0x875f('0x7')](_0x875f('0x1f'),auth[_0x875f('0x9')](),controller[_0x875f('0x20')]);router[_0x875f('0x7')](_0x875f('0x21'),auth[_0x875f('0x9')](),controller['getWhatsappInteractions']);router[_0x875f('0x7')](_0x875f('0x22'),auth[_0x875f('0x9')](),controller[_0x875f('0x23')]);router['get'](_0x875f('0x24'),auth[_0x875f('0x9')](),controller['getLists']);router['get'](_0x875f('0x25'),auth[_0x875f('0x9')](),controller[_0x875f('0x26')]);router[_0x875f('0x7')](_0x875f('0x27'),auth[_0x875f('0x9')](),controller['getVoicePrefixes']);router['get'](_0x875f('0x28'),auth[_0x875f('0x9')](),controller[_0x875f('0x29')]);router[_0x875f('0x7')]('/:id/mail_accounts',auth[_0x875f('0x9')](),controller[_0x875f('0x2a')]);router['get']('/:id/openchannel_accounts',auth[_0x875f('0x9')](),controller[_0x875f('0x2b')]);router[_0x875f('0x7')]('/:id/sms_accounts',auth[_0x875f('0x9')](),controller[_0x875f('0x2c')]);router[_0x875f('0x7')](_0x875f('0x2d'),auth[_0x875f('0x9')](),controller[_0x875f('0x2e')]);router['get']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['getWhatsappAccounts']);router[_0x875f('0x7')](_0x875f('0x2f'),auth['isAuthenticated'](),controller[_0x875f('0x30')]);router['get']('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0x875f('0x31')]);router[_0x875f('0x7')]('/:id/api_key',auth['isAuthenticated'](),controller['getApiKey']);router[_0x875f('0x32')](_0x875f('0x33'),auth[_0x875f('0x9')](),controller[_0x875f('0x34')]);router[_0x875f('0x32')]('/',auth['isAuthenticated'](),controller[_0x875f('0x35')]);router[_0x875f('0x32')]('/create_many',auth[_0x875f('0x9')](),controller[_0x875f('0x36')]);router[_0x875f('0x32')](_0x875f('0x14'),auth['isAuthenticated'](),controller[_0x875f('0x37')]);var upload=multer({'storage':multer[_0x875f('0x38')]({'destination':function(_0xf952ef,_0x298029,_0x3a434e){_0x3a434e(null,path['join'](config[_0x875f('0x39')],_0x875f('0x3a')));},'filename':function(_0x57525f,_0x2236c4,_0xd0d083){_0xd0d083(null,util['format']('%s-%s',Date['now'](),_0x2236c4[_0x875f('0x3b')]));}})});router[_0x875f('0x32')]('/:id/avatar',upload[_0x875f('0x3c')]('file'),controller[_0x875f('0x3d')]);router[_0x875f('0x32')](_0x875f('0x3e'),auth[_0x875f('0x9')](),controller[_0x875f('0x3f')]);router[_0x875f('0x32')]('/:id/logout',auth['isAuthenticated'](),controller['logout']);router[_0x875f('0x32')](_0x875f('0x40'),auth[_0x875f('0x9')](),controller[_0x875f('0x41')]);router[_0x875f('0x32')](_0x875f('0x42'),auth[_0x875f('0x9')](),controller['unpause']);router['post'](_0x875f('0x22'),auth['isAuthenticated'](),controller['addTeams']);router[_0x875f('0x32')](_0x875f('0x43'),auth[_0x875f('0x9')](),controller[_0x875f('0x44')]);router[_0x875f('0x32')](_0x875f('0x45'),auth['isAuthenticated'](),controller['addMailInteractions']);router['post'](_0x875f('0x46'),auth[_0x875f('0x9')](),controller[_0x875f('0x47')]);router[_0x875f('0x32')](_0x875f('0x48'),auth['isAuthenticated'](),controller[_0x875f('0x49')]);router['post'](_0x875f('0x4a'),auth[_0x875f('0x9')](),controller[_0x875f('0x4b')]);router[_0x875f('0x32')](_0x875f('0x4c'),auth[_0x875f('0x9')](),controller[_0x875f('0x4d')]);router[_0x875f('0x32')](_0x875f('0x28'),auth[_0x875f('0x9')](),controller[_0x875f('0x4e')]);router[_0x875f('0x32')](_0x875f('0x4f'),auth[_0x875f('0x9')](),controller[_0x875f('0x50')]);router['post'](_0x875f('0x51'),auth[_0x875f('0x9')](),controller[_0x875f('0x52')]);router[_0x875f('0x32')](_0x875f('0x53'),auth[_0x875f('0x9')](),controller[_0x875f('0x54')]);router['post'](_0x875f('0x2d'),auth[_0x875f('0x9')](),controller[_0x875f('0x55')]);router[_0x875f('0x32')]('/:id/whatsapp_accounts',auth[_0x875f('0x9')](),controller[_0x875f('0x56')]);router['post'](_0x875f('0x2f'),auth['isAuthenticated'](),controller[_0x875f('0x57')]);router[_0x875f('0x32')](_0x875f('0x58'),auth['isAuthenticated'](),controller[_0x875f('0x59')]);router[_0x875f('0x5a')]('/:id',auth[_0x875f('0x9')](),controller[_0x875f('0x5b')]);router['put']('/:id/password',auth[_0x875f('0x9')](),controller['changePassword']);router['delete'](_0x875f('0x14'),auth[_0x875f('0x9')](),controller[_0x875f('0x5c')]);router[_0x875f('0x5d')](_0x875f('0x22'),auth['isAuthenticated'](),controller[_0x875f('0x5e')]);router[_0x875f('0x5d')](_0x875f('0xe'),auth[_0x875f('0x9')](),controller['destroy']);router[_0x875f('0x5d')](_0x875f('0x43'),auth[_0x875f('0x9')](),controller['removeChatInteractions']);router[_0x875f('0x5d')]('/:id/mail_interactions',auth[_0x875f('0x9')](),controller[_0x875f('0x5f')]);router[_0x875f('0x5d')](_0x875f('0x46'),auth[_0x875f('0x9')](),controller[_0x875f('0x60')]);router[_0x875f('0x5d')](_0x875f('0x48'),auth[_0x875f('0x9')](),controller[_0x875f('0x61')]);router[_0x875f('0x5d')](_0x875f('0x4a'),auth[_0x875f('0x9')](),controller[_0x875f('0x62')]);router[_0x875f('0x5d')](_0x875f('0x4c'),auth[_0x875f('0x9')](),controller[_0x875f('0x63')]);router[_0x875f('0x5d')](_0x875f('0x28'),auth[_0x875f('0x9')](),controller['removeFaxAccounts']);router[_0x875f('0x5d')](_0x875f('0x4f'),auth['isAuthenticated'](),controller[_0x875f('0x64')]);router[_0x875f('0x5d')](_0x875f('0x51'),auth[_0x875f('0x9')](),controller[_0x875f('0x65')]);router['delete'](_0x875f('0x53'),auth['isAuthenticated'](),controller[_0x875f('0x66')]);router[_0x875f('0x5d')](_0x875f('0x2d'),auth[_0x875f('0x9')](),controller[_0x875f('0x67')]);router[_0x875f('0x5d')](_0x875f('0x68'),auth[_0x875f('0x9')](),controller[_0x875f('0x69')]);router['delete'](_0x875f('0x2f'),auth[_0x875f('0x9')](),controller[_0x875f('0x6a')]);router['delete'](_0x875f('0x58'),auth['isAuthenticated'](),controller[_0x875f('0x6b')]);module['exports']=router; \ No newline at end of file +var _0xaa3f=['getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','addQueues','diskStorage','server/files/images/','%s-%s','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','/:id/api_key','put','/:id','update','/:id/password','changePassword','delete','removeTeams','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','getVoiceQueuesRt','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists'];(function(_0x4ea434,_0x2aaef7){var _0x2b963b=function(_0x4f122d){while(--_0x4f122d){_0x4ea434['push'](_0x4ea434['shift']());}};_0x2b963b(++_0x2aaef7);}(_0xaa3f,0x198));var _0xfaa3=function(_0x3a0624,_0x399cde){_0x3a0624=_0x3a0624-0x0;var _0x43268f=_0xaa3f[_0x3a0624];return _0x43268f;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfaa3('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfaa3('0x2'));var interaction=require(_0xfaa3('0x3'));var config=require(_0xfaa3('0x4'));var controller=require(_0xfaa3('0x5'));router[_0xfaa3('0x6')]('/',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x8')]);router['get'](_0xfaa3('0x9'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0xa')]);router[_0xfaa3('0x6')](_0xfaa3('0xb'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0xc')]);router['get'](_0xfaa3('0xd'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0xe')]);router[_0xfaa3('0x6')]('/:id',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0xf')]);router['get'](_0xfaa3('0x10'),controller[_0xfaa3('0x11')]);router[_0xfaa3('0x6')](_0xfaa3('0x12'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x13')]);router[_0xfaa3('0x6')](_0xfaa3('0x14'),auth[_0xfaa3('0x7')](),controller['getContacts']);router[_0xfaa3('0x6')](_0xfaa3('0x15'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x16')]);router[_0xfaa3('0x6')]('/:id/queues_rt',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x17')]);router[_0xfaa3('0x6')]('/:id/groups',auth['isAuthenticated'](),controller[_0xfaa3('0x18')]);router[_0xfaa3('0x6')](_0xfaa3('0x19'),auth['isAuthenticated'](),controller['getRecordings']);router[_0xfaa3('0x6')](_0xfaa3('0x1a'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x1b')]);router[_0xfaa3('0x6')](_0xfaa3('0x1c'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x1d')]);router['get'](_0xfaa3('0x1e'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x1f')]);router[_0xfaa3('0x6')](_0xfaa3('0x20'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x21')]);router['get'](_0xfaa3('0x22'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0xfaa3('0x6')]('/:id/fax/interactions',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x23')]);router[_0xfaa3('0x6')](_0xfaa3('0x24'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0xfaa3('0x6')](_0xfaa3('0x25'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x26')]);router[_0xfaa3('0x6')](_0xfaa3('0x27'),auth['isAuthenticated'](),controller[_0xfaa3('0x28')]);router[_0xfaa3('0x6')](_0xfaa3('0x29'),auth['isAuthenticated'](),controller[_0xfaa3('0x2a')]);router['get'](_0xfaa3('0x2b'),auth['isAuthenticated'](),controller[_0xfaa3('0x2c')]);router[_0xfaa3('0x6')](_0xfaa3('0x2d'),auth[_0xfaa3('0x7')](),controller['getFaxAccounts']);router['get'](_0xfaa3('0x2e'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x2f')]);router[_0xfaa3('0x6')](_0xfaa3('0x30'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x31')]);router[_0xfaa3('0x6')](_0xfaa3('0x32'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x33')]);router['get'](_0xfaa3('0x34'),auth['isAuthenticated'](),controller[_0xfaa3('0x35')]);router[_0xfaa3('0x6')](_0xfaa3('0x36'),auth[_0xfaa3('0x7')](),controller['getWhatsappAccounts']);router[_0xfaa3('0x6')](_0xfaa3('0x37'),auth['isAuthenticated'](),controller[_0xfaa3('0x38')]);router['get'](_0xfaa3('0x39'),auth['isAuthenticated'](),controller[_0xfaa3('0x3a')]);router['get']('/:id/api_key',auth['isAuthenticated'](),controller[_0xfaa3('0x3b')]);router[_0xfaa3('0x3c')](_0xfaa3('0x14'),auth['isAuthenticated'](),controller[_0xfaa3('0x3d')]);router['post']('/',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x3e')]);router['post'](_0xfaa3('0x3f'),auth[_0xfaa3('0x7')](),controller['bulkCreate']);router[_0xfaa3('0x3c')](_0xfaa3('0x15'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x40')]);var upload=multer({'storage':multer[_0xfaa3('0x41')]({'destination':function(_0x2447df,_0x1b2c63,_0x1d54a){_0x1d54a(null,path['join'](config['root'],_0xfaa3('0x42')));},'filename':function(_0x18748b,_0x5cdbfd,_0x13b683){_0x13b683(null,util['format'](_0xfaa3('0x43'),Date['now'](),_0x5cdbfd['originalname']));}})});router[_0xfaa3('0x3c')](_0xfaa3('0x10'),upload[_0xfaa3('0x44')](_0xfaa3('0x45')),controller[_0xfaa3('0x46')]);router[_0xfaa3('0x3c')](_0xfaa3('0x47'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x48')]);router[_0xfaa3('0x3c')](_0xfaa3('0x49'),auth['isAuthenticated'](),controller[_0xfaa3('0x4a')]);router[_0xfaa3('0x3c')](_0xfaa3('0x4b'),auth[_0xfaa3('0x7')](),controller['pause']);router[_0xfaa3('0x3c')]('/:id/unpause',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x4c')]);router['post'](_0xfaa3('0x25'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x4d')]);router[_0xfaa3('0x3c')](_0xfaa3('0x4e'),auth[_0xfaa3('0x7')](),controller['addChatInteractions']);router[_0xfaa3('0x3c')](_0xfaa3('0x4f'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x50')]);router['post'](_0xfaa3('0x51'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x52')]);router[_0xfaa3('0x3c')](_0xfaa3('0x53'),auth[_0xfaa3('0x7')](),controller['addSmsInteractions']);router[_0xfaa3('0x3c')](_0xfaa3('0x54'),auth['isAuthenticated'](),controller[_0xfaa3('0x55')]);router[_0xfaa3('0x3c')]('/:id/whatsapp_interactions',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x56')]);router[_0xfaa3('0x3c')](_0xfaa3('0x2d'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x57')]);router[_0xfaa3('0x3c')](_0xfaa3('0x2e'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x58')]);router['post'](_0xfaa3('0x30'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x59')]);router[_0xfaa3('0x3c')](_0xfaa3('0x32'),auth[_0xfaa3('0x7')](),controller['addSmsAccounts']);router[_0xfaa3('0x3c')](_0xfaa3('0x34'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x5a')]);router['post'](_0xfaa3('0x36'),auth[_0xfaa3('0x7')](),controller['addWhatsappAccounts']);router[_0xfaa3('0x3c')](_0xfaa3('0x37'),auth[_0xfaa3('0x7')](),controller['addSquareProjects']);router[_0xfaa3('0x3c')](_0xfaa3('0x5b'),auth[_0xfaa3('0x7')](),controller['createApiKey']);router[_0xfaa3('0x5c')](_0xfaa3('0x5d'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x5e')]);router[_0xfaa3('0x5c')](_0xfaa3('0x5f'),auth['isAuthenticated'](),controller[_0xfaa3('0x60')]);router[_0xfaa3('0x61')](_0xfaa3('0x15'),auth[_0xfaa3('0x7')](),controller['removeQueues']);router['delete']('/:id/teams',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x62')]);router[_0xfaa3('0x61')]('/:id',auth[_0xfaa3('0x7')](),controller['destroy']);router['delete'](_0xfaa3('0x4e'),auth['isAuthenticated'](),controller[_0xfaa3('0x63')]);router[_0xfaa3('0x61')](_0xfaa3('0x4f'),auth[_0xfaa3('0x7')](),controller['removeMailInteractions']);router[_0xfaa3('0x61')](_0xfaa3('0x51'),auth['isAuthenticated'](),controller[_0xfaa3('0x64')]);router[_0xfaa3('0x61')](_0xfaa3('0x53'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x65')]);router[_0xfaa3('0x61')](_0xfaa3('0x54'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x66')]);router[_0xfaa3('0x61')](_0xfaa3('0x67'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x68')]);router[_0xfaa3('0x61')](_0xfaa3('0x2d'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x69')]);router[_0xfaa3('0x61')]('/:id/mail_accounts',auth[_0xfaa3('0x7')](),controller['removeMailAccounts']);router[_0xfaa3('0x61')](_0xfaa3('0x30'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x6a')]);router['delete'](_0xfaa3('0x32'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x6b')]);router[_0xfaa3('0x61')]('/:id/chat_websites',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x6c')]);router[_0xfaa3('0x61')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0xfaa3('0x61')](_0xfaa3('0x37'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x6d')]);router[_0xfaa3('0x61')](_0xfaa3('0x5b'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x6e')]);module[_0xfaa3('0x6f')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 3ce87e5..836167e 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 _0x3dd6=['passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','udp','wss','encryption','avpf','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','icesupport','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','ENUM','admin','user','agent','local','INTEGER','internal','accountcode','BOOLEAN','DATE','dynamic','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','rfc2833','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','active'];(function(_0x269e6b,_0x5bf136){var _0x408b6d=function(_0x4ca29e){while(--_0x4ca29e){_0x269e6b['push'](_0x269e6b['shift']());}};_0x408b6d(++_0x5bf136);}(_0x3dd6,0xcf));var _0x63dd=function(_0x1c5f32,_0x1ac260){_0x1c5f32=_0x1c5f32-0x0;var _0x3bd1e8=_0x3dd6[_0x1c5f32];return _0x3bd1e8;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require('util');var _=require(_0x63dd('0x0'));module[_0x63dd('0x1')]={'name':{'type':Sequelize[_0x63dd('0x2')],'allowNull':![],'unique':_0x63dd('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x11bf67){this[_0x63dd('0x4')]('name',_0x11bf67);this[_0x63dd('0x4')]('defaultuser',_0x11bf67);},'comment':_0x63dd('0x5')},'fullname':{'type':Sequelize[_0x63dd('0x2')],'allowNull':![],'set':function(_0x368feb){this[_0x63dd('0x4')](_0x63dd('0x6'),_0x368feb);this['setDataValue'](_0x63dd('0x7'),util[_0x63dd('0x8')](_0x63dd('0x9'),_0x368feb,this[_0x63dd('0xa')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x63dd('0x2')],'allowNull':![],'unique':_0x63dd('0xb'),'validate':{'isEmail':!![]},'set':function(_0x165462){if(_0x165462){this[_0x63dd('0x4')](_0x63dd('0xb'),_0x165462['toLowerCase']());}}},'role':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0xd'),_0x63dd('0xe'),_0x63dd('0xf'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x63dd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x63dd('0x2')],'defaultValue':_0x63dd('0x10')},'internal':{'type':Sequelize[_0x63dd('0x11')](0xb),'allowNull':![],'unique':_0x63dd('0x12'),'set':function(_0x3a0981){this['setDataValue']('internal',_0x3a0981);this[_0x63dd('0x4')](_0x63dd('0x13'),_0x3a0981);this[_0x63dd('0x4')]('callerid',util[_0x63dd('0x8')](_0x63dd('0x9'),this[_0x63dd('0xa')]('fullname'),_0x3a0981));}},'salt':{'type':Sequelize[_0x63dd('0x2')]},'phone':{'type':Sequelize[_0x63dd('0x2')]},'mobile':{'type':Sequelize[_0x63dd('0x2')]},'address':{'type':Sequelize[_0x63dd('0x2')]},'zipcode':{'type':Sequelize[_0x63dd('0x2')]},'userpic':{'type':Sequelize[_0x63dd('0x2')]},'city':{'type':Sequelize[_0x63dd('0x2')]},'country':{'type':Sequelize[_0x63dd('0x2')]},'online':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x63dd('0x15')]},'voicePause':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x63dd('0x2')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x63dd('0x15')]},'chatCapacity':{'type':Sequelize[_0x63dd('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x63dd('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x63dd('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x63dd('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x63dd('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x63dd('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x63dd('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x63dd('0x16')},'ipaddr':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x63dd('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x63dd('0xc')]('friend',_0x63dd('0xe'),'peer'),'allowNull':!![],'defaultValue':_0x63dd('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x18'),_0x63dd('0x19'),_0x63dd('0x1a'),_0x63dd('0x1b'),_0x63dd('0x1c'),'PROHIB_PASSED_SCREEN',_0x63dd('0x1d'),_0x63dd('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'permit':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![],'defaultValue':'udp','set':function(_0x2aa0b9){this[_0x63dd('0x4')](_0x63dd('0x1f'),_0x2aa0b9?_0x2aa0b9[_0x63dd('0x20')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x63dd('0xa')]('transport')[_0x63dd('0x21')](','):null;},'comment':_0x63dd('0x22')},'dtmfmode':{'type':Sequelize[_0x63dd('0xc')]('rfc2833',_0x63dd('0x23'),_0x63dd('0x24'),_0x63dd('0x25'),'auto'),'allowNull':!![],'defaultValue':_0x63dd('0x26')},'directmedia':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x27'),'no',_0x63dd('0x28'),_0x63dd('0x29'),_0x63dd('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x55ba5b){this['setDataValue'](_0x63dd('0x2b'),_0x55ba5b?_0x55ba5b[_0x63dd('0x20')](','):null);},'get':function(){return this[_0x63dd('0xa')](_0x63dd('0x2b'))?this[_0x63dd('0xa')](_0x63dd('0x2b'))['split'](','):null;},'comment':_0x63dd('0x2c')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x63dd('0x2')]},'pickupgroup':{'type':Sequelize[_0x63dd('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x63dd('0x2')]},'language':{'type':Sequelize[_0x63dd('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x63dd('0x2')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x63dd('0x2')],'allowNull':![],'defaultValue':_0x63dd('0x2d'),'set':function(_0x4ae5e1){this[_0x63dd('0x4')](_0x63dd('0x2e'),_0x4ae5e1?_0x4ae5e1[_0x63dd('0x20')](';'):_0x63dd('0x2d'));},'get':function(){return this[_0x63dd('0xa')](_0x63dd('0x2e'))?this[_0x63dd('0xa')](_0x63dd('0x2e'))['split'](';'):null;},'comment':_0x63dd('0x2f')},'autoframing':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x77f431){this[_0x63dd('0x4')](_0x63dd('0x30'),_0x77f431?_0x77f431[_0x63dd('0x20')](','):null);},'get':function(){return this[_0x63dd('0xa')](_0x63dd('0x30'))?this[_0x63dd('0xa')]('insecure')[_0x63dd('0x21')](','):null;},'comment':_0x63dd('0x31')},'trustrpid':{'type':Sequelize['ENUM'](_0x63dd('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x27'),'no',_0x63dd('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![],'defaultValue':_0x63dd('0x33')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x63dd('0xc')]('yes','no'),'allowNull':!![],'defaultValue':_0x63dd('0x27')},'busylevel':{'type':Sequelize[_0x63dd('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0x63dd('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x63dd('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x35'),_0x63dd('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x63dd('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x37'),_0x63dd('0x38')),'allowNull':!![],'defaultValue':_0x63dd('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x27'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x63dd('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x63dd('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x63dd('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x63dd('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x63dd('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x63dd('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x63dd('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x63dd('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x63dd('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x63dd('0xc')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x63dd('0xc')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x63dd('0xc')]('yes','no',_0x63dd('0x39'),_0x63dd('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x63dd('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x3b'),_0x63dd('0x3c'),_0x63dd('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x63dd('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x63dd('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x63dd('0xc')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x63dd('0x27'),'no','nonat',_0x63dd('0x29'),_0x63dd('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x63dd('0x2')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x63dd('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x63dd('0x3f')]},'showWebBar':{'type':Sequelize[_0x63dd('0x11')],'defaultValue':0x0,'set':function(_0x420fe1){this[_0x63dd('0x4')](_0x63dd('0x40'),_0x420fe1);var _0x4097a9=this[_0x63dd('0x41')]({'plain':!![]});switch(_0x420fe1){case 0x0:case 0x1:var _0x35db18=_0x4097a9['transport']?_[_0x63dd('0x42')](_0x4097a9['transport'])?_0x4097a9[_0x63dd('0x1f')]['join']():_0x4097a9['transport']:_0x63dd('0x43');if(_0x35db18===_0x63dd('0x44')){_0x35db18=_0x63dd('0x43');}this['setDataValue'](_0x63dd('0x1f'),_0x35db18);this[_0x63dd('0x4')](_0x63dd('0x45'),'no');this['setDataValue'](_0x63dd('0x46'),null);this[_0x63dd('0x4')]('force_avp',null);this[_0x63dd('0x4')]('icesupport',null);this['setDataValue'](_0x63dd('0x47'),null);this[_0x63dd('0x4')](_0x63dd('0x48'),null);this['setDataValue'](_0x63dd('0x49'),null);this[_0x63dd('0x4')](_0x63dd('0x4a'),null);this[_0x63dd('0x4')](_0x63dd('0x4b'),null);this[_0x63dd('0x4')](_0x63dd('0x4c'),'no');break;case 0x2:this[_0x63dd('0x4')](_0x63dd('0x1f'),'wss');this[_0x63dd('0x4')]('encryption','yes');this['setDataValue']('avpf',_0x63dd('0x27'));this[_0x63dd('0x4')]('force_avp',_0x63dd('0x27'));this['setDataValue'](_0x63dd('0x4d'),_0x63dd('0x27'));this[_0x63dd('0x4')](_0x63dd('0x47'),'yes');this[_0x63dd('0x4')]('dtlsverify','no');this['setDataValue']('dtlssetup',_0x63dd('0x3d'));this[_0x63dd('0x4')]('dtlscertfile',_0x4097a9['dtlscertfile']||_0x63dd('0x4e'));this['setDataValue'](_0x63dd('0x4b'),_0x4097a9['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0x63dd('0x4')]('rtcp_mux',_0x63dd('0x27'));break;default:}}},'permissions':{'type':Sequelize[_0x63dd('0x3f')],'set':function(_0x20cf84){this[_0x63dd('0x4')]('permissions',_0x20cf84?_0x20cf84[_0x63dd('0x20')](','):[]);},'get':function(){return this[_0x63dd('0xa')](_0x63dd('0x4f'))?_[_0x63dd('0x50')](this[_0x63dd('0xa')]('permissions')[_0x63dd('0x21')](','),function(_0x2ac87b){return parseInt(_0x2ac87b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x63dd('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x63dd('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0x63dd('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x63dd('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x63dd('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x63dd('0xc')](_0x63dd('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x63dd('0x2')]},'phoneBarEnableJaws':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x63dd('0x51')],'get':function(){return this[_0x63dd('0xa')]('phoneBarEnableScreenRecordingByAgent')?this[_0x63dd('0xa')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x63dd('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x63dd('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![],'set':function(_0x3b8576){if(typeof _0x3b8576===_0x63dd('0x52')){var _0xea6914=_0x3b8576==='1'?!![]:_0x3b8576==='0'?![]:_0x3b8576===_0x63dd('0x53')?!![]:_0x3b8576===_0x63dd('0x54')?![]:![];this[_0x63dd('0x4')]('screenrecording',_0xea6914);}else{this[_0x63dd('0x4')](_0x63dd('0x55'),_0x3b8576);}}},'blocked':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![],'set':function(_0x55a7d4){this['setDataValue']('blocked',_0x55a7d4);if(_0x55a7d4===!![]){this[_0x63dd('0x4')](_0x63dd('0x56'),moment());this[_0x63dd('0x4')](_0x63dd('0x57'),0x0);}else{this[_0x63dd('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x63dd('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x63dd('0x11')](0x5)[_0x63dd('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x63dd('0x14')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5162=['ENUM','admin','user','agent','local','INTEGER','internal','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','force_rport,comedia','nat','join','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','active','passive','actpass','update','update,nonat','TEXT','showWebBar','get','isArray','udp','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','force_avp','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blockedAt','UNSIGNED','sequelize','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email'];(function(_0x296273,_0xc923ae){var _0x29701b=function(_0x4b5f44){while(--_0x4b5f44){_0x296273['push'](_0x296273['shift']());}};_0x29701b(++_0xc923ae);}(_0x5162,0x103));var _0x2516=function(_0xd2f4f5,_0x341930){_0xd2f4f5=_0xd2f4f5-0x0;var _0x41fc10=_0x5162[_0xd2f4f5];return _0x41fc10;};'use strict';var Sequelize=require(_0x2516('0x0'));var moment=require('moment');var util=require('util');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x2516('0x1')],'allowNull':![],'unique':_0x2516('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3ce7de){this[_0x2516('0x3')](_0x2516('0x2'),_0x3ce7de);this[_0x2516('0x3')](_0x2516('0x4'),_0x3ce7de);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5beeb3){this[_0x2516('0x3')](_0x2516('0x5'),_0x5beeb3);this[_0x2516('0x3')](_0x2516('0x6'),util[_0x2516('0x7')](_0x2516('0x8'),_0x5beeb3,this[_0x2516('0x9')]('internal')));}},'alias':{'type':Sequelize[_0x2516('0x1')]},'email':{'type':Sequelize[_0x2516('0x1')],'allowNull':![],'unique':_0x2516('0xa'),'validate':{'isEmail':!![]},'set':function(_0x5dda21){if(_0x5dda21){this['setDataValue']('email',_0x5dda21['toLowerCase']());}}},'role':{'type':Sequelize[_0x2516('0xb')](_0x2516('0xc'),_0x2516('0xd'),_0x2516('0xe'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x2516('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x2516('0x1')],'defaultValue':_0x2516('0xf')},'internal':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':![],'unique':_0x2516('0x11'),'set':function(_0x558d20){this[_0x2516('0x3')](_0x2516('0x11'),_0x558d20);this[_0x2516('0x3')](_0x2516('0x12'),_0x558d20);this[_0x2516('0x3')](_0x2516('0x6'),util[_0x2516('0x7')](_0x2516('0x8'),this[_0x2516('0x9')]('fullname'),_0x558d20));}},'salt':{'type':Sequelize[_0x2516('0x1')]},'phone':{'type':Sequelize[_0x2516('0x1')]},'mobile':{'type':Sequelize[_0x2516('0x1')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x2516('0x1')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x2516('0x1')]},'online':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x2516('0x14')]},'voicePause':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x2516('0x1')],'defaultValue':_0x2516('0x15')},'lastPauseAt':{'type':Sequelize[_0x2516('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x2516('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x2516('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2516('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![],'defaultValue':_0x2516('0x16')},'ipaddr':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'port':{'type':Sequelize[_0x2516('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x17'),_0x2516('0xd'),'peer'),'allowNull':!![],'defaultValue':_0x2516('0x17')},'context':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x18'),_0x2516('0x19'),_0x2516('0x1a'),_0x2516('0x1b'),_0x2516('0x1c'),_0x2516('0x1d'),_0x2516('0x1e'),_0x2516('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'permit':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'secret':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'transport':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3e7a55){this['setDataValue'](_0x2516('0x20'),_0x3e7a55?_0x3e7a55['join'](','):null);},'get':function(){return this[_0x2516('0x9')]('transport')?this[_0x2516('0x9')](_0x2516('0x20'))[_0x2516('0x21')](','):null;},'comment':_0x2516('0x22')},'dtmfmode':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x23'),_0x2516('0x24'),_0x2516('0x25'),_0x2516('0x26'),'auto'),'allowNull':!![],'defaultValue':_0x2516('0x23')},'directmedia':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no',_0x2516('0x28'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'nat':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![],'defaultValue':_0x2516('0x29'),'set':function(_0x1979b5){this[_0x2516('0x3')](_0x2516('0x2a'),_0x1979b5?_0x1979b5[_0x2516('0x2b')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x2516('0x9')](_0x2516('0x2a'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x2516('0x1')]},'namedcallgroup':{'type':Sequelize[_0x2516('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x2516('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2516('0x1')]},'disallow':{'type':Sequelize[_0x2516('0x1')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x2516('0x1')],'allowNull':![],'defaultValue':_0x2516('0x2c'),'set':function(_0x155cf7){this[_0x2516('0x3')](_0x2516('0x2d'),_0x155cf7?_0x155cf7[_0x2516('0x2b')](';'):_0x2516('0x2c'));},'get':function(){return this[_0x2516('0x9')](_0x2516('0x2d'))?this[_0x2516('0x9')](_0x2516('0x2d'))[_0x2516('0x21')](';'):null;},'comment':_0x2516('0x2e')},'autoframing':{'type':Sequelize['ENUM'](_0x2516('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![],'set':function(_0x5debf2){this[_0x2516('0x3')](_0x2516('0x2f'),_0x5debf2?_0x5debf2[_0x2516('0x2b')](','):null);},'get':function(){return this[_0x2516('0x9')](_0x2516('0x2f'))?this['getDataValue'](_0x2516('0x2f'))[_0x2516('0x21')](','):null;},'comment':_0x2516('0x30')},'trustrpid':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2516('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no',_0x2516('0x31')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2516('0x32')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![],'defaultValue':_0x2516('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x2516('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x2516('0xb')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x2516('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x2516('0x27'),'no',_0x2516('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2516('0xb')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x34'),_0x2516('0x35'),_0x2516('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x37'),_0x2516('0x38')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2516('0xb')]('yes','no'),'allowNull':!![],'defaultValue':_0x2516('0x27')},'keepalive':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x2516('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2516('0xb')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x2516('0xb')]('yes','no','fingerprint',_0x2516('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x3a'),_0x2516('0x3b'),_0x2516('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x2516('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat',_0x2516('0x3d'),_0x2516('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x2516('0x1')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x2516('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x2516('0x3f')]},'showWebBar':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x0,'set':function(_0x503517){this[_0x2516('0x3')](_0x2516('0x40'),_0x503517);var _0x11fa5b=this[_0x2516('0x41')]({'plain':!![]});switch(_0x503517){case 0x0:case 0x1:var _0x27b2ee=_0x11fa5b[_0x2516('0x20')]?_[_0x2516('0x42')](_0x11fa5b[_0x2516('0x20')])?_0x11fa5b[_0x2516('0x20')][_0x2516('0x2b')]():_0x11fa5b[_0x2516('0x20')]:_0x2516('0x43');if(_0x27b2ee===_0x2516('0x44')){_0x27b2ee='udp';}this[_0x2516('0x3')](_0x2516('0x20'),_0x27b2ee);this[_0x2516('0x3')](_0x2516('0x45'),'no');this[_0x2516('0x3')](_0x2516('0x46'),null);this[_0x2516('0x3')]('force_avp',null);this[_0x2516('0x3')](_0x2516('0x47'),null);this[_0x2516('0x3')](_0x2516('0x48'),null);this[_0x2516('0x3')](_0x2516('0x49'),null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x2516('0x4a'),null);this[_0x2516('0x3')](_0x2516('0x4b'),null);this[_0x2516('0x3')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x2516('0x20'),'wss');this[_0x2516('0x3')](_0x2516('0x45'),'yes');this[_0x2516('0x3')](_0x2516('0x46'),_0x2516('0x27'));this[_0x2516('0x3')](_0x2516('0x4c'),_0x2516('0x27'));this[_0x2516('0x3')](_0x2516('0x47'),_0x2516('0x27'));this['setDataValue']('dtlsenable',_0x2516('0x27'));this[_0x2516('0x3')](_0x2516('0x49'),'no');this['setDataValue'](_0x2516('0x4d'),'actpass');this[_0x2516('0x3')](_0x2516('0x4a'),_0x11fa5b[_0x2516('0x4a')]||_0x2516('0x4e'));this[_0x2516('0x3')](_0x2516('0x4b'),_0x11fa5b[_0x2516('0x4b')]||_0x2516('0x4f'));this[_0x2516('0x3')](_0x2516('0x50'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x317942){this['setDataValue']('permissions',_0x317942?_0x317942[_0x2516('0x2b')](','):[]);},'get':function(){return this[_0x2516('0x9')](_0x2516('0x51'))?_[_0x2516('0x52')](this[_0x2516('0x9')](_0x2516('0x51'))[_0x2516('0x21')](','),function(_0x2081a8){return parseInt(_0x2081a8,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x2516('0x1')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x2516('0x1')]},'phoneBarUnconditional':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x2516('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2516('0x1')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2516('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2516('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2516('0x53')],'get':function(){return this[_0x2516('0x9')]('phoneBarEnableScreenRecordingByAgent')?this[_0x2516('0x9')](_0x2516('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x2516('0x1')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x42d604){if(typeof _0x42d604===_0x2516('0x55')){var _0x5b7252=_0x42d604==='1'?!![]:_0x42d604==='0'?![]:_0x42d604==='true'?!![]:_0x42d604===_0x2516('0x56')?![]:![];this['setDataValue'](_0x2516('0x57'),_0x5b7252);}else{this[_0x2516('0x3')](_0x2516('0x57'),_0x42d604);}}},'blocked':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![],'set':function(_0x322df6){this['setDataValue']('blocked',_0x322df6);if(_0x322df6===!![]){this['setDataValue'](_0x2516('0x58'),moment());this[_0x2516('0x3')]('loginAttempts',0x0);}else{this[_0x2516('0x3')](_0x2516('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x2516('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x2516('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x2516('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x2516('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2516('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 1d749dc..4dd39f4 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 _0xe139=['user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$any','firstName','lastName','Contact','Queue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','resolve','teams','queues','isEmpty','inbound','getAgents','toString','asc','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unavailable','busy','slice','toUpperCase','select','field','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','moment','util','path','lodash','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','./user.socket','register','defaults','localhost','client','http','request','then','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','User,\x20%s,\x20%s','message','result','status','end','json','offset','undefined','count','limit','Content-Range','update','destroy','get','role','admin','Users','agent','Telephones','telephone','ignore','value','includes','name','UserProfileResource','stack','send','map','fieldName','key','filter','salt','User','query','includeAll','include','attributes','findAll','openTabs','true','rows','length','push','dataValues','sms','fax','mail','openchannel','whatsapp','all','show','params','model','differenceBy','keys','rawAttributes','password','filters','intersection','fields','merge','find','catch','body','describe','addContacts','ids','omit','Setting','securePassword','validatePasswordPattern','internal','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','from','voicemail','mailbox','VoiceMail','email','permissions','101','102','103','113','110','105','106','108','109','100','111','115','create','Unauthorized','user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','Agents','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','previousPasswords','updatePasswordsHistory','addQueues','channel','loginInPause','voicePause','interface','Unknown\x20channel','capitalize','toLowerCase','Queues','spread','QueueId','emit','Queue:save','voice','VoiceQueue','online','format','UserVoiceQueueRt','removeQueues','isValidChannel','isArray','addAvatar','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','userpic','existsSync','server/files/images/','download','chat','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','CmContact','order','sort','pick','where','options','getContacts','hasOwnProperty','CmList','Tags','color','tag','nolimit','getQueues','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','login','phone','mobile','intrf','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','getChannels','YYYY-MM-DD\x20HH:mm:ss','device','PAUSE','LOGININPAUSE','MemberReport','bulkCreate','concat','isMiddleware','logout','forEach','QueuePause','pause','type','DEFAULT\x20PAUSE','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','unpause','manual','%s%s','Pause','getTeams','Team','addTeams','Voice','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','setDataValue','Sms','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','upsert','penalty','TeamVoicePrefix','UserVoicePrefix','removeTeams','getWhatsappQueues','removeAgent','VoicePrefixId','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions'];(function(_0xbcb315,_0x170664){var _0x434da0=function(_0x12b6d4){while(--_0x12b6d4){_0xbcb315['push'](_0xbcb315['shift']());}};_0x434da0(++_0x170664);}(_0xe139,0x1eb));var _0x9e13=function(_0x59f554,_0x328f9e){_0x59f554=_0x59f554-0x0;var _0x4352d9=_0xe139[_0x59f554];return _0x4352d9;};'use strict';var moment=require(_0x9e13('0x0'));var BPromise=require('bluebird');var util=require(_0x9e13('0x1'));var path=require(_0x9e13('0x2'));var fs=require('fs');var _=require(_0x9e13('0x3'));var squel=require('squel');var jayson=require(_0x9e13('0x4'));var Redis=require(_0x9e13('0x5'));var authService=require(_0x9e13('0x6'));var qs=require(_0x9e13('0x7'));var logger=require(_0x9e13('0x8'))('api');var utils=require(_0x9e13('0x9'));var config=require(_0x9e13('0xa'));var licenseUtil=require(_0x9e13('0xb'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x9e13('0xc')]));require(_0x9e13('0xd'))[_0x9e13('0xe')](socket);config[_0x9e13('0xc')]=_[_0x9e13('0xf')](config[_0x9e13('0xc')],{'host':_0x9e13('0x10'),'port':0x18eb});var client=jayson[_0x9e13('0x11')][_0x9e13('0x12')]({'port':0x232a});var values;function respondWithRpcPromise(_0x16f2a2,_0x338fb8,_0x4ccb75,_0xad71d1){return new BPromise(function(_0x213eab,_0x25a2c9){var _0x540019=_0xad71d1||client;return _0x540019[_0x9e13('0x13')](_0x16f2a2,_0x4ccb75)[_0x9e13('0x14')](function(_0x4a0df8){logger['info']('User,\x20%s,\x20%s',_0x338fb8,'request\x20sent');logger[_0x9e13('0x15')](_0x9e13('0x16'),_0x338fb8,'request\x20sent',JSON[_0x9e13('0x17')](_0x4a0df8));if(_0x4a0df8[_0x9e13('0x18')]){if(_0x4a0df8[_0x9e13('0x18')][_0x9e13('0x19')]===0x1f4){logger[_0x9e13('0x18')](_0x9e13('0x1a'),_0x338fb8,_0x4a0df8[_0x9e13('0x18')]['message']);return _0x25a2c9(_0x4a0df8['error'][_0x9e13('0x1b')]);}logger[_0x9e13('0x18')](_0x9e13('0x1a'),_0x338fb8,_0x4a0df8[_0x9e13('0x18')]['message']);return _0x213eab(_0x4a0df8[_0x9e13('0x18')][_0x9e13('0x1b')]);}else{logger['info']('User,\x20%s,\x20%s',_0x338fb8,'request\x20sent');_0x213eab(_0x4a0df8[_0x9e13('0x1c')][_0x9e13('0x1b')]);}})['catch'](function(_0x5216b2){logger[_0x9e13('0x18')]('User,\x20%s,\x20%s',_0x338fb8,_0x5216b2);_0x25a2c9(_0x5216b2);});});}function respondWithStatusCode(_0x4f0ad2,_0x13683f){_0x13683f=_0x13683f||0xcc;return function(_0x2d0676){if(_0x2d0676){return _0x4f0ad2['sendStatus'](_0x13683f);}return _0x4f0ad2[_0x9e13('0x1d')](_0x13683f)[_0x9e13('0x1e')]();};}function respondWithResult(_0x3bb422,_0x3dc208){_0x3dc208=_0x3dc208||0xc8;return function(_0x1864c8){if(_0x1864c8){return _0x3bb422['status'](_0x3dc208)[_0x9e13('0x1f')](_0x1864c8);}};}function respondWithFilteredResult(_0xeac12e,_0x4acefa){return function(_0x279561){if(_0x279561){var _0x3b1042=typeof _0x4acefa[_0x9e13('0x20')]===_0x9e13('0x21')&&typeof _0x4acefa['limit']===_0x9e13('0x21');var _0x4ab409=_0x279561[_0x9e13('0x22')];var _0x4d8a01=_0x3b1042?0x0:_0x4acefa[_0x9e13('0x20')];var _0x30a29e=_0x3b1042?_0x279561['count']:_0x4acefa[_0x9e13('0x20')]+_0x4acefa[_0x9e13('0x23')];var _0xfbf595;if(_0x30a29e>=_0x4ab409){_0x30a29e=_0x4ab409;_0xfbf595=0xc8;}else{_0xfbf595=0xce;}_0xeac12e[_0x9e13('0x1d')](_0xfbf595);return _0xeac12e['set'](_0x9e13('0x24'),_0x4d8a01+'-'+_0x30a29e+'/'+_0x4ab409)[_0x9e13('0x1f')](_0x279561);}return null;};}function saveUpdates(_0x3f5517){return function(_0x327177){if(_0x327177){return _0x327177[_0x9e13('0x25')](_0x3f5517)[_0x9e13('0x14')](function(_0x1d7276){return _0x1d7276;});}return null;};}function removeEntity(_0x39c4ee){return function(_0x24766a){if(_0x24766a){return _0x24766a[_0x9e13('0x26')]()['then'](function(){var _0x3fb688=_0x24766a[_0x9e13('0x27')]({'plain':!![]});if(_0x3fb688[_0x9e13('0x28')]===_0x9e13('0x29'))return;var _0x850453=[{'name':_0x9e13('0x2a'),'value':'user','ignore':!![]},{'name':'Agents','value':_0x9e13('0x2b'),'ignore':![]},{'name':_0x9e13('0x2c'),'value':_0x9e13('0x2d'),'ignore':![]}];var _0x51bee9=_(_0x850453)['filter'](_0x9e13('0x2e'))['map']('value')[_0x9e13('0x2f')]();if(_[_0x9e13('0x30')](_0x51bee9,_0x3fb688[_0x9e13('0x28')])){return;}var _0x52a8ec=_['find'](_0x850453,[_0x9e13('0x2f'),_0x3fb688['role']])[_0x9e13('0x31')];return db[_0x9e13('0x32')][_0x9e13('0x26')]({'where':{'type':_0x52a8ec,'resourceId':_0x3fb688['id']}})[_0x9e13('0x14')](function(){return _0x24766a;});})['then'](function(){_0x39c4ee['status'](0xcc)[_0x9e13('0x1e')]();});}};}function handleEntityNotFound(_0x24eb0c){return function(_0xa0fd0c){if(!_0xa0fd0c){_0x24eb0c['sendStatus'](0x194);}return _0xa0fd0c;};}function handleError(_0x3fab16,_0x231985){_0x231985=_0x231985||0x1f4;return function(_0x53857e){logger[_0x9e13('0x18')](_0x53857e[_0x9e13('0x33')]);if(_0x53857e[_0x9e13('0x31')]){delete _0x53857e[_0x9e13('0x31')];}_0x3fab16[_0x9e13('0x1d')](_0x231985)[_0x9e13('0x34')](_0x53857e);};}exports['index']=function(_0x1b5449,_0x2b180d){var _0x4b9c87={},_0x220c27={'count':0x0,'rows':[]};var _0x51a6d4=_(db['User']['rawAttributes'])[_0x9e13('0x35')](function(_0x22d26f){return{'name':_0x22d26f[_0x9e13('0x36')],'type':_0x22d26f['type'][_0x9e13('0x37')]};})[_0x9e13('0x38')](function(_0x5b0e5f){return!_[_0x9e13('0x30')](['password',_0x9e13('0x39')],_0x5b0e5f[_0x9e13('0x31')]);})['value']();_0x4b9c87=qs['getOptions'](_0x51a6d4,_0x1b5449);var _0x4e35e8={'where':_0x4b9c87['where']};return db[_0x9e13('0x3a')][_0x9e13('0x22')](_0x4e35e8)['then'](function(_0x5398a2){_0x220c27[_0x9e13('0x22')]=_0x5398a2;if(_0x1b5449[_0x9e13('0x3b')][_0x9e13('0x3c')]){_0x4b9c87[_0x9e13('0x3d')]=[{'all':!![]}];}if(!_[_0x9e13('0x30')](_0x4b9c87[_0x9e13('0x3e')],'id')){_0x4b9c87[_0x9e13('0x3e')]['push']('id');}return db['User'][_0x9e13('0x3f')](_0x4b9c87);})[_0x9e13('0x14')](function(_0x1f481e){_0x220c27['rows']=_0x1f481e;if(_0x1b5449[_0x9e13('0x3b')][_0x9e13('0x40')]===_0x9e13('0x41')){var _0x4ef08f=[];for(var _0x186831=0x0;_0x186831<_0x220c27[_0x9e13('0x42')][_0x9e13('0x43')];_0x186831++){_0x4ef08f[_0x9e13('0x44')](get_open_tabs('chat',_0x220c27[_0x9e13('0x42')][_0x186831][_0x9e13('0x45')]));_0x4ef08f[_0x9e13('0x44')](get_open_tabs(_0x9e13('0x46'),_0x220c27[_0x9e13('0x42')][_0x186831][_0x9e13('0x45')]));_0x4ef08f[_0x9e13('0x44')](get_open_tabs(_0x9e13('0x47'),_0x220c27[_0x9e13('0x42')][_0x186831]['dataValues']));_0x4ef08f['push'](get_open_tabs(_0x9e13('0x48'),_0x220c27[_0x9e13('0x42')][_0x186831]['dataValues']));_0x4ef08f[_0x9e13('0x44')](get_open_tabs(_0x9e13('0x49'),_0x220c27['rows'][_0x186831]['dataValues']));_0x4ef08f[_0x9e13('0x44')](get_open_tabs(_0x9e13('0x4a'),_0x220c27[_0x9e13('0x42')][_0x186831][_0x9e13('0x45')]));}return BPromise[_0x9e13('0x4b')](_0x4ef08f)[_0x9e13('0x14')](function(_0x3bb99b){return _0x220c27;});}else{return _0x220c27;}})[_0x9e13('0x14')](respondWithFilteredResult(_0x2b180d,_0x4b9c87))['catch'](handleError(_0x2b180d,null));};exports[_0x9e13('0x4c')]=function(_0x1b9981,_0x348589){var _0x4a5f15={'raw':![],'where':{'id':_0x1b9981[_0x9e13('0x4d')]['id']}},_0x84022f={};_0x84022f[_0x9e13('0x4e')]=_[_0x9e13('0x4f')](_[_0x9e13('0x50')](db[_0x9e13('0x3a')][_0x9e13('0x51')]),[_0x9e13('0x52'),_0x9e13('0x39')]);_0x84022f['query']=_[_0x9e13('0x50')](_0x1b9981[_0x9e13('0x3b')]);_0x84022f[_0x9e13('0x53')]=_[_0x9e13('0x54')](_0x84022f[_0x9e13('0x4e')],_0x84022f[_0x9e13('0x3b')]);_0x4a5f15['attributes']=_[_0x9e13('0x54')](_0x84022f[_0x9e13('0x4e')],qs[_0x9e13('0x55')](_0x1b9981[_0x9e13('0x3b')]['fields']));_0x4a5f15['attributes']=_0x4a5f15[_0x9e13('0x3e')][_0x9e13('0x43')]?_0x4a5f15[_0x9e13('0x3e')]:_0x84022f[_0x9e13('0x4e')];if(_0x1b9981[_0x9e13('0x3b')][_0x9e13('0x3c')]){_0x4a5f15['include']=[{'all':!![]}];}_0x4a5f15=_[_0x9e13('0x56')]({},_0x4a5f15,_0x1b9981['options']);if(!_[_0x9e13('0x30')](_0x4a5f15['attributes'],'id')){_0x4a5f15[_0x9e13('0x3e')]['push']('id');}return db[_0x9e13('0x3a')][_0x9e13('0x57')](_0x4a5f15)[_0x9e13('0x14')](handleEntityNotFound(_0x348589,null))[_0x9e13('0x14')](function(_0x46cc6b){var _0x4f6d43=[];values=_0x46cc6b;if(_0x1b9981[_0x9e13('0x3b')][_0x9e13('0x40')]===_0x9e13('0x41')){_0x4f6d43['push'](get_open_tabs('chat',_0x46cc6b['dataValues']));_0x4f6d43[_0x9e13('0x44')](get_open_tabs(_0x9e13('0x46'),_0x46cc6b[_0x9e13('0x45')]));_0x4f6d43[_0x9e13('0x44')](get_open_tabs(_0x9e13('0x49'),_0x46cc6b[_0x9e13('0x45')]));_0x4f6d43[_0x9e13('0x44')](get_open_tabs('whatsapp',_0x46cc6b[_0x9e13('0x45')]));_0x4f6d43[_0x9e13('0x44')](get_open_tabs(_0x9e13('0x47'),_0x46cc6b[_0x9e13('0x45')]));_0x4f6d43[_0x9e13('0x44')](get_open_tabs(_0x9e13('0x48'),_0x46cc6b[_0x9e13('0x45')]));return BPromise[_0x9e13('0x4b')](_0x4f6d43);}else{return values;}})[_0x9e13('0x14')](function(_0xbc5b00){return values;})['then'](respondWithResult(_0x348589,null))[_0x9e13('0x58')](handleError(_0x348589,null));};exports['update']=function(_0x4bd595,_0x3d94dc){if(_0x4bd595[_0x9e13('0x59')]['id']){delete _0x4bd595[_0x9e13('0x59')]['id'];}delete _0x4bd595[_0x9e13('0x59')][_0x9e13('0x28')];return db[_0x9e13('0x3a')][_0x9e13('0x57')]({'where':{'id':_0x4bd595[_0x9e13('0x4d')]['id']}})[_0x9e13('0x14')](handleEntityNotFound(_0x3d94dc,null))[_0x9e13('0x14')](saveUpdates(_0x4bd595[_0x9e13('0x59')],null))[_0x9e13('0x14')](respondWithResult(_0x3d94dc,null))['catch'](handleError(_0x3d94dc,null));};exports[_0x9e13('0x5a')]=function(_0x3aa815,_0x234cb8){return db['User'][_0x9e13('0x5a')]()[_0x9e13('0x14')](respondWithResult(_0x234cb8,null))[_0x9e13('0x58')](handleError(_0x234cb8,null));};exports[_0x9e13('0x5b')]=function(_0x379b4a,_0x16da11){return db[_0x9e13('0x3a')]['find']({'where':{'id':_0x379b4a[_0x9e13('0x4d')]['id']}})['then'](handleEntityNotFound(_0x16da11,null))['then'](function(_0x2508e3){if(_0x2508e3){return _0x2508e3[_0x9e13('0x5b')](_0x379b4a[_0x9e13('0x59')][_0x9e13('0x5c')],_[_0x9e13('0x5d')](_0x379b4a['body'],[_0x9e13('0x5c'),'id'])||{});}})['then'](respondWithResult(_0x16da11,null))[_0x9e13('0x58')](handleError(_0x16da11,null));};function validateUser(_0x3f90ea){return new BPromise(function(_0x4ca10c,_0x164cd3){if(_0x3f90ea['internal'])return _0x4ca10c(_0x3f90ea);return db[_0x9e13('0x5e')]['findById'](0x1)[_0x9e13('0x14')](function(_0x2455c8){if(_0x2455c8[_0x9e13('0x5f')])authService[_0x9e13('0x60')](_0x3f90ea[_0x9e13('0x52')]);db[_0x9e13('0x3a')]['max'](_0x9e13('0x61'))['then'](function(_0xb45c57){if(_[_0x9e13('0x62')](_0xb45c57)){_0x3f90ea[_0x9e13('0x61')]=_0x2455c8[_0x9e13('0x63')]||0x1;return;}if(_[_0x9e13('0x62')](_0x2455c8[_0x9e13('0x63')])||_0x2455c8[_0x9e13('0x63')]===_0xb45c57){_0x3f90ea[_0x9e13('0x61')]=_0xb45c57+0x1;return;}if(_0x2455c8[_0x9e13('0x63')]>_0xb45c57){_0x3f90ea[_0x9e13('0x61')]=_0x2455c8['min_internal'];return;}return db[_0x9e13('0x64')][_0x9e13('0x3b')](_0x9e13('0x65'),{'type':db[_0x9e13('0x64')][_0x9e13('0x66')][_0x9e13('0x67')]})[_0x9e13('0x14')](function(_0x26fbe6){if(_0x26fbe6&&_0x26fbe6[_0x9e13('0x43')]){for(var _0x34ef1b=0x0,_0x152a97=_0x26fbe6[_0x9e13('0x43')];_0x34ef1b<_0x152a97&&_[_0x9e13('0x62')](_0x3f90ea[_0x9e13('0x61')]);_0x34ef1b++){if(_0x2455c8[_0x9e13('0x63')]<=_0x26fbe6[_0x34ef1b][_0x9e13('0x68')]){_0x3f90ea[_0x9e13('0x61')]=_0x26fbe6[_0x34ef1b][_0x9e13('0x68')];}else if(_0x2455c8[_0x9e13('0x63')]>_0x26fbe6[_0x34ef1b][_0x9e13('0x68')]&&_0x2455c8[_0x9e13('0x63')]<=_0x26fbe6[_0x34ef1b]['to']){_0x3f90ea['internal']=_0x2455c8['min_internal'];}}}if(_[_0x9e13('0x62')](_0x3f90ea[_0x9e13('0x61')])){_0x3f90ea[_0x9e13('0x61')]=_0xb45c57+0x1;}return _0x4ca10c(_0x3f90ea);});});})[_0x9e13('0x58')](function(_0x57aa5f){_0x164cd3(_0x57aa5f);});});}function updateUser(_0x51b5d2){return new BPromise(function(_0x1eba3b,_0x1e4b71){try{if(_0x51b5d2[_0x9e13('0x69')]){_0x51b5d2[_0x9e13('0x6a')]=_0x51b5d2[_0x9e13('0x61')];_0x51b5d2[_0x9e13('0x6b')]={'mailbox':_0x51b5d2[_0x9e13('0x61')],'password':_0x51b5d2['password'],'fullname':_0x51b5d2['fullname'],'email':_0x51b5d2[_0x9e13('0x6c')]};}if(_0x51b5d2[_0x9e13('0x28')]==='agent'){if(!_0x51b5d2[_0x9e13('0x6d')])_0x51b5d2[_0x9e13('0x6d')]=[_0x9e13('0x6e'),_0x9e13('0x6f'),_0x9e13('0x70'),_0x9e13('0x71'),_0x9e13('0x72'),'104',_0x9e13('0x73'),_0x9e13('0x74'),'107',_0x9e13('0x75'),_0x9e13('0x76'),_0x9e13('0x77'),_0x9e13('0x78'),'114',_0x9e13('0x79')];}_0x1eba3b(_0x51b5d2);}catch(_0x21f223){_0x1e4b71(_0x21f223);}});}exports[_0x9e13('0x7a')]=function(_0x56b57b,_0x10dbb7){if(_0x56b57b['user'][_0x9e13('0x28')]===_0x9e13('0x2b'))throw new Error(_0x9e13('0x7b'));if(_0x56b57b[_0x9e13('0x59')]['role']==='user'&&_0x56b57b[_0x9e13('0x7c')][_0x9e13('0x28')]!==_0x9e13('0x29')){throw new Error(_0x9e13('0x7d'));}if(_0x56b57b[_0x9e13('0x59')][_0x9e13('0x28')]===_0x9e13('0x29')&&_0x56b57b['user'][_0x9e13('0x28')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x9e13('0x7e')]([_0x56b57b['body']])['then'](function(){return validateUser(_0x56b57b[_0x9e13('0x59')]);})[_0x9e13('0x14')](function(_0x4e1eca){return updateUser(_0x4e1eca)[_0x9e13('0x14')](function(_0x4344d8){if(_0x4344d8[_0x9e13('0x28')]==='admin'){_0x4344d8[_0x9e13('0x7f')]=_0x56b57b['user'][_0x9e13('0x7f')];delete _0x4344d8[_0x9e13('0x80')];}return _0x4344d8;});})[_0x9e13('0x14')](function(_0x5879bc){return db[_0x9e13('0x3a')][_0x9e13('0x7a')](_0x5879bc,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})['then'](function(_0x1432a5){if(_0x56b57b[_0x9e13('0x59')]['role']===_0x9e13('0x7c'))return _0x1432a5;if(_0x56b57b[_0x9e13('0x7c')][_0x9e13('0x28')]!==_0x9e13('0x7c'))return _0x1432a5;return db[_0x9e13('0x81')][_0x9e13('0x57')]({'where':{'name':_0x1432a5[_0x9e13('0x28')]===_0x9e13('0x2b')?_0x9e13('0x82'):_0x9e13('0x2c'),'userProfileId':_0x56b57b[_0x9e13('0x7c')][_0x9e13('0x80')]},'raw':!![]})[_0x9e13('0x14')](function(_0x333d54){if(!_0x333d54||_0x333d54[_0x9e13('0x83')]!=0x0)return _0x1432a5;return db[_0x9e13('0x32')][_0x9e13('0x7a')]({'name':_0x1432a5[_0x9e13('0x31')],'resourceId':_0x1432a5['id'],'type':_0x333d54['name'],'sectionId':_0x333d54['id']},{})[_0x9e13('0x14')](function(){return _0x1432a5;});})[_0x9e13('0x58')](function(_0x49d003){logger[_0x9e13('0x18')](_0x9e13('0x84'),_0x49d003);throw _0x49d003;});})['then'](respondWithResult(_0x10dbb7,0xc9))[_0x9e13('0x58')](handleError(_0x10dbb7,null));};exports['bulkCreate']=function(_0xf02936,_0x271da5){var _0x3a5c6e=_0xf02936[_0x9e13('0x59')];var _0x5a495d=[];if(_0xf02936[_0x9e13('0x7c')][_0x9e13('0x28')]===_0x9e13('0x2b'))throw new Error(_0x9e13('0x7b'));if(_[_0x9e13('0x85')](_0x3a5c6e,[_0x9e13('0x28'),_0x9e13('0x7c')])&&_0xf02936[_0x9e13('0x7c')]['role']!==_0x9e13('0x29')){throw new Error(_0x9e13('0x7d'));}if(_[_0x9e13('0x85')](_0x3a5c6e,['role',_0x9e13('0x29')])&&_0xf02936['user'][_0x9e13('0x28')]!==_0x9e13('0x29')){throw new Error(_0x9e13('0x86'));}return licenseUtil[_0x9e13('0x7e')](_0x3a5c6e)['then'](function(){return validateUser(_0x3a5c6e[0x0]);})['then'](function(){for(var _0x2099a5=0x1;_0x2099a5<_0x3a5c6e[_0x9e13('0x43')];_0x2099a5++){var _0x412e41=_0x3a5c6e[_0x2099a5-0x1][_0x9e13('0x61')];if(!_0x3a5c6e[_0x2099a5][_0x9e13('0x61')])_0x3a5c6e[_0x2099a5]['internal']=_0x412e41+0x1;_0x5a495d[_0x9e13('0x44')](validateUser(_0x3a5c6e[_0x2099a5]));}return BPromise[_0x9e13('0x4b')](_0x5a495d);})[_0x9e13('0x14')](function(){_0x5a495d=[];for(var _0x5d702d=0x0;_0x5d702d<_0x3a5c6e[_0x9e13('0x43')];_0x5d702d++){_0x5a495d[_0x9e13('0x44')](updateUser(_0x3a5c6e[_0x5d702d]));}return BPromise[_0x9e13('0x4b')](_0x5a495d);})[_0x9e13('0x14')](function(){return BPromise[_0x9e13('0x87')](_0x3a5c6e,function(_0x4d09e1){return db[_0x9e13('0x3a')][_0x9e13('0x7a')](_0x4d09e1,{'include':[{'model':db[_0x9e13('0x6b')],'as':_0x9e13('0x6b')}]})[_0x9e13('0x14')](function(_0x25c28d){_0x4d09e1['id']=_0x25c28d['id'];return _0x4d09e1;});});})[_0x9e13('0x14')](function(_0x50923c){if(_0xf02936[_0x9e13('0x59')][_0x9e13('0x28')]==='user')return _0x50923c;if(_0xf02936[_0x9e13('0x7c')][_0x9e13('0x28')]!==_0x9e13('0x7c'))return _0x50923c;var _0x4984f0=_['some'](_0x50923c,function(_0x3f85e4){return _0x3f85e4[_0x9e13('0x28')]===_0x9e13('0x2b')||_0x3f85e4[_0x9e13('0x28')]===_0x9e13('0x2d');});if(!_0x4984f0)return _0x50923c;return db[_0x9e13('0x81')][_0x9e13('0x3f')]({'where':{'name':{'$or':[_0x9e13('0x82'),_0x9e13('0x2c')]},'userProfileId':_0xf02936[_0x9e13('0x7c')][_0x9e13('0x80')]},'raw':!![]})[_0x9e13('0x14')](function(_0x2b8df6){if(_['isEmpty'](_0x2b8df6)||!_[_0x9e13('0x85')](_0x2b8df6,['autoAssociation',0x0]))return _0x50923c;_0x5a495d=[];var _0x4ac6e8=_(_0x2b8df6)[_0x9e13('0x35')](function(_0x57e7c1){if(_0x57e7c1[_0x9e13('0x83')]===0x1)return;return _0x57e7c1[_0x9e13('0x31')]===_0x9e13('0x82')?_0x9e13('0x2b'):_0x9e13('0x2d');})[_0x9e13('0x88')]()[_0x9e13('0x2f')]();for(var _0x2f1a0e=0x0;_0x2f1a0e<_0x50923c['length'];_0x2f1a0e++){if(!_['includes'](_0x4ac6e8,_0x50923c[_0x2f1a0e]['role']))return;var _0x17b45d=_0x50923c[_0x2f1a0e][_0x9e13('0x28')]===_0x9e13('0x2b')?'Agents':_0x9e13('0x2c');_0x5a495d['push'](db['UserProfileResource']['create']({'name':_0x50923c[_0x2f1a0e]['name'],'resourceId':_0x50923c[_0x2f1a0e]['id'],'type':_0x17b45d,'sectionId':_[_0x9e13('0x57')](_0x2b8df6,[_0x9e13('0x31'),_0x17b45d])['id']},{}));}return BPromise['all'](_0x5a495d);});})[_0x9e13('0x14')](respondWithResult(_0x271da5,0xc9))[_0x9e13('0x58')](handleError(_0x271da5,null));};exports[_0x9e13('0x89')]=function(_0x15bcad,_0x207379){if(_0x15bcad[_0x9e13('0x59')]['id']){delete _0x15bcad[_0x9e13('0x59')]['id'];}return db[_0x9e13('0x3a')][_0x9e13('0x57')]({'where':{'id':_0x15bcad[_0x9e13('0x4d')]['id']}})[_0x9e13('0x14')](function(_0x216cc0){if(!_0x216cc0)return null;if(_0x216cc0['id']===_0x15bcad[_0x9e13('0x7c')]['id']){if(!_0x15bcad[_0x9e13('0x59')][_0x9e13('0x8a')]||!_0x15bcad[_0x9e13('0x59')][_0x9e13('0x8b')]){throw new db[(_0x9e13('0x8c'))][(_0x9e13('0x8d'))](_0x9e13('0x8e'));}if(!_0x216cc0[_0x9e13('0x8f')](_0x15bcad[_0x9e13('0x59')][_0x9e13('0x8a')])){throw new db[(_0x9e13('0x8c'))][(_0x9e13('0x8d'))](_0x9e13('0x90'));}if(_0x15bcad[_0x9e13('0x59')][_0x9e13('0x8a')]===_0x15bcad[_0x9e13('0x59')]['newPassword']){throw new db[(_0x9e13('0x8c'))][(_0x9e13('0x8d'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x15bcad['user'][_0x9e13('0x28')]===_0x9e13('0x29')){if(!_0x15bcad[_0x9e13('0x59')][_0x9e13('0x8b')]){throw new db[(_0x9e13('0x8c'))][(_0x9e13('0x8d'))](_0x9e13('0x91'));}}else if(_0x15bcad[_0x9e13('0x7c')][_0x9e13('0x28')]===_0x9e13('0x7c')){if(!_0x15bcad[_0x9e13('0x59')][_0x9e13('0x8b')]){throw new db[(_0x9e13('0x8c'))][(_0x9e13('0x8d'))](_0x9e13('0x91'));}if(_0x216cc0[_0x9e13('0x28')]!==_0x9e13('0x2b')){throw new db[(_0x9e13('0x8c'))][(_0x9e13('0x8d'))](_0x9e13('0x7b'));}}else{throw new db[(_0x9e13('0x8c'))][(_0x9e13('0x8d'))](_0x9e13('0x7b'));}return _0x216cc0;})[_0x9e13('0x14')](handleEntityNotFound(_0x207379,null))[_0x9e13('0x14')](function(_0x155ef0){return db['Setting'][_0x9e13('0x92')]({'attributes':['id','securePassword',_0x9e13('0x93'),'passwordHistoryLimit']})[_0x9e13('0x14')](function(_0x417be3){if(_0x417be3[_0x9e13('0x5f')])authService[_0x9e13('0x60')](_0x15bcad['body'][_0x9e13('0x8b')]);if(!_0x417be3[_0x9e13('0x93')]||!_0x155ef0['previousPasswords'])return _0x155ef0;authService['validatePasswordHistory'](_0x15bcad[_0x9e13('0x59')][_0x9e13('0x8b')],_0x155ef0[_0x9e13('0x94')],_0x417be3['passwordHistoryLimit']);return _0x155ef0;})['then'](saveUpdates({'password':_0x15bcad[_0x9e13('0x59')]['newPassword'],'passwordResetAt':_0x15bcad['user']['id']==_0x15bcad[_0x9e13('0x4d')]['id']?moment():null,'previousPasswords':authService[_0x9e13('0x95')](_0x15bcad[_0x9e13('0x59')][_0x9e13('0x8b')],_0x155ef0['previousPasswords'])},null));})[_0x9e13('0x14')](respondWithResult(_0x207379,null))['catch'](handleError(_0x207379,null));};exports[_0x9e13('0x96')]=function(_0x1bbfee,_0x4e710b){var _0x1090f5=_0x1bbfee[_0x9e13('0x59')][_0x9e13('0x97')];return db[_0x9e13('0x3a')]['find']({'where':{'id':_0x1bbfee[_0x9e13('0x4d')]['id']},'attributes':['id',_0x9e13('0x31'),_0x9e13('0x28'),'online',_0x9e13('0x98'),_0x9e13('0x99'),_0x9e13('0x9a')]})[_0x9e13('0x14')](handleEntityNotFound(_0x4e710b,null))[_0x9e13('0x14')](function(_0x4db543){if(_0x4db543){if(!utils['isValidChannel'](_0x1090f5)){throw new db['Sequelize'][(_0x9e13('0x8d'))](_0x9e13('0x9b'));}return _0x4db543['add'+_[_0x9e13('0x9c')](_0x1090f5[_0x9e13('0x9d')]())+_0x9e13('0x9e')](_0x1bbfee[_0x9e13('0x59')][_0x9e13('0x5c')],{'penalty':_0x1bbfee['body']['penalty']||0x0})[_0x9e13('0x9f')](function(_0x1e0813){for(var _0x2bfda0=0x0;_0x2bfda0<_0x1bbfee['body'][_0x9e13('0x5c')]['length'];_0x2bfda0+=0x1){var _0x5093d9={'UserId':Number(_0x1bbfee['params']['id'])};_0x5093d9[_[_0x9e13('0x9c')](_0x1090f5[_0x9e13('0x9d')]())+_0x9e13('0xa0')]=Number(_0x1bbfee['body'][_0x9e13('0x5c')][_0x2bfda0]);socket[_0x9e13('0xa1')]('user'+_[_0x9e13('0x9c')](_0x1090f5[_0x9e13('0x9d')]())+_0x9e13('0xa2'),_0x5093d9);}return _0x1e0813;})['then'](function(){if(_0x1090f5===_0x9e13('0xa3')){return db[_0x9e13('0xa4')][_0x9e13('0x3f')]({'where':{'id':_0x1bbfee[_0x9e13('0x59')][_0x9e13('0x5c')]||[]},'raw':!![],'attributes':['id',_0x9e13('0x31')]});}})['then'](function(_0x3b99b5){var _0x4724bd=_0x4db543['get']({'plain':!![]});var _0x2b3025=[];if(_0x1090f5===_0x9e13('0xa3')&&_0x4724bd[_0x9e13('0x28')]===_0x9e13('0x2b')&&_0x4724bd[_0x9e13('0xa5')]){for(var _0x580f72=0x0;_0x580f72<_0x3b99b5['length'];_0x580f72+=0x1){_0x2b3025[_0x9e13('0x44')]({'membername':_0x4724bd[_0x9e13('0x31')],'UserId':_0x4724bd['id'],'queue_name':_0x3b99b5[_0x580f72][_0x9e13('0x31')],'VoiceQueueId':_0x3b99b5[_0x580f72]['id'],'interface':_[_0x9e13('0x62')](_0x4724bd[_0x9e13('0x9a')])?util[_0x9e13('0xa6')]('SIP/%s',_0x4724bd['name']):_0x4724bd[_0x9e13('0x9a')],'paused':_0x4724bd[_0x9e13('0x99')]||![],'penalty':_0x1bbfee[_0x9e13('0x59')]['penalty']||0x0});}return BPromise[_0x9e13('0x87')](_0x2b3025,function(_0x30b628){return db[_0x9e13('0xa7')]['upsert'](_0x30b628);});}return _0x4db543;});}})[_0x9e13('0x14')](respondWithStatusCode(_0x4e710b,null))[_0x9e13('0x58')](handleError(_0x4e710b,null));};exports[_0x9e13('0xa8')]=function(_0x1f3fdf,_0x575bcd){var _0x449dea;return db[_0x9e13('0x3a')][_0x9e13('0x57')]({'where':{'id':_0x1f3fdf['params']['id']},'attributes':['id',_0x9e13('0x31'),_0x9e13('0x28')]})['then'](handleEntityNotFound(_0x575bcd,null))[_0x9e13('0x14')](function(_0x5ae311){if(_0x5ae311){_0x449dea=_0x5ae311;if(!_0x1f3fdf['query'][_0x9e13('0x97')]||!utils[_0x9e13('0xa9')](_0x1f3fdf['query'][_0x9e13('0x97')])){throw new db[(_0x9e13('0x8c'))][(_0x9e13('0x8d'))](_0x9e13('0x9b'));}return _0x5ae311['remove'+_[_0x9e13('0x9c')](_0x1f3fdf[_0x9e13('0x3b')]['channel'][_0x9e13('0x9d')]())+'Queues'](_0x1f3fdf['query']['ids']);}})['then'](function(_0x48903f){if(_[_0x9e13('0xaa')](_0x1f3fdf[_0x9e13('0x3b')][_0x9e13('0x5c')])){for(var _0x523e22=0x0;_0x523e22<_0x1f3fdf[_0x9e13('0x3b')][_0x9e13('0x5c')][_0x9e13('0x43')];_0x523e22+=0x1){var _0x369693={'UserId':Number(_0x1f3fdf[_0x9e13('0x4d')]['id'])};_0x369693[_[_0x9e13('0x9c')](_0x1f3fdf[_0x9e13('0x3b')][_0x9e13('0x97')][_0x9e13('0x9d')]())+'QueueId']=Number(_0x1f3fdf[_0x9e13('0x3b')][_0x9e13('0x5c')][_0x523e22]);socket[_0x9e13('0xa1')](_0x9e13('0x7c')+_[_0x9e13('0x9c')](_0x1f3fdf[_0x9e13('0x3b')]['channel'][_0x9e13('0x9d')]())+'Queue:remove',_0x369693);}}else{var _0x369693={'UserId':Number(_0x1f3fdf['params']['id'])};_0x369693[_[_0x9e13('0x9c')](_0x1f3fdf[_0x9e13('0x3b')][_0x9e13('0x97')][_0x9e13('0x9d')]())+_0x9e13('0xa0')]=Number(_0x1f3fdf[_0x9e13('0x3b')]['ids']);socket[_0x9e13('0xa1')](_0x9e13('0x7c')+_[_0x9e13('0x9c')](_0x1f3fdf['query'][_0x9e13('0x97')][_0x9e13('0x9d')]())+'Queue:remove',_0x369693);}return _0x48903f;})[_0x9e13('0x14')](function(){if(_0x1f3fdf['query']['channel']===_0x9e13('0xa3')){return db['UserVoiceQueueRt'][_0x9e13('0x26')]({'where':{'UserId':_0x1f3fdf[_0x9e13('0x4d')]['id'],'VoiceQueueId':_0x1f3fdf['query'][_0x9e13('0x5c')]},'individualHooks':!![]})['then'](function(){return _0x449dea;});}return _0x449dea;})[_0x9e13('0x14')](respondWithStatusCode(_0x575bcd,null))[_0x9e13('0x58')](handleError(_0x575bcd,null));};exports[_0x9e13('0xab')]=function(_0x3ebeb9,_0x4c60a0){_0x3ebeb9[_0x9e13('0x59')]['userpic']=_0x3ebeb9[_0x9e13('0xac')][_0x9e13('0xad')];return db[_0x9e13('0x3a')]['find']({'where':{'id':_0x3ebeb9[_0x9e13('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4c60a0,null))['then'](saveUpdates(_0x3ebeb9[_0x9e13('0x59')],null))['then'](respondWithResult(_0x4c60a0,null))[_0x9e13('0x58')](handleError(_0x4c60a0,null));};exports[_0x9e13('0xae')]=function(_0x4a6ddd,_0x24c98a){var _0x22018d=path['join'](config[_0x9e13('0xaf')],_0x9e13('0xb0'));return db['User'][_0x9e13('0x57')]({'where':{'id':_0x4a6ddd[_0x9e13('0x4d')]['id']},'attributes':['id',_0x9e13('0xb1')],'raw':!![]})[_0x9e13('0x14')](handleEntityNotFound(_0x24c98a,null))[_0x9e13('0x14')](function(_0x45c808){if(_0x45c808){if(_['isNil'](_0x45c808[_0x9e13('0xb1')])){return _0x24c98a['download'](_0x22018d);}else{if(!fs[_0x9e13('0xb2')](path['join'](config[_0x9e13('0xaf')],_0x9e13('0xb3'),_0x45c808['userpic']))){return _0x24c98a[_0x9e13('0xb4')](_0x22018d);}return _0x24c98a['download'](path['join'](config['root'],'server/files/images/',_0x45c808[_0x9e13('0xb1')]));}}})['catch'](handleError(_0x24c98a,null));};exports['getOpenTabs']=function(_0x481daa,_0x4d6cb6){return db['User'][_0x9e13('0x57')]({'where':{'id':_0x481daa[_0x9e13('0x4d')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x4d6cb6,null))['then'](function(_0x153066){var _0x501c9a=[];values=_0x153066['dataValues'];_0x501c9a[_0x9e13('0x44')](get_open_tabs(_0x9e13('0xb5'),_0x153066[_0x9e13('0x45')]));_0x501c9a[_0x9e13('0x44')](get_open_tabs(_0x9e13('0x46'),_0x153066[_0x9e13('0x45')]));_0x501c9a['push'](get_open_tabs('openchannel',_0x153066[_0x9e13('0x45')]));_0x501c9a[_0x9e13('0x44')](get_open_tabs(_0x9e13('0x4a'),_0x153066['dataValues']));_0x501c9a['push'](get_open_tabs('fax',_0x153066['dataValues']));_0x501c9a['push'](get_open_tabs(_0x9e13('0x48'),_0x153066[_0x9e13('0x45')]));return BPromise['all'](_0x501c9a);})['then'](function(_0x38936d){var _0x262f57=[];if(_0x38936d){for(var _0x267097=0x0;_0x267097=_0x4a6cc5){_0x24ec7a=_0x4a6cc5;_0x44223b=0xc8;}else{_0x44223b=0xce;}_0x64d54f['status'](_0x44223b);return _0x64d54f[_0x7078('0x21')](_0x7078('0x22'),_0x3a9849+'-'+_0x24ec7a+'/'+_0x4a6cc5)[_0x7078('0x1c')](_0x4d439c);}return null;};}function saveUpdates(_0x41a8b3){return function(_0x90e680){if(_0x90e680){return _0x90e680[_0x7078('0x23')](_0x41a8b3)[_0x7078('0x10')](function(_0x1ef9d7){return _0x1ef9d7;});}return null;};}function removeEntity(_0x377c37){return function(_0xdfb4c7){if(_0xdfb4c7){return _0xdfb4c7['destroy']()[_0x7078('0x10')](function(){var _0x547aab=_0xdfb4c7[_0x7078('0x24')]({'plain':!![]});if(_0x547aab[_0x7078('0x25')]===_0x7078('0x26'))return;var _0xbdf31=[{'name':_0x7078('0x27'),'value':_0x7078('0x28'),'ignore':!![]},{'name':_0x7078('0x29'),'value':'agent','ignore':![]},{'name':_0x7078('0x2a'),'value':_0x7078('0x2b'),'ignore':![]}];var _0x3215ad=_(_0xbdf31)[_0x7078('0x2c')](_0x7078('0x2d'))[_0x7078('0x2e')](_0x7078('0x2f'))[_0x7078('0x2f')]();if(_[_0x7078('0x30')](_0x3215ad,_0x547aab['role'])){return;}var _0x221338=_[_0x7078('0x31')](_0xbdf31,[_0x7078('0x2f'),_0x547aab['role']])[_0x7078('0x32')];return db[_0x7078('0x33')][_0x7078('0x34')]({'where':{'type':_0x221338,'resourceId':_0x547aab['id']}})['then'](function(){return _0xdfb4c7;});})[_0x7078('0x10')](function(){_0x377c37['status'](0xcc)[_0x7078('0x35')]();});}};}function handleEntityNotFound(_0x413d81){return function(_0x185be4){if(!_0x185be4){_0x413d81[_0x7078('0x36')](0x194);}return _0x185be4;};}function handleError(_0x30623e,_0x5e544b){_0x5e544b=_0x5e544b||0x1f4;return function(_0x536851){logger[_0x7078('0x16')](_0x536851[_0x7078('0x37')]);if(_0x536851[_0x7078('0x32')]){delete _0x536851[_0x7078('0x32')];}_0x30623e['status'](_0x5e544b)['send'](_0x536851);};}exports[_0x7078('0x38')]=function(_0x5ad162,_0x32593e){var _0x375651={},_0x377521={'count':0x0,'rows':[]};var _0x359838=_(db[_0x7078('0x39')][_0x7078('0x3a')])['map'](function(_0xfd6de8){return{'name':_0xfd6de8[_0x7078('0x3b')],'type':_0xfd6de8[_0x7078('0x3c')][_0x7078('0x3d')]};})[_0x7078('0x2c')](function(_0x5075b7){return!_['includes'](['password',_0x7078('0x3e')],_0x5075b7['name']);})['value']();_0x375651=qs[_0x7078('0x3f')](_0x359838,_0x5ad162);var _0x39a6c9={'where':_0x375651[_0x7078('0x40')]};return db[_0x7078('0x39')][_0x7078('0x1f')](_0x39a6c9)['then'](function(_0x5f5ae7){_0x377521[_0x7078('0x1f')]=_0x5f5ae7;if(_0x5ad162['query'][_0x7078('0x41')]){_0x375651[_0x7078('0x42')]=[{'all':!![]}];}if(!_[_0x7078('0x30')](_0x375651['attributes'],'id')){_0x375651['attributes'][_0x7078('0x43')]('id');}return db['User'][_0x7078('0x44')](_0x375651);})[_0x7078('0x10')](function(_0x5bff1e){_0x377521[_0x7078('0x45')]=_0x5bff1e;if(_0x5ad162[_0x7078('0x46')]['openTabs']==='true'){var _0x32c3cc=[];for(var _0x1c0f21=0x0;_0x1c0f21<_0x377521[_0x7078('0x45')][_0x7078('0x47')];_0x1c0f21++){_0x32c3cc['push'](get_open_tabs('chat',_0x377521['rows'][_0x1c0f21][_0x7078('0x48')]));_0x32c3cc[_0x7078('0x43')](get_open_tabs('sms',_0x377521[_0x7078('0x45')][_0x1c0f21][_0x7078('0x48')]));_0x32c3cc[_0x7078('0x43')](get_open_tabs(_0x7078('0x49'),_0x377521[_0x7078('0x45')][_0x1c0f21][_0x7078('0x48')]));_0x32c3cc[_0x7078('0x43')](get_open_tabs('mail',_0x377521[_0x7078('0x45')][_0x1c0f21][_0x7078('0x48')]));_0x32c3cc[_0x7078('0x43')](get_open_tabs(_0x7078('0x4a'),_0x377521[_0x7078('0x45')][_0x1c0f21]['dataValues']));_0x32c3cc['push'](get_open_tabs(_0x7078('0x4b'),_0x377521['rows'][_0x1c0f21][_0x7078('0x48')]));}return BPromise[_0x7078('0x4c')](_0x32c3cc)[_0x7078('0x10')](function(_0x5eb7e1){return _0x377521;});}else{return _0x377521;}})[_0x7078('0x10')](respondWithFilteredResult(_0x32593e,_0x375651))[_0x7078('0x1a')](handleError(_0x32593e,null));};exports['show']=function(_0x569cc0,_0x5f667d){var _0xbbcc6b={'raw':![],'where':{'id':_0x569cc0[_0x7078('0x4d')]['id']}},_0x33f873={};_0x33f873[_0x7078('0x4e')]=_[_0x7078('0x4f')](_['keys'](db[_0x7078('0x39')][_0x7078('0x3a')]),[_0x7078('0x50'),_0x7078('0x3e')]);_0x33f873[_0x7078('0x46')]=_[_0x7078('0x51')](_0x569cc0[_0x7078('0x46')]);_0x33f873[_0x7078('0x52')]=_[_0x7078('0x53')](_0x33f873['model'],_0x33f873[_0x7078('0x46')]);_0xbbcc6b[_0x7078('0x54')]=_[_0x7078('0x53')](_0x33f873[_0x7078('0x4e')],qs['fields'](_0x569cc0['query'][_0x7078('0x55')]));_0xbbcc6b[_0x7078('0x54')]=_0xbbcc6b['attributes'][_0x7078('0x47')]?_0xbbcc6b[_0x7078('0x54')]:_0x33f873[_0x7078('0x4e')];if(_0x569cc0[_0x7078('0x46')]['includeAll']){_0xbbcc6b['include']=[{'all':!![]}];}_0xbbcc6b=_[_0x7078('0x56')]({},_0xbbcc6b,_0x569cc0[_0x7078('0x57')]);if(!_[_0x7078('0x30')](_0xbbcc6b['attributes'],'id')){_0xbbcc6b[_0x7078('0x54')][_0x7078('0x43')]('id');}return db[_0x7078('0x39')][_0x7078('0x31')](_0xbbcc6b)[_0x7078('0x10')](handleEntityNotFound(_0x5f667d,null))['then'](function(_0x56524f){var _0x4aec54=[];values=_0x56524f;if(_0x569cc0[_0x7078('0x46')][_0x7078('0x58')]===_0x7078('0x59')){_0x4aec54[_0x7078('0x43')](get_open_tabs('chat',_0x56524f[_0x7078('0x48')]));_0x4aec54[_0x7078('0x43')](get_open_tabs(_0x7078('0x5a'),_0x56524f['dataValues']));_0x4aec54[_0x7078('0x43')](get_open_tabs(_0x7078('0x4a'),_0x56524f[_0x7078('0x48')]));_0x4aec54[_0x7078('0x43')](get_open_tabs(_0x7078('0x4b'),_0x56524f['dataValues']));_0x4aec54[_0x7078('0x43')](get_open_tabs(_0x7078('0x49'),_0x56524f[_0x7078('0x48')]));_0x4aec54['push'](get_open_tabs(_0x7078('0x5b'),_0x56524f[_0x7078('0x48')]));return BPromise[_0x7078('0x4c')](_0x4aec54);}else{return values;}})[_0x7078('0x10')](function(_0x383753){return values;})[_0x7078('0x10')](respondWithResult(_0x5f667d,null))[_0x7078('0x1a')](handleError(_0x5f667d,null));};exports[_0x7078('0x23')]=function(_0x4f4b6e,_0x5c0dc0){if(_0x4f4b6e[_0x7078('0x5c')]['id']){delete _0x4f4b6e[_0x7078('0x5c')]['id'];}delete _0x4f4b6e[_0x7078('0x5c')][_0x7078('0x25')];return db[_0x7078('0x39')][_0x7078('0x31')]({'where':{'id':_0x4f4b6e['params']['id']}})[_0x7078('0x10')](handleEntityNotFound(_0x5c0dc0,null))[_0x7078('0x10')](saveUpdates(_0x4f4b6e['body'],null))[_0x7078('0x10')](respondWithResult(_0x5c0dc0,null))[_0x7078('0x1a')](handleError(_0x5c0dc0,null));};exports[_0x7078('0x5d')]=function(_0x39b7d2,_0x2dd93f){return db[_0x7078('0x39')][_0x7078('0x5d')]()[_0x7078('0x10')](respondWithResult(_0x2dd93f,null))[_0x7078('0x1a')](handleError(_0x2dd93f,null));};exports[_0x7078('0x5e')]=function(_0x11d0ec,_0x44edc7){return db[_0x7078('0x39')][_0x7078('0x31')]({'where':{'id':_0x11d0ec[_0x7078('0x4d')]['id']}})[_0x7078('0x10')](handleEntityNotFound(_0x44edc7,null))[_0x7078('0x10')](function(_0x1e818e){if(_0x1e818e){return _0x1e818e[_0x7078('0x5e')](_0x11d0ec[_0x7078('0x5c')][_0x7078('0x5f')],_[_0x7078('0x60')](_0x11d0ec[_0x7078('0x5c')],[_0x7078('0x5f'),'id'])||{});}})['then'](respondWithResult(_0x44edc7,null))[_0x7078('0x1a')](handleError(_0x44edc7,null));};function validateUser(_0x9ded8){return new BPromise(function(_0x4d213c,_0x382c04){if(_0x9ded8[_0x7078('0x61')])return _0x4d213c(_0x9ded8);return db[_0x7078('0x62')][_0x7078('0x63')](0x1)[_0x7078('0x10')](function(_0x5109bc){if(_0x5109bc[_0x7078('0x64')])authService['validatePasswordPattern'](_0x9ded8[_0x7078('0x50')]);db[_0x7078('0x39')]['max'](_0x7078('0x61'))[_0x7078('0x10')](function(_0x4c127b){if(_[_0x7078('0x65')](_0x4c127b)){_0x9ded8[_0x7078('0x61')]=_0x5109bc[_0x7078('0x66')]||0x1;return;}if(_[_0x7078('0x65')](_0x5109bc[_0x7078('0x66')])||_0x5109bc[_0x7078('0x66')]===_0x4c127b){_0x9ded8[_0x7078('0x61')]=_0x4c127b+0x1;return;}if(_0x5109bc[_0x7078('0x66')]>_0x4c127b){_0x9ded8[_0x7078('0x61')]=_0x5109bc['min_internal'];return;}return db['sequelize'][_0x7078('0x46')](_0x7078('0x67'),{'type':db[_0x7078('0x68')]['QueryTypes']['SELECT']})[_0x7078('0x10')](function(_0x522407){if(_0x522407&&_0x522407[_0x7078('0x47')]){for(var _0x43636e=0x0,_0x3191ed=_0x522407[_0x7078('0x47')];_0x43636e<_0x3191ed&&_['isNil'](_0x9ded8[_0x7078('0x61')]);_0x43636e++){if(_0x5109bc[_0x7078('0x66')]<=_0x522407[_0x43636e][_0x7078('0x69')]){_0x9ded8['internal']=_0x522407[_0x43636e][_0x7078('0x69')];}else if(_0x5109bc[_0x7078('0x66')]>_0x522407[_0x43636e][_0x7078('0x69')]&&_0x5109bc[_0x7078('0x66')]<=_0x522407[_0x43636e]['to']){_0x9ded8['internal']=_0x5109bc[_0x7078('0x66')];}}}if(_[_0x7078('0x65')](_0x9ded8[_0x7078('0x61')])){_0x9ded8[_0x7078('0x61')]=_0x4c127b+0x1;}return _0x4d213c(_0x9ded8);});});})[_0x7078('0x1a')](function(_0x17f5bf){_0x382c04(_0x17f5bf);});});}function updateUser(_0x259ff2){return new BPromise(function(_0x3b238f,_0x44328a){try{if(_0x259ff2[_0x7078('0x6a')]){_0x259ff2[_0x7078('0x6b')]=_0x259ff2[_0x7078('0x61')];_0x259ff2[_0x7078('0x6c')]={'mailbox':_0x259ff2[_0x7078('0x61')],'password':_0x259ff2['password'],'fullname':_0x259ff2[_0x7078('0x6d')],'email':_0x259ff2[_0x7078('0x6e')]};}if(_0x259ff2[_0x7078('0x25')]===_0x7078('0x6f')){if(!_0x259ff2[_0x7078('0x70')])_0x259ff2[_0x7078('0x70')]=[_0x7078('0x71'),'102',_0x7078('0x72'),_0x7078('0x73'),_0x7078('0x74'),'104',_0x7078('0x75'),_0x7078('0x76'),_0x7078('0x77'),'108','109',_0x7078('0x78'),_0x7078('0x79'),_0x7078('0x7a'),_0x7078('0x7b')];}_0x3b238f(_0x259ff2);}catch(_0x1e3c23){_0x44328a(_0x1e3c23);}});}exports[_0x7078('0x7c')]=function(_0x5e2f3d,_0xa69def){if(_0x5e2f3d[_0x7078('0x28')][_0x7078('0x25')]===_0x7078('0x6f'))throw new Error(_0x7078('0x7d'));if(_0x5e2f3d[_0x7078('0x5c')][_0x7078('0x25')]==='user'&&_0x5e2f3d['user'][_0x7078('0x25')]!==_0x7078('0x26')){throw new Error(_0x7078('0x7e'));}if(_0x5e2f3d[_0x7078('0x5c')][_0x7078('0x25')]===_0x7078('0x26')&&_0x5e2f3d[_0x7078('0x28')][_0x7078('0x25')]!==_0x7078('0x26')){throw new Error(_0x7078('0x7f'));}return licenseUtil[_0x7078('0x80')]([_0x5e2f3d[_0x7078('0x5c')]])['then'](function(){return validateUser(_0x5e2f3d['body']);})['then'](function(_0x1e141c){return updateUser(_0x1e141c)[_0x7078('0x10')](function(_0x12c861){if(_0x12c861['role']==='admin'){_0x12c861[_0x7078('0x81')]=_0x5e2f3d[_0x7078('0x28')][_0x7078('0x81')];delete _0x12c861[_0x7078('0x82')];}return _0x12c861;});})[_0x7078('0x10')](function(_0x5c3916){return db[_0x7078('0x39')][_0x7078('0x7c')](_0x5c3916,{'include':[{'model':db[_0x7078('0x6c')],'as':_0x7078('0x6c')}]});})[_0x7078('0x10')](function(_0x3fe9c8){if(_0x5e2f3d['body'][_0x7078('0x25')]===_0x7078('0x28'))return _0x3fe9c8;if(_0x5e2f3d['user'][_0x7078('0x25')]!==_0x7078('0x28'))return _0x3fe9c8;return db['UserProfileSection'][_0x7078('0x31')]({'where':{'name':_0x3fe9c8[_0x7078('0x25')]==='agent'?'Agents':_0x7078('0x2a'),'userProfileId':_0x5e2f3d[_0x7078('0x28')][_0x7078('0x82')]},'raw':!![]})[_0x7078('0x10')](function(_0x52b97e){if(!_0x52b97e||_0x52b97e['autoAssociation']!=0x0)return _0x3fe9c8;return db[_0x7078('0x33')]['create']({'name':_0x3fe9c8[_0x7078('0x32')],'resourceId':_0x3fe9c8['id'],'type':_0x52b97e['name'],'sectionId':_0x52b97e['id']},{})[_0x7078('0x10')](function(){return _0x3fe9c8;});})['catch'](function(_0x31548c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31548c);throw _0x31548c;});})['then'](respondWithResult(_0xa69def,0xc9))[_0x7078('0x1a')](handleError(_0xa69def,null));};exports[_0x7078('0x83')]=function(_0x430e74,_0x30b9c2){var _0x727756=_0x430e74[_0x7078('0x5c')];var _0x2ee95b=[];if(_0x430e74[_0x7078('0x28')]['role']==='agent')throw new Error(_0x7078('0x7d'));if(_[_0x7078('0x84')](_0x727756,[_0x7078('0x25'),_0x7078('0x28')])&&_0x430e74[_0x7078('0x28')][_0x7078('0x25')]!==_0x7078('0x26')){throw new Error(_0x7078('0x7e'));}if(_['some'](_0x727756,[_0x7078('0x25'),_0x7078('0x26')])&&_0x430e74[_0x7078('0x28')]['role']!==_0x7078('0x26')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x7078('0x80')](_0x727756)[_0x7078('0x10')](function(){return validateUser(_0x727756[0x0]);})['then'](function(){for(var _0x502fec=0x1;_0x502fec<_0x727756[_0x7078('0x47')];_0x502fec++){var _0x467cc0=_0x727756[_0x502fec-0x1]['internal'];if(!_0x727756[_0x502fec]['internal'])_0x727756[_0x502fec][_0x7078('0x61')]=_0x467cc0+0x1;_0x2ee95b[_0x7078('0x43')](validateUser(_0x727756[_0x502fec]));}return BPromise['all'](_0x2ee95b);})['then'](function(){_0x2ee95b=[];for(var _0x4d05c7=0x0;_0x4d05c7<_0x727756[_0x7078('0x47')];_0x4d05c7++){_0x2ee95b[_0x7078('0x43')](updateUser(_0x727756[_0x4d05c7]));}return BPromise[_0x7078('0x4c')](_0x2ee95b);})['then'](function(){return BPromise[_0x7078('0x85')](_0x727756,function(_0x2f3c99){return db[_0x7078('0x39')][_0x7078('0x7c')](_0x2f3c99,{'include':[{'model':db[_0x7078('0x6c')],'as':_0x7078('0x6c')}]})[_0x7078('0x10')](function(_0x15b299){_0x2f3c99['id']=_0x15b299['id'];return _0x2f3c99;});});})[_0x7078('0x10')](function(_0x162506){if(_0x430e74['body'][_0x7078('0x25')]===_0x7078('0x28'))return _0x162506;if(_0x430e74[_0x7078('0x28')]['role']!=='user')return _0x162506;var _0x351db3=_['some'](_0x162506,function(_0x2fd789){return _0x2fd789[_0x7078('0x25')]===_0x7078('0x6f')||_0x2fd789[_0x7078('0x25')]===_0x7078('0x2b');});if(!_0x351db3)return _0x162506;return db[_0x7078('0x86')]['findAll']({'where':{'name':{'$or':[_0x7078('0x29'),_0x7078('0x2a')]},'userProfileId':_0x430e74['user'][_0x7078('0x82')]},'raw':!![]})[_0x7078('0x10')](function(_0x45dd0c){if(_[_0x7078('0x87')](_0x45dd0c)||!_['some'](_0x45dd0c,[_0x7078('0x88'),0x0]))return _0x162506;_0x2ee95b=[];var _0x14e1f3=_(_0x45dd0c)[_0x7078('0x2e')](function(_0x347042){if(_0x347042['autoAssociation']===0x1)return;return _0x347042['name']==='Agents'?_0x7078('0x6f'):_0x7078('0x2b');})['compact']()['value']();for(var _0x59326b=0x0;_0x59326b<_0x162506[_0x7078('0x47')];_0x59326b++){if(!_[_0x7078('0x30')](_0x14e1f3,_0x162506[_0x59326b][_0x7078('0x25')]))return;var _0x378d03=_0x162506[_0x59326b]['role']===_0x7078('0x6f')?_0x7078('0x29'):_0x7078('0x2a');_0x2ee95b['push'](db[_0x7078('0x33')][_0x7078('0x7c')]({'name':_0x162506[_0x59326b][_0x7078('0x32')],'resourceId':_0x162506[_0x59326b]['id'],'type':_0x378d03,'sectionId':_[_0x7078('0x31')](_0x45dd0c,[_0x7078('0x32'),_0x378d03])['id']},{}));}return BPromise['all'](_0x2ee95b);});})[_0x7078('0x10')](respondWithResult(_0x30b9c2,0xc9))[_0x7078('0x1a')](handleError(_0x30b9c2,null));};exports[_0x7078('0x89')]=function(_0x1d6ca1,_0x2fd582){if(_0x1d6ca1['body']['id']){delete _0x1d6ca1[_0x7078('0x5c')]['id'];}return db['User']['find']({'where':{'id':_0x1d6ca1[_0x7078('0x4d')]['id']}})['then'](function(_0x3b191c){if(!_0x3b191c)return null;if(_0x3b191c['id']===_0x1d6ca1[_0x7078('0x28')]['id']){if(!_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8a')]||!_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8b')]){throw new db[(_0x7078('0x8c'))][(_0x7078('0x8d'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3b191c[_0x7078('0x8e')](_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8a')])){throw new db[(_0x7078('0x8c'))][(_0x7078('0x8d'))](_0x7078('0x8f'));}if(_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8a')]===_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8b')]){throw new db[(_0x7078('0x8c'))][(_0x7078('0x8d'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x1d6ca1['user'][_0x7078('0x25')]===_0x7078('0x26')){if(!_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8b')]){throw new db['Sequelize'][(_0x7078('0x8d'))](_0x7078('0x90'));}}else if(_0x1d6ca1[_0x7078('0x28')][_0x7078('0x25')]===_0x7078('0x28')){if(!_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8b')]){throw new db[(_0x7078('0x8c'))][(_0x7078('0x8d'))](_0x7078('0x90'));}if(_0x3b191c['role']!=='agent'){throw new db[(_0x7078('0x8c'))][(_0x7078('0x8d'))](_0x7078('0x7d'));}}else{throw new db[(_0x7078('0x8c'))][(_0x7078('0x8d'))](_0x7078('0x7d'));}return _0x3b191c;})[_0x7078('0x10')](handleEntityNotFound(_0x2fd582,null))[_0x7078('0x10')](function(_0x4f7701){return db['Setting']['findOne']({'attributes':['id',_0x7078('0x64'),'enforcePasswordHistory',_0x7078('0x91')]})[_0x7078('0x10')](function(_0x147c60){if(_0x147c60[_0x7078('0x64')])authService[_0x7078('0x92')](_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8b')]);if(!_0x147c60['enforcePasswordHistory']||!_0x4f7701[_0x7078('0x93')])return _0x4f7701;authService[_0x7078('0x94')](_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8b')],_0x4f7701['previousPasswords'],_0x147c60[_0x7078('0x91')]);return _0x4f7701;})[_0x7078('0x10')](saveUpdates({'password':_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8b')],'passwordResetAt':_0x1d6ca1[_0x7078('0x28')]['id']==_0x1d6ca1['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8b')],_0x4f7701[_0x7078('0x93')])},null));})['then'](respondWithResult(_0x2fd582,null))['catch'](handleError(_0x2fd582,null));};exports[_0x7078('0x95')]=function(_0x266bc5,_0x1aaf58){var _0x22dad3=_0x266bc5[_0x7078('0x5c')][_0x7078('0x96')];return db[_0x7078('0x39')]['find']({'where':{'id':_0x266bc5[_0x7078('0x4d')]['id']},'attributes':['id',_0x7078('0x32'),_0x7078('0x25'),_0x7078('0x97'),_0x7078('0x98'),_0x7078('0x99'),_0x7078('0x9a')]})[_0x7078('0x10')](handleEntityNotFound(_0x1aaf58,null))[_0x7078('0x10')](function(_0x414217){if(_0x414217){if(!utils[_0x7078('0x9b')](_0x22dad3)){throw new db['Sequelize'][(_0x7078('0x8d'))](_0x7078('0x9c'));}return _0x414217[_0x7078('0x9d')+_[_0x7078('0x9e')](_0x22dad3[_0x7078('0x9f')]())+'Queues'](_0x266bc5['body'][_0x7078('0x5f')],{'penalty':_0x266bc5[_0x7078('0x5c')][_0x7078('0xa0')]||0x0})[_0x7078('0xa1')](function(_0x14e9c5){for(var _0xdbe8c5=0x0;_0xdbe8c5<_0x266bc5[_0x7078('0x5c')][_0x7078('0x5f')][_0x7078('0x47')];_0xdbe8c5+=0x1){var _0x4962f1={'UserId':Number(_0x266bc5[_0x7078('0x4d')]['id'])};_0x4962f1[_[_0x7078('0x9e')](_0x22dad3[_0x7078('0x9f')]())+_0x7078('0xa2')]=Number(_0x266bc5['body'][_0x7078('0x5f')][_0xdbe8c5]);socket[_0x7078('0xa3')]('user'+_[_0x7078('0x9e')](_0x22dad3[_0x7078('0x9f')]())+'Queue:save',_0x4962f1);}return _0x14e9c5;})[_0x7078('0x10')](function(){if(_0x22dad3===_0x7078('0xa4')){return db[_0x7078('0xa5')]['findAll']({'where':{'id':_0x266bc5['body']['ids']||[]},'raw':!![],'attributes':['id',_0x7078('0x32')]});}})['then'](function(_0x5901bb){var _0x124580=_0x414217[_0x7078('0x24')]({'plain':!![]});var _0x365aa1=[];if(_0x22dad3===_0x7078('0xa4')&&_0x124580['role']===_0x7078('0x6f')&&_0x124580[_0x7078('0x97')]){for(var _0xe2710f=0x0;_0xe2710f<_0x5901bb[_0x7078('0x47')];_0xe2710f+=0x1){_0x365aa1[_0x7078('0x43')]({'membername':_0x124580['name'],'UserId':_0x124580['id'],'queue_name':_0x5901bb[_0xe2710f][_0x7078('0x32')],'VoiceQueueId':_0x5901bb[_0xe2710f]['id'],'interface':_[_0x7078('0x65')](_0x124580['interface'])?util[_0x7078('0xa6')](_0x7078('0xa7'),_0x124580['name']):_0x124580[_0x7078('0x9a')],'paused':_0x124580[_0x7078('0x99')]||![],'penalty':_0x266bc5['body'][_0x7078('0xa0')]||0x0});}return BPromise['each'](_0x365aa1,function(_0x46be01){return db[_0x7078('0xa8')][_0x7078('0xa9')](_0x46be01);});}return _0x414217;});}})['then'](respondWithStatusCode(_0x1aaf58,null))[_0x7078('0x1a')](handleError(_0x1aaf58,null));};exports['removeQueues']=function(_0x5976a7,_0x2dbbc2){var _0x38b67b;return db[_0x7078('0x39')][_0x7078('0x31')]({'where':{'id':_0x5976a7[_0x7078('0x4d')]['id']},'attributes':['id',_0x7078('0x32'),_0x7078('0x25')]})[_0x7078('0x10')](handleEntityNotFound(_0x2dbbc2,null))[_0x7078('0x10')](function(_0x388f56){if(_0x388f56){_0x38b67b=_0x388f56;if(!_0x5976a7[_0x7078('0x46')][_0x7078('0x96')]||!utils[_0x7078('0x9b')](_0x5976a7[_0x7078('0x46')]['channel'])){throw new db['Sequelize']['ValidationError'](_0x7078('0x9c'));}return _0x388f56[_0x7078('0xaa')+_['capitalize'](_0x5976a7[_0x7078('0x46')][_0x7078('0x96')][_0x7078('0x9f')]())+_0x7078('0xab')](_0x5976a7[_0x7078('0x46')][_0x7078('0x5f')]);}})[_0x7078('0x10')](function(_0x56eb87){if(_[_0x7078('0xac')](_0x5976a7[_0x7078('0x46')][_0x7078('0x5f')])){for(var _0x40ebcf=0x0;_0x40ebcf<_0x5976a7[_0x7078('0x46')][_0x7078('0x5f')]['length'];_0x40ebcf+=0x1){var _0x2da698={'UserId':Number(_0x5976a7[_0x7078('0x4d')]['id'])};_0x2da698[_['capitalize'](_0x5976a7['query'][_0x7078('0x96')][_0x7078('0x9f')]())+'QueueId']=Number(_0x5976a7[_0x7078('0x46')][_0x7078('0x5f')][_0x40ebcf]);socket[_0x7078('0xa3')](_0x7078('0x28')+_['capitalize'](_0x5976a7['query'][_0x7078('0x96')][_0x7078('0x9f')]())+_0x7078('0xad'),_0x2da698);}}else{var _0x2da698={'UserId':Number(_0x5976a7[_0x7078('0x4d')]['id'])};_0x2da698[_['capitalize'](_0x5976a7[_0x7078('0x46')]['channel'][_0x7078('0x9f')]())+_0x7078('0xa2')]=Number(_0x5976a7[_0x7078('0x46')]['ids']);socket[_0x7078('0xa3')]('user'+_[_0x7078('0x9e')](_0x5976a7['query'][_0x7078('0x96')]['toLowerCase']())+_0x7078('0xad'),_0x2da698);}return _0x56eb87;})['then'](function(){if(_0x5976a7[_0x7078('0x46')]['channel']===_0x7078('0xa4')){return db[_0x7078('0xa8')][_0x7078('0x34')]({'where':{'UserId':_0x5976a7[_0x7078('0x4d')]['id'],'VoiceQueueId':_0x5976a7[_0x7078('0x46')][_0x7078('0x5f')]},'individualHooks':!![]})[_0x7078('0x10')](function(){return _0x38b67b;});}return _0x38b67b;})[_0x7078('0x10')](respondWithStatusCode(_0x2dbbc2,null))['catch'](handleError(_0x2dbbc2,null));};exports[_0x7078('0xae')]=function(_0x282981,_0x30ba81){_0x282981['body']['userpic']=_0x282981[_0x7078('0xaf')]['filename'];return db[_0x7078('0x39')][_0x7078('0x31')]({'where':{'id':_0x282981['params']['id']}})['then'](handleEntityNotFound(_0x30ba81,null))['then'](saveUpdates(_0x282981[_0x7078('0x5c')],null))[_0x7078('0x10')](respondWithResult(_0x30ba81,null))[_0x7078('0x1a')](handleError(_0x30ba81,null));};exports[_0x7078('0xb0')]=function(_0x67757e,_0x583efc){var _0xb6a57b=path['join'](config['root'],_0x7078('0xb1'));return db[_0x7078('0x39')][_0x7078('0x31')]({'where':{'id':_0x67757e['params']['id']},'attributes':['id',_0x7078('0xb2')],'raw':!![]})[_0x7078('0x10')](handleEntityNotFound(_0x583efc,null))[_0x7078('0x10')](function(_0x3697cf){if(_0x3697cf){if(_[_0x7078('0x65')](_0x3697cf['userpic'])){return _0x583efc['download'](_0xb6a57b);}else{if(!fs[_0x7078('0xb3')](path[_0x7078('0xb4')](config['root'],_0x7078('0xb5'),_0x3697cf['userpic']))){return _0x583efc['download'](_0xb6a57b);}return _0x583efc['download'](path[_0x7078('0xb4')](config['root'],_0x7078('0xb5'),_0x3697cf['userpic']));}}})[_0x7078('0x1a')](handleError(_0x583efc,null));};exports['getOpenTabs']=function(_0x2cf233,_0x545c99){return db['User'][_0x7078('0x31')]({'where':{'id':_0x2cf233['params']['id']},'attributes':['id']})[_0x7078('0x10')](handleEntityNotFound(_0x545c99,null))['then'](function(_0xd80f59){var _0x211c16=[];values=_0xd80f59[_0x7078('0x48')];_0x211c16['push'](get_open_tabs(_0x7078('0xb6'),_0xd80f59[_0x7078('0x48')]));_0x211c16[_0x7078('0x43')](get_open_tabs(_0x7078('0x5a'),_0xd80f59['dataValues']));_0x211c16[_0x7078('0x43')](get_open_tabs(_0x7078('0x4a'),_0xd80f59[_0x7078('0x48')]));_0x211c16[_0x7078('0x43')](get_open_tabs(_0x7078('0x4b'),_0xd80f59['dataValues']));_0x211c16[_0x7078('0x43')](get_open_tabs(_0x7078('0x49'),_0xd80f59[_0x7078('0x48')]));_0x211c16['push'](get_open_tabs(_0x7078('0x5b'),_0xd80f59[_0x7078('0x48')]));return BPromise[_0x7078('0x4c')](_0x211c16);})[_0x7078('0x10')](function(_0x1b10b3){var _0x4109ea=[];if(_0x1b10b3){for(var _0x34e09e=0x0;_0x34e09e=_0xb75b3f[_0xacd2('0x53')]){throw new Error(_0xacd2('0x54'));}})[_0xacd2('0x26')](function(){if(_0x832d5d){return db[_0xacd2('0x2a')]['destroy']({'where':{'membername':_0x832d5d[_0xacd2('0x28')]},'individualHooks':!![]});}})[_0xacd2('0x26')](function(){if(_0x832d5d){return _0x832d5d[_0xacd2('0x55')]({'raw':!![]});}})[_0xacd2('0x26')](function(_0x2723f0){if(_0x832d5d){if(_0x2723f0){var _0x20907a=[];_0x8fe86c=_0x2723f0;if(_0x8fe86c[_0xacd2('0x2e')]){for(var _0x5dcff8=0x0;_0x5dcff8<_0x8fe86c['length'];_0x5dcff8++){_0x20907a[_0xacd2('0x34')](db[_0xacd2('0x2a')][_0xacd2('0x56')]({'membername':_0x832d5d[_0xacd2('0x28')],'UserId':_0x832d5d['id'],'queue_name':_0x8fe86c[_0x5dcff8][_0xacd2('0x28')],'VoiceQueueId':_0x8fe86c[_0x5dcff8]['id'],'interface':_0x4410cd,'paused':_0x832d5d[_0xacd2('0x57')]||![],'penalty':_0x8fe86c[_0x5dcff8]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xacd2('0x4c')](_0x20907a);}}}})['then'](function(){if(_0x832d5d){return db[_0xacd2('0x2c')][_0xacd2('0x1e')]({'where':{'membername':_0x832d5d[_0xacd2('0x28')],'exitAt':null}});}})[_0xacd2('0x26')](function(_0x2533d1){if(_0x832d5d){if(_0x2533d1&&_0x2533d1[_0xacd2('0x2e')]){var _0x13bd89=[];_0x2533d1[_0xacd2('0x33')](function(_0x314608){_0x13bd89[_0xacd2('0x34')](_0x314608[_0xacd2('0x2b')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xacd2('0x4c')](_0x13bd89);}}})[_0xacd2('0x26')](function(_0x40a996){if(_0x832d5d){var _0x4c5c4f=[];var _0x3fdea4=[];var _0x128395=utils[_0xacd2('0x32')]();var _0x300ffd={'membername':_0x832d5d[_0xacd2('0x28')],'interface':_0x4410cd,'enterAt':moment()['format'](_0xacd2('0x30')),'role':_0x832d5d[_0xacd2('0x58')],'internal':_0x832d5d['internal']};_0x128395[_0xacd2('0x33')](function(_0x210100){_0x4c5c4f['push'](_[_0xacd2('0x59')]({'channel':_0x210100,'type':_0xacd2('0x5a'),'data1':'callysquare','data2':_0x4410cd},_0x300ffd));if(_0x832d5d[_0xacd2('0x57')]){_0x3fdea4['push'](_[_0xacd2('0x59')]({'channel':_0x210100,'type':_0xacd2('0x2d'),'data1':_0xacd2('0x5b')},_0x300ffd));}});return db[_0xacd2('0x2c')][_0xacd2('0x5c')](_0x4c5c4f[_0xacd2('0x5d')](_0x3fdea4),{'individualHooks':!![]});}})[_0xacd2('0x26')](function(){if(_0x832d5d){return _0x832d5d['update']({'online':!![],'lastLoginAt':moment()[_0xacd2('0x2f')](_0xacd2('0x30')),'voicePause':_0x832d5d['loginInPause']||![],'mailPause':_0x832d5d[_0xacd2('0x57')]||![],'chatPause':_0x832d5d['loginInPause']||![],'faxPause':_0x832d5d['loginInPause']||![],'smsPause':_0x832d5d[_0xacd2('0x57')]||![],'openchannelPause':_0x832d5d[_0xacd2('0x57')]||![],'pauseType':_0x832d5d['loginInPause']?_0xacd2('0x5b'):null,'lastPauseAt':moment()[_0xacd2('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x4410cd});}})[_0xacd2('0x26')](function(_0x4e3ec0){_0x41c746(_0x4e3ec0);})[_0xacd2('0x1b')](function(_0x5e4d24){_0x13f26a(_0xd52391[_0xacd2('0x17')](0x1f4,_0x5e4d24[_0xacd2('0x18')]));});});}; \ No newline at end of file +var _0xd273=['all','LogoutUser','destroy','length','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','merge','callysquare','LOGININPAUSE','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./user.socket','register','request','then','info','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','User,\x20%s,\x20%s','message','result','catch','GetUser','User','findAll','options','raw','where','attributes','include','map','model','find','ShowUser','role','internal','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','name','format','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','findOne','channel','isValidChannel','Unknown\x20channel','voice','mail','chat','fax','sms','whatsapp','set','%s%s'];(function(_0x3d817e,_0x4ed0c1){var _0x45358a=function(_0x19618e){while(--_0x19618e){_0x3d817e['push'](_0x3d817e['shift']());}};_0x45358a(++_0x4ed0c1);}(_0xd273,0x12a));var _0x3d27=function(_0x5670a6,_0x1354d4){_0x5670a6=_0x5670a6-0x0;var _0x4788af=_0xd273[_0x5670a6];return _0x4788af;};'use strict';var _=require(_0x3d27('0x0'));var util=require('util');var moment=require(_0x3d27('0x1'));var BPromise=require(_0x3d27('0x2'));var rs=require(_0x3d27('0x3'));var fs=require('fs');var Redis=require(_0x3d27('0x4'));var db=require(_0x3d27('0x5'))['db'];var utils=require(_0x3d27('0x6'));var logger=require(_0x3d27('0x7'))(_0x3d27('0x8'));var config=require(_0x3d27('0x9'));var jayson=require(_0x3d27('0xa'));var client=jayson[_0x3d27('0xb')][_0x3d27('0xc')]({'port':0x232a});config[_0x3d27('0xd')]=_[_0x3d27('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d27('0xf'))[_0x3d27('0x10')](socket);function respondWithRpcPromise(_0x550899,_0x7d45e5,_0x31e695){return new BPromise(function(_0x36044e,_0x527034){return client[_0x3d27('0x11')](_0x550899,_0x31e695)[_0x3d27('0x12')](function(_0x52243b){logger[_0x3d27('0x13')]('User,\x20%s,\x20%s',_0x7d45e5,'request\x20sent');logger[_0x3d27('0x14')](_0x3d27('0x15'),_0x7d45e5,_0x3d27('0x16'),JSON[_0x3d27('0x17')](_0x52243b));if(_0x52243b[_0x3d27('0x18')]){if(_0x52243b['error'][_0x3d27('0x19')]===0x1f4){logger[_0x3d27('0x18')](_0x3d27('0x1a'),_0x7d45e5,_0x52243b[_0x3d27('0x18')][_0x3d27('0x1b')]);return _0x527034(_0x52243b[_0x3d27('0x18')][_0x3d27('0x1b')]);}logger[_0x3d27('0x18')](_0x3d27('0x1a'),_0x7d45e5,_0x52243b['error'][_0x3d27('0x1b')]);return _0x36044e(_0x52243b[_0x3d27('0x18')]['message']);}else{logger[_0x3d27('0x13')](_0x3d27('0x1a'),_0x7d45e5,_0x3d27('0x16'));_0x36044e(_0x52243b[_0x3d27('0x1c')][_0x3d27('0x1b')]);}})[_0x3d27('0x1d')](function(_0xc6b866){logger[_0x3d27('0x18')](_0x3d27('0x1a'),_0x7d45e5,_0xc6b866);_0x527034(_0xc6b866);});});}exports[_0x3d27('0x1e')]=function(_0x13c4a9){var _0x38b7d4=this;return new Promise(function(_0x4763b3,_0x19f7e7){return db[_0x3d27('0x1f')][_0x3d27('0x20')]({'raw':_0x13c4a9[_0x3d27('0x21')]?_0x13c4a9['options'][_0x3d27('0x22')]===undefined?!![]:![]:!![],'where':_0x13c4a9[_0x3d27('0x21')]?_0x13c4a9[_0x3d27('0x21')][_0x3d27('0x23')]||null:null,'attributes':_0x13c4a9[_0x3d27('0x21')]?_0x13c4a9['options'][_0x3d27('0x24')]||null:null,'limit':_0x13c4a9[_0x3d27('0x21')]?_0x13c4a9[_0x3d27('0x21')]['limit']||null:null,'include':_0x13c4a9[_0x3d27('0x21')]?_0x13c4a9[_0x3d27('0x21')][_0x3d27('0x25')]?_[_0x3d27('0x26')](_0x13c4a9[_0x3d27('0x21')][_0x3d27('0x25')],function(_0xf3a79a){return{'model':db[_0xf3a79a[_0x3d27('0x27')]],'as':_0xf3a79a['as'],'attributes':_0xf3a79a['attributes'],'include':_0xf3a79a[_0x3d27('0x25')]?_[_0x3d27('0x26')](_0xf3a79a[_0x3d27('0x25')],function(_0x38096f){return{'model':db[_0x38096f['model']],'as':_0x38096f['as'],'attributes':_0x38096f['attributes'],'include':_0x38096f[_0x3d27('0x25')]?_['map'](_0x38096f[_0x3d27('0x25')],function(_0x166d1e){return{'model':db[_0x166d1e[_0x3d27('0x27')]],'as':_0x166d1e['as'],'attributes':_0x166d1e[_0x3d27('0x24')]};}):[]};}):[]};}):[]:[]})[_0x3d27('0x12')](function(_0x2fd6b8){logger[_0x3d27('0x13')](_0x3d27('0x1e'),_0x13c4a9);logger[_0x3d27('0x14')](_0x3d27('0x1e'),_0x13c4a9,JSON[_0x3d27('0x17')](_0x2fd6b8));_0x4763b3(_0x2fd6b8);})[_0x3d27('0x1d')](function(_0x158b7d){logger['error'](_0x3d27('0x1e'),_0x158b7d['message'],_0x13c4a9);_0x19f7e7(_0x38b7d4[_0x3d27('0x18')](0x1f4,_0x158b7d['message']));});});};exports['ShowUser']=function(_0x14b5eb){var _0x58cdbb=this;return new Promise(function(_0x5ec46f,_0x574a29){return db[_0x3d27('0x1f')][_0x3d27('0x28')]({'raw':_0x14b5eb['options']?_0x14b5eb[_0x3d27('0x21')][_0x3d27('0x22')]===undefined?!![]:![]:!![],'where':_0x14b5eb[_0x3d27('0x21')]?_0x14b5eb[_0x3d27('0x21')]['where']||null:null,'attributes':_0x14b5eb['options']?_0x14b5eb[_0x3d27('0x21')]['attributes']||null:null,'include':_0x14b5eb['options']?_0x14b5eb['options']['include']?_['map'](_0x14b5eb[_0x3d27('0x21')][_0x3d27('0x25')],function(_0x8ab6f){return{'model':db[_0x8ab6f['model']],'as':_0x8ab6f['as'],'attributes':_0x8ab6f[_0x3d27('0x24')],'include':_0x8ab6f[_0x3d27('0x25')]?_[_0x3d27('0x26')](_0x8ab6f[_0x3d27('0x25')],function(_0x511ca2){return{'model':db[_0x511ca2['model']],'as':_0x511ca2['as'],'attributes':_0x511ca2[_0x3d27('0x24')],'include':_0x511ca2[_0x3d27('0x25')]?_[_0x3d27('0x26')](_0x511ca2[_0x3d27('0x25')],function(_0x429948){return{'model':db[_0x429948[_0x3d27('0x27')]],'as':_0x429948['as'],'attributes':_0x429948[_0x3d27('0x24')]};}):[]};}):[]};}):[]:[]})[_0x3d27('0x12')](function(_0xe9cd71){logger['info'](_0x3d27('0x29'),_0x14b5eb);logger['debug'](_0x3d27('0x29'),_0x14b5eb,JSON['stringify'](_0xe9cd71));_0x5ec46f(_0xe9cd71);})[_0x3d27('0x1d')](function(_0x3dd6f9){logger[_0x3d27('0x18')](_0x3d27('0x29'),_0x3dd6f9[_0x3d27('0x1b')],_0x14b5eb);_0x574a29(_0x58cdbb['error'](0x1f4,_0x3dd6f9['message']));});});};exports['PauseUser']=function(_0xdbbae7){var _0x4e35c9=this;return new Promise(function(_0x1b9cba,_0x3548d0){var _0x1dac42;return db['User'][_0x3d27('0x28')]({'where':_0xdbbae7[_0x3d27('0x21')][_0x3d27('0x23')]||{},'attributes':['id','name',_0x3d27('0x2a'),_0x3d27('0x2b'),_0x3d27('0x2c')]})[_0x3d27('0x12')](function(_0x4cfdef){if(_0x4cfdef){_0x1dac42=_0x4cfdef;return db[_0x3d27('0x2d')][_0x3d27('0x2e')]({'paused':0x1},{'where':{'UserId':_0x1dac42['id']},'individualHooks':!![]});}})['then'](function(){if(_0x1dac42){return db[_0x3d27('0x2f')]['findAll']({'where':{'membername':_0x1dac42['name'],'type':_0x3d27('0x30'),'exitAt':null}});}})[_0x3d27('0x12')](function(_0x20ff40){if(_0x1dac42){if(_0x20ff40&&_0x20ff40['length']){var _0x21e1d2=moment()['format'](_0x3d27('0x31'));for(var _0x4e526b=0x0,_0x28fa49=_0x20ff40['length'];_0x4e526b<_0x28fa49;_0x4e526b++){_0x20ff40[_0x4e526b][_0x3d27('0x32')]({'exitAt':_0x21e1d2});}}}})['then'](function(){if(_0x1dac42){var _0x2420d2=[];var _0x102b10=utils[_0x3d27('0x33')]();_0x102b10[_0x3d27('0x34')](function(_0x107df0){_0x2420d2[_0x3d27('0x35')]({'channel':_0x107df0,'membername':_0x1dac42[_0x3d27('0x36')],'interface':_['isNil'](_0x1dac42['interface'])?util[_0x3d27('0x37')](_0x3d27('0x38'),_0x1dac42[_0x3d27('0x36')]):_0x1dac42[_0x3d27('0x2c')],'type':_0x3d27('0x30'),'enterAt':moment()[_0x3d27('0x37')](_0x3d27('0x31')),'data1':_0xdbbae7[_0x3d27('0x39')][_0x3d27('0x3a')]||_0x3d27('0x3b'),'role':_0x1dac42[_0x3d27('0x2a')],'internal':_0x1dac42[_0x3d27('0x2b')],'uniqueid':_0xdbbae7[_0x3d27('0x39')][_0x3d27('0x3c')]||null});});return db[_0x3d27('0x2f')][_0x3d27('0x3d')](_0x2420d2,{'individualHooks':!![]});}})[_0x3d27('0x12')](function(){if(_0x1dac42){return _0x1dac42[_0x3d27('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xdbbae7['body']['type']||_0x3d27('0x3b'),'lastPauseAt':moment()[_0x3d27('0x37')](_0x3d27('0x31'))});}})[_0x3d27('0x12')](function(_0x39aa19){_0x1b9cba(_0x39aa19);})[_0x3d27('0x1d')](function(_0x2e47a4){_0x3548d0(_0x4e35c9[_0x3d27('0x18')](0x1f4,_0x2e47a4[_0x3d27('0x1b')]));});});};exports['UnpauseUser']=function(_0x443486){var _0xe09d09=this;return new Promise(function(_0x1b55e9,_0x325320){var _0x5963c0;return db[_0x3d27('0x1f')][_0x3d27('0x3e')]({'where':_0x443486[_0x3d27('0x21')][_0x3d27('0x23')]||{},'attributes':['id',_0x3d27('0x36')]})[_0x3d27('0x12')](function(_0x2a8884){if(_0x2a8884){_0x5963c0=_0x2a8884;if(_0x443486[_0x3d27('0x39')][_0x3d27('0x3f')]&&!utils[_0x3d27('0x40')](_0x443486[_0x3d27('0x39')][_0x3d27('0x3f')])){throw new Error(_0x3d27('0x41'));}switch(_0x443486[_0x3d27('0x39')][_0x3d27('0x3f')]){case _0x3d27('0x42'):return db[_0x3d27('0x2d')][_0x3d27('0x2e')]({'paused':0x0},{'where':{'UserId':_0x5963c0['id']}})[_0x3d27('0x12')](function(){return db['MemberReport'][_0x3d27('0x28')]({'where':{'channel':_0x443486[_0x3d27('0x39')][_0x3d27('0x3f')],'membername':_0x5963c0[_0x3d27('0x36')],'type':_0x3d27('0x30'),'exitAt':null}});})[_0x3d27('0x12')](function(_0x4be888){if(_0x4be888){return _0x4be888[_0x3d27('0x2e')]({'exitAt':moment()['format'](_0x3d27('0x31')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x3d27('0x12')](function(){return _0x5963c0[_0x3d27('0x2e')]({'voicePause':![]});});case _0x3d27('0x43'):case _0x3d27('0x44'):case _0x3d27('0x45'):case _0x3d27('0x46'):case'openchannel':case _0x3d27('0x47'):return db['MemberReport'][_0x3d27('0x28')]({'where':{'channel':_0x443486[_0x3d27('0x39')][_0x3d27('0x3f')],'membername':_0x5963c0[_0x3d27('0x36')],'type':_0x3d27('0x30'),'exitAt':null}})[_0x3d27('0x12')](function(_0xf02f2f){return _0xf02f2f[_0x3d27('0x2e')]({'exitAt':moment()[_0x3d27('0x37')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});})[_0x3d27('0x12')](function(){var _0x5a34d6={};_[_0x3d27('0x48')](_0x5a34d6,util[_0x3d27('0x37')](_0x3d27('0x49'),_0x443486[_0x3d27('0x39')][_0x3d27('0x3f')],'Pause'),![]);return _0x5963c0[_0x3d27('0x2e')](_0x5a34d6);});default:return db[_0x3d27('0x2d')][_0x3d27('0x2e')]({'paused':0x0},{'where':{'UserId':_0x5963c0['id']}})['then'](function(){return db[_0x3d27('0x2f')][_0x3d27('0x20')]({'where':{'membername':_0x5963c0['name'],'type':_0x3d27('0x30'),'exitAt':null}});})[_0x3d27('0x12')](function(_0x2b8dc6){var _0x584a5d=[];_0x2b8dc6[_0x3d27('0x34')](function(_0xecb2fe){_0x584a5d[_0x3d27('0x35')](_0xecb2fe[_0x3d27('0x2e')]({'exitAt':moment()[_0x3d27('0x37')](_0x3d27('0x31')),'data2':'system'}));});return BPromise[_0x3d27('0x4a')](_0x584a5d);})[_0x3d27('0x12')](function(){return _0x5963c0[_0x3d27('0x2e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x3d27('0x12')](function(_0x5cb8cf){_0x1b55e9(_0x5cb8cf);})['catch'](function(_0x337702){_0x325320(_0xe09d09['error'](0x1f4,_0x337702[_0x3d27('0x1b')]));});});};exports[_0x3d27('0x4b')]=function(_0x41c439){var _0x139c28=this;return new Promise(function(_0xc76dae,_0x15a6dd){var _0x5af5cf;return db['User']['findOne']({'where':_0x41c439['options'][_0x3d27('0x23')]||{},'attributes':['id','name']})[_0x3d27('0x12')](function(_0x589e7d){if(_0x589e7d){_0x5af5cf=_0x589e7d;return db[_0x3d27('0x2d')][_0x3d27('0x4c')]({'where':{'membername':_0x5af5cf[_0x3d27('0x36')]},'individualHooks':!![]});}})['then'](function(){if(_0x5af5cf){return db['MemberReport']['findAll']({'where':{'membername':_0x5af5cf[_0x3d27('0x36')],'exitAt':null}});}})[_0x3d27('0x12')](function(_0x32b151){if(_0x5af5cf){if(_0x32b151&&_0x32b151[_0x3d27('0x4d')]){var _0x55636b=[];_0x32b151[_0x3d27('0x34')](function(_0x11c0ab){_0x55636b['push'](_0x11c0ab[_0x3d27('0x2e')]({'exitAt':moment()[_0x3d27('0x37')](_0x3d27('0x31'))}));});return BPromise[_0x3d27('0x4a')](_0x55636b);}}})[_0x3d27('0x12')](function(){if(_0x5af5cf){return _0x5af5cf[_0x3d27('0x2e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x3d27('0x12')](function(_0x263f0c){_0xc76dae(_0x263f0c);})[_0x3d27('0x1d')](function(_0x3ad2d8){_0x15a6dd(_0x139c28[_0x3d27('0x18')](0x1f4,_0x3ad2d8['message']));});});};exports[_0x3d27('0x4e')]=function(_0x220044){var _0x53a9ab=this;return new Promise(function(_0x573eab,_0x27b92c){var _0x301633;var _0x29a59f;var _0x4b9ad0;var _0x3478a9;return db[_0x3d27('0x1f')][_0x3d27('0x3e')]({'where':_0x220044[_0x3d27('0x21')]['where']||{},'attributes':['id',_0x3d27('0x36'),_0x3d27('0x2a'),_0x3d27('0x4f'),_0x3d27('0x50'),_0x3d27('0x2b'),_0x3d27('0x51'),_0x3d27('0x2c')]})[_0x3d27('0x12')](function(_0x9eefd6){if(_0x9eefd6){_0x301633=_0x9eefd6;_0x3478a9=_0x220044[_0x3d27('0x39')]['interface']?_0x220044['body'][_0x3d27('0x2c')]:util[_0x3d27('0x37')]('SIP/%s',_0x301633[_0x3d27('0x36')]);return db[_0x3d27('0x1f')][_0x3d27('0x52')]({'where':{'role':_0x3d27('0x53'),'online':!![],'id':{'$ne':_0x301633['id']}}});}})[_0x3d27('0x12')](function(_0x162556){if(_0x162556){_0x4b9ad0=_0x162556;return require(_0x3d27('0x54'))[_0x3d27('0x55')]();}})[_0x3d27('0x12')](function(_0x440fa9){if(_0x440fa9&&_0x440fa9[_0x3d27('0x56')]&&_0x4b9ad0>=_0x440fa9[_0x3d27('0x56')]){throw new Error(_0x3d27('0x57'));}})[_0x3d27('0x12')](function(){if(_0x301633){return db[_0x3d27('0x2d')]['destroy']({'where':{'membername':_0x301633[_0x3d27('0x36')]},'individualHooks':!![]});}})[_0x3d27('0x12')](function(){if(_0x301633){return _0x301633[_0x3d27('0x58')]({'raw':!![]});}})[_0x3d27('0x12')](function(_0x1eb35e){if(_0x301633){if(_0x1eb35e){var _0x2327ee=[];_0x29a59f=_0x1eb35e;if(_0x29a59f[_0x3d27('0x4d')]){for(var _0x373acd=0x0;_0x373acd<_0x29a59f[_0x3d27('0x4d')];_0x373acd++){_0x2327ee['push'](db[_0x3d27('0x2d')][_0x3d27('0x59')]({'membername':_0x301633[_0x3d27('0x36')],'UserId':_0x301633['id'],'queue_name':_0x29a59f[_0x373acd][_0x3d27('0x36')],'VoiceQueueId':_0x29a59f[_0x373acd]['id'],'interface':_0x3478a9,'paused':_0x301633[_0x3d27('0x51')]||![],'penalty':_0x29a59f[_0x373acd]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x3d27('0x4a')](_0x2327ee);}}}})['then'](function(){if(_0x301633){return db[_0x3d27('0x2f')][_0x3d27('0x20')]({'where':{'membername':_0x301633[_0x3d27('0x36')],'exitAt':null}});}})[_0x3d27('0x12')](function(_0x3d03d0){if(_0x301633){if(_0x3d03d0&&_0x3d03d0[_0x3d27('0x4d')]){var _0x80204c=[];_0x3d03d0[_0x3d27('0x34')](function(_0x16ba37){_0x80204c[_0x3d27('0x35')](_0x16ba37[_0x3d27('0x2e')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x3d27('0x4a')](_0x80204c);}}})[_0x3d27('0x12')](function(_0x262a5b){if(_0x301633){var _0x2e7e82=[];var _0x3b8b7a=[];var _0x4d1b0d=utils['getChannels']();var _0x34c1ff={'membername':_0x301633['name'],'interface':_0x3478a9,'enterAt':moment()[_0x3d27('0x37')](_0x3d27('0x31')),'role':_0x301633[_0x3d27('0x2a')],'internal':_0x301633[_0x3d27('0x2b')]};_0x4d1b0d['forEach'](function(_0x56c2f2){_0x2e7e82[_0x3d27('0x35')](_[_0x3d27('0x5a')]({'channel':_0x56c2f2,'type':'LOGIN','data1':_0x3d27('0x5b'),'data2':_0x3478a9},_0x34c1ff));if(_0x301633[_0x3d27('0x51')]){_0x3b8b7a[_0x3d27('0x35')](_[_0x3d27('0x5a')]({'channel':_0x56c2f2,'type':_0x3d27('0x30'),'data1':_0x3d27('0x5c')},_0x34c1ff));}});return db[_0x3d27('0x2f')]['bulkCreate'](_0x2e7e82['concat'](_0x3b8b7a),{'individualHooks':!![]});}})[_0x3d27('0x12')](function(){if(_0x301633){return _0x301633[_0x3d27('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x3d27('0x37')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x301633[_0x3d27('0x51')]||![],'mailPause':_0x301633['loginInPause']||![],'chatPause':_0x301633[_0x3d27('0x51')]||![],'faxPause':_0x301633[_0x3d27('0x51')]||![],'smsPause':_0x301633[_0x3d27('0x51')]||![],'openchannelPause':_0x301633['loginInPause']||![],'pauseType':_0x301633[_0x3d27('0x51')]?_0x3d27('0x5c'):null,'lastPauseAt':moment()['format'](_0x3d27('0x31')),'interface':_0x3478a9});}})[_0x3d27('0x12')](function(_0x3d0285){_0x573eab(_0x3d0285);})[_0x3d27('0x1d')](function(_0x5cac29){_0x27b92c(_0x53a9ab[_0x3d27('0x18')](0x1f4,_0x5cac29[_0x3d27('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 0ce9a58..873c8be 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 _0xf109=['remove','removeListener','length','user:','save'];(function(_0x2126f6,_0x3cad9d){var _0x278d8f=function(_0x8928d4){while(--_0x8928d4){_0x2126f6['push'](_0x2126f6['shift']());}};_0x278d8f(++_0x3cad9d);}(_0xf109,0x1b2));var _0x9f10=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xf109[_0x1b6186];return _0x186121;};'use strict';var UserEvents=require('./user.events');var events=[_0x9f10('0x0'),_0x9f10('0x1'),'update'];function createListener(_0x424b23,_0xbbcce1){return function(_0x2cddd2){_0xbbcce1['emit'](_0x424b23,_0x2cddd2);};}function removeListener(_0x1f098c,_0x4d7bc6){return function(){UserEvents[_0x9f10('0x2')](_0x1f098c,_0x4d7bc6);};}exports['register']=function(_0x5a182c){for(var _0x3826c4=0x0,_0x5d8cab=events[_0x9f10('0x3')];_0x3826c4<_0x5d8cab;_0x3826c4++){var _0x108abd=events[_0x3826c4];var _0x54d04e=createListener(_0x9f10('0x4')+_0x108abd,_0x5a182c);UserEvents['on'](_0x108abd,_0x54d04e);}}; \ No newline at end of file +var _0x35f9=['./user.events','save','remove','update','removeListener','register','length','user:'];(function(_0x560796,_0x374571){var _0x2c6691=function(_0x173866){while(--_0x173866){_0x560796['push'](_0x560796['shift']());}};_0x2c6691(++_0x374571);}(_0x35f9,0x80));var _0x935f=function(_0x55a6c8,_0xe04694){_0x55a6c8=_0x55a6c8-0x0;var _0x27f974=_0x35f9[_0x55a6c8];return _0x27f974;};'use strict';var UserEvents=require(_0x935f('0x0'));var events=[_0x935f('0x1'),_0x935f('0x2'),_0x935f('0x3')];function createListener(_0x224314,_0x392544){return function(_0x5ca464){_0x392544['emit'](_0x224314,_0x5ca464);};}function removeListener(_0x16f617,_0x21ffa3){return function(){UserEvents[_0x935f('0x4')](_0x16f617,_0x21ffa3);};}exports[_0x935f('0x5')]=function(_0x163354){for(var _0x2ab44a=0x0,_0x218cda=events[_0x935f('0x6')];_0x2ab44a<_0x218cda;_0x2ab44a++){var _0x47eb6c=events[_0x2ab44a];var _0xe8570a=createListener(_0x935f('0x7')+_0x47eb6c,_0x163354);UserEvents['on'](_0x47eb6c,_0xe8570a);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 0b7fb95..23d694b 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(_0x3eac9d,_0x8225b2){var _0x3d5935=function(_0x216c76){while(--_0x216c76){_0x3eac9d['push'](_0x3eac9d['shift']());}};_0x3d5935(++_0x8225b2);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5cfbd1,_0x2a5877){var _0x206ad5=function(_0x22ecd3){while(--_0x22ecd3){_0x5cfbd1['push'](_0x5cfbd1['shift']());}};_0x206ad5(++_0x2a5877);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 57f2144..6c15e10 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 _0x066b=['exports'];(function(_0x5e875d,_0x45d395){var _0x50d7de=function(_0x3b137f){while(--_0x3b137f){_0x5e875d['push'](_0x5e875d['shift']());}};_0x50d7de(++_0x45d395);}(_0x066b,0x15d));var _0xb066=function(_0x398310,_0x26fd34){_0x398310=_0x398310-0x0;var _0x384b56=_0x066b[_0x398310];return _0x384b56;};'use strict';var Sequelize=require('sequelize');module[_0xb066('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x09b1=['INTEGER','sequelize'];(function(_0x2df0be,_0x4c8264){var _0x1c6e1c=function(_0xe23f83){while(--_0xe23f83){_0x2df0be['push'](_0x2df0be['shift']());}};_0x1c6e1c(++_0x4c8264);}(_0x09b1,0x167));var _0x109b=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x09b1[_0x39c734];return _0xb2a2f9;};'use strict';var Sequelize=require(_0x109b('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x109b('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 66104fe..be79698 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 _0x9045=['path','rimraf','../../config/environment','exports','UserChatQueue','lodash','util','api','bluebird','request-promise'];(function(_0x571095,_0x29c295){var _0x1d3f91=function(_0x246d59){while(--_0x246d59){_0x571095['push'](_0x571095['shift']());}};_0x1d3f91(++_0x29c295);}(_0x9045,0xc3));var _0x5904=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x9045[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x5904('0x0'));var util=require(_0x5904('0x1'));var logger=require('../../config/logger')(_0x5904('0x2'));var moment=require('moment');var BPromise=require(_0x5904('0x3'));var rp=require(_0x5904('0x4'));var fs=require('fs');var path=require(_0x5904('0x5'));var rimraf=require(_0x5904('0x6'));var config=require(_0x5904('0x7'));var attributes=require('./userChatQueue.attributes');module[_0x5904('0x8')]=function(_0x50b01a,_0x5b2908){return _0x50b01a['define'](_0x5904('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62d1=['define','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userChatQueue.attributes','exports'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x62d1,0x1ca));var _0x162d=function(_0x416df5,_0x5cd9e7){_0x416df5=_0x416df5-0x0;var _0x53235b=_0x62d1[_0x416df5];return _0x53235b;};'use strict';var _=require('lodash');var util=require(_0x162d('0x0'));var logger=require(_0x162d('0x1'))(_0x162d('0x2'));var moment=require(_0x162d('0x3'));var BPromise=require(_0x162d('0x4'));var rp=require(_0x162d('0x5'));var fs=require('fs');var path=require(_0x162d('0x6'));var rimraf=require(_0x162d('0x7'));var config=require('../../config/environment');var attributes=require(_0x162d('0x8'));module[_0x162d('0x9')]=function(_0x2998de,_0xe6a8c9){return _0x2998de[_0x162d('0xa')](_0x162d('0xb'),attributes,{'tableName':_0x162d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 487c513..71506a1 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 _0x879f=['error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x818de4,_0x4fc862){var _0x3c4458=function(_0x388f06){while(--_0x388f06){_0x818de4['push'](_0x818de4['shift']());}};_0x3c4458(++_0x4fc862);}(_0x879f,0x1e8));var _0xf879=function(_0x4aabb4,_0x154e76){_0x4aabb4=_0x4aabb4-0x0;var _0x546286=_0x879f[_0x4aabb4];return _0x546286;};'use strict';var _=require('lodash');var util=require(_0xf879('0x0'));var moment=require(_0xf879('0x1'));var BPromise=require(_0xf879('0x2'));var rs=require(_0xf879('0x3'));var fs=require('fs');var Redis=require(_0xf879('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf879('0x5'))(_0xf879('0x6'));var config=require(_0xf879('0x7'));var jayson=require(_0xf879('0x8'));var client=jayson[_0xf879('0x9')][_0xf879('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55ae1b,_0x13f69d,_0x811359){return new BPromise(function(_0x46e0ce,_0x14d488){return client[_0xf879('0xb')](_0x55ae1b,_0x811359)[_0xf879('0xc')](function(_0x4c9cf9){logger[_0xf879('0xd')](_0xf879('0xe'),_0x13f69d,_0xf879('0xf'));logger[_0xf879('0x10')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x13f69d,_0xf879('0xf'),JSON[_0xf879('0x11')](_0x4c9cf9));if(_0x4c9cf9[_0xf879('0x12')]){if(_0x4c9cf9['error']['code']===0x1f4){logger['error'](_0xf879('0xe'),_0x13f69d,_0x4c9cf9[_0xf879('0x12')][_0xf879('0x13')]);return _0x14d488(_0x4c9cf9[_0xf879('0x12')]['message']);}logger[_0xf879('0x12')](_0xf879('0xe'),_0x13f69d,_0x4c9cf9[_0xf879('0x12')][_0xf879('0x13')]);return _0x46e0ce(_0x4c9cf9[_0xf879('0x12')][_0xf879('0x13')]);}else{logger[_0xf879('0xd')](_0xf879('0xe'),_0x13f69d,_0xf879('0xf'));_0x46e0ce(_0x4c9cf9[_0xf879('0x14')]['message']);}})[_0xf879('0x15')](function(_0x195252){logger['error'](_0xf879('0xe'),_0x13f69d,_0x195252);_0x14d488(_0x195252);});});} \ No newline at end of file +var _0x951f=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0xa6bad1,_0x17312a){var _0x2fbbe2=function(_0x4c42f6){while(--_0x4c42f6){_0xa6bad1['push'](_0xa6bad1['shift']());}};_0x2fbbe2(++_0x17312a);}(_0x951f,0x189));var _0xf951=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x951f[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xf951('0x0'));var util=require(_0xf951('0x1'));var moment=require(_0xf951('0x2'));var BPromise=require(_0xf951('0x3'));var rs=require(_0xf951('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf951('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf951('0x6'));var config=require(_0xf951('0x7'));var jayson=require(_0xf951('0x8'));var client=jayson[_0xf951('0x9')][_0xf951('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5795a6,_0x1f4631,_0x586b0f){return new BPromise(function(_0x416cd6,_0x1781c3){return client[_0xf951('0xb')](_0x5795a6,_0x586b0f)[_0xf951('0xc')](function(_0x595fb1){logger[_0xf951('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x1f4631,_0xf951('0xe'));logger[_0xf951('0xf')](_0xf951('0x10'),_0x1f4631,'request\x20sent',JSON[_0xf951('0x11')](_0x595fb1));if(_0x595fb1[_0xf951('0x12')]){if(_0x595fb1[_0xf951('0x12')][_0xf951('0x13')]===0x1f4){logger[_0xf951('0x12')](_0xf951('0x14'),_0x1f4631,_0x595fb1['error'][_0xf951('0x15')]);return _0x1781c3(_0x595fb1['error'][_0xf951('0x15')]);}logger[_0xf951('0x12')](_0xf951('0x14'),_0x1f4631,_0x595fb1['error'][_0xf951('0x15')]);return _0x416cd6(_0x595fb1[_0xf951('0x12')][_0xf951('0x15')]);}else{logger[_0xf951('0xd')](_0xf951('0x14'),_0x1f4631,'request\x20sent');_0x416cd6(_0x595fb1[_0xf951('0x16')][_0xf951('0x15')]);}})[_0xf951('0x17')](function(_0x1e2235){logger['error'](_0xf951('0x14'),_0x1f4631,_0x1e2235);_0x1781c3(_0x1e2235);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index feb0f61..54fbcd1 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4b7675,_0x37045f){var _0x4ac15a=function(_0x24d48f){while(--_0x24d48f){_0x4b7675['push'](_0x4b7675['shift']());}};_0x4ac15a(++_0x37045f);}(_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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1d8965,_0x2aec0d){var _0x38edbf=function(_0x55850c){while(--_0x55850c){_0x1d8965['push'](_0x1d8965['shift']());}};_0x38edbf(++_0x2aec0d);}(_0xedd9,0xfc));var _0x9edd=function(_0x47d1ae,_0x41e056){_0x47d1ae=_0x47d1ae-0x0;var _0x47328a=_0xedd9[_0x47d1ae];return _0x47328a;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index ff8d96e..dce1823 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 _0xbbd4=['INTEGER','STRING','sequelize','exports'];(function(_0x5e480b,_0x4a00c3){var _0x4f183a=function(_0x104c26){while(--_0x104c26){_0x5e480b['push'](_0x5e480b['shift']());}};_0x4f183a(++_0x4a00c3);}(_0xbbd4,0x1c6));var _0x4bbd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbbd4[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x4bbd('0x0'));module[_0x4bbd('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4bbd('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x4bbd('0x3')]}}; \ No newline at end of file +var _0x54c9=['STRING','sequelize','exports','INTEGER'];(function(_0x4ad32f,_0x3bc396){var _0x2440ec=function(_0x460bad){while(--_0x460bad){_0x4ad32f['push'](_0x4ad32f['shift']());}};_0x2440ec(++_0x3bc396);}(_0x54c9,0x8d));var _0x954c=function(_0x17faf1,_0x40f1b3){_0x17faf1=_0x17faf1-0x0;var _0x2e40ef=_0x54c9[_0x17faf1];return _0x2e40ef;};'use strict';var Sequelize=require(_0x954c('0x0'));module[_0x954c('0x1')]={'penalty':{'type':Sequelize[_0x954c('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x954c('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x954c('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index a26b9b2..1bc3921 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 _0x1571=['./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x5b1904,_0x573a15){var _0x3eb6b4=function(_0x2d0fcc){while(--_0x2d0fcc){_0x5b1904['push'](_0x5b1904['shift']());}};_0x3eb6b4(++_0x573a15);}(_0x1571,0xad));var _0x1157=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0x1571[_0xf04c6d];return _0x4a804e;};'use strict';var _=require(_0x1157('0x0'));var util=require(_0x1157('0x1'));var logger=require(_0x1157('0x2'))(_0x1157('0x3'));var moment=require(_0x1157('0x4'));var BPromise=require(_0x1157('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1157('0x6'));var config=require('../../config/environment');var attributes=require(_0x1157('0x7'));module[_0x1157('0x8')]=function(_0x5603dc,_0x2b98a3){return _0x5603dc[_0x1157('0x9')](_0x1157('0xa'),attributes,{'tableName':_0x1157('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x897f=['./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x1a92c4,_0x45328a){var _0x368692=function(_0x4d53ef){while(--_0x4d53ef){_0x1a92c4['push'](_0x1a92c4['shift']());}};_0x368692(++_0x45328a);}(_0x897f,0xf7));var _0xf897=function(_0x1e79b9,_0x223ef3){_0x1e79b9=_0x1e79b9-0x0;var _0x2c2d29=_0x897f[_0x1e79b9];return _0x2c2d29;};'use strict';var _=require('lodash');var util=require(_0xf897('0x0'));var logger=require(_0xf897('0x1'))('api');var moment=require(_0xf897('0x2'));var BPromise=require(_0xf897('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf897('0x4'));var rimraf=require('rimraf');var config=require(_0xf897('0x5'));var attributes=require(_0xf897('0x6'));module[_0xf897('0x7')]=function(_0x16d2ed,_0x1fb04e){return _0x16d2ed[_0xf897('0x8')](_0xf897('0x9'),attributes,{'tableName':_0xf897('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 09af0e2..4dad1f0 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 _0x3a39=['bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util'];(function(_0x503e25,_0xd69403){var _0x4d1855=function(_0x5b0f10){while(--_0x5b0f10){_0x503e25['push'](_0x503e25['shift']());}};_0x4d1855(++_0xd69403);}(_0x3a39,0x10f));var _0x93a3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x3a39[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x93a3('0x0'));var util=require(_0x93a3('0x1'));var moment=require('moment');var BPromise=require(_0x93a3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93a3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x93a3('0x4'));var logger=require(_0x93a3('0x5'))('rpc');var config=require(_0x93a3('0x6'));var jayson=require(_0x93a3('0x7'));var client=jayson[_0x93a3('0x8')][_0x93a3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a4d09,_0x4537a9,_0x41d52e){return new BPromise(function(_0x4c3932,_0x4a620b){return client[_0x93a3('0xa')](_0x4a4d09,_0x41d52e)[_0x93a3('0xb')](function(_0x5b4566){logger['info'](_0x93a3('0xc'),_0x4537a9,_0x93a3('0xd'));logger[_0x93a3('0xe')](_0x93a3('0xf'),_0x4537a9,_0x93a3('0xd'),JSON[_0x93a3('0x10')](_0x5b4566));if(_0x5b4566['error']){if(_0x5b4566[_0x93a3('0x11')]['code']===0x1f4){logger[_0x93a3('0x11')](_0x93a3('0xc'),_0x4537a9,_0x5b4566[_0x93a3('0x11')][_0x93a3('0x12')]);return _0x4a620b(_0x5b4566[_0x93a3('0x11')][_0x93a3('0x12')]);}logger[_0x93a3('0x11')](_0x93a3('0xc'),_0x4537a9,_0x5b4566['error'][_0x93a3('0x12')]);return _0x4c3932(_0x5b4566[_0x93a3('0x11')][_0x93a3('0x12')]);}else{logger[_0x93a3('0x13')](_0x93a3('0xc'),_0x4537a9,_0x93a3('0xd'));_0x4c3932(_0x5b4566['result']['message']);}})[_0x93a3('0x14')](function(_0x357906){logger['error'](_0x93a3('0xc'),_0x4537a9,_0x357906);_0x4a620b(_0x357906);});});} \ No newline at end of file +var _0x7182=['result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4a29a9,_0x58cd04){var _0x386570=function(_0x1d2d09){while(--_0x1d2d09){_0x4a29a9['push'](_0x4a29a9['shift']());}};_0x386570(++_0x58cd04);}(_0x7182,0x12c));var _0x2718=function(_0x4714a0,_0x5ba5a7){_0x4714a0=_0x4714a0-0x0;var _0x48a983=_0x7182[_0x4714a0];return _0x48a983;};'use strict';var _=require('lodash');var util=require(_0x2718('0x0'));var moment=require(_0x2718('0x1'));var BPromise=require(_0x2718('0x2'));var rs=require(_0x2718('0x3'));var fs=require('fs');var Redis=require(_0x2718('0x4'));var db=require(_0x2718('0x5'))['db'];var utils=require(_0x2718('0x6'));var logger=require(_0x2718('0x7'))(_0x2718('0x8'));var config=require(_0x2718('0x9'));var jayson=require(_0x2718('0xa'));var client=jayson[_0x2718('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55d357,_0x43ce15,_0x282ae0){return new BPromise(function(_0x41716b,_0x46d47c){return client['request'](_0x55d357,_0x282ae0)[_0x2718('0xc')](function(_0x20f244){logger[_0x2718('0xd')](_0x2718('0xe'),_0x43ce15,_0x2718('0xf'));logger[_0x2718('0x10')](_0x2718('0x11'),_0x43ce15,_0x2718('0xf'),JSON[_0x2718('0x12')](_0x20f244));if(_0x20f244[_0x2718('0x13')]){if(_0x20f244[_0x2718('0x13')][_0x2718('0x14')]===0x1f4){logger[_0x2718('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x43ce15,_0x20f244['error'][_0x2718('0x15')]);return _0x46d47c(_0x20f244[_0x2718('0x13')][_0x2718('0x15')]);}logger['error'](_0x2718('0xe'),_0x43ce15,_0x20f244['error']['message']);return _0x41716b(_0x20f244[_0x2718('0x13')][_0x2718('0x15')]);}else{logger['info'](_0x2718('0xe'),_0x43ce15,_0x2718('0xf'));_0x41716b(_0x20f244[_0x2718('0x16')][_0x2718('0x15')]);}})['catch'](function(_0x41904b){logger[_0x2718('0x13')](_0x2718('0xe'),_0x43ce15,_0x41904b);_0x46d47c(_0x41904b);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 02fc600..51d3efa 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x85968f,_0x51e25e){var _0x4db032=function(_0x271a18){while(--_0x271a18){_0x85968f['push'](_0x85968f['shift']());}};_0x4db032(++_0x51e25e);}(_0x70e0,0x17b));var _0x070e=function(_0x4cd209,_0xabb48){_0x4cd209=_0x4cd209-0x0;var _0x3cc17b=_0x70e0[_0x4cd209];return _0x3cc17b;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x11b04b,_0x411c23){var _0x2bca59=function(_0x3eeed0){while(--_0x3eeed0){_0x11b04b['push'](_0x11b04b['shift']());}};_0x2bca59(++_0x411c23);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 77d3009..6eae10d 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 _0x691a=['exports','INTEGER','sequelize'];(function(_0x28d3b6,_0x1f7816){var _0x4f9fa4=function(_0x5ccdca){while(--_0x5ccdca){_0x28d3b6['push'](_0x28d3b6['shift']());}};_0x4f9fa4(++_0x1f7816);}(_0x691a,0x1df));var _0xa691=function(_0x2da097,_0x4af850){_0x2da097=_0x2da097-0x0;var _0x35888c=_0x691a[_0x2da097];return _0x35888c;};'use strict';var Sequelize=require(_0xa691('0x0'));module[_0xa691('0x1')]={'penalty':{'type':Sequelize[_0xa691('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb719=['exports','INTEGER','sequelize'];(function(_0x16971d,_0x180a2c){var _0x38150a=function(_0x1548b2){while(--_0x1548b2){_0x16971d['push'](_0x16971d['shift']());}};_0x38150a(++_0x180a2c);}(_0xb719,0x1f4));var _0x9b71=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0xb719[_0x291d3f];return _0x242080;};'use strict';var Sequelize=require(_0x9b71('0x0'));module[_0x9b71('0x1')]={'penalty':{'type':Sequelize[_0x9b71('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 b5dd946..1e7b743 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 _0xc404=['define','UserMailQueue','user_has_mail_queues','lodash','util','api','bluebird','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0xc90779,_0x5444ff){var _0x290d6a=function(_0x48d095){while(--_0x48d095){_0xc90779['push'](_0xc90779['shift']());}};_0x290d6a(++_0x5444ff);}(_0xc404,0xff));var _0x4c40=function(_0x5e26bd,_0x3c3e4d){_0x5e26bd=_0x5e26bd-0x0;var _0x3f951d=_0xc404[_0x5e26bd];return _0x3f951d;};'use strict';var _=require(_0x4c40('0x0'));var util=require(_0x4c40('0x1'));var logger=require('../../config/logger')(_0x4c40('0x2'));var moment=require('moment');var BPromise=require(_0x4c40('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c40('0x4'));var rimraf=require(_0x4c40('0x5'));var config=require(_0x4c40('0x6'));var attributes=require(_0x4c40('0x7'));module[_0x4c40('0x8')]=function(_0x54a463,_0x59bcca){return _0x54a463[_0x4c40('0x9')](_0x4c40('0xa'),attributes,{'tableName':_0x4c40('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74eb=['moment','request-promise','path','rimraf','../../config/environment','exports','define','UserMailQueue','user_has_mail_queues','util','../../config/logger'];(function(_0x2e6dbf,_0x57dd06){var _0x2680e5=function(_0x4018f4){while(--_0x4018f4){_0x2e6dbf['push'](_0x2e6dbf['shift']());}};_0x2680e5(++_0x57dd06);}(_0x74eb,0x174));var _0xb74e=function(_0x3979b4,_0x1d98a9){_0x3979b4=_0x3979b4-0x0;var _0x4fdf9f=_0x74eb[_0x3979b4];return _0x4fdf9f;};'use strict';var _=require('lodash');var util=require(_0xb74e('0x0'));var logger=require(_0xb74e('0x1'))('api');var moment=require(_0xb74e('0x2'));var BPromise=require('bluebird');var rp=require(_0xb74e('0x3'));var fs=require('fs');var path=require(_0xb74e('0x4'));var rimraf=require(_0xb74e('0x5'));var config=require(_0xb74e('0x6'));var attributes=require('./userMailQueue.attributes');module[_0xb74e('0x7')]=function(_0x12fd6f,_0x320cf6){return _0x12fd6f[_0xb74e('0x8')](_0xb74e('0x9'),attributes,{'tableName':_0xb74e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index ba5ecea..a1aa9f9 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 _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x00bb[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1cb9,0x14e));var _0x91cb=function(_0x40e935,_0x5e1a0d){_0x40e935=_0x40e935-0x0;var _0x1e4ed2=_0x1cb9[_0x40e935];return _0x1e4ed2;};'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')]('UserMailQueue,\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);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 9c000f9..f87fc02 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 _0xbd00=['sendUserNotification','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','post'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbd00,0x122));var _0x0bd0=function(_0x269fba,_0xa68777){_0x269fba=_0x269fba-0x0;var _0x1eeb74=_0xbd00[_0x269fba];return _0x1eeb74;};'use strict';var multer=require(_0x0bd0('0x0'));var util=require(_0x0bd0('0x1'));var path=require(_0x0bd0('0x2'));var timeout=require(_0x0bd0('0x3'));var express=require(_0x0bd0('0x4'));var router=express['Router']();var fs_extra=require(_0x0bd0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0bd0('0x6'));var config=require(_0x0bd0('0x7'));var controller=require(_0x0bd0('0x8'));router[_0x0bd0('0x9')]('/',auth['isAuthenticated'](),controller[_0x0bd0('0xa')]);module[_0x0bd0('0xb')]=router; \ No newline at end of file +var _0xa026=['../../components/auth/service','post','sendUserNotification','exports','multer','util','path','express','Router','fs-extra'];(function(_0x2b7b9d,_0x89a529){var _0x57e721=function(_0x3ee189){while(--_0x3ee189){_0x2b7b9d['push'](_0x2b7b9d['shift']());}};_0x57e721(++_0x89a529);}(_0xa026,0xb8));var _0x6a02=function(_0x25ffd4,_0x16b31d){_0x25ffd4=_0x25ffd4-0x0;var _0x414452=_0xa026[_0x25ffd4];return _0x414452;};'use strict';var multer=require(_0x6a02('0x0'));var util=require(_0x6a02('0x1'));var path=require(_0x6a02('0x2'));var timeout=require('connect-timeout');var express=require(_0x6a02('0x3'));var router=express[_0x6a02('0x4')]();var fs_extra=require(_0x6a02('0x5'));var auth=require(_0x6a02('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userNotification.controller');router[_0x6a02('0x7')]('/',auth['isAuthenticated'](),controller[_0x6a02('0x8')]);module[_0x6a02('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index dd17cf6..56a2ab1 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 _0xdecc=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0xdc8f8d,_0x37540b){var _0x4a85ce=function(_0x2cb323){while(--_0x2cb323){_0xdc8f8d['push'](_0xdc8f8d['shift']());}};_0x4a85ce(++_0x37540b);}(_0xdecc,0x1b3));var _0xcdec=function(_0x552fce,_0x3f24bc){_0x552fce=_0x552fce-0x0;var _0x3e27a2=_0xdecc[_0x552fce];return _0x3e27a2;};'use strict';var Sequelize=require(_0xcdec('0x0'));module['exports']={'body':{'type':Sequelize[_0xcdec('0x1')]},'senderName':{'type':Sequelize[_0xcdec('0x2')]},'recipientsId':{'type':Sequelize[_0xcdec('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xcdec('0x3')]}}; \ No newline at end of file +var _0x89b4=['BOOLEAN','exports','TEXT','STRING'];(function(_0x2793b1,_0x46ad54){var _0xfe5d1=function(_0x111ec3){while(--_0x111ec3){_0x2793b1['push'](_0x2793b1['shift']());}};_0xfe5d1(++_0x46ad54);}(_0x89b4,0x181));var _0x489b=function(_0x47d62e,_0x5a6418){_0x47d62e=_0x47d62e-0x0;var _0x2160a9=_0x89b4[_0x47d62e];return _0x2160a9;};'use strict';var Sequelize=require('sequelize');module[_0x489b('0x0')]={'body':{'type':Sequelize[_0x489b('0x1')]},'senderName':{'type':Sequelize[_0x489b('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x489b('0x2')]},'beep':{'type':Sequelize[_0x489b('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index a9cd2e2..4dd3a81 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 _0x627e=['parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','sortBy','join','sequelize','create','forEach','emit','userNotification:send','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','catch','startCase','User','union','ids','queue','replace','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','status','end','offset','limit','undefined','count','set','json','apply','save','update','destroy','then','sendStatus','error','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x627e,0x166));var _0xe627=function(_0x6cd4,_0x2816ea){_0x6cd4=_0x6cd4-0x0;var _0x5d44ff=_0x627e[_0x6cd4];return _0x5d44ff;};'use strict';var emlformat=require(_0xe627('0x0'));var rimraf=require(_0xe627('0x1'));var zipdir=require(_0xe627('0x2'));var jsonpatch=require(_0xe627('0x3'));var rp=require(_0xe627('0x4'));var moment=require(_0xe627('0x5'));var BPromise=require(_0xe627('0x6'));var Mustache=require(_0xe627('0x7'));var util=require(_0xe627('0x8'));var path=require(_0xe627('0x9'));var sox=require(_0xe627('0xa'));var csv=require(_0xe627('0xb'));var ejs=require(_0xe627('0xc'));var fs=require('fs');var fs_extra=require(_0xe627('0xd'));var _=require(_0xe627('0xe'));var squel=require('squel');var crypto=require(_0xe627('0xf'));var jsforce=require(_0xe627('0x10'));var deskjs=require(_0xe627('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe627('0x12'));var Papa=require(_0xe627('0x13'));var Redis=require(_0xe627('0x14'));var authService=require(_0xe627('0x15'));var qs=require(_0xe627('0x16'));var as=require(_0xe627('0x17'));var hardwareService=require(_0xe627('0x18'));var logger=require(_0xe627('0x19'))(_0xe627('0x1a'));var utils=require('../../config/utils');var config=require(_0xe627('0x1b'));var licenseUtil=require(_0xe627('0x1c'));var db=require('../../mysqldb')['db'];config[_0xe627('0x1d')]=_[_0xe627('0x1e')](config['redis'],{'host':_0xe627('0x1f'),'port':0x18eb});var socket=require(_0xe627('0x20'))(new Redis(config[_0xe627('0x1d')]));require(_0xe627('0x21'))['register'](socket);function respondWithStatusCode(_0x53377b,_0x4b7bd1){_0x4b7bd1=_0x4b7bd1||0xcc;return function(_0xf8c3f0){if(_0xf8c3f0){return _0x53377b['sendStatus'](_0x4b7bd1);}return _0x53377b[_0xe627('0x22')](_0x4b7bd1)[_0xe627('0x23')]();};}function respondWithResult(_0x59421f,_0x3e7504){_0x3e7504=_0x3e7504||0xc8;return function(_0x48a7a6){if(_0x48a7a6){return _0x59421f[_0xe627('0x22')](_0x3e7504)['json'](_0x48a7a6);}};}function respondWithFilteredResult(_0x1ec3c7,_0x50faf4){return function(_0x5543cd){if(_0x5543cd){var _0x111244=typeof _0x50faf4[_0xe627('0x24')]==='undefined'&&typeof _0x50faf4[_0xe627('0x25')]===_0xe627('0x26');var _0x4cdd95=_0x5543cd[_0xe627('0x27')];var _0x52f017=_0x111244?0x0:_0x50faf4[_0xe627('0x24')];var _0x384883=_0x111244?_0x5543cd['count']:_0x50faf4[_0xe627('0x24')]+_0x50faf4['limit'];var _0x4f6368;if(_0x384883>=_0x4cdd95){_0x384883=_0x4cdd95;_0x4f6368=0xc8;}else{_0x4f6368=0xce;}_0x1ec3c7['status'](_0x4f6368);return _0x1ec3c7[_0xe627('0x28')]('Content-Range',_0x52f017+'-'+_0x384883+'/'+_0x4cdd95)[_0xe627('0x29')](_0x5543cd);}return null;};}function patchUpdates(_0x2cf374){return function(_0x41ccf1){try{jsonpatch[_0xe627('0x2a')](_0x41ccf1,_0x2cf374,!![]);}catch(_0x2e25ca){return BPromise['reject'](_0x2e25ca);}return _0x41ccf1[_0xe627('0x2b')]();};}function saveUpdates(_0x210f55,_0x1a531f){return function(_0xb8ede5){if(_0xb8ede5){return _0xb8ede5[_0xe627('0x2c')](_0x210f55)['then'](function(_0x2f1f6e){return _0x2f1f6e;});}return null;};}function removeEntity(_0x49c277,_0x280623){return function(_0x1582bb){if(_0x1582bb){return _0x1582bb[_0xe627('0x2d')]()[_0xe627('0x2e')](function(){_0x49c277[_0xe627('0x22')](0xcc)[_0xe627('0x23')]();});}};}function handleEntityNotFound(_0x5e2057,_0x4a00e8){return function(_0x12dd8d){if(!_0x12dd8d){_0x5e2057[_0xe627('0x2f')](0x194);}return _0x12dd8d;};}function handleError(_0xf0b54,_0x5107f8){_0x5107f8=_0x5107f8||0x1f4;return function(_0x2c70aa){logger[_0xe627('0x30')](_0x2c70aa['stack']);if(_0x2c70aa[_0xe627('0x31')]){delete _0x2c70aa[_0xe627('0x31')];}_0xf0b54[_0xe627('0x22')](_0x5107f8)['send'](_0x2c70aa);};}exports[_0xe627('0x32')]=function(_0x534109,_0x477b5c,_0x50cb85){if(!_0x534109[_0xe627('0x33')][_0xe627('0x34')](_0xe627('0x35'))&&!_0x534109[_0xe627('0x33')]['hasOwnProperty'](_0xe627('0x36'))){throw new db[(_0xe627('0x37'))][(_0xe627('0x38'))](_0xe627('0x39'));}else{if(_0x534109[_0xe627('0x33')][_0xe627('0x34')](_0xe627('0x36'))&&!_0x534109[_0xe627('0x33')][_0xe627('0x34')](_0xe627('0x3a'))){throw new db[(_0xe627('0x37'))][(_0xe627('0x38'))](_0xe627('0x3b'));}if(!_0x534109[_0xe627('0x33')][_0xe627('0x34')](_0xe627('0x3c'))){throw new db[(_0xe627('0x37'))]['ValidationError'](_0xe627('0x3d'));}else{try{var _0xcd8693=JSON[_0xe627('0x3e')](_0x534109[_0xe627('0x33')][_0xe627('0x3c')]);}catch(_0x5ddda7){logger[_0xe627('0x30')](_0x5ddda7);throw new db['Sequelize'][(_0xe627('0x38'))](_0xe627('0x3f'));}var _0x408df7=[_0xe627('0x40'),_0xe627('0x41'),_0xe627('0x42'),_0xe627('0x43'),_0xe627('0x44'),_0xe627('0x45'),_0xe627('0x46'),'team','user'];if(_[_0xe627('0x47')](_0xcd8693,function(_0x56b39c){return!_[_0xe627('0x48')](_0x408df7,_0x56b39c[_0xe627('0x49')][_0xe627('0x4a')]());})){throw new db[(_0xe627('0x37'))][(_0xe627('0x38'))](_0xe627('0x4b'));}}}var _0x3546b3={};_0x3546b3[_0xe627('0x4c')]=_0x534109[_0xe627('0x33')][_0xe627('0x34')](_0xe627('0x4c'))?_0x534109['body'][_0xe627('0x4c')]:_0x534109['user'][_0xe627('0x4d')];_0x3546b3[_0xe627('0x4e')]=_['isEmpty'](_0x534109[_0xe627('0x33')][_0xe627('0x4e')])?null:_0x534109['body']['recipientsDescription'];_0x3546b3[_0xe627('0x4f')]=_0x534109['body'][_0xe627('0x4f')]||![];_0x3546b3[_0xe627('0x50')]=_0x534109['user']['id'];return getContent(_0x534109['body'])[_0xe627('0x2e')](function(_0x20f607){_0x3546b3[_0xe627('0x33')]=_0x20f607;return getRecipients(_0xcd8693);})[_0xe627('0x2e')](function(_0x3fdd2f){_0x3546b3['recipientsId']=_[_0xe627('0x51')](_0x3fdd2f)[_0xe627('0x52')](',');return db[_0xe627('0x53')]['transaction'](function(_0x5c5a2b){return db['UserNotification'][_0xe627('0x54')](_0x3546b3,{'raw':!![],'transaction':_0x5c5a2b})[_0xe627('0x2e')](function(_0x5b18b1){var _0x335ee6={'sender':_0x3546b3[_0xe627('0x4c')],'description':_0x3546b3[_0xe627('0x4e')],'content':_0x3546b3[_0xe627('0x33')],'beep':_0x3546b3['beep']};_0x3fdd2f[_0xe627('0x55')](function(_0x42694b){_0x335ee6['recipient']=_0x42694b;socket[_0xe627('0x56')](_0xe627('0x57'),_0x335ee6);});return _0x5b18b1;});});})[_0xe627('0x2e')](respondWithResult(_0x477b5c,0xc9))['catch'](handleError(_0x477b5c,null));};function getContent(_0x40f253){return new BPromise(function(_0x535f36,_0x5e872f){if(_0x40f253['text']){_0x535f36(_0x40f253[_0xe627('0x35')]);return;}return db[_0xe627('0x58')][_0xe627('0x59')]({'attributes':['html'],'where':{'id':_0x40f253[_0xe627('0x36')]},'raw':!![]})['then'](function(_0x2e982c){if(!_0x2e982c)throw new db['Sequelize'][(_0xe627('0x38'))](_0xe627('0x5a'));var _0x1dda16=Mustache[_0xe627('0x5b')](_0x2e982c[_0xe627('0x5c')],_0x40f253[_0xe627('0x3a')]);_0x535f36(_0x1dda16);})[_0xe627('0x5d')](function(_0x4ac009){_0x5e872f(_0x4ac009);});});}function getRecipients(_0x439a69){return new BPromise(function(_0x4391dc,_0x15b5d1){var _0x155e2d=[];var _0x4ea829=[];_0x439a69[_0xe627('0x55')](function(_0x1aa8e8){var _0x337b9e=_[_0xe627('0x5e')](_0x1aa8e8[_0xe627('0x49')]['toLowerCase']());if(_0x337b9e===_0xe627('0x5f')){_0x155e2d=_[_0xe627('0x60')](_0x155e2d,_0x1aa8e8[_0xe627('0x61')]);}else{if(_[_0xe627('0x48')](_0x337b9e,_0xe627('0x62')))_0x337b9e=_0x337b9e[_0xe627('0x63')](_0xe627('0x62'),'Queue');_0x1aa8e8[_0xe627('0x61')][_0xe627('0x55')](function(_0x8d7671){_0x4ea829[_0xe627('0x64')](getAgents(_0x337b9e,_0x8d7671));});}});return BPromise[_0xe627('0x65')](_0x4ea829)['then'](function(_0x1b819c){_0x155e2d=_['union'](_0x155e2d,_[_0xe627('0x66')](_0x1b819c));_0x4391dc(_0x155e2d);})['catch'](function(_0x1f8fcf){_0x15b5d1(_0x1f8fcf);});});}function getAgents(_0x5979fc,_0x3eb326){return new BPromise(function(_0xf57aa,_0x141e3a){return db[_0x5979fc]['findOne']({'where':{'id':_0x3eb326}})[_0xe627('0x2e')](function(_0x32e7f9){return _0x32e7f9[_0xe627('0x67')]({'attributes':['id'],'raw':!![]})[_0xe627('0x2e')](function(_0x3b2226){var _0xecef6f=_[_0xe627('0x68')](_0x3b2226,'id');_0xf57aa(_0xecef6f);});})['catch'](function(_0x3c7a74){_0x141e3a(_0x3c7a74);});});} \ No newline at end of file +var _0x2120=['apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','transaction','create','forEach','emit','userNotification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','union','ids','queue','replace','Queue','push','all','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','end','status','offset','limit','undefined','count','set','Content-Range','json'];(function(_0x56d896,_0x3b4c9c){var _0x293639=function(_0x126c14){while(--_0x126c14){_0x56d896['push'](_0x56d896['shift']());}};_0x293639(++_0x3b4c9c);}(_0x2120,0xa6));var _0x0212=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x2120[_0x4b174a];return _0x3cd7bf;};'use strict';var emlformat=require(_0x0212('0x0'));var rimraf=require(_0x0212('0x1'));var zipdir=require(_0x0212('0x2'));var jsonpatch=require(_0x0212('0x3'));var rp=require(_0x0212('0x4'));var moment=require(_0x0212('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0212('0x6'));var util=require(_0x0212('0x7'));var path=require(_0x0212('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0212('0x9'));var fs=require('fs');var fs_extra=require(_0x0212('0xa'));var _=require(_0x0212('0xb'));var squel=require('squel');var crypto=require(_0x0212('0xc'));var jsforce=require(_0x0212('0xd'));var deskjs=require(_0x0212('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0212('0xf'));var Redis=require(_0x0212('0x10'));var authService=require(_0x0212('0x11'));var qs=require(_0x0212('0x12'));var as=require(_0x0212('0x13'));var hardwareService=require(_0x0212('0x14'));var logger=require(_0x0212('0x15'))(_0x0212('0x16'));var utils=require('../../config/utils');var config=require(_0x0212('0x17'));var licenseUtil=require(_0x0212('0x18'));var db=require(_0x0212('0x19'))['db'];config[_0x0212('0x1a')]=_[_0x0212('0x1b')](config[_0x0212('0x1a')],{'host':_0x0212('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0212('0x1d'))[_0x0212('0x1e')](socket);function respondWithStatusCode(_0x242d9d,_0x7dc767){_0x7dc767=_0x7dc767||0xcc;return function(_0x51b5e6){if(_0x51b5e6){return _0x242d9d['sendStatus'](_0x7dc767);}return _0x242d9d['status'](_0x7dc767)[_0x0212('0x1f')]();};}function respondWithResult(_0x48003c,_0x1aac78){_0x1aac78=_0x1aac78||0xc8;return function(_0x280271){if(_0x280271){return _0x48003c[_0x0212('0x20')](_0x1aac78)['json'](_0x280271);}};}function respondWithFilteredResult(_0x19223c,_0x4a6c58){return function(_0x336028){if(_0x336028){var _0xa844b7=typeof _0x4a6c58[_0x0212('0x21')]==='undefined'&&typeof _0x4a6c58[_0x0212('0x22')]===_0x0212('0x23');var _0x45c8a6=_0x336028[_0x0212('0x24')];var _0x2c83ad=_0xa844b7?0x0:_0x4a6c58[_0x0212('0x21')];var _0x42ca8c=_0xa844b7?_0x336028['count']:_0x4a6c58[_0x0212('0x21')]+_0x4a6c58[_0x0212('0x22')];var _0x7cbeac;if(_0x42ca8c>=_0x45c8a6){_0x42ca8c=_0x45c8a6;_0x7cbeac=0xc8;}else{_0x7cbeac=0xce;}_0x19223c[_0x0212('0x20')](_0x7cbeac);return _0x19223c[_0x0212('0x25')](_0x0212('0x26'),_0x2c83ad+'-'+_0x42ca8c+'/'+_0x45c8a6)[_0x0212('0x27')](_0x336028);}return null;};}function patchUpdates(_0x1faaa0){return function(_0x316862){try{jsonpatch[_0x0212('0x28')](_0x316862,_0x1faaa0,!![]);}catch(_0x23af2a){return BPromise[_0x0212('0x29')](_0x23af2a);}return _0x316862[_0x0212('0x2a')]();};}function saveUpdates(_0x53c909,_0x12c378){return function(_0xa56ed0){if(_0xa56ed0){return _0xa56ed0[_0x0212('0x2b')](_0x53c909)[_0x0212('0x2c')](function(_0x5db4dd){return _0x5db4dd;});}return null;};}function removeEntity(_0x5a924b,_0x2323ce){return function(_0x38d601){if(_0x38d601){return _0x38d601[_0x0212('0x2d')]()[_0x0212('0x2c')](function(){_0x5a924b[_0x0212('0x20')](0xcc)[_0x0212('0x1f')]();});}};}function handleEntityNotFound(_0x25d72d,_0x49aa34){return function(_0x1c01ab){if(!_0x1c01ab){_0x25d72d['sendStatus'](0x194);}return _0x1c01ab;};}function handleError(_0x5cb89d,_0x38fd5f){_0x38fd5f=_0x38fd5f||0x1f4;return function(_0x4a2f54){logger[_0x0212('0x2e')](_0x4a2f54[_0x0212('0x2f')]);if(_0x4a2f54[_0x0212('0x30')]){delete _0x4a2f54[_0x0212('0x30')];}_0x5cb89d[_0x0212('0x20')](_0x38fd5f)[_0x0212('0x31')](_0x4a2f54);};}exports[_0x0212('0x32')]=function(_0x35b4de,_0x2cbe1d,_0x4652b3){if(!_0x35b4de[_0x0212('0x33')]['hasOwnProperty']('text')&&!_0x35b4de[_0x0212('0x33')]['hasOwnProperty'](_0x0212('0x34'))){throw new db[(_0x0212('0x35'))][(_0x0212('0x36'))](_0x0212('0x37'));}else{if(_0x35b4de['body'][_0x0212('0x38')](_0x0212('0x34'))&&!_0x35b4de[_0x0212('0x33')][_0x0212('0x38')](_0x0212('0x39'))){throw new db['Sequelize']['ValidationError'](_0x0212('0x3a'));}if(!_0x35b4de['body']['hasOwnProperty']('recipients')){throw new db[(_0x0212('0x35'))]['ValidationError'](_0x0212('0x3b'));}else{try{var _0x2d6d59=JSON['parse'](_0x35b4de[_0x0212('0x33')][_0x0212('0x3c')]);}catch(_0x1c7136){logger[_0x0212('0x2e')](_0x1c7136);throw new db[(_0x0212('0x35'))][(_0x0212('0x36'))](_0x0212('0x3d'));}var _0x5006d8=[_0x0212('0x3e'),_0x0212('0x3f'),_0x0212('0x40'),_0x0212('0x41'),'smsqueue',_0x0212('0x42'),_0x0212('0x43'),_0x0212('0x44'),'user'];if(_[_0x0212('0x45')](_0x2d6d59,function(_0x39abad){return!_[_0x0212('0x46')](_0x5006d8,_0x39abad[_0x0212('0x47')][_0x0212('0x48')]());})){throw new db[(_0x0212('0x35'))]['ValidationError'](_0x0212('0x49'));}}}var _0x168db6={};_0x168db6['senderName']=_0x35b4de[_0x0212('0x33')][_0x0212('0x38')](_0x0212('0x4a'))?_0x35b4de['body'][_0x0212('0x4a')]:_0x35b4de[_0x0212('0x4b')][_0x0212('0x4c')];_0x168db6[_0x0212('0x4d')]=_[_0x0212('0x4e')](_0x35b4de[_0x0212('0x33')][_0x0212('0x4d')])?null:_0x35b4de[_0x0212('0x33')][_0x0212('0x4d')];_0x168db6[_0x0212('0x4f')]=_0x35b4de[_0x0212('0x33')][_0x0212('0x4f')]||![];_0x168db6[_0x0212('0x50')]=_0x35b4de[_0x0212('0x4b')]['id'];return getContent(_0x35b4de[_0x0212('0x33')])['then'](function(_0x3f8641){_0x168db6['body']=_0x3f8641;return getRecipients(_0x2d6d59);})['then'](function(_0x2e0310){_0x168db6[_0x0212('0x51')]=_['sortBy'](_0x2e0310)[_0x0212('0x52')](',');return db[_0x0212('0x53')][_0x0212('0x54')](function(_0x1082fa){return db['UserNotification'][_0x0212('0x55')](_0x168db6,{'raw':!![],'transaction':_0x1082fa})[_0x0212('0x2c')](function(_0x33a0c9){var _0x51fb00={'sender':_0x168db6[_0x0212('0x4a')],'description':_0x168db6[_0x0212('0x4d')],'content':_0x168db6[_0x0212('0x33')],'beep':_0x168db6[_0x0212('0x4f')]};_0x2e0310[_0x0212('0x56')](function(_0x478994){_0x51fb00['recipient']=_0x478994;socket[_0x0212('0x57')](_0x0212('0x58'),_0x51fb00);});return _0x33a0c9;});});})[_0x0212('0x2c')](respondWithResult(_0x2cbe1d,0xc9))[_0x0212('0x59')](handleError(_0x2cbe1d,null));};function getContent(_0x23ebac){return new BPromise(function(_0x3f576a,_0x382d34){if(_0x23ebac['text']){_0x3f576a(_0x23ebac['text']);return;}return db['Template'][_0x0212('0x5a')]({'attributes':[_0x0212('0x5b')],'where':{'id':_0x23ebac[_0x0212('0x34')]},'raw':!![]})[_0x0212('0x2c')](function(_0x593a05){if(!_0x593a05)throw new db[(_0x0212('0x35'))][(_0x0212('0x36'))](_0x0212('0x5c'));var _0x8129bc=Mustache['render'](_0x593a05['html'],_0x23ebac[_0x0212('0x39')]);_0x3f576a(_0x8129bc);})['catch'](function(_0x1dfb1d){_0x382d34(_0x1dfb1d);});});}function getRecipients(_0x3f0d53){return new BPromise(function(_0x14afd6,_0x1dd78c){var _0x5d8df0=[];var _0x5e624f=[];_0x3f0d53[_0x0212('0x56')](function(_0x3049c7){var _0x40db72=_[_0x0212('0x5d')](_0x3049c7[_0x0212('0x47')][_0x0212('0x48')]());if(_0x40db72==='User'){_0x5d8df0=_[_0x0212('0x5e')](_0x5d8df0,_0x3049c7[_0x0212('0x5f')]);}else{if(_[_0x0212('0x46')](_0x40db72,_0x0212('0x60')))_0x40db72=_0x40db72[_0x0212('0x61')](_0x0212('0x60'),_0x0212('0x62'));_0x3049c7[_0x0212('0x5f')][_0x0212('0x56')](function(_0x310c2c){_0x5e624f[_0x0212('0x63')](getAgents(_0x40db72,_0x310c2c));});}});return BPromise[_0x0212('0x64')](_0x5e624f)['then'](function(_0x2f65ba){_0x5d8df0=_[_0x0212('0x5e')](_0x5d8df0,_['flatten'](_0x2f65ba));_0x14afd6(_0x5d8df0);})[_0x0212('0x59')](function(_0x1577e2){_0x1dd78c(_0x1577e2);});});}function getAgents(_0x56b457,_0x47402b){return new BPromise(function(_0x45e90e,_0x22e74f){return db[_0x56b457][_0x0212('0x5a')]({'where':{'id':_0x47402b}})['then'](function(_0x227428){return _0x227428[_0x0212('0x65')]({'attributes':['id'],'raw':!![]})[_0x0212('0x2c')](function(_0x1ab828){var _0x56711a=_[_0x0212('0x66')](_0x1ab828,'id');_0x45e90e(_0x56711a);});})[_0x0212('0x59')](function(_0x125e7c){_0x22e74f(_0x125e7c);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index e87f2da..af064ce 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 _0x6ec8=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x6ec8,0x155));var _0x86ec=function(_0x125b80,_0x41db3b){_0x125b80=_0x125b80-0x0;var _0x414ba8=_0x6ec8[_0x125b80];return _0x414ba8;};'use strict';var EventEmitter=require(_0x86ec('0x0'));var UserNotification=require(_0x86ec('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x86ec('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x86ec('0x3'),'afterDestroy':_0x86ec('0x4')};function emitEvent(_0x4edf89){return function(_0x4063ea,_0x158237,_0xc6302b){UserNotificationEvents[_0x86ec('0x5')](_0x4edf89+':'+_0x4063ea['id'],_0x4063ea);UserNotificationEvents[_0x86ec('0x5')](_0x4edf89,_0x4063ea);_0xc6302b(null);};}for(var e in events){if(events[_0x86ec('0x6')](e)){var event=events[e];UserNotification[_0x86ec('0x7')](e,emitEvent(event));}}module[_0x86ec('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xfe7d=['UserNotification','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3cc8c3,_0x5318e1){var _0x9d2e39=function(_0x6fed1a){while(--_0x6fed1a){_0x3cc8c3['push'](_0x3cc8c3['shift']());}};_0x9d2e39(++_0x5318e1);}(_0xfe7d,0xa1));var _0xdfe7=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0xfe7d[_0x19159a];return _0xa677f4;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xdfe7('0x0'))['db'][_0xdfe7('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xdfe7('0x2')](0x0);var events={'afterCreate':_0xdfe7('0x3'),'afterUpdate':_0xdfe7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x47441c){return function(_0x2ffb6f,_0x2038a1,_0x3a7871){UserNotificationEvents[_0xdfe7('0x5')](_0x47441c+':'+_0x2ffb6f['id'],_0x2ffb6f);UserNotificationEvents[_0xdfe7('0x5')](_0x47441c,_0x2ffb6f);_0x3a7871(null);};}for(var e in events){if(events[_0xdfe7('0x6')](e)){var event=events[e];UserNotification[_0xdfe7('0x7')](e,emitEvent(event));}}module[_0xdfe7('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 567307b..90c28d8 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 _0x7502=['exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x122c67,_0x3c4182){var _0x4b9888=function(_0x5b9e6e){while(--_0x5b9e6e){_0x122c67['push'](_0x122c67['shift']());}};_0x4b9888(++_0x3c4182);}(_0x7502,0x11e));var _0x2750=function(_0x314598,_0x1b2c55){_0x314598=_0x314598-0x0;var _0x1be25d=_0x7502[_0x314598];return _0x1be25d;};'use strict';var _=require(_0x2750('0x0'));var util=require(_0x2750('0x1'));var logger=require(_0x2750('0x2'))(_0x2750('0x3'));var moment=require(_0x2750('0x4'));var BPromise=require('bluebird');var rp=require(_0x2750('0x5'));var fs=require('fs');var path=require(_0x2750('0x6'));var rimraf=require('rimraf');var config=require(_0x2750('0x7'));var attributes=require('./userNotification.attributes');module[_0x2750('0x8')]=function(_0x2ecbf5,_0x5d6aea){return _0x2ecbf5[_0x2750('0x9')](_0x2750('0xa'),attributes,{'tableName':_0x2750('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2750('0xc'),'collate':_0x2750('0xd')});}; \ No newline at end of file +var _0x8004=['api','moment','bluebird','rimraf','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4','lodash','util','../../config/logger'];(function(_0x5109fb,_0x1d6241){var _0x18eb18=function(_0x5d2536){while(--_0x5d2536){_0x5109fb['push'](_0x5109fb['shift']());}};_0x18eb18(++_0x1d6241);}(_0x8004,0x75));var _0x4800=function(_0x4396d8,_0x24eb45){_0x4396d8=_0x4396d8-0x0;var _0x463743=_0x8004[_0x4396d8];return _0x463743;};'use strict';var _=require(_0x4800('0x0'));var util=require(_0x4800('0x1'));var logger=require(_0x4800('0x2'))(_0x4800('0x3'));var moment=require(_0x4800('0x4'));var BPromise=require(_0x4800('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4800('0x6'));var config=require('../../config/environment');var attributes=require(_0x4800('0x7'));module['exports']=function(_0xc97c3c,_0x12c005){return _0xc97c3c[_0x4800('0x8')](_0x4800('0x9'),attributes,{'tableName':_0x4800('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4800('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 0ca65c6..1e4f75a 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 _0x790a=['jayson/promise','client','http','defaults','localhost','redis','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3438dd,_0x368c86){var _0x360f08=function(_0x490c09){while(--_0x490c09){_0x3438dd['push'](_0x3438dd['shift']());}};_0x360f08(++_0x368c86);}(_0x790a,0xd1));var _0xa790=function(_0x592a9d,_0x434abb){_0x592a9d=_0x592a9d-0x0;var _0x59d2b3=_0x790a[_0x592a9d];return _0x59d2b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa790('0x0'));var BPromise=require(_0xa790('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa790('0x2'));var db=require(_0xa790('0x3'))['db'];var utils=require(_0xa790('0x4'));var logger=require(_0xa790('0x5'))(_0xa790('0x6'));var config=require('../../config/environment');var jayson=require(_0xa790('0x7'));var client=jayson[_0xa790('0x8')][_0xa790('0x9')]({'port':0x232a});config['redis']=_[_0xa790('0xa')](config['redis'],{'host':_0xa790('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa790('0xc')]));require(_0xa790('0xd'))[_0xa790('0xe')](socket);function respondWithRpcPromise(_0x8d3dea,_0x4cdfd8,_0x2390ba){return new BPromise(function(_0xa8a1e8,_0x180c0f){return client[_0xa790('0xf')](_0x8d3dea,_0x2390ba)[_0xa790('0x10')](function(_0x1362a5){logger[_0xa790('0x11')](_0xa790('0x12'),_0x4cdfd8,_0xa790('0x13'));logger[_0xa790('0x14')](_0xa790('0x15'),_0x4cdfd8,_0xa790('0x13'),JSON[_0xa790('0x16')](_0x1362a5));if(_0x1362a5[_0xa790('0x17')]){if(_0x1362a5[_0xa790('0x17')][_0xa790('0x18')]===0x1f4){logger['error'](_0xa790('0x12'),_0x4cdfd8,_0x1362a5['error'][_0xa790('0x19')]);return _0x180c0f(_0x1362a5[_0xa790('0x17')][_0xa790('0x19')]);}logger[_0xa790('0x17')]('UserNotification,\x20%s,\x20%s',_0x4cdfd8,_0x1362a5['error']['message']);return _0xa8a1e8(_0x1362a5[_0xa790('0x17')][_0xa790('0x19')]);}else{logger[_0xa790('0x11')](_0xa790('0x12'),_0x4cdfd8,_0xa790('0x13'));_0xa8a1e8(_0x1362a5[_0xa790('0x1a')][_0xa790('0x19')]);}})['catch'](function(_0xf6281f){logger[_0xa790('0x17')](_0xa790('0x12'),_0x4cdfd8,_0xf6281f);_0x180c0f(_0xf6281f);});});} \ No newline at end of file +var _0xb5e4=['socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x20b87d,_0x16b877){var _0x5679ce=function(_0x493c70){while(--_0x493c70){_0x20b87d['push'](_0x20b87d['shift']());}};_0x5679ce(++_0x16b877);}(_0xb5e4,0xab));var _0x4b5e=function(_0x6f9dbb,_0x31fbb9){_0x6f9dbb=_0x6f9dbb-0x0;var _0x5708a3=_0xb5e4[_0x6f9dbb];return _0x5708a3;};'use strict';var _=require(_0x4b5e('0x0'));var util=require(_0x4b5e('0x1'));var moment=require(_0x4b5e('0x2'));var BPromise=require(_0x4b5e('0x3'));var rs=require(_0x4b5e('0x4'));var fs=require('fs');var Redis=require(_0x4b5e('0x5'));var db=require(_0x4b5e('0x6'))['db'];var utils=require(_0x4b5e('0x7'));var logger=require(_0x4b5e('0x8'))('rpc');var config=require(_0x4b5e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4b5e('0xa')][_0x4b5e('0xb')]({'port':0x232a});config[_0x4b5e('0xc')]=_[_0x4b5e('0xd')](config['redis'],{'host':_0x4b5e('0xe'),'port':0x18eb});var socket=require(_0x4b5e('0xf'))(new Redis(config[_0x4b5e('0xc')]));require(_0x4b5e('0x10'))[_0x4b5e('0x11')](socket);function respondWithRpcPromise(_0x3d9e7d,_0x140d95,_0x63aa27){return new BPromise(function(_0x51d2d9,_0x4e212d){return client[_0x4b5e('0x12')](_0x3d9e7d,_0x63aa27)[_0x4b5e('0x13')](function(_0x40109b){logger[_0x4b5e('0x14')](_0x4b5e('0x15'),_0x140d95,_0x4b5e('0x16'));logger[_0x4b5e('0x17')](_0x4b5e('0x18'),_0x140d95,'request\x20sent',JSON[_0x4b5e('0x19')](_0x40109b));if(_0x40109b['error']){if(_0x40109b[_0x4b5e('0x1a')][_0x4b5e('0x1b')]===0x1f4){logger[_0x4b5e('0x1a')]('UserNotification,\x20%s,\x20%s',_0x140d95,_0x40109b['error']['message']);return _0x4e212d(_0x40109b[_0x4b5e('0x1a')][_0x4b5e('0x1c')]);}logger[_0x4b5e('0x1a')]('UserNotification,\x20%s,\x20%s',_0x140d95,_0x40109b[_0x4b5e('0x1a')]['message']);return _0x51d2d9(_0x40109b[_0x4b5e('0x1a')][_0x4b5e('0x1c')]);}else{logger[_0x4b5e('0x14')](_0x4b5e('0x15'),_0x140d95,_0x4b5e('0x16'));_0x51d2d9(_0x40109b[_0x4b5e('0x1d')][_0x4b5e('0x1c')]);}})[_0x4b5e('0x1e')](function(_0x3843d1){logger[_0x4b5e('0x1a')](_0x4b5e('0x15'),_0x140d95,_0x3843d1);_0x4e212d(_0x3843d1);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index d7a8248..8d13fd9 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 _0x3d1f=['./userNotification.events','update','removeListener','length'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x3d1f,0x1ac));var _0xf3d1=function(_0x5b96d8,_0x493ed9){_0x5b96d8=_0x5b96d8-0x0;var _0x154a2a=_0x3d1f[_0x5b96d8];return _0x154a2a;};'use strict';var UserNotificationEvents=require(_0xf3d1('0x0'));var events=['save','remove',_0xf3d1('0x1')];function createListener(_0x28b6c2,_0x2286ad){return function(_0x28d146){_0x2286ad['emit'](_0x28b6c2,_0x28d146);};}function removeListener(_0x4b6166,_0x44f6ae){return function(){UserNotificationEvents[_0xf3d1('0x2')](_0x4b6166,_0x44f6ae);};}exports['register']=function(_0x383686){for(var _0x4d3082=0x0,_0x3bdeab=events[_0xf3d1('0x3')];_0x4d3082<_0x3bdeab;_0x4d3082++){var _0x456f59=events[_0x4d3082];var _0x18e4b6=createListener('userNotification:'+_0x456f59,_0x383686);UserNotificationEvents['on'](_0x456f59,_0x18e4b6);}}; \ No newline at end of file +var _0x8ad4=['remove','update','emit','register','length','userNotification:','./userNotification.events','save'];(function(_0x2f7ee1,_0x238541){var _0x298295=function(_0x124360){while(--_0x124360){_0x2f7ee1['push'](_0x2f7ee1['shift']());}};_0x298295(++_0x238541);}(_0x8ad4,0x126));var _0x48ad=function(_0x30800b,_0x536828){_0x30800b=_0x30800b-0x0;var _0x3fb300=_0x8ad4[_0x30800b];return _0x3fb300;};'use strict';var UserNotificationEvents=require(_0x48ad('0x0'));var events=[_0x48ad('0x1'),_0x48ad('0x2'),_0x48ad('0x3')];function createListener(_0x1319e7,_0x37fd92){return function(_0x216046){_0x37fd92[_0x48ad('0x4')](_0x1319e7,_0x216046);};}function removeListener(_0x4bc0c9,_0x3d1b28){return function(){UserNotificationEvents['removeListener'](_0x4bc0c9,_0x3d1b28);};}exports[_0x48ad('0x5')]=function(_0x24daf7){for(var _0x3811c7=0x0,_0x233b27=events[_0x48ad('0x6')];_0x3811c7<_0x233b27;_0x3811c7++){var _0xef7984=events[_0x3811c7];var _0x2a9621=createListener(_0x48ad('0x7')+_0xef7984,_0x24daf7);UserNotificationEvents['on'](_0xef7984,_0x2a9621);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index ed1f730..b2acd67 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2c0c4b,_0x39f30c){var _0x304345=function(_0x482910){while(--_0x482910){_0x2c0c4b['push'](_0x2c0c4b['shift']());}};_0x304345(++_0x39f30c);}(_0x70e0,0x17b));var _0x070e=function(_0x1bf652,_0x53f402){_0x1bf652=_0x1bf652-0x0;var _0x5c30c8=_0x70e0[_0x1bf652];return _0x5c30c8;};'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(_0x4145e7,_0x31a1e0){var _0x9b22e1=function(_0x11762c){while(--_0x11762c){_0x4145e7['push'](_0x4145e7['shift']());}};_0x9b22e1(++_0x31a1e0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xcb91[_0x49d41c];return _0xb64c5f;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 07bac91..c77bb6a 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 _0xd7ad=['sequelize','exports'];(function(_0xc24aaf,_0x43b4d4){var _0x198ddd=function(_0x5491c4){while(--_0x5491c4){_0xc24aaf['push'](_0xc24aaf['shift']());}};_0x198ddd(++_0x43b4d4);}(_0xd7ad,0x15c));var _0xdd7a=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0xd7ad[_0x1ebce2];return _0x4a330c;};'use strict';var Sequelize=require(_0xdd7a('0x0'));module[_0xdd7a('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xaef4=['exports','INTEGER','sequelize'];(function(_0x3b936e,_0x1b6196){var _0x2d5de7=function(_0x477132){while(--_0x477132){_0x3b936e['push'](_0x3b936e['shift']());}};_0x2d5de7(++_0x1b6196);}(_0xaef4,0x197));var _0x4aef=function(_0x371622,_0x99c042){_0x371622=_0x371622-0x0;var _0x2abde8=_0xaef4[_0x371622];return _0x2abde8;};'use strict';var Sequelize=require(_0x4aef('0x0'));module[_0x4aef('0x1')]={'penalty':{'type':Sequelize[_0x4aef('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 311e335..64de44b 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 _0xe0c8=['../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','api','moment','bluebird','path'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xe0c8,0x1c2));var _0x8e0c=function(_0x3c0cd6,_0x5ba428){_0x3c0cd6=_0x3c0cd6-0x0;var _0x4381ec=_0xe0c8[_0x3c0cd6];return _0x4381ec;};'use strict';var _=require(_0x8e0c('0x0'));var util=require(_0x8e0c('0x1'));var logger=require('../../config/logger')(_0x8e0c('0x2'));var moment=require(_0x8e0c('0x3'));var BPromise=require(_0x8e0c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e0c('0x5'));var rimraf=require('rimraf');var config=require(_0x8e0c('0x6'));var attributes=require(_0x8e0c('0x7'));module[_0x8e0c('0x8')]=function(_0x4c072e,_0x93dd0){return _0x4c072e[_0x8e0c('0x9')](_0x8e0c('0xa'),attributes,{'tableName':_0x8e0c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c4d=['user_has_openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','UserOpenchannelQueue'];(function(_0xde0e66,_0x1a5e43){var _0x17bd72=function(_0x57c5a8){while(--_0x57c5a8){_0xde0e66['push'](_0xde0e66['shift']());}};_0x17bd72(++_0x1a5e43);}(_0x2c4d,0x8d));var _0xd2c4=function(_0x152ea8,_0x3fb53f){_0x152ea8=_0x152ea8-0x0;var _0x4c0ebe=_0x2c4d[_0x152ea8];return _0x4c0ebe;};'use strict';var _=require(_0xd2c4('0x0'));var util=require('util');var logger=require(_0xd2c4('0x1'))(_0xd2c4('0x2'));var moment=require(_0xd2c4('0x3'));var BPromise=require(_0xd2c4('0x4'));var rp=require(_0xd2c4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd2c4('0x6'));var config=require(_0xd2c4('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x20921d,_0x4677bf){return _0x20921d['define'](_0xd2c4('0x8'),attributes,{'tableName':_0xd2c4('0x9'),'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 a42d35c..37546e6 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 _0x6c66=['UserOpenchannelQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','request\x20sent','debug','error'];(function(_0x19309c,_0x299b11){var _0x802d31=function(_0x4c7b83){while(--_0x4c7b83){_0x19309c['push'](_0x19309c['shift']());}};_0x802d31(++_0x299b11);}(_0x6c66,0x9d));var _0x66c6=function(_0x41456e,_0x5a6321){_0x41456e=_0x41456e-0x0;var _0x3978df=_0x6c66[_0x41456e];return _0x3978df;};'use strict';var _=require(_0x66c6('0x0'));var util=require(_0x66c6('0x1'));var moment=require('moment');var BPromise=require(_0x66c6('0x2'));var rs=require(_0x66c6('0x3'));var fs=require('fs');var Redis=require(_0x66c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x66c6('0x5'));var logger=require(_0x66c6('0x6'))(_0x66c6('0x7'));var config=require(_0x66c6('0x8'));var jayson=require(_0x66c6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x373c19,_0x3698da,_0x4f5070){return new BPromise(function(_0x391c1e,_0x440af2){return client[_0x66c6('0xa')](_0x373c19,_0x4f5070)['then'](function(_0x37cfc9){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x3698da,_0x66c6('0xb'));logger[_0x66c6('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x3698da,_0x66c6('0xb'),JSON['stringify'](_0x37cfc9));if(_0x37cfc9['error']){if(_0x37cfc9[_0x66c6('0xd')]['code']===0x1f4){logger[_0x66c6('0xd')](_0x66c6('0xe'),_0x3698da,_0x37cfc9['error'][_0x66c6('0xf')]);return _0x440af2(_0x37cfc9[_0x66c6('0xd')][_0x66c6('0xf')]);}logger[_0x66c6('0xd')](_0x66c6('0xe'),_0x3698da,_0x37cfc9[_0x66c6('0xd')][_0x66c6('0xf')]);return _0x391c1e(_0x37cfc9[_0x66c6('0xd')][_0x66c6('0xf')]);}else{logger[_0x66c6('0x10')](_0x66c6('0xe'),_0x3698da,_0x66c6('0xb'));_0x391c1e(_0x37cfc9[_0x66c6('0x11')]['message']);}})[_0x66c6('0x12')](function(_0xa1fda3){logger[_0x66c6('0xd')](_0x66c6('0xe'),_0x3698da,_0xa1fda3);_0x440af2(_0xa1fda3);});});} \ No newline at end of file +var _0x551d=['http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\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(_0x397633,_0x297aee){var _0x55d1e7=function(_0x919aa7){while(--_0x919aa7){_0x397633['push'](_0x397633['shift']());}};_0x55d1e7(++_0x297aee);}(_0x551d,0xfc));var _0xd551=function(_0x10ab62,_0x21d1da){_0x10ab62=_0x10ab62-0x0;var _0x3b325b=_0x551d[_0x10ab62];return _0x3b325b;};'use strict';var _=require(_0xd551('0x0'));var util=require(_0xd551('0x1'));var moment=require(_0xd551('0x2'));var BPromise=require('bluebird');var rs=require(_0xd551('0x3'));var fs=require('fs');var Redis=require(_0xd551('0x4'));var db=require(_0xd551('0x5'))['db'];var utils=require(_0xd551('0x6'));var logger=require(_0xd551('0x7'))(_0xd551('0x8'));var config=require(_0xd551('0x9'));var jayson=require(_0xd551('0xa'));var client=jayson[_0xd551('0xb')][_0xd551('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x234a83,_0x32345c,_0x3f8e81){return new BPromise(function(_0x18e661,_0x17da03){return client[_0xd551('0xd')](_0x234a83,_0x3f8e81)['then'](function(_0x82aa5f){logger[_0xd551('0xe')](_0xd551('0xf'),_0x32345c,_0xd551('0x10'));logger[_0xd551('0x11')](_0xd551('0x12'),_0x32345c,_0xd551('0x10'),JSON['stringify'](_0x82aa5f));if(_0x82aa5f['error']){if(_0x82aa5f[_0xd551('0x13')][_0xd551('0x14')]===0x1f4){logger['error'](_0xd551('0xf'),_0x32345c,_0x82aa5f[_0xd551('0x13')]['message']);return _0x17da03(_0x82aa5f['error']['message']);}logger[_0xd551('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x32345c,_0x82aa5f[_0xd551('0x13')]['message']);return _0x18e661(_0x82aa5f[_0xd551('0x13')][_0xd551('0x15')]);}else{logger[_0xd551('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x32345c,'request\x20sent');_0x18e661(_0x82aa5f[_0xd551('0x16')]['message']);}})[_0xd551('0x17')](function(_0x37de93){logger[_0xd551('0x13')](_0xd551('0xf'),_0x32345c,_0x37de93);_0x17da03(_0x37de93);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 205b6bd..46cdf1e 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 _0xde39=['/:id/resources','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getResources','post','create','/:id/clone','clone','/:id/sections'];(function(_0x1f7d7d,_0x145761){var _0xd6e42e=function(_0x3bd866){while(--_0x3bd866){_0x1f7d7d['push'](_0x1f7d7d['shift']());}};_0xd6e42e(++_0x145761);}(_0xde39,0x15e));var _0x9de3=function(_0x91384,_0x545eef){_0x91384=_0x91384-0x0;var _0x44daa0=_0xde39[_0x91384];return _0x44daa0;};'use strict';var multer=require(_0x9de3('0x0'));var util=require(_0x9de3('0x1'));var path=require('path');var timeout=require(_0x9de3('0x2'));var express=require(_0x9de3('0x3'));var router=express[_0x9de3('0x4')]();var fs_extra=require(_0x9de3('0x5'));var auth=require(_0x9de3('0x6'));var interaction=require(_0x9de3('0x7'));var config=require('../../config/environment');var controller=require(_0x9de3('0x8'));router[_0x9de3('0x9')]('/',auth[_0x9de3('0xa')](),controller[_0x9de3('0xb')]);router['get'](_0x9de3('0xc'),auth[_0x9de3('0xa')](),controller[_0x9de3('0xd')]);router[_0x9de3('0x9')](_0x9de3('0xe'),auth['isAuthenticated'](),controller[_0x9de3('0xf')]);router[_0x9de3('0x9')]('/:id/sections',auth[_0x9de3('0xa')](),controller['getSections']);router['get']('/:id/resources',auth['isAuthenticated'](),controller[_0x9de3('0x10')]);router[_0x9de3('0x11')]('/',auth[_0x9de3('0xa')](),controller[_0x9de3('0x12')]);router['post'](_0x9de3('0x13'),auth[_0x9de3('0xa')](),controller[_0x9de3('0x14')]);router[_0x9de3('0x11')](_0x9de3('0x15'),auth['isAuthenticated'](),controller['addSections']);router[_0x9de3('0x11')](_0x9de3('0x16'),auth[_0x9de3('0xa')](),controller[_0x9de3('0x17')]);router[_0x9de3('0x18')](_0x9de3('0xe'),auth[_0x9de3('0xa')](),controller[_0x9de3('0x19')]);router[_0x9de3('0x1a')](_0x9de3('0xe'),auth['isAuthenticated'](),controller[_0x9de3('0x1b')]);router['delete'](_0x9de3('0x15'),auth['isAuthenticated'](),controller[_0x9de3('0x1c')]);router['delete'](_0x9de3('0x16'),auth[_0x9de3('0xa')](),controller[_0x9de3('0x1d')]);module[_0x9de3('0x1e')]=router; \ No newline at end of file +var _0xf3a7=['get','/describe','describe','show','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','/:id/sections','addResources','put','/:id','update','delete','destroy','removeSections','removeResources','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index'];(function(_0x8fa4bc,_0x5cd2af){var _0x35b6a7=function(_0x357c25){while(--_0x357c25){_0x8fa4bc['push'](_0x8fa4bc['shift']());}};_0x35b6a7(++_0x5cd2af);}(_0xf3a7,0x99));var _0x7f3a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf3a7[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x7f3a('0x0'));var path=require(_0x7f3a('0x1'));var timeout=require(_0x7f3a('0x2'));var express=require(_0x7f3a('0x3'));var router=express[_0x7f3a('0x4')]();var fs_extra=require(_0x7f3a('0x5'));var auth=require(_0x7f3a('0x6'));var interaction=require(_0x7f3a('0x7'));var config=require(_0x7f3a('0x8'));var controller=require(_0x7f3a('0x9'));router['get']('/',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0xb')]);router[_0x7f3a('0xc')](_0x7f3a('0xd'),auth[_0x7f3a('0xa')](),controller[_0x7f3a('0xe')]);router[_0x7f3a('0xc')]('/:id',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0xf')]);router['get']('/:id/sections',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x10')]);router['get'](_0x7f3a('0x11'),auth['isAuthenticated'](),controller[_0x7f3a('0x12')]);router['post']('/',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x13')]);router[_0x7f3a('0x14')](_0x7f3a('0x15'),auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x16')]);router[_0x7f3a('0x14')](_0x7f3a('0x17'),auth[_0x7f3a('0xa')](),controller['addSections']);router[_0x7f3a('0x14')]('/:id/resources',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x18')]);router[_0x7f3a('0x19')](_0x7f3a('0x1a'),auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x1b')]);router[_0x7f3a('0x1c')]('/:id',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x1d')]);router['delete'](_0x7f3a('0x17'),auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x1e')]);router[_0x7f3a('0x1c')]('/:id/resources',auth['isAuthenticated'](),controller[_0x7f3a('0x1f')]);module[_0x7f3a('0x20')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index cf10a7e..f38c322 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 _0xc2b7=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','crudPermissions','join'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc2b7,0x198));var _0x7c2b=function(_0x48a1dc,_0x3421dd){_0x48a1dc=_0x48a1dc-0x0;var _0x5c079e=_0xc2b7[_0x48a1dc];return _0x5c079e;};'use strict';var Sequelize=require(_0x7c2b('0x0'));module[_0x7c2b('0x1')]={'name':{'type':Sequelize[_0x7c2b('0x2')],'allowNull':![],'unique':_0x7c2b('0x3')},'crudPermissions':{'type':Sequelize[_0x7c2b('0x2')],'set':function(_0x174861){this['setDataValue'](_0x7c2b('0x4'),_0x174861?_0x174861[_0x7c2b('0x5')](''):[]);},'get':function(){return this[_0x7c2b('0x6')](_0x7c2b('0x4'))?this['getDataValue']('crudPermissions')[_0x7c2b('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x7c2b('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x7c2b('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x7c2b('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x7c2b('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x7c2b('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x265f=['name','setDataValue','join','getDataValue','crudPermissions','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x21c120,_0x5769f4){var _0x1eb983=function(_0x4a0d66){while(--_0x4a0d66){_0x21c120['push'](_0x21c120['shift']());}};_0x1eb983(++_0x5769f4);}(_0x265f,0x75));var _0xf265=function(_0x69b0bf,_0x248a70){_0x69b0bf=_0x69b0bf-0x0;var _0x53a201=_0x265f[_0x69b0bf];return _0x53a201;};'use strict';var Sequelize=require(_0xf265('0x0'));module[_0xf265('0x1')]={'name':{'type':Sequelize[_0xf265('0x2')],'allowNull':![],'unique':_0xf265('0x3')},'crudPermissions':{'type':Sequelize[_0xf265('0x2')],'set':function(_0x2f683f){this[_0xf265('0x4')]('crudPermissions',_0x2f683f?_0x2f683f[_0xf265('0x5')](''):[]);},'get':function(){return this[_0xf265('0x6')](_0xf265('0x7'))?this[_0xf265('0x6')](_0xf265('0x7'))[_0xf265('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xf265('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xf265('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xf265('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xf265('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf265('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xf265('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xf265('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 5831709..14a6cfe 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 _0xa486=['omit','updatedAt','sequelize','transaction','get','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','destroy','describe','addSections','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','forEach','resourceId','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','zip-dir','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','error','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','then','rows','catch','includeAll','find','create','body','clone','params','keys','createdAt','crudPermissions'];(function(_0x54f948,_0x291c02){var _0x76ff8c=function(_0x377216){while(--_0x377216){_0x54f948['push'](_0x54f948['shift']());}};_0x76ff8c(++_0x291c02);}(_0xa486,0x17d));var _0x6a48=function(_0x48eb4b,_0x3c39bc){_0x48eb4b=_0x48eb4b-0x0;var _0x31cbcf=_0xa486[_0x48eb4b];return _0x31cbcf;};'use strict';var emlformat=require(_0x6a48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a48('0x2'));var moment=require('moment');var BPromise=require(_0x6a48('0x3'));var Mustache=require(_0x6a48('0x4'));var util=require(_0x6a48('0x5'));var path=require(_0x6a48('0x6'));var sox=require(_0x6a48('0x7'));var csv=require(_0x6a48('0x8'));var ejs=require(_0x6a48('0x9'));var fs=require('fs');var fs_extra=require(_0x6a48('0xa'));var _=require(_0x6a48('0xb'));var squel=require(_0x6a48('0xc'));var crypto=require(_0x6a48('0xd'));var jsforce=require(_0x6a48('0xe'));var deskjs=require(_0x6a48('0xf'));var toCsv=require(_0x6a48('0x8'));var querystring=require(_0x6a48('0x10'));var Papa=require(_0x6a48('0x11'));var Redis=require('ioredis');var authService=require(_0x6a48('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6a48('0x13'));var hardwareService=require(_0x6a48('0x14'));var logger=require(_0x6a48('0x15'))(_0x6a48('0x16'));var utils=require(_0x6a48('0x17'));var config=require(_0x6a48('0x18'));var licenseUtil=require(_0x6a48('0x19'));var db=require(_0x6a48('0x1a'))['db'];config[_0x6a48('0x1b')]=_[_0x6a48('0x1c')](config[_0x6a48('0x1b')],{'host':_0x6a48('0x1d'),'port':0x18eb});var socket=require(_0x6a48('0x1e'))(new Redis(config[_0x6a48('0x1b')]));require(_0x6a48('0x1f'))[_0x6a48('0x20')](socket);function respondWithStatusCode(_0xcbcb4b,_0x4ab8c6){_0x4ab8c6=_0x4ab8c6||0xcc;return function(_0x180319){if(_0x180319){return _0xcbcb4b[_0x6a48('0x21')](_0x4ab8c6);}return _0xcbcb4b[_0x6a48('0x22')](_0x4ab8c6)[_0x6a48('0x23')]();};}function respondWithResult(_0x231930,_0xaf303c){_0xaf303c=_0xaf303c||0xc8;return function(_0xad96d0){if(_0xad96d0){return _0x231930[_0x6a48('0x22')](_0xaf303c)[_0x6a48('0x24')](_0xad96d0);}};}function respondWithFilteredResult(_0x20cab5,_0x506bd2){return function(_0xab0913){if(_0xab0913){var _0x23a1fe=typeof _0x506bd2[_0x6a48('0x25')]===_0x6a48('0x26')&&typeof _0x506bd2['limit']===_0x6a48('0x26');var _0x43a80d=_0xab0913[_0x6a48('0x27')];var _0x4a252e=_0x23a1fe?0x0:_0x506bd2[_0x6a48('0x25')];var _0x6a0206=_0x23a1fe?_0xab0913[_0x6a48('0x27')]:_0x506bd2['offset']+_0x506bd2[_0x6a48('0x28')];var _0x24c549;if(_0x6a0206>=_0x43a80d){_0x6a0206=_0x43a80d;_0x24c549=0xc8;}else{_0x24c549=0xce;}_0x20cab5[_0x6a48('0x22')](_0x24c549);return _0x20cab5[_0x6a48('0x29')]('Content-Range',_0x4a252e+'-'+_0x6a0206+'/'+_0x43a80d)[_0x6a48('0x24')](_0xab0913);}return null;};}function patchUpdates(_0x230220){return function(_0x59b031){try{jsonpatch['apply'](_0x59b031,_0x230220,!![]);}catch(_0x11b488){return BPromise[_0x6a48('0x2a')](_0x11b488);}return _0x59b031['save']();};}function saveUpdates(_0x2eae9f,_0x4846bf){return function(_0x508432){if(_0x508432){return _0x508432['update'](_0x2eae9f)['then'](function(_0x2a14d5){return _0x2a14d5;});}return null;};}function removeEntity(_0x5eeef8,_0x19594c){return function(_0x52de7c){if(_0x52de7c){return _0x52de7c['destroy']()['then'](function(){_0x5eeef8['status'](0xcc)[_0x6a48('0x23')]();});}};}function handleEntityNotFound(_0x29cfd2,_0x2cb60e){return function(_0x20ecb0){if(!_0x20ecb0){_0x29cfd2['sendStatus'](0x194);}return _0x20ecb0;};}function handleError(_0x370bfe,_0x23cbf5){_0x23cbf5=_0x23cbf5||0x1f4;return function(_0xf450b){logger[_0x6a48('0x2b')](_0xf450b['stack']);if(_0xf450b['name']){delete _0xf450b[_0x6a48('0x2c')];}_0x370bfe[_0x6a48('0x22')](_0x23cbf5)[_0x6a48('0x2d')](_0xf450b);};}exports[_0x6a48('0x2e')]=function(_0x437622,_0x5b01a4){var _0x16982f={},_0x5c8e3e={},_0x50e0e8={'count':0x0,'rows':[]};var _0x12ba71=_[_0x6a48('0x2f')](db[_0x6a48('0x30')][_0x6a48('0x31')],function(_0x24aa89){return{'name':_0x24aa89[_0x6a48('0x32')],'type':_0x24aa89[_0x6a48('0x33')][_0x6a48('0x34')]};});_0x5c8e3e[_0x6a48('0x35')]=_[_0x6a48('0x2f')](_0x12ba71,_0x6a48('0x2c'));_0x5c8e3e[_0x6a48('0x36')]=_['keys'](_0x437622[_0x6a48('0x36')]);_0x5c8e3e[_0x6a48('0x37')]=_[_0x6a48('0x38')](_0x5c8e3e['model'],_0x5c8e3e[_0x6a48('0x36')]);_0x16982f['attributes']=_[_0x6a48('0x38')](_0x5c8e3e['model'],qs[_0x6a48('0x39')](_0x437622[_0x6a48('0x36')][_0x6a48('0x39')]));_0x16982f['attributes']=_0x16982f[_0x6a48('0x3a')][_0x6a48('0x3b')]?_0x16982f['attributes']:_0x5c8e3e['model'];if(!_0x437622[_0x6a48('0x36')][_0x6a48('0x3c')](_0x6a48('0x3d'))){_0x16982f[_0x6a48('0x28')]=qs[_0x6a48('0x28')](_0x437622[_0x6a48('0x36')][_0x6a48('0x28')]);_0x16982f[_0x6a48('0x25')]=qs['offset'](_0x437622[_0x6a48('0x36')][_0x6a48('0x25')]);}_0x16982f[_0x6a48('0x3e')]=qs[_0x6a48('0x3f')](_0x437622[_0x6a48('0x36')][_0x6a48('0x3f')]);_0x16982f[_0x6a48('0x40')]=qs[_0x6a48('0x37')](_[_0x6a48('0x41')](_0x437622[_0x6a48('0x36')],_0x5c8e3e[_0x6a48('0x37')]),_0x12ba71);if(_0x437622[_0x6a48('0x36')][_0x6a48('0x42')]){_0x16982f[_0x6a48('0x40')]=_['merge'](_0x16982f[_0x6a48('0x40')],{'$or':_[_0x6a48('0x2f')](_0x12ba71,function(_0x57cf0b){if(_0x57cf0b[_0x6a48('0x33')]!==_0x6a48('0x43')){var _0x5b27e9={};_0x5b27e9[_0x57cf0b[_0x6a48('0x2c')]]={'$like':'%'+_0x437622['query'][_0x6a48('0x42')]+'%'};return _0x5b27e9;}})});}_0x16982f=_[_0x6a48('0x44')]({},_0x16982f,_0x437622[_0x6a48('0x45')]);var _0x93aeaf={'where':_0x16982f[_0x6a48('0x40')]};return db[_0x6a48('0x30')][_0x6a48('0x27')](_0x93aeaf)['then'](function(_0x5cbb47){_0x50e0e8[_0x6a48('0x27')]=_0x5cbb47;if(_0x437622[_0x6a48('0x36')]['includeAll']){_0x16982f[_0x6a48('0x46')]=[{'all':!![]}];}return db[_0x6a48('0x30')]['findAll'](_0x16982f);})[_0x6a48('0x47')](function(_0x2abea4){_0x50e0e8[_0x6a48('0x48')]=_0x2abea4;return _0x50e0e8;})[_0x6a48('0x47')](respondWithFilteredResult(_0x5b01a4,_0x16982f))[_0x6a48('0x49')](handleError(_0x5b01a4,null));};exports['show']=function(_0x367701,_0x553dd5){var _0x5d1603={'raw':![],'where':{'id':_0x367701['params']['id']}},_0x1af9e8={};_0x1af9e8[_0x6a48('0x35')]=_['keys'](db[_0x6a48('0x30')][_0x6a48('0x31')]);_0x1af9e8[_0x6a48('0x36')]=_['keys'](_0x367701[_0x6a48('0x36')]);_0x1af9e8['filters']=_['intersection'](_0x1af9e8['model'],_0x1af9e8[_0x6a48('0x36')]);_0x5d1603['attributes']=_[_0x6a48('0x38')](_0x1af9e8[_0x6a48('0x35')],qs[_0x6a48('0x39')](_0x367701[_0x6a48('0x36')]['fields']));_0x5d1603[_0x6a48('0x3a')]=_0x5d1603['attributes'][_0x6a48('0x3b')]?_0x5d1603[_0x6a48('0x3a')]:_0x1af9e8['model'];if(_0x367701['query'][_0x6a48('0x4a')]){_0x5d1603[_0x6a48('0x46')]=[{'all':!![]}];}_0x5d1603=_['merge']({},_0x5d1603,_0x367701[_0x6a48('0x45')]);return db[_0x6a48('0x30')][_0x6a48('0x4b')](_0x5d1603)[_0x6a48('0x47')](handleEntityNotFound(_0x553dd5,null))[_0x6a48('0x47')](respondWithResult(_0x553dd5,null))[_0x6a48('0x49')](handleError(_0x553dd5,null));};exports[_0x6a48('0x4c')]=function(_0x4b3cc1,_0x3227db){return db[_0x6a48('0x30')]['create'](_0x4b3cc1[_0x6a48('0x4d')],{})[_0x6a48('0x47')](respondWithResult(_0x3227db,0xc9))[_0x6a48('0x49')](handleError(_0x3227db,null));};exports[_0x6a48('0x4e')]=function(_0x375358,_0x58b400){var _0xf58971={'where':{'id':_0x375358[_0x6a48('0x4f')]['id']}},_0x1ce605={};_0x1ce605[_0x6a48('0x35')]=_[_0x6a48('0x50')](db['UserProfile']['rawAttributes']);_0xf58971[_0x6a48('0x3a')]=_[_0x6a48('0x38')](_0x1ce605[_0x6a48('0x35')],qs['fields'](_0x375358[_0x6a48('0x36')]['fields']));_0xf58971[_0x6a48('0x3a')]=_0xf58971[_0x6a48('0x3a')]['length']?_0xf58971[_0x6a48('0x3a')]:_0x1ce605[_0x6a48('0x35')];if(_0x375358[_0x6a48('0x36')][_0x6a48('0x4a')]){_0xf58971[_0x6a48('0x46')]=[{'all':!![]}];}_0xf58971=_[_0x6a48('0x44')]({},_0xf58971,_0x375358[_0x6a48('0x45')]);return db['UserProfile'][_0x6a48('0x4b')](_0xf58971)[_0x6a48('0x47')](handleEntityNotFound(_0x58b400,null))['then'](function(_0x5751ce){if(_0x5751ce){var _0x4b1bf0=_0x5751ce['get']({'plain':!![]});_0x4b1bf0=qs['omit'](_0x4b1bf0,['id',_0x6a48('0x51'),'updatedAt',_0x6a48('0x52')]);_0x375358[_0x6a48('0x4d')]=_[_0x6a48('0x53')](_0x375358['body'],['id',_0x6a48('0x51'),_0x6a48('0x54')]);return db[_0x6a48('0x55')][_0x6a48('0x56')](function(_0x40bc22){return db[_0x6a48('0x30')]['create'](_[_0x6a48('0x44')](_0x4b1bf0,_0x375358[_0x6a48('0x4d')]),{'include':_0x375358[_0x6a48('0x36')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x40bc22})[_0x6a48('0x47')](function(_0x52f213){var _0x502ab0=_0x52f213[_0x6a48('0x57')]({'plain':!![]});return db[_0x6a48('0x58')][_0x6a48('0x59')]({'where':{'userProfileId':_0x375358['params']['id']},'raw':!![]})['then'](function(_0x3f6ed5){if(_0x3f6ed5){return BPromise[_0x6a48('0x5a')](_0x3f6ed5,function(_0x133494){return new BPromise(function(_0x545e28,_0x454ea5){if(_0x133494[_0x6a48('0x5b')]===null||_0x133494['autoAssociation']===0x1)_0x545e28(null);return db[_0x6a48('0x5c')]['findAll']({'where':{'sectionId':_0x133494['id']},'raw':!![]})[_0x6a48('0x47')](function(_0x70b605){var _0x276f1e=_[_0x6a48('0x2f')](_0x70b605,function(_0xf88ef9){return qs[_0x6a48('0x53')](_0xf88ef9,['id',_0x6a48('0x51'),'updatedAt',_0x6a48('0x5d')]);});_0x545e28(_0x276f1e);})[_0x6a48('0x49')](function(_0x676264){_0x454ea5(_0x676264);});})[_0x6a48('0x47')](function(_0x2e9891){var _0x382bb5=qs[_0x6a48('0x53')](_0x133494,['id',_0x6a48('0x51'),_0x6a48('0x54')]);_0x382bb5[_0x6a48('0x5e')]=_0x502ab0['id'];if(_0x2e9891)_0x382bb5[_0x6a48('0x5f')]=_0x2e9891;return _0x382bb5;})['then'](function(_0x37db16){return db[_0x6a48('0x58')][_0x6a48('0x4c')](_0x37db16,{'include':[{'model':db[_0x6a48('0x5c')],'as':_0x6a48('0x5f')}],'raw':!![],'transaction':_0x40bc22});});})[_0x6a48('0x47')](function(){return _0x502ab0;});}});});});}})['then'](respondWithResult(_0x58b400,0xc9))['catch'](handleError(_0x58b400,null));};exports['update']=function(_0x32c497,_0x108042){if(_0x32c497[_0x6a48('0x4d')]['id']){delete _0x32c497[_0x6a48('0x4d')]['id'];}return db['UserProfile'][_0x6a48('0x4b')]({'where':{'id':_0x32c497['params']['id']}})[_0x6a48('0x47')](handleEntityNotFound(_0x108042,null))[_0x6a48('0x47')](saveUpdates(_0x32c497[_0x6a48('0x4d')],null))[_0x6a48('0x47')](respondWithResult(_0x108042,null))['catch'](handleError(_0x108042,null));};exports[_0x6a48('0x60')]=function(_0x42be98,_0x8201ca){return db[_0x6a48('0x30')][_0x6a48('0x4b')]({'where':{'id':_0x42be98[_0x6a48('0x4f')]['id']}})[_0x6a48('0x47')](handleEntityNotFound(_0x8201ca,null))[_0x6a48('0x47')](removeEntity(_0x8201ca,null))[_0x6a48('0x49')](handleError(_0x8201ca,null));};exports[_0x6a48('0x61')]=function(_0x83d1b9,_0x2a0a75){return db[_0x6a48('0x30')][_0x6a48('0x61')]()[_0x6a48('0x47')](respondWithResult(_0x2a0a75,null))[_0x6a48('0x49')](handleError(_0x2a0a75,null));};exports[_0x6a48('0x62')]=function(_0x52454c,_0x14077a){var _0x12a200=_0x52454c[_0x6a48('0x4d')];return db[_0x6a48('0x30')][_0x6a48('0x4b')]({'where':{'id':_0x52454c[_0x6a48('0x4f')]['id']}})['then'](handleEntityNotFound(_0x14077a,null))[_0x6a48('0x47')](function(_0x49bb0c){if(_0x49bb0c){return db[_0x6a48('0x55')][_0x6a48('0x56')](function(_0x5c1d99){return db[_0x6a48('0x58')][_0x6a48('0x60')]({'where':{'userProfileId':_0x52454c['params']['id'],'sectionId':_[_0x6a48('0x2f')](_0x12a200,function(_0x4f2595){return _0x4f2595[_0x6a48('0x5d')];})},'transaction':_0x5c1d99})['then'](function(){var _0x76b76f=_[_0x6a48('0x2f')](_0x12a200,function(_0x4348b4){_0x4348b4['userProfileId']=_0x52454c[_0x6a48('0x4f')]['id'];return _0x4348b4;});var _0x19d0cc=[];return BPromise['each'](_0x76b76f,function(_0x535fde){return db[_0x6a48('0x58')]['create'](_0x535fde,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x5c1d99})[_0x6a48('0x47')](function(_0x29458c){_0x19d0cc[_0x6a48('0x63')](_0x29458c[_0x6a48('0x57')]({'plain':!![]}));});})[_0x6a48('0x47')](function(){return _0x19d0cc;});});});}})['then'](function(_0x36560f){return _0x36560f;})[_0x6a48('0x47')](respondWithResult(_0x14077a,null))[_0x6a48('0x49')](handleError(_0x14077a,null));};exports[_0x6a48('0x64')]=function(_0x26f3c6,_0x3c7fc5){var _0x42b2ac;return db[_0x6a48('0x30')][_0x6a48('0x4b')]({'where':{'id':_0x26f3c6['params']['id']},'attributes':['id',_0x6a48('0x2c')]})[_0x6a48('0x47')](handleEntityNotFound(_0x3c7fc5,null))[_0x6a48('0x47')](function(_0x3fdbdf){if(_0x3fdbdf){_0x42b2ac=_0x3fdbdf;return db['UserProfileSection'][_0x6a48('0x60')]({'where':{'userProfileId':_0x26f3c6[_0x6a48('0x4f')]['id'],'sectionId':_0x26f3c6[_0x6a48('0x36')][_0x6a48('0x65')]}});}})['then'](function(){return _0x42b2ac;})[_0x6a48('0x47')](respondWithStatusCode(_0x3c7fc5,null))['catch'](handleError(_0x3c7fc5,null));};exports[_0x6a48('0x66')]=function(_0x3a9c25,_0x5e9622){var _0x13a727=[];var _0x2524d6=[];return db[_0x6a48('0x58')]['findAll']({'where':{'userProfileId':_0x3a9c25[_0x6a48('0x4f')]['id']},'raw':!![]})[_0x6a48('0x47')](function(_0x10a0e4){_0x13a727=_[_0x6a48('0x42')](_0x10a0e4,function(_0xe8c381){return _0xe8c381[_0x6a48('0x67')]===0x1||_[_0x6a48('0x68')]([0x3eb,0x709],_0xe8c381[_0x6a48('0x5d')]);});if(!_[_0x6a48('0x69')](_0x13a727)){return _['map'](_0x13a727,function(_0x17f9b5){return _0x17f9b5[_0x6a48('0x5d')];});}else{return;}})['then'](function(_0x388227){if(_0x388227)_0x2524d6=_0x388227;if(_['includes'](_0x2524d6,0x64)){var _0x1792f9=_[_0x6a48('0x4b')](_0x13a727,{'sectionId':0x64});return hasDefaultDashboard(_0x1792f9)[_0x6a48('0x47')](function(_0x2ca31e){return _[_0x6a48('0x2f')](_0x13a727,function(_0x19c999){if(_0x19c999[_0x6a48('0x5d')]===0x64){_0x19c999[_0x6a48('0x6a')]=_0x2ca31e;}return _0x19c999;});});}else{return;}})[_0x6a48('0x47')](function(_0x18580e){if(_0x18580e)_0x13a727=_0x18580e;if(_['includes'](_0x2524d6,0x3eb)){var _0x45b82c=_[_0x6a48('0x4b')](_0x13a727,{'sectionId':0x3eb});return getCustomDashboards(_0x45b82c)[_0x6a48('0x47')](function(_0xf2cd45){return _[_0x6a48('0x2f')](_0x13a727,function(_0x37c4e6){if(_0x45b82c[_0x6a48('0x67')]){if(_0x37c4e6['sectionId']===0x3eb){_0x37c4e6['subsections']=_0xf2cd45;}}else{if(_0x37c4e6[_0x6a48('0x5d')]===0x64){_0x37c4e6[_0x6a48('0x6a')]=_0xf2cd45;}}return _0x37c4e6;});});}else{return;}})['then'](function(_0x56c58f){if(_0x56c58f)_0x13a727=_0x56c58f;if(_[_0x6a48('0x68')](_0x2524d6,0x709)){var _0x3b28e0=_[_0x6a48('0x4b')](_0x13a727,{'sectionId':0x709});return getPlugins(_0x3b28e0)[_0x6a48('0x47')](function(_0x2fcaa5){if(_0x3b28e0['enabled']){return _[_0x6a48('0x2f')](_0x13a727,function(_0x5da4ba){if(_0x5da4ba[_0x6a48('0x5d')]===0x709){_0x5da4ba[_0x6a48('0x6a')]=_0x2fcaa5;}return _0x5da4ba;});}else{var _0x2600d9={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2fcaa5};var _0x189905=_[_0x6a48('0x2f')](_0x13a727);_0x189905[_0x6a48('0x63')](_0x2600d9);return _0x189905;}});}else{return;}})[_0x6a48('0x47')](function(_0x590adc){if(_0x590adc)_0x13a727=_0x590adc;return _[_0x6a48('0x42')](_0x13a727,[_0x6a48('0x67'),0x1]);})[_0x6a48('0x47')](respondWithResult(_0x5e9622,null))['catch'](handleError(_0x5e9622,null));};function hasDefaultDashboard(_0x11f924){var _0x2bacce=[0x65];return new BPromise(function(_0x2ede03,_0x1b048f){try{if(_0x11f924[_0x6a48('0x5b')]){_0x2ede03(_0x2bacce);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x11f924['id']},'raw':!![]})[_0x6a48('0x47')](function(_0x5ba0db){_0x5ba0db?_0x2ede03(_0x2bacce):_0x2ede03();});}}catch(_0x8f2bda){_0x1b048f(_0x8f2bda);}});}function getCustomDashboards(_0x3cc28a){var _0x356c7a=[];return new BPromise(function(_0x455849,_0x354d98){try{if(_0x3cc28a['autoAssociation']){return db['Dashboard'][_0x6a48('0x59')]({'raw':!![]})['then'](function(_0x35ebb3){_0x35ebb3['forEach'](function(_0xa76bba){_0x356c7a[_0x6a48('0x63')](_0xa76bba['id']+0x1869f);});_0x455849(_0x356c7a);});}else{return db[_0x6a48('0x5c')][_0x6a48('0x59')]({'where':{'sectionId':_0x3cc28a['id']},'raw':!![]})['then'](function(_0x13a19f){_0x13a19f[_0x6a48('0x6b')](function(_0x16131a){_0x356c7a['push'](_0x16131a[_0x6a48('0x6c')]+0x1869f);});_0x455849(_0x356c7a);});}}catch(_0x432204){_0x354d98(_0x432204);}});}function getPlugins(_0x57042b){var _0x57268d=[];return new BPromise(function(_0x1f5b67,_0x9cce07){try{if(_0x57042b['autoAssociation']){return db['Plugin'][_0x6a48('0x59')]({'raw':!![]})['then'](function(_0x15b678){_0x15b678[_0x6a48('0x6b')](function(_0x3a5f9c){_0x57268d[_0x6a48('0x63')](_0x3a5f9c['id']+0x15b38);});_0x1f5b67(_0x57268d);});}else{return db[_0x6a48('0x5c')][_0x6a48('0x59')]({'where':{'sectionId':_0x57042b['id']},'raw':!![]})[_0x6a48('0x47')](function(_0x286f81){_0x286f81[_0x6a48('0x6b')](function(_0x4e9211){_0x57268d['push'](_0x4e9211[_0x6a48('0x6c')]+0x15b38);});_0x1f5b67(_0x57268d);});}}catch(_0x49d4db){_0x9cce07(_0x49d4db);}});}exports[_0x6a48('0x6d')]=function(_0x23cedd,_0x3b148e){return db[_0x6a48('0x30')][_0x6a48('0x4b')]({'where':{'id':_0x23cedd[_0x6a48('0x4f')]['id']}})[_0x6a48('0x47')](handleEntityNotFound(_0x3b148e,null))[_0x6a48('0x47')](function(_0x59a53f){if(_0x59a53f){return db[_0x6a48('0x55')][_0x6a48('0x56')](function(_0xa6a261){return db[_0x6a48('0x58')]['findAll']({'where':{'userProfileId':_0x23cedd[_0x6a48('0x4f')]['id']},'attributes':['id'],'raw':!![]})[_0x6a48('0x47')](function(_0x829ab0){if(_0x829ab0){return db[_0x6a48('0x58')][_0x6a48('0x60')]({'where':{'userProfileId':_0x23cedd['params']['id'],'id':_[_0x6a48('0x2f')](_0x829ab0,function(_0x24a2ae){return _0x24a2ae['id'];})},'transaction':_0xa6a261});}})['then'](function(_0x369ed2){var _0x1f08c8=_[_0x6a48('0x2f')](_0x23cedd[_0x6a48('0x4d')],function(_0x26c72d){_0x26c72d[_0x6a48('0x5e')]=_0x23cedd[_0x6a48('0x4f')]['id'];return _0x26c72d;});return db['UserProfileSection'][_0x6a48('0x6e')](_0x1f08c8,{'raw':!![],'transaction':_0xa6a261});})[_0x6a48('0x47')](function(_0x42000e){var _0x1211d3=_['filter'](_[_0x6a48('0x2f')](_0x42000e,function(_0x2e1a2b){return _0x2e1a2b[_0x6a48('0x57')]({'plain':!![]});}),{'includeAll':![]});if(_0x1211d3){return db[_0x6a48('0x58')]['findAll']({'where':{'userProfileId':_0x23cedd['params']['id'],'sectionId':_[_0x6a48('0x2f')](_0x1211d3,function(_0x2a731d){return _0x2a731d[_0x6a48('0x5d')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x5655bf){var _0x1d8b49=_[_0x6a48('0x2f')](_0x23cedd['body'],function(_0x330a5d){_0x330a5d['userProfileId']=_0x23cedd[_0x6a48('0x4f')]['id'];return _0x330a5d;});return db[_0x6a48('0x5c')][_0x6a48('0x6e')](_0x1d8b49,{'raw':!![],'transaction':_0xa6a261});});}})['catch'](handleError(_0x3b148e,null));});}})[_0x6a48('0x47')](function(_0x57f0b6){var _0x5b0d79=_[_0x6a48('0x2f')](_0x57f0b6,function(_0x4c0e9d){return _0x4c0e9d[_0x6a48('0x57')]({'plain':!![]});});})[_0x6a48('0x47')](respondWithResult(_0x3b148e,null))[_0x6a48('0x49')](handleError(_0x3b148e,null));};exports[_0x6a48('0x6f')]=function(_0x352c48,_0x731f1f,_0x237826){return db[_0x6a48('0x30')]['find']({'where':{'id':_0x352c48['params']['id']}})[_0x6a48('0x47')](handleEntityNotFound(_0x731f1f,null))[_0x6a48('0x47')](function(_0x20e901){if(_0x20e901){return _0x20e901['removeResources'](_0x352c48[_0x6a48('0x36')][_0x6a48('0x65')]);}})[_0x6a48('0x47')](respondWithStatusCode(_0x731f1f,null))[_0x6a48('0x49')](handleError(_0x731f1f,null));};exports['getResources']=function(_0x48143d,_0x1cb7d){var _0x5c8e3a={};if(!_0x48143d[_0x6a48('0x36')][_0x6a48('0x70')])throw new Error(_0x6a48('0x71'));if(!_0x48143d[_0x6a48('0x36')][_0x6a48('0x3c')]('nolimit')){_0x5c8e3a[_0x6a48('0x28')]=qs[_0x6a48('0x28')](_0x48143d[_0x6a48('0x36')][_0x6a48('0x28')]);_0x5c8e3a['offset']=qs[_0x6a48('0x25')](_0x48143d[_0x6a48('0x36')][_0x6a48('0x25')]);}return db[_0x6a48('0x30')]['find']({'where':{'id':_0x48143d[_0x6a48('0x4f')]['id']}})[_0x6a48('0x47')](function(_0x114e35){if(!_0x114e35)throw new Error(_0x6a48('0x72')+_0x48143d[_0x6a48('0x4f')]['id']);return db['UserProfile'][_0x6a48('0x73')](_0x48143d);})['then'](respondWithFilteredResult(_0x1cb7d,_0x5c8e3a))['catch'](handleError(_0x1cb7d,null));}; \ No newline at end of file +var _0x04d5=['bulkCreate','removeResources','section','Missing\x20section\x20parameter','getResources','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','sendStatus','stack','name','send','index','map','UserProfile','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','includeAll','include','findAll','rows','options','find','catch','body','get','omit','createdAt','updatedAt','crudPermissions','transaction','create','UserProfileSection','params','each','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','sequelize','sectionId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','resourceId','forEach','addResources'];(function(_0x367798,_0x2c333f){var _0x48d963=function(_0x42f86b){while(--_0x42f86b){_0x367798['push'](_0x367798['shift']());}};_0x48d963(++_0x2c333f);}(_0x04d5,0xe1));var _0x504d=function(_0x564f0f,_0x2c9552){_0x564f0f=_0x564f0f-0x0;var _0x53e007=_0x04d5[_0x564f0f];return _0x53e007;};'use strict';var emlformat=require(_0x504d('0x0'));var rimraf=require(_0x504d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x504d('0x2'));var rp=require(_0x504d('0x3'));var moment=require(_0x504d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x504d('0x5'));var util=require(_0x504d('0x6'));var path=require(_0x504d('0x7'));var sox=require(_0x504d('0x8'));var csv=require(_0x504d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x504d('0xa'));var _=require(_0x504d('0xb'));var squel=require(_0x504d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x504d('0xd'));var toCsv=require(_0x504d('0x9'));var querystring=require(_0x504d('0xe'));var Papa=require('papaparse');var Redis=require(_0x504d('0xf'));var authService=require(_0x504d('0x10'));var qs=require(_0x504d('0x11'));var as=require(_0x504d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x504d('0x13'))(_0x504d('0x14'));var utils=require(_0x504d('0x15'));var config=require(_0x504d('0x16'));var licenseUtil=require(_0x504d('0x17'));var db=require(_0x504d('0x18'))['db'];config[_0x504d('0x19')]=_['defaults'](config['redis'],{'host':_0x504d('0x1a'),'port':0x18eb});var socket=require(_0x504d('0x1b'))(new Redis(config[_0x504d('0x19')]));require(_0x504d('0x1c'))[_0x504d('0x1d')](socket);function respondWithStatusCode(_0x3954ac,_0x5de52b){_0x5de52b=_0x5de52b||0xcc;return function(_0x2df33e){if(_0x2df33e){return _0x3954ac['sendStatus'](_0x5de52b);}return _0x3954ac[_0x504d('0x1e')](_0x5de52b)[_0x504d('0x1f')]();};}function respondWithResult(_0x529f96,_0x4099b8){_0x4099b8=_0x4099b8||0xc8;return function(_0x6f7c30){if(_0x6f7c30){return _0x529f96[_0x504d('0x1e')](_0x4099b8)[_0x504d('0x20')](_0x6f7c30);}};}function respondWithFilteredResult(_0x2a7b5b,_0x538a48){return function(_0x150cc7){if(_0x150cc7){var _0x4e11a0=typeof _0x538a48[_0x504d('0x21')]===_0x504d('0x22')&&typeof _0x538a48[_0x504d('0x23')]==='undefined';var _0x11c073=_0x150cc7[_0x504d('0x24')];var _0x19effc=_0x4e11a0?0x0:_0x538a48[_0x504d('0x21')];var _0x41771e=_0x4e11a0?_0x150cc7['count']:_0x538a48['offset']+_0x538a48[_0x504d('0x23')];var _0x4d4852;if(_0x41771e>=_0x11c073){_0x41771e=_0x11c073;_0x4d4852=0xc8;}else{_0x4d4852=0xce;}_0x2a7b5b[_0x504d('0x1e')](_0x4d4852);return _0x2a7b5b[_0x504d('0x25')]('Content-Range',_0x19effc+'-'+_0x41771e+'/'+_0x11c073)[_0x504d('0x20')](_0x150cc7);}return null;};}function patchUpdates(_0x59f2d0){return function(_0x29388b){try{jsonpatch[_0x504d('0x26')](_0x29388b,_0x59f2d0,!![]);}catch(_0xbef6c1){return BPromise['reject'](_0xbef6c1);}return _0x29388b[_0x504d('0x27')]();};}function saveUpdates(_0x4d29ca,_0x53d67e){return function(_0x218d20){if(_0x218d20){return _0x218d20[_0x504d('0x28')](_0x4d29ca)['then'](function(_0x5bbef7){return _0x5bbef7;});}return null;};}function removeEntity(_0x12c710,_0x251284){return function(_0x54bed7){if(_0x54bed7){return _0x54bed7[_0x504d('0x29')]()[_0x504d('0x2a')](function(){_0x12c710[_0x504d('0x1e')](0xcc)[_0x504d('0x1f')]();});}};}function handleEntityNotFound(_0x358742,_0x5c7177){return function(_0x3d4300){if(!_0x3d4300){_0x358742[_0x504d('0x2b')](0x194);}return _0x3d4300;};}function handleError(_0x45382a,_0x34c010){_0x34c010=_0x34c010||0x1f4;return function(_0x4a43c7){logger['error'](_0x4a43c7[_0x504d('0x2c')]);if(_0x4a43c7['name']){delete _0x4a43c7[_0x504d('0x2d')];}_0x45382a['status'](_0x34c010)[_0x504d('0x2e')](_0x4a43c7);};}exports[_0x504d('0x2f')]=function(_0x385e45,_0x4fef5b){var _0x2e564c={},_0x4b0575={},_0x506a22={'count':0x0,'rows':[]};var _0x156472=_[_0x504d('0x30')](db[_0x504d('0x31')]['rawAttributes'],function(_0x2a98a9){return{'name':_0x2a98a9[_0x504d('0x32')],'type':_0x2a98a9['type']['key']};});_0x4b0575[_0x504d('0x33')]=_[_0x504d('0x30')](_0x156472,_0x504d('0x2d'));_0x4b0575['query']=_[_0x504d('0x34')](_0x385e45[_0x504d('0x35')]);_0x4b0575[_0x504d('0x36')]=_[_0x504d('0x37')](_0x4b0575[_0x504d('0x33')],_0x4b0575[_0x504d('0x35')]);_0x2e564c[_0x504d('0x38')]=_[_0x504d('0x37')](_0x4b0575[_0x504d('0x33')],qs['fields'](_0x385e45['query'][_0x504d('0x39')]));_0x2e564c['attributes']=_0x2e564c[_0x504d('0x38')][_0x504d('0x3a')]?_0x2e564c[_0x504d('0x38')]:_0x4b0575[_0x504d('0x33')];if(!_0x385e45[_0x504d('0x35')][_0x504d('0x3b')](_0x504d('0x3c'))){_0x2e564c[_0x504d('0x23')]=qs[_0x504d('0x23')](_0x385e45[_0x504d('0x35')][_0x504d('0x23')]);_0x2e564c['offset']=qs[_0x504d('0x21')](_0x385e45['query']['offset']);}_0x2e564c['order']=qs[_0x504d('0x3d')](_0x385e45[_0x504d('0x35')]['sort']);_0x2e564c[_0x504d('0x3e')]=qs['filters'](_[_0x504d('0x3f')](_0x385e45[_0x504d('0x35')],_0x4b0575['filters']),_0x156472);if(_0x385e45[_0x504d('0x35')][_0x504d('0x40')]){_0x2e564c[_0x504d('0x3e')]=_['merge'](_0x2e564c['where'],{'$or':_[_0x504d('0x30')](_0x156472,function(_0x3b853c){if(_0x3b853c[_0x504d('0x41')]!=='VIRTUAL'){var _0x1a6d51={};_0x1a6d51[_0x3b853c[_0x504d('0x2d')]]={'$like':'%'+_0x385e45[_0x504d('0x35')]['filter']+'%'};return _0x1a6d51;}})});}_0x2e564c=_[_0x504d('0x42')]({},_0x2e564c,_0x385e45['options']);var _0x46614f={'where':_0x2e564c[_0x504d('0x3e')]};return db[_0x504d('0x31')]['count'](_0x46614f)[_0x504d('0x2a')](function(_0x6d4cc2){_0x506a22[_0x504d('0x24')]=_0x6d4cc2;if(_0x385e45[_0x504d('0x35')][_0x504d('0x43')]){_0x2e564c[_0x504d('0x44')]=[{'all':!![]}];}return db[_0x504d('0x31')][_0x504d('0x45')](_0x2e564c);})[_0x504d('0x2a')](function(_0x5164ee){_0x506a22[_0x504d('0x46')]=_0x5164ee;return _0x506a22;})[_0x504d('0x2a')](respondWithFilteredResult(_0x4fef5b,_0x2e564c))['catch'](handleError(_0x4fef5b,null));};exports['show']=function(_0x1b6d35,_0x3d936e){var _0x56436f={'raw':![],'where':{'id':_0x1b6d35['params']['id']}},_0x58aca5={};_0x58aca5[_0x504d('0x33')]=_[_0x504d('0x34')](db['UserProfile']['rawAttributes']);_0x58aca5['query']=_[_0x504d('0x34')](_0x1b6d35['query']);_0x58aca5[_0x504d('0x36')]=_[_0x504d('0x37')](_0x58aca5[_0x504d('0x33')],_0x58aca5[_0x504d('0x35')]);_0x56436f['attributes']=_[_0x504d('0x37')](_0x58aca5['model'],qs[_0x504d('0x39')](_0x1b6d35[_0x504d('0x35')][_0x504d('0x39')]));_0x56436f['attributes']=_0x56436f[_0x504d('0x38')][_0x504d('0x3a')]?_0x56436f[_0x504d('0x38')]:_0x58aca5[_0x504d('0x33')];if(_0x1b6d35[_0x504d('0x35')][_0x504d('0x43')]){_0x56436f[_0x504d('0x44')]=[{'all':!![]}];}_0x56436f=_[_0x504d('0x42')]({},_0x56436f,_0x1b6d35[_0x504d('0x47')]);return db[_0x504d('0x31')][_0x504d('0x48')](_0x56436f)[_0x504d('0x2a')](handleEntityNotFound(_0x3d936e,null))[_0x504d('0x2a')](respondWithResult(_0x3d936e,null))[_0x504d('0x49')](handleError(_0x3d936e,null));};exports['create']=function(_0x43ae6f,_0x1b6f67){return db[_0x504d('0x31')]['create'](_0x43ae6f[_0x504d('0x4a')],{})[_0x504d('0x2a')](respondWithResult(_0x1b6f67,0xc9))['catch'](handleError(_0x1b6f67,null));};exports['clone']=function(_0x3c5e1a,_0x3fd82c){var _0x9aa6b7={'where':{'id':_0x3c5e1a['params']['id']}},_0x3c095b={};_0x3c095b[_0x504d('0x33')]=_['keys'](db['UserProfile']['rawAttributes']);_0x9aa6b7[_0x504d('0x38')]=_[_0x504d('0x37')](_0x3c095b[_0x504d('0x33')],qs[_0x504d('0x39')](_0x3c5e1a[_0x504d('0x35')][_0x504d('0x39')]));_0x9aa6b7[_0x504d('0x38')]=_0x9aa6b7['attributes'][_0x504d('0x3a')]?_0x9aa6b7['attributes']:_0x3c095b['model'];if(_0x3c5e1a[_0x504d('0x35')][_0x504d('0x43')]){_0x9aa6b7[_0x504d('0x44')]=[{'all':!![]}];}_0x9aa6b7=_[_0x504d('0x42')]({},_0x9aa6b7,_0x3c5e1a[_0x504d('0x47')]);return db[_0x504d('0x31')]['find'](_0x9aa6b7)[_0x504d('0x2a')](handleEntityNotFound(_0x3fd82c,null))[_0x504d('0x2a')](function(_0x3f6bcf){if(_0x3f6bcf){var _0x15e4c5=_0x3f6bcf[_0x504d('0x4b')]({'plain':!![]});_0x15e4c5=qs[_0x504d('0x4c')](_0x15e4c5,['id',_0x504d('0x4d'),_0x504d('0x4e'),_0x504d('0x4f')]);_0x3c5e1a['body']=_[_0x504d('0x4c')](_0x3c5e1a[_0x504d('0x4a')],['id','createdAt',_0x504d('0x4e')]);return db['sequelize'][_0x504d('0x50')](function(_0x147178){return db['UserProfile'][_0x504d('0x51')](_[_0x504d('0x42')](_0x15e4c5,_0x3c5e1a[_0x504d('0x4a')]),{'include':_0x3c5e1a[_0x504d('0x35')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x147178})[_0x504d('0x2a')](function(_0x322682){var _0x14e964=_0x322682['get']({'plain':!![]});return db[_0x504d('0x52')][_0x504d('0x45')]({'where':{'userProfileId':_0x3c5e1a[_0x504d('0x53')]['id']},'raw':!![]})[_0x504d('0x2a')](function(_0x29c5b8){if(_0x29c5b8){return BPromise[_0x504d('0x54')](_0x29c5b8,function(_0x88be22){return new BPromise(function(_0x40786e,_0x4becf9){if(_0x88be22[_0x504d('0x55')]===null||_0x88be22[_0x504d('0x55')]===0x1)_0x40786e(null);return db[_0x504d('0x56')]['findAll']({'where':{'sectionId':_0x88be22['id']},'raw':!![]})[_0x504d('0x2a')](function(_0x5307bb){var _0x911bf6=_[_0x504d('0x30')](_0x5307bb,function(_0x45a9fd){return qs[_0x504d('0x4c')](_0x45a9fd,['id',_0x504d('0x4d'),_0x504d('0x4e'),'sectionId']);});_0x40786e(_0x911bf6);})[_0x504d('0x49')](function(_0x5856df){_0x4becf9(_0x5856df);});})[_0x504d('0x2a')](function(_0x265e00){var _0x2e33b8=qs[_0x504d('0x4c')](_0x88be22,['id',_0x504d('0x4d'),_0x504d('0x4e')]);_0x2e33b8[_0x504d('0x57')]=_0x14e964['id'];if(_0x265e00)_0x2e33b8['Resources']=_0x265e00;return _0x2e33b8;})['then'](function(_0x159263){return db['UserProfileSection'][_0x504d('0x51')](_0x159263,{'include':[{'model':db[_0x504d('0x56')],'as':_0x504d('0x58')}],'raw':!![],'transaction':_0x147178});});})[_0x504d('0x2a')](function(){return _0x14e964;});}});});});}})[_0x504d('0x2a')](respondWithResult(_0x3fd82c,0xc9))['catch'](handleError(_0x3fd82c,null));};exports['update']=function(_0x4d9d4e,_0x1a3f1c){if(_0x4d9d4e['body']['id']){delete _0x4d9d4e[_0x504d('0x4a')]['id'];}return db[_0x504d('0x31')][_0x504d('0x48')]({'where':{'id':_0x4d9d4e[_0x504d('0x53')]['id']}})[_0x504d('0x2a')](handleEntityNotFound(_0x1a3f1c,null))[_0x504d('0x2a')](saveUpdates(_0x4d9d4e[_0x504d('0x4a')],null))['then'](respondWithResult(_0x1a3f1c,null))[_0x504d('0x49')](handleError(_0x1a3f1c,null));};exports[_0x504d('0x29')]=function(_0x3517d3,_0x13f1ac){return db[_0x504d('0x31')][_0x504d('0x48')]({'where':{'id':_0x3517d3[_0x504d('0x53')]['id']}})[_0x504d('0x2a')](handleEntityNotFound(_0x13f1ac,null))['then'](removeEntity(_0x13f1ac,null))[_0x504d('0x49')](handleError(_0x13f1ac,null));};exports[_0x504d('0x59')]=function(_0x432b4f,_0x210477){return db[_0x504d('0x31')][_0x504d('0x59')]()[_0x504d('0x2a')](respondWithResult(_0x210477,null))[_0x504d('0x49')](handleError(_0x210477,null));};exports[_0x504d('0x5a')]=function(_0x6ab9af,_0x15d84c){var _0x27b4cf=_0x6ab9af[_0x504d('0x4a')];return db[_0x504d('0x31')][_0x504d('0x48')]({'where':{'id':_0x6ab9af[_0x504d('0x53')]['id']}})['then'](handleEntityNotFound(_0x15d84c,null))['then'](function(_0x18abab){if(_0x18abab){return db[_0x504d('0x5b')][_0x504d('0x50')](function(_0x2d6d9f){return db[_0x504d('0x52')][_0x504d('0x29')]({'where':{'userProfileId':_0x6ab9af[_0x504d('0x53')]['id'],'sectionId':_[_0x504d('0x30')](_0x27b4cf,function(_0x5f37a2){return _0x5f37a2[_0x504d('0x5c')];})},'transaction':_0x2d6d9f})['then'](function(){var _0x4cccca=_[_0x504d('0x30')](_0x27b4cf,function(_0x45cde8){_0x45cde8[_0x504d('0x57')]=_0x6ab9af[_0x504d('0x53')]['id'];return _0x45cde8;});var _0x4875a6=[];return BPromise[_0x504d('0x54')](_0x4cccca,function(_0x1fe567){return db[_0x504d('0x52')][_0x504d('0x51')](_0x1fe567,{'include':[{'model':db[_0x504d('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x2d6d9f})[_0x504d('0x2a')](function(_0x1e7a72){_0x4875a6[_0x504d('0x5d')](_0x1e7a72['get']({'plain':!![]}));});})[_0x504d('0x2a')](function(){return _0x4875a6;});});});}})['then'](function(_0x14e508){return _0x14e508;})[_0x504d('0x2a')](respondWithResult(_0x15d84c,null))[_0x504d('0x49')](handleError(_0x15d84c,null));};exports[_0x504d('0x5e')]=function(_0x506570,_0x2d9068){var _0x31d28c;return db[_0x504d('0x31')][_0x504d('0x48')]({'where':{'id':_0x506570['params']['id']},'attributes':['id','name']})[_0x504d('0x2a')](handleEntityNotFound(_0x2d9068,null))[_0x504d('0x2a')](function(_0x58baa0){if(_0x58baa0){_0x31d28c=_0x58baa0;return db['UserProfileSection'][_0x504d('0x29')]({'where':{'userProfileId':_0x506570[_0x504d('0x53')]['id'],'sectionId':_0x506570[_0x504d('0x35')][_0x504d('0x5f')]}});}})['then'](function(){return _0x31d28c;})[_0x504d('0x2a')](respondWithStatusCode(_0x2d9068,null))['catch'](handleError(_0x2d9068,null));};exports[_0x504d('0x60')]=function(_0x29b50b,_0x169e89){var _0x5596d8=[];var _0x102cc9=[];return db['UserProfileSection'][_0x504d('0x45')]({'where':{'userProfileId':_0x29b50b[_0x504d('0x53')]['id']},'raw':!![]})[_0x504d('0x2a')](function(_0x38b849){_0x5596d8=_[_0x504d('0x40')](_0x38b849,function(_0x5f4b89){return _0x5f4b89[_0x504d('0x61')]===0x1||_[_0x504d('0x62')]([0x3eb,0x709],_0x5f4b89['sectionId']);});if(!_[_0x504d('0x63')](_0x5596d8)){return _['map'](_0x5596d8,function(_0x415929){return _0x415929[_0x504d('0x5c')];});}else{return;}})[_0x504d('0x2a')](function(_0x395f23){if(_0x395f23)_0x102cc9=_0x395f23;if(_['includes'](_0x102cc9,0x64)){var _0x53b41e=_[_0x504d('0x48')](_0x5596d8,{'sectionId':0x64});return hasDefaultDashboard(_0x53b41e)[_0x504d('0x2a')](function(_0x49b0f9){return _[_0x504d('0x30')](_0x5596d8,function(_0x88f611){if(_0x88f611[_0x504d('0x5c')]===0x64){_0x88f611[_0x504d('0x64')]=_0x49b0f9;}return _0x88f611;});});}else{return;}})[_0x504d('0x2a')](function(_0x3d73fb){if(_0x3d73fb)_0x5596d8=_0x3d73fb;if(_[_0x504d('0x62')](_0x102cc9,0x3eb)){var _0xaea174=_[_0x504d('0x48')](_0x5596d8,{'sectionId':0x3eb});return getCustomDashboards(_0xaea174)[_0x504d('0x2a')](function(_0x50340f){return _[_0x504d('0x30')](_0x5596d8,function(_0x438261){if(_0xaea174[_0x504d('0x61')]){if(_0x438261[_0x504d('0x5c')]===0x3eb){_0x438261[_0x504d('0x64')]=_0x50340f;}}else{if(_0x438261['sectionId']===0x64){_0x438261['subsections']=_0x50340f;}}return _0x438261;});});}else{return;}})[_0x504d('0x2a')](function(_0x11ac47){if(_0x11ac47)_0x5596d8=_0x11ac47;if(_['includes'](_0x102cc9,0x709)){var _0x13a4e1=_[_0x504d('0x48')](_0x5596d8,{'sectionId':0x709});return getPlugins(_0x13a4e1)[_0x504d('0x2a')](function(_0x14f750){if(_0x13a4e1[_0x504d('0x61')]){return _[_0x504d('0x30')](_0x5596d8,function(_0x591fa2){if(_0x591fa2['sectionId']===0x709){_0x591fa2[_0x504d('0x64')]=_0x14f750;}return _0x591fa2;});}else{var _0x51ad6b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x14f750};var _0xf32e10=_[_0x504d('0x30')](_0x5596d8);_0xf32e10[_0x504d('0x5d')](_0x51ad6b);return _0xf32e10;}});}else{return;}})[_0x504d('0x2a')](function(_0x237b9b){if(_0x237b9b)_0x5596d8=_0x237b9b;return _[_0x504d('0x40')](_0x5596d8,['enabled',0x1]);})[_0x504d('0x2a')](respondWithResult(_0x169e89,null))[_0x504d('0x49')](handleError(_0x169e89,null));};function hasDefaultDashboard(_0xd343c5){var _0x203246=[0x65];return new BPromise(function(_0x554a56,_0x4ba37b){try{if(_0xd343c5[_0x504d('0x55')]){_0x554a56(_0x203246);}else{return db[_0x504d('0x56')][_0x504d('0x65')]({'where':{'sectionId':_0xd343c5['id']},'raw':!![]})[_0x504d('0x2a')](function(_0x2e3a41){_0x2e3a41?_0x554a56(_0x203246):_0x554a56();});}}catch(_0x26ba9b){_0x4ba37b(_0x26ba9b);}});}function getCustomDashboards(_0x496ec9){var _0x3c4031=[];return new BPromise(function(_0xd1aa9c,_0x581869){try{if(_0x496ec9[_0x504d('0x55')]){return db['Dashboard'][_0x504d('0x45')]({'raw':!![]})['then'](function(_0x51c051){_0x51c051['forEach'](function(_0x34e1d6){_0x3c4031['push'](_0x34e1d6['id']+0x1869f);});_0xd1aa9c(_0x3c4031);});}else{return db[_0x504d('0x56')][_0x504d('0x45')]({'where':{'sectionId':_0x496ec9['id']},'raw':!![]})[_0x504d('0x2a')](function(_0x4d05cd){_0x4d05cd['forEach'](function(_0x1c39b8){_0x3c4031[_0x504d('0x5d')](_0x1c39b8[_0x504d('0x66')]+0x1869f);});_0xd1aa9c(_0x3c4031);});}}catch(_0x165ae7){_0x581869(_0x165ae7);}});}function getPlugins(_0x54c9b6){var _0x505eb6=[];return new BPromise(function(_0x13083f,_0x5181a8){try{if(_0x54c9b6['autoAssociation']){return db['Plugin'][_0x504d('0x45')]({'raw':!![]})[_0x504d('0x2a')](function(_0x2fc9f9){_0x2fc9f9[_0x504d('0x67')](function(_0xaf9ab7){_0x505eb6[_0x504d('0x5d')](_0xaf9ab7['id']+0x15b38);});_0x13083f(_0x505eb6);});}else{return db['UserProfileResource'][_0x504d('0x45')]({'where':{'sectionId':_0x54c9b6['id']},'raw':!![]})['then'](function(_0x548202){_0x548202[_0x504d('0x67')](function(_0x5dc693){_0x505eb6[_0x504d('0x5d')](_0x5dc693['resourceId']+0x15b38);});_0x13083f(_0x505eb6);});}}catch(_0x40af83){_0x5181a8(_0x40af83);}});}exports[_0x504d('0x68')]=function(_0x4d2904,_0x36fb62){return db[_0x504d('0x31')][_0x504d('0x48')]({'where':{'id':_0x4d2904['params']['id']}})[_0x504d('0x2a')](handleEntityNotFound(_0x36fb62,null))[_0x504d('0x2a')](function(_0x14257b){if(_0x14257b){return db[_0x504d('0x5b')][_0x504d('0x50')](function(_0x2429f9){return db[_0x504d('0x52')]['findAll']({'where':{'userProfileId':_0x4d2904[_0x504d('0x53')]['id']},'attributes':['id'],'raw':!![]})[_0x504d('0x2a')](function(_0x9771a0){if(_0x9771a0){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x4d2904[_0x504d('0x53')]['id'],'id':_[_0x504d('0x30')](_0x9771a0,function(_0x5e6b3a){return _0x5e6b3a['id'];})},'transaction':_0x2429f9});}})[_0x504d('0x2a')](function(_0x4d256a){var _0x512089=_[_0x504d('0x30')](_0x4d2904[_0x504d('0x4a')],function(_0x4352f5){_0x4352f5[_0x504d('0x57')]=_0x4d2904[_0x504d('0x53')]['id'];return _0x4352f5;});return db['UserProfileSection'][_0x504d('0x69')](_0x512089,{'raw':!![],'transaction':_0x2429f9});})[_0x504d('0x2a')](function(_0x8603fb){var _0x485f4f=_['filter'](_[_0x504d('0x30')](_0x8603fb,function(_0x5d1e80){return _0x5d1e80[_0x504d('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x485f4f){return db[_0x504d('0x52')][_0x504d('0x45')]({'where':{'userProfileId':_0x4d2904[_0x504d('0x53')]['id'],'sectionId':_[_0x504d('0x30')](_0x485f4f,function(_0x1b29b2){return _0x1b29b2['sectionId'];})},'attributes':['id',_0x504d('0x5c')],'raw':!![]})[_0x504d('0x2a')](function(_0x1b0d17){var _0x423114=_[_0x504d('0x30')](_0x4d2904[_0x504d('0x4a')],function(_0xeab47b){_0xeab47b[_0x504d('0x57')]=_0x4d2904['params']['id'];return _0xeab47b;});return db['UserProfileResource']['bulkCreate'](_0x423114,{'raw':!![],'transaction':_0x2429f9});});}})[_0x504d('0x49')](handleError(_0x36fb62,null));});}})[_0x504d('0x2a')](function(_0x588e60){var _0x4a30b6=_[_0x504d('0x30')](_0x588e60,function(_0xafa6c1){return _0xafa6c1[_0x504d('0x4b')]({'plain':!![]});});})[_0x504d('0x2a')](respondWithResult(_0x36fb62,null))[_0x504d('0x49')](handleError(_0x36fb62,null));};exports[_0x504d('0x6a')]=function(_0x40509d,_0x2f0d09,_0x4676fd){return db['UserProfile']['find']({'where':{'id':_0x40509d[_0x504d('0x53')]['id']}})[_0x504d('0x2a')](handleEntityNotFound(_0x2f0d09,null))['then'](function(_0x315914){if(_0x315914){return _0x315914[_0x504d('0x6a')](_0x40509d[_0x504d('0x35')][_0x504d('0x5f')]);}})[_0x504d('0x2a')](respondWithStatusCode(_0x2f0d09,null))['catch'](handleError(_0x2f0d09,null));};exports['getResources']=function(_0x588e8a,_0x4cbc94){var _0x17b081={};if(!_0x588e8a['query'][_0x504d('0x6b')])throw new Error(_0x504d('0x6c'));if(!_0x588e8a[_0x504d('0x35')][_0x504d('0x3b')](_0x504d('0x3c'))){_0x17b081['limit']=qs[_0x504d('0x23')](_0x588e8a[_0x504d('0x35')][_0x504d('0x23')]);_0x17b081[_0x504d('0x21')]=qs[_0x504d('0x21')](_0x588e8a[_0x504d('0x35')]['offset']);}return db[_0x504d('0x31')]['find']({'where':{'id':_0x588e8a[_0x504d('0x53')]['id']}})[_0x504d('0x2a')](function(_0x4a6c88){if(!_0x4a6c88)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x588e8a[_0x504d('0x53')]['id']);return db[_0x504d('0x31')][_0x504d('0x6d')](_0x588e8a);})[_0x504d('0x2a')](respondWithFilteredResult(_0x4cbc94,_0x17b081))['catch'](handleError(_0x4cbc94,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index e6d4c00..c1e75d8 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 _0x96f2=['events','UserProfile','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x23e776,_0x453cf4){var _0x52285a=function(_0x3cf38d){while(--_0x3cf38d){_0x23e776['push'](_0x23e776['shift']());}};_0x52285a(++_0x453cf4);}(_0x96f2,0xb0));var _0x296f=function(_0x6ef892,_0x57e09d){_0x6ef892=_0x6ef892-0x0;var _0x3cf599=_0x96f2[_0x6ef892];return _0x3cf599;};'use strict';var EventEmitter=require(_0x296f('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x296f('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x296f('0x2')](0x0);var events={'afterCreate':_0x296f('0x3'),'afterUpdate':'update','afterDestroy':_0x296f('0x4')};function emitEvent(_0x333b22){return function(_0x334a4e,_0x57f54e,_0x5fae7){UserProfileEvents[_0x296f('0x5')](_0x333b22+':'+_0x334a4e['id'],_0x334a4e);UserProfileEvents['emit'](_0x333b22,_0x334a4e);_0x5fae7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x296f('0x6')](e,emitEvent(event));}}module[_0x296f('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x2581=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x3ee1fe,_0x59f2a1){var _0x1ae57a=function(_0x1ef0c4){while(--_0x1ef0c4){_0x3ee1fe['push'](_0x3ee1fe['shift']());}};_0x1ae57a(++_0x59f2a1);}(_0x2581,0xcb));var _0x1258=function(_0x6765c2,_0x1c4f41){_0x6765c2=_0x6765c2-0x0;var _0x3d1105=_0x2581[_0x6765c2];return _0x3d1105;};'use strict';var EventEmitter=require(_0x1258('0x0'));var UserProfile=require(_0x1258('0x1'))['db'][_0x1258('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1258('0x3')](0x0);var events={'afterCreate':_0x1258('0x4'),'afterUpdate':'update','afterDestroy':_0x1258('0x5')};function emitEvent(_0x1235e5){return function(_0x339891,_0xb54644,_0x3ad6b0){UserProfileEvents[_0x1258('0x6')](_0x1235e5+':'+_0x339891['id'],_0x339891);UserProfileEvents[_0x1258('0x6')](_0x1235e5,_0x339891);_0x3ad6b0(null);};}for(var e in events){if(events[_0x1258('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x1258('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 045a7d6..d824eab 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 _0x0424=['squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','projectName','projects','JscriptyProject','contacts','CmContact','parentSections','ListId','lists','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelAccount','smsaccounts','SmsAccount','WhatsappQueue','WhatsappAccount','teams','Team','agents','Users','admin','user','zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','dispositions','customdashboards','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Template','triggers','Trigger','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','SELECT','select','InteractionId','from','user_has_','_interactions','where','sequelize','OpenTabs','UserProfile','user_profiles','query','Invalid\x20section\x20\x27','isEmpty','length','push','params','all','ignore','find','autoAssociation','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','includeAll','include','custom','CustomReports','count','Tag','Tags','tag','ThroughTags','color','rows','true','chat','dataValues','sms','fax','mail','openchannel','../../components/parsers/qs','squel','exports','models','filter','field','findAll','then','map','catch','value','model','associatedResources','name','resolve','UserProfileResource','resourceId'];(function(_0x284d53,_0x2a87bc){var _0x1b9e25=function(_0x2f87e5){while(--_0x2f87e5){_0x284d53['push'](_0x284d53['shift']());}};_0x1b9e25(++_0x2a87bc);}(_0x0424,0x159));var _0x4042=function(_0x21f7d4,_0x3fb9df){_0x21f7d4=_0x21f7d4-0x0;var _0x143fa7=_0x0424[_0x21f7d4];return _0x143fa7;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var qs=require(_0x4042('0x0'));var squel=require(_0x4042('0x1'));module[_0x4042('0x2')]=function(_0x292a62){var _0x53f080=_0x292a62[_0x4042('0x3')];function _0x519987(_0x491eae,_0x20d8df){return new Promise(function(_0x24fdfd,_0x472795){if(!_0x20d8df)return _0x24fdfd(null);var _0xc0fba0=_0x20d8df[_0x4042('0x4')]?{[_0x20d8df[_0x4042('0x4')][_0x4042('0x5')]]:_0x20d8df['filter']['value']}:undefined;return _0x53f080[_0x491eae][_0x4042('0x6')]({'where':_0xc0fba0,'raw':!![]})[_0x4042('0x7')](function(_0x103e4a){_0x20d8df['associatedResources']=_[_0x4042('0x8')](_0x103e4a,'id');_0x24fdfd(_0x20d8df);})[_0x4042('0x9')](function(_0x2376a4){_0x472795(_0x2376a4);});});}function _0x2cbc75(_0x1c2984,_0x424961){return new Promise(function(_0x380aa0,_0x3b5a73){var _0x4af3ba=_0x1c2984[_0x4042('0x4')]?{[_0x1c2984[_0x4042('0x4')]['field']]:_0x1c2984[_0x4042('0x4')][_0x4042('0xa')]}:undefined;return _0x53f080[_0x1c2984[_0x4042('0xb')]][_0x4042('0x6')]({'where':_0x4af3ba,'raw':!![]})[_0x4042('0x7')](function(_0x1ff3ca){_0x424961[_0x4042('0xc')]=_['map'](_0x1ff3ca,function(_0x1029cf){return _0x1029cf[_0x4042('0xd')];});_0x380aa0(_0x424961);})['catch'](function(_0x28087d){_0x3b5a73(_0x28087d);});});}function _0x3f99f8(_0x43dcb5,_0x1c3328,_0x31e765){if(!_0x1c3328)return Promise[_0x4042('0xe')](null);return new Promise(function(_0x62cb76,_0x10cb93){return _0x53f080[_0x4042('0xf')]['findAll']({'where':{'sectionId':_0x1c3328['id']},'raw':!![]})[_0x4042('0x7')](function(_0x4fe024){if(_0x43dcb5[_0x4042('0x5')]&&_0x43dcb5['field']!=='id'){_0x1c3328[_0x4042('0xc')]=_[_0x4042('0x8')](_0x4fe024,function(_0x212520){return _0x212520[_0x43dcb5[_0x4042('0x5')]];});}else{if(_0x31e765==='AnalyticExtractedReport'){_0x1c3328[_0x4042('0xc')]=_[_0x4042('0x8')](_0x4fe024,function(_0x14d36c){return{'id':_0x14d36c[_0x4042('0x10')],'type':_0x14d36c['type']};});}else{_0x1c3328[_0x4042('0xc')]=_[_0x4042('0x8')](_0x4fe024,function(_0xd6fe6c){return _0xd6fe6c[_0x4042('0x10')];});}}_0x62cb76(_0x1c3328);})[_0x4042('0x9')](function(_0x548093){_0x10cb93(_0x548093);});});}function _0x1f9d4a(_0x6d12a5,_0x519f2c){var _0x1daee8={'parentSections':[]};switch(_0x6d12a5['toLowerCase']()){case _0x4042('0x11'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x13');break;case'odbc':_0x1daee8[_0x4042('0x12')]=_0x4042('0x14');break;case _0x4042('0x15'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x16');_0x1daee8['parentSections']=[{'name':'SquareProjects','field':_0x4042('0xd'),'foreignKey':_0x4042('0x17')}];break;case _0x4042('0x18'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x19');break;case _0x4042('0x1a'):_0x1daee8['childModel']=_0x4042('0x1b');_0x1daee8[_0x4042('0x1c')]=[{'name':'Lists','field':'id','foreignKey':_0x4042('0x1d')}];break;case _0x4042('0x1e'):_0x1daee8[_0x4042('0x12')]='CmList';break;case'companies':_0x1daee8[_0x4042('0x12')]=_0x4042('0x1f');break;case'globalcustomfields':_0x1daee8[_0x4042('0x12')]=_0x4042('0x20');break;case _0x4042('0x21'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x22');break;case _0x4042('0x23'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x24');break;case _0x4042('0x25'):_0x1daee8['childModel']=_0x4042('0x26');break;case _0x4042('0x27'):_0x1daee8['childModel']=_0x4042('0x28');break;case _0x4042('0x29'):case'internalroutes':case _0x4042('0x2a'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x2b');break;case _0x4042('0x2c'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x2d');break;case _0x4042('0x2e'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x2f');break;case _0x4042('0x30'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x31');_0x1daee8[_0x4042('0x1c')]=[{'name':_0x4042('0x32'),'field':_0x4042('0xd'),'foreignKey':_0x4042('0x33'),'model':_0x4042('0x34'),'filter':{'field':_0x4042('0x35'),'value':[_0x4042('0x36')]}},{'name':_0x4042('0x37'),'field':_0x4042('0xd'),'foreignKey':'membername','model':_0x4042('0x34'),'filter':{'field':_0x4042('0x35'),'value':[_0x4042('0x38')]}},{'name':_0x4042('0x39'),'field':'name','foreignKey':_0x4042('0x3a'),'model':_0x4042('0x3b'),'filter':{'field':_0x4042('0x3c'),'value':[_0x4042('0x3d')]}},{'name':_0x4042('0x3e'),'field':_0x4042('0xd'),'foreignKey':_0x4042('0x3a'),'model':_0x4042('0x3b'),'filter':{'field':_0x4042('0x3c'),'value':[_0x4042('0x3f')]}}];break;case'musiconholds':_0x1daee8[_0x4042('0x12')]=_0x4042('0x40');break;case _0x4042('0x41'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x42');break;case _0x4042('0x43'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x44');break;case'ivrcampaigns':_0x1daee8['childModel']=_0x4042('0x45');break;case _0x4042('0x46'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x47');break;case _0x4042('0x48'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x49');break;case _0x4042('0x4a'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x4b');break;case _0x4042('0x4c'):_0x1daee8[_0x4042('0x12')]='OpenchannelQueue';break;case'openchannelaccounts':_0x1daee8[_0x4042('0x12')]=_0x4042('0x4d');break;case'smsqueues':_0x1daee8[_0x4042('0x12')]='SmsQueue';break;case _0x4042('0x4e'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x4f');break;case'whatsappqueues':_0x1daee8[_0x4042('0x12')]=_0x4042('0x50');break;case'whatsappaccounts':_0x1daee8[_0x4042('0x12')]=_0x4042('0x51');break;case _0x4042('0x52'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x53');break;case'voicequeues':case'queuecampaigns':_0x1daee8['childModel']=_0x4042('0x3b');if(_0x519f2c){_0x1daee8[_0x4042('0x1c')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case'users':case _0x4042('0x54'):case'telephones':_0x1daee8['childModel']=_0x4042('0x34');if(_0x519f2c){_0x1daee8[_0x4042('0x1c')]=[{'name':_0x4042('0x55'),'filter':{'field':_0x4042('0x35'),'value':[_0x4042('0x56'),_0x4042('0x57')]},'ignore':!![]},{'name':_0x4042('0x32')},{'name':_0x4042('0x37')}];}break;case _0x4042('0x58'):_0x1daee8['childModel']='ZendeskAccount';break;case'salesforceaccounts':_0x1daee8['childModel']=_0x4042('0x59');break;case _0x4042('0x5a'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x5b');break;case _0x4042('0x5c'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x5d');break;case _0x4042('0x5e'):_0x1daee8['childModel']=_0x4042('0x5f');break;case _0x4042('0x60'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x61');break;case _0x4042('0x62'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x34');break;case'cannedanswers':_0x1daee8['childModel']='CannedAnswer';break;case _0x4042('0x63'):_0x1daee8[_0x4042('0x12')]='Disposition';break;case _0x4042('0x64'):_0x1daee8[_0x4042('0x12')]='Dashboard';break;case'intervals':_0x1daee8[_0x4042('0x12')]=_0x4042('0x65');break;case _0x4042('0x66'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x67');break;case _0x4042('0x68'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x69');break;case _0x4042('0x6a'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x6b');break;case _0x4042('0x6c'):_0x1daee8[_0x4042('0x12')]='Tag';break;case'templates':_0x1daee8[_0x4042('0x12')]=_0x4042('0x6d');break;case _0x4042('0x6e'):_0x1daee8['childModel']=_0x4042('0x6f');break;case'trunks':_0x1daee8[_0x4042('0x12')]='Trunk';break;case _0x4042('0x70'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x71');break;case _0x4042('0x72'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x73');break;case _0x4042('0x74'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x75');_0x1daee8['parentSections']=[{'name':_0x4042('0x76'),'field':'id','foreignKey':_0x4042('0x77')}];break;case _0x4042('0x78'):_0x1daee8[_0x4042('0x12')]=_0x4042('0x79');break;}return _0x1daee8;}function _0x211d7e(_0x4b4617,_0x143985){var _0x263b54=_0x4b4617[_0x4042('0x7a')](0x0)['toUpperCase']()+_0x4b4617[_0x4042('0x7b')](0x1);var _0x3703f6={'type':_0x53f080[_0x4042('0x7c')][_0x4042('0x7d')][_0x4042('0x7e')],'raw':!![]};return new Promise(function(_0x3959eb,_0x3c6185){var _0xf7b32b=squel[_0x4042('0x7f')]()[_0x4042('0x5')]('ui.'+_0x263b54+_0x4042('0x80'),'id')['field']('ui.createdAt')[_0x4042('0x81')](_0x4042('0x82')+_0x4b4617+_0x4042('0x83'),'ui')[_0x4042('0x84')]('ui.UserId\x20=\x20?',_0x143985['id']);return _0x53f080[_0x4042('0x85')]['query'](_0xf7b32b['toString'](),_0x3703f6)[_0x4042('0x7')](function(_0x4c0381){_0x143985[_0x263b54+_0x4042('0x86')]=_0x4c0381;_0x3959eb(_0x4c0381);})[_0x4042('0x9')](function(_0xced3c2){_0x3c6185(_0xced3c2);});});}return _0x292a62['define'](_0x4042('0x87'),attributes,{'tableName':_0x4042('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x52461a){var _0x38d226={'raw':![],'where':{}};var _0x28c9b0={};var _0x52def0={'count':0x0,'rows':[]};var _0x48d0a8=_0x52461a['query']['section'];var _0xe750c1=_0x52461a[_0x4042('0x89')]['mergeResources']||![];var _0x403ffa=_0x1f9d4a(_0x48d0a8,_0xe750c1);if(!_0x403ffa[_0x4042('0x12')])throw new Error(_0x4042('0x8a')+_0x48d0a8+'\x27');var _0x1bd48e=[{'name':_0x48d0a8}];if(!_[_0x4042('0x8b')](_0x403ffa[_0x4042('0x1c')]))_0x1bd48e=_0x403ffa[_0x4042('0x1c')];var _0x47d50c=[];for(var _0x882a1b=0x0;_0x882a1b<_0x1bd48e[_0x4042('0x8c')];_0x882a1b++){_0x47d50c[_0x4042('0x8d')](_0x53f080['UserProfileSection']['find']({'where':{'userProfileId':_0x52461a[_0x4042('0x8e')]['id'],'name':_0x1bd48e[_0x882a1b]['name']},'raw':!![]}));}return Promise[_0x4042('0x8f')](_0x47d50c)[_0x4042('0x7')](function(_0x196dee){var _0xd4abae=_[_0x4042('0x4')](_0x196dee,function(_0x4b4994){return _0x4b4994?_0x4b4994:undefined;});var _0x5b728b=_[_0x4042('0x4')](_0x1bd48e,[_0x4042('0x90'),!![]]);var _0x3bb5dd=_['isEmpty'](_0xd4abae)&&_[_0x4042('0x8b')](_0x5b728b)?null:_['union'](_0x5b728b,_0xd4abae);if(!_0x3bb5dd)return null;var _0x2a75c8=[];for(var _0x51a453=0x0;_0x51a453<_0x3bb5dd[_0x4042('0x8c')];_0x51a453++){var _0x5bda8f=_[_0x4042('0x91')](_0x1bd48e,function(_0x3e27f7){return _0x3bb5dd[_0x51a453]?_0x3e27f7[_0x4042('0xd')]===_0x3bb5dd[_0x51a453][_0x4042('0xd')]:null;});if(_0x5bda8f){if(_0x3bb5dd[_0x51a453][_0x4042('0x90')]){_0x2a75c8['push'](_0x519987(_0x403ffa[_0x4042('0x12')],_0x3bb5dd[_0x51a453]));}else{if(!_0x3bb5dd[_0x51a453][_0x4042('0x92')]){_0x2a75c8[_0x4042('0x8d')](_0x3f99f8(_0x5bda8f,_0x3bb5dd[_0x51a453],_0x403ffa[_0x4042('0x12')]));}else{if(_0x5bda8f[_0x4042('0xb')]){_0x2a75c8[_0x4042('0x8d')](_0x2cbc75(_0x5bda8f,_0x3bb5dd[_0x51a453]));}}}}}return Promise[_0x4042('0x8f')](_0x2a75c8);})[_0x4042('0x7')](function(_0x6a11bd){var _0x191469=_0x6a11bd;var _0x4e7042=null;if(_0x191469){_0x4e7042=_0x191469[_0x4042('0x8c')]===0x1?_0x191469[0x0]:null;}if(!_0x4e7042&&!_0x191469)return _0x52def0;var _0x2a7d79=_0x53f080[_0x403ffa[_0x4042('0x12')]]['rawAttributes'];_0x28c9b0[_0x4042('0xb')]=_[_0x4042('0x93')](_0x2a7d79);_0x28c9b0[_0x4042('0x89')]=_[_0x4042('0x93')](_0x52461a['query']);_0x28c9b0[_0x4042('0x94')]=_[_0x4042('0x95')](_0x28c9b0[_0x4042('0xb')],_0x28c9b0['query']);_0x38d226[_0x4042('0x96')]=_[_0x4042('0x95')](_0x28c9b0[_0x4042('0xb')],qs[_0x4042('0x97')](_0x52461a[_0x4042('0x89')][_0x4042('0x97')]));_0x38d226[_0x4042('0x96')]=_0x38d226[_0x4042('0x96')][_0x4042('0x8c')]?_0x38d226[_0x4042('0x96')]:_0x28c9b0[_0x4042('0xb')];if(!_0x52461a[_0x4042('0x89')]['hasOwnProperty'](_0x4042('0x98'))){_0x38d226[_0x4042('0x99')]=qs['limit'](_0x52461a['query']['limit']);_0x38d226[_0x4042('0x9a')]=qs[_0x4042('0x9a')](_0x52461a['query'][_0x4042('0x9a')]);}_0x38d226[_0x4042('0x9b')]=qs['sort'](_0x52461a[_0x4042('0x89')][_0x4042('0x9c')]);_0x38d226[_0x4042('0x84')]=qs['filters'](_[_0x4042('0x9d')](_0x52461a[_0x4042('0x89')],_0x28c9b0[_0x4042('0x94')]));if(_0x52461a[_0x4042('0x89')][_0x4042('0x4')]){_0x38d226[_0x4042('0x84')]=_[_0x4042('0x9e')](_0x38d226['where'],{'$or':_[_0x4042('0x8')](_0x2a7d79,function(_0x134099){if(_0x134099[_0x4042('0x3c')][_0x4042('0x9f')]!==_0x4042('0xa0')){var _0x51b7cb={};_0x51b7cb[_0x134099[_0x4042('0x5')]]={'$like':'%'+_0x52461a[_0x4042('0x89')][_0x4042('0x4')]+'%'};return _0x51b7cb;}})});}var _0x3a3e03=[];var _0x5c898c=null;var _0x437f8b={};if(_0x4e7042){_0x5c898c=_[_0x4042('0x91')](_0x1bd48e,[_0x4042('0xd'),_0x4e7042['name']]);if(_0x5c898c[_0x4042('0x5')]){_0x437f8b={};if(_0x403ffa[_0x4042('0x12')]===_0x4042('0x75')){_0x437f8b[_0x5c898c[_0x4042('0xa1')]]=_[_0x4042('0x8')](_0x4e7042[_0x4042('0xc')],'id');}else{_0x437f8b[_0x5c898c[_0x4042('0xa1')]]=_0x4e7042[_0x4042('0xc')];}_0x3a3e03[_0x4042('0x8d')](_0x437f8b);}else{_0x38d226[_0x4042('0x84')]['id']=_0x4e7042[_0x4042('0xc')];}}else{for(var _0x4554ed=0x0;_0x4554ed<_0x191469['length'];_0x4554ed++){_0x5c898c=_[_0x4042('0x91')](_0x1bd48e,[_0x4042('0xd'),_0x191469[_0x4554ed][_0x4042('0xd')]]);if(_0x5c898c[_0x4042('0x5')]){_0x437f8b={};_0x437f8b[_0x5c898c['foreignKey']]=_0x191469[_0x4554ed][_0x4042('0xc')];_0x3a3e03[_0x4042('0x8d')](_0x437f8b);}else{if(!_0x38d226[_0x4042('0x84')]['id'])_0x38d226[_0x4042('0x84')]['id']=[];_0x191469[_0x4554ed][_0x4042('0xc')][_0x4042('0xa2')](function(_0x27fd25){_0x38d226[_0x4042('0x84')]['id']['push'](_0x27fd25);});}}}if(!_['isEmpty'](_0x3a3e03)){_0x38d226[_0x4042('0x84')]=_[_0x4042('0x9e')](_0x38d226[_0x4042('0x84')],{'$and':{'$or':_0x3a3e03}});}_0x38d226=_['merge']({},_0x38d226,_0x52461a['options']);if(_0x4e7042&&!_0x4e7042[_0x4042('0x92')]&&_0x403ffa['childModel']==='AnalyticExtractedReport'){if(_0x52461a[_0x4042('0x89')][_0x4042('0xa3')]){_0x38d226[_0x4042('0xa4')]=[{'all':!![]}];}return _0x53f080[_0x403ffa[_0x4042('0x12')]]['findAll'](_0x38d226)[_0x4042('0x7')](function(_0x4d4f87){var _0x5e2a18=[];_0x4d4f87[_0x4042('0xa2')](function(_0x13db49){var _0x96ec1b;switch(_0x13db49['reportType']){case'default':_0x96ec1b=_['find'](_0x4e7042['associatedResources'],function(_0x4c36d0){return _0x4c36d0['id']===_0x13db49[_0x4042('0x77')]&&_0x4c36d0[_0x4042('0x3c')]==='DefaultReports';});break;case _0x4042('0xa5'):_0x96ec1b=_[_0x4042('0x91')](_0x4e7042['associatedResources'],function(_0x370e87){return _0x370e87['id']===_0x13db49[_0x4042('0x77')]&&_0x370e87[_0x4042('0x3c')]===_0x4042('0xa6');});break;}if(_0x96ec1b)_0x5e2a18[_0x4042('0x8d')](_0x13db49);});_0x52def0[_0x4042('0xa7')]=_0x5e2a18[_0x4042('0x8c')];_0x52def0['rows']=_0x5e2a18;return _0x52def0;});}else{return _0x53f080[_0x403ffa['childModel']][_0x4042('0xa7')]({'where':_0x38d226['where']})[_0x4042('0x7')](function(_0x13b774){_0x52def0[_0x4042('0xa7')]=_0x13b774;if(_0x52461a['query'][_0x4042('0xa3')]){if(_0x403ffa['childModel']==='CmContact'){_0x38d226[_0x4042('0xa4')]=[{'model':_0x53f080[_0x4042('0xa8')],'as':_0x4042('0xa9'),'attributes':['id','name','color'],'required':_0x52461a[_0x4042('0x89')][_0x4042('0xaa')]?!![]:![]},{'model':_0x53f080[_0x4042('0xa8')],'as':_0x4042('0xab'),'attributes':['id',_0x4042('0xd'),_0x4042('0xac')],'through':_0x52461a['query'][_0x4042('0xaa')]?{'attributes':[],'where':{'TagId':_0x52461a[_0x4042('0x89')][_0x4042('0xaa')]||undefined}}:{},'required':_0x52461a['query']['tag']?!![]:![]}];}else{_0x38d226[_0x4042('0xa4')]=[{'all':!![]}];}}return _0x53f080[_0x403ffa['childModel']]['findAll'](_0x38d226);})[_0x4042('0x7')](function(_0x367506){_0x52def0[_0x4042('0xad')]=_0x367506;if(_0x48d0a8===_0x4042('0x32')&&_0x52461a[_0x4042('0x89')]['openTabs']===_0x4042('0xae')){var _0x48e256=[];for(var _0x5bf95b=0x0;_0x5bf95b<_0x52def0[_0x4042('0xad')][_0x4042('0x8c')];_0x5bf95b++){_0x48e256[_0x4042('0x8d')](_0x211d7e(_0x4042('0xaf'),_0x52def0[_0x4042('0xad')][_0x5bf95b][_0x4042('0xb0')]));_0x48e256[_0x4042('0x8d')](_0x211d7e(_0x4042('0xb1'),_0x52def0['rows'][_0x5bf95b][_0x4042('0xb0')]));_0x48e256[_0x4042('0x8d')](_0x211d7e(_0x4042('0xb2'),_0x52def0[_0x4042('0xad')][_0x5bf95b]['dataValues']));_0x48e256[_0x4042('0x8d')](_0x211d7e(_0x4042('0xb3'),_0x52def0[_0x4042('0xad')][_0x5bf95b][_0x4042('0xb0')]));_0x48e256[_0x4042('0x8d')](_0x211d7e(_0x4042('0xb4'),_0x52def0[_0x4042('0xad')][_0x5bf95b][_0x4042('0xb0')]));_0x48e256[_0x4042('0x8d')](_0x211d7e('whatsapp',_0x52def0[_0x4042('0xad')][_0x5bf95b]['dataValues']));}return Promise[_0x4042('0x8f')](_0x48e256)['then'](function(){return _0x52def0;});}return _0x52def0;});}});}}});}; \ No newline at end of file +var _0x5496=['parentSections','SquareProjects','name','projectName','projects','contacts','CmContact','Lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','telephones','Users','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','charAt','toUpperCase','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','union','ignore','autoAssociation','model','all','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','merge','key','VIRTUAL','foreignKey','forEach','options','reportType','DefaultReports','CustomReports','count','rows','includeAll','Tags','color','tag','ThroughTags','include','openTabs','true','dataValues','sms','fax','mail','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','field','value','then','associatedResources','map','catch','findAll','resolve','resourceId','type','squareprojects','childModel','odbc','SquareOdbc','SquareRecording'];(function(_0x2e38cd,_0x446de2){var _0x5120c9=function(_0x18768e){while(--_0x18768e){_0x2e38cd['push'](_0x2e38cd['shift']());}};_0x5120c9(++_0x446de2);}(_0x5496,0x175));var _0x6549=function(_0x10e83d,_0x845ca0){_0x10e83d=_0x10e83d-0x0;var _0x353a04=_0x5496[_0x10e83d];return _0x353a04;};'use strict';var _=require(_0x6549('0x0'));var attributes=require(_0x6549('0x1'));var qs=require(_0x6549('0x2'));var squel=require(_0x6549('0x3'));module[_0x6549('0x4')]=function(_0x4b616a){var _0x21585c=_0x4b616a['models'];function _0x2d2155(_0x8112c5,_0x3750cc){return new Promise(function(_0x4d0473,_0x5a4658){if(!_0x3750cc)return _0x4d0473(null);var _0x43cb17=_0x3750cc[_0x6549('0x5')]?{[_0x3750cc['filter'][_0x6549('0x6')]]:_0x3750cc[_0x6549('0x5')][_0x6549('0x7')]}:undefined;return _0x21585c[_0x8112c5]['findAll']({'where':_0x43cb17,'raw':!![]})[_0x6549('0x8')](function(_0x35d008){_0x3750cc[_0x6549('0x9')]=_[_0x6549('0xa')](_0x35d008,'id');_0x4d0473(_0x3750cc);})[_0x6549('0xb')](function(_0x3e08a6){_0x5a4658(_0x3e08a6);});});}function _0x50fa35(_0x551133,_0x1e27d4){return new Promise(function(_0xac828c,_0x3c5f9b){var _0x216620=_0x551133[_0x6549('0x5')]?{[_0x551133['filter']['field']]:_0x551133[_0x6549('0x5')][_0x6549('0x7')]}:undefined;return _0x21585c[_0x551133['model']][_0x6549('0xc')]({'where':_0x216620,'raw':!![]})[_0x6549('0x8')](function(_0x195d25){_0x1e27d4[_0x6549('0x9')]=_[_0x6549('0xa')](_0x195d25,function(_0x86ae9d){return _0x86ae9d['name'];});_0xac828c(_0x1e27d4);})['catch'](function(_0x384f75){_0x3c5f9b(_0x384f75);});});}function _0x25da29(_0x47a81a,_0x238a04,_0x67acc0){if(!_0x238a04)return Promise[_0x6549('0xd')](null);return new Promise(function(_0x387e60,_0xffc8b9){return _0x21585c['UserProfileResource']['findAll']({'where':{'sectionId':_0x238a04['id']},'raw':!![]})[_0x6549('0x8')](function(_0x48f037){if(_0x47a81a['field']&&_0x47a81a[_0x6549('0x6')]!=='id'){_0x238a04[_0x6549('0x9')]=_[_0x6549('0xa')](_0x48f037,function(_0xfca192){return _0xfca192[_0x47a81a[_0x6549('0x6')]];});}else{if(_0x67acc0==='AnalyticExtractedReport'){_0x238a04[_0x6549('0x9')]=_['map'](_0x48f037,function(_0x125096){return{'id':_0x125096[_0x6549('0xe')],'type':_0x125096[_0x6549('0xf')]};});}else{_0x238a04[_0x6549('0x9')]=_[_0x6549('0xa')](_0x48f037,function(_0x12d547){return _0x12d547[_0x6549('0xe')];});}}_0x387e60(_0x238a04);})[_0x6549('0xb')](function(_0x2be467){_0xffc8b9(_0x2be467);});});}function _0x6ae00c(_0x40d3f9,_0x1fbfa4){var _0x23c0ba={'parentSections':[]};switch(_0x40d3f9['toLowerCase']()){case _0x6549('0x10'):_0x23c0ba[_0x6549('0x11')]='SquareProject';break;case _0x6549('0x12'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x13');break;case'squarerecordings':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x14');_0x23c0ba[_0x6549('0x15')]=[{'name':_0x6549('0x16'),'field':_0x6549('0x17'),'foreignKey':_0x6549('0x18')}];break;case _0x6549('0x19'):_0x23c0ba[_0x6549('0x11')]='JscriptyProject';break;case _0x6549('0x1a'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x1b');_0x23c0ba['parentSections']=[{'name':_0x6549('0x1c'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x23c0ba['childModel']=_0x6549('0x1d');break;case _0x6549('0x1e'):_0x23c0ba['childModel']=_0x6549('0x1f');break;case _0x6549('0x20'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x21');break;case _0x6549('0x22'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x23');break;case'chatwebsites':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x24');break;case _0x6549('0x25'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x26');break;case _0x6549('0x27'):_0x23c0ba['childModel']=_0x6549('0x28');break;case'inboundroutes':case _0x6549('0x29'):case'outboundroutes':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x2a');break;case _0x6549('0x2b'):_0x23c0ba['childModel']=_0x6549('0x2c');break;case _0x6549('0x2d'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x2e');break;case'voicerecordings':_0x23c0ba['childModel']='VoiceRecording';_0x23c0ba[_0x6549('0x15')]=[{'name':_0x6549('0x2f'),'field':'name','foreignKey':_0x6549('0x30'),'model':_0x6549('0x31'),'filter':{'field':_0x6549('0x32'),'value':[_0x6549('0x33')]}},{'name':_0x6549('0x34'),'field':'name','foreignKey':'membername','model':_0x6549('0x31'),'filter':{'field':_0x6549('0x32'),'value':[_0x6549('0x35')]}},{'name':_0x6549('0x36'),'field':_0x6549('0x17'),'foreignKey':_0x6549('0x37'),'model':_0x6549('0x38'),'filter':{'field':_0x6549('0xf'),'value':[_0x6549('0x39')]}},{'name':_0x6549('0x3a'),'field':'name','foreignKey':_0x6549('0x37'),'model':_0x6549('0x38'),'filter':{'field':_0x6549('0xf'),'value':[_0x6549('0x3b')]}}];break;case _0x6549('0x3c'):_0x23c0ba['childModel']='VoiceMusicOnHold';break;case'chanspies':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x3d');break;case _0x6549('0x3e'):_0x23c0ba[_0x6549('0x11')]='VoicePrefix';break;case'ivrcampaigns':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x3f');break;case _0x6549('0x40'):_0x23c0ba['childModel']=_0x6549('0x41');break;case'mailaccounts':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x42');break;case _0x6549('0x43'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x44');break;case _0x6549('0x45'):_0x23c0ba[_0x6549('0x11')]='OpenchannelQueue';break;case _0x6549('0x46'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x47');break;case _0x6549('0x48'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x49');break;case _0x6549('0x4a'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x4b');break;case _0x6549('0x4c'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x4d');break;case _0x6549('0x4e'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x4f');break;case _0x6549('0x50'):_0x23c0ba['childModel']=_0x6549('0x51');break;case _0x6549('0x52'):case _0x6549('0x53'):_0x23c0ba[_0x6549('0x11')]='VoiceQueue';if(_0x1fbfa4){_0x23c0ba[_0x6549('0x15')]=[{'name':'VoiceQueues'},{'name':_0x6549('0x3a')}];}break;case _0x6549('0x54'):case'agents':case _0x6549('0x55'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x31');if(_0x1fbfa4){_0x23c0ba[_0x6549('0x15')]=[{'name':_0x6549('0x56'),'filter':{'field':'role','value':['admin',_0x6549('0x57')]},'ignore':!![]},{'name':_0x6549('0x2f')},{'name':_0x6549('0x34')}];}break;case _0x6549('0x58'):_0x23c0ba[_0x6549('0x11')]='ZendeskAccount';break;case _0x6549('0x59'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x5a');break;case _0x6549('0x5b'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x5c');break;case _0x6549('0x5d'):_0x23c0ba[_0x6549('0x11')]='SugarcrmAccount';break;case _0x6549('0x5e'):_0x23c0ba['childModel']=_0x6549('0x5f');break;case _0x6549('0x60'):_0x23c0ba[_0x6549('0x11')]='ZohoAccount';break;case _0x6549('0x61'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x31');break;case'cannedanswers':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x62');break;case _0x6549('0x63'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x64');break;case _0x6549('0x65'):_0x23c0ba['childModel']=_0x6549('0x66');break;case'intervals':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x67');break;case _0x6549('0x68'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x69');break;case _0x6549('0x6a'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x6b');break;case _0x6549('0x6c'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x6d');break;case _0x6549('0x6e'):_0x23c0ba['childModel']=_0x6549('0x6f');break;case _0x6549('0x70'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x71');break;case _0x6549('0x72'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x73');break;case _0x6549('0x74'):_0x23c0ba['childModel']=_0x6549('0x75');break;case _0x6549('0x76'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x77');break;case _0x6549('0x78'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x79');break;case _0x6549('0x7a'):_0x23c0ba['childModel']=_0x6549('0x7b');_0x23c0ba[_0x6549('0x15')]=[{'name':_0x6549('0x7c'),'field':'id','foreignKey':_0x6549('0x7d')}];break;case _0x6549('0x7e'):_0x23c0ba[_0x6549('0x11')]='AnalyticMetric';break;}return _0x23c0ba;}function _0x2ca517(_0xe0a696,_0x4bf996){var _0x38bce4=_0xe0a696[_0x6549('0x7f')](0x0)[_0x6549('0x80')]()+_0xe0a696['slice'](0x1);var _0x4640c8={'type':_0x21585c[_0x6549('0x81')]['QueryTypes'][_0x6549('0x82')],'raw':!![]};return new Promise(function(_0x509f69,_0x3dc12c){var _0x522cd3=squel[_0x6549('0x83')]()[_0x6549('0x6')](_0x6549('0x84')+_0x38bce4+_0x6549('0x85'),'id')[_0x6549('0x6')](_0x6549('0x86'))[_0x6549('0x87')](_0x6549('0x88')+_0xe0a696+_0x6549('0x89'),'ui')[_0x6549('0x8a')](_0x6549('0x8b'),_0x4bf996['id']);return _0x21585c[_0x6549('0x8c')][_0x6549('0x8d')](_0x522cd3[_0x6549('0x8e')](),_0x4640c8)['then'](function(_0x2bff46){_0x4bf996[_0x38bce4+_0x6549('0x8f')]=_0x2bff46;_0x509f69(_0x2bff46);})['catch'](function(_0xfb11e1){_0x3dc12c(_0xfb11e1);});});}return _0x4b616a[_0x6549('0x90')](_0x6549('0x91'),attributes,{'tableName':_0x6549('0x92'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4fbc75){var _0x6ff64d={'raw':![],'where':{}};var _0x28ff2e={};var _0x19c9bd={'count':0x0,'rows':[]};var _0x20e39b=_0x4fbc75['query'][_0x6549('0x93')];var _0x5372f4=_0x4fbc75[_0x6549('0x8d')][_0x6549('0x94')]||![];var _0x101221=_0x6ae00c(_0x20e39b,_0x5372f4);if(!_0x101221[_0x6549('0x11')])throw new Error(_0x6549('0x95')+_0x20e39b+'\x27');var _0x23f067=[{'name':_0x20e39b}];if(!_[_0x6549('0x96')](_0x101221[_0x6549('0x15')]))_0x23f067=_0x101221[_0x6549('0x15')];var _0x1cd528=[];for(var _0x49427f=0x0;_0x49427f<_0x23f067[_0x6549('0x97')];_0x49427f++){_0x1cd528[_0x6549('0x98')](_0x21585c[_0x6549('0x99')][_0x6549('0x9a')]({'where':{'userProfileId':_0x4fbc75[_0x6549('0x9b')]['id'],'name':_0x23f067[_0x49427f][_0x6549('0x17')]},'raw':!![]}));}return Promise['all'](_0x1cd528)['then'](function(_0x368298){var _0x11886e=_[_0x6549('0x5')](_0x368298,function(_0x4e8333){return _0x4e8333?_0x4e8333:undefined;});var _0x1be12c=_[_0x6549('0x5')](_0x23f067,['ignore',!![]]);var _0x312299=_[_0x6549('0x96')](_0x11886e)&&_[_0x6549('0x96')](_0x1be12c)?null:_[_0x6549('0x9c')](_0x1be12c,_0x11886e);if(!_0x312299)return null;var _0x2ea46d=[];for(var _0x3c1768=0x0;_0x3c1768<_0x312299[_0x6549('0x97')];_0x3c1768++){var _0x402c26=_['find'](_0x23f067,function(_0x43c667){return _0x312299[_0x3c1768]?_0x43c667['name']===_0x312299[_0x3c1768][_0x6549('0x17')]:null;});if(_0x402c26){if(_0x312299[_0x3c1768][_0x6549('0x9d')]){_0x2ea46d['push'](_0x2d2155(_0x101221[_0x6549('0x11')],_0x312299[_0x3c1768]));}else{if(!_0x312299[_0x3c1768][_0x6549('0x9e')]){_0x2ea46d[_0x6549('0x98')](_0x25da29(_0x402c26,_0x312299[_0x3c1768],_0x101221['childModel']));}else{if(_0x402c26[_0x6549('0x9f')]){_0x2ea46d[_0x6549('0x98')](_0x50fa35(_0x402c26,_0x312299[_0x3c1768]));}}}}}return Promise[_0x6549('0xa0')](_0x2ea46d);})[_0x6549('0x8')](function(_0x15b906){var _0x34c5f9=_0x15b906;var _0x500bd9=null;if(_0x34c5f9){_0x500bd9=_0x34c5f9[_0x6549('0x97')]===0x1?_0x34c5f9[0x0]:null;}if(!_0x500bd9&&!_0x34c5f9)return _0x19c9bd;var _0x1cad48=_0x21585c[_0x101221[_0x6549('0x11')]]['rawAttributes'];_0x28ff2e['model']=_['keys'](_0x1cad48);_0x28ff2e[_0x6549('0x8d')]=_[_0x6549('0xa1')](_0x4fbc75[_0x6549('0x8d')]);_0x28ff2e['filters']=_['intersection'](_0x28ff2e[_0x6549('0x9f')],_0x28ff2e['query']);_0x6ff64d[_0x6549('0xa2')]=_[_0x6549('0xa3')](_0x28ff2e[_0x6549('0x9f')],qs[_0x6549('0xa4')](_0x4fbc75[_0x6549('0x8d')][_0x6549('0xa4')]));_0x6ff64d[_0x6549('0xa2')]=_0x6ff64d['attributes'][_0x6549('0x97')]?_0x6ff64d[_0x6549('0xa2')]:_0x28ff2e[_0x6549('0x9f')];if(!_0x4fbc75['query'][_0x6549('0xa5')](_0x6549('0xa6'))){_0x6ff64d[_0x6549('0xa7')]=qs[_0x6549('0xa7')](_0x4fbc75[_0x6549('0x8d')][_0x6549('0xa7')]);_0x6ff64d[_0x6549('0xa8')]=qs['offset'](_0x4fbc75[_0x6549('0x8d')]['offset']);}_0x6ff64d[_0x6549('0xa9')]=qs[_0x6549('0xaa')](_0x4fbc75[_0x6549('0x8d')][_0x6549('0xaa')]);_0x6ff64d[_0x6549('0x8a')]=qs[_0x6549('0xab')](_[_0x6549('0xac')](_0x4fbc75[_0x6549('0x8d')],_0x28ff2e['filters']));if(_0x4fbc75[_0x6549('0x8d')][_0x6549('0x5')]){_0x6ff64d[_0x6549('0x8a')]=_[_0x6549('0xad')](_0x6ff64d[_0x6549('0x8a')],{'$or':_[_0x6549('0xa')](_0x1cad48,function(_0xc8645b){if(_0xc8645b[_0x6549('0xf')][_0x6549('0xae')]!==_0x6549('0xaf')){var _0x51f479={};_0x51f479[_0xc8645b[_0x6549('0x6')]]={'$like':'%'+_0x4fbc75[_0x6549('0x8d')][_0x6549('0x5')]+'%'};return _0x51f479;}})});}var _0x45dc56=[];var _0x416657=null;var _0xd80e41={};if(_0x500bd9){_0x416657=_[_0x6549('0x9a')](_0x23f067,[_0x6549('0x17'),_0x500bd9[_0x6549('0x17')]]);if(_0x416657[_0x6549('0x6')]){_0xd80e41={};if(_0x101221[_0x6549('0x11')]===_0x6549('0x7b')){_0xd80e41[_0x416657[_0x6549('0xb0')]]=_[_0x6549('0xa')](_0x500bd9[_0x6549('0x9')],'id');}else{_0xd80e41[_0x416657[_0x6549('0xb0')]]=_0x500bd9[_0x6549('0x9')];}_0x45dc56[_0x6549('0x98')](_0xd80e41);}else{_0x6ff64d['where']['id']=_0x500bd9[_0x6549('0x9')];}}else{for(var _0x401eb0=0x0;_0x401eb0<_0x34c5f9[_0x6549('0x97')];_0x401eb0++){_0x416657=_[_0x6549('0x9a')](_0x23f067,[_0x6549('0x17'),_0x34c5f9[_0x401eb0][_0x6549('0x17')]]);if(_0x416657[_0x6549('0x6')]){_0xd80e41={};_0xd80e41[_0x416657[_0x6549('0xb0')]]=_0x34c5f9[_0x401eb0][_0x6549('0x9')];_0x45dc56[_0x6549('0x98')](_0xd80e41);}else{if(!_0x6ff64d[_0x6549('0x8a')]['id'])_0x6ff64d[_0x6549('0x8a')]['id']=[];_0x34c5f9[_0x401eb0][_0x6549('0x9')][_0x6549('0xb1')](function(_0x38df70){_0x6ff64d[_0x6549('0x8a')]['id'][_0x6549('0x98')](_0x38df70);});}}}if(!_['isEmpty'](_0x45dc56)){_0x6ff64d[_0x6549('0x8a')]=_[_0x6549('0xad')](_0x6ff64d[_0x6549('0x8a')],{'$and':{'$or':_0x45dc56}});}_0x6ff64d=_[_0x6549('0xad')]({},_0x6ff64d,_0x4fbc75[_0x6549('0xb2')]);if(_0x500bd9&&!_0x500bd9[_0x6549('0x9e')]&&_0x101221[_0x6549('0x11')]==='AnalyticExtractedReport'){if(_0x4fbc75[_0x6549('0x8d')]['includeAll']){_0x6ff64d['include']=[{'all':!![]}];}return _0x21585c[_0x101221[_0x6549('0x11')]]['findAll'](_0x6ff64d)[_0x6549('0x8')](function(_0x1f3230){var _0x30083b=[];_0x1f3230[_0x6549('0xb1')](function(_0x419fdb){var _0x5ac35c;switch(_0x419fdb[_0x6549('0xb3')]){case'default':_0x5ac35c=_[_0x6549('0x9a')](_0x500bd9[_0x6549('0x9')],function(_0x4528fd){return _0x4528fd['id']===_0x419fdb['reportId']&&_0x4528fd[_0x6549('0xf')]===_0x6549('0xb4');});break;case'custom':_0x5ac35c=_['find'](_0x500bd9[_0x6549('0x9')],function(_0x154346){return _0x154346['id']===_0x419fdb[_0x6549('0x7d')]&&_0x154346[_0x6549('0xf')]===_0x6549('0xb5');});break;}if(_0x5ac35c)_0x30083b[_0x6549('0x98')](_0x419fdb);});_0x19c9bd[_0x6549('0xb6')]=_0x30083b[_0x6549('0x97')];_0x19c9bd[_0x6549('0xb7')]=_0x30083b;return _0x19c9bd;});}else{return _0x21585c[_0x101221[_0x6549('0x11')]][_0x6549('0xb6')]({'where':_0x6ff64d[_0x6549('0x8a')]})[_0x6549('0x8')](function(_0x4746bb){_0x19c9bd[_0x6549('0xb6')]=_0x4746bb;if(_0x4fbc75[_0x6549('0x8d')][_0x6549('0xb8')]){if(_0x101221[_0x6549('0x11')]===_0x6549('0x1b')){_0x6ff64d['include']=[{'model':_0x21585c['Tag'],'as':_0x6549('0xb9'),'attributes':['id',_0x6549('0x17'),_0x6549('0xba')],'required':_0x4fbc75[_0x6549('0x8d')][_0x6549('0xbb')]?!![]:![]},{'model':_0x21585c[_0x6549('0x6f')],'as':_0x6549('0xbc'),'attributes':['id',_0x6549('0x17'),_0x6549('0xba')],'through':_0x4fbc75[_0x6549('0x8d')]['tag']?{'attributes':[],'where':{'TagId':_0x4fbc75['query']['tag']||undefined}}:{},'required':_0x4fbc75[_0x6549('0x8d')][_0x6549('0xbb')]?!![]:![]}];}else{_0x6ff64d[_0x6549('0xbd')]=[{'all':!![]}];}}return _0x21585c[_0x101221[_0x6549('0x11')]][_0x6549('0xc')](_0x6ff64d);})['then'](function(_0x100c37){_0x19c9bd[_0x6549('0xb7')]=_0x100c37;if(_0x20e39b===_0x6549('0x2f')&&_0x4fbc75[_0x6549('0x8d')][_0x6549('0xbe')]===_0x6549('0xbf')){var _0xaf1a80=[];for(var _0x1dd688=0x0;_0x1dd688<_0x19c9bd[_0x6549('0xb7')][_0x6549('0x97')];_0x1dd688++){_0xaf1a80[_0x6549('0x98')](_0x2ca517('chat',_0x19c9bd[_0x6549('0xb7')][_0x1dd688][_0x6549('0xc0')]));_0xaf1a80[_0x6549('0x98')](_0x2ca517(_0x6549('0xc1'),_0x19c9bd['rows'][_0x1dd688][_0x6549('0xc0')]));_0xaf1a80[_0x6549('0x98')](_0x2ca517(_0x6549('0xc2'),_0x19c9bd[_0x6549('0xb7')][_0x1dd688][_0x6549('0xc0')]));_0xaf1a80[_0x6549('0x98')](_0x2ca517(_0x6549('0xc3'),_0x19c9bd[_0x6549('0xb7')][_0x1dd688][_0x6549('0xc0')]));_0xaf1a80['push'](_0x2ca517(_0x6549('0xc4'),_0x19c9bd[_0x6549('0xb7')][_0x1dd688][_0x6549('0xc0')]));_0xaf1a80[_0x6549('0x98')](_0x2ca517('whatsapp',_0x19c9bd['rows'][_0x1dd688]['dataValues']));}return Promise[_0x6549('0xa0')](_0xaf1a80)['then'](function(){return _0x19c9bd;});}return _0x19c9bd;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 6cdb7e7..50bc747 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 _0xa3fe=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x4da370,_0x4fe303){var _0x54dfd2=function(_0x174b90){while(--_0x174b90){_0x4da370['push'](_0x4da370['shift']());}};_0x54dfd2(++_0x4fe303);}(_0xa3fe,0xd8));var _0xea3f=function(_0x160333,_0x928b61){_0x160333=_0x160333-0x0;var _0xa0bd67=_0xa3fe[_0x160333];return _0xa0bd67;};'use strict';var _=require(_0xea3f('0x0'));var util=require('util');var moment=require(_0xea3f('0x1'));var BPromise=require(_0xea3f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea3f('0x3'));var db=require(_0xea3f('0x4'))['db'];var utils=require(_0xea3f('0x5'));var logger=require('../../config/logger')(_0xea3f('0x6'));var config=require('../../config/environment');var jayson=require(_0xea3f('0x7'));var client=jayson[_0xea3f('0x8')][_0xea3f('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xea3f('0xa')],{'host':_0xea3f('0xb'),'port':0x18eb});var socket=require(_0xea3f('0xc'))(new Redis(config['redis']));require('./userProfile.socket')[_0xea3f('0xd')](socket);function respondWithRpcPromise(_0x5d9b2c,_0x526024,_0x249e8e){return new BPromise(function(_0xa8b25b,_0x414ddb){return client['request'](_0x5d9b2c,_0x249e8e)['then'](function(_0x5c8cd3){logger[_0xea3f('0xe')](_0xea3f('0xf'),_0x526024,_0xea3f('0x10'));logger[_0xea3f('0x11')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x526024,'request\x20sent',JSON['stringify'](_0x5c8cd3));if(_0x5c8cd3[_0xea3f('0x12')]){if(_0x5c8cd3[_0xea3f('0x12')]['code']===0x1f4){logger[_0xea3f('0x12')](_0xea3f('0xf'),_0x526024,_0x5c8cd3['error'][_0xea3f('0x13')]);return _0x414ddb(_0x5c8cd3[_0xea3f('0x12')][_0xea3f('0x13')]);}logger[_0xea3f('0x12')](_0xea3f('0xf'),_0x526024,_0x5c8cd3[_0xea3f('0x12')][_0xea3f('0x13')]);return _0xa8b25b(_0x5c8cd3[_0xea3f('0x12')][_0xea3f('0x13')]);}else{logger[_0xea3f('0xe')](_0xea3f('0xf'),_0x526024,_0xea3f('0x10'));_0xa8b25b(_0x5c8cd3[_0xea3f('0x14')][_0xea3f('0x13')]);}})[_0xea3f('0x15')](function(_0xc199e4){logger[_0xea3f('0x12')](_0xea3f('0xf'),_0x526024,_0xc199e4);_0x414ddb(_0xc199e4);});});} \ No newline at end of file +var _0x9e2e=['info','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then'];(function(_0x33bcdb,_0x11846b){var _0x18a9bf=function(_0x34417a){while(--_0x34417a){_0x33bcdb['push'](_0x33bcdb['shift']());}};_0x18a9bf(++_0x11846b);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x416208,_0x32e11e){_0x416208=_0x416208-0x0;var _0x1b43d6=_0x9e2e[_0x416208];return _0x1b43d6;};'use strict';var _=require(_0xe9e2('0x0'));var util=require(_0xe9e2('0x1'));var moment=require(_0xe9e2('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9e2('0x4'));var logger=require(_0xe9e2('0x5'))(_0xe9e2('0x6'));var config=require(_0xe9e2('0x7'));var jayson=require(_0xe9e2('0x8'));var client=jayson[_0xe9e2('0x9')][_0xe9e2('0xa')]({'port':0x232a});config['redis']=_[_0xe9e2('0xb')](config['redis'],{'host':_0xe9e2('0xc'),'port':0x18eb});var socket=require(_0xe9e2('0xd'))(new Redis(config['redis']));require(_0xe9e2('0xe'))[_0xe9e2('0xf')](socket);function respondWithRpcPromise(_0x5d065f,_0x20a3e9,_0xe1c4d3){return new BPromise(function(_0x56264f,_0x53e3c5){return client[_0xe9e2('0x10')](_0x5d065f,_0xe1c4d3)[_0xe9e2('0x11')](function(_0x2e02c8){logger[_0xe9e2('0x12')]('UserProfile,\x20%s,\x20%s',_0x20a3e9,'request\x20sent');logger[_0xe9e2('0x13')](_0xe9e2('0x14'),_0x20a3e9,_0xe9e2('0x15'),JSON[_0xe9e2('0x16')](_0x2e02c8));if(_0x2e02c8[_0xe9e2('0x17')]){if(_0x2e02c8[_0xe9e2('0x17')][_0xe9e2('0x18')]===0x1f4){logger[_0xe9e2('0x17')](_0xe9e2('0x19'),_0x20a3e9,_0x2e02c8[_0xe9e2('0x17')]['message']);return _0x53e3c5(_0x2e02c8['error'][_0xe9e2('0x1a')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x20a3e9,_0x2e02c8[_0xe9e2('0x17')][_0xe9e2('0x1a')]);return _0x56264f(_0x2e02c8[_0xe9e2('0x17')][_0xe9e2('0x1a')]);}else{logger[_0xe9e2('0x12')](_0xe9e2('0x19'),_0x20a3e9,'request\x20sent');_0x56264f(_0x2e02c8[_0xe9e2('0x1b')][_0xe9e2('0x1a')]);}})[_0xe9e2('0x1c')](function(_0x5b804f){logger[_0xe9e2('0x17')](_0xe9e2('0x19'),_0x20a3e9,_0x5b804f);_0x53e3c5(_0x5b804f);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index a07ee43..84e22b9 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 _0xab52=['emit','removeListener','register','length','./userProfile.events','save','remove','update'];(function(_0x4f192e,_0x4d1756){var _0x49294d=function(_0x580ab3){while(--_0x580ab3){_0x4f192e['push'](_0x4f192e['shift']());}};_0x49294d(++_0x4d1756);}(_0xab52,0xc4));var _0x2ab5=function(_0x4b77a0,_0x29156b){_0x4b77a0=_0x4b77a0-0x0;var _0x578dbb=_0xab52[_0x4b77a0];return _0x578dbb;};'use strict';var UserProfileEvents=require(_0x2ab5('0x0'));var events=[_0x2ab5('0x1'),_0x2ab5('0x2'),_0x2ab5('0x3')];function createListener(_0x40c39a,_0x3c21c4){return function(_0x13d370){_0x3c21c4[_0x2ab5('0x4')](_0x40c39a,_0x13d370);};}function removeListener(_0x206ed0,_0x2d3e70){return function(){UserProfileEvents[_0x2ab5('0x5')](_0x206ed0,_0x2d3e70);};}exports[_0x2ab5('0x6')]=function(_0x3b2bef){for(var _0x2e9de0=0x0,_0xdf1cb4=events[_0x2ab5('0x7')];_0x2e9de0<_0xdf1cb4;_0x2e9de0++){var _0x32025c=events[_0x2e9de0];var _0x51147f=createListener('userProfile:'+_0x32025c,_0x3b2bef);UserProfileEvents['on'](_0x32025c,_0x51147f);}}; \ No newline at end of file +var _0xa4a2=['remove','update','register','length','save'];(function(_0x1f48f5,_0xb9111a){var _0x2038e1=function(_0x3c6ccf){while(--_0x3c6ccf){_0x1f48f5['push'](_0x1f48f5['shift']());}};_0x2038e1(++_0xb9111a);}(_0xa4a2,0x9a));var _0x2a4a=function(_0x45dae8,_0x5c0982){_0x45dae8=_0x45dae8-0x0;var _0x51cd63=_0xa4a2[_0x45dae8];return _0x51cd63;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x2a4a('0x0'),_0x2a4a('0x1'),_0x2a4a('0x2')];function createListener(_0x4222f8,_0x2ccaf7){return function(_0x1dbb0e){_0x2ccaf7['emit'](_0x4222f8,_0x1dbb0e);};}function removeListener(_0x3a7694,_0x36c33e){return function(){UserProfileEvents['removeListener'](_0x3a7694,_0x36c33e);};}exports[_0x2a4a('0x3')]=function(_0x403593){for(var _0x46c0c6=0x0,_0x38f3a1=events[_0x2a4a('0x4')];_0x46c0c6<_0x38f3a1;_0x46c0c6++){var _0x5cb96d=events[_0x46c0c6];var _0x565247=createListener('userProfile:'+_0x5cb96d,_0x403593);UserProfileEvents['on'](_0x5cb96d,_0x565247);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 8830852..45a6fee 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 _0xe70c=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','describe','/:id','put','update'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe70c,0xa4));var _0xce70=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe70c[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xce70('0x0'));var util=require(_0xce70('0x1'));var path=require('path');var timeout=require(_0xce70('0x2'));var express=require(_0xce70('0x3'));var router=express[_0xce70('0x4')]();var fs_extra=require(_0xce70('0x5'));var auth=require(_0xce70('0x6'));var interaction=require(_0xce70('0x7'));var config=require(_0xce70('0x8'));var controller=require(_0xce70('0x9'));router[_0xce70('0xa')]('/',auth[_0xce70('0xb')](),controller['index']);router['get']('/describe',auth[_0xce70('0xb')](),controller[_0xce70('0xc')]);router['get'](_0xce70('0xd'),auth[_0xce70('0xb')](),controller['show']);router['post']('/',auth[_0xce70('0xb')](),controller['create']);router[_0xce70('0xe')]('/:id',auth[_0xce70('0xb')](),controller[_0xce70('0xf')]);router['delete'](_0xce70('0xd'),auth[_0xce70('0xb')](),controller[_0xce70('0x10')]);module[_0xce70('0x11')]=router; \ No newline at end of file +var _0xe638=['/describe','describe','/:id','show','post','create','put','update','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0xe638,0x144));var _0x8e63=function(_0x1502f5,_0x4cb98f){_0x1502f5=_0x1502f5-0x0;var _0x2ab33d=_0xe638[_0x1502f5];return _0x2ab33d;};'use strict';var multer=require('multer');var util=require(_0x8e63('0x0'));var path=require(_0x8e63('0x1'));var timeout=require(_0x8e63('0x2'));var express=require(_0x8e63('0x3'));var router=express['Router']();var fs_extra=require(_0x8e63('0x4'));var auth=require(_0x8e63('0x5'));var interaction=require(_0x8e63('0x6'));var config=require(_0x8e63('0x7'));var controller=require(_0x8e63('0x8'));router[_0x8e63('0x9')]('/',auth[_0x8e63('0xa')](),controller[_0x8e63('0xb')]);router['get'](_0x8e63('0xc'),auth[_0x8e63('0xa')](),controller[_0x8e63('0xd')]);router[_0x8e63('0x9')](_0x8e63('0xe'),auth['isAuthenticated'](),controller[_0x8e63('0xf')]);router[_0x8e63('0x10')]('/',auth[_0x8e63('0xa')](),controller[_0x8e63('0x11')]);router[_0x8e63('0x12')]('/:id',auth[_0x8e63('0xa')](),controller[_0x8e63('0x13')]);router['delete'](_0x8e63('0xe'),auth[_0x8e63('0xa')](),controller[_0x8e63('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index daa6b57..7a4034f 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 _0x4eb7=['STRING','sequelize','exports'];(function(_0x1d49c6,_0x36c18e){var _0x55bceb=function(_0x48583d){while(--_0x48583d){_0x1d49c6['push'](_0x1d49c6['shift']());}};_0x55bceb(++_0x36c18e);}(_0x4eb7,0x133));var _0x74eb=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x4eb7[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require(_0x74eb('0x0'));module[_0x74eb('0x1')]={'name':{'type':Sequelize[_0x74eb('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x74eb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1dab=['INTEGER','sequelize','STRING'];(function(_0x3e5971,_0x51577f){var _0xf04603=function(_0x5415df){while(--_0x5415df){_0x3e5971['push'](_0x3e5971['shift']());}};_0xf04603(++_0x51577f);}(_0x1dab,0xd9));var _0xb1da=function(_0x3cba1d,_0x2825ae){_0x3cba1d=_0x3cba1d-0x0;var _0x5f192b=_0x1dab[_0x3cba1d];return _0x5f192b;};'use strict';var Sequelize=require(_0xb1da('0x0'));module['exports']={'name':{'type':Sequelize[_0xb1da('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb1da('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb1da('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 1b66abe..b897403 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 _0xd117=['filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','UserProfileResource','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1e3aae,_0x3e51fe){var _0x1ed860=function(_0xcf05b8){while(--_0xcf05b8){_0x1e3aae['push'](_0x1e3aae['shift']());}};_0x1ed860(++_0x3e51fe);}(_0xd117,0x182));var _0x7d11=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0xd117[_0x2272b5];return _0x110156;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['create'](_0x161213['body'],{})['then'](respondWithResult(_0x193631,0xc9))[_0x7d11('0x40')](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x20297a,_0x18ae0e){if(_0x20297a[_0x7d11('0x48')]['id']){delete _0x20297a[_0x7d11('0x48')]['id'];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'id':_0x20297a[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x18ae0e,null))[_0x7d11('0x22')](saveUpdates(_0x20297a[_0x7d11('0x48')],null))['then'](respondWithResult(_0x18ae0e,null))[_0x7d11('0x40')](handleError(_0x18ae0e,null));};exports[_0x7d11('0x23')]=function(_0x29207f,_0x553a03){return db['UserProfileResource'][_0x7d11('0x45')]({'where':{'id':_0x29207f[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x553a03,null))['then'](removeEntity(_0x553a03,null))['catch'](handleError(_0x553a03,null));};exports[_0x7d11('0x49')]=function(_0x36af2b,_0x5e6234){return db[_0x7d11('0x28')][_0x7d11('0x49')]()[_0x7d11('0x22')](respondWithResult(_0x5e6234,null))[_0x7d11('0x40')](handleError(_0x5e6234,null));}; \ No newline at end of file +var _0x90b1=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','UserProfileResource','includeAll','rows','include','find','catch','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','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/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters'];(function(_0x1a902c,_0x5d40aa){var _0x1711e6=function(_0xeb98f7){while(--_0xeb98f7){_0x1a902c['push'](_0x1a902c['shift']());}};_0x1711e6(++_0x5d40aa);}(_0x90b1,0x1bb));var _0x190b=function(_0x2ca55e,_0x280c31){_0x2ca55e=_0x2ca55e-0x0;var _0x3c7753=_0x90b1[_0x2ca55e];return _0x3c7753;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['UserProfileResource'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['create']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['create'](_0x1f2262[_0x190b('0x43')],{})[_0x190b('0x22')](respondWithResult(_0xadc789,0xc9))[_0x190b('0x42')](handleError(_0xadc789,null));};exports['update']=function(_0x4cb561,_0x14958e){if(_0x4cb561[_0x190b('0x43')]['id']){delete _0x4cb561[_0x190b('0x43')]['id'];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'id':_0x4cb561[_0x190b('0x44')]['id']}})['then'](handleEntityNotFound(_0x14958e,null))[_0x190b('0x22')](saveUpdates(_0x4cb561[_0x190b('0x43')],null))[_0x190b('0x22')](respondWithResult(_0x14958e,null))['catch'](handleError(_0x14958e,null));};exports[_0x190b('0x23')]=function(_0x38c135,_0x215ab6){return db['UserProfileResource'][_0x190b('0x41')]({'where':{'id':_0x38c135[_0x190b('0x44')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x215ab6,null))[_0x190b('0x22')](removeEntity(_0x215ab6,null))[_0x190b('0x42')](handleError(_0x215ab6,null));};exports[_0x190b('0x45')]=function(_0x33cc78,_0x2ea1c8){return db[_0x190b('0x3d')][_0x190b('0x45')]()[_0x190b('0x22')](respondWithResult(_0x2ea1c8,null))['catch'](handleError(_0x2ea1c8,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 452fd39..ef7b1d9 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 _0xe826=['UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./userProfileResource.attributes','exports','define'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xe826,0x138));var _0x6e82=function(_0x48a6f3,_0xecaada){_0x48a6f3=_0x48a6f3-0x0;var _0x4a236e=_0xe826[_0x48a6f3];return _0x4a236e;};'use strict';var _=require(_0x6e82('0x0'));var util=require(_0x6e82('0x1'));var logger=require(_0x6e82('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6e82('0x3'));var rp=require(_0x6e82('0x4'));var fs=require('fs');var path=require(_0x6e82('0x5'));var rimraf=require('rimraf');var config=require(_0x6e82('0x6'));var attributes=require(_0x6e82('0x7'));module[_0x6e82('0x8')]=function(_0x565fa7,_0x7101d9){return _0x565fa7[_0x6e82('0x9')](_0x6e82('0xa'),attributes,{'tableName':_0x6e82('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x6e82('0xc'),_0x6e82('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b79=['path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','compositeIndex','resourceId','sectionId','util','../../config/logger','api','moment','request-promise'];(function(_0x1afea4,_0x106601){var _0x3df48a=function(_0x597a7a){while(--_0x597a7a){_0x1afea4['push'](_0x1afea4['shift']());}};_0x3df48a(++_0x106601);}(_0x7b79,0xcd));var _0x97b7=function(_0x5b2a50,_0x4d327f){_0x5b2a50=_0x5b2a50-0x0;var _0x12bff8=_0x7b79[_0x5b2a50];return _0x12bff8;};'use strict';var _=require('lodash');var util=require(_0x97b7('0x0'));var logger=require(_0x97b7('0x1'))(_0x97b7('0x2'));var moment=require(_0x97b7('0x3'));var BPromise=require('bluebird');var rp=require(_0x97b7('0x4'));var fs=require('fs');var path=require(_0x97b7('0x5'));var rimraf=require(_0x97b7('0x6'));var config=require(_0x97b7('0x7'));var attributes=require(_0x97b7('0x8'));module[_0x97b7('0x9')]=function(_0x18cb5c,_0x191d7c){return _0x18cb5c['define'](_0x97b7('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x97b7('0xb'),'fields':[_0x97b7('0xc'),_0x97b7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index eaa6bf8..ed6cb1e 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 _0x5fa3=['message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x5fa3,0x192));var _0x35fa=function(_0x384f02,_0x16155b){_0x384f02=_0x384f02-0x0;var _0x31140a=_0x5fa3[_0x384f02];return _0x31140a;};'use strict';var _=require(_0x35fa('0x0'));var util=require(_0x35fa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x35fa('0x2'));var fs=require('fs');var Redis=require(_0x35fa('0x3'));var db=require(_0x35fa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x35fa('0x5'))(_0x35fa('0x6'));var config=require(_0x35fa('0x7'));var jayson=require(_0x35fa('0x8'));var client=jayson[_0x35fa('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbced09,_0x5ca767,_0x58f7ed){return new BPromise(function(_0x1b0a4a,_0x140fd6){return client[_0x35fa('0xa')](_0xbced09,_0x58f7ed)[_0x35fa('0xb')](function(_0x3bca55){logger[_0x35fa('0xc')](_0x35fa('0xd'),_0x5ca767,'request\x20sent');logger['debug'](_0x35fa('0xe'),_0x5ca767,'request\x20sent',JSON[_0x35fa('0xf')](_0x3bca55));if(_0x3bca55[_0x35fa('0x10')]){if(_0x3bca55[_0x35fa('0x10')][_0x35fa('0x11')]===0x1f4){logger[_0x35fa('0x10')](_0x35fa('0xd'),_0x5ca767,_0x3bca55['error'][_0x35fa('0x12')]);return _0x140fd6(_0x3bca55['error']['message']);}logger[_0x35fa('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x5ca767,_0x3bca55['error']['message']);return _0x1b0a4a(_0x3bca55[_0x35fa('0x10')][_0x35fa('0x12')]);}else{logger['info'](_0x35fa('0xd'),_0x5ca767,'request\x20sent');_0x1b0a4a(_0x3bca55[_0x35fa('0x13')][_0x35fa('0x12')]);}})['catch'](function(_0x2bde9d){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x5ca767,_0x2bde9d);_0x140fd6(_0x2bde9d);});});} \ No newline at end of file +var _0x9f8b=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x24222e,_0x30946){var _0x44fe67=function(_0x35d921){while(--_0x35d921){_0x24222e['push'](_0x24222e['shift']());}};_0x44fe67(++_0x30946);}(_0x9f8b,0x1f3));var _0xb9f8=function(_0x40b687,_0x3d93e3){_0x40b687=_0x40b687-0x0;var _0x1a32fa=_0x9f8b[_0x40b687];return _0x1a32fa;};'use strict';var _=require(_0xb9f8('0x0'));var util=require(_0xb9f8('0x1'));var moment=require('moment');var BPromise=require(_0xb9f8('0x2'));var rs=require(_0xb9f8('0x3'));var fs=require('fs');var Redis=require(_0xb9f8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9f8('0x5'));var logger=require(_0xb9f8('0x6'))('rpc');var config=require(_0xb9f8('0x7'));var jayson=require(_0xb9f8('0x8'));var client=jayson[_0xb9f8('0x9')][_0xb9f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x132327,_0x56f78f,_0x80d9ab){return new BPromise(function(_0x425135,_0x31af41){return client[_0xb9f8('0xb')](_0x132327,_0x80d9ab)[_0xb9f8('0xc')](function(_0x3699fc){logger[_0xb9f8('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x56f78f,_0xb9f8('0xe'));logger[_0xb9f8('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x56f78f,'request\x20sent',JSON[_0xb9f8('0x10')](_0x3699fc));if(_0x3699fc[_0xb9f8('0x11')]){if(_0x3699fc['error'][_0xb9f8('0x12')]===0x1f4){logger[_0xb9f8('0x11')](_0xb9f8('0x13'),_0x56f78f,_0x3699fc[_0xb9f8('0x11')][_0xb9f8('0x14')]);return _0x31af41(_0x3699fc[_0xb9f8('0x11')][_0xb9f8('0x14')]);}logger['error'](_0xb9f8('0x13'),_0x56f78f,_0x3699fc[_0xb9f8('0x11')][_0xb9f8('0x14')]);return _0x425135(_0x3699fc[_0xb9f8('0x11')][_0xb9f8('0x14')]);}else{logger[_0xb9f8('0xd')](_0xb9f8('0x13'),_0x56f78f,_0xb9f8('0xe'));_0x425135(_0x3699fc[_0xb9f8('0x15')][_0xb9f8('0x14')]);}})[_0xb9f8('0x16')](function(_0x27bc72){logger[_0xb9f8('0x11')](_0xb9f8('0x13'),_0x56f78f,_0x27bc72);_0x31af41(_0x27bc72);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 56a7033..8ee9d18 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 _0x774e=['create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','post'];(function(_0x1055d3,_0x22ee14){var _0x34be22=function(_0x4ca4e5){while(--_0x4ca4e5){_0x1055d3['push'](_0x1055d3['shift']());}};_0x34be22(++_0x22ee14);}(_0x774e,0xd9));var _0xe774=function(_0x38b88b,_0x1e561b){_0x38b88b=_0x38b88b-0x0;var _0x2e1ce0=_0x774e[_0x38b88b];return _0x2e1ce0;};'use strict';var multer=require('multer');var util=require(_0xe774('0x0'));var path=require(_0xe774('0x1'));var timeout=require(_0xe774('0x2'));var express=require(_0xe774('0x3'));var router=express[_0xe774('0x4')]();var fs_extra=require(_0xe774('0x5'));var auth=require(_0xe774('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe774('0x7'));var controller=require(_0xe774('0x8'));router[_0xe774('0x9')]('/',auth[_0xe774('0xa')](),controller[_0xe774('0xb')]);router[_0xe774('0x9')](_0xe774('0xc'),auth[_0xe774('0xa')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe774('0xd')]('/',auth[_0xe774('0xa')](),controller[_0xe774('0xe')]);router[_0xe774('0xf')](_0xe774('0x10'),auth['isAuthenticated'](),controller[_0xe774('0x11')]);router[_0xe774('0x12')](_0xe774('0x10'),auth['isAuthenticated'](),controller[_0xe774('0x13')]);module[_0xe774('0x14')]=router; \ No newline at end of file +var _0xea29=['exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0xea29,0x1ba));var _0x9ea2=function(_0x513f27,_0x1cbc87){_0x513f27=_0x513f27-0x0;var _0xa316b7=_0xea29[_0x513f27];return _0xa316b7;};'use strict';var multer=require('multer');var util=require(_0x9ea2('0x0'));var path=require(_0x9ea2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9ea2('0x2'));var auth=require(_0x9ea2('0x3'));var interaction=require(_0x9ea2('0x4'));var config=require(_0x9ea2('0x5'));var controller=require(_0x9ea2('0x6'));router[_0x9ea2('0x7')]('/',auth[_0x9ea2('0x8')](),controller[_0x9ea2('0x9')]);router[_0x9ea2('0x7')](_0x9ea2('0xa'),auth[_0x9ea2('0x8')](),controller[_0x9ea2('0xb')]);router['get'](_0x9ea2('0xc'),auth[_0x9ea2('0x8')](),controller[_0x9ea2('0xd')]);router[_0x9ea2('0xe')]('/',auth[_0x9ea2('0x8')](),controller[_0x9ea2('0xf')]);router[_0x9ea2('0x10')](_0x9ea2('0xc'),auth['isAuthenticated'](),controller[_0x9ea2('0x11')]);router[_0x9ea2('0x12')]('/:id',auth[_0x9ea2('0x8')](),controller[_0x9ea2('0x13')]);module[_0x9ea2('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 7746177..a2d8d8b 100644 --- a/server/api/userProfileSection/userProfileSection.attributes.js +++ b/server/api/userProfileSection/userProfileSection.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cb4=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','getDataValue','split','sequelize'];(function(_0x316ac8,_0x1eaf95){var _0x55b2db=function(_0x2b0a6c){while(--_0x2b0a6c){_0x316ac8['push'](_0x316ac8['shift']());}};_0x55b2db(++_0x1eaf95);}(_0x6cb4,0xff));var _0x46cb=function(_0x43b577,_0x2f1caa){_0x43b577=_0x43b577-0x0;var _0x5ba284=_0x6cb4[_0x43b577];return _0x5ba284;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'name':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x46cb('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x46cb('0x2')],'set':function(_0x2efd19){this['setDataValue'](_0x46cb('0x5'),_0x2efd19?_0x2efd19['join'](''):[]);},'get':function(){return this[_0x46cb('0x6')]('crudPermissions')?this[_0x46cb('0x6')](_0x46cb('0x5'))[_0x46cb('0x7')](''):[];}}}; \ No newline at end of file +var _0x1775=['INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','exports','STRING'];(function(_0x238dd5,_0x5bb9cf){var _0x3ae0ab=function(_0x29be10){while(--_0x29be10){_0x238dd5['push'](_0x238dd5['shift']());}};_0x3ae0ab(++_0x5bb9cf);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0x5177('0x0')]={'name':{'type':Sequelize[_0x5177('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x5177('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5177('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5177('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5177('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5177('0x1')],'set':function(_0x2027bf){this[_0x5177('0x4')](_0x5177('0x5'),_0x2027bf?_0x2027bf[_0x5177('0x6')](''):[]);},'get':function(){return this[_0x5177('0x7')](_0x5177('0x5'))?this[_0x5177('0x7')](_0x5177('0x5'))[_0x5177('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index fd0f444..d2af7cd 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 _0xc3aa=['Content-Range','reject','update','destroy','sendStatus','error','stack','name','index','UserProfileSection','rawAttributes','type','model','map','query','keys','intersection','attributes','fields','nolimit','order','where','filters','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count'];(function(_0xd09724,_0x1da220){var _0x3275b8=function(_0x50445c){while(--_0x50445c){_0xd09724['push'](_0xd09724['shift']());}};_0x3275b8(++_0x1da220);}(_0xc3aa,0x18e));var _0xac3a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xc3aa[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require(_0xac3a('0x0'));var rimraf=require(_0xac3a('0x1'));var zipdir=require(_0xac3a('0x2'));var jsonpatch=require(_0xac3a('0x3'));var rp=require('request-promise');var moment=require(_0xac3a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xac3a('0x5'));var util=require(_0xac3a('0x6'));var path=require('path');var sox=require(_0xac3a('0x7'));var csv=require(_0xac3a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac3a('0x9'));var _=require(_0xac3a('0xa'));var squel=require(_0xac3a('0xb'));var crypto=require(_0xac3a('0xc'));var jsforce=require(_0xac3a('0xd'));var deskjs=require(_0xac3a('0xe'));var toCsv=require(_0xac3a('0x8'));var querystring=require(_0xac3a('0xf'));var Papa=require(_0xac3a('0x10'));var Redis=require(_0xac3a('0x11'));var authService=require(_0xac3a('0x12'));var qs=require(_0xac3a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac3a('0x14'));var logger=require(_0xac3a('0x15'))(_0xac3a('0x16'));var utils=require(_0xac3a('0x17'));var config=require(_0xac3a('0x18'));var licenseUtil=require(_0xac3a('0x19'));var db=require(_0xac3a('0x1a'))['db'];function respondWithStatusCode(_0x3eae12,_0x2ab1be){_0x2ab1be=_0x2ab1be||0xcc;return function(_0x232567){if(_0x232567){return _0x3eae12['sendStatus'](_0x2ab1be);}return _0x3eae12['status'](_0x2ab1be)[_0xac3a('0x1b')]();};}function respondWithResult(_0x182670,_0x468a7e){_0x468a7e=_0x468a7e||0xc8;return function(_0x31db88){if(_0x31db88){return _0x182670[_0xac3a('0x1c')](_0x468a7e)[_0xac3a('0x1d')](_0x31db88);}};}function respondWithFilteredResult(_0x2d3038,_0xc2645f){return function(_0x264b89){if(_0x264b89){var _0x274e1c=typeof _0xc2645f[_0xac3a('0x1e')]===_0xac3a('0x1f')&&typeof _0xc2645f[_0xac3a('0x20')]==='undefined';var _0xd5036a=_0x264b89['count'];var _0x114cd1=_0x274e1c?0x0:_0xc2645f[_0xac3a('0x1e')];var _0x1e877d=_0x274e1c?_0x264b89[_0xac3a('0x21')]:_0xc2645f[_0xac3a('0x1e')]+_0xc2645f[_0xac3a('0x20')];var _0x560586;if(_0x1e877d>=_0xd5036a){_0x1e877d=_0xd5036a;_0x560586=0xc8;}else{_0x560586=0xce;}_0x2d3038[_0xac3a('0x1c')](_0x560586);return _0x2d3038['set'](_0xac3a('0x22'),_0x114cd1+'-'+_0x1e877d+'/'+_0xd5036a)[_0xac3a('0x1d')](_0x264b89);}return null;};}function patchUpdates(_0x5ace80){return function(_0x230863){try{jsonpatch['apply'](_0x230863,_0x5ace80,!![]);}catch(_0x116f51){return BPromise[_0xac3a('0x23')](_0x116f51);}return _0x230863['save']();};}function saveUpdates(_0x40bcd1,_0x1a1fda){return function(_0x19166b){if(_0x19166b){return _0x19166b[_0xac3a('0x24')](_0x40bcd1)['then'](function(_0x32e89f){return _0x32e89f;});}return null;};}function removeEntity(_0x5f0708,_0x4f1e3d){return function(_0x5b8d5d){if(_0x5b8d5d){return _0x5b8d5d[_0xac3a('0x25')]()['then'](function(){_0x5f0708[_0xac3a('0x1c')](0xcc)[_0xac3a('0x1b')]();});}};}function handleEntityNotFound(_0x4289db,_0x457d42){return function(_0x121393){if(!_0x121393){_0x4289db[_0xac3a('0x26')](0x194);}return _0x121393;};}function handleError(_0x2ef548,_0x3fe27b){_0x3fe27b=_0x3fe27b||0x1f4;return function(_0x5fb9ce){logger[_0xac3a('0x27')](_0x5fb9ce[_0xac3a('0x28')]);if(_0x5fb9ce['name']){delete _0x5fb9ce[_0xac3a('0x29')];}_0x2ef548[_0xac3a('0x1c')](_0x3fe27b)['send'](_0x5fb9ce);};}exports[_0xac3a('0x2a')]=function(_0x1f8007,_0x56d47b){var _0x223473={},_0x36ccfc={},_0x326a46={'count':0x0,'rows':[]};var _0x381aba=_['map'](db[_0xac3a('0x2b')][_0xac3a('0x2c')],function(_0x30a5b8){return{'name':_0x30a5b8['fieldName'],'type':_0x30a5b8[_0xac3a('0x2d')]['key']};});_0x36ccfc[_0xac3a('0x2e')]=_[_0xac3a('0x2f')](_0x381aba,_0xac3a('0x29'));_0x36ccfc[_0xac3a('0x30')]=_[_0xac3a('0x31')](_0x1f8007[_0xac3a('0x30')]);_0x36ccfc['filters']=_[_0xac3a('0x32')](_0x36ccfc['model'],_0x36ccfc['query']);_0x223473[_0xac3a('0x33')]=_[_0xac3a('0x32')](_0x36ccfc['model'],qs[_0xac3a('0x34')](_0x1f8007[_0xac3a('0x30')][_0xac3a('0x34')]));_0x223473[_0xac3a('0x33')]=_0x223473[_0xac3a('0x33')]['length']?_0x223473[_0xac3a('0x33')]:_0x36ccfc[_0xac3a('0x2e')];if(!_0x1f8007['query']['hasOwnProperty'](_0xac3a('0x35'))){_0x223473[_0xac3a('0x20')]=qs['limit'](_0x1f8007['query']['limit']);_0x223473['offset']=qs[_0xac3a('0x1e')](_0x1f8007[_0xac3a('0x30')][_0xac3a('0x1e')]);}_0x223473[_0xac3a('0x36')]=qs['sort'](_0x1f8007[_0xac3a('0x30')]['sort']);_0x223473[_0xac3a('0x37')]=qs[_0xac3a('0x38')](_['pick'](_0x1f8007['query'],_0x36ccfc[_0xac3a('0x38')]),_0x381aba);if(_0x1f8007[_0xac3a('0x30')][_0xac3a('0x39')]){_0x223473[_0xac3a('0x37')]=_[_0xac3a('0x3a')](_0x223473[_0xac3a('0x37')],{'$or':_[_0xac3a('0x2f')](_0x381aba,function(_0x10ab2e){if(_0x10ab2e[_0xac3a('0x2d')]!==_0xac3a('0x3b')){var _0x53668d={};_0x53668d[_0x10ab2e['name']]={'$like':'%'+_0x1f8007[_0xac3a('0x30')][_0xac3a('0x39')]+'%'};return _0x53668d;}})});}_0x223473=_[_0xac3a('0x3a')]({},_0x223473,_0x1f8007[_0xac3a('0x3c')]);var _0x303ca5={'where':_0x223473[_0xac3a('0x37')]};return db[_0xac3a('0x2b')][_0xac3a('0x21')](_0x303ca5)[_0xac3a('0x3d')](function(_0x581176){_0x326a46['count']=_0x581176;if(_0x1f8007[_0xac3a('0x30')][_0xac3a('0x3e')]){_0x223473[_0xac3a('0x3f')]=[{'all':!![]}];}return db[_0xac3a('0x2b')][_0xac3a('0x40')](_0x223473);})[_0xac3a('0x3d')](function(_0x473f2a){_0x326a46[_0xac3a('0x41')]=_0x473f2a;return _0x326a46;})[_0xac3a('0x3d')](respondWithFilteredResult(_0x56d47b,_0x223473))[_0xac3a('0x42')](handleError(_0x56d47b,null));};exports[_0xac3a('0x43')]=function(_0x2a337b,_0x840b2d){var _0x76d4bd={'raw':![],'where':{'id':_0x2a337b['params']['id']}},_0x5ddfe5={};_0x5ddfe5[_0xac3a('0x2e')]=_['keys'](db[_0xac3a('0x2b')][_0xac3a('0x2c')]);_0x5ddfe5[_0xac3a('0x30')]=_['keys'](_0x2a337b[_0xac3a('0x30')]);_0x5ddfe5[_0xac3a('0x38')]=_[_0xac3a('0x32')](_0x5ddfe5[_0xac3a('0x2e')],_0x5ddfe5['query']);_0x76d4bd[_0xac3a('0x33')]=_['intersection'](_0x5ddfe5[_0xac3a('0x2e')],qs[_0xac3a('0x34')](_0x2a337b[_0xac3a('0x30')][_0xac3a('0x34')]));_0x76d4bd[_0xac3a('0x33')]=_0x76d4bd['attributes']['length']?_0x76d4bd[_0xac3a('0x33')]:_0x5ddfe5['model'];if(_0x2a337b['query']['includeAll']){_0x76d4bd['include']=[{'all':!![]}];}_0x76d4bd=_[_0xac3a('0x3a')]({},_0x76d4bd,_0x2a337b[_0xac3a('0x3c')]);return db[_0xac3a('0x2b')][_0xac3a('0x44')](_0x76d4bd)[_0xac3a('0x3d')](handleEntityNotFound(_0x840b2d,null))[_0xac3a('0x3d')](respondWithResult(_0x840b2d,null))[_0xac3a('0x42')](handleError(_0x840b2d,null));};exports['create']=function(_0x54c2b0,_0x5e747b){return db[_0xac3a('0x2b')][_0xac3a('0x45')](_0x54c2b0[_0xac3a('0x46')],{})['then'](respondWithResult(_0x5e747b,0xc9))[_0xac3a('0x42')](handleError(_0x5e747b,null));};exports['update']=function(_0x591a9d,_0x2f1590){if(_0x591a9d[_0xac3a('0x46')]['id']){delete _0x591a9d['body']['id'];}return db[_0xac3a('0x2b')][_0xac3a('0x44')]({'where':{'id':_0x591a9d[_0xac3a('0x47')]['id']}})[_0xac3a('0x3d')](handleEntityNotFound(_0x2f1590,null))[_0xac3a('0x3d')](saveUpdates(_0x591a9d[_0xac3a('0x46')],null))[_0xac3a('0x3d')](respondWithResult(_0x2f1590,null))['catch'](handleError(_0x2f1590,null));};exports[_0xac3a('0x25')]=function(_0x20bf3d,_0x2588c0){return db[_0xac3a('0x2b')][_0xac3a('0x44')]({'where':{'id':_0x20bf3d[_0xac3a('0x47')]['id']}})[_0xac3a('0x3d')](handleEntityNotFound(_0x2588c0,null))[_0xac3a('0x3d')](removeEntity(_0x2588c0,null))[_0xac3a('0x42')](handleError(_0x2588c0,null));};exports['describe']=function(_0x1b65e1,_0x4148f9){return db['UserProfileSection']['describe']()[_0xac3a('0x3d')](respondWithResult(_0x4148f9,null))[_0xac3a('0x42')](handleError(_0x4148f9,null));}; \ No newline at end of file +var _0x6eec=['keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','UserProfileSection','rows','catch','show','params','length','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query'];(function(_0x4bbbc0,_0x532cde){var _0x4b0977=function(_0x100c74){while(--_0x100c74){_0x4bbbc0['push'](_0x4bbbc0['shift']());}};_0x4b0977(++_0x532cde);}(_0x6eec,0x152));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc6ee('0x0'));var rimraf=require(_0xc6ee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6ee('0x2'));var rp=require(_0xc6ee('0x3'));var moment=require(_0xc6ee('0x4'));var BPromise=require(_0xc6ee('0x5'));var Mustache=require(_0xc6ee('0x6'));var util=require('util');var path=require(_0xc6ee('0x7'));var sox=require(_0xc6ee('0x8'));var csv=require('to-csv');var ejs=require(_0xc6ee('0x9'));var fs=require('fs');var fs_extra=require(_0xc6ee('0xa'));var _=require('lodash');var squel=require(_0xc6ee('0xb'));var crypto=require(_0xc6ee('0xc'));var jsforce=require(_0xc6ee('0xd'));var deskjs=require(_0xc6ee('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc6ee('0xf'));var Papa=require(_0xc6ee('0x10'));var Redis=require(_0xc6ee('0x11'));var authService=require(_0xc6ee('0x12'));var qs=require(_0xc6ee('0x13'));var as=require(_0xc6ee('0x14'));var hardwareService=require(_0xc6ee('0x15'));var logger=require('../../config/logger')(_0xc6ee('0x16'));var utils=require(_0xc6ee('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc6ee('0x18'))['db'];function respondWithStatusCode(_0x495e75,_0xfb6e12){_0xfb6e12=_0xfb6e12||0xcc;return function(_0x3f2f58){if(_0x3f2f58){return _0x495e75['sendStatus'](_0xfb6e12);}return _0x495e75['status'](_0xfb6e12)['end']();};}function respondWithResult(_0x5859d6,_0x54c9fb){_0x54c9fb=_0x54c9fb||0xc8;return function(_0x32ff1f){if(_0x32ff1f){return _0x5859d6[_0xc6ee('0x19')](_0x54c9fb)['json'](_0x32ff1f);}};}function respondWithFilteredResult(_0x40298d,_0x104e61){return function(_0x34b0cd){if(_0x34b0cd){var _0x4d0fc0=typeof _0x104e61[_0xc6ee('0x1a')]===_0xc6ee('0x1b')&&typeof _0x104e61[_0xc6ee('0x1c')]===_0xc6ee('0x1b');var _0x315a9f=_0x34b0cd[_0xc6ee('0x1d')];var _0x571a6c=_0x4d0fc0?0x0:_0x104e61['offset'];var _0x47253b=_0x4d0fc0?_0x34b0cd[_0xc6ee('0x1d')]:_0x104e61[_0xc6ee('0x1a')]+_0x104e61[_0xc6ee('0x1c')];var _0x1e8f7d;if(_0x47253b>=_0x315a9f){_0x47253b=_0x315a9f;_0x1e8f7d=0xc8;}else{_0x1e8f7d=0xce;}_0x40298d['status'](_0x1e8f7d);return _0x40298d[_0xc6ee('0x1e')](_0xc6ee('0x1f'),_0x571a6c+'-'+_0x47253b+'/'+_0x315a9f)[_0xc6ee('0x20')](_0x34b0cd);}return null;};}function patchUpdates(_0x1ba66d){return function(_0x51cc8b){try{jsonpatch[_0xc6ee('0x21')](_0x51cc8b,_0x1ba66d,!![]);}catch(_0x13e40e){return BPromise[_0xc6ee('0x22')](_0x13e40e);}return _0x51cc8b[_0xc6ee('0x23')]();};}function saveUpdates(_0x17865d,_0x2854){return function(_0x56915c){if(_0x56915c){return _0x56915c[_0xc6ee('0x24')](_0x17865d)['then'](function(_0x4ef71a){return _0x4ef71a;});}return null;};}function removeEntity(_0x5b07de,_0x384bea){return function(_0x1b7a39){if(_0x1b7a39){return _0x1b7a39[_0xc6ee('0x25')]()[_0xc6ee('0x26')](function(){_0x5b07de[_0xc6ee('0x19')](0xcc)[_0xc6ee('0x27')]();});}};}function handleEntityNotFound(_0x5e8f22,_0x5bbed7){return function(_0x310140){if(!_0x310140){_0x5e8f22[_0xc6ee('0x28')](0x194);}return _0x310140;};}function handleError(_0x42a08c,_0x4f4832){_0x4f4832=_0x4f4832||0x1f4;return function(_0xf5743d){logger[_0xc6ee('0x29')](_0xf5743d[_0xc6ee('0x2a')]);if(_0xf5743d[_0xc6ee('0x2b')]){delete _0xf5743d['name'];}_0x42a08c[_0xc6ee('0x19')](_0x4f4832)[_0xc6ee('0x2c')](_0xf5743d);};}exports[_0xc6ee('0x2d')]=function(_0x5899d7,_0x37d321){var _0xd303d9={},_0x652106={},_0x463768={'count':0x0,'rows':[]};var _0x4088b2=_[_0xc6ee('0x2e')](db['UserProfileSection'][_0xc6ee('0x2f')],function(_0x5ac423){return{'name':_0x5ac423['fieldName'],'type':_0x5ac423[_0xc6ee('0x30')][_0xc6ee('0x31')]};});_0x652106[_0xc6ee('0x32')]=_[_0xc6ee('0x2e')](_0x4088b2,_0xc6ee('0x2b'));_0x652106[_0xc6ee('0x33')]=_[_0xc6ee('0x34')](_0x5899d7[_0xc6ee('0x33')]);_0x652106['filters']=_[_0xc6ee('0x35')](_0x652106[_0xc6ee('0x32')],_0x652106[_0xc6ee('0x33')]);_0xd303d9[_0xc6ee('0x36')]=_[_0xc6ee('0x35')](_0x652106[_0xc6ee('0x32')],qs[_0xc6ee('0x37')](_0x5899d7[_0xc6ee('0x33')][_0xc6ee('0x37')]));_0xd303d9[_0xc6ee('0x36')]=_0xd303d9['attributes']['length']?_0xd303d9['attributes']:_0x652106[_0xc6ee('0x32')];if(!_0x5899d7['query'][_0xc6ee('0x38')](_0xc6ee('0x39'))){_0xd303d9[_0xc6ee('0x1c')]=qs[_0xc6ee('0x1c')](_0x5899d7[_0xc6ee('0x33')][_0xc6ee('0x1c')]);_0xd303d9[_0xc6ee('0x1a')]=qs[_0xc6ee('0x1a')](_0x5899d7['query']['offset']);}_0xd303d9['order']=qs['sort'](_0x5899d7[_0xc6ee('0x33')][_0xc6ee('0x3a')]);_0xd303d9[_0xc6ee('0x3b')]=qs[_0xc6ee('0x3c')](_[_0xc6ee('0x3d')](_0x5899d7[_0xc6ee('0x33')],_0x652106[_0xc6ee('0x3c')]),_0x4088b2);if(_0x5899d7[_0xc6ee('0x33')]['filter']){_0xd303d9[_0xc6ee('0x3b')]=_[_0xc6ee('0x3e')](_0xd303d9['where'],{'$or':_[_0xc6ee('0x2e')](_0x4088b2,function(_0x1101ab){if(_0x1101ab['type']!==_0xc6ee('0x3f')){var _0x5ba781={};_0x5ba781[_0x1101ab[_0xc6ee('0x2b')]]={'$like':'%'+_0x5899d7[_0xc6ee('0x33')][_0xc6ee('0x40')]+'%'};return _0x5ba781;}})});}_0xd303d9=_[_0xc6ee('0x3e')]({},_0xd303d9,_0x5899d7[_0xc6ee('0x41')]);var _0x3c3d3b={'where':_0xd303d9[_0xc6ee('0x3b')]};return db['UserProfileSection'][_0xc6ee('0x1d')](_0x3c3d3b)[_0xc6ee('0x26')](function(_0x188d88){_0x463768[_0xc6ee('0x1d')]=_0x188d88;if(_0x5899d7[_0xc6ee('0x33')][_0xc6ee('0x42')]){_0xd303d9[_0xc6ee('0x43')]=[{'all':!![]}];}return db[_0xc6ee('0x44')]['findAll'](_0xd303d9);})[_0xc6ee('0x26')](function(_0x4ba0f4){_0x463768[_0xc6ee('0x45')]=_0x4ba0f4;return _0x463768;})[_0xc6ee('0x26')](respondWithFilteredResult(_0x37d321,_0xd303d9))[_0xc6ee('0x46')](handleError(_0x37d321,null));};exports[_0xc6ee('0x47')]=function(_0xdca5ed,_0x5a6035){var _0x393f4b={'raw':![],'where':{'id':_0xdca5ed[_0xc6ee('0x48')]['id']}},_0x3c9e78={};_0x3c9e78[_0xc6ee('0x32')]=_['keys'](db['UserProfileSection'][_0xc6ee('0x2f')]);_0x3c9e78[_0xc6ee('0x33')]=_[_0xc6ee('0x34')](_0xdca5ed[_0xc6ee('0x33')]);_0x3c9e78[_0xc6ee('0x3c')]=_[_0xc6ee('0x35')](_0x3c9e78[_0xc6ee('0x32')],_0x3c9e78[_0xc6ee('0x33')]);_0x393f4b[_0xc6ee('0x36')]=_[_0xc6ee('0x35')](_0x3c9e78['model'],qs[_0xc6ee('0x37')](_0xdca5ed[_0xc6ee('0x33')][_0xc6ee('0x37')]));_0x393f4b['attributes']=_0x393f4b[_0xc6ee('0x36')][_0xc6ee('0x49')]?_0x393f4b[_0xc6ee('0x36')]:_0x3c9e78['model'];if(_0xdca5ed[_0xc6ee('0x33')][_0xc6ee('0x42')]){_0x393f4b[_0xc6ee('0x43')]=[{'all':!![]}];}_0x393f4b=_[_0xc6ee('0x3e')]({},_0x393f4b,_0xdca5ed[_0xc6ee('0x41')]);return db[_0xc6ee('0x44')]['find'](_0x393f4b)['then'](handleEntityNotFound(_0x5a6035,null))[_0xc6ee('0x26')](respondWithResult(_0x5a6035,null))[_0xc6ee('0x46')](handleError(_0x5a6035,null));};exports['create']=function(_0x109209,_0x3ade76){return db['UserProfileSection'][_0xc6ee('0x4a')](_0x109209[_0xc6ee('0x4b')],{})['then'](respondWithResult(_0x3ade76,0xc9))[_0xc6ee('0x46')](handleError(_0x3ade76,null));};exports[_0xc6ee('0x24')]=function(_0x1de409,_0x4ffcc8){if(_0x1de409[_0xc6ee('0x4b')]['id']){delete _0x1de409['body']['id'];}return db[_0xc6ee('0x44')][_0xc6ee('0x4c')]({'where':{'id':_0x1de409['params']['id']}})[_0xc6ee('0x26')](handleEntityNotFound(_0x4ffcc8,null))[_0xc6ee('0x26')](saveUpdates(_0x1de409[_0xc6ee('0x4b')],null))[_0xc6ee('0x26')](respondWithResult(_0x4ffcc8,null))[_0xc6ee('0x46')](handleError(_0x4ffcc8,null));};exports[_0xc6ee('0x25')]=function(_0x2ae1a9,_0x4d3312){return db[_0xc6ee('0x44')][_0xc6ee('0x4c')]({'where':{'id':_0x2ae1a9[_0xc6ee('0x48')]['id']}})[_0xc6ee('0x26')](handleEntityNotFound(_0x4d3312,null))[_0xc6ee('0x26')](removeEntity(_0x4d3312,null))['catch'](handleError(_0x4d3312,null));};exports[_0xc6ee('0x4d')]=function(_0x35b754,_0x315bfa){return db[_0xc6ee('0x44')][_0xc6ee('0x4d')]()['then'](respondWithResult(_0x315bfa,null))[_0xc6ee('0x46')](handleError(_0x315bfa,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 812447d..ef1ee04 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 _0xd6ff=['./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2bf032,_0x42a60e){var _0x2d6cae=function(_0x442cd1){while(--_0x442cd1){_0x2bf032['push'](_0x2bf032['shift']());}};_0x2d6cae(++_0x42a60e);}(_0xd6ff,0x76));var _0xfd6f=function(_0xceae51,_0x54d325){_0xceae51=_0xceae51-0x0;var _0x587390=_0xd6ff[_0xceae51];return _0x587390;};'use strict';var _=require('lodash');var util=require(_0xfd6f('0x0'));var logger=require(_0xfd6f('0x1'))(_0xfd6f('0x2'));var moment=require(_0xfd6f('0x3'));var BPromise=require('bluebird');var rp=require(_0xfd6f('0x4'));var fs=require('fs');var path=require(_0xfd6f('0x5'));var rimraf=require(_0xfd6f('0x6'));var config=require(_0xfd6f('0x7'));var attributes=require(_0xfd6f('0x8'));module[_0xfd6f('0x9')]=function(_0x28d14f,_0x5b737e){return _0x28d14f[_0xfd6f('0xa')](_0xfd6f('0xb'),attributes,{'tableName':_0xfd6f('0xc'),'paranoid':![],'indexes':[{'name':_0xfd6f('0xd'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5c8=['lodash','util','../../config/logger','moment','path','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId'];(function(_0x9174d,_0x2c16d7){var _0x60fee8=function(_0x480920){while(--_0x480920){_0x9174d['push'](_0x9174d['shift']());}};_0x60fee8(++_0x2c16d7);}(_0xc5c8,0x118));var _0x8c5c=function(_0x285b94,_0x1b9c45){_0x285b94=_0x285b94-0x0;var _0x5f336a=_0xc5c8[_0x285b94];return _0x5f336a;};'use strict';var _=require(_0x8c5c('0x0'));var util=require(_0x8c5c('0x1'));var logger=require(_0x8c5c('0x2'))('api');var moment=require(_0x8c5c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c5c('0x4'));var rimraf=require(_0x8c5c('0x5'));var config=require('../../config/environment');var attributes=require(_0x8c5c('0x6'));module[_0x8c5c('0x7')]=function(_0x390b86,_0x2e297d){return _0x390b86[_0x8c5c('0x8')](_0x8c5c('0x9'),attributes,{'tableName':_0x8c5c('0xa'),'paranoid':![],'indexes':[{'name':_0x8c5c('0xb'),'fields':[_0x8c5c('0xc'),_0x8c5c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index fda7844..8277c48 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 _0x47d3=['request\x20sent','stringify','error','code','message','info','result','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x57c5a7,_0x2800cc){var _0x3f07f5=function(_0x1eb113){while(--_0x1eb113){_0x57c5a7['push'](_0x57c5a7['shift']());}};_0x3f07f5(++_0x2800cc);}(_0x47d3,0x16c));var _0x347d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x47d3[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x347d('0x0'));var util=require(_0x347d('0x1'));var moment=require('moment');var BPromise=require(_0x347d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x347d('0x3'))['db'];var utils=require(_0x347d('0x4'));var logger=require(_0x347d('0x5'))(_0x347d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x347d('0x7')][_0x347d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d7cf1,_0x3406a6,_0x136202){return new BPromise(function(_0x164314,_0x19c2ad){return client[_0x347d('0x9')](_0x2d7cf1,_0x136202)[_0x347d('0xa')](function(_0x18c227){logger['info'](_0x347d('0xb'),_0x3406a6,'request\x20sent');logger[_0x347d('0xc')](_0x347d('0xd'),_0x3406a6,_0x347d('0xe'),JSON[_0x347d('0xf')](_0x18c227));if(_0x18c227[_0x347d('0x10')]){if(_0x18c227[_0x347d('0x10')][_0x347d('0x11')]===0x1f4){logger[_0x347d('0x10')](_0x347d('0xb'),_0x3406a6,_0x18c227[_0x347d('0x10')][_0x347d('0x12')]);return _0x19c2ad(_0x18c227[_0x347d('0x10')][_0x347d('0x12')]);}logger[_0x347d('0x10')](_0x347d('0xb'),_0x3406a6,_0x18c227[_0x347d('0x10')]['message']);return _0x164314(_0x18c227['error'][_0x347d('0x12')]);}else{logger[_0x347d('0x13')](_0x347d('0xb'),_0x3406a6,_0x347d('0xe'));_0x164314(_0x18c227[_0x347d('0x14')][_0x347d('0x12')]);}})['catch'](function(_0x144322){logger[_0x347d('0x10')](_0x347d('0xb'),_0x3406a6,_0x144322);_0x19c2ad(_0x144322);});});} \ No newline at end of file +var _0x51cd=['ioredis','../../mysqldb','rpc','jayson/promise','client','http','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','randomstring'];(function(_0x584863,_0x2d9880){var _0x1dde2a=function(_0x55fbd1){while(--_0x55fbd1){_0x584863['push'](_0x584863['shift']());}};_0x1dde2a(++_0x2d9880);}(_0x51cd,0x141));var _0xd51c=function(_0x8284f4,_0x258d1f){_0x8284f4=_0x8284f4-0x0;var _0x93b710=_0x51cd[_0x8284f4];return _0x93b710;};'use strict';var _=require(_0xd51c('0x0'));var util=require(_0xd51c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd51c('0x2'));var fs=require('fs');var Redis=require(_0xd51c('0x3'));var db=require(_0xd51c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd51c('0x5'));var config=require('../../config/environment');var jayson=require(_0xd51c('0x6'));var client=jayson[_0xd51c('0x7')][_0xd51c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25d9e2,_0x2c9344,_0x41020c){return new BPromise(function(_0x43ce50,_0x47698d){return client['request'](_0x25d9e2,_0x41020c)['then'](function(_0x473104){logger[_0xd51c('0x9')](_0xd51c('0xa'),_0x2c9344,_0xd51c('0xb'));logger[_0xd51c('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2c9344,_0xd51c('0xb'),JSON[_0xd51c('0xd')](_0x473104));if(_0x473104[_0xd51c('0xe')]){if(_0x473104['error']['code']===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2c9344,_0x473104[_0xd51c('0xe')][_0xd51c('0xf')]);return _0x47698d(_0x473104[_0xd51c('0xe')][_0xd51c('0xf')]);}logger[_0xd51c('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2c9344,_0x473104[_0xd51c('0xe')]['message']);return _0x43ce50(_0x473104['error'][_0xd51c('0xf')]);}else{logger[_0xd51c('0x9')]('UserProfileSection,\x20%s,\x20%s',_0x2c9344,_0xd51c('0xb'));_0x43ce50(_0x473104[_0xd51c('0x10')]['message']);}})[_0xd51c('0x11')](function(_0xcb8b86){logger[_0xd51c('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2c9344,_0xcb8b86);_0x47698d(_0xcb8b86);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 0d42b43..63f2b81 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x47bbd5,_0xfab6bc){var _0xea2a13=function(_0xc1964c){while(--_0xc1964c){_0x47bbd5['push'](_0x47bbd5['shift']());}};_0xea2a13(++_0xfab6bc);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5ebd54,_0x928763){var _0x5f53f5=function(_0x380b5f){while(--_0x380b5f){_0x5ebd54['push'](_0x5ebd54['shift']());}};_0x5f53f5(++_0x928763);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index c21f58e..d257005 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 _0x5e76=['INTEGER'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x5e76,0x16e));var _0x65e7=function(_0x3124ab,_0x105eca){_0x3124ab=_0x3124ab-0x0;var _0x5df462=_0x5e76[_0x3124ab];return _0x5df462;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x65e7('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x00e9=['INTEGER','sequelize','exports'];(function(_0x504113,_0x5b7ea4){var _0x549056=function(_0x91c35c){while(--_0x91c35c){_0x504113['push'](_0x504113['shift']());}};_0x549056(++_0x5b7ea4);}(_0x00e9,0x10f));var _0x900e=function(_0x4cc207,_0x73afa6){_0x4cc207=_0x4cc207-0x0;var _0x5ac6e5=_0x00e9[_0x4cc207];return _0x5ac6e5;};'use strict';var Sequelize=require(_0x900e('0x0'));module[_0x900e('0x1')]={'penalty':{'type':Sequelize[_0x900e('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 42fda98..e4551fe 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 _0x1883=['../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1c797a,_0x33a805){var _0x3b7d80=function(_0x29a9b5){while(--_0x29a9b5){_0x1c797a['push'](_0x1c797a['shift']());}};_0x3b7d80(++_0x33a805);}(_0x1883,0xab));var _0x3188=function(_0x5c4242,_0x4d185f){_0x5c4242=_0x5c4242-0x0;var _0x3f8fd2=_0x1883[_0x5c4242];return _0x3f8fd2;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdeb3=['./userSmsQueue.attributes','define','user_has_sms_queues','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x134764,_0x112da5){var _0x2fe527=function(_0x7db51d){while(--_0x7db51d){_0x134764['push'](_0x134764['shift']());}};_0x2fe527(++_0x112da5);}(_0xdeb3,0xb7));var _0x3deb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdeb3[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x3deb('0x0'));var logger=require(_0x3deb('0x1'))(_0x3deb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3deb('0x3'));var fs=require('fs');var path=require(_0x3deb('0x4'));var rimraf=require(_0x3deb('0x5'));var config=require(_0x3deb('0x6'));var attributes=require(_0x3deb('0x7'));module['exports']=function(_0x193700,_0x47d2d4){return _0x193700[_0x3deb('0x8')]('UserSmsQueue',attributes,{'tableName':_0x3deb('0x9'),'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 fcb8a23..d91dd96 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 _0x041c=['request','then','request\x20sent','debug','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x28fca4,_0x11e78b){var _0x42fd01=function(_0x33a97e){while(--_0x33a97e){_0x28fca4['push'](_0x28fca4['shift']());}};_0x42fd01(++_0x11e78b);}(_0x041c,0x1bf));var _0xc041=function(_0x16898f,_0xc3aa){_0x16898f=_0x16898f-0x0;var _0x1dd1c7=_0x041c[_0x16898f];return _0x1dd1c7;};'use strict';var _=require(_0xc041('0x0'));var util=require(_0xc041('0x1'));var moment=require(_0xc041('0x2'));var BPromise=require(_0xc041('0x3'));var rs=require(_0xc041('0x4'));var fs=require('fs');var Redis=require(_0xc041('0x5'));var db=require(_0xc041('0x6'))['db'];var utils=require(_0xc041('0x7'));var logger=require(_0xc041('0x8'))(_0xc041('0x9'));var config=require(_0xc041('0xa'));var jayson=require(_0xc041('0xb'));var client=jayson[_0xc041('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x689848,_0x6377ff,_0x1b6a54){return new BPromise(function(_0xb75e90,_0xf885a5){return client[_0xc041('0xd')](_0x689848,_0x1b6a54)[_0xc041('0xe')](function(_0x510e10){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x6377ff,_0xc041('0xf'));logger[_0xc041('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x6377ff,_0xc041('0xf'),JSON[_0xc041('0x11')](_0x510e10));if(_0x510e10[_0xc041('0x12')]){if(_0x510e10[_0xc041('0x12')][_0xc041('0x13')]===0x1f4){logger[_0xc041('0x12')](_0xc041('0x14'),_0x6377ff,_0x510e10['error'][_0xc041('0x15')]);return _0xf885a5(_0x510e10[_0xc041('0x12')][_0xc041('0x15')]);}logger[_0xc041('0x12')](_0xc041('0x14'),_0x6377ff,_0x510e10[_0xc041('0x12')][_0xc041('0x15')]);return _0xb75e90(_0x510e10['error'][_0xc041('0x15')]);}else{logger[_0xc041('0x16')]('UserSmsQueue,\x20%s,\x20%s',_0x6377ff,'request\x20sent');_0xb75e90(_0x510e10['result'][_0xc041('0x15')]);}})['catch'](function(_0x1af715){logger[_0xc041('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x6377ff,_0x1af715);_0xf885a5(_0x1af715);});});} \ No newline at end of file +var _0xfd49=['http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client'];(function(_0x208d9e,_0x2f31ae){var _0x23ae73=function(_0x18d0ee){while(--_0x18d0ee){_0x208d9e['push'](_0x208d9e['shift']());}};_0x23ae73(++_0x2f31ae);}(_0xfd49,0xea));var _0x9fd4=function(_0x5da107,_0x10357c){_0x5da107=_0x5da107-0x0;var _0x224f15=_0xfd49[_0x5da107];return _0x224f15;};'use strict';var _=require(_0x9fd4('0x0'));var util=require('util');var moment=require(_0x9fd4('0x1'));var BPromise=require('bluebird');var rs=require(_0x9fd4('0x2'));var fs=require('fs');var Redis=require(_0x9fd4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9fd4('0x4'))(_0x9fd4('0x5'));var config=require('../../config/environment');var jayson=require(_0x9fd4('0x6'));var client=jayson[_0x9fd4('0x7')][_0x9fd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c2127,_0x4c46b0,_0x3db339){return new BPromise(function(_0x17c1fe,_0x449810){return client[_0x9fd4('0x9')](_0x4c2127,_0x3db339)[_0x9fd4('0xa')](function(_0x1f3585){logger[_0x9fd4('0xb')](_0x9fd4('0xc'),_0x4c46b0,_0x9fd4('0xd'));logger[_0x9fd4('0xe')](_0x9fd4('0xf'),_0x4c46b0,_0x9fd4('0xd'),JSON[_0x9fd4('0x10')](_0x1f3585));if(_0x1f3585[_0x9fd4('0x11')]){if(_0x1f3585[_0x9fd4('0x11')][_0x9fd4('0x12')]===0x1f4){logger['error'](_0x9fd4('0xc'),_0x4c46b0,_0x1f3585[_0x9fd4('0x11')][_0x9fd4('0x13')]);return _0x449810(_0x1f3585[_0x9fd4('0x11')][_0x9fd4('0x13')]);}logger[_0x9fd4('0x11')](_0x9fd4('0xc'),_0x4c46b0,_0x1f3585[_0x9fd4('0x11')][_0x9fd4('0x13')]);return _0x17c1fe(_0x1f3585[_0x9fd4('0x11')][_0x9fd4('0x13')]);}else{logger[_0x9fd4('0xb')](_0x9fd4('0xc'),_0x4c46b0,'request\x20sent');_0x17c1fe(_0x1f3585[_0x9fd4('0x14')][_0x9fd4('0x13')]);}})[_0x9fd4('0x15')](function(_0x3b5f66){logger[_0x9fd4('0x11')](_0x9fd4('0xc'),_0x4c46b0,_0x3b5f66);_0x449810(_0x3b5f66);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/index.js b/server/api/userVoicePrefix/index.js index 17ebde5..0da6ef1 100644 --- a/server/api/userVoicePrefix/index.js +++ b/server/api/userVoicePrefix/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1cf072,_0x3cb849){var _0x42cc8c=function(_0x422113){while(--_0x422113){_0x1cf072['push'](_0x1cf072['shift']());}};_0x42cc8c(++_0x3cb849);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5568bf,_0x1d1e49){var _0x1f1049=function(_0x240897){while(--_0x240897){_0x5568bf['push'](_0x5568bf['shift']());}};_0x1f1049(++_0x1d1e49);}(_0xe706,0xa3));var _0x6e70=function(_0xdd27d1,_0xb6f0da){_0xdd27d1=_0xdd27d1-0x0;var _0x58220e=_0xe706[_0xdd27d1];return _0x58220e;};'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/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index e25a4ca..cdd8915 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 _0xbe45=['INTEGER','sequelize','exports'];(function(_0x3201df,_0x5ade24){var _0x3cd871=function(_0x3a566b){while(--_0x3a566b){_0x3201df['push'](_0x3201df['shift']());}};_0x3cd871(++_0x5ade24);}(_0xbe45,0x1b7));var _0x5be4=function(_0x39da82,_0xbdf743){_0x39da82=_0x39da82-0x0;var _0x373567=_0xbe45[_0x39da82];return _0x373567;};'use strict';var Sequelize=require(_0x5be4('0x0'));module[_0x5be4('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x5be4('0x2')]}}; \ No newline at end of file +var _0x0895=['sequelize','INTEGER'];(function(_0x4fd5a8,_0x30f8d9){var _0x5b14b4=function(_0x49116f){while(--_0x49116f){_0x4fd5a8['push'](_0x4fd5a8['shift']());}};_0x5b14b4(++_0x30f8d9);}(_0x0895,0x158));var _0x5089=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0895[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5089('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x5089('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x5089('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index eae1133..4f03cf8 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(_0x27acd6,_0x5b62ce){var _0x5ebb0c=function(_0x25b586){while(--_0x25b586){_0x27acd6['push'](_0x27acd6['shift']());}};_0x5ebb0c(++_0x5b62ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x4e08d6,_0x305aa0){var _0x4db1c3=function(_0x16c4bb){while(--_0x16c4bb){_0x4e08d6['push'](_0x4e08d6['shift']());}};_0x4db1c3(++_0x305aa0);}(_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'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.rpc.js b/server/api/userVoicePrefix/userVoicePrefix.rpc.js index 9ebc0ae..f6d2510 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.rpc.js +++ b/server/api/userVoicePrefix/userVoicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ea3=['info','request\x20sent','debug','UserVoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','UserVoicePrefix,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','request','then'];(function(_0x54b55b,_0x4970e7){var _0x2c3b0a=function(_0x19cbc5){while(--_0x19cbc5){_0x54b55b['push'](_0x54b55b['shift']());}};_0x2c3b0a(++_0x4970e7);}(_0x5ea3,0x64));var _0x35ea=function(_0x36d38e,_0x55a8af){_0x36d38e=_0x36d38e-0x0;var _0x1c145c=_0x5ea3[_0x36d38e];return _0x1c145c;};'use strict';var _=require('lodash');var util=require(_0x35ea('0x0'));var moment=require('moment');var BPromise=require(_0x35ea('0x1'));var rs=require(_0x35ea('0x2'));var fs=require('fs');var Redis=require(_0x35ea('0x3'));var db=require(_0x35ea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x35ea('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f792e,_0x113441,_0x5bae46){return new BPromise(function(_0x29dc03,_0x450915){return client[_0x35ea('0x6')](_0x3f792e,_0x5bae46)[_0x35ea('0x7')](function(_0x1db4b2){logger[_0x35ea('0x8')]('UserVoicePrefix,\x20%s,\x20%s',_0x113441,_0x35ea('0x9'));logger[_0x35ea('0xa')](_0x35ea('0xb'),_0x113441,_0x35ea('0x9'),JSON[_0x35ea('0xc')](_0x1db4b2));if(_0x1db4b2[_0x35ea('0xd')]){if(_0x1db4b2[_0x35ea('0xd')]['code']===0x1f4){logger['error'](_0x35ea('0xe'),_0x113441,_0x1db4b2[_0x35ea('0xd')][_0x35ea('0xf')]);return _0x450915(_0x1db4b2[_0x35ea('0xd')][_0x35ea('0xf')]);}logger[_0x35ea('0xd')](_0x35ea('0xe'),_0x113441,_0x1db4b2[_0x35ea('0xd')][_0x35ea('0xf')]);return _0x29dc03(_0x1db4b2[_0x35ea('0xd')][_0x35ea('0xf')]);}else{logger[_0x35ea('0x8')]('UserVoicePrefix,\x20%s,\x20%s',_0x113441,_0x35ea('0x9'));_0x29dc03(_0x1db4b2[_0x35ea('0x10')][_0x35ea('0xf')]);}})[_0x35ea('0x11')](function(_0x590799){logger[_0x35ea('0xd')](_0x35ea('0xe'),_0x113441,_0x590799);_0x450915(_0x590799);});});} \ No newline at end of file +var _0x9292=['client','http','request','then','UserVoicePrefix,\x20%s,\x20%s','request\x20sent','debug','UserVoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1ce4c0,_0x46a34a){var _0x869c61=function(_0x22cef1){while(--_0x22cef1){_0x1ce4c0['push'](_0x1ce4c0['shift']());}};_0x869c61(++_0x46a34a);}(_0x9292,0x6e));var _0x2929=function(_0x57c1b7,_0x46bb7a){_0x57c1b7=_0x57c1b7-0x0;var _0x3a4576=_0x9292[_0x57c1b7];return _0x3a4576;};'use strict';var _=require(_0x2929('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2929('0x1'));var rs=require(_0x2929('0x2'));var fs=require('fs');var Redis=require(_0x2929('0x3'));var db=require(_0x2929('0x4'))['db'];var utils=require(_0x2929('0x5'));var logger=require(_0x2929('0x6'))(_0x2929('0x7'));var config=require(_0x2929('0x8'));var jayson=require(_0x2929('0x9'));var client=jayson[_0x2929('0xa')][_0x2929('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b118c,_0x2e2469,_0x2dfcc4){return new BPromise(function(_0xaf1bd3,_0x37b531){return client[_0x2929('0xc')](_0x3b118c,_0x2dfcc4)[_0x2929('0xd')](function(_0xa0c0dc){logger['info'](_0x2929('0xe'),_0x2e2469,_0x2929('0xf'));logger[_0x2929('0x10')](_0x2929('0x11'),_0x2e2469,'request\x20sent',JSON[_0x2929('0x12')](_0xa0c0dc));if(_0xa0c0dc['error']){if(_0xa0c0dc[_0x2929('0x13')][_0x2929('0x14')]===0x1f4){logger['error'](_0x2929('0xe'),_0x2e2469,_0xa0c0dc['error'][_0x2929('0x15')]);return _0x37b531(_0xa0c0dc[_0x2929('0x13')][_0x2929('0x15')]);}logger['error'](_0x2929('0xe'),_0x2e2469,_0xa0c0dc[_0x2929('0x13')][_0x2929('0x15')]);return _0xaf1bd3(_0xa0c0dc[_0x2929('0x13')][_0x2929('0x15')]);}else{logger[_0x2929('0x16')](_0x2929('0xe'),_0x2e2469,_0x2929('0xf'));_0xaf1bd3(_0xa0c0dc['result'][_0x2929('0x15')]);}})[_0x2929('0x17')](function(_0x4d2fc2){logger['error'](_0x2929('0xe'),_0x2e2469,_0x4d2fc2);_0x37b531(_0x4d2fc2);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 4d5de37..71a3842 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2979d3,_0x54ff61){var _0x2a9a36=function(_0x215f64){while(--_0x215f64){_0x2979d3['push'](_0x2979d3['shift']());}};_0x2a9a36(++_0x54ff61);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 05e55f1..174dd76 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 _0x3abc=['exports'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x3abc,0x1c8));var _0xc3ab=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x3abc[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require('sequelize');module[_0xc3ab('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xeffe=['sequelize','INTEGER'];(function(_0x5699c9,_0x11e8e6){var _0x3b6676=function(_0x18387b){while(--_0x18387b){_0x5699c9['push'](_0x5699c9['shift']());}};_0x3b6676(++_0x11e8e6);}(_0xeffe,0x80));var _0xeeff=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xeffe[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0xeeff('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xeeff('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 0ca125c..1ca5d3d 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 _0x8179=['api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','util'];(function(_0x4fbe25,_0x186241){var _0x3d5b92=function(_0x25ecf8){while(--_0x25ecf8){_0x4fbe25['push'](_0x4fbe25['shift']());}};_0x3d5b92(++_0x186241);}(_0x8179,0x11d));var _0x9817=function(_0x3c8a3c,_0x44ddaf){_0x3c8a3c=_0x3c8a3c-0x0;var _0x2208c2=_0x8179[_0x3c8a3c];return _0x2208c2;};'use strict';var _=require('lodash');var util=require(_0x9817('0x0'));var logger=require('../../config/logger')(_0x9817('0x1'));var moment=require(_0x9817('0x2'));var BPromise=require('bluebird');var rp=require(_0x9817('0x3'));var fs=require('fs');var path=require(_0x9817('0x4'));var rimraf=require(_0x9817('0x5'));var config=require(_0x9817('0x6'));var attributes=require(_0x9817('0x7'));module[_0x9817('0x8')]=function(_0x543543,_0x46558d){return _0x543543[_0x9817('0x9')](_0x9817('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17fb=['user_has_voice_queues','util','api','moment','bluebird','request-promise','path','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x1f413c,_0x22f3dd){var _0x19ef31=function(_0x2c55db){while(--_0x2c55db){_0x1f413c['push'](_0x1f413c['shift']());}};_0x19ef31(++_0x22f3dd);}(_0x17fb,0x18d));var _0xb17f=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0x17fb[_0x2085f3];return _0x384e3c;};'use strict';var _=require('lodash');var util=require(_0xb17f('0x0'));var logger=require('../../config/logger')(_0xb17f('0x1'));var moment=require(_0xb17f('0x2'));var BPromise=require(_0xb17f('0x3'));var rp=require(_0xb17f('0x4'));var fs=require('fs');var path=require(_0xb17f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb17f('0x6'));module[_0xb17f('0x7')]=function(_0x3594dd,_0x2725f1){return _0x3594dd[_0xb17f('0x8')](_0xb17f('0x9'),attributes,{'tableName':_0xb17f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index c6649fd..c10801f 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 _0x7353=['rpc','../../config/environment','jayson/promise','client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/logger'];(function(_0x323c74,_0x49d297){var _0x446254=function(_0x5124ab){while(--_0x5124ab){_0x323c74['push'](_0x323c74['shift']());}};_0x446254(++_0x49d297);}(_0x7353,0x121));var _0x3735=function(_0x3921bb,_0x18f966){_0x3921bb=_0x3921bb-0x0;var _0x49dbed=_0x7353[_0x3921bb];return _0x49dbed;};'use strict';var _=require(_0x3735('0x0'));var util=require(_0x3735('0x1'));var moment=require(_0x3735('0x2'));var BPromise=require('bluebird');var rs=require(_0x3735('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3735('0x4'))(_0x3735('0x5'));var config=require(_0x3735('0x6'));var jayson=require(_0x3735('0x7'));var client=jayson[_0x3735('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56558c,_0x181f3c,_0x352ef8){return new BPromise(function(_0x5bdf09,_0x55435e){return client[_0x3735('0x9')](_0x56558c,_0x352ef8)[_0x3735('0xa')](function(_0x5b9bdf){logger[_0x3735('0xb')](_0x3735('0xc'),_0x181f3c,_0x3735('0xd'));logger['debug'](_0x3735('0xe'),_0x181f3c,'request\x20sent',JSON[_0x3735('0xf')](_0x5b9bdf));if(_0x5b9bdf['error']){if(_0x5b9bdf[_0x3735('0x10')][_0x3735('0x11')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x181f3c,_0x5b9bdf['error'][_0x3735('0x12')]);return _0x55435e(_0x5b9bdf[_0x3735('0x10')][_0x3735('0x12')]);}logger[_0x3735('0x10')](_0x3735('0xc'),_0x181f3c,_0x5b9bdf[_0x3735('0x10')][_0x3735('0x12')]);return _0x5bdf09(_0x5b9bdf[_0x3735('0x10')][_0x3735('0x12')]);}else{logger['info'](_0x3735('0xc'),_0x181f3c,_0x3735('0xd'));_0x5bdf09(_0x5b9bdf[_0x3735('0x13')][_0x3735('0x12')]);}})[_0x3735('0x14')](function(_0x57a62f){logger[_0x3735('0x10')](_0x3735('0xc'),_0x181f3c,_0x57a62f);_0x55435e(_0x57a62f);});});} \ No newline at end of file +var _0x7399=['error','code','message','UserVoiceQueue,\x20%s,\x20%s','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','stringify'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x7399,0x7c));var _0x9739=function(_0xf4d54c,_0x118dba){_0xf4d54c=_0xf4d54c-0x0;var _0x1e2ae6=_0x7399[_0xf4d54c];return _0x1e2ae6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9739('0x0'));var BPromise=require(_0x9739('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9739('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9739('0x3'));var logger=require(_0x9739('0x4'))(_0x9739('0x5'));var config=require('../../config/environment');var jayson=require(_0x9739('0x6'));var client=jayson[_0x9739('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21d752,_0x38a01b,_0x219ace){return new BPromise(function(_0x3fab9a,_0x5f0528){return client['request'](_0x21d752,_0x219ace)[_0x9739('0x8')](function(_0x401d4c){logger[_0x9739('0x9')]('UserVoiceQueue,\x20%s,\x20%s',_0x38a01b,_0x9739('0xa'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x38a01b,_0x9739('0xa'),JSON[_0x9739('0xb')](_0x401d4c));if(_0x401d4c[_0x9739('0xc')]){if(_0x401d4c[_0x9739('0xc')][_0x9739('0xd')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x38a01b,_0x401d4c[_0x9739('0xc')]['message']);return _0x5f0528(_0x401d4c[_0x9739('0xc')][_0x9739('0xe')]);}logger[_0x9739('0xc')](_0x9739('0xf'),_0x38a01b,_0x401d4c[_0x9739('0xc')][_0x9739('0xe')]);return _0x3fab9a(_0x401d4c[_0x9739('0xc')][_0x9739('0xe')]);}else{logger['info'](_0x9739('0xf'),_0x38a01b,_0x9739('0xa'));_0x3fab9a(_0x401d4c['result'][_0x9739('0xe')]);}})[_0x9739('0x10')](function(_0x175b98){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x38a01b,_0x175b98);_0x5f0528(_0x175b98);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index b79198e..78a7a18 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1d14a4,_0x3d0375){var _0x5cae92=function(_0x332f16){while(--_0x332f16){_0x1d14a4['push'](_0x1d14a4['shift']());}};_0x5cae92(++_0x3d0375);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5d1acc,_0x47c387){var _0x222e43=function(_0x3931ec){while(--_0x3931ec){_0x5d1acc['push'](_0x5d1acc['shift']());}};_0x222e43(++_0x47c387);}(_0xe706,0xa3));var _0x6e70=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0xe706[_0x58965a];return _0x254efc;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index cc7e5da..e209abb 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 _0x72a4=['Required\x20by\x20Asterisk','STRING','queue_interface','exports','INTEGER'];(function(_0x545412,_0x2084e0){var _0x21a9dc=function(_0x271ecb){while(--_0x271ecb){_0x545412['push'](_0x545412['shift']());}};_0x21a9dc(++_0x2084e0);}(_0x72a4,0x1c5));var _0x472a=function(_0x22e9a1,_0x1d3a53){_0x22e9a1=_0x22e9a1-0x0;var _0x5bff12=_0x72a4[_0x22e9a1];return _0x5bff12;};'use strict';var Sequelize=require('sequelize');module[_0x472a('0x0')]={'uniqueid':{'type':Sequelize[_0x472a('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x472a('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x472a('0x2')},'UserId':{'type':Sequelize[_0x472a('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x472a('0x3')],'allowNull':![],'unique':_0x472a('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x472a('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x472a('0x3')],'allowNull':![],'unique':_0x472a('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x472a('0x1')](0xb),'defaultValue':0x0,'comment':_0x472a('0x2')},'paused':{'type':Sequelize[_0x472a('0x1')](0xb),'defaultValue':0x0,'comment':_0x472a('0x2')}}; \ No newline at end of file +var _0x5cf6=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x83c6c7,_0x5eea4e){var _0x21cf84=function(_0x42eca1){while(--_0x42eca1){_0x83c6c7['push'](_0x83c6c7['shift']());}};_0x21cf84(++_0x5eea4e);}(_0x5cf6,0x1d3));var _0x65cf=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5cf6[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x65cf('0x0'));module[_0x65cf('0x1')]={'uniqueid':{'type':Sequelize[_0x65cf('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x65cf('0x3')},'membername':{'type':Sequelize[_0x65cf('0x4')],'allowNull':![],'comment':_0x65cf('0x3')},'UserId':{'type':Sequelize[_0x65cf('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x65cf('0x4')],'allowNull':![],'unique':_0x65cf('0x5'),'comment':_0x65cf('0x3')},'VoiceQueueId':{'type':Sequelize[_0x65cf('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x65cf('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x65cf('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x65cf('0x2')](0xb),'defaultValue':0x0,'comment':_0x65cf('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 971105c..3a36d0b 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 _0x8c69=['hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove'];(function(_0x283f1a,_0x271f9a){var _0x3eeb4c=function(_0x3c2780){while(--_0x3c2780){_0x283f1a['push'](_0x283f1a['shift']());}};_0x3eeb4c(++_0x271f9a);}(_0x8c69,0x123));var _0x98c6=function(_0x587067,_0x27377f){_0x587067=_0x587067-0x0;var _0x16b88f=_0x8c69[_0x587067];return _0x16b88f;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x98c6('0x0'))['db'][_0x98c6('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x98c6('0x2')](0x0);var events={'afterCreate':_0x98c6('0x3'),'afterUpdate':_0x98c6('0x4'),'afterDestroy':_0x98c6('0x5')};function emitEvent(_0xb79aa7){return function(_0x5272d9,_0x655ea4,_0x130c56){UserVoiceQueueRtEvents['emit'](_0xb79aa7+':'+_0x5272d9['id'],_0x5272d9);UserVoiceQueueRtEvents['emit'](_0xb79aa7,_0x5272d9);_0x130c56(null);};}for(var e in events){if(events[_0x98c6('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x98c6('0x7')](e,emitEvent(event));}}module[_0x98c6('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x551c=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','UserVoiceQueueRt'];(function(_0xa3fcbc,_0x4651de){var _0x157aef=function(_0x26e6eb){while(--_0x26e6eb){_0xa3fcbc['push'](_0xa3fcbc['shift']());}};_0x157aef(++_0x4651de);}(_0x551c,0xfe));var _0xc551=function(_0xb179e9,_0x95e390){_0xb179e9=_0xb179e9-0x0;var _0x30bf50=_0x551c[_0xb179e9];return _0x30bf50;};'use strict';var EventEmitter=require(_0xc551('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xc551('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc551('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc551('0x3'),'afterDestroy':_0xc551('0x4')};function emitEvent(_0x4054e0){return function(_0x487c4a,_0x1045c3,_0x3397bd){UserVoiceQueueRtEvents['emit'](_0x4054e0+':'+_0x487c4a['id'],_0x487c4a);UserVoiceQueueRtEvents[_0xc551('0x5')](_0x4054e0,_0x487c4a);_0x3397bd(null);};}for(var e in events){if(events[_0xc551('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xc551('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index d0cc441..2912840 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 _0x3d58=['define','UserVoiceQueueRt','user_has_voice_queues_rt','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports'];(function(_0x52b24f,_0xca062d){var _0x46ea6b=function(_0x29f821){while(--_0x29f821){_0x52b24f['push'](_0x52b24f['shift']());}};_0x46ea6b(++_0xca062d);}(_0x3d58,0x10b));var _0x83d5=function(_0x5dd742,_0x46e9d8){_0x5dd742=_0x5dd742-0x0;var _0x1a8fdc=_0x3d58[_0x5dd742];return _0x1a8fdc;};'use strict';var _=require('lodash');var util=require(_0x83d5('0x0'));var logger=require('../../config/logger')(_0x83d5('0x1'));var moment=require(_0x83d5('0x2'));var BPromise=require(_0x83d5('0x3'));var rp=require(_0x83d5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83d5('0x5'));var config=require(_0x83d5('0x6'));var attributes=require(_0x83d5('0x7'));module[_0x83d5('0x8')]=function(_0x1b810f,_0x3446bf){return _0x1b810f[_0x83d5('0x9')](_0x83d5('0xa'),attributes,{'tableName':_0x83d5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75a2=['exports','define','UserVoiceQueueRt','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x75a2,0x17c));var _0x275a=function(_0x1fc08d,_0x45d6be){_0x1fc08d=_0x1fc08d-0x0;var _0x121dc1=_0x75a2[_0x1fc08d];return _0x121dc1;};'use strict';var _=require(_0x275a('0x0'));var util=require(_0x275a('0x1'));var logger=require('../../config/logger')(_0x275a('0x2'));var moment=require(_0x275a('0x3'));var BPromise=require(_0x275a('0x4'));var rp=require(_0x275a('0x5'));var fs=require('fs');var path=require(_0x275a('0x6'));var rimraf=require(_0x275a('0x7'));var config=require(_0x275a('0x8'));var attributes=require(_0x275a('0x9'));module[_0x275a('0xa')]=function(_0x104dff,_0x21fc58){return _0x104dff[_0x275a('0xb')](_0x275a('0xc'),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 256e0ff..73ab47e 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 _0x8a6f=['message','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1bc7f3,_0x239f63){var _0x40a9a6=function(_0x408191){while(--_0x408191){_0x1bc7f3['push'](_0x1bc7f3['shift']());}};_0x40a9a6(++_0x239f63);}(_0x8a6f,0x197));var _0xf8a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a6f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf8a6('0x0'));var moment=require('moment');var BPromise=require(_0xf8a6('0x1'));var rs=require(_0xf8a6('0x2'));var fs=require('fs');var Redis=require(_0xf8a6('0x3'));var db=require(_0xf8a6('0x4'))['db'];var utils=require(_0xf8a6('0x5'));var logger=require(_0xf8a6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf8a6('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xf8a6('0x8')]=_[_0xf8a6('0x9')](config[_0xf8a6('0x8')],{'host':_0xf8a6('0xa'),'port':0x18eb});var socket=require(_0xf8a6('0xb'))(new Redis(config[_0xf8a6('0x8')]));require('./userVoiceQueueRt.socket')[_0xf8a6('0xc')](socket);function respondWithRpcPromise(_0x5e5234,_0x218629,_0x3cdd00){return new BPromise(function(_0x3ea5eb,_0x2a11d9){return client[_0xf8a6('0xd')](_0x5e5234,_0x3cdd00)[_0xf8a6('0xe')](function(_0x4ad377){logger[_0xf8a6('0xf')](_0xf8a6('0x10'),_0x218629,_0xf8a6('0x11'));logger[_0xf8a6('0x12')](_0xf8a6('0x13'),_0x218629,'request\x20sent',JSON[_0xf8a6('0x14')](_0x4ad377));if(_0x4ad377['error']){if(_0x4ad377['error']['code']===0x1f4){logger[_0xf8a6('0x15')](_0xf8a6('0x10'),_0x218629,_0x4ad377['error'][_0xf8a6('0x16')]);return _0x2a11d9(_0x4ad377[_0xf8a6('0x15')][_0xf8a6('0x16')]);}logger[_0xf8a6('0x15')](_0xf8a6('0x10'),_0x218629,_0x4ad377[_0xf8a6('0x15')][_0xf8a6('0x16')]);return _0x3ea5eb(_0x4ad377[_0xf8a6('0x15')][_0xf8a6('0x16')]);}else{logger[_0xf8a6('0xf')](_0xf8a6('0x10'),_0x218629,_0xf8a6('0x11'));_0x3ea5eb(_0x4ad377[_0xf8a6('0x17')][_0xf8a6('0x16')]);}})[_0xf8a6('0x18')](function(_0x350553){logger['error'](_0xf8a6('0x10'),_0x218629,_0x350553);_0x2a11d9(_0x350553);});});}exports[_0xf8a6('0x19')]=function(_0x5896c9){var _0x462195=this;return new Promise(function(_0x397eb6,_0x2c2a4f){return db['UserVoiceQueueRt'][_0xf8a6('0x1a')]({'raw':_0x5896c9[_0xf8a6('0x1b')]?_0x5896c9[_0xf8a6('0x1b')][_0xf8a6('0x1c')]===undefined?!![]:![]:!![],'where':_0x5896c9[_0xf8a6('0x1b')]?_0x5896c9[_0xf8a6('0x1b')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xf8a6('0x1d'),db[_0xf8a6('0x1e')]['fn']('IF',db[_0xf8a6('0x1e')]['literal'](_0xf8a6('0x1f')))),_0xf8a6('0x20')]]})[_0xf8a6('0xe')](function(_0x441a58){logger[_0xf8a6('0xf')](_0xf8a6('0x19'),_0x5896c9);logger[_0xf8a6('0x12')]('GetVoiceQueueRtPauses',_0x5896c9,JSON[_0xf8a6('0x14')](_0x441a58));_0x397eb6(_0x441a58);})['catch'](function(_0x1970ce){logger[_0xf8a6('0x15')]('GetVoiceQueueRtPauses',_0x1970ce[_0xf8a6('0x16')],_0x5896c9);_0x2c2a4f(_0x462195[_0xf8a6('0x15')](0x1f4,_0x1970ce[_0xf8a6('0x16')]));});});}; \ No newline at end of file +var _0x2f3e=['UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','./userVoiceQueueRt.socket','register','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1bb07c,_0x43cd16){var _0x30bb8a=function(_0x12ba2f){while(--_0x12ba2f){_0x1bb07c['push'](_0x1bb07c['shift']());}};_0x30bb8a(++_0x43cd16);}(_0x2f3e,0x149));var _0xe2f3=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0x2f3e[_0x5e28c2];return _0x1a8cc6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe2f3('0x0'));var BPromise=require(_0xe2f3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2f3('0x2'))['db'];var utils=require(_0xe2f3('0x3'));var logger=require('../../config/logger')(_0xe2f3('0x4'));var config=require(_0xe2f3('0x5'));var jayson=require(_0xe2f3('0x6'));var client=jayson['client'][_0xe2f3('0x7')]({'port':0x232a});config[_0xe2f3('0x8')]=_['defaults'](config[_0xe2f3('0x8')],{'host':_0xe2f3('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe2f3('0x8')]));require(_0xe2f3('0xa'))[_0xe2f3('0xb')](socket);function respondWithRpcPromise(_0x2cde01,_0x5453e3,_0x5e6c04){return new BPromise(function(_0x457523,_0x24c739){return client[_0xe2f3('0xc')](_0x2cde01,_0x5e6c04)[_0xe2f3('0xd')](function(_0x351adf){logger[_0xe2f3('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5453e3,_0xe2f3('0xf'));logger[_0xe2f3('0x10')](_0xe2f3('0x11'),_0x5453e3,_0xe2f3('0xf'),JSON[_0xe2f3('0x12')](_0x351adf));if(_0x351adf[_0xe2f3('0x13')]){if(_0x351adf[_0xe2f3('0x13')][_0xe2f3('0x14')]===0x1f4){logger[_0xe2f3('0x13')](_0xe2f3('0x15'),_0x5453e3,_0x351adf['error']['message']);return _0x24c739(_0x351adf['error'][_0xe2f3('0x16')]);}logger[_0xe2f3('0x13')](_0xe2f3('0x15'),_0x5453e3,_0x351adf[_0xe2f3('0x13')][_0xe2f3('0x16')]);return _0x457523(_0x351adf[_0xe2f3('0x13')][_0xe2f3('0x16')]);}else{logger[_0xe2f3('0xe')](_0xe2f3('0x15'),_0x5453e3,_0xe2f3('0xf'));_0x457523(_0x351adf[_0xe2f3('0x17')][_0xe2f3('0x16')]);}})[_0xe2f3('0x18')](function(_0x977015){logger['error'](_0xe2f3('0x15'),_0x5453e3,_0x977015);_0x24c739(_0x977015);});});}exports[_0xe2f3('0x19')]=function(_0x40bfa3){var _0x3fbe02=this;return new Promise(function(_0x56adc5,_0x21d85c){return db[_0xe2f3('0x1a')][_0xe2f3('0x1b')]({'raw':_0x40bfa3[_0xe2f3('0x1c')]?_0x40bfa3['options'][_0xe2f3('0x1d')]===undefined?!![]:![]:!![],'where':_0x40bfa3[_0xe2f3('0x1c')]?_0x40bfa3[_0xe2f3('0x1c')][_0xe2f3('0x1e')]||null:null,'attributes':[[db[_0xe2f3('0x1f')]['fn'](_0xe2f3('0x20'),db[_0xe2f3('0x1f')]['fn']('IF',db[_0xe2f3('0x1f')]['literal'](_0xe2f3('0x21')))),_0xe2f3('0x22')]]})[_0xe2f3('0xd')](function(_0x4bd25b){logger[_0xe2f3('0xe')](_0xe2f3('0x19'),_0x40bfa3);logger[_0xe2f3('0x10')](_0xe2f3('0x19'),_0x40bfa3,JSON[_0xe2f3('0x12')](_0x4bd25b));_0x56adc5(_0x4bd25b);})[_0xe2f3('0x18')](function(_0xeaeabc){logger['error']('GetVoiceQueueRtPauses',_0xeaeabc[_0xe2f3('0x16')],_0x40bfa3);_0x21d85c(_0x3fbe02['error'](0x1f4,_0xeaeabc[_0xe2f3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index cd02ad0..9ea8dbc 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 _0xaf0d=['userVoiceQueueRt:','save','remove','removeListener'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xaf0d,0x6d));var _0xdaf0=function(_0xc3481d,_0x6c6832){_0xc3481d=_0xc3481d-0x0;var _0x1f4322=_0xaf0d[_0xc3481d];return _0x1f4322;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xdaf0('0x0'),_0xdaf0('0x1'),'update'];function createListener(_0x53877e,_0x5ed0cf){return function(_0x4d0160){_0x5ed0cf['emit'](_0x53877e,_0x4d0160);};}function removeListener(_0x1b6f35,_0x21a3fa){return function(){UserVoiceQueueRtEvents[_0xdaf0('0x2')](_0x1b6f35,_0x21a3fa);};}exports['register']=function(_0x35fe4f){for(var _0x14b19d=0x0,_0x53aec7=events['length'];_0x14b19d<_0x53aec7;_0x14b19d++){var _0x26bda3=events[_0x14b19d];var _0x1dc345=createListener(_0xdaf0('0x3')+_0x26bda3,_0x35fe4f);UserVoiceQueueRtEvents['on'](_0x26bda3,_0x1dc345);}}; \ No newline at end of file +var _0x3641=['userVoiceQueueRt:','save','emit','register','length'];(function(_0x545211,_0x5787b1){var _0x41f333=function(_0x531000){while(--_0x531000){_0x545211['push'](_0x545211['shift']());}};_0x41f333(++_0x5787b1);}(_0x3641,0x173));var _0x1364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3641[_0x3dd15e];return _0x231fd0;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x1364('0x0'),'remove','update'];function createListener(_0x174332,_0x1a0e1a){return function(_0x5506bc){_0x1a0e1a[_0x1364('0x1')](_0x174332,_0x5506bc);};}function removeListener(_0x4a9034,_0x3d14e0){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4a9034,_0x3d14e0);};}exports[_0x1364('0x2')]=function(_0x4bcb69){for(var _0x169527=0x0,_0x278f40=events[_0x1364('0x3')];_0x169527<_0x278f40;_0x169527++){var _0x5ef8ba=events[_0x169527];var _0xb5d644=createListener(_0x1364('0x4')+_0x5ef8ba,_0x4bcb69);UserVoiceQueueRtEvents['on'](_0x5ef8ba,_0xb5d644);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index aaefa4d..84a1628 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(_0x543aad,_0x16a4ef){var _0x2d02a6=function(_0x1c853f){while(--_0x1c853f){_0x543aad['push'](_0x543aad['shift']());}};_0x2d02a6(++_0x16a4ef);}(_0xe706,0xa3));var _0x6e70=function(_0x53a167,_0x4bf6c7){_0x53a167=_0x53a167-0x0;var _0x150263=_0xe706[_0x53a167];return _0x150263;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x11bf29,_0x44409c){var _0x52a018=function(_0x3d11f1){while(--_0x3d11f1){_0x11bf29['push'](_0x11bf29['shift']());}};_0x52a018(++_0x44409c);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 3fd58e7..811ca43 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 _0x0532=['INTEGER','sequelize','exports'];(function(_0xf5a2e1,_0x22b951){var _0x1c5c00=function(_0xd4e775){while(--_0xd4e775){_0xf5a2e1['push'](_0xf5a2e1['shift']());}};_0x1c5c00(++_0x22b951);}(_0x0532,0x16c));var _0x2053=function(_0x4ec3a1,_0x38ce52){_0x4ec3a1=_0x4ec3a1-0x0;var _0x3b0f97=_0x0532[_0x4ec3a1];return _0x3b0f97;};'use strict';var Sequelize=require(_0x2053('0x0'));module[_0x2053('0x1')]={'penalty':{'type':Sequelize[_0x2053('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x13f5=['exports','INTEGER'];(function(_0x7ca76f,_0x5ac99c){var _0x1fd4f3=function(_0x4a6bf6){while(--_0x4a6bf6){_0x7ca76f['push'](_0x7ca76f['shift']());}};_0x1fd4f3(++_0x5ac99c);}(_0x13f5,0x16c));var _0x513f=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x13f5[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require('sequelize');module[_0x513f('0x0')]={'penalty':{'type':Sequelize[_0x513f('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 30394da..ccde303 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 _0x45d1=['bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment'];(function(_0x10d00e,_0x1ad25b){var _0x420ee5=function(_0xad9e3c){while(--_0xad9e3c){_0x10d00e['push'](_0x10d00e['shift']());}};_0x420ee5(++_0x1ad25b);}(_0x45d1,0x105));var _0x145d=function(_0x2e030a,_0x8e4c48){_0x2e030a=_0x2e030a-0x0;var _0x597df6=_0x45d1[_0x2e030a];return _0x597df6;};'use strict';var _=require(_0x145d('0x0'));var util=require(_0x145d('0x1'));var logger=require(_0x145d('0x2'))(_0x145d('0x3'));var moment=require(_0x145d('0x4'));var BPromise=require(_0x145d('0x5'));var rp=require(_0x145d('0x6'));var fs=require('fs');var path=require(_0x145d('0x7'));var rimraf=require(_0x145d('0x8'));var config=require(_0x145d('0x9'));var attributes=require(_0x145d('0xa'));module['exports']=function(_0x4e15bd,_0x2bb5f9){return _0x4e15bd[_0x145d('0xb')](_0x145d('0xc'),attributes,{'tableName':_0x145d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ca1=['user_has_whatsapp_queues','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','UserWhatsappQueue'];(function(_0x234249,_0x47ccd3){var _0x242b91=function(_0x7dd16b){while(--_0x7dd16b){_0x234249['push'](_0x234249['shift']());}};_0x242b91(++_0x47ccd3);}(_0x3ca1,0x97));var _0x13ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ca1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x13ca('0x0'))(_0x13ca('0x1'));var moment=require(_0x13ca('0x2'));var BPromise=require(_0x13ca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x13ca('0x4'));var config=require(_0x13ca('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0x13ca('0x6')]=function(_0x540a8b,_0x5f4c05){return _0x540a8b[_0x13ca('0x7')](_0x13ca('0x8'),attributes,{'tableName':_0x13ca('0x9'),'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 af80b2f..9614ebd 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 _0x3639=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','info','result','lodash','util','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3639,0xef));var _0x9363=function(_0x104112,_0x342eb6){_0x104112=_0x104112-0x0;var _0x394ab4=_0x3639[_0x104112];return _0x394ab4;};'use strict';var _=require(_0x9363('0x0'));var util=require(_0x9363('0x1'));var moment=require('moment');var BPromise=require(_0x9363('0x2'));var rs=require(_0x9363('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9363('0x4'));var logger=require(_0x9363('0x5'))(_0x9363('0x6'));var config=require(_0x9363('0x7'));var jayson=require(_0x9363('0x8'));var client=jayson[_0x9363('0x9')][_0x9363('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x200cb4,_0x3e08c5,_0xc3d5c7){return new BPromise(function(_0x238966,_0x5a9ed9){return client['request'](_0x200cb4,_0xc3d5c7)[_0x9363('0xb')](function(_0x2173b7){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x3e08c5,_0x9363('0xc'));logger[_0x9363('0xd')](_0x9363('0xe'),_0x3e08c5,_0x9363('0xc'),JSON[_0x9363('0xf')](_0x2173b7));if(_0x2173b7[_0x9363('0x10')]){if(_0x2173b7[_0x9363('0x10')][_0x9363('0x11')]===0x1f4){logger[_0x9363('0x10')](_0x9363('0x12'),_0x3e08c5,_0x2173b7[_0x9363('0x10')][_0x9363('0x13')]);return _0x5a9ed9(_0x2173b7[_0x9363('0x10')][_0x9363('0x13')]);}logger[_0x9363('0x10')](_0x9363('0x12'),_0x3e08c5,_0x2173b7[_0x9363('0x10')][_0x9363('0x13')]);return _0x238966(_0x2173b7[_0x9363('0x10')][_0x9363('0x13')]);}else{logger[_0x9363('0x14')](_0x9363('0x12'),_0x3e08c5,_0x9363('0xc'));_0x238966(_0x2173b7[_0x9363('0x15')][_0x9363('0x13')]);}})['catch'](function(_0x258e4e){logger[_0x9363('0x10')](_0x9363('0x12'),_0x3e08c5,_0x258e4e);_0x5a9ed9(_0x258e4e);});});} \ No newline at end of file +var _0x881d=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','info'];(function(_0x4981e,_0x27182f){var _0x1c6533=function(_0x3196dd){while(--_0x3196dd){_0x4981e['push'](_0x4981e['shift']());}};_0x1c6533(++_0x27182f);}(_0x881d,0x13a));var _0xd881=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x881d[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0xd881('0x0'));var util=require(_0xd881('0x1'));var moment=require(_0xd881('0x2'));var BPromise=require('bluebird');var rs=require(_0xd881('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd881('0x4'))(_0xd881('0x5'));var config=require(_0xd881('0x6'));var jayson=require(_0xd881('0x7'));var client=jayson[_0xd881('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x545cc0,_0x1dbce6,_0x26ef32){return new BPromise(function(_0x4b673f,_0x419d13){return client['request'](_0x545cc0,_0x26ef32)['then'](function(_0x2c9339){logger[_0xd881('0x9')](_0xd881('0xa'),_0x1dbce6,_0xd881('0xb'));logger[_0xd881('0xc')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1dbce6,_0xd881('0xb'),JSON[_0xd881('0xd')](_0x2c9339));if(_0x2c9339[_0xd881('0xe')]){if(_0x2c9339[_0xd881('0xe')][_0xd881('0xf')]===0x1f4){logger[_0xd881('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1dbce6,_0x2c9339['error'][_0xd881('0x10')]);return _0x419d13(_0x2c9339['error'][_0xd881('0x10')]);}logger[_0xd881('0xe')](_0xd881('0xa'),_0x1dbce6,_0x2c9339[_0xd881('0xe')][_0xd881('0x10')]);return _0x4b673f(_0x2c9339['error'][_0xd881('0x10')]);}else{logger[_0xd881('0x9')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1dbce6,_0xd881('0xb'));_0x4b673f(_0x2c9339['result']['message']);}})[_0xd881('0x11')](function(_0x2e1c31){logger[_0xd881('0xe')](_0xd881('0xa'),_0x1dbce6,_0x2e1c31);_0x419d13(_0x2e1c31);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index bf05ce3..20a1170 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 _0x4853=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','util','connect-timeout','express'];(function(_0x35d586,_0x43094a){var _0x4288ae=function(_0x3d8544){while(--_0x3d8544){_0x35d586['push'](_0x35d586['shift']());}};_0x4288ae(++_0x43094a);}(_0x4853,0x11d));var _0x3485=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4853[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x3485('0x0'));var path=require('path');var timeout=require(_0x3485('0x1'));var express=require(_0x3485('0x2'));var router=express[_0x3485('0x3')]();var fs_extra=require(_0x3485('0x4'));var auth=require(_0x3485('0x5'));var interaction=require(_0x3485('0x6'));var config=require('../../config/environment');var controller=require('./variable.controller');router['get']('/',auth[_0x3485('0x7')](),controller[_0x3485('0x8')]);router[_0x3485('0x9')](_0x3485('0xa'),auth[_0x3485('0x7')](),controller[_0x3485('0xb')]);router[_0x3485('0xc')]('/',auth['isAuthenticated'](),controller[_0x3485('0xd')]);router[_0x3485('0xe')](_0x3485('0xa'),auth[_0x3485('0x7')](),controller[_0x3485('0xf')]);router[_0x3485('0x10')](_0x3485('0xa'),auth[_0x3485('0x7')](),controller[_0x3485('0x11')]);module['exports']=router; \ No newline at end of file +var _0xeb0d=['put','/:id','update','delete','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','create'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x4688f3,_0x36fa36){_0x4688f3=_0x4688f3-0x0;var _0x3cb0b9=_0xeb0d[_0x4688f3];return _0x3cb0b9;};'use strict';var multer=require(_0xdeb0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdeb0('0x1'));var router=express[_0xdeb0('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xdeb0('0x3'));var interaction=require(_0xdeb0('0x4'));var config=require(_0xdeb0('0x5'));var controller=require(_0xdeb0('0x6'));router[_0xdeb0('0x7')]('/',auth[_0xdeb0('0x8')](),controller[_0xdeb0('0x9')]);router[_0xdeb0('0x7')]('/:id',auth[_0xdeb0('0x8')](),controller[_0xdeb0('0xa')]);router['post']('/',auth[_0xdeb0('0x8')](),controller[_0xdeb0('0xb')]);router[_0xdeb0('0xc')](_0xdeb0('0xd'),auth[_0xdeb0('0x8')](),controller[_0xdeb0('0xe')]);router[_0xdeb0('0xf')](_0xdeb0('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xdeb0('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 18de45d..2f537af 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 _0x4b99=['exports','STRING','sequelize'];(function(_0x5e9d35,_0x382c91){var _0x3beb2e=function(_0x4242cf){while(--_0x4242cf){_0x5e9d35['push'](_0x5e9d35['shift']());}};_0x3beb2e(++_0x382c91);}(_0x4b99,0x107));var _0x94b9=function(_0x492a4d,_0x525e4f){_0x492a4d=_0x492a4d-0x0;var _0x87aeac=_0x4b99[_0x492a4d];return _0x87aeac;};'use strict';var Sequelize=require(_0x94b9('0x0'));module[_0x94b9('0x1')]={'name':{'type':Sequelize[_0x94b9('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x04f5=['exports','STRING','sequelize'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x04f5,0x1a9));var _0x504f=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0x04f5[_0x2e58c7];return _0x26eb00;};'use strict';var Sequelize=require(_0x504f('0x0'));module[_0x504f('0x1')]={'name':{'type':Sequelize[_0x504f('0x2')],'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 77cd885..1e6580a 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 _0x1e88=['get','Variables','UserProfileResource','end','error','name','send','index','map','Variable','rawAttributes','fieldName','key','keys','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','intersection','includeAll','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy'];(function(_0x353504,_0x81bb23){var _0x124741=function(_0x41f2be){while(--_0x41f2be){_0x353504['push'](_0x353504['shift']());}};_0x124741(++_0x81bb23);}(_0x1e88,0x80));var _0x81e8=function(_0x182759,_0x32ca2e){_0x182759=_0x182759-0x0;var _0x486d79=_0x1e88[_0x182759];return _0x486d79;};'use strict';var emlformat=require(_0x81e8('0x0'));var rimraf=require(_0x81e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x81e8('0x2'));var rp=require(_0x81e8('0x3'));var moment=require(_0x81e8('0x4'));var BPromise=require(_0x81e8('0x5'));var Mustache=require(_0x81e8('0x6'));var util=require(_0x81e8('0x7'));var path=require(_0x81e8('0x8'));var sox=require(_0x81e8('0x9'));var csv=require(_0x81e8('0xa'));var ejs=require(_0x81e8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x81e8('0xc'));var squel=require('squel');var crypto=require(_0x81e8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x81e8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x81e8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x81e8('0x10'));var as=require(_0x81e8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x81e8('0x12'))(_0x81e8('0x13'));var utils=require(_0x81e8('0x14'));var config=require(_0x81e8('0x15'));var licenseUtil=require(_0x81e8('0x16'));var db=require(_0x81e8('0x17'))['db'];function respondWithStatusCode(_0x55032f,_0x23b40b){_0x23b40b=_0x23b40b||0xcc;return function(_0x436602){if(_0x436602){return _0x55032f[_0x81e8('0x18')](_0x23b40b);}return _0x55032f[_0x81e8('0x19')](_0x23b40b)['end']();};}function respondWithResult(_0x3463d7,_0x2f0ddb){_0x2f0ddb=_0x2f0ddb||0xc8;return function(_0x5a0581){if(_0x5a0581){return _0x3463d7[_0x81e8('0x19')](_0x2f0ddb)[_0x81e8('0x1a')](_0x5a0581);}};}function respondWithFilteredResult(_0x386200,_0x60009c){return function(_0x1ded3e){if(_0x1ded3e){var _0x2b3c2a=typeof _0x60009c[_0x81e8('0x1b')]==='undefined'&&typeof _0x60009c[_0x81e8('0x1c')]===_0x81e8('0x1d');var _0x1e38a0=_0x1ded3e['count'];var _0x2bb3b3=_0x2b3c2a?0x0:_0x60009c[_0x81e8('0x1b')];var _0x3bdf30=_0x2b3c2a?_0x1ded3e[_0x81e8('0x1e')]:_0x60009c[_0x81e8('0x1b')]+_0x60009c[_0x81e8('0x1c')];var _0x358095;if(_0x3bdf30>=_0x1e38a0){_0x3bdf30=_0x1e38a0;_0x358095=0xc8;}else{_0x358095=0xce;}_0x386200[_0x81e8('0x19')](_0x358095);return _0x386200[_0x81e8('0x1f')](_0x81e8('0x20'),_0x2bb3b3+'-'+_0x3bdf30+'/'+_0x1e38a0)[_0x81e8('0x1a')](_0x1ded3e);}return null;};}function patchUpdates(_0x24690d){return function(_0x59a9db){try{jsonpatch['apply'](_0x59a9db,_0x24690d,!![]);}catch(_0x215770){return BPromise[_0x81e8('0x21')](_0x215770);}return _0x59a9db[_0x81e8('0x22')]();};}function saveUpdates(_0x22502a,_0x3f4d14){return function(_0x313e6f){if(_0x313e6f){return _0x313e6f[_0x81e8('0x23')](_0x22502a)[_0x81e8('0x24')](function(_0xb9d030){return _0xb9d030;});}return null;};}function removeEntity(_0x3744f7,_0x3a77b8){return function(_0x1af37d){if(_0x1af37d){return _0x1af37d[_0x81e8('0x25')]()[_0x81e8('0x24')](function(){var _0x459386=_0x1af37d[_0x81e8('0x26')]({'plain':!![]});var _0x4b3998=_0x81e8('0x27');return db[_0x81e8('0x28')]['destroy']({'where':{'type':_0x4b3998,'resourceId':_0x459386['id']}})[_0x81e8('0x24')](function(){return _0x1af37d;});})[_0x81e8('0x24')](function(){_0x3744f7['status'](0xcc)[_0x81e8('0x29')]();});}};}function handleEntityNotFound(_0x4446e1,_0xed28b2){return function(_0x20cdcd){if(!_0x20cdcd){_0x4446e1['sendStatus'](0x194);}return _0x20cdcd;};}function handleError(_0x170e63,_0x52d4dc){_0x52d4dc=_0x52d4dc||0x1f4;return function(_0x38e39f){logger[_0x81e8('0x2a')](_0x38e39f['stack']);if(_0x38e39f[_0x81e8('0x2b')]){delete _0x38e39f['name'];}_0x170e63[_0x81e8('0x19')](_0x52d4dc)[_0x81e8('0x2c')](_0x38e39f);};}exports[_0x81e8('0x2d')]=function(_0x21661b,_0xa9570c){var _0x3d1fbb={},_0x4ba272={},_0x564e52={'count':0x0,'rows':[]};var _0x255176=_[_0x81e8('0x2e')](db[_0x81e8('0x2f')][_0x81e8('0x30')],function(_0x5e9e1d){return{'name':_0x5e9e1d[_0x81e8('0x31')],'type':_0x5e9e1d['type'][_0x81e8('0x32')]};});_0x4ba272['model']=_[_0x81e8('0x2e')](_0x255176,'name');_0x4ba272['query']=_[_0x81e8('0x33')](_0x21661b['query']);_0x4ba272['filters']=_['intersection'](_0x4ba272[_0x81e8('0x34')],_0x4ba272[_0x81e8('0x35')]);_0x3d1fbb[_0x81e8('0x36')]=_['intersection'](_0x4ba272[_0x81e8('0x34')],qs[_0x81e8('0x37')](_0x21661b[_0x81e8('0x35')][_0x81e8('0x37')]));_0x3d1fbb[_0x81e8('0x36')]=_0x3d1fbb[_0x81e8('0x36')][_0x81e8('0x38')]?_0x3d1fbb[_0x81e8('0x36')]:_0x4ba272[_0x81e8('0x34')];if(!_0x21661b[_0x81e8('0x35')][_0x81e8('0x39')](_0x81e8('0x3a'))){_0x3d1fbb[_0x81e8('0x1c')]=qs[_0x81e8('0x1c')](_0x21661b['query'][_0x81e8('0x1c')]);_0x3d1fbb[_0x81e8('0x1b')]=qs['offset'](_0x21661b[_0x81e8('0x35')]['offset']);}_0x3d1fbb[_0x81e8('0x3b')]=qs[_0x81e8('0x3c')](_0x21661b[_0x81e8('0x35')][_0x81e8('0x3c')]);_0x3d1fbb[_0x81e8('0x3d')]=qs[_0x81e8('0x3e')](_[_0x81e8('0x3f')](_0x21661b['query'],_0x4ba272[_0x81e8('0x3e')]),_0x255176);if(_0x21661b[_0x81e8('0x35')][_0x81e8('0x40')]){_0x3d1fbb[_0x81e8('0x3d')]=_[_0x81e8('0x41')](_0x3d1fbb['where'],{'$or':_[_0x81e8('0x2e')](_0x255176,function(_0x2313e2){if(_0x2313e2[_0x81e8('0x42')]!==_0x81e8('0x43')){var _0xe87d0e={};_0xe87d0e[_0x2313e2[_0x81e8('0x2b')]]={'$like':'%'+_0x21661b[_0x81e8('0x35')][_0x81e8('0x40')]+'%'};return _0xe87d0e;}})});}_0x3d1fbb=_[_0x81e8('0x41')]({},_0x3d1fbb,_0x21661b['options']);var _0x84b806={'where':_0x3d1fbb[_0x81e8('0x3d')]};return db['Variable']['count'](_0x84b806)[_0x81e8('0x24')](function(_0xb7cf97){_0x564e52[_0x81e8('0x1e')]=_0xb7cf97;if(_0x21661b[_0x81e8('0x35')]['includeAll']){_0x3d1fbb[_0x81e8('0x44')]=[{'all':!![]}];}return db[_0x81e8('0x2f')][_0x81e8('0x45')](_0x3d1fbb);})[_0x81e8('0x24')](function(_0x1ace7d){_0x564e52[_0x81e8('0x46')]=_0x1ace7d;return _0x564e52;})[_0x81e8('0x24')](respondWithFilteredResult(_0xa9570c,_0x3d1fbb))[_0x81e8('0x47')](handleError(_0xa9570c,null));};exports['show']=function(_0x40e536,_0x24f1e7){var _0x259aab={'raw':!![],'where':{'id':_0x40e536['params']['id']}},_0x1cfcfa={};_0x1cfcfa[_0x81e8('0x34')]=_['keys'](db[_0x81e8('0x2f')][_0x81e8('0x30')]);_0x1cfcfa['query']=_[_0x81e8('0x33')](_0x40e536['query']);_0x1cfcfa[_0x81e8('0x3e')]=_[_0x81e8('0x48')](_0x1cfcfa['model'],_0x1cfcfa[_0x81e8('0x35')]);_0x259aab[_0x81e8('0x36')]=_[_0x81e8('0x48')](_0x1cfcfa['model'],qs['fields'](_0x40e536[_0x81e8('0x35')][_0x81e8('0x37')]));_0x259aab[_0x81e8('0x36')]=_0x259aab[_0x81e8('0x36')][_0x81e8('0x38')]?_0x259aab[_0x81e8('0x36')]:_0x1cfcfa['model'];if(_0x40e536[_0x81e8('0x35')][_0x81e8('0x49')]){_0x259aab[_0x81e8('0x44')]=[{'all':!![]}];}_0x259aab=_[_0x81e8('0x41')]({},_0x259aab,_0x40e536['options']);return db[_0x81e8('0x2f')][_0x81e8('0x4a')](_0x259aab)[_0x81e8('0x24')](handleEntityNotFound(_0x24f1e7,null))[_0x81e8('0x24')](respondWithResult(_0x24f1e7,null))['catch'](handleError(_0x24f1e7,null));};exports['create']=function(_0x31bc06,_0x34d7c2){return db[_0x81e8('0x2f')]['create'](_0x31bc06[_0x81e8('0x4b')],{})[_0x81e8('0x24')](function(_0x4d2a04){var _0x18c072=_0x31bc06['user'][_0x81e8('0x26')]({'plain':!![]});if(!_0x18c072)throw new Error(_0x81e8('0x4c'));if(_0x18c072['role']===_0x81e8('0x4d')){var _0x28f0a3=_0x4d2a04[_0x81e8('0x26')]({'plain':!![]});var _0x554580=_0x81e8('0x27');return db[_0x81e8('0x4e')][_0x81e8('0x4a')]({'where':{'name':_0x554580,'userProfileId':_0x18c072['userProfileId']},'raw':!![]})['then'](function(_0x4107c1){if(_0x4107c1&&_0x4107c1[_0x81e8('0x4f')]===0x0){return db[_0x81e8('0x28')][_0x81e8('0x50')]({'name':_0x28f0a3['name'],'resourceId':_0x28f0a3['id'],'type':_0x4107c1[_0x81e8('0x2b')],'sectionId':_0x4107c1['id']},{})['then'](function(){return _0x4d2a04;});}else{return _0x4d2a04;}})[_0x81e8('0x47')](function(_0x5a72cb){logger['error'](_0x81e8('0x51'),_0x5a72cb);throw _0x5a72cb;});}return _0x4d2a04;})['then'](respondWithResult(_0x34d7c2,0xc9))['catch'](handleError(_0x34d7c2,null));};exports[_0x81e8('0x23')]=function(_0x28b172,_0x2f65ee){if(_0x28b172['body']['id']){delete _0x28b172[_0x81e8('0x4b')]['id'];}return db[_0x81e8('0x2f')][_0x81e8('0x4a')]({'where':{'id':_0x28b172[_0x81e8('0x52')]['id']}})['then'](handleEntityNotFound(_0x2f65ee,null))[_0x81e8('0x24')](saveUpdates(_0x28b172['body'],null))[_0x81e8('0x24')](respondWithResult(_0x2f65ee,null))[_0x81e8('0x47')](handleError(_0x2f65ee,null));};exports[_0x81e8('0x25')]=function(_0x1b6ea0,_0x1afb42){return db[_0x81e8('0x2f')][_0x81e8('0x4a')]({'where':{'id':_0x1b6ea0[_0x81e8('0x52')]['id']}})[_0x81e8('0x24')](handleEntityNotFound(_0x1afb42,null))[_0x81e8('0x24')](removeEntity(_0x1afb42,null))[_0x81e8('0x47')](handleError(_0x1afb42,null));}; \ No newline at end of file +var _0x9ea9=['json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','index','map','Variable','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status'];(function(_0x4a1d3c,_0x44b199){var _0x390797=function(_0x5966a0){while(--_0x5966a0){_0x4a1d3c['push'](_0x4a1d3c['shift']());}};_0x390797(++_0x44b199);}(_0x9ea9,0xd0));var _0x99ea=function(_0x3f862b,_0x1bd186){_0x3f862b=_0x3f862b-0x0;var _0x11ca07=_0x9ea9[_0x3f862b];return _0x11ca07;};'use strict';var emlformat=require(_0x99ea('0x0'));var rimraf=require(_0x99ea('0x1'));var zipdir=require(_0x99ea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99ea('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x99ea('0x4'));var util=require(_0x99ea('0x5'));var path=require('path');var sox=require(_0x99ea('0x6'));var csv=require(_0x99ea('0x7'));var ejs=require(_0x99ea('0x8'));var fs=require('fs');var fs_extra=require(_0x99ea('0x9'));var _=require(_0x99ea('0xa'));var squel=require(_0x99ea('0xb'));var crypto=require(_0x99ea('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x99ea('0x7'));var querystring=require(_0x99ea('0xd'));var Papa=require(_0x99ea('0xe'));var Redis=require(_0x99ea('0xf'));var authService=require(_0x99ea('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x99ea('0x11'));var hardwareService=require(_0x99ea('0x12'));var logger=require(_0x99ea('0x13'))(_0x99ea('0x14'));var utils=require('../../config/utils');var config=require(_0x99ea('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x99ea('0x16'))['db'];function respondWithStatusCode(_0x4ba557,_0x54120a){_0x54120a=_0x54120a||0xcc;return function(_0x4445d1){if(_0x4445d1){return _0x4ba557[_0x99ea('0x17')](_0x54120a);}return _0x4ba557['status'](_0x54120a)[_0x99ea('0x18')]();};}function respondWithResult(_0x39642d,_0x43ba0a){_0x43ba0a=_0x43ba0a||0xc8;return function(_0x571b9a){if(_0x571b9a){return _0x39642d[_0x99ea('0x19')](_0x43ba0a)[_0x99ea('0x1a')](_0x571b9a);}};}function respondWithFilteredResult(_0x299689,_0x5eb7ee){return function(_0x73358d){if(_0x73358d){var _0x1cfce4=typeof _0x5eb7ee['offset']===_0x99ea('0x1b')&&typeof _0x5eb7ee[_0x99ea('0x1c')]===_0x99ea('0x1b');var _0x14072d=_0x73358d[_0x99ea('0x1d')];var _0x1022b7=_0x1cfce4?0x0:_0x5eb7ee[_0x99ea('0x1e')];var _0x1a7ab9=_0x1cfce4?_0x73358d[_0x99ea('0x1d')]:_0x5eb7ee['offset']+_0x5eb7ee[_0x99ea('0x1c')];var _0x1f5623;if(_0x1a7ab9>=_0x14072d){_0x1a7ab9=_0x14072d;_0x1f5623=0xc8;}else{_0x1f5623=0xce;}_0x299689[_0x99ea('0x19')](_0x1f5623);return _0x299689[_0x99ea('0x1f')](_0x99ea('0x20'),_0x1022b7+'-'+_0x1a7ab9+'/'+_0x14072d)[_0x99ea('0x1a')](_0x73358d);}return null;};}function patchUpdates(_0x35948f){return function(_0x4fd0b3){try{jsonpatch[_0x99ea('0x21')](_0x4fd0b3,_0x35948f,!![]);}catch(_0x37bf13){return BPromise['reject'](_0x37bf13);}return _0x4fd0b3[_0x99ea('0x22')]();};}function saveUpdates(_0xb32dc2,_0x12fe18){return function(_0x57e5fd){if(_0x57e5fd){return _0x57e5fd[_0x99ea('0x23')](_0xb32dc2)[_0x99ea('0x24')](function(_0x40956a){return _0x40956a;});}return null;};}function removeEntity(_0x2319ff,_0x52f1ab){return function(_0x2834cb){if(_0x2834cb){return _0x2834cb[_0x99ea('0x25')]()[_0x99ea('0x24')](function(){var _0x235e89=_0x2834cb[_0x99ea('0x26')]({'plain':!![]});var _0x144f53=_0x99ea('0x27');return db[_0x99ea('0x28')]['destroy']({'where':{'type':_0x144f53,'resourceId':_0x235e89['id']}})[_0x99ea('0x24')](function(){return _0x2834cb;});})[_0x99ea('0x24')](function(){_0x2319ff[_0x99ea('0x19')](0xcc)[_0x99ea('0x18')]();});}};}function handleEntityNotFound(_0x29118a,_0x1d7ef2){return function(_0x9c3174){if(!_0x9c3174){_0x29118a[_0x99ea('0x17')](0x194);}return _0x9c3174;};}function handleError(_0x39891e,_0x32618d){_0x32618d=_0x32618d||0x1f4;return function(_0x4a9c5a){logger[_0x99ea('0x29')](_0x4a9c5a[_0x99ea('0x2a')]);if(_0x4a9c5a[_0x99ea('0x2b')]){delete _0x4a9c5a[_0x99ea('0x2b')];}_0x39891e[_0x99ea('0x19')](_0x32618d)['send'](_0x4a9c5a);};}exports[_0x99ea('0x2c')]=function(_0x116dc3,_0x59eb3c){var _0x396a99={},_0x1e6836={},_0xe54f79={'count':0x0,'rows':[]};var _0xa711e9=_[_0x99ea('0x2d')](db[_0x99ea('0x2e')][_0x99ea('0x2f')],function(_0x449872){return{'name':_0x449872['fieldName'],'type':_0x449872[_0x99ea('0x30')][_0x99ea('0x31')]};});_0x1e6836[_0x99ea('0x32')]=_[_0x99ea('0x2d')](_0xa711e9,_0x99ea('0x2b'));_0x1e6836[_0x99ea('0x33')]=_[_0x99ea('0x34')](_0x116dc3[_0x99ea('0x33')]);_0x1e6836[_0x99ea('0x35')]=_[_0x99ea('0x36')](_0x1e6836[_0x99ea('0x32')],_0x1e6836[_0x99ea('0x33')]);_0x396a99[_0x99ea('0x37')]=_[_0x99ea('0x36')](_0x1e6836[_0x99ea('0x32')],qs[_0x99ea('0x38')](_0x116dc3[_0x99ea('0x33')][_0x99ea('0x38')]));_0x396a99['attributes']=_0x396a99[_0x99ea('0x37')][_0x99ea('0x39')]?_0x396a99[_0x99ea('0x37')]:_0x1e6836[_0x99ea('0x32')];if(!_0x116dc3['query'][_0x99ea('0x3a')](_0x99ea('0x3b'))){_0x396a99[_0x99ea('0x1c')]=qs[_0x99ea('0x1c')](_0x116dc3[_0x99ea('0x33')][_0x99ea('0x1c')]);_0x396a99['offset']=qs['offset'](_0x116dc3[_0x99ea('0x33')][_0x99ea('0x1e')]);}_0x396a99[_0x99ea('0x3c')]=qs['sort'](_0x116dc3['query'][_0x99ea('0x3d')]);_0x396a99[_0x99ea('0x3e')]=qs[_0x99ea('0x35')](_[_0x99ea('0x3f')](_0x116dc3[_0x99ea('0x33')],_0x1e6836[_0x99ea('0x35')]),_0xa711e9);if(_0x116dc3[_0x99ea('0x33')][_0x99ea('0x40')]){_0x396a99[_0x99ea('0x3e')]=_[_0x99ea('0x41')](_0x396a99[_0x99ea('0x3e')],{'$or':_[_0x99ea('0x2d')](_0xa711e9,function(_0x323c09){if(_0x323c09['type']!==_0x99ea('0x42')){var _0x3adb6b={};_0x3adb6b[_0x323c09[_0x99ea('0x2b')]]={'$like':'%'+_0x116dc3[_0x99ea('0x33')][_0x99ea('0x40')]+'%'};return _0x3adb6b;}})});}_0x396a99=_[_0x99ea('0x41')]({},_0x396a99,_0x116dc3[_0x99ea('0x43')]);var _0x173885={'where':_0x396a99['where']};return db[_0x99ea('0x2e')][_0x99ea('0x1d')](_0x173885)[_0x99ea('0x24')](function(_0x177580){_0xe54f79[_0x99ea('0x1d')]=_0x177580;if(_0x116dc3['query']['includeAll']){_0x396a99[_0x99ea('0x44')]=[{'all':!![]}];}return db[_0x99ea('0x2e')]['findAll'](_0x396a99);})[_0x99ea('0x24')](function(_0x456d84){_0xe54f79['rows']=_0x456d84;return _0xe54f79;})[_0x99ea('0x24')](respondWithFilteredResult(_0x59eb3c,_0x396a99))[_0x99ea('0x45')](handleError(_0x59eb3c,null));};exports['show']=function(_0x36793c,_0x28d54f){var _0x2710a8={'raw':!![],'where':{'id':_0x36793c[_0x99ea('0x46')]['id']}},_0x586d56={};_0x586d56[_0x99ea('0x32')]=_[_0x99ea('0x34')](db[_0x99ea('0x2e')][_0x99ea('0x2f')]);_0x586d56[_0x99ea('0x33')]=_[_0x99ea('0x34')](_0x36793c[_0x99ea('0x33')]);_0x586d56[_0x99ea('0x35')]=_[_0x99ea('0x36')](_0x586d56[_0x99ea('0x32')],_0x586d56[_0x99ea('0x33')]);_0x2710a8['attributes']=_['intersection'](_0x586d56[_0x99ea('0x32')],qs[_0x99ea('0x38')](_0x36793c[_0x99ea('0x33')][_0x99ea('0x38')]));_0x2710a8[_0x99ea('0x37')]=_0x2710a8[_0x99ea('0x37')]['length']?_0x2710a8[_0x99ea('0x37')]:_0x586d56[_0x99ea('0x32')];if(_0x36793c[_0x99ea('0x33')][_0x99ea('0x47')]){_0x2710a8[_0x99ea('0x44')]=[{'all':!![]}];}_0x2710a8=_[_0x99ea('0x41')]({},_0x2710a8,_0x36793c[_0x99ea('0x43')]);return db[_0x99ea('0x2e')][_0x99ea('0x48')](_0x2710a8)[_0x99ea('0x24')](handleEntityNotFound(_0x28d54f,null))['then'](respondWithResult(_0x28d54f,null))[_0x99ea('0x45')](handleError(_0x28d54f,null));};exports[_0x99ea('0x49')]=function(_0x1be19c,_0x3d020e){return db['Variable'][_0x99ea('0x49')](_0x1be19c['body'],{})[_0x99ea('0x24')](function(_0x3d1cd7){var _0x1b500d=_0x1be19c[_0x99ea('0x4a')]['get']({'plain':!![]});if(!_0x1b500d)throw new Error(_0x99ea('0x4b'));if(_0x1b500d[_0x99ea('0x4c')]===_0x99ea('0x4a')){var _0x238c0a=_0x3d1cd7['get']({'plain':!![]});var _0x1c58c1=_0x99ea('0x27');return db['UserProfileSection'][_0x99ea('0x48')]({'where':{'name':_0x1c58c1,'userProfileId':_0x1b500d['userProfileId']},'raw':!![]})['then'](function(_0x5b6f6f){if(_0x5b6f6f&&_0x5b6f6f['autoAssociation']===0x0){return db[_0x99ea('0x28')][_0x99ea('0x49')]({'name':_0x238c0a['name'],'resourceId':_0x238c0a['id'],'type':_0x5b6f6f[_0x99ea('0x2b')],'sectionId':_0x5b6f6f['id']},{})[_0x99ea('0x24')](function(){return _0x3d1cd7;});}else{return _0x3d1cd7;}})[_0x99ea('0x45')](function(_0x4681a5){logger[_0x99ea('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4681a5);throw _0x4681a5;});}return _0x3d1cd7;})[_0x99ea('0x24')](respondWithResult(_0x3d020e,0xc9))[_0x99ea('0x45')](handleError(_0x3d020e,null));};exports[_0x99ea('0x23')]=function(_0x258525,_0x414b22){if(_0x258525['body']['id']){delete _0x258525[_0x99ea('0x4d')]['id'];}return db[_0x99ea('0x2e')][_0x99ea('0x48')]({'where':{'id':_0x258525['params']['id']}})[_0x99ea('0x24')](handleEntityNotFound(_0x414b22,null))[_0x99ea('0x24')](saveUpdates(_0x258525[_0x99ea('0x4d')],null))[_0x99ea('0x24')](respondWithResult(_0x414b22,null))['catch'](handleError(_0x414b22,null));};exports[_0x99ea('0x25')]=function(_0xe781a9,_0x34e07e){return db[_0x99ea('0x2e')]['find']({'where':{'id':_0xe781a9[_0x99ea('0x46')]['id']}})[_0x99ea('0x24')](handleEntityNotFound(_0x34e07e,null))[_0x99ea('0x24')](removeEntity(_0x34e07e,null))[_0x99ea('0x45')](handleError(_0x34e07e,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 7902ecd..281354e 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 _0x87cb=['lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./variable.attributes','exports','define'];(function(_0x6fe184,_0x198840){var _0x3efb55=function(_0x50e320){while(--_0x50e320){_0x6fe184['push'](_0x6fe184['shift']());}};_0x3efb55(++_0x198840);}(_0x87cb,0x1c2));var _0xb87c=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x87cb[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xb87c('0x0'));var util=require(_0xb87c('0x1'));var logger=require(_0xb87c('0x2'))('api');var moment=require(_0xb87c('0x3'));var BPromise=require(_0xb87c('0x4'));var rp=require(_0xb87c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb87c('0x6'));var attributes=require(_0xb87c('0x7'));module[_0xb87c('0x8')]=function(_0x50e87b,_0x4d9a38){return _0x50e87b[_0xb87c('0x9')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ec3=['lodash','util','api','bluebird','request-promise','path','rimraf','./variable.attributes','exports','define','Variable'];(function(_0x34ddf5,_0x36838b){var _0x29b34c=function(_0x228efe){while(--_0x228efe){_0x34ddf5['push'](_0x34ddf5['shift']());}};_0x29b34c(++_0x36838b);}(_0x8ec3,0x14a));var _0x38ec=function(_0x397fb4,_0x2a00f0){_0x397fb4=_0x397fb4-0x0;var _0xe202a1=_0x8ec3[_0x397fb4];return _0xe202a1;};'use strict';var _=require(_0x38ec('0x0'));var util=require(_0x38ec('0x1'));var logger=require('../../config/logger')(_0x38ec('0x2'));var moment=require('moment');var BPromise=require(_0x38ec('0x3'));var rp=require(_0x38ec('0x4'));var fs=require('fs');var path=require(_0x38ec('0x5'));var rimraf=require(_0x38ec('0x6'));var config=require('../../config/environment');var attributes=require(_0x38ec('0x7'));module[_0x38ec('0x8')]=function(_0x1ee289,_0x21a76c){return _0x1ee289[_0x38ec('0x9')](_0x38ec('0xa'),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 9bb3d11..6972a65 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 _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x1196b0,_0x36c47a){var _0x111c52=function(_0x5604c7){while(--_0x5604c7){_0x1196b0['push'](_0x1196b0['shift']());}};_0x111c52(++_0x36c47a);}(_0x55ca,0x126));var _0xa55c=function(_0x8d8f23,_0x8c1961){_0x8d8f23=_0x8d8f23-0x0;var _0x22bf54=_0x55ca[_0x8d8f23];return _0x22bf54;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x339fb4,_0x407ec9){var _0x2f57e6=function(_0xf2329b){while(--_0xf2329b){_0x339fb4['push'](_0x339fb4['shift']());}};_0x2f57e6(++_0x407ec9);}(_0xabce,0x103));var _0xeabc=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xabce[_0x433a86];return _0x23000c;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 07273fc..8cc24f0 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 _0xeb6e=['index','isAuthenticated','canUpdate','fetch','reset','/pull','pull','/restart','/migrations','express','Router','./version.controller','get'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xeb6e,0x14e));var _0xeeb6=function(_0x2cf678,_0x5d22cd){_0x2cf678=_0x2cf678-0x0;var _0x206b6a=_0xeb6e[_0x2cf678];return _0x206b6a;};'use strict';var express=require(_0xeeb6('0x0'));var router=express[_0xeeb6('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xeeb6('0x2'));router[_0xeeb6('0x3')]('/',controller[_0xeeb6('0x4')]);router[_0xeeb6('0x3')]('/fetch',auth[_0xeeb6('0x5')](),auth[_0xeeb6('0x6')](),controller[_0xeeb6('0x7')]);router[_0xeeb6('0x3')]('/reset',auth[_0xeeb6('0x5')](),auth[_0xeeb6('0x6')](),controller[_0xeeb6('0x8')]);router[_0xeeb6('0x3')](_0xeeb6('0x9'),auth['isAuthenticated'](),auth[_0xeeb6('0x6')](),controller[_0xeeb6('0xa')]);router['get'](_0xeeb6('0xb'),auth[_0xeeb6('0x5')](),controller['restart']);router[_0xeeb6('0x3')](_0xeeb6('0xc'),controller['migrations']);module['exports']=router; \ No newline at end of file +var _0x0e07=['pull','/restart','restart','/migrations','migrations','exports','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull'];(function(_0xe50267,_0x1c32f1){var _0x4e1590=function(_0x224933){while(--_0x224933){_0xe50267['push'](_0xe50267['shift']());}};_0x4e1590(++_0x1c32f1);}(_0x0e07,0xc9));var _0x70e0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0e07[_0x3bf83f];return _0x22c4a9;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x70e0('0x0'));var controller=require(_0x70e0('0x1'));router[_0x70e0('0x2')]('/',controller['index']);router[_0x70e0('0x2')](_0x70e0('0x3'),auth[_0x70e0('0x4')](),auth[_0x70e0('0x5')](),controller[_0x70e0('0x6')]);router[_0x70e0('0x2')](_0x70e0('0x7'),auth[_0x70e0('0x4')](),auth[_0x70e0('0x5')](),controller['reset']);router[_0x70e0('0x2')](_0x70e0('0x8'),auth[_0x70e0('0x4')](),auth[_0x70e0('0x5')](),controller[_0x70e0('0x9')]);router[_0x70e0('0x2')](_0x70e0('0xa'),auth[_0x70e0('0x4')](),controller[_0x70e0('0xb')]);router[_0x70e0('0x2')](_0x70e0('0xc'),controller[_0x70e0('0xd')]);module[_0x70e0('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 597fbbb..406056c 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 _0x5f1d=['sequelize','Migration','getQueryInterface','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','query','latest','fetch','2.0.0','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','.js','exports','push','sort'];(function(_0xf2931a,_0x2d490b){var _0x45c15d=function(_0x1ef510){while(--_0x1ef510){_0xf2931a['push'](_0xf2931a['shift']());}};_0x45c15d(++_0x2d490b);}(_0x5f1d,0x1b7));var _0xd5f1=function(_0x45ac2e,_0x3220a9){_0x45ac2e=_0x45ac2e-0x0;var _0x1406f3=_0x5f1d[_0x45ac2e];return _0x1406f3;};'use strict';var Umzug=require(_0xd5f1('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xd5f1('0x1'));var pkginfo=require(_0xd5f1('0x2'))(module,_0xd5f1('0x3'));var compareVersions=require(_0xd5f1('0x4'));var exec=require('child_process')[_0xd5f1('0x5')];var db=require(_0xd5f1('0x6'))['db'];var config=require(_0xd5f1('0x7'));var pm2=require(_0xd5f1('0x8'));var logger=require(_0xd5f1('0x9'))(_0xd5f1('0xa'));var git=require(_0xd5f1('0xb'))(config[_0xd5f1('0xc')]);exports[_0xd5f1('0xd')]=function(_0x352c63,_0x412107){var _0x282b13={'current':module['exports'][_0xd5f1('0x3')],'phonebar':0x2};if(_0x352c63[_0xd5f1('0xe')]&&_0x352c63['query'][_0xd5f1('0xf')]){return git[_0xd5f1('0x10')]()['tags'](function(_0x133ad3,_0x3c5c77){_0x282b13[_0xd5f1('0xf')]=(_0x133ad3?module['exports'][_0xd5f1('0x3')]:_0x3c5c77[_0xd5f1('0xf')])||_0xd5f1('0x11');return _0x412107[_0xd5f1('0x12')](0xc8)[_0xd5f1('0x13')](_0x282b13);});}else{return _0x412107[_0xd5f1('0x12')](0xc8)['json'](_0x282b13);}};exports['fetch']=function(_0x48da62,_0x900983){return git[_0xd5f1('0x10')]([_0xd5f1('0x14'),_0xd5f1('0x15')],function(_0x124b68){if(_0x124b68){logger['error'](_0x124b68);return _0x900983[_0xd5f1('0x12')](0x1f4)[_0xd5f1('0x13')](_0x124b68);}logger[_0xd5f1('0x16')](_0xd5f1('0x17'));return _0x900983[_0xd5f1('0x12')](0xc8)[_0xd5f1('0x13')]({'output':_0xd5f1('0x18')});});};exports['reset']=function(_0x26c49d,_0x3b381e){return git[_0xd5f1('0x19')]([_0xd5f1('0x1a'),_0xd5f1('0x1b')],function(_0x3af9ad){if(_0x3af9ad){logger[_0xd5f1('0x1c')](_0x3af9ad);return _0x3b381e[_0xd5f1('0x12')](0x1f4)[_0xd5f1('0x13')](_0x3af9ad);}logger[_0xd5f1('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3b381e['status'](0xc8)[_0xd5f1('0x13')]({'output':_0xd5f1('0x1d')});});};exports[_0xd5f1('0x1e')]=function(_0x9b4712,_0x3c1dca){exec(_0xd5f1('0x1f'),function(_0x1b9434,_0x4e6693,_0x19e36d){logger[_0xd5f1('0x16')](_0x4e6693);logger[_0xd5f1('0x16')](_0x19e36d);if(_0x1b9434){logger['error'](_0x1b9434);return _0x3c1dca[_0xd5f1('0x12')](0x1f4)[_0xd5f1('0x13')](_0x1b9434);}return _0x3c1dca[_0xd5f1('0x12')](0xc8)[_0xd5f1('0x13')]({'output':_0x4e6693});});};exports[_0xd5f1('0x20')]=function(_0x34fcdf,_0x3dceb3){return pm2[_0xd5f1('0x20')](_0xd5f1('0x21'))[_0xd5f1('0x22')](function(_0x15d576){logger['info'](_0xd5f1('0x23'),_0x15d576);return _0x3dceb3[_0xd5f1('0x12')](0xc8)[_0xd5f1('0x13')]({'output':_0xd5f1('0x24')});})[_0xd5f1('0x25')](function(_0x2b9d24){logger[_0xd5f1('0x1c')](_0x2b9d24);return _0x3dceb3[_0xd5f1('0x12')](0x1f4)[_0xd5f1('0x13')](_0x2b9d24);});};exports[_0xd5f1('0x26')]=function(_0x36a7ff,_0x11650e){var _0x19ce09=fs[_0xd5f1('0x27')](path[_0xd5f1('0x28')](config['root'],_0xd5f1('0x29'),'migrations'));var _0x1199a0=[];for(var _0x468894=0x0;_0x468894<_0x19ce09[_0xd5f1('0x2a')];_0x468894++){var _0x3e0626=_0x19ce09[_0x468894]['replace'](_0xd5f1('0x2b'),'');if(compareVersions(module[_0xd5f1('0x2c')][_0xd5f1('0x3')],_0x3e0626)===-0x1){_0x1199a0[_0xd5f1('0x2d')](_0x3e0626);}}if(_0x1199a0['length']){var _0x20152f=_0x1199a0[_0xd5f1('0x2e')](compareVersions);var _0x5bad8f=new Umzug({'storage':_0xd5f1('0x2f'),'storageOptions':{'model':db[_0xd5f1('0x30')],'modelName':_0xd5f1('0x30'),'columnName':_0xd5f1('0x3')},'migrations':{'params':[db[_0xd5f1('0x2f')][_0xd5f1('0x31')](),db[_0xd5f1('0x2f')]['constructor'],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xd5f1('0x28')](config[_0xd5f1('0xc')],_0xd5f1('0x29'),_0xd5f1('0x26')),'pattern':/\.js$/}});_0x5bad8f['up']({'migrations':_[_0xd5f1('0x32')](_0x20152f,function(_0x5e7025){return _0x5e7025+_0xd5f1('0x2b');})})[_0xd5f1('0x22')](function(){return _0x11650e[_0xd5f1('0x12')](0xc8)[_0xd5f1('0x13')]({'output':_0xd5f1('0x33')+module['exports'][_0xd5f1('0x3')]+'\x20to\x20'+_[_0xd5f1('0x34')](_0x20152f),'migrations':_[_0xd5f1('0x28')](_0x20152f)});})[_0xd5f1('0x25')](function(_0x46c714){if(_0x46c714 instanceof db[_0xd5f1('0x2f')]['UniqueConstraintError']){return _0x11650e['status'](0xc8)[_0xd5f1('0x13')]({'output':_0xd5f1('0x35')});}else{return _0x11650e['status'](0x1f4)[_0xd5f1('0x13')](_0x46c714);}});}else{return _0x11650e[_0xd5f1('0x12')](0xc8)[_0xd5f1('0x13')]({'output':_0xd5f1('0x35')});}}; \ No newline at end of file +var _0xdaf2=['Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','compare-versions','exec','../../mysqldb','../../config/environment','../../config/logger','simple-git','root','exports','version','query','latest','fetch','status','json','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor'];(function(_0x50bbe8,_0x260b4a){var _0x38bd00=function(_0x56d0d6){while(--_0x56d0d6){_0x50bbe8['push'](_0x50bbe8['shift']());}};_0x38bd00(++_0x260b4a);}(_0xdaf2,0xb8));var _0x2daf=function(_0x47df54,_0x1aeb61){_0x47df54=_0x47df54-0x0;var _0x261b87=_0xdaf2[_0x47df54];return _0x261b87;};'use strict';var Umzug=require(_0x2daf('0x0'));var path=require(_0x2daf('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x2daf('0x2'))(module,'version');var compareVersions=require(_0x2daf('0x3'));var exec=require('child_process')[_0x2daf('0x4')];var db=require(_0x2daf('0x5'))['db'];var config=require(_0x2daf('0x6'));var pm2=require('../../config/pm2');var logger=require(_0x2daf('0x7'))('update');var git=require(_0x2daf('0x8'))(config[_0x2daf('0x9')]);exports['index']=function(_0x4775dc,_0x19ba24){var _0x43ead3={'current':module[_0x2daf('0xa')][_0x2daf('0xb')],'phonebar':0x2};if(_0x4775dc[_0x2daf('0xc')]&&_0x4775dc[_0x2daf('0xc')][_0x2daf('0xd')]){return git[_0x2daf('0xe')]()['tags'](function(_0x41e1e8,_0x2a4966){_0x43ead3[_0x2daf('0xd')]=(_0x41e1e8?module['exports'][_0x2daf('0xb')]:_0x2a4966[_0x2daf('0xd')])||'2.0.0';return _0x19ba24[_0x2daf('0xf')](0xc8)[_0x2daf('0x10')](_0x43ead3);});}else{return _0x19ba24[_0x2daf('0xf')](0xc8)[_0x2daf('0x10')](_0x43ead3);}};exports[_0x2daf('0xe')]=function(_0x33573a,_0x1dd0c5){return git[_0x2daf('0xe')](['origin','master'],function(_0x4b10da){if(_0x4b10da){logger[_0x2daf('0x11')](_0x4b10da);return _0x1dd0c5[_0x2daf('0xf')](0x1f4)[_0x2daf('0x10')](_0x4b10da);}logger[_0x2daf('0x12')](_0x2daf('0x13'));return _0x1dd0c5['status'](0xc8)[_0x2daf('0x10')]({'output':_0x2daf('0x14')});});};exports[_0x2daf('0x15')]=function(_0xaaf27e,_0x1c28cd){return git[_0x2daf('0x15')](['--hard','FETCH_HEAD'],function(_0x2e81cc){if(_0x2e81cc){logger[_0x2daf('0x11')](_0x2e81cc);return _0x1c28cd[_0x2daf('0xf')](0x1f4)[_0x2daf('0x10')](_0x2e81cc);}logger[_0x2daf('0x12')](_0x2daf('0x16'));return _0x1c28cd[_0x2daf('0xf')](0xc8)[_0x2daf('0x10')]({'output':_0x2daf('0x17')});});};exports['pull']=function(_0x548eff,_0x278191){exec('npm\x20install\x20--production',function(_0x576225,_0x2eb565,_0x1aef5a){logger[_0x2daf('0x12')](_0x2eb565);logger['info'](_0x1aef5a);if(_0x576225){logger[_0x2daf('0x11')](_0x576225);return _0x278191[_0x2daf('0xf')](0x1f4)[_0x2daf('0x10')](_0x576225);}return _0x278191[_0x2daf('0xf')](0xc8)['json']({'output':_0x2eb565});});};exports[_0x2daf('0x18')]=function(_0x860e4f,_0x696cd4){return pm2['restart']('motion2')[_0x2daf('0x19')](function(_0x5deef5){logger[_0x2daf('0x12')](_0x2daf('0x1a'),_0x5deef5);return _0x696cd4[_0x2daf('0xf')](0xc8)[_0x2daf('0x10')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x2daf('0x1b')](function(_0x427092){logger[_0x2daf('0x11')](_0x427092);return _0x696cd4[_0x2daf('0xf')](0x1f4)[_0x2daf('0x10')](_0x427092);});};exports[_0x2daf('0x1c')]=function(_0x39c53d,_0x63e9ad){var _0x550d49=fs[_0x2daf('0x1d')](path[_0x2daf('0x1e')](config[_0x2daf('0x9')],_0x2daf('0x1f'),'migrations'));var _0x127f31=[];for(var _0x3848a9=0x0;_0x3848a9<_0x550d49[_0x2daf('0x20')];_0x3848a9++){var _0x4d3159=_0x550d49[_0x3848a9][_0x2daf('0x21')](_0x2daf('0x22'),'');if(compareVersions(module[_0x2daf('0xa')][_0x2daf('0xb')],_0x4d3159)===-0x1){_0x127f31[_0x2daf('0x23')](_0x4d3159);}}if(_0x127f31[_0x2daf('0x20')]){var _0x5b47b3=_0x127f31[_0x2daf('0x24')](compareVersions);var _0x5d8778=new Umzug({'storage':_0x2daf('0x25'),'storageOptions':{'model':db[_0x2daf('0x26')],'modelName':_0x2daf('0x26'),'columnName':'version'},'migrations':{'params':[db[_0x2daf('0x25')][_0x2daf('0x27')](),db[_0x2daf('0x25')][_0x2daf('0x28')],function(){throw new Error(_0x2daf('0x29'));}],'path':path[_0x2daf('0x1e')](config[_0x2daf('0x9')],_0x2daf('0x1f'),_0x2daf('0x1c')),'pattern':/\.js$/}});_0x5d8778['up']({'migrations':_['map'](_0x5b47b3,function(_0x93daa6){return _0x93daa6+_0x2daf('0x22');})})['then'](function(){return _0x63e9ad[_0x2daf('0xf')](0xc8)[_0x2daf('0x10')]({'output':_0x2daf('0x2a')+module[_0x2daf('0xa')][_0x2daf('0xb')]+'\x20to\x20'+_['last'](_0x5b47b3),'migrations':_['join'](_0x5b47b3)});})['catch'](function(_0x1dd1d3){if(_0x1dd1d3 instanceof db['sequelize'][_0x2daf('0x2b')]){return _0x63e9ad[_0x2daf('0xf')](0xc8)[_0x2daf('0x10')]({'output':_0x2daf('0x2c')});}else{return _0x63e9ad['status'](0x1f4)[_0x2daf('0x10')](_0x1dd1d3);}});}else{return _0x63e9ad[_0x2daf('0xf')](0xc8)['json']({'output':_0x2daf('0x2c')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 19bd07a..c6ad569 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 _0x9033=['destroy','multer','util','path','express','Router','fs-extra','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','delete'];(function(_0x53e3fa,_0x50c5f2){var _0xe8584a=function(_0x1771a5){while(--_0x1771a5){_0x53e3fa['push'](_0x53e3fa['shift']());}};_0xe8584a(++_0x50c5f2);}(_0x9033,0x1b6));var _0x3903=function(_0x153978,_0x28b2fb){_0x153978=_0x153978-0x0;var _0x3c3abd=_0x9033[_0x153978];return _0x3c3abd;};'use strict';var multer=require(_0x3903('0x0'));var util=require(_0x3903('0x1'));var path=require(_0x3903('0x2'));var timeout=require('connect-timeout');var express=require(_0x3903('0x3'));var router=express[_0x3903('0x4')]();var fs_extra=require(_0x3903('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3903('0x6'));var controller=require(_0x3903('0x7'));router['get']('/',auth[_0x3903('0x8')](),controller[_0x3903('0x9')]);router[_0x3903('0xa')](_0x3903('0xb'),auth[_0x3903('0x8')](),controller[_0x3903('0xc')]);router[_0x3903('0xa')](_0x3903('0xd'),auth[_0x3903('0x8')](),controller['show']);router[_0x3903('0xe')]('/',auth['isAuthenticated'](),controller[_0x3903('0xf')]);router[_0x3903('0x10')](_0x3903('0xd'),auth[_0x3903('0x8')](),controller['update']);router[_0x3903('0x11')](_0x3903('0xd'),auth['isAuthenticated'](),controller[_0x3903('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5080=['put','update','delete','destroy','multer','util','path','express','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','/:id','post','create'];(function(_0x470cdd,_0x4708cd){var _0x57fda7=function(_0x171462){while(--_0x171462){_0x470cdd['push'](_0x470cdd['shift']());}};_0x57fda7(++_0x4708cd);}(_0x5080,0x158));var _0x0508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5080[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0508('0x0'));var util=require(_0x0508('0x1'));var path=require(_0x0508('0x2'));var timeout=require('connect-timeout');var express=require(_0x0508('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0508('0x4'));var config=require('../../config/environment');var controller=require(_0x0508('0x5'));router[_0x0508('0x6')]('/',auth[_0x0508('0x7')](),controller[_0x0508('0x8')]);router[_0x0508('0x6')](_0x0508('0x9'),auth[_0x0508('0x7')](),controller['describe']);router[_0x0508('0x6')](_0x0508('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0508('0xb')]('/',auth[_0x0508('0x7')](),controller[_0x0508('0xc')]);router[_0x0508('0xd')]('/:id',auth[_0x0508('0x7')](),controller[_0x0508('0xe')]);router[_0x0508('0xf')](_0x0508('0xa'),auth[_0x0508('0x7')](),controller[_0x0508('0x10')]);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 67a2d9a..dea0ff4 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 _0xd5fc=['STRING','DATE','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x4955c9,_0x297c82){var _0x58007a=function(_0x2d4aac){while(--_0x2d4aac){_0x4955c9['push'](_0x4955c9['shift']());}};_0x58007a(++_0x297c82);}(_0xd5fc,0xae));var _0xcd5f=function(_0x4c1807,_0x148f6c){_0x4c1807=_0x4c1807-0x0;var _0x282815=_0xd5fc[_0x4c1807];return _0x282815;};'use strict';var Sequelize=require(_0xcd5f('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xcd5f('0x1')]},'calleridname':{'type':Sequelize[_0xcd5f('0x1')]},'queue':{'type':Sequelize[_0xcd5f('0x1')]},'interface':{'type':Sequelize[_0xcd5f('0x1')]},'membername':{'type':Sequelize[_0xcd5f('0x1')]},'agentcalledAt':{'type':Sequelize[_0xcd5f('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xcd5f('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xcd5f('0x2')]},'holdtime':{'type':Sequelize[_0xcd5f('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xcd5f('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xcd5f('0x3')]},'reason':{'type':Sequelize[_0xcd5f('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xcd5f('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xcd5f('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xcd5f('0x1')]},'language':{'type':Sequelize[_0xcd5f('0x1')]},'accountcode':{'type':Sequelize[_0xcd5f('0x1')]},'context':{'type':Sequelize[_0xcd5f('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xcd5f('0x1')]},'destchannel':{'type':Sequelize[_0xcd5f('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xcd5f('0x1')]},'destcalleridnum':{'type':Sequelize[_0xcd5f('0x1')]},'destcalleridname':{'type':Sequelize[_0xcd5f('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xcd5f('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xcd5f('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xcd5f('0x1')]},'destcontext':{'type':Sequelize[_0xcd5f('0x1')]},'destexten':{'type':Sequelize[_0xcd5f('0x1')]},'destpriority':{'type':Sequelize[_0xcd5f('0x1')]},'destuniqueid':{'type':Sequelize[_0xcd5f('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xcd5f('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xcd5f('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xcd5f('0x1')],'comment':_0xcd5f('0x4')},'transferexten':{'type':Sequelize[_0xcd5f('0x1')]},'transferuniqueid':{'type':Sequelize[_0xcd5f('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0bb4=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x26012f,_0xbeda9f){var _0x38b10f=function(_0xd82943){while(--_0xd82943){_0x26012f['push'](_0x26012f['shift']());}};_0x38b10f(++_0xbeda9f);}(_0x0bb4,0x77));var _0x40bb=function(_0x45d5dc,_0x5048ef){_0x45d5dc=_0x45d5dc-0x0;var _0x1174a3=_0x0bb4[_0x45d5dc];return _0x1174a3;};'use strict';var Sequelize=require(_0x40bb('0x0'));module[_0x40bb('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x40bb('0x2')]},'calleridnum':{'type':Sequelize[_0x40bb('0x2')]},'calleridname':{'type':Sequelize[_0x40bb('0x2')]},'queue':{'type':Sequelize[_0x40bb('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x40bb('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x40bb('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x40bb('0x3')]},'agentdumpAt':{'type':Sequelize[_0x40bb('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x40bb('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x40bb('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x40bb('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x40bb('0x5')]},'reason':{'type':Sequelize[_0x40bb('0x2')]},'lastevent':{'type':Sequelize[_0x40bb('0x2')]},'channel':{'type':Sequelize[_0x40bb('0x2')]},'channelstate':{'type':Sequelize[_0x40bb('0x5')]},'channelstatedesc':{'type':Sequelize[_0x40bb('0x2')]},'connectedlinenum':{'type':Sequelize[_0x40bb('0x2')]},'connectedlinename':{'type':Sequelize[_0x40bb('0x2')]},'language':{'type':Sequelize[_0x40bb('0x2')]},'accountcode':{'type':Sequelize[_0x40bb('0x2')]},'context':{'type':Sequelize[_0x40bb('0x2')]},'exten':{'type':Sequelize[_0x40bb('0x2')]},'priority':{'type':Sequelize[_0x40bb('0x2')]},'destchannel':{'type':Sequelize[_0x40bb('0x2')]},'destchannelstate':{'type':Sequelize[_0x40bb('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x40bb('0x2')]},'destcalleridnum':{'type':Sequelize[_0x40bb('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x40bb('0x2')]},'destlanguage':{'type':Sequelize[_0x40bb('0x2')]},'destaccountcode':{'type':Sequelize[_0x40bb('0x2')]},'destcontext':{'type':Sequelize[_0x40bb('0x2')]},'destexten':{'type':Sequelize[_0x40bb('0x2')]},'destpriority':{'type':Sequelize[_0x40bb('0x2')]},'destuniqueid':{'type':Sequelize[_0x40bb('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x40bb('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x40bb('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x40bb('0x2')],'comment':_0x40bb('0x6')},'transferexten':{'type':Sequelize[_0x40bb('0x2')]},'transferuniqueid':{'type':Sequelize[_0x40bb('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'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 53f74c0..ad1732a 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(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 a485a7c..e2a51fe 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 _0xc949=['path','rimraf','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x29579f,_0x2b98ea){var _0x36cb5a=function(_0x3378fb){while(--_0x3378fb){_0x29579f['push'](_0x29579f['shift']());}};_0x36cb5a(++_0x2b98ea);}(_0xc949,0x181));var _0x9c94=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc949[_0x432682];return _0x463d05;};'use strict';var _=require(_0x9c94('0x0'));var util=require('util');var logger=require(_0x9c94('0x1'))(_0x9c94('0x2'));var moment=require(_0x9c94('0x3'));var BPromise=require(_0x9c94('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c94('0x5'));var rimraf=require(_0x9c94('0x6'));var config=require('../../config/environment');var attributes=require(_0x9c94('0x7'));module[_0x9c94('0x8')]=function(_0x46d560,_0x1357ac){return _0x46d560['define'](_0x9c94('0x9'),attributes,{'tableName':_0x9c94('0xa'),'paranoid':![],'indexes':[{'fields':[_0x9c94('0xb'),_0x9c94('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x83d3=['report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceAgentReport'];(function(_0x5a240f,_0x187844){var _0x1ba1f2=function(_0x4ba791){while(--_0x4ba791){_0x5a240f['push'](_0x5a240f['shift']());}};_0x1ba1f2(++_0x187844);}(_0x83d3,0x17c));var _0x383d=function(_0xd3b0ac,_0x2f5065){_0xd3b0ac=_0xd3b0ac-0x0;var _0x3d773e=_0x83d3[_0xd3b0ac];return _0x3d773e;};'use strict';var _=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var logger=require(_0x383d('0x2'))(_0x383d('0x3'));var moment=require(_0x383d('0x4'));var BPromise=require('bluebird');var rp=require(_0x383d('0x5'));var fs=require('fs');var path=require(_0x383d('0x6'));var rimraf=require(_0x383d('0x7'));var config=require(_0x383d('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0x383d('0x9')]=function(_0x4f3c10,_0x50eaff){return _0x4f3c10[_0x383d('0xa')](_0x383d('0xb'),attributes,{'tableName':_0x383d('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x383d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 5271c64..41bf075 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 _0x7d1d=['rpc','../../config/environment','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','VoiceAgentReport','body','options','raw','CreateVoiceAgentReport','debug','UpdateVoiceAgentReport','update','where','attributes','limit','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0x7d1d,0xe6));var _0xd7d1=function(_0x146837,_0x2aa6a2){_0x146837=_0x146837-0x0;var _0x3d7e60=_0x7d1d[_0x146837];return _0x3d7e60;};'use strict';var _=require(_0xd7d1('0x0'));var util=require(_0xd7d1('0x1'));var moment=require(_0xd7d1('0x2'));var BPromise=require(_0xd7d1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7d1('0x4'));var db=require(_0xd7d1('0x5'))['db'];var utils=require(_0xd7d1('0x6'));var logger=require(_0xd7d1('0x7'))(_0xd7d1('0x8'));var config=require(_0xd7d1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd7d1('0xa')][_0xd7d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55f549,_0x5a0497,_0xd5ba2b){return new BPromise(function(_0xb23bff,_0x4c3ad5){return client[_0xd7d1('0xc')](_0x55f549,_0xd5ba2b)[_0xd7d1('0xd')](function(_0x355114){logger[_0xd7d1('0xe')](_0xd7d1('0xf'),_0x5a0497,'request\x20sent');logger['debug'](_0xd7d1('0x10'),_0x5a0497,_0xd7d1('0x11'),JSON['stringify'](_0x355114));if(_0x355114[_0xd7d1('0x12')]){if(_0x355114[_0xd7d1('0x12')][_0xd7d1('0x13')]===0x1f4){logger[_0xd7d1('0x12')](_0xd7d1('0xf'),_0x5a0497,_0x355114[_0xd7d1('0x12')][_0xd7d1('0x14')]);return _0x4c3ad5(_0x355114['error'][_0xd7d1('0x14')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x5a0497,_0x355114[_0xd7d1('0x12')][_0xd7d1('0x14')]);return _0xb23bff(_0x355114[_0xd7d1('0x12')][_0xd7d1('0x14')]);}else{logger['info'](_0xd7d1('0xf'),_0x5a0497,_0xd7d1('0x11'));_0xb23bff(_0x355114['result'][_0xd7d1('0x14')]);}})[_0xd7d1('0x15')](function(_0x31547b){logger[_0xd7d1('0x12')](_0xd7d1('0xf'),_0x5a0497,_0x31547b);_0x4c3ad5(_0x31547b);});});}exports['CreateVoiceAgentReport']=function(_0x3cab2e){var _0x4e38d5=this;return new Promise(function(_0x1f1a71,_0x465b22){return db[_0xd7d1('0x16')]['create'](_0x3cab2e[_0xd7d1('0x17')],{'raw':_0x3cab2e[_0xd7d1('0x18')]?_0x3cab2e['options'][_0xd7d1('0x19')]===undefined?!![]:![]:!![]})[_0xd7d1('0xd')](function(_0x35cb19){logger[_0xd7d1('0xe')](_0xd7d1('0x1a'),_0x3cab2e);logger[_0xd7d1('0x1b')](_0xd7d1('0x1a'),_0x3cab2e,JSON['stringify'](_0x35cb19));_0x1f1a71(_0x35cb19);})['catch'](function(_0x45beb7){logger[_0xd7d1('0x12')](_0xd7d1('0x1a'),_0x45beb7[_0xd7d1('0x14')],_0x3cab2e);_0x465b22(_0x4e38d5['error'](0x1f4,_0x45beb7[_0xd7d1('0x14')]));});});};exports[_0xd7d1('0x1c')]=function(_0x57a3c8){var _0x9b54cb=this;return new Promise(function(_0x5eedb2,_0xeee3d7){return db[_0xd7d1('0x16')][_0xd7d1('0x1d')](_0x57a3c8[_0xd7d1('0x17')],{'raw':_0x57a3c8[_0xd7d1('0x18')]?_0x57a3c8[_0xd7d1('0x18')][_0xd7d1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57a3c8[_0xd7d1('0x18')]?_0x57a3c8[_0xd7d1('0x18')][_0xd7d1('0x1e')]||null:null,'attributes':_0x57a3c8[_0xd7d1('0x18')]?_0x57a3c8[_0xd7d1('0x18')][_0xd7d1('0x1f')]||null:null,'limit':_0x57a3c8[_0xd7d1('0x18')]?_0x57a3c8[_0xd7d1('0x18')][_0xd7d1('0x20')]||null:null})[_0xd7d1('0xd')](function(_0x428352){logger[_0xd7d1('0xe')](_0xd7d1('0x1c'),_0x57a3c8);logger[_0xd7d1('0x1b')]('UpdateVoiceAgentReport',_0x57a3c8,JSON[_0xd7d1('0x21')](_0x428352));_0x5eedb2(_0x428352);})[_0xd7d1('0x15')](function(_0x50b5e9){logger[_0xd7d1('0x12')](_0xd7d1('0x1c'),_0x50b5e9[_0xd7d1('0x14')],_0x57a3c8);_0xeee3d7(_0x9b54cb[_0xd7d1('0x12')](0x1f4,_0x50b5e9[_0xd7d1('0x14')]));});});}; \ No newline at end of file +var _0x6645=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','debug','catch','update','raw','where','attributes','UpdateVoiceAgentReport'];(function(_0x564583,_0x369239){var _0x13ed6e=function(_0xf71f8a){while(--_0xf71f8a){_0x564583['push'](_0x564583['shift']());}};_0x13ed6e(++_0x369239);}(_0x6645,0x1c7));var _0x5664=function(_0x549689,_0x4d8ca6){_0x549689=_0x549689-0x0;var _0x57cdfe=_0x6645[_0x549689];return _0x57cdfe;};'use strict';var _=require(_0x5664('0x0'));var util=require(_0x5664('0x1'));var moment=require(_0x5664('0x2'));var BPromise=require(_0x5664('0x3'));var rs=require(_0x5664('0x4'));var fs=require('fs');var Redis=require(_0x5664('0x5'));var db=require(_0x5664('0x6'))['db'];var utils=require(_0x5664('0x7'));var logger=require('../../config/logger')(_0x5664('0x8'));var config=require(_0x5664('0x9'));var jayson=require(_0x5664('0xa'));var client=jayson[_0x5664('0xb')][_0x5664('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb7092d,_0x427bc7,_0x49f73b){return new BPromise(function(_0x1ff9f5,_0x38eec4){return client[_0x5664('0xd')](_0xb7092d,_0x49f73b)[_0x5664('0xe')](function(_0x406d9d){logger['info'](_0x5664('0xf'),_0x427bc7,_0x5664('0x10'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x427bc7,_0x5664('0x10'),JSON[_0x5664('0x11')](_0x406d9d));if(_0x406d9d[_0x5664('0x12')]){if(_0x406d9d[_0x5664('0x12')][_0x5664('0x13')]===0x1f4){logger[_0x5664('0x12')](_0x5664('0xf'),_0x427bc7,_0x406d9d[_0x5664('0x12')][_0x5664('0x14')]);return _0x38eec4(_0x406d9d['error'][_0x5664('0x14')]);}logger['error'](_0x5664('0xf'),_0x427bc7,_0x406d9d[_0x5664('0x12')]['message']);return _0x1ff9f5(_0x406d9d[_0x5664('0x12')]['message']);}else{logger[_0x5664('0x15')](_0x5664('0xf'),_0x427bc7,'request\x20sent');_0x1ff9f5(_0x406d9d[_0x5664('0x16')][_0x5664('0x14')]);}})['catch'](function(_0x2a9aa0){logger['error'](_0x5664('0xf'),_0x427bc7,_0x2a9aa0);_0x38eec4(_0x2a9aa0);});});}exports[_0x5664('0x17')]=function(_0x1f83ba){var _0x2b9ba4=this;return new Promise(function(_0x1b644a,_0x40edd6){return db[_0x5664('0x18')][_0x5664('0x19')](_0x1f83ba[_0x5664('0x1a')],{'raw':_0x1f83ba[_0x5664('0x1b')]?_0x1f83ba['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x53a4ee){logger[_0x5664('0x15')]('CreateVoiceAgentReport',_0x1f83ba);logger[_0x5664('0x1c')](_0x5664('0x17'),_0x1f83ba,JSON['stringify'](_0x53a4ee));_0x1b644a(_0x53a4ee);})[_0x5664('0x1d')](function(_0x3bccb7){logger['error'](_0x5664('0x17'),_0x3bccb7[_0x5664('0x14')],_0x1f83ba);_0x40edd6(_0x2b9ba4[_0x5664('0x12')](0x1f4,_0x3bccb7['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x5bb74e){var _0x4958fc=this;return new Promise(function(_0x3cb2f7,_0x5995fe){return db['VoiceAgentReport'][_0x5664('0x1e')](_0x5bb74e['body'],{'raw':_0x5bb74e[_0x5664('0x1b')]?_0x5bb74e[_0x5664('0x1b')][_0x5664('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bb74e[_0x5664('0x1b')]?_0x5bb74e['options'][_0x5664('0x20')]||null:null,'attributes':_0x5bb74e['options']?_0x5bb74e[_0x5664('0x1b')][_0x5664('0x21')]||null:null,'limit':_0x5bb74e['options']?_0x5bb74e['options']['limit']||null:null})[_0x5664('0xe')](function(_0x40dfd8){logger[_0x5664('0x15')](_0x5664('0x22'),_0x5bb74e);logger[_0x5664('0x1c')](_0x5664('0x22'),_0x5bb74e,JSON[_0x5664('0x11')](_0x40dfd8));_0x3cb2f7(_0x40dfd8);})[_0x5664('0x1d')](function(_0x5cc01c){logger[_0x5664('0x12')]('UpdateVoiceAgentReport',_0x5cc01c[_0x5664('0x14')],_0x5bb74e);_0x5995fe(_0x4958fc[_0x5664('0x12')](0x1f4,_0x5cc01c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 1e3ff35..b820f25 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 _0xb458=['./voiceCallReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','put','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x472ee7,_0x302242){var _0x6aa3f3=function(_0x43beda){while(--_0x43beda){_0x472ee7['push'](_0x472ee7['shift']());}};_0x6aa3f3(++_0x302242);}(_0xb458,0x103));var _0x8b45=function(_0x4d83ef,_0x49c76e){_0x4d83ef=_0x4d83ef-0x0;var _0x495f4f=_0xb458[_0x4d83ef];return _0x495f4f;};'use strict';var multer=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b45('0x3')]();var fs_extra=require(_0x8b45('0x4'));var auth=require(_0x8b45('0x5'));var interaction=require(_0x8b45('0x6'));var config=require('../../config/environment');var controller=require(_0x8b45('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8b45('0x8')]);router[_0x8b45('0x9')](_0x8b45('0xa'),auth[_0x8b45('0xb')](),controller[_0x8b45('0xc')]);router['get'](_0x8b45('0xd'),auth[_0x8b45('0xb')](),controller[_0x8b45('0xe')]);router[_0x8b45('0xf')]('/',auth[_0x8b45('0xb')](),controller['create']);router[_0x8b45('0x10')](_0x8b45('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8b45('0xb')](),controller[_0x8b45('0x11')]);module[_0x8b45('0x12')]=router; \ No newline at end of file +var _0x5178=['/describe','isAuthenticated','describe','/:id','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index'];(function(_0x378d9a,_0x459fc5){var _0xb77ff8=function(_0xc4e3f2){while(--_0xc4e3f2){_0x378d9a['push'](_0x378d9a['shift']());}};_0xb77ff8(++_0x459fc5);}(_0x5178,0x171));var _0x8517=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5178[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x8517('0x0'));var path=require(_0x8517('0x1'));var timeout=require(_0x8517('0x2'));var express=require(_0x8517('0x3'));var router=express[_0x8517('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var controller=require('./voiceCallReport.controller');router[_0x8517('0x7')]('/',auth['isAuthenticated'](),controller[_0x8517('0x8')]);router[_0x8517('0x7')](_0x8517('0x9'),auth[_0x8517('0xa')](),controller[_0x8517('0xb')]);router['get'](_0x8517('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8517('0xd')]('/',auth[_0x8517('0xa')](),controller['create']);router[_0x8517('0xe')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0xf')]);router[_0x8517('0x10')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0x11')]);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 67c8f62..55a43d7 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 _0x4e25=['outbound-fax','dialer','DATE','INTEGER','exports','STRING','inbound','internal','outbound'];(function(_0x15fba8,_0xc5eb7c){var _0x566cbc=function(_0x4aa070){while(--_0x4aa070){_0x15fba8['push'](_0x15fba8['shift']());}};_0x566cbc(++_0xc5eb7c);}(_0x4e25,0x175));var _0x54e2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4e25[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x54e2('0x0')]={'uniqueid':{'type':Sequelize[_0x54e2('0x1')]},'type':{'type':Sequelize['ENUM'](_0x54e2('0x2'),_0x54e2('0x3'),_0x54e2('0x4'),'inbound-fax',_0x54e2('0x5'),_0x54e2('0x6'))},'tag':{'type':Sequelize[_0x54e2('0x1')]},'accountcode':{'type':Sequelize[_0x54e2('0x1')]},'source':{'type':Sequelize[_0x54e2('0x1')]},'destination':{'type':Sequelize[_0x54e2('0x1')]},'destinationcontext':{'type':Sequelize[_0x54e2('0x1')]},'callerid':{'type':Sequelize[_0x54e2('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x54e2('0x1')]},'lastapplication':{'type':Sequelize[_0x54e2('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x54e2('0x7')]},'answertime':{'type':Sequelize[_0x54e2('0x7')]},'endtime':{'type':Sequelize[_0x54e2('0x7')]},'duration':{'type':Sequelize[_0x54e2('0x8')]},'billableseconds':{'type':Sequelize[_0x54e2('0x8')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x54e2('0x1')]},'userDisposition':{'type':Sequelize[_0x54e2('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x54e2('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x54e2('0x1')]},'note':{'type':Sequelize[_0x54e2('0x1')]},'prefix':{'type':Sequelize[_0x54e2('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x54e2('0x1')]}}; \ No newline at end of file +var _0x4bde=['dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','inbound','internal','outbound','inbound-fax'];(function(_0x380b52,_0x5b1752){var _0x2e098c=function(_0x41d777){while(--_0x41d777){_0x380b52['push'](_0x380b52['shift']());}};_0x2e098c(++_0x5b1752);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x573dca,_0x585f0e){_0x573dca=_0x573dca-0x0;var _0x74ec51=_0x4bde[_0x573dca];return _0x74ec51;};'use strict';var Sequelize=require(_0xe4bd('0x0'));module[_0xe4bd('0x1')]={'uniqueid':{'type':Sequelize[_0xe4bd('0x2')]},'type':{'type':Sequelize['ENUM'](_0xe4bd('0x3'),_0xe4bd('0x4'),_0xe4bd('0x5'),_0xe4bd('0x6'),'outbound-fax',_0xe4bd('0x7'))},'tag':{'type':Sequelize[_0xe4bd('0x2')]},'accountcode':{'type':Sequelize[_0xe4bd('0x2')]},'source':{'type':Sequelize[_0xe4bd('0x2')]},'destination':{'type':Sequelize[_0xe4bd('0x2')]},'destinationcontext':{'type':Sequelize[_0xe4bd('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe4bd('0x2')]},'destinationchannel':{'type':Sequelize[_0xe4bd('0x2')]},'lastapplication':{'type':Sequelize[_0xe4bd('0x2')]},'lastdata':{'type':Sequelize[_0xe4bd('0x8')]},'starttime':{'type':Sequelize[_0xe4bd('0x9')]},'systemanswertime':{'type':Sequelize[_0xe4bd('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xe4bd('0xa')]},'mohtime':{'type':Sequelize[_0xe4bd('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe4bd('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xe4bd('0x2')]},'userDisposition':{'type':Sequelize[_0xe4bd('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xe4bd('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xe4bd('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xe4bd('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xe4bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 2bc2958..f361e3c 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x5f391d,_0x3d53f0){var _0x475d94=function(_0xb3763d){while(--_0xb3763d){_0x5f391d['push'](_0x5f391d['shift']());}};_0x475d94(++_0x3d53f0);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0x0b0e[_0x1ae4a9];return _0x54d0b0;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x763007,_0x393ca7){var _0x1657a7=function(_0x187aed){while(--_0x187aed){_0x763007['push'](_0x763007['shift']());}};_0x1657a7(++_0x393ca7);}(_0xdb28,0x106));var _0x8db2=function(_0x37a751,_0x488ac3){_0x37a751=_0x37a751-0x0;var _0x430932=_0xdb28[_0x37a751];return _0x430932;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index e0cd731..0173204 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 _0x1986=['bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid','util','api','moment'];(function(_0x4b8c7b,_0x4648cc){var _0x85dfb4=function(_0x1c5a6c){while(--_0x1c5a6c){_0x4b8c7b['push'](_0x4b8c7b['shift']());}};_0x85dfb4(++_0x4648cc);}(_0x1986,0x135));var _0x6198=function(_0x54f727,_0x547925){_0x54f727=_0x54f727-0x0;var _0x2055f0=_0x1986[_0x54f727];return _0x2055f0;};'use strict';var _=require('lodash');var util=require(_0x6198('0x0'));var logger=require('../../config/logger')(_0x6198('0x1'));var moment=require(_0x6198('0x2'));var BPromise=require(_0x6198('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6198('0x4'));var rimraf=require(_0x6198('0x5'));var config=require(_0x6198('0x6'));var attributes=require(_0x6198('0x7'));module[_0x6198('0x8')]=function(_0x3f1ea2,_0x5d1ba1){return _0x3f1ea2[_0x6198('0x9')]('VoiceCallReport',attributes,{'tableName':_0x6198('0xa'),'paranoid':![],'indexes':[{'fields':[_0x6198('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf754=['uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define'];(function(_0x11ac57,_0x4ea5a0){var _0x42e683=function(_0x56d553){while(--_0x56d553){_0x11ac57['push'](_0x11ac57['shift']());}};_0x42e683(++_0x4ea5a0);}(_0xf754,0x1b1));var _0x4f75=function(_0x4138ea,_0x29b4f5){_0x4138ea=_0x4138ea-0x0;var _0x4df353=_0xf754[_0x4138ea];return _0x4df353;};'use strict';var _=require(_0x4f75('0x0'));var util=require(_0x4f75('0x1'));var logger=require('../../config/logger')(_0x4f75('0x2'));var moment=require(_0x4f75('0x3'));var BPromise=require(_0x4f75('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f75('0x5'));var rimraf=require(_0x4f75('0x6'));var config=require(_0x4f75('0x7'));var attributes=require(_0x4f75('0x8'));module[_0x4f75('0x9')]=function(_0xad7d3,_0x336865){return _0xad7d3[_0x4f75('0xa')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x4f75('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index eacb347..09c5ee3 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 _0x549f=['GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x549f,0x187));var _0xf549=function(_0xbe1cb,_0x3a9ed8){_0xbe1cb=_0xbe1cb-0x0;var _0x398a6f=_0x549f[_0xbe1cb];return _0x398a6f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf549('0x0'));var BPromise=require(_0xf549('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf549('0x2'));var db=require(_0xf549('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf549('0x4'));var jayson=require(_0xf549('0x5'));var client=jayson[_0xf549('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24b423,_0x16a895,_0x55aa14){return new BPromise(function(_0x4d7ded,_0x693cb4){return client[_0xf549('0x7')](_0x24b423,_0x55aa14)['then'](function(_0x27dc1f){logger['info'](_0xf549('0x8'),_0x16a895,'request\x20sent');logger['debug'](_0xf549('0x9'),_0x16a895,_0xf549('0xa'),JSON[_0xf549('0xb')](_0x27dc1f));if(_0x27dc1f[_0xf549('0xc')]){if(_0x27dc1f[_0xf549('0xc')]['code']===0x1f4){logger[_0xf549('0xc')](_0xf549('0x8'),_0x16a895,_0x27dc1f['error']['message']);return _0x693cb4(_0x27dc1f['error'][_0xf549('0xd')]);}logger[_0xf549('0xc')](_0xf549('0x8'),_0x16a895,_0x27dc1f[_0xf549('0xc')][_0xf549('0xd')]);return _0x4d7ded(_0x27dc1f[_0xf549('0xc')][_0xf549('0xd')]);}else{logger[_0xf549('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x16a895,'request\x20sent');_0x4d7ded(_0x27dc1f[_0xf549('0xf')][_0xf549('0xd')]);}})[_0xf549('0x10')](function(_0x58ce14){logger[_0xf549('0xc')](_0xf549('0x8'),_0x16a895,_0x58ce14);_0x693cb4(_0x58ce14);});});}exports[_0xf549('0x11')]=function(_0x4220e6){var _0x4e03dd=this;return new Promise(function(_0x1faf2f,_0x778a8d){return db[_0xf549('0x12')][_0xf549('0x13')]({'raw':_0x4220e6['options']?_0x4220e6[_0xf549('0x14')][_0xf549('0x15')]===undefined?!![]:![]:!![],'where':_0x4220e6[_0xf549('0x14')]?_0x4220e6[_0xf549('0x14')][_0xf549('0x16')]||null:null,'attributes':_0x4220e6['options']?_0x4220e6[_0xf549('0x14')][_0xf549('0x17')]||null:null,'limit':_0x4220e6[_0xf549('0x14')]?_0x4220e6[_0xf549('0x14')][_0xf549('0x18')]||null:null,'include':_0x4220e6['options']?_0x4220e6['options'][_0xf549('0x19')]?_[_0xf549('0x1a')](_0x4220e6['options'][_0xf549('0x19')],function(_0x511fa4){return{'model':db[_0x511fa4[_0xf549('0x1b')]],'as':_0x511fa4['as'],'attributes':_0x511fa4[_0xf549('0x17')],'include':_0x511fa4['include']?_[_0xf549('0x1a')](_0x511fa4[_0xf549('0x19')],function(_0x390c0f){return{'model':db[_0x390c0f['model']],'as':_0x390c0f['as'],'attributes':_0x390c0f[_0xf549('0x17')],'include':_0x390c0f[_0xf549('0x19')]?_[_0xf549('0x1a')](_0x390c0f[_0xf549('0x19')],function(_0x39cfc5){return{'model':db[_0x39cfc5[_0xf549('0x1b')]],'as':_0x39cfc5['as'],'attributes':_0x39cfc5['attributes']};}):[]};}):[]};}):[]:[]})[_0xf549('0x1c')](function(_0x54085d){logger[_0xf549('0xe')](_0xf549('0x11'),_0x4220e6);logger[_0xf549('0x1d')](_0xf549('0x11'),_0x4220e6,JSON[_0xf549('0xb')](_0x54085d));_0x1faf2f(_0x54085d);})[_0xf549('0x10')](function(_0x475ab4){logger['error'](_0xf549('0x11'),_0x475ab4[_0xf549('0xd')],_0x4220e6);_0x778a8d(_0x4e03dd[_0xf549('0xc')](0x1f4,_0x475ab4['message']));});});};exports[_0xf549('0x1e')]=function(_0x4ce3dd){var _0x3fc808=this;return new Promise(function(_0x51d8d0,_0xc120ab){return db['VoiceCallReport'][_0xf549('0x1f')](_0x4ce3dd[_0xf549('0x20')],{'raw':_0x4ce3dd[_0xf549('0x14')]?_0x4ce3dd[_0xf549('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x380ae6){logger[_0xf549('0xe')]('CreateVoiceCallReport',_0x4ce3dd);logger['debug'](_0xf549('0x1e'),_0x4ce3dd,JSON[_0xf549('0xb')](_0x380ae6));_0x51d8d0(_0x380ae6);})['catch'](function(_0x3dbe52){logger[_0xf549('0xc')]('CreateVoiceCallReport',_0x3dbe52[_0xf549('0xd')],_0x4ce3dd);_0xc120ab(_0x3fc808[_0xf549('0xc')](0x1f4,_0x3dbe52[_0xf549('0xd')]));});});};exports[_0xf549('0x21')]=function(_0x200930){var _0x3a07eb=this;return new Promise(function(_0x259153,_0x4ef33f){return db['VoiceCallReport']['update'](_0x200930[_0xf549('0x20')],{'raw':_0x200930[_0xf549('0x14')]?_0x200930[_0xf549('0x14')][_0xf549('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x200930[_0xf549('0x14')]?_0x200930[_0xf549('0x14')][_0xf549('0x16')]||null:null,'attributes':_0x200930[_0xf549('0x14')]?_0x200930[_0xf549('0x14')][_0xf549('0x17')]||null:null,'limit':_0x200930[_0xf549('0x14')]?_0x200930['options'][_0xf549('0x18')]||null:null})['then'](function(_0xc441c6){logger[_0xf549('0xe')](_0xf549('0x21'),_0x200930);logger[_0xf549('0x1d')](_0xf549('0x21'),_0x200930,JSON['stringify'](_0xc441c6));_0x259153(_0xc441c6);})[_0xf549('0x10')](function(_0x5c520d){logger['error'](_0xf549('0x21'),_0x5c520d[_0xf549('0xd')],_0x200930);_0x4ef33f(_0x3a07eb[_0xf549('0xc')](0x1f4,_0x5c520d[_0xf549('0xd')]));});});}; \ No newline at end of file +var _0x0e88=['raw','attributes','limit','map','include','model','then','body','UpdateVoiceCallReport','update','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','options'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0x0e88,0x1af));var _0x80e8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0e88[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x80e8('0x0'));var util=require(_0x80e8('0x1'));var moment=require('moment');var BPromise=require(_0x80e8('0x2'));var rs=require(_0x80e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80e8('0x4'))['db'];var utils=require(_0x80e8('0x5'));var logger=require(_0x80e8('0x6'))(_0x80e8('0x7'));var config=require(_0x80e8('0x8'));var jayson=require(_0x80e8('0x9'));var client=jayson[_0x80e8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4900df,_0x54498c,_0x4f3b88){return new BPromise(function(_0x44e0d2,_0x6f47ba){return client['request'](_0x4900df,_0x4f3b88)['then'](function(_0x12ca67){logger[_0x80e8('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x54498c,_0x80e8('0xc'));logger[_0x80e8('0xd')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x54498c,_0x80e8('0xc'),JSON[_0x80e8('0xe')](_0x12ca67));if(_0x12ca67[_0x80e8('0xf')]){if(_0x12ca67[_0x80e8('0xf')][_0x80e8('0x10')]===0x1f4){logger['error'](_0x80e8('0x11'),_0x54498c,_0x12ca67[_0x80e8('0xf')][_0x80e8('0x12')]);return _0x6f47ba(_0x12ca67[_0x80e8('0xf')][_0x80e8('0x12')]);}logger[_0x80e8('0xf')](_0x80e8('0x11'),_0x54498c,_0x12ca67[_0x80e8('0xf')][_0x80e8('0x12')]);return _0x44e0d2(_0x12ca67[_0x80e8('0xf')][_0x80e8('0x12')]);}else{logger[_0x80e8('0xb')](_0x80e8('0x11'),_0x54498c,_0x80e8('0xc'));_0x44e0d2(_0x12ca67[_0x80e8('0x13')]['message']);}})[_0x80e8('0x14')](function(_0x4af967){logger[_0x80e8('0xf')](_0x80e8('0x11'),_0x54498c,_0x4af967);_0x6f47ba(_0x4af967);});});}exports[_0x80e8('0x15')]=function(_0x46dd8e){var _0x295e0d=this;return new Promise(function(_0x28f884,_0x2e87dd){return db[_0x80e8('0x16')]['findAll']({'raw':_0x46dd8e[_0x80e8('0x17')]?_0x46dd8e[_0x80e8('0x17')][_0x80e8('0x18')]===undefined?!![]:![]:!![],'where':_0x46dd8e[_0x80e8('0x17')]?_0x46dd8e[_0x80e8('0x17')]['where']||null:null,'attributes':_0x46dd8e[_0x80e8('0x17')]?_0x46dd8e[_0x80e8('0x17')][_0x80e8('0x19')]||null:null,'limit':_0x46dd8e[_0x80e8('0x17')]?_0x46dd8e[_0x80e8('0x17')][_0x80e8('0x1a')]||null:null,'include':_0x46dd8e['options']?_0x46dd8e[_0x80e8('0x17')]['include']?_[_0x80e8('0x1b')](_0x46dd8e['options'][_0x80e8('0x1c')],function(_0x399e66){return{'model':db[_0x399e66['model']],'as':_0x399e66['as'],'attributes':_0x399e66[_0x80e8('0x19')],'include':_0x399e66['include']?_['map'](_0x399e66['include'],function(_0x1972aa){return{'model':db[_0x1972aa['model']],'as':_0x1972aa['as'],'attributes':_0x1972aa[_0x80e8('0x19')],'include':_0x1972aa['include']?_[_0x80e8('0x1b')](_0x1972aa[_0x80e8('0x1c')],function(_0x19d70b){return{'model':db[_0x19d70b[_0x80e8('0x1d')]],'as':_0x19d70b['as'],'attributes':_0x19d70b['attributes']};}):[]};}):[]};}):[]:[]})[_0x80e8('0x1e')](function(_0xd96118){logger['info']('GetVoiceCallReport',_0x46dd8e);logger[_0x80e8('0xd')](_0x80e8('0x15'),_0x46dd8e,JSON[_0x80e8('0xe')](_0xd96118));_0x28f884(_0xd96118);})[_0x80e8('0x14')](function(_0x232471){logger[_0x80e8('0xf')](_0x80e8('0x15'),_0x232471[_0x80e8('0x12')],_0x46dd8e);_0x2e87dd(_0x295e0d[_0x80e8('0xf')](0x1f4,_0x232471[_0x80e8('0x12')]));});});};exports['CreateVoiceCallReport']=function(_0x3d28ef){var _0x2abdbc=this;return new Promise(function(_0x389128,_0x19f8d9){return db['VoiceCallReport']['create'](_0x3d28ef[_0x80e8('0x1f')],{'raw':_0x3d28ef[_0x80e8('0x17')]?_0x3d28ef[_0x80e8('0x17')][_0x80e8('0x18')]===undefined?!![]:![]:!![]})[_0x80e8('0x1e')](function(_0xf50d4e){logger[_0x80e8('0xb')]('CreateVoiceCallReport',_0x3d28ef);logger[_0x80e8('0xd')]('CreateVoiceCallReport',_0x3d28ef,JSON[_0x80e8('0xe')](_0xf50d4e));_0x389128(_0xf50d4e);})[_0x80e8('0x14')](function(_0x31d65b){logger['error']('CreateVoiceCallReport',_0x31d65b[_0x80e8('0x12')],_0x3d28ef);_0x19f8d9(_0x2abdbc[_0x80e8('0xf')](0x1f4,_0x31d65b[_0x80e8('0x12')]));});});};exports[_0x80e8('0x20')]=function(_0x1d9838){var _0x54bf1f=this;return new Promise(function(_0x1ba1e8,_0x4bc232){return db[_0x80e8('0x16')][_0x80e8('0x21')](_0x1d9838[_0x80e8('0x1f')],{'raw':_0x1d9838[_0x80e8('0x17')]?_0x1d9838['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d9838[_0x80e8('0x17')]?_0x1d9838[_0x80e8('0x17')][_0x80e8('0x22')]||null:null,'attributes':_0x1d9838[_0x80e8('0x17')]?_0x1d9838[_0x80e8('0x17')]['attributes']||null:null,'limit':_0x1d9838[_0x80e8('0x17')]?_0x1d9838[_0x80e8('0x17')]['limit']||null:null})[_0x80e8('0x1e')](function(_0x1350d8){logger[_0x80e8('0xb')]('UpdateVoiceCallReport',_0x1d9838);logger[_0x80e8('0xd')](_0x80e8('0x20'),_0x1d9838,JSON['stringify'](_0x1350d8));_0x1ba1e8(_0x1350d8);})[_0x80e8('0x14')](function(_0x21add3){logger[_0x80e8('0xf')](_0x80e8('0x20'),_0x21add3[_0x80e8('0x12')],_0x1d9838);_0x4bc232(_0x54bf1f[_0x80e8('0xf')](0x1f4,_0x21add3[_0x80e8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 0aacd11..9a0323c 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 _0xbb0e=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','show','post','/:id','destroy','exports','multer','util'];(function(_0x30fe8c,_0x272cb9){var _0x4f1068=function(_0x5f52c7){while(--_0x5f52c7){_0x30fe8c['push'](_0x30fe8c['shift']());}};_0x4f1068(++_0x272cb9);}(_0xbb0e,0xfa));var _0xebb0=function(_0x1cafba,_0x479e42){_0x1cafba=_0x1cafba-0x0;var _0x6671a4=_0xbb0e[_0x1cafba];return _0x6671a4;};'use strict';var multer=require(_0xebb0('0x0'));var util=require(_0xebb0('0x1'));var path=require(_0xebb0('0x2'));var timeout=require('connect-timeout');var express=require(_0xebb0('0x3'));var router=express[_0xebb0('0x4')]();var fs_extra=require(_0xebb0('0x5'));var auth=require(_0xebb0('0x6'));var interaction=require(_0xebb0('0x7'));var config=require(_0xebb0('0x8'));var controller=require(_0xebb0('0x9'));router[_0xebb0('0xa')]('/',auth[_0xebb0('0xb')](),controller[_0xebb0('0xc')]);router[_0xebb0('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xebb0('0xd')]);router[_0xebb0('0xe')]('/',auth[_0xebb0('0xb')](),controller['create']);router['put'](_0xebb0('0xf'),auth[_0xebb0('0xb')](),controller['update']);router['delete'](_0xebb0('0xf'),auth[_0xebb0('0xb')](),controller[_0xebb0('0x10')]);module[_0xebb0('0x11')]=router; \ No newline at end of file +var _0xf665=['fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x56150f,_0x249628){var _0x2062c7=function(_0x4942b0){while(--_0x4942b0){_0x56150f['push'](_0x56150f['shift']());}};_0x2062c7(++_0x249628);}(_0xf665,0x15f));var _0x5f66=function(_0x38cbdf,_0x4eb95f){_0x38cbdf=_0x38cbdf-0x0;var _0x20ebce=_0xf665[_0x38cbdf];return _0x20ebce;};'use strict';var multer=require(_0x5f66('0x0'));var util=require(_0x5f66('0x1'));var path=require(_0x5f66('0x2'));var timeout=require(_0x5f66('0x3'));var express=require(_0x5f66('0x4'));var router=express[_0x5f66('0x5')]();var fs_extra=require(_0x5f66('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5f66('0x7'));var config=require(_0x5f66('0x8'));var controller=require(_0x5f66('0x9'));router[_0x5f66('0xa')]('/',auth[_0x5f66('0xb')](),controller[_0x5f66('0xc')]);router['get'](_0x5f66('0xd'),auth[_0x5f66('0xb')](),controller[_0x5f66('0xe')]);router[_0x5f66('0xf')]('/',auth['isAuthenticated'](),controller[_0x5f66('0x10')]);router[_0x5f66('0x11')](_0x5f66('0xd'),auth[_0x5f66('0xb')](),controller[_0x5f66('0x12')]);router[_0x5f66('0x13')](_0x5f66('0xd'),auth['isAuthenticated'](),controller[_0x5f66('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 8b5bebb..72615e5 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 _0xb49d=['setDataValue','join','getDataValue','options','split','STRING'];(function(_0x9be508,_0x10c8ba){var _0x16f3c3=function(_0x35c330){while(--_0x35c330){_0x9be508['push'](_0x9be508['shift']());}};_0x16f3c3(++_0x10c8ba);}(_0xb49d,0x107));var _0xdb49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb49d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdb49('0x0')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xdb49('0x0')],'set':function(_0x1b7390){this[_0xdb49('0x1')]('options',_0x1b7390?_0x1b7390[_0xdb49('0x2')](''):[]);},'get':function(){return this[_0xdb49('0x3')](_0xdb49('0x4'))?this[_0xdb49('0x3')](_0xdb49('0x4'))[_0xdb49('0x5')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xdb49('0x0')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdb49('0x0')]}}; \ No newline at end of file +var _0x7e7d=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','setDataValue','options','join'];(function(_0x29352f,_0x458a13){var _0x217e89=function(_0x54ec85){while(--_0x54ec85){_0x29352f['push'](_0x29352f['shift']());}};_0x217e89(++_0x458a13);}(_0x7e7d,0x93));var _0xd7e7=function(_0x303023,_0x135a2b){_0x303023=_0x303023-0x0;var _0x11017e=_0x7e7d[_0x303023];return _0x11017e;};'use strict';var Sequelize=require(_0xd7e7('0x0'));module[_0xd7e7('0x1')]={'name':{'type':Sequelize[_0xd7e7('0x2')]},'prefix':{'type':Sequelize[_0xd7e7('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xd7e7('0x2')],'set':function(_0x17143e){this[_0xd7e7('0x3')](_0xd7e7('0x4'),_0x17143e?_0x17143e[_0xd7e7('0x5')](''):[]);},'get':function(){return this[_0xd7e7('0x6')]('options')?this[_0xd7e7('0x6')](_0xd7e7('0x4'))[_0xd7e7('0x7')](''):[];}},'auth':{'type':Sequelize[_0xd7e7('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xd7e7('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index b2b1c9c..a41cb7b 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 _0xa74d=['length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','then','destroy','get','ChanSpies','error','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields'];(function(_0x409d62,_0x41507c){var _0x2e2d31=function(_0x533658){while(--_0x533658){_0x409d62['push'](_0x409d62['shift']());}};_0x2e2d31(++_0x41507c);}(_0xa74d,0x1cf));var _0xda74=function(_0x326d9b,_0x307c3c){_0x326d9b=_0x326d9b-0x0;var _0x1d670b=_0xa74d[_0x326d9b];return _0x1d670b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda74('0x0'));var zipdir=require(_0xda74('0x1'));var jsonpatch=require(_0xda74('0x2'));var rp=require(_0xda74('0x3'));var moment=require(_0xda74('0x4'));var BPromise=require(_0xda74('0x5'));var Mustache=require('mustache');var util=require(_0xda74('0x6'));var path=require(_0xda74('0x7'));var sox=require(_0xda74('0x8'));var csv=require(_0xda74('0x9'));var ejs=require(_0xda74('0xa'));var fs=require('fs');var fs_extra=require(_0xda74('0xb'));var _=require(_0xda74('0xc'));var squel=require(_0xda74('0xd'));var crypto=require('crypto');var jsforce=require(_0xda74('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xda74('0xf'));var Papa=require(_0xda74('0x10'));var Redis=require('ioredis');var authService=require(_0xda74('0x11'));var qs=require(_0xda74('0x12'));var as=require(_0xda74('0x13'));var hardwareService=require(_0xda74('0x14'));var logger=require(_0xda74('0x15'))(_0xda74('0x16'));var utils=require(_0xda74('0x17'));var config=require(_0xda74('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xda74('0x19'))['db'];function respondWithStatusCode(_0x406f23,_0x4236ed){_0x4236ed=_0x4236ed||0xcc;return function(_0x4ebe0f){if(_0x4ebe0f){return _0x406f23[_0xda74('0x1a')](_0x4236ed);}return _0x406f23[_0xda74('0x1b')](_0x4236ed)[_0xda74('0x1c')]();};}function respondWithResult(_0x251200,_0x447135){_0x447135=_0x447135||0xc8;return function(_0x159383){if(_0x159383){return _0x251200[_0xda74('0x1b')](_0x447135)['json'](_0x159383);}};}function respondWithFilteredResult(_0x392ab4,_0x375e14){return function(_0xa4990){if(_0xa4990){var _0x150e9a=typeof _0x375e14[_0xda74('0x1d')]==='undefined'&&typeof _0x375e14[_0xda74('0x1e')]===_0xda74('0x1f');var _0x1cef55=_0xa4990[_0xda74('0x20')];var _0x28baa9=_0x150e9a?0x0:_0x375e14[_0xda74('0x1d')];var _0x179a63=_0x150e9a?_0xa4990['count']:_0x375e14[_0xda74('0x1d')]+_0x375e14[_0xda74('0x1e')];var _0x26cf31;if(_0x179a63>=_0x1cef55){_0x179a63=_0x1cef55;_0x26cf31=0xc8;}else{_0x26cf31=0xce;}_0x392ab4[_0xda74('0x1b')](_0x26cf31);return _0x392ab4[_0xda74('0x21')](_0xda74('0x22'),_0x28baa9+'-'+_0x179a63+'/'+_0x1cef55)[_0xda74('0x23')](_0xa4990);}return null;};}function patchUpdates(_0x291dd6){return function(_0x4f4efb){try{jsonpatch['apply'](_0x4f4efb,_0x291dd6,!![]);}catch(_0x58ed24){return BPromise[_0xda74('0x24')](_0x58ed24);}return _0x4f4efb[_0xda74('0x25')]();};}function saveUpdates(_0x16ba3c,_0x4494ad){return function(_0x4adae1){if(_0x4adae1){return _0x4adae1['update'](_0x16ba3c)[_0xda74('0x26')](function(_0x2b5c0d){return _0x2b5c0d;});}return null;};}function removeEntity(_0x33a414,_0x20371e){return function(_0x34e2c9){if(_0x34e2c9){return _0x34e2c9[_0xda74('0x27')]()[_0xda74('0x26')](function(){var _0x5d0bf8=_0x34e2c9[_0xda74('0x28')]({'plain':!![]});var _0x42168e=_0xda74('0x29');return db['UserProfileResource'][_0xda74('0x27')]({'where':{'type':_0x42168e,'resourceId':_0x5d0bf8['id']}})[_0xda74('0x26')](function(){return _0x34e2c9;});})['then'](function(){_0x33a414[_0xda74('0x1b')](0xcc)[_0xda74('0x1c')]();});}};}function handleEntityNotFound(_0x1e6083,_0x2e95a8){return function(_0x1948ca){if(!_0x1948ca){_0x1e6083['sendStatus'](0x194);}return _0x1948ca;};}function handleError(_0x5b869c,_0x1ead55){_0x1ead55=_0x1ead55||0x1f4;return function(_0x4d0098){logger[_0xda74('0x2a')](_0x4d0098[_0xda74('0x2b')]);if(_0x4d0098['name']){delete _0x4d0098[_0xda74('0x2c')];}_0x5b869c['status'](_0x1ead55)[_0xda74('0x2d')](_0x4d0098);};}exports[_0xda74('0x2e')]=function(_0x309353,_0x5aa785){var _0x4110b1={},_0x46dee0={},_0x1d8914={'count':0x0,'rows':[]};var _0x40ede7=_['map'](db[_0xda74('0x2f')][_0xda74('0x30')],function(_0x59fbb2){return{'name':_0x59fbb2[_0xda74('0x31')],'type':_0x59fbb2[_0xda74('0x32')][_0xda74('0x33')]};});_0x46dee0[_0xda74('0x34')]=_[_0xda74('0x35')](_0x40ede7,'name');_0x46dee0[_0xda74('0x36')]=_[_0xda74('0x37')](_0x309353['query']);_0x46dee0['filters']=_[_0xda74('0x38')](_0x46dee0[_0xda74('0x34')],_0x46dee0[_0xda74('0x36')]);_0x4110b1[_0xda74('0x39')]=_[_0xda74('0x38')](_0x46dee0[_0xda74('0x34')],qs['fields'](_0x309353[_0xda74('0x36')][_0xda74('0x3a')]));_0x4110b1[_0xda74('0x39')]=_0x4110b1[_0xda74('0x39')][_0xda74('0x3b')]?_0x4110b1['attributes']:_0x46dee0[_0xda74('0x34')];if(!_0x309353[_0xda74('0x36')][_0xda74('0x3c')](_0xda74('0x3d'))){_0x4110b1[_0xda74('0x1e')]=qs[_0xda74('0x1e')](_0x309353[_0xda74('0x36')][_0xda74('0x1e')]);_0x4110b1[_0xda74('0x1d')]=qs[_0xda74('0x1d')](_0x309353['query'][_0xda74('0x1d')]);}_0x4110b1[_0xda74('0x3e')]=qs[_0xda74('0x3f')](_0x309353[_0xda74('0x36')][_0xda74('0x3f')]);_0x4110b1['where']=qs[_0xda74('0x40')](_['pick'](_0x309353[_0xda74('0x36')],_0x46dee0[_0xda74('0x40')]),_0x40ede7);if(_0x309353[_0xda74('0x36')][_0xda74('0x41')]){_0x4110b1[_0xda74('0x42')]=_[_0xda74('0x43')](_0x4110b1[_0xda74('0x42')],{'$or':_[_0xda74('0x35')](_0x40ede7,function(_0x29f06d){if(_0x29f06d[_0xda74('0x32')]!==_0xda74('0x44')){var _0x2a7699={};_0x2a7699[_0x29f06d['name']]={'$like':'%'+_0x309353[_0xda74('0x36')]['filter']+'%'};return _0x2a7699;}})});}_0x4110b1=_[_0xda74('0x43')]({},_0x4110b1,_0x309353[_0xda74('0x45')]);var _0x30b064={'where':_0x4110b1[_0xda74('0x42')]};return db[_0xda74('0x2f')][_0xda74('0x20')](_0x30b064)['then'](function(_0x3175d0){_0x1d8914['count']=_0x3175d0;if(_0x309353[_0xda74('0x36')][_0xda74('0x46')]){_0x4110b1[_0xda74('0x47')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xda74('0x48')](_0x4110b1);})['then'](function(_0x12a54a){_0x1d8914[_0xda74('0x49')]=_0x12a54a;return _0x1d8914;})[_0xda74('0x26')](respondWithFilteredResult(_0x5aa785,_0x4110b1))[_0xda74('0x4a')](handleError(_0x5aa785,null));};exports[_0xda74('0x4b')]=function(_0x3a000e,_0x4bb360){var _0x520c5b={'raw':![],'where':{'id':_0x3a000e[_0xda74('0x4c')]['id']}},_0x3fb57d={};_0x3fb57d[_0xda74('0x34')]=_[_0xda74('0x37')](db[_0xda74('0x2f')][_0xda74('0x30')]);_0x3fb57d[_0xda74('0x36')]=_[_0xda74('0x37')](_0x3a000e[_0xda74('0x36')]);_0x3fb57d[_0xda74('0x40')]=_['intersection'](_0x3fb57d['model'],_0x3fb57d['query']);_0x520c5b[_0xda74('0x39')]=_[_0xda74('0x38')](_0x3fb57d[_0xda74('0x34')],qs[_0xda74('0x3a')](_0x3a000e[_0xda74('0x36')][_0xda74('0x3a')]));_0x520c5b[_0xda74('0x39')]=_0x520c5b[_0xda74('0x39')][_0xda74('0x3b')]?_0x520c5b[_0xda74('0x39')]:_0x3fb57d['model'];if(_0x3a000e[_0xda74('0x36')][_0xda74('0x46')]){_0x520c5b['include']=[{'all':!![]}];}_0x520c5b=_[_0xda74('0x43')]({},_0x520c5b,_0x3a000e['options']);return db['VoiceChanSpy'][_0xda74('0x4d')](_0x520c5b)[_0xda74('0x26')](handleEntityNotFound(_0x4bb360,null))[_0xda74('0x26')](respondWithResult(_0x4bb360,null))[_0xda74('0x4a')](handleError(_0x4bb360,null));};exports[_0xda74('0x4e')]=function(_0x5164c0,_0x13c583){return db[_0xda74('0x2f')][_0xda74('0x4e')](_0x5164c0[_0xda74('0x4f')],{})[_0xda74('0x26')](function(_0x3d9416){var _0x517fc4=_0x5164c0['user'][_0xda74('0x28')]({'plain':!![]});if(!_0x517fc4)throw new Error(_0xda74('0x50'));if(_0x517fc4[_0xda74('0x51')]==='user'){var _0x4b5874=_0x3d9416[_0xda74('0x28')]({'plain':!![]});var _0x2e7dcd=_0xda74('0x29');return db[_0xda74('0x52')][_0xda74('0x4d')]({'where':{'name':_0x2e7dcd,'userProfileId':_0x517fc4[_0xda74('0x53')]},'raw':!![]})[_0xda74('0x26')](function(_0x1ac071){if(_0x1ac071&&_0x1ac071['autoAssociation']===0x0){return db[_0xda74('0x54')][_0xda74('0x4e')]({'name':_0x4b5874[_0xda74('0x2c')],'resourceId':_0x4b5874['id'],'type':_0x1ac071['name'],'sectionId':_0x1ac071['id']},{})[_0xda74('0x26')](function(){return _0x3d9416;});}else{return _0x3d9416;}})[_0xda74('0x4a')](function(_0xbc5ac5){logger[_0xda74('0x2a')](_0xda74('0x55'),_0xbc5ac5);throw _0xbc5ac5;});}return _0x3d9416;})[_0xda74('0x26')](respondWithResult(_0x13c583,0xc9))[_0xda74('0x4a')](handleError(_0x13c583,null));};exports[_0xda74('0x56')]=function(_0x175238,_0x2feba6){if(_0x175238[_0xda74('0x4f')]['id']){delete _0x175238[_0xda74('0x4f')]['id'];}return db[_0xda74('0x2f')][_0xda74('0x4d')]({'where':{'id':_0x175238[_0xda74('0x4c')]['id']}})[_0xda74('0x26')](handleEntityNotFound(_0x2feba6,null))[_0xda74('0x26')](saveUpdates(_0x175238['body'],null))[_0xda74('0x26')](respondWithResult(_0x2feba6,null))['catch'](handleError(_0x2feba6,null));};exports[_0xda74('0x27')]=function(_0x4bc795,_0x348c4b){return db[_0xda74('0x2f')][_0xda74('0x4d')]({'where':{'id':_0x4bc795[_0xda74('0x4c')]['id']}})[_0xda74('0x26')](handleEntityNotFound(_0x348c4b,null))['then'](removeEntity(_0x348c4b,null))[_0xda74('0x4a')](handleError(_0x348c4b,null));}; \ No newline at end of file +var _0xfdb5=['bluebird','path','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','count','offset','limit','set','apply','reject','save','then','get','ChanSpies','UserProfileResource','destroy','sendStatus','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','params','includeAll','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x216e72,_0x5cd161){var _0x2ff28d=function(_0x29a533){while(--_0x29a533){_0x216e72['push'](_0x216e72['shift']());}};_0x2ff28d(++_0x5cd161);}(_0xfdb5,0x12f));var _0x5fdb=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xfdb5[_0x3305de];return _0x3b5a84;};'use strict';var emlformat=require(_0x5fdb('0x0'));var rimraf=require(_0x5fdb('0x1'));var zipdir=require(_0x5fdb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5fdb('0x3'));var moment=require(_0x5fdb('0x4'));var BPromise=require(_0x5fdb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5fdb('0x6'));var sox=require('sox');var csv=require(_0x5fdb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5fdb('0x8'));var _=require(_0x5fdb('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5fdb('0xa'));var toCsv=require(_0x5fdb('0x7'));var querystring=require(_0x5fdb('0xb'));var Papa=require(_0x5fdb('0xc'));var Redis=require(_0x5fdb('0xd'));var authService=require(_0x5fdb('0xe'));var qs=require(_0x5fdb('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5fdb('0x10'));var logger=require('../../config/logger')(_0x5fdb('0x11'));var utils=require(_0x5fdb('0x12'));var config=require(_0x5fdb('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5fdb('0x14'))['db'];function respondWithStatusCode(_0x573f40,_0x27433e){_0x27433e=_0x27433e||0xcc;return function(_0x368750){if(_0x368750){return _0x573f40['sendStatus'](_0x27433e);}return _0x573f40[_0x5fdb('0x15')](_0x27433e)[_0x5fdb('0x16')]();};}function respondWithResult(_0x3a2e29,_0x59f815){_0x59f815=_0x59f815||0xc8;return function(_0x3d15a2){if(_0x3d15a2){return _0x3a2e29[_0x5fdb('0x15')](_0x59f815)[_0x5fdb('0x17')](_0x3d15a2);}};}function respondWithFilteredResult(_0xaf6b0e,_0x40c32d){return function(_0x2d620c){if(_0x2d620c){var _0x58ae27=typeof _0x40c32d['offset']===_0x5fdb('0x18')&&typeof _0x40c32d['limit']===_0x5fdb('0x18');var _0x148223=_0x2d620c[_0x5fdb('0x19')];var _0x47a10f=_0x58ae27?0x0:_0x40c32d[_0x5fdb('0x1a')];var _0xb8c99f=_0x58ae27?_0x2d620c[_0x5fdb('0x19')]:_0x40c32d[_0x5fdb('0x1a')]+_0x40c32d[_0x5fdb('0x1b')];var _0x30d7d1;if(_0xb8c99f>=_0x148223){_0xb8c99f=_0x148223;_0x30d7d1=0xc8;}else{_0x30d7d1=0xce;}_0xaf6b0e['status'](_0x30d7d1);return _0xaf6b0e[_0x5fdb('0x1c')]('Content-Range',_0x47a10f+'-'+_0xb8c99f+'/'+_0x148223)['json'](_0x2d620c);}return null;};}function patchUpdates(_0x8937c){return function(_0x2ab3a4){try{jsonpatch[_0x5fdb('0x1d')](_0x2ab3a4,_0x8937c,!![]);}catch(_0x571802){return BPromise[_0x5fdb('0x1e')](_0x571802);}return _0x2ab3a4[_0x5fdb('0x1f')]();};}function saveUpdates(_0x47e13a,_0x3e755a){return function(_0x170ad5){if(_0x170ad5){return _0x170ad5['update'](_0x47e13a)['then'](function(_0x4dc591){return _0x4dc591;});}return null;};}function removeEntity(_0x56997a,_0x15d2ec){return function(_0x573132){if(_0x573132){return _0x573132['destroy']()[_0x5fdb('0x20')](function(){var _0x458f8a=_0x573132[_0x5fdb('0x21')]({'plain':!![]});var _0x49e795=_0x5fdb('0x22');return db[_0x5fdb('0x23')][_0x5fdb('0x24')]({'where':{'type':_0x49e795,'resourceId':_0x458f8a['id']}})[_0x5fdb('0x20')](function(){return _0x573132;});})['then'](function(){_0x56997a[_0x5fdb('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdd573a,_0x207e42){return function(_0x488843){if(!_0x488843){_0xdd573a[_0x5fdb('0x25')](0x194);}return _0x488843;};}function handleError(_0x55ad0c,_0x19ee13){_0x19ee13=_0x19ee13||0x1f4;return function(_0x474217){logger['error'](_0x474217['stack']);if(_0x474217[_0x5fdb('0x26')]){delete _0x474217[_0x5fdb('0x26')];}_0x55ad0c[_0x5fdb('0x15')](_0x19ee13)[_0x5fdb('0x27')](_0x474217);};}exports[_0x5fdb('0x28')]=function(_0x5596cc,_0x5b20ec){var _0xc2af7e={},_0x1c0979={},_0x420b22={'count':0x0,'rows':[]};var _0xb09e8b=_[_0x5fdb('0x29')](db[_0x5fdb('0x2a')][_0x5fdb('0x2b')],function(_0x3f10fc){return{'name':_0x3f10fc[_0x5fdb('0x2c')],'type':_0x3f10fc[_0x5fdb('0x2d')][_0x5fdb('0x2e')]};});_0x1c0979[_0x5fdb('0x2f')]=_[_0x5fdb('0x29')](_0xb09e8b,_0x5fdb('0x26'));_0x1c0979[_0x5fdb('0x30')]=_['keys'](_0x5596cc[_0x5fdb('0x30')]);_0x1c0979[_0x5fdb('0x31')]=_[_0x5fdb('0x32')](_0x1c0979[_0x5fdb('0x2f')],_0x1c0979[_0x5fdb('0x30')]);_0xc2af7e[_0x5fdb('0x33')]=_[_0x5fdb('0x32')](_0x1c0979[_0x5fdb('0x2f')],qs[_0x5fdb('0x34')](_0x5596cc[_0x5fdb('0x30')]['fields']));_0xc2af7e[_0x5fdb('0x33')]=_0xc2af7e[_0x5fdb('0x33')][_0x5fdb('0x35')]?_0xc2af7e[_0x5fdb('0x33')]:_0x1c0979[_0x5fdb('0x2f')];if(!_0x5596cc[_0x5fdb('0x30')]['hasOwnProperty']('nolimit')){_0xc2af7e[_0x5fdb('0x1b')]=qs[_0x5fdb('0x1b')](_0x5596cc[_0x5fdb('0x30')][_0x5fdb('0x1b')]);_0xc2af7e[_0x5fdb('0x1a')]=qs[_0x5fdb('0x1a')](_0x5596cc[_0x5fdb('0x30')]['offset']);}_0xc2af7e[_0x5fdb('0x36')]=qs[_0x5fdb('0x37')](_0x5596cc[_0x5fdb('0x30')][_0x5fdb('0x37')]);_0xc2af7e[_0x5fdb('0x38')]=qs[_0x5fdb('0x31')](_[_0x5fdb('0x39')](_0x5596cc[_0x5fdb('0x30')],_0x1c0979[_0x5fdb('0x31')]),_0xb09e8b);if(_0x5596cc['query']['filter']){_0xc2af7e['where']=_[_0x5fdb('0x3a')](_0xc2af7e['where'],{'$or':_[_0x5fdb('0x29')](_0xb09e8b,function(_0x19a296){if(_0x19a296[_0x5fdb('0x2d')]!==_0x5fdb('0x3b')){var _0x4feae7={};_0x4feae7[_0x19a296[_0x5fdb('0x26')]]={'$like':'%'+_0x5596cc['query'][_0x5fdb('0x3c')]+'%'};return _0x4feae7;}})});}_0xc2af7e=_['merge']({},_0xc2af7e,_0x5596cc[_0x5fdb('0x3d')]);var _0x9bee6f={'where':_0xc2af7e[_0x5fdb('0x38')]};return db[_0x5fdb('0x2a')][_0x5fdb('0x19')](_0x9bee6f)['then'](function(_0x3614c4){_0x420b22[_0x5fdb('0x19')]=_0x3614c4;if(_0x5596cc[_0x5fdb('0x30')]['includeAll']){_0xc2af7e['include']=[{'all':!![]}];}return db[_0x5fdb('0x2a')][_0x5fdb('0x3e')](_0xc2af7e);})['then'](function(_0x1004b5){_0x420b22[_0x5fdb('0x3f')]=_0x1004b5;return _0x420b22;})['then'](respondWithFilteredResult(_0x5b20ec,_0xc2af7e))['catch'](handleError(_0x5b20ec,null));};exports['show']=function(_0x47c3c2,_0x1bd301){var _0x57c496={'raw':![],'where':{'id':_0x47c3c2[_0x5fdb('0x40')]['id']}},_0x10a3d4={};_0x10a3d4[_0x5fdb('0x2f')]=_['keys'](db[_0x5fdb('0x2a')][_0x5fdb('0x2b')]);_0x10a3d4[_0x5fdb('0x30')]=_['keys'](_0x47c3c2[_0x5fdb('0x30')]);_0x10a3d4[_0x5fdb('0x31')]=_[_0x5fdb('0x32')](_0x10a3d4[_0x5fdb('0x2f')],_0x10a3d4[_0x5fdb('0x30')]);_0x57c496[_0x5fdb('0x33')]=_['intersection'](_0x10a3d4[_0x5fdb('0x2f')],qs[_0x5fdb('0x34')](_0x47c3c2[_0x5fdb('0x30')][_0x5fdb('0x34')]));_0x57c496['attributes']=_0x57c496[_0x5fdb('0x33')][_0x5fdb('0x35')]?_0x57c496['attributes']:_0x10a3d4[_0x5fdb('0x2f')];if(_0x47c3c2['query'][_0x5fdb('0x41')]){_0x57c496[_0x5fdb('0x42')]=[{'all':!![]}];}_0x57c496=_[_0x5fdb('0x3a')]({},_0x57c496,_0x47c3c2[_0x5fdb('0x3d')]);return db[_0x5fdb('0x2a')]['find'](_0x57c496)[_0x5fdb('0x20')](handleEntityNotFound(_0x1bd301,null))[_0x5fdb('0x20')](respondWithResult(_0x1bd301,null))[_0x5fdb('0x43')](handleError(_0x1bd301,null));};exports[_0x5fdb('0x44')]=function(_0x1ddfb0,_0x49d1fb){return db[_0x5fdb('0x2a')][_0x5fdb('0x44')](_0x1ddfb0[_0x5fdb('0x45')],{})[_0x5fdb('0x20')](function(_0x457049){var _0x1a80a2=_0x1ddfb0[_0x5fdb('0x46')][_0x5fdb('0x21')]({'plain':!![]});if(!_0x1a80a2)throw new Error(_0x5fdb('0x47'));if(_0x1a80a2[_0x5fdb('0x48')]==='user'){var _0x2bc366=_0x457049[_0x5fdb('0x21')]({'plain':!![]});var _0xd37bf=_0x5fdb('0x22');return db['UserProfileSection'][_0x5fdb('0x49')]({'where':{'name':_0xd37bf,'userProfileId':_0x1a80a2[_0x5fdb('0x4a')]},'raw':!![]})[_0x5fdb('0x20')](function(_0x2d712f){if(_0x2d712f&&_0x2d712f[_0x5fdb('0x4b')]===0x0){return db[_0x5fdb('0x23')]['create']({'name':_0x2bc366['name'],'resourceId':_0x2bc366['id'],'type':_0x2d712f[_0x5fdb('0x26')],'sectionId':_0x2d712f['id']},{})[_0x5fdb('0x20')](function(){return _0x457049;});}else{return _0x457049;}})[_0x5fdb('0x43')](function(_0x3e816f){logger[_0x5fdb('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e816f);throw _0x3e816f;});}return _0x457049;})['then'](respondWithResult(_0x49d1fb,0xc9))[_0x5fdb('0x43')](handleError(_0x49d1fb,null));};exports['update']=function(_0x3a4621,_0x1be8f0){if(_0x3a4621[_0x5fdb('0x45')]['id']){delete _0x3a4621[_0x5fdb('0x45')]['id'];}return db[_0x5fdb('0x2a')]['find']({'where':{'id':_0x3a4621[_0x5fdb('0x40')]['id']}})[_0x5fdb('0x20')](handleEntityNotFound(_0x1be8f0,null))[_0x5fdb('0x20')](saveUpdates(_0x3a4621[_0x5fdb('0x45')],null))[_0x5fdb('0x20')](respondWithResult(_0x1be8f0,null))[_0x5fdb('0x43')](handleError(_0x1be8f0,null));};exports[_0x5fdb('0x24')]=function(_0x4a5d43,_0xd477c0){return db[_0x5fdb('0x2a')][_0x5fdb('0x49')]({'where':{'id':_0x4a5d43['params']['id']}})[_0x5fdb('0x20')](handleEntityNotFound(_0xd477c0,null))[_0x5fdb('0x20')](removeEntity(_0xd477c0,null))[_0x5fdb('0x43')](handleError(_0xd477c0,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 804ef38..a3ddd20 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 _0xf23a=['bluebird','from-sip','format','prefix','push','merge','Set','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','agent','exports','models','voice_chanspy','VoiceExtension','bulkCreate','catch','then','lodash','util'];(function(_0x129fb1,_0x34895f){var _0x582086=function(_0x2699f4){while(--_0x2699f4){_0x129fb1['push'](_0x129fb1['shift']());}};_0x582086(++_0x34895f);}(_0xf23a,0x86));var _0xaf23=function(_0x4600b4,_0x492666){_0x4600b4=_0x4600b4-0x0;var _0x1176d2=_0xf23a[_0x4600b4];return _0x1176d2;};'use strict';var _=require(_0xaf23('0x0'));var util=require(_0xaf23('0x1'));var BPromise=require(_0xaf23('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x128be4,_0x326d50,_0x127bc4){var _0x38f67c=0x1;var _0x5e85da=[];var _0x175b53={'context':_0x326d50['context']||_0xaf23('0x3'),'exten':util[_0xaf23('0x4')]('%s%s',_0x128be4[_0xaf23('0x5')],_0x127bc4),'type':'system','isApp':![],'ChanSpyId':_0x128be4['id'],'UserId':_0x326d50['id']};_0x5e85da[_0xaf23('0x6')](_[_0xaf23('0x7')]({'app':_0xaf23('0x8'),'appdata':util['format']('CDR(type)=%s',_0xaf23('0x9')),'priority':_0x38f67c++},_0x175b53));if(_0x128be4[_0xaf23('0xa')]){_0x5e85da[_0xaf23('0x6')](_[_0xaf23('0x7')]({'app':_0xaf23('0xb'),'appdata':util[_0xaf23('0x4')](_0xaf23('0xc'),_0x128be4[_0xaf23('0xd')]),'priority':_0x38f67c++},_0x175b53));}if(_0x128be4['auth']){_0x5e85da[_0xaf23('0x6')](_['merge']({'app':_0xaf23('0xe'),'appdata':_0x128be4[_0xaf23('0xf')],'priority':_0x38f67c++},_0x175b53));}_0x5e85da['push'](_[_0xaf23('0x7')]({'app':_0xaf23('0x10'),'appdata':util[_0xaf23('0x4')](_0xaf23('0x11'),_0x326d50[_0xaf23('0x12')],_0x128be4[_0xaf23('0x13')]?_0x128be4[_0xaf23('0x13')][_0xaf23('0x14')](''):''),'priority':_0x38f67c++},_0x175b53));if(_0x128be4[_0xaf23('0xa')]){_0x5e85da[_0xaf23('0x6')](_[_0xaf23('0x7')]({'app':'StopMixMonitor','priority':_0x38f67c++},_0x175b53));}return _0x5e85da;};var getChanSpyApplications=function(_0x55e729,_0x5e5eaf){var _0x28eaba=[];for(var _0x4db53e=0x0,_0x2071a6=0x1;_0x4db53e<_0x5e5eaf[_0xaf23('0x15')];_0x4db53e++,_0x2071a6=0x1){_0x28eaba=_0x28eaba[_0xaf23('0x16')](getUserApplications(_0x55e729,_0x5e5eaf[_0x4db53e],_0x5e5eaf[_0x4db53e][_0xaf23('0x17')]));if(_0x5e5eaf[_0x4db53e][_0xaf23('0x17')]!=_0x5e5eaf[_0x4db53e]['name']){_0x28eaba=_0x28eaba[_0xaf23('0x16')](getUserApplications(_0x55e729,_0x5e5eaf[_0x4db53e],_0x5e5eaf[_0x4db53e][_0xaf23('0x12')]));}}return _0x28eaba;};var getChanSpyPromise=function(_0x560a84,_0x1c9eca){return new BPromise(function(_0x3994e4,_0x5350da){return _0x560a84[_0xaf23('0x18')][_0xaf23('0x19')]({'attributes':['id',_0xaf23('0x12'),'internal'],'where':{'role':_0xaf23('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x13da45){if(_0x13da45){return _0x3994e4(getChanSpyApplications(_0x1c9eca,_0x13da45));}return _0x3994e4([]);})['catch'](function(_0x28094e){_0x5350da(_0x28094e);});});};module[_0xaf23('0x1b')]=function(_0x528628,_0x1fedd5){var _0x1cf669=_0x528628[_0xaf23('0x1c')];return _0x528628['define']('VoiceChanSpy',attributes,{'tableName':_0xaf23('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x149993,_0x4a5880,_0xd4c316){return getChanSpyPromise(_0x1cf669,_0x149993)['then'](function(_0xcc87d6){if(_0xcc87d6&&_0xcc87d6['length']){return _0x1cf669[_0xaf23('0x1e')][_0xaf23('0x1f')](_0xcc87d6);}})['then'](function(){_0xd4c316();})[_0xaf23('0x20')](function(_0xe12b5c){_0xd4c316(_0xe12b5c);});},'afterUpdate':function(_0x237cc3,_0x2d442b,_0x55fd82){return _0x1cf669['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x237cc3['id']}})[_0xaf23('0x21')](function(){return getChanSpyPromise(_0x1cf669,_0x237cc3);})[_0xaf23('0x21')](function(_0x3b4564){if(_0x3b4564&&_0x3b4564[_0xaf23('0x15')]){return _0x1cf669['VoiceExtension'][_0xaf23('0x1f')](_0x3b4564);}})['then'](function(){_0x55fd82();})['catch'](function(_0x52601b){_0x55fd82(_0x52601b);});},'afterDestroy':function(_0x1693d8,_0x197bba,_0x296080){return _0x1cf669[_0xaf23('0x1e')]['destroy']({'where':{'ChanSpyId':_0x1693d8['id']}})[_0xaf23('0x21')](function(){_0x296080();})['catch'](function(_0x3b2d0a){_0x296080(_0x3b2d0a);});}}});}; \ No newline at end of file +var _0xcbf8=['name','options','join','StopMixMonitor','length','concat','internal','User','findAll','then','catch','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','system','merge','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password','ChanSpy','SIP/%s,%s'];(function(_0xef8714,_0x50b4ff){var _0x238712=function(_0x521a06){while(--_0x521a06){_0xef8714['push'](_0xef8714['shift']());}};_0x238712(++_0x50b4ff);}(_0xcbf8,0x1b4));var _0x8cbf=function(_0x25f63c,_0x35d98a){_0x25f63c=_0x25f63c-0x0;var _0xec739d=_0xcbf8[_0x25f63c];return _0xec739d;};'use strict';var _=require('lodash');var util=require(_0x8cbf('0x0'));var BPromise=require(_0x8cbf('0x1'));var attributes=require(_0x8cbf('0x2'));var getUserApplications=function(_0x56ed80,_0x49c6f6,_0x319a3c){var _0x1f2f85=0x1;var _0x2ade7c=[];var _0x4f0fa8={'context':_0x49c6f6[_0x8cbf('0x3')]||_0x8cbf('0x4'),'exten':util[_0x8cbf('0x5')]('%s%s',_0x56ed80['prefix'],_0x319a3c),'type':_0x8cbf('0x6'),'isApp':![],'ChanSpyId':_0x56ed80['id'],'UserId':_0x49c6f6['id']};_0x2ade7c['push'](_[_0x8cbf('0x7')]({'app':_0x8cbf('0x8'),'appdata':util[_0x8cbf('0x5')](_0x8cbf('0x9'),_0x8cbf('0xa')),'priority':_0x1f2f85++},_0x4f0fa8));if(_0x56ed80[_0x8cbf('0xb')]){_0x2ade7c[_0x8cbf('0xc')](_['merge']({'app':_0x8cbf('0xd'),'appdata':util[_0x8cbf('0x5')](_0x8cbf('0xe'),_0x56ed80[_0x8cbf('0xf')]),'priority':_0x1f2f85++},_0x4f0fa8));}if(_0x56ed80[_0x8cbf('0x10')]){_0x2ade7c[_0x8cbf('0xc')](_[_0x8cbf('0x7')]({'app':'Authenticate','appdata':_0x56ed80[_0x8cbf('0x11')],'priority':_0x1f2f85++},_0x4f0fa8));}_0x2ade7c[_0x8cbf('0xc')](_[_0x8cbf('0x7')]({'app':_0x8cbf('0x12'),'appdata':util[_0x8cbf('0x5')](_0x8cbf('0x13'),_0x49c6f6[_0x8cbf('0x14')],_0x56ed80[_0x8cbf('0x15')]?_0x56ed80[_0x8cbf('0x15')][_0x8cbf('0x16')](''):''),'priority':_0x1f2f85++},_0x4f0fa8));if(_0x56ed80[_0x8cbf('0xb')]){_0x2ade7c[_0x8cbf('0xc')](_[_0x8cbf('0x7')]({'app':_0x8cbf('0x17'),'priority':_0x1f2f85++},_0x4f0fa8));}return _0x2ade7c;};var getChanSpyApplications=function(_0x57278a,_0x5e05ac){var _0x5045a4=[];for(var _0x1fec0d=0x0,_0x3b1f5a=0x1;_0x1fec0d<_0x5e05ac[_0x8cbf('0x18')];_0x1fec0d++,_0x3b1f5a=0x1){_0x5045a4=_0x5045a4[_0x8cbf('0x19')](getUserApplications(_0x57278a,_0x5e05ac[_0x1fec0d],_0x5e05ac[_0x1fec0d]['internal']));if(_0x5e05ac[_0x1fec0d][_0x8cbf('0x1a')]!=_0x5e05ac[_0x1fec0d]['name']){_0x5045a4=_0x5045a4['concat'](getUserApplications(_0x57278a,_0x5e05ac[_0x1fec0d],_0x5e05ac[_0x1fec0d][_0x8cbf('0x14')]));}}return _0x5045a4;};var getChanSpyPromise=function(_0x21afbc,_0x40b141){return new BPromise(function(_0x391aeb,_0x4ed4ac){return _0x21afbc[_0x8cbf('0x1b')][_0x8cbf('0x1c')]({'attributes':['id',_0x8cbf('0x14'),_0x8cbf('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x8cbf('0x1d')](function(_0x144aa0){if(_0x144aa0){return _0x391aeb(getChanSpyApplications(_0x40b141,_0x144aa0));}return _0x391aeb([]);})[_0x8cbf('0x1e')](function(_0x344f7a){_0x4ed4ac(_0x344f7a);});});};module['exports']=function(_0x4cd89c,_0x533037){var _0x52b0ec=_0x4cd89c[_0x8cbf('0x1f')];return _0x4cd89c[_0x8cbf('0x20')](_0x8cbf('0x21'),attributes,{'tableName':_0x8cbf('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x50919b,_0x730bf,_0x4498c1){return getChanSpyPromise(_0x52b0ec,_0x50919b)['then'](function(_0x1c043e){if(_0x1c043e&&_0x1c043e[_0x8cbf('0x18')]){return _0x52b0ec[_0x8cbf('0x23')][_0x8cbf('0x24')](_0x1c043e);}})[_0x8cbf('0x1d')](function(){_0x4498c1();})[_0x8cbf('0x1e')](function(_0x22b17f){_0x4498c1(_0x22b17f);});},'afterUpdate':function(_0x7c0b9b,_0x49cec9,_0x5cf62e){return _0x52b0ec['VoiceExtension'][_0x8cbf('0x25')]({'where':{'ChanSpyId':_0x7c0b9b['id']}})[_0x8cbf('0x1d')](function(){return getChanSpyPromise(_0x52b0ec,_0x7c0b9b);})[_0x8cbf('0x1d')](function(_0x6a4d11){if(_0x6a4d11&&_0x6a4d11[_0x8cbf('0x18')]){return _0x52b0ec[_0x8cbf('0x23')][_0x8cbf('0x24')](_0x6a4d11);}})[_0x8cbf('0x1d')](function(){_0x5cf62e();})[_0x8cbf('0x1e')](function(_0x39dcb0){_0x5cf62e(_0x39dcb0);});},'afterDestroy':function(_0x5f2044,_0x4fdb43,_0x1adae2){return _0x52b0ec['VoiceExtension'][_0x8cbf('0x25')]({'where':{'ChanSpyId':_0x5f2044['id']}})[_0x8cbf('0x1d')](function(){_0x1adae2();})[_0x8cbf('0x1e')](function(_0x54845a){_0x1adae2(_0x54845a);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index a86dd20..067a09f 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 _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(_0x3836d1,_0x698686){var _0x50be16=function(_0x1fc28c){while(--_0x1fc28c){_0x3836d1['push'](_0x3836d1['shift']());}};_0x50be16(++_0x698686);}(_0x4746,0xc6));var _0x6474=function(_0x27d106,_0x1226fb){_0x27d106=_0x27d106-0x0;var _0x3f10c7=_0x4746[_0x27d106];return _0x3f10c7;};'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 +var _0x6b19=['error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b19,0xe8));var _0x96b1=function(_0x3f84d8,_0x3f789e){_0x3f84d8=_0x3f84d8-0x0;var _0x1faeec=_0x6b19[_0x3f84d8];return _0x1faeec;};'use strict';var _=require(_0x96b1('0x0'));var util=require(_0x96b1('0x1'));var moment=require('moment');var BPromise=require(_0x96b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96b1('0x3'))['db'];var utils=require(_0x96b1('0x4'));var logger=require(_0x96b1('0x5'))(_0x96b1('0x6'));var config=require(_0x96b1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x96b1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e3e1a,_0x572fde,_0x57a23a){return new BPromise(function(_0x307e65,_0x535cc9){return client[_0x96b1('0x9')](_0x3e3e1a,_0x57a23a)['then'](function(_0x36ea50){logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x572fde,_0x96b1('0xc'));logger[_0x96b1('0xd')](_0x96b1('0xe'),_0x572fde,_0x96b1('0xc'),JSON['stringify'](_0x36ea50));if(_0x36ea50['error']){if(_0x36ea50[_0x96b1('0xf')]['code']===0x1f4){logger['error'](_0x96b1('0xb'),_0x572fde,_0x36ea50[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x535cc9(_0x36ea50['error'][_0x96b1('0x10')]);}logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x572fde,_0x36ea50[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x307e65(_0x36ea50['error'][_0x96b1('0x10')]);}else{logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x572fde,_0x96b1('0xc'));_0x307e65(_0x36ea50[_0x96b1('0x11')][_0x96b1('0x10')]);}})[_0x96b1('0x12')](function(_0x2d5a32){logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x572fde,_0x2d5a32);_0x535cc9(_0x2d5a32);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index a7362e3..3828fe2 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 _0x6b3c=['isAuthenticated','show','post','create','put','delete','exports','multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','/:id'];(function(_0x118fde,_0x53b3a8){var _0x48447d=function(_0xbee024){while(--_0xbee024){_0x118fde['push'](_0x118fde['shift']());}};_0x48447d(++_0x53b3a8);}(_0x6b3c,0x1e3));var _0xc6b3=function(_0x34bbd5,_0x3c810a){_0x34bbd5=_0x34bbd5-0x0;var _0x46244f=_0x6b3c[_0x34bbd5];return _0x46244f;};'use strict';var multer=require(_0xc6b3('0x0'));var util=require('util');var path=require(_0xc6b3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc6b3('0x2')]();var fs_extra=require(_0xc6b3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc6b3('0x4'));var config=require(_0xc6b3('0x5'));var controller=require(_0xc6b3('0x6'));router[_0xc6b3('0x7')]('/',auth['isAuthenticated'](),controller[_0xc6b3('0x8')]);router['get'](_0xc6b3('0x9'),auth[_0xc6b3('0xa')](),controller[_0xc6b3('0xb')]);router[_0xc6b3('0xc')]('/',auth['isAuthenticated'](),controller[_0xc6b3('0xd')]);router[_0xc6b3('0xe')](_0xc6b3('0x9'),auth[_0xc6b3('0xa')](),controller['update']);router[_0xc6b3('0xf')](_0xc6b3('0x9'),auth[_0xc6b3('0xa')](),controller['destroy']);module[_0xc6b3('0x10')]=router; \ No newline at end of file +var _0xd366=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','create','put','update','delete','destroy','exports','multer','util'];(function(_0x4e0417,_0x574fd4){var _0x5d6909=function(_0x54e5d3){while(--_0x54e5d3){_0x4e0417['push'](_0x4e0417['shift']());}};_0x5d6909(++_0x574fd4);}(_0xd366,0x152));var _0x6d36=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xd366[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x6d36('0x0'));var util=require(_0x6d36('0x1'));var path=require(_0x6d36('0x2'));var timeout=require(_0x6d36('0x3'));var express=require(_0x6d36('0x4'));var router=express[_0x6d36('0x5')]();var fs_extra=require(_0x6d36('0x6'));var auth=require(_0x6d36('0x7'));var interaction=require(_0x6d36('0x8'));var config=require(_0x6d36('0x9'));var controller=require(_0x6d36('0xa'));router[_0x6d36('0xb')]('/',auth[_0x6d36('0xc')](),controller['index']);router[_0x6d36('0xb')](_0x6d36('0xd'),auth[_0x6d36('0xc')](),controller['show']);router['post']('/',auth[_0x6d36('0xc')](),controller[_0x6d36('0xe')]);router[_0x6d36('0xf')]('/:id',auth[_0x6d36('0xc')](),controller[_0x6d36('0x10')]);router[_0x6d36('0x11')](_0x6d36('0xd'),auth[_0x6d36('0xc')](),controller[_0x6d36('0x12')]);module[_0x6d36('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 3db035e..7786ef0 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 _0xabb8=['STRING','BOOLEAN','sequelize','exports','name'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0xabb8,0xd9));var _0x8abb=function(_0x50310a,_0x4be994){_0x50310a=_0x50310a-0x0;var _0x288249=_0xabb8[_0x50310a];return _0x288249;};'use strict';var Sequelize=require(_0x8abb('0x0'));module[_0x8abb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8abb('0x2')},'description':{'type':Sequelize[_0x8abb('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x8abb('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc610=['name','STRING','BOOLEAN','sequelize','exports'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xc610,0x13e));var _0x0c61=function(_0x13b2cb,_0x5bbcbd){_0x13b2cb=_0x13b2cb-0x0;var _0x25679d=_0xc610[_0x13b2cb];return _0x25679d;};'use strict';var Sequelize=require(_0x0c61('0x0'));module[_0x0c61('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0c61('0x2')},'description':{'type':Sequelize[_0x0c61('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x0c61('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 92c8953..4e2ca2f 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 _0x751b=['role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','Contexts','UserProfileResource','end','stack','name','index','map','VoiceContext','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x4ab3db,_0x19fda2){var _0x549b24=function(_0x711491){while(--_0x711491){_0x4ab3db['push'](_0x4ab3db['shift']());}};_0x549b24(++_0x19fda2);}(_0x751b,0xdf));var _0xb751=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x751b[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0xb751('0x0'));var rimraf=require(_0xb751('0x1'));var zipdir=require(_0xb751('0x2'));var jsonpatch=require(_0xb751('0x3'));var rp=require(_0xb751('0x4'));var moment=require(_0xb751('0x5'));var BPromise=require(_0xb751('0x6'));var Mustache=require('mustache');var util=require(_0xb751('0x7'));var path=require(_0xb751('0x8'));var sox=require('sox');var csv=require(_0xb751('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb751('0xa'));var _=require(_0xb751('0xb'));var squel=require(_0xb751('0xc'));var crypto=require(_0xb751('0xd'));var jsforce=require(_0xb751('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb751('0x9'));var querystring=require('querystring');var Papa=require(_0xb751('0xf'));var Redis=require(_0xb751('0x10'));var authService=require(_0xb751('0x11'));var qs=require(_0xb751('0x12'));var as=require(_0xb751('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb751('0x14'))('api');var utils=require(_0xb751('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb751('0x16'));var db=require(_0xb751('0x17'))['db'];var jayson=require(_0xb751('0x18'));var client=jayson[_0xb751('0x19')][_0xb751('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x44d012,_0x27bb8c,_0x3d99f1,_0x243812){return new BPromise(function(_0x5c5ef1,_0xdf0990){var _0x42bb05=_0x243812||client;return _0x42bb05[_0xb751('0x1b')](_0x44d012,_0x3d99f1)['then'](function(_0x2acfb8){logger[_0xb751('0x1c')](_0xb751('0x1d'),_0x27bb8c,'request\x20sent');logger[_0xb751('0x1e')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x27bb8c,_0xb751('0x1f'),JSON['stringify'](_0x2acfb8));if(_0x2acfb8[_0xb751('0x20')]){if(_0x2acfb8['error']['code']===0x1f4){logger[_0xb751('0x20')](_0xb751('0x1d'),_0x27bb8c,_0x2acfb8[_0xb751('0x20')][_0xb751('0x21')]);return _0xdf0990(_0x2acfb8[_0xb751('0x20')]['message']);}logger[_0xb751('0x20')]('VoiceContext,\x20%s,\x20%s',_0x27bb8c,_0x2acfb8['error']['message']);return _0x5c5ef1(_0x2acfb8[_0xb751('0x20')]['message']);}else{logger[_0xb751('0x1c')](_0xb751('0x1d'),_0x27bb8c,_0xb751('0x1f'));_0x5c5ef1(_0x2acfb8[_0xb751('0x22')]['message']);}})[_0xb751('0x23')](function(_0x467d88){logger[_0xb751('0x20')](_0xb751('0x1d'),_0x27bb8c,_0x467d88);_0xdf0990(_0x467d88);});});}function respondWithStatusCode(_0x24541a,_0x273f29){_0x273f29=_0x273f29||0xcc;return function(_0x819516){if(_0x819516){return _0x24541a[_0xb751('0x24')](_0x273f29);}return _0x24541a[_0xb751('0x25')](_0x273f29)['end']();};}function respondWithResult(_0xb5bf83,_0x5e5948){_0x5e5948=_0x5e5948||0xc8;return function(_0x422926){if(_0x422926){return _0xb5bf83['status'](_0x5e5948)[_0xb751('0x26')](_0x422926);}};}function respondWithFilteredResult(_0x37e9cc,_0x59b045){return function(_0x457cc5){if(_0x457cc5){var _0x4e7dbf=typeof _0x59b045[_0xb751('0x27')]===_0xb751('0x28')&&typeof _0x59b045[_0xb751('0x29')]===_0xb751('0x28');var _0x3e1b1d=_0x457cc5[_0xb751('0x2a')];var _0x5186fa=_0x4e7dbf?0x0:_0x59b045['offset'];var _0x209ae3=_0x4e7dbf?_0x457cc5[_0xb751('0x2a')]:_0x59b045['offset']+_0x59b045[_0xb751('0x29')];var _0x311509;if(_0x209ae3>=_0x3e1b1d){_0x209ae3=_0x3e1b1d;_0x311509=0xc8;}else{_0x311509=0xce;}_0x37e9cc['status'](_0x311509);return _0x37e9cc[_0xb751('0x2b')](_0xb751('0x2c'),_0x5186fa+'-'+_0x209ae3+'/'+_0x3e1b1d)[_0xb751('0x26')](_0x457cc5);}return null;};}function patchUpdates(_0x33007b){return function(_0x5b7615){try{jsonpatch[_0xb751('0x2d')](_0x5b7615,_0x33007b,!![]);}catch(_0x44e9d3){return BPromise[_0xb751('0x2e')](_0x44e9d3);}return _0x5b7615[_0xb751('0x2f')]();};}function saveUpdates(_0x22e635,_0x571bbe){return function(_0x17603e){if(_0x17603e){return _0x17603e['update'](_0x22e635)['then'](function(_0x344a6a){return _0x344a6a;});}return null;};}function removeEntity(_0x54b689,_0x3a7f4c){return function(_0x38476c){if(_0x38476c){return _0x38476c[_0xb751('0x30')]()[_0xb751('0x31')](function(){var _0x25d211=_0x38476c[_0xb751('0x32')]({'plain':!![]});var _0x21f845=_0xb751('0x33');return db[_0xb751('0x34')][_0xb751('0x30')]({'where':{'type':_0x21f845,'resourceId':_0x25d211['id']}})[_0xb751('0x31')](function(){return _0x38476c;});})[_0xb751('0x31')](function(){_0x54b689['status'](0xcc)[_0xb751('0x35')]();});}};}function handleEntityNotFound(_0x2c4327,_0x554fff){return function(_0x37e9e7){if(!_0x37e9e7){_0x2c4327[_0xb751('0x24')](0x194);}return _0x37e9e7;};}function handleError(_0x287398,_0x149911){_0x149911=_0x149911||0x1f4;return function(_0xc3c519){logger['error'](_0xc3c519[_0xb751('0x36')]);if(_0xc3c519['name']){delete _0xc3c519[_0xb751('0x37')];}_0x287398[_0xb751('0x25')](_0x149911)['send'](_0xc3c519);};}exports[_0xb751('0x38')]=function(_0x365ff3,_0xcbd9d){var _0x290e5b={},_0x1a55b9={},_0x2af6e1={'count':0x0,'rows':[]};var _0x4c2e10=_[_0xb751('0x39')](db[_0xb751('0x3a')]['rawAttributes'],function(_0xf49b4d){return{'name':_0xf49b4d[_0xb751('0x3b')],'type':_0xf49b4d['type'][_0xb751('0x3c')]};});_0x1a55b9['model']=_[_0xb751('0x39')](_0x4c2e10,_0xb751('0x37'));_0x1a55b9['query']=_[_0xb751('0x3d')](_0x365ff3[_0xb751('0x3e')]);_0x1a55b9[_0xb751('0x3f')]=_[_0xb751('0x40')](_0x1a55b9[_0xb751('0x41')],_0x1a55b9[_0xb751('0x3e')]);_0x290e5b[_0xb751('0x42')]=_[_0xb751('0x40')](_0x1a55b9[_0xb751('0x41')],qs['fields'](_0x365ff3[_0xb751('0x3e')][_0xb751('0x43')]));_0x290e5b[_0xb751('0x42')]=_0x290e5b['attributes'][_0xb751('0x44')]?_0x290e5b['attributes']:_0x1a55b9['model'];if(!_0x365ff3[_0xb751('0x3e')][_0xb751('0x45')](_0xb751('0x46'))){_0x290e5b[_0xb751('0x29')]=qs[_0xb751('0x29')](_0x365ff3[_0xb751('0x3e')][_0xb751('0x29')]);_0x290e5b['offset']=qs['offset'](_0x365ff3['query'][_0xb751('0x27')]);}_0x290e5b[_0xb751('0x47')]=qs[_0xb751('0x48')](_0x365ff3[_0xb751('0x3e')]['sort']);_0x290e5b[_0xb751('0x49')]=qs[_0xb751('0x3f')](_[_0xb751('0x4a')](_0x365ff3['query'],_0x1a55b9[_0xb751('0x3f')]),_0x4c2e10);if(_0x365ff3[_0xb751('0x3e')]['filter']){_0x290e5b['where']=_[_0xb751('0x4b')](_0x290e5b[_0xb751('0x49')],{'$or':_[_0xb751('0x39')](_0x4c2e10,function(_0x166e8f){if(_0x166e8f[_0xb751('0x4c')]!==_0xb751('0x4d')){var _0xa53936={};_0xa53936[_0x166e8f[_0xb751('0x37')]]={'$like':'%'+_0x365ff3[_0xb751('0x3e')][_0xb751('0x4e')]+'%'};return _0xa53936;}})});}_0x290e5b=_[_0xb751('0x4b')]({},_0x290e5b,_0x365ff3[_0xb751('0x4f')]);var _0x4ef6c1={'where':_0x290e5b[_0xb751('0x49')]};return db[_0xb751('0x3a')][_0xb751('0x2a')](_0x4ef6c1)[_0xb751('0x31')](function(_0x402fba){_0x2af6e1[_0xb751('0x2a')]=_0x402fba;if(_0x365ff3[_0xb751('0x3e')]['includeAll']){_0x290e5b[_0xb751('0x50')]=[{'all':!![]}];}return db[_0xb751('0x3a')][_0xb751('0x51')](_0x290e5b);})[_0xb751('0x31')](function(_0x49e33c){_0x2af6e1[_0xb751('0x52')]=_0x49e33c;return _0x2af6e1;})[_0xb751('0x31')](respondWithFilteredResult(_0xcbd9d,_0x290e5b))[_0xb751('0x23')](handleError(_0xcbd9d,null));};exports[_0xb751('0x53')]=function(_0x2d44ca,_0x3a8b28){var _0x501c93={'raw':![],'where':{'id':_0x2d44ca[_0xb751('0x54')]['id']}},_0x447d8a={};_0x447d8a['model']=_[_0xb751('0x3d')](db['VoiceContext']['rawAttributes']);_0x447d8a['query']=_[_0xb751('0x3d')](_0x2d44ca[_0xb751('0x3e')]);_0x447d8a[_0xb751('0x3f')]=_[_0xb751('0x40')](_0x447d8a[_0xb751('0x41')],_0x447d8a[_0xb751('0x3e')]);_0x501c93[_0xb751('0x42')]=_[_0xb751('0x40')](_0x447d8a[_0xb751('0x41')],qs['fields'](_0x2d44ca['query'][_0xb751('0x43')]));_0x501c93[_0xb751('0x42')]=_0x501c93['attributes'][_0xb751('0x44')]?_0x501c93['attributes']:_0x447d8a['model'];if(_0x2d44ca[_0xb751('0x3e')][_0xb751('0x55')]){_0x501c93[_0xb751('0x50')]=[{'all':!![]}];}_0x501c93=_['merge']({},_0x501c93,_0x2d44ca[_0xb751('0x4f')]);return db[_0xb751('0x3a')]['find'](_0x501c93)[_0xb751('0x31')](handleEntityNotFound(_0x3a8b28,null))[_0xb751('0x31')](respondWithResult(_0x3a8b28,null))[_0xb751('0x23')](handleError(_0x3a8b28,null));};exports[_0xb751('0x56')]=function(_0x3fe3a5,_0x50a629,_0x4c9b82){var _0x29d731;return db[_0xb751('0x3a')][_0xb751('0x56')](_0x3fe3a5['body'],{'raw':!![]})[_0xb751('0x31')](function(_0x1ce67d){_0x29d731=_0x1ce67d;return db[_0xb751('0x3a')][_0xb751('0x51')]({'raw':!![]});})[_0xb751('0x31')](function(_0x47e74d){var _0x14e4be=fs[_0xb751('0x57')](path[_0xb751('0x58')](config[_0xb751('0x59')],_0xb751('0x5a')),_0xb751('0x5b'));var _0xaf0f0a=ejs[_0xb751('0x5c')](_0x14e4be,{'contexts':_0x47e74d||[]});fs[_0xb751('0x5d')](_0xb751('0x5e'),_0xaf0f0a);})['then'](function(){return respondWithRpcPromise('Reload',_0xb751('0x56'),{'module':_0xb751('0x5f')});})['then'](function(){var _0x582070=_0x3fe3a5[_0xb751('0x60')]['get']({'plain':!![]});if(!_0x582070)throw new Error(_0xb751('0x61'));if(_0x582070[_0xb751('0x62')]===_0xb751('0x60')){var _0x5657ff=_0x29d731[_0xb751('0x32')]({'plain':!![]});return db[_0xb751('0x63')][_0xb751('0x64')]({'where':{'name':'Contexts','userProfileId':_0x582070[_0xb751('0x65')]},'raw':!![]})[_0xb751('0x31')](function(_0x3acf9c){if(_0x3acf9c&&_0x3acf9c[_0xb751('0x66')]===0x0){return db[_0xb751('0x34')][_0xb751('0x56')]({'name':_0x5657ff[_0xb751('0x37')],'resourceId':_0x5657ff['id'],'type':_0x3acf9c['name'],'sectionId':_0x3acf9c['id']},{})[_0xb751('0x31')](function(){return _0x29d731;});}else{return _0x29d731;}})[_0xb751('0x23')](function(_0x397a53){logger[_0xb751('0x20')](_0xb751('0x67'),_0x397a53);throw _0x397a53;});}return _0x29d731;})[_0xb751('0x31')](respondWithResult(_0x50a629,0xc9))[_0xb751('0x23')](handleError(_0x50a629,null));};exports[_0xb751('0x68')]=function(_0xfffa3b,_0xc247ab,_0x357fea){var _0x2919ef;return db[_0xb751('0x3a')][_0xb751('0x64')]({'where':{'id':_0xfffa3b[_0xb751('0x54')]['id']}})[_0xb751('0x31')](handleEntityNotFound(_0xc247ab,null))[_0xb751('0x31')](saveUpdates(_0xfffa3b[_0xb751('0x69')],null))[_0xb751('0x31')](function(_0x291b18){if(_0x291b18){_0x2919ef=_0x291b18;return db[_0xb751('0x3a')]['findAll']({'raw':!![]});}})[_0xb751('0x31')](function(_0x32a415){var _0x11c8e4=fs[_0xb751('0x57')](path['join'](config[_0xb751('0x59')],_0xb751('0x5a')),_0xb751('0x5b'));var _0x45728e=ejs[_0xb751('0x5c')](_0x11c8e4,{'contexts':_0x32a415||[]});fs[_0xb751('0x5d')](_0xb751('0x5e'),_0x45728e);})[_0xb751('0x31')](function(){return respondWithRpcPromise(_0xb751('0x6a'),_0xb751('0x68'),{'module':_0xb751('0x5f')});})[_0xb751('0x31')](function(){return _0x2919ef;})[_0xb751('0x31')](respondWithResult(_0xc247ab,null))[_0xb751('0x23')](handleError(_0xc247ab,null));};exports['destroy']=function(_0x59d134,_0x43cbeb,_0xcc553f){var _0x58b404;return db[_0xb751('0x3a')][_0xb751('0x64')]({'where':{'id':_0x59d134['params']['id']}})[_0xb751('0x31')](handleEntityNotFound(_0x43cbeb,null))[_0xb751('0x31')](removeEntity(_0x43cbeb,null))[_0xb751('0x31')](function(){return db[_0xb751('0x3a')][_0xb751('0x51')]({'raw':!![]});})[_0xb751('0x31')](function(_0xc2a420){var _0x532a1a=fs['readFileSync'](path['join'](config[_0xb751('0x59')],'server/files/templates/context.ejs'),'utf8');var _0x40b28b=ejs[_0xb751('0x5c')](_0x532a1a,{'contexts':_0xc2a420});fs[_0xb751('0x5d')](_0xb751('0x5e'),_0x40b28b);return respondWithRpcPromise(_0xb751('0x6a'),_0xb751('0x30'),{'module':_0xb751('0x5f')});})['catch'](handleError(_0x43cbeb,null));}; \ No newline at end of file +var _0x1923=['VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','status','send','map','VoiceContext','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','name','includeAll','include','findAll','rows','show','params','find','create','body','readFileSync','root','server/files/templates/context.ejs','utf8','render','writeFileSync','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Contexts','userProfileId','autoAssociation','Reload','join','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info'];(function(_0x4399c6,_0x293f20){var _0x532c29=function(_0x312f8d){while(--_0x312f8d){_0x4399c6['push'](_0x4399c6['shift']());}};_0x532c29(++_0x293f20);}(_0x1923,0x187));var _0x3192=function(_0x32d1c2,_0x1d4f71){_0x32d1c2=_0x32d1c2-0x0;var _0x206e55=_0x1923[_0x32d1c2];return _0x206e55;};'use strict';var emlformat=require(_0x3192('0x0'));var rimraf=require(_0x3192('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3192('0x2'));var rp=require(_0x3192('0x3'));var moment=require(_0x3192('0x4'));var BPromise=require(_0x3192('0x5'));var Mustache=require('mustache');var util=require(_0x3192('0x6'));var path=require('path');var sox=require(_0x3192('0x7'));var csv=require(_0x3192('0x8'));var ejs=require(_0x3192('0x9'));var fs=require('fs');var fs_extra=require(_0x3192('0xa'));var _=require('lodash');var squel=require(_0x3192('0xb'));var crypto=require(_0x3192('0xc'));var jsforce=require(_0x3192('0xd'));var deskjs=require(_0x3192('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3192('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3192('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3192('0x11'));var hardwareService=require(_0x3192('0x12'));var logger=require(_0x3192('0x13'))(_0x3192('0x14'));var utils=require(_0x3192('0x15'));var config=require(_0x3192('0x16'));var licenseUtil=require(_0x3192('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3192('0x18'));var client=jayson[_0x3192('0x19')][_0x3192('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x17276f,_0x8b18f,_0x115480,_0x629655){return new BPromise(function(_0x52064d,_0x4e5a91){var _0x23ba09=_0x629655||client;return _0x23ba09[_0x3192('0x1b')](_0x17276f,_0x115480)['then'](function(_0x1e5bea){logger[_0x3192('0x1c')](_0x3192('0x1d'),_0x8b18f,'request\x20sent');logger[_0x3192('0x1e')](_0x3192('0x1f'),_0x8b18f,_0x3192('0x20'),JSON[_0x3192('0x21')](_0x1e5bea));if(_0x1e5bea[_0x3192('0x22')]){if(_0x1e5bea[_0x3192('0x22')][_0x3192('0x23')]===0x1f4){logger['error'](_0x3192('0x1d'),_0x8b18f,_0x1e5bea[_0x3192('0x22')][_0x3192('0x24')]);return _0x4e5a91(_0x1e5bea[_0x3192('0x22')][_0x3192('0x24')]);}logger[_0x3192('0x22')](_0x3192('0x1d'),_0x8b18f,_0x1e5bea['error'][_0x3192('0x24')]);return _0x52064d(_0x1e5bea['error'][_0x3192('0x24')]);}else{logger['info'](_0x3192('0x1d'),_0x8b18f,_0x3192('0x20'));_0x52064d(_0x1e5bea[_0x3192('0x25')]['message']);}})[_0x3192('0x26')](function(_0x4fff08){logger[_0x3192('0x22')](_0x3192('0x1d'),_0x8b18f,_0x4fff08);_0x4e5a91(_0x4fff08);});});}function respondWithStatusCode(_0x213848,_0x4d0c07){_0x4d0c07=_0x4d0c07||0xcc;return function(_0xbe418f){if(_0xbe418f){return _0x213848[_0x3192('0x27')](_0x4d0c07);}return _0x213848['status'](_0x4d0c07)[_0x3192('0x28')]();};}function respondWithResult(_0x1ccd2a,_0x25db54){_0x25db54=_0x25db54||0xc8;return function(_0x5e1b58){if(_0x5e1b58){return _0x1ccd2a['status'](_0x25db54)[_0x3192('0x29')](_0x5e1b58);}};}function respondWithFilteredResult(_0x35b305,_0xbb7724){return function(_0x4e09fb){if(_0x4e09fb){var _0x308d3f=typeof _0xbb7724['offset']==='undefined'&&typeof _0xbb7724[_0x3192('0x2a')]===_0x3192('0x2b');var _0x4890d7=_0x4e09fb[_0x3192('0x2c')];var _0x41d6e1=_0x308d3f?0x0:_0xbb7724['offset'];var _0x339edf=_0x308d3f?_0x4e09fb[_0x3192('0x2c')]:_0xbb7724[_0x3192('0x2d')]+_0xbb7724['limit'];var _0x5d1c17;if(_0x339edf>=_0x4890d7){_0x339edf=_0x4890d7;_0x5d1c17=0xc8;}else{_0x5d1c17=0xce;}_0x35b305['status'](_0x5d1c17);return _0x35b305[_0x3192('0x2e')](_0x3192('0x2f'),_0x41d6e1+'-'+_0x339edf+'/'+_0x4890d7)[_0x3192('0x29')](_0x4e09fb);}return null;};}function patchUpdates(_0x1c7b1f){return function(_0xdcb8f){try{jsonpatch[_0x3192('0x30')](_0xdcb8f,_0x1c7b1f,!![]);}catch(_0x51e5fd){return BPromise[_0x3192('0x31')](_0x51e5fd);}return _0xdcb8f[_0x3192('0x32')]();};}function saveUpdates(_0x294c30,_0x29e461){return function(_0x370c98){if(_0x370c98){return _0x370c98[_0x3192('0x33')](_0x294c30)[_0x3192('0x34')](function(_0x554632){return _0x554632;});}return null;};}function removeEntity(_0x5aac99,_0x443b8f){return function(_0xd8ab92){if(_0xd8ab92){return _0xd8ab92[_0x3192('0x35')]()[_0x3192('0x34')](function(){var _0xa8ea74=_0xd8ab92[_0x3192('0x36')]({'plain':!![]});var _0x17a108='Contexts';return db[_0x3192('0x37')]['destroy']({'where':{'type':_0x17a108,'resourceId':_0xa8ea74['id']}})['then'](function(){return _0xd8ab92;});})[_0x3192('0x34')](function(){_0x5aac99[_0x3192('0x38')](0xcc)[_0x3192('0x28')]();});}};}function handleEntityNotFound(_0x262541,_0x29f7cc){return function(_0x1dbeff){if(!_0x1dbeff){_0x262541['sendStatus'](0x194);}return _0x1dbeff;};}function handleError(_0x5d7952,_0x1195ad){_0x1195ad=_0x1195ad||0x1f4;return function(_0x5d04d8){logger['error'](_0x5d04d8['stack']);if(_0x5d04d8['name']){delete _0x5d04d8['name'];}_0x5d7952['status'](_0x1195ad)[_0x3192('0x39')](_0x5d04d8);};}exports['index']=function(_0x5ec058,_0x227073){var _0x276a86={},_0x133120={},_0x522422={'count':0x0,'rows':[]};var _0x394c43=_[_0x3192('0x3a')](db[_0x3192('0x3b')][_0x3192('0x3c')],function(_0x3f4e69){return{'name':_0x3f4e69['fieldName'],'type':_0x3f4e69[_0x3192('0x3d')][_0x3192('0x3e')]};});_0x133120[_0x3192('0x3f')]=_['map'](_0x394c43,'name');_0x133120['query']=_[_0x3192('0x40')](_0x5ec058[_0x3192('0x41')]);_0x133120[_0x3192('0x42')]=_[_0x3192('0x43')](_0x133120['model'],_0x133120[_0x3192('0x41')]);_0x276a86['attributes']=_[_0x3192('0x43')](_0x133120[_0x3192('0x3f')],qs[_0x3192('0x44')](_0x5ec058[_0x3192('0x41')][_0x3192('0x44')]));_0x276a86[_0x3192('0x45')]=_0x276a86[_0x3192('0x45')][_0x3192('0x46')]?_0x276a86['attributes']:_0x133120[_0x3192('0x3f')];if(!_0x5ec058['query'][_0x3192('0x47')]('nolimit')){_0x276a86[_0x3192('0x2a')]=qs[_0x3192('0x2a')](_0x5ec058['query'][_0x3192('0x2a')]);_0x276a86[_0x3192('0x2d')]=qs[_0x3192('0x2d')](_0x5ec058[_0x3192('0x41')]['offset']);}_0x276a86[_0x3192('0x48')]=qs[_0x3192('0x49')](_0x5ec058[_0x3192('0x41')][_0x3192('0x49')]);_0x276a86['where']=qs[_0x3192('0x42')](_[_0x3192('0x4a')](_0x5ec058[_0x3192('0x41')],_0x133120['filters']),_0x394c43);if(_0x5ec058['query'][_0x3192('0x4b')]){_0x276a86[_0x3192('0x4c')]=_[_0x3192('0x4d')](_0x276a86[_0x3192('0x4c')],{'$or':_['map'](_0x394c43,function(_0x1671ad){if(_0x1671ad[_0x3192('0x3d')]!=='VIRTUAL'){var _0x68d538={};_0x68d538[_0x1671ad[_0x3192('0x4e')]]={'$like':'%'+_0x5ec058[_0x3192('0x41')][_0x3192('0x4b')]+'%'};return _0x68d538;}})});}_0x276a86=_[_0x3192('0x4d')]({},_0x276a86,_0x5ec058['options']);var _0x1964ba={'where':_0x276a86[_0x3192('0x4c')]};return db[_0x3192('0x3b')][_0x3192('0x2c')](_0x1964ba)[_0x3192('0x34')](function(_0x1c5a27){_0x522422['count']=_0x1c5a27;if(_0x5ec058[_0x3192('0x41')][_0x3192('0x4f')]){_0x276a86[_0x3192('0x50')]=[{'all':!![]}];}return db['VoiceContext'][_0x3192('0x51')](_0x276a86);})[_0x3192('0x34')](function(_0x1d1e32){_0x522422[_0x3192('0x52')]=_0x1d1e32;return _0x522422;})[_0x3192('0x34')](respondWithFilteredResult(_0x227073,_0x276a86))[_0x3192('0x26')](handleError(_0x227073,null));};exports[_0x3192('0x53')]=function(_0x10fdbe,_0x66d6ad){var _0x4eabc0={'raw':![],'where':{'id':_0x10fdbe[_0x3192('0x54')]['id']}},_0x249d51={};_0x249d51[_0x3192('0x3f')]=_[_0x3192('0x40')](db[_0x3192('0x3b')][_0x3192('0x3c')]);_0x249d51[_0x3192('0x41')]=_['keys'](_0x10fdbe[_0x3192('0x41')]);_0x249d51[_0x3192('0x42')]=_[_0x3192('0x43')](_0x249d51[_0x3192('0x3f')],_0x249d51[_0x3192('0x41')]);_0x4eabc0[_0x3192('0x45')]=_[_0x3192('0x43')](_0x249d51[_0x3192('0x3f')],qs['fields'](_0x10fdbe['query'][_0x3192('0x44')]));_0x4eabc0[_0x3192('0x45')]=_0x4eabc0[_0x3192('0x45')][_0x3192('0x46')]?_0x4eabc0[_0x3192('0x45')]:_0x249d51[_0x3192('0x3f')];if(_0x10fdbe[_0x3192('0x41')]['includeAll']){_0x4eabc0[_0x3192('0x50')]=[{'all':!![]}];}_0x4eabc0=_[_0x3192('0x4d')]({},_0x4eabc0,_0x10fdbe['options']);return db[_0x3192('0x3b')][_0x3192('0x55')](_0x4eabc0)['then'](handleEntityNotFound(_0x66d6ad,null))[_0x3192('0x34')](respondWithResult(_0x66d6ad,null))['catch'](handleError(_0x66d6ad,null));};exports[_0x3192('0x56')]=function(_0xd2d64f,_0xcda527,_0x4d2d22){var _0x3ad50d;return db[_0x3192('0x3b')]['create'](_0xd2d64f[_0x3192('0x57')],{'raw':!![]})['then'](function(_0x5e793c){_0x3ad50d=_0x5e793c;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x1136a6){var _0x4c6b3d=fs[_0x3192('0x58')](path['join'](config[_0x3192('0x59')],_0x3192('0x5a')),_0x3192('0x5b'));var _0x58a593=ejs[_0x3192('0x5c')](_0x4c6b3d,{'contexts':_0x1136a6||[]});fs[_0x3192('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x58a593);})[_0x3192('0x34')](function(){return respondWithRpcPromise('Reload',_0x3192('0x56'),{'module':_0x3192('0x5e')});})[_0x3192('0x34')](function(){var _0x13922f=_0xd2d64f[_0x3192('0x5f')][_0x3192('0x36')]({'plain':!![]});if(!_0x13922f)throw new Error(_0x3192('0x60'));if(_0x13922f[_0x3192('0x61')]===_0x3192('0x5f')){var _0xced172=_0x3ad50d[_0x3192('0x36')]({'plain':!![]});return db[_0x3192('0x62')][_0x3192('0x55')]({'where':{'name':_0x3192('0x63'),'userProfileId':_0x13922f[_0x3192('0x64')]},'raw':!![]})[_0x3192('0x34')](function(_0xbded30){if(_0xbded30&&_0xbded30[_0x3192('0x65')]===0x0){return db[_0x3192('0x37')]['create']({'name':_0xced172[_0x3192('0x4e')],'resourceId':_0xced172['id'],'type':_0xbded30['name'],'sectionId':_0xbded30['id']},{})[_0x3192('0x34')](function(){return _0x3ad50d;});}else{return _0x3ad50d;}})[_0x3192('0x26')](function(_0xdcaa6b){logger[_0x3192('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdcaa6b);throw _0xdcaa6b;});}return _0x3ad50d;})[_0x3192('0x34')](respondWithResult(_0xcda527,0xc9))[_0x3192('0x26')](handleError(_0xcda527,null));};exports[_0x3192('0x33')]=function(_0x58b233,_0x275773,_0x1b52e6){var _0x5c1a49;return db[_0x3192('0x3b')]['find']({'where':{'id':_0x58b233[_0x3192('0x54')]['id']}})[_0x3192('0x34')](handleEntityNotFound(_0x275773,null))[_0x3192('0x34')](saveUpdates(_0x58b233[_0x3192('0x57')],null))[_0x3192('0x34')](function(_0x147ec2){if(_0x147ec2){_0x5c1a49=_0x147ec2;return db[_0x3192('0x3b')][_0x3192('0x51')]({'raw':!![]});}})[_0x3192('0x34')](function(_0x3f72d8){var _0x1438dc=fs['readFileSync'](path['join'](config[_0x3192('0x59')],_0x3192('0x5a')),_0x3192('0x5b'));var _0x34b642=ejs[_0x3192('0x5c')](_0x1438dc,{'contexts':_0x3f72d8||[]});fs[_0x3192('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x34b642);})[_0x3192('0x34')](function(){return respondWithRpcPromise(_0x3192('0x66'),_0x3192('0x33'),{'module':_0x3192('0x5e')});})['then'](function(){return _0x5c1a49;})[_0x3192('0x34')](respondWithResult(_0x275773,null))[_0x3192('0x26')](handleError(_0x275773,null));};exports[_0x3192('0x35')]=function(_0x16bdff,_0x43a121,_0x5419a1){var _0x55559b;return db[_0x3192('0x3b')][_0x3192('0x55')]({'where':{'id':_0x16bdff[_0x3192('0x54')]['id']}})[_0x3192('0x34')](handleEntityNotFound(_0x43a121,null))[_0x3192('0x34')](removeEntity(_0x43a121,null))[_0x3192('0x34')](function(){return db[_0x3192('0x3b')]['findAll']({'raw':!![]});})[_0x3192('0x34')](function(_0x3d378e){var _0xf67a8f=fs[_0x3192('0x58')](path[_0x3192('0x67')](config['root'],_0x3192('0x5a')),'utf8');var _0xf7795a=ejs[_0x3192('0x5c')](_0xf67a8f,{'contexts':_0x3d378e});fs[_0x3192('0x5d')](_0x3192('0x68'),_0xf7795a);return respondWithRpcPromise('Reload','destroy',{'module':_0x3192('0x5e')});})[_0x3192('0x26')](handleError(_0x43a121,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 40bf94a..7e77fd2 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 _0xa027=['bluebird','request-promise','./voiceContext.attributes','exports','VoiceContext','lodash','util','../../config/logger','api','moment'];(function(_0x4726c,_0x1dc1b7){var _0x30963b=function(_0x23bc1f){while(--_0x23bc1f){_0x4726c['push'](_0x4726c['shift']());}};_0x30963b(++_0x1dc1b7);}(_0xa027,0x1a9));var _0x7a02=function(_0x28f138,_0x342534){_0x28f138=_0x28f138-0x0;var _0x400246=_0xa027[_0x28f138];return _0x400246;};'use strict';var _=require(_0x7a02('0x0'));var util=require(_0x7a02('0x1'));var logger=require(_0x7a02('0x2'))(_0x7a02('0x3'));var moment=require(_0x7a02('0x4'));var BPromise=require(_0x7a02('0x5'));var rp=require(_0x7a02('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7a02('0x7'));module[_0x7a02('0x8')]=function(_0x409897,_0x19472e){return _0x409897['define'](_0x7a02('0x9'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc06=['api','bluebird','request-promise','path','rimraf','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc06,0x1a1));var _0x6bc0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc06[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6bc0('0x0'));var util=require(_0x6bc0('0x1'));var logger=require(_0x6bc0('0x2'))(_0x6bc0('0x3'));var moment=require('moment');var BPromise=require(_0x6bc0('0x4'));var rp=require(_0x6bc0('0x5'));var fs=require('fs');var path=require(_0x6bc0('0x6'));var rimraf=require(_0x6bc0('0x7'));var config=require('../../config/environment');var attributes=require(_0x6bc0('0x8'));module['exports']=function(_0x2485ac,_0x5a4e4c){return _0x2485ac[_0x6bc0('0x9')](_0x6bc0('0xa'),attributes,{'tableName':_0x6bc0('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 f888d37..8855821 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 _0xde9f=['debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xde9f,0x118));var _0xfde9=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xde9f[_0x5d7227];return _0x15ac55;};'use strict';var _=require(_0xfde9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfde9('0x1'));var rs=require(_0xfde9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfde9('0x3'))['db'];var utils=require(_0xfde9('0x4'));var logger=require('../../config/logger')(_0xfde9('0x5'));var config=require(_0xfde9('0x6'));var jayson=require(_0xfde9('0x7'));var client=jayson[_0xfde9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c3e01,_0x179ee0,_0x18a202){return new BPromise(function(_0x5569c2,_0x19a337){return client[_0xfde9('0x9')](_0x4c3e01,_0x18a202)[_0xfde9('0xa')](function(_0x3b775d){logger[_0xfde9('0xb')](_0xfde9('0xc'),_0x179ee0,_0xfde9('0xd'));logger[_0xfde9('0xe')](_0xfde9('0xf'),_0x179ee0,_0xfde9('0xd'),JSON[_0xfde9('0x10')](_0x3b775d));if(_0x3b775d[_0xfde9('0x11')]){if(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x12')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x179ee0,_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);return _0x19a337(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x179ee0,_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);return _0x5569c2(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);}else{logger[_0xfde9('0xb')]('VoiceContext,\x20%s,\x20%s',_0x179ee0,_0xfde9('0xd'));_0x5569c2(_0x3b775d[_0xfde9('0x14')][_0xfde9('0x13')]);}})['catch'](function(_0x31b1c7){logger[_0xfde9('0x11')](_0xfde9('0xc'),_0x179ee0,_0x31b1c7);_0x19a337(_0x31b1c7);});});} \ No newline at end of file +var _0x4046=['request\x20sent','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x1594df,_0x528bdb){var _0x2f5d63=function(_0x3dc46d){while(--_0x3dc46d){_0x1594df['push'](_0x1594df['shift']());}};_0x2f5d63(++_0x528bdb);}(_0x4046,0x126));var _0x6404=function(_0x26abb0,_0x2c1f2e){_0x26abb0=_0x26abb0-0x0;var _0x46a7bd=_0x4046[_0x26abb0];return _0x46a7bd;};'use strict';var _=require('lodash');var util=require(_0x6404('0x0'));var moment=require(_0x6404('0x1'));var BPromise=require(_0x6404('0x2'));var rs=require(_0x6404('0x3'));var fs=require('fs');var Redis=require(_0x6404('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6404('0x5'));var jayson=require(_0x6404('0x6'));var client=jayson[_0x6404('0x7')][_0x6404('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2eba27,_0x5cd47b,_0x4cbc18){return new BPromise(function(_0x21b3d6,_0x509ad2){return client[_0x6404('0x9')](_0x2eba27,_0x4cbc18)[_0x6404('0xa')](function(_0x17d76e){logger[_0x6404('0xb')]('VoiceContext,\x20%s,\x20%s',_0x5cd47b,'request\x20sent');logger[_0x6404('0xc')](_0x6404('0xd'),_0x5cd47b,_0x6404('0xe'),JSON[_0x6404('0xf')](_0x17d76e));if(_0x17d76e[_0x6404('0x10')]){if(_0x17d76e[_0x6404('0x10')][_0x6404('0x11')]===0x1f4){logger[_0x6404('0x10')](_0x6404('0x12'),_0x5cd47b,_0x17d76e[_0x6404('0x10')][_0x6404('0x13')]);return _0x509ad2(_0x17d76e['error'][_0x6404('0x13')]);}logger[_0x6404('0x10')](_0x6404('0x12'),_0x5cd47b,_0x17d76e['error'][_0x6404('0x13')]);return _0x21b3d6(_0x17d76e['error'][_0x6404('0x13')]);}else{logger[_0x6404('0xb')]('VoiceContext,\x20%s,\x20%s',_0x5cd47b,_0x6404('0xe'));_0x21b3d6(_0x17d76e[_0x6404('0x14')]['message']);}})[_0x6404('0x15')](function(_0x42234c){logger[_0x6404('0x10')](_0x6404('0x12'),_0x5cd47b,_0x42234c);_0x509ad2(_0x42234c);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index ad90874..05407b3 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 _0x7a62=['../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x180dda,_0x577ad9){var _0x5d003c=function(_0x2cdfd6){while(--_0x2cdfd6){_0x180dda['push'](_0x180dda['shift']());}};_0x5d003c(++_0x577ad9);}(_0x7a62,0x1b0));var _0x27a6=function(_0x4df48f,_0x3e55b4){_0x4df48f=_0x4df48f-0x0;var _0x4f83a9=_0x7a62[_0x4df48f];return _0x4f83a9;};'use strict';var multer=require(_0x27a6('0x0'));var util=require(_0x27a6('0x1'));var path=require(_0x27a6('0x2'));var timeout=require(_0x27a6('0x3'));var express=require(_0x27a6('0x4'));var router=express[_0x27a6('0x5')]();var fs_extra=require(_0x27a6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x27a6('0x7'));var config=require(_0x27a6('0x8'));var controller=require(_0x27a6('0x9'));router[_0x27a6('0xa')]('/',auth[_0x27a6('0xb')](),controller['index']);router['get'](_0x27a6('0xc'),auth[_0x27a6('0xb')](),controller[_0x27a6('0xd')]);router[_0x27a6('0xa')](_0x27a6('0xe'),auth['isAuthenticated'](),controller[_0x27a6('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x27a6('0x10')]);router['put']('/:id',auth[_0x27a6('0xb')](),controller['update']);router[_0x27a6('0x11')]('/:id',auth[_0x27a6('0xb')](),controller[_0x27a6('0x12')]);module[_0x27a6('0x13')]=router; \ No newline at end of file +var _0x447e=['./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra'];(function(_0x4b5965,_0x3909ca){var _0x3e7789=function(_0x33c2b0){while(--_0x33c2b0){_0x4b5965['push'](_0x4b5965['shift']());}};_0x3e7789(++_0x3909ca);}(_0x447e,0x10c));var _0xe447=function(_0x1ce314,_0x32e1c6){_0x1ce314=_0x1ce314-0x0;var _0x5d7ec3=_0x447e[_0x1ce314];return _0x5d7ec3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe447('0x0'));var timeout=require(_0xe447('0x1'));var express=require(_0xe447('0x2'));var router=express['Router']();var fs_extra=require(_0xe447('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe447('0x4'));router[_0xe447('0x5')]('/',auth[_0xe447('0x6')](),controller[_0xe447('0x7')]);router['get']('/describe',auth[_0xe447('0x6')](),controller[_0xe447('0x8')]);router[_0xe447('0x5')](_0xe447('0x9'),auth[_0xe447('0x6')](),controller[_0xe447('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe447('0xb')]);router[_0xe447('0xc')](_0xe447('0x9'),auth['isAuthenticated'](),controller[_0xe447('0xd')]);router[_0xe447('0xe')](_0xe447('0x9'),auth[_0xe447('0x6')](),controller[_0xe447('0xf')]);module[_0xe447('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index abb7012..c74040b 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(_0x218a77,_0x552008){var _0x36bcda=function(_0x1e1b95){while(--_0x1e1b95){_0x218a77['push'](_0x218a77['shift']());}};_0x36bcda(++_0x552008);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'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 _0x9f62=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x3afbdf,_0x9e463b){var _0x5b6861=function(_0x31d287){while(--_0x31d287){_0x3afbdf['push'](_0x3afbdf['shift']());}};_0x5b6861(++_0x9e463b);}(_0x9f62,0x154));var _0x29f6=function(_0x3690cf,_0x3750e7){_0x3690cf=_0x3690cf-0x0;var _0x53ebd2=_0x9f62[_0x3690cf];return _0x53ebd2;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x29f6('0x1')]},'channelstate':{'type':Sequelize[_0x29f6('0x2')]},'channelstatedesc':{'type':Sequelize[_0x29f6('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'connectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'language':{'type':Sequelize[_0x29f6('0x1')]},'accountcode':{'type':Sequelize[_0x29f6('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x29f6('0x1')]},'priority':{'type':Sequelize[_0x29f6('0x2')]},'uniqueid':{'type':Sequelize[_0x29f6('0x1')]},'linkedid':{'type':Sequelize[_0x29f6('0x1')]},'destchannel':{'type':Sequelize[_0x29f6('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x29f6('0x1')]},'destexten':{'type':Sequelize[_0x29f6('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x29f6('0x1')]},'destlinkedid':{'type':Sequelize[_0x29f6('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x29f6('0x3')]},'lastevent':{'type':Sequelize[_0x29f6('0x1')],'comment':_0x29f6('0x4')},'routeId':{'type':Sequelize[_0x29f6('0x2')]},'duration':{'type':Sequelize[_0x29f6('0x2')]},'holdtime':{'type':Sequelize[_0x29f6('0x2')]},'billableseconds':{'type':Sequelize[_0x29f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index e24e453..4a0be09 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 _0x8a68=['offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','error','stack','send','index','map','VoiceDialReport','type','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','name','filter','options','include','rows','catch','params','rawAttributes','intersection','length','find','create','body','describe','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x23f49a,_0xf5538e){var _0x3934e1=function(_0x48b1ae){while(--_0x48b1ae){_0x23f49a['push'](_0x23f49a['shift']());}};_0x3934e1(++_0xf5538e);}(_0x8a68,0x74));var _0x88a6=function(_0x1df2e4,_0x4e04cc){_0x1df2e4=_0x1df2e4-0x0;var _0x43e33a=_0x8a68[_0x1df2e4];return _0x43e33a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x88a6('0x0'));var zipdir=require(_0x88a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x88a6('0x2'));var BPromise=require(_0x88a6('0x3'));var Mustache=require(_0x88a6('0x4'));var util=require(_0x88a6('0x5'));var path=require(_0x88a6('0x6'));var sox=require(_0x88a6('0x7'));var csv=require(_0x88a6('0x8'));var ejs=require(_0x88a6('0x9'));var fs=require('fs');var fs_extra=require(_0x88a6('0xa'));var _=require(_0x88a6('0xb'));var squel=require(_0x88a6('0xc'));var crypto=require('crypto');var jsforce=require(_0x88a6('0xd'));var deskjs=require(_0x88a6('0xe'));var toCsv=require(_0x88a6('0x8'));var querystring=require(_0x88a6('0xf'));var Papa=require(_0x88a6('0x10'));var Redis=require('ioredis');var authService=require(_0x88a6('0x11'));var qs=require(_0x88a6('0x12'));var as=require(_0x88a6('0x13'));var hardwareService=require(_0x88a6('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x88a6('0x15'));var licenseUtil=require(_0x88a6('0x16'));var db=require(_0x88a6('0x17'))['db'];function respondWithStatusCode(_0x5755ce,_0xeccd03){_0xeccd03=_0xeccd03||0xcc;return function(_0x30846){if(_0x30846){return _0x5755ce[_0x88a6('0x18')](_0xeccd03);}return _0x5755ce[_0x88a6('0x19')](_0xeccd03)[_0x88a6('0x1a')]();};}function respondWithResult(_0x19dc0f,_0x5927ed){_0x5927ed=_0x5927ed||0xc8;return function(_0x17bcd8){if(_0x17bcd8){return _0x19dc0f['status'](_0x5927ed)[_0x88a6('0x1b')](_0x17bcd8);}};}function respondWithFilteredResult(_0x327f63,_0x18eb14){return function(_0x41693a){if(_0x41693a){var _0x2274b9=typeof _0x18eb14[_0x88a6('0x1c')]===_0x88a6('0x1d')&&typeof _0x18eb14['limit']==='undefined';var _0x481f2c=_0x41693a[_0x88a6('0x1e')];var _0x38c76c=_0x2274b9?0x0:_0x18eb14[_0x88a6('0x1c')];var _0x2d4810=_0x2274b9?_0x41693a[_0x88a6('0x1e')]:_0x18eb14[_0x88a6('0x1c')]+_0x18eb14[_0x88a6('0x1f')];var _0x5f151f;if(_0x2d4810>=_0x481f2c){_0x2d4810=_0x481f2c;_0x5f151f=0xc8;}else{_0x5f151f=0xce;}_0x327f63[_0x88a6('0x19')](_0x5f151f);return _0x327f63['set'](_0x88a6('0x20'),_0x38c76c+'-'+_0x2d4810+'/'+_0x481f2c)['json'](_0x41693a);}return null;};}function patchUpdates(_0x2f685e){return function(_0x281b82){try{jsonpatch[_0x88a6('0x21')](_0x281b82,_0x2f685e,!![]);}catch(_0x1be5a0){return BPromise['reject'](_0x1be5a0);}return _0x281b82[_0x88a6('0x22')]();};}function saveUpdates(_0x2514fd,_0x527e84){return function(_0x59da64){if(_0x59da64){return _0x59da64[_0x88a6('0x23')](_0x2514fd)[_0x88a6('0x24')](function(_0x261439){return _0x261439;});}return null;};}function removeEntity(_0x483a62,_0x14f7b5){return function(_0x26eda6){if(_0x26eda6){return _0x26eda6[_0x88a6('0x25')]()['then'](function(){_0x483a62[_0x88a6('0x19')](0xcc)[_0x88a6('0x1a')]();});}};}function handleEntityNotFound(_0x5195d5,_0x259c4f){return function(_0x38c035){if(!_0x38c035){_0x5195d5[_0x88a6('0x18')](0x194);}return _0x38c035;};}function handleError(_0x213f3e,_0x4e71d2){_0x4e71d2=_0x4e71d2||0x1f4;return function(_0x3516fe){logger[_0x88a6('0x26')](_0x3516fe[_0x88a6('0x27')]);if(_0x3516fe['name']){delete _0x3516fe['name'];}_0x213f3e['status'](_0x4e71d2)[_0x88a6('0x28')](_0x3516fe);};}exports[_0x88a6('0x29')]=function(_0x2ebe03,_0x49df1a){var _0x132e37={},_0x4e796e={},_0x4e200d={'count':0x0,'rows':[]};var _0x96a12c=_[_0x88a6('0x2a')](db[_0x88a6('0x2b')]['rawAttributes'],function(_0x1c1dbb){return{'name':_0x1c1dbb['fieldName'],'type':_0x1c1dbb[_0x88a6('0x2c')]['key']};});_0x4e796e['model']=_['map'](_0x96a12c,'name');_0x4e796e[_0x88a6('0x2d')]=_[_0x88a6('0x2e')](_0x2ebe03[_0x88a6('0x2d')]);_0x4e796e[_0x88a6('0x2f')]=_['intersection'](_0x4e796e[_0x88a6('0x30')],_0x4e796e['query']);_0x132e37[_0x88a6('0x31')]=_['intersection'](_0x4e796e['model'],qs[_0x88a6('0x32')](_0x2ebe03[_0x88a6('0x2d')]['fields']));_0x132e37[_0x88a6('0x31')]=_0x132e37[_0x88a6('0x31')]['length']?_0x132e37[_0x88a6('0x31')]:_0x4e796e['model'];if(!_0x2ebe03['query'][_0x88a6('0x33')](_0x88a6('0x34'))){_0x132e37[_0x88a6('0x1f')]=qs[_0x88a6('0x1f')](_0x2ebe03[_0x88a6('0x2d')][_0x88a6('0x1f')]);_0x132e37[_0x88a6('0x1c')]=qs[_0x88a6('0x1c')](_0x2ebe03[_0x88a6('0x2d')][_0x88a6('0x1c')]);}_0x132e37[_0x88a6('0x35')]=qs['sort'](_0x2ebe03[_0x88a6('0x2d')][_0x88a6('0x36')]);_0x132e37[_0x88a6('0x37')]=qs[_0x88a6('0x2f')](_[_0x88a6('0x38')](_0x2ebe03[_0x88a6('0x2d')],_0x4e796e['filters']),_0x96a12c);if(_0x2ebe03[_0x88a6('0x2d')]['filter']){_0x132e37['where']=_['merge'](_0x132e37[_0x88a6('0x37')],{'$or':_[_0x88a6('0x2a')](_0x96a12c,function(_0x4926d3){if(_0x4926d3['type']!==_0x88a6('0x39')){var _0x45a8c8={};_0x45a8c8[_0x4926d3[_0x88a6('0x3a')]]={'$like':'%'+_0x2ebe03[_0x88a6('0x2d')][_0x88a6('0x3b')]+'%'};return _0x45a8c8;}})});}_0x132e37=_['merge']({},_0x132e37,_0x2ebe03[_0x88a6('0x3c')]);var _0x436be6={'where':_0x132e37[_0x88a6('0x37')]};return db[_0x88a6('0x2b')][_0x88a6('0x1e')](_0x436be6)['then'](function(_0x60f196){_0x4e200d[_0x88a6('0x1e')]=_0x60f196;if(_0x2ebe03[_0x88a6('0x2d')]['includeAll']){_0x132e37[_0x88a6('0x3d')]=[{'all':!![]}];}return db[_0x88a6('0x2b')]['findAll'](_0x132e37);})[_0x88a6('0x24')](function(_0x5e1f28){_0x4e200d[_0x88a6('0x3e')]=_0x5e1f28;return _0x4e200d;})[_0x88a6('0x24')](respondWithFilteredResult(_0x49df1a,_0x132e37))[_0x88a6('0x3f')](handleError(_0x49df1a,null));};exports['show']=function(_0x305aec,_0x458fc0){var _0x5489e7={'raw':!![],'where':{'id':_0x305aec[_0x88a6('0x40')]['id']}},_0x41a0fc={};_0x41a0fc[_0x88a6('0x30')]=_[_0x88a6('0x2e')](db[_0x88a6('0x2b')][_0x88a6('0x41')]);_0x41a0fc[_0x88a6('0x2d')]=_[_0x88a6('0x2e')](_0x305aec['query']);_0x41a0fc[_0x88a6('0x2f')]=_[_0x88a6('0x42')](_0x41a0fc[_0x88a6('0x30')],_0x41a0fc[_0x88a6('0x2d')]);_0x5489e7['attributes']=_[_0x88a6('0x42')](_0x41a0fc['model'],qs[_0x88a6('0x32')](_0x305aec['query']['fields']));_0x5489e7[_0x88a6('0x31')]=_0x5489e7[_0x88a6('0x31')][_0x88a6('0x43')]?_0x5489e7[_0x88a6('0x31')]:_0x41a0fc[_0x88a6('0x30')];if(_0x305aec[_0x88a6('0x2d')]['includeAll']){_0x5489e7[_0x88a6('0x3d')]=[{'all':!![]}];}_0x5489e7=_['merge']({},_0x5489e7,_0x305aec[_0x88a6('0x3c')]);return db[_0x88a6('0x2b')][_0x88a6('0x44')](_0x5489e7)[_0x88a6('0x24')](handleEntityNotFound(_0x458fc0,null))[_0x88a6('0x24')](respondWithResult(_0x458fc0,null))[_0x88a6('0x3f')](handleError(_0x458fc0,null));};exports['create']=function(_0x5988bb,_0x49229f){return db['VoiceDialReport'][_0x88a6('0x45')](_0x5988bb[_0x88a6('0x46')],{})[_0x88a6('0x24')](respondWithResult(_0x49229f,0xc9))[_0x88a6('0x3f')](handleError(_0x49229f,null));};exports[_0x88a6('0x23')]=function(_0x4b97c7,_0x309851){if(_0x4b97c7[_0x88a6('0x46')]['id']){delete _0x4b97c7[_0x88a6('0x46')]['id'];}return db[_0x88a6('0x2b')][_0x88a6('0x44')]({'where':{'id':_0x4b97c7[_0x88a6('0x40')]['id']}})['then'](handleEntityNotFound(_0x309851,null))[_0x88a6('0x24')](saveUpdates(_0x4b97c7['body'],null))[_0x88a6('0x24')](respondWithResult(_0x309851,null))[_0x88a6('0x3f')](handleError(_0x309851,null));};exports[_0x88a6('0x25')]=function(_0x38dc39,_0x5ac8a1){return db[_0x88a6('0x2b')][_0x88a6('0x44')]({'where':{'id':_0x38dc39['params']['id']}})[_0x88a6('0x24')](handleEntityNotFound(_0x5ac8a1,null))[_0x88a6('0x24')](removeEntity(_0x5ac8a1,null))[_0x88a6('0x3f')](handleError(_0x5ac8a1,null));};exports[_0x88a6('0x47')]=function(_0x2bc721,_0x33da4e){return db[_0x88a6('0x2b')]['describe']()[_0x88a6('0x24')](respondWithResult(_0x33da4e,null))[_0x88a6('0x3f')](handleError(_0x33da4e,null));}; \ No newline at end of file +var _0x06ba=['map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','findAll','catch','merge','find','create','body','params','destroy','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','error','stack','name','send'];(function(_0x1be2cb,_0x4fdefe){var _0x584aa4=function(_0x3f57cd){while(--_0x3f57cd){_0x1be2cb['push'](_0x1be2cb['shift']());}};_0x584aa4(++_0x4fdefe);}(_0x06ba,0x14c));var _0xa06b=function(_0x59b11f,_0x25f699){_0x59b11f=_0x59b11f-0x0;var _0x23be25=_0x06ba[_0x59b11f];return _0x23be25;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa06b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa06b('0x1'));var moment=require(_0xa06b('0x2'));var BPromise=require(_0xa06b('0x3'));var Mustache=require(_0xa06b('0x4'));var util=require(_0xa06b('0x5'));var path=require(_0xa06b('0x6'));var sox=require(_0xa06b('0x7'));var csv=require(_0xa06b('0x8'));var ejs=require(_0xa06b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa06b('0xa'));var squel=require(_0xa06b('0xb'));var crypto=require('crypto');var jsforce=require(_0xa06b('0xc'));var deskjs=require(_0xa06b('0xd'));var toCsv=require(_0xa06b('0x8'));var querystring=require('querystring');var Papa=require(_0xa06b('0xe'));var Redis=require(_0xa06b('0xf'));var authService=require(_0xa06b('0x10'));var qs=require(_0xa06b('0x11'));var as=require(_0xa06b('0x12'));var hardwareService=require(_0xa06b('0x13'));var logger=require('../../config/logger')(_0xa06b('0x14'));var utils=require(_0xa06b('0x15'));var config=require(_0xa06b('0x16'));var licenseUtil=require(_0xa06b('0x17'));var db=require(_0xa06b('0x18'))['db'];function respondWithStatusCode(_0x1b76d3,_0x1b419d){_0x1b419d=_0x1b419d||0xcc;return function(_0x417dac){if(_0x417dac){return _0x1b76d3[_0xa06b('0x19')](_0x1b419d);}return _0x1b76d3[_0xa06b('0x1a')](_0x1b419d)[_0xa06b('0x1b')]();};}function respondWithResult(_0x5066a8,_0x36da6e){_0x36da6e=_0x36da6e||0xc8;return function(_0x3fae0e){if(_0x3fae0e){return _0x5066a8[_0xa06b('0x1a')](_0x36da6e)['json'](_0x3fae0e);}};}function respondWithFilteredResult(_0x2278a8,_0x30d193){return function(_0x30510c){if(_0x30510c){var _0x22b9eb=typeof _0x30d193[_0xa06b('0x1c')]==='undefined'&&typeof _0x30d193[_0xa06b('0x1d')]===_0xa06b('0x1e');var _0xe7a1f4=_0x30510c[_0xa06b('0x1f')];var _0x39775b=_0x22b9eb?0x0:_0x30d193[_0xa06b('0x1c')];var _0x5b07fd=_0x22b9eb?_0x30510c[_0xa06b('0x1f')]:_0x30d193[_0xa06b('0x1c')]+_0x30d193['limit'];var _0x2be118;if(_0x5b07fd>=_0xe7a1f4){_0x5b07fd=_0xe7a1f4;_0x2be118=0xc8;}else{_0x2be118=0xce;}_0x2278a8[_0xa06b('0x1a')](_0x2be118);return _0x2278a8[_0xa06b('0x20')](_0xa06b('0x21'),_0x39775b+'-'+_0x5b07fd+'/'+_0xe7a1f4)[_0xa06b('0x22')](_0x30510c);}return null;};}function patchUpdates(_0x3f6dd8){return function(_0x54600f){try{jsonpatch['apply'](_0x54600f,_0x3f6dd8,!![]);}catch(_0x5e7e9c){return BPromise[_0xa06b('0x23')](_0x5e7e9c);}return _0x54600f[_0xa06b('0x24')]();};}function saveUpdates(_0x1f3422,_0x262e4b){return function(_0x4abb85){if(_0x4abb85){return _0x4abb85[_0xa06b('0x25')](_0x1f3422)[_0xa06b('0x26')](function(_0x14bf5b){return _0x14bf5b;});}return null;};}function removeEntity(_0x1be3c7,_0x3c7dac){return function(_0x42f546){if(_0x42f546){return _0x42f546['destroy']()[_0xa06b('0x26')](function(){_0x1be3c7[_0xa06b('0x1a')](0xcc)[_0xa06b('0x1b')]();});}};}function handleEntityNotFound(_0x5d37fc,_0x558d5d){return function(_0x5e8445){if(!_0x5e8445){_0x5d37fc[_0xa06b('0x19')](0x194);}return _0x5e8445;};}function handleError(_0x21dac0,_0x2ed5cb){_0x2ed5cb=_0x2ed5cb||0x1f4;return function(_0xbdf2d7){logger[_0xa06b('0x27')](_0xbdf2d7[_0xa06b('0x28')]);if(_0xbdf2d7[_0xa06b('0x29')]){delete _0xbdf2d7['name'];}_0x21dac0[_0xa06b('0x1a')](_0x2ed5cb)[_0xa06b('0x2a')](_0xbdf2d7);};}exports['index']=function(_0xa4aeeb,_0x38f2d1){var _0x3c00d4={},_0x3c56aa={},_0x31692e={'count':0x0,'rows':[]};var _0x271f3b=_[_0xa06b('0x2b')](db[_0xa06b('0x2c')][_0xa06b('0x2d')],function(_0x37bfda){return{'name':_0x37bfda[_0xa06b('0x2e')],'type':_0x37bfda[_0xa06b('0x2f')][_0xa06b('0x30')]};});_0x3c56aa[_0xa06b('0x31')]=_[_0xa06b('0x2b')](_0x271f3b,_0xa06b('0x29'));_0x3c56aa[_0xa06b('0x32')]=_[_0xa06b('0x33')](_0xa4aeeb[_0xa06b('0x32')]);_0x3c56aa[_0xa06b('0x34')]=_['intersection'](_0x3c56aa['model'],_0x3c56aa[_0xa06b('0x32')]);_0x3c00d4['attributes']=_[_0xa06b('0x35')](_0x3c56aa[_0xa06b('0x31')],qs[_0xa06b('0x36')](_0xa4aeeb[_0xa06b('0x32')][_0xa06b('0x36')]));_0x3c00d4[_0xa06b('0x37')]=_0x3c00d4['attributes'][_0xa06b('0x38')]?_0x3c00d4[_0xa06b('0x37')]:_0x3c56aa[_0xa06b('0x31')];if(!_0xa4aeeb[_0xa06b('0x32')][_0xa06b('0x39')](_0xa06b('0x3a'))){_0x3c00d4[_0xa06b('0x1d')]=qs[_0xa06b('0x1d')](_0xa4aeeb[_0xa06b('0x32')][_0xa06b('0x1d')]);_0x3c00d4[_0xa06b('0x1c')]=qs[_0xa06b('0x1c')](_0xa4aeeb[_0xa06b('0x32')][_0xa06b('0x1c')]);}_0x3c00d4[_0xa06b('0x3b')]=qs['sort'](_0xa4aeeb[_0xa06b('0x32')][_0xa06b('0x3c')]);_0x3c00d4[_0xa06b('0x3d')]=qs[_0xa06b('0x34')](_['pick'](_0xa4aeeb[_0xa06b('0x32')],_0x3c56aa[_0xa06b('0x34')]),_0x271f3b);if(_0xa4aeeb[_0xa06b('0x32')][_0xa06b('0x3e')]){_0x3c00d4['where']=_['merge'](_0x3c00d4[_0xa06b('0x3d')],{'$or':_[_0xa06b('0x2b')](_0x271f3b,function(_0x15b4f4){if(_0x15b4f4[_0xa06b('0x2f')]!=='VIRTUAL'){var _0x2e7eab={};_0x2e7eab[_0x15b4f4[_0xa06b('0x29')]]={'$like':'%'+_0xa4aeeb[_0xa06b('0x32')]['filter']+'%'};return _0x2e7eab;}})});}_0x3c00d4=_['merge']({},_0x3c00d4,_0xa4aeeb[_0xa06b('0x3f')]);var _0x3466b4={'where':_0x3c00d4[_0xa06b('0x3d')]};return db[_0xa06b('0x2c')]['count'](_0x3466b4)[_0xa06b('0x26')](function(_0x17e786){_0x31692e[_0xa06b('0x1f')]=_0x17e786;if(_0xa4aeeb[_0xa06b('0x32')][_0xa06b('0x40')]){_0x3c00d4[_0xa06b('0x41')]=[{'all':!![]}];}return db[_0xa06b('0x2c')][_0xa06b('0x42')](_0x3c00d4);})[_0xa06b('0x26')](function(_0x313204){_0x31692e['rows']=_0x313204;return _0x31692e;})['then'](respondWithFilteredResult(_0x38f2d1,_0x3c00d4))[_0xa06b('0x43')](handleError(_0x38f2d1,null));};exports['show']=function(_0xf8b697,_0x69e42b){var _0xd3db31={'raw':!![],'where':{'id':_0xf8b697['params']['id']}},_0x144ea2={};_0x144ea2[_0xa06b('0x31')]=_[_0xa06b('0x33')](db['VoiceDialReport'][_0xa06b('0x2d')]);_0x144ea2[_0xa06b('0x32')]=_[_0xa06b('0x33')](_0xf8b697['query']);_0x144ea2['filters']=_[_0xa06b('0x35')](_0x144ea2[_0xa06b('0x31')],_0x144ea2['query']);_0xd3db31[_0xa06b('0x37')]=_[_0xa06b('0x35')](_0x144ea2[_0xa06b('0x31')],qs['fields'](_0xf8b697[_0xa06b('0x32')][_0xa06b('0x36')]));_0xd3db31['attributes']=_0xd3db31[_0xa06b('0x37')][_0xa06b('0x38')]?_0xd3db31[_0xa06b('0x37')]:_0x144ea2[_0xa06b('0x31')];if(_0xf8b697[_0xa06b('0x32')][_0xa06b('0x40')]){_0xd3db31[_0xa06b('0x41')]=[{'all':!![]}];}_0xd3db31=_[_0xa06b('0x44')]({},_0xd3db31,_0xf8b697[_0xa06b('0x3f')]);return db[_0xa06b('0x2c')][_0xa06b('0x45')](_0xd3db31)[_0xa06b('0x26')](handleEntityNotFound(_0x69e42b,null))[_0xa06b('0x26')](respondWithResult(_0x69e42b,null))[_0xa06b('0x43')](handleError(_0x69e42b,null));};exports['create']=function(_0x138810,_0x1f57ee){return db['VoiceDialReport'][_0xa06b('0x46')](_0x138810[_0xa06b('0x47')],{})[_0xa06b('0x26')](respondWithResult(_0x1f57ee,0xc9))['catch'](handleError(_0x1f57ee,null));};exports[_0xa06b('0x25')]=function(_0x113aa1,_0x3216db){if(_0x113aa1[_0xa06b('0x47')]['id']){delete _0x113aa1[_0xa06b('0x47')]['id'];}return db[_0xa06b('0x2c')]['find']({'where':{'id':_0x113aa1[_0xa06b('0x48')]['id']}})[_0xa06b('0x26')](handleEntityNotFound(_0x3216db,null))[_0xa06b('0x26')](saveUpdates(_0x113aa1['body'],null))['then'](respondWithResult(_0x3216db,null))[_0xa06b('0x43')](handleError(_0x3216db,null));};exports[_0xa06b('0x49')]=function(_0xd04781,_0x535f64){return db[_0xa06b('0x2c')]['find']({'where':{'id':_0xd04781[_0xa06b('0x48')]['id']}})[_0xa06b('0x26')](handleEntityNotFound(_0x535f64,null))[_0xa06b('0x26')](removeEntity(_0x535f64,null))[_0xa06b('0x43')](handleError(_0x535f64,null));};exports[_0xa06b('0x4a')]=function(_0x373ea2,_0x11342d){return db[_0xa06b('0x2c')][_0xa06b('0x4a')]()[_0xa06b('0x26')](respondWithResult(_0x11342d,null))[_0xa06b('0x43')](handleError(_0x11342d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 473fed2..da6b31e 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 _0x12ff=['request-promise','path','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','util','api','moment'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x12ff,0x165));var _0xf12f=function(_0x119171,_0x3929e3){_0x119171=_0x119171-0x0;var _0x325724=_0x12ff[_0x119171];return _0x325724;};'use strict';var _=require('lodash');var util=require(_0xf12f('0x0'));var logger=require('../../config/logger')(_0xf12f('0x1'));var moment=require(_0xf12f('0x2'));var BPromise=require('bluebird');var rp=require(_0xf12f('0x3'));var fs=require('fs');var path=require(_0xf12f('0x4'));var rimraf=require('rimraf');var config=require(_0xf12f('0x5'));var attributes=require(_0xf12f('0x6'));module['exports']=function(_0xcb2899,_0x53d4db){return _0xcb2899[_0xf12f('0x7')](_0xf12f('0x8'),attributes,{'tableName':_0xf12f('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1259=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial','lodash','util','../../config/logger','api','moment'];(function(_0x38f02e,_0xe73a0d){var _0x206435=function(_0x26c7bd){while(--_0x26c7bd){_0x38f02e['push'](_0x38f02e['shift']());}};_0x206435(++_0xe73a0d);}(_0x1259,0x1f3));var _0x9125=function(_0x6b77d4,_0x2b5301){_0x6b77d4=_0x6b77d4-0x0;var _0x1b94ba=_0x1259[_0x6b77d4];return _0x1b94ba;};'use strict';var _=require(_0x9125('0x0'));var util=require(_0x9125('0x1'));var logger=require(_0x9125('0x2'))(_0x9125('0x3'));var moment=require(_0x9125('0x4'));var BPromise=require(_0x9125('0x5'));var rp=require(_0x9125('0x6'));var fs=require('fs');var path=require(_0x9125('0x7'));var rimraf=require(_0x9125('0x8'));var config=require(_0x9125('0x9'));var attributes=require('./voiceDialReport.attributes');module[_0x9125('0xa')]=function(_0x479f58,_0xe07335){return _0x479f58[_0x9125('0xb')](_0x9125('0xc'),attributes,{'tableName':_0x9125('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index a2ed031..e3460ae 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 _0x7014=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','debug','stringify','error','message','result','catch','CreateVoiceDialReport','create','body','options','VoiceDialReport','update','where','attributes','limit','UpdateVoiceDialReport','util','moment'];(function(_0x2544ed,_0x276984){var _0x232965=function(_0x584036){while(--_0x584036){_0x2544ed['push'](_0x2544ed['shift']());}};_0x232965(++_0x276984);}(_0x7014,0xf6));var _0x4701=function(_0x1888fc,_0x2aa605){_0x1888fc=_0x1888fc-0x0;var _0x36face=_0x7014[_0x1888fc];return _0x36face;};'use strict';var _=require('lodash');var util=require(_0x4701('0x0'));var moment=require(_0x4701('0x1'));var BPromise=require(_0x4701('0x2'));var rs=require(_0x4701('0x3'));var fs=require('fs');var Redis=require(_0x4701('0x4'));var db=require(_0x4701('0x5'))['db'];var utils=require(_0x4701('0x6'));var logger=require(_0x4701('0x7'))(_0x4701('0x8'));var config=require(_0x4701('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4701('0xa')][_0x4701('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43d21f,_0x1c0bcc,_0x73aae2){return new BPromise(function(_0x5b975d,_0xf76ced){return client['request'](_0x43d21f,_0x73aae2)[_0x4701('0xc')](function(_0x5cdc73){logger[_0x4701('0xd')](_0x4701('0xe'),_0x1c0bcc,'request\x20sent');logger[_0x4701('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x1c0bcc,'request\x20sent',JSON[_0x4701('0x10')](_0x5cdc73));if(_0x5cdc73['error']){if(_0x5cdc73[_0x4701('0x11')]['code']===0x1f4){logger[_0x4701('0x11')](_0x4701('0xe'),_0x1c0bcc,_0x5cdc73[_0x4701('0x11')][_0x4701('0x12')]);return _0xf76ced(_0x5cdc73[_0x4701('0x11')]['message']);}logger[_0x4701('0x11')](_0x4701('0xe'),_0x1c0bcc,_0x5cdc73[_0x4701('0x11')]['message']);return _0x5b975d(_0x5cdc73[_0x4701('0x11')][_0x4701('0x12')]);}else{logger[_0x4701('0xd')](_0x4701('0xe'),_0x1c0bcc,'request\x20sent');_0x5b975d(_0x5cdc73[_0x4701('0x13')][_0x4701('0x12')]);}})[_0x4701('0x14')](function(_0x3a3a75){logger[_0x4701('0x11')](_0x4701('0xe'),_0x1c0bcc,_0x3a3a75);_0xf76ced(_0x3a3a75);});});}exports[_0x4701('0x15')]=function(_0x14ec9d){var _0x4c27b3=this;return new Promise(function(_0x533e48,_0x256d31){return db['VoiceDialReport'][_0x4701('0x16')](_0x14ec9d[_0x4701('0x17')],{'raw':_0x14ec9d['options']?_0x14ec9d[_0x4701('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x4701('0xc')](function(_0x55315c){logger[_0x4701('0xd')](_0x4701('0x15'),_0x14ec9d);logger['debug'](_0x4701('0x15'),_0x14ec9d,JSON[_0x4701('0x10')](_0x55315c));_0x533e48(_0x55315c);})[_0x4701('0x14')](function(_0x511b27){logger['error'](_0x4701('0x15'),_0x511b27[_0x4701('0x12')],_0x14ec9d);_0x256d31(_0x4c27b3[_0x4701('0x11')](0x1f4,_0x511b27[_0x4701('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x410a3d){var _0xb5caa7=this;return new Promise(function(_0x30142f,_0x2ae661){return db[_0x4701('0x19')][_0x4701('0x1a')](_0x410a3d[_0x4701('0x17')],{'raw':_0x410a3d[_0x4701('0x18')]?_0x410a3d[_0x4701('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x410a3d[_0x4701('0x18')]?_0x410a3d['options'][_0x4701('0x1b')]||null:null,'attributes':_0x410a3d['options']?_0x410a3d[_0x4701('0x18')][_0x4701('0x1c')]||null:null,'limit':_0x410a3d[_0x4701('0x18')]?_0x410a3d[_0x4701('0x18')][_0x4701('0x1d')]||null:null})[_0x4701('0xc')](function(_0x14f9ee){logger[_0x4701('0xd')](_0x4701('0x1e'),_0x410a3d);logger[_0x4701('0xf')]('UpdateVoiceDialReport',_0x410a3d,JSON[_0x4701('0x10')](_0x14f9ee));_0x30142f(_0x14f9ee);})[_0x4701('0x14')](function(_0x3abfb8){logger[_0x4701('0x11')](_0x4701('0x1e'),_0x3abfb8['message'],_0x410a3d);_0x2ae661(_0xb5caa7[_0x4701('0x11')](0x1f4,_0x3abfb8[_0x4701('0x12')]));});});}; \ No newline at end of file +var _0x367a=['jayson/promise','client','http','request','then','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceDialReport,\x20%s,\x20%s','message','request\x20sent','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','catch','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4de01e,_0x44e130){var _0x5c4271=function(_0x5a0266){while(--_0x5a0266){_0x4de01e['push'](_0x4de01e['shift']());}};_0x5c4271(++_0x44e130);}(_0x367a,0x15e));var _0xa367=function(_0x23aa41,_0x2944df){_0x23aa41=_0x23aa41-0x0;var _0x293abb=_0x367a[_0x23aa41];return _0x293abb;};'use strict';var _=require(_0xa367('0x0'));var util=require(_0xa367('0x1'));var moment=require(_0xa367('0x2'));var BPromise=require('bluebird');var rs=require(_0xa367('0x3'));var fs=require('fs');var Redis=require(_0xa367('0x4'));var db=require(_0xa367('0x5'))['db'];var utils=require(_0xa367('0x6'));var logger=require(_0xa367('0x7'))(_0xa367('0x8'));var config=require(_0xa367('0x9'));var jayson=require(_0xa367('0xa'));var client=jayson[_0xa367('0xb')][_0xa367('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4826ec,_0x57f269,_0x292d11){return new BPromise(function(_0x248058,_0x413fe7){return client[_0xa367('0xd')](_0x4826ec,_0x292d11)[_0xa367('0xe')](function(_0x1483f7){logger[_0xa367('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x57f269,'request\x20sent');logger[_0xa367('0x10')](_0xa367('0x11'),_0x57f269,'request\x20sent',JSON[_0xa367('0x12')](_0x1483f7));if(_0x1483f7[_0xa367('0x13')]){if(_0x1483f7[_0xa367('0x13')]['code']===0x1f4){logger[_0xa367('0x13')](_0xa367('0x14'),_0x57f269,_0x1483f7[_0xa367('0x13')][_0xa367('0x15')]);return _0x413fe7(_0x1483f7[_0xa367('0x13')]['message']);}logger[_0xa367('0x13')](_0xa367('0x14'),_0x57f269,_0x1483f7['error'][_0xa367('0x15')]);return _0x248058(_0x1483f7[_0xa367('0x13')][_0xa367('0x15')]);}else{logger['info'](_0xa367('0x14'),_0x57f269,_0xa367('0x16'));_0x248058(_0x1483f7[_0xa367('0x17')]['message']);}})['catch'](function(_0xd397f8){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x57f269,_0xd397f8);_0x413fe7(_0xd397f8);});});}exports[_0xa367('0x18')]=function(_0x4ee92f){var _0x10df20=this;return new Promise(function(_0x1f664b,_0x65bef6){return db[_0xa367('0x19')][_0xa367('0x1a')](_0x4ee92f[_0xa367('0x1b')],{'raw':_0x4ee92f['options']?_0x4ee92f[_0xa367('0x1c')][_0xa367('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x513a20){logger['info'](_0xa367('0x18'),_0x4ee92f);logger[_0xa367('0x10')](_0xa367('0x18'),_0x4ee92f,JSON['stringify'](_0x513a20));_0x1f664b(_0x513a20);})[_0xa367('0x1e')](function(_0xa3cded){logger['error'](_0xa367('0x18'),_0xa3cded[_0xa367('0x15')],_0x4ee92f);_0x65bef6(_0x10df20[_0xa367('0x13')](0x1f4,_0xa3cded[_0xa367('0x15')]));});});};exports[_0xa367('0x1f')]=function(_0x203748){var _0x4411cd=this;return new Promise(function(_0x304a55,_0x1ebae8){return db['VoiceDialReport'][_0xa367('0x20')](_0x203748[_0xa367('0x1b')],{'raw':_0x203748['options']?_0x203748[_0xa367('0x1c')][_0xa367('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x203748[_0xa367('0x1c')]?_0x203748[_0xa367('0x1c')][_0xa367('0x21')]||null:null,'attributes':_0x203748['options']?_0x203748[_0xa367('0x1c')][_0xa367('0x22')]||null:null,'limit':_0x203748[_0xa367('0x1c')]?_0x203748[_0xa367('0x1c')][_0xa367('0x23')]||null:null})['then'](function(_0x10cf5b){logger[_0xa367('0xf')]('UpdateVoiceDialReport',_0x203748);logger['debug'](_0xa367('0x1f'),_0x203748,JSON[_0xa367('0x12')](_0x10cf5b));_0x304a55(_0x10cf5b);})['catch'](function(_0x253d45){logger['error'](_0xa367('0x1f'),_0x253d45[_0xa367('0x15')],_0x203748);_0x1ebae8(_0x4411cd[_0xa367('0x13')](0x1f4,_0x253d45[_0xa367('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f2bdc3e..9803750 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 _0xed3c=['destroy','exports','util','path','express','Router','../../components/auth/service','./voiceExtension.controller','get','/:id','post','isAuthenticated','/:id/applications','addApplications','put','update','delete'];(function(_0x2a6f43,_0x479e52){var _0x1dffd0=function(_0x1d75b5){while(--_0x1d75b5){_0x2a6f43['push'](_0x2a6f43['shift']());}};_0x1dffd0(++_0x479e52);}(_0xed3c,0x134));var _0xced3=function(_0x2e0bed,_0x24b28d){_0x2e0bed=_0x2e0bed-0x0;var _0x45e74e=_0xed3c[_0x2e0bed];return _0x45e74e;};'use strict';var multer=require('multer');var util=require(_0xced3('0x0'));var path=require(_0xced3('0x1'));var timeout=require('connect-timeout');var express=require(_0xced3('0x2'));var router=express[_0xced3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xced3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xced3('0x5'));router[_0xced3('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xced3('0x6')](_0xced3('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xced3('0x8')]('/',auth[_0xced3('0x9')](),controller['create']);router['post'](_0xced3('0xa'),auth['isAuthenticated'](),controller[_0xced3('0xb')]);router[_0xced3('0xc')](_0xced3('0x7'),auth['isAuthenticated'](),controller[_0xced3('0xd')]);router[_0xced3('0xe')](_0xced3('0x7'),auth[_0xced3('0x9')](),controller[_0xced3('0xf')]);module[_0xced3('0x10')]=router; \ No newline at end of file +var _0xd746=['./voiceExtension.controller','get','/:id','show','post','isAuthenticated','create','addApplications','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xd746,0x99));var _0x6d74=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xd746[_0x29d915];return _0x160f86;};'use strict';var multer=require(_0x6d74('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6d74('0x1'));var express=require(_0x6d74('0x2'));var router=express['Router']();var fs_extra=require(_0x6d74('0x3'));var auth=require(_0x6d74('0x4'));var interaction=require(_0x6d74('0x5'));var config=require(_0x6d74('0x6'));var controller=require(_0x6d74('0x7'));router[_0x6d74('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6d74('0x9'),auth['isAuthenticated'](),controller[_0x6d74('0xa')]);router[_0x6d74('0xb')]('/',auth[_0x6d74('0xc')](),controller[_0x6d74('0xd')]);router[_0x6d74('0xb')]('/:id/applications',auth[_0x6d74('0xc')](),controller[_0x6d74('0xe')]);router[_0x6d74('0xf')]('/:id',auth[_0x6d74('0xc')](),controller[_0x6d74('0x10')]);router[_0x6d74('0x11')](_0x6d74('0x9'),auth['isAuthenticated'](),controller[_0x6d74('0x12')]);module[_0x6d74('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 21a7f7e..78f968e 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 _0xf6a4=['outbound','internal','inbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','exports','STRING','compositeIndex','NoOp','inbound'];(function(_0x1d96e5,_0x38fff6){var _0x345df0=function(_0x5c6b08){while(--_0x5c6b08){_0x1d96e5['push'](_0x1d96e5['shift']());}};_0x345df0(++_0x38fff6);}(_0xf6a4,0xaa));var _0x4f6a=function(_0x20de1a,_0x3f26d8){_0x20de1a=_0x20de1a-0x0;var _0x57c008=_0xf6a4[_0x20de1a];return _0x57c008;};'use strict';var Sequelize=require(_0x4f6a('0x0'));module[_0x4f6a('0x1')]={'context':{'type':Sequelize[_0x4f6a('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x4f6a('0x2')],'allowNull':![],'unique':_0x4f6a('0x3')},'priority':{'type':Sequelize[_0x4f6a('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x4f6a('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x4f6a('0x2')],'allowNull':![],'defaultValue':_0x4f6a('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x4f6a('0x5'),_0x4f6a('0x6'),_0x4f6a('0x7'),_0x4f6a('0x8'),'outbound-fax','system',_0x4f6a('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x4f6a('0x2')]},'interval':{'type':Sequelize[_0x4f6a('0x2')],'allowNull':![],'defaultValue':_0x4f6a('0xa')},'IntervalId':{'type':Sequelize[_0x4f6a('0xb')]},'isApp':{'type':Sequelize[_0x4f6a('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x4f6a('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x4f6a('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x4f6a('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x4f6a('0xd')},'answer':{'type':Sequelize[_0x4f6a('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x4f6a('0xe')],'get':function(_0xbbc3e5){return this[_0x4f6a('0xf')]('exten');}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xc7de=['exten','sequelize','compositeIndex','STRING','NoOp','ENUM','inbound','outbound','inbound-fax','outbound-fax','any','INTEGER','BOOLEAN','VIRTUAL','getDataValue'];(function(_0x16cdf2,_0x8ec198){var _0x702347=function(_0x5349fa){while(--_0x5349fa){_0x16cdf2['push'](_0x16cdf2['shift']());}};_0x702347(++_0x8ec198);}(_0xc7de,0x14b));var _0xec7d=function(_0x2a2799,_0x5e25a8){_0x2a2799=_0x2a2799-0x0;var _0x17f761=_0xc7de[_0x2a2799];return _0x17f761;};'use strict';var Sequelize=require(_0xec7d('0x0'));module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xec7d('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xec7d('0x2')],'allowNull':![],'unique':_0xec7d('0x1')},'priority':{'type':Sequelize[_0xec7d('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xec7d('0x1')},'tag':{'type':Sequelize[_0xec7d('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xec7d('0x2')],'allowNull':![],'defaultValue':_0xec7d('0x3')},'appdata':{'type':Sequelize[_0xec7d('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xec7d('0x4')](_0xec7d('0x5'),_0xec7d('0x6'),'internal',_0xec7d('0x7'),_0xec7d('0x8'),'system',_0xec7d('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xec7d('0x2')]},'interval':{'type':Sequelize[_0xec7d('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xec7d('0xa')]},'isApp':{'type':Sequelize[_0xec7d('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xec7d('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xec7d('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xec7d('0xa')]},'recordingFormat':{'type':Sequelize[_0xec7d('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xec7d('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xec7d('0xc')],'get':function(_0x40c075){return this[_0xec7d('0xd')](_0xec7d('0xe'));}},'alias':{'type':Sequelize[_0xec7d('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 290c4bf..4980a9c 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 _0x956c=['find','name','UserProfileResource','destroy','stack','send','index','VoiceExtension','rawAttributes','fieldName','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','length','options','create','exten','body','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','description','recordingFormat','alias','addApplications','findOne','sequelize','transaction','VoiceExtensionId','rewriteDial','toLowerCase','true','bulkCreate','findAndCountAll','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','register','sendStatus','end','json','undefined','offset','count','limit','status','set','Content-Range','apply','reject','save','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','includes','type'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x956c,0xa9));var _0xc956=function(_0x277656,_0x33a52d){_0x277656=_0x277656-0x0;var _0x5780db=_0x956c[_0x277656];return _0x5780db;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc956('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc956('0x1'));var moment=require(_0xc956('0x2'));var BPromise=require(_0xc956('0x3'));var Mustache=require(_0xc956('0x4'));var util=require(_0xc956('0x5'));var path=require(_0xc956('0x6'));var sox=require(_0xc956('0x7'));var csv=require(_0xc956('0x8'));var ejs=require(_0xc956('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc956('0xa'));var squel=require(_0xc956('0xb'));var crypto=require(_0xc956('0xc'));var jsforce=require(_0xc956('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc956('0x8'));var querystring=require(_0xc956('0xe'));var Papa=require(_0xc956('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc956('0x10'));var as=require(_0xc956('0x11'));var hardwareService=require(_0xc956('0x12'));var logger=require(_0xc956('0x13'))('api');var utils=require(_0xc956('0x14'));var config=require(_0xc956('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc956('0x16'))['db'];config[_0xc956('0x17')]=_[_0xc956('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc956('0x17')]));require('./voiceExtension.socket')[_0xc956('0x19')](socket);function respondWithStatusCode(_0x2d9d11,_0x49e31e){_0x49e31e=_0x49e31e||0xcc;return function(_0x3683cd){if(_0x3683cd){return _0x2d9d11[_0xc956('0x1a')](_0x49e31e);}return _0x2d9d11['status'](_0x49e31e)[_0xc956('0x1b')]();};}function respondWithResult(_0x571f58,_0x3f4172){_0x3f4172=_0x3f4172||0xc8;return function(_0x24de14){if(_0x24de14){return _0x571f58['status'](_0x3f4172)[_0xc956('0x1c')](_0x24de14);}};}function respondWithFilteredResult(_0x530218,_0xe00c0b){return function(_0xc10b68){if(_0xc10b68){var _0x5e5b89=typeof _0xe00c0b['offset']===_0xc956('0x1d')&&typeof _0xe00c0b['limit']===_0xc956('0x1d');var _0x11decb=_0xc10b68['count'];var _0x283ad2=_0x5e5b89?0x0:_0xe00c0b[_0xc956('0x1e')];var _0x482d90=_0x5e5b89?_0xc10b68[_0xc956('0x1f')]:_0xe00c0b[_0xc956('0x1e')]+_0xe00c0b[_0xc956('0x20')];var _0x1f8191;if(_0x482d90>=_0x11decb){_0x482d90=_0x11decb;_0x1f8191=0xc8;}else{_0x1f8191=0xce;}_0x530218[_0xc956('0x21')](_0x1f8191);return _0x530218[_0xc956('0x22')](_0xc956('0x23'),_0x283ad2+'-'+_0x482d90+'/'+_0x11decb)['json'](_0xc10b68);}return null;};}function patchUpdates(_0x239a37){return function(_0x29482a){try{jsonpatch[_0xc956('0x24')](_0x29482a,_0x239a37,!![]);}catch(_0x5db31b){return BPromise[_0xc956('0x25')](_0x5db31b);}return _0x29482a[_0xc956('0x26')]();};}function saveUpdates(_0x1823ab,_0x55cb0d){return function(_0x5b4c26){if(_0x5b4c26){return _0x5b4c26['update'](_0x1823ab)[_0xc956('0x27')](function(_0x1f1e39){return _0x1f1e39;});}return null;};}function removeEntity(_0x44e736,_0x122807){return function(_0x35b67c){if(_0x35b67c){return _0x35b67c['destroy']()[_0xc956('0x27')](function(){var _0x65e9b6=_0x35b67c[_0xc956('0x28')]({'plain':!![]});var _0x5dfb17=[{'name':'InboundRoutes','value':_0xc956('0x29'),'ignore':![]},{'name':_0xc956('0x2a'),'value':_0xc956('0x2b'),'ignore':![]},{'name':_0xc956('0x2c'),'value':_0xc956('0x2d'),'ignore':![]}];var _0x403573=_(_0x5dfb17)[_0xc956('0x2e')]('ignore')[_0xc956('0x2f')](_0xc956('0x30'))[_0xc956('0x30')]();if(_[_0xc956('0x31')](_0x403573,_0x65e9b6[_0xc956('0x32')])){return;}var _0x3ebc82=_[_0xc956('0x33')](_0x5dfb17,[_0xc956('0x30'),_0x65e9b6[_0xc956('0x32')]])[_0xc956('0x34')];return db[_0xc956('0x35')][_0xc956('0x36')]({'where':{'type':_0x3ebc82,'resourceId':_0x65e9b6['id']}})[_0xc956('0x27')](function(){return _0x35b67c;});})[_0xc956('0x27')](function(){_0x44e736['status'](0xcc)[_0xc956('0x1b')]();});}};}function handleEntityNotFound(_0x2325c1,_0x2714d7){return function(_0x3809b7){if(!_0x3809b7){_0x2325c1[_0xc956('0x1a')](0x194);}return _0x3809b7;};}function handleError(_0x35f105,_0x1021df){_0x1021df=_0x1021df||0x1f4;return function(_0x21b8e2){logger['error'](_0x21b8e2[_0xc956('0x37')]);if(_0x21b8e2[_0xc956('0x34')]){delete _0x21b8e2[_0xc956('0x34')];}_0x35f105[_0xc956('0x21')](_0x1021df)[_0xc956('0x38')](_0x21b8e2);};}exports[_0xc956('0x39')]=function(_0x1cdacf,_0x1fb1cb){var _0x3ffcc9={},_0xa6fa02={},_0x1c340f={'count':0x0,'rows':[]};var _0xb401b2=_[_0xc956('0x2f')](db[_0xc956('0x3a')][_0xc956('0x3b')],function(_0x35c634){return{'name':_0x35c634[_0xc956('0x3c')],'type':_0x35c634[_0xc956('0x32')]['key']};});_0xa6fa02[_0xc956('0x3d')]=_[_0xc956('0x2f')](_0xb401b2,'name');_0xa6fa02[_0xc956('0x3e')]=_['keys'](_0x1cdacf['query']);_0xa6fa02['filters']=_['intersection'](_0xa6fa02[_0xc956('0x3d')],_0xa6fa02[_0xc956('0x3e')]);_0x3ffcc9['attributes']=_[_0xc956('0x3f')](_0xa6fa02[_0xc956('0x3d')],qs[_0xc956('0x40')](_0x1cdacf[_0xc956('0x3e')][_0xc956('0x40')]));_0x3ffcc9[_0xc956('0x41')]=_0x3ffcc9[_0xc956('0x41')]['length']?_0x3ffcc9[_0xc956('0x41')]:_0xa6fa02[_0xc956('0x3d')];if(!_0x1cdacf['query'][_0xc956('0x42')](_0xc956('0x43'))){_0x3ffcc9[_0xc956('0x20')]=qs[_0xc956('0x20')](_0x1cdacf[_0xc956('0x3e')][_0xc956('0x20')]);_0x3ffcc9[_0xc956('0x1e')]=qs[_0xc956('0x1e')](_0x1cdacf['query'][_0xc956('0x1e')]);}_0x3ffcc9[_0xc956('0x44')]=qs[_0xc956('0x45')](_0x1cdacf[_0xc956('0x3e')][_0xc956('0x45')]);_0x3ffcc9['where']=qs[_0xc956('0x46')](_['pick'](_0x1cdacf['query'],_0xa6fa02[_0xc956('0x46')]),_0xb401b2);if(_0x1cdacf[_0xc956('0x3e')][_0xc956('0x2e')]){_0x3ffcc9['where']=_['merge'](_0x3ffcc9[_0xc956('0x47')],{'$or':_[_0xc956('0x2f')](_0xb401b2,function(_0x1eee6c){if(_0x1eee6c[_0xc956('0x32')]!==_0xc956('0x48')){var _0x321575={};_0x321575[_0x1eee6c[_0xc956('0x34')]]={'$like':'%'+_0x1cdacf[_0xc956('0x3e')][_0xc956('0x2e')]+'%'};return _0x321575;}})});}_0x3ffcc9=_[_0xc956('0x49')]({},_0x3ffcc9,_0x1cdacf['options']);var _0x4b66d6={'where':_0x3ffcc9['where']};return db[_0xc956('0x3a')][_0xc956('0x1f')](_0x4b66d6)[_0xc956('0x27')](function(_0x399d84){_0x1c340f[_0xc956('0x1f')]=_0x399d84;if(_0x1cdacf[_0xc956('0x3e')][_0xc956('0x4a')]){_0x3ffcc9[_0xc956('0x4b')]=[{'all':!![]}];}return db[_0xc956('0x3a')][_0xc956('0x4c')](_0x3ffcc9);})[_0xc956('0x27')](function(_0x58ac66){_0x1c340f[_0xc956('0x4d')]=_0x58ac66;return _0x1c340f;})['then'](respondWithFilteredResult(_0x1fb1cb,_0x3ffcc9))[_0xc956('0x4e')](handleError(_0x1fb1cb,null));};exports[_0xc956('0x4f')]=function(_0x25407b,_0x5080cf){var _0x3b44f6={'raw':![],'where':{'id':_0x25407b[_0xc956('0x50')]['id']}},_0x39f8b5={};_0x39f8b5['model']=_[_0xc956('0x51')](db['VoiceExtension'][_0xc956('0x3b')]);_0x39f8b5[_0xc956('0x3e')]=_[_0xc956('0x51')](_0x25407b[_0xc956('0x3e')]);_0x39f8b5[_0xc956('0x46')]=_[_0xc956('0x3f')](_0x39f8b5[_0xc956('0x3d')],_0x39f8b5[_0xc956('0x3e')]);_0x3b44f6[_0xc956('0x41')]=_['intersection'](_0x39f8b5[_0xc956('0x3d')],qs['fields'](_0x25407b[_0xc956('0x3e')][_0xc956('0x40')]));_0x3b44f6[_0xc956('0x41')]=_0x3b44f6[_0xc956('0x41')][_0xc956('0x52')]?_0x3b44f6['attributes']:_0x39f8b5[_0xc956('0x3d')];if(_0x25407b[_0xc956('0x3e')][_0xc956('0x4a')]){_0x3b44f6[_0xc956('0x4b')]=[{'all':!![]}];}_0x3b44f6=_[_0xc956('0x49')]({},_0x3b44f6,_0x25407b[_0xc956('0x53')]);return db['VoiceExtension'][_0xc956('0x33')](_0x3b44f6)['then'](handleEntityNotFound(_0x5080cf,null))[_0xc956('0x27')](respondWithResult(_0x5080cf,null))[_0xc956('0x4e')](handleError(_0x5080cf,null));};exports[_0xc956('0x36')]=function(_0x3434fb,_0x12ccf3){return db['VoiceExtension']['find']({'where':{'id':_0x3434fb['params']['id']}})['then'](handleEntityNotFound(_0x12ccf3,null))[_0xc956('0x27')](removeEntity(_0x12ccf3,null))[_0xc956('0x4e')](handleError(_0x12ccf3,null));};exports[_0xc956('0x54')]=function(_0x3dba02,_0x370571){if(_0x3dba02['body'][_0xc956('0x32')]===_0xc956('0x2b')&&!_['startsWith'](_0x3dba02['body'][_0xc956('0x55')],'_')){_0x3dba02[_0xc956('0x56')]['exten']='_'[_0xc956('0x57')](_0x3dba02[_0xc956('0x56')][_0xc956('0x55')]);}return db[_0xc956('0x3a')][_0xc956('0x54')](_0x3dba02['body'],{'raw':![]})[_0xc956('0x27')](function(_0x3359db){var _0x2291d6=_0x3dba02[_0xc956('0x58')][_0xc956('0x28')]({'plain':!![]});if(!_0x2291d6)throw new Error(_0xc956('0x59'));if(_0x2291d6['role']===_0xc956('0x58')){var _0x2ac2e3=_0x3359db[_0xc956('0x28')]({'plain':!![]});var _0x4cae49=[{'name':_0xc956('0x5a'),'value':_0xc956('0x29')},{'name':_0xc956('0x2a'),'value':_0xc956('0x2b')},{'name':_0xc956('0x2c'),'value':_0xc956('0x2d')}];var _0x40314a=_[_0xc956('0x33')](_0x4cae49,['value',_0x2ac2e3[_0xc956('0x32')]])[_0xc956('0x34')];return db[_0xc956('0x5b')][_0xc956('0x33')]({'where':{'name':_0x40314a,'userProfileId':_0x2291d6[_0xc956('0x5c')]},'raw':!![]})['then'](function(_0x23087d){if(_0x23087d&&_0x23087d['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2ac2e3[_0xc956('0x34')],'resourceId':_0x2ac2e3['id'],'type':_0x23087d[_0xc956('0x34')],'sectionId':_0x23087d['id']},{})['then'](function(){return _0x3359db;});}else{return _0x3359db;}})[_0xc956('0x4e')](function(_0x2d311a){logger[_0xc956('0x5d')](_0xc956('0x5e'),_0x2d311a);throw _0x2d311a;});}return _0x3359db;})['then'](respondWithResult(_0x370571,0xc9))['catch'](handleError(_0x370571,null));};exports[_0xc956('0x5f')]=function(_0x293020,_0x59209c){if(_0x293020['body']['id']){delete _0x293020[_0xc956('0x56')]['id'];}return db[_0xc956('0x3a')]['find']({'where':{'id':_0x293020[_0xc956('0x50')]['id']}})['then'](handleEntityNotFound(_0x59209c,null))[_0xc956('0x27')](function(_0x1ed222){if(_0x1ed222){return db[_0xc956('0x3a')][_0xc956('0x5f')](_[_0xc956('0x60')](_0x293020['body'],['exten','context',_0xc956('0x61'),_0xc956('0x62'),'cutdigits','mandatoryDisposition',_0xc956('0x63')]),{'where':{'context':_0x1ed222['context'],'exten':_0x1ed222[_0xc956('0x55')]},'individualHooks':!![]})[_0xc956('0x27')](function(_0x201d42){return _0x201d42;});}return null;})[_0xc956('0x27')](respondWithStatusCode(_0x59209c,null))[_0xc956('0x4e')](handleError(_0x59209c,null));};exports[_0xc956('0x64')]=function(_0x4ad2a4,_0x4b06dd){return db['VoiceExtension'][_0xc956('0x65')]({'where':{'id':_0x4ad2a4[_0xc956('0x50')]['id']}})[_0xc956('0x27')](function(_0x32fe5c){if(_0x32fe5c){return db[_0xc956('0x66')][_0xc956('0x67')](function(_0x59e36f){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x4ad2a4[_0xc956('0x50')]['id']},'transaction':_0x59e36f})[_0xc956('0x27')](function(){var _0x14d855=_['map'](_0x4ad2a4['body'],function(_0x1df02c){_0x1df02c[_0xc956('0x68')]=_0x4ad2a4[_0xc956('0x50')]['id'];_0x1df02c['isApp']=!![];return _0x1df02c;});var _0x118a70=_0x4ad2a4['query']['rewriteDial']&&_0x4ad2a4['query'][_0xc956('0x69')][_0xc956('0x6a')]()===_0xc956('0x6b')?!![]:![];return _0x32fe5c['createRouting'](_0x14d855,_0x118a70);})[_0xc956('0x27')](function(_0x4e1ce0){return db[_0xc956('0x3a')][_0xc956('0x6c')](_0x4e1ce0,{'transaction':_0x59e36f});});})[_0xc956('0x27')](function(){return db[_0xc956('0x3a')][_0xc956('0x6d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4ad2a4['params']['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xc956('0x27')](respondWithResult(_0x4b06dd,null))[_0xc956('0x4e')](handleError(_0x4b06dd,null));}; \ No newline at end of file +var _0xb08e=['socket.io-emitter','register','sendStatus','end','json','limit','undefined','count','offset','status','set','reject','update','then','destroy','get','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','error','stack','VoiceExtension','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','cutdigits','mandatoryDisposition','alias','addApplications','findOne','sequelize','transaction','VoiceExtensionId','isApp','rewriteDial','true','bulkCreate','rimraf','zip-dir','request-promise','moment','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0xb08e,0x187));var _0xeb08=function(_0x5794c4,_0x309b7a){_0x5794c4=_0x5794c4-0x0;var _0x537506=_0xb08e[_0x5794c4];return _0x537506;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb08('0x0'));var zipdir=require(_0xeb08('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb08('0x2'));var moment=require(_0xeb08('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xeb08('0x4'));var sox=require(_0xeb08('0x5'));var csv=require('to-csv');var ejs=require(_0xeb08('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeb08('0x7'));var crypto=require(_0xeb08('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xeb08('0x9'));var toCsv=require(_0xeb08('0xa'));var querystring=require(_0xeb08('0xb'));var Papa=require(_0xeb08('0xc'));var Redis=require(_0xeb08('0xd'));var authService=require(_0xeb08('0xe'));var qs=require(_0xeb08('0xf'));var as=require(_0xeb08('0x10'));var hardwareService=require(_0xeb08('0x11'));var logger=require(_0xeb08('0x12'))('api');var utils=require(_0xeb08('0x13'));var config=require(_0xeb08('0x14'));var licenseUtil=require(_0xeb08('0x15'));var db=require(_0xeb08('0x16'))['db'];config[_0xeb08('0x17')]=_[_0xeb08('0x18')](config[_0xeb08('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb08('0x19'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xeb08('0x1a')](socket);function respondWithStatusCode(_0x25d933,_0x6172c3){_0x6172c3=_0x6172c3||0xcc;return function(_0x2332b9){if(_0x2332b9){return _0x25d933[_0xeb08('0x1b')](_0x6172c3);}return _0x25d933['status'](_0x6172c3)[_0xeb08('0x1c')]();};}function respondWithResult(_0x313d43,_0x187fdc){_0x187fdc=_0x187fdc||0xc8;return function(_0xa0f387){if(_0xa0f387){return _0x313d43['status'](_0x187fdc)[_0xeb08('0x1d')](_0xa0f387);}};}function respondWithFilteredResult(_0x1e0a51,_0x41ddc3){return function(_0x67af63){if(_0x67af63){var _0x51ba69=typeof _0x41ddc3['offset']==='undefined'&&typeof _0x41ddc3[_0xeb08('0x1e')]===_0xeb08('0x1f');var _0x343959=_0x67af63[_0xeb08('0x20')];var _0x2e9529=_0x51ba69?0x0:_0x41ddc3[_0xeb08('0x21')];var _0x380c5a=_0x51ba69?_0x67af63[_0xeb08('0x20')]:_0x41ddc3[_0xeb08('0x21')]+_0x41ddc3[_0xeb08('0x1e')];var _0x2e5032;if(_0x380c5a>=_0x343959){_0x380c5a=_0x343959;_0x2e5032=0xc8;}else{_0x2e5032=0xce;}_0x1e0a51[_0xeb08('0x22')](_0x2e5032);return _0x1e0a51[_0xeb08('0x23')]('Content-Range',_0x2e9529+'-'+_0x380c5a+'/'+_0x343959)['json'](_0x67af63);}return null;};}function patchUpdates(_0x33c7aa){return function(_0x88da66){try{jsonpatch['apply'](_0x88da66,_0x33c7aa,!![]);}catch(_0x1d3dea){return BPromise[_0xeb08('0x24')](_0x1d3dea);}return _0x88da66['save']();};}function saveUpdates(_0x3c77df,_0x3fdfba){return function(_0x4308c7){if(_0x4308c7){return _0x4308c7[_0xeb08('0x25')](_0x3c77df)[_0xeb08('0x26')](function(_0x1f696d){return _0x1f696d;});}return null;};}function removeEntity(_0x5d7424,_0x326061){return function(_0x3c9f49){if(_0x3c9f49){return _0x3c9f49[_0xeb08('0x27')]()[_0xeb08('0x26')](function(){var _0x5c737e=_0x3c9f49[_0xeb08('0x28')]({'plain':!![]});var _0x37fb33=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0xeb08('0x29'),'value':_0xeb08('0x2a'),'ignore':![]},{'name':_0xeb08('0x2b'),'value':_0xeb08('0x2c'),'ignore':![]}];var _0x154810=_(_0x37fb33)[_0xeb08('0x2d')](_0xeb08('0x2e'))[_0xeb08('0x2f')]('value')[_0xeb08('0x30')]();if(_[_0xeb08('0x31')](_0x154810,_0x5c737e[_0xeb08('0x32')])){return;}var _0x406319=_[_0xeb08('0x33')](_0x37fb33,[_0xeb08('0x30'),_0x5c737e[_0xeb08('0x32')]])[_0xeb08('0x34')];return db['UserProfileResource'][_0xeb08('0x27')]({'where':{'type':_0x406319,'resourceId':_0x5c737e['id']}})[_0xeb08('0x26')](function(){return _0x3c9f49;});})['then'](function(){_0x5d7424['status'](0xcc)[_0xeb08('0x1c')]();});}};}function handleEntityNotFound(_0x37f0a6,_0x4b5432){return function(_0x4a154a){if(!_0x4a154a){_0x37f0a6['sendStatus'](0x194);}return _0x4a154a;};}function handleError(_0x571ab1,_0x497f03){_0x497f03=_0x497f03||0x1f4;return function(_0x2965f1){logger[_0xeb08('0x35')](_0x2965f1[_0xeb08('0x36')]);if(_0x2965f1['name']){delete _0x2965f1[_0xeb08('0x34')];}_0x571ab1[_0xeb08('0x22')](_0x497f03)['send'](_0x2965f1);};}exports['index']=function(_0x180e3d,_0x2bd8e3){var _0x1c4907={},_0x264f3f={},_0xa2a73c={'count':0x0,'rows':[]};var _0x442be3=_[_0xeb08('0x2f')](db[_0xeb08('0x37')][_0xeb08('0x38')],function(_0x275701){return{'name':_0x275701[_0xeb08('0x39')],'type':_0x275701[_0xeb08('0x32')][_0xeb08('0x3a')]};});_0x264f3f['model']=_[_0xeb08('0x2f')](_0x442be3,_0xeb08('0x34'));_0x264f3f[_0xeb08('0x3b')]=_[_0xeb08('0x3c')](_0x180e3d[_0xeb08('0x3b')]);_0x264f3f['filters']=_[_0xeb08('0x3d')](_0x264f3f[_0xeb08('0x3e')],_0x264f3f[_0xeb08('0x3b')]);_0x1c4907[_0xeb08('0x3f')]=_[_0xeb08('0x3d')](_0x264f3f[_0xeb08('0x3e')],qs[_0xeb08('0x40')](_0x180e3d[_0xeb08('0x3b')][_0xeb08('0x40')]));_0x1c4907[_0xeb08('0x3f')]=_0x1c4907[_0xeb08('0x3f')][_0xeb08('0x41')]?_0x1c4907['attributes']:_0x264f3f[_0xeb08('0x3e')];if(!_0x180e3d[_0xeb08('0x3b')]['hasOwnProperty'](_0xeb08('0x42'))){_0x1c4907[_0xeb08('0x1e')]=qs['limit'](_0x180e3d['query'][_0xeb08('0x1e')]);_0x1c4907[_0xeb08('0x21')]=qs[_0xeb08('0x21')](_0x180e3d[_0xeb08('0x3b')]['offset']);}_0x1c4907['order']=qs[_0xeb08('0x43')](_0x180e3d[_0xeb08('0x3b')][_0xeb08('0x43')]);_0x1c4907[_0xeb08('0x44')]=qs['filters'](_[_0xeb08('0x45')](_0x180e3d[_0xeb08('0x3b')],_0x264f3f[_0xeb08('0x46')]),_0x442be3);if(_0x180e3d[_0xeb08('0x3b')][_0xeb08('0x2d')]){_0x1c4907['where']=_[_0xeb08('0x47')](_0x1c4907[_0xeb08('0x44')],{'$or':_[_0xeb08('0x2f')](_0x442be3,function(_0x538b30){if(_0x538b30['type']!==_0xeb08('0x48')){var _0x1f9f1b={};_0x1f9f1b[_0x538b30[_0xeb08('0x34')]]={'$like':'%'+_0x180e3d['query'][_0xeb08('0x2d')]+'%'};return _0x1f9f1b;}})});}_0x1c4907=_[_0xeb08('0x47')]({},_0x1c4907,_0x180e3d[_0xeb08('0x49')]);var _0x5c7019={'where':_0x1c4907['where']};return db[_0xeb08('0x37')]['count'](_0x5c7019)['then'](function(_0x596b10){_0xa2a73c[_0xeb08('0x20')]=_0x596b10;if(_0x180e3d[_0xeb08('0x3b')][_0xeb08('0x4a')]){_0x1c4907[_0xeb08('0x4b')]=[{'all':!![]}];}return db[_0xeb08('0x37')][_0xeb08('0x4c')](_0x1c4907);})['then'](function(_0x1dfeff){_0xa2a73c[_0xeb08('0x4d')]=_0x1dfeff;return _0xa2a73c;})[_0xeb08('0x26')](respondWithFilteredResult(_0x2bd8e3,_0x1c4907))['catch'](handleError(_0x2bd8e3,null));};exports[_0xeb08('0x4e')]=function(_0x3daaad,_0x535494){var _0xe430e={'raw':![],'where':{'id':_0x3daaad[_0xeb08('0x4f')]['id']}},_0x50c43f={};_0x50c43f[_0xeb08('0x3e')]=_[_0xeb08('0x3c')](db['VoiceExtension']['rawAttributes']);_0x50c43f[_0xeb08('0x3b')]=_[_0xeb08('0x3c')](_0x3daaad[_0xeb08('0x3b')]);_0x50c43f[_0xeb08('0x46')]=_['intersection'](_0x50c43f['model'],_0x50c43f['query']);_0xe430e[_0xeb08('0x3f')]=_[_0xeb08('0x3d')](_0x50c43f[_0xeb08('0x3e')],qs[_0xeb08('0x40')](_0x3daaad[_0xeb08('0x3b')][_0xeb08('0x40')]));_0xe430e[_0xeb08('0x3f')]=_0xe430e[_0xeb08('0x3f')][_0xeb08('0x41')]?_0xe430e[_0xeb08('0x3f')]:_0x50c43f[_0xeb08('0x3e')];if(_0x3daaad[_0xeb08('0x3b')][_0xeb08('0x4a')]){_0xe430e[_0xeb08('0x4b')]=[{'all':!![]}];}_0xe430e=_['merge']({},_0xe430e,_0x3daaad[_0xeb08('0x49')]);return db['VoiceExtension'][_0xeb08('0x33')](_0xe430e)[_0xeb08('0x26')](handleEntityNotFound(_0x535494,null))[_0xeb08('0x26')](respondWithResult(_0x535494,null))[_0xeb08('0x50')](handleError(_0x535494,null));};exports['destroy']=function(_0xf4d76e,_0x6a92e){return db[_0xeb08('0x37')][_0xeb08('0x33')]({'where':{'id':_0xf4d76e[_0xeb08('0x4f')]['id']}})['then'](handleEntityNotFound(_0x6a92e,null))['then'](removeEntity(_0x6a92e,null))[_0xeb08('0x50')](handleError(_0x6a92e,null));};exports[_0xeb08('0x51')]=function(_0x4d87c1,_0x3a8297){if(_0x4d87c1[_0xeb08('0x52')][_0xeb08('0x32')]===_0xeb08('0x2a')&&!_['startsWith'](_0x4d87c1[_0xeb08('0x52')][_0xeb08('0x53')],'_')){_0x4d87c1[_0xeb08('0x52')][_0xeb08('0x53')]='_'[_0xeb08('0x54')](_0x4d87c1[_0xeb08('0x52')]['exten']);}return db[_0xeb08('0x37')][_0xeb08('0x51')](_0x4d87c1[_0xeb08('0x52')],{'raw':![]})[_0xeb08('0x26')](function(_0x1b256e){var _0x3ded81=_0x4d87c1[_0xeb08('0x55')]['get']({'plain':!![]});if(!_0x3ded81)throw new Error(_0xeb08('0x56'));if(_0x3ded81['role']===_0xeb08('0x55')){var _0x3f11b2=_0x1b256e['get']({'plain':!![]});var _0x4e6048=[{'name':'InboundRoutes','value':_0xeb08('0x57')},{'name':_0xeb08('0x29'),'value':_0xeb08('0x2a')},{'name':_0xeb08('0x2b'),'value':_0xeb08('0x2c')}];var _0x1ff87a=_[_0xeb08('0x33')](_0x4e6048,[_0xeb08('0x30'),_0x3f11b2[_0xeb08('0x32')]])[_0xeb08('0x34')];return db['UserProfileSection'][_0xeb08('0x33')]({'where':{'name':_0x1ff87a,'userProfileId':_0x3ded81[_0xeb08('0x58')]},'raw':!![]})[_0xeb08('0x26')](function(_0x8680a8){if(_0x8680a8&&_0x8680a8['autoAssociation']===0x0){return db[_0xeb08('0x59')][_0xeb08('0x51')]({'name':_0x3f11b2[_0xeb08('0x34')],'resourceId':_0x3f11b2['id'],'type':_0x8680a8[_0xeb08('0x34')],'sectionId':_0x8680a8['id']},{})[_0xeb08('0x26')](function(){return _0x1b256e;});}else{return _0x1b256e;}})[_0xeb08('0x50')](function(_0x293607){logger[_0xeb08('0x35')](_0xeb08('0x5a'),_0x293607);throw _0x293607;});}return _0x1b256e;})[_0xeb08('0x26')](respondWithResult(_0x3a8297,0xc9))[_0xeb08('0x50')](handleError(_0x3a8297,null));};exports[_0xeb08('0x25')]=function(_0x8a162f,_0x484fe6){if(_0x8a162f['body']['id']){delete _0x8a162f[_0xeb08('0x52')]['id'];}return db['VoiceExtension'][_0xeb08('0x33')]({'where':{'id':_0x8a162f[_0xeb08('0x4f')]['id']}})[_0xeb08('0x26')](handleEntityNotFound(_0x484fe6,null))[_0xeb08('0x26')](function(_0x5106bf){if(_0x5106bf){return db[_0xeb08('0x37')]['update'](_['pick'](_0x8a162f[_0xeb08('0x52')],[_0xeb08('0x53'),_0xeb08('0x5b'),'description','recordingFormat',_0xeb08('0x5c'),_0xeb08('0x5d'),_0xeb08('0x5e')]),{'where':{'context':_0x5106bf[_0xeb08('0x5b')],'exten':_0x5106bf[_0xeb08('0x53')]},'individualHooks':!![]})['then'](function(_0x2a3108){return _0x2a3108;});}return null;})[_0xeb08('0x26')](respondWithStatusCode(_0x484fe6,null))['catch'](handleError(_0x484fe6,null));};exports[_0xeb08('0x5f')]=function(_0x336687,_0x1aee48){return db[_0xeb08('0x37')][_0xeb08('0x60')]({'where':{'id':_0x336687['params']['id']}})[_0xeb08('0x26')](function(_0x1b74c0){if(_0x1b74c0){return db[_0xeb08('0x61')][_0xeb08('0x62')](function(_0x3022e8){return db[_0xeb08('0x37')][_0xeb08('0x27')]({'where':{'VoiceExtensionId':_0x336687[_0xeb08('0x4f')]['id']},'transaction':_0x3022e8})[_0xeb08('0x26')](function(){var _0x9c5036=_[_0xeb08('0x2f')](_0x336687[_0xeb08('0x52')],function(_0x575ac8){_0x575ac8[_0xeb08('0x63')]=_0x336687[_0xeb08('0x4f')]['id'];_0x575ac8[_0xeb08('0x64')]=!![];return _0x575ac8;});var _0x34bb69=_0x336687['query'][_0xeb08('0x65')]&&_0x336687[_0xeb08('0x3b')][_0xeb08('0x65')]['toLowerCase']()===_0xeb08('0x66')?!![]:![];return _0x1b74c0['createRouting'](_0x9c5036,_0x34bb69);})['then'](function(_0x366f08){return db[_0xeb08('0x37')][_0xeb08('0x67')](_0x366f08,{'transaction':_0x3022e8});});})[_0xeb08('0x26')](function(){return db[_0xeb08('0x37')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x336687[_0xeb08('0x4f')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xeb08('0x26')](respondWithResult(_0x1aee48,null))['catch'](handleError(_0x1aee48,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index b816b8c..e500d75 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 _0xdcf3=['hook','exports','events','../../mysqldb','save','remove','emit','hasOwnProperty'];(function(_0x440afd,_0x266a8f){var _0x580a07=function(_0x31367b){while(--_0x31367b){_0x440afd['push'](_0x440afd['shift']());}};_0x580a07(++_0x266a8f);}(_0xdcf3,0x9a));var _0x3dcf=function(_0x9d878e,_0x9b8f69){_0x9d878e=_0x9d878e-0x0;var _0x40d4a9=_0xdcf3[_0x9d878e];return _0x40d4a9;};'use strict';var EventEmitter=require(_0x3dcf('0x0'));var VoiceExtension=require(_0x3dcf('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3dcf('0x2'),'afterUpdate':'update','afterDestroy':_0x3dcf('0x3')};function emitEvent(_0x42324c){return function(_0x5b6795,_0x575ea8,_0x262e50){VoiceExtensionEvents['emit'](_0x42324c+':'+_0x5b6795['id'],_0x5b6795);VoiceExtensionEvents[_0x3dcf('0x4')](_0x42324c,_0x5b6795);_0x262e50(null);};}for(var e in events){if(events[_0x3dcf('0x5')](e)){var event=events[e];VoiceExtension[_0x3dcf('0x6')](e,emitEvent(event));}}module[_0x3dcf('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x19b7=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension'];(function(_0x3aef17,_0x1563c2){var _0x2ca07b=function(_0x45d548){while(--_0x45d548){_0x3aef17['push'](_0x3aef17['shift']());}};_0x2ca07b(++_0x1563c2);}(_0x19b7,0x179));var _0x719b=function(_0xa0996c,_0x3465fd){_0xa0996c=_0xa0996c-0x0;var _0x53db62=_0x19b7[_0xa0996c];return _0x53db62;};'use strict';var EventEmitter=require(_0x719b('0x0'));var VoiceExtension=require(_0x719b('0x1'))['db'][_0x719b('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x719b('0x3')](0x0);var events={'afterCreate':_0x719b('0x4'),'afterUpdate':_0x719b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x211797){return function(_0x22fc76,_0xe45db3,_0x50e4f9){VoiceExtensionEvents[_0x719b('0x6')](_0x211797+':'+_0x22fc76['id'],_0x22fc76);VoiceExtensionEvents[_0x719b('0x6')](_0x211797,_0x22fc76);_0x50e4f9(null);};}for(var e in events){if(events[_0x719b('0x7')](e)){var event=events[e];VoiceExtension[_0x719b('0x8')](e,emitEvent(event));}}module[_0x719b('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 8509ca4..caf5506 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 _0x024c=['catch','define','VoiceExtension','voice_extensions','Hangup','util','./voiceExtension.attributes','models','type','Set','context','alias','No\x20alias\x20set','push','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','exten','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','NoOp','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','options','url','split','length','trunk','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','intervals','map','filter','hasOwnProperty','tag','toLowerCase','CDR(tag)=','callerID','Set(CALLERID(all)=','answer','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat'];(function(_0x1706f5,_0xdcebbd){var _0x1b6ce4=function(_0x3a214e){while(--_0x3a214e){_0x1706f5['push'](_0x1706f5['shift']());}};_0x1b6ce4(++_0xdcebbd);}(_0x024c,0x19a));var _0xc024=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x024c[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xc024('0x0'));var _=require('lodash');var attributes=require(_0xc024('0x1'));module['exports']=function(_0x6ee970){var _0x201139=_0x6ee970[_0xc024('0x2')];function _0x50fcc3(_0x45e5dd){var _0x4e4da9=0x2;var _0x36cbc7=[{'type':_0x45e5dd[_0xc024('0x3')],'app':_0xc024('0x4'),'appdata':'CDR(type)='+_0x45e5dd[_0xc024('0x3')],'context':_0x45e5dd[_0xc024('0x5')],'exten':_0x45e5dd['exten'],'priority':_0x4e4da9++,'VoiceExtensionId':_0x45e5dd['id']},{'type':_0x45e5dd[_0xc024('0x3')],'app':_0x45e5dd[_0xc024('0x6')]?'Set':'NoOp','appdata':_0x45e5dd[_0xc024('0x6')]?'CDR(routeAlias)='+_0x45e5dd[_0xc024('0x6')]:_0xc024('0x7'),'context':_0x45e5dd[_0xc024('0x5')],'exten':_0x45e5dd['exten'],'priority':_0x4e4da9++,'VoiceExtensionId':_0x45e5dd['id']}];if(_0x45e5dd[_0xc024('0x3')]==='inbound'){_0x36cbc7[_0xc024('0x8')]({'type':_0xc024('0x9'),'app':_0xc024('0x4'),'appdata':_0xc024('0xa')+_0x45e5dd['id'],'context':_0x45e5dd[_0xc024('0x5')],'exten':_0x45e5dd['exten'],'priority':_0x4e4da9++,'VoiceExtensionId':_0x45e5dd['id']});}_0x36cbc7[_0xc024('0x8')]({'type':_0x45e5dd[_0xc024('0x3')],'app':'Set','appdata':_0xc024('0xb'),'context':_0x45e5dd[_0xc024('0x5')],'exten':_0x45e5dd[_0xc024('0xc')],'priority':_0x4e4da9++,'VoiceExtensionId':_0x45e5dd['id']},{'type':_0x45e5dd['type'],'app':'Set','appdata':_0xc024('0xd'),'context':_0x45e5dd['context'],'exten':_0x45e5dd[_0xc024('0xc')],'priority':_0x4e4da9++,'VoiceExtensionId':_0x45e5dd['id']},{'type':_0x45e5dd[_0xc024('0x3')],'app':_0xc024('0x4'),'appdata':_0xc024('0xe'),'context':_0x45e5dd['context'],'exten':_0x45e5dd['exten'],'priority':_0x4e4da9++,'VoiceExtensionId':_0x45e5dd['id']});return _0x36cbc7;}function _0x272196(_0xbcf717){var _0x2cc200=0x2;var _0x472721=[{'type':'outbound','app':_0xc024('0x4'),'appdata':_0xc024('0xf'),'context':_0xbcf717['context'],'exten':_0xbcf717[_0xc024('0xc')],'priority':_0x2cc200++,'VoiceExtensionId':_0xbcf717['id']},{'type':_0xc024('0x10'),'app':_0xbcf717[_0xc024('0x6')]?_0xc024('0x4'):_0xc024('0x11'),'appdata':_0xbcf717[_0xc024('0x6')]?_0xc024('0x12')+_0xbcf717['alias']:_0xc024('0x7'),'context':_0xbcf717['context'],'exten':_0xbcf717[_0xc024('0xc')],'priority':_0x2cc200++,'VoiceExtensionId':_0xbcf717['id']},{'type':_0xc024('0x10'),'app':_0xc024('0x4'),'appdata':_0xc024('0x13')+(_0xbcf717[_0xc024('0x14')]?_0xc024('0x15')+_0xbcf717['cutdigits']+'}':_0xc024('0x16')),'context':_0xbcf717['context'],'exten':_0xbcf717[_0xc024('0xc')],'priority':_0x2cc200++,'VoiceExtensionId':_0xbcf717['id']},{'type':_0xc024('0x10'),'app':_0xc024('0x4'),'appdata':'CDR(routeid)='+_0xbcf717['id'],'context':_0xbcf717[_0xc024('0x5')],'exten':_0xbcf717[_0xc024('0xc')],'priority':_0x2cc200++,'VoiceExtensionId':_0xbcf717['id']},{'type':'outbound','app':_0xc024('0x17'),'appdata':_0xc024('0x18')+(_0x2cc200+0x2)+_0xc024('0x19')+(_0x2cc200+0x1)+')','context':_0xbcf717['context'],'exten':_0xbcf717[_0xc024('0xc')],'priority':_0x2cc200++,'VoiceExtensionId':_0xbcf717['id']},{'type':_0xc024('0x10'),'app':'Set','appdata':_0xbcf717[_0xc024('0x14')]?'CDR(prefix)=${EXTEN:0:'+_0xbcf717[_0xc024('0x14')]+'}':_0xc024('0x1a'),'context':_0xbcf717[_0xc024('0x5')],'exten':_0xbcf717[_0xc024('0xc')],'priority':_0x2cc200++,'VoiceExtensionId':_0xbcf717['id']},{'type':'outbound','app':_0xc024('0x4'),'appdata':_0xc024('0xb'),'context':_0xbcf717[_0xc024('0x5')],'exten':_0xbcf717[_0xc024('0xc')],'priority':_0x2cc200++,'VoiceExtensionId':_0xbcf717['id']},{'type':_0xc024('0x10'),'app':_0xc024('0x4'),'appdata':_0xc024('0xd'),'context':_0xbcf717[_0xc024('0x5')],'exten':_0xbcf717['exten'],'priority':_0x2cc200++,'VoiceExtensionId':_0xbcf717['id']},{'type':_0xc024('0x10'),'app':_0xc024('0x4'),'appdata':_0xc024('0xe'),'context':_0xbcf717[_0xc024('0x5')],'exten':_0xbcf717['exten'],'priority':_0x2cc200++,'VoiceExtensionId':_0xbcf717['id']},{'type':_0xc024('0x10'),'app':'Set','appdata':'outboundrouteid='+_0xbcf717['id'],'context':_0xbcf717[_0xc024('0x5')],'exten':_0xbcf717[_0xc024('0xc')],'priority':_0x2cc200++,'VoiceExtensionId':_0xbcf717['id']}];if(_0xbcf717['hasOwnProperty'](_0xc024('0x1b'))&&_0xbcf717['recordingFormat']!==_0xc024('0x1c')){_0x472721[_0xc024('0x8')]({'type':_0xc024('0x10'),'app':_0xc024('0x4'),'appdata':_0xc024('0x1d'),'context':_0xbcf717[_0xc024('0x5')],'exten':_0xbcf717[_0xc024('0xc')],'priority':_0x2cc200++,'VoiceExtensionId':_0xbcf717['id']},{'type':_0xc024('0x10'),'app':_0xc024('0x4'),'appdata':_0xc024('0x1e')+_0xbcf717[_0xc024('0x1b')]||_0xc024('0x1f'),'context':_0xbcf717[_0xc024('0x5')],'exten':_0xbcf717[_0xc024('0xc')],'priority':_0x2cc200++,'VoiceExtensionId':_0xbcf717['id']});}return _0x472721;}function _0x2bbacd(_0x20f5c0){var _0x2833a6=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':_0xc024('0x20'),'param':0x2},{'name':_0xc024('0x21'),'param':0x3}];var _0x43e6f2={};var _0x1c7ffb=_0x20f5c0[_0xc024('0x22')](',');var _0x5ea10=[];for(var _0x38069e=0x0;_0x38069e<_0x2833a6[_0xc024('0x23')];_0x38069e++){switch(_0x2833a6[_0x38069e]['name']){case _0xc024('0x24'):_0x43e6f2[_0xc024('0x24')]=_0x1c7ffb[_0x2833a6[_0x38069e][_0xc024('0x25')]][_0xc024('0x22')]('/')[0x1];_0x43e6f2[_0xc024('0x26')]=_0x1c7ffb[_0x2833a6[_0x38069e][_0xc024('0x25')]][_0xc024('0x22')]('/')[0x2];_0x43e6f2[_0xc024('0x27')]=_0x43e6f2['phone']?_0x43e6f2[_0xc024('0x26')][_0xc024('0x22')]('$')[0x0]:undefined;_0x43e6f2[_0xc024('0x26')]=route[_0xc024('0x14')]?(_0x43e6f2[_0xc024('0x27')]||'')+_0xc024('0x15')+route['cutdigits']+'}':(_0x43e6f2['prefix']||'')+_0xc024('0x16');_0x5ea10[_0x2833a6[_0x38069e][_0xc024('0x25')]]=[_0xc024('0x28'),_0x43e6f2['trunk'],_0x43e6f2[_0xc024('0x26')]][_0xc024('0x29')]('/');break;case _0xc024('0x20'):_0x43e6f2[_0xc024('0x20')]=_0x1c7ffb[_0x2833a6[_0x38069e][_0xc024('0x25')]];if(route[_0xc024('0x1b')]!=='none'){if(_0x43e6f2[_0xc024('0x20')][_0xc024('0x2a')](_0xc024('0x2b'))<0x0){_0x43e6f2[_0xc024('0x20')]+=_0xc024('0x2b');}}else{_0x43e6f2[_0xc024('0x20')]=_0x43e6f2[_0xc024('0x20')][_0xc024('0x2c')](_0xc024('0x2b'),'');}_0x5ea10[_0x2833a6[_0x38069e][_0xc024('0x25')]]=_0x43e6f2[_0xc024('0x20')];break;default:_0x5ea10[_0x2833a6[_0x38069e][_0xc024('0x25')]]=_0x1c7ffb[_0x2833a6[_0x38069e]['param']];}}return _0x5ea10['join'](',');}function _0x2f91d5(_0x125abc,_0x4e0e42,_0x478658,_0x559a94){return new Promise(function(_0x178771,_0x2d5c75){var _0x4edc6b=[];if(_[_0xc024('0x2d')](_0x4e0e42))return _0x178771(_0x4edc6b);_0x201139[_0xc024('0x2e')][_0xc024('0x2f')]({'attributes':['id',_0xc024('0x30'),_0xc024('0x31')],'raw':!![]})[_0xc024('0x32')](function(_0x272b8a){for(var _0x594e8b=0x0,_0x40d80f=0x0;_0x594e8b<_0x4e0e42[_0xc024('0x23')];_0x594e8b++,_0x40d80f=0x0){var _0x4ea9b0=_0x4e0e42[_0x594e8b];var _0x589045=[];var _0x4fd337=[];if(_0x4ea9b0[_0xc024('0x30')]!=='*,*,*,*'){_0x4ea9b0[_0xc024('0x33')]=[_0x4ea9b0[_0xc024('0x30')]];}else{_0x4ea9b0[_0xc024('0x33')]=_0x4ea9b0['IntervalId']?_[_0xc024('0x34')](_[_0xc024('0x35')](_0x272b8a,{'IntervalId':_0x4ea9b0[_0xc024('0x31')]}),_0xc024('0x30')):[];}_0x4ea9b0['context']=_0x125abc[_0xc024('0x5')];_0x4ea9b0['exten']=_0x125abc['exten'];if(_0x4ea9b0[_0xc024('0x3')])_0x4ea9b0[_0xc024('0x3')]=_0x4ea9b0[_0xc024('0x3')]['toLowerCase']();if(_0x125abc[_0xc024('0x3')]==='outbound'){if(_0x4ea9b0[_0xc024('0x36')]('tag')&&_0x4ea9b0[_0xc024('0x37')]&&_0x4ea9b0['tag']!=='--'){_0x589045[_0xc024('0x8')]({'type':_0x4ea9b0[_0xc024('0x3')][_0xc024('0x38')](),'app':_0xc024('0x4'),'appdata':_0xc024('0x39')+_0x4ea9b0[_0xc024('0x37')],'context':_0x125abc['context'],'exten':_0x125abc[_0xc024('0xc')],'priority':_0x4ea9b0[_0xc024('0x33')][_0xc024('0x23')]+_0x478658+_0x40d80f++,'VoiceExtensionId':_0x125abc['id']});}_0x589045[_0xc024('0x8')]({'type':_0x4ea9b0[_0xc024('0x3')][_0xc024('0x38')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x4ea9b0[_0xc024('0x3a')]?_0xc024('0x3b')+_0x4ea9b0[_0xc024('0x3a')]+')':'NoOp(No\x20number\x20available)'),'context':_0x125abc[_0xc024('0x5')],'exten':_0x125abc['exten'],'priority':_0x4ea9b0[_0xc024('0x33')][_0xc024('0x23')]+_0x478658+_0x40d80f++,'VoiceExtensionId':_0x125abc['id']});}else{if(_0x4ea9b0['hasOwnProperty'](_0xc024('0x3c'))){if(['queue','playback'][_0xc024('0x3d')](_0x4ea9b0[_0xc024('0x3e')][_0xc024('0x38')]())&&_0x4ea9b0[_0xc024('0x3f')]!=='custom'){if(_0x4ea9b0[_0xc024('0x3c')]){_0x589045[_0xc024('0x8')]({'type':_0x4ea9b0[_0xc024('0x3')][_0xc024('0x38')](),'app':_0xc024('0x17'),'appdata':_0xc024('0x40'),'context':_0x125abc[_0xc024('0x5')],'exten':_0x125abc[_0xc024('0xc')],'priority':_0x4ea9b0[_0xc024('0x33')][_0xc024('0x23')]+_0x478658+_0x40d80f++,'VoiceExtensionId':_0x125abc['id']});_0x589045[_0xc024('0x8')]({'type':_0x4ea9b0[_0xc024('0x3')][_0xc024('0x38')](),'app':_0xc024('0x4'),'appdata':_0xc024('0x41'),'context':_0x125abc[_0xc024('0x5')],'exten':_0x125abc[_0xc024('0xc')],'priority':_0x4ea9b0[_0xc024('0x33')]['length']+_0x478658+_0x40d80f++,'VoiceExtensionId':_0x125abc['id']});}else{_0x589045[_0xc024('0x8')]({'type':_0x4ea9b0[_0xc024('0x3')][_0xc024('0x38')](),'app':_0xc024('0x17'),'appdata':_0xc024('0x42'),'context':_0x125abc[_0xc024('0x5')],'exten':_0x125abc['exten'],'priority':_0x4ea9b0[_0xc024('0x33')][_0xc024('0x23')]+_0x478658+_0x40d80f++,'VoiceExtensionId':_0x125abc['id']});_0x589045[_0xc024('0x8')]({'type':_0x4ea9b0[_0xc024('0x3')][_0xc024('0x38')](),'app':_0xc024('0x4'),'appdata':_0xc024('0x43'),'context':_0x125abc[_0xc024('0x5')],'exten':_0x125abc[_0xc024('0xc')],'priority':_0x4ea9b0[_0xc024('0x33')]['length']+_0x478658+_0x40d80f++,'VoiceExtensionId':_0x125abc['id']});}}}}for(var _0x2bae3a=0x0;_0x2bae3a<_0x4ea9b0['intervals'][_0xc024('0x23')];_0x2bae3a++){var _0xa2def2=_0x478658+_0x4ea9b0[_0xc024('0x33')][_0xc024('0x23')];var _0x477cc1=_0x2bae3a===_0x4ea9b0[_0xc024('0x33')][_0xc024('0x23')]-0x1?_0x478658+_0x589045[_0xc024('0x23')]+_0x4fd337[_0xc024('0x23')]+0x2:_0x478658+_0x2bae3a+0x1;_0x589045[_0xc024('0x44')](_0x2bae3a,0x0,{'type':_0x125abc['type'],'app':_0xc024('0x45'),'appdata':_0x4ea9b0[_0xc024('0x33')][_0x2bae3a]+'?'+_0x125abc[_0xc024('0x5')]+_0xc024('0x46')+_0xa2def2+':'+_0x125abc[_0xc024('0x5')]+_0xc024('0x46')+_0x477cc1,'exten':_0x125abc[_0xc024('0xc')],'context':_0x125abc[_0xc024('0x5')],'priority':_0x478658+_0x2bae3a,'VoiceExtensionId':_0x125abc['id']});}if(_0x559a94&&_0x4ea9b0[_0xc024('0x3f')]===_0xc024('0x47'))_0x4ea9b0[_0xc024('0x48')]=_0x2bbacd(_0x4ea9b0['appdata']);_0x4ea9b0[_0xc024('0x49')]=_0x589045[_0xc024('0x23')]?_[_0xc024('0x4a')](_0x589045)['priority']+0x1:_0x478658;_0x4edc6b=_[_0xc024('0x4b')](_0x4edc6b,_0x589045,[_0x4ea9b0],_0x4fd337);_0x478658=_['last'](_0x4edc6b)[_0xc024('0x49')]+0x1;}return _0x178771(_0x4edc6b);})[_0xc024('0x4c')](function(_0xa8b093){_0x2d5c75(_0xa8b093);});});}return _0x6ee970[_0xc024('0x4d')](_0xc024('0x4e'),attributes,{'tableName':_0xc024('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x12dbea,_0x130017){var _0x31baf7=this;var _0x23ed13=_0x31baf7['type']===_0xc024('0x10')?_0x272196(_0x31baf7):_0x50fcc3(_0x31baf7);return _0x2f91d5(_0x31baf7,_0x12dbea,_[_0xc024('0x4a')](_0x23ed13)[_0xc024('0x49')]+0x1,_0x130017)[_0xc024('0x32')](function(_0x5f48e){var _0x15a7db=_[_0xc024('0x4b')](_0x23ed13,_0x5f48e);_0x15a7db[_0xc024('0x8')]({'type':_0x31baf7[_0xc024('0x3')],'app':_0xc024('0x50'),'exten':_0x31baf7['exten'],'context':_0x31baf7[_0xc024('0x5')],'priority':_[_0xc024('0x4a')](_0x15a7db)[_0xc024('0x49')]+0x1,'VoiceExtensionId':_0x31baf7['id']});return _0x15a7db;});}}});}; \ No newline at end of file +var _0xb6d3=['CDR(tag)=','toLowerCase','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','outboundDial','appdata','priority','concat','catch','define','voice_extensions','last','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','outbound','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','param','phone','prefix','${EXTEN}','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','filter','tag'];(function(_0x2ca0ff,_0x4251fc){var _0x1b5cc0=function(_0x2a1300){while(--_0x2a1300){_0x2ca0ff['push'](_0x2ca0ff['shift']());}};_0x1b5cc0(++_0x4251fc);}(_0xb6d3,0x161));var _0x3b6d=function(_0xdcc3c2,_0xa52871){_0xdcc3c2=_0xdcc3c2-0x0;var _0x4862e9=_0xb6d3[_0xdcc3c2];return _0x4862e9;};'use strict';var util=require('util');var _=require(_0x3b6d('0x0'));var attributes=require(_0x3b6d('0x1'));module[_0x3b6d('0x2')]=function(_0x2a0181){var _0x3ca0ee=_0x2a0181[_0x3b6d('0x3')];function _0x2b6b82(_0x4d323f){var _0x4e2d5a=0x2;var _0x7a5ea4=[{'type':_0x4d323f[_0x3b6d('0x4')],'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x6')+_0x4d323f[_0x3b6d('0x4')],'context':_0x4d323f[_0x3b6d('0x7')],'exten':_0x4d323f[_0x3b6d('0x8')],'priority':_0x4e2d5a++,'VoiceExtensionId':_0x4d323f['id']},{'type':_0x4d323f[_0x3b6d('0x4')],'app':_0x4d323f['alias']?_0x3b6d('0x5'):_0x3b6d('0x9'),'appdata':_0x4d323f[_0x3b6d('0xa')]?_0x3b6d('0xb')+_0x4d323f['alias']:_0x3b6d('0xc'),'context':_0x4d323f[_0x3b6d('0x7')],'exten':_0x4d323f['exten'],'priority':_0x4e2d5a++,'VoiceExtensionId':_0x4d323f['id']}];if(_0x4d323f[_0x3b6d('0x4')]===_0x3b6d('0xd')){_0x7a5ea4[_0x3b6d('0xe')]({'type':_0x3b6d('0xd'),'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0xf')+_0x4d323f['id'],'context':_0x4d323f[_0x3b6d('0x7')],'exten':_0x4d323f['exten'],'priority':_0x4e2d5a++,'VoiceExtensionId':_0x4d323f['id']});}_0x7a5ea4[_0x3b6d('0xe')]({'type':_0x4d323f[_0x3b6d('0x4')],'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x10'),'context':_0x4d323f[_0x3b6d('0x7')],'exten':_0x4d323f[_0x3b6d('0x8')],'priority':_0x4e2d5a++,'VoiceExtensionId':_0x4d323f['id']},{'type':_0x4d323f[_0x3b6d('0x4')],'app':_0x3b6d('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4d323f[_0x3b6d('0x7')],'exten':_0x4d323f[_0x3b6d('0x8')],'priority':_0x4e2d5a++,'VoiceExtensionId':_0x4d323f['id']},{'type':_0x4d323f[_0x3b6d('0x4')],'app':_0x3b6d('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4d323f[_0x3b6d('0x7')],'exten':_0x4d323f[_0x3b6d('0x8')],'priority':_0x4e2d5a++,'VoiceExtensionId':_0x4d323f['id']});return _0x7a5ea4;}function _0x50024c(_0x34010a){var _0x23dfa2=0x2;var _0x1e27e8=[{'type':'outbound','app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x11'),'context':_0x34010a[_0x3b6d('0x7')],'exten':_0x34010a[_0x3b6d('0x8')],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':'outbound','app':_0x34010a['alias']?'Set':_0x3b6d('0x9'),'appdata':_0x34010a[_0x3b6d('0xa')]?'CDR(routeAlias)='+_0x34010a[_0x3b6d('0xa')]:_0x3b6d('0xc'),'context':_0x34010a['context'],'exten':_0x34010a[_0x3b6d('0x8')],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':'outbound','app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x12')+(_0x34010a[_0x3b6d('0x13')]?_0x3b6d('0x14')+_0x34010a[_0x3b6d('0x13')]+'}':'${EXTEN}'),'context':_0x34010a[_0x3b6d('0x7')],'exten':_0x34010a[_0x3b6d('0x8')],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':_0x3b6d('0x15'),'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0xf')+_0x34010a['id'],'context':_0x34010a[_0x3b6d('0x7')],'exten':_0x34010a['exten'],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':_0x3b6d('0x15'),'app':_0x3b6d('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x23dfa2+0x2)+_0x3b6d('0x17')+(_0x23dfa2+0x1)+')','context':_0x34010a[_0x3b6d('0x7')],'exten':_0x34010a[_0x3b6d('0x8')],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':_0x3b6d('0x15'),'app':_0x3b6d('0x5'),'appdata':_0x34010a[_0x3b6d('0x13')]?_0x3b6d('0x18')+_0x34010a[_0x3b6d('0x13')]+'}':_0x3b6d('0x19'),'context':_0x34010a['context'],'exten':_0x34010a[_0x3b6d('0x8')],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':_0x3b6d('0x15'),'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x10'),'context':_0x34010a[_0x3b6d('0x7')],'exten':_0x34010a['exten'],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':_0x3b6d('0x15'),'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x1a'),'context':_0x34010a[_0x3b6d('0x7')],'exten':_0x34010a['exten'],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':_0x3b6d('0x15'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x34010a['context'],'exten':_0x34010a['exten'],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':_0x3b6d('0x15'),'app':_0x3b6d('0x5'),'appdata':'outboundrouteid='+_0x34010a['id'],'context':_0x34010a[_0x3b6d('0x7')],'exten':_0x34010a[_0x3b6d('0x8')],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']}];if(_0x34010a[_0x3b6d('0x1b')](_0x3b6d('0x1c'))&&_0x34010a[_0x3b6d('0x1c')]!=='none'){_0x1e27e8[_0x3b6d('0xe')]({'type':_0x3b6d('0x15'),'app':_0x3b6d('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x34010a['context'],'exten':_0x34010a['exten'],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':_0x3b6d('0x15'),'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x1d')+_0x34010a[_0x3b6d('0x1c')]||_0x3b6d('0x1e'),'context':_0x34010a[_0x3b6d('0x7')],'exten':_0x34010a[_0x3b6d('0x8')],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']});}return _0x1e27e8;}function _0x1680b2(_0x83293d){var _0x3674a9=[{'name':_0x3b6d('0x1f'),'param':0x0},{'name':_0x3b6d('0x20'),'param':0x1},{'name':_0x3b6d('0x21'),'param':0x2},{'name':_0x3b6d('0x22'),'param':0x3}];var _0x497007={};var _0x64830e=_0x83293d[_0x3b6d('0x23')](',');var _0x19dda5=[];for(var _0x2dffb2=0x0;_0x2dffb2<_0x3674a9[_0x3b6d('0x24')];_0x2dffb2++){switch(_0x3674a9[_0x2dffb2]['name']){case _0x3b6d('0x1f'):_0x497007[_0x3b6d('0x1f')]=_0x64830e[_0x3674a9[_0x2dffb2][_0x3b6d('0x25')]][_0x3b6d('0x23')]('/')[0x1];_0x497007[_0x3b6d('0x26')]=_0x64830e[_0x3674a9[_0x2dffb2][_0x3b6d('0x25')]][_0x3b6d('0x23')]('/')[0x2];_0x497007['prefix']=_0x497007['phone']?_0x497007[_0x3b6d('0x26')][_0x3b6d('0x23')]('$')[0x0]:undefined;_0x497007['phone']=route['cutdigits']?(_0x497007[_0x3b6d('0x27')]||'')+_0x3b6d('0x14')+route[_0x3b6d('0x13')]+'}':(_0x497007[_0x3b6d('0x27')]||'')+_0x3b6d('0x28');_0x19dda5[_0x3674a9[_0x2dffb2][_0x3b6d('0x25')]]=[_0x3b6d('0x29'),_0x497007['trunk'],_0x497007['phone']][_0x3b6d('0x2a')]('/');break;case'options':_0x497007[_0x3b6d('0x21')]=_0x64830e[_0x3674a9[_0x2dffb2][_0x3b6d('0x25')]];if(route['recordingFormat']!==_0x3b6d('0x2b')){if(_0x497007[_0x3b6d('0x21')][_0x3b6d('0x2c')]('U(xcally-mixmonitor-context)')<0x0){_0x497007[_0x3b6d('0x21')]+=_0x3b6d('0x2d');}}else{_0x497007['options']=_0x497007[_0x3b6d('0x21')][_0x3b6d('0x2e')](_0x3b6d('0x2d'),'');}_0x19dda5[_0x3674a9[_0x2dffb2][_0x3b6d('0x25')]]=_0x497007[_0x3b6d('0x21')];break;default:_0x19dda5[_0x3674a9[_0x2dffb2][_0x3b6d('0x25')]]=_0x64830e[_0x3674a9[_0x2dffb2][_0x3b6d('0x25')]];}}return _0x19dda5['join'](',');}function _0x635b14(_0x26eb47,_0x3ecba3,_0x22537b,_0x71745a){return new Promise(function(_0xdbacd4,_0x34e643){var _0x234cde=[];if(_[_0x3b6d('0x2f')](_0x3ecba3))return _0xdbacd4(_0x234cde);_0x3ca0ee[_0x3b6d('0x30')][_0x3b6d('0x31')]({'attributes':['id',_0x3b6d('0x32'),_0x3b6d('0x33')],'raw':!![]})[_0x3b6d('0x34')](function(_0x289f81){for(var _0x53327d=0x0,_0x20fb8e=0x0;_0x53327d<_0x3ecba3[_0x3b6d('0x24')];_0x53327d++,_0x20fb8e=0x0){var _0x48aafb=_0x3ecba3[_0x53327d];var _0x3f7894=[];var _0x337a9a=[];if(_0x48aafb[_0x3b6d('0x32')]!==_0x3b6d('0x35')){_0x48aafb[_0x3b6d('0x36')]=[_0x48aafb[_0x3b6d('0x32')]];}else{_0x48aafb['intervals']=_0x48aafb[_0x3b6d('0x33')]?_['map'](_[_0x3b6d('0x37')](_0x289f81,{'IntervalId':_0x48aafb[_0x3b6d('0x33')]}),_0x3b6d('0x32')):[];}_0x48aafb[_0x3b6d('0x7')]=_0x26eb47[_0x3b6d('0x7')];_0x48aafb['exten']=_0x26eb47[_0x3b6d('0x8')];if(_0x48aafb[_0x3b6d('0x4')])_0x48aafb[_0x3b6d('0x4')]=_0x48aafb[_0x3b6d('0x4')]['toLowerCase']();if(_0x26eb47[_0x3b6d('0x4')]===_0x3b6d('0x15')){if(_0x48aafb[_0x3b6d('0x1b')](_0x3b6d('0x38'))&&_0x48aafb[_0x3b6d('0x38')]&&_0x48aafb[_0x3b6d('0x38')]!=='--'){_0x3f7894[_0x3b6d('0xe')]({'type':_0x48aafb['type']['toLowerCase'](),'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x39')+_0x48aafb[_0x3b6d('0x38')],'context':_0x26eb47['context'],'exten':_0x26eb47[_0x3b6d('0x8')],'priority':_0x48aafb[_0x3b6d('0x36')][_0x3b6d('0x24')]+_0x22537b+_0x20fb8e++,'VoiceExtensionId':_0x26eb47['id']});}_0x3f7894['push']({'type':_0x48aafb['type'][_0x3b6d('0x3a')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x48aafb[_0x3b6d('0x3b')]?_0x3b6d('0x3c')+_0x48aafb[_0x3b6d('0x3b')]+')':_0x3b6d('0x3d')),'context':_0x26eb47[_0x3b6d('0x7')],'exten':_0x26eb47[_0x3b6d('0x8')],'priority':_0x48aafb[_0x3b6d('0x36')][_0x3b6d('0x24')]+_0x22537b+_0x20fb8e++,'VoiceExtensionId':_0x26eb47['id']});}else{if(_0x48aafb['hasOwnProperty'](_0x3b6d('0x3e'))){if([_0x3b6d('0x3f'),'playback'][_0x3b6d('0x40')](_0x48aafb[_0x3b6d('0x41')]['toLowerCase']())&&_0x48aafb[_0x3b6d('0x42')]!==_0x3b6d('0x43')){if(_0x48aafb[_0x3b6d('0x3e')]){_0x3f7894[_0x3b6d('0xe')]({'type':_0x48aafb[_0x3b6d('0x4')]['toLowerCase'](),'app':_0x3b6d('0x16'),'appdata':_0x3b6d('0x44'),'context':_0x26eb47['context'],'exten':_0x26eb47[_0x3b6d('0x8')],'priority':_0x48aafb[_0x3b6d('0x36')][_0x3b6d('0x24')]+_0x22537b+_0x20fb8e++,'VoiceExtensionId':_0x26eb47['id']});_0x3f7894[_0x3b6d('0xe')]({'type':_0x48aafb[_0x3b6d('0x4')][_0x3b6d('0x3a')](),'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x45'),'context':_0x26eb47[_0x3b6d('0x7')],'exten':_0x26eb47[_0x3b6d('0x8')],'priority':_0x48aafb['intervals'][_0x3b6d('0x24')]+_0x22537b+_0x20fb8e++,'VoiceExtensionId':_0x26eb47['id']});}else{_0x3f7894[_0x3b6d('0xe')]({'type':_0x48aafb['type']['toLowerCase'](),'app':_0x3b6d('0x16'),'appdata':_0x3b6d('0x46'),'context':_0x26eb47[_0x3b6d('0x7')],'exten':_0x26eb47[_0x3b6d('0x8')],'priority':_0x48aafb[_0x3b6d('0x36')]['length']+_0x22537b+_0x20fb8e++,'VoiceExtensionId':_0x26eb47['id']});_0x3f7894[_0x3b6d('0xe')]({'type':_0x48aafb[_0x3b6d('0x4')][_0x3b6d('0x3a')](),'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x47'),'context':_0x26eb47[_0x3b6d('0x7')],'exten':_0x26eb47['exten'],'priority':_0x48aafb[_0x3b6d('0x36')][_0x3b6d('0x24')]+_0x22537b+_0x20fb8e++,'VoiceExtensionId':_0x26eb47['id']});}}}}for(var _0x472a63=0x0;_0x472a63<_0x48aafb['intervals'][_0x3b6d('0x24')];_0x472a63++){var _0x41757b=_0x22537b+_0x48aafb[_0x3b6d('0x36')][_0x3b6d('0x24')];var _0x6e6595=_0x472a63===_0x48aafb['intervals'][_0x3b6d('0x24')]-0x1?_0x22537b+_0x3f7894[_0x3b6d('0x24')]+_0x337a9a[_0x3b6d('0x24')]+0x2:_0x22537b+_0x472a63+0x1;_0x3f7894['splice'](_0x472a63,0x0,{'type':_0x26eb47[_0x3b6d('0x4')],'app':'GotoIfTime','appdata':_0x48aafb[_0x3b6d('0x36')][_0x472a63]+'?'+_0x26eb47[_0x3b6d('0x7')]+_0x3b6d('0x48')+_0x41757b+':'+_0x26eb47['context']+_0x3b6d('0x48')+_0x6e6595,'exten':_0x26eb47['exten'],'context':_0x26eb47[_0x3b6d('0x7')],'priority':_0x22537b+_0x472a63,'VoiceExtensionId':_0x26eb47['id']});}if(_0x71745a&&_0x48aafb[_0x3b6d('0x42')]===_0x3b6d('0x49'))_0x48aafb[_0x3b6d('0x4a')]=_0x1680b2(_0x48aafb['appdata']);_0x48aafb['priority']=_0x3f7894[_0x3b6d('0x24')]?_['last'](_0x3f7894)[_0x3b6d('0x4b')]+0x1:_0x22537b;_0x234cde=_[_0x3b6d('0x4c')](_0x234cde,_0x3f7894,[_0x48aafb],_0x337a9a);_0x22537b=_['last'](_0x234cde)[_0x3b6d('0x4b')]+0x1;}return _0xdbacd4(_0x234cde);})[_0x3b6d('0x4d')](function(_0x372b34){_0x34e643(_0x372b34);});});}return _0x2a0181[_0x3b6d('0x4e')]('VoiceExtension',attributes,{'tableName':_0x3b6d('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x518f00,_0x287dc0){var _0x119b25=this;var _0xf95840=_0x119b25['type']===_0x3b6d('0x15')?_0x50024c(_0x119b25):_0x2b6b82(_0x119b25);return _0x635b14(_0x119b25,_0x518f00,_[_0x3b6d('0x50')](_0xf95840)[_0x3b6d('0x4b')]+0x1,_0x287dc0)[_0x3b6d('0x34')](function(_0x3f041e){var _0x41fef9=_[_0x3b6d('0x4c')](_0xf95840,_0x3f041e);_0x41fef9[_0x3b6d('0xe')]({'type':_0x119b25[_0x3b6d('0x4')],'app':_0x3b6d('0x51'),'exten':_0x119b25[_0x3b6d('0x8')],'context':_0x119b25[_0x3b6d('0x7')],'priority':_[_0x3b6d('0x50')](_0x41fef9)[_0x3b6d('0x4b')]+0x1,'VoiceExtensionId':_0x119b25['id']});return _0x41fef9;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index bac0f98..689f8a2 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 _0x22da=['localhost','socket.io-emitter','register','request','info','VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','options','raw','where','attributes','limit','include','map','model','GetVoiceExtension','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis'];(function(_0x1f6f98,_0x140cf8){var _0xd2e973=function(_0x402809){while(--_0x402809){_0x1f6f98['push'](_0x1f6f98['shift']());}};_0xd2e973(++_0x140cf8);}(_0x22da,0x80));var _0xa22d=function(_0x51eb97,_0x28a03e){_0x51eb97=_0x51eb97-0x0;var _0x32e6d8=_0x22da[_0x51eb97];return _0x32e6d8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa22d('0x0'));var BPromise=require(_0xa22d('0x1'));var rs=require(_0xa22d('0x2'));var fs=require('fs');var Redis=require(_0xa22d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa22d('0x4'));var logger=require(_0xa22d('0x5'))(_0xa22d('0x6'));var config=require(_0xa22d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa22d('0x8')][_0xa22d('0x9')]({'port':0x232a});config['redis']=_[_0xa22d('0xa')](config[_0xa22d('0xb')],{'host':_0xa22d('0xc'),'port':0x18eb});var socket=require(_0xa22d('0xd'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xa22d('0xe')](socket);function respondWithRpcPromise(_0x122102,_0x4dfff8,_0x312520){return new BPromise(function(_0xc742bb,_0x471738){return client[_0xa22d('0xf')](_0x122102,_0x312520)['then'](function(_0x5d25b1){logger[_0xa22d('0x10')](_0xa22d('0x11'),_0x4dfff8,'request\x20sent');logger[_0xa22d('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x4dfff8,_0xa22d('0x13'),JSON[_0xa22d('0x14')](_0x5d25b1));if(_0x5d25b1[_0xa22d('0x15')]){if(_0x5d25b1['error'][_0xa22d('0x16')]===0x1f4){logger[_0xa22d('0x15')](_0xa22d('0x11'),_0x4dfff8,_0x5d25b1[_0xa22d('0x15')][_0xa22d('0x17')]);return _0x471738(_0x5d25b1['error'][_0xa22d('0x17')]);}logger[_0xa22d('0x15')](_0xa22d('0x11'),_0x4dfff8,_0x5d25b1[_0xa22d('0x15')][_0xa22d('0x17')]);return _0xc742bb(_0x5d25b1[_0xa22d('0x15')][_0xa22d('0x17')]);}else{logger[_0xa22d('0x10')](_0xa22d('0x11'),_0x4dfff8,_0xa22d('0x13'));_0xc742bb(_0x5d25b1[_0xa22d('0x18')][_0xa22d('0x17')]);}})[_0xa22d('0x19')](function(_0x256ba0){logger[_0xa22d('0x15')](_0xa22d('0x11'),_0x4dfff8,_0x256ba0);_0x471738(_0x256ba0);});});}exports['GetVoiceExtension']=function(_0x177a0f){var _0x194d74=this;return new Promise(function(_0xd96a44,_0x4ed606){return db['VoiceExtension']['findAll']({'raw':_0x177a0f[_0xa22d('0x1a')]?_0x177a0f[_0xa22d('0x1a')][_0xa22d('0x1b')]===undefined?!![]:![]:!![],'where':_0x177a0f['options']?_0x177a0f[_0xa22d('0x1a')][_0xa22d('0x1c')]||null:null,'attributes':_0x177a0f[_0xa22d('0x1a')]?_0x177a0f['options'][_0xa22d('0x1d')]||null:null,'limit':_0x177a0f[_0xa22d('0x1a')]?_0x177a0f['options'][_0xa22d('0x1e')]||null:null,'include':_0x177a0f[_0xa22d('0x1a')]?_0x177a0f[_0xa22d('0x1a')][_0xa22d('0x1f')]?_[_0xa22d('0x20')](_0x177a0f[_0xa22d('0x1a')][_0xa22d('0x1f')],function(_0x58aa49){return{'model':db[_0x58aa49['model']],'as':_0x58aa49['as'],'attributes':_0x58aa49[_0xa22d('0x1d')],'include':_0x58aa49[_0xa22d('0x1f')]?_[_0xa22d('0x20')](_0x58aa49[_0xa22d('0x1f')],function(_0x33b1c9){return{'model':db[_0x33b1c9[_0xa22d('0x21')]],'as':_0x33b1c9['as'],'attributes':_0x33b1c9[_0xa22d('0x1d')],'include':_0x33b1c9[_0xa22d('0x1f')]?_[_0xa22d('0x20')](_0x33b1c9[_0xa22d('0x1f')],function(_0x594ac5){return{'model':db[_0x594ac5['model']],'as':_0x594ac5['as'],'attributes':_0x594ac5[_0xa22d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550dd7){logger[_0xa22d('0x10')](_0xa22d('0x22'),_0x177a0f);logger[_0xa22d('0x12')](_0xa22d('0x22'),_0x177a0f,JSON[_0xa22d('0x14')](_0x550dd7));_0xd96a44(_0x550dd7);})[_0xa22d('0x19')](function(_0x1ef634){logger[_0xa22d('0x15')]('GetVoiceExtension',_0x1ef634[_0xa22d('0x17')],_0x177a0f);_0x4ed606(_0x194d74[_0xa22d('0x15')](0x1f4,_0x1ef634[_0xa22d('0x17')]));});});}; \ No newline at end of file +var _0x80c3=['error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','redis','defaults','socket.io-emitter','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x80c3,0x18f));var _0x380c=function(_0x4ca6a4,_0x5e9694){_0x4ca6a4=_0x4ca6a4-0x0;var _0x120555=_0x80c3[_0x4ca6a4];return _0x120555;};'use strict';var _=require(_0x380c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x380c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x380c('0x2'));var db=require(_0x380c('0x3'))['db'];var utils=require(_0x380c('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x380c('0x5'));var client=jayson['client']['http']({'port':0x232a});config[_0x380c('0x6')]=_[_0x380c('0x7')](config[_0x380c('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x380c('0x8'))(new Redis(config[_0x380c('0x6')]));require('./voiceExtension.socket')[_0x380c('0x9')](socket);function respondWithRpcPromise(_0x1d5493,_0x50be52,_0x58886c){return new BPromise(function(_0x3a1ebb,_0x35f424){return client['request'](_0x1d5493,_0x58886c)[_0x380c('0xa')](function(_0x41fbf2){logger[_0x380c('0xb')](_0x380c('0xc'),_0x50be52,_0x380c('0xd'));logger[_0x380c('0xe')](_0x380c('0xf'),_0x50be52,_0x380c('0xd'),JSON[_0x380c('0x10')](_0x41fbf2));if(_0x41fbf2[_0x380c('0x11')]){if(_0x41fbf2['error'][_0x380c('0x12')]===0x1f4){logger[_0x380c('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x50be52,_0x41fbf2[_0x380c('0x11')][_0x380c('0x13')]);return _0x35f424(_0x41fbf2[_0x380c('0x11')][_0x380c('0x13')]);}logger[_0x380c('0x11')](_0x380c('0xc'),_0x50be52,_0x41fbf2[_0x380c('0x11')][_0x380c('0x13')]);return _0x3a1ebb(_0x41fbf2[_0x380c('0x11')]['message']);}else{logger[_0x380c('0xb')]('VoiceExtension,\x20%s,\x20%s',_0x50be52,'request\x20sent');_0x3a1ebb(_0x41fbf2[_0x380c('0x14')]['message']);}})['catch'](function(_0x4901fe){logger['error'](_0x380c('0xc'),_0x50be52,_0x4901fe);_0x35f424(_0x4901fe);});});}exports[_0x380c('0x15')]=function(_0x1689b3){var _0x10c9ee=this;return new Promise(function(_0x92ea5f,_0x4086c2){return db[_0x380c('0x16')][_0x380c('0x17')]({'raw':_0x1689b3[_0x380c('0x18')]?_0x1689b3[_0x380c('0x18')][_0x380c('0x19')]===undefined?!![]:![]:!![],'where':_0x1689b3[_0x380c('0x18')]?_0x1689b3[_0x380c('0x18')][_0x380c('0x1a')]||null:null,'attributes':_0x1689b3[_0x380c('0x18')]?_0x1689b3[_0x380c('0x18')][_0x380c('0x1b')]||null:null,'limit':_0x1689b3[_0x380c('0x18')]?_0x1689b3[_0x380c('0x18')][_0x380c('0x1c')]||null:null,'include':_0x1689b3[_0x380c('0x18')]?_0x1689b3['options'][_0x380c('0x1d')]?_['map'](_0x1689b3[_0x380c('0x18')]['include'],function(_0x2f2e98){return{'model':db[_0x2f2e98['model']],'as':_0x2f2e98['as'],'attributes':_0x2f2e98['attributes'],'include':_0x2f2e98[_0x380c('0x1d')]?_[_0x380c('0x1e')](_0x2f2e98['include'],function(_0x24d551){return{'model':db[_0x24d551[_0x380c('0x1f')]],'as':_0x24d551['as'],'attributes':_0x24d551[_0x380c('0x1b')],'include':_0x24d551[_0x380c('0x1d')]?_[_0x380c('0x1e')](_0x24d551[_0x380c('0x1d')],function(_0x229840){return{'model':db[_0x229840[_0x380c('0x1f')]],'as':_0x229840['as'],'attributes':_0x229840['attributes']};}):[]};}):[]};}):[]:[]})[_0x380c('0xa')](function(_0x3a32f9){logger[_0x380c('0xb')](_0x380c('0x15'),_0x1689b3);logger[_0x380c('0xe')]('GetVoiceExtension',_0x1689b3,JSON['stringify'](_0x3a32f9));_0x92ea5f(_0x3a32f9);})['catch'](function(_0x339774){logger['error'](_0x380c('0x15'),_0x339774[_0x380c('0x13')],_0x1689b3);_0x4086c2(_0x10c9ee['error'](0x1f4,_0x339774[_0x380c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 413f8a1..4ddb33b 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x3a8840,_0x363d57){var _0xd80112=function(_0x522b79){while(--_0x522b79){_0x3a8840['push'](_0x3a8840['shift']());}};_0xd80112(++_0x363d57);}(_0x0295,0x1f0));var _0x5029=function(_0x1b658,_0x344b6a){_0x1b658=_0x1b658-0x0;var _0x1d17e5=_0x0295[_0x1b658];return _0x1d17e5;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file +var _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x406fe8,_0x4981d2){var _0x489ea4=function(_0x4c8e30){while(--_0x4c8e30){_0x406fe8['push'](_0x406fe8['shift']());}};_0x489ea4(++_0x4981d2);}(_0xe14b,0x93));var _0xbe14=function(_0x545a07,_0x24d669){_0x545a07=_0x545a07-0x0;var _0x436dd2=_0xe14b[_0x545a07];return _0x436dd2;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 279e78a..60f19ad 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 _0x4c60=['exports','multer','util','path','connect-timeout','Router','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','put','update','destroy'];(function(_0x2ea1df,_0x25cb53){var _0x21c130=function(_0x261122){while(--_0x261122){_0x2ea1df['push'](_0x2ea1df['shift']());}};_0x21c130(++_0x25cb53);}(_0x4c60,0xc1));var _0x04c6=function(_0x1668c0,_0x4bd511){_0x1668c0=_0x1668c0-0x0;var _0x20182b=_0x4c60[_0x1668c0];return _0x20182b;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x04c6('0x5'));router[_0x04c6('0x6')]('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0x8')]);router[_0x04c6('0x6')](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller['show']);router[_0x04c6('0x6')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x04c6('0xc')]('/:id',auth[_0x04c6('0x7')](),controller[_0x04c6('0xd')]);router['delete'](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xe')]);module[_0x04c6('0xf')]=router; \ No newline at end of file +var _0xbff5=['fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x149f32,_0x4273f7){var _0x11f475=function(_0x18eeef){while(--_0x18eeef){_0x149f32['push'](_0x149f32['shift']());}};_0x11f475(++_0x4273f7);}(_0xbff5,0x1bc));var _0x5bff=function(_0x13ef76,_0x59e898){_0x13ef76=_0x13ef76-0x0;var _0x4fbc52=_0xbff5[_0x13ef76];return _0x4fbc52;};'use strict';var multer=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var path=require(_0x5bff('0x2'));var timeout=require(_0x5bff('0x3'));var express=require(_0x5bff('0x4'));var router=express[_0x5bff('0x5')]();var fs_extra=require(_0x5bff('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5bff('0x7'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x5bff('0x8')]('/',auth[_0x5bff('0x9')](),controller[_0x5bff('0xa')]);router[_0x5bff('0x8')](_0x5bff('0xb'),auth[_0x5bff('0x9')](),controller[_0x5bff('0xc')]);router[_0x5bff('0x8')](_0x5bff('0xd'),auth['isAuthenticated'](),controller[_0x5bff('0xe')]);router['post']('/',auth[_0x5bff('0x9')](),controller[_0x5bff('0xf')]);router['put'](_0x5bff('0xb'),auth['isAuthenticated'](),controller[_0x5bff('0x10')]);router['delete'](_0x5bff('0xb'),auth[_0x5bff('0x9')](),controller['destroy']);module[_0x5bff('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 82b949e..d77a685 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 _0xb71d=['email','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','fullname','getDataValue','mailbox','sequelize','from-voicemail','contest_mailbox','STRING','setDataValue'];(function(_0x44594d,_0x44470c){var _0x1bff66=function(_0x45a4b9){while(--_0x45a4b9){_0x44594d['push'](_0x44594d['shift']());}};_0x1bff66(++_0x44470c);}(_0xb71d,0x9b));var _0xdb71=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb71d[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xdb71('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0xdb71('0x1'),'unique':_0xdb71('0x2')},'mailbox':{'type':Sequelize[_0xdb71('0x3')],'defaultValue':'','allowNull':![],'unique':_0xdb71('0x2')},'password':{'type':Sequelize[_0xdb71('0x3')]},'fullname':{'type':Sequelize[_0xdb71('0x3')]},'email':{'type':Sequelize[_0xdb71('0x3')],'validate':{'isEmail':!![]},'set':function(_0x258e69){this[_0xdb71('0x4')](_0xdb71('0x5'),typeof _0x258e69==='string'&&_0x258e69[_0xdb71('0x6')]()?_0x258e69[_0xdb71('0x6')]():null);}},'pager':{'type':Sequelize[_0xdb71('0x3')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xdb71('0x7')},'attach':{'type':Sequelize[_0xdb71('0x8')]('yes','no'),'defaultValue':_0xdb71('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xdb71('0x8')](_0xdb71('0x9'),'no'),'defaultValue':_0xdb71('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xdb71('0x3')]},'callback':{'type':Sequelize[_0xdb71('0x3')]},'review':{'type':Sequelize[_0xdb71('0x8')](_0xdb71('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xdb71('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xdb71('0x8')](_0xdb71('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xdb71('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xdb71('0x8')](_0xdb71('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xdb71('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xdb71('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xdb71('0x8')](_0xdb71('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xdb71('0x8')](_0xdb71('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xdb71('0x8')](_0xdb71('0x9'),'no'),'defaultValue':_0xdb71('0x9'),'allowNull':![]},'stamp':{'type':_0xdb71('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xdb71('0x3')]},'maxsecs':{'type':Sequelize[_0xdb71('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xdb71('0xc')],'get':function(){return this['getDataValue'](_0xdb71('0xd'))+'\x20-\x20'+this[_0xdb71('0xe')](_0xdb71('0xf'));}}}; \ No newline at end of file +var _0x3c08=['sequelize','STRING','from-voicemail','contest_mailbox','trim','central','yes','ENUM','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','mailbox'];(function(_0x34147b,_0x5e296c){var _0x2242fb=function(_0x121e97){while(--_0x121e97){_0x34147b['push'](_0x34147b['shift']());}};_0x2242fb(++_0x5e296c);}(_0x3c08,0xf7));var _0x83c0=function(_0x4432e0,_0x5b332d){_0x4432e0=_0x4432e0-0x0;var _0x29e13f=_0x3c08[_0x4432e0];return _0x29e13f;};'use strict';var Sequelize=require(_0x83c0('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x83c0('0x1')]},'context':{'type':Sequelize[_0x83c0('0x1')],'defaultValue':_0x83c0('0x2'),'unique':_0x83c0('0x3')},'mailbox':{'type':Sequelize[_0x83c0('0x1')],'defaultValue':'','allowNull':![],'unique':_0x83c0('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x83c0('0x1')],'validate':{'isEmail':!![]},'set':function(_0x3ea626){this['setDataValue']('email',typeof _0x3ea626==='string'&&_0x3ea626[_0x83c0('0x4')]()?_0x3ea626[_0x83c0('0x4')]():null);}},'pager':{'type':Sequelize[_0x83c0('0x1')]},'tz':{'type':Sequelize[_0x83c0('0x1')],'defaultValue':_0x83c0('0x5')},'attach':{'type':Sequelize['ENUM'](_0x83c0('0x6'),'no'),'defaultValue':_0x83c0('0x6'),'allowNull':![]},'saycid':{'type':Sequelize[_0x83c0('0x7')](_0x83c0('0x6'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x83c0('0x1')]},'callback':{'type':Sequelize[_0x83c0('0x1')]},'review':{'type':Sequelize['ENUM'](_0x83c0('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x83c0('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x83c0('0x6'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x83c0('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x83c0('0x7')](_0x83c0('0x6'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x83c0('0x7')](_0x83c0('0x6'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x83c0('0x7')](_0x83c0('0x6'),'no'),'defaultValue':_0x83c0('0x6'),'allowNull':![]},'forcename':{'type':Sequelize[_0x83c0('0x7')](_0x83c0('0x6'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x83c0('0x7')](_0x83c0('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x83c0('0x7')]('yes','no'),'defaultValue':_0x83c0('0x6'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x83c0('0x1')]},'emailbody':{'type':Sequelize[_0x83c0('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x83c0('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x83c0('0xa')],'get':function(){return this[_0x83c0('0xb')]('fullname')+'\x20-\x20'+this['getDataValue'](_0x83c0('0xc'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index d3fb769..1c00faf 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 _0xd87e=['autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getMessages','findOne','VoiceMailMessage','hasOwnProperty','sort','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Voicemails','UserProfileResource','error','name','map','VoiceMail','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId'];(function(_0x14bc1a,_0x3c2216){var _0x4bc98f=function(_0x31ae80){while(--_0x31ae80){_0x14bc1a['push'](_0x14bc1a['shift']());}};_0x4bc98f(++_0x3c2216);}(_0xd87e,0x1bf));var _0xed87=function(_0x1477b7,_0x312690){_0x1477b7=_0x1477b7-0x0;var _0x85e9d4=_0xd87e[_0x1477b7];return _0x85e9d4;};'use strict';var emlformat=require(_0xed87('0x0'));var rimraf=require(_0xed87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed87('0x2'));var rp=require(_0xed87('0x3'));var moment=require(_0xed87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed87('0x5'));var util=require('util');var path=require(_0xed87('0x6'));var sox=require(_0xed87('0x7'));var csv=require('to-csv');var ejs=require(_0xed87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed87('0x9'));var crypto=require(_0xed87('0xa'));var jsforce=require(_0xed87('0xb'));var deskjs=require(_0xed87('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require(_0xed87('0x13'));var logger=require('../../config/logger')(_0xed87('0x14'));var utils=require(_0xed87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed87('0x16'));var db=require(_0xed87('0x17'))['db'];function respondWithStatusCode(_0x5e912e,_0x4ffc2d){_0x4ffc2d=_0x4ffc2d||0xcc;return function(_0x466f35){if(_0x466f35){return _0x5e912e[_0xed87('0x18')](_0x4ffc2d);}return _0x5e912e[_0xed87('0x19')](_0x4ffc2d)[_0xed87('0x1a')]();};}function respondWithResult(_0x16bfd6,_0x3865c5){_0x3865c5=_0x3865c5||0xc8;return function(_0x52dfe8){if(_0x52dfe8){return _0x16bfd6[_0xed87('0x19')](_0x3865c5)[_0xed87('0x1b')](_0x52dfe8);}};}function respondWithFilteredResult(_0x1722a6,_0x1e9a3d){return function(_0x2f2fd3){if(_0x2f2fd3){var _0xd34e0e=typeof _0x1e9a3d[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x1e9a3d[_0xed87('0x1e')]==='undefined';var _0x3db5ea=_0x2f2fd3[_0xed87('0x1f')];var _0x2c386a=_0xd34e0e?0x0:_0x1e9a3d[_0xed87('0x1c')];var _0x5f4076=_0xd34e0e?_0x2f2fd3[_0xed87('0x1f')]:_0x1e9a3d[_0xed87('0x1c')]+_0x1e9a3d[_0xed87('0x1e')];var _0x3f9e08;if(_0x5f4076>=_0x3db5ea){_0x5f4076=_0x3db5ea;_0x3f9e08=0xc8;}else{_0x3f9e08=0xce;}_0x1722a6[_0xed87('0x19')](_0x3f9e08);return _0x1722a6[_0xed87('0x20')](_0xed87('0x21'),_0x2c386a+'-'+_0x5f4076+'/'+_0x3db5ea)[_0xed87('0x1b')](_0x2f2fd3);}return null;};}function patchUpdates(_0x3b7981){return function(_0x52e81c){try{jsonpatch['apply'](_0x52e81c,_0x3b7981,!![]);}catch(_0x5db546){return BPromise['reject'](_0x5db546);}return _0x52e81c[_0xed87('0x22')]();};}function saveUpdates(_0x5d3ec8,_0x4191a7){return function(_0x2b0b98){if(_0x2b0b98){return _0x2b0b98['update'](_0x5d3ec8)[_0xed87('0x23')](function(_0x505733){return _0x505733;});}return null;};}function removeEntity(_0x3d1641,_0x24962e){return function(_0x27799a){if(_0x27799a){return _0x27799a[_0xed87('0x24')]()[_0xed87('0x23')](function(){var _0x5d15b3=_0x27799a[_0xed87('0x25')]({'plain':!![]});var _0x3c22b7=_0xed87('0x26');return db[_0xed87('0x27')][_0xed87('0x24')]({'where':{'type':_0x3c22b7,'resourceId':_0x5d15b3['id']}})[_0xed87('0x23')](function(){return _0x27799a;});})[_0xed87('0x23')](function(){_0x3d1641[_0xed87('0x19')](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x38f5c,_0x469181){return function(_0x341a35){if(!_0x341a35){_0x38f5c[_0xed87('0x18')](0x194);}return _0x341a35;};}function handleError(_0x2b86e2,_0x4dfaf2){_0x4dfaf2=_0x4dfaf2||0x1f4;return function(_0xb32b1c){logger[_0xed87('0x28')](_0xb32b1c['stack']);if(_0xb32b1c[_0xed87('0x29')]){delete _0xb32b1c[_0xed87('0x29')];}_0x2b86e2[_0xed87('0x19')](_0x4dfaf2)['send'](_0xb32b1c);};}exports['index']=function(_0xd0efba,_0x428b75){var _0x21ab8a={},_0x549a19={},_0x37d45a={'count':0x0,'rows':[]};var _0x3b87e3=_[_0xed87('0x2a')](db[_0xed87('0x2b')][_0xed87('0x2c')],function(_0x46b9f9){return{'name':_0x46b9f9[_0xed87('0x2d')],'type':_0x46b9f9[_0xed87('0x2e')][_0xed87('0x2f')]};});_0x549a19['model']=_[_0xed87('0x2a')](_0x3b87e3,_0xed87('0x29'));_0x549a19['query']=_[_0xed87('0x30')](_0xd0efba['query']);_0x549a19[_0xed87('0x31')]=_[_0xed87('0x32')](_0x549a19[_0xed87('0x33')],_0x549a19[_0xed87('0x34')]);_0x21ab8a[_0xed87('0x35')]=_[_0xed87('0x32')](_0x549a19[_0xed87('0x33')],qs[_0xed87('0x36')](_0xd0efba[_0xed87('0x34')][_0xed87('0x36')]));_0x21ab8a[_0xed87('0x35')]=_0x21ab8a['attributes'][_0xed87('0x37')]?_0x21ab8a[_0xed87('0x35')]:_0x549a19['model'];if(!_0xd0efba[_0xed87('0x34')]['hasOwnProperty'](_0xed87('0x38'))){_0x21ab8a[_0xed87('0x1e')]=qs['limit'](_0xd0efba[_0xed87('0x34')][_0xed87('0x1e')]);_0x21ab8a[_0xed87('0x1c')]=qs[_0xed87('0x1c')](_0xd0efba[_0xed87('0x34')]['offset']);}_0x21ab8a[_0xed87('0x39')]=qs['sort'](_0xd0efba[_0xed87('0x34')]['sort']);_0x21ab8a[_0xed87('0x3a')]=qs[_0xed87('0x31')](_[_0xed87('0x3b')](_0xd0efba[_0xed87('0x34')],_0x549a19[_0xed87('0x31')]),_0x3b87e3);if(_0xd0efba[_0xed87('0x34')][_0xed87('0x3c')]){_0x21ab8a[_0xed87('0x3a')]=_[_0xed87('0x3d')](_0x21ab8a['where'],{'$or':_['map'](_0x3b87e3,function(_0xa6714a){if(_0xa6714a[_0xed87('0x2e')]!==_0xed87('0x3e')){var _0x325112={};_0x325112[_0xa6714a[_0xed87('0x29')]]={'$like':'%'+_0xd0efba[_0xed87('0x34')]['filter']+'%'};return _0x325112;}})});}_0x21ab8a=_[_0xed87('0x3d')]({},_0x21ab8a,_0xd0efba[_0xed87('0x3f')]);var _0x1c49b0={'where':_0x21ab8a['where']};return db[_0xed87('0x2b')][_0xed87('0x1f')](_0x1c49b0)[_0xed87('0x23')](function(_0x1b0092){_0x37d45a[_0xed87('0x1f')]=_0x1b0092;if(_0xd0efba[_0xed87('0x34')][_0xed87('0x40')]){_0x21ab8a[_0xed87('0x41')]=[{'all':!![]}];}return db[_0xed87('0x2b')][_0xed87('0x42')](_0x21ab8a);})['then'](function(_0x7e6cbb){_0x37d45a[_0xed87('0x43')]=_0x7e6cbb;return _0x37d45a;})[_0xed87('0x23')](respondWithFilteredResult(_0x428b75,_0x21ab8a))['catch'](handleError(_0x428b75,null));};exports['show']=function(_0xa31eec,_0x7aa7fa){var _0x40cd98={'raw':!![],'where':{'id':_0xa31eec['params']['id']}},_0x41a658={};_0x41a658[_0xed87('0x33')]=_[_0xed87('0x30')](db['VoiceMail'][_0xed87('0x2c')]);_0x41a658[_0xed87('0x34')]=_[_0xed87('0x30')](_0xa31eec[_0xed87('0x34')]);_0x41a658[_0xed87('0x31')]=_[_0xed87('0x32')](_0x41a658[_0xed87('0x33')],_0x41a658[_0xed87('0x34')]);_0x40cd98[_0xed87('0x35')]=_[_0xed87('0x32')](_0x41a658[_0xed87('0x33')],qs['fields'](_0xa31eec[_0xed87('0x34')][_0xed87('0x36')]));_0x40cd98[_0xed87('0x35')]=_0x40cd98[_0xed87('0x35')][_0xed87('0x37')]?_0x40cd98[_0xed87('0x35')]:_0x41a658[_0xed87('0x33')];if(_0xa31eec[_0xed87('0x34')][_0xed87('0x40')]){_0x40cd98[_0xed87('0x41')]=[{'all':!![]}];}_0x40cd98=_[_0xed87('0x3d')]({},_0x40cd98,_0xa31eec[_0xed87('0x3f')]);return db[_0xed87('0x2b')][_0xed87('0x44')](_0x40cd98)[_0xed87('0x23')](handleEntityNotFound(_0x7aa7fa,null))[_0xed87('0x23')](respondWithResult(_0x7aa7fa,null))[_0xed87('0x45')](handleError(_0x7aa7fa,null));};exports['create']=function(_0x2c7bef,_0x1a68a7){return db[_0xed87('0x2b')]['create'](_0x2c7bef[_0xed87('0x46')],{})[_0xed87('0x23')](function(_0x54bc95){var _0x33e736=_0x2c7bef[_0xed87('0x47')][_0xed87('0x25')]({'plain':!![]});if(!_0x33e736)throw new Error(_0xed87('0x48'));if(_0x33e736['role']===_0xed87('0x47')){var _0x436e15=_0x54bc95[_0xed87('0x25')]({'plain':!![]});var _0x272a07=_0xed87('0x26');return db[_0xed87('0x49')][_0xed87('0x44')]({'where':{'name':_0x272a07,'userProfileId':_0x33e736[_0xed87('0x4a')]},'raw':!![]})[_0xed87('0x23')](function(_0x251d4e){if(_0x251d4e&&_0x251d4e[_0xed87('0x4b')]===0x0){return db[_0xed87('0x27')][_0xed87('0x4c')]({'name':_0x436e15['name'],'resourceId':_0x436e15['id'],'type':_0x251d4e[_0xed87('0x29')],'sectionId':_0x251d4e['id']},{})['then'](function(){return _0x54bc95;});}else{return _0x54bc95;}})[_0xed87('0x45')](function(_0x329973){logger[_0xed87('0x28')](_0xed87('0x4d'),_0x329973);throw _0x329973;});}return _0x54bc95;})[_0xed87('0x23')](respondWithResult(_0x1a68a7,0xc9))[_0xed87('0x45')](handleError(_0x1a68a7,null));};exports[_0xed87('0x4e')]=function(_0xccdbb6,_0x3b413d){if(_0xccdbb6[_0xed87('0x46')]['id']){delete _0xccdbb6['body']['id'];}return db[_0xed87('0x2b')][_0xed87('0x44')]({'where':{'id':_0xccdbb6[_0xed87('0x4f')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x3b413d,null))[_0xed87('0x23')](saveUpdates(_0xccdbb6[_0xed87('0x46')],null))[_0xed87('0x23')](respondWithResult(_0x3b413d,null))[_0xed87('0x45')](handleError(_0x3b413d,null));};exports[_0xed87('0x24')]=function(_0x367ff4,_0x32db1f){return db['VoiceMail']['find']({'where':{'id':_0x367ff4[_0xed87('0x4f')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x32db1f,null))[_0xed87('0x23')](removeEntity(_0x32db1f,null))[_0xed87('0x45')](handleError(_0x32db1f,null));};exports[_0xed87('0x50')]=function(_0x4dd840,_0x7e6738,_0x1ddd72){return db[_0xed87('0x2b')][_0xed87('0x51')]({'where':{'id':_0x4dd840[_0xed87('0x4f')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x7e6738,null))[_0xed87('0x23')](function(_0x1391a2){var _0x2ffffa;var _0xf4ec55={},_0x3feebb={};_0x3feebb[_0xed87('0x33')]=_[_0xed87('0x30')](db[_0xed87('0x52')]['rawAttributes']);_0x3feebb[_0xed87('0x34')]=_[_0xed87('0x30')](_0x4dd840[_0xed87('0x34')]);_0x3feebb[_0xed87('0x31')]=_[_0xed87('0x32')](_0x3feebb[_0xed87('0x33')],_0x3feebb[_0xed87('0x34')]);_0xf4ec55[_0xed87('0x35')]=_['intersection'](_0x3feebb[_0xed87('0x33')],qs[_0xed87('0x36')](_0x4dd840[_0xed87('0x34')][_0xed87('0x36')]));_0xf4ec55[_0xed87('0x35')]=_0xf4ec55[_0xed87('0x35')]['length']?_0xf4ec55['attributes']:_0x3feebb[_0xed87('0x33')];if(!_0x4dd840[_0xed87('0x34')][_0xed87('0x53')](_0xed87('0x38'))){_0xf4ec55[_0xed87('0x1e')]=qs[_0xed87('0x1e')](_0x4dd840[_0xed87('0x34')][_0xed87('0x1e')]);_0xf4ec55['offset']=qs[_0xed87('0x1c')](_0x4dd840['query'][_0xed87('0x1c')]);}_0xf4ec55[_0xed87('0x39')]=qs['sort'](_0x4dd840[_0xed87('0x34')][_0xed87('0x54')]);_0xf4ec55['where']=qs[_0xed87('0x31')](_[_0xed87('0x3b')](_0x4dd840[_0xed87('0x34')],_0x3feebb[_0xed87('0x31')]));if(_0x4dd840[_0xed87('0x34')]['filter']){_0xf4ec55[_0xed87('0x3a')]=_[_0xed87('0x3d')](_0xf4ec55[_0xed87('0x3a')],{'$or':_[_0xed87('0x2a')](_0xf4ec55['attributes'],function(_0x58279a){var _0x3a6ab6={};_0x3a6ab6[_0x58279a]={'$like':'%'+_0x4dd840[_0xed87('0x34')]['filter']+'%'};return _0x3a6ab6;})});}_0xf4ec55[_0xed87('0x3a')]=_[_0xed87('0x3d')](_0xf4ec55[_0xed87('0x3a')],{'mailboxuser':_0x1391a2[_0xed87('0x55')]});_0xf4ec55=_[_0xed87('0x3d')]({},_0xf4ec55,_0x4dd840[_0xed87('0x3f')]);return db[_0xed87('0x52')][_0xed87('0x56')](_0xf4ec55)[_0xed87('0x23')](respondWithFilteredResult(_0x7e6738,_0xf4ec55));})[_0xed87('0x45')](handleError(_0x7e6738,null));}; \ No newline at end of file +var _0xe605=['count','set','Content-Range','apply','save','update','then','destroy','Voicemails','UserProfileResource','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceMail','findAll','rows','show','params','intersection','find','catch','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x26d51f,_0x1de895){var _0x48305d=function(_0x13652a){while(--_0x13652a){_0x26d51f['push'](_0x26d51f['shift']());}};_0x48305d(++_0x1de895);}(_0xe605,0x92));var _0x5e60=function(_0x1676bf,_0x1e1a91){_0x1676bf=_0x1676bf-0x0;var _0x146ff4=_0xe605[_0x1676bf];return _0x146ff4;};'use strict';var emlformat=require(_0x5e60('0x0'));var rimraf=require(_0x5e60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e60('0x2'));var rp=require(_0x5e60('0x3'));var moment=require(_0x5e60('0x4'));var BPromise=require(_0x5e60('0x5'));var Mustache=require(_0x5e60('0x6'));var util=require(_0x5e60('0x7'));var path=require(_0x5e60('0x8'));var sox=require(_0x5e60('0x9'));var csv=require(_0x5e60('0xa'));var ejs=require(_0x5e60('0xb'));var fs=require('fs');var fs_extra=require(_0x5e60('0xc'));var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require(_0x5e60('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x371df7,_0x178782){_0x178782=_0x178782||0xcc;return function(_0x1f4e14){if(_0x1f4e14){return _0x371df7[_0x5e60('0x19')](_0x178782);}return _0x371df7[_0x5e60('0x1a')](_0x178782)[_0x5e60('0x1b')]();};}function respondWithResult(_0x4fd10e,_0x209adb){_0x209adb=_0x209adb||0xc8;return function(_0x45304f){if(_0x45304f){return _0x4fd10e[_0x5e60('0x1a')](_0x209adb)[_0x5e60('0x1c')](_0x45304f);}};}function respondWithFilteredResult(_0x5b028f,_0x20af5f){return function(_0x529ffe){if(_0x529ffe){var _0x1ffd77=typeof _0x20af5f[_0x5e60('0x1d')]==='undefined'&&typeof _0x20af5f[_0x5e60('0x1e')]===_0x5e60('0x1f');var _0xaa7d05=_0x529ffe[_0x5e60('0x20')];var _0x5c485d=_0x1ffd77?0x0:_0x20af5f[_0x5e60('0x1d')];var _0x22d718=_0x1ffd77?_0x529ffe['count']:_0x20af5f[_0x5e60('0x1d')]+_0x20af5f[_0x5e60('0x1e')];var _0x17c630;if(_0x22d718>=_0xaa7d05){_0x22d718=_0xaa7d05;_0x17c630=0xc8;}else{_0x17c630=0xce;}_0x5b028f[_0x5e60('0x1a')](_0x17c630);return _0x5b028f[_0x5e60('0x21')](_0x5e60('0x22'),_0x5c485d+'-'+_0x22d718+'/'+_0xaa7d05)[_0x5e60('0x1c')](_0x529ffe);}return null;};}function patchUpdates(_0x524c93){return function(_0x3282e4){try{jsonpatch[_0x5e60('0x23')](_0x3282e4,_0x524c93,!![]);}catch(_0x228f13){return BPromise['reject'](_0x228f13);}return _0x3282e4[_0x5e60('0x24')]();};}function saveUpdates(_0x5d77dd,_0x376069){return function(_0x1a44e5){if(_0x1a44e5){return _0x1a44e5[_0x5e60('0x25')](_0x5d77dd)[_0x5e60('0x26')](function(_0x34e98d){return _0x34e98d;});}return null;};}function removeEntity(_0x2a499e,_0x2636f1){return function(_0x5d2c03){if(_0x5d2c03){return _0x5d2c03[_0x5e60('0x27')]()[_0x5e60('0x26')](function(){var _0x19f37b=_0x5d2c03['get']({'plain':!![]});var _0x45cb62=_0x5e60('0x28');return db[_0x5e60('0x29')][_0x5e60('0x27')]({'where':{'type':_0x45cb62,'resourceId':_0x19f37b['id']}})['then'](function(){return _0x5d2c03;});})[_0x5e60('0x26')](function(){_0x2a499e['status'](0xcc)[_0x5e60('0x1b')]();});}};}function handleEntityNotFound(_0x221322,_0x4ba727){return function(_0x46691f){if(!_0x46691f){_0x221322[_0x5e60('0x19')](0x194);}return _0x46691f;};}function handleError(_0x5b1b46,_0x1ee931){_0x1ee931=_0x1ee931||0x1f4;return function(_0xac9c7a){logger['error'](_0xac9c7a['stack']);if(_0xac9c7a['name']){delete _0xac9c7a[_0x5e60('0x2a')];}_0x5b1b46[_0x5e60('0x1a')](_0x1ee931)[_0x5e60('0x2b')](_0xac9c7a);};}exports[_0x5e60('0x2c')]=function(_0x3ccfee,_0x558197){var _0x168ce6={},_0x405461={},_0x4d4b55={'count':0x0,'rows':[]};var _0x11fc87=_['map'](db['VoiceMail'][_0x5e60('0x2d')],function(_0x3c4340){return{'name':_0x3c4340[_0x5e60('0x2e')],'type':_0x3c4340[_0x5e60('0x2f')][_0x5e60('0x30')]};});_0x405461[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x11fc87,_0x5e60('0x2a'));_0x405461[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x3ccfee['query']);_0x405461[_0x5e60('0x35')]=_['intersection'](_0x405461['model'],_0x405461[_0x5e60('0x33')]);_0x168ce6[_0x5e60('0x36')]=_['intersection'](_0x405461[_0x5e60('0x31')],qs['fields'](_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x37')]));_0x168ce6[_0x5e60('0x36')]=_0x168ce6[_0x5e60('0x36')][_0x5e60('0x38')]?_0x168ce6[_0x5e60('0x36')]:_0x405461[_0x5e60('0x31')];if(!_0x3ccfee[_0x5e60('0x33')]['hasOwnProperty'](_0x5e60('0x39'))){_0x168ce6[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x1e')]);_0x168ce6[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x3ccfee['query'][_0x5e60('0x1d')]);}_0x168ce6[_0x5e60('0x3a')]=qs['sort'](_0x3ccfee['query'][_0x5e60('0x3b')]);_0x168ce6[_0x5e60('0x3c')]=qs[_0x5e60('0x35')](_[_0x5e60('0x3d')](_0x3ccfee[_0x5e60('0x33')],_0x405461['filters']),_0x11fc87);if(_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x3e')]){_0x168ce6[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x168ce6[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x32')](_0x11fc87,function(_0x2b635a){if(_0x2b635a['type']!==_0x5e60('0x40')){var _0x1f95b2={};_0x1f95b2[_0x2b635a['name']]={'$like':'%'+_0x3ccfee['query']['filter']+'%'};return _0x1f95b2;}})});}_0x168ce6=_[_0x5e60('0x3f')]({},_0x168ce6,_0x3ccfee[_0x5e60('0x41')]);var _0x2c6d5b={'where':_0x168ce6[_0x5e60('0x3c')]};return db['VoiceMail'][_0x5e60('0x20')](_0x2c6d5b)[_0x5e60('0x26')](function(_0x4b6192){_0x4d4b55['count']=_0x4b6192;if(_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x42')]){_0x168ce6[_0x5e60('0x43')]=[{'all':!![]}];}return db[_0x5e60('0x44')][_0x5e60('0x45')](_0x168ce6);})[_0x5e60('0x26')](function(_0x2522d2){_0x4d4b55[_0x5e60('0x46')]=_0x2522d2;return _0x4d4b55;})[_0x5e60('0x26')](respondWithFilteredResult(_0x558197,_0x168ce6))['catch'](handleError(_0x558197,null));};exports[_0x5e60('0x47')]=function(_0x2bb154,_0x59a2eb){var _0x1b1567={'raw':!![],'where':{'id':_0x2bb154[_0x5e60('0x48')]['id']}},_0x4aac07={};_0x4aac07[_0x5e60('0x31')]=_[_0x5e60('0x34')](db['VoiceMail'][_0x5e60('0x2d')]);_0x4aac07[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x2bb154[_0x5e60('0x33')]);_0x4aac07['filters']=_['intersection'](_0x4aac07['model'],_0x4aac07[_0x5e60('0x33')]);_0x1b1567[_0x5e60('0x36')]=_[_0x5e60('0x49')](_0x4aac07[_0x5e60('0x31')],qs[_0x5e60('0x37')](_0x2bb154[_0x5e60('0x33')]['fields']));_0x1b1567[_0x5e60('0x36')]=_0x1b1567[_0x5e60('0x36')][_0x5e60('0x38')]?_0x1b1567[_0x5e60('0x36')]:_0x4aac07[_0x5e60('0x31')];if(_0x2bb154[_0x5e60('0x33')][_0x5e60('0x42')]){_0x1b1567['include']=[{'all':!![]}];}_0x1b1567=_[_0x5e60('0x3f')]({},_0x1b1567,_0x2bb154[_0x5e60('0x41')]);return db[_0x5e60('0x44')][_0x5e60('0x4a')](_0x1b1567)[_0x5e60('0x26')](handleEntityNotFound(_0x59a2eb,null))[_0x5e60('0x26')](respondWithResult(_0x59a2eb,null))[_0x5e60('0x4b')](handleError(_0x59a2eb,null));};exports[_0x5e60('0x4c')]=function(_0x1518bd,_0x350d6d){return db[_0x5e60('0x44')][_0x5e60('0x4c')](_0x1518bd[_0x5e60('0x4d')],{})[_0x5e60('0x26')](function(_0x1aa381){var _0x176ef3=_0x1518bd[_0x5e60('0x4e')][_0x5e60('0x4f')]({'plain':!![]});if(!_0x176ef3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x176ef3['role']===_0x5e60('0x4e')){var _0x4d3588=_0x1aa381[_0x5e60('0x4f')]({'plain':!![]});var _0x1d247e=_0x5e60('0x28');return db[_0x5e60('0x50')][_0x5e60('0x4a')]({'where':{'name':_0x1d247e,'userProfileId':_0x176ef3[_0x5e60('0x51')]},'raw':!![]})['then'](function(_0x48bea6){if(_0x48bea6&&_0x48bea6[_0x5e60('0x52')]===0x0){return db[_0x5e60('0x29')][_0x5e60('0x4c')]({'name':_0x4d3588['name'],'resourceId':_0x4d3588['id'],'type':_0x48bea6['name'],'sectionId':_0x48bea6['id']},{})[_0x5e60('0x26')](function(){return _0x1aa381;});}else{return _0x1aa381;}})[_0x5e60('0x4b')](function(_0x179cc6){logger['error'](_0x5e60('0x53'),_0x179cc6);throw _0x179cc6;});}return _0x1aa381;})[_0x5e60('0x26')](respondWithResult(_0x350d6d,0xc9))[_0x5e60('0x4b')](handleError(_0x350d6d,null));};exports[_0x5e60('0x25')]=function(_0x17d002,_0x148204){if(_0x17d002['body']['id']){delete _0x17d002[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x44')]['find']({'where':{'id':_0x17d002[_0x5e60('0x48')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x148204,null))[_0x5e60('0x26')](saveUpdates(_0x17d002['body'],null))[_0x5e60('0x26')](respondWithResult(_0x148204,null))[_0x5e60('0x4b')](handleError(_0x148204,null));};exports['destroy']=function(_0x26e129,_0x367208){return db[_0x5e60('0x44')][_0x5e60('0x4a')]({'where':{'id':_0x26e129['params']['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x367208,null))[_0x5e60('0x26')](removeEntity(_0x367208,null))['catch'](handleError(_0x367208,null));};exports[_0x5e60('0x54')]=function(_0x4cb322,_0x8d00b9,_0x5220fc){return db[_0x5e60('0x44')][_0x5e60('0x55')]({'where':{'id':_0x4cb322['params']['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x8d00b9,null))['then'](function(_0x1a2094){var _0x566fc7;var _0x157787={},_0x5b4daa={};_0x5b4daa[_0x5e60('0x31')]=_[_0x5e60('0x34')](db[_0x5e60('0x56')][_0x5e60('0x2d')]);_0x5b4daa[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x4cb322[_0x5e60('0x33')]);_0x5b4daa['filters']=_[_0x5e60('0x49')](_0x5b4daa[_0x5e60('0x31')],_0x5b4daa[_0x5e60('0x33')]);_0x157787[_0x5e60('0x36')]=_[_0x5e60('0x49')](_0x5b4daa[_0x5e60('0x31')],qs['fields'](_0x4cb322['query']['fields']));_0x157787[_0x5e60('0x36')]=_0x157787[_0x5e60('0x36')]['length']?_0x157787[_0x5e60('0x36')]:_0x5b4daa[_0x5e60('0x31')];if(!_0x4cb322['query'][_0x5e60('0x57')](_0x5e60('0x39'))){_0x157787[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x1e')]);_0x157787[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x1d')]);}_0x157787[_0x5e60('0x3a')]=qs[_0x5e60('0x3b')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3b')]);_0x157787[_0x5e60('0x3c')]=qs[_0x5e60('0x35')](_[_0x5e60('0x3d')](_0x4cb322['query'],_0x5b4daa[_0x5e60('0x35')]));if(_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3e')]){_0x157787['where']=_[_0x5e60('0x3f')](_0x157787[_0x5e60('0x3c')],{'$or':_['map'](_0x157787[_0x5e60('0x36')],function(_0x6f4d2f){var _0x5bbaaf={};_0x5bbaaf[_0x6f4d2f]={'$like':'%'+_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3e')]+'%'};return _0x5bbaaf;})});}_0x157787[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x157787[_0x5e60('0x3c')],{'mailboxuser':_0x1a2094[_0x5e60('0x58')]});_0x157787=_[_0x5e60('0x3f')]({},_0x157787,_0x4cb322[_0x5e60('0x41')]);return db[_0x5e60('0x56')]['findAndCountAll'](_0x157787)[_0x5e60('0x26')](respondWithFilteredResult(_0x8d00b9,_0x157787));})[_0x5e60('0x4b')](handleError(_0x8d00b9,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 48bfd7e..dd39fbb 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 _0x4183=['context','lodash','../../config/logger','moment','path','rimraf','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x5bd838,_0x25ef66){var _0x41ee1b=function(_0x4171d2){while(--_0x4171d2){_0x5bd838['push'](_0x5bd838['shift']());}};_0x41ee1b(++_0x25ef66);}(_0x4183,0x109));var _0x3418=function(_0x2dcc0f,_0x4c72f2){_0x2dcc0f=_0x2dcc0f-0x0;var _0x44443f=_0x4183[_0x2dcc0f];return _0x44443f;};'use strict';var _=require(_0x3418('0x0'));var util=require('util');var logger=require(_0x3418('0x1'))('api');var moment=require(_0x3418('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3418('0x3'));var rimraf=require(_0x3418('0x4'));var config=require('../../config/environment');var attributes=require(_0x3418('0x5'));module[_0x3418('0x6')]=function(_0x1d7bf6,_0x239006){return _0x1d7bf6['define'](_0x3418('0x7'),attributes,{'tableName':_0x3418('0x8'),'paranoid':![],'indexes':[{'name':_0x3418('0x9'),'fields':['mailbox',_0x3418('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x69ee=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x69ee,0x11c));var _0xe69e=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x69ee[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xe69e('0x0'));var util=require('util');var logger=require(_0xe69e('0x1'))(_0xe69e('0x2'));var moment=require(_0xe69e('0x3'));var BPromise=require(_0xe69e('0x4'));var rp=require(_0xe69e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe69e('0x6'));var config=require(_0xe69e('0x7'));var attributes=require(_0xe69e('0x8'));module[_0xe69e('0x9')]=function(_0x3932de,_0x63e4ff){return _0x3932de[_0xe69e('0xa')](_0xe69e('0xb'),attributes,{'tableName':_0xe69e('0xc'),'paranoid':![],'indexes':[{'name':_0xe69e('0xd'),'fields':[_0xe69e('0xe'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 8d98695..9f0c02d 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 _0xae0e=['../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x4c0a89,_0x27d1a9){var _0x2e12e7=function(_0xedb834){while(--_0xedb834){_0x4c0a89['push'](_0x4c0a89['shift']());}};_0x2e12e7(++_0x27d1a9);}(_0xae0e,0x1de));var _0xeae0=function(_0x5ee6c8,_0x300382){_0x5ee6c8=_0x5ee6c8-0x0;var _0xb061cc=_0xae0e[_0x5ee6c8];return _0xb061cc;};'use strict';var _=require('lodash');var util=require(_0xeae0('0x0'));var moment=require(_0xeae0('0x1'));var BPromise=require(_0xeae0('0x2'));var rs=require(_0xeae0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeae0('0x4'));var logger=require(_0xeae0('0x5'))(_0xeae0('0x6'));var config=require('../../config/environment');var jayson=require(_0xeae0('0x7'));var client=jayson[_0xeae0('0x8')][_0xeae0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x415fd4,_0x40a4c,_0x361b96){return new BPromise(function(_0x381e16,_0x2ed453){return client['request'](_0x415fd4,_0x361b96)[_0xeae0('0xa')](function(_0x4d6e0f){logger[_0xeae0('0xb')](_0xeae0('0xc'),_0x40a4c,_0xeae0('0xd'));logger[_0xeae0('0xe')](_0xeae0('0xf'),_0x40a4c,_0xeae0('0xd'),JSON[_0xeae0('0x10')](_0x4d6e0f));if(_0x4d6e0f[_0xeae0('0x11')]){if(_0x4d6e0f[_0xeae0('0x11')]['code']===0x1f4){logger[_0xeae0('0x11')](_0xeae0('0xc'),_0x40a4c,_0x4d6e0f[_0xeae0('0x11')][_0xeae0('0x12')]);return _0x2ed453(_0x4d6e0f['error'][_0xeae0('0x12')]);}logger[_0xeae0('0x11')](_0xeae0('0xc'),_0x40a4c,_0x4d6e0f[_0xeae0('0x11')][_0xeae0('0x12')]);return _0x381e16(_0x4d6e0f['error'][_0xeae0('0x12')]);}else{logger[_0xeae0('0xb')](_0xeae0('0xc'),_0x40a4c,_0xeae0('0xd'));_0x381e16(_0x4d6e0f[_0xeae0('0x13')]['message']);}})[_0xeae0('0x14')](function(_0x45e94b){logger[_0xeae0('0x11')](_0xeae0('0xc'),_0x40a4c,_0x45e94b);_0x2ed453(_0x45e94b);});});} \ No newline at end of file +var _0xd37a=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','info','catch','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd37a,0xe4));var _0xad37=function(_0x537dc8,_0x500f51){_0x537dc8=_0x537dc8-0x0;var _0xb6fed7=_0xd37a[_0x537dc8];return _0xb6fed7;};'use strict';var _=require(_0xad37('0x0'));var util=require(_0xad37('0x1'));var moment=require(_0xad37('0x2'));var BPromise=require(_0xad37('0x3'));var rs=require(_0xad37('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad37('0x5'))['db'];var utils=require(_0xad37('0x6'));var logger=require(_0xad37('0x7'))(_0xad37('0x8'));var config=require('../../config/environment');var jayson=require(_0xad37('0x9'));var client=jayson[_0xad37('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24c861,_0x27b6df,_0x47e61a){return new BPromise(function(_0x185925,_0x12fbf6){return client[_0xad37('0xb')](_0x24c861,_0x47e61a)[_0xad37('0xc')](function(_0x4f7b3b){logger['info']('VoiceMail,\x20%s,\x20%s',_0x27b6df,_0xad37('0xd'));logger[_0xad37('0xe')](_0xad37('0xf'),_0x27b6df,_0xad37('0xd'),JSON[_0xad37('0x10')](_0x4f7b3b));if(_0x4f7b3b['error']){if(_0x4f7b3b[_0xad37('0x11')][_0xad37('0x12')]===0x1f4){logger[_0xad37('0x11')](_0xad37('0x13'),_0x27b6df,_0x4f7b3b['error'][_0xad37('0x14')]);return _0x12fbf6(_0x4f7b3b[_0xad37('0x11')][_0xad37('0x14')]);}logger[_0xad37('0x11')](_0xad37('0x13'),_0x27b6df,_0x4f7b3b['error']['message']);return _0x185925(_0x4f7b3b[_0xad37('0x11')][_0xad37('0x14')]);}else{logger[_0xad37('0x15')](_0xad37('0x13'),_0x27b6df,_0xad37('0xd'));_0x185925(_0x4f7b3b['result'][_0xad37('0x14')]);}})[_0xad37('0x16')](function(_0x1a7c39){logger[_0xad37('0x11')](_0xad37('0x13'),_0x27b6df,_0x1a7c39);_0x12fbf6(_0x1a7c39);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index dc8afe0..66fbb58 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 _0x3686=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x577683,_0x14b55c){var _0x316810=function(_0x1697e1){while(--_0x1697e1){_0x577683['push'](_0x577683['shift']());}};_0x316810(++_0x14b55c);}(_0x3686,0xc6));var _0x6368=function(_0x44d99d,_0x3c0d7b){_0x44d99d=_0x44d99d-0x0;var _0xa63afd=_0x3686[_0x44d99d];return _0xa63afd;};'use strict';var multer=require(_0x6368('0x0'));var util=require(_0x6368('0x1'));var path=require('path');var timeout=require(_0x6368('0x2'));var express=require(_0x6368('0x3'));var router=express[_0x6368('0x4')]();var fs_extra=require(_0x6368('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6368('0x6'));var config=require(_0x6368('0x7'));var controller=require(_0x6368('0x8'));router[_0x6368('0x9')]('/',auth['isAuthenticated'](),controller[_0x6368('0xa')]);router[_0x6368('0x9')](_0x6368('0xb'),auth[_0x6368('0xc')](),controller['show']);router[_0x6368('0x9')]('/:id/download',auth[_0x6368('0xc')](),controller['download']);router[_0x6368('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6368('0xb'),auth[_0x6368('0xc')](),controller['update']);router[_0x6368('0xe')]('/:id',auth[_0x6368('0xc')](),controller[_0x6368('0xf')]);module[_0x6368('0x10')]=router; \ No newline at end of file +var _0x4fa3=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','download','post','create','update','delete','/:id','multer','util','path'];(function(_0x50fa33,_0x57d4dc){var _0x867bfa=function(_0x1ec4dd){while(--_0x1ec4dd){_0x50fa33['push'](_0x50fa33['shift']());}};_0x867bfa(++_0x57d4dc);}(_0x4fa3,0xa8));var _0x34fa=function(_0x2e4cbf,_0x8763d3){_0x2e4cbf=_0x2e4cbf-0x0;var _0x52840f=_0x4fa3[_0x2e4cbf];return _0x52840f;};'use strict';var multer=require(_0x34fa('0x0'));var util=require(_0x34fa('0x1'));var path=require(_0x34fa('0x2'));var timeout=require(_0x34fa('0x3'));var express=require(_0x34fa('0x4'));var router=express[_0x34fa('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x34fa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x34fa('0x7'));var controller=require('./voiceMailMessage.controller');router[_0x34fa('0x8')]('/',auth[_0x34fa('0x9')](),controller[_0x34fa('0xa')]);router[_0x34fa('0x8')]('/:id',auth[_0x34fa('0x9')](),controller[_0x34fa('0xb')]);router[_0x34fa('0x8')](_0x34fa('0xc'),auth['isAuthenticated'](),controller[_0x34fa('0xd')]);router[_0x34fa('0xe')]('/',auth['isAuthenticated'](),controller[_0x34fa('0xf')]);router['put']('/:id',auth[_0x34fa('0x9')](),controller[_0x34fa('0x10')]);router[_0x34fa('0x11')](_0x34fa('0x12'),auth[_0x34fa('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 0233a42..99f263c 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 _0x63eb=['sequelize','exports','getDataValue','INTEGER','STRING','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x63eb,0xe0));var _0xb63e=function(_0x34fdce,_0x302224){_0x34fdce=_0x34fdce-0x0;var _0x3c869a=_0x63eb[_0x34fdce];return _0x3c869a;};'use strict';var Sequelize=require(_0xb63e('0x0'));module[_0xb63e('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5e98fd){return this[_0xb63e('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xb63e('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb63e('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xb63e('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb63e('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xb63e('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb63e('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb63e('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xb63e('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb63e('0x4')],'defaultValue':''},'stamp':{'type':_0xb63e('0x5'),'defaultValue':Sequelize[_0xb63e('0x6')](_0xb63e('0x7'))}}; \ No newline at end of file +var _0x98be=['VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','sequelize','exports'];(function(_0x1dbc6a,_0x50786a){var _0x9c84fe=function(_0x5e314c){while(--_0x5e314c){_0x1dbc6a['push'](_0x1dbc6a['shift']());}};_0x9c84fe(++_0x50786a);}(_0x98be,0x120));var _0xe98b=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x98be[_0x456fb1];return _0x4083d6;};'use strict';var Sequelize=require(_0xe98b('0x0'));module[_0xe98b('0x1')]={'name':{'type':Sequelize[_0xe98b('0x2')],'get':function(_0x257be4){return this[_0xe98b('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xe98b('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xe98b('0x6')](_0xe98b('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'stamp':{'type':_0xe98b('0x8'),'defaultValue':Sequelize[_0xe98b('0x9')]('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 f2ac58a..ea1f5e2 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 _0x882d=['nolimit','order','sort','filter','where','merge','options','includeAll','include','rows','catch','find','create','body','params','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','differenceBy','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x29771f,_0x1189ae){var _0x279baf=function(_0xd66325){while(--_0xd66325){_0x29771f['push'](_0x29771f['shift']());}};_0x279baf(++_0x1189ae);}(_0x882d,0x16c));var _0xd882=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0x882d[_0x2d91c6];return _0x3a8d19;};'use strict';var emlformat=require(_0xd882('0x0'));var rimraf=require(_0xd882('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd882('0x2'));var rp=require(_0xd882('0x3'));var moment=require(_0xd882('0x4'));var BPromise=require(_0xd882('0x5'));var Mustache=require(_0xd882('0x6'));var util=require(_0xd882('0x7'));var path=require(_0xd882('0x8'));var sox=require(_0xd882('0x9'));var csv=require(_0xd882('0xa'));var ejs=require(_0xd882('0xb'));var fs=require('fs');var fs_extra=require(_0xd882('0xc'));var _=require(_0xd882('0xd'));var squel=require(_0xd882('0xe'));var crypto=require('crypto');var jsforce=require(_0xd882('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd882('0xa'));var querystring=require('querystring');var Papa=require(_0xd882('0x10'));var Redis=require(_0xd882('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd882('0x12'));var logger=require(_0xd882('0x13'))(_0xd882('0x14'));var utils=require(_0xd882('0x15'));var config=require(_0xd882('0x16'));var licenseUtil=require(_0xd882('0x17'));var db=require(_0xd882('0x18'))['db'];function respondWithStatusCode(_0xa23a6,_0x493a5d){_0x493a5d=_0x493a5d||0xcc;return function(_0x56cc8c){if(_0x56cc8c){return _0xa23a6[_0xd882('0x19')](_0x493a5d);}return _0xa23a6[_0xd882('0x1a')](_0x493a5d)[_0xd882('0x1b')]();};}function respondWithResult(_0x43fa0a,_0x28ac52){_0x28ac52=_0x28ac52||0xc8;return function(_0x5cdb02){if(_0x5cdb02){return _0x43fa0a[_0xd882('0x1a')](_0x28ac52)[_0xd882('0x1c')](_0x5cdb02);}};}function respondWithFilteredResult(_0x38b6dc,_0x23d08a){return function(_0x2525fa){if(_0x2525fa){var _0x3705f9=typeof _0x23d08a[_0xd882('0x1d')]===_0xd882('0x1e')&&typeof _0x23d08a[_0xd882('0x1f')]===_0xd882('0x1e');var _0x4c2494=_0x2525fa[_0xd882('0x20')];var _0x148c7a=_0x3705f9?0x0:_0x23d08a[_0xd882('0x1d')];var _0x182b7a=_0x3705f9?_0x2525fa[_0xd882('0x20')]:_0x23d08a['offset']+_0x23d08a['limit'];var _0x37b3f0;if(_0x182b7a>=_0x4c2494){_0x182b7a=_0x4c2494;_0x37b3f0=0xc8;}else{_0x37b3f0=0xce;}_0x38b6dc['status'](_0x37b3f0);return _0x38b6dc[_0xd882('0x21')](_0xd882('0x22'),_0x148c7a+'-'+_0x182b7a+'/'+_0x4c2494)[_0xd882('0x1c')](_0x2525fa);}return null;};}function patchUpdates(_0x10045c){return function(_0x10d32f){try{jsonpatch[_0xd882('0x23')](_0x10d32f,_0x10045c,!![]);}catch(_0x23c666){return BPromise[_0xd882('0x24')](_0x23c666);}return _0x10d32f[_0xd882('0x25')]();};}function saveUpdates(_0x1dbf65,_0x10dde8){return function(_0x5c5c80){if(_0x5c5c80){return _0x5c5c80[_0xd882('0x26')](_0x1dbf65)['then'](function(_0x31f5a6){return _0x31f5a6;});}return null;};}function removeEntity(_0xab40,_0x26a1ca){return function(_0x1255b3){if(_0x1255b3){return _0x1255b3[_0xd882('0x27')]()[_0xd882('0x28')](function(){_0xab40[_0xd882('0x1a')](0xcc)[_0xd882('0x1b')]();});}};}function handleEntityNotFound(_0x55d856,_0xc3471a){return function(_0x28773e){if(!_0x28773e){_0x55d856['sendStatus'](0x194);}return _0x28773e;};}function handleError(_0x571eca,_0x26ba79){_0x26ba79=_0x26ba79||0x1f4;return function(_0x422d23){logger[_0xd882('0x29')](_0x422d23[_0xd882('0x2a')]);if(_0x422d23[_0xd882('0x2b')]){delete _0x422d23[_0xd882('0x2b')];}_0x571eca[_0xd882('0x1a')](_0x26ba79)[_0xd882('0x2c')](_0x422d23);};}exports[_0xd882('0x2d')]=function(_0x1fc047,_0x199010){var _0x505743={},_0x437ccc={},_0x2a3225={'count':0x0,'rows':[]};var _0x1c53c4=_[_0xd882('0x2e')](db[_0xd882('0x2f')][_0xd882('0x30')],function(_0x5e4b16){return{'name':_0x5e4b16[_0xd882('0x31')],'type':_0x5e4b16[_0xd882('0x32')]['key']};});_0x437ccc['model']=_[_0xd882('0x33')](_['map'](_0x1c53c4,_0xd882('0x2b')),[_0xd882('0x2b')]);_0x437ccc[_0xd882('0x34')]=_[_0xd882('0x35')](_0x1fc047[_0xd882('0x34')]);_0x437ccc[_0xd882('0x36')]=_['intersection'](_0x437ccc[_0xd882('0x37')],_0x437ccc[_0xd882('0x34')]);_0x505743[_0xd882('0x38')]=_[_0xd882('0x39')](_0x437ccc[_0xd882('0x37')],qs[_0xd882('0x3a')](_0x1fc047['query']['fields']));_0x505743[_0xd882('0x38')]=_0x505743['attributes'][_0xd882('0x3b')]?_0x505743[_0xd882('0x38')]:_0x437ccc['model'];if(!_0x1fc047[_0xd882('0x34')][_0xd882('0x3c')](_0xd882('0x3d'))){_0x505743[_0xd882('0x1f')]=qs[_0xd882('0x1f')](_0x1fc047['query']['limit']);_0x505743[_0xd882('0x1d')]=qs['offset'](_0x1fc047[_0xd882('0x34')][_0xd882('0x1d')]);}_0x505743[_0xd882('0x3e')]=qs[_0xd882('0x3f')](_0x1fc047[_0xd882('0x34')][_0xd882('0x3f')]);_0x505743['where']=qs['filters'](_['pick'](_0x1fc047['query'],_0x437ccc['filters']),_0x1c53c4);if(_0x1fc047[_0xd882('0x34')][_0xd882('0x40')]){_0x505743[_0xd882('0x41')]=_['merge'](_0x505743[_0xd882('0x41')],{'$or':_[_0xd882('0x2e')](_0x1c53c4,function(_0x354768){if(_0x354768[_0xd882('0x32')]!=='VIRTUAL'){var _0x536c6a={};_0x536c6a[_0x354768[_0xd882('0x2b')]]={'$like':'%'+_0x1fc047[_0xd882('0x34')]['filter']+'%'};return _0x536c6a;}})});}_0x505743=_[_0xd882('0x42')]({},_0x505743,_0x1fc047[_0xd882('0x43')]);var _0x5f4617={'where':_0x505743['where']};return db[_0xd882('0x2f')][_0xd882('0x20')](_0x5f4617)[_0xd882('0x28')](function(_0x1886db){_0x2a3225[_0xd882('0x20')]=_0x1886db;if(_0x1fc047[_0xd882('0x34')][_0xd882('0x44')]){_0x505743[_0xd882('0x45')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x505743);})['then'](function(_0x338496){_0x2a3225[_0xd882('0x46')]=_0x338496;return _0x2a3225;})[_0xd882('0x28')](respondWithFilteredResult(_0x199010,_0x505743))[_0xd882('0x47')](handleError(_0x199010,null));};exports['show']=function(_0x5f5f64,_0x553bfd){var _0x3eba0e={'raw':!![],'where':{'id':_0x5f5f64['params']['id']}},_0x12590a={};_0x12590a[_0xd882('0x37')]=_['keys'](db[_0xd882('0x2f')][_0xd882('0x30')]);_0x12590a[_0xd882('0x34')]=_[_0xd882('0x35')](_0x5f5f64[_0xd882('0x34')]);_0x12590a[_0xd882('0x36')]=_[_0xd882('0x39')](_0x12590a[_0xd882('0x37')],_0x12590a[_0xd882('0x34')]);_0x3eba0e['attributes']=_[_0xd882('0x39')](_0x12590a[_0xd882('0x37')],qs[_0xd882('0x3a')](_0x5f5f64[_0xd882('0x34')]['fields']));_0x3eba0e['attributes']=_0x3eba0e[_0xd882('0x38')][_0xd882('0x3b')]?_0x3eba0e[_0xd882('0x38')]:_0x12590a[_0xd882('0x37')];if(_0x5f5f64[_0xd882('0x34')][_0xd882('0x44')]){_0x3eba0e[_0xd882('0x45')]=[{'all':!![]}];}_0x3eba0e=_[_0xd882('0x42')]({},_0x3eba0e,_0x5f5f64[_0xd882('0x43')]);return db[_0xd882('0x2f')][_0xd882('0x48')](_0x3eba0e)[_0xd882('0x28')](handleEntityNotFound(_0x553bfd,null))[_0xd882('0x28')](respondWithResult(_0x553bfd,null))[_0xd882('0x47')](handleError(_0x553bfd,null));};exports[_0xd882('0x49')]=function(_0xef3fae,_0x5e3ead){return db[_0xd882('0x2f')][_0xd882('0x49')](_0xef3fae[_0xd882('0x4a')],{})['then'](respondWithResult(_0x5e3ead,0xc9))['catch'](handleError(_0x5e3ead,null));};exports['update']=function(_0x2fe110,_0xe3bf1a){if(_0x2fe110[_0xd882('0x4a')]['id']){delete _0x2fe110[_0xd882('0x4a')]['id'];}return db[_0xd882('0x2f')][_0xd882('0x48')]({'where':{'id':_0x2fe110['params']['id']}})['then'](handleEntityNotFound(_0xe3bf1a,null))[_0xd882('0x28')](saveUpdates(_0x2fe110[_0xd882('0x4a')],null))[_0xd882('0x28')](respondWithResult(_0xe3bf1a,null))[_0xd882('0x47')](handleError(_0xe3bf1a,null));};exports[_0xd882('0x27')]=function(_0x5c21ac,_0x3dbeb7){return db[_0xd882('0x2f')][_0xd882('0x48')]({'where':{'id':_0x5c21ac[_0xd882('0x4b')]['id']}})[_0xd882('0x28')](handleEntityNotFound(_0x3dbeb7,null))[_0xd882('0x28')](removeEntity(_0x3dbeb7,null))[_0xd882('0x47')](handleError(_0x3dbeb7,null));};exports[_0xd882('0x4c')]=function(_0x52b70a,_0x3e9e2c,_0x51eea1){return db[_0xd882('0x2f')][_0xd882('0x48')]({'where':{'id':_0x52b70a['params']['id']},'attributes':['id',_0xd882('0x4d'),_0xd882('0x4e')]})['then'](handleEntityNotFound(_0x3e9e2c,null))[_0xd882('0x28')](function(_0x30d6ae){if(_0x30d6ae){if(!_0x30d6ae[_0xd882('0x4d')]){throw new db['Sequelize'][(_0xd882('0x4f'))](_0xd882('0x50'));}var _0x2283fa={'Content-Type':_0xd882('0x51'),'Content-Disposition':'attachment'};if(_0x30d6ae['msg_id']){_0x2283fa[_0xd882('0x52')]=_0xd882('0x53')+_0x30d6ae[_0xd882('0x4e')]+_0xd882('0x54');}_0x3e9e2c['set'](_0x2283fa);return _0x3e9e2c['send'](new Buffer(_0x30d6ae['recording']));}})['catch'](handleError(_0x3e9e2c,null));}; \ No newline at end of file +var _0x12c6=['create','body','download','recording','msg_id','Sequelize','ValidationError','attachment','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','model','differenceBy','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','rows','catch','show','params','includeAll','include','find'];(function(_0x4a4922,_0x82cb8f){var _0x55a8c6=function(_0x59712e){while(--_0x59712e){_0x4a4922['push'](_0x4a4922['shift']());}};_0x55a8c6(++_0x82cb8f);}(_0x12c6,0xae));var _0x612c=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x12c6[_0x49b207];return _0x2dc8fa;};'use strict';var emlformat=require(_0x612c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x612c('0x1'));var jsonpatch=require(_0x612c('0x2'));var rp=require(_0x612c('0x3'));var moment=require(_0x612c('0x4'));var BPromise=require(_0x612c('0x5'));var Mustache=require(_0x612c('0x6'));var util=require('util');var path=require(_0x612c('0x7'));var sox=require(_0x612c('0x8'));var csv=require(_0x612c('0x9'));var ejs=require(_0x612c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x612c('0xb'));var squel=require('squel');var crypto=require(_0x612c('0xc'));var jsforce=require(_0x612c('0xd'));var deskjs=require(_0x612c('0xe'));var toCsv=require(_0x612c('0x9'));var querystring=require('querystring');var Papa=require(_0x612c('0xf'));var Redis=require(_0x612c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x612c('0x11'));var as=require(_0x612c('0x12'));var hardwareService=require(_0x612c('0x13'));var logger=require(_0x612c('0x14'))(_0x612c('0x15'));var utils=require('../../config/utils');var config=require(_0x612c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x612c('0x17'))['db'];function respondWithStatusCode(_0xf92df8,_0xc15a74){_0xc15a74=_0xc15a74||0xcc;return function(_0xcfec51){if(_0xcfec51){return _0xf92df8[_0x612c('0x18')](_0xc15a74);}return _0xf92df8['status'](_0xc15a74)[_0x612c('0x19')]();};}function respondWithResult(_0x54abcd,_0x5a48a1){_0x5a48a1=_0x5a48a1||0xc8;return function(_0x4541f1){if(_0x4541f1){return _0x54abcd[_0x612c('0x1a')](_0x5a48a1)['json'](_0x4541f1);}};}function respondWithFilteredResult(_0x115b27,_0x525fba){return function(_0x3550cd){if(_0x3550cd){var _0x509e9f=typeof _0x525fba[_0x612c('0x1b')]===_0x612c('0x1c')&&typeof _0x525fba[_0x612c('0x1d')]===_0x612c('0x1c');var _0x5dc922=_0x3550cd[_0x612c('0x1e')];var _0x52e0f7=_0x509e9f?0x0:_0x525fba[_0x612c('0x1b')];var _0x5070e8=_0x509e9f?_0x3550cd[_0x612c('0x1e')]:_0x525fba[_0x612c('0x1b')]+_0x525fba[_0x612c('0x1d')];var _0x3d9a40;if(_0x5070e8>=_0x5dc922){_0x5070e8=_0x5dc922;_0x3d9a40=0xc8;}else{_0x3d9a40=0xce;}_0x115b27[_0x612c('0x1a')](_0x3d9a40);return _0x115b27[_0x612c('0x1f')](_0x612c('0x20'),_0x52e0f7+'-'+_0x5070e8+'/'+_0x5dc922)[_0x612c('0x21')](_0x3550cd);}return null;};}function patchUpdates(_0x165b19){return function(_0x2a6048){try{jsonpatch['apply'](_0x2a6048,_0x165b19,!![]);}catch(_0xcbcb48){return BPromise[_0x612c('0x22')](_0xcbcb48);}return _0x2a6048[_0x612c('0x23')]();};}function saveUpdates(_0x30e733,_0x32e18c){return function(_0x32d95f){if(_0x32d95f){return _0x32d95f[_0x612c('0x24')](_0x30e733)[_0x612c('0x25')](function(_0x2f313f){return _0x2f313f;});}return null;};}function removeEntity(_0x3027dc,_0x19def7){return function(_0x5804bf){if(_0x5804bf){return _0x5804bf['destroy']()['then'](function(){_0x3027dc['status'](0xcc)[_0x612c('0x19')]();});}};}function handleEntityNotFound(_0x88c5af,_0x2b8d60){return function(_0x4f0e2f){if(!_0x4f0e2f){_0x88c5af[_0x612c('0x18')](0x194);}return _0x4f0e2f;};}function handleError(_0x13de73,_0x5791c3){_0x5791c3=_0x5791c3||0x1f4;return function(_0x5f59f9){logger['error'](_0x5f59f9[_0x612c('0x26')]);if(_0x5f59f9[_0x612c('0x27')]){delete _0x5f59f9[_0x612c('0x27')];}_0x13de73[_0x612c('0x1a')](_0x5791c3)[_0x612c('0x28')](_0x5f59f9);};}exports[_0x612c('0x29')]=function(_0x36dfb0,_0x46c8db){var _0x5b08bc={},_0x316b8f={},_0x14dc23={'count':0x0,'rows':[]};var _0x4a6907=_[_0x612c('0x2a')](db[_0x612c('0x2b')][_0x612c('0x2c')],function(_0x213898){return{'name':_0x213898[_0x612c('0x2d')],'type':_0x213898['type']['key']};});_0x316b8f[_0x612c('0x2e')]=_[_0x612c('0x2f')](_[_0x612c('0x2a')](_0x4a6907,_0x612c('0x27')),[_0x612c('0x27')]);_0x316b8f['query']=_[_0x612c('0x30')](_0x36dfb0[_0x612c('0x31')]);_0x316b8f[_0x612c('0x32')]=_['intersection'](_0x316b8f[_0x612c('0x2e')],_0x316b8f['query']);_0x5b08bc['attributes']=_[_0x612c('0x33')](_0x316b8f[_0x612c('0x2e')],qs[_0x612c('0x34')](_0x36dfb0[_0x612c('0x31')][_0x612c('0x34')]));_0x5b08bc[_0x612c('0x35')]=_0x5b08bc[_0x612c('0x35')][_0x612c('0x36')]?_0x5b08bc['attributes']:_0x316b8f[_0x612c('0x2e')];if(!_0x36dfb0[_0x612c('0x31')][_0x612c('0x37')](_0x612c('0x38'))){_0x5b08bc[_0x612c('0x1d')]=qs[_0x612c('0x1d')](_0x36dfb0[_0x612c('0x31')][_0x612c('0x1d')]);_0x5b08bc[_0x612c('0x1b')]=qs[_0x612c('0x1b')](_0x36dfb0[_0x612c('0x31')][_0x612c('0x1b')]);}_0x5b08bc[_0x612c('0x39')]=qs[_0x612c('0x3a')](_0x36dfb0['query'][_0x612c('0x3a')]);_0x5b08bc[_0x612c('0x3b')]=qs[_0x612c('0x32')](_[_0x612c('0x3c')](_0x36dfb0[_0x612c('0x31')],_0x316b8f[_0x612c('0x32')]),_0x4a6907);if(_0x36dfb0['query']['filter']){_0x5b08bc['where']=_[_0x612c('0x3d')](_0x5b08bc[_0x612c('0x3b')],{'$or':_[_0x612c('0x2a')](_0x4a6907,function(_0x4a2bbc){if(_0x4a2bbc[_0x612c('0x3e')]!==_0x612c('0x3f')){var _0x2dd41a={};_0x2dd41a[_0x4a2bbc['name']]={'$like':'%'+_0x36dfb0['query']['filter']+'%'};return _0x2dd41a;}})});}_0x5b08bc=_[_0x612c('0x3d')]({},_0x5b08bc,_0x36dfb0[_0x612c('0x40')]);var _0x11f198={'where':_0x5b08bc['where']};return db[_0x612c('0x2b')][_0x612c('0x1e')](_0x11f198)['then'](function(_0x2bf09f){_0x14dc23[_0x612c('0x1e')]=_0x2bf09f;if(_0x36dfb0[_0x612c('0x31')]['includeAll']){_0x5b08bc['include']=[{'all':!![]}];}return db[_0x612c('0x2b')]['findAll'](_0x5b08bc);})[_0x612c('0x25')](function(_0x25ff5c){_0x14dc23[_0x612c('0x41')]=_0x25ff5c;return _0x14dc23;})[_0x612c('0x25')](respondWithFilteredResult(_0x46c8db,_0x5b08bc))[_0x612c('0x42')](handleError(_0x46c8db,null));};exports[_0x612c('0x43')]=function(_0x1102e0,_0x5bcd39){var _0x77dffa={'raw':!![],'where':{'id':_0x1102e0[_0x612c('0x44')]['id']}},_0x5c0142={};_0x5c0142['model']=_[_0x612c('0x30')](db['VoiceMailMessage'][_0x612c('0x2c')]);_0x5c0142['query']=_[_0x612c('0x30')](_0x1102e0[_0x612c('0x31')]);_0x5c0142[_0x612c('0x32')]=_[_0x612c('0x33')](_0x5c0142[_0x612c('0x2e')],_0x5c0142['query']);_0x77dffa['attributes']=_['intersection'](_0x5c0142[_0x612c('0x2e')],qs['fields'](_0x1102e0[_0x612c('0x31')][_0x612c('0x34')]));_0x77dffa[_0x612c('0x35')]=_0x77dffa['attributes'][_0x612c('0x36')]?_0x77dffa[_0x612c('0x35')]:_0x5c0142[_0x612c('0x2e')];if(_0x1102e0[_0x612c('0x31')][_0x612c('0x45')]){_0x77dffa[_0x612c('0x46')]=[{'all':!![]}];}_0x77dffa=_['merge']({},_0x77dffa,_0x1102e0[_0x612c('0x40')]);return db['VoiceMailMessage'][_0x612c('0x47')](_0x77dffa)[_0x612c('0x25')](handleEntityNotFound(_0x5bcd39,null))['then'](respondWithResult(_0x5bcd39,null))['catch'](handleError(_0x5bcd39,null));};exports['create']=function(_0x1b522a,_0x12ce80){return db[_0x612c('0x2b')][_0x612c('0x48')](_0x1b522a[_0x612c('0x49')],{})[_0x612c('0x25')](respondWithResult(_0x12ce80,0xc9))['catch'](handleError(_0x12ce80,null));};exports[_0x612c('0x24')]=function(_0xf64c84,_0x4084e5){if(_0xf64c84['body']['id']){delete _0xf64c84[_0x612c('0x49')]['id'];}return db['VoiceMailMessage'][_0x612c('0x47')]({'where':{'id':_0xf64c84[_0x612c('0x44')]['id']}})[_0x612c('0x25')](handleEntityNotFound(_0x4084e5,null))['then'](saveUpdates(_0xf64c84[_0x612c('0x49')],null))['then'](respondWithResult(_0x4084e5,null))[_0x612c('0x42')](handleError(_0x4084e5,null));};exports['destroy']=function(_0x211e34,_0x41bcbe){return db[_0x612c('0x2b')][_0x612c('0x47')]({'where':{'id':_0x211e34[_0x612c('0x44')]['id']}})[_0x612c('0x25')](handleEntityNotFound(_0x41bcbe,null))[_0x612c('0x25')](removeEntity(_0x41bcbe,null))[_0x612c('0x42')](handleError(_0x41bcbe,null));};exports[_0x612c('0x4a')]=function(_0xd6e597,_0x12bdbc,_0x579037){return db[_0x612c('0x2b')]['find']({'where':{'id':_0xd6e597[_0x612c('0x44')]['id']},'attributes':['id',_0x612c('0x4b'),_0x612c('0x4c')]})['then'](handleEntityNotFound(_0x12bdbc,null))[_0x612c('0x25')](function(_0x2d7a3b){if(_0x2d7a3b){if(!_0x2d7a3b[_0x612c('0x4b')]){throw new db[(_0x612c('0x4d'))][(_0x612c('0x4e'))]('VoiceMailMessage\x20not\x20found');}var _0x500f23={'Content-Type':'audio/wav','Content-Disposition':_0x612c('0x4f')};if(_0x2d7a3b[_0x612c('0x4c')]){_0x500f23['Content-Disposition']=_0x612c('0x50')+_0x2d7a3b['msg_id']+_0x612c('0x51');}_0x12bdbc['set'](_0x500f23);return _0x12bdbc[_0x612c('0x28')](new Buffer(_0x2d7a3b[_0x612c('0x4b')]));}})[_0x612c('0x42')](handleError(_0x12bdbc,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 1b3b837..3467cf4 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 _0xa3c8=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes'];(function(_0x3af2ff,_0x39ab4d){var _0x5657cb=function(_0x3acf65){while(--_0x3acf65){_0x3af2ff['push'](_0x3af2ff['shift']());}};_0x5657cb(++_0x39ab4d);}(_0xa3c8,0x1b5));var _0x8a3c=function(_0x370ce2,_0x3d4e23){_0x370ce2=_0x370ce2-0x0;var _0xa653d3=_0xa3c8[_0x370ce2];return _0xa653d3;};'use strict';var _=require(_0x8a3c('0x0'));var util=require(_0x8a3c('0x1'));var logger=require(_0x8a3c('0x2'))(_0x8a3c('0x3'));var moment=require(_0x8a3c('0x4'));var BPromise=require(_0x8a3c('0x5'));var rp=require(_0x8a3c('0x6'));var fs=require('fs');var path=require(_0x8a3c('0x7'));var rimraf=require(_0x8a3c('0x8'));var config=require(_0x8a3c('0x9'));var attributes=require(_0x8a3c('0xa'));module[_0x8a3c('0xb')]=function(_0x27cd11,_0x5f37c1){return _0x27cd11[_0x8a3c('0xc')](_0x8a3c('0xd'),attributes,{'tableName':_0x8a3c('0xe'),'paranoid':![],'indexes':[{'name':_0x8a3c('0xf'),'fields':[_0x8a3c('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0xda92=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x3724b1,_0x505127){var _0x3c4507=function(_0x589996){while(--_0x589996){_0x3724b1['push'](_0x3724b1['shift']());}};_0x3c4507(++_0x505127);}(_0xda92,0xa4));var _0x2da9=function(_0x2ee4fb,_0x3de151){_0x2ee4fb=_0x2ee4fb-0x0;var _0x343e4b=_0xda92[_0x2ee4fb];return _0x343e4b;};'use strict';var _=require(_0x2da9('0x0'));var util=require(_0x2da9('0x1'));var logger=require(_0x2da9('0x2'))(_0x2da9('0x3'));var moment=require(_0x2da9('0x4'));var BPromise=require(_0x2da9('0x5'));var rp=require(_0x2da9('0x6'));var fs=require('fs');var path=require(_0x2da9('0x7'));var rimraf=require(_0x2da9('0x8'));var config=require(_0x2da9('0x9'));var attributes=require(_0x2da9('0xa'));module['exports']=function(_0x2456a1,_0x5816f6){return _0x2456a1[_0x2da9('0xb')](_0x2da9('0xc'),attributes,{'tableName':_0x2da9('0xd'),'paranoid':![],'indexes':[{'name':_0x2da9('0xe'),'fields':[_0x2da9('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 2cf059d..3bfd111 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 _0x58da=['result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x58da,0xb5));var _0xa58d=function(_0x26002a,_0x5107de){_0x26002a=_0x26002a-0x0;var _0x119a1b=_0x58da[_0x26002a];return _0x119a1b;};'use strict';var _=require('lodash');var util=require(_0xa58d('0x0'));var moment=require(_0xa58d('0x1'));var BPromise=require(_0xa58d('0x2'));var rs=require(_0xa58d('0x3'));var fs=require('fs');var Redis=require(_0xa58d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa58d('0x5'));var logger=require(_0xa58d('0x6'))('rpc');var config=require(_0xa58d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa58d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x552a76,_0x1d95ab,_0x4d7cfe){return new BPromise(function(_0x10c7af,_0x5d3708){return client[_0xa58d('0x9')](_0x552a76,_0x4d7cfe)[_0xa58d('0xa')](function(_0x208c0e){logger['info'](_0xa58d('0xb'),_0x1d95ab,_0xa58d('0xc'));logger[_0xa58d('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x1d95ab,_0xa58d('0xc'),JSON[_0xa58d('0xe')](_0x208c0e));if(_0x208c0e[_0xa58d('0xf')]){if(_0x208c0e['error'][_0xa58d('0x10')]===0x1f4){logger[_0xa58d('0xf')](_0xa58d('0xb'),_0x1d95ab,_0x208c0e[_0xa58d('0xf')][_0xa58d('0x11')]);return _0x5d3708(_0x208c0e[_0xa58d('0xf')][_0xa58d('0x11')]);}logger['error'](_0xa58d('0xb'),_0x1d95ab,_0x208c0e[_0xa58d('0xf')][_0xa58d('0x11')]);return _0x10c7af(_0x208c0e['error']['message']);}else{logger[_0xa58d('0x12')](_0xa58d('0xb'),_0x1d95ab,_0xa58d('0xc'));_0x10c7af(_0x208c0e[_0xa58d('0x13')][_0xa58d('0x11')]);}})['catch'](function(_0x1ccc06){logger['error'](_0xa58d('0xb'),_0x1d95ab,_0x1ccc06);_0x5d3708(_0x1ccc06);});});} \ No newline at end of file +var _0x405d=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x27521e,_0x5a23c8){var _0x7d880b=function(_0x3ab111){while(--_0x3ab111){_0x27521e['push'](_0x27521e['shift']());}};_0x7d880b(++_0x5a23c8);}(_0x405d,0x151));var _0xd405=function(_0x3445a7,_0x285439){_0x3445a7=_0x3445a7-0x0;var _0x2aec67=_0x405d[_0x3445a7];return _0x2aec67;};'use strict';var _=require(_0xd405('0x0'));var util=require('util');var moment=require(_0xd405('0x1'));var BPromise=require(_0xd405('0x2'));var rs=require(_0xd405('0x3'));var fs=require('fs');var Redis=require(_0xd405('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd405('0x5'));var logger=require(_0xd405('0x6'))(_0xd405('0x7'));var config=require(_0xd405('0x8'));var jayson=require(_0xd405('0x9'));var client=jayson[_0xd405('0xa')][_0xd405('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x500397,_0x7d760a,_0x22119c){return new BPromise(function(_0x5c6c46,_0x1ad480){return client[_0xd405('0xc')](_0x500397,_0x22119c)['then'](function(_0x3b547b){logger[_0xd405('0xd')](_0xd405('0xe'),_0x7d760a,_0xd405('0xf'));logger[_0xd405('0x10')](_0xd405('0x11'),_0x7d760a,'request\x20sent',JSON[_0xd405('0x12')](_0x3b547b));if(_0x3b547b[_0xd405('0x13')]){if(_0x3b547b[_0xd405('0x13')][_0xd405('0x14')]===0x1f4){logger[_0xd405('0x13')](_0xd405('0xe'),_0x7d760a,_0x3b547b[_0xd405('0x13')][_0xd405('0x15')]);return _0x1ad480(_0x3b547b[_0xd405('0x13')]['message']);}logger[_0xd405('0x13')](_0xd405('0xe'),_0x7d760a,_0x3b547b[_0xd405('0x13')][_0xd405('0x15')]);return _0x5c6c46(_0x3b547b[_0xd405('0x13')][_0xd405('0x15')]);}else{logger[_0xd405('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x7d760a,_0xd405('0xf'));_0x5c6c46(_0x3b547b[_0xd405('0x16')][_0xd405('0x15')]);}})[_0xd405('0x17')](function(_0x2a973c){logger[_0xd405('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x7d760a,_0x2a973c);_0x1ad480(_0x2a973c);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 5016a46..e5b9ba0 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 _0x87c4=['./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','create','put','update','delete','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x191141,_0x232869){var _0x22c70f=function(_0x759df6){while(--_0x759df6){_0x191141['push'](_0x191141['shift']());}};_0x22c70f(++_0x232869);}(_0x87c4,0x135));var _0x487c=function(_0x2a9cc6,_0x25e508){_0x2a9cc6=_0x2a9cc6-0x0;var _0x2043d3=_0x87c4[_0x2a9cc6];return _0x2043d3;};'use strict';var multer=require('multer');var util=require(_0x487c('0x0'));var path=require(_0x487c('0x1'));var timeout=require(_0x487c('0x2'));var express=require(_0x487c('0x3'));var router=express[_0x487c('0x4')]();var fs_extra=require(_0x487c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x487c('0x6'));router[_0x487c('0x7')]('/',auth[_0x487c('0x8')](),controller[_0x487c('0x9')]);router[_0x487c('0x7')](_0x487c('0xa'),auth['isAuthenticated'](),controller[_0x487c('0xb')]);router[_0x487c('0x7')](_0x487c('0xc'),auth[_0x487c('0x8')](),controller[_0x487c('0xd')]);router['post']('/',auth[_0x487c('0x8')](),controller[_0x487c('0xe')]);router['post'](_0x487c('0xc'),auth['isAuthenticated'](),controller['addSound']);router[_0x487c('0xf')](_0x487c('0xa'),auth[_0x487c('0x8')](),controller[_0x487c('0x10')]);router['delete'](_0x487c('0xa'),auth[_0x487c('0x8')](),controller['destroy']);router[_0x487c('0x11')](_0x487c('0x12'),auth[_0x487c('0x8')](),controller[_0x487c('0x13')]);module[_0x487c('0x14')]=router; \ No newline at end of file +var _0xca3e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','/:id','get','/:id/sounds','getSounds','post','create','addSound','delete','/:id/sounds/:id2','removeSound','exports','path','connect-timeout','express'];(function(_0x416330,_0x3a8fc1){var _0x478ab7=function(_0x3b9763){while(--_0x3b9763){_0x416330['push'](_0x416330['shift']());}};_0x478ab7(++_0x3a8fc1);}(_0xca3e,0x18d));var _0xeca3=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xca3e[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeca3('0x0'));var timeout=require(_0xeca3('0x1'));var express=require(_0xeca3('0x2'));var router=express['Router']();var fs_extra=require(_0xeca3('0x3'));var auth=require(_0xeca3('0x4'));var interaction=require(_0xeca3('0x5'));var config=require(_0xeca3('0x6'));var controller=require(_0xeca3('0x7'));router['get']('/',auth[_0xeca3('0x8')](),controller['index']);router['get'](_0xeca3('0x9'),auth[_0xeca3('0x8')](),controller['show']);router[_0xeca3('0xa')](_0xeca3('0xb'),auth[_0xeca3('0x8')](),controller[_0xeca3('0xc')]);router[_0xeca3('0xd')]('/',auth[_0xeca3('0x8')](),controller[_0xeca3('0xe')]);router['post'](_0xeca3('0xb'),auth[_0xeca3('0x8')](),controller[_0xeca3('0xf')]);router['put'](_0xeca3('0x9'),auth[_0xeca3('0x8')](),controller['update']);router[_0xeca3('0x10')](_0xeca3('0x9'),auth[_0xeca3('0x8')](),controller['destroy']);router[_0xeca3('0x10')](_0xeca3('0x11'),auth[_0xeca3('0x8')](),controller[_0xeca3('0x12')]);module[_0xeca3('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 6fca38d..f598a49 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 _0xc414=['custom','files','mp3nb','quietmp3nb','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x30175c,_0x24d15c){var _0x387e4b=function(_0x250f73){while(--_0x250f73){_0x30175c['push'](_0x30175c['shift']());}};_0x387e4b(++_0x24d15c);}(_0xc414,0x17d));var _0x4c41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc414[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4c41('0x0'));module[_0x4c41('0x1')]={'name':{'type':Sequelize[_0x4c41('0x2')],'allowNull':![],'unique':_0x4c41('0x3')},'mode':{'type':Sequelize['ENUM'](_0x4c41('0x4'),_0x4c41('0x5'),_0x4c41('0x6'),_0x4c41('0x7'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x4c41('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x4c41('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x4c41('0x2')],'allowNull':!![],'defaultValue':_0x4c41('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x4c41('0x9')},'defaultEntry':{'type':Sequelize[_0x4c41('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3a58=['mp3nb','quietmp3nb','quietmp3','mp3','STRING','exports','ENUM','custom','files'];(function(_0xa5b97,_0x5b090b){var _0x114ead=function(_0x4b7a28){while(--_0x4b7a28){_0xa5b97['push'](_0xa5b97['shift']());}};_0x114ead(++_0x5b090b);}(_0x3a58,0x68));var _0x83a5=function(_0x56e1e3,_0x5959dc){_0x56e1e3=_0x56e1e3-0x0;var _0x47b0f4=_0x3a58[_0x56e1e3];return _0x47b0f4;};'use strict';var Sequelize=require('sequelize');module[_0x83a5('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x83a5('0x1')](_0x83a5('0x2'),_0x83a5('0x3'),_0x83a5('0x4'),_0x83a5('0x5'),_0x83a5('0x6'),_0x83a5('0x7')),'allowNull':!![],'defaultValue':_0x83a5('0x3')},'directory':{'type':Sequelize[_0x83a5('0x8')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x83a5('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x83a5('0x8')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x83a5('0x8')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index bad7197..b6d8b17 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 _0xd9aa=['length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','body','sequelize','transaction','mode','directory','join','root','create','files','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','readdirSync','unlinkSync','rmdirSync','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','format','basename','extname','server/files/moh','%s.%s','symlinkSync','Sequelize','removeSound','id2','getSounds','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x51ecf5,_0x2c1040){var _0x58d442=function(_0x41bb30){while(--_0x41bb30){_0x51ecf5['push'](_0x51ecf5['shift']());}};_0x58d442(++_0x2c1040);}(_0xd9aa,0x1f1));var _0xad9a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd9aa[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xad9a('0x0'));var rimraf=require(_0xad9a('0x1'));var zipdir=require(_0xad9a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad9a('0x3'));var moment=require(_0xad9a('0x4'));var BPromise=require(_0xad9a('0x5'));var Mustache=require('mustache');var util=require(_0xad9a('0x6'));var path=require(_0xad9a('0x7'));var sox=require('sox');var csv=require(_0xad9a('0x8'));var ejs=require(_0xad9a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad9a('0xa'));var squel=require(_0xad9a('0xb'));var crypto=require(_0xad9a('0xc'));var jsforce=require(_0xad9a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xad9a('0x8'));var querystring=require('querystring');var Papa=require(_0xad9a('0xe'));var Redis=require(_0xad9a('0xf'));var authService=require(_0xad9a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xad9a('0x11'));var hardwareService=require(_0xad9a('0x12'));var logger=require(_0xad9a('0x13'))(_0xad9a('0x14'));var utils=require(_0xad9a('0x15'));var config=require(_0xad9a('0x16'));var licenseUtil=require(_0xad9a('0x17'));var db=require(_0xad9a('0x18'))['db'];function respondWithStatusCode(_0x5e7013,_0x441795){_0x441795=_0x441795||0xcc;return function(_0x504441){if(_0x504441){return _0x5e7013[_0xad9a('0x19')](_0x441795);}return _0x5e7013['status'](_0x441795)['end']();};}function respondWithResult(_0x37a7c0,_0x45011a){_0x45011a=_0x45011a||0xc8;return function(_0x5bd9a0){if(_0x5bd9a0){return _0x37a7c0[_0xad9a('0x1a')](_0x45011a)['json'](_0x5bd9a0);}};}function respondWithFilteredResult(_0x1ab0c4,_0xb53952){return function(_0x46330e){if(_0x46330e){var _0x17beef=typeof _0xb53952['offset']===_0xad9a('0x1b')&&typeof _0xb53952[_0xad9a('0x1c')]===_0xad9a('0x1b');var _0x1b6db3=_0x46330e[_0xad9a('0x1d')];var _0x1a542e=_0x17beef?0x0:_0xb53952[_0xad9a('0x1e')];var _0x4013ce=_0x17beef?_0x46330e[_0xad9a('0x1d')]:_0xb53952[_0xad9a('0x1e')]+_0xb53952[_0xad9a('0x1c')];var _0x532b20;if(_0x4013ce>=_0x1b6db3){_0x4013ce=_0x1b6db3;_0x532b20=0xc8;}else{_0x532b20=0xce;}_0x1ab0c4[_0xad9a('0x1a')](_0x532b20);return _0x1ab0c4[_0xad9a('0x1f')](_0xad9a('0x20'),_0x1a542e+'-'+_0x4013ce+'/'+_0x1b6db3)[_0xad9a('0x21')](_0x46330e);}return null;};}function patchUpdates(_0x15bc3b){return function(_0x1af378){try{jsonpatch['apply'](_0x1af378,_0x15bc3b,!![]);}catch(_0x783d19){return BPromise['reject'](_0x783d19);}return _0x1af378[_0xad9a('0x22')]();};}function saveUpdates(_0x17c524,_0x1ab3c7){return function(_0x140a55){if(_0x140a55){return _0x140a55[_0xad9a('0x23')](_0x17c524)[_0xad9a('0x24')](function(_0x46e0d0){return _0x46e0d0;});}return null;};}function removeEntity(_0x5728ff,_0x4e2cf4){return function(_0x531f88){if(_0x531f88){return _0x531f88[_0xad9a('0x25')]()[_0xad9a('0x24')](function(){var _0x56646b=_0x531f88[_0xad9a('0x26')]({'plain':!![]});var _0x2d55b1=_0xad9a('0x27');return db[_0xad9a('0x28')]['destroy']({'where':{'type':_0x2d55b1,'resourceId':_0x56646b['id']}})[_0xad9a('0x24')](function(){return _0x531f88;});})[_0xad9a('0x24')](function(){_0x5728ff[_0xad9a('0x1a')](0xcc)[_0xad9a('0x29')]();});}};}function handleEntityNotFound(_0x349c4d,_0x4997af){return function(_0x5b6f1f){if(!_0x5b6f1f){_0x349c4d['sendStatus'](0x194);}return _0x5b6f1f;};}function handleError(_0x456045,_0x21bd23){_0x21bd23=_0x21bd23||0x1f4;return function(_0x49cd59){logger[_0xad9a('0x2a')](_0x49cd59[_0xad9a('0x2b')]);if(_0x49cd59[_0xad9a('0x2c')]){delete _0x49cd59[_0xad9a('0x2c')];}_0x456045[_0xad9a('0x1a')](_0x21bd23)[_0xad9a('0x2d')](_0x49cd59);};}exports['index']=function(_0x5d45fc,_0x52c45e){var _0x2f9429={},_0xfb267e={},_0x5ded24={'count':0x0,'rows':[]};var _0xf07f28=_[_0xad9a('0x2e')](db[_0xad9a('0x2f')][_0xad9a('0x30')],function(_0x394e5b){return{'name':_0x394e5b['fieldName'],'type':_0x394e5b[_0xad9a('0x31')][_0xad9a('0x32')]};});_0xfb267e[_0xad9a('0x33')]=_[_0xad9a('0x2e')](_0xf07f28,'name');_0xfb267e[_0xad9a('0x34')]=_[_0xad9a('0x35')](_0x5d45fc[_0xad9a('0x34')]);_0xfb267e[_0xad9a('0x36')]=_[_0xad9a('0x37')](_0xfb267e['model'],_0xfb267e[_0xad9a('0x34')]);_0x2f9429[_0xad9a('0x38')]=_[_0xad9a('0x37')](_0xfb267e['model'],qs[_0xad9a('0x39')](_0x5d45fc[_0xad9a('0x34')]['fields']));_0x2f9429[_0xad9a('0x38')]=_0x2f9429[_0xad9a('0x38')][_0xad9a('0x3a')]?_0x2f9429[_0xad9a('0x38')]:_0xfb267e[_0xad9a('0x33')];if(!_0x5d45fc[_0xad9a('0x34')][_0xad9a('0x3b')](_0xad9a('0x3c'))){_0x2f9429['limit']=qs[_0xad9a('0x1c')](_0x5d45fc[_0xad9a('0x34')][_0xad9a('0x1c')]);_0x2f9429[_0xad9a('0x1e')]=qs[_0xad9a('0x1e')](_0x5d45fc[_0xad9a('0x34')][_0xad9a('0x1e')]);}_0x2f9429[_0xad9a('0x3d')]=qs[_0xad9a('0x3e')](_0x5d45fc[_0xad9a('0x34')][_0xad9a('0x3e')]);delete _0x5d45fc[_0xad9a('0x34')]['sort'];_0x2f9429['where']=qs[_0xad9a('0x36')](_['pick'](_0x5d45fc[_0xad9a('0x34')],_0xfb267e[_0xad9a('0x36')]),_0xf07f28);if(_0x5d45fc[_0xad9a('0x34')]['filter']){_0x2f9429[_0xad9a('0x3f')]=_[_0xad9a('0x40')](_0x2f9429[_0xad9a('0x3f')],{'$or':_[_0xad9a('0x2e')](_0xf07f28,function(_0x139afa){if(_0x139afa[_0xad9a('0x31')]!=='VIRTUAL'){var _0x4e6ea0={};_0x4e6ea0[_0x139afa['name']]={'$like':'%'+_0x5d45fc[_0xad9a('0x34')][_0xad9a('0x41')]+'%'};return _0x4e6ea0;}})});}_0x2f9429=_['merge']({},_0x2f9429,_0x5d45fc[_0xad9a('0x42')]);var _0x118d34={'where':_0x2f9429[_0xad9a('0x3f')]};return db[_0xad9a('0x2f')][_0xad9a('0x1d')](_0x118d34)[_0xad9a('0x24')](function(_0xd5e391){_0x5ded24[_0xad9a('0x1d')]=_0xd5e391;if(_0x5d45fc[_0xad9a('0x34')][_0xad9a('0x43')]){_0x2f9429[_0xad9a('0x44')]=[{'all':!![]}];}return db[_0xad9a('0x2f')][_0xad9a('0x45')](_0x2f9429);})[_0xad9a('0x24')](function(_0xc350fc){_0x5ded24[_0xad9a('0x46')]=_0xc350fc;return _0x5ded24;})[_0xad9a('0x24')](respondWithFilteredResult(_0x52c45e,_0x2f9429))[_0xad9a('0x47')](handleError(_0x52c45e,null));};exports[_0xad9a('0x48')]=function(_0x56ac42,_0x2cd559){var _0x39eb63={'raw':![],'where':{'id':_0x56ac42[_0xad9a('0x49')]['id']}},_0x378e9a={};_0x378e9a[_0xad9a('0x33')]=_[_0xad9a('0x35')](db[_0xad9a('0x2f')][_0xad9a('0x30')]);_0x378e9a[_0xad9a('0x34')]=_[_0xad9a('0x35')](_0x56ac42[_0xad9a('0x34')]);_0x378e9a[_0xad9a('0x36')]=_['intersection'](_0x378e9a[_0xad9a('0x33')],_0x378e9a[_0xad9a('0x34')]);_0x39eb63[_0xad9a('0x38')]=_['intersection'](_0x378e9a[_0xad9a('0x33')],qs[_0xad9a('0x39')](_0x56ac42[_0xad9a('0x34')]['fields']));_0x39eb63[_0xad9a('0x38')]=_0x39eb63[_0xad9a('0x38')][_0xad9a('0x3a')]?_0x39eb63[_0xad9a('0x38')]:_0x378e9a[_0xad9a('0x33')];if(_0x56ac42['query'][_0xad9a('0x43')]){_0x39eb63[_0xad9a('0x44')]=[{'all':!![]}];}_0x39eb63=_[_0xad9a('0x40')]({},_0x39eb63,_0x56ac42[_0xad9a('0x42')]);return db[_0xad9a('0x2f')][_0xad9a('0x4a')](_0x39eb63)['then'](handleEntityNotFound(_0x2cd559,null))[_0xad9a('0x24')](respondWithResult(_0x2cd559,null))[_0xad9a('0x47')](handleError(_0x2cd559,null));};exports[_0xad9a('0x23')]=function(_0x1296d0,_0x3f84a8){if(_0x1296d0[_0xad9a('0x4b')]['id']){delete _0x1296d0[_0xad9a('0x4b')]['id'];}return db[_0xad9a('0x2f')]['find']({'where':{'id':_0x1296d0[_0xad9a('0x49')]['id']}})[_0xad9a('0x24')](handleEntityNotFound(_0x3f84a8,null))['then'](saveUpdates(_0x1296d0[_0xad9a('0x4b')],null))[_0xad9a('0x24')](respondWithResult(_0x3f84a8,null))[_0xad9a('0x47')](handleError(_0x3f84a8,null));};exports['create']=function(_0x518ce6,_0x1fef66,_0x5d6567){return db[_0xad9a('0x4c')][_0xad9a('0x4d')](function(_0x1c26cc){if(_0x518ce6[_0xad9a('0x4b')][_0xad9a('0x4e')]==='files'){_0x518ce6[_0xad9a('0x4b')][_0xad9a('0x4f')]=path[_0xad9a('0x50')](config[_0xad9a('0x51')],'server/files/moh',_0x518ce6['body'][_0xad9a('0x2c')]);}return db['VoiceMusicOnHold'][_0xad9a('0x52')](_0x518ce6[_0xad9a('0x4b')],{'transaction':_0x1c26cc})['then'](function(_0x1bdc0e){if(_0x518ce6[_0xad9a('0x4b')][_0xad9a('0x4e')]===_0xad9a('0x53')){fs[_0xad9a('0x54')](_0x1bdc0e[_0xad9a('0x4f')],parseInt('0777',0x8));}var _0x17f9cd=_0x518ce6['user']['get']({'plain':!![]});if(!_0x17f9cd)throw new Error(_0xad9a('0x55'));if(_0x17f9cd['role']===_0xad9a('0x56')){var _0x24b636=_0x1bdc0e[_0xad9a('0x26')]({'plain':!![]});return db[_0xad9a('0x57')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x17f9cd[_0xad9a('0x58')]},'raw':!![]})['then'](function(_0x33713a){if(_0x33713a&&_0x33713a[_0xad9a('0x59')]===0x0){return db[_0xad9a('0x28')]['create']({'name':_0x24b636[_0xad9a('0x2c')],'resourceId':_0x24b636['id'],'type':_0x33713a[_0xad9a('0x2c')],'sectionId':_0x33713a['id']},{})[_0xad9a('0x24')](function(){return _0x1bdc0e;});}else{return _0x1bdc0e;}})[_0xad9a('0x47')](function(_0x48a6d9){logger[_0xad9a('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48a6d9);});}return _0x1bdc0e;});})['then'](respondWithResult(_0x1fef66,0xc9))[_0xad9a('0x47')](handleError(_0x1fef66,null));};exports[_0xad9a('0x25')]=function(_0x34546f,_0x14b07c,_0x5f3f4b){var _0x4b3f63;return db['VoiceMusicOnHold'][_0xad9a('0x4a')]({'where':{'id':_0x34546f[_0xad9a('0x49')]['id']}})[_0xad9a('0x24')](function(_0x30b2a7){if(_0x30b2a7){return db[_0xad9a('0x4c')][_0xad9a('0x4d')](function(_0x5012a8){return _0x30b2a7[_0xad9a('0x25')]({'transaction':_0x5012a8,'raw':!![]})['then'](function(_0x59bc45){if(_0x59bc45['directory']){fs[_0xad9a('0x5a')](_0x59bc45['directory'])['forEach'](function(_0x1e4086){fs[_0xad9a('0x5b')](path[_0xad9a('0x50')](_0x59bc45[_0xad9a('0x4f')],_0x1e4086));});fs[_0xad9a('0x5c')](_0x59bc45['directory']);}return _0x59bc45;});})[_0xad9a('0x47')](function(_0x4e9755){throw new db['Sequelize'][(_0xad9a('0x5d'))](_0x4e9755[_0xad9a('0x5e')]);});}})[_0xad9a('0x24')](handleEntityNotFound(_0x14b07c,null))[_0xad9a('0x24')](removeEntity(_0x14b07c,null))['catch'](handleError(_0x14b07c,null));};exports['addSound']=function(_0x265eee,_0x26898c,_0x46bce7){return db['sequelize'][_0xad9a('0x4d')](function(_0x29a17e){var _0x598255;return db[_0xad9a('0x2f')][_0xad9a('0x4a')]({'where':{'id':_0x265eee[_0xad9a('0x49')]['id']}})[_0xad9a('0x24')](function(_0x3f862f){if(_0x3f862f){_0x598255=_0x3f862f;return _0x3f862f[_0xad9a('0x5f')](_0x265eee[_0xad9a('0x4b')]['id'],{'transaction':_0x29a17e});}})[_0xad9a('0x24')](function(_0x2f4d52){if(_0x2f4d52){return db[_0xad9a('0x60')][_0xad9a('0x61')]({'where':{'id':_0x265eee['body']['id']},'attributes':['id',_0xad9a('0x2c'),_0xad9a('0x62'),_0xad9a('0x63'),_0xad9a('0x64')],'raw':!![]});}})[_0xad9a('0x24')](function(_0x314441){if(_0x314441){var _0x12e5f8=path['join'](config['root'],'server/files/sounds/converted',util[_0xad9a('0x65')]('%s.%s',path[_0xad9a('0x66')](_0x314441[_0xad9a('0x62')],path[_0xad9a('0x67')](_0x314441[_0xad9a('0x62')])),_0x314441[_0xad9a('0x63')]));var _0x5d22b6=path[_0xad9a('0x50')](config['root'],_0xad9a('0x68'),_0x598255['name'],util[_0xad9a('0x65')](_0xad9a('0x69'),_0x314441[_0xad9a('0x2c')],_0x314441[_0xad9a('0x63')]));fs[_0xad9a('0x6a')](_0x12e5f8,_0x5d22b6);return _0x314441;}})[_0xad9a('0x47')](function(_0xb17ef4){throw new db[(_0xad9a('0x6b'))][(_0xad9a('0x5d'))](_0xb17ef4['message']);});})[_0xad9a('0x24')](handleEntityNotFound(_0x26898c,null))[_0xad9a('0x24')](respondWithResult(_0x26898c,0xc9))['catch'](handleError(_0x26898c,null));};exports[_0xad9a('0x6c')]=function(_0x419c4d,_0x24bcb7,_0x18000c){return db[_0xad9a('0x4c')][_0xad9a('0x4d')](function(_0x4f3c38){var _0x2e84bf;return db[_0xad9a('0x2f')][_0xad9a('0x61')]({'where':{'id':_0x419c4d[_0xad9a('0x49')]['id']}})[_0xad9a('0x24')](handleEntityNotFound(_0x24bcb7,null))[_0xad9a('0x24')](function(_0x399d05){if(_0x399d05){_0x2e84bf=_0x399d05;return _0x399d05[_0xad9a('0x6c')](_0x419c4d[_0xad9a('0x49')]['id2']);}})[_0xad9a('0x24')](function(_0x1540dd){if(_0x1540dd){return db[_0xad9a('0x60')][_0xad9a('0x61')]({'where':{'id':_0x419c4d[_0xad9a('0x49')][_0xad9a('0x6d')]},'attributes':['id',_0xad9a('0x2c'),'save_name',_0xad9a('0x63'),_0xad9a('0x64')],'raw':!![]});}})[_0xad9a('0x24')](function(_0x4f46a0){if(_0x4f46a0){fs[_0xad9a('0x5b')](path[_0xad9a('0x50')](_0x2e84bf[_0xad9a('0x4f')],util[_0xad9a('0x65')](_0xad9a('0x69'),_0x4f46a0[_0xad9a('0x2c')],_0x4f46a0[_0xad9a('0x63')])));return _0x4f46a0;}})[_0xad9a('0x47')](function(_0x4bdf96){throw new db['Sequelize'][(_0xad9a('0x5d'))](_0x4bdf96[_0xad9a('0x5e')]);});})[_0xad9a('0x24')](handleEntityNotFound(_0x24bcb7,null))[_0xad9a('0x24')](respondWithStatusCode(_0x24bcb7,0xcc))[_0xad9a('0x47')](handleError(_0x24bcb7,null));};exports['getSounds']=function(_0x39a462,_0x697aaa,_0x2d269a){var _0x39160a={};var _0x14c022={};var _0x2b6593;var _0x127633;return db[_0xad9a('0x2f')][_0xad9a('0x61')]({'where':{'id':_0x39a462['params']['id']}})[_0xad9a('0x24')](handleEntityNotFound(_0x697aaa,null))['then'](function(_0x1f84ee){if(_0x1f84ee){_0x2b6593=_0x1f84ee;_0x14c022[_0xad9a('0x33')]=_[_0xad9a('0x35')](db[_0xad9a('0x60')][_0xad9a('0x30')]);_0x14c022['query']=_[_0xad9a('0x35')](_0x39a462[_0xad9a('0x34')]);_0x14c022['filters']=_[_0xad9a('0x37')](_0x14c022[_0xad9a('0x33')],_0x14c022[_0xad9a('0x34')]);_0x39160a[_0xad9a('0x38')]=_['intersection'](_0x14c022['model'],qs[_0xad9a('0x39')](_0x39a462[_0xad9a('0x34')][_0xad9a('0x39')]));_0x39160a[_0xad9a('0x38')]=_0x39160a[_0xad9a('0x38')][_0xad9a('0x3a')]?_0x39160a[_0xad9a('0x38')]:_0x14c022['model'];_0x39160a['order']=qs['sort'](_0x39a462['query'][_0xad9a('0x3e')]);_0x39160a['where']=qs[_0xad9a('0x36')](_['pick'](_0x39a462['query'],_0x14c022[_0xad9a('0x36')]));if(_0x39a462['query'][_0xad9a('0x41')]){_0x39160a[_0xad9a('0x3f')]=_['merge'](_0x39160a[_0xad9a('0x3f')],{'$or':_[_0xad9a('0x2e')](_0x39160a['attributes'],function(_0x43370e){var _0x4863a8={};_0x4863a8[_0x43370e]={'$like':'%'+_0x39a462[_0xad9a('0x34')][_0xad9a('0x41')]+'%'};return _0x4863a8;})});}_0x39160a=_['merge']({},_0x39160a,_0x39a462['options']);return _0x2b6593[_0xad9a('0x6e')](_0x39160a);}})[_0xad9a('0x24')](function(_0x513417){if(_0x513417){_0x127633=_0x513417[_0xad9a('0x3a')];if(!_0x39a462[_0xad9a('0x34')][_0xad9a('0x3b')]('nolimit')){_0x39160a['limit']=qs[_0xad9a('0x1c')](_0x39a462['query'][_0xad9a('0x1c')]);_0x39160a['offset']=qs[_0xad9a('0x1e')](_0x39a462['query'][_0xad9a('0x1e')]);}return _0x2b6593[_0xad9a('0x6e')](_0x39160a);}})['then'](function(_0x50a6e7){if(_0x50a6e7){return _0x50a6e7?{'count':_0x127633,'rows':_0x50a6e7}:null;}})['then'](respondWithResult(_0x697aaa,null))[_0xad9a('0x47')](handleError(_0x697aaa,null));}; \ No newline at end of file +var _0xd0c9=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','fields','body','find','create','sequelize','transaction','mode','files','server/files/moh','mkdirSync','0777','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','destroy','readdirSync','directory','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','root','server/files/sounds/converted','format','basename','extname','%s.%s','message','removeSound','id2','createdAt','getSounds','rimraf','zip-dir'];(function(_0x391811,_0x187aa0){var _0x4fb675=function(_0x177804){while(--_0x177804){_0x391811['push'](_0x391811['shift']());}};_0x4fb675(++_0x187aa0);}(_0xd0c9,0x73));var _0x9d0c=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xd0c9[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d0c('0x0'));var zipdir=require(_0x9d0c('0x1'));var jsonpatch=require(_0x9d0c('0x2'));var rp=require(_0x9d0c('0x3'));var moment=require(_0x9d0c('0x4'));var BPromise=require(_0x9d0c('0x5'));var Mustache=require(_0x9d0c('0x6'));var util=require(_0x9d0c('0x7'));var path=require(_0x9d0c('0x8'));var sox=require(_0x9d0c('0x9'));var csv=require(_0x9d0c('0xa'));var ejs=require(_0x9d0c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d0c('0xc'));var squel=require(_0x9d0c('0xd'));var crypto=require(_0x9d0c('0xe'));var jsforce=require(_0x9d0c('0xf'));var deskjs=require(_0x9d0c('0x10'));var toCsv=require(_0x9d0c('0xa'));var querystring=require(_0x9d0c('0x11'));var Papa=require(_0x9d0c('0x12'));var Redis=require('ioredis');var authService=require(_0x9d0c('0x13'));var qs=require(_0x9d0c('0x14'));var as=require(_0x9d0c('0x15'));var hardwareService=require(_0x9d0c('0x16'));var logger=require('../../config/logger')(_0x9d0c('0x17'));var utils=require(_0x9d0c('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9d0c('0x19'))['db'];function respondWithStatusCode(_0x20388c,_0x13d790){_0x13d790=_0x13d790||0xcc;return function(_0x410890){if(_0x410890){return _0x20388c[_0x9d0c('0x1a')](_0x13d790);}return _0x20388c[_0x9d0c('0x1b')](_0x13d790)[_0x9d0c('0x1c')]();};}function respondWithResult(_0x512a02,_0x34780b){_0x34780b=_0x34780b||0xc8;return function(_0x460c77){if(_0x460c77){return _0x512a02['status'](_0x34780b)[_0x9d0c('0x1d')](_0x460c77);}};}function respondWithFilteredResult(_0x5e8de0,_0x37b12){return function(_0x21ba77){if(_0x21ba77){var _0x511960=typeof _0x37b12['offset']===_0x9d0c('0x1e')&&typeof _0x37b12['limit']===_0x9d0c('0x1e');var _0x55ed30=_0x21ba77[_0x9d0c('0x1f')];var _0x5a5ac6=_0x511960?0x0:_0x37b12[_0x9d0c('0x20')];var _0x2e93c1=_0x511960?_0x21ba77[_0x9d0c('0x1f')]:_0x37b12['offset']+_0x37b12['limit'];var _0x16cb45;if(_0x2e93c1>=_0x55ed30){_0x2e93c1=_0x55ed30;_0x16cb45=0xc8;}else{_0x16cb45=0xce;}_0x5e8de0[_0x9d0c('0x1b')](_0x16cb45);return _0x5e8de0['set'](_0x9d0c('0x21'),_0x5a5ac6+'-'+_0x2e93c1+'/'+_0x55ed30)[_0x9d0c('0x1d')](_0x21ba77);}return null;};}function patchUpdates(_0x36d603){return function(_0x4999b9){try{jsonpatch[_0x9d0c('0x22')](_0x4999b9,_0x36d603,!![]);}catch(_0x4aef82){return BPromise[_0x9d0c('0x23')](_0x4aef82);}return _0x4999b9[_0x9d0c('0x24')]();};}function saveUpdates(_0x219efc,_0x22322f){return function(_0x2a91ff){if(_0x2a91ff){return _0x2a91ff[_0x9d0c('0x25')](_0x219efc)[_0x9d0c('0x26')](function(_0x3207ad){return _0x3207ad;});}return null;};}function removeEntity(_0x443c2c,_0x155c28){return function(_0x252650){if(_0x252650){return _0x252650['destroy']()[_0x9d0c('0x26')](function(){var _0x2b2b2b=_0x252650[_0x9d0c('0x27')]({'plain':!![]});var _0x164ef1=_0x9d0c('0x28');return db[_0x9d0c('0x29')]['destroy']({'where':{'type':_0x164ef1,'resourceId':_0x2b2b2b['id']}})[_0x9d0c('0x26')](function(){return _0x252650;});})[_0x9d0c('0x26')](function(){_0x443c2c[_0x9d0c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb94e9b,_0x167ad8){return function(_0x72c23f){if(!_0x72c23f){_0xb94e9b['sendStatus'](0x194);}return _0x72c23f;};}function handleError(_0x5c9485,_0x50b8b1){_0x50b8b1=_0x50b8b1||0x1f4;return function(_0x35183d){logger[_0x9d0c('0x2a')](_0x35183d[_0x9d0c('0x2b')]);if(_0x35183d['name']){delete _0x35183d[_0x9d0c('0x2c')];}_0x5c9485[_0x9d0c('0x1b')](_0x50b8b1)[_0x9d0c('0x2d')](_0x35183d);};}exports[_0x9d0c('0x2e')]=function(_0x53d0d5,_0x1daaaa){var _0x5f196a={},_0xfd69d3={},_0x186b6a={'count':0x0,'rows':[]};var _0x162572=_[_0x9d0c('0x2f')](db[_0x9d0c('0x30')][_0x9d0c('0x31')],function(_0x2cb5eb){return{'name':_0x2cb5eb[_0x9d0c('0x32')],'type':_0x2cb5eb[_0x9d0c('0x33')][_0x9d0c('0x34')]};});_0xfd69d3[_0x9d0c('0x35')]=_[_0x9d0c('0x2f')](_0x162572,'name');_0xfd69d3[_0x9d0c('0x36')]=_[_0x9d0c('0x37')](_0x53d0d5[_0x9d0c('0x36')]);_0xfd69d3[_0x9d0c('0x38')]=_[_0x9d0c('0x39')](_0xfd69d3[_0x9d0c('0x35')],_0xfd69d3[_0x9d0c('0x36')]);_0x5f196a[_0x9d0c('0x3a')]=_['intersection'](_0xfd69d3[_0x9d0c('0x35')],qs['fields'](_0x53d0d5['query']['fields']));_0x5f196a['attributes']=_0x5f196a[_0x9d0c('0x3a')][_0x9d0c('0x3b')]?_0x5f196a['attributes']:_0xfd69d3[_0x9d0c('0x35')];if(!_0x53d0d5[_0x9d0c('0x36')][_0x9d0c('0x3c')](_0x9d0c('0x3d'))){_0x5f196a[_0x9d0c('0x3e')]=qs[_0x9d0c('0x3e')](_0x53d0d5['query'][_0x9d0c('0x3e')]);_0x5f196a['offset']=qs[_0x9d0c('0x20')](_0x53d0d5[_0x9d0c('0x36')]['offset']);}_0x5f196a[_0x9d0c('0x3f')]=qs[_0x9d0c('0x40')](_0x53d0d5['query'][_0x9d0c('0x40')]);delete _0x53d0d5[_0x9d0c('0x36')][_0x9d0c('0x40')];_0x5f196a[_0x9d0c('0x41')]=qs[_0x9d0c('0x38')](_[_0x9d0c('0x42')](_0x53d0d5['query'],_0xfd69d3[_0x9d0c('0x38')]),_0x162572);if(_0x53d0d5[_0x9d0c('0x36')][_0x9d0c('0x43')]){_0x5f196a[_0x9d0c('0x41')]=_[_0x9d0c('0x44')](_0x5f196a[_0x9d0c('0x41')],{'$or':_[_0x9d0c('0x2f')](_0x162572,function(_0x2d9d07){if(_0x2d9d07[_0x9d0c('0x33')]!=='VIRTUAL'){var _0x33fe56={};_0x33fe56[_0x2d9d07[_0x9d0c('0x2c')]]={'$like':'%'+_0x53d0d5[_0x9d0c('0x36')][_0x9d0c('0x43')]+'%'};return _0x33fe56;}})});}_0x5f196a=_[_0x9d0c('0x44')]({},_0x5f196a,_0x53d0d5[_0x9d0c('0x45')]);var _0x154a44={'where':_0x5f196a[_0x9d0c('0x41')]};return db['VoiceMusicOnHold'][_0x9d0c('0x1f')](_0x154a44)[_0x9d0c('0x26')](function(_0x53fb3a){_0x186b6a[_0x9d0c('0x1f')]=_0x53fb3a;if(_0x53d0d5['query'][_0x9d0c('0x46')]){_0x5f196a[_0x9d0c('0x47')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x5f196a);})[_0x9d0c('0x26')](function(_0x50ac0b){_0x186b6a[_0x9d0c('0x48')]=_0x50ac0b;return _0x186b6a;})['then'](respondWithFilteredResult(_0x1daaaa,_0x5f196a))['catch'](handleError(_0x1daaaa,null));};exports[_0x9d0c('0x49')]=function(_0x1422a0,_0x4e34e0){var _0x246164={'raw':![],'where':{'id':_0x1422a0[_0x9d0c('0x4a')]['id']}},_0x25cf8={};_0x25cf8['model']=_['keys'](db[_0x9d0c('0x30')][_0x9d0c('0x31')]);_0x25cf8['query']=_[_0x9d0c('0x37')](_0x1422a0[_0x9d0c('0x36')]);_0x25cf8[_0x9d0c('0x38')]=_['intersection'](_0x25cf8['model'],_0x25cf8['query']);_0x246164[_0x9d0c('0x3a')]=_[_0x9d0c('0x39')](_0x25cf8[_0x9d0c('0x35')],qs[_0x9d0c('0x4b')](_0x1422a0[_0x9d0c('0x36')][_0x9d0c('0x4b')]));_0x246164[_0x9d0c('0x3a')]=_0x246164[_0x9d0c('0x3a')][_0x9d0c('0x3b')]?_0x246164[_0x9d0c('0x3a')]:_0x25cf8[_0x9d0c('0x35')];if(_0x1422a0[_0x9d0c('0x36')][_0x9d0c('0x46')]){_0x246164[_0x9d0c('0x47')]=[{'all':!![]}];}_0x246164=_[_0x9d0c('0x44')]({},_0x246164,_0x1422a0[_0x9d0c('0x45')]);return db[_0x9d0c('0x30')]['find'](_0x246164)[_0x9d0c('0x26')](handleEntityNotFound(_0x4e34e0,null))[_0x9d0c('0x26')](respondWithResult(_0x4e34e0,null))['catch'](handleError(_0x4e34e0,null));};exports[_0x9d0c('0x25')]=function(_0x3a72da,_0x363b18){if(_0x3a72da[_0x9d0c('0x4c')]['id']){delete _0x3a72da[_0x9d0c('0x4c')]['id'];}return db[_0x9d0c('0x30')][_0x9d0c('0x4d')]({'where':{'id':_0x3a72da[_0x9d0c('0x4a')]['id']}})[_0x9d0c('0x26')](handleEntityNotFound(_0x363b18,null))[_0x9d0c('0x26')](saveUpdates(_0x3a72da[_0x9d0c('0x4c')],null))[_0x9d0c('0x26')](respondWithResult(_0x363b18,null))['catch'](handleError(_0x363b18,null));};exports[_0x9d0c('0x4e')]=function(_0x22ce27,_0x387577,_0x255a24){return db[_0x9d0c('0x4f')][_0x9d0c('0x50')](function(_0x43b949){if(_0x22ce27['body'][_0x9d0c('0x51')]===_0x9d0c('0x52')){_0x22ce27[_0x9d0c('0x4c')]['directory']=path['join'](config['root'],_0x9d0c('0x53'),_0x22ce27[_0x9d0c('0x4c')][_0x9d0c('0x2c')]);}return db['VoiceMusicOnHold'][_0x9d0c('0x4e')](_0x22ce27[_0x9d0c('0x4c')],{'transaction':_0x43b949})[_0x9d0c('0x26')](function(_0x1e1084){if(_0x22ce27[_0x9d0c('0x4c')][_0x9d0c('0x51')]===_0x9d0c('0x52')){fs[_0x9d0c('0x54')](_0x1e1084['directory'],parseInt(_0x9d0c('0x55'),0x8));}var _0x4c2da8=_0x22ce27[_0x9d0c('0x56')]['get']({'plain':!![]});if(!_0x4c2da8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c2da8[_0x9d0c('0x57')]==='user'){var _0x202c06=_0x1e1084['get']({'plain':!![]});return db['UserProfileSection'][_0x9d0c('0x4d')]({'where':{'name':'MusicOnHolds','userProfileId':_0x4c2da8[_0x9d0c('0x58')]},'raw':!![]})[_0x9d0c('0x26')](function(_0x4a6239){if(_0x4a6239&&_0x4a6239[_0x9d0c('0x59')]===0x0){return db[_0x9d0c('0x29')][_0x9d0c('0x4e')]({'name':_0x202c06['name'],'resourceId':_0x202c06['id'],'type':_0x4a6239[_0x9d0c('0x2c')],'sectionId':_0x4a6239['id']},{})[_0x9d0c('0x26')](function(){return _0x1e1084;});}else{return _0x1e1084;}})['catch'](function(_0x334393){logger['error'](_0x9d0c('0x5a'),_0x334393);});}return _0x1e1084;});})[_0x9d0c('0x26')](respondWithResult(_0x387577,0xc9))[_0x9d0c('0x5b')](handleError(_0x387577,null));};exports[_0x9d0c('0x5c')]=function(_0x1aeba3,_0x35a753,_0x3f0194){var _0xc33050;return db[_0x9d0c('0x30')][_0x9d0c('0x4d')]({'where':{'id':_0x1aeba3[_0x9d0c('0x4a')]['id']}})[_0x9d0c('0x26')](function(_0x891aad){if(_0x891aad){return db[_0x9d0c('0x4f')][_0x9d0c('0x50')](function(_0x6f3d80){return _0x891aad[_0x9d0c('0x5c')]({'transaction':_0x6f3d80,'raw':!![]})[_0x9d0c('0x26')](function(_0x33a81f){if(_0x33a81f['directory']){fs[_0x9d0c('0x5d')](_0x33a81f[_0x9d0c('0x5e')])[_0x9d0c('0x5f')](function(_0x3089e9){fs[_0x9d0c('0x60')](path[_0x9d0c('0x61')](_0x33a81f[_0x9d0c('0x5e')],_0x3089e9));});fs[_0x9d0c('0x62')](_0x33a81f[_0x9d0c('0x5e')]);}return _0x33a81f;});})[_0x9d0c('0x5b')](function(_0x48ecbc){throw new db[(_0x9d0c('0x63'))][(_0x9d0c('0x64'))](_0x48ecbc['message']);});}})['then'](handleEntityNotFound(_0x35a753,null))[_0x9d0c('0x26')](removeEntity(_0x35a753,null))[_0x9d0c('0x5b')](handleError(_0x35a753,null));};exports[_0x9d0c('0x65')]=function(_0xa55b59,_0x5a43cd,_0x370e65){return db[_0x9d0c('0x4f')][_0x9d0c('0x50')](function(_0x354fca){var _0x13ad66;return db[_0x9d0c('0x30')]['find']({'where':{'id':_0xa55b59[_0x9d0c('0x4a')]['id']}})['then'](function(_0x45a6f2){if(_0x45a6f2){_0x13ad66=_0x45a6f2;return _0x45a6f2[_0x9d0c('0x65')](_0xa55b59[_0x9d0c('0x4c')]['id'],{'transaction':_0x354fca});}})[_0x9d0c('0x26')](function(_0x52dd10){if(_0x52dd10){return db[_0x9d0c('0x66')][_0x9d0c('0x67')]({'where':{'id':_0xa55b59[_0x9d0c('0x4c')]['id']},'attributes':['id',_0x9d0c('0x2c'),_0x9d0c('0x68'),_0x9d0c('0x69'),'createdAt'],'raw':!![]});}})[_0x9d0c('0x26')](function(_0xb26ed5){if(_0xb26ed5){var _0x2219eb=path[_0x9d0c('0x61')](config[_0x9d0c('0x6a')],_0x9d0c('0x6b'),util[_0x9d0c('0x6c')]('%s.%s',path[_0x9d0c('0x6d')](_0xb26ed5[_0x9d0c('0x68')],path[_0x9d0c('0x6e')](_0xb26ed5[_0x9d0c('0x68')])),_0xb26ed5[_0x9d0c('0x69')]));var _0x598bab=path['join'](config[_0x9d0c('0x6a')],_0x9d0c('0x53'),_0x13ad66[_0x9d0c('0x2c')],util[_0x9d0c('0x6c')](_0x9d0c('0x6f'),_0xb26ed5[_0x9d0c('0x2c')],_0xb26ed5['converted_format']));fs['symlinkSync'](_0x2219eb,_0x598bab);return _0xb26ed5;}})[_0x9d0c('0x5b')](function(_0x2251b5){throw new db[(_0x9d0c('0x63'))][(_0x9d0c('0x64'))](_0x2251b5[_0x9d0c('0x70')]);});})[_0x9d0c('0x26')](handleEntityNotFound(_0x5a43cd,null))[_0x9d0c('0x26')](respondWithResult(_0x5a43cd,0xc9))[_0x9d0c('0x5b')](handleError(_0x5a43cd,null));};exports[_0x9d0c('0x71')]=function(_0x3bf6b7,_0x25a82c,_0x5c9ec9){return db['sequelize']['transaction'](function(_0x547861){var _0x24314b;return db['VoiceMusicOnHold'][_0x9d0c('0x67')]({'where':{'id':_0x3bf6b7['params']['id']}})['then'](handleEntityNotFound(_0x25a82c,null))['then'](function(_0x5a7427){if(_0x5a7427){_0x24314b=_0x5a7427;return _0x5a7427[_0x9d0c('0x71')](_0x3bf6b7[_0x9d0c('0x4a')]['id2']);}})[_0x9d0c('0x26')](function(_0x4bf636){if(_0x4bf636){return db['Sound'][_0x9d0c('0x67')]({'where':{'id':_0x3bf6b7[_0x9d0c('0x4a')][_0x9d0c('0x72')]},'attributes':['id','name',_0x9d0c('0x68'),_0x9d0c('0x69'),_0x9d0c('0x73')],'raw':!![]});}})['then'](function(_0x30f5fd){if(_0x30f5fd){fs[_0x9d0c('0x60')](path[_0x9d0c('0x61')](_0x24314b[_0x9d0c('0x5e')],util[_0x9d0c('0x6c')](_0x9d0c('0x6f'),_0x30f5fd[_0x9d0c('0x2c')],_0x30f5fd['converted_format'])));return _0x30f5fd;}})['catch'](function(_0x390793){throw new db['Sequelize'][(_0x9d0c('0x64'))](_0x390793['message']);});})[_0x9d0c('0x26')](handleEntityNotFound(_0x25a82c,null))[_0x9d0c('0x26')](respondWithStatusCode(_0x25a82c,0xcc))[_0x9d0c('0x5b')](handleError(_0x25a82c,null));};exports['getSounds']=function(_0x33b5f8,_0x1c978a,_0x58cbb0){var _0x9d1377={};var _0x368e59={};var _0x381dc5;var _0x5a7ddd;return db[_0x9d0c('0x30')]['findOne']({'where':{'id':_0x33b5f8['params']['id']}})[_0x9d0c('0x26')](handleEntityNotFound(_0x1c978a,null))[_0x9d0c('0x26')](function(_0x36f025){if(_0x36f025){_0x381dc5=_0x36f025;_0x368e59[_0x9d0c('0x35')]=_[_0x9d0c('0x37')](db[_0x9d0c('0x66')][_0x9d0c('0x31')]);_0x368e59[_0x9d0c('0x36')]=_[_0x9d0c('0x37')](_0x33b5f8[_0x9d0c('0x36')]);_0x368e59[_0x9d0c('0x38')]=_[_0x9d0c('0x39')](_0x368e59['model'],_0x368e59[_0x9d0c('0x36')]);_0x9d1377[_0x9d0c('0x3a')]=_[_0x9d0c('0x39')](_0x368e59['model'],qs['fields'](_0x33b5f8['query']['fields']));_0x9d1377[_0x9d0c('0x3a')]=_0x9d1377['attributes']['length']?_0x9d1377[_0x9d0c('0x3a')]:_0x368e59[_0x9d0c('0x35')];_0x9d1377[_0x9d0c('0x3f')]=qs[_0x9d0c('0x40')](_0x33b5f8[_0x9d0c('0x36')]['sort']);_0x9d1377[_0x9d0c('0x41')]=qs['filters'](_[_0x9d0c('0x42')](_0x33b5f8[_0x9d0c('0x36')],_0x368e59[_0x9d0c('0x38')]));if(_0x33b5f8[_0x9d0c('0x36')][_0x9d0c('0x43')]){_0x9d1377['where']=_[_0x9d0c('0x44')](_0x9d1377[_0x9d0c('0x41')],{'$or':_[_0x9d0c('0x2f')](_0x9d1377[_0x9d0c('0x3a')],function(_0xc639d4){var _0x20e0ef={};_0x20e0ef[_0xc639d4]={'$like':'%'+_0x33b5f8['query']['filter']+'%'};return _0x20e0ef;})});}_0x9d1377=_[_0x9d0c('0x44')]({},_0x9d1377,_0x33b5f8[_0x9d0c('0x45')]);return _0x381dc5[_0x9d0c('0x74')](_0x9d1377);}})['then'](function(_0x4959ca){if(_0x4959ca){_0x5a7ddd=_0x4959ca[_0x9d0c('0x3b')];if(!_0x33b5f8[_0x9d0c('0x36')]['hasOwnProperty'](_0x9d0c('0x3d'))){_0x9d1377[_0x9d0c('0x3e')]=qs[_0x9d0c('0x3e')](_0x33b5f8[_0x9d0c('0x36')][_0x9d0c('0x3e')]);_0x9d1377[_0x9d0c('0x20')]=qs[_0x9d0c('0x20')](_0x33b5f8[_0x9d0c('0x36')][_0x9d0c('0x20')]);}return _0x381dc5[_0x9d0c('0x74')](_0x9d1377);}})['then'](function(_0x490291){if(_0x490291){return _0x490291?{'count':_0x5a7ddd,'rows':_0x490291}:null;}})[_0x9d0c('0x26')](respondWithResult(_0x1c978a,null))[_0x9d0c('0x5b')](handleError(_0x1c978a,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index d8b049f..ad310b8 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 _0xc2d6=['define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1bc762,_0x523eb3){var _0x40f70c=function(_0x3c206e){while(--_0x3c206e){_0x1bc762['push'](_0x1bc762['shift']());}};_0x40f70c(++_0x523eb3);}(_0xc2d6,0x1e4));var _0x6c2d=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xc2d6[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x6c2d('0x0'));var util=require(_0x6c2d('0x1'));var logger=require(_0x6c2d('0x2'))('api');var moment=require(_0x6c2d('0x3'));var BPromise=require(_0x6c2d('0x4'));var rp=require(_0x6c2d('0x5'));var fs=require('fs');var path=require(_0x6c2d('0x6'));var rimraf=require(_0x6c2d('0x7'));var config=require(_0x6c2d('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x6c2d('0x9')]=function(_0x125ce4,_0x81324d){return _0x125ce4[_0x6c2d('0xa')](_0x6c2d('0xb'),attributes,{'tableName':_0x6c2d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ab1=['rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x13178a,_0x23c431){var _0x4411d9=function(_0x3dfe02){while(--_0x3dfe02){_0x13178a['push'](_0x13178a['shift']());}};_0x4411d9(++_0x23c431);}(_0x6ab1,0x124));var _0x16ab=function(_0x4cb272,_0x52c0e9){_0x4cb272=_0x4cb272-0x0;var _0x57b4aa=_0x6ab1[_0x4cb272];return _0x57b4aa;};'use strict';var _=require(_0x16ab('0x0'));var util=require(_0x16ab('0x1'));var logger=require(_0x16ab('0x2'))(_0x16ab('0x3'));var moment=require(_0x16ab('0x4'));var BPromise=require('bluebird');var rp=require(_0x16ab('0x5'));var fs=require('fs');var path=require(_0x16ab('0x6'));var rimraf=require(_0x16ab('0x7'));var config=require(_0x16ab('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x16ab('0x9')]=function(_0x55ade2,_0x23222b){return _0x55ade2[_0x16ab('0xa')](_0x16ab('0xb'),attributes,{'tableName':_0x16ab('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 6c64b69..4170151 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x304ca2,_0x5bbb93){var _0x245f5a=function(_0x5912cc){while(--_0x5912cc){_0x304ca2['push'](_0x304ca2['shift']());}};_0x245f5a(++_0x5bbb93);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0xcb91[_0x454018];return _0x24697d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _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(_0xfb1192,_0x1efde6){var _0x33c542=function(_0x1b0325){while(--_0x1b0325){_0xfb1192['push'](_0xfb1192['shift']());}};_0x33c542(++_0x1efde6);}(_0xedd9,0xfc));var _0x9edd=function(_0x24a23e,_0x576d31){_0x24a23e=_0x24a23e-0x0;var _0x51073c=_0xedd9[_0x24a23e];return _0x51073c;};'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 f335cc1..399cfed 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 _0x4aa3=['addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','index','isAuthenticated','describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','create','post','addAgents'];(function(_0x863840,_0x2387fe){var _0x5183b0=function(_0x19a1e5){while(--_0x19a1e5){_0x863840['push'](_0x863840['shift']());}};_0x5183b0(++_0x2387fe);}(_0x4aa3,0x174));var _0x34aa=function(_0x45484b,_0x243030){_0x45484b=_0x45484b-0x0;var _0x4b05f5=_0x4aa3[_0x45484b];return _0x4b05f5;};'use strict';var multer=require(_0x34aa('0x0'));var util=require(_0x34aa('0x1'));var path=require('path');var timeout=require(_0x34aa('0x2'));var express=require(_0x34aa('0x3'));var router=express['Router']();var fs_extra=require(_0x34aa('0x4'));var auth=require(_0x34aa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x34aa('0x6'));var controller=require(_0x34aa('0x7'));router[_0x34aa('0x8')]('/',auth['isAuthenticated'](),controller[_0x34aa('0x9')]);router[_0x34aa('0x8')]('/describe',auth[_0x34aa('0xa')](),controller[_0x34aa('0xb')]);router['get'](_0x34aa('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x34aa('0x8')](_0x34aa('0xd'),auth[_0x34aa('0xa')](),controller[_0x34aa('0xe')]);router[_0x34aa('0x8')](_0x34aa('0xf'),auth['isAuthenticated'](),controller[_0x34aa('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x34aa('0x11')]);router[_0x34aa('0x12')](_0x34aa('0xd'),auth['isAuthenticated'](),controller[_0x34aa('0x13')]);router['post'](_0x34aa('0xf'),auth[_0x34aa('0xa')](),controller[_0x34aa('0x14')]);router[_0x34aa('0x15')](_0x34aa('0xc'),auth['isAuthenticated'](),controller[_0x34aa('0x16')]);router[_0x34aa('0x17')](_0x34aa('0xc'),auth[_0x34aa('0xa')](),controller[_0x34aa('0x18')]);router[_0x34aa('0x17')](_0x34aa('0xd'),auth[_0x34aa('0xa')](),controller[_0x34aa('0x19')]);router[_0x34aa('0x17')](_0x34aa('0xf'),auth[_0x34aa('0xa')](),controller[_0x34aa('0x1a')]);module[_0x34aa('0x1b')]=router; \ No newline at end of file +var _0x871e=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','show','/:id/users','getAgents','/:id/teams','getTeams','post','addAgents','addTeams','put','/:id','destroy','delete','removeAgents','removeTeams'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0x871e,0x1b0));var _0xe871=function(_0x4f76db,_0x48a942){_0x4f76db=_0x4f76db-0x0;var _0x5c8b10=_0x871e[_0x4f76db];return _0x5c8b10;};'use strict';var multer=require(_0xe871('0x0'));var util=require('util');var path=require(_0xe871('0x1'));var timeout=require(_0xe871('0x2'));var express=require(_0xe871('0x3'));var router=express[_0xe871('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe871('0x5'));var interaction=require(_0xe871('0x6'));var config=require(_0xe871('0x7'));var controller=require(_0xe871('0x8'));router[_0xe871('0x9')]('/',auth[_0xe871('0xa')](),controller[_0xe871('0xb')]);router[_0xe871('0x9')](_0xe871('0xc'),auth[_0xe871('0xa')](),controller['describe']);router[_0xe871('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe871('0xd')]);router[_0xe871('0x9')](_0xe871('0xe'),auth['isAuthenticated'](),controller[_0xe871('0xf')]);router[_0xe871('0x9')](_0xe871('0x10'),auth[_0xe871('0xa')](),controller[_0xe871('0x11')]);router[_0xe871('0x12')]('/',auth[_0xe871('0xa')](),controller['create']);router[_0xe871('0x12')](_0xe871('0xe'),auth[_0xe871('0xa')](),controller[_0xe871('0x13')]);router[_0xe871('0x12')](_0xe871('0x10'),auth[_0xe871('0xa')](),controller[_0xe871('0x14')]);router[_0xe871('0x15')]('/:id',auth[_0xe871('0xa')](),controller['update']);router['delete'](_0xe871('0x16'),auth[_0xe871('0xa')](),controller[_0xe871('0x17')]);router[_0xe871('0x18')](_0xe871('0xe'),auth[_0xe871('0xa')](),controller[_0xe871('0x19')]);router[_0xe871('0x18')](_0xe871('0x10'),auth['isAuthenticated'](),controller[_0xe871('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 65752fd..11b8699 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 _0x29df=['name','INTEGER','sequelize','exports','STRING','system-','getDataValue'];(function(_0xadcd24,_0x35c083){var _0x424607=function(_0x48aa54){while(--_0x48aa54){_0xadcd24['push'](_0xadcd24['shift']());}};_0x424607(++_0x35c083);}(_0x29df,0x1c2));var _0xf29d=function(_0x560f6b,_0x3abe55){_0x560f6b=_0x560f6b-0x0;var _0x46430d=_0x29df[_0x560f6b];return _0x46430d;};'use strict';var Sequelize=require(_0xf29d('0x0'));module[_0xf29d('0x1')]={'name':{'type':Sequelize[_0xf29d('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x1f062c){return _0xf29d('0x3')+this[_0xf29d('0x4')](_0xf29d('0x5'))+'-';}},'description':{'type':Sequelize[_0xf29d('0x2')]},'callerIdAll':{'type':Sequelize[_0xf29d('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xf29d('0x6')]}}; \ No newline at end of file +var _0x70fd=['sequelize','STRING','name','VIRTUAL','system-','getDataValue'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x70fd,0x17a));var _0xd70f=function(_0x56b034,_0xb96f9b){_0x56b034=_0x56b034-0x0;var _0x25f338=_0x70fd[_0x56b034];return _0x25f338;};'use strict';var Sequelize=require(_0xd70f('0x0'));module['exports']={'name':{'type':Sequelize[_0xd70f('0x1')],'allowNull':![],'unique':_0xd70f('0x2')},'prefix':{'type':Sequelize[_0xd70f('0x3')],'get':function(_0x13be88){return _0xd70f('0x4')+this[_0xd70f('0x5')](_0xd70f('0x2'))+'-';}},'description':{'type':Sequelize[_0xd70f('0x1')]},'callerIdAll':{'type':Sequelize[_0xd70f('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index f45af9f..5b962a6 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 _0x7916=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','undefined','limit','count','offset','Content-Range','json','reject','then','destroy','get','UserProfileResource','end','error','name','send','index','map','VoicePrefix','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','keys','rawAttributes','length','find','catch','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','charAt','update','system-','transaction','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getTeams','Team','findAll','Agents','online','interface','flatMap','upsert','each','UserVoicePrefix','findOrCreate','forEach','removeTeams','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse'];(function(_0x53be63,_0x15408c){var _0x40739c=function(_0x36154a){while(--_0x36154a){_0x53be63['push'](_0x53be63['shift']());}};_0x40739c(++_0x15408c);}(_0x7916,0x128));var _0x6791=function(_0x20d0e6,_0x579837){_0x20d0e6=_0x20d0e6-0x0;var _0x4cc540=_0x7916[_0x20d0e6];return _0x4cc540;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];config[_0x6791('0x17')]=_[_0x6791('0x18')](config[_0x6791('0x17')],{'host':_0x6791('0x19'),'port':0x18eb});var socket=require(_0x6791('0x1a'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x6791('0x1b')](socket);function respondWithStatusCode(_0x5122f9,_0x2a9151){_0x2a9151=_0x2a9151||0xcc;return function(_0x4c32a1){if(_0x4c32a1){return _0x5122f9[_0x6791('0x1c')](_0x2a9151);}return _0x5122f9[_0x6791('0x1d')](_0x2a9151)['end']();};}function respondWithResult(_0x3e4792,_0x4b80ed){_0x4b80ed=_0x4b80ed||0xc8;return function(_0x3856ac){if(_0x3856ac){return _0x3e4792[_0x6791('0x1d')](_0x4b80ed)['json'](_0x3856ac);}};}function respondWithFilteredResult(_0xbc35d,_0x36d7a1){return function(_0x5bec14){if(_0x5bec14){var _0x1872f5=typeof _0x36d7a1['offset']===_0x6791('0x1e')&&typeof _0x36d7a1[_0x6791('0x1f')]===_0x6791('0x1e');var _0x3a72ce=_0x5bec14[_0x6791('0x20')];var _0x2bc0ab=_0x1872f5?0x0:_0x36d7a1[_0x6791('0x21')];var _0x581d51=_0x1872f5?_0x5bec14[_0x6791('0x20')]:_0x36d7a1[_0x6791('0x21')]+_0x36d7a1['limit'];var _0x21ef16;if(_0x581d51>=_0x3a72ce){_0x581d51=_0x3a72ce;_0x21ef16=0xc8;}else{_0x21ef16=0xce;}_0xbc35d[_0x6791('0x1d')](_0x21ef16);return _0xbc35d['set'](_0x6791('0x22'),_0x2bc0ab+'-'+_0x581d51+'/'+_0x3a72ce)[_0x6791('0x23')](_0x5bec14);}return null;};}function patchUpdates(_0x15b9ab){return function(_0x12d83b){try{jsonpatch['apply'](_0x12d83b,_0x15b9ab,!![]);}catch(_0x3e17b3){return BPromise[_0x6791('0x24')](_0x3e17b3);}return _0x12d83b['save']();};}function saveUpdates(_0x53bb44,_0x4b23bc){return function(_0x372dae){if(_0x372dae){return _0x372dae['update'](_0x53bb44)[_0x6791('0x25')](function(_0x5409f1){return _0x5409f1;});}return null;};}function removeEntity(_0x54a092,_0x496273){return function(_0x5cadc){if(_0x5cadc){return _0x5cadc[_0x6791('0x26')]()[_0x6791('0x25')](function(){var _0x56a74e=_0x5cadc[_0x6791('0x27')]({'plain':!![]});var _0x30cc17='VoicePrefixes';return db[_0x6791('0x28')]['destroy']({'where':{'type':_0x30cc17,'resourceId':_0x56a74e['id']}})[_0x6791('0x25')](function(){return _0x5cadc;});})['then'](function(){_0x54a092['status'](0xcc)[_0x6791('0x29')]();});}};}function handleEntityNotFound(_0x551718,_0x2f56a2){return function(_0x34b006){if(!_0x34b006){_0x551718['sendStatus'](0x194);}return _0x34b006;};}function handleError(_0x240a9f,_0x273f79){_0x273f79=_0x273f79||0x1f4;return function(_0x234c5e){logger[_0x6791('0x2a')](_0x234c5e['stack']);if(_0x234c5e['name']){delete _0x234c5e[_0x6791('0x2b')];}_0x240a9f['status'](_0x273f79)[_0x6791('0x2c')](_0x234c5e);};}exports[_0x6791('0x2d')]=function(_0x30397e,_0x2b98b8){var _0x1d551b={},_0x127bfa={},_0x8e2101={'count':0x0,'rows':[]};var _0x14307e=_[_0x6791('0x2e')](db[_0x6791('0x2f')]['rawAttributes'],function(_0x28b3d4){return{'name':_0x28b3d4[_0x6791('0x30')],'type':_0x28b3d4[_0x6791('0x31')][_0x6791('0x32')]};});_0x127bfa[_0x6791('0x33')]=_[_0x6791('0x2e')](_0x14307e,'name');_0x127bfa['query']=_['keys'](_0x30397e[_0x6791('0x34')]);_0x127bfa[_0x6791('0x35')]=_[_0x6791('0x36')](_0x127bfa['model'],_0x127bfa['query']);_0x1d551b[_0x6791('0x37')]=_[_0x6791('0x36')](_0x127bfa[_0x6791('0x33')],qs[_0x6791('0x38')](_0x30397e['query'][_0x6791('0x38')]));_0x1d551b[_0x6791('0x37')]=_0x1d551b[_0x6791('0x37')]['length']?_0x1d551b[_0x6791('0x37')]:_0x127bfa['model'];if(!_0x30397e['query'][_0x6791('0x39')](_0x6791('0x3a'))){_0x1d551b['limit']=qs[_0x6791('0x1f')](_0x30397e[_0x6791('0x34')][_0x6791('0x1f')]);_0x1d551b[_0x6791('0x21')]=qs[_0x6791('0x21')](_0x30397e['query'][_0x6791('0x21')]);}_0x1d551b[_0x6791('0x3b')]=qs[_0x6791('0x3c')](_0x30397e['query'][_0x6791('0x3c')]);_0x1d551b[_0x6791('0x3d')]=qs[_0x6791('0x35')](_['pick'](_0x30397e[_0x6791('0x34')],_0x127bfa[_0x6791('0x35')]),_0x14307e);if(_0x30397e[_0x6791('0x34')][_0x6791('0x3e')]){_0x1d551b['where']=_[_0x6791('0x3f')](_0x1d551b[_0x6791('0x3d')],{'$or':_[_0x6791('0x2e')](_0x14307e,function(_0xd0f1c){if(_0xd0f1c[_0x6791('0x31')]!==_0x6791('0x40')){var _0x2688a9={};_0x2688a9[_0xd0f1c[_0x6791('0x2b')]]={'$like':'%'+_0x30397e[_0x6791('0x34')]['filter']+'%'};return _0x2688a9;}})});}_0x1d551b=_['merge']({},_0x1d551b,_0x30397e[_0x6791('0x41')]);var _0xe11675={'where':_0x1d551b['where']};return db[_0x6791('0x2f')][_0x6791('0x20')](_0xe11675)[_0x6791('0x25')](function(_0x3edb86){_0x8e2101[_0x6791('0x20')]=_0x3edb86;if(_0x30397e[_0x6791('0x34')][_0x6791('0x42')]){_0x1d551b['include']=[{'all':!![]}];}return db[_0x6791('0x2f')]['findAll'](_0x1d551b);})[_0x6791('0x25')](function(_0xfc170e){_0x8e2101[_0x6791('0x43')]=_0xfc170e;return _0x8e2101;})[_0x6791('0x25')](respondWithFilteredResult(_0x2b98b8,_0x1d551b))['catch'](handleError(_0x2b98b8,null));};exports[_0x6791('0x44')]=function(_0x4f0e2d,_0xeb9d45){var _0x3251e9={'raw':![],'where':{'id':_0x4f0e2d[_0x6791('0x45')]['id']}},_0x5a7fb6={};_0x5a7fb6[_0x6791('0x33')]=_[_0x6791('0x46')](db['VoicePrefix'][_0x6791('0x47')]);_0x5a7fb6[_0x6791('0x34')]=_[_0x6791('0x46')](_0x4f0e2d[_0x6791('0x34')]);_0x5a7fb6['filters']=_[_0x6791('0x36')](_0x5a7fb6[_0x6791('0x33')],_0x5a7fb6['query']);_0x3251e9[_0x6791('0x37')]=_['intersection'](_0x5a7fb6[_0x6791('0x33')],qs[_0x6791('0x38')](_0x4f0e2d[_0x6791('0x34')][_0x6791('0x38')]));_0x3251e9[_0x6791('0x37')]=_0x3251e9[_0x6791('0x37')][_0x6791('0x48')]?_0x3251e9[_0x6791('0x37')]:_0x5a7fb6[_0x6791('0x33')];if(_0x4f0e2d['query'][_0x6791('0x42')]){_0x3251e9['include']=[{'all':!![]}];}_0x3251e9=_[_0x6791('0x3f')]({},_0x3251e9,_0x4f0e2d[_0x6791('0x41')]);return db[_0x6791('0x2f')][_0x6791('0x49')](_0x3251e9)[_0x6791('0x25')](handleEntityNotFound(_0xeb9d45,null))['then'](respondWithResult(_0xeb9d45,null))[_0x6791('0x4a')](handleError(_0xeb9d45,null));};exports[_0x6791('0x26')]=function(_0x235b56,_0x3d22f3){return db[_0x6791('0x2f')]['find']({'where':{'id':_0x235b56[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x3d22f3,null))['then'](removeEntity(_0x3d22f3,null))[_0x6791('0x4a')](handleError(_0x3d22f3,null));};exports['describe']=function(_0x3d4b7e,_0x22a4d3){return db[_0x6791('0x2f')][_0x6791('0x4b')]()['then'](respondWithResult(_0x22a4d3,null))[_0x6791('0x4a')](handleError(_0x22a4d3,null));};exports[_0x6791('0x4c')]=function(_0x5655c8,_0x189b22){var _0x4370ab;return db[_0x6791('0x4d')]['transaction'](function(_0x355e97){return db[_0x6791('0x2f')]['create'](_0x5655c8[_0x6791('0x4e')],{'transaction':_0x355e97})[_0x6791('0x25')](function(_0x49d583){_0x4370ab=_0x49d583[_0x6791('0x27')]({'plain':!![]});return db[_0x6791('0x4f')][_0x6791('0x49')]({'where':{'id':_0x4370ab[_0x6791('0x50')]},'raw':!![]})['then'](function(_0x3c1076){return createVoicePrefixExtensions(_0x4370ab,_0x3c1076,_0x355e97);});});})[_0x6791('0x25')](function(){var _0x32f36b=_0x5655c8['user']['get']({'plain':!![]});if(!_0x32f36b)throw new Error(_0x6791('0x51'));if(_0x32f36b[_0x6791('0x52')]===_0x6791('0x53')){var _0x45756f=_0x4370ab;return db[_0x6791('0x54')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x32f36b[_0x6791('0x55')]},'raw':!![]})['then'](function(_0x51f071){if(_0x51f071&&_0x51f071[_0x6791('0x56')]===0x0){return db[_0x6791('0x28')][_0x6791('0x4c')]({'name':_0x45756f[_0x6791('0x2b')],'resourceId':_0x45756f['id'],'type':_0x51f071[_0x6791('0x2b')],'sectionId':_0x51f071['id']},{})[_0x6791('0x25')](function(){return _0x4370ab;});}else{return _0x4370ab;}})['catch'](function(_0x5a30f3){logger[_0x6791('0x2a')](_0x6791('0x57'),_0x5a30f3);throw _0x5a30f3;});}return _0x4370ab;})['then'](respondWithResult(_0x189b22,null))[_0x6791('0x4a')](handleError(_0x189b22,null));};function Extension(_0x535ecf,_0x473443,_0x15fb6c,_0x50cf85){this[_0x6791('0x58')]=_0x6791('0x59');this[_0x6791('0x5a')]=_0x535ecf;this['app']=_0x15fb6c;this[_0x6791('0x31')]=_0x6791('0x5b');this[_0x6791('0x5c')]=_0x6791('0x5d');this[_0x6791('0x5e')]=_0x473443;this['appdata']=_0x50cf85;}function createVoicePrefixExtensions(_0x54d0ba,_0x1a9acd,_0x13430e){return new BPromise(function(_0x5d2668,_0x329fc0){var _0x466a64=new Extension(formatPrefixName(_0x54d0ba[_0x6791('0x5f')]),0x1,_0x6791('0x60'),_0x6791('0x61'));_0x466a64[_0x6791('0x62')]=_0x54d0ba['id'];return db[_0x6791('0x4f')][_0x6791('0x4c')](_0x466a64,{'transaction':_0x13430e})['then'](function(_0x2c5f12){var _0x3b46bf=_0x2c5f12[_0x6791('0x27')]({'plain':!![]});var _0x1a9a2e=_['map'](addVoicePrefixExtensions(_0x54d0ba,_0x1a9acd),function(_0x16dff7){_0x16dff7[_0x6791('0x50')]=_0x3b46bf['id'];_0x16dff7[_0x6791('0x62')]=_0x54d0ba['id'];return _0x16dff7;});return db['VoiceExtension'][_0x6791('0x63')](_0x1a9a2e,{'transaction':_0x13430e})[_0x6791('0x25')](function(_0x99d4ee){if(!_0x99d4ee){return _0x329fc0(_0x6791('0x64'));}else{return _0x5d2668(_0x99d4ee);}})['catch'](function(_0x2c834f){return _0x329fc0(_0x2c834f);});});;});};function addVoicePrefixExtensions(_0x2843fb,_0x5522db){var _0x1114d4=[];var _0x901cc1=formatPrefixName(_0x2843fb[_0x6791('0x5f')]);_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x2,_0x6791('0x66'),_0x6791('0x67')+_0x2843fb['name']));if(_0x2843fb[_0x6791('0x68')]){_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x3,_0x6791('0x66'),'PREFIX-CALLERIDALL='+_0x2843fb[_0x6791('0x68')]));}else{_0x1114d4['push'](new Extension(_0x901cc1,0x3,_0x6791('0x60'),_0x6791('0x69')));}_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x4,_0x6791('0x6a'),_0x5522db[_0x6791('0x58')]+','+'${EXTEN:'+(0x8+_0x2843fb[_0x6791('0x2b')][_0x6791('0x48')])+'}'+','+0x1));return _0x1114d4;}function formatPrefixName(_0x375062){var _0x2accfa='_';for(var _0x5f158f=0x0;_0x5f158f<_0x375062[_0x6791('0x48')];_0x5f158f++){if(_0x375062[_0x6791('0x6b')](_0x5f158f)=='-'){_0x2accfa+=_0x375062['charAt'](_0x5f158f);}else{_0x2accfa+='['+_0x375062[_0x6791('0x6b')](_0x5f158f)+']';}}_0x2accfa+='.';return _0x2accfa;}exports[_0x6791('0x6c')]=function(_0x567302,_0x201465,_0x23b9b4){var _0x113d9f=_0x567302[_0x6791('0x4e')];_0x113d9f['prefix']=_0x6791('0x6d')+_0x113d9f[_0x6791('0x2b')]+'-';return db['sequelize'][_0x6791('0x6e')](function(_0x26c2aa){return db[_0x6791('0x2f')][_0x6791('0x6c')](_0x113d9f,{'where':{'id':_0x113d9f['id']},'transaction':_0x26c2aa})[_0x6791('0x25')](function(){return db['VoiceExtension'][_0x6791('0x26')]({'where':{'VoicePrefixId':_0x113d9f['id']},'transaction':_0x26c2aa})[_0x6791('0x25')](function(){return db['VoiceExtension'][_0x6791('0x49')]({'where':{'id':_0x113d9f[_0x6791('0x50')]},'raw':!![]})[_0x6791('0x25')](function(_0x4bbf2d){return createVoicePrefixExtensions(_0x113d9f,_0x4bbf2d,_0x26c2aa);});});});})[_0x6791('0x25')](function(){return db[_0x6791('0x2f')][_0x6791('0x6f')](_0x113d9f['id']);})[_0x6791('0x25')](respondWithResult(_0x201465,null))[_0x6791('0x4a')](handleError(_0x201465,null));};exports[_0x6791('0x70')]=function(_0x367dc9,_0x30b3e6,_0x4cca28){return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x367dc9['params']['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x30b3e6,null))[_0x6791('0x25')](function(_0x410a66){if(_0x410a66){return _0x410a66['addAgents'](_0x367dc9[_0x6791('0x4e')]['ids'],_[_0x6791('0x71')](_0x367dc9[_0x6791('0x4e')],[_0x6791('0x72'),'id'])||{})[_0x6791('0x73')](function(_0x3a964a){for(var _0x2d15b5=0x0;_0x2d15b5<_0x367dc9[_0x6791('0x4e')][_0x6791('0x72')][_0x6791('0x48')];_0x2d15b5+=0x1){socket[_0x6791('0x74')](_0x6791('0x75'),{'UserId':Number(_0x367dc9[_0x6791('0x4e')][_0x6791('0x72')][_0x2d15b5]),'VoicePrefixId':Number(_0x367dc9[_0x6791('0x45')]['id'])});}return _0x3a964a;});}})[_0x6791('0x25')](respondWithResult(_0x30b3e6,null))[_0x6791('0x4a')](handleError(_0x30b3e6,null));};exports[_0x6791('0x76')]=function(_0x386bc7,_0xc6c959,_0x5cf7d7){return db['VoicePrefix']['find']({'where':{'id':_0x386bc7[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0xc6c959,null))[_0x6791('0x25')](function(_0x194a0b){if(_0x194a0b){return _0x194a0b[_0x6791('0x76')](_0x386bc7[_0x6791('0x34')][_0x6791('0x72')])[_0x6791('0x25')](function(){if(_[_0x6791('0x77')](_0x386bc7[_0x6791('0x34')][_0x6791('0x72')])){for(var _0x37ae6b=0x0;_0x37ae6b<_0x386bc7[_0x6791('0x34')][_0x6791('0x72')][_0x6791('0x48')];_0x37ae6b+=0x1){socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':Number(_0x386bc7[_0x6791('0x34')][_0x6791('0x72')][_0x37ae6b]),'VoicePrefixId':Number(_0x386bc7[_0x6791('0x45')]['id'])});}}else{socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':Number(_0x386bc7[_0x6791('0x34')][_0x6791('0x72')]),'VoicePrefixId':Number(_0x386bc7[_0x6791('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0xc6c959,null))[_0x6791('0x4a')](handleError(_0xc6c959,null));};exports['getAgents']=function(_0x8d9556,_0x11eb22,_0x4b262c){var _0x1c2864={};var _0x503041={};var _0x27e3bd;var _0x26e77c;return db['VoicePrefix'][_0x6791('0x79')]({'where':{'id':_0x8d9556[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x11eb22,null))['then'](function(_0x41fcf4){if(_0x41fcf4){_0x27e3bd=_0x41fcf4;_0x503041[_0x6791('0x33')]=_[_0x6791('0x46')](db[_0x6791('0x7a')][_0x6791('0x47')]);_0x503041[_0x6791('0x34')]=_['keys'](_0x8d9556[_0x6791('0x34')]);_0x503041[_0x6791('0x35')]=_[_0x6791('0x36')](_0x503041[_0x6791('0x33')],_0x503041[_0x6791('0x34')]);_0x1c2864[_0x6791('0x37')]=_[_0x6791('0x36')](_0x503041['model'],qs[_0x6791('0x38')](_0x8d9556['query'][_0x6791('0x38')]));_0x1c2864['attributes']=_0x1c2864[_0x6791('0x37')][_0x6791('0x48')]?_0x1c2864[_0x6791('0x37')]:_0x503041[_0x6791('0x33')];_0x1c2864[_0x6791('0x3b')]=qs[_0x6791('0x3c')](_0x8d9556['query'][_0x6791('0x3c')]);_0x1c2864['where']=qs[_0x6791('0x35')](_['pick'](_0x8d9556['query'],_0x503041['filters']));if(_0x8d9556[_0x6791('0x34')][_0x6791('0x3e')]){_0x1c2864['where']=_[_0x6791('0x3f')](_0x1c2864['where'],{'$or':_[_0x6791('0x2e')](_0x1c2864[_0x6791('0x37')],function(_0x4f52c2){var _0x494435={};_0x494435[_0x4f52c2]={'$like':'%'+_0x8d9556['query'][_0x6791('0x3e')]+'%'};return _0x494435;})});}_0x1c2864=_[_0x6791('0x3f')]({},_0x1c2864,_0x8d9556[_0x6791('0x41')]);return _0x27e3bd['getAgents'](_0x1c2864);}})[_0x6791('0x25')](function(_0x20ded4){if(_0x20ded4){_0x26e77c=_0x20ded4[_0x6791('0x48')];if(!_0x8d9556[_0x6791('0x34')][_0x6791('0x39')]('nolimit')){_0x1c2864[_0x6791('0x1f')]=qs[_0x6791('0x1f')](_0x8d9556[_0x6791('0x34')][_0x6791('0x1f')]);_0x1c2864[_0x6791('0x21')]=qs['offset'](_0x8d9556[_0x6791('0x34')][_0x6791('0x21')]);}return _0x27e3bd['getAgents'](_0x1c2864);}})[_0x6791('0x25')](function(_0x46aea7){if(_0x46aea7){return _0x46aea7?{'count':_0x26e77c,'rows':_0x46aea7}:null;}})[_0x6791('0x25')](respondWithResult(_0x11eb22,null))[_0x6791('0x4a')](handleError(_0x11eb22,null));};exports['getTeams']=function(_0x29e2a0,_0x1092d4,_0x370da4){var _0xdf1dd4={};var _0xa5eb83={};var _0x145814;var _0x5dcaab;return db[_0x6791('0x2f')]['findOne']({'where':{'id':_0x29e2a0['params']['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x1092d4,null))[_0x6791('0x25')](function(_0x313d5d){if(_0x313d5d){_0x145814=_0x313d5d;_0xa5eb83['model']=_[_0x6791('0x46')](db['Team'][_0x6791('0x47')]);_0xa5eb83[_0x6791('0x34')]=_['keys'](_0x29e2a0[_0x6791('0x34')]);_0xa5eb83[_0x6791('0x35')]=_[_0x6791('0x36')](_0xa5eb83[_0x6791('0x33')],_0xa5eb83[_0x6791('0x34')]);_0xdf1dd4['attributes']=_[_0x6791('0x36')](_0xa5eb83[_0x6791('0x33')],qs[_0x6791('0x38')](_0x29e2a0['query']['fields']));_0xdf1dd4[_0x6791('0x37')]=_0xdf1dd4[_0x6791('0x37')]['length']?_0xdf1dd4[_0x6791('0x37')]:_0xa5eb83[_0x6791('0x33')];_0xdf1dd4[_0x6791('0x3b')]=qs['sort'](_0x29e2a0[_0x6791('0x34')]['sort']);_0xdf1dd4['where']=qs[_0x6791('0x35')](_['pick'](_0x29e2a0[_0x6791('0x34')],_0xa5eb83[_0x6791('0x35')]));if(_0x29e2a0[_0x6791('0x34')][_0x6791('0x3e')]){_0xdf1dd4[_0x6791('0x3d')]=_[_0x6791('0x3f')](_0xdf1dd4['where'],{'$or':_[_0x6791('0x2e')](_0xdf1dd4['attributes'],function(_0x221fad){var _0x4d6641={};_0x4d6641[_0x221fad]={'$like':'%'+_0x29e2a0['query'][_0x6791('0x3e')]+'%'};return _0x4d6641;})});}_0xdf1dd4=_[_0x6791('0x3f')]({},_0xdf1dd4,_0x29e2a0[_0x6791('0x41')]);return _0x145814[_0x6791('0x7b')](_0xdf1dd4);}})[_0x6791('0x25')](function(_0x11089f){if(_0x11089f){_0x5dcaab=_0x11089f[_0x6791('0x48')];if(!_0x29e2a0[_0x6791('0x34')][_0x6791('0x39')](_0x6791('0x3a'))){_0xdf1dd4[_0x6791('0x1f')]=qs[_0x6791('0x1f')](_0x29e2a0[_0x6791('0x34')][_0x6791('0x1f')]);_0xdf1dd4[_0x6791('0x21')]=qs[_0x6791('0x21')](_0x29e2a0[_0x6791('0x34')][_0x6791('0x21')]);}return _0x145814[_0x6791('0x7b')](_0xdf1dd4);}})['then'](function(_0xfef30e){if(_0xfef30e){return _0xfef30e?{'count':_0x5dcaab,'rows':_0xfef30e}:null;}})[_0x6791('0x25')](respondWithResult(_0x1092d4,null))[_0x6791('0x4a')](handleError(_0x1092d4,null));};exports['addTeams']=function(_0x4c6eb1,_0x4bce1d,_0x42d7fb){var _0x257efa=_0x4c6eb1['body'][_0x6791('0x72')];var _0x17c93e;return db[_0x6791('0x7c')][_0x6791('0x7d')]({'where':{'id':_0x257efa},'attributes':['id'],'include':[{'model':db[_0x6791('0x7a')],'as':_0x6791('0x7e'),'attributes':['id',_0x6791('0x2b'),_0x6791('0x7f'),'voicePause',_0x6791('0x80')],'raw':!![]}]})['then'](function(_0xd61243){if(_0xd61243){_0x17c93e=_0xd61243;var _0x123627=_[_0x6791('0x81')](_0xd61243,function(_0x5d5963){var _0x4d36de=_0x5d5963['get']({'plain':!![]});return _0x4d36de[_0x6791('0x7e')];});return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x4c6eb1[_0x6791('0x45')]['id']}})['then'](function(_0x3b487a){return db[_0x6791('0x4d')][_0x6791('0x6e')](function(_0x3b0d8f){return _0x3b487a['addTeams'](_0x257efa,{'transaction':_0x3b0d8f})['then'](function(){return BPromise['each'](_0x17c93e,function(_0x3a7711){return db['TeamVoicePrefix'][_0x6791('0x82')]({'TeamId':_0x3a7711['id'],'VoicePrefixId':_0x4c6eb1[_0x6791('0x45')]['id']},{'transaction':_0x3b0d8f});});})[_0x6791('0x25')](function(){return BPromise[_0x6791('0x83')](_0x123627,function(_0x15a95b){return db[_0x6791('0x84')][_0x6791('0x85')]({'where':{'UserId':_0x15a95b['id'],'VoicePrefixId':_0x4c6eb1[_0x6791('0x45')]['id']},'transaction':_0x3b0d8f});});})['then'](function(){_0x123627[_0x6791('0x86')](function(_0x300c8b){socket['emit'](_0x6791('0x75'),{'UserId':_0x300c8b['id'],'VoicePrefixId':_0x3b487a['id']});});});});});}})[_0x6791('0x25')](respondWithStatusCode(_0x4bce1d,null))[_0x6791('0x4a')](handleError(_0x4bce1d,null));};exports[_0x6791('0x87')]=function(_0x4f88e4,_0x447ea6,_0x31a2c8){return db[_0x6791('0x7c')][_0x6791('0x7d')]({'where':{'id':_0x4f88e4[_0x6791('0x34')][_0x6791('0x72')]},'attributes':['id'],'include':[{'model':db[_0x6791('0x7a')],'as':_0x6791('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x6791('0x25')](handleEntityNotFound(_0x447ea6,null))['then'](function(_0x150a13){var _0x211721=_[_0x6791('0x2e')](_0x150a13,'id');var _0xb7986d=[];var _0x19cb72=[];var _0x5aad37=squel['select']();_0x5aad37[_0x6791('0x88')](_0x6791('0x89'))['from'](_0x6791('0x8a'),'tq')[_0x6791('0x8b')](_0x6791('0x8c'),'ut',_0x6791('0x8d'))[_0x6791('0x3d')](_0x6791('0x8e'),_0x4f88e4[_0x6791('0x45')]['id']);for(var _0x21a12c=0x0;_0x21a12c<_0x150a13[_0x6791('0x48')];_0x21a12c+=0x1){let _0x54a34f=_0x150a13[_0x21a12c];for(var _0x405e1c=0x0;_0x405e1c<_0x54a34f[_0x6791('0x7e')]['length'];_0x405e1c+=0x1){let _0x303ba8=_0x54a34f['Agents'][_0x405e1c];var _0x23bed3=_0x5aad37[_0x6791('0x8f')]();_0x23bed3[_0x6791('0x3d')](_0x6791('0x90'),_0x303ba8['id']);_0x19cb72[_0x6791('0x65')](db[_0x6791('0x4d')][_0x6791('0x34')](_0x23bed3[_0x6791('0x91')](),{'type':db[_0x6791('0x4d')][_0x6791('0x92')][_0x6791('0x93')]})[_0x6791('0x25')](function(_0x1f06d8){if(_0x1f06d8[_0x6791('0x48')]===0x1){return _0x303ba8['id'];}else{var _0x46d6ff=_[_0x6791('0x94')](_[_0x6791('0x2e')](_0x1f06d8,_0x6791('0x95')),function(_0x462e03){return _['includes'](_0x211721,_0x462e03);});if(_0x46d6ff){return _0x303ba8['id'];}}}));}}return BPromise[_0x6791('0x96')](_0x19cb72)['then'](function(_0x41385c){_0xb7986d=_(_0xb7986d)[_0x6791('0x97')](_0x41385c)[_0x6791('0x98')]()[_0x6791('0x99')]();return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x4f88e4[_0x6791('0x45')]['id']}})[_0x6791('0x25')](function(_0x546bf7){return db[_0x6791('0x4d')]['transaction'](function(_0x54cf28){return _0x546bf7[_0x6791('0x87')](_0x4f88e4[_0x6791('0x34')][_0x6791('0x72')],{'transaction':_0x54cf28})[_0x6791('0x25')](function(){if(!_[_0x6791('0x9a')](_0xb7986d)){return _0x546bf7[_0x6791('0x76')](_0xb7986d,{'transaction':_0x54cf28});}})[_0x6791('0x25')](function(){_0xb7986d['forEach'](function(_0x3b7b0f){socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':_0x3b7b0f,'VoicePrefixId':_0x546bf7['id']});});});});});});})[_0x6791('0x25')](respondWithStatusCode(_0x447ea6,null))[_0x6791('0x4a')](handleError(_0x447ea6,null));}; \ No newline at end of file +var _0x3423=['VoiceExtension','role','user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','charAt','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','order','getAgents','nolimit','getTeams','Team','addTeams','online','Agents','each','TeamVoicePrefix','upsert','findOrCreate','forEach','removeTeams','User','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','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','../../components/auth/service','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','UserProfileResource','then','end','error','stack','name','index','VoicePrefix','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','includeAll','find','params','describe','create','sequelize','body','get'];(function(_0x5bc954,_0x18dac4){var _0xf24448=function(_0x27b1e5){while(--_0x27b1e5){_0x5bc954['push'](_0x5bc954['shift']());}};_0xf24448(++_0x18dac4);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3342('0x0'));var jsonpatch=require(_0x3342('0x1'));var rp=require(_0x3342('0x2'));var moment=require(_0x3342('0x3'));var BPromise=require(_0x3342('0x4'));var Mustache=require(_0x3342('0x5'));var util=require(_0x3342('0x6'));var path=require(_0x3342('0x7'));var sox=require(_0x3342('0x8'));var csv=require(_0x3342('0x9'));var ejs=require(_0x3342('0xa'));var fs=require('fs');var fs_extra=require(_0x3342('0xb'));var _=require(_0x3342('0xc'));var squel=require(_0x3342('0xd'));var crypto=require(_0x3342('0xe'));var jsforce=require(_0x3342('0xf'));var deskjs=require(_0x3342('0x10'));var toCsv=require(_0x3342('0x9'));var querystring=require(_0x3342('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3342('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3342('0x13'));var utils=require(_0x3342('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3342('0x15'));var db=require('../../mysqldb')['db'];config[_0x3342('0x16')]=_[_0x3342('0x17')](config['redis'],{'host':_0x3342('0x18'),'port':0x18eb});var socket=require(_0x3342('0x19'))(new Redis(config[_0x3342('0x16')]));require(_0x3342('0x1a'))[_0x3342('0x1b')](socket);function respondWithStatusCode(_0x104077,_0x34a306){_0x34a306=_0x34a306||0xcc;return function(_0x59be1d){if(_0x59be1d){return _0x104077[_0x3342('0x1c')](_0x34a306);}return _0x104077[_0x3342('0x1d')](_0x34a306)['end']();};}function respondWithResult(_0x40d609,_0x2c9df0){_0x2c9df0=_0x2c9df0||0xc8;return function(_0x51ef91){if(_0x51ef91){return _0x40d609['status'](_0x2c9df0)[_0x3342('0x1e')](_0x51ef91);}};}function respondWithFilteredResult(_0x143cf1,_0x6949fc){return function(_0x2075cb){if(_0x2075cb){var _0x12947a=typeof _0x6949fc[_0x3342('0x1f')]===_0x3342('0x20')&&typeof _0x6949fc[_0x3342('0x21')]===_0x3342('0x20');var _0x4f4c2a=_0x2075cb[_0x3342('0x22')];var _0xda235a=_0x12947a?0x0:_0x6949fc[_0x3342('0x1f')];var _0x5e05f5=_0x12947a?_0x2075cb[_0x3342('0x22')]:_0x6949fc[_0x3342('0x1f')]+_0x6949fc['limit'];var _0xe774b7;if(_0x5e05f5>=_0x4f4c2a){_0x5e05f5=_0x4f4c2a;_0xe774b7=0xc8;}else{_0xe774b7=0xce;}_0x143cf1[_0x3342('0x1d')](_0xe774b7);return _0x143cf1['set'](_0x3342('0x23'),_0xda235a+'-'+_0x5e05f5+'/'+_0x4f4c2a)['json'](_0x2075cb);}return null;};}function patchUpdates(_0x3f271c){return function(_0x38994e){try{jsonpatch[_0x3342('0x24')](_0x38994e,_0x3f271c,!![]);}catch(_0x2dbad1){return BPromise[_0x3342('0x25')](_0x2dbad1);}return _0x38994e[_0x3342('0x26')]();};}function saveUpdates(_0x26eb87,_0x2d8622){return function(_0x5d4f14){if(_0x5d4f14){return _0x5d4f14[_0x3342('0x27')](_0x26eb87)['then'](function(_0x51cf45){return _0x51cf45;});}return null;};}function removeEntity(_0x986ab0,_0x52ba65){return function(_0x5d2f0b){if(_0x5d2f0b){return _0x5d2f0b[_0x3342('0x28')]()['then'](function(){var _0x37df78=_0x5d2f0b['get']({'plain':!![]});var _0x524286='VoicePrefixes';return db[_0x3342('0x29')][_0x3342('0x28')]({'where':{'type':_0x524286,'resourceId':_0x37df78['id']}})[_0x3342('0x2a')](function(){return _0x5d2f0b;});})['then'](function(){_0x986ab0[_0x3342('0x1d')](0xcc)[_0x3342('0x2b')]();});}};}function handleEntityNotFound(_0x1cc542,_0x272a52){return function(_0x4fbfb7){if(!_0x4fbfb7){_0x1cc542[_0x3342('0x1c')](0x194);}return _0x4fbfb7;};}function handleError(_0x3d6810,_0x387ba2){_0x387ba2=_0x387ba2||0x1f4;return function(_0x301114){logger[_0x3342('0x2c')](_0x301114[_0x3342('0x2d')]);if(_0x301114[_0x3342('0x2e')]){delete _0x301114['name'];}_0x3d6810[_0x3342('0x1d')](_0x387ba2)['send'](_0x301114);};}exports[_0x3342('0x2f')]=function(_0x407f8c,_0x508f87){var _0x250396={},_0x1cc42d={},_0x347d52={'count':0x0,'rows':[]};var _0x4e7410=_['map'](db[_0x3342('0x30')][_0x3342('0x31')],function(_0x311cfe){return{'name':_0x311cfe[_0x3342('0x32')],'type':_0x311cfe[_0x3342('0x33')][_0x3342('0x34')]};});_0x1cc42d[_0x3342('0x35')]=_[_0x3342('0x36')](_0x4e7410,_0x3342('0x2e'));_0x1cc42d[_0x3342('0x37')]=_[_0x3342('0x38')](_0x407f8c[_0x3342('0x37')]);_0x1cc42d['filters']=_['intersection'](_0x1cc42d[_0x3342('0x35')],_0x1cc42d['query']);_0x250396[_0x3342('0x39')]=_[_0x3342('0x3a')](_0x1cc42d[_0x3342('0x35')],qs[_0x3342('0x3b')](_0x407f8c[_0x3342('0x37')][_0x3342('0x3b')]));_0x250396[_0x3342('0x39')]=_0x250396['attributes'][_0x3342('0x3c')]?_0x250396[_0x3342('0x39')]:_0x1cc42d[_0x3342('0x35')];if(!_0x407f8c[_0x3342('0x37')][_0x3342('0x3d')]('nolimit')){_0x250396[_0x3342('0x21')]=qs['limit'](_0x407f8c[_0x3342('0x37')][_0x3342('0x21')]);_0x250396[_0x3342('0x1f')]=qs[_0x3342('0x1f')](_0x407f8c['query'][_0x3342('0x1f')]);}_0x250396['order']=qs[_0x3342('0x3e')](_0x407f8c[_0x3342('0x37')][_0x3342('0x3e')]);_0x250396[_0x3342('0x3f')]=qs[_0x3342('0x40')](_[_0x3342('0x41')](_0x407f8c[_0x3342('0x37')],_0x1cc42d['filters']),_0x4e7410);if(_0x407f8c[_0x3342('0x37')][_0x3342('0x42')]){_0x250396['where']=_[_0x3342('0x43')](_0x250396[_0x3342('0x3f')],{'$or':_['map'](_0x4e7410,function(_0x45b956){if(_0x45b956[_0x3342('0x33')]!=='VIRTUAL'){var _0x4985db={};_0x4985db[_0x45b956['name']]={'$like':'%'+_0x407f8c[_0x3342('0x37')][_0x3342('0x42')]+'%'};return _0x4985db;}})});}_0x250396=_['merge']({},_0x250396,_0x407f8c[_0x3342('0x44')]);var _0x2a1f7e={'where':_0x250396[_0x3342('0x3f')]};return db[_0x3342('0x30')][_0x3342('0x22')](_0x2a1f7e)[_0x3342('0x2a')](function(_0x34de7b){_0x347d52[_0x3342('0x22')]=_0x34de7b;if(_0x407f8c['query']['includeAll']){_0x250396[_0x3342('0x45')]=[{'all':!![]}];}return db[_0x3342('0x30')][_0x3342('0x46')](_0x250396);})[_0x3342('0x2a')](function(_0x717946){_0x347d52[_0x3342('0x47')]=_0x717946;return _0x347d52;})['then'](respondWithFilteredResult(_0x508f87,_0x250396))[_0x3342('0x48')](handleError(_0x508f87,null));};exports[_0x3342('0x49')]=function(_0x283ce9,_0x309423){var _0x64e352={'raw':![],'where':{'id':_0x283ce9['params']['id']}},_0x365d6f={};_0x365d6f[_0x3342('0x35')]=_['keys'](db[_0x3342('0x30')][_0x3342('0x31')]);_0x365d6f[_0x3342('0x37')]=_[_0x3342('0x38')](_0x283ce9['query']);_0x365d6f[_0x3342('0x40')]=_[_0x3342('0x3a')](_0x365d6f['model'],_0x365d6f[_0x3342('0x37')]);_0x64e352[_0x3342('0x39')]=_[_0x3342('0x3a')](_0x365d6f[_0x3342('0x35')],qs['fields'](_0x283ce9[_0x3342('0x37')][_0x3342('0x3b')]));_0x64e352['attributes']=_0x64e352[_0x3342('0x39')]['length']?_0x64e352['attributes']:_0x365d6f[_0x3342('0x35')];if(_0x283ce9[_0x3342('0x37')][_0x3342('0x4a')]){_0x64e352[_0x3342('0x45')]=[{'all':!![]}];}_0x64e352=_[_0x3342('0x43')]({},_0x64e352,_0x283ce9[_0x3342('0x44')]);return db[_0x3342('0x30')]['find'](_0x64e352)['then'](handleEntityNotFound(_0x309423,null))[_0x3342('0x2a')](respondWithResult(_0x309423,null))['catch'](handleError(_0x309423,null));};exports[_0x3342('0x28')]=function(_0x5e1202,_0x4c9214){return db['VoicePrefix'][_0x3342('0x4b')]({'where':{'id':_0x5e1202[_0x3342('0x4c')]['id']}})[_0x3342('0x2a')](handleEntityNotFound(_0x4c9214,null))[_0x3342('0x2a')](removeEntity(_0x4c9214,null))['catch'](handleError(_0x4c9214,null));};exports[_0x3342('0x4d')]=function(_0x3a6597,_0x4ce271){return db[_0x3342('0x30')][_0x3342('0x4d')]()[_0x3342('0x2a')](respondWithResult(_0x4ce271,null))['catch'](handleError(_0x4ce271,null));};exports[_0x3342('0x4e')]=function(_0x1497d9,_0x45eb2c){var _0x3be76c;return db[_0x3342('0x4f')]['transaction'](function(_0x2699d2){return db[_0x3342('0x30')][_0x3342('0x4e')](_0x1497d9[_0x3342('0x50')],{'transaction':_0x2699d2})[_0x3342('0x2a')](function(_0x386a5d){_0x3be76c=_0x386a5d[_0x3342('0x51')]({'plain':!![]});return db[_0x3342('0x52')][_0x3342('0x4b')]({'where':{'id':_0x3be76c['VoiceExtensionId']},'raw':!![]})[_0x3342('0x2a')](function(_0x4eebaa){return createVoicePrefixExtensions(_0x3be76c,_0x4eebaa,_0x2699d2);});});})[_0x3342('0x2a')](function(){var _0x524fb6=_0x1497d9['user']['get']({'plain':!![]});if(!_0x524fb6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x524fb6[_0x3342('0x53')]===_0x3342('0x54')){var _0x3cd098=_0x3be76c;return db[_0x3342('0x55')][_0x3342('0x4b')]({'where':{'name':_0x3342('0x56'),'userProfileId':_0x524fb6[_0x3342('0x57')]},'raw':!![]})[_0x3342('0x2a')](function(_0x2938e0){if(_0x2938e0&&_0x2938e0[_0x3342('0x58')]===0x0){return db[_0x3342('0x29')]['create']({'name':_0x3cd098['name'],'resourceId':_0x3cd098['id'],'type':_0x2938e0[_0x3342('0x2e')],'sectionId':_0x2938e0['id']},{})['then'](function(){return _0x3be76c;});}else{return _0x3be76c;}})[_0x3342('0x48')](function(_0x59964b){logger['error'](_0x3342('0x59'),_0x59964b);throw _0x59964b;});}return _0x3be76c;})[_0x3342('0x2a')](respondWithResult(_0x45eb2c,null))[_0x3342('0x48')](handleError(_0x45eb2c,null));};function Extension(_0x5d5e0f,_0x58d37a,_0x54b41d,_0x3cc92a){this['context']=_0x3342('0x5a');this[_0x3342('0x5b')]=_0x5d5e0f;this[_0x3342('0x5c')]=_0x54b41d;this['type']=_0x3342('0x5d');this[_0x3342('0x5e')]=_0x3342('0x5f');this[_0x3342('0x60')]=_0x58d37a;this[_0x3342('0x61')]=_0x3cc92a;}function createVoicePrefixExtensions(_0x19e27b,_0xa4452,_0x57942a){return new BPromise(function(_0x4bc9a9,_0x30e299){var _0x4ec1c4=new Extension(formatPrefixName(_0x19e27b[_0x3342('0x62')]),0x1,_0x3342('0x63'),_0x3342('0x64'));_0x4ec1c4[_0x3342('0x65')]=_0x19e27b['id'];return db[_0x3342('0x52')]['create'](_0x4ec1c4,{'transaction':_0x57942a})[_0x3342('0x2a')](function(_0x3f2fcb){var _0x4c1c6a=_0x3f2fcb[_0x3342('0x51')]({'plain':!![]});var _0x14cc64=_[_0x3342('0x36')](addVoicePrefixExtensions(_0x19e27b,_0xa4452),function(_0x2858a6){_0x2858a6[_0x3342('0x66')]=_0x4c1c6a['id'];_0x2858a6[_0x3342('0x65')]=_0x19e27b['id'];return _0x2858a6;});return db[_0x3342('0x52')][_0x3342('0x67')](_0x14cc64,{'transaction':_0x57942a})[_0x3342('0x2a')](function(_0x36eec8){if(!_0x36eec8){return _0x30e299(_0x3342('0x68'));}else{return _0x4bc9a9(_0x36eec8);}})[_0x3342('0x48')](function(_0x3b01a3){return _0x30e299(_0x3b01a3);});});;});};function addVoicePrefixExtensions(_0x58cbdd,_0x5c9399){var _0x146ffc=[];var _0x4672b5=formatPrefixName(_0x58cbdd[_0x3342('0x62')]);_0x146ffc[_0x3342('0x69')](new Extension(_0x4672b5,0x2,'Set','CDR(prefix)='+_0x58cbdd[_0x3342('0x2e')]));if(_0x58cbdd[_0x3342('0x6a')]){_0x146ffc[_0x3342('0x69')](new Extension(_0x4672b5,0x3,_0x3342('0x6b'),_0x3342('0x6c')+_0x58cbdd[_0x3342('0x6a')]));}else{_0x146ffc[_0x3342('0x69')](new Extension(_0x4672b5,0x3,_0x3342('0x63'),_0x3342('0x6d')));}_0x146ffc[_0x3342('0x69')](new Extension(_0x4672b5,0x4,'goto',_0x5c9399[_0x3342('0x6e')]+','+'${EXTEN:'+(0x8+_0x58cbdd[_0x3342('0x2e')][_0x3342('0x3c')])+'}'+','+0x1));return _0x146ffc;}function formatPrefixName(_0x536fbc){var _0x18cadb='_';for(var _0x3506d4=0x0;_0x3506d4<_0x536fbc['length'];_0x3506d4++){if(_0x536fbc[_0x3342('0x6f')](_0x3506d4)=='-'){_0x18cadb+=_0x536fbc[_0x3342('0x6f')](_0x3506d4);}else{_0x18cadb+='['+_0x536fbc[_0x3342('0x6f')](_0x3506d4)+']';}}_0x18cadb+='.';return _0x18cadb;}exports[_0x3342('0x27')]=function(_0x6b9502,_0x42bc3b,_0x28d937){var _0x57b8ac=_0x6b9502[_0x3342('0x50')];_0x57b8ac['prefix']='system-'+_0x57b8ac[_0x3342('0x2e')]+'-';return db[_0x3342('0x4f')][_0x3342('0x70')](function(_0x28e73f){return db[_0x3342('0x30')][_0x3342('0x27')](_0x57b8ac,{'where':{'id':_0x57b8ac['id']},'transaction':_0x28e73f})[_0x3342('0x2a')](function(){return db[_0x3342('0x52')]['destroy']({'where':{'VoicePrefixId':_0x57b8ac['id']},'transaction':_0x28e73f})[_0x3342('0x2a')](function(){return db[_0x3342('0x52')][_0x3342('0x4b')]({'where':{'id':_0x57b8ac[_0x3342('0x66')]},'raw':!![]})[_0x3342('0x2a')](function(_0x2f02ce){return createVoicePrefixExtensions(_0x57b8ac,_0x2f02ce,_0x28e73f);});});});})[_0x3342('0x2a')](function(){return db['VoicePrefix'][_0x3342('0x71')](_0x57b8ac['id']);})[_0x3342('0x2a')](respondWithResult(_0x42bc3b,null))[_0x3342('0x48')](handleError(_0x42bc3b,null));};exports[_0x3342('0x72')]=function(_0x38a83f,_0x30e493,_0x5a9027){return db['VoicePrefix']['find']({'where':{'id':_0x38a83f[_0x3342('0x4c')]['id']}})[_0x3342('0x2a')](handleEntityNotFound(_0x30e493,null))[_0x3342('0x2a')](function(_0x43cabb){if(_0x43cabb){return _0x43cabb[_0x3342('0x72')](_0x38a83f[_0x3342('0x50')][_0x3342('0x73')],_[_0x3342('0x74')](_0x38a83f['body'],[_0x3342('0x73'),'id'])||{})[_0x3342('0x75')](function(_0x2967d6){for(var _0x42782f=0x0;_0x42782f<_0x38a83f['body'][_0x3342('0x73')][_0x3342('0x3c')];_0x42782f+=0x1){socket[_0x3342('0x76')](_0x3342('0x77'),{'UserId':Number(_0x38a83f[_0x3342('0x50')][_0x3342('0x73')][_0x42782f]),'VoicePrefixId':Number(_0x38a83f[_0x3342('0x4c')]['id'])});}return _0x2967d6;});}})[_0x3342('0x2a')](respondWithResult(_0x30e493,null))[_0x3342('0x48')](handleError(_0x30e493,null));};exports['removeAgents']=function(_0xdc419a,_0x1862b8,_0x58c1b1){return db[_0x3342('0x30')]['find']({'where':{'id':_0xdc419a[_0x3342('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1862b8,null))[_0x3342('0x2a')](function(_0x5b2f46){if(_0x5b2f46){return _0x5b2f46[_0x3342('0x78')](_0xdc419a[_0x3342('0x37')]['ids'])[_0x3342('0x2a')](function(){if(_[_0x3342('0x79')](_0xdc419a['query'][_0x3342('0x73')])){for(var _0x24c9ef=0x0;_0x24c9ef<_0xdc419a[_0x3342('0x37')][_0x3342('0x73')][_0x3342('0x3c')];_0x24c9ef+=0x1){socket[_0x3342('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0xdc419a[_0x3342('0x37')][_0x3342('0x73')][_0x24c9ef]),'VoicePrefixId':Number(_0xdc419a[_0x3342('0x4c')]['id'])});}}else{socket[_0x3342('0x76')](_0x3342('0x7a'),{'UserId':Number(_0xdc419a[_0x3342('0x37')][_0x3342('0x73')]),'VoicePrefixId':Number(_0xdc419a[_0x3342('0x4c')]['id'])});}});}})[_0x3342('0x2a')](respondWithStatusCode(_0x1862b8,null))[_0x3342('0x48')](handleError(_0x1862b8,null));};exports['getAgents']=function(_0x677fc4,_0x7c5834,_0x2e050f){var _0x592122={};var _0x5ef689={};var _0x344a1d;var _0x52e891;return db['VoicePrefix'][_0x3342('0x7b')]({'where':{'id':_0x677fc4[_0x3342('0x4c')]['id']}})['then'](handleEntityNotFound(_0x7c5834,null))[_0x3342('0x2a')](function(_0x4d7132){if(_0x4d7132){_0x344a1d=_0x4d7132;_0x5ef689[_0x3342('0x35')]=_['keys'](db['User'][_0x3342('0x31')]);_0x5ef689[_0x3342('0x37')]=_[_0x3342('0x38')](_0x677fc4['query']);_0x5ef689['filters']=_[_0x3342('0x3a')](_0x5ef689['model'],_0x5ef689[_0x3342('0x37')]);_0x592122[_0x3342('0x39')]=_[_0x3342('0x3a')](_0x5ef689[_0x3342('0x35')],qs['fields'](_0x677fc4['query'][_0x3342('0x3b')]));_0x592122[_0x3342('0x39')]=_0x592122['attributes'][_0x3342('0x3c')]?_0x592122['attributes']:_0x5ef689[_0x3342('0x35')];_0x592122[_0x3342('0x7c')]=qs[_0x3342('0x3e')](_0x677fc4[_0x3342('0x37')][_0x3342('0x3e')]);_0x592122['where']=qs['filters'](_['pick'](_0x677fc4[_0x3342('0x37')],_0x5ef689[_0x3342('0x40')]));if(_0x677fc4[_0x3342('0x37')]['filter']){_0x592122[_0x3342('0x3f')]=_[_0x3342('0x43')](_0x592122[_0x3342('0x3f')],{'$or':_[_0x3342('0x36')](_0x592122[_0x3342('0x39')],function(_0x2355c0){var _0x5cfbf6={};_0x5cfbf6[_0x2355c0]={'$like':'%'+_0x677fc4[_0x3342('0x37')]['filter']+'%'};return _0x5cfbf6;})});}_0x592122=_['merge']({},_0x592122,_0x677fc4['options']);return _0x344a1d[_0x3342('0x7d')](_0x592122);}})[_0x3342('0x2a')](function(_0x50c080){if(_0x50c080){_0x52e891=_0x50c080[_0x3342('0x3c')];if(!_0x677fc4[_0x3342('0x37')]['hasOwnProperty'](_0x3342('0x7e'))){_0x592122[_0x3342('0x21')]=qs[_0x3342('0x21')](_0x677fc4[_0x3342('0x37')][_0x3342('0x21')]);_0x592122[_0x3342('0x1f')]=qs[_0x3342('0x1f')](_0x677fc4[_0x3342('0x37')]['offset']);}return _0x344a1d[_0x3342('0x7d')](_0x592122);}})[_0x3342('0x2a')](function(_0x13738c){if(_0x13738c){return _0x13738c?{'count':_0x52e891,'rows':_0x13738c}:null;}})[_0x3342('0x2a')](respondWithResult(_0x7c5834,null))[_0x3342('0x48')](handleError(_0x7c5834,null));};exports[_0x3342('0x7f')]=function(_0x2d2902,_0x49de28,_0x57a3f8){var _0x1fdaa3={};var _0x2fd436={};var _0x28b7ba;var _0x36ac0d;return db[_0x3342('0x30')][_0x3342('0x7b')]({'where':{'id':_0x2d2902[_0x3342('0x4c')]['id']}})['then'](handleEntityNotFound(_0x49de28,null))[_0x3342('0x2a')](function(_0x15652e){if(_0x15652e){_0x28b7ba=_0x15652e;_0x2fd436[_0x3342('0x35')]=_[_0x3342('0x38')](db[_0x3342('0x80')]['rawAttributes']);_0x2fd436[_0x3342('0x37')]=_[_0x3342('0x38')](_0x2d2902[_0x3342('0x37')]);_0x2fd436[_0x3342('0x40')]=_['intersection'](_0x2fd436[_0x3342('0x35')],_0x2fd436[_0x3342('0x37')]);_0x1fdaa3[_0x3342('0x39')]=_[_0x3342('0x3a')](_0x2fd436[_0x3342('0x35')],qs[_0x3342('0x3b')](_0x2d2902[_0x3342('0x37')]['fields']));_0x1fdaa3['attributes']=_0x1fdaa3[_0x3342('0x39')]['length']?_0x1fdaa3[_0x3342('0x39')]:_0x2fd436[_0x3342('0x35')];_0x1fdaa3[_0x3342('0x7c')]=qs[_0x3342('0x3e')](_0x2d2902[_0x3342('0x37')]['sort']);_0x1fdaa3[_0x3342('0x3f')]=qs[_0x3342('0x40')](_[_0x3342('0x41')](_0x2d2902['query'],_0x2fd436['filters']));if(_0x2d2902[_0x3342('0x37')][_0x3342('0x42')]){_0x1fdaa3[_0x3342('0x3f')]=_[_0x3342('0x43')](_0x1fdaa3[_0x3342('0x3f')],{'$or':_[_0x3342('0x36')](_0x1fdaa3[_0x3342('0x39')],function(_0x2c8c08){var _0x316b4c={};_0x316b4c[_0x2c8c08]={'$like':'%'+_0x2d2902[_0x3342('0x37')][_0x3342('0x42')]+'%'};return _0x316b4c;})});}_0x1fdaa3=_[_0x3342('0x43')]({},_0x1fdaa3,_0x2d2902['options']);return _0x28b7ba['getTeams'](_0x1fdaa3);}})['then'](function(_0x2539a0){if(_0x2539a0){_0x36ac0d=_0x2539a0[_0x3342('0x3c')];if(!_0x2d2902[_0x3342('0x37')][_0x3342('0x3d')](_0x3342('0x7e'))){_0x1fdaa3['limit']=qs[_0x3342('0x21')](_0x2d2902[_0x3342('0x37')][_0x3342('0x21')]);_0x1fdaa3['offset']=qs[_0x3342('0x1f')](_0x2d2902[_0x3342('0x37')]['offset']);}return _0x28b7ba['getTeams'](_0x1fdaa3);}})[_0x3342('0x2a')](function(_0x1cbc11){if(_0x1cbc11){return _0x1cbc11?{'count':_0x36ac0d,'rows':_0x1cbc11}:null;}})[_0x3342('0x2a')](respondWithResult(_0x49de28,null))[_0x3342('0x48')](handleError(_0x49de28,null));};exports[_0x3342('0x81')]=function(_0x51b0f9,_0x48cb53,_0x37fdc5){var _0x26063d=_0x51b0f9[_0x3342('0x50')][_0x3342('0x73')];var _0x43323e;return db[_0x3342('0x80')][_0x3342('0x46')]({'where':{'id':_0x26063d},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x3342('0x82'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x3c1c34){if(_0x3c1c34){_0x43323e=_0x3c1c34;var _0x319a6e=_['flatMap'](_0x3c1c34,function(_0x36739b){var _0x4dcbb1=_0x36739b['get']({'plain':!![]});return _0x4dcbb1[_0x3342('0x83')];});return db['VoicePrefix'][_0x3342('0x4b')]({'where':{'id':_0x51b0f9[_0x3342('0x4c')]['id']}})[_0x3342('0x2a')](function(_0x2b029d){return db[_0x3342('0x4f')][_0x3342('0x70')](function(_0x5aa6ce){return _0x2b029d[_0x3342('0x81')](_0x26063d,{'transaction':_0x5aa6ce})[_0x3342('0x2a')](function(){return BPromise[_0x3342('0x84')](_0x43323e,function(_0x5d9c1e){return db[_0x3342('0x85')][_0x3342('0x86')]({'TeamId':_0x5d9c1e['id'],'VoicePrefixId':_0x51b0f9[_0x3342('0x4c')]['id']},{'transaction':_0x5aa6ce});});})[_0x3342('0x2a')](function(){return BPromise[_0x3342('0x84')](_0x319a6e,function(_0x41de0c){return db['UserVoicePrefix'][_0x3342('0x87')]({'where':{'UserId':_0x41de0c['id'],'VoicePrefixId':_0x51b0f9[_0x3342('0x4c')]['id']},'transaction':_0x5aa6ce});});})[_0x3342('0x2a')](function(){_0x319a6e[_0x3342('0x88')](function(_0x441c2a){socket['emit'](_0x3342('0x77'),{'UserId':_0x441c2a['id'],'VoicePrefixId':_0x2b029d['id']});});});});});}})[_0x3342('0x2a')](respondWithStatusCode(_0x48cb53,null))[_0x3342('0x48')](handleError(_0x48cb53,null));};exports[_0x3342('0x89')]=function(_0x498de2,_0x100d41,_0x56251e){return db[_0x3342('0x80')][_0x3342('0x46')]({'where':{'id':_0x498de2[_0x3342('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3342('0x8a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3342('0x2a')](handleEntityNotFound(_0x100d41,null))['then'](function(_0x340350){var _0xe6d040=_[_0x3342('0x36')](_0x340350,'id');var _0x58253f=[];var _0x25b867=[];var _0x3a6d87=squel[_0x3342('0x8b')]();_0x3a6d87[_0x3342('0x8c')](_0x3342('0x8d'))[_0x3342('0x8e')](_0x3342('0x8f'),'tq')['join'](_0x3342('0x90'),'ut',_0x3342('0x91'))[_0x3342('0x3f')]('VoicePrefixId\x20=\x20?',_0x498de2[_0x3342('0x4c')]['id']);for(var _0x3c0eb8=0x0;_0x3c0eb8<_0x340350[_0x3342('0x3c')];_0x3c0eb8+=0x1){let _0x2b5df1=_0x340350[_0x3c0eb8];for(var _0xe57bc1=0x0;_0xe57bc1<_0x2b5df1[_0x3342('0x83')][_0x3342('0x3c')];_0xe57bc1+=0x1){let _0x2ae81c=_0x2b5df1['Agents'][_0xe57bc1];var _0x448a3c=_0x3a6d87[_0x3342('0x92')]();_0x448a3c['where'](_0x3342('0x93'),_0x2ae81c['id']);_0x25b867[_0x3342('0x69')](db[_0x3342('0x4f')][_0x3342('0x37')](_0x448a3c[_0x3342('0x94')](),{'type':db[_0x3342('0x4f')][_0x3342('0x95')][_0x3342('0x96')]})[_0x3342('0x2a')](function(_0x31095f){if(_0x31095f[_0x3342('0x3c')]===0x1){return _0x2ae81c['id'];}else{var _0x4a301d=_['every'](_[_0x3342('0x36')](_0x31095f,_0x3342('0x97')),function(_0x107e1b){return _[_0x3342('0x98')](_0xe6d040,_0x107e1b);});if(_0x4a301d){return _0x2ae81c['id'];}}}));}}return BPromise[_0x3342('0x99')](_0x25b867)[_0x3342('0x2a')](function(_0x34f15a){_0x58253f=_(_0x58253f)[_0x3342('0x9a')](_0x34f15a)[_0x3342('0x9b')]()[_0x3342('0x9c')]();return db[_0x3342('0x30')][_0x3342('0x4b')]({'where':{'id':_0x498de2[_0x3342('0x4c')]['id']}})[_0x3342('0x2a')](function(_0x45d548){return db[_0x3342('0x4f')]['transaction'](function(_0x4e1359){return _0x45d548[_0x3342('0x89')](_0x498de2[_0x3342('0x37')]['ids'],{'transaction':_0x4e1359})[_0x3342('0x2a')](function(){if(!_[_0x3342('0x9d')](_0x58253f)){return _0x45d548['removeAgents'](_0x58253f,{'transaction':_0x4e1359});}})[_0x3342('0x2a')](function(){_0x58253f['forEach'](function(_0x24049f){socket[_0x3342('0x76')](_0x3342('0x7a'),{'UserId':_0x24049f,'VoicePrefixId':_0x45d548['id']});});});});});});})[_0x3342('0x2a')](respondWithStatusCode(_0x100d41,null))[_0x3342('0x48')](handleError(_0x100d41,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index bf73350..c4f94fb 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 _0x020d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','update'];(function(_0x27684e,_0x23dbec){var _0x201d94=function(_0x53a298){while(--_0x53a298){_0x27684e['push'](_0x27684e['shift']());}};_0x201d94(++_0x23dbec);}(_0x020d,0x1d4));var _0xd020=function(_0x4a2568,_0x5a8b32){_0x4a2568=_0x4a2568-0x0;var _0x413664=_0x020d[_0x4a2568];return _0x413664;};'use strict';var EventEmitter=require(_0xd020('0x0'));var VoicePrefix=require(_0xd020('0x1'))['db'][_0xd020('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd020('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5cf478){return function(_0x1948b0,_0x53c33e,_0x5db288){VoicePrefixEvents[_0xd020('0x4')](_0x5cf478+':'+_0x1948b0['id'],_0x1948b0);VoicePrefixEvents['emit'](_0x5cf478,_0x1948b0);_0x5db288(null);};}for(var e in events){if(events[_0xd020('0x5')](e)){var event=events[e];VoicePrefix[_0xd020('0x6')](e,emitEvent(event));}}module[_0xd020('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0x0473=['save','remove','emit','hasOwnProperty','exports','VoicePrefix'];(function(_0xcd37c0,_0x95c330){var _0x42b0df=function(_0x3632f6){while(--_0x3632f6){_0xcd37c0['push'](_0xcd37c0['shift']());}};_0x42b0df(++_0x95c330);}(_0x0473,0x179));var _0x3047=function(_0x4b90b7,_0x2b0ab0){_0x4b90b7=_0x4b90b7-0x0;var _0x36ac5f=_0x0473[_0x4b90b7];return _0x36ac5f;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x3047('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3047('0x1'),'afterUpdate':'update','afterDestroy':_0x3047('0x2')};function emitEvent(_0x299028){return function(_0x2c173f,_0x35efeb,_0xaa47a0){VoicePrefixEvents[_0x3047('0x3')](_0x299028+':'+_0x2c173f['id'],_0x2c173f);VoicePrefixEvents[_0x3047('0x3')](_0x299028,_0x2c173f);_0xaa47a0(null);};}for(var e in events){if(events[_0x3047('0x4')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x3047('0x5')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 9d5eaac..7bf1a91 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 _0x9993=['define','VoicePrefix','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x9993,0x7a));var _0x3999=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x9993[_0x36ed48];return _0x51c63a;};'use strict';var _=require('lodash');var util=require(_0x3999('0x0'));var logger=require(_0x3999('0x1'))(_0x3999('0x2'));var moment=require('moment');var BPromise=require(_0x3999('0x3'));var rp=require(_0x3999('0x4'));var fs=require('fs');var path=require(_0x3999('0x5'));var rimraf=require(_0x3999('0x6'));var config=require(_0x3999('0x7'));var attributes=require(_0x3999('0x8'));module[_0x3999('0x9')]=function(_0x177892,_0x888598){return _0x177892[_0x3999('0xa')](_0x3999('0xb'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf14c=['bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','lodash','api'];(function(_0x106301,_0x245789){var _0x1125f1=function(_0x1c8ab2){while(--_0x1c8ab2){_0x106301['push'](_0x106301['shift']());}};_0x1125f1(++_0x245789);}(_0xf14c,0x13e));var _0xcf14=function(_0xf7c778,_0x195f70){_0xf7c778=_0xf7c778-0x0;var _0x45eabc=_0xf14c[_0xf7c778];return _0x45eabc;};'use strict';var _=require(_0xcf14('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcf14('0x1'));var moment=require('moment');var BPromise=require(_0xcf14('0x2'));var rp=require(_0xcf14('0x3'));var fs=require('fs');var path=require(_0xcf14('0x4'));var rimraf=require('rimraf');var config=require(_0xcf14('0x5'));var attributes=require(_0xcf14('0x6'));module['exports']=function(_0x5cc24b,_0x5b97a5){return _0x5cc24b[_0xcf14('0x7')](_0xcf14('0x8'),attributes,{'tableName':_0xcf14('0x9'),'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 2afb169..00e542e 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 _0xe08b=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voicePrefix.socket','then','info','VoicePrefix,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x31d707,_0x733c2b){var _0x3ff20d=function(_0x42de7a){while(--_0x42de7a){_0x31d707['push'](_0x31d707['shift']());}};_0x3ff20d(++_0x733c2b);}(_0xe08b,0x10e));var _0xbe08=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0xe08b[_0x450bf9];return _0x268350;};'use strict';var _=require(_0xbe08('0x0'));var util=require('util');var moment=require(_0xbe08('0x1'));var BPromise=require(_0xbe08('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe08('0x3'));var db=require(_0xbe08('0x4'))['db'];var utils=require(_0xbe08('0x5'));var logger=require(_0xbe08('0x6'))(_0xbe08('0x7'));var config=require(_0xbe08('0x8'));var jayson=require(_0xbe08('0x9'));var client=jayson[_0xbe08('0xa')][_0xbe08('0xb')]({'port':0x232a});config[_0xbe08('0xc')]=_[_0xbe08('0xd')](config[_0xbe08('0xc')],{'host':_0xbe08('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe08('0xc')]));require(_0xbe08('0xf'))['register'](socket);function respondWithRpcPromise(_0xb4e69a,_0xed8e0c,_0x47ca8d){return new BPromise(function(_0xc5824c,_0x202fec){return client['request'](_0xb4e69a,_0x47ca8d)[_0xbe08('0x10')](function(_0x133725){logger[_0xbe08('0x11')](_0xbe08('0x12'),_0xed8e0c,'request\x20sent');logger[_0xbe08('0x13')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0xed8e0c,_0xbe08('0x14'),JSON[_0xbe08('0x15')](_0x133725));if(_0x133725[_0xbe08('0x16')]){if(_0x133725[_0xbe08('0x16')][_0xbe08('0x17')]===0x1f4){logger[_0xbe08('0x16')](_0xbe08('0x12'),_0xed8e0c,_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);return _0x202fec(_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);}logger[_0xbe08('0x16')](_0xbe08('0x12'),_0xed8e0c,_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);return _0xc5824c(_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);}else{logger[_0xbe08('0x11')]('VoicePrefix,\x20%s,\x20%s',_0xed8e0c,_0xbe08('0x14'));_0xc5824c(_0x133725[_0xbe08('0x19')][_0xbe08('0x18')]);}})[_0xbe08('0x1a')](function(_0x1c9379){logger[_0xbe08('0x16')](_0xbe08('0x12'),_0xed8e0c,_0x1c9379);_0x202fec(_0x1c9379);});});} \ No newline at end of file +var _0x32f4=['request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x432db9,_0x20b76f){var _0x287d06=function(_0x3ef9db){while(--_0x3ef9db){_0x432db9['push'](_0x432db9['shift']());}};_0x287d06(++_0x20b76f);}(_0x32f4,0x154));var _0x432f=function(_0x31cd84,_0x3ec25a){_0x31cd84=_0x31cd84-0x0;var _0x55f053=_0x32f4[_0x31cd84];return _0x55f053;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});config['redis']=_[_0x432f('0xb')](config[_0x432f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x432f('0xd'))(new Redis(config['redis']));require(_0x432f('0xe'))[_0x432f('0xf')](socket);function respondWithRpcPromise(_0x3a0d4b,_0x13369a,_0x53f3ef){return new BPromise(function(_0x5d0155,_0x23fd9d){return client['request'](_0x3a0d4b,_0x53f3ef)[_0x432f('0x10')](function(_0x4b6c02){logger[_0x432f('0x11')](_0x432f('0x12'),_0x13369a,'request\x20sent');logger[_0x432f('0x13')](_0x432f('0x14'),_0x13369a,'request\x20sent',JSON[_0x432f('0x15')](_0x4b6c02));if(_0x4b6c02[_0x432f('0x16')]){if(_0x4b6c02['error']['code']===0x1f4){logger[_0x432f('0x16')](_0x432f('0x12'),_0x13369a,_0x4b6c02[_0x432f('0x16')][_0x432f('0x17')]);return _0x23fd9d(_0x4b6c02[_0x432f('0x16')]['message']);}logger[_0x432f('0x16')](_0x432f('0x12'),_0x13369a,_0x4b6c02[_0x432f('0x16')][_0x432f('0x17')]);return _0x5d0155(_0x4b6c02['error'][_0x432f('0x17')]);}else{logger[_0x432f('0x11')](_0x432f('0x12'),_0x13369a,_0x432f('0x18'));_0x5d0155(_0x4b6c02[_0x432f('0x19')][_0x432f('0x17')]);}})['catch'](function(_0x2d2c86){logger['error'](_0x432f('0x12'),_0x13369a,_0x2d2c86);_0x23fd9d(_0x2d2c86);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index cdca81e..e42f84b 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 _0xe3db=['./voicePrefix.events','save','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x332a86,_0x1cf5f7){var _0x41cdef=function(_0x56101b){while(--_0x56101b){_0x332a86['push'](_0x332a86['shift']());}};_0x41cdef(++_0x1cf5f7);}(_0xe3db,0xc8));var _0xbe3d=function(_0x1e6a42,_0x93d089){_0x1e6a42=_0x1e6a42-0x0;var _0x49e234=_0xe3db[_0x1e6a42];return _0x49e234;};'use strict';var VoicePrefixEvents=require(_0xbe3d('0x0'));var events=[_0xbe3d('0x1'),'remove',_0xbe3d('0x2')];function createListener(_0x17c43e,_0x37fcba){return function(_0x411429){_0x37fcba[_0xbe3d('0x3')](_0x17c43e,_0x411429);};}function removeListener(_0x192368,_0x30163d){return function(){VoicePrefixEvents[_0xbe3d('0x4')](_0x192368,_0x30163d);};}exports[_0xbe3d('0x5')]=function(_0xd5a81){for(var _0x2b4c19=0x0,_0x4c255b=events[_0xbe3d('0x6')];_0x2b4c19<_0x4c255b;_0x2b4c19++){var _0x90d1ab=events[_0x2b4c19];var _0x24136a=createListener(_0xbe3d('0x7')+_0x90d1ab,_0xd5a81);VoicePrefixEvents['on'](_0x90d1ab,_0x24136a);}}; \ No newline at end of file +var _0x195e=['save','remove','update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x518ad2,_0x13f91b){var _0x8ee5ea=function(_0x5a516a){while(--_0x5a516a){_0x518ad2['push'](_0x518ad2['shift']());}};_0x8ee5ea(++_0x13f91b);}(_0x195e,0xfb));var _0xe195=function(_0x5bb053,_0x5158f8){_0x5bb053=_0x5bb053-0x0;var _0x44eed4=_0x195e[_0x5bb053];return _0x44eed4;};'use strict';var VoicePrefixEvents=require(_0xe195('0x0'));var events=[_0xe195('0x1'),_0xe195('0x2'),_0xe195('0x3')];function createListener(_0x40fe4d,_0x3975a9){return function(_0x31ca3b){_0x3975a9[_0xe195('0x4')](_0x40fe4d,_0x31ca3b);};}function removeListener(_0x2243e9,_0x30011c){return function(){VoicePrefixEvents[_0xe195('0x5')](_0x2243e9,_0x30011c);};}exports[_0xe195('0x6')]=function(_0x11cc55){for(var _0x595c13=0x0,_0x2a1acc=events[_0xe195('0x7')];_0x595c13<_0x2a1acc;_0x595c13++){var _0x2ead59=events[_0x595c13];var _0x28c1a9=createListener(_0xe195('0x8')+_0x2ead59,_0x11cc55);VoicePrefixEvents['on'](_0x2ead59,_0x28c1a9);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index ada1339..90b55e5 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 _0x1e62=['/:id/members','getMembers','/:id/lists','getBlackLists','post','create','/:id/teams','addTeams','addBlackLists','put','update','delete','removeTeams','/:id/blacklists','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/hoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','/:id/users','getAgents'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x1e62,0x127));var _0x21e6=function(_0x42122e,_0x180661){_0x42122e=_0x42122e-0x0;var _0x347d53=_0x1e62[_0x42122e];return _0x347d53;};'use strict';var multer=require(_0x21e6('0x0'));var util=require(_0x21e6('0x1'));var path=require(_0x21e6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x21e6('0x3')]();var fs_extra=require(_0x21e6('0x4'));var auth=require(_0x21e6('0x5'));var interaction=require(_0x21e6('0x6'));var config=require(_0x21e6('0x7'));var controller=require('./voiceQueue.controller');router[_0x21e6('0x8')]('/',auth[_0x21e6('0x9')](),controller[_0x21e6('0xa')]);router[_0x21e6('0x8')](_0x21e6('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x21e6('0x8')](_0x21e6('0xc'),auth[_0x21e6('0x9')](),controller['getHoppers']);router[_0x21e6('0x8')](_0x21e6('0xd'),auth[_0x21e6('0x9')](),controller['getHopperHistories']);router[_0x21e6('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x21e6('0xe')]);router[_0x21e6('0x8')](_0x21e6('0xf'),auth[_0x21e6('0x9')](),controller[_0x21e6('0x10')]);router[_0x21e6('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x21e6('0x11')]);router[_0x21e6('0x8')](_0x21e6('0x12'),auth['isAuthenticated'](),controller[_0x21e6('0x13')]);router[_0x21e6('0x8')](_0x21e6('0x14'),auth[_0x21e6('0x9')](),controller[_0x21e6('0x15')]);router[_0x21e6('0x8')](_0x21e6('0x16'),auth[_0x21e6('0x9')](),controller['getLists']);router['get']('/:id/blacklists',auth['isAuthenticated'](),controller[_0x21e6('0x17')]);router[_0x21e6('0x18')]('/',auth[_0x21e6('0x9')](),controller[_0x21e6('0x19')]);router[_0x21e6('0x18')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x21e6('0x18')](_0x21e6('0x1a'),auth[_0x21e6('0x9')](),controller[_0x21e6('0x1b')]);router[_0x21e6('0x18')](_0x21e6('0x12'),auth[_0x21e6('0x9')](),controller['addAgents']);router['post'](_0x21e6('0x16'),auth['isAuthenticated'](),controller['addLists']);router['post']('/:id/blacklists',auth[_0x21e6('0x9')](),controller[_0x21e6('0x1c')]);router[_0x21e6('0x1d')](_0x21e6('0xb'),auth[_0x21e6('0x9')](),controller[_0x21e6('0x1e')]);router[_0x21e6('0x1f')]('/:id',auth[_0x21e6('0x9')](),controller['destroy']);router[_0x21e6('0x1f')]('/:id/teams',auth[_0x21e6('0x9')](),controller[_0x21e6('0x20')]);router[_0x21e6('0x1f')](_0x21e6('0x12'),auth[_0x21e6('0x9')](),controller['removeAgents']);router[_0x21e6('0x1f')](_0x21e6('0x16'),auth['isAuthenticated'](),controller['removeLists']);router[_0x21e6('0x1f')](_0x21e6('0x21'),auth[_0x21e6('0x9')](),controller['removeBlackLists']);module[_0x21e6('0x22')]=router; \ No newline at end of file +var _0x8f9d=['getHopperBlacks','getTeams','/:id/users','getAgents','/:id/lists','/:id/blacklists','post','create','/:id/clone','clone','/:id/teams','addAgents','addLists','addBlackLists','put','delete','removeTeams','removeLists','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black'];(function(_0x27734e,_0x5027c2){var _0x210f1d=function(_0x304f5d){while(--_0x304f5d){_0x27734e['push'](_0x27734e['shift']());}};_0x210f1d(++_0x5027c2);}(_0x8f9d,0x194));var _0xd8f9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f9d[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xd8f9('0x0'));var util=require('util');var path=require(_0xd8f9('0x1'));var timeout=require(_0xd8f9('0x2'));var express=require('express');var router=express[_0xd8f9('0x3')]();var fs_extra=require(_0xd8f9('0x4'));var auth=require(_0xd8f9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd8f9('0x6'));var controller=require(_0xd8f9('0x7'));router[_0xd8f9('0x8')]('/',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xa')]);router['get'](_0xd8f9('0xb'),auth[_0xd8f9('0x9')](),controller['show']);router[_0xd8f9('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller['getHoppers']);router[_0xd8f9('0x8')]('/:id/hopper_histories',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xc')]);router['get'](_0xd8f9('0xd'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xe')]);router['get'](_0xd8f9('0xf'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x10')]);router[_0xd8f9('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd8f9('0x11')]);router['get'](_0xd8f9('0x12'),auth['isAuthenticated'](),controller[_0xd8f9('0x13')]);router['get']('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xd8f9('0x14'),auth[_0xd8f9('0x9')](),controller['getLists']);router['get'](_0xd8f9('0x15'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xd8f9('0x16')]('/',auth['isAuthenticated'](),controller[_0xd8f9('0x17')]);router[_0xd8f9('0x16')](_0xd8f9('0x18'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x19')]);router[_0xd8f9('0x16')](_0xd8f9('0x1a'),auth['isAuthenticated'](),controller['addTeams']);router[_0xd8f9('0x16')](_0xd8f9('0x12'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x1b')]);router['post'](_0xd8f9('0x14'),auth['isAuthenticated'](),controller[_0xd8f9('0x1c')]);router['post'](_0xd8f9('0x15'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x1d')]);router[_0xd8f9('0x1e')](_0xd8f9('0xb'),auth[_0xd8f9('0x9')](),controller['update']);router[_0xd8f9('0x1f')](_0xd8f9('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xd8f9('0x1f')](_0xd8f9('0x1a'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x20')]);router[_0xd8f9('0x1f')](_0xd8f9('0x12'),auth['isAuthenticated'](),controller['removeAgents']);router['delete'](_0xd8f9('0x14'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x21')]);router['delete'](_0xd8f9('0x15'),auth[_0xd8f9('0x9')](),controller['removeBlackLists']);module[_0xd8f9('0x22')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 77a96f6..d9ce2da 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 _0x444a=['joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','outbound','default','leastrecent','fewestcalls','random','rrmemory','wrandom','rrordered','setDataValue','type','getDataValue','dialMethod','roundrobin','predictive','power','INTEGER','yes','all','TEXT','periodic_announce','split','join'];(function(_0x190738,_0x142f48){var _0x6fddb0=function(_0xa47b39){while(--_0xa47b39){_0x190738['push'](_0x190738['shift']());}};_0x6fddb0(++_0x142f48);}(_0x444a,0x170));var _0xa444=function(_0x290a56,_0x5c540a){_0x290a56=_0x290a56-0x0;var _0x89610=_0x444a[_0x290a56];return _0x89610;};'use strict';var Sequelize=require(_0xa444('0x0'));module['exports']={'name':{'type':Sequelize[_0xa444('0x1')],'allowNull':![],'unique':_0xa444('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa444('0x3')](_0xa444('0x4'),_0xa444('0x5')),'allowNull':![],'defaultValue':_0xa444('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xa444('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xa444('0x3')]('rr','ringall',_0xa444('0x7'),_0xa444('0x8'),_0xa444('0x9'),_0xa444('0xa'),'linear',_0xa444('0xb'),_0xa444('0xc')),'allowNull':![],'defaultValue':'ringall','set':function(_0x1e4332){this[_0xa444('0xd')]('strategy',_0x1e4332?_0x1e4332:'rrmemory');},'get':function(){var _0x346afa=this['getDataValue'](_0xa444('0xe'));var _0x28ac38=this[_0xa444('0xf')](_0xa444('0x10'));var _0x3e6c75=this['getDataValue']('strategy');if(_0x346afa===_0xa444('0x4')){return _0x3e6c75;}if(_0x28ac38==='booked'&&_0x3e6c75==='rrmemory'||_0x28ac38==='booked'&&_0x3e6c75===_0xa444('0x11')){return _0x3e6c75;}if(_0x28ac38==='progressive'||_0x28ac38===_0xa444('0x12')||_0x28ac38===_0xa444('0x13')){return _0x3e6c75;}return null;}},'servicelevel':{'type':Sequelize[_0xa444('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xa444('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xa444('0x14')](0xb)},'timeout':{'type':Sequelize[_0xa444('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xa444('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xa444('0x1')]},'weight':{'type':Sequelize[_0xa444('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xa444('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xa444('0x3')](_0xa444('0x15'),'no'),'defaultValue':_0xa444('0x15')},'autopause':{'type':Sequelize[_0xa444('0x3')]('yes','no',_0xa444('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xa444('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xa444('0x3')](_0xa444('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xa444('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xa444('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xa444('0x3')](_0xa444('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xa444('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xa444('0x3')](_0xa444('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xa444('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xa444('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xa444('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xa444('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xa444('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xa444('0x3')](_0xa444('0x15'),'no'),'defaultValue':_0xa444('0x15')},'announce_holdtime':{'type':Sequelize[_0xa444('0x3')](_0xa444('0x15'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xa444('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xa444('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0xa444('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xa444('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xa444('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xa444('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xa444('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xa444('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xa444('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xa444('0x1')]},'queue_quantity1':{'type':Sequelize[_0xa444('0x1')]},'queue_quantity2':{'type':Sequelize[_0xa444('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xa444('0x1')]},'periodic_announce':{'type':Sequelize[_0xa444('0x17')],'set':function(_0xb20422){this['setDataValue'](_0xa444('0x18'),_0xb20422?_0xb20422['join'](','):[]);},'get':function(){return this[_0xa444('0xf')](_0xa444('0x18'))?this['getDataValue'](_0xa444('0x18'))[_0xa444('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0xa444('0x1')],'defaultValue':_0xa444('0x15'),'set':function(_0x34a147){this[_0xa444('0xd')]('joinempty',_0x34a147?_0x34a147[_0xa444('0x1a')](','):undefined);},'get':function(){return this[_0xa444('0xf')]('joinempty')?this[_0xa444('0xf')](_0xa444('0x1b'))[_0xa444('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xa444('0x1')],'defaultValue':'no','set':function(_0x4a7a61){this[_0xa444('0xd')](_0xa444('0x1c'),_0x4a7a61?_0x4a7a61[_0xa444('0x1a')](','):undefined);},'get':function(){return this[_0xa444('0xf')](_0xa444('0x1c'))?this[_0xa444('0xf')](_0xa444('0x1c'))[_0xa444('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xa444('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xa444('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xa444('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xa444('0x3')](_0xa444('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xa444('0x1')]},'description':{'type':Sequelize[_0xa444('0x1')]},'acw':{'type':Sequelize[_0xa444('0x1d')],'defaultValue':0x0,'set':function(_0x337862){this[_0xa444('0xd')](_0xa444('0x1e'),_0x337862);if(_0x337862){if(this[_0xa444('0xf')](_0xa444('0x1f'))<0x2){this[_0xa444('0xd')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xa444('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xa444('0x1d')],'defaultValue':0x0,'comment':_0xa444('0x20')},'dialMethod':{'type':Sequelize[_0xa444('0x3')]('preview',_0xa444('0x21'),_0xa444('0x13'),_0xa444('0x12'),_0xa444('0x22')),'defaultValue':_0xa444('0x21'),'comment':_0xa444('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xa444('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa444('0x25')},'dialLimitQueue':{'type':Sequelize[_0xa444('0x14')](0x4)[_0xa444('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xa444('0x26')](0x2)[_0xa444('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xa444('0x3')](_0xa444('0x27'),_0xa444('0x28')),'defaultValue':_0xa444('0x28'),'comment':_0xa444('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xa444('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xa444('0x2a')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xa444('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xa444('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa444('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa444('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xa444('0x14')](0x3)[_0xa444('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa444('0x2c')},'dialQueueOptions':{'type':Sequelize[_0xa444('0x1')],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xa444('0x14')](0x3)[_0xa444('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa444('0x2d')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xa444('0x14')](0x3)[_0xa444('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa444('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa444('0x14')](0x5)[_0xa444('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa444('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0xa444('0x14')](0x3)[_0xa444('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa444('0x30')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa444('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa444('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa444('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xa444('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa444('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa444('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa444('0x14')](0x3)[_0xa444('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xa444('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xa444('0x3')](_0xa444('0x34'),_0xa444('0x35'),_0xa444('0x36')),'defaultValue':_0xa444('0x34')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xa444('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa444('0x37')},'dialAMDGreeting':{'type':Sequelize[_0xa444('0x14')](0x9)[_0xa444('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa444('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa444('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa444('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa444('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa444('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0xa444('0x14')](0x9)[_0xa444('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa444('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa444('0x14')](0x9)[_0xa444('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa444('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa444('0x14')](0x9)[_0xa444('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa444('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xa444('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa444('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa444('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0xa444('0x14')](0x5)[_0xa444('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xa444('0x1d')],'defaultValue':0x0,'comment':_0xa444('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xa444('0x3')]('DESC',_0xa444('0x41')),'defaultValue':_0xa444('0x42')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xa444('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xa444('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa444('0x14')](0x3)[_0xa444('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa444('0x43')},'dialCutDigit':{'type':Sequelize[_0xa444('0x14')](0x3)[_0xa444('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa444('0x14')](0x3)[_0xa444('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa444('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa444('0x14')](0x5)[_0xa444('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xa444('0x14')](0x3)[_0xa444('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa444('0x45')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa444('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa444('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa444('0x14')](0x3)[_0xa444('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa444('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa444('0x14')](0x5)[_0xa444('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa444('0x48')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xa444('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa444('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa444('0x14')](0x3)[_0xa444('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa444('0x14')](0x5)[_0xa444('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa444('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa444('0x14')],'allowNull':!![],'comment':_0xa444('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0xa444('0x1d')],'defaultValue':![],'comment':_0xa444('0x4c'),'set':function(_0x4b93e2){if(!_0x4b93e2)this['setDataValue'](_0xa444('0x4d'),null);this[_0xa444('0xd')](_0xa444('0x4e'),_0x4b93e2);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xa444('0x14')](0x3)[_0xa444('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xa444('0x14')](0x3)[_0xa444('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x42b0=['dropRate','FLOAT','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','inbound','STRING','default','ENUM','ringall','random','rrmemory','rrordered','strategy','getDataValue','type','dialMethod','booked','progressive','power','INTEGER','yes','all','TEXT','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','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).','agentBusyFactor'];(function(_0x1900b1,_0x40abe8){var _0x2e422d=function(_0x206dd1){while(--_0x206dd1){_0x1900b1['push'](_0x1900b1['shift']());}};_0x2e422d(++_0x40abe8);}(_0x42b0,0xbc));var _0x042b=function(_0x482611,_0x33356d){_0x482611=_0x482611-0x0;var _0x4aeb3a=_0x42b0[_0x482611];return _0x4aeb3a;};'use strict';var Sequelize=require(_0x042b('0x0'));module[_0x042b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x042b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x042b('0x3'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x042b('0x4')],'defaultValue':_0x042b('0x5')},'announce':{'type':Sequelize[_0x042b('0x4')],'defaultValue':''},'strategy':{'type':Sequelize[_0x042b('0x6')]('rr',_0x042b('0x7'),'leastrecent','fewestcalls',_0x042b('0x8'),_0x042b('0x9'),'linear','wrandom',_0x042b('0xa')),'allowNull':![],'defaultValue':'ringall','set':function(_0x8fd46a){this['setDataValue'](_0x042b('0xb'),_0x8fd46a?_0x8fd46a:_0x042b('0x9'));},'get':function(){var _0x1d2796=this[_0x042b('0xc')](_0x042b('0xd'));var _0x414f4a=this[_0x042b('0xc')](_0x042b('0xe'));var _0x21bf5c=this[_0x042b('0xc')](_0x042b('0xb'));if(_0x1d2796===_0x042b('0x3')){return _0x21bf5c;}if(_0x414f4a===_0x042b('0xf')&&_0x21bf5c==='rrmemory'||_0x414f4a===_0x042b('0xf')&&_0x21bf5c==='roundrobin'){return _0x21bf5c;}if(_0x414f4a===_0x042b('0x10')||_0x414f4a==='predictive'||_0x414f4a===_0x042b('0x11')){return _0x21bf5c;}return null;}},'servicelevel':{'type':Sequelize[_0x042b('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x042b('0x12')](0xb)},'timeout':{'type':Sequelize[_0x042b('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x042b('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x042b('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x042b('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x042b('0x6')](_0x042b('0x13'),'no'),'defaultValue':_0x042b('0x13')},'autopause':{'type':Sequelize['ENUM'](_0x042b('0x13'),'no',_0x042b('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x042b('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x042b('0x6')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x042b('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x042b('0x6')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x042b('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x042b('0x6')](_0x042b('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x042b('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x042b('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x042b('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x042b('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x042b('0x6')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x042b('0x6')](_0x042b('0x13'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x042b('0x6')](_0x042b('0x13'),'no')},'announce_position_limit':{'type':Sequelize[_0x042b('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x042b('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x042b('0x4')]},'queue_youarenext':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x042b('0x4')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x042b('0x15')],'set':function(_0x4ed494){this[_0x042b('0x16')](_0x042b('0x17'),_0x4ed494?_0x4ed494[_0x042b('0x18')](','):[]);},'get':function(){return this[_0x042b('0xc')](_0x042b('0x17'))?this[_0x042b('0xc')](_0x042b('0x17'))[_0x042b('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x042b('0x4')],'defaultValue':_0x042b('0x13'),'set':function(_0x2344f4){this[_0x042b('0x16')](_0x042b('0x1a'),_0x2344f4?_0x2344f4[_0x042b('0x18')](','):undefined);},'get':function(){return this[_0x042b('0xc')](_0x042b('0x1a'))?this['getDataValue'](_0x042b('0x1a'))[_0x042b('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x042b('0x4')],'defaultValue':'no','set':function(_0xa7b29a){this[_0x042b('0x16')](_0x042b('0x1b'),_0xa7b29a?_0xa7b29a['join'](','):undefined);},'get':function(){return this[_0x042b('0xc')](_0x042b('0x1b'))?this['getDataValue'](_0x042b('0x1b'))[_0x042b('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x042b('0x6')](_0x042b('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x042b('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x042b('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x042b('0x6')](_0x042b('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x042b('0x4')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x042b('0x1c')],'defaultValue':0x0,'set':function(_0x1502a7){this[_0x042b('0x16')]('acw',_0x1502a7);if(_0x1502a7){if(this[_0x042b('0xc')]('wrapuptime')<0x2){this[_0x042b('0x16')](_0x042b('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x042b('0x1c')],'defaultValue':0x0,'comment':_0x042b('0x1e')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x042b('0x10'),_0x042b('0x11'),'predictive',_0x042b('0xf')),'defaultValue':_0x042b('0x10'),'comment':_0x042b('0x1f')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x042b('0x20')},'dialLimitQueue':{'type':Sequelize[_0x042b('0x12')](0x4)[_0x042b('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x042b('0x22')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x042b('0x23')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x042b('0x24'),'dropRate'),'defaultValue':_0x042b('0x25'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x042b('0x26')](0x2)[_0x042b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x042b('0x12')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x042b('0x27')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x042b('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x042b('0x28'),'comment':_0x042b('0x29')},'dialQueueTimeout':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x042b('0x2a')},'dialQueueProject':{'type':Sequelize[_0x042b('0x4')],'comment':_0x042b('0x2b')},'dialCongestionMaxRetry':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x042b('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x042b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x042b('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x042b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x3,'comment':_0x042b('0x2e')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x042b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x042b('0x2f')},'dialGlobalMaxRetry':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x042b('0x30')},'dialTimezone':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x042b('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x042b('0x31'),_0x042b('0x32'),'onlyIfOpen'),'defaultValue':_0x042b('0x31')},'dialAMDActive':{'type':Sequelize[_0x042b('0x1c')],'defaultValue':0x0,'comment':_0x042b('0x33')},'dialAMDInitialSilence':{'type':Sequelize[_0x042b('0x12')](0x9)[_0x042b('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x042b('0x34')},'dialAMDGreeting':{'type':Sequelize[_0x042b('0x12')](0x9)[_0x042b('0x21')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x042b('0x12')](0x9)[_0x042b('0x21')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x042b('0x35')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x042b('0x12')](0x9)[_0x042b('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x042b('0x36')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x042b('0x12')](0x9)[_0x042b('0x21')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x042b('0x37')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x042b('0x12')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x042b('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x042b('0x12')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x042b('0x38')},'dialRecallMeTimeout':{'type':Sequelize[_0x042b('0x12')](0x5)[_0x042b('0x21')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x042b('0x39')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x042b('0x3a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x042b('0x3b'),_0x042b('0x3c')),'defaultValue':_0x042b('0x3b')},'dialQueueProject2':{'type':Sequelize[_0x042b('0x4')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x042b('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x042b('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x042b('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x042b('0x3d')},'dialCutDigit':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x042b('0x3e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x042b('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x042b('0x3f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x042b('0x12')](0x5)[_0x042b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x042b('0x40')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x042b('0x41')},'dialDropRetryFrequency':{'type':Sequelize[_0x042b('0x12')](0x5)[_0x042b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x042b('0x42')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x042b('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x042b('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x042b('0x44')},'dialMachineMaxRetry':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x042b('0x45')},'dialMachineRetryFrequency':{'type':Sequelize[_0x042b('0x12')](0x5)[_0x042b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x042b('0x12')](0x5)[_0x042b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x042b('0x46')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x042b('0x12')],'allowNull':!![],'comment':_0x042b('0x47')},'mandatoryDisposition':{'type':Sequelize[_0x042b('0x1c')],'defaultValue':![],'comment':_0x042b('0x48'),'set':function(_0xa2d9a6){if(!_0xa2d9a6)this[_0x042b('0x16')](_0x042b('0x49'),null);this['setDataValue'](_0x042b('0x4a'),_0xa2d9a6);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index f2eca74..14f8423 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 _0x7802=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','localhost','register','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','destroy','then','VoiceQueues','QueueCampaigns','outbound','map','value','includes','type','name','UserProfileResource','sendStatus','error','send','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceQueue','findAll','rows','catch','show','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','omit','inbound','getHoppers','findOne','VoiceQueueId','getHopperHistories','nolimit','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','flatMap','Agents','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','SIP/%s','interface','userVoiceQueue:save','ids','select','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','emit','isNil','format','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ListId','NOW()','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','insert','ContactId','cm_hopper','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x3a5458,_0x7d1481){var _0x470284=function(_0x47aaf3){while(--_0x47aaf3){_0x3a5458['push'](_0x3a5458['shift']());}};_0x470284(++_0x7d1481);}(_0x7802,0xa7));var _0x2780=function(_0x472caf,_0x42c3d5){_0x472caf=_0x472caf-0x0;var _0x16cd58=_0x7802[_0x472caf];return _0x16cd58;};'use strict';var emlformat=require(_0x2780('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2780('0x1'));var jsonpatch=require(_0x2780('0x2'));var rp=require(_0x2780('0x3'));var moment=require('moment');var BPromise=require(_0x2780('0x4'));var Mustache=require(_0x2780('0x5'));var util=require('util');var path=require('path');var sox=require(_0x2780('0x6'));var csv=require(_0x2780('0x7'));var ejs=require(_0x2780('0x8'));var fs=require('fs');var fs_extra=require(_0x2780('0x9'));var _=require(_0x2780('0xa'));var squel=require(_0x2780('0xb'));var crypto=require(_0x2780('0xc'));var jsforce=require(_0x2780('0xd'));var deskjs=require(_0x2780('0xe'));var toCsv=require(_0x2780('0x7'));var querystring=require(_0x2780('0xf'));var Papa=require(_0x2780('0x10'));var Redis=require(_0x2780('0x11'));var authService=require(_0x2780('0x12'));var qs=require(_0x2780('0x13'));var as=require(_0x2780('0x14'));var hardwareService=require(_0x2780('0x15'));var logger=require(_0x2780('0x16'))('api');var utils=require(_0x2780('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2780('0x18'));var db=require('../../mysqldb')['db'];config[_0x2780('0x19')]=_['defaults'](config[_0x2780('0x19')],{'host':_0x2780('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2780('0x19')]));require('./voiceQueue.socket')[_0x2780('0x1b')](socket);function respondWithStatusCode(_0x585c2d,_0x4f97ca){_0x4f97ca=_0x4f97ca||0xcc;return function(_0x55e87b){if(_0x55e87b){return _0x585c2d['sendStatus'](_0x4f97ca);}return _0x585c2d[_0x2780('0x1c')](_0x4f97ca)[_0x2780('0x1d')]();};}function respondWithResult(_0x344d96,_0x6d2c4d){_0x6d2c4d=_0x6d2c4d||0xc8;return function(_0x455368){if(_0x455368){return _0x344d96['status'](_0x6d2c4d)['json'](_0x455368);}};}function respondWithFilteredResult(_0x215f56,_0x2d3ee0){return function(_0x7aac7){if(_0x7aac7){var _0x4d4204=typeof _0x2d3ee0[_0x2780('0x1e')]==='undefined'&&typeof _0x2d3ee0['limit']===_0x2780('0x1f');var _0x254704=_0x7aac7[_0x2780('0x20')];var _0x420759=_0x4d4204?0x0:_0x2d3ee0[_0x2780('0x1e')];var _0xb29d97=_0x4d4204?_0x7aac7[_0x2780('0x20')]:_0x2d3ee0[_0x2780('0x1e')]+_0x2d3ee0[_0x2780('0x21')];var _0x3e90cc;if(_0xb29d97>=_0x254704){_0xb29d97=_0x254704;_0x3e90cc=0xc8;}else{_0x3e90cc=0xce;}_0x215f56[_0x2780('0x1c')](_0x3e90cc);return _0x215f56['set'](_0x2780('0x22'),_0x420759+'-'+_0xb29d97+'/'+_0x254704)[_0x2780('0x23')](_0x7aac7);}return null;};}function patchUpdates(_0x4663c7){return function(_0x40fbad){try{jsonpatch[_0x2780('0x24')](_0x40fbad,_0x4663c7,!![]);}catch(_0x2000e5){return BPromise[_0x2780('0x25')](_0x2000e5);}return _0x40fbad[_0x2780('0x26')]();};}function saveUpdates(_0x377b67,_0x549f88){return function(_0x1a8db4){if(_0x1a8db4){return _0x1a8db4[_0x2780('0x27')](_0x377b67)['then'](function(_0x465696){return _0x465696;});}return null;};}function removeEntity(_0x5e8065,_0x503a7c){return function(_0x1eddf6){if(_0x1eddf6){return _0x1eddf6[_0x2780('0x28')]()[_0x2780('0x29')](function(){var _0x4ddda6=_0x1eddf6['get']({'plain':!![]});var _0x3302a0=[{'name':_0x2780('0x2a'),'value':'inbound','ignore':![]},{'name':_0x2780('0x2b'),'value':_0x2780('0x2c'),'ignore':![]}];var _0x2a96ea=_(_0x3302a0)['filter']('ignore')[_0x2780('0x2d')](_0x2780('0x2e'))[_0x2780('0x2e')]();if(_[_0x2780('0x2f')](_0x2a96ea,_0x4ddda6[_0x2780('0x30')])){return;}var _0x11dd60=_['find'](_0x3302a0,['value',_0x4ddda6[_0x2780('0x30')]])[_0x2780('0x31')];return db[_0x2780('0x32')][_0x2780('0x28')]({'where':{'type':_0x11dd60,'resourceId':_0x4ddda6['id']}})[_0x2780('0x29')](function(){return _0x1eddf6;});})[_0x2780('0x29')](function(){_0x5e8065[_0x2780('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12a3e4,_0xd9974c){return function(_0x417ce6){if(!_0x417ce6){_0x12a3e4[_0x2780('0x33')](0x194);}return _0x417ce6;};}function handleError(_0x479056,_0x2a97a7){_0x2a97a7=_0x2a97a7||0x1f4;return function(_0x585fdd){logger[_0x2780('0x34')](_0x585fdd['stack']);if(_0x585fdd['name']){delete _0x585fdd['name'];}_0x479056[_0x2780('0x1c')](_0x2a97a7)[_0x2780('0x35')](_0x585fdd);};}exports['index']=function(_0xd1196f,_0x273517){var _0xae25f7={},_0xd28265={},_0x1429ae={'count':0x0,'rows':[]};var _0x39972e=_[_0x2780('0x2d')](db['VoiceQueue']['rawAttributes'],function(_0x1a5aab){return{'name':_0x1a5aab['fieldName'],'type':_0x1a5aab[_0x2780('0x30')]['key']};});_0xd28265[_0x2780('0x36')]=_[_0x2780('0x2d')](_0x39972e,_0x2780('0x31'));_0xd28265[_0x2780('0x37')]=_[_0x2780('0x38')](_0xd1196f[_0x2780('0x37')]);_0xd28265[_0x2780('0x39')]=_[_0x2780('0x3a')](_0xd28265[_0x2780('0x36')],_0xd28265[_0x2780('0x37')]);_0xae25f7[_0x2780('0x3b')]=_[_0x2780('0x3a')](_0xd28265[_0x2780('0x36')],qs[_0x2780('0x3c')](_0xd1196f[_0x2780('0x37')]['fields']));_0xae25f7['attributes']=_0xae25f7[_0x2780('0x3b')][_0x2780('0x3d')]?_0xae25f7['attributes']:_0xd28265[_0x2780('0x36')];if(!_0xd1196f[_0x2780('0x37')][_0x2780('0x3e')]('nolimit')){_0xae25f7[_0x2780('0x21')]=qs[_0x2780('0x21')](_0xd1196f[_0x2780('0x37')][_0x2780('0x21')]);_0xae25f7['offset']=qs['offset'](_0xd1196f[_0x2780('0x37')][_0x2780('0x1e')]);}_0xae25f7[_0x2780('0x3f')]=qs['sort'](_0xd1196f[_0x2780('0x37')][_0x2780('0x40')]);_0xae25f7[_0x2780('0x41')]=qs[_0x2780('0x39')](_[_0x2780('0x42')](_0xd1196f['query'],_0xd28265['filters']),_0x39972e);if(_0xd1196f[_0x2780('0x37')][_0x2780('0x43')]){_0xae25f7['where']=_[_0x2780('0x44')](_0xae25f7[_0x2780('0x41')],{'$or':_[_0x2780('0x2d')](_0x39972e,function(_0xa20c22){if(_0xa20c22[_0x2780('0x30')]!==_0x2780('0x45')){var _0x2558ea={};_0x2558ea[_0xa20c22[_0x2780('0x31')]]={'$like':'%'+_0xd1196f['query']['filter']+'%'};return _0x2558ea;}})});}_0xae25f7=_['merge']({},_0xae25f7,_0xd1196f[_0x2780('0x46')]);var _0x207b48={'where':_0xae25f7[_0x2780('0x41')]};return db['VoiceQueue']['count'](_0x207b48)[_0x2780('0x29')](function(_0x149e55){_0x1429ae[_0x2780('0x20')]=_0x149e55;if(_0xd1196f['query'][_0x2780('0x47')]){_0xae25f7[_0x2780('0x48')]=[{'all':!![]}];}return db[_0x2780('0x49')][_0x2780('0x4a')](_0xae25f7);})[_0x2780('0x29')](function(_0xfdcc72){_0x1429ae[_0x2780('0x4b')]=_0xfdcc72;return _0x1429ae;})[_0x2780('0x29')](respondWithFilteredResult(_0x273517,_0xae25f7))[_0x2780('0x4c')](handleError(_0x273517,null));};exports[_0x2780('0x4d')]=function(_0x575721,_0x56f1e7){var _0x4e917a={'raw':![],'where':{'id':_0x575721['params']['id']}},_0x1fb87c={};_0x1fb87c[_0x2780('0x36')]=_[_0x2780('0x38')](db[_0x2780('0x49')][_0x2780('0x4e')]);_0x1fb87c[_0x2780('0x37')]=_[_0x2780('0x38')](_0x575721[_0x2780('0x37')]);_0x1fb87c['filters']=_['intersection'](_0x1fb87c[_0x2780('0x36')],_0x1fb87c[_0x2780('0x37')]);_0x4e917a['attributes']=_[_0x2780('0x3a')](_0x1fb87c[_0x2780('0x36')],qs['fields'](_0x575721['query'][_0x2780('0x3c')]));_0x4e917a[_0x2780('0x3b')]=_0x4e917a[_0x2780('0x3b')][_0x2780('0x3d')]?_0x4e917a['attributes']:_0x1fb87c[_0x2780('0x36')];if(_0x575721[_0x2780('0x37')]['includeAll']){_0x4e917a[_0x2780('0x48')]=[{'all':!![]}];}_0x4e917a=_['merge']({},_0x4e917a,_0x575721['options']);return db[_0x2780('0x49')][_0x2780('0x4f')](_0x4e917a)[_0x2780('0x29')](handleEntityNotFound(_0x56f1e7,null))[_0x2780('0x29')](respondWithResult(_0x56f1e7,null))[_0x2780('0x4c')](handleError(_0x56f1e7,null));};exports['create']=function(_0x2ffb3e,_0xcd907b){return db[_0x2780('0x49')][_0x2780('0x50')](_0x2ffb3e[_0x2780('0x51')],{})[_0x2780('0x29')](function(_0x1fc58b){var _0x734a7e=_0x2ffb3e[_0x2780('0x52')][_0x2780('0x53')]({'plain':!![]});if(!_0x734a7e)throw new Error(_0x2780('0x54'));if(_0x734a7e[_0x2780('0x55')]===_0x2780('0x52')){var _0x429b9a=_0x1fc58b[_0x2780('0x53')]({'plain':!![]});var _0x2ac3e8=[{'name':_0x2780('0x2a'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x105741=_[_0x2780('0x4f')](_0x2ac3e8,['value',_0x429b9a['type']])[_0x2780('0x31')];return db[_0x2780('0x56')][_0x2780('0x4f')]({'where':{'name':_0x105741,'userProfileId':_0x734a7e[_0x2780('0x57')]},'raw':!![]})[_0x2780('0x29')](function(_0x44dd70){if(_0x44dd70&&_0x44dd70[_0x2780('0x58')]===0x0){return db[_0x2780('0x32')][_0x2780('0x50')]({'name':_0x429b9a[_0x2780('0x31')],'resourceId':_0x429b9a['id'],'type':_0x44dd70[_0x2780('0x31')],'sectionId':_0x44dd70['id']},{})[_0x2780('0x29')](function(){return _0x1fc58b;});}else{return _0x1fc58b;}})[_0x2780('0x4c')](function(_0x4e99c1){logger[_0x2780('0x34')](_0x2780('0x59'),_0x4e99c1);throw _0x4e99c1;});}return _0x1fc58b;})[_0x2780('0x29')](respondWithResult(_0xcd907b,0xc9))['catch'](handleError(_0xcd907b,null));};exports[_0x2780('0x5a')]=function(_0x278504,_0x2c3e0d){var _0x224fd5={'where':{'id':_0x278504[_0x2780('0x5b')]['id']}},_0x1e0db2={};_0x1e0db2[_0x2780('0x36')]=_[_0x2780('0x38')](db[_0x2780('0x49')][_0x2780('0x4e')]);_0x224fd5[_0x2780('0x3b')]=_[_0x2780('0x3a')](_0x1e0db2['model'],qs[_0x2780('0x3c')](_0x278504[_0x2780('0x37')]['fields']));_0x224fd5[_0x2780('0x3b')]=_0x224fd5[_0x2780('0x3b')][_0x2780('0x3d')]?_0x224fd5[_0x2780('0x3b')]:_0x1e0db2['model'];if(_0x278504['query'][_0x2780('0x47')]){_0x224fd5[_0x2780('0x48')]=[{'all':!![]}];}_0x224fd5=_['merge']({},_0x224fd5,_0x278504[_0x2780('0x46')]);return db[_0x2780('0x49')][_0x2780('0x4f')](_0x224fd5)[_0x2780('0x29')](handleEntityNotFound(_0x2c3e0d,null))[_0x2780('0x29')](function(_0x4375a6){if(_0x4375a6){var _0x129592=_0x4375a6[_0x2780('0x53')]({'plain':!![]});_0x129592=qs['omit'](_0x129592,['id',_0x2780('0x5c'),_0x2780('0x5d')]);_0x278504[_0x2780('0x51')]=_[_0x2780('0x5e')](_0x278504[_0x2780('0x51')],['id',_0x2780('0x5c'),_0x2780('0x5d')]);return db['VoiceQueue'][_0x2780('0x50')](_[_0x2780('0x44')](_0x129592,_0x278504[_0x2780('0x51')]),{'include':_0x278504[_0x2780('0x37')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x834873){var _0x1746b2=_0x278504['user'][_0x2780('0x53')]({'plain':!![]});if(!_0x1746b2)throw new Error(_0x2780('0x54'));if(_0x1746b2['role']===_0x2780('0x52')){var _0x1b26e1=_0x834873[_0x2780('0x53')]({'plain':!![]});var _0x5f528d=[{'name':'VoiceQueues','value':_0x2780('0x5f')},{'name':'QueueCampaigns','value':_0x2780('0x2c')}];var _0x179a8a=_[_0x2780('0x4f')](_0x5f528d,[_0x2780('0x2e'),_0x1b26e1[_0x2780('0x30')]])['name'];return db[_0x2780('0x56')]['find']({'where':{'name':_0x179a8a,'userProfileId':_0x1746b2[_0x2780('0x57')]},'raw':!![]})['then'](function(_0x48cd36){if(_0x48cd36&&_0x48cd36[_0x2780('0x58')]===0x0){return db[_0x2780('0x32')][_0x2780('0x50')]({'name':_0x1b26e1[_0x2780('0x31')],'resourceId':_0x1b26e1['id'],'type':_0x48cd36['name'],'sectionId':_0x48cd36['id']},{})[_0x2780('0x29')](function(){return _0x834873;});}else{return _0x834873;}})[_0x2780('0x4c')](function(_0x1ef4a4){logger[_0x2780('0x34')](_0x2780('0x59'),_0x1ef4a4);throw _0x1ef4a4;});}return _0x834873;});}})[_0x2780('0x29')](respondWithResult(_0x2c3e0d,0xc9))['catch'](handleError(_0x2c3e0d,null));};exports[_0x2780('0x27')]=function(_0xda8b2d,_0x2a60ad){if(_0xda8b2d['body']['id']){delete _0xda8b2d['body']['id'];}return db['VoiceQueue']['find']({'where':{'id':_0xda8b2d[_0x2780('0x5b')]['id']}})[_0x2780('0x29')](handleEntityNotFound(_0x2a60ad,null))[_0x2780('0x29')](saveUpdates(_0xda8b2d[_0x2780('0x51')],null))['then'](respondWithResult(_0x2a60ad,null))[_0x2780('0x4c')](handleError(_0x2a60ad,null));};exports[_0x2780('0x28')]=function(_0x57c5df,_0x78557b){return db[_0x2780('0x49')][_0x2780('0x4f')]({'where':{'id':_0x57c5df[_0x2780('0x5b')]['id']}})[_0x2780('0x29')](handleEntityNotFound(_0x78557b,null))[_0x2780('0x29')](removeEntity(_0x78557b,null))[_0x2780('0x4c')](handleError(_0x78557b,null));};exports[_0x2780('0x60')]=function(_0x587d46,_0x180bbd,_0x5d0052){var _0x26a068={'raw':![],'where':{}};var _0x11c51b={};var _0x3d1851={'count':0x0,'rows':[]};return db[_0x2780('0x49')][_0x2780('0x61')]({'where':{'id':_0x587d46['params']['id']}})[_0x2780('0x29')](handleEntityNotFound(_0x180bbd,null))[_0x2780('0x29')](function(_0x5348d7){if(_0x5348d7){_0x11c51b[_0x2780('0x36')]=_[_0x2780('0x38')](db['CmHopper'][_0x2780('0x4e')]);_0x11c51b[_0x2780('0x37')]=_[_0x2780('0x38')](_0x587d46[_0x2780('0x37')]);_0x11c51b['filters']=_[_0x2780('0x3a')](_0x11c51b[_0x2780('0x36')],_0x11c51b['query']);_0x26a068[_0x2780('0x3b')]=_[_0x2780('0x3a')](_0x11c51b['model'],qs[_0x2780('0x3c')](_0x587d46['query'][_0x2780('0x3c')]));_0x26a068[_0x2780('0x3b')]=_0x26a068[_0x2780('0x3b')]['length']?_0x26a068[_0x2780('0x3b')]:_0x11c51b[_0x2780('0x36')];if(!_0x587d46[_0x2780('0x37')][_0x2780('0x3e')]('nolimit')){_0x26a068[_0x2780('0x21')]=qs[_0x2780('0x21')](_0x587d46[_0x2780('0x37')]['limit']);_0x26a068[_0x2780('0x1e')]=qs['offset'](_0x587d46[_0x2780('0x37')][_0x2780('0x1e')]);}_0x26a068[_0x2780('0x3f')]=qs['sort'](_0x587d46[_0x2780('0x37')][_0x2780('0x40')]);_0x26a068[_0x2780('0x41')]=qs['filters'](_[_0x2780('0x42')](_0x587d46[_0x2780('0x37')],_0x11c51b[_0x2780('0x39')]));_0x26a068[_0x2780('0x41')][_0x2780('0x62')]=_0x5348d7['id'];if(_0x587d46[_0x2780('0x37')][_0x2780('0x43')]){_0x26a068['where']=_[_0x2780('0x44')](_0x26a068[_0x2780('0x41')],{'$or':_[_0x2780('0x2d')](_0x26a068[_0x2780('0x3b')],function(_0xa10a97){var _0x335663={};_0x335663[_0xa10a97]={'$like':'%'+_0x587d46[_0x2780('0x37')][_0x2780('0x43')]+'%'};return _0x335663;})});}_0x26a068=_[_0x2780('0x44')]({},_0x26a068,_0x587d46[_0x2780('0x46')]);return db['CmHopper']['count']({'where':_0x26a068['where']})['then'](function(_0x1e31fe){_0x3d1851[_0x2780('0x20')]=_0x1e31fe;if(_0x587d46[_0x2780('0x37')][_0x2780('0x47')]){_0x26a068[_0x2780('0x48')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x26a068);})[_0x2780('0x29')](function(_0x7e8082){_0x3d1851[_0x2780('0x4b')]=_0x7e8082;return _0x3d1851;});}})[_0x2780('0x29')](respondWithFilteredResult(_0x180bbd,_0x26a068))[_0x2780('0x4c')](handleError(_0x180bbd,null));};exports[_0x2780('0x63')]=function(_0x46bb5c,_0x3d5b82,_0x5175ae){var _0x13a642={'raw':!![],'where':{}};var _0x5c6d47={};var _0x174b10={'count':0x0,'rows':[]};return db[_0x2780('0x49')][_0x2780('0x61')]({'where':{'id':_0x46bb5c[_0x2780('0x5b')]['id']}})[_0x2780('0x29')](handleEntityNotFound(_0x3d5b82,null))[_0x2780('0x29')](function(_0x13b1b3){if(_0x13b1b3){_0x5c6d47[_0x2780('0x36')]=_[_0x2780('0x38')](db['CmHopperHistory']['rawAttributes']);_0x5c6d47[_0x2780('0x37')]=_[_0x2780('0x38')](_0x46bb5c[_0x2780('0x37')]);_0x5c6d47[_0x2780('0x39')]=_[_0x2780('0x3a')](_0x5c6d47['model'],_0x5c6d47[_0x2780('0x37')]);_0x13a642[_0x2780('0x3b')]=_[_0x2780('0x3a')](_0x5c6d47[_0x2780('0x36')],qs[_0x2780('0x3c')](_0x46bb5c['query'][_0x2780('0x3c')]));_0x13a642[_0x2780('0x3b')]=_0x13a642[_0x2780('0x3b')][_0x2780('0x3d')]?_0x13a642[_0x2780('0x3b')]:_0x5c6d47['model'];if(!_0x46bb5c[_0x2780('0x37')][_0x2780('0x3e')](_0x2780('0x64'))){_0x13a642[_0x2780('0x21')]=qs['limit'](_0x46bb5c['query'][_0x2780('0x21')]);_0x13a642[_0x2780('0x1e')]=qs[_0x2780('0x1e')](_0x46bb5c[_0x2780('0x37')][_0x2780('0x1e')]);}_0x13a642['order']=qs[_0x2780('0x40')](_0x46bb5c['query'][_0x2780('0x40')]);_0x13a642['where']=qs['filters'](_[_0x2780('0x42')](_0x46bb5c[_0x2780('0x37')],_0x5c6d47[_0x2780('0x39')]));_0x13a642['where'][_0x2780('0x62')]=_0x13b1b3['id'];if(_0x46bb5c[_0x2780('0x37')][_0x2780('0x43')]){_0x13a642[_0x2780('0x41')]=_['merge'](_0x13a642[_0x2780('0x41')],{'$or':_['map'](_0x13a642[_0x2780('0x3b')],function(_0x529b03){var _0xd25c23={};_0xd25c23[_0x529b03]={'$like':'%'+_0x46bb5c[_0x2780('0x37')][_0x2780('0x43')]+'%'};return _0xd25c23;})});}_0x13a642=_['merge']({},_0x13a642,_0x46bb5c[_0x2780('0x46')]);return db[_0x2780('0x65')][_0x2780('0x20')]({'where':_0x13a642[_0x2780('0x41')]})[_0x2780('0x29')](function(_0x5a8fe0){_0x174b10[_0x2780('0x20')]=_0x5a8fe0;if(_0x46bb5c[_0x2780('0x37')][_0x2780('0x47')]){_0x13a642[_0x2780('0x48')]=[{'all':!![]}];}return db[_0x2780('0x65')][_0x2780('0x4a')](_0x13a642);})[_0x2780('0x29')](function(_0x5b2173){_0x174b10[_0x2780('0x4b')]=_0x5b2173;return _0x174b10;});}})['then'](respondWithFilteredResult(_0x3d5b82,_0x13a642))[_0x2780('0x4c')](handleError(_0x3d5b82,null));};exports[_0x2780('0x66')]=function(_0x978244,_0x147b34,_0x22cd75){var _0x3d79f4={'raw':!![],'where':{}};var _0x158142={};var _0x4a9d0a={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2780('0x61')]({'where':{'id':_0x978244[_0x2780('0x5b')]['id']}})[_0x2780('0x29')](handleEntityNotFound(_0x147b34,null))['then'](function(_0x49f1b3){if(_0x49f1b3){_0x158142[_0x2780('0x36')]=_[_0x2780('0x38')](db[_0x2780('0x67')][_0x2780('0x4e')]);_0x158142['query']=_[_0x2780('0x38')](_0x978244[_0x2780('0x37')]);_0x158142[_0x2780('0x39')]=_[_0x2780('0x3a')](_0x158142['model'],_0x158142[_0x2780('0x37')]);_0x3d79f4['attributes']=_['intersection'](_0x158142[_0x2780('0x36')],qs['fields'](_0x978244[_0x2780('0x37')][_0x2780('0x3c')]));_0x3d79f4[_0x2780('0x3b')]=_0x3d79f4[_0x2780('0x3b')][_0x2780('0x3d')]?_0x3d79f4['attributes']:_0x158142[_0x2780('0x36')];if(!_0x978244[_0x2780('0x37')][_0x2780('0x3e')](_0x2780('0x64'))){_0x3d79f4[_0x2780('0x21')]=qs[_0x2780('0x21')](_0x978244[_0x2780('0x37')][_0x2780('0x21')]);_0x3d79f4['offset']=qs[_0x2780('0x1e')](_0x978244[_0x2780('0x37')][_0x2780('0x1e')]);}_0x3d79f4['order']=qs[_0x2780('0x40')](_0x978244[_0x2780('0x37')][_0x2780('0x40')]);_0x3d79f4['where']=qs[_0x2780('0x39')](_[_0x2780('0x42')](_0x978244[_0x2780('0x37')],_0x158142['filters']));_0x3d79f4['where']['VoiceQueueId']=_0x49f1b3['id'];if(_0x978244[_0x2780('0x37')]['filter']){_0x3d79f4[_0x2780('0x41')]=_[_0x2780('0x44')](_0x3d79f4[_0x2780('0x41')],{'$or':_[_0x2780('0x2d')](_0x3d79f4['attributes'],function(_0xd906d3){var _0x5aa06a={};_0x5aa06a[_0xd906d3]={'$like':'%'+_0x978244[_0x2780('0x37')][_0x2780('0x43')]+'%'};return _0x5aa06a;})});}_0x3d79f4=_[_0x2780('0x44')]({},_0x3d79f4,_0x978244['options']);return db[_0x2780('0x67')][_0x2780('0x20')]({'where':_0x3d79f4[_0x2780('0x41')]})['then'](function(_0x369e04){_0x4a9d0a[_0x2780('0x20')]=_0x369e04;if(_0x978244[_0x2780('0x37')][_0x2780('0x47')]){_0x3d79f4['include']=[{'all':!![]}];}return db[_0x2780('0x67')][_0x2780('0x4a')](_0x3d79f4);})[_0x2780('0x29')](function(_0x4e6891){_0x4a9d0a['rows']=_0x4e6891;return _0x4a9d0a;});}})[_0x2780('0x29')](respondWithFilteredResult(_0x147b34,_0x3d79f4))[_0x2780('0x4c')](handleError(_0x147b34,null));};exports['getHopperBlacks']=function(_0x2ab843,_0x7ebbe2,_0x4dc185){var _0x5c403d={'raw':!![],'where':{}};var _0x3e0417={};var _0x5acfd7={'count':0x0,'rows':[]};return db[_0x2780('0x49')]['findOne']({'where':{'id':_0x2ab843['params']['id']}})[_0x2780('0x29')](handleEntityNotFound(_0x7ebbe2,null))[_0x2780('0x29')](function(_0x3a5f63){if(_0x3a5f63){_0x3e0417['model']=_['keys'](db[_0x2780('0x68')][_0x2780('0x4e')]);_0x3e0417['query']=_[_0x2780('0x38')](_0x2ab843[_0x2780('0x37')]);_0x3e0417[_0x2780('0x39')]=_['intersection'](_0x3e0417[_0x2780('0x36')],_0x3e0417['query']);_0x5c403d[_0x2780('0x3b')]=_[_0x2780('0x3a')](_0x3e0417[_0x2780('0x36')],qs[_0x2780('0x3c')](_0x2ab843[_0x2780('0x37')]['fields']));_0x5c403d[_0x2780('0x3b')]=_0x5c403d[_0x2780('0x3b')]['length']?_0x5c403d[_0x2780('0x3b')]:_0x3e0417[_0x2780('0x36')];if(!_0x2ab843[_0x2780('0x37')][_0x2780('0x3e')](_0x2780('0x64'))){_0x5c403d['limit']=qs[_0x2780('0x21')](_0x2ab843[_0x2780('0x37')]['limit']);_0x5c403d[_0x2780('0x1e')]=qs[_0x2780('0x1e')](_0x2ab843[_0x2780('0x37')][_0x2780('0x1e')]);}_0x5c403d[_0x2780('0x3f')]=qs[_0x2780('0x40')](_0x2ab843[_0x2780('0x37')][_0x2780('0x40')]);_0x5c403d[_0x2780('0x41')]=qs[_0x2780('0x39')](_[_0x2780('0x42')](_0x2ab843[_0x2780('0x37')],_0x3e0417[_0x2780('0x39')]));_0x5c403d[_0x2780('0x41')][_0x2780('0x62')]=_0x3a5f63['id'];if(_0x2ab843[_0x2780('0x37')][_0x2780('0x43')]){_0x5c403d[_0x2780('0x41')]=_[_0x2780('0x44')](_0x5c403d[_0x2780('0x41')],{'$or':_['map'](_0x5c403d[_0x2780('0x3b')],function(_0x4e541a){var _0x37c0cb={};_0x37c0cb[_0x4e541a]={'$like':'%'+_0x2ab843[_0x2780('0x37')][_0x2780('0x43')]+'%'};return _0x37c0cb;})});}_0x5c403d=_[_0x2780('0x44')]({},_0x5c403d,_0x2ab843[_0x2780('0x46')]);return db['CmHopperBlack'][_0x2780('0x20')]({'where':_0x5c403d['where']})['then'](function(_0x16022f){_0x5acfd7[_0x2780('0x20')]=_0x16022f;if(_0x2ab843[_0x2780('0x37')][_0x2780('0x47')]){_0x5c403d['include']=[{'all':!![]}];}return db[_0x2780('0x68')][_0x2780('0x4a')](_0x5c403d);})[_0x2780('0x29')](function(_0x3f6e7){_0x5acfd7['rows']=_0x3f6e7;return _0x5acfd7;});}})[_0x2780('0x29')](respondWithFilteredResult(_0x7ebbe2,_0x5c403d))['catch'](handleError(_0x7ebbe2,null));};exports[_0x2780('0x69')]=function(_0x3add73,_0x390638,_0x3d4a42){var _0x349605={};var _0x102f73={};var _0x235e6a;var _0x1190cf;return db[_0x2780('0x49')][_0x2780('0x61')]({'where':{'id':_0x3add73[_0x2780('0x5b')]['id']}})[_0x2780('0x29')](handleEntityNotFound(_0x390638,null))['then'](function(_0x9aeb1a){if(_0x9aeb1a){_0x235e6a=_0x9aeb1a;_0x102f73[_0x2780('0x36')]=_[_0x2780('0x38')](db[_0x2780('0x6a')][_0x2780('0x4e')]);_0x102f73[_0x2780('0x37')]=_['keys'](_0x3add73[_0x2780('0x37')]);_0x102f73['filters']=_[_0x2780('0x3a')](_0x102f73[_0x2780('0x36')],_0x102f73[_0x2780('0x37')]);_0x349605[_0x2780('0x3b')]=_['intersection'](_0x102f73['model'],qs[_0x2780('0x3c')](_0x3add73[_0x2780('0x37')][_0x2780('0x3c')]));_0x349605[_0x2780('0x3b')]=_0x349605['attributes']['length']?_0x349605[_0x2780('0x3b')]:_0x102f73[_0x2780('0x36')];_0x349605[_0x2780('0x3f')]=qs[_0x2780('0x40')](_0x3add73['query'][_0x2780('0x40')]);_0x349605[_0x2780('0x41')]=qs[_0x2780('0x39')](_[_0x2780('0x42')](_0x3add73[_0x2780('0x37')],_0x102f73[_0x2780('0x39')]));if(_0x3add73[_0x2780('0x37')]['filter']){_0x349605['where']=_[_0x2780('0x44')](_0x349605['where'],{'$or':_[_0x2780('0x2d')](_0x349605[_0x2780('0x3b')],function(_0x3f323b){var _0x7d9c99={};_0x7d9c99[_0x3f323b]={'$like':'%'+_0x3add73[_0x2780('0x37')][_0x2780('0x43')]+'%'};return _0x7d9c99;})});}_0x349605=_[_0x2780('0x44')]({},_0x349605,_0x3add73[_0x2780('0x46')]);return _0x235e6a[_0x2780('0x69')](_0x349605);}})[_0x2780('0x29')](function(_0x545e29){if(_0x545e29){_0x1190cf=_0x545e29[_0x2780('0x3d')];if(!_0x3add73[_0x2780('0x37')][_0x2780('0x3e')](_0x2780('0x64'))){_0x349605['limit']=qs[_0x2780('0x21')](_0x3add73[_0x2780('0x37')][_0x2780('0x21')]);_0x349605[_0x2780('0x1e')]=qs['offset'](_0x3add73[_0x2780('0x37')][_0x2780('0x1e')]);}return _0x235e6a[_0x2780('0x69')](_0x349605);}})[_0x2780('0x29')](function(_0x284b81){if(_0x284b81){return _0x284b81?{'count':_0x1190cf,'rows':_0x284b81}:null;}})[_0x2780('0x29')](respondWithResult(_0x390638,null))[_0x2780('0x4c')](handleError(_0x390638,null));};exports[_0x2780('0x6b')]=function(_0x347f78,_0x2db74e,_0x5d832c){var _0x12c8db=_0x347f78[_0x2780('0x51')][_0x2780('0x6c')];var _0x3e6e44=_[_0x2780('0x2d')](_0x12c8db,'id');return db[_0x2780('0x6a')][_0x2780('0x4a')]({'where':{'id':_0x3e6e44},'attributes':['id'],'include':[{'model':db[_0x2780('0x6d')],'as':'Agents','attributes':['id',_0x2780('0x31'),_0x2780('0x6e'),_0x2780('0x6f'),'interface'],'raw':!![]}]})[_0x2780('0x29')](function(_0x36822f){if(_0x36822f){var _0x71bed8=_[_0x2780('0x70')](_0x36822f,function(_0x37a949){var _0x1ebfb8=_0x37a949[_0x2780('0x53')]({'plain':!![]});_0x1ebfb8[_0x2780('0x71')][_0x2780('0x72')](function(_0x4ab11e){_0x4ab11e[_0x2780('0x73')]=_[_0x2780('0x4f')](_0x12c8db,{'id':_0x1ebfb8['id']})[_0x2780('0x73')];});return _0x1ebfb8[_0x2780('0x71')];});return db['VoiceQueue'][_0x2780('0x4f')]({'where':{'id':_0x347f78['params']['id']}})[_0x2780('0x29')](function(_0x46fb31){return db[_0x2780('0x74')][_0x2780('0x75')](function(_0x1f2365){return _0x46fb31[_0x2780('0x6b')](_0x3e6e44,{'transaction':_0x1f2365})['then'](function(){return BPromise[_0x2780('0x76')](_0x12c8db,function(_0x1ea34d){return db[_0x2780('0x77')][_0x2780('0x78')]({'TeamId':_0x1ea34d['id'],'VoiceQueueId':_0x347f78[_0x2780('0x5b')]['id'],'penalty':_0x1ea34d[_0x2780('0x73')]},{'transaction':_0x1f2365});});})['then'](function(){return BPromise[_0x2780('0x76')](_0x71bed8,function(_0x539452){return db[_0x2780('0x79')]['findOrCreate']({'where':{'UserId':_0x539452['id'],'VoiceQueueId':_0x347f78[_0x2780('0x5b')]['id']},'defaults':{'penalty':_0x539452[_0x2780('0x73')]},'transaction':_0x1f2365});});})['then'](function(){return BPromise[_0x2780('0x76')](_[_0x2780('0x43')](_0x71bed8,{'online':!![]}),function(_0x272626){return db[_0x2780('0x7a')][_0x2780('0x78')]({'membername':_0x272626['name'],'UserId':_0x272626['id'],'queue_name':_0x46fb31[_0x2780('0x31')],'VoiceQueueId':_0x46fb31['id'],'interface':_['isNil'](_0x272626['interface'])?util['format'](_0x2780('0x7b'),_0x272626['name']):_0x272626[_0x2780('0x7c')],'paused':_0x272626[_0x2780('0x6f')]||![],'penalty':_0x272626['penalty']},{'transaction':_0x1f2365});});})[_0x2780('0x29')](function(){_0x71bed8[_0x2780('0x72')](function(_0x52b69c){socket['emit'](_0x2780('0x7d'),{'UserId':_0x52b69c['id'],'VoiceQueueId':_0x46fb31['id']});});});});});}})['then'](respondWithStatusCode(_0x2db74e,null))['catch'](handleError(_0x2db74e,null));};exports['removeTeams']=function(_0x32227f,_0x11cfb0,_0x5969b3){return db[_0x2780('0x6a')][_0x2780('0x4a')]({'where':{'id':_0x32227f[_0x2780('0x37')][_0x2780('0x7e')]},'attributes':['id'],'include':[{'model':db[_0x2780('0x6d')],'as':_0x2780('0x71'),'attributes':['id'],'raw':!![]}]})[_0x2780('0x29')](handleEntityNotFound(_0x11cfb0,null))[_0x2780('0x29')](function(_0x1a82ec){var _0x3e067a=_['map'](_0x1a82ec,'id');var _0x451ede=[];var _0x8fc690=[];var _0x1123a7=squel[_0x2780('0x7f')]();_0x1123a7[_0x2780('0x80')](_0x2780('0x81'))['from'](_0x2780('0x82'),'tq')['join'](_0x2780('0x83'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2780('0x41')]('VoiceQueueId\x20=\x20?',_0x32227f[_0x2780('0x5b')]['id']);for(var _0x1f6c34=0x0;_0x1f6c34<_0x1a82ec[_0x2780('0x3d')];_0x1f6c34+=0x1){let _0x1f1286=_0x1a82ec[_0x1f6c34];for(var _0x3bb5ee=0x0;_0x3bb5ee<_0x1f1286[_0x2780('0x71')]['length'];_0x3bb5ee+=0x1){let _0x1e13ea=_0x1f1286[_0x2780('0x71')][_0x3bb5ee];var _0x4e90b6=_0x1123a7[_0x2780('0x5a')]();_0x4e90b6[_0x2780('0x41')](_0x2780('0x84'),_0x1e13ea['id']);_0x8fc690[_0x2780('0x85')](db[_0x2780('0x74')][_0x2780('0x37')](_0x4e90b6[_0x2780('0x86')](),{'type':db[_0x2780('0x74')][_0x2780('0x87')][_0x2780('0x88')]})['then'](function(_0x41492a){if(_0x41492a[_0x2780('0x3d')]===0x1){return _0x1e13ea['id'];}else{var _0xc92892=_[_0x2780('0x89')](_[_0x2780('0x2d')](_0x41492a,_0x2780('0x8a')),function(_0x53f59f){return _[_0x2780('0x2f')](_0x3e067a,_0x53f59f);});if(_0xc92892){return _0x1e13ea['id'];}}}));}}return BPromise[_0x2780('0x8b')](_0x8fc690)[_0x2780('0x29')](function(_0x5dffc0){_0x451ede=_(_0x451ede)['union'](_0x5dffc0)[_0x2780('0x8c')]()[_0x2780('0x2e')]();return db[_0x2780('0x49')][_0x2780('0x4f')]({'where':{'id':_0x32227f[_0x2780('0x5b')]['id']}})[_0x2780('0x29')](function(_0x4d848f){return db[_0x2780('0x74')][_0x2780('0x75')](function(_0x4c3888){return _0x4d848f[_0x2780('0x8d')](_0x32227f[_0x2780('0x37')][_0x2780('0x7e')],{'transaction':_0x4c3888})[_0x2780('0x29')](function(){if(!_[_0x2780('0x8e')](_0x451ede)){return _0x4d848f[_0x2780('0x8f')](_0x451ede,{'transaction':_0x4c3888})['then'](function(){return db[_0x2780('0x7a')][_0x2780('0x28')]({'where':{'VoiceQueueId':_0x32227f[_0x2780('0x5b')]['id'],'UserId':_0x451ede},'transaction':_0x4c3888});});}})[_0x2780('0x29')](function(){_0x451ede[_0x2780('0x72')](function(_0x5e38ed){socket['emit'](_0x2780('0x90'),{'UserId':_0x5e38ed,'VoiceQueueId':_0x4d848f['id']});});});});});});})['then'](respondWithStatusCode(_0x11cfb0,null))['catch'](handleError(_0x11cfb0,null));};exports[_0x2780('0x91')]=function(_0xc337b6,_0x3c748b,_0xcf3b61){var _0x1d907f,_0x5a51cf;return db[_0x2780('0x49')][_0x2780('0x4f')]({'where':{'id':_0xc337b6['params']['id']}})[_0x2780('0x29')](handleEntityNotFound(_0x3c748b,null))[_0x2780('0x29')](function(_0x2ba20e){if(_0x2ba20e){_0x5a51cf=_0x2ba20e;return _0x2ba20e[_0x2780('0x91')](_0xc337b6[_0x2780('0x51')]['ids'],_[_0x2780('0x5e')](_0xc337b6[_0x2780('0x51')],[_0x2780('0x7e'),'id'])||{})[_0x2780('0x92')](function(_0x50b997){for(var _0x58165f=0x0;_0x58165f<_0xc337b6['body'][_0x2780('0x7e')][_0x2780('0x3d')];_0x58165f+=0x1){socket[_0x2780('0x93')](_0x2780('0x7d'),{'UserId':Number(_0xc337b6[_0x2780('0x51')][_0x2780('0x7e')][_0x58165f]),'VoiceQueueId':Number(_0xc337b6['params']['id'])});}return _0x50b997;});}})[_0x2780('0x29')](function(_0x3b6467){_0x1d907f=_0x3b6467||[];if(_0x5a51cf){return db['User'][_0x2780('0x4a')]({'where':{'id':_0xc337b6['body'][_0x2780('0x7e')]},'attributes':['id',_0x2780('0x31'),'online','voicePause','interface'],'raw':!![]});}})[_0x2780('0x29')](function(_0x41fcc1){if(!_[_0x2780('0x8e')](_0x41fcc1)){var _0x18f37d=[];for(var _0x418f3e=0x0;_0x418f3e<_0x41fcc1[_0x2780('0x3d')];_0x418f3e++){if(_0x41fcc1[_0x418f3e][_0x2780('0x6e')]){_0x18f37d[_0x2780('0x85')](db[_0x2780('0x7a')][_0x2780('0x78')]({'membername':_0x41fcc1[_0x418f3e][_0x2780('0x31')],'UserId':_0x41fcc1[_0x418f3e]['id'],'queue_name':_0x5a51cf[_0x2780('0x31')],'VoiceQueueId':_0x5a51cf['id'],'interface':_[_0x2780('0x94')](_0x41fcc1[_0x418f3e][_0x2780('0x7c')])?util[_0x2780('0x95')](_0x2780('0x7b'),_0x41fcc1[_0x418f3e][_0x2780('0x31')]):_0x41fcc1[_0x418f3e]['interface'],'paused':_0x41fcc1[_0x418f3e][_0x2780('0x6f')]||![],'penalty':_0xc337b6['body']['penalty']||0x0}));}}return BPromise[_0x2780('0x8b')](_0x18f37d);}})[_0x2780('0x29')](function(){return _0x1d907f;})[_0x2780('0x29')](respondWithResult(_0x3c748b,null))[_0x2780('0x4c')](handleError(_0x3c748b,null));};exports[_0x2780('0x8f')]=function(_0x428c1d,_0x52b677,_0x5c03ac){return db[_0x2780('0x49')][_0x2780('0x4f')]({'where':{'id':_0x428c1d[_0x2780('0x5b')]['id']}})['then'](handleEntityNotFound(_0x52b677,null))[_0x2780('0x29')](function(_0x3631e3){if(_0x3631e3){return _0x3631e3['removeAgents'](_0x428c1d['query'][_0x2780('0x7e')])[_0x2780('0x29')](function(){if(_[_0x2780('0x96')](_0x428c1d[_0x2780('0x37')]['ids'])){for(var _0x53e78d=0x0;_0x53e78d<_0x428c1d[_0x2780('0x37')][_0x2780('0x7e')]['length'];_0x53e78d+=0x1){socket[_0x2780('0x93')](_0x2780('0x90'),{'UserId':Number(_0x428c1d['query'][_0x2780('0x7e')][_0x53e78d]),'VoiceQueueId':Number(_0x428c1d[_0x2780('0x5b')]['id'])});}}else{socket[_0x2780('0x93')](_0x2780('0x90'),{'UserId':Number(_0x428c1d[_0x2780('0x37')]['ids']),'VoiceQueueId':Number(_0x428c1d[_0x2780('0x5b')]['id'])});}});}})['then'](function(_0x235155){return db['UserVoiceQueueRt'][_0x2780('0x28')]({'where':{'VoiceQueueId':_0x428c1d['params']['id'],'UserId':_0x428c1d['query']['ids']}})['then'](function(){return _0x235155;});})['then'](respondWithStatusCode(_0x52b677,null))['catch'](handleError(_0x52b677,null));};exports[_0x2780('0x97')]=function(_0x22377c,_0xee09ba,_0x3d5ec6){var _0x4f63d9={};var _0xc02e66={};var _0x184a73;var _0x3c024f;return db['VoiceQueue'][_0x2780('0x61')]({'where':{'id':_0x22377c[_0x2780('0x5b')]['id']}})[_0x2780('0x29')](handleEntityNotFound(_0xee09ba,null))[_0x2780('0x29')](function(_0x32be3f){if(_0x32be3f){_0x184a73=_0x32be3f;_0xc02e66['model']=_['keys'](db['User'][_0x2780('0x4e')]);_0xc02e66[_0x2780('0x37')]=_[_0x2780('0x38')](_0x22377c[_0x2780('0x37')]);_0xc02e66['filters']=_[_0x2780('0x3a')](_0xc02e66[_0x2780('0x36')],_0xc02e66[_0x2780('0x37')]);_0x4f63d9['attributes']=_[_0x2780('0x3a')](_0xc02e66[_0x2780('0x36')],qs[_0x2780('0x3c')](_0x22377c[_0x2780('0x37')]['fields']));_0x4f63d9[_0x2780('0x3b')]=_0x4f63d9[_0x2780('0x3b')][_0x2780('0x3d')]?_0x4f63d9[_0x2780('0x3b')]:_0xc02e66[_0x2780('0x36')];_0x4f63d9['order']=qs[_0x2780('0x40')](_0x22377c[_0x2780('0x37')][_0x2780('0x40')]);_0x4f63d9['where']=qs[_0x2780('0x39')](_[_0x2780('0x42')](_0x22377c[_0x2780('0x37')],_0xc02e66[_0x2780('0x39')]));if(_0x22377c[_0x2780('0x37')][_0x2780('0x43')]){_0x4f63d9[_0x2780('0x41')]=_[_0x2780('0x44')](_0x4f63d9[_0x2780('0x41')],{'$or':_[_0x2780('0x2d')](_0x4f63d9[_0x2780('0x3b')],function(_0x246966){var _0x194c41={};_0x194c41[_0x246966]={'$like':'%'+_0x22377c[_0x2780('0x37')][_0x2780('0x43')]+'%'};return _0x194c41;})});}_0x4f63d9=_[_0x2780('0x44')]({},_0x4f63d9,_0x22377c[_0x2780('0x46')]);return _0x184a73[_0x2780('0x97')](_0x4f63d9);}})[_0x2780('0x29')](function(_0x2599a8){if(_0x2599a8){_0x3c024f=_0x2599a8[_0x2780('0x3d')];if(!_0x22377c[_0x2780('0x37')]['hasOwnProperty'](_0x2780('0x64'))){_0x4f63d9[_0x2780('0x21')]=qs[_0x2780('0x21')](_0x22377c[_0x2780('0x37')][_0x2780('0x21')]);_0x4f63d9[_0x2780('0x1e')]=qs['offset'](_0x22377c[_0x2780('0x37')]['offset']);}return _0x184a73[_0x2780('0x97')](_0x4f63d9);}})['then'](function(_0x103745){if(_0x103745){return _0x103745?{'count':_0x3c024f,'rows':_0x103745}:null;}})[_0x2780('0x29')](respondWithResult(_0xee09ba,null))[_0x2780('0x4c')](handleError(_0xee09ba,null));};exports[_0x2780('0x98')]=function(_0x59625a,_0x3106ed,_0x546f7d){var _0x2cac5c={};var _0x2f4338={};var _0x25013b;var _0x5cbbf5;return db[_0x2780('0x49')][_0x2780('0x61')]({'where':{'id':_0x59625a[_0x2780('0x5b')]['id']}})[_0x2780('0x29')](handleEntityNotFound(_0x3106ed,null))['then'](function(_0x217908){if(_0x217908){_0x25013b=_0x217908;_0x2f4338['model']=_['keys'](db['UserVoiceQueueRt'][_0x2780('0x4e')]);_0x2f4338['query']=_[_0x2780('0x38')](_0x59625a['query']);_0x2f4338[_0x2780('0x39')]=_[_0x2780('0x3a')](_0x2f4338[_0x2780('0x36')],_0x2f4338[_0x2780('0x37')]);_0x2cac5c[_0x2780('0x3b')]=_[_0x2780('0x3a')](_0x2f4338[_0x2780('0x36')],qs[_0x2780('0x3c')](_0x59625a[_0x2780('0x37')][_0x2780('0x3c')]));_0x2cac5c[_0x2780('0x3b')]=_0x2cac5c[_0x2780('0x3b')]['length']?_0x2cac5c[_0x2780('0x3b')]:_0x2f4338[_0x2780('0x36')];_0x2cac5c['order']=qs['sort'](_0x59625a[_0x2780('0x37')][_0x2780('0x40')]);_0x2cac5c[_0x2780('0x41')]=qs[_0x2780('0x39')](_[_0x2780('0x42')](_0x59625a[_0x2780('0x37')],_0x2f4338['filters']));if(_0x59625a[_0x2780('0x37')][_0x2780('0x43')]){_0x2cac5c[_0x2780('0x41')]=_[_0x2780('0x44')](_0x2cac5c[_0x2780('0x41')],{'$or':_[_0x2780('0x2d')](_0x2cac5c['attributes'],function(_0x3dc877){var _0x11acd1={};_0x11acd1[_0x3dc877]={'$like':'%'+_0x59625a[_0x2780('0x37')][_0x2780('0x43')]+'%'};return _0x11acd1;})});}_0x2cac5c=_[_0x2780('0x44')]({},_0x2cac5c,_0x59625a[_0x2780('0x46')]);return _0x25013b[_0x2780('0x98')](_0x2cac5c);}})[_0x2780('0x29')](function(_0x2b944a){if(_0x2b944a){_0x5cbbf5=_0x2b944a[_0x2780('0x3d')];if(!_0x59625a[_0x2780('0x37')][_0x2780('0x3e')](_0x2780('0x64'))){_0x2cac5c[_0x2780('0x21')]=qs['limit'](_0x59625a['query']['limit']);_0x2cac5c[_0x2780('0x1e')]=qs['offset'](_0x59625a[_0x2780('0x37')][_0x2780('0x1e')]);}return _0x25013b[_0x2780('0x98')](_0x2cac5c);}})[_0x2780('0x29')](function(_0x17bd9a){return _0x17bd9a?{'count':_0x5cbbf5,'rows':_0x17bd9a}:null;})[_0x2780('0x29')](respondWithResult(_0x3106ed,null))[_0x2780('0x4c')](handleError(_0x3106ed,null));};exports[_0x2780('0x99')]=function(_0x3af3b5,_0x595d42,_0x3c2abb){var _0x4f5d9c={};var _0x183d3b={};var _0x10048d;var _0x71d992;return db[_0x2780('0x49')][_0x2780('0x61')]({'where':{'id':_0x3af3b5[_0x2780('0x5b')]['id']}})[_0x2780('0x29')](handleEntityNotFound(_0x595d42,null))[_0x2780('0x29')](function(_0x490e37){if(_0x490e37){_0x10048d=_0x490e37;_0x183d3b[_0x2780('0x36')]=_[_0x2780('0x38')](db['CmList'][_0x2780('0x4e')]);_0x183d3b[_0x2780('0x37')]=_['keys'](_0x3af3b5[_0x2780('0x37')]);_0x183d3b['filters']=_['intersection'](_0x183d3b[_0x2780('0x36')],_0x183d3b[_0x2780('0x37')]);_0x4f5d9c[_0x2780('0x3b')]=_[_0x2780('0x3a')](_0x183d3b[_0x2780('0x36')],qs['fields'](_0x3af3b5[_0x2780('0x37')][_0x2780('0x3c')]));_0x4f5d9c[_0x2780('0x3b')]=_0x4f5d9c[_0x2780('0x3b')][_0x2780('0x3d')]?_0x4f5d9c['attributes']:_0x183d3b[_0x2780('0x36')];_0x4f5d9c[_0x2780('0x3f')]=qs[_0x2780('0x40')](_0x3af3b5['query'][_0x2780('0x40')]);_0x4f5d9c[_0x2780('0x41')]=qs[_0x2780('0x39')](_[_0x2780('0x42')](_0x3af3b5[_0x2780('0x37')],_0x183d3b[_0x2780('0x39')]));if(_0x3af3b5[_0x2780('0x37')][_0x2780('0x43')]){_0x4f5d9c[_0x2780('0x41')]=_[_0x2780('0x44')](_0x4f5d9c[_0x2780('0x41')],{'$or':_['map'](_0x4f5d9c['attributes'],function(_0x1c55a8){var _0x51d474={};_0x51d474[_0x1c55a8]={'$like':'%'+_0x3af3b5['query'][_0x2780('0x43')]+'%'};return _0x51d474;})});}_0x4f5d9c=_[_0x2780('0x44')]({},_0x4f5d9c,_0x3af3b5[_0x2780('0x46')]);return _0x10048d[_0x2780('0x99')](_0x4f5d9c);}})[_0x2780('0x29')](function(_0x3bcb9a){if(_0x3bcb9a){_0x71d992=_0x3bcb9a[_0x2780('0x3d')];if(!_0x3af3b5[_0x2780('0x37')][_0x2780('0x3e')]('nolimit')){_0x4f5d9c[_0x2780('0x21')]=qs['limit'](_0x3af3b5['query']['limit']);_0x4f5d9c[_0x2780('0x1e')]=qs[_0x2780('0x1e')](_0x3af3b5[_0x2780('0x37')][_0x2780('0x1e')]);}return _0x10048d[_0x2780('0x99')](_0x4f5d9c);}})[_0x2780('0x29')](function(_0x46660a){if(_0x46660a){return _0x46660a?{'count':_0x71d992,'rows':_0x46660a}:null;}})['then'](respondWithResult(_0x595d42,null))[_0x2780('0x4c')](handleError(_0x595d42,null));};exports[_0x2780('0x9a')]=function(_0x50f68a,_0xb72d00,_0x55a76b){var _0x56bd2b,_0x41baec;return db[_0x2780('0x49')][_0x2780('0x4f')]({'where':{'id':_0x50f68a[_0x2780('0x5b')]['id']}})[_0x2780('0x29')](handleEntityNotFound(_0xb72d00,null))[_0x2780('0x29')](function(_0x545cdd){if(_0x545cdd){_0x41baec=_0x545cdd;return _0x545cdd['addLists'](_0x50f68a[_0x2780('0x51')][_0x2780('0x7e')],_[_0x2780('0x5e')](_0x50f68a[_0x2780('0x51')],['ids','id'])||{});}return null;})[_0x2780('0x92')](function(_0x4e489e){var _0x5bad47;_0x56bd2b=_0x4e489e||[];var _0x28d2f2=[];if(_0x4e489e){for(var _0x4f8a6a=0x0;_0x4f8a6a<_0x4e489e['length'];_0x4f8a6a+=0x1){var _0x2a404a=_0x4e489e[_0x4f8a6a]['get']({'plain':!![]});_0x41baec[_0x2780('0x9b')]=_0x50f68a[_0x2780('0x51')]['dialCheckDuplicateType']?_0x50f68a['body'][_0x2780('0x9b')]:_0x41baec[_0x2780('0x9b')];switch(_0x41baec[_0x2780('0x9b')]){case _0x2780('0x9c'):_0x5bad47=squel['insert']()[_0x2780('0x9d')]('cm_hopper')[_0x2780('0x9e')]([_0x2780('0x9f'),_0x2780('0xa0'),'ContactId',_0x2780('0xa1'),_0x2780('0x62'),_0x2780('0x5c'),_0x2780('0x5d')],squel[_0x2780('0x7f')]()[_0x2780('0x80')](_0x2780('0x9f'),_0x2780('0x9f'))[_0x2780('0x80')](_0x2780('0xa2'),_0x2780('0xa0'))[_0x2780('0x80')]('id','ContactId')[_0x2780('0x80')](_0x2a404a[_0x2780('0xa3')]['toString'](),_0x2780('0xa1'))[_0x2780('0x80')](_0x50f68a[_0x2780('0x5b')]['id'][_0x2780('0x86')](),_0x2780('0x62'))[_0x2780('0x80')]('NOW()',_0x2780('0x5c'))['field']('NOW()',_0x2780('0x5d'))[_0x2780('0xa4')](_0x2780('0xa5'))[_0x2780('0x41')](_0x2780('0xa6'))[_0x2780('0x41')](_0x2780('0xa7'),_0x2a404a['CmListId']['toString']())[_0x2780('0x41')](_0x2780('0xa8'))[_0x2780('0x41')](_0x2780('0xa9'),squel[_0x2780('0x7f')]()['field'](_0x2780('0xaa'))[_0x2780('0xa4')](_0x2780('0xab'))[_0x2780('0x41')](_0x2780('0xac'),_0x50f68a[_0x2780('0x5b')]['id']['toString']()))[_0x2780('0x41')](_0x2780('0xa9'),squel[_0x2780('0x7f')]()[_0x2780('0x80')](_0x2780('0xad'))['from']('cm_hopper')[_0x2780('0x41')](_0x2780('0xac'),_0x50f68a[_0x2780('0x5b')]['id']['toString']())))[_0x2780('0x86')]();break;case'onlyIfOpen':_0x5bad47=squel[_0x2780('0xae')]()['into']('cm_hopper')[_0x2780('0x9e')]([_0x2780('0x9f'),_0x2780('0xa0'),_0x2780('0xaf'),_0x2780('0xa1'),_0x2780('0x62'),'createdAt',_0x2780('0x5d')],squel[_0x2780('0x7f')]()[_0x2780('0x80')]('phone',_0x2780('0x9f'))[_0x2780('0x80')](_0x2780('0xa2'),'scheduledAt')[_0x2780('0x80')]('id',_0x2780('0xaf'))[_0x2780('0x80')](_0x2a404a[_0x2780('0xa3')][_0x2780('0x86')](),_0x2780('0xa1'))[_0x2780('0x80')](_0x50f68a['params']['id'][_0x2780('0x86')](),_0x2780('0x62'))[_0x2780('0x80')]('NOW()',_0x2780('0x5c'))[_0x2780('0x80')](_0x2780('0xa2'),_0x2780('0x5d'))[_0x2780('0xa4')](_0x2780('0xa5'))[_0x2780('0x41')](_0x2780('0xa6'))['where'](_0x2780('0xa7'),_0x2a404a['CmListId'][_0x2780('0x86')]())['where'](_0x2780('0xa8'))[_0x2780('0x41')](_0x2780('0xa9'),squel[_0x2780('0x7f')]()[_0x2780('0x80')](_0x2780('0xad'))['from'](_0x2780('0xb0'))['where'](_0x2780('0xac'),_0x50f68a['params']['id'][_0x2780('0x86')]())))['toString']();break;default:_0x5bad47=squel[_0x2780('0xae')]()[_0x2780('0x9d')](_0x2780('0xb0'))[_0x2780('0x9e')]([_0x2780('0x9f'),_0x2780('0xa0'),_0x2780('0xaf'),_0x2780('0xa1'),_0x2780('0x62'),_0x2780('0x5c'),'updatedAt'],squel[_0x2780('0x7f')]()[_0x2780('0x80')](_0x2780('0x9f'),_0x2780('0x9f'))[_0x2780('0x80')](_0x2780('0xa2'),_0x2780('0xa0'))['field']('id',_0x2780('0xaf'))[_0x2780('0x80')](_0x2a404a[_0x2780('0xa3')]['toString'](),_0x2780('0xa1'))[_0x2780('0x80')](_0x50f68a[_0x2780('0x5b')]['id']['toString'](),_0x2780('0x62'))['field'](_0x2780('0xa2'),'createdAt')[_0x2780('0x80')](_0x2780('0xa2'),_0x2780('0x5d'))['from'](_0x2780('0xa5'))[_0x2780('0x41')](_0x2780('0xa6'))['where']('ListId\x20=\x20?',_0x2a404a[_0x2780('0xa3')][_0x2780('0x86')]())[_0x2780('0x41')](_0x2780('0xa8')))[_0x2780('0x86')]();}_0x28d2f2[_0x2780('0x85')](db['sequelize'][_0x2780('0x37')](_0x5bad47));}return BPromise[_0x2780('0x8b')](_0x28d2f2);}})['then'](function(){return _0x56bd2b;})[_0x2780('0x29')](respondWithResult(_0xb72d00,null))['catch'](handleError(_0xb72d00,null));};exports[_0x2780('0xb1')]=function(_0x394576,_0x2a8467,_0x1d036c){return db[_0x2780('0x49')]['find']({'where':{'id':_0x394576[_0x2780('0x5b')]['id']}})[_0x2780('0x29')](handleEntityNotFound(_0x2a8467,null))[_0x2780('0x29')](function(_0xbf1c34){if(_0xbf1c34){return _0xbf1c34[_0x2780('0xb1')](_0x394576[_0x2780('0x37')][_0x2780('0x7e')]);}})['then'](function(_0xeed96d){if(_0xeed96d){return db['CmHopper'][_0x2780('0x28')]({'where':{'ListId':_0x394576[_0x2780('0x37')]['ids'],'VoiceQueueId':_0x394576['params']['id']}})[_0x2780('0x29')](function(){return _0xeed96d;});}})[_0x2780('0x29')](respondWithStatusCode(_0x2a8467,null))[_0x2780('0x4c')](handleError(_0x2a8467,null));};exports[_0x2780('0xb2')]=function(_0x3ac1cd,_0x493092,_0xb8ffc4){var _0x4eac42={};var _0x112514={};var _0x5f4d19;var _0x57a48f;return db[_0x2780('0x49')][_0x2780('0x61')]({'where':{'id':_0x3ac1cd[_0x2780('0x5b')]['id']}})[_0x2780('0x29')](handleEntityNotFound(_0x493092,null))[_0x2780('0x29')](function(_0x1b8d67){if(_0x1b8d67){_0x5f4d19=_0x1b8d67;_0x112514[_0x2780('0x36')]=_['keys'](db[_0x2780('0xb3')][_0x2780('0x4e')]);_0x112514[_0x2780('0x37')]=_[_0x2780('0x38')](_0x3ac1cd[_0x2780('0x37')]);_0x112514['filters']=_[_0x2780('0x3a')](_0x112514[_0x2780('0x36')],_0x112514[_0x2780('0x37')]);_0x4eac42[_0x2780('0x3b')]=_[_0x2780('0x3a')](_0x112514[_0x2780('0x36')],qs[_0x2780('0x3c')](_0x3ac1cd[_0x2780('0x37')][_0x2780('0x3c')]));_0x4eac42[_0x2780('0x3b')]=_0x4eac42[_0x2780('0x3b')][_0x2780('0x3d')]?_0x4eac42['attributes']:_0x112514[_0x2780('0x36')];_0x4eac42[_0x2780('0x3f')]=qs[_0x2780('0x40')](_0x3ac1cd['query'][_0x2780('0x40')]);_0x4eac42[_0x2780('0x41')]=qs['filters'](_[_0x2780('0x42')](_0x3ac1cd[_0x2780('0x37')],_0x112514[_0x2780('0x39')]));if(_0x3ac1cd[_0x2780('0x37')][_0x2780('0x43')]){_0x4eac42[_0x2780('0x41')]=_[_0x2780('0x44')](_0x4eac42[_0x2780('0x41')],{'$or':_[_0x2780('0x2d')](_0x4eac42[_0x2780('0x3b')],function(_0x3dc983){var _0x82fde3={};_0x82fde3[_0x3dc983]={'$like':'%'+_0x3ac1cd[_0x2780('0x37')][_0x2780('0x43')]+'%'};return _0x82fde3;})});}_0x4eac42=_[_0x2780('0x44')]({},_0x4eac42,_0x3ac1cd['options']);return _0x5f4d19[_0x2780('0xb2')](_0x4eac42);}})[_0x2780('0x29')](function(_0x364224){if(_0x364224){_0x57a48f=_0x364224['length'];if(!_0x3ac1cd[_0x2780('0x37')]['hasOwnProperty']('nolimit')){_0x4eac42[_0x2780('0x21')]=qs[_0x2780('0x21')](_0x3ac1cd[_0x2780('0x37')][_0x2780('0x21')]);_0x4eac42[_0x2780('0x1e')]=qs[_0x2780('0x1e')](_0x3ac1cd[_0x2780('0x37')][_0x2780('0x1e')]);}return _0x5f4d19[_0x2780('0xb2')](_0x4eac42);}})['then'](function(_0x66d1b3){if(_0x66d1b3){return _0x66d1b3?{'count':_0x57a48f,'rows':_0x66d1b3}:null;}})[_0x2780('0x29')](respondWithResult(_0x493092,null))[_0x2780('0x4c')](handleError(_0x493092,null));};exports[_0x2780('0xb4')]=function(_0x4f3280,_0x40d4f6,_0x2b34d3){var _0x3e928f,_0x1c0e02;return db[_0x2780('0x49')][_0x2780('0x4f')]({'where':{'id':_0x4f3280[_0x2780('0x5b')]['id']}})[_0x2780('0x29')](handleEntityNotFound(_0x40d4f6,null))['then'](function(_0x4ca365){if(_0x4ca365){_0x1c0e02=_0x4ca365;return _0x4ca365[_0x2780('0xb4')](_0x4f3280[_0x2780('0x51')][_0x2780('0x7e')],_[_0x2780('0x5e')](_0x4f3280[_0x2780('0x51')],[_0x2780('0x7e'),'id'])||{});}return null;})[_0x2780('0x92')](function(_0x238d17){var _0x391f7b;_0x3e928f=_0x238d17||[];var _0x4c040d=[];if(_0x238d17){for(var _0x40b57b=0x0;_0x40b57b<_0x238d17[_0x2780('0x3d')];_0x40b57b+=0x1){var _0x15831d=_0x238d17[_0x40b57b]['get']({'plain':!![]});_0x391f7b=squel['insert']()[_0x2780('0x9d')]('cm_hopper_black')['fromQuery']([_0x2780('0x9f'),_0x2780('0xaf'),_0x2780('0xa1'),_0x2780('0x62'),_0x2780('0x5c'),_0x2780('0x5d')],squel[_0x2780('0x7f')]()['field'](_0x2780('0x9f'),_0x2780('0x9f'))['field']('id','ContactId')[_0x2780('0x80')](_0x15831d['CmListId'][_0x2780('0x86')](),_0x2780('0xa1'))['field'](_0x4f3280[_0x2780('0x5b')]['id'][_0x2780('0x86')](),'VoiceQueueId')['field']('NOW()',_0x2780('0x5c'))['field'](_0x2780('0xa2'),'updatedAt')[_0x2780('0xa4')](_0x2780('0xa5'))['where'](_0x2780('0xa6'))[_0x2780('0x41')]('ListId\x20=\x20?',_0x15831d[_0x2780('0xa3')]['toString']())['where'](_0x2780('0xa8')))['toString']();_0x4c040d[_0x2780('0x85')](db[_0x2780('0x74')]['query'](_0x391f7b));}return BPromise[_0x2780('0x8b')](_0x4c040d);}})[_0x2780('0x29')](function(){return _0x3e928f;})[_0x2780('0x29')](respondWithResult(_0x40d4f6,null))[_0x2780('0x4c')](handleError(_0x40d4f6,null));};exports[_0x2780('0xb5')]=function(_0x3efe9a,_0x549592,_0x46ecfc){return db[_0x2780('0x49')][_0x2780('0x4f')]({'where':{'id':_0x3efe9a[_0x2780('0x5b')]['id']}})[_0x2780('0x29')](handleEntityNotFound(_0x549592,null))[_0x2780('0x29')](function(_0x3656c2){if(_0x3656c2){return _0x3656c2['removeBlackLists'](_0x3efe9a[_0x2780('0x37')]['ids']);}})['then'](function(_0x3190b7){if(_0x3190b7){return db[_0x2780('0x68')][_0x2780('0x28')]({'where':{'ListId':_0x3efe9a[_0x2780('0x37')][_0x2780('0x7e')],'VoiceQueueId':_0x3efe9a[_0x2780('0x5b')]['id']}})[_0x2780('0x29')](function(){return _0x3190b7;});}})[_0x2780('0x29')](respondWithStatusCode(_0x549592,null))[_0x2780('0x4c')](handleError(_0x549592,null));}; \ No newline at end of file +var _0x402a=['fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filters','where','merge','VIRTUAL','options','VoiceQueue','findAll','rows','catch','params','keys','includeAll','include','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','findOne','CmHopper','order','getHopperHistories','CmHopperHistory','CmHopperFinal','VoiceQueueId','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','Agents','online','voicePause','interface','flatMap','penalty','sequelize','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueue','findOrCreate','isNil','format','SIP/%s','forEach','emit','removeTeams','select','tq.TeamId','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','union','ids','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','phone','ContactId','ListId','field','scheduledAt','CmListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','fromQuery','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','phone\x20IS\x20NOT\x20NULL','removeBlackLists','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','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','redis','localhost','./voiceQueue.socket','register','end','json','offset','undefined','count','set','Content-Range','reject','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','name','destroy','status','sendStatus','error','stack','send','index','rawAttributes'];(function(_0x42c049,_0x4b6268){var _0x48a805=function(_0x29ed88){while(--_0x29ed88){_0x42c049['push'](_0x42c049['shift']());}};_0x48a805(++_0x4b6268);}(_0x402a,0x12f));var _0xa402=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x402a[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa402('0x0'));var rp=require(_0xa402('0x1'));var moment=require(_0xa402('0x2'));var BPromise=require(_0xa402('0x3'));var Mustache=require(_0xa402('0x4'));var util=require(_0xa402('0x5'));var path=require(_0xa402('0x6'));var sox=require('sox');var csv=require(_0xa402('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa402('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa402('0x9'));var toCsv=require(_0xa402('0x7'));var querystring=require('querystring');var Papa=require(_0xa402('0xa'));var Redis=require(_0xa402('0xb'));var authService=require(_0xa402('0xc'));var qs=require(_0xa402('0xd'));var as=require(_0xa402('0xe'));var hardwareService=require(_0xa402('0xf'));var logger=require('../../config/logger')(_0xa402('0x10'));var utils=require(_0xa402('0x11'));var config=require(_0xa402('0x12'));var licenseUtil=require(_0xa402('0x13'));var db=require(_0xa402('0x14'))['db'];config[_0xa402('0x15')]=_['defaults'](config[_0xa402('0x15')],{'host':_0xa402('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa402('0x15')]));require(_0xa402('0x17'))[_0xa402('0x18')](socket);function respondWithStatusCode(_0x127a88,_0x373050){_0x373050=_0x373050||0xcc;return function(_0x3980b7){if(_0x3980b7){return _0x127a88['sendStatus'](_0x373050);}return _0x127a88['status'](_0x373050)[_0xa402('0x19')]();};}function respondWithResult(_0x2e270d,_0x5a6255){_0x5a6255=_0x5a6255||0xc8;return function(_0x23e7ef){if(_0x23e7ef){return _0x2e270d['status'](_0x5a6255)[_0xa402('0x1a')](_0x23e7ef);}};}function respondWithFilteredResult(_0x4c9f5c,_0x177601){return function(_0x559589){if(_0x559589){var _0xc84a68=typeof _0x177601[_0xa402('0x1b')]===_0xa402('0x1c')&&typeof _0x177601['limit']===_0xa402('0x1c');var _0x36bf1c=_0x559589[_0xa402('0x1d')];var _0x44bba8=_0xc84a68?0x0:_0x177601[_0xa402('0x1b')];var _0x3e8be8=_0xc84a68?_0x559589[_0xa402('0x1d')]:_0x177601[_0xa402('0x1b')]+_0x177601['limit'];var _0x294565;if(_0x3e8be8>=_0x36bf1c){_0x3e8be8=_0x36bf1c;_0x294565=0xc8;}else{_0x294565=0xce;}_0x4c9f5c['status'](_0x294565);return _0x4c9f5c[_0xa402('0x1e')](_0xa402('0x1f'),_0x44bba8+'-'+_0x3e8be8+'/'+_0x36bf1c)[_0xa402('0x1a')](_0x559589);}return null;};}function patchUpdates(_0x1fb00c){return function(_0x4189e9){try{jsonpatch['apply'](_0x4189e9,_0x1fb00c,!![]);}catch(_0x19c65a){return BPromise[_0xa402('0x20')](_0x19c65a);}return _0x4189e9['save']();};}function saveUpdates(_0x3a57b9,_0x5b9981){return function(_0x47cd8c){if(_0x47cd8c){return _0x47cd8c[_0xa402('0x21')](_0x3a57b9)['then'](function(_0x3eea26){return _0x3eea26;});}return null;};}function removeEntity(_0x275235,_0x319ab0){return function(_0x19d6b4){if(_0x19d6b4){return _0x19d6b4['destroy']()[_0xa402('0x22')](function(){var _0xae460=_0x19d6b4[_0xa402('0x23')]({'plain':!![]});var _0x29a77f=[{'name':_0xa402('0x24'),'value':_0xa402('0x25'),'ignore':![]},{'name':_0xa402('0x26'),'value':_0xa402('0x27'),'ignore':![]}];var _0x1a4235=_(_0x29a77f)[_0xa402('0x28')](_0xa402('0x29'))[_0xa402('0x2a')](_0xa402('0x2b'))[_0xa402('0x2b')]();if(_['includes'](_0x1a4235,_0xae460[_0xa402('0x2c')])){return;}var _0x3c3ddf=_[_0xa402('0x2d')](_0x29a77f,['value',_0xae460[_0xa402('0x2c')]])[_0xa402('0x2e')];return db['UserProfileResource'][_0xa402('0x2f')]({'where':{'type':_0x3c3ddf,'resourceId':_0xae460['id']}})[_0xa402('0x22')](function(){return _0x19d6b4;});})[_0xa402('0x22')](function(){_0x275235[_0xa402('0x30')](0xcc)[_0xa402('0x19')]();});}};}function handleEntityNotFound(_0x47a0e4,_0x42ab96){return function(_0x33509a){if(!_0x33509a){_0x47a0e4[_0xa402('0x31')](0x194);}return _0x33509a;};}function handleError(_0xda665f,_0x4255d5){_0x4255d5=_0x4255d5||0x1f4;return function(_0x2daba6){logger[_0xa402('0x32')](_0x2daba6[_0xa402('0x33')]);if(_0x2daba6[_0xa402('0x2e')]){delete _0x2daba6[_0xa402('0x2e')];}_0xda665f[_0xa402('0x30')](_0x4255d5)[_0xa402('0x34')](_0x2daba6);};}exports[_0xa402('0x35')]=function(_0x1344dd,_0x17e32f){var _0x1b2d69={},_0x1b1c0f={},_0x3ed54e={'count':0x0,'rows':[]};var _0x17720f=_[_0xa402('0x2a')](db['VoiceQueue'][_0xa402('0x36')],function(_0x534b57){return{'name':_0x534b57[_0xa402('0x37')],'type':_0x534b57['type'][_0xa402('0x38')]};});_0x1b1c0f[_0xa402('0x39')]=_['map'](_0x17720f,_0xa402('0x2e'));_0x1b1c0f[_0xa402('0x3a')]=_['keys'](_0x1344dd['query']);_0x1b1c0f['filters']=_[_0xa402('0x3b')](_0x1b1c0f[_0xa402('0x39')],_0x1b1c0f[_0xa402('0x3a')]);_0x1b2d69[_0xa402('0x3c')]=_[_0xa402('0x3b')](_0x1b1c0f[_0xa402('0x39')],qs[_0xa402('0x3d')](_0x1344dd['query']['fields']));_0x1b2d69['attributes']=_0x1b2d69['attributes'][_0xa402('0x3e')]?_0x1b2d69[_0xa402('0x3c')]:_0x1b1c0f[_0xa402('0x39')];if(!_0x1344dd['query'][_0xa402('0x3f')](_0xa402('0x40'))){_0x1b2d69['limit']=qs[_0xa402('0x41')](_0x1344dd[_0xa402('0x3a')][_0xa402('0x41')]);_0x1b2d69['offset']=qs[_0xa402('0x1b')](_0x1344dd[_0xa402('0x3a')][_0xa402('0x1b')]);}_0x1b2d69['order']=qs[_0xa402('0x42')](_0x1344dd[_0xa402('0x3a')]['sort']);_0x1b2d69['where']=qs['filters'](_[_0xa402('0x43')](_0x1344dd[_0xa402('0x3a')],_0x1b1c0f[_0xa402('0x44')]),_0x17720f);if(_0x1344dd[_0xa402('0x3a')][_0xa402('0x28')]){_0x1b2d69[_0xa402('0x45')]=_[_0xa402('0x46')](_0x1b2d69[_0xa402('0x45')],{'$or':_[_0xa402('0x2a')](_0x17720f,function(_0x1d74bf){if(_0x1d74bf['type']!==_0xa402('0x47')){var _0x401add={};_0x401add[_0x1d74bf[_0xa402('0x2e')]]={'$like':'%'+_0x1344dd[_0xa402('0x3a')]['filter']+'%'};return _0x401add;}})});}_0x1b2d69=_[_0xa402('0x46')]({},_0x1b2d69,_0x1344dd[_0xa402('0x48')]);var _0x281617={'where':_0x1b2d69[_0xa402('0x45')]};return db[_0xa402('0x49')][_0xa402('0x1d')](_0x281617)[_0xa402('0x22')](function(_0x15d881){_0x3ed54e[_0xa402('0x1d')]=_0x15d881;if(_0x1344dd[_0xa402('0x3a')]['includeAll']){_0x1b2d69['include']=[{'all':!![]}];}return db[_0xa402('0x49')][_0xa402('0x4a')](_0x1b2d69);})['then'](function(_0x53ccf3){_0x3ed54e[_0xa402('0x4b')]=_0x53ccf3;return _0x3ed54e;})[_0xa402('0x22')](respondWithFilteredResult(_0x17e32f,_0x1b2d69))[_0xa402('0x4c')](handleError(_0x17e32f,null));};exports['show']=function(_0x198e1f,_0x1a7bdb){var _0x29e2ed={'raw':![],'where':{'id':_0x198e1f[_0xa402('0x4d')]['id']}},_0x232576={};_0x232576['model']=_[_0xa402('0x4e')](db[_0xa402('0x49')][_0xa402('0x36')]);_0x232576[_0xa402('0x3a')]=_[_0xa402('0x4e')](_0x198e1f[_0xa402('0x3a')]);_0x232576[_0xa402('0x44')]=_[_0xa402('0x3b')](_0x232576[_0xa402('0x39')],_0x232576[_0xa402('0x3a')]);_0x29e2ed['attributes']=_[_0xa402('0x3b')](_0x232576[_0xa402('0x39')],qs[_0xa402('0x3d')](_0x198e1f['query'][_0xa402('0x3d')]));_0x29e2ed[_0xa402('0x3c')]=_0x29e2ed[_0xa402('0x3c')][_0xa402('0x3e')]?_0x29e2ed['attributes']:_0x232576[_0xa402('0x39')];if(_0x198e1f[_0xa402('0x3a')][_0xa402('0x4f')]){_0x29e2ed[_0xa402('0x50')]=[{'all':!![]}];}_0x29e2ed=_[_0xa402('0x46')]({},_0x29e2ed,_0x198e1f[_0xa402('0x48')]);return db[_0xa402('0x49')]['find'](_0x29e2ed)['then'](handleEntityNotFound(_0x1a7bdb,null))[_0xa402('0x22')](respondWithResult(_0x1a7bdb,null))[_0xa402('0x4c')](handleError(_0x1a7bdb,null));};exports[_0xa402('0x51')]=function(_0x44c102,_0x19c08c){return db[_0xa402('0x49')][_0xa402('0x51')](_0x44c102[_0xa402('0x52')],{})['then'](function(_0x31d8a4){var _0x3d55f6=_0x44c102[_0xa402('0x53')][_0xa402('0x23')]({'plain':!![]});if(!_0x3d55f6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d55f6['role']==='user'){var _0x4e0163=_0x31d8a4['get']({'plain':!![]});var _0x1709c3=[{'name':_0xa402('0x24'),'value':_0xa402('0x25')},{'name':_0xa402('0x26'),'value':_0xa402('0x27')}];var _0x11ff31=_[_0xa402('0x2d')](_0x1709c3,[_0xa402('0x2b'),_0x4e0163['type']])[_0xa402('0x2e')];return db[_0xa402('0x54')][_0xa402('0x2d')]({'where':{'name':_0x11ff31,'userProfileId':_0x3d55f6[_0xa402('0x55')]},'raw':!![]})[_0xa402('0x22')](function(_0x58202c){if(_0x58202c&&_0x58202c[_0xa402('0x56')]===0x0){return db[_0xa402('0x57')][_0xa402('0x51')]({'name':_0x4e0163['name'],'resourceId':_0x4e0163['id'],'type':_0x58202c[_0xa402('0x2e')],'sectionId':_0x58202c['id']},{})['then'](function(){return _0x31d8a4;});}else{return _0x31d8a4;}})[_0xa402('0x4c')](function(_0x42ff4c){logger[_0xa402('0x32')](_0xa402('0x58'),_0x42ff4c);throw _0x42ff4c;});}return _0x31d8a4;})['then'](respondWithResult(_0x19c08c,0xc9))[_0xa402('0x4c')](handleError(_0x19c08c,null));};exports[_0xa402('0x59')]=function(_0x2e4607,_0x22c101){var _0x90bfad={'where':{'id':_0x2e4607[_0xa402('0x4d')]['id']}},_0x454efa={};_0x454efa['model']=_[_0xa402('0x4e')](db['VoiceQueue'][_0xa402('0x36')]);_0x90bfad[_0xa402('0x3c')]=_['intersection'](_0x454efa[_0xa402('0x39')],qs[_0xa402('0x3d')](_0x2e4607[_0xa402('0x3a')][_0xa402('0x3d')]));_0x90bfad['attributes']=_0x90bfad[_0xa402('0x3c')][_0xa402('0x3e')]?_0x90bfad[_0xa402('0x3c')]:_0x454efa['model'];if(_0x2e4607['query']['includeAll']){_0x90bfad[_0xa402('0x50')]=[{'all':!![]}];}_0x90bfad=_[_0xa402('0x46')]({},_0x90bfad,_0x2e4607[_0xa402('0x48')]);return db[_0xa402('0x49')][_0xa402('0x2d')](_0x90bfad)[_0xa402('0x22')](handleEntityNotFound(_0x22c101,null))[_0xa402('0x22')](function(_0x38c46f){if(_0x38c46f){var _0x400cc5=_0x38c46f[_0xa402('0x23')]({'plain':!![]});_0x400cc5=qs[_0xa402('0x5a')](_0x400cc5,['id',_0xa402('0x5b'),_0xa402('0x5c')]);_0x2e4607[_0xa402('0x52')]=_[_0xa402('0x5a')](_0x2e4607[_0xa402('0x52')],['id',_0xa402('0x5b'),'updatedAt']);return db[_0xa402('0x49')][_0xa402('0x51')](_[_0xa402('0x46')](_0x400cc5,_0x2e4607['body']),{'include':_0x2e4607[_0xa402('0x3a')][_0xa402('0x4f')]?[{'all':!![]}]:undefined})[_0xa402('0x22')](function(_0x579d07){var _0x4a5ab9=_0x2e4607[_0xa402('0x53')][_0xa402('0x23')]({'plain':!![]});if(!_0x4a5ab9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a5ab9[_0xa402('0x5d')]==='user'){var _0x4fbe46=_0x579d07[_0xa402('0x23')]({'plain':!![]});var _0x158d07=[{'name':_0xa402('0x24'),'value':_0xa402('0x25')},{'name':'QueueCampaigns','value':_0xa402('0x27')}];var _0x5c007f=_[_0xa402('0x2d')](_0x158d07,[_0xa402('0x2b'),_0x4fbe46[_0xa402('0x2c')]])[_0xa402('0x2e')];return db['UserProfileSection'][_0xa402('0x2d')]({'where':{'name':_0x5c007f,'userProfileId':_0x4a5ab9[_0xa402('0x55')]},'raw':!![]})[_0xa402('0x22')](function(_0x55af06){if(_0x55af06&&_0x55af06[_0xa402('0x56')]===0x0){return db[_0xa402('0x57')]['create']({'name':_0x4fbe46[_0xa402('0x2e')],'resourceId':_0x4fbe46['id'],'type':_0x55af06[_0xa402('0x2e')],'sectionId':_0x55af06['id']},{})['then'](function(){return _0x579d07;});}else{return _0x579d07;}})[_0xa402('0x4c')](function(_0x3e77e0){logger['error'](_0xa402('0x58'),_0x3e77e0);throw _0x3e77e0;});}return _0x579d07;});}})[_0xa402('0x22')](respondWithResult(_0x22c101,0xc9))[_0xa402('0x4c')](handleError(_0x22c101,null));};exports[_0xa402('0x21')]=function(_0x1e067f,_0x237ab1){if(_0x1e067f[_0xa402('0x52')]['id']){delete _0x1e067f[_0xa402('0x52')]['id'];}return db[_0xa402('0x49')]['find']({'where':{'id':_0x1e067f[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x237ab1,null))[_0xa402('0x22')](saveUpdates(_0x1e067f[_0xa402('0x52')],null))['then'](respondWithResult(_0x237ab1,null))[_0xa402('0x4c')](handleError(_0x237ab1,null));};exports[_0xa402('0x2f')]=function(_0x26da6,_0x4ccf92){return db['VoiceQueue'][_0xa402('0x2d')]({'where':{'id':_0x26da6[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x4ccf92,null))[_0xa402('0x22')](removeEntity(_0x4ccf92,null))['catch'](handleError(_0x4ccf92,null));};exports['getHoppers']=function(_0x5da8ad,_0x418411,_0x5a28e5){var _0xe66198={'raw':![],'where':{}};var _0x18f907={};var _0xdf3d8f={'count':0x0,'rows':[]};return db[_0xa402('0x49')][_0xa402('0x5e')]({'where':{'id':_0x5da8ad[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x418411,null))[_0xa402('0x22')](function(_0x288e4d){if(_0x288e4d){_0x18f907[_0xa402('0x39')]=_['keys'](db[_0xa402('0x5f')][_0xa402('0x36')]);_0x18f907['query']=_[_0xa402('0x4e')](_0x5da8ad[_0xa402('0x3a')]);_0x18f907[_0xa402('0x44')]=_[_0xa402('0x3b')](_0x18f907[_0xa402('0x39')],_0x18f907[_0xa402('0x3a')]);_0xe66198[_0xa402('0x3c')]=_[_0xa402('0x3b')](_0x18f907[_0xa402('0x39')],qs['fields'](_0x5da8ad[_0xa402('0x3a')]['fields']));_0xe66198[_0xa402('0x3c')]=_0xe66198[_0xa402('0x3c')]['length']?_0xe66198[_0xa402('0x3c')]:_0x18f907[_0xa402('0x39')];if(!_0x5da8ad['query'][_0xa402('0x3f')](_0xa402('0x40'))){_0xe66198[_0xa402('0x41')]=qs[_0xa402('0x41')](_0x5da8ad['query'][_0xa402('0x41')]);_0xe66198['offset']=qs[_0xa402('0x1b')](_0x5da8ad['query'][_0xa402('0x1b')]);}_0xe66198[_0xa402('0x60')]=qs[_0xa402('0x42')](_0x5da8ad['query'][_0xa402('0x42')]);_0xe66198[_0xa402('0x45')]=qs[_0xa402('0x44')](_[_0xa402('0x43')](_0x5da8ad[_0xa402('0x3a')],_0x18f907[_0xa402('0x44')]));_0xe66198[_0xa402('0x45')]['VoiceQueueId']=_0x288e4d['id'];if(_0x5da8ad['query'][_0xa402('0x28')]){_0xe66198[_0xa402('0x45')]=_[_0xa402('0x46')](_0xe66198['where'],{'$or':_['map'](_0xe66198['attributes'],function(_0x2352e4){var _0x135270={};_0x135270[_0x2352e4]={'$like':'%'+_0x5da8ad[_0xa402('0x3a')]['filter']+'%'};return _0x135270;})});}_0xe66198=_[_0xa402('0x46')]({},_0xe66198,_0x5da8ad[_0xa402('0x48')]);return db[_0xa402('0x5f')][_0xa402('0x1d')]({'where':_0xe66198[_0xa402('0x45')]})[_0xa402('0x22')](function(_0x39cf95){_0xdf3d8f['count']=_0x39cf95;if(_0x5da8ad[_0xa402('0x3a')]['includeAll']){_0xe66198['include']=[{'all':!![]}];}return db[_0xa402('0x5f')][_0xa402('0x4a')](_0xe66198);})['then'](function(_0x406471){_0xdf3d8f[_0xa402('0x4b')]=_0x406471;return _0xdf3d8f;});}})['then'](respondWithFilteredResult(_0x418411,_0xe66198))[_0xa402('0x4c')](handleError(_0x418411,null));};exports[_0xa402('0x61')]=function(_0x37f9ac,_0x15d0b5,_0x40e560){var _0x3e4cba={'raw':!![],'where':{}};var _0x305818={};var _0x259c20={'count':0x0,'rows':[]};return db[_0xa402('0x49')]['findOne']({'where':{'id':_0x37f9ac[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x15d0b5,null))[_0xa402('0x22')](function(_0x372950){if(_0x372950){_0x305818[_0xa402('0x39')]=_[_0xa402('0x4e')](db[_0xa402('0x62')]['rawAttributes']);_0x305818[_0xa402('0x3a')]=_['keys'](_0x37f9ac[_0xa402('0x3a')]);_0x305818[_0xa402('0x44')]=_[_0xa402('0x3b')](_0x305818[_0xa402('0x39')],_0x305818[_0xa402('0x3a')]);_0x3e4cba[_0xa402('0x3c')]=_[_0xa402('0x3b')](_0x305818['model'],qs[_0xa402('0x3d')](_0x37f9ac[_0xa402('0x3a')][_0xa402('0x3d')]));_0x3e4cba['attributes']=_0x3e4cba[_0xa402('0x3c')][_0xa402('0x3e')]?_0x3e4cba[_0xa402('0x3c')]:_0x305818['model'];if(!_0x37f9ac[_0xa402('0x3a')][_0xa402('0x3f')]('nolimit')){_0x3e4cba[_0xa402('0x41')]=qs['limit'](_0x37f9ac['query']['limit']);_0x3e4cba[_0xa402('0x1b')]=qs['offset'](_0x37f9ac[_0xa402('0x3a')][_0xa402('0x1b')]);}_0x3e4cba[_0xa402('0x60')]=qs['sort'](_0x37f9ac[_0xa402('0x3a')][_0xa402('0x42')]);_0x3e4cba[_0xa402('0x45')]=qs[_0xa402('0x44')](_[_0xa402('0x43')](_0x37f9ac[_0xa402('0x3a')],_0x305818[_0xa402('0x44')]));_0x3e4cba[_0xa402('0x45')]['VoiceQueueId']=_0x372950['id'];if(_0x37f9ac['query'][_0xa402('0x28')]){_0x3e4cba[_0xa402('0x45')]=_[_0xa402('0x46')](_0x3e4cba[_0xa402('0x45')],{'$or':_[_0xa402('0x2a')](_0x3e4cba[_0xa402('0x3c')],function(_0x471a81){var _0x101800={};_0x101800[_0x471a81]={'$like':'%'+_0x37f9ac[_0xa402('0x3a')]['filter']+'%'};return _0x101800;})});}_0x3e4cba=_[_0xa402('0x46')]({},_0x3e4cba,_0x37f9ac[_0xa402('0x48')]);return db[_0xa402('0x62')][_0xa402('0x1d')]({'where':_0x3e4cba[_0xa402('0x45')]})[_0xa402('0x22')](function(_0x174b03){_0x259c20[_0xa402('0x1d')]=_0x174b03;if(_0x37f9ac[_0xa402('0x3a')][_0xa402('0x4f')]){_0x3e4cba['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xa402('0x4a')](_0x3e4cba);})[_0xa402('0x22')](function(_0x2f3fa9){_0x259c20[_0xa402('0x4b')]=_0x2f3fa9;return _0x259c20;});}})[_0xa402('0x22')](respondWithFilteredResult(_0x15d0b5,_0x3e4cba))[_0xa402('0x4c')](handleError(_0x15d0b5,null));};exports['getHopperFinals']=function(_0x4ea643,_0x557532,_0x559d44){var _0xc362cc={'raw':!![],'where':{}};var _0x1bab0c={};var _0x4badd3={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa402('0x5e')]({'where':{'id':_0x4ea643[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x557532,null))[_0xa402('0x22')](function(_0x55d58e){if(_0x55d58e){_0x1bab0c[_0xa402('0x39')]=_['keys'](db[_0xa402('0x63')][_0xa402('0x36')]);_0x1bab0c[_0xa402('0x3a')]=_[_0xa402('0x4e')](_0x4ea643[_0xa402('0x3a')]);_0x1bab0c[_0xa402('0x44')]=_[_0xa402('0x3b')](_0x1bab0c[_0xa402('0x39')],_0x1bab0c[_0xa402('0x3a')]);_0xc362cc[_0xa402('0x3c')]=_[_0xa402('0x3b')](_0x1bab0c[_0xa402('0x39')],qs['fields'](_0x4ea643['query'][_0xa402('0x3d')]));_0xc362cc[_0xa402('0x3c')]=_0xc362cc['attributes'][_0xa402('0x3e')]?_0xc362cc['attributes']:_0x1bab0c[_0xa402('0x39')];if(!_0x4ea643[_0xa402('0x3a')][_0xa402('0x3f')](_0xa402('0x40'))){_0xc362cc[_0xa402('0x41')]=qs[_0xa402('0x41')](_0x4ea643[_0xa402('0x3a')]['limit']);_0xc362cc[_0xa402('0x1b')]=qs['offset'](_0x4ea643['query']['offset']);}_0xc362cc[_0xa402('0x60')]=qs['sort'](_0x4ea643[_0xa402('0x3a')][_0xa402('0x42')]);_0xc362cc[_0xa402('0x45')]=qs[_0xa402('0x44')](_[_0xa402('0x43')](_0x4ea643[_0xa402('0x3a')],_0x1bab0c[_0xa402('0x44')]));_0xc362cc['where'][_0xa402('0x64')]=_0x55d58e['id'];if(_0x4ea643[_0xa402('0x3a')][_0xa402('0x28')]){_0xc362cc['where']=_[_0xa402('0x46')](_0xc362cc[_0xa402('0x45')],{'$or':_['map'](_0xc362cc['attributes'],function(_0x3d47ce){var _0x176c93={};_0x176c93[_0x3d47ce]={'$like':'%'+_0x4ea643[_0xa402('0x3a')][_0xa402('0x28')]+'%'};return _0x176c93;})});}_0xc362cc=_[_0xa402('0x46')]({},_0xc362cc,_0x4ea643['options']);return db['CmHopperFinal']['count']({'where':_0xc362cc[_0xa402('0x45')]})['then'](function(_0x6e8779){_0x4badd3['count']=_0x6e8779;if(_0x4ea643[_0xa402('0x3a')]['includeAll']){_0xc362cc['include']=[{'all':!![]}];}return db[_0xa402('0x63')][_0xa402('0x4a')](_0xc362cc);})['then'](function(_0x22f002){_0x4badd3[_0xa402('0x4b')]=_0x22f002;return _0x4badd3;});}})[_0xa402('0x22')](respondWithFilteredResult(_0x557532,_0xc362cc))['catch'](handleError(_0x557532,null));};exports[_0xa402('0x65')]=function(_0x3c738d,_0x5e7057,_0x4140d6){var _0x44ea44={'raw':!![],'where':{}};var _0x3bbf9d={};var _0xa6f0c9={'count':0x0,'rows':[]};return db[_0xa402('0x49')][_0xa402('0x5e')]({'where':{'id':_0x3c738d[_0xa402('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5e7057,null))['then'](function(_0x53fa7e){if(_0x53fa7e){_0x3bbf9d[_0xa402('0x39')]=_[_0xa402('0x4e')](db['CmHopperBlack'][_0xa402('0x36')]);_0x3bbf9d['query']=_[_0xa402('0x4e')](_0x3c738d[_0xa402('0x3a')]);_0x3bbf9d[_0xa402('0x44')]=_[_0xa402('0x3b')](_0x3bbf9d[_0xa402('0x39')],_0x3bbf9d[_0xa402('0x3a')]);_0x44ea44['attributes']=_['intersection'](_0x3bbf9d[_0xa402('0x39')],qs[_0xa402('0x3d')](_0x3c738d[_0xa402('0x3a')]['fields']));_0x44ea44[_0xa402('0x3c')]=_0x44ea44['attributes'][_0xa402('0x3e')]?_0x44ea44['attributes']:_0x3bbf9d[_0xa402('0x39')];if(!_0x3c738d['query'][_0xa402('0x3f')](_0xa402('0x40'))){_0x44ea44[_0xa402('0x41')]=qs[_0xa402('0x41')](_0x3c738d[_0xa402('0x3a')][_0xa402('0x41')]);_0x44ea44[_0xa402('0x1b')]=qs[_0xa402('0x1b')](_0x3c738d[_0xa402('0x3a')][_0xa402('0x1b')]);}_0x44ea44[_0xa402('0x60')]=qs[_0xa402('0x42')](_0x3c738d['query'][_0xa402('0x42')]);_0x44ea44[_0xa402('0x45')]=qs[_0xa402('0x44')](_[_0xa402('0x43')](_0x3c738d[_0xa402('0x3a')],_0x3bbf9d[_0xa402('0x44')]));_0x44ea44[_0xa402('0x45')][_0xa402('0x64')]=_0x53fa7e['id'];if(_0x3c738d[_0xa402('0x3a')]['filter']){_0x44ea44[_0xa402('0x45')]=_[_0xa402('0x46')](_0x44ea44[_0xa402('0x45')],{'$or':_[_0xa402('0x2a')](_0x44ea44[_0xa402('0x3c')],function(_0x5f404f){var _0x242c69={};_0x242c69[_0x5f404f]={'$like':'%'+_0x3c738d[_0xa402('0x3a')][_0xa402('0x28')]+'%'};return _0x242c69;})});}_0x44ea44=_[_0xa402('0x46')]({},_0x44ea44,_0x3c738d['options']);return db[_0xa402('0x66')][_0xa402('0x1d')]({'where':_0x44ea44[_0xa402('0x45')]})['then'](function(_0x478174){_0xa6f0c9[_0xa402('0x1d')]=_0x478174;if(_0x3c738d[_0xa402('0x3a')][_0xa402('0x4f')]){_0x44ea44[_0xa402('0x50')]=[{'all':!![]}];}return db[_0xa402('0x66')][_0xa402('0x4a')](_0x44ea44);})['then'](function(_0x4f1d25){_0xa6f0c9[_0xa402('0x4b')]=_0x4f1d25;return _0xa6f0c9;});}})['then'](respondWithFilteredResult(_0x5e7057,_0x44ea44))[_0xa402('0x4c')](handleError(_0x5e7057,null));};exports[_0xa402('0x67')]=function(_0x12ffab,_0x4288f9,_0x55ea45){var _0xdc6b0f={};var _0x4d8c11={};var _0x4dc886;var _0x15e0e1;return db[_0xa402('0x49')][_0xa402('0x5e')]({'where':{'id':_0x12ffab[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x4288f9,null))['then'](function(_0x1319fe){if(_0x1319fe){_0x4dc886=_0x1319fe;_0x4d8c11[_0xa402('0x39')]=_[_0xa402('0x4e')](db[_0xa402('0x68')][_0xa402('0x36')]);_0x4d8c11[_0xa402('0x3a')]=_[_0xa402('0x4e')](_0x12ffab['query']);_0x4d8c11[_0xa402('0x44')]=_[_0xa402('0x3b')](_0x4d8c11['model'],_0x4d8c11[_0xa402('0x3a')]);_0xdc6b0f[_0xa402('0x3c')]=_[_0xa402('0x3b')](_0x4d8c11[_0xa402('0x39')],qs[_0xa402('0x3d')](_0x12ffab[_0xa402('0x3a')]['fields']));_0xdc6b0f[_0xa402('0x3c')]=_0xdc6b0f[_0xa402('0x3c')]['length']?_0xdc6b0f[_0xa402('0x3c')]:_0x4d8c11[_0xa402('0x39')];_0xdc6b0f[_0xa402('0x60')]=qs[_0xa402('0x42')](_0x12ffab['query']['sort']);_0xdc6b0f[_0xa402('0x45')]=qs['filters'](_['pick'](_0x12ffab[_0xa402('0x3a')],_0x4d8c11[_0xa402('0x44')]));if(_0x12ffab['query']['filter']){_0xdc6b0f[_0xa402('0x45')]=_[_0xa402('0x46')](_0xdc6b0f['where'],{'$or':_[_0xa402('0x2a')](_0xdc6b0f[_0xa402('0x3c')],function(_0x848e53){var _0x174ce0={};_0x174ce0[_0x848e53]={'$like':'%'+_0x12ffab[_0xa402('0x3a')]['filter']+'%'};return _0x174ce0;})});}_0xdc6b0f=_[_0xa402('0x46')]({},_0xdc6b0f,_0x12ffab[_0xa402('0x48')]);return _0x4dc886[_0xa402('0x67')](_0xdc6b0f);}})[_0xa402('0x22')](function(_0x2aaf16){if(_0x2aaf16){_0x15e0e1=_0x2aaf16[_0xa402('0x3e')];if(!_0x12ffab[_0xa402('0x3a')][_0xa402('0x3f')](_0xa402('0x40'))){_0xdc6b0f[_0xa402('0x41')]=qs['limit'](_0x12ffab[_0xa402('0x3a')][_0xa402('0x41')]);_0xdc6b0f[_0xa402('0x1b')]=qs[_0xa402('0x1b')](_0x12ffab[_0xa402('0x3a')][_0xa402('0x1b')]);}return _0x4dc886[_0xa402('0x67')](_0xdc6b0f);}})[_0xa402('0x22')](function(_0x369f3f){if(_0x369f3f){return _0x369f3f?{'count':_0x15e0e1,'rows':_0x369f3f}:null;}})[_0xa402('0x22')](respondWithResult(_0x4288f9,null))[_0xa402('0x4c')](handleError(_0x4288f9,null));};exports[_0xa402('0x69')]=function(_0x44d027,_0x552557,_0x547774){var _0x312035=_0x44d027['body']['teams'];var _0x130c2a=_['map'](_0x312035,'id');return db[_0xa402('0x68')][_0xa402('0x4a')]({'where':{'id':_0x130c2a},'attributes':['id'],'include':[{'model':db[_0xa402('0x6a')],'as':_0xa402('0x6b'),'attributes':['id','name',_0xa402('0x6c'),_0xa402('0x6d'),_0xa402('0x6e')],'raw':!![]}]})[_0xa402('0x22')](function(_0x8c9491){if(_0x8c9491){var _0x495afe=_[_0xa402('0x6f')](_0x8c9491,function(_0x132e2a){var _0x24dfff=_0x132e2a[_0xa402('0x23')]({'plain':!![]});_0x24dfff['Agents']['forEach'](function(_0x4a15d3){_0x4a15d3[_0xa402('0x70')]=_[_0xa402('0x2d')](_0x312035,{'id':_0x24dfff['id']})[_0xa402('0x70')];});return _0x24dfff[_0xa402('0x6b')];});return db[_0xa402('0x49')][_0xa402('0x2d')]({'where':{'id':_0x44d027[_0xa402('0x4d')]['id']}})['then'](function(_0x136e49){return db[_0xa402('0x71')][_0xa402('0x72')](function(_0x261fbb){return _0x136e49['addTeams'](_0x130c2a,{'transaction':_0x261fbb})[_0xa402('0x22')](function(){return BPromise['each'](_0x312035,function(_0x4c5f4e){return db[_0xa402('0x73')][_0xa402('0x74')]({'TeamId':_0x4c5f4e['id'],'VoiceQueueId':_0x44d027[_0xa402('0x4d')]['id'],'penalty':_0x4c5f4e['penalty']},{'transaction':_0x261fbb});});})[_0xa402('0x22')](function(){return BPromise[_0xa402('0x75')](_0x495afe,function(_0xfc1f6){return db[_0xa402('0x76')][_0xa402('0x77')]({'where':{'UserId':_0xfc1f6['id'],'VoiceQueueId':_0x44d027[_0xa402('0x4d')]['id']},'defaults':{'penalty':_0xfc1f6[_0xa402('0x70')]},'transaction':_0x261fbb});});})[_0xa402('0x22')](function(){return BPromise[_0xa402('0x75')](_[_0xa402('0x28')](_0x495afe,{'online':!![]}),function(_0x4fbb03){return db['UserVoiceQueueRt'][_0xa402('0x74')]({'membername':_0x4fbb03['name'],'UserId':_0x4fbb03['id'],'queue_name':_0x136e49[_0xa402('0x2e')],'VoiceQueueId':_0x136e49['id'],'interface':_[_0xa402('0x78')](_0x4fbb03[_0xa402('0x6e')])?util[_0xa402('0x79')](_0xa402('0x7a'),_0x4fbb03['name']):_0x4fbb03['interface'],'paused':_0x4fbb03[_0xa402('0x6d')]||![],'penalty':_0x4fbb03[_0xa402('0x70')]},{'transaction':_0x261fbb});});})[_0xa402('0x22')](function(){_0x495afe[_0xa402('0x7b')](function(_0xc0168e){socket[_0xa402('0x7c')]('userVoiceQueue:save',{'UserId':_0xc0168e['id'],'VoiceQueueId':_0x136e49['id']});});});});});}})[_0xa402('0x22')](respondWithStatusCode(_0x552557,null))['catch'](handleError(_0x552557,null));};exports[_0xa402('0x7d')]=function(_0x852bf5,_0x53d28e,_0x14b4c6){return db['Team'][_0xa402('0x4a')]({'where':{'id':_0x852bf5[_0xa402('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa402('0x6a')],'as':_0xa402('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xa402('0x22')](handleEntityNotFound(_0x53d28e,null))[_0xa402('0x22')](function(_0x7b91c0){var _0x22d209=_[_0xa402('0x2a')](_0x7b91c0,'id');var _0xe347cf=[];var _0x438ff2=[];var _0x14eea4=squel[_0xa402('0x7e')]();_0x14eea4['field'](_0xa402('0x7f'))[_0xa402('0x80')](_0xa402('0x81'),'tq')[_0xa402('0x82')]('user_has_teams','ut',_0xa402('0x83'))['where'](_0xa402('0x84'),_0x852bf5[_0xa402('0x4d')]['id']);for(var _0x1f41af=0x0;_0x1f41af<_0x7b91c0[_0xa402('0x3e')];_0x1f41af+=0x1){let _0x117e79=_0x7b91c0[_0x1f41af];for(var _0x538be3=0x0;_0x538be3<_0x117e79[_0xa402('0x6b')][_0xa402('0x3e')];_0x538be3+=0x1){let _0x5b81c0=_0x117e79[_0xa402('0x6b')][_0x538be3];var _0x396a87=_0x14eea4[_0xa402('0x59')]();_0x396a87['where'](_0xa402('0x85'),_0x5b81c0['id']);_0x438ff2[_0xa402('0x86')](db[_0xa402('0x71')]['query'](_0x396a87[_0xa402('0x87')](),{'type':db[_0xa402('0x71')][_0xa402('0x88')]['SELECT']})[_0xa402('0x22')](function(_0x29ff30){if(_0x29ff30['length']===0x1){return _0x5b81c0['id'];}else{var _0xa2b2de=_['every'](_['map'](_0x29ff30,_0xa402('0x89')),function(_0x481d19){return _[_0xa402('0x8a')](_0x22d209,_0x481d19);});if(_0xa2b2de){return _0x5b81c0['id'];}}}));}}return BPromise[_0xa402('0x8b')](_0x438ff2)[_0xa402('0x22')](function(_0x52dbd6){_0xe347cf=_(_0xe347cf)[_0xa402('0x8c')](_0x52dbd6)['compact']()['value']();return db[_0xa402('0x49')][_0xa402('0x2d')]({'where':{'id':_0x852bf5[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](function(_0x264e62){return db[_0xa402('0x71')][_0xa402('0x72')](function(_0x3f239d){return _0x264e62[_0xa402('0x7d')](_0x852bf5[_0xa402('0x3a')][_0xa402('0x8d')],{'transaction':_0x3f239d})[_0xa402('0x22')](function(){if(!_[_0xa402('0x8e')](_0xe347cf)){return _0x264e62[_0xa402('0x8f')](_0xe347cf,{'transaction':_0x3f239d})[_0xa402('0x22')](function(){return db[_0xa402('0x90')][_0xa402('0x2f')]({'where':{'VoiceQueueId':_0x852bf5[_0xa402('0x4d')]['id'],'UserId':_0xe347cf},'transaction':_0x3f239d});});}})[_0xa402('0x22')](function(){_0xe347cf['forEach'](function(_0x5e02eb){socket['emit'](_0xa402('0x91'),{'UserId':_0x5e02eb,'VoiceQueueId':_0x264e62['id']});});});});});});})[_0xa402('0x22')](respondWithStatusCode(_0x53d28e,null))[_0xa402('0x4c')](handleError(_0x53d28e,null));};exports['addAgents']=function(_0x35e5c1,_0x70a073,_0x26fc8c){var _0x1d99b7,_0xf43f21;return db[_0xa402('0x49')]['find']({'where':{'id':_0x35e5c1['params']['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x70a073,null))[_0xa402('0x22')](function(_0x2429be){if(_0x2429be){_0xf43f21=_0x2429be;return _0x2429be[_0xa402('0x92')](_0x35e5c1[_0xa402('0x52')][_0xa402('0x8d')],_['omit'](_0x35e5c1[_0xa402('0x52')],['ids','id'])||{})[_0xa402('0x93')](function(_0x5bc19e){for(var _0x477f2b=0x0;_0x477f2b<_0x35e5c1[_0xa402('0x52')][_0xa402('0x8d')][_0xa402('0x3e')];_0x477f2b+=0x1){socket[_0xa402('0x7c')]('userVoiceQueue:save',{'UserId':Number(_0x35e5c1['body']['ids'][_0x477f2b]),'VoiceQueueId':Number(_0x35e5c1[_0xa402('0x4d')]['id'])});}return _0x5bc19e;});}})[_0xa402('0x22')](function(_0x30103c){_0x1d99b7=_0x30103c||[];if(_0xf43f21){return db[_0xa402('0x6a')]['findAll']({'where':{'id':_0x35e5c1[_0xa402('0x52')][_0xa402('0x8d')]},'attributes':['id',_0xa402('0x2e'),'online','voicePause',_0xa402('0x6e')],'raw':!![]});}})[_0xa402('0x22')](function(_0xe24f82){if(!_[_0xa402('0x8e')](_0xe24f82)){var _0x454de2=[];for(var _0x4bf417=0x0;_0x4bf417<_0xe24f82['length'];_0x4bf417++){if(_0xe24f82[_0x4bf417][_0xa402('0x6c')]){_0x454de2['push'](db[_0xa402('0x90')][_0xa402('0x74')]({'membername':_0xe24f82[_0x4bf417][_0xa402('0x2e')],'UserId':_0xe24f82[_0x4bf417]['id'],'queue_name':_0xf43f21['name'],'VoiceQueueId':_0xf43f21['id'],'interface':_[_0xa402('0x78')](_0xe24f82[_0x4bf417][_0xa402('0x6e')])?util[_0xa402('0x79')](_0xa402('0x7a'),_0xe24f82[_0x4bf417]['name']):_0xe24f82[_0x4bf417][_0xa402('0x6e')],'paused':_0xe24f82[_0x4bf417][_0xa402('0x6d')]||![],'penalty':_0x35e5c1[_0xa402('0x52')][_0xa402('0x70')]||0x0}));}}return BPromise[_0xa402('0x8b')](_0x454de2);}})[_0xa402('0x22')](function(){return _0x1d99b7;})[_0xa402('0x22')](respondWithResult(_0x70a073,null))[_0xa402('0x4c')](handleError(_0x70a073,null));};exports[_0xa402('0x8f')]=function(_0x5a996b,_0x596977,_0x5b3f33){return db[_0xa402('0x49')][_0xa402('0x2d')]({'where':{'id':_0x5a996b['params']['id']}})['then'](handleEntityNotFound(_0x596977,null))[_0xa402('0x22')](function(_0x5c526c){if(_0x5c526c){return _0x5c526c[_0xa402('0x8f')](_0x5a996b[_0xa402('0x3a')][_0xa402('0x8d')])['then'](function(){if(_['isArray'](_0x5a996b[_0xa402('0x3a')][_0xa402('0x8d')])){for(var _0x27d943=0x0;_0x27d943<_0x5a996b[_0xa402('0x3a')][_0xa402('0x8d')]['length'];_0x27d943+=0x1){socket[_0xa402('0x7c')](_0xa402('0x91'),{'UserId':Number(_0x5a996b[_0xa402('0x3a')]['ids'][_0x27d943]),'VoiceQueueId':Number(_0x5a996b[_0xa402('0x4d')]['id'])});}}else{socket[_0xa402('0x7c')](_0xa402('0x91'),{'UserId':Number(_0x5a996b[_0xa402('0x3a')][_0xa402('0x8d')]),'VoiceQueueId':Number(_0x5a996b['params']['id'])});}});}})[_0xa402('0x22')](function(_0x40e5d8){return db[_0xa402('0x90')][_0xa402('0x2f')]({'where':{'VoiceQueueId':_0x5a996b[_0xa402('0x4d')]['id'],'UserId':_0x5a996b[_0xa402('0x3a')]['ids']}})['then'](function(){return _0x40e5d8;});})[_0xa402('0x22')](respondWithStatusCode(_0x596977,null))[_0xa402('0x4c')](handleError(_0x596977,null));};exports[_0xa402('0x94')]=function(_0x187732,_0x258f2a,_0x5d1b34){var _0x5df773={};var _0x239032={};var _0x488059;var _0x3f9a0c;return db[_0xa402('0x49')][_0xa402('0x5e')]({'where':{'id':_0x187732['params']['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x258f2a,null))[_0xa402('0x22')](function(_0x359a52){if(_0x359a52){_0x488059=_0x359a52;_0x239032[_0xa402('0x39')]=_[_0xa402('0x4e')](db[_0xa402('0x6a')][_0xa402('0x36')]);_0x239032[_0xa402('0x3a')]=_[_0xa402('0x4e')](_0x187732['query']);_0x239032[_0xa402('0x44')]=_[_0xa402('0x3b')](_0x239032['model'],_0x239032[_0xa402('0x3a')]);_0x5df773[_0xa402('0x3c')]=_[_0xa402('0x3b')](_0x239032[_0xa402('0x39')],qs['fields'](_0x187732[_0xa402('0x3a')]['fields']));_0x5df773[_0xa402('0x3c')]=_0x5df773['attributes'][_0xa402('0x3e')]?_0x5df773['attributes']:_0x239032['model'];_0x5df773['order']=qs['sort'](_0x187732[_0xa402('0x3a')][_0xa402('0x42')]);_0x5df773[_0xa402('0x45')]=qs[_0xa402('0x44')](_[_0xa402('0x43')](_0x187732[_0xa402('0x3a')],_0x239032[_0xa402('0x44')]));if(_0x187732['query'][_0xa402('0x28')]){_0x5df773[_0xa402('0x45')]=_[_0xa402('0x46')](_0x5df773['where'],{'$or':_[_0xa402('0x2a')](_0x5df773[_0xa402('0x3c')],function(_0xb04a61){var _0x2c0466={};_0x2c0466[_0xb04a61]={'$like':'%'+_0x187732[_0xa402('0x3a')][_0xa402('0x28')]+'%'};return _0x2c0466;})});}_0x5df773=_['merge']({},_0x5df773,_0x187732[_0xa402('0x48')]);return _0x488059[_0xa402('0x94')](_0x5df773);}})[_0xa402('0x22')](function(_0x5a6808){if(_0x5a6808){_0x3f9a0c=_0x5a6808['length'];if(!_0x187732['query'][_0xa402('0x3f')](_0xa402('0x40'))){_0x5df773[_0xa402('0x41')]=qs[_0xa402('0x41')](_0x187732[_0xa402('0x3a')][_0xa402('0x41')]);_0x5df773[_0xa402('0x1b')]=qs[_0xa402('0x1b')](_0x187732[_0xa402('0x3a')][_0xa402('0x1b')]);}return _0x488059[_0xa402('0x94')](_0x5df773);}})['then'](function(_0x5f09fc){if(_0x5f09fc){return _0x5f09fc?{'count':_0x3f9a0c,'rows':_0x5f09fc}:null;}})[_0xa402('0x22')](respondWithResult(_0x258f2a,null))[_0xa402('0x4c')](handleError(_0x258f2a,null));};exports['getMembers']=function(_0xf73026,_0x5f0c08,_0x19cfc1){var _0x30df3f={};var _0x35513f={};var _0x1fc1c5;var _0x1fedab;return db[_0xa402('0x49')][_0xa402('0x5e')]({'where':{'id':_0xf73026[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x5f0c08,null))[_0xa402('0x22')](function(_0x216874){if(_0x216874){_0x1fc1c5=_0x216874;_0x35513f['model']=_[_0xa402('0x4e')](db[_0xa402('0x90')][_0xa402('0x36')]);_0x35513f[_0xa402('0x3a')]=_[_0xa402('0x4e')](_0xf73026[_0xa402('0x3a')]);_0x35513f['filters']=_['intersection'](_0x35513f[_0xa402('0x39')],_0x35513f[_0xa402('0x3a')]);_0x30df3f[_0xa402('0x3c')]=_[_0xa402('0x3b')](_0x35513f[_0xa402('0x39')],qs[_0xa402('0x3d')](_0xf73026['query'][_0xa402('0x3d')]));_0x30df3f['attributes']=_0x30df3f[_0xa402('0x3c')][_0xa402('0x3e')]?_0x30df3f[_0xa402('0x3c')]:_0x35513f[_0xa402('0x39')];_0x30df3f['order']=qs[_0xa402('0x42')](_0xf73026[_0xa402('0x3a')]['sort']);_0x30df3f[_0xa402('0x45')]=qs[_0xa402('0x44')](_[_0xa402('0x43')](_0xf73026[_0xa402('0x3a')],_0x35513f[_0xa402('0x44')]));if(_0xf73026[_0xa402('0x3a')][_0xa402('0x28')]){_0x30df3f[_0xa402('0x45')]=_[_0xa402('0x46')](_0x30df3f['where'],{'$or':_[_0xa402('0x2a')](_0x30df3f[_0xa402('0x3c')],function(_0x1b1c70){var _0x23b32b={};_0x23b32b[_0x1b1c70]={'$like':'%'+_0xf73026[_0xa402('0x3a')][_0xa402('0x28')]+'%'};return _0x23b32b;})});}_0x30df3f=_[_0xa402('0x46')]({},_0x30df3f,_0xf73026[_0xa402('0x48')]);return _0x1fc1c5['getMembers'](_0x30df3f);}})[_0xa402('0x22')](function(_0x44d341){if(_0x44d341){_0x1fedab=_0x44d341[_0xa402('0x3e')];if(!_0xf73026[_0xa402('0x3a')][_0xa402('0x3f')](_0xa402('0x40'))){_0x30df3f[_0xa402('0x41')]=qs[_0xa402('0x41')](_0xf73026[_0xa402('0x3a')][_0xa402('0x41')]);_0x30df3f[_0xa402('0x1b')]=qs['offset'](_0xf73026['query']['offset']);}return _0x1fc1c5[_0xa402('0x95')](_0x30df3f);}})['then'](function(_0x1374f7){return _0x1374f7?{'count':_0x1fedab,'rows':_0x1374f7}:null;})['then'](respondWithResult(_0x5f0c08,null))[_0xa402('0x4c')](handleError(_0x5f0c08,null));};exports[_0xa402('0x96')]=function(_0x1378d5,_0x1b461a,_0x1c1b35){var _0x3a3ca3={};var _0x18804c={};var _0x136636;var _0x213085;return db[_0xa402('0x49')]['findOne']({'where':{'id':_0x1378d5[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x1b461a,null))['then'](function(_0x5ca8b4){if(_0x5ca8b4){_0x136636=_0x5ca8b4;_0x18804c[_0xa402('0x39')]=_[_0xa402('0x4e')](db[_0xa402('0x97')][_0xa402('0x36')]);_0x18804c[_0xa402('0x3a')]=_[_0xa402('0x4e')](_0x1378d5['query']);_0x18804c[_0xa402('0x44')]=_[_0xa402('0x3b')](_0x18804c['model'],_0x18804c['query']);_0x3a3ca3[_0xa402('0x3c')]=_['intersection'](_0x18804c[_0xa402('0x39')],qs[_0xa402('0x3d')](_0x1378d5[_0xa402('0x3a')]['fields']));_0x3a3ca3[_0xa402('0x3c')]=_0x3a3ca3[_0xa402('0x3c')][_0xa402('0x3e')]?_0x3a3ca3[_0xa402('0x3c')]:_0x18804c['model'];_0x3a3ca3[_0xa402('0x60')]=qs['sort'](_0x1378d5['query'][_0xa402('0x42')]);_0x3a3ca3[_0xa402('0x45')]=qs[_0xa402('0x44')](_[_0xa402('0x43')](_0x1378d5[_0xa402('0x3a')],_0x18804c['filters']));if(_0x1378d5[_0xa402('0x3a')][_0xa402('0x28')]){_0x3a3ca3[_0xa402('0x45')]=_[_0xa402('0x46')](_0x3a3ca3['where'],{'$or':_[_0xa402('0x2a')](_0x3a3ca3[_0xa402('0x3c')],function(_0x141e3a){var _0x13aecb={};_0x13aecb[_0x141e3a]={'$like':'%'+_0x1378d5['query'][_0xa402('0x28')]+'%'};return _0x13aecb;})});}_0x3a3ca3=_['merge']({},_0x3a3ca3,_0x1378d5[_0xa402('0x48')]);return _0x136636[_0xa402('0x96')](_0x3a3ca3);}})['then'](function(_0x3278e1){if(_0x3278e1){_0x213085=_0x3278e1['length'];if(!_0x1378d5[_0xa402('0x3a')][_0xa402('0x3f')](_0xa402('0x40'))){_0x3a3ca3['limit']=qs[_0xa402('0x41')](_0x1378d5[_0xa402('0x3a')]['limit']);_0x3a3ca3[_0xa402('0x1b')]=qs['offset'](_0x1378d5[_0xa402('0x3a')][_0xa402('0x1b')]);}return _0x136636[_0xa402('0x96')](_0x3a3ca3);}})[_0xa402('0x22')](function(_0x39ff6a){if(_0x39ff6a){return _0x39ff6a?{'count':_0x213085,'rows':_0x39ff6a}:null;}})['then'](respondWithResult(_0x1b461a,null))[_0xa402('0x4c')](handleError(_0x1b461a,null));};exports['addLists']=function(_0x550403,_0x2102f6,_0x1cabdf){var _0x1cbb16,_0x5a2079;return db[_0xa402('0x49')][_0xa402('0x2d')]({'where':{'id':_0x550403['params']['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x2102f6,null))['then'](function(_0x3fca89){if(_0x3fca89){_0x5a2079=_0x3fca89;return _0x3fca89[_0xa402('0x98')](_0x550403[_0xa402('0x52')]['ids'],_[_0xa402('0x5a')](_0x550403[_0xa402('0x52')],[_0xa402('0x8d'),'id'])||{});}return null;})[_0xa402('0x93')](function(_0x2bee8f){var _0xde9aac;_0x1cbb16=_0x2bee8f||[];var _0x5021d0=[];if(_0x2bee8f){for(var _0x1bef04=0x0;_0x1bef04<_0x2bee8f[_0xa402('0x3e')];_0x1bef04+=0x1){var _0x3f26dd=_0x2bee8f[_0x1bef04][_0xa402('0x23')]({'plain':!![]});_0x5a2079['dialCheckDuplicateType']=_0x550403[_0xa402('0x52')][_0xa402('0x99')]?_0x550403[_0xa402('0x52')][_0xa402('0x99')]:_0x5a2079[_0xa402('0x99')];switch(_0x5a2079[_0xa402('0x99')]){case _0xa402('0x9a'):_0xde9aac=squel[_0xa402('0x9b')]()[_0xa402('0x9c')]('cm_hopper')['fromQuery']([_0xa402('0x9d'),'scheduledAt',_0xa402('0x9e'),_0xa402('0x9f'),_0xa402('0x64'),_0xa402('0x5b'),_0xa402('0x5c')],squel[_0xa402('0x7e')]()[_0xa402('0xa0')](_0xa402('0x9d'),_0xa402('0x9d'))[_0xa402('0xa0')]('NOW()',_0xa402('0xa1'))[_0xa402('0xa0')]('id',_0xa402('0x9e'))[_0xa402('0xa0')](_0x3f26dd[_0xa402('0xa2')]['toString'](),_0xa402('0x9f'))[_0xa402('0xa0')](_0x550403[_0xa402('0x4d')]['id'][_0xa402('0x87')](),_0xa402('0x64'))[_0xa402('0xa0')](_0xa402('0xa3'),_0xa402('0x5b'))[_0xa402('0xa0')](_0xa402('0xa3'),_0xa402('0x5c'))[_0xa402('0x80')](_0xa402('0xa4'))[_0xa402('0x45')](_0xa402('0xa5'))[_0xa402('0x45')](_0xa402('0xa6'),_0x3f26dd[_0xa402('0xa2')]['toString']())[_0xa402('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0xa402('0x45')](_0xa402('0xa7'),squel[_0xa402('0x7e')]()['field'](_0xa402('0xa8'))[_0xa402('0x80')](_0xa402('0xa9'))[_0xa402('0x45')](_0xa402('0x84'),_0x550403[_0xa402('0x4d')]['id'][_0xa402('0x87')]()))[_0xa402('0x45')](_0xa402('0xa7'),squel[_0xa402('0x7e')]()[_0xa402('0xa0')]('COALESCE(phone,\x27\x27)')[_0xa402('0x80')]('cm_hopper')[_0xa402('0x45')](_0xa402('0x84'),_0x550403[_0xa402('0x4d')]['id'][_0xa402('0x87')]())))[_0xa402('0x87')]();break;case _0xa402('0xaa'):_0xde9aac=squel[_0xa402('0x9b')]()[_0xa402('0x9c')]('cm_hopper')[_0xa402('0xab')]([_0xa402('0x9d'),_0xa402('0xa1'),_0xa402('0x9e'),_0xa402('0x9f'),'VoiceQueueId','createdAt',_0xa402('0x5c')],squel[_0xa402('0x7e')]()[_0xa402('0xa0')](_0xa402('0x9d'),_0xa402('0x9d'))[_0xa402('0xa0')](_0xa402('0xa3'),_0xa402('0xa1'))[_0xa402('0xa0')]('id',_0xa402('0x9e'))[_0xa402('0xa0')](_0x3f26dd[_0xa402('0xa2')][_0xa402('0x87')](),_0xa402('0x9f'))[_0xa402('0xa0')](_0x550403[_0xa402('0x4d')]['id']['toString'](),_0xa402('0x64'))[_0xa402('0xa0')](_0xa402('0xa3'),_0xa402('0x5b'))[_0xa402('0xa0')](_0xa402('0xa3'),'updatedAt')[_0xa402('0x80')](_0xa402('0xa4'))[_0xa402('0x45')](_0xa402('0xa5'))[_0xa402('0x45')](_0xa402('0xa6'),_0x3f26dd[_0xa402('0xa2')][_0xa402('0x87')]())[_0xa402('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0xa402('0x45')](_0xa402('0xa7'),squel['select']()[_0xa402('0xa0')](_0xa402('0xac'))[_0xa402('0x80')]('cm_hopper')['where'](_0xa402('0x84'),_0x550403[_0xa402('0x4d')]['id'][_0xa402('0x87')]())))[_0xa402('0x87')]();break;default:_0xde9aac=squel[_0xa402('0x9b')]()[_0xa402('0x9c')]('cm_hopper')[_0xa402('0xab')](['phone',_0xa402('0xa1'),_0xa402('0x9e'),_0xa402('0x9f'),_0xa402('0x64'),_0xa402('0x5b'),_0xa402('0x5c')],squel['select']()['field'](_0xa402('0x9d'),_0xa402('0x9d'))[_0xa402('0xa0')](_0xa402('0xa3'),'scheduledAt')[_0xa402('0xa0')]('id',_0xa402('0x9e'))[_0xa402('0xa0')](_0x3f26dd['CmListId']['toString'](),_0xa402('0x9f'))[_0xa402('0xa0')](_0x550403[_0xa402('0x4d')]['id']['toString'](),_0xa402('0x64'))['field'](_0xa402('0xa3'),_0xa402('0x5b'))[_0xa402('0xa0')](_0xa402('0xa3'),_0xa402('0x5c'))[_0xa402('0x80')](_0xa402('0xa4'))[_0xa402('0x45')](_0xa402('0xa5'))[_0xa402('0x45')](_0xa402('0xa6'),_0x3f26dd[_0xa402('0xa2')][_0xa402('0x87')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x5021d0[_0xa402('0x86')](db[_0xa402('0x71')][_0xa402('0x3a')](_0xde9aac));}return BPromise[_0xa402('0x8b')](_0x5021d0);}})[_0xa402('0x22')](function(){return _0x1cbb16;})['then'](respondWithResult(_0x2102f6,null))[_0xa402('0x4c')](handleError(_0x2102f6,null));};exports[_0xa402('0xad')]=function(_0x43802e,_0x3e66db,_0x5a29b7){return db['VoiceQueue'][_0xa402('0x2d')]({'where':{'id':_0x43802e[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x3e66db,null))[_0xa402('0x22')](function(_0x347f88){if(_0x347f88){return _0x347f88['removeLists'](_0x43802e[_0xa402('0x3a')][_0xa402('0x8d')]);}})['then'](function(_0x113305){if(_0x113305){return db[_0xa402('0x5f')][_0xa402('0x2f')]({'where':{'ListId':_0x43802e[_0xa402('0x3a')][_0xa402('0x8d')],'VoiceQueueId':_0x43802e[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](function(){return _0x113305;});}})[_0xa402('0x22')](respondWithStatusCode(_0x3e66db,null))[_0xa402('0x4c')](handleError(_0x3e66db,null));};exports[_0xa402('0xae')]=function(_0xf3d7d8,_0x11737b,_0x4858d7){var _0x34df43={};var _0x2ae75a={};var _0x208108;var _0xec22be;return db[_0xa402('0x49')][_0xa402('0x5e')]({'where':{'id':_0xf3d7d8['params']['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x11737b,null))[_0xa402('0x22')](function(_0x5576f4){if(_0x5576f4){_0x208108=_0x5576f4;_0x2ae75a[_0xa402('0x39')]=_['keys'](db['CmList']['rawAttributes']);_0x2ae75a['query']=_[_0xa402('0x4e')](_0xf3d7d8[_0xa402('0x3a')]);_0x2ae75a['filters']=_[_0xa402('0x3b')](_0x2ae75a[_0xa402('0x39')],_0x2ae75a['query']);_0x34df43[_0xa402('0x3c')]=_['intersection'](_0x2ae75a[_0xa402('0x39')],qs[_0xa402('0x3d')](_0xf3d7d8[_0xa402('0x3a')][_0xa402('0x3d')]));_0x34df43['attributes']=_0x34df43[_0xa402('0x3c')]['length']?_0x34df43[_0xa402('0x3c')]:_0x2ae75a[_0xa402('0x39')];_0x34df43[_0xa402('0x60')]=qs[_0xa402('0x42')](_0xf3d7d8[_0xa402('0x3a')][_0xa402('0x42')]);_0x34df43[_0xa402('0x45')]=qs[_0xa402('0x44')](_[_0xa402('0x43')](_0xf3d7d8['query'],_0x2ae75a[_0xa402('0x44')]));if(_0xf3d7d8['query'][_0xa402('0x28')]){_0x34df43[_0xa402('0x45')]=_[_0xa402('0x46')](_0x34df43[_0xa402('0x45')],{'$or':_[_0xa402('0x2a')](_0x34df43[_0xa402('0x3c')],function(_0xaeaf2c){var _0x24966d={};_0x24966d[_0xaeaf2c]={'$like':'%'+_0xf3d7d8['query'][_0xa402('0x28')]+'%'};return _0x24966d;})});}_0x34df43=_[_0xa402('0x46')]({},_0x34df43,_0xf3d7d8[_0xa402('0x48')]);return _0x208108[_0xa402('0xae')](_0x34df43);}})[_0xa402('0x22')](function(_0x938add){if(_0x938add){_0xec22be=_0x938add[_0xa402('0x3e')];if(!_0xf3d7d8[_0xa402('0x3a')][_0xa402('0x3f')](_0xa402('0x40'))){_0x34df43[_0xa402('0x41')]=qs[_0xa402('0x41')](_0xf3d7d8[_0xa402('0x3a')][_0xa402('0x41')]);_0x34df43[_0xa402('0x1b')]=qs['offset'](_0xf3d7d8[_0xa402('0x3a')][_0xa402('0x1b')]);}return _0x208108[_0xa402('0xae')](_0x34df43);}})[_0xa402('0x22')](function(_0xe6e62a){if(_0xe6e62a){return _0xe6e62a?{'count':_0xec22be,'rows':_0xe6e62a}:null;}})['then'](respondWithResult(_0x11737b,null))['catch'](handleError(_0x11737b,null));};exports[_0xa402('0xaf')]=function(_0x3a2052,_0x46b08c,_0x4d85ac){var _0x30775c,_0x4aef16;return db['VoiceQueue'][_0xa402('0x2d')]({'where':{'id':_0x3a2052[_0xa402('0x4d')]['id']}})['then'](handleEntityNotFound(_0x46b08c,null))['then'](function(_0x279eb9){if(_0x279eb9){_0x4aef16=_0x279eb9;return _0x279eb9[_0xa402('0xaf')](_0x3a2052['body']['ids'],_['omit'](_0x3a2052[_0xa402('0x52')],['ids','id'])||{});}return null;})[_0xa402('0x93')](function(_0x2454e3){var _0x30537a;_0x30775c=_0x2454e3||[];var _0x32adac=[];if(_0x2454e3){for(var _0x3b727c=0x0;_0x3b727c<_0x2454e3['length'];_0x3b727c+=0x1){var _0x310a96=_0x2454e3[_0x3b727c][_0xa402('0x23')]({'plain':!![]});_0x30537a=squel[_0xa402('0x9b')]()['into'](_0xa402('0xb0'))[_0xa402('0xab')]([_0xa402('0x9d'),_0xa402('0x9e'),_0xa402('0x9f'),_0xa402('0x64'),_0xa402('0x5b'),_0xa402('0x5c')],squel['select']()[_0xa402('0xa0')](_0xa402('0x9d'),_0xa402('0x9d'))[_0xa402('0xa0')]('id',_0xa402('0x9e'))[_0xa402('0xa0')](_0x310a96['CmListId']['toString'](),_0xa402('0x9f'))[_0xa402('0xa0')](_0x3a2052[_0xa402('0x4d')]['id'][_0xa402('0x87')](),_0xa402('0x64'))[_0xa402('0xa0')](_0xa402('0xa3'),_0xa402('0x5b'))[_0xa402('0xa0')]('NOW()',_0xa402('0x5c'))['from']('cm_contacts')[_0xa402('0x45')](_0xa402('0xa5'))['where'](_0xa402('0xa6'),_0x310a96[_0xa402('0xa2')]['toString']())['where'](_0xa402('0xb1')))[_0xa402('0x87')]();_0x32adac[_0xa402('0x86')](db[_0xa402('0x71')][_0xa402('0x3a')](_0x30537a));}return BPromise['all'](_0x32adac);}})[_0xa402('0x22')](function(){return _0x30775c;})[_0xa402('0x22')](respondWithResult(_0x46b08c,null))[_0xa402('0x4c')](handleError(_0x46b08c,null));};exports['removeBlackLists']=function(_0x404944,_0x1cc8d4,_0x716f22){return db['VoiceQueue']['find']({'where':{'id':_0x404944[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x1cc8d4,null))['then'](function(_0x583c0b){if(_0x583c0b){return _0x583c0b[_0xa402('0xb2')](_0x404944[_0xa402('0x3a')][_0xa402('0x8d')]);}})[_0xa402('0x22')](function(_0x1b9804){if(_0x1b9804){return db[_0xa402('0x66')][_0xa402('0x2f')]({'where':{'ListId':_0x404944['query'][_0xa402('0x8d')],'VoiceQueueId':_0x404944[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](function(){return _0x1b9804;});}})[_0xa402('0x22')](respondWithStatusCode(_0x1cc8d4,null))['catch'](handleError(_0x1cc8d4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 4d18c96..fa6c767 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 _0xfcd4=['hook','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x53fa82,_0x257f92){var _0x29828c=function(_0x3db168){while(--_0x3db168){_0x53fa82['push'](_0x53fa82['shift']());}};_0x29828c(++_0x257f92);}(_0xfcd4,0xc5));var _0x4fcd=function(_0x18fd0b,_0xe0f9ed){_0x18fd0b=_0x18fd0b-0x0;var _0x3b19a3=_0xfcd4[_0x18fd0b];return _0x3b19a3;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x4fcd('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4fcd('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4fcd('0x2'),'afterDestroy':_0x4fcd('0x3')};function emitEvent(_0x16cded){return function(_0x1dd0ec,_0x20504d,_0x40d580){VoiceQueueEvents[_0x4fcd('0x4')](_0x16cded+':'+_0x1dd0ec['id'],_0x1dd0ec);VoiceQueueEvents['emit'](_0x16cded,_0x1dd0ec);_0x40d580(null);};}for(var e in events){if(events[_0x4fcd('0x5')](e)){var event=events[e];VoiceQueue[_0x4fcd('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xdfea=['save','remove','emit','hook','exports','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x1623a5,_0x5ca096){var _0x55b630=function(_0x112413){while(--_0x112413){_0x1623a5['push'](_0x1623a5['shift']());}};_0x55b630(++_0x5ca096);}(_0xdfea,0x125));var _0xadfe=function(_0x32ae87,_0x151b9e){_0x32ae87=_0x32ae87-0x0;var _0x1bc656=_0xdfea[_0x32ae87];return _0x1bc656;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xadfe('0x0'))['db'][_0xadfe('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xadfe('0x2')](0x0);var events={'afterCreate':_0xadfe('0x3'),'afterUpdate':'update','afterDestroy':_0xadfe('0x4')};function emitEvent(_0x36b025){return function(_0x1edc12,_0x280586,_0x560acd){VoiceQueueEvents[_0xadfe('0x5')](_0x36b025+':'+_0x1edc12['id'],_0x1edc12);VoiceQueueEvents[_0xadfe('0x5')](_0x36b025,_0x1edc12);_0x560acd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xadfe('0x6')](e,emitEvent(event));}}module[_0xadfe('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 26876ed..4a6f52d 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(_0x33a643,_0x46d924){var _0x3022b7=function(_0x24d1fa){while(--_0x24d1fa){_0x33a643['push'](_0x33a643['shift']());}};_0x3022b7(++_0x46d924);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x3c5924,_0x4d295f){var _0x576958=function(_0x4a3e2d){while(--_0x4a3e2d){_0x3c5924['push'](_0x3c5924['shift']());}};_0x576958(++_0x4d295f);}(_0x008c,0x188));var _0xc008=function(_0x3d7022,_0x59dfd5){_0x3d7022=_0x3d7022-0x0;var _0x40870b=_0x008c[_0x3d7022];return _0x40870b;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 37509a5..bb7c253 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 _0x3b1a=['client','http','redis','defaults','localhost','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowVoiceQueue','find','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3aaf69,_0x318ff9){var _0x4542c6=function(_0x5d1369){while(--_0x5d1369){_0x3aaf69['push'](_0x3aaf69['shift']());}};_0x4542c6(++_0x318ff9);}(_0x3b1a,0xbc));var _0xa3b1=function(_0xf4f343,_0x41fe4a){_0xf4f343=_0xf4f343-0x0;var _0x4cda68=_0x3b1a[_0xf4f343];return _0x4cda68;};'use strict';var _=require('lodash');var util=require(_0xa3b1('0x0'));var moment=require(_0xa3b1('0x1'));var BPromise=require(_0xa3b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa3b1('0x4'))('rpc');var config=require(_0xa3b1('0x5'));var jayson=require(_0xa3b1('0x6'));var client=jayson[_0xa3b1('0x7')][_0xa3b1('0x8')]({'port':0x232a});config[_0xa3b1('0x9')]=_[_0xa3b1('0xa')](config[_0xa3b1('0x9')],{'host':_0xa3b1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3b1('0x9')]));require(_0xa3b1('0xc'))[_0xa3b1('0xd')](socket);function respondWithRpcPromise(_0x436c0a,_0x5d7818,_0x24a4fc){return new BPromise(function(_0x2630db,_0x4679fb){return client[_0xa3b1('0xe')](_0x436c0a,_0x24a4fc)[_0xa3b1('0xf')](function(_0x524246){logger[_0xa3b1('0x10')](_0xa3b1('0x11'),_0x5d7818,_0xa3b1('0x12'));logger[_0xa3b1('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5d7818,_0xa3b1('0x12'),JSON['stringify'](_0x524246));if(_0x524246[_0xa3b1('0x14')]){if(_0x524246['error'][_0xa3b1('0x15')]===0x1f4){logger[_0xa3b1('0x14')](_0xa3b1('0x11'),_0x5d7818,_0x524246[_0xa3b1('0x14')][_0xa3b1('0x16')]);return _0x4679fb(_0x524246[_0xa3b1('0x14')][_0xa3b1('0x16')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x5d7818,_0x524246[_0xa3b1('0x14')][_0xa3b1('0x16')]);return _0x2630db(_0x524246[_0xa3b1('0x14')]['message']);}else{logger[_0xa3b1('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x5d7818,_0xa3b1('0x12'));_0x2630db(_0x524246[_0xa3b1('0x17')][_0xa3b1('0x16')]);}})[_0xa3b1('0x18')](function(_0x2b708e){logger[_0xa3b1('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x5d7818,_0x2b708e);_0x4679fb(_0x2b708e);});});}exports[_0xa3b1('0x19')]=function(_0x14f411){var _0x1afa95=this;return new Promise(function(_0x1f2c25,_0x353aa7){return db[_0xa3b1('0x1a')][_0xa3b1('0x1b')]({'raw':_0x14f411[_0xa3b1('0x1c')]?_0x14f411[_0xa3b1('0x1c')][_0xa3b1('0x1d')]===undefined?!![]:![]:!![],'where':_0x14f411['options']?_0x14f411['options'][_0xa3b1('0x1e')]||null:null,'attributes':_0x14f411['options']?_0x14f411[_0xa3b1('0x1c')]['attributes']||null:null,'limit':_0x14f411[_0xa3b1('0x1c')]?_0x14f411[_0xa3b1('0x1c')][_0xa3b1('0x1f')]||null:null,'include':_0x14f411['options']?_0x14f411[_0xa3b1('0x1c')][_0xa3b1('0x20')]?_[_0xa3b1('0x21')](_0x14f411[_0xa3b1('0x1c')][_0xa3b1('0x20')],function(_0x235960){return{'model':db[_0x235960[_0xa3b1('0x22')]],'as':_0x235960['as'],'attributes':_0x235960[_0xa3b1('0x23')],'include':_0x235960[_0xa3b1('0x20')]?_['map'](_0x235960[_0xa3b1('0x20')],function(_0x366df1){return{'model':db[_0x366df1[_0xa3b1('0x22')]],'as':_0x366df1['as'],'attributes':_0x366df1['attributes'],'include':_0x366df1[_0xa3b1('0x20')]?_[_0xa3b1('0x21')](_0x366df1[_0xa3b1('0x20')],function(_0x11f04f){return{'model':db[_0x11f04f['model']],'as':_0x11f04f['as'],'attributes':_0x11f04f[_0xa3b1('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa3b1('0xf')](function(_0x36f581){logger['info']('GetVoiceQueue',_0x14f411);logger['debug'](_0xa3b1('0x19'),_0x14f411,JSON[_0xa3b1('0x24')](_0x36f581));_0x1f2c25(_0x36f581);})[_0xa3b1('0x18')](function(_0x2f9985){logger[_0xa3b1('0x14')](_0xa3b1('0x19'),_0x2f9985[_0xa3b1('0x16')],_0x14f411);_0x353aa7(_0x1afa95[_0xa3b1('0x14')](0x1f4,_0x2f9985['message']));});});};exports[_0xa3b1('0x25')]=function(_0x2b3d78){var _0x187984=this;return new Promise(function(_0x48cb29,_0x11ba5d){return db[_0xa3b1('0x1a')][_0xa3b1('0x26')]({'raw':_0x2b3d78[_0xa3b1('0x1c')]?_0x2b3d78[_0xa3b1('0x1c')][_0xa3b1('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b3d78[_0xa3b1('0x1c')]?_0x2b3d78[_0xa3b1('0x1c')]['where']||null:null,'attributes':_0x2b3d78[_0xa3b1('0x1c')]?_0x2b3d78['options'][_0xa3b1('0x23')]||null:null,'include':_0x2b3d78[_0xa3b1('0x1c')]?_0x2b3d78['options']['include']?_['map'](_0x2b3d78[_0xa3b1('0x1c')][_0xa3b1('0x20')],function(_0x205056){return{'model':db[_0x205056[_0xa3b1('0x22')]],'as':_0x205056['as'],'attributes':_0x205056[_0xa3b1('0x23')],'include':_0x205056[_0xa3b1('0x20')]?_[_0xa3b1('0x21')](_0x205056['include'],function(_0x16123f){return{'model':db[_0x16123f['model']],'as':_0x16123f['as'],'attributes':_0x16123f[_0xa3b1('0x23')],'include':_0x16123f[_0xa3b1('0x20')]?_[_0xa3b1('0x21')](_0x16123f[_0xa3b1('0x20')],function(_0x262a2c){return{'model':db[_0x262a2c[_0xa3b1('0x22')]],'as':_0x262a2c['as'],'attributes':_0x262a2c['attributes']};}):[]};}):[]};}):[]:[]})[_0xa3b1('0xf')](function(_0x1035a9){logger[_0xa3b1('0x10')](_0xa3b1('0x25'),_0x2b3d78);logger[_0xa3b1('0x13')](_0xa3b1('0x25'),_0x2b3d78,JSON[_0xa3b1('0x24')](_0x1035a9));_0x48cb29(_0x1035a9);})[_0xa3b1('0x18')](function(_0x2f2368){logger['error']('ShowVoiceQueue',_0x2f2368[_0xa3b1('0x16')],_0x2b3d78);_0x11ba5d(_0x187984[_0xa3b1('0x14')](0x1f4,_0x2f2368[_0xa3b1('0x16')]));});});}; \ No newline at end of file +var _0x1c64=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','raw','options','where','attributes','limit','include','map','model','GetVoiceQueue','catch','ShowVoiceQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x500a89,_0x1d65c6){var _0x2432fd=function(_0x1d496e){while(--_0x1d496e){_0x500a89['push'](_0x500a89['shift']());}};_0x2432fd(++_0x1d65c6);}(_0x1c64,0x1e9));var _0x41c6=function(_0x50fd4b,_0x145fb2){_0x50fd4b=_0x50fd4b-0x0;var _0x11658a=_0x1c64[_0x50fd4b];return _0x11658a;};'use strict';var _=require(_0x41c6('0x0'));var util=require('util');var moment=require(_0x41c6('0x1'));var BPromise=require(_0x41c6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41c6('0x3'));var db=require(_0x41c6('0x4'))['db'];var utils=require(_0x41c6('0x5'));var logger=require(_0x41c6('0x6'))(_0x41c6('0x7'));var config=require(_0x41c6('0x8'));var jayson=require(_0x41c6('0x9'));var client=jayson[_0x41c6('0xa')]['http']({'port':0x232a});config['redis']=_[_0x41c6('0xb')](config[_0x41c6('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x41c6('0xd'))(new Redis(config['redis']));require(_0x41c6('0xe'))[_0x41c6('0xf')](socket);function respondWithRpcPromise(_0x19a0c7,_0x552c30,_0x5d59ab){return new BPromise(function(_0x4323df,_0x44fc08){return client[_0x41c6('0x10')](_0x19a0c7,_0x5d59ab)[_0x41c6('0x11')](function(_0x536735){logger[_0x41c6('0x12')](_0x41c6('0x13'),_0x552c30,_0x41c6('0x14'));logger[_0x41c6('0x15')](_0x41c6('0x16'),_0x552c30,_0x41c6('0x14'),JSON[_0x41c6('0x17')](_0x536735));if(_0x536735[_0x41c6('0x18')]){if(_0x536735['error']['code']===0x1f4){logger[_0x41c6('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x552c30,_0x536735[_0x41c6('0x18')][_0x41c6('0x19')]);return _0x44fc08(_0x536735[_0x41c6('0x18')][_0x41c6('0x19')]);}logger[_0x41c6('0x18')](_0x41c6('0x13'),_0x552c30,_0x536735['error'][_0x41c6('0x19')]);return _0x4323df(_0x536735[_0x41c6('0x18')]['message']);}else{logger[_0x41c6('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x552c30,_0x41c6('0x14'));_0x4323df(_0x536735['result'][_0x41c6('0x19')]);}})['catch'](function(_0x3b4efa){logger[_0x41c6('0x18')](_0x41c6('0x13'),_0x552c30,_0x3b4efa);_0x44fc08(_0x3b4efa);});});}exports['GetVoiceQueue']=function(_0x252046){var _0x1d60b4=this;return new Promise(function(_0x5387a1,_0x5b84ce){return db['VoiceQueue']['findAll']({'raw':_0x252046['options']?_0x252046['options'][_0x41c6('0x1a')]===undefined?!![]:![]:!![],'where':_0x252046[_0x41c6('0x1b')]?_0x252046[_0x41c6('0x1b')][_0x41c6('0x1c')]||null:null,'attributes':_0x252046[_0x41c6('0x1b')]?_0x252046['options'][_0x41c6('0x1d')]||null:null,'limit':_0x252046[_0x41c6('0x1b')]?_0x252046['options'][_0x41c6('0x1e')]||null:null,'include':_0x252046[_0x41c6('0x1b')]?_0x252046[_0x41c6('0x1b')][_0x41c6('0x1f')]?_[_0x41c6('0x20')](_0x252046['options'][_0x41c6('0x1f')],function(_0x227116){return{'model':db[_0x227116['model']],'as':_0x227116['as'],'attributes':_0x227116['attributes'],'include':_0x227116[_0x41c6('0x1f')]?_['map'](_0x227116[_0x41c6('0x1f')],function(_0x33fef4){return{'model':db[_0x33fef4[_0x41c6('0x21')]],'as':_0x33fef4['as'],'attributes':_0x33fef4['attributes'],'include':_0x33fef4[_0x41c6('0x1f')]?_[_0x41c6('0x20')](_0x33fef4['include'],function(_0x5e5be0){return{'model':db[_0x5e5be0['model']],'as':_0x5e5be0['as'],'attributes':_0x5e5be0['attributes']};}):[]};}):[]};}):[]:[]})[_0x41c6('0x11')](function(_0x10873e){logger[_0x41c6('0x12')](_0x41c6('0x22'),_0x252046);logger[_0x41c6('0x15')](_0x41c6('0x22'),_0x252046,JSON[_0x41c6('0x17')](_0x10873e));_0x5387a1(_0x10873e);})[_0x41c6('0x23')](function(_0x54169f){logger[_0x41c6('0x18')](_0x41c6('0x22'),_0x54169f['message'],_0x252046);_0x5b84ce(_0x1d60b4[_0x41c6('0x18')](0x1f4,_0x54169f[_0x41c6('0x19')]));});});};exports[_0x41c6('0x24')]=function(_0x3eb638){var _0x33eba5=this;return new Promise(function(_0x49a487,_0x4187a4){return db['VoiceQueue'][_0x41c6('0x25')]({'raw':_0x3eb638['options']?_0x3eb638['options']['raw']===undefined?!![]:![]:!![],'where':_0x3eb638['options']?_0x3eb638[_0x41c6('0x1b')][_0x41c6('0x1c')]||null:null,'attributes':_0x3eb638[_0x41c6('0x1b')]?_0x3eb638[_0x41c6('0x1b')][_0x41c6('0x1d')]||null:null,'include':_0x3eb638[_0x41c6('0x1b')]?_0x3eb638[_0x41c6('0x1b')]['include']?_['map'](_0x3eb638['options'][_0x41c6('0x1f')],function(_0x432f7d){return{'model':db[_0x432f7d[_0x41c6('0x21')]],'as':_0x432f7d['as'],'attributes':_0x432f7d[_0x41c6('0x1d')],'include':_0x432f7d[_0x41c6('0x1f')]?_[_0x41c6('0x20')](_0x432f7d[_0x41c6('0x1f')],function(_0x2ec636){return{'model':db[_0x2ec636['model']],'as':_0x2ec636['as'],'attributes':_0x2ec636[_0x41c6('0x1d')],'include':_0x2ec636[_0x41c6('0x1f')]?_['map'](_0x2ec636[_0x41c6('0x1f')],function(_0x13de45){return{'model':db[_0x13de45[_0x41c6('0x21')]],'as':_0x13de45['as'],'attributes':_0x13de45['attributes']};}):[]};}):[]};}):[]:[]})[_0x41c6('0x11')](function(_0x6b71b8){logger['info']('ShowVoiceQueue',_0x3eb638);logger['debug'](_0x41c6('0x24'),_0x3eb638,JSON['stringify'](_0x6b71b8));_0x49a487(_0x6b71b8);})['catch'](function(_0x22f557){logger[_0x41c6('0x18')]('ShowVoiceQueue',_0x22f557['message'],_0x3eb638);_0x4187a4(_0x33eba5[_0x41c6('0x18')](0x1f4,_0x22f557['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index bd9831a..bced351 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 _0x9d54=['remove','update','length','voiceQueue:','./voiceQueue.events'];(function(_0x4afd78,_0x58992b){var _0x2a552d=function(_0x43676f){while(--_0x43676f){_0x4afd78['push'](_0x4afd78['shift']());}};_0x2a552d(++_0x58992b);}(_0x9d54,0x1e9));var _0x49d5=function(_0xe3e427,_0x55bf82){_0xe3e427=_0xe3e427-0x0;var _0x49b5fd=_0x9d54[_0xe3e427];return _0x49b5fd;};'use strict';var VoiceQueueEvents=require(_0x49d5('0x0'));var events=['save',_0x49d5('0x1'),_0x49d5('0x2')];function createListener(_0xf5c3d,_0x2eed77){return function(_0x5ae01e){_0x2eed77['emit'](_0xf5c3d,_0x5ae01e);};}function removeListener(_0x3dd90f,_0x10db9c){return function(){VoiceQueueEvents['removeListener'](_0x3dd90f,_0x10db9c);};}exports['register']=function(_0x276cc2){for(var _0x3ba81e=0x0,_0x1a5aa0=events[_0x49d5('0x3')];_0x3ba81e<_0x1a5aa0;_0x3ba81e++){var _0x238dfd=events[_0x3ba81e];var _0x3cb839=createListener(_0x49d5('0x4')+_0x238dfd,_0x276cc2);VoiceQueueEvents['on'](_0x238dfd,_0x3cb839);}}; \ No newline at end of file +var _0xb1e6=['remove','emit','removeListener'];(function(_0x19babd,_0x1d4ef7){var _0x314eaf=function(_0x24ea35){while(--_0x24ea35){_0x19babd['push'](_0x19babd['shift']());}};_0x314eaf(++_0x1d4ef7);}(_0xb1e6,0xea));var _0x6b1e=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0xb1e6[_0x40aaa4];return _0x4e21e5;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0x6b1e('0x0'),'update'];function createListener(_0x2bddab,_0x160e35){return function(_0x21cc5d){_0x160e35[_0x6b1e('0x1')](_0x2bddab,_0x21cc5d);};}function removeListener(_0x48ec6d,_0x2b16ee){return function(){VoiceQueueEvents[_0x6b1e('0x2')](_0x48ec6d,_0x2b16ee);};}exports['register']=function(_0x417274){for(var _0x54fcfc=0x0,_0x2f8041=events['length'];_0x54fcfc<_0x2f8041;_0x54fcfc++){var _0x56447c=events[_0x54fcfc];var _0x3d1fac=createListener('voiceQueue:'+_0x56447c,_0x417274);VoiceQueueEvents['on'](_0x56447c,_0x3d1fac);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index e5a296c..f170050 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 _0xedce=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0x55af86,_0x5c8ff6){var _0x58df3b=function(_0x2ddd94){while(--_0x2ddd94){_0x55af86['push'](_0x55af86['shift']());}};_0x58df3b(++_0x5c8ff6);}(_0xedce,0x10d));var _0xeedc=function(_0x339fef,_0x4b15e3){_0x339fef=_0x339fef-0x0;var _0x7036b=_0xedce[_0x339fef];return _0x7036b;};'use strict';var multer=require(_0xeedc('0x0'));var util=require(_0xeedc('0x1'));var path=require(_0xeedc('0x2'));var timeout=require(_0xeedc('0x3'));var express=require(_0xeedc('0x4'));var router=express[_0xeedc('0x5')]();var fs_extra=require(_0xeedc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xeedc('0x7'));var config=require(_0xeedc('0x8'));var controller=require(_0xeedc('0x9'));router[_0xeedc('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xeedc('0xa')](_0xeedc('0xb'),auth[_0xeedc('0xc')](),controller[_0xeedc('0xd')]);router[_0xeedc('0xa')]('/index',auth[_0xeedc('0xc')](),controller['getVoiceQueuesReport']);router['get'](_0xeedc('0xe'),auth[_0xeedc('0xc')](),controller[_0xeedc('0xf')]);router[_0xeedc('0x10')]('/',auth[_0xeedc('0xc')](),controller[_0xeedc('0x11')]);router[_0xeedc('0x12')]('/:id',auth[_0xeedc('0xc')](),controller['update']);router['delete'](_0xeedc('0xe'),auth[_0xeedc('0xc')](),controller[_0xeedc('0x13')]);module[_0xeedc('0x14')]=router; \ No newline at end of file +var _0x8125=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','describe','/index','getVoiceQueuesReport','show','post','create'];(function(_0x281cf1,_0x4ec5d5){var _0x29fa78=function(_0x50a151){while(--_0x50a151){_0x281cf1['push'](_0x281cf1['shift']());}};_0x29fa78(++_0x4ec5d5);}(_0x8125,0x17c));var _0x5812=function(_0x220f99,_0x2baaf7){_0x220f99=_0x220f99-0x0;var _0x377fa6=_0x8125[_0x220f99];return _0x377fa6;};'use strict';var multer=require(_0x5812('0x0'));var util=require(_0x5812('0x1'));var path=require(_0x5812('0x2'));var timeout=require(_0x5812('0x3'));var express=require(_0x5812('0x4'));var router=express[_0x5812('0x5')]();var fs_extra=require(_0x5812('0x6'));var auth=require(_0x5812('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5812('0x8'));var controller=require(_0x5812('0x9'));router['get']('/',auth[_0x5812('0xa')](),controller[_0x5812('0xb')]);router[_0x5812('0xc')](_0x5812('0xd'),auth[_0x5812('0xa')](),controller[_0x5812('0xe')]);router['get'](_0x5812('0xf'),auth[_0x5812('0xa')](),controller[_0x5812('0x10')]);router[_0x5812('0xc')]('/:id',auth[_0x5812('0xa')](),controller[_0x5812('0x11')]);router[_0x5812('0x12')]('/',auth[_0x5812('0xa')](),controller[_0x5812('0x13')]);router['put'](_0x5812('0x14'),auth['isAuthenticated'](),controller[_0x5812('0x15')]);router[_0x5812('0x16')]('/:id',auth[_0x5812('0xa')](),controller[_0x5812('0x17')]);module[_0x5812('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index bdbdaa7..91f1cc0 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 _0x8192=['DATE','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','getDataValue','queuecallerjoinAt','diff','setDataValue','queuecallerleaveAt','holdtime','INTEGER'];(function(_0x56d526,_0x15beac){var _0x1e6e72=function(_0x401de5){while(--_0x401de5){_0x56d526['push'](_0x56d526['shift']());}};_0x1e6e72(++_0x15beac);}(_0x8192,0x7c));var _0x2819=function(_0x56f2c9,_0x15a637){_0x56f2c9=_0x56f2c9-0x0;var _0x3557d4=_0x8192[_0x56f2c9];return _0x3557d4;};'use strict';var Sequelize=require(_0x2819('0x0'));var moment=require(_0x2819('0x1'));module[_0x2819('0x2')]={'type':{'type':Sequelize[_0x2819('0x3')]},'uniqueid':{'type':Sequelize[_0x2819('0x3')]},'calleridnum':{'type':Sequelize[_0x2819('0x3')]},'calleridname':{'type':Sequelize[_0x2819('0x3')]},'queue':{'type':Sequelize[_0x2819('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x1d293f){var _0x14a49b=moment(_0x1d293f);var _0x43bf9d=moment(this[_0x2819('0x4')](_0x2819('0x5')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x1b89f3=_0x14a49b[_0x2819('0x6')](_0x43bf9d,'seconds');this[_0x2819('0x7')](_0x2819('0x8'),_0x1d293f);this['setDataValue'](_0x2819('0x9'),_0x1b89f3||null);}},'position':{'type':Sequelize[_0x2819('0xa')]},'count':{'type':Sequelize[_0x2819('0xa')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2819('0xb')]},'queuecallercomplete':{'type':Sequelize[_0x2819('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2819('0xb')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x2819('0xb')]},'queuecallerexitreason':{'type':Sequelize[_0x2819('0x3')],'comment':_0x2819('0xd')},'originalposition':{'type':Sequelize[_0x2819('0xa')]},'channel':{'type':Sequelize[_0x2819('0x3')]},'connectedlinenum':{'type':Sequelize[_0x2819('0x3')]},'connectedlinename':{'type':Sequelize[_0x2819('0x3')]},'accountcode':{'type':Sequelize[_0x2819('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x2819('0x3')]},'priority':{'type':Sequelize[_0x2819('0x3')]},'holdtime':{'type':Sequelize[_0x2819('0xa')]},'mohtime':{'type':Sequelize[_0x2819('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2819('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x2819('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x2819('0xe')},'transferexten':{'type':Sequelize[_0x2819('0x3')]},'transferuniqueid':{'type':Sequelize[_0x2819('0x3')]},'disposition':{'type':Sequelize[_0x2819('0x3')]},'secondDisposition':{'type':Sequelize[_0x2819('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2819('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x2819('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2acd=['moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','setDataValue','queuecallerleaveAt','holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2acd,0xaf));var _0xd2ac=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x2acd[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0xd2ac('0x0'));var moment=require(_0xd2ac('0x1'));module[_0xd2ac('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd2ac('0x3')]},'calleridname':{'type':Sequelize[_0xd2ac('0x3')]},'queue':{'type':Sequelize[_0xd2ac('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xd2ac('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xd2ac('0x4')],'set':function(_0x1b2e5b){var _0x13294d=moment(_0x1b2e5b);var _0x578e4b=moment(this[_0xd2ac('0x5')](_0xd2ac('0x6')))[_0xd2ac('0x7')](_0xd2ac('0x8'));var _0x3cff58=_0x13294d['diff'](_0x578e4b,'seconds');this[_0xd2ac('0x9')](_0xd2ac('0xa'),_0x1b2e5b);this[_0xd2ac('0x9')](_0xd2ac('0xb'),_0x3cff58||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xd2ac('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xd2ac('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xd2ac('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xd2ac('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xd2ac('0x3')],'comment':_0xd2ac('0xd')},'originalposition':{'type':Sequelize[_0xd2ac('0xe')]},'channel':{'type':Sequelize[_0xd2ac('0x3')]},'connectedlinenum':{'type':Sequelize[_0xd2ac('0x3')]},'connectedlinename':{'type':Sequelize[_0xd2ac('0x3')]},'accountcode':{'type':Sequelize[_0xd2ac('0x3')]},'context':{'type':Sequelize[_0xd2ac('0x3')]},'exten':{'type':Sequelize[_0xd2ac('0x3')]},'priority':{'type':Sequelize[_0xd2ac('0x3')]},'holdtime':{'type':Sequelize[_0xd2ac('0xe')]},'mohtime':{'type':Sequelize[_0xd2ac('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd2ac('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xd2ac('0x3')]},'transfer':{'type':Sequelize[_0xd2ac('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xd2ac('0xf')},'transferexten':{'type':Sequelize[_0xd2ac('0x3')]},'transferuniqueid':{'type':Sequelize[_0xd2ac('0x3')]},'disposition':{'type':Sequelize[_0xd2ac('0x3')]},'secondDisposition':{'type':Sequelize[_0xd2ac('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd2ac('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 0c9954f..ee08a46 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 _0x0832=['zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./voiceQueueReport.socket','status','json','undefined','limit','count','offset','set','save','then','destroy','end','sendStatus','error','stack','name','VoiceQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','sort','pick','filter','map','VIRTUAL','merge','findAll','rows','catch','show','params','fields','length','includeAll','include','options','find','create','body','update','describe','getVoiceQueuesReport','nolimit','order','where','eml-format','rimraf'];(function(_0x35e77f,_0x54b076){var _0x1e6628=function(_0x51eba8){while(--_0x51eba8){_0x35e77f['push'](_0x35e77f['shift']());}};_0x1e6628(++_0x54b076);}(_0x0832,0x1ea));var _0x2083=function(_0x2f900b,_0xc1b13a){_0x2f900b=_0x2f900b-0x0;var _0x33a82e=_0x0832[_0x2f900b];return _0x33a82e;};'use strict';var emlformat=require(_0x2083('0x0'));var rimraf=require(_0x2083('0x1'));var zipdir=require(_0x2083('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2083('0x3'));var moment=require('moment');var BPromise=require(_0x2083('0x4'));var Mustache=require(_0x2083('0x5'));var util=require(_0x2083('0x6'));var path=require(_0x2083('0x7'));var sox=require(_0x2083('0x8'));var csv=require(_0x2083('0x9'));var ejs=require(_0x2083('0xa'));var fs=require('fs');var fs_extra=require(_0x2083('0xb'));var _=require(_0x2083('0xc'));var squel=require(_0x2083('0xd'));var crypto=require(_0x2083('0xe'));var jsforce=require(_0x2083('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2083('0x9'));var querystring=require(_0x2083('0x10'));var Papa=require(_0x2083('0x11'));var Redis=require('ioredis');var authService=require(_0x2083('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2083('0x13'));var hardwareService=require(_0x2083('0x14'));var logger=require(_0x2083('0x15'))(_0x2083('0x16'));var utils=require('../../config/utils');var config=require(_0x2083('0x17'));var licenseUtil=require(_0x2083('0x18'));var db=require(_0x2083('0x19'))['db'];config['redis']=_[_0x2083('0x1a')](config['redis'],{'host':_0x2083('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2083('0x1c')]));require(_0x2083('0x1d'))['register'](socket);function respondWithStatusCode(_0x321504,_0xaa1bb3){_0xaa1bb3=_0xaa1bb3||0xcc;return function(_0x49af41){if(_0x49af41){return _0x321504['sendStatus'](_0xaa1bb3);}return _0x321504[_0x2083('0x1e')](_0xaa1bb3)['end']();};}function respondWithResult(_0x45200f,_0x7fed45){_0x7fed45=_0x7fed45||0xc8;return function(_0x502ea1){if(_0x502ea1){return _0x45200f[_0x2083('0x1e')](_0x7fed45)[_0x2083('0x1f')](_0x502ea1);}};}function respondWithFilteredResult(_0x91292f,_0x44694f){return function(_0x232035){if(_0x232035){var _0x3e42ec=typeof _0x44694f['offset']===_0x2083('0x20')&&typeof _0x44694f[_0x2083('0x21')]==='undefined';var _0x4d749a=_0x232035[_0x2083('0x22')];var _0xdd9c9e=_0x3e42ec?0x0:_0x44694f[_0x2083('0x23')];var _0x497c72=_0x3e42ec?_0x232035[_0x2083('0x22')]:_0x44694f[_0x2083('0x23')]+_0x44694f[_0x2083('0x21')];var _0x52518b;if(_0x497c72>=_0x4d749a){_0x497c72=_0x4d749a;_0x52518b=0xc8;}else{_0x52518b=0xce;}_0x91292f[_0x2083('0x1e')](_0x52518b);return _0x91292f[_0x2083('0x24')]('Content-Range',_0xdd9c9e+'-'+_0x497c72+'/'+_0x4d749a)[_0x2083('0x1f')](_0x232035);}return null;};}function patchUpdates(_0x442c03){return function(_0x2c72db){try{jsonpatch['apply'](_0x2c72db,_0x442c03,!![]);}catch(_0x3bc982){return BPromise['reject'](_0x3bc982);}return _0x2c72db[_0x2083('0x25')]();};}function saveUpdates(_0x12f9ca,_0xa24b5b){return function(_0x3e1014){if(_0x3e1014){return _0x3e1014['update'](_0x12f9ca)[_0x2083('0x26')](function(_0x1e0dae){return _0x1e0dae;});}return null;};}function removeEntity(_0x2881ab,_0x13e48d){return function(_0x3681d0){if(_0x3681d0){return _0x3681d0[_0x2083('0x27')]()[_0x2083('0x26')](function(){_0x2881ab[_0x2083('0x1e')](0xcc)[_0x2083('0x28')]();});}};}function handleEntityNotFound(_0x3898e7,_0x3c50e6){return function(_0x442ca2){if(!_0x442ca2){_0x3898e7[_0x2083('0x29')](0x194);}return _0x442ca2;};}function handleError(_0x562b55,_0x2e9e13){_0x2e9e13=_0x2e9e13||0x1f4;return function(_0x2a5d53){logger[_0x2083('0x2a')](_0x2a5d53[_0x2083('0x2b')]);if(_0x2a5d53[_0x2083('0x2c')]){delete _0x2a5d53['name'];}_0x562b55[_0x2083('0x1e')](_0x2e9e13)['send'](_0x2a5d53);};}exports['index']=function(_0x21a229,_0x2350ba){var _0xd6e4a7={},_0x27fdda={},_0xa2f80e={'count':0x0,'rows':[]};var _0x3a7f9f=_['map'](db[_0x2083('0x2d')][_0x2083('0x2e')],function(_0x416788){return{'name':_0x416788[_0x2083('0x2f')],'type':_0x416788[_0x2083('0x30')][_0x2083('0x31')]};});_0x27fdda['model']=_['map'](_0x3a7f9f,_0x2083('0x2c'));_0x27fdda[_0x2083('0x32')]=_[_0x2083('0x33')](_0x21a229[_0x2083('0x32')]);_0x27fdda[_0x2083('0x34')]=_[_0x2083('0x35')](_0x27fdda[_0x2083('0x36')],_0x27fdda['query']);_0xd6e4a7['attributes']=_[_0x2083('0x35')](_0x27fdda[_0x2083('0x36')],qs['fields'](_0x21a229[_0x2083('0x32')]['fields']));_0xd6e4a7[_0x2083('0x37')]=_0xd6e4a7[_0x2083('0x37')]['length']?_0xd6e4a7[_0x2083('0x37')]:_0x27fdda[_0x2083('0x36')];if(!_0x21a229[_0x2083('0x32')][_0x2083('0x38')]('nolimit')){_0xd6e4a7[_0x2083('0x21')]=qs[_0x2083('0x21')](_0x21a229[_0x2083('0x32')][_0x2083('0x21')]);_0xd6e4a7['offset']=qs['offset'](_0x21a229[_0x2083('0x32')][_0x2083('0x23')]);}_0xd6e4a7['order']=qs[_0x2083('0x39')](_0x21a229[_0x2083('0x32')]['sort']);_0xd6e4a7['where']=qs['filters'](_[_0x2083('0x3a')](_0x21a229[_0x2083('0x32')],_0x27fdda[_0x2083('0x34')]),_0x3a7f9f);if(_0x21a229[_0x2083('0x32')][_0x2083('0x3b')]){_0xd6e4a7['where']=_['merge'](_0xd6e4a7['where'],{'$or':_[_0x2083('0x3c')](_0x3a7f9f,function(_0x23fe5f){if(_0x23fe5f[_0x2083('0x30')]!==_0x2083('0x3d')){var _0x28d5b1={};_0x28d5b1[_0x23fe5f[_0x2083('0x2c')]]={'$like':'%'+_0x21a229[_0x2083('0x32')][_0x2083('0x3b')]+'%'};return _0x28d5b1;}})});}_0xd6e4a7=_[_0x2083('0x3e')]({},_0xd6e4a7,_0x21a229['options']);var _0x46695e={'where':_0xd6e4a7['where']};return db[_0x2083('0x2d')][_0x2083('0x22')](_0x46695e)['then'](function(_0x3ba55d){_0xa2f80e[_0x2083('0x22')]=_0x3ba55d;if(_0x21a229[_0x2083('0x32')]['includeAll']){_0xd6e4a7['include']=[{'all':!![]}];}return db[_0x2083('0x2d')][_0x2083('0x3f')](_0xd6e4a7);})[_0x2083('0x26')](function(_0x45b15d){_0xa2f80e[_0x2083('0x40')]=_0x45b15d;return _0xa2f80e;})[_0x2083('0x26')](respondWithFilteredResult(_0x2350ba,_0xd6e4a7))[_0x2083('0x41')](handleError(_0x2350ba,null));};exports[_0x2083('0x42')]=function(_0x5dc427,_0x462290){var _0x59c591={'raw':![],'where':{'id':_0x5dc427[_0x2083('0x43')]['id']}},_0x22a4e3={};_0x22a4e3['model']=_[_0x2083('0x33')](db[_0x2083('0x2d')][_0x2083('0x2e')]);_0x22a4e3['query']=_['keys'](_0x5dc427[_0x2083('0x32')]);_0x22a4e3[_0x2083('0x34')]=_[_0x2083('0x35')](_0x22a4e3[_0x2083('0x36')],_0x22a4e3['query']);_0x59c591[_0x2083('0x37')]=_[_0x2083('0x35')](_0x22a4e3[_0x2083('0x36')],qs[_0x2083('0x44')](_0x5dc427['query'][_0x2083('0x44')]));_0x59c591[_0x2083('0x37')]=_0x59c591[_0x2083('0x37')][_0x2083('0x45')]?_0x59c591[_0x2083('0x37')]:_0x22a4e3['model'];if(_0x5dc427[_0x2083('0x32')][_0x2083('0x46')]){_0x59c591[_0x2083('0x47')]=[{'all':!![]}];}_0x59c591=_[_0x2083('0x3e')]({},_0x59c591,_0x5dc427[_0x2083('0x48')]);return db[_0x2083('0x2d')][_0x2083('0x49')](_0x59c591)[_0x2083('0x26')](handleEntityNotFound(_0x462290,null))[_0x2083('0x26')](respondWithResult(_0x462290,null))[_0x2083('0x41')](handleError(_0x462290,null));};exports['create']=function(_0x4332a9,_0x1b5b61){return db[_0x2083('0x2d')][_0x2083('0x4a')](_0x4332a9[_0x2083('0x4b')],{})[_0x2083('0x26')](respondWithResult(_0x1b5b61,0xc9))['catch'](handleError(_0x1b5b61,null));};exports[_0x2083('0x4c')]=function(_0x24a57d,_0xaad1cb){if(_0x24a57d['body']['id']){delete _0x24a57d[_0x2083('0x4b')]['id'];}return db[_0x2083('0x2d')][_0x2083('0x49')]({'where':{'id':_0x24a57d[_0x2083('0x43')]['id']}})[_0x2083('0x26')](handleEntityNotFound(_0xaad1cb,null))['then'](saveUpdates(_0x24a57d[_0x2083('0x4b')],null))[_0x2083('0x26')](respondWithResult(_0xaad1cb,null))['catch'](handleError(_0xaad1cb,null));};exports[_0x2083('0x27')]=function(_0x4546e5,_0x3a7881){return db[_0x2083('0x2d')][_0x2083('0x49')]({'where':{'id':_0x4546e5[_0x2083('0x43')]['id']}})[_0x2083('0x26')](handleEntityNotFound(_0x3a7881,null))['then'](removeEntity(_0x3a7881,null))[_0x2083('0x41')](handleError(_0x3a7881,null));};exports[_0x2083('0x4d')]=function(_0x34ca3a,_0x3949c5){return db[_0x2083('0x2d')][_0x2083('0x4d')]()['then'](respondWithResult(_0x3949c5,null))[_0x2083('0x41')](handleError(_0x3949c5,null));};exports[_0x2083('0x4e')]=function(_0x23831e,_0x555143){var _0x3a739c={},_0x5a0d42={},_0x4ca197={'count':0x0,'rows':[]};_0x5a0d42[_0x2083('0x36')]=_[_0x2083('0x33')](db['VoiceQueueReport'][_0x2083('0x2e')]);_0x5a0d42[_0x2083('0x32')]=_['keys'](_0x23831e[_0x2083('0x32')]);_0x5a0d42[_0x2083('0x34')]=_[_0x2083('0x35')](_0x5a0d42[_0x2083('0x36')],_0x5a0d42[_0x2083('0x32')]);_0x3a739c['attributes']=_[_0x2083('0x35')](_0x5a0d42['model'],qs[_0x2083('0x44')](_0x23831e[_0x2083('0x32')][_0x2083('0x44')]));_0x3a739c[_0x2083('0x37')]=_0x3a739c[_0x2083('0x37')]['length']?_0x3a739c['attributes']:_0x5a0d42[_0x2083('0x36')];if(!_0x23831e[_0x2083('0x32')][_0x2083('0x38')](_0x2083('0x4f'))){_0x3a739c[_0x2083('0x21')]=qs[_0x2083('0x21')](_0x23831e[_0x2083('0x32')][_0x2083('0x21')]);_0x3a739c['offset']=qs['offset'](_0x23831e[_0x2083('0x32')][_0x2083('0x23')]);}_0x3a739c[_0x2083('0x50')]=qs['sort'](_0x23831e[_0x2083('0x32')][_0x2083('0x39')]);_0x3a739c[_0x2083('0x51')]=qs[_0x2083('0x34')](_['pick'](_0x23831e['query'],_0x5a0d42['filters']));if(_0x23831e['query'][_0x2083('0x3b')]){_0x3a739c[_0x2083('0x51')]=_['merge'](_0x3a739c[_0x2083('0x51')],{'$or':_[_0x2083('0x3c')](_0x3a739c[_0x2083('0x37')],function(_0x1a4148){var _0x5391a7={};_0x5391a7[_0x1a4148]={'$like':'%'+_0x23831e['query'][_0x2083('0x3b')]+'%'};return _0x5391a7;})});}_0x3a739c=_['merge']({},_0x3a739c,_0x23831e['options']);var _0x1a90eb={'where':_0x3a739c[_0x2083('0x51')]};return db[_0x2083('0x2d')][_0x2083('0x22')](_0x1a90eb)[_0x2083('0x26')](function(_0xb74ed7){_0x4ca197[_0x2083('0x22')]=_0xb74ed7;if(_0x23831e[_0x2083('0x32')][_0x2083('0x46')]){_0x3a739c[_0x2083('0x47')]=[{'all':!![]}];}return db[_0x2083('0x2d')]['findAll'](_0x3a739c);})[_0x2083('0x26')](function(_0x463f0b){_0x4ca197[_0x2083('0x40')]=_0x463f0b;return _0x4ca197;})[_0x2083('0x26')](respondWithFilteredResult(_0x555143,_0x3a739c,_0x2083('0x4e')))[_0x2083('0x41')](handleError(_0x555143,null,_0x2083('0x4e')));}; \ No newline at end of file +var _0x2e44=['hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceQueueReport','findAll','rows','catch','show','params','keys','find','body','describe','order','getVoiceQueuesReport','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','stack','name','index','map','rawAttributes','type','key','query','intersection','model','fields','attributes','length'];(function(_0x45f111,_0x3a1a4a){var _0x483508=function(_0x3131ab){while(--_0x3131ab){_0x45f111['push'](_0x45f111['shift']());}};_0x483508(++_0x3a1a4a);}(_0x2e44,0x1a8));var _0x42e4=function(_0x442214,_0x3a869f){_0x442214=_0x442214-0x0;var _0x2bddf9=_0x2e44[_0x442214];return _0x2bddf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x42e4('0x0'));var zipdir=require(_0x42e4('0x1'));var jsonpatch=require(_0x42e4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x42e4('0x3'));var util=require(_0x42e4('0x4'));var path=require(_0x42e4('0x5'));var sox=require(_0x42e4('0x6'));var csv=require(_0x42e4('0x7'));var ejs=require(_0x42e4('0x8'));var fs=require('fs');var fs_extra=require(_0x42e4('0x9'));var _=require(_0x42e4('0xa'));var squel=require(_0x42e4('0xb'));var crypto=require(_0x42e4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x42e4('0xd'));var toCsv=require(_0x42e4('0x7'));var querystring=require(_0x42e4('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x42e4('0xf'));var qs=require(_0x42e4('0x10'));var as=require(_0x42e4('0x11'));var hardwareService=require(_0x42e4('0x12'));var logger=require(_0x42e4('0x13'))(_0x42e4('0x14'));var utils=require(_0x42e4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x42e4('0x16'));var db=require(_0x42e4('0x17'))['db'];config[_0x42e4('0x18')]=_[_0x42e4('0x19')](config[_0x42e4('0x18')],{'host':_0x42e4('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42e4('0x18')]));require(_0x42e4('0x1b'))[_0x42e4('0x1c')](socket);function respondWithStatusCode(_0x6ea8fd,_0x1968bf){_0x1968bf=_0x1968bf||0xcc;return function(_0x156fcb){if(_0x156fcb){return _0x6ea8fd[_0x42e4('0x1d')](_0x1968bf);}return _0x6ea8fd[_0x42e4('0x1e')](_0x1968bf)['end']();};}function respondWithResult(_0x4dbb3e,_0x1cd491){_0x1cd491=_0x1cd491||0xc8;return function(_0x3bba4c){if(_0x3bba4c){return _0x4dbb3e[_0x42e4('0x1e')](_0x1cd491)[_0x42e4('0x1f')](_0x3bba4c);}};}function respondWithFilteredResult(_0x57a621,_0x4ec341){return function(_0x5d7d3d){if(_0x5d7d3d){var _0x5d5f7d=typeof _0x4ec341[_0x42e4('0x20')]===_0x42e4('0x21')&&typeof _0x4ec341[_0x42e4('0x22')]===_0x42e4('0x21');var _0x1b19f1=_0x5d7d3d[_0x42e4('0x23')];var _0x2df9fc=_0x5d5f7d?0x0:_0x4ec341['offset'];var _0x1849ba=_0x5d5f7d?_0x5d7d3d[_0x42e4('0x23')]:_0x4ec341[_0x42e4('0x20')]+_0x4ec341[_0x42e4('0x22')];var _0x1ac263;if(_0x1849ba>=_0x1b19f1){_0x1849ba=_0x1b19f1;_0x1ac263=0xc8;}else{_0x1ac263=0xce;}_0x57a621['status'](_0x1ac263);return _0x57a621[_0x42e4('0x24')]('Content-Range',_0x2df9fc+'-'+_0x1849ba+'/'+_0x1b19f1)[_0x42e4('0x1f')](_0x5d7d3d);}return null;};}function patchUpdates(_0x1e226a){return function(_0x441890){try{jsonpatch['apply'](_0x441890,_0x1e226a,!![]);}catch(_0x19420d){return BPromise[_0x42e4('0x25')](_0x19420d);}return _0x441890[_0x42e4('0x26')]();};}function saveUpdates(_0x358a5b,_0x176ec1){return function(_0x53ec43){if(_0x53ec43){return _0x53ec43[_0x42e4('0x27')](_0x358a5b)[_0x42e4('0x28')](function(_0x449643){return _0x449643;});}return null;};}function removeEntity(_0x3cfeec,_0xb5354b){return function(_0x4ac1ab){if(_0x4ac1ab){return _0x4ac1ab[_0x42e4('0x29')]()[_0x42e4('0x28')](function(){_0x3cfeec['status'](0xcc)[_0x42e4('0x2a')]();});}};}function handleEntityNotFound(_0x1556ca,_0x382516){return function(_0x157d5a){if(!_0x157d5a){_0x1556ca[_0x42e4('0x1d')](0x194);}return _0x157d5a;};}function handleError(_0x30677f,_0x540434){_0x540434=_0x540434||0x1f4;return function(_0x35bc9b){logger['error'](_0x35bc9b[_0x42e4('0x2b')]);if(_0x35bc9b[_0x42e4('0x2c')]){delete _0x35bc9b['name'];}_0x30677f[_0x42e4('0x1e')](_0x540434)['send'](_0x35bc9b);};}exports[_0x42e4('0x2d')]=function(_0x5cd940,_0x2d1a75){var _0x1dc463={},_0x4240e4={},_0x114264={'count':0x0,'rows':[]};var _0x745e6a=_[_0x42e4('0x2e')](db['VoiceQueueReport'][_0x42e4('0x2f')],function(_0x3d79ae){return{'name':_0x3d79ae['fieldName'],'type':_0x3d79ae[_0x42e4('0x30')][_0x42e4('0x31')]};});_0x4240e4['model']=_[_0x42e4('0x2e')](_0x745e6a,'name');_0x4240e4[_0x42e4('0x32')]=_['keys'](_0x5cd940[_0x42e4('0x32')]);_0x4240e4['filters']=_[_0x42e4('0x33')](_0x4240e4[_0x42e4('0x34')],_0x4240e4[_0x42e4('0x32')]);_0x1dc463['attributes']=_[_0x42e4('0x33')](_0x4240e4[_0x42e4('0x34')],qs[_0x42e4('0x35')](_0x5cd940[_0x42e4('0x32')][_0x42e4('0x35')]));_0x1dc463['attributes']=_0x1dc463[_0x42e4('0x36')][_0x42e4('0x37')]?_0x1dc463[_0x42e4('0x36')]:_0x4240e4[_0x42e4('0x34')];if(!_0x5cd940[_0x42e4('0x32')][_0x42e4('0x38')](_0x42e4('0x39'))){_0x1dc463[_0x42e4('0x22')]=qs[_0x42e4('0x22')](_0x5cd940[_0x42e4('0x32')][_0x42e4('0x22')]);_0x1dc463[_0x42e4('0x20')]=qs['offset'](_0x5cd940[_0x42e4('0x32')][_0x42e4('0x20')]);}_0x1dc463['order']=qs['sort'](_0x5cd940[_0x42e4('0x32')][_0x42e4('0x3a')]);_0x1dc463[_0x42e4('0x3b')]=qs[_0x42e4('0x3c')](_[_0x42e4('0x3d')](_0x5cd940[_0x42e4('0x32')],_0x4240e4['filters']),_0x745e6a);if(_0x5cd940[_0x42e4('0x32')][_0x42e4('0x3e')]){_0x1dc463['where']=_[_0x42e4('0x3f')](_0x1dc463['where'],{'$or':_['map'](_0x745e6a,function(_0x341481){if(_0x341481['type']!==_0x42e4('0x40')){var _0x3a7af8={};_0x3a7af8[_0x341481[_0x42e4('0x2c')]]={'$like':'%'+_0x5cd940['query'][_0x42e4('0x3e')]+'%'};return _0x3a7af8;}})});}_0x1dc463=_[_0x42e4('0x3f')]({},_0x1dc463,_0x5cd940[_0x42e4('0x41')]);var _0x71c630={'where':_0x1dc463[_0x42e4('0x3b')]};return db['VoiceQueueReport']['count'](_0x71c630)[_0x42e4('0x28')](function(_0x22dd4b){_0x114264[_0x42e4('0x23')]=_0x22dd4b;if(_0x5cd940[_0x42e4('0x32')][_0x42e4('0x42')]){_0x1dc463[_0x42e4('0x43')]=[{'all':!![]}];}return db[_0x42e4('0x44')][_0x42e4('0x45')](_0x1dc463);})[_0x42e4('0x28')](function(_0x4c78c3){_0x114264[_0x42e4('0x46')]=_0x4c78c3;return _0x114264;})['then'](respondWithFilteredResult(_0x2d1a75,_0x1dc463))[_0x42e4('0x47')](handleError(_0x2d1a75,null));};exports[_0x42e4('0x48')]=function(_0x38f453,_0x5f255b){var _0x386e42={'raw':![],'where':{'id':_0x38f453[_0x42e4('0x49')]['id']}},_0x17d9af={};_0x17d9af['model']=_[_0x42e4('0x4a')](db[_0x42e4('0x44')][_0x42e4('0x2f')]);_0x17d9af[_0x42e4('0x32')]=_['keys'](_0x38f453['query']);_0x17d9af[_0x42e4('0x3c')]=_[_0x42e4('0x33')](_0x17d9af[_0x42e4('0x34')],_0x17d9af['query']);_0x386e42[_0x42e4('0x36')]=_[_0x42e4('0x33')](_0x17d9af[_0x42e4('0x34')],qs[_0x42e4('0x35')](_0x38f453[_0x42e4('0x32')][_0x42e4('0x35')]));_0x386e42['attributes']=_0x386e42[_0x42e4('0x36')]['length']?_0x386e42[_0x42e4('0x36')]:_0x17d9af[_0x42e4('0x34')];if(_0x38f453[_0x42e4('0x32')][_0x42e4('0x42')]){_0x386e42[_0x42e4('0x43')]=[{'all':!![]}];}_0x386e42=_[_0x42e4('0x3f')]({},_0x386e42,_0x38f453[_0x42e4('0x41')]);return db['VoiceQueueReport'][_0x42e4('0x4b')](_0x386e42)[_0x42e4('0x28')](handleEntityNotFound(_0x5f255b,null))[_0x42e4('0x28')](respondWithResult(_0x5f255b,null))[_0x42e4('0x47')](handleError(_0x5f255b,null));};exports['create']=function(_0x307a6d,_0xd83657){return db[_0x42e4('0x44')]['create'](_0x307a6d[_0x42e4('0x4c')],{})[_0x42e4('0x28')](respondWithResult(_0xd83657,0xc9))['catch'](handleError(_0xd83657,null));};exports[_0x42e4('0x27')]=function(_0x13c91f,_0x5d1879){if(_0x13c91f[_0x42e4('0x4c')]['id']){delete _0x13c91f['body']['id'];}return db[_0x42e4('0x44')]['find']({'where':{'id':_0x13c91f[_0x42e4('0x49')]['id']}})[_0x42e4('0x28')](handleEntityNotFound(_0x5d1879,null))[_0x42e4('0x28')](saveUpdates(_0x13c91f[_0x42e4('0x4c')],null))[_0x42e4('0x28')](respondWithResult(_0x5d1879,null))[_0x42e4('0x47')](handleError(_0x5d1879,null));};exports[_0x42e4('0x29')]=function(_0x5ce8bd,_0x26a516){return db['VoiceQueueReport']['find']({'where':{'id':_0x5ce8bd['params']['id']}})['then'](handleEntityNotFound(_0x26a516,null))['then'](removeEntity(_0x26a516,null))[_0x42e4('0x47')](handleError(_0x26a516,null));};exports[_0x42e4('0x4d')]=function(_0x2f0aa1,_0x277979){return db[_0x42e4('0x44')][_0x42e4('0x4d')]()[_0x42e4('0x28')](respondWithResult(_0x277979,null))[_0x42e4('0x47')](handleError(_0x277979,null));};exports['getVoiceQueuesReport']=function(_0x32c505,_0x1cf278){var _0x723916={},_0x14715e={},_0x4753f9={'count':0x0,'rows':[]};_0x14715e[_0x42e4('0x34')]=_[_0x42e4('0x4a')](db[_0x42e4('0x44')][_0x42e4('0x2f')]);_0x14715e[_0x42e4('0x32')]=_[_0x42e4('0x4a')](_0x32c505[_0x42e4('0x32')]);_0x14715e[_0x42e4('0x3c')]=_['intersection'](_0x14715e[_0x42e4('0x34')],_0x14715e[_0x42e4('0x32')]);_0x723916['attributes']=_[_0x42e4('0x33')](_0x14715e[_0x42e4('0x34')],qs[_0x42e4('0x35')](_0x32c505[_0x42e4('0x32')]['fields']));_0x723916[_0x42e4('0x36')]=_0x723916['attributes'][_0x42e4('0x37')]?_0x723916[_0x42e4('0x36')]:_0x14715e['model'];if(!_0x32c505[_0x42e4('0x32')][_0x42e4('0x38')](_0x42e4('0x39'))){_0x723916[_0x42e4('0x22')]=qs[_0x42e4('0x22')](_0x32c505[_0x42e4('0x32')][_0x42e4('0x22')]);_0x723916[_0x42e4('0x20')]=qs[_0x42e4('0x20')](_0x32c505[_0x42e4('0x32')][_0x42e4('0x20')]);}_0x723916[_0x42e4('0x4e')]=qs[_0x42e4('0x3a')](_0x32c505['query'][_0x42e4('0x3a')]);_0x723916[_0x42e4('0x3b')]=qs[_0x42e4('0x3c')](_[_0x42e4('0x3d')](_0x32c505[_0x42e4('0x32')],_0x14715e[_0x42e4('0x3c')]));if(_0x32c505[_0x42e4('0x32')][_0x42e4('0x3e')]){_0x723916[_0x42e4('0x3b')]=_['merge'](_0x723916[_0x42e4('0x3b')],{'$or':_[_0x42e4('0x2e')](_0x723916[_0x42e4('0x36')],function(_0x1b3498){var _0x578423={};_0x578423[_0x1b3498]={'$like':'%'+_0x32c505[_0x42e4('0x32')][_0x42e4('0x3e')]+'%'};return _0x578423;})});}_0x723916=_[_0x42e4('0x3f')]({},_0x723916,_0x32c505[_0x42e4('0x41')]);var _0x22537a={'where':_0x723916[_0x42e4('0x3b')]};return db[_0x42e4('0x44')]['count'](_0x22537a)[_0x42e4('0x28')](function(_0x24b28b){_0x4753f9[_0x42e4('0x23')]=_0x24b28b;if(_0x32c505[_0x42e4('0x32')][_0x42e4('0x42')]){_0x723916[_0x42e4('0x43')]=[{'all':!![]}];}return db[_0x42e4('0x44')][_0x42e4('0x45')](_0x723916);})[_0x42e4('0x28')](function(_0x13a3e3){_0x4753f9[_0x42e4('0x46')]=_0x13a3e3;return _0x4753f9;})[_0x42e4('0x28')](respondWithFilteredResult(_0x1cf278,_0x723916,'getVoiceQueuesReport'))['catch'](handleError(_0x1cf278,null,_0x42e4('0x4f')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index d001502..f1dc9ab 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 _0xdea5=['emit','hook','exports','events','VoiceQueueReport','setMaxListeners','save','update'];(function(_0x130ced,_0x2f1655){var _0x44d512=function(_0xb29565){while(--_0xb29565){_0x130ced['push'](_0x130ced['shift']());}};_0x44d512(++_0x2f1655);}(_0xdea5,0xb3));var _0x5dea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdea5[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x5dea('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x5dea('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x5dea('0x2')](0x0);var events={'afterCreate':_0x5dea('0x3'),'afterUpdate':_0x5dea('0x4'),'afterDestroy':'remove'};function emitEvent(_0x20b220){return function(_0xe40064,_0x5f2488,_0x18ad2b){VoiceQueueReportEvents[_0x5dea('0x5')](_0x20b220+':'+_0xe40064['id'],_0xe40064);VoiceQueueReportEvents[_0x5dea('0x5')](_0x20b220,_0xe40064);_0x18ad2b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x5dea('0x6')](e,emitEvent(event));}}module[_0x5dea('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xf1ea=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','update','remove','emit'];(function(_0x15c536,_0x45dbca){var _0x514730=function(_0x357e90){while(--_0x357e90){_0x15c536['push'](_0x15c536['shift']());}};_0x514730(++_0x45dbca);}(_0xf1ea,0x16b));var _0xaf1e=function(_0x1aca38,_0x47f6bc){_0x1aca38=_0x1aca38-0x0;var _0x2d0648=_0xf1ea[_0x1aca38];return _0x2d0648;};'use strict';var EventEmitter=require(_0xaf1e('0x0'));var VoiceQueueReport=require(_0xaf1e('0x1'))['db'][_0xaf1e('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xaf1e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaf1e('0x4'),'afterDestroy':_0xaf1e('0x5')};function emitEvent(_0xd2a04d){return function(_0x286877,_0x1f405b,_0x7443b){VoiceQueueReportEvents[_0xaf1e('0x6')](_0xd2a04d+':'+_0x286877['id'],_0x286877);VoiceQueueReportEvents['emit'](_0xd2a04d,_0x286877);_0x7443b(null);};}for(var e in events){if(events[_0xaf1e('0x7')](e)){var event=events[e];VoiceQueueReport[_0xaf1e('0x8')](e,emitEvent(event));}}module[_0xaf1e('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 9f5e391..48f36bb 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 _0xc3ac=['moment','bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x3d5cde,_0x1509c4){var _0x1e6aa4=function(_0x5799de){while(--_0x5799de){_0x3d5cde['push'](_0x3d5cde['shift']());}};_0x1e6aa4(++_0x1509c4);}(_0xc3ac,0x1de));var _0xcc3a=function(_0x20db9f,_0x1f21d7){_0x20db9f=_0x20db9f-0x0;var _0x2e7448=_0xc3ac[_0x20db9f];return _0x2e7448;};'use strict';var _=require(_0xcc3a('0x0'));var util=require(_0xcc3a('0x1'));var logger=require(_0xcc3a('0x2'))('api');var moment=require(_0xcc3a('0x3'));var BPromise=require(_0xcc3a('0x4'));var rp=require(_0xcc3a('0x5'));var fs=require('fs');var path=require(_0xcc3a('0x6'));var rimraf=require('rimraf');var config=require(_0xcc3a('0x7'));var attributes=require(_0xcc3a('0x8'));module['exports']=function(_0x1706c8,_0x12e38d){return _0x1706c8[_0xcc3a('0x9')](_0xcc3a('0xa'),attributes,{'tableName':_0xcc3a('0xb'),'paranoid':![],'indexes':[{'fields':[_0xcc3a('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4061=['api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid','calleridnum','util'];(function(_0x5507b3,_0x1d90dd){var _0x1167c8=function(_0xa5a0ab){while(--_0xa5a0ab){_0x5507b3['push'](_0x5507b3['shift']());}};_0x1167c8(++_0x1d90dd);}(_0x4061,0x11d));var _0x1406=function(_0x480a28,_0x4d827a){_0x480a28=_0x480a28-0x0;var _0x4434cc=_0x4061[_0x480a28];return _0x4434cc;};'use strict';var _=require('lodash');var util=require(_0x1406('0x0'));var logger=require('../../config/logger')(_0x1406('0x1'));var moment=require(_0x1406('0x2'));var BPromise=require(_0x1406('0x3'));var rp=require(_0x1406('0x4'));var fs=require('fs');var path=require(_0x1406('0x5'));var rimraf=require('rimraf');var config=require(_0x1406('0x6'));var attributes=require(_0x1406('0x7'));module[_0x1406('0x8')]=function(_0x51662d,_0x28e380){return _0x51662d[_0x1406('0x9')](_0x1406('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x1406('0xb')]},{'fields':[_0x1406('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 544b33a..5a2c4a7 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 _0x5d52=['stringify','error','code','message','info','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','map','include','model','then','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','limit','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','request','VoiceQueueReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x35fa3f,_0x500d59){var _0x158869=function(_0x2a249c){while(--_0x2a249c){_0x35fa3f['push'](_0x35fa3f['shift']());}};_0x158869(++_0x500d59);}(_0x5d52,0x120));var _0x25d5=function(_0x5694cd,_0x2fefe4){_0x5694cd=_0x5694cd-0x0;var _0x5235d6=_0x5d52[_0x5694cd];return _0x5235d6;};'use strict';var _=require(_0x25d5('0x0'));var util=require('util');var moment=require(_0x25d5('0x1'));var BPromise=require(_0x25d5('0x2'));var rs=require(_0x25d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x25d5('0x4'));var logger=require(_0x25d5('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25d5('0x6')][_0x25d5('0x7')]({'port':0x232a});config[_0x25d5('0x8')]=_[_0x25d5('0x9')](config[_0x25d5('0x8')],{'host':_0x25d5('0xa'),'port':0x18eb});var socket=require(_0x25d5('0xb'))(new Redis(config[_0x25d5('0x8')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x25dd31,_0x252e0b,_0x335b28){return new BPromise(function(_0x560f57,_0x38f709){return client[_0x25d5('0xc')](_0x25dd31,_0x335b28)['then'](function(_0x5a6cf9){logger['info'](_0x25d5('0xd'),_0x252e0b,'request\x20sent');logger[_0x25d5('0xe')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x252e0b,_0x25d5('0xf'),JSON[_0x25d5('0x10')](_0x5a6cf9));if(_0x5a6cf9['error']){if(_0x5a6cf9[_0x25d5('0x11')][_0x25d5('0x12')]===0x1f4){logger[_0x25d5('0x11')](_0x25d5('0xd'),_0x252e0b,_0x5a6cf9['error'][_0x25d5('0x13')]);return _0x38f709(_0x5a6cf9[_0x25d5('0x11')][_0x25d5('0x13')]);}logger[_0x25d5('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x252e0b,_0x5a6cf9['error'][_0x25d5('0x13')]);return _0x560f57(_0x5a6cf9[_0x25d5('0x11')][_0x25d5('0x13')]);}else{logger[_0x25d5('0x14')](_0x25d5('0xd'),_0x252e0b,_0x25d5('0xf'));_0x560f57(_0x5a6cf9['result'][_0x25d5('0x13')]);}})[_0x25d5('0x15')](function(_0x3c39fa){logger[_0x25d5('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x252e0b,_0x3c39fa);_0x38f709(_0x3c39fa);});});}exports[_0x25d5('0x16')]=function(_0x27f6a9){var _0x2c91a3=this;return new Promise(function(_0x475f62,_0x2b3c45){return db[_0x25d5('0x17')][_0x25d5('0x18')]({'raw':_0x27f6a9[_0x25d5('0x19')]?_0x27f6a9[_0x25d5('0x19')][_0x25d5('0x1a')]===undefined?!![]:![]:!![],'where':_0x27f6a9[_0x25d5('0x19')]?_0x27f6a9[_0x25d5('0x19')][_0x25d5('0x1b')]||null:null,'attributes':_0x27f6a9[_0x25d5('0x19')]?_0x27f6a9[_0x25d5('0x19')][_0x25d5('0x1c')]||null:null,'limit':_0x27f6a9[_0x25d5('0x19')]?_0x27f6a9[_0x25d5('0x19')]['limit']||null:null,'include':_0x27f6a9[_0x25d5('0x19')]?_0x27f6a9[_0x25d5('0x19')]['include']?_[_0x25d5('0x1d')](_0x27f6a9[_0x25d5('0x19')][_0x25d5('0x1e')],function(_0xdb11f1){return{'model':db[_0xdb11f1[_0x25d5('0x1f')]],'as':_0xdb11f1['as'],'attributes':_0xdb11f1[_0x25d5('0x1c')],'include':_0xdb11f1['include']?_[_0x25d5('0x1d')](_0xdb11f1['include'],function(_0x2e9644){return{'model':db[_0x2e9644[_0x25d5('0x1f')]],'as':_0x2e9644['as'],'attributes':_0x2e9644[_0x25d5('0x1c')],'include':_0x2e9644[_0x25d5('0x1e')]?_[_0x25d5('0x1d')](_0x2e9644[_0x25d5('0x1e')],function(_0x79c389){return{'model':db[_0x79c389[_0x25d5('0x1f')]],'as':_0x79c389['as'],'attributes':_0x79c389['attributes']};}):[]};}):[]};}):[]:[]})[_0x25d5('0x20')](function(_0x124b77){logger[_0x25d5('0x14')](_0x25d5('0x16'),_0x27f6a9);logger[_0x25d5('0xe')](_0x25d5('0x16'),_0x27f6a9,JSON[_0x25d5('0x10')](_0x124b77));_0x475f62(_0x124b77);})[_0x25d5('0x15')](function(_0x4ff4d9){logger['error'](_0x25d5('0x16'),_0x4ff4d9['message'],_0x27f6a9);_0x2b3c45(_0x2c91a3['error'](0x1f4,_0x4ff4d9[_0x25d5('0x13')]));});});};exports[_0x25d5('0x21')]=function(_0x1279f9){var _0x13088a=this;return new Promise(function(_0x9cfe66,_0x46efc8){return db[_0x25d5('0x17')]['create'](_0x1279f9[_0x25d5('0x22')],{'raw':_0x1279f9[_0x25d5('0x19')]?_0x1279f9['options'][_0x25d5('0x1a')]===undefined?!![]:![]:!![]})[_0x25d5('0x20')](function(_0x2303c9){logger['info'](_0x25d5('0x21'),_0x1279f9);logger['debug'](_0x25d5('0x21'),_0x1279f9,JSON[_0x25d5('0x10')](_0x2303c9));_0x9cfe66(_0x2303c9);})[_0x25d5('0x15')](function(_0x86757d){logger[_0x25d5('0x11')]('CreateVoiceQueueReport',_0x86757d[_0x25d5('0x13')],_0x1279f9);_0x46efc8(_0x13088a[_0x25d5('0x11')](0x1f4,_0x86757d[_0x25d5('0x13')]));});});};exports[_0x25d5('0x23')]=function(_0x2c1140){var _0x45c9b3=this;return new Promise(function(_0x22f741,_0x53fc27){return db[_0x25d5('0x17')][_0x25d5('0x24')](_0x2c1140[_0x25d5('0x22')],{'raw':_0x2c1140[_0x25d5('0x19')]?_0x2c1140[_0x25d5('0x19')][_0x25d5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c1140[_0x25d5('0x19')]?_0x2c1140[_0x25d5('0x19')]['where']||null:null,'attributes':_0x2c1140[_0x25d5('0x19')]?_0x2c1140[_0x25d5('0x19')][_0x25d5('0x1c')]||null:null,'limit':_0x2c1140[_0x25d5('0x19')]?_0x2c1140[_0x25d5('0x19')][_0x25d5('0x25')]||null:null})[_0x25d5('0x20')](function(_0x4d3e63){logger[_0x25d5('0x14')](_0x25d5('0x23'),_0x2c1140);logger['debug'](_0x25d5('0x23'),_0x2c1140,JSON[_0x25d5('0x10')](_0x4d3e63));_0x22f741(_0x4d3e63);})[_0x25d5('0x15')](function(_0xc79402){logger[_0x25d5('0x11')](_0x25d5('0x23'),_0xc79402[_0x25d5('0x13')],_0x2c1140);_0x53fc27(_0x45c9b3[_0x25d5('0x11')](0x1f4,_0xc79402[_0x25d5('0x13')]));});});}; \ No newline at end of file +var _0xef48=['map','stringify','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','include','model','attributes'];(function(_0x18ce2f,_0x93cbb1){var _0xdfdde3=function(_0x26a400){while(--_0x26a400){_0x18ce2f['push'](_0x18ce2f['shift']());}};_0xdfdde3(++_0x93cbb1);}(_0xef48,0xf0));var _0x8ef4=function(_0x14c931,_0x52511b){_0x14c931=_0x14c931-0x0;var _0x45e73a=_0xef48[_0x14c931];return _0x45e73a;};'use strict';var _=require(_0x8ef4('0x0'));var util=require(_0x8ef4('0x1'));var moment=require(_0x8ef4('0x2'));var BPromise=require('bluebird');var rs=require(_0x8ef4('0x3'));var fs=require('fs');var Redis=require(_0x8ef4('0x4'));var db=require(_0x8ef4('0x5'))['db'];var utils=require(_0x8ef4('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8ef4('0x7'));var client=jayson[_0x8ef4('0x8')][_0x8ef4('0x9')]({'port':0x232a});config[_0x8ef4('0xa')]=_[_0x8ef4('0xb')](config[_0x8ef4('0xa')],{'host':_0x8ef4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x8ef4('0xd')](socket);function respondWithRpcPromise(_0x3d50cc,_0x40ff1e,_0x46bba2){return new BPromise(function(_0x30cd23,_0x554ad1){return client[_0x8ef4('0xe')](_0x3d50cc,_0x46bba2)[_0x8ef4('0xf')](function(_0x583e11){logger[_0x8ef4('0x10')](_0x8ef4('0x11'),_0x40ff1e,'request\x20sent');logger[_0x8ef4('0x12')](_0x8ef4('0x13'),_0x40ff1e,_0x8ef4('0x14'),JSON['stringify'](_0x583e11));if(_0x583e11['error']){if(_0x583e11['error'][_0x8ef4('0x15')]===0x1f4){logger[_0x8ef4('0x16')](_0x8ef4('0x11'),_0x40ff1e,_0x583e11['error'][_0x8ef4('0x17')]);return _0x554ad1(_0x583e11[_0x8ef4('0x16')][_0x8ef4('0x17')]);}logger[_0x8ef4('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x40ff1e,_0x583e11['error']['message']);return _0x30cd23(_0x583e11['error'][_0x8ef4('0x17')]);}else{logger[_0x8ef4('0x10')](_0x8ef4('0x11'),_0x40ff1e,_0x8ef4('0x14'));_0x30cd23(_0x583e11[_0x8ef4('0x18')][_0x8ef4('0x17')]);}})[_0x8ef4('0x19')](function(_0x6c6767){logger[_0x8ef4('0x16')](_0x8ef4('0x11'),_0x40ff1e,_0x6c6767);_0x554ad1(_0x6c6767);});});}exports[_0x8ef4('0x1a')]=function(_0x258288){var _0x291f21=this;return new Promise(function(_0x4d1012,_0x47ec68){return db[_0x8ef4('0x1b')]['findAll']({'raw':_0x258288[_0x8ef4('0x1c')]?_0x258288['options'][_0x8ef4('0x1d')]===undefined?!![]:![]:!![],'where':_0x258288[_0x8ef4('0x1c')]?_0x258288[_0x8ef4('0x1c')]['where']||null:null,'attributes':_0x258288[_0x8ef4('0x1c')]?_0x258288[_0x8ef4('0x1c')]['attributes']||null:null,'limit':_0x258288[_0x8ef4('0x1c')]?_0x258288[_0x8ef4('0x1c')]['limit']||null:null,'include':_0x258288[_0x8ef4('0x1c')]?_0x258288['options'][_0x8ef4('0x1e')]?_['map'](_0x258288[_0x8ef4('0x1c')][_0x8ef4('0x1e')],function(_0x4831f5){return{'model':db[_0x4831f5[_0x8ef4('0x1f')]],'as':_0x4831f5['as'],'attributes':_0x4831f5[_0x8ef4('0x20')],'include':_0x4831f5['include']?_[_0x8ef4('0x21')](_0x4831f5[_0x8ef4('0x1e')],function(_0xfa46f3){return{'model':db[_0xfa46f3['model']],'as':_0xfa46f3['as'],'attributes':_0xfa46f3[_0x8ef4('0x20')],'include':_0xfa46f3['include']?_[_0x8ef4('0x21')](_0xfa46f3[_0x8ef4('0x1e')],function(_0x33db9b){return{'model':db[_0x33db9b['model']],'as':_0x33db9b['as'],'attributes':_0x33db9b[_0x8ef4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8ef4('0xf')](function(_0x5cbd8b){logger['info']('GetVoiceQueueReport',_0x258288);logger[_0x8ef4('0x12')](_0x8ef4('0x1a'),_0x258288,JSON[_0x8ef4('0x22')](_0x5cbd8b));_0x4d1012(_0x5cbd8b);})[_0x8ef4('0x19')](function(_0x1cd2ba){logger[_0x8ef4('0x16')](_0x8ef4('0x1a'),_0x1cd2ba[_0x8ef4('0x17')],_0x258288);_0x47ec68(_0x291f21[_0x8ef4('0x16')](0x1f4,_0x1cd2ba[_0x8ef4('0x17')]));});});};exports[_0x8ef4('0x23')]=function(_0x1bb4c0){var _0x1b9c7f=this;return new Promise(function(_0x197792,_0x47d9fa){return db[_0x8ef4('0x1b')]['create'](_0x1bb4c0['body'],{'raw':_0x1bb4c0['options']?_0x1bb4c0['options'][_0x8ef4('0x1d')]===undefined?!![]:![]:!![]})[_0x8ef4('0xf')](function(_0x14ea57){logger[_0x8ef4('0x10')]('CreateVoiceQueueReport',_0x1bb4c0);logger[_0x8ef4('0x12')]('CreateVoiceQueueReport',_0x1bb4c0,JSON['stringify'](_0x14ea57));_0x197792(_0x14ea57);})[_0x8ef4('0x19')](function(_0x39a570){logger['error'](_0x8ef4('0x23'),_0x39a570['message'],_0x1bb4c0);_0x47d9fa(_0x1b9c7f[_0x8ef4('0x16')](0x1f4,_0x39a570[_0x8ef4('0x17')]));});});};exports[_0x8ef4('0x24')]=function(_0x21e999){var _0x1b8c8f=this;return new Promise(function(_0x29af21,_0x4e29bc){return db['VoiceQueueReport'][_0x8ef4('0x25')](_0x21e999['body'],{'raw':_0x21e999[_0x8ef4('0x1c')]?_0x21e999['options'][_0x8ef4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21e999[_0x8ef4('0x1c')]?_0x21e999[_0x8ef4('0x1c')][_0x8ef4('0x26')]||null:null,'attributes':_0x21e999[_0x8ef4('0x1c')]?_0x21e999[_0x8ef4('0x1c')]['attributes']||null:null,'limit':_0x21e999['options']?_0x21e999[_0x8ef4('0x1c')]['limit']||null:null})[_0x8ef4('0xf')](function(_0xbbb202){logger[_0x8ef4('0x10')](_0x8ef4('0x24'),_0x21e999);logger[_0x8ef4('0x12')](_0x8ef4('0x24'),_0x21e999,JSON[_0x8ef4('0x22')](_0xbbb202));_0x29af21(_0xbbb202);})[_0x8ef4('0x19')](function(_0x4bafdd){logger[_0x8ef4('0x16')](_0x8ef4('0x24'),_0x4bafdd[_0x8ef4('0x17')],_0x21e999);_0x4e29bc(_0x1b8c8f[_0x8ef4('0x16')](0x1f4,_0x4bafdd[_0x8ef4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 788eadb..8352c62 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 _0xe4d6=['remove','update','emit','removeListener','length','./voiceQueueReport.events','save'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xe4d6,0xd7));var _0x6e4d=function(_0x43bb33,_0x109e83){_0x43bb33=_0x43bb33-0x0;var _0x31a88c=_0xe4d6[_0x43bb33];return _0x31a88c;};'use strict';var VoiceQueueReportEvents=require(_0x6e4d('0x0'));var events=[_0x6e4d('0x1'),_0x6e4d('0x2'),_0x6e4d('0x3')];function createListener(_0x4d21a2,_0x2ea10a){return function(_0x1fe878){_0x2ea10a[_0x6e4d('0x4')](_0x4d21a2,_0x1fe878);};}function removeListener(_0x57b524,_0x56c6aa){return function(){VoiceQueueReportEvents[_0x6e4d('0x5')](_0x57b524,_0x56c6aa);};}exports['register']=function(_0x34f714){for(var _0x32a166=0x0,_0x241d30=events[_0x6e4d('0x6')];_0x32a166<_0x241d30;_0x32a166++){var _0x14706a=events[_0x32a166];var _0x50f0cc=createListener('voiceQueueReport:'+_0x14706a,_0x34f714);VoiceQueueReportEvents['on'](_0x14706a,_0x50f0cc);}}; \ No newline at end of file +var _0x6797=['emit','removeListener','register','length','./voiceQueueReport.events','save','remove','update'];(function(_0x1e24f8,_0x52070f){var _0x5c4446=function(_0x40bf51){while(--_0x40bf51){_0x1e24f8['push'](_0x1e24f8['shift']());}};_0x5c4446(++_0x52070f);}(_0x6797,0x94));var _0x7679=function(_0x268409,_0x4e20cf){_0x268409=_0x268409-0x0;var _0x4ac01b=_0x6797[_0x268409];return _0x4ac01b;};'use strict';var VoiceQueueReportEvents=require(_0x7679('0x0'));var events=[_0x7679('0x1'),_0x7679('0x2'),_0x7679('0x3')];function createListener(_0x1f0334,_0x376d30){return function(_0x2a9c70){_0x376d30[_0x7679('0x4')](_0x1f0334,_0x2a9c70);};}function removeListener(_0x216d92,_0x494458){return function(){VoiceQueueReportEvents[_0x7679('0x5')](_0x216d92,_0x494458);};}exports[_0x7679('0x6')]=function(_0x57b2f9){for(var _0x415e7a=0x0,_0x5326a8=events[_0x7679('0x7')];_0x415e7a<_0x5326a8;_0x415e7a++){var _0xa34325=events[_0x415e7a];var _0x423561=createListener('voiceQueueReport:'+_0xa34325,_0x57b2f9);VoiceQueueReportEvents['on'](_0xa34325,_0x423561);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 1f2dd33..098ad6a 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 _0x4b76=['Router','fs-extra','./voiceQueuesLog.controller','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x108072,_0x53d627){var _0x1a5612=function(_0x19dc84){while(--_0x19dc84){_0x108072['push'](_0x108072['shift']());}};_0x1a5612(++_0x53d627);}(_0x4b76,0x1cc));var _0x64b7=function(_0x236e36,_0x581fba){_0x236e36=_0x236e36-0x0;var _0x56f71f=_0x4b76[_0x236e36];return _0x56f71f;};'use strict';var multer=require(_0x64b7('0x0'));var util=require(_0x64b7('0x1'));var path=require(_0x64b7('0x2'));var timeout=require('connect-timeout');var express=require(_0x64b7('0x3'));var router=express[_0x64b7('0x4')]();var fs_extra=require(_0x64b7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x64b7('0x6'));router['get']('/',auth[_0x64b7('0x7')](),controller[_0x64b7('0x8')]);router['get'](_0x64b7('0x9'),auth[_0x64b7('0x7')](),controller['show']);router[_0x64b7('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x64b7('0xb')](_0x64b7('0x9'),auth[_0x64b7('0x7')](),controller[_0x64b7('0xc')]);router[_0x64b7('0xd')](_0x64b7('0x9'),auth['isAuthenticated'](),controller[_0x64b7('0xe')]);module[_0x64b7('0xf')]=router; \ No newline at end of file +var _0x4156=['create','put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post'];(function(_0x3c96f5,_0xd07b7d){var _0x2ec0ad=function(_0x521391){while(--_0x521391){_0x3c96f5['push'](_0x3c96f5['shift']());}};_0x2ec0ad(++_0xd07b7d);}(_0x4156,0x1eb));var _0x6415=function(_0x590955,_0x26a268){_0x590955=_0x590955-0x0;var _0x22fbed=_0x4156[_0x590955];return _0x22fbed;};'use strict';var multer=require(_0x6415('0x0'));var util=require('util');var path=require(_0x6415('0x1'));var timeout=require('connect-timeout');var express=require(_0x6415('0x2'));var router=express[_0x6415('0x3')]();var fs_extra=require(_0x6415('0x4'));var auth=require(_0x6415('0x5'));var interaction=require(_0x6415('0x6'));var config=require(_0x6415('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x6415('0x8')]('/',auth[_0x6415('0x9')](),controller[_0x6415('0xa')]);router[_0x6415('0x8')](_0x6415('0xb'),auth[_0x6415('0x9')](),controller['show']);router[_0x6415('0xc')]('/',auth['isAuthenticated'](),controller[_0x6415('0xd')]);router[_0x6415('0xe')](_0x6415('0xb'),auth['isAuthenticated'](),controller[_0x6415('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6415('0x10')]);module[_0x6415('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 17cdd72..9f12bab 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 _0x2aca=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE','format'];(function(_0x5ac195,_0x5cf9a8){var _0x46d9f4=function(_0x3e4203){while(--_0x3e4203){_0x5ac195['push'](_0x5ac195['shift']());}};_0x46d9f4(++_0x5cf9a8);}(_0x2aca,0x166));var _0xa2ac=function(_0x207e25,_0x5a9278){_0x207e25=_0x207e25-0x0;var _0x1ca6db=_0x2aca[_0x207e25];return _0x1ca6db;};'use strict';var Sequelize=require(_0xa2ac('0x0'));var moment=require(_0xa2ac('0x1'));module[_0xa2ac('0x2')]={'time':{'type':Sequelize[_0xa2ac('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa2ac('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa2ac('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa2ac('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa2ac('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa2ac('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa2ac('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa2ac('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa2ac('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa2ac('0x4')],'allowNull':![],'defaultValue':moment()[_0xa2ac('0x5')](_0xa2ac('0x6'))}}; \ No newline at end of file +var _0x9256=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0x9256,0x128));var _0x6925=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9256[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6925('0x0'));var moment=require(_0x6925('0x1'));module[_0x6925('0x2')]={'time':{'type':Sequelize[_0x6925('0x3')]},'callid':{'type':Sequelize[_0x6925('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6925('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6925('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6925('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x6925('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x6925('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6925('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6925('0x4')],'allowNull':![],'defaultValue':moment()[_0x6925('0x5')](_0x6925('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index fe6ad10..8f55b66 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 _0xafac=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','key','keys','query','filters','intersection','model','fields','attributes','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','find','catch','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','fs-extra','jsforce','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x30706b,_0x4ece0a){var _0x144465=function(_0x378305){while(--_0x378305){_0x30706b['push'](_0x30706b['shift']());}};_0x144465(++_0x4ece0a);}(_0xafac,0x13e));var _0xcafa=function(_0x97993d,_0x5cf1ef){_0x97993d=_0x97993d-0x0;var _0x3e9314=_0xafac[_0x97993d];return _0x3e9314;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcafa('0x0'));var jsonpatch=require(_0xcafa('0x1'));var rp=require(_0xcafa('0x2'));var moment=require(_0xcafa('0x3'));var BPromise=require(_0xcafa('0x4'));var Mustache=require('mustache');var util=require(_0xcafa('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcafa('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcafa('0x7'));var deskjs=require('desk.js');var toCsv=require(_0xcafa('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcafa('0x9'));var authService=require('../../components/auth/service');var qs=require(_0xcafa('0xa'));var as=require(_0xcafa('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcafa('0xc'));var utils=require(_0xcafa('0xd'));var config=require(_0xcafa('0xe'));var licenseUtil=require(_0xcafa('0xf'));var db=require(_0xcafa('0x10'))['db'];function respondWithStatusCode(_0x7d070,_0x13ee4c){_0x13ee4c=_0x13ee4c||0xcc;return function(_0xf5bdd0){if(_0xf5bdd0){return _0x7d070['sendStatus'](_0x13ee4c);}return _0x7d070[_0xcafa('0x11')](_0x13ee4c)[_0xcafa('0x12')]();};}function respondWithResult(_0x1189c2,_0x1e1ad7){_0x1e1ad7=_0x1e1ad7||0xc8;return function(_0x23ed72){if(_0x23ed72){return _0x1189c2[_0xcafa('0x11')](_0x1e1ad7)[_0xcafa('0x13')](_0x23ed72);}};}function respondWithFilteredResult(_0x426812,_0x2c18ed){return function(_0x10f1bd){if(_0x10f1bd){var _0x5bbbbe=typeof _0x2c18ed[_0xcafa('0x14')]===_0xcafa('0x15')&&typeof _0x2c18ed[_0xcafa('0x16')]===_0xcafa('0x15');var _0x21543b=_0x10f1bd['count'];var _0x116aa9=_0x5bbbbe?0x0:_0x2c18ed[_0xcafa('0x14')];var _0x175a81=_0x5bbbbe?_0x10f1bd[_0xcafa('0x17')]:_0x2c18ed[_0xcafa('0x14')]+_0x2c18ed['limit'];var _0x3e43a6;if(_0x175a81>=_0x21543b){_0x175a81=_0x21543b;_0x3e43a6=0xc8;}else{_0x3e43a6=0xce;}_0x426812[_0xcafa('0x11')](_0x3e43a6);return _0x426812[_0xcafa('0x18')](_0xcafa('0x19'),_0x116aa9+'-'+_0x175a81+'/'+_0x21543b)[_0xcafa('0x13')](_0x10f1bd);}return null;};}function patchUpdates(_0x142e3e){return function(_0x2e5291){try{jsonpatch[_0xcafa('0x1a')](_0x2e5291,_0x142e3e,!![]);}catch(_0x52a035){return BPromise[_0xcafa('0x1b')](_0x52a035);}return _0x2e5291[_0xcafa('0x1c')]();};}function saveUpdates(_0x531a49,_0x5599d6){return function(_0xc231ba){if(_0xc231ba){return _0xc231ba[_0xcafa('0x1d')](_0x531a49)[_0xcafa('0x1e')](function(_0xf25590){return _0xf25590;});}return null;};}function removeEntity(_0x5e88eb,_0x90c632){return function(_0x4ebbc6){if(_0x4ebbc6){return _0x4ebbc6[_0xcafa('0x1f')]()['then'](function(){_0x5e88eb[_0xcafa('0x11')](0xcc)[_0xcafa('0x12')]();});}};}function handleEntityNotFound(_0x22b41c,_0x50fdd9){return function(_0x1d805d){if(!_0x1d805d){_0x22b41c[_0xcafa('0x20')](0x194);}return _0x1d805d;};}function handleError(_0x4d3176,_0x4144bb){_0x4144bb=_0x4144bb||0x1f4;return function(_0x55b557){logger[_0xcafa('0x21')](_0x55b557[_0xcafa('0x22')]);if(_0x55b557[_0xcafa('0x23')]){delete _0x55b557['name'];}_0x4d3176[_0xcafa('0x11')](_0x4144bb)[_0xcafa('0x24')](_0x55b557);};}exports[_0xcafa('0x25')]=function(_0x5403b0,_0x73f030){var _0x5badb0={},_0x56e181={},_0x44882c={'count':0x0,'rows':[]};var _0x3b636e=_[_0xcafa('0x26')](db[_0xcafa('0x27')][_0xcafa('0x28')],function(_0xdb3b5c){return{'name':_0xdb3b5c['fieldName'],'type':_0xdb3b5c['type'][_0xcafa('0x29')]};});_0x56e181['model']=_[_0xcafa('0x26')](_0x3b636e,'name');_0x56e181['query']=_[_0xcafa('0x2a')](_0x5403b0[_0xcafa('0x2b')]);_0x56e181[_0xcafa('0x2c')]=_[_0xcafa('0x2d')](_0x56e181[_0xcafa('0x2e')],_0x56e181['query']);_0x5badb0['attributes']=_['intersection'](_0x56e181['model'],qs[_0xcafa('0x2f')](_0x5403b0[_0xcafa('0x2b')][_0xcafa('0x2f')]));_0x5badb0[_0xcafa('0x30')]=_0x5badb0[_0xcafa('0x30')]['length']?_0x5badb0['attributes']:_0x56e181[_0xcafa('0x2e')];if(!_0x5403b0[_0xcafa('0x2b')]['hasOwnProperty'](_0xcafa('0x31'))){_0x5badb0[_0xcafa('0x16')]=qs[_0xcafa('0x16')](_0x5403b0[_0xcafa('0x2b')][_0xcafa('0x16')]);_0x5badb0[_0xcafa('0x14')]=qs[_0xcafa('0x14')](_0x5403b0[_0xcafa('0x2b')][_0xcafa('0x14')]);}_0x5badb0[_0xcafa('0x32')]=qs[_0xcafa('0x33')](_0x5403b0[_0xcafa('0x2b')][_0xcafa('0x33')]);_0x5badb0['where']=qs['filters'](_[_0xcafa('0x34')](_0x5403b0[_0xcafa('0x2b')],_0x56e181[_0xcafa('0x2c')]),_0x3b636e);if(_0x5403b0[_0xcafa('0x2b')][_0xcafa('0x35')]){_0x5badb0[_0xcafa('0x36')]=_[_0xcafa('0x37')](_0x5badb0[_0xcafa('0x36')],{'$or':_[_0xcafa('0x26')](_0x3b636e,function(_0x434e04){if(_0x434e04[_0xcafa('0x38')]!==_0xcafa('0x39')){var _0x40bf8f={};_0x40bf8f[_0x434e04[_0xcafa('0x23')]]={'$like':'%'+_0x5403b0['query'][_0xcafa('0x35')]+'%'};return _0x40bf8f;}})});}_0x5badb0=_[_0xcafa('0x37')]({},_0x5badb0,_0x5403b0[_0xcafa('0x3a')]);var _0x50dcbc={'where':_0x5badb0[_0xcafa('0x36')]};return db[_0xcafa('0x27')]['count'](_0x50dcbc)[_0xcafa('0x1e')](function(_0x979d6e){_0x44882c[_0xcafa('0x17')]=_0x979d6e;if(_0x5403b0[_0xcafa('0x2b')][_0xcafa('0x3b')]){_0x5badb0[_0xcafa('0x3c')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xcafa('0x3d')](_0x5badb0);})[_0xcafa('0x1e')](function(_0x2fbe7f){_0x44882c['rows']=_0x2fbe7f;return _0x44882c;})[_0xcafa('0x1e')](respondWithFilteredResult(_0x73f030,_0x5badb0))['catch'](handleError(_0x73f030,null));};exports[_0xcafa('0x3e')]=function(_0x5c53ac,_0x37e425){var _0xa29085={'raw':!![],'where':{'id':_0x5c53ac['params']['id']}},_0x1e8603={};_0x1e8603['model']=_[_0xcafa('0x2a')](db[_0xcafa('0x27')]['rawAttributes']);_0x1e8603[_0xcafa('0x2b')]=_[_0xcafa('0x2a')](_0x5c53ac['query']);_0x1e8603[_0xcafa('0x2c')]=_[_0xcafa('0x2d')](_0x1e8603[_0xcafa('0x2e')],_0x1e8603['query']);_0xa29085[_0xcafa('0x30')]=_[_0xcafa('0x2d')](_0x1e8603[_0xcafa('0x2e')],qs[_0xcafa('0x2f')](_0x5c53ac[_0xcafa('0x2b')][_0xcafa('0x2f')]));_0xa29085[_0xcafa('0x30')]=_0xa29085['attributes']['length']?_0xa29085[_0xcafa('0x30')]:_0x1e8603[_0xcafa('0x2e')];if(_0x5c53ac[_0xcafa('0x2b')][_0xcafa('0x3b')]){_0xa29085[_0xcafa('0x3c')]=[{'all':!![]}];}_0xa29085=_[_0xcafa('0x37')]({},_0xa29085,_0x5c53ac[_0xcafa('0x3a')]);return db['VoiceQueuesLog'][_0xcafa('0x3f')](_0xa29085)[_0xcafa('0x1e')](handleEntityNotFound(_0x37e425,null))['then'](respondWithResult(_0x37e425,null))[_0xcafa('0x40')](handleError(_0x37e425,null));};exports[_0xcafa('0x41')]=function(_0x151d54,_0x44bd2f){return db[_0xcafa('0x27')][_0xcafa('0x41')](_0x151d54[_0xcafa('0x42')],{})[_0xcafa('0x1e')](respondWithResult(_0x44bd2f,0xc9))[_0xcafa('0x40')](handleError(_0x44bd2f,null));};exports[_0xcafa('0x1d')]=function(_0x10f634,_0x4b198a){if(_0x10f634[_0xcafa('0x42')]['id']){delete _0x10f634[_0xcafa('0x42')]['id'];}return db[_0xcafa('0x27')][_0xcafa('0x3f')]({'where':{'id':_0x10f634[_0xcafa('0x43')]['id']}})[_0xcafa('0x1e')](handleEntityNotFound(_0x4b198a,null))[_0xcafa('0x1e')](saveUpdates(_0x10f634[_0xcafa('0x42')],null))[_0xcafa('0x1e')](respondWithResult(_0x4b198a,null))[_0xcafa('0x40')](handleError(_0x4b198a,null));};exports['destroy']=function(_0x18fbc7,_0x1b383d){return db[_0xcafa('0x27')][_0xcafa('0x3f')]({'where':{'id':_0x18fbc7[_0xcafa('0x43')]['id']}})[_0xcafa('0x1e')](handleEntityNotFound(_0x1b383d,null))['then'](removeEntity(_0x1b383d,null))['catch'](handleError(_0x1b383d,null));}; \ No newline at end of file +var _0xb44d=['fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','filter','options','includeAll','findAll','catch','show','params','include','find','create','body','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes'];(function(_0x35d822,_0xf2b0c0){var _0x18b48c=function(_0xd85391){while(--_0xd85391){_0x35d822['push'](_0x35d822['shift']());}};_0x18b48c(++_0xf2b0c0);}(_0xb44d,0x144));var _0xdb44=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb44d[_0x502c7d];return _0x30b7ed;};'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(_0xdb44('0x0'));var moment=require(_0xdb44('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdb44('0x2'));var path=require(_0xdb44('0x3'));var sox=require(_0xdb44('0x4'));var csv=require('to-csv');var ejs=require(_0xdb44('0x5'));var fs=require('fs');var fs_extra=require(_0xdb44('0x6'));var _=require(_0xdb44('0x7'));var squel=require(_0xdb44('0x8'));var crypto=require(_0xdb44('0x9'));var jsforce=require(_0xdb44('0xa'));var deskjs=require(_0xdb44('0xb'));var toCsv=require(_0xdb44('0xc'));var querystring=require(_0xdb44('0xd'));var Papa=require('papaparse');var Redis=require(_0xdb44('0xe'));var authService=require(_0xdb44('0xf'));var qs=require(_0xdb44('0x10'));var as=require(_0xdb44('0x11'));var hardwareService=require(_0xdb44('0x12'));var logger=require(_0xdb44('0x13'))(_0xdb44('0x14'));var utils=require('../../config/utils');var config=require(_0xdb44('0x15'));var licenseUtil=require(_0xdb44('0x16'));var db=require(_0xdb44('0x17'))['db'];function respondWithStatusCode(_0x3925f0,_0x34a872){_0x34a872=_0x34a872||0xcc;return function(_0x3a35a7){if(_0x3a35a7){return _0x3925f0[_0xdb44('0x18')](_0x34a872);}return _0x3925f0[_0xdb44('0x19')](_0x34a872)['end']();};}function respondWithResult(_0x3f46b5,_0x5a6dd2){_0x5a6dd2=_0x5a6dd2||0xc8;return function(_0x229ca7){if(_0x229ca7){return _0x3f46b5[_0xdb44('0x19')](_0x5a6dd2)[_0xdb44('0x1a')](_0x229ca7);}};}function respondWithFilteredResult(_0x198ec3,_0x204f2a){return function(_0x5bdb24){if(_0x5bdb24){var _0x431232=typeof _0x204f2a[_0xdb44('0x1b')]===_0xdb44('0x1c')&&typeof _0x204f2a['limit']===_0xdb44('0x1c');var _0x4bb54f=_0x5bdb24[_0xdb44('0x1d')];var _0x4c19e2=_0x431232?0x0:_0x204f2a[_0xdb44('0x1b')];var _0x28ff5e=_0x431232?_0x5bdb24[_0xdb44('0x1d')]:_0x204f2a[_0xdb44('0x1b')]+_0x204f2a[_0xdb44('0x1e')];var _0x248758;if(_0x28ff5e>=_0x4bb54f){_0x28ff5e=_0x4bb54f;_0x248758=0xc8;}else{_0x248758=0xce;}_0x198ec3[_0xdb44('0x19')](_0x248758);return _0x198ec3[_0xdb44('0x1f')](_0xdb44('0x20'),_0x4c19e2+'-'+_0x28ff5e+'/'+_0x4bb54f)[_0xdb44('0x1a')](_0x5bdb24);}return null;};}function patchUpdates(_0x1bbca7){return function(_0x2bb745){try{jsonpatch[_0xdb44('0x21')](_0x2bb745,_0x1bbca7,!![]);}catch(_0x341a7a){return BPromise['reject'](_0x341a7a);}return _0x2bb745[_0xdb44('0x22')]();};}function saveUpdates(_0x417507,_0x3e81e9){return function(_0xd13dc){if(_0xd13dc){return _0xd13dc[_0xdb44('0x23')](_0x417507)['then'](function(_0x3ebf26){return _0x3ebf26;});}return null;};}function removeEntity(_0x97fc4c,_0x5760b5){return function(_0x109b93){if(_0x109b93){return _0x109b93[_0xdb44('0x24')]()[_0xdb44('0x25')](function(){_0x97fc4c[_0xdb44('0x19')](0xcc)[_0xdb44('0x26')]();});}};}function handleEntityNotFound(_0x2c3960,_0x3ddbef){return function(_0x392e04){if(!_0x392e04){_0x2c3960[_0xdb44('0x18')](0x194);}return _0x392e04;};}function handleError(_0x57465f,_0xb0eabb){_0xb0eabb=_0xb0eabb||0x1f4;return function(_0x19da1b){logger[_0xdb44('0x27')](_0x19da1b['stack']);if(_0x19da1b[_0xdb44('0x28')]){delete _0x19da1b[_0xdb44('0x28')];}_0x57465f[_0xdb44('0x19')](_0xb0eabb)[_0xdb44('0x29')](_0x19da1b);};}exports[_0xdb44('0x2a')]=function(_0x2f2db4,_0x3856f5){var _0x1e09a1={},_0x2a16d5={},_0x19845e={'count':0x0,'rows':[]};var _0xcd4e9d=_[_0xdb44('0x2b')](db[_0xdb44('0x2c')][_0xdb44('0x2d')],function(_0x34baa4){return{'name':_0x34baa4[_0xdb44('0x2e')],'type':_0x34baa4[_0xdb44('0x2f')][_0xdb44('0x30')]};});_0x2a16d5[_0xdb44('0x31')]=_[_0xdb44('0x2b')](_0xcd4e9d,_0xdb44('0x28'));_0x2a16d5[_0xdb44('0x32')]=_[_0xdb44('0x33')](_0x2f2db4[_0xdb44('0x32')]);_0x2a16d5['filters']=_[_0xdb44('0x34')](_0x2a16d5[_0xdb44('0x31')],_0x2a16d5[_0xdb44('0x32')]);_0x1e09a1[_0xdb44('0x35')]=_['intersection'](_0x2a16d5[_0xdb44('0x31')],qs[_0xdb44('0x36')](_0x2f2db4[_0xdb44('0x32')]['fields']));_0x1e09a1[_0xdb44('0x35')]=_0x1e09a1['attributes'][_0xdb44('0x37')]?_0x1e09a1[_0xdb44('0x35')]:_0x2a16d5[_0xdb44('0x31')];if(!_0x2f2db4[_0xdb44('0x32')][_0xdb44('0x38')]('nolimit')){_0x1e09a1[_0xdb44('0x1e')]=qs[_0xdb44('0x1e')](_0x2f2db4[_0xdb44('0x32')][_0xdb44('0x1e')]);_0x1e09a1[_0xdb44('0x1b')]=qs[_0xdb44('0x1b')](_0x2f2db4[_0xdb44('0x32')]['offset']);}_0x1e09a1[_0xdb44('0x39')]=qs[_0xdb44('0x3a')](_0x2f2db4['query'][_0xdb44('0x3a')]);_0x1e09a1['where']=qs[_0xdb44('0x3b')](_[_0xdb44('0x3c')](_0x2f2db4[_0xdb44('0x32')],_0x2a16d5[_0xdb44('0x3b')]),_0xcd4e9d);if(_0x2f2db4[_0xdb44('0x32')]['filter']){_0x1e09a1[_0xdb44('0x3d')]=_[_0xdb44('0x3e')](_0x1e09a1[_0xdb44('0x3d')],{'$or':_[_0xdb44('0x2b')](_0xcd4e9d,function(_0x2d3600){if(_0x2d3600[_0xdb44('0x2f')]!=='VIRTUAL'){var _0x232419={};_0x232419[_0x2d3600['name']]={'$like':'%'+_0x2f2db4['query'][_0xdb44('0x3f')]+'%'};return _0x232419;}})});}_0x1e09a1=_[_0xdb44('0x3e')]({},_0x1e09a1,_0x2f2db4[_0xdb44('0x40')]);var _0xaa7448={'where':_0x1e09a1[_0xdb44('0x3d')]};return db['VoiceQueuesLog'][_0xdb44('0x1d')](_0xaa7448)[_0xdb44('0x25')](function(_0x2c9842){_0x19845e['count']=_0x2c9842;if(_0x2f2db4[_0xdb44('0x32')][_0xdb44('0x41')]){_0x1e09a1['include']=[{'all':!![]}];}return db[_0xdb44('0x2c')][_0xdb44('0x42')](_0x1e09a1);})[_0xdb44('0x25')](function(_0x406091){_0x19845e['rows']=_0x406091;return _0x19845e;})[_0xdb44('0x25')](respondWithFilteredResult(_0x3856f5,_0x1e09a1))[_0xdb44('0x43')](handleError(_0x3856f5,null));};exports[_0xdb44('0x44')]=function(_0x56b12f,_0x434ab8){var _0x411dcd={'raw':!![],'where':{'id':_0x56b12f[_0xdb44('0x45')]['id']}},_0x504801={};_0x504801[_0xdb44('0x31')]=_[_0xdb44('0x33')](db[_0xdb44('0x2c')][_0xdb44('0x2d')]);_0x504801[_0xdb44('0x32')]=_[_0xdb44('0x33')](_0x56b12f['query']);_0x504801['filters']=_[_0xdb44('0x34')](_0x504801[_0xdb44('0x31')],_0x504801[_0xdb44('0x32')]);_0x411dcd['attributes']=_[_0xdb44('0x34')](_0x504801['model'],qs[_0xdb44('0x36')](_0x56b12f['query']['fields']));_0x411dcd[_0xdb44('0x35')]=_0x411dcd[_0xdb44('0x35')][_0xdb44('0x37')]?_0x411dcd[_0xdb44('0x35')]:_0x504801[_0xdb44('0x31')];if(_0x56b12f[_0xdb44('0x32')]['includeAll']){_0x411dcd[_0xdb44('0x46')]=[{'all':!![]}];}_0x411dcd=_[_0xdb44('0x3e')]({},_0x411dcd,_0x56b12f[_0xdb44('0x40')]);return db['VoiceQueuesLog'][_0xdb44('0x47')](_0x411dcd)[_0xdb44('0x25')](handleEntityNotFound(_0x434ab8,null))[_0xdb44('0x25')](respondWithResult(_0x434ab8,null))[_0xdb44('0x43')](handleError(_0x434ab8,null));};exports[_0xdb44('0x48')]=function(_0x1b0ab9,_0x166219){return db[_0xdb44('0x2c')][_0xdb44('0x48')](_0x1b0ab9[_0xdb44('0x49')],{})[_0xdb44('0x25')](respondWithResult(_0x166219,0xc9))[_0xdb44('0x43')](handleError(_0x166219,null));};exports[_0xdb44('0x23')]=function(_0x16fb40,_0x323e56){if(_0x16fb40['body']['id']){delete _0x16fb40[_0xdb44('0x49')]['id'];}return db[_0xdb44('0x2c')][_0xdb44('0x47')]({'where':{'id':_0x16fb40['params']['id']}})['then'](handleEntityNotFound(_0x323e56,null))[_0xdb44('0x25')](saveUpdates(_0x16fb40[_0xdb44('0x49')],null))['then'](respondWithResult(_0x323e56,null))[_0xdb44('0x43')](handleError(_0x323e56,null));};exports['destroy']=function(_0x5e2403,_0x137305){return db[_0xdb44('0x2c')]['find']({'where':{'id':_0x5e2403[_0xdb44('0x45')]['id']}})[_0xdb44('0x25')](handleEntityNotFound(_0x137305,null))[_0xdb44('0x25')](removeEntity(_0x137305,null))[_0xdb44('0x43')](handleError(_0x137305,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index c6ba5bc..85f6028 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 _0xfe58=['rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event','dtm','../../config/logger','api','moment','bluebird','path'];(function(_0x5b5b01,_0xbde740){var _0xc692ff=function(_0xe8c5ea){while(--_0xe8c5ea){_0x5b5b01['push'](_0x5b5b01['shift']());}};_0xc692ff(++_0xbde740);}(_0xfe58,0x1cf));var _0x8fe5=function(_0x1ae338,_0x298701){_0x1ae338=_0x1ae338-0x0;var _0x5e6f36=_0xfe58[_0x1ae338];return _0x5e6f36;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8fe5('0x0'))(_0x8fe5('0x1'));var moment=require(_0x8fe5('0x2'));var BPromise=require(_0x8fe5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fe5('0x4'));var rimraf=require(_0x8fe5('0x5'));var config=require(_0x8fe5('0x6'));var attributes=require(_0x8fe5('0x7'));module[_0x8fe5('0x8')]=function(_0x5028b4,_0x5efaad){return _0x5028b4[_0x8fe5('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0x8fe5('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x8fe5('0xb'),_0x8fe5('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x938c=['util','api','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event','dtm','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x938c,0x11f));var _0xc938=function(_0x4ba512,_0x4a5f1c){_0x4ba512=_0x4ba512-0x0;var _0x164839=_0x938c[_0x4ba512];return _0x164839;};'use strict';var _=require(_0xc938('0x0'));var util=require(_0xc938('0x1'));var logger=require('../../config/logger')(_0xc938('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc938('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc938('0x4'));var config=require(_0xc938('0x5'));var attributes=require(_0xc938('0x6'));module[_0xc938('0x7')]=function(_0x235110,_0x8cfbb6){return _0x235110['define'](_0xc938('0x8'),attributes,{'tableName':_0xc938('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xc938('0xa'),_0xc938('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 6e616a4..9896228 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 _0xabd8=['debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xabd8,0x142));var _0x8abd=function(_0x9a3e0f,_0x2f796d){_0x9a3e0f=_0x9a3e0f-0x0;var _0x3d2a9a=_0xabd8[_0x9a3e0f];return _0x3d2a9a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8abd('0x0'));var rs=require(_0x8abd('0x1'));var fs=require('fs');var Redis=require(_0x8abd('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8abd('0x3'));var logger=require(_0x8abd('0x4'))(_0x8abd('0x5'));var config=require(_0x8abd('0x6'));var jayson=require(_0x8abd('0x7'));var client=jayson[_0x8abd('0x8')][_0x8abd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7e8824,_0x38ff7d,_0x399d52){return new BPromise(function(_0x14c8c5,_0x7c4bd0){return client[_0x8abd('0xa')](_0x7e8824,_0x399d52)['then'](function(_0x30d682){logger[_0x8abd('0xb')](_0x8abd('0xc'),_0x38ff7d,_0x8abd('0xd'));logger[_0x8abd('0xe')](_0x8abd('0xf'),_0x38ff7d,_0x8abd('0xd'),JSON[_0x8abd('0x10')](_0x30d682));if(_0x30d682[_0x8abd('0x11')]){if(_0x30d682[_0x8abd('0x11')]['code']===0x1f4){logger[_0x8abd('0x11')](_0x8abd('0xc'),_0x38ff7d,_0x30d682[_0x8abd('0x11')]['message']);return _0x7c4bd0(_0x30d682[_0x8abd('0x11')][_0x8abd('0x12')]);}logger[_0x8abd('0x11')](_0x8abd('0xc'),_0x38ff7d,_0x30d682[_0x8abd('0x11')][_0x8abd('0x12')]);return _0x14c8c5(_0x30d682[_0x8abd('0x11')][_0x8abd('0x12')]);}else{logger['info'](_0x8abd('0xc'),_0x38ff7d,_0x8abd('0xd'));_0x14c8c5(_0x30d682[_0x8abd('0x13')][_0x8abd('0x12')]);}})[_0x8abd('0x14')](function(_0x29b1e1){logger[_0x8abd('0x11')](_0x8abd('0xc'),_0x38ff7d,_0x29b1e1);_0x7c4bd0(_0x29b1e1);});});} \ No newline at end of file +var _0x72d1=['error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x3784d2,_0x504607){var _0x2a1938=function(_0x5548f5){while(--_0x5548f5){_0x3784d2['push'](_0x3784d2['shift']());}};_0x2a1938(++_0x504607);}(_0x72d1,0x18b));var _0x172d=function(_0x20fdc1,_0xde1296){_0x20fdc1=_0x20fdc1-0x0;var _0x25397c=_0x72d1[_0x20fdc1];return _0x25397c;};'use strict';var _=require(_0x172d('0x0'));var util=require(_0x172d('0x1'));var moment=require('moment');var BPromise=require(_0x172d('0x2'));var rs=require(_0x172d('0x3'));var fs=require('fs');var Redis=require(_0x172d('0x4'));var db=require(_0x172d('0x5'))['db'];var utils=require(_0x172d('0x6'));var logger=require(_0x172d('0x7'))('rpc');var config=require(_0x172d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x172d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d95e1,_0x2c3d19,_0x4071b3){return new BPromise(function(_0x52a4f3,_0x1fed7a){return client[_0x172d('0xa')](_0x3d95e1,_0x4071b3)[_0x172d('0xb')](function(_0x1de73f){logger[_0x172d('0xc')](_0x172d('0xd'),_0x2c3d19,_0x172d('0xe'));logger[_0x172d('0xf')](_0x172d('0x10'),_0x2c3d19,'request\x20sent',JSON[_0x172d('0x11')](_0x1de73f));if(_0x1de73f['error']){if(_0x1de73f['error'][_0x172d('0x12')]===0x1f4){logger['error'](_0x172d('0xd'),_0x2c3d19,_0x1de73f[_0x172d('0x13')][_0x172d('0x14')]);return _0x1fed7a(_0x1de73f[_0x172d('0x13')][_0x172d('0x14')]);}logger[_0x172d('0x13')](_0x172d('0xd'),_0x2c3d19,_0x1de73f[_0x172d('0x13')]['message']);return _0x52a4f3(_0x1de73f[_0x172d('0x13')]['message']);}else{logger[_0x172d('0xc')](_0x172d('0xd'),_0x2c3d19,'request\x20sent');_0x52a4f3(_0x1de73f[_0x172d('0x15')]['message']);}})[_0x172d('0x16')](function(_0x81f26a){logger[_0x172d('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2c3d19,_0x81f26a);_0x1fed7a(_0x81f26a);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 7abdd75..8fe504c 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 _0xa749=['downloads','/:id/transcribe','post','runTranscribe','put','delete','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads'];(function(_0xc06b57,_0x122c9a){var _0x53f00d=function(_0x2268ff){while(--_0x2268ff){_0xc06b57['push'](_0xc06b57['shift']());}};_0x53f00d(++_0x122c9a);}(_0xa749,0x1b7));var _0x9a74=function(_0x175896,_0xd45d1e){_0x175896=_0x175896-0x0;var _0x5ad8a0=_0xa749[_0x175896];return _0x5ad8a0;};'use strict';var multer=require(_0x9a74('0x0'));var util=require('util');var path=require(_0x9a74('0x1'));var timeout=require('connect-timeout');var express=require(_0x9a74('0x2'));var router=express[_0x9a74('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9a74('0x4'));var config=require(_0x9a74('0x5'));var controller=require(_0x9a74('0x6'));router[_0x9a74('0x7')]('/',auth[_0x9a74('0x8')](),controller[_0x9a74('0x9')]);router[_0x9a74('0x7')](_0x9a74('0xa'),auth[_0x9a74('0x8')](),controller[_0x9a74('0xb')]);router[_0x9a74('0x7')](_0x9a74('0xc'),auth[_0x9a74('0x8')](),controller[_0x9a74('0xd')]);router[_0x9a74('0x7')](_0x9a74('0xe'),auth[_0x9a74('0x8')](),controller[_0x9a74('0xf')]);router[_0x9a74('0x7')](_0x9a74('0x10'),controller[_0x9a74('0x11')]);router[_0x9a74('0x7')](_0x9a74('0x12'),auth[_0x9a74('0x8')](),controller['downloadTranscribe']);router[_0x9a74('0x13')]('/',auth[_0x9a74('0x8')](),controller['create']);router[_0x9a74('0x13')](_0x9a74('0x12'),auth[_0x9a74('0x8')](),controller[_0x9a74('0x14')]);router[_0x9a74('0x15')](_0x9a74('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x9a74('0x16')](_0x9a74('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9a74('0x17')]=router; \ No newline at end of file +var _0xc41c=['/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0xc41c,0xdb));var _0xcc41=function(_0x14a83c,_0x394b54){_0x14a83c=_0x14a83c-0x0;var _0x345d56=_0xc41c[_0x14a83c];return _0x345d56;};'use strict';var multer=require('multer');var util=require(_0xcc41('0x0'));var path=require(_0xcc41('0x1'));var timeout=require(_0xcc41('0x2'));var express=require(_0xcc41('0x3'));var router=express[_0xcc41('0x4')]();var fs_extra=require(_0xcc41('0x5'));var auth=require(_0xcc41('0x6'));var interaction=require(_0xcc41('0x7'));var config=require('../../config/environment');var controller=require(_0xcc41('0x8'));router[_0xcc41('0x9')]('/',auth[_0xcc41('0xa')](),controller[_0xcc41('0xb')]);router[_0xcc41('0x9')](_0xcc41('0xc'),auth['isAuthenticated'](),controller[_0xcc41('0xd')]);router['get'](_0xcc41('0xe'),auth[_0xcc41('0xa')](),controller['show']);router[_0xcc41('0x9')](_0xcc41('0xf'),auth['isAuthenticated'](),controller[_0xcc41('0x10')]);router[_0xcc41('0x9')](_0xcc41('0x11'),controller[_0xcc41('0x12')]);router[_0xcc41('0x9')](_0xcc41('0x13'),auth[_0xcc41('0xa')](),controller[_0xcc41('0x14')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xcc41('0x15')](_0xcc41('0x13'),auth[_0xcc41('0xa')](),controller[_0xcc41('0x16')]);router['put'](_0xcc41('0xe'),auth[_0xcc41('0xa')](),controller[_0xcc41('0x17')]);router[_0xcc41('0x18')]('/:id',auth[_0xcc41('0xa')](),controller[_0xcc41('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index d023798..ab63e58 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(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 f622983..12cdc33 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 _0xc083=['apply','reject','save','destroy','error','name','send','map','VoiceRecording','fieldName','type','key','model','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','show','params','length','merge','find','create','body','update','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','col','token','$and','push','secrets','ValidationError','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','createBucket','upload','TranscribeService','startTranscriptionJob','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','writeFile','downloadTranscribe','findOne','fileText','root','/server/files/transcribes/transcribe_','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json'];(function(_0xc36b8,_0x473435){var _0x5eb6ee=function(_0x30d11b){while(--_0x30d11b){_0xc36b8['push'](_0xc36b8['shift']());}};_0x5eb6ee(++_0x473435);}(_0xc083,0x10d));var _0x3c08=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc083[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x3c08('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3c08('0x1'));var jsonpatch=require(_0x3c08('0x2'));var rp=require('request-promise');var moment=require(_0x3c08('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3c08('0x4'));var util=require(_0x3c08('0x5'));var path=require(_0x3c08('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3c08('0x7'));var fs=require('fs');var fs_extra=require(_0x3c08('0x8'));var _=require(_0x3c08('0x9'));var squel=require('squel');var crypto=require(_0x3c08('0xa'));var jsforce=require(_0x3c08('0xb'));var deskjs=require(_0x3c08('0xc'));var toCsv=require(_0x3c08('0xd'));var querystring=require(_0x3c08('0xe'));var Papa=require(_0x3c08('0xf'));var AWS=require(_0x3c08('0x10'));var uuidv4=require(_0x3c08('0x11'));var Redis=require(_0x3c08('0x12'));var authService=require(_0x3c08('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3c08('0x14'));var hardwareService=require(_0x3c08('0x15'));var logger=require(_0x3c08('0x16'))('api');var utils=require(_0x3c08('0x17'));var config=require(_0x3c08('0x18'));var licenseUtil=require(_0x3c08('0x19'));var db=require(_0x3c08('0x1a'))['db'];function respondWithStatusCode(_0x5caec8,_0x5677ce){_0x5677ce=_0x5677ce||0xcc;return function(_0x2c3b4d){if(_0x2c3b4d){return _0x5caec8[_0x3c08('0x1b')](_0x5677ce);}return _0x5caec8[_0x3c08('0x1c')](_0x5677ce)[_0x3c08('0x1d')]();};}function respondWithResult(_0x3aa790,_0x283d65){_0x283d65=_0x283d65||0xc8;return function(_0x259697){if(_0x259697){return _0x3aa790['status'](_0x283d65)['json'](_0x259697);}};}function respondWithFilteredResult(_0x2bfa49,_0x30392e){return function(_0x2bafc9){if(_0x2bafc9){var _0x3c1655=typeof _0x30392e[_0x3c08('0x1e')]===_0x3c08('0x1f')&&typeof _0x30392e[_0x3c08('0x20')]==='undefined';var _0x3c2b5e=_0x2bafc9[_0x3c08('0x21')];var _0x40251f=_0x3c1655?0x0:_0x30392e[_0x3c08('0x1e')];var _0x53b393=_0x3c1655?_0x2bafc9[_0x3c08('0x21')]:_0x30392e[_0x3c08('0x1e')]+_0x30392e['limit'];var _0x59a73d;if(_0x53b393>=_0x3c2b5e){_0x53b393=_0x3c2b5e;_0x59a73d=0xc8;}else{_0x59a73d=0xce;}_0x2bfa49[_0x3c08('0x1c')](_0x59a73d);return _0x2bfa49[_0x3c08('0x22')](_0x3c08('0x23'),_0x40251f+'-'+_0x53b393+'/'+_0x3c2b5e)[_0x3c08('0x24')](_0x2bafc9);}return null;};}function patchUpdates(_0x3df7a0){return function(_0x16428a){try{jsonpatch[_0x3c08('0x25')](_0x16428a,_0x3df7a0,!![]);}catch(_0x4595e5){return BPromise[_0x3c08('0x26')](_0x4595e5);}return _0x16428a[_0x3c08('0x27')]();};}function saveUpdates(_0x113dee,_0x363f6b){return function(_0x4c73df){if(_0x4c73df){return _0x4c73df['update'](_0x113dee)['then'](function(_0x3818fb){return _0x3818fb;});}return null;};}function removeEntity(_0x3eaa54,_0x4b8fed){return function(_0x1ea5a2){if(_0x1ea5a2){return _0x1ea5a2[_0x3c08('0x28')]()['then'](function(){_0x3eaa54[_0x3c08('0x1c')](0xcc)[_0x3c08('0x1d')]();});}};}function handleEntityNotFound(_0x1b201d,_0x4589fc){return function(_0x352b87){if(!_0x352b87){_0x1b201d[_0x3c08('0x1b')](0x194);}return _0x352b87;};}function handleError(_0x219c96,_0x172e5a){_0x172e5a=_0x172e5a||0x1f4;return function(_0x1ff15a){logger[_0x3c08('0x29')](_0x1ff15a['stack']);if(_0x1ff15a[_0x3c08('0x2a')]){delete _0x1ff15a[_0x3c08('0x2a')];}_0x219c96[_0x3c08('0x1c')](_0x172e5a)[_0x3c08('0x2b')](_0x1ff15a);};}exports['index']=function(_0x50594f,_0x3ec15d){var _0x672e64={},_0x49d661={},_0xba6ae1={'count':0x0,'rows':[]};var _0x599e0e=_[_0x3c08('0x2c')](db[_0x3c08('0x2d')]['rawAttributes'],function(_0x39fa9c){return{'name':_0x39fa9c[_0x3c08('0x2e')],'type':_0x39fa9c[_0x3c08('0x2f')][_0x3c08('0x30')]};});_0x49d661[_0x3c08('0x31')]=_['differenceBy'](_[_0x3c08('0x2c')](_0x599e0e,_0x3c08('0x2a')),[_0x3c08('0x32')]);_0x49d661[_0x3c08('0x33')]=_[_0x3c08('0x34')](_0x50594f[_0x3c08('0x33')]);_0x49d661[_0x3c08('0x35')]=_[_0x3c08('0x36')](_0x49d661[_0x3c08('0x31')],_0x49d661[_0x3c08('0x33')]);_0x672e64[_0x3c08('0x37')]=_[_0x3c08('0x36')](_0x49d661[_0x3c08('0x31')],qs[_0x3c08('0x38')](_0x50594f[_0x3c08('0x33')]['fields']));_0x672e64[_0x3c08('0x37')]=_0x672e64[_0x3c08('0x37')]['length']?_0x672e64[_0x3c08('0x37')]:_0x49d661[_0x3c08('0x31')];if(!_0x50594f[_0x3c08('0x33')][_0x3c08('0x39')](_0x3c08('0x3a'))){_0x672e64[_0x3c08('0x20')]=qs['limit'](_0x50594f[_0x3c08('0x33')][_0x3c08('0x20')]);_0x672e64[_0x3c08('0x1e')]=qs[_0x3c08('0x1e')](_0x50594f[_0x3c08('0x33')][_0x3c08('0x1e')]);}_0x672e64[_0x3c08('0x3b')]=qs[_0x3c08('0x3c')](_0x50594f[_0x3c08('0x33')][_0x3c08('0x3c')]);_0x672e64[_0x3c08('0x3d')]=qs[_0x3c08('0x35')](_[_0x3c08('0x3e')](_0x50594f['query'],_0x49d661[_0x3c08('0x35')]),_0x599e0e);if(_0x50594f['query'][_0x3c08('0x3f')]){_0x672e64[_0x3c08('0x3d')]=_['merge'](_0x672e64['where'],{'$or':_['map'](_0x599e0e,function(_0x46a602){if(_0x46a602[_0x3c08('0x2f')]!==_0x3c08('0x40')){var _0x13e6c0={};_0x13e6c0[_0x46a602[_0x3c08('0x2a')]]={'$like':'%'+_0x50594f[_0x3c08('0x33')][_0x3c08('0x3f')]+'%'};return _0x13e6c0;}})});}_0x672e64=_['merge']({},_0x672e64,_0x50594f[_0x3c08('0x41')]);var _0x1bedf7={'where':_0x672e64[_0x3c08('0x3d')]};return db[_0x3c08('0x2d')]['count'](_0x1bedf7)['then'](function(_0x249a12){_0xba6ae1[_0x3c08('0x21')]=_0x249a12;if(_0x50594f[_0x3c08('0x33')][_0x3c08('0x42')]){_0x672e64[_0x3c08('0x43')]=[{'all':!![]}];}return db[_0x3c08('0x2d')][_0x3c08('0x44')](_0x672e64);})[_0x3c08('0x45')](function(_0xa0eeaa){_0xba6ae1[_0x3c08('0x46')]=_0xa0eeaa;return _0xba6ae1;})[_0x3c08('0x45')](respondWithFilteredResult(_0x3ec15d,_0x672e64))[_0x3c08('0x47')](handleError(_0x3ec15d,null));};exports[_0x3c08('0x48')]=function(_0x1e4a11,_0x347f26){var _0x4d0024={'raw':![],'where':{'id':_0x1e4a11[_0x3c08('0x49')]['id']}},_0x402537={};_0x402537['model']=_[_0x3c08('0x34')](db[_0x3c08('0x2d')]['rawAttributes']);_0x402537['query']=_[_0x3c08('0x34')](_0x1e4a11[_0x3c08('0x33')]);_0x402537[_0x3c08('0x35')]=_['intersection'](_0x402537[_0x3c08('0x31')],_0x402537['query']);_0x4d0024[_0x3c08('0x37')]=_[_0x3c08('0x36')](_0x402537[_0x3c08('0x31')],qs[_0x3c08('0x38')](_0x1e4a11[_0x3c08('0x33')][_0x3c08('0x38')]));_0x4d0024[_0x3c08('0x37')]=_0x4d0024[_0x3c08('0x37')][_0x3c08('0x4a')]?_0x4d0024['attributes']:_0x402537[_0x3c08('0x31')];if(_0x1e4a11[_0x3c08('0x33')][_0x3c08('0x42')]){_0x4d0024[_0x3c08('0x43')]=[{'all':!![]}];}_0x4d0024=_[_0x3c08('0x4b')]({},_0x4d0024,_0x1e4a11[_0x3c08('0x41')]);return db[_0x3c08('0x2d')][_0x3c08('0x4c')](_0x4d0024)[_0x3c08('0x45')](handleEntityNotFound(_0x347f26,null))[_0x3c08('0x45')](respondWithResult(_0x347f26,null))['catch'](handleError(_0x347f26,null));};exports[_0x3c08('0x4d')]=function(_0x3d503b,_0x52393e){return db[_0x3c08('0x2d')][_0x3c08('0x4d')](_0x3d503b[_0x3c08('0x4e')],{})[_0x3c08('0x45')](respondWithResult(_0x52393e,0xc9))[_0x3c08('0x47')](handleError(_0x52393e,null));};exports[_0x3c08('0x4f')]=function(_0x4427ee,_0x3a0dd9){if(_0x4427ee[_0x3c08('0x4e')]['id']){delete _0x4427ee[_0x3c08('0x4e')]['id'];}return db['VoiceRecording'][_0x3c08('0x4c')]({'where':{'id':_0x4427ee[_0x3c08('0x49')]['id']}})[_0x3c08('0x45')](handleEntityNotFound(_0x3a0dd9,null))[_0x3c08('0x45')](saveUpdates(_0x4427ee['body'],null))[_0x3c08('0x45')](respondWithResult(_0x3a0dd9,null))[_0x3c08('0x47')](handleError(_0x3a0dd9,null));};exports[_0x3c08('0x50')]=function(_0x17c400,_0x54c1ff){return db[_0x3c08('0x2d')][_0x3c08('0x50')]()[_0x3c08('0x45')](respondWithResult(_0x54c1ff,null))[_0x3c08('0x47')](handleError(_0x54c1ff,null));};exports[_0x3c08('0x51')]=function(_0x23c41a,_0x35aa61,_0x1a59a1){var _0x29cdd4=require(_0x3c08('0x52'));var _0x235730=![];var _0x1bded3={};if(_0x23c41a[_0x3c08('0x33')][_0x3c08('0x2f')]&&_0x23c41a[_0x3c08('0x33')][_0x3c08('0x2f')]===_0x3c08('0x53')){_0x1bded3[_0x3c08('0x53')]=_0x23c41a[_0x3c08('0x49')]['id'];}else{_0x1bded3['id']=_0x23c41a[_0x3c08('0x49')]['id'];}return db[_0x3c08('0x2d')]['find']({'where':_0x1bded3,'attributes':['id',_0x3c08('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x35aa61,null))[_0x3c08('0x45')](function(_0x333566){if(_0x333566){var _0x1891ad=_0x333566[_0x3c08('0x54')];var _0x39abc8=util['format'](_0x3c08('0x55'),_0x1891ad);if(fs[_0x3c08('0x56')](_0x39abc8)){_0x235730=!![];return _0x29cdd4[_0x3c08('0x57')](_0x39abc8,_0x1891ad,config['secrets'][_0x3c08('0x58')])[_0x3c08('0x45')](function(){return _0x333566;});}return _0x333566;}})[_0x3c08('0x45')](function(_0x1f8b6b){if(_0x1f8b6b){var _0x26325f=_0x1f8b6b[_0x3c08('0x54')];if(!fs[_0x3c08('0x56')](_0x26325f)){throw new db[(_0x3c08('0x59'))]['ValidationError'](_0x3c08('0x5a'));}if(_0x1f8b6b[_0x3c08('0x5b')]){return _0x35aa61[_0x3c08('0x51')](_0x26325f,_0x1f8b6b[_0x3c08('0x5b')]+path[_0x3c08('0x5c')](_0x26325f),function(){if(_0x235730){fs[_0x3c08('0x5d')](_0x26325f);}});}else{return _0x35aa61[_0x3c08('0x51')](_0x26325f,function(_0x5c0899){if(_0x235730){fs[_0x3c08('0x5d')](_0x26325f);}});}}})[_0x3c08('0x47')](function(_0x576e8c){if(_0x576e8c['message']===_0x3c08('0x5a')){_0x35aa61[_0x3c08('0x1c')](0x194)[_0x3c08('0x2b')](_0x3c08('0x5e'));}else{return handleError(_0x35aa61,null);}});};exports[_0x3c08('0x5f')]=function(_0x53bf92,_0x47bb36,_0x547daf){var _0x2892ab=require(_0x3c08('0x52'));var _0x3bd8fa=![];var _0x5010d3={'$and':[db['sequelize'][_0x3c08('0x3d')](db['sequelize']['fn']('MD5',db[_0x3c08('0x60')][_0x3c08('0x61')]('uniqueid')),_0x53bf92[_0x3c08('0x33')][_0x3c08('0x62')])]};if(_0x53bf92['query']['type']&&_0x53bf92[_0x3c08('0x33')]['type']===_0x3c08('0x53')){_0x5010d3[_0x3c08('0x63')][_0x3c08('0x64')]({'uniqueid':_0x53bf92[_0x3c08('0x49')]['id']});}else{_0x5010d3['$and']['push']({'id':_0x53bf92[_0x3c08('0x49')]['id']});}return db['VoiceRecording'][_0x3c08('0x4c')]({'where':_0x5010d3,'attributes':['id',_0x3c08('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x47bb36,null))[_0x3c08('0x45')](function(_0x47f6a0){if(_0x47f6a0){var _0x1edd94=util[_0x3c08('0x32')]('%s.cypher',_0x47f6a0[_0x3c08('0x54')]);if(fs[_0x3c08('0x56')](_0x1edd94)){_0x3bd8fa=!![];return _0x2892ab['decryptFile'](_0x1edd94,_0x47f6a0[_0x3c08('0x54')],config[_0x3c08('0x65')][_0x3c08('0x58')])[_0x3c08('0x45')](function(){return _0x47f6a0;});}return _0x47f6a0;}})[_0x3c08('0x45')](function(_0x31aa04){if(_0x31aa04){if(!fs[_0x3c08('0x56')](_0x31aa04[_0x3c08('0x54')])){throw new db[(_0x3c08('0x59'))][(_0x3c08('0x66'))](_0x3c08('0x5a'));}if(_0x31aa04['filename']){return _0x47bb36[_0x3c08('0x51')](_0x31aa04[_0x3c08('0x54')],_0x31aa04['filename']+path['extname'](_0x31aa04[_0x3c08('0x54')]),function(){if(_0x3bd8fa){fs[_0x3c08('0x5d')](_0x31aa04['value']);}});}else{return _0x47bb36[_0x3c08('0x51')](_0x31aa04[_0x3c08('0x54')],function(_0x6f29ac){if(_0x3bd8fa){fs[_0x3c08('0x5d')](_0x31aa04['value']);}});}}})[_0x3c08('0x47')](handleError(_0x47bb36,null));};exports[_0x3c08('0x28')]=function(_0x5e470c,_0x523210){return db['VoiceRecording']['find']({'where':{'id':_0x5e470c[_0x3c08('0x49')]['id']}})[_0x3c08('0x45')](function(_0xfaf3c4){if(_[_0x3c08('0x67')](_0xfaf3c4)){throw new ReferenceError(_0x3c08('0x68'));}return _0xfaf3c4;})[_0x3c08('0x45')](function(_0x12032f){var _0x4db85e=_0x12032f['value'];logger[_0x3c08('0x69')](_0x3c08('0x6a'),_0x4db85e);if(!_[_0x3c08('0x67')](_0x12032f[_0x3c08('0x54')])&&fs[_0x3c08('0x56')](_0x4db85e)){logger[_0x3c08('0x69')]('File:\x20\x22'+_0x4db85e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3c08('0x6b')](_0x4db85e);}_0x4db85e=_0x4db85e+_0x3c08('0x6c');if(!_['isNil'](_0x12032f[_0x3c08('0x54')])&&fs[_0x3c08('0x56')](_0x4db85e)){logger[_0x3c08('0x69')]('File:\x20\x22'+_0x4db85e+_0x3c08('0x6d'));fs[_0x3c08('0x6b')](_0x4db85e);}return _0x12032f;})[_0x3c08('0x45')](function(_0x567605){if(!_0x567605)throw new InternalError();return _0x567605[_0x3c08('0x28')]();})['then'](function(){_0x523210[_0x3c08('0x1c')](0xcc)[_0x3c08('0x1d')]();})[_0x3c08('0x47')](handleError(_0x523210,null));};function getBucketslist(_0x2cf428,_0x243665,_0x113cc1){return new Promise(function(_0x4dbd52,_0x1db2f1){var _0x385c06=new AWS['S3']({'accessKeyId':_0x243665,'secretAccessKey':_0x2cf428,'region':_0x113cc1});_0x385c06['listBuckets']({},function(_0x49c2e2,_0x2f38f1){if(_0x49c2e2){return _0x1db2f1(_0x49c2e2);}else{return _0x4dbd52(_0x2f38f1);}});});}function createBucket(_0x2f5867,_0x243c58,_0x8e97de,_0x6dcfd5){return new Promise(function(_0x227e09,_0x4947c9){var _0x3a941b=new AWS['S3']({'accessKeyId':_0x243c58,'secretAccessKey':_0x2f5867,'region':_0x8e97de});_0x3a941b[_0x3c08('0x6e')]({'Bucket':_0x6dcfd5},function(_0x5bbf24,_0x5638fc){if(_0x5bbf24){return _0x4947c9(_0x5bbf24);}else{return _0x227e09(_0x5638fc);}});});}function uploadFile(_0x36d9cb,_0x501d5b,_0x5db96b,_0x550706,_0x10d18a,_0xfc52b5){return new Promise(function(_0x28f406,_0x481b6b){var _0x48ca6c=new AWS['S3']({'accessKeyId':_0x501d5b,'secretAccessKey':_0x36d9cb,'region':_0x5db96b});_0x48ca6c[_0x3c08('0x6f')]({'Bucket':_0x550706,'Key':_0x10d18a,'Body':_0xfc52b5},function(_0x40a8a6,_0x54def2){if(_0x40a8a6){return _0x481b6b(_0x40a8a6);}else{return _0x28f406(_0x54def2);}});});}function startTranscribe(_0x2966e4,_0x41ee09,_0x266bf4,_0x4ac01b,_0x121684,_0x1c8338){return new Promise(function(_0x2df8f8,_0x368e0c){var _0x2fb202=new AWS[(_0x3c08('0x70'))]({'accessKeyId':_0x41ee09,'secretAccessKey':_0x2966e4,'region':_0x266bf4});_0x2fb202[_0x3c08('0x71')]({'TranscriptionJobName':_0x4ac01b,'LanguageCode':_0x121684,'Media':{'MediaFileUri':_0x1c8338}},function(_0x2a29b2,_0x4e5c62){if(_0x2a29b2){return _0x368e0c(_0x2a29b2);}else{return _0x2df8f8(_0x4e5c62);}});});}function transcribe(_0x52e141,_0x1be6d1,_0x1c3fa2,_0x292fb9,_0x16d18b,_0x2801b0,_0x322d76){return new Promise(function(_0x1def06,_0x4ae9f3){var _0x5a233e={};logger[_0x3c08('0x69')](util[_0x3c08('0x32')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x52e141,_0x16d18b));return uploadFile(_0x1be6d1,_0x1c3fa2,_0x292fb9,_0x16d18b,path['basename'](_0x2801b0),fs[_0x3c08('0x72')](_0x2801b0))[_0x3c08('0x45')](function(_0x274cd3){logger[_0x3c08('0x69')](util['format'](_0x3c08('0x73'),_0x52e141,_0x16d18b,_0x274cd3['Location']));_0x5a233e[_0x3c08('0x74')]=_0x274cd3[_0x3c08('0x75')];_0x5a233e[_0x3c08('0x76')]=_0x274cd3['Location'];logger[_0x3c08('0x69')](util[_0x3c08('0x32')](_0x3c08('0x77'),_0x52e141));return startTranscribe(_0x1be6d1,_0x1c3fa2,_0x292fb9,uuidv4(),_0x322d76,_0x274cd3[_0x3c08('0x78')]);})[_0x3c08('0x45')](function(_0x4146d2){logger[_0x3c08('0x69')](util[_0x3c08('0x32')](_0x3c08('0x79'),_0x52e141,_0x4146d2[_0x3c08('0x7a')][_0x3c08('0x7b')]));_0x5a233e[_0x3c08('0x7c')]=_0x4146d2[_0x3c08('0x7a')][_0x3c08('0x7b')];_0x5a233e['transcribeStatus']=_0x4146d2['TranscriptionJob'][_0x3c08('0x7d')];return _0x1def06(_0x5a233e);})[_0x3c08('0x47')](function(_0xc9471a){return _0x4ae9f3(_0xc9471a);});});}exports[_0x3c08('0x7e')]=function(_0x4083a5,_0x4b66bd,_0x3b396f){var _0x18bee9;var _0x85f15a;var _0x37189d;var _0x427af1=require(_0x3c08('0x52'));return db['VoiceRecording']['findOne']({'where':{'id':_0x4083a5['params']['id']}})['then'](function(_0x52fa20){if(_0x52fa20){var _0x6ad3af=util['format'](_0x3c08('0x55'),_0x52fa20[_0x3c08('0x54')]);if(fs[_0x3c08('0x56')](_0x6ad3af)){cypher=!![];return _0x427af1[_0x3c08('0x57')](_0x6ad3af,_0x52fa20[_0x3c08('0x54')],config[_0x3c08('0x65')][_0x3c08('0x58')])[_0x3c08('0x45')](function(){return _0x52fa20;});}return _0x52fa20;}})[_0x3c08('0x45')](function(_0x2a4c39){if(!_0x2a4c39){throw new db['Sequelize'][(_0x3c08('0x66'))](_0x3c08('0x7f'));}_0x85f15a=_0x2a4c39;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x3c08('0x45')](handleEntityNotFound(_0x4b66bd,null))[_0x3c08('0x45')](function(_0x361650){if(_0x361650){_0x18bee9=_0x361650;if(!_0x18bee9[_0x3c08('0x80')]||!_0x18bee9[_0x3c08('0x81')]||!_0x18bee9[_0x3c08('0x82')]||!_0x18bee9[_0x3c08('0x83')]||!_0x18bee9[_0x3c08('0x74')]){throw new db['Sequelize']['ValidationError'](_0x3c08('0x84'));}if(_0x4083a5[_0x3c08('0x4e')][_0x3c08('0x85')]&&(!_0x18bee9[_0x3c08('0x86')]||!_0x18bee9[_0x3c08('0x87')]||!_0x18bee9['sentimentRegion']||!_0x18bee9[_0x3c08('0x83')]||!_0x18bee9['bucket'])){throw new db['Sequelize'][(_0x3c08('0x66'))](_0x3c08('0x88'));}return db['CloudProvider']['findOne']({'where':{'id':_0x18bee9[_0x3c08('0x81')]}});}})[_0x3c08('0x45')](function(_0x3f9f71){if(!_0x3f9f71){throw new db[(_0x3c08('0x59'))][(_0x3c08('0x66'))](_0x3c08('0x89'));}if(!_0x3f9f71[_0x3c08('0x8a')]||!_0x3f9f71[_0x3c08('0x8b')]){throw new db[(_0x3c08('0x59'))][(_0x3c08('0x66'))](_0x3c08('0x8c'));}_0x37189d=_0x3f9f71;return getBucketslist(_0x37189d['data1'],_0x37189d[_0x3c08('0x8b')],_0x18bee9[_0x3c08('0x82')]);})[_0x3c08('0x45')](function(_0x553d0a){if(_0x553d0a&&_0x553d0a[_0x3c08('0x8d')]){var _0x25703d=_[_0x3c08('0x4c')](_0x553d0a[_0x3c08('0x8d')],function(_0x50d160){return _0x50d160[_0x3c08('0x8e')]===_0x18bee9[_0x3c08('0x74')];});if(!_0x25703d){logger['info'](util['format'](_0x3c08('0x8f'),_0x4083a5[_0x3c08('0x49')]['id'],_0x18bee9['bucket']));return createBucket(_0x37189d[_0x3c08('0x8a')],_0x37189d['data2'],_0x18bee9[_0x3c08('0x82')],_0x18bee9[_0x3c08('0x74')]);}logger[_0x3c08('0x69')](util[_0x3c08('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x4083a5[_0x3c08('0x49')]['id'],_0x18bee9[_0x3c08('0x74')]));return;}})[_0x3c08('0x45')](function(_0x277af1){if(_0x85f15a[_0x3c08('0x90')]==='NEW'){return transcribe(_0x4083a5['params']['id'],_0x37189d['data1'],_0x37189d['data2'],_0x18bee9[_0x3c08('0x82')],_0x18bee9['bucket'],_0x85f15a[_0x3c08('0x54')],_0x18bee9[_0x3c08('0x83')]);}else{logger[_0x3c08('0x69')](util['format'](_0x3c08('0x91'),_0x4083a5[_0x3c08('0x49')]['id']));return{'transcribeStatus':_0x3c08('0x92')};}})['then'](function(_0x9a23d4){if(_0x9a23d4){_0x9a23d4['tempSentiment']=_0x4083a5[_0x3c08('0x4e')][_0x3c08('0x85')];return _0x85f15a['updateAttributes'](_0x9a23d4);}})[_0x3c08('0x45')](respondWithResult(_0x4b66bd,null))['catch'](handleError(_0x4b66bd,null));};function writeFile(_0x404648,_0x49b5f3){return new Promise(function(_0x4df014,_0x1b2a9b){fs[_0x3c08('0x93')](_0x49b5f3,_0x404648,function(_0x1772e6,_0xac2310){if(_0x1772e6){return _0x1b2a9b(_0x1772e6);}else{return _0x4df014(_0xac2310);}});});}exports[_0x3c08('0x94')]=function(_0x402842,_0x2ba60c,_0x5d9fb6){return db['VoiceRecording'][_0x3c08('0x95')]({'where':{'id':_0x402842['params']['id']}})[_0x3c08('0x45')](handleEntityNotFound(_0x2ba60c))['then'](function(_0x57ea38){if(_0x57ea38&&_0x57ea38['fileText']){var _0x2f7cf5=_0x57ea38[_0x3c08('0x96')];var _0x3c0bc9=config[_0x3c08('0x97')]+_0x3c08('0x98')+_0x57ea38['id']+'.txt';if(fs[_0x3c08('0x56')](_0x3c0bc9)){return _0x3c0bc9;}return writeFile(_0x2f7cf5,_0x3c0bc9)['then'](function(){return _0x3c0bc9;});}else{throw new db[(_0x3c08('0x59'))][(_0x3c08('0x66'))]('Transcript\x20not\x20available');}})[_0x3c08('0x45')](function(_0x161019){return _0x2ba60c[_0x3c08('0x51')](_0x161019);})[_0x3c08('0x47')](handleError(_0x2ba60c));}; \ No newline at end of file +var _0x93f4=['[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','findOne','Setting','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','differenceBy','format','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','download','../../components/encryptor','type','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','sequelize','MD5','$and','push','recording','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request'];(function(_0x40c986,_0x2700c8){var _0x3b4231=function(_0x20f373){while(--_0x20f373){_0x40c986['push'](_0x40c986['shift']());}};_0x3b4231(++_0x2700c8);}(_0x93f4,0xbf));var _0x493f=function(_0x119de2,_0x4ca9ad){_0x119de2=_0x119de2-0x0;var _0x32db9b=_0x93f4[_0x119de2];return _0x32db9b;};'use strict';var emlformat=require(_0x493f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x493f('0x1'));var jsonpatch=require(_0x493f('0x2'));var rp=require('request-promise');var moment=require(_0x493f('0x3'));var BPromise=require(_0x493f('0x4'));var Mustache=require(_0x493f('0x5'));var util=require(_0x493f('0x6'));var path=require(_0x493f('0x7'));var sox=require(_0x493f('0x8'));var csv=require('to-csv');var ejs=require(_0x493f('0x9'));var fs=require('fs');var fs_extra=require(_0x493f('0xa'));var _=require(_0x493f('0xb'));var squel=require(_0x493f('0xc'));var crypto=require(_0x493f('0xd'));var jsforce=require(_0x493f('0xe'));var deskjs=require(_0x493f('0xf'));var toCsv=require(_0x493f('0x10'));var querystring=require(_0x493f('0x11'));var Papa=require(_0x493f('0x12'));var AWS=require(_0x493f('0x13'));var uuidv4=require(_0x493f('0x14'));var Redis=require(_0x493f('0x15'));var authService=require(_0x493f('0x16'));var qs=require(_0x493f('0x17'));var as=require(_0x493f('0x18'));var hardwareService=require(_0x493f('0x19'));var logger=require(_0x493f('0x1a'))(_0x493f('0x1b'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x493f('0x1c'));var db=require(_0x493f('0x1d'))['db'];function respondWithStatusCode(_0x28e696,_0x953956){_0x953956=_0x953956||0xcc;return function(_0x3197fd){if(_0x3197fd){return _0x28e696[_0x493f('0x1e')](_0x953956);}return _0x28e696[_0x493f('0x1f')](_0x953956)[_0x493f('0x20')]();};}function respondWithResult(_0x4edc39,_0x12473a){_0x12473a=_0x12473a||0xc8;return function(_0x52204a){if(_0x52204a){return _0x4edc39[_0x493f('0x1f')](_0x12473a)['json'](_0x52204a);}};}function respondWithFilteredResult(_0xac0765,_0xd9423c){return function(_0x5d47f1){if(_0x5d47f1){var _0x38c79c=typeof _0xd9423c[_0x493f('0x21')]===_0x493f('0x22')&&typeof _0xd9423c[_0x493f('0x23')]===_0x493f('0x22');var _0x51c7f3=_0x5d47f1[_0x493f('0x24')];var _0x34841f=_0x38c79c?0x0:_0xd9423c[_0x493f('0x21')];var _0x3336e0=_0x38c79c?_0x5d47f1[_0x493f('0x24')]:_0xd9423c[_0x493f('0x21')]+_0xd9423c[_0x493f('0x23')];var _0x565082;if(_0x3336e0>=_0x51c7f3){_0x3336e0=_0x51c7f3;_0x565082=0xc8;}else{_0x565082=0xce;}_0xac0765[_0x493f('0x1f')](_0x565082);return _0xac0765[_0x493f('0x25')](_0x493f('0x26'),_0x34841f+'-'+_0x3336e0+'/'+_0x51c7f3)[_0x493f('0x27')](_0x5d47f1);}return null;};}function patchUpdates(_0x51d94e){return function(_0x5e2a73){try{jsonpatch[_0x493f('0x28')](_0x5e2a73,_0x51d94e,!![]);}catch(_0x25ee9d){return BPromise[_0x493f('0x29')](_0x25ee9d);}return _0x5e2a73[_0x493f('0x2a')]();};}function saveUpdates(_0x5b80a6,_0x56e2f6){return function(_0x20016f){if(_0x20016f){return _0x20016f[_0x493f('0x2b')](_0x5b80a6)[_0x493f('0x2c')](function(_0x13d2ee){return _0x13d2ee;});}return null;};}function removeEntity(_0x459f70,_0x2ebd2e){return function(_0x567ed1){if(_0x567ed1){return _0x567ed1[_0x493f('0x2d')]()[_0x493f('0x2c')](function(){_0x459f70[_0x493f('0x1f')](0xcc)[_0x493f('0x20')]();});}};}function handleEntityNotFound(_0x5abaa3,_0x5b32cc){return function(_0x1cbad3){if(!_0x1cbad3){_0x5abaa3[_0x493f('0x1e')](0x194);}return _0x1cbad3;};}function handleError(_0x4909c1,_0x4662d1){_0x4662d1=_0x4662d1||0x1f4;return function(_0x277594){logger[_0x493f('0x2e')](_0x277594[_0x493f('0x2f')]);if(_0x277594['name']){delete _0x277594[_0x493f('0x30')];}_0x4909c1[_0x493f('0x1f')](_0x4662d1)[_0x493f('0x31')](_0x277594);};}exports[_0x493f('0x32')]=function(_0xa403f5,_0x8882a7){var _0x477290={},_0x2b58f0={},_0x3d488b={'count':0x0,'rows':[]};var _0x40f77f=_[_0x493f('0x33')](db[_0x493f('0x34')][_0x493f('0x35')],function(_0x243009){return{'name':_0x243009[_0x493f('0x36')],'type':_0x243009['type'][_0x493f('0x37')]};});_0x2b58f0['model']=_[_0x493f('0x38')](_[_0x493f('0x33')](_0x40f77f,_0x493f('0x30')),[_0x493f('0x39')]);_0x2b58f0['query']=_['keys'](_0xa403f5['query']);_0x2b58f0[_0x493f('0x3a')]=_[_0x493f('0x3b')](_0x2b58f0[_0x493f('0x3c')],_0x2b58f0[_0x493f('0x3d')]);_0x477290['attributes']=_[_0x493f('0x3b')](_0x2b58f0[_0x493f('0x3c')],qs['fields'](_0xa403f5[_0x493f('0x3d')][_0x493f('0x3e')]));_0x477290[_0x493f('0x3f')]=_0x477290[_0x493f('0x3f')][_0x493f('0x40')]?_0x477290[_0x493f('0x3f')]:_0x2b58f0[_0x493f('0x3c')];if(!_0xa403f5['query'][_0x493f('0x41')](_0x493f('0x42'))){_0x477290['limit']=qs[_0x493f('0x23')](_0xa403f5['query'][_0x493f('0x23')]);_0x477290[_0x493f('0x21')]=qs[_0x493f('0x21')](_0xa403f5[_0x493f('0x3d')][_0x493f('0x21')]);}_0x477290[_0x493f('0x43')]=qs[_0x493f('0x44')](_0xa403f5[_0x493f('0x3d')][_0x493f('0x44')]);_0x477290['where']=qs[_0x493f('0x3a')](_[_0x493f('0x45')](_0xa403f5[_0x493f('0x3d')],_0x2b58f0[_0x493f('0x3a')]),_0x40f77f);if(_0xa403f5[_0x493f('0x3d')]['filter']){_0x477290[_0x493f('0x46')]=_[_0x493f('0x47')](_0x477290[_0x493f('0x46')],{'$or':_['map'](_0x40f77f,function(_0x2e0657){if(_0x2e0657['type']!==_0x493f('0x48')){var _0x120929={};_0x120929[_0x2e0657['name']]={'$like':'%'+_0xa403f5[_0x493f('0x3d')][_0x493f('0x49')]+'%'};return _0x120929;}})});}_0x477290=_[_0x493f('0x47')]({},_0x477290,_0xa403f5[_0x493f('0x4a')]);var _0x157887={'where':_0x477290[_0x493f('0x46')]};return db['VoiceRecording'][_0x493f('0x24')](_0x157887)[_0x493f('0x2c')](function(_0x4f022c){_0x3d488b[_0x493f('0x24')]=_0x4f022c;if(_0xa403f5[_0x493f('0x3d')][_0x493f('0x4b')]){_0x477290[_0x493f('0x4c')]=[{'all':!![]}];}return db[_0x493f('0x34')][_0x493f('0x4d')](_0x477290);})[_0x493f('0x2c')](function(_0x190a2f){_0x3d488b[_0x493f('0x4e')]=_0x190a2f;return _0x3d488b;})['then'](respondWithFilteredResult(_0x8882a7,_0x477290))['catch'](handleError(_0x8882a7,null));};exports[_0x493f('0x4f')]=function(_0x3dea37,_0x5b30d0){var _0x3e298d={'raw':![],'where':{'id':_0x3dea37[_0x493f('0x50')]['id']}},_0x584ada={};_0x584ada['model']=_[_0x493f('0x51')](db[_0x493f('0x34')][_0x493f('0x35')]);_0x584ada[_0x493f('0x3d')]=_[_0x493f('0x51')](_0x3dea37[_0x493f('0x3d')]);_0x584ada[_0x493f('0x3a')]=_[_0x493f('0x3b')](_0x584ada[_0x493f('0x3c')],_0x584ada[_0x493f('0x3d')]);_0x3e298d[_0x493f('0x3f')]=_[_0x493f('0x3b')](_0x584ada[_0x493f('0x3c')],qs['fields'](_0x3dea37[_0x493f('0x3d')][_0x493f('0x3e')]));_0x3e298d[_0x493f('0x3f')]=_0x3e298d[_0x493f('0x3f')][_0x493f('0x40')]?_0x3e298d['attributes']:_0x584ada[_0x493f('0x3c')];if(_0x3dea37[_0x493f('0x3d')][_0x493f('0x4b')]){_0x3e298d[_0x493f('0x4c')]=[{'all':!![]}];}_0x3e298d=_[_0x493f('0x47')]({},_0x3e298d,_0x3dea37[_0x493f('0x4a')]);return db[_0x493f('0x34')][_0x493f('0x52')](_0x3e298d)['then'](handleEntityNotFound(_0x5b30d0,null))[_0x493f('0x2c')](respondWithResult(_0x5b30d0,null))[_0x493f('0x53')](handleError(_0x5b30d0,null));};exports[_0x493f('0x54')]=function(_0x58605c,_0x12d1bb){return db[_0x493f('0x34')][_0x493f('0x54')](_0x58605c['body'],{})[_0x493f('0x2c')](respondWithResult(_0x12d1bb,0xc9))[_0x493f('0x53')](handleError(_0x12d1bb,null));};exports['update']=function(_0x32b188,_0x4283f9){if(_0x32b188[_0x493f('0x55')]['id']){delete _0x32b188[_0x493f('0x55')]['id'];}return db[_0x493f('0x34')][_0x493f('0x52')]({'where':{'id':_0x32b188[_0x493f('0x50')]['id']}})['then'](handleEntityNotFound(_0x4283f9,null))[_0x493f('0x2c')](saveUpdates(_0x32b188[_0x493f('0x55')],null))[_0x493f('0x2c')](respondWithResult(_0x4283f9,null))[_0x493f('0x53')](handleError(_0x4283f9,null));};exports[_0x493f('0x56')]=function(_0x4abd73,_0x4c16fc){return db[_0x493f('0x34')][_0x493f('0x56')]()[_0x493f('0x2c')](respondWithResult(_0x4c16fc,null))['catch'](handleError(_0x4c16fc,null));};exports[_0x493f('0x57')]=function(_0x2278fb,_0x4f3925,_0x5f4c78){var _0x2ce8c9=require(_0x493f('0x58'));var _0xa6854f=![];var _0x53b7a4={};if(_0x2278fb[_0x493f('0x3d')][_0x493f('0x59')]&&_0x2278fb[_0x493f('0x3d')]['type']===_0x493f('0x5a')){_0x53b7a4['uniqueid']=_0x2278fb[_0x493f('0x50')]['id'];}else{_0x53b7a4['id']=_0x2278fb[_0x493f('0x50')]['id'];}return db[_0x493f('0x34')][_0x493f('0x52')]({'where':_0x53b7a4,'attributes':['id',_0x493f('0x5b')],'raw':!![]})['then'](handleEntityNotFound(_0x4f3925,null))['then'](function(_0x5f3da3){if(_0x5f3da3){var _0x2b626c=_0x5f3da3[_0x493f('0x5b')];var _0x3dc486=util['format'](_0x493f('0x5c'),_0x2b626c);if(fs[_0x493f('0x5d')](_0x3dc486)){_0xa6854f=!![];return _0x2ce8c9[_0x493f('0x5e')](_0x3dc486,_0x2b626c,config[_0x493f('0x5f')]['recording'])['then'](function(){return _0x5f3da3;});}return _0x5f3da3;}})[_0x493f('0x2c')](function(_0xfcd4e2){if(_0xfcd4e2){var _0x2ab17b=_0xfcd4e2[_0x493f('0x5b')];if(!fs['existsSync'](_0x2ab17b)){throw new db[(_0x493f('0x60'))][(_0x493f('0x61'))](_0x493f('0x62'));}if(_0xfcd4e2[_0x493f('0x63')]){return _0x4f3925[_0x493f('0x57')](_0x2ab17b,_0xfcd4e2[_0x493f('0x63')]+path[_0x493f('0x64')](_0x2ab17b),function(){if(_0xa6854f){fs[_0x493f('0x65')](_0x2ab17b);}});}else{return _0x4f3925['download'](_0x2ab17b,function(_0x494919){if(_0xa6854f){fs[_0x493f('0x65')](_0x2ab17b);}});}}})[_0x493f('0x53')](function(_0xe90b55){if(_0xe90b55[_0x493f('0x66')]===_0x493f('0x62')){_0x4f3925[_0x493f('0x1f')](0x194)[_0x493f('0x31')]('Not\x20found');}else{return handleError(_0x4f3925,null);}});};exports['downloads']=function(_0x1ca489,_0x3c67a5,_0x1f867c){var _0x232508=require(_0x493f('0x58'));var _0x15702c=![];var _0x3bde97={'$and':[db['sequelize']['where'](db[_0x493f('0x67')]['fn'](_0x493f('0x68'),db[_0x493f('0x67')]['col']('uniqueid')),_0x1ca489[_0x493f('0x3d')]['token'])]};if(_0x1ca489[_0x493f('0x3d')][_0x493f('0x59')]&&_0x1ca489['query'][_0x493f('0x59')]===_0x493f('0x5a')){_0x3bde97[_0x493f('0x69')][_0x493f('0x6a')]({'uniqueid':_0x1ca489[_0x493f('0x50')]['id']});}else{_0x3bde97[_0x493f('0x69')][_0x493f('0x6a')]({'id':_0x1ca489['params']['id']});}return db['VoiceRecording']['find']({'where':_0x3bde97,'attributes':['id',_0x493f('0x5b')],'raw':!![]})[_0x493f('0x2c')](handleEntityNotFound(_0x3c67a5,null))['then'](function(_0x1f95df){if(_0x1f95df){var _0x4e0a8f=util['format']('%s.cypher',_0x1f95df['value']);if(fs[_0x493f('0x5d')](_0x4e0a8f)){_0x15702c=!![];return _0x232508[_0x493f('0x5e')](_0x4e0a8f,_0x1f95df[_0x493f('0x5b')],config['secrets'][_0x493f('0x6b')])[_0x493f('0x2c')](function(){return _0x1f95df;});}return _0x1f95df;}})['then'](function(_0x4e8a3d){if(_0x4e8a3d){if(!fs['existsSync'](_0x4e8a3d[_0x493f('0x5b')])){throw new db[(_0x493f('0x60'))][(_0x493f('0x61'))](_0x493f('0x62'));}if(_0x4e8a3d[_0x493f('0x63')]){return _0x3c67a5[_0x493f('0x57')](_0x4e8a3d['value'],_0x4e8a3d[_0x493f('0x63')]+path['extname'](_0x4e8a3d[_0x493f('0x5b')]),function(){if(_0x15702c){fs[_0x493f('0x65')](_0x4e8a3d[_0x493f('0x5b')]);}});}else{return _0x3c67a5[_0x493f('0x57')](_0x4e8a3d[_0x493f('0x5b')],function(_0x544e44){if(_0x15702c){fs[_0x493f('0x65')](_0x4e8a3d[_0x493f('0x5b')]);}});}}})[_0x493f('0x53')](handleError(_0x3c67a5,null));};exports[_0x493f('0x2d')]=function(_0x18776f,_0x481a4c){return db[_0x493f('0x34')][_0x493f('0x52')]({'where':{'id':_0x18776f[_0x493f('0x50')]['id']}})[_0x493f('0x2c')](function(_0x3c934){if(_[_0x493f('0x6c')](_0x3c934)){throw new ReferenceError(_0x493f('0x6d'));}return _0x3c934;})[_0x493f('0x2c')](function(_0x429a12){var _0x1d1c04=_0x429a12[_0x493f('0x5b')];logger[_0x493f('0x6e')](_0x493f('0x6f'),_0x1d1c04);if(!_[_0x493f('0x6c')](_0x429a12['value'])&&fs[_0x493f('0x5d')](_0x1d1c04)){logger['info'](_0x493f('0x70')+_0x1d1c04+_0x493f('0x71'));fs[_0x493f('0x72')](_0x1d1c04);}_0x1d1c04=_0x1d1c04+_0x493f('0x73');if(!_['isNil'](_0x429a12['value'])&&fs[_0x493f('0x5d')](_0x1d1c04)){logger['info'](_0x493f('0x70')+_0x1d1c04+_0x493f('0x71'));fs['unlinkSync'](_0x1d1c04);}return _0x429a12;})['then'](function(_0x200789){if(!_0x200789)throw new InternalError();return _0x200789[_0x493f('0x2d')]();})['then'](function(){_0x481a4c[_0x493f('0x1f')](0xcc)[_0x493f('0x20')]();})[_0x493f('0x53')](handleError(_0x481a4c,null));};function getBucketslist(_0x2ca3d7,_0x4519f8,_0x534356){return new Promise(function(_0x4b8119,_0x178bff){var _0x3d41cd=new AWS['S3']({'accessKeyId':_0x4519f8,'secretAccessKey':_0x2ca3d7,'region':_0x534356});_0x3d41cd[_0x493f('0x74')]({},function(_0x3eefc4,_0x45d547){if(_0x3eefc4){return _0x178bff(_0x3eefc4);}else{return _0x4b8119(_0x45d547);}});});}function createBucket(_0x180d13,_0xd51f92,_0x549875,_0x420e5c){return new Promise(function(_0x3b3317,_0x1df79f){var _0x3ab1dd=new AWS['S3']({'accessKeyId':_0xd51f92,'secretAccessKey':_0x180d13,'region':_0x549875});_0x3ab1dd[_0x493f('0x75')]({'Bucket':_0x420e5c},function(_0x294c81,_0x386caa){if(_0x294c81){return _0x1df79f(_0x294c81);}else{return _0x3b3317(_0x386caa);}});});}function uploadFile(_0x48880c,_0xb917a6,_0xd52c76,_0x3230da,_0x267385,_0x584ead){return new Promise(function(_0x507393,_0x18f05a){var _0x28a39a=new AWS['S3']({'accessKeyId':_0xb917a6,'secretAccessKey':_0x48880c,'region':_0xd52c76});_0x28a39a[_0x493f('0x76')]({'Bucket':_0x3230da,'Key':_0x267385,'Body':_0x584ead},function(_0x412827,_0x4e8ce2){if(_0x412827){return _0x18f05a(_0x412827);}else{return _0x507393(_0x4e8ce2);}});});}function startTranscribe(_0x4ccfe5,_0x3ddf60,_0x5511e0,_0x434f54,_0x2c4a95,_0x3a7862){return new Promise(function(_0x14c54e,_0x3c57a4){var _0x152c75=new AWS['TranscribeService']({'accessKeyId':_0x3ddf60,'secretAccessKey':_0x4ccfe5,'region':_0x5511e0});_0x152c75['startTranscriptionJob']({'TranscriptionJobName':_0x434f54,'LanguageCode':_0x2c4a95,'Media':{'MediaFileUri':_0x3a7862}},function(_0x196a20,_0x215b20){if(_0x196a20){return _0x3c57a4(_0x196a20);}else{return _0x14c54e(_0x215b20);}});});}function transcribe(_0x2ab930,_0x120db9,_0x54945d,_0x28d679,_0x450f0f,_0x4f2991,_0x2da625){return new Promise(function(_0x5257a0,_0x3d7031){var _0x4c4764={};logger[_0x493f('0x6e')](util['format'](_0x493f('0x77'),_0x2ab930,_0x450f0f));return uploadFile(_0x120db9,_0x54945d,_0x28d679,_0x450f0f,path[_0x493f('0x78')](_0x4f2991),fs[_0x493f('0x79')](_0x4f2991))[_0x493f('0x2c')](function(_0x106652){logger[_0x493f('0x6e')](util[_0x493f('0x39')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x2ab930,_0x450f0f,_0x106652[_0x493f('0x7a')]));_0x4c4764[_0x493f('0x7b')]=_0x106652[_0x493f('0x7c')];_0x4c4764[_0x493f('0x7d')]=_0x106652[_0x493f('0x7a')];logger['info'](util[_0x493f('0x39')](_0x493f('0x7e'),_0x2ab930));return startTranscribe(_0x120db9,_0x54945d,_0x28d679,uuidv4(),_0x2da625,_0x106652[_0x493f('0x7a')]);})[_0x493f('0x2c')](function(_0x295e6f){logger[_0x493f('0x6e')](util['format'](_0x493f('0x7f'),_0x2ab930,_0x295e6f[_0x493f('0x80')][_0x493f('0x81')]));_0x4c4764[_0x493f('0x82')]=_0x295e6f['TranscriptionJob'][_0x493f('0x81')];_0x4c4764[_0x493f('0x83')]=_0x295e6f['TranscriptionJob']['TranscriptionJobStatus'];return _0x5257a0(_0x4c4764);})[_0x493f('0x53')](function(_0x4c141a){return _0x3d7031(_0x4c141a);});});}exports[_0x493f('0x84')]=function(_0x3cde02,_0x433db9,_0x1bb79f){var _0x388102;var _0x41748f;var _0x2a1a28;var _0x48b9d4=require(_0x493f('0x58'));return db[_0x493f('0x34')][_0x493f('0x85')]({'where':{'id':_0x3cde02['params']['id']}})[_0x493f('0x2c')](function(_0x338bdb){if(_0x338bdb){var _0x91d48c=util[_0x493f('0x39')](_0x493f('0x5c'),_0x338bdb[_0x493f('0x5b')]);if(fs[_0x493f('0x5d')](_0x91d48c)){cypher=!![];return _0x48b9d4['decryptFile'](_0x91d48c,_0x338bdb[_0x493f('0x5b')],config[_0x493f('0x5f')][_0x493f('0x6b')])[_0x493f('0x2c')](function(){return _0x338bdb;});}return _0x338bdb;}})['then'](function(_0x362e7f){if(!_0x362e7f){throw new db['Sequelize'][(_0x493f('0x61'))]('Voice\x20Recording\x20not\x20found');}_0x41748f=_0x362e7f;return db[_0x493f('0x86')][_0x493f('0x85')]({'where':{'id':0x1}});})[_0x493f('0x2c')](handleEntityNotFound(_0x433db9,null))[_0x493f('0x2c')](function(_0x597c82){if(_0x597c82){_0x388102=_0x597c82;if(!_0x388102['transcribe']||!_0x388102['transcribeAccountId']||!_0x388102[_0x493f('0x87')]||!_0x388102['language']||!_0x388102[_0x493f('0x7b')]){throw new db[(_0x493f('0x60'))]['ValidationError'](_0x493f('0x88'));}if(_0x3cde02[_0x493f('0x55')][_0x493f('0x89')]&&(!_0x388102['sentiment']||!_0x388102['sentimentAccountId']||!_0x388102['sentimentRegion']||!_0x388102[_0x493f('0x8a')]||!_0x388102[_0x493f('0x7b')])){throw new db['Sequelize'][(_0x493f('0x61'))](_0x493f('0x8b'));}return db[_0x493f('0x8c')][_0x493f('0x85')]({'where':{'id':_0x388102[_0x493f('0x8d')]}});}})[_0x493f('0x2c')](function(_0xd2315c){if(!_0xd2315c){throw new db[(_0x493f('0x60'))][(_0x493f('0x61'))](_0x493f('0x8e'));}if(!_0xd2315c[_0x493f('0x8f')]||!_0xd2315c[_0x493f('0x90')]){throw new db[(_0x493f('0x60'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x2a1a28=_0xd2315c;return getBucketslist(_0x2a1a28['data1'],_0x2a1a28['data2'],_0x388102[_0x493f('0x87')]);})[_0x493f('0x2c')](function(_0x872fe9){if(_0x872fe9&&_0x872fe9[_0x493f('0x91')]){var _0x5e33a3=_['find'](_0x872fe9[_0x493f('0x91')],function(_0x116c29){return _0x116c29[_0x493f('0x92')]===_0x388102[_0x493f('0x7b')];});if(!_0x5e33a3){logger['info'](util[_0x493f('0x39')](_0x493f('0x93'),_0x3cde02[_0x493f('0x50')]['id'],_0x388102['bucket']));return createBucket(_0x2a1a28['data1'],_0x2a1a28[_0x493f('0x90')],_0x388102[_0x493f('0x87')],_0x388102[_0x493f('0x7b')]);}logger[_0x493f('0x6e')](util[_0x493f('0x39')](_0x493f('0x94'),_0x3cde02[_0x493f('0x50')]['id'],_0x388102['bucket']));return;}})['then'](function(_0x441be1){if(_0x41748f[_0x493f('0x83')]==='NEW'){return transcribe(_0x3cde02[_0x493f('0x50')]['id'],_0x2a1a28[_0x493f('0x8f')],_0x2a1a28[_0x493f('0x90')],_0x388102[_0x493f('0x87')],_0x388102[_0x493f('0x7b')],_0x41748f[_0x493f('0x5b')],_0x388102[_0x493f('0x8a')]);}else{logger[_0x493f('0x6e')](util[_0x493f('0x39')](_0x493f('0x95'),_0x3cde02[_0x493f('0x50')]['id']));return{'transcribeStatus':_0x493f('0x96')};}})['then'](function(_0x5ceb35){if(_0x5ceb35){_0x5ceb35[_0x493f('0x97')]=_0x3cde02[_0x493f('0x55')][_0x493f('0x89')];return _0x41748f[_0x493f('0x98')](_0x5ceb35);}})[_0x493f('0x2c')](respondWithResult(_0x433db9,null))[_0x493f('0x53')](handleError(_0x433db9,null));};function writeFile(_0x2bf9b0,_0x17b3d6){return new Promise(function(_0x1c54d6,_0x5b9f8b){fs[_0x493f('0x99')](_0x17b3d6,_0x2bf9b0,function(_0x5e14cb,_0x17b0bc){if(_0x5e14cb){return _0x5b9f8b(_0x5e14cb);}else{return _0x1c54d6(_0x17b0bc);}});});}exports[_0x493f('0x9a')]=function(_0x370b03,_0x53b1d9,_0x16ae5d){return db[_0x493f('0x34')][_0x493f('0x85')]({'where':{'id':_0x370b03[_0x493f('0x50')]['id']}})[_0x493f('0x2c')](handleEntityNotFound(_0x53b1d9))[_0x493f('0x2c')](function(_0x41a79b){if(_0x41a79b&&_0x41a79b[_0x493f('0x9b')]){var _0x8b7a3=_0x41a79b[_0x493f('0x9b')];var _0x243848=config[_0x493f('0x9c')]+_0x493f('0x9d')+_0x41a79b['id']+_0x493f('0x9e');if(fs[_0x493f('0x5d')](_0x243848)){return _0x243848;}return writeFile(_0x8b7a3,_0x243848)[_0x493f('0x2c')](function(){return _0x243848;});}else{throw new db[(_0x493f('0x60'))][(_0x493f('0x61'))]('Transcript\x20not\x20available');}})['then'](function(_0x11f540){return _0x53b1d9[_0x493f('0x57')](_0x11f540);})[_0x493f('0x53')](handleError(_0x53b1d9));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 42b137f..699fa22 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 _0x2fed=['VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','define'];(function(_0x2f7e5a,_0x2a2e3f){var _0x4056b4=function(_0xf8215c){while(--_0xf8215c){_0x2f7e5a['push'](_0x2f7e5a['shift']());}};_0x4056b4(++_0x2a2e3f);}(_0x2fed,0x11b));var _0xd2fe=function(_0x471ac5,_0xb474bb){_0x471ac5=_0x471ac5-0x0;var _0x47f111=_0x2fed[_0x471ac5];return _0x47f111;};'use strict';var _=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var logger=require(_0xd2fe('0x2'))('api');var moment=require(_0xd2fe('0x3'));var BPromise=require(_0xd2fe('0x4'));var rp=require(_0xd2fe('0x5'));var fs=require('fs');var path=require(_0xd2fe('0x6'));var rimraf=require(_0xd2fe('0x7'));var config=require(_0xd2fe('0x8'));var attributes=require(_0xd2fe('0x9'));module['exports']=function(_0x5d2842,_0x27eb8e){return _0x5d2842[_0xd2fe('0xa')](_0xd2fe('0xb'),attributes,{'tableName':_0xd2fe('0xc'),'paranoid':![],'indexes':[{'name':_0xd2fe('0xd'),'fields':[_0xd2fe('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1981=['define','voice_recordings','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceRecording.attributes','exports'];(function(_0x41e45f,_0x3ee147){var _0x52ee1f=function(_0x383b40){while(--_0x383b40){_0x41e45f['push'](_0x41e45f['shift']());}};_0x52ee1f(++_0x3ee147);}(_0x1981,0xf3));var _0x1198=function(_0x13ab6a,_0x2074dd){_0x13ab6a=_0x13ab6a-0x0;var _0xebf4cf=_0x1981[_0x13ab6a];return _0xebf4cf;};'use strict';var _=require(_0x1198('0x0'));var util=require('util');var logger=require(_0x1198('0x1'))(_0x1198('0x2'));var moment=require('moment');var BPromise=require(_0x1198('0x3'));var rp=require(_0x1198('0x4'));var fs=require('fs');var path=require(_0x1198('0x5'));var rimraf=require(_0x1198('0x6'));var config=require('../../config/environment');var attributes=require(_0x1198('0x7'));module[_0x1198('0x8')]=function(_0x1be165,_0x439413){return _0x1be165[_0x1198('0x9')]('VoiceRecording',attributes,{'tableName':_0x1198('0xa'),'paranoid':![],'indexes':[{'name':_0x1198('0xb'),'fields':[_0x1198('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index d45d099..245ae85 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 _0x6d11=['message','catch','VoiceRecording','update','options','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','create','body','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2a236a,_0x1f2732){var _0x43a800=function(_0x43275a){while(--_0x43275a){_0x2a236a['push'](_0x2a236a['shift']());}};_0x43a800(++_0x1f2732);}(_0x6d11,0xbf));var _0x16d1=function(_0x49d6ba,_0x3a04d2){_0x49d6ba=_0x49d6ba-0x0;var _0x21202b=_0x6d11[_0x49d6ba];return _0x21202b;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var moment=require(_0x16d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x16d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16d1('0x4'))['db'];var utils=require(_0x16d1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x16d1('0x6'));var jayson=require(_0x16d1('0x7'));var client=jayson[_0x16d1('0x8')][_0x16d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1009dc,_0x150217,_0x19390d){return new BPromise(function(_0x5d0e3f,_0x58a7a2){return client['request'](_0x1009dc,_0x19390d)[_0x16d1('0xa')](function(_0xcfbb15){logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,'request\x20sent');logger[_0x16d1('0xd')](_0x16d1('0xe'),_0x150217,_0x16d1('0xf'),JSON[_0x16d1('0x10')](_0xcfbb15));if(_0xcfbb15[_0x16d1('0x11')]){if(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x12')]===0x1f4){logger[_0x16d1('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x58a7a2(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}logger[_0x16d1('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x5d0e3f(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}else{logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,_0x16d1('0xf'));_0x5d0e3f(_0xcfbb15['result'][_0x16d1('0x13')]);}})[_0x16d1('0x14')](function(_0x555b2d){logger['error'](_0x16d1('0xc'),_0x150217,_0x555b2d);_0x58a7a2(_0x555b2d);});});}exports['UpdateVoiceRecording']=function(_0x46a25e){var _0x4aeff0=this;return new Promise(function(_0x1da1b8,_0x4fe22d){return db[_0x16d1('0x15')][_0x16d1('0x16')](_0x46a25e['body'],{'raw':_0x46a25e['options']?_0x46a25e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46a25e[_0x16d1('0x17')]?_0x46a25e['options'][_0x16d1('0x18')]||null:null,'attributes':_0x46a25e[_0x16d1('0x17')]?_0x46a25e[_0x16d1('0x17')][_0x16d1('0x19')]||null:null,'limit':_0x46a25e['options']?_0x46a25e[_0x16d1('0x17')][_0x16d1('0x1a')]||null:null})[_0x16d1('0xa')](function(_0x585ce5){logger[_0x16d1('0xb')](_0x16d1('0x1b'),_0x46a25e);logger[_0x16d1('0xd')](_0x16d1('0x1b'),_0x46a25e,JSON[_0x16d1('0x10')](_0x585ce5));_0x1da1b8(_0x585ce5);})[_0x16d1('0x14')](function(_0x32f362){logger[_0x16d1('0x11')](_0x16d1('0x1b'),_0x32f362[_0x16d1('0x13')],_0x46a25e);_0x4fe22d(_0x4aeff0[_0x16d1('0x11')](0x1f4,_0x32f362[_0x16d1('0x13')]));});});};exports[_0x16d1('0x1c')]=function(_0x262f89){var _0x346b69=this;return new Promise(function(_0x2b8403,_0x491f65){var _0x25ae4e=require(_0x16d1('0x1d'));var _0x4257f1;return db['Setting'][_0x16d1('0x1e')]({'attributes':['id',_0x16d1('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x16d1('0xa')](function(_0x22e5b3){_0x4257f1=_0x22e5b3;return db[_0x16d1('0x15')][_0x16d1('0x20')](_0x262f89[_0x16d1('0x21')]);})['then'](function(_0x3dd104){if(_0x4257f1[_0x16d1('0x1f')]&&fs[_0x16d1('0x22')](_0x3dd104[_0x16d1('0x23')])){var _0x55c021=util['format'](_0x16d1('0x24'),_0x3dd104[_0x16d1('0x23')]);return _0x25ae4e[_0x16d1('0x25')](_0x3dd104[_0x16d1('0x23')],_0x55c021,config[_0x16d1('0x26')][_0x16d1('0x27')])[_0x16d1('0xa')](function(){fs[_0x16d1('0x28')](_0x3dd104[_0x16d1('0x23')]);logger[_0x16d1('0xb')](_0x16d1('0x29'));return _0x3dd104;});}return _0x3dd104;})[_0x16d1('0xa')](function(_0x188cf4){logger[_0x16d1('0xb')]('CreateVoiceRecording',_0x262f89);logger[_0x16d1('0xd')]('CreateVoiceRecording',_0x262f89,JSON[_0x16d1('0x10')](_0x188cf4));_0x2b8403(_0x188cf4);})[_0x16d1('0x14')](function(_0x2b9126){logger[_0x16d1('0x11')](_0x16d1('0x1c'),_0x2b9126[_0x16d1('0x13')],_0x262f89);_0x491f65(_0x346b69['error'](0x1f4,_0x2b9126['message']));});});}; \ No newline at end of file +var _0x4e2e=['error','message','result','VoiceRecording','update','body','options','raw','attributes','limit','UpdateVoiceRecording','debug','catch','../../components/encryptor','findOne','create','callRecordingEncryption','format','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x136e50,_0x28db6a){var _0x497591=function(_0x5cb145){while(--_0x5cb145){_0x136e50['push'](_0x136e50['shift']());}};_0x497591(++_0x28db6a);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x3207ab,_0x2d34c1){_0x3207ab=_0x3207ab-0x0;var _0x120e52=_0x4e2e[_0x3207ab];return _0x120e52;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var BPromise=require(_0xe4e2('0x2'));var rs=require(_0xe4e2('0x3'));var fs=require('fs');var Redis=require(_0xe4e2('0x4'));var db=require(_0xe4e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e2('0x6'))(_0xe4e2('0x7'));var config=require(_0xe4e2('0x8'));var jayson=require(_0xe4e2('0x9'));var client=jayson['client'][_0xe4e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b1c6,_0x1c4e64,_0x125338){return new BPromise(function(_0x956c75,_0x27304b){return client[_0xe4e2('0xb')](_0x36b1c6,_0x125338)[_0xe4e2('0xc')](function(_0x4912da){logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));logger['debug'](_0xe4e2('0x10'),_0x1c4e64,_0xe4e2('0xf'),JSON[_0xe4e2('0x11')](_0x4912da));if(_0x4912da[_0xe4e2('0x12')]){if(_0x4912da[_0xe4e2('0x12')]['code']===0x1f4){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x27304b(_0x4912da['error'][_0xe4e2('0x13')]);}logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x956c75(_0x4912da['error']['message']);}else{logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));_0x956c75(_0x4912da[_0xe4e2('0x14')][_0xe4e2('0x13')]);}})['catch'](function(_0x754778){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x754778);_0x27304b(_0x754778);});});}exports['UpdateVoiceRecording']=function(_0x196f16){var _0x54c80b=this;return new Promise(function(_0x1d5e9d,_0x3f313b){return db[_0xe4e2('0x15')][_0xe4e2('0x16')](_0x196f16[_0xe4e2('0x17')],{'raw':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')]['where']||null:null,'attributes':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x1a')]||null:null,'limit':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x1b')]||null:null})[_0xe4e2('0xc')](function(_0x51c67e){logger[_0xe4e2('0xd')](_0xe4e2('0x1c'),_0x196f16);logger[_0xe4e2('0x1d')]('UpdateVoiceRecording',_0x196f16,JSON[_0xe4e2('0x11')](_0x51c67e));_0x1d5e9d(_0x51c67e);})[_0xe4e2('0x1e')](function(_0x598fa3){logger[_0xe4e2('0x12')](_0xe4e2('0x1c'),_0x598fa3[_0xe4e2('0x13')],_0x196f16);_0x3f313b(_0x54c80b[_0xe4e2('0x12')](0x1f4,_0x598fa3[_0xe4e2('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x166610){var _0x357903=this;return new Promise(function(_0x1f6d1f,_0x5120fd){var _0x3a31b8=require(_0xe4e2('0x1f'));var _0x31f651;return db['Setting'][_0xe4e2('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xe4e2('0xc')](function(_0x1e21c0){_0x31f651=_0x1e21c0;return db['VoiceRecording'][_0xe4e2('0x21')](_0x166610[_0xe4e2('0x17')]);})[_0xe4e2('0xc')](function(_0x41500b){if(_0x31f651[_0xe4e2('0x22')]&&fs['existsSync'](_0x41500b['value'])){var _0x2cb235=util[_0xe4e2('0x23')](_0xe4e2('0x24'),_0x41500b[_0xe4e2('0x25')]);return _0x3a31b8[_0xe4e2('0x26')](_0x41500b[_0xe4e2('0x25')],_0x2cb235,config[_0xe4e2('0x27')][_0xe4e2('0x28')])[_0xe4e2('0xc')](function(){fs[_0xe4e2('0x29')](_0x41500b[_0xe4e2('0x25')]);logger[_0xe4e2('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x41500b;});}return _0x41500b;})[_0xe4e2('0xc')](function(_0x8ffc6){logger[_0xe4e2('0xd')](_0xe4e2('0x2a'),_0x166610);logger[_0xe4e2('0x1d')](_0xe4e2('0x2a'),_0x166610,JSON['stringify'](_0x8ffc6));_0x1f6d1f(_0x8ffc6);})[_0xe4e2('0x1e')](function(_0x286714){logger[_0xe4e2('0x12')](_0xe4e2('0x2a'),_0x286714[_0xe4e2('0x13')],_0x166610);_0x5120fd(_0x357903[_0xe4e2('0x12')](0x1f4,_0x286714[_0xe4e2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index ca9ee65..a7d6bb3 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 _0x0304=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0x0304,0x7f));var _0x4030=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x0304[_0x20589d];return _0x422de9;};'use strict';var multer=require(_0x4030('0x0'));var util=require('util');var path=require(_0x4030('0x1'));var timeout=require(_0x4030('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4030('0x3'));var auth=require(_0x4030('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4030('0x5'));router[_0x4030('0x6')]('/',auth[_0x4030('0x7')](),controller[_0x4030('0x8')]);router[_0x4030('0x6')](_0x4030('0x9'),auth[_0x4030('0x7')](),controller[_0x4030('0xa')]);router[_0x4030('0x6')](_0x4030('0xb'),auth[_0x4030('0x7')](),controller[_0x4030('0xc')]);router[_0x4030('0xd')]('/',auth[_0x4030('0x7')](),controller[_0x4030('0xe')]);router[_0x4030('0xf')](_0x4030('0xb'),auth[_0x4030('0x7')](),controller[_0x4030('0x10')]);router[_0x4030('0x11')](_0x4030('0xb'),auth[_0x4030('0x7')](),controller[_0x4030('0x12')]);module[_0x4030('0x13')]=router; \ No newline at end of file +var _0x805f=['create','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','get','/describe','describe','post'];(function(_0x3803a4,_0x3460b6){var _0x1064d9=function(_0xd6e64e){while(--_0xd6e64e){_0x3803a4['push'](_0x3803a4['shift']());}};_0x1064d9(++_0x3460b6);}(_0x805f,0x95));var _0xf805=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x805f[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xf805('0x0'));var util=require(_0xf805('0x1'));var path=require(_0xf805('0x2'));var timeout=require(_0xf805('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf805('0x4'));var auth=require(_0xf805('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf805('0x6'));var controller=require(_0xf805('0x7'));router['get']('/',auth[_0xf805('0x8')](),controller['index']);router[_0xf805('0x9')](_0xf805('0xa'),auth[_0xf805('0x8')](),controller[_0xf805('0xb')]);router[_0xf805('0x9')]('/:id',auth[_0xf805('0x8')](),controller['show']);router[_0xf805('0xc')]('/',auth[_0xf805('0x8')](),controller[_0xf805('0xd')]);router[_0xf805('0xe')]('/:id',auth[_0xf805('0x8')](),controller[_0xf805('0xf')]);router[_0xf805('0x10')]('/:id',auth[_0xf805('0x8')](),controller[_0xf805('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 0d76ff8..af301ee 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 _0x6f7c=['attended','STRING','Yes','sequelize','ENUM','blind'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6f7c,0xb7));var _0xc6f7=function(_0x3c02fb,_0x1f55ff){_0x3c02fb=_0x3c02fb-0x0;var _0x14a55f=_0x6f7c[_0x3c02fb];return _0x14a55f;};'use strict';var Sequelize=require(_0xc6f7('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xc6f7('0x1')](_0xc6f7('0x2'),_0xc6f7('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xc6f7('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xc6f7('0x4')]},'transferercalleridname':{'type':Sequelize[_0xc6f7('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xc6f7('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xc6f7('0x4')]},'transferercontext':{'type':Sequelize[_0xc6f7('0x4')]},'transfererexten':{'type':Sequelize[_0xc6f7('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xc6f7('0x4')]},'transfereechannel':{'type':Sequelize[_0xc6f7('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xc6f7('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xc6f7('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xc6f7('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xc6f7('0x4')]},'transfereecontext':{'type':Sequelize[_0xc6f7('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0xc6f7('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xc6f7('0x4')]}}; \ No newline at end of file +var _0xdcce=['Yes','sequelize','moment','blind','attended','STRING','ENUM'];(function(_0xc70ff5,_0x1f8a90){var _0x3f84b4=function(_0x5d55d5){while(--_0x5d55d5){_0xc70ff5['push'](_0xc70ff5['shift']());}};_0x3f84b4(++_0x1f8a90);}(_0xdcce,0x1eb));var _0xedcc=function(_0x43a660,_0x2a08c8){_0x43a660=_0x43a660-0x0;var _0x40f835=_0xdcce[_0x43a660];return _0x40f835;};'use strict';var Sequelize=require(_0xedcc('0x0'));var moment=require(_0xedcc('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xedcc('0x2'),_0xedcc('0x3'))},'result':{'type':Sequelize[_0xedcc('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xedcc('0x4')]},'transferercalleridname':{'type':Sequelize[_0xedcc('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xedcc('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xedcc('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xedcc('0x4')]},'transfererexten':{'type':Sequelize[_0xedcc('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xedcc('0x4')]},'transfereechannel':{'type':Sequelize[_0xedcc('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xedcc('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xedcc('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xedcc('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xedcc('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xedcc('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xedcc('0x5')](_0xedcc('0x6'),'No')},'context':{'type':Sequelize[_0xedcc('0x4')]},'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 53d75a6..977b177 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 _0x31cb=['Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','VoiceTransferReport','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set'];(function(_0x5ea12c,_0x58685d){var _0x4e3711=function(_0x2aeb19){while(--_0x2aeb19){_0x5ea12c['push'](_0x5ea12c['shift']());}};_0x4e3711(++_0x58685d);}(_0x31cb,0x7a));var _0xb31c=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x31cb[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0xb31c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb31c('0x1'));var jsonpatch=require(_0xb31c('0x2'));var rp=require(_0xb31c('0x3'));var moment=require(_0xb31c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb31c('0x5'));var util=require(_0xb31c('0x6'));var path=require(_0xb31c('0x7'));var sox=require(_0xb31c('0x8'));var csv=require('to-csv');var ejs=require(_0xb31c('0x9'));var fs=require('fs');var fs_extra=require(_0xb31c('0xa'));var _=require(_0xb31c('0xb'));var squel=require('squel');var crypto=require(_0xb31c('0xc'));var jsforce=require(_0xb31c('0xd'));var deskjs=require(_0xb31c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb31c('0xf'));var Papa=require(_0xb31c('0x10'));var Redis=require(_0xb31c('0x11'));var authService=require(_0xb31c('0x12'));var qs=require(_0xb31c('0x13'));var as=require(_0xb31c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb31c('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xb31c('0x16'));var licenseUtil=require(_0xb31c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a6812,_0xe876b){_0xe876b=_0xe876b||0xcc;return function(_0x456672){if(_0x456672){return _0x5a6812[_0xb31c('0x18')](_0xe876b);}return _0x5a6812[_0xb31c('0x19')](_0xe876b)['end']();};}function respondWithResult(_0x572a66,_0x13bad9){_0x13bad9=_0x13bad9||0xc8;return function(_0x5437a5){if(_0x5437a5){return _0x572a66[_0xb31c('0x19')](_0x13bad9)[_0xb31c('0x1a')](_0x5437a5);}};}function respondWithFilteredResult(_0x179a14,_0x170b2b){return function(_0x8423a9){if(_0x8423a9){var _0x575cc9=typeof _0x170b2b[_0xb31c('0x1b')]==='undefined'&&typeof _0x170b2b['limit']===_0xb31c('0x1c');var _0x12a4fa=_0x8423a9[_0xb31c('0x1d')];var _0x56b838=_0x575cc9?0x0:_0x170b2b[_0xb31c('0x1b')];var _0x236c46=_0x575cc9?_0x8423a9[_0xb31c('0x1d')]:_0x170b2b[_0xb31c('0x1b')]+_0x170b2b[_0xb31c('0x1e')];var _0x5c3b08;if(_0x236c46>=_0x12a4fa){_0x236c46=_0x12a4fa;_0x5c3b08=0xc8;}else{_0x5c3b08=0xce;}_0x179a14[_0xb31c('0x19')](_0x5c3b08);return _0x179a14[_0xb31c('0x1f')](_0xb31c('0x20'),_0x56b838+'-'+_0x236c46+'/'+_0x12a4fa)['json'](_0x8423a9);}return null;};}function patchUpdates(_0x2ae289){return function(_0x6a62f1){try{jsonpatch[_0xb31c('0x21')](_0x6a62f1,_0x2ae289,!![]);}catch(_0x403ac7){return BPromise[_0xb31c('0x22')](_0x403ac7);}return _0x6a62f1[_0xb31c('0x23')]();};}function saveUpdates(_0x5e6673,_0x24f1cb){return function(_0x5a02ca){if(_0x5a02ca){return _0x5a02ca[_0xb31c('0x24')](_0x5e6673)['then'](function(_0x1b31f3){return _0x1b31f3;});}return null;};}function removeEntity(_0x584ba8,_0x1fd401){return function(_0x21e518){if(_0x21e518){return _0x21e518[_0xb31c('0x25')]()[_0xb31c('0x26')](function(){_0x584ba8['status'](0xcc)[_0xb31c('0x27')]();});}};}function handleEntityNotFound(_0x4b99db,_0x203cad){return function(_0x23dff9){if(!_0x23dff9){_0x4b99db[_0xb31c('0x18')](0x194);}return _0x23dff9;};}function handleError(_0x24efb1,_0x4cff72){_0x4cff72=_0x4cff72||0x1f4;return function(_0xc1f564){logger['error'](_0xc1f564[_0xb31c('0x28')]);if(_0xc1f564[_0xb31c('0x29')]){delete _0xc1f564[_0xb31c('0x29')];}_0x24efb1[_0xb31c('0x19')](_0x4cff72)[_0xb31c('0x2a')](_0xc1f564);};}exports[_0xb31c('0x2b')]=function(_0xa57bb3,_0x371117){var _0x49f7e5={},_0x4bee8f={},_0x29b39a={'count':0x0,'rows':[]};var _0x563d73=_[_0xb31c('0x2c')](db['VoiceTransferReport'][_0xb31c('0x2d')],function(_0x3b5c8d){return{'name':_0x3b5c8d[_0xb31c('0x2e')],'type':_0x3b5c8d[_0xb31c('0x2f')][_0xb31c('0x30')]};});_0x4bee8f[_0xb31c('0x31')]=_['map'](_0x563d73,_0xb31c('0x29'));_0x4bee8f['query']=_[_0xb31c('0x32')](_0xa57bb3[_0xb31c('0x33')]);_0x4bee8f[_0xb31c('0x34')]=_[_0xb31c('0x35')](_0x4bee8f['model'],_0x4bee8f[_0xb31c('0x33')]);_0x49f7e5[_0xb31c('0x36')]=_[_0xb31c('0x35')](_0x4bee8f[_0xb31c('0x31')],qs[_0xb31c('0x37')](_0xa57bb3[_0xb31c('0x33')][_0xb31c('0x37')]));_0x49f7e5[_0xb31c('0x36')]=_0x49f7e5['attributes'][_0xb31c('0x38')]?_0x49f7e5[_0xb31c('0x36')]:_0x4bee8f[_0xb31c('0x31')];if(!_0xa57bb3[_0xb31c('0x33')][_0xb31c('0x39')](_0xb31c('0x3a'))){_0x49f7e5[_0xb31c('0x1e')]=qs[_0xb31c('0x1e')](_0xa57bb3[_0xb31c('0x33')][_0xb31c('0x1e')]);_0x49f7e5[_0xb31c('0x1b')]=qs['offset'](_0xa57bb3[_0xb31c('0x33')][_0xb31c('0x1b')]);}_0x49f7e5[_0xb31c('0x3b')]=qs['sort'](_0xa57bb3[_0xb31c('0x33')][_0xb31c('0x3c')]);_0x49f7e5[_0xb31c('0x3d')]=qs[_0xb31c('0x34')](_['pick'](_0xa57bb3[_0xb31c('0x33')],_0x4bee8f[_0xb31c('0x34')]),_0x563d73);if(_0xa57bb3[_0xb31c('0x33')][_0xb31c('0x3e')]){_0x49f7e5[_0xb31c('0x3d')]=_['merge'](_0x49f7e5['where'],{'$or':_[_0xb31c('0x2c')](_0x563d73,function(_0x519474){if(_0x519474[_0xb31c('0x2f')]!==_0xb31c('0x3f')){var _0x23c7a9={};_0x23c7a9[_0x519474[_0xb31c('0x29')]]={'$like':'%'+_0xa57bb3[_0xb31c('0x33')][_0xb31c('0x3e')]+'%'};return _0x23c7a9;}})});}_0x49f7e5=_[_0xb31c('0x40')]({},_0x49f7e5,_0xa57bb3[_0xb31c('0x41')]);var _0x355a74={'where':_0x49f7e5[_0xb31c('0x3d')]};return db[_0xb31c('0x42')][_0xb31c('0x1d')](_0x355a74)['then'](function(_0xf97e83){_0x29b39a['count']=_0xf97e83;if(_0xa57bb3[_0xb31c('0x33')][_0xb31c('0x43')]){_0x49f7e5[_0xb31c('0x44')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x49f7e5);})[_0xb31c('0x26')](function(_0x3d1eaa){_0x29b39a[_0xb31c('0x45')]=_0x3d1eaa;return _0x29b39a;})[_0xb31c('0x26')](respondWithFilteredResult(_0x371117,_0x49f7e5))[_0xb31c('0x46')](handleError(_0x371117,null));};exports[_0xb31c('0x47')]=function(_0x58b8a8,_0x261d6f){var _0x58ddbb={'raw':!![],'where':{'id':_0x58b8a8[_0xb31c('0x48')]['id']}},_0x768710={};_0x768710['model']=_['keys'](db[_0xb31c('0x42')][_0xb31c('0x2d')]);_0x768710['query']=_[_0xb31c('0x32')](_0x58b8a8[_0xb31c('0x33')]);_0x768710[_0xb31c('0x34')]=_['intersection'](_0x768710[_0xb31c('0x31')],_0x768710[_0xb31c('0x33')]);_0x58ddbb['attributes']=_[_0xb31c('0x35')](_0x768710[_0xb31c('0x31')],qs[_0xb31c('0x37')](_0x58b8a8[_0xb31c('0x33')][_0xb31c('0x37')]));_0x58ddbb[_0xb31c('0x36')]=_0x58ddbb[_0xb31c('0x36')][_0xb31c('0x38')]?_0x58ddbb['attributes']:_0x768710[_0xb31c('0x31')];if(_0x58b8a8[_0xb31c('0x33')][_0xb31c('0x43')]){_0x58ddbb[_0xb31c('0x44')]=[{'all':!![]}];}_0x58ddbb=_[_0xb31c('0x40')]({},_0x58ddbb,_0x58b8a8['options']);return db['VoiceTransferReport'][_0xb31c('0x49')](_0x58ddbb)[_0xb31c('0x26')](handleEntityNotFound(_0x261d6f,null))[_0xb31c('0x26')](respondWithResult(_0x261d6f,null))[_0xb31c('0x46')](handleError(_0x261d6f,null));};exports[_0xb31c('0x4a')]=function(_0x281527,_0x3149a3){return db[_0xb31c('0x42')][_0xb31c('0x4a')](_0x281527[_0xb31c('0x4b')],{})['then'](respondWithResult(_0x3149a3,0xc9))[_0xb31c('0x46')](handleError(_0x3149a3,null));};exports[_0xb31c('0x24')]=function(_0x239223,_0x218d5a){if(_0x239223['body']['id']){delete _0x239223[_0xb31c('0x4b')]['id'];}return db[_0xb31c('0x42')][_0xb31c('0x49')]({'where':{'id':_0x239223[_0xb31c('0x48')]['id']}})[_0xb31c('0x26')](handleEntityNotFound(_0x218d5a,null))['then'](saveUpdates(_0x239223['body'],null))[_0xb31c('0x26')](respondWithResult(_0x218d5a,null))['catch'](handleError(_0x218d5a,null));};exports[_0xb31c('0x25')]=function(_0x28fee3,_0x56bc4f){return db[_0xb31c('0x42')]['find']({'where':{'id':_0x28fee3[_0xb31c('0x48')]['id']}})[_0xb31c('0x26')](handleEntityNotFound(_0x56bc4f,null))[_0xb31c('0x26')](removeEntity(_0x56bc4f,null))[_0xb31c('0x46')](handleError(_0x56bc4f,null));};exports[_0xb31c('0x4c')]=function(_0x427f0b,_0x1f6c5f){return db['VoiceTransferReport'][_0xb31c('0x4c')]()[_0xb31c('0x26')](respondWithResult(_0x1f6c5f,null))[_0xb31c('0x46')](handleError(_0x1f6c5f,null));}; \ No newline at end of file +var _0x5e95=['filter','merge','type','VIRTUAL','name','options','includeAll','findAll','rows','catch','params','include','create','body','find','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','save','update','destroy','then','end','sendStatus','error','stack','send','index','VoiceTransferReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick'];(function(_0x4fa717,_0xf10785){var _0x431048=function(_0x1c5cea){while(--_0x1c5cea){_0x4fa717['push'](_0x4fa717['shift']());}};_0x431048(++_0xf10785);}(_0x5e95,0x1d2));var _0x55e9=function(_0x5ead0e,_0x394902){_0x5ead0e=_0x5ead0e-0x0;var _0x425c06=_0x5e95[_0x5ead0e];return _0x425c06;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x55e9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x55e9('0x1'));var moment=require(_0x55e9('0x2'));var BPromise=require(_0x55e9('0x3'));var Mustache=require(_0x55e9('0x4'));var util=require(_0x55e9('0x5'));var path=require(_0x55e9('0x6'));var sox=require(_0x55e9('0x7'));var csv=require('to-csv');var ejs=require(_0x55e9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x55e9('0x9'));var squel=require('squel');var crypto=require(_0x55e9('0xa'));var jsforce=require(_0x55e9('0xb'));var deskjs=require(_0x55e9('0xc'));var toCsv=require(_0x55e9('0xd'));var querystring=require(_0x55e9('0xe'));var Papa=require('papaparse');var Redis=require(_0x55e9('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x55e9('0x10'));var hardwareService=require(_0x55e9('0x11'));var logger=require('../../config/logger')(_0x55e9('0x12'));var utils=require(_0x55e9('0x13'));var config=require(_0x55e9('0x14'));var licenseUtil=require(_0x55e9('0x15'));var db=require(_0x55e9('0x16'))['db'];function respondWithStatusCode(_0x2aa651,_0x594020){_0x594020=_0x594020||0xcc;return function(_0x52f299){if(_0x52f299){return _0x2aa651['sendStatus'](_0x594020);}return _0x2aa651['status'](_0x594020)['end']();};}function respondWithResult(_0x111b87,_0x3ab8d0){_0x3ab8d0=_0x3ab8d0||0xc8;return function(_0x19d104){if(_0x19d104){return _0x111b87[_0x55e9('0x17')](_0x3ab8d0)[_0x55e9('0x18')](_0x19d104);}};}function respondWithFilteredResult(_0x18d265,_0x1ac496){return function(_0xf72e24){if(_0xf72e24){var _0x5cedf8=typeof _0x1ac496[_0x55e9('0x19')]==='undefined'&&typeof _0x1ac496['limit']===_0x55e9('0x1a');var _0x479a00=_0xf72e24[_0x55e9('0x1b')];var _0x5604a5=_0x5cedf8?0x0:_0x1ac496[_0x55e9('0x19')];var _0x12aa16=_0x5cedf8?_0xf72e24[_0x55e9('0x1b')]:_0x1ac496['offset']+_0x1ac496['limit'];var _0x21ff9c;if(_0x12aa16>=_0x479a00){_0x12aa16=_0x479a00;_0x21ff9c=0xc8;}else{_0x21ff9c=0xce;}_0x18d265[_0x55e9('0x17')](_0x21ff9c);return _0x18d265[_0x55e9('0x1c')](_0x55e9('0x1d'),_0x5604a5+'-'+_0x12aa16+'/'+_0x479a00)['json'](_0xf72e24);}return null;};}function patchUpdates(_0x2ec009){return function(_0x4fb37d){try{jsonpatch['apply'](_0x4fb37d,_0x2ec009,!![]);}catch(_0x38bb91){return BPromise['reject'](_0x38bb91);}return _0x4fb37d[_0x55e9('0x1e')]();};}function saveUpdates(_0x36bc49,_0x4154c9){return function(_0x90c18e){if(_0x90c18e){return _0x90c18e[_0x55e9('0x1f')](_0x36bc49)['then'](function(_0x4a273a){return _0x4a273a;});}return null;};}function removeEntity(_0x3c2560,_0x4a4b5e){return function(_0x1ffd7a){if(_0x1ffd7a){return _0x1ffd7a[_0x55e9('0x20')]()[_0x55e9('0x21')](function(){_0x3c2560[_0x55e9('0x17')](0xcc)[_0x55e9('0x22')]();});}};}function handleEntityNotFound(_0xccaecb,_0x196182){return function(_0x332896){if(!_0x332896){_0xccaecb[_0x55e9('0x23')](0x194);}return _0x332896;};}function handleError(_0x1f5ea7,_0x3ad7d7){_0x3ad7d7=_0x3ad7d7||0x1f4;return function(_0x384c2b){logger[_0x55e9('0x24')](_0x384c2b[_0x55e9('0x25')]);if(_0x384c2b['name']){delete _0x384c2b['name'];}_0x1f5ea7[_0x55e9('0x17')](_0x3ad7d7)[_0x55e9('0x26')](_0x384c2b);};}exports[_0x55e9('0x27')]=function(_0x6cee4f,_0x28fee0){var _0x24bf57={},_0x27676f={},_0x3b4efc={'count':0x0,'rows':[]};var _0x4b8ca8=_['map'](db[_0x55e9('0x28')][_0x55e9('0x29')],function(_0x5478c7){return{'name':_0x5478c7[_0x55e9('0x2a')],'type':_0x5478c7['type'][_0x55e9('0x2b')]};});_0x27676f[_0x55e9('0x2c')]=_[_0x55e9('0x2d')](_0x4b8ca8,'name');_0x27676f[_0x55e9('0x2e')]=_[_0x55e9('0x2f')](_0x6cee4f[_0x55e9('0x2e')]);_0x27676f[_0x55e9('0x30')]=_[_0x55e9('0x31')](_0x27676f['model'],_0x27676f['query']);_0x24bf57['attributes']=_[_0x55e9('0x31')](_0x27676f[_0x55e9('0x2c')],qs[_0x55e9('0x32')](_0x6cee4f[_0x55e9('0x2e')]['fields']));_0x24bf57[_0x55e9('0x33')]=_0x24bf57[_0x55e9('0x33')][_0x55e9('0x34')]?_0x24bf57[_0x55e9('0x33')]:_0x27676f['model'];if(!_0x6cee4f['query'][_0x55e9('0x35')]('nolimit')){_0x24bf57[_0x55e9('0x36')]=qs[_0x55e9('0x36')](_0x6cee4f['query'][_0x55e9('0x36')]);_0x24bf57['offset']=qs[_0x55e9('0x19')](_0x6cee4f[_0x55e9('0x2e')]['offset']);}_0x24bf57[_0x55e9('0x37')]=qs[_0x55e9('0x38')](_0x6cee4f[_0x55e9('0x2e')][_0x55e9('0x38')]);_0x24bf57[_0x55e9('0x39')]=qs['filters'](_[_0x55e9('0x3a')](_0x6cee4f[_0x55e9('0x2e')],_0x27676f[_0x55e9('0x30')]),_0x4b8ca8);if(_0x6cee4f['query'][_0x55e9('0x3b')]){_0x24bf57[_0x55e9('0x39')]=_[_0x55e9('0x3c')](_0x24bf57[_0x55e9('0x39')],{'$or':_['map'](_0x4b8ca8,function(_0x5766d0){if(_0x5766d0[_0x55e9('0x3d')]!==_0x55e9('0x3e')){var _0x1ab571={};_0x1ab571[_0x5766d0[_0x55e9('0x3f')]]={'$like':'%'+_0x6cee4f[_0x55e9('0x2e')][_0x55e9('0x3b')]+'%'};return _0x1ab571;}})});}_0x24bf57=_['merge']({},_0x24bf57,_0x6cee4f[_0x55e9('0x40')]);var _0x19e926={'where':_0x24bf57[_0x55e9('0x39')]};return db[_0x55e9('0x28')][_0x55e9('0x1b')](_0x19e926)[_0x55e9('0x21')](function(_0x1a11ad){_0x3b4efc[_0x55e9('0x1b')]=_0x1a11ad;if(_0x6cee4f[_0x55e9('0x2e')][_0x55e9('0x41')]){_0x24bf57['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0x55e9('0x42')](_0x24bf57);})[_0x55e9('0x21')](function(_0x3969ec){_0x3b4efc[_0x55e9('0x43')]=_0x3969ec;return _0x3b4efc;})[_0x55e9('0x21')](respondWithFilteredResult(_0x28fee0,_0x24bf57))[_0x55e9('0x44')](handleError(_0x28fee0,null));};exports['show']=function(_0x48619a,_0x2e7e72){var _0x56959f={'raw':!![],'where':{'id':_0x48619a[_0x55e9('0x45')]['id']}},_0xecadb7={};_0xecadb7[_0x55e9('0x2c')]=_[_0x55e9('0x2f')](db[_0x55e9('0x28')][_0x55e9('0x29')]);_0xecadb7[_0x55e9('0x2e')]=_[_0x55e9('0x2f')](_0x48619a[_0x55e9('0x2e')]);_0xecadb7[_0x55e9('0x30')]=_[_0x55e9('0x31')](_0xecadb7[_0x55e9('0x2c')],_0xecadb7[_0x55e9('0x2e')]);_0x56959f['attributes']=_[_0x55e9('0x31')](_0xecadb7[_0x55e9('0x2c')],qs[_0x55e9('0x32')](_0x48619a[_0x55e9('0x2e')]['fields']));_0x56959f[_0x55e9('0x33')]=_0x56959f[_0x55e9('0x33')]['length']?_0x56959f[_0x55e9('0x33')]:_0xecadb7[_0x55e9('0x2c')];if(_0x48619a['query']['includeAll']){_0x56959f[_0x55e9('0x46')]=[{'all':!![]}];}_0x56959f=_[_0x55e9('0x3c')]({},_0x56959f,_0x48619a[_0x55e9('0x40')]);return db[_0x55e9('0x28')]['find'](_0x56959f)['then'](handleEntityNotFound(_0x2e7e72,null))['then'](respondWithResult(_0x2e7e72,null))['catch'](handleError(_0x2e7e72,null));};exports[_0x55e9('0x47')]=function(_0x6a7c09,_0x2d40d0){return db[_0x55e9('0x28')]['create'](_0x6a7c09[_0x55e9('0x48')],{})[_0x55e9('0x21')](respondWithResult(_0x2d40d0,0xc9))[_0x55e9('0x44')](handleError(_0x2d40d0,null));};exports[_0x55e9('0x1f')]=function(_0x4fba66,_0x18bd8f){if(_0x4fba66[_0x55e9('0x48')]['id']){delete _0x4fba66[_0x55e9('0x48')]['id'];}return db[_0x55e9('0x28')]['find']({'where':{'id':_0x4fba66[_0x55e9('0x45')]['id']}})[_0x55e9('0x21')](handleEntityNotFound(_0x18bd8f,null))[_0x55e9('0x21')](saveUpdates(_0x4fba66['body'],null))['then'](respondWithResult(_0x18bd8f,null))[_0x55e9('0x44')](handleError(_0x18bd8f,null));};exports['destroy']=function(_0x364a35,_0x3660ee){return db[_0x55e9('0x28')][_0x55e9('0x49')]({'where':{'id':_0x364a35['params']['id']}})[_0x55e9('0x21')](handleEntityNotFound(_0x3660ee,null))[_0x55e9('0x21')](removeEntity(_0x3660ee,null))[_0x55e9('0x44')](handleError(_0x3660ee,null));};exports[_0x55e9('0x4a')]=function(_0x560153,_0x2b336c){return db[_0x55e9('0x28')][_0x55e9('0x4a')]()['then'](respondWithResult(_0x2b336c,null))[_0x55e9('0x44')](handleError(_0x2b336c,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index fdb5885..d2954ff 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 _0x6f2e=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','util'];(function(_0x13a45f,_0x533e58){var _0x145ef3=function(_0x17127a){while(--_0x17127a){_0x13a45f['push'](_0x13a45f['shift']());}};_0x145ef3(++_0x533e58);}(_0x6f2e,0x9b));var _0xe6f2=function(_0x391e92,_0x102740){_0x391e92=_0x391e92-0x0;var _0x5dfb22=_0x6f2e[_0x391e92];return _0x5dfb22;};'use strict';var _=require('lodash');var util=require(_0xe6f2('0x0'));var logger=require(_0xe6f2('0x1'))('api');var moment=require(_0xe6f2('0x2'));var BPromise=require(_0xe6f2('0x3'));var rp=require(_0xe6f2('0x4'));var fs=require('fs');var path=require(_0xe6f2('0x5'));var rimraf=require('rimraf');var config=require(_0xe6f2('0x6'));var attributes=require(_0xe6f2('0x7'));module[_0xe6f2('0x8')]=function(_0x4ad4ee,_0x29c0be){return _0x4ad4ee[_0xe6f2('0x9')](_0xe6f2('0xa'),attributes,{'tableName':_0xe6f2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ad1=['VoiceTransferReport','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x138d06,_0x33edf2){var _0x1a01eb=function(_0x387acb){while(--_0x387acb){_0x138d06['push'](_0x138d06['shift']());}};_0x1a01eb(++_0x33edf2);}(_0x0ad1,0x137));var _0x10ad=function(_0x298679,_0xcea593){_0x298679=_0x298679-0x0;var _0x1f8b52=_0x0ad1[_0x298679];return _0x1f8b52;};'use strict';var _=require(_0x10ad('0x0'));var util=require('util');var logger=require(_0x10ad('0x1'))('api');var moment=require(_0x10ad('0x2'));var BPromise=require(_0x10ad('0x3'));var rp=require(_0x10ad('0x4'));var fs=require('fs');var path=require(_0x10ad('0x5'));var rimraf=require(_0x10ad('0x6'));var config=require(_0x10ad('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x10ad('0x8')]=function(_0x14b9ad,_0x457793){return _0x14b9ad['define'](_0x10ad('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 359cf4d..1a51a0f 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 _0xe355=['options','debug','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','body'];(function(_0x1f5247,_0x1bbdd4){var _0x2184ad=function(_0x56a611){while(--_0x56a611){_0x1f5247['push'](_0x1f5247['shift']());}};_0x2184ad(++_0x1bbdd4);}(_0xe355,0x148));var _0x5e35=function(_0x40412a,_0xd7d49){_0x40412a=_0x40412a-0x0;var _0x369d36=_0xe355[_0x40412a];return _0x369d36;};'use strict';var _=require(_0x5e35('0x0'));var util=require(_0x5e35('0x1'));var moment=require('moment');var BPromise=require(_0x5e35('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5e35('0x3'));var logger=require(_0x5e35('0x4'))(_0x5e35('0x5'));var config=require(_0x5e35('0x6'));var jayson=require(_0x5e35('0x7'));var client=jayson['client'][_0x5e35('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa720cb,_0x1ab0e5,_0x5899e6){return new BPromise(function(_0x37618c,_0x2fe0da){return client[_0x5e35('0x9')](_0xa720cb,_0x5899e6)['then'](function(_0x26d231){logger[_0x5e35('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x1ab0e5,'request\x20sent');logger['debug'](_0x5e35('0xb'),_0x1ab0e5,_0x5e35('0xc'),JSON[_0x5e35('0xd')](_0x26d231));if(_0x26d231[_0x5e35('0xe')]){if(_0x26d231[_0x5e35('0xe')]['code']===0x1f4){logger['error'](_0x5e35('0xf'),_0x1ab0e5,_0x26d231[_0x5e35('0xe')][_0x5e35('0x10')]);return _0x2fe0da(_0x26d231[_0x5e35('0xe')][_0x5e35('0x10')]);}logger[_0x5e35('0xe')](_0x5e35('0xf'),_0x1ab0e5,_0x26d231[_0x5e35('0xe')][_0x5e35('0x10')]);return _0x37618c(_0x26d231['error'][_0x5e35('0x10')]);}else{logger[_0x5e35('0xa')](_0x5e35('0xf'),_0x1ab0e5,_0x5e35('0xc'));_0x37618c(_0x26d231[_0x5e35('0x11')][_0x5e35('0x10')]);}})['catch'](function(_0x4a2b3f){logger[_0x5e35('0xe')](_0x5e35('0xf'),_0x1ab0e5,_0x4a2b3f);_0x2fe0da(_0x4a2b3f);});});}exports[_0x5e35('0x12')]=function(_0x393734){var _0x693982=this;return new Promise(function(_0x352406,_0x2aa705){return db[_0x5e35('0x13')][_0x5e35('0x14')](_0x393734[_0x5e35('0x15')],{'raw':_0x393734[_0x5e35('0x16')]?_0x393734[_0x5e35('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x28561a){logger['info'](_0x5e35('0x12'),_0x393734);logger[_0x5e35('0x17')](_0x5e35('0x12'),_0x393734,JSON['stringify'](_0x28561a));_0x352406(_0x28561a);})[_0x5e35('0x18')](function(_0x9f6eb1){logger['error'](_0x5e35('0x12'),_0x9f6eb1[_0x5e35('0x10')],_0x393734);_0x2aa705(_0x693982[_0x5e35('0xe')](0x1f4,_0x9f6eb1['message']));});});}; \ No newline at end of file +var _0x004c=['error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','create','raw','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x597c15,_0x59294e){var _0x2d6b32=function(_0x334788){while(--_0x334788){_0x597c15['push'](_0x597c15['shift']());}};_0x2d6b32(++_0x59294e);}(_0x004c,0x1de));var _0xc004=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x004c[_0x342baa];return _0x1208f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc004('0x0'));var BPromise=require(_0xc004('0x1'));var rs=require(_0xc004('0x2'));var fs=require('fs');var Redis=require(_0xc004('0x3'));var db=require(_0xc004('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc004('0x5'))(_0xc004('0x6'));var config=require('../../config/environment');var jayson=require(_0xc004('0x7'));var client=jayson[_0xc004('0x8')][_0xc004('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cabfe,_0x3511a2,_0x3f1f44){return new BPromise(function(_0x2abbfd,_0x1dfeb7){return client[_0xc004('0xa')](_0x1cabfe,_0x3f1f44)[_0xc004('0xb')](function(_0x41b838){logger[_0xc004('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x3511a2,_0xc004('0xd'));logger[_0xc004('0xe')](_0xc004('0xf'),_0x3511a2,_0xc004('0xd'),JSON['stringify'](_0x41b838));if(_0x41b838['error']){if(_0x41b838[_0xc004('0x10')][_0xc004('0x11')]===0x1f4){logger['error'](_0xc004('0x12'),_0x3511a2,_0x41b838[_0xc004('0x10')][_0xc004('0x13')]);return _0x1dfeb7(_0x41b838[_0xc004('0x10')]['message']);}logger[_0xc004('0x10')](_0xc004('0x12'),_0x3511a2,_0x41b838[_0xc004('0x10')][_0xc004('0x13')]);return _0x2abbfd(_0x41b838[_0xc004('0x10')][_0xc004('0x13')]);}else{logger[_0xc004('0xc')](_0xc004('0x12'),_0x3511a2,'request\x20sent');_0x2abbfd(_0x41b838[_0xc004('0x14')][_0xc004('0x13')]);}})[_0xc004('0x15')](function(_0xfa0527){logger[_0xc004('0x10')](_0xc004('0x12'),_0x3511a2,_0xfa0527);_0x1dfeb7(_0xfa0527);});});}exports[_0xc004('0x16')]=function(_0x391b51){var _0x4ff234=this;return new Promise(function(_0x3fc1d2,_0x497216){return db['VoiceTransferReport'][_0xc004('0x17')](_0x391b51['body'],{'raw':_0x391b51['options']?_0x391b51['options'][_0xc004('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x30dc1c){logger['info'](_0xc004('0x16'),_0x391b51);logger[_0xc004('0xe')](_0xc004('0x16'),_0x391b51,JSON[_0xc004('0x19')](_0x30dc1c));_0x3fc1d2(_0x30dc1c);})[_0xc004('0x15')](function(_0x5689c8){logger[_0xc004('0x10')](_0xc004('0x16'),_0x5689c8[_0xc004('0x13')],_0x391b51);_0x497216(_0x4ff234['error'](0x1f4,_0x5689c8[_0xc004('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index c4d8426..fc2bfbf 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 _0xf9dd=['/transfer','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','/hangup','hangup','/answer','answer','hold','/unhold','calls'];(function(_0x49c653,_0x390195){var _0x31e169=function(_0x3684ac){while(--_0x3684ac){_0x49c653['push'](_0x49c653['shift']());}};_0x31e169(++_0x390195);}(_0xf9dd,0x89));var _0xdf9d=function(_0x3fef57,_0x4d91e5){_0x3fef57=_0x3fef57-0x0;var _0x2ebf41=_0xf9dd[_0x3fef57];return _0x2ebf41;};'use strict';var express=require(_0xdf9d('0x0'));var router=express[_0xdf9d('0x1')]();var auth=require(_0xdf9d('0x2'));var controller=require(_0xdf9d('0x3'));router[_0xdf9d('0x4')](_0xdf9d('0x5'),auth[_0xdf9d('0x6')](),auth[_0xdf9d('0x7')](),controller[_0xdf9d('0x8')]);router[_0xdf9d('0x4')](_0xdf9d('0x9'),auth[_0xdf9d('0x6')](),auth[_0xdf9d('0x7')](),controller[_0xdf9d('0xa')]);router[_0xdf9d('0x4')](_0xdf9d('0xb'),auth[_0xdf9d('0x6')](),auth[_0xdf9d('0x7')](),controller[_0xdf9d('0xc')]);router[_0xdf9d('0x4')]('/hold',auth['isAuthenticated'](),auth[_0xdf9d('0x7')](),controller[_0xdf9d('0xd')]);router[_0xdf9d('0x4')](_0xdf9d('0xe'),auth[_0xdf9d('0x6')](),auth[_0xdf9d('0x7')](),controller['unhold']);router[_0xdf9d('0x4')]('/calls',auth[_0xdf9d('0x6')](),auth[_0xdf9d('0x7')](),controller[_0xdf9d('0xf')]);router[_0xdf9d('0x4')](_0xdf9d('0x10'),auth[_0xdf9d('0x6')](),auth[_0xdf9d('0x7')](),controller['transfer']);module['exports']=router; \ No newline at end of file +var _0xb2fe=['exports','express','Router','post','isAuthenticated','originate','canUpdate','hangup','/answer','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer'];(function(_0xb119da,_0x42d325){var _0x3ecb48=function(_0x361539){while(--_0x361539){_0xb119da['push'](_0xb119da['shift']());}};_0x3ecb48(++_0x42d325);}(_0xb2fe,0x1c3));var _0xeb2f=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0xb2fe[_0x2f1114];return _0x2fe856;};'use strict';var express=require(_0xeb2f('0x0'));var router=express[_0xeb2f('0x1')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0xeb2f('0x2')]('/originate',auth[_0xeb2f('0x3')](),auth['canUpdate'](),controller[_0xeb2f('0x4')]);router[_0xeb2f('0x2')]('/hangup',auth[_0xeb2f('0x3')](),auth[_0xeb2f('0x5')](),controller[_0xeb2f('0x6')]);router[_0xeb2f('0x2')](_0xeb2f('0x7'),auth[_0xeb2f('0x3')](),auth['canUpdate'](),controller[_0xeb2f('0x8')]);router[_0xeb2f('0x2')](_0xeb2f('0x9'),auth['isAuthenticated'](),auth[_0xeb2f('0x5')](),controller[_0xeb2f('0xa')]);router['post'](_0xeb2f('0xb'),auth[_0xeb2f('0x3')](),auth[_0xeb2f('0x5')](),controller[_0xeb2f('0xc')]);router[_0xeb2f('0x2')](_0xeb2f('0xd'),auth[_0xeb2f('0x3')](),auth[_0xeb2f('0x5')](),controller[_0xeb2f('0xe')]);router[_0xeb2f('0x2')](_0xeb2f('0xf'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xeb2f('0x10')]);module[_0xeb2f('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 0d4fa56..bc473c3 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 _0x1b32=['emit','log','handleError:','error','name','status','send','NotFound','request','then','code','message','result','User','findOne','agent','all','filter','rows','UserId','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','validate','length','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup\x20fired:','hangup\x20executed!','catch','answer','answer\x20fired:','webbar:answer','hold','sessionId','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','string','callNumber\x20is\x20required','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info'];(function(_0x14bcdf,_0x19c402){var _0x3605fc=function(_0x102c8e){while(--_0x102c8e){_0x14bcdf['push'](_0x14bcdf['shift']());}};_0x3605fc(++_0x19c402);}(_0x1b32,0x85));var _0x21b3=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x1b32[_0x1a72f3];return _0x57ef47;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x21b3('0x0'));var db=require(_0x21b3('0x1'))['db'];var config=require(_0x21b3('0x2'));var util=require(_0x21b3('0x3'));var BPromise=require(_0x21b3('0x4'));var jayson=require(_0x21b3('0x5'));var amiClient=jayson[_0x21b3('0x6')][_0x21b3('0x7')]({'port':0x232a});var logger=require(_0x21b3('0x8'))(_0x21b3('0x9'));var Redis=require(_0x21b3('0xa'));config[_0x21b3('0xb')]=_[_0x21b3('0xc')](config[_0x21b3('0xb')],{'host':_0x21b3('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x21b3('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0x12')]},'transferNumber':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x15662a,_0xe6b2b7,_0x29f286){logger[_0x21b3('0x14')](_0x15662a,_0xe6b2b7,JSON['stringify'](_0x29f286));io['to'](_0x15662a)[_0x21b3('0x15')](_0xe6b2b7,_0x29f286);}function handleError(_0x47ae6c){return function(_0x408c17){console[_0x21b3('0x16')](_0x21b3('0x17'),_0x408c17,_0x408c17 instanceof RangeError);logger[_0x21b3('0x18')](_0x408c17['stack']);if(_0x408c17 instanceof RangeError){if(_0x408c17[_0x21b3('0x19')]){delete _0x408c17[_0x21b3('0x19')];}_0x47ae6c[_0x21b3('0x1a')](0x194)['send'](_0x408c17);}else{if(_0x408c17[_0x21b3('0x19')]){delete _0x408c17[_0x21b3('0x19')];}_0x47ae6c[_0x21b3('0x1a')](0x1f4)[_0x21b3('0x1b')](_0x408c17);}};}function checkError(){return function(_0x360e57){if(!_0x360e57){throw new RangeError(_0x21b3('0x1c'));}return _0x360e57;};}function respondWithRpcPromise(_0x1e5181,_0x4cc8e0){return new BPromise(function(_0xbb78f3,_0x54695b){var _0x139672=amiClient;return _0x139672[_0x21b3('0x1d')](_0x1e5181,_0x4cc8e0)[_0x21b3('0x1e')](function(_0x4fcb87){if(_0x4fcb87[_0x21b3('0x18')]){if(_0x4fcb87['error'][_0x21b3('0x1f')]===0x1f4){return _0x54695b(_0x4fcb87[_0x21b3('0x18')][_0x21b3('0x20')]);}return _0xbb78f3(_0x4fcb87[_0x21b3('0x18')][_0x21b3('0x20')]);}else{_0xbb78f3(_0x4fcb87[_0x21b3('0x21')]);}})['catch'](function(_0x5b752c){_0x54695b(_0x5b752c);});});}function getAgent(_0x49aab8){return db[_0x21b3('0x22')][_0x21b3('0x23')]({'where':{'id':_0x49aab8,'role':_0x21b3('0x24')}})[_0x21b3('0x1e')](checkError());}function getAgentCheckSession(_0x18eba4,_0x58a356){return new BPromise(function(_0x170e78,_0x564313){var _0x16d012=respondWithRpcPromise('VoiceChannels');var _0x469e42=getAgent(_0x18eba4);Promise[_0x21b3('0x25')]([_0x16d012,_0x469e42])[_0x21b3('0x1e')](function(_0x4f6432){var _0x291e52=_0x4f6432[0x0];var _0x300977=_0x4f6432[0x1];var _0x336b1e=_[_0x21b3('0x26')](_0x291e52[_0x21b3('0x27')],function(_0x210c49){return _0x210c49[_0x21b3('0x28')]==_0x300977['id']&&_0x210c49['sessionId']==_0x58a356;});if(_0x336b1e['length']==0x1){_0x170e78(_0x300977);}else{_0x564313(new RangeError(_0x21b3('0x29')+_0x58a356+_0x21b3('0x2a')));}});});}exports['originate']=function(_0x45c753,_0xa04ac7){logger[_0x21b3('0x14')](_0x21b3('0x2b'),_0x45c753[_0x21b3('0x2c')]);var _0x6c56f5=originateValidation[_0x21b3('0x2d')](_0x45c753[_0x21b3('0x2c')]);if(_0x6c56f5[_0x21b3('0x2e')]>0x0){return _0xa04ac7['status'](0x190)['json'](_0x6c56f5);}var _0x18946f=_0x45c753['body'][_0x21b3('0x2f')];var _0x2d8c12=_0x45c753['body'][_0x21b3('0x30')];var _0x403cec=_0x45c753[_0x21b3('0x2c')][_0x21b3('0x31')];var _0x4c4239=_0x45c753[_0x21b3('0x2c')][_0x21b3('0x32')];return getAgent(_0x18946f)[_0x21b3('0x1e')](function(_0x118b9b){logger['info'](_0x21b3('0x33'),_0x118b9b['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x118b9b[_0x21b3('0x19')]),_0x21b3('0x36'),{'callNumber':_0x2d8c12,'callerId':_0x403cec,'callbackUrl':_0x4c4239});return _0xa04ac7[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x38')});})['catch'](handleError(_0xa04ac7));};exports['hangup']=function(_0x28641f,_0x86027e){logger[_0x21b3('0x14')](_0x21b3('0x39'),_0x28641f['body']);var _0x1c190e=hangupValidation[_0x21b3('0x2d')](_0x28641f[_0x21b3('0x2c')]);if(_0x1c190e[_0x21b3('0x2e')]>0x0){return _0x86027e[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x1c190e);}var _0xbb93cd=_0x28641f[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x3145b2=_0x28641f[_0x21b3('0x2c')]['sessionId'];return getAgent(_0xbb93cd)[_0x21b3('0x1e')](function(_0x321050){logger['info'](_0x21b3('0x33'),_0x321050['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x321050['name']),'webbar:hangup',{'sessionId':_0x3145b2});return _0x86027e['status'](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x3a')});})[_0x21b3('0x3b')](handleError(_0x86027e));};exports[_0x21b3('0x3c')]=function(_0x548652,_0x5d310c){logger[_0x21b3('0x14')](_0x21b3('0x3d'),_0x548652[_0x21b3('0x2c')]);var _0x28adbc=answerValidation[_0x21b3('0x2d')](_0x548652[_0x21b3('0x2c')]);if(_0x28adbc[_0x21b3('0x2e')]>0x0){return _0x5d310c['status'](0x190)[_0x21b3('0x37')](_0x28adbc);}var _0x44cf7d=_0x548652[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x119b43=_0x548652[_0x21b3('0x2c')]['sessionId'];return getAgent(_0x44cf7d)['then'](function(_0x1e7e1b){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0x1e7e1b['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x1e7e1b[_0x21b3('0x19')]),_0x21b3('0x3e'),{'sessionId':_0x119b43});return _0x5d310c[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':'answer\x20executed!'});})[_0x21b3('0x3b')](handleError(_0x5d310c));};exports[_0x21b3('0x3f')]=function(_0x3bc4ef,_0x4e3d2b){logger['info']('hold\x20fired:',_0x3bc4ef[_0x21b3('0x2c')]);var _0x17b878=holdValidation[_0x21b3('0x2d')](_0x3bc4ef[_0x21b3('0x2c')]);if(_0x17b878[_0x21b3('0x2e')]>0x0){return _0x4e3d2b[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x17b878);}var _0x30d48b=_0x3bc4ef[_0x21b3('0x2c')]['userId'];var _0x542ef4=_0x3bc4ef['body'][_0x21b3('0x40')];return getAgent(_0x30d48b)[_0x21b3('0x1e')](function(_0x4046cd){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0x4046cd[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x4046cd[_0x21b3('0x19')]),_0x21b3('0x41'),{'sessionId':_0x542ef4});return _0x4e3d2b['status'](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x42')});})[_0x21b3('0x3b')](handleError(_0x4e3d2b));};exports[_0x21b3('0x43')]=function(_0x34509e,_0x2c7019){logger[_0x21b3('0x14')](_0x21b3('0x44'),_0x34509e[_0x21b3('0x2c')]);var _0x58c568=unholdValidation[_0x21b3('0x2d')](_0x34509e[_0x21b3('0x2c')]);if(_0x58c568[_0x21b3('0x2e')]>0x0){return _0x2c7019[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x58c568);}var _0x5d7ee7=_0x34509e['body'][_0x21b3('0x2f')];var _0x4bd19f=_0x34509e[_0x21b3('0x2c')][_0x21b3('0x40')];return getAgent(_0x5d7ee7)[_0x21b3('0x1e')](function(_0x412536){logger['info']('entityFound:',_0x412536[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x412536[_0x21b3('0x19')]),'webbar:unhold',{'sessionId':_0x4bd19f});return _0x2c7019[_0x21b3('0x1a')](0xc8)['json']({'error':![],'message':_0x21b3('0x45')});})[_0x21b3('0x3b')](handleError(_0x2c7019));};exports['calls']=function(_0x5f55ff,_0x3fd841){logger[_0x21b3('0x14')](_0x21b3('0x46'),_0x3fd841[_0x21b3('0x2c')]);var _0xc612b5=callsValidation[_0x21b3('0x2d')](_0x5f55ff[_0x21b3('0x2c')]);if(_0xc612b5['length']>0x0){return _0x3fd841[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0xc612b5);}var _0x166a31=_0x5f55ff[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x49a40e=respondWithRpcPromise('VoiceChannels');var _0x31c8f8=getAgent(_0x166a31);return Promise[_0x21b3('0x25')]([_0x49a40e,_0x31c8f8])[_0x21b3('0x1e')](function(_0x279b7d){var _0x18582e=_0x279b7d[0x0];var _0x4f728=_0x279b7d[0x1];var _0x5b1611=_[_0x21b3('0x26')](_0x18582e[_0x21b3('0x27')],function(_0x552141){return _0x552141[_0x21b3('0x28')]==_0x4f728['id'];});return _0x3fd841['status'](0xc8)[_0x21b3('0x37')]({'count':_0x5b1611[_0x21b3('0x2e')],'rows':_0x5b1611});})[_0x21b3('0x3b')](handleError(_0x3fd841));};exports[_0x21b3('0x47')]=function(_0x542c4e,_0x193317){logger['info'](_0x21b3('0x48'),_0x542c4e[_0x21b3('0x2c')]);var _0x3d285f=conferenceValidation[_0x21b3('0x2d')](_0x542c4e[_0x21b3('0x2c')]);if(_0x3d285f['length']>0x0){return _0x193317[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x3d285f);}var _0x1821bf=_0x542c4e[_0x21b3('0x2c')][_0x21b3('0x2f')];return getAgent(_0x1821bf)[_0x21b3('0x1e')](function(_0xf6eb3){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0xf6eb3[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0xf6eb3[_0x21b3('0x19')]),_0x21b3('0x49'));return _0x193317[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x4a')});})[_0x21b3('0x3b')](handleError(_0x193317));};exports['transfer']=function(_0x412e3b,_0xc0c8f){logger[_0x21b3('0x14')]('transfer\x20fired:',_0x412e3b[_0x21b3('0x2c')]);var _0x3572e1=transferValidation[_0x21b3('0x2d')](_0x412e3b['body']);if(_0x3572e1[_0x21b3('0x2e')]>0x0){return _0xc0c8f[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x3572e1);}var _0x1655e4=_0x412e3b[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x2d33a7=_0x412e3b['body']['sessionId'];var _0x31c511=_0x412e3b['body'][_0x21b3('0x4b')];return getAgent(_0x1655e4)[_0x21b3('0x1e')](function(_0x164d9f){logger['info'](_0x21b3('0x33'),_0x164d9f[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x164d9f[_0x21b3('0x19')]),_0x21b3('0x4c'),{'sessionId':_0x2d33a7,'transferNumber':_0x31c511});return _0xc0c8f[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0xc0c8f));}; \ No newline at end of file +var _0x5b02=['conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','jayson/promise','http','../../config/logger','webbarapi','ioredis','redis','localhost','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','all','filter','rows','UserId','sessionId','length','originate','originate\x20fired:','body','validate','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup\x20executed!','answer','answer\x20fired:','userId','webbar:answer','answer\x20executed!','hold','hold\x20fired:','unhold\x20fired:','calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','webbar:conference'];(function(_0x23292a,_0x1e08ea){var _0x4564f2=function(_0x1ae201){while(--_0x1ae201){_0x23292a['push'](_0x23292a['shift']());}};_0x4564f2(++_0x1e08ea);}(_0x5b02,0xe9));var _0x25b0=function(_0xee2556,_0x5267a8){_0xee2556=_0xee2556-0x0;var _0x305250=_0x5b02[_0xee2556];return _0x305250;};'use strict';var path=require(_0x25b0('0x0'));var fs=require('fs');var _=require(_0x25b0('0x1'));var db=require(_0x25b0('0x2'))['db'];var config=require(_0x25b0('0x3'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x25b0('0x4'));var amiClient=jayson['client'][_0x25b0('0x5')]({'port':0x232a});var logger=require(_0x25b0('0x6'))(_0x25b0('0x7'));var Redis=require(_0x25b0('0x8'));config[_0x25b0('0x9')]=_['defaults'](config[_0x25b0('0x9')],{'host':_0x25b0('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x25b0('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x25b0('0xb')]},'callNumber':{'type':_0x25b0('0xc'),'required':[!![],_0x25b0('0xd')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x25b0('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0x25b0('0xe'),'required':[!![],_0x25b0('0xb')]},'sessionId':{'type':_0x25b0('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x25b0('0xe'),'required':[!![],_0x25b0('0xb')]},'sessionId':{'type':_0x25b0('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x25b0('0xe'),'required':[!![],_0x25b0('0xb')]},'sessionId':{'type':_0x25b0('0xc'),'required':[!![],_0x25b0('0xf')]},'transferNumber':{'type':_0x25b0('0xc'),'required':[!![],_0x25b0('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x25b0('0xe'),'required':[!![],_0x25b0('0xb')]},'sessionId':{'type':_0x25b0('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x25b0('0xe'),'required':[!![],_0x25b0('0xb')]},'sessionId':{'type':_0x25b0('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x25b0('0xe'),'required':[!![],_0x25b0('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0xfe1ea6,_0x4b2357,_0xa8280a){logger[_0x25b0('0x11')](_0xfe1ea6,_0x4b2357,JSON[_0x25b0('0x12')](_0xa8280a));io['to'](_0xfe1ea6)[_0x25b0('0x13')](_0x4b2357,_0xa8280a);}function handleError(_0x5e3a3a){return function(_0x1d850f){console[_0x25b0('0x14')](_0x25b0('0x15'),_0x1d850f,_0x1d850f instanceof RangeError);logger[_0x25b0('0x16')](_0x1d850f[_0x25b0('0x17')]);if(_0x1d850f instanceof RangeError){if(_0x1d850f[_0x25b0('0x18')]){delete _0x1d850f['name'];}_0x5e3a3a[_0x25b0('0x19')](0x194)[_0x25b0('0x1a')](_0x1d850f);}else{if(_0x1d850f[_0x25b0('0x18')]){delete _0x1d850f[_0x25b0('0x18')];}_0x5e3a3a[_0x25b0('0x19')](0x1f4)[_0x25b0('0x1a')](_0x1d850f);}};}function checkError(){return function(_0x232be7){if(!_0x232be7){throw new RangeError(_0x25b0('0x1b'));}return _0x232be7;};}function respondWithRpcPromise(_0x7bdaf9,_0x35939f){return new BPromise(function(_0x2b2eda,_0x3ce1da){var _0x5cb746=amiClient;return _0x5cb746[_0x25b0('0x1c')](_0x7bdaf9,_0x35939f)[_0x25b0('0x1d')](function(_0x517ec5){if(_0x517ec5[_0x25b0('0x16')]){if(_0x517ec5[_0x25b0('0x16')][_0x25b0('0x1e')]===0x1f4){return _0x3ce1da(_0x517ec5['error']['message']);}return _0x2b2eda(_0x517ec5['error'][_0x25b0('0x1f')]);}else{_0x2b2eda(_0x517ec5[_0x25b0('0x20')]);}})[_0x25b0('0x21')](function(_0x24f847){_0x3ce1da(_0x24f847);});});}function getAgent(_0xdbb459){return db[_0x25b0('0x22')][_0x25b0('0x23')]({'where':{'id':_0xdbb459,'role':_0x25b0('0x24')}})[_0x25b0('0x1d')](checkError());}function getAgentCheckSession(_0x596d14,_0x2ea408){return new BPromise(function(_0xbfba84,_0x5ed7d2){var _0x567775=respondWithRpcPromise('VoiceChannels');var _0x1a6212=getAgent(_0x596d14);Promise[_0x25b0('0x25')]([_0x567775,_0x1a6212])[_0x25b0('0x1d')](function(_0x105129){var _0x214377=_0x105129[0x0];var _0x3285ae=_0x105129[0x1];var _0x12676b=_[_0x25b0('0x26')](_0x214377[_0x25b0('0x27')],function(_0x285a2b){return _0x285a2b[_0x25b0('0x28')]==_0x3285ae['id']&&_0x285a2b[_0x25b0('0x29')]==_0x2ea408;});if(_0x12676b[_0x25b0('0x2a')]==0x1){_0xbfba84(_0x3285ae);}else{_0x5ed7d2(new RangeError('sessionId\x20'+_0x2ea408+'\x20not\x20found!'));}});});}exports[_0x25b0('0x2b')]=function(_0x52eec1,_0x4dfeea){logger[_0x25b0('0x11')](_0x25b0('0x2c'),_0x52eec1[_0x25b0('0x2d')]);var _0x2338fa=originateValidation[_0x25b0('0x2e')](_0x52eec1['body']);if(_0x2338fa[_0x25b0('0x2a')]>0x0){return _0x4dfeea[_0x25b0('0x19')](0x190)['json'](_0x2338fa);}var _0x13ce9=_0x52eec1[_0x25b0('0x2d')]['userId'];var _0x215fb8=_0x52eec1['body'][_0x25b0('0x2f')];var _0x21f60e=_0x52eec1[_0x25b0('0x2d')][_0x25b0('0x30')];var _0x374bde=_0x52eec1[_0x25b0('0x2d')][_0x25b0('0x31')];return getAgent(_0x13ce9)[_0x25b0('0x1d')](function(_0x2f123c){logger['info'](_0x25b0('0x32'),_0x2f123c[_0x25b0('0x18')]);emit(util[_0x25b0('0x33')](_0x25b0('0x34'),_0x2f123c[_0x25b0('0x18')]),_0x25b0('0x35'),{'callNumber':_0x215fb8,'callerId':_0x21f60e,'callbackUrl':_0x374bde});return _0x4dfeea[_0x25b0('0x19')](0xc8)[_0x25b0('0x36')]({'error':![],'message':_0x25b0('0x37')});})[_0x25b0('0x21')](handleError(_0x4dfeea));};exports['hangup']=function(_0x282af9,_0x104b35){logger[_0x25b0('0x11')]('hangup\x20fired:',_0x282af9[_0x25b0('0x2d')]);var _0x42a0ed=hangupValidation[_0x25b0('0x2e')](_0x282af9[_0x25b0('0x2d')]);if(_0x42a0ed[_0x25b0('0x2a')]>0x0){return _0x104b35[_0x25b0('0x19')](0x190)[_0x25b0('0x36')](_0x42a0ed);}var _0x391493=_0x282af9['body']['userId'];var _0x447a18=_0x282af9[_0x25b0('0x2d')][_0x25b0('0x29')];return getAgent(_0x391493)['then'](function(_0x9c6ab4){logger['info'](_0x25b0('0x32'),_0x9c6ab4[_0x25b0('0x18')]);emit(util[_0x25b0('0x33')](_0x25b0('0x34'),_0x9c6ab4[_0x25b0('0x18')]),'webbar:hangup',{'sessionId':_0x447a18});return _0x104b35[_0x25b0('0x19')](0xc8)[_0x25b0('0x36')]({'error':![],'message':_0x25b0('0x38')});})[_0x25b0('0x21')](handleError(_0x104b35));};exports[_0x25b0('0x39')]=function(_0x5a9e86,_0x327659){logger[_0x25b0('0x11')](_0x25b0('0x3a'),_0x5a9e86[_0x25b0('0x2d')]);var _0x35fc00=answerValidation[_0x25b0('0x2e')](_0x5a9e86[_0x25b0('0x2d')]);if(_0x35fc00[_0x25b0('0x2a')]>0x0){return _0x327659[_0x25b0('0x19')](0x190)[_0x25b0('0x36')](_0x35fc00);}var _0x124d4b=_0x5a9e86['body'][_0x25b0('0x3b')];var _0x5cb047=_0x5a9e86[_0x25b0('0x2d')][_0x25b0('0x29')];return getAgent(_0x124d4b)[_0x25b0('0x1d')](function(_0x365805){logger['info'](_0x25b0('0x32'),_0x365805[_0x25b0('0x18')]);emit(util[_0x25b0('0x33')]('user:%s',_0x365805[_0x25b0('0x18')]),_0x25b0('0x3c'),{'sessionId':_0x5cb047});return _0x327659[_0x25b0('0x19')](0xc8)[_0x25b0('0x36')]({'error':![],'message':_0x25b0('0x3d')});})[_0x25b0('0x21')](handleError(_0x327659));};exports[_0x25b0('0x3e')]=function(_0x55ff4c,_0x3ad3b3){logger[_0x25b0('0x11')](_0x25b0('0x3f'),_0x55ff4c['body']);var _0xbaeb06=holdValidation[_0x25b0('0x2e')](_0x55ff4c[_0x25b0('0x2d')]);if(_0xbaeb06[_0x25b0('0x2a')]>0x0){return _0x3ad3b3[_0x25b0('0x19')](0x190)['json'](_0xbaeb06);}var _0x1e8a8d=_0x55ff4c[_0x25b0('0x2d')][_0x25b0('0x3b')];var _0x524e9a=_0x55ff4c[_0x25b0('0x2d')][_0x25b0('0x29')];return getAgent(_0x1e8a8d)[_0x25b0('0x1d')](function(_0x1d6d55){logger[_0x25b0('0x11')](_0x25b0('0x32'),_0x1d6d55['name']);emit(util['format']('user:%s',_0x1d6d55[_0x25b0('0x18')]),'webbar:hold',{'sessionId':_0x524e9a});return _0x3ad3b3['status'](0xc8)[_0x25b0('0x36')]({'error':![],'message':'hold\x20executed!'});})[_0x25b0('0x21')](handleError(_0x3ad3b3));};exports['unhold']=function(_0x4fc22d,_0x394e52){logger[_0x25b0('0x11')](_0x25b0('0x40'),_0x4fc22d[_0x25b0('0x2d')]);var _0x42d139=unholdValidation[_0x25b0('0x2e')](_0x4fc22d[_0x25b0('0x2d')]);if(_0x42d139[_0x25b0('0x2a')]>0x0){return _0x394e52[_0x25b0('0x19')](0x190)[_0x25b0('0x36')](_0x42d139);}var _0x48fb71=_0x4fc22d['body']['userId'];var _0xf1e6bf=_0x4fc22d[_0x25b0('0x2d')][_0x25b0('0x29')];return getAgent(_0x48fb71)[_0x25b0('0x1d')](function(_0x14db4c){logger[_0x25b0('0x11')](_0x25b0('0x32'),_0x14db4c['name']);emit(util[_0x25b0('0x33')]('user:%s',_0x14db4c[_0x25b0('0x18')]),'webbar:unhold',{'sessionId':_0xf1e6bf});return _0x394e52['status'](0xc8)[_0x25b0('0x36')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x394e52));};exports[_0x25b0('0x41')]=function(_0xe5dc47,_0x38e958){logger[_0x25b0('0x11')](_0x25b0('0x42'),_0x38e958[_0x25b0('0x2d')]);var _0x8bbdb3=callsValidation[_0x25b0('0x2e')](_0xe5dc47[_0x25b0('0x2d')]);if(_0x8bbdb3[_0x25b0('0x2a')]>0x0){return _0x38e958['status'](0x190)['json'](_0x8bbdb3);}var _0x163a05=_0xe5dc47[_0x25b0('0x2d')]['userId'];var _0xef5172=respondWithRpcPromise(_0x25b0('0x43'));var _0x176a1d=getAgent(_0x163a05);return Promise[_0x25b0('0x25')]([_0xef5172,_0x176a1d])[_0x25b0('0x1d')](function(_0x4cce6a){var _0x163a01=_0x4cce6a[0x0];var _0x2d1577=_0x4cce6a[0x1];var _0x135371=_['filter'](_0x163a01[_0x25b0('0x27')],function(_0x3f0516){return _0x3f0516[_0x25b0('0x28')]==_0x2d1577['id'];});return _0x38e958[_0x25b0('0x19')](0xc8)[_0x25b0('0x36')]({'count':_0x135371[_0x25b0('0x2a')],'rows':_0x135371});})[_0x25b0('0x21')](handleError(_0x38e958));};exports[_0x25b0('0x44')]=function(_0x28682b,_0x39a5e3){logger[_0x25b0('0x11')](_0x25b0('0x45'),_0x28682b[_0x25b0('0x2d')]);var _0x2c5995=conferenceValidation['validate'](_0x28682b[_0x25b0('0x2d')]);if(_0x2c5995[_0x25b0('0x2a')]>0x0){return _0x39a5e3['status'](0x190)[_0x25b0('0x36')](_0x2c5995);}var _0x4c089c=_0x28682b[_0x25b0('0x2d')][_0x25b0('0x3b')];return getAgent(_0x4c089c)['then'](function(_0x4513e8){logger[_0x25b0('0x11')](_0x25b0('0x32'),_0x4513e8['name']);emit(util[_0x25b0('0x33')]('user:%s',_0x4513e8[_0x25b0('0x18')]),_0x25b0('0x46'));return _0x39a5e3['status'](0xc8)[_0x25b0('0x36')]({'error':![],'message':_0x25b0('0x47')});})['catch'](handleError(_0x39a5e3));};exports[_0x25b0('0x48')]=function(_0x5b1aef,_0x5e7724){logger['info'](_0x25b0('0x49'),_0x5b1aef[_0x25b0('0x2d')]);var _0x2f1d4a=transferValidation['validate'](_0x5b1aef[_0x25b0('0x2d')]);if(_0x2f1d4a[_0x25b0('0x2a')]>0x0){return _0x5e7724[_0x25b0('0x19')](0x190)[_0x25b0('0x36')](_0x2f1d4a);}var _0x1e4c6e=_0x5b1aef[_0x25b0('0x2d')][_0x25b0('0x3b')];var _0x452f19=_0x5b1aef[_0x25b0('0x2d')][_0x25b0('0x29')];var _0x1fb191=_0x5b1aef[_0x25b0('0x2d')][_0x25b0('0x4a')];return getAgent(_0x1e4c6e)[_0x25b0('0x1d')](function(_0x1b0150){logger[_0x25b0('0x11')](_0x25b0('0x32'),_0x1b0150['name']);emit(util[_0x25b0('0x33')]('user:%s',_0x1b0150[_0x25b0('0x18')]),_0x25b0('0x4b'),{'sessionId':_0x452f19,'transferNumber':_0x1fb191});return _0x5e7724[_0x25b0('0x19')](0xc8)[_0x25b0('0x36')]({'error':![],'message':'transfer\x20executed!'});})[_0x25b0('0x21')](handleError(_0x5e7724));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 3b0e2ca..2b17a74 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 _0x7096=['removeAgents','exports','util','connect-timeout','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','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/notify','/:id/send','send','/:id','update','delete','destroy','removeDispositions','removeAnswers'];(function(_0x35a742,_0x540ebd){var _0x4e9f0a=function(_0x166cd4){while(--_0x166cd4){_0x35a742['push'](_0x35a742['shift']());}};_0x4e9f0a(++_0x540ebd);}(_0x7096,0x10c));var _0x6709=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7096[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0x6709('0x0'));var path=require('path');var timeout=require(_0x6709('0x1'));var express=require('express');var router=express[_0x6709('0x2')]();var fs_extra=require(_0x6709('0x3'));var auth=require(_0x6709('0x4'));var interaction=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var controller=require(_0x6709('0x7'));router[_0x6709('0x8')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0xa')]);router[_0x6709('0x8')](_0x6709('0xb'),auth[_0x6709('0x9')](),controller[_0x6709('0xc')]);router['get']('/:id',auth[_0x6709('0x9')](),controller[_0x6709('0xd')]);router[_0x6709('0x8')](_0x6709('0xe'),auth[_0x6709('0x9')](),controller[_0x6709('0xf')]);router['get']('/:id/canned_answers',auth[_0x6709('0x9')](),controller[_0x6709('0x10')]);router[_0x6709('0x8')](_0x6709('0x11'),auth[_0x6709('0x9')](),controller[_0x6709('0x12')]);router[_0x6709('0x8')](_0x6709('0x13'),auth['isAuthenticated'](),controller[_0x6709('0x14')]);router[_0x6709('0x15')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0x16')]);router['post'](_0x6709('0xe'),auth['isAuthenticated'](),controller[_0x6709('0x17')]);router['post'](_0x6709('0x18'),auth[_0x6709('0x9')](),controller[_0x6709('0x19')]);router[_0x6709('0x15')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x6709('0x15')](_0x6709('0x13'),auth['isAuthenticated'](),controller[_0x6709('0x1a')]);router[_0x6709('0x15')](_0x6709('0x1b'),controller['notify']);router[_0x6709('0x15')](_0x6709('0x1c'),auth[_0x6709('0x9')](),controller[_0x6709('0x1d')]);router['put'](_0x6709('0x1e'),auth[_0x6709('0x9')](),controller[_0x6709('0x1f')]);router[_0x6709('0x20')](_0x6709('0x1e'),auth[_0x6709('0x9')](),controller[_0x6709('0x21')]);router[_0x6709('0x20')](_0x6709('0xe'),auth[_0x6709('0x9')](),controller[_0x6709('0x22')]);router[_0x6709('0x20')]('/:id/canned_answers',auth[_0x6709('0x9')](),controller[_0x6709('0x23')]);router[_0x6709('0x20')]('/:id/users',auth[_0x6709('0x9')](),controller[_0x6709('0x24')]);module[_0x6709('0x25')]=router; \ No newline at end of file +var _0x524e=['index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','addDisposition','addAnswer','addApplications','/:id/notify','notify','/:id/send','put','update','delete','destroy','removeAnswers','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get'];(function(_0x4ea413,_0x51ff3a){var _0x51cf25=function(_0x3c6456){while(--_0x3c6456){_0x4ea413['push'](_0x4ea413['shift']());}};_0x51cf25(++_0x51ff3a);}(_0x524e,0x15e));var _0xe524=function(_0x5a9e79,_0x5799de){_0x5a9e79=_0x5a9e79-0x0;var _0x5cca9c=_0x524e[_0x5a9e79];return _0x5cca9c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x9')](_0xe524('0x10'),auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x9')](_0xe524('0x12'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x9')](_0xe524('0x14'),auth[_0xe524('0xe')](),controller['getAgents']);router['get'](_0xe524('0x15'),auth[_0xe524('0xe')](),controller[_0xe524('0x16')]);router[_0xe524('0x17')]('/',auth[_0xe524('0xe')](),controller['create']);router[_0xe524('0x17')]('/:id/dispositions',auth[_0xe524('0xe')](),controller[_0xe524('0x18')]);router['post'](_0xe524('0x12'),auth['isAuthenticated'](),controller[_0xe524('0x19')]);router['post'](_0xe524('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['post'](_0xe524('0x15'),auth['isAuthenticated'](),controller[_0xe524('0x1a')]);router[_0xe524('0x17')](_0xe524('0x1b'),controller[_0xe524('0x1c')]);router['post'](_0xe524('0x1d'),auth[_0xe524('0xe')](),controller['send']);router[_0xe524('0x1e')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x1f')]);router[_0xe524('0x20')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x21')]);router[_0xe524('0x20')]('/:id/dispositions',auth[_0xe524('0xe')](),controller['removeDispositions']);router['delete'](_0xe524('0x12'),auth[_0xe524('0xe')](),controller[_0xe524('0x22')]);router[_0xe524('0x20')]('/:id/users',auth[_0xe524('0xe')](),controller['removeAgents']);module[_0xe524('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 0ef09d5..1cbf1e7 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 _0x1bd0=['mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId'];(function(_0x1482fc,_0x5d347c){var _0x2b2c9a=function(_0x147032){while(--_0x147032){_0x1482fc['push'](_0x1482fc['shift']());}};_0x2b2c9a(++_0x5d347c);}(_0x1bd0,0x160));var _0x01bd=function(_0x410c13,_0x17f4f5){_0x410c13=_0x410c13-0x0;var _0x442ad2=_0x1bd0[_0x410c13];return _0x442ad2;};'use strict';var Sequelize=require(_0x01bd('0x0'));var rs=require(_0x01bd('0x1'));module[_0x01bd('0x2')]={'name':{'type':Sequelize[_0x01bd('0x3')],'unique':_0x01bd('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x01bd('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x01bd('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x01bd('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x01bd('0x5')]('twilio')},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x01bd('0x3')]},'notificationTemplate':{'type':Sequelize[_0x01bd('0x6')],'defaultValue':function(){return _0x01bd('0x7');}},'notificationSound':{'type':Sequelize[_0x01bd('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x01bd('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x01bd('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x01bd('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x01bd('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x01bd('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x01bd('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x01bd('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1c04d8){if(!_0x1c04d8){this[_0x01bd('0xa')](_0x01bd('0xb'),null);}this[_0x01bd('0xa')](_0x01bd('0xc'),_0x1c04d8);}},'description':{'type':Sequelize[_0x01bd('0x3')]}}; \ No newline at end of file +var _0x952e=['BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','twilio','TEXT','INTEGER'];(function(_0x4a494d,_0x2e3e04){var _0x5222ae=function(_0x1a317b){while(--_0x1a317b){_0x4a494d['push'](_0x4a494d['shift']());}};_0x5222ae(++_0x2e3e04);}(_0x952e,0x1bf));var _0xe952=function(_0x491501,_0x38538d){_0x491501=_0x491501-0x0;var _0x2cbdcc=_0x952e[_0x491501];return _0x2cbdcc;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xe952('0x0'));module[_0xe952('0x1')]={'name':{'type':Sequelize[_0xe952('0x2')],'unique':_0xe952('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xe952('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xe952('0x2')],'defaultValue':function(){return rs[_0xe952('0x4')]();}},'phone':{'type':Sequelize[_0xe952('0x2')]},'type':{'type':Sequelize['ENUM'](_0xe952('0x5'))},'accountSid':{'type':Sequelize[_0xe952('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xe952('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe952('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe952('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe952('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe952('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe952('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe952('0x8')],'defaultValue':![],'comment':_0xe952('0x9'),'set':function(_0x423297){if(!_0x423297){this[_0xe952('0xa')](_0xe952('0xb'),null);}this[_0xe952('0xa')](_0xe952('0xc'),_0x423297);}},'description':{'type':Sequelize[_0xe952('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index b1b284b..8eb837f 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 _0xb06c=['undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','WhatsappAccounts','stack','name','send','index','map','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','Pause','describe','addDisposition','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','WhatsappAccountId','getAnswers','CannedAnswer','order','removeAnswers','addAgents','omit','emit','removeAgents','userWhatsappAccount:remove','getAgents','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','applications','orderBy','Applications','asc','account','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','type','from','From','replace','whatsapp:','messageId','MessageSid','isNil','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','contact','WhatsappInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','to\x20is\x20mandatory','List','out','WhatsappMessage','Messages','dataValues','rimraf','zip-dir','moment','bluebird','util','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','end','json','offset'];(function(_0xb725be,_0x45bd01){var _0x2f2424=function(_0x2566ca){while(--_0x2566ca){_0xb725be['push'](_0xb725be['shift']());}};_0x2f2424(++_0x45bd01);}(_0xb06c,0x141));var _0xcb06=function(_0xaee9d,_0x56f26d){_0xaee9d=_0xaee9d-0x0;var _0x20f1aa=_0xb06c[_0xaee9d];return _0x20f1aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb06('0x0'));var zipdir=require(_0xcb06('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcb06('0x2'));var BPromise=require(_0xcb06('0x3'));var Mustache=require('mustache');var util=require(_0xcb06('0x4'));var path=require(_0xcb06('0x5'));var sox=require('sox');var csv=require(_0xcb06('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb06('0x7'));var squel=require('squel');var crypto=require(_0xcb06('0x8'));var jsforce=require(_0xcb06('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xcb06('0x6'));var querystring=require(_0xcb06('0xa'));var Papa=require(_0xcb06('0xb'));var Redis=require(_0xcb06('0xc'));var authService=require(_0xcb06('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xcb06('0xe'));var hardwareService=require(_0xcb06('0xf'));var logger=require(_0xcb06('0x10'))(_0xcb06('0x11'));var utils=require('../../config/utils');var config=require(_0xcb06('0x12'));var licenseUtil=require(_0xcb06('0x13'));var db=require(_0xcb06('0x14'))['db'];config[_0xcb06('0x15')]=_[_0xcb06('0x16')](config[_0xcb06('0x15')],{'host':_0xcb06('0x17'),'port':0x18eb});var socket=require(_0xcb06('0x18'))(new Redis(config[_0xcb06('0x15')]));require('./whatsappAccount.socket')[_0xcb06('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xcb06('0x1a')][_0xcb06('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x497d2d,_0x1bf7e4,_0x2153ea,_0x53227f){return new BPromise(function(_0x4b57d4,_0x22e423){var _0xb84c2c=_0x53227f||client;return _0xb84c2c[_0xcb06('0x1c')](_0x497d2d,_0x2153ea)[_0xcb06('0x1d')](function(_0x52e595){logger[_0xcb06('0x1e')](_0xcb06('0x1f'),_0x1bf7e4,_0xcb06('0x20'));logger[_0xcb06('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1bf7e4,_0xcb06('0x20'),JSON[_0xcb06('0x22')](_0x52e595));if(_0x52e595[_0xcb06('0x23')]){if(_0x52e595[_0xcb06('0x23')][_0xcb06('0x24')]===0x1f4){logger[_0xcb06('0x23')](_0xcb06('0x1f'),_0x1bf7e4,_0x52e595[_0xcb06('0x23')][_0xcb06('0x25')]);return _0x22e423(_0x52e595[_0xcb06('0x23')][_0xcb06('0x25')]);}logger[_0xcb06('0x23')](_0xcb06('0x1f'),_0x1bf7e4,_0x52e595[_0xcb06('0x23')][_0xcb06('0x25')]);return _0x4b57d4(_0x52e595[_0xcb06('0x23')][_0xcb06('0x25')]);}else{logger['info'](_0xcb06('0x1f'),_0x1bf7e4,_0xcb06('0x20'));_0x4b57d4(_0x52e595['result'][_0xcb06('0x25')]);}})['catch'](function(_0x3b7412){logger[_0xcb06('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x1bf7e4,_0x3b7412);_0x22e423(_0x3b7412);});});}function respondWithStatusCode(_0x2f8f75,_0x24e667){_0x24e667=_0x24e667||0xcc;return function(_0x13b321){if(_0x13b321){return _0x2f8f75[_0xcb06('0x26')](_0x24e667);}return _0x2f8f75[_0xcb06('0x27')](_0x24e667)[_0xcb06('0x28')]();};}function respondWithResult(_0x31ce67,_0xed9c31){_0xed9c31=_0xed9c31||0xc8;return function(_0x3309c2){if(_0x3309c2){return _0x31ce67['status'](_0xed9c31)[_0xcb06('0x29')](_0x3309c2);}};}function respondWithFilteredResult(_0x288f55,_0x443ca8){return function(_0x1555f2){if(_0x1555f2){var _0x163f1e=typeof _0x443ca8[_0xcb06('0x2a')]===_0xcb06('0x2b')&&typeof _0x443ca8[_0xcb06('0x2c')]===_0xcb06('0x2b');var _0x11ec0b=_0x1555f2[_0xcb06('0x2d')];var _0x21981f=_0x163f1e?0x0:_0x443ca8[_0xcb06('0x2a')];var _0x332124=_0x163f1e?_0x1555f2[_0xcb06('0x2d')]:_0x443ca8[_0xcb06('0x2a')]+_0x443ca8[_0xcb06('0x2c')];var _0x245aaa;if(_0x332124>=_0x11ec0b){_0x332124=_0x11ec0b;_0x245aaa=0xc8;}else{_0x245aaa=0xce;}_0x288f55[_0xcb06('0x27')](_0x245aaa);return _0x288f55[_0xcb06('0x2e')](_0xcb06('0x2f'),_0x21981f+'-'+_0x332124+'/'+_0x11ec0b)[_0xcb06('0x29')](_0x1555f2);}return null;};}function patchUpdates(_0x5145c6){return function(_0x54630a){try{jsonpatch[_0xcb06('0x30')](_0x54630a,_0x5145c6,!![]);}catch(_0x515505){return BPromise[_0xcb06('0x31')](_0x515505);}return _0x54630a[_0xcb06('0x32')]();};}function saveUpdates(_0x4931a4,_0x1a38de){return function(_0x14769e){if(_0x14769e){return _0x14769e['update'](_0x4931a4)['then'](function(_0x5199a9){return _0x5199a9;});}return null;};}function removeEntity(_0x21ff02,_0x5ce295){return function(_0x264ca5){if(_0x264ca5){return _0x264ca5[_0xcb06('0x33')]()[_0xcb06('0x1d')](function(){var _0x371623=_0x264ca5[_0xcb06('0x34')]({'plain':!![]});var _0x4a8522=_0xcb06('0x35');return db['UserProfileResource'][_0xcb06('0x33')]({'where':{'type':_0x4a8522,'resourceId':_0x371623['id']}})[_0xcb06('0x1d')](function(){return _0x264ca5;});})[_0xcb06('0x1d')](function(){_0x21ff02['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45bd00,_0x5dcc36){return function(_0x5e3989){if(!_0x5e3989){_0x45bd00['sendStatus'](0x194);}return _0x5e3989;};}function handleError(_0x568e16,_0x55e712){_0x55e712=_0x55e712||0x1f4;return function(_0x4f41a0){logger['error'](_0x4f41a0[_0xcb06('0x36')]);if(_0x4f41a0['name']){delete _0x4f41a0[_0xcb06('0x37')];}_0x568e16[_0xcb06('0x27')](_0x55e712)[_0xcb06('0x38')](_0x4f41a0);};}exports[_0xcb06('0x39')]=function(_0x15c429,_0x39d205){var _0x2707dd={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x104d11={},_0x25476b={'count':0x0,'rows':[]};var _0x5113d=_[_0xcb06('0x3a')](db['WhatsappAccount']['rawAttributes'],function(_0x44b5c8){return{'name':_0x44b5c8['fieldName'],'type':_0x44b5c8['type'][_0xcb06('0x3b')]};});_0x104d11[_0xcb06('0x3c')]=_[_0xcb06('0x3a')](_0x5113d,_0xcb06('0x37'));_0x104d11[_0xcb06('0x3d')]=_[_0xcb06('0x3e')](_0x15c429['query']);_0x104d11[_0xcb06('0x3f')]=_[_0xcb06('0x40')](_0x104d11['model'],_0x104d11[_0xcb06('0x3d')]);_0x2707dd[_0xcb06('0x41')]=_['intersection'](_0x104d11['model'],qs['fields'](_0x15c429[_0xcb06('0x3d')][_0xcb06('0x42')]));_0x2707dd[_0xcb06('0x41')]=_0x2707dd[_0xcb06('0x41')][_0xcb06('0x43')]?_0x2707dd[_0xcb06('0x41')]:_0x104d11['model'];if(!_0x15c429[_0xcb06('0x3d')][_0xcb06('0x44')](_0xcb06('0x45'))){_0x2707dd[_0xcb06('0x2c')]=qs[_0xcb06('0x2c')](_0x15c429[_0xcb06('0x3d')][_0xcb06('0x2c')]);_0x2707dd[_0xcb06('0x2a')]=qs[_0xcb06('0x2a')](_0x15c429['query'][_0xcb06('0x2a')]);}_0x2707dd['order']=qs['sort'](_0x15c429[_0xcb06('0x3d')][_0xcb06('0x46')]);_0x2707dd[_0xcb06('0x47')]=qs[_0xcb06('0x3f')](_[_0xcb06('0x48')](_0x15c429['query'],_0x104d11[_0xcb06('0x3f')]),_0x5113d);if(_0x15c429[_0xcb06('0x3d')][_0xcb06('0x49')]){_0x2707dd[_0xcb06('0x47')]=_[_0xcb06('0x4a')](_0x2707dd[_0xcb06('0x47')],{'$or':_[_0xcb06('0x3a')](_0x5113d,function(_0x2347c5){if(_0x2347c5['type']!==_0xcb06('0x4b')){var _0xfd16e1={};_0xfd16e1[_0x2347c5[_0xcb06('0x37')]]={'$like':'%'+_0x15c429[_0xcb06('0x3d')][_0xcb06('0x49')]+'%'};return _0xfd16e1;}})});}_0x2707dd=_[_0xcb06('0x4a')]({},_0x2707dd,_0x15c429[_0xcb06('0x4c')]);var _0x198372={'where':_0x2707dd['where']};return db[_0xcb06('0x4d')][_0xcb06('0x2d')](_0x198372)[_0xcb06('0x1d')](function(_0x192faa){_0x25476b[_0xcb06('0x2d')]=_0x192faa;if(_0x15c429[_0xcb06('0x3d')][_0xcb06('0x4e')]){_0x2707dd[_0xcb06('0x4f')]=[{'all':!![]}];}return db[_0xcb06('0x4d')][_0xcb06('0x50')](_0x2707dd);})['then'](function(_0x24ab43){_0x25476b[_0xcb06('0x51')]=_0x24ab43;return _0x25476b;})['then'](respondWithFilteredResult(_0x39d205,_0x2707dd))[_0xcb06('0x52')](handleError(_0x39d205,null));};exports[_0xcb06('0x53')]=function(_0x3ec687,_0x11b926){var _0x4485a3={'raw':![],'where':{'id':_0x3ec687[_0xcb06('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0xcb06('0x55')}]},_0x4effe5={};_0x4effe5['model']=_[_0xcb06('0x3e')](db[_0xcb06('0x4d')][_0xcb06('0x56')]);_0x4effe5[_0xcb06('0x3d')]=_[_0xcb06('0x3e')](_0x3ec687['query']);_0x4effe5[_0xcb06('0x3f')]=_['intersection'](_0x4effe5[_0xcb06('0x3c')],_0x4effe5[_0xcb06('0x3d')]);_0x4485a3[_0xcb06('0x41')]=_[_0xcb06('0x40')](_0x4effe5['model'],qs[_0xcb06('0x42')](_0x3ec687[_0xcb06('0x3d')][_0xcb06('0x42')]));_0x4485a3[_0xcb06('0x41')]=_0x4485a3[_0xcb06('0x41')][_0xcb06('0x43')]?_0x4485a3['attributes']:_0x4effe5[_0xcb06('0x3c')];if(_0x3ec687[_0xcb06('0x3d')][_0xcb06('0x4e')]){_0x4485a3[_0xcb06('0x4f')]=[{'all':!![]}];}_0x4485a3=_[_0xcb06('0x4a')]({},_0x4485a3,_0x3ec687[_0xcb06('0x4c')]);return db['WhatsappAccount'][_0xcb06('0x57')](_0x4485a3)[_0xcb06('0x1d')](handleEntityNotFound(_0x11b926,null))['then'](respondWithResult(_0x11b926,null))[_0xcb06('0x52')](handleError(_0x11b926,null));};exports[_0xcb06('0x58')]=function(_0xcdeee7,_0xb9d177){return db[_0xcb06('0x4d')]['create'](_0xcdeee7[_0xcb06('0x59')],{})[_0xcb06('0x1d')](function(_0x10e1ef){var _0xf061f7=_0xcdeee7['user']['get']({'plain':!![]});if(!_0xf061f7)throw new Error(_0xcb06('0x5a'));if(_0xf061f7[_0xcb06('0x5b')]===_0xcb06('0x5c')){var _0x533f0a=_0x10e1ef[_0xcb06('0x34')]({'plain':!![]});var _0x21fced=_0xcb06('0x35');return db['UserProfileSection']['find']({'where':{'name':_0x21fced,'userProfileId':_0xf061f7[_0xcb06('0x5d')]},'raw':!![]})['then'](function(_0x3f3fcb){if(_0x3f3fcb&&_0x3f3fcb['autoAssociation']===0x0){return db['UserProfileResource'][_0xcb06('0x58')]({'name':_0x533f0a[_0xcb06('0x37')],'resourceId':_0x533f0a['id'],'type':_0x3f3fcb['name'],'sectionId':_0x3f3fcb['id']},{})[_0xcb06('0x1d')](function(){return _0x10e1ef;});}else{return _0x10e1ef;}})[_0xcb06('0x52')](function(_0x185f4b){logger[_0xcb06('0x23')](_0xcb06('0x5e'),_0x185f4b);throw _0x185f4b;});}return _0x10e1ef;})['then'](respondWithResult(_0xb9d177,0xc9))[_0xcb06('0x52')](handleError(_0xb9d177,null));};exports[_0xcb06('0x5f')]=function(_0x10e4e2,_0x2a0537){if(_0x10e4e2['body']['id']){delete _0x10e4e2[_0xcb06('0x59')]['id'];}return db[_0xcb06('0x4d')][_0xcb06('0x57')]({'where':{'id':_0x10e4e2[_0xcb06('0x54')]['id']},'include':[{'model':db[_0xcb06('0x60')],'as':_0xcb06('0x55')}]})['then'](handleEntityNotFound(_0x2a0537,null))[_0xcb06('0x1d')](saveUpdates(_0x10e4e2['body'],null))[_0xcb06('0x1d')](respondWithResult(_0x2a0537,null))[_0xcb06('0x52')](handleError(_0x2a0537,null));};exports[_0xcb06('0x33')]=function(_0x224b2a,_0x523e98){return db[_0xcb06('0x4d')][_0xcb06('0x57')]({'where':{'id':_0x224b2a['params']['id']}})[_0xcb06('0x1d')](handleEntityNotFound(_0x523e98,null))[_0xcb06('0x1d')](removeEntity(_0x523e98,null))['catch'](handleError(_0x523e98,null));};exports[_0xcb06('0x61')]=function(_0x487936,_0x44b171){return db[_0xcb06('0x4d')][_0xcb06('0x61')]()[_0xcb06('0x1d')](respondWithResult(_0x44b171,null))[_0xcb06('0x52')](handleError(_0x44b171,null));};exports[_0xcb06('0x62')]=function(_0x2541d6,_0x3efc5f,_0x58b734){if(_0x2541d6[_0xcb06('0x59')]['id']){delete _0x2541d6['body']['id'];}return db['WhatsappAccount'][_0xcb06('0x57')]({'where':{'id':_0x2541d6['params']['id']}})[_0xcb06('0x1d')](handleEntityNotFound(_0x3efc5f,null))[_0xcb06('0x1d')](function(_0x5cb0b8){if(_0x5cb0b8){_0x2541d6[_0xcb06('0x59')]['WhatsappAccountId']=_0x5cb0b8['id'];return db[_0xcb06('0x63')][_0xcb06('0x58')](_0x2541d6[_0xcb06('0x59')]);}})[_0xcb06('0x1d')](respondWithResult(_0x3efc5f,null))['catch'](handleError(_0x3efc5f,null));};exports[_0xcb06('0x64')]=function(_0x30ab45,_0x2fdf6d,_0x22bc96){var _0x239f2e={'raw':![],'where':{}};var _0x4414f9={};var _0x18196a={'count':0x0,'rows':[]};return db[_0xcb06('0x4d')][_0xcb06('0x65')]({'where':{'id':_0x30ab45['params']['id']}})[_0xcb06('0x1d')](handleEntityNotFound(_0x2fdf6d,null))[_0xcb06('0x1d')](function(_0xdd4a97){if(_0xdd4a97){_0x4414f9['model']=_['keys'](db[_0xcb06('0x63')][_0xcb06('0x56')]);_0x4414f9[_0xcb06('0x3d')]=_['keys'](_0x30ab45['query']);_0x4414f9[_0xcb06('0x3f')]=_[_0xcb06('0x40')](_0x4414f9[_0xcb06('0x3c')],_0x4414f9[_0xcb06('0x3d')]);_0x239f2e[_0xcb06('0x41')]=_[_0xcb06('0x40')](_0x4414f9[_0xcb06('0x3c')],qs['fields'](_0x30ab45['query'][_0xcb06('0x42')]));_0x239f2e[_0xcb06('0x41')]=_0x239f2e['attributes'][_0xcb06('0x43')]?_0x239f2e[_0xcb06('0x41')]:_0x4414f9[_0xcb06('0x3c')];if(!_0x30ab45[_0xcb06('0x3d')][_0xcb06('0x44')](_0xcb06('0x45'))){_0x239f2e[_0xcb06('0x2c')]=qs['limit'](_0x30ab45[_0xcb06('0x3d')][_0xcb06('0x2c')]);_0x239f2e[_0xcb06('0x2a')]=qs['offset'](_0x30ab45[_0xcb06('0x3d')][_0xcb06('0x2a')]);}_0x239f2e['order']=qs[_0xcb06('0x46')](_0x30ab45[_0xcb06('0x3d')]['sort']);_0x239f2e[_0xcb06('0x47')]=qs[_0xcb06('0x3f')](_[_0xcb06('0x48')](_0x30ab45[_0xcb06('0x3d')],_0x4414f9[_0xcb06('0x3f')]));_0x239f2e[_0xcb06('0x47')]['WhatsappAccountId']=_0xdd4a97['id'];if(_0x30ab45[_0xcb06('0x3d')]['filter']){_0x239f2e[_0xcb06('0x47')]=_[_0xcb06('0x4a')](_0x239f2e[_0xcb06('0x47')],{'$or':_[_0xcb06('0x3a')](_0x239f2e['attributes'],function(_0xdd1ae4){var _0xb81f1d={};_0xb81f1d[_0xdd1ae4]={'$like':'%'+_0x30ab45[_0xcb06('0x3d')][_0xcb06('0x49')]+'%'};return _0xb81f1d;})});}_0x239f2e=_[_0xcb06('0x4a')]({},_0x239f2e,_0x30ab45['options']);return db[_0xcb06('0x63')][_0xcb06('0x2d')]({'where':_0x239f2e[_0xcb06('0x47')]})[_0xcb06('0x1d')](function(_0x450aa9){_0x18196a[_0xcb06('0x2d')]=_0x450aa9;if(_0x30ab45['query']['includeAll']){_0x239f2e[_0xcb06('0x4f')]=[{'all':!![]}];}return db[_0xcb06('0x63')]['findAll'](_0x239f2e);})['then'](function(_0x5cee9c){_0x18196a['rows']=_0x5cee9c;return _0x18196a;});}})[_0xcb06('0x1d')](respondWithFilteredResult(_0x2fdf6d,_0x239f2e))[_0xcb06('0x52')](handleError(_0x2fdf6d,null));};exports['removeDispositions']=function(_0x3fb1aa,_0x49e82d,_0x2333b9){return db[_0xcb06('0x4d')][_0xcb06('0x57')]({'where':{'id':_0x3fb1aa[_0xcb06('0x54')]['id']}})[_0xcb06('0x1d')](handleEntityNotFound(_0x49e82d,null))[_0xcb06('0x1d')](function(_0x2478c8){if(_0x2478c8){return _0x2478c8[_0xcb06('0x66')](_0x3fb1aa[_0xcb06('0x3d')][_0xcb06('0x67')]);}})[_0xcb06('0x1d')](respondWithStatusCode(_0x49e82d,null))['catch'](handleError(_0x49e82d,null));};exports[_0xcb06('0x68')]=function(_0x615503,_0x554076,_0x2a3414){if(_0x615503['body']['id']){delete _0x615503['body']['id'];}return db[_0xcb06('0x4d')][_0xcb06('0x57')]({'where':{'id':_0x615503[_0xcb06('0x54')]['id']}})[_0xcb06('0x1d')](handleEntityNotFound(_0x554076,null))[_0xcb06('0x1d')](function(_0x5c9b01){if(_0x5c9b01){_0x615503['body'][_0xcb06('0x69')]=_0x5c9b01['id'];return db['CannedAnswer']['create'](_0x615503[_0xcb06('0x59')]);}})[_0xcb06('0x1d')](respondWithResult(_0x554076,null))[_0xcb06('0x52')](handleError(_0x554076,null));};exports[_0xcb06('0x6a')]=function(_0x25a64e,_0x8bc9dd,_0x2b9ded){var _0x2370e5={'raw':![],'where':{}};var _0x399680={};var _0x1387b2={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xcb06('0x65')]({'where':{'id':_0x25a64e['params']['id']}})['then'](handleEntityNotFound(_0x8bc9dd,null))[_0xcb06('0x1d')](function(_0x5a3ad2){if(_0x5a3ad2){_0x399680[_0xcb06('0x3c')]=_['keys'](db[_0xcb06('0x6b')][_0xcb06('0x56')]);_0x399680[_0xcb06('0x3d')]=_[_0xcb06('0x3e')](_0x25a64e[_0xcb06('0x3d')]);_0x399680[_0xcb06('0x3f')]=_['intersection'](_0x399680[_0xcb06('0x3c')],_0x399680[_0xcb06('0x3d')]);_0x2370e5['attributes']=_[_0xcb06('0x40')](_0x399680[_0xcb06('0x3c')],qs['fields'](_0x25a64e[_0xcb06('0x3d')]['fields']));_0x2370e5['attributes']=_0x2370e5[_0xcb06('0x41')][_0xcb06('0x43')]?_0x2370e5[_0xcb06('0x41')]:_0x399680[_0xcb06('0x3c')];if(!_0x25a64e['query'][_0xcb06('0x44')](_0xcb06('0x45'))){_0x2370e5['limit']=qs[_0xcb06('0x2c')](_0x25a64e[_0xcb06('0x3d')][_0xcb06('0x2c')]);_0x2370e5[_0xcb06('0x2a')]=qs['offset'](_0x25a64e[_0xcb06('0x3d')]['offset']);}_0x2370e5[_0xcb06('0x6c')]=qs[_0xcb06('0x46')](_0x25a64e[_0xcb06('0x3d')]['sort']);_0x2370e5[_0xcb06('0x47')]=qs[_0xcb06('0x3f')](_[_0xcb06('0x48')](_0x25a64e[_0xcb06('0x3d')],_0x399680[_0xcb06('0x3f')]));_0x2370e5['where'][_0xcb06('0x69')]=_0x5a3ad2['id'];if(_0x25a64e[_0xcb06('0x3d')][_0xcb06('0x49')]){_0x2370e5[_0xcb06('0x47')]=_[_0xcb06('0x4a')](_0x2370e5[_0xcb06('0x47')],{'$or':_['map'](_0x2370e5[_0xcb06('0x41')],function(_0xb065db){var _0x1b14c2={};_0x1b14c2[_0xb065db]={'$like':'%'+_0x25a64e[_0xcb06('0x3d')]['filter']+'%'};return _0x1b14c2;})});}_0x2370e5=_[_0xcb06('0x4a')]({},_0x2370e5,_0x25a64e[_0xcb06('0x4c')]);return db[_0xcb06('0x6b')]['count']({'where':_0x2370e5[_0xcb06('0x47')]})['then'](function(_0x4fa8df){_0x1387b2['count']=_0x4fa8df;if(_0x25a64e[_0xcb06('0x3d')]['includeAll']){_0x2370e5[_0xcb06('0x4f')]=[{'all':!![]}];}return db[_0xcb06('0x6b')][_0xcb06('0x50')](_0x2370e5);})[_0xcb06('0x1d')](function(_0x43ac44){_0x1387b2[_0xcb06('0x51')]=_0x43ac44;return _0x1387b2;});}})[_0xcb06('0x1d')](respondWithFilteredResult(_0x8bc9dd,_0x2370e5))[_0xcb06('0x52')](handleError(_0x8bc9dd,null));};exports[_0xcb06('0x6d')]=function(_0x26a201,_0x27e365,_0x1e65ec){return db[_0xcb06('0x4d')][_0xcb06('0x57')]({'where':{'id':_0x26a201[_0xcb06('0x54')]['id']}})[_0xcb06('0x1d')](handleEntityNotFound(_0x27e365,null))[_0xcb06('0x1d')](function(_0x570c26){if(_0x570c26){return _0x570c26[_0xcb06('0x6d')](_0x26a201[_0xcb06('0x3d')][_0xcb06('0x67')]);}})['then'](respondWithStatusCode(_0x27e365,null))[_0xcb06('0x52')](handleError(_0x27e365,null));};exports[_0xcb06('0x6e')]=function(_0x5917d0,_0x338f8e,_0x551f54){return db[_0xcb06('0x4d')][_0xcb06('0x57')]({'where':{'id':_0x5917d0['params']['id']}})[_0xcb06('0x1d')](handleEntityNotFound(_0x338f8e,null))[_0xcb06('0x1d')](function(_0x433681){if(_0x433681){return _0x433681[_0xcb06('0x6e')](_0x5917d0[_0xcb06('0x59')][_0xcb06('0x67')],_[_0xcb06('0x6f')](_0x5917d0[_0xcb06('0x59')],[_0xcb06('0x67'),'id'])||{})['spread'](function(_0x7064f1){for(var _0x31656f=0x0;_0x31656f<_0x5917d0[_0xcb06('0x59')][_0xcb06('0x67')][_0xcb06('0x43')];_0x31656f+=0x1){socket[_0xcb06('0x70')]('userWhatsappAccount:save',{'UserId':Number(_0x5917d0[_0xcb06('0x59')][_0xcb06('0x67')][_0x31656f]),'WhatsappAccountId':Number(_0x5917d0['params']['id'])});}return _0x7064f1;});}})[_0xcb06('0x1d')](respondWithResult(_0x338f8e,null))[_0xcb06('0x52')](handleError(_0x338f8e,null));};exports[_0xcb06('0x71')]=function(_0x9dc505,_0x1f7109,_0x57f370){return db[_0xcb06('0x4d')][_0xcb06('0x57')]({'where':{'id':_0x9dc505[_0xcb06('0x54')]['id']}})[_0xcb06('0x1d')](handleEntityNotFound(_0x1f7109,null))[_0xcb06('0x1d')](function(_0x4f1452){if(_0x4f1452){return _0x4f1452[_0xcb06('0x71')](_0x9dc505[_0xcb06('0x3d')][_0xcb06('0x67')])[_0xcb06('0x1d')](function(){if(_['isArray'](_0x9dc505[_0xcb06('0x3d')][_0xcb06('0x67')])){for(var _0x2f9896=0x0;_0x2f9896<_0x9dc505[_0xcb06('0x3d')][_0xcb06('0x67')]['length'];_0x2f9896+=0x1){socket[_0xcb06('0x70')](_0xcb06('0x72'),{'UserId':Number(_0x9dc505[_0xcb06('0x3d')][_0xcb06('0x67')][_0x2f9896]),'WhatsappAccountId':Number(_0x9dc505[_0xcb06('0x54')]['id'])});}}else{socket[_0xcb06('0x70')](_0xcb06('0x72'),{'UserId':Number(_0x9dc505['query']['ids']),'WhatsappAccountId':Number(_0x9dc505[_0xcb06('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x1f7109,null))[_0xcb06('0x52')](handleError(_0x1f7109,null));};exports[_0xcb06('0x73')]=function(_0x39fd73,_0x47cd0d,_0x171868){var _0x2bf128={};var _0x1f073b={};var _0x3b133f;var _0x4555a6;return db['WhatsappAccount']['findOne']({'where':{'id':_0x39fd73[_0xcb06('0x54')]['id']}})[_0xcb06('0x1d')](handleEntityNotFound(_0x47cd0d,null))[_0xcb06('0x1d')](function(_0x4be0b2){if(_0x4be0b2){_0x3b133f=_0x4be0b2;_0x1f073b['model']=_[_0xcb06('0x3e')](db['User'][_0xcb06('0x56')]);_0x1f073b[_0xcb06('0x3d')]=_[_0xcb06('0x3e')](_0x39fd73[_0xcb06('0x3d')]);_0x1f073b[_0xcb06('0x3f')]=_[_0xcb06('0x40')](_0x1f073b['model'],_0x1f073b['query']);_0x2bf128[_0xcb06('0x41')]=_[_0xcb06('0x40')](_0x1f073b[_0xcb06('0x3c')],qs['fields'](_0x39fd73[_0xcb06('0x3d')][_0xcb06('0x42')]));_0x2bf128[_0xcb06('0x41')]=_0x2bf128['attributes'][_0xcb06('0x43')]?_0x2bf128[_0xcb06('0x41')]:_0x1f073b[_0xcb06('0x3c')];_0x2bf128[_0xcb06('0x6c')]=qs[_0xcb06('0x46')](_0x39fd73[_0xcb06('0x3d')][_0xcb06('0x46')]);_0x2bf128[_0xcb06('0x47')]=qs[_0xcb06('0x3f')](_[_0xcb06('0x48')](_0x39fd73[_0xcb06('0x3d')],_0x1f073b['filters']));if(_0x39fd73[_0xcb06('0x3d')]['filter']){_0x2bf128[_0xcb06('0x47')]=_[_0xcb06('0x4a')](_0x2bf128[_0xcb06('0x47')],{'$or':_[_0xcb06('0x3a')](_0x2bf128[_0xcb06('0x41')],function(_0x4fa561){var _0x54f8f9={};_0x54f8f9[_0x4fa561]={'$like':'%'+_0x39fd73['query']['filter']+'%'};return _0x54f8f9;})});}_0x2bf128=_[_0xcb06('0x4a')]({},_0x2bf128,_0x39fd73[_0xcb06('0x4c')]);return _0x3b133f[_0xcb06('0x73')](_0x2bf128);}})['then'](function(_0x3770ae){if(_0x3770ae){_0x4555a6=_0x3770ae[_0xcb06('0x43')];if(!_0x39fd73['query']['hasOwnProperty'](_0xcb06('0x45'))){_0x2bf128['limit']=qs['limit'](_0x39fd73[_0xcb06('0x3d')][_0xcb06('0x2c')]);_0x2bf128[_0xcb06('0x2a')]=qs[_0xcb06('0x2a')](_0x39fd73['query'][_0xcb06('0x2a')]);}return _0x3b133f[_0xcb06('0x73')](_0x2bf128);}})[_0xcb06('0x1d')](function(_0x4040d2){if(_0x4040d2){return _0x4040d2?{'count':_0x4555a6,'rows':_0x4040d2}:null;}})[_0xcb06('0x1d')](respondWithResult(_0x47cd0d,null))[_0xcb06('0x52')](handleError(_0x47cd0d,null));};exports['addApplications']=function(_0x1ee2e2,_0x2115ec,_0xb500d2){return db[_0xcb06('0x4d')][_0xcb06('0x65')]({'where':{'id':_0x1ee2e2[_0xcb06('0x54')]['id']}})['then'](handleEntityNotFound(_0x2115ec,null))[_0xcb06('0x1d')](function(_0x156b48){if(_0x156b48){return db['sequelize']['transaction'](function(_0x42450c){return db['WhatsappApplication'][_0xcb06('0x33')]({'where':{'WhatsappAccountId':_0x1ee2e2[_0xcb06('0x54')]['id']},'transaction':_0x42450c})[_0xcb06('0x1d')](function(_0xd3966a){var _0x339933=_[_0xcb06('0x3a')](_0x1ee2e2[_0xcb06('0x59')],function(_0x9e373f){_0x9e373f[_0xcb06('0x69')]=_0x1ee2e2['params']['id'];return _0x9e373f;});return db[_0xcb06('0x74')][_0xcb06('0x75')](_0x339933,{'transaction':_0x42450c});});})[_0xcb06('0x1d')](function(){return db[_0xcb06('0x74')][_0xcb06('0x76')]({'where':{'WhatsappAccountId':_0x1ee2e2[_0xcb06('0x54')]['id']},'order':_0xcb06('0x77')});});}})[_0xcb06('0x1d')](respondWithResult(_0x2115ec,null))[_0xcb06('0x52')](handleError(_0x2115ec,null));};exports[_0xcb06('0x78')]=function(_0x9de27,_0xeb5086,_0xda8b79){var _0x321e4d={};var _0x383095={};var _0x2012f5;var _0x368c80;return db[_0xcb06('0x4d')][_0xcb06('0x65')]({'where':{'id':_0x9de27[_0xcb06('0x54')]['id']}})[_0xcb06('0x1d')](handleEntityNotFound(_0xeb5086,null))[_0xcb06('0x1d')](function(_0x120341){if(_0x120341){_0x2012f5=_0x120341;_0x383095[_0xcb06('0x3c')]=_[_0xcb06('0x3e')](db[_0xcb06('0x74')][_0xcb06('0x56')]);_0x383095[_0xcb06('0x3d')]=_[_0xcb06('0x3e')](_0x9de27[_0xcb06('0x3d')]);_0x383095[_0xcb06('0x3f')]=_[_0xcb06('0x40')](_0x383095[_0xcb06('0x3c')],_0x383095['query']);_0x321e4d[_0xcb06('0x41')]=_['intersection'](_0x383095[_0xcb06('0x3c')],qs['fields'](_0x9de27['query'][_0xcb06('0x42')]));_0x321e4d['attributes']=_0x321e4d[_0xcb06('0x41')][_0xcb06('0x43')]?_0x321e4d[_0xcb06('0x41')]:_0x383095[_0xcb06('0x3c')];_0x321e4d[_0xcb06('0x6c')]=qs[_0xcb06('0x46')](_0x9de27[_0xcb06('0x3d')][_0xcb06('0x46')]);_0x321e4d[_0xcb06('0x47')]=qs['filters'](_['pick'](_0x9de27['query'],_0x383095[_0xcb06('0x3f')]));if(_0x9de27['query']['filter']){_0x321e4d[_0xcb06('0x47')]=_[_0xcb06('0x4a')](_0x321e4d['where'],{'$or':_[_0xcb06('0x3a')](_0x321e4d[_0xcb06('0x41')],function(_0x41a240){var _0x19b4a1={};_0x19b4a1[_0x41a240]={'$like':'%'+_0x9de27[_0xcb06('0x3d')][_0xcb06('0x49')]+'%'};return _0x19b4a1;})});}_0x321e4d=_[_0xcb06('0x4a')]({},_0x321e4d,_0x9de27[_0xcb06('0x4c')]);return _0x2012f5[_0xcb06('0x78')](_0x321e4d);}})[_0xcb06('0x1d')](function(_0x3a4358){if(_0x3a4358){_0x368c80=_0x3a4358[_0xcb06('0x43')];if(!_0x9de27[_0xcb06('0x3d')][_0xcb06('0x44')](_0xcb06('0x45'))){_0x321e4d[_0xcb06('0x2c')]=qs[_0xcb06('0x2c')](_0x9de27[_0xcb06('0x3d')][_0xcb06('0x2c')]);_0x321e4d[_0xcb06('0x2a')]=qs[_0xcb06('0x2a')](_0x9de27[_0xcb06('0x3d')][_0xcb06('0x2a')]);}return _0x2012f5[_0xcb06('0x78')](_0x321e4d);}})['then'](function(_0x2dd57f){if(_0x2dd57f){return _0x2dd57f?{'count':_0x368c80,'rows':_0x2dd57f}:null;}})[_0xcb06('0x1d')](respondWithResult(_0xeb5086,null))[_0xcb06('0x52')](handleError(_0xeb5086,null));};exports['notify']=function(_0x5ca561,_0x1e0bb2,_0x69e088){var _0x2da9b7={'channel':'whatsapp'};var _0x42a7e4=[];var _0x55d8eb=[];var _0x20fbb8={};return db[_0xcb06('0x4d')][_0xcb06('0x57')]({'where':{'id':_0x5ca561[_0xcb06('0x54')]['id']},'include':[{'model':db[_0xcb06('0x74')],'as':'Applications'}]})[_0xcb06('0x1d')](handleEntityNotFound(_0x1e0bb2,null))[_0xcb06('0x1d')](function(_0xd2468d){_0x2da9b7['account']=_0xd2468d;_0x2da9b7[_0xcb06('0x79')]=_[_0xcb06('0x7a')](_0xd2468d[_0xcb06('0x7b')],[_0xcb06('0x77')],[_0xcb06('0x7c')]);if(_0x2da9b7[_0xcb06('0x7d')]['Applications']){delete _0x2da9b7[_0xcb06('0x7d')][_0xcb06('0x7b')];}return db[_0xcb06('0x7e')][_0xcb06('0x61')]();})['then'](function(_0x3ee419){if(!_0x3ee419){throw new db[(_0xcb06('0x7f'))]['ValidationError'](_0xcb06('0x80'));}_0x42a7e4=_[_0xcb06('0x81')](_[_0xcb06('0x3e')](_0x3ee419),['createdAt',_0xcb06('0x82')]);_0x55d8eb=_[_0xcb06('0x81')](_['keys'](_0x3ee419),[_0xcb06('0x83'),_0xcb06('0x82'),_0xcb06('0x84'),_0xcb06('0x85')]);_0x2da9b7[_0xcb06('0x59')]={'mapKey':_0xcb06('0x86')};if(_0x2da9b7[_0xcb06('0x7d')][_0xcb06('0x87')]&&_0x2da9b7[_0xcb06('0x7d')][_0xcb06('0x87')]==='twilio'){_0x2da9b7[_0xcb06('0x59')][_0xcb06('0x88')]=_0x5ca561[_0xcb06('0x59')][_0xcb06('0x89')][_0xcb06('0x8a')](_0xcb06('0x8b'),'');_0x2da9b7['body'][_0xcb06('0x59')]=_0x5ca561['body']['Body'];_0x2da9b7[_0xcb06('0x59')][_0xcb06('0x8c')]=_0x5ca561['body'][_0xcb06('0x8d')];}if(_0x2da9b7[_0xcb06('0x59')]['id']){delete _0x2da9b7[_0xcb06('0x59')]['id'];}if(_[_0xcb06('0x8e')](_0x2da9b7[_0xcb06('0x59')][_0xcb06('0x88')])){throw new db[(_0xcb06('0x7f'))]['ValidationError'](_0xcb06('0x8f'));}if(_[_0xcb06('0x8e')](_0x2da9b7[_0xcb06('0x59')]['body'])||_0x2da9b7[_0xcb06('0x59')][_0xcb06('0x59')]===''){throw new db[(_0xcb06('0x7f'))][(_0xcb06('0x90'))](_0xcb06('0x91'));}if(_[_0xcb06('0x8e')](_0x2da9b7['body'][_0xcb06('0x92')])){throw new db[(_0xcb06('0x7f'))][(_0xcb06('0x90'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x55d8eb);}if(!_[_0xcb06('0x93')](_0x55d8eb,_0x2da9b7[_0xcb06('0x59')][_0xcb06('0x92')])){throw new db[(_0xcb06('0x7f'))][(_0xcb06('0x90'))](_0xcb06('0x94')+_0x55d8eb);}_0x20fbb8[_0x2da9b7[_0xcb06('0x59')][_0xcb06('0x92')]]=_0x2da9b7['body']['from'];return db[_0xcb06('0x95')][_0xcb06('0x57')]({'where':{'id':_0x2da9b7['account'][_0xcb06('0x85')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x20fbb8,'limit':0x1,'order':[['updatedAt',_0xcb06('0x96')]]}]});})[_0xcb06('0x1d')](handleEntityNotFound(_0x1e0bb2,null))[_0xcb06('0x1d')](function(_0x391553){if(_0x391553){_0x2da9b7[_0xcb06('0x97')]=_[_0xcb06('0x6f')](_0x391553,[_0xcb06('0x98')]);if(_0x391553['Contacts'][_0xcb06('0x43')]){return _0x391553[_0xcb06('0x98')][0x0];}var _0x3aa757=_[_0xcb06('0x16')](_0x2da9b7['body'],{'firstName':_0x2da9b7['body'][_0xcb06('0x88')],'ListId':_0x391553['id']});_0x3aa757[_0x2da9b7['body'][_0xcb06('0x92')]]=_0x2da9b7[_0xcb06('0x59')]['from'];return db[_0xcb06('0x7e')][_0xcb06('0x58')](_0x3aa757,{'fields':_0x42a7e4,'raw':!![]});}})['then'](handleEntityNotFound(_0x1e0bb2,null))[_0xcb06('0x1d')](function(_0x45e2ad){if(_0x45e2ad){_0x2da9b7[_0xcb06('0x99')]=_0x45e2ad;var _0x567a01={'ContactId':_0x45e2ad['id'],'phone':_0x2da9b7[_0xcb06('0x59')][_0xcb06('0x88')],'WhatsappAccountId':_0x5ca561[_0xcb06('0x54')]['id']};var _0x15eb95={'ContactId':_0x45e2ad['id'],'WhatsappAccountId':_0x5ca561[_0xcb06('0x54')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0x15eb95})[_0xcb06('0x1d')](function(_0x4c4a14){if(_0x4c4a14){return[_0x4c4a14,![]];}return db[_0xcb06('0x9a')][_0xcb06('0x58')](_0x567a01)[_0xcb06('0x1d')](function(_0x596662){return[_0x596662,!![]];});});}})[_0xcb06('0x9b')](function(_0x2d49ca,_0x4f51ea){_0x2da9b7[_0xcb06('0x9c')]=_0x2d49ca['get']({'plain':!![]});_0x2da9b7[_0xcb06('0x9c')][_0xcb06('0x9d')]=![];if(_0x4f51ea){if(_0x2da9b7['account']['autoclose']){_0x2da9b7[_0xcb06('0x79')][_0xcb06('0x9e')]({'id':0x0,'priority':_0x2da9b7[_0xcb06('0x79')][_0xcb06('0x43')]+0x1,'app':_0xcb06('0x9f'),'appdata':_0xcb06('0xa0'),'interval':_0xcb06('0xa1')});}_0x2da9b7[_0xcb06('0x9c')]['created']=!![];}return db['WhatsappMessage'][_0xcb06('0x58')]({'phone':_0x2da9b7[_0xcb06('0x59')]['from'],'messageId':_0x2da9b7[_0xcb06('0x59')][_0xcb06('0x8c')],'body':_0x2da9b7['body']['body'],'WhatsappAccountId':_0x5ca561[_0xcb06('0x54')]['id'],'WhatsappInteractionId':_0x2d49ca['id'],'direction':'in','ContactId':_0x2d49ca[_0xcb06('0xa2')],'AttachmentId':_0x2da9b7[_0xcb06('0x59')]['AttachmentId']});})[_0xcb06('0x1d')](function(_0x4bc7ce){_0x2da9b7[_0xcb06('0x25')]=_0x4bc7ce;if(_0x2da9b7['interaction'][_0xcb06('0xa3')]){return db[_0xcb06('0xa4')]['find']({'attributes':['id',_0xcb06('0x37')],'where':{'id':_0x2da9b7[_0xcb06('0x9c')][_0xcb06('0xa3')]}})[_0xcb06('0x1d')](function(_0x16dba7){if(_0x16dba7){_0x2da9b7[_0xcb06('0x79')][_0xcb06('0xa5')]({'id':0x0,'priority':0x0,'app':_0xcb06('0xa6'),'appdata':_0x16dba7[_0xcb06('0x37')]+','+(_0x2da9b7[_0xcb06('0x7d')][_0xcb06('0xa7')]||0xa),'interval':_0xcb06('0xa1')});}return respondWithRpcPromise(_0xcb06('0xa8'),_0xcb06('0xa9'),_0x2da9b7);});}return respondWithRpcPromise(_0xcb06('0xa8'),_0xcb06('0xa9'),_0x2da9b7);})['then'](function(_0xbbced5){if(_0xbbced5){var _0xfaee6=0xc8;var _0x40febf='receiveMessage';logger[_0xcb06('0x1e')](_0xcb06('0xaa'),_0x40febf,_0xfaee6,_0xcb06('0xab'));logger[_0xcb06('0x21')](_0xcb06('0xac'),_0x40febf,_0xfaee6,_0xcb06('0xab'),JSON['stringify'](_0xbbced5));if(_0x2da9b7[_0xcb06('0x7d')][_0xcb06('0x87')]===_0xcb06('0xad')){return _0x1e0bb2[_0xcb06('0x27')](_0xfaee6)['set'](_0xcb06('0xae'),_0xcb06('0xaf'))[_0xcb06('0x38')]('\x0a');}else{return _0x1e0bb2[_0xcb06('0x27')](_0xfaee6)[_0xcb06('0x29')](_0xbbced5);}}})[_0xcb06('0x52')](handleError(_0x1e0bb2,null));};exports['send']=function(_0x2e99fa,_0x416438,_0xcaf043){var _0x2fd5d0,_0xa86255,_0x286575;if(_[_0xcb06('0x8e')](_0x2e99fa[_0xcb06('0x59')]['body'])||_0x2e99fa[_0xcb06('0x59')]['body']===''){throw new db['Sequelize'][(_0xcb06('0x90'))](_0xcb06('0x91'));}if(_[_0xcb06('0x8e')](_0x2e99fa[_0xcb06('0x59')]['to'])){throw new db[(_0xcb06('0x7f'))][(_0xcb06('0x90'))](_0xcb06('0xb0'));}_0x2fd5d0=_0x2e99fa[_0xcb06('0x59')]['to'];return db[_0xcb06('0x4d')][_0xcb06('0x57')]({'where':{'id':_0x2e99fa[_0xcb06('0x54')]['id']},'include':[{'model':db[_0xcb06('0x95')],'as':'List','include':[{'model':db[_0xcb06('0x7e')],'as':_0xcb06('0x98'),'where':{'mobile':_0x2fd5d0},'limit':0x1,'order':[[_0xcb06('0x82'),'DESC']]}]}]})[_0xcb06('0x1d')](handleEntityNotFound(_0x416438,null))[_0xcb06('0x1d')](function(_0x5c551f){if(_0x5c551f&&_0x5c551f[_0xcb06('0xb1')]){_0xa86255=_0x5c551f[_0xcb06('0x34')]({'plain':!![]});if(_0xa86255[_0xcb06('0xb1')]&&_0xa86255[_0xcb06('0xb1')][_0xcb06('0x98')]['length']){return _0xa86255['List'][_0xcb06('0x98')][0x0];}return db[_0xcb06('0x7e')][_0xcb06('0x58')](_[_0xcb06('0x16')](_0x2e99fa['body'],{'firstName':_0x2fd5d0,'mobile':_0x2fd5d0,'phone':_0x2fd5d0,'ListId':_0xa86255['ListId']}));}})[_0xcb06('0x1d')](handleEntityNotFound(_0x416438,null))[_0xcb06('0x1d')](function(_0x2d0513){if(_0x2d0513){_0x286575=_0x2d0513;return db[_0xcb06('0x9a')][_0xcb06('0x57')]({'where':{'ContactId':_0x286575['id'],'closed':![],'WhatsappAccountId':_0xa86255['id']}})[_0xcb06('0x1d')](function(_0x1dfe68){if(_0x1dfe68){return[_0x1dfe68,![]];}return db[_0xcb06('0x9a')][_0xcb06('0x58')]({'UserId':_0x2e99fa[_0xcb06('0x5c')]['id'],'ContactId':_0x286575['id'],'WhatsappAccountId':_0xa86255['id'],'phone':_0x2fd5d0,'firstMsgDirection':_0xcb06('0xb2'),'Messages':[_[_0xcb06('0x4a')](_0x2e99fa[_0xcb06('0x59')],{'read':![],'body':_0x2e99fa['body'][_0xcb06('0x59')],'phone':_0x2fd5d0,'WhatsappAccountId':_0xa86255['id'],'UserId':_0x2e99fa[_0xcb06('0x5c')]['id'],'ContactId':_0x286575['id']})]},{'include':[{'model':db[_0xcb06('0xb3')],'as':_0xcb06('0xb4')}]})['then'](function(_0x3574ee){return[_0x3574ee,!![]];});});}})['spread'](function(_0xae1ade,_0x281ea9){if(_0x281ea9){return _0xae1ade;}return db[_0xcb06('0xb3')]['create'](_[_0xcb06('0x4a')](_0x2e99fa[_0xcb06('0x59')],{'read':![],'body':_0x2e99fa[_0xcb06('0x59')][_0xcb06('0x59')],'phone':_0x2fd5d0,'WhatsappAccountId':_0xa86255['id'],'WhatsappInteractionId':_0xae1ade['id'],'UserId':_0x2e99fa['user']['id'],'ContactId':_0x286575['id']}))[_0xcb06('0x1d')](function(_0x3907ea){_0xae1ade['dataValues'][_0xcb06('0xb4')]=[];_0xae1ade[_0xcb06('0xb5')][_0xcb06('0xb4')][_0xcb06('0x9e')](_0x3907ea[_0xcb06('0xb5')]);return _0xae1ade;});})[_0xcb06('0x1d')](respondWithResult(_0x416438,null))[_0xcb06('0x52')](handleError(_0x416438,null));}; \ No newline at end of file +var _0x33cc=['receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','to\x20is\x20mandatory','List','out','Messages','dataValues','push','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','end','status','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','destroy','get','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','create','body','user','role','WhatsappAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','WhatsappAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','WhatsappApplication','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','Body','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','defaults','CmContact','WhatsappInteraction','interaction','created','autoclose','close','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','Start','startRouting'];(function(_0x5df893,_0x578e66){var _0xb5e6ce=function(_0x2b4aca){while(--_0x2b4aca){_0x5df893['push'](_0x5df893['shift']());}};_0xb5e6ce(++_0x578e66);}(_0x33cc,0x178));var _0xc33c=function(_0x26896f,_0x4edf8c){_0x26896f=_0x26896f-0x0;var _0xa4850a=_0x33cc[_0x26896f];return _0xa4850a;};'use strict';var emlformat=require(_0xc33c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc33c('0x1'));var jsonpatch=require(_0xc33c('0x2'));var rp=require('request-promise');var moment=require(_0xc33c('0x3'));var BPromise=require(_0xc33c('0x4'));var Mustache=require(_0xc33c('0x5'));var util=require('util');var path=require(_0xc33c('0x6'));var sox=require(_0xc33c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc33c('0x8'));var _=require(_0xc33c('0x9'));var squel=require(_0xc33c('0xa'));var crypto=require(_0xc33c('0xb'));var jsforce=require(_0xc33c('0xc'));var deskjs=require(_0xc33c('0xd'));var toCsv=require(_0xc33c('0xe'));var querystring=require(_0xc33c('0xf'));var Papa=require(_0xc33c('0x10'));var Redis=require('ioredis');var authService=require(_0xc33c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc33c('0x12'));var hardwareService=require(_0xc33c('0x13'));var logger=require('../../config/logger')(_0xc33c('0x14'));var utils=require(_0xc33c('0x15'));var config=require(_0xc33c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc33c('0x17'))['db'];config[_0xc33c('0x18')]=_['defaults'](config['redis'],{'host':_0xc33c('0x19'),'port':0x18eb});var socket=require(_0xc33c('0x1a'))(new Redis(config[_0xc33c('0x18')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0xc33c('0x1b'));var client=jayson['client'][_0xc33c('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x32de81,_0x51f805,_0x2b5167,_0x1c9b91){return new BPromise(function(_0x36ce16,_0x5c5f25){var _0x52a1c1=_0x1c9b91||client;return _0x52a1c1[_0xc33c('0x1d')](_0x32de81,_0x2b5167)[_0xc33c('0x1e')](function(_0x40232d){logger['info'](_0xc33c('0x1f'),_0x51f805,_0xc33c('0x20'));logger[_0xc33c('0x21')](_0xc33c('0x22'),_0x51f805,_0xc33c('0x20'),JSON['stringify'](_0x40232d));if(_0x40232d[_0xc33c('0x23')]){if(_0x40232d[_0xc33c('0x23')][_0xc33c('0x24')]===0x1f4){logger[_0xc33c('0x23')](_0xc33c('0x1f'),_0x51f805,_0x40232d['error'][_0xc33c('0x25')]);return _0x5c5f25(_0x40232d[_0xc33c('0x23')][_0xc33c('0x25')]);}logger[_0xc33c('0x23')](_0xc33c('0x1f'),_0x51f805,_0x40232d[_0xc33c('0x23')][_0xc33c('0x25')]);return _0x36ce16(_0x40232d['error'][_0xc33c('0x25')]);}else{logger[_0xc33c('0x26')](_0xc33c('0x1f'),_0x51f805,_0xc33c('0x20'));_0x36ce16(_0x40232d[_0xc33c('0x27')][_0xc33c('0x25')]);}})[_0xc33c('0x28')](function(_0x1092a3){logger['error'](_0xc33c('0x1f'),_0x51f805,_0x1092a3);_0x5c5f25(_0x1092a3);});});}function respondWithStatusCode(_0x2fce2c,_0x21ac89){_0x21ac89=_0x21ac89||0xcc;return function(_0xdbe92a){if(_0xdbe92a){return _0x2fce2c[_0xc33c('0x29')](_0x21ac89);}return _0x2fce2c['status'](_0x21ac89)[_0xc33c('0x2a')]();};}function respondWithResult(_0x4c0220,_0x3468f4){_0x3468f4=_0x3468f4||0xc8;return function(_0x1a9825){if(_0x1a9825){return _0x4c0220[_0xc33c('0x2b')](_0x3468f4)['json'](_0x1a9825);}};}function respondWithFilteredResult(_0x47dbe5,_0x112f4a){return function(_0x32a9ee){if(_0x32a9ee){var _0x3a8423=typeof _0x112f4a['offset']===_0xc33c('0x2c')&&typeof _0x112f4a[_0xc33c('0x2d')]==='undefined';var _0x76e10a=_0x32a9ee['count'];var _0x39d18c=_0x3a8423?0x0:_0x112f4a[_0xc33c('0x2e')];var _0x151595=_0x3a8423?_0x32a9ee[_0xc33c('0x2f')]:_0x112f4a[_0xc33c('0x2e')]+_0x112f4a[_0xc33c('0x2d')];var _0x5eaf6d;if(_0x151595>=_0x76e10a){_0x151595=_0x76e10a;_0x5eaf6d=0xc8;}else{_0x5eaf6d=0xce;}_0x47dbe5[_0xc33c('0x2b')](_0x5eaf6d);return _0x47dbe5['set'](_0xc33c('0x30'),_0x39d18c+'-'+_0x151595+'/'+_0x76e10a)[_0xc33c('0x31')](_0x32a9ee);}return null;};}function patchUpdates(_0x2894fe){return function(_0x2f6b98){try{jsonpatch[_0xc33c('0x32')](_0x2f6b98,_0x2894fe,!![]);}catch(_0x185c27){return BPromise[_0xc33c('0x33')](_0x185c27);}return _0x2f6b98[_0xc33c('0x34')]();};}function saveUpdates(_0x59494d,_0x5506e0){return function(_0xe82252){if(_0xe82252){return _0xe82252[_0xc33c('0x35')](_0x59494d)[_0xc33c('0x1e')](function(_0x219b2b){return _0x219b2b;});}return null;};}function removeEntity(_0x9f83,_0x312aa1){return function(_0x2bd0d5){if(_0x2bd0d5){return _0x2bd0d5[_0xc33c('0x36')]()[_0xc33c('0x1e')](function(){var _0x417f7a=_0x2bd0d5[_0xc33c('0x37')]({'plain':!![]});var _0x7701d0='WhatsappAccounts';return db[_0xc33c('0x38')][_0xc33c('0x36')]({'where':{'type':_0x7701d0,'resourceId':_0x417f7a['id']}})['then'](function(){return _0x2bd0d5;});})['then'](function(){_0x9f83['status'](0xcc)[_0xc33c('0x2a')]();});}};}function handleEntityNotFound(_0x4f1abe,_0x2e16fd){return function(_0x5b1a0e){if(!_0x5b1a0e){_0x4f1abe[_0xc33c('0x29')](0x194);}return _0x5b1a0e;};}function handleError(_0x5eb768,_0x3a869c){_0x3a869c=_0x3a869c||0x1f4;return function(_0x357553){logger[_0xc33c('0x23')](_0x357553['stack']);if(_0x357553[_0xc33c('0x39')]){delete _0x357553['name'];}_0x5eb768[_0xc33c('0x2b')](_0x3a869c)[_0xc33c('0x3a')](_0x357553);};}exports['index']=function(_0x8cb5de,_0x4b8e3c){var _0x12edb2={'include':[{'model':db[_0xc33c('0x3b')],'as':_0xc33c('0x3c')}]},_0x54f319={},_0xf8cdd8={'count':0x0,'rows':[]};var _0x4b0b91=_[_0xc33c('0x3d')](db[_0xc33c('0x3e')][_0xc33c('0x3f')],function(_0x1dfef7){return{'name':_0x1dfef7[_0xc33c('0x40')],'type':_0x1dfef7[_0xc33c('0x41')][_0xc33c('0x42')]};});_0x54f319[_0xc33c('0x43')]=_[_0xc33c('0x3d')](_0x4b0b91,_0xc33c('0x39'));_0x54f319[_0xc33c('0x44')]=_[_0xc33c('0x45')](_0x8cb5de[_0xc33c('0x44')]);_0x54f319['filters']=_[_0xc33c('0x46')](_0x54f319['model'],_0x54f319[_0xc33c('0x44')]);_0x12edb2['attributes']=_[_0xc33c('0x46')](_0x54f319[_0xc33c('0x43')],qs[_0xc33c('0x47')](_0x8cb5de[_0xc33c('0x44')]['fields']));_0x12edb2['attributes']=_0x12edb2[_0xc33c('0x48')][_0xc33c('0x49')]?_0x12edb2[_0xc33c('0x48')]:_0x54f319[_0xc33c('0x43')];if(!_0x8cb5de['query']['hasOwnProperty'](_0xc33c('0x4a'))){_0x12edb2[_0xc33c('0x2d')]=qs[_0xc33c('0x2d')](_0x8cb5de[_0xc33c('0x44')][_0xc33c('0x2d')]);_0x12edb2['offset']=qs['offset'](_0x8cb5de[_0xc33c('0x44')][_0xc33c('0x2e')]);}_0x12edb2[_0xc33c('0x4b')]=qs[_0xc33c('0x4c')](_0x8cb5de[_0xc33c('0x44')][_0xc33c('0x4c')]);_0x12edb2[_0xc33c('0x4d')]=qs['filters'](_[_0xc33c('0x4e')](_0x8cb5de[_0xc33c('0x44')],_0x54f319[_0xc33c('0x4f')]),_0x4b0b91);if(_0x8cb5de[_0xc33c('0x44')][_0xc33c('0x50')]){_0x12edb2[_0xc33c('0x4d')]=_[_0xc33c('0x51')](_0x12edb2[_0xc33c('0x4d')],{'$or':_[_0xc33c('0x3d')](_0x4b0b91,function(_0x30acb4){if(_0x30acb4['type']!==_0xc33c('0x52')){var _0x3e69a7={};_0x3e69a7[_0x30acb4[_0xc33c('0x39')]]={'$like':'%'+_0x8cb5de['query']['filter']+'%'};return _0x3e69a7;}})});}_0x12edb2=_['merge']({},_0x12edb2,_0x8cb5de[_0xc33c('0x53')]);var _0x402840={'where':_0x12edb2['where']};return db[_0xc33c('0x3e')][_0xc33c('0x2f')](_0x402840)[_0xc33c('0x1e')](function(_0x424437){_0xf8cdd8[_0xc33c('0x2f')]=_0x424437;if(_0x8cb5de['query']['includeAll']){_0x12edb2[_0xc33c('0x54')]=[{'all':!![]}];}return db[_0xc33c('0x3e')][_0xc33c('0x55')](_0x12edb2);})['then'](function(_0xe2cfab){_0xf8cdd8[_0xc33c('0x56')]=_0xe2cfab;return _0xf8cdd8;})[_0xc33c('0x1e')](respondWithFilteredResult(_0x4b8e3c,_0x12edb2))[_0xc33c('0x28')](handleError(_0x4b8e3c,null));};exports['show']=function(_0x1505e6,_0x2453b3){var _0x287fb6={'raw':![],'where':{'id':_0x1505e6[_0xc33c('0x57')]['id']},'include':[{'model':db[_0xc33c('0x3b')],'as':_0xc33c('0x3c')}]},_0x440127={};_0x440127[_0xc33c('0x43')]=_[_0xc33c('0x45')](db[_0xc33c('0x3e')][_0xc33c('0x3f')]);_0x440127[_0xc33c('0x44')]=_[_0xc33c('0x45')](_0x1505e6[_0xc33c('0x44')]);_0x440127[_0xc33c('0x4f')]=_[_0xc33c('0x46')](_0x440127[_0xc33c('0x43')],_0x440127['query']);_0x287fb6[_0xc33c('0x48')]=_[_0xc33c('0x46')](_0x440127[_0xc33c('0x43')],qs[_0xc33c('0x47')](_0x1505e6[_0xc33c('0x44')][_0xc33c('0x47')]));_0x287fb6[_0xc33c('0x48')]=_0x287fb6[_0xc33c('0x48')][_0xc33c('0x49')]?_0x287fb6[_0xc33c('0x48')]:_0x440127[_0xc33c('0x43')];if(_0x1505e6['query'][_0xc33c('0x58')]){_0x287fb6['include']=[{'all':!![]}];}_0x287fb6=_[_0xc33c('0x51')]({},_0x287fb6,_0x1505e6[_0xc33c('0x53')]);return db[_0xc33c('0x3e')][_0xc33c('0x59')](_0x287fb6)[_0xc33c('0x1e')](handleEntityNotFound(_0x2453b3,null))[_0xc33c('0x1e')](respondWithResult(_0x2453b3,null))[_0xc33c('0x28')](handleError(_0x2453b3,null));};exports[_0xc33c('0x5a')]=function(_0x535f9d,_0x3ff9b2){return db[_0xc33c('0x3e')][_0xc33c('0x5a')](_0x535f9d[_0xc33c('0x5b')],{})[_0xc33c('0x1e')](function(_0x930234){var _0x232b0d=_0x535f9d[_0xc33c('0x5c')][_0xc33c('0x37')]({'plain':!![]});if(!_0x232b0d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x232b0d[_0xc33c('0x5d')]===_0xc33c('0x5c')){var _0x29edea=_0x930234[_0xc33c('0x37')]({'plain':!![]});var _0xbbbf99=_0xc33c('0x5e');return db[_0xc33c('0x5f')]['find']({'where':{'name':_0xbbbf99,'userProfileId':_0x232b0d['userProfileId']},'raw':!![]})[_0xc33c('0x1e')](function(_0x2da9e3){if(_0x2da9e3&&_0x2da9e3[_0xc33c('0x60')]===0x0){return db[_0xc33c('0x38')][_0xc33c('0x5a')]({'name':_0x29edea['name'],'resourceId':_0x29edea['id'],'type':_0x2da9e3[_0xc33c('0x39')],'sectionId':_0x2da9e3['id']},{})[_0xc33c('0x1e')](function(){return _0x930234;});}else{return _0x930234;}})['catch'](function(_0x3a9bba){logger['error'](_0xc33c('0x61'),_0x3a9bba);throw _0x3a9bba;});}return _0x930234;})[_0xc33c('0x1e')](respondWithResult(_0x3ff9b2,0xc9))['catch'](handleError(_0x3ff9b2,null));};exports[_0xc33c('0x35')]=function(_0x4a1d7f,_0x4895d6){if(_0x4a1d7f[_0xc33c('0x5b')]['id']){delete _0x4a1d7f['body']['id'];}return db[_0xc33c('0x3e')]['find']({'where':{'id':_0x4a1d7f[_0xc33c('0x57')]['id']},'include':[{'model':db[_0xc33c('0x3b')],'as':_0xc33c('0x3c')}]})[_0xc33c('0x1e')](handleEntityNotFound(_0x4895d6,null))[_0xc33c('0x1e')](saveUpdates(_0x4a1d7f[_0xc33c('0x5b')],null))[_0xc33c('0x1e')](respondWithResult(_0x4895d6,null))['catch'](handleError(_0x4895d6,null));};exports[_0xc33c('0x36')]=function(_0x38e657,_0x2195e3){return db[_0xc33c('0x3e')][_0xc33c('0x59')]({'where':{'id':_0x38e657['params']['id']}})[_0xc33c('0x1e')](handleEntityNotFound(_0x2195e3,null))[_0xc33c('0x1e')](removeEntity(_0x2195e3,null))[_0xc33c('0x28')](handleError(_0x2195e3,null));};exports[_0xc33c('0x62')]=function(_0x7ffe7e,_0x90386d){return db['WhatsappAccount'][_0xc33c('0x62')]()[_0xc33c('0x1e')](respondWithResult(_0x90386d,null))[_0xc33c('0x28')](handleError(_0x90386d,null));};exports[_0xc33c('0x63')]=function(_0x5ab236,_0x24b1fa,_0x1a812a){if(_0x5ab236[_0xc33c('0x5b')]['id']){delete _0x5ab236[_0xc33c('0x5b')]['id'];}return db[_0xc33c('0x3e')][_0xc33c('0x59')]({'where':{'id':_0x5ab236[_0xc33c('0x57')]['id']}})['then'](handleEntityNotFound(_0x24b1fa,null))[_0xc33c('0x1e')](function(_0x4800a8){if(_0x4800a8){_0x5ab236[_0xc33c('0x5b')]['WhatsappAccountId']=_0x4800a8['id'];return db[_0xc33c('0x64')][_0xc33c('0x5a')](_0x5ab236[_0xc33c('0x5b')]);}})[_0xc33c('0x1e')](respondWithResult(_0x24b1fa,null))[_0xc33c('0x28')](handleError(_0x24b1fa,null));};exports[_0xc33c('0x65')]=function(_0x3e3c0e,_0x486966,_0x467d71){var _0x638bd={'raw':![],'where':{}};var _0x1b4a88={};var _0x5c4b50={'count':0x0,'rows':[]};return db[_0xc33c('0x3e')][_0xc33c('0x66')]({'where':{'id':_0x3e3c0e[_0xc33c('0x57')]['id']}})[_0xc33c('0x1e')](handleEntityNotFound(_0x486966,null))[_0xc33c('0x1e')](function(_0x21342f){if(_0x21342f){_0x1b4a88[_0xc33c('0x43')]=_['keys'](db[_0xc33c('0x64')][_0xc33c('0x3f')]);_0x1b4a88['query']=_[_0xc33c('0x45')](_0x3e3c0e[_0xc33c('0x44')]);_0x1b4a88[_0xc33c('0x4f')]=_[_0xc33c('0x46')](_0x1b4a88['model'],_0x1b4a88['query']);_0x638bd[_0xc33c('0x48')]=_[_0xc33c('0x46')](_0x1b4a88['model'],qs[_0xc33c('0x47')](_0x3e3c0e[_0xc33c('0x44')][_0xc33c('0x47')]));_0x638bd['attributes']=_0x638bd[_0xc33c('0x48')][_0xc33c('0x49')]?_0x638bd['attributes']:_0x1b4a88[_0xc33c('0x43')];if(!_0x3e3c0e['query'][_0xc33c('0x67')](_0xc33c('0x4a'))){_0x638bd[_0xc33c('0x2d')]=qs['limit'](_0x3e3c0e['query'][_0xc33c('0x2d')]);_0x638bd[_0xc33c('0x2e')]=qs[_0xc33c('0x2e')](_0x3e3c0e[_0xc33c('0x44')][_0xc33c('0x2e')]);}_0x638bd[_0xc33c('0x4b')]=qs[_0xc33c('0x4c')](_0x3e3c0e[_0xc33c('0x44')][_0xc33c('0x4c')]);_0x638bd[_0xc33c('0x4d')]=qs['filters'](_['pick'](_0x3e3c0e[_0xc33c('0x44')],_0x1b4a88[_0xc33c('0x4f')]));_0x638bd['where'][_0xc33c('0x68')]=_0x21342f['id'];if(_0x3e3c0e[_0xc33c('0x44')][_0xc33c('0x50')]){_0x638bd['where']=_[_0xc33c('0x51')](_0x638bd[_0xc33c('0x4d')],{'$or':_[_0xc33c('0x3d')](_0x638bd['attributes'],function(_0x554d80){var _0x4fecca={};_0x4fecca[_0x554d80]={'$like':'%'+_0x3e3c0e[_0xc33c('0x44')][_0xc33c('0x50')]+'%'};return _0x4fecca;})});}_0x638bd=_[_0xc33c('0x51')]({},_0x638bd,_0x3e3c0e[_0xc33c('0x53')]);return db['Disposition'][_0xc33c('0x2f')]({'where':_0x638bd[_0xc33c('0x4d')]})[_0xc33c('0x1e')](function(_0x3dfc09){_0x5c4b50[_0xc33c('0x2f')]=_0x3dfc09;if(_0x3e3c0e['query'][_0xc33c('0x58')]){_0x638bd[_0xc33c('0x54')]=[{'all':!![]}];}return db[_0xc33c('0x64')][_0xc33c('0x55')](_0x638bd);})[_0xc33c('0x1e')](function(_0x15fbbb){_0x5c4b50[_0xc33c('0x56')]=_0x15fbbb;return _0x5c4b50;});}})['then'](respondWithFilteredResult(_0x486966,_0x638bd))[_0xc33c('0x28')](handleError(_0x486966,null));};exports[_0xc33c('0x69')]=function(_0x27ef44,_0x5952cf,_0x10091e){return db[_0xc33c('0x3e')][_0xc33c('0x59')]({'where':{'id':_0x27ef44[_0xc33c('0x57')]['id']}})[_0xc33c('0x1e')](handleEntityNotFound(_0x5952cf,null))['then'](function(_0x226f92){if(_0x226f92){return _0x226f92['removeDispositions'](_0x27ef44[_0xc33c('0x44')][_0xc33c('0x6a')]);}})['then'](respondWithStatusCode(_0x5952cf,null))['catch'](handleError(_0x5952cf,null));};exports[_0xc33c('0x6b')]=function(_0x23bfb9,_0x258352,_0x134abf){if(_0x23bfb9['body']['id']){delete _0x23bfb9['body']['id'];}return db[_0xc33c('0x3e')][_0xc33c('0x59')]({'where':{'id':_0x23bfb9['params']['id']}})[_0xc33c('0x1e')](handleEntityNotFound(_0x258352,null))[_0xc33c('0x1e')](function(_0x12136b){if(_0x12136b){_0x23bfb9[_0xc33c('0x5b')][_0xc33c('0x68')]=_0x12136b['id'];return db['CannedAnswer'][_0xc33c('0x5a')](_0x23bfb9['body']);}})['then'](respondWithResult(_0x258352,null))[_0xc33c('0x28')](handleError(_0x258352,null));};exports[_0xc33c('0x6c')]=function(_0x31a995,_0x1e7ef2,_0x393121){var _0x35e163={'raw':![],'where':{}};var _0xdfe40c={};var _0x5956c2={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xc33c('0x66')]({'where':{'id':_0x31a995[_0xc33c('0x57')]['id']}})[_0xc33c('0x1e')](handleEntityNotFound(_0x1e7ef2,null))[_0xc33c('0x1e')](function(_0x2003f8){if(_0x2003f8){_0xdfe40c[_0xc33c('0x43')]=_[_0xc33c('0x45')](db[_0xc33c('0x6d')][_0xc33c('0x3f')]);_0xdfe40c[_0xc33c('0x44')]=_['keys'](_0x31a995[_0xc33c('0x44')]);_0xdfe40c['filters']=_['intersection'](_0xdfe40c[_0xc33c('0x43')],_0xdfe40c[_0xc33c('0x44')]);_0x35e163[_0xc33c('0x48')]=_[_0xc33c('0x46')](_0xdfe40c[_0xc33c('0x43')],qs[_0xc33c('0x47')](_0x31a995[_0xc33c('0x44')][_0xc33c('0x47')]));_0x35e163['attributes']=_0x35e163[_0xc33c('0x48')][_0xc33c('0x49')]?_0x35e163[_0xc33c('0x48')]:_0xdfe40c[_0xc33c('0x43')];if(!_0x31a995[_0xc33c('0x44')][_0xc33c('0x67')](_0xc33c('0x4a'))){_0x35e163[_0xc33c('0x2d')]=qs[_0xc33c('0x2d')](_0x31a995[_0xc33c('0x44')][_0xc33c('0x2d')]);_0x35e163[_0xc33c('0x2e')]=qs['offset'](_0x31a995[_0xc33c('0x44')][_0xc33c('0x2e')]);}_0x35e163['order']=qs['sort'](_0x31a995[_0xc33c('0x44')][_0xc33c('0x4c')]);_0x35e163['where']=qs['filters'](_[_0xc33c('0x4e')](_0x31a995[_0xc33c('0x44')],_0xdfe40c[_0xc33c('0x4f')]));_0x35e163[_0xc33c('0x4d')][_0xc33c('0x68')]=_0x2003f8['id'];if(_0x31a995[_0xc33c('0x44')]['filter']){_0x35e163['where']=_[_0xc33c('0x51')](_0x35e163[_0xc33c('0x4d')],{'$or':_['map'](_0x35e163['attributes'],function(_0x568cd3){var _0x4305d0={};_0x4305d0[_0x568cd3]={'$like':'%'+_0x31a995[_0xc33c('0x44')][_0xc33c('0x50')]+'%'};return _0x4305d0;})});}_0x35e163=_[_0xc33c('0x51')]({},_0x35e163,_0x31a995[_0xc33c('0x53')]);return db[_0xc33c('0x6d')][_0xc33c('0x2f')]({'where':_0x35e163[_0xc33c('0x4d')]})[_0xc33c('0x1e')](function(_0x1e7250){_0x5956c2['count']=_0x1e7250;if(_0x31a995[_0xc33c('0x44')][_0xc33c('0x58')]){_0x35e163['include']=[{'all':!![]}];}return db[_0xc33c('0x6d')][_0xc33c('0x55')](_0x35e163);})['then'](function(_0x2cebaa){_0x5956c2[_0xc33c('0x56')]=_0x2cebaa;return _0x5956c2;});}})[_0xc33c('0x1e')](respondWithFilteredResult(_0x1e7ef2,_0x35e163))['catch'](handleError(_0x1e7ef2,null));};exports[_0xc33c('0x6e')]=function(_0x46a79f,_0x266ee0,_0xacafc6){return db[_0xc33c('0x3e')][_0xc33c('0x59')]({'where':{'id':_0x46a79f[_0xc33c('0x57')]['id']}})['then'](handleEntityNotFound(_0x266ee0,null))['then'](function(_0x58823e){if(_0x58823e){return _0x58823e['removeAnswers'](_0x46a79f[_0xc33c('0x44')][_0xc33c('0x6a')]);}})[_0xc33c('0x1e')](respondWithStatusCode(_0x266ee0,null))[_0xc33c('0x28')](handleError(_0x266ee0,null));};exports[_0xc33c('0x6f')]=function(_0x10cd55,_0x34fb50,_0x8a52a1){return db[_0xc33c('0x3e')][_0xc33c('0x59')]({'where':{'id':_0x10cd55[_0xc33c('0x57')]['id']}})['then'](handleEntityNotFound(_0x34fb50,null))[_0xc33c('0x1e')](function(_0x2534f9){if(_0x2534f9){return _0x2534f9[_0xc33c('0x6f')](_0x10cd55[_0xc33c('0x5b')][_0xc33c('0x6a')],_[_0xc33c('0x70')](_0x10cd55[_0xc33c('0x5b')],[_0xc33c('0x6a'),'id'])||{})[_0xc33c('0x71')](function(_0x1438cf){for(var _0x108019=0x0;_0x108019<_0x10cd55[_0xc33c('0x5b')][_0xc33c('0x6a')]['length'];_0x108019+=0x1){socket[_0xc33c('0x72')](_0xc33c('0x73'),{'UserId':Number(_0x10cd55[_0xc33c('0x5b')]['ids'][_0x108019]),'WhatsappAccountId':Number(_0x10cd55[_0xc33c('0x57')]['id'])});}return _0x1438cf;});}})[_0xc33c('0x1e')](respondWithResult(_0x34fb50,null))[_0xc33c('0x28')](handleError(_0x34fb50,null));};exports[_0xc33c('0x74')]=function(_0x46476d,_0x485f13,_0x1e23fa){return db[_0xc33c('0x3e')][_0xc33c('0x59')]({'where':{'id':_0x46476d[_0xc33c('0x57')]['id']}})[_0xc33c('0x1e')](handleEntityNotFound(_0x485f13,null))[_0xc33c('0x1e')](function(_0x4c65bf){if(_0x4c65bf){return _0x4c65bf[_0xc33c('0x74')](_0x46476d[_0xc33c('0x44')][_0xc33c('0x6a')])[_0xc33c('0x1e')](function(){if(_[_0xc33c('0x75')](_0x46476d['query'][_0xc33c('0x6a')])){for(var _0x38c939=0x0;_0x38c939<_0x46476d['query'][_0xc33c('0x6a')][_0xc33c('0x49')];_0x38c939+=0x1){socket[_0xc33c('0x72')](_0xc33c('0x76'),{'UserId':Number(_0x46476d[_0xc33c('0x44')][_0xc33c('0x6a')][_0x38c939]),'WhatsappAccountId':Number(_0x46476d[_0xc33c('0x57')]['id'])});}}else{socket[_0xc33c('0x72')](_0xc33c('0x76'),{'UserId':Number(_0x46476d[_0xc33c('0x44')][_0xc33c('0x6a')]),'WhatsappAccountId':Number(_0x46476d[_0xc33c('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x485f13,null))[_0xc33c('0x28')](handleError(_0x485f13,null));};exports['getAgents']=function(_0x484d7e,_0x8fc44a,_0x17d610){var _0x5a5261={};var _0x37602d={};var _0x2525ad;var _0x51e5fe;return db[_0xc33c('0x3e')]['findOne']({'where':{'id':_0x484d7e['params']['id']}})['then'](handleEntityNotFound(_0x8fc44a,null))[_0xc33c('0x1e')](function(_0x34045b){if(_0x34045b){_0x2525ad=_0x34045b;_0x37602d[_0xc33c('0x43')]=_[_0xc33c('0x45')](db[_0xc33c('0x77')][_0xc33c('0x3f')]);_0x37602d[_0xc33c('0x44')]=_[_0xc33c('0x45')](_0x484d7e[_0xc33c('0x44')]);_0x37602d[_0xc33c('0x4f')]=_[_0xc33c('0x46')](_0x37602d[_0xc33c('0x43')],_0x37602d[_0xc33c('0x44')]);_0x5a5261['attributes']=_[_0xc33c('0x46')](_0x37602d[_0xc33c('0x43')],qs[_0xc33c('0x47')](_0x484d7e[_0xc33c('0x44')][_0xc33c('0x47')]));_0x5a5261['attributes']=_0x5a5261['attributes'][_0xc33c('0x49')]?_0x5a5261[_0xc33c('0x48')]:_0x37602d[_0xc33c('0x43')];_0x5a5261[_0xc33c('0x4b')]=qs['sort'](_0x484d7e[_0xc33c('0x44')][_0xc33c('0x4c')]);_0x5a5261[_0xc33c('0x4d')]=qs[_0xc33c('0x4f')](_[_0xc33c('0x4e')](_0x484d7e[_0xc33c('0x44')],_0x37602d[_0xc33c('0x4f')]));if(_0x484d7e[_0xc33c('0x44')][_0xc33c('0x50')]){_0x5a5261[_0xc33c('0x4d')]=_[_0xc33c('0x51')](_0x5a5261[_0xc33c('0x4d')],{'$or':_['map'](_0x5a5261['attributes'],function(_0x46a077){var _0x3649ec={};_0x3649ec[_0x46a077]={'$like':'%'+_0x484d7e[_0xc33c('0x44')][_0xc33c('0x50')]+'%'};return _0x3649ec;})});}_0x5a5261=_[_0xc33c('0x51')]({},_0x5a5261,_0x484d7e[_0xc33c('0x53')]);return _0x2525ad[_0xc33c('0x78')](_0x5a5261);}})[_0xc33c('0x1e')](function(_0x715623){if(_0x715623){_0x51e5fe=_0x715623[_0xc33c('0x49')];if(!_0x484d7e[_0xc33c('0x44')]['hasOwnProperty'](_0xc33c('0x4a'))){_0x5a5261[_0xc33c('0x2d')]=qs[_0xc33c('0x2d')](_0x484d7e[_0xc33c('0x44')]['limit']);_0x5a5261[_0xc33c('0x2e')]=qs[_0xc33c('0x2e')](_0x484d7e[_0xc33c('0x44')][_0xc33c('0x2e')]);}return _0x2525ad[_0xc33c('0x78')](_0x5a5261);}})[_0xc33c('0x1e')](function(_0x3ae64a){if(_0x3ae64a){return _0x3ae64a?{'count':_0x51e5fe,'rows':_0x3ae64a}:null;}})[_0xc33c('0x1e')](respondWithResult(_0x8fc44a,null))[_0xc33c('0x28')](handleError(_0x8fc44a,null));};exports['addApplications']=function(_0x323d49,_0x1b1d49,_0x2a5de4){return db[_0xc33c('0x3e')][_0xc33c('0x66')]({'where':{'id':_0x323d49[_0xc33c('0x57')]['id']}})['then'](handleEntityNotFound(_0x1b1d49,null))[_0xc33c('0x1e')](function(_0x246aa7){if(_0x246aa7){return db['sequelize']['transaction'](function(_0x290dbf){return db[_0xc33c('0x79')]['destroy']({'where':{'WhatsappAccountId':_0x323d49[_0xc33c('0x57')]['id']},'transaction':_0x290dbf})[_0xc33c('0x1e')](function(_0x5468aa){var _0x540bc3=_['map'](_0x323d49[_0xc33c('0x5b')],function(_0x1eddaf){_0x1eddaf[_0xc33c('0x68')]=_0x323d49[_0xc33c('0x57')]['id'];return _0x1eddaf;});return db['WhatsappApplication']['bulkCreate'](_0x540bc3,{'transaction':_0x290dbf});});})['then'](function(){return db['WhatsappApplication'][_0xc33c('0x7a')]({'where':{'WhatsappAccountId':_0x323d49[_0xc33c('0x57')]['id']},'order':_0xc33c('0x7b')});});}})[_0xc33c('0x1e')](respondWithResult(_0x1b1d49,null))[_0xc33c('0x28')](handleError(_0x1b1d49,null));};exports['getApplications']=function(_0x11542d,_0x34efbb,_0x19b135){var _0xc7c5bb={};var _0x30f9b0={};var _0x4cf765;var _0x2d4cfc;return db[_0xc33c('0x3e')][_0xc33c('0x66')]({'where':{'id':_0x11542d['params']['id']}})[_0xc33c('0x1e')](handleEntityNotFound(_0x34efbb,null))['then'](function(_0x25a754){if(_0x25a754){_0x4cf765=_0x25a754;_0x30f9b0[_0xc33c('0x43')]=_[_0xc33c('0x45')](db[_0xc33c('0x79')]['rawAttributes']);_0x30f9b0[_0xc33c('0x44')]=_['keys'](_0x11542d[_0xc33c('0x44')]);_0x30f9b0[_0xc33c('0x4f')]=_['intersection'](_0x30f9b0['model'],_0x30f9b0[_0xc33c('0x44')]);_0xc7c5bb[_0xc33c('0x48')]=_[_0xc33c('0x46')](_0x30f9b0['model'],qs['fields'](_0x11542d[_0xc33c('0x44')]['fields']));_0xc7c5bb[_0xc33c('0x48')]=_0xc7c5bb[_0xc33c('0x48')]['length']?_0xc7c5bb[_0xc33c('0x48')]:_0x30f9b0['model'];_0xc7c5bb['order']=qs[_0xc33c('0x4c')](_0x11542d['query'][_0xc33c('0x4c')]);_0xc7c5bb[_0xc33c('0x4d')]=qs[_0xc33c('0x4f')](_[_0xc33c('0x4e')](_0x11542d[_0xc33c('0x44')],_0x30f9b0['filters']));if(_0x11542d[_0xc33c('0x44')][_0xc33c('0x50')]){_0xc7c5bb[_0xc33c('0x4d')]=_[_0xc33c('0x51')](_0xc7c5bb[_0xc33c('0x4d')],{'$or':_[_0xc33c('0x3d')](_0xc7c5bb['attributes'],function(_0x316a30){var _0x3e7500={};_0x3e7500[_0x316a30]={'$like':'%'+_0x11542d[_0xc33c('0x44')]['filter']+'%'};return _0x3e7500;})});}_0xc7c5bb=_[_0xc33c('0x51')]({},_0xc7c5bb,_0x11542d['options']);return _0x4cf765[_0xc33c('0x7c')](_0xc7c5bb);}})[_0xc33c('0x1e')](function(_0x1d08b3){if(_0x1d08b3){_0x2d4cfc=_0x1d08b3[_0xc33c('0x49')];if(!_0x11542d[_0xc33c('0x44')][_0xc33c('0x67')](_0xc33c('0x4a'))){_0xc7c5bb[_0xc33c('0x2d')]=qs[_0xc33c('0x2d')](_0x11542d[_0xc33c('0x44')][_0xc33c('0x2d')]);_0xc7c5bb[_0xc33c('0x2e')]=qs['offset'](_0x11542d[_0xc33c('0x44')][_0xc33c('0x2e')]);}return _0x4cf765[_0xc33c('0x7c')](_0xc7c5bb);}})[_0xc33c('0x1e')](function(_0x1b42b8){if(_0x1b42b8){return _0x1b42b8?{'count':_0x2d4cfc,'rows':_0x1b42b8}:null;}})[_0xc33c('0x1e')](respondWithResult(_0x34efbb,null))[_0xc33c('0x28')](handleError(_0x34efbb,null));};exports[_0xc33c('0x7d')]=function(_0xe8e6ef,_0x14c4fa,_0x290c5a){var _0x1329c0={'channel':_0xc33c('0x7e')};var _0x269356=[];var _0x2cded6=[];var _0x45f690={};return db[_0xc33c('0x3e')]['find']({'where':{'id':_0xe8e6ef[_0xc33c('0x57')]['id']},'include':[{'model':db[_0xc33c('0x79')],'as':_0xc33c('0x7f')}]})[_0xc33c('0x1e')](handleEntityNotFound(_0x14c4fa,null))['then'](function(_0x346e01){_0x1329c0[_0xc33c('0x80')]=_0x346e01;_0x1329c0[_0xc33c('0x81')]=_['orderBy'](_0x346e01[_0xc33c('0x7f')],[_0xc33c('0x7b')],[_0xc33c('0x82')]);if(_0x1329c0[_0xc33c('0x80')][_0xc33c('0x7f')]){delete _0x1329c0['account'][_0xc33c('0x7f')];}return db['CmContact'][_0xc33c('0x62')]();})[_0xc33c('0x1e')](function(_0x35dfb2){if(!_0x35dfb2){throw new db[(_0xc33c('0x83'))][(_0xc33c('0x84'))](_0xc33c('0x85'));}_0x269356=_[_0xc33c('0x86')](_[_0xc33c('0x45')](_0x35dfb2),[_0xc33c('0x87'),_0xc33c('0x88')]);_0x2cded6=_[_0xc33c('0x86')](_[_0xc33c('0x45')](_0x35dfb2),['createdAt',_0xc33c('0x88'),_0xc33c('0x89'),_0xc33c('0x8a')]);_0x1329c0[_0xc33c('0x5b')]={'mapKey':_0xc33c('0x8b')};if(_0x1329c0[_0xc33c('0x80')][_0xc33c('0x41')]&&_0x1329c0[_0xc33c('0x80')][_0xc33c('0x41')]===_0xc33c('0x8c')){_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x8d')]=_0xe8e6ef[_0xc33c('0x5b')][_0xc33c('0x8e')]['replace'](_0xc33c('0x8f'),'');_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x5b')]=_0xe8e6ef[_0xc33c('0x5b')][_0xc33c('0x90')];_0x1329c0['body'][_0xc33c('0x91')]=_0xe8e6ef[_0xc33c('0x5b')]['MessageSid'];}if(_0x1329c0['body']['id']){delete _0x1329c0[_0xc33c('0x5b')]['id'];}if(_[_0xc33c('0x92')](_0x1329c0['body'][_0xc33c('0x8d')])){throw new db[(_0xc33c('0x83'))][(_0xc33c('0x84'))](_0xc33c('0x93'));}if(_[_0xc33c('0x92')](_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x5b')])||_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x5b')]===''){throw new db[(_0xc33c('0x83'))][(_0xc33c('0x84'))](_0xc33c('0x94'));}if(_[_0xc33c('0x92')](_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x95')])){throw new db['Sequelize'][(_0xc33c('0x84'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2cded6);}if(!_[_0xc33c('0x96')](_0x2cded6,_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x95')])){throw new db[(_0xc33c('0x83'))][(_0xc33c('0x84'))](_0xc33c('0x97')+_0x2cded6);}_0x45f690[_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x95')]]=_0x1329c0[_0xc33c('0x5b')]['from'];return db[_0xc33c('0x98')][_0xc33c('0x59')]({'where':{'id':_0x1329c0[_0xc33c('0x80')][_0xc33c('0x8a')]},'include':[{'model':db['CmContact'],'as':_0xc33c('0x99'),'where':_0x45f690,'limit':0x1,'order':[[_0xc33c('0x88'),'DESC']]}]});})[_0xc33c('0x1e')](handleEntityNotFound(_0x14c4fa,null))[_0xc33c('0x1e')](function(_0x5bd5a2){if(_0x5bd5a2){_0x1329c0[_0xc33c('0x9a')]=_[_0xc33c('0x70')](_0x5bd5a2,[_0xc33c('0x99')]);if(_0x5bd5a2[_0xc33c('0x99')]['length']){return _0x5bd5a2[_0xc33c('0x99')][0x0];}var _0x3384a1=_[_0xc33c('0x9b')](_0x1329c0[_0xc33c('0x5b')],{'firstName':_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x8d')],'ListId':_0x5bd5a2['id']});_0x3384a1[_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x95')]]=_0x1329c0[_0xc33c('0x5b')]['from'];return db[_0xc33c('0x9c')]['create'](_0x3384a1,{'fields':_0x269356,'raw':!![]});}})['then'](handleEntityNotFound(_0x14c4fa,null))['then'](function(_0x21bc56){if(_0x21bc56){_0x1329c0['contact']=_0x21bc56;var _0xdbafc9={'ContactId':_0x21bc56['id'],'phone':_0x1329c0['body'][_0xc33c('0x8d')],'WhatsappAccountId':_0xe8e6ef[_0xc33c('0x57')]['id']};var _0x58ece2={'ContactId':_0x21bc56['id'],'WhatsappAccountId':_0xe8e6ef[_0xc33c('0x57')]['id'],'closed':![]};return db[_0xc33c('0x9d')]['find']({'where':_0x58ece2})[_0xc33c('0x1e')](function(_0x5ab336){if(_0x5ab336){return[_0x5ab336,![]];}return db['WhatsappInteraction'][_0xc33c('0x5a')](_0xdbafc9)[_0xc33c('0x1e')](function(_0x1ac774){return[_0x1ac774,!![]];});});}})['spread'](function(_0x376cec,_0x32fafa){_0x1329c0[_0xc33c('0x9e')]=_0x376cec[_0xc33c('0x37')]({'plain':!![]});_0x1329c0[_0xc33c('0x9e')][_0xc33c('0x9f')]=![];if(_0x32fafa){if(_0x1329c0[_0xc33c('0x80')][_0xc33c('0xa0')]){_0x1329c0[_0xc33c('0x81')]['push']({'id':0x0,'priority':_0x1329c0[_0xc33c('0x81')][_0xc33c('0x49')]+0x1,'app':_0xc33c('0xa1'),'appdata':'unmanaged','interval':_0xc33c('0xa2')});}_0x1329c0[_0xc33c('0x9e')]['created']=!![];}return db[_0xc33c('0xa3')]['create']({'phone':_0x1329c0[_0xc33c('0x5b')]['from'],'messageId':_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x91')],'body':_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x5b')],'WhatsappAccountId':_0xe8e6ef[_0xc33c('0x57')]['id'],'WhatsappInteractionId':_0x376cec['id'],'direction':'in','ContactId':_0x376cec[_0xc33c('0xa4')],'AttachmentId':_0x1329c0[_0xc33c('0x5b')][_0xc33c('0xa5')]});})[_0xc33c('0x1e')](function(_0x3392da){_0x1329c0[_0xc33c('0x25')]=_0x3392da;if(_0x1329c0[_0xc33c('0x9e')][_0xc33c('0xa6')]){return db[_0xc33c('0x77')][_0xc33c('0x59')]({'attributes':['id',_0xc33c('0x39')],'where':{'id':_0x1329c0[_0xc33c('0x9e')][_0xc33c('0xa6')]}})['then'](function(_0x1dde14){if(_0x1dde14){_0x1329c0['applications'][_0xc33c('0xa7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1dde14['name']+','+(_0x1329c0[_0xc33c('0x80')]['waitForTheAssignedAgent']||0xa),'interval':_0xc33c('0xa2')});}return respondWithRpcPromise(_0xc33c('0xa8'),'startRouting',_0x1329c0);});}return respondWithRpcPromise('Start',_0xc33c('0xa9'),_0x1329c0);})[_0xc33c('0x1e')](function(_0x4b0b0b){if(_0x4b0b0b){var _0x6993a5=0xc8;var _0x3da34e=_0xc33c('0xaa');logger['info'](_0xc33c('0x22'),_0x3da34e,_0x6993a5,_0xc33c('0xab'));logger['debug'](_0xc33c('0xac'),_0x3da34e,_0x6993a5,_0xc33c('0xab'),JSON['stringify'](_0x4b0b0b));if(_0x1329c0[_0xc33c('0x80')][_0xc33c('0x41')]===_0xc33c('0x8c')){return _0x14c4fa[_0xc33c('0x2b')](_0x6993a5)[_0xc33c('0xad')](_0xc33c('0xae'),_0xc33c('0xaf'))[_0xc33c('0x3a')]('\x0a');}else{return _0x14c4fa['status'](_0x6993a5)[_0xc33c('0x31')](_0x4b0b0b);}}})['catch'](handleError(_0x14c4fa,null));};exports[_0xc33c('0x3a')]=function(_0x1b93f6,_0x2b1997,_0x411f3a){var _0x521c07,_0x46be99,_0x531d6d;if(_['isNil'](_0x1b93f6[_0xc33c('0x5b')]['body'])||_0x1b93f6[_0xc33c('0x5b')][_0xc33c('0x5b')]===''){throw new db['Sequelize']['ValidationError'](_0xc33c('0x94'));}if(_[_0xc33c('0x92')](_0x1b93f6[_0xc33c('0x5b')]['to'])){throw new db[(_0xc33c('0x83'))][(_0xc33c('0x84'))](_0xc33c('0xb0'));}_0x521c07=_0x1b93f6['body']['to'];return db[_0xc33c('0x3e')][_0xc33c('0x59')]({'where':{'id':_0x1b93f6[_0xc33c('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0xc33c('0xb1'),'include':[{'model':db[_0xc33c('0x9c')],'as':'Contacts','where':{'mobile':_0x521c07},'limit':0x1,'order':[[_0xc33c('0x88'),'DESC']]}]}]})[_0xc33c('0x1e')](handleEntityNotFound(_0x2b1997,null))[_0xc33c('0x1e')](function(_0x3d2064){if(_0x3d2064&&_0x3d2064[_0xc33c('0xb1')]){_0x46be99=_0x3d2064[_0xc33c('0x37')]({'plain':!![]});if(_0x46be99[_0xc33c('0xb1')]&&_0x46be99[_0xc33c('0xb1')]['Contacts'][_0xc33c('0x49')]){return _0x46be99[_0xc33c('0xb1')]['Contacts'][0x0];}return db[_0xc33c('0x9c')][_0xc33c('0x5a')](_['defaults'](_0x1b93f6['body'],{'firstName':_0x521c07,'mobile':_0x521c07,'phone':_0x521c07,'ListId':_0x46be99[_0xc33c('0x8a')]}));}})['then'](handleEntityNotFound(_0x2b1997,null))[_0xc33c('0x1e')](function(_0x416a59){if(_0x416a59){_0x531d6d=_0x416a59;return db[_0xc33c('0x9d')][_0xc33c('0x59')]({'where':{'ContactId':_0x531d6d['id'],'closed':![],'WhatsappAccountId':_0x46be99['id']}})[_0xc33c('0x1e')](function(_0x2712f1){if(_0x2712f1){return[_0x2712f1,![]];}return db[_0xc33c('0x9d')]['create']({'UserId':_0x1b93f6[_0xc33c('0x5c')]['id'],'ContactId':_0x531d6d['id'],'WhatsappAccountId':_0x46be99['id'],'phone':_0x521c07,'firstMsgDirection':_0xc33c('0xb2'),'Messages':[_[_0xc33c('0x51')](_0x1b93f6[_0xc33c('0x5b')],{'read':![],'body':_0x1b93f6['body'][_0xc33c('0x5b')],'phone':_0x521c07,'WhatsappAccountId':_0x46be99['id'],'UserId':_0x1b93f6['user']['id'],'ContactId':_0x531d6d['id']})]},{'include':[{'model':db[_0xc33c('0xa3')],'as':_0xc33c('0xb3')}]})[_0xc33c('0x1e')](function(_0x57e21b){return[_0x57e21b,!![]];});});}})['spread'](function(_0xb9b12d,_0x171953){if(_0x171953){return _0xb9b12d;}return db['WhatsappMessage']['create'](_[_0xc33c('0x51')](_0x1b93f6[_0xc33c('0x5b')],{'read':![],'body':_0x1b93f6['body'][_0xc33c('0x5b')],'phone':_0x521c07,'WhatsappAccountId':_0x46be99['id'],'WhatsappInteractionId':_0xb9b12d['id'],'UserId':_0x1b93f6[_0xc33c('0x5c')]['id'],'ContactId':_0x531d6d['id']}))[_0xc33c('0x1e')](function(_0x5906f9){_0xb9b12d[_0xc33c('0xb4')][_0xc33c('0xb3')]=[];_0xb9b12d['dataValues'][_0xc33c('0xb3')][_0xc33c('0xb5')](_0x5906f9[_0xc33c('0xb4')]);return _0xb9b12d;});})[_0xc33c('0x1e')](respondWithResult(_0x2b1997,null))[_0xc33c('0x28')](handleError(_0x2b1997,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index a55d305..1f47eb4 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 _0x0878=['hook','exports','../../mysqldb','WhatsappAccount','save','remove','emit','hasOwnProperty'];(function(_0x152b7c,_0x478abf){var _0x437f4d=function(_0x4a327f){while(--_0x4a327f){_0x152b7c['push'](_0x152b7c['shift']());}};_0x437f4d(++_0x478abf);}(_0x0878,0x152));var _0x8087=function(_0x3adc99,_0x20689e){_0x3adc99=_0x3adc99-0x0;var _0x26fa68=_0x0878[_0x3adc99];return _0x26fa68;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x8087('0x0'))['db'][_0x8087('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8087('0x2'),'afterUpdate':'update','afterDestroy':_0x8087('0x3')};function emitEvent(_0x4dddbe){return function(_0x40f6b0,_0x160fbb,_0x10aeca){WhatsappAccountEvents[_0x8087('0x4')](_0x4dddbe+':'+_0x40f6b0['id'],_0x40f6b0);WhatsappAccountEvents[_0x8087('0x4')](_0x4dddbe,_0x40f6b0);_0x10aeca(null);};}for(var e in events){if(events[_0x8087('0x5')](e)){var event=events[e];WhatsappAccount[_0x8087('0x6')](e,emitEvent(event));}}module[_0x8087('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x8815=['events','WhatsappAccount','setMaxListeners','update','remove','hook'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x8815,0x150));var _0x5881=function(_0x2defb5,_0x1cda14){_0x2defb5=_0x2defb5-0x0;var _0x229c53=_0x8815[_0x2defb5];return _0x229c53;};'use strict';var EventEmitter=require(_0x5881('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x5881('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5881('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5881('0x3'),'afterDestroy':_0x5881('0x4')};function emitEvent(_0xd3502a){return function(_0xee60a8,_0x25d8d1,_0x17737e){WhatsappAccountEvents['emit'](_0xd3502a+':'+_0xee60a8['id'],_0xee60a8);WhatsappAccountEvents['emit'](_0xd3502a,_0xee60a8);_0x17737e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x5881('0x5')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 710da31..08d8b82 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 _0x3344=['api','moment','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x54de24,_0x2d420b){var _0x5021ef=function(_0x5dd253){while(--_0x5dd253){_0x54de24['push'](_0x54de24['shift']());}};_0x5021ef(++_0x2d420b);}(_0x3344,0x1de));var _0x4334=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3344[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4334('0x0'));var util=require(_0x4334('0x1'));var logger=require(_0x4334('0x2'))(_0x4334('0x3'));var moment=require(_0x4334('0x4'));var BPromise=require(_0x4334('0x5'));var rp=require(_0x4334('0x6'));var fs=require('fs');var path=require(_0x4334('0x7'));var rimraf=require(_0x4334('0x8'));var config=require('../../config/environment');var attributes=require(_0x4334('0x9'));module[_0x4334('0xa')]=function(_0x5f4049,_0x1fedde){return _0x5f4049['define'](_0x4334('0xb'),attributes,{'tableName':_0x4334('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d85=['./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0x4d85,0xd0));var _0x54d8=function(_0x579dfd,_0x49ec2d){_0x579dfd=_0x579dfd-0x0;var _0x3231dc=_0x4d85[_0x579dfd];return _0x3231dc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x54d8('0x0'))(_0x54d8('0x1'));var moment=require(_0x54d8('0x2'));var BPromise=require(_0x54d8('0x3'));var rp=require(_0x54d8('0x4'));var fs=require('fs');var path=require(_0x54d8('0x5'));var rimraf=require(_0x54d8('0x6'));var config=require(_0x54d8('0x7'));var attributes=require(_0x54d8('0x8'));module[_0x54d8('0x9')]=function(_0xe5dd14,_0x5d7e80){return _0xe5dd14['define'](_0x54d8('0xa'),attributes,{'tableName':_0x54d8('0xb'),'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 84b54a6..3ead721 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 _0x0e38=['stringify','error','code','message','info','request\x20sent','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','model','map','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./whatsappAccount.socket','register','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x4817e4,_0x19e840){var _0x267fa4=function(_0x215ac5){while(--_0x215ac5){_0x4817e4['push'](_0x4817e4['shift']());}};_0x267fa4(++_0x19e840);}(_0x0e38,0x1a9));var _0x80e3=function(_0x238c8c,_0x5e4d9c){_0x238c8c=_0x238c8c-0x0;var _0x3423bc=_0x0e38[_0x238c8c];return _0x3423bc;};'use strict';var _=require(_0x80e3('0x0'));var util=require('util');var moment=require(_0x80e3('0x1'));var BPromise=require('bluebird');var rs=require(_0x80e3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80e3('0x3'))['db'];var utils=require(_0x80e3('0x4'));var logger=require(_0x80e3('0x5'))(_0x80e3('0x6'));var config=require(_0x80e3('0x7'));var jayson=require(_0x80e3('0x8'));var client=jayson[_0x80e3('0x9')][_0x80e3('0xa')]({'port':0x232a});config[_0x80e3('0xb')]=_['defaults'](config['redis'],{'host':_0x80e3('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x80e3('0xb')]));require(_0x80e3('0xd'))[_0x80e3('0xe')](socket);function respondWithRpcPromise(_0x24fea1,_0x2a7962,_0x2060bd){return new BPromise(function(_0x292259,_0x21e1f6){return client['request'](_0x24fea1,_0x2060bd)[_0x80e3('0xf')](function(_0x30885f){logger['info'](_0x80e3('0x10'),_0x2a7962,'request\x20sent');logger[_0x80e3('0x11')](_0x80e3('0x12'),_0x2a7962,'request\x20sent',JSON[_0x80e3('0x13')](_0x30885f));if(_0x30885f[_0x80e3('0x14')]){if(_0x30885f[_0x80e3('0x14')][_0x80e3('0x15')]===0x1f4){logger[_0x80e3('0x14')](_0x80e3('0x10'),_0x2a7962,_0x30885f['error']['message']);return _0x21e1f6(_0x30885f[_0x80e3('0x14')][_0x80e3('0x16')]);}logger['error'](_0x80e3('0x10'),_0x2a7962,_0x30885f['error'][_0x80e3('0x16')]);return _0x292259(_0x30885f[_0x80e3('0x14')][_0x80e3('0x16')]);}else{logger[_0x80e3('0x17')](_0x80e3('0x10'),_0x2a7962,_0x80e3('0x18'));_0x292259(_0x30885f[_0x80e3('0x19')][_0x80e3('0x16')]);}})['catch'](function(_0xde620b){logger[_0x80e3('0x14')](_0x80e3('0x10'),_0x2a7962,_0xde620b);_0x21e1f6(_0xde620b);});});}exports[_0x80e3('0x1a')]=function(_0x1ecf0d){var _0x461368=this;return new Promise(function(_0x119c18,_0x1d1062){return db[_0x80e3('0x1b')][_0x80e3('0x1c')]({'raw':_0x1ecf0d[_0x80e3('0x1d')]?_0x1ecf0d[_0x80e3('0x1d')][_0x80e3('0x1e')]===undefined?!![]:![]:!![],'where':_0x1ecf0d[_0x80e3('0x1d')]?_0x1ecf0d[_0x80e3('0x1d')][_0x80e3('0x1f')]||null:null,'attributes':_0x1ecf0d[_0x80e3('0x1d')]?_0x1ecf0d[_0x80e3('0x1d')][_0x80e3('0x20')]||null:null,'include':_0x1ecf0d[_0x80e3('0x1d')]?_0x1ecf0d['options'][_0x80e3('0x21')]?_['map'](_0x1ecf0d[_0x80e3('0x1d')][_0x80e3('0x21')],function(_0x17d9e2){return{'model':db[_0x17d9e2[_0x80e3('0x22')]],'as':_0x17d9e2['as'],'attributes':_0x17d9e2[_0x80e3('0x20')],'include':_0x17d9e2[_0x80e3('0x21')]?_[_0x80e3('0x23')](_0x17d9e2[_0x80e3('0x21')],function(_0x3bced7){return{'model':db[_0x3bced7[_0x80e3('0x22')]],'as':_0x3bced7['as'],'attributes':_0x3bced7[_0x80e3('0x20')],'include':_0x3bced7['include']?_[_0x80e3('0x23')](_0x3bced7[_0x80e3('0x21')],function(_0x857cd9){return{'model':db[_0x857cd9['model']],'as':_0x857cd9['as'],'attributes':_0x857cd9[_0x80e3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x80e3('0xf')](function(_0x5af56c){logger['info'](_0x80e3('0x1a'),_0x1ecf0d);logger[_0x80e3('0x11')](_0x80e3('0x1a'),_0x1ecf0d,JSON['stringify'](_0x5af56c));_0x119c18(_0x5af56c);})[_0x80e3('0x24')](function(_0x1891e4){logger['error'](_0x80e3('0x1a'),_0x1891e4['message'],_0x1ecf0d);_0x1d1062(_0x461368[_0x80e3('0x14')](0x1f4,_0x1891e4[_0x80e3('0x16')]));});});}; \ No newline at end of file +var _0x564a=['model','attributes','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','debug','request\x20sent','error','code','message','info','WhatsappAccount,\x20%s,\x20%s','catch','ShowWhatsappAccount','find','options','raw','where','include','map'];(function(_0x1c0058,_0x25d0cf){var _0x480919=function(_0x25c458){while(--_0x25c458){_0x1c0058['push'](_0x1c0058['shift']());}};_0x480919(++_0x25d0cf);}(_0x564a,0x1de));var _0xa564=function(_0x45cc6e,_0x55e0d0){_0x45cc6e=_0x45cc6e-0x0;var _0x492cf1=_0x564a[_0x45cc6e];return _0x492cf1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa564('0x0'));var rs=require(_0xa564('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa564('0x2'))['db'];var utils=require(_0xa564('0x3'));var logger=require(_0xa564('0x4'))(_0xa564('0x5'));var config=require(_0xa564('0x6'));var jayson=require(_0xa564('0x7'));var client=jayson[_0xa564('0x8')][_0xa564('0x9')]({'port':0x232a});config['redis']=_[_0xa564('0xa')](config[_0xa564('0xb')],{'host':_0xa564('0xc'),'port':0x18eb});var socket=require(_0xa564('0xd'))(new Redis(config[_0xa564('0xb')]));require(_0xa564('0xe'))['register'](socket);function respondWithRpcPromise(_0x27c50e,_0x5b8552,_0x32be4d){return new BPromise(function(_0x3d82a0,_0x47b662){return client[_0xa564('0xf')](_0x27c50e,_0x32be4d)[_0xa564('0x10')](function(_0x21efec){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x5b8552,'request\x20sent');logger[_0xa564('0x11')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5b8552,_0xa564('0x12'),JSON['stringify'](_0x21efec));if(_0x21efec[_0xa564('0x13')]){if(_0x21efec['error'][_0xa564('0x14')]===0x1f4){logger[_0xa564('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x5b8552,_0x21efec[_0xa564('0x13')][_0xa564('0x15')]);return _0x47b662(_0x21efec['error']['message']);}logger[_0xa564('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x5b8552,_0x21efec[_0xa564('0x13')][_0xa564('0x15')]);return _0x3d82a0(_0x21efec[_0xa564('0x13')][_0xa564('0x15')]);}else{logger[_0xa564('0x16')](_0xa564('0x17'),_0x5b8552,_0xa564('0x12'));_0x3d82a0(_0x21efec['result']['message']);}})[_0xa564('0x18')](function(_0x54f500){logger[_0xa564('0x13')](_0xa564('0x17'),_0x5b8552,_0x54f500);_0x47b662(_0x54f500);});});}exports[_0xa564('0x19')]=function(_0x39372b){var _0x4cffd0=this;return new Promise(function(_0x10770e,_0x3ac934){return db['WhatsappAccount'][_0xa564('0x1a')]({'raw':_0x39372b[_0xa564('0x1b')]?_0x39372b['options'][_0xa564('0x1c')]===undefined?!![]:![]:!![],'where':_0x39372b['options']?_0x39372b[_0xa564('0x1b')][_0xa564('0x1d')]||null:null,'attributes':_0x39372b[_0xa564('0x1b')]?_0x39372b['options']['attributes']||null:null,'include':_0x39372b['options']?_0x39372b[_0xa564('0x1b')][_0xa564('0x1e')]?_[_0xa564('0x1f')](_0x39372b[_0xa564('0x1b')][_0xa564('0x1e')],function(_0x317c71){return{'model':db[_0x317c71[_0xa564('0x20')]],'as':_0x317c71['as'],'attributes':_0x317c71[_0xa564('0x21')],'include':_0x317c71['include']?_['map'](_0x317c71['include'],function(_0x429c8c){return{'model':db[_0x429c8c['model']],'as':_0x429c8c['as'],'attributes':_0x429c8c[_0xa564('0x21')],'include':_0x429c8c[_0xa564('0x1e')]?_['map'](_0x429c8c[_0xa564('0x1e')],function(_0x18ee0b){return{'model':db[_0x18ee0b[_0xa564('0x20')]],'as':_0x18ee0b['as'],'attributes':_0x18ee0b[_0xa564('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa564('0x10')](function(_0xd7f74b){logger[_0xa564('0x16')]('ShowWhatsappAccount',_0x39372b);logger[_0xa564('0x11')](_0xa564('0x19'),_0x39372b,JSON['stringify'](_0xd7f74b));_0x10770e(_0xd7f74b);})[_0xa564('0x18')](function(_0x218ac0){logger[_0xa564('0x13')]('ShowWhatsappAccount',_0x218ac0[_0xa564('0x15')],_0x39372b);_0x3ac934(_0x4cffd0[_0xa564('0x13')](0x1f4,_0x218ac0[_0xa564('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 624711f..b6ca13f 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 _0x32bf=['register','length','whatsappAccount:','save','remove','update','emit'];(function(_0x1040f0,_0x3a981e){var _0x1b2bfe=function(_0x48d806){while(--_0x48d806){_0x1040f0['push'](_0x1040f0['shift']());}};_0x1b2bfe(++_0x3a981e);}(_0x32bf,0x14c));var _0xf32b=function(_0x3cd31a,_0x381c1b){_0x3cd31a=_0x3cd31a-0x0;var _0x33b7ae=_0x32bf[_0x3cd31a];return _0x33b7ae;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xf32b('0x0'),_0xf32b('0x1'),_0xf32b('0x2')];function createListener(_0x34f69d,_0x5c823e){return function(_0x5cce67){_0x5c823e[_0xf32b('0x3')](_0x34f69d,_0x5cce67);};}function removeListener(_0x94ce68,_0x2469b1){return function(){WhatsappAccountEvents['removeListener'](_0x94ce68,_0x2469b1);};}exports[_0xf32b('0x4')]=function(_0x771bdb){for(var _0x533c0c=0x0,_0x5e35eb=events[_0xf32b('0x5')];_0x533c0c<_0x5e35eb;_0x533c0c++){var _0x17cac7=events[_0x533c0c];var _0x4a8fb6=createListener(_0xf32b('0x6')+_0x17cac7,_0x771bdb);WhatsappAccountEvents['on'](_0x17cac7,_0x4a8fb6);}}; \ No newline at end of file +var _0xdcbc=['removeListener','register','whatsappAccount:','save','remove','emit'];(function(_0x35939c,_0x26d676){var _0x5db96f=function(_0x88f4){while(--_0x88f4){_0x35939c['push'](_0x35939c['shift']());}};_0x5db96f(++_0x26d676);}(_0xdcbc,0xab));var _0xcdcb=function(_0x15407e,_0x30ee0d){_0x15407e=_0x15407e-0x0;var _0x113423=_0xdcbc[_0x15407e];return _0x113423;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xcdcb('0x0'),_0xcdcb('0x1'),'update'];function createListener(_0x13b94f,_0x55793a){return function(_0x5bb4cc){_0x55793a[_0xcdcb('0x2')](_0x13b94f,_0x5bb4cc);};}function removeListener(_0x4d5286,_0x5bcc58){return function(){WhatsappAccountEvents[_0xcdcb('0x3')](_0x4d5286,_0x5bcc58);};}exports[_0xcdcb('0x4')]=function(_0x86dea9){for(var _0x48a0bf=0x0,_0xbc1770=events['length'];_0x48a0bf<_0xbc1770;_0x48a0bf++){var _0x2949d2=events[_0x48a0bf];var _0x20b235=createListener(_0xcdcb('0x5')+_0x2949d2,_0x86dea9);WhatsappAccountEvents['on'](_0x2949d2,_0x20b235);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index f4f044b..f9beb7e 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 _0xd7f4=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x32eb4f,_0x35acd8){var _0x307d37=function(_0x6bf4cf){while(--_0x6bf4cf){_0x32eb4f['push'](_0x32eb4f['shift']());}};_0x307d37(++_0x35acd8);}(_0xd7f4,0x1ea));var _0x4d7f=function(_0x37c798,_0x4fded2){_0x37c798=_0x37c798-0x0;var _0x41e7f7=_0xd7f4[_0x37c798];return _0x41e7f7;};'use strict';var multer=require('multer');var util=require(_0x4d7f('0x0'));var path=require(_0x4d7f('0x1'));var timeout=require(_0x4d7f('0x2'));var express=require(_0x4d7f('0x3'));var router=express[_0x4d7f('0x4')]();var fs_extra=require(_0x4d7f('0x5'));var auth=require(_0x4d7f('0x6'));var interaction=require(_0x4d7f('0x7'));var config=require(_0x4d7f('0x8'));var controller=require(_0x4d7f('0x9'));router[_0x4d7f('0xa')]('/',auth[_0x4d7f('0xb')](),controller[_0x4d7f('0xc')]);router[_0x4d7f('0xa')](_0x4d7f('0xd'),auth[_0x4d7f('0xb')](),controller[_0x4d7f('0xe')]);router[_0x4d7f('0xf')]('/',auth[_0x4d7f('0xb')](),controller[_0x4d7f('0x10')]);router[_0x4d7f('0x11')](_0x4d7f('0xd'),auth[_0x4d7f('0xb')](),controller[_0x4d7f('0x12')]);router[_0x4d7f('0x13')](_0x4d7f('0xd'),auth[_0x4d7f('0xb')](),controller[_0x4d7f('0x14')]);module[_0x4d7f('0x15')]=router; \ No newline at end of file +var _0xb6d5=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5c9dab,_0x152aa1){var _0x2f8aca=function(_0x4a91f7){while(--_0x4a91f7){_0x5c9dab['push'](_0x5c9dab['shift']());}};_0x2f8aca(++_0x152aa1);}(_0xb6d5,0xd1));var _0x5b6d=function(_0x155af3,_0x4b7f9a){_0x155af3=_0x155af3-0x0;var _0x15a675=_0xb6d5[_0x155af3];return _0x15a675;};'use strict';var multer=require(_0x5b6d('0x0'));var util=require(_0x5b6d('0x1'));var path=require(_0x5b6d('0x2'));var timeout=require('connect-timeout');var express=require(_0x5b6d('0x3'));var router=express[_0x5b6d('0x4')]();var fs_extra=require(_0x5b6d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5b6d('0x6'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x5b6d('0x7')]('/',auth[_0x5b6d('0x8')](),controller[_0x5b6d('0x9')]);router['get'](_0x5b6d('0xa'),auth[_0x5b6d('0x8')](),controller[_0x5b6d('0xb')]);router[_0x5b6d('0xc')]('/',auth['isAuthenticated'](),controller[_0x5b6d('0xd')]);router[_0x5b6d('0xe')](_0x5b6d('0xa'),auth[_0x5b6d('0x8')](),controller[_0x5b6d('0xf')]);router[_0x5b6d('0x10')](_0x5b6d('0xa'),auth[_0x5b6d('0x8')](),controller[_0x5b6d('0x11')]);module[_0x5b6d('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 2fe94e6..f3859f7 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 _0xd3ea=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x357f53,_0xb7d010){var _0x5f4b0b=function(_0x19d543){while(--_0x19d543){_0x357f53['push'](_0x357f53['shift']());}};_0x5f4b0b(++_0xb7d010);}(_0xd3ea,0x15e));var _0xad3e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xd3ea[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0xad3e('0x0'));module[_0xad3e('0x1')]={'priority':{'type':Sequelize[_0xad3e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xad3e('0x3')],'allowNull':![],'defaultValue':_0xad3e('0x4')},'appdata':{'type':Sequelize[_0xad3e('0x5')]()},'description':{'type':Sequelize[_0xad3e('0x3')]},'interval':{'type':Sequelize[_0xad3e('0x3')],'defaultValue':_0xad3e('0x6')}}; \ No newline at end of file +var _0x7ccf=['sequelize','STRING','noop','*,*,*,*'];(function(_0x5bee05,_0x22f7e7){var _0x3308f7=function(_0x43e2e4){while(--_0x43e2e4){_0x5bee05['push'](_0x5bee05['shift']());}};_0x3308f7(++_0x22f7e7);}(_0x7ccf,0xbc));var _0xf7cc=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0x7ccf[_0x310d10];return _0x1fb8af;};'use strict';var Sequelize=require(_0xf7cc('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf7cc('0x1')],'allowNull':![],'defaultValue':_0xf7cc('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf7cc('0x1')]},'interval':{'type':Sequelize[_0xf7cc('0x1')],'defaultValue':_0xf7cc('0x3')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 7878a28..5fb0cf0 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 _0xd052=['index','map','rawAttributes','fieldName','type','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','WhatsappApplication','includeAll','include','findAll','rows','show','params','keys','intersection','catch','create','body','find','zip-dir','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x487c99,_0x1251f3){var _0x108c78=function(_0x1f53f3){while(--_0x1f53f3){_0x487c99['push'](_0x487c99['shift']());}};_0x108c78(++_0x1251f3);}(_0xd052,0x69));var _0x2d05=function(_0x446aa5,_0x4c2961){_0x446aa5=_0x446aa5-0x0;var _0x3d74e2=_0xd052[_0x446aa5];return _0x3d74e2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2d05('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d05('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2d05('0x2'));var util=require('util');var path=require(_0x2d05('0x3'));var sox=require(_0x2d05('0x4'));var csv=require('to-csv');var ejs=require(_0x2d05('0x5'));var fs=require('fs');var fs_extra=require(_0x2d05('0x6'));var _=require(_0x2d05('0x7'));var squel=require(_0x2d05('0x8'));var crypto=require(_0x2d05('0x9'));var jsforce=require(_0x2d05('0xa'));var deskjs=require(_0x2d05('0xb'));var toCsv=require(_0x2d05('0xc'));var querystring=require(_0x2d05('0xd'));var Papa=require(_0x2d05('0xe'));var Redis=require(_0x2d05('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d05('0x10'));var logger=require(_0x2d05('0x11'))(_0x2d05('0x12'));var utils=require(_0x2d05('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2d05('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f4225,_0x16548b){_0x16548b=_0x16548b||0xcc;return function(_0x1c28b8){if(_0x1c28b8){return _0x1f4225['sendStatus'](_0x16548b);}return _0x1f4225[_0x2d05('0x15')](_0x16548b)[_0x2d05('0x16')]();};}function respondWithResult(_0x1e096a,_0x5630a6){_0x5630a6=_0x5630a6||0xc8;return function(_0x4b6568){if(_0x4b6568){return _0x1e096a['status'](_0x5630a6)[_0x2d05('0x17')](_0x4b6568);}};}function respondWithFilteredResult(_0x2f1e2a,_0x4cf64f){return function(_0x2a68bd){if(_0x2a68bd){var _0x5bf467=typeof _0x4cf64f['offset']===_0x2d05('0x18')&&typeof _0x4cf64f[_0x2d05('0x19')]==='undefined';var _0x15b13c=_0x2a68bd[_0x2d05('0x1a')];var _0xf73a87=_0x5bf467?0x0:_0x4cf64f[_0x2d05('0x1b')];var _0x33bdf7=_0x5bf467?_0x2a68bd['count']:_0x4cf64f[_0x2d05('0x1b')]+_0x4cf64f[_0x2d05('0x19')];var _0x2c456c;if(_0x33bdf7>=_0x15b13c){_0x33bdf7=_0x15b13c;_0x2c456c=0xc8;}else{_0x2c456c=0xce;}_0x2f1e2a['status'](_0x2c456c);return _0x2f1e2a[_0x2d05('0x1c')](_0x2d05('0x1d'),_0xf73a87+'-'+_0x33bdf7+'/'+_0x15b13c)[_0x2d05('0x17')](_0x2a68bd);}return null;};}function patchUpdates(_0x1a4b74){return function(_0x1cd959){try{jsonpatch[_0x2d05('0x1e')](_0x1cd959,_0x1a4b74,!![]);}catch(_0x3bc562){return BPromise[_0x2d05('0x1f')](_0x3bc562);}return _0x1cd959[_0x2d05('0x20')]();};}function saveUpdates(_0x138912,_0x4a9e7c){return function(_0x244358){if(_0x244358){return _0x244358[_0x2d05('0x21')](_0x138912)[_0x2d05('0x22')](function(_0x33bc59){return _0x33bc59;});}return null;};}function removeEntity(_0x43b55f,_0x3ff181){return function(_0x458528){if(_0x458528){return _0x458528[_0x2d05('0x23')]()[_0x2d05('0x22')](function(){_0x43b55f['status'](0xcc)[_0x2d05('0x16')]();});}};}function handleEntityNotFound(_0x13ef22,_0x37966b){return function(_0x4b61a7){if(!_0x4b61a7){_0x13ef22['sendStatus'](0x194);}return _0x4b61a7;};}function handleError(_0x48d545,_0x7ca052){_0x7ca052=_0x7ca052||0x1f4;return function(_0x3240c7){logger[_0x2d05('0x24')](_0x3240c7[_0x2d05('0x25')]);if(_0x3240c7[_0x2d05('0x26')]){delete _0x3240c7['name'];}_0x48d545[_0x2d05('0x15')](_0x7ca052)['send'](_0x3240c7);};}exports[_0x2d05('0x27')]=function(_0x12e82b,_0x2a30be){var _0xc9bd97={},_0x12869d={},_0x350a53={'count':0x0,'rows':[]};var _0x173e72=_[_0x2d05('0x28')](db['WhatsappApplication'][_0x2d05('0x29')],function(_0x434104){return{'name':_0x434104[_0x2d05('0x2a')],'type':_0x434104[_0x2d05('0x2b')]['key']};});_0x12869d['model']=_['map'](_0x173e72,'name');_0x12869d[_0x2d05('0x2c')]=_['keys'](_0x12e82b[_0x2d05('0x2c')]);_0x12869d[_0x2d05('0x2d')]=_['intersection'](_0x12869d['model'],_0x12869d[_0x2d05('0x2c')]);_0xc9bd97[_0x2d05('0x2e')]=_['intersection'](_0x12869d[_0x2d05('0x2f')],qs[_0x2d05('0x30')](_0x12e82b[_0x2d05('0x2c')][_0x2d05('0x30')]));_0xc9bd97[_0x2d05('0x2e')]=_0xc9bd97[_0x2d05('0x2e')][_0x2d05('0x31')]?_0xc9bd97[_0x2d05('0x2e')]:_0x12869d[_0x2d05('0x2f')];if(!_0x12e82b[_0x2d05('0x2c')][_0x2d05('0x32')](_0x2d05('0x33'))){_0xc9bd97[_0x2d05('0x19')]=qs[_0x2d05('0x19')](_0x12e82b[_0x2d05('0x2c')]['limit']);_0xc9bd97['offset']=qs[_0x2d05('0x1b')](_0x12e82b[_0x2d05('0x2c')][_0x2d05('0x1b')]);}_0xc9bd97['order']=qs['sort'](_0x12e82b[_0x2d05('0x2c')][_0x2d05('0x34')]);_0xc9bd97[_0x2d05('0x35')]=qs['filters'](_[_0x2d05('0x36')](_0x12e82b[_0x2d05('0x2c')],_0x12869d[_0x2d05('0x2d')]),_0x173e72);if(_0x12e82b['query']['filter']){_0xc9bd97['where']=_['merge'](_0xc9bd97[_0x2d05('0x35')],{'$or':_[_0x2d05('0x28')](_0x173e72,function(_0x258a43){if(_0x258a43['type']!==_0x2d05('0x37')){var _0x56ee18={};_0x56ee18[_0x258a43[_0x2d05('0x26')]]={'$like':'%'+_0x12e82b[_0x2d05('0x2c')][_0x2d05('0x38')]+'%'};return _0x56ee18;}})});}_0xc9bd97=_[_0x2d05('0x39')]({},_0xc9bd97,_0x12e82b[_0x2d05('0x3a')]);var _0x442cd4={'where':_0xc9bd97[_0x2d05('0x35')]};return db[_0x2d05('0x3b')][_0x2d05('0x1a')](_0x442cd4)[_0x2d05('0x22')](function(_0x81f72e){_0x350a53[_0x2d05('0x1a')]=_0x81f72e;if(_0x12e82b['query'][_0x2d05('0x3c')]){_0xc9bd97[_0x2d05('0x3d')]=[{'all':!![]}];}return db[_0x2d05('0x3b')][_0x2d05('0x3e')](_0xc9bd97);})[_0x2d05('0x22')](function(_0x27798d){_0x350a53[_0x2d05('0x3f')]=_0x27798d;return _0x350a53;})['then'](respondWithFilteredResult(_0x2a30be,_0xc9bd97))['catch'](handleError(_0x2a30be,null));};exports[_0x2d05('0x40')]=function(_0x27cd4c,_0x311adf){var _0x1a1104={'raw':!![],'where':{'id':_0x27cd4c[_0x2d05('0x41')]['id']}},_0xbafabe={};_0xbafabe[_0x2d05('0x2f')]=_[_0x2d05('0x42')](db[_0x2d05('0x3b')][_0x2d05('0x29')]);_0xbafabe[_0x2d05('0x2c')]=_[_0x2d05('0x42')](_0x27cd4c[_0x2d05('0x2c')]);_0xbafabe[_0x2d05('0x2d')]=_['intersection'](_0xbafabe[_0x2d05('0x2f')],_0xbafabe[_0x2d05('0x2c')]);_0x1a1104[_0x2d05('0x2e')]=_[_0x2d05('0x43')](_0xbafabe[_0x2d05('0x2f')],qs['fields'](_0x27cd4c[_0x2d05('0x2c')][_0x2d05('0x30')]));_0x1a1104[_0x2d05('0x2e')]=_0x1a1104[_0x2d05('0x2e')][_0x2d05('0x31')]?_0x1a1104['attributes']:_0xbafabe[_0x2d05('0x2f')];if(_0x27cd4c['query'][_0x2d05('0x3c')]){_0x1a1104[_0x2d05('0x3d')]=[{'all':!![]}];}_0x1a1104=_['merge']({},_0x1a1104,_0x27cd4c[_0x2d05('0x3a')]);return db[_0x2d05('0x3b')]['find'](_0x1a1104)[_0x2d05('0x22')](handleEntityNotFound(_0x311adf,null))[_0x2d05('0x22')](respondWithResult(_0x311adf,null))[_0x2d05('0x44')](handleError(_0x311adf,null));};exports['create']=function(_0x31f59,_0x2b728d){return db[_0x2d05('0x3b')][_0x2d05('0x45')](_0x31f59[_0x2d05('0x46')],{})[_0x2d05('0x22')](respondWithResult(_0x2b728d,0xc9))['catch'](handleError(_0x2b728d,null));};exports['update']=function(_0x448916,_0x547602){if(_0x448916['body']['id']){delete _0x448916['body']['id'];}return db[_0x2d05('0x3b')][_0x2d05('0x47')]({'where':{'id':_0x448916[_0x2d05('0x41')]['id']}})[_0x2d05('0x22')](handleEntityNotFound(_0x547602,null))['then'](saveUpdates(_0x448916[_0x2d05('0x46')],null))[_0x2d05('0x22')](respondWithResult(_0x547602,null))[_0x2d05('0x44')](handleError(_0x547602,null));};exports[_0x2d05('0x23')]=function(_0x187347,_0x16be02){return db['WhatsappApplication'][_0x2d05('0x47')]({'where':{'id':_0x187347['params']['id']}})['then'](handleEntityNotFound(_0x16be02,null))['then'](removeEntity(_0x16be02,null))['catch'](handleError(_0x16be02,null));}; \ No newline at end of file +var _0x1228=['end','json','undefined','count','limit','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappApplication','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','offset','sort','pick','filter','where','merge','type','options','includeAll','rows','catch','params','length','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x1228,0x12f));var _0x8122=function(_0x7ec937,_0xbe3b08){_0x7ec937=_0x7ec937-0x0;var _0x150040=_0x1228[_0x7ec937];return _0x150040;};'use strict';var emlformat=require(_0x8122('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8122('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8122('0x2'));var moment=require(_0x8122('0x3'));var BPromise=require(_0x8122('0x4'));var Mustache=require('mustache');var util=require(_0x8122('0x5'));var path=require(_0x8122('0x6'));var sox=require('sox');var csv=require(_0x8122('0x7'));var ejs=require(_0x8122('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8122('0x9'));var squel=require(_0x8122('0xa'));var crypto=require('crypto');var jsforce=require(_0x8122('0xb'));var deskjs=require(_0x8122('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8122('0xd'));var Papa=require(_0x8122('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8122('0xf'));var logger=require('../../config/logger')(_0x8122('0x10'));var utils=require(_0x8122('0x11'));var config=require(_0x8122('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8122('0x13'))['db'];function respondWithStatusCode(_0x565f6e,_0x162ed4){_0x162ed4=_0x162ed4||0xcc;return function(_0x1ca828){if(_0x1ca828){return _0x565f6e[_0x8122('0x14')](_0x162ed4);}return _0x565f6e[_0x8122('0x15')](_0x162ed4)[_0x8122('0x16')]();};}function respondWithResult(_0x266feb,_0x1fa431){_0x1fa431=_0x1fa431||0xc8;return function(_0x1be8e2){if(_0x1be8e2){return _0x266feb[_0x8122('0x15')](_0x1fa431)[_0x8122('0x17')](_0x1be8e2);}};}function respondWithFilteredResult(_0xfa15a2,_0x6baf37){return function(_0x559256){if(_0x559256){var _0x3ed5d1=typeof _0x6baf37['offset']===_0x8122('0x18')&&typeof _0x6baf37['limit']===_0x8122('0x18');var _0x2acf8f=_0x559256[_0x8122('0x19')];var _0x4bfb9e=_0x3ed5d1?0x0:_0x6baf37['offset'];var _0x4f7277=_0x3ed5d1?_0x559256['count']:_0x6baf37['offset']+_0x6baf37[_0x8122('0x1a')];var _0x2511e9;if(_0x4f7277>=_0x2acf8f){_0x4f7277=_0x2acf8f;_0x2511e9=0xc8;}else{_0x2511e9=0xce;}_0xfa15a2[_0x8122('0x15')](_0x2511e9);return _0xfa15a2['set']('Content-Range',_0x4bfb9e+'-'+_0x4f7277+'/'+_0x2acf8f)[_0x8122('0x17')](_0x559256);}return null;};}function patchUpdates(_0x174321){return function(_0x68761a){try{jsonpatch['apply'](_0x68761a,_0x174321,!![]);}catch(_0x15e635){return BPromise[_0x8122('0x1b')](_0x15e635);}return _0x68761a[_0x8122('0x1c')]();};}function saveUpdates(_0x988c0c,_0x3c6226){return function(_0x130e1b){if(_0x130e1b){return _0x130e1b[_0x8122('0x1d')](_0x988c0c)[_0x8122('0x1e')](function(_0x4fc6af){return _0x4fc6af;});}return null;};}function removeEntity(_0x34c185,_0x5cfa77){return function(_0x732946){if(_0x732946){return _0x732946[_0x8122('0x1f')]()[_0x8122('0x1e')](function(){_0x34c185[_0x8122('0x15')](0xcc)[_0x8122('0x16')]();});}};}function handleEntityNotFound(_0x240a6d,_0x40e945){return function(_0x2708a5){if(!_0x2708a5){_0x240a6d[_0x8122('0x14')](0x194);}return _0x2708a5;};}function handleError(_0x4e67ab,_0x1258d7){_0x1258d7=_0x1258d7||0x1f4;return function(_0xa79602){logger[_0x8122('0x20')](_0xa79602[_0x8122('0x21')]);if(_0xa79602[_0x8122('0x22')]){delete _0xa79602[_0x8122('0x22')];}_0x4e67ab[_0x8122('0x15')](_0x1258d7)[_0x8122('0x23')](_0xa79602);};}exports[_0x8122('0x24')]=function(_0x4610b1,_0x4c70f4){var _0x49531a={},_0x2a0b63={},_0x264ccf={'count':0x0,'rows':[]};var _0x5263ca=_['map'](db[_0x8122('0x25')][_0x8122('0x26')],function(_0x367ada){return{'name':_0x367ada['fieldName'],'type':_0x367ada['type'][_0x8122('0x27')]};});_0x2a0b63[_0x8122('0x28')]=_[_0x8122('0x29')](_0x5263ca,_0x8122('0x22'));_0x2a0b63[_0x8122('0x2a')]=_[_0x8122('0x2b')](_0x4610b1[_0x8122('0x2a')]);_0x2a0b63[_0x8122('0x2c')]=_[_0x8122('0x2d')](_0x2a0b63[_0x8122('0x28')],_0x2a0b63['query']);_0x49531a[_0x8122('0x2e')]=_[_0x8122('0x2d')](_0x2a0b63[_0x8122('0x28')],qs[_0x8122('0x2f')](_0x4610b1[_0x8122('0x2a')][_0x8122('0x2f')]));_0x49531a[_0x8122('0x2e')]=_0x49531a[_0x8122('0x2e')]['length']?_0x49531a['attributes']:_0x2a0b63[_0x8122('0x28')];if(!_0x4610b1['query']['hasOwnProperty'](_0x8122('0x30'))){_0x49531a['limit']=qs['limit'](_0x4610b1[_0x8122('0x2a')][_0x8122('0x1a')]);_0x49531a['offset']=qs[_0x8122('0x31')](_0x4610b1['query'][_0x8122('0x31')]);}_0x49531a['order']=qs[_0x8122('0x32')](_0x4610b1[_0x8122('0x2a')]['sort']);_0x49531a['where']=qs['filters'](_[_0x8122('0x33')](_0x4610b1[_0x8122('0x2a')],_0x2a0b63['filters']),_0x5263ca);if(_0x4610b1[_0x8122('0x2a')][_0x8122('0x34')]){_0x49531a[_0x8122('0x35')]=_[_0x8122('0x36')](_0x49531a['where'],{'$or':_[_0x8122('0x29')](_0x5263ca,function(_0x1a1510){if(_0x1a1510[_0x8122('0x37')]!=='VIRTUAL'){var _0x3805ec={};_0x3805ec[_0x1a1510['name']]={'$like':'%'+_0x4610b1[_0x8122('0x2a')]['filter']+'%'};return _0x3805ec;}})});}_0x49531a=_[_0x8122('0x36')]({},_0x49531a,_0x4610b1[_0x8122('0x38')]);var _0x1e6c01={'where':_0x49531a[_0x8122('0x35')]};return db['WhatsappApplication'][_0x8122('0x19')](_0x1e6c01)[_0x8122('0x1e')](function(_0x565829){_0x264ccf[_0x8122('0x19')]=_0x565829;if(_0x4610b1[_0x8122('0x2a')][_0x8122('0x39')]){_0x49531a['include']=[{'all':!![]}];}return db[_0x8122('0x25')]['findAll'](_0x49531a);})[_0x8122('0x1e')](function(_0x3258e8){_0x264ccf[_0x8122('0x3a')]=_0x3258e8;return _0x264ccf;})[_0x8122('0x1e')](respondWithFilteredResult(_0x4c70f4,_0x49531a))[_0x8122('0x3b')](handleError(_0x4c70f4,null));};exports['show']=function(_0xbad19,_0x16ab8c){var _0x5bceb1={'raw':!![],'where':{'id':_0xbad19[_0x8122('0x3c')]['id']}},_0x3dbd77={};_0x3dbd77[_0x8122('0x28')]=_[_0x8122('0x2b')](db[_0x8122('0x25')][_0x8122('0x26')]);_0x3dbd77[_0x8122('0x2a')]=_['keys'](_0xbad19[_0x8122('0x2a')]);_0x3dbd77[_0x8122('0x2c')]=_[_0x8122('0x2d')](_0x3dbd77['model'],_0x3dbd77[_0x8122('0x2a')]);_0x5bceb1[_0x8122('0x2e')]=_[_0x8122('0x2d')](_0x3dbd77['model'],qs['fields'](_0xbad19[_0x8122('0x2a')]['fields']));_0x5bceb1['attributes']=_0x5bceb1[_0x8122('0x2e')][_0x8122('0x3d')]?_0x5bceb1[_0x8122('0x2e')]:_0x3dbd77['model'];if(_0xbad19[_0x8122('0x2a')][_0x8122('0x39')]){_0x5bceb1['include']=[{'all':!![]}];}_0x5bceb1=_[_0x8122('0x36')]({},_0x5bceb1,_0xbad19[_0x8122('0x38')]);return db[_0x8122('0x25')][_0x8122('0x3e')](_0x5bceb1)['then'](handleEntityNotFound(_0x16ab8c,null))[_0x8122('0x1e')](respondWithResult(_0x16ab8c,null))['catch'](handleError(_0x16ab8c,null));};exports[_0x8122('0x3f')]=function(_0x21860f,_0x5e6093){return db[_0x8122('0x25')][_0x8122('0x3f')](_0x21860f['body'],{})[_0x8122('0x1e')](respondWithResult(_0x5e6093,0xc9))[_0x8122('0x3b')](handleError(_0x5e6093,null));};exports[_0x8122('0x1d')]=function(_0x8c7e4f,_0x1d9ccf){if(_0x8c7e4f[_0x8122('0x40')]['id']){delete _0x8c7e4f[_0x8122('0x40')]['id'];}return db['WhatsappApplication'][_0x8122('0x3e')]({'where':{'id':_0x8c7e4f[_0x8122('0x3c')]['id']}})[_0x8122('0x1e')](handleEntityNotFound(_0x1d9ccf,null))[_0x8122('0x1e')](saveUpdates(_0x8c7e4f['body'],null))[_0x8122('0x1e')](respondWithResult(_0x1d9ccf,null))[_0x8122('0x3b')](handleError(_0x1d9ccf,null));};exports[_0x8122('0x1f')]=function(_0x4bac94,_0x3618cb){return db[_0x8122('0x25')][_0x8122('0x3e')]({'where':{'id':_0x4bac94[_0x8122('0x3c')]['id']}})[_0x8122('0x1e')](handleEntityNotFound(_0x3618cb,null))['then'](removeEntity(_0x3618cb,null))[_0x8122('0x3b')](handleError(_0x3618cb,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 8dc6577..eb03e87 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 _0xb2b5=['utf8mb4_unicode_ci','moment','bluebird','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','utf8mb4'];(function(_0x59be39,_0x38558d){var _0x136795=function(_0x5e499f){while(--_0x5e499f){_0x59be39['push'](_0x59be39['shift']());}};_0x136795(++_0x38558d);}(_0xb2b5,0xa3));var _0x5b2b=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xb2b5[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5b2b('0x0'));var BPromise=require(_0x5b2b('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5b2b('0x2'));var config=require(_0x5b2b('0x3'));var attributes=require(_0x5b2b('0x4'));module[_0x5b2b('0x5')]=function(_0x49d9f6,_0x30c3e2){return _0x49d9f6[_0x5b2b('0x6')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5b2b('0x7'),'collate':_0x5b2b('0x8')});}; \ No newline at end of file +var _0x3148=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4_unicode_ci','lodash'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3148,0x1d3));var _0x8314=function(_0x2565d5,_0xe6c944){_0x2565d5=_0x2565d5-0x0;var _0x1b546c=_0x3148[_0x2565d5];return _0x1b546c;};'use strict';var _=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var logger=require('../../config/logger')(_0x8314('0x2'));var moment=require(_0x8314('0x3'));var BPromise=require(_0x8314('0x4'));var rp=require(_0x8314('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8314('0x6'));var config=require(_0x8314('0x7'));var attributes=require(_0x8314('0x8'));module[_0x8314('0x9')]=function(_0x18a30b,_0x9cb271){return _0x18a30b[_0x8314('0xa')]('WhatsappApplication',attributes,{'tableName':_0x8314('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8314('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index d5bcedf..c91105c 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 _0x8d0e=['info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then'];(function(_0x325305,_0x4f32b5){var _0x38d450=function(_0x287010){while(--_0x287010){_0x325305['push'](_0x325305['shift']());}};_0x38d450(++_0x4f32b5);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x4dc757,_0x22afaa){_0x4dc757=_0x4dc757-0x0;var _0x529635=_0x8d0e[_0x4dc757];return _0x529635;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var moment=require(_0xe8d0('0x2'));var BPromise=require(_0xe8d0('0x3'));var rs=require(_0xe8d0('0x4'));var fs=require('fs');var Redis=require(_0xe8d0('0x5'));var db=require(_0xe8d0('0x6'))['db'];var utils=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('rpc');var config=require(_0xe8d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92483d,_0x469d37,_0xcc03d0){return new BPromise(function(_0x2b6dce,_0x13aa63){return client[_0xe8d0('0xb')](_0x92483d,_0xcc03d0)[_0xe8d0('0xc')](function(_0x5605a0){logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,_0xe8d0('0xf'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x469d37,_0xe8d0('0xf'),JSON[_0xe8d0('0x10')](_0x5605a0));if(_0x5605a0[_0xe8d0('0x11')]){if(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x12')]===0x1f4){logger[_0xe8d0('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x13aa63(_0x5605a0['error'][_0xe8d0('0x13')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x2b6dce(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);}else{logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,'request\x20sent');_0x2b6dce(_0x5605a0[_0xe8d0('0x14')]['message']);}})[_0xe8d0('0x15')](function(_0x3c526c){logger[_0xe8d0('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x469d37,_0x3c526c);_0x13aa63(_0x3c526c);});});} \ No newline at end of file +var _0xda55=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x5bf9c0,_0x206f4c){var _0x285285=function(_0xbdbfbf){while(--_0xbdbfbf){_0x5bf9c0['push'](_0x5bf9c0['shift']());}};_0x285285(++_0x206f4c);}(_0xda55,0x6d));var _0x5da5=function(_0x4f1789,_0x37fda7){_0x4f1789=_0x4f1789-0x0;var _0x5bb8fe=_0xda55[_0x4f1789];return _0x5bb8fe;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd877,_0x267469,_0x71b187){return new BPromise(function(_0x46290d,_0x3debdf){return client[_0x5da5('0x9')](_0x2fd877,_0x71b187)[_0x5da5('0xa')](function(_0x302795){logger['info'](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x267469,_0x5da5('0xc'),JSON[_0x5da5('0xf')](_0x302795));if(_0x302795[_0x5da5('0x10')]){if(_0x302795['error'][_0x5da5('0x11')]===0x1f4){logger[_0x5da5('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x267469,_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);return _0x3debdf(_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);}logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x302795['error']['message']);return _0x46290d(_0x302795['error'][_0x5da5('0x12')]);}else{logger[_0x5da5('0x13')](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));_0x46290d(_0x302795[_0x5da5('0x14')][_0x5da5('0x12')]);}})[_0x5da5('0x15')](function(_0x4a952a){logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x4a952a);_0x3debdf(_0x4a952a);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index d4e9bdd..3ea0193 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 _0x3c94=['create','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','tracked','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x5d6aa6,_0x5a737f){var _0x296d36=function(_0x2d475b){while(--_0x2d475b){_0x5d6aa6['push'](_0x5d6aa6['shift']());}};_0x296d36(++_0x5a737f);}(_0x3c94,0xcd));var _0x43c9=function(_0x4f4fb9,_0x3798bc){_0x4f4fb9=_0x4f4fb9-0x0;var _0x1d9828=_0x3c94[_0x4f4fb9];return _0x1d9828;};'use strict';var multer=require(_0x43c9('0x0'));var util=require(_0x43c9('0x1'));var path=require(_0x43c9('0x2'));var timeout=require(_0x43c9('0x3'));var express=require(_0x43c9('0x4'));var router=express[_0x43c9('0x5')]();var fs_extra=require(_0x43c9('0x6'));var auth=require(_0x43c9('0x7'));var interaction=require(_0x43c9('0x8'));var config=require(_0x43c9('0x9'));var controller=require(_0x43c9('0xa'));router[_0x43c9('0xb')]('/',auth['isAuthenticated'](),controller[_0x43c9('0xc')]);router[_0x43c9('0xb')](_0x43c9('0xd'),auth[_0x43c9('0xe')](),controller[_0x43c9('0xf')]);router[_0x43c9('0xb')](_0x43c9('0x10'),auth[_0x43c9('0xe')](),controller[_0x43c9('0x11')]);router['get'](_0x43c9('0x12'),auth[_0x43c9('0xe')](),controller[_0x43c9('0x13')]);router[_0x43c9('0xb')](_0x43c9('0x14'),auth[_0x43c9('0xe')](),controller[_0x43c9('0x15')]);router[_0x43c9('0x16')]('/',auth[_0x43c9('0xe')](),controller[_0x43c9('0x17')]);router[_0x43c9('0x16')](_0x43c9('0x12'),auth[_0x43c9('0xe')](),controller[_0x43c9('0x18')]);router[_0x43c9('0x16')](_0x43c9('0x19'),auth[_0x43c9('0xe')](),interaction['tracked'](_0x43c9('0x1a'),_0x43c9('0x1b')),controller[_0x43c9('0x1c')]);router[_0x43c9('0x1d')](_0x43c9('0x10'),auth['isAuthenticated'](),interaction['tracked'](_0x43c9('0x1a'),_0x43c9('0x1e')),controller[_0x43c9('0x1f')]);router[_0x43c9('0x20')]('/:id',auth[_0x43c9('0xe')](),interaction[_0x43c9('0x21')](_0x43c9('0x1a'),_0x43c9('0x22')),controller[_0x43c9('0x23')]);router[_0x43c9('0x20')](_0x43c9('0x19'),auth[_0x43c9('0xe')](),controller[_0x43c9('0x24')]);module[_0x43c9('0x25')]=router; \ No newline at end of file +var _0xe0ae=['update','delete','destroy','/:id/tags','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','index','get','/describe','isAuthenticated','show','/:id/messages','getMessages','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','/:id','whatsappinteraction:update'];(function(_0x4390a4,_0x31b8aa){var _0x4f3b4f=function(_0xbc8664){while(--_0xbc8664){_0x4390a4['push'](_0x4390a4['shift']());}};_0x4f3b4f(++_0x31b8aa);}(_0xe0ae,0xa1));var _0xee0a=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0xe0ae[_0x5d5bcb];return _0x4ea5eb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee0a('0x0'));var timeout=require(_0xee0a('0x1'));var express=require('express');var router=express[_0xee0a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xee0a('0x3'));var interaction=require(_0xee0a('0x4'));var config=require('../../config/environment');var controller=require(_0xee0a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xee0a('0x6')]);router[_0xee0a('0x7')](_0xee0a('0x8'),auth[_0xee0a('0x9')](),controller['describe']);router[_0xee0a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xee0a('0xa')]);router[_0xee0a('0x7')](_0xee0a('0xb'),auth['isAuthenticated'](),controller[_0xee0a('0xc')]);router[_0xee0a('0x7')]('/:id/download',auth[_0xee0a('0x9')](),controller['download']);router[_0xee0a('0xd')]('/',auth[_0xee0a('0x9')](),controller['create']);router[_0xee0a('0xd')]('/:id/messages',auth[_0xee0a('0x9')](),controller[_0xee0a('0xe')]);router['post']('/:id/tags',auth[_0xee0a('0x9')](),interaction[_0xee0a('0xf')](_0xee0a('0x10'),_0xee0a('0x11')),controller[_0xee0a('0x12')]);router['put'](_0xee0a('0x13'),auth[_0xee0a('0x9')](),interaction['tracked'](_0xee0a('0x10'),_0xee0a('0x14')),controller[_0xee0a('0x15')]);router[_0xee0a('0x16')]('/:id',auth[_0xee0a('0x9')](),interaction[_0xee0a('0xf')](_0xee0a('0x10'),'whatsappinteraction:destroy'),controller[_0xee0a('0x17')]);router[_0xee0a('0x16')](_0xee0a('0x18'),auth[_0xee0a('0x9')](),controller['removeTags']);module[_0xee0a('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 0e82a9b..3b5b83c 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 _0xc99e=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x133b9f,_0x1ef2b9){var _0x56c5e5=function(_0x5105ac){while(--_0x5105ac){_0x133b9f['push'](_0x133b9f['shift']());}};_0x56c5e5(++_0x1ef2b9);}(_0xc99e,0x6e));var _0xec99=function(_0x87918b,_0x312c94){_0x87918b=_0x87918b-0x0;var _0x1c8d14=_0xc99e[_0x87918b];return _0x1c8d14;};'use strict';var Sequelize=require(_0xec99('0x0'));var moment=require(_0xec99('0x1'));module[_0xec99('0x2')]={'closed':{'type':Sequelize[_0xec99('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xec99('0x4')]},'disposition':{'type':Sequelize[_0xec99('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xec99('0x5')]},'note':{'type':Sequelize[_0xec99('0x5')]},'phone':{'type':Sequelize[_0xec99('0x5')]},'read1stAt':{'type':Sequelize[_0xec99('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xec99('0x6')]('in',_0xec99('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xec99('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xec99('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xec99('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0845=['BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x24b470,_0xd7c92d){var _0x4acedd=function(_0xb1ff13){while(--_0xb1ff13){_0x24b470['push'](_0x24b470['shift']());}};_0x4acedd(++_0xd7c92d);}(_0x0845,0x125));var _0x5084=function(_0x11e645,_0x5d8923){_0x11e645=_0x11e645-0x0;var _0x4e544a=_0x0845[_0x11e645];return _0x4e544a;};'use strict';var Sequelize=require(_0x5084('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x5084('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5084('0x2')]},'disposition':{'type':Sequelize[_0x5084('0x3')]},'secondDisposition':{'type':Sequelize[_0x5084('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5084('0x3')]},'note':{'type':Sequelize[_0x5084('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x5084('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x5084('0x4')]('in',_0x5084('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5084('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 5640d6b..a6e6d09 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 _0xf555=['a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','search','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','include','create','catch','update','describe','WhatsappMessage','addMessage','ids','omit','findOne','format','YYYY-MM-DD\x20HH:mm:ss','options','setTags','spread','findAll','emit','download','join','root','files','tmp','server','attachments','firstName','Attachment','Messages','Account','Owner','get','mkdirSync','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','System','lastName','out','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','localhost','socket.io-emitter','redis','./whatsappInteraction.socket','register','sendStatus','end','status','json','undefined','limit','offset','count','set','reject','save','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf555,0x97));var _0x5f55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf555[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5f55('0x0'));var rimraf=require(_0x5f55('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f55('0x2'));var rp=require('request-promise');var moment=require(_0x5f55('0x3'));var BPromise=require(_0x5f55('0x4'));var Mustache=require(_0x5f55('0x5'));var util=require('util');var path=require(_0x5f55('0x6'));var sox=require(_0x5f55('0x7'));var csv=require('to-csv');var ejs=require(_0x5f55('0x8'));var fs=require('fs');var fs_extra=require(_0x5f55('0x9'));var _=require(_0x5f55('0xa'));var squel=require(_0x5f55('0xb'));var crypto=require(_0x5f55('0xc'));var jsforce=require(_0x5f55('0xd'));var deskjs=require(_0x5f55('0xe'));var toCsv=require(_0x5f55('0xf'));var querystring=require(_0x5f55('0x10'));var Papa=require('papaparse');var Redis=require(_0x5f55('0x11'));var authService=require(_0x5f55('0x12'));var qs=require(_0x5f55('0x13'));var as=require(_0x5f55('0x14'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x5f55('0x15'));var logger=require(_0x5f55('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5f55('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x5f55('0x18'),'port':0x18eb});var socket=require(_0x5f55('0x19'))(new Redis(config[_0x5f55('0x1a')]));require(_0x5f55('0x1b'))[_0x5f55('0x1c')](socket);function respondWithStatusCode(_0x3943c8,_0x336aff){_0x336aff=_0x336aff||0xcc;return function(_0x549678){if(_0x549678){return _0x3943c8[_0x5f55('0x1d')](_0x336aff);}return _0x3943c8['status'](_0x336aff)[_0x5f55('0x1e')]();};}function respondWithResult(_0x3175c8,_0x2e70a6){_0x2e70a6=_0x2e70a6||0xc8;return function(_0x49eb28){if(_0x49eb28){return _0x3175c8[_0x5f55('0x1f')](_0x2e70a6)[_0x5f55('0x20')](_0x49eb28);}};}function respondWithFilteredResult(_0x1b6f27,_0x5644d5){return function(_0x351886){if(_0x351886){var _0x1051a4=typeof _0x5644d5['offset']===_0x5f55('0x21')&&typeof _0x5644d5[_0x5f55('0x22')]==='undefined';var _0x55bb0f=_0x351886['count'];var _0x25d9d1=_0x1051a4?0x0:_0x5644d5[_0x5f55('0x23')];var _0x5adc68=_0x1051a4?_0x351886[_0x5f55('0x24')]:_0x5644d5[_0x5f55('0x23')]+_0x5644d5[_0x5f55('0x22')];var _0x6607aa;if(_0x5adc68>=_0x55bb0f){_0x5adc68=_0x55bb0f;_0x6607aa=0xc8;}else{_0x6607aa=0xce;}_0x1b6f27[_0x5f55('0x1f')](_0x6607aa);return _0x1b6f27[_0x5f55('0x25')]('Content-Range',_0x25d9d1+'-'+_0x5adc68+'/'+_0x55bb0f)[_0x5f55('0x20')](_0x351886);}return null;};}function patchUpdates(_0x44f2d5){return function(_0x3c1a14){try{jsonpatch['apply'](_0x3c1a14,_0x44f2d5,!![]);}catch(_0x2c146c){return BPromise[_0x5f55('0x26')](_0x2c146c);}return _0x3c1a14[_0x5f55('0x27')]();};}function saveUpdates(_0x3f3338,_0xa08506){return function(_0x59cf8f){if(_0x59cf8f){return _0x59cf8f['update'](_0x3f3338)[_0x5f55('0x28')](function(_0x54c0c3){return _0x54c0c3;});}return null;};}function removeEntity(_0x234a0f,_0x470cbf){return function(_0x67ddf){if(_0x67ddf){return _0x67ddf[_0x5f55('0x29')]()['then'](function(){_0x234a0f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x429ca3,_0xfae79f){return function(_0x13b151){if(!_0x13b151){_0x429ca3[_0x5f55('0x1d')](0x194);}return _0x13b151;};}function handleError(_0x24f87f,_0x202330){_0x202330=_0x202330||0x1f4;return function(_0x443c0b){logger['error'](_0x443c0b[_0x5f55('0x2a')]);if(_0x443c0b[_0x5f55('0x2b')]){delete _0x443c0b[_0x5f55('0x2b')];}_0x24f87f['status'](_0x202330)[_0x5f55('0x2c')](_0x443c0b);};}function getInteractionUsers(_0x4921a0,_0x221f26){return new BPromise(function(_0x4520ef,_0x13e16f){try{if(_0x221f26[_0x4921a0['id']]){_0x4921a0[_0x5f55('0x2d')]=_[_0x5f55('0x2e')](_0x221f26[_0x4921a0['id']],function(_0x5db90b){return{'id':_0x5db90b['id'],'fullname':_0x5db90b[_0x5f55('0x2f')]};});}}catch(_0x5ae8ca){_0x13e16f(_0x5ae8ca);}_0x4520ef(_0x4921a0);});}function getInteractionTags(_0xf20acd,_0x59915a){return new BPromise(function(_0x36090f,_0x1422bd){try{if(_0xf20acd[_0x5f55('0x30')]){_0xf20acd[_0x5f55('0x31')]=[];_0xf20acd[_0x5f55('0x30')][_0x5f55('0x32')](',')[_0x5f55('0x33')](function(_0x5bfda1){_0xf20acd[_0x5f55('0x31')][_0x5f55('0x34')](_0x59915a[_0x5bfda1]);});}delete _0xf20acd[_0x5f55('0x30')];}catch(_0x1452fa){_0x1422bd(_0x1452fa);}_0x36090f(_0xf20acd);});}function updateWhatsappInteraction(_0x9aace1,_0x12c99c,_0x11e3c8){return new BPromise(function(_0x4d9a33,_0x321bce){return getInteractionUsers(_0x9aace1,_0x11e3c8)['then'](function(_0x198643){return getInteractionTags(_0x198643,_0x12c99c);})['then'](function(_0x3394fe){_0x4d9a33(_0x3394fe);})['catch'](function(_0x2b6a85){_0x321bce(_0x2b6a85);});});}exports[_0x5f55('0x35')]=function(_0x360ad8,_0x4beffd){var _0x402f06={},_0x4a967b={},_0xdea125={'count':0x0,'rows':[]};var _0x5e0916=_[_0x5f55('0x2e')](db[_0x5f55('0x36')][_0x5f55('0x37')],function(_0x494b90){return{'name':_0x494b90[_0x5f55('0x38')],'type':_0x494b90[_0x5f55('0x39')][_0x5f55('0x3a')]};});_0x4a967b[_0x5f55('0x3b')]=_[_0x5f55('0x2e')](_0x5e0916,_0x5f55('0x2b'));_0x4a967b[_0x5f55('0x3c')]=_[_0x5f55('0x3d')](_0x360ad8['query']);_0x4a967b[_0x5f55('0x3e')]=_[_0x5f55('0x3f')](_0x4a967b[_0x5f55('0x3b')],_0x4a967b[_0x5f55('0x3c')]);_0x402f06[_0x5f55('0x40')]=_[_0x5f55('0x3f')](_0x4a967b['model'],qs[_0x5f55('0x41')](_0x360ad8[_0x5f55('0x3c')][_0x5f55('0x41')]));_0x402f06[_0x5f55('0x40')]=_0x402f06['attributes'][_0x5f55('0x42')]?_0x402f06['attributes']:_0x4a967b[_0x5f55('0x3b')];if(!_0x360ad8['query'][_0x5f55('0x43')](_0x5f55('0x44'))){_0x402f06[_0x5f55('0x22')]=qs['limit'](_0x360ad8[_0x5f55('0x3c')][_0x5f55('0x22')]);_0x402f06[_0x5f55('0x23')]=qs[_0x5f55('0x23')](_0x360ad8['query']['offset']);}_0x402f06[_0x5f55('0x45')]=qs[_0x5f55('0x46')](_0x360ad8[_0x5f55('0x3c')]['sort']);_0x402f06[_0x5f55('0x47')]=qs['filters'](_[_0x5f55('0x48')](_0x360ad8[_0x5f55('0x3c')],_0x4a967b['filters']),_0x5e0916);var _0x11216b=[];var _0x1e9bca=squel[_0x5f55('0x49')]()['field']('id')['field']('name')[_0x5f55('0x4a')](_0x5f55('0x4b'))[_0x5f55('0x4c')]('tools_tags');var _0x693aae=squel[_0x5f55('0x49')]()[_0x5f55('0x4a')]('u.id')[_0x5f55('0x4a')](_0x5f55('0x4d'))[_0x5f55('0x4a')](_0x5f55('0x4e'))[_0x5f55('0x4c')](_0x5f55('0x4f'),'ui')[_0x5f55('0x50')](_0x5f55('0x51'),'u',_0x5f55('0x52'));var _0x45d7a1=squel['select']()[_0x5f55('0x4c')]('whatsapp_interactions','i')[_0x5f55('0x50')]('cm_contacts','c',_0x5f55('0x53'))[_0x5f55('0x50')](_0x5f55('0x51'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x5f55('0x54'),'a',_0x5f55('0x55'))['left_join']('whatsapp_messages','me',_0x5f55('0x56'))[_0x5f55('0x50')](_0x5f55('0x57'),'it',_0x5f55('0x58'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x3598d2=squel[_0x5f55('0x59')]();var _0x21c931=[];var _0x12a0ca=squel[_0x5f55('0x59')]();var _0x3b210a;if(_0x360ad8['query'][_0x5f55('0x5a')]){_0x3b210a=as['parseSearch'](_0x360ad8[_0x5f55('0x3c')][_0x5f55('0x5a')]);var _0x1dfeaa=_0x3b210a['sqlOperator'];for(var _0x24a279=0x0;_0x24a279<_0x3b210a['conditions']['length'];_0x24a279++){var _0x4eb724=_0x3b210a[_0x5f55('0x5b')][_0x24a279];var _0x5525ac='i';var _0x4c899d=_['find'](_0x5e0916,[_0x5f55('0x2b'),_0x4eb724[_0x5f55('0x4a')]]);if(!_0x4c899d){switch(_0x4eb724[_0x5f55('0x4a')]){case _0x5f55('0x5c'):if(_0x4eb724[_0x5f55('0x5d')]==0x1){_0x45d7a1[_0x5f55('0x5e')]('`'+_0x4eb724[_0x5f55('0x4a')]+_0x5f55('0x5f'));}else{_0x45d7a1[_0x5f55('0x5e')]('`'+_0x4eb724[_0x5f55('0x4a')]+_0x5f55('0x60'));}break;case _0x5f55('0x61'):if(_0x4eb724[_0x5f55('0x62')]===_0x5f55('0x63')){if(_0x4eb724[_0x5f55('0x5d')][_0x5f55('0x32')]('\x20')[_0x5f55('0x42')]>0x1){_0x3598d2[_0x1dfeaa](_0x5f55('0x64'),qs[_0x5f55('0x65')](_0x4eb724['value']),null);}else{var _0x51eba4='%'+_0x4eb724[_0x5f55('0x5d')]+'%';_0x3598d2[_0x1dfeaa](_0x5f55('0x66'),_0x51eba4,_0x51eba4,_0x51eba4);}}else{_0x4c899d=_[_0x5f55('0x67')](_0x5e0916,[_0x5f55('0x2b'),_0x5f55('0x68')]);_0x4eb724[_0x5f55('0x4a')]=_0x5f55('0x68');_0x1b194f=as[_0x5f55('0x69')](_0x5525ac,_0x4c899d[_0x5f55('0x39')],_0x4eb724);_0x3598d2[_0x1dfeaa](_0x1b194f[_0x5f55('0x6a')],_0x1b194f[_0x5f55('0x5d')][_0x5f55('0x6b')],_0x1b194f[_0x5f55('0x5d')][_0x5f55('0x1e')]);}break;case _0x5f55('0x6c'):var _0x5a73e5=_0x4eb724[_0x5f55('0x5d')][_0x5f55('0x32')](',')[_0x5f55('0x2e')](function(_0x15ad0f){return Number(_0x15ad0f);});_0x5a73e5[_0x5f55('0x33')](function(_0x575c14){_0x12a0ca['or'](_0x5f55('0x6d'),'%,'+_0x575c14+',%');});_0x21c931=_['union'](_0x21c931,_0x5a73e5);break;case _0x5f55('0x6e'):if(_0x4eb724[_0x5f55('0x62')]===_0x5f55('0x63')){_0x3598d2[_0x1dfeaa](_0x5f55('0x6f'),'%'+_0x4eb724[_0x5f55('0x5d')]+'%',null);}else{_0x4c899d=_['find'](_0x5e0916,[_0x5f55('0x2b'),_0x5f55('0x70')]);_0x4eb724[_0x5f55('0x4a')]='UserId';_0x1b194f=as[_0x5f55('0x69')](_0x5525ac,_0x4c899d[_0x5f55('0x39')],_0x4eb724);_0x3598d2[_0x1dfeaa](_0x1b194f[_0x5f55('0x6a')],_0x1b194f['value'][_0x5f55('0x6b')],_0x1b194f[_0x5f55('0x5d')][_0x5f55('0x1e')]);}break;case _0x5f55('0x71'):_0x1b194f=as['buildExpression']('me',null,_0x4eb724);_0x3598d2[_0x1dfeaa](_0x1b194f[_0x5f55('0x6a')],_0x1b194f[_0x5f55('0x5d')]['start'],_0x1b194f[_0x5f55('0x5d')][_0x5f55('0x1e')]);break;}}else{var _0x1b194f=as[_0x5f55('0x69')](_0x5525ac,_0x4c899d[_0x5f55('0x39')],_0x4eb724);_0x3598d2[_0x1dfeaa](_0x1b194f[_0x5f55('0x6a')],_0x1b194f['value'][_0x5f55('0x6b')],_0x1b194f[_0x5f55('0x5d')][_0x5f55('0x1e')]);}}}else{var _0x46b671=_(_0x360ad8[_0x5f55('0x3c')])[_0x5f55('0x3d')]()[_0x5f55('0x2e')](function(_0x23bacd){return _[_0x5f55('0x72')](_0x5e0916,['name',_0x23bacd])?_0x23bacd:undefined;})[_0x5f55('0x73')]()[_0x5f55('0x5d')]();if(!_[_0x5f55('0x74')](_0x46b671)){_0x46b671['forEach'](function(_0x12541f){if(_0x12541f===_0x5f55('0x75')){_0x45d7a1[_0x5f55('0x47')](_0x5f55('0x76'),[][_0x5f55('0x77')](_0x360ad8['query'][_0x12541f]));}else if(_0x12541f===_0x5f55('0x78')){var _0x42ae25=JSON[_0x5f55('0x79')](_0x360ad8[_0x5f55('0x3c')][_0x12541f])[_0x5f55('0x7a')];var _0x403f47=JSON[_0x5f55('0x79')](_0x360ad8[_0x5f55('0x3c')][_0x12541f])[_0x5f55('0x7b')];_0x45d7a1[_0x5f55('0x47')](_0x5f55('0x7c'),_0x42ae25,_0x403f47);}else{if(_0x360ad8['query'][_0x12541f]===_0x5f55('0x7d')){_0x45d7a1[_0x5f55('0x47')]('i.'+_0x12541f+_0x5f55('0x7e'));}else{_0x45d7a1[_0x5f55('0x47')]('i.'+_0x12541f+_0x5f55('0x7f'),_0x360ad8[_0x5f55('0x3c')][_0x12541f]);}}});}if(_0x360ad8[_0x5f55('0x3c')][_0x5f55('0x80')]){if(_0x360ad8['query']['read']==0x1){_0x45d7a1[_0x5f55('0x5e')](_0x5f55('0x81'));}else{_0x45d7a1['having'](_0x5f55('0x82'));}}if(_0x360ad8[_0x5f55('0x3c')]['tag']){_0x21c931=_[_0x5f55('0x83')](_0x360ad8[_0x5f55('0x3c')]['tag'])?_0x360ad8[_0x5f55('0x3c')][_0x5f55('0x84')]:new Array(_0x360ad8[_0x5f55('0x3c')]['tag']);_0x21c931[_0x5f55('0x33')](function(_0xb0573d){_0x12a0ca['or'](_0x5f55('0x6d'),'%,'+_0xb0573d+',%');});}if(_0x360ad8[_0x5f55('0x3c')][_0x5f55('0x85')]){var _0x263b77=_0x360ad8[_0x5f55('0x3c')][_0x5f55('0x85')][_0x5f55('0x86')]('\x5c','\x5c\x5c')[_0x5f55('0x86')](/'/g,'\x27\x27');if(qs[_0x5f55('0x87')](_0x263b77)){_0x3598d2['or']('i.id\x20LIKE\x20?',_0x263b77+'%')['or'](_0x5f55('0x88'),_0x263b77+'%');}else{_0x3598d2['or'](_0x5f55('0x89'),qs['getFullTextValue'](_0x263b77))['or'](_0x5f55('0x8a'),_0x263b77+'%');}}}_0x45d7a1[_0x5f55('0x47')](_0x3598d2);_0x45d7a1[_0x5f55('0x8b')](_0x5f55('0x8c'));var _0xfeb371={'type':db[_0x5f55('0x8d')][_0x5f55('0x8e')][_0x5f55('0x8f')],'raw':!![]};var _0x28ddb3=_0x45d7a1['clone']();_0x28ddb3[_0x5f55('0x4a')](_0x5f55('0x8c'));_0x28ddb3['field'](_0x5f55('0x90'),'unreadMessages');if(_0x402f06['order']){_0x402f06[_0x5f55('0x45')][_0x5f55('0x33')](function(_0x150f07){var _0x5831eb=_0x150f07[0x0]===_0x5f55('0x91')?_0x150f07[0x0]:'i.'+_0x150f07[0x0];_0x45d7a1['order'](_0x5831eb,_0x150f07[0x1]===_0x5f55('0x92')?![]:!![]);});}if(!_[_0x5f55('0x74')](_0x21c931)){_0x45d7a1[_0x5f55('0x5e')](_0x12a0ca);_0x28ddb3[_0x5f55('0x47')](_0x5f55('0x93'),_0x21c931);}BPromise[_0x5f55('0x94')]()['then'](function(){if(!_0x3b210a){if(_0x360ad8[_0x5f55('0x3c')][_0x5f55('0x75')])return;_0x28ddb3[_0x5f55('0x47')](_0x5f55('0x95'));_0x45d7a1[_0x5f55('0x47')](_0x5f55('0x95'));return;}if(_0x360ad8['user'][_0x5f55('0x96')]!==_0x5f55('0x97'))return;return _0x360ad8[_0x5f55('0x98')][_0x5f55('0x99')]({'attributes':['id'],'raw':!![]})[_0x5f55('0x28')](function(_0x1ef2be){if(_[_0x5f55('0x74')](_0x1ef2be)){_0x28ddb3[_0x5f55('0x47')](_0x5f55('0x9a'));_0x45d7a1[_0x5f55('0x47')](_0x5f55('0x9a'));}else{_0x28ddb3[_0x5f55('0x47')](_0x5f55('0x76'),_[_0x5f55('0x2e')](_0x1ef2be,'id'));_0x45d7a1[_0x5f55('0x47')]('i.WhatsappAccountId\x20IN\x20?',_[_0x5f55('0x2e')](_0x1ef2be,'id'));}});})['then'](function(){if(_0x360ad8[_0x5f55('0x98')][_0x5f55('0x96')]==='agent'&&!_0x3b210a&&!_0x360ad8['query'][_0x5f55('0x75')])return[];return db['sequelize'][_0x5f55('0x3c')](_0x28ddb3['toString'](),_0xfeb371);})[_0x5f55('0x28')](function(_0x1ad540){_0xdea125['count']=_0x1ad540[_0x5f55('0x42')];if(_0xdea125['count']===0x0)return[];return db['sequelize'][_0x5f55('0x3c')](_0x1e9bca[_0x5f55('0x9b')](),_0xfeb371)[_0x5f55('0x28')](function(_0x555e90){_0x11216b=_[_0x5f55('0x9c')](_0x555e90,'id');_0xfeb371=_[_0x5f55('0x9d')](_0xfeb371,{'model':db[_0x5f55('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x360ad8[_0x5f55('0x3c')][_0x5f55('0x41')]){_0x402f06[_0x5f55('0x40')][_0x5f55('0x33')](function(_0x342e0d){_0x45d7a1[_0x5f55('0x4a')]('i.'+_0x342e0d);});}else{_0x45d7a1['field'](_0x5f55('0x90'),_0x5f55('0x5c'));_0x45d7a1[_0x5f55('0x4a')](_0x5f55('0x9e'),_0x5f55('0x9f'));_0x45d7a1['field'](_0x5f55('0xa0'),'Account.mandatoryDisposition');_0x45d7a1[_0x5f55('0x4a')](_0x5f55('0xa1'),_0x5f55('0x91'));_0x45d7a1[_0x5f55('0x4a')](_0x5f55('0xa2'));_0x45d7a1['field']('c.firstName',_0x5f55('0xa3'));_0x45d7a1[_0x5f55('0x4a')](_0x5f55('0xa4'),_0x5f55('0xa5'));_0x45d7a1['field']('c.email',_0x5f55('0xa6'));_0x45d7a1[_0x5f55('0x4a')](_0x5f55('0xa7'),_0x5f55('0xa8'));_0x45d7a1[_0x5f55('0x4a')](_0x5f55('0xa9'),_0x5f55('0xaa'));_0x45d7a1['field'](_0x5f55('0xab'),_0x5f55('0xac'));_0x45d7a1[_0x5f55('0x4a')]('o.fullname','Owner.fullname');_0x45d7a1[_0x5f55('0x4a')]('o.internal','Owner.internal');_0x45d7a1['field'](_0x5f55('0xad'),_0x5f55('0x30'));}if(_0x402f06['limit'])_0x45d7a1[_0x5f55('0x22')](_0x402f06[_0x5f55('0x22')]);if(_0x402f06['offset'])_0x45d7a1[_0x5f55('0x23')](_0x402f06[_0x5f55('0x23')]);return db[_0x5f55('0xae')]['query'](_0x45d7a1['toString'](),_0xfeb371);})[_0x5f55('0x28')](function(_0x5a29b2){if(_0x5a29b2[_0x5f55('0x42')]>0x0)_0x693aae[_0x5f55('0x47')](_0x5f55('0xaf'),_[_0x5f55('0x2e')](_0x5a29b2,'id'));return db[_0x5f55('0xae')][_0x5f55('0x3c')](_0x693aae[_0x5f55('0x9b')](),_0xfeb371)[_0x5f55('0x28')](function(_0x2e7980){var _0x4bf474=_[_0x5f55('0xb0')](_0x2e7980,'WhatsappInteractionId');var _0x318ee8=[];_0x5a29b2[_0x5f55('0x33')](function(_0xcad0df){_0x318ee8[_0x5f55('0x34')](updateWhatsappInteraction(_0xcad0df,_0x11216b,_0x4bf474));});return BPromise[_0x5f55('0xb1')](_0x318ee8);});});})['then'](function(_0x4ec4e4){_0xdea125[_0x5f55('0xb2')]=_0x4ec4e4;return _0xdea125;})[_0x5f55('0x28')](respondWithFilteredResult(_0x4beffd,_0x402f06))['catch'](handleError(_0x4beffd,null));};exports[_0x5f55('0xb3')]=function(_0x5e6ce4,_0x1249d4){var _0x2a5575={'raw':![],'where':{'id':_0x5e6ce4[_0x5f55('0xb4')]['id']}},_0x90df20={};_0x90df20[_0x5f55('0x3b')]=_[_0x5f55('0x3d')](db[_0x5f55('0x36')]['rawAttributes']);_0x90df20['query']=_[_0x5f55('0x3d')](_0x5e6ce4[_0x5f55('0x3c')]);_0x90df20[_0x5f55('0x3e')]=_[_0x5f55('0x3f')](_0x90df20[_0x5f55('0x3b')],_0x90df20[_0x5f55('0x3c')]);_0x2a5575[_0x5f55('0x40')]=_[_0x5f55('0x3f')](_0x90df20[_0x5f55('0x3b')],qs[_0x5f55('0x41')](_0x5e6ce4['query']['fields']));_0x2a5575[_0x5f55('0x40')]=_0x2a5575[_0x5f55('0x40')][_0x5f55('0x42')]?_0x2a5575[_0x5f55('0x40')]:_0x90df20[_0x5f55('0x3b')];if(_0x5e6ce4['query'][_0x5f55('0xb5')]){_0x2a5575[_0x5f55('0xb6')]=[{'all':!![]}];}_0x2a5575=_[_0x5f55('0x9d')]({},_0x2a5575,_0x5e6ce4['options']);return db[_0x5f55('0x36')][_0x5f55('0x67')](_0x2a5575)['then'](handleEntityNotFound(_0x1249d4,null))[_0x5f55('0x28')](respondWithResult(_0x1249d4,null))['catch'](handleError(_0x1249d4,null));};exports[_0x5f55('0xb7')]=function(_0x5c8a17,_0x27595a){return db[_0x5f55('0x36')]['create'](_0x5c8a17['body'],{})[_0x5f55('0x28')](respondWithResult(_0x27595a,0xc9))[_0x5f55('0xb8')](handleError(_0x27595a,null));};exports[_0x5f55('0xb9')]=function(_0x1de066,_0x4ef95d){if(_0x1de066[_0x5f55('0x71')]['id']){delete _0x1de066[_0x5f55('0x71')]['id'];}return db[_0x5f55('0x36')][_0x5f55('0x67')]({'where':{'id':_0x1de066[_0x5f55('0xb4')]['id']}})[_0x5f55('0x28')](handleEntityNotFound(_0x4ef95d,null))[_0x5f55('0x28')](saveUpdates(_0x1de066['body'],null))[_0x5f55('0x28')](respondWithResult(_0x4ef95d,null))[_0x5f55('0xb8')](handleError(_0x4ef95d,null));};exports[_0x5f55('0x29')]=function(_0x47f022,_0x352961){return db['WhatsappInteraction'][_0x5f55('0x67')]({'where':{'id':_0x47f022['params']['id']}})[_0x5f55('0x28')](handleEntityNotFound(_0x352961,null))['then'](removeEntity(_0x352961,null))['catch'](handleError(_0x352961,null));};exports[_0x5f55('0xba')]=function(_0x41723f,_0xc5d4cb){return db[_0x5f55('0x36')]['describe']()[_0x5f55('0x28')](respondWithResult(_0xc5d4cb,null))[_0x5f55('0xb8')](handleError(_0xc5d4cb,null));};exports['addMessage']=function(_0x10c506,_0xfc1c7c,_0x538280){return db[_0x5f55('0xbb')][_0x5f55('0x67')]({'where':{'id':_0x10c506['params']['id']}})['then'](handleEntityNotFound(_0xfc1c7c,null))['then'](function(_0x33f111){if(_0x33f111){return _0x33f111[_0x5f55('0xbc')](_0x10c506[_0x5f55('0x71')][_0x5f55('0xbd')],_[_0x5f55('0xbe')](_0x10c506[_0x5f55('0x71')],[_0x5f55('0xbd'),'id'])||{});}})[_0x5f55('0x28')](respondWithResult(_0xfc1c7c,null))['catch'](handleError(_0xfc1c7c,null));};exports['getMessages']=function(_0x13cc3f,_0x2d596d,_0x138a28){var _0x33d383={'raw':![],'where':{}};var _0x3c5b40={};var _0x4cac8a={'count':0x0,'rows':[]};return db[_0x5f55('0x36')][_0x5f55('0xbf')]({'where':{'id':_0x13cc3f['params']['id']}})['then'](handleEntityNotFound(_0x2d596d,null))[_0x5f55('0x28')](function(_0x24a187){if(_0x24a187){_0x3c5b40['model']=_['keys'](db[_0x5f55('0xbb')]['rawAttributes']);_0x3c5b40[_0x5f55('0x3c')]=_[_0x5f55('0x3d')](_0x13cc3f[_0x5f55('0x3c')]);_0x3c5b40[_0x5f55('0x3e')]=_[_0x5f55('0x3f')](_0x3c5b40[_0x5f55('0x3b')],_0x3c5b40[_0x5f55('0x3c')]);_0x33d383[_0x5f55('0x40')]=_[_0x5f55('0x3f')](_0x3c5b40[_0x5f55('0x3b')],qs[_0x5f55('0x41')](_0x13cc3f[_0x5f55('0x3c')]['fields']));_0x33d383[_0x5f55('0x40')]=_0x33d383[_0x5f55('0x40')][_0x5f55('0x42')]?_0x33d383['attributes']:_0x3c5b40['model'];if(!_0x13cc3f['query'][_0x5f55('0x43')](_0x5f55('0x44'))){_0x33d383['limit']=qs[_0x5f55('0x22')](_0x13cc3f[_0x5f55('0x3c')][_0x5f55('0x22')]);_0x33d383[_0x5f55('0x23')]=qs[_0x5f55('0x23')](_0x13cc3f['query'][_0x5f55('0x23')]);}_0x33d383[_0x5f55('0x45')]=qs[_0x5f55('0x46')](_0x13cc3f[_0x5f55('0x3c')][_0x5f55('0x46')]);_0x33d383[_0x5f55('0x47')]=qs[_0x5f55('0x3e')](_['pick'](_0x13cc3f[_0x5f55('0x3c')],_0x3c5b40['filters']));_0x33d383[_0x5f55('0x47')]['WhatsappInteractionId']=_0x24a187['id'];if(_0x13cc3f[_0x5f55('0x3c')][_0x5f55('0x85')]){_0x33d383[_0x5f55('0x47')]=_[_0x5f55('0x9d')](_0x33d383[_0x5f55('0x47')],{'$or':_[_0x5f55('0x2e')](_0x33d383[_0x5f55('0x40')],function(_0x287425){var _0x51c54={};_0x51c54[_0x287425]={'$like':'%'+_0x13cc3f['query'][_0x5f55('0x85')]+'%'};return _0x51c54;})});}if(_0x13cc3f['query']['$gte']){var _0xf4ef35=_0x13cc3f[_0x5f55('0x3c')][_0x5f55('0x7a')]['split'](',');var _0x3dbd34={};_0x3dbd34[_0xf4ef35[0x0]]={'$gte':moment(_0xf4ef35[0x1])[_0x5f55('0xc0')](_0x5f55('0xc1'))};_0x33d383[_0x5f55('0x47')]=_['merge'](_0x33d383[_0x5f55('0x47')],_0x3dbd34);}_0x33d383=_[_0x5f55('0x9d')]({},_0x33d383,_0x13cc3f[_0x5f55('0xc2')]);return db['WhatsappMessage']['count']({'where':_0x33d383['where']})[_0x5f55('0x28')](function(_0x101a81){_0x4cac8a[_0x5f55('0x24')]=_0x101a81;if(_0x13cc3f['query']['includeAll']){_0x33d383['include']=[{'all':!![]}];}return db[_0x5f55('0xbb')]['findAll'](_0x33d383);})['then'](function(_0x2e3d4a){_0x4cac8a[_0x5f55('0xb2')]=_0x2e3d4a;return _0x4cac8a;});}})[_0x5f55('0x28')](respondWithFilteredResult(_0x2d596d,_0x33d383))[_0x5f55('0xb8')](handleError(_0x2d596d,null));};exports['addTags']=function(_0x4c10f6,_0x2fa537,_0x32cc56){return db[_0x5f55('0x36')][_0x5f55('0x67')]({'where':{'id':_0x4c10f6[_0x5f55('0xb4')]['id']}})[_0x5f55('0x28')](handleEntityNotFound(_0x2fa537,null))['then'](function(_0x537151){if(_0x537151){return _0x537151[_0x5f55('0xc3')](_0x4c10f6[_0x5f55('0x71')][_0x5f55('0xbd')],_[_0x5f55('0xbe')](_0x4c10f6[_0x5f55('0x71')],[_0x5f55('0xbd'),'id'])||{})[_0x5f55('0xc4')](function(){return db[_0x5f55('0x6c')][_0x5f55('0xc5')]({'attributes':['id',_0x5f55('0x2b'),_0x5f55('0x4b')],'where':{'id':_0x4c10f6['body']['ids']}});})[_0x5f55('0x28')](function(_0x1db022){socket[_0x5f55('0xc6')]('whatsappInteractionTags:save',{'id':Number(_0x4c10f6['params']['id']),'tags':_0x1db022||[]});return{'id':Number(_0x4c10f6['params']['id']),'tags':_0x1db022||[]};});}})['then'](respondWithResult(_0x2fa537,null))[_0x5f55('0xb8')](handleError(_0x2fa537,null));};exports['removeTags']=function(_0x547837,_0x1a5750,_0x3913b8){return db[_0x5f55('0x36')]['find']({'where':{'id':_0x547837[_0x5f55('0xb4')]['id']}})[_0x5f55('0x28')](handleEntityNotFound(_0x1a5750,null))[_0x5f55('0x28')](function(_0x51d42a){if(_0x51d42a){return _0x51d42a['removeTags'](_0x547837['query'][_0x5f55('0xbd')]);}})[_0x5f55('0x28')](respondWithStatusCode(_0x1a5750,null))[_0x5f55('0xb8')](handleError(_0x1a5750,null));};exports[_0x5f55('0xc7')]=function(_0x4f854f,_0x53247f){var _0x52dcad=moment()['unix']()[_0x5f55('0x9b')]();var _0x6c861=path[_0x5f55('0xc8')](config[_0x5f55('0xc9')],'server',_0x5f55('0xca'),_0x5f55('0xcb'));var _0x325719=path[_0x5f55('0xc8')](config[_0x5f55('0xc9')],_0x5f55('0xcc'),_0x5f55('0xca'),_0x5f55('0xcd'));var _0x11381d=path['join'](_0x6c861,_0x52dcad);var _0x3468b1=util[_0x5f55('0xc0')]('transcript-%d-%s.zip',_0x4f854f[_0x5f55('0xb4')]['id'],_0x52dcad);var _0x571ca7=path[_0x5f55('0xc8')](_0x6c861,_0x3468b1);var _0x377e4b=[];_0x377e4b['push']({'model':db['User'],'as':_0x5f55('0x6e'),'attributes':['id','fullname'],'raw':!![]});_0x377e4b[_0x5f55('0x34')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x5f55('0xce'),'lastName'],'raw':!![]});if(_0x4f854f[_0x5f55('0x3c')][_0x5f55('0xcd')]){_0x377e4b[_0x5f55('0x34')]({'model':db[_0x5f55('0xcf')],'as':_0x5f55('0xcf'),'raw':!![]});}var _0x1ece1e=[{'model':db[_0x5f55('0xbb')],'as':_0x5f55('0xd0'),'attributes':['id',_0x5f55('0x71'),_0x5f55('0x78'),'direction','secret',_0x5f55('0x80')],'include':_0x377e4b}];_0x1ece1e[_0x5f55('0x34')]({'model':db['WhatsappAccount'],'as':_0x5f55('0xd1'),'attributes':['id',_0x5f55('0x2b')]});_0x1ece1e[_0x5f55('0x34')]({'model':db[_0x5f55('0x6e')],'as':_0x5f55('0xd2'),'attributes':['id',_0x5f55('0x2f')]});return db['WhatsappInteraction'][_0x5f55('0x67')]({'where':{'id':_0x4f854f[_0x5f55('0xb4')]['id']},'include':_0x1ece1e})[_0x5f55('0x28')](handleEntityNotFound(_0x53247f,null))[_0x5f55('0x28')](function(_0x3234fa){if(_0x3234fa){var _0x700f71=_0x3234fa[_0x5f55('0xd3')]({'plain':!![]});fs[_0x5f55('0xd4')](_0x11381d);var _0x30b0ea={'channel':'Whatsapp','account':_0x700f71['Account'][_0x5f55('0x2b')],'agent':_0x700f71[_0x5f55('0xd2')]?_0x700f71['Owner'][_0x5f55('0x2f')]:_0x5f55('0xd5'),'createdAt':moment(_0x700f71[_0x5f55('0x78')])['format'](_0x5f55('0xc1'))[_0x5f55('0x9b')](),'closedAt':_0x700f71[_0x5f55('0xd6')]?moment(_0x700f71[_0x5f55('0xd7')])[_0x5f55('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x700f71[_0x5f55('0xd8')],'messages':_(_0x700f71[_0x5f55('0xd0')])['filter']({'secret':![]})[_0x5f55('0x2e')](function(_0x4bb419){if(_0x4bb419[_0x5f55('0xcf')]){var _0x4990e7=path['join'](_0x325719,_0x4bb419[_0x5f55('0xcf')][_0x5f55('0xd9')]);if(fs[_0x5f55('0xda')](_0x4990e7)){fs[_0x5f55('0xdb')](_0x4990e7)[_0x5f55('0xdc')](fs[_0x5f55('0xdd')](path[_0x5f55('0xc8')](_0x11381d,_0x4bb419[_0x5f55('0xcf')]['basename'])));}}return{'date':moment(_0x4bb419['createdAt'])['format'](_0x5f55('0xc1'))[_0x5f55('0x9b')](),'sender':_0x4bb419[_0x5f55('0xde')]==='out'?_0x4bb419[_0x5f55('0x6e')]?_0x4bb419['User'][_0x5f55('0x2f')]:_0x5f55('0xdf'):_0x4bb419[_0x5f55('0x61')][_0x5f55('0xce')]+(_0x4bb419['Contact'][_0x5f55('0xe0')]?'\x20'+_0x4bb419[_0x5f55('0x61')][_0x5f55('0xe0')]:''),'body':_0x4bb419['Attachment']?_0x4bb419[_0x5f55('0xcf')][_0x5f55('0xd9')]:_0x4bb419[_0x5f55('0x71')],'direction':_0x4bb419[_0x5f55('0xde')]===_0x5f55('0xe1')?'A':'C','secret':_0x4bb419[_0x5f55('0xe2')],'read':_0x4bb419['read'],'attachment':_0x4bb419[_0x5f55('0xcf')]};})['value']()};return ejs[_0x5f55('0xe3')](path[_0x5f55('0xc8')](config[_0x5f55('0xc9')],_0x5f55('0xcc'),_0x5f55('0xe4'),_0x5f55('0xe5')),{'interaction':_0x30b0ea})[_0x5f55('0x28')](function(_0x51d76f){var _0x59f1b9=path[_0x5f55('0xc8')](_0x11381d,_0x5f55('0xe6')+_0x700f71['id']+'-'+_0x52dcad+_0x5f55('0xe7'));var _0x43b44d={'path':_0x59f1b9,'channel':_0x5f55('0xe8'),'interactionId':_0x700f71['id']};return pdf['createPdfFromHTML'](_0x51d76f,_0x43b44d);})['then'](function(){return new BPromise(function(_0x99c22b,_0x954382){zipdir(_0x11381d,{'saveTo':_0x571ca7},function(_0x3248fa,_0x4b0651){if(_0x3248fa)return _0x954382(_0x3248fa);return _0x99c22b(_0x4b0651);});})[_0x5f55('0x28')](function(){return new BPromise(function(_0xe9ac9b,_0x4ddd7d){rimraf(_0x11381d,function(_0x2139aa){if(_0x2139aa)_0x4ddd7d(_0x2139aa);return _0xe9ac9b();});});})[_0x5f55('0x28')](function(){return _0x53247f[_0x5f55('0xc7')](_0x571ca7,_0x3468b1,function(_0x15cafc){if(_0x15cafc){console[_0x5f55('0xe9')](_0x5f55('0xea'),_0x15cafc);}else{fs[_0x5f55('0xeb')](_0x571ca7);}});});});}else{return _0x53247f['sendStatus'](0xc8);}})['catch'](handleError(_0x53247f,null));}; \ No newline at end of file +var _0xb377=['undefined','count','set','Content-Range','reject','destroy','then','end','error','name','send','Users','map','TagIds','Tags','split','push','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','field','color','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','keys','some','compact','isEmpty','WhatsappAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','keyBy','unreadMessages','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','all','show','includeAll','include','merge','options','create','catch','update','params','describe','addMessage','WhatsappMessage','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','ids','omit','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','server','tmp','join','root','files','attachments','format','fullname','CmContact','firstName','direction','secret','WhatsappAccount','Owner','mkdirSync','N.A.','closed','disposition','Messages','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','offset'];(function(_0x21f992,_0x4f3714){var _0x3b4e84=function(_0x27e621){while(--_0x27e621){_0x21f992['push'](_0x21f992['shift']());}};_0x3b4e84(++_0x4f3714);}(_0xb377,0x1b6));var _0x7b37=function(_0x49fc92,_0xf8005a){_0x49fc92=_0x49fc92-0x0;var _0x34ddd6=_0xb377[_0x49fc92];return _0x34ddd6;};'use strict';var emlformat=require(_0x7b37('0x0'));var rimraf=require(_0x7b37('0x1'));var zipdir=require(_0x7b37('0x2'));var jsonpatch=require(_0x7b37('0x3'));var rp=require(_0x7b37('0x4'));var moment=require(_0x7b37('0x5'));var BPromise=require(_0x7b37('0x6'));var Mustache=require(_0x7b37('0x7'));var util=require(_0x7b37('0x8'));var path=require(_0x7b37('0x9'));var sox=require(_0x7b37('0xa'));var csv=require(_0x7b37('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b37('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7b37('0xd'));var deskjs=require(_0x7b37('0xe'));var toCsv=require(_0x7b37('0xb'));var querystring=require(_0x7b37('0xf'));var Papa=require(_0x7b37('0x10'));var Redis=require(_0x7b37('0x11'));var authService=require(_0x7b37('0x12'));var qs=require(_0x7b37('0x13'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x7b37('0x14'));var hardwareService=require(_0x7b37('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x7b37('0x16'));var config=require(_0x7b37('0x17'));var licenseUtil=require(_0x7b37('0x18'));var db=require(_0x7b37('0x19'))['db'];config[_0x7b37('0x1a')]=_[_0x7b37('0x1b')](config[_0x7b37('0x1a')],{'host':_0x7b37('0x1c'),'port':0x18eb});var socket=require(_0x7b37('0x1d'))(new Redis(config[_0x7b37('0x1a')]));require(_0x7b37('0x1e'))[_0x7b37('0x1f')](socket);function respondWithStatusCode(_0x35a61f,_0x330ee2){_0x330ee2=_0x330ee2||0xcc;return function(_0xbfdc78){if(_0xbfdc78){return _0x35a61f[_0x7b37('0x20')](_0x330ee2);}return _0x35a61f[_0x7b37('0x21')](_0x330ee2)['end']();};}function respondWithResult(_0x537c83,_0x176a4f){_0x176a4f=_0x176a4f||0xc8;return function(_0x5b06f9){if(_0x5b06f9){return _0x537c83['status'](_0x176a4f)[_0x7b37('0x22')](_0x5b06f9);}};}function respondWithFilteredResult(_0x5a64fb,_0x1447aa){return function(_0x487f5c){if(_0x487f5c){var _0x29a9dd=typeof _0x1447aa[_0x7b37('0x23')]===_0x7b37('0x24')&&typeof _0x1447aa['limit']==='undefined';var _0x6905bb=_0x487f5c[_0x7b37('0x25')];var _0x3f3bbb=_0x29a9dd?0x0:_0x1447aa[_0x7b37('0x23')];var _0x30bf66=_0x29a9dd?_0x487f5c['count']:_0x1447aa['offset']+_0x1447aa['limit'];var _0x436d15;if(_0x30bf66>=_0x6905bb){_0x30bf66=_0x6905bb;_0x436d15=0xc8;}else{_0x436d15=0xce;}_0x5a64fb[_0x7b37('0x21')](_0x436d15);return _0x5a64fb[_0x7b37('0x26')](_0x7b37('0x27'),_0x3f3bbb+'-'+_0x30bf66+'/'+_0x6905bb)[_0x7b37('0x22')](_0x487f5c);}return null;};}function patchUpdates(_0x3059d8){return function(_0x11af8e){try{jsonpatch['apply'](_0x11af8e,_0x3059d8,!![]);}catch(_0x4066ea){return BPromise[_0x7b37('0x28')](_0x4066ea);}return _0x11af8e['save']();};}function saveUpdates(_0x239cfc,_0x4f03a2){return function(_0x1d9645){if(_0x1d9645){return _0x1d9645['update'](_0x239cfc)['then'](function(_0x2e3678){return _0x2e3678;});}return null;};}function removeEntity(_0x337759,_0x42d1d7){return function(_0x94ecb2){if(_0x94ecb2){return _0x94ecb2[_0x7b37('0x29')]()[_0x7b37('0x2a')](function(){_0x337759['status'](0xcc)[_0x7b37('0x2b')]();});}};}function handleEntityNotFound(_0xdc5403,_0x8df2fc){return function(_0x3d0cc1){if(!_0x3d0cc1){_0xdc5403[_0x7b37('0x20')](0x194);}return _0x3d0cc1;};}function handleError(_0x1e0433,_0x46810f){_0x46810f=_0x46810f||0x1f4;return function(_0x2bfdd1){logger[_0x7b37('0x2c')](_0x2bfdd1['stack']);if(_0x2bfdd1[_0x7b37('0x2d')]){delete _0x2bfdd1[_0x7b37('0x2d')];}_0x1e0433[_0x7b37('0x21')](_0x46810f)[_0x7b37('0x2e')](_0x2bfdd1);};}function getInteractionUsers(_0x50ac54,_0x2949c6){return new BPromise(function(_0x3282b9,_0x9c4451){try{if(_0x2949c6[_0x50ac54['id']]){_0x50ac54[_0x7b37('0x2f')]=_[_0x7b37('0x30')](_0x2949c6[_0x50ac54['id']],function(_0x3a60c5){return{'id':_0x3a60c5['id'],'fullname':_0x3a60c5['fullname']};});}}catch(_0x29ec63){_0x9c4451(_0x29ec63);}_0x3282b9(_0x50ac54);});}function getInteractionTags(_0x4a1def,_0x2cec69){return new BPromise(function(_0x5df623,_0x1844a9){try{if(_0x4a1def[_0x7b37('0x31')]){_0x4a1def[_0x7b37('0x32')]=[];_0x4a1def['TagIds'][_0x7b37('0x33')](',')['forEach'](function(_0x58cb03){_0x4a1def[_0x7b37('0x32')][_0x7b37('0x34')](_0x2cec69[_0x58cb03]);});}delete _0x4a1def['TagIds'];}catch(_0x1fde0c){_0x1844a9(_0x1fde0c);}_0x5df623(_0x4a1def);});}function updateWhatsappInteraction(_0x2abbdd,_0x4b29b7,_0x479052){return new BPromise(function(_0x234cbc,_0x4ad051){return getInteractionUsers(_0x2abbdd,_0x479052)['then'](function(_0x5a36eb){return getInteractionTags(_0x5a36eb,_0x4b29b7);})[_0x7b37('0x2a')](function(_0x562f69){_0x234cbc(_0x562f69);})['catch'](function(_0x153e83){_0x4ad051(_0x153e83);});});}exports[_0x7b37('0x35')]=function(_0x2bc27,_0x226e42){var _0x18ec5e={},_0x470d68={},_0x139910={'count':0x0,'rows':[]};var _0x4e0b6d=_[_0x7b37('0x30')](db[_0x7b37('0x36')][_0x7b37('0x37')],function(_0x2dd21e){return{'name':_0x2dd21e[_0x7b37('0x38')],'type':_0x2dd21e[_0x7b37('0x39')][_0x7b37('0x3a')]};});_0x470d68[_0x7b37('0x3b')]=_['map'](_0x4e0b6d,_0x7b37('0x2d'));_0x470d68[_0x7b37('0x3c')]=_['keys'](_0x2bc27[_0x7b37('0x3c')]);_0x470d68[_0x7b37('0x3d')]=_[_0x7b37('0x3e')](_0x470d68[_0x7b37('0x3b')],_0x470d68[_0x7b37('0x3c')]);_0x18ec5e[_0x7b37('0x3f')]=_[_0x7b37('0x3e')](_0x470d68[_0x7b37('0x3b')],qs[_0x7b37('0x40')](_0x2bc27[_0x7b37('0x3c')]['fields']));_0x18ec5e[_0x7b37('0x3f')]=_0x18ec5e[_0x7b37('0x3f')][_0x7b37('0x41')]?_0x18ec5e[_0x7b37('0x3f')]:_0x470d68[_0x7b37('0x3b')];if(!_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x42')](_0x7b37('0x43'))){_0x18ec5e['limit']=qs['limit'](_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x44')]);_0x18ec5e[_0x7b37('0x23')]=qs[_0x7b37('0x23')](_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x23')]);}_0x18ec5e[_0x7b37('0x45')]=qs[_0x7b37('0x46')](_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x46')]);_0x18ec5e[_0x7b37('0x47')]=qs['filters'](_['pick'](_0x2bc27[_0x7b37('0x3c')],_0x470d68['filters']),_0x4e0b6d);var _0x4297d6=[];var _0x2e708e=squel['select']()['field']('id')[_0x7b37('0x48')](_0x7b37('0x2d'))['field'](_0x7b37('0x49'))['from'](_0x7b37('0x4a'));var _0x14360b=squel[_0x7b37('0x4b')]()[_0x7b37('0x48')](_0x7b37('0x4c'))[_0x7b37('0x48')](_0x7b37('0x4d'))[_0x7b37('0x48')](_0x7b37('0x4e'))[_0x7b37('0x4f')](_0x7b37('0x50'),'ui')[_0x7b37('0x51')](_0x7b37('0x52'),'u',_0x7b37('0x53'));var _0x552779=squel['select']()[_0x7b37('0x4f')](_0x7b37('0x54'),'i')[_0x7b37('0x51')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x7b37('0x51')](_0x7b37('0x52'),'o',_0x7b37('0x55'))[_0x7b37('0x51')](_0x7b37('0x56'),'a',_0x7b37('0x57'))[_0x7b37('0x51')](_0x7b37('0x58'),'me',_0x7b37('0x59'))['left_join']('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0x7b37('0x51')]('tools_tags','t',_0x7b37('0x5a'));var _0x1b57b4=squel[_0x7b37('0x5b')]();var _0x3f365a=[];var _0x4defaa=squel[_0x7b37('0x5b')]();var _0x21c400;if(_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x5c')]){_0x21c400=as['parseSearch'](_0x2bc27['query'][_0x7b37('0x5c')]);var _0x290775=_0x21c400['sqlOperator'];for(var _0x2046ce=0x0;_0x2046ce<_0x21c400[_0x7b37('0x5d')]['length'];_0x2046ce++){var _0x203c91=_0x21c400[_0x7b37('0x5d')][_0x2046ce];var _0x3f9fb1='i';var _0x4f79c3=_['find'](_0x4e0b6d,[_0x7b37('0x2d'),_0x203c91[_0x7b37('0x48')]]);if(!_0x4f79c3){switch(_0x203c91[_0x7b37('0x48')]){case'unreadMessages':if(_0x203c91[_0x7b37('0x5e')]==0x1){_0x552779[_0x7b37('0x5f')]('`'+_0x203c91[_0x7b37('0x48')]+_0x7b37('0x60'));}else{_0x552779[_0x7b37('0x5f')]('`'+_0x203c91['field']+'`\x20>\x200');}break;case _0x7b37('0x61'):if(_0x203c91[_0x7b37('0x62')]===_0x7b37('0x63')){if(_0x203c91['value'][_0x7b37('0x33')]('\x20')['length']>0x1){_0x1b57b4[_0x290775](_0x7b37('0x64'),qs[_0x7b37('0x65')](_0x203c91[_0x7b37('0x5e')]),null);}else{var _0x31af15='%'+_0x203c91[_0x7b37('0x5e')]+'%';_0x1b57b4[_0x290775]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x31af15,_0x31af15,_0x31af15);}}else{_0x4f79c3=_[_0x7b37('0x66')](_0x4e0b6d,[_0x7b37('0x2d'),_0x7b37('0x67')]);_0x203c91[_0x7b37('0x48')]='ContactId';_0x5e386c=as['buildExpression'](_0x3f9fb1,_0x4f79c3[_0x7b37('0x39')],_0x203c91);_0x1b57b4[_0x290775](_0x5e386c[_0x7b37('0x68')],_0x5e386c[_0x7b37('0x5e')][_0x7b37('0x69')],_0x5e386c['value']['end']);}break;case _0x7b37('0x6a'):var _0x45429b=_0x203c91['value'][_0x7b37('0x33')](',')[_0x7b37('0x30')](function(_0x3b13d2){return Number(_0x3b13d2);});_0x45429b[_0x7b37('0x6b')](function(_0x3a4335){_0x4defaa['or'](_0x7b37('0x6c'),'%,'+_0x3a4335+',%');});_0x3f365a=_['union'](_0x3f365a,_0x45429b);break;case _0x7b37('0x6d'):if(_0x203c91[_0x7b37('0x62')]===_0x7b37('0x63')){_0x1b57b4[_0x290775](_0x7b37('0x6e'),'%'+_0x203c91[_0x7b37('0x5e')]+'%',null);}else{_0x4f79c3=_[_0x7b37('0x66')](_0x4e0b6d,[_0x7b37('0x2d'),_0x7b37('0x6f')]);_0x203c91[_0x7b37('0x48')]=_0x7b37('0x6f');_0x5e386c=as[_0x7b37('0x70')](_0x3f9fb1,_0x4f79c3[_0x7b37('0x39')],_0x203c91);_0x1b57b4[_0x290775](_0x5e386c[_0x7b37('0x68')],_0x5e386c[_0x7b37('0x5e')]['start'],_0x5e386c[_0x7b37('0x5e')]['end']);}break;case _0x7b37('0x71'):_0x5e386c=as[_0x7b37('0x70')]('me',null,_0x203c91);_0x1b57b4[_0x290775](_0x5e386c[_0x7b37('0x68')],_0x5e386c[_0x7b37('0x5e')][_0x7b37('0x69')],_0x5e386c[_0x7b37('0x5e')][_0x7b37('0x2b')]);break;}}else{var _0x5e386c=as[_0x7b37('0x70')](_0x3f9fb1,_0x4f79c3[_0x7b37('0x39')],_0x203c91);_0x1b57b4[_0x290775](_0x5e386c[_0x7b37('0x68')],_0x5e386c[_0x7b37('0x5e')][_0x7b37('0x69')],_0x5e386c[_0x7b37('0x5e')][_0x7b37('0x2b')]);}}}else{var _0x484aad=_(_0x2bc27[_0x7b37('0x3c')])[_0x7b37('0x72')]()[_0x7b37('0x30')](function(_0x10150a){return _[_0x7b37('0x73')](_0x4e0b6d,[_0x7b37('0x2d'),_0x10150a])?_0x10150a:undefined;})[_0x7b37('0x74')]()['value']();if(!_[_0x7b37('0x75')](_0x484aad)){_0x484aad[_0x7b37('0x6b')](function(_0x42e239){if(_0x42e239===_0x7b37('0x76')){_0x552779[_0x7b37('0x47')]('i.WhatsappAccountId\x20IN\x20?',[][_0x7b37('0x77')](_0x2bc27[_0x7b37('0x3c')][_0x42e239]));}else if(_0x42e239===_0x7b37('0x78')){var _0x497f90=JSON[_0x7b37('0x79')](_0x2bc27[_0x7b37('0x3c')][_0x42e239])[_0x7b37('0x7a')];var _0x2fd9fa=JSON['parse'](_0x2bc27[_0x7b37('0x3c')][_0x42e239])[_0x7b37('0x7b')];_0x552779[_0x7b37('0x47')](_0x7b37('0x7c'),_0x497f90,_0x2fd9fa);}else{if(_0x2bc27['query'][_0x42e239]===_0x7b37('0x7d')){_0x552779[_0x7b37('0x47')]('i.'+_0x42e239+_0x7b37('0x7e'));}else{_0x552779[_0x7b37('0x47')]('i.'+_0x42e239+'\x20=\x20?',_0x2bc27[_0x7b37('0x3c')][_0x42e239]);}}});}if(_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x7f')]){if(_0x2bc27[_0x7b37('0x3c')]['read']==0x1){_0x552779[_0x7b37('0x5f')](_0x7b37('0x80'));}else{_0x552779['having']('`unreadMessages`\x20>\x200');}}if(_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x81')]){_0x3f365a=_[_0x7b37('0x82')](_0x2bc27['query'][_0x7b37('0x81')])?_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x81')]:new Array(_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x81')]);_0x3f365a[_0x7b37('0x6b')](function(_0x2555fd){_0x4defaa['or'](_0x7b37('0x6c'),'%,'+_0x2555fd+',%');});}if(_0x2bc27['query'][_0x7b37('0x83')]){var _0x120387=_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x83')][_0x7b37('0x84')]('\x5c','\x5c\x5c')[_0x7b37('0x84')](/'/g,'\x27\x27');if(qs[_0x7b37('0x85')](_0x120387)){_0x1b57b4['or'](_0x7b37('0x86'),_0x120387+'%')['or'](_0x7b37('0x87'),_0x120387+'%');}else{_0x1b57b4['or'](_0x7b37('0x88'),qs[_0x7b37('0x65')](_0x120387))['or'](_0x7b37('0x89'),_0x120387+'%');}}}_0x552779[_0x7b37('0x47')](_0x1b57b4);_0x552779[_0x7b37('0x8a')](_0x7b37('0x8b'));var _0x24523b={'type':db[_0x7b37('0x8c')]['QueryTypes']['SELECT'],'raw':!![]};var _0x40f41b=_0x552779[_0x7b37('0x8d')]();_0x40f41b[_0x7b37('0x48')](_0x7b37('0x8b'));_0x40f41b[_0x7b37('0x48')](_0x7b37('0x8e'),'unreadMessages');if(_0x18ec5e[_0x7b37('0x45')]){_0x18ec5e[_0x7b37('0x45')][_0x7b37('0x6b')](function(_0x3a587a){var _0x1148fe=_0x3a587a[0x0]==='contactName'?_0x3a587a[0x0]:'i.'+_0x3a587a[0x0];_0x552779[_0x7b37('0x45')](_0x1148fe,_0x3a587a[0x1]==='DESC'?![]:!![]);});}if(!_[_0x7b37('0x75')](_0x3f365a)){_0x552779[_0x7b37('0x5f')](_0x4defaa);_0x40f41b['where'](_0x7b37('0x8f'),_0x3f365a);}BPromise['resolve']()[_0x7b37('0x2a')](function(){if(!_0x21c400){if(_0x2bc27['query'][_0x7b37('0x76')])return;_0x40f41b[_0x7b37('0x47')](_0x7b37('0x90'));_0x552779[_0x7b37('0x47')](_0x7b37('0x90'));return;}if(_0x2bc27[_0x7b37('0x91')][_0x7b37('0x92')]!==_0x7b37('0x93'))return;return _0x2bc27['user'][_0x7b37('0x94')]({'attributes':['id'],'raw':!![]})[_0x7b37('0x2a')](function(_0x1f8f7e){if(_[_0x7b37('0x75')](_0x1f8f7e)){_0x40f41b[_0x7b37('0x47')]('i.WhatsappAccountId\x20IS\x20NULL');_0x552779[_0x7b37('0x47')](_0x7b37('0x95'));}else{_0x40f41b['where'](_0x7b37('0x96'),_[_0x7b37('0x30')](_0x1f8f7e,'id'));_0x552779[_0x7b37('0x47')](_0x7b37('0x96'),_['map'](_0x1f8f7e,'id'));}});})['then'](function(){if(_0x2bc27[_0x7b37('0x91')][_0x7b37('0x92')]===_0x7b37('0x93')&&!_0x21c400&&!_0x2bc27['query'][_0x7b37('0x76')])return[];return db[_0x7b37('0x97')][_0x7b37('0x3c')](_0x40f41b['toString'](),_0x24523b);})['then'](function(_0x25e17f){_0x139910[_0x7b37('0x25')]=_0x25e17f['length'];if(_0x139910[_0x7b37('0x25')]===0x0)return[];return db[_0x7b37('0x97')]['query'](_0x2e708e['toString'](),_0x24523b)[_0x7b37('0x2a')](function(_0x416407){_0x4297d6=_[_0x7b37('0x98')](_0x416407,'id');_0x24523b=_['merge'](_0x24523b,{'model':db[_0x7b37('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x40')]){_0x18ec5e[_0x7b37('0x3f')][_0x7b37('0x6b')](function(_0x5931b2){_0x552779['field']('i.'+_0x5931b2);});}else{_0x552779[_0x7b37('0x48')](_0x7b37('0x8e'),_0x7b37('0x99'));_0x552779[_0x7b37('0x48')]('a.key',_0x7b37('0x9a'));_0x552779[_0x7b37('0x48')]('a.mandatoryDisposition',_0x7b37('0x9b'));_0x552779[_0x7b37('0x48')](_0x7b37('0x9c'),_0x7b37('0x9d'));_0x552779[_0x7b37('0x48')](_0x7b37('0x9e'));_0x552779['field']('c.firstName','Contact.firstName');_0x552779[_0x7b37('0x48')](_0x7b37('0x9f'),'Contact.lastName');_0x552779[_0x7b37('0x48')](_0x7b37('0xa0'),'Contact.email');_0x552779['field'](_0x7b37('0xa1'),_0x7b37('0xa2'));_0x552779['field'](_0x7b37('0xa3'),_0x7b37('0xa4'));_0x552779[_0x7b37('0x48')]('c.fax',_0x7b37('0xa5'));_0x552779[_0x7b37('0x48')](_0x7b37('0xa6'),_0x7b37('0xa7'));_0x552779[_0x7b37('0x48')]('o.internal','Owner.internal');_0x552779['field'](_0x7b37('0xa8'),_0x7b37('0x31'));}if(_0x18ec5e[_0x7b37('0x44')])_0x552779[_0x7b37('0x44')](_0x18ec5e[_0x7b37('0x44')]);if(_0x18ec5e['offset'])_0x552779['offset'](_0x18ec5e[_0x7b37('0x23')]);return db[_0x7b37('0x97')][_0x7b37('0x3c')](_0x552779[_0x7b37('0xa9')](),_0x24523b);})['then'](function(_0x55508d){if(_0x55508d[_0x7b37('0x41')]>0x0)_0x14360b[_0x7b37('0x47')](_0x7b37('0xaa'),_[_0x7b37('0x30')](_0x55508d,'id'));return db[_0x7b37('0x97')]['query'](_0x14360b[_0x7b37('0xa9')](),_0x24523b)[_0x7b37('0x2a')](function(_0x531fb1){var _0x50cc3f=_['groupBy'](_0x531fb1,_0x7b37('0xab'));var _0x2ab3f9=[];_0x55508d[_0x7b37('0x6b')](function(_0x5c85d9){_0x2ab3f9['push'](updateWhatsappInteraction(_0x5c85d9,_0x4297d6,_0x50cc3f));});return BPromise[_0x7b37('0xac')](_0x2ab3f9);});});})[_0x7b37('0x2a')](function(_0x21ba13){_0x139910['rows']=_0x21ba13;return _0x139910;})[_0x7b37('0x2a')](respondWithFilteredResult(_0x226e42,_0x18ec5e))['catch'](handleError(_0x226e42,null));};exports[_0x7b37('0xad')]=function(_0x30e341,_0x325804){var _0xeb6e9b={'raw':![],'where':{'id':_0x30e341['params']['id']}},_0x239221={};_0x239221[_0x7b37('0x3b')]=_['keys'](db[_0x7b37('0x36')][_0x7b37('0x37')]);_0x239221[_0x7b37('0x3c')]=_['keys'](_0x30e341[_0x7b37('0x3c')]);_0x239221[_0x7b37('0x3d')]=_['intersection'](_0x239221[_0x7b37('0x3b')],_0x239221[_0x7b37('0x3c')]);_0xeb6e9b[_0x7b37('0x3f')]=_['intersection'](_0x239221[_0x7b37('0x3b')],qs[_0x7b37('0x40')](_0x30e341[_0x7b37('0x3c')][_0x7b37('0x40')]));_0xeb6e9b[_0x7b37('0x3f')]=_0xeb6e9b[_0x7b37('0x3f')]['length']?_0xeb6e9b[_0x7b37('0x3f')]:_0x239221['model'];if(_0x30e341[_0x7b37('0x3c')][_0x7b37('0xae')]){_0xeb6e9b[_0x7b37('0xaf')]=[{'all':!![]}];}_0xeb6e9b=_[_0x7b37('0xb0')]({},_0xeb6e9b,_0x30e341[_0x7b37('0xb1')]);return db['WhatsappInteraction']['find'](_0xeb6e9b)['then'](handleEntityNotFound(_0x325804,null))[_0x7b37('0x2a')](respondWithResult(_0x325804,null))['catch'](handleError(_0x325804,null));};exports['create']=function(_0x1de1da,_0x25c3d6){return db[_0x7b37('0x36')][_0x7b37('0xb2')](_0x1de1da['body'],{})[_0x7b37('0x2a')](respondWithResult(_0x25c3d6,0xc9))[_0x7b37('0xb3')](handleError(_0x25c3d6,null));};exports[_0x7b37('0xb4')]=function(_0x23fa8c,_0x4245d8){if(_0x23fa8c[_0x7b37('0x71')]['id']){delete _0x23fa8c[_0x7b37('0x71')]['id'];}return db[_0x7b37('0x36')][_0x7b37('0x66')]({'where':{'id':_0x23fa8c[_0x7b37('0xb5')]['id']}})[_0x7b37('0x2a')](handleEntityNotFound(_0x4245d8,null))[_0x7b37('0x2a')](saveUpdates(_0x23fa8c[_0x7b37('0x71')],null))[_0x7b37('0x2a')](respondWithResult(_0x4245d8,null))['catch'](handleError(_0x4245d8,null));};exports[_0x7b37('0x29')]=function(_0x60d3d,_0xcfcaff){return db[_0x7b37('0x36')]['find']({'where':{'id':_0x60d3d[_0x7b37('0xb5')]['id']}})['then'](handleEntityNotFound(_0xcfcaff,null))[_0x7b37('0x2a')](removeEntity(_0xcfcaff,null))[_0x7b37('0xb3')](handleError(_0xcfcaff,null));};exports[_0x7b37('0xb6')]=function(_0x3d7907,_0x3525b0){return db[_0x7b37('0x36')][_0x7b37('0xb6')]()[_0x7b37('0x2a')](respondWithResult(_0x3525b0,null))[_0x7b37('0xb3')](handleError(_0x3525b0,null));};exports[_0x7b37('0xb7')]=function(_0x35df31,_0x13094c,_0x376dfb){return db[_0x7b37('0xb8')][_0x7b37('0x66')]({'where':{'id':_0x35df31[_0x7b37('0xb5')]['id']}})[_0x7b37('0x2a')](handleEntityNotFound(_0x13094c,null))['then'](function(_0x3632e1){if(_0x3632e1){return _0x3632e1[_0x7b37('0xb7')](_0x35df31[_0x7b37('0x71')]['ids'],_['omit'](_0x35df31['body'],['ids','id'])||{});}})[_0x7b37('0x2a')](respondWithResult(_0x13094c,null))[_0x7b37('0xb3')](handleError(_0x13094c,null));};exports[_0x7b37('0xb9')]=function(_0x2dae4,_0x425072,_0x21a9aa){var _0x15d183={'raw':![],'where':{}};var _0x10e014={};var _0x44f054={'count':0x0,'rows':[]};return db[_0x7b37('0x36')]['findOne']({'where':{'id':_0x2dae4[_0x7b37('0xb5')]['id']}})['then'](handleEntityNotFound(_0x425072,null))[_0x7b37('0x2a')](function(_0x45727c){if(_0x45727c){_0x10e014[_0x7b37('0x3b')]=_[_0x7b37('0x72')](db[_0x7b37('0xb8')][_0x7b37('0x37')]);_0x10e014['query']=_['keys'](_0x2dae4[_0x7b37('0x3c')]);_0x10e014[_0x7b37('0x3d')]=_[_0x7b37('0x3e')](_0x10e014['model'],_0x10e014[_0x7b37('0x3c')]);_0x15d183[_0x7b37('0x3f')]=_[_0x7b37('0x3e')](_0x10e014[_0x7b37('0x3b')],qs['fields'](_0x2dae4[_0x7b37('0x3c')][_0x7b37('0x40')]));_0x15d183[_0x7b37('0x3f')]=_0x15d183['attributes'][_0x7b37('0x41')]?_0x15d183[_0x7b37('0x3f')]:_0x10e014[_0x7b37('0x3b')];if(!_0x2dae4[_0x7b37('0x3c')][_0x7b37('0x42')](_0x7b37('0x43'))){_0x15d183[_0x7b37('0x44')]=qs[_0x7b37('0x44')](_0x2dae4[_0x7b37('0x3c')]['limit']);_0x15d183[_0x7b37('0x23')]=qs[_0x7b37('0x23')](_0x2dae4['query'][_0x7b37('0x23')]);}_0x15d183[_0x7b37('0x45')]=qs[_0x7b37('0x46')](_0x2dae4['query'][_0x7b37('0x46')]);_0x15d183[_0x7b37('0x47')]=qs[_0x7b37('0x3d')](_['pick'](_0x2dae4[_0x7b37('0x3c')],_0x10e014[_0x7b37('0x3d')]));_0x15d183[_0x7b37('0x47')][_0x7b37('0xab')]=_0x45727c['id'];if(_0x2dae4['query'][_0x7b37('0x83')]){_0x15d183['where']=_[_0x7b37('0xb0')](_0x15d183['where'],{'$or':_['map'](_0x15d183[_0x7b37('0x3f')],function(_0x218cd5){var _0x49b9dc={};_0x49b9dc[_0x218cd5]={'$like':'%'+_0x2dae4['query'][_0x7b37('0x83')]+'%'};return _0x49b9dc;})});}if(_0x2dae4[_0x7b37('0x3c')]['$gte']){var _0x4ca3a2=_0x2dae4[_0x7b37('0x3c')][_0x7b37('0x7a')][_0x7b37('0x33')](',');var _0x2eda57={};_0x2eda57[_0x4ca3a2[0x0]]={'$gte':moment(_0x4ca3a2[0x1])['format'](_0x7b37('0xba'))};_0x15d183['where']=_[_0x7b37('0xb0')](_0x15d183[_0x7b37('0x47')],_0x2eda57);}_0x15d183=_[_0x7b37('0xb0')]({},_0x15d183,_0x2dae4[_0x7b37('0xb1')]);return db[_0x7b37('0xb8')]['count']({'where':_0x15d183[_0x7b37('0x47')]})['then'](function(_0x392678){_0x44f054['count']=_0x392678;if(_0x2dae4[_0x7b37('0x3c')][_0x7b37('0xae')]){_0x15d183[_0x7b37('0xaf')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x7b37('0xbb')](_0x15d183);})[_0x7b37('0x2a')](function(_0xc9ee95){_0x44f054[_0x7b37('0xbc')]=_0xc9ee95;return _0x44f054;});}})[_0x7b37('0x2a')](respondWithFilteredResult(_0x425072,_0x15d183))[_0x7b37('0xb3')](handleError(_0x425072,null));};exports[_0x7b37('0xbd')]=function(_0x44ac1a,_0x1ebc64,_0x3fbf69){return db[_0x7b37('0x36')][_0x7b37('0x66')]({'where':{'id':_0x44ac1a[_0x7b37('0xb5')]['id']}})['then'](handleEntityNotFound(_0x1ebc64,null))['then'](function(_0x2c04a0){if(_0x2c04a0){return _0x2c04a0[_0x7b37('0xbe')](_0x44ac1a[_0x7b37('0x71')][_0x7b37('0xbf')],_[_0x7b37('0xc0')](_0x44ac1a[_0x7b37('0x71')],[_0x7b37('0xbf'),'id'])||{})[_0x7b37('0xc1')](function(){return db[_0x7b37('0x6a')][_0x7b37('0xbb')]({'attributes':['id',_0x7b37('0x2d'),'color'],'where':{'id':_0x44ac1a[_0x7b37('0x71')][_0x7b37('0xbf')]}});})[_0x7b37('0x2a')](function(_0x3a562e){socket[_0x7b37('0xc2')](_0x7b37('0xc3'),{'id':Number(_0x44ac1a[_0x7b37('0xb5')]['id']),'tags':_0x3a562e||[]});return{'id':Number(_0x44ac1a[_0x7b37('0xb5')]['id']),'tags':_0x3a562e||[]};});}})[_0x7b37('0x2a')](respondWithResult(_0x1ebc64,null))[_0x7b37('0xb3')](handleError(_0x1ebc64,null));};exports[_0x7b37('0xc4')]=function(_0x4e5305,_0x24127b,_0x5d470e){return db['WhatsappInteraction'][_0x7b37('0x66')]({'where':{'id':_0x4e5305['params']['id']}})[_0x7b37('0x2a')](handleEntityNotFound(_0x24127b,null))[_0x7b37('0x2a')](function(_0x33c156){if(_0x33c156){return _0x33c156['removeTags'](_0x4e5305[_0x7b37('0x3c')][_0x7b37('0xbf')]);}})['then'](respondWithStatusCode(_0x24127b,null))[_0x7b37('0xb3')](handleError(_0x24127b,null));};exports[_0x7b37('0xc5')]=function(_0x4e7d33,_0x3a2ee6){var _0x126db3=moment()[_0x7b37('0xc6')]()[_0x7b37('0xa9')]();var _0xe7d931=path['join'](config['root'],_0x7b37('0xc7'),'files',_0x7b37('0xc8'));var _0x10b497=path[_0x7b37('0xc9')](config[_0x7b37('0xca')],_0x7b37('0xc7'),_0x7b37('0xcb'),_0x7b37('0xcc'));var _0x3a29df=path[_0x7b37('0xc9')](_0xe7d931,_0x126db3);var _0x2246dc=util[_0x7b37('0xcd')]('transcript-%d-%s.zip',_0x4e7d33[_0x7b37('0xb5')]['id'],_0x126db3);var _0x187255=path[_0x7b37('0xc9')](_0xe7d931,_0x2246dc);var _0x3cb0db=[];_0x3cb0db[_0x7b37('0x34')]({'model':db[_0x7b37('0x6d')],'as':_0x7b37('0x6d'),'attributes':['id',_0x7b37('0xce')],'raw':!![]});_0x3cb0db[_0x7b37('0x34')]({'model':db[_0x7b37('0xcf')],'as':'Contact','attributes':['id',_0x7b37('0xd0'),'lastName'],'raw':!![]});if(_0x4e7d33[_0x7b37('0x3c')][_0x7b37('0xcc')]){_0x3cb0db['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x4c8965=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x7b37('0x71'),_0x7b37('0x78'),_0x7b37('0xd1'),_0x7b37('0xd2'),_0x7b37('0x7f')],'include':_0x3cb0db}];_0x4c8965[_0x7b37('0x34')]({'model':db[_0x7b37('0xd3')],'as':'Account','attributes':['id',_0x7b37('0x2d')]});_0x4c8965[_0x7b37('0x34')]({'model':db[_0x7b37('0x6d')],'as':_0x7b37('0xd4'),'attributes':['id',_0x7b37('0xce')]});return db[_0x7b37('0x36')][_0x7b37('0x66')]({'where':{'id':_0x4e7d33[_0x7b37('0xb5')]['id']},'include':_0x4c8965})[_0x7b37('0x2a')](handleEntityNotFound(_0x3a2ee6,null))[_0x7b37('0x2a')](function(_0x128366){if(_0x128366){var _0x9f9b3a=_0x128366['get']({'plain':!![]});fs[_0x7b37('0xd5')](_0x3a29df);var _0x32d677={'channel':'Whatsapp','account':_0x9f9b3a['Account'][_0x7b37('0x2d')],'agent':_0x9f9b3a[_0x7b37('0xd4')]?_0x9f9b3a[_0x7b37('0xd4')][_0x7b37('0xce')]:_0x7b37('0xd6'),'createdAt':moment(_0x9f9b3a['createdAt'])[_0x7b37('0xcd')](_0x7b37('0xba'))['toString'](),'closedAt':_0x9f9b3a[_0x7b37('0xd7')]?moment(_0x9f9b3a['closedAt'])[_0x7b37('0xcd')](_0x7b37('0xba'))[_0x7b37('0xa9')]():'','disposition':_0x9f9b3a[_0x7b37('0xd8')],'messages':_(_0x9f9b3a[_0x7b37('0xd9')])[_0x7b37('0x83')]({'secret':![]})[_0x7b37('0x30')](function(_0x52ad72){if(_0x52ad72[_0x7b37('0xda')]){var _0x1d82e5=path[_0x7b37('0xc9')](_0x10b497,_0x52ad72['Attachment'][_0x7b37('0xdb')]);if(fs[_0x7b37('0xdc')](_0x1d82e5)){fs[_0x7b37('0xdd')](_0x1d82e5)[_0x7b37('0xde')](fs[_0x7b37('0xdf')](path[_0x7b37('0xc9')](_0x3a29df,_0x52ad72[_0x7b37('0xda')]['basename'])));}}return{'date':moment(_0x52ad72[_0x7b37('0x78')])[_0x7b37('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x52ad72['direction']===_0x7b37('0xe0')?_0x52ad72[_0x7b37('0x6d')]?_0x52ad72['User'][_0x7b37('0xce')]:_0x7b37('0xe1'):_0x52ad72[_0x7b37('0x61')][_0x7b37('0xd0')]+(_0x52ad72[_0x7b37('0x61')]['lastName']?'\x20'+_0x52ad72[_0x7b37('0x61')][_0x7b37('0xe2')]:''),'body':_0x52ad72[_0x7b37('0xda')]?_0x52ad72[_0x7b37('0xda')]['basename']:_0x52ad72[_0x7b37('0x71')],'direction':_0x52ad72[_0x7b37('0xd1')]===_0x7b37('0xe0')?'A':'C','secret':_0x52ad72[_0x7b37('0xd2')],'read':_0x52ad72[_0x7b37('0x7f')],'attachment':_0x52ad72[_0x7b37('0xda')]};})[_0x7b37('0x5e')]()};return ejs[_0x7b37('0xe3')](path[_0x7b37('0xc9')](config[_0x7b37('0xca')],_0x7b37('0xc7'),_0x7b37('0xe4'),_0x7b37('0xe5')),{'interaction':_0x32d677})[_0x7b37('0x2a')](function(_0x51bee5){var _0x5ce492=path[_0x7b37('0xc9')](_0x3a29df,_0x7b37('0xe6')+_0x9f9b3a['id']+'-'+_0x126db3+_0x7b37('0xe7'));var _0x35c0cb={'path':_0x5ce492,'channel':_0x7b37('0xe8'),'interactionId':_0x9f9b3a['id']};return pdf[_0x7b37('0xe9')](_0x51bee5,_0x35c0cb);})['then'](function(){return new BPromise(function(_0x425cc3,_0x179d99){zipdir(_0x3a29df,{'saveTo':_0x187255},function(_0x42ed99,_0x16eda7){if(_0x42ed99)return _0x179d99(_0x42ed99);return _0x425cc3(_0x16eda7);});})[_0x7b37('0x2a')](function(){return new BPromise(function(_0x27d766,_0x2d6be9){rimraf(_0x3a29df,function(_0x4c1659){if(_0x4c1659)_0x2d6be9(_0x4c1659);return _0x27d766();});});})[_0x7b37('0x2a')](function(){return _0x3a2ee6[_0x7b37('0xc5')](_0x187255,_0x2246dc,function(_0x591177){if(_0x591177){console[_0x7b37('0xea')](_0x7b37('0xeb'),_0x591177);}else{fs[_0x7b37('0xec')](_0x187255);}});});});}else{return _0x3a2ee6[_0x7b37('0x20')](0xc8);}})['catch'](handleError(_0x3a2ee6,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 63397c4..501541d 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 _0x6d4a=['update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','emit','hasOwnProperty','hook','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x5aa9b7,_0x17409b){var _0x5af464=function(_0x449636){while(--_0x449636){_0x5aa9b7['push'](_0x5aa9b7['shift']());}};_0x5af464(++_0x17409b);}(_0x6d4a,0x117));var _0xa6d4=function(_0x14a028,_0x59dd0a){_0x14a028=_0x14a028-0x0;var _0x141294=_0x6d4a[_0x14a028];return _0x141294;};'use strict';var EventEmitter=require(_0xa6d4('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xa6d4('0x1')];var WhatsappMessage=require(_0xa6d4('0x2'))['db'][_0xa6d4('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa6d4('0x4')](0x0);var events={'afterCreate':_0xa6d4('0x5'),'afterUpdate':_0xa6d4('0x6'),'afterDestroy':_0xa6d4('0x7')};function emitEvent(_0x422d77){return function(_0x91048f,_0x3a7c95,_0x25a720){_0x91048f[_0xa6d4('0x8')]({'attributes':['id'],'raw':!![]})[_0xa6d4('0x9')](function(_0x444bf9){_0x91048f['setDataValue'](_0xa6d4('0xa'),_0x444bf9[_0xa6d4('0xb')](function(_0x52739a){return{'id':_0x52739a['id']};}));return WhatsappMessage[_0xa6d4('0xc')]({'where':{'WhatsappInteractionId':_0x91048f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa6d4('0x9')](function(_0x2bea15){_0x91048f[_0xa6d4('0xd')](_0xa6d4('0xe'),_0x2bea15['length']);WhatsappInteractionEvents[_0xa6d4('0xf')](_0x422d77+':'+_0x91048f['id'],_0x91048f);WhatsappInteractionEvents[_0xa6d4('0xf')](_0x422d77,_0x91048f);_0x25a720(null);})['catch'](_0x25a720(null));};}for(var e in events){if(events[_0xa6d4('0x10')](e)){var event=events[e];WhatsappInteraction[_0xa6d4('0x11')](e,emitEvent(event));}}module[_0xa6d4('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x570f=['WhatsappInteraction','setMaxListeners','save','update','remove','getUsers','Users','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5ed068,_0x470a7c){var _0x141d2d=function(_0x32ce1a){while(--_0x32ce1a){_0x5ed068['push'](_0x5ed068['shift']());}};_0x141d2d(++_0x470a7c);}(_0x570f,0x152));var _0xf570=function(_0x2b89dc,_0x8bfa42){_0x2b89dc=_0x2b89dc-0x0;var _0x412762=_0x570f[_0x2b89dc];return _0x412762;};'use strict';var EventEmitter=require(_0xf570('0x0'));var WhatsappInteraction=require(_0xf570('0x1'))['db'][_0xf570('0x2')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf570('0x3')](0x0);var events={'afterCreate':_0xf570('0x4'),'afterUpdate':_0xf570('0x5'),'afterDestroy':_0xf570('0x6')};function emitEvent(_0x140bb4){return function(_0x1cb206,_0x5b8c89,_0x5ce063){_0x1cb206[_0xf570('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x37d1c8){_0x1cb206['setDataValue'](_0xf570('0x8'),_0x37d1c8['map'](function(_0x350a32){return{'id':_0x350a32['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x1cb206['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf570('0x9')](function(_0x375e35){_0x1cb206[_0xf570('0xa')](_0xf570('0xb'),_0x375e35[_0xf570('0xc')]);WhatsappInteractionEvents['emit'](_0x140bb4+':'+_0x1cb206['id'],_0x1cb206);WhatsappInteractionEvents[_0xf570('0xd')](_0x140bb4,_0x1cb206);_0x5ce063(null);})[_0xf570('0xe')](_0x5ce063(null));};}for(var e in events){if(events[_0xf570('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xf570('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 24bf5ce..e94d9eb 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 _0xc884=['api','moment','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0xc884,0x165));var _0x4c88=function(_0x416fca,_0x1f561e){_0x416fca=_0x416fca-0x0;var _0x8ba873=_0xc884[_0x416fca];return _0x8ba873;};'use strict';var _=require(_0x4c88('0x0'));var util=require(_0x4c88('0x1'));var logger=require(_0x4c88('0x2'))(_0x4c88('0x3'));var moment=require(_0x4c88('0x4'));var BPromise=require(_0x4c88('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c88('0x6'));var rimraf=require(_0x4c88('0x7'));var config=require(_0x4c88('0x8'));var attributes=require(_0x4c88('0x9'));module[_0x4c88('0xa')]=function(_0x1cf448,_0x5712f1){return _0x1cf448[_0x4c88('0xb')](_0x4c88('0xc'),attributes,{'tableName':_0x4c88('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a1204,_0x560b23,_0x4702b6){if(_0x1a1204[_0x4c88('0xe')](_0x4c88('0xf'))){_0x1a1204[_0x4c88('0x10')]=moment()[_0x4c88('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4702b6(null,_0x1a1204);}}});}; \ No newline at end of file +var _0xa3bf=['path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','request-promise'];(function(_0x32cdfe,_0x200ff4){var _0x178aa0=function(_0x3e7ca7){while(--_0x3e7ca7){_0x32cdfe['push'](_0x32cdfe['shift']());}};_0x178aa0(++_0x200ff4);}(_0xa3bf,0x1eb));var _0xfa3b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa3bf[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xfa3b('0x0'));var util=require(_0xfa3b('0x1'));var logger=require('../../config/logger')(_0xfa3b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfa3b('0x3'));var fs=require('fs');var path=require(_0xfa3b('0x4'));var rimraf=require(_0xfa3b('0x5'));var config=require(_0xfa3b('0x6'));var attributes=require(_0xfa3b('0x7'));module[_0xfa3b('0x8')]=function(_0x5a3214,_0x4ca21a){return _0x5a3214[_0xfa3b('0x9')](_0xfa3b('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b9a4e,_0x4a4b3d,_0x23dd99){if(_0x5b9a4e[_0xfa3b('0xb')]('closed')){_0x5b9a4e[_0xfa3b('0xc')]=moment()[_0xfa3b('0xd')](_0xfa3b('0xe'));}_0x23dd99(null,_0x5b9a4e);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 70b24db..167660f 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 _0x67a5=['AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','WhatsappInteraction','update','body','options','where','limit','UpdateWhatsappInteraction'];(function(_0x34113c,_0x34ed64){var _0x107db4=function(_0x266c7a){while(--_0x266c7a){_0x34113c['push'](_0x34113c['shift']());}};_0x107db4(++_0x34ed64);}(_0x67a5,0x13e));var _0x567a=function(_0x5c8183,_0x11c219){_0x5c8183=_0x5c8183-0x0;var _0xb13af2=_0x67a5[_0x5c8183];return _0xb13af2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x567a('0x0'));var rs=require(_0x567a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x567a('0x2'))['db'];var utils=require(_0x567a('0x3'));var logger=require(_0x567a('0x4'))('rpc');var config=require(_0x567a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x567a('0x6')][_0x567a('0x7')]({'port':0x232a});config[_0x567a('0x8')]=_[_0x567a('0x9')](config[_0x567a('0x8')],{'host':_0x567a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x567a('0x8')]));require(_0x567a('0xb'))[_0x567a('0xc')](socket);function respondWithRpcPromise(_0x4fd4d6,_0x5bf2a6,_0x5e8351){return new BPromise(function(_0x1e16b7,_0xd4bb00){return client[_0x567a('0xd')](_0x4fd4d6,_0x5e8351)[_0x567a('0xe')](function(_0x275138){logger[_0x567a('0xf')](_0x567a('0x10'),_0x5bf2a6,_0x567a('0x11'));logger[_0x567a('0x12')](_0x567a('0x13'),_0x5bf2a6,_0x567a('0x11'),JSON[_0x567a('0x14')](_0x275138));if(_0x275138['error']){if(_0x275138['error'][_0x567a('0x15')]===0x1f4){logger['error'](_0x567a('0x10'),_0x5bf2a6,_0x275138[_0x567a('0x16')]['message']);return _0xd4bb00(_0x275138[_0x567a('0x16')][_0x567a('0x17')]);}logger['error'](_0x567a('0x10'),_0x5bf2a6,_0x275138[_0x567a('0x16')]['message']);return _0x1e16b7(_0x275138[_0x567a('0x16')]['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x5bf2a6,_0x567a('0x11'));_0x1e16b7(_0x275138[_0x567a('0x18')][_0x567a('0x17')]);}})[_0x567a('0x19')](function(_0x19ad08){logger[_0x567a('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x5bf2a6,_0x19ad08);_0xd4bb00(_0x19ad08);});});}exports['UpdateWhatsappInteraction']=function(_0x3aba47){var _0x4d31a5=this;return new Promise(function(_0x3ef68d,_0x4860b5){return db[_0x567a('0x1a')][_0x567a('0x1b')](_0x3aba47[_0x567a('0x1c')],{'raw':_0x3aba47[_0x567a('0x1d')]?_0x3aba47[_0x567a('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aba47[_0x567a('0x1d')]?_0x3aba47[_0x567a('0x1d')][_0x567a('0x1e')]||null:null,'attributes':_0x3aba47[_0x567a('0x1d')]?_0x3aba47[_0x567a('0x1d')]['attributes']||null:null,'limit':_0x3aba47['options']?_0x3aba47[_0x567a('0x1d')][_0x567a('0x1f')]||null:null})[_0x567a('0xe')](function(_0x28750f){logger[_0x567a('0xf')](_0x567a('0x20'),_0x3aba47);logger['debug'](_0x567a('0x20'),_0x3aba47,JSON[_0x567a('0x14')](_0x28750f));_0x3ef68d(_0x28750f);})[_0x567a('0x19')](function(_0x180ae4){logger[_0x567a('0x16')](_0x567a('0x20'),_0x180ae4[_0x567a('0x17')],_0x3aba47);_0x4860b5(_0x4d31a5[_0x567a('0x16')](0x1f4,_0x180ae4[_0x567a('0x17')]));});});};exports[_0x567a('0x21')]=function(_0x1e8ece){return new Promise(function(_0x51e254,_0x3aed1c){return db[_0x567a('0x1a')][_0x567a('0x22')]({'where':_0x1e8ece[_0x567a('0x1d')]?_0x1e8ece[_0x567a('0x1d')][_0x567a('0x1e')]||null:null})['then'](function(_0x50cda8){if(_0x50cda8){return _0x50cda8[_0x567a('0x23')](_0x1e8ece[_0x567a('0x1c')][_0x567a('0x24')],_['omit'](_0x1e8ece[_0x567a('0x1c')],[_0x567a('0x24'),'id'])||{});}})[_0x567a('0x25')](function(_0x285507){logger['info'](_0x567a('0x26'),_0x1e8ece);logger[_0x567a('0x12')](_0x567a('0x26'),_0x1e8ece,JSON['stringify'](_0x285507));_0x51e254(_0x285507);})[_0x567a('0x19')](function(_0xd9efc8){logger[_0x567a('0x16')](_0x567a('0x26'),_0xd9efc8[_0x567a('0x17')],_0x1e8ece);_0x3aed1c(_this[_0x567a('0x16')](0x1f4,_0xd9efc8[_0x567a('0x17')]));});});}; \ No newline at end of file +var _0x6739=['defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateWhatsappInteraction','body','options','where','attributes','limit','debug','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x5ec7db,_0x36c0be){var _0x209f26=function(_0x4d7c3e){while(--_0x4d7c3e){_0x5ec7db['push'](_0x5ec7db['shift']());}};_0x209f26(++_0x36c0be);}(_0x6739,0x185));var _0x9673=function(_0x54780a,_0x20447c){_0x54780a=_0x54780a-0x0;var _0x56fa61=_0x6739[_0x54780a];return _0x56fa61;};'use strict';var _=require(_0x9673('0x0'));var util=require(_0x9673('0x1'));var moment=require('moment');var BPromise=require(_0x9673('0x2'));var rs=require(_0x9673('0x3'));var fs=require('fs');var Redis=require(_0x9673('0x4'));var db=require(_0x9673('0x5'))['db'];var utils=require(_0x9673('0x6'));var logger=require(_0x9673('0x7'))(_0x9673('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9673('0x9')][_0x9673('0xa')]({'port':0x232a});config['redis']=_[_0x9673('0xb')](config[_0x9673('0xc')],{'host':_0x9673('0xd'),'port':0x18eb});var socket=require(_0x9673('0xe'))(new Redis(config['redis']));require(_0x9673('0xf'))[_0x9673('0x10')](socket);function respondWithRpcPromise(_0x174e3c,_0x3e36a1,_0x5ce004){return new BPromise(function(_0x179a59,_0x5915c6){return client['request'](_0x174e3c,_0x5ce004)[_0x9673('0x11')](function(_0x4f8056){logger[_0x9673('0x12')](_0x9673('0x13'),_0x3e36a1,_0x9673('0x14'));logger['debug'](_0x9673('0x15'),_0x3e36a1,_0x9673('0x14'),JSON[_0x9673('0x16')](_0x4f8056));if(_0x4f8056['error']){if(_0x4f8056['error']['code']===0x1f4){logger[_0x9673('0x17')](_0x9673('0x13'),_0x3e36a1,_0x4f8056[_0x9673('0x17')][_0x9673('0x18')]);return _0x5915c6(_0x4f8056[_0x9673('0x17')][_0x9673('0x18')]);}logger[_0x9673('0x17')](_0x9673('0x13'),_0x3e36a1,_0x4f8056['error'][_0x9673('0x18')]);return _0x179a59(_0x4f8056[_0x9673('0x17')][_0x9673('0x18')]);}else{logger[_0x9673('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x3e36a1,'request\x20sent');_0x179a59(_0x4f8056['result']['message']);}})[_0x9673('0x19')](function(_0x3d2e29){logger[_0x9673('0x17')](_0x9673('0x13'),_0x3e36a1,_0x3d2e29);_0x5915c6(_0x3d2e29);});});}exports[_0x9673('0x1a')]=function(_0xcd1d5e){var _0x10e40b=this;return new Promise(function(_0x51418b,_0x12eea5){return db['WhatsappInteraction']['update'](_0xcd1d5e[_0x9673('0x1b')],{'raw':_0xcd1d5e['options']?_0xcd1d5e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcd1d5e[_0x9673('0x1c')]?_0xcd1d5e[_0x9673('0x1c')][_0x9673('0x1d')]||null:null,'attributes':_0xcd1d5e[_0x9673('0x1c')]?_0xcd1d5e[_0x9673('0x1c')][_0x9673('0x1e')]||null:null,'limit':_0xcd1d5e[_0x9673('0x1c')]?_0xcd1d5e[_0x9673('0x1c')][_0x9673('0x1f')]||null:null})[_0x9673('0x11')](function(_0x5e39ad){logger[_0x9673('0x12')](_0x9673('0x1a'),_0xcd1d5e);logger[_0x9673('0x20')](_0x9673('0x1a'),_0xcd1d5e,JSON[_0x9673('0x16')](_0x5e39ad));_0x51418b(_0x5e39ad);})[_0x9673('0x19')](function(_0xd8dfff){logger[_0x9673('0x17')](_0x9673('0x1a'),_0xd8dfff[_0x9673('0x18')],_0xcd1d5e);_0x12eea5(_0x10e40b[_0x9673('0x17')](0x1f4,_0xd8dfff['message']));});});};exports[_0x9673('0x21')]=function(_0x1cab29){return new Promise(function(_0x3bf900,_0x3b2ad6){return db[_0x9673('0x22')][_0x9673('0x23')]({'where':_0x1cab29[_0x9673('0x1c')]?_0x1cab29[_0x9673('0x1c')][_0x9673('0x1d')]||null:null})[_0x9673('0x11')](function(_0x65094d){if(_0x65094d){return _0x65094d[_0x9673('0x24')](_0x1cab29[_0x9673('0x1b')][_0x9673('0x25')],_['omit'](_0x1cab29['body'],[_0x9673('0x25'),'id'])||{});}})[_0x9673('0x26')](function(_0xc75f97){logger[_0x9673('0x12')](_0x9673('0x27'),_0x1cab29);logger['debug']('AddTags',_0x1cab29,JSON['stringify'](_0xc75f97));_0x3bf900(_0xc75f97);})[_0x9673('0x19')](function(_0x52c044){logger[_0x9673('0x17')](_0x9673('0x27'),_0x52c044[_0x9673('0x18')],_0x1cab29);_0x3b2ad6(_this[_0x9673('0x17')](0x1f4,_0x52c044[_0x9673('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 4c8b19d..187c87e 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 _0x544d=['whatsappInteraction:','./whatsappInteraction.events','remove','update','emit','removeListener','register'];(function(_0x4e5e6c,_0x959eb4){var _0xcf9053=function(_0x3bce18){while(--_0x3bce18){_0x4e5e6c['push'](_0x4e5e6c['shift']());}};_0xcf9053(++_0x959eb4);}(_0x544d,0x1c8));var _0xd544=function(_0x1899de,_0x318f1a){_0x1899de=_0x1899de-0x0;var _0x10af05=_0x544d[_0x1899de];return _0x10af05;};'use strict';var WhatsappInteractionEvents=require(_0xd544('0x0'));var events=['save',_0xd544('0x1'),_0xd544('0x2')];function createListener(_0x313e4e,_0x218fad){return function(_0x39463a){_0x218fad[_0xd544('0x3')](_0x313e4e,_0x39463a);};}function removeListener(_0x1dfd71,_0x1c3abe){return function(){WhatsappInteractionEvents[_0xd544('0x4')](_0x1dfd71,_0x1c3abe);};}exports[_0xd544('0x5')]=function(_0x46ae28){for(var _0xd1fc19=0x0,_0x437909=events['length'];_0xd1fc19<_0x437909;_0xd1fc19++){var _0xebdc0f=events[_0xd1fc19];var _0x56be27=createListener(_0xd544('0x6')+_0xebdc0f,_0x46ae28);WhatsappInteractionEvents['on'](_0xebdc0f,_0x56be27);}}; \ No newline at end of file +var _0x6ac5=['register','./whatsappInteraction.events','update','emit'];(function(_0x326f05,_0x19eaf1){var _0x353cff=function(_0x4c2a10){while(--_0x4c2a10){_0x326f05['push'](_0x326f05['shift']());}};_0x353cff(++_0x19eaf1);}(_0x6ac5,0x119));var _0x56ac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6ac5[_0x14add3];return _0x4a174f;};'use strict';var WhatsappInteractionEvents=require(_0x56ac('0x0'));var events=['save','remove',_0x56ac('0x1')];function createListener(_0x5ac3ba,_0x5eeb27){return function(_0x2d7bfd){_0x5eeb27[_0x56ac('0x2')](_0x5ac3ba,_0x2d7bfd);};}function removeListener(_0x12e5be,_0x1ffbc7){return function(){WhatsappInteractionEvents['removeListener'](_0x12e5be,_0x1ffbc7);};}exports[_0x56ac('0x3')]=function(_0xb211f3){for(var _0x27ae8d=0x0,_0x3b0b6a=events['length'];_0x27ae8d<_0x3b0b6a;_0x27ae8d++){var _0x4ba671=events[_0x27ae8d];var _0x2f9c99=createListener('whatsappInteraction:'+_0x4ba671,_0xb211f3);WhatsappInteractionEvents['on'](_0x4ba671,_0x2f9c99);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index ac364de..54b242b 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 _0xfe97=['show','post','tracked','whatsappmessage:create','status','put','update','/:id/accept','/:id/reject','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','./whatsappMessage.controller','get','index','/describe','describe','/:id','isAuthenticated'];(function(_0x52dbc0,_0x110a09){var _0x446d9f=function(_0xcd77a4){while(--_0xcd77a4){_0x52dbc0['push'](_0x52dbc0['shift']());}};_0x446d9f(++_0x110a09);}(_0xfe97,0xed));var _0x7fe9=function(_0xcffc6e,_0x1e20f0){_0xcffc6e=_0xcffc6e-0x0;var _0x2af0c2=_0xfe97[_0xcffc6e];return _0x2af0c2;};'use strict';var multer=require(_0x7fe9('0x0'));var util=require('util');var path=require(_0x7fe9('0x1'));var timeout=require('connect-timeout');var express=require(_0x7fe9('0x2'));var router=express[_0x7fe9('0x3')]();var fs_extra=require(_0x7fe9('0x4'));var auth=require(_0x7fe9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7fe9('0x6'));router[_0x7fe9('0x7')]('/',auth['isAuthenticated'](),controller[_0x7fe9('0x8')]);router[_0x7fe9('0x7')](_0x7fe9('0x9'),auth['isAuthenticated'](),controller[_0x7fe9('0xa')]);router[_0x7fe9('0x7')](_0x7fe9('0xb'),auth[_0x7fe9('0xc')](),controller[_0x7fe9('0xd')]);router[_0x7fe9('0xe')]('/',auth[_0x7fe9('0xc')](),interaction[_0x7fe9('0xf')]('whatsapp',_0x7fe9('0x10')),controller['create']);router[_0x7fe9('0xe')]('/:id/status',controller[_0x7fe9('0x11')]);router[_0x7fe9('0x12')]('/:id',auth[_0x7fe9('0xc')](),controller[_0x7fe9('0x13')]);router['put'](_0x7fe9('0x14'),auth[_0x7fe9('0xc')](),controller['accept']);router[_0x7fe9('0x12')](_0x7fe9('0x15'),auth[_0x7fe9('0xc')](),controller['reject']);router[_0x7fe9('0x16')](_0x7fe9('0xb'),auth[_0x7fe9('0xc')](),controller[_0x7fe9('0x17')]);module[_0x7fe9('0x18')]=router; \ No newline at end of file +var _0x47dd=['index','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x114cde,_0x148efd){var _0x4b7547=function(_0x643263){while(--_0x643263){_0x114cde['push'](_0x114cde['shift']());}};_0x4b7547(++_0x148efd);}(_0x47dd,0x106));var _0xd47d=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x47dd[_0xc0a3d3];return _0x3386e8;};'use strict';var multer=require('multer');var util=require(_0xd47d('0x0'));var path=require(_0xd47d('0x1'));var timeout=require('connect-timeout');var express=require(_0xd47d('0x2'));var router=express['Router']();var fs_extra=require(_0xd47d('0x3'));var auth=require(_0xd47d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd47d('0x5'));var controller=require('./whatsappMessage.controller');router[_0xd47d('0x6')]('/',auth[_0xd47d('0x7')](),controller[_0xd47d('0x8')]);router[_0xd47d('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xd47d('0x9')]);router[_0xd47d('0x6')](_0xd47d('0xa'),auth[_0xd47d('0x7')](),controller[_0xd47d('0xb')]);router[_0xd47d('0xc')]('/',auth[_0xd47d('0x7')](),interaction[_0xd47d('0xd')](_0xd47d('0xe'),_0xd47d('0xf')),controller[_0xd47d('0x10')]);router[_0xd47d('0xc')](_0xd47d('0x11'),controller[_0xd47d('0x12')]);router['put'](_0xd47d('0xa'),auth[_0xd47d('0x7')](),controller[_0xd47d('0x13')]);router[_0xd47d('0x14')](_0xd47d('0x15'),auth[_0xd47d('0x7')](),controller[_0xd47d('0x16')]);router[_0xd47d('0x14')](_0xd47d('0x17'),auth[_0xd47d('0x7')](),controller[_0xd47d('0x18')]);router[_0xd47d('0x19')](_0xd47d('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xd47d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 9da08d0..0bf96db 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 _0x74f3=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','BOOLEAN'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x74f3,0x164));var _0x374f=function(_0x380e4a,_0x40572b){_0x380e4a=_0x380e4a-0x0;var _0x11be37=_0x74f3[_0x380e4a];return _0x11be37;};'use strict';var Sequelize=require(_0x374f('0x0'));module[_0x374f('0x1')]={'body':{'type':Sequelize[_0x374f('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x374f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x374f('0x4')]('in',_0x374f('0x5')),'defaultValue':_0x374f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x374f('0x6')]},'readAt':{'type':Sequelize[_0x374f('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x374f('0x6')]},'providerResponse':{'type':Sequelize[_0x374f('0x2')]}}; \ No newline at end of file +var _0x0453=['ENUM','out','STRING','DATE','BOOLEAN','exports','TEXT','medium'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x0453,0x155));var _0x3045=function(_0x95651d,_0x5a22db){_0x95651d=_0x95651d-0x0;var _0x266777=_0x0453[_0x95651d];return _0x266777;};'use strict';var Sequelize=require('sequelize');module[_0x3045('0x0')]={'body':{'type':Sequelize[_0x3045('0x1')](_0x3045('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3045('0x3')]('in',_0x3045('0x4')),'defaultValue':_0x3045('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3045('0x5')](0xbe)},'phone':{'type':Sequelize[_0x3045('0x5')]},'readAt':{'type':Sequelize[_0x3045('0x6')]},'secret':{'type':Sequelize[_0x3045('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3045('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 63a8345..245b0d1 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 _0x83db=['body','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','agent','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','rejectMessage','QueryTypes','rejectmessage','WhatsappAccount','WhatsappAccountId','inspect','twilio','MessageSid','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create'];(function(_0x438933,_0x5129bb){var _0x1da77e=function(_0x1e8f2c){while(--_0x1e8f2c){_0x438933['push'](_0x438933['shift']());}};_0x1da77e(++_0x5129bb);}(_0x83db,0x13f));var _0xb83d=function(_0x415d8d,_0x5b692f){_0x415d8d=_0x415d8d-0x0;var _0x201c4a=_0x83db[_0x415d8d];return _0x201c4a;};'use strict';var emlformat=require(_0xb83d('0x0'));var rimraf=require(_0xb83d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb83d('0x2'));var rp=require(_0xb83d('0x3'));var moment=require(_0xb83d('0x4'));var BPromise=require(_0xb83d('0x5'));var Mustache=require(_0xb83d('0x6'));var util=require(_0xb83d('0x7'));var path=require(_0xb83d('0x8'));var sox=require(_0xb83d('0x9'));var csv=require(_0xb83d('0xa'));var ejs=require(_0xb83d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb83d('0xc'));var squel=require(_0xb83d('0xd'));var crypto=require(_0xb83d('0xe'));var jsforce=require(_0xb83d('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb83d('0x10'));var Redis=require(_0xb83d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb83d('0x12'));var as=require(_0xb83d('0x13'));var hardwareService=require(_0xb83d('0x14'));var logger=require(_0xb83d('0x15'))(_0xb83d('0x16'));var utils=require(_0xb83d('0x17'));var config=require(_0xb83d('0x18'));var licenseUtil=require(_0xb83d('0x19'));var db=require(_0xb83d('0x1a'))['db'];config[_0xb83d('0x1b')]=_[_0xb83d('0x1c')](config[_0xb83d('0x1b')],{'host':_0xb83d('0x1d'),'port':0x18eb});var socket=require(_0xb83d('0x1e'))(new Redis(config[_0xb83d('0x1b')]));require(_0xb83d('0x1f'))[_0xb83d('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb83d('0x21')][_0xb83d('0x22')]({'port':0x232c});var client9002=jayson['client'][_0xb83d('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x55c1e5,_0x1df89e,_0x306c48,_0x37be68){return new BPromise(function(_0x5ab846,_0x3301e8){var _0x1e2bbd=_0x37be68||client;return _0x1e2bbd[_0xb83d('0x23')](_0x55c1e5,_0x306c48)[_0xb83d('0x24')](function(_0x30b263){logger[_0xb83d('0x25')](_0xb83d('0x26'),_0x1df89e,_0xb83d('0x27'));logger[_0xb83d('0x28')](_0xb83d('0x29'),_0x1df89e,'request\x20sent',JSON[_0xb83d('0x2a')](_0x30b263));if(_0x30b263[_0xb83d('0x2b')]){if(_0x30b263[_0xb83d('0x2b')][_0xb83d('0x2c')]===0x1f4){logger[_0xb83d('0x2b')](_0xb83d('0x26'),_0x1df89e,_0x30b263[_0xb83d('0x2b')][_0xb83d('0x2d')]);return _0x3301e8(_0x30b263[_0xb83d('0x2b')]['message']);}logger[_0xb83d('0x2b')](_0xb83d('0x26'),_0x1df89e,_0x30b263[_0xb83d('0x2b')][_0xb83d('0x2d')]);return _0x5ab846(_0x30b263[_0xb83d('0x2b')]['message']);}else{logger[_0xb83d('0x25')](_0xb83d('0x26'),_0x1df89e,'request\x20sent');_0x5ab846(_0x30b263[_0xb83d('0x2e')][_0xb83d('0x2d')]);}})[_0xb83d('0x2f')](function(_0x1a5507){logger['error'](_0xb83d('0x26'),_0x1df89e,_0x1a5507);_0x3301e8(_0x1a5507);});});}function respondWithStatusCode(_0x281230,_0x35fdf4){_0x35fdf4=_0x35fdf4||0xcc;return function(_0x2d9630){if(_0x2d9630){return _0x281230['sendStatus'](_0x35fdf4);}return _0x281230['status'](_0x35fdf4)[_0xb83d('0x30')]();};}function respondWithResult(_0x2c6cd9,_0x4a229c){_0x4a229c=_0x4a229c||0xc8;return function(_0x4cd9db){if(_0x4cd9db){return _0x2c6cd9[_0xb83d('0x31')](_0x4a229c)['json'](_0x4cd9db);}};}function respondWithFilteredResult(_0x5ab220,_0x3ad44f){return function(_0x1ef30f){if(_0x1ef30f){var _0x21fa45=typeof _0x3ad44f[_0xb83d('0x32')]==='undefined'&&typeof _0x3ad44f['limit']===_0xb83d('0x33');var _0x238542=_0x1ef30f['count'];var _0x5db815=_0x21fa45?0x0:_0x3ad44f[_0xb83d('0x32')];var _0xeab446=_0x21fa45?_0x1ef30f[_0xb83d('0x34')]:_0x3ad44f[_0xb83d('0x32')]+_0x3ad44f[_0xb83d('0x35')];var _0xccf93b;if(_0xeab446>=_0x238542){_0xeab446=_0x238542;_0xccf93b=0xc8;}else{_0xccf93b=0xce;}_0x5ab220['status'](_0xccf93b);return _0x5ab220[_0xb83d('0x36')](_0xb83d('0x37'),_0x5db815+'-'+_0xeab446+'/'+_0x238542)[_0xb83d('0x38')](_0x1ef30f);}return null;};}function patchUpdates(_0x9f6cfb){return function(_0x24deb5){try{jsonpatch[_0xb83d('0x39')](_0x24deb5,_0x9f6cfb,!![]);}catch(_0x1e55cc){return BPromise[_0xb83d('0x3a')](_0x1e55cc);}return _0x24deb5[_0xb83d('0x3b')]();};}function saveUpdates(_0x1b5d97,_0x1817d0){return function(_0x414c8c){if(_0x414c8c){return _0x414c8c[_0xb83d('0x3c')](_0x1b5d97)['then'](function(_0x3d356a){return _0x3d356a;});}return null;};}function removeEntity(_0x2ca171,_0x5b8ad2){return function(_0x673e29){if(_0x673e29){return _0x673e29[_0xb83d('0x3d')]()['then'](function(){_0x2ca171[_0xb83d('0x31')](0xcc)[_0xb83d('0x30')]();});}};}function handleEntityNotFound(_0x36b4db,_0x5e9c82){return function(_0x21155){if(!_0x21155){_0x36b4db['sendStatus'](0x194);}return _0x21155;};}function handleError(_0x21096a,_0x491593){_0x491593=_0x491593||0x1f4;return function(_0x5df33e){logger['error'](_0x5df33e[_0xb83d('0x3e')]);if(_0x5df33e[_0xb83d('0x3f')]){delete _0x5df33e[_0xb83d('0x3f')];}_0x21096a[_0xb83d('0x31')](_0x491593)[_0xb83d('0x40')](_0x5df33e);};}exports[_0xb83d('0x41')]=function(_0x3a02ef,_0x1f4aea){var _0x3fb747={},_0x1ff86={},_0x566c66={'count':0x0,'rows':[]};var _0x445641=_[_0xb83d('0x42')](db[_0xb83d('0x43')]['rawAttributes'],function(_0x11d1f3){return{'name':_0x11d1f3[_0xb83d('0x44')],'type':_0x11d1f3[_0xb83d('0x45')][_0xb83d('0x46')]};});_0x1ff86[_0xb83d('0x47')]=_[_0xb83d('0x42')](_0x445641,_0xb83d('0x3f'));_0x1ff86[_0xb83d('0x48')]=_['keys'](_0x3a02ef[_0xb83d('0x48')]);_0x1ff86[_0xb83d('0x49')]=_[_0xb83d('0x4a')](_0x1ff86[_0xb83d('0x47')],_0x1ff86[_0xb83d('0x48')]);_0x3fb747[_0xb83d('0x4b')]=_[_0xb83d('0x4a')](_0x1ff86[_0xb83d('0x47')],qs[_0xb83d('0x4c')](_0x3a02ef[_0xb83d('0x48')][_0xb83d('0x4c')]));_0x3fb747[_0xb83d('0x4b')]=_0x3fb747[_0xb83d('0x4b')]['length']?_0x3fb747['attributes']:_0x1ff86[_0xb83d('0x47')];if(!_0x3a02ef['query']['hasOwnProperty'](_0xb83d('0x4d'))){_0x3fb747['limit']=qs[_0xb83d('0x35')](_0x3a02ef[_0xb83d('0x48')][_0xb83d('0x35')]);_0x3fb747[_0xb83d('0x32')]=qs[_0xb83d('0x32')](_0x3a02ef['query'][_0xb83d('0x32')]);}_0x3fb747[_0xb83d('0x4e')]=qs['sort'](_0x3a02ef[_0xb83d('0x48')][_0xb83d('0x4f')]);_0x3fb747[_0xb83d('0x50')]=qs[_0xb83d('0x49')](_[_0xb83d('0x51')](_0x3a02ef[_0xb83d('0x48')],_0x1ff86[_0xb83d('0x49')]),_0x445641);if(_0x3a02ef[_0xb83d('0x48')][_0xb83d('0x52')]){_0x3fb747[_0xb83d('0x50')]=_[_0xb83d('0x53')](_0x3fb747[_0xb83d('0x50')],{'$or':_[_0xb83d('0x42')](_0x445641,function(_0x324356){if(_0x324356[_0xb83d('0x45')]!==_0xb83d('0x54')){var _0x20ddfc={};_0x20ddfc[_0x324356[_0xb83d('0x3f')]]={'$like':'%'+_0x3a02ef[_0xb83d('0x48')][_0xb83d('0x52')]+'%'};return _0x20ddfc;}})});}_0x3fb747=_[_0xb83d('0x53')]({},_0x3fb747,_0x3a02ef[_0xb83d('0x55')]);var _0x945d5e={'where':_0x3fb747[_0xb83d('0x50')]};return db['WhatsappMessage'][_0xb83d('0x34')](_0x945d5e)[_0xb83d('0x24')](function(_0x122162){_0x566c66[_0xb83d('0x34')]=_0x122162;if(_0x3a02ef['query'][_0xb83d('0x56')]){_0x3fb747[_0xb83d('0x57')]=[{'all':!![]}];}return db[_0xb83d('0x43')][_0xb83d('0x58')](_0x3fb747);})[_0xb83d('0x24')](function(_0x1e7da8){_0x566c66[_0xb83d('0x59')]=_0x1e7da8;return _0x566c66;})[_0xb83d('0x24')](respondWithFilteredResult(_0x1f4aea,_0x3fb747))[_0xb83d('0x2f')](handleError(_0x1f4aea,null));};exports[_0xb83d('0x5a')]=function(_0x161e39,_0x5766dd){var _0x27f31e={'raw':!![],'where':{'id':_0x161e39[_0xb83d('0x5b')]['id']}},_0x211c4c={};_0x211c4c[_0xb83d('0x47')]=_[_0xb83d('0x5c')](db[_0xb83d('0x43')]['rawAttributes']);_0x211c4c[_0xb83d('0x48')]=_['keys'](_0x161e39['query']);_0x211c4c[_0xb83d('0x49')]=_['intersection'](_0x211c4c[_0xb83d('0x47')],_0x211c4c['query']);_0x27f31e[_0xb83d('0x4b')]=_[_0xb83d('0x4a')](_0x211c4c[_0xb83d('0x47')],qs[_0xb83d('0x4c')](_0x161e39[_0xb83d('0x48')][_0xb83d('0x4c')]));_0x27f31e['attributes']=_0x27f31e['attributes']['length']?_0x27f31e[_0xb83d('0x4b')]:_0x211c4c[_0xb83d('0x47')];if(_0x161e39[_0xb83d('0x48')]['includeAll']){_0x27f31e[_0xb83d('0x57')]=[{'all':!![]}];}_0x27f31e=_[_0xb83d('0x53')]({},_0x27f31e,_0x161e39['options']);return db['WhatsappMessage'][_0xb83d('0x5d')](_0x27f31e)['then'](handleEntityNotFound(_0x5766dd,null))[_0xb83d('0x24')](respondWithResult(_0x5766dd,null))[_0xb83d('0x2f')](handleError(_0x5766dd,null));};exports[_0xb83d('0x5e')]=function(_0x280385,_0x25be0b){return db['WhatsappMessage'][_0xb83d('0x5e')](_0x280385[_0xb83d('0x5f')],{})[_0xb83d('0x24')](respondWithResult(_0x25be0b,0xc9))[_0xb83d('0x2f')](handleError(_0x25be0b,null));};exports['update']=function(_0x1c4e0b,_0x3a0499){if(_0x1c4e0b[_0xb83d('0x5f')]['id']){delete _0x1c4e0b[_0xb83d('0x5f')]['id'];}return db['WhatsappMessage'][_0xb83d('0x5d')]({'where':{'id':_0x1c4e0b[_0xb83d('0x5b')]['id']}})[_0xb83d('0x24')](handleEntityNotFound(_0x3a0499,null))[_0xb83d('0x24')](saveUpdates(_0x1c4e0b['body'],null))[_0xb83d('0x24')](respondWithResult(_0x3a0499,null))[_0xb83d('0x2f')](handleError(_0x3a0499,null));};exports[_0xb83d('0x3d')]=function(_0x45d4f2,_0x5e6ede){return db[_0xb83d('0x43')][_0xb83d('0x5d')]({'where':{'id':_0x45d4f2[_0xb83d('0x5b')]['id']}})[_0xb83d('0x24')](handleEntityNotFound(_0x5e6ede,null))[_0xb83d('0x24')](removeEntity(_0x5e6ede,null))['catch'](handleError(_0x5e6ede,null));};exports['describe']=function(_0x4bd752,_0x2005b6){return db[_0xb83d('0x43')][_0xb83d('0x60')]()['then'](respondWithResult(_0x2005b6,null))['catch'](handleError(_0x2005b6,null));};var interaction_log=require(_0xb83d('0x15'))(_0xb83d('0x61'));exports[_0xb83d('0x62')]=function(_0x2285f0,_0x3e9a44,_0x5eef95){var _0x5cbe54={'agent':{},'channel':_0xb83d('0x63')};if(_0x2285f0[_0xb83d('0x5f')]['id']){delete _0x2285f0['body']['id'];}_0x2285f0[_0xb83d('0x5f')]['read']=!![];_0x2285f0['body'][_0xb83d('0x64')]=moment()[_0xb83d('0x65')](_0xb83d('0x66'));_0x2285f0['body'][_0xb83d('0x67')]=_0x2285f0[_0xb83d('0x5f')]['UserId']||_0x2285f0[_0xb83d('0x68')]['id'];_0x5cbe54['agent']['id']=_0x2285f0['body'][_0xb83d('0x67')];return db[_0xb83d('0x43')][_0xb83d('0x5d')]({'where':{'id':_0x2285f0[_0xb83d('0x5b')]['id'],'UserId':null}})[_0xb83d('0x24')](handleEntityNotFound(_0x3e9a44,null))[_0xb83d('0x24')](saveUpdates(_0x2285f0[_0xb83d('0x5f')],null))[_0xb83d('0x24')](function(_0x1a604b){if(_0x1a604b){_0x5cbe54['message']=_0x1a604b[_0xb83d('0x69')]({'plain':!![]});return db[_0xb83d('0x6a')]['find']({'where':{'id':_0x1a604b[_0xb83d('0x6b')]}});}return null;})[_0xb83d('0x24')](handleEntityNotFound(_0x3e9a44,null))['then'](function(_0x55b5a0){if(_0x55b5a0){return _0x55b5a0[_0xb83d('0x3c')]({'UserId':_0x2285f0[_0xb83d('0x5f')]['UserId'],'read1stAt':_[_0xb83d('0x6c')](_0x55b5a0[_0xb83d('0x6d')])?moment()['format'](_0xb83d('0x66')):undefined});}return null;})['then'](function(_0x36e9b2){if(_0x36e9b2){_0x5cbe54[_0xb83d('0x6e')]=_0x36e9b2[_0xb83d('0x69')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2285f0[_0xb83d('0x68')]['id'],_0x2285f0[_0xb83d('0x68')]['name'],_0x2285f0[_0xb83d('0x68')][_0xb83d('0x6f')],_0x5cbe54[_0xb83d('0x6e')]['id'],_0x2285f0[_0xb83d('0x5f')]?JSON['stringify'](_0x2285f0[_0xb83d('0x5f')]):_0xb83d('0x70'));return respondWithRpcPromise(_0xb83d('0x71'),'acceptMessage',_0x5cbe54);}return null;})['then'](function(_0x1e3521){var _0x5eb20a=_0xb83d('0x72')+_0x1e3521[_0xb83d('0x2d')]['ContactId'];return db[_0xb83d('0x73')][_0xb83d('0x48')](_0x5eb20a,{'type':db[_0xb83d('0x74')]['QueryTypes'][_0xb83d('0x75')],'raw':!![]})['then'](function(_0x1fbd3c){return _0x1fbd3c;});})[_0xb83d('0x24')](function(_0xb7d4d9){if(_0xb7d4d9){_0x5cbe54[_0xb83d('0x2d')][_0xb83d('0x76')]=_0xb7d4d9[0x0];if(!_0x2285f0[_0xb83d('0x5f')][_0xb83d('0x67')])return;return db['User'][_0xb83d('0x5d')]({'where':{'id':_0x2285f0[_0xb83d('0x5f')][_0xb83d('0x67')],'role':_0xb83d('0x77')},'attributes':['id',_0xb83d('0x3f'),'fullname',_0xb83d('0x78'),_0xb83d('0x79')],'raw':!![]});}return null;})['then'](function(_0x2eaf0d){if(!_0x2eaf0d)return null;_0x5cbe54[_0xb83d('0x2d')][_0xb83d('0x77')]=_0x2eaf0d;return _0x5cbe54;})[_0xb83d('0x24')](function(_0x5b1426){if(_0x5b1426){if(_0x2285f0[_0xb83d('0x5f')][_0xb83d('0x7a')]){_0x5cbe54[_0xb83d('0x2d')][_0xb83d('0x7b')]=util[_0xb83d('0x65')](_0xb83d('0x7c'),_0x2285f0[_0xb83d('0x68')][_0xb83d('0x3f')]);_0x5cbe54[_0xb83d('0x2d')][_0xb83d('0x7d')]=_0x5cbe54[_0xb83d('0x7d')];_0x5cbe54[_0xb83d('0x2d')][_0xb83d('0x7e')]=_0x5cbe54[_0xb83d('0x7d')];_0x5cbe54['message'][_0xb83d('0x7f')]=_0xb83d('0x62');return respondWithRpcPromise(_0xb83d('0x80'),'EventManager',{'event':_0xb83d('0x81'),'message':_0x5cbe54[_0xb83d('0x2d')]},client9002)[_0xb83d('0x24')](function(){return _0x5cbe54;});}return _0x5cbe54;}return null;})['then'](respondWithResult(_0x3e9a44,null))[_0xb83d('0x2f')](handleError(_0x3e9a44,null));};var interaction_log=require(_0xb83d('0x15'))(_0xb83d('0x61'));exports[_0xb83d('0x3a')]=function(_0x108495,_0x1d11fb,_0x1de355){var _0x40a71e={'agent':{},'channel':'whatsapp'};if(_0x108495[_0xb83d('0x5f')]['id']){delete _0x108495[_0xb83d('0x5f')]['id'];}_0x108495[_0xb83d('0x5f')][_0xb83d('0x67')]=_0x108495[_0xb83d('0x5f')][_0xb83d('0x67')]||_0x108495['user']['id'];_0x40a71e['agent']['id']=_0x108495[_0xb83d('0x5f')][_0xb83d('0x67')];return db[_0xb83d('0x43')][_0xb83d('0x5d')]({'where':{'id':_0x108495[_0xb83d('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1d11fb,null))['then'](function(_0x31571b){if(_0x31571b){_0x40a71e['message']=_0x31571b['get']({'plain':!![]});return db[_0xb83d('0x6a')][_0xb83d('0x5d')]({'where':{'id':_0x31571b[_0xb83d('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x1d11fb,null))[_0xb83d('0x24')](function(_0x22248e){if(_0x22248e){_0x40a71e[_0xb83d('0x6e')]=_0x22248e[_0xb83d('0x69')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x108495[_0xb83d('0x68')]['id'],_0x108495[_0xb83d('0x68')][_0xb83d('0x3f')],_0x108495[_0xb83d('0x68')]['role'],_0x40a71e[_0xb83d('0x6e')]['id'],_0x108495[_0xb83d('0x5f')]?JSON['stringify'](_0x108495[_0xb83d('0x5f')]):_0xb83d('0x70'));return respondWithRpcPromise('RejectMessage',_0xb83d('0x82'),_0x40a71e);}return null;})[_0xb83d('0x24')](function(_0x26685c){var _0x35a73e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x26685c['message']['ContactId'];return db[_0xb83d('0x73')][_0xb83d('0x48')](_0x35a73e,{'type':db[_0xb83d('0x74')][_0xb83d('0x83')][_0xb83d('0x75')],'raw':!![]})['then'](function(_0x4f0b3d){return _0x4f0b3d;});})['then'](function(_0x1bc4fd){if(_0x1bc4fd){_0x40a71e[_0xb83d('0x2d')]['contact']=_0x1bc4fd[0x0];if(!_0x108495[_0xb83d('0x5f')][_0xb83d('0x67')])return;return db['User']['find']({'where':{'id':_0x108495[_0xb83d('0x5f')][_0xb83d('0x67')],'role':_0xb83d('0x77')},'attributes':['id',_0xb83d('0x3f'),'fullname','email',_0xb83d('0x79')],'raw':!![]});}return null;})[_0xb83d('0x24')](function(_0xef9fe5){if(!_0xef9fe5)return null;_0x40a71e[_0xb83d('0x2d')]['agent']=_0xef9fe5;return _0x40a71e;})[_0xb83d('0x24')](function(_0x112116){if(_0x112116){_0x112116[_0xb83d('0x2d')][_0xb83d('0x7b')]=util[_0xb83d('0x65')](_0xb83d('0x7c'),_0x108495[_0xb83d('0x68')]['name']);_0x112116[_0xb83d('0x2d')]['channel']=_0x40a71e['channel'];_0x112116[_0xb83d('0x2d')]['motionChannel']=_0x40a71e[_0xb83d('0x7d')];_0x112116[_0xb83d('0x2d')][_0xb83d('0x7f')]='reject';respondWithRpcPromise('EventManager',_0xb83d('0x80'),{'event':_0xb83d('0x84'),'message':_0x112116[_0xb83d('0x2d')]},client9002);return _0x40a71e;}return null;})[_0xb83d('0x24')](respondWithResult(_0x1d11fb,null))[_0xb83d('0x2f')](handleError(_0x1d11fb,null));};exports[_0xb83d('0x31')]=function(_0x21c0d5,_0x31f8a0,_0x283141){if(_0x21c0d5[_0xb83d('0x5f')]['id']){delete _0x21c0d5['body']['id'];}var _0x26c1ff;return db[_0xb83d('0x43')][_0xb83d('0x5d')]({'where':{'id':_0x21c0d5[_0xb83d('0x5b')]['id']}})[_0xb83d('0x24')](handleEntityNotFound(_0x31f8a0,null))['then'](function(_0x4eb8a2){if(_0x4eb8a2){_0x26c1ff=_0x4eb8a2;return db[_0xb83d('0x85')][_0xb83d('0x5d')]({'where':{'id':_0x4eb8a2[_0xb83d('0x86')]}});}})[_0xb83d('0x24')](handleEntityNotFound(_0x31f8a0,null))['then'](function(_0x48da3d){if(_0x48da3d){logger[_0xb83d('0x28')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xb83d('0x31'),'received\x20delivery\x20report\x20from',_0x48da3d[_0xb83d('0x45')],util[_0xb83d('0x87')](_0x21c0d5[_0xb83d('0x5f')],{'showHidden':![],'depth':null}));switch(_0x48da3d[_0xb83d('0x45')]){case _0xb83d('0x88'):if(_0x21c0d5[_0xb83d('0x5f')]['MessageSid']&&_0x21c0d5['body'][_0xb83d('0x89')]===_0x26c1ff['messageId']&&_0x21c0d5['body']['MessageStatus']&&_0x21c0d5[_0xb83d('0x5f')]['MessageStatus']==='read'){return _0x26c1ff[_0xb83d('0x3c')]({'read':!![]});}else{logger[_0xb83d('0x2b')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xb83d('0x31'),_0xb83d('0x88'),util[_0xb83d('0x87')](_0x21c0d5[_0xb83d('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x26c1ff;}})[_0xb83d('0x24')](respondWithResult(_0x31f8a0,null))[_0xb83d('0x2f')](handleError(_0x31f8a0,null));}; \ No newline at end of file +var _0x0c94=['../../config/license/util','../../mysqldb','redis','defaults','localhost','jayson/promise','client','http','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','end','stack','name','map','WhatsappMessage','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteractionId','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','Sequelize','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','type','inspect','twilio','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x59550b,_0x186704){var _0x2f68f5=function(_0x4d0225){while(--_0x4d0225){_0x59550b['push'](_0x59550b['shift']());}};_0x2f68f5(++_0x186704);}(_0x0c94,0x71));var _0x40c9=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x0c94[_0x4c12ec];return _0x3ae42c;};'use strict';var emlformat=require(_0x40c9('0x0'));var rimraf=require(_0x40c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x40c9('0x2'));var moment=require(_0x40c9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x40c9('0x4'));var util=require('util');var path=require(_0x40c9('0x5'));var sox=require('sox');var csv=require(_0x40c9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x40c9('0x7'));var _=require(_0x40c9('0x8'));var squel=require('squel');var crypto=require(_0x40c9('0x9'));var jsforce=require(_0x40c9('0xa'));var deskjs=require(_0x40c9('0xb'));var toCsv=require(_0x40c9('0x6'));var querystring=require(_0x40c9('0xc'));var Papa=require(_0x40c9('0xd'));var Redis=require(_0x40c9('0xe'));var authService=require(_0x40c9('0xf'));var qs=require(_0x40c9('0x10'));var as=require(_0x40c9('0x11'));var hardwareService=require(_0x40c9('0x12'));var logger=require(_0x40c9('0x13'))(_0x40c9('0x14'));var utils=require(_0x40c9('0x15'));var config=require(_0x40c9('0x16'));var licenseUtil=require(_0x40c9('0x17'));var db=require(_0x40c9('0x18'))['db'];config[_0x40c9('0x19')]=_[_0x40c9('0x1a')](config[_0x40c9('0x19')],{'host':_0x40c9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x40c9('0x19')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x40c9('0x1c'));var client=jayson[_0x40c9('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x40c9('0x1d')][_0x40c9('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2a11b2,_0x3def4f,_0x5b0848,_0x3e15d6){return new BPromise(function(_0x12756b,_0x2788a8){var _0x2d3c82=_0x3e15d6||client;return _0x2d3c82['request'](_0x2a11b2,_0x5b0848)['then'](function(_0x4d6f9e){logger[_0x40c9('0x1f')](_0x40c9('0x20'),_0x3def4f,_0x40c9('0x21'));logger[_0x40c9('0x22')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3def4f,_0x40c9('0x21'),JSON[_0x40c9('0x23')](_0x4d6f9e));if(_0x4d6f9e['error']){if(_0x4d6f9e[_0x40c9('0x24')][_0x40c9('0x25')]===0x1f4){logger[_0x40c9('0x24')](_0x40c9('0x20'),_0x3def4f,_0x4d6f9e[_0x40c9('0x24')][_0x40c9('0x26')]);return _0x2788a8(_0x4d6f9e[_0x40c9('0x24')][_0x40c9('0x26')]);}logger[_0x40c9('0x24')](_0x40c9('0x20'),_0x3def4f,_0x4d6f9e[_0x40c9('0x24')][_0x40c9('0x26')]);return _0x12756b(_0x4d6f9e['error'][_0x40c9('0x26')]);}else{logger['info'](_0x40c9('0x20'),_0x3def4f,_0x40c9('0x21'));_0x12756b(_0x4d6f9e[_0x40c9('0x27')][_0x40c9('0x26')]);}})['catch'](function(_0x42eadf){logger[_0x40c9('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x3def4f,_0x42eadf);_0x2788a8(_0x42eadf);});});}function respondWithStatusCode(_0xc7372e,_0x1cf291){_0x1cf291=_0x1cf291||0xcc;return function(_0x42879d){if(_0x42879d){return _0xc7372e[_0x40c9('0x28')](_0x1cf291);}return _0xc7372e[_0x40c9('0x29')](_0x1cf291)['end']();};}function respondWithResult(_0x4f68ce,_0x34e8d2){_0x34e8d2=_0x34e8d2||0xc8;return function(_0x2011aa){if(_0x2011aa){return _0x4f68ce[_0x40c9('0x29')](_0x34e8d2)[_0x40c9('0x2a')](_0x2011aa);}};}function respondWithFilteredResult(_0x1338e6,_0xa5532f){return function(_0x355657){if(_0x355657){var _0x263516=typeof _0xa5532f['offset']===_0x40c9('0x2b')&&typeof _0xa5532f[_0x40c9('0x2c')]===_0x40c9('0x2b');var _0x42c304=_0x355657[_0x40c9('0x2d')];var _0x2a7a2c=_0x263516?0x0:_0xa5532f[_0x40c9('0x2e')];var _0x46de56=_0x263516?_0x355657[_0x40c9('0x2d')]:_0xa5532f[_0x40c9('0x2e')]+_0xa5532f[_0x40c9('0x2c')];var _0x516382;if(_0x46de56>=_0x42c304){_0x46de56=_0x42c304;_0x516382=0xc8;}else{_0x516382=0xce;}_0x1338e6[_0x40c9('0x29')](_0x516382);return _0x1338e6[_0x40c9('0x2f')]('Content-Range',_0x2a7a2c+'-'+_0x46de56+'/'+_0x42c304)[_0x40c9('0x2a')](_0x355657);}return null;};}function patchUpdates(_0x2c4c03){return function(_0x4e7d85){try{jsonpatch[_0x40c9('0x30')](_0x4e7d85,_0x2c4c03,!![]);}catch(_0x3f2d6b){return BPromise[_0x40c9('0x31')](_0x3f2d6b);}return _0x4e7d85[_0x40c9('0x32')]();};}function saveUpdates(_0x4afdaa,_0x18fd96){return function(_0x2e38b5){if(_0x2e38b5){return _0x2e38b5[_0x40c9('0x33')](_0x4afdaa)[_0x40c9('0x34')](function(_0x342777){return _0x342777;});}return null;};}function removeEntity(_0x424d78,_0x20497e){return function(_0xc740d6){if(_0xc740d6){return _0xc740d6[_0x40c9('0x35')]()[_0x40c9('0x34')](function(){_0x424d78[_0x40c9('0x29')](0xcc)[_0x40c9('0x36')]();});}};}function handleEntityNotFound(_0x342db9,_0x3cfa08){return function(_0xe25a5){if(!_0xe25a5){_0x342db9[_0x40c9('0x28')](0x194);}return _0xe25a5;};}function handleError(_0x1d1311,_0x1c76a2){_0x1c76a2=_0x1c76a2||0x1f4;return function(_0x41dbc8){logger[_0x40c9('0x24')](_0x41dbc8[_0x40c9('0x37')]);if(_0x41dbc8[_0x40c9('0x38')]){delete _0x41dbc8[_0x40c9('0x38')];}_0x1d1311[_0x40c9('0x29')](_0x1c76a2)['send'](_0x41dbc8);};}exports['index']=function(_0x22041a,_0x296fc3){var _0x32a433={},_0x58e062={},_0x4bfb4c={'count':0x0,'rows':[]};var _0x16d8b5=_[_0x40c9('0x39')](db[_0x40c9('0x3a')][_0x40c9('0x3b')],function(_0xedeebe){return{'name':_0xedeebe['fieldName'],'type':_0xedeebe['type'][_0x40c9('0x3c')]};});_0x58e062[_0x40c9('0x3d')]=_[_0x40c9('0x39')](_0x16d8b5,_0x40c9('0x38'));_0x58e062['query']=_[_0x40c9('0x3e')](_0x22041a[_0x40c9('0x3f')]);_0x58e062[_0x40c9('0x40')]=_[_0x40c9('0x41')](_0x58e062[_0x40c9('0x3d')],_0x58e062[_0x40c9('0x3f')]);_0x32a433['attributes']=_[_0x40c9('0x41')](_0x58e062[_0x40c9('0x3d')],qs[_0x40c9('0x42')](_0x22041a[_0x40c9('0x3f')][_0x40c9('0x42')]));_0x32a433['attributes']=_0x32a433[_0x40c9('0x43')][_0x40c9('0x44')]?_0x32a433[_0x40c9('0x43')]:_0x58e062[_0x40c9('0x3d')];if(!_0x22041a[_0x40c9('0x3f')][_0x40c9('0x45')](_0x40c9('0x46'))){_0x32a433[_0x40c9('0x2c')]=qs['limit'](_0x22041a[_0x40c9('0x3f')][_0x40c9('0x2c')]);_0x32a433[_0x40c9('0x2e')]=qs[_0x40c9('0x2e')](_0x22041a[_0x40c9('0x3f')][_0x40c9('0x2e')]);}_0x32a433['order']=qs[_0x40c9('0x47')](_0x22041a[_0x40c9('0x3f')]['sort']);_0x32a433[_0x40c9('0x48')]=qs[_0x40c9('0x40')](_[_0x40c9('0x49')](_0x22041a[_0x40c9('0x3f')],_0x58e062[_0x40c9('0x40')]),_0x16d8b5);if(_0x22041a[_0x40c9('0x3f')][_0x40c9('0x4a')]){_0x32a433[_0x40c9('0x48')]=_['merge'](_0x32a433['where'],{'$or':_[_0x40c9('0x39')](_0x16d8b5,function(_0x2d12d5){if(_0x2d12d5['type']!==_0x40c9('0x4b')){var _0x18c346={};_0x18c346[_0x2d12d5['name']]={'$like':'%'+_0x22041a[_0x40c9('0x3f')][_0x40c9('0x4a')]+'%'};return _0x18c346;}})});}_0x32a433=_['merge']({},_0x32a433,_0x22041a[_0x40c9('0x4c')]);var _0x87fd45={'where':_0x32a433[_0x40c9('0x48')]};return db[_0x40c9('0x3a')][_0x40c9('0x2d')](_0x87fd45)['then'](function(_0x1c9721){_0x4bfb4c[_0x40c9('0x2d')]=_0x1c9721;if(_0x22041a[_0x40c9('0x3f')][_0x40c9('0x4d')]){_0x32a433[_0x40c9('0x4e')]=[{'all':!![]}];}return db[_0x40c9('0x3a')][_0x40c9('0x4f')](_0x32a433);})[_0x40c9('0x34')](function(_0x4c3da1){_0x4bfb4c[_0x40c9('0x50')]=_0x4c3da1;return _0x4bfb4c;})[_0x40c9('0x34')](respondWithFilteredResult(_0x296fc3,_0x32a433))[_0x40c9('0x51')](handleError(_0x296fc3,null));};exports[_0x40c9('0x52')]=function(_0x1ea01e,_0x3bc174){var _0x2f86f6={'raw':!![],'where':{'id':_0x1ea01e[_0x40c9('0x53')]['id']}},_0x52d7a7={};_0x52d7a7[_0x40c9('0x3d')]=_[_0x40c9('0x3e')](db[_0x40c9('0x3a')][_0x40c9('0x3b')]);_0x52d7a7[_0x40c9('0x3f')]=_[_0x40c9('0x3e')](_0x1ea01e[_0x40c9('0x3f')]);_0x52d7a7[_0x40c9('0x40')]=_[_0x40c9('0x41')](_0x52d7a7[_0x40c9('0x3d')],_0x52d7a7[_0x40c9('0x3f')]);_0x2f86f6[_0x40c9('0x43')]=_[_0x40c9('0x41')](_0x52d7a7[_0x40c9('0x3d')],qs['fields'](_0x1ea01e[_0x40c9('0x3f')][_0x40c9('0x42')]));_0x2f86f6[_0x40c9('0x43')]=_0x2f86f6[_0x40c9('0x43')][_0x40c9('0x44')]?_0x2f86f6['attributes']:_0x52d7a7[_0x40c9('0x3d')];if(_0x1ea01e['query'][_0x40c9('0x4d')]){_0x2f86f6[_0x40c9('0x4e')]=[{'all':!![]}];}_0x2f86f6=_['merge']({},_0x2f86f6,_0x1ea01e[_0x40c9('0x4c')]);return db['WhatsappMessage']['find'](_0x2f86f6)[_0x40c9('0x34')](handleEntityNotFound(_0x3bc174,null))['then'](respondWithResult(_0x3bc174,null))[_0x40c9('0x51')](handleError(_0x3bc174,null));};exports[_0x40c9('0x54')]=function(_0x5e71ef,_0x5e9328){return db[_0x40c9('0x3a')][_0x40c9('0x54')](_0x5e71ef['body'],{})['then'](respondWithResult(_0x5e9328,0xc9))[_0x40c9('0x51')](handleError(_0x5e9328,null));};exports['update']=function(_0x14f0ff,_0x1a10ed){if(_0x14f0ff[_0x40c9('0x55')]['id']){delete _0x14f0ff[_0x40c9('0x55')]['id'];}return db[_0x40c9('0x3a')][_0x40c9('0x56')]({'where':{'id':_0x14f0ff[_0x40c9('0x53')]['id']}})[_0x40c9('0x34')](handleEntityNotFound(_0x1a10ed,null))['then'](saveUpdates(_0x14f0ff['body'],null))['then'](respondWithResult(_0x1a10ed,null))[_0x40c9('0x51')](handleError(_0x1a10ed,null));};exports[_0x40c9('0x35')]=function(_0x33f490,_0x198834){return db[_0x40c9('0x3a')][_0x40c9('0x56')]({'where':{'id':_0x33f490['params']['id']}})[_0x40c9('0x34')](handleEntityNotFound(_0x198834,null))[_0x40c9('0x34')](removeEntity(_0x198834,null))[_0x40c9('0x51')](handleError(_0x198834,null));};exports[_0x40c9('0x57')]=function(_0x2a5cb1,_0x1552e1){return db['WhatsappMessage'][_0x40c9('0x57')]()[_0x40c9('0x34')](respondWithResult(_0x1552e1,null))['catch'](handleError(_0x1552e1,null));};var interaction_log=require(_0x40c9('0x13'))(_0x40c9('0x58'));exports[_0x40c9('0x59')]=function(_0x24ae9b,_0x4b7aa2,_0x803d78){var _0x2032f7={'agent':{},'channel':_0x40c9('0x5a')};if(_0x24ae9b[_0x40c9('0x55')]['id']){delete _0x24ae9b[_0x40c9('0x55')]['id'];}_0x24ae9b[_0x40c9('0x55')]['read']=!![];_0x24ae9b[_0x40c9('0x55')][_0x40c9('0x5b')]=moment()[_0x40c9('0x5c')](_0x40c9('0x5d'));_0x24ae9b['body'][_0x40c9('0x5e')]=_0x24ae9b['body'][_0x40c9('0x5e')]||_0x24ae9b[_0x40c9('0x5f')]['id'];_0x2032f7['agent']['id']=_0x24ae9b[_0x40c9('0x55')][_0x40c9('0x5e')];return db[_0x40c9('0x3a')][_0x40c9('0x56')]({'where':{'id':_0x24ae9b[_0x40c9('0x53')]['id'],'UserId':null}})[_0x40c9('0x34')](handleEntityNotFound(_0x4b7aa2,null))['then'](saveUpdates(_0x24ae9b['body'],null))[_0x40c9('0x34')](function(_0x46e5c0){if(_0x46e5c0){_0x2032f7['message']=_0x46e5c0[_0x40c9('0x60')]({'plain':!![]});return db['WhatsappInteraction'][_0x40c9('0x56')]({'where':{'id':_0x46e5c0[_0x40c9('0x61')]}});}return null;})[_0x40c9('0x34')](handleEntityNotFound(_0x4b7aa2,null))['then'](function(_0x317de3){if(_0x317de3){return _0x317de3['update']({'UserId':_0x24ae9b[_0x40c9('0x55')]['UserId'],'read1stAt':_[_0x40c9('0x62')](_0x317de3[_0x40c9('0x63')])?moment()[_0x40c9('0x5c')](_0x40c9('0x5d')):undefined});}return null;})[_0x40c9('0x34')](function(_0x1beef8){if(_0x1beef8){_0x2032f7[_0x40c9('0x64')]=_0x1beef8[_0x40c9('0x60')]({'plain':!![]});interaction_log[_0x40c9('0x1f')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x24ae9b['user']['id'],_0x24ae9b[_0x40c9('0x5f')][_0x40c9('0x38')],_0x24ae9b[_0x40c9('0x5f')][_0x40c9('0x65')],_0x2032f7[_0x40c9('0x64')]['id'],_0x24ae9b[_0x40c9('0x55')]?JSON[_0x40c9('0x23')](_0x24ae9b[_0x40c9('0x55')]):'null');return respondWithRpcPromise(_0x40c9('0x66'),_0x40c9('0x67'),_0x2032f7);}return null;})['then'](function(_0x4070c5){var _0x498fc8=_0x40c9('0x68')+_0x4070c5['message'][_0x40c9('0x69')];return db[_0x40c9('0x6a')][_0x40c9('0x3f')](_0x498fc8,{'type':db['Sequelize'][_0x40c9('0x6b')]['SELECT'],'raw':!![]})[_0x40c9('0x34')](function(_0x2d0d3b){return _0x2d0d3b;});})[_0x40c9('0x34')](function(_0x4b4f1f){if(_0x4b4f1f){_0x2032f7[_0x40c9('0x26')][_0x40c9('0x6c')]=_0x4b4f1f[0x0];if(!_0x24ae9b[_0x40c9('0x55')]['UserId'])return;return db[_0x40c9('0x6d')][_0x40c9('0x56')]({'where':{'id':_0x24ae9b[_0x40c9('0x55')][_0x40c9('0x5e')],'role':_0x40c9('0x6e')},'attributes':['id',_0x40c9('0x38'),_0x40c9('0x6f'),_0x40c9('0x70'),_0x40c9('0x71')],'raw':!![]});}return null;})[_0x40c9('0x34')](function(_0x495b12){if(!_0x495b12)return null;_0x2032f7['message'][_0x40c9('0x6e')]=_0x495b12;return _0x2032f7;})[_0x40c9('0x34')](function(_0x14e3e0){if(_0x14e3e0){if(_0x24ae9b[_0x40c9('0x55')][_0x40c9('0x72')]){_0x2032f7[_0x40c9('0x26')][_0x40c9('0x73')]=util[_0x40c9('0x5c')](_0x40c9('0x74'),_0x24ae9b['user'][_0x40c9('0x38')]);_0x2032f7[_0x40c9('0x26')][_0x40c9('0x75')]=_0x2032f7[_0x40c9('0x75')];_0x2032f7[_0x40c9('0x26')][_0x40c9('0x76')]=_0x2032f7[_0x40c9('0x75')];_0x2032f7[_0x40c9('0x26')][_0x40c9('0x77')]=_0x40c9('0x59');return respondWithRpcPromise(_0x40c9('0x78'),_0x40c9('0x78'),{'event':_0x40c9('0x79'),'message':_0x2032f7['message']},client9002)[_0x40c9('0x34')](function(){return _0x2032f7;});}return _0x2032f7;}return null;})[_0x40c9('0x34')](respondWithResult(_0x4b7aa2,null))[_0x40c9('0x51')](handleError(_0x4b7aa2,null));};var interaction_log=require('../../config/logger')(_0x40c9('0x58'));exports[_0x40c9('0x31')]=function(_0x2ce3cc,_0x5f500d,_0x1f3360){var _0x26fd80={'agent':{},'channel':'whatsapp'};if(_0x2ce3cc['body']['id']){delete _0x2ce3cc[_0x40c9('0x55')]['id'];}_0x2ce3cc['body'][_0x40c9('0x5e')]=_0x2ce3cc[_0x40c9('0x55')]['UserId']||_0x2ce3cc[_0x40c9('0x5f')]['id'];_0x26fd80[_0x40c9('0x6e')]['id']=_0x2ce3cc['body'][_0x40c9('0x5e')];return db[_0x40c9('0x3a')][_0x40c9('0x56')]({'where':{'id':_0x2ce3cc[_0x40c9('0x53')]['id'],'UserId':null}})[_0x40c9('0x34')](handleEntityNotFound(_0x5f500d,null))[_0x40c9('0x34')](function(_0x160ea4){if(_0x160ea4){_0x26fd80[_0x40c9('0x26')]=_0x160ea4[_0x40c9('0x60')]({'plain':!![]});return db[_0x40c9('0x7a')]['find']({'where':{'id':_0x160ea4[_0x40c9('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x5f500d,null))[_0x40c9('0x34')](function(_0x416b30){if(_0x416b30){_0x26fd80[_0x40c9('0x64')]=_0x416b30['get']({'plain':!![]});interaction_log[_0x40c9('0x1f')](_0x40c9('0x7b'),_0x2ce3cc['user']['id'],_0x2ce3cc[_0x40c9('0x5f')][_0x40c9('0x38')],_0x2ce3cc['user'][_0x40c9('0x65')],_0x26fd80['interaction']['id'],_0x2ce3cc[_0x40c9('0x55')]?JSON[_0x40c9('0x23')](_0x2ce3cc['body']):_0x40c9('0x7c'));return respondWithRpcPromise(_0x40c9('0x7d'),'rejectMessage',_0x26fd80);}return null;})['then'](function(_0x57732a){var _0x7ea51c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x57732a['message']['ContactId'];return db[_0x40c9('0x6a')][_0x40c9('0x3f')](_0x7ea51c,{'type':db[_0x40c9('0x7e')]['QueryTypes']['SELECT'],'raw':!![]})[_0x40c9('0x34')](function(_0x4c9713){return _0x4c9713;});})[_0x40c9('0x34')](function(_0x233803){if(_0x233803){_0x26fd80[_0x40c9('0x26')][_0x40c9('0x6c')]=_0x233803[0x0];if(!_0x2ce3cc['body']['UserId'])return;return db[_0x40c9('0x6d')][_0x40c9('0x56')]({'where':{'id':_0x2ce3cc[_0x40c9('0x55')][_0x40c9('0x5e')],'role':_0x40c9('0x6e')},'attributes':['id',_0x40c9('0x38'),_0x40c9('0x6f'),_0x40c9('0x70'),_0x40c9('0x71')],'raw':!![]});}return null;})['then'](function(_0x57a66b){if(!_0x57a66b)return null;_0x26fd80[_0x40c9('0x26')]['agent']=_0x57a66b;return _0x26fd80;})['then'](function(_0xac4e26){if(_0xac4e26){_0xac4e26['message'][_0x40c9('0x73')]=util['format'](_0x40c9('0x74'),_0x2ce3cc[_0x40c9('0x5f')][_0x40c9('0x38')]);_0xac4e26['message'][_0x40c9('0x75')]=_0x26fd80[_0x40c9('0x75')];_0xac4e26[_0x40c9('0x26')][_0x40c9('0x76')]=_0x26fd80[_0x40c9('0x75')];_0xac4e26[_0x40c9('0x26')][_0x40c9('0x77')]=_0x40c9('0x31');respondWithRpcPromise(_0x40c9('0x78'),_0x40c9('0x78'),{'event':_0x40c9('0x7f'),'message':_0xac4e26[_0x40c9('0x26')]},client9002);return _0x26fd80;}return null;})[_0x40c9('0x34')](respondWithResult(_0x5f500d,null))[_0x40c9('0x51')](handleError(_0x5f500d,null));};exports[_0x40c9('0x29')]=function(_0x167a3c,_0xa4a70a,_0x3d21ac){if(_0x167a3c[_0x40c9('0x55')]['id']){delete _0x167a3c[_0x40c9('0x55')]['id'];}var _0x29b1aa;return db[_0x40c9('0x3a')]['find']({'where':{'id':_0x167a3c['params']['id']}})[_0x40c9('0x34')](handleEntityNotFound(_0xa4a70a,null))[_0x40c9('0x34')](function(_0x45f6fd){if(_0x45f6fd){_0x29b1aa=_0x45f6fd;return db['WhatsappAccount'][_0x40c9('0x56')]({'where':{'id':_0x45f6fd[_0x40c9('0x80')]}});}})[_0x40c9('0x34')](handleEntityNotFound(_0xa4a70a,null))[_0x40c9('0x34')](function(_0x363808){if(_0x363808){logger[_0x40c9('0x22')](_0x40c9('0x81'),_0x40c9('0x29'),'received\x20delivery\x20report\x20from',_0x363808[_0x40c9('0x82')],util[_0x40c9('0x83')](_0x167a3c[_0x40c9('0x55')],{'showHidden':![],'depth':null}));switch(_0x363808[_0x40c9('0x82')]){case _0x40c9('0x84'):if(_0x167a3c[_0x40c9('0x55')]['MessageSid']&&_0x167a3c[_0x40c9('0x55')]['MessageSid']===_0x29b1aa['messageId']&&_0x167a3c[_0x40c9('0x55')]['MessageStatus']&&_0x167a3c[_0x40c9('0x55')][_0x40c9('0x85')]===_0x40c9('0x86')){return _0x29b1aa['update']({'read':!![]});}else{logger[_0x40c9('0x24')](_0x40c9('0x87'),_0x40c9('0x29'),_0x40c9('0x84'),util[_0x40c9('0x83')](_0x167a3c[_0x40c9('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x29b1aa;}})[_0x40c9('0x34')](respondWithResult(_0xa4a70a,null))['catch'](handleError(_0xa4a70a,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 097ca99..488ec79 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 _0x26f9=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x551cf2,_0xeea20b){var _0x53191c=function(_0x157686){while(--_0x157686){_0x551cf2['push'](_0x551cf2['shift']());}};_0x53191c(++_0xeea20b);}(_0x26f9,0x16f));var _0x926f=function(_0x282f9a,_0x63dff){_0x282f9a=_0x282f9a-0x0;var _0x52528c=_0x26f9[_0x282f9a];return _0x52528c;};'use strict';var EventEmitter=require(_0x926f('0x0'));var WhatsappMessage=require(_0x926f('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x926f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x926f('0x3')};function emitEvent(_0x1c54cc){return function(_0x542c64,_0x38dd25,_0x40adf5){WhatsappMessageEvents[_0x926f('0x4')](_0x1c54cc+':'+_0x542c64['id'],_0x542c64);WhatsappMessageEvents[_0x926f('0x4')](_0x1c54cc,_0x542c64);_0x40adf5(null);};}for(var e in events){if(events[_0x926f('0x5')](e)){var event=events[e];WhatsappMessage[_0x926f('0x6')](e,emitEvent(event));}}module[_0x926f('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x4b0f=['exports','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x418c3a,_0xafc508){_0x418c3a=_0x418c3a-0x0;var _0x5ebf73=_0x4b0f[_0x418c3a];return _0x5ebf73;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xf4b0('0x0'))['db'][_0xf4b0('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf4b0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf4b0('0x3'),'afterDestroy':_0xf4b0('0x4')};function emitEvent(_0x141c87){return function(_0x28be5f,_0x2a08dc,_0x354cb3){WhatsappMessageEvents[_0xf4b0('0x5')](_0x141c87+':'+_0x28be5f['id'],_0x28be5f);WhatsappMessageEvents[_0xf4b0('0x5')](_0x141c87,_0x28be5f);_0x354cb3(null);};}for(var e in events){if(events[_0xf4b0('0x6')](e)){var event=events[e];WhatsappMessage[_0xf4b0('0x7')](e,emitEvent(event));}}module[_0xf4b0('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 0ac91db..0f7547e 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 _0xd377=['WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','create','body','whatsapp:','remote','/status?token=','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','FULLTEXT','models','get','toLowerCase','direction','secret','UserId'];(function(_0xe84805,_0x2702d9){var _0x398efd=function(_0x37cfad){while(--_0x37cfad){_0xe84805['push'](_0xe84805['shift']());}};_0x398efd(++_0x2702d9);}(_0xd377,0x1a3));var _0x7d37=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd377[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x7d37('0x0'));var logger=require(_0x7d37('0x1'))(_0x7d37('0x2'));var moment=require(_0x7d37('0x3'));var BPromise=require(_0x7d37('0x4'));var rp=require(_0x7d37('0x5'));var fs=require('fs');var path=require(_0x7d37('0x6'));var rimraf=require(_0x7d37('0x7'));var config=require(_0x7d37('0x8'));var attributes=require(_0x7d37('0x9'));module[_0x7d37('0xa')]=function(_0x4b203e,_0xc7520c){return _0x4b203e[_0x7d37('0xb')](_0x7d37('0xc'),attributes,{'tableName':_0x7d37('0xd'),'paranoid':![],'indexes':[{'name':_0x7d37('0xe'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0x7d37('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2618a0,_0x3c452a,_0x38cfa5){var _0x58d272=_0x4b203e[_0x7d37('0x10')];var _0x3e16ef=_0x2618a0[_0x7d37('0x11')]({'plain':!![]});if(_0x3e16ef['direction'][_0x7d37('0x12')]()==='in'||_0x3e16ef[_0x7d37('0x13')][_0x7d37('0x12')]()==='out'&&!_0x3e16ef[_0x7d37('0x14')]&&!_['isNil'](_0x3e16ef[_0x7d37('0x15')])){_0x58d272[_0x7d37('0x16')][_0x7d37('0x17')]({'where':{'id':_0x3e16ef[_0x7d37('0x18')]}})[_0x7d37('0x19')](function(_0x468199){if(_0x468199){_0x468199[_0x7d37('0x1a')]({'lastMsgAt':_0x3e16ef[_0x7d37('0x1b')],'lastMsgDirection':_0x3e16ef['direction'][_0x7d37('0x12')]()});}})['catch'](function(_0x580933){console['error'](_0x580933);});}if(_0x3e16ef[_0x7d37('0x13')]===_0x7d37('0x1c')&&!_0x3e16ef['secret']){var _0x4f3eb4;_0x58d272[_0x7d37('0x1d')][_0x7d37('0x1e')]({'where':{'id':_0x3e16ef[_0x7d37('0x1f')]},'raw':!![]})['then'](function(_0x5e4c2a){_0x4f3eb4=_0x5e4c2a;if(_0x4f3eb4&&_0x4f3eb4['type']){switch(_0x4f3eb4[_0x7d37('0x20')]){case _0x7d37('0x21'):var _0x4ad738=require(_0x7d37('0x21'));if(_0x4f3eb4[_0x7d37('0x22')]&&_0x4f3eb4[_0x7d37('0x23')]&&_0x4f3eb4[_0x7d37('0x24')]){var _0x43f969=new _0x4ad738(_0x4f3eb4['accountSid'],_0x4f3eb4[_0x7d37('0x23')]);_0x43f969['messages'][_0x7d37('0x25')]({'body':_0x3e16ef[_0x7d37('0x26')],'to':_0x7d37('0x27')+_0x3e16ef[_0x7d37('0x24')],'from':_0x7d37('0x27')+_0x4f3eb4[_0x7d37('0x24')],'statusCallback':_0x4f3eb4[_0x7d37('0x28')]+'/api/whatsapp/messages/'+_0x3e16ef['id']+_0x7d37('0x29')+_0x4f3eb4[_0x7d37('0x2a')]})[_0x7d37('0x19')](function(_0x29aca2){if(_0x29aca2[_0x7d37('0x2b')]){return _0x2618a0['update']({'messageId':_0x29aca2['sid']});}})['catch'](function(_0x133852){logger[_0x7d37('0x2c')](_0x7d37('0x2d'),_0x7d37('0x2e'),_0x7d37('0x21'),util[_0x7d37('0x2f')](_0x133852,{'showHidden':![],'depth':null}));});}else{logger[_0x7d37('0x2c')](_0x7d37('0x2d'),_0x7d37('0x2e'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})['finally'](function(){_0x38cfa5();});}else{_0x38cfa5();}}},'charset':'utf8mb4','collate':_0x7d37('0x30')});}; \ No newline at end of file +var _0x2f78=['catch','error','out','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','secret','UserId','findOne','WhatsappInteractionId','then','update','createdAt'];(function(_0x41010e,_0x25e9c5){var _0x59e342=function(_0x37d547){while(--_0x37d547){_0x41010e['push'](_0x41010e['shift']());}};_0x59e342(++_0x25e9c5);}(_0x2f78,0x19f));var _0x82f7=function(_0x4d3d58,_0xa122fe){_0x4d3d58=_0x4d3d58-0x0;var _0xcc3d3c=_0x2f78[_0x4d3d58];return _0xcc3d3c;};'use strict';var _=require(_0x82f7('0x0'));var util=require('util');var logger=require(_0x82f7('0x1'))('api');var moment=require(_0x82f7('0x2'));var BPromise=require(_0x82f7('0x3'));var rp=require(_0x82f7('0x4'));var fs=require('fs');var path=require(_0x82f7('0x5'));var rimraf=require(_0x82f7('0x6'));var config=require(_0x82f7('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0x82f7('0x8')]=function(_0x2887ba,_0xcae3f2){return _0x2887ba[_0x82f7('0x9')](_0x82f7('0xa'),attributes,{'tableName':_0x82f7('0xb'),'paranoid':![],'indexes':[{'name':_0x82f7('0xc'),'fields':[_0x82f7('0xc')]},{'name':_0x82f7('0xd'),'fields':[_0x82f7('0xe')],'type':_0x82f7('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x476420,_0x2e8d29,_0x318020){var _0x44745c=_0x2887ba[_0x82f7('0x10')];var _0xeb84eb=_0x476420['get']({'plain':!![]});if(_0xeb84eb[_0x82f7('0x11')]['toLowerCase']()==='in'||_0xeb84eb[_0x82f7('0x11')][_0x82f7('0x12')]()==='out'&&!_0xeb84eb[_0x82f7('0x13')]&&!_['isNil'](_0xeb84eb[_0x82f7('0x14')])){_0x44745c['WhatsappInteraction'][_0x82f7('0x15')]({'where':{'id':_0xeb84eb[_0x82f7('0x16')]}})[_0x82f7('0x17')](function(_0x5a37de){if(_0x5a37de){_0x5a37de[_0x82f7('0x18')]({'lastMsgAt':_0xeb84eb[_0x82f7('0x19')],'lastMsgDirection':_0xeb84eb[_0x82f7('0x11')][_0x82f7('0x12')]()});}})[_0x82f7('0x1a')](function(_0x11539b){console[_0x82f7('0x1b')](_0x11539b);});}if(_0xeb84eb[_0x82f7('0x11')]===_0x82f7('0x1c')&&!_0xeb84eb[_0x82f7('0x13')]){var _0x2cc643;_0x44745c[_0x82f7('0x1d')][_0x82f7('0x1e')]({'where':{'id':_0xeb84eb['WhatsappAccountId']},'raw':!![]})['then'](function(_0x30af30){_0x2cc643=_0x30af30;if(_0x2cc643&&_0x2cc643[_0x82f7('0x1f')]){switch(_0x2cc643['type']){case _0x82f7('0x20'):var _0x1fa904=require(_0x82f7('0x20'));if(_0x2cc643[_0x82f7('0x21')]&&_0x2cc643[_0x82f7('0x22')]&&_0x2cc643[_0x82f7('0x23')]){var _0x2c51ad=new _0x1fa904(_0x2cc643[_0x82f7('0x21')],_0x2cc643[_0x82f7('0x22')]);_0x2c51ad[_0x82f7('0x24')][_0x82f7('0x25')]({'body':_0xeb84eb[_0x82f7('0xe')],'to':_0x82f7('0x26')+_0xeb84eb['phone'],'from':_0x82f7('0x26')+_0x2cc643[_0x82f7('0x23')],'statusCallback':_0x2cc643[_0x82f7('0x27')]+_0x82f7('0x28')+_0xeb84eb['id']+_0x82f7('0x29')+_0x2cc643[_0x82f7('0x2a')]})[_0x82f7('0x17')](function(_0x100ef1){if(_0x100ef1[_0x82f7('0x2b')]){return _0x476420[_0x82f7('0x18')]({'messageId':_0x100ef1['sid']});}})[_0x82f7('0x1a')](function(_0x4b24ed){logger[_0x82f7('0x1b')](_0x82f7('0x2c'),'afterCreate',_0x82f7('0x20'),util[_0x82f7('0x2d')](_0x4b24ed,{'showHidden':![],'depth':null}));});}else{logger[_0x82f7('0x1b')](_0x82f7('0x2c'),_0x82f7('0x2e'),_0x82f7('0x20'),_0x82f7('0x2f'));}break;}}})['finally'](function(){_0x318020();});}else{_0x318020();}}},'charset':_0x82f7('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index c246e81..f2b93aa 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 _0x6eff=['options','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','catch','CreateWhatsappMessage','create','body'];(function(_0x1c9c24,_0x2a517b){var _0x349c69=function(_0x259ff7){while(--_0x259ff7){_0x1c9c24['push'](_0x1c9c24['shift']());}};_0x349c69(++_0x2a517b);}(_0x6eff,0xc2));var _0xf6ef=function(_0x4d337e,_0x2f7eed){_0x4d337e=_0x4d337e-0x0;var _0x247963=_0x6eff[_0x4d337e];return _0x247963;};'use strict';var _=require(_0xf6ef('0x0'));var util=require(_0xf6ef('0x1'));var moment=require('moment');var BPromise=require(_0xf6ef('0x2'));var rs=require(_0xf6ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6ef('0x4'))['db'];var utils=require(_0xf6ef('0x5'));var logger=require(_0xf6ef('0x6'))('rpc');var config=require(_0xf6ef('0x7'));var jayson=require(_0xf6ef('0x8'));var client=jayson[_0xf6ef('0x9')][_0xf6ef('0xa')]({'port':0x232a});config[_0xf6ef('0xb')]=_[_0xf6ef('0xc')](config[_0xf6ef('0xb')],{'host':_0xf6ef('0xd'),'port':0x18eb});var socket=require(_0xf6ef('0xe'))(new Redis(config[_0xf6ef('0xb')]));require(_0xf6ef('0xf'))[_0xf6ef('0x10')](socket);function respondWithRpcPromise(_0x585862,_0x39d53d,_0x1f1a89){return new BPromise(function(_0x490eb9,_0xc6732b){return client['request'](_0x585862,_0x1f1a89)[_0xf6ef('0x11')](function(_0x179705){logger[_0xf6ef('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x39d53d,_0xf6ef('0x13'));logger[_0xf6ef('0x14')](_0xf6ef('0x15'),_0x39d53d,'request\x20sent',JSON[_0xf6ef('0x16')](_0x179705));if(_0x179705[_0xf6ef('0x17')]){if(_0x179705[_0xf6ef('0x17')]['code']===0x1f4){logger[_0xf6ef('0x17')](_0xf6ef('0x18'),_0x39d53d,_0x179705[_0xf6ef('0x17')][_0xf6ef('0x19')]);return _0xc6732b(_0x179705[_0xf6ef('0x17')][_0xf6ef('0x19')]);}logger[_0xf6ef('0x17')](_0xf6ef('0x18'),_0x39d53d,_0x179705[_0xf6ef('0x17')][_0xf6ef('0x19')]);return _0x490eb9(_0x179705[_0xf6ef('0x17')][_0xf6ef('0x19')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x39d53d,_0xf6ef('0x13'));_0x490eb9(_0x179705['result'][_0xf6ef('0x19')]);}})[_0xf6ef('0x1a')](function(_0x4ba456){logger[_0xf6ef('0x17')](_0xf6ef('0x18'),_0x39d53d,_0x4ba456);_0xc6732b(_0x4ba456);});});}exports[_0xf6ef('0x1b')]=function(_0x77133b){var _0x2ba48d=this;return new Promise(function(_0x3c4e97,_0x525d1a){return db['WhatsappMessage'][_0xf6ef('0x1c')](_0x77133b[_0xf6ef('0x1d')],{'raw':_0x77133b[_0xf6ef('0x1e')]?_0x77133b['options'][_0xf6ef('0x1f')]===undefined?!![]:![]:!![]})[_0xf6ef('0x11')](function(_0x597596){logger['info']('CreateWhatsappMessage',_0x77133b);logger['debug'](_0xf6ef('0x1b'),_0x77133b,JSON[_0xf6ef('0x16')](_0x597596));_0x3c4e97(_0x597596);})[_0xf6ef('0x1a')](function(_0x745c1d){logger[_0xf6ef('0x17')](_0xf6ef('0x1b'),_0x745c1d[_0xf6ef('0x19')],_0x77133b);_0x525d1a(_0x2ba48d[_0xf6ef('0x17')](0x1f4,_0x745c1d[_0xf6ef('0x19')]));});});}; \ No newline at end of file +var _0xca13=['info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then'];(function(_0x267692,_0x229aaa){var _0x209905=function(_0x252e4c){while(--_0x252e4c){_0x267692['push'](_0x267692['shift']());}};_0x209905(++_0x229aaa);}(_0xca13,0x1af));var _0x3ca1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xca13[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ca1('0x0'));var BPromise=require(_0x3ca1('0x1'));var rs=require(_0x3ca1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ca1('0x3'))['db'];var utils=require(_0x3ca1('0x4'));var logger=require('../../config/logger')(_0x3ca1('0x5'));var config=require(_0x3ca1('0x6'));var jayson=require(_0x3ca1('0x7'));var client=jayson['client'][_0x3ca1('0x8')]({'port':0x232a});config[_0x3ca1('0x9')]=_[_0x3ca1('0xa')](config[_0x3ca1('0x9')],{'host':_0x3ca1('0xb'),'port':0x18eb});var socket=require(_0x3ca1('0xc'))(new Redis(config[_0x3ca1('0x9')]));require(_0x3ca1('0xd'))[_0x3ca1('0xe')](socket);function respondWithRpcPromise(_0x40f9ae,_0x2bdd2a,_0x3e868d){return new BPromise(function(_0x19d6b3,_0x45a199){return client[_0x3ca1('0xf')](_0x40f9ae,_0x3e868d)[_0x3ca1('0x10')](function(_0x5bfc3a){logger[_0x3ca1('0x11')](_0x3ca1('0x12'),_0x2bdd2a,'request\x20sent');logger[_0x3ca1('0x13')](_0x3ca1('0x14'),_0x2bdd2a,_0x3ca1('0x15'),JSON[_0x3ca1('0x16')](_0x5bfc3a));if(_0x5bfc3a[_0x3ca1('0x17')]){if(_0x5bfc3a[_0x3ca1('0x17')][_0x3ca1('0x18')]===0x1f4){logger[_0x3ca1('0x17')](_0x3ca1('0x12'),_0x2bdd2a,_0x5bfc3a[_0x3ca1('0x17')][_0x3ca1('0x19')]);return _0x45a199(_0x5bfc3a[_0x3ca1('0x17')][_0x3ca1('0x19')]);}logger[_0x3ca1('0x17')](_0x3ca1('0x12'),_0x2bdd2a,_0x5bfc3a[_0x3ca1('0x17')][_0x3ca1('0x19')]);return _0x19d6b3(_0x5bfc3a[_0x3ca1('0x17')][_0x3ca1('0x19')]);}else{logger['info'](_0x3ca1('0x12'),_0x2bdd2a,_0x3ca1('0x15'));_0x19d6b3(_0x5bfc3a['result'][_0x3ca1('0x19')]);}})[_0x3ca1('0x1a')](function(_0x487559){logger[_0x3ca1('0x17')](_0x3ca1('0x12'),_0x2bdd2a,_0x487559);_0x45a199(_0x487559);});});}exports[_0x3ca1('0x1b')]=function(_0x3bac23){var _0x498eb6=this;return new Promise(function(_0x23e433,_0x2e5e80){return db[_0x3ca1('0x1c')][_0x3ca1('0x1d')](_0x3bac23['body'],{'raw':_0x3bac23[_0x3ca1('0x1e')]?_0x3bac23[_0x3ca1('0x1e')][_0x3ca1('0x1f')]===undefined?!![]:![]:!![]})[_0x3ca1('0x10')](function(_0x2ef076){logger[_0x3ca1('0x11')](_0x3ca1('0x1b'),_0x3bac23);logger['debug']('CreateWhatsappMessage',_0x3bac23,JSON[_0x3ca1('0x16')](_0x2ef076));_0x23e433(_0x2ef076);})[_0x3ca1('0x1a')](function(_0x71e1b1){logger[_0x3ca1('0x17')](_0x3ca1('0x1b'),_0x71e1b1[_0x3ca1('0x19')],_0x3bac23);_0x2e5e80(_0x498eb6[_0x3ca1('0x17')](0x1f4,_0x71e1b1[_0x3ca1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 811db2b..e295351 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 _0x11e3=['update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','remove'];(function(_0x373674,_0x2530a8){var _0x471ee3=function(_0x12bca3){while(--_0x12bca3){_0x373674['push'](_0x373674['shift']());}};_0x471ee3(++_0x2530a8);}(_0x11e3,0x15c));var _0x311e=function(_0x508215,_0x5a3b72){_0x508215=_0x508215-0x0;var _0x52b2f4=_0x11e3[_0x508215];return _0x52b2f4;};'use strict';var WhatsappMessageEvents=require(_0x311e('0x0'));var events=[_0x311e('0x1'),_0x311e('0x2'),_0x311e('0x3')];function createListener(_0x5b05d5,_0x48be7a){return function(_0x43f954){_0x48be7a[_0x311e('0x4')](_0x5b05d5,_0x43f954);};}function removeListener(_0x5e6427,_0x5c1999){return function(){WhatsappMessageEvents[_0x311e('0x5')](_0x5e6427,_0x5c1999);};}exports[_0x311e('0x6')]=function(_0x959c63){for(var _0x7fdf2=0x0,_0x50853b=events[_0x311e('0x7')];_0x7fdf2<_0x50853b;_0x7fdf2++){var _0x5e2293=events[_0x7fdf2];var _0x460983=createListener(_0x311e('0x8')+_0x5e2293,_0x959c63);WhatsappMessageEvents['on'](_0x5e2293,_0x460983);}}; \ No newline at end of file +var _0x0726=['remove','emit','removeListener','register','whatsappMessage:','./whatsappMessage.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0726,0x16d));var _0x6072=function(_0x4b75b1,_0x426fc4){_0x4b75b1=_0x4b75b1-0x0;var _0x2c73f6=_0x0726[_0x4b75b1];return _0x2c73f6;};'use strict';var WhatsappMessageEvents=require(_0x6072('0x0'));var events=['save',_0x6072('0x1'),'update'];function createListener(_0x48c6d7,_0x45636e){return function(_0x41e3ad){_0x45636e[_0x6072('0x2')](_0x48c6d7,_0x41e3ad);};}function removeListener(_0x2253ed,_0x55598f){return function(){WhatsappMessageEvents[_0x6072('0x3')](_0x2253ed,_0x55598f);};}exports[_0x6072('0x4')]=function(_0x3745c1){for(var _0x5bd8a1=0x0,_0x4e900f=events['length'];_0x5bd8a1<_0x4e900f;_0x5bd8a1++){var _0xcea004=events[_0x5bd8a1];var _0x5d4bf2=createListener(_0x6072('0x5')+_0xcea004,_0x3745c1);WhatsappMessageEvents['on'](_0xcea004,_0x5d4bf2);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index cb4451a..d83b998 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 _0x5f05=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','destroy','removeTeams','exports'];(function(_0x261979,_0x481f17){var _0x506ffb=function(_0x2e6846){while(--_0x2e6846){_0x261979['push'](_0x261979['shift']());}};_0x506ffb(++_0x481f17);}(_0x5f05,0xe0));var _0x55f0=function(_0x57e950,_0x4537a5){_0x57e950=_0x57e950-0x0;var _0x2f381c=_0x5f05[_0x57e950];return _0x2f381c;};'use strict';var multer=require(_0x55f0('0x0'));var util=require(_0x55f0('0x1'));var path=require('path');var timeout=require(_0x55f0('0x2'));var express=require(_0x55f0('0x3'));var router=express['Router']();var fs_extra=require(_0x55f0('0x4'));var auth=require(_0x55f0('0x5'));var interaction=require(_0x55f0('0x6'));var config=require('../../config/environment');var controller=require(_0x55f0('0x7'));router[_0x55f0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x55f0('0x9'),auth[_0x55f0('0xa')](),controller[_0x55f0('0xb')]);router[_0x55f0('0x8')](_0x55f0('0xc'),auth[_0x55f0('0xa')](),controller['show']);router[_0x55f0('0x8')](_0x55f0('0xd'),auth[_0x55f0('0xa')](),controller[_0x55f0('0xe')]);router[_0x55f0('0x8')](_0x55f0('0xf'),auth['isAuthenticated'](),controller[_0x55f0('0x10')]);router[_0x55f0('0x8')](_0x55f0('0x11'),auth[_0x55f0('0xa')](),controller[_0x55f0('0x12')]);router[_0x55f0('0x13')]('/',auth[_0x55f0('0xa')](),controller[_0x55f0('0x14')]);router['post'](_0x55f0('0xf'),auth[_0x55f0('0xa')](),controller[_0x55f0('0x15')]);router[_0x55f0('0x13')](_0x55f0('0x11'),auth[_0x55f0('0xa')](),controller['addAgents']);router[_0x55f0('0x16')](_0x55f0('0xc'),auth[_0x55f0('0xa')](),controller[_0x55f0('0x17')]);router[_0x55f0('0x18')](_0x55f0('0xc'),auth[_0x55f0('0xa')](),controller[_0x55f0('0x19')]);router[_0x55f0('0x18')](_0x55f0('0xf'),auth[_0x55f0('0xa')](),controller[_0x55f0('0x1a')]);router[_0x55f0('0x18')](_0x55f0('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x55f0('0x1b')]=router; \ No newline at end of file +var _0x987e=['addAgents','put','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','describe','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams'];(function(_0x4239f7,_0x488b3d){var _0x2ffcca=function(_0x7383c6){while(--_0x7383c6){_0x4239f7['push'](_0x4239f7['shift']());}};_0x2ffcca(++_0x488b3d);}(_0x987e,0xfb));var _0xe987=function(_0x556708,_0x51aaab){_0x556708=_0x556708-0x0;var _0x5773ab=_0x987e[_0x556708];return _0x5773ab;};'use strict';var multer=require(_0xe987('0x0'));var util=require(_0xe987('0x1'));var path=require('path');var timeout=require(_0xe987('0x2'));var express=require(_0xe987('0x3'));var router=express[_0xe987('0x4')]();var fs_extra=require(_0xe987('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe987('0x6'));var controller=require(_0xe987('0x7'));router[_0xe987('0x8')]('/',auth[_0xe987('0x9')](),controller['index']);router[_0xe987('0x8')]('/describe',auth[_0xe987('0x9')](),controller[_0xe987('0xa')]);router[_0xe987('0x8')]('/:id',auth[_0xe987('0x9')](),controller['show']);router[_0xe987('0x8')](_0xe987('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xe987('0x8')](_0xe987('0xc'),auth[_0xe987('0x9')](),controller[_0xe987('0xd')]);router[_0xe987('0x8')](_0xe987('0xe'),auth[_0xe987('0x9')](),controller[_0xe987('0xf')]);router[_0xe987('0x10')]('/',auth[_0xe987('0x9')](),controller[_0xe987('0x11')]);router['post'](_0xe987('0xc'),auth['isAuthenticated'](),controller[_0xe987('0x12')]);router[_0xe987('0x10')]('/:id/users',auth[_0xe987('0x9')](),controller[_0xe987('0x13')]);router[_0xe987('0x14')]('/:id',auth[_0xe987('0x9')](),controller['update']);router[_0xe987('0x15')](_0xe987('0x16'),auth[_0xe987('0x9')](),controller[_0xe987('0x17')]);router['delete']('/:id/teams',auth[_0xe987('0x9')](),controller[_0xe987('0x18')]);router[_0xe987('0x15')]('/:id/users',auth[_0xe987('0x9')](),controller[_0xe987('0x19')]);module[_0xe987('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index d488855..39f4ddb 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 _0x7834=['rrmemory','beepall','roundrobin','STRING','sequelize','name','ENUM'];(function(_0x57f32f,_0x5aa6ea){var _0x3b30c6=function(_0x20da0c){while(--_0x20da0c){_0x57f32f['push'](_0x57f32f['shift']());}};_0x3b30c6(++_0x5aa6ea);}(_0x7834,0x13f));var _0x4783=function(_0x3e7fb3,_0x2d9a8e){_0x3e7fb3=_0x3e7fb3-0x0;var _0x14d83d=_0x7834[_0x3e7fb3];return _0x14d83d;};'use strict';var Sequelize=require(_0x4783('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4783('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4783('0x2')](_0x4783('0x3'),_0x4783('0x4'),_0x4783('0x5'))},'description':{'type':Sequelize[_0x4783('0x6')]}}; \ No newline at end of file +var _0x0fc2=['STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0x0fc2,0x6e));var _0x20fc=function(_0xd6a21b,_0xbfe245){_0xd6a21b=_0xd6a21b-0x0;var _0x275d2c=_0x0fc2[_0xd6a21b];return _0x275d2c;};'use strict';var Sequelize=require(_0x20fc('0x0'));module[_0x20fc('0x1')]={'name':{'type':Sequelize[_0x20fc('0x2')],'unique':_0x20fc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x20fc('0x4')](_0x20fc('0x5'),_0x20fc('0x6'),_0x20fc('0x7'))},'description':{'type':Sequelize[_0x20fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index a800fe7..eda0ac4 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 _0x7290=['apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','send','index','map','WhatsappQueue','fieldName','type','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserWhatsappQueue','rawAttributes','nolimit','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','QueryTypes','SELECT','every','value','isEmpty','removeAgents','addAgents','omit','spread','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set'];(function(_0x5ab05b,_0x59ba0f){var _0x47b4ac=function(_0x100950){while(--_0x100950){_0x5ab05b['push'](_0x5ab05b['shift']());}};_0x47b4ac(++_0x59ba0f);}(_0x7290,0x64));var _0x0729=function(_0x11bf1b,_0x50581b){_0x11bf1b=_0x11bf1b-0x0;var _0x387d1c=_0x7290[_0x11bf1b];return _0x387d1c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0729('0x0'));var zipdir=require(_0x0729('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0729('0x2'));var moment=require(_0x0729('0x3'));var BPromise=require(_0x0729('0x4'));var Mustache=require(_0x0729('0x5'));var util=require(_0x0729('0x6'));var path=require(_0x0729('0x7'));var sox=require(_0x0729('0x8'));var csv=require('to-csv');var ejs=require(_0x0729('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0729('0xa'));var crypto=require('crypto');var jsforce=require(_0x0729('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0729('0xc'));var Papa=require(_0x0729('0xd'));var Redis=require(_0x0729('0xe'));var authService=require(_0x0729('0xf'));var qs=require(_0x0729('0x10'));var as=require(_0x0729('0x11'));var hardwareService=require(_0x0729('0x12'));var logger=require(_0x0729('0x13'))(_0x0729('0x14'));var utils=require(_0x0729('0x15'));var config=require(_0x0729('0x16'));var licenseUtil=require(_0x0729('0x17'));var db=require('../../mysqldb')['db'];config[_0x0729('0x18')]=_[_0x0729('0x19')](config[_0x0729('0x18')],{'host':_0x0729('0x1a'),'port':0x18eb});var socket=require(_0x0729('0x1b'))(new Redis(config[_0x0729('0x18')]));require('./whatsappQueue.socket')[_0x0729('0x1c')](socket);function respondWithStatusCode(_0x488e5c,_0x3012dc){_0x3012dc=_0x3012dc||0xcc;return function(_0x12602f){if(_0x12602f){return _0x488e5c[_0x0729('0x1d')](_0x3012dc);}return _0x488e5c[_0x0729('0x1e')](_0x3012dc)['end']();};}function respondWithResult(_0x2caef7,_0x12a081){_0x12a081=_0x12a081||0xc8;return function(_0x11483f){if(_0x11483f){return _0x2caef7['status'](_0x12a081)[_0x0729('0x1f')](_0x11483f);}};}function respondWithFilteredResult(_0x23703b,_0x6d048a){return function(_0x51bb82){if(_0x51bb82){var _0x435efb=typeof _0x6d048a[_0x0729('0x20')]===_0x0729('0x21')&&typeof _0x6d048a['limit']===_0x0729('0x21');var _0x252467=_0x51bb82[_0x0729('0x22')];var _0x10083b=_0x435efb?0x0:_0x6d048a['offset'];var _0x73bf5e=_0x435efb?_0x51bb82[_0x0729('0x22')]:_0x6d048a['offset']+_0x6d048a[_0x0729('0x23')];var _0x4d595f;if(_0x73bf5e>=_0x252467){_0x73bf5e=_0x252467;_0x4d595f=0xc8;}else{_0x4d595f=0xce;}_0x23703b[_0x0729('0x1e')](_0x4d595f);return _0x23703b[_0x0729('0x24')]('Content-Range',_0x10083b+'-'+_0x73bf5e+'/'+_0x252467)[_0x0729('0x1f')](_0x51bb82);}return null;};}function patchUpdates(_0x5759d6){return function(_0x4a484e){try{jsonpatch[_0x0729('0x25')](_0x4a484e,_0x5759d6,!![]);}catch(_0x3161c8){return BPromise[_0x0729('0x26')](_0x3161c8);}return _0x4a484e[_0x0729('0x27')]();};}function saveUpdates(_0x3158b3,_0x1f635a){return function(_0x584214){if(_0x584214){return _0x584214[_0x0729('0x28')](_0x3158b3)[_0x0729('0x29')](function(_0x3339cd){return _0x3339cd;});}return null;};}function removeEntity(_0x5954b0,_0x1716ef){return function(_0x4d9270){if(_0x4d9270){return _0x4d9270[_0x0729('0x2a')]()['then'](function(){var _0x364b02=_0x4d9270[_0x0729('0x2b')]({'plain':!![]});var _0x2a4baa='WhatsappQueues';return db[_0x0729('0x2c')][_0x0729('0x2a')]({'where':{'type':_0x2a4baa,'resourceId':_0x364b02['id']}})[_0x0729('0x29')](function(){return _0x4d9270;});})[_0x0729('0x29')](function(){_0x5954b0[_0x0729('0x1e')](0xcc)[_0x0729('0x2d')]();});}};}function handleEntityNotFound(_0x86c178,_0x1ee8fb){return function(_0x1cf376){if(!_0x1cf376){_0x86c178[_0x0729('0x1d')](0x194);}return _0x1cf376;};}function handleError(_0x452a12,_0xa32245){_0xa32245=_0xa32245||0x1f4;return function(_0x5dc9c2){logger[_0x0729('0x2e')](_0x5dc9c2['stack']);if(_0x5dc9c2['name']){delete _0x5dc9c2['name'];}_0x452a12[_0x0729('0x1e')](_0xa32245)[_0x0729('0x2f')](_0x5dc9c2);};}exports[_0x0729('0x30')]=function(_0x2da14c,_0x160768){var _0x314411={},_0xc44b97={},_0x56a4d9={'count':0x0,'rows':[]};var _0x2397c6=_[_0x0729('0x31')](db[_0x0729('0x32')]['rawAttributes'],function(_0x55c6d9){return{'name':_0x55c6d9[_0x0729('0x33')],'type':_0x55c6d9[_0x0729('0x34')]['key']};});_0xc44b97[_0x0729('0x35')]=_[_0x0729('0x31')](_0x2397c6,_0x0729('0x36'));_0xc44b97[_0x0729('0x37')]=_[_0x0729('0x38')](_0x2da14c['query']);_0xc44b97['filters']=_[_0x0729('0x39')](_0xc44b97[_0x0729('0x35')],_0xc44b97[_0x0729('0x37')]);_0x314411['attributes']=_[_0x0729('0x39')](_0xc44b97[_0x0729('0x35')],qs[_0x0729('0x3a')](_0x2da14c[_0x0729('0x37')][_0x0729('0x3a')]));_0x314411[_0x0729('0x3b')]=_0x314411[_0x0729('0x3b')][_0x0729('0x3c')]?_0x314411[_0x0729('0x3b')]:_0xc44b97[_0x0729('0x35')];if(!_0x2da14c['query'][_0x0729('0x3d')]('nolimit')){_0x314411[_0x0729('0x23')]=qs['limit'](_0x2da14c[_0x0729('0x37')][_0x0729('0x23')]);_0x314411['offset']=qs[_0x0729('0x20')](_0x2da14c['query']['offset']);}_0x314411[_0x0729('0x3e')]=qs[_0x0729('0x3f')](_0x2da14c[_0x0729('0x37')][_0x0729('0x3f')]);_0x314411[_0x0729('0x40')]=qs[_0x0729('0x41')](_[_0x0729('0x42')](_0x2da14c[_0x0729('0x37')],_0xc44b97[_0x0729('0x41')]),_0x2397c6);if(_0x2da14c[_0x0729('0x37')][_0x0729('0x43')]){_0x314411[_0x0729('0x40')]=_[_0x0729('0x44')](_0x314411[_0x0729('0x40')],{'$or':_[_0x0729('0x31')](_0x2397c6,function(_0x344694){if(_0x344694[_0x0729('0x34')]!==_0x0729('0x45')){var _0x175678={};_0x175678[_0x344694[_0x0729('0x36')]]={'$like':'%'+_0x2da14c[_0x0729('0x37')][_0x0729('0x43')]+'%'};return _0x175678;}})});}_0x314411=_[_0x0729('0x44')]({},_0x314411,_0x2da14c[_0x0729('0x46')]);var _0x145f2b={'where':_0x314411[_0x0729('0x40')]};return db[_0x0729('0x32')]['count'](_0x145f2b)['then'](function(_0x5ac176){_0x56a4d9[_0x0729('0x22')]=_0x5ac176;if(_0x2da14c[_0x0729('0x37')]['includeAll']){_0x314411['include']=[{'all':!![]}];}return db[_0x0729('0x32')][_0x0729('0x47')](_0x314411);})[_0x0729('0x29')](function(_0x32991d){_0x56a4d9[_0x0729('0x48')]=_0x32991d;return _0x56a4d9;})['then'](respondWithFilteredResult(_0x160768,_0x314411))[_0x0729('0x49')](handleError(_0x160768,null));};exports[_0x0729('0x4a')]=function(_0x16b4ef,_0xa0bf5){var _0x10f181={'raw':!![],'where':{'id':_0x16b4ef['params']['id']}},_0x4461ca={};_0x4461ca[_0x0729('0x35')]=_[_0x0729('0x38')](db['WhatsappQueue']['rawAttributes']);_0x4461ca['query']=_['keys'](_0x16b4ef[_0x0729('0x37')]);_0x4461ca[_0x0729('0x41')]=_['intersection'](_0x4461ca['model'],_0x4461ca[_0x0729('0x37')]);_0x10f181[_0x0729('0x3b')]=_[_0x0729('0x39')](_0x4461ca['model'],qs['fields'](_0x16b4ef['query']['fields']));_0x10f181['attributes']=_0x10f181[_0x0729('0x3b')][_0x0729('0x3c')]?_0x10f181[_0x0729('0x3b')]:_0x4461ca[_0x0729('0x35')];if(_0x16b4ef[_0x0729('0x37')][_0x0729('0x4b')]){_0x10f181['include']=[{'all':!![]}];}_0x10f181=_['merge']({},_0x10f181,_0x16b4ef[_0x0729('0x46')]);return db[_0x0729('0x32')][_0x0729('0x4c')](_0x10f181)[_0x0729('0x29')](handleEntityNotFound(_0xa0bf5,null))['then'](respondWithResult(_0xa0bf5,null))[_0x0729('0x49')](handleError(_0xa0bf5,null));};exports['create']=function(_0x54eb19,_0x1d94f1){return db[_0x0729('0x32')][_0x0729('0x4d')](_0x54eb19[_0x0729('0x4e')],{})['then'](function(_0x14a22f){var _0x48f3ec=_0x54eb19[_0x0729('0x4f')][_0x0729('0x2b')]({'plain':!![]});if(!_0x48f3ec)throw new Error(_0x0729('0x50'));if(_0x48f3ec[_0x0729('0x51')]===_0x0729('0x4f')){var _0x1ce10c=_0x14a22f[_0x0729('0x2b')]({'plain':!![]});var _0x12f90e=_0x0729('0x52');return db[_0x0729('0x53')][_0x0729('0x4c')]({'where':{'name':_0x12f90e,'userProfileId':_0x48f3ec[_0x0729('0x54')]},'raw':!![]})[_0x0729('0x29')](function(_0x1ddc31){if(_0x1ddc31&&_0x1ddc31[_0x0729('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x1ce10c[_0x0729('0x36')],'resourceId':_0x1ce10c['id'],'type':_0x1ddc31[_0x0729('0x36')],'sectionId':_0x1ddc31['id']},{})[_0x0729('0x29')](function(){return _0x14a22f;});}else{return _0x14a22f;}})[_0x0729('0x49')](function(_0x3ebff3){logger[_0x0729('0x2e')](_0x0729('0x56'),_0x3ebff3);throw _0x3ebff3;});}return _0x14a22f;})['then'](respondWithResult(_0x1d94f1,0xc9))[_0x0729('0x49')](handleError(_0x1d94f1,null));};exports['update']=function(_0xd22573,_0x4df4ea){if(_0xd22573['body']['id']){delete _0xd22573[_0x0729('0x4e')]['id'];}return db[_0x0729('0x32')][_0x0729('0x4c')]({'where':{'id':_0xd22573['params']['id']}})['then'](handleEntityNotFound(_0x4df4ea,null))[_0x0729('0x29')](saveUpdates(_0xd22573[_0x0729('0x4e')],null))[_0x0729('0x29')](respondWithResult(_0x4df4ea,null))['catch'](handleError(_0x4df4ea,null));};exports[_0x0729('0x2a')]=function(_0x490ab8,_0x26ce8c){return db['WhatsappQueue'][_0x0729('0x4c')]({'where':{'id':_0x490ab8[_0x0729('0x57')]['id']}})[_0x0729('0x29')](handleEntityNotFound(_0x26ce8c,null))[_0x0729('0x29')](removeEntity(_0x26ce8c,null))[_0x0729('0x49')](handleError(_0x26ce8c,null));};exports[_0x0729('0x58')]=function(_0xbccc9d,_0x56539c){return db['WhatsappQueue'][_0x0729('0x58')]()[_0x0729('0x29')](respondWithResult(_0x56539c,null))[_0x0729('0x49')](handleError(_0x56539c,null));};exports['getMembers']=function(_0x160448,_0x5b5859,_0x44c6ce){var _0x60295={'raw':!![],'where':{}},_0x203150={},_0x4fa57d;return db['WhatsappQueue'][_0x0729('0x59')]({'where':{'id':_0x160448['params']['id']}})['then'](handleEntityNotFound(_0x5b5859,null))[_0x0729('0x29')](function(_0x2efe7a){if(_0x2efe7a){_0x4fa57d=_0x2efe7a[_0x0729('0x2b')]({'plain':!![]});_0x203150['model']=_[_0x0729('0x38')](db[_0x0729('0x5a')][_0x0729('0x5b')]);_0x203150[_0x0729('0x37')]=_['keys'](_0x160448[_0x0729('0x37')]);_0x203150[_0x0729('0x41')]=_[_0x0729('0x39')](_0x203150[_0x0729('0x35')],_0x203150[_0x0729('0x37')]);_0x60295[_0x0729('0x3b')]=_[_0x0729('0x39')](_0x203150[_0x0729('0x35')],qs['fields'](_0x160448['query'][_0x0729('0x3a')]));_0x60295[_0x0729('0x3b')]=_0x60295[_0x0729('0x3b')][_0x0729('0x3c')]?_0x60295[_0x0729('0x3b')]:_0x203150[_0x0729('0x35')];if(!_0x160448[_0x0729('0x37')]['hasOwnProperty'](_0x0729('0x5c'))){_0x60295[_0x0729('0x23')]=qs['limit'](_0x160448[_0x0729('0x37')][_0x0729('0x23')]);_0x60295[_0x0729('0x20')]=qs['offset'](_0x160448[_0x0729('0x37')][_0x0729('0x20')]);}_0x60295[_0x0729('0x3e')]=qs[_0x0729('0x3f')](_0x160448['query'][_0x0729('0x3f')]);_0x60295[_0x0729('0x40')]=qs[_0x0729('0x41')](_[_0x0729('0x42')](_0x160448[_0x0729('0x37')],_0x203150['filters']));_0x60295['where'][_0x0729('0x5d')]=_0x2efe7a['id'];if(_0x160448[_0x0729('0x37')][_0x0729('0x43')]){_0x60295[_0x0729('0x40')]=_['merge'](_0x60295['where'],{'$or':_[_0x0729('0x31')](_0x60295[_0x0729('0x3b')],function(_0x2e797f){var _0x4b3c43={};_0x4b3c43[_0x2e797f]={'$like':'%'+_0x160448[_0x0729('0x37')][_0x0729('0x43')]+'%'};return _0x4b3c43;})});}_0x60295=_[_0x0729('0x44')]({},_0x60295,_0x160448[_0x0729('0x46')]);return db[_0x0729('0x5a')][_0x0729('0x47')](_0x60295);}})[_0x0729('0x29')](function(_0x34615c){if(_0x34615c){return db[_0x0729('0x5e')][_0x0729('0x5f')]({'where':{'id':_[_0x0729('0x31')](_0x34615c,_0x0729('0x60')),'role':_0x0729('0x61')},'attributes':['id',_0x0729('0x36'),_0x0729('0x62'),_0x0729('0x63'),_0x0729('0x64')]});}})[_0x0729('0x29')](function(_0x58d1b8){if(_0x58d1b8){return{'count':_0x58d1b8[_0x0729('0x22')],'rows':_[_0x0729('0x31')](_0x58d1b8[_0x0729('0x48')],function(_0x163404){return{'membername':_0x163404[_0x0729('0x36')],'UserId':_0x163404['id'],'queue_name':_0x4fa57d[_0x0729('0x36')],'WhatsappQueueId':_0x4fa57d['id'],'interface':util[_0x0729('0x65')](_0x0729('0x66'),_0x0729('0x67'),_0x163404['name']),'penalty':0x0,'paused':_0x163404[_0x0729('0x62')],'createdAt':_0x163404[_0x0729('0x64')],'updatedAt':_0x163404[_0x0729('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0729('0x29')](respondWithFilteredResult(_0x5b5859,_0x60295))[_0x0729('0x49')](handleError(_0x5b5859,null));};exports['getTeams']=function(_0x4524b8,_0x11d0b0,_0x2cca1e){var _0x45b74e={};var _0x38b74a={};var _0x25e902;var _0x202f69;return db[_0x0729('0x32')][_0x0729('0x59')]({'where':{'id':_0x4524b8[_0x0729('0x57')]['id']}})[_0x0729('0x29')](handleEntityNotFound(_0x11d0b0,null))['then'](function(_0x311bbf){if(_0x311bbf){_0x25e902=_0x311bbf;_0x38b74a['model']=_[_0x0729('0x38')](db[_0x0729('0x68')]['rawAttributes']);_0x38b74a[_0x0729('0x37')]=_[_0x0729('0x38')](_0x4524b8[_0x0729('0x37')]);_0x38b74a[_0x0729('0x41')]=_[_0x0729('0x39')](_0x38b74a[_0x0729('0x35')],_0x38b74a[_0x0729('0x37')]);_0x45b74e['attributes']=_[_0x0729('0x39')](_0x38b74a['model'],qs[_0x0729('0x3a')](_0x4524b8['query'][_0x0729('0x3a')]));_0x45b74e[_0x0729('0x3b')]=_0x45b74e['attributes'][_0x0729('0x3c')]?_0x45b74e[_0x0729('0x3b')]:_0x38b74a[_0x0729('0x35')];_0x45b74e['order']=qs['sort'](_0x4524b8[_0x0729('0x37')]['sort']);_0x45b74e[_0x0729('0x40')]=qs['filters'](_[_0x0729('0x42')](_0x4524b8['query'],_0x38b74a['filters']));if(_0x4524b8[_0x0729('0x37')]['filter']){_0x45b74e[_0x0729('0x40')]=_['merge'](_0x45b74e['where'],{'$or':_['map'](_0x45b74e[_0x0729('0x3b')],function(_0xb81e8){var _0x2a9fa1={};_0x2a9fa1[_0xb81e8]={'$like':'%'+_0x4524b8[_0x0729('0x37')][_0x0729('0x43')]+'%'};return _0x2a9fa1;})});}_0x45b74e=_[_0x0729('0x44')]({},_0x45b74e,_0x4524b8['options']);return _0x25e902['getTeams'](_0x45b74e);}})[_0x0729('0x29')](function(_0x449654){if(_0x449654){_0x202f69=_0x449654['length'];if(!_0x4524b8[_0x0729('0x37')][_0x0729('0x3d')](_0x0729('0x5c'))){_0x45b74e[_0x0729('0x23')]=qs['limit'](_0x4524b8[_0x0729('0x37')][_0x0729('0x23')]);_0x45b74e['offset']=qs[_0x0729('0x20')](_0x4524b8[_0x0729('0x37')][_0x0729('0x20')]);}return _0x25e902[_0x0729('0x69')](_0x45b74e);}})[_0x0729('0x29')](function(_0x1450ad){if(_0x1450ad){return _0x1450ad?{'count':_0x202f69,'rows':_0x1450ad}:null;}})[_0x0729('0x29')](respondWithResult(_0x11d0b0,null))['catch'](handleError(_0x11d0b0,null));};exports[_0x0729('0x6a')]=function(_0x56f632,_0x341bb3,_0x2cd167){var _0x1e485f=_0x56f632[_0x0729('0x4e')][_0x0729('0x6b')];return db[_0x0729('0x68')][_0x0729('0x47')]({'where':{'id':_0x1e485f},'attributes':['id'],'include':[{'model':db[_0x0729('0x5e')],'as':_0x0729('0x6c'),'attributes':['id',_0x0729('0x36'),_0x0729('0x6d'),_0x0729('0x6e'),_0x0729('0x6f')],'raw':!![]}]})['then'](function(_0x485785){if(_0x485785){var _0x5aacfe=_[_0x0729('0x70')](_0x485785,function(_0x378f0d){var _0x2ac3fa=_0x378f0d[_0x0729('0x2b')]({'plain':!![]});return _0x2ac3fa[_0x0729('0x6c')];});return db['WhatsappQueue'][_0x0729('0x4c')]({'where':{'id':_0x56f632[_0x0729('0x57')]['id']}})[_0x0729('0x29')](function(_0x15a495){return db[_0x0729('0x71')][_0x0729('0x72')](function(_0x5d41db){return _0x15a495[_0x0729('0x6a')](_0x1e485f,{'transaction':_0x5d41db})[_0x0729('0x29')](function(){return BPromise[_0x0729('0x73')](_0x5aacfe,function(_0x507622){return db['UserWhatsappQueue'][_0x0729('0x74')]({'where':{'UserId':_0x507622['id'],'WhatsappQueueId':_0x56f632[_0x0729('0x57')]['id']},'transaction':_0x5d41db});});})[_0x0729('0x29')](function(){_0x5aacfe[_0x0729('0x75')](function(_0x8e2430){socket[_0x0729('0x76')]('userWhatsappQueue:save',{'UserId':_0x8e2430['id'],'WhatsappQueueId':_0x15a495['id']});});});});});}})[_0x0729('0x29')](respondWithStatusCode(_0x341bb3,null))['catch'](handleError(_0x341bb3,null));};exports['removeTeams']=function(_0x18dc8f,_0x1a7779,_0x1773af){return db[_0x0729('0x68')][_0x0729('0x47')]({'where':{'id':_0x18dc8f['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x0729('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1a7779,null))[_0x0729('0x29')](function(_0xb7ad36){var _0x30344d=_[_0x0729('0x31')](_0xb7ad36,'id');var _0x52948d=[];var _0x38380d=[];var _0x4b0694=squel['select']();_0x4b0694['field'](_0x0729('0x77'))[_0x0729('0x78')](_0x0729('0x79'),'tq')['join'](_0x0729('0x7a'),'ut',_0x0729('0x7b'))[_0x0729('0x40')]('WhatsappQueueId\x20=\x20?',_0x18dc8f['params']['id']);for(var _0x5de69c=0x0;_0x5de69c<_0xb7ad36[_0x0729('0x3c')];_0x5de69c+=0x1){let _0x4ac151=_0xb7ad36[_0x5de69c];for(var _0x30445d=0x0;_0x30445d<_0x4ac151[_0x0729('0x6c')][_0x0729('0x3c')];_0x30445d+=0x1){let _0x4e5713=_0x4ac151[_0x0729('0x6c')][_0x30445d];var _0x1f00b6=_0x4b0694['clone']();_0x1f00b6['where']('ut.UserId\x20=\x20?',_0x4e5713['id']);_0x38380d['push'](db['sequelize']['query'](_0x1f00b6['toString'](),{'type':db['sequelize'][_0x0729('0x7c')][_0x0729('0x7d')]})[_0x0729('0x29')](function(_0x1c4948){if(_0x1c4948[_0x0729('0x3c')]===0x1){return _0x4e5713['id'];}else{var _0x19c12c=_[_0x0729('0x7e')](_[_0x0729('0x31')](_0x1c4948,'TeamId'),function(_0x3cfef0){return _['includes'](_0x30344d,_0x3cfef0);});if(_0x19c12c){return _0x4e5713['id'];}}}));}}return BPromise['all'](_0x38380d)['then'](function(_0x41ed8f){_0x52948d=_(_0x52948d)['union'](_0x41ed8f)['compact']()[_0x0729('0x7f')]();return db[_0x0729('0x32')][_0x0729('0x4c')]({'where':{'id':_0x18dc8f[_0x0729('0x57')]['id']}})[_0x0729('0x29')](function(_0x494bf8){return db[_0x0729('0x71')][_0x0729('0x72')](function(_0x27ec8a){return _0x494bf8['removeTeams'](_0x18dc8f['query'][_0x0729('0x6b')],{'transaction':_0x27ec8a})[_0x0729('0x29')](function(){if(!_[_0x0729('0x80')](_0x52948d)){return _0x494bf8[_0x0729('0x81')](_0x52948d,{'transaction':_0x27ec8a});}})[_0x0729('0x29')](function(){_0x52948d[_0x0729('0x75')](function(_0x407cff){socket[_0x0729('0x76')]('userWhatsappQueue:remove',{'UserId':_0x407cff,'WhatsappQueueId':_0x494bf8['id']});});});});});});})[_0x0729('0x29')](respondWithStatusCode(_0x1a7779,null))[_0x0729('0x49')](handleError(_0x1a7779,null));};exports[_0x0729('0x82')]=function(_0x5c202e,_0x37c235,_0x1f3d29){return db['WhatsappQueue']['find']({'where':{'id':_0x5c202e[_0x0729('0x57')]['id']}})[_0x0729('0x29')](handleEntityNotFound(_0x37c235,null))[_0x0729('0x29')](function(_0x19289b){if(_0x19289b){return _0x19289b[_0x0729('0x82')](_0x5c202e['body']['ids'],_[_0x0729('0x83')](_0x5c202e['body'],[_0x0729('0x6b'),'id'])||{})[_0x0729('0x84')](function(_0x17b5a4){for(var _0x5a015e=0x0;_0x5a015e<_0x5c202e[_0x0729('0x4e')][_0x0729('0x6b')]['length'];_0x5a015e+=0x1){socket[_0x0729('0x76')](_0x0729('0x85'),{'UserId':Number(_0x5c202e['body'][_0x0729('0x6b')][_0x5a015e]),'WhatsappQueueId':Number(_0x5c202e[_0x0729('0x57')]['id'])});}return _0x17b5a4;});}})[_0x0729('0x29')](respondWithResult(_0x37c235,null))[_0x0729('0x49')](handleError(_0x37c235,null));};exports[_0x0729('0x81')]=function(_0x57b821,_0x113826,_0x5d2eb7){return db[_0x0729('0x32')]['find']({'where':{'id':_0x57b821[_0x0729('0x57')]['id']}})[_0x0729('0x29')](handleEntityNotFound(_0x113826,null))[_0x0729('0x29')](function(_0x195f9f){if(_0x195f9f){return _0x195f9f[_0x0729('0x81')](_0x57b821[_0x0729('0x37')][_0x0729('0x6b')])['then'](function(){if(_[_0x0729('0x86')](_0x57b821[_0x0729('0x37')]['ids'])){for(var _0x23d8da=0x0;_0x23d8da<_0x57b821[_0x0729('0x37')][_0x0729('0x6b')][_0x0729('0x3c')];_0x23d8da+=0x1){socket['emit'](_0x0729('0x87'),{'UserId':Number(_0x57b821[_0x0729('0x37')][_0x0729('0x6b')][_0x23d8da]),'WhatsappQueueId':Number(_0x57b821[_0x0729('0x57')]['id'])});}}else{socket['emit'](_0x0729('0x87'),{'UserId':Number(_0x57b821['query'][_0x0729('0x6b')]),'WhatsappQueueId':Number(_0x57b821[_0x0729('0x57')]['id'])});}});}})[_0x0729('0x29')](respondWithStatusCode(_0x113826,null))[_0x0729('0x49')](handleError(_0x113826,null));};exports['getAgents']=function(_0x51ca33,_0x20e5b3,_0x4e6331){var _0x1ae3f6={};var _0x28e0ff={};var _0x1f3995;var _0x16944f;return db[_0x0729('0x32')]['findOne']({'where':{'id':_0x51ca33[_0x0729('0x57')]['id']}})['then'](handleEntityNotFound(_0x20e5b3,null))[_0x0729('0x29')](function(_0x927ec5){if(_0x927ec5){_0x1f3995=_0x927ec5;_0x28e0ff[_0x0729('0x35')]=_[_0x0729('0x38')](db[_0x0729('0x5e')][_0x0729('0x5b')]);_0x28e0ff[_0x0729('0x37')]=_[_0x0729('0x38')](_0x51ca33[_0x0729('0x37')]);_0x28e0ff['filters']=_[_0x0729('0x39')](_0x28e0ff[_0x0729('0x35')],_0x28e0ff[_0x0729('0x37')]);_0x1ae3f6[_0x0729('0x3b')]=_[_0x0729('0x39')](_0x28e0ff['model'],qs[_0x0729('0x3a')](_0x51ca33['query'][_0x0729('0x3a')]));_0x1ae3f6['attributes']=_0x1ae3f6[_0x0729('0x3b')][_0x0729('0x3c')]?_0x1ae3f6['attributes']:_0x28e0ff[_0x0729('0x35')];_0x1ae3f6['order']=qs[_0x0729('0x3f')](_0x51ca33[_0x0729('0x37')]['sort']);_0x1ae3f6[_0x0729('0x40')]=qs[_0x0729('0x41')](_[_0x0729('0x42')](_0x51ca33['query'],_0x28e0ff[_0x0729('0x41')]));if(_0x51ca33['query'][_0x0729('0x43')]){_0x1ae3f6[_0x0729('0x40')]=_[_0x0729('0x44')](_0x1ae3f6[_0x0729('0x40')],{'$or':_[_0x0729('0x31')](_0x1ae3f6[_0x0729('0x3b')],function(_0x557c8f){var _0x2c3979={};_0x2c3979[_0x557c8f]={'$like':'%'+_0x51ca33[_0x0729('0x37')][_0x0729('0x43')]+'%'};return _0x2c3979;})});}_0x1ae3f6=_[_0x0729('0x44')]({},_0x1ae3f6,_0x51ca33[_0x0729('0x46')]);return _0x1f3995['getAgents'](_0x1ae3f6);}})[_0x0729('0x29')](function(_0x30dcf0){if(_0x30dcf0){_0x16944f=_0x30dcf0['length'];if(!_0x51ca33[_0x0729('0x37')]['hasOwnProperty'](_0x0729('0x5c'))){_0x1ae3f6[_0x0729('0x23')]=qs[_0x0729('0x23')](_0x51ca33[_0x0729('0x37')][_0x0729('0x23')]);_0x1ae3f6[_0x0729('0x20')]=qs['offset'](_0x51ca33[_0x0729('0x37')][_0x0729('0x20')]);}return _0x1f3995[_0x0729('0x88')](_0x1ae3f6);}})[_0x0729('0x29')](function(_0x498ba9){if(_0x498ba9){return _0x498ba9?{'count':_0x16944f,'rows':_0x498ba9}:null;}})['then'](respondWithResult(_0x20e5b3,null))[_0x0729('0x49')](handleError(_0x20e5b3,null));}; \ No newline at end of file +var _0x612e=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','format','%s/%s','createdAt','getTeams','addTeams','Team','Agents','flatMap','sequelize','transaction','each','forEach','emit','removeTeams','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','userWhatsappQueue:save','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','WhatsappQueues','then','error','stack','name','index','WhatsappQueue','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user'];(function(_0x5c7ffe,_0x5ddc7a){var _0x3280d6=function(_0x1910eb){while(--_0x1910eb){_0x5c7ffe['push'](_0x5c7ffe['shift']());}};_0x3280d6(++_0x5ddc7a);}(_0x612e,0x14a));var _0xe612=function(_0x56fe36,_0x2e2f28){_0x56fe36=_0x56fe36-0x0;var _0xa4badd=_0x612e[_0x56fe36];return _0xa4badd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe612('0x0'));var jsonpatch=require(_0xe612('0x1'));var rp=require(_0xe612('0x2'));var moment=require(_0xe612('0x3'));var BPromise=require(_0xe612('0x4'));var Mustache=require(_0xe612('0x5'));var util=require(_0xe612('0x6'));var path=require(_0xe612('0x7'));var sox=require('sox');var csv=require(_0xe612('0x8'));var ejs=require(_0xe612('0x9'));var fs=require('fs');var fs_extra=require(_0xe612('0xa'));var _=require(_0xe612('0xb'));var squel=require(_0xe612('0xc'));var crypto=require(_0xe612('0xd'));var jsforce=require(_0xe612('0xe'));var deskjs=require(_0xe612('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe612('0x10'));var Papa=require(_0xe612('0x11'));var Redis=require('ioredis');var authService=require(_0xe612('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe612('0x13'));var hardwareService=require(_0xe612('0x14'));var logger=require(_0xe612('0x15'))(_0xe612('0x16'));var utils=require(_0xe612('0x17'));var config=require(_0xe612('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe612('0x19')]=_[_0xe612('0x1a')](config[_0xe612('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe612('0x19')]));require(_0xe612('0x1b'))[_0xe612('0x1c')](socket);function respondWithStatusCode(_0x4aa49f,_0x43b942){_0x43b942=_0x43b942||0xcc;return function(_0x282ba3){if(_0x282ba3){return _0x4aa49f[_0xe612('0x1d')](_0x43b942);}return _0x4aa49f[_0xe612('0x1e')](_0x43b942)[_0xe612('0x1f')]();};}function respondWithResult(_0x1641f7,_0x11d473){_0x11d473=_0x11d473||0xc8;return function(_0x5f3972){if(_0x5f3972){return _0x1641f7[_0xe612('0x1e')](_0x11d473)[_0xe612('0x20')](_0x5f3972);}};}function respondWithFilteredResult(_0x16c2cb,_0x7a3915){return function(_0xa22f68){if(_0xa22f68){var _0x4340fc=typeof _0x7a3915[_0xe612('0x21')]===_0xe612('0x22')&&typeof _0x7a3915[_0xe612('0x23')]===_0xe612('0x22');var _0x26da5b=_0xa22f68[_0xe612('0x24')];var _0xa6ced3=_0x4340fc?0x0:_0x7a3915['offset'];var _0x2574c7=_0x4340fc?_0xa22f68[_0xe612('0x24')]:_0x7a3915[_0xe612('0x21')]+_0x7a3915[_0xe612('0x23')];var _0x3f4922;if(_0x2574c7>=_0x26da5b){_0x2574c7=_0x26da5b;_0x3f4922=0xc8;}else{_0x3f4922=0xce;}_0x16c2cb[_0xe612('0x1e')](_0x3f4922);return _0x16c2cb[_0xe612('0x25')](_0xe612('0x26'),_0xa6ced3+'-'+_0x2574c7+'/'+_0x26da5b)[_0xe612('0x20')](_0xa22f68);}return null;};}function patchUpdates(_0x5e5195){return function(_0x13600c){try{jsonpatch[_0xe612('0x27')](_0x13600c,_0x5e5195,!![]);}catch(_0x3b12b4){return BPromise['reject'](_0x3b12b4);}return _0x13600c[_0xe612('0x28')]();};}function saveUpdates(_0x5e49f1,_0x195f0b){return function(_0x93c596){if(_0x93c596){return _0x93c596[_0xe612('0x29')](_0x5e49f1)['then'](function(_0x4f9860){return _0x4f9860;});}return null;};}function removeEntity(_0x1cd8d7,_0x4c5694){return function(_0x1bb7b3){if(_0x1bb7b3){return _0x1bb7b3['destroy']()['then'](function(){var _0x3acfcb=_0x1bb7b3[_0xe612('0x2a')]({'plain':!![]});var _0xf50051=_0xe612('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0xf50051,'resourceId':_0x3acfcb['id']}})[_0xe612('0x2c')](function(){return _0x1bb7b3;});})[_0xe612('0x2c')](function(){_0x1cd8d7[_0xe612('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49c11e,_0x3bbccd){return function(_0x5fb819){if(!_0x5fb819){_0x49c11e[_0xe612('0x1d')](0x194);}return _0x5fb819;};}function handleError(_0x4b07c3,_0x400bf0){_0x400bf0=_0x400bf0||0x1f4;return function(_0x2e2106){logger[_0xe612('0x2d')](_0x2e2106[_0xe612('0x2e')]);if(_0x2e2106[_0xe612('0x2f')]){delete _0x2e2106[_0xe612('0x2f')];}_0x4b07c3[_0xe612('0x1e')](_0x400bf0)['send'](_0x2e2106);};}exports[_0xe612('0x30')]=function(_0x278709,_0x126611){var _0x9cad79={},_0x29c429={},_0x3117cd={'count':0x0,'rows':[]};var _0x3ca3fa=_['map'](db[_0xe612('0x31')][_0xe612('0x32')],function(_0xefadb){return{'name':_0xefadb['fieldName'],'type':_0xefadb[_0xe612('0x33')]['key']};});_0x29c429['model']=_['map'](_0x3ca3fa,_0xe612('0x2f'));_0x29c429[_0xe612('0x34')]=_[_0xe612('0x35')](_0x278709[_0xe612('0x34')]);_0x29c429[_0xe612('0x36')]=_[_0xe612('0x37')](_0x29c429['model'],_0x29c429[_0xe612('0x34')]);_0x9cad79['attributes']=_[_0xe612('0x37')](_0x29c429[_0xe612('0x38')],qs[_0xe612('0x39')](_0x278709[_0xe612('0x34')][_0xe612('0x39')]));_0x9cad79[_0xe612('0x3a')]=_0x9cad79[_0xe612('0x3a')]['length']?_0x9cad79[_0xe612('0x3a')]:_0x29c429[_0xe612('0x38')];if(!_0x278709[_0xe612('0x34')][_0xe612('0x3b')](_0xe612('0x3c'))){_0x9cad79[_0xe612('0x23')]=qs[_0xe612('0x23')](_0x278709[_0xe612('0x34')][_0xe612('0x23')]);_0x9cad79['offset']=qs[_0xe612('0x21')](_0x278709[_0xe612('0x34')][_0xe612('0x21')]);}_0x9cad79[_0xe612('0x3d')]=qs[_0xe612('0x3e')](_0x278709[_0xe612('0x34')][_0xe612('0x3e')]);_0x9cad79[_0xe612('0x3f')]=qs[_0xe612('0x36')](_[_0xe612('0x40')](_0x278709[_0xe612('0x34')],_0x29c429[_0xe612('0x36')]),_0x3ca3fa);if(_0x278709[_0xe612('0x34')][_0xe612('0x41')]){_0x9cad79[_0xe612('0x3f')]=_[_0xe612('0x42')](_0x9cad79[_0xe612('0x3f')],{'$or':_[_0xe612('0x43')](_0x3ca3fa,function(_0x406a51){if(_0x406a51[_0xe612('0x33')]!=='VIRTUAL'){var _0x462bf4={};_0x462bf4[_0x406a51['name']]={'$like':'%'+_0x278709[_0xe612('0x34')][_0xe612('0x41')]+'%'};return _0x462bf4;}})});}_0x9cad79=_[_0xe612('0x42')]({},_0x9cad79,_0x278709[_0xe612('0x44')]);var _0x38dd9f={'where':_0x9cad79[_0xe612('0x3f')]};return db[_0xe612('0x31')]['count'](_0x38dd9f)['then'](function(_0x5ea890){_0x3117cd[_0xe612('0x24')]=_0x5ea890;if(_0x278709['query'][_0xe612('0x45')]){_0x9cad79[_0xe612('0x46')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xe612('0x47')](_0x9cad79);})[_0xe612('0x2c')](function(_0x218333){_0x3117cd[_0xe612('0x48')]=_0x218333;return _0x3117cd;})['then'](respondWithFilteredResult(_0x126611,_0x9cad79))[_0xe612('0x49')](handleError(_0x126611,null));};exports[_0xe612('0x4a')]=function(_0x3c6d39,_0x3205f4){var _0xa1b9b2={'raw':!![],'where':{'id':_0x3c6d39[_0xe612('0x4b')]['id']}},_0x419d4e={};_0x419d4e['model']=_[_0xe612('0x35')](db[_0xe612('0x31')][_0xe612('0x32')]);_0x419d4e[_0xe612('0x34')]=_[_0xe612('0x35')](_0x3c6d39[_0xe612('0x34')]);_0x419d4e[_0xe612('0x36')]=_[_0xe612('0x37')](_0x419d4e[_0xe612('0x38')],_0x419d4e['query']);_0xa1b9b2[_0xe612('0x3a')]=_[_0xe612('0x37')](_0x419d4e['model'],qs['fields'](_0x3c6d39[_0xe612('0x34')][_0xe612('0x39')]));_0xa1b9b2[_0xe612('0x3a')]=_0xa1b9b2[_0xe612('0x3a')][_0xe612('0x4c')]?_0xa1b9b2[_0xe612('0x3a')]:_0x419d4e[_0xe612('0x38')];if(_0x3c6d39[_0xe612('0x34')][_0xe612('0x45')]){_0xa1b9b2['include']=[{'all':!![]}];}_0xa1b9b2=_[_0xe612('0x42')]({},_0xa1b9b2,_0x3c6d39[_0xe612('0x44')]);return db['WhatsappQueue'][_0xe612('0x4d')](_0xa1b9b2)[_0xe612('0x2c')](handleEntityNotFound(_0x3205f4,null))['then'](respondWithResult(_0x3205f4,null))[_0xe612('0x49')](handleError(_0x3205f4,null));};exports[_0xe612('0x4e')]=function(_0x595a12,_0x258c3d){return db[_0xe612('0x31')][_0xe612('0x4e')](_0x595a12[_0xe612('0x4f')],{})[_0xe612('0x2c')](function(_0x3f9552){var _0x50b663=_0x595a12[_0xe612('0x50')][_0xe612('0x2a')]({'plain':!![]});if(!_0x50b663)throw new Error(_0xe612('0x51'));if(_0x50b663[_0xe612('0x52')]==='user'){var _0x44c25b=_0x3f9552['get']({'plain':!![]});var _0x172186=_0xe612('0x2b');return db[_0xe612('0x53')][_0xe612('0x4d')]({'where':{'name':_0x172186,'userProfileId':_0x50b663[_0xe612('0x54')]},'raw':!![]})[_0xe612('0x2c')](function(_0x2a8ae5){if(_0x2a8ae5&&_0x2a8ae5[_0xe612('0x55')]===0x0){return db[_0xe612('0x56')][_0xe612('0x4e')]({'name':_0x44c25b[_0xe612('0x2f')],'resourceId':_0x44c25b['id'],'type':_0x2a8ae5['name'],'sectionId':_0x2a8ae5['id']},{})[_0xe612('0x2c')](function(){return _0x3f9552;});}else{return _0x3f9552;}})[_0xe612('0x49')](function(_0x33af18){logger[_0xe612('0x2d')](_0xe612('0x57'),_0x33af18);throw _0x33af18;});}return _0x3f9552;})[_0xe612('0x2c')](respondWithResult(_0x258c3d,0xc9))[_0xe612('0x49')](handleError(_0x258c3d,null));};exports[_0xe612('0x29')]=function(_0x10bf3d,_0x476b01){if(_0x10bf3d['body']['id']){delete _0x10bf3d[_0xe612('0x4f')]['id'];}return db[_0xe612('0x31')][_0xe612('0x4d')]({'where':{'id':_0x10bf3d['params']['id']}})[_0xe612('0x2c')](handleEntityNotFound(_0x476b01,null))['then'](saveUpdates(_0x10bf3d[_0xe612('0x4f')],null))['then'](respondWithResult(_0x476b01,null))[_0xe612('0x49')](handleError(_0x476b01,null));};exports[_0xe612('0x58')]=function(_0xc0ee2f,_0x1c0215){return db[_0xe612('0x31')]['find']({'where':{'id':_0xc0ee2f['params']['id']}})['then'](handleEntityNotFound(_0x1c0215,null))[_0xe612('0x2c')](removeEntity(_0x1c0215,null))[_0xe612('0x49')](handleError(_0x1c0215,null));};exports[_0xe612('0x59')]=function(_0x5c9481,_0x3e4935){return db[_0xe612('0x31')][_0xe612('0x59')]()['then'](respondWithResult(_0x3e4935,null))[_0xe612('0x49')](handleError(_0x3e4935,null));};exports[_0xe612('0x5a')]=function(_0x16c9ea,_0xf69112,_0x4c6da6){var _0x48439b={'raw':!![],'where':{}},_0x268218={},_0x5b04c2;return db['WhatsappQueue'][_0xe612('0x5b')]({'where':{'id':_0x16c9ea[_0xe612('0x4b')]['id']}})['then'](handleEntityNotFound(_0xf69112,null))[_0xe612('0x2c')](function(_0x48e57d){if(_0x48e57d){_0x5b04c2=_0x48e57d['get']({'plain':!![]});_0x268218[_0xe612('0x38')]=_[_0xe612('0x35')](db[_0xe612('0x5c')][_0xe612('0x32')]);_0x268218[_0xe612('0x34')]=_[_0xe612('0x35')](_0x16c9ea['query']);_0x268218[_0xe612('0x36')]=_[_0xe612('0x37')](_0x268218[_0xe612('0x38')],_0x268218[_0xe612('0x34')]);_0x48439b[_0xe612('0x3a')]=_[_0xe612('0x37')](_0x268218[_0xe612('0x38')],qs[_0xe612('0x39')](_0x16c9ea[_0xe612('0x34')][_0xe612('0x39')]));_0x48439b[_0xe612('0x3a')]=_0x48439b['attributes']['length']?_0x48439b[_0xe612('0x3a')]:_0x268218[_0xe612('0x38')];if(!_0x16c9ea[_0xe612('0x34')][_0xe612('0x3b')](_0xe612('0x3c'))){_0x48439b[_0xe612('0x23')]=qs['limit'](_0x16c9ea[_0xe612('0x34')]['limit']);_0x48439b[_0xe612('0x21')]=qs[_0xe612('0x21')](_0x16c9ea[_0xe612('0x34')][_0xe612('0x21')]);}_0x48439b[_0xe612('0x3d')]=qs[_0xe612('0x3e')](_0x16c9ea[_0xe612('0x34')][_0xe612('0x3e')]);_0x48439b[_0xe612('0x3f')]=qs['filters'](_[_0xe612('0x40')](_0x16c9ea['query'],_0x268218[_0xe612('0x36')]));_0x48439b[_0xe612('0x3f')]['WhatsappQueueId']=_0x48e57d['id'];if(_0x16c9ea[_0xe612('0x34')]['filter']){_0x48439b[_0xe612('0x3f')]=_[_0xe612('0x42')](_0x48439b[_0xe612('0x3f')],{'$or':_[_0xe612('0x43')](_0x48439b['attributes'],function(_0x55a99a){var _0x35af6a={};_0x35af6a[_0x55a99a]={'$like':'%'+_0x16c9ea[_0xe612('0x34')][_0xe612('0x41')]+'%'};return _0x35af6a;})});}_0x48439b=_[_0xe612('0x42')]({},_0x48439b,_0x16c9ea[_0xe612('0x44')]);return db[_0xe612('0x5c')][_0xe612('0x47')](_0x48439b);}})[_0xe612('0x2c')](function(_0x1f06ea){if(_0x1f06ea){return db[_0xe612('0x5d')][_0xe612('0x5e')]({'where':{'id':_[_0xe612('0x43')](_0x1f06ea,_0xe612('0x5f')),'role':_0xe612('0x60')},'attributes':['id','name',_0xe612('0x61'),'updatedAt','createdAt']});}})['then'](function(_0x4f4654){if(_0x4f4654){return{'count':_0x4f4654['count'],'rows':_[_0xe612('0x43')](_0x4f4654[_0xe612('0x48')],function(_0x49d08a){return{'membername':_0x49d08a[_0xe612('0x2f')],'UserId':_0x49d08a['id'],'queue_name':_0x5b04c2[_0xe612('0x2f')],'WhatsappQueueId':_0x5b04c2['id'],'interface':util[_0xe612('0x62')](_0xe612('0x63'),'SIP',_0x49d08a[_0xe612('0x2f')]),'penalty':0x0,'paused':_0x49d08a[_0xe612('0x61')],'createdAt':_0x49d08a[_0xe612('0x64')],'updatedAt':_0x49d08a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe612('0x2c')](respondWithFilteredResult(_0xf69112,_0x48439b))[_0xe612('0x49')](handleError(_0xf69112,null));};exports['getTeams']=function(_0x54ec62,_0x4e9db3,_0x21f847){var _0x343054={};var _0x38424e={};var _0x158c77;var _0x31a22d;return db[_0xe612('0x31')][_0xe612('0x5b')]({'where':{'id':_0x54ec62[_0xe612('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4e9db3,null))[_0xe612('0x2c')](function(_0x378eb7){if(_0x378eb7){_0x158c77=_0x378eb7;_0x38424e[_0xe612('0x38')]=_[_0xe612('0x35')](db['Team']['rawAttributes']);_0x38424e[_0xe612('0x34')]=_[_0xe612('0x35')](_0x54ec62[_0xe612('0x34')]);_0x38424e[_0xe612('0x36')]=_[_0xe612('0x37')](_0x38424e[_0xe612('0x38')],_0x38424e[_0xe612('0x34')]);_0x343054[_0xe612('0x3a')]=_['intersection'](_0x38424e[_0xe612('0x38')],qs[_0xe612('0x39')](_0x54ec62['query'][_0xe612('0x39')]));_0x343054[_0xe612('0x3a')]=_0x343054['attributes'][_0xe612('0x4c')]?_0x343054[_0xe612('0x3a')]:_0x38424e[_0xe612('0x38')];_0x343054[_0xe612('0x3d')]=qs['sort'](_0x54ec62[_0xe612('0x34')][_0xe612('0x3e')]);_0x343054[_0xe612('0x3f')]=qs[_0xe612('0x36')](_[_0xe612('0x40')](_0x54ec62[_0xe612('0x34')],_0x38424e['filters']));if(_0x54ec62[_0xe612('0x34')][_0xe612('0x41')]){_0x343054[_0xe612('0x3f')]=_[_0xe612('0x42')](_0x343054[_0xe612('0x3f')],{'$or':_[_0xe612('0x43')](_0x343054['attributes'],function(_0x34d1f2){var _0x372bc1={};_0x372bc1[_0x34d1f2]={'$like':'%'+_0x54ec62[_0xe612('0x34')][_0xe612('0x41')]+'%'};return _0x372bc1;})});}_0x343054=_[_0xe612('0x42')]({},_0x343054,_0x54ec62['options']);return _0x158c77[_0xe612('0x65')](_0x343054);}})['then'](function(_0x4b59b9){if(_0x4b59b9){_0x31a22d=_0x4b59b9[_0xe612('0x4c')];if(!_0x54ec62['query']['hasOwnProperty'](_0xe612('0x3c'))){_0x343054[_0xe612('0x23')]=qs[_0xe612('0x23')](_0x54ec62[_0xe612('0x34')][_0xe612('0x23')]);_0x343054[_0xe612('0x21')]=qs[_0xe612('0x21')](_0x54ec62[_0xe612('0x34')][_0xe612('0x21')]);}return _0x158c77['getTeams'](_0x343054);}})[_0xe612('0x2c')](function(_0x415e8c){if(_0x415e8c){return _0x415e8c?{'count':_0x31a22d,'rows':_0x415e8c}:null;}})['then'](respondWithResult(_0x4e9db3,null))['catch'](handleError(_0x4e9db3,null));};exports[_0xe612('0x66')]=function(_0x80942a,_0x10e9a4,_0xbfb488){var _0x1e6032=_0x80942a[_0xe612('0x4f')]['ids'];return db[_0xe612('0x67')][_0xe612('0x47')]({'where':{'id':_0x1e6032},'attributes':['id'],'include':[{'model':db[_0xe612('0x5d')],'as':_0xe612('0x68'),'attributes':['id','name','online','voicePause','interface'],'raw':!![]}]})[_0xe612('0x2c')](function(_0x32fd14){if(_0x32fd14){var _0x13246f=_[_0xe612('0x69')](_0x32fd14,function(_0x5bd67){var _0x2a08c9=_0x5bd67['get']({'plain':!![]});return _0x2a08c9[_0xe612('0x68')];});return db[_0xe612('0x31')][_0xe612('0x4d')]({'where':{'id':_0x80942a[_0xe612('0x4b')]['id']}})[_0xe612('0x2c')](function(_0x13f4ce){return db[_0xe612('0x6a')][_0xe612('0x6b')](function(_0x419cb9){return _0x13f4ce[_0xe612('0x66')](_0x1e6032,{'transaction':_0x419cb9})[_0xe612('0x2c')](function(){return BPromise[_0xe612('0x6c')](_0x13246f,function(_0x480c6e){return db[_0xe612('0x5c')]['findOrCreate']({'where':{'UserId':_0x480c6e['id'],'WhatsappQueueId':_0x80942a[_0xe612('0x4b')]['id']},'transaction':_0x419cb9});});})['then'](function(){_0x13246f[_0xe612('0x6d')](function(_0x350c6a){socket[_0xe612('0x6e')]('userWhatsappQueue:save',{'UserId':_0x350c6a['id'],'WhatsappQueueId':_0x13f4ce['id']});});});});});}})[_0xe612('0x2c')](respondWithStatusCode(_0x10e9a4,null))[_0xe612('0x49')](handleError(_0x10e9a4,null));};exports[_0xe612('0x6f')]=function(_0x53d8fb,_0x1c6251,_0x586332){return db['Team'][_0xe612('0x47')]({'where':{'id':_0x53d8fb['query'][_0xe612('0x70')]},'attributes':['id'],'include':[{'model':db[_0xe612('0x5d')],'as':_0xe612('0x68'),'attributes':['id'],'raw':!![]}]})[_0xe612('0x2c')](handleEntityNotFound(_0x1c6251,null))['then'](function(_0x15820c){var _0x4473a7=_['map'](_0x15820c,'id');var _0x245a82=[];var _0x369f7f=[];var _0x3f074c=squel[_0xe612('0x71')]();_0x3f074c[_0xe612('0x72')](_0xe612('0x73'))[_0xe612('0x74')](_0xe612('0x75'),'tq')[_0xe612('0x76')]('user_has_teams','ut',_0xe612('0x77'))[_0xe612('0x3f')]('WhatsappQueueId\x20=\x20?',_0x53d8fb[_0xe612('0x4b')]['id']);for(var _0x147040=0x0;_0x147040<_0x15820c[_0xe612('0x4c')];_0x147040+=0x1){let _0x5bb1d7=_0x15820c[_0x147040];for(var _0x20a836=0x0;_0x20a836<_0x5bb1d7[_0xe612('0x68')]['length'];_0x20a836+=0x1){let _0x14be5a=_0x5bb1d7['Agents'][_0x20a836];var _0x4a1a5e=_0x3f074c[_0xe612('0x78')]();_0x4a1a5e[_0xe612('0x3f')](_0xe612('0x79'),_0x14be5a['id']);_0x369f7f[_0xe612('0x7a')](db[_0xe612('0x6a')][_0xe612('0x34')](_0x4a1a5e[_0xe612('0x7b')](),{'type':db['sequelize'][_0xe612('0x7c')]['SELECT']})[_0xe612('0x2c')](function(_0x154a27){if(_0x154a27[_0xe612('0x4c')]===0x1){return _0x14be5a['id'];}else{var _0x3932c0=_[_0xe612('0x7d')](_['map'](_0x154a27,_0xe612('0x7e')),function(_0x33d0f8){return _['includes'](_0x4473a7,_0x33d0f8);});if(_0x3932c0){return _0x14be5a['id'];}}}));}}return BPromise[_0xe612('0x7f')](_0x369f7f)[_0xe612('0x2c')](function(_0x11bb31){_0x245a82=_(_0x245a82)['union'](_0x11bb31)['compact']()[_0xe612('0x80')]();return db[_0xe612('0x31')]['find']({'where':{'id':_0x53d8fb[_0xe612('0x4b')]['id']}})[_0xe612('0x2c')](function(_0x512e92){return db[_0xe612('0x6a')][_0xe612('0x6b')](function(_0x228015){return _0x512e92[_0xe612('0x6f')](_0x53d8fb[_0xe612('0x34')][_0xe612('0x70')],{'transaction':_0x228015})[_0xe612('0x2c')](function(){if(!_[_0xe612('0x81')](_0x245a82)){return _0x512e92[_0xe612('0x82')](_0x245a82,{'transaction':_0x228015});}})[_0xe612('0x2c')](function(){_0x245a82[_0xe612('0x6d')](function(_0x38fb56){socket[_0xe612('0x6e')](_0xe612('0x83'),{'UserId':_0x38fb56,'WhatsappQueueId':_0x512e92['id']});});});});});});})[_0xe612('0x2c')](respondWithStatusCode(_0x1c6251,null))[_0xe612('0x49')](handleError(_0x1c6251,null));};exports[_0xe612('0x84')]=function(_0x4dc2ce,_0xba3825,_0x35df64){return db[_0xe612('0x31')][_0xe612('0x4d')]({'where':{'id':_0x4dc2ce[_0xe612('0x4b')]['id']}})[_0xe612('0x2c')](handleEntityNotFound(_0xba3825,null))['then'](function(_0x503447){if(_0x503447){return _0x503447[_0xe612('0x84')](_0x4dc2ce['body']['ids'],_['omit'](_0x4dc2ce['body'],[_0xe612('0x70'),'id'])||{})[_0xe612('0x85')](function(_0x20d867){for(var _0x3a59a8=0x0;_0x3a59a8<_0x4dc2ce[_0xe612('0x4f')][_0xe612('0x70')][_0xe612('0x4c')];_0x3a59a8+=0x1){socket[_0xe612('0x6e')](_0xe612('0x86'),{'UserId':Number(_0x4dc2ce['body']['ids'][_0x3a59a8]),'WhatsappQueueId':Number(_0x4dc2ce[_0xe612('0x4b')]['id'])});}return _0x20d867;});}})['then'](respondWithResult(_0xba3825,null))['catch'](handleError(_0xba3825,null));};exports[_0xe612('0x82')]=function(_0x4e9017,_0x8898bb,_0x463b7a){return db[_0xe612('0x31')][_0xe612('0x4d')]({'where':{'id':_0x4e9017[_0xe612('0x4b')]['id']}})['then'](handleEntityNotFound(_0x8898bb,null))[_0xe612('0x2c')](function(_0x508a3f){if(_0x508a3f){return _0x508a3f['removeAgents'](_0x4e9017[_0xe612('0x34')][_0xe612('0x70')])[_0xe612('0x2c')](function(){if(_[_0xe612('0x87')](_0x4e9017[_0xe612('0x34')]['ids'])){for(var _0x11a0e8=0x0;_0x11a0e8<_0x4e9017[_0xe612('0x34')][_0xe612('0x70')][_0xe612('0x4c')];_0x11a0e8+=0x1){socket[_0xe612('0x6e')]('userWhatsappQueue:remove',{'UserId':Number(_0x4e9017['query']['ids'][_0x11a0e8]),'WhatsappQueueId':Number(_0x4e9017['params']['id'])});}}else{socket[_0xe612('0x6e')](_0xe612('0x83'),{'UserId':Number(_0x4e9017[_0xe612('0x34')][_0xe612('0x70')]),'WhatsappQueueId':Number(_0x4e9017[_0xe612('0x4b')]['id'])});}});}})[_0xe612('0x2c')](respondWithStatusCode(_0x8898bb,null))['catch'](handleError(_0x8898bb,null));};exports[_0xe612('0x88')]=function(_0x22f16f,_0x4be221,_0x2776e3){var _0x159f8d={};var _0x47ed63={};var _0x3005ac;var _0x17acb4;return db[_0xe612('0x31')][_0xe612('0x5b')]({'where':{'id':_0x22f16f['params']['id']}})[_0xe612('0x2c')](handleEntityNotFound(_0x4be221,null))[_0xe612('0x2c')](function(_0x2c9722){if(_0x2c9722){_0x3005ac=_0x2c9722;_0x47ed63[_0xe612('0x38')]=_['keys'](db[_0xe612('0x5d')]['rawAttributes']);_0x47ed63[_0xe612('0x34')]=_[_0xe612('0x35')](_0x22f16f[_0xe612('0x34')]);_0x47ed63['filters']=_[_0xe612('0x37')](_0x47ed63['model'],_0x47ed63[_0xe612('0x34')]);_0x159f8d[_0xe612('0x3a')]=_['intersection'](_0x47ed63[_0xe612('0x38')],qs[_0xe612('0x39')](_0x22f16f['query']['fields']));_0x159f8d['attributes']=_0x159f8d['attributes']['length']?_0x159f8d[_0xe612('0x3a')]:_0x47ed63[_0xe612('0x38')];_0x159f8d['order']=qs[_0xe612('0x3e')](_0x22f16f[_0xe612('0x34')]['sort']);_0x159f8d[_0xe612('0x3f')]=qs[_0xe612('0x36')](_[_0xe612('0x40')](_0x22f16f['query'],_0x47ed63[_0xe612('0x36')]));if(_0x22f16f['query'][_0xe612('0x41')]){_0x159f8d[_0xe612('0x3f')]=_[_0xe612('0x42')](_0x159f8d[_0xe612('0x3f')],{'$or':_[_0xe612('0x43')](_0x159f8d[_0xe612('0x3a')],function(_0x3e5a7f){var _0x34d1fe={};_0x34d1fe[_0x3e5a7f]={'$like':'%'+_0x22f16f[_0xe612('0x34')][_0xe612('0x41')]+'%'};return _0x34d1fe;})});}_0x159f8d=_[_0xe612('0x42')]({},_0x159f8d,_0x22f16f[_0xe612('0x44')]);return _0x3005ac[_0xe612('0x88')](_0x159f8d);}})[_0xe612('0x2c')](function(_0x8fcaff){if(_0x8fcaff){_0x17acb4=_0x8fcaff[_0xe612('0x4c')];if(!_0x22f16f[_0xe612('0x34')][_0xe612('0x3b')]('nolimit')){_0x159f8d[_0xe612('0x23')]=qs[_0xe612('0x23')](_0x22f16f[_0xe612('0x34')][_0xe612('0x23')]);_0x159f8d[_0xe612('0x21')]=qs[_0xe612('0x21')](_0x22f16f[_0xe612('0x34')][_0xe612('0x21')]);}return _0x3005ac[_0xe612('0x88')](_0x159f8d);}})['then'](function(_0x203498){if(_0x203498){return _0x203498?{'count':_0x17acb4,'rows':_0x203498}:null;}})['then'](respondWithResult(_0x4be221,null))[_0xe612('0x49')](handleError(_0x4be221,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 6930238..cb0b439 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 _0xe692=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe692,0xd0));var _0x2e69=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xe692[_0x5a95fa];return _0x1a61b8;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x2e69('0x0'))['db'][_0x2e69('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x2e69('0x2')](0x0);var events={'afterCreate':_0x2e69('0x3'),'afterUpdate':_0x2e69('0x4'),'afterDestroy':_0x2e69('0x5')};function emitEvent(_0x43360b){return function(_0x3066e4,_0x1df782,_0x26358a){WhatsappQueueEvents[_0x2e69('0x6')](_0x43360b+':'+_0x3066e4['id'],_0x3066e4);WhatsappQueueEvents[_0x2e69('0x6')](_0x43360b,_0x3066e4);_0x26358a(null);};}for(var e in events){if(events[_0x2e69('0x7')](e)){var event=events[e];WhatsappQueue[_0x2e69('0x8')](e,emitEvent(event));}}module[_0x2e69('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x33bd=['emit','hook','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove'];(function(_0x2be2c7,_0x32900e){var _0x4cc9a7=function(_0x2a3c37){while(--_0x2a3c37){_0x2be2c7['push'](_0x2be2c7['shift']());}};_0x4cc9a7(++_0x32900e);}(_0x33bd,0x19a));var _0xd33b=function(_0x20369f,_0x5db98c){_0x20369f=_0x20369f-0x0;var _0x74c15d=_0x33bd[_0x20369f];return _0x74c15d;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xd33b('0x0'))['db'][_0xd33b('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd33b('0x2')](0x0);var events={'afterCreate':_0xd33b('0x3'),'afterUpdate':_0xd33b('0x4'),'afterDestroy':_0xd33b('0x5')};function emitEvent(_0x406a6d){return function(_0x39f82,_0x51e093,_0x11c609){WhatsappQueueEvents[_0xd33b('0x6')](_0x406a6d+':'+_0x39f82['id'],_0x39f82);WhatsappQueueEvents['emit'](_0x406a6d,_0x39f82);_0x11c609(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xd33b('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index e21195e..11deb2b 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 _0xa5b3=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues'];(function(_0x931675,_0x5a5a79){var _0x4d6672=function(_0x41746d){while(--_0x41746d){_0x931675['push'](_0x931675['shift']());}};_0x4d6672(++_0x5a5a79);}(_0xa5b3,0x1e0));var _0x3a5b=function(_0xd282a4,_0x48cd3a){_0xd282a4=_0xd282a4-0x0;var _0x486fcf=_0xa5b3[_0xd282a4];return _0x486fcf;};'use strict';var _=require(_0x3a5b('0x0'));var util=require(_0x3a5b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3a5b('0x2'));var BPromise=require(_0x3a5b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a5b('0x4'));var rimraf=require(_0x3a5b('0x5'));var config=require(_0x3a5b('0x6'));var attributes=require(_0x3a5b('0x7'));module[_0x3a5b('0x8')]=function(_0x5c6d37,_0x59a260){return _0x5c6d37[_0x3a5b('0x9')](_0x3a5b('0xa'),attributes,{'tableName':_0x3a5b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5688=['api','request-promise','path','rimraf','exports','WhatsappQueue','util','../../config/logger'];(function(_0x4f6bbb,_0x3e628a){var _0x1a9332=function(_0x306e5d){while(--_0x306e5d){_0x4f6bbb['push'](_0x4f6bbb['shift']());}};_0x1a9332(++_0x3e628a);}(_0x5688,0x186));var _0x8568=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x5688[_0x29db36];return _0x234e87;};'use strict';var _=require('lodash');var util=require(_0x8568('0x0'));var logger=require(_0x8568('0x1'))(_0x8568('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8568('0x3'));var fs=require('fs');var path=require(_0x8568('0x4'));var rimraf=require(_0x8568('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x8568('0x6')]=function(_0x2f62af,_0x2d50fb){return _0x2f62af['define'](_0x8568('0x7'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index af6fe34..800cd7d 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 _0xcd43=['error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowWhatsappQueue','find','debug','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3c73d1,_0x2c5b98){var _0x200bba=function(_0x23c557){while(--_0x23c557){_0x3c73d1['push'](_0x3c73d1['shift']());}};_0x200bba(++_0x2c5b98);}(_0xcd43,0x13a));var _0x3cd4=function(_0xf72b59,_0x387f27){_0xf72b59=_0xf72b59-0x0;var _0x2b723c=_0xcd43[_0xf72b59];return _0x2b723c;};'use strict';var _=require(_0x3cd4('0x0'));var util=require(_0x3cd4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3cd4('0x2'));var fs=require('fs');var Redis=require(_0x3cd4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3cd4('0x4'));var logger=require(_0x3cd4('0x5'))(_0x3cd4('0x6'));var config=require(_0x3cd4('0x7'));var jayson=require(_0x3cd4('0x8'));var client=jayson[_0x3cd4('0x9')][_0x3cd4('0xa')]({'port':0x232a});config['redis']=_[_0x3cd4('0xb')](config[_0x3cd4('0xc')],{'host':_0x3cd4('0xd'),'port':0x18eb});var socket=require(_0x3cd4('0xe'))(new Redis(config[_0x3cd4('0xc')]));require(_0x3cd4('0xf'))[_0x3cd4('0x10')](socket);function respondWithRpcPromise(_0x188380,_0x901627,_0x2d4f21){return new BPromise(function(_0x507c62,_0xde4f84){return client[_0x3cd4('0x11')](_0x188380,_0x2d4f21)[_0x3cd4('0x12')](function(_0x11ee08){logger[_0x3cd4('0x13')](_0x3cd4('0x14'),_0x901627,_0x3cd4('0x15'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x901627,_0x3cd4('0x15'),JSON['stringify'](_0x11ee08));if(_0x11ee08['error']){if(_0x11ee08[_0x3cd4('0x16')][_0x3cd4('0x17')]===0x1f4){logger[_0x3cd4('0x16')](_0x3cd4('0x14'),_0x901627,_0x11ee08['error']['message']);return _0xde4f84(_0x11ee08['error']['message']);}logger[_0x3cd4('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x901627,_0x11ee08[_0x3cd4('0x16')][_0x3cd4('0x18')]);return _0x507c62(_0x11ee08[_0x3cd4('0x16')][_0x3cd4('0x18')]);}else{logger[_0x3cd4('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x901627,_0x3cd4('0x15'));_0x507c62(_0x11ee08[_0x3cd4('0x19')][_0x3cd4('0x18')]);}})[_0x3cd4('0x1a')](function(_0x2addf0){logger[_0x3cd4('0x16')](_0x3cd4('0x14'),_0x901627,_0x2addf0);_0xde4f84(_0x2addf0);});});}exports[_0x3cd4('0x1b')]=function(_0x4127c2){var _0x5a0926=this;return new Promise(function(_0x439db6,_0xec7333){return db[_0x3cd4('0x1c')][_0x3cd4('0x1d')]({'raw':_0x4127c2[_0x3cd4('0x1e')]?_0x4127c2['options'][_0x3cd4('0x1f')]===undefined?!![]:![]:!![],'where':_0x4127c2[_0x3cd4('0x1e')]?_0x4127c2['options'][_0x3cd4('0x20')]||null:null,'attributes':_0x4127c2[_0x3cd4('0x1e')]?_0x4127c2[_0x3cd4('0x1e')][_0x3cd4('0x21')]||null:null,'limit':_0x4127c2[_0x3cd4('0x1e')]?_0x4127c2[_0x3cd4('0x1e')][_0x3cd4('0x22')]||null:null,'include':_0x4127c2[_0x3cd4('0x1e')]?_0x4127c2[_0x3cd4('0x1e')][_0x3cd4('0x23')]?_[_0x3cd4('0x24')](_0x4127c2['options'][_0x3cd4('0x23')],function(_0x3e95ca){return{'model':db[_0x3e95ca['model']],'as':_0x3e95ca['as'],'attributes':_0x3e95ca[_0x3cd4('0x21')],'include':_0x3e95ca['include']?_[_0x3cd4('0x24')](_0x3e95ca['include'],function(_0x4a660b){return{'model':db[_0x4a660b[_0x3cd4('0x25')]],'as':_0x4a660b['as'],'attributes':_0x4a660b[_0x3cd4('0x21')],'include':_0x4a660b[_0x3cd4('0x23')]?_[_0x3cd4('0x24')](_0x4a660b[_0x3cd4('0x23')],function(_0x184e28){return{'model':db[_0x184e28[_0x3cd4('0x25')]],'as':_0x184e28['as'],'attributes':_0x184e28['attributes']};}):[]};}):[]};}):[]:[]})[_0x3cd4('0x12')](function(_0x6a7598){logger[_0x3cd4('0x13')](_0x3cd4('0x1b'),_0x4127c2);logger['debug'](_0x3cd4('0x1b'),_0x4127c2,JSON[_0x3cd4('0x26')](_0x6a7598));_0x439db6(_0x6a7598);})['catch'](function(_0x24d222){logger['error'](_0x3cd4('0x1b'),_0x24d222[_0x3cd4('0x18')],_0x4127c2);_0xec7333(_0x5a0926['error'](0x1f4,_0x24d222['message']));});});};exports[_0x3cd4('0x27')]=function(_0x392ee2){var _0x18a892=this;return new Promise(function(_0x42448b,_0x5ab773){return db[_0x3cd4('0x1c')][_0x3cd4('0x28')]({'raw':_0x392ee2['options']?_0x392ee2[_0x3cd4('0x1e')][_0x3cd4('0x1f')]===undefined?!![]:![]:!![],'where':_0x392ee2[_0x3cd4('0x1e')]?_0x392ee2['options'][_0x3cd4('0x20')]||null:null,'attributes':_0x392ee2[_0x3cd4('0x1e')]?_0x392ee2[_0x3cd4('0x1e')]['attributes']||null:null,'include':_0x392ee2['options']?_0x392ee2[_0x3cd4('0x1e')][_0x3cd4('0x23')]?_[_0x3cd4('0x24')](_0x392ee2[_0x3cd4('0x1e')][_0x3cd4('0x23')],function(_0x3859ba){return{'model':db[_0x3859ba[_0x3cd4('0x25')]],'as':_0x3859ba['as'],'attributes':_0x3859ba[_0x3cd4('0x21')],'include':_0x3859ba[_0x3cd4('0x23')]?_[_0x3cd4('0x24')](_0x3859ba[_0x3cd4('0x23')],function(_0xaeec16){return{'model':db[_0xaeec16['model']],'as':_0xaeec16['as'],'attributes':_0xaeec16[_0x3cd4('0x21')],'include':_0xaeec16[_0x3cd4('0x23')]?_[_0x3cd4('0x24')](_0xaeec16[_0x3cd4('0x23')],function(_0x1e3a26){return{'model':db[_0x1e3a26[_0x3cd4('0x25')]],'as':_0x1e3a26['as'],'attributes':_0x1e3a26['attributes']};}):[]};}):[]};}):[]:[]})[_0x3cd4('0x12')](function(_0x300490){logger[_0x3cd4('0x13')]('ShowWhatsappQueue',_0x392ee2);logger[_0x3cd4('0x29')](_0x3cd4('0x27'),_0x392ee2,JSON['stringify'](_0x300490));_0x42448b(_0x300490);})['catch'](function(_0x1e425d){logger[_0x3cd4('0x16')](_0x3cd4('0x27'),_0x1e425d[_0x3cd4('0x18')],_0x392ee2);_0x5ab773(_0x18a892[_0x3cd4('0x16')](0x1f4,_0x1e425d[_0x3cd4('0x18')]));});});}; \ No newline at end of file +var _0xdbfa=['jayson/promise','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','limit','include','model','map','catch','ShowWhatsappQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1f60c2,_0x46bd6b){var _0xc3ef84=function(_0x2484d4){while(--_0x2484d4){_0x1f60c2['push'](_0x1f60c2['shift']());}};_0xc3ef84(++_0x46bd6b);}(_0xdbfa,0x156));var _0xadbf=function(_0x44bb5e,_0x48ab50){_0x44bb5e=_0x44bb5e-0x0;var _0x490872=_0xdbfa[_0x44bb5e];return _0x490872;};'use strict';var _=require(_0xadbf('0x0'));var util=require(_0xadbf('0x1'));var moment=require(_0xadbf('0x2'));var BPromise=require(_0xadbf('0x3'));var rs=require(_0xadbf('0x4'));var fs=require('fs');var Redis=require(_0xadbf('0x5'));var db=require(_0xadbf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xadbf('0x7'))(_0xadbf('0x8'));var config=require(_0xadbf('0x9'));var jayson=require(_0xadbf('0xa'));var client=jayson[_0xadbf('0xb')][_0xadbf('0xc')]({'port':0x232a});config[_0xadbf('0xd')]=_[_0xadbf('0xe')](config[_0xadbf('0xd')],{'host':_0xadbf('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xadbf('0xd')]));require(_0xadbf('0x10'))[_0xadbf('0x11')](socket);function respondWithRpcPromise(_0x1f5ac6,_0x242021,_0x771208){return new BPromise(function(_0x2b62bf,_0x5b9c09){return client[_0xadbf('0x12')](_0x1f5ac6,_0x771208)[_0xadbf('0x13')](function(_0x5617bd){logger[_0xadbf('0x14')](_0xadbf('0x15'),_0x242021,_0xadbf('0x16'));logger[_0xadbf('0x17')](_0xadbf('0x18'),_0x242021,_0xadbf('0x16'),JSON[_0xadbf('0x19')](_0x5617bd));if(_0x5617bd[_0xadbf('0x1a')]){if(_0x5617bd[_0xadbf('0x1a')][_0xadbf('0x1b')]===0x1f4){logger['error'](_0xadbf('0x15'),_0x242021,_0x5617bd[_0xadbf('0x1a')][_0xadbf('0x1c')]);return _0x5b9c09(_0x5617bd['error']['message']);}logger['error'](_0xadbf('0x15'),_0x242021,_0x5617bd[_0xadbf('0x1a')][_0xadbf('0x1c')]);return _0x2b62bf(_0x5617bd['error'][_0xadbf('0x1c')]);}else{logger[_0xadbf('0x14')](_0xadbf('0x15'),_0x242021,_0xadbf('0x16'));_0x2b62bf(_0x5617bd[_0xadbf('0x1d')][_0xadbf('0x1c')]);}})['catch'](function(_0x1336d4){logger[_0xadbf('0x1a')](_0xadbf('0x15'),_0x242021,_0x1336d4);_0x5b9c09(_0x1336d4);});});}exports[_0xadbf('0x1e')]=function(_0x1b0857){var _0x3dc26f=this;return new Promise(function(_0x3dbbfa,_0x12e086){return db[_0xadbf('0x1f')][_0xadbf('0x20')]({'raw':_0x1b0857[_0xadbf('0x21')]?_0x1b0857[_0xadbf('0x21')][_0xadbf('0x22')]===undefined?!![]:![]:!![],'where':_0x1b0857['options']?_0x1b0857[_0xadbf('0x21')]['where']||null:null,'attributes':_0x1b0857['options']?_0x1b0857['options'][_0xadbf('0x23')]||null:null,'limit':_0x1b0857[_0xadbf('0x21')]?_0x1b0857[_0xadbf('0x21')][_0xadbf('0x24')]||null:null,'include':_0x1b0857[_0xadbf('0x21')]?_0x1b0857[_0xadbf('0x21')][_0xadbf('0x25')]?_['map'](_0x1b0857[_0xadbf('0x21')][_0xadbf('0x25')],function(_0x52959e){return{'model':db[_0x52959e[_0xadbf('0x26')]],'as':_0x52959e['as'],'attributes':_0x52959e['attributes'],'include':_0x52959e[_0xadbf('0x25')]?_[_0xadbf('0x27')](_0x52959e[_0xadbf('0x25')],function(_0x20298d){return{'model':db[_0x20298d[_0xadbf('0x26')]],'as':_0x20298d['as'],'attributes':_0x20298d[_0xadbf('0x23')],'include':_0x20298d[_0xadbf('0x25')]?_['map'](_0x20298d[_0xadbf('0x25')],function(_0x52a182){return{'model':db[_0x52a182['model']],'as':_0x52a182['as'],'attributes':_0x52a182[_0xadbf('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ccf35){logger[_0xadbf('0x14')](_0xadbf('0x1e'),_0x1b0857);logger[_0xadbf('0x17')](_0xadbf('0x1e'),_0x1b0857,JSON[_0xadbf('0x19')](_0x2ccf35));_0x3dbbfa(_0x2ccf35);})[_0xadbf('0x28')](function(_0x2b95d2){logger['error'](_0xadbf('0x1e'),_0x2b95d2[_0xadbf('0x1c')],_0x1b0857);_0x12e086(_0x3dc26f[_0xadbf('0x1a')](0x1f4,_0x2b95d2[_0xadbf('0x1c')]));});});};exports[_0xadbf('0x29')]=function(_0x11d007){var _0x265571=this;return new Promise(function(_0x41bf94,_0x33b5f4){return db[_0xadbf('0x1f')][_0xadbf('0x2a')]({'raw':_0x11d007[_0xadbf('0x21')]?_0x11d007[_0xadbf('0x21')][_0xadbf('0x22')]===undefined?!![]:![]:!![],'where':_0x11d007['options']?_0x11d007['options'][_0xadbf('0x2b')]||null:null,'attributes':_0x11d007['options']?_0x11d007[_0xadbf('0x21')][_0xadbf('0x23')]||null:null,'include':_0x11d007[_0xadbf('0x21')]?_0x11d007['options']['include']?_[_0xadbf('0x27')](_0x11d007[_0xadbf('0x21')][_0xadbf('0x25')],function(_0x44a9d6){return{'model':db[_0x44a9d6[_0xadbf('0x26')]],'as':_0x44a9d6['as'],'attributes':_0x44a9d6[_0xadbf('0x23')],'include':_0x44a9d6[_0xadbf('0x25')]?_['map'](_0x44a9d6[_0xadbf('0x25')],function(_0x11cb7b){return{'model':db[_0x11cb7b[_0xadbf('0x26')]],'as':_0x11cb7b['as'],'attributes':_0x11cb7b[_0xadbf('0x23')],'include':_0x11cb7b['include']?_[_0xadbf('0x27')](_0x11cb7b[_0xadbf('0x25')],function(_0x560786){return{'model':db[_0x560786[_0xadbf('0x26')]],'as':_0x560786['as'],'attributes':_0x560786[_0xadbf('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b4357){logger[_0xadbf('0x14')]('ShowWhatsappQueue',_0x11d007);logger[_0xadbf('0x17')](_0xadbf('0x29'),_0x11d007,JSON['stringify'](_0x4b4357));_0x41bf94(_0x4b4357);})[_0xadbf('0x28')](function(_0x2c18d6){logger['error'](_0xadbf('0x29'),_0x2c18d6[_0xadbf('0x1c')],_0x11d007);_0x33b5f4(_0x265571[_0xadbf('0x1a')](0x1f4,_0x2c18d6[_0xadbf('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 762c322..1e97ddb 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 _0x4c2b=['./whatsappQueue.events','save','remove','removeListener','register','length','whatsappQueue:'];(function(_0x725639,_0x477a18){var _0x1b33e9=function(_0xa8d689){while(--_0xa8d689){_0x725639['push'](_0x725639['shift']());}};_0x1b33e9(++_0x477a18);}(_0x4c2b,0x181));var _0xb4c2=function(_0x34ecb9,_0x59387e){_0x34ecb9=_0x34ecb9-0x0;var _0x995157=_0x4c2b[_0x34ecb9];return _0x995157;};'use strict';var WhatsappQueueEvents=require(_0xb4c2('0x0'));var events=[_0xb4c2('0x1'),_0xb4c2('0x2'),'update'];function createListener(_0x286242,_0x1a444c){return function(_0x1eff34){_0x1a444c['emit'](_0x286242,_0x1eff34);};}function removeListener(_0x5dc029,_0x57fe65){return function(){WhatsappQueueEvents[_0xb4c2('0x3')](_0x5dc029,_0x57fe65);};}exports[_0xb4c2('0x4')]=function(_0x261a46){for(var _0x4f80dc=0x0,_0x224be2=events[_0xb4c2('0x5')];_0x4f80dc<_0x224be2;_0x4f80dc++){var _0x530a1c=events[_0x4f80dc];var _0x562dab=createListener(_0xb4c2('0x6')+_0x530a1c,_0x261a46);WhatsappQueueEvents['on'](_0x530a1c,_0x562dab);}}; \ No newline at end of file +var _0x40cf=['whatsappQueue:','./whatsappQueue.events','save','remove','update','removeListener','length'];(function(_0x5eb5e2,_0x44c89e){var _0x44e6a5=function(_0x6f8322){while(--_0x6f8322){_0x5eb5e2['push'](_0x5eb5e2['shift']());}};_0x44e6a5(++_0x44c89e);}(_0x40cf,0xa9));var _0xf40c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x40cf[_0x14add3];return _0x4a174f;};'use strict';var WhatsappQueueEvents=require(_0xf40c('0x0'));var events=[_0xf40c('0x1'),_0xf40c('0x2'),_0xf40c('0x3')];function createListener(_0xffdea6,_0x3b3dc5){return function(_0x24db5c){_0x3b3dc5['emit'](_0xffdea6,_0x24db5c);};}function removeListener(_0x55ec1d,_0x2f7ed5){return function(){WhatsappQueueEvents[_0xf40c('0x4')](_0x55ec1d,_0x2f7ed5);};}exports['register']=function(_0x2b21dd){for(var _0x56da7b=0x0,_0x1d59ef=events[_0xf40c('0x5')];_0x56da7b<_0x1d59ef;_0x56da7b++){var _0x39a0f1=events[_0x56da7b];var _0x3ef571=createListener(_0xf40c('0x6')+_0x39a0f1,_0x2b21dd);WhatsappQueueEvents['on'](_0x39a0f1,_0x3ef571);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 344599c..04efb06 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 _0xaace=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy'];(function(_0x2998db,_0x3424f1){var _0x115fea=function(_0x3b493c){while(--_0x3b493c){_0x2998db['push'](_0x2998db['shift']());}};_0x115fea(++_0x3424f1);}(_0xaace,0x78));var _0xeaac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaace[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xeaac('0x0'));var util=require(_0xeaac('0x1'));var path=require('path');var timeout=require(_0xeaac('0x2'));var express=require(_0xeaac('0x3'));var router=express[_0xeaac('0x4')]();var fs_extra=require(_0xeaac('0x5'));var auth=require(_0xeaac('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeaac('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0xeaac('0x8')]('/',auth[_0xeaac('0x9')](),controller[_0xeaac('0xa')]);router[_0xeaac('0x8')](_0xeaac('0xb'),auth[_0xeaac('0x9')](),controller[_0xeaac('0xc')]);router[_0xeaac('0x8')](_0xeaac('0xd'),auth[_0xeaac('0x9')](),controller[_0xeaac('0xe')]);router[_0xeaac('0xf')]('/',auth[_0xeaac('0x9')](),controller[_0xeaac('0x10')]);router['put'](_0xeaac('0xd'),auth[_0xeaac('0x9')](),controller[_0xeaac('0x11')]);router[_0xeaac('0x12')]('/:id',auth[_0xeaac('0x9')](),controller[_0xeaac('0x13')]);module['exports']=router; \ No newline at end of file +var _0x825d=['/:id','update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','create','put'];(function(_0x5f5225,_0x224c7d){var _0x30efee=function(_0xfe1afa){while(--_0xfe1afa){_0x5f5225['push'](_0x5f5225['shift']());}};_0x30efee(++_0x224c7d);}(_0x825d,0x7b));var _0xd825=function(_0x3609f8,_0x2cf633){_0x3609f8=_0x3609f8-0x0;var _0x4fcdd3=_0x825d[_0x3609f8];return _0x4fcdd3;};'use strict';var multer=require('multer');var util=require(_0xd825('0x0'));var path=require(_0xd825('0x1'));var timeout=require(_0xd825('0x2'));var express=require(_0xd825('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd825('0x4'));var interaction=require(_0xd825('0x5'));var config=require(_0xd825('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0xd825('0x7')]('/',auth['isAuthenticated'](),controller[_0xd825('0x8')]);router[_0xd825('0x7')](_0xd825('0x9'),auth[_0xd825('0xa')](),controller['describe']);router[_0xd825('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xd825('0xa')](),controller[_0xd825('0xb')]);router[_0xd825('0xc')](_0xd825('0xd'),auth[_0xd825('0xa')](),controller[_0xd825('0xe')]);router[_0xd825('0xf')](_0xd825('0xd'),auth[_0xd825('0xa')](),controller[_0xd825('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 7ae82cd..2bc4a55 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(_0x43961b,_0x242c2a){var _0x106b96=function(_0x4d8f47){while(--_0x4d8f47){_0x43961b['push'](_0x43961b['shift']());}};_0x106b96(++_0x242c2a);}(_0x7a54,0x106));var _0x47a5=function(_0x3d0c8c,_0x1f8c19){_0x3d0c8c=_0x3d0c8c-0x0;var _0x29303a=_0x7a54[_0x3d0c8c];return _0x29303a;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x13fa16,_0x3f5320){var _0x361d97=function(_0x434c2a){while(--_0x434c2a){_0x13fa16['push'](_0x13fa16['shift']());}};_0x361d97(++_0x3f5320);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index ee5782b..be39699 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 _0x02ce=['then','destroy','error','name','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','rows','catch','show','keys','includeAll','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update'];(function(_0x139c39,_0xc46751){var _0xdb9b55=function(_0x34e0d0){while(--_0x34e0d0){_0x139c39['push'](_0x139c39['shift']());}};_0xdb9b55(++_0xc46751);}(_0x02ce,0x1ac));var _0xe02c=function(_0x41d918,_0x1970ff){_0x41d918=_0x41d918-0x0;var _0xe69720=_0x02ce[_0x41d918];return _0xe69720;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];function respondWithStatusCode(_0x23d886,_0x32fc45){_0x32fc45=_0x32fc45||0xcc;return function(_0x5d6d13){if(_0x5d6d13){return _0x23d886[_0xe02c('0x1c')](_0x32fc45);}return _0x23d886['status'](_0x32fc45)['end']();};}function respondWithResult(_0x3f4e28,_0x56405a){_0x56405a=_0x56405a||0xc8;return function(_0x221910){if(_0x221910){return _0x3f4e28['status'](_0x56405a)[_0xe02c('0x1d')](_0x221910);}};}function respondWithFilteredResult(_0x4e9c6d,_0x256311){return function(_0x366893){if(_0x366893){var _0x59f2f6=typeof _0x256311[_0xe02c('0x1e')]===_0xe02c('0x1f')&&typeof _0x256311['limit']===_0xe02c('0x1f');var _0x20f492=_0x366893['count'];var _0x52917f=_0x59f2f6?0x0:_0x256311[_0xe02c('0x1e')];var _0x49604a=_0x59f2f6?_0x366893[_0xe02c('0x20')]:_0x256311[_0xe02c('0x1e')]+_0x256311[_0xe02c('0x21')];var _0x36fed0;if(_0x49604a>=_0x20f492){_0x49604a=_0x20f492;_0x36fed0=0xc8;}else{_0x36fed0=0xce;}_0x4e9c6d[_0xe02c('0x22')](_0x36fed0);return _0x4e9c6d['set'](_0xe02c('0x23'),_0x52917f+'-'+_0x49604a+'/'+_0x20f492)['json'](_0x366893);}return null;};}function patchUpdates(_0x4ea9b5){return function(_0x393621){try{jsonpatch[_0xe02c('0x24')](_0x393621,_0x4ea9b5,!![]);}catch(_0x480b9a){return BPromise[_0xe02c('0x25')](_0x480b9a);}return _0x393621[_0xe02c('0x26')]();};}function saveUpdates(_0x4ce5ee,_0x38dce2){return function(_0x45fd82){if(_0x45fd82){return _0x45fd82[_0xe02c('0x27')](_0x4ce5ee)[_0xe02c('0x28')](function(_0x2d44c8){return _0x2d44c8;});}return null;};}function removeEntity(_0x557142,_0x3e80e3){return function(_0xf41d4c){if(_0xf41d4c){return _0xf41d4c[_0xe02c('0x29')]()[_0xe02c('0x28')](function(){_0x557142[_0xe02c('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0xefd882,_0x4411d8){return function(_0x3592ca){if(!_0x3592ca){_0xefd882[_0xe02c('0x1c')](0x194);}return _0x3592ca;};}function handleError(_0x16dfa3,_0x303d24){_0x303d24=_0x303d24||0x1f4;return function(_0x43dc78){logger[_0xe02c('0x2a')](_0x43dc78['stack']);if(_0x43dc78[_0xe02c('0x2b')]){delete _0x43dc78[_0xe02c('0x2b')];}_0x16dfa3[_0xe02c('0x22')](_0x303d24)['send'](_0x43dc78);};}exports[_0xe02c('0x2c')]=function(_0x2d1d98,_0x445421){var _0x287f7e={},_0x1e7eab={},_0x35a309={'count':0x0,'rows':[]};var _0x22a285=_[_0xe02c('0x2d')](db[_0xe02c('0x2e')][_0xe02c('0x2f')],function(_0x17d5b3){return{'name':_0x17d5b3['fieldName'],'type':_0x17d5b3[_0xe02c('0x30')][_0xe02c('0x31')]};});_0x1e7eab[_0xe02c('0x32')]=_[_0xe02c('0x2d')](_0x22a285,_0xe02c('0x2b'));_0x1e7eab[_0xe02c('0x33')]=_['keys'](_0x2d1d98[_0xe02c('0x33')]);_0x1e7eab[_0xe02c('0x34')]=_['intersection'](_0x1e7eab[_0xe02c('0x32')],_0x1e7eab[_0xe02c('0x33')]);_0x287f7e[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x1e7eab[_0xe02c('0x32')],qs['fields'](_0x2d1d98['query'][_0xe02c('0x37')]));_0x287f7e[_0xe02c('0x35')]=_0x287f7e['attributes'][_0xe02c('0x38')]?_0x287f7e['attributes']:_0x1e7eab[_0xe02c('0x32')];if(!_0x2d1d98[_0xe02c('0x33')][_0xe02c('0x39')](_0xe02c('0x3a'))){_0x287f7e[_0xe02c('0x21')]=qs['limit'](_0x2d1d98[_0xe02c('0x33')]['limit']);_0x287f7e[_0xe02c('0x1e')]=qs[_0xe02c('0x1e')](_0x2d1d98[_0xe02c('0x33')][_0xe02c('0x1e')]);}_0x287f7e[_0xe02c('0x3b')]=qs[_0xe02c('0x3c')](_0x2d1d98['query'][_0xe02c('0x3c')]);_0x287f7e[_0xe02c('0x3d')]=qs['filters'](_[_0xe02c('0x3e')](_0x2d1d98[_0xe02c('0x33')],_0x1e7eab['filters']),_0x22a285);if(_0x2d1d98[_0xe02c('0x33')]['filter']){_0x287f7e[_0xe02c('0x3d')]=_[_0xe02c('0x3f')](_0x287f7e['where'],{'$or':_[_0xe02c('0x2d')](_0x22a285,function(_0x1eeddb){if(_0x1eeddb[_0xe02c('0x30')]!==_0xe02c('0x40')){var _0x3c4a65={};_0x3c4a65[_0x1eeddb[_0xe02c('0x2b')]]={'$like':'%'+_0x2d1d98['query'][_0xe02c('0x41')]+'%'};return _0x3c4a65;}})});}_0x287f7e=_['merge']({},_0x287f7e,_0x2d1d98['options']);var _0x3db057={'where':_0x287f7e[_0xe02c('0x3d')]};return db[_0xe02c('0x2e')][_0xe02c('0x20')](_0x3db057)['then'](function(_0x37e4fe){_0x35a309[_0xe02c('0x20')]=_0x37e4fe;if(_0x2d1d98[_0xe02c('0x33')]['includeAll']){_0x287f7e['include']=[{'all':!![]}];}return db[_0xe02c('0x2e')][_0xe02c('0x42')](_0x287f7e);})[_0xe02c('0x28')](function(_0x2313d2){_0x35a309[_0xe02c('0x43')]=_0x2313d2;return _0x35a309;})[_0xe02c('0x28')](respondWithFilteredResult(_0x445421,_0x287f7e))[_0xe02c('0x44')](handleError(_0x445421,null));};exports[_0xe02c('0x45')]=function(_0x21d66e,_0x53d123){var _0xc7e935={'raw':!![],'where':{'id':_0x21d66e['params']['id']}},_0x5ef4a1={};_0x5ef4a1[_0xe02c('0x32')]=_[_0xe02c('0x46')](db[_0xe02c('0x2e')][_0xe02c('0x2f')]);_0x5ef4a1[_0xe02c('0x33')]=_[_0xe02c('0x46')](_0x21d66e[_0xe02c('0x33')]);_0x5ef4a1[_0xe02c('0x34')]=_['intersection'](_0x5ef4a1['model'],_0x5ef4a1[_0xe02c('0x33')]);_0xc7e935[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x5ef4a1['model'],qs[_0xe02c('0x37')](_0x21d66e[_0xe02c('0x33')][_0xe02c('0x37')]));_0xc7e935[_0xe02c('0x35')]=_0xc7e935[_0xe02c('0x35')][_0xe02c('0x38')]?_0xc7e935[_0xe02c('0x35')]:_0x5ef4a1[_0xe02c('0x32')];if(_0x21d66e[_0xe02c('0x33')][_0xe02c('0x47')]){_0xc7e935['include']=[{'all':!![]}];}_0xc7e935=_[_0xe02c('0x3f')]({},_0xc7e935,_0x21d66e[_0xe02c('0x48')]);return db[_0xe02c('0x2e')][_0xe02c('0x49')](_0xc7e935)[_0xe02c('0x28')](handleEntityNotFound(_0x53d123,null))[_0xe02c('0x28')](respondWithResult(_0x53d123,null))[_0xe02c('0x44')](handleError(_0x53d123,null));};exports[_0xe02c('0x4a')]=function(_0x30dc90,_0x1176c9){return db[_0xe02c('0x2e')][_0xe02c('0x4a')](_0x30dc90[_0xe02c('0x4b')],{})['then'](respondWithResult(_0x1176c9,0xc9))[_0xe02c('0x44')](handleError(_0x1176c9,null));};exports['update']=function(_0x15b05c,_0x324911){if(_0x15b05c[_0xe02c('0x4b')]['id']){delete _0x15b05c[_0xe02c('0x4b')]['id'];}return db[_0xe02c('0x2e')][_0xe02c('0x49')]({'where':{'id':_0x15b05c[_0xe02c('0x4c')]['id']}})[_0xe02c('0x28')](handleEntityNotFound(_0x324911,null))[_0xe02c('0x28')](saveUpdates(_0x15b05c[_0xe02c('0x4b')],null))['then'](respondWithResult(_0x324911,null))[_0xe02c('0x44')](handleError(_0x324911,null));};exports[_0xe02c('0x29')]=function(_0xeb4214,_0x536cf7){return db[_0xe02c('0x2e')]['find']({'where':{'id':_0xeb4214[_0xe02c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x536cf7,null))['then'](removeEntity(_0x536cf7,null))['catch'](handleError(_0x536cf7,null));};exports['describe']=function(_0x51d540,_0x5740df){return db[_0xe02c('0x2e')][_0xe02c('0x4d')]()[_0xe02c('0x28')](respondWithResult(_0x5740df,null))[_0xe02c('0x44')](handleError(_0x5740df,null));}; \ No newline at end of file +var _0xbfcc=['destroy','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','offset','count','set','Content-Range','json','reject','then'];(function(_0x3bee7a,_0x95a83d){var _0x3a9081=function(_0x296808){while(--_0x296808){_0x3bee7a['push'](_0x3bee7a['shift']());}};_0x3a9081(++_0x95a83d);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xbfcc[_0x1992f1];return _0x413dfe;};'use strict';var emlformat=require(_0xcbfc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcbfc('0x1'));var rp=require(_0xcbfc('0x2'));var moment=require(_0xcbfc('0x3'));var BPromise=require(_0xcbfc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcbfc('0x5'));var ejs=require(_0xcbfc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbfc('0x7'));var squel=require('squel');var crypto=require(_0xcbfc('0x8'));var jsforce=require(_0xcbfc('0x9'));var deskjs=require(_0xcbfc('0xa'));var toCsv=require(_0xcbfc('0x5'));var querystring=require('querystring');var Papa=require(_0xcbfc('0xb'));var Redis=require(_0xcbfc('0xc'));var authService=require(_0xcbfc('0xd'));var qs=require(_0xcbfc('0xe'));var as=require(_0xcbfc('0xf'));var hardwareService=require(_0xcbfc('0x10'));var logger=require('../../config/logger')(_0xcbfc('0x11'));var utils=require(_0xcbfc('0x12'));var config=require(_0xcbfc('0x13'));var licenseUtil=require(_0xcbfc('0x14'));var db=require(_0xcbfc('0x15'))['db'];function respondWithStatusCode(_0x4e8b34,_0x3bfd05){_0x3bfd05=_0x3bfd05||0xcc;return function(_0x86f67c){if(_0x86f67c){return _0x4e8b34[_0xcbfc('0x16')](_0x3bfd05);}return _0x4e8b34['status'](_0x3bfd05)[_0xcbfc('0x17')]();};}function respondWithResult(_0x3ec338,_0x2f2bdd){_0x2f2bdd=_0x2f2bdd||0xc8;return function(_0x45a5cc){if(_0x45a5cc){return _0x3ec338[_0xcbfc('0x18')](_0x2f2bdd)['json'](_0x45a5cc);}};}function respondWithFilteredResult(_0x3c69ed,_0x1963de){return function(_0x1ec8c4){if(_0x1ec8c4){var _0x4317e4=typeof _0x1963de['offset']==='undefined'&&typeof _0x1963de[_0xcbfc('0x19')]===_0xcbfc('0x1a');var _0xa65368=_0x1ec8c4['count'];var _0x5b078f=_0x4317e4?0x0:_0x1963de[_0xcbfc('0x1b')];var _0x99b59d=_0x4317e4?_0x1ec8c4[_0xcbfc('0x1c')]:_0x1963de['offset']+_0x1963de[_0xcbfc('0x19')];var _0x552777;if(_0x99b59d>=_0xa65368){_0x99b59d=_0xa65368;_0x552777=0xc8;}else{_0x552777=0xce;}_0x3c69ed[_0xcbfc('0x18')](_0x552777);return _0x3c69ed[_0xcbfc('0x1d')](_0xcbfc('0x1e'),_0x5b078f+'-'+_0x99b59d+'/'+_0xa65368)[_0xcbfc('0x1f')](_0x1ec8c4);}return null;};}function patchUpdates(_0x25c167){return function(_0x2653b1){try{jsonpatch['apply'](_0x2653b1,_0x25c167,!![]);}catch(_0x9c79da){return BPromise[_0xcbfc('0x20')](_0x9c79da);}return _0x2653b1['save']();};}function saveUpdates(_0x1da958,_0x5a449b){return function(_0x4cc8b3){if(_0x4cc8b3){return _0x4cc8b3['update'](_0x1da958)[_0xcbfc('0x21')](function(_0x4a0fcb){return _0x4a0fcb;});}return null;};}function removeEntity(_0x4a1915,_0x1b3e42){return function(_0x34cffa){if(_0x34cffa){return _0x34cffa[_0xcbfc('0x22')]()[_0xcbfc('0x21')](function(){_0x4a1915['status'](0xcc)[_0xcbfc('0x17')]();});}};}function handleEntityNotFound(_0x51284a,_0x280b78){return function(_0x75bca0){if(!_0x75bca0){_0x51284a['sendStatus'](0x194);}return _0x75bca0;};}function handleError(_0x28bdcf,_0x3b73a3){_0x3b73a3=_0x3b73a3||0x1f4;return function(_0x4ab48e){logger[_0xcbfc('0x23')](_0x4ab48e[_0xcbfc('0x24')]);if(_0x4ab48e[_0xcbfc('0x25')]){delete _0x4ab48e[_0xcbfc('0x25')];}_0x28bdcf['status'](_0x3b73a3)[_0xcbfc('0x26')](_0x4ab48e);};}exports[_0xcbfc('0x27')]=function(_0x4f632a,_0x1f6a14){var _0x26463f={},_0x7cbdfa={},_0x388d41={'count':0x0,'rows':[]};var _0x2b4286=_[_0xcbfc('0x28')](db[_0xcbfc('0x29')]['rawAttributes'],function(_0x41b68b){return{'name':_0x41b68b[_0xcbfc('0x2a')],'type':_0x41b68b[_0xcbfc('0x2b')][_0xcbfc('0x2c')]};});_0x7cbdfa['model']=_[_0xcbfc('0x28')](_0x2b4286,_0xcbfc('0x25'));_0x7cbdfa[_0xcbfc('0x2d')]=_[_0xcbfc('0x2e')](_0x4f632a[_0xcbfc('0x2d')]);_0x7cbdfa[_0xcbfc('0x2f')]=_[_0xcbfc('0x30')](_0x7cbdfa['model'],_0x7cbdfa[_0xcbfc('0x2d')]);_0x26463f[_0xcbfc('0x31')]=_['intersection'](_0x7cbdfa[_0xcbfc('0x32')],qs[_0xcbfc('0x33')](_0x4f632a[_0xcbfc('0x2d')]['fields']));_0x26463f['attributes']=_0x26463f['attributes'][_0xcbfc('0x34')]?_0x26463f[_0xcbfc('0x31')]:_0x7cbdfa[_0xcbfc('0x32')];if(!_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x35')](_0xcbfc('0x36'))){_0x26463f[_0xcbfc('0x19')]=qs[_0xcbfc('0x19')](_0x4f632a['query'][_0xcbfc('0x19')]);_0x26463f[_0xcbfc('0x1b')]=qs['offset'](_0x4f632a[_0xcbfc('0x2d')]['offset']);}_0x26463f[_0xcbfc('0x37')]=qs[_0xcbfc('0x38')](_0x4f632a[_0xcbfc('0x2d')]['sort']);_0x26463f[_0xcbfc('0x39')]=qs['filters'](_['pick'](_0x4f632a[_0xcbfc('0x2d')],_0x7cbdfa[_0xcbfc('0x2f')]),_0x2b4286);if(_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3a')]){_0x26463f[_0xcbfc('0x39')]=_[_0xcbfc('0x3b')](_0x26463f[_0xcbfc('0x39')],{'$or':_[_0xcbfc('0x28')](_0x2b4286,function(_0x5cf4fa){if(_0x5cf4fa[_0xcbfc('0x2b')]!=='VIRTUAL'){var _0x15a5c4={};_0x15a5c4[_0x5cf4fa[_0xcbfc('0x25')]]={'$like':'%'+_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3a')]+'%'};return _0x15a5c4;}})});}_0x26463f=_['merge']({},_0x26463f,_0x4f632a['options']);var _0x236b66={'where':_0x26463f[_0xcbfc('0x39')]};return db[_0xcbfc('0x29')][_0xcbfc('0x1c')](_0x236b66)[_0xcbfc('0x21')](function(_0x4aa189){_0x388d41[_0xcbfc('0x1c')]=_0x4aa189;if(_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3c')]){_0x26463f['include']=[{'all':!![]}];}return db[_0xcbfc('0x29')][_0xcbfc('0x3d')](_0x26463f);})[_0xcbfc('0x21')](function(_0x4ca55c){_0x388d41[_0xcbfc('0x3e')]=_0x4ca55c;return _0x388d41;})[_0xcbfc('0x21')](respondWithFilteredResult(_0x1f6a14,_0x26463f))[_0xcbfc('0x3f')](handleError(_0x1f6a14,null));};exports[_0xcbfc('0x40')]=function(_0x102f4f,_0x28447a){var _0x1e14bb={'raw':!![],'where':{'id':_0x102f4f[_0xcbfc('0x41')]['id']}},_0x561544={};_0x561544[_0xcbfc('0x32')]=_['keys'](db[_0xcbfc('0x29')][_0xcbfc('0x42')]);_0x561544[_0xcbfc('0x2d')]=_[_0xcbfc('0x2e')](_0x102f4f[_0xcbfc('0x2d')]);_0x561544[_0xcbfc('0x2f')]=_[_0xcbfc('0x30')](_0x561544[_0xcbfc('0x32')],_0x561544['query']);_0x1e14bb[_0xcbfc('0x31')]=_[_0xcbfc('0x30')](_0x561544[_0xcbfc('0x32')],qs[_0xcbfc('0x33')](_0x102f4f[_0xcbfc('0x2d')][_0xcbfc('0x33')]));_0x1e14bb[_0xcbfc('0x31')]=_0x1e14bb['attributes'][_0xcbfc('0x34')]?_0x1e14bb[_0xcbfc('0x31')]:_0x561544['model'];if(_0x102f4f[_0xcbfc('0x2d')][_0xcbfc('0x3c')]){_0x1e14bb[_0xcbfc('0x43')]=[{'all':!![]}];}_0x1e14bb=_['merge']({},_0x1e14bb,_0x102f4f[_0xcbfc('0x44')]);return db[_0xcbfc('0x29')][_0xcbfc('0x45')](_0x1e14bb)[_0xcbfc('0x21')](handleEntityNotFound(_0x28447a,null))[_0xcbfc('0x21')](respondWithResult(_0x28447a,null))[_0xcbfc('0x3f')](handleError(_0x28447a,null));};exports[_0xcbfc('0x46')]=function(_0x55fc0b,_0x5a87b6){return db[_0xcbfc('0x29')][_0xcbfc('0x46')](_0x55fc0b[_0xcbfc('0x47')],{})[_0xcbfc('0x21')](respondWithResult(_0x5a87b6,0xc9))['catch'](handleError(_0x5a87b6,null));};exports['update']=function(_0x2e89bf,_0xe5c5ef){if(_0x2e89bf[_0xcbfc('0x47')]['id']){delete _0x2e89bf['body']['id'];}return db[_0xcbfc('0x29')][_0xcbfc('0x45')]({'where':{'id':_0x2e89bf[_0xcbfc('0x41')]['id']}})['then'](handleEntityNotFound(_0xe5c5ef,null))[_0xcbfc('0x21')](saveUpdates(_0x2e89bf[_0xcbfc('0x47')],null))[_0xcbfc('0x21')](respondWithResult(_0xe5c5ef,null))[_0xcbfc('0x3f')](handleError(_0xe5c5ef,null));};exports[_0xcbfc('0x22')]=function(_0xd9976d,_0x222b58){return db[_0xcbfc('0x29')][_0xcbfc('0x45')]({'where':{'id':_0xd9976d[_0xcbfc('0x41')]['id']}})['then'](handleEntityNotFound(_0x222b58,null))[_0xcbfc('0x21')](removeEntity(_0x222b58,null))[_0xcbfc('0x3f')](handleError(_0x222b58,null));};exports[_0xcbfc('0x48')]=function(_0x5c2ad9,_0x28ae7f){return db[_0xcbfc('0x29')]['describe']()[_0xcbfc('0x21')](respondWithResult(_0x28ae7f,null))[_0xcbfc('0x3f')](handleError(_0x28ae7f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index ecced28..a365900 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 _0xf1eb=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf1eb,0xdb));var _0xbf1e=function(_0x4b496d,_0x438871){_0x4b496d=_0x4b496d-0x0;var _0x3decdd=_0xf1eb[_0x4b496d];return _0x3decdd;};'use strict';var _=require(_0xbf1e('0x0'));var util=require('util');var logger=require(_0xbf1e('0x1'))(_0xbf1e('0x2'));var moment=require(_0xbf1e('0x3'));var BPromise=require(_0xbf1e('0x4'));var rp=require(_0xbf1e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf1e('0x6'));var config=require(_0xbf1e('0x7'));var attributes=require(_0xbf1e('0x8'));module[_0xbf1e('0x9')]=function(_0x5a1f85,_0xb9f1b1){return _0x5a1f85[_0xbf1e('0xa')](_0xbf1e('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbf1e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x02fd=['request-promise','path','rimraf','../../config/environment','define','WhatsappQueueReport','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x02fd,0xdf));var _0xd02f=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x02fd[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0xd02f('0x0'));var util=require('util');var logger=require(_0xd02f('0x1'))(_0xd02f('0x2'));var moment=require(_0xd02f('0x3'));var BPromise=require(_0xd02f('0x4'));var rp=require(_0xd02f('0x5'));var fs=require('fs');var path=require(_0xd02f('0x6'));var rimraf=require(_0xd02f('0x7'));var config=require(_0xd02f('0x8'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x1c1d9c,_0x2440e7){return _0x1c1d9c[_0xd02f('0x9')](_0xd02f('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xd02f('0xb'),'fields':[_0xd02f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 5ed84e1..1e19b7b 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 _0xe819=['WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','WhatsappQueueReport','body','options','raw','then','CreateWhatsappQueueReport','stringify','UpdateWhatsappQueueReport','update','where','attributes','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x8c1005,_0x1f3f16){var _0x175354=function(_0xd0e9c4){while(--_0xd0e9c4){_0x8c1005['push'](_0x8c1005['shift']());}};_0x175354(++_0x1f3f16);}(_0xe819,0x1a3));var _0x9e81=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xe819[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x9e81('0x0'));var util=require(_0x9e81('0x1'));var moment=require(_0x9e81('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e81('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e81('0x4'))(_0x9e81('0x5'));var config=require(_0x9e81('0x6'));var jayson=require(_0x9e81('0x7'));var client=jayson[_0x9e81('0x8')][_0x9e81('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x560784,_0x2fd647,_0x3eab31){return new BPromise(function(_0x25e60c,_0x14407f){return client[_0x9e81('0xa')](_0x560784,_0x3eab31)['then'](function(_0x50059b){logger[_0x9e81('0xb')](_0x9e81('0xc'),_0x2fd647,_0x9e81('0xd'));logger[_0x9e81('0xe')](_0x9e81('0xf'),_0x2fd647,'request\x20sent',JSON['stringify'](_0x50059b));if(_0x50059b[_0x9e81('0x10')]){if(_0x50059b['error'][_0x9e81('0x11')]===0x1f4){logger['error'](_0x9e81('0xc'),_0x2fd647,_0x50059b[_0x9e81('0x10')][_0x9e81('0x12')]);return _0x14407f(_0x50059b[_0x9e81('0x10')][_0x9e81('0x12')]);}logger['error'](_0x9e81('0xc'),_0x2fd647,_0x50059b[_0x9e81('0x10')]['message']);return _0x25e60c(_0x50059b[_0x9e81('0x10')]['message']);}else{logger['info'](_0x9e81('0xc'),_0x2fd647,'request\x20sent');_0x25e60c(_0x50059b['result'][_0x9e81('0x12')]);}})[_0x9e81('0x13')](function(_0x327180){logger[_0x9e81('0x10')](_0x9e81('0xc'),_0x2fd647,_0x327180);_0x14407f(_0x327180);});});}exports['CreateWhatsappQueueReport']=function(_0x255597){var _0x54dbb5=this;return new Promise(function(_0x16ef53,_0x308e97){return db[_0x9e81('0x14')]['create'](_0x255597[_0x9e81('0x15')],{'raw':_0x255597['options']?_0x255597[_0x9e81('0x16')][_0x9e81('0x17')]===undefined?!![]:![]:!![]})[_0x9e81('0x18')](function(_0xe00168){logger[_0x9e81('0xb')]('CreateWhatsappQueueReport',_0x255597);logger[_0x9e81('0xe')](_0x9e81('0x19'),_0x255597,JSON[_0x9e81('0x1a')](_0xe00168));_0x16ef53(_0xe00168);})[_0x9e81('0x13')](function(_0x531aa8){logger[_0x9e81('0x10')]('CreateWhatsappQueueReport',_0x531aa8[_0x9e81('0x12')],_0x255597);_0x308e97(_0x54dbb5[_0x9e81('0x10')](0x1f4,_0x531aa8[_0x9e81('0x12')]));});});};exports[_0x9e81('0x1b')]=function(_0x31652c){var _0x12cfaa=this;return new Promise(function(_0x24b4d0,_0x1a7583){return db[_0x9e81('0x14')][_0x9e81('0x1c')](_0x31652c[_0x9e81('0x15')],{'raw':_0x31652c[_0x9e81('0x16')]?_0x31652c[_0x9e81('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31652c['options']?_0x31652c[_0x9e81('0x16')][_0x9e81('0x1d')]||null:null,'attributes':_0x31652c[_0x9e81('0x16')]?_0x31652c[_0x9e81('0x16')][_0x9e81('0x1e')]||null:null,'limit':_0x31652c[_0x9e81('0x16')]?_0x31652c[_0x9e81('0x16')]['limit']||null:null})['then'](function(_0x163e06){logger[_0x9e81('0xb')]('UpdateWhatsappQueueReport',_0x31652c);logger[_0x9e81('0xe')](_0x9e81('0x1b'),_0x31652c,JSON[_0x9e81('0x1a')](_0x163e06));_0x24b4d0(_0x163e06);})['catch'](function(_0x589d6f){logger[_0x9e81('0x10')](_0x9e81('0x1b'),_0x589d6f[_0x9e81('0x12')],_0x31652c);_0x1a7583(_0x12cfaa[_0x9e81('0x10')](0x1f4,_0x589d6f[_0x9e81('0x12')]));});});}; \ No newline at end of file +var _0xdff5=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','WhatsappQueueReport','create','body','options','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','raw','attributes','limit','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x4950e5,_0x3558ea){var _0x5be113=function(_0x4e3716){while(--_0x4e3716){_0x4950e5['push'](_0x4950e5['shift']());}};_0x5be113(++_0x3558ea);}(_0xdff5,0x1bb));var _0x5dff=function(_0x3d7b67,_0x1fb5bd){_0x3d7b67=_0x3d7b67-0x0;var _0x514c12=_0xdff5[_0x3d7b67];return _0x514c12;};'use strict';var _=require(_0x5dff('0x0'));var util=require(_0x5dff('0x1'));var moment=require(_0x5dff('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dff('0x3'));var db=require(_0x5dff('0x4'))['db'];var utils=require(_0x5dff('0x5'));var logger=require(_0x5dff('0x6'))(_0x5dff('0x7'));var config=require(_0x5dff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5dff('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x240493,_0x53dd52,_0x2c3d30){return new BPromise(function(_0x1c968e,_0x20456f){return client[_0x5dff('0xa')](_0x240493,_0x2c3d30)[_0x5dff('0xb')](function(_0x417283){logger['info'](_0x5dff('0xc'),_0x53dd52,_0x5dff('0xd'));logger[_0x5dff('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x53dd52,'request\x20sent',JSON[_0x5dff('0xf')](_0x417283));if(_0x417283['error']){if(_0x417283[_0x5dff('0x10')][_0x5dff('0x11')]===0x1f4){logger[_0x5dff('0x10')](_0x5dff('0xc'),_0x53dd52,_0x417283[_0x5dff('0x10')][_0x5dff('0x12')]);return _0x20456f(_0x417283[_0x5dff('0x10')]['message']);}logger[_0x5dff('0x10')](_0x5dff('0xc'),_0x53dd52,_0x417283[_0x5dff('0x10')][_0x5dff('0x12')]);return _0x1c968e(_0x417283[_0x5dff('0x10')]['message']);}else{logger[_0x5dff('0x13')](_0x5dff('0xc'),_0x53dd52,'request\x20sent');_0x1c968e(_0x417283[_0x5dff('0x14')][_0x5dff('0x12')]);}})[_0x5dff('0x15')](function(_0x29fc09){logger[_0x5dff('0x10')](_0x5dff('0xc'),_0x53dd52,_0x29fc09);_0x20456f(_0x29fc09);});});}exports['CreateWhatsappQueueReport']=function(_0x8bec5a){var _0x41d498=this;return new Promise(function(_0x4bf38f,_0x5edbf5){return db[_0x5dff('0x16')][_0x5dff('0x17')](_0x8bec5a[_0x5dff('0x18')],{'raw':_0x8bec5a[_0x5dff('0x19')]?_0x8bec5a[_0x5dff('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x5dff('0xb')](function(_0x2d5707){logger[_0x5dff('0x13')](_0x5dff('0x1a'),_0x8bec5a);logger['debug']('CreateWhatsappQueueReport',_0x8bec5a,JSON[_0x5dff('0xf')](_0x2d5707));_0x4bf38f(_0x2d5707);})['catch'](function(_0x38efd0){logger[_0x5dff('0x10')](_0x5dff('0x1a'),_0x38efd0[_0x5dff('0x12')],_0x8bec5a);_0x5edbf5(_0x41d498[_0x5dff('0x10')](0x1f4,_0x38efd0[_0x5dff('0x12')]));});});};exports[_0x5dff('0x1b')]=function(_0x4abc1e){var _0x1af9a1=this;return new Promise(function(_0x20ea92,_0x289efe){return db[_0x5dff('0x16')][_0x5dff('0x1c')](_0x4abc1e[_0x5dff('0x18')],{'raw':_0x4abc1e['options']?_0x4abc1e['options'][_0x5dff('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4abc1e[_0x5dff('0x19')]?_0x4abc1e[_0x5dff('0x19')]['where']||null:null,'attributes':_0x4abc1e[_0x5dff('0x19')]?_0x4abc1e[_0x5dff('0x19')][_0x5dff('0x1e')]||null:null,'limit':_0x4abc1e[_0x5dff('0x19')]?_0x4abc1e[_0x5dff('0x19')][_0x5dff('0x1f')]||null:null})[_0x5dff('0xb')](function(_0x271830){logger['info'](_0x5dff('0x1b'),_0x4abc1e);logger[_0x5dff('0xe')](_0x5dff('0x1b'),_0x4abc1e,JSON['stringify'](_0x271830));_0x20ea92(_0x271830);})[_0x5dff('0x15')](function(_0x46e3e8){logger[_0x5dff('0x10')](_0x5dff('0x1b'),_0x46e3e8['message'],_0x4abc1e);_0x289efe(_0x1af9a1[_0x5dff('0x10')](0x1f4,_0x46e3e8[_0x5dff('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index f567d6f..9eca7c0 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 _0xbfb0=['post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','show'];(function(_0x3eac5b,_0x4ab9de){var _0x243df1=function(_0x3cc11d){while(--_0x3cc11d){_0x3eac5b['push'](_0x3eac5b['shift']());}};_0x243df1(++_0x4ab9de);}(_0xbfb0,0x197));var _0x0bfb=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0xbfb0[_0x564821];return _0x2b604d;};'use strict';var multer=require(_0x0bfb('0x0'));var util=require(_0x0bfb('0x1'));var path=require(_0x0bfb('0x2'));var timeout=require(_0x0bfb('0x3'));var express=require('express');var router=express[_0x0bfb('0x4')]();var fs_extra=require(_0x0bfb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0bfb('0x6'));var config=require('../../config/environment');var controller=require(_0x0bfb('0x7'));router[_0x0bfb('0x8')]('/',auth[_0x0bfb('0x9')](),controller[_0x0bfb('0xa')]);router[_0x0bfb('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x0bfb('0xb')]);router[_0x0bfb('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0bfb('0xc')]);router[_0x0bfb('0xd')]('/',auth[_0x0bfb('0x9')](),controller[_0x0bfb('0xe')]);router[_0x0bfb('0xf')](_0x0bfb('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x0bfb('0x11')](_0x0bfb('0x10'),auth[_0x0bfb('0x9')](),controller[_0x0bfb('0x12')]);module[_0x0bfb('0x13')]=router; \ No newline at end of file +var _0x4dd3=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','describe','show','post','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x29b083,_0x5157a4){var _0x38d17a=function(_0x49b261){while(--_0x49b261){_0x29b083['push'](_0x29b083['shift']());}};_0x38d17a(++_0x5157a4);}(_0x4dd3,0x14c));var _0x34dd=function(_0x4e0a03,_0x5eb6b0){_0x4e0a03=_0x4e0a03-0x0;var _0x2478fc=_0x4dd3[_0x4e0a03];return _0x2478fc;};'use strict';var multer=require('multer');var util=require(_0x34dd('0x0'));var path=require(_0x34dd('0x1'));var timeout=require(_0x34dd('0x2'));var express=require(_0x34dd('0x3'));var router=express[_0x34dd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34dd('0x5'));var interaction=require(_0x34dd('0x6'));var config=require(_0x34dd('0x7'));var controller=require(_0x34dd('0x8'));router['get']('/',auth[_0x34dd('0x9')](),controller[_0x34dd('0xa')]);router[_0x34dd('0xb')]('/describe',auth[_0x34dd('0x9')](),controller[_0x34dd('0xc')]);router[_0x34dd('0xb')]('/:id',auth[_0x34dd('0x9')](),controller[_0x34dd('0xd')]);router[_0x34dd('0xe')]('/',auth[_0x34dd('0x9')](),controller[_0x34dd('0xf')]);router[_0x34dd('0x10')](_0x34dd('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x34dd('0x12')](_0x34dd('0x11'),auth[_0x34dd('0x9')](),controller[_0x34dd('0x13')]);module[_0x34dd('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index dd8aef3..4c42d5f 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 _0x117c=['queue','DATE','ENUM'];(function(_0xb4d40c,_0x51256d){var _0x53556b=function(_0x54c078){while(--_0x54c078){_0xb4d40c['push'](_0xb4d40c['shift']());}};_0x53556b(++_0x51256d);}(_0x117c,0x71));var _0xc117=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x117c[_0x24259d];return _0x5a701;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc117('0x0')]('account','agent',_0xc117('0x1')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xc117('0x2')]}}; \ No newline at end of file +var _0x3306=['ENUM','agent','queue','DATE','sequelize','exports','STRING'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x3306,0x107));var _0x6330=function(_0xf33adc,_0x53af83){_0xf33adc=_0xf33adc-0x0;var _0x527f43=_0x3306[_0xf33adc];return _0x527f43;};'use strict';var Sequelize=require(_0x6330('0x0'));module[_0x6330('0x1')]={'uniqueid':{'type':Sequelize[_0x6330('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6330('0x3')]('account',_0x6330('0x4'),_0x6330('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x6330('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index e68dcdc..8a8e91c 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 _0xecc8=['sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','save','update','then','error','stack','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','length','find','create','body','destroy','describe','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4756fc,_0x43ad07){var _0x5f4459=function(_0x4cf6c3){while(--_0x4cf6c3){_0x4756fc['push'](_0x4756fc['shift']());}};_0x5f4459(++_0x43ad07);}(_0xecc8,0x111));var _0x8ecc=function(_0x4275e9,_0x593c5d){_0x4275e9=_0x4275e9-0x0;var _0x3286ea=_0xecc8[_0x4275e9];return _0x3286ea;};'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(_0x8ecc('0x0'));var moment=require('moment');var BPromise=require(_0x8ecc('0x1'));var Mustache=require(_0x8ecc('0x2'));var util=require(_0x8ecc('0x3'));var path=require('path');var sox=require(_0x8ecc('0x4'));var csv=require(_0x8ecc('0x5'));var ejs=require(_0x8ecc('0x6'));var fs=require('fs');var fs_extra=require(_0x8ecc('0x7'));var _=require(_0x8ecc('0x8'));var squel=require('squel');var crypto=require(_0x8ecc('0x9'));var jsforce=require(_0x8ecc('0xa'));var deskjs=require(_0x8ecc('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ecc('0xc'));var Redis=require(_0x8ecc('0xd'));var authService=require(_0x8ecc('0xe'));var qs=require(_0x8ecc('0xf'));var as=require(_0x8ecc('0x10'));var hardwareService=require(_0x8ecc('0x11'));var logger=require(_0x8ecc('0x12'))('api');var utils=require(_0x8ecc('0x13'));var config=require(_0x8ecc('0x14'));var licenseUtil=require(_0x8ecc('0x15'));var db=require(_0x8ecc('0x16'))['db'];function respondWithStatusCode(_0x2b9dd3,_0x144c87){_0x144c87=_0x144c87||0xcc;return function(_0x57fc51){if(_0x57fc51){return _0x2b9dd3[_0x8ecc('0x17')](_0x144c87);}return _0x2b9dd3[_0x8ecc('0x18')](_0x144c87)[_0x8ecc('0x19')]();};}function respondWithResult(_0x4f99ab,_0x50dcd3){_0x50dcd3=_0x50dcd3||0xc8;return function(_0xd9feb){if(_0xd9feb){return _0x4f99ab['status'](_0x50dcd3)[_0x8ecc('0x1a')](_0xd9feb);}};}function respondWithFilteredResult(_0x519dc3,_0x3a0ee3){return function(_0x5e10c3){if(_0x5e10c3){var _0x4e04dc=typeof _0x3a0ee3[_0x8ecc('0x1b')]===_0x8ecc('0x1c')&&typeof _0x3a0ee3['limit']===_0x8ecc('0x1c');var _0x27a3a3=_0x5e10c3['count'];var _0x3f6756=_0x4e04dc?0x0:_0x3a0ee3['offset'];var _0x3d4ee5=_0x4e04dc?_0x5e10c3[_0x8ecc('0x1d')]:_0x3a0ee3[_0x8ecc('0x1b')]+_0x3a0ee3[_0x8ecc('0x1e')];var _0x43166c;if(_0x3d4ee5>=_0x27a3a3){_0x3d4ee5=_0x27a3a3;_0x43166c=0xc8;}else{_0x43166c=0xce;}_0x519dc3[_0x8ecc('0x18')](_0x43166c);return _0x519dc3['set'](_0x8ecc('0x1f'),_0x3f6756+'-'+_0x3d4ee5+'/'+_0x27a3a3)['json'](_0x5e10c3);}return null;};}function patchUpdates(_0x365f3d){return function(_0x3427f2){try{jsonpatch['apply'](_0x3427f2,_0x365f3d,!![]);}catch(_0x4aff41){return BPromise['reject'](_0x4aff41);}return _0x3427f2[_0x8ecc('0x20')]();};}function saveUpdates(_0x55425d,_0x23bfc4){return function(_0x179575){if(_0x179575){return _0x179575[_0x8ecc('0x21')](_0x55425d)[_0x8ecc('0x22')](function(_0x303018){return _0x303018;});}return null;};}function removeEntity(_0x52ddd1,_0xfbd3e1){return function(_0x2d67d5){if(_0x2d67d5){return _0x2d67d5['destroy']()['then'](function(){_0x52ddd1[_0x8ecc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5af1a4,_0x4f2cc8){return function(_0x57c979){if(!_0x57c979){_0x5af1a4['sendStatus'](0x194);}return _0x57c979;};}function handleError(_0x2534d3,_0x4c8310){_0x4c8310=_0x4c8310||0x1f4;return function(_0x1b8cc8){logger[_0x8ecc('0x23')](_0x1b8cc8[_0x8ecc('0x24')]);if(_0x1b8cc8[_0x8ecc('0x25')]){delete _0x1b8cc8[_0x8ecc('0x25')];}_0x2534d3['status'](_0x4c8310)[_0x8ecc('0x26')](_0x1b8cc8);};}exports['index']=function(_0x83b54b,_0x2d162d){var _0x2d6a7c={},_0x563085={},_0x5f0c7e={'count':0x0,'rows':[]};var _0x1a7972=_[_0x8ecc('0x27')](db[_0x8ecc('0x28')][_0x8ecc('0x29')],function(_0xf76c84){return{'name':_0xf76c84[_0x8ecc('0x2a')],'type':_0xf76c84[_0x8ecc('0x2b')][_0x8ecc('0x2c')]};});_0x563085['model']=_[_0x8ecc('0x27')](_0x1a7972,'name');_0x563085[_0x8ecc('0x2d')]=_['keys'](_0x83b54b[_0x8ecc('0x2d')]);_0x563085[_0x8ecc('0x2e')]=_[_0x8ecc('0x2f')](_0x563085[_0x8ecc('0x30')],_0x563085[_0x8ecc('0x2d')]);_0x2d6a7c[_0x8ecc('0x31')]=_[_0x8ecc('0x2f')](_0x563085['model'],qs[_0x8ecc('0x32')](_0x83b54b['query'][_0x8ecc('0x32')]));_0x2d6a7c[_0x8ecc('0x31')]=_0x2d6a7c[_0x8ecc('0x31')]['length']?_0x2d6a7c[_0x8ecc('0x31')]:_0x563085[_0x8ecc('0x30')];if(!_0x83b54b[_0x8ecc('0x2d')][_0x8ecc('0x33')](_0x8ecc('0x34'))){_0x2d6a7c[_0x8ecc('0x1e')]=qs[_0x8ecc('0x1e')](_0x83b54b[_0x8ecc('0x2d')]['limit']);_0x2d6a7c[_0x8ecc('0x1b')]=qs[_0x8ecc('0x1b')](_0x83b54b[_0x8ecc('0x2d')][_0x8ecc('0x1b')]);}_0x2d6a7c[_0x8ecc('0x35')]=qs['sort'](_0x83b54b['query'][_0x8ecc('0x36')]);_0x2d6a7c[_0x8ecc('0x37')]=qs[_0x8ecc('0x2e')](_[_0x8ecc('0x38')](_0x83b54b[_0x8ecc('0x2d')],_0x563085[_0x8ecc('0x2e')]),_0x1a7972);if(_0x83b54b[_0x8ecc('0x2d')][_0x8ecc('0x39')]){_0x2d6a7c[_0x8ecc('0x37')]=_[_0x8ecc('0x3a')](_0x2d6a7c[_0x8ecc('0x37')],{'$or':_[_0x8ecc('0x27')](_0x1a7972,function(_0x195976){if(_0x195976[_0x8ecc('0x2b')]!==_0x8ecc('0x3b')){var _0x5e1ac9={};_0x5e1ac9[_0x195976[_0x8ecc('0x25')]]={'$like':'%'+_0x83b54b[_0x8ecc('0x2d')][_0x8ecc('0x39')]+'%'};return _0x5e1ac9;}})});}_0x2d6a7c=_[_0x8ecc('0x3a')]({},_0x2d6a7c,_0x83b54b[_0x8ecc('0x3c')]);var _0x4b1d31={'where':_0x2d6a7c[_0x8ecc('0x37')]};return db[_0x8ecc('0x28')][_0x8ecc('0x1d')](_0x4b1d31)[_0x8ecc('0x22')](function(_0x36779c){_0x5f0c7e[_0x8ecc('0x1d')]=_0x36779c;if(_0x83b54b['query'][_0x8ecc('0x3d')]){_0x2d6a7c[_0x8ecc('0x3e')]=[{'all':!![]}];}return db[_0x8ecc('0x28')]['findAll'](_0x2d6a7c);})[_0x8ecc('0x22')](function(_0x249dcd){_0x5f0c7e[_0x8ecc('0x3f')]=_0x249dcd;return _0x5f0c7e;})[_0x8ecc('0x22')](respondWithFilteredResult(_0x2d162d,_0x2d6a7c))[_0x8ecc('0x40')](handleError(_0x2d162d,null));};exports[_0x8ecc('0x41')]=function(_0x33fe63,_0x43cc8c){var _0x3e3943={'raw':!![],'where':{'id':_0x33fe63[_0x8ecc('0x42')]['id']}},_0x37f33b={};_0x37f33b[_0x8ecc('0x30')]=_[_0x8ecc('0x43')](db['WhatsappTransferReport'][_0x8ecc('0x29')]);_0x37f33b[_0x8ecc('0x2d')]=_['keys'](_0x33fe63[_0x8ecc('0x2d')]);_0x37f33b['filters']=_[_0x8ecc('0x2f')](_0x37f33b[_0x8ecc('0x30')],_0x37f33b[_0x8ecc('0x2d')]);_0x3e3943['attributes']=_[_0x8ecc('0x2f')](_0x37f33b[_0x8ecc('0x30')],qs[_0x8ecc('0x32')](_0x33fe63['query'][_0x8ecc('0x32')]));_0x3e3943[_0x8ecc('0x31')]=_0x3e3943['attributes'][_0x8ecc('0x44')]?_0x3e3943[_0x8ecc('0x31')]:_0x37f33b[_0x8ecc('0x30')];if(_0x33fe63[_0x8ecc('0x2d')][_0x8ecc('0x3d')]){_0x3e3943[_0x8ecc('0x3e')]=[{'all':!![]}];}_0x3e3943=_[_0x8ecc('0x3a')]({},_0x3e3943,_0x33fe63[_0x8ecc('0x3c')]);return db[_0x8ecc('0x28')][_0x8ecc('0x45')](_0x3e3943)[_0x8ecc('0x22')](handleEntityNotFound(_0x43cc8c,null))[_0x8ecc('0x22')](respondWithResult(_0x43cc8c,null))[_0x8ecc('0x40')](handleError(_0x43cc8c,null));};exports[_0x8ecc('0x46')]=function(_0x293733,_0x33464c){return db['WhatsappTransferReport']['create'](_0x293733[_0x8ecc('0x47')],{})[_0x8ecc('0x22')](respondWithResult(_0x33464c,0xc9))[_0x8ecc('0x40')](handleError(_0x33464c,null));};exports[_0x8ecc('0x21')]=function(_0x50c710,_0x149ce6){if(_0x50c710[_0x8ecc('0x47')]['id']){delete _0x50c710[_0x8ecc('0x47')]['id'];}return db[_0x8ecc('0x28')][_0x8ecc('0x45')]({'where':{'id':_0x50c710[_0x8ecc('0x42')]['id']}})['then'](handleEntityNotFound(_0x149ce6,null))[_0x8ecc('0x22')](saveUpdates(_0x50c710['body'],null))['then'](respondWithResult(_0x149ce6,null))[_0x8ecc('0x40')](handleError(_0x149ce6,null));};exports[_0x8ecc('0x48')]=function(_0x51934a,_0x39dfbf){return db[_0x8ecc('0x28')]['find']({'where':{'id':_0x51934a[_0x8ecc('0x42')]['id']}})[_0x8ecc('0x22')](handleEntityNotFound(_0x39dfbf,null))[_0x8ecc('0x22')](removeEntity(_0x39dfbf,null))['catch'](handleError(_0x39dfbf,null));};exports[_0x8ecc('0x49')]=function(_0x1a26ad,_0x44e9fb){return db[_0x8ecc('0x28')][_0x8ecc('0x49')]()['then'](respondWithResult(_0x44e9fb,null))[_0x8ecc('0x40')](handleError(_0x44e9fb,null));}; \ No newline at end of file +var _0x7d14=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','WhatsappTransferReport','rawAttributes'];(function(_0x598257,_0x516239){var _0x1922d5=function(_0x3ece5a){while(--_0x3ece5a){_0x598257['push'](_0x598257['shift']());}};_0x1922d5(++_0x516239);}(_0x7d14,0x6d));var _0x47d1=function(_0x219757,_0x512398){_0x219757=_0x219757-0x0;var _0x370904=_0x7d14[_0x219757];return _0x370904;};'use strict';var emlformat=require(_0x47d1('0x0'));var rimraf=require(_0x47d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47d1('0x2'));var rp=require(_0x47d1('0x3'));var moment=require(_0x47d1('0x4'));var BPromise=require(_0x47d1('0x5'));var Mustache=require('mustache');var util=require(_0x47d1('0x6'));var path=require(_0x47d1('0x7'));var sox=require(_0x47d1('0x8'));var csv=require(_0x47d1('0x9'));var ejs=require(_0x47d1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x47d1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x47d1('0xc'));var toCsv=require(_0x47d1('0x9'));var querystring=require(_0x47d1('0xd'));var Papa=require(_0x47d1('0xe'));var Redis=require(_0x47d1('0xf'));var authService=require(_0x47d1('0x10'));var qs=require(_0x47d1('0x11'));var as=require(_0x47d1('0x12'));var hardwareService=require(_0x47d1('0x13'));var logger=require(_0x47d1('0x14'))(_0x47d1('0x15'));var utils=require(_0x47d1('0x16'));var config=require(_0x47d1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x47d1('0x18'))['db'];function respondWithStatusCode(_0x1247c7,_0x50155b){_0x50155b=_0x50155b||0xcc;return function(_0x2b14dd){if(_0x2b14dd){return _0x1247c7[_0x47d1('0x19')](_0x50155b);}return _0x1247c7[_0x47d1('0x1a')](_0x50155b)[_0x47d1('0x1b')]();};}function respondWithResult(_0x1ee76a,_0xada37f){_0xada37f=_0xada37f||0xc8;return function(_0x1e3895){if(_0x1e3895){return _0x1ee76a[_0x47d1('0x1a')](_0xada37f)[_0x47d1('0x1c')](_0x1e3895);}};}function respondWithFilteredResult(_0xf39a50,_0x18754d){return function(_0x29bbb9){if(_0x29bbb9){var _0x22a2c7=typeof _0x18754d['offset']==='undefined'&&typeof _0x18754d[_0x47d1('0x1d')]===_0x47d1('0x1e');var _0x54ccc5=_0x29bbb9[_0x47d1('0x1f')];var _0x540a61=_0x22a2c7?0x0:_0x18754d['offset'];var _0x372e4f=_0x22a2c7?_0x29bbb9[_0x47d1('0x1f')]:_0x18754d[_0x47d1('0x20')]+_0x18754d[_0x47d1('0x1d')];var _0x54ca37;if(_0x372e4f>=_0x54ccc5){_0x372e4f=_0x54ccc5;_0x54ca37=0xc8;}else{_0x54ca37=0xce;}_0xf39a50[_0x47d1('0x1a')](_0x54ca37);return _0xf39a50['set'](_0x47d1('0x21'),_0x540a61+'-'+_0x372e4f+'/'+_0x54ccc5)[_0x47d1('0x1c')](_0x29bbb9);}return null;};}function patchUpdates(_0x21ed20){return function(_0x5b0261){try{jsonpatch[_0x47d1('0x22')](_0x5b0261,_0x21ed20,!![]);}catch(_0x4260a0){return BPromise[_0x47d1('0x23')](_0x4260a0);}return _0x5b0261[_0x47d1('0x24')]();};}function saveUpdates(_0x57478d,_0x4522aa){return function(_0x474911){if(_0x474911){return _0x474911[_0x47d1('0x25')](_0x57478d)[_0x47d1('0x26')](function(_0x5de4d1){return _0x5de4d1;});}return null;};}function removeEntity(_0x29bca2,_0x4400e5){return function(_0x4e6ed3){if(_0x4e6ed3){return _0x4e6ed3[_0x47d1('0x27')]()[_0x47d1('0x26')](function(){_0x29bca2[_0x47d1('0x1a')](0xcc)[_0x47d1('0x1b')]();});}};}function handleEntityNotFound(_0x244038,_0x4aece8){return function(_0x4710bd){if(!_0x4710bd){_0x244038['sendStatus'](0x194);}return _0x4710bd;};}function handleError(_0x5f070d,_0x1d0b56){_0x1d0b56=_0x1d0b56||0x1f4;return function(_0x3e07f7){logger[_0x47d1('0x28')](_0x3e07f7[_0x47d1('0x29')]);if(_0x3e07f7[_0x47d1('0x2a')]){delete _0x3e07f7[_0x47d1('0x2a')];}_0x5f070d[_0x47d1('0x1a')](_0x1d0b56)[_0x47d1('0x2b')](_0x3e07f7);};}exports['index']=function(_0x2187d3,_0x509c75){var _0x3ce24e={},_0x3d3573={},_0x172307={'count':0x0,'rows':[]};var _0x2f9851=_[_0x47d1('0x2c')](db[_0x47d1('0x2d')][_0x47d1('0x2e')],function(_0xe135a4){return{'name':_0xe135a4['fieldName'],'type':_0xe135a4['type'][_0x47d1('0x2f')]};});_0x3d3573[_0x47d1('0x30')]=_[_0x47d1('0x2c')](_0x2f9851,'name');_0x3d3573[_0x47d1('0x31')]=_[_0x47d1('0x32')](_0x2187d3[_0x47d1('0x31')]);_0x3d3573[_0x47d1('0x33')]=_[_0x47d1('0x34')](_0x3d3573['model'],_0x3d3573[_0x47d1('0x31')]);_0x3ce24e[_0x47d1('0x35')]=_[_0x47d1('0x34')](_0x3d3573[_0x47d1('0x30')],qs[_0x47d1('0x36')](_0x2187d3[_0x47d1('0x31')][_0x47d1('0x36')]));_0x3ce24e[_0x47d1('0x35')]=_0x3ce24e[_0x47d1('0x35')][_0x47d1('0x37')]?_0x3ce24e['attributes']:_0x3d3573['model'];if(!_0x2187d3['query'][_0x47d1('0x38')](_0x47d1('0x39'))){_0x3ce24e[_0x47d1('0x1d')]=qs[_0x47d1('0x1d')](_0x2187d3['query'][_0x47d1('0x1d')]);_0x3ce24e[_0x47d1('0x20')]=qs['offset'](_0x2187d3[_0x47d1('0x31')]['offset']);}_0x3ce24e[_0x47d1('0x3a')]=qs[_0x47d1('0x3b')](_0x2187d3['query'][_0x47d1('0x3b')]);_0x3ce24e[_0x47d1('0x3c')]=qs[_0x47d1('0x33')](_[_0x47d1('0x3d')](_0x2187d3[_0x47d1('0x31')],_0x3d3573['filters']),_0x2f9851);if(_0x2187d3[_0x47d1('0x31')]['filter']){_0x3ce24e[_0x47d1('0x3c')]=_[_0x47d1('0x3e')](_0x3ce24e[_0x47d1('0x3c')],{'$or':_[_0x47d1('0x2c')](_0x2f9851,function(_0x33064b){if(_0x33064b[_0x47d1('0x3f')]!==_0x47d1('0x40')){var _0x31cc97={};_0x31cc97[_0x33064b[_0x47d1('0x2a')]]={'$like':'%'+_0x2187d3[_0x47d1('0x31')][_0x47d1('0x41')]+'%'};return _0x31cc97;}})});}_0x3ce24e=_[_0x47d1('0x3e')]({},_0x3ce24e,_0x2187d3[_0x47d1('0x42')]);var _0x302786={'where':_0x3ce24e[_0x47d1('0x3c')]};return db[_0x47d1('0x2d')][_0x47d1('0x1f')](_0x302786)[_0x47d1('0x26')](function(_0x13309d){_0x172307[_0x47d1('0x1f')]=_0x13309d;if(_0x2187d3[_0x47d1('0x31')][_0x47d1('0x43')]){_0x3ce24e[_0x47d1('0x44')]=[{'all':!![]}];}return db[_0x47d1('0x2d')][_0x47d1('0x45')](_0x3ce24e);})[_0x47d1('0x26')](function(_0x1bca4a){_0x172307[_0x47d1('0x46')]=_0x1bca4a;return _0x172307;})['then'](respondWithFilteredResult(_0x509c75,_0x3ce24e))['catch'](handleError(_0x509c75,null));};exports[_0x47d1('0x47')]=function(_0x469511,_0x396da4){var _0x4b9367={'raw':!![],'where':{'id':_0x469511[_0x47d1('0x48')]['id']}},_0x3906fb={};_0x3906fb[_0x47d1('0x30')]=_[_0x47d1('0x32')](db['WhatsappTransferReport'][_0x47d1('0x2e')]);_0x3906fb['query']=_['keys'](_0x469511[_0x47d1('0x31')]);_0x3906fb[_0x47d1('0x33')]=_[_0x47d1('0x34')](_0x3906fb[_0x47d1('0x30')],_0x3906fb['query']);_0x4b9367[_0x47d1('0x35')]=_[_0x47d1('0x34')](_0x3906fb[_0x47d1('0x30')],qs['fields'](_0x469511[_0x47d1('0x31')][_0x47d1('0x36')]));_0x4b9367[_0x47d1('0x35')]=_0x4b9367['attributes']['length']?_0x4b9367[_0x47d1('0x35')]:_0x3906fb[_0x47d1('0x30')];if(_0x469511[_0x47d1('0x31')][_0x47d1('0x43')]){_0x4b9367['include']=[{'all':!![]}];}_0x4b9367=_[_0x47d1('0x3e')]({},_0x4b9367,_0x469511['options']);return db['WhatsappTransferReport'][_0x47d1('0x49')](_0x4b9367)['then'](handleEntityNotFound(_0x396da4,null))['then'](respondWithResult(_0x396da4,null))['catch'](handleError(_0x396da4,null));};exports[_0x47d1('0x4a')]=function(_0xf8a077,_0xb52b5b){return db[_0x47d1('0x2d')][_0x47d1('0x4a')](_0xf8a077[_0x47d1('0x4b')],{})['then'](respondWithResult(_0xb52b5b,0xc9))[_0x47d1('0x4c')](handleError(_0xb52b5b,null));};exports[_0x47d1('0x25')]=function(_0x2f1536,_0x5db50d){if(_0x2f1536[_0x47d1('0x4b')]['id']){delete _0x2f1536[_0x47d1('0x4b')]['id'];}return db['WhatsappTransferReport'][_0x47d1('0x49')]({'where':{'id':_0x2f1536[_0x47d1('0x48')]['id']}})['then'](handleEntityNotFound(_0x5db50d,null))[_0x47d1('0x26')](saveUpdates(_0x2f1536['body'],null))[_0x47d1('0x26')](respondWithResult(_0x5db50d,null))[_0x47d1('0x4c')](handleError(_0x5db50d,null));};exports[_0x47d1('0x27')]=function(_0x5d73ef,_0x51e4bf){return db[_0x47d1('0x2d')][_0x47d1('0x49')]({'where':{'id':_0x5d73ef[_0x47d1('0x48')]['id']}})[_0x47d1('0x26')](handleEntityNotFound(_0x51e4bf,null))[_0x47d1('0x26')](removeEntity(_0x51e4bf,null))[_0x47d1('0x4c')](handleError(_0x51e4bf,null));};exports[_0x47d1('0x4d')]=function(_0x295a6e,_0x28b9eb){return db[_0x47d1('0x2d')]['describe']()[_0x47d1('0x26')](respondWithResult(_0x28b9eb,null))[_0x47d1('0x4c')](handleError(_0x28b9eb,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index af06572..55b947f 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 _0xf233=['moment','bluebird','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf233,0x122));var _0x3f23=function(_0x16ae4f,_0xa6e5bb){_0x16ae4f=_0x16ae4f-0x0;var _0x157c2a=_0xf233[_0x16ae4f];return _0x157c2a;};'use strict';var _=require(_0x3f23('0x0'));var util=require(_0x3f23('0x1'));var logger=require(_0x3f23('0x2'))(_0x3f23('0x3'));var moment=require(_0x3f23('0x4'));var BPromise=require(_0x3f23('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f23('0x6'));var rimraf=require(_0x3f23('0x7'));var config=require(_0x3f23('0x8'));var attributes=require(_0x3f23('0x9'));module[_0x3f23('0xa')]=function(_0x498b34,_0x1f6fb1){return _0x498b34[_0x3f23('0xb')](_0x3f23('0xc'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x3f23('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb3b7=['report_whatsapp_transfer','lodash','api','moment','bluebird','path','../../config/environment','./whatsappTransferReport.attributes','exports','define'];(function(_0x1abf62,_0x116a74){var _0x2de161=function(_0x4f203f){while(--_0x4f203f){_0x1abf62['push'](_0x1abf62['shift']());}};_0x2de161(++_0x116a74);}(_0xb3b7,0x12d));var _0x7b3b=function(_0x551d38,_0x35f382){_0x551d38=_0x551d38-0x0;var _0x5a551c=_0xb3b7[_0x551d38];return _0x5a551c;};'use strict';var _=require(_0x7b3b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7b3b('0x1'));var moment=require(_0x7b3b('0x2'));var BPromise=require(_0x7b3b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b3b('0x4'));var rimraf=require('rimraf');var config=require(_0x7b3b('0x5'));var attributes=require(_0x7b3b('0x6'));module[_0x7b3b('0x7')]=function(_0xa0e0a8,_0x2d6465){return _0xa0e0a8[_0x7b3b('0x8')]('WhatsappTransferReport',attributes,{'tableName':_0x7b3b('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index d3b646d..aee9943 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 _0xa8fe=['message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x3160e6,_0x4a7bd6){var _0x5022ca=function(_0x29a871){while(--_0x29a871){_0x3160e6['push'](_0x3160e6['shift']());}};_0x5022ca(++_0x4a7bd6);}(_0xa8fe,0x1ac));var _0xea8f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xa8fe[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xea8f('0x0'));var util=require('util');var moment=require(_0xea8f('0x1'));var BPromise=require('bluebird');var rs=require(_0xea8f('0x2'));var fs=require('fs');var Redis=require(_0xea8f('0x3'));var db=require(_0xea8f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xea8f('0x5'))(_0xea8f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59b0f0,_0x58299b,_0x1e8939){return new BPromise(function(_0xf62df6,_0x34bc02){return client[_0xea8f('0x7')](_0x59b0f0,_0x1e8939)[_0xea8f('0x8')](function(_0x25b7dc){logger[_0xea8f('0x9')](_0xea8f('0xa'),_0x58299b,_0xea8f('0xb'));logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x58299b,_0xea8f('0xb'),JSON['stringify'](_0x25b7dc));if(_0x25b7dc[_0xea8f('0xc')]){if(_0x25b7dc[_0xea8f('0xc')][_0xea8f('0xd')]===0x1f4){logger[_0xea8f('0xc')](_0xea8f('0xa'),_0x58299b,_0x25b7dc[_0xea8f('0xc')][_0xea8f('0xe')]);return _0x34bc02(_0x25b7dc['error'][_0xea8f('0xe')]);}logger[_0xea8f('0xc')](_0xea8f('0xa'),_0x58299b,_0x25b7dc[_0xea8f('0xc')][_0xea8f('0xe')]);return _0xf62df6(_0x25b7dc[_0xea8f('0xc')][_0xea8f('0xe')]);}else{logger[_0xea8f('0x9')](_0xea8f('0xa'),_0x58299b,_0xea8f('0xb'));_0xf62df6(_0x25b7dc[_0xea8f('0xf')]['message']);}})[_0xea8f('0x10')](function(_0x1d89e3){logger['error'](_0xea8f('0xa'),_0x58299b,_0x1d89e3);_0x34bc02(_0x1d89e3);});});} \ No newline at end of file +var _0x3878=['rpc','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x5a26db,_0x2c5ccd){var _0x4619dd=function(_0x21e28f){while(--_0x21e28f){_0x5a26db['push'](_0x5a26db['shift']());}};_0x4619dd(++_0x2c5ccd);}(_0x3878,0x1c7));var _0x8387=function(_0x2b6c93,_0x163a8b){_0x2b6c93=_0x2b6c93-0x0;var _0x5cfd8e=_0x3878[_0x2b6c93];return _0x5cfd8e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8387('0x0'));var BPromise=require(_0x8387('0x1'));var rs=require(_0x8387('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8387('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8387('0x4'))(_0x8387('0x5'));var config=require('../../config/environment');var jayson=require(_0x8387('0x6'));var client=jayson[_0x8387('0x7')][_0x8387('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ef0b6,_0x1e9fa6,_0x459f7c){return new BPromise(function(_0x4d9ace,_0x778970){return client[_0x8387('0x9')](_0x5ef0b6,_0x459f7c)[_0x8387('0xa')](function(_0x15b12a){logger[_0x8387('0xb')](_0x8387('0xc'),_0x1e9fa6,_0x8387('0xd'));logger[_0x8387('0xe')](_0x8387('0xf'),_0x1e9fa6,_0x8387('0xd'),JSON['stringify'](_0x15b12a));if(_0x15b12a['error']){if(_0x15b12a[_0x8387('0x10')]['code']===0x1f4){logger[_0x8387('0x10')](_0x8387('0xc'),_0x1e9fa6,_0x15b12a[_0x8387('0x10')]['message']);return _0x778970(_0x15b12a[_0x8387('0x10')][_0x8387('0x11')]);}logger[_0x8387('0x10')](_0x8387('0xc'),_0x1e9fa6,_0x15b12a[_0x8387('0x10')][_0x8387('0x11')]);return _0x4d9ace(_0x15b12a[_0x8387('0x10')][_0x8387('0x11')]);}else{logger[_0x8387('0xb')](_0x8387('0xc'),_0x1e9fa6,_0x8387('0xd'));_0x4d9ace(_0x15b12a[_0x8387('0x12')][_0x8387('0x11')]);}})[_0x8387('0x13')](function(_0x51e7de){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x1e9fa6,_0x51e7de);_0x778970(_0x51e7de);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 38de26e..d92b3d1 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x05e4=['info','start','Online\x20apps:','map','filter','online','name','join','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','listen','then'];(function(_0x307338,_0x4c205d){var _0x5c139c=function(_0xd536ca){while(--_0xd536ca){_0x307338['push'](_0x307338['shift']());}};_0x5c139c(++_0x4c205d);}(_0x05e4,0x166));var _0x405e=function(_0x4c0a61,_0x3fe37a){_0x4c0a61=_0x4c0a61-0x0;var _0x501faf=_0x05e4[_0x4c0a61];return _0x501faf;};'use strict';var _=require('lodash');var mysqldb=require(_0x405e('0x0'));var rpc=require(_0x405e('0x1'));var config=require(_0x405e('0x2'));var logger=require(_0x405e('0x3'))(_0x405e('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x405e('0x5'));var schedule=require(_0x405e('0x6'));var chat=require(_0x405e('0x7'));var whatsapp=require(_0x405e('0x8'));var transcribe=require(_0x405e('0x9'));function main(){return mysqldb['db'][_0x405e('0xa')][_0x405e('0xb')]()['then'](function(){return rpc[_0x405e('0xc')]();})[_0x405e('0xd')](function(_0x10a77a){logger[_0x405e('0xe')](_0x10a77a);return chat[_0x405e('0xf')]();})['then'](function(){return whatsapp[_0x405e('0xf')]();})[_0x405e('0xd')](function(){return schedule[_0x405e('0xf')]();})['then'](function(){return transcribe['start']();})[_0x405e('0xd')](function(_0x9957d9){logger[_0x405e('0xe')](_0x9957d9);return pm2[_0x405e('0xf')](pm2Config);})[_0x405e('0xd')](function(_0x43ae47){logger[_0x405e('0xe')](_0x405e('0x10'),_[_0x405e('0x11')](_[_0x405e('0x12')](_0x43ae47,{'status':_0x405e('0x13')}),'name')['join']());logger[_0x405e('0xe')]('Offline\x20apps:',_[_0x405e('0x11')](_['filter'](_0x43ae47,function(_0x4523cb){return _0x4523cb['status']!=='online';}),_0x405e('0x14'))[_0x405e('0x15')]()||_0x405e('0x16'));config[_0x405e('0x17')]&&require(_0x405e('0x18'))[_0x405e('0x19')]();require(_0x405e('0x1a'))[_0x405e('0x19')]();})[_0x405e('0x1b')](function(_0x3577b5){logger[_0x405e('0x1c')](_0x405e('0x1d'),_0x3577b5);process[_0x405e('0x1e')](0x1);});}main(); \ No newline at end of file +var _0x06ec=['status','join','None','seedDB','./config/license','default','catch','error','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','Online\x20apps:','online','name','Offline\x20apps:','map','filter'];(function(_0x5124f6,_0x3c142d){var _0x171e16=function(_0x4f61f9){while(--_0x4f61f9){_0x5124f6['push'](_0x5124f6['shift']());}};_0x171e16(++_0x3c142d);}(_0x06ec,0x81));var _0xc06e=function(_0x314db8,_0x994e22){_0x314db8=_0x314db8-0x0;var _0x59d4f4=_0x06ec[_0x314db8];return _0x59d4f4;};'use strict';var _=require(_0xc06e('0x0'));var mysqldb=require(_0xc06e('0x1'));var rpc=require(_0xc06e('0x2'));var config=require(_0xc06e('0x3'));var logger=require(_0xc06e('0x4'))(_0xc06e('0x5'));var pm2=require(_0xc06e('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xc06e('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xc06e('0x8'));function main(){return mysqldb['db'][_0xc06e('0x9')][_0xc06e('0xa')]()[_0xc06e('0xb')](function(){return rpc[_0xc06e('0xc')]();})['then'](function(_0x25327e){logger[_0xc06e('0xd')](_0x25327e);return chat[_0xc06e('0xe')]();})['then'](function(){return whatsapp['start']();})['then'](function(){return schedule[_0xc06e('0xe')]();})[_0xc06e('0xb')](function(){return transcribe[_0xc06e('0xe')]();})[_0xc06e('0xb')](function(_0x279656){logger[_0xc06e('0xd')](_0x279656);return pm2[_0xc06e('0xe')](pm2Config);})[_0xc06e('0xb')](function(_0x1457e9){logger['info'](_0xc06e('0xf'),_['map'](_['filter'](_0x1457e9,{'status':_0xc06e('0x10')}),_0xc06e('0x11'))['join']());logger['info'](_0xc06e('0x12'),_[_0xc06e('0x13')](_[_0xc06e('0x14')](_0x1457e9,function(_0x2b5c83){return _0x2b5c83[_0xc06e('0x15')]!==_0xc06e('0x10');}),_0xc06e('0x11'))[_0xc06e('0x16')]()||_0xc06e('0x17'));config[_0xc06e('0x18')]&&require('./config/seedDB')['default']();require(_0xc06e('0x19'))[_0xc06e('0x1a')]();})[_0xc06e('0x1b')](function(_0x52f0cf){logger[_0xc06e('0x1c')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x52f0cf);process[_0xc06e('0x1d')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index ffec549..fca2fed 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 _0x72fc=['Unmanaged.','Forbidden.','catch','isAuthenticated','use','headers','authorization','startsWith','Basic','User','find','authenticate','Unknown\x20authorization\x20format','query','apikey','getUuid','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','splice','unshift','encryptString','join','promisify','sign','secret','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util','moment','secrets','session','role','name','internal','userpic','permissions','voicePause','mailPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','isChatInteractionAuthorized','user','ChatInteraction','findOne','closed','disposition','then','status','unmanaged','json'];(function(_0x5e9d35,_0x382c91){var _0x3beb2e=function(_0x4242cf){while(--_0x4242cf){_0x5e9d35['push'](_0x5e9d35['shift']());}};_0x3beb2e(++_0x382c91);}(_0x72fc,0x141));var _0xc72f=function(_0x2c743f,_0x293dec){_0x2c743f=_0x2c743f-0x0;var _0x37fdf3=_0x72fc[_0x2c743f];return _0x37fdf3;};'use strict';var db=require(_0xc72f('0x0'))['db'];var config=require(_0xc72f('0x1'));var hardwareConf=require(_0xc72f('0x2'));var licenseUtil=require(_0xc72f('0x3'));var encryptor=require(_0xc72f('0x4'));var _=require(_0xc72f('0x5'));var jwt=require(_0xc72f('0x6'));var expressJwt=require(_0xc72f('0x7'));var compose=require(_0xc72f('0x8'));var basicAuth=require(_0xc72f('0x9'));var crypto=require(_0xc72f('0xa'));var BPromise=require('bluebird');var util=require(_0xc72f('0xb'));var moment=require(_0xc72f('0xc'));var validateJwt=expressJwt({'secret':config[_0xc72f('0xd')][_0xc72f('0xe')]});var userAttributes=['id',_0xc72f('0xf'),'fullname',_0xc72f('0x10'),_0xc72f('0x11'),'email',_0xc72f('0x12'),_0xc72f('0x13'),'md5secret',_0xc72f('0x14'),'chatPause',_0xc72f('0x15'),_0xc72f('0x16'),'smsPause',_0xc72f('0x17'),_0xc72f('0x18'),'showWebBar',_0xc72f('0x19'),_0xc72f('0x1a'),_0xc72f('0x1b'),_0xc72f('0x1c'),_0xc72f('0x1d'),_0xc72f('0x1e'),_0xc72f('0x1f'),_0xc72f('0x20'),'phoneBarDnd',_0xc72f('0x21'),_0xc72f('0x22'),_0xc72f('0x23'),_0xc72f('0x24'),_0xc72f('0x25'),_0xc72f('0x26'),_0xc72f('0x27'),_0xc72f('0x28'),_0xc72f('0x29'),_0xc72f('0x2a'),_0xc72f('0x2b'),_0xc72f('0x2c'),_0xc72f('0x2d'),_0xc72f('0x2e'),'downloadOmnichannelInteractions','downloadAttachments'];exports[_0xc72f('0x2f')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x1eefb1,_0x245926,_0x117c9e){if(_0x1eefb1[_0xc72f('0x30')]){_0x117c9e();}else{return db[_0xc72f('0x31')][_0xc72f('0x32')]({'where':{'id':_0x1eefb1['params']['id']},'attributes':['id',_0xc72f('0x33'),_0xc72f('0x34')],'raw':!![]})[_0xc72f('0x35')](function(_0x298456){if(_0x298456&&_0x298456['closed']){return _0x245926[_0xc72f('0x36')](_0x298456[_0xc72f('0x34')]===_0xc72f('0x37')?0x195:0x193)[_0xc72f('0x38')]({'message':_0x298456[_0xc72f('0x34')]===_0xc72f('0x37')?_0xc72f('0x39'):_0xc72f('0x3a')});}else{_0x117c9e();}})[_0xc72f('0x3b')](function(_0x265dd6){_0x117c9e(_0x265dd6);});}});};exports[_0xc72f('0x3c')]=function isAuthenticated(_0x14ca6a){return compose()[_0xc72f('0x3d')](function(_0x5e0f4d,_0x275fea,_0x2cecf6){var _0x301dd1;if(_0x5e0f4d[_0xc72f('0x3e')][_0xc72f('0x3f')]){if(_[_0xc72f('0x40')](_0x5e0f4d['headers']['authorization'],_0xc72f('0x41'))){var _0x297e32=basicAuth(_0x5e0f4d);db[_0xc72f('0x42')][_0xc72f('0x43')]({'where':{'name':_0x297e32['name']}})[_0xc72f('0x35')](function(_0x445a12){if(!_0x445a12||!_0x445a12[_0xc72f('0x44')](_0x297e32['pass'])){return _0x275fea['status'](0x191)[_0xc72f('0x38')]({'message':'Wrong\x20credentials.'});}_0x5e0f4d['user']={'id':_0x445a12['id']};_0x2cecf6();})['catch'](function(_0x5ae854){_0x2cecf6(_0x5ae854);});}else if(_[_0xc72f('0x40')](_0x5e0f4d[_0xc72f('0x3e')][_0xc72f('0x3f')],'Bearer')){validateJwt(_0x5e0f4d,_0x275fea,_0x2cecf6);}else{if(_0x14ca6a){_0x2cecf6();}else{return _0x275fea[_0xc72f('0x36')](0x193)[_0xc72f('0x38')]({'message':_0xc72f('0x45')});}}}else if(_0x5e0f4d[_0xc72f('0x46')][_0xc72f('0x47')]){try{var _0xbeb248={'audience':hardwareConf[_0xc72f('0x48')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x5e0f4d['query'][_0xc72f('0x47')],_0xbeb248)[_0xc72f('0x35')](function(_0x3dfbd6){return db[_0xc72f('0x42')]['find']({'where':{'id':_0x3dfbd6['sub']}})[_0xc72f('0x35')](function(_0x1b3340){_0x301dd1=_0x1b3340;return db[_0xc72f('0x49')][_0xc72f('0x32')]({'where':{'id':0x1},'attributes':[_0xc72f('0x4a'),_0xc72f('0x4b')],'raw':!![]});})[_0xc72f('0x35')](function(_0x2ee408){if(!_0x301dd1||!_[_0xc72f('0x4c')](_0x301dd1[_0xc72f('0x4d')],_0x3dfbd6[_0xc72f('0x4e')])){return _0x275fea[_0xc72f('0x36')](0x191)[_0xc72f('0x38')]({'message':_0xc72f('0x4f')});}if(_0x301dd1[_0xc72f('0x50')]){return _0x275fea[_0xc72f('0x36')](0x191)['json']({'message':_0xc72f('0x51')});}if(_0x301dd1[_0xc72f('0x52')]){if(_0x2ee408[_0xc72f('0x4b')]>0x0){if(moment(_0x301dd1[_0xc72f('0x53')])[_0xc72f('0x54')](_0x2ee408[_0xc72f('0x4b')],'minutes')>moment()){return _0x275fea['status'](0x191)[_0xc72f('0x38')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x275fea[_0xc72f('0x36')](0x191)[_0xc72f('0x38')]({'message':_0xc72f('0x51')});}}_0x5e0f4d[_0xc72f('0x30')]={'id':_0x301dd1['id']};_0x2cecf6();});})['catch'](function(){return _0x275fea[_0xc72f('0x36')](0x191)[_0xc72f('0x38')]({'message':_0xc72f('0x51')});});}catch(_0x392f28){_0x2cecf6(_0x392f28);}}else if(_0x14ca6a){_0x2cecf6();}else{return _0x275fea['status'](0x193)[_0xc72f('0x38')]({'message':_0xc72f('0x45')});}})[_0xc72f('0x3d')](function(_0x196e6d,_0x2d4666,_0x11a8a7){if(_0x196e6d['user']){db['User'][_0xc72f('0x43')]({'where':{'id':_0x196e6d[_0xc72f('0x30')]['id']},'attributes':userAttributes})[_0xc72f('0x35')](function(_0x2dbdb0){if(!_0x2dbdb0){return _0x2d4666[_0xc72f('0x36')](0x194)[_0xc72f('0x38')]({'message':_0xc72f('0x55')});}_0x196e6d['user']=_0x2dbdb0;_0x11a8a7();})[_0xc72f('0x3b')](function(_0x152023){_0x11a8a7(_0x152023);});}else if(_0x14ca6a){_0x11a8a7();}else{return _0x2d4666[_0xc72f('0x36')](0x194)[_0xc72f('0x38')]({'message':_0xc72f('0x56')});}});};exports[_0xc72f('0x57')]=function canUpdate(){return compose()[_0xc72f('0x3d')](function(_0x51d975,_0x5b0f03,_0xcc8f7){return licenseUtil[_0xc72f('0x58')]()['then'](function(_0x59ab80){if(_0x59ab80['update']){_0xcc8f7();}else{return _0x5b0f03[_0xc72f('0x36')](0x193)[_0xc72f('0x38')]({'message':_0xc72f('0x59')});}})[_0xc72f('0x3b')](function(_0x54089f){_0xcc8f7(_0x54089f);});});};exports[_0xc72f('0x5a')]=function(_0x50a3c9,_0x30d00f,_0x51193d){_0x50a3c9[_0xc72f('0x5a')]=!![];return _0x51193d();};exports[_0xc72f('0x5b')]=function signToken(_0x3d8067){return signJwt(_0x3d8067);};exports[_0xc72f('0x5c')]=function(_0x5ab1b8,_0x50dd24){if(!_0x5ab1b8['user']){return _0x50dd24[_0xc72f('0x36')](0x194)[_0xc72f('0x38')]({'message':_0xc72f('0x5d')});}var _0x45b7aa={'payload':{'id':_0x5ab1b8[_0xc72f('0x30')]['id'],'role':_0x5ab1b8['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x45b7aa)[_0xc72f('0x35')](function(_0x33dc38){_0x50dd24['cookie'](_0xc72f('0x5e'),_0x33dc38);_0x50dd24[_0xc72f('0x5f')](_0xc72f('0x60'));})['catch'](function(_0x116233){return _0x50dd24[_0xc72f('0x36')](0x1f4)[_0xc72f('0x61')](_0x116233);});};exports[_0xc72f('0x62')]=function(_0x2c84ec){if(_[_0xc72f('0x63')](_0x2c84ec[_0xc72f('0x4d')])||_[_0xc72f('0x63')](_0x2c84ec[_0xc72f('0x64')])){return null;}else{return createJwt(_0x2c84ec);}};exports[_0xc72f('0x65')]=function(_0x3b5271){_0x3b5271[_0xc72f('0x4d')]=generateNonce();_0x3b5271['apiKeyIat']=generateIssuedAt();return createJwt(_0x3b5271);};exports[_0xc72f('0x66')]=function(_0x33ec02,_0x30e5a3){var _0x2fd327=_0x33ec02[_0xc72f('0x46')][_0xc72f('0x47')];if(_0x2fd327){var _0x35f046={'nonce':_0x30e5a3['apiKeyNonce'],'iat':_0x30e5a3[_0xc72f('0x64')],'audience':hardwareConf[_0xc72f('0x48')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x2fd327,_0x35f046)['then'](function(){return generateApiKey(_0x30e5a3);});}else{throw{'message':_0xc72f('0x67')};}};exports['validatePasswordPattern']=function(_0x108cbb){var _0x301ea5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x301ea5[_0xc72f('0x68')](_0x108cbb))throw new db[(_0xc72f('0x69'))]['ValidationError'](_0xc72f('0x6a'));return;};exports[_0xc72f('0x6b')]=function(_0x367725,_0x1d9e38,_0x261f42){var _0x1b7f3c=encryptor[_0xc72f('0x6c')](_0x1d9e38)[_0xc72f('0x6d')](',');for(var _0x474b27=0x0;_0x474b27<_0x261f42;_0x474b27++){if(!_0x1b7f3c[_0x474b27])break;if(_0x367725[_0xc72f('0x6e')]()===_0x1b7f3c[_0x474b27][_0xc72f('0x6e')]()){var _0x315e04=util['format'](_0xc72f('0x6f'),_0x261f42);if(_0x261f42===0x1){_0x315e04='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xc72f('0x69'))][(_0xc72f('0x70'))](_0x315e04);}}return;};exports[_0xc72f('0x71')]=function(_0x51930a,_0x46567){var _0x579b5a=_0x46567?encryptor[_0xc72f('0x6c')](_0x46567)[_0xc72f('0x6d')](','):[];if(_0x579b5a['length']===0x5){_0x579b5a[_0xc72f('0x72')](-0x1,0x1);}_0x579b5a[_0xc72f('0x73')](_0x51930a);return encryptor[_0xc72f('0x74')](_0x579b5a[_0xc72f('0x75')](','));};function signJwt(_0x391fce){var _0x5b6529=BPromise[_0xc72f('0x76')](jwt[_0xc72f('0x77')],{'context':jwt});var _0x57f540=_0x391fce[_0xc72f('0x78')]||config[_0xc72f('0xd')][_0xc72f('0xe')];return new BPromise(function(_0x23ddae,_0x5aaf03){_0x5b6529(_0x391fce['payload'],_0x57f540,_0x391fce['options'])[_0xc72f('0x35')](function(_0x5d5bad){_0x23ddae(_0x5d5bad);})[_0xc72f('0x3b')](function(_0x2ee79a){_0x5aaf03(_0x2ee79a);});});}function verifyJwt(_0x1496bb,_0x2e2aad,_0x3bb904){var _0x4819bd=BPromise[_0xc72f('0x76')](jwt['verify'],{'context':jwt});var _0xe5c87e=_0x3bb904||config[_0xc72f('0xd')][_0xc72f('0xe')];return new BPromise(function(_0x50bd57,_0x22bb9c){_0x4819bd(_0x1496bb,_0xe5c87e,_0x2e2aad)[_0xc72f('0x35')](function(_0x5e82a4){_0x50bd57(_0x5e82a4);})[_0xc72f('0x3b')](function(_0xba8c3){_0x22bb9c(_0xba8c3);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xc72f('0x79')](_0xc72f('0x7a'));}function generateIssuedAt(){return Math[_0xc72f('0x7b')](Date[_0xc72f('0x7c')]()/0x3e8)[_0xc72f('0x79')]();}function createJwt(_0x381696){var _0x14da52={'payload':{'iat':_0x381696[_0xc72f('0x64')],'nonce':_0x381696[_0xc72f('0x4d')]},'options':{'algorithm':_0xc72f('0x7d'),'subject':_0x381696['id'][_0xc72f('0x79')](),'issuer':hardwareConf[_0xc72f('0x48')](),'audience':hardwareConf[_0xc72f('0x48')]()}};return signJwt(_0x14da52)[_0xc72f('0x35')](function(_0x3f5f22){return{'iat':_0x381696[_0xc72f('0x64')],'nonce':_0x381696[_0xc72f('0x4d')],'token':_0x3f5f22};});} \ No newline at end of file +var _0xd215=['phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','disposition','status','unmanaged','json','Unmanaged.','catch','headers','authorization','startsWith','User','then','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','find','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','disabled','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','user','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','join','promisify','sign','payload','options','toString','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd215,0x14f));var _0x5d21=function(_0xfd37a1,_0x599d38){_0xfd37a1=_0xfd37a1-0x0;var _0x3c727a=_0xd215[_0xfd37a1];return _0x3c727a;};'use strict';var db=require(_0x5d21('0x0'))['db'];var config=require(_0x5d21('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x5d21('0x2'));var encryptor=require(_0x5d21('0x3'));var _=require(_0x5d21('0x4'));var jwt=require(_0x5d21('0x5'));var expressJwt=require(_0x5d21('0x6'));var compose=require(_0x5d21('0x7'));var basicAuth=require(_0x5d21('0x8'));var crypto=require(_0x5d21('0x9'));var BPromise=require(_0x5d21('0xa'));var util=require(_0x5d21('0xb'));var moment=require(_0x5d21('0xc'));var validateJwt=expressJwt({'secret':config[_0x5d21('0xd')][_0x5d21('0xe')]});var userAttributes=['id',_0x5d21('0xf'),_0x5d21('0x10'),_0x5d21('0x11'),_0x5d21('0x12'),_0x5d21('0x13'),_0x5d21('0x14'),_0x5d21('0x15'),_0x5d21('0x16'),_0x5d21('0x17'),_0x5d21('0x18'),_0x5d21('0x19'),_0x5d21('0x1a'),'smsPause',_0x5d21('0x1b'),_0x5d21('0x1c'),'showWebBar','lastLoginAt','lastPauseAt',_0x5d21('0x1d'),_0x5d21('0x1e'),_0x5d21('0x1f'),_0x5d21('0x20'),_0x5d21('0x21'),'phoneBarAutoAnswerDelay',_0x5d21('0x22'),_0x5d21('0x23'),_0x5d21('0x24'),_0x5d21('0x25'),_0x5d21('0x26'),'phoneBarPrefixRequired','phoneBarRemoteControl',_0x5d21('0x27'),_0x5d21('0x28'),_0x5d21('0x29'),'userProfileId',_0x5d21('0x2a'),_0x5d21('0x2b'),_0x5d21('0x2c'),'downloadVoiceRecordings',_0x5d21('0x2d'),'downloadAttachments'];exports[_0x5d21('0x2e')]=function(){return this[_0x5d21('0x2f')](!![])[_0x5d21('0x30')](function(_0x356e0d,_0x23e541,_0x49f8d8){if(_0x356e0d['user']){_0x49f8d8();}else{return db[_0x5d21('0x31')][_0x5d21('0x32')]({'where':{'id':_0x356e0d[_0x5d21('0x33')]['id']},'attributes':['id',_0x5d21('0x34'),_0x5d21('0x35')],'raw':!![]})['then'](function(_0x457467){if(_0x457467&&_0x457467[_0x5d21('0x34')]){return _0x23e541[_0x5d21('0x36')](_0x457467[_0x5d21('0x35')]===_0x5d21('0x37')?0x195:0x193)[_0x5d21('0x38')]({'message':_0x457467[_0x5d21('0x35')]===_0x5d21('0x37')?_0x5d21('0x39'):'Forbidden.'});}else{_0x49f8d8();}})[_0x5d21('0x3a')](function(_0x6ab990){_0x49f8d8(_0x6ab990);});}});};exports[_0x5d21('0x2f')]=function isAuthenticated(_0x39d0b1){return compose()[_0x5d21('0x30')](function(_0x1b405c,_0x226353,_0x4ebd70){var _0x56ba84;if(_0x1b405c[_0x5d21('0x3b')][_0x5d21('0x3c')]){if(_[_0x5d21('0x3d')](_0x1b405c[_0x5d21('0x3b')]['authorization'],'Basic')){var _0x2e4f1=basicAuth(_0x1b405c);db[_0x5d21('0x3e')]['find']({'where':{'name':_0x2e4f1[_0x5d21('0x11')]}})[_0x5d21('0x3f')](function(_0x32c80e){if(!_0x32c80e||!_0x32c80e[_0x5d21('0x40')](_0x2e4f1[_0x5d21('0x41')])){return _0x226353[_0x5d21('0x36')](0x191)[_0x5d21('0x38')]({'message':_0x5d21('0x42')});}_0x1b405c['user']={'id':_0x32c80e['id']};_0x4ebd70();})[_0x5d21('0x3a')](function(_0x5b0c5f){_0x4ebd70(_0x5b0c5f);});}else if(_[_0x5d21('0x3d')](_0x1b405c['headers'][_0x5d21('0x3c')],_0x5d21('0x43'))){validateJwt(_0x1b405c,_0x226353,_0x4ebd70);}else{if(_0x39d0b1){_0x4ebd70();}else{return _0x226353[_0x5d21('0x36')](0x193)['json']({'message':_0x5d21('0x44')});}}}else if(_0x1b405c[_0x5d21('0x45')][_0x5d21('0x46')]){try{var _0x3fde64={'audience':hardwareConf[_0x5d21('0x47')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x1b405c[_0x5d21('0x45')][_0x5d21('0x46')],_0x3fde64)[_0x5d21('0x3f')](function(_0x14fd1e){return db[_0x5d21('0x3e')][_0x5d21('0x48')]({'where':{'id':_0x14fd1e['sub']}})[_0x5d21('0x3f')](function(_0x3390f6){_0x56ba84=_0x3390f6;return db[_0x5d21('0x49')][_0x5d21('0x32')]({'where':{'id':0x1},'attributes':[_0x5d21('0x4a'),_0x5d21('0x4b')],'raw':!![]});})[_0x5d21('0x3f')](function(_0x3fed5b){if(!_0x56ba84||!_['isEqual'](_0x56ba84[_0x5d21('0x4c')],_0x14fd1e[_0x5d21('0x4d')])){return _0x226353[_0x5d21('0x36')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x56ba84[_0x5d21('0x4e')]){return _0x226353[_0x5d21('0x36')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}if(_0x56ba84['blocked']){if(_0x3fed5b[_0x5d21('0x4b')]>0x0){if(moment(_0x56ba84[_0x5d21('0x4f')])[_0x5d21('0x50')](_0x3fed5b['blockDuration'],_0x5d21('0x51'))>moment()){return _0x226353[_0x5d21('0x36')](0x191)['json']({'message':_0x5d21('0x52')});}}else{return _0x226353['status'](0x191)[_0x5d21('0x38')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x1b405c['user']={'id':_0x56ba84['id']};_0x4ebd70();});})[_0x5d21('0x3a')](function(){return _0x226353['status'](0x191)[_0x5d21('0x38')]({'message':_0x5d21('0x52')});});}catch(_0x2cbf19){_0x4ebd70(_0x2cbf19);}}else if(_0x39d0b1){_0x4ebd70();}else{return _0x226353[_0x5d21('0x36')](0x193)[_0x5d21('0x38')]({'message':'Unknown\x20authorization\x20format'});}})[_0x5d21('0x30')](function(_0x2638db,_0x465338,_0x501e0f){if(_0x2638db[_0x5d21('0x53')]){db[_0x5d21('0x3e')][_0x5d21('0x48')]({'where':{'id':_0x2638db['user']['id']},'attributes':userAttributes})[_0x5d21('0x3f')](function(_0x64e381){if(!_0x64e381){return _0x465338[_0x5d21('0x36')](0x194)[_0x5d21('0x38')]({'message':_0x5d21('0x54')});}_0x2638db[_0x5d21('0x53')]=_0x64e381;_0x501e0f();})['catch'](function(_0x30b62c){_0x501e0f(_0x30b62c);});}else if(_0x39d0b1){_0x501e0f();}else{return _0x465338[_0x5d21('0x36')](0x194)[_0x5d21('0x38')]({'message':_0x5d21('0x55')});}});};exports[_0x5d21('0x56')]=function canUpdate(){return compose()[_0x5d21('0x30')](function(_0x4fea1b,_0x2bdfce,_0xaa4ecf){return licenseUtil[_0x5d21('0x57')]()['then'](function(_0x2b1a43){if(_0x2b1a43[_0x5d21('0x58')]){_0xaa4ecf();}else{return _0x2bdfce[_0x5d21('0x36')](0x193)['json']({'message':_0x5d21('0x59')});}})[_0x5d21('0x3a')](function(_0x5220d3){_0xaa4ecf(_0x5220d3);});});};exports[_0x5d21('0x5a')]=function(_0x17035e,_0x40e806,_0x32cdc4){_0x17035e[_0x5d21('0x5a')]=!![];return _0x32cdc4();};exports[_0x5d21('0x5b')]=function signToken(_0x2a519a){return signJwt(_0x2a519a);};exports['setTokenCookie']=function(_0x4b3e71,_0x2efb8c){if(!_0x4b3e71[_0x5d21('0x53')]){return _0x2efb8c[_0x5d21('0x36')](0x194)[_0x5d21('0x38')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x51c2ac={'payload':{'id':_0x4b3e71['user']['id'],'role':_0x4b3e71[_0x5d21('0x53')][_0x5d21('0xf')]},'options':{'expiresIn':0x15180}};return signJwt(_0x51c2ac)[_0x5d21('0x3f')](function(_0x584742){_0x2efb8c[_0x5d21('0x5c')](_0x5d21('0x5d'),_0x584742);_0x2efb8c[_0x5d21('0x5e')]('/dashboards/general');})[_0x5d21('0x3a')](function(_0x31bb57){return _0x2efb8c[_0x5d21('0x36')](0x1f4)[_0x5d21('0x5f')](_0x31bb57);});};exports[_0x5d21('0x60')]=function(_0x18ebe0){if(_[_0x5d21('0x61')](_0x18ebe0[_0x5d21('0x4c')])||_[_0x5d21('0x61')](_0x18ebe0[_0x5d21('0x62')])){return null;}else{return createJwt(_0x18ebe0);}};exports[_0x5d21('0x63')]=function(_0x1cec3a){_0x1cec3a[_0x5d21('0x4c')]=generateNonce();_0x1cec3a[_0x5d21('0x62')]=generateIssuedAt();return createJwt(_0x1cec3a);};exports[_0x5d21('0x64')]=function(_0x2bdd52,_0x2c7946){var _0x144fcc=_0x2bdd52[_0x5d21('0x45')]['apikey'];if(_0x144fcc){var _0x3ccb1f={'nonce':_0x2c7946[_0x5d21('0x4c')],'iat':_0x2c7946[_0x5d21('0x62')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x5d21('0x47')]()};return verifyJwt(_0x144fcc,_0x3ccb1f)[_0x5d21('0x3f')](function(){return generateApiKey(_0x2c7946);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x5d21('0x65')]=function(_0x3857f1){var _0x441d29=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x441d29[_0x5d21('0x66')](_0x3857f1))throw new db[(_0x5d21('0x67'))][(_0x5d21('0x68'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x5d21('0x69')]=function(_0x558119,_0x41c1c7,_0x25690f){var _0x1d7723=encryptor['decryptString'](_0x41c1c7)[_0x5d21('0x6a')](',');for(var _0x270bea=0x0;_0x270bea<_0x25690f;_0x270bea++){if(!_0x1d7723[_0x270bea])break;if(_0x558119['toLowerCase']()===_0x1d7723[_0x270bea][_0x5d21('0x6b')]()){var _0x8e138d=util[_0x5d21('0x6c')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x25690f);if(_0x25690f===0x1){_0x8e138d=_0x5d21('0x6d');}throw new db[(_0x5d21('0x67'))][(_0x5d21('0x68'))](_0x8e138d);}}return;};exports[_0x5d21('0x6e')]=function(_0x3f55e5,_0xbb1458){var _0x4da225=_0xbb1458?encryptor['decryptString'](_0xbb1458)[_0x5d21('0x6a')](','):[];if(_0x4da225[_0x5d21('0x6f')]===0x5){_0x4da225[_0x5d21('0x70')](-0x1,0x1);}_0x4da225[_0x5d21('0x71')](_0x3f55e5);return encryptor['encryptString'](_0x4da225[_0x5d21('0x72')](','));};function signJwt(_0x42dafc){var _0x12e347=BPromise[_0x5d21('0x73')](jwt[_0x5d21('0x74')],{'context':jwt});var _0x2ab0c4=_0x42dafc['secret']||config['secrets'][_0x5d21('0xe')];return new BPromise(function(_0x17e426,_0x26f984){_0x12e347(_0x42dafc[_0x5d21('0x75')],_0x2ab0c4,_0x42dafc[_0x5d21('0x76')])[_0x5d21('0x3f')](function(_0x262dc3){_0x17e426(_0x262dc3);})[_0x5d21('0x3a')](function(_0x2a720b){_0x26f984(_0x2a720b);});});}function verifyJwt(_0x15a52d,_0x5eec85,_0x417e59){var _0x16651b=BPromise[_0x5d21('0x73')](jwt['verify'],{'context':jwt});var _0x3f354c=_0x417e59||config[_0x5d21('0xd')][_0x5d21('0xe')];return new BPromise(function(_0x4b81d7,_0x330d47){_0x16651b(_0x15a52d,_0x3f354c,_0x5eec85)[_0x5d21('0x3f')](function(_0x2f3a47){_0x4b81d7(_0x2f3a47);})[_0x5d21('0x3a')](function(_0x56f5c8){_0x330d47(_0x56f5c8);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x5d21('0x77')]('hex');}function generateIssuedAt(){return Math[_0x5d21('0x78')](Date[_0x5d21('0x79')]()/0x3e8)[_0x5d21('0x77')]();}function createJwt(_0x1a32f9){var _0x412959={'payload':{'iat':_0x1a32f9[_0x5d21('0x62')],'nonce':_0x1a32f9[_0x5d21('0x4c')]},'options':{'algorithm':_0x5d21('0x7a'),'subject':_0x1a32f9['id']['toString'](),'issuer':hardwareConf[_0x5d21('0x47')](),'audience':hardwareConf[_0x5d21('0x47')]()}};return signJwt(_0x412959)[_0x5d21('0x3f')](function(_0xcd9cd9){return{'iat':_0x1a32f9[_0x5d21('0x62')],'nonce':_0x1a32f9[_0x5d21('0x4c')],'token':_0xcd9cd9};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index eaee12f..9086bde 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 _0x625c=['error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','binary','write','end','final','unlink','decryptFile','createDecipher','update','close','secret','utf8','base64','decryptString','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','join'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x625c,0xdd));var _0xc625=function(_0x48bdbf,_0x39f058){_0x48bdbf=_0x48bdbf-0x0;var _0x579f69=_0x625c[_0x48bdbf];return _0x579f69;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xc625('0x0'));var config=require(_0xc625('0x1'));var logger=require(_0xc625('0x2'))(_0xc625('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc625('0x4')][_0xc625('0x5')],'algorithm':_0xc625('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0xc625('0x7')]&&config['encrypt'][_0xc625('0x8')]){var isSupported=isAlgorithmSupported(config[_0xc625('0x7')]['algorithm']);if(isSupported){fileOptions[_0xc625('0x8')]=config[_0xc625('0x7')][_0xc625('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xc625('0x9')](',\x20');logger[_0xc625('0xa')](config[_0xc625('0x7')][_0xc625('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x43bf10){return AES_SUPPORTED_RX[_0xc625('0xb')](_0x43bf10);}function getSupportedCiphers(){return crypto[_0xc625('0xc')]()[_0xc625('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x38f107){return getSupportedCiphers()[_0xc625('0xe')](_0x38f107)>-0x1;}function combineOptions(_0x4595c4){var _0x546d1e={};for(var _0x10b8fb in fileOptions){if(fileOptions['hasOwnProperty'](_0x10b8fb)){_0x546d1e[_0x10b8fb]=fileOptions[_0x10b8fb];}}if(_0x4595c4){for(var _0xfd9d0a in _0x4595c4){if(_0x4595c4[_0xc625('0xf')](_0xfd9d0a)){_0x546d1e[_0xfd9d0a]=_0x4595c4[_0xfd9d0a];}}}return _0x546d1e;}exports[_0xc625('0x10')]=function(_0x340ead,_0x5d347e,_0x4c8213,_0xf12716){return new BPromise(function(_0xd37bd1,_0x3dc4ac){_0xf12716=combineOptions(_0xf12716);var _0x235123=new Buffer(_0x4c8213);var _0x5cee0f=fs[_0xc625('0x11')](_0x340ead);var _0x42ffc6=fs[_0xc625('0x12')](_0x5d347e);var _0x2a393e=crypto[_0xc625('0x13')](_0xf12716[_0xc625('0x8')],_0x235123);_0x5cee0f['on']('data',function(_0x32120f){var _0x3fe292=new Buffer(_0x2a393e['update'](_0x32120f),_0xc625('0x14'));_0x42ffc6[_0xc625('0x15')](_0x3fe292);});_0x5cee0f['on'](_0xc625('0x16'),function(){try{var _0x37dfb0=new Buffer(_0x2a393e[_0xc625('0x17')](_0xc625('0x14')),_0xc625('0x14'));_0x42ffc6['write'](_0x37dfb0);_0x42ffc6[_0xc625('0x16')]();_0x42ffc6['on']('close',function(){return _0xd37bd1(_0x5d347e);});}catch(_0x5a92d3){fs[_0xc625('0x18')](_0x5d347e);return _0x3dc4ac(_0x5a92d3);}});});};exports[_0xc625('0x19')]=function(_0x29c576,_0x4662b0,_0x4bd151,_0x287207){return new BPromise(function(_0x4ad301,_0x2ee25c){_0x287207=combineOptions(_0x287207);var _0x3f1b5d=new Buffer(_0x4bd151);var _0x1724c5=fs[_0xc625('0x11')](_0x29c576);var _0x1f69d9=fs[_0xc625('0x12')](_0x4662b0);var _0x295f0f=crypto[_0xc625('0x1a')](_0x287207[_0xc625('0x8')],_0x3f1b5d);_0x1724c5['on']('data',function(_0x5af94a){var _0x44fe57=new Buffer(_0x295f0f[_0xc625('0x1b')](_0x5af94a),_0xc625('0x14'));_0x1f69d9['write'](_0x44fe57);});_0x1724c5['on'](_0xc625('0x16'),function(){try{var _0x5033d2=new Buffer(_0x295f0f[_0xc625('0x17')](_0xc625('0x14')),_0xc625('0x14'));_0x1f69d9[_0xc625('0x15')](_0x5033d2);_0x1f69d9[_0xc625('0x16')]();_0x1f69d9['on'](_0xc625('0x1c'),function(){return _0x4ad301(_0x4662b0);});}catch(_0x2a87db){fs['unlink'](_0x4662b0);return _0x2ee25c(_0x2a87db);}});});};exports['encryptString']=function(_0x532287,_0x491081,_0x27d467){var _0x4596b2=_0x27d467||stringOptions[_0xc625('0x8')];var _0x2e3bf6=_0x491081||stringOptions[_0xc625('0x1d')];var _0x3d2454=crypto[_0xc625('0x13')](_0x4596b2,_0x2e3bf6);var _0x1d9cfa=_0x3d2454[_0xc625('0x1b')](_0x532287,_0xc625('0x1e'),_0xc625('0x1f'));_0x1d9cfa+=_0x3d2454[_0xc625('0x17')]('base64');return _0x1d9cfa;};exports[_0xc625('0x20')]=function(_0x395569,_0x3301b7,_0x4ac242){var _0x5403be=_0x4ac242||stringOptions['algorithm'];var _0x18a502=_0x3301b7||stringOptions['secret'];var _0x409d63=crypto[_0xc625('0x1a')](_0x5403be,_0x18a502);var _0x5aa5aa=_0x409d63['update'](_0x395569,_0xc625('0x1f'),_0xc625('0x1e'));_0x5aa5aa+=_0x409d63['final']('utf8');return _0x5aa5aa;}; \ No newline at end of file +var _0x32cc=['write','close','unlink','encryptString','secret','createCipher','utf8','base64','createDecipher','crypto','bluebird','../../config/environment','app','secrets','aes-256-ctr','aes192','algorithm','encrypt','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','data','update','end','final','binary'];(function(_0x31ddea,_0x40de6d){var _0x12539b=function(_0x1d353b){while(--_0x1d353b){_0x31ddea['push'](_0x31ddea['shift']());}};_0x12539b(++_0x40de6d);}(_0x32cc,0x171));var _0xc32c=function(_0x4096be,_0x1a7ca1){_0x4096be=_0x4096be-0x0;var _0x1455bd=_0x32cc[_0x4096be];return _0x1455bd;};'use strict';var crypto=require(_0xc32c('0x0'));var fs=require('fs');var BPromise=require(_0xc32c('0x1'));var _=require('lodash');var config=require(_0xc32c('0x2'));var logger=require('../../config/logger')(_0xc32c('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc32c('0x4')]['session'],'algorithm':_0xc32c('0x5')};const fileOptions={'algorithm':_0xc32c('0x6')};if(config['encrypt']&&config['encrypt'][_0xc32c('0x7')]){var isSupported=isAlgorithmSupported(config[_0xc32c('0x8')][_0xc32c('0x7')]);if(isSupported){fileOptions['algorithm']=config[_0xc32c('0x8')][_0xc32c('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0xc32c('0x8')][_0xc32c('0x7')],_0xc32c('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x14126c){return AES_SUPPORTED_RX['test'](_0x14126c);}function getSupportedCiphers(){return crypto[_0xc32c('0xa')]()[_0xc32c('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x3fbcf2){return getSupportedCiphers()[_0xc32c('0xc')](_0x3fbcf2)>-0x1;}function combineOptions(_0x592c4b){var _0x548d93={};for(var _0x1a4514 in fileOptions){if(fileOptions[_0xc32c('0xd')](_0x1a4514)){_0x548d93[_0x1a4514]=fileOptions[_0x1a4514];}}if(_0x592c4b){for(var _0x851f6a in _0x592c4b){if(_0x592c4b[_0xc32c('0xd')](_0x851f6a)){_0x548d93[_0x851f6a]=_0x592c4b[_0x851f6a];}}}return _0x548d93;}exports['encryptFile']=function(_0x24ac51,_0x461c60,_0x1a7119,_0x2919a4){return new BPromise(function(_0xa711be,_0x334501){_0x2919a4=combineOptions(_0x2919a4);var _0x5a4e05=new Buffer(_0x1a7119);var _0x1700e0=fs[_0xc32c('0xe')](_0x24ac51);var _0xf2bd68=fs[_0xc32c('0xf')](_0x461c60);var _0x128dd6=crypto['createCipher'](_0x2919a4['algorithm'],_0x5a4e05);_0x1700e0['on'](_0xc32c('0x10'),function(_0x2230e5){var _0x37a14f=new Buffer(_0x128dd6[_0xc32c('0x11')](_0x2230e5),'binary');_0xf2bd68['write'](_0x37a14f);});_0x1700e0['on'](_0xc32c('0x12'),function(){try{var _0xf83c6a=new Buffer(_0x128dd6[_0xc32c('0x13')](_0xc32c('0x14')),_0xc32c('0x14'));_0xf2bd68[_0xc32c('0x15')](_0xf83c6a);_0xf2bd68[_0xc32c('0x12')]();_0xf2bd68['on'](_0xc32c('0x16'),function(){return _0xa711be(_0x461c60);});}catch(_0x48a988){fs[_0xc32c('0x17')](_0x461c60);return _0x334501(_0x48a988);}});});};exports['decryptFile']=function(_0x254d56,_0x446945,_0x280f20,_0x152bad){return new BPromise(function(_0x429ff4,_0x5c17c0){_0x152bad=combineOptions(_0x152bad);var _0x4ebefb=new Buffer(_0x280f20);var _0x2f6efb=fs[_0xc32c('0xe')](_0x254d56);var _0x418b3f=fs[_0xc32c('0xf')](_0x446945);var _0x22bc2c=crypto['createDecipher'](_0x152bad[_0xc32c('0x7')],_0x4ebefb);_0x2f6efb['on'](_0xc32c('0x10'),function(_0x268b51){var _0x1e239c=new Buffer(_0x22bc2c['update'](_0x268b51),_0xc32c('0x14'));_0x418b3f[_0xc32c('0x15')](_0x1e239c);});_0x2f6efb['on']('end',function(){try{var _0x5a8fa4=new Buffer(_0x22bc2c[_0xc32c('0x13')]('binary'),_0xc32c('0x14'));_0x418b3f[_0xc32c('0x15')](_0x5a8fa4);_0x418b3f[_0xc32c('0x12')]();_0x418b3f['on'](_0xc32c('0x16'),function(){return _0x429ff4(_0x446945);});}catch(_0x2cf1f7){fs[_0xc32c('0x17')](_0x446945);return _0x5c17c0(_0x2cf1f7);}});});};exports[_0xc32c('0x18')]=function(_0x35c022,_0x5de3a4,_0x5ad0e2){var _0x5bae79=_0x5ad0e2||stringOptions[_0xc32c('0x7')];var _0x5e3ad1=_0x5de3a4||stringOptions[_0xc32c('0x19')];var _0xb32e0c=crypto[_0xc32c('0x1a')](_0x5bae79,_0x5e3ad1);var _0x2ce0df=_0xb32e0c[_0xc32c('0x11')](_0x35c022,_0xc32c('0x1b'),_0xc32c('0x1c'));_0x2ce0df+=_0xb32e0c[_0xc32c('0x13')](_0xc32c('0x1c'));return _0x2ce0df;};exports['decryptString']=function(_0x2353f5,_0x3586c5,_0x44a12f){var _0x375919=_0x44a12f||stringOptions['algorithm'];var _0x2c6836=_0x3586c5||stringOptions[_0xc32c('0x19')];var _0x502b9b=crypto[_0xc32c('0x1d')](_0x375919,_0x2c6836);var _0x3d06fa=_0x502b9b['update'](_0x2353f5,_0xc32c('0x1c'),'utf8');_0x3d06fa+=_0x502b9b[_0xc32c('0x13')](_0xc32c('0x1b'));return _0x3d06fa;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 302ad39..3d05647 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 _0xb0ac=['../../config/logger','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','splitSizeCsv','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','format','dirname','existsSync','join','mkdirSync','csv','%s.%s','writeFileSync','zip','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','Failed','finally','exit','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH'];(function(_0x4e22e8,_0x4e29d6){var _0x4b3e6f=function(_0x4a1f24){while(--_0x4a1f24){_0x4e22e8['push'](_0x4e22e8['shift']());}};_0x4b3e6f(++_0x4e29d6);}(_0xb0ac,0x198));var _0xcb0a=function(_0x3d6459,_0x3131f8){_0x3d6459=_0x3d6459-0x0;var _0x6339c3=_0xb0ac[_0x3d6459];return _0x6339c3;};'use strict';var util=require('util');var path=require('path');var _=require(_0xcb0a('0x0'));var csv=require(_0xcb0a('0x1'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xcb0a('0x2'));var rimraf=require(_0xcb0a('0x3'));var db=require(_0xcb0a('0x4'))['db'];var dbH=require(_0xcb0a('0x4'))[_0xcb0a('0x5')];var logger=require(_0xcb0a('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x42a2d8,_0x2bcc0b){var _0x26f525={'status':_0x42a2d8};var _0xced8a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2bcc0b){_0x26f525[_0xcb0a('0x7')]=_0x2bcc0b;}return db['AnalyticExtractedReport'][_0xcb0a('0x8')](_0x26f525,_0xced8a);}function main(){var _0x19de16=0x1388;var _0x394c3c;logger[_0xcb0a('0x9')](util['format'](_0xcb0a('0xa'),EXTRACTED_REPORT_ID,_0xcb0a('0xb')));return db[_0xcb0a('0xc')][_0xcb0a('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcb0a('0xe'),'splitSizeCsv']})[_0xcb0a('0xf')](function(_0x148e61){if(_0x148e61){_0x394c3c=_0x148e61;_0x19de16=_0x394c3c[_0xcb0a('0x10')]||0x1388;}})[_0xcb0a('0xf')](function(){return dbH['sequelize'][_0xcb0a('0x11')](util['format'](_0xcb0a('0x12'),QUERY),{'type':dbH[_0xcb0a('0x13')][_0xcb0a('0x14')][_0xcb0a('0x15')]});})[_0xcb0a('0xf')](function(_0x5151ce){if(!_0x5151ce[0x0][_0xcb0a('0x16')]){return analyticExtractedReport(_0xcb0a('0x17'));}var _0x3db595=[];var _0x4ab8ea=0x0;if(_0x394c3c[_0xcb0a('0xe')]){if(_0x5151ce&&_0x5151ce[_0xcb0a('0x18')]){var _0x1a0116=_[_0xcb0a('0x19')](_0x5151ce[0x0][_0xcb0a('0x16')]/_0x19de16);var _0x5193e2=Number[_0xcb0a('0x1a')](_0x5151ce[0x0][_0xcb0a('0x16')]/_0x19de16)?_0x5151ce[0x0]['num']%_0x19de16:0x0;_0x1a0116[_0xcb0a('0x1b')](function(_0x5ee0a5){if(_0x5ee0a5>0x0){_0x4ab8ea+=_0x19de16;}_0x3db595[_0xcb0a('0x1c')](dbH[_0xcb0a('0x13')][_0xcb0a('0x11')](util['format'](_0xcb0a('0x1d'),QUERY,_0x19de16,_0x4ab8ea),{'type':dbH[_0xcb0a('0x13')][_0xcb0a('0x14')]['SELECT']}));});if(_0x5193e2>0x0){_0x4ab8ea+=_0x19de16;_0x3db595[_0xcb0a('0x1c')](dbH[_0xcb0a('0x13')][_0xcb0a('0x11')](util[_0xcb0a('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5193e2,_0x4ab8ea),{'type':dbH['sequelize'][_0xcb0a('0x14')][_0xcb0a('0x15')]}));}}}else{_0x3db595[_0xcb0a('0x1c')](dbH[_0xcb0a('0x13')][_0xcb0a('0x11')](QUERY,{'type':dbH[_0xcb0a('0x13')][_0xcb0a('0x14')][_0xcb0a('0x15')]}));}var _0x83e895=path[_0xcb0a('0x1f')](PATH);var _0x438614=path['basename'](PATH,'.csv');var _0x1a97e4=_0x394c3c[_0xcb0a('0xe')]&&_0x3db595[_0xcb0a('0x18')]>0x1;var _0x4af40b=[];if(!fs[_0xcb0a('0x20')](path[_0xcb0a('0x21')](_0x83e895,_0x438614))&&_0x1a97e4){fs[_0xcb0a('0x22')](path[_0xcb0a('0x21')](_0x83e895,_0x438614));}return BPromise['each'](_0x3db595,function(_0x175e9a){_0x4af40b['push'](_0x175e9a);})[_0xcb0a('0xf')](function(){for(var _0x39dc7d=0x0;_0x39dc7d<_0x4af40b['length'];_0x39dc7d+=0x1){var _0x44b356;var _0xacceb4=_0x4af40b[_0x39dc7d];if(_0x1a97e4){_0x44b356=path['join'](_0x83e895,_0x438614,util[_0xcb0a('0x1e')]('%s%d.%s',_0x438614,_0x39dc7d,_0xcb0a('0x23')));}else{_0x44b356=path[_0xcb0a('0x21')](_0x83e895,util[_0xcb0a('0x1e')](_0xcb0a('0x24'),_0x438614,_0xcb0a('0x23')));}fs[_0xcb0a('0x25')](_0x44b356,csv(_0xacceb4));}})[_0xcb0a('0xf')](function(){if(_0x1a97e4){return new Promise(function(_0x174342){zipdir(path['join'](_0x83e895,_0x438614),{'saveTo':path['join'](_0x83e895,util['format'](_0xcb0a('0x24'),_0x438614,_0xcb0a('0x26')))},function(_0x8455de,_0x2b4e3b){rimraf(path['join'](_0x83e895,_0x438614),function(){});_0x174342('zip\x20finished');});});}})[_0xcb0a('0xf')](function(){logger['info'](util['format'](_0xcb0a('0x27'),EXTRACTED_REPORT_ID,_0xcb0a('0xb')));return analyticExtractedReport(_0xcb0a('0x28'),_0x1a97e4?util[_0xcb0a('0x1e')](_0xcb0a('0x24'),_0x438614,_0x1a97e4?_0xcb0a('0x26'):_0xcb0a('0x23')):null);});})['catch'](function(_0x1fb845){logger['info'](util[_0xcb0a('0x1e')](_0xcb0a('0x29'),EXTRACTED_REPORT_ID,_0xcb0a('0xb')),util[_0xcb0a('0x2a')](_0x1fb845,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcb0a('0x2b'));})[_0xcb0a('0x2c')](function(){process[_0xcb0a('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x36d6=['catch','inspect','Failed','finally','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','query','sequelize','QueryTypes','SELECT','num','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x39feab,_0x1efcb6){var _0x44f6ec=function(_0x36b476){while(--_0x36b476){_0x39feab['push'](_0x39feab['shift']());}};_0x44f6ec(++_0x1efcb6);}(_0x36d6,0xf4));var _0x636d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36d6[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x636d('0x0'));var path=require(_0x636d('0x1'));var _=require(_0x636d('0x2'));var csv=require(_0x636d('0x3'));var fs=require('fs');var BPromise=require(_0x636d('0x4'));var zipdir=require(_0x636d('0x5'));var rimraf=require(_0x636d('0x6'));var db=require(_0x636d('0x7'))['db'];var dbH=require(_0x636d('0x7'))[_0x636d('0x8')];var logger=require(_0x636d('0x9'))(_0x636d('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x636d('0xb')][0x2]);var QUERY=process[_0x636d('0xb')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5bd3fc,_0x12eb30){var _0x36132c={'status':_0x5bd3fc};var _0x36eae6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x12eb30){_0x36132c[_0x636d('0xc')]=_0x12eb30;}return db['AnalyticExtractedReport'][_0x636d('0xd')](_0x36132c,_0x36eae6);}function main(){var _0x3d7fb0=0x1388;var _0x5b92a8;logger[_0x636d('0xe')](util[_0x636d('0xf')](_0x636d('0x10'),EXTRACTED_REPORT_ID,_0x636d('0x11')));return db[_0x636d('0x12')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x636d('0x13'),_0x636d('0x14')]})[_0x636d('0x15')](function(_0x3f41c6){if(_0x3f41c6){_0x5b92a8=_0x3f41c6;_0x3d7fb0=_0x5b92a8[_0x636d('0x14')]||0x1388;}})[_0x636d('0x15')](function(){return dbH['sequelize'][_0x636d('0x16')](util[_0x636d('0xf')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x636d('0x17')][_0x636d('0x18')][_0x636d('0x19')]});})['then'](function(_0x4893af){if(!_0x4893af[0x0][_0x636d('0x1a')]){return analyticExtractedReport('Empty');}var _0x57c837=[];var _0x5157aa=0x0;if(_0x5b92a8[_0x636d('0x13')]){if(_0x4893af&&_0x4893af[_0x636d('0x1b')]){var _0x5366b7=_[_0x636d('0x1c')](_0x4893af[0x0][_0x636d('0x1a')]/_0x3d7fb0);var _0x890a32=Number['isInteger'](_0x4893af[0x0]['num']/_0x3d7fb0)?_0x4893af[0x0][_0x636d('0x1a')]%_0x3d7fb0:0x0;_0x5366b7[_0x636d('0x1d')](function(_0x2d502f){if(_0x2d502f>0x0){_0x5157aa+=_0x3d7fb0;}_0x57c837[_0x636d('0x1e')](dbH[_0x636d('0x17')][_0x636d('0x16')](util[_0x636d('0xf')](_0x636d('0x1f'),QUERY,_0x3d7fb0,_0x5157aa),{'type':dbH[_0x636d('0x17')][_0x636d('0x18')][_0x636d('0x19')]}));});if(_0x890a32>0x0){_0x5157aa+=_0x3d7fb0;_0x57c837['push'](dbH['sequelize'][_0x636d('0x16')](util[_0x636d('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x890a32,_0x5157aa),{'type':dbH[_0x636d('0x17')][_0x636d('0x18')][_0x636d('0x19')]}));}}}else{_0x57c837['push'](dbH[_0x636d('0x17')][_0x636d('0x16')](QUERY,{'type':dbH['sequelize'][_0x636d('0x18')]['SELECT']}));}var _0x2bf6c9=path[_0x636d('0x20')](PATH);var _0x1e955f=path['basename'](PATH,_0x636d('0x21'));var _0x455e57=_0x5b92a8[_0x636d('0x13')]&&_0x57c837[_0x636d('0x1b')]>0x1;var _0x1b8640=[];if(!fs[_0x636d('0x22')](path['join'](_0x2bf6c9,_0x1e955f))&&_0x455e57){fs[_0x636d('0x23')](path[_0x636d('0x24')](_0x2bf6c9,_0x1e955f));}return BPromise[_0x636d('0x25')](_0x57c837,function(_0x509249){_0x1b8640['push'](_0x509249);})['then'](function(){for(var _0x31b43d=0x0;_0x31b43d<_0x1b8640[_0x636d('0x1b')];_0x31b43d+=0x1){var _0x40ad64;var _0x1865dc=_0x1b8640[_0x31b43d];if(_0x455e57){_0x40ad64=path['join'](_0x2bf6c9,_0x1e955f,util[_0x636d('0xf')](_0x636d('0x26'),_0x1e955f,_0x31b43d,_0x636d('0x27')));}else{_0x40ad64=path[_0x636d('0x24')](_0x2bf6c9,util['format'](_0x636d('0x28'),_0x1e955f,_0x636d('0x27')));}fs[_0x636d('0x29')](_0x40ad64,csv(_0x1865dc));}})['then'](function(){if(_0x455e57){return new Promise(function(_0x44dc74){zipdir(path[_0x636d('0x24')](_0x2bf6c9,_0x1e955f),{'saveTo':path[_0x636d('0x24')](_0x2bf6c9,util['format'](_0x636d('0x28'),_0x1e955f,_0x636d('0x2a')))},function(_0x4bc2a3,_0x42f187){rimraf(path[_0x636d('0x24')](_0x2bf6c9,_0x1e955f),function(){});_0x44dc74('zip\x20finished');});});}})[_0x636d('0x15')](function(){logger['info'](util[_0x636d('0xf')](_0x636d('0x2b'),EXTRACTED_REPORT_ID,_0x636d('0x11')));return analyticExtractedReport('Completed',_0x455e57?util[_0x636d('0xf')](_0x636d('0x28'),_0x1e955f,_0x455e57?_0x636d('0x2a'):_0x636d('0x27')):null);});})[_0x636d('0x2c')](function(_0x3b4e48){logger['info'](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x636d('0x11')),util[_0x636d('0x2d')](_0x3b4e48,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x636d('0x2e'));})[_0x636d('0x2f')](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 5b153f1..71902cf 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 _0x1d3a=['startDate','endDate','header','pageBreak','before','margin','landscape','Arial','black','num','Empty','Setting','find','split','then','length','range','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','.pdf','existsSync','join','mkdirSync','flatten','createPdfKitDocument','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','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-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','createWriteStream','finish','error','end','createPdfFromHTML','path','lodash','util','html-to-pdfmake','zip-dir','rimraf','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','auto','body','chunk','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x1d3a,0xf2));var _0xa1d3=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x1d3a[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0xa1d3('0x0'));var fs=require('fs');var util=require(_0xa1d3('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0xa1d3('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xa1d3('0x3'));var rimraf=require(_0xa1d3('0x4'));var JSDOM=require('jsdom')[_0xa1d3('0x5')];var window=new JSDOM('')['window'];var BPromise=require(_0xa1d3('0x6'));var db=require(_0xa1d3('0x7'))['db'];var dbH=require(_0xa1d3('0x7'))[_0xa1d3('0x8')];var logger=require(_0xa1d3('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xa1d3('0xa')][0x3];var PATH=process[_0xa1d3('0xa')][0x4];var NAME=process[_0xa1d3('0xa')][0x5];var FORMAT=_0xa1d3('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5808e2,_0x58f7bd){var _0x14ed95={'status':_0x5808e2};var _0x1bddf7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x58f7bd){_0x14ed95[_0xa1d3('0xc')]=_0x58f7bd;}return db[_0xa1d3('0xd')][_0xa1d3('0xe')](_0x14ed95,_0x1bddf7);}function getHeaders(_0x4d45eb){return _[_0xa1d3('0xf')](_0x4d45eb,function(_0x482b8f){return{'text':_0x482b8f,'style':_0xa1d3('0x10')};});}function getRows(_0x5d3040,_0x4f2d64){return _[_0xa1d3('0xf')](_0x4f2d64,function(_0x135e11){return _(_0x135e11)[_0xa1d3('0x11')](_0x5d3040)['map'](function(_0x2f67d7){return _0x2f67d7?_[_0xa1d3('0x12')](_0x2f67d7):'';})[_0xa1d3('0x13')]();});}function createTable(_0x2cc5c5,_0x10a501){var _0x526bc7={'widths':_[_0xa1d3('0x14')](Array(_0x2cc5c5['length']),0x91),'heights':function(_0x1b8398){return _0x1b8398===0x0?_0xa1d3('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3f85df=getHeaders(_0x2cc5c5);_0x526bc7[_0xa1d3('0x16')]['push'](_0x3f85df);var _0x558d63=getRows(_0x2cc5c5,_0x10a501);_0x526bc7[_0xa1d3('0x16')]=_0x526bc7[_0xa1d3('0x16')]['concat'](_0x558d63);return _0x526bc7;}function createTables(_0x355e97){var _0x54e979=[];var _0x5bdbfb=_[_0xa1d3('0x17')](Object['keys'](_0x355e97[0x0]),0x5);_0x5bdbfb[_0xa1d3('0x18')](function(_0x10fb2a){_0x54e979[_0xa1d3('0x19')](createTable(_0x10fb2a,_0x355e97));});return _0x54e979;}function getPDFDocDefinition(_0x127f3b){var _0x5ad847=util[_0xa1d3('0x1a')](_0xa1d3('0x1b'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xa1d3('0x1c')])[_0xa1d3('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0xa1d3('0x1d')])['format'](FORMAT));var _0xc5918d=[];for(var _0x85e96b=0x0;_0x85e96b<_0x127f3b['length'];_0x85e96b++){var _0x37de12=[];if(_0x85e96b===0x0){_0x37de12[_0xa1d3('0x19')]({'text':_0x5ad847,'style':_0xa1d3('0x1e')});}var _0x2708a8={'table':_0x127f3b[_0x85e96b]};if(_0x85e96b>0x0){_0x2708a8[_0xa1d3('0x1f')]=_0xa1d3('0x20');_0x2708a8[_0xa1d3('0x21')]=[0x0,0x46,0x0,0x0];}_0x37de12[_0xa1d3('0x19')](_0x2708a8);_0xc5918d[_0xa1d3('0x19')](_0x37de12);}return{'pageSize':'A4','pageOrientation':_0xa1d3('0x22'),'content':_0xc5918d,'footer':function(_0x313eca,_0x24363f){return{'text':_0x313eca[_0xa1d3('0x12')]()+'\x20/\x20'+_0x24363f,'style':'footer'};},'defaultStyle':{'font':_0xa1d3('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa1d3('0x24')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5422c0){var _0x65ca45=0x1388;var _0x1f190b;if(!_0x5422c0[0x0][_0xa1d3('0x25')]){return analyticExtractedReport(_0xa1d3('0x26'));}return db[_0xa1d3('0x27')][_0xa1d3('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa1d3('0x29'),'splitSizePdf']})['then'](function(_0x15bb4f){if(_0x15bb4f){_0x1f190b=_0x15bb4f;_0x65ca45=_0x1f190b['splitSizePdf']||0x3e8;}})[_0xa1d3('0x2a')](function(){var _0x8cce5=[];var _0x544fe7=0x0;if(_0x1f190b[_0xa1d3('0x29')]){if(_0x5422c0&&_0x5422c0[_0xa1d3('0x2b')]){var _0x4c5916=_[_0xa1d3('0x2c')](_0x5422c0[0x0][_0xa1d3('0x25')]/_0x65ca45);var _0xffb3a=Number['isInteger'](_0x5422c0[0x0][_0xa1d3('0x25')]/_0x65ca45)?_0x5422c0[0x0]['num']%_0x65ca45:0x0;_0x4c5916[_0xa1d3('0x18')](function(_0xdd1a02){if(_0xdd1a02>0x0){_0x544fe7+=_0x65ca45;}_0x8cce5['push'](dbH['sequelize'][_0xa1d3('0x2d')](util[_0xa1d3('0x1a')](_0xa1d3('0x2e'),QUERY,_0x65ca45,_0x544fe7),{'type':dbH[_0xa1d3('0x2f')][_0xa1d3('0x30')][_0xa1d3('0x31')]}));});if(_0xffb3a>0x0){_0x544fe7+=_0x65ca45;_0x8cce5[_0xa1d3('0x19')](dbH[_0xa1d3('0x2f')][_0xa1d3('0x2d')](util[_0xa1d3('0x1a')](_0xa1d3('0x2e'),QUERY,_0xffb3a,_0x544fe7),{'type':dbH[_0xa1d3('0x2f')][_0xa1d3('0x30')]['SELECT']}));}}}else{_0x8cce5['push'](dbH[_0xa1d3('0x2f')][_0xa1d3('0x2d')](QUERY,{'type':dbH[_0xa1d3('0x2f')][_0xa1d3('0x30')][_0xa1d3('0x31')]}));}var _0x5101bb=path[_0xa1d3('0x32')](PATH);var _0x1f93ad=path['basename'](PATH,_0xa1d3('0x33'));var _0x2cdde5=_0x1f190b[_0xa1d3('0x29')]&&_0x8cce5[_0xa1d3('0x2b')]>0x1;var _0x146dd3=[];if(!fs[_0xa1d3('0x34')](path[_0xa1d3('0x35')](_0x5101bb,_0x1f93ad))&&_0x2cdde5){fs[_0xa1d3('0x36')](path[_0xa1d3('0x35')](_0x5101bb,_0x1f93ad));}return BPromise['each'](_0x8cce5,function(_0x5e4039){_0x146dd3['push'](_0x5e4039);})[_0xa1d3('0x2a')](function(){var _0x50884f=[];for(var _0x5027bd=0x0;_0x5027bd<_0x146dd3['length'];_0x5027bd+=0x1){var _0x4e359d=_0x146dd3[_0x5027bd];var _0x37cf4e=createTables(_[_0xa1d3('0x37')](_0x4e359d));var _0x38f93c;var _0x60385c=getPDFDocDefinition(_0x37cf4e);var _0x5c05ae=getPDFPrinter();var _0x1d5fc4=_0x5c05ae[_0xa1d3('0x38')](_0x60385c);if(_0x2cdde5){_0x38f93c=path[_0xa1d3('0x35')](_0x5101bb,_0x1f93ad,util[_0xa1d3('0x1a')]('%s%d.%s',_0x1f93ad,_0x5027bd,_0xa1d3('0x39')));}else{_0x38f93c=path[_0xa1d3('0x35')](_0x5101bb,util[_0xa1d3('0x1a')](_0xa1d3('0x3a'),_0x1f93ad,_0xa1d3('0x39')));}_0x50884f[_0xa1d3('0x19')](writePDFDocument(_0x1d5fc4,_0x38f93c));}return Promise[_0xa1d3('0x3b')](_0x50884f);})[_0xa1d3('0x2a')](function(){if(_0x2cdde5){return new Promise(function(_0x3e2987){zipdir(path['join'](_0x5101bb,_0x1f93ad),{'saveTo':path['join'](_0x5101bb,util[_0xa1d3('0x1a')](_0xa1d3('0x3a'),_0x1f93ad,_0xa1d3('0x3c')))},function(){rimraf(path['join'](_0x5101bb,_0x1f93ad),function(){});_0x3e2987(_0xa1d3('0x3d'));});});}})['then'](function(){if(!_0x2cdde5)return;rimraf(path[_0xa1d3('0x35')](_0x5101bb,_0x1f93ad),function(){});})[_0xa1d3('0x2a')](function(){logger[_0xa1d3('0x3e')](util[_0xa1d3('0x1a')](_0xa1d3('0x3f'),EXTRACTED_REPORT_ID,_0xa1d3('0x40')));return analyticExtractedReport(_0xa1d3('0x41'),_0x2cdde5?util[_0xa1d3('0x1a')](_0xa1d3('0x3a'),_0x1f93ad,_0x2cdde5?_0xa1d3('0x3c'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xa1d3('0x3e')](util['format'](_0xa1d3('0x42'),EXTRACTED_REPORT_ID,_0xa1d3('0x40')));return db[_0xa1d3('0xd')][_0xa1d3('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x23a515){EXTRACTED_REPORT=_0x23a515;return dbH[_0xa1d3('0x2f')]['query'](util[_0xa1d3('0x1a')](_0xa1d3('0x44'),QUERY),{'type':dbH[_0xa1d3('0x2f')][_0xa1d3('0x30')][_0xa1d3('0x31')]});})[_0xa1d3('0x2a')](extractReport)[_0xa1d3('0x45')](function(_0x242c46){logger[_0xa1d3('0x3e')](util[_0xa1d3('0x1a')](_0xa1d3('0x46'),EXTRACTED_REPORT_ID,'PDF'),util[_0xa1d3('0x47')](_0x242c46,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa1d3('0x48'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4cef81=new PdfPrinter({'Arial':{'normal':__dirname+_0xa1d3('0x49'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xa1d3('0x4a'),'bolditalics':__dirname+_0xa1d3('0x4b')}});return _0x4cef81;}function getPDFDocDefinitionFromHTML(_0x302d8d,_0x49c29d){var _0x38536c=util[_0xa1d3('0x1a')](_0xa1d3('0x4c'),_0x49c29d[_0xa1d3('0x4d')],_0x49c29d[_0xa1d3('0x4e')]);var _0x42047f=moment()[_0xa1d3('0x1a')](_0xa1d3('0x4f'))[_0xa1d3('0x12')]();var _0x57bddc=htmlToPdfmake(_0x302d8d,{'window':window,'tableAutoSize':!![]});return{'content':[_0x57bddc],'defaultStyle':{'font':_0xa1d3('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa1d3('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xa1d3('0x50')}},'header':function(){return[{'text':_0xa1d3('0x51'),'style':'header'}];},'footer':function(_0x2d3e17,_0x3fe5ae){return[{'text':util[_0xa1d3('0x1a')](_0xa1d3('0x52'),_0x38536c,_0x2d3e17,_0x3fe5ae,_0x42047f),'style':_0xa1d3('0x53')}];}};}function writePDFDocument(_0x8891a7,_0x57cdc4){return new Promise(function(_0x6117fc,_0x39b9bd){var _0x1e552a=_0x8891a7['pipe'](fs[_0xa1d3('0x54')](_0x57cdc4));_0x1e552a['on'](_0xa1d3('0x55'),function(){_0x6117fc('finish');});_0x1e552a['on'](_0xa1d3('0x56'),function(_0xaa36cd){_0x39b9bd(_0xaa36cd);});_0x8891a7[_0xa1d3('0x57')]();});}exports[_0xa1d3('0x58')]=function(_0x427cb4,_0x48f5a4){var _0x5d3210=getPDFPrinter();var _0x434cb6=getPDFDocDefinitionFromHTML(_0x427cb4,_0x48f5a4);var _0x5637b7=_0x5d3210[_0xa1d3('0x38')](_0x434cb6);return writePDFDocument(_0x5637b7,_0x48f5a4[_0xa1d3('0x59')])[_0xa1d3('0x45')](function(_0x5dab29){throw _0x5dab29;});}; \ No newline at end of file +var _0x75f6=['center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','path','lodash','util','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','value','fill','body','push','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','pageBreak','before','landscape','toString','\x20/\x20','footer','black','right','num','Empty','Setting','find','split','splitSizePdf','then','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','query','dirname','length','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD'];(function(_0x328347,_0x4f3389){var _0x508f7a=function(_0x205e34){while(--_0x205e34){_0x328347['push'](_0x328347['shift']());}};_0x508f7a(++_0x4f3389);}(_0x75f6,0x171));var _0x675f=function(_0x523e42,_0x4449bf){_0x523e42=_0x523e42-0x0;var _0x476393=_0x75f6[_0x523e42];return _0x476393;};'use strict';var _=require(_0x675f('0x0'));var fs=require('fs');var util=require(_0x675f('0x1'));var path=require('path');var moment=require(_0x675f('0x2'));var htmlToPdfmake=require(_0x675f('0x3'));var PdfPrinter=require(_0x675f('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x675f('0x5'));var JSDOM=require(_0x675f('0x6'))[_0x675f('0x7')];var window=new JSDOM('')[_0x675f('0x8')];var BPromise=require(_0x675f('0x9'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x675f('0xa'))(_0x675f('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x675f('0xc')][0x4];var NAME=process[_0x675f('0xc')][0x5];var FORMAT=_0x675f('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1f81c2,_0x4538c6){var _0x4125a1={'status':_0x1f81c2};var _0x67a5a5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4538c6){_0x4125a1[_0x675f('0xe')]=_0x4538c6;}return db['AnalyticExtractedReport'][_0x675f('0xf')](_0x4125a1,_0x67a5a5);}function getHeaders(_0x22ca8d){return _[_0x675f('0x10')](_0x22ca8d,function(_0x3337b6){return{'text':_0x3337b6,'style':_0x675f('0x11')};});}function getRows(_0x24003a,_0x3a7020){return _[_0x675f('0x10')](_0x3a7020,function(_0x2fd9be){return _(_0x2fd9be)[_0x675f('0x12')](_0x24003a)[_0x675f('0x10')](function(_0x302463){return _0x302463?_['toString'](_0x302463):'';})[_0x675f('0x13')]();});}function createTable(_0x15b53b,_0x1f3781){var _0x533e99={'widths':_[_0x675f('0x14')](Array(_0x15b53b['length']),0x91),'heights':function(_0x4838d1){return _0x4838d1===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x55844c=getHeaders(_0x15b53b);_0x533e99[_0x675f('0x15')][_0x675f('0x16')](_0x55844c);var _0x45b00c=getRows(_0x15b53b,_0x1f3781);_0x533e99[_0x675f('0x15')]=_0x533e99[_0x675f('0x15')]['concat'](_0x45b00c);return _0x533e99;}function createTables(_0x283f25){var _0x25d0bd=[];var _0x2448c8=_[_0x675f('0x17')](Object[_0x675f('0x18')](_0x283f25[0x0]),0x5);_0x2448c8[_0x675f('0x19')](function(_0x5b4919){_0x25d0bd[_0x675f('0x16')](createTable(_0x5b4919,_0x283f25));});return _0x25d0bd;}function getPDFDocDefinition(_0x42863d){var _0x4524ca=util[_0x675f('0x1a')](_0x675f('0x1b'),NAME,EXTRACTED_REPORT[_0x675f('0x1c')],moment(EXTRACTED_REPORT['startDate'])[_0x675f('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x675f('0x1d')])[_0x675f('0x1a')](FORMAT));var _0x2e14db=[];for(var _0x2c672a=0x0;_0x2c672a<_0x42863d['length'];_0x2c672a++){var _0x431387=[];if(_0x2c672a===0x0){_0x431387[_0x675f('0x16')]({'text':_0x4524ca,'style':'header'});}var _0x514782={'table':_0x42863d[_0x2c672a]};if(_0x2c672a>0x0){_0x514782[_0x675f('0x1e')]=_0x675f('0x1f');_0x514782['margin']=[0x0,0x46,0x0,0x0];}_0x431387[_0x675f('0x16')](_0x514782);_0x2e14db[_0x675f('0x16')](_0x431387);}return{'pageSize':'A4','pageOrientation':_0x675f('0x20'),'content':_0x2e14db,'footer':function(_0x80fb12,_0x148e64){return{'text':_0x80fb12[_0x675f('0x21')]()+_0x675f('0x22')+_0x148e64,'style':_0x675f('0x23')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x675f('0x24')},'footer':{'alignment':_0x675f('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x442899){var _0x479ee7=0x1388;var _0x204dde;if(!_0x442899[0x0][_0x675f('0x26')]){return analyticExtractedReport(_0x675f('0x27'));}return db[_0x675f('0x28')][_0x675f('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x675f('0x2a'),_0x675f('0x2b')]})[_0x675f('0x2c')](function(_0x31ccb6){if(_0x31ccb6){_0x204dde=_0x31ccb6;_0x479ee7=_0x204dde[_0x675f('0x2b')]||0x3e8;}})['then'](function(){var _0x391f10=[];var _0x3d7efb=0x0;if(_0x204dde[_0x675f('0x2a')]){if(_0x442899&&_0x442899['length']){var _0x83cb3d=_['range'](_0x442899[0x0][_0x675f('0x26')]/_0x479ee7);var _0x22ca1a=Number[_0x675f('0x2d')](_0x442899[0x0][_0x675f('0x26')]/_0x479ee7)?_0x442899[0x0][_0x675f('0x26')]%_0x479ee7:0x0;_0x83cb3d[_0x675f('0x19')](function(_0x4719bd){if(_0x4719bd>0x0){_0x3d7efb+=_0x479ee7;}_0x391f10['push'](dbH['sequelize']['query'](util[_0x675f('0x1a')](_0x675f('0x2e'),QUERY,_0x479ee7,_0x3d7efb),{'type':dbH['sequelize'][_0x675f('0x2f')][_0x675f('0x30')]}));});if(_0x22ca1a>0x0){_0x3d7efb+=_0x479ee7;_0x391f10[_0x675f('0x16')](dbH[_0x675f('0x31')][_0x675f('0x32')](util['format'](_0x675f('0x2e'),QUERY,_0x22ca1a,_0x3d7efb),{'type':dbH[_0x675f('0x31')][_0x675f('0x2f')]['SELECT']}));}}}else{_0x391f10['push'](dbH['sequelize'][_0x675f('0x32')](QUERY,{'type':dbH[_0x675f('0x31')][_0x675f('0x2f')][_0x675f('0x30')]}));}var _0x39a935=path[_0x675f('0x33')](PATH);var _0x4662dd=path['basename'](PATH,'.pdf');var _0x496afa=_0x204dde[_0x675f('0x2a')]&&_0x391f10[_0x675f('0x34')]>0x1;var _0x7df918=[];if(!fs[_0x675f('0x35')](path[_0x675f('0x36')](_0x39a935,_0x4662dd))&&_0x496afa){fs[_0x675f('0x37')](path['join'](_0x39a935,_0x4662dd));}return BPromise[_0x675f('0x38')](_0x391f10,function(_0x35430f){_0x7df918[_0x675f('0x16')](_0x35430f);})['then'](function(){var _0x32d14=[];for(var _0x7079f4=0x0;_0x7079f4<_0x7df918[_0x675f('0x34')];_0x7079f4+=0x1){var _0x265261=_0x7df918[_0x7079f4];var _0x4c7a85=createTables(_[_0x675f('0x39')](_0x265261));var _0x1a2a3b;var _0x5d02d2=getPDFDocDefinition(_0x4c7a85);var _0x11aa59=getPDFPrinter();var _0x1e84d4=_0x11aa59[_0x675f('0x3a')](_0x5d02d2);if(_0x496afa){_0x1a2a3b=path['join'](_0x39a935,_0x4662dd,util[_0x675f('0x1a')](_0x675f('0x3b'),_0x4662dd,_0x7079f4,_0x675f('0x3c')));}else{_0x1a2a3b=path[_0x675f('0x36')](_0x39a935,util[_0x675f('0x1a')](_0x675f('0x3d'),_0x4662dd,_0x675f('0x3c')));}_0x32d14[_0x675f('0x16')](writePDFDocument(_0x1e84d4,_0x1a2a3b));}return Promise['all'](_0x32d14);})[_0x675f('0x2c')](function(){if(_0x496afa){return new Promise(function(_0x30dd64){zipdir(path['join'](_0x39a935,_0x4662dd),{'saveTo':path['join'](_0x39a935,util[_0x675f('0x1a')](_0x675f('0x3d'),_0x4662dd,_0x675f('0x3e')))},function(){rimraf(path[_0x675f('0x36')](_0x39a935,_0x4662dd),function(){});_0x30dd64(_0x675f('0x3f'));});});}})[_0x675f('0x2c')](function(){if(!_0x496afa)return;rimraf(path[_0x675f('0x36')](_0x39a935,_0x4662dd),function(){});})[_0x675f('0x2c')](function(){logger[_0x675f('0x40')](util[_0x675f('0x1a')](_0x675f('0x41'),EXTRACTED_REPORT_ID,_0x675f('0x42')));return analyticExtractedReport('Completed',_0x496afa?util[_0x675f('0x1a')](_0x675f('0x3d'),_0x4662dd,_0x496afa?_0x675f('0x3e'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x675f('0x40')](util['format'](_0x675f('0x43'),EXTRACTED_REPORT_ID,_0x675f('0x42')));return db[_0x675f('0x44')][_0x675f('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x675f('0x2c')](function(_0x3bbba6){EXTRACTED_REPORT=_0x3bbba6;return dbH[_0x675f('0x31')][_0x675f('0x32')](util[_0x675f('0x1a')](_0x675f('0x46'),QUERY),{'type':dbH[_0x675f('0x31')][_0x675f('0x2f')][_0x675f('0x30')]});})[_0x675f('0x2c')](extractReport)[_0x675f('0x47')](function(_0x186bfe){logger[_0x675f('0x40')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x675f('0x42')),util['inspect'](_0x186bfe,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x675f('0x48'));})[_0x675f('0x49')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2e5ff8=new PdfPrinter({'Arial':{'normal':__dirname+_0x675f('0x4a'),'bold':__dirname+_0x675f('0x4b'),'italics':__dirname+_0x675f('0x4c'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x2e5ff8;}function getPDFDocDefinitionFromHTML(_0x3f94ba,_0x4e01a4){var _0x498e5a=util[_0x675f('0x1a')](_0x675f('0x4d'),_0x4e01a4[_0x675f('0x4e')],_0x4e01a4[_0x675f('0x4f')]);var _0x242b8e=moment()[_0x675f('0x1a')](_0x675f('0x50'))['toString']();var _0x31a27e=htmlToPdfmake(_0x3f94ba,{'window':window,'tableAutoSize':!![]});return{'content':[_0x31a27e],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x675f('0x51'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x675f('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x675f('0x51')}},'header':function(){return[{'text':_0x675f('0x52'),'style':_0x675f('0x53')}];},'footer':function(_0x3c4139,_0x49db30){return[{'text':util[_0x675f('0x1a')](_0x675f('0x54'),_0x498e5a,_0x3c4139,_0x49db30,_0x242b8e),'style':_0x675f('0x23')}];}};}function writePDFDocument(_0x1fdbbf,_0x3cf7e6){return new Promise(function(_0xf349bf,_0xbf2d43){var _0x11f10c=_0x1fdbbf[_0x675f('0x55')](fs[_0x675f('0x56')](_0x3cf7e6));_0x11f10c['on'](_0x675f('0x57'),function(){_0xf349bf(_0x675f('0x57'));});_0x11f10c['on'](_0x675f('0x58'),function(_0x36a02d){_0xbf2d43(_0x36a02d);});_0x1fdbbf['end']();});}exports['createPdfFromHTML']=function(_0x51767a,_0x18759d){var _0x1ac552=getPDFPrinter();var _0x3b3112=getPDFDocDefinitionFromHTML(_0x51767a,_0x18759d);var _0x2807a4=_0x1ac552[_0x675f('0x3a')](_0x3b3112);return writePDFDocument(_0x2807a4,_0x18759d[_0x675f('0x59')])['catch'](function(_0x1b46c1){throw _0x1b46c1;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 5cf9d29..0a4c370 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 _0x38b3=['split','length','range','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','.xlsx','existsSync','join','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','zip\x20finished','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','splitSizeXlsx','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','then','num','Empty'];(function(_0x1740ae,_0x5889d2){var _0x2eddc6=function(_0x228c0f){while(--_0x228c0f){_0x1740ae['push'](_0x1740ae['shift']());}};_0x2eddc6(++_0x5889d2);}(_0x38b3,0xda));var _0x338b=function(_0x3fc587,_0x30812a){_0x3fc587=_0x3fc587-0x0;var _0x521284=_0x38b3[_0x3fc587];return _0x521284;};'use strict';var util=require(_0x338b('0x0'));var path=require(_0x338b('0x1'));var _=require(_0x338b('0x2'));var fs=require('fs');var json2xls=require(_0x338b('0x3'));var BPromise=require(_0x338b('0x4'));var zipdir=require(_0x338b('0x5'));var rimraf=require(_0x338b('0x6'));var db=require(_0x338b('0x7'))['db'];var dbH=require(_0x338b('0x7'))[_0x338b('0x8')];var logger=require(_0x338b('0x9'))(_0x338b('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x338b('0xb')][0x2]);var QUERY=process[_0x338b('0xb')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x193685,_0xbf679b){var _0x48bafd={'status':_0x193685};var _0x3c5014={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xbf679b){_0x48bafd[_0x338b('0xc')]=_0xbf679b;}return db['AnalyticExtractedReport'][_0x338b('0xd')](_0x48bafd,_0x3c5014);}function main(){var _0x2a1642=0x1388;var _0x287312;logger[_0x338b('0xe')](util['format'](_0x338b('0xf'),EXTRACTED_REPORT_ID,_0x338b('0x10')));return db['Setting'][_0x338b('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})['then'](function(_0x5bfe66){if(_0x5bfe66){_0x287312=_0x5bfe66;_0x2a1642=_0x287312[_0x338b('0x12')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x338b('0x13')](util[_0x338b('0x14')](_0x338b('0x15'),QUERY),{'type':dbH['sequelize'][_0x338b('0x16')][_0x338b('0x17')]});})[_0x338b('0x18')](function(_0x2acd34){if(!_0x2acd34[0x0][_0x338b('0x19')]){return analyticExtractedReport(_0x338b('0x1a'));}var _0x3d945f=[];var _0x1ab892=0x0;if(_0x287312[_0x338b('0x1b')]){if(_0x2acd34&&_0x2acd34[_0x338b('0x1c')]){var _0x1924e8=_[_0x338b('0x1d')](_0x2acd34[0x0][_0x338b('0x19')]/_0x2a1642);var _0x46c020=Number[_0x338b('0x1e')](_0x2acd34[0x0][_0x338b('0x19')]/_0x2a1642)?_0x2acd34[0x0][_0x338b('0x19')]%_0x2a1642:0x0;_0x1924e8['forEach'](function(_0x49d9b7){if(_0x49d9b7>0x0){_0x1ab892+=_0x2a1642;}_0x3d945f['push'](dbH[_0x338b('0x1f')][_0x338b('0x13')](util[_0x338b('0x14')](_0x338b('0x20'),QUERY,_0x2a1642,_0x1ab892),{'type':dbH[_0x338b('0x1f')][_0x338b('0x16')][_0x338b('0x17')]}));});if(_0x46c020>0x0){_0x1ab892+=_0x2a1642;_0x3d945f['push'](dbH['sequelize']['query'](util[_0x338b('0x14')](_0x338b('0x20'),QUERY,_0x46c020,_0x1ab892),{'type':dbH[_0x338b('0x1f')][_0x338b('0x16')][_0x338b('0x17')]}));}}}else{_0x3d945f[_0x338b('0x21')](dbH['sequelize'][_0x338b('0x13')](QUERY,{'type':dbH[_0x338b('0x1f')][_0x338b('0x16')][_0x338b('0x17')]}));}var _0x43d660=path[_0x338b('0x22')](PATH);var _0x3cc95b=path['basename'](PATH,_0x338b('0x23'));var _0x5390cc=_0x287312[_0x338b('0x1b')]&&_0x3d945f[_0x338b('0x1c')]>0x1;var _0x582ad0=[];if(!fs[_0x338b('0x24')](path['join'](_0x43d660,_0x3cc95b))&&_0x5390cc){fs['mkdirSync'](path[_0x338b('0x25')](_0x43d660,_0x3cc95b));}return BPromise[_0x338b('0x26')](_0x3d945f,function(_0x50e9cf){_0x582ad0[_0x338b('0x21')](_0x50e9cf);})['then'](function(){for(var _0xef4224=0x0;_0xef4224<_0x582ad0['length'];_0xef4224+=0x1){var _0x2ec77d;var _0x5d996d=_0x582ad0[_0xef4224];if(_0x5390cc){_0x2ec77d=path['join'](_0x43d660,_0x3cc95b,util['format'](_0x338b('0x27'),_0x3cc95b,_0xef4224,_0x338b('0x28')));}else{_0x2ec77d=path[_0x338b('0x25')](_0x43d660,util[_0x338b('0x14')]('%s.%s',_0x3cc95b,_0x338b('0x28')));}fs[_0x338b('0x29')](_0x2ec77d,json2xls(_0x5d996d),_0x338b('0x2a'));}})[_0x338b('0x18')](function(){if(_0x5390cc){return new Promise(function(_0x4bb781){zipdir(path[_0x338b('0x25')](_0x43d660,_0x3cc95b),{'saveTo':path[_0x338b('0x25')](_0x43d660,util[_0x338b('0x14')](_0x338b('0x2b'),_0x3cc95b,_0x338b('0x2c')))},function(_0x3a725f,_0x276c34){rimraf(path[_0x338b('0x25')](_0x43d660,_0x3cc95b),function(){});_0x4bb781(_0x338b('0x2d'));});});}})[_0x338b('0x18')](function(){logger['info'](util[_0x338b('0x14')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x338b('0x10')));return analyticExtractedReport('Completed',_0x5390cc?util[_0x338b('0x14')](_0x338b('0x2b'),_0x3cc95b,_0x5390cc?_0x338b('0x2c'):_0x338b('0x28')):null);});})['catch'](function(_0x673b51){logger[_0x338b('0xe')](util[_0x338b('0x14')](_0x338b('0x2e'),EXTRACTED_REPORT_ID,_0x338b('0x10')),util['inspect'](_0x673b51,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x338b('0x2f')](function(){process[_0x338b('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0d40=['num','Empty','length','range','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT'];(function(_0x458123,_0x6e1c89){var _0x2557d9=function(_0x358965){while(--_0x358965){_0x458123['push'](_0x458123['shift']());}};_0x2557d9(++_0x6e1c89);}(_0x0d40,0xac));var _0x00d4=function(_0x1ebc6c,_0x58a00b){_0x1ebc6c=_0x1ebc6c-0x0;var _0x3a826d=_0x0d40[_0x1ebc6c];return _0x3a826d;};'use strict';var util=require(_0x00d4('0x0'));var path=require(_0x00d4('0x1'));var _=require(_0x00d4('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x00d4('0x3'));var zipdir=require(_0x00d4('0x4'));var rimraf=require(_0x00d4('0x5'));var db=require(_0x00d4('0x6'))['db'];var dbH=require(_0x00d4('0x6'))[_0x00d4('0x7')];var logger=require(_0x00d4('0x8'))(_0x00d4('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x00d4('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xf7ecf8,_0xddeaa6){var _0xf08a92={'status':_0xf7ecf8};var _0x552a16={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xddeaa6){_0xf08a92[_0x00d4('0xb')]=_0xddeaa6;}return db['AnalyticExtractedReport'][_0x00d4('0xc')](_0xf08a92,_0x552a16);}function main(){var _0x27dd92=0x1388;var _0x5e8cb0;logger['info'](util[_0x00d4('0xd')](_0x00d4('0xe'),EXTRACTED_REPORT_ID,_0x00d4('0xf')));return db['Setting'][_0x00d4('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x00d4('0x11'),_0x00d4('0x12')]})[_0x00d4('0x13')](function(_0x31ee35){if(_0x31ee35){_0x5e8cb0=_0x31ee35;_0x27dd92=_0x5e8cb0['splitSizeXlsx']||0x1388;}})[_0x00d4('0x13')](function(){return dbH['sequelize']['query'](util['format'](_0x00d4('0x14'),QUERY),{'type':dbH[_0x00d4('0x15')][_0x00d4('0x16')][_0x00d4('0x17')]});})[_0x00d4('0x13')](function(_0x196d7d){if(!_0x196d7d[0x0][_0x00d4('0x18')]){return analyticExtractedReport(_0x00d4('0x19'));}var _0x1b9a83=[];var _0x4dbc80=0x0;if(_0x5e8cb0['split']){if(_0x196d7d&&_0x196d7d[_0x00d4('0x1a')]){var _0x54ef98=_[_0x00d4('0x1b')](_0x196d7d[0x0][_0x00d4('0x18')]/_0x27dd92);var _0x4eeb88=Number['isInteger'](_0x196d7d[0x0][_0x00d4('0x18')]/_0x27dd92)?_0x196d7d[0x0][_0x00d4('0x18')]%_0x27dd92:0x0;_0x54ef98['forEach'](function(_0x1c2783){if(_0x1c2783>0x0){_0x4dbc80+=_0x27dd92;}_0x1b9a83[_0x00d4('0x1c')](dbH[_0x00d4('0x15')][_0x00d4('0x1d')](util[_0x00d4('0xd')](_0x00d4('0x1e'),QUERY,_0x27dd92,_0x4dbc80),{'type':dbH[_0x00d4('0x15')][_0x00d4('0x16')]['SELECT']}));});if(_0x4eeb88>0x0){_0x4dbc80+=_0x27dd92;_0x1b9a83[_0x00d4('0x1c')](dbH['sequelize'][_0x00d4('0x1d')](util[_0x00d4('0xd')](_0x00d4('0x1e'),QUERY,_0x4eeb88,_0x4dbc80),{'type':dbH[_0x00d4('0x15')]['QueryTypes']['SELECT']}));}}}else{_0x1b9a83[_0x00d4('0x1c')](dbH[_0x00d4('0x15')][_0x00d4('0x1d')](QUERY,{'type':dbH[_0x00d4('0x15')]['QueryTypes']['SELECT']}));}var _0x5863dd=path[_0x00d4('0x1f')](PATH);var _0x3bd844=path[_0x00d4('0x20')](PATH,_0x00d4('0x21'));var _0x154aef=_0x5e8cb0[_0x00d4('0x11')]&&_0x1b9a83[_0x00d4('0x1a')]>0x1;var _0x26a168=[];if(!fs[_0x00d4('0x22')](path[_0x00d4('0x23')](_0x5863dd,_0x3bd844))&&_0x154aef){fs['mkdirSync'](path[_0x00d4('0x23')](_0x5863dd,_0x3bd844));}return BPromise['each'](_0x1b9a83,function(_0x2942ef){_0x26a168[_0x00d4('0x1c')](_0x2942ef);})[_0x00d4('0x13')](function(){for(var _0x29597f=0x0;_0x29597f<_0x26a168[_0x00d4('0x1a')];_0x29597f+=0x1){var _0x4195a5;var _0x42c2fd=_0x26a168[_0x29597f];if(_0x154aef){_0x4195a5=path[_0x00d4('0x23')](_0x5863dd,_0x3bd844,util[_0x00d4('0xd')](_0x00d4('0x24'),_0x3bd844,_0x29597f,'xlsx'));}else{_0x4195a5=path[_0x00d4('0x23')](_0x5863dd,util[_0x00d4('0xd')]('%s.%s',_0x3bd844,_0x00d4('0x25')));}fs[_0x00d4('0x26')](_0x4195a5,json2xls(_0x42c2fd),_0x00d4('0x27'));}})[_0x00d4('0x13')](function(){if(_0x154aef){return new Promise(function(_0x186e60){zipdir(path[_0x00d4('0x23')](_0x5863dd,_0x3bd844),{'saveTo':path[_0x00d4('0x23')](_0x5863dd,util['format'](_0x00d4('0x28'),_0x3bd844,_0x00d4('0x29')))},function(_0x4d53e4,_0x18866d){rimraf(path[_0x00d4('0x23')](_0x5863dd,_0x3bd844),function(){});_0x186e60(_0x00d4('0x2a'));});});}})[_0x00d4('0x13')](function(){logger[_0x00d4('0x2b')](util[_0x00d4('0xd')](_0x00d4('0x2c'),EXTRACTED_REPORT_ID,_0x00d4('0xf')));return analyticExtractedReport(_0x00d4('0x2d'),_0x154aef?util[_0x00d4('0xd')]('%s.%s',_0x3bd844,_0x154aef?_0x00d4('0x29'):_0x00d4('0x25')):null);});})[_0x00d4('0x2e')](function(_0x1c61fd){logger['info'](util[_0x00d4('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x00d4('0x2f')](_0x1c61fd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x00d4('0x30'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index f6ca413..d1f4279 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 _0x021f=['lodash','util','Interval','findAll','intervals','models','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','queue','playback','hasOwnProperty','priority','extensions','type','Set','format','CDR(type)=%s','VoiceExtensionId','inbound','push','CDR(routeid)=','context','extension','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite'];(function(_0x107a51,_0x35f56d){var _0x149234=function(_0x28575e){while(--_0x28575e){_0x107a51['push'](_0x107a51['shift']());}};_0x149234(++_0x35f56d);}(_0x021f,0x128));var _0xf021=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x021f[_0x3070dc];return _0x431489;};'use strict';var _=require(_0xf021('0x0'));var util=require(_0xf021('0x1'));function rewrite(_0x3c63a5,_0x49d069){var _0x4938fc=this;return _0x3c63a5['models'][_0xf021('0x2')][_0xf021('0x3')]({'raw':!![]})['then'](function(_0x2afb89){_0x4938fc[_0xf021('0x4')]=_0x2afb89;return _0x3c63a5[_0xf021('0x5')][_0xf021('0x6')][_0xf021('0x3')]({'where':{'IntervalId':_0x49d069[_0xf021('0x7')]},'raw':!![]});})['then'](function(_0x1c0faa){return _0x3c63a5[_0xf021('0x5')][_0xf021('0x6')][_0xf021('0x3')]({'where':{'exten':{'$in':_[_0xf021('0x8')](_[_0xf021('0x9')](_0x1c0faa,_0xf021('0xa')))}},'order':[{'raw':_0xf021('0xb')}],'raw':!![]});})[_0xf021('0xc')](function(_0x49d49f){var _0x2740c2=_[_0xf021('0xd')](_0x49d49f,{'priority':'1'});var _0x58b0a1=_[_0xf021('0xd')](_0x49d49f,{'isApp':0x1});var _0x42486b=_['groupBy'](_0x58b0a1,_0xf021('0xa'));var _0x390eef=[_0xf021('0xe'),_0xf021('0xf')];var _0x2cbfd0=[];var _0x3341b6=[];for(var _0x102ff1 in _0x42486b){if(_0x42486b[_0xf021('0x10')](_0x102ff1)){_0x4938fc[_0xf021('0x11')]=0x2;_0x4938fc[_0xf021('0x12')]=[];_0x4938fc['extension']=_['find'](_0x2740c2,{'exten':_0x42486b[_0x102ff1][0x0][_0xf021('0xa')]});_0x4938fc[_0xf021('0x12')]['push']({'type':_0x42486b[_0x102ff1][0x0][_0xf021('0x13')],'app':_0xf021('0x14'),'appdata':util[_0xf021('0x15')](_0xf021('0x16'),_0x42486b[_0x102ff1][0x0][_0xf021('0x13')]),'context':_0x42486b[_0x102ff1][0x0]['context'],'exten':_0x42486b[_0x102ff1][0x0][_0xf021('0xa')],'priority':_0x4938fc[_0xf021('0x11')]++,'VoiceExtensionId':_0x42486b[_0x102ff1][0x0][_0xf021('0x17')]});if(_0x42486b[_0x102ff1][0x0][_0xf021('0x13')]===_0xf021('0x18')){_0x4938fc[_0xf021('0x12')][_0xf021('0x19')]({'type':_0x42486b[_0x102ff1][0x0][_0xf021('0x13')],'app':'Set','appdata':_0xf021('0x1a')+_0x42486b[_0x102ff1][0x0][_0xf021('0x17')],'context':_0x42486b[_0x102ff1][0x0][_0xf021('0x1b')],'exten':_0x42486b[_0x102ff1][0x0][_0xf021('0xa')],'priority':_0x4938fc[_0xf021('0x11')]++,'VoiceExtensionId':_0x42486b[_0x102ff1][0x0][_0xf021('0x17')]});}else if(_0x42486b[_0x102ff1][0x0][_0xf021('0x13')]==='outbound'){if(_0x4938fc['extension']){_0x4938fc[_0xf021('0x12')][_0xf021('0x19')]({'type':_0x42486b[_0x102ff1][0x0]['type'],'app':_0xf021('0x14'),'appdata':'CDR(destination)='+(_0x4938fc[_0xf021('0x1c')][_0xf021('0x1d')]?_0xf021('0x1e')+_0x4938fc[_0xf021('0x1c')][_0xf021('0x1d')]+'}':_0xf021('0x1f')),'context':_0x42486b[_0x102ff1][0x0][_0xf021('0x1b')],'exten':_0x42486b[_0x102ff1][0x0][_0xf021('0xa')],'priority':_0x4938fc['priority']++,'VoiceExtensionId':_0x42486b[_0x102ff1][0x0][_0xf021('0x17')]});}_0x4938fc['extensions']['push']({'type':_0x42486b[_0x102ff1][0x0][_0xf021('0x13')],'app':_0xf021('0x14'),'appdata':'CDR(routeid)='+_0x42486b[_0x102ff1][0x0][_0xf021('0x17')],'context':_0x42486b[_0x102ff1][0x0]['context'],'exten':_0x42486b[_0x102ff1][0x0][_0xf021('0xa')],'priority':_0x4938fc['priority']++,'VoiceExtensionId':_0x42486b[_0x102ff1][0x0]['VoiceExtensionId']});var _0x4a3880=_0x4938fc[_0xf021('0x11')]++;_0x4938fc['extensions'][_0xf021('0x19')]({'type':_0x42486b[_0x102ff1][0x0][_0xf021('0x13')],'app':_0xf021('0x20'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4a3880+0x2)+_0xf021('0x21')+(_0x4a3880+0x1)+')','context':_0x42486b[_0x102ff1][0x0][_0xf021('0x1b')],'exten':_0x42486b[_0x102ff1][0x0][_0xf021('0xa')],'priority':_0x4a3880,'VoiceExtensionId':_0x42486b[_0x102ff1][0x0][_0xf021('0x17')]});if(_0x4938fc[_0xf021('0x1c')]){_0x4938fc[_0xf021('0x12')][_0xf021('0x19')]({'type':_0x42486b[_0x102ff1][0x0]['type'],'app':_0xf021('0x14'),'appdata':_0x4938fc[_0xf021('0x1c')]['cutdigits']?_0xf021('0x22')+_0x4938fc[_0xf021('0x1c')][_0xf021('0x1d')]+'}':_0xf021('0x23'),'context':_0x42486b[_0x102ff1][0x0][_0xf021('0x1b')],'exten':_0x42486b[_0x102ff1][0x0][_0xf021('0xa')],'priority':_0x4938fc[_0xf021('0x11')]++,'VoiceExtensionId':_0x42486b[_0x102ff1][0x0][_0xf021('0x17')]});}_0x4938fc['extensions'][_0xf021('0x19')]({'type':_0x42486b[_0x102ff1][0x0]['type'],'app':'Set','appdata':'outboundrouteid='+_0x42486b[_0x102ff1][0x0][_0xf021('0x17')],'context':_0x42486b[_0x102ff1][0x0]['context'],'exten':_0x42486b[_0x102ff1][0x0][_0xf021('0xa')],'priority':_0x4938fc[_0xf021('0x11')]++,'VoiceExtensionId':_0x42486b[_0x102ff1][0x0][_0xf021('0x17')]});if(_0x4938fc[_0xf021('0x1c')]&&_0x4938fc[_0xf021('0x1c')][_0xf021('0x10')]('recordingFormat')&&_0x4938fc[_0xf021('0x1c')][_0xf021('0x24')]!==_0xf021('0x25')){_0x4938fc['extensions'][_0xf021('0x19')]({'type':_0x42486b[_0x102ff1][0x0][_0xf021('0x13')],'app':_0xf021('0x14'),'appdata':_0xf021('0x26'),'context':_0x42486b[_0x102ff1][0x0][_0xf021('0x1b')],'exten':_0x42486b[_0x102ff1][0x0][_0xf021('0xa')],'priority':_0x4938fc[_0xf021('0x11')]++,'VoiceExtensionId':_0x42486b[_0x102ff1][0x0]['VoiceExtensionId']});_0x4938fc[_0xf021('0x12')]['push']({'type':_0x42486b[_0x102ff1][0x0][_0xf021('0x13')],'app':'Set','appdata':_0xf021('0x27')+_0x4938fc[_0xf021('0x1c')][_0xf021('0x24')]||_0xf021('0x28'),'context':_0x42486b[_0x102ff1][0x0][_0xf021('0x1b')],'exten':_0x42486b[_0x102ff1][0x0]['exten'],'priority':_0x4938fc[_0xf021('0x11')]++,'VoiceExtensionId':_0x42486b[_0x102ff1][0x0][_0xf021('0x17')]});}}_0x4938fc[_0xf021('0x12')]['push']({'type':_0x42486b[_0x102ff1][0x0]['type'],'app':_0xf021('0x14'),'appdata':_0xf021('0x29'),'context':_0x42486b[_0x102ff1][0x0]['context'],'exten':_0x42486b[_0x102ff1][0x0][_0xf021('0xa')],'priority':_0x4938fc[_0xf021('0x11')]++,'VoiceExtensionId':_0x42486b[_0x102ff1][0x0][_0xf021('0x17')]});_0x4938fc[_0xf021('0x12')][_0xf021('0x19')]({'type':_0x42486b[_0x102ff1][0x0][_0xf021('0x13')],'app':_0xf021('0x14'),'appdata':_0xf021('0x2a'),'context':_0x42486b[_0x102ff1][0x0][_0xf021('0x1b')],'exten':_0x42486b[_0x102ff1][0x0]['exten'],'priority':_0x4938fc['priority']++,'VoiceExtensionId':_0x42486b[_0x102ff1][0x0][_0xf021('0x17')]});_0x4938fc[_0xf021('0x12')][_0xf021('0x19')]({'type':_0x42486b[_0x102ff1][0x0][_0xf021('0x13')],'app':_0xf021('0x14'),'appdata':_0xf021('0x2b'),'context':_0x42486b[_0x102ff1][0x0][_0xf021('0x1b')],'exten':_0x42486b[_0x102ff1][0x0][_0xf021('0xa')],'priority':_0x4938fc[_0xf021('0x11')]++,'VoiceExtensionId':_0x42486b[_0x102ff1][0x0][_0xf021('0x17')]});for(var _0x563022=0x0,_0x1b650e=0x0;_0x563022<_0x42486b[_0x102ff1][_0xf021('0x2c')];_0x563022+=0x1,_0x1b650e=0x0){var _0x5eddbb=_0x42486b[_0x102ff1][_0x563022];if(_0x5eddbb['type']){_0x5eddbb[_0xf021('0x13')]=_0x5eddbb[_0xf021('0x13')]['toLowerCase']();}var _0x3310f1=[];var _0x353b30=[];delete _0x5eddbb['id'];delete _0x5eddbb[_0xf021('0x2d')];delete _0x5eddbb[_0xf021('0x2e')];var _0x1846e2=_0x5eddbb['interval']!==_0xf021('0x2f')?[_0x5eddbb[_0xf021('0x30')]]:_0x5eddbb[_0xf021('0x7')]?_[_0xf021('0x9')](_[_0xf021('0xd')](_0x4938fc['intervals'],{'IntervalId':_0x5eddbb['IntervalId']}),_0xf021('0x30')):[];if(_0x5eddbb['hasOwnProperty']('tag')){if(_0x5eddbb['tag']&&_0x5eddbb[_0xf021('0x31')]!=='--'){_0x3310f1[_0xf021('0x19')]({'type':_0x5eddbb[_0xf021('0x13')],'app':'Set','appdata':_0xf021('0x32')+_0x5eddbb[_0xf021('0x31')],'context':_0x5eddbb[_0xf021('0x1b')],'exten':_0x5eddbb['exten'],'priority':_0x1846e2[_0xf021('0x2c')]+_0x4938fc[_0xf021('0x11')]+_0x1b650e++,'VoiceExtensionId':_0x5eddbb[_0xf021('0x17')]});}}if(_0x5eddbb[_0xf021('0x13')]===_0xf021('0x33')&&_0x5eddbb[_0xf021('0x10')](_0xf021('0x34'))){if(_0x5eddbb[_0xf021('0x34')]){_0x3310f1['push']({'type':_0x5eddbb[_0xf021('0x13')],'app':_0xf021('0x20'),'appdata':_0xf021('0x35')+_0x5eddbb[_0xf021('0x34')]+')','context':_0x5eddbb[_0xf021('0x1b')],'exten':_0x5eddbb[_0xf021('0xa')],'priority':_0x1846e2[_0xf021('0x2c')]+_0x4938fc['priority']+_0x1b650e++,'VoiceExtensionId':_0x5eddbb['VoiceExtensionId']});}else{_0x3310f1['push']({'type':_0x5eddbb[_0xf021('0x13')],'app':'ExecIf','appdata':_0xf021('0x36'),'context':_0x5eddbb['context'],'exten':_0x5eddbb[_0xf021('0xa')],'priority':_0x1846e2['length']+_0x4938fc['priority']+_0x1b650e++,'VoiceExtensionId':_0x5eddbb[_0xf021('0x17')]});}}if(_0x5eddbb['hasOwnProperty'](_0xf021('0x37'))){if(_0x390eef[_0xf021('0x38')](_0x5eddbb[_0xf021('0x39')]['toLowerCase']())>=0x0&&_0x5eddbb['appType']!==_0xf021('0x3a')){if(_0x5eddbb[_0xf021('0x37')]){_0x3310f1[_0xf021('0x19')]({'type':_0x5eddbb['type'],'app':_0xf021('0x20'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x5eddbb[_0xf021('0x1b')],'exten':_0x5eddbb['exten'],'priority':_0x1846e2[_0xf021('0x2c')]+_0x4938fc[_0xf021('0x11')]+_0x1b650e++,'VoiceExtensionId':_0x5eddbb[_0xf021('0x17')]});_0x3310f1[_0xf021('0x19')]({'type':_0x5eddbb[_0xf021('0x13')],'app':'Set','appdata':_0xf021('0x3b'),'context':_0x5eddbb['context'],'exten':_0x5eddbb[_0xf021('0xa')],'priority':_0x1846e2[_0xf021('0x2c')]+_0x4938fc[_0xf021('0x11')]+_0x1b650e++,'VoiceExtensionId':_0x5eddbb['VoiceExtensionId']});}else{_0x3310f1[_0xf021('0x19')]({'type':_0x5eddbb[_0xf021('0x13')],'app':_0xf021('0x20'),'appdata':_0xf021('0x3c'),'context':_0x5eddbb[_0xf021('0x1b')],'exten':_0x5eddbb[_0xf021('0xa')],'priority':_0x1846e2[_0xf021('0x2c')]+_0x4938fc[_0xf021('0x11')]+_0x1b650e++,'VoiceExtensionId':_0x5eddbb['VoiceExtensionId']});_0x3310f1['push']({'type':_0x5eddbb['type'],'app':'Set','appdata':_0xf021('0x3d'),'context':_0x5eddbb['context'],'exten':_0x5eddbb[_0xf021('0xa')],'priority':_0x1846e2['length']+_0x4938fc['priority']+_0x1b650e++,'VoiceExtensionId':_0x5eddbb[_0xf021('0x17')]});}}}for(var _0x4439f2=0x0;_0x4439f2<_0x1846e2[_0xf021('0x2c')];_0x4439f2+=0x1){var _0x5efcf9=_0x4938fc[_0xf021('0x11')]+_0x1846e2[_0xf021('0x2c')];var _0x559fdf=_0x4439f2===_0x1846e2['length']-0x1?_0x4938fc[_0xf021('0x11')]+_0x3310f1[_0xf021('0x2c')]+_0x353b30['length']+0x2:_0x4938fc[_0xf021('0x11')]+_0x4439f2+0x1;_0x3310f1[_0xf021('0x3e')](_0x4439f2,0x0,{'type':_0x5eddbb[_0xf021('0x13')],'app':_0xf021('0x3f'),'appdata':_0x1846e2[_0x4439f2]+'?'+_0x5eddbb[_0xf021('0x1b')]+_0xf021('0x40')+_0x5efcf9+':'+_0x5eddbb[_0xf021('0x1b')]+_0xf021('0x40')+_0x559fdf,'exten':_0x5eddbb[_0xf021('0xa')],'context':_0x5eddbb[_0xf021('0x1b')],'priority':_0x4938fc[_0xf021('0x11')]+_0x4439f2,'VoiceExtensionId':_0x42486b[_0x102ff1][0x0][_0xf021('0x17')]});}_0x5eddbb[_0xf021('0x11')]=_0x3310f1[_0xf021('0x2c')]?_[_0xf021('0x41')](_0x3310f1)[_0xf021('0x11')]+0x1:_0x4938fc['priority'];_0x4938fc[_0xf021('0x11')]=(_0x353b30[_0xf021('0x2c')]?_['last'](_0x353b30)['priority']:_0x5eddbb[_0xf021('0x11')])+0x1;_0x4938fc[_0xf021('0x12')]=_[_0xf021('0x42')](_0x4938fc['extensions'],_0x3310f1,[_0x5eddbb],_0x353b30);}_0x4938fc[_0xf021('0x12')][_0xf021('0x19')]({'type':_0x42486b[_0x102ff1][0x0][_0xf021('0x13')],'app':_0xf021('0x43'),'exten':_0x42486b[_0x102ff1][0x0]['exten'],'context':_0x42486b[_0x102ff1][0x0][_0xf021('0x1b')],'priority':_0x4938fc[_0xf021('0x11')],'VoiceExtensionId':_0x42486b[_0x102ff1][0x0][_0xf021('0x17')]});_0x2cbfd0[_0xf021('0x19')](_0x42486b[_0x102ff1][0x0]['VoiceExtensionId']);_0x3341b6=_[_0xf021('0x42')](_0x3341b6,_0x4938fc[_0xf021('0x12')]);}}return _0x3c63a5['transaction'](function(_0x32448d){return _0x3c63a5['models'][_0xf021('0x6')][_0xf021('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x2cbfd0}},'transaction':_0x32448d})['then'](function(_0x20fd84){return _0x3c63a5[_0xf021('0x5')][_0xf021('0x6')][_0xf021('0x45')](_[_0xf021('0x46')](_0x3341b6,_0xf021('0x11')),{'transaction':_0x32448d});});});})[_0xf021('0x47')](function(_0x5afad0){console[_0xf021('0x48')](_0x5afad0);});}exports[_0xf021('0x49')]=rewrite; \ No newline at end of file +var _0xd866=['createdAt','interval','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','transaction','destroy','sortBy','catch','error','rewrite','util','models','Interval','intervals','VoiceExtension','findAll','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab'];(function(_0x3d2438,_0x2e7922){var _0xd18de5=function(_0xe8a130){while(--_0xe8a130){_0x3d2438['push'](_0x3d2438['shift']());}};_0xd18de5(++_0x2e7922);}(_0xd866,0x188));var _0x6d86=function(_0x4acf6f,_0x5072e5){_0x4acf6f=_0x4acf6f-0x0;var _0x3c6d3a=_0xd866[_0x4acf6f];return _0x3c6d3a;};'use strict';var _=require('lodash');var util=require(_0x6d86('0x0'));function rewrite(_0x16449b,_0x11e859){var _0x384a71=this;return _0x16449b[_0x6d86('0x1')][_0x6d86('0x2')]['findAll']({'raw':!![]})['then'](function(_0x415be2){_0x384a71[_0x6d86('0x3')]=_0x415be2;return _0x16449b[_0x6d86('0x1')][_0x6d86('0x4')][_0x6d86('0x5')]({'where':{'IntervalId':_0x11e859[_0x6d86('0x6')]},'raw':!![]});})['then'](function(_0x44292b){return _0x16449b['models']['VoiceExtension'][_0x6d86('0x5')]({'where':{'exten':{'$in':_[_0x6d86('0x7')](_[_0x6d86('0x8')](_0x44292b,_0x6d86('0x9')))}},'order':[{'raw':_0x6d86('0xa')}],'raw':!![]});})[_0x6d86('0xb')](function(_0x12e1cc){var _0xddcc57=_[_0x6d86('0xc')](_0x12e1cc,{'priority':'1'});var _0x4f88f3=_[_0x6d86('0xc')](_0x12e1cc,{'isApp':0x1});var _0x720731=_[_0x6d86('0xd')](_0x4f88f3,_0x6d86('0x9'));var _0x2d9b0b=[_0x6d86('0xe'),_0x6d86('0xf')];var _0x4e084a=[];var _0x1e08b1=[];for(var _0x36a1d3 in _0x720731){if(_0x720731[_0x6d86('0x10')](_0x36a1d3)){_0x384a71[_0x6d86('0x11')]=0x2;_0x384a71[_0x6d86('0x12')]=[];_0x384a71[_0x6d86('0x13')]=_[_0x6d86('0x14')](_0xddcc57,{'exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')]});_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':_0x6d86('0x17'),'appdata':util[_0x6d86('0x18')](_0x6d86('0x19'),_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')]),'context':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1a')],'exten':_0x720731[_0x36a1d3][0x0]['exten'],'priority':_0x384a71['priority']++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});if(_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')]===_0x6d86('0x1c')){_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0]['type'],'app':'Set','appdata':_0x6d86('0x1d')+_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')],'context':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1a')],'exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')],'priority':_0x384a71[_0x6d86('0x11')]++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});}else if(_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')]===_0x6d86('0x1e')){if(_0x384a71['extension']){_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':_0x6d86('0x17'),'appdata':'CDR(destination)='+(_0x384a71[_0x6d86('0x13')][_0x6d86('0x1f')]?_0x6d86('0x20')+_0x384a71[_0x6d86('0x13')]['cutdigits']+'}':'${EXTEN}'),'context':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1a')],'exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')],'priority':_0x384a71['priority']++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});}_0x384a71[_0x6d86('0x12')]['push']({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':_0x6d86('0x17'),'appdata':_0x6d86('0x1d')+_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')],'context':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1a')],'exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')],'priority':_0x384a71['priority']++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});var _0x25b600=_0x384a71['priority']++;_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':_0x6d86('0x21'),'appdata':_0x6d86('0x22')+(_0x25b600+0x2)+'):Goto('+(_0x25b600+0x1)+')','context':_0x720731[_0x36a1d3][0x0]['context'],'exten':_0x720731[_0x36a1d3][0x0]['exten'],'priority':_0x25b600,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});if(_0x384a71[_0x6d86('0x13')]){_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':'Set','appdata':_0x384a71[_0x6d86('0x13')][_0x6d86('0x1f')]?_0x6d86('0x23')+_0x384a71['extension'][_0x6d86('0x1f')]+'}':_0x6d86('0x24'),'context':_0x720731[_0x36a1d3][0x0]['context'],'exten':_0x720731[_0x36a1d3][0x0]['exten'],'priority':_0x384a71['priority']++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});}_0x384a71['extensions'][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0]['type'],'app':'Set','appdata':_0x6d86('0x25')+_0x720731[_0x36a1d3][0x0]['VoiceExtensionId'],'context':_0x720731[_0x36a1d3][0x0]['context'],'exten':_0x720731[_0x36a1d3][0x0]['exten'],'priority':_0x384a71[_0x6d86('0x11')]++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});if(_0x384a71['extension']&&_0x384a71[_0x6d86('0x13')][_0x6d86('0x10')](_0x6d86('0x26'))&&_0x384a71['extension'][_0x6d86('0x26')]!==_0x6d86('0x27')){_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':'Set','appdata':_0x6d86('0x28'),'context':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1a')],'exten':_0x720731[_0x36a1d3][0x0]['exten'],'priority':_0x384a71[_0x6d86('0x11')]++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0]['type'],'app':_0x6d86('0x17'),'appdata':_0x6d86('0x29')+_0x384a71[_0x6d86('0x13')][_0x6d86('0x26')]||_0x6d86('0x2a'),'context':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1a')],'exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')],'priority':_0x384a71[_0x6d86('0x11')]++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});}}_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':'Set','appdata':_0x6d86('0x2b'),'context':_0x720731[_0x36a1d3][0x0]['context'],'exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')],'priority':_0x384a71[_0x6d86('0x11')]++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':'Set','appdata':_0x6d86('0x2c'),'context':_0x720731[_0x36a1d3][0x0]['context'],'exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')],'priority':_0x384a71[_0x6d86('0x11')]++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});_0x384a71[_0x6d86('0x12')]['push']({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':'Set','appdata':_0x6d86('0x2d'),'context':_0x720731[_0x36a1d3][0x0]['context'],'exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')],'priority':_0x384a71['priority']++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});for(var _0x50eccf=0x0,_0x4f0fe8=0x0;_0x50eccf<_0x720731[_0x36a1d3]['length'];_0x50eccf+=0x1,_0x4f0fe8=0x0){var _0x43f00=_0x720731[_0x36a1d3][_0x50eccf];if(_0x43f00[_0x6d86('0x16')]){_0x43f00[_0x6d86('0x16')]=_0x43f00[_0x6d86('0x16')]['toLowerCase']();}var _0x5e0d2d=[];var _0x14aaff=[];delete _0x43f00['id'];delete _0x43f00[_0x6d86('0x2e')];delete _0x43f00['updatedAt'];var _0x2d3647=_0x43f00[_0x6d86('0x2f')]!=='*,*,*,*'?[_0x43f00[_0x6d86('0x2f')]]:_0x43f00[_0x6d86('0x6')]?_[_0x6d86('0x8')](_[_0x6d86('0xc')](_0x384a71[_0x6d86('0x3')],{'IntervalId':_0x43f00[_0x6d86('0x6')]}),_0x6d86('0x2f')):[];if(_0x43f00[_0x6d86('0x10')](_0x6d86('0x30'))){if(_0x43f00[_0x6d86('0x30')]&&_0x43f00[_0x6d86('0x30')]!=='--'){_0x5e0d2d['push']({'type':_0x43f00[_0x6d86('0x16')],'app':_0x6d86('0x17'),'appdata':_0x6d86('0x31')+_0x43f00['tag'],'context':_0x43f00[_0x6d86('0x1a')],'exten':_0x43f00[_0x6d86('0x9')],'priority':_0x2d3647[_0x6d86('0x32')]+_0x384a71['priority']+_0x4f0fe8++,'VoiceExtensionId':_0x43f00[_0x6d86('0x1b')]});}}if(_0x43f00[_0x6d86('0x16')]===_0x6d86('0x1e')&&_0x43f00[_0x6d86('0x10')]('callerID')){if(_0x43f00[_0x6d86('0x33')]){_0x5e0d2d[_0x6d86('0x15')]({'type':_0x43f00['type'],'app':_0x6d86('0x21'),'appdata':_0x6d86('0x34')+_0x43f00[_0x6d86('0x33')]+')','context':_0x43f00[_0x6d86('0x1a')],'exten':_0x43f00['exten'],'priority':_0x2d3647['length']+_0x384a71['priority']+_0x4f0fe8++,'VoiceExtensionId':_0x43f00['VoiceExtensionId']});}else{_0x5e0d2d[_0x6d86('0x15')]({'type':_0x43f00['type'],'app':_0x6d86('0x21'),'appdata':_0x6d86('0x35'),'context':_0x43f00[_0x6d86('0x1a')],'exten':_0x43f00[_0x6d86('0x9')],'priority':_0x2d3647['length']+_0x384a71[_0x6d86('0x11')]+_0x4f0fe8++,'VoiceExtensionId':_0x43f00[_0x6d86('0x1b')]});}}if(_0x43f00['hasOwnProperty'](_0x6d86('0x36'))){if(_0x2d9b0b[_0x6d86('0x37')](_0x43f00[_0x6d86('0x38')][_0x6d86('0x39')]())>=0x0&&_0x43f00[_0x6d86('0x3a')]!==_0x6d86('0x3b')){if(_0x43f00['answer']){_0x5e0d2d[_0x6d86('0x15')]({'type':_0x43f00['type'],'app':_0x6d86('0x21'),'appdata':_0x6d86('0x3c'),'context':_0x43f00[_0x6d86('0x1a')],'exten':_0x43f00['exten'],'priority':_0x2d3647['length']+_0x384a71[_0x6d86('0x11')]+_0x4f0fe8++,'VoiceExtensionId':_0x43f00[_0x6d86('0x1b')]});_0x5e0d2d[_0x6d86('0x15')]({'type':_0x43f00['type'],'app':_0x6d86('0x17'),'appdata':_0x6d86('0x3d'),'context':_0x43f00[_0x6d86('0x1a')],'exten':_0x43f00[_0x6d86('0x9')],'priority':_0x2d3647['length']+_0x384a71[_0x6d86('0x11')]+_0x4f0fe8++,'VoiceExtensionId':_0x43f00[_0x6d86('0x1b')]});}else{_0x5e0d2d[_0x6d86('0x15')]({'type':_0x43f00[_0x6d86('0x16')],'app':'ExecIf','appdata':_0x6d86('0x3e'),'context':_0x43f00[_0x6d86('0x1a')],'exten':_0x43f00['exten'],'priority':_0x2d3647['length']+_0x384a71[_0x6d86('0x11')]+_0x4f0fe8++,'VoiceExtensionId':_0x43f00[_0x6d86('0x1b')]});_0x5e0d2d[_0x6d86('0x15')]({'type':_0x43f00['type'],'app':_0x6d86('0x17'),'appdata':_0x6d86('0x3f'),'context':_0x43f00[_0x6d86('0x1a')],'exten':_0x43f00['exten'],'priority':_0x2d3647[_0x6d86('0x32')]+_0x384a71[_0x6d86('0x11')]+_0x4f0fe8++,'VoiceExtensionId':_0x43f00[_0x6d86('0x1b')]});}}}for(var _0x4dfc1d=0x0;_0x4dfc1d<_0x2d3647[_0x6d86('0x32')];_0x4dfc1d+=0x1){var _0x2ea319=_0x384a71[_0x6d86('0x11')]+_0x2d3647[_0x6d86('0x32')];var _0xb2778f=_0x4dfc1d===_0x2d3647[_0x6d86('0x32')]-0x1?_0x384a71[_0x6d86('0x11')]+_0x5e0d2d[_0x6d86('0x32')]+_0x14aaff[_0x6d86('0x32')]+0x2:_0x384a71[_0x6d86('0x11')]+_0x4dfc1d+0x1;_0x5e0d2d['splice'](_0x4dfc1d,0x0,{'type':_0x43f00['type'],'app':'GotoIfTime','appdata':_0x2d3647[_0x4dfc1d]+'?'+_0x43f00[_0x6d86('0x1a')]+_0x6d86('0x40')+_0x2ea319+':'+_0x43f00[_0x6d86('0x1a')]+_0x6d86('0x40')+_0xb2778f,'exten':_0x43f00['exten'],'context':_0x43f00['context'],'priority':_0x384a71['priority']+_0x4dfc1d,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});}_0x43f00['priority']=_0x5e0d2d[_0x6d86('0x32')]?_['last'](_0x5e0d2d)[_0x6d86('0x11')]+0x1:_0x384a71[_0x6d86('0x11')];_0x384a71[_0x6d86('0x11')]=(_0x14aaff[_0x6d86('0x32')]?_[_0x6d86('0x41')](_0x14aaff)[_0x6d86('0x11')]:_0x43f00['priority'])+0x1;_0x384a71[_0x6d86('0x12')]=_[_0x6d86('0x42')](_0x384a71[_0x6d86('0x12')],_0x5e0d2d,[_0x43f00],_0x14aaff);}_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':'Hangup','exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')],'context':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1a')],'priority':_0x384a71[_0x6d86('0x11')],'VoiceExtensionId':_0x720731[_0x36a1d3][0x0]['VoiceExtensionId']});_0x4e084a[_0x6d86('0x15')](_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]);_0x1e08b1=_[_0x6d86('0x42')](_0x1e08b1,_0x384a71[_0x6d86('0x12')]);}}return _0x16449b[_0x6d86('0x43')](function(_0x3328ce){return _0x16449b[_0x6d86('0x1')][_0x6d86('0x4')][_0x6d86('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x4e084a}},'transaction':_0x3328ce})[_0x6d86('0xb')](function(_0x14532f){return _0x16449b[_0x6d86('0x1')][_0x6d86('0x4')]['bulkCreate'](_[_0x6d86('0x45')](_0x1e08b1,_0x6d86('0x11')),{'transaction':_0x3328ce});});});})[_0x6d86('0x46')](function(_0x28b46f){console[_0x6d86('0x47')](_0x28b46f);});}exports[_0x6d86('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 0bf82c1..00279af 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 _0xb77f=['util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','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','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','select','field','NOW()','toString','updatedAt','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','id\x20IN\x20?','str','cm_hopper_final','cm_contacts','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','get','query','VoiceQueueId','catch','onlyIfOpen','sequelize','all','outbound','BlackLists','Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','message','Error\x20processing\x20rows\x20block:','finally','emit','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb77f,0x71));var _0xfb77=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb77f[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0xfb77('0x0'));var util=require(_0xfb77('0x1'));var _=require(_0xfb77('0x2'));var fs=require('fs');var squel=require(_0xfb77('0x3'));var Papa=require(_0xfb77('0x4'));var Redis=require(_0xfb77('0x5'));var db=require(_0xfb77('0x6'))['db'];var config=require(_0xfb77('0x7'));var logger=require('../../../config/logger')(_0xfb77('0x8'));config[_0xfb77('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfb77('0xa'))(new Redis(config[_0xfb77('0x9')]));require(_0xfb77('0xb'))[_0xfb77('0xc')](socket);try{if(!process[_0xfb77('0xd')][0x2]||process[_0xfb77('0xd')][0x2]===_0xfb77('0xe')||process['argv'][0x2]===_0xfb77('0xf')){throw new Error(_0xfb77('0x10'));}var FILEPATH=process[_0xfb77('0xd')][0x2];if(!process[_0xfb77('0xd')][0x3]||process['argv'][0x3]===_0xfb77('0xe')||process['argv'][0x3]==='null'||!process[_0xfb77('0xd')][0x4]||process[_0xfb77('0xd')][0x4]===_0xfb77('0xe')||process[_0xfb77('0xd')][0x4]===_0xfb77('0xf')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xfb77('0x11')](process[_0xfb77('0xd')][0x3][_0xfb77('0x12')](','),process[_0xfb77('0xd')][0x4]['split'](','));if(!process[_0xfb77('0xd')][0x5]||process['argv'][0x5]===_0xfb77('0xe')||process[_0xfb77('0xd')][0x5]===_0xfb77('0xf')){throw new Error(_0xfb77('0x13'));}var LISTID=process[_0xfb77('0xd')][0x5];var COMPANYID=process[_0xfb77('0xd')][0x6]&&process[_0xfb77('0xd')][0x6]!==_0xfb77('0xe')&&process['argv'][0x6]!==_0xfb77('0xf')?process[_0xfb77('0xd')][0x6]:null;var DUPLICATES=process[_0xfb77('0xd')][0x7]&&process['argv'][0x7]!==_0xfb77('0xe')&&process[_0xfb77('0xd')][0x7]!==_0xfb77('0xf')?process[_0xfb77('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0xfb77('0xd')][0x8]===_0xfb77('0xe')||process[_0xfb77('0xd')][0x8]==='null'){throw new Error(_0xfb77('0x14'));}var SOCKET_TIMESTAMP=process[_0xfb77('0xd')][0x8];}catch(_0x185071){logger[_0xfb77('0x15')](_0x185071);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(_0x5e7124,_0x3e29b7,_0x5c5069,_0x1af3f7){var _0xc82889={'message':_0x3e29b7};_0xc82889[_0x5e7124]=!![];if(_0x5c5069){_0xc82889[_0xfb77('0x16')]=_0x5c5069;}if(_0x1af3f7){_0xc82889[_0xfb77('0x17')]=_0x1af3f7;}return _0xc82889;}function isEmail(_0x26a26f){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))*$/[_0xfb77('0x18')](_0x26a26f);}function checkRow(_0xa19dc9,_0x502093,_0x17cadb){return new BPromise(function(_0x94faf8,_0x4ef553){if(_[_0xfb77('0x19')](_0xa19dc9)){return _0x4ef553(handleCheckRowError(_0xfb77('0x15'),_0xfb77('0x1a'),null,_0x17cadb));}if(_0xa19dc9[_0xfb77('0x1b')]&&_0xa19dc9['errors'][_0xfb77('0x1c')]){var _0x2c9583=_[_0xfb77('0x1d')](_0xa19dc9[_0xfb77('0x1b')],'message')[_0xfb77('0x1e')](';');return _0x4ef553(handleCheckRowError('error',_0x2c9583,null,_0x17cadb));}var _0x1de4f3={};for(var _0x20af30 in FIELDS){if(FIELDS[_0xfb77('0x1f')](_0x20af30)&&FIELDS[_0x20af30]){_0x1de4f3[_0x20af30]=_0xa19dc9[_0xfb77('0x20')][0x0][FIELDS[_0x20af30]]||_0xa19dc9[_0xfb77('0x20')][0x0]['\ufeff'+FIELDS[_0x20af30]];}}if(!_0x1de4f3[_0xfb77('0x21')]){return _0x4ef553(handleCheckRowError('error',_0xfb77('0x22'),null,_0x17cadb));}if(!_0x1de4f3[_0xfb77('0x23')]){return _0x4ef553(handleCheckRowError(_0xfb77('0x15'),_0xfb77('0x24'),null,_0x17cadb));}if(_0x1de4f3[_0xfb77('0x25')]){var _0xfedba1=moment(_0x1de4f3['birthDate'],_0xfb77('0x26'));if(!_0xfedba1[_0xfb77('0x27')]()){return _0x4ef553(handleCheckRowError(_0xfb77('0x15'),_0xfb77('0x28'),null,_0x17cadb));}}if(_0x1de4f3[_0xfb77('0x29')]){if(!isEmail(_0x1de4f3[_0xfb77('0x29')])){return _0x4ef553(handleCheckRowError(_0xfb77('0x15'),'email\x20format\x20is\x20not\x20valid!',null,_0x17cadb));}}_0x1de4f3[_0xfb77('0x2a')]=LISTID;_0x1de4f3[_0xfb77('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xfb77('0x1c')]&&_0x502093){var _0x3176d4={};for(var _0x2850a7=0x0,_0x5e6e7f=DUPLICATES[_0xfb77('0x1c')];_0x2850a7<_0x5e6e7f;_0x2850a7+=0x1){_0x3176d4[DUPLICATES[_0x2850a7]]=_0x1de4f3[DUPLICATES[_0x2850a7]];}var _0x5336af=_[_0xfb77('0x2c')](_0x502093,_0x3176d4);if(_0x5336af){return _0x4ef553(handleCheckRowError(_0xfb77('0x2d'),_0xfb77('0x2e'),_0x5336af,_0x17cadb));}}return db['CmContact']['create'](_0x1de4f3,{'raw':!![],'hooks':![],'fields':_[_0xfb77('0x2f')](_0x1de4f3)})[_0xfb77('0x30')](function(_0xf1433){if(DUPLICATES&&DUPLICATES[_0xfb77('0x1c')]&&_0x502093){_0x502093[_0xfb77('0x31')](_[_0xfb77('0x32')](_0x1de4f3,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xf1433['id'];return _0x94faf8();})['catch'](function(_0x331914){return _0x4ef553(handleCheckRowError(_0xfb77('0x15'),_0xfb77('0x33')+(_0x331914['message']||JSON[_0xfb77('0x34')](_0x331914)),null,_0x17cadb));});});}function checkHopper(){function _0x102214(){return function(_0x2237c8){logger[_0xfb77('0x15')](_0xfb77('0x35'),_0xfb77('0x36'),util[_0xfb77('0x37')](_0x2237c8,{'showHidden':![],'depth':null}));};}var _0x4952d1=function(_0x5417f2,_0x178f3c){var _0x342ef5=squel['insert']()[_0xfb77('0x38')](_0xfb77('0x39'))[_0xfb77('0x3a')]([_0xfb77('0x23'),_0xfb77('0x3b'),_0xfb77('0x3c'),_0xfb77('0x2a'),_0x178f3c,_0xfb77('0x3d'),'updatedAt'],squel[_0xfb77('0x3e')]()[_0xfb77('0x3f')](_0xfb77('0x23'),_0xfb77('0x23'))[_0xfb77('0x3f')](_0xfb77('0x40'),_0xfb77('0x3b'))[_0xfb77('0x3f')]('id',_0xfb77('0x3c'))[_0xfb77('0x3f')](LISTID[_0xfb77('0x41')](),'ListId')[_0xfb77('0x3f')](_0x5417f2['id'][_0xfb77('0x41')](),_0x178f3c)[_0xfb77('0x3f')](_0xfb77('0x40'),_0xfb77('0x3d'))[_0xfb77('0x3f')]('NOW()',_0xfb77('0x42'))[_0xfb77('0x43')]('cm_contacts')[_0xfb77('0x44')](_0xfb77('0x45'))[_0xfb77('0x44')](_0xfb77('0x46'),LISTID[_0xfb77('0x41')]())[_0xfb77('0x44')](_0xfb77('0x47'))[_0xfb77('0x44')](_0xfb77('0x48'),squel['select']()['field'](_0xfb77('0x23'))['from'](_0xfb77('0x39'))[_0xfb77('0x44')](_0x178f3c+_0xfb77('0x49'),_0x5417f2['id'][_0xfb77('0x41')]())))['toString']();return _0x342ef5;};var _0x2316b4=function(_0xdf6306,_0x7a33e2){var _0x3168da=squel[_0xfb77('0x4a')]()[_0xfb77('0x38')](_0xfb77('0x39'))[_0xfb77('0x3a')]([_0xfb77('0x23'),'scheduledAt',_0xfb77('0x3c'),_0xfb77('0x2a'),_0x7a33e2,_0xfb77('0x3d'),_0xfb77('0x42')],squel['select']()[_0xfb77('0x3f')](_0xfb77('0x23'),'phone')[_0xfb77('0x3f')](_0xfb77('0x40'),'scheduledAt')[_0xfb77('0x3f')]('id',_0xfb77('0x3c'))[_0xfb77('0x3f')](LISTID['toString'](),'ListId')[_0xfb77('0x3f')](_0xdf6306['id']['toString'](),_0x7a33e2)[_0xfb77('0x3f')](_0xfb77('0x40'),'createdAt')[_0xfb77('0x3f')](_0xfb77('0x40'),_0xfb77('0x42'))[_0xfb77('0x43')]('cm_contacts')[_0xfb77('0x44')]('deletedAt\x20IS\x20NULL')[_0xfb77('0x44')](_0xfb77('0x46'),LISTID[_0xfb77('0x41')]())[_0xfb77('0x44')](_0xfb77('0x4b'),squel[_0xfb77('0x4c')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0xfb77('0x44')](_0xfb77('0x48'),squel[_0xfb77('0x3e')]()[_0xfb77('0x3f')]('calleridnum')[_0xfb77('0x43')](_0xfb77('0x4d'))[_0xfb77('0x44')](_0x7a33e2+'\x20=\x20?',_0xdf6306['id']['toString']()))[_0xfb77('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0xfb77('0x3e')]()[_0xfb77('0x3f')](_0xfb77('0x23'))['from'](_0xfb77('0x39'))[_0xfb77('0x44')](_0x7a33e2+_0xfb77('0x49'),_0xdf6306['id'][_0xfb77('0x41')]())))['toString']();return _0x3168da;};function _0x43a394(_0x10b394,_0x464d1c){var _0x5d8486=squel[_0xfb77('0x4a')]()['into']('cm_hopper')['fromQuery']([_0xfb77('0x23'),_0xfb77('0x3b'),_0xfb77('0x3c'),_0xfb77('0x2a'),_0x464d1c,_0xfb77('0x3d'),'updatedAt'],squel[_0xfb77('0x3e')]()['field'](_0xfb77('0x23'),_0xfb77('0x23'))[_0xfb77('0x3f')](_0xfb77('0x40'),_0xfb77('0x3b'))[_0xfb77('0x3f')]('id',_0xfb77('0x3c'))[_0xfb77('0x3f')](LISTID[_0xfb77('0x41')](),_0xfb77('0x2a'))['field'](_0x10b394['id'][_0xfb77('0x41')](),_0x464d1c)['field'](_0xfb77('0x40'),_0xfb77('0x3d'))[_0xfb77('0x3f')](_0xfb77('0x40'),_0xfb77('0x42'))[_0xfb77('0x43')](_0xfb77('0x4e'))[_0xfb77('0x44')]('deletedAt\x20IS\x20NULL')[_0xfb77('0x44')](_0xfb77('0x46'),LISTID['toString']())[_0xfb77('0x44')](_0xfb77('0x4b'),squel[_0xfb77('0x4c')](hopperContacts))[_0xfb77('0x44')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x5d8486;}function _0xfc22a4(_0x452623,_0x489d8a){var _0x172711=squel[_0xfb77('0x4a')]()[_0xfb77('0x38')](_0xfb77('0x4f'))[_0xfb77('0x3a')]([_0xfb77('0x23'),'ContactId',_0xfb77('0x2a'),_0x489d8a,_0xfb77('0x3d'),_0xfb77('0x42')],squel[_0xfb77('0x3e')]()[_0xfb77('0x3f')](_0xfb77('0x23'),_0xfb77('0x23'))[_0xfb77('0x3f')]('id','ContactId')[_0xfb77('0x3f')](LISTID[_0xfb77('0x41')](),_0xfb77('0x2a'))[_0xfb77('0x3f')](_0x452623['id']['toString'](),_0x489d8a)[_0xfb77('0x3f')](_0xfb77('0x40'),_0xfb77('0x3d'))['field'](_0xfb77('0x40'),'updatedAt')[_0xfb77('0x43')]('cm_contacts')[_0xfb77('0x44')](_0xfb77('0x45'))[_0xfb77('0x44')](_0xfb77('0x46'),LISTID[_0xfb77('0x41')]())[_0xfb77('0x44')](_0xfb77('0x4b'),squel[_0xfb77('0x4c')](hopperContacts))[_0xfb77('0x44')](_0xfb77('0x47')))[_0xfb77('0x41')]();return _0x172711;}return db[_0xfb77('0x50')][_0xfb77('0x51')]({'where':{'type':'outbound'},'attributes':['id',_0xfb77('0x52')],'include':[{'model':db[_0xfb77('0x53')],'as':_0xfb77('0x54'),'where':{'id':LISTID}}]})[_0xfb77('0x30')](function(_0x129567){var _0x5ac01c=[];if(_0x129567){var _0x36c5eb;for(var _0x29be9f=0x0,_0x28a89f;_0x29be9f<_0x129567[_0xfb77('0x1c')];_0x29be9f+=0x1){_0x28a89f=_0x129567[_0x29be9f][_0xfb77('0x55')]({'plain':!![]});switch(_0x28a89f[_0xfb77('0x52')]){case'always':_0x5ac01c[_0xfb77('0x31')](db['sequelize'][_0xfb77('0x56')](_0x2316b4(_0x28a89f,_0xfb77('0x57')))[_0xfb77('0x30')](function(){})[_0xfb77('0x58')](_0x102214()));break;case _0xfb77('0x59'):_0x5ac01c[_0xfb77('0x31')](db[_0xfb77('0x5a')][_0xfb77('0x56')](_0x4952d1(_0x28a89f,'VoiceQueueId'))[_0xfb77('0x30')](function(){})[_0xfb77('0x58')](_0x102214()));break;default:_0x5ac01c[_0xfb77('0x31')](db['sequelize'][_0xfb77('0x56')](_0x43a394(_0x28a89f,_0xfb77('0x57')))['then'](function(){})[_0xfb77('0x58')](_0x102214()));}}}return _0x5ac01c;})[_0xfb77('0x5b')]()['then'](function(){return db[_0xfb77('0x50')][_0xfb77('0x51')]({'where':{'type':_0xfb77('0x5c')},'attributes':['id'],'include':[{'model':db[_0xfb77('0x53')],'as':_0xfb77('0x5d'),'where':{'id':LISTID}}]})[_0xfb77('0x30')](function(_0x3107a6){var _0x1cf1dc=[];if(_0x3107a6){var _0x59cbd2;for(var _0x2217d3=0x0,_0x238a72;_0x2217d3<_0x3107a6[_0xfb77('0x1c')];_0x2217d3+=0x1){_0x238a72=_0x3107a6[_0x2217d3]['get']({'plain':!![]});_0x1cf1dc[_0xfb77('0x31')](db['sequelize']['query'](_0xfc22a4(_0x238a72,'VoiceQueueId'))[_0xfb77('0x30')](function(){})[_0xfb77('0x58')](_0x102214()));}}return _0x1cf1dc;})[_0xfb77('0x5b')]();})[_0xfb77('0x30')](function(){return db[_0xfb77('0x5e')][_0xfb77('0x51')]({'attributes':['id',_0xfb77('0x52')],'include':[{'model':db[_0xfb77('0x53')],'as':_0xfb77('0x54'),'where':{'id':LISTID}}]})[_0xfb77('0x30')](function(_0x339a17){var _0x2d0199=[];if(_0x339a17){for(var _0x321b2c=0x0,_0x12e7fe;_0x321b2c<_0x339a17[_0xfb77('0x1c')];_0x321b2c+=0x1){_0x12e7fe=_0x339a17[_0x321b2c][_0xfb77('0x55')]({'plain':!![]});switch(_0x12e7fe['dialCheckDuplicateType']){case _0xfb77('0x5f'):_0x2d0199['push'](db[_0xfb77('0x5a')][_0xfb77('0x56')](_0x2316b4(_0x12e7fe,_0xfb77('0x60')))['then'](function(){})['catch'](_0x102214()));break;case _0xfb77('0x59'):_0x2d0199['push'](db['sequelize'][_0xfb77('0x56')](_0x4952d1(_0x12e7fe,'CampaignId'))['then'](function(){})[_0xfb77('0x58')](_0x102214()));break;default:_0x2d0199['push'](db[_0xfb77('0x5a')][_0xfb77('0x56')](_0x43a394(_0x12e7fe,_0xfb77('0x60')))[_0xfb77('0x30')](function(){})[_0xfb77('0x58')](_0x102214()));}}}return _0x2d0199;})['all']();})[_0xfb77('0x30')](function(){return db['Campaign'][_0xfb77('0x51')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xfb77('0x5d'),'where':{'id':LISTID}}]})[_0xfb77('0x30')](function(_0x5eeb3b){var _0x2ff18c=[];if(_0x5eeb3b){for(var _0x5528df=0x0,_0x17d493;_0x5528df<_0x5eeb3b[_0xfb77('0x1c')];_0x5528df+=0x1){_0x17d493=_0x5eeb3b[_0x5528df][_0xfb77('0x55')]({'plain':!![]});_0x2ff18c[_0xfb77('0x31')](db[_0xfb77('0x5a')][_0xfb77('0x56')](_0xfc22a4(_0x17d493,_0xfb77('0x60')))['then'](function(){})['catch'](_0x102214()));}}return _0x2ff18c;})['all']();})['catch'](function(_0x3fc8f9){logger[_0xfb77('0x15')](_0xfb77('0x61'),_0xfb77('0x62'),_0x3fc8f9[_0xfb77('0x63')]);});}var processPromises=function(_0x5175fa){return BPromise[_0xfb77('0x5b')](promises)[_0xfb77('0x30')](function(_0x248986){})[_0xfb77('0x58')](function(_0xad6d15){logger['error'](_0xfb77('0x64'),JSON[_0xfb77('0x34')](_0xad6d15));})[_0xfb77('0x65')](function(){socket[_0xfb77('0x66')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5175fa){return _0x5175fa['resume']();}});};var endCsv=function(){return BPromise[_0xfb77('0x67')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xfb77('0x30')](function(){socket[_0xfb77('0x66')](_0xfb77('0x68')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xfb77('0x69')](FILEPATH);}catch(_0x45ea5b){logger[_0xfb77('0x15')](_0xfb77('0x6a'),JSON[_0xfb77('0x34')](_0x45ea5b));}finally{process['exit'](0x0);}});};process['on'](_0xfb77('0x6b'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xfb77('0x67')]()[_0xfb77('0x30')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xfb77('0x6c')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xfb77('0x30')](function(_0x20c9fb){var _0x36d246=fs[_0xfb77('0x6d')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xfb77('0x6e')](_0x36d246,{'header':!![],'skipEmptyLines':!![],'step':function(_0x54cc63,_0x55a7e8){total+=0x1;var _0x57f93f=total;promises['push'](checkRow(_0x54cc63,_0x20c9fb,_0x57f93f)[_0xfb77('0x30')](function(){success+=0x1;})['catch'](function(_0x517928){if(_0x517928[_0xfb77('0x15')]){errors+=0x1;delete _0x517928[_0xfb77('0x15')];}else if(_0x517928[_0xfb77('0x2d')]){duplicates+=0x1;delete _0x517928[_0xfb77('0x2d')];}rows['push'](_0x517928);}));if(total%0xc8===0x0){_0x55a7e8[_0xfb77('0x6f')]();return processPromises(_0x55a7e8);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0xfb77('0x70'));endCsv();});},'error':function(_0x32421b,_0x279756){logger['info'](_0xfb77('0x71'),JSON[_0xfb77('0x34')](_0x32421b));endCsv();}});})[_0xfb77('0x58')](function(_0x4e3e09){logger[_0xfb77('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xfb77('0x34')](_0x4e3e09));});}main(); \ No newline at end of file +var _0x12a3=['into','cm_hopper','fromQuery','phone','ContactId','updatedAt','select','field','NOW()','toString','createdAt','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','scheduledAt','from','str','calleridnum','id\x20IN\x20?','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','get','always','push','query','VoiceQueueId','sequelize','catch','all','VoiceQueue','Campaign','Lists','CampaignId','CmList','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','parse','pause','info','bluebird','util','squel','papaparse','ioredis','../../../config/environment','api','redis','defaults','localhost','../../../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','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','then','stringify','cmContact','checkHopper','inspect','insert'];(function(_0x3760f1,_0x498373){var _0x14d886=function(_0x104123){while(--_0x104123){_0x3760f1['push'](_0x3760f1['shift']());}};_0x14d886(++_0x498373);}(_0x12a3,0x1d5));var _0x312a=function(_0x5454ad,_0x47ed68){_0x5454ad=_0x5454ad-0x0;var _0x398aff=_0x12a3[_0x5454ad];return _0x398aff;};'use strict';var BPromise=require(_0x312a('0x0'));var util=require(_0x312a('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x312a('0x2'));var Papa=require(_0x312a('0x3'));var Redis=require(_0x312a('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x312a('0x5'));var logger=require('../../../config/logger')(_0x312a('0x6'));config[_0x312a('0x7')]=_[_0x312a('0x8')](config[_0x312a('0x7')],{'host':_0x312a('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x312a('0x7')]));require(_0x312a('0xa'))['register'](socket);try{if(!process[_0x312a('0xb')][0x2]||process[_0x312a('0xb')][0x2]===_0x312a('0xc')||process[_0x312a('0xb')][0x2]===_0x312a('0xd')){throw new Error(_0x312a('0xe'));}var FILEPATH=process[_0x312a('0xb')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]==='undefined'||process['argv'][0x3]===_0x312a('0xd')||!process[_0x312a('0xb')][0x4]||process[_0x312a('0xb')][0x4]===_0x312a('0xc')||process[_0x312a('0xb')][0x4]===_0x312a('0xd')){throw new Error(_0x312a('0xf'));}var FIELDS=_[_0x312a('0x10')](process[_0x312a('0xb')][0x3][_0x312a('0x11')](','),process[_0x312a('0xb')][0x4]['split'](','));if(!process[_0x312a('0xb')][0x5]||process['argv'][0x5]===_0x312a('0xc')||process[_0x312a('0xb')][0x5]===_0x312a('0xd')){throw new Error(_0x312a('0x12'));}var LISTID=process[_0x312a('0xb')][0x5];var COMPANYID=process[_0x312a('0xb')][0x6]&&process[_0x312a('0xb')][0x6]!=='undefined'&&process[_0x312a('0xb')][0x6]!==_0x312a('0xd')?process[_0x312a('0xb')][0x6]:null;var DUPLICATES=process[_0x312a('0xb')][0x7]&&process['argv'][0x7]!=='undefined'&&process['argv'][0x7]!==_0x312a('0xd')?process[_0x312a('0xb')][0x7]:null;if(!process[_0x312a('0xb')][0x8]||process[_0x312a('0xb')][0x8]===_0x312a('0xc')||process['argv'][0x8]===_0x312a('0xd')){throw new Error(_0x312a('0x13'));}var SOCKET_TIMESTAMP=process[_0x312a('0xb')][0x8];}catch(_0x55a730){logger[_0x312a('0x14')](_0x55a730);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(_0x5c0b94,_0x1c3ff3,_0x128673,_0x5827c4){var _0x10fa84={'message':_0x1c3ff3};_0x10fa84[_0x5c0b94]=!![];if(_0x128673){_0x10fa84[_0x312a('0x15')]=_0x128673;}if(_0x5827c4){_0x10fa84[_0x312a('0x16')]=_0x5827c4;}return _0x10fa84;}function isEmail(_0x4e18e2){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))*$/[_0x312a('0x17')](_0x4e18e2);}function checkRow(_0x15ccda,_0x331d33,_0x1b6b38){return new BPromise(function(_0x2bdf09,_0x21882d){if(_[_0x312a('0x18')](_0x15ccda)){return _0x21882d(handleCheckRowError(_0x312a('0x14'),_0x312a('0x19'),null,_0x1b6b38));}if(_0x15ccda[_0x312a('0x1a')]&&_0x15ccda[_0x312a('0x1a')][_0x312a('0x1b')]){var _0x503124=_[_0x312a('0x1c')](_0x15ccda[_0x312a('0x1a')],_0x312a('0x1d'))[_0x312a('0x1e')](';');return _0x21882d(handleCheckRowError(_0x312a('0x14'),_0x503124,null,_0x1b6b38));}var _0x286a7e={};for(var _0x2a106a in FIELDS){if(FIELDS['hasOwnProperty'](_0x2a106a)&&FIELDS[_0x2a106a]){_0x286a7e[_0x2a106a]=_0x15ccda['data'][0x0][FIELDS[_0x2a106a]]||_0x15ccda['data'][0x0]['\ufeff'+FIELDS[_0x2a106a]];}}if(!_0x286a7e[_0x312a('0x1f')]){return _0x21882d(handleCheckRowError('error',_0x312a('0x20'),null,_0x1b6b38));}if(!_0x286a7e['phone']){return _0x21882d(handleCheckRowError('error',_0x312a('0x21'),null,_0x1b6b38));}if(_0x286a7e[_0x312a('0x22')]){var _0x37de07=moment(_0x286a7e[_0x312a('0x22')],_0x312a('0x23'));if(!_0x37de07['isValid']()){return _0x21882d(handleCheckRowError(_0x312a('0x14'),_0x312a('0x24'),null,_0x1b6b38));}}if(_0x286a7e[_0x312a('0x25')]){if(!isEmail(_0x286a7e[_0x312a('0x25')])){return _0x21882d(handleCheckRowError(_0x312a('0x14'),'email\x20format\x20is\x20not\x20valid!',null,_0x1b6b38));}}_0x286a7e[_0x312a('0x26')]=LISTID;_0x286a7e[_0x312a('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x312a('0x1b')]&&_0x331d33){var _0x4ca72f={};for(var _0x54cfc7=0x0,_0x2bdcc7=DUPLICATES[_0x312a('0x1b')];_0x54cfc7<_0x2bdcc7;_0x54cfc7+=0x1){_0x4ca72f[DUPLICATES[_0x54cfc7]]=_0x286a7e[DUPLICATES[_0x54cfc7]];}var _0x4d0190=_[_0x312a('0x28')](_0x331d33,_0x4ca72f);if(_0x4d0190){return _0x21882d(handleCheckRowError(_0x312a('0x29'),_0x312a('0x2a'),_0x4d0190,_0x1b6b38));}}return db[_0x312a('0x2b')]['create'](_0x286a7e,{'raw':!![],'hooks':![],'fields':_[_0x312a('0x2c')](_0x286a7e)})[_0x312a('0x2d')](function(_0x15e681){if(DUPLICATES&&DUPLICATES[_0x312a('0x1b')]&&_0x331d33){_0x331d33['push'](_['pick'](_0x286a7e,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x15e681['id'];return _0x2bdf09();})['catch'](function(_0x468d70){return _0x21882d(handleCheckRowError(_0x312a('0x14'),'Error\x20while\x20creating\x20contact:\x20'+(_0x468d70[_0x312a('0x1d')]||JSON[_0x312a('0x2e')](_0x468d70)),null,_0x1b6b38));});});}function checkHopper(){function _0x43eb52(){return function(_0x2fdc40){logger[_0x312a('0x14')](_0x312a('0x2f'),_0x312a('0x30'),util[_0x312a('0x31')](_0x2fdc40,{'showHidden':![],'depth':null}));};}var _0x5ed282=function(_0x1086f2,_0x581824){var _0x5a8585=squel[_0x312a('0x32')]()[_0x312a('0x33')](_0x312a('0x34'))[_0x312a('0x35')]([_0x312a('0x36'),'scheduledAt',_0x312a('0x37'),_0x312a('0x26'),_0x581824,'createdAt',_0x312a('0x38')],squel[_0x312a('0x39')]()[_0x312a('0x3a')](_0x312a('0x36'),_0x312a('0x36'))[_0x312a('0x3a')](_0x312a('0x3b'),'scheduledAt')[_0x312a('0x3a')]('id',_0x312a('0x37'))[_0x312a('0x3a')](LISTID['toString'](),'ListId')[_0x312a('0x3a')](_0x1086f2['id'][_0x312a('0x3c')](),_0x581824)[_0x312a('0x3a')](_0x312a('0x3b'),_0x312a('0x3d'))[_0x312a('0x3a')](_0x312a('0x3b'),_0x312a('0x38'))['from'](_0x312a('0x3e'))[_0x312a('0x3f')](_0x312a('0x40'))['where'](_0x312a('0x41'),LISTID[_0x312a('0x3c')]())['where'](_0x312a('0x42'))[_0x312a('0x3f')](_0x312a('0x43'),squel[_0x312a('0x39')]()['field'](_0x312a('0x36'))['from'](_0x312a('0x34'))[_0x312a('0x3f')](_0x581824+_0x312a('0x44'),_0x1086f2['id'][_0x312a('0x3c')]())))[_0x312a('0x3c')]();return _0x5a8585;};var _0x45a85a=function(_0x201b87,_0x59248a){var _0x128b76=squel[_0x312a('0x32')]()[_0x312a('0x33')](_0x312a('0x34'))['fromQuery']([_0x312a('0x36'),_0x312a('0x45'),_0x312a('0x37'),'ListId',_0x59248a,_0x312a('0x3d'),_0x312a('0x38')],squel[_0x312a('0x39')]()[_0x312a('0x3a')](_0x312a('0x36'),_0x312a('0x36'))['field'](_0x312a('0x3b'),_0x312a('0x45'))[_0x312a('0x3a')]('id','ContactId')[_0x312a('0x3a')](LISTID['toString'](),_0x312a('0x26'))[_0x312a('0x3a')](_0x201b87['id']['toString'](),_0x59248a)['field'](_0x312a('0x3b'),_0x312a('0x3d'))[_0x312a('0x3a')](_0x312a('0x3b'),'updatedAt')[_0x312a('0x46')](_0x312a('0x3e'))['where'](_0x312a('0x40'))[_0x312a('0x3f')](_0x312a('0x41'),LISTID['toString']())[_0x312a('0x3f')]('id\x20IN\x20?',squel[_0x312a('0x47')](hopperContacts))[_0x312a('0x3f')](_0x312a('0x42'))[_0x312a('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x312a('0x48'))['from']('cm_hopper_final')[_0x312a('0x3f')](_0x59248a+'\x20=\x20?',_0x201b87['id'][_0x312a('0x3c')]()))[_0x312a('0x3f')](_0x312a('0x43'),squel[_0x312a('0x39')]()[_0x312a('0x3a')](_0x312a('0x36'))[_0x312a('0x46')](_0x312a('0x34'))['where'](_0x59248a+_0x312a('0x44'),_0x201b87['id'][_0x312a('0x3c')]())))['toString']();return _0x128b76;};function _0x23dd81(_0x595fa0,_0x78f317){var _0x52471d=squel[_0x312a('0x32')]()[_0x312a('0x33')](_0x312a('0x34'))['fromQuery'](['phone',_0x312a('0x45'),'ContactId','ListId',_0x78f317,_0x312a('0x3d'),'updatedAt'],squel[_0x312a('0x39')]()['field'](_0x312a('0x36'),_0x312a('0x36'))[_0x312a('0x3a')]('NOW()',_0x312a('0x45'))[_0x312a('0x3a')]('id',_0x312a('0x37'))[_0x312a('0x3a')](LISTID[_0x312a('0x3c')](),_0x312a('0x26'))[_0x312a('0x3a')](_0x595fa0['id'][_0x312a('0x3c')](),_0x78f317)['field']('NOW()',_0x312a('0x3d'))[_0x312a('0x3a')]('NOW()',_0x312a('0x38'))[_0x312a('0x46')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x312a('0x3f')]('ListId\x20=\x20?',LISTID[_0x312a('0x3c')]())[_0x312a('0x3f')](_0x312a('0x49'),squel[_0x312a('0x47')](hopperContacts))[_0x312a('0x3f')](_0x312a('0x42')))[_0x312a('0x3c')]();return _0x52471d;}function _0x461f51(_0x20f328,_0x1967e7){var _0x2c9b96=squel[_0x312a('0x32')]()['into'](_0x312a('0x4a'))[_0x312a('0x35')]([_0x312a('0x36'),'ContactId',_0x312a('0x26'),_0x1967e7,_0x312a('0x3d'),'updatedAt'],squel[_0x312a('0x39')]()[_0x312a('0x3a')](_0x312a('0x36'),_0x312a('0x36'))[_0x312a('0x3a')]('id','ContactId')[_0x312a('0x3a')](LISTID['toString'](),_0x312a('0x26'))[_0x312a('0x3a')](_0x20f328['id']['toString'](),_0x1967e7)[_0x312a('0x3a')](_0x312a('0x3b'),_0x312a('0x3d'))['field'](_0x312a('0x3b'),_0x312a('0x38'))['from'](_0x312a('0x3e'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x312a('0x41'),LISTID[_0x312a('0x3c')]())['where'](_0x312a('0x49'),squel[_0x312a('0x47')](hopperContacts))[_0x312a('0x3f')](_0x312a('0x42')))[_0x312a('0x3c')]();return _0x2c9b96;}return db['VoiceQueue'][_0x312a('0x4b')]({'where':{'type':_0x312a('0x4c')},'attributes':['id',_0x312a('0x4d')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x312a('0x2d')](function(_0x2260ae){var _0x3388a6=[];if(_0x2260ae){var _0x2d0e8e;for(var _0x9b3762=0x0,_0x831d90;_0x9b3762<_0x2260ae[_0x312a('0x1b')];_0x9b3762+=0x1){_0x831d90=_0x2260ae[_0x9b3762][_0x312a('0x4e')]({'plain':!![]});switch(_0x831d90[_0x312a('0x4d')]){case _0x312a('0x4f'):_0x3388a6[_0x312a('0x50')](db['sequelize'][_0x312a('0x51')](_0x45a85a(_0x831d90,_0x312a('0x52')))[_0x312a('0x2d')](function(){})['catch'](_0x43eb52()));break;case'onlyIfOpen':_0x3388a6[_0x312a('0x50')](db[_0x312a('0x53')][_0x312a('0x51')](_0x5ed282(_0x831d90,_0x312a('0x52')))[_0x312a('0x2d')](function(){})[_0x312a('0x54')](_0x43eb52()));break;default:_0x3388a6[_0x312a('0x50')](db['sequelize'][_0x312a('0x51')](_0x23dd81(_0x831d90,_0x312a('0x52')))[_0x312a('0x2d')](function(){})[_0x312a('0x54')](_0x43eb52()));}}}return _0x3388a6;})[_0x312a('0x55')]()[_0x312a('0x2d')](function(){return db[_0x312a('0x56')][_0x312a('0x4b')]({'where':{'type':_0x312a('0x4c')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x563261){var _0x15458e=[];if(_0x563261){var _0x3ecf41;for(var _0x13e693=0x0,_0x28cd6e;_0x13e693<_0x563261[_0x312a('0x1b')];_0x13e693+=0x1){_0x28cd6e=_0x563261[_0x13e693][_0x312a('0x4e')]({'plain':!![]});_0x15458e[_0x312a('0x50')](db['sequelize'][_0x312a('0x51')](_0x461f51(_0x28cd6e,'VoiceQueueId'))[_0x312a('0x2d')](function(){})['catch'](_0x43eb52()));}}return _0x15458e;})[_0x312a('0x55')]();})[_0x312a('0x2d')](function(){return db[_0x312a('0x57')][_0x312a('0x4b')]({'attributes':['id',_0x312a('0x4d')],'include':[{'model':db['CmList'],'as':_0x312a('0x58'),'where':{'id':LISTID}}]})[_0x312a('0x2d')](function(_0x3c7d45){var _0x452c4c=[];if(_0x3c7d45){for(var _0x187764=0x0,_0x3aecda;_0x187764<_0x3c7d45[_0x312a('0x1b')];_0x187764+=0x1){_0x3aecda=_0x3c7d45[_0x187764][_0x312a('0x4e')]({'plain':!![]});switch(_0x3aecda[_0x312a('0x4d')]){case _0x312a('0x4f'):_0x452c4c[_0x312a('0x50')](db[_0x312a('0x53')]['query'](_0x45a85a(_0x3aecda,_0x312a('0x59')))[_0x312a('0x2d')](function(){})[_0x312a('0x54')](_0x43eb52()));break;case'onlyIfOpen':_0x452c4c[_0x312a('0x50')](db[_0x312a('0x53')][_0x312a('0x51')](_0x5ed282(_0x3aecda,_0x312a('0x59')))[_0x312a('0x2d')](function(){})[_0x312a('0x54')](_0x43eb52()));break;default:_0x452c4c[_0x312a('0x50')](db['sequelize'][_0x312a('0x51')](_0x23dd81(_0x3aecda,_0x312a('0x59')))[_0x312a('0x2d')](function(){})[_0x312a('0x54')](_0x43eb52()));}}}return _0x452c4c;})['all']();})[_0x312a('0x2d')](function(){return db[_0x312a('0x57')][_0x312a('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x312a('0x5a')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x312a('0x2d')](function(_0x49d8e7){var _0x52fd2d=[];if(_0x49d8e7){for(var _0x337d43=0x0,_0x4277f8;_0x337d43<_0x49d8e7[_0x312a('0x1b')];_0x337d43+=0x1){_0x4277f8=_0x49d8e7[_0x337d43][_0x312a('0x4e')]({'plain':!![]});_0x52fd2d[_0x312a('0x50')](db[_0x312a('0x53')][_0x312a('0x51')](_0x461f51(_0x4277f8,_0x312a('0x59')))['then'](function(){})[_0x312a('0x54')](_0x43eb52()));}}return _0x52fd2d;})['all']();})[_0x312a('0x54')](function(_0x1b2e97){logger[_0x312a('0x14')](_0x312a('0x5b'),_0x312a('0x5c'),_0x1b2e97[_0x312a('0x1d')]);});}var processPromises=function(_0x3ad24d){return BPromise[_0x312a('0x55')](promises)[_0x312a('0x2d')](function(_0xebdac9){})[_0x312a('0x54')](function(_0x4495bc){logger[_0x312a('0x14')](_0x312a('0x5d'),JSON[_0x312a('0x2e')](_0x4495bc));})['finally'](function(){socket[_0x312a('0x5e')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3ad24d){return _0x3ad24d['resume']();}});};var endCsv=function(){return BPromise[_0x312a('0x5f')]()[_0x312a('0x2d')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x312a('0x5e')](_0x312a('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x312a('0x61')](FILEPATH);}catch(_0x37a67b){logger[_0x312a('0x14')](_0x312a('0x62'),JSON[_0x312a('0x2e')](_0x37a67b));}finally{process[_0x312a('0x63')](0x0);}});};process['on'](_0x312a('0x64'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x312a('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x312a('0x11')](',');return db[_0x312a('0x2b')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x427094){var _0x355cd1=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x312a('0x65')](_0x355cd1,{'header':!![],'skipEmptyLines':!![],'step':function(_0x16bcc4,_0x171a64){total+=0x1;var _0xc1c4ce=total;promises[_0x312a('0x50')](checkRow(_0x16bcc4,_0x427094,_0xc1c4ce)['then'](function(){success+=0x1;})[_0x312a('0x54')](function(_0x4de776){if(_0x4de776[_0x312a('0x14')]){errors+=0x1;delete _0x4de776[_0x312a('0x14')];}else if(_0x4de776[_0x312a('0x29')]){duplicates+=0x1;delete _0x4de776[_0x312a('0x29')];}rows[_0x312a('0x50')](_0x4de776);}));if(total%0xc8===0x0){_0x171a64[_0x312a('0x66')]();return processPromises(_0x171a64);}},'complete':function(){return processPromises()[_0x312a('0x2d')](function(){logger[_0x312a('0x67')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x2e70b8,_0x597ddf){logger[_0x312a('0x67')]('CSV\x20parse\x20error',JSON['stringify'](_0x2e70b8));endCsv();}});})['catch'](function(_0x1a7c9b){logger[_0x312a('0x14')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x312a('0x2e')](_0x1a7c9b));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index c874794..2d1bcc5 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 _0x8f79=['cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_hopper_black','createdAt','field','ListId\x20=\x20?','\x20=\x20?','concat','insert',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','group','info','Received\x20SIGINT','error','message','push','sequelize','query','catch','stringify','start','binding','socket_timestamp','root','server/files/tmp','header','parse','data','length','rows','errors','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','email','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns_has_cm_blacklists','campaigns','CampaignId','each','affectedRows','unlink','exit','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','where','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','into','cm_hopper','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?'];(function(_0x4b04f9,_0x109d55){var _0x421410=function(_0x23206f){while(--_0x23206f){_0x4b04f9['push'](_0x4b04f9['shift']());}};_0x421410(++_0x109d55);}(_0x8f79,0x149));var _0x98f7=function(_0xede44e,_0x2540de){_0xede44e=_0xede44e-0x0;var _0x36367b=_0x8f79[_0xede44e];return _0x36367b;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require('papaparse');var util=require(_0x98f7('0x0'));var BPromise=require(_0x98f7('0x1'));var moment=require(_0x98f7('0x2'));var squel=require(_0x98f7('0x3'));var Redis=require(_0x98f7('0x4'));var db=require(_0x98f7('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x98f7('0x6'))(_0x98f7('0x7'));config[_0x98f7('0x8')]=_[_0x98f7('0x9')](config[_0x98f7('0x8')],{'host':_0x98f7('0xa'),'port':0x18eb});var socket=require(_0x98f7('0xb'))(new Redis(config[_0x98f7('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x98f7('0xc')](_0x98f7('0xd'));function isEmail(_0x4c7a23){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))*$/[_0x98f7('0xe')](_0x4c7a23);}function selectNotIn(_0xa8bcc8,_0x5877ce,_0x342b3a,_0x4f4e75,_0x15691c){return squel[_0x98f7('0xf')]()['field'](_0x98f7('0x10'))[_0x98f7('0x11')](_0x4f4e75)[_0x98f7('0x12')](_0x5877ce,null,_0x5877ce+'.id\x20=\x20'+_0x4f4e75+'.'+_0x342b3a)[_0x98f7('0x13')](_0x4f4e75+'.'+_0x342b3a+'\x20=\x20'+_0xa8bcc8+'.'+_0x342b3a)[_0x98f7('0x13')](_0x5877ce+'.dialCheckDuplicateType\x20IN\x20('+_0x15691c[_0x98f7('0x12')]()+')');}function insertCmHopper(_0x4a8d48,_0x4d1069,_0x5304a2,_0x59ffd7,_0x48b6cc){var _0x423dd0=['cm_contacts.phone',_0x98f7('0x14'),_0x98f7('0x15'),_0x98f7('0x16'),_0x4d1069+'.'+_0x59ffd7,_0x98f7('0x17'),_0x98f7('0x18'),_0x98f7('0x19'),'cm_contacts.UserId','\x22'+_0x48b6cc+'\x22'];return squel['insert']()[_0x98f7('0x1a')](_0x98f7('0x1b'))['fromQuery']([_0x98f7('0x10'),_0x98f7('0x1c'),_0x98f7('0x1d'),_0x98f7('0x1e'),_0x59ffd7,'createdAt',_0x98f7('0x1f'),_0x98f7('0x20'),_0x98f7('0x21'),_0x98f7('0x22')],squel[_0x98f7('0xf')]()[_0x98f7('0x23')](_0x423dd0)[_0x98f7('0x11')](_0x4d1069)[_0x98f7('0x12')](_0x98f7('0x24'),null,_0x98f7('0x25')+_0x4d1069+'.CmListId')[_0x98f7('0x12')](_0x5304a2,null,_0x5304a2+'.id\x20=\x20'+_0x4d1069+'.'+_0x59ffd7)['where'](_0x4d1069+_0x98f7('0x26'),_0x4a8d48)['where'](_0x98f7('0x27'),NOW)[_0x98f7('0x13')](_0x98f7('0x28'),selectNotIn(_0x4d1069,_0x5304a2,_0x59ffd7,_0x98f7('0x1b'),[_0x98f7('0x29'),_0x98f7('0x2a')]))['where'](_0x98f7('0x28'),selectNotIn(_0x4d1069,_0x5304a2,_0x59ffd7,_0x98f7('0x1b'),[_0x98f7('0x29')])))[_0x98f7('0x2b')]();}function insertCmHopperBlack(_0x4c243a,_0x279177,_0x45cd8b,_0x41afac){var _0x46057f=[_0x98f7('0x2c'),_0x98f7('0x15'),_0x98f7('0x16'),_0x279177+'.'+_0x41afac,_0x98f7('0x17'),_0x98f7('0x18')];return squel['insert']()['into'](_0x98f7('0x2d'))['fromQuery'](['phone',_0x98f7('0x1d'),_0x98f7('0x1e'),_0x41afac,_0x98f7('0x2e'),_0x98f7('0x1f')],squel[_0x98f7('0xf')]()[_0x98f7('0x23')](_0x46057f)[_0x98f7('0x11')](_0x279177)[_0x98f7('0x12')](_0x98f7('0x24'),null,_0x98f7('0x25')+_0x279177+'.CmListId')[_0x98f7('0x12')](_0x45cd8b,null,_0x45cd8b+'.id\x20=\x20'+_0x279177+'.'+_0x41afac)[_0x98f7('0x13')](_0x279177+_0x98f7('0x26'),_0x4c243a)[_0x98f7('0x13')](_0x98f7('0x27'),NOW)[_0x98f7('0x13')](_0x98f7('0x28'),squel['select']()[_0x98f7('0x2f')](_0x98f7('0x10'))['from'](_0x98f7('0x2d'))['where'](_0x98f7('0x30'),_0x4c243a)[_0x98f7('0x13')](_0x41afac+_0x98f7('0x31'),_0x279177+'.'+_0x41afac)))[_0x98f7('0x2b')]();}function insertCmContact(_0x2a5542,_0x201714,_0xd64bef,_0x7d65f3){var _0x1874ae=_[_0x98f7('0x32')](_['keys'](_0x7d65f3),[_0x98f7('0x1e'),'CompanyId',_0x98f7('0x2e'),_0x98f7('0x1f')]);return squel[_0x98f7('0x33')]()[_0x98f7('0x1a')](_0x98f7('0x24'))['fromQuery'](_0x1874ae,squel[_0x98f7('0xf')]()[_0x98f7('0x23')](_0x1874ae)[_0x98f7('0x11')](_0x201714)[_0x98f7('0x13')]('('+_0xd64bef[_0x98f7('0x12')](',')+_0x98f7('0x34'),squel[_0x98f7('0xf')]()[_0x98f7('0x23')](_0xd64bef)['from'](_0x98f7('0x24'))['where'](_0x98f7('0x30'),_0x2a5542)[_0x98f7('0x13')](_0x98f7('0x35')))[_0x98f7('0x13')](_0x98f7('0x36'),squel[_0x98f7('0xf')]()['field']('MIN(id)','min_id')[_0x98f7('0x11')](_0x201714)[_0x98f7('0x37')](_0xd64bef['join'](','))))[_0x98f7('0x2b')]();}function handleStop(){logger[_0x98f7('0x38')](_0x98f7('0x39'));stopped=!![];}function handleUncaughtException(_0x57c7e2){logger[_0x98f7('0x3a')](_0x57c7e2[_0x98f7('0x3b')]);process['exit'](0x1);}function handleError(_0x3dfc44,_0x2c30a2){stats['errors'][_0x98f7('0x3c')]({'name':_0x2c30a2['code'],'message':_0x2c30a2['message'],'row':_0x3dfc44});}function handleQuery(_0x265a4e){logger['info'](_0x265a4e);return db[_0x98f7('0x3d')][_0x98f7('0x3e')](_0x265a4e)['spread'](function(_0x1b442d){results[_0x98f7('0x3c')](_0x1b442d);})[_0x98f7('0x3f')](function(_0x5549c8){logger[_0x98f7('0x3a')](_0x5549c8[_0x98f7('0x3b')]);});}function main(_0x37af32,_0x5d24ff,_0x1fe3f4,_0x137ec5){logger[_0x98f7('0x38')]('main',_0x37af32,JSON[_0x98f7('0x40')](_0x5d24ff));process['send'](_0x98f7('0x41'));var _0x95134=_0x5d24ff[_0x98f7('0x42')];var _0x411732=_0x5d24ff[_0x98f7('0x43')];var _0x110c89=path[_0x98f7('0x12')](config[_0x98f7('0x44')],_0x98f7('0x45'),_0x411732+'.csv');var _0x4bb308=_['keys'](_0x95134)[_0x98f7('0x12')]();logger[_0x98f7('0x38')](_0x98f7('0x46'),_0x4bb308);fs['writeFileSync'](_0x110c89,_0x4bb308+'\x0a');Papa[_0x98f7('0x47')](fs['createReadStream'](_0x37af32),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1ba200,_0x2d38e4){try{for(var _0x44fced=0x0,_0x4dc4b6=[];_0x44fced<_0x1ba200[_0x98f7('0x48')][_0x98f7('0x49')];_0x44fced++){stats[_0x98f7('0x4a')]+=0x1;if(_0x1ba200[_0x98f7('0x4b')][_0x44fced]){handleError(_0x1ba200[_0x98f7('0x48')][_0x44fced],_0x1ba200['errors'][_0x44fced]);}else{var _0x46fc1b=[];for(var _0x1407f9 in _0x95134){if(_0x95134[_0x98f7('0x4c')](_0x1407f9)){if(_0x1ba200['data'][_0x44fced][_0x95134[_0x1407f9]]){var _0x1de315=_[_0x98f7('0x4d')](_0x1ba200[_0x98f7('0x48')][_0x44fced][_0x95134[_0x1407f9]]['replace'](/"/g,'\x27'));switch(_0x1407f9){case _0x98f7('0x1c'):var _0x9289b0=moment(_0x1de315,_0x98f7('0xd'),!![]);if(_0x9289b0[_0x98f7('0x4e')]()){_0x4dc4b6[_0x98f7('0x3c')]('\x22'+_0x1de315+'\x22');}else{_0x46fc1b[_0x98f7('0x3c')](_0x98f7('0x4f'));}break;case _0x98f7('0x20'):var _0x556595=parseInt(_0x1de315);_0x1de315=_['isNaN'](_0x556595)||_0x556595<0x0||_0x556595>0x4?_0x137ec5?0x3:0x2:_0x556595;_0x4dc4b6['push']('\x22'+_0x1de315+'\x22');break;case _0x98f7('0x21'):var _0x5ae9a0=parseInt(_0x1de315);if(_[_0x98f7('0x50')](_0x5ae9a0)&&_[_0x98f7('0x51')](_0x1fe3f4,_0x5ae9a0)){_0x4dc4b6['push']('\x22'+_0x5ae9a0+'\x22');}else{_0x46fc1b[_0x98f7('0x3c')](_0x98f7('0x52'));}break;case _0x98f7('0x53'):if(isEmail(_0x1de315)){_0x4dc4b6[_0x98f7('0x3c')]('\x22'+_0x1de315+'\x22');}else{_0x46fc1b[_0x98f7('0x3c')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x558906=moment(_0x1de315,_0x98f7('0x54'),!![]);if(_0x558906['isValid']()){_0x4dc4b6['push']('\x22'+_0x1de315+'\x22');}else{_0x46fc1b[_0x98f7('0x3c')](_0x98f7('0x55'));}break;default:_0x4dc4b6[_0x98f7('0x3c')]('\x22'+_0x1de315+'\x22');}}else{switch(_0x1407f9){case _0x98f7('0x56'):case _0x98f7('0x10'):_0x46fc1b['push'](_0x1407f9+'\x20not\x20specified');break;default:_0x4dc4b6[_0x98f7('0x3c')]('\x22\x22');}}}}if(_0x46fc1b[_0x98f7('0x49')]){handleError(_0x1ba200['data'][_0x44fced],{'code':_0x98f7('0x57'),'message':_0x46fc1b['join']()});}else{fs['appendFileSync'](_0x110c89,_0x4dc4b6[_0x98f7('0x12')]()+'\x0a');}_0x4dc4b6=[];}if(!(stats[_0x98f7('0x4a')]%0xc8)){socket[_0x98f7('0x58')](_0x98f7('0x59')+_0x411732,stats);stats[_0x98f7('0x4b')]=[];}}if(stopped){logger['info'](_0x98f7('0x5a'));_0x2d38e4[_0x98f7('0x5b')]();}}catch(_0x44c849){handleError(_0x1ba200['data'][_0x44fced],{'code':_0x98f7('0x5c'),'message':_0x44c849[_0x98f7('0x3b')]});logger[_0x98f7('0x3a')](_0x98f7('0x5d'),_0x44c849[_0x98f7('0x3b')]);}},'complete':function(){try{var _0x428930=[];var _0xdeedcc='cm_contacts';if(_0x5d24ff[_0x98f7('0x5e')]&&_0x5d24ff[_0x98f7('0x5e')][_0x98f7('0x49')]){_0xdeedcc='cm_contacts_'+_0x411732;_0x428930[_0x98f7('0x3c')](_0x98f7('0x5f')+_0xdeedcc+_0x98f7('0x60'));}var _0x120144=util['format'](_0x98f7('0x61'),_0x110c89,_0xdeedcc,_0x4bb308,_0x5d24ff[_0x98f7('0x1e')],_0x5d24ff[_0x98f7('0x62')]||null,NOW,NOW);if(_['isNil'](_0x95134[_0x98f7('0x1c')])){_0x120144+=_0x98f7('0x63');}_0x428930[_0x98f7('0x3c')](_0x120144);if(_0x5d24ff['duplicates']&&_0x5d24ff[_0x98f7('0x5e')][_0x98f7('0x49')]){_0x428930[_0x98f7('0x3c')](insertCmContact(_0x5d24ff[_0x98f7('0x1e')],_0xdeedcc,_0x5d24ff['duplicates'],_0x95134));_0x428930[_0x98f7('0x3c')]('DROP\x20TABLE\x20'+_0xdeedcc+';');}_0x428930[_0x98f7('0x3c')](insertCmHopper(_0x5d24ff[_0x98f7('0x1e')],_0x98f7('0x64'),_0x98f7('0x65'),_0x98f7('0x66'),_0x137ec5));_0x428930['push'](insertCmHopperBlack(_0x5d24ff['ListId'],_0x98f7('0x67'),_0x98f7('0x65'),_0x98f7('0x66')));_0x428930[_0x98f7('0x3c')](insertCmHopper(_0x5d24ff[_0x98f7('0x1e')],_0x98f7('0x68'),'campaigns','CampaignId',_0x137ec5));_0x428930[_0x98f7('0x3c')](insertCmHopperBlack(_0x5d24ff[_0x98f7('0x1e')],_0x98f7('0x69'),_0x98f7('0x6a'),_0x98f7('0x6b')));BPromise[_0x98f7('0x6c')](_0x428930,handleQuery)['then'](function(_0x4f7bd7){stats['finish']=!![];stats['affectedRows']=_0x5d24ff['duplicates']&&_0x5d24ff[_0x98f7('0x5e')][_0x98f7('0x49')]?results[0x2][_0x98f7('0x6d')]:results[0x0]['affectedRows'];socket['emit'](_0x98f7('0x59')+_0x411732,stats);fs[_0x98f7('0x6e')](_0x37af32);fs[_0x98f7('0x6e')](_0x110c89);process[_0x98f7('0x6f')](0x0);})[_0x98f7('0x3f')](function(_0x2c059a){logger[_0x98f7('0x3a')](_0x2c059a[_0x98f7('0x3b')]);process[_0x98f7('0x6f')](0x1);});}catch(_0xe70fe3){logger[_0x98f7('0x3a')]('complete',_0xe70fe3[_0x98f7('0x3b')]);process[_0x98f7('0x6f')](0x1);}},'error':function(_0x294919,_0x2f14fb,_0x3ade8d,_0x615a62){throw new Error(_0x615a62);}});}function validate(){if(process[_0x98f7('0x70')]&&process[_0x98f7('0x70')]['length']<0x4){throw new Error(_0x98f7('0x71'));}var _0x4fb418=path[_0x98f7('0x12')](config[_0x98f7('0x44')],_0x98f7('0x45'),process['argv'][0x2]);if(!fs[_0x98f7('0x72')](_0x4fb418)){throw new Error(_0x98f7('0x73'));}var _0x5750f5={};try{_0x5750f5=JSON[_0x98f7('0x47')](process[_0x98f7('0x70')][0x3]);if(!_0x5750f5[_0x98f7('0x42')]){throw new Error(_0x98f7('0x74'));}if(!_0x5750f5[_0x98f7('0x42')][_0x98f7('0x10')]){throw new Error(_0x98f7('0x75'));}if(!_0x5750f5['binding'][_0x98f7('0x56')]){throw new Error(_0x98f7('0x76'));}var _0x1048c6=0x0;if(_0x5750f5[_0x98f7('0x42')][_0x98f7('0x21')]){_0x1048c6=0x1;}if(!_0x5750f5[_0x98f7('0x1e')]){throw new Error(_0x98f7('0x77'));}}catch(_0x43104a){throw new Error('body\x20id\x20mandatory');}var _0x17539b=[];try{_0x17539b=_['map'](JSON[_0x98f7('0x47')](process[_0x98f7('0x70')][0x4]),'id');}catch(_0x2691a8){logger[_0x98f7('0x38')](_0x98f7('0x78'));}main(_0x4fb418,_0x5750f5,_0x17539b,_0x1048c6);}validate();process['on'](_0x98f7('0x79'),handleStop);process['on'](_0x98f7('0x7a'),handleUncaughtException); \ No newline at end of file +var _0x6b5b=['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','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','root','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','defaults','redis','localhost','socket.io-emitter','format','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','concat','keys','insert','fields',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','field','min_id','info','Received\x20SIGINT','message','push','query','main','stringify','send','start','binding','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','rows','errors','trim','replace','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','error','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;'];(function(_0xcc5aeb,_0xc48bcb){var _0x4c2d2b=function(_0x21935e){while(--_0x21935e){_0xcc5aeb['push'](_0xcc5aeb['shift']());}};_0x4c2d2b(++_0xc48bcb);}(_0x6b5b,0x130));var _0xb6b5=function(_0x21f959,_0x42fdbc){_0x21f959=_0x21f959-0x0;var _0x210421=_0x6b5b[_0x21f959];return _0x210421;};'use strict';var fs=require('fs');var path=require(_0xb6b5('0x0'));var _=require(_0xb6b5('0x1'));var Papa=require(_0xb6b5('0x2'));var util=require(_0xb6b5('0x3'));var BPromise=require(_0xb6b5('0x4'));var moment=require(_0xb6b5('0x5'));var squel=require(_0xb6b5('0x6'));var Redis=require(_0xb6b5('0x7'));var db=require(_0xb6b5('0x8'))['db'];var config=require(_0xb6b5('0x9'));var logger=require('../../../config/logger')('import');config['redis']=_[_0xb6b5('0xa')](config[_0xb6b5('0xb')],{'host':_0xb6b5('0xc'),'port':0x18eb});var socket=require(_0xb6b5('0xd'))(new Redis(config[_0xb6b5('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xb6b5('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x34d511){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))*$/[_0xb6b5('0xf')](_0x34d511);}function selectNotIn(_0x4dbb08,_0x2187e4,_0x5f5634,_0x4706b6,_0x5c387b){return squel[_0xb6b5('0x10')]()['field'](_0xb6b5('0x11'))[_0xb6b5('0x12')](_0x4706b6)[_0xb6b5('0x13')](_0x2187e4,null,_0x2187e4+_0xb6b5('0x14')+_0x4706b6+'.'+_0x5f5634)[_0xb6b5('0x15')](_0x4706b6+'.'+_0x5f5634+_0xb6b5('0x16')+_0x4dbb08+'.'+_0x5f5634)['where'](_0x2187e4+_0xb6b5('0x17')+_0x5c387b[_0xb6b5('0x13')]()+')');}function insertCmHopper(_0x2bec73,_0x466772,_0xcd6edf,_0x4ea23b,_0x334d56){var _0x54b131=[_0xb6b5('0x18'),_0xb6b5('0x19'),_0xb6b5('0x1a'),_0xb6b5('0x1b'),_0x466772+'.'+_0x4ea23b,_0xb6b5('0x1c'),'cm_contacts.updatedAt',_0xb6b5('0x1d'),_0xb6b5('0x1e'),'\x22'+_0x334d56+'\x22'];return squel['insert']()[_0xb6b5('0x1f')](_0xb6b5('0x20'))[_0xb6b5('0x21')]([_0xb6b5('0x11'),'scheduledat',_0xb6b5('0x22'),_0xb6b5('0x23'),_0x4ea23b,_0xb6b5('0x24'),_0xb6b5('0x25'),'priority',_0xb6b5('0x26'),_0xb6b5('0x27')],squel[_0xb6b5('0x10')]()['fields'](_0x54b131)[_0xb6b5('0x12')](_0x466772)[_0xb6b5('0x13')](_0xb6b5('0x28'),null,_0xb6b5('0x29')+_0x466772+_0xb6b5('0x2a'))[_0xb6b5('0x13')](_0xcd6edf,null,_0xcd6edf+'.id\x20=\x20'+_0x466772+'.'+_0x4ea23b)[_0xb6b5('0x15')](_0x466772+_0xb6b5('0x2b'),_0x2bec73)[_0xb6b5('0x15')](_0xb6b5('0x2c'),NOW)[_0xb6b5('0x15')](_0xb6b5('0x2d'),selectNotIn(_0x466772,_0xcd6edf,_0x4ea23b,_0xb6b5('0x20'),['\x22always\x22',_0xb6b5('0x2e')]))[_0xb6b5('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x466772,_0xcd6edf,_0x4ea23b,_0xb6b5('0x20'),['\x22always\x22'])))[_0xb6b5('0x2f')]();}function insertCmHopperBlack(_0x4aa81b,_0x36ee96,_0x5cb511,_0x3198cd){var _0x59bf65=[_0xb6b5('0x18'),_0xb6b5('0x1a'),_0xb6b5('0x1b'),_0x36ee96+'.'+_0x3198cd,_0xb6b5('0x1c'),'cm_contacts.updatedAt'];return squel['insert']()[_0xb6b5('0x1f')](_0xb6b5('0x30'))[_0xb6b5('0x21')]([_0xb6b5('0x11'),_0xb6b5('0x22'),_0xb6b5('0x23'),_0x3198cd,_0xb6b5('0x24'),_0xb6b5('0x25')],squel[_0xb6b5('0x10')]()['fields'](_0x59bf65)['from'](_0x36ee96)[_0xb6b5('0x13')](_0xb6b5('0x28'),null,_0xb6b5('0x29')+_0x36ee96+'.CmListId')[_0xb6b5('0x13')](_0x5cb511,null,_0x5cb511+_0xb6b5('0x14')+_0x36ee96+'.'+_0x3198cd)[_0xb6b5('0x15')](_0x36ee96+_0xb6b5('0x2b'),_0x4aa81b)[_0xb6b5('0x15')](_0xb6b5('0x2c'),NOW)[_0xb6b5('0x15')](_0xb6b5('0x2d'),squel[_0xb6b5('0x10')]()['field'](_0xb6b5('0x11'))[_0xb6b5('0x12')]('cm_hopper_black')['where'](_0xb6b5('0x31'),_0x4aa81b)[_0xb6b5('0x15')](_0x3198cd+_0xb6b5('0x32'),_0x36ee96+'.'+_0x3198cd)))[_0xb6b5('0x2f')]();}function insertCmContact(_0x4a598f,_0x3fca79,_0x38d0b0,_0x19f7af){var _0x10ba8f=_[_0xb6b5('0x33')](_[_0xb6b5('0x34')](_0x19f7af),[_0xb6b5('0x23'),'CompanyId',_0xb6b5('0x24'),_0xb6b5('0x25')]);return squel[_0xb6b5('0x35')]()[_0xb6b5('0x1f')](_0xb6b5('0x28'))['fromQuery'](_0x10ba8f,squel[_0xb6b5('0x10')]()[_0xb6b5('0x36')](_0x10ba8f)[_0xb6b5('0x12')](_0x3fca79)[_0xb6b5('0x15')]('('+_0x38d0b0[_0xb6b5('0x13')](',')+_0xb6b5('0x37'),squel[_0xb6b5('0x10')]()['fields'](_0x38d0b0)[_0xb6b5('0x12')](_0xb6b5('0x28'))['where'](_0xb6b5('0x31'),_0x4a598f)['where'](_0xb6b5('0x38')))[_0xb6b5('0x15')]('id\x20IN\x20?',squel['select']()[_0xb6b5('0x39')]('MIN(id)',_0xb6b5('0x3a'))['from'](_0x3fca79)['group'](_0x38d0b0[_0xb6b5('0x13')](','))))[_0xb6b5('0x2f')]();}function handleStop(){logger[_0xb6b5('0x3b')](_0xb6b5('0x3c'));stopped=!![];}function handleUncaughtException(_0x3abcc8){logger['error'](_0x3abcc8[_0xb6b5('0x3d')]);process['exit'](0x1);}function handleError(_0x3abdf4,_0x224b5b){stats['errors'][_0xb6b5('0x3e')]({'name':_0x224b5b['code'],'message':_0x224b5b['message'],'row':_0x3abdf4});}function handleQuery(_0x8635cc){logger[_0xb6b5('0x3b')](_0x8635cc);return db['sequelize'][_0xb6b5('0x3f')](_0x8635cc)['spread'](function(_0x21554a){results[_0xb6b5('0x3e')](_0x21554a);})['catch'](function(_0x2d9395){logger['error'](_0x2d9395['message']);});}function main(_0x2545de,_0x3f4eff,_0x5f4263,_0x361c0b){logger['info'](_0xb6b5('0x40'),_0x2545de,JSON[_0xb6b5('0x41')](_0x3f4eff));process[_0xb6b5('0x42')](_0xb6b5('0x43'));var _0x1536e0=_0x3f4eff[_0xb6b5('0x44')];var _0x52824d=_0x3f4eff['socket_timestamp'];var _0x330af7=path[_0xb6b5('0x13')](config['root'],_0xb6b5('0x45'),_0x52824d+_0xb6b5('0x46'));var _0x21bb2f=_['keys'](_0x1536e0)[_0xb6b5('0x13')]();logger['info'](_0xb6b5('0x47'),_0x21bb2f);fs[_0xb6b5('0x48')](_0x330af7,_0x21bb2f+'\x0a');Papa[_0xb6b5('0x49')](fs[_0xb6b5('0x4a')](_0x2545de),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2da069,_0x3a8ef8){try{for(var _0x48b6fa=0x0,_0x14fe98=[];_0x48b6fa<_0x2da069[_0xb6b5('0x4b')][_0xb6b5('0x4c')];_0x48b6fa++){stats[_0xb6b5('0x4d')]+=0x1;if(_0x2da069[_0xb6b5('0x4e')][_0x48b6fa]){handleError(_0x2da069[_0xb6b5('0x4b')][_0x48b6fa],_0x2da069[_0xb6b5('0x4e')][_0x48b6fa]);}else{var _0x2b33bd=[];for(var _0x33c0ed in _0x1536e0){if(_0x1536e0['hasOwnProperty'](_0x33c0ed)){if(_0x2da069[_0xb6b5('0x4b')][_0x48b6fa][_0x1536e0[_0x33c0ed]]){var _0x3adcaa=_[_0xb6b5('0x4f')](_0x2da069[_0xb6b5('0x4b')][_0x48b6fa][_0x1536e0[_0x33c0ed]][_0xb6b5('0x50')](/"/g,'\x27'));switch(_0x33c0ed){case _0xb6b5('0x51'):var _0x444efa=moment(_0x3adcaa,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x444efa['isValid']()){_0x14fe98[_0xb6b5('0x3e')]('\x22'+_0x3adcaa+'\x22');}else{_0x2b33bd['push'](_0xb6b5('0x52'));}break;case _0xb6b5('0x53'):var _0x45beb6=parseInt(_0x3adcaa);_0x3adcaa=_['isNaN'](_0x45beb6)||_0x45beb6<0x0||_0x45beb6>0x4?_0x361c0b?0x3:0x2:_0x45beb6;_0x14fe98['push']('\x22'+_0x3adcaa+'\x22');break;case'UserId':var _0x30bbf4=parseInt(_0x3adcaa);if(_[_0xb6b5('0x54')](_0x30bbf4)&&_[_0xb6b5('0x55')](_0x5f4263,_0x30bbf4)){_0x14fe98[_0xb6b5('0x3e')]('\x22'+_0x30bbf4+'\x22');}else{_0x2b33bd[_0xb6b5('0x3e')](_0xb6b5('0x56'));}break;case _0xb6b5('0x57'):if(isEmail(_0x3adcaa)){_0x14fe98[_0xb6b5('0x3e')]('\x22'+_0x3adcaa+'\x22');}else{_0x2b33bd[_0xb6b5('0x3e')](_0xb6b5('0x58'));}break;case'dateOfBirth':var _0x56cfc0=moment(_0x3adcaa,_0xb6b5('0x59'),!![]);if(_0x56cfc0[_0xb6b5('0x5a')]()){_0x14fe98[_0xb6b5('0x3e')]('\x22'+_0x3adcaa+'\x22');}else{_0x2b33bd[_0xb6b5('0x3e')](_0xb6b5('0x5b'));}break;default:_0x14fe98['push']('\x22'+_0x3adcaa+'\x22');}}else{switch(_0x33c0ed){case _0xb6b5('0x5c'):case _0xb6b5('0x11'):_0x2b33bd[_0xb6b5('0x3e')](_0x33c0ed+_0xb6b5('0x5d'));break;default:_0x14fe98[_0xb6b5('0x3e')]('\x22\x22');}}}}if(_0x2b33bd[_0xb6b5('0x4c')]){handleError(_0x2da069[_0xb6b5('0x4b')][_0x48b6fa],{'code':_0xb6b5('0x5e'),'message':_0x2b33bd['join']()});}else{fs[_0xb6b5('0x5f')](_0x330af7,_0x14fe98['join']()+'\x0a');}_0x14fe98=[];}if(!(stats[_0xb6b5('0x4d')]%0xc8)){socket[_0xb6b5('0x60')](_0xb6b5('0x61')+_0x52824d,stats);stats[_0xb6b5('0x4e')]=[];}}if(stopped){logger[_0xb6b5('0x3b')](_0xb6b5('0x62'));_0x3a8ef8[_0xb6b5('0x63')]();}}catch(_0x4dfeca){handleError(_0x2da069[_0xb6b5('0x4b')][_0x48b6fa],{'code':_0xb6b5('0x64'),'message':_0x4dfeca[_0xb6b5('0x3d')]});logger[_0xb6b5('0x65')](_0xb6b5('0x66'),_0x4dfeca[_0xb6b5('0x3d')]);}},'complete':function(){try{var _0x100b72=[];var _0x3f2bef=_0xb6b5('0x28');if(_0x3f4eff['duplicates']&&_0x3f4eff[_0xb6b5('0x67')][_0xb6b5('0x4c')]){_0x3f2bef=_0xb6b5('0x68')+_0x52824d;_0x100b72[_0xb6b5('0x3e')](_0xb6b5('0x69')+_0x3f2bef+_0xb6b5('0x6a'));}var _0x2d62cf=util[_0xb6b5('0xe')](_0xb6b5('0x6b'),_0x330af7,_0x3f2bef,_0x21bb2f,_0x3f4eff['ListId'],_0x3f4eff[_0xb6b5('0x6c')]||null,NOW,NOW);if(_['isNil'](_0x1536e0['scheduledat'])){_0x2d62cf+=_0xb6b5('0x6d');}_0x100b72[_0xb6b5('0x3e')](_0x2d62cf);if(_0x3f4eff[_0xb6b5('0x67')]&&_0x3f4eff['duplicates'][_0xb6b5('0x4c')]){_0x100b72[_0xb6b5('0x3e')](insertCmContact(_0x3f4eff[_0xb6b5('0x23')],_0x3f2bef,_0x3f4eff['duplicates'],_0x1536e0));_0x100b72[_0xb6b5('0x3e')](_0xb6b5('0x6e')+_0x3f2bef+';');}_0x100b72[_0xb6b5('0x3e')](insertCmHopper(_0x3f4eff[_0xb6b5('0x23')],_0xb6b5('0x6f'),_0xb6b5('0x70'),'VoiceQueueId',_0x361c0b));_0x100b72[_0xb6b5('0x3e')](insertCmHopperBlack(_0x3f4eff[_0xb6b5('0x23')],_0xb6b5('0x71'),_0xb6b5('0x70'),_0xb6b5('0x72')));_0x100b72['push'](insertCmHopper(_0x3f4eff['ListId'],_0xb6b5('0x73'),_0xb6b5('0x74'),_0xb6b5('0x75'),_0x361c0b));_0x100b72[_0xb6b5('0x3e')](insertCmHopperBlack(_0x3f4eff[_0xb6b5('0x23')],_0xb6b5('0x76'),_0xb6b5('0x74'),_0xb6b5('0x75')));BPromise[_0xb6b5('0x77')](_0x100b72,handleQuery)[_0xb6b5('0x78')](function(_0x3320ce){stats[_0xb6b5('0x79')]=!![];stats['affectedRows']=_0x3f4eff[_0xb6b5('0x67')]&&_0x3f4eff['duplicates'][_0xb6b5('0x4c')]?results[0x2][_0xb6b5('0x7a')]:results[0x0][_0xb6b5('0x7a')];socket[_0xb6b5('0x60')](_0xb6b5('0x61')+_0x52824d,stats);fs[_0xb6b5('0x7b')](_0x2545de);fs[_0xb6b5('0x7b')](_0x330af7);process[_0xb6b5('0x7c')](0x0);})['catch'](function(_0x5a12cd){logger[_0xb6b5('0x65')](_0x5a12cd['message']);process[_0xb6b5('0x7c')](0x1);});}catch(_0x33e336){logger[_0xb6b5('0x65')](_0xb6b5('0x7d'),_0x33e336[_0xb6b5('0x3d')]);process[_0xb6b5('0x7c')](0x1);}},'error':function(_0x9e21e5,_0x55302b,_0x437d4c,_0xb80152){throw new Error(_0xb80152);}});}function validate(){if(process['argv']&&process[_0xb6b5('0x7e')][_0xb6b5('0x4c')]<0x4){throw new Error(_0xb6b5('0x7f'));}var _0x1ecce6=path[_0xb6b5('0x13')](config[_0xb6b5('0x80')],'server/files/tmp',process[_0xb6b5('0x7e')][0x2]);if(!fs['existsSync'](_0x1ecce6)){throw new Error(_0xb6b5('0x81'));}var _0x49ebe2={};try{_0x49ebe2=JSON['parse'](process['argv'][0x3]);if(!_0x49ebe2['binding']){throw new Error(_0xb6b5('0x82'));}if(!_0x49ebe2[_0xb6b5('0x44')][_0xb6b5('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x49ebe2[_0xb6b5('0x44')][_0xb6b5('0x5c')]){throw new Error(_0xb6b5('0x83'));}var _0x17bf7d=0x0;if(_0x49ebe2['binding'][_0xb6b5('0x26')]){_0x17bf7d=0x1;}if(!_0x49ebe2[_0xb6b5('0x23')]){throw new Error(_0xb6b5('0x84'));}}catch(_0x3c0e3d){throw new Error(_0xb6b5('0x85'));}var _0x3906db=[];try{_0x3906db=_[_0xb6b5('0x86')](JSON[_0xb6b5('0x49')](process[_0xb6b5('0x7e')][0x4]),'id');}catch(_0x1f3bfb){logger['info']('No\x20agent\x20available');}main(_0x1ecce6,_0x49ebe2,_0x3906db,_0x17bf7d);}validate();process['on'](_0xb6b5('0x87'),handleStop);process['on'](_0xb6b5('0x88'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 5f1bb40..e4dd94e 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 _0xc1af=['uniqueid','Date','Agent\x20Name','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','agentcompleteAt','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','Answer\x20Time','answertime','Complete\x20Time','duration','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','queue','push','outbound','string','Outbound\x20Call','getDescriptions','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xc1af,0x97));var _0xfc1a=function(_0x2e048a,_0x59979d){_0x2e048a=_0x2e048a-0x0;var _0x2fb3d9=_0xc1af[_0x2e048a];return _0x2fb3d9;};'use strict';exports[_0xfc1a('0x0')]=function(_0x2dca56,_0x4f4c93){var _0x1c7b7c=[{'type':'string','content':_0xfc1a('0x1'),'variableName':null}];switch(_0x2dca56[_0xfc1a('0x2')]()){case _0xfc1a('0x3'):switch(_0x4f4c93[_0xfc1a('0x2')]()){case _0xfc1a('0x4'):_0x1c7b7c['push']({'type':_0xfc1a('0x5'),'content':'','variableName':_0xfc1a('0x6')});_0x1c7b7c[_0xfc1a('0x7')]({'type':_0xfc1a('0x5'),'content':'','variableName':'calleridnum'});break;case _0xfc1a('0x8'):_0x1c7b7c[_0xfc1a('0x7')]({'type':_0xfc1a('0x9'),'content':_0xfc1a('0xa'),'variableName':null});_0x1c7b7c[_0xfc1a('0x7')]({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0x1c7b7c;};exports[_0xfc1a('0xb')]=function(_0x264c43,_0x3d446f){var _0x4eea48=[];switch(_0x264c43[_0xfc1a('0x2')]()){case _0xfc1a('0x3'):switch(_0x3d446f['toLowerCase']()){case _0xfc1a('0x4'):_0x4eea48=[{'type':_0xfc1a('0x9'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xfc1a('0xc'),'content':'','key':_0xfc1a('0xd'),'keyType':'variable','variableName':_0xfc1a('0xe')},{'type':_0xfc1a('0xc'),'content':'','key':_0xfc1a('0xf'),'keyType':'variable','variableName':_0xfc1a('0x10')},{'type':_0xfc1a('0xc'),'content':'','key':_0xfc1a('0x11'),'keyType':_0xfc1a('0x5'),'variableName':_0xfc1a('0x12')},{'type':_0xfc1a('0xc'),'content':'','key':_0xfc1a('0x13'),'keyType':'variable','variableName':_0xfc1a('0x6')},{'type':_0xfc1a('0xc'),'content':'','key':_0xfc1a('0x14'),'keyType':_0xfc1a('0x5'),'variableName':_0xfc1a('0x15')},{'type':_0xfc1a('0xc'),'content':'','key':_0xfc1a('0x16'),'keyType':'variable','variableName':'agentcalledAt'},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xfc1a('0x17'),'keyType':_0xfc1a('0x5'),'variableName':'destcalleridname'},{'type':_0xfc1a('0xc'),'content':'','key':_0xfc1a('0x18'),'keyType':'variable','variableName':_0xfc1a('0x19')},{'type':'string','content':_0xfc1a('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xfc1a('0x1b'),'keyType':_0xfc1a('0x5'),'variableName':_0xfc1a('0x1c')},{'type':_0xfc1a('0xc'),'content':'','key':_0xfc1a('0x1d'),'keyType':_0xfc1a('0x5'),'variableName':_0xfc1a('0x1e')},{'type':'keyValue','content':'','key':'Agent\x20Complete','keyType':'variable','variableName':_0xfc1a('0x1f')},{'type':_0xfc1a('0xc'),'content':'','key':'Hold\x20Time','keyType':_0xfc1a('0x5'),'variableName':_0xfc1a('0x20')},{'type':_0xfc1a('0xc'),'content':'','key':_0xfc1a('0x21'),'keyType':_0xfc1a('0x5'),'variableName':_0xfc1a('0x22')}];break;case _0xfc1a('0x8'):_0x4eea48=[{'type':'string','content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xfc1a('0xc'),'content':'','key':_0xfc1a('0x23'),'keyType':_0xfc1a('0x5'),'keyContent':'','variableName':_0xfc1a('0x19')},{'type':'keyValue','content':'','key':_0xfc1a('0x24'),'keyType':_0xfc1a('0x5'),'keyContent':'','variableName':_0xfc1a('0x25')},{'type':_0xfc1a('0xc'),'content':'','key':_0xfc1a('0x14'),'keyType':_0xfc1a('0x5'),'keyContent':'','variableName':_0xfc1a('0x15')},{'type':_0xfc1a('0xc'),'content':'','key':_0xfc1a('0x16'),'keyType':_0xfc1a('0x5'),'keyContent':'','variableName':'starttime'},{'type':'string','content':_0xfc1a('0x1a')},{'type':_0xfc1a('0xc'),'content':'','key':_0xfc1a('0x26'),'keyType':_0xfc1a('0x5'),'keyContent':'','variableName':_0xfc1a('0x27')},{'type':'keyValue','content':'','key':_0xfc1a('0x28'),'keyType':_0xfc1a('0x5'),'keyContent':'','variableName':'endtime'},{'type':_0xfc1a('0xc'),'content':'','key':'Duration','keyType':_0xfc1a('0x5'),'keyContent':'','variableName':_0xfc1a('0x29')},{'type':_0xfc1a('0xc'),'content':'','key':'Billable\x20Time','keyType':_0xfc1a('0x5'),'keyContent':'','variableName':_0xfc1a('0x2a')}];break;}}return _0x4eea48;}; \ No newline at end of file +var _0x0290=['UniqueId','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','agentcalledAt','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime','outbound','***\x20Call\x20Info\x20***','Member\x20Name','membername','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','billableseconds','getSubjects','string','toLowerCase','inbound','push','queue','variable','destcalleridnum','voice','calleridnum','keyValue','Caller\x20Name','calleridname','Call\x20To','Queue'];(function(_0x143a73,_0x540ecb){var _0x5d7710=function(_0x2a3dfc){while(--_0x2a3dfc){_0x143a73['push'](_0x143a73['shift']());}};_0x5d7710(++_0x540ecb);}(_0x0290,0x69));var _0x0029=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x0290[_0x1e7b16];return _0x37fadc;};'use strict';exports[_0x0029('0x0')]=function(_0x8dbaa6,_0x53da3c){var _0x337d24=[{'type':_0x0029('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x8dbaa6[_0x0029('0x2')]()){case'voice':switch(_0x53da3c['toLowerCase']()){case _0x0029('0x3'):_0x337d24[_0x0029('0x4')]({'type':'variable','content':'','variableName':_0x0029('0x5')});_0x337d24[_0x0029('0x4')]({'type':_0x0029('0x6'),'content':'','variableName':'calleridnum'});break;case'outbound':_0x337d24[_0x0029('0x4')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x337d24[_0x0029('0x4')]({'type':_0x0029('0x6'),'content':'','variableName':_0x0029('0x7')});break;}}return _0x337d24;};exports['getDescriptions']=function(_0x3026a4,_0x320e95){var _0x28180a=[];switch(_0x3026a4[_0x0029('0x2')]()){case _0x0029('0x8'):switch(_0x320e95['toLowerCase']()){case _0x0029('0x3'):_0x28180a=[{'type':'string','content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Caller\x20Number','keyType':_0x0029('0x6'),'variableName':_0x0029('0x9')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0xb'),'keyType':_0x0029('0x6'),'variableName':_0x0029('0xc')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0xd'),'keyType':_0x0029('0x6'),'variableName':'destexten'},{'type':'keyValue','content':'','key':_0x0029('0xe'),'keyType':_0x0029('0x6'),'variableName':_0x0029('0x5')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0xf'),'keyType':_0x0029('0x6'),'variableName':_0x0029('0x10')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x11'),'keyType':_0x0029('0x6'),'variableName':'agentcalledAt'},{'type':_0x0029('0x1'),'content':_0x0029('0x12'),'key':null,'keyType':null,'variableName':null},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x13'),'keyType':'variable','variableName':_0x0029('0x14')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x15'),'keyType':'variable','variableName':_0x0029('0x7')},{'type':'string','content':_0x0029('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x0029('0xa'),'content':'','key':'Agent\x20Ring','keyType':'variable','variableName':_0x0029('0x17')},{'type':_0x0029('0xa'),'content':'','key':'Agent\x20Connect','keyType':_0x0029('0x6'),'variableName':_0x0029('0x18')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x19'),'keyType':_0x0029('0x6'),'variableName':_0x0029('0x1a')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x1b'),'keyType':'variable','variableName':_0x0029('0x1c')},{'type':_0x0029('0xa'),'content':'','key':'Talk\x20Time','keyType':_0x0029('0x6'),'variableName':_0x0029('0x1d')}];break;case _0x0029('0x1e'):_0x28180a=[{'type':_0x0029('0x1'),'content':_0x0029('0x1f'),'variableName':null},{'type':_0x0029('0xa'),'content':'','key':'Called\x20Number','keyType':_0x0029('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x20'),'keyType':_0x0029('0x6'),'keyContent':'','variableName':_0x0029('0x21')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0xf'),'keyType':_0x0029('0x6'),'keyContent':'','variableName':'uniqueid'},{'type':_0x0029('0xa'),'content':'','key':'Date','keyType':_0x0029('0x6'),'keyContent':'','variableName':_0x0029('0x22')},{'type':_0x0029('0x1'),'content':_0x0029('0x16')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x23'),'keyType':_0x0029('0x6'),'keyContent':'','variableName':'answertime'},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x24'),'keyType':_0x0029('0x6'),'keyContent':'','variableName':_0x0029('0x25')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x26'),'keyType':_0x0029('0x6'),'keyContent':'','variableName':'duration'},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':_0x0029('0x6'),'keyContent':'','variableName':_0x0029('0x27')}];break;}}return _0x28180a;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 0408c8f..f071011 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 _0xfc82=['role','null','findOne','then','update','info','tracked','user','query','clone','omit','body','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xfc82,0x188));var _0x2fc8=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xfc82[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x2fc8('0x0'));var db=require(_0x2fc8('0x1'))['db'];var loggers={'openchannel':require(_0x2fc8('0x2'))(_0x2fc8('0x3')),'mail':require('../../config/logger')('mail-interactions'),'fax':require('../../config/logger')(_0x2fc8('0x4')),'sms':require(_0x2fc8('0x2'))(_0x2fc8('0x5')),'chat':require(_0x2fc8('0x2'))(_0x2fc8('0x6')),'whatsapp':require(_0x2fc8('0x2'))(_0x2fc8('0x7'))};function getInteractionId(_0x163704,_0x23517c,_0x5679f5){if(_0x163704&&_0x163704[_[_0x2fc8('0x8')](_0x5679f5)+_0x2fc8('0x9')]){return _0x163704[_['upperFirst'](_0x5679f5)+_0x2fc8('0x9')];}else if(_0x163704&&_0x163704['id']){return _0x163704['id'];}else if(_0x23517c&&_0x23517c['id']){return _0x23517c['id'];}else{return _0x2fc8('0xa');}}function log(_0x7155d,_0x250ada,_0x46c625,_0x4d0bbf,_0x5050fe,_0xe3cae8){loggers[_0x5050fe['toLowerCase']()][_0x7155d](_0x2fc8('0xb'),_0xe3cae8[_0x2fc8('0xc')](),_0x250ada?_0x250ada['id']:null,_0x250ada?_0x250ada[_0x2fc8('0xd')]:null,_0x250ada?_0x250ada[_0x2fc8('0xe')]:null,getInteractionId(_0x46c625,_0x4d0bbf,_0x5050fe),_0x46c625?JSON['stringify'](_0x46c625):_0x2fc8('0xf'));}function updateUser(_0x552622,_0x360b22,_0xfa8f4c,_0x163261,_0x2b4935){db[_[_0x2fc8('0x8')](_0x163261)+'Interaction'][_0x2fc8('0x10')]({'where':{'id':getInteractionId(_0x360b22,_0xfa8f4c,_0x163261)}})[_0x2fc8('0x11')](function(_0x39b372){if(_0x39b372){return _0x39b372[_0x2fc8('0x12')]({'UserId':_0x552622?_0x552622['id']:null});}})[_0x2fc8('0x11')](function(_0x2e701c){if(_0x2e701c){log(_0x2fc8('0x13'),_0x552622,_0x360b22,_0xfa8f4c,_0x163261,_0x2b4935);}})['catch'](function(){log('error',_0x552622,_0x360b22,_0xfa8f4c,_0x163261,_0x2b4935);});}exports[_0x2fc8('0x14')]=function(_0x306e3b,_0x42a6e6){return function(_0x6d2891,_0x5d0eaa,_0x36c786){var _0x289a64=_0x6d2891[_0x2fc8('0x15')];var _0x38edbd={};var _0x388b4e=_0x6d2891[_0x2fc8('0x16')];if(_0x38edbd){_0x38edbd=_[_0x2fc8('0x17')](_0x6d2891['body']);_0x38edbd=_[_0x2fc8('0x18')](_0x38edbd,[_0x2fc8('0x19'),'html',_0x2fc8('0x1a'),_0x2fc8('0x1b'),_0x2fc8('0x1c')]);}updateUser(_0x289a64,_0x38edbd,_0x388b4e,_0x306e3b,_0x42a6e6);_0x36c786(null);};}; \ No newline at end of file +var _0x134c=['sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','then','update','catch','error','tracked','user','clone','body','omit','html','phone','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions'];(function(_0x29ee0c,_0x283703){var _0x1904f8=function(_0x4ef781){while(--_0x4ef781){_0x29ee0c['push'](_0x29ee0c['shift']());}};_0x1904f8(++_0x283703);}(_0x134c,0x1ca));var _0xc134=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x134c[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0xc134('0x0'));var db=require(_0xc134('0x1'))['db'];var loggers={'openchannel':require(_0xc134('0x2'))(_0xc134('0x3')),'mail':require(_0xc134('0x2'))(_0xc134('0x4')),'fax':require(_0xc134('0x2'))(_0xc134('0x5')),'sms':require(_0xc134('0x2'))(_0xc134('0x6')),'chat':require(_0xc134('0x2'))(_0xc134('0x7')),'whatsapp':require(_0xc134('0x2'))(_0xc134('0x8'))};function getInteractionId(_0x4133db,_0x5827d7,_0x1a0c6a){if(_0x4133db&&_0x4133db[_[_0xc134('0x9')](_0x1a0c6a)+_0xc134('0xa')]){return _0x4133db[_[_0xc134('0x9')](_0x1a0c6a)+'InteractionId'];}else if(_0x4133db&&_0x4133db['id']){return _0x4133db['id'];}else if(_0x5827d7&&_0x5827d7['id']){return _0x5827d7['id'];}else{return'unknown';}}function log(_0x4e3135,_0x407f0c,_0x1f3b59,_0x385cf2,_0x3a0ef6,_0x562287){loggers[_0x3a0ef6[_0xc134('0xb')]()][_0x4e3135](_0xc134('0xc'),_0x562287[_0xc134('0xd')](),_0x407f0c?_0x407f0c['id']:null,_0x407f0c?_0x407f0c[_0xc134('0xe')]:null,_0x407f0c?_0x407f0c['role']:null,getInteractionId(_0x1f3b59,_0x385cf2,_0x3a0ef6),_0x1f3b59?JSON[_0xc134('0xf')](_0x1f3b59):_0xc134('0x10'));}function updateUser(_0x587e78,_0x44c701,_0x19a010,_0x4de881,_0x32745d){db[_[_0xc134('0x9')](_0x4de881)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x44c701,_0x19a010,_0x4de881)}})[_0xc134('0x11')](function(_0x5a705a){if(_0x5a705a){return _0x5a705a[_0xc134('0x12')]({'UserId':_0x587e78?_0x587e78['id']:null});}})[_0xc134('0x11')](function(_0x36adbd){if(_0x36adbd){log('info',_0x587e78,_0x44c701,_0x19a010,_0x4de881,_0x32745d);}})[_0xc134('0x13')](function(){log(_0xc134('0x14'),_0x587e78,_0x44c701,_0x19a010,_0x4de881,_0x32745d);});}exports[_0xc134('0x15')]=function(_0x262361,_0x1e5cb4){return function(_0x5ce8b9,_0x2d10c0,_0x5085ec){var _0x9efe12=_0x5ce8b9[_0xc134('0x16')];var _0xa7d678={};var _0x4fac22=_0x5ce8b9['query'];if(_0xa7d678){_0xa7d678=_[_0xc134('0x17')](_0x5ce8b9[_0xc134('0x18')]);_0xa7d678=_[_0xc134('0x19')](_0xa7d678,[_0xc134('0x18'),_0xc134('0x1a'),_0xc134('0x1b'),'fax',_0xc134('0x1c')]);}updateUser(_0x9efe12,_0xa7d678,_0x4fac22,_0x262361,_0x1e5cb4);_0x5085ec(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 8e41ca4..13d35ae 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 _0xefb3=['hasOwnProperty','use','License','findOne','then','count','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit','util','../../mysqldb','../../config/environment','license','split','aes-256-ctr','%s:%s:%s','update','utf8','final','parse'];(function(_0x39a250,_0x52bb7f){var _0x272481=function(_0x161d88){while(--_0x161d88){_0x39a250['push'](_0x39a250['shift']());}};_0x272481(++_0x52bb7f);}(_0xefb3,0x1d0));var _0x3efb=function(_0x30c902,_0x297f5a){_0x30c902=_0x30c902-0x0;var _0x3f76d7=_0xefb3[_0x30c902];return _0x3f76d7;};'use strict';var crypto=require('crypto');var util=require(_0x3efb('0x0'));var compose=require('composable-middleware');var db=require(_0x3efb('0x1'))['db'];var config=require(_0x3efb('0x2'));function getValueFromLicense(_0x1e3f79,_0x5c45ae){if(_0x1e3f79&&_0x5c45ae){if(_0x5c45ae['data1']&&_0x5c45ae[_0x3efb('0x3')]){var _0x2fe4bb=_0x5c45ae['data1'];var _0x256e6a=_0x5c45ae[_0x3efb('0x3')];var _0xde10a5=_0x2fe4bb[_0x3efb('0x4')]('-')[0x4];var _0x1ae954=_0x2fe4bb[_0x3efb('0x4')]('-')[0x0];var _0xf7ad83=crypto['createDecipher'](_0x3efb('0x5'),util['format'](_0x3efb('0x6'),_0xde10a5,_0x2fe4bb,_0x1ae954));var _0x66cb1a=_0xf7ad83[_0x3efb('0x7')](_0x256e6a,'base64',_0x3efb('0x8'));_0x66cb1a+=_0xf7ad83[_0x3efb('0x9')](_0x3efb('0x8'));var _0x3e1a7=JSON[_0x3efb('0xa')](_0x66cb1a);return _0x3e1a7[_0x3efb('0xb')](_0x1e3f79)?_0x3e1a7[_0x1e3f79]:null;}}return null;}function isLimit(_0x42e22d,_0x2078f,_0x364da5,_0x707d73){var _0x28f3c7=_0x2078f;return compose()[_0x3efb('0xc')](function(_0x4c71b6,_0x25d333,_0x1725f5){return db[_0x3efb('0xd')][_0x3efb('0xe')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x375e42){var _0x5e770c=getValueFromLicense(_0x42e22d,_0x375e42);return _0x5e770c?_0x5e770c:_0x28f3c7;})[_0x3efb('0xf')](function(_0x3a8015){_0x28f3c7=_0x3a8015;return _0x364da5[_0x3efb('0x10')](_0x707d73);})[_0x3efb('0xf')](function(_0x6f9a2){if(_0x6f9a2>=_0x28f3c7){return _0x25d333['status'](0x193)[_0x3efb('0x11')]({'message':util[_0x3efb('0x12')](_0x3efb('0x13'),_0x42e22d)});}_0x1725f5();})[_0x3efb('0x14')](function(_0x1a7738){_0x1725f5(_0x1a7738);});});}function isUserLimit(){return isLimit(_0x3efb('0x15'),0x1,db[_0x3efb('0x16')],{'where':{'$or':[{'role':_0x3efb('0x17')},{'role':'user'}]}});}exports[_0x3efb('0x18')]=isUserLimit; \ No newline at end of file +var _0x4439=['split','format','update','base64','final','parse','use','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','data1','license'];(function(_0x182ab1,_0x1e1378){var _0x1c51c4=function(_0x402684){while(--_0x402684){_0x182ab1['push'](_0x182ab1['shift']());}};_0x1c51c4(++_0x1e1378);}(_0x4439,0x1c9));var _0x9443=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0x4439[_0x4c1ec2];return _0x3f6f1c;};'use strict';var crypto=require(_0x9443('0x0'));var util=require(_0x9443('0x1'));var compose=require(_0x9443('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x481b6d,_0x22ff4d){if(_0x481b6d&&_0x22ff4d){if(_0x22ff4d[_0x9443('0x3')]&&_0x22ff4d['license']){var _0x249349=_0x22ff4d[_0x9443('0x3')];var _0x5d1a28=_0x22ff4d[_0x9443('0x4')];var _0x553cba=_0x249349[_0x9443('0x5')]('-')[0x4];var _0x569b31=_0x249349[_0x9443('0x5')]('-')[0x0];var _0x33f342=crypto['createDecipher']('aes-256-ctr',util[_0x9443('0x6')]('%s:%s:%s',_0x553cba,_0x249349,_0x569b31));var _0x518bef=_0x33f342[_0x9443('0x7')](_0x5d1a28,_0x9443('0x8'),'utf8');_0x518bef+=_0x33f342[_0x9443('0x9')]('utf8');var _0x4929e6=JSON[_0x9443('0xa')](_0x518bef);return _0x4929e6['hasOwnProperty'](_0x481b6d)?_0x4929e6[_0x481b6d]:null;}}return null;}function isLimit(_0x4fcb49,_0x3f91b6,_0xd2b9ba,_0x5bb1b8){var _0x32b880=_0x3f91b6;return compose()[_0x9443('0xb')](function(_0x34696c,_0x1457c7,_0x3c355a){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0x9443('0xc')](function(_0x5b4a77){var _0x41bcde=getValueFromLicense(_0x4fcb49,_0x5b4a77);return _0x41bcde?_0x41bcde:_0x32b880;})[_0x9443('0xc')](function(_0x2cf3c4){_0x32b880=_0x2cf3c4;return _0xd2b9ba[_0x9443('0xd')](_0x5bb1b8);})['then'](function(_0x4836f2){if(_0x4836f2>=_0x32b880){return _0x1457c7['status'](0x193)[_0x9443('0xe')]({'message':util[_0x9443('0x6')](_0x9443('0xf'),_0x4fcb49)});}_0x3c355a();})[_0x9443('0x10')](function(_0x4f1913){_0x3c355a(_0x4f1913);});});}function isUserLimit(){return isLimit(_0x9443('0x11'),0x1,db[_0x9443('0x12')],{'where':{'$or':[{'role':_0x9443('0x13')},{'role':_0x9443('0x14')}]}});}exports[_0x9443('0x15')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 6408897..63cc793 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 _0xcd87=['castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','>\x20?','<=\x20?','$gte','start','shift','pop','utcOffset','hours','add','seconds','lodash','moment','sqlOperator','[$or]','and','replace','[$and]','split','length','slice','forEach','match','indexOf','map','conditions','buildExpression','DATE','operator','$between','value','includes','$lte','format'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xcd87,0x115));var _0x7cd8=function(_0x2a704c,_0x1f2202){_0x2a704c=_0x2a704c-0x0;var _0x34e65a=_0xcd87[_0x2a704c];return _0x34e65a;};'use strict';var _=require(_0x7cd8('0x0'));var moment=require(_0x7cd8('0x1'));exports['parseSearch']=function(_0x1ed0b2){var _0x2a180a={'conditions':[]};_0x2a180a[_0x7cd8('0x2')]=_['startsWith'](_0x1ed0b2,_0x7cd8('0x3'))?'or':_0x7cd8('0x4');var _0x382528=_0x1ed0b2[_0x7cd8('0x5')](_0x7cd8('0x6'),'')[_0x7cd8('0x5')]('[$or]','')[_0x7cd8('0x7')]('||');for(var _0x4c5a88=0x0;_0x4c5a88<_0x382528[_0x7cd8('0x8')];_0x4c5a88++){var _0x50ec1d=_0x382528[_0x4c5a88][_0x7cd8('0x7')](':=');var _0x285c54=_0x50ec1d[0x0];var _0x4a87ef=_0x50ec1d[_0x7cd8('0x9')](0x1);_0x4a87ef[_0x7cd8('0xa')](function(_0x1cd69f){var _0xdbea2a=_0x1cd69f[_0x7cd8('0x7')]('[')['shift']();var _0x5a80a9=_0x1cd69f[_0x7cd8('0xb')](/\[(.*?)\]/g);_0x5a80a9[_0x7cd8('0xa')](function(_0x4e4946){var _0x55b436=_0x4e4946[_0x7cd8('0x7')]('[')['filter'](function(_0x16e188){return _0x16e188[_0x7cd8('0xc')](']')>-0x1;})[_0x7cd8('0xd')](function(_0x5d4524){return _0x5d4524[_0x7cd8('0x7')](']')[0x0];})[0x0];_0x2a180a[_0x7cd8('0xe')]['push']({'field':_0x285c54,'operator':_0xdbea2a,'value':_0x55b436});});});}return _0x2a180a;};exports[_0x7cd8('0xf')]=function(_0x31c2c5,_0x211930,_0x32c3e0){var _0x551102={};if(_0x211930===_0x7cd8('0x10')){if(_0x32c3e0[_0x7cd8('0x11')]==='$eq'){_0x32c3e0[_0x7cd8('0x11')]=_0x7cd8('0x12');_0x32c3e0[_0x7cd8('0x13')]+=','+_0x32c3e0[_0x7cd8('0x13')];}else if(_[_0x7cd8('0x14')](['$gt',_0x7cd8('0x15')],_0x32c3e0[_0x7cd8('0x11')])){_0x32c3e0['value']=moment(_0x32c3e0[_0x7cd8('0x13')])['add'](0x1,'days')[_0x7cd8('0x16')]('YYYY-MM-DD');}}if(_0x32c3e0[_0x7cd8('0x17')]){_0x211930=_0x32c3e0[_0x7cd8('0x17')];_0x551102[_0x7cd8('0x18')]=_0x7cd8('0x19')+_0x31c2c5+'.'+_0x32c3e0[_0x7cd8('0x1a')]+'\x20AS\x20'+_0x32c3e0['castTo']+')\x20'+parseOperator(_0x32c3e0['operator']);}else{_0x551102[_0x7cd8('0x18')]=_0x31c2c5+'.'+_0x32c3e0['field']+'\x20'+parseOperator(_0x32c3e0[_0x7cd8('0x11')]);}if(_[_0x7cd8('0x14')]([_0x7cd8('0x1b'),_0x7cd8('0x1c')],_0x32c3e0['operator']))_0x551102['text']='('+_0x551102['text']+_0x7cd8('0x1d')+_0x31c2c5+'.'+_0x32c3e0[_0x7cd8('0x1a')]+_0x7cd8('0x1e');_0x551102[_0x7cd8('0x13')]=parseValue(_0x211930,_0x32c3e0[_0x7cd8('0x11')],_0x32c3e0[_0x7cd8('0x13')]);return _0x551102;};function parseOperator(_0x9be684){var _0x3d7c1d;switch(_0x9be684){case _0x7cd8('0x1f'):_0x3d7c1d=_0x7cd8('0x20');break;case _0x7cd8('0x1c'):_0x3d7c1d=_0x7cd8('0x21');break;case _0x7cd8('0x22'):_0x3d7c1d='=\x20?';break;case'$ne':_0x3d7c1d=_0x7cd8('0x23');break;case _0x7cd8('0x24'):case _0x7cd8('0x25'):case _0x7cd8('0x26'):_0x3d7c1d=_0x7cd8('0x27');break;case'$lt':_0x3d7c1d='<\x20?';break;case'$gt':_0x3d7c1d=_0x7cd8('0x28');break;case _0x7cd8('0x15'):_0x3d7c1d=_0x7cd8('0x29');break;case _0x7cd8('0x2a'):_0x3d7c1d='>=\x20?';break;case _0x7cd8('0x12'):_0x3d7c1d='BETWEEN\x20?\x20AND\x20?';break;}return _0x3d7c1d;}function parseValue(_0x213bbd,_0x7caaaa,_0x4fd217){var _0x396c44={'start':undefined,'end':undefined};switch(_0x7caaaa){case _0x7cd8('0x1f'):case _0x7cd8('0x1c'):_0x396c44[_0x7cd8('0x2b')]=_0x4fd217['split'](',');break;case _0x7cd8('0x24'):_0x396c44[_0x7cd8('0x2b')]='%'+_0x4fd217+'%';break;case'$startsWith':_0x396c44[_0x7cd8('0x2b')]=_0x4fd217+'%';break;case _0x7cd8('0x26'):_0x396c44['start']='%'+_0x4fd217;break;case'$between':var _0x4d991c=_0x4fd217['split'](',');var _0x4fd217=_0x4d991c[_0x7cd8('0x2c')]();var _0x393cb6=_0x4d991c[_0x7cd8('0x2d')]();if(_0x213bbd===_0x7cd8('0x10')){_0x4fd217=moment(_0x4fd217)[_0x7cd8('0x2e')](0x0,!![])['format']();_0x393cb6=moment(_0x393cb6)[_0x7cd8('0x2e')](0x0,!![])['add'](0x17,_0x7cd8('0x2f'))[_0x7cd8('0x30')](0x3b,'minutes')[_0x7cd8('0x30')](0x3b,_0x7cd8('0x31'))['format']();}_0x396c44={'start':_0x4fd217,'end':_0x393cb6};break;default:_0x396c44[_0x7cd8('0x2b')]=_0x4fd217;break;}return _0x396c44;} \ No newline at end of file +var _0xf2f0=['pop','utcOffset','format','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','replace','[$or]','length','split','slice','forEach','shift','indexOf','conditions','buildExpression','DATE','$eq','$between','value','includes','$gt','$lte','add','days','castTo','text','CAST(','field','\x20AS\x20','operator','$notIn','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','$lt','<\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xf2f0,0x1d0));var _0x0f2f=function(_0x4d20c0,_0x33210c){_0x4d20c0=_0x4d20c0-0x0;var _0x1afcc3=_0xf2f0[_0x4d20c0];return _0x1afcc3;};'use strict';var _=require(_0x0f2f('0x0'));var moment=require(_0x0f2f('0x1'));exports[_0x0f2f('0x2')]=function(_0x1b568d){var _0x9ba9eb={'conditions':[]};_0x9ba9eb[_0x0f2f('0x3')]=_[_0x0f2f('0x4')](_0x1b568d,'[$or]')?'or':'and';var _0x210316=_0x1b568d[_0x0f2f('0x5')]('[$and]','')[_0x0f2f('0x5')](_0x0f2f('0x6'),'')['split']('||');for(var _0x3f2bbb=0x0;_0x3f2bbb<_0x210316[_0x0f2f('0x7')];_0x3f2bbb++){var _0x4c4b87=_0x210316[_0x3f2bbb][_0x0f2f('0x8')](':=');var _0x1f8035=_0x4c4b87[0x0];var _0x58f2ee=_0x4c4b87[_0x0f2f('0x9')](0x1);_0x58f2ee[_0x0f2f('0xa')](function(_0x1e0406){var _0x1b3903=_0x1e0406[_0x0f2f('0x8')]('[')[_0x0f2f('0xb')]();var _0x207c00=_0x1e0406['match'](/\[(.*?)\]/g);_0x207c00['forEach'](function(_0x620b67){var _0x34d765=_0x620b67[_0x0f2f('0x8')]('[')['filter'](function(_0x33f51d){return _0x33f51d[_0x0f2f('0xc')](']')>-0x1;})['map'](function(_0xf69ffd){return _0xf69ffd[_0x0f2f('0x8')](']')[0x0];})[0x0];_0x9ba9eb[_0x0f2f('0xd')]['push']({'field':_0x1f8035,'operator':_0x1b3903,'value':_0x34d765});});});}return _0x9ba9eb;};exports[_0x0f2f('0xe')]=function(_0x52c2ff,_0x7addf5,_0x1b09f4){var _0x1095a0={};if(_0x7addf5===_0x0f2f('0xf')){if(_0x1b09f4['operator']===_0x0f2f('0x10')){_0x1b09f4['operator']=_0x0f2f('0x11');_0x1b09f4['value']+=','+_0x1b09f4[_0x0f2f('0x12')];}else if(_[_0x0f2f('0x13')]([_0x0f2f('0x14'),_0x0f2f('0x15')],_0x1b09f4['operator'])){_0x1b09f4['value']=moment(_0x1b09f4[_0x0f2f('0x12')])[_0x0f2f('0x16')](0x1,_0x0f2f('0x17'))['format']('YYYY-MM-DD');}}if(_0x1b09f4[_0x0f2f('0x18')]){_0x7addf5=_0x1b09f4[_0x0f2f('0x18')];_0x1095a0[_0x0f2f('0x19')]=_0x0f2f('0x1a')+_0x52c2ff+'.'+_0x1b09f4[_0x0f2f('0x1b')]+_0x0f2f('0x1c')+_0x1b09f4[_0x0f2f('0x18')]+')\x20'+parseOperator(_0x1b09f4[_0x0f2f('0x1d')]);}else{_0x1095a0['text']=_0x52c2ff+'.'+_0x1b09f4['field']+'\x20'+parseOperator(_0x1b09f4[_0x0f2f('0x1d')]);}if(_[_0x0f2f('0x13')](['$ne',_0x0f2f('0x1e')],_0x1b09f4[_0x0f2f('0x1d')]))_0x1095a0[_0x0f2f('0x19')]='('+_0x1095a0[_0x0f2f('0x19')]+'\x20OR\x20'+_0x52c2ff+'.'+_0x1b09f4[_0x0f2f('0x1b')]+_0x0f2f('0x1f');_0x1095a0[_0x0f2f('0x12')]=parseValue(_0x7addf5,_0x1b09f4[_0x0f2f('0x1d')],_0x1b09f4[_0x0f2f('0x12')]);return _0x1095a0;};function parseOperator(_0x17cb25){var _0x36174b;switch(_0x17cb25){case _0x0f2f('0x20'):_0x36174b='IN\x20?';break;case'$notIn':_0x36174b=_0x0f2f('0x21');break;case _0x0f2f('0x10'):_0x36174b=_0x0f2f('0x22');break;case _0x0f2f('0x23'):_0x36174b=_0x0f2f('0x24');break;case _0x0f2f('0x25'):case _0x0f2f('0x26'):case'$endsWith':_0x36174b='LIKE\x20?';break;case _0x0f2f('0x27'):_0x36174b=_0x0f2f('0x28');break;case _0x0f2f('0x14'):_0x36174b='>\x20?';break;case _0x0f2f('0x15'):_0x36174b='<=\x20?';break;case _0x0f2f('0x29'):_0x36174b=_0x0f2f('0x2a');break;case _0x0f2f('0x11'):_0x36174b=_0x0f2f('0x2b');break;}return _0x36174b;}function parseValue(_0x11bd5d,_0x1a48d6,_0xb6040d){var _0x5db11e={'start':undefined,'end':undefined};switch(_0x1a48d6){case'$in':case'$notIn':_0x5db11e[_0x0f2f('0x2c')]=_0xb6040d[_0x0f2f('0x8')](',');break;case _0x0f2f('0x25'):_0x5db11e[_0x0f2f('0x2c')]='%'+_0xb6040d+'%';break;case _0x0f2f('0x26'):_0x5db11e[_0x0f2f('0x2c')]=_0xb6040d+'%';break;case _0x0f2f('0x2d'):_0x5db11e[_0x0f2f('0x2c')]='%'+_0xb6040d;break;case _0x0f2f('0x11'):var _0x27cd69=_0xb6040d['split'](',');var _0xb6040d=_0x27cd69['shift']();var _0xc8b984=_0x27cd69[_0x0f2f('0x2e')]();if(_0x11bd5d==='DATE'){_0xb6040d=moment(_0xb6040d)[_0x0f2f('0x2f')](0x0,!![])[_0x0f2f('0x30')]();_0xc8b984=moment(_0xc8b984)[_0x0f2f('0x2f')](0x0,!![])[_0x0f2f('0x16')](0x17,_0x0f2f('0x31'))[_0x0f2f('0x16')](0x3b,'minutes')['add'](0x3b,_0x0f2f('0x32'))['format']();}_0x5db11e={'start':_0xb6040d,'end':_0xc8b984};break;default:_0x5db11e['start']=_0xb6040d;break;}return _0x5db11e;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 671ec99..6d03f05 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 _0x82ac=['push','join','getOptions','query','$id','model','map','intersection','attributes','fields','order','sort','where','filter','merge','lower','options','lodash','sequelize','moment','keys','includes','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','format','YYYY-MM-DD','utc','$lte','name','uniqueid','isArray','limit','offset','indexOf','priority','cast','unsigned','substr','DESC','col','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace'];(function(_0x5ebb34,_0x30bcfa){var _0x2a1a18=function(_0x474e26){while(--_0x474e26){_0x5ebb34['push'](_0x5ebb34['shift']());}};_0x2a1a18(++_0x30bcfa);}(_0x82ac,0xc5));var _0xc82a=function(_0x16eb99,_0x5becfe){_0x16eb99=_0x16eb99-0x0;var _0x3514a3=_0x82ac[_0x16eb99];return _0x3514a3;};'use strict';var _=require(_0xc82a('0x0'));var sequelize=require(_0xc82a('0x1'));var moment=require(_0xc82a('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x49cf32){var _0x9f4f07=['ne'];try{var _0x3d49ae=JSON['parse'](_0x49cf32);var _0x2d8378=Object[_0xc82a('0x3')](_0x3d49ae)[0x0];return _0x9f4f07[_0xc82a('0x4')](_0x2d8378);}catch(_0x4250b3){return![];}}function getOperatorValue(_0x5e0893){var _0x3a9cd7=JSON['parse'](_0x5e0893);var _0x146eef=Object[_0xc82a('0x3')](_0x3a9cd7)[0x0];var _0x3e764c=_0x3a9cd7[_0x146eef];return{['$'+_0x146eef]:_0x3e764c};}exports['fields']=function(_0x2b71ba){var _0x3855c7=null;if(_0x2b71ba){_0x3855c7=_0x2b71ba[_0xc82a('0x5')](',');}return _0x3855c7;};exports[_0xc82a('0x6')]=function(_0x1fbfe0,_0x5ecc8d){var _0x3058a5={};if(!_[_0xc82a('0x7')](_0x1fbfe0)){_[_0xc82a('0x8')](_0x1fbfe0,function(_0x4a8548,_0x2c3d82){try{if(_0x5ecc8d){var _0x38b6bc=_[_0xc82a('0x9')](_0x5ecc8d,{'name':_0x2c3d82})||{};if(hasSequelizeOperator(_0x4a8548)){_0x3058a5[_0x2c3d82]=getOperatorValue(_0x4a8548);}else if(_0x38b6bc[_0xc82a('0xa')]===_0xc82a('0xb')&&_[_0xc82a('0xc')](_0x4a8548)){var _0x8668f=JSON[_0xc82a('0xd')](_0x4a8548);var _0x37a4ae={'$gte':moment(moment(_0x8668f['$gte'])[_0xc82a('0xe')](_0xc82a('0xf')))[_0xc82a('0x10')]()[_0xc82a('0xe')](),'$lte':moment(moment(_0x8668f[_0xc82a('0x11')])['format']('YYYY-MM-DD'))[_0xc82a('0x10')]()['subtract'](0x1,'s')[_0xc82a('0xe')]()};_0x3058a5[_0x2c3d82]=_0x37a4ae;}else if(_0x38b6bc[_0xc82a('0x12')]===_0xc82a('0x13')){_0x3058a5[_0x2c3d82]=_0x4a8548;}else{_0x3058a5[_0x2c3d82]=_[_0xc82a('0x14')](_0x4a8548)?_0x4a8548:JSON[_0xc82a('0xd')](_0x4a8548);}}else{_0x3058a5[_0x2c3d82]=_['isArray'](_0x4a8548)?_0x4a8548:JSON[_0xc82a('0xd')](_0x4a8548);}}catch(_0x15bd87){_0x3058a5[_0x2c3d82]=_0x4a8548['split'](',');}});}return _0x3058a5;};exports[_0xc82a('0x15')]=function(_0x1e7c33){_0x1e7c33=parseInt(_0x1e7c33,0xa);if(!_0x1e7c33||_0x1e7c33<0x0){_0x1e7c33=LIMIT_VALUE;}return _0x1e7c33;};exports[_0xc82a('0x16')]=function(_0x5deb22){_0x5deb22=parseInt(_0x5deb22,0xa);if(!_0x5deb22||_0x5deb22<0x0){_0x5deb22=0x0;}return _0x5deb22;};exports['sort']=function(_0x179886){var _0x561416,_0x2a7060=null;if(_0x179886){_0x561416=_0x179886[_0xc82a('0x5')](',');_0x2a7060=_['map'](_0x561416,function(_0x38cbd8){if(_0x38cbd8[_0xc82a('0x17')]('-')===0x0){return[_0x38cbd8===_0xc82a('0x18')?sequelize[_0xc82a('0x19')](sequelize['col'](_0xc82a('0x18')),_0xc82a('0x1a')):_0x38cbd8[_0xc82a('0x1b')](0x1),_0xc82a('0x1c')];}else{return[_0x38cbd8===_0xc82a('0x18')?sequelize['cast'](sequelize[_0xc82a('0x1d')]('priority'),_0xc82a('0x1a')):_0x38cbd8,_0xc82a('0x1e')];}});}return _0x2a7060;};exports[_0xc82a('0x1f')]=function(_0x5cec99,_0x409701){if(_[_0xc82a('0x7')](_0x5cec99)){return _0x5cec99;}if(_['isArray'](_0x5cec99)){for(var _0x240815=0x0;_0x240815<_0x5cec99[_0xc82a('0x20')];_0x240815+=0x1){_0x5cec99[_0x240815]=this['omit'](_0x5cec99[_0x240815],_0x409701);}return _0x5cec99;}if(!_[_0xc82a('0x21')](_0x5cec99)){return _0x5cec99;}if(_['isString'](_0x409701)){_0x409701=[_0x409701];}if(!_[_0xc82a('0x14')](_0x409701)){return _0x5cec99;}for(var _0x2d76bf=0x0;_0x2d76bf<_0x409701['length'];_0x2d76bf+=0x1){_[_0xc82a('0x22')](_0x5cec99,_0x409701[_0x2d76bf]);}for(var _0xdbb63d in _0x5cec99){if(_0x5cec99[_0xc82a('0x23')](_0xdbb63d)){_0x5cec99[_0xdbb63d]=this[_0xc82a('0x1f')](_0x5cec99[_0xdbb63d],_0x409701);}}return _0x5cec99;};exports[_0xc82a('0x24')]=function(_0x171730){return _0x171730[_0xc82a('0x25')](RegExp(_0xc82a('0x26')))?!![]:![];};exports[_0xc82a('0x27')]=function(_0x86e5b4){return _0x86e5b4['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xc82a('0x28')]=function(_0x1fe44b){var _0x5af763=[];_0x1fe44b[_0xc82a('0x5')](/[ ,]+/)[_0xc82a('0x29')](function(_0x30a609){_0x30a609=_0x30a609[_0xc82a('0x2a')](/([^:]")"+/g,'$1');_0x30a609='+'+_0x30a609+'*';if(_0x30a609[_0xc82a('0x4')]('@'))_0x30a609='\x22'+_0x30a609+'\x22';_0x5af763[_0xc82a('0x2b')](_0x30a609);});return _0x5af763[_0xc82a('0x2c')]('\x20');};exports[_0xc82a('0x2d')]=function(_0x1ddb00,_0x240c2b,_0x4eb73a){var _0x395bae={},_0x102d7b={};if(_0x240c2b[_0xc82a('0x2e')][_0xc82a('0x2f')]){_0x240c2b[_0xc82a('0x2e')]['id']=_0x240c2b[_0xc82a('0x2e')][_0xc82a('0x2f')];delete _0x240c2b[_0xc82a('0x2e')][_0xc82a('0x2f')];}_0x395bae[_0xc82a('0x30')]=_[_0xc82a('0x31')](_0x1ddb00,_0xc82a('0x12'));_0x395bae['query']=_[_0xc82a('0x3')](_0x240c2b['query']);_0x395bae[_0xc82a('0x6')]=_[_0xc82a('0x32')](_0x395bae[_0xc82a('0x30')],_0x395bae['query']);_0x102d7b[_0xc82a('0x33')]=_[_0xc82a('0x32')](_0x395bae[_0xc82a('0x30')],this[_0xc82a('0x34')](_0x240c2b['query'][_0xc82a('0x34')]));_0x102d7b[_0xc82a('0x33')]=_0x102d7b[_0xc82a('0x33')][_0xc82a('0x20')]?_0x102d7b[_0xc82a('0x33')]:_0x395bae[_0xc82a('0x30')];if(!_0x240c2b[_0xc82a('0x2e')]['hasOwnProperty']('nolimit')){_0x102d7b['limit']=this[_0xc82a('0x15')](_0x240c2b[_0xc82a('0x2e')][_0xc82a('0x15')]);_0x102d7b[_0xc82a('0x16')]=this[_0xc82a('0x16')](_0x240c2b[_0xc82a('0x2e')][_0xc82a('0x16')]);}_0x102d7b[_0xc82a('0x35')]=this[_0xc82a('0x36')](_0x240c2b[_0xc82a('0x2e')][_0xc82a('0x36')]);_0x102d7b[_0xc82a('0x37')]=this[_0xc82a('0x6')](_['pick'](_0x240c2b['query'],_0x395bae[_0xc82a('0x6')]),_0x1ddb00);if(_0x240c2b[_0xc82a('0x2e')][_0xc82a('0x38')]){_0x102d7b[_0xc82a('0x37')]=_[_0xc82a('0x39')](_0x102d7b[_0xc82a('0x37')],{'$or':_[_0xc82a('0x31')](_0x1ddb00,function(_0x4a15f7){if(_0x4a15f7[_0xc82a('0xa')]!=='VIRTUAL'){if(_0x4eb73a){return sequelize['where'](sequelize['fn'](_0xc82a('0x3a'),sequelize[_0xc82a('0x1d')](_0x4a15f7['name'])),{'$like':sequelize['fn'](_0xc82a('0x3a'),'%'+_0x240c2b['query']['filter']+'%')});}else{var _0xe188b6={};_0xe188b6[_0x4a15f7[_0xc82a('0x12')]]={'$like':'%'+_0x240c2b[_0xc82a('0x2e')]['filter']+'%'};return _0xe188b6;}}})});}_0x102d7b=_[_0xc82a('0x39')]({},_0x102d7b,_0x240c2b[_0xc82a('0x3b')]);return _0x102d7b;}; \ No newline at end of file +var _0x48ad=['lower','merge','options','lodash','sequelize','parse','keys','fields','split','isEmpty','forOwn','find','type','isPlainObject','$gte','YYYY-MM-DD','utc','format','subtract','name','isArray','sort','map','indexOf','priority','unsigned','substr','DESC','cast','col','ASC','omit','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','push','join','getOptions','query','$id','model','intersection','attributes','limit','offset','order','where','filters','pick'];(function(_0x3712dd,_0x46da6d){var _0x5b2e4e=function(_0xe0b6b1){while(--_0xe0b6b1){_0x3712dd['push'](_0x3712dd['shift']());}};_0x5b2e4e(++_0x46da6d);}(_0x48ad,0xa5));var _0xd48a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x48ad[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd48a('0x0'));var sequelize=require(_0xd48a('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2d64e0){var _0x24e0b0=['ne'];try{var _0x54c470=JSON[_0xd48a('0x2')](_0x2d64e0);var _0x17f413=Object[_0xd48a('0x3')](_0x54c470)[0x0];return _0x24e0b0['includes'](_0x17f413);}catch(_0x55e4e2){return![];}}function getOperatorValue(_0x107986){var _0x566e32=JSON['parse'](_0x107986);var _0x369a1f=Object[_0xd48a('0x3')](_0x566e32)[0x0];var _0x190648=_0x566e32[_0x369a1f];return{['$'+_0x369a1f]:_0x190648};}exports[_0xd48a('0x4')]=function(_0x9a9301){var _0x1a15dc=null;if(_0x9a9301){_0x1a15dc=_0x9a9301[_0xd48a('0x5')](',');}return _0x1a15dc;};exports['filters']=function(_0x196777,_0x584a25){var _0x3382ba={};if(!_[_0xd48a('0x6')](_0x196777)){_[_0xd48a('0x7')](_0x196777,function(_0x3c0a62,_0x259391){try{if(_0x584a25){var _0x14c014=_[_0xd48a('0x8')](_0x584a25,{'name':_0x259391})||{};if(hasSequelizeOperator(_0x3c0a62)){_0x3382ba[_0x259391]=getOperatorValue(_0x3c0a62);}else if(_0x14c014[_0xd48a('0x9')]==='DATE'&&_[_0xd48a('0xa')](_0x3c0a62)){var _0x38a860=JSON[_0xd48a('0x2')](_0x3c0a62);var _0x327acf={'$gte':moment(moment(_0x38a860[_0xd48a('0xb')])['format'](_0xd48a('0xc')))[_0xd48a('0xd')]()[_0xd48a('0xe')](),'$lte':moment(moment(_0x38a860['$lte'])[_0xd48a('0xe')]('YYYY-MM-DD'))[_0xd48a('0xd')]()[_0xd48a('0xf')](0x1,'s')[_0xd48a('0xe')]()};_0x3382ba[_0x259391]=_0x327acf;}else if(_0x14c014[_0xd48a('0x10')]==='uniqueid'){_0x3382ba[_0x259391]=_0x3c0a62;}else{_0x3382ba[_0x259391]=_[_0xd48a('0x11')](_0x3c0a62)?_0x3c0a62:JSON['parse'](_0x3c0a62);}}else{_0x3382ba[_0x259391]=_[_0xd48a('0x11')](_0x3c0a62)?_0x3c0a62:JSON[_0xd48a('0x2')](_0x3c0a62);}}catch(_0x3ae5c8){_0x3382ba[_0x259391]=_0x3c0a62[_0xd48a('0x5')](',');}});}return _0x3382ba;};exports['limit']=function(_0x16e9cd){_0x16e9cd=parseInt(_0x16e9cd,0xa);if(!_0x16e9cd||_0x16e9cd<0x0){_0x16e9cd=LIMIT_VALUE;}return _0x16e9cd;};exports['offset']=function(_0x11d3c1){_0x11d3c1=parseInt(_0x11d3c1,0xa);if(!_0x11d3c1||_0x11d3c1<0x0){_0x11d3c1=0x0;}return _0x11d3c1;};exports[_0xd48a('0x12')]=function(_0x276ff3){var _0x2c2c0c,_0x5256e3=null;if(_0x276ff3){_0x2c2c0c=_0x276ff3[_0xd48a('0x5')](',');_0x5256e3=_[_0xd48a('0x13')](_0x2c2c0c,function(_0x3f2033){if(_0x3f2033[_0xd48a('0x14')]('-')===0x0){return[_0x3f2033===_0xd48a('0x15')?sequelize['cast'](sequelize['col'](_0xd48a('0x15')),_0xd48a('0x16')):_0x3f2033[_0xd48a('0x17')](0x1),_0xd48a('0x18')];}else{return[_0x3f2033===_0xd48a('0x15')?sequelize[_0xd48a('0x19')](sequelize[_0xd48a('0x1a')](_0xd48a('0x15')),_0xd48a('0x16')):_0x3f2033,_0xd48a('0x1b')];}});}return _0x5256e3;};exports[_0xd48a('0x1c')]=function(_0x509393,_0x527034){if(_[_0xd48a('0x6')](_0x509393)){return _0x509393;}if(_[_0xd48a('0x11')](_0x509393)){for(var _0x19a75a=0x0;_0x19a75a<_0x509393[_0xd48a('0x1d')];_0x19a75a+=0x1){_0x509393[_0x19a75a]=this[_0xd48a('0x1c')](_0x509393[_0x19a75a],_0x527034);}return _0x509393;}if(!_[_0xd48a('0x1e')](_0x509393)){return _0x509393;}if(_[_0xd48a('0x1f')](_0x527034)){_0x527034=[_0x527034];}if(!_[_0xd48a('0x11')](_0x527034)){return _0x509393;}for(var _0x4dfacc=0x0;_0x4dfacc<_0x527034[_0xd48a('0x1d')];_0x4dfacc+=0x1){_[_0xd48a('0x20')](_0x509393,_0x527034[_0x4dfacc]);}for(var _0x4070ee in _0x509393){if(_0x509393['hasOwnProperty'](_0x4070ee)){_0x509393[_0x4070ee]=this['omit'](_0x509393[_0x4070ee],_0x527034);}}return _0x509393;};exports[_0xd48a('0x21')]=function(_0x5ce2bd){return _0x5ce2bd[_0xd48a('0x22')](RegExp(_0xd48a('0x23')))?!![]:![];};exports[_0xd48a('0x24')]=function(_0xad93f1){return _0xad93f1[_0xd48a('0x22')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x27e73f){var _0x38979d=[];_0x27e73f[_0xd48a('0x5')](/[ ,]+/)['forEach'](function(_0x429d7a){_0x429d7a=_0x429d7a['replace'](/([^:]")"+/g,'$1');_0x429d7a='+'+_0x429d7a+'*';if(_0x429d7a['includes']('@'))_0x429d7a='\x22'+_0x429d7a+'\x22';_0x38979d[_0xd48a('0x25')](_0x429d7a);});return _0x38979d[_0xd48a('0x26')]('\x20');};exports[_0xd48a('0x27')]=function(_0x3438af,_0x533323,_0x10c124){var _0x55059a={},_0x437ab3={};if(_0x533323[_0xd48a('0x28')][_0xd48a('0x29')]){_0x533323[_0xd48a('0x28')]['id']=_0x533323[_0xd48a('0x28')][_0xd48a('0x29')];delete _0x533323[_0xd48a('0x28')][_0xd48a('0x29')];}_0x55059a[_0xd48a('0x2a')]=_['map'](_0x3438af,_0xd48a('0x10'));_0x55059a[_0xd48a('0x28')]=_[_0xd48a('0x3')](_0x533323[_0xd48a('0x28')]);_0x55059a['filters']=_[_0xd48a('0x2b')](_0x55059a[_0xd48a('0x2a')],_0x55059a['query']);_0x437ab3[_0xd48a('0x2c')]=_[_0xd48a('0x2b')](_0x55059a[_0xd48a('0x2a')],this[_0xd48a('0x4')](_0x533323['query'][_0xd48a('0x4')]));_0x437ab3[_0xd48a('0x2c')]=_0x437ab3[_0xd48a('0x2c')]['length']?_0x437ab3[_0xd48a('0x2c')]:_0x55059a[_0xd48a('0x2a')];if(!_0x533323['query']['hasOwnProperty']('nolimit')){_0x437ab3['limit']=this['limit'](_0x533323[_0xd48a('0x28')][_0xd48a('0x2d')]);_0x437ab3[_0xd48a('0x2e')]=this[_0xd48a('0x2e')](_0x533323[_0xd48a('0x28')][_0xd48a('0x2e')]);}_0x437ab3[_0xd48a('0x2f')]=this[_0xd48a('0x12')](_0x533323[_0xd48a('0x28')][_0xd48a('0x12')]);_0x437ab3[_0xd48a('0x30')]=this[_0xd48a('0x31')](_[_0xd48a('0x32')](_0x533323[_0xd48a('0x28')],_0x55059a[_0xd48a('0x31')]),_0x3438af);if(_0x533323['query']['filter']){_0x437ab3['where']=_['merge'](_0x437ab3[_0xd48a('0x30')],{'$or':_[_0xd48a('0x13')](_0x3438af,function(_0x414dea){if(_0x414dea[_0xd48a('0x9')]!=='VIRTUAL'){if(_0x10c124){return sequelize[_0xd48a('0x30')](sequelize['fn'](_0xd48a('0x33'),sequelize['col'](_0x414dea[_0xd48a('0x10')])),{'$like':sequelize['fn'](_0xd48a('0x33'),'%'+_0x533323[_0xd48a('0x28')]['filter']+'%')});}else{var _0x3ca62b={};_0x3ca62b[_0x414dea['name']]={'$like':'%'+_0x533323[_0xd48a('0x28')]['filter']+'%'};return _0x3ca62b;}}})});}_0x437ab3=_[_0xd48a('0x34')]({},_0x437ab3,_0x533323[_0xd48a('0x35')]);return _0x437ab3;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index c291801..f79bea7 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0983=['join','root','public','test','client','use','toISOString','split','static','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','serve-favicon','cookie-parser','errorhandler','passport','cors','moment','./environment','../mysqldb','default','get','production','set','appPath'];(function(_0x1d0228,_0x414fb0){var _0x190732=function(_0x38b9b0){while(--_0x38b9b0){_0x1d0228['push'](_0x1d0228['shift']());}};_0x190732(++_0x414fb0);}(_0x0983,0x101));var _0x3098=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x0983[_0x122096];return _0x3d1966;};'use strict';var express=require('express');var favicon=require(_0x3098('0x0'));var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require(_0x3098('0x1'));var errorHandler=require(_0x3098('0x2'));var path=require('path');var passport=require(_0x3098('0x3'));var cors=require(_0x3098('0x4'));var moment=require(_0x3098('0x5'));var config=require(_0x3098('0x6'));var db=require(_0x3098('0x7'))['db'];exports[_0x3098('0x8')]=function(_0x29b380){var _0x1b8bf1=_0x29b380[_0x3098('0x9')]('env');if(_0x1b8bf1===_0x3098('0xa')){_0x29b380[_0x3098('0xb')](_0x3098('0xc'),path[_0x3098('0xd')](config[_0x3098('0xe')],_0x3098('0xf')));}if(_0x1b8bf1==='development'||_0x1b8bf1===_0x3098('0x10')){_0x29b380[_0x3098('0xb')](_0x3098('0xc'),path[_0x3098('0xd')](config[_0x3098('0xe')],_0x3098('0x11')));_0x29b380[_0x3098('0x12')](errorHandler());}_0x29b380[_0x3098('0xb')]('json\x20replacer',function(_0x220c4a,_0x50e47a){if(this[_0x220c4a]instanceof Date){_0x50e47a=this[_0x220c4a][_0x3098('0x13')]()[_0x3098('0x14')]('.')[0x0]+'Z';}return _0x50e47a;});_0x29b380[_0x3098('0x12')](express[_0x3098('0x15')](_0x29b380['get'](_0x3098('0xc'))));_0x29b380[_0x3098('0xb')]('views',config['root']+'/server/views');_0x29b380['engine'](_0x3098('0x16'),require(_0x3098('0x17'))[_0x3098('0x18')]);_0x29b380[_0x3098('0xb')](_0x3098('0x19'),_0x3098('0x16'));_0x29b380['use'](bodyParser[_0x3098('0x1a')]({'limit':_0x3098('0x1b'),'extended':!![]}));_0x29b380[_0x3098('0x12')](bodyParser[_0x3098('0x1c')]({'limit':_0x3098('0x1b')}));_0x29b380[_0x3098('0x12')](cors());_0x29b380[_0x3098('0x12')](methodOverride());_0x29b380[_0x3098('0x12')](cookieParser());_0x29b380[_0x3098('0x12')](passport[_0x3098('0x1d')]());}; \ No newline at end of file +var _0xc35b=['client','use','json\x20replacer','toISOString','split','views','/server/views','renderFile','view\x20engine','html','urlencoded','50mb','json','initialize','express','body-parser','method-override','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','env','production','set','appPath','join','root','public','development','test'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc35b,0x103));var _0xbc35=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xc35b[_0x409353];return _0x4f4b59;};'use strict';var express=require(_0xbc35('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0xbc35('0x1'));var methodOverride=require(_0xbc35('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xbc35('0x3'));var path=require(_0xbc35('0x4'));var passport=require(_0xbc35('0x5'));var cors=require(_0xbc35('0x6'));var moment=require(_0xbc35('0x7'));var config=require(_0xbc35('0x8'));var db=require(_0xbc35('0x9'))['db'];exports[_0xbc35('0xa')]=function(_0x4cc110){var _0x4b9ee9=_0x4cc110[_0xbc35('0xb')](_0xbc35('0xc'));if(_0x4b9ee9===_0xbc35('0xd')){_0x4cc110[_0xbc35('0xe')](_0xbc35('0xf'),path[_0xbc35('0x10')](config[_0xbc35('0x11')],_0xbc35('0x12')));}if(_0x4b9ee9===_0xbc35('0x13')||_0x4b9ee9===_0xbc35('0x14')){_0x4cc110['set'](_0xbc35('0xf'),path[_0xbc35('0x10')](config[_0xbc35('0x11')],_0xbc35('0x15')));_0x4cc110[_0xbc35('0x16')](errorHandler());}_0x4cc110['set'](_0xbc35('0x17'),function(_0x322a89,_0x5c3d11){if(this[_0x322a89]instanceof Date){_0x5c3d11=this[_0x322a89][_0xbc35('0x18')]()[_0xbc35('0x19')]('.')[0x0]+'Z';}return _0x5c3d11;});_0x4cc110[_0xbc35('0x16')](express['static'](_0x4cc110[_0xbc35('0xb')](_0xbc35('0xf'))));_0x4cc110['set'](_0xbc35('0x1a'),config['root']+_0xbc35('0x1b'));_0x4cc110['engine']('html',require('ejs')[_0xbc35('0x1c')]);_0x4cc110['set'](_0xbc35('0x1d'),_0xbc35('0x1e'));_0x4cc110[_0xbc35('0x16')](bodyParser[_0xbc35('0x1f')]({'limit':_0xbc35('0x20'),'extended':!![]}));_0x4cc110[_0xbc35('0x16')](bodyParser[_0xbc35('0x21')]({'limit':_0xbc35('0x20')}));_0x4cc110[_0xbc35('0x16')](cors());_0x4cc110['use'](methodOverride());_0x4cc110[_0xbc35('0x16')](cookieParser());_0x4cc110[_0xbc35('0x16')](passport[_0xbc35('0x22')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index cd148fb..9e5b905 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 _0x9691=['concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','join','createHash','md5','update','hex','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','filter','IPv4','internal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9691,0xcc));var _0x1969=function(_0x30e9f0,_0x362a22){_0x30e9f0=_0x30e9f0-0x0;var _0x59c9fd=_0x9691[_0x30e9f0];return _0x59c9fd;};'use strict';var _=require(_0x1969('0x0'));var os=require('os');var crypto=require(_0x1969('0x1'));var machine=require(_0x1969('0x2'));var exec=require(_0x1969('0x3'))[_0x1969('0x4')];var config=require(_0x1969('0x5'));function getInterfaces(){var _0x3dcd84=[];var _0x14bf5a=os[_0x1969('0x6')]();var _0x3c2041=_[_0x1969('0x7')](_[_0x1969('0x8')](_0x14bf5a));for(var _0x244e12=0x0;_0x244e12<_0x3c2041['length'];_0x244e12++){var _0x244192=_0x14bf5a[_0x3c2041[_0x244e12]][_0x1969('0x9')](function(_0x4421da){return _0x4421da['family']===_0x1969('0xa')&&_0x4421da[_0x1969('0xb')]===![];});_0x3dcd84=_0x3dcd84[_0x1969('0xc')](_0x244192);}return _0x3dcd84;}function getFirstInterface(){var _0x1b2d7b=_[_0x1969('0xd')](getInterfaces());return{'macAddress':_0x1b2d7b&&_0x1b2d7b[_0x1969('0xe')]?_0x1b2d7b[_0x1969('0xe')]:_0x1969('0xf'),'ipAddress':_0x1b2d7b&&_0x1b2d7b['address']?_0x1b2d7b[_0x1969('0x10')]:_0x1969('0x11')};}exports[_0x1969('0x12')]=getFirstInterface;function getCPUhash(){var _0x3530fc=_[_0x1969('0x7')](os[_0x1969('0x13')]()[_0x1969('0x14')](function(_0x3e4514){return _0x3e4514['model'];}))[_0x1969('0x15')](':');return crypto[_0x1969('0x16')](_0x1969('0x17'))[_0x1969('0x18')](_0x3530fc)['digest'](_0x1969('0x19'));}exports['getUuid']=function(){var _0x2fd96c=os[_0x1969('0x1a')]();var _0x326c56=/[0-9a-f-]{36}/;if(config[_0x1969('0x1b')]&&_0x326c56[_0x1969('0x1c')](config['licenseToken'])){return config[_0x1969('0x1b')];}else if(_0x2fd96c===_0x1969('0x1d')){return exec(_0x1969('0x1e'),{'encoding':_0x1969('0x1f')})['replace']('\x0d\x0a','');}else{var _0x205924=getFirstInterface();var _0x38609b=getCPUhash();var _0x3cfb7a=_0x38609b+'|'+os[_0x1969('0x20')]()+'|'+_0x205924[_0x1969('0x21')]+'|'+_0x205924['ipAddress'];var _0x80b135=crypto[_0x1969('0x16')](_0x1969('0x17'))[_0x1969('0x18')](_0x3cfb7a)[_0x1969('0x22')](_0x1969('0x19'));return _0x80b135['substring'](0x0,0x8)+'-'+_0x80b135['substring'](0x8,0xc)+'-'+_0x80b135[_0x1969('0x23')](0xc,0x10)+'-'+_0x80b135[_0x1969('0x23')](0x10,0x14)+'-'+_0x80b135[_0x1969('0x23')](0x14);}}; \ No newline at end of file +var _0xea43=['macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0xea43,0x150));var _0x3ea4=function(_0x2a1191,_0x233115){_0x2a1191=_0x2a1191-0x0;var _0x2a420e=_0xea43[_0x2a1191];return _0x2a420e;};'use strict';var _=require(_0x3ea4('0x0'));var os=require('os');var crypto=require(_0x3ea4('0x1'));var machine=require(_0x3ea4('0x2'));var exec=require('child_process')[_0x3ea4('0x3')];var config=require(_0x3ea4('0x4'));function getInterfaces(){var _0x3c07f9=[];var _0x3ad820=os[_0x3ea4('0x5')]();var _0xc48a27=_[_0x3ea4('0x6')](_[_0x3ea4('0x7')](_0x3ad820));for(var _0x1f3836=0x0;_0x1f3836<_0xc48a27[_0x3ea4('0x8')];_0x1f3836++){var _0x593665=_0x3ad820[_0xc48a27[_0x1f3836]][_0x3ea4('0x9')](function(_0x5073dd){return _0x5073dd[_0x3ea4('0xa')]===_0x3ea4('0xb')&&_0x5073dd[_0x3ea4('0xc')]===![];});_0x3c07f9=_0x3c07f9[_0x3ea4('0xd')](_0x593665);}return _0x3c07f9;}function getFirstInterface(){var _0x7d44b2=_[_0x3ea4('0xe')](getInterfaces());return{'macAddress':_0x7d44b2&&_0x7d44b2['mac']?_0x7d44b2['mac']:_0x3ea4('0xf'),'ipAddress':_0x7d44b2&&_0x7d44b2[_0x3ea4('0x10')]?_0x7d44b2[_0x3ea4('0x10')]:_0x3ea4('0x11')};}exports[_0x3ea4('0x12')]=getFirstInterface;function getCPUhash(){var _0x236533=_[_0x3ea4('0x6')](os[_0x3ea4('0x13')]()['map'](function(_0x83de2c){return _0x83de2c[_0x3ea4('0x14')];}))[_0x3ea4('0x15')](':');return crypto[_0x3ea4('0x16')](_0x3ea4('0x17'))[_0x3ea4('0x18')](_0x236533)[_0x3ea4('0x19')](_0x3ea4('0x1a'));}exports[_0x3ea4('0x1b')]=function(){var _0x28b094=os[_0x3ea4('0x1c')]();var _0x889d47=/[0-9a-f-]{36}/;if(config[_0x3ea4('0x1d')]&&_0x889d47[_0x3ea4('0x1e')](config[_0x3ea4('0x1d')])){return config['licenseToken'];}else if(_0x28b094==='win32'){return exec(_0x3ea4('0x1f'),{'encoding':_0x3ea4('0x20')})[_0x3ea4('0x21')]('\x0d\x0a','');}else{var _0x4826b3=getFirstInterface();var _0x2b89f8=getCPUhash();var _0x65f63d=_0x2b89f8+'|'+os['hostname']()+'|'+_0x4826b3[_0x3ea4('0x22')]+'|'+_0x4826b3[_0x3ea4('0x23')];var _0x352b75=crypto[_0x3ea4('0x16')]('md5')[_0x3ea4('0x18')](_0x65f63d)[_0x3ea4('0x19')](_0x3ea4('0x1a'));return _0x352b75[_0x3ea4('0x24')](0x0,0x8)+'-'+_0x352b75[_0x3ea4('0x24')](0x8,0xc)+'-'+_0x352b75[_0x3ea4('0x24')](0xc,0x10)+'-'+_0x352b75[_0x3ea4('0x24')](0x10,0x14)+'-'+_0x352b75[_0x3ea4('0x24')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 8477969..7cad7fe 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 _0xbe5e=['format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','error','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','moment','request-promise','bluebird','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','version'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xbe5e,0x143));var _0xebe5=function(_0x3ac8ec,_0x38df56){_0x3ac8ec=_0x3ac8ec-0x0;var _0x5122b1=_0xbe5e[_0x3ac8ec];return _0x5122b1;};'use strict';var util=require('util');var moment=require(_0xebe5('0x0'));var rp=require(_0xebe5('0x1'));var BPromise=require(_0xebe5('0x2'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0xebe5('0x3'))['db'];var encryptor=require(_0xebe5('0x4'));var hardware=require(_0xebe5('0x5'));var logger=require('../logger')(_0xebe5('0x6'));var HOST=_0xebe5('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x42b933){return new BPromise(function(_0x3127eb,_0x9f499d){var _0x5c2af6=util['format'](_0xebe5('0x8'),HOST,_0x42b933,module['exports'][_0xebe5('0x9')]);if(oldToken){_0x5c2af6=util[_0xebe5('0xa')](_0xebe5('0xb'),HOST,_0x42b933,module['exports']['version'],oldToken);}var _0x57f823={'uri':_0x5c2af6,'method':_0xebe5('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x57f823)[_0xebe5('0xd')](function(_0x5b2fa0){_0x3127eb(_0x5b2fa0);})[_0xebe5('0xe')](function(_0x2ea71d){_0x9f499d(_0x2ea71d);});});}function manageLicense(_0x4241c8,_0x554922){var _0x191fa3=_0x554922[_0xebe5('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x191fa3[_0xebe5('0x10')]!==_0x4241c8&&!_0x191fa3[_0xebe5('0x11')]){oldToken=_0x191fa3[_0xebe5('0x10')];}httpRequest(_0x4241c8)[_0xebe5('0xd')](function(_0x41de3e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x41de3e[_0xebe5('0x12')]){isOldTokenSent=![];if(!_0x191fa3[_0xebe5('0x6')]&&_0x191fa3['license']!=_0x41de3e[_0xebe5('0x6')]||_0x191fa3[_0xebe5('0x6')]&&_0x191fa3['data2']){logger['info'](_0xebe5('0x13'));}if(_0x191fa3['license']&&!_0x191fa3[_0xebe5('0x11')]&&_0x191fa3['license']!=_0x41de3e['license']){logger[_0xebe5('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x191fa3[_0xebe5('0x6')]&&!_0x191fa3[_0xebe5('0x11')]&&_0x191fa3[_0xebe5('0x6')]==_0x41de3e[_0xebe5('0x6')]){return _0x554922;}return _0x554922[_0xebe5('0x15')]({'data1':_0x4241c8,'data2':null,'license':_0x41de3e['license']});}else{if(_0x41de3e[_0xebe5('0x6')]||_0x191fa3[_0xebe5('0x6')]){if(!_0x191fa3['data2']){if(_0x191fa3['data1']==_0x4241c8){GRAY_PERIOD_REASON=_0xebe5('0x16');logger[_0xebe5('0x14')](_0xebe5('0x17'));}else{GRAY_PERIOD_REASON=_0xebe5('0x18');logger[_0xebe5('0x14')](_0xebe5('0x19'),_0x191fa3[_0xebe5('0x10')],_0x4241c8);}logger[_0xebe5('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xebe5('0x1a')](),moment()[_0xebe5('0xa')](_0xebe5('0x1b')));return _0x554922[_0xebe5('0x15')]({'data2':encryptor[_0xebe5('0x1c')](moment()[_0xebe5('0xa')](_0xebe5('0x1b')))});}else{if(moment()[_0xebe5('0x1d')](encryptor[_0xebe5('0x1e')](_0x191fa3[_0xebe5('0x11')]),_0xebe5('0x1f'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0xebe5('0xa')](_0xebe5('0x1b')));isOldTokenSent=![];return _0x554922[_0xebe5('0x15')]({'data1':_0x4241c8,'data2':null,'license':null});}}}else{if(_0x191fa3[_0xebe5('0x10')]!=_0x4241c8){logger['info'](_0xebe5('0x19'),_0x191fa3[_0xebe5('0x10')],_0x4241c8);return _0x554922['update']({'data1':_0x4241c8,'data2':null,'license':null});}}}return _0x554922;})[_0xebe5('0xd')](function(_0x48e7ab){_0x554922=_0x48e7ab;})['catch'](function(_0x42aa84){logger[_0xebe5('0x20')](_0x42aa84['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xebe5('0x21')](),_0x554922);},TIME);});}function defaultLicense(){var _0x4e3bf4=hardware['getUuid']();if(_0x4e3bf4){return db['License'][_0xebe5('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x4e3bf4}})[_0xebe5('0x23')](function(_0x59fb1d,_0x53ff99){logger[_0xebe5('0x14')](_0xebe5('0x24'),_0x4e3bf4);manageLicense(_0x4e3bf4,_0x59fb1d);})[_0xebe5('0xe')](function(_0x7697e1){logger[_0xebe5('0x20')](_0x7697e1['message']);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x6bcb=['util','moment','request-promise','bluebird','pkginfo','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','GET','then','catch','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default'];(function(_0x3754d6,_0x2822e0){var _0xbb2448=function(_0x215d29){while(--_0x215d29){_0x3754d6['push'](_0x3754d6['shift']());}};_0xbb2448(++_0x2822e0);}(_0x6bcb,0x7b));var _0xb6bc=function(_0x14477e,_0x44d4da){_0x14477e=_0x14477e-0x0;var _0x5d4a05=_0x6bcb[_0x14477e];return _0x5d4a05;};'use strict';var util=require(_0xb6bc('0x0'));var moment=require(_0xb6bc('0x1'));var rp=require(_0xb6bc('0x2'));var BPromise=require(_0xb6bc('0x3'));var pkginfo=require(_0xb6bc('0x4'))(module,'version');var db=require(_0xb6bc('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xb6bc('0x6'));var logger=require(_0xb6bc('0x7'))(_0xb6bc('0x8'));var HOST=_0xb6bc('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x13d0fe){return new BPromise(function(_0xbf663a,_0x37cb10){var _0xa5ece8=util[_0xb6bc('0xa')](_0xb6bc('0xb'),HOST,_0x13d0fe,module[_0xb6bc('0xc')][_0xb6bc('0xd')]);if(oldToken){_0xa5ece8=util[_0xb6bc('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x13d0fe,module[_0xb6bc('0xc')][_0xb6bc('0xd')],oldToken);}var _0x3abdd6={'uri':_0xa5ece8,'method':_0xb6bc('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x3abdd6)[_0xb6bc('0xf')](function(_0x5a8e45){_0xbf663a(_0x5a8e45);})[_0xb6bc('0x10')](function(_0x1d509d){_0x37cb10(_0x1d509d);});});}function manageLicense(_0x5661a6,_0x133b64){var _0x112247=_0x133b64[_0xb6bc('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x112247[_0xb6bc('0x12')]!==_0x5661a6&&!_0x112247['data2']){oldToken=_0x112247['data1'];}httpRequest(_0x5661a6)[_0xb6bc('0xf')](function(_0x57a8f3){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x57a8f3[_0xb6bc('0x13')]){isOldTokenSent=![];if(!_0x112247[_0xb6bc('0x8')]&&_0x112247[_0xb6bc('0x8')]!=_0x57a8f3['license']||_0x112247[_0xb6bc('0x8')]&&_0x112247[_0xb6bc('0x14')]){logger[_0xb6bc('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x112247[_0xb6bc('0x8')]&&!_0x112247[_0xb6bc('0x14')]&&_0x112247[_0xb6bc('0x8')]!=_0x57a8f3[_0xb6bc('0x8')]){logger[_0xb6bc('0x15')](_0xb6bc('0x16'));}if(_0x112247['license']&&!_0x112247[_0xb6bc('0x14')]&&_0x112247[_0xb6bc('0x8')]==_0x57a8f3[_0xb6bc('0x8')]){return _0x133b64;}return _0x133b64[_0xb6bc('0x17')]({'data1':_0x5661a6,'data2':null,'license':_0x57a8f3[_0xb6bc('0x8')]});}else{if(_0x57a8f3[_0xb6bc('0x8')]||_0x112247[_0xb6bc('0x8')]){if(!_0x112247[_0xb6bc('0x14')]){if(_0x112247[_0xb6bc('0x12')]==_0x5661a6){GRAY_PERIOD_REASON=_0xb6bc('0x18');logger[_0xb6bc('0x15')](_0xb6bc('0x19'));}else{GRAY_PERIOD_REASON=_0xb6bc('0x1a');logger['info'](_0xb6bc('0x1b'),_0x112247[_0xb6bc('0x12')],_0x5661a6);}logger[_0xb6bc('0x15')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xb6bc('0x1c')](),moment()[_0xb6bc('0xa')](_0xb6bc('0x1d')));return _0x133b64[_0xb6bc('0x17')]({'data2':encryptor[_0xb6bc('0x1e')](moment()[_0xb6bc('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor['decryptString'](_0x112247[_0xb6bc('0x14')]),_0xb6bc('0x1f'))>DAYS){logger[_0xb6bc('0x15')](_0xb6bc('0x20'),moment()['format'](_0xb6bc('0x1d')));isOldTokenSent=![];return _0x133b64['update']({'data1':_0x5661a6,'data2':null,'license':null});}}}else{if(_0x112247['data1']!=_0x5661a6){logger['info'](_0xb6bc('0x1b'),_0x112247['data1'],_0x5661a6);return _0x133b64[_0xb6bc('0x17')]({'data1':_0x5661a6,'data2':null,'license':null});}}}return _0x133b64;})['then'](function(_0x5a07fb){_0x133b64=_0x5a07fb;})[_0xb6bc('0x10')](function(_0xb6ed39){logger[_0xb6bc('0x21')](_0xb6ed39[_0xb6bc('0x22')]);})[_0xb6bc('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0xb6bc('0x24')](),_0x133b64);},TIME);});}function defaultLicense(){var _0xb71abb=hardware[_0xb6bc('0x24')]();if(_0xb71abb){return db[_0xb6bc('0x25')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0xb71abb}})[_0xb6bc('0x26')](function(_0x2e3da2,_0x513374){logger[_0xb6bc('0x15')](_0xb6bc('0x27'),_0xb71abb);manageLicense(_0xb71abb,_0x2e3da2);})[_0xb6bc('0x10')](function(_0xa13708){logger['error'](_0xa13708[_0xb6bc('0x22')]);});}}exports[_0xb6bc('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index a1beefd..8a19221 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 _0xd94c=['gray','deadline','add','days','grayReason','changed','message','User','role','sequelize','COUNT','count','admin','user','telephone','users','telephones','forEach','catch','pick','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','then','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','demo','uuid','machineUuid'];(function(_0x4a5849,_0x2406a5){var _0x187ab0=function(_0x8a7dd8){while(--_0x8a7dd8){_0x4a5849['push'](_0x4a5849['shift']());}};_0x187ab0(++_0x2406a5);}(_0xd94c,0x1c4));var _0xcd94=function(_0x5307b0,_0x1f1e3c){_0x5307b0=_0x5307b0-0x0;var _0x1421b8=_0xd94c[_0x5307b0];return _0x1421b8;};'use strict';var util=require(_0xcd94('0x0'));var _=require(_0xcd94('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0xcd94('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0xcd94('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcd94('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xcd94('0x5'),'machineUuid':hardware[_0xcd94('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcd94('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xcd94('0x7'),'machineUuid':hardware[_0xcd94('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x170ee0){return new BPromise(function(_0x1fd5e5,_0xba0d88){return db[_0xcd94('0x8')]['find'](_['defaults'](_0x170ee0,{'raw':!![],'where':{'id':0x1}}))[_0xcd94('0x9')](function(_0x24df0d){return checkLicense(_0x24df0d,null);})[_0xcd94('0x9')](function(_0x335dfd){_0x1fd5e5(_0x335dfd);return;})['catch'](function(_0x5c70d3){_0xba0d88(_0x5c70d3);});});}function checkLicense(_0x1281d3,_0x46337d){if(!_0x1281d3){demoLicense['uuid']=_0x1281d3[_0xcd94('0xa')];return demoLicense;}try{var _0x5b2fbe=_0x46337d||_0x1281d3[_0xcd94('0xb')];if(_['isEmpty'](_0x5b2fbe)){throw new Error(_0xcd94('0xc'));}var _0x18c365=_0x1281d3[_0xcd94('0xa')];var _0x394400=_0x1281d3[_0xcd94('0xd')];var _0x5472f4=_0x18c365[_0xcd94('0xe')]('-')[0x4];var _0x327c6e=_0x18c365['split']('-')[0x0];var _0x4ebcbb=encryptor[_0xcd94('0xf')](_0x5b2fbe,util[_0xcd94('0x10')]('%s:%s:%s',_0x5472f4,_0x18c365,_0x327c6e));var _0x4c066b=JSON[_0xcd94('0x11')](_0x4ebcbb);_0x4c066b[_0xcd94('0x12')]=![];_0x4c066b[_0xcd94('0x13')]=_0x18c365;_0x4c066b[_0xcd94('0x14')]=hardware['getUuid']();if(_0x394400){var _0x4f8d6a=encryptor[_0xcd94('0xf')](_0x394400);_0x4c066b[_0xcd94('0x15')]=_0x4f8d6a;_0x4c066b[_0xcd94('0x16')]=moment(_0x4f8d6a)[_0xcd94('0x17')](0x7,_0xcd94('0x18'))[_0xcd94('0x10')]();_0x4c066b[_0xcd94('0x19')]=_0x4c066b[_0xcd94('0x13')]!=_0x4c066b[_0xcd94('0x14')]?_0xcd94('0x1a'):'disabled';}return _0x4c066b;}catch(_0x2171bc){breakingLicense[_0xcd94('0x13')]=_0x1281d3[_0xcd94('0xa')];breakingLicense[_0xcd94('0x1b')]=_0x2171bc[_0xcd94('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x47c721,_0x1bd989){getLicense()['then'](function(_0x46e495){return db[_0xcd94('0x1c')]['findAll']({'attributes':[_0xcd94('0x1d'),[db[_0xcd94('0x1e')]['fn'](_0xcd94('0x1f'),db[_0xcd94('0x1e')]['col'](_0xcd94('0x1d'))),_0xcd94('0x20')]],'group':'role','where':{'role':{'$or':[_0xcd94('0x21'),_0xcd94('0x22'),_0xcd94('0x23')]}},'raw':!![]})[_0xcd94('0x9')](function(_0x382399){var _0x2a462b={'user':_0x46e495[_0xcd94('0x24')]||0x0,'telephone':_0x46e495[_0xcd94('0x25')]||0x0};_0x382399[_0xcd94('0x26')](function(_0x3b2336){var _0x474144=_0x3b2336['role']===_0xcd94('0x21')?_0xcd94('0x22'):_0x3b2336[_0xcd94('0x1d')];_0x2a462b[_0x474144]-=_0x3b2336[_0xcd94('0x20')];if(_0x2a462b[_0x474144]<0x0)_0x2a462b[_0x474144]=0x0;});_0x47c721(_0x2a462b);return;});})[_0xcd94('0x27')](function(_0x444440){_0x1bd989(_0x444440);});});}function checkUserLimits(_0x32b87e){return new BPromise(function(_0x471dfd,_0x1019cc){getLimits()[_0xcd94('0x9')](function(_0x14feeb){var _0x28105c=_[_0xcd94('0x28')](_['countBy'](_0x32b87e,_0xcd94('0x1d')),[_0xcd94('0x21'),_0xcd94('0x22'),_0xcd94('0x23')]);var _0x1d46d3=(_0x28105c[_0xcd94('0x21')]||0x0)+(_0x28105c[_0xcd94('0x22')]||0x0);var _0x5385c7=_0x28105c['telephone']||0x0;if(_0x1d46d3>_0x14feeb[_0xcd94('0x22')])return _0x1019cc(_0xcd94('0x29'));if(_0x5385c7>_0x14feeb[_0xcd94('0x23')])return _0x1019cc('License\x20limit\x20reached\x20for\x20telephones');return _0x471dfd();})[_0xcd94('0x27')](function(_0x3f46cd){_0x1019cc(_0x3f46cd);});});}module[_0xcd94('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xd3a3=['License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../mysqldb','Demo\x20license','getUuid','defaults','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','parse','demo','uuid','machineUuid','decryptString','deadline','add','grayReason','message','User','findAll','role','COUNT','sequelize','col','admin','then','users','telephones','forEach','user','count','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users'];(function(_0x396278,_0x49f698){var _0x30286b=function(_0x4c299c){while(--_0x4c299c){_0x396278['push'](_0x396278['shift']());}};_0x30286b(++_0x49f698);}(_0xd3a3,0xb6));var _0x3d3a=function(_0x5e12e5,_0x351f55){_0x5e12e5=_0x5e12e5-0x0;var _0x5b2efa=_0xd3a3[_0x5e12e5];return _0x5b2efa;};'use strict';var util=require(_0x3d3a('0x0'));var _=require(_0x3d3a('0x1'));var moment=require(_0x3d3a('0x2'));var BPromise=require('bluebird');var hardware=require(_0x3d3a('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0x3d3a('0x4'))['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':_0x3d3a('0x5'),'machineUuid':hardware['getUuid'](),'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':'Breaking\x20license','machineUuid':hardware[_0x3d3a('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4835af){return new BPromise(function(_0x3eb449,_0x47d55a){return db['License']['find'](_[_0x3d3a('0x7')](_0x4835af,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x12fe88){return checkLicense(_0x12fe88,null);})['then'](function(_0x83d70e){_0x3eb449(_0x83d70e);return;})[_0x3d3a('0x8')](function(_0x3aad50){_0x47d55a(_0x3aad50);});});}function checkLicense(_0x1bfc89,_0x2c510e){if(!_0x1bfc89){demoLicense['uuid']=_0x1bfc89[_0x3d3a('0x9')];return demoLicense;}try{var _0x277133=_0x2c510e||_0x1bfc89[_0x3d3a('0xa')];if(_[_0x3d3a('0xb')](_0x277133)){throw new Error(_0x3d3a('0xc'));}var _0x8e8d41=_0x1bfc89[_0x3d3a('0x9')];var _0x2f92cc=_0x1bfc89[_0x3d3a('0xd')];var _0x2e7274=_0x8e8d41[_0x3d3a('0xe')]('-')[0x4];var _0x45e194=_0x8e8d41['split']('-')[0x0];var _0x1a82a0=encryptor['decryptString'](_0x277133,util[_0x3d3a('0xf')](_0x3d3a('0x10'),_0x2e7274,_0x8e8d41,_0x45e194));var _0x249ed6=JSON[_0x3d3a('0x11')](_0x1a82a0);_0x249ed6[_0x3d3a('0x12')]=![];_0x249ed6[_0x3d3a('0x13')]=_0x8e8d41;_0x249ed6[_0x3d3a('0x14')]=hardware[_0x3d3a('0x6')]();if(_0x2f92cc){var _0x37b1de=encryptor[_0x3d3a('0x15')](_0x2f92cc);_0x249ed6['gray']=_0x37b1de;_0x249ed6[_0x3d3a('0x16')]=moment(_0x37b1de)[_0x3d3a('0x17')](0x7,'days')[_0x3d3a('0xf')]();_0x249ed6[_0x3d3a('0x18')]=_0x249ed6[_0x3d3a('0x13')]!=_0x249ed6[_0x3d3a('0x14')]?'changed':'disabled';}return _0x249ed6;}catch(_0x2527fc){breakingLicense[_0x3d3a('0x13')]=_0x1bfc89[_0x3d3a('0x9')];breakingLicense[_0x3d3a('0x19')]=_0x2527fc[_0x3d3a('0x19')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2c8008,_0xabe79e){getLicense()['then'](function(_0x5ecb3a){return db[_0x3d3a('0x1a')][_0x3d3a('0x1b')]({'attributes':[_0x3d3a('0x1c'),[db['sequelize']['fn'](_0x3d3a('0x1d'),db[_0x3d3a('0x1e')][_0x3d3a('0x1f')](_0x3d3a('0x1c'))),'count']],'group':_0x3d3a('0x1c'),'where':{'role':{'$or':[_0x3d3a('0x20'),'user','telephone']}},'raw':!![]})[_0x3d3a('0x21')](function(_0xe00b7c){var _0xec5059={'user':_0x5ecb3a[_0x3d3a('0x22')]||0x0,'telephone':_0x5ecb3a[_0x3d3a('0x23')]||0x0};_0xe00b7c[_0x3d3a('0x24')](function(_0x52505b){var _0x1cb610=_0x52505b[_0x3d3a('0x1c')]===_0x3d3a('0x20')?_0x3d3a('0x25'):_0x52505b[_0x3d3a('0x1c')];_0xec5059[_0x1cb610]-=_0x52505b[_0x3d3a('0x26')];if(_0xec5059[_0x1cb610]<0x0)_0xec5059[_0x1cb610]=0x0;});_0x2c8008(_0xec5059);return;});})[_0x3d3a('0x8')](function(_0x1b0913){_0xabe79e(_0x1b0913);});});}function checkUserLimits(_0x52fec8){return new BPromise(function(_0x7a7be5,_0x2c5d11){getLimits()[_0x3d3a('0x21')](function(_0x2f2815){var _0x8f2e26=_[_0x3d3a('0x27')](_[_0x3d3a('0x28')](_0x52fec8,_0x3d3a('0x1c')),[_0x3d3a('0x20'),'user','telephone']);var _0x6369d4=(_0x8f2e26[_0x3d3a('0x20')]||0x0)+(_0x8f2e26[_0x3d3a('0x25')]||0x0);var _0x31e888=_0x8f2e26[_0x3d3a('0x29')]||0x0;if(_0x6369d4>_0x2f2815[_0x3d3a('0x25')])return _0x2c5d11(_0x3d3a('0x2a'));if(_0x31e888>_0x2f2815[_0x3d3a('0x29')])return _0x2c5d11(_0x3d3a('0x2b'));return _0x7a7be5();})[_0x3d3a('0x8')](function(_0xd3a8a9){_0x2c5d11(_0xd3a8a9);});});}module[_0x3d3a('0x2c')]={'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 4e934f2..c970e0e 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 _0xd4f4=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x5d37f2,_0x40b508){var _0x2ba122=function(_0x1a5984){while(--_0x1a5984){_0x5d37f2['push'](_0x5d37f2['shift']());}};_0x2ba122(++_0x40b508);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x1049cb,_0x1354a0){_0x1049cb=_0x1049cb-0x0;var _0x792be4=_0xd4f4[_0x1049cb];return _0x792be4;};'use strict';module[_0x4d4f('0x0')]={'DOMAIN':_0x4d4f('0x1'),'SESSION_SECRET':_0x4d4f('0x2'),'GOOGLE_ID':_0x4d4f('0x3'),'GOOGLE_SECRET':_0x4d4f('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xa30a=['http://localhost:9000','myappanuglar-secret','secret','exports'];(function(_0xc0a626,_0x3f3d91){var _0x2717b6=function(_0x3fb8a7){while(--_0x3fb8a7){_0xc0a626['push'](_0xc0a626['shift']());}};_0x2717b6(++_0x3f3d91);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';module[_0xaa30('0x0')]={'DOMAIN':_0xaa30('0x1'),'SESSION_SECRET':_0xaa30('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xaa30('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index ed6c699..125daa5 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7224=['join','/var','log','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','exports','Logger','transports','File','%s-%s','error','info','env','debugLevel','moment','util'];(function(_0x46ba12,_0x47cf95){var _0x3c2297=function(_0x1f8428){while(--_0x1f8428){_0x46ba12['push'](_0x46ba12['shift']());}};_0x3c2297(++_0x47cf95);}(_0x7224,0xe5));var _0x4722=function(_0x35db17,_0x8d64da){_0x35db17=_0x35db17-0x0;var _0x73f088=_0x7224[_0x35db17];return _0x73f088;};'use strict';var moment=require(_0x4722('0x0'));var winston=require('winston');var util=require(_0x4722('0x1'));var path=require('path');var debugLevel='INFO';function filename(_0x58b80a,_0x378ef1){return path[_0x4722('0x2')](_0x4722('0x3'),_0x4722('0x4'),'xcally',util[_0x4722('0x5')](_0x4722('0x6'),_0x58b80a,_0x378ef1));}function formatter(_0x1ad5cb,_0x5df8ea){_0x5df8ea[_0x4722('0x7')]=_0x5df8ea[_0x4722('0x7')]['replace'](/@@{/g,'{{{')[_0x4722('0x8')](/}@@/g,_0x4722('0x9'))[_0x4722('0x8')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x4722('0x5')](_0x4722('0xa'),moment()[_0x4722('0x5')](_0x4722('0xb')),_0x5df8ea['level']['toUpperCase'](),_0x1ad5cb,_0x5df8ea[_0x4722('0x7')]);}module[_0x4722('0xc')]=function(_0x46acf2){return new winston[(_0x4722('0xd'))]({'transports':[new winston[(_0x4722('0xe'))][(_0x4722('0xf'))]({'name':util[_0x4722('0x5')](_0x4722('0x10'),_0x46acf2,_0x4722('0x11')),'filename':filename(_0x46acf2,_0x4722('0x11')),'level':_0x4722('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2918b8){return formatter(_0x46acf2,_0x2918b8);}}),new winston['transports'][(_0x4722('0xf'))]({'name':util[_0x4722('0x5')](_0x4722('0x10'),_0x46acf2,_0x4722('0x12')),'filename':filename(_0x46acf2,_0x4722('0x12')),'level':_0x4722('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x26bcbf){return formatter(_0x46acf2,_0x26bcbf);}}),new winston[(_0x4722('0xe'))]['Console']({'level':process[_0x4722('0x13')][_0x4722('0x14')]||debugLevel,'json':![],'formatter':function(_0x42c260){return formatter(_0x46acf2,_0x42c260);}})]});}; \ No newline at end of file +var _0x07a5=['replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','Logger','%s-%s','error','transports','File','info','Console','env','debugLevel','moment','winston','util','path','INFO','join','log','xcally','format','%s-%s.log','message'];(function(_0x5c1421,_0x5e5516){var _0x248528=function(_0x1bb102){while(--_0x1bb102){_0x5c1421['push'](_0x5c1421['shift']());}};_0x248528(++_0x5e5516);}(_0x07a5,0x12d));var _0x507a=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x07a5[_0x277107];return _0x1da046;};'use strict';var moment=require(_0x507a('0x0'));var winston=require(_0x507a('0x1'));var util=require(_0x507a('0x2'));var path=require(_0x507a('0x3'));var debugLevel=_0x507a('0x4');function filename(_0x4ada96,_0xb1d2d4){return path[_0x507a('0x5')]('/var',_0x507a('0x6'),_0x507a('0x7'),util[_0x507a('0x8')](_0x507a('0x9'),_0x4ada96,_0xb1d2d4));}function formatter(_0x178ade,_0x4d6d64){_0x4d6d64[_0x507a('0xa')]=_0x4d6d64[_0x507a('0xa')][_0x507a('0xb')](/@@{/g,_0x507a('0xc'))['replace'](/}@@/g,_0x507a('0xd'))[_0x507a('0xb')](/@{/g,'{{')[_0x507a('0xb')](/}@/g,'}}');return util[_0x507a('0x8')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x507a('0x8')](_0x507a('0xe')),_0x4d6d64['level'][_0x507a('0xf')](),_0x178ade,_0x4d6d64[_0x507a('0xa')]);}module[_0x507a('0x10')]=function(_0x1f7de7){return new winston[(_0x507a('0x11'))]({'transports':[new winston['transports']['File']({'name':util[_0x507a('0x8')](_0x507a('0x12'),_0x1f7de7,_0x507a('0x13')),'filename':filename(_0x1f7de7,_0x507a('0x13')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2914ee){return formatter(_0x1f7de7,_0x2914ee);}}),new winston[(_0x507a('0x14'))][(_0x507a('0x15'))]({'name':util[_0x507a('0x8')]('%s-%s',_0x1f7de7,_0x507a('0x16')),'filename':filename(_0x1f7de7,_0x507a('0x16')),'level':_0x507a('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x35db06){return formatter(_0x1f7de7,_0x35db06);}}),new winston['transports'][(_0x507a('0x17'))]({'level':process[_0x507a('0x18')][_0x507a('0x19')]||debugLevel,'json':![],'formatter':function(_0x4ecbc0){return formatter(_0x1f7de7,_0x4ecbc0);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 3b4967b..f82c3a2 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 _0xf80a=['path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x3cd0c2,_0x4dc250){var _0x566ea6=function(_0x2a2311){while(--_0x2a2311){_0x3cd0c2['push'](_0x3cd0c2['shift']());}};_0x566ea6(++_0x4dc250);}(_0xf80a,0x1d1));var _0xaf80=function(_0x133f0b,_0x49e3a7){_0x133f0b=_0x133f0b-0x0;var _0x1a0cf4=_0xf80a[_0x133f0b];return _0x1a0cf4;};'use strict';var path=require(_0xaf80('0x0'));var os=require('os');var config={'apps':[{'name':_0xaf80('0x1'),'script':path[_0xaf80('0x2')](__dirname,_0xaf80('0x3'))},{'name':_0xaf80('0x4'),'script':path[_0xaf80('0x2')](__dirname,_0xaf80('0x5'))},{'name':_0xaf80('0x6'),'script':path[_0xaf80('0x2')](__dirname,_0xaf80('0x7'))},{'name':_0xaf80('0x8'),'script':path[_0xaf80('0x2')](__dirname,_0xaf80('0x9'))},{'name':_0xaf80('0xa'),'script':path['join'](__dirname,_0xaf80('0xb'))},{'name':_0xaf80('0xc'),'script':path[_0xaf80('0x2')](__dirname,_0xaf80('0xd'))}]};module[_0xaf80('0xe')]=config; \ No newline at end of file +var _0x4440=['express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path'];(function(_0x343dbb,_0x5158ba){var _0x3c0a45=function(_0x1ea39c){while(--_0x1ea39c){_0x343dbb['push'](_0x343dbb['shift']());}};_0x3c0a45(++_0x5158ba);}(_0x4440,0x81));var _0x0444=function(_0x5f4129,_0x26eb9a){_0x5f4129=_0x5f4129-0x0;var _0x27fd6c=_0x4440[_0x5f4129];return _0x27fd6c;};'use strict';var path=require(_0x0444('0x0'));var os=require('os');var config={'apps':[{'name':_0x0444('0x1'),'script':path[_0x0444('0x2')](__dirname,_0x0444('0x3'))},{'name':_0x0444('0x4'),'script':path['join'](__dirname,_0x0444('0x5'))},{'name':_0x0444('0x6'),'script':path[_0x0444('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0x0444('0x7'),'script':path[_0x0444('0x2')](__dirname,_0x0444('0x8'))},{'name':'routing','script':path[_0x0444('0x2')](__dirname,_0x0444('0x9'))},{'name':_0x0444('0xa'),'script':path['join'](__dirname,_0x0444('0xb'))}]};module[_0x0444('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 54511ce..dd38cb5 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 _0xa72e=['start','disconnect','stop','restart','then','list','describe','delete','dump','saved','pm2','bluebird','./config','connected'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xa72e,0x1a0));var _0xea72=function(_0xd09df6,_0x24ba0e){_0xd09df6=_0xd09df6-0x0;var _0x2ab578=_0xa72e[_0xd09df6];return _0x2ab578;};'use strict';var pm2=require(_0xea72('0x0'));var BPromise=require(_0xea72('0x1'));var config=require(_0xea72('0x2'));function connect(){return new BPromise(function(_0x2daa9f,_0x420b25){return pm2['connect'](function(_0x2d9309){if(_0x2d9309){return _0x420b25(_0x2d9309);}return _0x2daa9f(_0xea72('0x3'));});});};exports[_0xea72('0x4')]=function(_0x1393f3){return connect()['then'](function(){return new BPromise(function(_0x49e067,_0x3165b7){return pm2[_0xea72('0x4')](_0x1393f3,function(_0x46a0eb,_0x4e9438){if(_0x46a0eb){return _0x3165b7(_0x46a0eb);}pm2[_0xea72('0x5')]();return _0x49e067(_0x4e9438);});});});};exports['stop']=function(_0x36406c){return connect()['then'](function(){return new BPromise(function(_0x41afbd,_0x2dcc78){return pm2[_0xea72('0x6')](_0x36406c,function(_0x405d63,_0x46b53d){if(_0x405d63){return _0x2dcc78(_0x405d63);}pm2['disconnect']();return _0x41afbd(_0x46b53d);});});});};exports[_0xea72('0x7')]=function(_0x2ff34e){return connect()[_0xea72('0x8')](function(){return new BPromise(function(_0x3be02f,_0x379542){return pm2[_0xea72('0x7')](_0x2ff34e,function(_0x227215,_0x427add){if(_0x227215){return _0x379542(_0x227215);}pm2[_0xea72('0x5')]();return _0x3be02f(_0x427add);});});});};exports['list']=function(){return connect()[_0xea72('0x8')](function(){return new BPromise(function(_0x23229b,_0x15a4dd){return pm2[_0xea72('0x9')](function(_0xf2e71e,_0x1ecdc7){if(_0xf2e71e){return _0x15a4dd(_0xf2e71e);}pm2[_0xea72('0x5')]();return _0x23229b(_0x1ecdc7);});});});};exports[_0xea72('0xa')]=function(_0x2b3b98){return connect()[_0xea72('0x8')](function(){return new BPromise(function(_0x7ee3dc,_0x373778){return pm2[_0xea72('0xa')](_0x2b3b98,function(_0xb3b431,_0x35c1b9){if(_0xb3b431){return _0x373778(_0xb3b431);}pm2[_0xea72('0x5')]();return _0x7ee3dc(_0x35c1b9);});});});};exports['delete']=function(_0x105605){return connect()[_0xea72('0x8')](function(){return new BPromise(function(_0x2101c2,_0x15a0a8){return pm2[_0xea72('0xb')](_0x105605,function(_0x477b88,_0x45733a){if(_0x477b88){return _0x15a0a8(_0x477b88);}pm2[_0xea72('0x5')]();return _0x2101c2(_0x45733a);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x1cbfe1,_0x3d7f2c){return pm2[_0xea72('0xc')](function(_0x355da1){if(_0x355da1){return _0x3d7f2c(_0x355da1);}return _0x1cbfe1(_0xea72('0xd'));});});});}; \ No newline at end of file +var _0xd7f6=['bluebird','./config','start','disconnect','stop','then','restart','list','delete','dump','saved','pm2'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xd7f6,0x137));var _0x6d7f=function(_0x44b622,_0x5520c5){_0x44b622=_0x44b622-0x0;var _0x424962=_0xd7f6[_0x44b622];return _0x424962;};'use strict';var pm2=require(_0x6d7f('0x0'));var BPromise=require(_0x6d7f('0x1'));var config=require(_0x6d7f('0x2'));function connect(){return new BPromise(function(_0x5d339a,_0x51abe1){return pm2['connect'](function(_0x1ddc9d){if(_0x1ddc9d){return _0x51abe1(_0x1ddc9d);}return _0x5d339a('connected');});});};exports[_0x6d7f('0x3')]=function(_0x40135d){return connect()['then'](function(){return new BPromise(function(_0x30dc75,_0x26ad4a){return pm2[_0x6d7f('0x3')](_0x40135d,function(_0x4ad2f2,_0x3dbf8d){if(_0x4ad2f2){return _0x26ad4a(_0x4ad2f2);}pm2[_0x6d7f('0x4')]();return _0x30dc75(_0x3dbf8d);});});});};exports[_0x6d7f('0x5')]=function(_0x4ac8af){return connect()[_0x6d7f('0x6')](function(){return new BPromise(function(_0x478bb,_0xc51443){return pm2['stop'](_0x4ac8af,function(_0x139f1d,_0x2a9b85){if(_0x139f1d){return _0xc51443(_0x139f1d);}pm2[_0x6d7f('0x4')]();return _0x478bb(_0x2a9b85);});});});};exports['restart']=function(_0x447234){return connect()[_0x6d7f('0x6')](function(){return new BPromise(function(_0x539834,_0x3a1ea3){return pm2[_0x6d7f('0x7')](_0x447234,function(_0x5bd45a,_0x4b1421){if(_0x5bd45a){return _0x3a1ea3(_0x5bd45a);}pm2[_0x6d7f('0x4')]();return _0x539834(_0x4b1421);});});});};exports[_0x6d7f('0x8')]=function(){return connect()[_0x6d7f('0x6')](function(){return new BPromise(function(_0x5c47ce,_0x5be0f){return pm2[_0x6d7f('0x8')](function(_0x5c869d,_0x541ae0){if(_0x5c869d){return _0x5be0f(_0x5c869d);}pm2['disconnect']();return _0x5c47ce(_0x541ae0);});});});};exports['describe']=function(_0x2390e4){return connect()[_0x6d7f('0x6')](function(){return new BPromise(function(_0x4f0015,_0x28c642){return pm2['describe'](_0x2390e4,function(_0x387aad,_0x3d6e42){if(_0x387aad){return _0x28c642(_0x387aad);}pm2[_0x6d7f('0x4')]();return _0x4f0015(_0x3d6e42);});});});};exports[_0x6d7f('0x9')]=function(_0x15edcb){return connect()[_0x6d7f('0x6')](function(){return new BPromise(function(_0x41c9c4,_0x52b45f){return pm2[_0x6d7f('0x9')](_0x15edcb,function(_0x512919,_0x371a81){if(_0x512919){return _0x52b45f(_0x512919);}pm2[_0x6d7f('0x4')]();return _0x41c9c4(_0x371a81);});});});};exports[_0x6d7f('0xa')]=function(){return connect()[_0x6d7f('0x6')](function(){return new BPromise(function(_0x55563b,_0xd2e74e){return pm2[_0x6d7f('0xa')](function(_0x189f61){if(_0x189f61){return _0xd2e74e(_0x189f61);}return _0x55563b(_0x6d7f('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index b1837fb..1f1a566 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 _0x54a9=['subtract','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','then','join','catch','error','inspect','start','lodash','moment','ioredis','util','../../config/environment','schedule','redis','localhost','socket.io-emitter','chatTimeout','ChatInteraction','lastMsgAt'];(function(_0x1ce054,_0x2fc853){var _0x4ae4ff=function(_0x3d8144){while(--_0x3d8144){_0x1ce054['push'](_0x1ce054['shift']());}};_0x4ae4ff(++_0x2fc853);}(_0x54a9,0x1b6));var _0x954a=function(_0x58af94,_0x1ff454){_0x58af94=_0x58af94-0x0;var _0x493407=_0x54a9[_0x58af94];return _0x493407;};'use strict';var _=require(_0x954a('0x0'));var moment=require(_0x954a('0x1'));var Redis=require(_0x954a('0x2'));var util=require(_0x954a('0x3'));var config=require(_0x954a('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x954a('0x5'));config[_0x954a('0x6')]=_['defaults'](config[_0x954a('0x6')],{'host':_0x954a('0x7'),'port':0x18eb});var io=require(_0x954a('0x8'))(new Redis(config[_0x954a('0x6')]));function closeInteractions(){var _0x22ff23=0x0;var _0x5c3742=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x954a('0x9')],'where':{'id':0x1}})['then'](function(_0x4871a5){_0x22ff23=_0x4871a5[_0x954a('0x9')];if(_0x22ff23){return db[_0x954a('0xa')]['findAll']({'raw':!![],'attributes':['id',_0x954a('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x954a('0xc')](_0x4871a5[_0x954a('0x9')],'minutes')}}});}else{return[];}})['then'](function(_0x4f1166){if(_0x4f1166&&_0x4f1166[_0x954a('0xd')]){_0x5c3742=_[_0x954a('0xe')](_0x4f1166||[],'id');logger[_0x954a('0xf')](_0x954a('0x10'),_0x5c3742['join']());return db['ChatInteraction'][_0x954a('0x11')]({'closeReason':_0x954a('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x5c3742}});}})[_0x954a('0x13')](function(){if(_0x5c3742&&_0x5c3742[_0x954a('0xd')]){logger[_0x954a('0xf')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x5c3742[_0x954a('0x14')]());for(var _0x356dcd=0x0;_0x356dcd<_0x5c3742[_0x954a('0xd')];_0x356dcd++){io['emit']('chatInteraction:update',{'id':_0x5c3742[_0x356dcd],'closed':!![]});}}})[_0x954a('0x15')](function(_0x38cdb5){logger[_0x954a('0x16')]('[CHAT]\x20Error\x20closing\x20interactions',_0x38cdb5?util[_0x954a('0x17')](_0x38cdb5,{'showHidden':![],'depth':null}):'');});}exports[_0x954a('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf282=['[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','find','chatTimeout','then','ChatInteraction','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','emit','catch','error'];(function(_0x2aa76d,_0x2e687d){var _0x2941a0=function(_0x549cc5){while(--_0x549cc5){_0x2aa76d['push'](_0x2aa76d['shift']());}};_0x2941a0(++_0x2e687d);}(_0xf282,0x14d));var _0x2f28=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xf282[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var moment=require(_0x2f28('0x0'));var Redis=require(_0x2f28('0x1'));var util=require(_0x2f28('0x2'));var config=require(_0x2f28('0x3'));var db=require(_0x2f28('0x4'))['db'];var logger=require(_0x2f28('0x5'))(_0x2f28('0x6'));config[_0x2f28('0x7')]=_[_0x2f28('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2f28('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x1b5ec3=0x0;var _0x3a07ef=[];return db['Setting'][_0x2f28('0xa')]({'raw':!![],'attributes':['id',_0x2f28('0xb')],'where':{'id':0x1}})[_0x2f28('0xc')](function(_0x39b8b7){_0x1b5ec3=_0x39b8b7[_0x2f28('0xb')];if(_0x1b5ec3){return db[_0x2f28('0xd')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2f28('0xe')](_0x39b8b7['chatTimeout'],_0x2f28('0xf'))}}});}else{return[];}})['then'](function(_0x500dc4){if(_0x500dc4&&_0x500dc4[_0x2f28('0x10')]){_0x3a07ef=_['map'](_0x500dc4||[],'id');logger[_0x2f28('0x11')](_0x2f28('0x12'),_0x3a07ef[_0x2f28('0x13')]());return db[_0x2f28('0xd')][_0x2f28('0x14')]({'closeReason':_0x2f28('0x15'),'disposition':_0x2f28('0x16'),'closed':!![],'closedAt':moment()[_0x2f28('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3a07ef}});}})[_0x2f28('0xc')](function(){if(_0x3a07ef&&_0x3a07ef[_0x2f28('0x10')]){logger[_0x2f28('0x11')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x3a07ef[_0x2f28('0x13')]());for(var _0x4a83cf=0x0;_0x4a83cf<_0x3a07ef['length'];_0x4a83cf++){io[_0x2f28('0x18')]('chatInteraction:update',{'id':_0x3a07ef[_0x4a83cf],'closed':!![]});}}})[_0x2f28('0x19')](function(_0x25b209){logger[_0x2f28('0x1a')](_0x2f28('0x1b'),_0x25b209?util[_0x2f28('0x1c')](_0x25b209,{'showHidden':![],'depth':null}):'');});}exports[_0x2f28('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 6f17cc1..d30502f 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 _0x41df=['\x22%s\x22\x20<%s>','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','existsSync','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','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','data','isNil','subtractNumber','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','then','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','toRun','index','my\x20id','run\x20job','cron','active','endAt','start','add\x20cron','deleteJob','stop\x20cron','isBetween','startAt','update','update\x20cron','run','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41df,0xa7));var _0xf41d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x41df[_0x501510];return _0x1e6ee5;};'use strict';var fs=require('fs');var util=require(_0xf41d('0x0'));var path=require('path');var _=require(_0xf41d('0x1'));var moment=require(_0xf41d('0x2'));var CronJobManager=require(_0xf41d('0x3'));var jayson=require(_0xf41d('0x4'));var BPromise=require(_0xf41d('0x5'));var logger=require('../logger')(_0xf41d('0x6'));var db=require(_0xf41d('0x7'))['db'];var analyticCustomReportController=require(_0xf41d('0x8'));var analyticDefaultReportController=require(_0xf41d('0x9'));var client=jayson[_0xf41d('0xa')][_0xf41d('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5e8cc2,_0x2c19ec){return function(){logger[_0xf41d('0xc')](_0xf41d('0xd'),_0x5e8cc2['email']);var _0x150a24=!![];var _0xe889b5={'tls':{'rejectUnauthorized':![]}};if(_0x5e8cc2[_0xf41d('0xe')][_0xf41d('0xf')][_0xf41d('0x10')]){_0xe889b5[_0xf41d('0x10')]=_0x5e8cc2[_0xf41d('0xe')][_0xf41d('0xf')][_0xf41d('0x10')];}else{_0xe889b5['host']=_0x5e8cc2[_0xf41d('0xe')]['Smtp'][_0xf41d('0x11')];_0xe889b5['port']=_0x5e8cc2[_0xf41d('0xe')][_0xf41d('0xf')][_0xf41d('0x12')];_0xe889b5[_0xf41d('0x13')]=_0x5e8cc2[_0xf41d('0xe')][_0xf41d('0xf')]['secure'];}if(_0x5e8cc2[_0xf41d('0xe')]['Smtp'][_0xf41d('0x14')]){_0xe889b5[_0xf41d('0x15')]={'user':_0x5e8cc2[_0xf41d('0xe')][_0xf41d('0xf')][_0xf41d('0x16')],'pass':_0x5e8cc2['MailAccount']['Smtp'][_0xf41d('0x17')]};}var _0x146377={'account':_0xe889b5,'message':{'from':util[_0xf41d('0x18')](_0xf41d('0x19'),_0x5e8cc2['MailAccount'][_0xf41d('0x1a')],_0x5e8cc2[_0xf41d('0xe')]['email']||_0x5e8cc2[_0xf41d('0xe')][_0xf41d('0xf')][_0xf41d('0x16')]),'to':_0x5e8cc2[_0xf41d('0x1b')],'cc':_0x5e8cc2['cc'],'bcc':_0x5e8cc2[_0xf41d('0x1c')],'subject':util['format'](_0xf41d('0x1d'),_0x2c19ec['name'],_0x5e8cc2['subtractNumber'],_0x5e8cc2[_0xf41d('0x1e')])}};var _0x3ba342=path[_0xf41d('0x1f')](__dirname,_0xf41d('0x20'));var _0x3bfe2f=_0x2c19ec[_0xf41d('0x21')];var _0x12edde=util[_0xf41d('0x18')](_0xf41d('0x22'),path[_0xf41d('0x23')](_0x2c19ec['savename'],path[_0xf41d('0x24')](_0x2c19ec[_0xf41d('0x21')])),'zip');var _0x5b8b20=path[_0xf41d('0x1f')](_0x3ba342,_0x3bfe2f);var _0x186a69=path['join'](_0x3ba342,_0x12edde);if(fs[_0xf41d('0x25')](_0x5b8b20)){_0x2c19ec[_0xf41d('0x26')]='Sent';_0x146377[_0xf41d('0x27')][_0xf41d('0x28')]=[{'filename':_0x3bfe2f,'path':_0x5b8b20}];_0x146377['message'][_0xf41d('0x29')]=util[_0xf41d('0x18')](_0xf41d('0x2a'),JSON[_0xf41d('0x2b')](_0x2c19ec,null,0x2));}else if(fs[_0xf41d('0x25')](_0x186a69)){_0x2c19ec[_0xf41d('0x26')]='Sent';_0x146377[_0xf41d('0x27')]['attachments']=[{'filename':_0x12edde,'path':_0x186a69}];}else{_0x146377[_0xf41d('0x27')][_0xf41d('0x29')]=_0xf41d('0x2c');if(!_0x5e8cc2['sendIfEmpty']){_0x150a24=![];logger[_0xf41d('0xc')](_0xf41d('0x2d'));}}if(_0x150a24){return client[_0xf41d('0x2e')](_0xf41d('0x2f'),_0x146377)['then'](function(_0x4c1fc4){if(_0x4c1fc4[_0xf41d('0x30')]){return logger[_0xf41d('0x30')](_0xf41d('0x31'),JSON['stringify'](_0x4c1fc4));}return logger[_0xf41d('0xc')](_0xf41d('0x32'));})['catch'](function(_0xbc64a7){return logger[_0xf41d('0x30')](_0xf41d('0x31'),JSON[_0xf41d('0x2b')](_0xbc64a7));});}};}function handleError(){return function(_0x3da876){return logger['error'](JSON[_0xf41d('0x2b')](_0x3da876));};}function handleResult(_0x44b17b){return function(_0x5171ec){logger[_0xf41d('0xc')](_0xf41d('0x33'),JSON['stringify'](_0x5171ec));if(_0x44b17b[_0xf41d('0xe')]&&_0x44b17b[_0xf41d('0xe')][_0xf41d('0xf')]&&!_[_0xf41d('0x34')](_0x44b17b[_0xf41d('0x1b')])){setTimeout(handleSendEmail(_0x44b17b,_0x5171ec),0x3c*0x3e8);}};}function handleJob(_0x4cc08f){return function(){try{if(_[_0xf41d('0x34')](_0x4cc08f[_0xf41d('0x35')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xf41d('0x34')](_0x4cc08f['subtractUnit'])){return logger[_0xf41d('0xc')](_0xf41d('0x36'));}var _0x4616c8={'startDate':moment()[_0xf41d('0x37')](_0x4cc08f[_0xf41d('0x35')],_0x4cc08f[_0xf41d('0x1e')])[_0xf41d('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xf41d('0x18')](_0xf41d('0x38')),'type':_0xf41d('0x39'),'output':_0x4cc08f[_0xf41d('0x3a')],'name':_0x4cc08f[_0xf41d('0x1a')]};if(!_[_0xf41d('0x34')](_0x4cc08f[_0xf41d('0x3b')])){logger[_0xf41d('0xc')](_0xf41d('0x3c'),_0x4cc08f[_0xf41d('0x3b')]);return analyticDefaultReportController[_0xf41d('0x3d')]({'id':_0x4cc08f[_0xf41d('0x3b')]},_0x4616c8)['then'](handleResult(_0x4cc08f))[_0xf41d('0x3e')](handleError());}if(!_['isNil'](_0x4cc08f[_0xf41d('0x3f')])){logger[_0xf41d('0xc')](_0xf41d('0x40'),_0x4cc08f[_0xf41d('0x3f')]);return analyticCustomReportController[_0xf41d('0x3d')]({'id':_0x4cc08f[_0xf41d('0x3f')]},_0x4616c8)[_0xf41d('0x41')](handleResult(_0x4cc08f))['catch'](handleError());}}catch(_0xf7b857){logger[_0xf41d('0x30')](JSON[_0xf41d('0x2b')](_0xf7b857));}return logger['info'](_0xf41d('0x42'));};}function getJobs(_0x465a83){var _0x2da46d={};if(_0x465a83){_0x2da46d['id']=_0x465a83;}return db[_0xf41d('0x43')][_0xf41d('0x44')]({'where':_0x2da46d,'include':[{'model':db[_0xf41d('0xe')],'attributes':['id',_0xf41d('0x1a'),_0xf41d('0x1b')],'include':[{'model':db[_0xf41d('0x45')],'as':_0xf41d('0xf')}]}]})['then'](function(_0x1d0e96){var _0x1de6c3=_[_0xf41d('0x46')](manager[_0xf41d('0x47')]);var _0x22f015=_[_0xf41d('0x48')](_0x1d0e96,function(_0x40d951){return _0x40d951['id'][_0xf41d('0x49')]();});var _0x2914d0=_[_0xf41d('0x4a')](_0x1d0e96,function(_0x29f334){return _0x29f334['id'][_0xf41d('0x49')]();});var _0x213aba=_0x465a83?_0x22f015:_[_0xf41d('0x4b')](_0x22f015,_0x1de6c3);var _0x33d757=_[_0xf41d('0x4c')](_0x22f015,_0x1de6c3);var _0x123c83=_['difference'](_0x1de6c3,_0x22f015);var _0x26d172;var _0x2b67d8;for(_0x26d172=0x0;_0x26d172<_0x123c83[_0xf41d('0x4d')]&&!_0x465a83;_0x26d172+=0x1){_0x2b67d8=_0x123c83[_0x26d172][_0xf41d('0x49')]();if(manager[_0xf41d('0x4e')](_0x2b67d8)){manager[_0xf41d('0x4f')](_0x2b67d8);manager['deleteJob'](_0x2b67d8);logger[_0xf41d('0xc')]('delete\x20cron',_0x2b67d8);}}logger[_0xf41d('0xc')](_0xf41d('0x50'),JSON[_0xf41d('0x2b')](_0x213aba));for(_0x26d172=0x0;_0x26d172<_0x213aba[_0xf41d('0x4d')];_0x26d172+=0x1){_0x2b67d8=_0x213aba[_0x26d172]['toString']();logger[_0xf41d('0xc')](_0xf41d('0x51'),_0x2b67d8);if(_0x465a83){logger[_0xf41d('0xc')](_0xf41d('0x52'),_0x465a83);logger[_0xf41d('0xc')](JSON[_0xf41d('0x2b')](_0x2914d0[_0x2b67d8]));BPromise['resolve']()[_0xf41d('0x41')](handleJob(_0x2914d0[_0x2b67d8]));logger[_0xf41d('0xc')](_0xf41d('0x53'),_0x2914d0[_0x2b67d8][_0xf41d('0x1a')],_0x2914d0[_0x2b67d8][_0xf41d('0x54')]);}else if(_0x2914d0[_0x2b67d8][_0xf41d('0x54')]&&_0x2914d0[_0x2b67d8][_0xf41d('0x55')]&&moment()['isBetween'](_0x2914d0[_0x2b67d8]['startAt'],_0x2914d0[_0x2b67d8][_0xf41d('0x56')])){manager['add'](_0x2b67d8,_0x2914d0[_0x2b67d8]['cron'],handleJob(_0x2914d0[_0x2b67d8]));manager[_0xf41d('0x57')](_0x2b67d8);logger[_0xf41d('0xc')](_0xf41d('0x58'),_0x2914d0[_0x2b67d8]['name'],_0x2914d0[_0x2b67d8][_0xf41d('0x54')]);}else if(manager[_0xf41d('0x4e')](_0x2b67d8)){manager[_0xf41d('0x4f')](_0x2b67d8);manager[_0xf41d('0x59')](_0x2b67d8);logger[_0xf41d('0xc')](_0xf41d('0x5a'),_0x2914d0[_0x2b67d8][_0xf41d('0x1a')],_0x2914d0[_0x2b67d8][_0xf41d('0x54')]);}}for(_0x26d172=0x0,_0x2b67d8;_0x26d172<_0x33d757[_0xf41d('0x4d')]&&!_0x465a83;_0x26d172+=0x1){_0x2b67d8=_0x33d757[_0x26d172][_0xf41d('0x49')]();if(manager[_0xf41d('0x4e')](_0x2b67d8)){if(_0x2914d0[_0x2b67d8]['cron']&&_0x2914d0[_0x2b67d8]['active']&&moment()[_0xf41d('0x5b')](_0x2914d0[_0x2b67d8][_0xf41d('0x5c')],_0x2914d0[_0x2b67d8][_0xf41d('0x56')])){manager[_0xf41d('0x5d')](_0x2b67d8,_0x2914d0[_0x2b67d8][_0xf41d('0x54')],handleJob(_0x2914d0[_0x2b67d8]));logger[_0xf41d('0xc')](_0xf41d('0x5e'),_0x2914d0[_0x2b67d8][_0xf41d('0x1a')],_0x2914d0[_0x2b67d8][_0xf41d('0x54')]);}else{manager[_0xf41d('0x4f')](_0x2b67d8);manager[_0xf41d('0x59')](_0x2b67d8);logger['info']('stop\x20cron',_0x2914d0[_0x2b67d8][_0xf41d('0x1a')],_0x2914d0[_0x2b67d8]['cron']);}}}})[_0xf41d('0x3e')](function(_0x1e519e){logger[_0xf41d('0x30')](JSON['stringify'](_0x1e519e));});}exports[_0xf41d('0x5f')]=function(_0x3d75fe){return getJobs(_0x3d75fe);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xf64a=['savename','format','%s.%s','basename','extname','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','start','stop\x20cron','endAt','update','run','util','lodash','moment','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','port','secure','authentication','auth','user','pass','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports'];(function(_0x507f20,_0x471478){var _0x12ee49=function(_0x3475e5){while(--_0x3475e5){_0x507f20['push'](_0x507f20['shift']());}};_0x12ee49(++_0x471478);}(_0xf64a,0xf2));var _0xaf64=function(_0xf2f332,_0x299fbf){_0xf2f332=_0xf2f332-0x0;var _0x56cce3=_0xf64a[_0xf2f332];return _0x56cce3;};'use strict';var fs=require('fs');var util=require(_0xaf64('0x0'));var path=require('path');var _=require(_0xaf64('0x1'));var moment=require(_0xaf64('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xaf64('0x3'));var BPromise=require(_0xaf64('0x4'));var logger=require('../logger')(_0xaf64('0x5'));var db=require(_0xaf64('0x6'))['db'];var analyticCustomReportController=require(_0xaf64('0x7'));var analyticDefaultReportController=require(_0xaf64('0x8'));var client=jayson[_0xaf64('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x118963,_0x1dbc04){return function(){logger['info'](_0xaf64('0xa'),_0x118963['email']);var _0x41917b=!![];var _0x488421={'tls':{'rejectUnauthorized':![]}};if(_0x118963[_0xaf64('0xb')][_0xaf64('0xc')][_0xaf64('0xd')]){_0x488421[_0xaf64('0xd')]=_0x118963['MailAccount']['Smtp']['service'];}else{_0x488421['host']=_0x118963[_0xaf64('0xb')][_0xaf64('0xc')]['host'];_0x488421['port']=_0x118963[_0xaf64('0xb')][_0xaf64('0xc')][_0xaf64('0xe')];_0x488421[_0xaf64('0xf')]=_0x118963[_0xaf64('0xb')][_0xaf64('0xc')][_0xaf64('0xf')];}if(_0x118963['MailAccount'][_0xaf64('0xc')][_0xaf64('0x10')]){_0x488421[_0xaf64('0x11')]={'user':_0x118963['MailAccount'][_0xaf64('0xc')][_0xaf64('0x12')],'pass':_0x118963['MailAccount'][_0xaf64('0xc')][_0xaf64('0x13')]};}var _0x348806={'account':_0x488421,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x118963['MailAccount'][_0xaf64('0x14')],_0x118963[_0xaf64('0xb')][_0xaf64('0x15')]||_0x118963[_0xaf64('0xb')][_0xaf64('0xc')]['user']),'to':_0x118963['email'],'cc':_0x118963['cc'],'bcc':_0x118963[_0xaf64('0x16')],'subject':util['format'](_0xaf64('0x17'),_0x1dbc04[_0xaf64('0x14')],_0x118963[_0xaf64('0x18')],_0x118963[_0xaf64('0x19')])}};var _0x2d6707=path[_0xaf64('0x1a')](__dirname,_0xaf64('0x1b'));var _0x136b0e=_0x1dbc04[_0xaf64('0x1c')];var _0x362537=util[_0xaf64('0x1d')](_0xaf64('0x1e'),path[_0xaf64('0x1f')](_0x1dbc04[_0xaf64('0x1c')],path[_0xaf64('0x20')](_0x1dbc04['savename'])),'zip');var _0x425fe5=path['join'](_0x2d6707,_0x136b0e);var _0x29f2cc=path[_0xaf64('0x1a')](_0x2d6707,_0x362537);if(fs[_0xaf64('0x21')](_0x425fe5)){_0x1dbc04[_0xaf64('0x22')]=_0xaf64('0x23');_0x348806[_0xaf64('0x24')][_0xaf64('0x25')]=[{'filename':_0x136b0e,'path':_0x425fe5}];_0x348806[_0xaf64('0x24')][_0xaf64('0x26')]=util['format'](_0xaf64('0x27'),JSON[_0xaf64('0x28')](_0x1dbc04,null,0x2));}else if(fs['existsSync'](_0x29f2cc)){_0x1dbc04[_0xaf64('0x22')]=_0xaf64('0x23');_0x348806[_0xaf64('0x24')][_0xaf64('0x25')]=[{'filename':_0x362537,'path':_0x29f2cc}];}else{_0x348806['message']['text']=_0xaf64('0x29');if(!_0x118963[_0xaf64('0x2a')]){_0x41917b=![];logger[_0xaf64('0x2b')](_0xaf64('0x2c'));}}if(_0x41917b){return client[_0xaf64('0x2d')](_0xaf64('0x2e'),_0x348806)[_0xaf64('0x2f')](function(_0x2e8cdb){if(_0x2e8cdb['error']){return logger[_0xaf64('0x30')]('error\x20mail',JSON[_0xaf64('0x28')](_0x2e8cdb));}return logger[_0xaf64('0x2b')](_0xaf64('0x31'));})[_0xaf64('0x32')](function(_0x403c14){return logger[_0xaf64('0x30')](_0xaf64('0x33'),JSON[_0xaf64('0x28')](_0x403c14));});}};}function handleError(){return function(_0x26f7ce){return logger[_0xaf64('0x30')](JSON[_0xaf64('0x28')](_0x26f7ce));};}function handleResult(_0x20c144){return function(_0x1e9c1b){logger[_0xaf64('0x2b')](_0xaf64('0x34'),JSON[_0xaf64('0x28')](_0x1e9c1b));if(_0x20c144['MailAccount']&&_0x20c144[_0xaf64('0xb')][_0xaf64('0xc')]&&!_[_0xaf64('0x35')](_0x20c144[_0xaf64('0x15')])){setTimeout(handleSendEmail(_0x20c144,_0x1e9c1b),0x3c*0x3e8);}};}function handleJob(_0x3d8a21){return function(){try{if(_['isNil'](_0x3d8a21['subtractNumber'])){return logger[_0xaf64('0x2b')](_0xaf64('0x36'));}if(_[_0xaf64('0x35')](_0x3d8a21[_0xaf64('0x19')])){return logger[_0xaf64('0x2b')](_0xaf64('0x37'));}var _0x4f0fa2={'startDate':moment()[_0xaf64('0x38')](_0x3d8a21[_0xaf64('0x18')],_0x3d8a21[_0xaf64('0x19')])[_0xaf64('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xaf64('0x1d')](_0xaf64('0x39')),'type':_0xaf64('0x3a'),'output':_0x3d8a21[_0xaf64('0x3b')],'name':_0x3d8a21['name']};if(!_[_0xaf64('0x35')](_0x3d8a21[_0xaf64('0x3c')])){logger[_0xaf64('0x2b')](_0xaf64('0x3d'),_0x3d8a21[_0xaf64('0x3c')]);return analyticDefaultReportController[_0xaf64('0x3e')]({'id':_0x3d8a21[_0xaf64('0x3c')]},_0x4f0fa2)[_0xaf64('0x2f')](handleResult(_0x3d8a21))[_0xaf64('0x32')](handleError());}if(!_[_0xaf64('0x35')](_0x3d8a21[_0xaf64('0x3f')])){logger[_0xaf64('0x2b')](_0xaf64('0x40'),_0x3d8a21['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x3d8a21[_0xaf64('0x3f')]},_0x4f0fa2)[_0xaf64('0x2f')](handleResult(_0x3d8a21))['catch'](handleError());}}catch(_0xd84b56){logger[_0xaf64('0x30')](JSON[_0xaf64('0x28')](_0xd84b56));}return logger['info'](_0xaf64('0x41'));};}function getJobs(_0x280b8f){var _0x50172f={};if(_0x280b8f){_0x50172f['id']=_0x280b8f;}return db[_0xaf64('0x42')][_0xaf64('0x43')]({'where':_0x50172f,'include':[{'model':db[_0xaf64('0xb')],'attributes':['id',_0xaf64('0x14'),_0xaf64('0x15')],'include':[{'model':db[_0xaf64('0x44')],'as':_0xaf64('0xc')}]}]})[_0xaf64('0x2f')](function(_0x3b46da){var _0x144405=_['keys'](manager['jobs']);var _0x5e4fab=_['map'](_0x3b46da,function(_0x393563){return _0x393563['id'][_0xaf64('0x45')]();});var _0x3a7a44=_[_0xaf64('0x46')](_0x3b46da,function(_0x9d3987){return _0x9d3987['id'][_0xaf64('0x45')]();});var _0x153f49=_0x280b8f?_0x5e4fab:_[_0xaf64('0x47')](_0x5e4fab,_0x144405);var _0x849967=_[_0xaf64('0x48')](_0x5e4fab,_0x144405);var _0x1e2214=_[_0xaf64('0x47')](_0x144405,_0x5e4fab);var _0x13345a;var _0x19215a;for(_0x13345a=0x0;_0x13345a<_0x1e2214[_0xaf64('0x49')]&&!_0x280b8f;_0x13345a+=0x1){_0x19215a=_0x1e2214[_0x13345a][_0xaf64('0x45')]();if(manager[_0xaf64('0x4a')](_0x19215a)){manager[_0xaf64('0x4b')](_0x19215a);manager[_0xaf64('0x4c')](_0x19215a);logger[_0xaf64('0x2b')]('delete\x20cron',_0x19215a);}}logger[_0xaf64('0x2b')]('toRun',JSON[_0xaf64('0x28')](_0x153f49));for(_0x13345a=0x0;_0x13345a<_0x153f49[_0xaf64('0x49')];_0x13345a+=0x1){_0x19215a=_0x153f49[_0x13345a]['toString']();logger[_0xaf64('0x2b')](_0xaf64('0x4d'),_0x19215a);if(_0x280b8f){logger[_0xaf64('0x2b')](_0xaf64('0x4e'),_0x280b8f);logger[_0xaf64('0x2b')](JSON[_0xaf64('0x28')](_0x3a7a44[_0x19215a]));BPromise[_0xaf64('0x4f')]()[_0xaf64('0x2f')](handleJob(_0x3a7a44[_0x19215a]));logger['info'](_0xaf64('0x50'),_0x3a7a44[_0x19215a][_0xaf64('0x14')],_0x3a7a44[_0x19215a][_0xaf64('0x51')]);}else if(_0x3a7a44[_0x19215a][_0xaf64('0x51')]&&_0x3a7a44[_0x19215a][_0xaf64('0x52')]&&moment()[_0xaf64('0x53')](_0x3a7a44[_0x19215a][_0xaf64('0x54')],_0x3a7a44[_0x19215a]['endAt'])){manager['add'](_0x19215a,_0x3a7a44[_0x19215a][_0xaf64('0x51')],handleJob(_0x3a7a44[_0x19215a]));manager[_0xaf64('0x55')](_0x19215a);logger[_0xaf64('0x2b')]('add\x20cron',_0x3a7a44[_0x19215a][_0xaf64('0x14')],_0x3a7a44[_0x19215a][_0xaf64('0x51')]);}else if(manager['exists'](_0x19215a)){manager[_0xaf64('0x4b')](_0x19215a);manager[_0xaf64('0x4c')](_0x19215a);logger[_0xaf64('0x2b')](_0xaf64('0x56'),_0x3a7a44[_0x19215a][_0xaf64('0x14')],_0x3a7a44[_0x19215a]['cron']);}}for(_0x13345a=0x0,_0x19215a;_0x13345a<_0x849967[_0xaf64('0x49')]&&!_0x280b8f;_0x13345a+=0x1){_0x19215a=_0x849967[_0x13345a][_0xaf64('0x45')]();if(manager[_0xaf64('0x4a')](_0x19215a)){if(_0x3a7a44[_0x19215a][_0xaf64('0x51')]&&_0x3a7a44[_0x19215a][_0xaf64('0x52')]&&moment()[_0xaf64('0x53')](_0x3a7a44[_0x19215a][_0xaf64('0x54')],_0x3a7a44[_0x19215a][_0xaf64('0x57')])){manager[_0xaf64('0x58')](_0x19215a,_0x3a7a44[_0x19215a][_0xaf64('0x51')],handleJob(_0x3a7a44[_0x19215a]));logger[_0xaf64('0x2b')]('update\x20cron',_0x3a7a44[_0x19215a][_0xaf64('0x14')],_0x3a7a44[_0x19215a][_0xaf64('0x51')]);}else{manager[_0xaf64('0x4b')](_0x19215a);manager[_0xaf64('0x4c')](_0x19215a);logger[_0xaf64('0x2b')]('stop\x20cron',_0x3a7a44[_0x19215a][_0xaf64('0x14')],_0x3a7a44[_0x19215a][_0xaf64('0x51')]);}}}})[_0xaf64('0x32')](function(_0x4f2793){logger[_0xaf64('0x30')](JSON[_0xaf64('0x28')](_0x4f2793));});}exports[_0xaf64('0x59')]=function(_0x51bfbf){return getJobs(_0x51bfbf);};exports[_0xaf64('0x55')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 2bb5ecb..821d1f9 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 _0x3d7f=['sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','update','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','SequelizeValidationError','lodash','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0x3d7f,0x1a1));var _0xf3d7=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x3d7f[_0x1e3c16];return _0x47a0c9;};var _=require(_0xf3d7('0x0'));var AWS=require('aws-sdk');var rp=require(_0xf3d7('0x1'));var util=require('util');var BPromise=require(_0xf3d7('0x2'));var db=require(_0xf3d7('0x3'))['db'];var logger=require(_0xf3d7('0x4'))(_0xf3d7('0x5'));function getTranscriptionJob(_0x4aa4b1,_0x574073,_0x433483,_0x20fb37){return new Promise(function(_0x5b667c,_0x59deab){var _0x3fe200=new AWS[(_0xf3d7('0x6'))]({'accessKeyId':_0x574073,'secretAccessKey':_0x4aa4b1,'region':_0x433483});_0x3fe200[_0xf3d7('0x7')]({'TranscriptionJobName':_0x20fb37},function(_0x50fce6,_0x19c27d){if(_0x50fce6){return _0x59deab(_0x50fce6);}else{return _0x5b667c(_0x19c27d);}});});}function sentiment(_0x2d2bcd,_0x476c74,_0x2334e2,_0x167637,_0x175766){return new Promise(function(_0x3e5a00,_0x117cc4){var _0x2b6ba2=new AWS[(_0xf3d7('0x8'))]({'accessKeyId':_0x476c74,'secretAccessKey':_0x2d2bcd,'region':_0x2334e2});_0x2b6ba2[_0xf3d7('0x9')]({'Text':_0x167637,'LanguageCode':_0x175766['substring'](0x0,0x2)},function(_0x486f97,_0xe3b5cb){if(_0x486f97){return _0x117cc4(_0x486f97);}else{return _0x3e5a00(_0xe3b5cb);}});});}function checkTranscribeJob(_0xf6ca2f,_0x5e7b43,_0x161613){var _0xecd54c;return new BPromise(function(_0x42f319,_0x482977){logger[_0xf3d7('0xa')](util[_0xf3d7('0xb')](_0xf3d7('0xc'),_0xf6ca2f['id'],_0xf6ca2f[_0xf3d7('0xd')]));return getTranscriptionJob(_0x161613[_0xf3d7('0xe')],_0x161613[_0xf3d7('0xf')],_0x5e7b43['transcribeRegion'],_0xf6ca2f[_0xf3d7('0xd')])[_0xf3d7('0x10')](function(_0x305b5c){logger[_0xf3d7('0xa')](util[_0xf3d7('0xb')](_0xf3d7('0x11'),_0xf6ca2f['id'],_0xf6ca2f[_0xf3d7('0xd')],_0x305b5c['TranscriptionJob'][_0xf3d7('0x12')]));if(!_0xf6ca2f[_0xf3d7('0x13')]){switch(_0x305b5c[_0xf3d7('0x14')][_0xf3d7('0x12')]){case _0xf3d7('0x15'):var _0x1472d9={'transcribeStatus':_0x305b5c['TranscriptionJob'][_0xf3d7('0x12')],'fileUri':_0x305b5c[_0xf3d7('0x14')][_0xf3d7('0x16')][_0xf3d7('0x17')]};logger[_0xf3d7('0xa')](util[_0xf3d7('0xb')](_0xf3d7('0x18'),_0xf6ca2f['id']));return rp({'uri':_0x305b5c[_0xf3d7('0x14')][_0xf3d7('0x16')][_0xf3d7('0x17')],'json':!![]})[_0xf3d7('0x10')](function(_0x564daa){logger[_0xf3d7('0xa')](util[_0xf3d7('0xb')](_0xf3d7('0x19'),_0xf6ca2f['id']));if(_0x564daa&&_0x564daa[_0xf3d7('0x1a')]&&_0x564daa[_0xf3d7('0x1a')][_0xf3d7('0x1b')]&&_0x564daa['results'][_0xf3d7('0x1b')][_0xf3d7('0x1c')]){_0x1472d9[_0xf3d7('0x13')]='';for(var _0xbe9345=0x0;_0xbe9345<_0x564daa[_0xf3d7('0x1a')][_0xf3d7('0x1b')][_0xf3d7('0x1c')];_0xbe9345++){_0x1472d9['fileText']+=_0x564daa[_0xf3d7('0x1a')][_0xf3d7('0x1b')][_0xbe9345][_0xf3d7('0x1d')]+'';}}return _0xf6ca2f['update'](_0x1472d9);})['then'](function(){logger[_0xf3d7('0xa')](util['format'](_0xf3d7('0x1e'),_0xf6ca2f['id']));if(!_0xf6ca2f['tempSentiment']){throw new db[(_0xf3d7('0x1f'))][(_0xf3d7('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5e7b43[_0xf3d7('0x21')]||!_0x5e7b43[_0xf3d7('0x22')]||!_0x5e7b43[_0xf3d7('0x23')]||!_0x5e7b43[_0xf3d7('0x24')]||!_0x5e7b43[_0xf3d7('0x25')]){throw new db[(_0xf3d7('0x1f'))][(_0xf3d7('0x20'))](_0xf3d7('0x26'));}if(!_0x1472d9[_0xf3d7('0x13')]){throw new Error(_0xf3d7('0x27'));}if(_0x5e7b43[_0xf3d7('0x22')]===_0x161613['id']){return _0x161613;}else{return db[_0xf3d7('0x28')][_0xf3d7('0x29')]({'where':{'id':_settings[_0xf3d7('0x22')]}});}})[_0xf3d7('0x10')](function(_0x34ba58){if(!_0x34ba58){throw new db[(_0xf3d7('0x1f'))][(_0xf3d7('0x20'))](_0xf3d7('0x2a'));}if(!_0x34ba58[_0xf3d7('0xe')]||!_0x34ba58['data2']){throw new db[(_0xf3d7('0x1f'))][(_0xf3d7('0x20'))](_0xf3d7('0x2b'));}_0xecd54c=_0x34ba58;logger[_0xf3d7('0xa')](util[_0xf3d7('0xb')](_0xf3d7('0x2c'),_0xf6ca2f['id']));return sentiment(_0xecd54c['data1'],_0xecd54c[_0xf3d7('0xf')],_0x5e7b43[_0xf3d7('0x23')],_0x1472d9[_0xf3d7('0x13')],_0x5e7b43[_0xf3d7('0x24')]);})['then'](function(_0x716173){logger[_0xf3d7('0xa')](util[_0xf3d7('0xb')](_0xf3d7('0x2d'),_0xf6ca2f['id']));return _0xf6ca2f['update']({'sentiment':_0x716173[_0xf3d7('0x2e')],'sPositive':_0x716173[_0xf3d7('0x2f')][_0xf3d7('0x30')],'sNegative':_0x716173[_0xf3d7('0x2f')][_0xf3d7('0x31')],'sMixed':_0x716173[_0xf3d7('0x2f')][_0xf3d7('0x32')],'sNeutral':_0x716173['SentimentScore'][_0xf3d7('0x33')]});})[_0xf3d7('0x10')](function(){logger[_0xf3d7('0xa')](util[_0xf3d7('0xb')](_0xf3d7('0x1e'),_0xf6ca2f['id']));_0x42f319();});case _0xf3d7('0x34'):return _0xf6ca2f['update']({'transcribeStatus':'FAILED','failureReason':_0x305b5c[_0xf3d7('0x14')][_0xf3d7('0x35')]})[_0xf3d7('0x10')](function(){logger[_0xf3d7('0xa')](util[_0xf3d7('0xb')](_0xf3d7('0x1e'),_0xf6ca2f['id']));_0x42f319();});default:logger[_0xf3d7('0xa')](util['format'](_0xf3d7('0x36'),_0xf6ca2f['id']));break;}}else{return BPromise[_0xf3d7('0x37')]()[_0xf3d7('0x10')](function(){if(!_0xf6ca2f[_0xf3d7('0x38')]){throw new db[(_0xf3d7('0x1f'))]['ValidationError'](_0xf3d7('0x39'));}if(!_0x5e7b43[_0xf3d7('0x21')]||!_0x5e7b43[_0xf3d7('0x22')]||!_0x5e7b43['sentimentRegion']||!_0x5e7b43[_0xf3d7('0x24')]||!_0x5e7b43[_0xf3d7('0x25')]){throw new db[(_0xf3d7('0x1f'))]['ValidationError'](_0xf3d7('0x26'));}if(!_0xf6ca2f[_0xf3d7('0x13')]){throw new Error(_0xf3d7('0x27'));}if(_0x5e7b43[_0xf3d7('0x22')]===_0x161613['id']){return _0x161613;}else{return db[_0xf3d7('0x28')][_0xf3d7('0x29')]({'where':{'id':_settings[_0xf3d7('0x22')]}});}})['then'](function(_0x5d6994){if(!_0x5d6994){throw new db[(_0xf3d7('0x1f'))][(_0xf3d7('0x20'))](_0xf3d7('0x2a'));}if(!_0x5d6994[_0xf3d7('0xe')]||!_0x5d6994['data2']){throw new db['Sequelize'][(_0xf3d7('0x20'))](_0xf3d7('0x2b'));}_0xecd54c=_0x5d6994;logger[_0xf3d7('0xa')](util[_0xf3d7('0xb')](_0xf3d7('0x2c'),_0xf6ca2f['id']));return sentiment(_0xecd54c[_0xf3d7('0xe')],_0xecd54c[_0xf3d7('0xf')],_0x5e7b43[_0xf3d7('0x23')],_0xf6ca2f[_0xf3d7('0x13')],_0x5e7b43[_0xf3d7('0x24')]);})[_0xf3d7('0x10')](function(_0x42df1a){logger[_0xf3d7('0xa')](util[_0xf3d7('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xf6ca2f['id']));return _0xf6ca2f[_0xf3d7('0x3a')]({'sentiment':_0x42df1a[_0xf3d7('0x2e')],'sPositive':_0x42df1a[_0xf3d7('0x2f')][_0xf3d7('0x30')],'sNegative':_0x42df1a[_0xf3d7('0x2f')][_0xf3d7('0x31')],'sMixed':_0x42df1a['SentimentScore'][_0xf3d7('0x32')],'sNeutral':_0x42df1a[_0xf3d7('0x2f')]['Neutral'],'transcribeStatus':_0xf3d7('0x15')});})['then'](function(){logger[_0xf3d7('0xa')](util[_0xf3d7('0xb')](_0xf3d7('0x1e'),_0xf6ca2f['id']));_0x42f319();});}})[_0xf3d7('0x3b')](function(_0x234157){if(_0x234157){if(!_0x234157['name']||_0x234157[_0xf3d7('0x3c')]!=='SequelizeValidationError'){logger[_0xf3d7('0x3d')](util[_0xf3d7('0xb')](_0xf3d7('0x3e'),_0xf6ca2f['id']),util[_0xf3d7('0x3f')](_0x234157,{'showHidden':![],'depth':null}));}}_0x42f319();});});}function checkTranscribe(){var _0x59c6b6;var _0x13f8b4;var _0x83d058;return db[_0xf3d7('0x40')][_0xf3d7('0x41')]({'where':{'transcribeStatus':_0xf3d7('0x42')}})[_0xf3d7('0x10')](function(_0x25b661){if(!_0x25b661||!_0x25b661[_0xf3d7('0x1c')]){throw new db[(_0xf3d7('0x1f'))]['ValidationError'](_0xf3d7('0x43'));}_0x59c6b6=_0x25b661;return db[_0xf3d7('0x44')][_0xf3d7('0x29')]({'where':{'id':0x1}});})[_0xf3d7('0x10')](function(_0xfce1a){if(!_0xfce1a){throw new db['Sequelize'][(_0xf3d7('0x20'))]('Settings\x20not\x20available');}_0x13f8b4=_0xfce1a;if(!_0x13f8b4[_0xf3d7('0x5')]||!_0x13f8b4[_0xf3d7('0x45')]||!_0x13f8b4[_0xf3d7('0x46')]||!_0x13f8b4[_0xf3d7('0x24')]||!_0x13f8b4[_0xf3d7('0x25')]){throw new db['Sequelize'][(_0xf3d7('0x20'))](_0xf3d7('0x47'));}return db[_0xf3d7('0x28')][_0xf3d7('0x29')]({'where':{'id':_0x13f8b4[_0xf3d7('0x45')]}});})['then'](function(_0xd564c1){if(!_0xd564c1){throw new db[(_0xf3d7('0x1f'))][(_0xf3d7('0x20'))](_0xf3d7('0x2a'));}if(!_0xd564c1[_0xf3d7('0xe')]||!_0xd564c1[_0xf3d7('0xf')]){throw new db[(_0xf3d7('0x1f'))][(_0xf3d7('0x20'))](_0xf3d7('0x2b'));}_0x83d058=_0xd564c1;var _0x5d0a67=[];_0x59c6b6[_0xf3d7('0x48')](function(_0x2e2a01){_0x5d0a67[_0xf3d7('0x49')](checkTranscribeJob(_0x2e2a01,_0x13f8b4,_0x83d058));});return BPromise['all'](_0x5d0a67);})[_0xf3d7('0x3b')](function(_0x1afff5){if(_0x1afff5){if(!_0x1afff5[_0xf3d7('0x3c')]||_0x1afff5[_0xf3d7('0x3c')]!==_0xf3d7('0x4a')){logger[_0xf3d7('0x3d')](util[_0xf3d7('0x3f')](_0x1afff5,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x91b6=['Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Negative','SentimentScore','Mixed','Neutral','FAILED','FailureReason','resolve','tempSentiment','findOne','Sentiment','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','push','catch','start','lodash','aws-sdk','util','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated'];(function(_0x43a6dc,_0x42ce1a){var _0x48541e=function(_0x22c2e3){while(--_0x22c2e3){_0x43a6dc['push'](_0x43a6dc['shift']());}};_0x48541e(++_0x42ce1a);}(_0x91b6,0x18b));var _0x691b=function(_0x2cc89c,_0x4c12a7){_0x2cc89c=_0x2cc89c-0x0;var _0x6c677=_0x91b6[_0x2cc89c];return _0x6c677;};var _=require(_0x691b('0x0'));var AWS=require(_0x691b('0x1'));var rp=require('request-promise');var util=require(_0x691b('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x691b('0x3'))(_0x691b('0x4'));function getTranscriptionJob(_0x22cf2d,_0x28f581,_0xeca3c,_0x3e19d0){return new Promise(function(_0x585420,_0x5586b9){var _0x448027=new AWS[(_0x691b('0x5'))]({'accessKeyId':_0x28f581,'secretAccessKey':_0x22cf2d,'region':_0xeca3c});_0x448027['getTranscriptionJob']({'TranscriptionJobName':_0x3e19d0},function(_0x223632,_0xceca6a){if(_0x223632){return _0x5586b9(_0x223632);}else{return _0x585420(_0xceca6a);}});});}function sentiment(_0x2fdbf8,_0x17aa85,_0xbd8767,_0x30204f,_0xc49113){return new Promise(function(_0x1073cb,_0x5ad4a9){var _0x3a4377=new AWS[(_0x691b('0x6'))]({'accessKeyId':_0x17aa85,'secretAccessKey':_0x2fdbf8,'region':_0xbd8767});_0x3a4377[_0x691b('0x7')]({'Text':_0x30204f,'LanguageCode':_0xc49113[_0x691b('0x8')](0x0,0x2)},function(_0x128bbf,_0x31eeb6){if(_0x128bbf){return _0x5ad4a9(_0x128bbf);}else{return _0x1073cb(_0x31eeb6);}});});}function checkTranscribeJob(_0x494e02,_0x3abde0,_0x152ebb){var _0xb9cc85;return new BPromise(function(_0x72a1eb,_0x592151){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0xb'),_0x494e02['id'],_0x494e02[_0x691b('0xc')]));return getTranscriptionJob(_0x152ebb[_0x691b('0xd')],_0x152ebb[_0x691b('0xe')],_0x3abde0[_0x691b('0xf')],_0x494e02['transcribeName'])[_0x691b('0x10')](function(_0x5952df){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x11'),_0x494e02['id'],_0x494e02[_0x691b('0xc')],_0x5952df[_0x691b('0x12')]['TranscriptionJobStatus']));if(!_0x494e02[_0x691b('0x13')]){switch(_0x5952df[_0x691b('0x12')][_0x691b('0x14')]){case _0x691b('0x15'):var _0x15ed6b={'transcribeStatus':_0x5952df['TranscriptionJob'][_0x691b('0x14')],'fileUri':_0x5952df[_0x691b('0x12')][_0x691b('0x16')][_0x691b('0x17')]};logger[_0x691b('0x9')](util[_0x691b('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x494e02['id']));return rp({'uri':_0x5952df[_0x691b('0x12')][_0x691b('0x16')]['TranscriptFileUri'],'json':!![]})[_0x691b('0x10')](function(_0x3d5a84){logger[_0x691b('0x9')](util['format'](_0x691b('0x18'),_0x494e02['id']));if(_0x3d5a84&&_0x3d5a84[_0x691b('0x19')]&&_0x3d5a84[_0x691b('0x19')]['transcripts']&&_0x3d5a84[_0x691b('0x19')][_0x691b('0x1a')]['length']){_0x15ed6b[_0x691b('0x13')]='';for(var _0x43ad07=0x0;_0x43ad07<_0x3d5a84[_0x691b('0x19')][_0x691b('0x1a')][_0x691b('0x1b')];_0x43ad07++){_0x15ed6b[_0x691b('0x13')]+=_0x3d5a84[_0x691b('0x19')]['transcripts'][_0x43ad07][_0x691b('0x1c')]+'';}}return _0x494e02[_0x691b('0x1d')](_0x15ed6b);})['then'](function(){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x1e'),_0x494e02['id']));if(!_0x494e02['tempSentiment']){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3abde0[_0x691b('0x21')]||!_0x3abde0[_0x691b('0x22')]||!_0x3abde0[_0x691b('0x23')]||!_0x3abde0['language']||!_0x3abde0[_0x691b('0x24')]){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))](_0x691b('0x25'));}if(!_0x15ed6b[_0x691b('0x13')]){throw new Error(_0x691b('0x26'));}if(_0x3abde0[_0x691b('0x22')]===_0x152ebb['id']){return _0x152ebb;}else{return db[_0x691b('0x27')]['findOne']({'where':{'id':_settings[_0x691b('0x22')]}});}})[_0x691b('0x10')](function(_0x1aa5aa){if(!_0x1aa5aa){throw new db['Sequelize'][(_0x691b('0x20'))](_0x691b('0x28'));}if(!_0x1aa5aa['data1']||!_0x1aa5aa[_0x691b('0xe')]){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))](_0x691b('0x29'));}_0xb9cc85=_0x1aa5aa;logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x2a'),_0x494e02['id']));return sentiment(_0xb9cc85[_0x691b('0xd')],_0xb9cc85['data2'],_0x3abde0[_0x691b('0x23')],_0x15ed6b[_0x691b('0x13')],_0x3abde0[_0x691b('0x2b')]);})['then'](function(_0x110827){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x2c'),_0x494e02['id']));return _0x494e02[_0x691b('0x1d')]({'sentiment':_0x110827['Sentiment'],'sPositive':_0x110827['SentimentScore'][_0x691b('0x2d')],'sNegative':_0x110827['SentimentScore'][_0x691b('0x2e')],'sMixed':_0x110827[_0x691b('0x2f')][_0x691b('0x30')],'sNeutral':_0x110827[_0x691b('0x2f')][_0x691b('0x31')]});})[_0x691b('0x10')](function(){logger[_0x691b('0x9')](util[_0x691b('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x494e02['id']));_0x72a1eb();});case'FAILED':return _0x494e02[_0x691b('0x1d')]({'transcribeStatus':_0x691b('0x32'),'failureReason':_0x5952df[_0x691b('0x12')][_0x691b('0x33')]})[_0x691b('0x10')](function(){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x1e'),_0x494e02['id']));_0x72a1eb();});default:logger[_0x691b('0x9')](util[_0x691b('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x494e02['id']));break;}}else{return BPromise[_0x691b('0x34')]()[_0x691b('0x10')](function(){if(!_0x494e02[_0x691b('0x35')]){throw new db[(_0x691b('0x1f'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3abde0[_0x691b('0x21')]||!_0x3abde0[_0x691b('0x22')]||!_0x3abde0[_0x691b('0x23')]||!_0x3abde0['language']||!_0x3abde0['bucket']){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))](_0x691b('0x25'));}if(!_0x494e02[_0x691b('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x3abde0['sentimentAccountId']===_0x152ebb['id']){return _0x152ebb;}else{return db[_0x691b('0x27')][_0x691b('0x36')]({'where':{'id':_settings[_0x691b('0x22')]}});}})[_0x691b('0x10')](function(_0x280805){if(!_0x280805){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x280805['data1']||!_0x280805['data2']){throw new db['Sequelize'][(_0x691b('0x20'))](_0x691b('0x29'));}_0xb9cc85=_0x280805;logger['info'](util['format'](_0x691b('0x2a'),_0x494e02['id']));return sentiment(_0xb9cc85[_0x691b('0xd')],_0xb9cc85[_0x691b('0xe')],_0x3abde0[_0x691b('0x23')],_0x494e02[_0x691b('0x13')],_0x3abde0[_0x691b('0x2b')]);})[_0x691b('0x10')](function(_0x5440f1){logger[_0x691b('0x9')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x494e02['id']));return _0x494e02['update']({'sentiment':_0x5440f1[_0x691b('0x37')],'sPositive':_0x5440f1[_0x691b('0x2f')][_0x691b('0x2d')],'sNegative':_0x5440f1[_0x691b('0x2f')][_0x691b('0x2e')],'sMixed':_0x5440f1[_0x691b('0x2f')][_0x691b('0x30')],'sNeutral':_0x5440f1['SentimentScore'][_0x691b('0x31')],'transcribeStatus':_0x691b('0x15')});})[_0x691b('0x10')](function(){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x1e'),_0x494e02['id']));_0x72a1eb();});}})['catch'](function(_0x1c1886){if(_0x1c1886){if(!_0x1c1886[_0x691b('0x38')]||_0x1c1886[_0x691b('0x38')]!==_0x691b('0x39')){logger[_0x691b('0x3a')](util[_0x691b('0xa')](_0x691b('0x3b'),_0x494e02['id']),util[_0x691b('0x3c')](_0x1c1886,{'showHidden':![],'depth':null}));}}_0x72a1eb();});});}function checkTranscribe(){var _0x5566ec;var _0x47f491;var _0x5dac4d;return db[_0x691b('0x3d')][_0x691b('0x3e')]({'where':{'transcribeStatus':_0x691b('0x3f')}})[_0x691b('0x10')](function(_0x3d69f5){if(!_0x3d69f5||!_0x3d69f5[_0x691b('0x1b')]){throw new db['Sequelize']['ValidationError'](_0x691b('0x40'));}_0x5566ec=_0x3d69f5;return db[_0x691b('0x41')][_0x691b('0x36')]({'where':{'id':0x1}});})[_0x691b('0x10')](function(_0x476b7f){if(!_0x476b7f){throw new db[(_0x691b('0x1f'))]['ValidationError'](_0x691b('0x42'));}_0x47f491=_0x476b7f;if(!_0x47f491[_0x691b('0x4')]||!_0x47f491[_0x691b('0x43')]||!_0x47f491[_0x691b('0xf')]||!_0x47f491['language']||!_0x47f491[_0x691b('0x24')]){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))]('Transcribe\x20not\x20configured');}return db[_0x691b('0x27')][_0x691b('0x36')]({'where':{'id':_0x47f491[_0x691b('0x43')]}});})[_0x691b('0x10')](function(_0x8c51c7){if(!_0x8c51c7){throw new db['Sequelize'][(_0x691b('0x20'))](_0x691b('0x28'));}if(!_0x8c51c7[_0x691b('0xd')]||!_0x8c51c7[_0x691b('0xe')]){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x5dac4d=_0x8c51c7;var _0x40964a=[];_0x5566ec['forEach'](function(_0x4be219){_0x40964a[_0x691b('0x44')](checkTranscribeJob(_0x4be219,_0x47f491,_0x5dac4d));});return BPromise['all'](_0x40964a);})[_0x691b('0x45')](function(_0x4b79b0){if(_0x4b79b0){if(!_0x4b79b0['name']||_0x4b79b0[_0x691b('0x38')]!==_0x691b('0x39')){logger['error'](util[_0x691b('0x3c')](_0x4b79b0,{'showHidden':![],'depth':null}));}}});}exports[_0x691b('0x46')]=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 1851f9a..e30023a 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 _0xf2a5=['[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','util','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','lastMsgAt','subtract','hours','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','format','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error'];(function(_0x4b9b78,_0x1dc74a){var _0x330388=function(_0x49bcdc){while(--_0x49bcdc){_0x4b9b78['push'](_0x4b9b78['shift']());}};_0x330388(++_0x1dc74a);}(_0xf2a5,0x6a));var _0x5f2a=function(_0x3af714,_0x248436){_0x3af714=_0x3af714-0x0;var _0x40ad6e=_0xf2a5[_0x3af714];return _0x40ad6e;};'use strict';var _=require(_0x5f2a('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0x5f2a('0x1'));var config=require('../../config/environment');var db=require(_0x5f2a('0x2'))['db'];var logger=require(_0x5f2a('0x3'))('schedule');config[_0x5f2a('0x4')]=_[_0x5f2a('0x5')](config[_0x5f2a('0x4')],{'host':_0x5f2a('0x6'),'port':0x18eb});var io=require(_0x5f2a('0x7'))(new Redis(config[_0x5f2a('0x4')]));function closeInteractions(){var _0x30da52=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0x5f2a('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x5f2a('0x9')](0x18,_0x5f2a('0xa'))}}})['then'](function(_0x5e9852){if(_0x5e9852&&_0x5e9852['length']){_0x30da52=_[_0x5f2a('0xb')](_0x5e9852||[],'id');logger[_0x5f2a('0xc')](_0x5f2a('0xd'),_0x30da52[_0x5f2a('0xe')]());return db[_0x5f2a('0xf')][_0x5f2a('0x10')]({'closeReason':_0x5f2a('0x11'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x5f2a('0x12')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x30da52}});}})[_0x5f2a('0x13')](function(){if(_0x30da52&&_0x30da52['length']){logger[_0x5f2a('0xc')](_0x5f2a('0x14'),_0x30da52['join']());for(var _0x47fd70=0x0;_0x47fd70<_0x30da52['length'];_0x47fd70++){io['emit'](_0x5f2a('0x15'),{'id':_0x30da52[_0x47fd70],'closed':!![]});}}})[_0x5f2a('0x16')](function(_0x41ce38){logger[_0x5f2a('0x17')](_0x5f2a('0x18'),_0x41ce38?util['inspect'](_0x41ce38,{'showHidden':![],'depth':null}):'');});}exports[_0x5f2a('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa4f4=['util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','moment','ioredis'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xa4f4,0xf6));var _0x4a4f=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xa4f4[_0x2aea9e];return _0x430b92;};'use strict';var _=require('lodash');var moment=require(_0x4a4f('0x0'));var Redis=require(_0x4a4f('0x1'));var util=require(_0x4a4f('0x2'));var config=require(_0x4a4f('0x3'));var db=require(_0x4a4f('0x4'))['db'];var logger=require(_0x4a4f('0x5'))(_0x4a4f('0x6'));config[_0x4a4f('0x7')]=_[_0x4a4f('0x8')](config[_0x4a4f('0x7')],{'host':_0x4a4f('0x9'),'port':0x18eb});var io=require(_0x4a4f('0xa'))(new Redis(config[_0x4a4f('0x7')]));function closeInteractions(){var _0x34c739=[];return db[_0x4a4f('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x4a4f('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4a4f('0xd')](0x18,'hours')}}})[_0x4a4f('0xe')](function(_0x370180){if(_0x370180&&_0x370180[_0x4a4f('0xf')]){_0x34c739=_[_0x4a4f('0x10')](_0x370180||[],'id');logger['info'](_0x4a4f('0x11'),_0x34c739[_0x4a4f('0x12')]());return db[_0x4a4f('0xb')]['update']({'closeReason':_0x4a4f('0x13'),'disposition':_0x4a4f('0x14'),'closed':!![],'closedAt':moment()[_0x4a4f('0x15')](_0x4a4f('0x16'))},{'where':{'id':_0x34c739}});}})['then'](function(){if(_0x34c739&&_0x34c739[_0x4a4f('0xf')]){logger[_0x4a4f('0x17')](_0x4a4f('0x18'),_0x34c739[_0x4a4f('0x12')]());for(var _0x1c1b5c=0x0;_0x1c1b5c<_0x34c739[_0x4a4f('0xf')];_0x1c1b5c++){io[_0x4a4f('0x19')](_0x4a4f('0x1a'),{'id':_0x34c739[_0x1c1b5c],'closed':!![]});}}})[_0x4a4f('0x1b')](function(_0x34e643){logger[_0x4a4f('0x1c')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x34e643?util[_0x4a4f('0x1d')](_0x34e643,{'showHidden':![],'depth':null}):'');});}exports[_0x4a4f('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 e223158..67ed8f9 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4925=['contacts1','destroy','finished\x20populating','contacts2','CmHopper','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','CmContact','then','bulkCreate','log'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_0x4925,0x105));var _0x5492=function(_0x437d7f,_0x1feb46){_0x437d7f=_0x437d7f-0x0;var _0x31058c=_0x4925[_0x437d7f];return _0x31058c;};'use strict';var util=require(_0x5492('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x5492('0x1')]({'id':i,'firstName':_0x5492('0x2')+i,'lastName':_0x5492('0x3')+i,'phone':0xf879fb460+i,'email':_0x5492('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x5492('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x5492('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x5492('0x1')]({'id':i,'firstName':_0x5492('0x2')+i,'lastName':_0x5492('0x3')+i,'phone':0xf879fb460+i,'email':_0x5492('0x4')+i+_0x5492('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x5492('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5492('0x5')](),'updatedAt':Date[_0x5492('0x5')]()});}db[_0x5492('0x7')]['destroy']({'where':{}})[_0x5492('0x8')](function(){return db[_0x5492('0x7')][_0x5492('0x9')](contacts);})[_0x5492('0x8')](function(){console[_0x5492('0xa')]('finished\x20populating',_0x5492('0xb'));return db['CmHopper'][_0x5492('0xc')]({'where':{}});})['then'](function(){return db['CmHopper'][_0x5492('0x9')](hopper);})[_0x5492('0x8')](function(){console['log']('finished\x20populating','hopper1');return db[_0x5492('0x7')][_0x5492('0x9')](contacts2);})[_0x5492('0x8')](function(){console[_0x5492('0xa')](_0x5492('0xd'),_0x5492('0xe'));return db[_0x5492('0xf')][_0x5492('0x9')](hopper2);})[_0x5492('0x8')](function(){console[_0x5492('0xa')](_0x5492('0xd'),'hopper2');})[_0x5492('0x10')](function(_0x5667d9){console[_0x5492('0xa')](_0x5667d9);}); \ No newline at end of file +var _0x7634=['push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','log','contacts1','CmHopper','bulkCreate','finished\x20populating','hopper1','contacts2','catch','util','../mysqldb'];(function(_0x4332fb,_0x57977a){var _0x1e8335=function(_0x1d14f9){while(--_0x1d14f9){_0x4332fb['push'](_0x4332fb['shift']());}};_0x1e8335(++_0x57977a);}(_0x7634,0x70));var _0x4763=function(_0x11f6de,_0xdeae3b){_0x11f6de=_0x11f6de-0x0;var _0x3b912b=_0x7634[_0x11f6de];return _0x3b912b;};'use strict';var util=require(_0x4763('0x0'));var db=require(_0x4763('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4763('0x2')]({'id':i,'firstName':_0x4763('0x3')+i,'lastName':_0x4763('0x4')+i,'phone':0xf879fb460+i,'email':_0x4763('0x5')+i+_0x4763('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4763('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4763('0x7')](),'updatedAt':Date[_0x4763('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4763('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x4763('0x4')+i,'phone':0xf879fb460+i,'email':_0x4763('0x5')+i+_0x4763('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x4763('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4763('0x7')](),'updatedAt':Date[_0x4763('0x7')]()});}db[_0x4763('0x8')][_0x4763('0x9')]({'where':{}})[_0x4763('0xa')](function(){return db[_0x4763('0x8')]['bulkCreate'](contacts);})[_0x4763('0xa')](function(){console[_0x4763('0xb')]('finished\x20populating',_0x4763('0xc'));return db['CmHopper'][_0x4763('0x9')]({'where':{}});})[_0x4763('0xa')](function(){return db[_0x4763('0xd')][_0x4763('0xe')](hopper);})[_0x4763('0xa')](function(){console[_0x4763('0xb')](_0x4763('0xf'),_0x4763('0x10'));return db[_0x4763('0x8')][_0x4763('0xe')](contacts2);})[_0x4763('0xa')](function(){console[_0x4763('0xb')]('finished\x20populating',_0x4763('0x11'));return db['CmHopper']['bulkCreate'](hopper2);})['then'](function(){console['log'](_0x4763('0xf'),'hopper2');})[_0x4763('0x12')](function(_0x32f1f4){console[_0x4763('0xb')](_0x32f1f4);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 4b3615d..7f14242 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x112f=['udp','wss','all','yes','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend'];(function(_0x3d2373,_0x488599){var _0x5bbfaa=function(_0x1f0fd6){while(--_0x1f0fd6){_0x3d2373['push'](_0x3d2373['shift']());}};_0x5bbfaa(++_0x488599);}(_0x112f,0x6a));var _0xf112=function(_0x38febf,_0x1fdebc){_0x38febf=_0x38febf-0x0;var _0x36db7f=_0x112f[_0x38febf];return _0x36db7f;};'use strict';var util=require('util');var db=require(_0xf112('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf112('0x1')]({'name':util[_0xf112('0x2')](_0xf112('0x3'),_0xf112('0x4'),i),'fullname':util[_0xf112('0x2')](_0xf112('0x3'),_0xf112('0x4'),i),'email':util[_0xf112('0x2')](_0xf112('0x5'),_0xf112('0x4'),i),'role':_0xf112('0x4'),'password':_0xf112('0x6'),'internal':0xfa0+i,'type':_0xf112('0x7'),'transport':[_0xf112('0x8'),'ws',_0xf112('0x9')],'disallow':[_0xf112('0xa')],'allow':['ulaw'],'defaultuser':util[_0xf112('0x2')](_0xf112('0x3'),_0xf112('0x4'),i),'encryption':_0xf112('0xb'),'avpf':_0xf112('0xb'),'force_avp':_0xf112('0xb'),'icesupport':'yes','dtlsenable':_0xf112('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xf112('0xc'),'callerid':util[_0xf112('0x2')](_0xf112('0xd'),util[_0xf112('0x2')](_0xf112('0x3'),_0xf112('0x4'),i),0xfa0+i)});}db[_0xf112('0xe')]['bulkCreate'](users)[_0xf112('0xf')](function(){console[_0xf112('0x10')](_0xf112('0x11'));})[_0xf112('0x12')](function(_0x747e4c){console[_0xf112('0x10')](_0x747e4c);}); \ No newline at end of file +var _0xab66=['%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','catch','util','../mysqldb','push','format','%s%s','agent'];(function(_0x4a007c,_0x810025){var _0x19f12b=function(_0x5f12f3){while(--_0x5f12f3){_0x4a007c['push'](_0x4a007c['shift']());}};_0x19f12b(++_0x810025);}(_0xab66,0x125));var _0x6ab6=function(_0x870992,_0x3634b7){_0x870992=_0x870992-0x0;var _0x2c1dfb=_0xab66[_0x870992];return _0x2c1dfb;};'use strict';var util=require(_0x6ab6('0x0'));var db=require(_0x6ab6('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x6ab6('0x2')]({'name':util[_0x6ab6('0x3')](_0x6ab6('0x4'),'agent',i),'fullname':util['format'](_0x6ab6('0x4'),_0x6ab6('0x5'),i),'email':util[_0x6ab6('0x3')](_0x6ab6('0x6'),'agent',i),'role':'agent','password':_0x6ab6('0x7'),'internal':0xfa0+i,'type':_0x6ab6('0x8'),'transport':[_0x6ab6('0x9'),'ws',_0x6ab6('0xa')],'disallow':[_0x6ab6('0xb')],'allow':[_0x6ab6('0xc')],'defaultuser':util[_0x6ab6('0x3')](_0x6ab6('0x4'),_0x6ab6('0x5'),i),'encryption':_0x6ab6('0xd'),'avpf':_0x6ab6('0xd'),'force_avp':_0x6ab6('0xd'),'icesupport':_0x6ab6('0xd'),'dtlsenable':_0x6ab6('0xd'),'dtlsverify':'no','dtlscertfile':_0x6ab6('0xe'),'dtlsprivatekey':_0x6ab6('0xf'),'dtlssetup':_0x6ab6('0x10'),'callerid':util[_0x6ab6('0x3')](_0x6ab6('0x11'),util[_0x6ab6('0x3')](_0x6ab6('0x4'),_0x6ab6('0x5'),i),0xfa0+i)});}db[_0x6ab6('0x12')][_0x6ab6('0x13')](users)[_0x6ab6('0x14')](function(){console[_0x6ab6('0x15')]('add\x20user');})[_0x6ab6('0x16')](function(_0x5b2966){console[_0x6ab6('0x15')](_0x5b2966);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index f2f8604..cfa2450 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4991=['OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','SmsQueues','MailQueues','IvrCampaigns','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getWhatsappQueues','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','SmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','setMaxListeners','request','connection','remoteAddress','remotePort','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','./environment','name','Agents','User','role','agent','type','ivr','UserProfileSection','findOne','autoAssociation','ChatQueues','FaxQueues','WhatsappQueues','findAll','Telephones','Trunks','resourceId','then','map','where','telephone','Campaign','format','%s:queue:%s','length','user:%s','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue'];(function(_0x5eaee0,_0xa466b8){var _0x17016c=function(_0x1a036b){while(--_0x1a036b){_0x5eaee0['push'](_0x5eaee0['shift']());}};_0x17016c(++_0xa466b8);}(_0x4991,0xf7));var _0x1499=function(_0x4bc56e,_0x4f2fc0){_0x4bc56e=_0x4bc56e-0x0;var _0x29c230=_0x4991[_0x4bc56e];return _0x29c230;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var BPromise=require(_0x1499('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x1499('0x2'));var queryQueues={'attributes':['id',_0x1499('0x3')],'include':[{'as':_0x1499('0x4'),'model':db[_0x1499('0x5')],'attributes':['id',_0x1499('0x3'),_0x1499('0x6')],'raw':!![],'where':{'role':_0x1499('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1499('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x1499('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x1499('0x3')],'where':{'role':_0x1499('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1499('0x3'),_0x1499('0x8')],'where':{'type':_0x1499('0x9')}};function getAssociatedResources(_0x3277b3,_0x15b291,_0x48d2ca){return db[_0x1499('0xa')][_0x1499('0xb')]({'where':{'name':_0x3277b3,'userProfileId':_0x15b291},'raw':!![]})['then'](function(_0x2a4816){if(_0x2a4816){if(_0x2a4816[_0x1499('0xc')]){switch(_0x3277b3){case'VoiceQueues':case _0x1499('0xd'):case _0x1499('0xe'):case'SmsQueues':case'MailQueues':case'OpenchannelQueues':case _0x1499('0xf'):return db[_0x48d2ca][_0x1499('0x10')](queryQueues);case _0x1499('0x11'):return db[_0x48d2ca][_0x1499('0x10')](queryTelephones);case _0x1499('0x12'):return db[_0x48d2ca]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x48d2ca][_0x1499('0x10')](queryCampaigns);}}else{return db['UserProfileResource'][_0x1499('0x10')]({'attributes':[_0x1499('0x13')],'where':{'sectionId':_0x2a4816['id']},'raw':!![]})[_0x1499('0x14')](function(_0x3ab605){if(_0x3ab605){var _0x48f654={'where':{'id':_[_0x1499('0x15')](_0x3ab605,_0x1499('0x13'))},'raw':!![]};switch(_0x48d2ca){case'User':_0x48f654[_0x1499('0x16')][_0x1499('0x6')]=_0x1499('0x17');break;case _0x1499('0x18'):_0x48f654[_0x1499('0x16')][_0x1499('0x8')]='ivr';break;}return db[_0x48d2ca]['findAll'](_0x48f654);}else{return[];}});}}else{return[];}})['then'](function(_0x2172b3){return _0x2172b3;});}function joinOrLeaveQueues(_0xad534b,_0x4a4e28,_0x351da9,_0x3c13a1){_0xad534b[_0x4a4e28](util[_0x1499('0x19')](_0x1499('0x1a'),_0x351da9,_0x3c13a1[_0x1499('0x3')]));if(_0x3c13a1[_0x1499('0x4')]){for(var _0x2b0458=0x0;_0x2b0458<_0x3c13a1[_0x1499('0x4')][_0x1499('0x1b')];_0x2b0458+=0x1){_0xad534b[_0x4a4e28](util[_0x1499('0x19')](_0x1499('0x1c'),_0x3c13a1[_0x1499('0x4')][_0x2b0458][_0x1499('0x3')]));}}}function joinOrLeave(_0x3b73f6,_0x4ec57a,_0x1e2c51){var _0x2c7f57;if(_0x3b73f6['handshake'][_0x1499('0x1d')]['id']){db[_0x1499('0x5')][_0x1499('0x1e')]({'attributes':['id',_0x1499('0x3'),_0x1499('0x6'),_0x1499('0x1f')],'where':{'id':_0x3b73f6['handshake']['query']['id']},'include':[{'model':db[_0x1499('0x20')],'as':_0x1499('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x1499('0x22')],'as':_0x1499('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x1499('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1499('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1499('0x26')],'as':_0x1499('0x27'),'attributes':['id'],'raw':!![]}]})[_0x1499('0x14')](function(_0x1b460b){if(_0x1b460b){_0x2c7f57=_0x1b460b;_0x3b73f6[_0x4ec57a](util[_0x1499('0x19')](_0x1499('0x1c'),_0x1b460b[_0x1499('0x3')]));var _0x5d3ec5=[];switch(_0x1b460b[_0x1499('0x6')]){case _0x1499('0x28'):_0x3b73f6[_0x4ec57a](_0x1499('0x29'));_0x3b73f6[_0x4ec57a]('voice:outbound');if(queryQueues[_0x1499('0x2a')](_0x1499('0x2b'))){delete queryQueues['include'];}_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x2d')]['findAll'](queryQueues));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x2e')][_0x1499('0x10')](queryQueues));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x2f')][_0x1499('0x10')](queryQueues));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x30')][_0x1499('0x10')](queryQueues));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x31')][_0x1499('0x10')](queryQueues));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x32')][_0x1499('0x10')](queryQueues));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x33')][_0x1499('0x10')](queryQueues));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x5')]['findAll'](queryTelephones));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x34')][_0x1499('0x10')](queryTrunks));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x18')][_0x1499('0x10')](queryCampaigns));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x5')][_0x1499('0x10')](queryAgents));break;case _0x1499('0x35'):_0x3b73f6[_0x4ec57a](_0x1499('0x29'));_0x3b73f6[_0x4ec57a]('voice:outbound');_0x5d3ec5['push'](getAssociatedResources(_0x1499('0x36'),_0x1b460b['userProfileId'],_0x1499('0x2d')));_0x5d3ec5['push'](getAssociatedResources(_0x1499('0xd'),_0x1b460b[_0x1499('0x1f')],_0x1499('0x2e')));_0x5d3ec5[_0x1499('0x2c')](getAssociatedResources('FaxQueues',_0x1b460b[_0x1499('0x1f')],'FaxQueue'));_0x5d3ec5[_0x1499('0x2c')](getAssociatedResources(_0x1499('0x37'),_0x1b460b[_0x1499('0x1f')],_0x1499('0x30')));_0x5d3ec5['push'](getAssociatedResources(_0x1499('0x38'),_0x1b460b[_0x1499('0x1f')],_0x1499('0x31')));_0x5d3ec5[_0x1499('0x2c')](getAssociatedResources('OpenchannelQueues',_0x1b460b[_0x1499('0x1f')],'OpenchannelQueue'));_0x5d3ec5[_0x1499('0x2c')](getAssociatedResources(_0x1499('0xf'),_0x1b460b[_0x1499('0x1f')],_0x1499('0x33')));_0x5d3ec5[_0x1499('0x2c')](getAssociatedResources(_0x1499('0x11'),_0x1b460b[_0x1499('0x1f')],_0x1499('0x5')));_0x5d3ec5[_0x1499('0x2c')](getAssociatedResources(_0x1499('0x12'),_0x1b460b['userProfileId'],_0x1499('0x34')));_0x5d3ec5['push'](getAssociatedResources(_0x1499('0x39'),_0x1b460b[_0x1499('0x1f')],'Campaign'));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x5')][_0x1499('0x10')](queryAgents));break;case _0x1499('0x7'):_0x3b73f6[_0x4ec57a](_0x1499('0x29'));_0x3b73f6[_0x4ec57a]('voice:outbound');_0x5d3ec5['push'](_0x1b460b[_0x1499('0x3a')]({'attributes':['id',_0x1499('0x3')]}));_0x5d3ec5['push'](_0x1b460b[_0x1499('0x3b')]({'attributes':['id',_0x1499('0x3')]}));_0x5d3ec5['push'](_0x1b460b['getFaxQueues']({'attributes':['id',_0x1499('0x3')]}));_0x5d3ec5[_0x1499('0x2c')](_0x1b460b[_0x1499('0x3c')]({'attributes':['id','name']}));_0x5d3ec5[_0x1499('0x2c')](_0x1b460b[_0x1499('0x3d')]({'attributes':['id',_0x1499('0x3')]}));_0x5d3ec5[_0x1499('0x2c')](_0x1b460b['getOpenchannelQueues']({'attributes':['id',_0x1499('0x3')]}));_0x5d3ec5[_0x1499('0x2c')](_0x1b460b[_0x1499('0x3e')]({'attributes':['id',_0x1499('0x3')]}));break;}return BPromise['all'](_0x5d3ec5);}})[_0x1499('0x14')](function(_0x123a1d){if(_0x123a1d&&_0x123a1d[_0x1499('0x1b')]){for(var _0x4b36c4=0x0;_0x4b36c4<_0x123a1d['length'];_0x4b36c4+=0x1){for(var _0xe49a9f=0x0;_0xe49a9f<_0x123a1d[_0x4b36c4]['length'];_0xe49a9f+=0x1){switch(_0x4b36c4){case 0x0:joinOrLeaveQueues(_0x3b73f6,_0x4ec57a,_0x1499('0x3f'),_0x123a1d[_0x4b36c4][_0xe49a9f]);break;case 0x1:joinOrLeaveQueues(_0x3b73f6,_0x4ec57a,_0x1499('0x40'),_0x123a1d[_0x4b36c4][_0xe49a9f]);break;case 0x2:joinOrLeaveQueues(_0x3b73f6,_0x4ec57a,_0x1499('0x41'),_0x123a1d[_0x4b36c4][_0xe49a9f]);break;case 0x3:joinOrLeaveQueues(_0x3b73f6,_0x4ec57a,_0x1499('0x42'),_0x123a1d[_0x4b36c4][_0xe49a9f]);break;case 0x4:joinOrLeaveQueues(_0x3b73f6,_0x4ec57a,_0x1499('0x43'),_0x123a1d[_0x4b36c4][_0xe49a9f]);break;case 0x5:joinOrLeaveQueues(_0x3b73f6,_0x4ec57a,_0x1499('0x44'),_0x123a1d[_0x4b36c4][_0xe49a9f]);break;case 0x6:joinOrLeaveQueues(_0x3b73f6,_0x4ec57a,_0x1499('0x45'),_0x123a1d[_0x4b36c4][_0xe49a9f]);break;case 0x7:if(_0x2c7f57['role']!==_0x1499('0x7'))_0x3b73f6[_0x4ec57a](util['format'](_0x1499('0x46'),_0x123a1d[_0x4b36c4][_0xe49a9f][_0x1499('0x3')]));break;case 0x8:if(_0x2c7f57['role']!==_0x1499('0x7'))_0x3b73f6[_0x4ec57a](util[_0x1499('0x19')](_0x1499('0x47'),_0x123a1d[_0x4b36c4][_0xe49a9f]['name']));break;case 0x9:if(_0x2c7f57[_0x1499('0x6')]!==_0x1499('0x7'))_0x3b73f6[_0x4ec57a](util[_0x1499('0x19')](_0x1499('0x48'),_0x123a1d[_0x4b36c4][_0xe49a9f][_0x1499('0x8')],_0x123a1d[_0x4b36c4][_0xe49a9f][_0x1499('0x3')]));break;case 0xa:_0x3b73f6[_0x4ec57a](util[_0x1499('0x19')](_0x1499('0x1c'),_0x123a1d[_0x4b36c4][_0xe49a9f][_0x1499('0x3')]));break;}}}}})[_0x1499('0x14')](function(){if(_0x4ec57a==='leave'){var _0x13770a=_[_0x1499('0x15')](_0x2c7f57[_0x1499('0x21')],'id');return _0x2c7f57['removeChatInteractions'](_0x13770a)[_0x1499('0x14')](function(){for(var _0x2a7614=0x0;_0x2a7614<_0x13770a['length'];_0x2a7614+=0x1){_0x1e2c51[_0x1499('0x49')](_0x1499('0x4a'),{'ChatInteractionId':Number(_0x13770a[_0x2a7614]),'UserId':Number(_0x2c7f57['id'])});}});}})['then'](function(){if(_0x4ec57a===_0x1499('0x4b')){var _0x1fb718=_[_0x1499('0x15')](_0x2c7f57[_0x1499('0x23')],'id');return _0x2c7f57[_0x1499('0x4c')](_0x1fb718)[_0x1499('0x14')](function(){for(var _0x10450f=0x0;_0x10450f<_0x1fb718['length'];_0x10450f+=0x1){_0x1e2c51[_0x1499('0x49')](_0x1499('0x4d'),{'MailInteractionId':Number(_0x1fb718[_0x10450f]),'UserId':Number(_0x2c7f57['id'])});}});}})[_0x1499('0x14')](function(){if(_0x4ec57a===_0x1499('0x4b')){var _0x52f4ae=_['map'](_0x2c7f57[_0x1499('0x4e')],'id');return _0x2c7f57[_0x1499('0x4f')](_0x52f4ae)['then'](function(){for(var _0x3c3a20=0x0;_0x3c3a20<_0x52f4ae[_0x1499('0x1b')];_0x3c3a20+=0x1){_0x1e2c51[_0x1499('0x49')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x52f4ae[_0x3c3a20]),'UserId':Number(_0x2c7f57['id'])});}});}})['then'](function(){if(_0x4ec57a==='leave'){var _0x308ce2=_[_0x1499('0x15')](_0x2c7f57[_0x1499('0x50')],'id');return _0x2c7f57['removeSmsInteractions'](_0x308ce2)[_0x1499('0x14')](function(){for(var _0x588e56=0x0;_0x588e56<_0x308ce2[_0x1499('0x1b')];_0x588e56+=0x1){_0x1e2c51[_0x1499('0x49')](_0x1499('0x51'),{'SmsInteractionId':Number(_0x308ce2[_0x588e56]),'UserId':Number(_0x2c7f57['id'])});}});}})[_0x1499('0x14')](function(){if(_0x4ec57a==='leave'){var _0x53a9da=_['map'](_0x2c7f57[_0x1499('0x52')],'id');return _0x2c7f57[_0x1499('0x53')](_0x53a9da)[_0x1499('0x14')](function(){for(var _0x28866f=0x0;_0x28866f<_0x53a9da['length'];_0x28866f+=0x1){_0x1e2c51[_0x1499('0x49')](_0x1499('0x54'),{'OpenchannelInteractionId':Number(_0x53a9da[_0x28866f]),'UserId':Number(_0x2c7f57['id'])});}});}})['then'](function(){if(_0x4ec57a===_0x1499('0x4b')){var _0x4f2887=_[_0x1499('0x15')](_0x2c7f57[_0x1499('0x27')],'id');return _0x2c7f57[_0x1499('0x55')](_0x4f2887)['then'](function(){for(var _0x739e63=0x0;_0x739e63<_0x4f2887[_0x1499('0x1b')];_0x739e63+=0x1){_0x1e2c51[_0x1499('0x49')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x4f2887[_0x739e63]),'UserId':Number(_0x2c7f57['id'])});}});}})[_0x1499('0x56')](function(_0x3ff1ce){_0x3b73f6[_0x1499('0x57')](_0x3ff1ce);});}}function onDisconnect(_0x4a7706,_0x305fee){joinOrLeave(_0x4a7706,_0x1499('0x4b'),_0x305fee);}function onConnect(_0x217399){joinOrLeave(_0x217399,_0x1499('0x58'));}exports[_0x1499('0x59')]=function(_0x96a0ed){_0x96a0ed['on']('connection',function(_0x1df8d0){_0x1df8d0[_0x1499('0x5a')](0x0);_0x1df8d0['address']=_0x1df8d0[_0x1499('0x5b')][_0x1499('0x5c')][_0x1499('0x5d')]+':'+_0x1df8d0[_0x1499('0x5b')][_0x1499('0x5c')][_0x1499('0x5e')];_0x1df8d0['connectedAt']=new Date();_0x1df8d0[_0x1499('0x57')]=function(_0x3bd8c9){console[_0x1499('0x57')]('SocketIO\x20'+_0x1df8d0[_0x1499('0x5f')][_0x1499('0x3')]+'['+_0x1df8d0['address']+']',_0x3bd8c9);};_0x1df8d0['on'](_0x1499('0x60'),function(){onDisconnect(_0x1df8d0,_0x96a0ed);_0x1df8d0[_0x1499('0x57')](_0x1499('0x61'));});onConnect(_0x1df8d0);_0x1df8d0[_0x1499('0x57')](_0x1499('0x62'));});}; \ No newline at end of file +var _0x930b=['SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','user:%s','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','voice:outbound','OpenchannelQueue','WhatsappQueues','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','leave','removeFaxInteractions','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','log','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','../mysqldb','./environment','name','role','agent','telephone','type','ivr','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','Telephones','Trunks','findAll','UserProfileResource','resourceId','map','User','Campaign','where','then','%s:queue:%s','Agents','format','handshake','query','userProfileId','ChatInteraction','MailInteractions','FaxInteraction','FaxInteractions'];(function(_0x3fefe7,_0x4dae86){var _0x21a6d5=function(_0xcba50c){while(--_0xcba50c){_0x3fefe7['push'](_0x3fefe7['shift']());}};_0x21a6d5(++_0x4dae86);}(_0x930b,0x106));var _0xb930=function(_0x3b9f8e,_0x5c044d){_0x3b9f8e=_0x3b9f8e-0x0;var _0x301469=_0x930b[_0x3b9f8e];return _0x301469;};'use strict';var _=require(_0xb930('0x0'));var util=require(_0xb930('0x1'));var BPromise=require('bluebird');var db=require(_0xb930('0x2'))['db'];var config=require(_0xb930('0x3'));var queryQueues={'attributes':['id',_0xb930('0x4')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0xb930('0x4'),_0xb930('0x5')],'raw':!![],'where':{'role':_0xb930('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xb930('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb930('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xb930('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb930('0x4'),_0xb930('0x8')],'where':{'type':_0xb930('0x9')}};function getAssociatedResources(_0xb5f26f,_0x1614d3,_0x48a7e1){return db['UserProfileSection'][_0xb930('0xa')]({'where':{'name':_0xb5f26f,'userProfileId':_0x1614d3},'raw':!![]})['then'](function(_0x400032){if(_0x400032){if(_0x400032[_0xb930('0xb')]){switch(_0xb5f26f){case _0xb930('0xc'):case _0xb930('0xd'):case _0xb930('0xe'):case _0xb930('0xf'):case _0xb930('0x10'):case _0xb930('0x11'):case'WhatsappQueues':return db[_0x48a7e1]['findAll'](queryQueues);case _0xb930('0x12'):return db[_0x48a7e1]['findAll'](queryTelephones);case _0xb930('0x13'):return db[_0x48a7e1][_0xb930('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x48a7e1][_0xb930('0x14')](queryCampaigns);}}else{return db[_0xb930('0x15')][_0xb930('0x14')]({'attributes':[_0xb930('0x16')],'where':{'sectionId':_0x400032['id']},'raw':!![]})['then'](function(_0x465c2c){if(_0x465c2c){var _0x2631c9={'where':{'id':_[_0xb930('0x17')](_0x465c2c,_0xb930('0x16'))},'raw':!![]};switch(_0x48a7e1){case _0xb930('0x18'):_0x2631c9['where'][_0xb930('0x5')]=_0xb930('0x7');break;case _0xb930('0x19'):_0x2631c9[_0xb930('0x1a')][_0xb930('0x8')]=_0xb930('0x9');break;}return db[_0x48a7e1][_0xb930('0x14')](_0x2631c9);}else{return[];}});}}else{return[];}})[_0xb930('0x1b')](function(_0x343068){return _0x343068;});}function joinOrLeaveQueues(_0x1fcc73,_0x4771ec,_0x56281b,_0x134c7f){_0x1fcc73[_0x4771ec](util['format'](_0xb930('0x1c'),_0x56281b,_0x134c7f[_0xb930('0x4')]));if(_0x134c7f[_0xb930('0x1d')]){for(var _0x1b7a77=0x0;_0x1b7a77<_0x134c7f[_0xb930('0x1d')]['length'];_0x1b7a77+=0x1){_0x1fcc73[_0x4771ec](util[_0xb930('0x1e')]('user:%s',_0x134c7f[_0xb930('0x1d')][_0x1b7a77]['name']));}}}function joinOrLeave(_0x46df92,_0x20f8df,_0x231517){var _0x17b135;if(_0x46df92[_0xb930('0x1f')][_0xb930('0x20')]['id']){db[_0xb930('0x18')]['find']({'attributes':['id',_0xb930('0x4'),_0xb930('0x5'),_0xb930('0x21')],'where':{'id':_0x46df92[_0xb930('0x1f')]['query']['id']},'include':[{'model':db[_0xb930('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xb930('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xb930('0x24')],'as':_0xb930('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xb930('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb930('0x27')],'as':_0xb930('0x28'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xb930('0x29'),'attributes':['id'],'raw':!![]}]})[_0xb930('0x1b')](function(_0x3d45c2){if(_0x3d45c2){_0x17b135=_0x3d45c2;_0x46df92[_0x20f8df](util[_0xb930('0x1e')](_0xb930('0x2a'),_0x3d45c2[_0xb930('0x4')]));var _0x36a00e=[];switch(_0x3d45c2[_0xb930('0x5')]){case _0xb930('0x2b'):_0x46df92[_0x20f8df](_0xb930('0x2c'));_0x46df92[_0x20f8df]('voice:outbound');if(queryQueues[_0xb930('0x2d')](_0xb930('0x2e'))){delete queryQueues[_0xb930('0x2e')];}_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x30')]['findAll'](queryQueues));_0x36a00e['push'](db[_0xb930('0x31')]['findAll'](queryQueues));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x32')][_0xb930('0x14')](queryQueues));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x33')][_0xb930('0x14')](queryQueues));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x34')][_0xb930('0x14')](queryQueues));_0x36a00e[_0xb930('0x2f')](db['OpenchannelQueue'][_0xb930('0x14')](queryQueues));_0x36a00e['push'](db[_0xb930('0x35')][_0xb930('0x14')](queryQueues));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x18')][_0xb930('0x14')](queryTelephones));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x36')][_0xb930('0x14')](queryTrunks));_0x36a00e[_0xb930('0x2f')](db['Campaign']['findAll'](queryCampaigns));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x18')][_0xb930('0x14')](queryAgents));break;case'user':_0x46df92[_0x20f8df](_0xb930('0x2c'));_0x46df92[_0x20f8df](_0xb930('0x37'));_0x36a00e['push'](getAssociatedResources(_0xb930('0xc'),_0x3d45c2['userProfileId'],'VoiceQueue'));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0xd'),_0x3d45c2[_0xb930('0x21')],'ChatQueue'));_0x36a00e['push'](getAssociatedResources(_0xb930('0xe'),_0x3d45c2[_0xb930('0x21')],_0xb930('0x32')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0xf'),_0x3d45c2['userProfileId'],_0xb930('0x33')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0x10'),_0x3d45c2[_0xb930('0x21')],'MailQueue'));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0x11'),_0x3d45c2[_0xb930('0x21')],_0xb930('0x38')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0x39'),_0x3d45c2['userProfileId'],_0xb930('0x35')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources('Telephones',_0x3d45c2[_0xb930('0x21')],_0xb930('0x18')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0x13'),_0x3d45c2[_0xb930('0x21')],_0xb930('0x36')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0x3a'),_0x3d45c2[_0xb930('0x21')],_0xb930('0x19')));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x18')][_0xb930('0x14')](queryAgents));break;case'agent':_0x46df92[_0x20f8df](_0xb930('0x2c'));_0x46df92[_0x20f8df](_0xb930('0x37'));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x3b')]({'attributes':['id','name']}));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x3c')]({'attributes':['id',_0xb930('0x4')]}));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x3d')]({'attributes':['id','name']}));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x3e')]({'attributes':['id',_0xb930('0x4')]}));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x3f')]({'attributes':['id','name']}));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x40')]({'attributes':['id',_0xb930('0x4')]}));_0x36a00e['push'](_0x3d45c2[_0xb930('0x41')]({'attributes':['id',_0xb930('0x4')]}));break;}return BPromise['all'](_0x36a00e);}})[_0xb930('0x1b')](function(_0xa83bf7){if(_0xa83bf7&&_0xa83bf7[_0xb930('0x42')]){for(var _0x83ec8f=0x0;_0x83ec8f<_0xa83bf7['length'];_0x83ec8f+=0x1){for(var _0x2c6034=0x0;_0x2c6034<_0xa83bf7[_0x83ec8f][_0xb930('0x42')];_0x2c6034+=0x1){switch(_0x83ec8f){case 0x0:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x43'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x1:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x44'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x2:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x45'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x3:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x46'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x4:joinOrLeaveQueues(_0x46df92,_0x20f8df,'mail',_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x5:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x47'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x6:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x48'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x7:if(_0x17b135[_0xb930('0x5')]!==_0xb930('0x6'))_0x46df92[_0x20f8df](util[_0xb930('0x1e')](_0xb930('0x49'),_0xa83bf7[_0x83ec8f][_0x2c6034][_0xb930('0x4')]));break;case 0x8:if(_0x17b135[_0xb930('0x5')]!==_0xb930('0x6'))_0x46df92[_0x20f8df](util[_0xb930('0x1e')](_0xb930('0x4a'),_0xa83bf7[_0x83ec8f][_0x2c6034]['name']));break;case 0x9:if(_0x17b135[_0xb930('0x5')]!==_0xb930('0x6'))_0x46df92[_0x20f8df](util['format'](_0xb930('0x4b'),_0xa83bf7[_0x83ec8f][_0x2c6034][_0xb930('0x8')],_0xa83bf7[_0x83ec8f][_0x2c6034]['name']));break;case 0xa:_0x46df92[_0x20f8df](util[_0xb930('0x1e')](_0xb930('0x2a'),_0xa83bf7[_0x83ec8f][_0x2c6034]['name']));break;}}}}})['then'](function(){if(_0x20f8df==='leave'){var _0x1de39d=_[_0xb930('0x17')](_0x17b135['ChatInteractions'],'id');return _0x17b135[_0xb930('0x4c')](_0x1de39d)[_0xb930('0x1b')](function(){for(var _0x3f60d6=0x0;_0x3f60d6<_0x1de39d[_0xb930('0x42')];_0x3f60d6+=0x1){_0x231517[_0xb930('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x1de39d[_0x3f60d6]),'UserId':Number(_0x17b135['id'])});}});}})[_0xb930('0x1b')](function(){if(_0x20f8df==='leave'){var _0x1e813d=_[_0xb930('0x17')](_0x17b135['MailInteractions'],'id');return _0x17b135[_0xb930('0x4e')](_0x1e813d)[_0xb930('0x1b')](function(){for(var _0x2f3f76=0x0;_0x2f3f76<_0x1e813d[_0xb930('0x42')];_0x2f3f76+=0x1){_0x231517[_0xb930('0x4d')](_0xb930('0x4f'),{'MailInteractionId':Number(_0x1e813d[_0x2f3f76]),'UserId':Number(_0x17b135['id'])});}});}})['then'](function(){if(_0x20f8df===_0xb930('0x50')){var _0x54f527=_[_0xb930('0x17')](_0x17b135['FaxInteractions'],'id');return _0x17b135[_0xb930('0x51')](_0x54f527)['then'](function(){for(var _0x552a97=0x0;_0x552a97<_0x54f527[_0xb930('0x42')];_0x552a97+=0x1){_0x231517[_0xb930('0x4d')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x54f527[_0x552a97]),'UserId':Number(_0x17b135['id'])});}});}})[_0xb930('0x1b')](function(){if(_0x20f8df===_0xb930('0x50')){var _0x59d4ea=_['map'](_0x17b135[_0xb930('0x52')],'id');return _0x17b135[_0xb930('0x53')](_0x59d4ea)[_0xb930('0x1b')](function(){for(var _0x55a929=0x0;_0x55a929<_0x59d4ea[_0xb930('0x42')];_0x55a929+=0x1){_0x231517['emit'](_0xb930('0x54'),{'SmsInteractionId':Number(_0x59d4ea[_0x55a929]),'UserId':Number(_0x17b135['id'])});}});}})['then'](function(){if(_0x20f8df===_0xb930('0x50')){var _0x54fcde=_[_0xb930('0x17')](_0x17b135[_0xb930('0x28')],'id');return _0x17b135[_0xb930('0x55')](_0x54fcde)[_0xb930('0x1b')](function(){for(var _0x2ac4fc=0x0;_0x2ac4fc<_0x54fcde[_0xb930('0x42')];_0x2ac4fc+=0x1){_0x231517[_0xb930('0x4d')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x54fcde[_0x2ac4fc]),'UserId':Number(_0x17b135['id'])});}});}})['then'](function(){if(_0x20f8df===_0xb930('0x50')){var _0x263b8e=_[_0xb930('0x17')](_0x17b135[_0xb930('0x29')],'id');return _0x17b135[_0xb930('0x56')](_0x263b8e)[_0xb930('0x1b')](function(){for(var _0x77800c=0x0;_0x77800c<_0x263b8e['length'];_0x77800c+=0x1){_0x231517[_0xb930('0x4d')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x263b8e[_0x77800c]),'UserId':Number(_0x17b135['id'])});}});}})['catch'](function(_0x4c7779){_0x46df92[_0xb930('0x57')](_0x4c7779);});}}function onDisconnect(_0x47b7bf,_0x6dbe76){joinOrLeave(_0x47b7bf,_0xb930('0x50'),_0x6dbe76);}function onConnect(_0x114be2){joinOrLeave(_0x114be2,_0xb930('0x58'));}exports[_0xb930('0x59')]=function(_0x2091fb){_0x2091fb['on'](_0xb930('0x5a'),function(_0x54fc1d){_0x54fc1d[_0xb930('0x5b')](0x0);_0x54fc1d[_0xb930('0x5c')]=_0x54fc1d[_0xb930('0x5d')]['connection']['remoteAddress']+':'+_0x54fc1d[_0xb930('0x5d')][_0xb930('0x5a')][_0xb930('0x5e')];_0x54fc1d[_0xb930('0x5f')]=new Date();_0x54fc1d[_0xb930('0x57')]=function(_0x4c1de6){console[_0xb930('0x57')](_0xb930('0x60')+_0x54fc1d[_0xb930('0x61')][_0xb930('0x4')]+'['+_0x54fc1d[_0xb930('0x5c')]+']',_0x4c1de6);};_0x54fc1d['on'](_0xb930('0x62'),function(){onDisconnect(_0x54fc1d,_0x2091fb);_0x54fc1d[_0xb930('0x57')](_0xb930('0x63'));});onConnect(_0x54fc1d);_0x54fc1d[_0xb930('0x57')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index feb88da..c4d70db 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 _0x9102=['Sequelize','QueryTypes','SELECT','UserId','User','name','fullname','internal','interface','format','SIP/%s','channel','agent','incomingmessage','sequelize','query','contact','changed','closed','motionChannel','find','get','email','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','../../mysqldb','../logger','triggers','lodash','client','http','Chat','ChatInteraction','newinteraction','closedinteraction','afterCreate','newmessage','Sms','SmsInteraction','SmsMessage','WhatsappInteraction','Whatsapp','afterUpdate','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','substatus','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','then','info','Trigger,\x20%s','error','code','catch','event','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId'];(function(_0x5bd6a0,_0x41b345){var _0x51b71=function(_0x3f7f6b){while(--_0x3f7f6b){_0x5bd6a0['push'](_0x5bd6a0['shift']());}};_0x51b71(++_0x41b345);}(_0x9102,0x133));var _0x2910=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x9102[_0xa6cc5c];return _0x44803d;};'use strict';var util=require('util');var db=require(_0x2910('0x0'))['db'];var jayson=require('jayson/promise');var logger=require(_0x2910('0x1'))(_0x2910('0x2'));var _=require(_0x2910('0x3'));var client=jayson[_0x2910('0x4')][_0x2910('0x5')]({'port':0x232a});var triggers=[{'channel':_0x2910('0x6'),'model':_0x2910('0x7'),'event':'afterCreate','condition':_0x2910('0x8'),'callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':'afterUpdate','condition':_0x2910('0x9'),'callback':afterUpdate},{'channel':_0x2910('0x6'),'model':'ChatMessage','event':_0x2910('0xa'),'condition':_0x2910('0xb'),'callback':afterCreateMessage},{'channel':_0x2910('0xc'),'model':_0x2910('0xd'),'event':_0x2910('0xa'),'condition':_0x2910('0x8'),'callback':afterCreate},{'channel':_0x2910('0xc'),'model':_0x2910('0xd'),'event':'afterUpdate','condition':_0x2910('0x9'),'callback':afterUpdate},{'channel':_0x2910('0xc'),'model':_0x2910('0xe'),'event':_0x2910('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x2910('0xf'),'event':'afterCreate','condition':_0x2910('0x8'),'callback':afterCreate},{'channel':_0x2910('0x10'),'model':_0x2910('0xf'),'event':_0x2910('0x11'),'condition':_0x2910('0x9'),'callback':afterUpdate},{'channel':_0x2910('0x10'),'model':_0x2910('0x12'),'event':_0x2910('0xa'),'condition':_0x2910('0xb'),'callback':afterCreateMessage},{'channel':_0x2910('0x13'),'model':_0x2910('0x14'),'event':_0x2910('0xa'),'condition':_0x2910('0x8'),'callback':afterCreate},{'channel':_0x2910('0x13'),'model':'FaxInteraction','event':_0x2910('0x11'),'condition':_0x2910('0x9'),'callback':afterUpdate},{'channel':_0x2910('0x13'),'model':_0x2910('0x15'),'event':_0x2910('0xa'),'condition':_0x2910('0xb'),'callback':afterCreateMessage},{'channel':_0x2910('0x16'),'model':_0x2910('0x17'),'event':_0x2910('0xa'),'condition':_0x2910('0x8'),'callback':afterCreate},{'channel':_0x2910('0x16'),'model':_0x2910('0x17'),'event':_0x2910('0x11'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x2910('0x16'),'model':_0x2910('0x17'),'event':_0x2910('0x18'),'condition':_0x2910('0x18'),'callback':afterUpdate},{'channel':'Mail','model':'MailMessage','event':_0x2910('0xa'),'condition':_0x2910('0xb'),'callback':afterCreateMessage},{'channel':_0x2910('0x19'),'model':_0x2910('0x1a'),'event':'afterCreate','condition':_0x2910('0x8'),'callback':afterCreate},{'channel':_0x2910('0x19'),'model':_0x2910('0x1a'),'event':'afterUpdate','condition':_0x2910('0x9'),'callback':afterUpdate},{'channel':_0x2910('0x19'),'model':_0x2910('0x1b'),'event':_0x2910('0xa'),'condition':_0x2910('0xb'),'callback':afterCreateMessage}];function request(_0x5d6504){return client['request'](_0x2910('0x1c'),_0x5d6504)[_0x2910('0x1d')](function(_0x5c743b){logger[_0x2910('0x1e')](_0x2910('0x1f'),_0x2910('0x1c'),_0x5c743b);if(_0x5c743b[_0x2910('0x20')]){if(_0x5c743b[_0x2910('0x20')][_0x2910('0x21')]===0x1f4){logger[_0x2910('0x20')](_0x2910('0x1f'),_0x2910('0x1c'),_0x5c743b[_0x2910('0x20')]);}}})[_0x2910('0x22')](function(_0x567dcf){logger[_0x2910('0x20')](_0x2910('0x1f'),_0x2910('0x1c'),_0x567dcf);});}function afterCreateMessage(_0x1515fe,_0x3864eb){return function(_0x5af61a,_0x4ae661){_0x5af61a=_0x5af61a['get']({'plain':!![]});_0x5af61a['channel']=_0x1515fe;_0x5af61a['motionChannel']=_0x1515fe;_0x5af61a[_0x2910('0x23')]=_0x5af61a['direction'];var _0x5a40d4=_0x2910('0x24')+_0x5af61a[_0x2910('0x25')];return db['sequelize']['query'](_0x5a40d4,{'type':db[_0x2910('0x26')][_0x2910('0x27')][_0x2910('0x28')],'raw':!![]})[_0x2910('0x1d')](function(_0x2f8971){return _0x2f8971;})[_0x2910('0x1d')](function(_0x214ad1){if(_0x214ad1){_0x5af61a['contact']=_0x214ad1[0x0];}if(_0x5af61a[_0x2910('0x29')]){return db[_0x2910('0x2a')]['find']({'where':{'id':_0x5af61a[_0x2910('0x29')]},'attributes':['id',_0x2910('0x2b'),_0x2910('0x2c'),'email',_0x2910('0x2d')],'raw':!![]})[_0x2910('0x1d')](function(_0x57ef5d){_0x5af61a[_0x2910('0x2e')]=util[_0x2910('0x2f')](_0x2910('0x30'),_0x57ef5d[_0x2910('0x2b')]);_0x5af61a[_0x2910('0x31')]=_0x1515fe;_0x5af61a[_0x2910('0x32')]=_0x57ef5d;return request({'event':_0x2910('0x33'),'message':_0x5af61a});})[_0x2910('0x22')](function(_0x2f6a6f){console['error'](_0x2f6a6f);});}else{return request({'event':'outgoingmessage','message':_0x5af61a});}});};}function afterCreate(_0xee24a,_0x3c907d){return function(_0x1f16dd,_0x51621d){_0x1f16dd=_0x1f16dd['get']({'plain':!![]});_0x1f16dd[_0x2910('0x31')]=_0xee24a;_0x1f16dd['motionChannel']=_0xee24a;_0x1f16dd['event']='opened';var _0x3e50f4=_0x2910('0x24')+_0x1f16dd[_0x2910('0x25')];return db[_0x2910('0x34')][_0x2910('0x35')](_0x3e50f4,{'type':db[_0x2910('0x26')][_0x2910('0x27')]['SELECT'],'raw':!![]})['then'](function(_0x191ed5){return _0x191ed5;})[_0x2910('0x1d')](function(_0x283aa2){if(_0x283aa2){_0x1f16dd[_0x2910('0x36')]=_0x283aa2[0x0];}return request({'event':_0x3c907d,'message':_0x1f16dd});});};}function afterUpdate(_0x5bb2f0,_0x1080fd){return function(_0x5bdce1,_0x3e86b5){if(_0x5bdce1[_0x2910('0x37')](_0x2910('0x38'))&&_0x5bdce1[_0x2910('0x38')]){_0x5bdce1=_0x5bdce1['get']({'plain':!![]});_0x5bdce1[_0x2910('0x31')]=_0x5bb2f0;_0x5bdce1[_0x2910('0x39')]=_0x5bb2f0;_0x5bdce1[_0x2910('0x23')]=_0x2910('0x38');var _0x51390a=_0x2910('0x24')+_0x5bdce1['ContactId'];return db[_0x2910('0x34')][_0x2910('0x35')](_0x51390a,{'type':db[_0x2910('0x26')][_0x2910('0x27')]['SELECT'],'raw':!![]})['then'](function(_0xbf8f19){return _0xbf8f19;})['then'](function(_0x28db6e){if(_0x28db6e){_0x5bdce1[_0x2910('0x36')]=_0x28db6e[0x0];}if(_0x5bdce1['UserId']){return db[_0x2910('0x2a')][_0x2910('0x3a')]({'where':{'id':_0x5bdce1[_0x2910('0x29')]},'attributes':['id','name',_0x2910('0x2c'),'email',_0x2910('0x2d')],'raw':!![]})[_0x2910('0x1d')](function(_0x45efb9){_0x5bdce1[_0x2910('0x2e')]=util[_0x2910('0x2f')](_0x2910('0x30'),_0x45efb9[_0x2910('0x2b')]);_0x5bdce1[_0x2910('0x32')]=_0x45efb9;return request({'event':_0x1080fd,'message':_0x5bdce1});})[_0x2910('0x22')](function(_0x28e1e2){console[_0x2910('0x20')](_0x28e1e2);});}else{return request({'event':_0x1080fd,'message':_0x5bdce1});}});}else if(_0x5bdce1[_0x2910('0x37')](_0x2910('0x18'))){_0x5bdce1=_0x5bdce1[_0x2910('0x3b')]({'plain':!![]});_0x5bdce1[_0x2910('0x31')]=_0x5bb2f0;_0x5bdce1[_0x2910('0x23')]=_0x2910('0x18');var _0x51390a=_0x2910('0x24')+_0x5bdce1[_0x2910('0x25')];return db[_0x2910('0x34')]['query'](_0x51390a,{'type':db['Sequelize'][_0x2910('0x27')][_0x2910('0x28')],'raw':!![]})[_0x2910('0x1d')](function(_0x5ddf7a){return _0x5ddf7a;})['then'](function(_0x4536f8){if(_0x4536f8){_0x5bdce1[_0x2910('0x36')]=_0x4536f8[0x0];}if(_0x5bdce1[_0x2910('0x29')]){return db[_0x2910('0x2a')][_0x2910('0x3a')]({'where':{'id':_0x5bdce1[_0x2910('0x29')]},'attributes':['id','name',_0x2910('0x2c'),_0x2910('0x3c'),'internal'],'raw':!![]})[_0x2910('0x1d')](function(_0x5169d8){_0x5bdce1[_0x2910('0x2e')]=util[_0x2910('0x2f')]('SIP/%s',_0x5169d8[_0x2910('0x2b')]);_0x5bdce1[_0x2910('0x32')]=_0x5169d8;return request({'event':_0x1080fd,'message':_0x5bdce1});})[_0x2910('0x22')](function(_0x43e56c){console['error'](_0x43e56c);});}else{return request({'event':_0x1080fd,'message':_0x5bdce1});}});}};}exports[_0x2910('0x3d')]=function(){for(var _0x143a4b=0x0;_0x143a4b=_0x34d783[_0x1df7('0x16')]){throw Error(_0x1df7('0x17'));}_0x2e785d(_0x4a60c3);})[_0x1df7('0x18')](function(_0x41e5b8){_0x10fca9(_0x41e5b8);});});}; \ No newline at end of file +var _0x95c7=['getChannels','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','count','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','fax','sms','openchannel'];(function(_0x126cce,_0x526dca){var _0x383de4=function(_0x10757f){while(--_0x10757f){_0x126cce['push'](_0x126cce['shift']());}};_0x383de4(++_0x526dca);}(_0x95c7,0x69));var _0x795c=function(_0x22e118,_0xbe03e0){_0x22e118=_0x22e118-0x0;var _0x5c1898=_0x95c7[_0x22e118];return _0x5c1898;};'use strict';var _=require(_0x795c('0x0'));var BPromise=require(_0x795c('0x1'));var db=require(_0x795c('0x2'))['db'];var util=require(_0x795c('0x3'));var channels=[_0x795c('0x4'),_0x795c('0x5'),_0x795c('0x6'),_0x795c('0x7'),_0x795c('0x8'),'whatsapp',_0x795c('0x9')];exports[_0x795c('0xa')]=function(){return channels;};exports['isValidChannel']=function(_0x46d3b4){_0x46d3b4=_0x46d3b4[_0x795c('0xb')]();return _[_0x795c('0xc')](channels,_0x46d3b4);};exports[_0x795c('0xd')]=function(_0x79935f,_0x43cc8f,_0x1d28e3,_0x27a74d){var _0x462ff8={'loginAttempts':_0x43cc8f,'blocked':_0x1d28e3};if(!_[_0x795c('0xe')](_0x27a74d)){_0x462ff8[_0x795c('0xf')]=_0x27a74d;}return _0x79935f[_0x795c('0x10')](_0x462ff8);};exports[_0x795c('0x11')]=function(_0x19fa52){return new BPromise(function(_0x322dd4,_0x14c2ef){var _0x87c930=0x0;if(_0x19fa52[_0x795c('0x12')]!==_0x795c('0x13')){_0x322dd4(_0x19fa52);}db['User'][_0x795c('0x14')]({'where':{'role':_0x795c('0x13'),'online':!![],'id':{'$ne':_0x19fa52['id']}}})['then'](function(_0x3caa2e){_0x87c930=_0x3caa2e;return util['getLicense']();})['then'](function(_0x37720f){if(_0x37720f&&_0x37720f[_0x795c('0x15')]&&_0x87c930>=_0x37720f[_0x795c('0x15')]){throw Error(_0x795c('0x16'));}_0x322dd4(_0x19fa52);})['catch'](function(_0x4333ca){_0x14c2ef(_0x4333ca);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index da2958c..9d14791 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x234b=['exports','status','render'];(function(_0x9070ff,_0xd95335){var _0x4195af=function(_0x246ce9){while(--_0x246ce9){_0x9070ff['push'](_0x9070ff['shift']());}};_0x4195af(++_0xd95335);}(_0x234b,0x8a));var _0xb234=function(_0x64fa3b,_0x332bc3){_0x64fa3b=_0x64fa3b-0x0;var _0x61d1b6=_0x234b[_0x64fa3b];return _0x61d1b6;};'use strict';module[_0xb234('0x0')][0x194]=function pageNotFound(_0x34f78b,_0x196d5e){var _0x34e8b0='404';var _0x5b154b=0x194;var _0x5a6ad1={'status':_0x5b154b};_0x196d5e[_0xb234('0x1')](_0x5a6ad1['status']);_0x196d5e[_0xb234('0x2')](_0x34e8b0,{},function(_0x214a92,_0x3eb8af){if(_0x214a92){return _0x196d5e[_0xb234('0x1')](_0x5a6ad1['status'])['json'](_0x5a6ad1);}_0x196d5e['send'](_0x3eb8af);});}; \ No newline at end of file +var _0xc6bf=['status','render','json','send','exports','404'];(function(_0x5b8b9e,_0x1d8909){var _0x7f00e1=function(_0xbeeed7){while(--_0xbeeed7){_0x5b8b9e['push'](_0x5b8b9e['shift']());}};_0x7f00e1(++_0x1d8909);}(_0xc6bf,0x118));var _0xfc6b=function(_0x3816c2,_0xb221e1){_0x3816c2=_0x3816c2-0x0;var _0x144669=_0xc6bf[_0x3816c2];return _0x144669;};'use strict';module[_0xfc6b('0x0')][0x194]=function pageNotFound(_0x684adb,_0x72a0b9){var _0x5cc6cb=_0xfc6b('0x1');var _0x1577a2=0x194;var _0x95209f={'status':_0x1577a2};_0x72a0b9[_0xfc6b('0x2')](_0x95209f[_0xfc6b('0x2')]);_0x72a0b9[_0xfc6b('0x3')](_0x5cc6cb,{},function(_0x39ea5b,_0x12318f){if(_0x39ea5b){return _0x72a0b9['status'](_0x95209f[_0xfc6b('0x2')])[_0xfc6b('0x4')](_0x95209f);}_0x72a0b9[_0xfc6b('0x5')](_0x12318f);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 8802729..1bd1ae8 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3a7=['UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','cascade','User','UserId','hasMany','VoiceQueuesRt','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','chat_group_has_users','Contacts','cm_user_has_contacts','CmList','Lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefix','VoicePrefixes','ChatQueues','FaxQueue','SmsQueue','SmsQueues','cm_user_has_lists','user_has_voice_prefixes','ChatWebsite','user_has_chat_websites','FaxAccount','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','VoiceContext','Applications','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessionReport','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','Answers','ListId','Template','TemplateId','Pause','team_has_mail_queues','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','ThroughTags','Users','Attachments','ChatWebsiteId','ChatOfflineMessageId','MailApplication','restrict','TagId','MailQueueReport','List','FaxAccountId','Interactions','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','Interaction','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','Tags','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','Agent','Queue','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','team_has_chat_queues','ChatGroupId','Website','CompanyId','Company','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','Condition','AutomationId','Intervals','Extensions','MailApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','moh_has_sounds','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','DescriptionId','FieldId','Subject','Field','SugarcrmAccount','SugarcrmField','Descriptions','VariableId','DeskConfiguration','int_desk_configuration_has_tags','Description','ZohoAccount','ZohoField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerConfiguration','FreshsalesAccount','ChatQueueReport','ToId','SessionId','ProjectId','FaxQueues','OpenchannelQueues','team_has_whatsapp_queues','WhatsappQueues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xcall','127.0.0.1','mysql','utf8mb4','name','sequelizeHistory','utf8','utf8_general_ci','username','password','options','database','import','../api/user/user.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/voiceMail/voiceMail.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../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/condition/condition.model','../api/interval/interval.model','../api/pause/pause.model','Cdr','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','ServicenowField','Dynamics365Account','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','JscriptyProject','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/voicePrefix/voicePrefix.model'];(function(_0x10f511,_0x3e68e5){var _0x2d749b=function(_0x24a914){while(--_0x24a914){_0x10f511['push'](_0x10f511['shift']());}};_0x2d749b(++_0x3e68e5);}(_0xd3a7,0x107));var _0x7d3a=function(_0x4d483e,_0x39a84c){_0x4d483e=_0x4d483e-0x0;var _0x35a5ab=_0xd3a7[_0x4d483e];return _0x35a5ab;};'use strict';var config=require(_0x7d3a('0x0'));var Sequelize=require(_0x7d3a('0x1'));var _=require(_0x7d3a('0x2'));var jstz=require(_0x7d3a('0x3'));var timezone=jstz[_0x7d3a('0x4')]();config['sequelize']=_[_0x7d3a('0x5')](config[_0x7d3a('0x1')],{'database':'motion2','username':_0x7d3a('0x6'),'password':'xC@LL1234','options':{'host':_0x7d3a('0x7'),'port':0xcea,'dialect':_0x7d3a('0x8'),'dialectOptions':{'charset':_0x7d3a('0x9')},'logging':![],'timezone':timezone[_0x7d3a('0xa')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x7d3a('0xb')]=_[_0x7d3a('0x5')](config[_0x7d3a('0xb')],{'database':'motion2','username':_0x7d3a('0x6'),'password':'xC@LL1234','options':{'host':_0x7d3a('0x7'),'port':0xcea,'dialect':_0x7d3a('0x8'),'dialectOptions':{'charset':_0x7d3a('0x9')},'logging':![],'timezone':timezone[_0x7d3a('0xa')](),'define':{'charset':_0x7d3a('0xc'),'collate':_0x7d3a('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x7d3a('0x1')][_0x7d3a('0xe')],config[_0x7d3a('0x1')][_0x7d3a('0xf')],config[_0x7d3a('0x1')][_0x7d3a('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x7d3a('0x11')],config['sequelizeHistory'][_0x7d3a('0xe')],config[_0x7d3a('0xb')][_0x7d3a('0xf')],config['sequelizeHistory']['options'])};db['User']=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0x13'));db['VoiceChanSpy']=db['sequelize'][_0x7d3a('0x12')]('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0x14'));db[_0x7d3a('0x15')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x16'));db[_0x7d3a('0x17')]=db[_0x7d3a('0x1')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x7d3a('0x18')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x19'));db[_0x7d3a('0x1a')]=db[_0x7d3a('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x7d3a('0x1b')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x1c'));db['VoiceMailMessage']=db['sequelize'][_0x7d3a('0x12')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x7d3a('0x1d')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x1e'));db[_0x7d3a('0x1f')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x20'));db['VoiceAgentReport']=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x21'));db['VoiceQueueReport']=db['sequelize']['import'](_0x7d3a('0x22'));db['MemberReport']=db['sequelize']['import'](_0x7d3a('0x23'));db[_0x7d3a('0x24')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/trunk/trunk.model');db[_0x7d3a('0x25')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x26'));db[_0x7d3a('0x27')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x28'));db[_0x7d3a('0x29')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x2a'));db[_0x7d3a('0x2b')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x2c'));db[_0x7d3a('0x2d')]=db[_0x7d3a('0x1')]['import']('../api/userMailQueue/userMailQueue.model');db[_0x7d3a('0x2e')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x2f'));db[_0x7d3a('0x30')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x31'));db[_0x7d3a('0x32')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x33'));db[_0x7d3a('0x34')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x35'));db[_0x7d3a('0x36')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x37'));db[_0x7d3a('0x38')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/mailServerOut/mailServerOut.model');db[_0x7d3a('0x39')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x3a'));db[_0x7d3a('0x3b')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x3c'));db['MailSubstatus']=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x3d'));db['MailInteraction']=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x3e'));db[_0x7d3a('0x3f')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x40'));db['MailApplication']=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x41'));db['MailQueueReport']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x42'));db[_0x7d3a('0x43')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x44'));db[_0x7d3a('0x45')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x46'));db['FaxAccount']=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x47'));db[_0x7d3a('0x48')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x49'));db[_0x7d3a('0x4a')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x4b'));db['FaxMessage']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x4c'));db['FaxQueue']=db['sequelize'][_0x7d3a('0x12')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x4d'));db[_0x7d3a('0x4e')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/smsAccount/smsAccount.model');db[_0x7d3a('0x4f')]=db['sequelize']['import'](_0x7d3a('0x50'));db[_0x7d3a('0x51')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/smsInteraction/smsInteraction.model');db[_0x7d3a('0x52')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x53'));db['SmsQueue']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x54'));db[_0x7d3a('0x55')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x56'));db[_0x7d3a('0x57')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0x58'));db[_0x7d3a('0x59')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x5a'));db[_0x7d3a('0x5b')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x5c'));db['ChatWebsite']=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x5d'));db[_0x7d3a('0x5e')]=db['sequelize']['import'](_0x7d3a('0x5f'));db[_0x7d3a('0x60')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x61'));db[_0x7d3a('0x62')]=db['sequelize']['import'](_0x7d3a('0x63'));db[_0x7d3a('0x64')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/chatMessage/chatMessage.model');db[_0x7d3a('0x65')]=db['sequelize'][_0x7d3a('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x7d3a('0x66')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x67'));db['ChatGroup']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x68'));db[_0x7d3a('0x69')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x6a'));db[_0x7d3a('0x6b')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x6c'));db[_0x7d3a('0x6d')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/cmContact/cmContact.model');db[_0x7d3a('0x6e')]=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0x6f'));db[_0x7d3a('0x70')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x71'));db[_0x7d3a('0x72')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x7d3a('0x73')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x74'));db['ReportAgentPreview']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x75'));db[_0x7d3a('0x76')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x77'));db[_0x7d3a('0x78')]=db['sequelize']['import'](_0x7d3a('0x79'));db[_0x7d3a('0x7a')]=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0x7b'));db[_0x7d3a('0x7c')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x7d'));db[_0x7d3a('0x7e')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/disposition/disposition.model');db['Condition']=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x7f'));db['Interval']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x80'));db['Pause']=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x81'));db[_0x7d3a('0x82')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/cdr/cdr.model');db[_0x7d3a('0x83')]=db[_0x7d3a('0x1')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x7d3a('0x84')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x85'));db[_0x7d3a('0x86')]=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0x87'));db['Tag']=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0x88'));db['Template']=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0x89'));db[_0x7d3a('0x8a')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x8b'));db[_0x7d3a('0x8c')]=db['sequelize'][_0x7d3a('0x12')]('../api/variable/variable.model');db[_0x7d3a('0x8d')]=db['sequelize']['import'](_0x7d3a('0x8e'));db[_0x7d3a('0x8f')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x90'));db[_0x7d3a('0x91')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x92'));db[_0x7d3a('0x93')]=db['sequelize']['import'](_0x7d3a('0x94'));db[_0x7d3a('0x95')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x96'));db['AnalyticMetric']=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0x97'));db[_0x7d3a('0x98')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x7d3a('0x99')]=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0x9a'));db[_0x7d3a('0x9b')]=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0x9c'));db[_0x7d3a('0x9d')]=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0x9e'));db['SalesforceField']=db[_0x7d3a('0x1')]['import'](_0x7d3a('0x9f'));db['SugarcrmAccount']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xa0'));db[_0x7d3a('0xa1')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x7d3a('0xa2')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xa3'));db['DeskConfiguration']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xa4'));db[_0x7d3a('0xa5')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xa6'));db['ZohoAccount']=db[_0x7d3a('0x1')]['import'](_0x7d3a('0xa7'));db[_0x7d3a('0xa8')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xa9'));db['ZohoField']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xaa'));db[_0x7d3a('0xab')]=db['sequelize'][_0x7d3a('0x12')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x7d3a('0xac')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0xad'));db[_0x7d3a('0xae')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xaf'));db[_0x7d3a('0xb0')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xb1'));db[_0x7d3a('0xb2')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x7d3a('0xb3')]=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0xb4'));db['VtigerAccount']=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0xb5'));db['VtigerConfiguration']=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x7d3a('0xb6')]=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0xb7'));db[_0x7d3a('0xb8')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x7d3a('0xb9')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x7d3a('0xba')]=db[_0x7d3a('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db[_0x7d3a('0xbb')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x7d3a('0xbc')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x7d3a('0xbd')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xbe'));db['FreshsalesAccount']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xbf'));db[_0x7d3a('0xc0')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x7d3a('0xc1')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xc2'));db['Integration']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x8e'));db[_0x7d3a('0xc3')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0xc4'));db['ChatQueueReport']=db[_0x7d3a('0x1')]['import'](_0x7d3a('0xc5'));db[_0x7d3a('0xc6')]=db[_0x7d3a('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0x7d3a('0xc7')]=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0xc8'));db[_0x7d3a('0xc9')]=db['sequelize'][_0x7d3a('0x12')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db['sequelize']['import'](_0x7d3a('0xca'));db[_0x7d3a('0xcb')]=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0xcc'));db[_0x7d3a('0xcd')]=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0xce'));db['SquareDetailsReport']=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/squareReportDetail/squareReportDetail.model');db[_0x7d3a('0xcf')]=db['sequelize'][_0x7d3a('0x12')]('../api/jscriptyProject/jscriptyProject.model');db[_0x7d3a('0xd0')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0xd1'));db['SquareOdbc']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xd2'));db[_0x7d3a('0xd3')]=db['sequelize']['import'](_0x7d3a('0xd4'));db['SquareRecording']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xd5'));db[_0x7d3a('0xd6')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xd7'));db[_0x7d3a('0xd8')]=db['sequelize']['import'](_0x7d3a('0xd9'));db['License']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xda'));db[_0x7d3a('0xdb')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xdc'));db[_0x7d3a('0xdd')]=db['sequelize']['import'](_0x7d3a('0xde'));db[_0x7d3a('0xdf')]=db['sequelize'][_0x7d3a('0x12')]('../api/attachment/attachment.model');db[_0x7d3a('0xe0')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0xe1'));db[_0x7d3a('0xe2')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0xe3'));db[_0x7d3a('0xe4')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xe5'));db['FaxTransferReport']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xe6'));db[_0x7d3a('0xe7')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xe8'));db[_0x7d3a('0xe9')]=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0xea'));db['CmList']=db['sequelize'][_0x7d3a('0x12')]('../api/cmList/cmList.model');db['VoicePrefix']=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0xeb'));db[_0x7d3a('0xec')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0xed'));db[_0x7d3a('0xee')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0xef'));db['UserProfileResource']=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xf0'));db[_0x7d3a('0xf1')]=db['sequelize'][_0x7d3a('0x12')](_0x7d3a('0xf2'));db[_0x7d3a('0xf3')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xf4'));db['WhatsappApplication']=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/whatsappApplication/whatsappApplication.model');db[_0x7d3a('0xf5')]=db['sequelize'][_0x7d3a('0x12')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x7d3a('0xf6')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xf7'));db[_0x7d3a('0xf8')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xf9'));db[_0x7d3a('0xfa')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xfb'));db[_0x7d3a('0xfc')]=db[_0x7d3a('0x1')]['import'](_0x7d3a('0xfd'));db[_0x7d3a('0xfe')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0xff'));db[_0x7d3a('0x100')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x7d3a('0x101')]=db[_0x7d3a('0x1')][_0x7d3a('0x12')](_0x7d3a('0x102'));db[_0x7d3a('0x103')]=db['sequelize']['import'](_0x7d3a('0x104'));db['User'][_0x7d3a('0x105')](db[_0x7d3a('0x106')],{'as':_0x7d3a('0x106'),'onDelete':_0x7d3a('0x107'),'foreignKey':'UserId'});db[_0x7d3a('0x108')]['hasMany'](db[_0x7d3a('0x1a')],{'as':'Recordings','foreignKey':_0x7d3a('0x109')});db[_0x7d3a('0x108')][_0x7d3a('0x10a')](db[_0x7d3a('0x27')],{'as':_0x7d3a('0x10b'),'foreignKey':_0x7d3a('0x109')});db[_0x7d3a('0x108')][_0x7d3a('0x10a')](db[_0x7d3a('0x15')],{'as':'Extensions','onDelete':_0x7d3a('0x107'),'hooks':!![]});db[_0x7d3a('0x108')][_0x7d3a('0x10a')](db[_0x7d3a('0x72')],{'as':_0x7d3a('0x10c'),'foreignKey':'UserId'});db[_0x7d3a('0x108')][_0x7d3a('0x10a')](db[_0x7d3a('0x73')],{'as':_0x7d3a('0x10d'),'foreignKey':_0x7d3a('0x109')});db[_0x7d3a('0x108')][_0x7d3a('0x10a')](db[_0x7d3a('0x10e')],{'as':_0x7d3a('0x10e'),'foreignKey':_0x7d3a('0x109')});db[_0x7d3a('0x108')][_0x7d3a('0x10a')](db[_0x7d3a('0x10f')],{'as':_0x7d3a('0x110'),'foreignKey':_0x7d3a('0x109')});db[_0x7d3a('0x108')][_0x7d3a('0x10a')](db[_0x7d3a('0x62')],{'as':_0x7d3a('0x111'),'foreignKey':_0x7d3a('0x109')});db[_0x7d3a('0x108')]['hasMany'](db['SmsInteraction'],{'as':_0x7d3a('0x112'),'foreignKey':_0x7d3a('0x109')});db[_0x7d3a('0x108')][_0x7d3a('0x10a')](db[_0x7d3a('0x4a')],{'as':_0x7d3a('0x113'),'foreignKey':_0x7d3a('0x109')});db[_0x7d3a('0x108')][_0x7d3a('0x10a')](db[_0x7d3a('0x114')],{'as':'MailInteractions','foreignKey':_0x7d3a('0x109')});db[_0x7d3a('0x108')][_0x7d3a('0x10a')](db[_0x7d3a('0xf5')],{'as':_0x7d3a('0x115'),'foreignKey':_0x7d3a('0x109')});db[_0x7d3a('0x108')][_0x7d3a('0x10a')](db[_0x7d3a('0xf1')],{'as':_0x7d3a('0x116'),'foreignKey':_0x7d3a('0x117')});db[_0x7d3a('0x108')][_0x7d3a('0x118')](db[_0x7d3a('0xec')],{'as':_0x7d3a('0xec'),'foreignKey':_0x7d3a('0x119')});db[_0x7d3a('0x108')][_0x7d3a('0x11a')](db[_0x7d3a('0x11b')],{'as':'Groups','through':_0x7d3a('0x11c')});db[_0x7d3a('0x108')][_0x7d3a('0x11a')](db['CmContact'],{'as':_0x7d3a('0x11d'),'through':_0x7d3a('0x11e')});db['User'][_0x7d3a('0x11a')](db[_0x7d3a('0x11f')],{'as':_0x7d3a('0x120'),'through':'cm_user_has_lists'});db[_0x7d3a('0x108')]['belongsToMany'](db[_0x7d3a('0xd8')],{'through':_0x7d3a('0x121')});db[_0x7d3a('0x108')][_0x7d3a('0x11a')](db[_0x7d3a('0x114')],{'as':_0x7d3a('0x122'),'through':_0x7d3a('0x123')});db['User'][_0x7d3a('0x11a')](db['ChatInteraction'],{'as':_0x7d3a('0x111'),'through':'user_has_chat_interactions'});db[_0x7d3a('0x108')]['belongsToMany'](db[_0x7d3a('0x4a')],{'as':_0x7d3a('0x113'),'through':_0x7d3a('0x124')});db[_0x7d3a('0x108')]['belongsToMany'](db[_0x7d3a('0x51')],{'as':_0x7d3a('0x112'),'through':_0x7d3a('0x125')});db[_0x7d3a('0x108')]['belongsToMany'](db[_0x7d3a('0x10f')],{'as':_0x7d3a('0x110'),'through':_0x7d3a('0x126')});db[_0x7d3a('0x108')][_0x7d3a('0x11a')](db[_0x7d3a('0xf5')],{'as':_0x7d3a('0x115'),'through':_0x7d3a('0x127')});db[_0x7d3a('0x108')]['belongsToMany'](db[_0x7d3a('0x18')],{'as':_0x7d3a('0x128'),'through':_0x7d3a('0x29'),'required':![]});db[_0x7d3a('0x108')][_0x7d3a('0x11a')](db[_0x7d3a('0x129')],{'as':_0x7d3a('0x12a'),'through':_0x7d3a('0x103'),'required':![]});db['User'][_0x7d3a('0x11a')](db[_0x7d3a('0x3b')],{'as':'MailQueues','through':_0x7d3a('0x2d'),'required':![]});db[_0x7d3a('0x108')][_0x7d3a('0x11a')](db['ChatQueue'],{'as':_0x7d3a('0x12b'),'through':_0x7d3a('0x2b'),'required':![],'hooks':!![]});db[_0x7d3a('0x108')][_0x7d3a('0x11a')](db[_0x7d3a('0x12c')],{'as':'FaxQueues','through':_0x7d3a('0x2e'),'required':![]});db[_0x7d3a('0x108')][_0x7d3a('0x11a')](db[_0x7d3a('0x12d')],{'as':_0x7d3a('0x12e'),'through':_0x7d3a('0x30'),'required':![]});db[_0x7d3a('0x108')][_0x7d3a('0x11a')](db[_0x7d3a('0x5b')],{'as':'OpenchannelQueues','through':_0x7d3a('0x32'),'required':![]});db[_0x7d3a('0x108')][_0x7d3a('0x11a')](db['WhatsappQueue'],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0x7d3a('0x108')]['belongsToMany'](db[_0x7d3a('0x11f')],{'through':_0x7d3a('0x12f')});db['User'][_0x7d3a('0x11a')](db['VoicePrefix'],{'as':_0x7d3a('0x12a'),'through':_0x7d3a('0x130'),'required':![]});db[_0x7d3a('0x108')][_0x7d3a('0x11a')](db[_0x7d3a('0x131')],{'as':'ChatWebsites','through':_0x7d3a('0x132')});db['User']['belongsToMany'](db[_0x7d3a('0x133')],{'as':'FaxAccounts','through':_0x7d3a('0x134')});db[_0x7d3a('0x108')][_0x7d3a('0x11a')](db[_0x7d3a('0x39')],{'as':_0x7d3a('0x135'),'through':_0x7d3a('0x136')});db[_0x7d3a('0x108')]['belongsToMany'](db[_0x7d3a('0x55')],{'as':_0x7d3a('0x137'),'through':_0x7d3a('0x138')});db[_0x7d3a('0x108')][_0x7d3a('0x11a')](db['SmsAccount'],{'as':_0x7d3a('0x139'),'through':_0x7d3a('0x13a')});db[_0x7d3a('0x108')][_0x7d3a('0x11a')](db[_0x7d3a('0xf3')],{'as':_0x7d3a('0x13b'),'through':_0x7d3a('0x13c')});db[_0x7d3a('0x108')]['belongsToMany'](db[_0x7d3a('0xd3')],{'as':_0x7d3a('0x13d'),'through':_0x7d3a('0x13e')});db[_0x7d3a('0x13f')]['hasMany'](db['VoiceExtension'],{'as':_0x7d3a('0x140'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x141')});db[_0x7d3a('0x142')][_0x7d3a('0x10a')](db[_0x7d3a('0x15')],{'onDelete':_0x7d3a('0x107')});db['VoiceExtension']['hasMany'](db[_0x7d3a('0x15')],{'as':_0x7d3a('0x143'),'onDelete':_0x7d3a('0x107')});db[_0x7d3a('0x17')]['belongsToMany'](db[_0x7d3a('0x86')],{'as':'Sounds','through':'moh_has_sounds'});db['VoiceQueue'][_0x7d3a('0x10a')](db[_0x7d3a('0x27')],{'as':_0x7d3a('0x144'),'foreignKey':_0x7d3a('0x145')});db[_0x7d3a('0x18')][_0x7d3a('0x10a')](db[_0x7d3a('0x6e')],{'as':_0x7d3a('0x146'),'foreignKey':_0x7d3a('0x145')});db[_0x7d3a('0x18')]['hasMany'](db[_0x7d3a('0x72')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0x7d3a('0x18')][_0x7d3a('0x10a')](db[_0x7d3a('0x73')],{'as':_0x7d3a('0x147'),'foreignKey':_0x7d3a('0x145')});db[_0x7d3a('0x18')]['hasMany'](db[_0x7d3a('0x10e')],{'as':'ReportAgentPreview','foreignKey':_0x7d3a('0x145')});db[_0x7d3a('0x18')][_0x7d3a('0x10a')](db[_0x7d3a('0x70')],{'as':_0x7d3a('0x148'),'foreignKey':'VoiceQueueId'});db[_0x7d3a('0x18')][_0x7d3a('0x10a')](db[_0x7d3a('0x149')],{'as':'JscriptySessions','foreignKey':_0x7d3a('0x145')});db[_0x7d3a('0x18')]['belongsTo'](db[_0x7d3a('0x24')],{'as':_0x7d3a('0x24'),'foreignKey':_0x7d3a('0x14a')});db['VoiceQueue'][_0x7d3a('0x118')](db[_0x7d3a('0x24')],{'as':_0x7d3a('0x14b'),'foreignKey':_0x7d3a('0x14c')});db['VoiceQueue'][_0x7d3a('0x118')](db[_0x7d3a('0x14d')],{'as':_0x7d3a('0x14d'),'foreignKey':_0x7d3a('0x14e')});db[_0x7d3a('0x18')][_0x7d3a('0x118')](db['Pause'],{'as':_0x7d3a('0x14f'),'foreignKey':_0x7d3a('0x150')});db['VoiceQueue'][_0x7d3a('0x11a')](db[_0x7d3a('0x11f')],{'as':_0x7d3a('0x120'),'through':_0x7d3a('0x151')});db[_0x7d3a('0x18')]['belongsToMany'](db['User'],{'as':_0x7d3a('0x152'),'through':_0x7d3a('0x29')});db[_0x7d3a('0x18')][_0x7d3a('0x11a')](db[_0x7d3a('0xd8')],{'as':_0x7d3a('0x153'),'through':_0x7d3a('0x100')});db[_0x7d3a('0x18')][_0x7d3a('0x11a')](db[_0x7d3a('0x11f')],{'as':'BlackLists','through':_0x7d3a('0x154')});db[_0x7d3a('0x1a')]['belongsTo'](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x108'),'foreignKey':'UserId'});db[_0x7d3a('0x1b')][_0x7d3a('0x118')](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x108'),'foreignKey':_0x7d3a('0x109')});db['VoiceMail'][_0x7d3a('0x10a')](db[_0x7d3a('0x155')],{'as':_0x7d3a('0x156'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x157'),'sourceKey':_0x7d3a('0x158')});db[_0x7d3a('0x155')][_0x7d3a('0x118')](db[_0x7d3a('0x106')],{'foreignKey':'mailboxuser','targetKey':_0x7d3a('0x158')});db[_0x7d3a('0x1d')][_0x7d3a('0x10a')](db[_0x7d3a('0x159')],{'as':_0x7d3a('0x15a'),'foreignKey':_0x7d3a('0x15b'),'constraints':![]});db['VoiceCallReport'][_0x7d3a('0x10a')](db[_0x7d3a('0x15c')],{'as':_0x7d3a('0x15d'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport']['belongsTo'](db['User'],{'as':_0x7d3a('0x108'),'foreignKey':_0x7d3a('0x109')});db['VoiceCallReport'][_0x7d3a('0x118')](db[_0x7d3a('0x6d')],{'as':_0x7d3a('0x15e'),'foreignKey':_0x7d3a('0x15f')});db[_0x7d3a('0x36')][_0x7d3a('0x118')](db['MailAccount'],{'as':_0x7d3a('0x39'),'foreignKey':_0x7d3a('0x160')});db['MailServerOut'][_0x7d3a('0x118')](db[_0x7d3a('0x39')],{'as':'MailAccount','foreignKey':_0x7d3a('0x160')});db[_0x7d3a('0x39')]['hasOne'](db[_0x7d3a('0x36')],{'as':_0x7d3a('0x161'),'onDelete':_0x7d3a('0x107')});db[_0x7d3a('0x39')][_0x7d3a('0x105')](db[_0x7d3a('0x38')],{'as':_0x7d3a('0x162'),'onDelete':_0x7d3a('0x107')});db['MailAccount']['hasMany'](db[_0x7d3a('0x7e')],{'as':_0x7d3a('0x163'),'foreignKey':_0x7d3a('0x160'),'onDelete':'cascade'});db[_0x7d3a('0x39')]['hasMany'](db[_0x7d3a('0x7c')],{'as':_0x7d3a('0x164'),'foreignKey':'MailAccountId'});db[_0x7d3a('0x39')][_0x7d3a('0x10a')](db[_0x7d3a('0x3f')],{'as':_0x7d3a('0x156'),'foreignKey':_0x7d3a('0x160')});db['MailAccount'][_0x7d3a('0x10a')](db[_0x7d3a('0x114')],{'as':'Interactions'});db[_0x7d3a('0x39')]['hasMany'](db['MailApplication'],{'as':'Applications'});db['MailAccount']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x7d3a('0x165')});db[_0x7d3a('0x39')][_0x7d3a('0x118')](db[_0x7d3a('0x166')],{'as':'Template','foreignKey':_0x7d3a('0x167')});db[_0x7d3a('0x39')][_0x7d3a('0x118')](db[_0x7d3a('0x168')],{'as':_0x7d3a('0x14f'),'foreignKey':_0x7d3a('0x150')});db['MailAccount'][_0x7d3a('0x11a')](db['User'],{'as':'Agents','through':_0x7d3a('0x136')});db[_0x7d3a('0x3b')][_0x7d3a('0x11a')](db[_0x7d3a('0x108')],{'as':'Agents','through':'UserMailQueue'});db[_0x7d3a('0x3b')][_0x7d3a('0x11a')](db[_0x7d3a('0xd8')],{'through':_0x7d3a('0x169'),'as':_0x7d3a('0x153')});db[_0x7d3a('0x114')][_0x7d3a('0x10a')](db[_0x7d3a('0x3f')],{'as':_0x7d3a('0x156'),'onDelete':'cascade','foreignKey':_0x7d3a('0x16a')});db[_0x7d3a('0x114')]['belongsTo'](db[_0x7d3a('0x39')],{'as':_0x7d3a('0x16b'),'foreignKey':_0x7d3a('0x160')});db[_0x7d3a('0x114')][_0x7d3a('0x118')](db[_0x7d3a('0x6d')],{'as':'Contact','foreignKey':_0x7d3a('0x15f')});db[_0x7d3a('0x114')]['belongsTo'](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x16c'),'foreignKey':_0x7d3a('0x109')});db[_0x7d3a('0x114')][_0x7d3a('0x11a')](db[_0x7d3a('0x16d')],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0x7d3a('0x114')]['belongsToMany'](db['Tag'],{'through':_0x7d3a('0x16e'),'as':_0x7d3a('0x16f')});db[_0x7d3a('0x114')]['belongsToMany'](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x170'),'through':_0x7d3a('0x123'),'foreignKey':_0x7d3a('0x16a')});db[_0x7d3a('0x3f')][_0x7d3a('0x10a')](db[_0x7d3a('0xdf')],{'as':_0x7d3a('0x171'),'onDelete':_0x7d3a('0x107')});db[_0x7d3a('0x3f')][_0x7d3a('0x118')](db['User'],{'as':'User'});db[_0x7d3a('0x3f')][_0x7d3a('0x118')](db['CmContact'],{'onDelete':'cascade','as':_0x7d3a('0x15e')});db['MailMessage']['belongsTo'](db[_0x7d3a('0x114')],{'as':'Interaction','foreignKey':_0x7d3a('0x16a')});db['MailMessage'][_0x7d3a('0x118')](db['MailAccount'],{'as':_0x7d3a('0x16b'),'foreignKey':_0x7d3a('0x160')});db[_0x7d3a('0x3f')][_0x7d3a('0x118')](db['ChatWebsite'],{'as':_0x7d3a('0x131'),'foreignKey':_0x7d3a('0x172')});db[_0x7d3a('0x3f')][_0x7d3a('0x118')](db[_0x7d3a('0x65')],{'as':_0x7d3a('0x65'),'foreignKey':_0x7d3a('0x173')});db[_0x7d3a('0x174')][_0x7d3a('0x118')](db[_0x7d3a('0x108')],{'onDelete':'restrict'});db['MailApplication'][_0x7d3a('0x118')](db[_0x7d3a('0x3b')],{'onDelete':'restrict'});db[_0x7d3a('0x174')][_0x7d3a('0x118')](db[_0x7d3a('0x39')],{'onDelete':_0x7d3a('0x175')});db['MailApplication']['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0x7d3a('0x14e')});db[_0x7d3a('0x174')][_0x7d3a('0x118')](db[_0x7d3a('0x16d')],{'onDelete':_0x7d3a('0x175'),'foreignKey':_0x7d3a('0x176')});db[_0x7d3a('0x177')][_0x7d3a('0x118')](db[_0x7d3a('0x39')],{});db[_0x7d3a('0x177')][_0x7d3a('0x118')](db[_0x7d3a('0x11f')],{'as':_0x7d3a('0x178'),'foreignKey':_0x7d3a('0x165')});db[_0x7d3a('0x177')]['belongsTo'](db[_0x7d3a('0x6d')],{'as':_0x7d3a('0x15e'),'foreignKey':'ContactId'});db[_0x7d3a('0x177')][_0x7d3a('0x118')](db[_0x7d3a('0x114')],{});db['MailQueueReport']['belongsTo'](db[_0x7d3a('0x3f')],{});db['MailQueueReport'][_0x7d3a('0x118')](db['User'],{});db[_0x7d3a('0x177')]['belongsTo'](db[_0x7d3a('0x3b')],{});db[_0x7d3a('0x43')][_0x7d3a('0x10a')](db[_0x7d3a('0x45')],{'as':'Items','onDelete':'cascade'});db[_0x7d3a('0x133')]['hasMany'](db[_0x7d3a('0x7e')],{'as':'Dispositions','foreignKey':_0x7d3a('0x179'),'onDelete':_0x7d3a('0x107')});db[_0x7d3a('0x133')][_0x7d3a('0x10a')](db[_0x7d3a('0x7c')],{'as':_0x7d3a('0x164'),'foreignKey':'FaxAccountId'});db[_0x7d3a('0x133')]['hasMany'](db[_0x7d3a('0x4a')],{'as':_0x7d3a('0x17a')});db['FaxAccount']['hasMany'](db['FaxApplication'],{'as':_0x7d3a('0x143')});db[_0x7d3a('0x133')]['hasMany'](db['VoiceExtension'],{'as':_0x7d3a('0x17b'),'onDelete':_0x7d3a('0x107')});db[_0x7d3a('0x133')][_0x7d3a('0x10a')](db['FaxMessage'],{'as':'Messages'});db[_0x7d3a('0x133')]['belongsTo'](db[_0x7d3a('0x24')],{'as':'Trunk'});db[_0x7d3a('0x133')][_0x7d3a('0x118')](db['CmList'],{'as':_0x7d3a('0x178'),'foreignKey':_0x7d3a('0x165')});db['FaxAccount'][_0x7d3a('0x118')](db['Pause'],{'as':_0x7d3a('0x14f'),'foreignKey':_0x7d3a('0x150')});db[_0x7d3a('0x133')][_0x7d3a('0x11a')](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x152'),'through':'user_has_fax_accounts'});db[_0x7d3a('0x48')][_0x7d3a('0x118')](db[_0x7d3a('0x108')],{'onDelete':_0x7d3a('0x175')});db['FaxApplication']['belongsTo'](db['FaxQueue'],{'onDelete':_0x7d3a('0x175')});db['FaxApplication'][_0x7d3a('0x118')](db['FaxAccount'],{'onDelete':_0x7d3a('0x175')});db[_0x7d3a('0x48')][_0x7d3a('0x118')](db['Tag'],{'onDelete':_0x7d3a('0x175'),'foreignKey':_0x7d3a('0x176')});db[_0x7d3a('0x4a')]['hasMany'](db[_0x7d3a('0x17c')],{'as':_0x7d3a('0x156'),'onDelete':'cascade','foreignKey':_0x7d3a('0x17d')});db['FaxInteraction'][_0x7d3a('0x118')](db['FaxAccount'],{'as':'Account','foreignKey':_0x7d3a('0x179')});db[_0x7d3a('0x4a')][_0x7d3a('0x118')](db[_0x7d3a('0x6d')],{'as':_0x7d3a('0x15e'),'foreignKey':_0x7d3a('0x15f')});db[_0x7d3a('0x4a')][_0x7d3a('0x118')](db['User'],{'as':_0x7d3a('0x16c'),'foreignKey':_0x7d3a('0x109')});db['FaxInteraction'][_0x7d3a('0x11a')](db[_0x7d3a('0x16d')],{'through':_0x7d3a('0x17e'),'as':'Tags'});db[_0x7d3a('0x4a')][_0x7d3a('0x11a')](db[_0x7d3a('0x16d')],{'through':_0x7d3a('0x17e'),'as':_0x7d3a('0x16f')});db['FaxInteraction']['belongsToMany'](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x170'),'through':'user_has_fax_interactions','foreignKey':_0x7d3a('0x17d')});db['FaxMessage'][_0x7d3a('0x118')](db[_0x7d3a('0x108')],{'onDelete':_0x7d3a('0x107'),'as':_0x7d3a('0x108')});db['FaxMessage'][_0x7d3a('0x118')](db['FaxInteraction'],{'as':_0x7d3a('0x17f'),'foreignKey':_0x7d3a('0x17d')});db['FaxMessage'][_0x7d3a('0x118')](db[_0x7d3a('0x6d')],{'onDelete':'cascade','as':_0x7d3a('0x15e')});db[_0x7d3a('0x17c')][_0x7d3a('0x118')](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x7d3a('0x17c')][_0x7d3a('0x118')](db[_0x7d3a('0x133')],{'as':'Account','foreignKey':_0x7d3a('0x179')});db['FaxQueue'][_0x7d3a('0x11a')](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x152'),'through':_0x7d3a('0x2e')});db[_0x7d3a('0x12c')]['belongsToMany'](db[_0x7d3a('0xd8')],{'through':_0x7d3a('0x180'),'as':_0x7d3a('0x153')});db[_0x7d3a('0x181')]['belongsTo'](db[_0x7d3a('0x133')],{});db['FaxQueueReport']['belongsTo'](db['CmList'],{'as':_0x7d3a('0x178'),'foreignKey':_0x7d3a('0x165')});db['FaxQueueReport'][_0x7d3a('0x118')](db[_0x7d3a('0x6d')],{'as':'Contact','foreignKey':_0x7d3a('0x15f')});db[_0x7d3a('0x181')]['belongsTo'](db[_0x7d3a('0x4a')],{});db['FaxQueueReport'][_0x7d3a('0x118')](db[_0x7d3a('0x17c')],{});db['FaxQueueReport']['belongsTo'](db[_0x7d3a('0x108')],{});db['FaxQueueReport'][_0x7d3a('0x118')](db[_0x7d3a('0x12c')],{});db[_0x7d3a('0x4e')]['hasMany'](db[_0x7d3a('0x7e')],{'as':_0x7d3a('0x163'),'foreignKey':'SmsAccountId','onDelete':_0x7d3a('0x107')});db['SmsAccount'][_0x7d3a('0x10a')](db[_0x7d3a('0x7c')],{'as':_0x7d3a('0x164'),'foreignKey':_0x7d3a('0x182')});db['SmsAccount']['hasMany'](db[_0x7d3a('0x52')],{'as':_0x7d3a('0x156'),'foreignKey':_0x7d3a('0x182')});db[_0x7d3a('0x4e')][_0x7d3a('0x10a')](db['SmsInteraction'],{'as':_0x7d3a('0x17a')});db[_0x7d3a('0x4e')][_0x7d3a('0x10a')](db[_0x7d3a('0x4f')],{'as':'Applications'});db[_0x7d3a('0x4e')]['belongsTo'](db[_0x7d3a('0x11f')],{'as':_0x7d3a('0x178'),'foreignKey':_0x7d3a('0x165')});db[_0x7d3a('0x4e')]['belongsTo'](db['Pause'],{'as':_0x7d3a('0x14f'),'foreignKey':_0x7d3a('0x150')});db['SmsAccount'][_0x7d3a('0x11a')](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x152'),'through':_0x7d3a('0x13a')});db['SmsApplication']['belongsTo'](db['User'],{'onDelete':_0x7d3a('0x175')});db['SmsApplication'][_0x7d3a('0x118')](db[_0x7d3a('0x12d')],{'onDelete':'restrict'});db[_0x7d3a('0x4f')][_0x7d3a('0x118')](db[_0x7d3a('0x4e')],{'onDelete':'restrict'});db[_0x7d3a('0x4f')]['belongsTo'](db['Interval'],{'onDelete':_0x7d3a('0x175'),'foreignKey':_0x7d3a('0x14e')});db[_0x7d3a('0x4f')][_0x7d3a('0x118')](db[_0x7d3a('0x16d')],{'onDelete':_0x7d3a('0x175'),'foreignKey':_0x7d3a('0x176')});db[_0x7d3a('0x51')][_0x7d3a('0x10a')](db['SmsMessage'],{'as':_0x7d3a('0x156'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x183')});db[_0x7d3a('0x51')][_0x7d3a('0x118')](db[_0x7d3a('0x4e')],{'as':_0x7d3a('0x16b'),'foreignKey':_0x7d3a('0x182')});db[_0x7d3a('0x51')][_0x7d3a('0x118')](db[_0x7d3a('0x6d')],{'as':_0x7d3a('0x15e'),'foreignKey':_0x7d3a('0x15f')});db['SmsInteraction'][_0x7d3a('0x118')](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x16c'),'foreignKey':_0x7d3a('0x109')});db[_0x7d3a('0x51')][_0x7d3a('0x11a')](db[_0x7d3a('0x16d')],{'through':_0x7d3a('0x184'),'as':_0x7d3a('0x185')});db[_0x7d3a('0x51')][_0x7d3a('0x11a')](db[_0x7d3a('0x16d')],{'through':_0x7d3a('0x184'),'as':'ThroughTags'});db[_0x7d3a('0x51')]['belongsToMany'](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x170'),'through':_0x7d3a('0x125'),'foreignKey':_0x7d3a('0x183')});db[_0x7d3a('0x52')]['belongsTo'](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x108')});db[_0x7d3a('0x52')][_0x7d3a('0x118')](db[_0x7d3a('0x6d')],{'onDelete':_0x7d3a('0x107'),'as':_0x7d3a('0x15e')});db['SmsMessage']['belongsTo'](db['SmsInteraction'],{'onDelete':'cascade','as':_0x7d3a('0x17f'),'foreignKey':_0x7d3a('0x183')});db[_0x7d3a('0x52')][_0x7d3a('0x118')](db['SmsAccount'],{'as':'Account','foreignKey':_0x7d3a('0x182')});db[_0x7d3a('0x12d')][_0x7d3a('0x11a')](db[_0x7d3a('0x108')],{'as':'Agents','through':_0x7d3a('0x30'),'foreignKey':_0x7d3a('0x186')});db[_0x7d3a('0x12d')]['belongsToMany'](db[_0x7d3a('0xd8')],{'through':'team_has_sms_queues','as':'Teams'});db['OpenchannelAccount'][_0x7d3a('0x10a')](db[_0x7d3a('0x7e')],{'as':'Dispositions','foreignKey':_0x7d3a('0x187'),'onDelete':_0x7d3a('0x107')});db[_0x7d3a('0x55')][_0x7d3a('0x10a')](db[_0x7d3a('0x7c')],{'as':_0x7d3a('0x164'),'foreignKey':_0x7d3a('0x187')});db['OpenchannelAccount'][_0x7d3a('0x10a')](db[_0x7d3a('0x10f')],{'as':_0x7d3a('0x17a'),'foreignKey':'OpenchannelAccountId'});db[_0x7d3a('0x55')]['hasMany'](db['OpenchannelMessage'],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x7d3a('0x55')][_0x7d3a('0x10a')](db[_0x7d3a('0x57')],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['belongsTo'](db[_0x7d3a('0x11f')],{'as':_0x7d3a('0x178'),'foreignKey':_0x7d3a('0x165')});db['OpenchannelAccount'][_0x7d3a('0x118')](db[_0x7d3a('0x168')],{'as':_0x7d3a('0x14f'),'foreignKey':_0x7d3a('0x150')});db[_0x7d3a('0x55')][_0x7d3a('0x11a')](db[_0x7d3a('0x108')],{'as':'Agents','through':_0x7d3a('0x138')});db[_0x7d3a('0x57')][_0x7d3a('0x118')](db[_0x7d3a('0x108')],{'onDelete':'restrict'});db[_0x7d3a('0x57')]['belongsTo'](db[_0x7d3a('0x5b')],{'onDelete':_0x7d3a('0x175'),'foreignKey':_0x7d3a('0x188')});db['OpenchannelApplication'][_0x7d3a('0x118')](db[_0x7d3a('0x55')],{'onDelete':_0x7d3a('0x175'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication']['belongsTo'](db[_0x7d3a('0x14d')],{'onDelete':_0x7d3a('0x175'),'foreignKey':_0x7d3a('0x14e')});db[_0x7d3a('0x57')]['belongsTo'](db[_0x7d3a('0x16d')],{'onDelete':_0x7d3a('0x175'),'foreignKey':'TagId'});db[_0x7d3a('0x10f')][_0x7d3a('0x10a')](db[_0x7d3a('0x59')],{'as':_0x7d3a('0x156'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x189')});db[_0x7d3a('0x10f')][_0x7d3a('0x118')](db[_0x7d3a('0x55')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x7d3a('0x10f')]['belongsTo'](db['CmContact'],{'as':_0x7d3a('0x15e'),'foreignKey':'ContactId'});db[_0x7d3a('0x10f')]['belongsTo'](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x16c'),'foreignKey':_0x7d3a('0x109')});db[_0x7d3a('0x10f')][_0x7d3a('0x11a')](db[_0x7d3a('0x16d')],{'through':_0x7d3a('0x18a'),'as':_0x7d3a('0x185')});db[_0x7d3a('0x10f')]['belongsToMany'](db[_0x7d3a('0x16d')],{'through':'openchannel_interaction_has_tags','as':_0x7d3a('0x16f')});db['OpenchannelInteraction'][_0x7d3a('0x11a')](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x170'),'through':_0x7d3a('0x126'),'foreignKey':'OpenchannelInteractionId'});db[_0x7d3a('0x59')][_0x7d3a('0x118')](db['User'],{'onDelete':_0x7d3a('0x107'),'as':_0x7d3a('0x108')});db[_0x7d3a('0x59')]['belongsTo'](db[_0x7d3a('0x6d')],{'onDelete':_0x7d3a('0x107'),'as':_0x7d3a('0x15e')});db[_0x7d3a('0x59')][_0x7d3a('0x118')](db[_0x7d3a('0x10f')],{'onDelete':_0x7d3a('0x107'),'as':_0x7d3a('0x17f'),'foreignKey':_0x7d3a('0x189')});db['OpenchannelMessage'][_0x7d3a('0x118')](db[_0x7d3a('0xdf')],{'as':'Attachment','foreignKey':_0x7d3a('0x18b')});db[_0x7d3a('0x59')][_0x7d3a('0x118')](db[_0x7d3a('0x55')],{'as':_0x7d3a('0x16b'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0x7d3a('0x11a')](db[_0x7d3a('0x108')],{'as':'Agents','through':_0x7d3a('0x32'),'foreignKey':_0x7d3a('0x188')});db['OpenchannelQueue'][_0x7d3a('0x11a')](db['Team'],{'through':_0x7d3a('0x18c'),'as':_0x7d3a('0x153')});db['ChatWebsite'][_0x7d3a('0x10a')](db['Disposition'],{'as':_0x7d3a('0x163'),'foreignKey':_0x7d3a('0x172'),'onDelete':_0x7d3a('0x107')});db[_0x7d3a('0x131')][_0x7d3a('0x10a')](db[_0x7d3a('0x7c')],{'as':_0x7d3a('0x164'),'foreignKey':'ChatWebsiteId'});db[_0x7d3a('0x131')][_0x7d3a('0x10a')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db['ChatWebsite'][_0x7d3a('0x10a')](db[_0x7d3a('0x62')],{'as':_0x7d3a('0x17a')});db[_0x7d3a('0x131')][_0x7d3a('0x10a')](db[_0x7d3a('0x60')],{'as':'Applications'});db[_0x7d3a('0x131')][_0x7d3a('0x10a')](db[_0x7d3a('0x64')],{'as':_0x7d3a('0x156')});db[_0x7d3a('0x131')]['belongsTo'](db[_0x7d3a('0x11f')],{'as':'List','foreignKey':_0x7d3a('0x165')});db['ChatWebsite'][_0x7d3a('0x118')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0x7d3a('0x131')][_0x7d3a('0x118')](db[_0x7d3a('0x39')],{'as':_0x7d3a('0x39'),'foreignKey':_0x7d3a('0x160')});db[_0x7d3a('0x131')][_0x7d3a('0x118')](db[_0x7d3a('0x168')],{'as':_0x7d3a('0x14f'),'foreignKey':_0x7d3a('0x150')});db[_0x7d3a('0x131')][_0x7d3a('0x11a')](db['User'],{'as':_0x7d3a('0x152'),'through':_0x7d3a('0x132')});db[_0x7d3a('0x5e')]['belongsTo'](db[_0x7d3a('0x55')],{});db[_0x7d3a('0x5e')][_0x7d3a('0x118')](db['CmList'],{'as':_0x7d3a('0x178'),'foreignKey':_0x7d3a('0x165')});db[_0x7d3a('0x5e')][_0x7d3a('0x118')](db[_0x7d3a('0x6d')],{'as':'Contact','foreignKey':_0x7d3a('0x15f')});db[_0x7d3a('0x5e')][_0x7d3a('0x118')](db[_0x7d3a('0x10f')],{});db[_0x7d3a('0x5e')][_0x7d3a('0x118')](db[_0x7d3a('0x59')],{});db[_0x7d3a('0x5e')][_0x7d3a('0x118')](db['User'],{});db[_0x7d3a('0x5e')][_0x7d3a('0x118')](db[_0x7d3a('0x5b')],{});db[_0x7d3a('0x60')]['belongsTo'](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x18d'),'foreignKey':_0x7d3a('0x109'),'onDelete':_0x7d3a('0x175')});db['ChatApplication'][_0x7d3a('0x118')](db[_0x7d3a('0x66')],{'as':_0x7d3a('0x18e'),'foreignKey':'ChatQueueId','onDelete':_0x7d3a('0x175')});db[_0x7d3a('0x60')]['belongsTo'](db['ChatWebsite'],{'as':'Website','foreignKey':_0x7d3a('0x172'),'onDelete':'restrict'});db[_0x7d3a('0x60')][_0x7d3a('0x118')](db[_0x7d3a('0x16d')],{'onDelete':_0x7d3a('0x175'),'foreignKey':_0x7d3a('0x176')});db[_0x7d3a('0x62')][_0x7d3a('0x10a')](db[_0x7d3a('0x64')],{'as':_0x7d3a('0x156'),'onDelete':'cascade','foreignKey':_0x7d3a('0x18f')});db[_0x7d3a('0x62')][_0x7d3a('0x118')](db['ChatWebsite'],{'as':_0x7d3a('0x16b'),'foreignKey':'ChatWebsiteId'});db[_0x7d3a('0x62')][_0x7d3a('0x118')](db[_0x7d3a('0x6d')],{'as':_0x7d3a('0x15e'),'foreignKey':_0x7d3a('0x15f')});db[_0x7d3a('0x62')][_0x7d3a('0x118')](db['User'],{'as':_0x7d3a('0x16c'),'foreignKey':'UserId'});db[_0x7d3a('0x62')][_0x7d3a('0x11a')](db[_0x7d3a('0x16d')],{'through':_0x7d3a('0x190'),'as':_0x7d3a('0x185')});db['ChatInteraction'][_0x7d3a('0x11a')](db[_0x7d3a('0x16d')],{'through':'chat_interaction_has_tags','as':_0x7d3a('0x16f')});db['ChatInteraction']['belongsToMany'](db['User'],{'as':'Users','through':_0x7d3a('0x191'),'foreignKey':_0x7d3a('0x18f')});db[_0x7d3a('0x64')]['belongsTo'](db[_0x7d3a('0x108')],{'onDelete':_0x7d3a('0x107'),'as':_0x7d3a('0x108')});db[_0x7d3a('0x64')][_0x7d3a('0x118')](db[_0x7d3a('0x6d')],{'onDelete':_0x7d3a('0x107'),'as':_0x7d3a('0x15e'),'foreignKey':_0x7d3a('0x15f')});db[_0x7d3a('0x64')][_0x7d3a('0x118')](db[_0x7d3a('0x62')],{'onDelete':_0x7d3a('0x107'),'as':_0x7d3a('0x17f'),'foreignKey':'ChatInteractionId'});db[_0x7d3a('0x64')]['belongsTo'](db['Attachment'],{'as':_0x7d3a('0xdf'),'foreignKey':_0x7d3a('0x18b')});db[_0x7d3a('0x64')][_0x7d3a('0x118')](db[_0x7d3a('0x131')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x7d3a('0x65')]['hasMany'](db['Attachment'],{'as':_0x7d3a('0x171'),'foreignKey':_0x7d3a('0x173'),'onDelete':_0x7d3a('0x107'),'hooks':!![]});db[_0x7d3a('0x65')]['belongsTo'](db['CmContact'],{'onDelete':_0x7d3a('0x107'),'as':_0x7d3a('0x15e'),'foreignKey':_0x7d3a('0x15f')});db[_0x7d3a('0x65')][_0x7d3a('0x118')](db[_0x7d3a('0x131')],{'as':_0x7d3a('0x16b'),'foreignKey':'ChatWebsiteId'});db[_0x7d3a('0x66')][_0x7d3a('0x11a')](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x152'),'through':_0x7d3a('0x2b'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db['Team'],{'through':_0x7d3a('0x192'),'as':_0x7d3a('0x153')});db[_0x7d3a('0x11b')][_0x7d3a('0x10a')](db[_0x7d3a('0xc6')],{'as':'Messages','foreignKey':_0x7d3a('0x193'),'onDelete':_0x7d3a('0x107')});db[_0x7d3a('0x11b')][_0x7d3a('0x11a')](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x144'),'through':_0x7d3a('0x11c')});db[_0x7d3a('0x69')][_0x7d3a('0x118')](db['ChatWebsite'],{'as':_0x7d3a('0x194'),'foreignKey':'ChatWebsiteId'});db[_0x7d3a('0x6b')][_0x7d3a('0x10a')](db[_0x7d3a('0x6d')],{'as':_0x7d3a('0x11d'),'foreignKey':_0x7d3a('0x195')});db[_0x7d3a('0x6d')][_0x7d3a('0x10a')](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x7d3a('0x6d')][_0x7d3a('0x10a')](db[_0x7d3a('0x72')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0x7d3a('0x6d')][_0x7d3a('0x10a')](db[_0x7d3a('0x73')],{'as':_0x7d3a('0x147'),'foreignKey':'ContactId'});db[_0x7d3a('0x6d')][_0x7d3a('0x10a')](db[_0x7d3a('0x10e')],{'as':_0x7d3a('0x10e'),'foreignKey':_0x7d3a('0x15f')});db['CmContact'][_0x7d3a('0x10a')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x7d3a('0x15f')});db['CmContact'][_0x7d3a('0x10a')](db['OpenchannelInteraction'],{'as':_0x7d3a('0x110'),'foreignKey':_0x7d3a('0x15f'),'onDelete':_0x7d3a('0x175')});db[_0x7d3a('0x6d')][_0x7d3a('0x10a')](db[_0x7d3a('0x62')],{'as':_0x7d3a('0x111'),'foreignKey':_0x7d3a('0x15f'),'onDelete':'restrict'});db['CmContact']['hasMany'](db[_0x7d3a('0x51')],{'as':'SmsInteractions','foreignKey':_0x7d3a('0x15f'),'onDelete':_0x7d3a('0x175')});db[_0x7d3a('0x6d')][_0x7d3a('0x10a')](db[_0x7d3a('0x4a')],{'as':_0x7d3a('0x113'),'foreignKey':_0x7d3a('0x15f'),'onDelete':_0x7d3a('0x175')});db['CmContact'][_0x7d3a('0x10a')](db[_0x7d3a('0x114')],{'as':_0x7d3a('0x122'),'foreignKey':_0x7d3a('0x15f'),'onDelete':'restrict'});db[_0x7d3a('0x6d')][_0x7d3a('0x118')](db[_0x7d3a('0x6b')],{'as':_0x7d3a('0x196'),'foreignKey':_0x7d3a('0x195')});db[_0x7d3a('0x6d')][_0x7d3a('0x118')](db[_0x7d3a('0x11f')],{'as':_0x7d3a('0x178'),'foreignKey':_0x7d3a('0x165'),'onDelete':'cascade'});db['CmContact'][_0x7d3a('0x11a')](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x170'),'through':'cm_user_has_contacts'});db[_0x7d3a('0x6d')][_0x7d3a('0x11a')](db[_0x7d3a('0x16d')],{'as':_0x7d3a('0x185'),'through':_0x7d3a('0x197')});db[_0x7d3a('0x6d')][_0x7d3a('0x11a')](db['Tag'],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0x7d3a('0x6e')][_0x7d3a('0x118')](db['CmContact'],{'as':_0x7d3a('0x15e'),'foreignKey':_0x7d3a('0x15f'),'onDelete':'cascade'});db['CmHopper'][_0x7d3a('0x118')](db[_0x7d3a('0x11f')],{'as':_0x7d3a('0x178'),'foreignKey':_0x7d3a('0x165'),'onDelete':'cascade'});db[_0x7d3a('0x6e')]['belongsTo'](db[_0x7d3a('0x108')],{'as':'Agent','foreignKey':_0x7d3a('0x109')});db[_0x7d3a('0x6e')][_0x7d3a('0x118')](db['VoiceQueue'],{'as':_0x7d3a('0x18e'),'foreignKey':_0x7d3a('0x145'),'onDelete':_0x7d3a('0x107')});db[_0x7d3a('0x6e')][_0x7d3a('0x118')](db[_0x7d3a('0xdb')],{'as':_0x7d3a('0xdb'),'foreignKey':_0x7d3a('0x198'),'onDelete':_0x7d3a('0x107')});db['CmHopper'][_0x7d3a('0x118')](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x16c'),'foreignKey':_0x7d3a('0x199')});db[_0x7d3a('0x70')][_0x7d3a('0x118')](db['CmContact'],{'as':_0x7d3a('0x15e'),'foreignKey':'ContactId','onDelete':_0x7d3a('0x107')});db['CmHopperBlack'][_0x7d3a('0x118')](db['CmList'],{'as':_0x7d3a('0x178'),'foreignKey':_0x7d3a('0x165'),'onDelete':_0x7d3a('0x107')});db[_0x7d3a('0x70')][_0x7d3a('0x118')](db[_0x7d3a('0x18')],{'as':_0x7d3a('0x18e'),'foreignKey':_0x7d3a('0x145'),'onDelete':_0x7d3a('0x107')});db[_0x7d3a('0x70')][_0x7d3a('0x118')](db[_0x7d3a('0xdb')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x7d3a('0x107')});db[_0x7d3a('0x7a')][_0x7d3a('0x10a')](db['Condition'],{'as':{'plural':_0x7d3a('0x19a'),'singular':_0x7d3a('0x19b')},'foreignKey':_0x7d3a('0x19c'),'onDelete':_0x7d3a('0x107'),'hooks':!![]});db[_0x7d3a('0x7a')][_0x7d3a('0x10a')](db[_0x7d3a('0x19d')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x7d3a('0x107'),'hooks':!![]});db[_0x7d3a('0x7a')]['hasMany'](db['Action'],{'as':'Actions','foreignKey':_0x7d3a('0x19e'),'onDelete':_0x7d3a('0x107'),'hooks':!![]});db[_0x7d3a('0x7e')][_0x7d3a('0x10a')](db['Disposition'],{'as':_0x7d3a('0x163'),'foreignKey':'ParentId','onDelete':_0x7d3a('0x107')});db[_0x7d3a('0x14d')][_0x7d3a('0x10a')](db[_0x7d3a('0x14d')],{'as':_0x7d3a('0x19f'),'foreignKey':'IntervalId','onDelete':_0x7d3a('0x107'),'hooks':!![],'required':![]});db[_0x7d3a('0x14d')][_0x7d3a('0x10a')](db[_0x7d3a('0x15')],{'as':_0x7d3a('0x1a0'),'foreignKey':_0x7d3a('0x14e'),'onDelete':_0x7d3a('0x175')});db[_0x7d3a('0x14d')][_0x7d3a('0x10a')](db[_0x7d3a('0x174')],{'as':_0x7d3a('0x1a1'),'foreignKey':_0x7d3a('0x14e')});db[_0x7d3a('0x14d')]['hasMany'](db['ChatApplication'],{'as':'ChatApplications','foreignKey':_0x7d3a('0x14e')});db[_0x7d3a('0x14d')][_0x7d3a('0x10a')](db['FaxApplication'],{'as':_0x7d3a('0x1a2'),'foreignKey':_0x7d3a('0x14e')});db[_0x7d3a('0x14d')][_0x7d3a('0x10a')](db[_0x7d3a('0x4f')],{'as':_0x7d3a('0x1a3'),'foreignKey':_0x7d3a('0x14e')});db['Schedule'][_0x7d3a('0x118')](db[_0x7d3a('0x39')],{});db[_0x7d3a('0x84')][_0x7d3a('0x118')](db[_0x7d3a('0x93')],{'foreignKey':_0x7d3a('0x1a4')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x7d3a('0x1a5')});db[_0x7d3a('0x86')][_0x7d3a('0x11a')](db['VoiceMusicOnHold'],{'as':'Mohs','through':_0x7d3a('0x1a6'),'onDelete':_0x7d3a('0x175')});db[_0x7d3a('0x16d')][_0x7d3a('0x11a')](db[_0x7d3a('0x6d')],{'through':'cm_contact_has_tags'});db[_0x7d3a('0x16d')][_0x7d3a('0x11a')](db[_0x7d3a('0x62')],{'through':_0x7d3a('0x190')});db[_0x7d3a('0x16d')][_0x7d3a('0x11a')](db[_0x7d3a('0x114')],{'through':_0x7d3a('0x16e')});db[_0x7d3a('0x16d')][_0x7d3a('0x11a')](db[_0x7d3a('0x51')],{'through':_0x7d3a('0x184')});db[_0x7d3a('0x16d')][_0x7d3a('0x11a')](db[_0x7d3a('0x4a')],{'through':_0x7d3a('0x17e')});db['Tag'][_0x7d3a('0x11a')](db[_0x7d3a('0x10f')],{'through':_0x7d3a('0x18a')});db[_0x7d3a('0x16d')]['belongsToMany'](db[_0x7d3a('0xf5')],{'through':_0x7d3a('0x1a7')});db[_0x7d3a('0x8a')][_0x7d3a('0x10a')](db['Condition'],{'as':{'plural':_0x7d3a('0x1a8'),'singular':_0x7d3a('0x1a9')},'foreignKey':_0x7d3a('0x1aa'),'onDelete':_0x7d3a('0x107'),'hooks':!![]});db[_0x7d3a('0x8a')][_0x7d3a('0x10a')](db['Condition'],{'as':{'plural':'AnyConditions','singular':_0x7d3a('0x1ab')},'foreignKey':_0x7d3a('0x1ac'),'onDelete':_0x7d3a('0x107'),'hooks':!![]});db[_0x7d3a('0x8a')][_0x7d3a('0x10a')](db[_0x7d3a('0x78')],{'as':'Actions','foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0x7d3a('0x91')][_0x7d3a('0x10a')](db[_0x7d3a('0x98')],{'as':'Fields','onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1a5'),'hooks':!![]});db[_0x7d3a('0x93')][_0x7d3a('0x10a')](db['AnalyticFieldReport'],{'as':_0x7d3a('0x1ad'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1a4')});db[_0x7d3a('0x1ae')][_0x7d3a('0x10a')](db[_0x7d3a('0x98')],{'as':_0x7d3a('0x1ad'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1af')});db[_0x7d3a('0x98')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0x7d3a('0x1af')});db[_0x7d3a('0x9b')]['hasMany'](db[_0x7d3a('0x9d')],{'as':_0x7d3a('0x1b0'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b1')});db[_0x7d3a('0x9d')]['hasMany'](db[_0x7d3a('0x1b2')],{'as':_0x7d3a('0x1b3'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b4')});db[_0x7d3a('0x9d')][_0x7d3a('0x10a')](db[_0x7d3a('0x1b2')],{'as':'Descriptions','onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b5')});db[_0x7d3a('0x9d')][_0x7d3a('0x10a')](db[_0x7d3a('0x1b2')],{'as':_0x7d3a('0x1ad'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b6')});db[_0x7d3a('0x9d')][_0x7d3a('0x118')](db['SalesforceAccount'],{'as':_0x7d3a('0x16b'),'foreignKey':'AccountId'});db[_0x7d3a('0x1b2')]['hasMany'](db[_0x7d3a('0x1b2')],{'as':_0x7d3a('0x1b7'),'foreignKey':_0x7d3a('0x1b4')});db[_0x7d3a('0x1b2')][_0x7d3a('0x10a')](db[_0x7d3a('0x1b2')],{'as':'Description','foreignKey':_0x7d3a('0x1b5')});db[_0x7d3a('0x1b2')][_0x7d3a('0x10a')](db[_0x7d3a('0x1b2')],{'as':_0x7d3a('0x1b8'),'foreignKey':'FieldId'});db[_0x7d3a('0x1b2')][_0x7d3a('0x118')](db['Variable'],{'as':_0x7d3a('0x8c'),'foreignKey':'VariableId'});db[_0x7d3a('0x1b9')]['hasMany'](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x7d3a('0x1b1')});db[_0x7d3a('0xa1')][_0x7d3a('0x10a')](db[_0x7d3a('0x1ba')],{'as':_0x7d3a('0x1b3'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b4')});db[_0x7d3a('0xa1')][_0x7d3a('0x10a')](db[_0x7d3a('0x1ba')],{'as':_0x7d3a('0x1bb'),'onDelete':'cascade','foreignKey':_0x7d3a('0x1b5')});db[_0x7d3a('0xa1')]['hasMany'](db[_0x7d3a('0x1ba')],{'as':_0x7d3a('0x1ad'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b6')});db[_0x7d3a('0xa1')][_0x7d3a('0x118')](db[_0x7d3a('0x1b9')],{'as':_0x7d3a('0x16b'),'foreignKey':_0x7d3a('0x1b1')});db['SugarcrmField'][_0x7d3a('0x10a')](db[_0x7d3a('0x1ba')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x7d3a('0x1ba')][_0x7d3a('0x10a')](db[_0x7d3a('0x1ba')],{'as':'Description','foreignKey':_0x7d3a('0x1b5')});db[_0x7d3a('0x1ba')][_0x7d3a('0x10a')](db['SugarcrmField'],{'as':_0x7d3a('0x1b8'),'foreignKey':_0x7d3a('0x1b6')});db[_0x7d3a('0x1ba')][_0x7d3a('0x118')](db[_0x7d3a('0x8c')],{'as':_0x7d3a('0x8c'),'foreignKey':_0x7d3a('0x1bc')});db[_0x7d3a('0xa2')][_0x7d3a('0x10a')](db['DeskConfiguration'],{'as':_0x7d3a('0x1b0'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b1')});db[_0x7d3a('0x1bd')][_0x7d3a('0x10a')](db['DeskField'],{'as':_0x7d3a('0x1b3'),'onDelete':_0x7d3a('0x107'),'foreignKey':'SubjectId'});db['DeskConfiguration'][_0x7d3a('0x10a')](db[_0x7d3a('0xa5')],{'as':_0x7d3a('0x1bb'),'onDelete':_0x7d3a('0x107'),'foreignKey':'DescriptionId'});db[_0x7d3a('0x1bd')][_0x7d3a('0x10a')](db[_0x7d3a('0xa5')],{'as':_0x7d3a('0x1ad'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b6')});db[_0x7d3a('0x1bd')][_0x7d3a('0x118')](db[_0x7d3a('0xa2')],{'as':'Account','foreignKey':'AccountId'});db[_0x7d3a('0x1bd')][_0x7d3a('0x11a')](db[_0x7d3a('0x16d')],{'through':_0x7d3a('0x1be')});db[_0x7d3a('0xa5')][_0x7d3a('0x10a')](db['DeskField'],{'as':_0x7d3a('0x1b7'),'foreignKey':_0x7d3a('0x1b4')});db['DeskField']['hasMany'](db[_0x7d3a('0xa5')],{'as':_0x7d3a('0x1bf'),'foreignKey':_0x7d3a('0x1b5')});db[_0x7d3a('0xa5')][_0x7d3a('0x10a')](db[_0x7d3a('0xa5')],{'as':'Field','foreignKey':_0x7d3a('0x1b6')});db['DeskField']['belongsTo'](db[_0x7d3a('0x8c')],{'as':'Variable','foreignKey':_0x7d3a('0x1bc')});db[_0x7d3a('0x1c0')][_0x7d3a('0x10a')](db[_0x7d3a('0xa8')],{'as':_0x7d3a('0x1b0'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b1')});db['ZohoConfiguration'][_0x7d3a('0x10a')](db['ZohoField'],{'as':_0x7d3a('0x1b3'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b4')});db['ZohoConfiguration'][_0x7d3a('0x10a')](db['ZohoField'],{'as':'Descriptions','onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b5')});db[_0x7d3a('0xa8')][_0x7d3a('0x10a')](db[_0x7d3a('0x1c1')],{'as':_0x7d3a('0x1ad'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b6')});db[_0x7d3a('0xa8')][_0x7d3a('0x118')](db[_0x7d3a('0x1c0')],{'as':_0x7d3a('0x16b'),'foreignKey':'AccountId'});db['ZohoField'][_0x7d3a('0x10a')](db['ZohoField'],{'as':_0x7d3a('0x1b7'),'foreignKey':'SubjectId'});db['ZohoField'][_0x7d3a('0x10a')](db['ZohoField'],{'as':_0x7d3a('0x1bf'),'foreignKey':_0x7d3a('0x1b5')});db[_0x7d3a('0x1c1')][_0x7d3a('0x10a')](db[_0x7d3a('0x1c1')],{'as':_0x7d3a('0x1b8'),'foreignKey':_0x7d3a('0x1b6')});db[_0x7d3a('0x1c1')][_0x7d3a('0x118')](db[_0x7d3a('0x8c')],{'as':_0x7d3a('0x8c'),'foreignKey':_0x7d3a('0x1bc')});db[_0x7d3a('0xab')][_0x7d3a('0x10a')](db[_0x7d3a('0xac')],{'as':'Configurations','onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b1')});db[_0x7d3a('0xac')][_0x7d3a('0x10a')](db[_0x7d3a('0xae')],{'as':_0x7d3a('0x1b3'),'foreignKey':_0x7d3a('0x1b4')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x7d3a('0x1b5')});db[_0x7d3a('0xac')]['hasMany'](db[_0x7d3a('0xae')],{'as':_0x7d3a('0x1ad'),'foreignKey':_0x7d3a('0x1b6')});db[_0x7d3a('0xac')]['belongsTo'](db[_0x7d3a('0xab')],{'as':_0x7d3a('0x16b'),'foreignKey':_0x7d3a('0x1b1')});db[_0x7d3a('0xac')][_0x7d3a('0x11a')](db[_0x7d3a('0x16d')],{'through':_0x7d3a('0x1c2')});db['ZendeskField'][_0x7d3a('0x10a')](db[_0x7d3a('0xae')],{'as':_0x7d3a('0x1b7'),'foreignKey':_0x7d3a('0x1b4')});db[_0x7d3a('0xae')][_0x7d3a('0x10a')](db['ZendeskField'],{'as':_0x7d3a('0x1bf'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x7d3a('0x10a')](db[_0x7d3a('0xae')],{'as':_0x7d3a('0x1b8'),'foreignKey':_0x7d3a('0x1b6')});db['ZendeskField'][_0x7d3a('0x118')](db[_0x7d3a('0x8c')],{'as':_0x7d3a('0x8c'),'foreignKey':'VariableId'});db[_0x7d3a('0xb0')][_0x7d3a('0x10a')](db[_0x7d3a('0xb2')],{'as':_0x7d3a('0x1b0'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b1')});db[_0x7d3a('0xb2')]['hasMany'](db['FreshdeskField'],{'as':_0x7d3a('0x1b3'),'onDelete':'cascade','foreignKey':_0x7d3a('0x1b4')});db[_0x7d3a('0xb2')]['hasMany'](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b5')});db[_0x7d3a('0xb2')][_0x7d3a('0x10a')](db[_0x7d3a('0xb3')],{'as':'Fields','onDelete':_0x7d3a('0x107'),'foreignKey':'FieldId'});db[_0x7d3a('0xb2')]['belongsTo'](db['FreshdeskAccount'],{'as':_0x7d3a('0x16b'),'foreignKey':_0x7d3a('0x1b1')});db['FreshdeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0x7d3a('0x1c3')});db[_0x7d3a('0xb3')]['hasMany'](db[_0x7d3a('0xb3')],{'as':_0x7d3a('0x1b7'),'foreignKey':_0x7d3a('0x1b4')});db['FreshdeskField'][_0x7d3a('0x10a')](db[_0x7d3a('0xb3')],{'as':'Description','foreignKey':_0x7d3a('0x1b5')});db[_0x7d3a('0xb3')][_0x7d3a('0x10a')](db[_0x7d3a('0xb3')],{'as':_0x7d3a('0x1b8'),'foreignKey':'FieldId'});db[_0x7d3a('0xb3')][_0x7d3a('0x118')](db['Variable'],{'as':_0x7d3a('0x8c'),'foreignKey':'VariableId'});db[_0x7d3a('0x1c4')][_0x7d3a('0x10a')](db[_0x7d3a('0x1c5')],{'as':_0x7d3a('0x1b0'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b1')});db[_0x7d3a('0x1c5')][_0x7d3a('0x10a')](db[_0x7d3a('0xb6')],{'as':'Subjects','foreignKey':_0x7d3a('0x1b4')});db['VtigerConfiguration'][_0x7d3a('0x10a')](db['VtigerField'],{'as':_0x7d3a('0x1bb'),'foreignKey':_0x7d3a('0x1b5')});db[_0x7d3a('0x1c5')][_0x7d3a('0x10a')](db['VtigerField'],{'as':'Fields','foreignKey':_0x7d3a('0x1b6')});db['VtigerConfiguration']['belongsTo'](db['VtigerAccount'],{'as':_0x7d3a('0x16b'),'foreignKey':_0x7d3a('0x1b1')});db[_0x7d3a('0xb6')][_0x7d3a('0x10a')](db['VtigerField'],{'as':_0x7d3a('0x1b7'),'foreignKey':'SubjectId'});db[_0x7d3a('0xb6')][_0x7d3a('0x10a')](db[_0x7d3a('0xb6')],{'as':_0x7d3a('0x1bf'),'foreignKey':_0x7d3a('0x1b5')});db[_0x7d3a('0xb6')][_0x7d3a('0x10a')](db[_0x7d3a('0xb6')],{'as':'Field','foreignKey':_0x7d3a('0x1b6')});db[_0x7d3a('0xb6')][_0x7d3a('0x118')](db['Variable'],{'as':_0x7d3a('0x8c'),'foreignKey':_0x7d3a('0x1bc')});db[_0x7d3a('0xb8')][_0x7d3a('0x10a')](db[_0x7d3a('0xb9')],{'as':'Configurations','onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b1')});db[_0x7d3a('0xb9')][_0x7d3a('0x10a')](db['ServicenowField'],{'as':'Subjects','foreignKey':_0x7d3a('0x1b4')});db[_0x7d3a('0xb9')][_0x7d3a('0x10a')](db['ServicenowField'],{'as':'Descriptions','foreignKey':_0x7d3a('0x1b5')});db['ServicenowConfiguration'][_0x7d3a('0x10a')](db[_0x7d3a('0xba')],{'as':_0x7d3a('0x1ad'),'foreignKey':_0x7d3a('0x1b6')});db['ServicenowConfiguration'][_0x7d3a('0x118')](db['ServicenowAccount'],{'as':_0x7d3a('0x16b'),'foreignKey':_0x7d3a('0x1b1')});db[_0x7d3a('0xba')][_0x7d3a('0x10a')](db[_0x7d3a('0xba')],{'as':_0x7d3a('0x1b7'),'foreignKey':_0x7d3a('0x1b4')});db['ServicenowField'][_0x7d3a('0x10a')](db['ServicenowField'],{'as':_0x7d3a('0x1bf'),'foreignKey':_0x7d3a('0x1b5')});db['ServicenowField'][_0x7d3a('0x10a')](db['ServicenowField'],{'as':_0x7d3a('0x1b8'),'foreignKey':'FieldId'});db[_0x7d3a('0xba')][_0x7d3a('0x118')](db['Variable'],{'as':'Variable','foreignKey':_0x7d3a('0x1bc')});db[_0x7d3a('0xbb')][_0x7d3a('0x10a')](db[_0x7d3a('0xbc')],{'as':_0x7d3a('0x1b0'),'onDelete':'cascade','foreignKey':_0x7d3a('0x1b1')});db[_0x7d3a('0xbc')][_0x7d3a('0x10a')](db['Dynamics365Field'],{'as':_0x7d3a('0x1b3'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b4')});db[_0x7d3a('0xbc')][_0x7d3a('0x10a')](db[_0x7d3a('0xbd')],{'as':'Descriptions','onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b5')});db[_0x7d3a('0xbc')][_0x7d3a('0x10a')](db[_0x7d3a('0xbd')],{'as':_0x7d3a('0x1ad'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b6')});db[_0x7d3a('0xbc')][_0x7d3a('0x118')](db[_0x7d3a('0xbb')],{'as':_0x7d3a('0x16b'),'foreignKey':_0x7d3a('0x1b1')});db['Dynamics365Field']['hasMany'](db[_0x7d3a('0xbd')],{'as':_0x7d3a('0x1b7'),'foreignKey':_0x7d3a('0x1b4')});db[_0x7d3a('0xbd')][_0x7d3a('0x10a')](db[_0x7d3a('0xbd')],{'as':_0x7d3a('0x1bf'),'foreignKey':_0x7d3a('0x1b5')});db['Dynamics365Field'][_0x7d3a('0x10a')](db[_0x7d3a('0xbd')],{'as':_0x7d3a('0x1b8'),'foreignKey':_0x7d3a('0x1b6')});db[_0x7d3a('0xbd')][_0x7d3a('0x118')](db['Variable'],{'as':_0x7d3a('0x8c'),'foreignKey':_0x7d3a('0x1bc')});db[_0x7d3a('0x1c6')][_0x7d3a('0x10a')](db['FreshsalesConfiguration'],{'as':_0x7d3a('0x1b0'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1b1')});db[_0x7d3a('0xc0')]['hasMany'](db[_0x7d3a('0xc1')],{'as':_0x7d3a('0x1b3'),'foreignKey':_0x7d3a('0x1b4')});db[_0x7d3a('0xc0')][_0x7d3a('0x10a')](db[_0x7d3a('0xc1')],{'as':_0x7d3a('0x1bb'),'foreignKey':'DescriptionId'});db[_0x7d3a('0xc0')][_0x7d3a('0x10a')](db[_0x7d3a('0xc1')],{'as':_0x7d3a('0x1ad'),'foreignKey':'FieldId'});db[_0x7d3a('0xc0')][_0x7d3a('0x118')](db[_0x7d3a('0x1c6')],{'as':_0x7d3a('0x16b'),'foreignKey':_0x7d3a('0x1b1')});db[_0x7d3a('0xc1')][_0x7d3a('0x10a')](db[_0x7d3a('0xc1')],{'as':_0x7d3a('0x1b7'),'foreignKey':_0x7d3a('0x1b4')});db[_0x7d3a('0xc1')][_0x7d3a('0x10a')](db[_0x7d3a('0xc1')],{'as':'Description','foreignKey':'DescriptionId'});db['FreshsalesField'][_0x7d3a('0x10a')](db[_0x7d3a('0xc1')],{'as':_0x7d3a('0x1b8'),'foreignKey':_0x7d3a('0x1b6')});db[_0x7d3a('0xc1')][_0x7d3a('0x118')](db[_0x7d3a('0x8c')],{'as':_0x7d3a('0x8c'),'foreignKey':_0x7d3a('0x1bc')});db[_0x7d3a('0x1c7')][_0x7d3a('0x118')](db[_0x7d3a('0x131')],{});db[_0x7d3a('0x1c7')][_0x7d3a('0x118')](db['CmList'],{'as':_0x7d3a('0x178'),'foreignKey':_0x7d3a('0x165')});db[_0x7d3a('0x1c7')][_0x7d3a('0x118')](db[_0x7d3a('0x6d')],{'as':_0x7d3a('0x15e'),'foreignKey':_0x7d3a('0x15f')});db[_0x7d3a('0x1c7')][_0x7d3a('0x118')](db['ChatInteraction'],{});db['ChatQueueReport']['belongsTo'](db[_0x7d3a('0x64')],{});db['ChatQueueReport'][_0x7d3a('0x118')](db[_0x7d3a('0x108')],{});db[_0x7d3a('0x1c7')][_0x7d3a('0x118')](db['ChatQueue'],{});db[_0x7d3a('0xc6')][_0x7d3a('0x118')](db[_0x7d3a('0x108')],{'onDelete':_0x7d3a('0x107'),'foreignKey':'FromId'});db[_0x7d3a('0xc6')][_0x7d3a('0x118')](db[_0x7d3a('0x108')],{'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1c8')});db['JscriptySessionReport'][_0x7d3a('0x10a')](db[_0x7d3a('0xc9')],{'foreignKey':_0x7d3a('0x1c9'),'onDelete':_0x7d3a('0x107')});db[_0x7d3a('0x149')][_0x7d3a('0x10a')](db[_0x7d3a('0xc7')],{'foreignKey':_0x7d3a('0x1c9'),'onDelete':_0x7d3a('0x107')});db['SmsQueueReport']['belongsTo'](db[_0x7d3a('0x4e')],{});db[_0x7d3a('0xcb')][_0x7d3a('0x118')](db[_0x7d3a('0x11f')],{'as':_0x7d3a('0x178'),'foreignKey':_0x7d3a('0x165')});db[_0x7d3a('0xcb')][_0x7d3a('0x118')](db['CmContact'],{'as':_0x7d3a('0x15e'),'foreignKey':_0x7d3a('0x15f')});db[_0x7d3a('0xcb')][_0x7d3a('0x118')](db[_0x7d3a('0x51')],{});db['SmsQueueReport']['belongsTo'](db[_0x7d3a('0x52')],{});db[_0x7d3a('0xcb')]['belongsTo'](db[_0x7d3a('0x108')],{});db[_0x7d3a('0xcb')][_0x7d3a('0x118')](db[_0x7d3a('0x12d')],{});db[_0x7d3a('0xcf')][_0x7d3a('0x10a')](db['JscriptySessionReport'],{'foreignKey':_0x7d3a('0x1ca')});db[_0x7d3a('0xcf')]['hasMany'](db[_0x7d3a('0xc9')],{'foreignKey':_0x7d3a('0x1ca')});db[_0x7d3a('0xcf')][_0x7d3a('0x10a')](db[_0x7d3a('0xc7')],{'foreignKey':_0x7d3a('0x1ca')});db[_0x7d3a('0xd3')][_0x7d3a('0x11a')](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x170'),'through':'user_has_square_projects'});db[_0x7d3a('0xd8')][_0x7d3a('0x11a')](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x152'),'through':'user_has_teams'});db[_0x7d3a('0xd8')]['belongsToMany'](db[_0x7d3a('0x18')],{'through':'TeamVoiceQueue','as':_0x7d3a('0x128')});db[_0x7d3a('0xd8')]['belongsToMany'](db[_0x7d3a('0x3b')],{'through':_0x7d3a('0x169'),'as':'MailQueues'});db[_0x7d3a('0xd8')]['belongsToMany'](db['ChatQueue'],{'through':_0x7d3a('0x192'),'as':_0x7d3a('0x12b')});db[_0x7d3a('0xd8')][_0x7d3a('0x11a')](db['FaxQueue'],{'through':_0x7d3a('0x180'),'as':_0x7d3a('0x1cb')});db[_0x7d3a('0xd8')][_0x7d3a('0x11a')](db[_0x7d3a('0x12d')],{'through':'team_has_sms_queues','as':_0x7d3a('0x12e')});db[_0x7d3a('0xd8')][_0x7d3a('0x11a')](db[_0x7d3a('0x5b')],{'through':_0x7d3a('0x18c'),'as':_0x7d3a('0x1cc')});db[_0x7d3a('0xd8')][_0x7d3a('0x11a')](db['WhatsappQueue'],{'through':_0x7d3a('0x1cd'),'as':_0x7d3a('0x1ce')});db['Team']['belongsToMany'](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':_0x7d3a('0x12a')});db[_0x7d3a('0xdb')][_0x7d3a('0x10a')](db[_0x7d3a('0x6e')],{'as':_0x7d3a('0x146'),'foreignKey':_0x7d3a('0x198')});db[_0x7d3a('0xdb')][_0x7d3a('0x10a')](db[_0x7d3a('0x72')],{'as':_0x7d3a('0x10c'),'foreignKey':_0x7d3a('0x198')});db[_0x7d3a('0xdb')][_0x7d3a('0x10a')](db[_0x7d3a('0x73')],{'as':_0x7d3a('0x147'),'foreignKey':_0x7d3a('0x198')});db['Campaign'][_0x7d3a('0x10a')](db[_0x7d3a('0x70')],{'as':_0x7d3a('0x148'),'foreignKey':_0x7d3a('0x198')});db['Campaign'][_0x7d3a('0x118')](db[_0x7d3a('0x24')],{'as':_0x7d3a('0x24'),'foreignKey':_0x7d3a('0x14a')});db[_0x7d3a('0xdb')][_0x7d3a('0x118')](db[_0x7d3a('0x24')],{'as':_0x7d3a('0x14b'),'foreignKey':_0x7d3a('0x14c')});db['Campaign'][_0x7d3a('0x118')](db[_0x7d3a('0x14d')],{'as':'Interval','foreignKey':_0x7d3a('0x14e')});db[_0x7d3a('0xdb')][_0x7d3a('0x118')](db['SquareProject'],{'as':_0x7d3a('0xd3'),'foreignKey':_0x7d3a('0x1cf')});db['Campaign'][_0x7d3a('0x11a')](db['CmList'],{'as':'Lists','through':_0x7d3a('0x1d0')});db[_0x7d3a('0xdb')][_0x7d3a('0x11a')](db[_0x7d3a('0x11f')],{'as':'BlackLists','through':_0x7d3a('0x1d1')});db[_0x7d3a('0xdf')][_0x7d3a('0x118')](db[_0x7d3a('0x65')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x7d3a('0xe2')][_0x7d3a('0x118')](db['MailMessage'],{});db[_0x7d3a('0xe2')][_0x7d3a('0x118')](db[_0x7d3a('0x114')],{});db[_0x7d3a('0xe2')][_0x7d3a('0x118')](db[_0x7d3a('0x39')],{'foreignKey':_0x7d3a('0x1d2'),'as':_0x7d3a('0x1d3')});db[_0x7d3a('0xe2')][_0x7d3a('0x118')](db[_0x7d3a('0x108')],{'foreignKey':_0x7d3a('0x1d4'),'as':_0x7d3a('0x1d5')});db[_0x7d3a('0xe2')][_0x7d3a('0x118')](db['User'],{'foreignKey':_0x7d3a('0x1d6'),'as':_0x7d3a('0x1d7')});db[_0x7d3a('0xe2')][_0x7d3a('0x118')](db[_0x7d3a('0x3b')],{'foreignKey':_0x7d3a('0x1d8'),'as':_0x7d3a('0x1d9')});db['MailTransferReport']['belongsTo'](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0x7d3a('0x1da')});db[_0x7d3a('0xe4')][_0x7d3a('0x118')](db['ChatMessage'],{});db[_0x7d3a('0xe4')]['belongsTo'](db['ChatInteraction'],{});db[_0x7d3a('0xe4')][_0x7d3a('0x118')](db['ChatWebsite'],{'foreignKey':_0x7d3a('0x1db'),'as':_0x7d3a('0x1d3')});db[_0x7d3a('0xe4')][_0x7d3a('0x118')](db[_0x7d3a('0x108')],{'foreignKey':_0x7d3a('0x1d4'),'as':'FromAgent'});db['ChatTransferReport'][_0x7d3a('0x118')](db[_0x7d3a('0x108')],{'foreignKey':_0x7d3a('0x1d6'),'as':_0x7d3a('0x1d7')});db['ChatTransferReport'][_0x7d3a('0x118')](db[_0x7d3a('0x66')],{'foreignKey':_0x7d3a('0x1dc'),'as':_0x7d3a('0x1d9')});db[_0x7d3a('0xe4')][_0x7d3a('0x118')](db[_0x7d3a('0x131')],{'foreignKey':_0x7d3a('0x1dd'),'as':'ToAccount'});db['FaxTransferReport'][_0x7d3a('0x118')](db['FaxMessage'],{});db['FaxTransferReport']['belongsTo'](db[_0x7d3a('0x4a')],{});db[_0x7d3a('0x1de')][_0x7d3a('0x118')](db[_0x7d3a('0x133')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0x7d3a('0x1de')][_0x7d3a('0x118')](db['User'],{'foreignKey':_0x7d3a('0x1d4'),'as':'FromAgent'});db[_0x7d3a('0x1de')][_0x7d3a('0x118')](db['User'],{'foreignKey':_0x7d3a('0x1d6'),'as':_0x7d3a('0x1d7')});db['FaxTransferReport'][_0x7d3a('0x118')](db['FaxQueue'],{'foreignKey':_0x7d3a('0x1df'),'as':_0x7d3a('0x1d9')});db[_0x7d3a('0x1de')]['belongsTo'](db[_0x7d3a('0x133')],{'foreignKey':_0x7d3a('0x1e0'),'as':'ToAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0x7d3a('0x59')],{});db[_0x7d3a('0xe7')][_0x7d3a('0x118')](db[_0x7d3a('0x10f')],{});db['OpenchannelTransferReport'][_0x7d3a('0x118')](db[_0x7d3a('0x55')],{'foreignKey':_0x7d3a('0x1e1'),'as':_0x7d3a('0x1d3')});db[_0x7d3a('0xe7')]['belongsTo'](db[_0x7d3a('0x108')],{'foreignKey':_0x7d3a('0x1d4'),'as':_0x7d3a('0x1d5')});db[_0x7d3a('0xe7')][_0x7d3a('0x118')](db[_0x7d3a('0x108')],{'foreignKey':_0x7d3a('0x1d6'),'as':_0x7d3a('0x1d7')});db[_0x7d3a('0xe7')][_0x7d3a('0x118')](db[_0x7d3a('0x5b')],{'foreignKey':_0x7d3a('0x1e2'),'as':_0x7d3a('0x1d9')});db['OpenchannelTransferReport']['belongsTo'](db[_0x7d3a('0x55')],{'foreignKey':_0x7d3a('0x1e3'),'as':_0x7d3a('0x1da')});db[_0x7d3a('0xe9')][_0x7d3a('0x118')](db[_0x7d3a('0x52')],{});db['SmsTransferReport'][_0x7d3a('0x118')](db[_0x7d3a('0x51')],{});db[_0x7d3a('0xe9')]['belongsTo'](db[_0x7d3a('0x4e')],{'foreignKey':_0x7d3a('0x1e4'),'as':_0x7d3a('0x1d3')});db[_0x7d3a('0xe9')]['belongsTo'](db[_0x7d3a('0x108')],{'foreignKey':_0x7d3a('0x1d4'),'as':_0x7d3a('0x1d5')});db[_0x7d3a('0xe9')][_0x7d3a('0x118')](db[_0x7d3a('0x108')],{'foreignKey':_0x7d3a('0x1d6'),'as':_0x7d3a('0x1d7')});db[_0x7d3a('0xe9')][_0x7d3a('0x118')](db['SmsQueue'],{'foreignKey':_0x7d3a('0x1e5'),'as':_0x7d3a('0x1d9')});db['SmsTransferReport'][_0x7d3a('0x118')](db['SmsAccount'],{'foreignKey':_0x7d3a('0x1e6'),'as':'ToAccount'});db[_0x7d3a('0x11f')][_0x7d3a('0x10a')](db[_0x7d3a('0x7e')],{'as':'Dispositions','foreignKey':_0x7d3a('0x165'),'onDelete':'cascade'});db[_0x7d3a('0x11f')][_0x7d3a('0x10a')](db[_0x7d3a('0x76')],{'as':_0x7d3a('0x1e7'),'foreignKey':_0x7d3a('0x165')});db['CmList']['hasMany'](db['CmContact'],{'as':_0x7d3a('0x11d'),'onDelete':'cascade','foreignKey':'ListId'});db[_0x7d3a('0x11f')]['hasMany'](db['CmHopperFinal'],{'as':_0x7d3a('0x10c'),'foreignKey':_0x7d3a('0x165')});db[_0x7d3a('0x11f')][_0x7d3a('0x10a')](db[_0x7d3a('0x73')],{'as':_0x7d3a('0x10d'),'foreignKey':'ListId'});db[_0x7d3a('0x11f')][_0x7d3a('0x10a')](db[_0x7d3a('0x10e')],{'as':_0x7d3a('0x10e'),'foreignKey':_0x7d3a('0x165')});db[_0x7d3a('0x11f')][_0x7d3a('0x11a')](db[_0x7d3a('0x18')],{'as':'Queues','through':_0x7d3a('0x151')});db[_0x7d3a('0x11f')]['belongsToMany'](db['User'],{'as':_0x7d3a('0x152'),'through':_0x7d3a('0x12f')});db['VoicePrefix']['hasMany'](db['VoiceExtension'],{'as':_0x7d3a('0x1a0'),'onDelete':_0x7d3a('0x107')});db[_0x7d3a('0x129')][_0x7d3a('0x11a')](db['User'],{'as':_0x7d3a('0x152'),'through':_0x7d3a('0x103')});db['VoicePrefix']['belongsToMany'](db['Team'],{'through':_0x7d3a('0x101'),'as':_0x7d3a('0x153')});db[_0x7d3a('0xec')][_0x7d3a('0x10a')](db['User'],{'as':_0x7d3a('0x170'),'foreignKey':'userProfileId'});db['UserProfile'][_0x7d3a('0x10a')](db['UserProfileSection'],{'as':_0x7d3a('0x1e8'),'foreignKey':_0x7d3a('0x119'),'onDelete':'cascade'});db['UserProfileSection'][_0x7d3a('0x10a')](db[_0x7d3a('0x1e9')],{'as':_0x7d3a('0x1ea'),'foreignKey':_0x7d3a('0x1eb'),'onDelete':_0x7d3a('0x107')});db[_0x7d3a('0xf3')][_0x7d3a('0x10a')](db[_0x7d3a('0x7e')],{'as':'Dispositions','foreignKey':_0x7d3a('0x1ec'),'onDelete':'cascade'});db[_0x7d3a('0xf3')][_0x7d3a('0x10a')](db[_0x7d3a('0x7c')],{'as':_0x7d3a('0x164'),'foreignKey':_0x7d3a('0x1ec')});db[_0x7d3a('0xf3')]['hasMany'](db[_0x7d3a('0xf6')],{'as':_0x7d3a('0x156'),'foreignKey':'WhatsappAccountId'});db[_0x7d3a('0xf3')][_0x7d3a('0x10a')](db[_0x7d3a('0xf5')],{'as':_0x7d3a('0x17a')});db['WhatsappAccount'][_0x7d3a('0x10a')](db[_0x7d3a('0x1ed')],{'as':'Applications'});db[_0x7d3a('0xf3')][_0x7d3a('0x118')](db[_0x7d3a('0x11f')],{'as':_0x7d3a('0x178'),'foreignKey':_0x7d3a('0x165')});db['WhatsappAccount'][_0x7d3a('0x118')](db[_0x7d3a('0x168')],{'as':_0x7d3a('0x14f'),'foreignKey':_0x7d3a('0x150')});db[_0x7d3a('0xf3')][_0x7d3a('0x11a')](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x152'),'through':'user_has_whatsapp_accounts'});db[_0x7d3a('0x1ed')][_0x7d3a('0x118')](db['User'],{'onDelete':'restrict'});db[_0x7d3a('0x1ed')]['belongsTo'](db[_0x7d3a('0xfc')],{'onDelete':_0x7d3a('0x175')});db[_0x7d3a('0x1ed')][_0x7d3a('0x118')](db[_0x7d3a('0xf3')],{'onDelete':_0x7d3a('0x175')});db[_0x7d3a('0x1ed')][_0x7d3a('0x118')](db[_0x7d3a('0x14d')],{'onDelete':_0x7d3a('0x175'),'foreignKey':_0x7d3a('0x14e')});db[_0x7d3a('0x1ed')][_0x7d3a('0x118')](db[_0x7d3a('0x16d')],{'onDelete':_0x7d3a('0x175'),'foreignKey':'TagId'});db[_0x7d3a('0xf5')][_0x7d3a('0x10a')](db['WhatsappMessage'],{'as':_0x7d3a('0x156'),'onDelete':_0x7d3a('0x107'),'foreignKey':_0x7d3a('0x1ee')});db[_0x7d3a('0xf5')][_0x7d3a('0x118')](db[_0x7d3a('0xf3')],{'as':_0x7d3a('0x16b'),'foreignKey':_0x7d3a('0x1ec')});db[_0x7d3a('0xf5')][_0x7d3a('0x118')](db[_0x7d3a('0x6d')],{'as':'Contact','foreignKey':_0x7d3a('0x15f')});db[_0x7d3a('0xf5')]['belongsTo'](db['User'],{'as':_0x7d3a('0x16c'),'foreignKey':_0x7d3a('0x109')});db['WhatsappInteraction'][_0x7d3a('0x11a')](db[_0x7d3a('0x16d')],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0x7d3a('0xf5')][_0x7d3a('0x11a')](db['Tag'],{'through':_0x7d3a('0x1a7'),'as':'ThroughTags'});db[_0x7d3a('0xf5')][_0x7d3a('0x11a')](db[_0x7d3a('0x108')],{'as':'Users','through':_0x7d3a('0x127'),'foreignKey':_0x7d3a('0x1ee')});db[_0x7d3a('0xf6')]['belongsTo'](db[_0x7d3a('0x108')],{'as':_0x7d3a('0x108')});db[_0x7d3a('0xf6')][_0x7d3a('0x118')](db['CmContact'],{'onDelete':_0x7d3a('0x107'),'as':_0x7d3a('0x15e')});db[_0x7d3a('0xf6')][_0x7d3a('0x118')](db[_0x7d3a('0xf5')],{'onDelete':_0x7d3a('0x107'),'as':_0x7d3a('0x17f'),'foreignKey':_0x7d3a('0x1ee')});db[_0x7d3a('0xf6')][_0x7d3a('0x118')](db[_0x7d3a('0xf3')],{'as':_0x7d3a('0x16b'),'foreignKey':_0x7d3a('0x1ec')});db[_0x7d3a('0xf8')][_0x7d3a('0x118')](db['WhatsappAccount'],{});db[_0x7d3a('0xf8')][_0x7d3a('0x118')](db[_0x7d3a('0x11f')],{'as':'List','foreignKey':'ListId'});db['WhatsappQueueReport']['belongsTo'](db[_0x7d3a('0x6d')],{'as':_0x7d3a('0x15e'),'foreignKey':_0x7d3a('0x15f')});db['WhatsappQueueReport'][_0x7d3a('0x118')](db[_0x7d3a('0xf5')],{});db[_0x7d3a('0xf8')][_0x7d3a('0x118')](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0x7d3a('0x118')](db['WhatsappMessage'],{});db[_0x7d3a('0xf8')][_0x7d3a('0x118')](db[_0x7d3a('0x108')],{});db[_0x7d3a('0xfa')][_0x7d3a('0x118')](db[_0x7d3a('0xf6')],{});db[_0x7d3a('0xfa')][_0x7d3a('0x118')](db[_0x7d3a('0xf5')],{});db['WhatsappTransferReport'][_0x7d3a('0x118')](db[_0x7d3a('0xf3')],{'foreignKey':_0x7d3a('0x1ef'),'as':_0x7d3a('0x1d3')});db[_0x7d3a('0xfa')][_0x7d3a('0x118')](db['WhatsappAccount'],{'foreignKey':_0x7d3a('0x1f0'),'as':_0x7d3a('0x1da')});db[_0x7d3a('0xfa')][_0x7d3a('0x118')](db[_0x7d3a('0xfc')],{'foreignKey':_0x7d3a('0x1f1'),'as':_0x7d3a('0x1d9')});db[_0x7d3a('0xfa')][_0x7d3a('0x118')](db[_0x7d3a('0x108')],{'foreignKey':_0x7d3a('0x1d4'),'as':_0x7d3a('0x1d5')});db['WhatsappTransferReport']['belongsTo'](db[_0x7d3a('0x108')],{'foreignKey':_0x7d3a('0x1d6'),'as':_0x7d3a('0x1d7')});db[_0x7d3a('0xfc')][_0x7d3a('0x11a')](db['User'],{'as':'Agents','through':_0x7d3a('0x34'),'foreignKey':_0x7d3a('0x1f2')});db[_0x7d3a('0xfc')][_0x7d3a('0x11a')](db[_0x7d3a('0xd8')],{'through':_0x7d3a('0x1cd'),'as':_0x7d3a('0x153')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x2646=['Recordings','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','MailInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','chat_group_has_users','Contacts','cm_user_has_lists','user_has_teams','user_has_chat_interactions','FaxInteraction','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueue','VoicePrefixes','MailQueue','UserMailQueue','ChatQueues','FaxQueue','FaxQueues','UserFaxQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperHistories','JscriptySessions','Trunk','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','UserVoiceQueue','Teams','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','CmContact','Contact','ContactId','MailAccountId','Answers','MailInteraction','Interactions','MailApplication','List','ListId','Template','Agents','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','user_has_mail_interactions','Attachment','Attachments','ChatWebsiteId','restrict','TagId','MailQueueReport','Items','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','Users','Interaction','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','Dispositions','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','OpenchannelQueueReport','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','AttachmentId','ChatInternalMessage','CompanyId','CmHopperFinal','cm_user_has_contacts','Agent','CampaignId','OwnerId','CmHopperBlack','Condition','All','OneAll','AutomationAllId','Any','OneAny','AutomationId','ParentId','Intervals','SmsApplications','DefaultReportId','CustomReportId','Mohs','cm_contact_has_tags','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','SalesforceAccount','Subject','Description','VariableId','SugarcrmField','Field','DeskConfiguration','int_desk_configuration_has_tags','ZohoConfiguration','ZohoField','int_zendesk_configuration_has_tags','FreshdeskField','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerField','FreshsalesField','JscriptyQuestionReport','SessionId','JscriptyProject','ProjectId','VoiceQueues','MailQueues','team_has_whatsapp_queues','HopperBlacks','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','ChatOfflineMessageId','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','FromAgent','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','UserProfileResource','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','defaultsDeep','motion2','xC@LL1234','127.0.0.1','name','utf8','sequelizeHistory','xcall','utf8mb4','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/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','cascade','UserId','hasMany'];(function(_0x3484e3,_0x246f13){var _0x5b1a72=function(_0x2f4734){while(--_0x2f4734){_0x3484e3['push'](_0x3484e3['shift']());}};_0x5b1a72(++_0x246f13);}(_0x2646,0xee));var _0x6264=function(_0x53f740,_0x1c689c){_0x53f740=_0x53f740-0x0;var _0x50636a=_0x2646[_0x53f740];return _0x50636a;};'use strict';var config=require(_0x6264('0x0'));var Sequelize=require(_0x6264('0x1'));var _=require(_0x6264('0x2'));var jstz=require(_0x6264('0x3'));var timezone=jstz['determine']();config[_0x6264('0x1')]=_[_0x6264('0x4')](config[_0x6264('0x1')],{'database':_0x6264('0x5'),'username':'xcall','password':_0x6264('0x6'),'options':{'host':_0x6264('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x6264('0x8')](),'define':{'charset':_0x6264('0x9'),'collate':'utf8_general_ci'}}});config[_0x6264('0xa')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':'motion2','username':_0x6264('0xb'),'password':_0x6264('0x6'),'options':{'host':_0x6264('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x6264('0xc')},'logging':![],'timezone':timezone[_0x6264('0x8')](),'define':{'charset':_0x6264('0x9'),'collate':_0x6264('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6264('0x1')][_0x6264('0xe')],config[_0x6264('0x1')][_0x6264('0xf')],config['sequelize'][_0x6264('0x10')],config['sequelize'][_0x6264('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x6264('0xe')],config['sequelizeHistory'][_0x6264('0xf')],config[_0x6264('0xa')][_0x6264('0x10')],config[_0x6264('0xa')][_0x6264('0x11')])};db[_0x6264('0x12')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x14'));db[_0x6264('0x15')]=db[_0x6264('0x1')]['import'](_0x6264('0x16'));db[_0x6264('0x17')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x18'));db[_0x6264('0x19')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x1a'));db[_0x6264('0x1b')]=db['sequelize']['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x1c'));db[_0x6264('0x1d')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x1e'));db[_0x6264('0x1f')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x20'));db['VoiceMail']=db[_0x6264('0x1')][_0x6264('0x13')]('../api/voiceMail/voiceMail.model');db[_0x6264('0x21')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x22'));db[_0x6264('0x23')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x24'));db[_0x6264('0x25')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x26'));db[_0x6264('0x27')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x28'));db[_0x6264('0x29')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x2a'));db[_0x6264('0x2b')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x2c'));db['Trunk']=db[_0x6264('0x1')]['import']('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x2d'));db['UserVoiceQueueRt']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x2e'));db['UserVoiceQueue']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x2f'));db[_0x6264('0x30')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x31'));db['UserMailQueue']=db[_0x6264('0x1')]['import'](_0x6264('0x32'));db['UserFaxQueue']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x33'));db[_0x6264('0x34')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x35'));db[_0x6264('0x36')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x37'));db[_0x6264('0x38')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/mailServerIn/mailServerIn.model');db[_0x6264('0x39')]=db['sequelize']['import'](_0x6264('0x3a'));db[_0x6264('0x3b')]=db['sequelize']['import'](_0x6264('0x3c'));db['MailQueue']=db[_0x6264('0x1')]['import'](_0x6264('0x3d'));db[_0x6264('0x3e')]=db[_0x6264('0x1')]['import']('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x6264('0x1')]['import'](_0x6264('0x3f'));db[_0x6264('0x40')]=db['sequelize'][_0x6264('0x13')]('../api/mailMessage/mailMessage.model');db['MailApplication']=db[_0x6264('0x1')][_0x6264('0x13')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db['sequelize'][_0x6264('0x13')](_0x6264('0x41'));db[_0x6264('0x42')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x43'));db[_0x6264('0x44')]=db[_0x6264('0x1')]['import']('../api/dashboardItem/dashboardItem.model');db[_0x6264('0x45')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/faxAccount/faxAccount.model');db[_0x6264('0x46')]=db['sequelize']['import'](_0x6264('0x47'));db['FaxInteraction']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x48'));db[_0x6264('0x49')]=db['sequelize']['import'](_0x6264('0x4a'));db['FaxQueue']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x4b'));db[_0x6264('0x4c')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x4d'));db[_0x6264('0x4e')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x4f'));db[_0x6264('0x50')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x51'));db[_0x6264('0x52')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x53'));db['SmsMessage']=db['sequelize']['import'](_0x6264('0x54'));db[_0x6264('0x55')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/smsQueue/smsQueue.model');db[_0x6264('0x56')]=db['sequelize'][_0x6264('0x13')]('../api/openchannelAccount/openchannelAccount.model');db[_0x6264('0x57')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x58'));db[_0x6264('0x59')]=db['sequelize'][_0x6264('0x13')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x6264('0x5a')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x5b'));db[_0x6264('0x5c')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x5d'));db[_0x6264('0x5e')]=db['sequelize'][_0x6264('0x13')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db['sequelize'][_0x6264('0x13')](_0x6264('0x5f'));db[_0x6264('0x60')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x61'));db[_0x6264('0x62')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x63'));db[_0x6264('0x64')]=db[_0x6264('0x1')]['import']('../api/chatMessage/chatMessage.model');db[_0x6264('0x65')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x6264('0x66')]=db['sequelize']['import'](_0x6264('0x67'));db['ChatGroup']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x68'));db[_0x6264('0x69')]=db[_0x6264('0x1')]['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0x6264('0x6a')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x6b'));db['CmContact']=db[_0x6264('0x1')]['import']('../api/cmContact/cmContact.model');db[_0x6264('0x6c')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x6d'));db['CmHopperBlack']=db['sequelize'][_0x6264('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db[_0x6264('0x1')][_0x6264('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x6264('0x6e')]=db[_0x6264('0x1')]['import'](_0x6264('0x6f'));db['ReportAgentPreview']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x70'));db[_0x6264('0x71')]=db[_0x6264('0x1')]['import'](_0x6264('0x72'));db[_0x6264('0x73')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x74'));db[_0x6264('0x75')]=db['sequelize'][_0x6264('0x13')]('../api/automation/automation.model');db[_0x6264('0x76')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x77'));db[_0x6264('0x78')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x79'));db['Condition']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x7a'));db[_0x6264('0x7b')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x7c'));db[_0x6264('0x7d')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x7e'));db[_0x6264('0x7f')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x6264('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x6264('0x81')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x82'));db['Sound']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x83'));db[_0x6264('0x84')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/tag/tag.model');db['Template']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x85'));db[_0x6264('0x86')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x87'));db[_0x6264('0x88')]=db[_0x6264('0x1')]['import']('../api/variable/variable.model');db[_0x6264('0x89')]=db[_0x6264('0x1')]['import']('../api/integration/integration.model');db[_0x6264('0x8a')]=db[_0x6264('0x1')]['import'](_0x6264('0x8b'));db[_0x6264('0x8c')]=db[_0x6264('0x1')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0x6264('0x8d')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x8e'));db[_0x6264('0x8f')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x90'));db['AnalyticMetric']=db[_0x6264('0x1')]['import'](_0x6264('0x91'));db[_0x6264('0x92')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x93'));db['AnalyticTreeReport']=db[_0x6264('0x1')][_0x6264('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db[_0x6264('0x1')]['import'](_0x6264('0x94'));db[_0x6264('0x95')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x96'));db[_0x6264('0x97')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x98'));db[_0x6264('0x99')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x9a'));db[_0x6264('0x9b')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x9c'));db['SugarcrmField']=db[_0x6264('0x1')][_0x6264('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x6264('0x9d')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x9e'));db['DeskConfiguration']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x9f'));db[_0x6264('0xa0')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xa1'));db[_0x6264('0xa2')]=db[_0x6264('0x1')]['import'](_0x6264('0xa3'));db['ZohoConfiguration']=db['sequelize']['import'](_0x6264('0xa4'));db['ZohoField']=db['sequelize'][_0x6264('0x13')](_0x6264('0xa5'));db[_0x6264('0xa6')]=db['sequelize'][_0x6264('0x13')](_0x6264('0xa7'));db[_0x6264('0xa8')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xa9'));db[_0x6264('0xaa')]=db['sequelize'][_0x6264('0x13')](_0x6264('0xab'));db['FreshdeskAccount']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xac'));db[_0x6264('0xad')]=db[_0x6264('0x1')]['import'](_0x6264('0xae'));db['FreshdeskField']=db[_0x6264('0x1')][_0x6264('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x6264('0x1')]['import'](_0x6264('0xaf'));db[_0x6264('0xb0')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xb1'));db['VtigerField']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xb2'));db[_0x6264('0xb3')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xb4'));db[_0x6264('0xb5')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xb6'));db[_0x6264('0xb7')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xb8'));db[_0x6264('0xb9')]=db['sequelize'][_0x6264('0x13')](_0x6264('0xba'));db[_0x6264('0xbb')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xbc'));db[_0x6264('0xbd')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xbe'));db[_0x6264('0xbf')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x6264('0xc0')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xc1'));db['FreshsalesField']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xc2'));db[_0x6264('0x89')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xc3'));db['Network']=db['sequelize'][_0x6264('0x13')](_0x6264('0xc4'));db[_0x6264('0xc5')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xc6'));db['ChatInternalMessage']=db[_0x6264('0x1')][_0x6264('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x6264('0xc7')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xc8'));db['JscriptyQuestionReport']=db['sequelize'][_0x6264('0x13')](_0x6264('0xc9'));db[_0x6264('0xca')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xcb'));db[_0x6264('0xcc')]=db['sequelize'][_0x6264('0x13')](_0x6264('0xcd'));db['SquareReport']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xce'));db[_0x6264('0xcf')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xd0'));db['JscriptyProject']=db['sequelize']['import'](_0x6264('0xd1'));db[_0x6264('0xd2')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xd3'));db[_0x6264('0xd4')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xd5'));db['SquareProject']=db['sequelize'][_0x6264('0x13')](_0x6264('0xd6'));db[_0x6264('0xd7')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/squareRecording/squareRecording.model');db[_0x6264('0xd8')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/squareMessage/squareMessage.model');db[_0x6264('0xd9')]=db['sequelize'][_0x6264('0x13')](_0x6264('0xda'));db[_0x6264('0xdb')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xdc'));db[_0x6264('0xdd')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xde'));db[_0x6264('0xdf')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xe0'));db['Attachment']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xe1'));db[_0x6264('0xe2')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xe3'));db['MailTransferReport']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xe4'));db[_0x6264('0xe5')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xe6'));db[_0x6264('0xe7')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xe8'));db[_0x6264('0xe9')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db['sequelize']['import'](_0x6264('0xea'));db[_0x6264('0xeb')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xec'));db[_0x6264('0xed')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xee'));db[_0x6264('0xef')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xf0'));db[_0x6264('0xf1')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xf2'));db['UserProfileResource']=db[_0x6264('0x1')]['import'](_0x6264('0xf3'));db['UserNotification']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xf4'));db[_0x6264('0xf5')]=db[_0x6264('0x1')]['import'](_0x6264('0xf6'));db[_0x6264('0xf7')]=db['sequelize'][_0x6264('0x13')](_0x6264('0xf8'));db[_0x6264('0xf9')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x6264('0xfa')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xfb'));db[_0x6264('0xfc')]=db[_0x6264('0x1')]['import'](_0x6264('0xfd'));db['WhatsappTransferReport']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xfe'));db[_0x6264('0xff')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x100'));db[_0x6264('0x101')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x102'));db[_0x6264('0x103')]=db['sequelize']['import'](_0x6264('0x104'));db[_0x6264('0x105')]=db[_0x6264('0x1')]['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x6264('0x106')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x107'));db['User'][_0x6264('0x108')](db[_0x6264('0x109')],{'as':'VoiceMail','onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')][_0x6264('0x10c')](db[_0x6264('0x1d')],{'as':_0x6264('0x10d'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')][_0x6264('0x10c')](db[_0x6264('0x10e')],{'as':_0x6264('0x10f'),'foreignKey':'UserId'});db[_0x6264('0x12')]['hasMany'](db['VoiceExtension'],{'as':_0x6264('0x110'),'onDelete':_0x6264('0x10a'),'hooks':!![]});db['User'][_0x6264('0x10c')](db['CmHopperFinal'],{'as':_0x6264('0x111'),'foreignKey':'UserId'});db['User'][_0x6264('0x10c')](db[_0x6264('0x6e')],{'as':_0x6264('0x112'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')][_0x6264('0x10c')](db[_0x6264('0x113')],{'as':_0x6264('0x113'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')]['hasMany'](db[_0x6264('0x59')],{'as':_0x6264('0x114'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')][_0x6264('0x10c')](db['ChatInteraction'],{'as':_0x6264('0x115'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')][_0x6264('0x10c')](db[_0x6264('0x52')],{'as':_0x6264('0x116'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')]['hasMany'](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')]['hasMany'](db['MailInteraction'],{'as':_0x6264('0x117'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')][_0x6264('0x10c')](db[_0x6264('0xf9')],{'as':'WhatsappInteractions','foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')][_0x6264('0x10c')](db['UserNotification'],{'as':_0x6264('0x118'),'foreignKey':_0x6264('0x119')});db['User'][_0x6264('0x11a')](db['UserProfile'],{'as':_0x6264('0xef'),'foreignKey':_0x6264('0x11b')});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0x11d')],{'as':'Groups','through':_0x6264('0x11e')});db[_0x6264('0x12')][_0x6264('0x11c')](db['CmContact'],{'as':_0x6264('0x11f'),'through':'cm_user_has_contacts'});db['User'][_0x6264('0x11c')](db[_0x6264('0xeb')],{'as':'Lists','through':_0x6264('0x120')});db[_0x6264('0x12')]['belongsToMany'](db[_0x6264('0xd9')],{'through':_0x6264('0x121')});db['User']['belongsToMany'](db['MailInteraction'],{'as':_0x6264('0x117'),'through':'user_has_mail_interactions'});db[_0x6264('0x12')]['belongsToMany'](db['ChatInteraction'],{'as':_0x6264('0x115'),'through':_0x6264('0x122')});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0x123')],{'as':_0x6264('0x124'),'through':_0x6264('0x125')});db[_0x6264('0x12')]['belongsToMany'](db['SmsInteraction'],{'as':_0x6264('0x116'),'through':_0x6264('0x126')});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0x59')],{'as':'OpenchannelInteractions','through':_0x6264('0x127')});db[_0x6264('0x12')][_0x6264('0x11c')](db['WhatsappInteraction'],{'as':_0x6264('0x128'),'through':_0x6264('0x129')});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0x12a')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0x6264('0x12')]['belongsToMany'](db[_0x6264('0xed')],{'as':_0x6264('0x12b'),'through':'UserVoicePrefix','required':![]});db[_0x6264('0x12')]['belongsToMany'](db[_0x6264('0x12c')],{'as':'MailQueues','through':_0x6264('0x12d'),'required':![]});db[_0x6264('0x12')][_0x6264('0x11c')](db['ChatQueue'],{'as':_0x6264('0x12e'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x6264('0x11c')](db[_0x6264('0x12f')],{'as':_0x6264('0x130'),'through':_0x6264('0x131'),'required':![]});db[_0x6264('0x12')]['belongsToMany'](db[_0x6264('0x55')],{'as':'SmsQueues','through':_0x6264('0x34'),'required':![]});db['User']['belongsToMany'](db[_0x6264('0x5c')],{'as':_0x6264('0x132'),'through':_0x6264('0x133'),'required':![]});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0xff')],{'as':_0x6264('0x134'),'through':_0x6264('0x36'),'required':![]});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0xeb')],{'through':_0x6264('0x120')});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0xed')],{'as':_0x6264('0x12b'),'through':'user_has_voice_prefixes','required':![]});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0x5e')],{'as':_0x6264('0x135'),'through':_0x6264('0x136')});db[_0x6264('0x12')][_0x6264('0x11c')](db['FaxAccount'],{'as':_0x6264('0x137'),'through':_0x6264('0x138')});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0x3b')],{'as':'MailAccounts','through':_0x6264('0x139')});db[_0x6264('0x12')]['belongsToMany'](db[_0x6264('0x56')],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db['User']['belongsToMany'](db[_0x6264('0x4e')],{'as':_0x6264('0x13a'),'through':_0x6264('0x13b')});db[_0x6264('0x12')][_0x6264('0x11c')](db['WhatsappAccount'],{'as':_0x6264('0x13c'),'through':_0x6264('0x13d')});db['User'][_0x6264('0x11c')](db[_0x6264('0x13e')],{'as':'SquareProjects','through':_0x6264('0x13f')});db[_0x6264('0x15')]['hasMany'](db[_0x6264('0x19')],{'as':_0x6264('0x140'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x141')});db[_0x6264('0x17')][_0x6264('0x10c')](db[_0x6264('0x19')],{'onDelete':_0x6264('0x10a')});db[_0x6264('0x19')][_0x6264('0x10c')](db[_0x6264('0x19')],{'as':_0x6264('0x142'),'onDelete':_0x6264('0x10a')});db[_0x6264('0x1b')][_0x6264('0x11c')](db[_0x6264('0x143')],{'as':_0x6264('0x144'),'through':_0x6264('0x145')});db[_0x6264('0x12a')][_0x6264('0x10c')](db[_0x6264('0x10e')],{'as':_0x6264('0x146'),'foreignKey':'VoiceQueueId'});db[_0x6264('0x12a')][_0x6264('0x10c')](db[_0x6264('0x6c')],{'as':_0x6264('0x147'),'foreignKey':_0x6264('0x148')});db[_0x6264('0x12a')]['hasMany'](db['CmHopperFinal'],{'as':_0x6264('0x111'),'foreignKey':_0x6264('0x148')});db[_0x6264('0x12a')][_0x6264('0x10c')](db[_0x6264('0x6e')],{'as':_0x6264('0x149'),'foreignKey':_0x6264('0x148')});db[_0x6264('0x12a')]['hasMany'](db[_0x6264('0x113')],{'as':_0x6264('0x113'),'foreignKey':_0x6264('0x148')});db[_0x6264('0x12a')]['hasMany'](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x6264('0x148')});db['VoiceQueue'][_0x6264('0x10c')](db['JscriptySessionReport'],{'as':_0x6264('0x14a'),'foreignKey':_0x6264('0x148')});db[_0x6264('0x12a')][_0x6264('0x11a')](db['Trunk'],{'as':_0x6264('0x14b'),'foreignKey':_0x6264('0x14c')});db['VoiceQueue'][_0x6264('0x11a')](db[_0x6264('0x14b')],{'as':_0x6264('0x14d'),'foreignKey':'TrunkBackupId'});db[_0x6264('0x12a')][_0x6264('0x11a')](db[_0x6264('0x7b')],{'as':_0x6264('0x7b'),'foreignKey':_0x6264('0x14e')});db['VoiceQueue'][_0x6264('0x11a')](db['Pause'],{'as':_0x6264('0x14f'),'foreignKey':_0x6264('0x150')});db['VoiceQueue'][_0x6264('0x11c')](db[_0x6264('0xeb')],{'as':_0x6264('0x151'),'through':_0x6264('0x152')});db[_0x6264('0x12a')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':'Agents','through':_0x6264('0x153')});db[_0x6264('0x12a')][_0x6264('0x11c')](db[_0x6264('0xd9')],{'as':_0x6264('0x154'),'through':_0x6264('0x103')});db['VoiceQueue']['belongsToMany'](db[_0x6264('0xeb')],{'as':'BlackLists','through':_0x6264('0x155')});db[_0x6264('0x1d')][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x12'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x1f')][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x12'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x109')][_0x6264('0x10c')](db['VoiceMailMessage'],{'as':_0x6264('0x156'),'onDelete':'cascade','foreignKey':_0x6264('0x157'),'sourceKey':'mailbox'});db[_0x6264('0x21')][_0x6264('0x11a')](db['VoiceMail'],{'foreignKey':_0x6264('0x157'),'targetKey':_0x6264('0x158')});db['VoiceCallReport'][_0x6264('0x10c')](db[_0x6264('0x29')],{'as':_0x6264('0x159'),'foreignKey':_0x6264('0x15a'),'constraints':![]});db[_0x6264('0x23')]['hasMany'](db[_0x6264('0x27')],{'as':_0x6264('0x15b'),'foreignKey':_0x6264('0x15a'),'constraints':![]});db[_0x6264('0x23')][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x12'),'foreignKey':_0x6264('0x10b')});db['VoiceCallReport'][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x38')][_0x6264('0x11a')](db['MailAccount'],{'as':_0x6264('0x3b'),'foreignKey':_0x6264('0x15f')});db[_0x6264('0x39')]['belongsTo'](db[_0x6264('0x3b')],{'as':_0x6264('0x3b'),'foreignKey':_0x6264('0x15f')});db['MailAccount'][_0x6264('0x108')](db[_0x6264('0x38')],{'as':'Imap','onDelete':_0x6264('0x10a')});db['MailAccount']['hasOne'](db[_0x6264('0x39')],{'as':'Smtp','onDelete':'cascade'});db['MailAccount']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x6264('0x15f'),'onDelete':'cascade'});db[_0x6264('0x3b')][_0x6264('0x10c')](db[_0x6264('0x76')],{'as':_0x6264('0x160'),'foreignKey':_0x6264('0x15f')});db[_0x6264('0x3b')][_0x6264('0x10c')](db[_0x6264('0x40')],{'as':_0x6264('0x156'),'foreignKey':_0x6264('0x15f')});db[_0x6264('0x3b')]['hasMany'](db[_0x6264('0x161')],{'as':_0x6264('0x162')});db[_0x6264('0x3b')][_0x6264('0x10c')](db[_0x6264('0x163')],{'as':_0x6264('0x142')});db[_0x6264('0x3b')]['belongsTo'](db[_0x6264('0xeb')],{'as':_0x6264('0x164'),'foreignKey':_0x6264('0x165')});db[_0x6264('0x3b')][_0x6264('0x11a')](db[_0x6264('0x166')],{'as':_0x6264('0x166'),'foreignKey':'TemplateId'});db[_0x6264('0x3b')]['belongsTo'](db[_0x6264('0x7d')],{'as':_0x6264('0x14f'),'foreignKey':_0x6264('0x150')});db[_0x6264('0x3b')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':_0x6264('0x139')});db['MailQueue'][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':'Agents','through':_0x6264('0x12d')});db[_0x6264('0x12c')][_0x6264('0x11c')](db['Team'],{'through':_0x6264('0x168'),'as':_0x6264('0x154')});db[_0x6264('0x161')][_0x6264('0x10c')](db[_0x6264('0x40')],{'as':_0x6264('0x156'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x169')});db[_0x6264('0x161')][_0x6264('0x11a')](db[_0x6264('0x3b')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x15f')});db[_0x6264('0x161')]['belongsTo'](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x161')][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x16b'),'foreignKey':'UserId'});db['MailInteraction'][_0x6264('0x11c')](db['Tag'],{'through':_0x6264('0x16c'),'as':_0x6264('0x16d')});db[_0x6264('0x161')][_0x6264('0x11c')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x6264('0x16e')});db[_0x6264('0x161')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':'Users','through':_0x6264('0x16f'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x6264('0x10c')](db[_0x6264('0x170')],{'as':_0x6264('0x171'),'onDelete':_0x6264('0x10a')});db['MailMessage'][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x12')});db[_0x6264('0x40')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x15d')});db[_0x6264('0x40')][_0x6264('0x11a')](db[_0x6264('0x161')],{'as':'Interaction','foreignKey':_0x6264('0x169')});db['MailMessage'][_0x6264('0x11a')](db['MailAccount'],{'as':'Account','foreignKey':_0x6264('0x15f')});db['MailMessage'][_0x6264('0x11a')](db[_0x6264('0x5e')],{'as':_0x6264('0x5e'),'foreignKey':_0x6264('0x172')});db['MailMessage'][_0x6264('0x11a')](db['ChatOfflineMessage'],{'as':_0x6264('0x65'),'foreignKey':'ChatOfflineMessageId'});db[_0x6264('0x163')][_0x6264('0x11a')](db[_0x6264('0x12')],{'onDelete':_0x6264('0x173')});db[_0x6264('0x163')]['belongsTo'](db[_0x6264('0x12c')],{'onDelete':_0x6264('0x173')});db[_0x6264('0x163')][_0x6264('0x11a')](db[_0x6264('0x3b')],{'onDelete':_0x6264('0x173')});db[_0x6264('0x163')][_0x6264('0x11a')](db['Interval'],{'onDelete':_0x6264('0x173'),'foreignKey':_0x6264('0x14e')});db[_0x6264('0x163')]['belongsTo'](db[_0x6264('0x84')],{'onDelete':'restrict','foreignKey':_0x6264('0x174')});db[_0x6264('0x175')][_0x6264('0x11a')](db['MailAccount'],{});db[_0x6264('0x175')][_0x6264('0x11a')](db['CmList'],{'as':'List','foreignKey':_0x6264('0x165')});db[_0x6264('0x175')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x175')][_0x6264('0x11a')](db['MailInteraction'],{});db[_0x6264('0x175')][_0x6264('0x11a')](db[_0x6264('0x40')],{});db['MailQueueReport'][_0x6264('0x11a')](db[_0x6264('0x12')],{});db[_0x6264('0x175')][_0x6264('0x11a')](db[_0x6264('0x12c')],{});db[_0x6264('0x42')][_0x6264('0x10c')](db['DashboardItem'],{'as':_0x6264('0x176'),'onDelete':_0x6264('0x10a')});db[_0x6264('0x45')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x6264('0x177'),'onDelete':_0x6264('0x10a')});db['FaxAccount'][_0x6264('0x10c')](db['CannedAnswer'],{'as':_0x6264('0x160'),'foreignKey':_0x6264('0x177')});db['FaxAccount'][_0x6264('0x10c')](db['FaxInteraction'],{'as':_0x6264('0x162')});db['FaxAccount'][_0x6264('0x10c')](db[_0x6264('0x46')],{'as':_0x6264('0x142')});db[_0x6264('0x45')][_0x6264('0x10c')](db[_0x6264('0x19')],{'as':_0x6264('0x178'),'onDelete':_0x6264('0x10a')});db[_0x6264('0x45')][_0x6264('0x10c')](db[_0x6264('0x49')],{'as':_0x6264('0x156')});db[_0x6264('0x45')][_0x6264('0x11a')](db['Trunk'],{'as':'Trunk'});db[_0x6264('0x45')][_0x6264('0x11a')](db[_0x6264('0xeb')],{'as':_0x6264('0x164'),'foreignKey':_0x6264('0x165')});db['FaxAccount']['belongsTo'](db[_0x6264('0x7d')],{'as':_0x6264('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6264('0x45')]['belongsToMany'](db['User'],{'as':_0x6264('0x167'),'through':'user_has_fax_accounts'});db[_0x6264('0x46')]['belongsTo'](db[_0x6264('0x12')],{'onDelete':_0x6264('0x173')});db[_0x6264('0x46')]['belongsTo'](db[_0x6264('0x12f')],{'onDelete':_0x6264('0x173')});db[_0x6264('0x46')][_0x6264('0x11a')](db[_0x6264('0x45')],{'onDelete':_0x6264('0x173')});db[_0x6264('0x46')][_0x6264('0x11a')](db[_0x6264('0x84')],{'onDelete':_0x6264('0x173'),'foreignKey':_0x6264('0x174')});db[_0x6264('0x123')]['hasMany'](db[_0x6264('0x49')],{'as':_0x6264('0x156'),'onDelete':'cascade','foreignKey':_0x6264('0x179')});db['FaxInteraction'][_0x6264('0x11a')](db[_0x6264('0x45')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x177')});db['FaxInteraction'][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x123')][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x16b'),'foreignKey':'UserId'});db['FaxInteraction'][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':_0x6264('0x17a'),'as':'Tags'});db[_0x6264('0x123')][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':'fax_interaction_has_tags','as':_0x6264('0x16e')});db[_0x6264('0x123')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x17b'),'through':'user_has_fax_interactions','foreignKey':_0x6264('0x179')});db['FaxMessage'][_0x6264('0x11a')](db['User'],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x12')});db['FaxMessage'][_0x6264('0x11a')](db[_0x6264('0x123')],{'as':_0x6264('0x17c'),'foreignKey':_0x6264('0x179')});db['FaxMessage'][_0x6264('0x11a')](db[_0x6264('0x15c')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x15d')});db['FaxMessage'][_0x6264('0x11a')](db[_0x6264('0x170')],{'as':_0x6264('0x170'),'foreignKey':'AttachmentId'});db[_0x6264('0x49')][_0x6264('0x11a')](db[_0x6264('0x45')],{'as':'Account','foreignKey':_0x6264('0x177')});db[_0x6264('0x12f')]['belongsToMany'](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':_0x6264('0x131')});db[_0x6264('0x12f')][_0x6264('0x11c')](db[_0x6264('0xd9')],{'through':'team_has_fax_queues','as':_0x6264('0x154')});db[_0x6264('0x4c')][_0x6264('0x11a')](db[_0x6264('0x45')],{});db[_0x6264('0x4c')][_0x6264('0x11a')](db['CmList'],{'as':_0x6264('0x164'),'foreignKey':_0x6264('0x165')});db[_0x6264('0x4c')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':'ContactId'});db['FaxQueueReport']['belongsTo'](db['FaxInteraction'],{});db['FaxQueueReport'][_0x6264('0x11a')](db[_0x6264('0x49')],{});db['FaxQueueReport']['belongsTo'](db[_0x6264('0x12')],{});db[_0x6264('0x4c')][_0x6264('0x11a')](db[_0x6264('0x12f')],{});db['SmsAccount'][_0x6264('0x10c')](db[_0x6264('0x78')],{'as':'Dispositions','foreignKey':_0x6264('0x17d'),'onDelete':'cascade'});db['SmsAccount'][_0x6264('0x10c')](db['CannedAnswer'],{'as':_0x6264('0x160'),'foreignKey':_0x6264('0x17d')});db[_0x6264('0x4e')][_0x6264('0x10c')](db[_0x6264('0x17e')],{'as':'Messages','foreignKey':_0x6264('0x17d')});db[_0x6264('0x4e')]['hasMany'](db[_0x6264('0x52')],{'as':_0x6264('0x162')});db[_0x6264('0x4e')][_0x6264('0x10c')](db[_0x6264('0x50')],{'as':_0x6264('0x142')});db[_0x6264('0x4e')][_0x6264('0x11a')](db[_0x6264('0xeb')],{'as':_0x6264('0x164'),'foreignKey':_0x6264('0x165')});db[_0x6264('0x4e')][_0x6264('0x11a')](db[_0x6264('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x6264('0x150')});db[_0x6264('0x4e')]['belongsToMany'](db['User'],{'as':_0x6264('0x167'),'through':'user_has_sms_accounts'});db['SmsApplication'][_0x6264('0x11a')](db['User'],{'onDelete':_0x6264('0x173')});db[_0x6264('0x50')][_0x6264('0x11a')](db[_0x6264('0x55')],{'onDelete':'restrict'});db[_0x6264('0x50')]['belongsTo'](db[_0x6264('0x4e')],{'onDelete':_0x6264('0x173')});db[_0x6264('0x50')][_0x6264('0x11a')](db[_0x6264('0x7b')],{'onDelete':_0x6264('0x173'),'foreignKey':'IntervalId'});db['SmsApplication'][_0x6264('0x11a')](db['Tag'],{'onDelete':_0x6264('0x173'),'foreignKey':'TagId'});db[_0x6264('0x52')][_0x6264('0x10c')](db['SmsMessage'],{'as':_0x6264('0x156'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x17f')});db[_0x6264('0x52')][_0x6264('0x11a')](db[_0x6264('0x4e')],{'as':'Account','foreignKey':_0x6264('0x17d')});db[_0x6264('0x52')][_0x6264('0x11a')](db['CmContact'],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x52')][_0x6264('0x11a')](db['User'],{'as':_0x6264('0x16b'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x52')][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':_0x6264('0x180'),'as':'Tags'});db[_0x6264('0x52')][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':'sms_interaction_has_tags','as':_0x6264('0x16e')});db[_0x6264('0x52')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x17b'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db[_0x6264('0x17e')]['belongsTo'](db['User'],{'as':_0x6264('0x12')});db['SmsMessage'][_0x6264('0x11a')](db['CmContact'],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x15d')});db[_0x6264('0x17e')][_0x6264('0x11a')](db[_0x6264('0x52')],{'onDelete':'cascade','as':_0x6264('0x17c'),'foreignKey':'SmsInteractionId'});db[_0x6264('0x17e')][_0x6264('0x11a')](db[_0x6264('0x4e')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x17d')});db[_0x6264('0x55')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':_0x6264('0x34'),'foreignKey':'SmsQueueId'});db[_0x6264('0x55')][_0x6264('0x11c')](db[_0x6264('0xd9')],{'through':_0x6264('0x181'),'as':_0x6264('0x154')});db[_0x6264('0x56')][_0x6264('0x10c')](db[_0x6264('0x78')],{'as':_0x6264('0x182'),'foreignKey':_0x6264('0x183'),'onDelete':'cascade'});db[_0x6264('0x56')][_0x6264('0x10c')](db[_0x6264('0x76')],{'as':_0x6264('0x160'),'foreignKey':_0x6264('0x183')});db[_0x6264('0x56')][_0x6264('0x10c')](db['OpenchannelInteraction'],{'as':_0x6264('0x162'),'foreignKey':_0x6264('0x183')});db['OpenchannelAccount']['hasMany'](db['OpenchannelMessage'],{'as':_0x6264('0x156'),'foreignKey':'OpenchannelAccountId'});db[_0x6264('0x56')]['hasMany'](db['OpenchannelApplication'],{'as':_0x6264('0x142'),'foreignKey':_0x6264('0x183')});db[_0x6264('0x56')][_0x6264('0x11a')](db[_0x6264('0xeb')],{'as':'List','foreignKey':_0x6264('0x165')});db[_0x6264('0x56')][_0x6264('0x11a')](db[_0x6264('0x7d')],{'as':_0x6264('0x14f'),'foreignKey':_0x6264('0x150')});db[_0x6264('0x56')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':'Agents','through':_0x6264('0x184')});db[_0x6264('0x57')]['belongsTo'](db[_0x6264('0x12')],{'onDelete':_0x6264('0x173')});db[_0x6264('0x57')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0x6264('0x173'),'foreignKey':'OpenchannelQueueId'});db[_0x6264('0x57')][_0x6264('0x11a')](db[_0x6264('0x56')],{'onDelete':_0x6264('0x173'),'foreignKey':_0x6264('0x183')});db[_0x6264('0x57')][_0x6264('0x11a')](db[_0x6264('0x7b')],{'onDelete':_0x6264('0x173'),'foreignKey':'IntervalId'});db['OpenchannelApplication']['belongsTo'](db[_0x6264('0x84')],{'onDelete':_0x6264('0x173'),'foreignKey':_0x6264('0x174')});db[_0x6264('0x59')][_0x6264('0x10c')](db[_0x6264('0x5a')],{'as':_0x6264('0x156'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x185')});db[_0x6264('0x59')]['belongsTo'](db[_0x6264('0x56')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x183')});db[_0x6264('0x59')]['belongsTo'](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':'ContactId'});db[_0x6264('0x59')]['belongsTo'](db['User'],{'as':_0x6264('0x16b'),'foreignKey':'UserId'});db[_0x6264('0x59')][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':_0x6264('0x186'),'as':_0x6264('0x16d')});db['OpenchannelInteraction']['belongsToMany'](db['Tag'],{'through':_0x6264('0x186'),'as':'ThroughTags'});db[_0x6264('0x59')]['belongsToMany'](db[_0x6264('0x12')],{'as':'Users','through':_0x6264('0x127'),'foreignKey':_0x6264('0x185')});db[_0x6264('0x5a')]['belongsTo'](db[_0x6264('0x12')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x12')});db['OpenchannelMessage'][_0x6264('0x11a')](db[_0x6264('0x15c')],{'onDelete':'cascade','as':_0x6264('0x15d')});db[_0x6264('0x5a')][_0x6264('0x11a')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x6264('0x17c'),'foreignKey':_0x6264('0x185')});db['OpenchannelMessage'][_0x6264('0x11a')](db[_0x6264('0x170')],{'as':_0x6264('0x170'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x6264('0x11a')](db[_0x6264('0x56')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x183')});db['OpenchannelQueue']['belongsToMany'](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':'UserOpenchannelQueue','foreignKey':_0x6264('0x187')});db[_0x6264('0x5c')][_0x6264('0x11c')](db[_0x6264('0xd9')],{'through':_0x6264('0x188'),'as':'Teams'});db['ChatWebsite']['hasMany'](db['Disposition'],{'as':_0x6264('0x182'),'foreignKey':_0x6264('0x172'),'onDelete':'cascade'});db[_0x6264('0x5e')]['hasMany'](db[_0x6264('0x76')],{'as':'Answers','foreignKey':_0x6264('0x172')});db['ChatWebsite'][_0x6264('0x10c')](db[_0x6264('0x69')],{'as':_0x6264('0x189')});db['ChatWebsite'][_0x6264('0x10c')](db[_0x6264('0x62')],{'as':_0x6264('0x162')});db['ChatWebsite']['hasMany'](db[_0x6264('0x60')],{'as':_0x6264('0x142')});db[_0x6264('0x5e')]['hasMany'](db['ChatMessage'],{'as':_0x6264('0x156')});db[_0x6264('0x5e')]['belongsTo'](db[_0x6264('0xeb')],{'as':_0x6264('0x164'),'foreignKey':_0x6264('0x165')});db[_0x6264('0x5e')][_0x6264('0x11a')](db['Interval'],{'as':_0x6264('0x7b'),'foreignKey':_0x6264('0x14e')});db[_0x6264('0x5e')][_0x6264('0x11a')](db['MailAccount'],{'as':_0x6264('0x3b'),'foreignKey':_0x6264('0x15f')});db[_0x6264('0x5e')][_0x6264('0x11a')](db[_0x6264('0x7d')],{'as':_0x6264('0x14f'),'foreignKey':_0x6264('0x150')});db[_0x6264('0x5e')]['belongsToMany'](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':_0x6264('0x136')});db['OpenchannelQueueReport'][_0x6264('0x11a')](db[_0x6264('0x56')],{});db[_0x6264('0x18a')]['belongsTo'](db[_0x6264('0xeb')],{'as':'List','foreignKey':'ListId'});db['OpenchannelQueueReport'][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x18a')][_0x6264('0x11a')](db[_0x6264('0x59')],{});db[_0x6264('0x18a')][_0x6264('0x11a')](db[_0x6264('0x5a')],{});db[_0x6264('0x18a')][_0x6264('0x11a')](db[_0x6264('0x12')],{});db[_0x6264('0x18a')][_0x6264('0x11a')](db[_0x6264('0x5c')],{});db[_0x6264('0x60')][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':'Agent','foreignKey':_0x6264('0x10b'),'onDelete':_0x6264('0x173')});db[_0x6264('0x60')][_0x6264('0x11a')](db[_0x6264('0x66')],{'as':_0x6264('0x18b'),'foreignKey':_0x6264('0x18c'),'onDelete':_0x6264('0x173')});db[_0x6264('0x60')][_0x6264('0x11a')](db['ChatWebsite'],{'as':_0x6264('0x18d'),'foreignKey':_0x6264('0x172'),'onDelete':_0x6264('0x173')});db[_0x6264('0x60')][_0x6264('0x11a')](db[_0x6264('0x84')],{'onDelete':_0x6264('0x173'),'foreignKey':'TagId'});db[_0x6264('0x62')][_0x6264('0x10c')](db[_0x6264('0x64')],{'as':_0x6264('0x156'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x18e')});db[_0x6264('0x62')][_0x6264('0x11a')](db[_0x6264('0x5e')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x172')});db[_0x6264('0x62')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x62')][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x16b'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x62')][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':'chat_interaction_has_tags','as':_0x6264('0x16d')});db['ChatInteraction'][_0x6264('0x11c')](db['Tag'],{'through':_0x6264('0x18f'),'as':_0x6264('0x16e')});db[_0x6264('0x62')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x17b'),'through':_0x6264('0x122'),'foreignKey':_0x6264('0x18e')});db[_0x6264('0x64')]['belongsTo'](db[_0x6264('0x12')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x12')});db[_0x6264('0x64')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db['ChatMessage'][_0x6264('0x11a')](db[_0x6264('0x62')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x17c'),'foreignKey':'ChatInteractionId'});db[_0x6264('0x64')][_0x6264('0x11a')](db[_0x6264('0x170')],{'as':'Attachment','foreignKey':_0x6264('0x190')});db[_0x6264('0x64')]['belongsTo'](db[_0x6264('0x5e')],{'as':_0x6264('0x16a'),'foreignKey':'ChatWebsiteId'});db[_0x6264('0x65')][_0x6264('0x10c')](db[_0x6264('0x170')],{'as':_0x6264('0x171'),'foreignKey':'ChatOfflineMessageId','onDelete':'cascade','hooks':!![]});db[_0x6264('0x65')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x15d'),'foreignKey':'ContactId'});db[_0x6264('0x65')]['belongsTo'](db[_0x6264('0x5e')],{'as':'Account','foreignKey':_0x6264('0x172')});db[_0x6264('0x66')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':_0x6264('0x30'),'hooks':!![]});db[_0x6264('0x66')][_0x6264('0x11c')](db[_0x6264('0xd9')],{'through':'team_has_chat_queues','as':'Teams'});db[_0x6264('0x11d')][_0x6264('0x10c')](db[_0x6264('0x191')],{'as':_0x6264('0x156'),'foreignKey':'ChatGroupId','onDelete':_0x6264('0x10a')});db[_0x6264('0x11d')]['belongsToMany'](db[_0x6264('0x12')],{'as':_0x6264('0x146'),'through':_0x6264('0x11e')});db[_0x6264('0x69')][_0x6264('0x11a')](db[_0x6264('0x5e')],{'as':'Website','foreignKey':_0x6264('0x172')});db['CmCompany'][_0x6264('0x10c')](db[_0x6264('0x15c')],{'as':_0x6264('0x11f'),'foreignKey':_0x6264('0x192')});db[_0x6264('0x15c')][_0x6264('0x10c')](db[_0x6264('0x6c')],{'as':'Hoppers','foreignKey':_0x6264('0x15e')});db[_0x6264('0x15c')][_0x6264('0x10c')](db[_0x6264('0x193')],{'as':_0x6264('0x111'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x15c')][_0x6264('0x10c')](db[_0x6264('0x6e')],{'as':_0x6264('0x149'),'foreignKey':'ContactId'});db[_0x6264('0x15c')]['hasMany'](db[_0x6264('0x113')],{'as':_0x6264('0x113'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x15c')][_0x6264('0x10c')](db[_0x6264('0xca')],{'as':_0x6264('0x14a'),'foreignKey':'ContactId'});db[_0x6264('0x15c')][_0x6264('0x10c')](db[_0x6264('0x59')],{'as':_0x6264('0x114'),'foreignKey':_0x6264('0x15e'),'onDelete':_0x6264('0x173')});db[_0x6264('0x15c')][_0x6264('0x10c')](db[_0x6264('0x62')],{'as':_0x6264('0x115'),'foreignKey':_0x6264('0x15e'),'onDelete':'restrict'});db['CmContact'][_0x6264('0x10c')](db[_0x6264('0x52')],{'as':_0x6264('0x116'),'foreignKey':_0x6264('0x15e'),'onDelete':'restrict'});db[_0x6264('0x15c')]['hasMany'](db[_0x6264('0x123')],{'as':_0x6264('0x124'),'foreignKey':_0x6264('0x15e'),'onDelete':_0x6264('0x173')});db[_0x6264('0x15c')][_0x6264('0x10c')](db['MailInteraction'],{'as':_0x6264('0x117'),'foreignKey':_0x6264('0x15e'),'onDelete':'restrict'});db[_0x6264('0x15c')]['belongsTo'](db[_0x6264('0x6a')],{'as':'Company','foreignKey':_0x6264('0x192')});db[_0x6264('0x15c')][_0x6264('0x11a')](db['CmList'],{'as':_0x6264('0x164'),'foreignKey':_0x6264('0x165'),'onDelete':'cascade'});db[_0x6264('0x15c')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x17b'),'through':_0x6264('0x194')});db[_0x6264('0x15c')][_0x6264('0x11c')](db[_0x6264('0x84')],{'as':_0x6264('0x16d'),'through':'cm_contact_has_tags'});db[_0x6264('0x15c')][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':'cm_contact_has_tags','as':_0x6264('0x16e')});db[_0x6264('0x6c')][_0x6264('0x11a')](db['CmContact'],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e'),'onDelete':'cascade'});db[_0x6264('0x6c')][_0x6264('0x11a')](db[_0x6264('0xeb')],{'as':_0x6264('0x164'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x6264('0x6c')][_0x6264('0x11a')](db['User'],{'as':_0x6264('0x195'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x6c')][_0x6264('0x11a')](db[_0x6264('0x12a')],{'as':_0x6264('0x18b'),'foreignKey':'VoiceQueueId','onDelete':_0x6264('0x10a')});db[_0x6264('0x6c')][_0x6264('0x11a')](db['Campaign'],{'as':_0x6264('0xdd'),'foreignKey':_0x6264('0x196'),'onDelete':_0x6264('0x10a')});db['CmHopper'][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x16b'),'foreignKey':_0x6264('0x197')});db[_0x6264('0x198')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':'Contact','foreignKey':_0x6264('0x15e'),'onDelete':_0x6264('0x10a')});db[_0x6264('0x198')][_0x6264('0x11a')](db[_0x6264('0xeb')],{'as':_0x6264('0x164'),'foreignKey':'ListId','onDelete':_0x6264('0x10a')});db[_0x6264('0x198')]['belongsTo'](db['VoiceQueue'],{'as':_0x6264('0x18b'),'foreignKey':_0x6264('0x148'),'onDelete':_0x6264('0x10a')});db[_0x6264('0x198')]['belongsTo'](db['Campaign'],{'as':_0x6264('0xdd'),'foreignKey':_0x6264('0x196'),'onDelete':_0x6264('0x10a')});db[_0x6264('0x75')][_0x6264('0x10c')](db[_0x6264('0x199')],{'as':{'plural':_0x6264('0x19a'),'singular':_0x6264('0x19b')},'foreignKey':_0x6264('0x19c'),'onDelete':'cascade','hooks':!![]});db[_0x6264('0x75')][_0x6264('0x10c')](db['Condition'],{'as':{'plural':_0x6264('0x19d'),'singular':_0x6264('0x19e')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x6264('0x75')][_0x6264('0x10c')](db['Action'],{'as':'Actions','foreignKey':_0x6264('0x19f'),'onDelete':'cascade','hooks':!![]});db['Disposition'][_0x6264('0x10c')](db[_0x6264('0x78')],{'as':'Dispositions','foreignKey':_0x6264('0x1a0'),'onDelete':_0x6264('0x10a')});db['Interval'][_0x6264('0x10c')](db[_0x6264('0x7b')],{'as':_0x6264('0x1a1'),'foreignKey':_0x6264('0x14e'),'onDelete':_0x6264('0x10a'),'hooks':!![],'required':![]});db[_0x6264('0x7b')][_0x6264('0x10c')](db['VoiceExtension'],{'as':_0x6264('0x110'),'foreignKey':_0x6264('0x14e'),'onDelete':_0x6264('0x173')});db[_0x6264('0x7b')][_0x6264('0x10c')](db[_0x6264('0x163')],{'as':'MailApplications','foreignKey':_0x6264('0x14e')});db[_0x6264('0x7b')][_0x6264('0x10c')](db[_0x6264('0x60')],{'as':'ChatApplications','foreignKey':_0x6264('0x14e')});db[_0x6264('0x7b')][_0x6264('0x10c')](db[_0x6264('0x46')],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0x6264('0x7b')][_0x6264('0x10c')](db['SmsApplication'],{'as':_0x6264('0x1a2'),'foreignKey':'IntervalId'});db[_0x6264('0x81')][_0x6264('0x11a')](db[_0x6264('0x3b')],{});db['Schedule'][_0x6264('0x11a')](db[_0x6264('0x8d')],{'foreignKey':_0x6264('0x1a3')});db[_0x6264('0x81')][_0x6264('0x11a')](db[_0x6264('0x8c')],{'foreignKey':_0x6264('0x1a4')});db['Sound'][_0x6264('0x11c')](db['VoiceMusicOnHold'],{'as':_0x6264('0x1a5'),'through':_0x6264('0x145'),'onDelete':_0x6264('0x173')});db[_0x6264('0x84')][_0x6264('0x11c')](db[_0x6264('0x15c')],{'through':_0x6264('0x1a6')});db['Tag'][_0x6264('0x11c')](db[_0x6264('0x62')],{'through':_0x6264('0x18f')});db[_0x6264('0x84')]['belongsToMany'](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x6264('0x84')][_0x6264('0x11c')](db[_0x6264('0x52')],{'through':'sms_interaction_has_tags'});db[_0x6264('0x84')]['belongsToMany'](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x6264('0x84')][_0x6264('0x11c')](db[_0x6264('0x59')],{'through':_0x6264('0x186')});db[_0x6264('0x84')]['belongsToMany'](db[_0x6264('0xf9')],{'through':_0x6264('0x1a7')});db[_0x6264('0x86')][_0x6264('0x10c')](db[_0x6264('0x199')],{'as':{'plural':'AllConditions','singular':_0x6264('0x1a8')},'foreignKey':_0x6264('0x1a9'),'onDelete':'cascade','hooks':!![]});db[_0x6264('0x86')][_0x6264('0x10c')](db['Condition'],{'as':{'plural':_0x6264('0x1aa'),'singular':_0x6264('0x1ab')},'foreignKey':_0x6264('0x1ac'),'onDelete':_0x6264('0x10a'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x6264('0x73')],{'as':_0x6264('0x1ad'),'foreignKey':_0x6264('0x1ae'),'onDelete':_0x6264('0x10a'),'hooks':!![]});db[_0x6264('0x8c')][_0x6264('0x10c')](db[_0x6264('0x92')],{'as':_0x6264('0x1af'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1a4'),'hooks':!![]});db[_0x6264('0x8d')][_0x6264('0x10c')](db[_0x6264('0x92')],{'as':'Fields','onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x6264('0x1b0')][_0x6264('0x10c')](db['AnalyticFieldReport'],{'as':_0x6264('0x1af'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b1')});db[_0x6264('0x92')][_0x6264('0x11a')](db[_0x6264('0x1b0')],{'foreignKey':_0x6264('0x1b1')});db['SalesforceAccount'][_0x6264('0x10c')](db[_0x6264('0x95')],{'as':_0x6264('0x1b2'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b3')});db[_0x6264('0x95')][_0x6264('0x10c')](db['SalesforceField'],{'as':_0x6264('0x1b4'),'onDelete':'cascade','foreignKey':_0x6264('0x1b5')});db['SalesforceConfiguration'][_0x6264('0x10c')](db[_0x6264('0x97')],{'as':_0x6264('0x1b6'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0x95')][_0x6264('0x10c')](db['SalesforceField'],{'as':_0x6264('0x1af'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0x95')][_0x6264('0x11a')](db[_0x6264('0x1b9')],{'as':'Account','foreignKey':_0x6264('0x1b3')});db[_0x6264('0x97')][_0x6264('0x10c')](db[_0x6264('0x97')],{'as':_0x6264('0x1ba'),'foreignKey':'SubjectId'});db[_0x6264('0x97')]['hasMany'](db[_0x6264('0x97')],{'as':_0x6264('0x1bb'),'foreignKey':'DescriptionId'});db['SalesforceField']['hasMany'](db[_0x6264('0x97')],{'as':'Field','foreignKey':'FieldId'});db[_0x6264('0x97')]['belongsTo'](db[_0x6264('0x88')],{'as':_0x6264('0x88'),'foreignKey':_0x6264('0x1bc')});db[_0x6264('0x99')][_0x6264('0x10c')](db[_0x6264('0x9b')],{'as':_0x6264('0x1b2'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b3')});db[_0x6264('0x9b')][_0x6264('0x10c')](db['SugarcrmField'],{'as':_0x6264('0x1b4'),'onDelete':'cascade','foreignKey':_0x6264('0x1b5')});db['SugarcrmConfiguration']['hasMany'](db[_0x6264('0x1bd')],{'as':_0x6264('0x1b6'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0x9b')][_0x6264('0x10c')](db[_0x6264('0x1bd')],{'as':_0x6264('0x1af'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0x9b')]['belongsTo'](db[_0x6264('0x99')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x1b3')});db[_0x6264('0x1bd')][_0x6264('0x10c')](db['SugarcrmField'],{'as':_0x6264('0x1ba'),'foreignKey':'SubjectId'});db[_0x6264('0x1bd')]['hasMany'](db[_0x6264('0x1bd')],{'as':_0x6264('0x1bb'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0x1bd')][_0x6264('0x10c')](db['SugarcrmField'],{'as':_0x6264('0x1be'),'foreignKey':_0x6264('0x1b8')});db['SugarcrmField']['belongsTo'](db[_0x6264('0x88')],{'as':'Variable','foreignKey':'VariableId'});db[_0x6264('0x9d')][_0x6264('0x10c')](db['DeskConfiguration'],{'as':_0x6264('0x1b2'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b3')});db[_0x6264('0x1bf')][_0x6264('0x10c')](db[_0x6264('0xa0')],{'as':_0x6264('0x1b4'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b5')});db[_0x6264('0x1bf')][_0x6264('0x10c')](db[_0x6264('0xa0')],{'as':_0x6264('0x1b6'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['DeskConfiguration'][_0x6264('0x10c')](db[_0x6264('0xa0')],{'as':_0x6264('0x1af'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0x1bf')][_0x6264('0x11a')](db[_0x6264('0x9d')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x1b3')});db['DeskConfiguration']['belongsToMany'](db[_0x6264('0x84')],{'through':_0x6264('0x1c0')});db[_0x6264('0xa0')]['hasMany'](db[_0x6264('0xa0')],{'as':_0x6264('0x1ba'),'foreignKey':_0x6264('0x1b5')});db['DeskField']['hasMany'](db[_0x6264('0xa0')],{'as':'Description','foreignKey':_0x6264('0x1b7')});db['DeskField']['hasMany'](db[_0x6264('0xa0')],{'as':_0x6264('0x1be'),'foreignKey':'FieldId'});db['DeskField'][_0x6264('0x11a')](db[_0x6264('0x88')],{'as':'Variable','foreignKey':_0x6264('0x1bc')});db[_0x6264('0xa2')][_0x6264('0x10c')](db[_0x6264('0x1c1')],{'as':'Configurations','onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b3')});db[_0x6264('0x1c1')][_0x6264('0x10c')](db[_0x6264('0x1c2')],{'as':'Subjects','onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b5')});db[_0x6264('0x1c1')][_0x6264('0x10c')](db[_0x6264('0x1c2')],{'as':_0x6264('0x1b6'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0x1c1')][_0x6264('0x10c')](db[_0x6264('0x1c2')],{'as':'Fields','onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b8')});db['ZohoConfiguration']['belongsTo'](db[_0x6264('0xa2')],{'as':'Account','foreignKey':'AccountId'});db[_0x6264('0x1c2')][_0x6264('0x10c')](db[_0x6264('0x1c2')],{'as':_0x6264('0x1ba'),'foreignKey':_0x6264('0x1b5')});db[_0x6264('0x1c2')][_0x6264('0x10c')](db[_0x6264('0x1c2')],{'as':'Description','foreignKey':_0x6264('0x1b7')});db[_0x6264('0x1c2')]['hasMany'](db[_0x6264('0x1c2')],{'as':_0x6264('0x1be'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0x1c2')][_0x6264('0x11a')](db[_0x6264('0x88')],{'as':_0x6264('0x88'),'foreignKey':'VariableId'});db[_0x6264('0xa6')][_0x6264('0x10c')](db[_0x6264('0xa8')],{'as':_0x6264('0x1b2'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b3')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x6264('0x1b4'),'foreignKey':'SubjectId'});db[_0x6264('0xa8')][_0x6264('0x10c')](db['ZendeskField'],{'as':_0x6264('0x1b6'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0xa8')][_0x6264('0x10c')](db['ZendeskField'],{'as':_0x6264('0x1af'),'foreignKey':'FieldId'});db[_0x6264('0xa8')][_0x6264('0x11a')](db[_0x6264('0xa6')],{'as':_0x6264('0x16a'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':_0x6264('0x1c3')});db[_0x6264('0xaa')]['hasMany'](db[_0x6264('0xaa')],{'as':_0x6264('0x1ba'),'foreignKey':'SubjectId'});db[_0x6264('0xaa')][_0x6264('0x10c')](db[_0x6264('0xaa')],{'as':'Description','foreignKey':_0x6264('0x1b7')});db[_0x6264('0xaa')][_0x6264('0x10c')](db[_0x6264('0xaa')],{'as':_0x6264('0x1be'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0xaa')][_0x6264('0x11a')](db[_0x6264('0x88')],{'as':'Variable','foreignKey':_0x6264('0x1bc')});db['FreshdeskAccount']['hasMany'](db['FreshdeskConfiguration'],{'as':_0x6264('0x1b2'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b3')});db[_0x6264('0xad')]['hasMany'](db['FreshdeskField'],{'as':_0x6264('0x1b4'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b5')});db[_0x6264('0xad')][_0x6264('0x10c')](db[_0x6264('0x1c4')],{'as':_0x6264('0x1b6'),'onDelete':_0x6264('0x10a'),'foreignKey':'DescriptionId'});db[_0x6264('0xad')][_0x6264('0x10c')](db[_0x6264('0x1c4')],{'as':_0x6264('0x1af'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0xad')]['belongsTo'](db[_0x6264('0x1c5')],{'as':_0x6264('0x16a'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':_0x6264('0x1c6')});db['FreshdeskField'][_0x6264('0x10c')](db[_0x6264('0x1c4')],{'as':_0x6264('0x1ba'),'foreignKey':_0x6264('0x1b5')});db[_0x6264('0x1c4')][_0x6264('0x10c')](db['FreshdeskField'],{'as':_0x6264('0x1bb'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0x1c4')]['hasMany'](db[_0x6264('0x1c4')],{'as':_0x6264('0x1be'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0x1c4')][_0x6264('0x11a')](db[_0x6264('0x88')],{'as':_0x6264('0x88'),'foreignKey':_0x6264('0x1bc')});db[_0x6264('0x1c7')][_0x6264('0x10c')](db[_0x6264('0xb0')],{'as':_0x6264('0x1b2'),'onDelete':'cascade','foreignKey':_0x6264('0x1b3')});db[_0x6264('0xb0')][_0x6264('0x10c')](db[_0x6264('0x1c8')],{'as':'Subjects','foreignKey':_0x6264('0x1b5')});db[_0x6264('0xb0')][_0x6264('0x10c')](db['VtigerField'],{'as':_0x6264('0x1b6'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0xb0')][_0x6264('0x10c')](db[_0x6264('0x1c8')],{'as':_0x6264('0x1af'),'foreignKey':_0x6264('0x1b8')});db['VtigerConfiguration'][_0x6264('0x11a')](db[_0x6264('0x1c7')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x1b3')});db[_0x6264('0x1c8')]['hasMany'](db[_0x6264('0x1c8')],{'as':_0x6264('0x1ba'),'foreignKey':_0x6264('0x1b5')});db['VtigerField']['hasMany'](db[_0x6264('0x1c8')],{'as':_0x6264('0x1bb'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0x1c8')][_0x6264('0x10c')](db[_0x6264('0x1c8')],{'as':_0x6264('0x1be'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0x1c8')][_0x6264('0x11a')](db[_0x6264('0x88')],{'as':_0x6264('0x88'),'foreignKey':_0x6264('0x1bc')});db[_0x6264('0xb3')][_0x6264('0x10c')](db[_0x6264('0xb5')],{'as':'Configurations','onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b3')});db['ServicenowConfiguration'][_0x6264('0x10c')](db[_0x6264('0xb7')],{'as':_0x6264('0x1b4'),'foreignKey':_0x6264('0x1b5')});db['ServicenowConfiguration'][_0x6264('0x10c')](db[_0x6264('0xb7')],{'as':_0x6264('0x1b6'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0xb5')][_0x6264('0x10c')](db[_0x6264('0xb7')],{'as':'Fields','foreignKey':_0x6264('0x1b8')});db[_0x6264('0xb5')]['belongsTo'](db['ServicenowAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x6264('0xb7')]['hasMany'](db[_0x6264('0xb7')],{'as':_0x6264('0x1ba'),'foreignKey':_0x6264('0x1b5')});db[_0x6264('0xb7')][_0x6264('0x10c')](db[_0x6264('0xb7')],{'as':_0x6264('0x1bb'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0xb7')]['hasMany'](db[_0x6264('0xb7')],{'as':_0x6264('0x1be'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0xb7')][_0x6264('0x11a')](db[_0x6264('0x88')],{'as':_0x6264('0x88'),'foreignKey':'VariableId'});db[_0x6264('0xb9')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x6264('0x1b2'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b3')});db['Dynamics365Configuration']['hasMany'](db[_0x6264('0xbd')],{'as':_0x6264('0x1b4'),'onDelete':'cascade','foreignKey':_0x6264('0x1b5')});db[_0x6264('0xbb')]['hasMany'](db['Dynamics365Field'],{'as':_0x6264('0x1b6'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0xbb')][_0x6264('0x10c')](db[_0x6264('0xbd')],{'as':'Fields','onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0xbb')][_0x6264('0x11a')](db[_0x6264('0xb9')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x1b3')});db[_0x6264('0xbd')]['hasMany'](db['Dynamics365Field'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x6264('0xbd')][_0x6264('0x10c')](db[_0x6264('0xbd')],{'as':_0x6264('0x1bb'),'foreignKey':'DescriptionId'});db['Dynamics365Field'][_0x6264('0x10c')](db[_0x6264('0xbd')],{'as':_0x6264('0x1be'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0xbd')]['belongsTo'](db[_0x6264('0x88')],{'as':_0x6264('0x88'),'foreignKey':_0x6264('0x1bc')});db[_0x6264('0xbf')][_0x6264('0x10c')](db[_0x6264('0xc0')],{'as':_0x6264('0x1b2'),'onDelete':'cascade','foreignKey':_0x6264('0x1b3')});db[_0x6264('0xc0')][_0x6264('0x10c')](db[_0x6264('0x1c9')],{'as':_0x6264('0x1b4'),'foreignKey':_0x6264('0x1b5')});db[_0x6264('0xc0')][_0x6264('0x10c')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x6264('0x10c')](db[_0x6264('0x1c9')],{'as':_0x6264('0x1af'),'foreignKey':'FieldId'});db[_0x6264('0xc0')][_0x6264('0x11a')](db[_0x6264('0xbf')],{'as':'Account','foreignKey':_0x6264('0x1b3')});db[_0x6264('0x1c9')][_0x6264('0x10c')](db[_0x6264('0x1c9')],{'as':_0x6264('0x1ba'),'foreignKey':_0x6264('0x1b5')});db[_0x6264('0x1c9')][_0x6264('0x10c')](db[_0x6264('0x1c9')],{'as':_0x6264('0x1bb'),'foreignKey':'DescriptionId'});db[_0x6264('0x1c9')]['hasMany'](db[_0x6264('0x1c9')],{'as':_0x6264('0x1be'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0x1c9')]['belongsTo'](db['Variable'],{'as':_0x6264('0x88'),'foreignKey':_0x6264('0x1bc')});db[_0x6264('0xc5')][_0x6264('0x11a')](db[_0x6264('0x5e')],{});db[_0x6264('0xc5')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x6264('0x165')});db[_0x6264('0xc5')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0xc5')]['belongsTo'](db['ChatInteraction'],{});db['ChatQueueReport'][_0x6264('0x11a')](db[_0x6264('0x64')],{});db[_0x6264('0xc5')][_0x6264('0x11a')](db[_0x6264('0x12')],{});db[_0x6264('0xc5')]['belongsTo'](db[_0x6264('0x66')],{});db[_0x6264('0x191')][_0x6264('0x11a')](db[_0x6264('0x12')],{'onDelete':_0x6264('0x10a'),'foreignKey':'FromId'});db[_0x6264('0x191')]['belongsTo'](db[_0x6264('0x12')],{'onDelete':'cascade','foreignKey':'ToId'});db['JscriptySessionReport'][_0x6264('0x10c')](db[_0x6264('0x1ca')],{'foreignKey':_0x6264('0x1cb'),'onDelete':_0x6264('0x10a')});db[_0x6264('0xca')]['hasMany'](db[_0x6264('0xc7')],{'foreignKey':_0x6264('0x1cb'),'onDelete':_0x6264('0x10a')});db['SmsQueueReport'][_0x6264('0x11a')](db[_0x6264('0x4e')],{});db['SmsQueueReport'][_0x6264('0x11a')](db['CmList'],{'as':'List','foreignKey':_0x6264('0x165')});db[_0x6264('0xcc')]['belongsTo'](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0xcc')]['belongsTo'](db['SmsInteraction'],{});db[_0x6264('0xcc')][_0x6264('0x11a')](db['SmsMessage'],{});db[_0x6264('0xcc')][_0x6264('0x11a')](db['User'],{});db[_0x6264('0xcc')][_0x6264('0x11a')](db[_0x6264('0x55')],{});db[_0x6264('0x1cc')][_0x6264('0x10c')](db['JscriptySessionReport'],{'foreignKey':_0x6264('0x1cd')});db['JscriptyProject'][_0x6264('0x10c')](db[_0x6264('0x1ca')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x6264('0x10c')](db['JscriptyAnswerReport'],{'foreignKey':_0x6264('0x1cd')});db['SquareProject']['belongsToMany'](db['User'],{'as':'Users','through':'user_has_square_projects'});db['Team']['belongsToMany'](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':_0x6264('0x121')});db[_0x6264('0xd9')][_0x6264('0x11c')](db[_0x6264('0x12a')],{'through':_0x6264('0x103'),'as':_0x6264('0x1ce')});db['Team'][_0x6264('0x11c')](db['MailQueue'],{'through':_0x6264('0x168'),'as':_0x6264('0x1cf')});db[_0x6264('0xd9')][_0x6264('0x11c')](db[_0x6264('0x66')],{'through':'team_has_chat_queues','as':_0x6264('0x12e')});db[_0x6264('0xd9')][_0x6264('0x11c')](db['FaxQueue'],{'through':'team_has_fax_queues','as':_0x6264('0x130')});db['Team'][_0x6264('0x11c')](db[_0x6264('0x55')],{'through':_0x6264('0x181'),'as':'SmsQueues'});db[_0x6264('0xd9')][_0x6264('0x11c')](db[_0x6264('0x5c')],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x6264('0xd9')][_0x6264('0x11c')](db['WhatsappQueue'],{'through':_0x6264('0x1d0'),'as':_0x6264('0x134')});db[_0x6264('0xd9')][_0x6264('0x11c')](db[_0x6264('0xed')],{'through':_0x6264('0x105'),'as':'VoicePrefixes'});db[_0x6264('0xdd')][_0x6264('0x10c')](db[_0x6264('0x6c')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0x6264('0xdd')][_0x6264('0x10c')](db[_0x6264('0x193')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0x6264('0xdd')]['hasMany'](db[_0x6264('0x6e')],{'as':'HopperHistories','foreignKey':_0x6264('0x196')});db[_0x6264('0xdd')][_0x6264('0x10c')](db[_0x6264('0x198')],{'as':_0x6264('0x1d1'),'foreignKey':_0x6264('0x196')});db['Campaign'][_0x6264('0x11a')](db[_0x6264('0x14b')],{'as':_0x6264('0x14b'),'foreignKey':'TrunkId'});db[_0x6264('0xdd')][_0x6264('0x11a')](db['Trunk'],{'as':_0x6264('0x14d'),'foreignKey':_0x6264('0x1d2')});db[_0x6264('0xdd')][_0x6264('0x11a')](db[_0x6264('0x7b')],{'as':_0x6264('0x7b'),'foreignKey':_0x6264('0x14e')});db[_0x6264('0xdd')][_0x6264('0x11a')](db['SquareProject'],{'as':'SquareProject','foreignKey':_0x6264('0x1d3')});db[_0x6264('0xdd')][_0x6264('0x11c')](db['CmList'],{'as':'Lists','through':_0x6264('0x1d4')});db[_0x6264('0xdd')]['belongsToMany'](db[_0x6264('0xeb')],{'as':_0x6264('0x1d5'),'through':_0x6264('0x1d6')});db[_0x6264('0x170')]['belongsTo'](db[_0x6264('0x65')],{'as':_0x6264('0x65'),'foreignKey':_0x6264('0x1d7')});db[_0x6264('0x1d8')][_0x6264('0x11a')](db[_0x6264('0x40')],{});db[_0x6264('0x1d8')][_0x6264('0x11a')](db['MailInteraction'],{});db[_0x6264('0x1d8')]['belongsTo'](db[_0x6264('0x3b')],{'foreignKey':_0x6264('0x1d9'),'as':_0x6264('0x1da')});db[_0x6264('0x1d8')]['belongsTo'](db[_0x6264('0x12')],{'foreignKey':_0x6264('0x1db'),'as':'FromAgent'});db[_0x6264('0x1d8')][_0x6264('0x11a')](db['User'],{'foreignKey':_0x6264('0x1dc'),'as':_0x6264('0x1dd')});db[_0x6264('0x1d8')][_0x6264('0x11a')](db['MailQueue'],{'foreignKey':_0x6264('0x1de'),'as':'ToQueue'});db[_0x6264('0x1d8')][_0x6264('0x11a')](db[_0x6264('0x3b')],{'foreignKey':'ToMailAccountId','as':_0x6264('0x1df')});db[_0x6264('0xe5')]['belongsTo'](db['ChatMessage'],{});db[_0x6264('0xe5')]['belongsTo'](db[_0x6264('0x62')],{});db[_0x6264('0xe5')][_0x6264('0x11a')](db[_0x6264('0x5e')],{'foreignKey':_0x6264('0x1e0'),'as':_0x6264('0x1da')});db[_0x6264('0xe5')][_0x6264('0x11a')](db[_0x6264('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x6264('0xe5')]['belongsTo'](db[_0x6264('0x12')],{'foreignKey':'ToUserId','as':_0x6264('0x1dd')});db[_0x6264('0xe5')][_0x6264('0x11a')](db[_0x6264('0x66')],{'foreignKey':_0x6264('0x1e1'),'as':_0x6264('0x1e2')});db[_0x6264('0xe5')][_0x6264('0x11a')](db[_0x6264('0x5e')],{'foreignKey':_0x6264('0x1e3'),'as':'ToAccount'});db[_0x6264('0xe7')]['belongsTo'](db[_0x6264('0x49')],{});db[_0x6264('0xe7')][_0x6264('0x11a')](db[_0x6264('0x123')],{});db['FaxTransferReport'][_0x6264('0x11a')](db[_0x6264('0x45')],{'foreignKey':_0x6264('0x1e4'),'as':_0x6264('0x1da')});db[_0x6264('0xe7')][_0x6264('0x11a')](db[_0x6264('0x12')],{'foreignKey':_0x6264('0x1db'),'as':_0x6264('0x1e5')});db[_0x6264('0xe7')][_0x6264('0x11a')](db[_0x6264('0x12')],{'foreignKey':_0x6264('0x1dc'),'as':_0x6264('0x1dd')});db[_0x6264('0xe7')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x6264('0x1e6'),'as':_0x6264('0x1e2')});db[_0x6264('0xe7')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x6264('0x1e7'),'as':_0x6264('0x1df')});db['OpenchannelTransferReport'][_0x6264('0x11a')](db[_0x6264('0x5a')],{});db[_0x6264('0xe9')][_0x6264('0x11a')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0x6264('0x11a')](db[_0x6264('0x56')],{'foreignKey':_0x6264('0x1e8'),'as':_0x6264('0x1da')});db[_0x6264('0xe9')]['belongsTo'](db[_0x6264('0x12')],{'foreignKey':_0x6264('0x1db'),'as':_0x6264('0x1e5')});db[_0x6264('0xe9')][_0x6264('0x11a')](db[_0x6264('0x12')],{'foreignKey':_0x6264('0x1dc'),'as':_0x6264('0x1dd')});db[_0x6264('0xe9')][_0x6264('0x11a')](db['OpenchannelQueue'],{'foreignKey':_0x6264('0x1e9'),'as':_0x6264('0x1e2')});db[_0x6264('0xe9')][_0x6264('0x11a')](db[_0x6264('0x56')],{'foreignKey':_0x6264('0x1ea'),'as':_0x6264('0x1df')});db[_0x6264('0x1eb')][_0x6264('0x11a')](db['SmsMessage'],{});db[_0x6264('0x1eb')][_0x6264('0x11a')](db['SmsInteraction'],{});db[_0x6264('0x1eb')]['belongsTo'](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0x6264('0x1da')});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x6264('0x1db'),'as':_0x6264('0x1e5')});db[_0x6264('0x1eb')]['belongsTo'](db[_0x6264('0x12')],{'foreignKey':_0x6264('0x1dc'),'as':_0x6264('0x1dd')});db[_0x6264('0x1eb')]['belongsTo'](db[_0x6264('0x55')],{'foreignKey':_0x6264('0x1ec'),'as':'ToQueue'});db[_0x6264('0x1eb')][_0x6264('0x11a')](db['SmsAccount'],{'foreignKey':_0x6264('0x1ed'),'as':'ToAccount'});db[_0x6264('0xeb')][_0x6264('0x10c')](db[_0x6264('0x78')],{'as':_0x6264('0x182'),'foreignKey':_0x6264('0x165'),'onDelete':'cascade'});db[_0x6264('0xeb')][_0x6264('0x10c')](db[_0x6264('0x71')],{'as':_0x6264('0x1ee'),'foreignKey':'ListId'});db['CmList'][_0x6264('0x10c')](db[_0x6264('0x15c')],{'as':_0x6264('0x11f'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x165')});db[_0x6264('0xeb')][_0x6264('0x10c')](db[_0x6264('0x193')],{'as':_0x6264('0x111'),'foreignKey':_0x6264('0x165')});db['CmList'][_0x6264('0x10c')](db[_0x6264('0x6e')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x6264('0x10c')](db[_0x6264('0x113')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x6264('0xeb')][_0x6264('0x11c')](db[_0x6264('0x12a')],{'as':_0x6264('0x1ef'),'through':_0x6264('0x152')});db[_0x6264('0xeb')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':_0x6264('0x120')});db[_0x6264('0xed')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade'});db[_0x6264('0xed')]['belongsToMany'](db[_0x6264('0x12')],{'as':'Agents','through':_0x6264('0x106')});db[_0x6264('0xed')][_0x6264('0x11c')](db[_0x6264('0xd9')],{'through':'TeamVoicePrefix','as':_0x6264('0x154')});db[_0x6264('0xef')]['hasMany'](db[_0x6264('0x12')],{'as':'Users','foreignKey':_0x6264('0x11b')});db[_0x6264('0xef')]['hasMany'](db['UserProfileSection'],{'as':_0x6264('0x1f0'),'foreignKey':_0x6264('0x11b'),'onDelete':'cascade'});db['UserProfileSection'][_0x6264('0x10c')](db[_0x6264('0x1f1')],{'as':'Resources','foreignKey':_0x6264('0x1f2'),'onDelete':_0x6264('0x10a')});db['WhatsappAccount'][_0x6264('0x10c')](db[_0x6264('0x78')],{'as':_0x6264('0x182'),'foreignKey':_0x6264('0x1f3'),'onDelete':'cascade'});db[_0x6264('0xf5')]['hasMany'](db[_0x6264('0x76')],{'as':_0x6264('0x160'),'foreignKey':_0x6264('0x1f3')});db[_0x6264('0xf5')][_0x6264('0x10c')](db[_0x6264('0xfa')],{'as':_0x6264('0x156'),'foreignKey':'WhatsappAccountId'});db[_0x6264('0xf5')][_0x6264('0x10c')](db['WhatsappInteraction'],{'as':_0x6264('0x162')});db['WhatsappAccount'][_0x6264('0x10c')](db[_0x6264('0xf7')],{'as':_0x6264('0x142')});db[_0x6264('0xf5')][_0x6264('0x11a')](db['CmList'],{'as':'List','foreignKey':_0x6264('0x165')});db[_0x6264('0xf5')][_0x6264('0x11a')](db[_0x6264('0x7d')],{'as':_0x6264('0x14f'),'foreignKey':_0x6264('0x150')});db[_0x6264('0xf5')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':_0x6264('0x13d')});db['WhatsappApplication'][_0x6264('0x11a')](db[_0x6264('0x12')],{'onDelete':_0x6264('0x173')});db[_0x6264('0xf7')]['belongsTo'](db['WhatsappQueue'],{'onDelete':_0x6264('0x173')});db[_0x6264('0xf7')][_0x6264('0x11a')](db[_0x6264('0xf5')],{'onDelete':_0x6264('0x173')});db[_0x6264('0xf7')]['belongsTo'](db['Interval'],{'onDelete':_0x6264('0x173'),'foreignKey':'IntervalId'});db[_0x6264('0xf7')][_0x6264('0x11a')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x6264('0x174')});db[_0x6264('0xf9')]['hasMany'](db['WhatsappMessage'],{'as':_0x6264('0x156'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1f4')});db[_0x6264('0xf9')][_0x6264('0x11a')](db[_0x6264('0xf5')],{'as':_0x6264('0x16a'),'foreignKey':'WhatsappAccountId'});db[_0x6264('0xf9')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db['WhatsappInteraction'][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x16b'),'foreignKey':_0x6264('0x10b')});db['WhatsappInteraction'][_0x6264('0x11c')](db['Tag'],{'through':_0x6264('0x1a7'),'as':_0x6264('0x16d')});db[_0x6264('0xf9')]['belongsToMany'](db[_0x6264('0x84')],{'through':_0x6264('0x1a7'),'as':_0x6264('0x16e')});db[_0x6264('0xf9')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x17b'),'through':_0x6264('0x129'),'foreignKey':_0x6264('0x1f4')});db[_0x6264('0xfa')][_0x6264('0x11a')](db['User'],{'as':_0x6264('0x12')});db[_0x6264('0xfa')]['belongsTo'](db[_0x6264('0x15c')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x15d')});db[_0x6264('0xfa')][_0x6264('0x11a')](db[_0x6264('0xf9')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x17c'),'foreignKey':_0x6264('0x1f4')});db[_0x6264('0xfa')][_0x6264('0x11a')](db[_0x6264('0xf5')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x1f3')});db['WhatsappQueueReport'][_0x6264('0x11a')](db['WhatsappAccount'],{});db[_0x6264('0xfc')][_0x6264('0x11a')](db[_0x6264('0xeb')],{'as':'List','foreignKey':_0x6264('0x165')});db['WhatsappQueueReport'][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db['WhatsappQueueReport']['belongsTo'](db[_0x6264('0xf9')],{});db[_0x6264('0xfc')][_0x6264('0x11a')](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0x6264('0x11a')](db[_0x6264('0xfa')],{});db[_0x6264('0xfc')]['belongsTo'](db[_0x6264('0x12')],{});db[_0x6264('0x1f5')][_0x6264('0x11a')](db[_0x6264('0xfa')],{});db['WhatsappTransferReport'][_0x6264('0x11a')](db['WhatsappInteraction'],{});db[_0x6264('0x1f5')][_0x6264('0x11a')](db['WhatsappAccount'],{'foreignKey':_0x6264('0x1f6'),'as':'FromAccount'});db['WhatsappTransferReport']['belongsTo'](db[_0x6264('0xf5')],{'foreignKey':_0x6264('0x1f7'),'as':_0x6264('0x1df')});db[_0x6264('0x1f5')][_0x6264('0x11a')](db[_0x6264('0xff')],{'foreignKey':_0x6264('0x1f8'),'as':_0x6264('0x1e2')});db[_0x6264('0x1f5')][_0x6264('0x11a')](db[_0x6264('0x12')],{'foreignKey':_0x6264('0x1db'),'as':_0x6264('0x1e5')});db['WhatsappTransferReport'][_0x6264('0x11a')](db[_0x6264('0x12')],{'foreignKey':_0x6264('0x1dc'),'as':_0x6264('0x1dd')});db['WhatsappQueue'][_0x6264('0x11c')](db['User'],{'as':_0x6264('0x167'),'through':_0x6264('0x36'),'foreignKey':_0x6264('0x1f9')});db[_0x6264('0xff')]['belongsToMany'](db[_0x6264('0xd9')],{'through':_0x6264('0x1d0'),'as':'Teams'});module[_0x6264('0x1fa')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index b2c1b21..3b2256f 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea80=['./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/schedules','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceField','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./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/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','username','newPassword','apiKey','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','membername','calleridnum','exten','clientEmail','privateKey','secretaccesskey','key','pass','localstationid','dsn','secret','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','lodash','path','express-winston','util','./errors','./config/environment','./config/logger','api','auth','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','url','statusCode','responseTime','user','name','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','remoteAddress','other','agent_name','test','/api/users','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/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/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','./api/mailAccount','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxMessage','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','/api/chat/groups','/api/chat/proactive_actions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea80,0xd5));var _0x0ea8=function(_0x579b5c,_0x584833){_0x579b5c=_0x579b5c-0x0;var _0x51754d=_0xea80[_0x579b5c];return _0x51754d;};'use strict';var _=require(_0x0ea8('0x0'));var path=require(_0x0ea8('0x1'));var express=require('express');var ewinston=require(_0x0ea8('0x2'));var util=require(_0x0ea8('0x3'));var errors=require(_0x0ea8('0x4'));var config=require(_0x0ea8('0x5'));var logger=require(_0x0ea8('0x6'))(_0x0ea8('0x7'));var authLogger=require(_0x0ea8('0x6'))(_0x0ea8('0x8'));exports['default']=function(_0xdc783b){_0xdc783b[_0x0ea8('0x9')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1127b5,_0x272e73){var _0x2b5a6c=_0x0ea8('0xa');if(!_[_0x0ea8('0xb')](_0x1127b5[_0x0ea8('0xc')])){_0x2b5a6c+=_0x0ea8('0xd');var _0x5e5487=_0x1127b5[_0x0ea8('0xc')];maskSensitiveData(_0x5e5487);}return util[_0x0ea8('0xe')](_0x2b5a6c,_0x1127b5[_0x0ea8('0xf')],_0x1127b5[_0x0ea8('0x10')][_0x0ea8('0x11')]?_0x1127b5['headers'][_0x0ea8('0x11')]:_0x1127b5['connection']['remoteAddress']||_0x1127b5['ip'],_0x1127b5[_0x0ea8('0x12')],_0x272e73[_0x0ea8('0x13')],_0x272e73[_0x0ea8('0x14')],_0x1127b5['user']?_0x1127b5[_0x0ea8('0x15')]['id']:null,_0x1127b5[_0x0ea8('0x15')]?_0x1127b5[_0x0ea8('0x15')][_0x0ea8('0x16')]:null,_0x1127b5[_0x0ea8('0x15')]?_0x1127b5[_0x0ea8('0x15')]['role']:null,_0x5e5487?util[_0x0ea8('0x17')](_0x5e5487,![],null):'');}}));_0xdc783b[_0x0ea8('0x9')](ewinston[_0x0ea8('0x18')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2c0d06,_0x57b26b){var _0xbd7818=_0x0ea8('0x19');if(_0x2c0d06[_0x0ea8('0xc')]&&_0x2c0d06[_0x0ea8('0xc')][_0x0ea8('0x1a')]&&_0x2c0d06[_0x0ea8('0xc')][_0x0ea8('0x1b')]){_0xbd7818=_0x0ea8('0x1c');}return util[_0x0ea8('0xe')](_0xbd7818,_0x2c0d06[_0x0ea8('0xf')],_0x2c0d06['headers']['x-forwarded-for']?_0x2c0d06[_0x0ea8('0x10')][_0x0ea8('0x11')]:_0x2c0d06[_0x0ea8('0x1d')][_0x0ea8('0x1e')]||_0x2c0d06['ip'],_0x2c0d06['url'],_0x57b26b[_0x0ea8('0x13')],_0x57b26b[_0x0ea8('0x14')],_0x2c0d06[_0x0ea8('0x15')]?_0x2c0d06[_0x0ea8('0x15')]['id']:null,_0x2c0d06[_0x0ea8('0x15')]?_0x2c0d06['user'][_0x0ea8('0x16')]:null,_0x2c0d06[_0x0ea8('0x15')]?_0x2c0d06[_0x0ea8('0x15')]['role']:null,_0x2c0d06[_0x0ea8('0xc')]&&_0x2c0d06[_0x0ea8('0xc')]['device']?_0x2c0d06['body'][_0x0ea8('0x1a')]:_0x0ea8('0x1f'),_0x2c0d06[_0x0ea8('0xc')]&&_0x2c0d06[_0x0ea8('0xc')]['agent_id']?_0x2c0d06['body']['agent_id']:'',_0x2c0d06[_0x0ea8('0xc')]&&_0x2c0d06[_0x0ea8('0xc')][_0x0ea8('0x20')]?_0x2c0d06[_0x0ea8('0xc')]['agent_name']:'');},'ignoreRoute':function(_0x5eacb9){var _0x18c7c6=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x18c7c6[_0x0ea8('0x21')](_0x5eacb9[_0x0ea8('0x12')]);}}));_0xdc783b['use'](_0x0ea8('0x22'),require('./api/user'));_0xdc783b[_0x0ea8('0x9')]('/api/voice/chanspy',require(_0x0ea8('0x23')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x24'),require('./api/voiceContext'));_0xdc783b['use'](_0x0ea8('0x25'),require(_0x0ea8('0x26')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x27'),require('./api/voiceMusicOnHold'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x28'),require('./api/voiceQueue'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x29'),require(_0x0ea8('0x2a')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x2b'),require('./api/screenRecording'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x2c'),require(_0x0ea8('0x2d')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x2e'),require(_0x0ea8('0x2f')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x30'),require(_0x0ea8('0x31')));_0xdc783b['use']('/api/voice/dials/reports',require(_0x0ea8('0x32')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x33'),require(_0x0ea8('0x34')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x35'),require(_0x0ea8('0x36')));_0xdc783b['use']('/api/members/reports',require(_0x0ea8('0x37')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x38'),require(_0x0ea8('0x39')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x3a'),require(_0x0ea8('0x3b')));_0xdc783b[_0x0ea8('0x9')]('/api/mail/out_servers',require(_0x0ea8('0x3c')));_0xdc783b[_0x0ea8('0x9')]('/api/mail/accounts',require(_0x0ea8('0x3d')));_0xdc783b[_0x0ea8('0x9')]('/api/mail/queues',require('./api/mailQueue'));_0xdc783b['use']('/api/mail/substatuses',require(_0x0ea8('0x3e')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x3f'),require('./api/mailInteraction'));_0xdc783b['use'](_0x0ea8('0x40'),require(_0x0ea8('0x41')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x42'),require('./api/mailApplication'));_0xdc783b[_0x0ea8('0x9')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x43'),require(_0x0ea8('0x44')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x45'),require(_0x0ea8('0x46')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x47'),require(_0x0ea8('0x48')));_0xdc783b['use'](_0x0ea8('0x49'),require(_0x0ea8('0x4a')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x4b'),require('./api/faxInteraction'));_0xdc783b['use']('/api/fax/messages',require(_0x0ea8('0x4c')));_0xdc783b[_0x0ea8('0x9')]('/api/fax/queues',require(_0x0ea8('0x4d')));_0xdc783b[_0x0ea8('0x9')]('/api/fax/reports/queue',require(_0x0ea8('0x4e')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x4f'),require(_0x0ea8('0x50')));_0xdc783b[_0x0ea8('0x9')]('/api/sms/applications',require(_0x0ea8('0x51')));_0xdc783b['use'](_0x0ea8('0x52'),require('./api/smsInteraction'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x53'),require(_0x0ea8('0x54')));_0xdc783b['use'](_0x0ea8('0x55'),require(_0x0ea8('0x56')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x57'),require(_0x0ea8('0x58')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x59'),require(_0x0ea8('0x5a')));_0xdc783b['use']('/api/openchannel/interactions',require(_0x0ea8('0x5b')));_0xdc783b['use'](_0x0ea8('0x5c'),require('./api/openchannelMessage'));_0xdc783b['use']('/api/openchannel/queues',require(_0x0ea8('0x5d')));_0xdc783b[_0x0ea8('0x9')]('/api/chat/websites',require('./api/chatWebsite'));_0xdc783b[_0x0ea8('0x9')]('/api/openchannel/reports/queue',require(_0x0ea8('0x5e')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x5f'),require(_0x0ea8('0x60')));_0xdc783b[_0x0ea8('0x9')]('/api/chat/interactions',require('./api/chatInteraction'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x61'),require(_0x0ea8('0x62')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x63'),require('./api/chatOfflineMessage'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x64'),require('./api/chatQueue'));_0xdc783b['use'](_0x0ea8('0x65'),require('./api/chatGroup'));_0xdc783b['use'](_0x0ea8('0x66'),require(_0x0ea8('0x67')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x68'),require(_0x0ea8('0x69')));_0xdc783b['use'](_0x0ea8('0x6a'),require(_0x0ea8('0x6b')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x6c'),require(_0x0ea8('0x6d')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x6e'),require(_0x0ea8('0x6f')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x70'),require('./api/cmHopperFinal'));_0xdc783b['use']('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x71'),require(_0x0ea8('0x72')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x73'),require('./api/action'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x74'),require(_0x0ea8('0x75')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x76'),require('./api/cannedAnswer'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x77'),require(_0x0ea8('0x78')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x79'),require('./api/condition'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x7a'),require(_0x0ea8('0x7b')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x7c'),require(_0x0ea8('0x7d')));_0xdc783b['use'](_0x0ea8('0x7e'),require('./api/cdr'));_0xdc783b['use']('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x7f'),require('./api/schedule'));_0xdc783b['use'](_0x0ea8('0x80'),require(_0x0ea8('0x81')));_0xdc783b['use'](_0x0ea8('0x82'),require('./api/tag'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x83'),require(_0x0ea8('0x84')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x85'),require(_0x0ea8('0x86')));_0xdc783b['use'](_0x0ea8('0x87'),require(_0x0ea8('0x88')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x89'),require('./api/integration'));_0xdc783b[_0x0ea8('0x9')]('/api/integrations/reports',require(_0x0ea8('0x8a')));_0xdc783b['use'](_0x0ea8('0x8b'),require(_0x0ea8('0x8c')));_0xdc783b[_0x0ea8('0x9')]('/api/analytics/default_reports',require(_0x0ea8('0x8d')));_0xdc783b['use'](_0x0ea8('0x8e'),require(_0x0ea8('0x8f')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x90'),require('./api/analyticMetric'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x91'),require(_0x0ea8('0x92')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x93'),require('./api/analyticTreeReport'));_0xdc783b[_0x0ea8('0x9')]('/api/integrations/salesforce/accounts',require(_0x0ea8('0x94')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x95'),require('./api/intSalesforceConfiguration'));_0xdc783b['use']('/api/integrations/salesforce/fields',require(_0x0ea8('0x96')));_0xdc783b['use']('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0xdc783b['use']('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0xdc783b['use']('/api/integrations/sugarcrm/fields',require(_0x0ea8('0x97')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x98'),require('./api/intDeskAccount'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x99'),require(_0x0ea8('0x9a')));_0xdc783b['use'](_0x0ea8('0x9b'),require('./api/intDeskField'));_0xdc783b['use'](_0x0ea8('0x9c'),require(_0x0ea8('0x9d')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x9e'),require(_0x0ea8('0x9f')));_0xdc783b['use'](_0x0ea8('0xa0'),require('./api/intZohoField'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xa1'),require(_0x0ea8('0xa2')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xa3'),require(_0x0ea8('0xa4')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xa5'),require(_0x0ea8('0xa6')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xa7'),require('./api/intFreshdeskAccount'));_0xdc783b['use'](_0x0ea8('0xa8'),require('./api/intFreshdeskConfiguration'));_0xdc783b[_0x0ea8('0x9')]('/api/integrations/freshdesk/fields',require(_0x0ea8('0xa9')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xaa'),require(_0x0ea8('0xab')));_0xdc783b['use'](_0x0ea8('0xac'),require(_0x0ea8('0xad')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xae'),require(_0x0ea8('0xaf')));_0xdc783b[_0x0ea8('0x9')]('/api/integrations/servicenow/accounts',require(_0x0ea8('0xb0')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xb1'),require(_0x0ea8('0xb2')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xb3'),require(_0x0ea8('0xb4')));_0xdc783b['use']('/api/integrations/dynamics365/accounts',require(_0x0ea8('0xb5')));_0xdc783b[_0x0ea8('0x9')]('/api/integrations/dynamics365/configurations',require(_0x0ea8('0xb6')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xb7'),require(_0x0ea8('0xb8')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xb9'),require('./api/intFreshsalesAccount'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xba'),require(_0x0ea8('0xbb')));_0xdc783b[_0x0ea8('0x9')]('/api/integrations/freshsales/fields',require(_0x0ea8('0xbc')));_0xdc783b['use'](_0x0ea8('0xbd'),require('./api/network'));_0xdc783b[_0x0ea8('0x9')]('/api/chat/reports/queue',require(_0x0ea8('0xbe')));_0xdc783b[_0x0ea8('0x9')]('/api/chat/internal/messages',require(_0x0ea8('0xbf')));_0xdc783b['use']('/api/jscripty/answers/reports',require(_0x0ea8('0xc0')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xc1'),require(_0x0ea8('0xc2')));_0xdc783b['use']('/api/jscripty/sessions/reports',require(_0x0ea8('0xc3')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xc4'),require(_0x0ea8('0xc5')));_0xdc783b['use'](_0x0ea8('0xc6'),require(_0x0ea8('0xc7')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xc8'),require(_0x0ea8('0xc9')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xca'),require('./api/jscriptyProject'));_0xdc783b['use'](_0x0ea8('0xcb'),require(_0x0ea8('0xcc')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xcd'),require('./api/squareOdbc'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xce'),require(_0x0ea8('0xcf')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xd0'),require(_0x0ea8('0xd1')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xd2'),require(_0x0ea8('0xd3')));_0xdc783b[_0x0ea8('0x9')]('/api/teams',require(_0x0ea8('0xd4')));_0xdc783b['use'](_0x0ea8('0xd5'),require(_0x0ea8('0xd6')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xd7'),require('./api/campaign'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xd8'),require(_0x0ea8('0xd9')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xda'),require(_0x0ea8('0xdb')));_0xdc783b[_0x0ea8('0x9')]('/api/plugins',require(_0x0ea8('0xdc')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xdd'),require(_0x0ea8('0xde')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xdf'),require(_0x0ea8('0xe0')));_0xdc783b['use'](_0x0ea8('0xe1'),require(_0x0ea8('0xe2')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xe3'),require('./api/openchannelTransferReport'));_0xdc783b['use'](_0x0ea8('0xe4'),require(_0x0ea8('0xe5')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xe6'),require(_0x0ea8('0xe7')));_0xdc783b[_0x0ea8('0x9')]('/api/voice/prefixes',require(_0x0ea8('0xe8')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xe9'),require(_0x0ea8('0xea')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xeb'),require('./api/userProfileSection'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xec'),require('./api/userProfileResource'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xed'),require('./api/userNotification'));_0xdc783b['use'](_0x0ea8('0xee'),require(_0x0ea8('0xef')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xf0'),require(_0x0ea8('0xf1')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xf2'),require(_0x0ea8('0xf3')));_0xdc783b['use'](_0x0ea8('0xf4'),require(_0x0ea8('0xf5')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xf6'),require('./api/whatsappQueueReport'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xf7'),require('./api/whatsappTransferReport'));_0xdc783b['use'](_0x0ea8('0xf8'),require('./api/whatsappQueue'));_0xdc783b[_0x0ea8('0x9')]('/api/cloudProviders',require('./api/cloudProvider'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xf9'),require('./api/realtime'));_0xdc783b['use'](_0x0ea8('0xfa'),require(_0x0ea8('0xfb')));_0xdc783b['use'](_0x0ea8('0xfc'),require(_0x0ea8('0xfd')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xfe'),require('./api/jira'));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0xff'),require(_0x0ea8('0x100')));_0xdc783b[_0x0ea8('0x9')]('/api/version',require('./api/version'));_0xdc783b[_0x0ea8('0x9')]('/api/system',require(_0x0ea8('0x101')));_0xdc783b['use'](_0x0ea8('0x102'),require(_0x0ea8('0x103')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x104'),require(_0x0ea8('0x105')));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x106'),express[_0x0ea8('0x107')](path[_0x0ea8('0x108')](config[_0x0ea8('0x109')],'/apidoc')));_0xdc783b[_0x0ea8('0x9')]('/www',express[_0x0ea8('0x107')](path[_0x0ea8('0x108')](config[_0x0ea8('0x109')],_0x0ea8('0x10a'))));_0xdc783b['use']('/demo',express[_0x0ea8('0x107')](path[_0x0ea8('0x108')](config[_0x0ea8('0x109')],_0x0ea8('0x10b'))));_0xdc783b[_0x0ea8('0x9')](_0x0ea8('0x10c'),express[_0x0ea8('0x107')](path[_0x0ea8('0x108')](config[_0x0ea8('0x109')],_0x0ea8('0x10d'),_0x0ea8('0x10e'))));_0xdc783b[_0x0ea8('0x9')]('/plugins',express['static'](path[_0x0ea8('0x108')](config[_0x0ea8('0x109')],_0x0ea8('0x10f'))));_0xdc783b['route'](_0x0ea8('0x110'))[_0x0ea8('0x111')](errors[0x194]);_0xdc783b['route']('/*')[_0x0ea8('0x111')](function(_0x3c0c88,_0x309780){_0x309780['sendFile'](path[_0x0ea8('0x112')](_0xdc783b[_0x0ea8('0x111')](_0x0ea8('0x113'))+_0x0ea8('0x114')));});};var sensitiveFields=[_0x0ea8('0x115'),'password',_0x0ea8('0x116'),_0x0ea8('0x117'),'firstName',_0x0ea8('0x118'),_0x0ea8('0x119'),_0x0ea8('0x11a'),_0x0ea8('0x11b'),_0x0ea8('0x11c'),_0x0ea8('0x11d'),_0x0ea8('0x11e'),_0x0ea8('0x11f'),_0x0ea8('0x120'),_0x0ea8('0x121'),'accessKey',_0x0ea8('0x122'),_0x0ea8('0x123'),_0x0ea8('0x124'),_0x0ea8('0x125'),_0x0ea8('0x126'),_0x0ea8('0x127'),'consumerKey','consumerSecret',_0x0ea8('0x128'),'calleridname',_0x0ea8('0x129'),_0x0ea8('0x12a'),'vidaooApiKey',_0x0ea8('0x12b'),_0x0ea8('0x12c'),'accesskeyid',_0x0ea8('0x12d'),_0x0ea8('0x12e'),_0x0ea8('0x15'),_0x0ea8('0x12f'),'accountSid',_0x0ea8('0x130'),_0x0ea8('0x131'),_0x0ea8('0x132'),_0x0ea8('0x133'),'oldPassword'];function maskSensitiveData(_0x5356c5){var _0x28458b=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x5356c5))return;for(var _0xb4dfe5 in _0x5356c5){if(_[_0x0ea8('0x134')](_0x5356c5[_0xb4dfe5])){for(var _0x38cf63=0x0;_0x38cf63<_0x5356c5[_0xb4dfe5][_0x0ea8('0x135')];_0x38cf63++){maskSensitiveData(_0x5356c5[_0xb4dfe5][_0x38cf63]);}}else if(_[_0x0ea8('0x136')](_0x5356c5[_0xb4dfe5])){maskSensitiveData(_0x5356c5[_0xb4dfe5]);}else if(_[_0x0ea8('0x137')](_0x5356c5[_0xb4dfe5])){_0x5356c5[_0xb4dfe5]=_0x5356c5[_0xb4dfe5][_0x0ea8('0x138')](/{{{/g,_0x0ea8('0x139'))[_0x0ea8('0x138')](/}}}/g,_0x0ea8('0x13a'))[_0x0ea8('0x138')](/{{/g,'@{')[_0x0ea8('0x138')](/}}/g,'}@');if(_[_0x0ea8('0x13b')](sensitiveFields,_0xb4dfe5)){_0x5356c5[_0xb4dfe5]=_0x5356c5[_0xb4dfe5][_0x0ea8('0x138')](_0x28458b,'*');}}}} \ No newline at end of file +var _0xa246=['device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','statusCode','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/faxAccount','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/applications','./api/chatApplication','/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/chatProactiveAction','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/template','/api/triggers','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/cloudProvider','/api/realtime','./api/realtime','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','/api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','3.0.0','/plugins','route','get','sendFile','appPath','/index.html','username','password','newPassword','apiKey','firstName','lastName','phone','mobile','fax','clientId','securityToken','code','accessKey','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','exten','clientEmail','privateKey','secretaccesskey','pass','accountSid','localstationid','secret','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','path','express-winston','util','./errors','./config/logger','api','auth','default','use','logger','isEmpty','\x20body=%s','method','headers','x-forwarded-for','remoteAddress','url','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body'];(function(_0x1ba114,_0x594a5b){var _0x245c01=function(_0x4681dd){while(--_0x4681dd){_0x1ba114['push'](_0x1ba114['shift']());}};_0x245c01(++_0x594a5b);}(_0xa246,0x11f));var _0x6a24=function(_0x479753,_0x255c91){_0x479753=_0x479753-0x0;var _0x38f3e2=_0xa246[_0x479753];return _0x38f3e2;};'use strict';var _=require('lodash');var path=require(_0x6a24('0x0'));var express=require('express');var ewinston=require(_0x6a24('0x1'));var util=require(_0x6a24('0x2'));var errors=require(_0x6a24('0x3'));var config=require('./config/environment');var logger=require(_0x6a24('0x4'))(_0x6a24('0x5'));var authLogger=require('./config/logger')(_0x6a24('0x6'));exports[_0x6a24('0x7')]=function(_0xbd5399){_0xbd5399[_0x6a24('0x8')](ewinston[_0x6a24('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x45a85d,_0x97b2a){var _0x3463a3='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x6a24('0xa')](_0x45a85d['body'])){_0x3463a3+=_0x6a24('0xb');var _0x5d32be=_0x45a85d['body'];maskSensitiveData(_0x5d32be);}return util['format'](_0x3463a3,_0x45a85d[_0x6a24('0xc')],_0x45a85d[_0x6a24('0xd')][_0x6a24('0xe')]?_0x45a85d['headers']['x-forwarded-for']:_0x45a85d['connection'][_0x6a24('0xf')]||_0x45a85d['ip'],_0x45a85d[_0x6a24('0x10')],_0x97b2a['statusCode'],_0x97b2a[_0x6a24('0x11')],_0x45a85d[_0x6a24('0x12')]?_0x45a85d[_0x6a24('0x12')]['id']:null,_0x45a85d[_0x6a24('0x12')]?_0x45a85d['user'][_0x6a24('0x13')]:null,_0x45a85d['user']?_0x45a85d[_0x6a24('0x12')][_0x6a24('0x14')]:null,_0x5d32be?util['inspect'](_0x5d32be,![],null):'');}}));_0xbd5399[_0x6a24('0x8')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x153333,_0x3cb223){var _0x2a8eee=_0x6a24('0x15');if(_0x153333[_0x6a24('0x16')]&&_0x153333[_0x6a24('0x16')][_0x6a24('0x17')]&&_0x153333[_0x6a24('0x16')][_0x6a24('0x18')]){_0x2a8eee=_0x6a24('0x19');}return util['format'](_0x2a8eee,_0x153333[_0x6a24('0xc')],_0x153333[_0x6a24('0xd')]['x-forwarded-for']?_0x153333[_0x6a24('0xd')][_0x6a24('0xe')]:_0x153333[_0x6a24('0x1a')][_0x6a24('0xf')]||_0x153333['ip'],_0x153333[_0x6a24('0x10')],_0x3cb223[_0x6a24('0x1b')],_0x3cb223[_0x6a24('0x11')],_0x153333[_0x6a24('0x12')]?_0x153333['user']['id']:null,_0x153333[_0x6a24('0x12')]?_0x153333[_0x6a24('0x12')][_0x6a24('0x13')]:null,_0x153333[_0x6a24('0x12')]?_0x153333[_0x6a24('0x12')][_0x6a24('0x14')]:null,_0x153333[_0x6a24('0x16')]&&_0x153333[_0x6a24('0x16')][_0x6a24('0x17')]?_0x153333[_0x6a24('0x16')][_0x6a24('0x17')]:_0x6a24('0x1c'),_0x153333[_0x6a24('0x16')]&&_0x153333[_0x6a24('0x16')]['agent_id']?_0x153333[_0x6a24('0x16')][_0x6a24('0x18')]:'',_0x153333['body']&&_0x153333[_0x6a24('0x16')]['agent_name']?_0x153333['body'][_0x6a24('0x1d')]:'');},'ignoreRoute':function(_0x46003b){var _0x41a0cf=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x41a0cf[_0x6a24('0x1e')](_0x46003b[_0x6a24('0x10')]);}}));_0xbd5399['use'](_0x6a24('0x1f'),require(_0x6a24('0x20')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x21'),require(_0x6a24('0x22')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x23'),require(_0x6a24('0x24')));_0xbd5399['use'](_0x6a24('0x25'),require(_0x6a24('0x26')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x27'),require('./api/voiceMusicOnHold'));_0xbd5399[_0x6a24('0x8')]('/api/voice/queues',require(_0x6a24('0x28')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x29'),require(_0x6a24('0x2a')));_0xbd5399[_0x6a24('0x8')]('/api/screen/recordings',require(_0x6a24('0x2b')));_0xbd5399['use'](_0x6a24('0x2c'),require(_0x6a24('0x2d')));_0xbd5399['use']('/api/voice/mails/messages',require(_0x6a24('0x2e')));_0xbd5399['use']('/api/voice/calls/reports',require('./api/voiceCallReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x2f'),require(_0x6a24('0x30')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x31'),require('./api/voiceAgentReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x32'),require(_0x6a24('0x33')));_0xbd5399[_0x6a24('0x8')]('/api/members/reports',require(_0x6a24('0x34')));_0xbd5399['use'](_0x6a24('0x35'),require(_0x6a24('0x36')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x37'),require(_0x6a24('0x38')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x39'),require('./api/mailServerOut'));_0xbd5399['use'](_0x6a24('0x3a'),require(_0x6a24('0x3b')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x3c'),require(_0x6a24('0x3d')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x3e'),require(_0x6a24('0x3f')));_0xbd5399['use'](_0x6a24('0x40'),require(_0x6a24('0x41')));_0xbd5399['use']('/api/mail/messages',require(_0x6a24('0x42')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x43'),require(_0x6a24('0x44')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x45'),require('./api/mailQueueReport'));_0xbd5399[_0x6a24('0x8')]('/api/dashboards',require('./api/dashboard'));_0xbd5399[_0x6a24('0x8')]('/api/dashboards/items',require('./api/dashboardItem'));_0xbd5399['use']('/api/fax/accounts',require(_0x6a24('0x46')));_0xbd5399[_0x6a24('0x8')]('/api/fax/applications',require('./api/faxApplication'));_0xbd5399[_0x6a24('0x8')]('/api/fax/interactions',require(_0x6a24('0x47')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x48'),require(_0x6a24('0x49')));_0xbd5399['use'](_0x6a24('0x4a'),require(_0x6a24('0x4b')));_0xbd5399['use'](_0x6a24('0x4c'),require('./api/faxQueueReport'));_0xbd5399['use'](_0x6a24('0x4d'),require(_0x6a24('0x4e')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x4f'),require(_0x6a24('0x50')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x51'),require(_0x6a24('0x52')));_0xbd5399['use']('/api/sms/messages',require(_0x6a24('0x53')));_0xbd5399[_0x6a24('0x8')]('/api/sms/queues',require('./api/smsQueue'));_0xbd5399['use']('/api/openchannel/accounts',require(_0x6a24('0x54')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x55'),require('./api/openchannelApplication'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x56'),require(_0x6a24('0x57')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x58'),require(_0x6a24('0x59')));_0xbd5399['use'](_0x6a24('0x5a'),require(_0x6a24('0x5b')));_0xbd5399[_0x6a24('0x8')]('/api/chat/websites',require('./api/chatWebsite'));_0xbd5399[_0x6a24('0x8')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x5c'),require(_0x6a24('0x5d')));_0xbd5399['use'](_0x6a24('0x5e'),require(_0x6a24('0x5f')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x60'),require(_0x6a24('0x61')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x62'),require(_0x6a24('0x63')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x64'),require(_0x6a24('0x65')));_0xbd5399['use'](_0x6a24('0x66'),require('./api/chatGroup'));_0xbd5399[_0x6a24('0x8')]('/api/chat/proactive_actions',require(_0x6a24('0x67')));_0xbd5399[_0x6a24('0x8')]('/api/cm/companies',require('./api/cmCompany'));_0xbd5399[_0x6a24('0x8')]('/api/cm/contacts',require(_0x6a24('0x68')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x69'),require('./api/cmHopper'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x6a'),require('./api/cmHopperBlack'));_0xbd5399['use'](_0x6a24('0x6b'),require('./api/cmHopperFinal'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x6c'),require(_0x6a24('0x6d')));_0xbd5399['use'](_0x6a24('0x6e'),require(_0x6a24('0x6f')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x70'),require(_0x6a24('0x71')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x72'),require('./api/automation'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x73'),require(_0x6a24('0x74')));_0xbd5399['use']('/api/dispositions',require(_0x6a24('0x75')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x76'),require(_0x6a24('0x77')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x78'),require('./api/interval'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x79'),require(_0x6a24('0x7a')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x7b'),require('./api/cdr'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x7c'),require(_0x6a24('0x7d')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x7e'),require(_0x6a24('0x7f')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x80'),require(_0x6a24('0x81')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x82'),require('./api/tag'));_0xbd5399[_0x6a24('0x8')]('/api/templates',require(_0x6a24('0x83')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x84'),require('./api/trigger'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x85'),require(_0x6a24('0x86')));_0xbd5399[_0x6a24('0x8')]('/api/integrations',require(_0x6a24('0x87')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x88'),require(_0x6a24('0x89')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x8a'),require('./api/analyticCustomReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x8b'),require(_0x6a24('0x8c')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x8d'),require('./api/analyticExtractedReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x8e'),require('./api/analyticMetric'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x8f'),require('./api/analyticFieldReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x90'),require(_0x6a24('0x91')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x92'),require(_0x6a24('0x93')));_0xbd5399['use'](_0x6a24('0x94'),require(_0x6a24('0x95')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x96'),require(_0x6a24('0x97')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x98'),require(_0x6a24('0x99')));_0xbd5399['use'](_0x6a24('0x9a'),require('./api/intSugarcrmConfiguration'));_0xbd5399['use']('/api/integrations/sugarcrm/fields',require(_0x6a24('0x9b')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x9c'),require(_0x6a24('0x9d')));_0xbd5399['use'](_0x6a24('0x9e'),require(_0x6a24('0x9f')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xa0'),require('./api/intDeskField'));_0xbd5399[_0x6a24('0x8')]('/api/integrations/zoho/accounts',require(_0x6a24('0xa1')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xa2'),require('./api/intZohoConfiguration'));_0xbd5399['use'](_0x6a24('0xa3'),require(_0x6a24('0xa4')));_0xbd5399['use'](_0x6a24('0xa5'),require(_0x6a24('0xa6')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xa7'),require(_0x6a24('0xa8')));_0xbd5399['use']('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xa9'),require(_0x6a24('0xaa')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xab'),require('./api/intFreshdeskConfiguration'));_0xbd5399[_0x6a24('0x8')]('/api/integrations/freshdesk/fields',require(_0x6a24('0xac')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xad'),require('./api/intVtigerAccount'));_0xbd5399[_0x6a24('0x8')]('/api/integrations/vtiger/configurations',require(_0x6a24('0xae')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xaf'),require('./api/intVtigerField'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xb0'),require('./api/intServicenowAccount'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xb1'),require('./api/intServicenowConfiguration'));_0xbd5399['use']('/api/integrations/servicenow/fields',require(_0x6a24('0xb2')));_0xbd5399[_0x6a24('0x8')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xb3'),require(_0x6a24('0xb4')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xb5'),require('./api/intDynamics365Field'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xb6'),require('./api/intFreshsalesAccount'));_0xbd5399['use']('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0xbd5399[_0x6a24('0x8')]('/api/integrations/freshsales/fields',require(_0x6a24('0xb7')));_0xbd5399['use'](_0x6a24('0xb8'),require(_0x6a24('0xb9')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xba'),require(_0x6a24('0xbb')));_0xbd5399['use'](_0x6a24('0xbc'),require(_0x6a24('0xbd')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xbe'),require(_0x6a24('0xbf')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xc0'),require(_0x6a24('0xc1')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xc2'),require(_0x6a24('0xc3')));_0xbd5399[_0x6a24('0x8')]('/api/sms/reports/queue',require(_0x6a24('0xc4')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xc5'),require(_0x6a24('0xc6')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xc7'),require(_0x6a24('0xc8')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xc9'),require(_0x6a24('0xca')));_0xbd5399['use'](_0x6a24('0xcb'),require('./api/setting'));_0xbd5399['use'](_0x6a24('0xcc'),require(_0x6a24('0xcd')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xce'),require(_0x6a24('0xcf')));_0xbd5399['use'](_0x6a24('0xd0'),require('./api/squareRecording'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xd1'),require(_0x6a24('0xd2')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xd3'),require('./api/team'));_0xbd5399['use']('/api/license',require(_0x6a24('0xd4')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xd5'),require(_0x6a24('0xd6')));_0xbd5399[_0x6a24('0x8')]('/api/migrations',require(_0x6a24('0xd7')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xd8'),require('./api/attachment'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xd9'),require(_0x6a24('0xda')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xdb'),require(_0x6a24('0xdc')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xdd'),require(_0x6a24('0xde')));_0xbd5399['use']('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xdf'),require(_0x6a24('0xe0')));_0xbd5399[_0x6a24('0x8')]('/api/sms/reports/transfer',require(_0x6a24('0xe1')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xe2'),require(_0x6a24('0xe3')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xe4'),require(_0x6a24('0xe5')));_0xbd5399[_0x6a24('0x8')]('/api/userProfiles',require(_0x6a24('0xe6')));_0xbd5399['use'](_0x6a24('0xe7'),require(_0x6a24('0xe8')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xe9'),require(_0x6a24('0xea')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xeb'),require('./api/userNotification'));_0xbd5399[_0x6a24('0x8')]('/api/whatsapp/accounts',require(_0x6a24('0xec')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xed'),require(_0x6a24('0xee')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xef'),require(_0x6a24('0xf0')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xf1'),require('./api/whatsappMessage'));_0xbd5399['use'](_0x6a24('0xf2'),require('./api/whatsappQueueReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xf3'),require('./api/whatsappTransferReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xf4'),require('./api/whatsappQueue'));_0xbd5399[_0x6a24('0x8')]('/api/cloudProviders',require(_0x6a24('0xf5')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xf6'),require(_0x6a24('0xf7')));_0xbd5399[_0x6a24('0x8')]('/api/auth/local',require(_0x6a24('0xf8')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xf9'),require(_0x6a24('0xfa')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xfb'),require('./api/jira'));_0xbd5399['use'](_0x6a24('0xfc'),require('./api/rpc'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xfd'),require('./api/version'));_0xbd5399['use'](_0x6a24('0xfe'),require(_0x6a24('0xff')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x100'),require('./api/pm2'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x101'),require(_0x6a24('0x102')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x103'),express[_0x6a24('0x104')](path[_0x6a24('0x105')](config[_0x6a24('0x106')],_0x6a24('0x103'))));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x107'),express['static'](path[_0x6a24('0x105')](config['root'],_0x6a24('0x107'))));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x108'),express[_0x6a24('0x104')](path[_0x6a24('0x105')](config[_0x6a24('0x106')],_0x6a24('0x108'))));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x109'),express[_0x6a24('0x104')](path[_0x6a24('0x105')](config[_0x6a24('0x106')],'snippet',_0x6a24('0x10a'))));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x10b'),express[_0x6a24('0x104')](path[_0x6a24('0x105')](config[_0x6a24('0x106')],'/server/files/plugins')));_0xbd5399[_0x6a24('0x10c')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x6a24('0x10d')](errors[0x194]);_0xbd5399['route']('/*')[_0x6a24('0x10d')](function(_0x59512e,_0xc390a){_0xc390a[_0x6a24('0x10e')](path['resolve'](_0xbd5399[_0x6a24('0x10d')](_0x6a24('0x10f'))+_0x6a24('0x110')));});};var sensitiveFields=[_0x6a24('0x111'),_0x6a24('0x112'),_0x6a24('0x113'),_0x6a24('0x114'),_0x6a24('0x115'),_0x6a24('0x116'),'street',_0x6a24('0x117'),_0x6a24('0x118'),_0x6a24('0x119'),'email',_0x6a24('0x11a'),'clientSecret',_0x6a24('0x11b'),_0x6a24('0x11c'),_0x6a24('0x11d'),'tenantId',_0x6a24('0x11e'),_0x6a24('0x11f'),_0x6a24('0x120'),_0x6a24('0x121'),'authToken',_0x6a24('0x122'),_0x6a24('0x123'),_0x6a24('0x124'),_0x6a24('0x125'),'calleridnum',_0x6a24('0x126'),'vidaooApiKey',_0x6a24('0x127'),_0x6a24('0x128'),'accesskeyid',_0x6a24('0x129'),'key',_0x6a24('0x12'),_0x6a24('0x12a'),_0x6a24('0x12b'),_0x6a24('0x12c'),'dsn',_0x6a24('0x12d'),'registry',_0x6a24('0x12e')];function maskSensitiveData(_0x1bc1f5){var _0x3794fd=/(?!^)[\s\S](?!$)/g;if(!_[_0x6a24('0x12f')](_0x1bc1f5))return;for(var _0x15e4f9 in _0x1bc1f5){if(_[_0x6a24('0x130')](_0x1bc1f5[_0x15e4f9])){for(var _0x127e9f=0x0;_0x127e9f<_0x1bc1f5[_0x15e4f9][_0x6a24('0x131')];_0x127e9f++){maskSensitiveData(_0x1bc1f5[_0x15e4f9][_0x127e9f]);}}else if(_[_0x6a24('0x12f')](_0x1bc1f5[_0x15e4f9])){maskSensitiveData(_0x1bc1f5[_0x15e4f9]);}else if(_[_0x6a24('0x132')](_0x1bc1f5[_0x15e4f9])){_0x1bc1f5[_0x15e4f9]=_0x1bc1f5[_0x15e4f9][_0x6a24('0x133')](/{{{/g,_0x6a24('0x134'))[_0x6a24('0x133')](/}}}/g,_0x6a24('0x135'))[_0x6a24('0x133')](/{{/g,'@{')[_0x6a24('0x133')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x15e4f9)){_0x1bc1f5[_0x15e4f9]=_0x1bc1f5[_0x15e4f9][_0x6a24('0x133')](_0x3794fd,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 4d23c55..16e1636 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2937=['../api/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc'];(function(_0x43b2e6,_0x14d773){var _0x102c0b=function(_0x1776f2){while(--_0x1776f2){_0x43b2e6['push'](_0x43b2e6['shift']());}};_0x102c0b(++_0x14d773);}(_0x2937,0xf2));var _0x7293=function(_0x89b17c,_0x3d1c4c){_0x89b17c=_0x89b17c-0x0;var _0x462791=_0x2937[_0x89b17c];return _0x462791;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x7293('0x0'));var _=require(_0x7293('0x1'));var config=require(_0x7293('0x2'));exports[_0x7293('0x3')]=function(){return new BPromise(function(_0x4567ca,_0x29df01){var _0x35ea45={};_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x5')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x6')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x7')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x8')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x9')));_0x35ea45=_['merge'](_0x35ea45,require(_0x7293('0xa')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0xb')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0xc')));_0x35ea45=_['merge'](_0x35ea45,require(_0x7293('0xd')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0xe')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0xf')));_0x35ea45=_['merge'](_0x35ea45,require('../api/mailServerIn/mailServerIn.rpc'));_0x35ea45=_['merge'](_0x35ea45,require('../api/mailAccount/mailAccount.rpc'));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x10')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x11')));_0x35ea45=_['merge'](_0x35ea45,require(_0x7293('0x12')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x13')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x14')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x15')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x16')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require('../api/faxInteraction/faxInteraction.rpc'));_0x35ea45=_['merge'](_0x35ea45,require(_0x7293('0x17')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x18')));_0x35ea45=_['merge'](_0x35ea45,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x35ea45=_['merge'](_0x35ea45,require('../api/smsAccount/smsAccount.rpc'));_0x35ea45=_['merge'](_0x35ea45,require('../api/smsInteraction/smsInteraction.rpc'));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x19')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x1a')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x1b')));_0x35ea45=_['merge'](_0x35ea45,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x1c')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x1d')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x1e')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x1f')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require('../api/chatQueue/chatQueue.rpc'));_0x35ea45=_['merge'](_0x35ea45,require(_0x7293('0x20')));_0x35ea45=_['merge'](_0x35ea45,require(_0x7293('0x21')));_0x35ea45=_['merge'](_0x35ea45,require(_0x7293('0x22')));_0x35ea45=_['merge'](_0x35ea45,require(_0x7293('0x23')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x24')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x25')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require('../api/interval/interval.rpc'));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x26')));_0x35ea45=_['merge'](_0x35ea45,require(_0x7293('0x27')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x28')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x29')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x2a')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x2b')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x2c')));_0x35ea45=_['merge'](_0x35ea45,require(_0x7293('0x2d')));_0x35ea45=_['merge'](_0x35ea45,require(_0x7293('0x2e')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x2f')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x30')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x31')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x32')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x33')));_0x35ea45=_['merge'](_0x35ea45,require(_0x7293('0x34')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x35')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require('../api/setting/setting.rpc'));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x36')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x37')));_0x35ea45=_['merge'](_0x35ea45,require('../api/squareRecording/squareRecording.rpc'));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require('../api/squareMessage/squareMessage.rpc'));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x38')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x39')));_0x35ea45=_['merge'](_0x35ea45,require('../api/plugin/plugin.rpc'));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x3a')));_0x35ea45=_['merge'](_0x35ea45,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x3b')));_0x35ea45=_['merge'](_0x35ea45,require(_0x7293('0x3c')));_0x35ea45=_[_0x7293('0x4')](_0x35ea45,require(_0x7293('0x3d')));var _0x4b0517=jayson[_0x7293('0x3e')](_0x35ea45)[_0x7293('0x3f')]();var _0x1d8575=config[_0x7293('0x40')][_0x7293('0x41')]||config['port']+0x1;var _0x3c03ea=config['rpc']['ip']||_0x7293('0x42');_0x4b0517['on'](_0x7293('0x43'),function(_0x5acdfe){return _0x29df01(_0x5acdfe);});_0x4b0517['listen'](_0x1d8575,_0x3c03ea,function(){console[_0x7293('0x44')](_0x7293('0x45'),_0x3c03ea,_0x1d8575);require(_0x7293('0x46'))[_0x7293('0x47')]();return _0x4567ca(_0x7293('0x48')+_0x3c03ea+':'+_0x1d8575);});});}; \ No newline at end of file +var _0xfef6=['../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','port','rpc','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc'];(function(_0x1fed08,_0x9fb6b4){var _0x5a3466=function(_0x3971b0){while(--_0x3971b0){_0x1fed08['push'](_0x1fed08['shift']());}};_0x5a3466(++_0x9fb6b4);}(_0xfef6,0x95));var _0x6fef=function(_0x4b5a9e,_0x467811){_0x4b5a9e=_0x4b5a9e-0x0;var _0x1c2d77=_0xfef6[_0x4b5a9e];return _0x1c2d77;};'use strict';var jayson=require(_0x6fef('0x0'));var BPromise=require(_0x6fef('0x1'));var _=require(_0x6fef('0x2'));var config=require(_0x6fef('0x3'));exports['listen']=function(){return new BPromise(function(_0xd96f6c,_0x4eba83){var _0x2f8c51={};_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x5')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x6')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x7')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x8')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x9')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0xa')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0xb')));_0x2f8c51=_['merge'](_0x2f8c51,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0xc')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/trunk/trunk.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0xd')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0xe')));_0x2f8c51=_['merge'](_0x2f8c51,require('../api/mailAccount/mailAccount.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0xf')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x10')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x11')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x12')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x13')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x14')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/faxApplication/faxApplication.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x15')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x16')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/faxQueue/faxQueue.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x2f8c51=_['merge'](_0x2f8c51,require('../api/smsAccount/smsAccount.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/smsInteraction/smsInteraction.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x17')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/smsQueue/smsQueue.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x18')));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x19')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/chatMessage/chatMessage.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x1a')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x1b')));_0x2f8c51=_['merge'](_0x2f8c51,require('../api/cmHopper/cmHopper.rpc'));_0x2f8c51=_['merge'](_0x2f8c51,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x1c')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x1d')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x1e')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x1f')));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x20')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x21')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x22')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x23')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/variable/variable.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x24')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x25')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x26')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x27')));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x28')));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x29')));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x2a')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x2b')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x2c')));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x2d')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x2e')));_0x2f8c51=_['merge'](_0x2f8c51,require('../api/setting/setting.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x2f')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/squareProject/squareProject.rpc'));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x30')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x31')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x32')));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x33')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/plugin/plugin.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x34')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x35')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x36')));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x37')));var _0x4589c6=jayson['server'](_0x2f8c51)[_0x6fef('0x38')]();var _0x1108df=config['rpc']['port']||config[_0x6fef('0x39')]+0x1;var _0x551349=config[_0x6fef('0x3a')]['ip']||'localhost';_0x4589c6['on'](_0x6fef('0x3b'),function(_0x528b0a){return _0x4eba83(_0x528b0a);});_0x4589c6[_0x6fef('0x3c')](_0x1108df,_0x551349,function(){console[_0x6fef('0x3d')](_0x6fef('0x3e'),_0x551349,_0x1108df);require(_0x6fef('0x3f'))['default']();return _0xd96f6c(_0x6fef('0x40')+_0x551349+':'+_0x1108df);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index e6f30df..a326f9f 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 _0xd4ab=['toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','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','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','write','inherits','prototype','sendRequest','command','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','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable'];(function(_0x422aff,_0x23b4e9){var _0xbdf95f=function(_0x578769){while(--_0x578769){_0x422aff['push'](_0x422aff['shift']());}};_0xbdf95f(++_0x23b4e9);}(_0xd4ab,0x112));var _0xbd4a=function(_0x12372f,_0x29b44e){_0x12372f=_0x12372f-0x0;var _0x515a2e=_0xd4ab[_0x12372f];return _0x515a2e;};'use strict';var util=require('util');var _=require(_0xbd4a('0x0'));var EventEmitter=require(_0xbd4a('0x1'))[_0xbd4a('0x2')];var AGIReply=require(_0xbd4a('0x3'));var AGIError=require('./error');function AGIChannel(_0x39f39a){var _0x46e0a4=this,_0x3b8a19=new AGIReply(),_0x50bb17=![],_0x5313da={};EventEmitter[_0xbd4a('0x4')](_0x46e0a4);_0x39f39a[_0xbd4a('0x5')](_0xbd4a('0x6'));_0x39f39a[_0xbd4a('0x7')](0x8*0x3c*0x3c*0x3e8);_0x3b8a19[_0xbd4a('0x5')](_0xbd4a('0x6'));_0x3b8a19['on'](_0xbd4a('0x8'),function(_0x3705e6){for(var _0x26381b in _0x3705e6){_0x46e0a4[_0x26381b]=_0x3705e6[_0x26381b];}_0x46e0a4[_0xbd4a('0x9')](_0xbd4a('0xa'));});_0x3b8a19['on'](_0xbd4a('0xb'),function(_0x1f7d34){if(_0x1f7d34['toLowerCase']()=='hangup'){_0x46e0a4[_0xbd4a('0x9')](_0xbd4a('0xc'));return;}if(_0x1f7d34[_0xbd4a('0xd')](0x0,0xb)==_0xbd4a('0xe')){_0x50bb17=!![];}if(_0x50bb17){_0x5313da['rx']+=_0x1f7d34+'\x0a';if(_0x1f7d34[_0xbd4a('0xf')](_0xbd4a('0x10'))!=-0x1){_0x50bb17=![];}}else{_0x5313da['rx']=_0x1f7d34;}if(_0x50bb17){return;}if(typeof _0x5313da['cb']==_0xbd4a('0x11')){var _0x2d73a9=_0x5313da['rx'][_0xbd4a('0xd')](0x0,0x3),_0x242351=null,_0x3f4191=null;_0x2d73a9=parseInt(_0x2d73a9);if(isNaN(_0x2d73a9)){_0x5313da['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xbd4a('0x12')});return;}if(_0x2d73a9!=0xc8){_0x5313da['cb'](null,{'code':_0x2d73a9,'result':-0x1,'extra':'KO'});return;}_0x242351=_0x5313da['rx'][_0xbd4a('0xd')](0x4)['replace'](_0xbd4a('0x13'),'');if(_0x242351[_0xbd4a('0x14')]('\x20')!=-0x1){_0x242351=_0x242351[_0xbd4a('0x15')](0x0,_0x242351[_0xbd4a('0x14')]('\x20'));}if(_[_0xbd4a('0x16')](_0x242351,'-1')){_0x242351=parseInt(_0x242351);}_0x3f4191=_0x5313da['rx'][_0xbd4a('0x17')]('\x20');if(_0x3f4191[_0xbd4a('0x18')]==0x3){_0x3f4191=_0x3f4191[0x2][_0xbd4a('0xd')](0x1,_0x3f4191[0x2][_0xbd4a('0x18')]-0x1);}else if(_0x3f4191['length']>0x3){var _0x5d1c2e=/\((.+)\)/;var _0xd166f7=_0x5313da['rx'][_0xbd4a('0x19')](_0x5d1c2e);if(_0xd166f7){_0x3f4191=_0xd166f7[0x1];}else{_0x3f4191=null;}}else{_0x3f4191=null;}_0x5313da['cb'](null,{'code':_0x2d73a9,'result':_0x242351,'extra':_0x3f4191});}});_0x39f39a['on'](_0xbd4a('0x1a'),function(_0x375bb4){_0x46e0a4[_0xbd4a('0x9')](_0xbd4a('0x1a'),new AGIError(_0xbd4a('0x1b'),_0x375bb4[_0xbd4a('0x1c')]));});_0x39f39a['on']('close',function(){_0x46e0a4['emit'](_0xbd4a('0x1d'),new AGIError(_0xbd4a('0x1e')));});_0x39f39a['on']('timeout',function(){_0x46e0a4[_0xbd4a('0x9')](_0xbd4a('0x1f'),new AGIError(_0xbd4a('0x20')));_0x39f39a[_0xbd4a('0x21')]();});_0x39f39a['pipe'](_0x3b8a19);this['command']=function(_0x485c3c,_0x5c1d77){var _0x485c3c=_0x485c3c||'',_0x5c1d77=typeof _0x5c1d77==_0xbd4a('0x11')?_0x5c1d77:new Function();_0x5313da={'tx':_0x485c3c,'rx':'','cb':_0x5c1d77};_0x39f39a[_0xbd4a('0x22')](_0x485c3c+'\x0a');},this['close']=function(){_0x39f39a[_0xbd4a('0x21')]();};}util[_0xbd4a('0x23')](AGIChannel,EventEmitter);AGIChannel[_0xbd4a('0x24')][_0xbd4a('0x25')]=function(_0x10d8f8){return this[_0xbd4a('0x26')][_0xbd4a('0x27')](this,_0x10d8f8);};AGIChannel['prototype'][_0xbd4a('0x28')]=function(){return this[_0xbd4a('0x25')]('ANSWER');};AGIChannel[_0xbd4a('0x24')][_0xbd4a('0x29')]=function(_0x4d30a6,_0x22c65b,_0x2e972c){_0x4d30a6=_0x4d30a6===undefined?_0xbd4a('0x2a'):_0x4d30a6;_0x22c65b=_0x22c65b===undefined?'5':_0x22c65b;_0x2e972c=_0x2e972c===undefined?'1':_0x2e972c;return this['sendRequest'](util[_0xbd4a('0x2b')](_0xbd4a('0x2c'),_0x4d30a6,_0x22c65b*0x3e8,_0x2e972c));};AGIChannel[_0xbd4a('0x24')][_0xbd4a('0x2d')]=function(_0x4169c3){_0x4169c3=_0x4169c3||_0xbd4a('0x2e');return this[_0xbd4a('0x25')](util[_0xbd4a('0x2b')](_0xbd4a('0x2f'),_0x4169c3));};AGIChannel[_0xbd4a('0x24')][_0xbd4a('0x30')]=function(_0x4fab16,_0x16d79a){if(_[_0xbd4a('0x31')](_0x16d79a)){return this[_0xbd4a('0x25')](util[_0xbd4a('0x2b')](_0xbd4a('0x32'),_0x4fab16,_0x16d79a['join'](',')));}return this['sendRequest'](util[_0xbd4a('0x2b')](_0xbd4a('0x32'),_0x4fab16,_0x16d79a));};AGIChannel[_0xbd4a('0x24')][_0xbd4a('0x33')]=function(_0x507b32){return this['sendRequest'](util[_0xbd4a('0x2b')](_0xbd4a('0x34'),_0x507b32));};AGIChannel[_0xbd4a('0x24')][_0xbd4a('0x35')]=function(_0x596e64){return this[_0xbd4a('0x25')](util['format'](_0xbd4a('0x36'),_0x596e64));};AGIChannel['prototype']['setPriority']=function(_0x4d6858){return this[_0xbd4a('0x25')](util[_0xbd4a('0x2b')](_0xbd4a('0x37'),_0x4d6858));};AGIChannel[_0xbd4a('0x24')][_0xbd4a('0xc')]=function(){return this[_0xbd4a('0x25')](_0xbd4a('0x38'));};AGIChannel[_0xbd4a('0x24')][_0xbd4a('0x39')]=function(_0x12d2d2,_0x1ae97b){var _0x2f9932=_['isBoolean'](_0x1ae97b)||_['isNumber'](_0x1ae97b)?_0x1ae97b[_0xbd4a('0x3a')]():_0x1ae97b;return this[_0xbd4a('0x25')](util[_0xbd4a('0x2b')](_0xbd4a('0x3b'),_0x12d2d2,_0x2f9932?_0x2f9932[_0xbd4a('0x3a')]()[_0xbd4a('0x3c')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xbd4a('0x24')][_0xbd4a('0x3d')]=function(_0x51a785,_0x50d8d1){return this[_0xbd4a('0x25')](util[_0xbd4a('0x2b')](_0xbd4a('0x3e'),_0x51a785,_0x50d8d1));};AGIChannel['prototype']['sayDigits']=function(_0x42cf8a,_0x121d27){return this[_0xbd4a('0x25')](util[_0xbd4a('0x2b')](_0xbd4a('0x3f'),_0x42cf8a,_0x121d27));};AGIChannel[_0xbd4a('0x24')][_0xbd4a('0x40')]=function(_0x58089d,_0x169683){return this[_0xbd4a('0x25')](util['format'](_0xbd4a('0x41'),_0x58089d,_0x169683));};AGIChannel[_0xbd4a('0x24')][_0xbd4a('0x42')]=function(_0x5d3748,_0x3631fc,_0x4ac97a){_0x3631fc=_0x3631fc||this[_0xbd4a('0x43')];_0x4ac97a=_0x4ac97a||0x1;this[_0xbd4a('0x33')](_0x5d3748);this[_0xbd4a('0x35')](_0x3631fc);this['setPriority'](_0x4ac97a);return this['noop'](util[_0xbd4a('0x2b')](_0xbd4a('0x44'),_0x5d3748,_0x3631fc,_0x4ac97a));};AGIChannel['prototype'][_0xbd4a('0x45')]=function(_0x4c49b9){return this[_0xbd4a('0x25')](util['format'](_0xbd4a('0x46'),_0x4c49b9));};AGIChannel[_0xbd4a('0x24')]['recordFile']=function(_0x34b91f,_0x2236ff,_0x2bd97c,_0x162d5d,_0x1e5f38,_0x40ae2f){_0x2236ff=_0x2236ff||_0xbd4a('0x47');_0x2bd97c=_0x2bd97c||'';_0x162d5d=_0x162d5d===undefined?-0x1:_0x162d5d==='-1'?-0x1:_0x162d5d*0x3e8;_0x1e5f38=_0x1e5f38===undefined?'':'s='+_0x1e5f38;_0x40ae2f=_0x40ae2f?_0xbd4a('0x48'):'';return this[_0xbd4a('0x25')](util[_0xbd4a('0x2b')](_0xbd4a('0x49'),_0x34b91f,_0x2236ff,_0x2bd97c,_0x162d5d,_0x40ae2f,_0x1e5f38));};AGIChannel[_0xbd4a('0x24')][_0xbd4a('0x4a')]=function(_0x43f7ba,_0xff8bb0){_0xff8bb0=_0xff8bb0||'';return this['sendRequest'](util[_0xbd4a('0x2b')](_0xbd4a('0x4b'),_0x43f7ba,_0xff8bb0));};AGIChannel['prototype'][_0xbd4a('0x4c')]=function(_0x1b8198){return this['exec'](_0xbd4a('0x4d'),_0x1b8198);};AGIChannel[_0xbd4a('0x24')][_0xbd4a('0x4e')]=function(_0xa6e2e5){return this[_0xbd4a('0x30')](_0xbd4a('0x4f'),_0xa6e2e5);};AGIChannel[_0xbd4a('0x24')][_0xbd4a('0x1a')]=function(_0x1d4b96,_0x224a1e){this[_0xbd4a('0x2d')](util[_0xbd4a('0x2b')](_0xbd4a('0x50'),_0x1d4b96['id'],_0x1d4b96[_0xbd4a('0x51')],_0x224a1e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xbd4a('0x52')]=AGIChannel; \ No newline at end of file +var _0x33aa=['E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','prototype','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','sendRequest','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','setVariable','isBoolean','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','indexOf','substr','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout'];(function(_0x222165,_0x2c296e){var _0x1ee52d=function(_0x43f5c9){while(--_0x43f5c9){_0x222165['push'](_0x222165['shift']());}};_0x1ee52d(++_0x2c296e);}(_0x33aa,0xc9));var _0xa33a=function(_0x3d5f8a,_0x34a40b){_0x3d5f8a=_0x3d5f8a-0x0;var _0x15bf5b=_0x33aa[_0x3d5f8a];return _0x15bf5b;};'use strict';var util=require(_0xa33a('0x0'));var _=require(_0xa33a('0x1'));var EventEmitter=require(_0xa33a('0x2'))[_0xa33a('0x3')];var AGIReply=require(_0xa33a('0x4'));var AGIError=require(_0xa33a('0x5'));function AGIChannel(_0x2ffdd6){var _0x31060d=this,_0x530bf8=new AGIReply(),_0x5b8073=![],_0x1655fa={};EventEmitter[_0xa33a('0x6')](_0x31060d);_0x2ffdd6[_0xa33a('0x7')](_0xa33a('0x8'));_0x2ffdd6[_0xa33a('0x9')](0x8*0x3c*0x3c*0x3e8);_0x530bf8[_0xa33a('0x7')]('utf8');_0x530bf8['on']('headers',function(_0x4c5511){for(var _0x41eac5 in _0x4c5511){_0x31060d[_0x41eac5]=_0x4c5511[_0x41eac5];}_0x31060d[_0xa33a('0xa')]('ready');});_0x530bf8['on'](_0xa33a('0xb'),function(_0x4b2bd2){if(_0x4b2bd2[_0xa33a('0xc')]()==_0xa33a('0xd')){_0x31060d[_0xa33a('0xa')](_0xa33a('0xd'));return;}if(_0x4b2bd2[_0xa33a('0xe')](0x0,0xb)==_0xa33a('0xf')){_0x5b8073=!![];}if(_0x5b8073){_0x1655fa['rx']+=_0x4b2bd2+'\x0a';if(_0x4b2bd2[_0xa33a('0x10')](_0xa33a('0x11'))!=-0x1){_0x5b8073=![];}}else{_0x1655fa['rx']=_0x4b2bd2;}if(_0x5b8073){return;}if(typeof _0x1655fa['cb']==_0xa33a('0x12')){var _0x2db0b1=_0x1655fa['rx']['substring'](0x0,0x3),_0x1df689=null,_0x282f1b=null;_0x2db0b1=parseInt(_0x2db0b1);if(isNaN(_0x2db0b1)){_0x1655fa['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xa33a('0x13')});return;}if(_0x2db0b1!=0xc8){_0x1655fa['cb'](null,{'code':_0x2db0b1,'result':-0x1,'extra':'KO'});return;}_0x1df689=_0x1655fa['rx'][_0xa33a('0xe')](0x4)['replace']('result=','');if(_0x1df689[_0xa33a('0x14')]('\x20')!=-0x1){_0x1df689=_0x1df689[_0xa33a('0x15')](0x0,_0x1df689['indexOf']('\x20'));}if(_['startsWith'](_0x1df689,'-1')){_0x1df689=parseInt(_0x1df689);}_0x282f1b=_0x1655fa['rx']['split']('\x20');if(_0x282f1b[_0xa33a('0x16')]==0x3){_0x282f1b=_0x282f1b[0x2]['substring'](0x1,_0x282f1b[0x2][_0xa33a('0x16')]-0x1);}else if(_0x282f1b[_0xa33a('0x16')]>0x3){var _0x4087c8=/\((.+)\)/;var _0x31ec07=_0x1655fa['rx'][_0xa33a('0x17')](_0x4087c8);if(_0x31ec07){_0x282f1b=_0x31ec07[0x1];}else{_0x282f1b=null;}}else{_0x282f1b=null;}_0x1655fa['cb'](null,{'code':_0x2db0b1,'result':_0x1df689,'extra':_0x282f1b});}});_0x2ffdd6['on'](_0xa33a('0x18'),function(_0x951571){_0x31060d[_0xa33a('0xa')]('error',new AGIError(_0xa33a('0x19'),_0x951571[_0xa33a('0x1a')]));});_0x2ffdd6['on']('close',function(){_0x31060d[_0xa33a('0xa')](_0xa33a('0x1b'),new AGIError(_0xa33a('0x1c')));});_0x2ffdd6['on'](_0xa33a('0x1d'),function(){_0x31060d[_0xa33a('0xa')](_0xa33a('0x1d'),new AGIError(_0xa33a('0x1e')));_0x2ffdd6['destroy']();});_0x2ffdd6[_0xa33a('0x1f')](_0x530bf8);this[_0xa33a('0x20')]=function(_0x2fcb5a,_0x421771){var _0x2fcb5a=_0x2fcb5a||'',_0x421771=typeof _0x421771=='function'?_0x421771:new Function();_0x1655fa={'tx':_0x2fcb5a,'rx':'','cb':_0x421771};_0x2ffdd6[_0xa33a('0x21')](_0x2fcb5a+'\x0a');},this[_0xa33a('0x1b')]=function(){_0x2ffdd6[_0xa33a('0x22')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xa33a('0x23')]['sendRequest']=function(_0x1cd651){return this[_0xa33a('0x20')]['sync'](this,_0x1cd651);};AGIChannel[_0xa33a('0x23')]['answer']=function(){return this['sendRequest'](_0xa33a('0x24'));};AGIChannel[_0xa33a('0x23')][_0xa33a('0x25')]=function(_0xee59a6,_0x5090e4,_0x87c655){_0xee59a6=_0xee59a6===undefined?'beep':_0xee59a6;_0x5090e4=_0x5090e4===undefined?'5':_0x5090e4;_0x87c655=_0x87c655===undefined?'1':_0x87c655;return this['sendRequest'](util[_0xa33a('0x26')](_0xa33a('0x27'),_0xee59a6,_0x5090e4*0x3e8,_0x87c655));};AGIChannel[_0xa33a('0x23')]['noop']=function(_0x1f0af6){_0x1f0af6=_0x1f0af6||_0xa33a('0x28');return this[_0xa33a('0x29')](util[_0xa33a('0x26')](_0xa33a('0x2a'),_0x1f0af6));};AGIChannel['prototype'][_0xa33a('0x2b')]=function(_0x245ecc,_0x5745fb){if(_[_0xa33a('0x2c')](_0x5745fb)){return this[_0xa33a('0x29')](util[_0xa33a('0x26')](_0xa33a('0x2d'),_0x245ecc,_0x5745fb[_0xa33a('0x2e')](',')));}return this[_0xa33a('0x29')](util['format']('EXEC\x20%s\x20%s',_0x245ecc,_0x5745fb));};AGIChannel[_0xa33a('0x23')][_0xa33a('0x2f')]=function(_0x173001){return this['sendRequest'](util[_0xa33a('0x26')](_0xa33a('0x30'),_0x173001));};AGIChannel['prototype'][_0xa33a('0x31')]=function(_0x42c715){return this[_0xa33a('0x29')](util[_0xa33a('0x26')](_0xa33a('0x32'),_0x42c715));};AGIChannel['prototype']['setPriority']=function(_0x319b49){return this[_0xa33a('0x29')](util[_0xa33a('0x26')](_0xa33a('0x33'),_0x319b49));};AGIChannel[_0xa33a('0x23')][_0xa33a('0xd')]=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0xa33a('0x23')][_0xa33a('0x34')]=function(_0x24739e,_0x388750){var _0x103563=_[_0xa33a('0x35')](_0x388750)||_['isNumber'](_0x388750)?_0x388750[_0xa33a('0x36')]():_0x388750;return this['sendRequest'](util[_0xa33a('0x26')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x24739e,_0x103563?_0x103563[_0xa33a('0x36')]()[_0xa33a('0x37')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xa33a('0x38')]=function(_0x21222b,_0x1cd846){return this[_0xa33a('0x29')](util[_0xa33a('0x26')](_0xa33a('0x39'),_0x21222b,_0x1cd846));};AGIChannel[_0xa33a('0x23')][_0xa33a('0x3a')]=function(_0x469a79,_0xead1c2){return this[_0xa33a('0x29')](util['format'](_0xa33a('0x3b'),_0x469a79,_0xead1c2));};AGIChannel[_0xa33a('0x23')]['sayPhonetic']=function(_0x51b18e,_0x196485){return this[_0xa33a('0x29')](util['format'](_0xa33a('0x3c'),_0x51b18e,_0x196485));};AGIChannel[_0xa33a('0x23')][_0xa33a('0x3d')]=function(_0x182a83,_0x48d2a9,_0x1771e4){_0x48d2a9=_0x48d2a9||this[_0xa33a('0x3e')];_0x1771e4=_0x1771e4||0x1;this['setContext'](_0x182a83);this[_0xa33a('0x31')](_0x48d2a9);this['setPriority'](_0x1771e4);return this[_0xa33a('0x3f')](util[_0xa33a('0x26')](_0xa33a('0x40'),_0x182a83,_0x48d2a9,_0x1771e4));};AGIChannel[_0xa33a('0x23')][_0xa33a('0x41')]=function(_0x5a540e){return this['sendRequest'](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x5a540e));};AGIChannel[_0xa33a('0x23')][_0xa33a('0x42')]=function(_0x536c5e,_0x3cc299,_0x338583,_0x3fd52e,_0x43b097,_0x4d3540){_0x3cc299=_0x3cc299||_0xa33a('0x43');_0x338583=_0x338583||'';_0x3fd52e=_0x3fd52e===undefined?-0x1:_0x3fd52e==='-1'?-0x1:_0x3fd52e*0x3e8;_0x43b097=_0x43b097===undefined?'':'s='+_0x43b097;_0x4d3540=_0x4d3540?_0xa33a('0x44'):'';return this[_0xa33a('0x29')](util[_0xa33a('0x26')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x536c5e,_0x3cc299,_0x338583,_0x3fd52e,_0x4d3540,_0x43b097));};AGIChannel[_0xa33a('0x23')][_0xa33a('0x45')]=function(_0x58c02b,_0x46d2b6){_0x46d2b6=_0x46d2b6||'';return this['sendRequest'](util[_0xa33a('0x26')](_0xa33a('0x46'),_0x58c02b,_0x46d2b6));};AGIChannel['prototype'][_0xa33a('0x47')]=function(_0x5c8fe2){return this['exec'](_0xa33a('0x48'),_0x5c8fe2);};AGIChannel[_0xa33a('0x23')][_0xa33a('0x49')]=function(_0x2fd3c5){return this['exec']('WAIT',_0x2fd3c5);};AGIChannel[_0xa33a('0x23')][_0xa33a('0x18')]=function(_0x1eda10,_0x18e131){this[_0xa33a('0x3f')](util[_0xa33a('0x26')](_0xa33a('0x4a'),_0x1eda10['id'],_0x1eda10[_0xa33a('0x4b')],_0x18e131));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xa33a('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index b79b586..832e2d0 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 _0xac3b=['push','format','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac3b,0x1d5));var _0xbac3=function(_0x4c0619,_0x58dd6b){_0x4c0619=_0x4c0619-0x0;var _0x40ee84=_0xac3b[_0x4c0619];return _0x40ee84;};'use strict';var util=require(_0xbac3('0x0'));var error={'E_AGI_UNDEFINED':_0xbac3('0x1'),'E_AGI_ARGUMENT_PORT':_0xbac3('0x2'),'E_AGI_SERVER_ERROR':_0xbac3('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xbac3('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xbac3('0x5'),'E_AGI_SOCKET_ERROR':_0xbac3('0x6'),'E_AGI_SOCKET_CLOSE':_0xbac3('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xbac3('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xbac3('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0xbabecb){var _0xbabecb=_0xbabecb||null,_0x20edb3=_0x20edb3||[],_0x585924=0x1,_0x462343='';if(!error[_0xbabecb]){_0xbabecb=_0xbac3('0xa');}_0x20edb3[_0xbac3('0xb')](error[_0xbabecb]);while(arguments[_0x585924]){_0x20edb3[_0xbac3('0xb')](arguments[_0x585924]);_0x585924++;}_0x462343=util[_0xbac3('0xc')]['apply'](util,_0x20edb3);this['message']=_0x462343;this[_0xbac3('0xd')]=_0xbabecb;}module[_0xbac3('0xe')]=AGIError; \ No newline at end of file +var _0xfd5c=['Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','message','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xfd5c,0x175));var _0xcfd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd5c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xcfd5('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xcfd5('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xcfd5('0x2'),'E_AGI_SOCKET_ERROR':_0xcfd5('0x3'),'E_AGI_SOCKET_CLOSE':_0xcfd5('0x4'),'E_AGI_SOCKET_TIMEOUT':_0xcfd5('0x5'),'E_AGI_COMMAND_EMPTY':_0xcfd5('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xcfd5('0x7'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x60cdfe){var _0x60cdfe=_0x60cdfe||null,_0x1a68a8=_0x1a68a8||[],_0x2dcfdc=0x1,_0x129037='';if(!error[_0x60cdfe]){_0x60cdfe=_0xcfd5('0x8');}_0x1a68a8[_0xcfd5('0x9')](error[_0x60cdfe]);while(arguments[_0x2dcfdc]){_0x1a68a8[_0xcfd5('0x9')](arguments[_0x2dcfdc]);_0x2dcfdc++;}_0x129037=util['format']['apply'](util,_0x1a68a8);this[_0xcfd5('0xa')]=_0x129037;this[_0xcfd5('0xb')]=_0x60cdfe;}module[_0xcfd5('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 4e927d5..731941b 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 _0x4123=['info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','split','agicommand','vswitch','default','target','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','addVertex','prototype','addEdge','push','numberOfEdges','size','relations'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x4123,0x87));var _0x3412=function(_0x2a99f1,_0x198fd7){_0x2a99f1=_0x2a99f1-0x0;var _0x6948e5=_0x4123[_0x2a99f1];return _0x6948e5;};'use strict';var _=require(_0x3412('0x0'));var logger=require(_0x3412('0x1'))(_0x3412('0x2'));var verticesWithRetry=[_0x3412('0x3'),_0x3412('0x4'),_0x3412('0x5')];var Graph=function(){this[_0x3412('0x6')]={};this[_0x3412('0x7')]={};this['numberOfEdges']=0x0;};Graph['prototype'][_0x3412('0x8')]=function(_0x7bbf53){this['vertices'][_0x7bbf53['id']]=_0x7bbf53;this[_0x3412('0x7')][_0x7bbf53['id']]=[];};Graph[_0x3412('0x9')][_0x3412('0xa')]=function(_0x43f43c,_0x40c825,_0x2617a6){this['edges'][_0x43f43c][_0x3412('0xb')]({'target':_0x40c825,'condition':_0x2617a6});this[_0x3412('0xc')]+=0x1;};Graph[_0x3412('0x9')][_0x3412('0xd')]=function(){return _[_0x3412('0xd')](this[_0x3412('0x6')]);};Graph[_0x3412('0x9')][_0x3412('0xe')]=function(){return this[_0x3412('0xc')];};Graph['prototype']['getVertex']=function(_0x2967ee){return this[_0x3412('0x6')][_0x2967ee];};Graph[_0x3412('0x9')]['traverseBFS']=function(_0x548451,_0x50fbd4){if(!this[_0x3412('0x6')][_0x548451]){return logger[_0x3412('0xf')](_0x3412('0x10'));}var _0x19b3f8=_0x50fbd4(this[_0x3412('0x6')][_0x548451]);if(!_0x19b3f8){return logger[_0x3412('0xf')](_0x3412('0x11'));}if(this[_0x3412('0x7')][_0x548451][_0x3412('0x12')]===0x0){return logger[_0x3412('0xf')](_0x3412('0x13'));}for(var _0x382f11=0x0,_0x454cd0=[],_0x854010=![];_0x382f11\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./mailRpc','./graph','defaults','127.0.0.1','nextTick','error','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','message','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','source','target','addEdge','value','then','catch','agi_','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','sync','production','start','root','joinAt','traverseBFS','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0xc3a0,0x16d));var _0x0c3a=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0xc3a0[_0x264b9b];return _0x4c7a0e;};'use strict';var parser=require(_0x0c3a('0x0'));var _=require(_0x0c3a('0x1'));var syncho=require(_0x0c3a('0x2'));var util=require(_0x0c3a('0x3'));var moment=require(_0x0c3a('0x4'));var config=require(_0x0c3a('0x5'));var logger=require(_0x0c3a('0x6'))(_0x0c3a('0x7'));var utilLicense=require(_0x0c3a('0x8'));var rpc=require('./rpc');var mailRpc=require(_0x0c3a('0x9'));var Graph=require(_0x0c3a('0xa'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x0c3a('0x7')]=_[_0x0c3a('0xb')](config[_0x0c3a('0x7')],{'ip':_0x0c3a('0xc'),'port':0x11dd});function connectionHandler(_0x5a27ff){process[_0x0c3a('0xd')](function(){syncho(function(){try{setChannelVariables(_0x5a27ff);agiHandler(_0x5a27ff);}catch(_0x1e65c7){logger[_0x0c3a('0xe')](_0x1e65c7['stack']);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x0c3a('0xf')]);logger[_0x0c3a('0x10')](util[_0x0c3a('0x11')](_0x0c3a('0x12'),config[_0x0c3a('0x7')]['ip'],config[_0x0c3a('0x7')][_0x0c3a('0xf')]));}function errorHandler(_0x55704a){if(_0x55704a&&_0x55704a[_0x0c3a('0x13')]&&_0x55704a['message']){logger['error'](util[_0x0c3a('0x11')](_0x0c3a('0x14'),_0x55704a[_0x0c3a('0x13')],_0x55704a[_0x0c3a('0x15')]));}else{logger[_0x0c3a('0xe')](util[_0x0c3a('0x11')]('[ERROR]\x20%s',_0x55704a[_0x0c3a('0x16')]));}}function closeHandler(){logger[_0x0c3a('0x10')](util[_0x0c3a('0x11')](_0x0c3a('0x17'),this[_0x0c3a('0x18')],this[_0x0c3a('0x19')],this[_0x0c3a('0x1a')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x3f03dd){logger[_0x0c3a('0xe')](_0x3f03dd[_0x0c3a('0x16')]);}}function timeoutHandler(){logger[_0x0c3a('0x10')](util['format'](_0x0c3a('0x1b'),this['arg_1'],this['calleridname'],this[_0x0c3a('0x1a')],this[_0x0c3a('0x1c')],this[_0x0c3a('0x1d')]));}function hangupHandler(){logger[_0x0c3a('0x10')](util[_0x0c3a('0x11')](_0x0c3a('0x1e'),this['arg_1'],this[_0x0c3a('0x19')],this[_0x0c3a('0x1a')],this[_0x0c3a('0x1c')],this[_0x0c3a('0x1d')]));this[_0x0c3a('0x1f')]=!![];}function getRoot(_0x465e6a){return parser[_0x0c3a('0x20')](_0x465e6a,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x556df5,_0xf17ffb,_0x228d35){_0xf17ffb[_0x0c3a('0x21')]=_0x228d35;if(_0xf17ffb[_0x0c3a('0x22')](_0x0c3a('0x23'))){_0xf17ffb[_0x0c3a('0x24')]=parseInt(_0xf17ffb[_0x0c3a('0x23')],0xa);}_0x556df5[_0x0c3a('0x25')](_[_0x0c3a('0x26')](_0xf17ffb,_0x0c3a('0x27')));}function initGraph(_0x108292,_0x41c341){var _0x3f3fa7=new Graph();for(var _0x3dfe48 in _0x108292){if(_0x108292[_0x0c3a('0x22')](_0x3dfe48)){if(_['isArray'](_0x108292[_0x3dfe48])){for(var _0x12abb5=0x0;_0x12abb5<_0x108292[_0x3dfe48][_0x0c3a('0x28')];_0x12abb5+=0x1){addVertex(_0x3f3fa7,_0x108292[_0x3dfe48][_0x12abb5],_0x3dfe48);}}else{addVertex(_0x3f3fa7,_0x108292[_0x3dfe48],_0x3dfe48);}}}for(var _0x2c8b9d=0x0;_0x2c8b9d<_0x41c341[_0x0c3a('0x28')];_0x2c8b9d+=0x1){if(_0x41c341[_0x2c8b9d][_0x0c3a('0x29')]&&_0x41c341[_0x2c8b9d][_0x0c3a('0x2a')]){_0x3f3fa7[_0x0c3a('0x2b')](_0x41c341[_0x2c8b9d][_0x0c3a('0x29')],_0x41c341[_0x2c8b9d][_0x0c3a('0x2a')],_0x41c341[_0x2c8b9d][_0x0c3a('0x2c')]);}}return _0x3f3fa7;}function getSquareProject(_0x3a27fc,_0xd3e2a9){rpc['getSquareProject'](_0x3a27fc)['then'](function(_0x47c5a8){_0xd3e2a9(null,_0x47c5a8);})['catch'](function(_0x55aa9c){_0xd3e2a9(null,_0x55aa9c);});}function createSquareReport(_0x2f28e2,_0x465245){rpc['createSquareReport'](_0x2f28e2)[_0x0c3a('0x2d')](function(_0x3ae80e){if(_0x465245){_0x465245(null,_0x3ae80e);}})[_0x0c3a('0x2e')](function(_0x42bddf){if(_0x465245){_0x465245(null,_0x42bddf);}});}function setChannelVariables(_0x294d2f){for(var _0x44980c in _0x294d2f){if(_0x294d2f[_0x0c3a('0x22')](_0x44980c)){if(_0x44980c['indexOf'](_0x0c3a('0x2f'))===0x0){_0x294d2f[_0x44980c['substring'](0x4)]=_0x294d2f[_0x44980c];delete _0x294d2f[_0x44980c];}}}}function getLogFromObject(_0x5d15d1){return util[_0x0c3a('0x30')](_0x5d15d1,{'showHidden':![],'depth':null});}function agiHandler(_0x476d4f){var _0x17a3f2,_0x57e5de,_0x20c882,_0x1e29fa,_0x3e6fa0;logger[_0x0c3a('0x31')](_0x0c3a('0x32'),JSON[_0x0c3a('0x33')](_0x476d4f,null,0x2));logger[_0x0c3a('0x10')](util[_0x0c3a('0x11')](_0x0c3a('0x34'),_0x476d4f['arg_1'],_0x476d4f[_0x0c3a('0x19')],_0x476d4f[_0x0c3a('0x1a')],_0x476d4f[_0x0c3a('0x1c')],_0x476d4f[_0x0c3a('0x1d')]));_0x476d4f['on'](_0x0c3a('0xe'),errorHandler);_0x476d4f['on'](_0x0c3a('0x35'),closeHandler);_0x476d4f['on'](_0x0c3a('0x36'),timeoutHandler);_0x476d4f[_0x0c3a('0x1f')]=![];_0x476d4f['on']('hangup',hangupHandler);var _0x8dcaa4=getSquareProject[_0x0c3a('0x37')](null,_0x476d4f[_0x0c3a('0x18')]);if(_0x8dcaa4){if(_0x8dcaa4['production']){_0x17a3f2=getRoot(_0x8dcaa4[_0x0c3a('0x38')]);if(_0x17a3f2&&_0x17a3f2[_0x0c3a('0x39')]){logger[_0x0c3a('0x31')](_0x0c3a('0x3a'),JSON[_0x0c3a('0x33')](_0x17a3f2,null,0x2));_0x476d4f[_0x0c3a('0x3b')]=moment()[_0x0c3a('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x57e5de=initGraph(_[_0x0c3a('0x26')](_0x17a3f2,_0x0c3a('0x27')),_0x17a3f2['mxCell']);_0x20c882=new Vertices(_0x476d4f,rpc,mailRpc);logger[_0x0c3a('0x10')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x476d4f[_0x0c3a('0x18')],_0x476d4f[_0x0c3a('0x19')],_0x476d4f[_0x0c3a('0x1a')],_0x476d4f[_0x0c3a('0x1c')],_0x476d4f[_0x0c3a('0x1d')]));_0x57e5de[_0x0c3a('0x3c')](_0x17a3f2[_0x0c3a('0x39')]['id'],function(_0x4df3ab){try{_0x4df3ab=_0x20c882[_0x0c3a('0x3d')](_0x4df3ab);logger[_0x0c3a('0x31')](_0x0c3a('0x3e'),JSON[_0x0c3a('0x33')](_0x4df3ab,null,0x2));if(_0x4df3ab[_0x0c3a('0x21')]==='gotoc'){logger[_0x0c3a('0x10')](_0x0c3a('0x3f'));_0x476d4f['context']=_0x4df3ab['context']||_0x476d4f[_0x0c3a('0x40')];_0x476d4f[_0x0c3a('0x41')]=_0x4df3ab[_0x0c3a('0x41')];_0x476d4f['priority']=_0x4df3ab['priority']?_0x4df3ab[_0x0c3a('0x42')]-0x1:0x1;return null;}else if(_0x4df3ab&&_0x20c882[_0x4df3ab['agicommand']]){_0x3e6fa0=_0x20c882[_0x4df3ab[_0x0c3a('0x21')]](_0x4df3ab);logger[_0x0c3a('0x10')](_0x0c3a('0x43'),JSON[_0x0c3a('0x33')](_0x3e6fa0,null,0x2));if(_0x3e6fa0&&_0x3e6fa0[_0x0c3a('0x44')]===AGI_CODE_SUCCESS&&_0x3e6fa0[_0x0c3a('0x45')]!==AGI_RESULT_ERROR&&!_0x476d4f['evtHangup']){logger['debug']('response',getLogFromObject(_0x3e6fa0));return _[_0x0c3a('0x46')](_0x3e6fa0[_0x0c3a('0x45')])?null:_0x3e6fa0[_0x0c3a('0x45')][_0x0c3a('0x47')]();}else{logger[_0x0c3a('0xe')]('response',getLogFromObject(_0x3e6fa0));return null;}}else{logger[_0x0c3a('0xe')](_0x0c3a('0x48'));return null;}}catch(_0x3fb1c7){logger[_0x0c3a('0xe')](_0x3fb1c7[_0x0c3a('0x16')]);return null;}});if(_0x17a3f2[_0x0c3a('0x49')]){logger['info'](util[_0x0c3a('0x11')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x476d4f[_0x0c3a('0x18')],_0x476d4f[_0x0c3a('0x19')],_0x476d4f[_0x0c3a('0x1a')],_0x476d4f[_0x0c3a('0x1c')],_0x476d4f[_0x0c3a('0x1d')]));_0x57e5de[_0x0c3a('0x3c')](_0x17a3f2[_0x0c3a('0x49')]['id'],function(_0x47a7be){try{_0x47a7be=_0x20c882[_0x0c3a('0x3d')](_0x47a7be);logger[_0x0c3a('0x31')](_0x0c3a('0x3e'),JSON['stringify'](_0x47a7be,null,0x2));if(_0x47a7be&&_0x20c882[_0x47a7be[_0x0c3a('0x21')]]){_0x3e6fa0=_0x20c882[_0x47a7be['agicommand']](_0x47a7be);if(_0x3e6fa0){logger['debug'](_0x0c3a('0x43'),getLogFromObject(_0x3e6fa0));return _[_0x0c3a('0x46')](_0x3e6fa0[_0x0c3a('0x45')])?null:_0x3e6fa0['result'][_0x0c3a('0x47')]();}else{logger[_0x0c3a('0xe')](_0x0c3a('0x43'),getLogFromObject(_0x3e6fa0));return null;}}else{logger[_0x0c3a('0xe')](_0x0c3a('0x48'));return null;}}catch(_0x40fd87){logger[_0x0c3a('0xe')](_0x40fd87[_0x0c3a('0x16')]);return null;}});}logger[_0x0c3a('0x10')](util[_0x0c3a('0x11')](_0x0c3a('0x4a'),_0x476d4f[_0x0c3a('0x18')],_0x476d4f['calleridname'],_0x476d4f['callerid'],_0x476d4f['dnid'],_0x476d4f['uniqueid']));logger[_0x0c3a('0x10')](util[_0x0c3a('0x11')](_0x0c3a('0x4b'),_0x476d4f[_0x0c3a('0x40')],_0x476d4f[_0x0c3a('0x41')],parseInt(_0x476d4f[_0x0c3a('0x42')],0xa)+0x1));_0x476d4f[_0x0c3a('0x4c')](_0x476d4f[_0x0c3a('0x40')],_0x476d4f['extension'],parseInt(_0x476d4f[_0x0c3a('0x42')],0xa)+0x1);_0x476d4f[_0x0c3a('0x35')]();}}else{logger[_0x0c3a('0xe')](util[_0x0c3a('0x11')](_0x0c3a('0x4d'),_0x476d4f[_0x0c3a('0x18')]));_0x476d4f['continueAt'](_0x476d4f[_0x0c3a('0x40')],_0x476d4f['extension'],parseInt(_0x476d4f[_0x0c3a('0x42')],0xa)+0x1);_0x476d4f['close']();}}else{logger[_0x0c3a('0xe')](util[_0x0c3a('0x11')](_0x0c3a('0x4e'),_0x476d4f[_0x0c3a('0x18')]));_0x476d4f[_0x0c3a('0x4c')](_0x476d4f[_0x0c3a('0x40')],_0x476d4f[_0x0c3a('0x41')],parseInt(_0x476d4f[_0x0c3a('0x42')],0xa)+0x1);_0x476d4f['close']();}}function main(){var _0x2dc8f9;return utilLicense[_0x0c3a('0x4f')]()['then'](function(_0x4eecdd){if(_0x4eecdd){if(_0x4eecdd[_0x0c3a('0x50')]){if(_0x4eecdd[_0x0c3a('0x51')]&&_0x4eecdd[_0x0c3a('0x51')]>0x0){logger[_0x0c3a('0x10')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x4eecdd[_0x0c3a('0x51')]));_0x2dc8f9=_0x4eecdd[_0x0c3a('0x51')];}else{logger['info'](_0x0c3a('0x52'));}}else{logger[_0x0c3a('0x10')](_0x0c3a('0x53'));_0x2dc8f9=-0x1;}}})[_0x0c3a('0x2e')](function(_0x37743d){logger[_0x0c3a('0xe')]('[LICENSE]',_0x37743d[_0x0c3a('0x16')]);})[_0x0c3a('0x49')](function(){var _0x14de2c=require(_0x0c3a('0x54'))(config[_0x0c3a('0x7')][_0x0c3a('0xf')],config[_0x0c3a('0x7')]['ip'],_0x2dc8f9);_0x14de2c['on'](_0x0c3a('0xe'),errorHandler);_0x14de2c['on'](_0x0c3a('0x55'),listeningHandler);_0x14de2c['on'](_0x0c3a('0x56'),connectionHandler);_0x14de2c['on'](_0x0c3a('0x35'),closeHandler);});}main(); \ No newline at end of file +var _0x0a90=['sync','production','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','[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','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','xml2json','lodash','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./vertices','agi','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','evtHangup','toJson','agicommand','maxRetry','retry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','addEdge','source','target','then','catch','substring','inspect','debug','variables','close','timeout','hangup'];(function(_0x1f5cb0,_0x3212e6){var _0x110d95=function(_0x1d0f74){while(--_0x1d0f74){_0x1f5cb0['push'](_0x1f5cb0['shift']());}};_0x110d95(++_0x3212e6);}(_0x0a90,0x1e7));var _0x00a9=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x0a90[_0x20ef64];return _0x3707d8;};'use strict';var parser=require(_0x00a9('0x0'));var _=require(_0x00a9('0x1'));var syncho=require('syncho');var util=require(_0x00a9('0x2'));var moment=require(_0x00a9('0x3'));var config=require(_0x00a9('0x4'));var logger=require(_0x00a9('0x5'))('agi');var utilLicense=require(_0x00a9('0x6'));var rpc=require(_0x00a9('0x7'));var mailRpc=require(_0x00a9('0x8'));var Graph=require('./graph');var Vertices=require(_0x00a9('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x00a9('0xa')]=_['defaults'](config['agi'],{'ip':_0x00a9('0xb'),'port':0x11dd});function connectionHandler(_0x1ecb0d){process[_0x00a9('0xc')](function(){syncho(function(){try{setChannelVariables(_0x1ecb0d);agiHandler(_0x1ecb0d);}catch(_0x1cc483){logger[_0x00a9('0xd')](_0x1cc483[_0x00a9('0xe')]);}});});}function listeningHandler(){console[_0x00a9('0xf')](_0x00a9('0x10'),config[_0x00a9('0xa')]['port']);logger[_0x00a9('0x11')](util[_0x00a9('0x12')](_0x00a9('0x13'),config[_0x00a9('0xa')]['ip'],config[_0x00a9('0xa')][_0x00a9('0x14')]));}function errorHandler(_0x51395b){if(_0x51395b&&_0x51395b[_0x00a9('0x15')]&&_0x51395b['message']){logger['error'](util[_0x00a9('0x12')]('[%s]\x20%s',_0x51395b[_0x00a9('0x15')],_0x51395b['message']));}else{logger[_0x00a9('0xd')](util[_0x00a9('0x12')](_0x00a9('0x16'),_0x51395b[_0x00a9('0xe')]));}}function closeHandler(){logger['info'](util['format'](_0x00a9('0x17'),this['arg_1'],this[_0x00a9('0x18')],this[_0x00a9('0x19')],this['dnid'],this[_0x00a9('0x1a')]));try{createSquareReport(this);}catch(_0x5ddcc8){logger[_0x00a9('0xd')](_0x5ddcc8[_0x00a9('0xe')]);}}function timeoutHandler(){logger[_0x00a9('0x11')](util[_0x00a9('0x12')](_0x00a9('0x1b'),this[_0x00a9('0x1c')],this[_0x00a9('0x18')],this[_0x00a9('0x19')],this[_0x00a9('0x1d')],this[_0x00a9('0x1a')]));}function hangupHandler(){logger[_0x00a9('0x11')](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x00a9('0x1c')],this['calleridname'],this['callerid'],this[_0x00a9('0x1d')],this['uniqueid']));this[_0x00a9('0x1e')]=!![];}function getRoot(_0x123270){return parser[_0x00a9('0x1f')](_0x123270,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x311dd2,_0x192781,_0x4abb29){_0x192781[_0x00a9('0x20')]=_0x4abb29;if(_0x192781['hasOwnProperty']('retry')){_0x192781[_0x00a9('0x21')]=parseInt(_0x192781[_0x00a9('0x22')],0xa);}_0x311dd2[_0x00a9('0x23')](_[_0x00a9('0x24')](_0x192781,_0x00a9('0x25')));}function initGraph(_0x55fa59,_0xebf50f){var _0x462865=new Graph();for(var _0x4d4bf3 in _0x55fa59){if(_0x55fa59[_0x00a9('0x26')](_0x4d4bf3)){if(_[_0x00a9('0x27')](_0x55fa59[_0x4d4bf3])){for(var _0x48da17=0x0;_0x48da17<_0x55fa59[_0x4d4bf3][_0x00a9('0x28')];_0x48da17+=0x1){addVertex(_0x462865,_0x55fa59[_0x4d4bf3][_0x48da17],_0x4d4bf3);}}else{addVertex(_0x462865,_0x55fa59[_0x4d4bf3],_0x4d4bf3);}}}for(var _0x48dd86=0x0;_0x48dd86<_0xebf50f[_0x00a9('0x28')];_0x48dd86+=0x1){if(_0xebf50f[_0x48dd86]['source']&&_0xebf50f[_0x48dd86]['target']){_0x462865[_0x00a9('0x29')](_0xebf50f[_0x48dd86][_0x00a9('0x2a')],_0xebf50f[_0x48dd86][_0x00a9('0x2b')],_0xebf50f[_0x48dd86]['value']);}}return _0x462865;}function getSquareProject(_0x30a318,_0x313e94){rpc['getSquareProject'](_0x30a318)[_0x00a9('0x2c')](function(_0x57e7fb){_0x313e94(null,_0x57e7fb);})[_0x00a9('0x2d')](function(_0x1122d3){_0x313e94(null,_0x1122d3);});}function createSquareReport(_0xdaa373,_0x757d3){rpc['createSquareReport'](_0xdaa373)['then'](function(_0x38f79d){if(_0x757d3){_0x757d3(null,_0x38f79d);}})[_0x00a9('0x2d')](function(_0x3e3f0f){if(_0x757d3){_0x757d3(null,_0x3e3f0f);}});}function setChannelVariables(_0x4c5710){for(var _0x3647b7 in _0x4c5710){if(_0x4c5710[_0x00a9('0x26')](_0x3647b7)){if(_0x3647b7['indexOf']('agi_')===0x0){_0x4c5710[_0x3647b7[_0x00a9('0x2e')](0x4)]=_0x4c5710[_0x3647b7];delete _0x4c5710[_0x3647b7];}}}}function getLogFromObject(_0x2e4e7e){return util[_0x00a9('0x2f')](_0x2e4e7e,{'showHidden':![],'depth':null});}function agiHandler(_0x2ddd12){var _0x2e3520,_0x11553c,_0x312dab,_0x30b9f2,_0xa5c732;logger[_0x00a9('0x30')](_0x00a9('0x31'),JSON['stringify'](_0x2ddd12,null,0x2));logger[_0x00a9('0x11')](util[_0x00a9('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2ddd12['arg_1'],_0x2ddd12[_0x00a9('0x18')],_0x2ddd12[_0x00a9('0x19')],_0x2ddd12[_0x00a9('0x1d')],_0x2ddd12[_0x00a9('0x1a')]));_0x2ddd12['on'](_0x00a9('0xd'),errorHandler);_0x2ddd12['on'](_0x00a9('0x32'),closeHandler);_0x2ddd12['on'](_0x00a9('0x33'),timeoutHandler);_0x2ddd12[_0x00a9('0x1e')]=![];_0x2ddd12['on'](_0x00a9('0x34'),hangupHandler);var _0x8b152c=getSquareProject[_0x00a9('0x35')](null,_0x2ddd12[_0x00a9('0x1c')]);if(_0x8b152c){if(_0x8b152c[_0x00a9('0x36')]){_0x2e3520=getRoot(_0x8b152c['production']);if(_0x2e3520&&_0x2e3520[_0x00a9('0x37')]){logger['debug'](_0x00a9('0x38'),JSON['stringify'](_0x2e3520,null,0x2));_0x2ddd12[_0x00a9('0x39')]=moment()[_0x00a9('0x12')](_0x00a9('0x3a'));_0x11553c=initGraph(_[_0x00a9('0x24')](_0x2e3520,'mxCell'),_0x2e3520[_0x00a9('0x25')]);_0x312dab=new Vertices(_0x2ddd12,rpc,mailRpc);logger[_0x00a9('0x11')](util['format'](_0x00a9('0x3b'),_0x2ddd12[_0x00a9('0x1c')],_0x2ddd12['calleridname'],_0x2ddd12[_0x00a9('0x19')],_0x2ddd12[_0x00a9('0x1d')],_0x2ddd12[_0x00a9('0x1a')]));_0x11553c[_0x00a9('0x3c')](_0x2e3520[_0x00a9('0x37')]['id'],function(_0xed183){try{_0xed183=_0x312dab[_0x00a9('0x3d')](_0xed183);logger['debug'](_0x00a9('0x3e'),JSON[_0x00a9('0x3f')](_0xed183,null,0x2));if(_0xed183[_0x00a9('0x20')]===_0x00a9('0x40')){logger[_0x00a9('0x11')](_0x00a9('0x41'));_0x2ddd12[_0x00a9('0x42')]=_0xed183[_0x00a9('0x42')]||_0x2ddd12[_0x00a9('0x42')];_0x2ddd12[_0x00a9('0x43')]=_0xed183[_0x00a9('0x43')];_0x2ddd12[_0x00a9('0x44')]=_0xed183[_0x00a9('0x44')]?_0xed183[_0x00a9('0x44')]-0x1:0x1;return null;}else if(_0xed183&&_0x312dab[_0xed183['agicommand']]){_0xa5c732=_0x312dab[_0xed183['agicommand']](_0xed183);logger['info'](_0x00a9('0x45'),JSON[_0x00a9('0x3f')](_0xa5c732,null,0x2));if(_0xa5c732&&_0xa5c732[_0x00a9('0x46')]===AGI_CODE_SUCCESS&&_0xa5c732['result']!==AGI_RESULT_ERROR&&!_0x2ddd12['evtHangup']){logger[_0x00a9('0x30')](_0x00a9('0x45'),getLogFromObject(_0xa5c732));return _[_0x00a9('0x47')](_0xa5c732['result'])?null:_0xa5c732[_0x00a9('0x48')]['toString']();}else{logger[_0x00a9('0xd')](_0x00a9('0x45'),getLogFromObject(_0xa5c732));return null;}}else{logger['error'](_0x00a9('0x49'));return null;}}catch(_0x42ccc9){logger[_0x00a9('0xd')](_0x42ccc9[_0x00a9('0xe')]);return null;}});if(_0x2e3520[_0x00a9('0x4a')]){logger[_0x00a9('0x11')](util[_0x00a9('0x12')](_0x00a9('0x4b'),_0x2ddd12[_0x00a9('0x1c')],_0x2ddd12[_0x00a9('0x18')],_0x2ddd12[_0x00a9('0x19')],_0x2ddd12['dnid'],_0x2ddd12[_0x00a9('0x1a')]));_0x11553c[_0x00a9('0x3c')](_0x2e3520[_0x00a9('0x4a')]['id'],function(_0x3dfe7e){try{_0x3dfe7e=_0x312dab[_0x00a9('0x3d')](_0x3dfe7e);logger[_0x00a9('0x30')](_0x00a9('0x3e'),JSON[_0x00a9('0x3f')](_0x3dfe7e,null,0x2));if(_0x3dfe7e&&_0x312dab[_0x3dfe7e[_0x00a9('0x20')]]){_0xa5c732=_0x312dab[_0x3dfe7e[_0x00a9('0x20')]](_0x3dfe7e);if(_0xa5c732){logger[_0x00a9('0x30')](_0x00a9('0x45'),getLogFromObject(_0xa5c732));return _[_0x00a9('0x47')](_0xa5c732[_0x00a9('0x48')])?null:_0xa5c732[_0x00a9('0x48')][_0x00a9('0x4c')]();}else{logger[_0x00a9('0xd')](_0x00a9('0x45'),getLogFromObject(_0xa5c732));return null;}}else{logger[_0x00a9('0xd')](_0x00a9('0x49'));return null;}}catch(_0x247675){logger[_0x00a9('0xd')](_0x247675[_0x00a9('0xe')]);return null;}});}logger[_0x00a9('0x11')](util[_0x00a9('0x12')](_0x00a9('0x4d'),_0x2ddd12[_0x00a9('0x1c')],_0x2ddd12[_0x00a9('0x18')],_0x2ddd12[_0x00a9('0x19')],_0x2ddd12[_0x00a9('0x1d')],_0x2ddd12[_0x00a9('0x1a')]));logger[_0x00a9('0x11')](util[_0x00a9('0x12')](_0x00a9('0x4e'),_0x2ddd12[_0x00a9('0x42')],_0x2ddd12['extension'],parseInt(_0x2ddd12[_0x00a9('0x44')],0xa)+0x1));_0x2ddd12['continueAt'](_0x2ddd12[_0x00a9('0x42')],_0x2ddd12[_0x00a9('0x43')],parseInt(_0x2ddd12[_0x00a9('0x44')],0xa)+0x1);_0x2ddd12[_0x00a9('0x32')]();}}else{logger[_0x00a9('0xd')](util['format'](_0x00a9('0x4f'),_0x2ddd12['arg_1']));_0x2ddd12[_0x00a9('0x50')](_0x2ddd12['context'],_0x2ddd12[_0x00a9('0x43')],parseInt(_0x2ddd12[_0x00a9('0x44')],0xa)+0x1);_0x2ddd12['close']();}}else{logger[_0x00a9('0xd')](util[_0x00a9('0x12')](_0x00a9('0x51'),_0x2ddd12[_0x00a9('0x1c')]));_0x2ddd12['continueAt'](_0x2ddd12[_0x00a9('0x42')],_0x2ddd12['extension'],parseInt(_0x2ddd12[_0x00a9('0x44')],0xa)+0x1);_0x2ddd12['close']();}}function main(){var _0x19b8bf;return utilLicense[_0x00a9('0x52')]()[_0x00a9('0x2c')](function(_0x3a44ef){if(_0x3a44ef){if(_0x3a44ef[_0x00a9('0x53')]){if(_0x3a44ef[_0x00a9('0x54')]&&_0x3a44ef[_0x00a9('0x54')]>0x0){logger[_0x00a9('0x11')](util[_0x00a9('0x12')](_0x00a9('0x55'),_0x3a44ef['callysquare']));_0x19b8bf=_0x3a44ef[_0x00a9('0x54')];}else{logger[_0x00a9('0x11')](_0x00a9('0x56'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x19b8bf=-0x1;}}})[_0x00a9('0x2d')](function(_0x3b8f6d){logger[_0x00a9('0xd')](_0x00a9('0x57'),_0x3b8f6d[_0x00a9('0xe')]);})['finally'](function(){var _0x5e202f=require(_0x00a9('0x58'))(config[_0x00a9('0xa')][_0x00a9('0x14')],config[_0x00a9('0xa')]['ip'],_0x19b8bf);_0x5e202f['on'](_0x00a9('0xd'),errorHandler);_0x5e202f['on'](_0x00a9('0x59'),listeningHandler);_0x5e202f['on']('connection',connectionHandler);_0x5e202f['on'](_0x00a9('0x32'),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 ac55966..5464c3e 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 _0x0cc1=['then','error','message','catch','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x0cc1,0x181));var _0x10cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cc1[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x10cc('0x0'));var jayson=require(_0x10cc('0x1'));var client=jayson[_0x10cc('0x2')][_0x10cc('0x3')]({'port':0x232b});function request(_0x5b2710,_0x2d2535){return new BPromise(function(_0x5acdb8,_0x454e00){return client[_0x10cc('0x4')](_0x5b2710,_0x2d2535)[_0x10cc('0x5')](function(_0x26a1a7){if(_0x26a1a7[_0x10cc('0x6')]){return _0x454e00(_0x26a1a7[_0x10cc('0x6')][_0x10cc('0x7')]);}else{return _0x5acdb8(_0x26a1a7['result']);}})[_0x10cc('0x8')](function(_0x58d662){return _0x454e00(_0x58d662);});});}exports['sendMailMessage']=function(_0x40198a,_0x33338c){return request(_0x10cc('0x9'),{'account':_0x40198a,'message':_0x33338c});}; \ No newline at end of file +var _0x7ec9=['SendMail','bluebird','jayson/promise','client','http','request','error','message','result','sendMailMessage'];(function(_0x2adb29,_0x2d4933){var _0x3f7e01=function(_0x5503f5){while(--_0x5503f5){_0x2adb29['push'](_0x2adb29['shift']());}};_0x3f7e01(++_0x2d4933);}(_0x7ec9,0xa1));var _0x97ec=function(_0x495b3d,_0x4d3da4){_0x495b3d=_0x495b3d-0x0;var _0x4cb329=_0x7ec9[_0x495b3d];return _0x4cb329;};'use strict';var BPromise=require(_0x97ec('0x0'));var jayson=require(_0x97ec('0x1'));var client=jayson[_0x97ec('0x2')][_0x97ec('0x3')]({'port':0x232b});function request(_0x3f95a5,_0x97547){return new BPromise(function(_0xb36106,_0x16880f){return client[_0x97ec('0x4')](_0x3f95a5,_0x97547)['then'](function(_0x4792c5){if(_0x4792c5['error']){return _0x16880f(_0x4792c5[_0x97ec('0x5')][_0x97ec('0x6')]);}else{return _0xb36106(_0x4792c5[_0x97ec('0x7')]);}})['catch'](function(_0x397631){return _0x16880f(_0x397631);});});}exports[_0x97ec('0x8')]=function(_0x2b6aca,_0xa8f17f){return request(_0x97ec('0x9'),{'account':_0x2b6aca,'message':_0xa8f17f});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index adac157..3e78025 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 _0x3ee7=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','length','split','slice','emit','headers','substring','exports','stream'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x3ee7,0x98));var _0x73ee=function(_0x4814aa,_0x44afeb){_0x4814aa=_0x4814aa-0x0;var _0x49b7d5=_0x3ee7[_0x4814aa];return _0x49b7d5;};'use strict';var util=require('util');var Transform=require(_0x73ee('0x0'))['Transform'];function AGIReply(_0x4fb747){Transform[_0x73ee('0x1')](this,_0x4fb747);this['_localBuffer']='';this[_0x73ee('0x2')]=![];}util[_0x73ee('0x3')](AGIReply,Transform);AGIReply[_0x73ee('0x4')][_0x73ee('0x5')]=function(_0x4f49d1,_0x62e720,_0x2bc2c1){var _0x447c6f='\x0a',_0x4c78de=['\x0a\x0a',_0x73ee('0x6')],_0x36cb7c=-0x1,_0x2a7359=-0x1,_0x48ec48='',_0x32c472=0x0,_0x4a0f0a='',_0x311370='';this[_0x73ee('0x7')]+=_0x4f49d1[_0x73ee('0x8')]();_0x4a0f0a=this[_0x73ee('0x7')];if(!this['_inBody']){_0x32c472=0x0;while(_0x4c78de[_0x32c472]){while((_0x2a7359=_0x4a0f0a[_0x73ee('0x9')](_0x4c78de[_0x32c472]))!=-0x1){_0x48ec48=_0x4c78de[_0x32c472];_0x311370=_0x4a0f0a['substring'](0x0,_0x2a7359);_0x4a0f0a=_0x4a0f0a['substring'](_0x2a7359+_0x48ec48[_0x73ee('0xa')]);var _0x5a4111=_0x311370[_0x73ee('0xb')](_0x447c6f),_0x35e995=0x0,_0x39e928={},_0x4c26a7='',_0x4f62ff='',_0x408377=-0x1;while(_0x5a4111[_0x35e995]){_0x408377=_0x5a4111[_0x35e995]['indexOf'](':');if(_0x408377!=-0x1){_0x4c26a7=_0x5a4111[_0x35e995][_0x73ee('0xc')](0x0,_0x408377)['trim']();_0x4f62ff=_0x5a4111[_0x35e995][_0x73ee('0xc')](_0x408377+0x1)['trim']();if(_0x4c26a7[_0x73ee('0xa')]>0x0){_0x39e928[_0x4c26a7]=_0x4f62ff;}}else{}_0x35e995++;}this[_0x73ee('0xd')](_0x73ee('0xe'),_0x39e928);this['_inBody']=!![];}_0x32c472++;}this['_localBuffer']=_0x4a0f0a;}else{while((_0x36cb7c=_0x4a0f0a[_0x73ee('0x9')](_0x447c6f))!=-0x1){_0x311370=_0x4a0f0a[_0x73ee('0xf')](0x0,_0x36cb7c);this['emit']('line',_0x311370);_0x4a0f0a=_0x4a0f0a['substring'](_0x36cb7c+_0x447c6f['length']);}this['_localBuffer']=_0x4a0f0a;}_0x2bc2c1();};module[_0x73ee('0x10')]=AGIReply; \ No newline at end of file +var _0x36b7=['emit','util','stream','Transform','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','substring','length','split','indexOf','slice','trim','headers'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x36b7,0x1bb));var _0x736b=function(_0xdd1f1b,_0x4a823f){_0xdd1f1b=_0xdd1f1b-0x0;var _0x3252b1=_0x36b7[_0xdd1f1b];return _0x3252b1;};'use strict';var util=require(_0x736b('0x0'));var Transform=require(_0x736b('0x1'))[_0x736b('0x2')];function AGIReply(_0x423088){Transform['call'](this,_0x423088);this[_0x736b('0x3')]='';this[_0x736b('0x4')]=![];}util[_0x736b('0x5')](AGIReply,Transform);AGIReply[_0x736b('0x6')][_0x736b('0x7')]=function(_0x5ae441,_0x2f82ab,_0x2851c2){var _0x1eca9e='\x0a',_0x269afa=['\x0a\x0a',_0x736b('0x8')],_0x47afad=-0x1,_0x3879d3=-0x1,_0x365481='',_0x124257=0x0,_0x1cf182='',_0x4488ad='';this[_0x736b('0x3')]+=_0x5ae441['toString']();_0x1cf182=this[_0x736b('0x3')];if(!this[_0x736b('0x4')]){_0x124257=0x0;while(_0x269afa[_0x124257]){while((_0x3879d3=_0x1cf182['indexOf'](_0x269afa[_0x124257]))!=-0x1){_0x365481=_0x269afa[_0x124257];_0x4488ad=_0x1cf182[_0x736b('0x9')](0x0,_0x3879d3);_0x1cf182=_0x1cf182['substring'](_0x3879d3+_0x365481[_0x736b('0xa')]);var _0x34db6d=_0x4488ad[_0x736b('0xb')](_0x1eca9e),_0x5f1a1d=0x0,_0x5670a9={},_0x646209='',_0x5249cf='',_0x43d45a=-0x1;while(_0x34db6d[_0x5f1a1d]){_0x43d45a=_0x34db6d[_0x5f1a1d][_0x736b('0xc')](':');if(_0x43d45a!=-0x1){_0x646209=_0x34db6d[_0x5f1a1d][_0x736b('0xd')](0x0,_0x43d45a)[_0x736b('0xe')]();_0x5249cf=_0x34db6d[_0x5f1a1d][_0x736b('0xd')](_0x43d45a+0x1)[_0x736b('0xe')]();if(_0x646209['length']>0x0){_0x5670a9[_0x646209]=_0x5249cf;}}else{}_0x5f1a1d++;}this['emit'](_0x736b('0xf'),_0x5670a9);this[_0x736b('0x4')]=!![];}_0x124257++;}this[_0x736b('0x3')]=_0x1cf182;}else{while((_0x47afad=_0x1cf182[_0x736b('0xc')](_0x1eca9e))!=-0x1){_0x4488ad=_0x1cf182['substring'](0x0,_0x47afad);this[_0x736b('0x10')]('line',_0x4488ad);_0x1cf182=_0x1cf182[_0x736b('0x9')](_0x47afad+_0x1eca9e[_0x736b('0xa')]);}this[_0x736b('0x3')]=_0x1cf182;}_0x2851c2();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 7a2710d..6fd9f70 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 _0x334e=['save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','ShowPause','LoginUser','agentUnpause','bluebird','moment','lodash','util','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','ShowTrunk','getSoundById','ShowSound'];(function(_0x3f52d9,_0x1d748c){var _0x21e01f=function(_0x22e584){while(--_0x22e584){_0x3f52d9['push'](_0x3f52d9['shift']());}};_0x21e01f(++_0x1d748c);}(_0x334e,0x1d9));var _0xe334=function(_0x17a8cf,_0x1e70c1){_0x17a8cf=_0x17a8cf-0x0;var _0x375bc3=_0x334e[_0x17a8cf];return _0x375bc3;};'use strict';var BPromise=require(_0xe334('0x0'));var moment=require(_0xe334('0x1'));var _=require(_0xe334('0x2'));var util=require(_0xe334('0x3'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe334('0x4')]({'port':0x2329});function request(_0x529354,_0x4465f9){return new BPromise(function(_0x251d2a,_0x48d658){return client[_0xe334('0x5')](_0x529354,_0x4465f9)[_0xe334('0x6')](function(_0x17f3fc){if(_0x17f3fc[_0xe334('0x7')]){return _0x48d658(_0x17f3fc[_0xe334('0x7')][_0xe334('0x8')]);}else{return _0x251d2a(_0x17f3fc[_0xe334('0x9')]);}})[_0xe334('0xa')](function(_0x3a9ff8){return _0x48d658(_0x3a9ff8);});});}exports[_0xe334('0xb')]=function(_0x365d0e){return request(_0xe334('0xc'),{'options':{'raw':![],'where':{'name':_0x365d0e},'attributes':[_0xe334('0xd')]}});};exports[_0xe334('0xe')]=function(_0x42a7ed){return request(_0xe334('0xf'),{'options':{'raw':![],'where':{'id':_0x42a7ed},'include':[{'model':_0xe334('0x10'),'as':_0xe334('0x11')}],'attributes':['id',_0xe334('0x12'),_0xe334('0x13')]}});};exports['getSquareProjectById']=function(_0x201d34){return request(_0xe334('0xc'),{'options':{'where':{'id':_0x201d34},'attributes':[_0xe334('0x12')]}});};exports[_0xe334('0x14')]=function(_0x54d2c4){return request(_0xe334('0x15'),{'options':{'where':{'id':_0x54d2c4},'attributes':[_0xe334('0x12')]}});};exports[_0xe334('0x16')]=function(_0xfd92c0){return request(_0xe334('0x17'),{'options':{'where':{'id':_0xfd92c0},'attributes':[_0xe334('0x12')]}});};exports[_0xe334('0x18')]=function(_0x3d360b){return request(_0xe334('0x19'),{'options':{'where':{'id':_0x3d360b},'attributes':[_0xe334('0x1a')]}});};exports['getUserById']=function(_0x4f4f99){return request(_0xe334('0x1b'),{'options':{'where':{'id':_0x4f4f99},'attributes':[_0xe334('0x12')]}});};exports['getTrunkById']=function(_0x2d7051){return request(_0xe334('0x1c'),{'options':{'where':{'id':_0x2d7051},'attributes':[_0xe334('0x12')]}});};exports[_0xe334('0x1d')]=function(_0x2e6c79){return request(_0xe334('0x1e'),{'options':{'where':{'id':_0x2e6c79},'attributes':[_0xe334('0x1f')]}});};exports[_0xe334('0x20')]=function(_0x908641){return request(_0xe334('0x21'),{'options':{'raw':![],'where':{'id':_0x908641},'include':[{'model':_0xe334('0x22'),'as':_0xe334('0x23')}]}});};exports[_0xe334('0x24')]=function(_0x472978){return request('ShowSmsAccount',{'options':{'where':{'id':_0x472978},'attributes':['id',_0xe334('0x12')]}});};exports['createSmsMessage']=function(_0x13c53d){return request('CreateSmsMessage',{'body':_0x13c53d});};exports[_0xe334('0x25')]=function(_0x2758b7){return request(_0xe334('0x26'),{'body':_0x2758b7});};exports[_0xe334('0x27')]=function(_0xe330fe){return request(_0xe334('0x28'),{'body':_[_0xe334('0x29')](_0xe330fe,{'project_name':_0xe330fe[_0xe334('0x2a')],'prev_project_name':_0xe330fe['arg_2']||'','is_subproject':_0xe330fe[_0xe334('0x2b')]?!![]:![],'leaveAt':moment()[_0xe334('0x2c')](_0xe334('0x2d'))})});};exports['createSquareRecording']=function(_0x1598e5){return request(_0xe334('0x2e'),{'body':_0x1598e5});};exports[_0xe334('0x2f')]=function(_0x5ba93a){return request(_0xe334('0x30'),{'body':_0x5ba93a});};exports[_0xe334('0x31')]=function(_0x1ce148){return request(_0xe334('0x32'),{'options':{'raw':![],'where':{'phone':_0x1ce148[_0xe334('0x33')],'ListId':_0x1ce148[_0xe334('0x34')]}}})[_0xe334('0x6')](function(_0x2d06cb){if(_0x2d06cb){return _0x2d06cb;}return request('CreateCmContact',{'body':_0x1ce148});});};exports['getPauseById']=function(_0x5dbc2c){return request(_0xe334('0x35'),{'options':{'where':{'id':_0x5dbc2c},'attributes':[_0xe334('0x12')]}});};exports['agentLogin']=function(_0x13996c,_0x11c498){return request(_0xe334('0x36'),{'body':{'interface':_0x11c498},'options':{'where':_0x13996c}});};exports['agentPause']=function(_0x243223,_0x9e41ef,_0x28f34a){return request('PauseUser',{'body':{'type':_0x9e41ef,'uniqueid':_0x28f34a},'options':{'where':_0x243223}});};exports[_0xe334('0x37')]=function(_0x18dbe2){return request('UnpauseUser',{'body':{},'options':{'where':_0x18dbe2}});};exports['agentLogout']=function(_0x33bbf4){return request('LogoutUser',{'body':{},'options':{'where':_0x33bbf4}});}; \ No newline at end of file +var _0x6dd9=['http','request','then','error','message','result','catch','ShowSquareProject','production','MailServerOut','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Intervals','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','jayson/promise'];(function(_0x5bb7ba,_0x330a53){var _0x1f3daa=function(_0x19479e){while(--_0x19479e){_0x5bb7ba['push'](_0x5bb7ba['shift']());}};_0x1f3daa(++_0x330a53);}(_0x6dd9,0x1c6));var _0x96dd=function(_0x147893,_0x4afae8){_0x147893=_0x147893-0x0;var _0x456c32=_0x6dd9[_0x147893];return _0x456c32;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x96dd('0x0'));var util=require('util');var jayson=require(_0x96dd('0x1'));var client=jayson['client'][_0x96dd('0x2')]({'port':0x2329});function request(_0x1901c1,_0x296afb){return new BPromise(function(_0xc989b5,_0x54c160){return client[_0x96dd('0x3')](_0x1901c1,_0x296afb)[_0x96dd('0x4')](function(_0x4b0f87){if(_0x4b0f87[_0x96dd('0x5')]){return _0x54c160(_0x4b0f87[_0x96dd('0x5')][_0x96dd('0x6')]);}else{return _0xc989b5(_0x4b0f87[_0x96dd('0x7')]);}})[_0x96dd('0x8')](function(_0x44081a){return _0x54c160(_0x44081a);});});}exports['getSquareProject']=function(_0x5a4c7d){return request(_0x96dd('0x9'),{'options':{'raw':![],'where':{'name':_0x5a4c7d},'attributes':[_0x96dd('0xa')]}});};exports['getMailAccountById']=function(_0x578b16){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x578b16},'include':[{'model':_0x96dd('0xb'),'as':'Smtp'}],'attributes':['id',_0x96dd('0xc'),'email']}});};exports[_0x96dd('0xd')]=function(_0x3a5b4a){return request(_0x96dd('0x9'),{'options':{'where':{'id':_0x3a5b4a},'attributes':[_0x96dd('0xc')]}});};exports[_0x96dd('0xe')]=function(_0x5d3237){return request(_0x96dd('0xf'),{'options':{'where':{'id':_0x5d3237},'attributes':[_0x96dd('0xc')]}});};exports[_0x96dd('0x10')]=function(_0x85ee26){return request(_0x96dd('0x11'),{'options':{'where':{'id':_0x85ee26},'attributes':['name']}});};exports[_0x96dd('0x12')]=function(_0x446716){return request(_0x96dd('0x13'),{'options':{'where':{'id':_0x446716},'attributes':[_0x96dd('0x14')]}});};exports[_0x96dd('0x15')]=function(_0x3d4634){return request(_0x96dd('0x16'),{'options':{'where':{'id':_0x3d4634},'attributes':['name']}});};exports[_0x96dd('0x17')]=function(_0x1eb1d7){return request(_0x96dd('0x18'),{'options':{'where':{'id':_0x1eb1d7},'attributes':['name']}});};exports[_0x96dd('0x19')]=function(_0x1058b1){return request(_0x96dd('0x1a'),{'options':{'where':{'id':_0x1058b1},'attributes':[_0x96dd('0x1b')]}});};exports[_0x96dd('0x1c')]=function(_0x4d492a){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x4d492a},'include':[{'model':'Interval','as':_0x96dd('0x1d')}]}});};exports['getSmsAccountById']=function(_0x5e1337){return request(_0x96dd('0x1e'),{'options':{'where':{'id':_0x5e1337},'attributes':['id',_0x96dd('0xc')]}});};exports[_0x96dd('0x1f')]=function(_0x27cbeb){return request('CreateSmsMessage',{'body':_0x27cbeb});};exports[_0x96dd('0x20')]=function(_0x88d61c){return request(_0x96dd('0x21'),{'body':_0x88d61c});};exports[_0x96dd('0x22')]=function(_0x2ece34){return request('CreateSquareReport',{'body':_[_0x96dd('0x23')](_0x2ece34,{'project_name':_0x2ece34[_0x96dd('0x24')],'prev_project_name':_0x2ece34['arg_2']||'','is_subproject':_0x2ece34[_0x96dd('0x25')]?!![]:![],'leaveAt':moment()[_0x96dd('0x26')](_0x96dd('0x27'))})});};exports[_0x96dd('0x28')]=function(_0x4a45f3){return request(_0x96dd('0x29'),{'body':_0x4a45f3});};exports[_0x96dd('0x2a')]=function(_0x2e6848){return request(_0x96dd('0x2b'),{'body':_0x2e6848});};exports[_0x96dd('0x2c')]=function(_0xdf2da3){return request(_0x96dd('0x2d'),{'options':{'raw':![],'where':{'phone':_0xdf2da3[_0x96dd('0x2e')],'ListId':_0xdf2da3['ListId']}}})[_0x96dd('0x4')](function(_0x55ac45){if(_0x55ac45){return _0x55ac45;}return request(_0x96dd('0x2f'),{'body':_0xdf2da3});});};exports['getPauseById']=function(_0x35d6db){return request(_0x96dd('0x30'),{'options':{'where':{'id':_0x35d6db},'attributes':[_0x96dd('0xc')]}});};exports[_0x96dd('0x31')]=function(_0x5039ae,_0x47678f){return request(_0x96dd('0x32'),{'body':{'interface':_0x47678f},'options':{'where':_0x5039ae}});};exports[_0x96dd('0x33')]=function(_0x5446dd,_0x226d14,_0x32d364){return request(_0x96dd('0x34'),{'body':{'type':_0x226d14,'uniqueid':_0x32d364},'options':{'where':_0x5446dd}});};exports[_0x96dd('0x35')]=function(_0x55b0c2){return request(_0x96dd('0x36'),{'body':{},'options':{'where':_0x55b0c2}});};exports[_0x96dd('0x37')]=function(_0x53d96f){return request(_0x96dd('0x38'),{'body':{},'options':{'where':_0x53d96f}});}; \ 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 8fcc4a0..5c3c498 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 _0xdedd=['./lex','exports','./polly'];(function(_0x526fa8,_0x2bb2dd){var _0x446750=function(_0x1e18e8){while(--_0x1e18e8){_0x526fa8['push'](_0x526fa8['shift']());}};_0x446750(++_0x2bb2dd);}(_0xdedd,0x197));var _0xdded=function(_0x40099d,_0x4c20c6){_0x40099d=_0x40099d-0x0;var _0x381541=_0xdedd[_0x40099d];return _0x381541;};var polly=require(_0xdded('0x0'));var lex=require(_0xdded('0x1'));module[_0xdded('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xe978=['exports','./polly','./lex'];(function(_0x200ced,_0x503efa){var _0x28e175=function(_0x450010){while(--_0x450010){_0x200ced['push'](_0x200ced['shift']());}};_0x28e175(++_0x503efa);}(_0xe978,0x70));var _0x8e97=function(_0x7f6b75,_0x2d4175){_0x7f6b75=_0x7f6b75-0x0;var _0x10b834=_0xe978[_0x7f6b75];return _0x10b834;};var polly=require(_0x8e97('0x0'));var lex=require(_0x8e97('0x1'));module[_0x8e97('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 97b7345..5a415e8 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['exports','./lib/api'];(function(_0x2e067a,_0xab528c){var _0xc64976=function(_0x53a98e){while(--_0x53a98e){_0x2e067a['push'](_0x2e067a['shift']());}};_0xc64976(++_0xab528c);}(_0x70e0,0x17b));var _0x070e=function(_0x236705,_0xf142f){_0x236705=_0x236705-0x0;var _0x1f61a0=_0x70e0[_0x236705];return _0x1f61a0;};'use strict';var lex=require(_0x070e('0x0'));module[_0x070e('0x1')]=function(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32){return lex(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32);}; \ No newline at end of file +var _0x4483=['exports','./lib/api'];(function(_0x2651a9,_0x31dc2d){var _0xff12d3=function(_0x2f579d){while(--_0x2f579d){_0x2651a9['push'](_0x2651a9['shift']());}};_0xff12d3(++_0x31dc2d);}(_0x4483,0x1a3));var _0x3448=function(_0x2d5be0,_0x35c601){_0x2d5be0=_0x2d5be0-0x0;var _0x5e9a30=_0x4483[_0x2d5be0];return _0x5e9a30;};'use strict';var lex=require(_0x3448('0x0'));module[_0x3448('0x1')]=function(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178){return lex(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178);}; \ 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 3b4f231..96d576e 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(_0x5c69ff,_0x3fc60d){var _0x918f5f=function(_0x27ca31){while(--_0x27ca31){_0x5c69ff['push'](_0x5c69ff['shift']());}};_0x918f5f(++_0x3fc60d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x1bb831,_0x5d76be){var _0x4a94af=function(_0x553e61){while(--_0x553e61){_0x1bb831['push'](_0x1bb831['shift']());}};_0x4a94af(++_0x5d76be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 a31b668..bea5e3a 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 _0xa3e5=['exports'];(function(_0x35b8bf,_0x184512){var _0x6d65c8=function(_0x250cbc){while(--_0x250cbc){_0x35b8bf['push'](_0x35b8bf['shift']());}};_0x6d65c8(++_0x184512);}(_0xa3e5,0x1db));var _0x5a3e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa3e5[_0x4cf98e];return _0x1623ac;};'use strict';var polly=require('./lib/api');module[_0x5a3e('0x0')]=function(_0x13c0a3,_0xc1c09,_0x35db07,_0x3d7bf6,_0x1fad6b,_0x14e6e4,_0xc8064f){return polly(_0x13c0a3,_0xc1c09,_0x35db07,_0x3d7bf6,_0x1fad6b,_0x14e6e4,_0xc8064f);}; \ No newline at end of file +'use strict';var polly=require('./lib/api');module['exports']=function(_0x39e9b9,_0x240af5,_0x2a58c0,_0x359f3b,_0xb0fbfc,_0x151d12,_0x17f959){return polly(_0x39e9b9,_0x240af5,_0x2a58c0,_0x359f3b,_0xb0fbfc,_0x151d12,_0x17f959);}; \ 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 ee6388b..6c1cc29 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 _0x5cf7=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x48566c,_0x4f892b){var _0x32c819=function(_0x5f90a7){while(--_0x5f90a7){_0x48566c['push'](_0x48566c['shift']());}};_0x32c819(++_0x4f892b);}(_0x5cf7,0x1c1));var _0x75cf=function(_0xd31e88,_0x201923){_0xd31e88=_0xd31e88-0x0;var _0x296e88=_0x5cf7[_0xd31e88];return _0x296e88;};'use strict';var fs=require('fs');var path=require(_0x75cf('0x0'));var BPromise=require(_0x75cf('0x1'));var rs=require(_0x75cf('0x2'));var AWS=require(_0x75cf('0x3'));function pollyResult(_0x4b2b29,_0x16ed55,_0x371747){return new BPromise(function(_0x2ffccc,_0x5c1df1){_0x4b2b29[_0x75cf('0x4')](_0x16ed55,function(_0x66a937,_0x42e50a){if(_0x66a937){_0x5c1df1(_0x66a937);}else if(_0x42e50a){if(_0x42e50a[_0x75cf('0x5')]instanceof Buffer){fs[_0x75cf('0x6')](_0x371747,_0x42e50a[_0x75cf('0x5')],function(_0x5d6719){if(_0x5d6719){_0x5c1df1(_0x5d6719);}else{_0x2ffccc();}});}else{_0x5c1df1(new Error(_0x75cf('0x7')));}}else{_0x5c1df1(new Error(_0x75cf('0x8')));}});});}module[_0x75cf('0x9')]=function(_0x5899cb,_0x4133c2,_0x48eeb5,_0x580067,_0x484941,_0x2b4ff1,_0x491269){var _0x50f037=new AWS[(_0x75cf('0xa'))]({'accessKeyId':_0x5899cb,'secretAccessKey':_0x4133c2,'region':_0x48eeb5});var _0x5d7828={'Text':_0x484941,'TextType':_0x2b4ff1||_0x75cf('0xb'),'OutputFormat':_0x75cf('0xc'),'VoiceId':_0x580067};return pollyResult(_0x50f037,_0x5d7828,_0x491269);}; \ No newline at end of file +var _0xbcfd=['exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xbcfd,0xa0));var _0xdbcf=function(_0xfe57a8,_0x5bc623){_0xfe57a8=_0xfe57a8-0x0;var _0x243c8c=_0xbcfd[_0xfe57a8];return _0x243c8c;};'use strict';var fs=require('fs');var path=require(_0xdbcf('0x0'));var BPromise=require(_0xdbcf('0x1'));var rs=require(_0xdbcf('0x2'));var AWS=require(_0xdbcf('0x3'));function pollyResult(_0xb76611,_0x571a88,_0x5e117e){return new BPromise(function(_0xa12756,_0x4787e7){_0xb76611[_0xdbcf('0x4')](_0x571a88,function(_0x558abd,_0x4c7ff8){if(_0x558abd){_0x4787e7(_0x558abd);}else if(_0x4c7ff8){if(_0x4c7ff8[_0xdbcf('0x5')]instanceof Buffer){fs[_0xdbcf('0x6')](_0x5e117e,_0x4c7ff8['AudioStream'],function(_0x2fbfe4){if(_0x2fbfe4){_0x4787e7(_0x2fbfe4);}else{_0xa12756();}});}else{_0x4787e7(new Error(_0xdbcf('0x7')));}}else{_0x4787e7(new Error(_0xdbcf('0x8')));}});});}module[_0xdbcf('0x9')]=function(_0x5309ec,_0x30ab5f,_0x1acd53,_0x4d6eaa,_0x5a621b,_0x3fd529,_0x111f49){var _0x54bf93=new AWS[(_0xdbcf('0xa'))]({'accessKeyId':_0x5309ec,'secretAccessKey':_0x30ab5f,'region':_0x1acd53});var _0x5a0f97={'Text':_0x5a621b,'TextType':_0x3fd529||_0xdbcf('0xb'),'OutputFormat':_0xdbcf('0xc'),'VoiceId':_0x4d6eaa};return pollyResult(_0x54bf93,_0x5a0f97,_0x111f49);}; \ 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 2f965ed..7c61fd7 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 _0x0726=['exports','./lib/api'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x0726,0xff));var _0x6072=function(_0x1b35ea,_0x19df19){_0x1b35ea=_0x1b35ea-0x0;var _0x107cd3=_0x0726[_0x1b35ea];return _0x107cd3;};'use strict';var asr=require(_0x6072('0x0'));module[_0x6072('0x1')]=function(_0x4d86b9,_0x1a24a3,_0x5988e4,_0x2f2b37){return asr(_0x4d86b9,_0x1a24a3,_0x5988e4);}; \ No newline at end of file +var _0x6d0e=['./lib/api'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6d0e,0xc6));var _0xe6d0=function(_0x3b09be,_0x163cf5){_0x3b09be=_0x3b09be-0x0;var _0x3596f3=_0x6d0e[_0x3b09be];return _0x3596f3;};'use strict';var asr=require(_0xe6d0('0x0'));module['exports']=function(_0x47c041,_0x31f7d8,_0x3a640b,_0x5d1a64){return asr(_0x47c041,_0x31f7d8,_0x3a640b);}; \ 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 2de98ad..b1f6976 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 _0xfb3f=['lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string'];(function(_0x7bcf5e,_0x27d7a9){var _0x40dccc=function(_0x354bc){while(--_0x354bc){_0x7bcf5e['push'](_0x7bcf5e['shift']());}};_0x40dccc(++_0x27d7a9);}(_0xfb3f,0xd9));var _0xffb3=function(_0x5c5994,_0xda1c98){_0x5c5994=_0x5c5994-0x0;var _0x4c36b1=_0xfb3f[_0x5c5994];return _0x4c36b1;};'use strict';var url=require(_0xffb3('0x0'));var BPromise=require(_0xffb3('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xffb3('0x2')]=function(_0x55ad19,_0x53c180,_0x24550b){return new BPromise(function(_0x49acbf,_0x39dd2c){var _0x4f28c4;if(typeof _0x55ad19!==_0xffb3('0x3')||_0x55ad19[_0xffb3('0x4')]===0x0){return _0x39dd2c(_0xffb3('0x5'));}if(typeof _0x53c180!==_0xffb3('0x3')||_0x53c180[_0xffb3('0x4')]===0x0){return _0x39dd2c(_0xffb3('0x6'));}if(typeof _0x24550b!=='undefined'&&(typeof _0x24550b!==_0xffb3('0x3')||_0x24550b[_0xffb3('0x4')]===0x0)){return _0x39dd2c(_0xffb3('0x7'));}try{_0x4f28c4=fs[_0xffb3('0x8')](_0x55ad19)[_0xffb3('0x9')]('base64');}catch(_0x35b664){return _0x39dd2c(_0x35b664);}return _0x49acbf({'method':_0xffb3('0xa'),'uri':host+_0xffb3('0xb')+_0x53c180,'body':{'config':{'encoding':_0xffb3('0xc'),'sampleRateHertz':_0xffb3('0xd'),'languageCode':_0x24550b},'audio':{'content':_0x4f28c4}},'json':!![]});});}; \ No newline at end of file +var _0x6c50=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','LINEAR16','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x31bfee,_0x5e7b65){var _0x4fe58e=function(_0x52f282){while(--_0x52f282){_0x31bfee['push'](_0x31bfee['shift']());}};_0x4fe58e(++_0x5e7b65);}(_0x6c50,0xa4));var _0x06c5=function(_0x19ab82,_0xd81a9b){_0x19ab82=_0x19ab82-0x0;var _0x3c5d89=_0x6c50[_0x19ab82];return _0x3c5d89;};'use strict';var url=require(_0x06c5('0x0'));var BPromise=require(_0x06c5('0x1'));var fs=require('fs');var host=_0x06c5('0x2');module[_0x06c5('0x3')]=function(_0x495adf,_0xd66539,_0x494494){return new BPromise(function(_0x4271d1,_0x2853be){var _0x434003;if(typeof _0x495adf!==_0x06c5('0x4')||_0x495adf[_0x06c5('0x5')]===0x0){return _0x2853be(_0x06c5('0x6'));}if(typeof _0xd66539!==_0x06c5('0x4')||_0xd66539[_0x06c5('0x5')]===0x0){return _0x2853be(_0x06c5('0x7'));}if(typeof _0x494494!==_0x06c5('0x8')&&(typeof _0x494494!==_0x06c5('0x4')||_0x494494['length']===0x0)){return _0x2853be(_0x06c5('0x9'));}try{_0x434003=fs[_0x06c5('0xa')](_0x495adf)[_0x06c5('0xb')](_0x06c5('0xc'));}catch(_0x4e863c){return _0x2853be(_0x4e863c);}return _0x4271d1({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0xd66539,'body':{'config':{'encoding':_0x06c5('0xd'),'sampleRateHertz':'8000','languageCode':_0x494494},'audio':{'content':_0x434003}},'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 30e6268..d1e9d5e 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 _0xeab5=['exports','./asr'];(function(_0x40b27d,_0x101270){var _0xb37365=function(_0x3f19a0){while(--_0x3f19a0){_0x40b27d['push'](_0x40b27d['shift']());}};_0xb37365(++_0x101270);}(_0xeab5,0x15d));var _0x5eab=function(_0x4c4a38,_0x5cb470){_0x4c4a38=_0x4c4a38-0x0;var _0x2acf5e=_0xeab5[_0x4c4a38];return _0x2acf5e;};var asr=require(_0x5eab('0x0'));module[_0x5eab('0x1')]={'asr':asr}; \ No newline at end of file +var _0x07b2=['exports','./asr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07b2,0x18d));var _0x207b=function(_0x32f0bf,_0x528534){_0x32f0bf=_0x32f0bf-0x0;var _0xcb4c4f=_0x07b2[_0x32f0bf];return _0xcb4c4f;};var asr=require(_0x207b('0x0'));module[_0x207b('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 37e6ef0..a10ed3c 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 _0x8c4c=['wav','error\x20convert','finish\x20to\x20convert','tmp','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','resolve','from','audioContent','writeFile','googleTTS','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','.mp3','goggleTTS\x20path','asr','uri','results','alternatives','transcript','map','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','result','resolvedQuery','action','actionIncomplete','speech','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dialogflow','http','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./google','./sestek','protocol','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','error','download\x20error','end','data','transcode'];(function(_0x1049bd,_0x7bd55e){var _0x12fe2c=function(_0x4b975a){while(--_0x4b975a){_0x1049bd['push'](_0x1049bd['shift']());}};_0x12fe2c(++_0x7bd55e);}(_0x8c4c,0x1dc));var _0xc8c4=function(_0x5d6a75,_0x2effa3){_0x5d6a75=_0x5d6a75-0x0;var _0x355f27=_0x8c4c[_0x5d6a75];return _0x355f27;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0xc8c4('0x0'));var fs=require('fs');var http=require(_0xc8c4('0x1'));var https=require('https');var md5=require(_0xc8c4('0x2'));var path=require(_0xc8c4('0x3'));var querystring=require(_0xc8c4('0x4'));var rp=require(_0xc8c4('0x5'));var rs=require(_0xc8c4('0x6'));var sox=require(_0xc8c4('0x7'));var tts=require(_0xc8c4('0x8'));var urlParse=require(_0xc8c4('0x9'))[_0xc8c4('0xa')];var util=require(_0xc8c4('0xb'));var aws=require('./aws');var google=require(_0xc8c4('0xc'));var sestek=require(_0xc8c4('0xd'));var tilde=require('./tilde');var logger=require('../../../config/logger')('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x326138,_0x436f6c){return new BPromise(function(_0x4f7ae2,_0x19c0ed){var _0x4d1c7f=urlParse(_0x326138);var _0x55ddd0=_0x4d1c7f[_0xc8c4('0xe')]===_0xc8c4('0xf')?https:http;var _0x256fc8={'host':_0x4d1c7f[_0xc8c4('0x10')],'path':_0x4d1c7f['path'],'headers':{'user-agent':_0xc8c4('0x11')}};_0x55ddd0[_0xc8c4('0x12')](_0x256fc8,function(_0x578dd1){if(_0x578dd1[_0xc8c4('0x13')]!==0xc8){logger['error'](_0xc8c4('0x14')+_0x326138+_0xc8c4('0x15')+_0x578dd1[_0xc8c4('0x13')]+'\x20('+_0x578dd1[_0xc8c4('0x16')]+')');_0x19c0ed(new Error('request\x20to\x20'+_0x326138+'\x20failed,\x20status\x20code\x20=\x20'+_0x578dd1[_0xc8c4('0x13')]+'\x20('+_0x578dd1['statusMessage']+')'));return;}var _0x3233d5=fs[_0xc8c4('0x17')](_0x436f6c);_0x3233d5['on']('finish',function(){logger[_0xc8c4('0x18')](_0xc8c4('0x19'));_0x3233d5[_0xc8c4('0x1a')](_0x4f7ae2);});_0x3233d5['on'](_0xc8c4('0x1b'),function(_0x4db735){fs['unlink'](_0x436f6c);logger['error'](_0xc8c4('0x1c'),_0x4db735);_0x19c0ed(_0x4db735);});_0x578dd1['pipe'](_0x3233d5);})['on'](_0xc8c4('0x1b'),function(_0x4dbc98){logger[_0xc8c4('0x1b')](_0x4dbc98);_0x19c0ed(_0x4dbc98);})[_0xc8c4('0x1d')]();});}function uploadFile(_0x376cb0){return new BPromise(function(_0x247d85,_0xfed73c){var _0x573b96=urlParse(_0x376cb0);var _0x3eceb3=_0x573b96['protocol']===_0xc8c4('0xf')?https:http;var _0x5e415d={'host':_0x573b96[_0xc8c4('0x10')],'path':_0x573b96[_0xc8c4('0x3')],'headers':{'user-agent':_0xc8c4('0x11')}};_0x3eceb3[_0xc8c4('0x12')](_0x5e415d,function(_0x578add){if(_0x578add[_0xc8c4('0x13')]!==0xc8){_0xfed73c(new Error(_0xc8c4('0x14')+_0x376cb0+_0xc8c4('0x15')+_0x578add['statusCode']+'\x20('+_0x578add['statusMessage']+')'));return;}var _0x865118='';_0x578add['on'](_0xc8c4('0x1e'),function(_0x304bec){_0x865118+=_0x304bec;});_0x578add['on'](_0xc8c4('0x1d'),function(){_0x247d85(_0x865118);});})['on'](_0xc8c4('0x1b'),function(_0x313390){_0xfed73c(_0x313390);})[_0xc8c4('0x1d')]();});}function convertFile(_0x530c0d,_0x40fe5c){return new BPromise(function(_0x55615d,_0x1304fb){var _0x38bc38=sox[_0xc8c4('0x1f')](_0x530c0d,_0x40fe5c,{'sampleRate':0x1f40,'format':_0xc8c4('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x38bc38['on'](_0xc8c4('0x1b'),function(_0x2c0b0c){logger[_0xc8c4('0x1b')](_0xc8c4('0x21'),_0x2c0b0c);_0x1304fb(_0x2c0b0c);});_0x38bc38['on'](_0xc8c4('0x1d'),function(){logger[_0xc8c4('0x18')](_0xc8c4('0x22'));_0x55615d();});_0x38bc38['start']();});}function base64Decode(_0x237225,_0x205ca5){var _0x2a875=path['resolve'](__dirname,_0xc8c4('0x23'),rs[_0xc8c4('0x24')](0x4)+_0xc8c4('0x25'));fs[_0xc8c4('0x26')](_0x2a875,_0x237225,_0xc8c4('0x27'));return convertFile(_0x2a875,_0x205ca5)[_0xc8c4('0x28')](function(){try{fs[_0xc8c4('0x29')](_0x2a875);fs[_0xc8c4('0x2a')](_0x205ca5,_0xc8c4('0x2b'));}catch(_0x5797f3){logger['error'](_0x5797f3);}return _0x205ca5[_0xc8c4('0x2c')]('.')[0x0];});}function base64Encode(_0x3870c8){var _0x5a3197=fs['readFileSync'](_0x3870c8);return new Buffer(_0x5a3197)[_0xc8c4('0x2d')](_0xc8c4('0x27'));}exports[_0xc8c4('0x2e')]=function(_0x266a2a,_0x1ce21c,_0x14dfb2,_0x59ca07,_0x902943,_0x585e8f){var _0x515acf,_0x45a58c;var _0x185be3=_0xc8c4('0x2f');var _0x4c417d=_0xc8c4('0x30')+_0x266a2a;var _0x277841={};if(_0x1ce21c===_0xc8c4('0x31')){_0x277841[_0xc8c4('0x32')]={'ssml':_0x14dfb2};}else{_0x277841[_0xc8c4('0x32')]={'text':_0x14dfb2};};_0x277841[_0xc8c4('0x33')]={'languageCode':_0x59ca07,'ssmlGender':_0x902943};_0x277841[_0xc8c4('0x34')]={'audioEncoding':_0xc8c4('0x35'),'sampleRateHertz':0x1f40};var _0x27694a={'url':_0x185be3+'text:synthesize'+_0x4c417d,'method':_0xc8c4('0x36'),'json':!![],'body':_0x277841};return rp(_0x27694a)[_0xc8c4('0x28')](function(_0x336b8f){return new BPromise(function(_0x8d9a0,_0x4eadc0){_0x515acf=path[_0xc8c4('0x37')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x2e979e=Buffer[_0xc8c4('0x38')](_0x336b8f[_0xc8c4('0x39')],'base64');return fs[_0xc8c4('0x3a')](_0x515acf,_0x2e979e,function(_0x2e136a){_0x4eadc0(_0x2e136a);},function(_0x3106f6){fs[_0xc8c4('0x2a')](_0x515acf,_0xc8c4('0x2b'));_0x8d9a0(_0x3106f6);});});})[_0xc8c4('0x28')](function(_0x56de67){_0x45a58c=path['resolve'](__dirname,_0xc8c4('0x23'),rs[_0xc8c4('0x24')](0x4)+'.wav');return convertFile(_0x515acf,_0x45a58c);})[_0xc8c4('0x28')](function(){try{fs[_0xc8c4('0x29')](_0x515acf);fs['chmodSync'](_0x45a58c,_0xc8c4('0x2b'));}catch(_0x49814e){logger[_0xc8c4('0x1b')](_0x49814e);}logger['info']('googleCloudTTS\x20path',_0x45a58c[_0xc8c4('0x2c')]('.')[0x0]);return _0x45a58c[_0xc8c4('0x2c')]('.')[0x0];});};exports[_0xc8c4('0x3b')]=function(_0x5c4452,_0x178933){var _0x2188c5='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x102f94,_0xcfb88f;var _0x4e2bc6;var _0x4eaffb={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x2188c5,'headers':{'Content-Type':_0xc8c4('0x3c')},'body':_0xc8c4('0x3d')+encodeURIComponent(JSON[_0xc8c4('0x3e')]([[[_0xc8c4('0x3f'),JSON[_0xc8c4('0x3e')]([_0x5c4452,_0x178933||'en',![],'null']),null,_0xc8c4('0x40')]]]))};return rp(_0x4eaffb)['then'](function(_0x875019){try{_0x4e2bc6=eval(_0x875019[_0xc8c4('0x41')](0x5))[0x0][0x2];}catch(_0x55bc46){throw new Error('parse\x20response\x20failed:\x0a'+_0x875019[_0xc8c4('0x1e')]);}if(!_0x4e2bc6){if(_0x5c4452[_0xc8c4('0x42')]>0xc8){throw new Error(_0xc8c4('0x43'));}else{throw new Error(_0xc8c4('0x44')+_0x178933+_0xc8c4('0x45'));}}try{_0x4e2bc6=eval(_0x4e2bc6)[0x0];}catch(_0x3a8213){throw new Error(_0xc8c4('0x46')+res[_0xc8c4('0x1e')]);}const _0x208b46=_0x4e2bc6;_0x102f94=path[_0xc8c4('0x37')](__dirname,_0xc8c4('0x23'),rs[_0xc8c4('0x24')](0x4)+_0xc8c4('0x47'));fs[_0xc8c4('0x26')](_0x102f94,_0x4e2bc6,{'encoding':_0xc8c4('0x27')});_0xcfb88f=path[_0xc8c4('0x37')](__dirname,_0xc8c4('0x23'),rs[_0xc8c4('0x24')](0x4)+_0xc8c4('0x25'));return convertFile(_0x102f94,_0xcfb88f);})[_0xc8c4('0x28')](function(){try{fs[_0xc8c4('0x29')](_0x102f94);fs['chmodSync'](_0xcfb88f,_0xc8c4('0x2b'));}catch(_0xe99324){logger[_0xc8c4('0x1b')](_0xe99324);}logger[_0xc8c4('0x18')](_0xc8c4('0x48'),_0xcfb88f[_0xc8c4('0x2c')]('.')[0x0]);return _0xcfb88f[_0xc8c4('0x2c')]('.')[0x0];});};exports['googleASR']=function(_0x5ba470,_0x3f81e5,_0x5178b6){return google[_0xc8c4('0x49')](_0x5ba470,_0x3f81e5,_0x5178b6)[_0xc8c4('0x28')](function(_0x470263){logger[_0xc8c4('0x18')](_0x470263[_0xc8c4('0x4a')]);return rp(_0x470263);})['then'](function(_0x170489){var _0x347121='';var _0x1b1e78=0x0;try{fs['unlink'](_0x5ba470);}catch(_0x5a79fd){logger[_0xc8c4('0x1b')](_0x5a79fd);}if(_0x170489&&_0x170489[_0xc8c4('0x4b')]){_0x347121=_0x170489[_0xc8c4('0x4b')]['map'](function(_0x1ad13e){return _0x1ad13e&&_0x1ad13e[_0xc8c4('0x4c')][0x0]&&_0x1ad13e[_0xc8c4('0x4c')][0x0][_0xc8c4('0x4d')]?_0x1ad13e[_0xc8c4('0x4c')][0x0][_0xc8c4('0x4d')]:'';})['join']('\x0a');_0x1b1e78=_0x170489['results'][_0xc8c4('0x4e')](function(_0x2e005d){return _0x2e005d&&_0x2e005d[_0xc8c4('0x4c')][0x0]&&_0x2e005d[_0xc8c4('0x4c')][0x0][_0xc8c4('0x4f')]?_0x2e005d['alternatives'][0x0][_0xc8c4('0x4f')]:0x0;})[_0xc8c4('0x50')]('\x0a');}logger[_0xc8c4('0x18')](_0xc8c4('0x51'),_0x347121);logger[_0xc8c4('0x18')](_0xc8c4('0x52'),_0x1b1e78);return{'transcript':_0x347121,'confidence':_0x1b1e78};})[_0xc8c4('0x53')](function(_0x24e08c){logger[_0xc8c4('0x1b')]('[%s]\x20%s:%s',_0x24e08c[_0xc8c4('0x13')],_0x24e08c[_0xc8c4('0x54')],_0x24e08c[_0xc8c4('0x55')]);});};exports[_0xc8c4('0x56')]=function(_0x4eeebe,_0x25c7bb,_0x35c640,_0x3a2151){var _0x2b7415=apiai(_0x25c7bb,{'language':_0x3a2151||'en'});return _0x2b7415['textRequest'](_0x35c640,{'sessionId':md5(_0x4eeebe)})[_0xc8c4('0x28')](function(_0x45018f){logger[_0xc8c4('0x18')](JSON[_0xc8c4('0x3e')](_0x45018f));return{'source':_0x45018f[_0xc8c4('0x57')]['source'],'resolvedQuery':_0x45018f[_0xc8c4('0x57')][_0xc8c4('0x58')],'action':_0x45018f[_0xc8c4('0x57')][_0xc8c4('0x59')],'actionIncomplete':_0x45018f[_0xc8c4('0x57')][_0xc8c4('0x5a')],'speech':_0x45018f['result']['fulfillment'][_0xc8c4('0x5b')],'score':_0x45018f['result']['score'],'statusCode':_0x45018f['status']['code'],'endConversation':_0x45018f[_0xc8c4('0x57')]['metadata']['endConversation']||![],'isFallbackIntent':_0x45018f[_0xc8c4('0x57')]['metadata']['isFallbackIntent']};});};exports[_0xc8c4('0x5c')]=function(_0x3d15bd,_0xff34e1,_0x16b2d5,_0xc53e99,_0x5a1084,_0x1bd341){var _0x3c2744=_0xc53e99[_0xc8c4('0x5d')](/\\n/g,'\x0a');var _0xc4c4d6={'credentials':{'private_key':_0x3c2744,'client_email':_0x16b2d5}};var _0x17d79d=new dialogflow[(_0xc8c4('0x5e'))](_0xc4c4d6);var _0x3d52e5=_0x17d79d[_0xc8c4('0x5f')](_0xff34e1,md5(_0x3d15bd));var _0x2ef720={'session':_0x3d52e5,'queryInput':{'text':{'text':_0x5a1084,'languageCode':_0x1bd341}}};return _0x17d79d[_0xc8c4('0x60')](_0x2ef720)[_0xc8c4('0x28')](function(_0x2df46e){if(_0x2df46e&&_0x2df46e[_0xc8c4('0x42')]){logger['info'](_0xc8c4('0x61'),JSON[_0xc8c4('0x3e')](_0x2df46e));var _0x4d8b6a=_0x2df46e[0x0];if(_0x4d8b6a){var _0x4cd756={'action':_0x4d8b6a['queryResult'][_0xc8c4('0x59')],'allRequiredParamsPresent':_0x4d8b6a[_0xc8c4('0x62')]['allRequiredParamsPresent'],'endConversation':_0x4d8b6a[_0xc8c4('0x62')][_0xc8c4('0x63')]&&_0x4d8b6a[_0xc8c4('0x62')][_0xc8c4('0x63')][_0xc8c4('0x64')]?_0x4d8b6a['queryResult'][_0xc8c4('0x63')][_0xc8c4('0x64')][_0xc8c4('0x65')][_0xc8c4('0x66')]:![],'fulfillmentText':_0x4d8b6a[_0xc8c4('0x62')][_0xc8c4('0x67')],'intentName':_0x4d8b6a['queryResult'][_0xc8c4('0x68')][_0xc8c4('0x54')],'intentDisplayName':_0x4d8b6a['queryResult']['intent']['displayName'],'isFallbackIntent':_0x4d8b6a['queryResult']['intent'][_0xc8c4('0x69')],'languageCode':_0x4d8b6a[_0xc8c4('0x62')][_0xc8c4('0x6a')],'queryText':_0x4d8b6a['queryResult']['queryText'],'responseId':_0x4d8b6a[_0xc8c4('0x6b')],'score':_0x4d8b6a[_0xc8c4('0x62')][_0xc8c4('0x6c')],'speech':_0x4d8b6a[_0xc8c4('0x62')][_0xc8c4('0x67')],'providerResponse':JSON[_0xc8c4('0x3e')](_0x2df46e)};return _0x4cd756;}}});};exports['tildeASR']=function(_0x3be916,_0x30a353,_0x218ffe,_0x4ced5e){return tilde[_0xc8c4('0x49')](_0x3be916,_0x30a353,_0x218ffe,_0x4ced5e)[_0xc8c4('0x28')](function(_0x25737b){try{fs['unlink'](_0x3be916);}catch(_0x55681f){logger[_0xc8c4('0x1b')](_0x55681f);}logger[_0xc8c4('0x18')](_0xc8c4('0x6d'),_0x25737b[_0xc8c4('0x4d')]);logger[_0xc8c4('0x18')](_0xc8c4('0x6e'),_0x25737b[_0xc8c4('0x4f')]);return _0x25737b;});};exports[_0xc8c4('0x6f')]=function(_0x3a8bc7,_0x204377,_0x75931e,_0x5a2924,_0xe880eb,_0x3c13f3){var _0x137eff=path[_0xc8c4('0x37')](__dirname,_0xc8c4('0x23'),rs[_0xc8c4('0x24')](0x4)+_0xc8c4('0x47'));var _0x3480cb;return aws['polly'](_0x3a8bc7,_0x204377,_0x75931e,_0x5a2924,_0xe880eb,_0x3c13f3,_0x137eff)[_0xc8c4('0x28')](function(){_0x3480cb=path[_0xc8c4('0x37')](__dirname,_0xc8c4('0x23'),rs[_0xc8c4('0x24')](0x4)+_0xc8c4('0x25'));return convertFile(_0x137eff,_0x3480cb);})['then'](function(){try{fs['unlink'](_0x137eff);fs['chmodSync'](_0x3480cb,_0xc8c4('0x2b'));}catch(_0x513a8c){logger[_0xc8c4('0x1b')](_0x513a8c);}return _0x3480cb[_0xc8c4('0x2c')]('.')[0x0];});};exports[_0xc8c4('0x70')]=function(_0x2ac0ad,_0x1bafee,_0x394e16,_0x16b96c,_0x19209b,_0x534148){return aws[_0xc8c4('0x71')](_0x2ac0ad,_0x1bafee,_0x394e16,_0x16b96c,_0x19209b,_0x534148)['then'](function(_0x292122){logger['info'](JSON[_0xc8c4('0x3e')](_0x292122));return _0x292122;});};exports[_0xc8c4('0x72')]=function(_0x2bd541,_0x3029c9,_0x52de9c,_0x4a6ca0){var _0x57a543=util[_0xc8c4('0x73')](_0xc8c4('0x74'),ISPEECH_API,_0x2bd541,encodeURIComponent(_0x3029c9),_0x52de9c,_0x4a6ca0);var _0x464a65=path['resolve'](__dirname,_0xc8c4('0x23'),rs[_0xc8c4('0x24')](0x4)+'.mp3');var _0x260c2c;return downloadFile(_0x57a543,_0x464a65)[_0xc8c4('0x28')](function(){_0x260c2c=path[_0xc8c4('0x37')](__dirname,_0xc8c4('0x23'),rs[_0xc8c4('0x24')](0x4)+_0xc8c4('0x25'));return convertFile(_0x464a65,_0x260c2c);})[_0xc8c4('0x28')](function(){try{fs['unlink'](_0x464a65);fs[_0xc8c4('0x2a')](_0x260c2c,_0xc8c4('0x2b'));}catch(_0x146115){logger[_0xc8c4('0x1b')](_0x146115);}return _0x260c2c[_0xc8c4('0x2c')]('.')[0x0];});};exports[_0xc8c4('0x75')]=function(_0xf55aa4,_0x20d1e9,_0x17b9b1,_0x2debf1){var _0x2d9a87=util[_0xc8c4('0x73')](_0xc8c4('0x76'),ISPEECH_API,_0x20d1e9,_0x17b9b1,base64Encode(_0xf55aa4),_0x2debf1?util[_0xc8c4('0x73')]('model=%s',encodeURIComponent(_0x2debf1)):_0xc8c4('0x77'));return uploadFile(_0x2d9a87)[_0xc8c4('0x28')](function(_0x206e54){return querystring[_0xc8c4('0xa')](_0x206e54);});};exports['sestekNDA']=function(_0x14f605,_0x172eaa){return sestek['nda'](_0x14f605,_0x172eaa)['then'](function(_0x4675d5){logger[_0xc8c4('0x18')](JSON['stringify'](_0x4675d5));var _0x54a143={'speech':_0x4675d5[_0xc8c4('0x78')],'action':_0x4675d5[_0xc8c4('0x79')]?_0x4675d5[_0xc8c4('0x79')][_0xc8c4('0x7a')]:undefined,'actiondata':_0x4675d5[_0xc8c4('0x79')]?_0x4675d5['channelData'][_0xc8c4('0x7b')]:undefined};if(_0x4675d5['channelData']&&_0x4675d5[_0xc8c4('0x79')][_0xc8c4('0x7c')]){return base64Decode(_0x4675d5[_0xc8c4('0x79')][_0xc8c4('0x7c')][_0xc8c4('0x7d')],path[_0xc8c4('0x37')](__dirname,'tmp',rs[_0xc8c4('0x24')](0x4)+_0xc8c4('0x25')))[_0xc8c4('0x28')](function(_0x75b170){_0x54a143[_0xc8c4('0x7e')]=_0x75b170;return _0x54a143;});}return _0x54a143;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x95a8=['sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','protocol','WHAT_EVER','data','end','wav','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','ssml','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','resolve','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','polly','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','model=%s','freeform=3'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x95a8,0x1a6));var _0x895a=function(_0x83f8c4,_0x450c4b){_0x83f8c4=_0x83f8c4-0x0;var _0x1cf945=_0x95a8[_0x83f8c4];return _0x1cf945;};'use strict';var apiai=require(_0x895a('0x0'));var BPromise=require(_0x895a('0x1'));var dialogflow=require(_0x895a('0x2'));var fs=require('fs');var http=require(_0x895a('0x3'));var https=require(_0x895a('0x4'));var md5=require(_0x895a('0x5'));var path=require(_0x895a('0x6'));var querystring=require(_0x895a('0x7'));var rp=require(_0x895a('0x8'));var rs=require(_0x895a('0x9'));var sox=require(_0x895a('0xa'));var tts=require('google-tts-api');var urlParse=require(_0x895a('0xb'))[_0x895a('0xc')];var util=require(_0x895a('0xd'));var aws=require(_0x895a('0xe'));var google=require(_0x895a('0xf'));var sestek=require(_0x895a('0x10'));var tilde=require(_0x895a('0x11'));var logger=require(_0x895a('0x12'))(_0x895a('0x13'));var ISPEECH_API=_0x895a('0x14');function downloadFile(_0x27ff82,_0x236805){return new BPromise(function(_0x521bda,_0xdcf792){var _0x15f27b=urlParse(_0x27ff82);var _0x25f37c=_0x15f27b['protocol']===_0x895a('0x15')?https:http;var _0x22f7bf={'host':_0x15f27b[_0x895a('0x16')],'path':_0x15f27b[_0x895a('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x25f37c[_0x895a('0x17')](_0x22f7bf,function(_0x3ada3a){if(_0x3ada3a[_0x895a('0x18')]!==0xc8){logger[_0x895a('0x19')](_0x895a('0x1a')+_0x27ff82+'\x20failed,\x20status\x20code\x20=\x20'+_0x3ada3a[_0x895a('0x18')]+'\x20('+_0x3ada3a['statusMessage']+')');_0xdcf792(new Error(_0x895a('0x1a')+_0x27ff82+_0x895a('0x1b')+_0x3ada3a[_0x895a('0x18')]+'\x20('+_0x3ada3a['statusMessage']+')'));return;}var _0x178398=fs[_0x895a('0x1c')](_0x236805);_0x178398['on'](_0x895a('0x1d'),function(){logger[_0x895a('0x1e')](_0x895a('0x1f'));_0x178398[_0x895a('0x20')](_0x521bda);});_0x178398['on'](_0x895a('0x19'),function(_0x41398d){fs[_0x895a('0x21')](_0x236805);logger[_0x895a('0x19')](_0x895a('0x22'),_0x41398d);_0xdcf792(_0x41398d);});_0x3ada3a[_0x895a('0x23')](_0x178398);})['on'](_0x895a('0x19'),function(_0x400fcf){logger['error'](_0x400fcf);_0xdcf792(_0x400fcf);})['end']();});}function uploadFile(_0x2089ed){return new BPromise(function(_0x5126de,_0x11d929){var _0x3a9e98=urlParse(_0x2089ed);var _0x29206b=_0x3a9e98[_0x895a('0x24')]===_0x895a('0x15')?https:http;var _0xfbfde7={'host':_0x3a9e98[_0x895a('0x16')],'path':_0x3a9e98[_0x895a('0x6')],'headers':{'user-agent':_0x895a('0x25')}};_0x29206b[_0x895a('0x17')](_0xfbfde7,function(_0x5c43f5){if(_0x5c43f5[_0x895a('0x18')]!==0xc8){_0x11d929(new Error(_0x895a('0x1a')+_0x2089ed+'\x20failed,\x20status\x20code\x20=\x20'+_0x5c43f5[_0x895a('0x18')]+'\x20('+_0x5c43f5['statusMessage']+')'));return;}var _0xadaee5='';_0x5c43f5['on'](_0x895a('0x26'),function(_0x6760bd){_0xadaee5+=_0x6760bd;});_0x5c43f5['on']('end',function(){_0x5126de(_0xadaee5);});})['on'](_0x895a('0x19'),function(_0x1748bb){_0x11d929(_0x1748bb);})[_0x895a('0x27')]();});}function convertFile(_0xec8298,_0x210d3f){return new BPromise(function(_0x55b52f,_0xc94ab7){var _0x1cefc6=sox['transcode'](_0xec8298,_0x210d3f,{'sampleRate':0x1f40,'format':_0x895a('0x28'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1cefc6['on']('error',function(_0x57a019){logger['error']('error\x20convert',_0x57a019);_0xc94ab7(_0x57a019);});_0x1cefc6['on'](_0x895a('0x27'),function(){logger[_0x895a('0x1e')]('finish\x20to\x20convert');_0x55b52f();});_0x1cefc6[_0x895a('0x29')]();});}function base64Decode(_0x3760a6,_0x1c480e){var _0x6d98d2=path['resolve'](__dirname,_0x895a('0x2a'),rs[_0x895a('0x2b')](0x4)+_0x895a('0x2c'));fs[_0x895a('0x2d')](_0x6d98d2,_0x3760a6,_0x895a('0x2e'));return convertFile(_0x6d98d2,_0x1c480e)[_0x895a('0x2f')](function(){try{fs['unlink'](_0x6d98d2);fs[_0x895a('0x30')](_0x1c480e,_0x895a('0x31'));}catch(_0x52ff31){logger[_0x895a('0x19')](_0x52ff31);}return _0x1c480e[_0x895a('0x32')]('.')[0x0];});}function base64Encode(_0x328426){var _0xc701f5=fs[_0x895a('0x33')](_0x328426);return new Buffer(_0xc701f5)[_0x895a('0x34')]('base64');}exports['googleCloudTTS']=function(_0x4296ec,_0x12c392,_0x27bd8a,_0x23b8b0,_0x362431,_0x28ae67){var _0x3fedd4,_0x33fc14;var _0x131e21=_0x895a('0x35');var _0x30b5eb='?key='+_0x4296ec;var _0x3d1574={};if(_0x12c392===_0x895a('0x36')){_0x3d1574['input']={'ssml':_0x27bd8a};}else{_0x3d1574['input']={'text':_0x27bd8a};};_0x3d1574[_0x895a('0x37')]={'languageCode':_0x23b8b0,'ssmlGender':_0x362431};_0x3d1574[_0x895a('0x38')]={'audioEncoding':_0x895a('0x39'),'sampleRateHertz':0x1f40};var _0x2db5ff={'url':_0x131e21+_0x895a('0x3a')+_0x30b5eb,'method':_0x895a('0x3b'),'json':!![],'body':_0x3d1574};return rp(_0x2db5ff)[_0x895a('0x2f')](function(_0x331f09){return new BPromise(function(_0x2a5464,_0x1a06b0){_0x3fedd4=path['resolve'](__dirname,'tmp',rs[_0x895a('0x2b')](0x4)+_0x895a('0x3c'));var _0x520826=Buffer[_0x895a('0x3d')](_0x331f09[_0x895a('0x3e')],_0x895a('0x2e'));return fs[_0x895a('0x3f')](_0x3fedd4,_0x520826,function(_0x3b9346){_0x1a06b0(_0x3b9346);},function(_0xaedec5){fs[_0x895a('0x30')](_0x3fedd4,_0x895a('0x31'));_0x2a5464(_0xaedec5);});});})['then'](function(_0x16054f){_0x33fc14=path[_0x895a('0x40')](__dirname,_0x895a('0x2a'),rs['generate'](0x4)+_0x895a('0x2c'));return convertFile(_0x3fedd4,_0x33fc14);})['then'](function(){try{fs[_0x895a('0x21')](_0x3fedd4);fs['chmodSync'](_0x33fc14,_0x895a('0x31'));}catch(_0x47a3e3){logger[_0x895a('0x19')](_0x47a3e3);}logger[_0x895a('0x1e')]('googleCloudTTS\x20path',_0x33fc14[_0x895a('0x32')]('.')[0x0]);return _0x33fc14['split']('.')[0x0];});};exports[_0x895a('0x41')]=function(_0x3d9ecc,_0x518046){var _0x523945=_0x895a('0x42');var _0xf1e083,_0x2fe5ca;var _0x2fcfce;var _0x36269b={'encoding':_0x895a('0x43'),'method':_0x895a('0x3b'),'timeout':0x2710,'url':_0x523945,'headers':{'Content-Type':_0x895a('0x44')},'body':_0x895a('0x45')+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0x895a('0x46')]([_0x3d9ecc,_0x518046||'en',![],_0x895a('0x47')]),null,_0x895a('0x48')]]]))};return rp(_0x36269b)['then'](function(_0x174dae){try{_0x2fcfce=eval(_0x174dae[_0x895a('0x49')](0x5))[0x0][0x2];}catch(_0x5b4835){throw new Error(_0x895a('0x4a')+_0x174dae[_0x895a('0x26')]);}if(!_0x2fcfce){if(_0x3d9ecc[_0x895a('0x4b')]>0xc8){throw new Error(_0x895a('0x4c'));}else{throw new Error('lang\x20\x22'+_0x518046+_0x895a('0x4d'));}}try{_0x2fcfce=eval(_0x2fcfce)[0x0];}catch(_0x55a6fc){throw new Error(_0x895a('0x4a')+res[_0x895a('0x26')]);}const _0x168f0d=_0x2fcfce;_0xf1e083=path[_0x895a('0x40')](__dirname,_0x895a('0x2a'),rs[_0x895a('0x2b')](0x4)+_0x895a('0x3c'));fs['writeFileSync'](_0xf1e083,_0x2fcfce,{'encoding':_0x895a('0x2e')});_0x2fe5ca=path[_0x895a('0x40')](__dirname,_0x895a('0x2a'),rs['generate'](0x4)+_0x895a('0x2c'));return convertFile(_0xf1e083,_0x2fe5ca);})[_0x895a('0x2f')](function(){try{fs[_0x895a('0x21')](_0xf1e083);fs['chmodSync'](_0x2fe5ca,'777');}catch(_0x28c526){logger[_0x895a('0x19')](_0x28c526);}logger['info']('goggleTTS\x20path',_0x2fe5ca['split']('.')[0x0]);return _0x2fe5ca[_0x895a('0x32')]('.')[0x0];});};exports[_0x895a('0x4e')]=function(_0x36b1c1,_0x1b234e,_0x328ddf){return google[_0x895a('0x4f')](_0x36b1c1,_0x1b234e,_0x328ddf)[_0x895a('0x2f')](function(_0x37baef){logger[_0x895a('0x1e')](_0x37baef[_0x895a('0x50')]);return rp(_0x37baef);})['then'](function(_0x23c75e){var _0x12923c='';var _0xe0794b=0x0;try{fs[_0x895a('0x21')](_0x36b1c1);}catch(_0x35a979){logger['error'](_0x35a979);}if(_0x23c75e&&_0x23c75e['results']){_0x12923c=_0x23c75e[_0x895a('0x51')][_0x895a('0x52')](function(_0x5e2f92){return _0x5e2f92&&_0x5e2f92[_0x895a('0x53')][0x0]&&_0x5e2f92[_0x895a('0x53')][0x0][_0x895a('0x54')]?_0x5e2f92['alternatives'][0x0][_0x895a('0x54')]:'';})[_0x895a('0x55')]('\x0a');_0xe0794b=_0x23c75e[_0x895a('0x51')][_0x895a('0x52')](function(_0x3e6646){return _0x3e6646&&_0x3e6646[_0x895a('0x53')][0x0]&&_0x3e6646[_0x895a('0x53')][0x0][_0x895a('0x56')]?_0x3e6646[_0x895a('0x53')][0x0]['confidence']:0x0;})[_0x895a('0x55')]('\x0a');}logger[_0x895a('0x1e')](_0x895a('0x57'),_0x12923c);logger[_0x895a('0x1e')](_0x895a('0x58'),_0xe0794b);return{'transcript':_0x12923c,'confidence':_0xe0794b};})['catch'](function(_0x3e019b){logger[_0x895a('0x19')](_0x895a('0x59'),_0x3e019b['statusCode'],_0x3e019b[_0x895a('0x5a')],_0x3e019b['message']);});};exports[_0x895a('0x5b')]=function(_0x304c7d,_0x597f62,_0xd18a35,_0x1bd6b4){var _0x2c1680=apiai(_0x597f62,{'language':_0x1bd6b4||'en'});return _0x2c1680[_0x895a('0x5c')](_0xd18a35,{'sessionId':md5(_0x304c7d)})[_0x895a('0x2f')](function(_0x2ed630){logger[_0x895a('0x1e')](JSON['stringify'](_0x2ed630));return{'source':_0x2ed630[_0x895a('0x5d')][_0x895a('0x5e')],'resolvedQuery':_0x2ed630['result'][_0x895a('0x5f')],'action':_0x2ed630[_0x895a('0x5d')][_0x895a('0x60')],'actionIncomplete':_0x2ed630[_0x895a('0x5d')][_0x895a('0x61')],'speech':_0x2ed630[_0x895a('0x5d')][_0x895a('0x62')][_0x895a('0x63')],'score':_0x2ed630['result'][_0x895a('0x64')],'statusCode':_0x2ed630['status'][_0x895a('0x65')],'endConversation':_0x2ed630[_0x895a('0x5d')][_0x895a('0x66')][_0x895a('0x67')]||![],'isFallbackIntent':_0x2ed630[_0x895a('0x5d')][_0x895a('0x66')]['isFallbackIntent']};});};exports[_0x895a('0x68')]=function(_0x1aa731,_0x129163,_0x4bca86,_0x32a464,_0x488acc,_0x3fa13e){var _0x2446d1=_0x32a464[_0x895a('0x69')](/\\n/g,'\x0a');var _0x2a4bed={'credentials':{'private_key':_0x2446d1,'client_email':_0x4bca86}};var _0x5190f0=new dialogflow[(_0x895a('0x6a'))](_0x2a4bed);var _0x5ec8cb=_0x5190f0[_0x895a('0x6b')](_0x129163,md5(_0x1aa731));var _0x7fc17b={'session':_0x5ec8cb,'queryInput':{'text':{'text':_0x488acc,'languageCode':_0x3fa13e}}};return _0x5190f0[_0x895a('0x6c')](_0x7fc17b)[_0x895a('0x2f')](function(_0x592684){if(_0x592684&&_0x592684[_0x895a('0x4b')]){logger[_0x895a('0x1e')]('Dialogflow\x20V2\x20response:',JSON[_0x895a('0x46')](_0x592684));var _0x262926=_0x592684[0x0];if(_0x262926){var _0x38194a={'action':_0x262926[_0x895a('0x6d')][_0x895a('0x60')],'allRequiredParamsPresent':_0x262926[_0x895a('0x6d')]['allRequiredParamsPresent'],'endConversation':_0x262926['queryResult'][_0x895a('0x6e')]&&_0x262926[_0x895a('0x6d')]['diagnosticInfo'][_0x895a('0x6f')]?_0x262926[_0x895a('0x6d')]['diagnosticInfo'][_0x895a('0x6f')][_0x895a('0x70')][_0x895a('0x71')]:![],'fulfillmentText':_0x262926['queryResult'][_0x895a('0x72')],'intentName':_0x262926[_0x895a('0x6d')]['intent'][_0x895a('0x5a')],'intentDisplayName':_0x262926[_0x895a('0x6d')][_0x895a('0x73')]['displayName'],'isFallbackIntent':_0x262926['queryResult'][_0x895a('0x73')][_0x895a('0x74')],'languageCode':_0x262926[_0x895a('0x6d')][_0x895a('0x75')],'queryText':_0x262926[_0x895a('0x6d')][_0x895a('0x76')],'responseId':_0x262926['responseId'],'score':_0x262926[_0x895a('0x6d')][_0x895a('0x77')],'speech':_0x262926[_0x895a('0x6d')][_0x895a('0x72')],'providerResponse':JSON[_0x895a('0x46')](_0x592684)};return _0x38194a;}}});};exports[_0x895a('0x78')]=function(_0x9f3995,_0x2f4a83,_0x40fd9c,_0xeff263){return tilde[_0x895a('0x4f')](_0x9f3995,_0x2f4a83,_0x40fd9c,_0xeff263)[_0x895a('0x2f')](function(_0x58367e){try{fs[_0x895a('0x21')](_0x9f3995);}catch(_0x4ced0d){logger[_0x895a('0x19')](_0x4ced0d);}logger[_0x895a('0x1e')]('Tilde\x20ASR\x20transcription',_0x58367e[_0x895a('0x54')]);logger['info']('Tilde\x20ASR\x20confidence',_0x58367e[_0x895a('0x56')]);return _0x58367e;});};exports['awsPolly']=function(_0xf1b204,_0x5d850d,_0x1f155d,_0x26fabd,_0x25ef65,_0x48ec1d){var _0x324d24=path[_0x895a('0x40')](__dirname,_0x895a('0x2a'),rs[_0x895a('0x2b')](0x4)+_0x895a('0x3c'));var _0x5cab03;return aws[_0x895a('0x79')](_0xf1b204,_0x5d850d,_0x1f155d,_0x26fabd,_0x25ef65,_0x48ec1d,_0x324d24)[_0x895a('0x2f')](function(){_0x5cab03=path[_0x895a('0x40')](__dirname,'tmp',rs[_0x895a('0x2b')](0x4)+'.wav');return convertFile(_0x324d24,_0x5cab03);})['then'](function(){try{fs['unlink'](_0x324d24);fs['chmodSync'](_0x5cab03,_0x895a('0x31'));}catch(_0x2a93d0){logger['error'](_0x2a93d0);}return _0x5cab03[_0x895a('0x32')]('.')[0x0];});};exports['awsLex']=function(_0x2881b0,_0x51d656,_0xe8d045,_0x1a7a73,_0x499400,_0x2c774f){return aws[_0x895a('0x7a')](_0x2881b0,_0x51d656,_0xe8d045,_0x1a7a73,_0x499400,_0x2c774f)[_0x895a('0x2f')](function(_0x4ff8b3){logger['info'](JSON[_0x895a('0x46')](_0x4ff8b3));return _0x4ff8b3;});};exports[_0x895a('0x7b')]=function(_0x2be10e,_0x9bd868,_0xb8b99c,_0x1fee9a){var _0x5814bc=util['format'](_0x895a('0x7c'),ISPEECH_API,_0x2be10e,encodeURIComponent(_0x9bd868),_0xb8b99c,_0x1fee9a);var _0x1c252a=path[_0x895a('0x40')](__dirname,_0x895a('0x2a'),rs[_0x895a('0x2b')](0x4)+'.mp3');var _0x298531;return downloadFile(_0x5814bc,_0x1c252a)[_0x895a('0x2f')](function(){_0x298531=path[_0x895a('0x40')](__dirname,_0x895a('0x2a'),rs['generate'](0x4)+_0x895a('0x2c'));return convertFile(_0x1c252a,_0x298531);})[_0x895a('0x2f')](function(){try{fs[_0x895a('0x21')](_0x1c252a);fs['chmodSync'](_0x298531,'777');}catch(_0x4e1a52){logger[_0x895a('0x19')](_0x4e1a52);}return _0x298531[_0x895a('0x32')]('.')[0x0];});};exports[_0x895a('0x7d')]=function(_0x3d5601,_0x18825b,_0x436062,_0x14ae75){var _0x4ec9e9=util[_0x895a('0x7e')](_0x895a('0x7f'),ISPEECH_API,_0x18825b,_0x436062,base64Encode(_0x3d5601),_0x14ae75?util[_0x895a('0x7e')](_0x895a('0x80'),encodeURIComponent(_0x14ae75)):_0x895a('0x81'));return uploadFile(_0x4ec9e9)['then'](function(_0x2c32ed){return querystring[_0x895a('0xc')](_0x2c32ed);});};exports[_0x895a('0x82')]=function(_0x509438,_0x5251c3){return sestek['nda'](_0x509438,_0x5251c3)[_0x895a('0x2f')](function(_0x32e8d2){logger['info'](JSON[_0x895a('0x46')](_0x32e8d2));var _0x2ec3b2={'speech':_0x32e8d2[_0x895a('0x83')],'action':_0x32e8d2[_0x895a('0x84')]?_0x32e8d2[_0x895a('0x84')][_0x895a('0x85')]:undefined,'actiondata':_0x32e8d2[_0x895a('0x84')]?_0x32e8d2['channelData'][_0x895a('0x86')]:undefined};if(_0x32e8d2[_0x895a('0x84')]&&_0x32e8d2[_0x895a('0x84')][_0x895a('0x87')]){return base64Decode(_0x32e8d2[_0x895a('0x84')]['AudioFromTts'][_0x895a('0x88')],path[_0x895a('0x40')](__dirname,_0x895a('0x2a'),rs['generate'](0x4)+_0x895a('0x2c')))[_0x895a('0x2f')](function(_0x2c849b){_0x2ec3b2[_0x895a('0x89')]=_0x2c849b;return _0x2ec3b2;});}return _0x2ec3b2;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 8f34e03..c1d5403 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 nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file +var _0x9f6d=['exports'];(function(_0x4f7e75,_0x291708){var _0x4e350f=function(_0x556b28){while(--_0x556b28){_0x4f7e75['push'](_0x4f7e75['shift']());}};_0x4e350f(++_0x291708);}(_0x9f6d,0x1ea));var _0xd9f6=function(_0x389441,_0x3ab518){_0x389441=_0x389441-0x0;var _0x5e987a=_0x9f6d[_0x389441];return _0x5e987a;};var nda=require('./nda');module[_0xd9f6('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 92d8706..fef36ef 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 _0x8ce3=['custom_action_data','CustomActionData','stringify','request-promise','url','agi','exports','POST','resolve','ndauth_url','password','username','then','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action'];(function(_0x3a1b6c,_0x48fbe0){var _0x499e2b=function(_0x1aada1){while(--_0x1aada1){_0x3a1b6c['push'](_0x3a1b6c['shift']());}};_0x499e2b(++_0x48fbe0);}(_0x8ce3,0xc3));var _0x38ce=function(_0x14d233,_0x4289f7){_0x14d233=_0x14d233-0x0;var _0x2d4c76=_0x8ce3[_0x14d233];return _0x2d4c76;};'use strict';var rp=require(_0x38ce('0x0'));var url=require(_0x38ce('0x1'));var logger=require('../../../../../config/logger')(_0x38ce('0x2'));module[_0x38ce('0x3')]=function(_0xee1d0e,_0x26ec48){var _0x1b4dd4={'method':_0x38ce('0x4'),'uri':url[_0x38ce('0x5')](_0x26ec48[_0x38ce('0x6')],'/token'),'form':{'grant_type':_0x38ce('0x7'),'username':_0x26ec48[_0x38ce('0x8')],'password':_0x26ec48['password']},'json':!![]};return rp(_0x1b4dd4)[_0x38ce('0x9')](function(_0xbe7332){var _0x3f8011={'method':'POST','uri':url[_0x38ce('0x5')](_0x26ec48['ndassistant_url'],_0x38ce('0xa')),'body':{'type':_0x26ec48['ndaactivity_type']||_0x38ce('0xb'),'channelId':_0x38ce('0xc'),'conversation':{'id':_0xee1d0e[_0x38ce('0xd')]},'from':{'id':_0xee1d0e[_0x38ce('0xe')],'name':_0xee1d0e[_0x38ce('0xf')]},'recipient':{'id':_0xee1d0e[_0x38ce('0x10')],'name':_0xee1d0e[_0x38ce('0x11')]},'text':_0x26ec48[_0x38ce('0x12')],'channelData':{}},'headers':{'Authorization':_0x38ce('0x13')+_0xbe7332[_0x38ce('0x14')]},'json':!![]};if(_0x26ec48[_0x38ce('0x15')]){_0x3f8011[_0x38ce('0x16')][_0x38ce('0x17')][_0x38ce('0x18')]=_0x26ec48[_0x38ce('0x15')];}if(_0x26ec48[_0x38ce('0x19')]=='1'){_0x3f8011['body']['channelData'][_0x38ce('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x38ce('0x1b')};}if(_0x26ec48[_0x38ce('0x1c')]){_0x3f8011['body'][_0x38ce('0x17')]['CustomAction']=_0x26ec48[_0x38ce('0x1c')];if(_0x26ec48[_0x38ce('0x1d')]){_0x3f8011['body'][_0x38ce('0x17')][_0x38ce('0x1e')]=_0x26ec48[_0x38ce('0x1d')];}}logger['info'](JSON[_0x38ce('0x1f')](_0x3f8011));return rp(_0x3f8011);});}; \ No newline at end of file +var _0x43c8=['/token','password','username','then','ndassistant_url','message','uniqueid','callerid','calleridname','dnid','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','url','agi','exports','POST','resolve'];(function(_0x55f36e,_0x336ec3){var _0x29e495=function(_0x34706b){while(--_0x34706b){_0x55f36e['push'](_0x55f36e['shift']());}};_0x29e495(++_0x336ec3);}(_0x43c8,0xaf));var _0x843c=function(_0x4c6699,_0x12df33){_0x4c6699=_0x4c6699-0x0;var _0x1891bc=_0x43c8[_0x4c6699];return _0x1891bc;};'use strict';var rp=require('request-promise');var url=require(_0x843c('0x0'));var logger=require('../../../../../config/logger')(_0x843c('0x1'));module[_0x843c('0x2')]=function(_0x254ff3,_0x302fdb){var _0x227b2a={'method':_0x843c('0x3'),'uri':url[_0x843c('0x4')](_0x302fdb['ndauth_url'],_0x843c('0x5')),'form':{'grant_type':_0x843c('0x6'),'username':_0x302fdb[_0x843c('0x7')],'password':_0x302fdb[_0x843c('0x6')]},'json':!![]};return rp(_0x227b2a)[_0x843c('0x8')](function(_0x49aee7){var _0x327327={'method':_0x843c('0x3'),'uri':url['resolve'](_0x302fdb[_0x843c('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x302fdb['ndaactivity_type']||_0x843c('0xa'),'channelId':'Nda','conversation':{'id':_0x254ff3[_0x843c('0xb')]},'from':{'id':_0x254ff3[_0x843c('0xc')],'name':_0x254ff3[_0x843c('0xd')]},'recipient':{'id':_0x254ff3[_0x843c('0xe')],'name':_0x254ff3['extension']},'text':_0x302fdb[_0x843c('0xf')],'channelData':{}},'headers':{'Authorization':_0x843c('0x10')+_0x49aee7[_0x843c('0x11')]},'json':!![]};if(_0x302fdb[_0x843c('0x12')]){_0x327327[_0x843c('0x13')][_0x843c('0x14')][_0x843c('0x15')]=_0x302fdb[_0x843c('0x12')];}if(_0x302fdb[_0x843c('0x16')]=='1'){_0x327327[_0x843c('0x13')][_0x843c('0x14')][_0x843c('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x843c('0x18')};}if(_0x302fdb[_0x843c('0x19')]){_0x327327[_0x843c('0x13')]['channelData'][_0x843c('0x1a')]=_0x302fdb[_0x843c('0x19')];if(_0x302fdb[_0x843c('0x1b')]){_0x327327[_0x843c('0x13')][_0x843c('0x14')]['CustomActionData']=_0x302fdb[_0x843c('0x1b')];}}logger[_0x843c('0x1c')](JSON[_0x843c('0x1d')](_0x327327));return rp(_0x327327);});}; \ 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 31b7bc5..1657cf0 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 _0x3a2c=['exports'];(function(_0x254d9f,_0x54ddb5){var _0x1eedb9=function(_0x2d05f1){while(--_0x2d05f1){_0x254d9f['push'](_0x254d9f['shift']());}};_0x1eedb9(++_0x54ddb5);}(_0x3a2c,0xa5));var _0xc3a2=function(_0x141b44,_0x151f94){_0x141b44=_0x141b44-0x0;var _0x5891ee=_0x3a2c[_0x141b44];return _0x5891ee;};'use strict';var asr=require('./lib/api');module[_0xc3a2('0x0')]=function(_0xadae2d,_0x3335e0,_0x39f3ad,_0x388785){return asr(_0xadae2d,_0x3335e0,_0x39f3ad,_0x388785);}; \ No newline at end of file +var _0xfe97=['./lib/api','exports'];(function(_0x2c1034,_0x200d0a){var _0xdaec76=function(_0x41346a){while(--_0x41346a){_0x2c1034['push'](_0x2c1034['shift']());}};_0xdaec76(++_0x200d0a);}(_0xfe97,0x140));var _0x7fe9=function(_0x56074b,_0x1fced1){_0x56074b=_0x56074b-0x0;var _0x54b63e=_0xfe97[_0x56074b];return _0x54b63e;};'use strict';var asr=require(_0x7fe9('0x0'));module[_0x7fe9('0x1')]=function(_0x405599,_0x4a2df4,_0x500a80,_0x2e3dbe){return asr(_0x405599,_0x4a2df4,_0x500a80,_0x2e3dbe);}; \ 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 1402c36..ac9cbe8 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 _0x7e88=['Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','crypto','../../../../../../config/logger','agi','exports','info','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','Open\x20Tilde\x20ASR\x20socket','unix','createReadStream','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','hypotheses','likelihood','Success.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error'];(function(_0x1efdca,_0x35f429){var _0x2481fa=function(_0x192a22){while(--_0x192a22){_0x1efdca['push'](_0x1efdca['shift']());}};_0x2481fa(++_0x35f429);}(_0x7e88,0x16e));var _0x87e8=function(_0x1b9556,_0x6cd69c){_0x1b9556=_0x1b9556-0x0;var _0x30c48c=_0x7e88[_0x1b9556];return _0x30c48c;};'use strict';var BPromise=require(_0x87e8('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x87e8('0x1'));var logger=require(_0x87e8('0x2'))(_0x87e8('0x3'));module[_0x87e8('0x4')]=function(_0x4509d2,_0x6eb914,_0xf0e624,_0x2d6a8a){return new BPromise(function(_0x48e5a2,_0x4722eb){logger[_0x87e8('0x5')]('Tilde\x20URI',_0x2d6a8a||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x26e007=new WebSocket(_0x2d6a8a||_0x87e8('0x6'),{'perMessageDeflate':![]});var _0x5e5ccb='';var _0x1edd9b='0';var _0x155645='1';var _0xe48662=_0x87e8('0x7');function _0x2aee9d(_0x388b50){var _0xce7285=crypto[_0x87e8('0x8')](_0x87e8('0x9'));_0xce7285[_0x87e8('0xa')](_0x388b50);return _0xce7285[_0x87e8('0xb')](_0x87e8('0xc'));}function _0x1b4281(){try{logger[_0x87e8('0x5')](_0x87e8('0xd'));var _0x3bc867=moment()[_0x87e8('0xe')]();var _0x14dea2=_0x2aee9d(_0x3bc867+_0x6eb914+_0xf0e624);_0x26e007['send'](JSON['stringify']({'appID':_0x6eb914,'timestamp':_0x3bc867,'appKey':_0x14dea2}));var _0x18c35c=fs[_0x87e8('0xf')](_0x4509d2);_0x18c35c['on']('data',function(_0x2486dc){_0x26e007[_0x87e8('0x10')](_0x2486dc);});_0x18c35c['on'](_0x87e8('0x11'),function(){_0x26e007[_0x87e8('0x10')](_0x87e8('0x12'));});}catch(_0xbc6818){logger[_0x87e8('0x13')](_0x87e8('0x14'),JSON[_0x87e8('0x15')](_0xbc6818));_0x26e007[_0x87e8('0x16')]();}}function _0xf4beab(_0x34d4b5){try{if(_0x34d4b5){var _0x2b1e40=JSON[_0x87e8('0x17')](_0x34d4b5);switch(_0x2b1e40[_0x87e8('0x18')]){case 0x0:if(_0x2b1e40[_0x87e8('0x19')]){if(_0x2b1e40[_0x87e8('0x19')][_0x87e8('0x1a')]){logger[_0x87e8('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0x87e8('0x15')](_0x2b1e40[_0x87e8('0x19')][_0x87e8('0x1b')]));_0x5e5ccb=_0x2b1e40[_0x87e8('0x19')]['hypotheses'][0x0]['transcript'];_0x1edd9b=_0x2b1e40[_0x87e8('0x19')][_0x87e8('0x1b')][0x0][_0x87e8('0x1c')];_0x155645='0';_0xe48662=_0x87e8('0x1d');_0x26e007[_0x87e8('0x16')]();}}break;case 0x1:logger[_0x87e8('0x5')](_0x87e8('0x7'));_0x155645='1';_0xe48662=_0x87e8('0x7');break;case 0x2:logger[_0x87e8('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x155645='2';_0xe48662='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x87e8('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x155645='9';_0xe48662=_0x87e8('0x1e');break;case 0xa:logger[_0x87e8('0x5')](_0x87e8('0x1f'));_0x155645='10';_0xe48662=_0x87e8('0x1f');break;case 0xb:logger[_0x87e8('0x5')](_0x87e8('0x20'));_0x155645='11';_0xe48662=_0x87e8('0x20');}}}catch(_0x23177e){logger[_0x87e8('0x13')](_0x87e8('0x21'),JSON[_0x87e8('0x15')](_0x23177e));_0x26e007[_0x87e8('0x16')]();}}function _0x3f8b2e(){logger[_0x87e8('0x5')](_0x87e8('0x22'));_0x48e5a2({'transcript':_0x5e5ccb,'confidence':_0x1edd9b,'status':_0x155645,'status_message':_0xe48662});}function _0x259522(_0x3fa03a){logger[_0x87e8('0x13')](_0x87e8('0x23'));if(!_[_0x87e8('0x24')](_0x3fa03a)){logger[_0x87e8('0x13')](_[_0x87e8('0x25')](_0x3fa03a)?JSON[_0x87e8('0x15')](_0x3fa03a):_0x3fa03a);}}_0x26e007['on'](_0x87e8('0x26'),_0x1b4281);_0x26e007['on'](_0x87e8('0x27'),_0xf4beab);_0x26e007['on'](_0x87e8('0x11'),_0x3f8b2e);_0x26e007['on']('error',_0x259522);});}; \ No newline at end of file +var _0x786b=['hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','data','send','close','EOS','error','terminate','parse','status','result','final','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','update','digest'];(function(_0x44425c,_0x278574){var _0x566013=function(_0x19e485){while(--_0x19e485){_0x44425c['push'](_0x44425c['shift']());}};_0x566013(++_0x278574);}(_0x786b,0x1d5));var _0xb786=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x786b[_0x46e363];return _0x3fb059;};'use strict';var BPromise=require(_0xb786('0x0'));var _=require(_0xb786('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb786('0x2'));var crypto=require(_0xb786('0x3'));var logger=require(_0xb786('0x4'))('agi');module[_0xb786('0x5')]=function(_0x460e1c,_0x14d4ad,_0x2bbe84,_0x59679d){return new BPromise(function(_0x29a867,_0x5856ee){logger[_0xb786('0x6')](_0xb786('0x7'),_0x59679d||_0xb786('0x8'));var _0x183781=new WebSocket(_0x59679d||_0xb786('0x8'),{'perMessageDeflate':![]});var _0x120120='';var _0x13ad1e='0';var _0x3b6792='1';var _0x506755='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x205c49(_0x207fc2){var _0x554507=crypto['createHash']('sha1');_0x554507[_0xb786('0x9')](_0x207fc2);return _0x554507[_0xb786('0xa')](_0xb786('0xb'));}function _0x47fc13(){try{logger[_0xb786('0x6')](_0xb786('0xc'));var _0x345a3e=moment()[_0xb786('0xd')]();var _0x2f10e4=_0x205c49(_0x345a3e+_0x14d4ad+_0x2bbe84);_0x183781['send'](JSON[_0xb786('0xe')]({'appID':_0x14d4ad,'timestamp':_0x345a3e,'appKey':_0x2f10e4}));var _0x2233b2=fs['createReadStream'](_0x460e1c);_0x2233b2['on'](_0xb786('0xf'),function(_0x77e390){_0x183781[_0xb786('0x10')](_0x77e390);});_0x2233b2['on'](_0xb786('0x11'),function(){_0x183781[_0xb786('0x10')](_0xb786('0x12'));});}catch(_0x5733d3){logger[_0xb786('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0xb786('0xe')](_0x5733d3));_0x183781[_0xb786('0x14')]();}}function _0x373b2a(_0x3af933){try{if(_0x3af933){var _0x4bc738=JSON[_0xb786('0x15')](_0x3af933);switch(_0x4bc738[_0xb786('0x16')]){case 0x0:if(_0x4bc738[_0xb786('0x17')]){if(_0x4bc738[_0xb786('0x17')][_0xb786('0x18')]){logger[_0xb786('0x6')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x4bc738[_0xb786('0x17')][_0xb786('0x19')]));_0x120120=_0x4bc738[_0xb786('0x17')][_0xb786('0x19')][0x0][_0xb786('0x1a')];_0x13ad1e=_0x4bc738[_0xb786('0x17')][_0xb786('0x19')][0x0][_0xb786('0x1b')];_0x3b6792='0';_0x506755=_0xb786('0x1c');_0x183781[_0xb786('0x14')]();}}break;case 0x1:logger[_0xb786('0x6')](_0xb786('0x1d'));_0x3b6792='1';_0x506755=_0xb786('0x1d');break;case 0x2:logger[_0xb786('0x6')](_0xb786('0x1e'));_0x3b6792='2';_0x506755='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0xb786('0x1f'));_0x3b6792='9';_0x506755=_0xb786('0x1f');break;case 0xa:logger[_0xb786('0x6')](_0xb786('0x20'));_0x3b6792='10';_0x506755=_0xb786('0x20');break;case 0xb:logger[_0xb786('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x3b6792='11';_0x506755=_0xb786('0x21');}}}catch(_0xaa7ee){logger[_0xb786('0x13')](_0xb786('0x22'),JSON[_0xb786('0xe')](_0xaa7ee));_0x183781[_0xb786('0x14')]();}}function _0x445ae6(){logger[_0xb786('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x29a867({'transcript':_0x120120,'confidence':_0x13ad1e,'status':_0x3b6792,'status_message':_0x506755});}function _0x22248f(_0x2535e3){logger[_0xb786('0x13')](_0xb786('0x23'));if(!_[_0xb786('0x24')](_0x2535e3)){logger[_0xb786('0x13')](_[_0xb786('0x25')](_0x2535e3)?JSON[_0xb786('0xe')](_0x2535e3):_0x2535e3);}}_0x183781['on'](_0xb786('0x26'),_0x47fc13);_0x183781['on'](_0xb786('0x27'),_0x373b2a);_0x183781['on'](_0xb786('0x11'),_0x445ae6);_0x183781['on']('error',_0x22248f);});}; \ 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 f9aa435..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 _0xbc58=['./asr','exports'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xbc58,0x1ee));var _0x8bc5=function(_0x4fb2d8,_0x44ecc9){_0x4fb2d8=_0x4fb2d8-0x0;var _0x5aa5e3=_0xbc58[_0x4fb2d8];return _0x5aa5e3;};var asr=require(_0x8bc5('0x0'));module[_0x8bc5('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 11c9b88..370c399 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 _0xd0a5=['error','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','E_AGI_SERVER_CLOSE','nextTick','net','EventEmitter','./channel','127.0.0.1','emit'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xd0a5,0x1c6));var _0x5d0a=function(_0x1d638a,_0x2c4d2b){_0x1d638a=_0x1d638a-0x0;var _0x59a099=_0xd0a5[_0x1d638a];return _0x59a099;};'use strict';var util=require('util');var net=require(_0x5d0a('0x0'));var EventEmitter=require('events')[_0x5d0a('0x1')];var AGIError=require('./error');var AGIChannel=require(_0x5d0a('0x2'));var AGIServer=function(_0x5808ab,_0x2c650f,_0x10f317){var _0x110efd=this,_0x5808ab=_0x5808ab||0x11dd,_0x2c650f=_0x2c650f||_0x5d0a('0x3'),_0x120a15=null,_0x28b1a1=0x0;EventEmitter['call'](_0x110efd);function _0x51bc9f(){if(!_0x5808ab){_0x110efd[_0x5d0a('0x4')](_0x5d0a('0x5'),new AGIError(_0x5d0a('0x6')));return![];}_0x120a15=net['createServer']();_0x120a15[_0x5d0a('0x7')](_0x5808ab,_0x2c650f);_0x120a15['on']('listening',function(){_0x110efd[_0x5d0a('0x4')](_0x5d0a('0x8'));});_0x120a15['on'](_0x5d0a('0x9'),function(_0x38e7dd){_0x120a15[_0x5d0a('0xa')](function(_0x174cae,_0x5c6492){if(_0x174cae){_0x110efd['emit']('error',new AGIError(_0x5d0a('0xb'),_0x174cae));}else if(_0x10f317&&_0x10f317<0x0){_0x110efd[_0x5d0a('0x4')]('error',new AGIError(_0x5d0a('0xc')));_0x38e7dd[_0x5d0a('0xd')]();}else if(_0x10f317&&_0x10f317>0x0&&_0x10f317<_0x5c6492){_0x28b1a1+=0x1;_0x110efd[_0x5d0a('0x4')](_0x5d0a('0x5'),new AGIError(_0x5d0a('0xe'),_0x28b1a1));_0x38e7dd[_0x5d0a('0xd')]();}else{var _0x2a3ea7=new AGIChannel(_0x38e7dd);_0x2a3ea7['on']('ready',function(){_0x110efd[_0x5d0a('0x4')](_0x5d0a('0x9'),_0x2a3ea7);});}});});_0x120a15['on']('error',function(_0x1f888f){_0x110efd[_0x5d0a('0x4')](_0x5d0a('0x5'),new AGIError(_0x5d0a('0xb'),_0x1f888f['code']));});_0x120a15['on']('close',function(){_0x110efd['emit']('close',new AGIError(_0x5d0a('0xf')));});}process[_0x5d0a('0x10')](function(){_0x51bc9f();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x1877bf,_0x45289e,_0x36d048){return new AGIServer(_0x1877bf,_0x45289e,_0x36d048);}; \ No newline at end of file +var _0x96fc=['127.0.0.1','call','createServer','listening','connection','getConnections','emit','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./error','./channel'];(function(_0xab3a95,_0x34b0d2){var _0x5c9ab8=function(_0x3dcef5){while(--_0x3dcef5){_0xab3a95['push'](_0xab3a95['shift']());}};_0x5c9ab8(++_0x34b0d2);}(_0x96fc,0x13f));var _0xc96f=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x96fc[_0x1cc8fe];return _0x230054;};'use strict';var util=require(_0xc96f('0x0'));var net=require(_0xc96f('0x1'));var EventEmitter=require(_0xc96f('0x2'))[_0xc96f('0x3')];var AGIError=require(_0xc96f('0x4'));var AGIChannel=require(_0xc96f('0x5'));var AGIServer=function(_0x1d2d65,_0x3afd1e,_0x284ed7){var _0x45282f=this,_0x1d2d65=_0x1d2d65||0x11dd,_0x3afd1e=_0x3afd1e||_0xc96f('0x6'),_0x7dc051=null,_0x4b779b=0x0;EventEmitter[_0xc96f('0x7')](_0x45282f);function _0x180297(){if(!_0x1d2d65){_0x45282f['emit']('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x7dc051=net[_0xc96f('0x8')]();_0x7dc051['listen'](_0x1d2d65,_0x3afd1e);_0x7dc051['on'](_0xc96f('0x9'),function(){_0x45282f['emit'](_0xc96f('0x9'));});_0x7dc051['on'](_0xc96f('0xa'),function(_0x84f2ad){_0x7dc051[_0xc96f('0xb')](function(_0x4acb9f,_0x3c77f8){if(_0x4acb9f){_0x45282f[_0xc96f('0xc')](_0xc96f('0xd'),new AGIError(_0xc96f('0xe'),_0x4acb9f));}else if(_0x284ed7&&_0x284ed7<0x0){_0x45282f['emit'](_0xc96f('0xd'),new AGIError(_0xc96f('0xf')));_0x84f2ad[_0xc96f('0x10')]();}else if(_0x284ed7&&_0x284ed7>0x0&&_0x284ed7<_0x3c77f8){_0x4b779b+=0x1;_0x45282f[_0xc96f('0xc')](_0xc96f('0xd'),new AGIError(_0xc96f('0x11'),_0x4b779b));_0x84f2ad['destroy']();}else{var _0x1e55c6=new AGIChannel(_0x84f2ad);_0x1e55c6['on'](_0xc96f('0x12'),function(){_0x45282f[_0xc96f('0xc')](_0xc96f('0xa'),_0x1e55c6);});}});});_0x7dc051['on'](_0xc96f('0xd'),function(_0x128b2f){_0x45282f[_0xc96f('0xc')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x128b2f[_0xc96f('0x13')]));});_0x7dc051['on'](_0xc96f('0x14'),function(){_0x45282f['emit'](_0xc96f('0x14'),new AGIError(_0xc96f('0x15')));});}process[_0xc96f('0x16')](function(){_0x180297();});};util[_0xc96f('0x17')](AGIServer,EventEmitter);module[_0xc96f('0x18')]=function(_0x517219,_0x4fa203,_0x51dccc){return new AGIServer(_0x517219,_0x4fa203,_0x51dccc);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index a2fbd33..8b797e3 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 _0x04e0=['out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','wav','NOBEEP','recordFile','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20FOUND\x20BY','math','operation','math\x20%s','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','gosub','position','QUEUE','record','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','%s_STATUS_MESSAGE','saydigits','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','service','host','port','secure','pass','template_id','sendMail\x20message','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','sms_account_id','no\x20sms\x20account\x20found','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','yes','Answer','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','util','lodash','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','then','name','catch','prototype','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','format','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','agicommand','createSquareRecording','uniqueid','callerid','calleridname','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','text','languageCode','ssmlGender','MALE','MP3','google_tts_language','restAPI','url','method','timeout','number','includes','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','en-US','model','awsPolly','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_access_key_id','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','isEmpty','%s.%s','replaceAllVariables','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','label','no\x20grammar\x20configured','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','wait','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','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','MRCPRecog','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','toUpperCase','speech'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x04e0,0xd2));var _0x004e=function(_0x3c65b6,_0x14107e){_0x3c65b6=_0x3c65b6-0x0;var _0x1387a4=_0x04e0[_0x3c65b6];return _0x1387a4;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x004e('0x0'));var _=require(_0x004e('0x1'));var sh=require(_0x004e('0x2'));var odbc=require('odbc')();var rs=require(_0x004e('0x3'));var moment=require(_0x004e('0x4'));var Mustache=require(_0x004e('0x5'));var rp=require(_0x004e('0x6'));var logger=require(_0x004e('0x7'))(_0x004e('0x8'));var config=require(_0x004e('0x9'));var scripts=require(_0x004e('0xa'));var FILES_PATH=_0x004e('0xb');var recursiveMapAttributes=[_0x004e('0xc'),_0x004e('0xd')];var verticesWithRetry=[_0x004e('0xe'),_0x004e('0xf'),_0x004e('0x10')];var AGIVertices=function(_0x8eadd3,_0x5b5f4a,_0x1c2094){this[_0x004e('0x11')]=_0x8eadd3;this[_0x004e('0x12')]=_0x5b5f4a;this[_0x004e('0x13')]=_0x1c2094;};AGIVertices['prototype'][_0x004e('0x14')]=function(_0x37263f,_0xb84aca){this[_0x004e('0x12')]['getVariableById'](_0x37263f)[_0x004e('0x15')](function(_0x293748){_0xb84aca(null,_0x293748?_0x293748[_0x004e('0x16')]:![]);})[_0x004e('0x17')](function(_0x196517){_0xb84aca(_0x196517);});};AGIVertices[_0x004e('0x18')][_0x004e('0x19')]=function(_0x281e78,_0x9e1aab){this[_0x004e('0x12')]['getVoiceQueueById'](_0x281e78)[_0x004e('0x15')](function(_0x38b995){_0x9e1aab(null,_0x38b995?_0x38b995[_0x004e('0x16')]:![]);})[_0x004e('0x17')](function(_0x35616f){_0x9e1aab(_0x35616f);});};AGIVertices[_0x004e('0x18')][_0x004e('0x1a')]=function(_0x4fa55b,_0x13c0d2){this['rpc'][_0x004e('0x1b')](_0x4fa55b)['then'](function(_0x1e0a5e){_0x13c0d2(null,_0x1e0a5e?_0x1e0a5e['name']:![]);})[_0x004e('0x17')](function(_0x28f98f){_0x13c0d2(_0x28f98f);});};AGIVertices[_0x004e('0x18')][_0x004e('0x1c')]=function(_0x5065c0,_0x197c8f){this['rpc'][_0x004e('0x1d')](_0x5065c0)[_0x004e('0x15')](function(_0x267aa){_0x197c8f(null,_0x267aa?_0x267aa[_0x004e('0x1e')]:![]);})['catch'](function(_0xb2b7d1){_0x197c8f(_0xb2b7d1);});};AGIVertices[_0x004e('0x18')][_0x004e('0x1f')]=function(_0x2c0cbc,_0x32a8bb){this[_0x004e('0x12')][_0x004e('0x20')](_0x2c0cbc)[_0x004e('0x15')](function(_0x5780c9){_0x32a8bb(null,_0x5780c9?_0x5780c9[_0x004e('0x16')]:![]);})[_0x004e('0x17')](function(_0x12e3b6){_0x32a8bb(_0x12e3b6);});};AGIVertices['prototype'][_0x004e('0x21')]=function(_0x345151,_0x3facc6){this['rpc'][_0x004e('0x22')](_0x345151)[_0x004e('0x15')](function(_0x3bebe8){_0x3facc6(null,_0x3bebe8?_0x3bebe8[_0x004e('0x16')]:![]);})[_0x004e('0x17')](function(_0x49c9d9){_0x3facc6(_0x49c9d9);});};AGIVertices[_0x004e('0x18')][_0x004e('0x23')]=function(_0x2c397e,_0x1f8d58){var _0x30924d=this;this[_0x004e('0x12')][_0x004e('0x24')](_0x2c397e)[_0x004e('0x15')](function(_0x4afdc6){_0x1f8d58(null,_0x4afdc6?_0x30924d[_0x004e('0x25')](_0x4afdc6['save_name']):![]);})['catch'](function(_0x11f9c4){_0x1f8d58(_0x11f9c4);});};AGIVertices[_0x004e('0x18')]['getMailAccount']=function(_0x6c462a,_0x1cbd1c){this['rpc']['getMailAccountById'](_0x6c462a)['then'](function(_0x4cba10){_0x1cbd1c(null,_0x4cba10?_0x4cba10:![]);})[_0x004e('0x17')](function(_0x4d2323){_0x1cbd1c(_0x4d2323);});};AGIVertices['prototype'][_0x004e('0x26')]=function(_0x1ad079,_0xa639d0,_0x3e6b9c){this['mailRpc'][_0x004e('0x26')](_0x1ad079,_0xa639d0)[_0x004e('0x15')](function(){_0x3e6b9c(null);})[_0x004e('0x17')](function(_0x58c0a9){_0x3e6b9c(_0x58c0a9);});};AGIVertices[_0x004e('0x18')][_0x004e('0x27')]=function(_0x4b6a59,_0x53c914){this[_0x004e('0x12')]['getIntervalById'](_0x4b6a59)['then'](function(_0x107529){if(_0x107529){if(_0x107529[_0x004e('0x28')]){_0x53c914(null,[_0x107529[_0x004e('0x29')]]);}else{_0x53c914(null,_[_0x004e('0x2a')](_0x107529[_0x004e('0x2b')],_0x004e('0x29')));}}else{_0x53c914(null,![]);}})[_0x004e('0x17')](function(_0xd763d3){_0x53c914(_0xd763d3);});};AGIVertices[_0x004e('0x18')][_0x004e('0x25')]=function(_0x8ad157){return util[_0x004e('0x2c')]('%s/sounds/converted/%s',FILES_PATH,_0x8ad157);};AGIVertices[_0x004e('0x18')][_0x004e('0x2d')]=function(_0x3f74c0,_0x42fb75,_0x427900){odbc[_0x004e('0x2e')](_0x3f74c0,function(_0x454cee){if(_0x454cee){logger[_0x004e('0x2f')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x454cee);_0x427900(_0x454cee);}else{logger[_0x004e('0x30')](_0x004e('0x31'));odbc[_0x004e('0x32')](_0x42fb75,function(_0x323ae7,_0x304720){if(_0x323ae7){logger[_0x004e('0x30')]('Error\x20executing\x20query\x20%s',_0x42fb75);_0x427900(_0x323ae7);}else{logger['info'](_0x004e('0x33'),_0x42fb75);odbc[_0x004e('0x34')](function(_0x525029){if(_0x525029){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x525029);}_0x427900(null,_0x304720);});}});}});};AGIVertices['prototype'][_0x004e('0x35')]=function(_0x2ed1c9,_0x1a01d0){this[_0x004e('0x12')][_0x004e('0x36')](_0x2ed1c9)[_0x004e('0x15')](function(_0x119b95){_0x1a01d0(null,_0x119b95?_0x119b95:![]);})[_0x004e('0x17')](function(_0x199065){_0x1a01d0(_0x199065);});};AGIVertices[_0x004e('0x18')][_0x004e('0x37')]=function(_0x2d79bc,_0x4ec07f){this['rpc'][_0x004e('0x37')](_0x2d79bc)[_0x004e('0x15')](function(_0x4eb2af){_0x4ec07f(null,_0x4eb2af);})[_0x004e('0x17')](function(_0x54067e){_0x4ec07f(_0x54067e);});};AGIVertices[_0x004e('0x18')]['createSquareDetailsReport']=function(_0x33e3d2,_0x9a7a81,_0xae946a){this[_0x004e('0x12')][_0x004e('0x38')]({'uniqueid':this[_0x004e('0x11')]['uniqueid'],'node':_0x33e3d2['label'],'application':_0x33e3d2[_0x004e('0x39')],'data':_0x9a7a81||null,'project_name':this[_0x004e('0x11')]['arg_1'],'callerid':this[_0x004e('0x11')]['callerid']})[_0x004e('0x15')](function(_0x126a15){if(_0xae946a){_0xae946a(null,_0x126a15);}})[_0x004e('0x17')](function(_0x5e96a5){if(_0xae946a){_0xae946a(_0x5e96a5);}});};AGIVertices[_0x004e('0x18')]['createSquareRecording']=function(_0xbc6573,_0x4b51a4,_0x3eb829,_0x3332a5){this[_0x004e('0x12')][_0x004e('0x3a')]({'uniqueid':this[_0x004e('0x11')][_0x004e('0x3b')],'callerid':this[_0x004e('0x11')][_0x004e('0x3c')],'calleridname':this[_0x004e('0x11')][_0x004e('0x3d')],'context':this[_0x004e('0x11')]['context'],'extension':this[_0x004e('0x11')][_0x004e('0x3e')],'priority':this[_0x004e('0x11')][_0x004e('0x3f')],'accountcode':this[_0x004e('0x11')][_0x004e('0x40')],'dnid':this['channel'][_0x004e('0x41')],'projectName':this[_0x004e('0x11')]['arg_1'],'saveName':_0x4b51a4,'filename':_0xbc6573['file']||_0x4b51a4,'savePath':_0x3eb829})['then'](function(_0x2c7abe){_0x3332a5(null,_0x2c7abe);})['catch'](function(_0x4e82c8){_0x3332a5(_0x4e82c8);});};AGIVertices[_0x004e('0x18')][_0x004e('0x42')]=function(_0x46aea5,_0x2a457e,_0x183010,_0x4c77bc,_0x1636a0){this['rpc'][_0x004e('0x42')]({'uniqueid':this['channel']['uniqueid'],'body':_0x46aea5,'direction':_0x2a457e,'providerName':_0x183010,'providerResponse':_0x4c77bc})[_0x004e('0x15')](function(_0x4da5d3){if(_0x1636a0){_0x1636a0(null,_0x4da5d3);}})[_0x004e('0x17')](function(_0x4f9848){if(_0x1636a0){_0x1636a0(_0x4f9848);}});};AGIVertices[_0x004e('0x18')][_0x004e('0x43')]=function(_0xabefb3,_0x1f4496){this[_0x004e('0x12')]['createCmContact']({'firstName':_['isEmpty'](_0xabefb3[_0x004e('0x16')])||_[_0x004e('0x44')](_0xabefb3['name'])?_0x004e('0x45')+Math[_0x004e('0x46')]():_0xabefb3[_0x004e('0x16')],'lastName':_['isEmpty'](_0xabefb3['lastName'])||_[_0x004e('0x44')](_0xabefb3[_0x004e('0x47')])?null:_0xabefb3[_0x004e('0x47')],'phone':_0xabefb3[_0x004e('0x48')],'ListId':_0xabefb3[_0x004e('0x49')],'scheduledat':_0xabefb3['scheduledAt'],'callbackUniqueid':this[_0x004e('0x11')][_0x004e('0x3b')],'tags':_0x004e('0x4a'),'description':_0x004e('0x4b')+_0xabefb3[_0x004e('0x4c')][_0x004e('0x4d')](),'priority':_0xabefb3[_0x004e('0x4e')]})[_0x004e('0x15')](function(_0x4cada4){_0x1f4496(null,_0x4cada4);})[_0x004e('0x17')](function(_0x4873a7){_0x1f4496(_0x4873a7);});};AGIVertices['prototype']['getPause']=function(_0x4fef3b,_0x15b16e){this[_0x004e('0x12')][_0x004e('0x4f')](_0x4fef3b)['then'](function(_0x1630fa){_0x15b16e(null,_0x1630fa?_0x1630fa['name']:![]);})[_0x004e('0x17')](function(_0x1bea48){_0x15b16e(_0x1bea48);});};AGIVertices['prototype'][_0x004e('0x50')]=function(_0x5c6ff3,_0x18af9f,_0xf34f35){var _0x4928c4={'role':_0x004e('0x51')};_0x4928c4[_0x5c6ff3]=this[_0x004e('0x11')][_0x004e('0x3c')];this[_0x004e('0x12')][_0x004e('0x50')](_0x4928c4,_0x18af9f,this[_0x004e('0x11')][_0x004e('0x3b')])['then'](function(_0x41f22f){_0xf34f35(null,_[_0x004e('0x44')](_0x41f22f)?![]:!![]);})['catch'](function(_0x354958){logger[_0x004e('0x2f')](_0x354958);_0xf34f35(null,![]);});};AGIVertices[_0x004e('0x18')][_0x004e('0x52')]=function(_0x53b36e,_0x3eb566){var _0x38c4ca={'role':_0x004e('0x51')};_0x38c4ca[_0x53b36e]=this[_0x004e('0x11')][_0x004e('0x3c')];this[_0x004e('0x12')][_0x004e('0x52')](_0x38c4ca)[_0x004e('0x15')](function(_0x198787){_0x3eb566(null,_['isNil'](_0x198787)?![]:!![]);})['catch'](function(_0x27517a){logger['error'](_0x27517a);_0x3eb566(null,![]);});};AGIVertices[_0x004e('0x18')][_0x004e('0x53')]=function(_0x1a2da3,_0x4f844a){var _0x154293={'role':_0x004e('0x51')};_0x154293[_0x1a2da3]=this['channel'][_0x004e('0x3c')];this[_0x004e('0x12')][_0x004e('0x53')](_0x154293)[_0x004e('0x15')](function(_0x433a7d){_0x4f844a(null,_[_0x004e('0x44')](_0x433a7d)?![]:!![]);})[_0x004e('0x17')](function(_0x6f6c1b){logger[_0x004e('0x2f')](_0x6f6c1b);_0x4f844a(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x47b251,_0x17fdbc){var _0x1c4ebd={'role':_0x004e('0x51')};_0x1c4ebd[_0x47b251]=this['channel'][_0x004e('0x3c')];var _0x4facb9=_0x47b251!=_0x004e('0x54')?util['format'](_0x004e('0x55'),_0x004e('0x56'),this['channel']['callerid']):undefined;this[_0x004e('0x12')][_0x004e('0x57')](_0x1c4ebd,_0x4facb9)[_0x004e('0x15')](function(_0x5a1d2d){_0x17fdbc(null,_[_0x004e('0x44')](_0x5a1d2d)?![]:!![]);})['catch'](function(_0x44b21b){logger[_0x004e('0x2f')](_0x44b21b);_0x17fdbc(null,![]);});};AGIVertices[_0x004e('0x18')][_0x004e('0x58')]=function(_0x55b75f,_0x2a5f2a){sh[_0x004e('0x59')](_[_0x004e('0x5a')](_0x55b75f),function(_0x3e6d70,_0x77c3ed){var _0x4b52be=_0x77c3ed[_0x004e('0x5b')](/(\r\n|\n|\r)/gm,'');_0x2a5f2a(null,_0x4b52be);});};AGIVertices[_0x004e('0x18')][_0x004e('0x5c')]=function(_0x1f3cc5,_0x4343de){scripts[_0x004e('0x5c')](_0x1f3cc5['apiKey'],_0x1f3cc5['google_cloud_tts_text_type']||_0x004e('0x5d'),_0x1f3cc5[_0x004e('0x5d')],_0x1f3cc5[_0x004e('0x5e')]||'en-US',_0x1f3cc5[_0x004e('0x5f')]||_0x004e('0x60'),_0x1f3cc5['audioEncoding']||_0x004e('0x61'))['then'](function(_0x1f62a9){_0x4343de(null,_0x1f62a9);})[_0x004e('0x17')](function(_0x202729){_0x4343de(_0x202729);});};AGIVertices['prototype']['googleTTS']=function(_0x203735,_0x9f73e8){scripts['googleTTS'](_0x203735[_0x004e('0x5d')],_0x203735[_0x004e('0x62')]||'en',0x1)[_0x004e('0x15')](function(_0x28a51f){_0x9f73e8(null,_0x28a51f);})['catch'](function(_0x501ca6){_0x9f73e8(_0x501ca6);});};AGIVertices[_0x004e('0x18')][_0x004e('0x63')]=function(_0x3d2022,_0x693caa){var _0x2bae96={'uri':_0x3d2022[_0x004e('0x64')],'method':_0x3d2022[_0x004e('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3d2022[_0x004e('0x66')])===_0x004e('0x67')&&parseInt(_0x3d2022[_0x004e('0x66')])>=0x1?parseInt(_0x3d2022[_0x004e('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x004e('0x68')](['POST',_0x004e('0x69')],_0x2bae96[_0x004e('0x65')]['toUpperCase']())){try{_0x2bae96[_0x004e('0x6a')]=_0x3d2022[_0x004e('0xd')]?JSON[_0x004e('0x6b')](_0x3d2022['rawBody']):{};}catch(_0x1f87cf){logger[_0x004e('0x2f')](_0x004e('0x6c'),_0x1f87cf);}}try{_0x2bae96[_0x004e('0x6d')]=_0x3d2022[_0x004e('0xc')]?JSON['parse'](_0x3d2022['rawHeaders']):{};}catch(_0x2175c0){logger[_0x004e('0x2f')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2175c0);}if(_0x3d2022[_0x004e('0x6e')]){try{var _0x498307=require(_0x3d2022[_0x004e('0x6e')])[_0x004e('0x6f')](this,_0x2bae96);_0x2bae96[_0x004e('0x70')]=Mustache[_0x004e('0x71')](_0x3d2022[_0x004e('0x64')],_0x498307,{},['$$','$$']);if(_0x2bae96[_0x004e('0x6d')]){_0x2bae96[_0x004e('0x6d')]=JSON[_0x004e('0x6b')](Mustache[_0x004e('0x71')](JSON[_0x004e('0x72')](_0x2bae96[_0x004e('0x6d')]),_0x498307,{},['$$','$$']));}if(_0x2bae96[_0x004e('0x6a')]){_0x2bae96[_0x004e('0x6a')]=JSON[_0x004e('0x6b')](Mustache['render'](JSON[_0x004e('0x72')](_0x2bae96['body']),_0x498307,{},['$$','$$']));}}catch(_0x2089ec){logger[_0x004e('0x2f')](_0x004e('0x73'),_0x2089ec);}}rp(_0x2bae96)[_0x004e('0x15')](function(_0xa2aa5a){var _0x16ca8e={'statusCode':_0xa2aa5a[_0x004e('0x74')]||0xc8,'statusMessage':_0xa2aa5a[_0x004e('0x75')]||'OK','headers':_0xa2aa5a[_0x004e('0x6d')]||{},'body':_0xa2aa5a['body']||{}};_0x693caa(null,_0x16ca8e);})[_0x004e('0x17')](function(_0x1ba2ac){var _0x1995fd={'statusCode':_0x1ba2ac[_0x004e('0x74')]||0x1f4,'statusMessage':_0x1ba2ac[_0x004e('0x76')]||_0x004e('0x77'),'headers':_0x1ba2ac[_0x004e('0x78')][_0x004e('0x6d')]||{},'body':_0x1ba2ac[_0x004e('0x78')][_0x004e('0x6a')]||{}};_0x693caa(null,_0x1995fd);});};AGIVertices[_0x004e('0x18')][_0x004e('0x79')]=function(_0x2fd7a1,_0x4a7047){scripts[_0x004e('0x79')](this[_0x004e('0x11')][_0x004e('0x3b')],_0x2fd7a1[_0x004e('0x7a')],_0x2fd7a1[_0x004e('0x5d')],_0x2fd7a1['dialogflow_language']||'en')[_0x004e('0x15')](function(_0xabea7f){_0x4a7047(null,_0xabea7f);})[_0x004e('0x17')](function(_0x198c59){_0x4a7047(_0x198c59);});};AGIVertices[_0x004e('0x18')]['googleDialogflowV2']=function(_0x57ea08,_0x572873){scripts[_0x004e('0x7b')](this[_0x004e('0x11')]['uniqueid'],_0x57ea08[_0x004e('0x7c')],_0x57ea08[_0x004e('0x7d')],_0x57ea08[_0x004e('0x7e')],_0x57ea08[_0x004e('0x5d')],_0x57ea08[_0x004e('0x7f')]||'en')[_0x004e('0x15')](function(_0x457847){_0x572873(null,_0x457847);})[_0x004e('0x17')](function(_0x212684){_0x572873(_0x212684);});};AGIVertices[_0x004e('0x18')][_0x004e('0x80')]=function(_0x3db2c0,_0x46553c){scripts[_0x004e('0x80')](this[_0x004e('0x11')],_0x3db2c0)[_0x004e('0x15')](function(_0x38eabb){_0x46553c(null,_0x38eabb);})[_0x004e('0x17')](function(_0x1a5068){_0x46553c(_0x1a5068);});};AGIVertices['prototype'][_0x004e('0x81')]=function(_0x754b23,_0x30f744){scripts['ispeechTTS'](_0x754b23['key'],_0x754b23['text'],_0x754b23['ispeech_tts_language']||'en-US',_0x754b23[_0x004e('0x82')])[_0x004e('0x15')](function(_0x1113a3){_0x30f744(null,_0x1113a3);})[_0x004e('0x17')](function(_0x4b7628){_0x30f744(_0x4b7628);});};AGIVertices['prototype'][_0x004e('0x83')]=function(_0x174366,_0x148a7c,_0x1d5306){scripts[_0x004e('0x83')](_0x148a7c,_0x174366[_0x004e('0x7a')],_0x174366[_0x004e('0x84')]||_0x004e('0x85'),this['isConfigured'](_0x174366[_0x004e('0x86')])?_0x174366['model']:undefined)[_0x004e('0x15')](function(_0x55bf66){_0x1d5306(null,_0x55bf66);})[_0x004e('0x17')](function(_0x4616a6){_0x1d5306(_0x4616a6);});};AGIVertices[_0x004e('0x18')]['awsPolly']=function(_0x4a1f15,_0x455448){scripts[_0x004e('0x87')](_0x4a1f15['aws_access_key_id'],_0x4a1f15['aws_secret_access_key'],_0x4a1f15[_0x004e('0x88')],_0x4a1f15[_0x004e('0x89')]||_0x004e('0x8a'),_0x4a1f15[_0x004e('0x5d')],_0x4a1f15['aws_text_type']||_0x004e('0x5d'))[_0x004e('0x15')](function(_0x1130ce){_0x455448(null,_0x1130ce);})['catch'](function(_0x5b6caa){_0x455448(_0x5b6caa);});};AGIVertices[_0x004e('0x18')][_0x004e('0x8b')]=function(_0x2ffe70,_0x530d51){scripts[_0x004e('0x8b')](this[_0x004e('0x11')]['uniqueid'],_0x2ffe70[_0x004e('0x8c')],_0x2ffe70[_0x004e('0x8d')],_0x2ffe70[_0x004e('0x8e')],_0x2ffe70[_0x004e('0x5d')],_0x2ffe70[_0x004e('0x8f')])[_0x004e('0x15')](function(_0x1cce20){_0x530d51(null,_0x1cce20);})[_0x004e('0x17')](function(_0x336500){_0x530d51(_0x336500);});};AGIVertices['prototype'][_0x004e('0x90')]=function(_0x43e22a,_0x7729dd,_0x5aae88){scripts['googleASR'](_0x7729dd,_0x43e22a[_0x004e('0x7a')],_0x43e22a['google_asr_language']||_0x004e('0x85'))[_0x004e('0x15')](function(_0x297655){_0x5aae88(null,_0x297655);})['catch'](function(_0x1cfeac){_0x5aae88(_0x1cfeac);});};AGIVertices[_0x004e('0x18')][_0x004e('0x91')]=function(_0x42504f,_0x2e8c4a,_0x340789){scripts[_0x004e('0x91')](_0x2e8c4a,_0x42504f[_0x004e('0x92')],_0x42504f[_0x004e('0x93')],_0x42504f[_0x004e('0x70')])[_0x004e('0x15')](function(_0x3a1af7){_0x340789(null,_0x3a1af7);})[_0x004e('0x17')](function(_0x32d07f){_0x340789(_0x32d07f);});};AGIVertices[_0x004e('0x18')][_0x004e('0x94')]=function(_0x2fb398){var _0xb7d4ea=_['includes'](verticesWithRetry,_0x2fb398[_0x004e('0x39')])?_0x2fb398:_['clone'](_0x2fb398);for(var _0x71d521 in _0xb7d4ea){if(_0xb7d4ea[_0x004e('0x95')](_0x71d521)){if(_0xb7d4ea[_0x71d521]&&_[_0x004e('0x96')](_0xb7d4ea[_0x71d521])){if(_['includes'](recursiveMapAttributes,_0x71d521)){_0xb7d4ea[_0x71d521]=this[_0x004e('0x97')](_0xb7d4ea[_0x71d521]);}else{_0xb7d4ea[_0x71d521]=this['replaceAllVariables'](_0xb7d4ea[_0x71d521]);}}}}return _0xb7d4ea;};AGIVertices[_0x004e('0x18')][_0x004e('0x98')]=function(_0x3e20b0){for(var _0x5d0527 in _0x3e20b0){if(_0x3e20b0[_0x004e('0x95')](_0x5d0527)){if(_[_0x004e('0x99')](_0x3e20b0[_0x5d0527])){this[_0x004e('0x98')](_0x3e20b0[_0x5d0527]);}else if(_[_0x004e('0x9a')](_0x3e20b0[_0x5d0527])){for(var _0x415571=0x0;_0x415571<_0x3e20b0[_0x5d0527][_0x004e('0x9b')];_0x415571++){this[_0x004e('0x98')](_0x3e20b0[_0x5d0527][_0x415571]);}}else if(_[_0x004e('0x96')](_0x3e20b0[_0x5d0527])){_0x3e20b0[_0x5d0527]=this['replaceAllVariables'](_0x3e20b0[_0x5d0527]);}}}};AGIVertices[_0x004e('0x18')][_0x004e('0x9c')]=function(_0x281086,_0xbed50){for(var _0x2e24df in _0x281086){if(_0x281086['hasOwnProperty'](_0x2e24df)){if(_['isPlainObject'](_0x281086[_0x2e24df])){if(!_[_0x004e('0x9d')](_0x281086[_0x2e24df])){this[_0x004e('0x9c')](_0x281086[_0x2e24df],util[_0x004e('0x2c')](_0x004e('0x9e'),_0xbed50,_0x2e24df));}}else if(_[_0x004e('0x9a')](_0x281086[_0x2e24df])){for(var _0x485677=0x0;_0x485677<_0x281086[_0x2e24df]['length'];_0x485677++){this[_0x004e('0x9c')](_0x281086[_0x2e24df][_0x485677],util[_0x004e('0x2c')](_0x004e('0x9e'),_0xbed50,_0x2e24df+'['+_0x485677+']'));}}else{if(!_['isNil'](_0x281086[_0x2e24df])){this[_0x004e('0x11')]['setVariable'](util[_0x004e('0x2c')](_0x004e('0x9e'),_0xbed50,_0x2e24df),_0x281086[_0x2e24df]);}}}}};AGIVertices['prototype'][_0x004e('0x97')]=function(_0x40e2e4){try{var _0x3096aa=JSON[_0x004e('0x6b')](_0x40e2e4);this[_0x004e('0x98')](_0x3096aa);return JSON[_0x004e('0x72')](_0x3096aa);}catch(_0x416265){return this['replaceAllVariables'](_0x40e2e4);}};AGIVertices[_0x004e('0x18')][_0x004e('0x9f')]=function(_0x358172){var _0x2dbf0b=_0x358172[_0x004e('0xa0')]('{');for(var _0x21efa9=0x1;_0x21efa9<_0x2dbf0b['length'];_0x21efa9+=0x1){var _0x521bce=_0x2dbf0b[_0x21efa9][_0x004e('0xa0')]('}');if(_0x521bce['length']>0x1){_0x358172=_0x358172[_0x004e('0xa1')]('{'+_0x521bce[0x0]+'}',this[_0x004e('0x11')]['getVariable'](_0x521bce[0x0])[_0x004e('0xa2')]||_0x521bce[0x0]);}}if(_0x2dbf0b[_0x004e('0x9b')]===0x1){return _0x358172[_0x004e('0x4d')]();}return this[_0x004e('0x9f')](_0x358172);};AGIVertices[_0x004e('0x18')][_0x004e('0xa3')]=function(_0x2c943a,_0x26b48d){var _0x3dbf4f=this['channel'][_0x004e('0x14')](_0x2c943a);if(_0x3dbf4f['result']===-0x1){return _0x3dbf4f;}logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0xa4'),_0x26b48d,_0x3dbf4f[_0x004e('0xa2')]));return this['channel'][_0x004e('0xa5')](_0x26b48d,_0x3dbf4f[_0x004e('0xa2')]);};AGIVertices[_0x004e('0x18')][_0x004e('0xa6')]=function(_0x1efa0c){return _0x1efa0c&&_0x1efa0c!=='0'&&_0x1efa0c!=='-1'&&_0x1efa0c!=='';};AGIVertices[_0x004e('0x18')][_0x004e('0xa7')]=function(_0x83d817){this[_0x004e('0x38')][_0x004e('0x6f')](this,_0x83d817,'-');_0x83d817[_0x004e('0xa8')]=_0x83d817[_0x004e('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x004e('0x18')][_0x004e('0xa9')]=function(_0x5b91d3){logger[_0x004e('0x30')](util['format'](_0x004e('0xaa'),_0x5b91d3['label']));if(!this['isConfigured'](_0x5b91d3[_0x004e('0x5d')])){return this['channel'][_0x004e('0xab')](_0x004e('0xac'));}var _0x2cdf6d='\x22'+_0x5b91d3['text']+'\x22';if(this[_0x004e('0xa6')](_0x5b91d3[_0x004e('0x78')])){_0x2cdf6d+=','+_0x5b91d3[_0x004e('0x78')];}var _0x364725=this[_0x004e('0x11')][_0x004e('0x59')](_0x004e('0xad'),_0x2cdf6d);if(_0x364725[_0x004e('0xae')]===-0x1){return _0x364725;}return this['channel'][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0xaf'),_0x2cdf6d));};AGIVertices['prototype'][_0x004e('0xb0')]=function(_0x171cb7){logger[_0x004e('0x30')](util[_0x004e('0x2c')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x171cb7[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0x171cb7['grammar'])){return this['channel'][_0x004e('0xab')](_0x004e('0xb2'));}var _0x4b611c=_0x171cb7[_0x004e('0xb3')];if(this['isConfigured'](_0x171cb7[_0x004e('0x78')])){_0x4b611c+=','+_0x171cb7[_0x004e('0x78')];}var _0x5e6a39=this[_0x004e('0x11')][_0x004e('0x59')]('MRCPRecog',_0x4b611c);if(_0x5e6a39[_0x004e('0xae')]===-0x1){return _0x5e6a39;}var _0x32d997=this[_0x004e('0xa3')](_0x004e('0xb4'),_0x004e('0xb5'));if(_0x32d997['result']===-0x1){return _0x32d997;}var _0x306426=this[_0x004e('0xa3')]('RECOG_INPUT()',_0x004e('0xb6'));if(_0x306426[_0x004e('0xae')]===-0x1){return _0x306426;}var _0x7ce1d4=this['getAndSetVariable'](_0x004e('0xb7'),_0x004e('0xb8'));if(_0x7ce1d4[_0x004e('0xae')]===-0x1){return _0x7ce1d4;}return this[_0x004e('0x11')]['noop'](util[_0x004e('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4b611c));};AGIVertices[_0x004e('0x18')][_0x004e('0x8')]=function(_0x44b46a){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0xb9'),_0x44b46a['label']));return this[_0x004e('0x11')][_0x004e('0x8')]([_0x44b46a[_0x004e('0xba')],_0x44b46a[_0x004e('0xbb')]]);};AGIVertices['prototype'][_0x004e('0xbc')]=function(_0x100f44){logger[_0x004e('0x30')](util[_0x004e('0x2c')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x100f44[_0x004e('0xb1')]));if(this[_0x004e('0xa6')](_0x100f44[_0x004e('0x66')])){logger[_0x004e('0x30')](util[_0x004e('0x2c')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x100f44[_0x004e('0x66')]));var _0x38d63c=this[_0x004e('0x11')][_0x004e('0xbd')](_0x100f44['timeout']);if(_0x38d63c['result']===-0x1){return _0x38d63c;}}return this['channel']['answer']();};AGIVertices[_0x004e('0x18')][_0x004e('0x4a')]=function(_0xe2042d){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0xbe'),_0xe2042d[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0xe2042d[_0x004e('0x49')])){return this['channel'][_0x004e('0x2f')](_0xe2042d,_0x004e('0xbf'));}_0xe2042d[_0x004e('0x4c')]=moment();if(this[_0x004e('0xa6')](_0xe2042d[_0x004e('0xc0')])){_0xe2042d[_0x004e('0x4c')]=moment()[_0x004e('0xc1')](_0xe2042d[_0x004e('0xc0')],_0x004e('0xc2'));}if(!this[_0x004e('0xa6')](_0xe2042d[_0x004e('0x4e')])){_0xe2042d[_0x004e('0x4e')]=0x2;}this['createCmContact'][_0x004e('0x6f')](this,_0xe2042d);return this[_0x004e('0x11')]['noop'](util[_0x004e('0x2c')](_0x004e('0xc3'),_0xe2042d[_0x004e('0x48')],_0xe2042d[_0x004e('0x49')],_0xe2042d[_0x004e('0x4c')]));};AGIVertices['prototype'][_0x004e('0xc4')]=function(_0xef3512){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0xc5'),_0xef3512[_0x004e('0xb1')]));var _0x2d05ff=this[_0x004e('0x11')][_0x004e('0x59')](_0xef3512['application'],_0xef3512[_0x004e('0x78')]);if(_0x2d05ff[_0x004e('0xae')]===-0x1){return _0x2d05ff;}return this[_0x004e('0x11')]['noop'](util[_0x004e('0x2c')](_0x004e('0xc6'),_0xef3512[_0x004e('0xc7')],_0xef3512[_0x004e('0x78')]));};AGIVertices[_0x004e('0x18')][_0x004e('0xc8')]=function(_0x368276){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0xc9'),_0x368276['label']));if(!this[_0x004e('0xa6')](_0x368276[_0x004e('0x5d')])){return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0xac'));}var _0x543bf2='\x22'+_0x368276[_0x004e('0x5d')]+'\x22';if(this[_0x004e('0xa6')](_0x368276['options'])){_0x543bf2+=','+_0x368276[_0x004e('0x78')];}var _0x310fa5=this[_0x004e('0x11')][_0x004e('0x59')]('MRCPSynth',_0x543bf2);if(_0x310fa5[_0x004e('0xae')]===-0x1){return _0x310fa5;}return this[_0x004e('0x11')][_0x004e('0xab')](util['format'](_0x004e('0xaf'),_0x543bf2));};AGIVertices['prototype'][_0x004e('0xca')]=function(_0x3ef316){logger[_0x004e('0x30')](util[_0x004e('0x2c')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x3ef316[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0x3ef316[_0x004e('0x5d')])){return this['channel'][_0x004e('0xab')](_0x004e('0xac'));}var _0x53e649='\x22'+_0x3ef316[_0x004e('0x5d')]+'\x22';if(this[_0x004e('0xa6')](_0x3ef316[_0x004e('0x78')])){_0x53e649+=','+_0x3ef316[_0x004e('0x78')];}var _0x2851e2=this[_0x004e('0x11')][_0x004e('0x59')](_0x004e('0xad'),_0x53e649);if(_0x2851e2[_0x004e('0xae')]===-0x1){return _0x2851e2;}return this[_0x004e('0x11')]['noop'](util[_0x004e('0x2c')](_0x004e('0xaf'),_0x53e649));};AGIVertices[_0x004e('0x18')][_0x004e('0xcb')]=function(_0x483092){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0xcc'),_0x483092[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0x483092[_0x004e('0xb3')])){return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0xb2'));}var _0x14ecd7=_0x483092[_0x004e('0xb3')];if(this[_0x004e('0xa6')](_0x483092[_0x004e('0x78')])){_0x14ecd7+=','+_0x483092[_0x004e('0x78')];}var _0x12ba68=this[_0x004e('0x11')]['exec']('MRCPRecog',_0x14ecd7);if(_0x12ba68['result']===-0x1){return _0x12ba68;}var _0x32e3a8=this[_0x004e('0xa3')](_0x004e('0xb4'),_0x004e('0xcd'));if(_0x32e3a8[_0x004e('0xae')]===-0x1){return _0x32e3a8;}var _0x3a3f37=this[_0x004e('0xa3')](_0x004e('0xce'),_0x004e('0xcf'));if(_0x3a3f37['result']===-0x1){return _0x3a3f37;}var _0x1def3d=this[_0x004e('0xa3')](_0x004e('0xb7'),_0x004e('0xd0'));if(_0x1def3d[_0x004e('0xae')]===-0x1){return _0x1def3d;}return this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0xd1'),_0x14ecd7));};AGIVertices[_0x004e('0x18')][_0x004e('0xd2')]=function(_0x49e1fa){logger[_0x004e('0x30')](util[_0x004e('0x2c')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x49e1fa[_0x004e('0xb1')]));if(!this['isConfigured'](_0x49e1fa[_0x004e('0xb3')])){return this['channel'][_0x004e('0xab')](_0x004e('0xb2'));}var _0x322c0d=_0x49e1fa[_0x004e('0xb3')];if(this[_0x004e('0xa6')](_0x49e1fa[_0x004e('0x78')])){_0x322c0d+=','+_0x49e1fa['options'];}var _0x1c58a7=this[_0x004e('0x11')]['exec'](_0x004e('0xd3'),_0x322c0d);if(_0x1c58a7['result']===-0x1){return _0x1c58a7;}var _0x40d5a1=this[_0x004e('0xa3')](_0x004e('0xb4'),_0x004e('0xd4'));if(_0x40d5a1[_0x004e('0xae')]===-0x1){return _0x40d5a1;}var _0x558794=this[_0x004e('0xa3')](_0x004e('0xce'),_0x004e('0xd5'));if(_0x558794[_0x004e('0xae')]===-0x1){return _0x558794;}var _0x5dade8=this[_0x004e('0xa3')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x5dade8[_0x004e('0xae')]===-0x1){return _0x5dade8;}return this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0xd1'),_0x322c0d));};AGIVertices['prototype'][_0x004e('0xd6')]=function(_0x10ae4c){logger[_0x004e('0x30')](util['format'](_0x004e('0xd7'),_0x10ae4c['label']));if(!this[_0x004e('0xa6')](_0x10ae4c[_0x004e('0xd8')])){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x10ae4c,_0x004e('0xd9'));}var _0x47cb19=this[_0x004e('0x1c')][_0x004e('0x6f')](this,_0x10ae4c[_0x004e('0xd8')]);if(!_0x47cb19){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x10ae4c,'no\x20odbc\x20database\x20found');}if(!this[_0x004e('0xa6')](_0x10ae4c[_0x004e('0x32')])){return this['channel'][_0x004e('0x2f')](_0x10ae4c,_0x004e('0xda'));}var _0xb7c8ef=_0x10ae4c[_0x004e('0x32')][_0x004e('0x5b')](/(\r\n|\n|\r)/gm,'\x20');this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0xdb'),_0xb7c8ef));var _0x16448d=this[_0x004e('0x2d')]['sync'](this,_0x47cb19,_0xb7c8ef);this['createSquareDetailsReport'][_0x004e('0x6f')](this,_0x10ae4c,_0xb7c8ef);if(!this[_0x004e('0xa6')](_0x10ae4c[_0x004e('0xdc')])){return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0xdd'));}var _0x28d011=this[_0x004e('0x14')]['sync'](this,_0x10ae4c['variable_id']);if(!_0x28d011){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x10ae4c,_0x004e('0xde'));}var _0x12e37e=this;_0x16448d['forEach'](function(_0x5af879,_0x53cb9e){Object[_0x004e('0xdf')](_0x5af879)[_0x004e('0xe0')](function(_0x228712){_0x12e37e[_0x004e('0x11')][_0x004e('0xa5')](util['format'](_0x004e('0xe1'),_0x28d011,_0x53cb9e,_0x228712),_0x5af879[_0x228712]);});});this[_0x004e('0x11')][_0x004e('0xa5')](util[_0x004e('0x2c')](_0x004e('0xe2'),_0x28d011),_0x16448d[_0x004e('0x9b')]);return this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0xe3'),_0x28d011));};AGIVertices[_0x004e('0x18')]['dial']=function(_0xe0fee9){logger[_0x004e('0xe4')](util[_0x004e('0x2c')](_0x004e('0xe5'),_0xe0fee9[_0x004e('0xb1')]));if(!this['isConfigured'](_0xe0fee9[_0x004e('0xe6')])){return this[_0x004e('0x11')][_0x004e('0x2f')](_0xe0fee9,_0x004e('0xe7'));}var _0x8e6ba8=this[_0x004e('0x1f')][_0x004e('0x6f')](this,_0xe0fee9[_0x004e('0xe6')]);if(!_0x8e6ba8){return this[_0x004e('0x11')][_0x004e('0x2f')](_0xe0fee9,_0x004e('0xe8'));}var _0x1be637=this[_0x004e('0x11')]['exec']('DIAL',[util[_0x004e('0x2c')](_0x004e('0xe9'),_0x8e6ba8),_0xe0fee9[_0x004e('0x66')],_0xe0fee9[_0x004e('0xea')],_0xe0fee9['url']]);if(_0x1be637[_0x004e('0xae')]===-0x1){return _0x1be637;}return this[_0x004e('0x11')][_0x004e('0xab')](util['format']('Executed\x20command\x20%s',_0x004e('0xeb')));};AGIVertices[_0x004e('0x18')][_0x004e('0xec')]=function(_0x35eaae){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0xed'),_0x35eaae[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0x35eaae[_0x004e('0x7a')])){return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0xee'));}if(!this[_0x004e('0xa6')](_0x35eaae[_0x004e('0x5d')])){return this['channel'][_0x004e('0xab')](_0x004e('0xac'));}this[_0x004e('0x11')][_0x004e('0xef')]=!![];this['createSquareDetailsReport'](_0x35eaae);this[_0x004e('0x42')](_0x35eaae[_0x004e('0x5d')],'in','','');this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0xf0'),_0x35eaae[_0x004e('0x5d')]));var _0x17b1a7=this['googleDialogflow'][_0x004e('0x6f')](this,_0x35eaae);if(_0x17b1a7){for(var _0x46b780 in _0x17b1a7){if(_0x17b1a7[_0x004e('0x95')](_0x46b780)){this[_0x004e('0x11')][_0x004e('0xa5')](util[_0x004e('0x2c')]('DIALOGFLOW_%s',_0x46b780[_0x004e('0xf1')]()),_0x17b1a7[_0x46b780]);}}this[_0x004e('0x42')](_0x17b1a7[_0x004e('0xf2')],_0x004e('0xf3'),'dialogflow','');return this[_0x004e('0x11')][_0x004e('0xab')](util['format'](_0x004e('0xf4'),_0x17b1a7[_0x004e('0xf2')]));}return this[_0x004e('0x11')][_0x004e('0x2f')](_0x35eaae,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0x004e('0xf5')]=function(_0x1e093d){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0xf6'),_0x1e093d[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0x1e093d[_0x004e('0x7c')])){return this[_0x004e('0x11')]['noop']('no\x20project_id\x20configured');}if(!this[_0x004e('0xa6')](_0x1e093d[_0x004e('0x7d')])){return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0xf7'));}if(!this['isConfigured'](_0x1e093d[_0x004e('0x7e')])){return this['channel']['noop']('no\x20private_key\x20configured');}if(!this[_0x004e('0xa6')](_0x1e093d[_0x004e('0x7f')])){return this['channel'][_0x004e('0xab')](_0x004e('0xf8'));}if(!this[_0x004e('0xa6')](_0x1e093d[_0x004e('0x5d')])){return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0xac'));}this['channel'][_0x004e('0xef')]=!![];this[_0x004e('0x38')](_0x1e093d);this[_0x004e('0x42')](_0x1e093d[_0x004e('0x5d')],'in','','');this['channel'][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0xf9'),_0x1e093d[_0x004e('0x5d')]));var _0x291c4f=this[_0x004e('0x7b')][_0x004e('0x6f')](this,_0x1e093d);if(_0x291c4f){for(var _0xebd923 in _0x291c4f){if(_0x291c4f[_0x004e('0x95')](_0xebd923)){if(_0xebd923!=='providerResponse'){this[_0x004e('0x11')]['setVariable'](util[_0x004e('0x2c')](_0x004e('0xfa'),_0xebd923[_0x004e('0xf1')]()),_0x291c4f[_0xebd923]);}}}this['createSquareMessage'](_0x291c4f['speech'],_0x004e('0xf3'),'dialogflowV2',_0x291c4f[_0x004e('0xfb')]);return this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0xfc'),_0x291c4f[_0x004e('0xf2')]));}return this['channel'][_0x004e('0x2f')](_0x1e093d,_0x004e('0xfd'));};AGIVertices[_0x004e('0x18')][_0x004e('0xfe')]=function(_0x1f662a){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0xff'),_0x1f662a['label']));if(!this[_0x004e('0xa6')](_0x1f662a[_0x004e('0x100')])){return this['channel']['noop'](_0x004e('0x101'));}if(!this['isConfigured'](_0x1f662a[_0x004e('0x102')])){return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0x103'));}if(!this[_0x004e('0xa6')](_0x1f662a[_0x004e('0x104')])){return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0x105'));}if(!this['isConfigured'](_0x1f662a[_0x004e('0x106')])){return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0xac'));}this[_0x004e('0x11')][_0x004e('0xef')]=!![];this['createSquareDetailsReport'](_0x1f662a);this[_0x004e('0x42')](_0x1f662a[_0x004e('0x5d')],'in','','');this['channel'][_0x004e('0xab')](util['format'](_0x004e('0x107'),_0x1f662a[_0x004e('0x5d')]));var _0x5ea06d=this['sestekNDA'][_0x004e('0x6f')](this,_0x1f662a);if(_0x5ea06d){for(var _0x5c0864 in _0x5ea06d){if(_0x5ea06d['hasOwnProperty'](_0x5c0864)){this['channel'][_0x004e('0xa5')](util['format'](_0x004e('0x108'),_0x5c0864[_0x004e('0xf1')]()),_0x5ea06d[_0x5c0864]);}}this[_0x004e('0x42')](_0x5ea06d['speech'],_0x004e('0xf3'),_0x004e('0xfe'),'');if(_0x5ea06d[_0x004e('0x109')]){this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0x10a'),_0x5ea06d[_0x004e('0x109')]));var _0x374462=this[_0x004e('0x11')][_0x004e('0x10b')](_0x5ea06d[_0x004e('0x109')]);try{fs['unlink'](_0x5ea06d[_0x004e('0x109')]+_0x004e('0x10c'));}catch(_0x281897){logger[_0x004e('0x2f')](_0x281897);}return _0x374462;}else{return this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0x10d'),_0x5ea06d['speech']));}}return this[_0x004e('0x11')]['error'](_0x1f662a,_0x004e('0x10e'));};AGIVertices[_0x004e('0x18')]['end']=function(_0x4771d7){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x10f'),_0x4771d7[_0x004e('0xb1')]));return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0x110'));};AGIVertices[_0x004e('0x18')][_0x004e('0x111')]=function(_0x2e707a){logger[_0x004e('0x30')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x2e707a[_0x004e('0xb1')]));var _0x334c72='';if(_0x2e707a[_0x004e('0x112')]){if(!this[_0x004e('0xa6')](_0x2e707a['trunk_id'])){return this[_0x004e('0x11')]['error'](_0x2e707a,_0x004e('0x113'));}else{var _0x50660f=parseInt(_0x2e707a[_0x004e('0x112')],0xa);if(isNaN(_0x50660f)){_0x334c72=_0x2e707a[_0x004e('0x112')];}else{_0x334c72=this[_0x004e('0x21')][_0x004e('0x6f')](this,_0x2e707a[_0x004e('0x112')]);if(!_0x334c72){return this[_0x004e('0x11')]['error'](_0x2e707a,_0x004e('0x114'));}}}}else if(_0x2e707a['trunk_name']){_0x334c72=_0x2e707a[_0x004e('0x115')];}else{return this['channel'][_0x004e('0x2f')](_0x2e707a,'no\x20trunk\x20selected');}var _0x191d3f=this[_0x004e('0x11')]['exec'](_0x004e('0xeb'),[util['format'](_0x004e('0x116'),_0x334c72,_0x2e707a[_0x004e('0x48')]),_0x2e707a[_0x004e('0x66')],_0x2e707a[_0x004e('0xea')],_0x2e707a['url']]);if(_0x191d3f['result']===-0x1){return _0x191d3f;}return this['channel']['noop'](util[_0x004e('0x2c')]('Executed\x20command\x20%s',_0x004e('0xeb')));};AGIVertices[_0x004e('0x18')][_0x004e('0x117')]=function(_0x260708){logger[_0x004e('0x30')](util['format'](_0x004e('0x118'),_0x260708[_0x004e('0xb1')]));return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0x117'));};AGIVertices[_0x004e('0x18')][_0x004e('0xf')]=function(_0x59ab48){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x119'),_0x59ab48[_0x004e('0xb1')]));if(_0x59ab48[_0x004e('0xa8')]===0x0){return this['maxRetry'](_0x59ab48);}_0x59ab48[_0x004e('0xa8')]-=0x1;if(!this[_0x004e('0xa6')](_0x59ab48[_0x004e('0x11a')])){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x59ab48,_0x004e('0x11b'));}var _0x87aaa2=this[_0x004e('0x23')][_0x004e('0x6f')](this,_0x59ab48[_0x004e('0x11a')]);if(!_0x87aaa2){return this['channel'][_0x004e('0x2f')](_0x59ab48,_0x004e('0x11c'));}if(!this[_0x004e('0xa6')](_0x59ab48[_0x004e('0xdc')])){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x004e('0xdd'));}var _0x1e8531=this[_0x004e('0x11')]['getData'](_0x87aaa2,_0x59ab48[_0x004e('0x11d')],_0x59ab48[_0x004e('0x11e')]);var _0x121f43=_0x1e8531[_0x004e('0xae')]?_0x1e8531[_0x004e('0xae')][_0x004e('0x4d')]():'';logger[_0x004e('0x30')]('test',JSON[_0x004e('0x72')](_0x1e8531));if(_0x1e8531[_0x004e('0xae')]===-0x1){this[_0x004e('0x38')]['sync'](this,_0x59ab48,_0x121f43);return _0x1e8531;}else if(_0x1e8531['extra']===_0x004e('0x66')){_0x1e8531[_0x004e('0xae')]=_0x121f43[_0x004e('0x9b')]>=parseInt(_0x59ab48[_0x004e('0x11f')])?'x':'i';}else{_0x1e8531[_0x004e('0xae')]=_0x121f43['length']>=parseInt(_0x59ab48[_0x004e('0x11f')])&&_0x121f43[_0x004e('0x9b')]<=parseInt(_0x59ab48[_0x004e('0x11e')])?'x':'i';}var _0x4bd305=this[_0x004e('0x14')]['sync'](this,_0x59ab48[_0x004e('0xdc')]);if(!_0x4bd305){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x59ab48,_0x004e('0xde'));}this['channel'][_0x004e('0xa5')](_0x4bd305,_0x121f43);if(this[_0x004e('0xa6')](_0x59ab48[_0x004e('0x120')])){var _0x20880d=parseInt(_0x59ab48[_0x004e('0x120')],0xa);var _0x538cf9=rs[_0x004e('0x121')]({'charset':'*','length':_0x20880d});var _0x5a65c1=_0x121f43[_0x004e('0x9b')];if(_0x5a65c1>0x0){if(_0x5a65c1>_0x20880d){this[_0x004e('0x38')][_0x004e('0x6f')](this,_0x59ab48,_0x59ab48[_0x004e('0x122')]===_0x004e('0x123')?_0x538cf9+_0x121f43[_0x004e('0x124')](_0x20880d):_0x121f43[_0x004e('0x124')](0x0,_0x5a65c1-_0x20880d)+_0x538cf9);}else{this[_0x004e('0x38')][_0x004e('0x6f')](this,_0x59ab48,rs['generate']({'charset':'*','length':_0x5a65c1}));}}else{this[_0x004e('0x38')][_0x004e('0x6f')](this,_0x59ab48,'');}}else{this[_0x004e('0x38')][_0x004e('0x6f')](this,_0x59ab48,_0x121f43);}return _0x1e8531;};AGIVertices[_0x004e('0x18')][_0x004e('0x10')]=function(_0x46c55b){logger['info'](util[_0x004e('0x2c')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x46c55b['label']));return this[_0x004e('0xf')](_0x46c55b);};AGIVertices[_0x004e('0x18')][_0x004e('0x125')]=function(_0x13e125){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x126'),_0x13e125[_0x004e('0xb1')]));this[_0x004e('0x38')][_0x004e('0x6f')](this,_0x13e125,_0x13e125['goalname']);return this[_0x004e('0x11')]['noop'](util['format'](_0x004e('0x127'),_0x13e125[_0x004e('0x128')]));};AGIVertices[_0x004e('0x18')]['awspolly']=function(_0x24c845){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x129'),_0x24c845[_0x004e('0xb1')]));if(!this['isConfigured'](_0x24c845['aws_access_key_id'])||!this[_0x004e('0xa6')](_0x24c845[_0x004e('0x8d')])){return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0x12a'));}if(!this[_0x004e('0xa6')](_0x24c845['text'])){return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0xac'));}this[_0x004e('0x11')]['noop'](util[_0x004e('0x2c')](_0x004e('0x12b'),_0x24c845[_0x004e('0x5d')]));var _0x217b31=this[_0x004e('0x87')]['sync'](this,_0x24c845);if(_0x217b31){this[_0x004e('0x11')]['noop'](util[_0x004e('0x2c')]('aws\x20Polly\x20%s\x20file\x20created',_0x217b31));var _0x4327a6=this[_0x004e('0x11')][_0x004e('0x10b')](_0x217b31);try{fs[_0x004e('0x12c')](_0x217b31+_0x004e('0x10c'));}catch(_0x4f6c26){logger['error'](_0x4f6c26);}return _0x4327a6;}return this[_0x004e('0x11')][_0x004e('0x2f')](_0x24c845,_0x004e('0x12d'));};AGIVertices['prototype'][_0x004e('0x12e')]=function(_0x2d2022){logger['info'](util['format'](_0x004e('0x12f'),_0x2d2022['label']));if(!this[_0x004e('0xa6')](_0x2d2022[_0x004e('0x8c')])||!this[_0x004e('0xa6')](_0x2d2022[_0x004e('0x8d')])){return this[_0x004e('0x11')]['noop'](_0x004e('0x12a'));}if(!this[_0x004e('0xa6')](_0x2d2022[_0x004e('0x8f')])){return this[_0x004e('0x11')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x004e('0xa6')](_0x2d2022[_0x004e('0x5d')])){return this[_0x004e('0x11')]['noop'](_0x004e('0xac'));}this[_0x004e('0x11')]['bot']=!![];this['createSquareDetailsReport'](_0x2d2022);this['createSquareMessage'](_0x2d2022['text'],'in','','');this['channel'][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0x130'),_0x2d2022[_0x004e('0x5d')]));var _0x3f6fb7=this['awsLex']['sync'](this,_0x2d2022);if(_0x3f6fb7){for(var _0x39db12 in _0x3f6fb7){if(_0x3f6fb7[_0x004e('0x95')](_0x39db12)&&_['isString'](_0x3f6fb7[_0x39db12])){this['channel'][_0x004e('0xa5')](util[_0x004e('0x2c')](_0x004e('0x131'),_0x39db12[_0x004e('0xf1')]()),_0x3f6fb7[_0x39db12]);}}if(_[_0x004e('0x44')](_0x3f6fb7[_0x004e('0x76')])){return this['channel'][_0x004e('0xab')](_0x004e('0x132'));}else{this[_0x004e('0x42')](_0x3f6fb7[_0x004e('0x76')],_0x004e('0xf3'),_0x004e('0x133'),'');return this[_0x004e('0x11')]['noop'](util[_0x004e('0x2c')](_0x004e('0x134'),_0x3f6fb7['message']));}}return this[_0x004e('0x11')][_0x004e('0x2f')](_0x2d2022,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x004e('0x18')][_0x004e('0x135')]=function(_0x794f86){logger[_0x004e('0x30')](util['format'](_0x004e('0x136'),_0x794f86['label'],_0x794f86['timeout']));if(!this[_0x004e('0xa6')](_0x794f86['key'])){return this[_0x004e('0x11')]['noop'](_0x004e('0xee'));}var _0x3ec34b='wav';var _0x4ec031=util[_0x004e('0x2c')](_0x004e('0x137'),FILES_PATH,rs[_0x004e('0x121')](0x4));var _0xaf0f28=util[_0x004e('0x2c')](_0x004e('0x9e'),_0x4ec031,_0x3ec34b);var _0x50432c=!![];if(_0x794f86[_0x004e('0x138')]==='NOBEEP'){_0x50432c=![];}var _0x200f10=this[_0x004e('0x11')]['recordFile'](_0x4ec031,_0x3ec34b,_0x794f86[_0x004e('0x139')],_0x794f86[_0x004e('0x66')],undefined,_0x50432c);if(_0x200f10[_0x004e('0xae')]!==-0x1){this[_0x004e('0x11')]['noop'](util['format']('google\x20%s\x20file\x20created',_0xaf0f28));var _0x5031bc=this[_0x004e('0x90')][_0x004e('0x6f')](this,_0x794f86,_0xaf0f28);if(_0x5031bc){for(var _0x1d8969 in _0x5031bc){if(_0x5031bc['hasOwnProperty'](_0x1d8969)){this[_0x004e('0x11')][_0x004e('0xa5')](util[_0x004e('0x2c')](_0x004e('0x13a'),_0x1d8969['toUpperCase']()),_0x5031bc[_0x1d8969]);}}return this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0x13b'),JSON[_0x004e('0x72')](_0x5031bc)));}}return _0x200f10;};AGIVertices['prototype']['tildeasr']=function(_0x305a02){logger['info'](util[_0x004e('0x2c')](_0x004e('0x13c'),_0x305a02[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0x305a02[_0x004e('0x92')])){return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0x13d'));}if(!this[_0x004e('0xa6')](_0x305a02[_0x004e('0x93')])){return this[_0x004e('0x11')]['noop']('no\x20appsecret\x20configured');}var _0x219aa0=_0x004e('0x13e');var _0x563749=util[_0x004e('0x2c')](_0x004e('0x137'),FILES_PATH,rs['generate'](0x4));var _0x340546=util[_0x004e('0x2c')](_0x004e('0x9e'),_0x563749,_0x219aa0);var _0x544e7d=!![];if(_0x305a02[_0x004e('0x138')]===_0x004e('0x13f')){_0x544e7d=![];}var _0x165b19=this[_0x004e('0x11')][_0x004e('0x140')](_0x563749,_0x219aa0,_0x305a02[_0x004e('0x139')],_0x305a02['timeout'],undefined,_0x544e7d);if(_0x165b19[_0x004e('0xae')]!==-0x1){this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')]('tilde\x20%s\x20file\x20created',_0x340546));var _0x5c158a=this[_0x004e('0x91')]['sync'](this,_0x305a02,_0x340546);if(_0x5c158a){for(var _0x4a5f1c in _0x5c158a){if(_0x5c158a[_0x004e('0x95')](_0x4a5f1c)){this['channel'][_0x004e('0xa5')](util['format'](_0x004e('0x141'),_0x4a5f1c[_0x004e('0xf1')]()),_0x5c158a[_0x4a5f1c]);}}return this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0x142'),JSON['stringify'](_0x5c158a)));}}return _0x165b19;};AGIVertices[_0x004e('0x18')][_0x004e('0x143')]=function(_0x2ea771){logger['info'](util['format'](_0x004e('0x144'),_0x2ea771[_0x004e('0xb1')]));return this['channel'][_0x004e('0x145')](_0x2ea771['context'],_0x2ea771[_0x004e('0x3e')],_0x2ea771['priority']);};AGIVertices['prototype'][_0x004e('0x146')]=function(_0x3428f7){logger[_0x004e('0x30')](util[_0x004e('0x2c')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x3428f7[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0x3428f7['condition'])){return this[_0x004e('0x11')]['error'](_0x3428f7,'no\x20condition\x20configured');}try{var _0x17d2ff=eval(_0x3428f7[_0x004e('0x147')])?'true':_0x004e('0x148');this[_0x004e('0x11')][_0x004e('0xab')](util['format'](_0x004e('0x149'),_0x3428f7[_0x004e('0x147')],_0x17d2ff));return{'code':0xc8,'result':_0x17d2ff};}catch(_0x8274df){return{'code':0xc8,'result':_0x004e('0x148')};}};AGIVertices[_0x004e('0x18')][_0x004e('0x14a')]=function(_0x5aaffe){logger['info'](util[_0x004e('0x2c')](_0x004e('0x14b'),_0x5aaffe['label']));if(!this[_0x004e('0xa6')](_0x5aaffe[_0x004e('0x14c')])){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x5aaffe,_0x004e('0x14d'));}var _0x521b2b=this[_0x004e('0x27')][_0x004e('0x6f')](this,_0x5aaffe[_0x004e('0x14c')]);if(!_0x521b2b){return this['channel']['error'](_0x5aaffe,_0x004e('0x14e'));}for(var _0x332df9=0x0;_0x332df9<_0x521b2b[_0x004e('0x9b')];_0x332df9+=0x1){var _0x22eb08=this[_0x004e('0x11')][_0x004e('0x14')](util[_0x004e('0x2c')](_0x004e('0x14f'),_0x521b2b[_0x332df9]));if(_0x22eb08[_0x004e('0xae')]===-0x1){return _0x22eb08;}logger['info'](util[_0x004e('0x2c')](_0x004e('0x150'),_0x521b2b[_0x332df9],_0x22eb08['extra']));if(_0x22eb08['extra']==='true'){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x150'),_0x521b2b[_0x332df9],_0x004e('0x151')));this['channel'][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0x150'),_0x521b2b[_0x332df9],_0x004e('0x151')));return{'code':0xc8,'result':_0x004e('0x151')};}else{logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x150'),_0x521b2b[_0x332df9],'false'));this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0x150'),_0x521b2b[_0x332df9],_0x004e('0x148')));}}return{'code':0xc8,'result':_0x004e('0x148')};};AGIVertices['prototype'][_0x004e('0x152')]=function(_0x70b461){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x153'),_0x70b461[_0x004e('0xb1')]));return this['channel']['hangup']();};AGIVertices[_0x004e('0x18')][_0x004e('0x154')]=function(_0x5ee26c){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x155'),_0x5ee26c[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0x5ee26c[_0x004e('0x7a')])){return this[_0x004e('0x11')]['noop']('no\x20key\x20configured');}var _0x24ebd2=_0x004e('0x13e');var _0x597673=util[_0x004e('0x2c')](_0x004e('0x137'),FILES_PATH,rs['generate'](0x4));var _0x28ae55=util[_0x004e('0x2c')](_0x004e('0x9e'),_0x597673,_0x24ebd2);var _0x699cfb=!![];if(_0x5ee26c[_0x004e('0x138')]===_0x004e('0x13f')){_0x699cfb=![];}var _0x19d865=this['channel'][_0x004e('0x140')](_0x597673,_0x24ebd2,_0x5ee26c[_0x004e('0x139')],_0x5ee26c['timeout'],undefined,_0x699cfb);if(_0x19d865['result']!==-0x1){this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0x156'),_0x28ae55));var _0x23069f=this[_0x004e('0x83')]['sync'](this,_0x5ee26c,_0x28ae55);if(_0x23069f){for(var _0x50815e in _0x23069f){if(_0x23069f['hasOwnProperty'](_0x50815e)){this[_0x004e('0x11')][_0x004e('0xa5')](util[_0x004e('0x2c')](_0x004e('0x157'),_0x50815e['toUpperCase']()),_0x23069f[_0x50815e]);}}return this[_0x004e('0x11')][_0x004e('0xab')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x004e('0x72')](_0x23069f)));}}return _0x19d865;};AGIVertices[_0x004e('0x18')]['ispeechtts']=function(_0x37d462){logger['info'](util[_0x004e('0x2c')](_0x004e('0x158'),_0x37d462[_0x004e('0xb1')]));if(!this['isConfigured'](_0x37d462[_0x004e('0x7a')])){return this['channel']['noop']('no\x20key\x20configured');}if(!this[_0x004e('0xa6')](_0x37d462['text'])){return this['channel']['noop'](_0x004e('0xac'));}this[_0x004e('0x11')]['noop'](util[_0x004e('0x2c')](_0x004e('0x159'),_0x37d462['text']));var _0x449bb1=this['ispeechTTS'][_0x004e('0x6f')](this,_0x37d462);if(_0x449bb1){this['channel'][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0x156'),_0x449bb1));var _0x18cfa2=this['channel'][_0x004e('0x10b')](_0x449bb1,_0x37d462['intKey']);try{fs[_0x004e('0x12c')](_0x449bb1+_0x004e('0x10c'));}catch(_0x68c2a1){logger[_0x004e('0x2f')](_0x68c2a1);}return _0x18cfa2;}return this[_0x004e('0x11')][_0x004e('0x2f')](_0x37d462,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x004e('0x18')][_0x004e('0x15a')]=function(_0x1e8d08){logger['info'](util['format'](_0x004e('0x15b'),_0x1e8d08[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0x1e8d08['findBy'])){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x1e8d08,_0x004e('0x15c'));}logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x15d'),this['channel'][_0x004e('0x3c')],_0x1e8d08[_0x004e('0x15e')]));var _0x5e10f0=this[_0x004e('0x57')][_0x004e('0x6f')](this,_0x1e8d08['findBy']);if(_0x5e10f0){logger['info'](util[_0x004e('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x004e('0x3c')],_0x1e8d08[_0x004e('0x15e')]));this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x004e('0x11')][_0x004e('0x3c')],_0x1e8d08[_0x004e('0x15e')]));return{'code':0xc8,'result':_0x004e('0x15f')};}else{logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x160'),this['channel']['callerid'],_0x1e8d08[_0x004e('0x15e')]));this[_0x004e('0x11')][_0x004e('0xab')](util['format'](_0x004e('0x160'),this[_0x004e('0x11')][_0x004e('0x3c')],_0x1e8d08[_0x004e('0x15e')]));return{'code':0xc8,'result':_0x004e('0x161')};}};AGIVertices[_0x004e('0x18')][_0x004e('0x162')]=function(_0x3d6ee9){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x163'),_0x3d6ee9[_0x004e('0xb1')]));if(!this['isConfigured'](_0x3d6ee9[_0x004e('0x15e')])){return this['channel'][_0x004e('0x2f')](_0x3d6ee9,'no\x20find\x20by\x20configured');}logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x15d'),this[_0x004e('0x11')][_0x004e('0x3c')],_0x3d6ee9['findBy']));var _0x20926b=this[_0x004e('0x53')][_0x004e('0x6f')](this,_0x3d6ee9[_0x004e('0x15e')]);if(_0x20926b){logger[_0x004e('0x30')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x004e('0x11')][_0x004e('0x3c')],_0x3d6ee9[_0x004e('0x15e')]));this['channel'][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0x164'),this[_0x004e('0x11')][_0x004e('0x3c')],_0x3d6ee9[_0x004e('0x15e')]));return{'code':0xc8,'result':_0x004e('0x15f')};}else{logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x160'),this[_0x004e('0x11')][_0x004e('0x3c')],_0x3d6ee9['findBy']));this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0x160'),this[_0x004e('0x11')][_0x004e('0x3c')],_0x3d6ee9[_0x004e('0x15e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x004e('0x18')][_0x004e('0x165')]=function(_0x4292c4){logger[_0x004e('0x30')](util[_0x004e('0x2c')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x4292c4['label']));if(!this[_0x004e('0xa6')](_0x4292c4[_0x004e('0x166')])){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x4292c4,'no\x20operation\x20configured');}this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0x167'),_0x4292c4['operation']));var _0x513b31=eval(_0x4292c4[_0x004e('0x166')]);if(!this[_0x004e('0xa6')](_0x4292c4[_0x004e('0xdc')])){return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0xdd'));}var _0x821d85=this[_0x004e('0x14')][_0x004e('0x6f')](this,_0x4292c4['variable_id']);if(!_0x821d85){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x4292c4,_0x004e('0xde'));}if(_['isArray'](_0x513b31)){var _0x20f8fa=this;_0x513b31[_0x004e('0xe0')](function(_0x254f70,_0x89182f){_0x20f8fa[_0x004e('0x11')]['setVariable'](util[_0x004e('0x2c')]('%s[%s]',_0x821d85,_0x89182f),_0x254f70);});return this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')]('variable\x20%s[key]\x20set',_0x821d85));}else{return this[_0x004e('0x11')][_0x004e('0xa5')](_0x821d85,_0x513b31);}};AGIVertices[_0x004e('0x18')]['menu']=function(_0x4a026d){logger['info'](util[_0x004e('0x2c')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x4a026d[_0x004e('0xb1')]));if(_0x4a026d[_0x004e('0xa8')]===0x0){return this[_0x004e('0xa7')](_0x4a026d);}_0x4a026d[_0x004e('0xa8')]-=0x1;if(!this[_0x004e('0xa6')](_0x4a026d[_0x004e('0x11a')])){return this['channel']['error'](_0x4a026d,'no\x20file\x20audio\x20selected');}var _0x3a0ffa=this['getSound']['sync'](this,_0x4a026d[_0x004e('0x11a')]);if(!_0x3a0ffa){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x4a026d,_0x004e('0x11c'));}var _0x4c432c=this['channel']['getData'](_0x3a0ffa,_0x4a026d[_0x004e('0x11d')],_0x4a026d['digit']);var _0x4183fb=_0x4c432c['result'];if(_0x4c432c[_0x004e('0xae')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x4a026d,'-1');return _0x4c432c;}else if(_0x4c432c['extra']===_0x004e('0x66')){_0x4c432c[_0x004e('0xae')]=_0x4c432c[_0x004e('0xae')]['length']>0x0?_0x4c432c['result']:'t';}else if(_[_0x004e('0x9d')](_0x4c432c[_0x004e('0xae')])){_0x4c432c[_0x004e('0xae')]='#';_0x4183fb='#';}if(!this['isConfigured'](_0x4a026d[_0x004e('0xdc')])){this['channel'][_0x004e('0xab')](_0x004e('0xdd'));}else{var _0x5032d7=this[_0x004e('0x14')]['sync'](this,_0x4a026d['variable_id']);if(!_0x5032d7){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x4a026d,_0x004e('0xde'));}this[_0x004e('0x11')][_0x004e('0xa5')](_0x5032d7,_0x4183fb);}this[_0x004e('0x38')][_0x004e('0x6f')](this,_0x4a026d,_0x4183fb);return _0x4c432c;};AGIVertices[_0x004e('0x18')][_0x004e('0xab')]=function(_0x5ebf7c){logger['info'](util['format'](_0x004e('0x168'),_0x5ebf7c[_0x004e('0xb1')]));return this['channel'][_0x004e('0xab')](_0x5ebf7c[_0x004e('0x169')]||_0x5ebf7c[_0x004e('0xb1')]);};AGIVertices['prototype'][_0x004e('0x16a')]=function(_0x463f7d){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x16b'),_0x463f7d[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0x463f7d[_0x004e('0x15e')])){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x463f7d,'no\x20find\x20by\x20configured');}logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x15d'),this[_0x004e('0x11')][_0x004e('0x3c')],_0x463f7d[_0x004e('0x15e')]));var _0x19b0eb=this[_0x004e('0x16c')][_0x004e('0x6f')](this,_0x463f7d[_0x004e('0x16d')]);var _0x2c64ab=this[_0x004e('0x50')][_0x004e('0x6f')](this,_0x463f7d[_0x004e('0x15e')],_0x19b0eb);if(_0x2c64ab){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x164'),this[_0x004e('0x11')][_0x004e('0x3c')],_0x463f7d[_0x004e('0x15e')]));this[_0x004e('0x11')]['noop'](util[_0x004e('0x2c')](_0x004e('0x164'),this[_0x004e('0x11')][_0x004e('0x3c')],_0x463f7d[_0x004e('0x15e')]));return{'code':0xc8,'result':_0x004e('0x15f')};}else{logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x160'),this[_0x004e('0x11')][_0x004e('0x3c')],_0x463f7d[_0x004e('0x15e')]));this['channel'][_0x004e('0xab')](util['format'](_0x004e('0x164'),this[_0x004e('0x11')][_0x004e('0x3c')],_0x463f7d[_0x004e('0x15e')]));return{'code':0xc8,'result':_0x004e('0x161')};}};AGIVertices['prototype'][_0x004e('0x16e')]=function(_0x988eda){logger[_0x004e('0x30')](util[_0x004e('0x2c')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x988eda[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0x988eda['file_id'])){return this[_0x004e('0x11')]['error'](_0x988eda,_0x004e('0x11b'));}var _0x5ef226=this['getSound'][_0x004e('0x6f')](this,_0x988eda[_0x004e('0x11a')]);if(!_0x5ef226){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x988eda,_0x004e('0x11c'));}var _0x214927=this[_0x004e('0x11')][_0x004e('0x59')](_0x004e('0x16f'),[_0x5ef226,_0x988eda[_0x004e('0xea')]]);if(_0x214927[_0x004e('0xae')]===-0x1){return _0x214927;}return this['channel']['noop'](util[_0x004e('0x2c')](_0x004e('0xc6'),_0x004e('0x16f'),_0x5ef226));};AGIVertices['prototype'][_0x004e('0x170')]=function(_0x411e98){logger['info'](util[_0x004e('0x2c')](_0x004e('0x171'),_0x411e98[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0x411e98[_0x004e('0x172')])){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x411e98,_0x004e('0x173'));}var _0x211b50='';var _0x52d1d7=parseInt(_0x411e98[_0x004e('0x172')],0xa);if(isNaN(_0x52d1d7)){_0x211b50=_0x411e98[_0x004e('0x172')];}else{_0x211b50=this[_0x004e('0x19')][_0x004e('0x6f')](this,_0x411e98[_0x004e('0x172')]);if(!_0x211b50){return this['channel'][_0x004e('0x2f')](_0x411e98,_0x004e('0x174'));}}var _0x3a1640='';if(this[_0x004e('0xa6')](_0x411e98['file_id'])){var _0x1244ff=this['getSound'][_0x004e('0x6f')](this,_0x411e98[_0x004e('0x11a')]);if(_0x1244ff){_0x3a1640=_0x1244ff;}}this[_0x004e('0x38')][_0x004e('0x6f')](this,_0x411e98,_0x211b50);if(_0x411e98[_0x004e('0xea')][_0x004e('0x175')]('x')<0x0){_0x411e98[_0x004e('0xea')]+='x';}if(_0x411e98[_0x004e('0xea')][_0x004e('0x175')]('X')<0x0){_0x411e98[_0x004e('0xea')]+='X';}this[_0x004e('0x11')][_0x004e('0xa5')](_0x004e('0x176'),_0x211b50?_0x211b50[_0x004e('0x177')]():'');var _0x916404=this[_0x004e('0x11')][_0x004e('0x59')]('QUEUE',[_0x211b50,_0x411e98[_0x004e('0xea')],_0x411e98['url'],_0x3a1640,_0x411e98['timeout'],_0x411e98['agi'],_0x411e98['macro'],_0x411e98[_0x004e('0x178')],'',_0x411e98[_0x004e('0x179')]]);if(_0x916404['result']===-0x1){return _0x916404;}return this[_0x004e('0x11')]['noop'](util[_0x004e('0x2c')](_0x004e('0xc6'),_0x004e('0x17a'),_0x211b50));};AGIVertices[_0x004e('0x18')][_0x004e('0x17b')]=function(_0x49215a){logger[_0x004e('0x30')](util[_0x004e('0x2c')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x49215a[_0x004e('0xb1')]));var _0x4089c2=_0x49215a[_0x004e('0x17c')]||_0x004e('0x13e');var _0x1212e7=util[_0x004e('0x2c')](_0x004e('0x17d'),this['channel'][_0x004e('0x3b')],rs[_0x004e('0x121')](0x5));var _0x4b2359=util[_0x004e('0x2c')](_0x004e('0x17e'),FILES_PATH,_0x1212e7,_0x4089c2);var _0x4833ca=util[_0x004e('0x2c')]('%s/recordings/%s',FILES_PATH,_0x1212e7);this[_0x004e('0x3a')]['sync'](this,_0x49215a,_0x1212e7,_0x4b2359);this['channel'][_0x004e('0xa5')]('RECORDING_SAVENAME',_0x1212e7);logger[_0x004e('0x30')](_0x004e('0x17f'),_0x4833ca,_0x4089c2,_0x49215a[_0x004e('0x180')],_0x49215a[_0x004e('0x66')]);return this[_0x004e('0x11')][_0x004e('0x140')](_0x4833ca,_0x4089c2,_0x49215a[_0x004e('0x180')],_0x49215a[_0x004e('0x66')],undefined,!![]);};AGIVertices[_0x004e('0x18')][_0x004e('0x181')]=function(_0x28d0bb){logger[_0x004e('0x30')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x28d0bb['label']));if(!this[_0x004e('0xa6')](_0x28d0bb['url'])){return this[_0x004e('0x11')]['noop'](_0x004e('0x182'));}var _0x1f1d16=this[_0x004e('0x63')]['sync'](this,_0x28d0bb);logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x183'),util[_0x004e('0x184')](_0x1f1d16,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x28d0bb[_0x004e('0xdc')])){return this[_0x004e('0x11')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x1ba627=this[_0x004e('0x14')][_0x004e('0x6f')](this,_0x28d0bb[_0x004e('0xdc')]);if(!_0x1ba627){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x28d0bb,'no\x20variable\x20found');}this[_0x004e('0x11')][_0x004e('0xa5')](util[_0x004e('0x2c')](_0x004e('0x185'),_0x1ba627),_0x1f1d16[_0x004e('0x74')]?_0x1f1d16[_0x004e('0x74')]:'200');this[_0x004e('0x11')][_0x004e('0xa5')](util['format'](_0x004e('0x186'),_0x1ba627),_0x1f1d16[_0x004e('0x75')]?_0x1f1d16[_0x004e('0x75')]:'OK');if(_0x1f1d16[_0x004e('0x6a')]){try{this['saveRestApiResult'](_0x1f1d16[_0x004e('0x6a')],_0x1ba627);}catch(_0x420c6f){logger[_0x004e('0x2f')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x1ba627));}}return this['channel'][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0xe3'),_0x1ba627));};AGIVertices[_0x004e('0x18')][_0x004e('0x187')]=function(_0x1145c7){logger[_0x004e('0x30')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x1145c7[_0x004e('0xb1')]));return this[_0x004e('0x11')][_0x004e('0x188')](_0x1145c7['digits'][_0x004e('0x5b')](/\s+/g,''),_0x1145c7[_0x004e('0x180')]);};AGIVertices[_0x004e('0x18')][_0x004e('0x189')]=function(_0x777fe8){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x18a'),_0x777fe8[_0x004e('0xb1')]));return this[_0x004e('0x11')]['sayNumber'](_0x777fe8[_0x004e('0x67')][_0x004e('0x5b')](/\s+/g,''),_0x777fe8[_0x004e('0x180')]);};AGIVertices['prototype'][_0x004e('0x18b')]=function(_0x3dfee5){logger['info'](util[_0x004e('0x2c')](_0x004e('0x18c'),_0x3dfee5[_0x004e('0xb1')]));return this['channel'][_0x004e('0x18d')](_0x3dfee5[_0x004e('0x5d')],_0x3dfee5[_0x004e('0x180')]);};AGIVertices[_0x004e('0x18')][_0x004e('0x18e')]=function(_0x157614){logger[_0x004e('0x30')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x157614[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0x157614[_0x004e('0x18f')])){return this[_0x004e('0x11')][_0x004e('0xab')]('no\x20mail\x20account\x20configured');}var _0x4a551c=this[_0x004e('0x190')][_0x004e('0x6f')](this,_0x157614['account_id']);if(!_0x4a551c||!_0x4a551c[_0x004e('0x191')]){return this[_0x004e('0x11')]['error'](_0x157614,_0x004e('0x192'));}var _0x3148b1={'from':util['format'](_0x004e('0x193'),_0x4a551c['name'],_0x4a551c[_0x004e('0x194')]||_0x4a551c[_0x004e('0x191')][_0x004e('0x195')]),'to':_0x157614['to']||'','cc':_0x157614['cc']||'','bcc':_0x157614[_0x004e('0x196')]||'','subject':_0x157614['subject'],'html':_0x157614[_0x004e('0x5d')],'text':_0x157614['text']};var _0x1a38a3={'tls':{'rejectUnauthorized':![]}};if(_0x4a551c[_0x004e('0x191')]['service']){_0x1a38a3[_0x004e('0x197')]=_0x4a551c[_0x004e('0x191')][_0x004e('0x197')];}else{_0x1a38a3[_0x004e('0x198')]=_0x4a551c[_0x004e('0x191')][_0x004e('0x198')];_0x1a38a3[_0x004e('0x199')]=_0x4a551c[_0x004e('0x191')][_0x004e('0x199')];_0x1a38a3['secure']=_0x4a551c[_0x004e('0x191')][_0x004e('0x19a')];}if(_0x4a551c[_0x004e('0x191')]['authentication']){_0x1a38a3['auth']={'user':_0x4a551c[_0x004e('0x191')]['user'],'pass':_0x4a551c[_0x004e('0x191')][_0x004e('0x19b')]};}if(this[_0x004e('0xa6')](_0x157614[_0x004e('0x19c')])){}logger[_0x004e('0xe4')](_0x004e('0x19d'),JSON[_0x004e('0x72')](_0x3148b1));this[_0x004e('0x38')][_0x004e('0x6f')](this,_0x157614,_0x157614['account_id']);this['channel'][_0x004e('0xab')](util[_0x004e('0x2c')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x4a551c[_0x004e('0x16')]));this[_0x004e('0x26')][_0x004e('0x6f')](this,_0x1a38a3,_0x3148b1);return this[_0x004e('0x11')]['noop'](_0x004e('0x19e'));};AGIVertices['prototype']['sendFax']=function(_0x53c48f){logger['info'](util[_0x004e('0x2c')](_0x004e('0x19f'),_0x53c48f[_0x004e('0xb1')]));return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0x1a0'));};AGIVertices['prototype']['sendSMS']=function(_0x1c2123){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x1a1'),_0x1c2123[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0x1c2123['sms_account_id'])){return this['channel'][_0x004e('0xab')](_0x004e('0x1a2'));}var _0x49539d=this[_0x004e('0x35')][_0x004e('0x6f')](this,_0x1c2123[_0x004e('0x1a3')]);if(!_0x49539d){return this[_0x004e('0x11')]['error'](_0x1c2123,_0x004e('0x1a4'));}var _0x429b1d={'body':_0x1c2123['sms_text'],'phone':_0x1c2123['to']||'','SmsAccountId':_0x49539d['id']};logger[_0x004e('0xe4')]('sendSMS\x20message',JSON['stringify'](_0x429b1d));this[_0x004e('0x38')][_0x004e('0x6f')](this,_0x1c2123,_0x1c2123[_0x004e('0x1a3')]);this['channel'][_0x004e('0xab')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x49539d[_0x004e('0x16')]));this['createSmsMessage'][_0x004e('0x6f')](this,_0x429b1d);return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0x1a5'));};AGIVertices['prototype'][_0x004e('0x1a6')]=function(_0x3f6b3b){logger[_0x004e('0x30')](util[_0x004e('0x2c')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x3f6b3b[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0x3f6b3b['variable_id'])){return this['channel'][_0x004e('0x2f')](_0x3f6b3b,'no\x20variable\x20selected');}var _0xf8f7d5=this[_0x004e('0x14')][_0x004e('0x6f')](this,_0x3f6b3b[_0x004e('0xdc')]);if(!_0xf8f7d5){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x3f6b3b,_0x004e('0xde'));}return this[_0x004e('0x11')]['setVariable'](_0xf8f7d5,_0x3f6b3b['variable_value']);};AGIVertices[_0x004e('0x18')]['start']=function(_0x55831c){logger['info'](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x55831c[_0x004e('0xb1')]));this[_0x004e('0x11')][_0x004e('0xab')]('START\x20CALLY\x20SQUARE');if(_0x55831c[_0x004e('0xbc')]===_0x004e('0x1a7')){this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0x1a8'));return this[_0x004e('0x11')]['answer']();}return this[_0x004e('0x11')][_0x004e('0xab')]('Skipped\x20Answer');};AGIVertices[_0x004e('0x18')]['subproject']=function(_0x1a54f6){logger['info'](util[_0x004e('0x2c')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x1a54f6['label']));if(!this[_0x004e('0xa6')](_0x1a54f6[_0x004e('0x1a9')])){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x1a54f6,'no\x20subproject\x20selected');}var _0x5b991e=this[_0x004e('0x1a')][_0x004e('0x6f')](this,_0x1a54f6[_0x004e('0x1a9')]);if(!this['isConfigured'](_0x5b991e)){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x1a54f6,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x1a54f6[_0x004e('0x1a9')]));}if(_0x5b991e===this[_0x004e('0x11')]['arg_1']){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x1a54f6,_0x004e('0x1aa'));}this[_0x004e('0x38')][_0x004e('0x6f')](this,_0x1a54f6,_0x5b991e);var _0x8b2b25=this[_0x004e('0x11')][_0x004e('0x59')](_0x004e('0x1ab'),util[_0x004e('0x2c')](_0x004e('0x1ac'),config['agi'][_0x004e('0x198')]||'127.0.0.1',_0x5b991e,this[_0x004e('0x11')]['arg_1']));if(_0x8b2b25[_0x004e('0xae')]===-0x1){return _0x8b2b25;}return this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0xc6'),'AGI',_0x5b991e));};AGIVertices['prototype'][_0x004e('0x1ad')]=function(_0x50af4c){logger['info'](util['format'](_0x004e('0x1ae'),_0x50af4c[_0x004e('0xb1')]));var _0xf10886=this[_0x004e('0x58')][_0x004e('0x6f')](this,_0x50af4c[_0x004e('0xba')]);this['createSquareDetailsReport'][_0x004e('0x6f')](this,_0x50af4c,_0x50af4c[_0x004e('0xba')]);if(this[_0x004e('0xa6')](_0x50af4c[_0x004e('0xdc')])){var _0xe9935a=this['getVariable'][_0x004e('0x6f')](this,_0x50af4c[_0x004e('0xdc')]);if(_0xe9935a){this['channel'][_0x004e('0xa5')](_0xe9935a,_0xf10886);return this['channel'][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0x1af'),_0x50af4c[_0x004e('0xba')],_0xe9935a));}}return this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0x1b0'),_0x50af4c[_0x004e('0xba')]));};AGIVertices['prototype'][_0x004e('0x1b1')]=function(_0x2ae98d){logger[_0x004e('0x30')](util[_0x004e('0x2c')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x2ae98d[_0x004e('0xb1')]));_0x2ae98d['text']=_0x2ae98d[_0x004e('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x004e('0xa6')](_0x2ae98d[_0x004e('0x1b2')])){return this[_0x004e('0x11')]['noop'](_0x004e('0x1b3'));}if(!this['isConfigured'](_0x2ae98d[_0x004e('0x5d')])){return this[_0x004e('0x11')][_0x004e('0xab')](_0x004e('0xac'));}this['channel'][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0x1b4'),_0x2ae98d[_0x004e('0x5d')]));var _0x52e3e5=this[_0x004e('0x5c')][_0x004e('0x6f')](this,_0x2ae98d);if(_0x52e3e5){this['channel']['noop'](util[_0x004e('0x2c')](_0x004e('0x1b5'),_0x52e3e5));var _0x4b52b7=this[_0x004e('0x11')][_0x004e('0x10b')](_0x52e3e5);try{fs['unlink'](_0x52e3e5+_0x004e('0x10c'));}catch(_0x3c41d0){logger['error'](_0x3c41d0);}return _0x4b52b7;}return this[_0x004e('0x11')][_0x004e('0x2f')](_0x2ae98d,_0x004e('0x1b6'));};AGIVertices['prototype'][_0x004e('0x1b7')]=function(_0x3144a0){logger['info'](util[_0x004e('0x2c')](_0x004e('0x1b8'),_0x3144a0['label']));_0x3144a0[_0x004e('0x5d')]=_0x3144a0[_0x004e('0x5d')][_0x004e('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x004e('0xa6')](_0x3144a0[_0x004e('0x5d')])){return this[_0x004e('0x11')][_0x004e('0xab')]('no\x20text\x20configured');}this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0x1b9'),_0x3144a0[_0x004e('0x5d')]));var _0x59095a=this[_0x004e('0x1ba')][_0x004e('0x6f')](this,_0x3144a0);if(_0x59095a){this['channel'][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0x1bb'),_0x59095a));var _0x55fe94=this[_0x004e('0x11')][_0x004e('0x10b')](_0x59095a);try{fs[_0x004e('0x12c')](_0x59095a+_0x004e('0x10c'));}catch(_0x4e7f85){logger[_0x004e('0x2f')](_0x4e7f85);}return _0x55fe94;}return this['channel'][_0x004e('0x2f')](_0x3144a0,_0x004e('0x1bc'));};AGIVertices[_0x004e('0x18')][_0x004e('0x1bd')]=function(_0x130c61){logger[_0x004e('0x30')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x130c61[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0x130c61[_0x004e('0x15e')])){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x130c61,_0x004e('0x15c'));}logger['info'](util[_0x004e('0x2c')](_0x004e('0x15d'),this[_0x004e('0x11')]['callerid'],_0x130c61[_0x004e('0x15e')]));var _0x23f7fd=this[_0x004e('0x52')][_0x004e('0x6f')](this,_0x130c61[_0x004e('0x15e')]);if(_0x23f7fd){logger[_0x004e('0x30')](util['format'](_0x004e('0x164'),this[_0x004e('0x11')]['callerid'],_0x130c61[_0x004e('0x15e')]));this['channel'][_0x004e('0xab')](util['format'](_0x004e('0x164'),this[_0x004e('0x11')]['callerid'],_0x130c61[_0x004e('0x15e')]));return{'code':0xc8,'result':'success'};}else{logger[_0x004e('0x30')](util['format'](_0x004e('0x160'),this[_0x004e('0x11')][_0x004e('0x3c')],_0x130c61[_0x004e('0x15e')]));this[_0x004e('0x11')]['noop'](util[_0x004e('0x2c')](_0x004e('0x160'),this['channel'][_0x004e('0x3c')],_0x130c61[_0x004e('0x15e')]));return{'code':0xc8,'result':_0x004e('0x161')};}};AGIVertices['prototype'][_0x004e('0x1be')]=function(_0x58b0bc){logger['info'](util['format'](_0x004e('0x1bf'),_0x58b0bc[_0x004e('0xb1')]));var _0x15e868=this['channel']['exec'](_0x004e('0x1c0'),[_0x58b0bc[_0x004e('0x1c1')],_0x58b0bc[_0x004e('0x78')]]);if(_0x15e868['result']===-0x1){return _0x15e868;}return this[_0x004e('0x11')][_0x004e('0xab')](util[_0x004e('0x2c')](_0x004e('0xc6'),_0x004e('0x1c0'),_0x58b0bc[_0x004e('0x1c1')]));};AGIVertices[_0x004e('0x18')]['vswitch']=function(_0x573165){logger[_0x004e('0x30')](util[_0x004e('0x2c')](_0x004e('0x1c2'),_0x573165[_0x004e('0xb1')]));if(!this[_0x004e('0xa6')](_0x573165[_0x004e('0xdc')])){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x573165,_0x004e('0x1c3'));}var _0x32dacb=this[_0x004e('0x14')][_0x004e('0x6f')](this,_0x573165['variable_id']);if(!_0x32dacb){return this[_0x004e('0x11')][_0x004e('0x2f')](_0x573165,'no\x20variable\x20found');}var _0x4b8a2f=this[_0x004e('0x11')][_0x004e('0x14')](_0x32dacb);return{'code':0xc8,'result':_0x4b8a2f[_0x004e('0xa2')]?_0x4b8a2f['extra']:'-'};};String[_0x004e('0x18')][_0x004e('0xa1')]=function(_0x5e43f2,_0xdd3368){return this[_0x004e('0xa0')](_0x5e43f2)[_0x004e('0x1c4')](_0xdd3368);};module['exports']=AGIVertices; \ No newline at end of file +var _0xb661=['extension','priority','accountcode','dnid','file','createSquareMessage','isEmpty','random','lastName','isNil','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','googleTTS','google_tts_language','restAPI','method','number','timeout','includes','POST','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','googleDialogflow','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','findBy','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','service','host','port','secure','authentication','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','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','vswitch','exports','path','util','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','./scripts','rawHeaders','menu','getdigits','channel','rpc','mailRpc','prototype','getVariable','then','name','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context'];(function(_0x17c2d2,_0x1b6fb0){var _0x13eee1=function(_0x35b38d){while(--_0x35b38d){_0x17c2d2['push'](_0x17c2d2['shift']());}};_0x13eee1(++_0x1b6fb0);}(_0xb661,0x195));var _0x1b66=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xb661[_0x4709c0];return _0x13348b;};'use strict';var fs=require('fs');var path=require(_0x1b66('0x0'));var util=require(_0x1b66('0x1'));var _=require('lodash');var sh=require(_0x1b66('0x2'));var odbc=require(_0x1b66('0x3'))();var rs=require(_0x1b66('0x4'));var moment=require(_0x1b66('0x5'));var Mustache=require(_0x1b66('0x6'));var rp=require(_0x1b66('0x7'));var logger=require('../../config/logger')(_0x1b66('0x8'));var config=require(_0x1b66('0x9'));var scripts=require(_0x1b66('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x1b66('0xb'),'rawBody'];var verticesWithRetry=[_0x1b66('0xc'),_0x1b66('0xd'),'getsecretdigits'];var AGIVertices=function(_0x6e9539,_0x1bc0cc,_0x1e326b){this[_0x1b66('0xe')]=_0x6e9539;this[_0x1b66('0xf')]=_0x1bc0cc;this[_0x1b66('0x10')]=_0x1e326b;};AGIVertices[_0x1b66('0x11')][_0x1b66('0x12')]=function(_0x557ba4,_0x467e88){this[_0x1b66('0xf')]['getVariableById'](_0x557ba4)[_0x1b66('0x13')](function(_0x1a1bfc){_0x467e88(null,_0x1a1bfc?_0x1a1bfc[_0x1b66('0x14')]:![]);})[_0x1b66('0x15')](function(_0x41176c){_0x467e88(_0x41176c);});};AGIVertices[_0x1b66('0x11')]['getVoiceQueue']=function(_0x2ad6ff,_0x1416f5){this[_0x1b66('0xf')]['getVoiceQueueById'](_0x2ad6ff)[_0x1b66('0x13')](function(_0x25dd62){_0x1416f5(null,_0x25dd62?_0x25dd62[_0x1b66('0x14')]:![]);})[_0x1b66('0x15')](function(_0x2e0184){_0x1416f5(_0x2e0184);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x16')]=function(_0x3abd32,_0x1607a0){this['rpc'][_0x1b66('0x17')](_0x3abd32)['then'](function(_0x497e1e){_0x1607a0(null,_0x497e1e?_0x497e1e[_0x1b66('0x14')]:![]);})[_0x1b66('0x15')](function(_0x29e1a2){_0x1607a0(_0x29e1a2);});};AGIVertices['prototype'][_0x1b66('0x18')]=function(_0x5f0d02,_0x505468){this['rpc'][_0x1b66('0x19')](_0x5f0d02)['then'](function(_0x543a62){_0x505468(null,_0x543a62?_0x543a62['dsn']:![]);})[_0x1b66('0x15')](function(_0x23b2a9){_0x505468(_0x23b2a9);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x1a')]=function(_0x16fe0f,_0x4a7622){this[_0x1b66('0xf')][_0x1b66('0x1b')](_0x16fe0f)[_0x1b66('0x13')](function(_0x5e5bd3){_0x4a7622(null,_0x5e5bd3?_0x5e5bd3[_0x1b66('0x14')]:![]);})[_0x1b66('0x15')](function(_0x1c45e9){_0x4a7622(_0x1c45e9);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x1c')]=function(_0x259473,_0x427ee3){this[_0x1b66('0xf')][_0x1b66('0x1d')](_0x259473)[_0x1b66('0x13')](function(_0x23e3b7){_0x427ee3(null,_0x23e3b7?_0x23e3b7[_0x1b66('0x14')]:![]);})[_0x1b66('0x15')](function(_0xe0d42f){_0x427ee3(_0xe0d42f);});};AGIVertices['prototype'][_0x1b66('0x1e')]=function(_0x39d5d9,_0x4ee254){var _0x55d558=this;this[_0x1b66('0xf')][_0x1b66('0x1f')](_0x39d5d9)[_0x1b66('0x13')](function(_0x5030dd){_0x4ee254(null,_0x5030dd?_0x55d558[_0x1b66('0x20')](_0x5030dd[_0x1b66('0x21')]):![]);})[_0x1b66('0x15')](function(_0x10c526){_0x4ee254(_0x10c526);});};AGIVertices['prototype'][_0x1b66('0x22')]=function(_0x2b0df0,_0x29876f){this[_0x1b66('0xf')][_0x1b66('0x23')](_0x2b0df0)['then'](function(_0x12eaa3){_0x29876f(null,_0x12eaa3?_0x12eaa3:![]);})['catch'](function(_0x2256d0){_0x29876f(_0x2256d0);});};AGIVertices[_0x1b66('0x11')]['sendMailMessage']=function(_0x2931b6,_0x5a3d25,_0xfcd242){this[_0x1b66('0x10')][_0x1b66('0x24')](_0x2931b6,_0x5a3d25)['then'](function(){_0xfcd242(null);})['catch'](function(_0xf80599){_0xfcd242(_0xf80599);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x25')]=function(_0x26c8e1,_0x110be5){this[_0x1b66('0xf')][_0x1b66('0x26')](_0x26c8e1)[_0x1b66('0x13')](function(_0x49b408){if(_0x49b408){if(_0x49b408[_0x1b66('0x27')]){_0x110be5(null,[_0x49b408[_0x1b66('0x28')]]);}else{_0x110be5(null,_[_0x1b66('0x29')](_0x49b408['Intervals'],'interval'));}}else{_0x110be5(null,![]);}})[_0x1b66('0x15')](function(_0x2f371e){_0x110be5(_0x2f371e);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x20')]=function(_0xe3af8f){return util[_0x1b66('0x2a')](_0x1b66('0x2b'),FILES_PATH,_0xe3af8f);};AGIVertices[_0x1b66('0x11')]['getQueryOdbc']=function(_0x58ffb8,_0x24df96,_0x19bb2a){odbc['open'](_0x58ffb8,function(_0x4a5515){if(_0x4a5515){logger[_0x1b66('0x2c')](_0x1b66('0x2d'),_0x4a5515);_0x19bb2a(_0x4a5515);}else{logger[_0x1b66('0x2e')]('ODBC\x20connection\x20successfully');odbc[_0x1b66('0x2f')](_0x24df96,function(_0x4c6fb7,_0x44acc8){if(_0x4c6fb7){logger['info'](_0x1b66('0x30'),_0x24df96);_0x19bb2a(_0x4c6fb7);}else{logger[_0x1b66('0x2e')](_0x1b66('0x31'),_0x24df96);odbc[_0x1b66('0x32')](function(_0x3fd63f){if(_0x3fd63f){logger[_0x1b66('0x2c')](_0x1b66('0x33'),_0x3fd63f);}_0x19bb2a(null,_0x44acc8);});}});}});};AGIVertices[_0x1b66('0x11')]['getSmsAccount']=function(_0x4514bf,_0x5ad456){this[_0x1b66('0xf')][_0x1b66('0x34')](_0x4514bf)[_0x1b66('0x13')](function(_0x376c4e){_0x5ad456(null,_0x376c4e?_0x376c4e:![]);})[_0x1b66('0x15')](function(_0x560000){_0x5ad456(_0x560000);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x35')]=function(_0x1fb153,_0x5e65cb){this[_0x1b66('0xf')][_0x1b66('0x35')](_0x1fb153)[_0x1b66('0x13')](function(_0x4faba9){_0x5e65cb(null,_0x4faba9);})['catch'](function(_0x246e05){_0x5e65cb(_0x246e05);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x36')]=function(_0x3a6690,_0x50d2e2,_0x38b53b){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x1b66('0xe')][_0x1b66('0x37')],'node':_0x3a6690[_0x1b66('0x38')],'application':_0x3a6690[_0x1b66('0x39')],'data':_0x50d2e2||null,'project_name':this[_0x1b66('0xe')][_0x1b66('0x3a')],'callerid':this[_0x1b66('0xe')][_0x1b66('0x3b')]})['then'](function(_0x256a65){if(_0x38b53b){_0x38b53b(null,_0x256a65);}})[_0x1b66('0x15')](function(_0x24fb17){if(_0x38b53b){_0x38b53b(_0x24fb17);}});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x3c')]=function(_0x56f65e,_0x33841b,_0x119552,_0x5bb55b){this['rpc'][_0x1b66('0x3c')]({'uniqueid':this[_0x1b66('0xe')][_0x1b66('0x37')],'callerid':this[_0x1b66('0xe')][_0x1b66('0x3b')],'calleridname':this[_0x1b66('0xe')][_0x1b66('0x3d')],'context':this[_0x1b66('0xe')][_0x1b66('0x3e')],'extension':this[_0x1b66('0xe')][_0x1b66('0x3f')],'priority':this[_0x1b66('0xe')][_0x1b66('0x40')],'accountcode':this[_0x1b66('0xe')][_0x1b66('0x41')],'dnid':this[_0x1b66('0xe')][_0x1b66('0x42')],'projectName':this[_0x1b66('0xe')][_0x1b66('0x3a')],'saveName':_0x33841b,'filename':_0x56f65e[_0x1b66('0x43')]||_0x33841b,'savePath':_0x119552})[_0x1b66('0x13')](function(_0x4d4cfe){_0x5bb55b(null,_0x4d4cfe);})[_0x1b66('0x15')](function(_0x513b9b){_0x5bb55b(_0x513b9b);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x44')]=function(_0x17b741,_0x592c96,_0x3fa70d,_0x31b48a,_0x43db3f){this[_0x1b66('0xf')][_0x1b66('0x44')]({'uniqueid':this[_0x1b66('0xe')][_0x1b66('0x37')],'body':_0x17b741,'direction':_0x592c96,'providerName':_0x3fa70d,'providerResponse':_0x31b48a})['then'](function(_0x53b558){if(_0x43db3f){_0x43db3f(null,_0x53b558);}})[_0x1b66('0x15')](function(_0x219819){if(_0x43db3f){_0x43db3f(_0x219819);}});};AGIVertices[_0x1b66('0x11')]['createCmContact']=function(_0x10c158,_0x2869f5){this[_0x1b66('0xf')]['createCmContact']({'firstName':_[_0x1b66('0x45')](_0x10c158[_0x1b66('0x14')])||_['isNil'](_0x10c158[_0x1b66('0x14')])?'callback_'+Math[_0x1b66('0x46')]():_0x10c158[_0x1b66('0x14')],'lastName':_[_0x1b66('0x45')](_0x10c158[_0x1b66('0x47')])||_[_0x1b66('0x48')](_0x10c158[_0x1b66('0x47')])?null:_0x10c158[_0x1b66('0x47')],'phone':_0x10c158[_0x1b66('0x49')],'ListId':_0x10c158[_0x1b66('0x4a')],'scheduledat':_0x10c158['scheduledAt'],'callbackUniqueid':this[_0x1b66('0xe')][_0x1b66('0x37')],'tags':_0x1b66('0x4b'),'description':_0x1b66('0x4c')+_0x10c158[_0x1b66('0x4d')][_0x1b66('0x4e')](),'priority':_0x10c158['callback_priority']})[_0x1b66('0x13')](function(_0x1f72ad){_0x2869f5(null,_0x1f72ad);})[_0x1b66('0x15')](function(_0x4ff76e){_0x2869f5(_0x4ff76e);});};AGIVertices[_0x1b66('0x11')]['getPause']=function(_0x3eb82f,_0x47fc0c){this[_0x1b66('0xf')][_0x1b66('0x4f')](_0x3eb82f)['then'](function(_0x7a938e){_0x47fc0c(null,_0x7a938e?_0x7a938e[_0x1b66('0x14')]:![]);})[_0x1b66('0x15')](function(_0xf119ab){_0x47fc0c(_0xf119ab);});};AGIVertices[_0x1b66('0x11')]['agentPause']=function(_0x36b83f,_0x4d9a41,_0x3bde0e){var _0x1e9f79={'role':_0x1b66('0x50')};_0x1e9f79[_0x36b83f]=this[_0x1b66('0xe')][_0x1b66('0x3b')];this[_0x1b66('0xf')][_0x1b66('0x51')](_0x1e9f79,_0x4d9a41,this[_0x1b66('0xe')][_0x1b66('0x37')])['then'](function(_0x5f0f0a){_0x3bde0e(null,_['isNil'](_0x5f0f0a)?![]:!![]);})[_0x1b66('0x15')](function(_0x2db56a){logger['error'](_0x2db56a);_0x3bde0e(null,![]);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x52')]=function(_0x42fc22,_0x37ae92){var _0x3de7b1={'role':'agent'};_0x3de7b1[_0x42fc22]=this['channel'][_0x1b66('0x3b')];this[_0x1b66('0xf')]['agentUnpause'](_0x3de7b1)['then'](function(_0x4e86b5){_0x37ae92(null,_[_0x1b66('0x48')](_0x4e86b5)?![]:!![]);})[_0x1b66('0x15')](function(_0x166965){logger[_0x1b66('0x2c')](_0x166965);_0x37ae92(null,![]);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x53')]=function(_0x91844c,_0x380077){var _0x53d904={'role':_0x1b66('0x50')};_0x53d904[_0x91844c]=this[_0x1b66('0xe')][_0x1b66('0x3b')];this[_0x1b66('0xf')]['agentLogout'](_0x53d904)['then'](function(_0x1a4c98){_0x380077(null,_[_0x1b66('0x48')](_0x1a4c98)?![]:!![]);})[_0x1b66('0x15')](function(_0x632de4){logger[_0x1b66('0x2c')](_0x632de4);_0x380077(null,![]);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x54')]=function(_0x260fe5,_0x479098){var _0x1ac517={'role':_0x1b66('0x50')};_0x1ac517[_0x260fe5]=this['channel'][_0x1b66('0x3b')];var _0x510e7a=_0x260fe5!=_0x1b66('0x55')?util[_0x1b66('0x2a')](_0x1b66('0x56'),_0x1b66('0x57'),this[_0x1b66('0xe')][_0x1b66('0x3b')]):undefined;this['rpc'][_0x1b66('0x54')](_0x1ac517,_0x510e7a)[_0x1b66('0x13')](function(_0x1f8a68){_0x479098(null,_[_0x1b66('0x48')](_0x1f8a68)?![]:!![]);})[_0x1b66('0x15')](function(_0x5b1634){logger[_0x1b66('0x2c')](_0x5b1634);_0x479098(null,![]);});};AGIVertices['prototype'][_0x1b66('0x58')]=function(_0x9ea5e2,_0x1adf7c){sh[_0x1b66('0x59')](_['trim'](_0x9ea5e2),function(_0xa9b959,_0x50ddd0){var _0x1c201b=_0x50ddd0['replace'](/(\r\n|\n|\r)/gm,'');_0x1adf7c(null,_0x1c201b);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x5a')]=function(_0xf1c74f,_0x3726bd){scripts[_0x1b66('0x5a')](_0xf1c74f['apiKey'],_0xf1c74f[_0x1b66('0x5b')]||_0x1b66('0x5c'),_0xf1c74f['text'],_0xf1c74f[_0x1b66('0x5d')]||_0x1b66('0x5e'),_0xf1c74f[_0x1b66('0x5f')]||'MALE',_0xf1c74f[_0x1b66('0x60')]||'MP3')[_0x1b66('0x13')](function(_0x5c05b5){_0x3726bd(null,_0x5c05b5);})[_0x1b66('0x15')](function(_0x50cb9f){_0x3726bd(_0x50cb9f);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x61')]=function(_0x8ea01,_0x59222a){scripts[_0x1b66('0x61')](_0x8ea01[_0x1b66('0x5c')],_0x8ea01[_0x1b66('0x62')]||'en',0x1)[_0x1b66('0x13')](function(_0x3a854b){_0x59222a(null,_0x3a854b);})['catch'](function(_0x19a9fb){_0x59222a(_0x19a9fb);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x63')]=function(_0x4782aa,_0x47a730){var _0x1d95c6={'uri':_0x4782aa['url'],'method':_0x4782aa[_0x1b66('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4782aa['timeout'])===_0x1b66('0x65')&&parseInt(_0x4782aa['timeout'])>=0x1?parseInt(_0x4782aa[_0x1b66('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x1b66('0x67')]([_0x1b66('0x68'),'PUT'],_0x1d95c6['method'][_0x1b66('0x69')]())){try{_0x1d95c6[_0x1b66('0x6a')]=_0x4782aa[_0x1b66('0x6b')]?JSON[_0x1b66('0x6c')](_0x4782aa[_0x1b66('0x6b')]):{};}catch(_0x17d302){logger[_0x1b66('0x2c')](_0x1b66('0x6d'),_0x17d302);}}try{_0x1d95c6[_0x1b66('0x6e')]=_0x4782aa[_0x1b66('0xb')]?JSON[_0x1b66('0x6c')](_0x4782aa[_0x1b66('0xb')]):{};}catch(_0x1106df){logger[_0x1b66('0x2c')](_0x1b66('0x6f'),_0x1106df);}if(_0x4782aa[_0x1b66('0x70')]){try{var _0x5f5377=require(_0x4782aa[_0x1b66('0x70')])[_0x1b66('0x71')](this,_0x1d95c6);_0x1d95c6[_0x1b66('0x72')]=Mustache[_0x1b66('0x73')](_0x4782aa[_0x1b66('0x74')],_0x5f5377,{},['$$','$$']);if(_0x1d95c6[_0x1b66('0x6e')]){_0x1d95c6[_0x1b66('0x6e')]=JSON[_0x1b66('0x6c')](Mustache[_0x1b66('0x73')](JSON[_0x1b66('0x75')](_0x1d95c6[_0x1b66('0x6e')]),_0x5f5377,{},['$$','$$']));}if(_0x1d95c6['body']){_0x1d95c6[_0x1b66('0x6a')]=JSON[_0x1b66('0x6c')](Mustache[_0x1b66('0x73')](JSON[_0x1b66('0x75')](_0x1d95c6[_0x1b66('0x6a')]),_0x5f5377,{},['$$','$$']));}}catch(_0x1af0d5){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1af0d5);}}rp(_0x1d95c6)[_0x1b66('0x13')](function(_0x38cd43){var _0x102874={'statusCode':_0x38cd43[_0x1b66('0x76')]||0xc8,'statusMessage':_0x38cd43['statusMessage']||'OK','headers':_0x38cd43[_0x1b66('0x6e')]||{},'body':_0x38cd43['body']||{}};_0x47a730(null,_0x102874);})[_0x1b66('0x15')](function(_0x429b88){var _0x1ea421={'statusCode':_0x429b88[_0x1b66('0x76')]||0x1f4,'statusMessage':_0x429b88[_0x1b66('0x77')]||_0x1b66('0x78'),'headers':_0x429b88[_0x1b66('0x79')][_0x1b66('0x6e')]||{},'body':_0x429b88['options'][_0x1b66('0x6a')]||{}};_0x47a730(null,_0x1ea421);});};AGIVertices[_0x1b66('0x11')]['googleDialogflow']=function(_0x5d7df5,_0x1bcb49){scripts['googleDialogflow'](this[_0x1b66('0xe')][_0x1b66('0x37')],_0x5d7df5['key'],_0x5d7df5[_0x1b66('0x5c')],_0x5d7df5['dialogflow_language']||'en')['then'](function(_0x3a42d4){_0x1bcb49(null,_0x3a42d4);})[_0x1b66('0x15')](function(_0x4b8ebd){_0x1bcb49(_0x4b8ebd);});};AGIVertices['prototype'][_0x1b66('0x7a')]=function(_0x3f2614,_0xd718dd){scripts[_0x1b66('0x7a')](this['channel'][_0x1b66('0x37')],_0x3f2614[_0x1b66('0x7b')],_0x3f2614[_0x1b66('0x7c')],_0x3f2614[_0x1b66('0x7d')],_0x3f2614[_0x1b66('0x5c')],_0x3f2614[_0x1b66('0x7e')]||'en')[_0x1b66('0x13')](function(_0x153f22){_0xd718dd(null,_0x153f22);})['catch'](function(_0x442f72){_0xd718dd(_0x442f72);});};AGIVertices[_0x1b66('0x11')]['sestekNDA']=function(_0x1afa89,_0x1c7363){scripts[_0x1b66('0x7f')](this['channel'],_0x1afa89)['then'](function(_0x54583e){_0x1c7363(null,_0x54583e);})[_0x1b66('0x15')](function(_0x2ff06c){_0x1c7363(_0x2ff06c);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x80')]=function(_0x342fc6,_0x28b244){scripts[_0x1b66('0x80')](_0x342fc6[_0x1b66('0x81')],_0x342fc6[_0x1b66('0x5c')],_0x342fc6[_0x1b66('0x82')]||_0x1b66('0x5e'),_0x342fc6['speed'])[_0x1b66('0x13')](function(_0x434818){_0x28b244(null,_0x434818);})[_0x1b66('0x15')](function(_0x215409){_0x28b244(_0x215409);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x83')]=function(_0x18b152,_0x2ba532,_0x4789c4){scripts[_0x1b66('0x83')](_0x2ba532,_0x18b152['key'],_0x18b152['ispeech_asr_language']||_0x1b66('0x5e'),this[_0x1b66('0x84')](_0x18b152[_0x1b66('0x85')])?_0x18b152[_0x1b66('0x85')]:undefined)['then'](function(_0x533d59){_0x4789c4(null,_0x533d59);})[_0x1b66('0x15')](function(_0x52b66a){_0x4789c4(_0x52b66a);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x86')]=function(_0x1cb90d,_0x2905a9){scripts[_0x1b66('0x86')](_0x1cb90d[_0x1b66('0x87')],_0x1cb90d[_0x1b66('0x88')],_0x1cb90d[_0x1b66('0x89')],_0x1cb90d[_0x1b66('0x8a')]||_0x1b66('0x8b'),_0x1cb90d[_0x1b66('0x5c')],_0x1cb90d[_0x1b66('0x8c')]||_0x1b66('0x5c'))[_0x1b66('0x13')](function(_0x1abbc7){_0x2905a9(null,_0x1abbc7);})['catch'](function(_0xbc39d7){_0x2905a9(_0xbc39d7);});};AGIVertices['prototype'][_0x1b66('0x8d')]=function(_0xcec0ed,_0x3733f1){scripts[_0x1b66('0x8d')](this[_0x1b66('0xe')][_0x1b66('0x37')],_0xcec0ed[_0x1b66('0x87')],_0xcec0ed['aws_secret_access_key'],_0xcec0ed[_0x1b66('0x8e')],_0xcec0ed[_0x1b66('0x5c')],_0xcec0ed[_0x1b66('0x8f')])[_0x1b66('0x13')](function(_0x3b9ebc){_0x3733f1(null,_0x3b9ebc);})[_0x1b66('0x15')](function(_0x12e1dc){_0x3733f1(_0x12e1dc);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x90')]=function(_0x281d49,_0xd7cd06,_0x6734b4){scripts[_0x1b66('0x90')](_0xd7cd06,_0x281d49[_0x1b66('0x81')],_0x281d49[_0x1b66('0x91')]||_0x1b66('0x5e'))[_0x1b66('0x13')](function(_0x542a7e){_0x6734b4(null,_0x542a7e);})[_0x1b66('0x15')](function(_0x132521){_0x6734b4(_0x132521);});};AGIVertices[_0x1b66('0x11')]['tildeASR']=function(_0x3762b3,_0x1a4c6e,_0x1e659f){scripts[_0x1b66('0x92')](_0x1a4c6e,_0x3762b3[_0x1b66('0x93')],_0x3762b3[_0x1b66('0x94')],_0x3762b3[_0x1b66('0x72')])[_0x1b66('0x13')](function(_0x376424){_0x1e659f(null,_0x376424);})[_0x1b66('0x15')](function(_0x558f36){_0x1e659f(_0x558f36);});};AGIVertices[_0x1b66('0x11')]['clear']=function(_0x23f6f6){var _0x443a0d=_['includes'](verticesWithRetry,_0x23f6f6[_0x1b66('0x39')])?_0x23f6f6:_[_0x1b66('0x95')](_0x23f6f6);for(var _0x49f3d9 in _0x443a0d){if(_0x443a0d[_0x1b66('0x96')](_0x49f3d9)){if(_0x443a0d[_0x49f3d9]&&_[_0x1b66('0x97')](_0x443a0d[_0x49f3d9])){if(_[_0x1b66('0x67')](recursiveMapAttributes,_0x49f3d9)){_0x443a0d[_0x49f3d9]=this[_0x1b66('0x98')](_0x443a0d[_0x49f3d9]);}else{_0x443a0d[_0x49f3d9]=this[_0x1b66('0x99')](_0x443a0d[_0x49f3d9]);}}}}return _0x443a0d;};AGIVertices[_0x1b66('0x11')]['recursiveNodeIndex']=function(_0x2717b3){for(var _0x2de48f in _0x2717b3){if(_0x2717b3['hasOwnProperty'](_0x2de48f)){if(_['isPlainObject'](_0x2717b3[_0x2de48f])){this[_0x1b66('0x9a')](_0x2717b3[_0x2de48f]);}else if(_[_0x1b66('0x9b')](_0x2717b3[_0x2de48f])){for(var _0x445e7c=0x0;_0x445e7c<_0x2717b3[_0x2de48f][_0x1b66('0x9c')];_0x445e7c++){this[_0x1b66('0x9a')](_0x2717b3[_0x2de48f][_0x445e7c]);}}else if(_['isString'](_0x2717b3[_0x2de48f])){_0x2717b3[_0x2de48f]=this['replaceAllVariables'](_0x2717b3[_0x2de48f]);}}}};AGIVertices[_0x1b66('0x11')][_0x1b66('0x9d')]=function(_0x4c1e1f,_0x207354){for(var _0x17e4f2 in _0x4c1e1f){if(_0x4c1e1f[_0x1b66('0x96')](_0x17e4f2)){if(_['isPlainObject'](_0x4c1e1f[_0x17e4f2])){if(!_[_0x1b66('0x45')](_0x4c1e1f[_0x17e4f2])){this[_0x1b66('0x9d')](_0x4c1e1f[_0x17e4f2],util[_0x1b66('0x2a')]('%s.%s',_0x207354,_0x17e4f2));}}else if(_[_0x1b66('0x9b')](_0x4c1e1f[_0x17e4f2])){for(var _0x23912f=0x0;_0x23912f<_0x4c1e1f[_0x17e4f2][_0x1b66('0x9c')];_0x23912f++){this[_0x1b66('0x9d')](_0x4c1e1f[_0x17e4f2][_0x23912f],util[_0x1b66('0x2a')](_0x1b66('0x9e'),_0x207354,_0x17e4f2+'['+_0x23912f+']'));}}else{if(!_[_0x1b66('0x48')](_0x4c1e1f[_0x17e4f2])){this[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')](_0x1b66('0x9e'),_0x207354,_0x17e4f2),_0x4c1e1f[_0x17e4f2]);}}}}};AGIVertices[_0x1b66('0x11')][_0x1b66('0x98')]=function(_0x33071b){try{var _0x24a8c6=JSON[_0x1b66('0x6c')](_0x33071b);this[_0x1b66('0x9a')](_0x24a8c6);return JSON[_0x1b66('0x75')](_0x24a8c6);}catch(_0x551160){return this[_0x1b66('0x99')](_0x33071b);}};AGIVertices[_0x1b66('0x11')][_0x1b66('0x99')]=function(_0x36efa4){var _0x31c97c=_0x36efa4['split']('{');for(var _0x2557d0=0x1;_0x2557d0<_0x31c97c['length'];_0x2557d0+=0x1){var _0x447fff=_0x31c97c[_0x2557d0][_0x1b66('0xa0')]('}');if(_0x447fff[_0x1b66('0x9c')]>0x1){_0x36efa4=_0x36efa4[_0x1b66('0xa1')]('{'+_0x447fff[0x0]+'}',this[_0x1b66('0xe')][_0x1b66('0x12')](_0x447fff[0x0])[_0x1b66('0xa2')]||_0x447fff[0x0]);}}if(_0x31c97c[_0x1b66('0x9c')]===0x1){return _0x36efa4[_0x1b66('0x4e')]();}return this['replaceAllVariables'](_0x36efa4);};AGIVertices[_0x1b66('0x11')][_0x1b66('0xa3')]=function(_0x8cde7b,_0x4a3aa4){var _0x24d41c=this[_0x1b66('0xe')][_0x1b66('0x12')](_0x8cde7b);if(_0x24d41c[_0x1b66('0xa4')]===-0x1){return _0x24d41c;}logger['info'](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x4a3aa4,_0x24d41c[_0x1b66('0xa2')]));return this[_0x1b66('0xe')][_0x1b66('0x9f')](_0x4a3aa4,_0x24d41c['extra']);};AGIVertices[_0x1b66('0x11')][_0x1b66('0x84')]=function(_0x13516e){return _0x13516e&&_0x13516e!=='0'&&_0x13516e!=='-1'&&_0x13516e!=='';};AGIVertices[_0x1b66('0x11')][_0x1b66('0xa5')]=function(_0xcc1497){this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0xcc1497,'-');_0xcc1497[_0x1b66('0xa6')]=_0xcc1497[_0x1b66('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x1b66('0xa7')]=function(_0x33b268){logger['info'](util['format'](_0x1b66('0xa8'),_0x33b268[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x33b268[_0x1b66('0x5c')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xaa'));}var _0x5009c9='\x22'+_0x33b268[_0x1b66('0x5c')]+'\x22';if(this[_0x1b66('0x84')](_0x33b268['options'])){_0x5009c9+=','+_0x33b268[_0x1b66('0x79')];}var _0x2de7e0=this[_0x1b66('0xe')][_0x1b66('0x59')](_0x1b66('0xab'),_0x5009c9);if(_0x2de7e0[_0x1b66('0xa4')]===-0x1){return _0x2de7e0;}return this['channel'][_0x1b66('0xa9')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x5009c9));};AGIVertices[_0x1b66('0x11')][_0x1b66('0xac')]=function(_0x569297){logger['info'](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x569297[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x569297[_0x1b66('0xad')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xae'));}var _0x45e493=_0x569297[_0x1b66('0xad')];if(this['isConfigured'](_0x569297[_0x1b66('0x79')])){_0x45e493+=','+_0x569297[_0x1b66('0x79')];}var _0x576d55=this[_0x1b66('0xe')][_0x1b66('0x59')]('MRCPRecog',_0x45e493);if(_0x576d55[_0x1b66('0xa4')]===-0x1){return _0x576d55;}var _0x48c81f=this[_0x1b66('0xa3')](_0x1b66('0xaf'),_0x1b66('0xb0'));if(_0x48c81f[_0x1b66('0xa4')]===-0x1){return _0x48c81f;}var _0x3677f4=this[_0x1b66('0xa3')](_0x1b66('0xb1'),_0x1b66('0xb2'));if(_0x3677f4['result']===-0x1){return _0x3677f4;}var _0x1a4e25=this['getAndSetVariable'](_0x1b66('0xb3'),'MRCP_RECOG_INSTANCE');if(_0x1a4e25[_0x1b66('0xa4')]===-0x1){return _0x1a4e25;}return this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0xb4'),_0x45e493));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x8')]=function(_0x5c20d3){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0xb5'),_0x5c20d3[_0x1b66('0x38')]));return this['channel'][_0x1b66('0x8')]([_0x5c20d3[_0x1b66('0xb6')],_0x5c20d3['args']]);};AGIVertices['prototype']['answer']=function(_0x447f3a){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0xb7'),_0x447f3a['label']));if(this[_0x1b66('0x84')](_0x447f3a['timeout'])){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0xb8'),_0x447f3a[_0x1b66('0x66')]));var _0x78d414=this[_0x1b66('0xe')][_0x1b66('0xb9')](_0x447f3a['timeout']);if(_0x78d414[_0x1b66('0xa4')]===-0x1){return _0x78d414;}}return this[_0x1b66('0xe')][_0x1b66('0xba')]();};AGIVertices[_0x1b66('0x11')]['callback']=function(_0x324cb2){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0xbb'),_0x324cb2[_0x1b66('0x38')]));if(!this['isConfigured'](_0x324cb2[_0x1b66('0x4a')])){return this['channel'][_0x1b66('0x2c')](_0x324cb2,_0x1b66('0xbc'));}_0x324cb2['scheduledAt']=moment();if(this[_0x1b66('0x84')](_0x324cb2['delay'])){_0x324cb2[_0x1b66('0x4d')]=moment()[_0x1b66('0xbd')](_0x324cb2[_0x1b66('0xbe')],_0x1b66('0xbf'));}if(!this['isConfigured'](_0x324cb2['callback_priority'])){_0x324cb2[_0x1b66('0xc0')]=0x2;}this['createCmContact'][_0x1b66('0x71')](this,_0x324cb2);return this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0xc1'),_0x324cb2['phone'],_0x324cb2[_0x1b66('0x4a')],_0x324cb2['scheduledAt']));};AGIVertices[_0x1b66('0x11')][_0x1b66('0xc2')]=function(_0x437b3a){logger['info'](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x437b3a[_0x1b66('0x38')]));var _0x349099=this['channel']['exec'](_0x437b3a['application'],_0x437b3a[_0x1b66('0x79')]);if(_0x349099[_0x1b66('0xa4')]===-0x1){return _0x349099;}return this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0xc3'),_0x437b3a['application'],_0x437b3a['options']));};AGIVertices[_0x1b66('0x11')]['lumenvoxtts']=function(_0x427eb1){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0xc4'),_0x427eb1[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x427eb1[_0x1b66('0x5c')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xaa'));}var _0x3e10fa='\x22'+_0x427eb1[_0x1b66('0x5c')]+'\x22';if(this[_0x1b66('0x84')](_0x427eb1[_0x1b66('0x79')])){_0x3e10fa+=','+_0x427eb1['options'];}var _0x18f88a=this[_0x1b66('0xe')][_0x1b66('0x59')](_0x1b66('0xab'),_0x3e10fa);if(_0x18f88a[_0x1b66('0xa4')]===-0x1){return _0x18f88a;}return this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0xc5'),_0x3e10fa));};AGIVertices['prototype'][_0x1b66('0xc6')]=function(_0x5dafbf){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0xc7'),_0x5dafbf[_0x1b66('0x38')]));if(!this['isConfigured'](_0x5dafbf[_0x1b66('0x5c')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xaa'));}var _0x3207cd='\x22'+_0x5dafbf['text']+'\x22';if(this[_0x1b66('0x84')](_0x5dafbf['options'])){_0x3207cd+=','+_0x5dafbf[_0x1b66('0x79')];}var _0x35595c=this[_0x1b66('0xe')][_0x1b66('0x59')](_0x1b66('0xab'),_0x3207cd);if(_0x35595c[_0x1b66('0xa4')]===-0x1){return _0x35595c;}return this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x3207cd));};AGIVertices[_0x1b66('0x11')][_0x1b66('0xc8')]=function(_0x22b160){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0xc9'),_0x22b160[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x22b160[_0x1b66('0xad')])){return this['channel'][_0x1b66('0xa9')](_0x1b66('0xae'));}var _0x29cf3a=_0x22b160['grammar'];if(this[_0x1b66('0x84')](_0x22b160[_0x1b66('0x79')])){_0x29cf3a+=','+_0x22b160[_0x1b66('0x79')];}var _0x47d70f=this[_0x1b66('0xe')]['exec'](_0x1b66('0xca'),_0x29cf3a);if(_0x47d70f[_0x1b66('0xa4')]===-0x1){return _0x47d70f;}var _0x14dd24=this[_0x1b66('0xa3')](_0x1b66('0xaf'),_0x1b66('0xcb'));if(_0x14dd24[_0x1b66('0xa4')]===-0x1){return _0x14dd24;}var _0x19a89c=this['getAndSetVariable'](_0x1b66('0xb1'),_0x1b66('0xcc'));if(_0x19a89c[_0x1b66('0xa4')]===-0x1){return _0x19a89c;}var _0x59f5fb=this[_0x1b66('0xa3')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x59f5fb[_0x1b66('0xa4')]===-0x1){return _0x59f5fb;}return this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0xb4'),_0x29cf3a));};AGIVertices[_0x1b66('0x11')]['sestekasr']=function(_0x2b1c5a){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0xcd'),_0x2b1c5a[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x2b1c5a[_0x1b66('0xad')])){return this['channel'][_0x1b66('0xa9')]('no\x20grammar\x20configured');}var _0x1c8635=_0x2b1c5a['grammar'];if(this[_0x1b66('0x84')](_0x2b1c5a[_0x1b66('0x79')])){_0x1c8635+=','+_0x2b1c5a[_0x1b66('0x79')];}var _0x1bbbfd=this['channel'][_0x1b66('0x59')]('MRCPRecog',_0x1c8635);if(_0x1bbbfd['result']===-0x1){return _0x1bbbfd;}var _0x413f57=this['getAndSetVariable'](_0x1b66('0xaf'),_0x1b66('0xce'));if(_0x413f57[_0x1b66('0xa4')]===-0x1){return _0x413f57;}var _0x1b11c6=this[_0x1b66('0xa3')](_0x1b66('0xb1'),_0x1b66('0xcf'));if(_0x1b11c6['result']===-0x1){return _0x1b11c6;}var _0x155bde=this[_0x1b66('0xa3')](_0x1b66('0xb3'),_0x1b66('0xd0'));if(_0x155bde[_0x1b66('0xa4')]===-0x1){return _0x155bde;}return this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0xb4'),_0x1c8635));};AGIVertices[_0x1b66('0x11')][_0x1b66('0xd1')]=function(_0x291733){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0xd2'),_0x291733[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x291733[_0x1b66('0xd3')])){return this['channel'][_0x1b66('0x2c')](_0x291733,_0x1b66('0xd4'));}var _0x404d24=this[_0x1b66('0x18')]['sync'](this,_0x291733[_0x1b66('0xd3')]);if(!_0x404d24){return this['channel'][_0x1b66('0x2c')](_0x291733,_0x1b66('0xd5'));}if(!this['isConfigured'](_0x291733['query'])){return this[_0x1b66('0xe')]['error'](_0x291733,_0x1b66('0xd6'));}var _0x264def=_0x291733[_0x1b66('0x2f')][_0x1b66('0xd7')](/(\r\n|\n|\r)/gm,'\x20');this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format'](_0x1b66('0xd8'),_0x264def));var _0x13c6ca=this[_0x1b66('0xd9')][_0x1b66('0x71')](this,_0x404d24,_0x264def);this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x291733,_0x264def);if(!this[_0x1b66('0x84')](_0x291733[_0x1b66('0xda')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xdb'));}var _0x27a60f=this[_0x1b66('0x12')]['sync'](this,_0x291733[_0x1b66('0xda')]);if(!_0x27a60f){return this['channel'][_0x1b66('0x2c')](_0x291733,_0x1b66('0xdc'));}var _0x569ce9=this;_0x13c6ca[_0x1b66('0xdd')](function(_0x374b0f,_0x212f4c){Object[_0x1b66('0xde')](_0x374b0f)[_0x1b66('0xdd')](function(_0x56f90c){_0x569ce9[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')](_0x1b66('0xdf'),_0x27a60f,_0x212f4c,_0x56f90c),_0x374b0f[_0x56f90c]);});});this[_0x1b66('0xe')][_0x1b66('0x9f')](util['format'](_0x1b66('0xe0'),_0x27a60f),_0x13c6ca[_0x1b66('0x9c')]);return this['channel'][_0x1b66('0xa9')](util['format']('variable\x20%s\x20set',_0x27a60f));};AGIVertices['prototype'][_0x1b66('0xe1')]=function(_0x22f13d){logger[_0x1b66('0xe2')](util[_0x1b66('0x2a')](_0x1b66('0xe3'),_0x22f13d[_0x1b66('0x38')]));if(!this['isConfigured'](_0x22f13d[_0x1b66('0xe4')])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x22f13d,_0x1b66('0xe5'));}var _0x5cec7a=this['getUser'][_0x1b66('0x71')](this,_0x22f13d[_0x1b66('0xe4')]);if(!_0x5cec7a){return this[_0x1b66('0xe')]['error'](_0x22f13d,_0x1b66('0xe6'));}var _0x25efd0=this[_0x1b66('0xe')][_0x1b66('0x59')](_0x1b66('0xe7'),[util[_0x1b66('0x2a')](_0x1b66('0xe8'),_0x5cec7a),_0x22f13d[_0x1b66('0x66')],_0x22f13d[_0x1b66('0xe9')],_0x22f13d[_0x1b66('0x74')]]);if(_0x25efd0['result']===-0x1){return _0x25efd0;}return this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0xea'),_0x1b66('0xe7')));};AGIVertices[_0x1b66('0x11')][_0x1b66('0xeb')]=function(_0xcc5d50){logger['info'](util['format'](_0x1b66('0xec'),_0xcc5d50[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0xcc5d50[_0x1b66('0x81')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xed'));}if(!this[_0x1b66('0x84')](_0xcc5d50['text'])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xaa'));}this[_0x1b66('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0xcc5d50);this[_0x1b66('0x44')](_0xcc5d50[_0x1b66('0x5c')],'in','','');this[_0x1b66('0xe')]['noop'](util['format'](_0x1b66('0xee'),_0xcc5d50[_0x1b66('0x5c')]));var _0x80a3bf=this[_0x1b66('0xef')][_0x1b66('0x71')](this,_0xcc5d50);if(_0x80a3bf){for(var _0x4e0ed8 in _0x80a3bf){if(_0x80a3bf[_0x1b66('0x96')](_0x4e0ed8)){this[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')](_0x1b66('0xf0'),_0x4e0ed8[_0x1b66('0x69')]()),_0x80a3bf[_0x4e0ed8]);}}this['createSquareMessage'](_0x80a3bf['speech'],_0x1b66('0xf1'),_0x1b66('0xeb'),'');return this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format'](_0x1b66('0xf2'),_0x80a3bf[_0x1b66('0xf3')]));}return this['channel']['error'](_0xcc5d50,_0x1b66('0xf4'));};AGIVertices['prototype'][_0x1b66('0xf5')]=function(_0x3fa21e){logger['info'](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x3fa21e['label']));if(!this[_0x1b66('0x84')](_0x3fa21e[_0x1b66('0x7b')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x3fa21e[_0x1b66('0x7c')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xf6'));}if(!this[_0x1b66('0x84')](_0x3fa21e[_0x1b66('0x7d')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x3fa21e['dialogflowV2_language'])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xf7'));}if(!this[_0x1b66('0x84')](_0x3fa21e[_0x1b66('0x5c')])){return this['channel'][_0x1b66('0xa9')](_0x1b66('0xaa'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x3fa21e);this[_0x1b66('0x44')](_0x3fa21e[_0x1b66('0x5c')],'in','','');this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format'](_0x1b66('0xf8'),_0x3fa21e[_0x1b66('0x5c')]));var _0x599e21=this['googleDialogflowV2'][_0x1b66('0x71')](this,_0x3fa21e);if(_0x599e21){for(var _0x5d9648 in _0x599e21){if(_0x599e21[_0x1b66('0x96')](_0x5d9648)){if(_0x5d9648!==_0x1b66('0xf9')){this[_0x1b66('0xe')]['setVariable'](util[_0x1b66('0x2a')](_0x1b66('0xf0'),_0x5d9648['toUpperCase']()),_0x599e21[_0x5d9648]);}}}this[_0x1b66('0x44')](_0x599e21[_0x1b66('0xf3')],_0x1b66('0xf1'),_0x1b66('0xf5'),_0x599e21[_0x1b66('0xf9')]);return this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0xfa'),_0x599e21[_0x1b66('0xf3')]));}return this[_0x1b66('0xe')]['error'](_0x3fa21e,_0x1b66('0xfb'));};AGIVertices[_0x1b66('0x11')][_0x1b66('0xfc')]=function(_0x59fced){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x59fced[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x59fced['ndauth_url'])){return this[_0x1b66('0xe')]['noop'](_0x1b66('0xfd'));}if(!this['isConfigured'](_0x59fced[_0x1b66('0xfe')])){return this[_0x1b66('0xe')]['noop'](_0x1b66('0xff'));}if(!this[_0x1b66('0x84')](_0x59fced[_0x1b66('0x100')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0x101'));}if(!this[_0x1b66('0x84')](_0x59fced[_0x1b66('0x102')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xaa'));}this[_0x1b66('0xe')][_0x1b66('0x103')]=!![];this[_0x1b66('0x36')](_0x59fced);this[_0x1b66('0x44')](_0x59fced[_0x1b66('0x5c')],'in','','');this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format'](_0x1b66('0x104'),_0x59fced[_0x1b66('0x5c')]));var _0x1d3bca=this[_0x1b66('0x7f')][_0x1b66('0x71')](this,_0x59fced);if(_0x1d3bca){for(var _0x2ddc8d in _0x1d3bca){if(_0x1d3bca[_0x1b66('0x96')](_0x2ddc8d)){this[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')](_0x1b66('0x105'),_0x2ddc8d[_0x1b66('0x69')]()),_0x1d3bca[_0x2ddc8d]);}}this[_0x1b66('0x44')](_0x1d3bca[_0x1b66('0xf3')],'out','sesteknda','');if(_0x1d3bca[_0x1b66('0x106')]){this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x107'),_0x1d3bca['audiofile']));var _0xe8ac11=this[_0x1b66('0xe')][_0x1b66('0x108')](_0x1d3bca['audiofile']);try{fs['unlink'](_0x1d3bca[_0x1b66('0x106')]+_0x1b66('0x109'));}catch(_0x1cabe9){logger[_0x1b66('0x2c')](_0x1cabe9);}return _0xe8ac11;}else{return this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x10a'),_0x1d3bca['speech']));}}return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x59fced,_0x1b66('0x10b'));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x10c')]=function(_0x1172a5){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('Enter\x20in\x20END\x20(%s)\x20block',_0x1172a5[_0x1b66('0x38')]));return this[_0x1b66('0xe')][_0x1b66('0xa9')]('end');};AGIVertices[_0x1b66('0x11')]['ext_dial']=function(_0x665bf2){logger['info'](util[_0x1b66('0x2a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x665bf2[_0x1b66('0x38')]));var _0x2417eb='';if(_0x665bf2[_0x1b66('0x10d')]){if(!this[_0x1b66('0x84')](_0x665bf2[_0x1b66('0x10d')])){return this['channel'][_0x1b66('0x2c')](_0x665bf2,_0x1b66('0x10e'));}else{var _0x24798d=parseInt(_0x665bf2[_0x1b66('0x10d')],0xa);if(isNaN(_0x24798d)){_0x2417eb=_0x665bf2['trunk_id'];}else{_0x2417eb=this[_0x1b66('0x1c')][_0x1b66('0x71')](this,_0x665bf2['trunk_id']);if(!_0x2417eb){return this['channel'][_0x1b66('0x2c')](_0x665bf2,_0x1b66('0x10f'));}}}}else if(_0x665bf2[_0x1b66('0x110')]){_0x2417eb=_0x665bf2[_0x1b66('0x110')];}else{return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x665bf2,_0x1b66('0x10e'));}var _0x4a8cb4=this[_0x1b66('0xe')][_0x1b66('0x59')](_0x1b66('0xe7'),[util[_0x1b66('0x2a')]('SIP/%s/%s',_0x2417eb,_0x665bf2[_0x1b66('0x49')]),_0x665bf2['timeout'],_0x665bf2['opts'],_0x665bf2[_0x1b66('0x74')]]);if(_0x4a8cb4[_0x1b66('0xa4')]===-0x1){return _0x4a8cb4;}return this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format'](_0x1b66('0xea'),_0x1b66('0xe7')));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x111')]=function(_0x37b5a7){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x112'),_0x37b5a7[_0x1b66('0x38')]));return this['channel'][_0x1b66('0xa9')](_0x1b66('0x111'));};AGIVertices[_0x1b66('0x11')][_0x1b66('0xd')]=function(_0x4026a5){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0x113'),_0x4026a5['label']));if(_0x4026a5[_0x1b66('0xa6')]===0x0){return this['maxRetry'](_0x4026a5);}_0x4026a5['retry']-=0x1;if(!this[_0x1b66('0x84')](_0x4026a5[_0x1b66('0x114')])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x4026a5,'no\x20file\x20audio\x20selected');}var _0x1e6892=this[_0x1b66('0x1e')][_0x1b66('0x71')](this,_0x4026a5[_0x1b66('0x114')]);if(!_0x1e6892){return this[_0x1b66('0xe')]['error'](_0x4026a5,_0x1b66('0x115'));}if(!this[_0x1b66('0x84')](_0x4026a5['variable_id'])){return this[_0x1b66('0xe')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x395da0=this[_0x1b66('0xe')][_0x1b66('0x116')](_0x1e6892,_0x4026a5[_0x1b66('0x117')],_0x4026a5['maxdigit']);var _0x5b1036=_0x395da0[_0x1b66('0xa4')]?_0x395da0[_0x1b66('0xa4')][_0x1b66('0x4e')]():'';logger[_0x1b66('0x2e')](_0x1b66('0x118'),JSON[_0x1b66('0x75')](_0x395da0));if(_0x395da0[_0x1b66('0xa4')]===-0x1){this['createSquareDetailsReport'][_0x1b66('0x71')](this,_0x4026a5,_0x5b1036);return _0x395da0;}else if(_0x395da0[_0x1b66('0xa2')]===_0x1b66('0x66')){_0x395da0[_0x1b66('0xa4')]=_0x5b1036[_0x1b66('0x9c')]>=parseInt(_0x4026a5[_0x1b66('0x119')])?'x':'i';}else{_0x395da0['result']=_0x5b1036['length']>=parseInt(_0x4026a5['mindigit'])&&_0x5b1036[_0x1b66('0x9c')]<=parseInt(_0x4026a5[_0x1b66('0x11a')])?'x':'i';}var _0x506f73=this[_0x1b66('0x12')][_0x1b66('0x71')](this,_0x4026a5[_0x1b66('0xda')]);if(!_0x506f73){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x4026a5,_0x1b66('0xdc'));}this[_0x1b66('0xe')][_0x1b66('0x9f')](_0x506f73,_0x5b1036);if(this[_0x1b66('0x84')](_0x4026a5[_0x1b66('0x11b')])){var _0x9bfb13=parseInt(_0x4026a5[_0x1b66('0x11b')],0xa);var _0x431706=rs['generate']({'charset':'*','length':_0x9bfb13});var _0x3b28eb=_0x5b1036[_0x1b66('0x9c')];if(_0x3b28eb>0x0){if(_0x3b28eb>_0x9bfb13){this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x4026a5,_0x4026a5[_0x1b66('0x11c')]===_0x1b66('0x11d')?_0x431706+_0x5b1036[_0x1b66('0x11e')](_0x9bfb13):_0x5b1036[_0x1b66('0x11e')](0x0,_0x3b28eb-_0x9bfb13)+_0x431706);}else{this['createSquareDetailsReport'][_0x1b66('0x71')](this,_0x4026a5,rs[_0x1b66('0x11f')]({'charset':'*','length':_0x3b28eb}));}}else{this[_0x1b66('0x36')]['sync'](this,_0x4026a5,'');}}else{this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x4026a5,_0x5b1036);}return _0x395da0;};AGIVertices['prototype']['getsecretdigits']=function(_0x291e94){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0x120'),_0x291e94['label']));return this[_0x1b66('0xd')](_0x291e94);};AGIVertices[_0x1b66('0x11')][_0x1b66('0x121')]=function(_0x1c5a37){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x122'),_0x1c5a37[_0x1b66('0x38')]));this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x1c5a37,_0x1c5a37[_0x1b66('0x123')]);return this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x124'),_0x1c5a37[_0x1b66('0x123')]));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x125')]=function(_0x353f9d){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0x126'),_0x353f9d[_0x1b66('0x38')]));if(!this['isConfigured'](_0x353f9d[_0x1b66('0x87')])||!this[_0x1b66('0x84')](_0x353f9d[_0x1b66('0x88')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x1b66('0x84')](_0x353f9d[_0x1b66('0x5c')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xaa'));}this['channel']['noop'](util[_0x1b66('0x2a')](_0x1b66('0x127'),_0x353f9d['text']));var _0x47ad0a=this[_0x1b66('0x86')][_0x1b66('0x71')](this,_0x353f9d);if(_0x47ad0a){this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x128'),_0x47ad0a));var _0x75d1f6=this[_0x1b66('0xe')][_0x1b66('0x108')](_0x47ad0a);try{fs[_0x1b66('0x129')](_0x47ad0a+_0x1b66('0x109'));}catch(_0x26548b){logger[_0x1b66('0x2c')](_0x26548b);}return _0x75d1f6;}return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x353f9d,_0x1b66('0x12a'));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x12b')]=function(_0x3cf686){logger['info'](util['format'](_0x1b66('0x12c'),_0x3cf686['label']));if(!this[_0x1b66('0x84')](_0x3cf686['aws_access_key_id'])||!this[_0x1b66('0x84')](_0x3cf686['aws_secret_access_key'])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0x12d'));}if(!this['isConfigured'](_0x3cf686[_0x1b66('0x8f')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0x12e'));}if(!this[_0x1b66('0x84')](_0x3cf686[_0x1b66('0x5c')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')]('no\x20text\x20configured');}this['channel'][_0x1b66('0x103')]=!![];this[_0x1b66('0x36')](_0x3cf686);this[_0x1b66('0x44')](_0x3cf686[_0x1b66('0x5c')],'in','','');this['channel'][_0x1b66('0xa9')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x3cf686[_0x1b66('0x5c')]));var _0x598d93=this[_0x1b66('0x8d')][_0x1b66('0x71')](this,_0x3cf686);if(_0x598d93){for(var _0x2bfacb in _0x598d93){if(_0x598d93[_0x1b66('0x96')](_0x2bfacb)&&_[_0x1b66('0x97')](_0x598d93[_0x2bfacb])){this['channel']['setVariable'](util['format'](_0x1b66('0x12f'),_0x2bfacb[_0x1b66('0x69')]()),_0x598d93[_0x2bfacb]);}}if(_['isNil'](_0x598d93[_0x1b66('0x77')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0x130'));}else{this[_0x1b66('0x44')](_0x598d93[_0x1b66('0x77')],_0x1b66('0xf1'),_0x1b66('0x131'),'');return this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format'](_0x1b66('0x132'),_0x598d93[_0x1b66('0x77')]));}}return this[_0x1b66('0xe')]['error'](_0x3cf686,_0x1b66('0x133'));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x134')]=function(_0x2ae4a6){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x135'),_0x2ae4a6[_0x1b66('0x38')],_0x2ae4a6[_0x1b66('0x66')]));if(!this['isConfigured'](_0x2ae4a6[_0x1b66('0x81')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xed'));}var _0x50d403=_0x1b66('0x136');var _0x59506c=util[_0x1b66('0x2a')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x446713=util['format'](_0x1b66('0x9e'),_0x59506c,_0x50d403);var _0x35ab13=!![];if(_0x2ae4a6[_0x1b66('0x137')]===_0x1b66('0x138')){_0x35ab13=![];}var _0x1dd2f0=this[_0x1b66('0xe')][_0x1b66('0x139')](_0x59506c,_0x50d403,_0x2ae4a6[_0x1b66('0x13a')],_0x2ae4a6[_0x1b66('0x66')],undefined,_0x35ab13);if(_0x1dd2f0[_0x1b66('0xa4')]!==-0x1){this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format']('google\x20%s\x20file\x20created',_0x446713));var _0xd0fdd=this[_0x1b66('0x90')][_0x1b66('0x71')](this,_0x2ae4a6,_0x446713);if(_0xd0fdd){for(var _0xb842b8 in _0xd0fdd){if(_0xd0fdd[_0x1b66('0x96')](_0xb842b8)){this[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')]('GOOGLE_ASR_%s',_0xb842b8[_0x1b66('0x69')]()),_0xd0fdd[_0xb842b8]);}}return this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')]('GoogleASR\x20Result\x20%s',JSON[_0x1b66('0x75')](_0xd0fdd)));}}return _0x1dd2f0;};AGIVertices['prototype'][_0x1b66('0x13b')]=function(_0x240cd8){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0x13c'),_0x240cd8[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x240cd8[_0x1b66('0x93')])){return this['channel'][_0x1b66('0xa9')](_0x1b66('0x13d'));}if(!this['isConfigured'](_0x240cd8[_0x1b66('0x94')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0x13e'));}var _0x350a72='wav';var _0x30b4d9=util[_0x1b66('0x2a')](_0x1b66('0x13f'),FILES_PATH,rs[_0x1b66('0x11f')](0x4));var _0x373c20=util[_0x1b66('0x2a')](_0x1b66('0x9e'),_0x30b4d9,_0x350a72);var _0x398548=!![];if(_0x240cd8[_0x1b66('0x137')]===_0x1b66('0x138')){_0x398548=![];}var _0x2e6056=this[_0x1b66('0xe')][_0x1b66('0x139')](_0x30b4d9,_0x350a72,_0x240cd8[_0x1b66('0x13a')],_0x240cd8[_0x1b66('0x66')],undefined,_0x398548);if(_0x2e6056[_0x1b66('0xa4')]!==-0x1){this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x140'),_0x373c20));var _0xb560c3=this[_0x1b66('0x92')][_0x1b66('0x71')](this,_0x240cd8,_0x373c20);if(_0xb560c3){for(var _0x3ae886 in _0xb560c3){if(_0xb560c3['hasOwnProperty'](_0x3ae886)){this[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')]('TILDE_ASR_%s',_0x3ae886['toUpperCase']()),_0xb560c3[_0x3ae886]);}}return this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0x141'),JSON[_0x1b66('0x75')](_0xb560c3)));}}return _0x2e6056;};AGIVertices[_0x1b66('0x11')][_0x1b66('0x142')]=function(_0x3a25b8){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x143'),_0x3a25b8['label']));return this[_0x1b66('0xe')][_0x1b66('0x144')](_0x3a25b8[_0x1b66('0x3e')],_0x3a25b8[_0x1b66('0x3f')],_0x3a25b8[_0x1b66('0x40')]);};AGIVertices[_0x1b66('0x11')]['gotoif']=function(_0x11ae23){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x145'),_0x11ae23['label']));if(!this[_0x1b66('0x84')](_0x11ae23[_0x1b66('0x146')])){return this['channel']['error'](_0x11ae23,_0x1b66('0x147'));}try{var _0x44b045=eval(_0x11ae23[_0x1b66('0x146')])?_0x1b66('0x148'):_0x1b66('0x149');this['channel'][_0x1b66('0xa9')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x11ae23[_0x1b66('0x146')],_0x44b045));return{'code':0xc8,'result':_0x44b045};}catch(_0xe49792){return{'code':0xc8,'result':_0x1b66('0x149')};}};AGIVertices['prototype']['gotoiftime']=function(_0x46bf7d){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x14a'),_0x46bf7d[_0x1b66('0x38')]));if(!this['isConfigured'](_0x46bf7d[_0x1b66('0x14b')])){return this[_0x1b66('0xe')]['error'](_0x46bf7d,'no\x20interval\x20configured');}var _0x2cee3c=this['getIntervals']['sync'](this,_0x46bf7d['interval_id']);if(!_0x2cee3c){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x46bf7d,'no\x20intervals\x20found');}for(var _0x5cff69=0x0;_0x5cff69<_0x2cee3c[_0x1b66('0x9c')];_0x5cff69+=0x1){var _0x3848e2=this[_0x1b66('0xe')][_0x1b66('0x12')](util[_0x1b66('0x2a')](_0x1b66('0x14c'),_0x2cee3c[_0x5cff69]));if(_0x3848e2[_0x1b66('0xa4')]===-0x1){return _0x3848e2;}logger[_0x1b66('0x2e')](util['format']('IFTIME\x20%s\x20%s',_0x2cee3c[_0x5cff69],_0x3848e2[_0x1b66('0xa2')]));if(_0x3848e2[_0x1b66('0xa2')]===_0x1b66('0x148')){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('IFTIME\x20%s\x20%s',_0x2cee3c[_0x5cff69],_0x1b66('0x148')));this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format'](_0x1b66('0x14d'),_0x2cee3c[_0x5cff69],_0x1b66('0x148')));return{'code':0xc8,'result':'true'};}else{logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x14d'),_0x2cee3c[_0x5cff69],_0x1b66('0x149')));this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x14d'),_0x2cee3c[_0x5cff69],_0x1b66('0x149')));}}return{'code':0xc8,'result':_0x1b66('0x149')};};AGIVertices[_0x1b66('0x11')][_0x1b66('0x14e')]=function(_0x38b3c8){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x38b3c8[_0x1b66('0x38')]));return this[_0x1b66('0xe')]['hangup']();};AGIVertices['prototype'][_0x1b66('0x14f')]=function(_0x261f11){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0x150'),_0x261f11[_0x1b66('0x38')]));if(!this['isConfigured'](_0x261f11[_0x1b66('0x81')])){return this['channel'][_0x1b66('0xa9')]('no\x20key\x20configured');}var _0xf34d0e='wav';var _0x3f93e0=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x1b66('0x11f')](0x4));var _0xd701e6=util[_0x1b66('0x2a')](_0x1b66('0x9e'),_0x3f93e0,_0xf34d0e);var _0x3b6de9=!![];if(_0x261f11[_0x1b66('0x137')]==='NOBEEP'){_0x3b6de9=![];}var _0x1ecb5e=this[_0x1b66('0xe')]['recordFile'](_0x3f93e0,_0xf34d0e,_0x261f11[_0x1b66('0x13a')],_0x261f11[_0x1b66('0x66')],undefined,_0x3b6de9);if(_0x1ecb5e['result']!==-0x1){this[_0x1b66('0xe')]['noop'](util['format'](_0x1b66('0x151'),_0xd701e6));var _0x442971=this['ispeechASR'][_0x1b66('0x71')](this,_0x261f11,_0xd701e6);if(_0x442971){for(var _0x9178bf in _0x442971){if(_0x442971[_0x1b66('0x96')](_0x9178bf)){this[_0x1b66('0xe')]['setVariable'](util[_0x1b66('0x2a')](_0x1b66('0x152'),_0x9178bf[_0x1b66('0x69')]()),_0x442971[_0x9178bf]);}}return this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x153'),JSON[_0x1b66('0x75')](_0x442971)));}}return _0x1ecb5e;};AGIVertices[_0x1b66('0x11')][_0x1b66('0x154')]=function(_0x324460){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x324460[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x324460['key'])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xed'));}if(!this[_0x1b66('0x84')](_0x324460[_0x1b66('0x5c')])){return this['channel'][_0x1b66('0xa9')]('no\x20text\x20configured');}this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x155'),_0x324460[_0x1b66('0x5c')]));var _0x1103fe=this['ispeechTTS'][_0x1b66('0x71')](this,_0x324460);if(_0x1103fe){this['channel'][_0x1b66('0xa9')](util['format'](_0x1b66('0x151'),_0x1103fe));var _0x447ea6=this['channel']['streamFile'](_0x1103fe,_0x324460[_0x1b66('0x13a')]);try{fs['unlink'](_0x1103fe+_0x1b66('0x109'));}catch(_0x44061){logger[_0x1b66('0x2c')](_0x44061);}return _0x447ea6;}return this['channel'][_0x1b66('0x2c')](_0x324460,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x1b66('0x11')][_0x1b66('0x156')]=function(_0x2e86be){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0x157'),_0x2e86be[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x2e86be['findBy'])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x2e86be,_0x1b66('0x158'));}logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x159'),this[_0x1b66('0xe')]['callerid'],_0x2e86be['findBy']));var _0xa8853a=this[_0x1b66('0x54')][_0x1b66('0x71')](this,_0x2e86be['findBy']);if(_0xa8853a){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x15a'),this['channel'][_0x1b66('0x3b')],_0x2e86be[_0x1b66('0x15b')]));this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0x15a'),this[_0x1b66('0xe')]['callerid'],_0x2e86be[_0x1b66('0x15b')]));return{'code':0xc8,'result':_0x1b66('0x15c')};}else{logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x15d'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x2e86be[_0x1b66('0x15b')]));this['channel'][_0x1b66('0xa9')](util['format'](_0x1b66('0x15d'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x2e86be[_0x1b66('0x15b')]));return{'code':0xc8,'result':_0x1b66('0x15e')};}};AGIVertices['prototype'][_0x1b66('0x15f')]=function(_0x367f2d){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x367f2d[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x367f2d['findBy'])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x367f2d,_0x1b66('0x158'));}logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x367f2d[_0x1b66('0x15b')]));var _0x4d2685=this[_0x1b66('0x53')]['sync'](this,_0x367f2d['findBy']);if(_0x4d2685){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x15a'),this[_0x1b66('0xe')]['callerid'],_0x367f2d[_0x1b66('0x15b')]));this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x15a'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x367f2d[_0x1b66('0x15b')]));return{'code':0xc8,'result':'success'};}else{logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x367f2d[_0x1b66('0x15b')]));this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0x15d'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x367f2d[_0x1b66('0x15b')]));return{'code':0xc8,'result':_0x1b66('0x15e')};}};AGIVertices['prototype'][_0x1b66('0x160')]=function(_0x4d71ea){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x161'),_0x4d71ea[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x4d71ea['operation'])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x4d71ea,_0x1b66('0x162'));}this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')]('math\x20%s',_0x4d71ea[_0x1b66('0x163')]));var _0x23d0eb=eval(_0x4d71ea[_0x1b66('0x163')]);if(!this[_0x1b66('0x84')](_0x4d71ea[_0x1b66('0xda')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xdb'));}var _0x352f7e=this['getVariable'][_0x1b66('0x71')](this,_0x4d71ea[_0x1b66('0xda')]);if(!_0x352f7e){return this['channel'][_0x1b66('0x2c')](_0x4d71ea,_0x1b66('0xdc'));}if(_[_0x1b66('0x9b')](_0x23d0eb)){var _0x12b41b=this;_0x23d0eb[_0x1b66('0xdd')](function(_0xcd38e3,_0x579f5f){_0x12b41b[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')](_0x1b66('0x164'),_0x352f7e,_0x579f5f),_0xcd38e3);});return this[_0x1b66('0xe')]['noop'](util['format'](_0x1b66('0x165'),_0x352f7e));}else{return this[_0x1b66('0xe')][_0x1b66('0x9f')](_0x352f7e,_0x23d0eb);}};AGIVertices['prototype'][_0x1b66('0xc')]=function(_0x1c35a3){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x166'),_0x1c35a3['label']));if(_0x1c35a3[_0x1b66('0xa6')]===0x0){return this['maxRetry'](_0x1c35a3);}_0x1c35a3[_0x1b66('0xa6')]-=0x1;if(!this['isConfigured'](_0x1c35a3[_0x1b66('0x114')])){return this['channel'][_0x1b66('0x2c')](_0x1c35a3,_0x1b66('0x167'));}var _0x1b1b7a=this[_0x1b66('0x1e')][_0x1b66('0x71')](this,_0x1c35a3[_0x1b66('0x114')]);if(!_0x1b1b7a){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x1c35a3,_0x1b66('0x115'));}var _0x5ad514=this['channel'][_0x1b66('0x116')](_0x1b1b7a,_0x1c35a3[_0x1b66('0x117')],_0x1c35a3['digit']);var _0x34cac1=_0x5ad514[_0x1b66('0xa4')];if(_0x5ad514[_0x1b66('0xa4')]===-0x1){this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x1c35a3,'-1');return _0x5ad514;}else if(_0x5ad514['extra']===_0x1b66('0x66')){_0x5ad514[_0x1b66('0xa4')]=_0x5ad514[_0x1b66('0xa4')][_0x1b66('0x9c')]>0x0?_0x5ad514[_0x1b66('0xa4')]:'t';}else if(_['isEmpty'](_0x5ad514['result'])){_0x5ad514[_0x1b66('0xa4')]='#';_0x34cac1='#';}if(!this[_0x1b66('0x84')](_0x1c35a3[_0x1b66('0xda')])){this[_0x1b66('0xe')][_0x1b66('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x99c9a=this[_0x1b66('0x12')][_0x1b66('0x71')](this,_0x1c35a3[_0x1b66('0xda')]);if(!_0x99c9a){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x1c35a3,_0x1b66('0xdc'));}this[_0x1b66('0xe')][_0x1b66('0x9f')](_0x99c9a,_0x34cac1);}this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x1c35a3,_0x34cac1);return _0x5ad514;};AGIVertices[_0x1b66('0x11')][_0x1b66('0xa9')]=function(_0x4761cc){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x168'),_0x4761cc[_0x1b66('0x38')]));return this[_0x1b66('0xe')]['noop'](_0x4761cc[_0x1b66('0x169')]||_0x4761cc['label']);};AGIVertices[_0x1b66('0x11')][_0x1b66('0x16a')]=function(_0xe81378){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x16b'),_0xe81378['label']));if(!this[_0x1b66('0x84')](_0xe81378[_0x1b66('0x15b')])){return this['channel'][_0x1b66('0x2c')](_0xe81378,_0x1b66('0x158'));}logger[_0x1b66('0x2e')](util['format'](_0x1b66('0x159'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0xe81378[_0x1b66('0x15b')]));var _0x7b7aee=this[_0x1b66('0x16c')]['sync'](this,_0xe81378[_0x1b66('0x16d')]);var _0x273d3a=this[_0x1b66('0x51')][_0x1b66('0x71')](this,_0xe81378[_0x1b66('0x15b')],_0x7b7aee);if(_0x273d3a){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x15a'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0xe81378[_0x1b66('0x15b')]));this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0x15a'),this[_0x1b66('0xe')]['callerid'],_0xe81378['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x1b66('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1b66('0xe')][_0x1b66('0x3b')],_0xe81378[_0x1b66('0x15b')]));this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x15a'),this['channel'][_0x1b66('0x3b')],_0xe81378[_0x1b66('0x15b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x1b66('0x11')][_0x1b66('0x16e')]=function(_0x1ab5bc){logger['info'](util[_0x1b66('0x2a')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x1ab5bc[_0x1b66('0x38')]));if(!this['isConfigured'](_0x1ab5bc['file_id'])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x1ab5bc,_0x1b66('0x167'));}var _0x1dd94e=this[_0x1b66('0x1e')][_0x1b66('0x71')](this,_0x1ab5bc[_0x1b66('0x114')]);if(!_0x1dd94e){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x1ab5bc,_0x1b66('0x115'));}var _0x1b296b=this['channel'][_0x1b66('0x59')](_0x1b66('0x16f'),[_0x1dd94e,_0x1ab5bc[_0x1b66('0xe9')]]);if(_0x1b296b[_0x1b66('0xa4')]===-0x1){return _0x1b296b;}return this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0xc3'),_0x1b66('0x16f'),_0x1dd94e));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x170')]=function(_0x3f122f){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x171'),_0x3f122f[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x3f122f[_0x1b66('0x172')])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x3f122f,'no\x20queue\x20selected');}var _0x20a19c='';var _0x50af84=parseInt(_0x3f122f[_0x1b66('0x172')],0xa);if(isNaN(_0x50af84)){_0x20a19c=_0x3f122f[_0x1b66('0x172')];}else{_0x20a19c=this[_0x1b66('0x173')]['sync'](this,_0x3f122f['queue_id']);if(!_0x20a19c){return this['channel'][_0x1b66('0x2c')](_0x3f122f,_0x1b66('0x174'));}}var _0x2cf6a1='';if(this[_0x1b66('0x84')](_0x3f122f[_0x1b66('0x114')])){var _0x52ac4f=this[_0x1b66('0x1e')][_0x1b66('0x71')](this,_0x3f122f[_0x1b66('0x114')]);if(_0x52ac4f){_0x2cf6a1=_0x52ac4f;}}this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x3f122f,_0x20a19c);if(_0x3f122f['opts'][_0x1b66('0x175')]('x')<0x0){_0x3f122f[_0x1b66('0xe9')]+='x';}if(_0x3f122f[_0x1b66('0xe9')][_0x1b66('0x175')]('X')<0x0){_0x3f122f[_0x1b66('0xe9')]+='X';}this[_0x1b66('0xe')][_0x1b66('0x9f')](_0x1b66('0x176'),_0x20a19c?_0x20a19c['toLowerCase']():'');var _0x253c3b=this['channel'][_0x1b66('0x59')](_0x1b66('0x177'),[_0x20a19c,_0x3f122f[_0x1b66('0xe9')],_0x3f122f['url'],_0x2cf6a1,_0x3f122f[_0x1b66('0x66')],_0x3f122f[_0x1b66('0x8')],_0x3f122f['macro'],_0x3f122f[_0x1b66('0x178')],'',_0x3f122f[_0x1b66('0x179')]]);if(_0x253c3b[_0x1b66('0xa4')]===-0x1){return _0x253c3b;}return this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')]('Executed\x20command\x20%s\x20%s',_0x1b66('0x177'),_0x20a19c));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x17a')]=function(_0x5b5d6d){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x17b'),_0x5b5d6d[_0x1b66('0x38')]));var _0x16974c=_0x5b5d6d[_0x1b66('0x17c')]||'wav';var _0x29bc88=util[_0x1b66('0x2a')](_0x1b66('0x17d'),this['channel'][_0x1b66('0x37')],rs['generate'](0x5));var _0x17a8d0=util[_0x1b66('0x2a')](_0x1b66('0x17e'),FILES_PATH,_0x29bc88,_0x16974c);var _0x1281c2=util['format']('%s/recordings/%s',FILES_PATH,_0x29bc88);this[_0x1b66('0x3c')][_0x1b66('0x71')](this,_0x5b5d6d,_0x29bc88,_0x17a8d0);this['channel']['setVariable'](_0x1b66('0x17f'),_0x29bc88);logger[_0x1b66('0x2e')](_0x1b66('0x180'),_0x1281c2,_0x16974c,_0x5b5d6d[_0x1b66('0x181')],_0x5b5d6d['timeout']);return this['channel'][_0x1b66('0x139')](_0x1281c2,_0x16974c,_0x5b5d6d[_0x1b66('0x181')],_0x5b5d6d[_0x1b66('0x66')],undefined,!![]);};AGIVertices['prototype'][_0x1b66('0x182')]=function(_0x1005c8){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x1005c8['label']));if(!this['isConfigured'](_0x1005c8[_0x1b66('0x74')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')]('no\x20url\x20configured');}var _0x345b87=this[_0x1b66('0x63')][_0x1b66('0x71')](this,_0x1005c8);logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x183'),util[_0x1b66('0x184')](_0x345b87,{'showHidden':![],'depth':null})));if(!this[_0x1b66('0x84')](_0x1005c8[_0x1b66('0xda')])){return this['channel']['noop'](_0x1b66('0x185'));}var _0x1ee46d=this[_0x1b66('0x12')][_0x1b66('0x71')](this,_0x1005c8[_0x1b66('0xda')]);if(!_0x1ee46d){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x1005c8,_0x1b66('0xdc'));}this[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')](_0x1b66('0x186'),_0x1ee46d),_0x345b87[_0x1b66('0x76')]?_0x345b87[_0x1b66('0x76')]:_0x1b66('0x187'));this[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')](_0x1b66('0x188'),_0x1ee46d),_0x345b87[_0x1b66('0x189')]?_0x345b87[_0x1b66('0x189')]:'OK');if(_0x345b87[_0x1b66('0x6a')]){try{this[_0x1b66('0x9d')](_0x345b87[_0x1b66('0x6a')],_0x1ee46d);}catch(_0x52cdec){logger[_0x1b66('0x2c')](util[_0x1b66('0x2a')](_0x1b66('0x18a'),_0x1ee46d));}}return this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0x18b'),_0x1ee46d));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x18c')]=function(_0x1473b5){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x18d'),_0x1473b5[_0x1b66('0x38')]));return this[_0x1b66('0xe')]['sayDigits'](_0x1473b5[_0x1b66('0x18e')][_0x1b66('0xd7')](/\s+/g,''),_0x1473b5[_0x1b66('0x181')]);};AGIVertices[_0x1b66('0x11')][_0x1b66('0x18f')]=function(_0x80e942){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x80e942['label']));return this[_0x1b66('0xe')][_0x1b66('0x190')](_0x80e942['number'][_0x1b66('0xd7')](/\s+/g,''),_0x80e942[_0x1b66('0x181')]);};AGIVertices[_0x1b66('0x11')][_0x1b66('0x191')]=function(_0x20751c){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0x192'),_0x20751c[_0x1b66('0x38')]));return this[_0x1b66('0xe')][_0x1b66('0x193')](_0x20751c[_0x1b66('0x5c')],_0x20751c[_0x1b66('0x181')]);};AGIVertices['prototype'][_0x1b66('0x194')]=function(_0x390762){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x390762['label']));if(!this[_0x1b66('0x84')](_0x390762[_0x1b66('0x195')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0x196'));}var _0xe2b928=this[_0x1b66('0x22')][_0x1b66('0x71')](this,_0x390762[_0x1b66('0x195')]);if(!_0xe2b928||!_0xe2b928[_0x1b66('0x197')]){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x390762,_0x1b66('0x198'));}var _0x5ae4d0={'from':util['format'](_0x1b66('0x199'),_0xe2b928[_0x1b66('0x14')],_0xe2b928[_0x1b66('0x19a')]||_0xe2b928[_0x1b66('0x197')][_0x1b66('0x19b')]),'to':_0x390762['to']||'','cc':_0x390762['cc']||'','bcc':_0x390762['bcc']||'','subject':_0x390762['subject'],'html':_0x390762[_0x1b66('0x5c')],'text':_0x390762['text']};var _0x4a5a9d={'tls':{'rejectUnauthorized':![]}};if(_0xe2b928['Smtp'][_0x1b66('0x19c')]){_0x4a5a9d[_0x1b66('0x19c')]=_0xe2b928[_0x1b66('0x197')][_0x1b66('0x19c')];}else{_0x4a5a9d[_0x1b66('0x19d')]=_0xe2b928[_0x1b66('0x197')][_0x1b66('0x19d')];_0x4a5a9d[_0x1b66('0x19e')]=_0xe2b928['Smtp'][_0x1b66('0x19e')];_0x4a5a9d[_0x1b66('0x19f')]=_0xe2b928[_0x1b66('0x197')][_0x1b66('0x19f')];}if(_0xe2b928[_0x1b66('0x197')][_0x1b66('0x1a0')]){_0x4a5a9d['auth']={'user':_0xe2b928[_0x1b66('0x197')][_0x1b66('0x19b')],'pass':_0xe2b928[_0x1b66('0x197')][_0x1b66('0x1a1')]};}if(this[_0x1b66('0x84')](_0x390762[_0x1b66('0x1a2')])){}logger[_0x1b66('0xe2')]('sendMail\x20message',JSON['stringify'](_0x5ae4d0));this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x390762,_0x390762[_0x1b66('0x195')]);this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x1a3'),_0xe2b928['name']));this['sendMailMessage'][_0x1b66('0x71')](this,_0x4a5a9d,_0x5ae4d0);return this['channel']['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x1b66('0x11')][_0x1b66('0x1a4')]=function(_0x23b68a){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x1a5'),_0x23b68a[_0x1b66('0x38')]));return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0x1a6'));};AGIVertices[_0x1b66('0x11')]['sendSMS']=function(_0x37d1da){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x1a7'),_0x37d1da[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x37d1da[_0x1b66('0x1a8')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')]('no\x20sms\x20account\x20configured');}var _0x23a0a5=this['getSmsAccount'][_0x1b66('0x71')](this,_0x37d1da['sms_account_id']);if(!_0x23a0a5){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x37d1da,_0x1b66('0x1a9'));}var _0x28972a={'body':_0x37d1da[_0x1b66('0x1aa')],'phone':_0x37d1da['to']||'','SmsAccountId':_0x23a0a5['id']};logger[_0x1b66('0xe2')]('sendSMS\x20message',JSON[_0x1b66('0x75')](_0x28972a));this[_0x1b66('0x36')]['sync'](this,_0x37d1da,_0x37d1da[_0x1b66('0x1a8')]);this[_0x1b66('0xe')]['noop'](util['format'](_0x1b66('0x1ab'),_0x23a0a5[_0x1b66('0x14')]));this[_0x1b66('0x35')]['sync'](this,_0x28972a);return this[_0x1b66('0xe')]['noop'](_0x1b66('0x1ac'));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x1ad')]=function(_0x54ea93){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x1ae'),_0x54ea93[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x54ea93[_0x1b66('0xda')])){return this[_0x1b66('0xe')]['error'](_0x54ea93,_0x1b66('0x1af'));}var _0x54145c=this[_0x1b66('0x12')][_0x1b66('0x71')](this,_0x54ea93['variable_id']);if(!_0x54145c){return this[_0x1b66('0xe')]['error'](_0x54ea93,'no\x20variable\x20found');}return this[_0x1b66('0xe')]['setVariable'](_0x54145c,_0x54ea93[_0x1b66('0x1b0')]);};AGIVertices['prototype'][_0x1b66('0x1b1')]=function(_0x3f487e){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x1b2'),_0x3f487e[_0x1b66('0x38')]));this[_0x1b66('0xe')][_0x1b66('0xa9')]('START\x20CALLY\x20SQUARE');if(_0x3f487e['answer']===_0x1b66('0x1b3')){this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0x1b4'));return this['channel']['answer']();}return this['channel'][_0x1b66('0xa9')](_0x1b66('0x1b5'));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x1b6')]=function(_0x288cd3){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x1b7'),_0x288cd3['label']));if(!this['isConfigured'](_0x288cd3[_0x1b66('0x1b8')])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x288cd3,'no\x20subproject\x20selected');}var _0x392f36=this[_0x1b66('0x16')]['sync'](this,_0x288cd3[_0x1b66('0x1b8')]);if(!this[_0x1b66('0x84')](_0x392f36)){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x288cd3,util[_0x1b66('0x2a')](_0x1b66('0x1b9'),_0x288cd3['project_id']));}if(_0x392f36===this[_0x1b66('0xe')][_0x1b66('0x3a')]){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x288cd3,_0x1b66('0x1ba'));}this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x288cd3,_0x392f36);var _0x116666=this['channel'][_0x1b66('0x59')](_0x1b66('0x1bb'),util[_0x1b66('0x2a')](_0x1b66('0x1bc'),config[_0x1b66('0x8')]['host']||_0x1b66('0x1bd'),_0x392f36,this[_0x1b66('0xe')][_0x1b66('0x3a')]));if(_0x116666[_0x1b66('0xa4')]===-0x1){return _0x116666;}return this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0xc3'),_0x1b66('0x1bb'),_0x392f36));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x1be')]=function(_0x201abe){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x1bf'),_0x201abe[_0x1b66('0x38')]));var _0x1240ee=this[_0x1b66('0x58')][_0x1b66('0x71')](this,_0x201abe['command']);this['createSquareDetailsReport'][_0x1b66('0x71')](this,_0x201abe,_0x201abe['command']);if(this[_0x1b66('0x84')](_0x201abe[_0x1b66('0xda')])){var _0x4ed41c=this[_0x1b66('0x12')]['sync'](this,_0x201abe[_0x1b66('0xda')]);if(_0x4ed41c){this[_0x1b66('0xe')][_0x1b66('0x9f')](_0x4ed41c,_0x1240ee);return this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format'](_0x1b66('0x1c0'),_0x201abe[_0x1b66('0xb6')],_0x4ed41c));}}return this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x1c1'),_0x201abe[_0x1b66('0xb6')]));};AGIVertices[_0x1b66('0x11')]['google_cloud_tts']=function(_0x2be336){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x1c2'),_0x2be336[_0x1b66('0x38')]));_0x2be336['text']=_0x2be336[_0x1b66('0x5c')][_0x1b66('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1b66('0x84')](_0x2be336[_0x1b66('0x1c3')])){return this[_0x1b66('0xe')]['noop'](_0x1b66('0x1c4'));}if(!this[_0x1b66('0x84')](_0x2be336['text'])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xaa'));}this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x1c5'),_0x2be336[_0x1b66('0x5c')]));var _0x360814=this[_0x1b66('0x5a')][_0x1b66('0x71')](this,_0x2be336);if(_0x360814){this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x1c6'),_0x360814));var _0x3f2823=this[_0x1b66('0xe')][_0x1b66('0x108')](_0x360814);try{fs['unlink'](_0x360814+_0x1b66('0x109'));}catch(_0x2e4ceb){logger[_0x1b66('0x2c')](_0x2e4ceb);}return _0x3f2823;}return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x2be336,_0x1b66('0x1c7'));};AGIVertices['prototype'][_0x1b66('0x1c8')]=function(_0x3b45f2){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x1c9'),_0x3b45f2[_0x1b66('0x38')]));_0x3b45f2[_0x1b66('0x5c')]=_0x3b45f2[_0x1b66('0x5c')][_0x1b66('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1b66('0x84')](_0x3b45f2[_0x1b66('0x5c')])){return this[_0x1b66('0xe')]['noop'](_0x1b66('0xaa'));}this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0x1ca'),_0x3b45f2['text']));var _0x2f4aa4=this['googleTTS']['sync'](this,_0x3b45f2);if(_0x2f4aa4){this['channel']['noop'](util[_0x1b66('0x2a')](_0x1b66('0x1cb'),_0x2f4aa4));var _0x2b9fb1=this['channel'][_0x1b66('0x108')](_0x2f4aa4);try{fs[_0x1b66('0x129')](_0x2f4aa4+'.wav');}catch(_0x2c34f8){logger['error'](_0x2c34f8);}return _0x2b9fb1;}return this['channel'][_0x1b66('0x2c')](_0x3b45f2,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x1b66('0x1cc')]=function(_0x5abf64){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x1cd'),_0x5abf64['label']));if(!this[_0x1b66('0x84')](_0x5abf64[_0x1b66('0x15b')])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x5abf64,_0x1b66('0x158'));}logger['info'](util['format'](_0x1b66('0x159'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x5abf64[_0x1b66('0x15b')]));var _0x4ececd=this[_0x1b66('0x52')][_0x1b66('0x71')](this,_0x5abf64[_0x1b66('0x15b')]);if(_0x4ececd){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x15a'),this['channel'][_0x1b66('0x3b')],_0x5abf64[_0x1b66('0x15b')]));this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1b66('0xe')]['callerid'],_0x5abf64[_0x1b66('0x15b')]));return{'code':0xc8,'result':_0x1b66('0x15c')};}else{logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x15d'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x5abf64[_0x1b66('0x15b')]));this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x15d'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x5abf64[_0x1b66('0x15b')]));return{'code':0xc8,'result':_0x1b66('0x15e')};}};AGIVertices[_0x1b66('0x11')][_0x1b66('0x1ce')]=function(_0x567101){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x1cf'),_0x567101[_0x1b66('0x38')]));var _0x453ad4=this[_0x1b66('0xe')][_0x1b66('0x59')](_0x1b66('0x1d0'),[_0x567101['mailbox'],_0x567101[_0x1b66('0x79')]]);if(_0x453ad4[_0x1b66('0xa4')]===-0x1){return _0x453ad4;}return this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0xc3'),'VOICEMAIL',_0x567101[_0x1b66('0x1d1')]));};AGIVertices['prototype'][_0x1b66('0x1d2')]=function(_0x26c3b3){logger[_0x1b66('0x2e')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x26c3b3[_0x1b66('0x38')]));if(!this['isConfigured'](_0x26c3b3[_0x1b66('0xda')])){return this[_0x1b66('0xe')]['error'](_0x26c3b3,'no\x20variable\x20selected');}var _0x47b173=this[_0x1b66('0x12')][_0x1b66('0x71')](this,_0x26c3b3[_0x1b66('0xda')]);if(!_0x47b173){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x26c3b3,_0x1b66('0xdc'));}var _0xb9a293=this[_0x1b66('0xe')][_0x1b66('0x12')](_0x47b173);return{'code':0xc8,'result':_0xb9a293[_0x1b66('0xa2')]?_0xb9a293[_0x1b66('0xa2')]:'-'};};String[_0x1b66('0x11')]['replaceAll']=function(_0x30e1b2,_0x1e643b){return this[_0x1b66('0xa0')](_0x30e1b2)['join'](_0x1e643b);};module[_0x1b66('0x1d3')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index fcb5535..f5d9633 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 _0x22c4=['autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','util','lodash','moment','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','queue','updateAcw','update','uniqueid','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','message','prototype','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','interface','destlinkedid','acw','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer'];(function(_0xd17192,_0x42d4bd){var _0x3da8c9=function(_0x3d953d){while(--_0x3d953d){_0xd17192['push'](_0xd17192['shift']());}};_0x3da8c9(++_0x42d4bd);}(_0x22c4,0x1ae));var _0x422c=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0x22c4[_0x2b152a];return _0x2ad4c7;};'use strict';var util=require(_0x422c('0x0'));var _=require(_0x422c('0x1'));var moment=require(_0x422c('0x2'));var ami=require('../ami');var logger=require('../../../config/logger')('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x422c('0x3'));function Acw(_0x53ee2c){this[_0x422c('0x4')]=_0x53ee2c[_0x422c('0x4')];this[_0x422c('0x5')]=_0x53ee2c[_0x422c('0x5')];this[_0x422c('0x6')]=_0x53ee2c[_0x422c('0x6')];this[_0x422c('0x7')]={};ami['on']('agentconnect',this[_0x422c('0x8')][_0x422c('0x9')](this));ami['on'](_0x422c('0xa'),this[_0x422c('0xb')]['bind'](this));ami['on'](_0x422c('0xc'),this['syncHangup'][_0x422c('0x9')](this));ami['on'](_0x422c('0xd'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x422c('0xe'),this[_0x422c('0xf')][_0x422c('0x9')](this));ami['on'](_0x422c('0x10'),this[_0x422c('0x11')][_0x422c('0x9')](this));ami['on'](_0x422c('0x12'),this[_0x422c('0x13')]['bind'](this));}function getDiff(_0x51def7){var _0x52f31f=moment()[_0x422c('0x14')](0x0);var _0x2beb53=moment(_0x51def7)[_0x422c('0x14')](0x0);return _0x52f31f[_0x422c('0x15')](_0x2beb53,_0x422c('0x16'));}Acw['prototype'][_0x422c('0x17')]=function(_0x4ca88c){try{var _0x186a92=this;var _0x230624=this[_0x422c('0x7')][_0x4ca88c]['interface'];var _0x4835c9=this[_0x422c('0x7')][_0x4ca88c]['queue'];var _0x47b6ba=this[_0x422c('0x4')][_0x4835c9];var _0x5f092f=![];var _0x46e7b3='ACW';if(_0x47b6ba[_0x422c('0x18')]){if(_0x47b6ba['mandatoryDispositionPause'][_0x422c('0x19')]){_0x5f092f=!![];_0x46e7b3=_0x47b6ba[_0x422c('0x1a')][_0x422c('0x19')];}}ami[_0x422c('0x1b')]({'action':_0x422c('0x1c'),'interface':_0x230624,'paused':!![],'reason':_0x46e7b3})[_0x422c('0x1d')](function(_0x37edc3){if(_0x186a92[_0x422c('0x5')][_0x230624]){return RpcUser['getAgent'](_0x186a92[_0x422c('0x5')][_0x230624]['id'])[_0x422c('0x1d')](function(_0x108302){if(_0x108302&&!_0x108302[_0x422c('0x1e')]){logger[_0x422c('0x1f')](_0x422c('0x20'),_0x4ca88c,_0x230624,_0x4835c9);var _0x2aaeec=_0x186a92[_0x422c('0x7')][_0x4ca88c][_0x422c('0x21')]&&_0x186a92[_0x422c('0x7')][_0x4ca88c]['destlinkedid']?_0x186a92['channels'][_0x4ca88c]['destlinkedid']:_0x4ca88c;return RpcUser['savePause'](_0x186a92[_0x422c('0x5')][_0x230624],_0x46e7b3,_0x2aaeec)[_0x422c('0x1d')](function(_0x212436){if(!_0x5f092f){_0x186a92[_0x422c('0x6')][_0x230624]={};logger['info'](_0x422c('0x22'),_0x4ca88c,_0x186a92[_0x422c('0x4')][_0x4835c9][_0x422c('0x23')],_0x230624,_0x4835c9);_0x186a92[_0x422c('0x6')][_0x230624][_0x422c('0x24')]=setTimeout(_0x186a92[_0x422c('0x25')]['bind'](_0x186a92,_0x230624),_0x186a92[_0x422c('0x4')][_0x4835c9]['acwTimeout']*0x3e8);_0x186a92[_0x422c('0x6')][_0x230624][_0x422c('0x26')]=moment()[_0x422c('0x27')](_0x422c('0x28'));_0x186a92[_0x422c('0x6')][_0x230624]['uniqueid']=_0x4ca88c;_0x186a92[_0x422c('0x6')][_0x230624][_0x422c('0x29')]=_0x4835c9;_0x186a92[_0x422c('0x6')][_0x230624][_0x422c('0x2a')]=function(){var _0x1fdac7=getDiff(_0x186a92['timers'][_0x230624][_0x422c('0x26')]);clearTimeout(_0x186a92[_0x422c('0x6')][_0x230624][_0x422c('0x24')]);_0x186a92[_0x422c('0x6')][_0x230624]['timer']=![];RpcVoiceAgentReport[_0x422c('0x2b')]({'acwtime':_0x1fdac7},_0x186a92[_0x422c('0x6')][_0x230624][_0x422c('0x2c')],_0x230624)[_0x422c('0x1d')](function(_0x338287){logger[_0x422c('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x4ca88c,_0x1fdac7,_0x338287);})['catch'](function(_0x28adfd){logger[_0x422c('0x2d')]('[%s][UPDATE][ERRORS:%s]',_0x4ca88c,_0x28adfd);});delete _0x186a92['timers'][_0x230624];};}});}else{logger[_0x422c('0x1f')](_0x422c('0x2e'),_0x4ca88c,_0x230624,_0x4835c9);}});}})[_0x422c('0x2f')](function(_0x4d6581){logger['error'](_0x422c('0x22'),_0x4ca88c,_0x186a92[_0x422c('0x4')][_0x4835c9][_0x422c('0x23')],_0x230624,_0x4835c9);})[_0x422c('0x30')](function(){delete _0x186a92['channels'][_0x4ca88c];});}catch(_0x5c8077){logger[_0x422c('0x2d')]('[ACW][START]\x20%s',_0x5c8077[_0x422c('0x31')]);}};Acw[_0x422c('0x32')][_0x422c('0x25')]=function(_0x318add){try{var _0x2fe999=this;if(_0x2fe999[_0x422c('0x6')][_0x318add]){_0x2fe999[_0x422c('0x6')][_0x318add][_0x422c('0x24')]=![];var _0x21a158=_0x2fe999[_0x422c('0x6')][_0x318add][_0x422c('0x2c')];var _0x52c161=_0x2fe999[_0x422c('0x6')][_0x318add][_0x422c('0x29')];var _0x4288fd=_0x2fe999['voiceQueues'][_0x52c161]['acwTimeout'];logger[_0x422c('0x1f')]('[%s][TIMER][STOP][AGENT:%s]',_0x21a158,_0x318add);RpcUser['saveUnpause'](this['agents'][_0x318add]);RpcVoiceAgentReport[_0x422c('0x2b')]({'acwtime':_0x4288fd,'agentacw':!![]},_0x21a158,_0x318add)[_0x422c('0x1d')](function(_0x150c33){logger[_0x422c('0x1f')](_0x422c('0x33'),_0x21a158,_0x4288fd,_0x150c33);})['catch'](function(_0x2b6153){logger['error'](_0x422c('0x34'),_0x21a158,_0x2b6153);});}else{logger[_0x422c('0x2d')](_0x422c('0x35'),_0x318add);if(_0x2fe999[_0x422c('0x6')]){logger[_0x422c('0x1f')]('[ACW][TIMERS]',JSON[_0x422c('0x36')](_0x2fe999[_0x422c('0x6')]));}}}catch(_0x39c851){logger['error'](_0x422c('0x37'),_0x39c851['message']);}};Acw[_0x422c('0x32')]['syncAgentConnect']=function(_0x3802db){try{if(this[_0x422c('0x4')][_0x3802db[_0x422c('0x29')]]&&(this[_0x422c('0x4')][_0x3802db['queue']]['acw']||this[_0x422c('0x4')][_0x3802db['queue']][_0x422c('0x18')])){if(this['agents'][_0x3802db['interface']]){this[_0x422c('0x7')][_0x3802db['uniqueid']]={'queue':_0x3802db[_0x422c('0x29')],'interface':_0x3802db[_0x422c('0x38')],'destlinkedid':_0x3802db[_0x422c('0x39')]};}}}catch(_0x49d022){logger[_0x422c('0x2d')]('[ACW][syncAgentConnect]\x20%s',_0x49d022[_0x422c('0x31')]);}};Acw[_0x422c('0x32')]['syncAgentConnectPreview']=function(_0x4623e4){try{if(this[_0x422c('0x4')][_0x4623e4[_0x422c('0x29')]]&&(this[_0x422c('0x4')][_0x4623e4[_0x422c('0x29')]][_0x422c('0x3a')]||this[_0x422c('0x4')][_0x4623e4[_0x422c('0x29')]][_0x422c('0x18')])){if(this[_0x422c('0x5')][_0x4623e4[_0x422c('0x38')]]){this[_0x422c('0x7')][_0x4623e4[_0x422c('0x2c')]]={'queue':_0x4623e4['queue'],'interface':_0x4623e4['interface']};}}}catch(_0x5cd6a1){logger[_0x422c('0x2d')](_0x422c('0x3b'),_0x5cd6a1[_0x422c('0x31')]);}};Acw[_0x422c('0x32')][_0x422c('0xb')]=function(_0x46f068){try{if(this[_0x422c('0x7')][_0x46f068[_0x422c('0x2c')]]&&_[_0x422c('0x3c')](this[_0x422c('0x7')][_0x46f068['uniqueid']][_0x422c('0x21')])){logger['info'](_0x422c('0x3d'),_0x46f068[_0x422c('0x2c')]);this[_0x422c('0x17')](_0x46f068['uniqueid']);}else if(this[_0x422c('0x7')][_0x46f068['linkedid']]&&_[_0x422c('0x3c')](this[_0x422c('0x7')][_0x46f068[_0x422c('0x3e')]][_0x422c('0x21')])){logger[_0x422c('0x1f')](_0x422c('0x3f'),_0x46f068['linkedid']);this[_0x422c('0x17')](_0x46f068[_0x422c('0x3e')]);}}catch(_0xec9034){logger[_0x422c('0x2d')]('[ACW][syncHangupRequest]\x20%s',_0xec9034['message']);}};Acw['prototype'][_0x422c('0x40')]=function(_0x22eada){try{if(this[_0x422c('0x7')][_0x22eada[_0x422c('0x2c')]]&&this[_0x422c('0x7')][_0x22eada['uniqueid']][_0x422c('0x21')]){logger['info'](_0x422c('0x41'),_0x22eada[_0x422c('0x2c')]);this[_0x422c('0x17')](_0x22eada['uniqueid']);}else if(this[_0x422c('0x7')][_0x22eada[_0x422c('0x3e')]]&&this['channels'][_0x22eada['linkedid']][_0x422c('0x21')]){logger['info'](_0x422c('0x42'),_0x22eada[_0x422c('0x3e')]);this[_0x422c('0x17')](_0x22eada['linkedid']);}}catch(_0x47806f){logger[_0x422c('0x2d')](_0x422c('0x43'),_0x47806f[_0x422c('0x31')]);}};Acw[_0x422c('0x32')]['syncAttendedTransfer']=function(_0xd9c704){try{if(!_[_0x422c('0x44')](this['channels'][_0xd9c704['transfereeuniqueid']])){this[_0x422c('0x17')](_0xd9c704['transfereeuniqueid']);if(this[_0x422c('0x7')][_0xd9c704[_0x422c('0x45')]]){this[_0x422c('0x7')][_0xd9c704[_0x422c('0x45')]][_0x422c('0x21')]=!![];this[_0x422c('0x7')][_0xd9c704['transfertargetuniqueid']]=this[_0x422c('0x7')][_0xd9c704[_0x422c('0x45')]];delete this[_0x422c('0x7')][_0xd9c704[_0x422c('0x45')]];}}else if(!_[_0x422c('0x44')](this['channels'][_0xd9c704[_0x422c('0x46')]])){this['startAcw'](_0xd9c704[_0x422c('0x46')]);if(this['channels'][_0xd9c704[_0x422c('0x47')]]){this[_0x422c('0x7')][_0xd9c704[_0x422c('0x47')]][_0x422c('0x21')]=!![];this[_0x422c('0x7')][_0xd9c704[_0x422c('0x48')]]=this[_0x422c('0x7')][_0xd9c704[_0x422c('0x47')]];delete this[_0x422c('0x7')][_0xd9c704[_0x422c('0x47')]];}}}catch(_0x19478b){logger[_0x422c('0x2d')](_0x422c('0x49'),_0x19478b[_0x422c('0x31')]);}};Acw[_0x422c('0x32')][_0x422c('0x11')]=function(_0x15ed48){try{if(this[_0x422c('0x7')][_0x15ed48[_0x422c('0x4a')]]){logger[_0x422c('0x1f')](_0x422c('0x4b'),JSON['stringify'](_0x15ed48[_0x422c('0x4a')]));this['startAcw'](_0x15ed48[_0x422c('0x4a')]);}else if(this['channels'][_0x15ed48[_0x422c('0x4c')]]){logger['info'](_0x422c('0x4d'),JSON[_0x422c('0x36')](_0x15ed48['transfererlinkedid']));this[_0x422c('0x17')](_0x15ed48[_0x422c('0x4c')]);}}catch(_0x131b2f){logger['error'](_0x422c('0x4e'),_0x131b2f[_0x422c('0x31')]);}};Acw['prototype'][_0x422c('0x4f')]=function(_0x3bc763){try{if(this[_0x422c('0x4')][_0x3bc763[_0x422c('0x29')]]&&this['voiceQueues'][_0x3bc763[_0x422c('0x29')]][_0x422c('0x50')]===_0x422c('0x51')){if(this[_0x422c('0x5')][_0x3bc763[_0x422c('0x38')]]){logger[_0x422c('0x1f')](_0x422c('0x52'),_0x3bc763[_0x422c('0x2c')],_0x3bc763[_0x422c('0x38')],_0x3bc763[_0x422c('0x29')]);return RpcUser[_0x422c('0x53')](this[_0x422c('0x5')][_0x3bc763[_0x422c('0x38')]],_0x422c('0x54'),_0x3bc763[_0x422c('0x2c')]);}}}catch(_0x2f53ba){logger[_0x422c('0x2d')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x2f53ba[_0x422c('0x31')]);}};module['exports']=Acw; \ No newline at end of file +var _0x2389=['uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][TIMERS]','stringify','acw','interface','syncAgentConnectPreview','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','lodash','moment','../ami','../../../config/logger','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','queue','ACW','mandatoryDispositionPause','name','QueuePause','getAgent','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x230902,_0x5b7c78){var _0x2feae9=function(_0x4f1660){while(--_0x4f1660){_0x230902['push'](_0x230902['shift']());}};_0x2feae9(++_0x5b7c78);}(_0x2389,0x192));var _0x9238=function(_0x2b0d88,_0x5b5ef2){_0x2b0d88=_0x2b0d88-0x0;var _0x1c9256=_0x2389[_0x2b0d88];return _0x1c9256;};'use strict';var util=require('util');var _=require(_0x9238('0x0'));var moment=require(_0x9238('0x1'));var ami=require(_0x9238('0x2'));var logger=require(_0x9238('0x3'))('acw');var RpcUser=require(_0x9238('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3676d4){this['voiceQueues']=_0x3676d4[_0x9238('0x5')];this[_0x9238('0x6')]=_0x3676d4[_0x9238('0x6')];this[_0x9238('0x7')]=_0x3676d4[_0x9238('0x7')];this[_0x9238('0x8')]={};ami['on'](_0x9238('0x9'),this[_0x9238('0xa')][_0x9238('0xb')](this));ami['on'](_0x9238('0xc'),this[_0x9238('0xd')]['bind'](this));ami['on'](_0x9238('0xe'),this['syncHangup'][_0x9238('0xb')](this));ami['on'](_0x9238('0xf'),this['syncAgentRingNoAnswer'][_0x9238('0xb')](this));ami['on'](_0x9238('0x10'),this[_0x9238('0x11')][_0x9238('0xb')](this));ami['on'](_0x9238('0x12'),this[_0x9238('0x13')][_0x9238('0xb')](this));ami['on'](_0x9238('0x14'),this['syncAgentConnectPreview'][_0x9238('0xb')](this));}function getDiff(_0x294c5d){var _0x11ff1e=moment()['milliseconds'](0x0);var _0x459387=moment(_0x294c5d)[_0x9238('0x15')](0x0);return _0x11ff1e[_0x9238('0x16')](_0x459387,_0x9238('0x17'));}Acw[_0x9238('0x18')]['startAcw']=function(_0x1781f){try{var _0x3f903d=this;var _0x5b5321=this[_0x9238('0x8')][_0x1781f]['interface'];var _0x2dca2d=this['channels'][_0x1781f][_0x9238('0x19')];var _0x215380=this[_0x9238('0x5')][_0x2dca2d];var _0x259f93=![];var _0x5e125d=_0x9238('0x1a');if(_0x215380['mandatoryDisposition']){if(_0x215380[_0x9238('0x1b')]['name']){_0x259f93=!![];_0x5e125d=_0x215380[_0x9238('0x1b')][_0x9238('0x1c')];}}ami['Action']({'action':_0x9238('0x1d'),'interface':_0x5b5321,'paused':!![],'reason':_0x5e125d})['then'](function(_0xbfdac3){if(_0x3f903d['agents'][_0x5b5321]){return RpcUser[_0x9238('0x1e')](_0x3f903d[_0x9238('0x6')][_0x5b5321]['id'])[_0x9238('0x1f')](function(_0x223162){if(_0x223162&&!_0x223162[_0x9238('0x20')]){logger[_0x9238('0x21')](_0x9238('0x22'),_0x1781f,_0x5b5321,_0x2dca2d);var _0xf46b5a=_0x3f903d[_0x9238('0x8')][_0x1781f]['attended']&&_0x3f903d[_0x9238('0x8')][_0x1781f][_0x9238('0x23')]?_0x3f903d[_0x9238('0x8')][_0x1781f][_0x9238('0x23')]:_0x1781f;return RpcUser[_0x9238('0x24')](_0x3f903d[_0x9238('0x6')][_0x5b5321],_0x5e125d,_0xf46b5a)[_0x9238('0x1f')](function(_0x5afa70){if(!_0x259f93){_0x3f903d[_0x9238('0x7')][_0x5b5321]={};logger[_0x9238('0x21')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1781f,_0x3f903d[_0x9238('0x5')][_0x2dca2d][_0x9238('0x25')],_0x5b5321,_0x2dca2d);_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x26')]=setTimeout(_0x3f903d[_0x9238('0x27')][_0x9238('0xb')](_0x3f903d,_0x5b5321),_0x3f903d[_0x9238('0x5')][_0x2dca2d][_0x9238('0x25')]*0x3e8);_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x28')]=moment()[_0x9238('0x29')](_0x9238('0x2a'));_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x2b')]=_0x1781f;_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x19')]=_0x2dca2d;_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x2c')]=function(){var _0x1717cd=getDiff(_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x28')]);clearTimeout(_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x26')]);_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x26')]=![];RpcVoiceAgentReport[_0x9238('0x2d')]({'acwtime':_0x1717cd},_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x2b')],_0x5b5321)[_0x9238('0x1f')](function(_0x43ff95){logger['info'](_0x9238('0x2e'),_0x1781f,_0x1717cd,_0x43ff95);})[_0x9238('0x2f')](function(_0x169efa){logger[_0x9238('0x30')](_0x9238('0x31'),_0x1781f,_0x169efa);});delete _0x3f903d[_0x9238('0x7')][_0x5b5321];};}});}else{logger['info'](_0x9238('0x32'),_0x1781f,_0x5b5321,_0x2dca2d);}});}})[_0x9238('0x2f')](function(_0x343ab4){logger[_0x9238('0x30')](_0x9238('0x33'),_0x1781f,_0x3f903d[_0x9238('0x5')][_0x2dca2d][_0x9238('0x25')],_0x5b5321,_0x2dca2d);})[_0x9238('0x34')](function(){delete _0x3f903d[_0x9238('0x8')][_0x1781f];});}catch(_0x3db5b3){logger[_0x9238('0x30')]('[ACW][START]\x20%s',_0x3db5b3[_0x9238('0x35')]);}};Acw[_0x9238('0x18')][_0x9238('0x27')]=function(_0x4600ac){try{var _0x3b82d4=this;if(_0x3b82d4[_0x9238('0x7')][_0x4600ac]){_0x3b82d4[_0x9238('0x7')][_0x4600ac][_0x9238('0x26')]=![];var _0x3b214d=_0x3b82d4['timers'][_0x4600ac][_0x9238('0x2b')];var _0x444c3d=_0x3b82d4[_0x9238('0x7')][_0x4600ac][_0x9238('0x19')];var _0x12fec9=_0x3b82d4['voiceQueues'][_0x444c3d][_0x9238('0x25')];logger['info'](_0x9238('0x36'),_0x3b214d,_0x4600ac);RpcUser[_0x9238('0x37')](this['agents'][_0x4600ac]);RpcVoiceAgentReport[_0x9238('0x2d')]({'acwtime':_0x12fec9,'agentacw':!![]},_0x3b214d,_0x4600ac)[_0x9238('0x1f')](function(_0x28646d){logger[_0x9238('0x21')](_0x9238('0x2e'),_0x3b214d,_0x12fec9,_0x28646d);})[_0x9238('0x2f')](function(_0x592622){logger['error'](_0x9238('0x31'),_0x3b214d,_0x592622);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x4600ac);if(_0x3b82d4[_0x9238('0x7')]){logger['info'](_0x9238('0x38'),JSON[_0x9238('0x39')](_0x3b82d4[_0x9238('0x7')]));}}}catch(_0x1c24fa){logger[_0x9238('0x30')]('[ACW][STOP]\x20%s',_0x1c24fa['message']);}};Acw[_0x9238('0x18')]['syncAgentConnect']=function(_0x5ba8dd){try{if(this['voiceQueues'][_0x5ba8dd[_0x9238('0x19')]]&&(this[_0x9238('0x5')][_0x5ba8dd[_0x9238('0x19')]][_0x9238('0x3a')]||this[_0x9238('0x5')][_0x5ba8dd[_0x9238('0x19')]]['mandatoryDisposition'])){if(this[_0x9238('0x6')][_0x5ba8dd[_0x9238('0x3b')]]){this[_0x9238('0x8')][_0x5ba8dd[_0x9238('0x2b')]]={'queue':_0x5ba8dd[_0x9238('0x19')],'interface':_0x5ba8dd[_0x9238('0x3b')],'destlinkedid':_0x5ba8dd[_0x9238('0x23')]};}}}catch(_0x383b4e){logger[_0x9238('0x30')]('[ACW][syncAgentConnect]\x20%s',_0x383b4e[_0x9238('0x35')]);}};Acw[_0x9238('0x18')][_0x9238('0x3c')]=function(_0x104728){try{if(this['voiceQueues'][_0x104728[_0x9238('0x19')]]&&(this[_0x9238('0x5')][_0x104728[_0x9238('0x19')]][_0x9238('0x3a')]||this[_0x9238('0x5')][_0x104728[_0x9238('0x19')]][_0x9238('0x3d')])){if(this[_0x9238('0x6')][_0x104728[_0x9238('0x3b')]]){this[_0x9238('0x8')][_0x104728['uniqueid']]={'queue':_0x104728['queue'],'interface':_0x104728['interface']};}}}catch(_0x5c2c4e){logger[_0x9238('0x30')](_0x9238('0x3e'),_0x5c2c4e[_0x9238('0x35')]);}};Acw['prototype'][_0x9238('0xd')]=function(_0x5e71ba){try{if(this[_0x9238('0x8')][_0x5e71ba[_0x9238('0x2b')]]&&_[_0x9238('0x3f')](this[_0x9238('0x8')][_0x5e71ba['uniqueid']][_0x9238('0x40')])){logger[_0x9238('0x21')](_0x9238('0x41'),_0x5e71ba['uniqueid']);this[_0x9238('0x42')](_0x5e71ba[_0x9238('0x2b')]);}else if(this[_0x9238('0x8')][_0x5e71ba[_0x9238('0x43')]]&&_[_0x9238('0x3f')](this[_0x9238('0x8')][_0x5e71ba[_0x9238('0x43')]][_0x9238('0x40')])){logger[_0x9238('0x21')]('[%s][HANGUP:LINKEDID]',_0x5e71ba[_0x9238('0x43')]);this[_0x9238('0x42')](_0x5e71ba[_0x9238('0x43')]);}}catch(_0x48b491){logger['error'](_0x9238('0x44'),_0x48b491[_0x9238('0x35')]);}};Acw['prototype'][_0x9238('0x45')]=function(_0x403d8a){try{if(this['channels'][_0x403d8a[_0x9238('0x2b')]]&&this[_0x9238('0x8')][_0x403d8a[_0x9238('0x2b')]]['attended']){logger[_0x9238('0x21')](_0x9238('0x46'),_0x403d8a[_0x9238('0x2b')]);this['startAcw'](_0x403d8a[_0x9238('0x2b')]);}else if(this['channels'][_0x403d8a['linkedid']]&&this['channels'][_0x403d8a[_0x9238('0x43')]][_0x9238('0x40')]){logger[_0x9238('0x21')](_0x9238('0x47'),_0x403d8a[_0x9238('0x43')]);this[_0x9238('0x42')](_0x403d8a[_0x9238('0x43')]);}}catch(_0x2f8022){logger['error'](_0x9238('0x48'),_0x2f8022['message']);}};Acw['prototype'][_0x9238('0x11')]=function(_0x123ebf){try{if(!_[_0x9238('0x49')](this[_0x9238('0x8')][_0x123ebf[_0x9238('0x4a')]])){this[_0x9238('0x42')](_0x123ebf[_0x9238('0x4a')]);if(this[_0x9238('0x8')][_0x123ebf[_0x9238('0x4b')]]){this[_0x9238('0x8')][_0x123ebf['secondtransfereruniqueid']]['attended']=!![];this['channels'][_0x123ebf[_0x9238('0x4c')]]=this[_0x9238('0x8')][_0x123ebf[_0x9238('0x4b')]];delete this[_0x9238('0x8')][_0x123ebf['secondtransfereruniqueid']];}}else if(!_[_0x9238('0x49')](this[_0x9238('0x8')][_0x123ebf[_0x9238('0x4c')]])){this[_0x9238('0x42')](_0x123ebf['transfertargetuniqueid']);if(this[_0x9238('0x8')][_0x123ebf[_0x9238('0x4d')]]){this[_0x9238('0x8')][_0x123ebf['origtransfereruniqueid']][_0x9238('0x40')]=!![];this[_0x9238('0x8')][_0x123ebf[_0x9238('0x4a')]]=this[_0x9238('0x8')][_0x123ebf[_0x9238('0x4d')]];delete this['channels'][_0x123ebf['origtransfereruniqueid']];}}}catch(_0x4f0504){logger[_0x9238('0x30')](_0x9238('0x4e'),_0x4f0504[_0x9238('0x35')]);}};Acw[_0x9238('0x18')]['syncBlindTransfer']=function(_0x262bb1){try{if(this[_0x9238('0x8')][_0x262bb1[_0x9238('0x4f')]]){logger[_0x9238('0x21')](_0x9238('0x50'),JSON[_0x9238('0x39')](_0x262bb1[_0x9238('0x4f')]));this[_0x9238('0x42')](_0x262bb1[_0x9238('0x4f')]);}else if(this[_0x9238('0x8')][_0x262bb1['transfererlinkedid']]){logger['info'](_0x9238('0x51'),JSON[_0x9238('0x39')](_0x262bb1[_0x9238('0x52')]));this[_0x9238('0x42')](_0x262bb1[_0x9238('0x52')]);}}catch(_0x28b051){logger[_0x9238('0x30')](_0x9238('0x53'),_0x28b051[_0x9238('0x35')]);}};Acw[_0x9238('0x18')][_0x9238('0x54')]=function(_0x264182){try{if(this['voiceQueues'][_0x264182[_0x9238('0x19')]]&&this[_0x9238('0x5')][_0x264182[_0x9238('0x19')]][_0x9238('0x55')]===_0x9238('0x56')){if(this[_0x9238('0x6')][_0x264182[_0x9238('0x3b')]]){logger[_0x9238('0x21')](_0x9238('0x57'),_0x264182[_0x9238('0x2b')],_0x264182[_0x9238('0x3b')],_0x264182[_0x9238('0x19')]);return RpcUser[_0x9238('0x24')](this[_0x9238('0x6')][_0x264182['interface']],'Auto-Pause',_0x264182['uniqueid']);}}}catch(_0x17628d){logger[_0x9238('0x30')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x17628d[_0x9238('0x35')]);}};module[_0x9238('0x58')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 06b7e3a..926309a 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 _0xb085=['Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','port','once','close','connect','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionDeviceStateList','catch','log','asterisk-manager','moment','lodash','../../config/logger','ami','../../config/environment','asterisk','password','keepConnected','Action','promisify','action','error','format','inspect'];(function(_0x12b1a2,_0x269a7f){var _0x17bf43=function(_0x4c0c32){while(--_0x4c0c32){_0x12b1a2['push'](_0x12b1a2['shift']());}};_0x17bf43(++_0x269a7f);}(_0xb085,0x131));var _0x5b08=function(_0x1a9a26,_0x32e742){_0x1a9a26=_0x1a9a26-0x0;var _0x584ac0=_0xb085[_0x1a9a26];return _0x584ac0;};'use strict';var Manager=require(_0x5b08('0x0'));var BPromise=require('bluebird');var moment=require(_0x5b08('0x1'));var util=require('util');var _=require(_0x5b08('0x2'));var logger=require(_0x5b08('0x3'))(_0x5b08('0x4'));var config=require(_0x5b08('0x5'));var ami=new Manager(config[_0x5b08('0x6')]['port'],config[_0x5b08('0x6')]['ip'],config[_0x5b08('0x6')]['username'],config[_0x5b08('0x6')][_0x5b08('0x7')],!![]);ami[_0x5b08('0x8')]();ami[_0x5b08('0x9')]=BPromise[_0x5b08('0xa')](ami[_0x5b08('0xb')]);function error(_0x5c68f6){logger[_0x5b08('0xc')](util[_0x5b08('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x5b08('0x6')]['username'],config['asterisk']['ip'],config[_0x5b08('0x6')]['port'],util[_0x5b08('0xe')](_0x5c68f6,![],null)));}function close(){logger[_0x5b08('0xc')](util['format'](_0x5b08('0xf'),config['asterisk'][_0x5b08('0x10')],config['asterisk']['ip'],config[_0x5b08('0x6')]['port']));}ami[_0x5b08('0x11')]=function(){return function(){return ami[_0x5b08('0x9')]({'action':_0x5b08('0x12')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x5b08('0x9')]({'action':_0x5b08('0x13')});};};ami[_0x5b08('0x14')]=function(){return function(){return ami[_0x5b08('0x9')]({'action':_0x5b08('0x15')});};};ami[_0x5b08('0x16')]=function(){return function(){return ami['Action']({'action':_0x5b08('0x17')});};};ami[_0x5b08('0x18')]=function(){return function(){return ami[_0x5b08('0x9')]({'action':_0x5b08('0x19')});};};function connect(_0x5ab8c3){logger['info'](util['format'](_0x5b08('0x1a'),config['asterisk'][_0x5b08('0x10')],config[_0x5b08('0x6')]['ip'],config[_0x5b08('0x6')][_0x5b08('0x1b')]));ami[_0x5b08('0x1c')](_0x5b08('0xc'),error);ami[_0x5b08('0x1c')](_0x5b08('0x1d'),close);}ami['on'](_0x5b08('0x1e'),connect);ami['on'](_0x5b08('0x1f'),function(_0x20b587){logger[_0x5b08('0x20')](util['format'](_0x5b08('0x21'),config[_0x5b08('0x6')][_0x5b08('0x10')],config[_0x5b08('0x6')]['ip'],config[_0x5b08('0x6')][_0x5b08('0x1b')],util[_0x5b08('0xe')](_0x20b587,![],null)));});ami['on'](_0x5b08('0x22'),function(_0x1fa8e5){logger['info'](util['format'](_0x5b08('0x23'),config[_0x5b08('0x6')][_0x5b08('0x10')],config[_0x5b08('0x6')]['ip'],config[_0x5b08('0x6')]['port']));return BPromise['resolve']()['then'](ami[_0x5b08('0x11')]())[_0x5b08('0x24')](ami[_0x5b08('0x25')]())[_0x5b08('0x24')](ami[_0x5b08('0x14')]())[_0x5b08('0x24')](ami[_0x5b08('0x16')]())[_0x5b08('0x24')](ami[_0x5b08('0x18')]())[_0x5b08('0x26')](function(_0x3c5ffc){console[_0x5b08('0x27')](_0x3c5ffc);});});ami[_0x5b08('0x1c')]('error',error);ami[_0x5b08('0x1c')]('close',close);module['exports']=ami; \ No newline at end of file +var _0x587a=['Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionDeviceStateList','actionQueueSummary','catch','log','asterisk-manager','moment','lodash','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect'];(function(_0x31c077,_0x5d69f6){var _0x20fecd=function(_0x3c8d7e){while(--_0x3c8d7e){_0x31c077['push'](_0x31c077['shift']());}};_0x20fecd(++_0x5d69f6);}(_0x587a,0x190));var _0xa587=function(_0x2fc1f6,_0x51543e){_0x2fc1f6=_0x2fc1f6-0x0;var _0x7a3346=_0x587a[_0x2fc1f6];return _0x7a3346;};'use strict';var Manager=require(_0xa587('0x0'));var BPromise=require('bluebird');var moment=require(_0xa587('0x1'));var util=require('util');var _=require(_0xa587('0x2'));var logger=require(_0xa587('0x3'))(_0xa587('0x4'));var config=require(_0xa587('0x5'));var ami=new Manager(config[_0xa587('0x6')][_0xa587('0x7')],config[_0xa587('0x6')]['ip'],config[_0xa587('0x6')][_0xa587('0x8')],config[_0xa587('0x6')][_0xa587('0x9')],!![]);ami[_0xa587('0xa')]();ami[_0xa587('0xb')]=BPromise[_0xa587('0xc')](ami[_0xa587('0xd')]);function error(_0x2f9e81){logger[_0xa587('0xe')](util[_0xa587('0xf')](_0xa587('0x10'),config[_0xa587('0x6')]['username'],config[_0xa587('0x6')]['ip'],config[_0xa587('0x6')]['port'],util[_0xa587('0x11')](_0x2f9e81,![],null)));}function close(){logger[_0xa587('0xe')](util[_0xa587('0xf')](_0xa587('0x12'),config[_0xa587('0x6')][_0xa587('0x8')],config[_0xa587('0x6')]['ip'],config['asterisk']['port']));}ami[_0xa587('0x13')]=function(){return function(){return ami[_0xa587('0xb')]({'action':_0xa587('0x14')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xa587('0xb')]({'action':_0xa587('0x15')});};};ami[_0xa587('0x16')]=function(){return function(){return ami[_0xa587('0xb')]({'action':_0xa587('0x17')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xa587('0xb')]({'action':'queuesummary'});};};ami[_0xa587('0x18')]=function(){return function(){return ami[_0xa587('0xb')]({'action':_0xa587('0x19')});};};function connect(_0x45cab8){logger[_0xa587('0x1a')](util['format'](_0xa587('0x1b'),config[_0xa587('0x6')][_0xa587('0x8')],config[_0xa587('0x6')]['ip'],config[_0xa587('0x6')][_0xa587('0x7')]));ami[_0xa587('0x1c')](_0xa587('0xe'),error);ami[_0xa587('0x1c')](_0xa587('0x1d'),close);}ami['on']('connect',connect);ami['on'](_0xa587('0x1e'),function(_0x2240ec){logger['info'](util[_0xa587('0xf')](_0xa587('0x1f'),config['asterisk'][_0xa587('0x8')],config[_0xa587('0x6')]['ip'],config['asterisk']['port'],util[_0xa587('0x11')](_0x2240ec,![],null)));});ami['on']('fullybooted',function(_0x19c495){logger[_0xa587('0x1a')](util[_0xa587('0xf')](_0xa587('0x20'),config[_0xa587('0x6')][_0xa587('0x8')],config[_0xa587('0x6')]['ip'],config[_0xa587('0x6')][_0xa587('0x7')]));return BPromise['resolve']()[_0xa587('0x21')](ami[_0xa587('0x13')]())[_0xa587('0x21')](ami[_0xa587('0x22')]())[_0xa587('0x21')](ami[_0xa587('0x16')]())[_0xa587('0x21')](ami[_0xa587('0x23')]())[_0xa587('0x21')](ami[_0xa587('0x18')]())[_0xa587('0x24')](function(_0x2ac485){console[_0xa587('0x25')](_0x2ac485);});});ami['once'](_0xa587('0xe'),error);ami[_0xa587('0x1c')]('close',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 3df7053..7256921 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 _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xda3f,0xec));var _0xfda3=function(_0x22d99d,_0x565a26){_0x22d99d=_0x22d99d-0x0;var _0x2e2b22=_0xda3f[_0x22d99d];return _0x2e2b22;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x36940e,_0x11f338){var _0x3283f2=function(_0x418008){while(--_0x418008){_0x36940e['push'](_0x36940e['shift']());}};_0x3283f2(++_0x11f338);}(_0xb7e7,0x121));var _0x7b7e=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xb7e7[_0x17928f];return _0x500b63;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 84b4d3a..6fd2e36 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb9c=['util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','substring','getQueue','exports'];(function(_0x5b833c,_0x30a20c){var _0x1d2266=function(_0x42d357){while(--_0x42d357){_0x5b833c['push'](_0x5b833c['shift']());}};_0x1d2266(++_0x30a20c);}(_0xcb9c,0x10e));var _0xccb9=function(_0x290a3f,_0x42cea8){_0x290a3f=_0x290a3f-0x0;var _0x3c29f7=_0xcb9c[_0x290a3f];return _0x3c29f7;};'use strict';var util=require(_0xccb9('0x0'));var _=require(_0xccb9('0x1'));var moment=require(_0xccb9('0x2'));function checkNameSurname(_0x391926,_0x4da224,_0x416f70){var _0x5b7afc='';if(!_[_0xccb9('0x3')](_0x4da224)&&_0xccb9('0x4')===typeof _0x4da224){_0x5b7afc+=_0x4da224;}if(!_[_0xccb9('0x3')](_0x416f70)&&_0xccb9('0x4')===typeof _0x416f70){_0x5b7afc+='\x20'+_0x416f70;}if(_0x5b7afc!==''){return _0x5b7afc;}return _0x391926;}function Action(_0x33941f,_0x273e19,_0xdacb7e){this[_0xccb9('0x5')]=_0x33941f;this[_0xccb9('0x6')]=_0xdacb7e||undefined;this[_0xccb9('0x7')]=checkNameSurname(_0x273e19[_0xccb9('0x8')]['phone'],_0x273e19[_0xccb9('0x8')]['firstName'],_0x273e19[_0xccb9('0x8')][_0xccb9('0x9')]);this[_0xccb9('0xa')]=_0x273e19['Contact']['phone'];this[_0xccb9('0xb')]=_0x33941f[_0xccb9('0x7')];this['active']=_0x273e19[_0xccb9('0xc')]||![];this[_0xccb9('0xd')]=_0x33941f['type'];this[_0xccb9('0xe')]=_0x33941f[_0xccb9('0xe')]||0x3;this[_0xccb9('0xf')]=_0x273e19[_0xccb9('0xf')];this[_0xccb9('0x10')]=_0x273e19[_0xccb9('0x10')];this['countcongestionretry']=_0x273e19[_0xccb9('0x11')];this[_0xccb9('0x12')]=_0x273e19['countnoanswerretry'];this[_0xccb9('0x13')]=_0x273e19['countnosuchnumberretry'];this[_0xccb9('0x14')]=_0x273e19[_0xccb9('0x14')];this[_0xccb9('0x15')]=_0x273e19[_0xccb9('0x15')];this[_0xccb9('0x16')]=_0x273e19['countmachineretry'];this[_0xccb9('0x17')]=_0x273e19[_0xccb9('0x17')];this['ContactId']=_0x273e19[_0xccb9('0x18')];this[_0xccb9('0x19')]=_0x273e19[_0xccb9('0x19')];this['UserId']=_0x273e19['UserId'];this[_0xccb9('0x1a')]=_0x273e19[_0xccb9('0x1a')];this[_0xccb9('0x1b')]=_0x273e19[_0xccb9('0x1b')];this[_0xccb9('0x1c')]=_0x273e19['id'];this[_0xccb9('0x1d')]=_0x273e19[_0xccb9('0x8')][_0xccb9('0x1e')]||'';this[_0xccb9('0x1f')]=moment()[_0xccb9('0x20')](_0xccb9('0x21'));this['callback']=_0x273e19[_0xccb9('0x22')];this['callbackuniqueid']=_0x273e19[_0xccb9('0x23')];this['callbackat']=_0x273e19[_0xccb9('0x24')];this[_0xccb9('0x25')]=_0x273e19[_0xccb9('0x25')];this[_0xccb9('0x26')]='';this['originatecalleridname']='';}Action[_0xccb9('0x27')][_0xccb9('0x28')]=function(){return util[_0xccb9('0x20')](_0xccb9('0x29'),this[_0xccb9('0x7')],this['voiceQueue']['dialCutDigit']>0x0?this[_0xccb9('0xa')][_0xccb9('0x2a')](this[_0xccb9('0x5')]['dialCutDigit']):this[_0xccb9('0xa')]);};Action['prototype'][_0xccb9('0x2b')]=function(){return this[_0xccb9('0xb')];};module[_0xccb9('0x2c')]=Action; \ No newline at end of file +var _0x2a00=['CampaignId','ContactFirstName','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','exports','util','moment','string','isNil','voiceQueue','uniqueid','Contact','phone','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x43981b,_0x6db766){var _0x143b46=function(_0x3bbff6){while(--_0x3bbff6){_0x43981b['push'](_0x43981b['shift']());}};_0x143b46(++_0x6db766);}(_0x2a00,0x143));var _0x02a0=function(_0x51ce5f,_0x484b41){_0x51ce5f=_0x51ce5f-0x0;var _0x4cb4d5=_0x2a00[_0x51ce5f];return _0x4cb4d5;};'use strict';var util=require(_0x02a0('0x0'));var _=require('lodash');var moment=require(_0x02a0('0x1'));function checkNameSurname(_0x1fce82,_0x532f07,_0x5aaf68){var _0x50d7a5='';if(!_['isNil'](_0x532f07)&&_0x02a0('0x2')===typeof _0x532f07){_0x50d7a5+=_0x532f07;}if(!_[_0x02a0('0x3')](_0x5aaf68)&&_0x02a0('0x2')===typeof _0x5aaf68){_0x50d7a5+='\x20'+_0x5aaf68;}if(_0x50d7a5!==''){return _0x50d7a5;}return _0x1fce82;}function Action(_0x21558f,_0x19167c,_0x34bdf2){this[_0x02a0('0x4')]=_0x21558f;this[_0x02a0('0x5')]=_0x34bdf2||undefined;this['name']=checkNameSurname(_0x19167c[_0x02a0('0x6')][_0x02a0('0x7')],_0x19167c[_0x02a0('0x6')][_0x02a0('0x8')],_0x19167c[_0x02a0('0x6')][_0x02a0('0x9')]);this[_0x02a0('0xa')]=_0x19167c[_0x02a0('0x6')][_0x02a0('0x7')];this[_0x02a0('0xb')]=_0x21558f[_0x02a0('0xc')];this[_0x02a0('0xd')]=_0x19167c[_0x02a0('0xd')]||![];this[_0x02a0('0xe')]=_0x21558f[_0x02a0('0xe')];this[_0x02a0('0xf')]=_0x21558f[_0x02a0('0xf')]||0x3;this[_0x02a0('0x10')]=_0x19167c['scheduledat'];this[_0x02a0('0x11')]=_0x19167c['countbusyretry'];this[_0x02a0('0x12')]=_0x19167c[_0x02a0('0x12')];this[_0x02a0('0x13')]=_0x19167c[_0x02a0('0x13')];this[_0x02a0('0x14')]=_0x19167c[_0x02a0('0x14')];this[_0x02a0('0x15')]=_0x19167c[_0x02a0('0x15')];this[_0x02a0('0x16')]=_0x19167c['countabandonedretry'];this[_0x02a0('0x17')]=_0x19167c['countmachineretry'];this[_0x02a0('0x18')]=_0x19167c[_0x02a0('0x18')];this[_0x02a0('0x19')]=_0x19167c['ContactId'];this[_0x02a0('0x1a')]=_0x19167c[_0x02a0('0x1a')];this[_0x02a0('0x1b')]=_0x19167c[_0x02a0('0x1b')];this[_0x02a0('0x1c')]=_0x19167c[_0x02a0('0x1c')];this[_0x02a0('0x1d')]=_0x19167c[_0x02a0('0x1d')];this['idHopper']=_0x19167c['id'];this[_0x02a0('0x1e')]=_0x19167c[_0x02a0('0x6')][_0x02a0('0x8')]||'';this[_0x02a0('0x1f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x02a0('0x20')]=_0x19167c[_0x02a0('0x20')];this[_0x02a0('0x21')]=_0x19167c[_0x02a0('0x21')];this[_0x02a0('0x22')]=_0x19167c[_0x02a0('0x22')];this[_0x02a0('0x23')]=_0x19167c[_0x02a0('0x23')];this['originatecalleridnum']='';this[_0x02a0('0x24')]='';}Action[_0x02a0('0x25')][_0x02a0('0x26')]=function(){return util[_0x02a0('0x27')](_0x02a0('0x28'),this['name'],this['voiceQueue'][_0x02a0('0x29')]>0x0?this['number']['substring'](this['voiceQueue'][_0x02a0('0x29')]):this[_0x02a0('0xa')]);};Action['prototype'][_0x02a0('0x2a')]=function(){return this['queue'];};module[_0x02a0('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 655fbc5..a43b1d9 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','membername','reason','callbackuniqueid'];(function(_0x1265ac,_0x130ae8){var _0x340226=function(_0x1c38be){while(--_0x1c38be){_0x1265ac['push'](_0x1265ac['shift']());}};_0x340226(++_0x130ae8);}(_0x2ef3,0xba));var _0x32ef=function(_0xb37e7c,_0x53fffb){_0xb37e7c=_0xb37e7c-0x0;var _0x58d690=_0x2ef3[_0xb37e7c];return _0x58d690;};'use strict';var util=require(_0x32ef('0x0'));var _=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));function getSeconds(_0x26e56e,_0x3944df){var _0x38047b=moment(_0x26e56e)['milliseconds'](0x0);var _0x38f865=moment(_0x3944df)[_0x32ef('0x3')](0x0);return _0x38047b['diff'](_0x38f865,_0x32ef('0x4'));}function AgentComplete(_0x37dd1d,_0x4c8104){this['state']=0x4;this[_0x32ef('0x5')]=_0x32ef('0x6');this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')];this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')];this[_0x32ef('0x9')]=_0x37dd1d[_0x32ef('0x8')]===_0x32ef('0xa')?_0x32ef('0xb'):_0x37dd1d['type'];this['countbusyretry']=_0x37dd1d[_0x32ef('0xc')];this[_0x32ef('0xd')]=_0x37dd1d[_0x32ef('0xd')];this[_0x32ef('0xe')]=_0x37dd1d['countnoanswerretry'];this[_0x32ef('0xf')]=_0x37dd1d['countbusyretry']+_0x37dd1d[_0x32ef('0xd')]+_0x37dd1d['countnoanswerretry']+_0x37dd1d[_0x32ef('0x10')]+_0x37dd1d[_0x32ef('0x11')]+_0x37dd1d['countabandonedretry']+_0x37dd1d['countmachineretry']+_0x37dd1d[_0x32ef('0x12')];this['countnosuchnumberretry']=_0x37dd1d[_0x32ef('0x10')];this[_0x32ef('0x11')]=_0x37dd1d[_0x32ef('0x11')];this[_0x32ef('0x13')]=_0x37dd1d['countabandonedretry'];this['countmachineretry']=_0x37dd1d['countmachineretry'];this[_0x32ef('0x12')]=_0x37dd1d[_0x32ef('0x12')];this[_0x32ef('0x14')]=_0x4c8104['uniqueid'];this['calleridname']=_0x37dd1d[_0x32ef('0x15')];this[_0x32ef('0x16')]=_0x37dd1d[_0x32ef('0x17')];this['starttime']=_0x37dd1d[_0x32ef('0x18')];this[_0x32ef('0x19')]=_0x37dd1d['responsetime'];this[_0x32ef('0x1a')]=_0x37dd1d[_0x32ef('0x1a')];this[_0x32ef('0x1b')]=moment()[_0x32ef('0x1c')](_0x32ef('0x1d'));this[_0x32ef('0x1e')]=getSeconds(_0x37dd1d['responsetime'],_0x37dd1d[_0x32ef('0x18')]);this['holdtime']=getSeconds(_0x37dd1d[_0x32ef('0x1a')],_0x37dd1d[_0x32ef('0x19')]);this['talktime']=getSeconds(this[_0x32ef('0x1b')],_0x37dd1d[_0x32ef('0x1a')]);this[_0x32ef('0xb')]=_0x4c8104['queue'];this['membername']=_0x4c8104[_0x32ef('0x1f')];this[_0x32ef('0x20')]=_0x4c8104[_0x32ef('0x20')];this['callback']=_0x37dd1d['callback'];this[_0x32ef('0x21')]=_0x37dd1d['callbackuniqueid'];this['callbackat']=_0x37dd1d[_0x32ef('0x22')];this[_0x32ef('0x23')]=_0x37dd1d[_0x32ef('0x23')];this[_0x32ef('0x24')]=_0x37dd1d[_0x32ef('0x24')];this[_0x32ef('0x25')]=_0x37dd1d[_0x32ef('0x25')];this[_0x32ef('0x26')]=_0x37dd1d[_0x32ef('0x26')];this[_0x32ef('0x27')]=_0x37dd1d[_0x32ef('0x27')];this[_0x32ef('0x28')]=_0x37dd1d['CampaignId'];this[_0x32ef('0x29')]=_0x37dd1d[_0x32ef('0x29')]||'';this['originatecalleridname']=_0x37dd1d[_0x32ef('0x2a')]||'';}module[_0x32ef('0x2b')]=AgentComplete; \ No newline at end of file +var _0x846d=['countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','answertime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','milliseconds','diff','seconds','state','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0xddccb1,_0x468b7a){var _0x44ad80=function(_0x38ac38){while(--_0x38ac38){_0xddccb1['push'](_0xddccb1['shift']());}};_0x44ad80(++_0x468b7a);}(_0x846d,0x1e4));var _0xd846=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0x846d[_0x1afabf];return _0x497ff1;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x346394,_0x263188){var _0x28ecd0=moment(_0x346394)[_0xd846('0x0')](0x0);var _0x35253d=moment(_0x263188)['milliseconds'](0x0);return _0x28ecd0[_0xd846('0x1')](_0x35253d,_0xd846('0x2'));}function AgentComplete(_0x143622,_0x217956){this[_0xd846('0x3')]=0x4;this['statedesc']='Answer';this[_0xd846('0x4')]=_0x143622[_0xd846('0x4')];this[_0xd846('0x5')]=_0x143622[_0xd846('0x5')];this[_0xd846('0x6')]=_0x143622[_0xd846('0x5')]===_0xd846('0x7')?_0xd846('0x8'):_0x143622['type'];this['countbusyretry']=_0x143622[_0xd846('0x9')];this[_0xd846('0xa')]=_0x143622[_0xd846('0xa')];this[_0xd846('0xb')]=_0x143622[_0xd846('0xb')];this[_0xd846('0xc')]=_0x143622['countbusyretry']+_0x143622[_0xd846('0xa')]+_0x143622['countnoanswerretry']+_0x143622['countnosuchnumberretry']+_0x143622['countdropretry']+_0x143622[_0xd846('0xd')]+_0x143622['countmachineretry']+_0x143622[_0xd846('0xe')];this[_0xd846('0xf')]=_0x143622['countnosuchnumberretry'];this[_0xd846('0x10')]=_0x143622['countdropretry'];this[_0xd846('0xd')]=_0x143622['countabandonedretry'];this[_0xd846('0x11')]=_0x143622[_0xd846('0x11')];this['countagentrejectretry']=_0x143622[_0xd846('0xe')];this[_0xd846('0x12')]=_0x217956[_0xd846('0x12')];this[_0xd846('0x13')]=_0x143622['name'];this[_0xd846('0x14')]=_0x143622[_0xd846('0x15')];this[_0xd846('0x16')]=_0x143622['starttime'];this[_0xd846('0x17')]=_0x143622[_0xd846('0x17')];this['answertime']=_0x143622['answertime'];this[_0xd846('0x18')]=moment()[_0xd846('0x19')](_0xd846('0x1a'));this[_0xd846('0x1b')]=getSeconds(_0x143622[_0xd846('0x17')],_0x143622[_0xd846('0x16')]);this[_0xd846('0x1c')]=getSeconds(_0x143622[_0xd846('0x1d')],_0x143622['responsetime']);this[_0xd846('0x1e')]=getSeconds(this[_0xd846('0x18')],_0x143622[_0xd846('0x1d')]);this[_0xd846('0x8')]=_0x217956[_0xd846('0x8')];this['membername']=_0x217956[_0xd846('0x1f')];this[_0xd846('0x20')]=_0x217956[_0xd846('0x20')];this[_0xd846('0x21')]=_0x143622['callback'];this[_0xd846('0x22')]=_0x143622['callbackuniqueid'];this[_0xd846('0x23')]=_0x143622[_0xd846('0x23')];this[_0xd846('0x24')]=_0x143622[_0xd846('0x24')];this[_0xd846('0x25')]=_0x143622[_0xd846('0x25')];this['ListId']=_0x143622[_0xd846('0x26')];this[_0xd846('0x27')]=_0x143622[_0xd846('0x27')];this[_0xd846('0x28')]=_0x143622[_0xd846('0x28')];this['CampaignId']=_0x143622[_0xd846('0x29')];this[_0xd846('0x2a')]=_0x143622[_0xd846('0x2a')]||'';this[_0xd846('0x2b')]=_0x143622[_0xd846('0x2b')]||'';}module[_0xd846('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index bca41ad..6c7ee61 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa2b=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x3e3046,_0x2bccbc){_0x3e3046=_0x3e3046-0x0;var _0x1a95cb=_0xfa2b[_0x3e3046];return _0x1a95cb;};'use strict';var util=require(_0xbfa2('0x0'));var _=require(_0xbfa2('0x1'));var moment=require(_0xbfa2('0x2'));function getSeconds(_0x9a9b55,_0x237b3e){var _0x41d712=moment(_0x9a9b55)[_0xbfa2('0x3')](0x0);var _0x1103cf=moment(_0x237b3e)[_0xbfa2('0x3')](0x0);return _0x41d712[_0xbfa2('0x4')](_0x1103cf,_0xbfa2('0x5'));}function Final(_0x2e8f3b){this[_0xbfa2('0x6')]=_0x2e8f3b[_0xbfa2('0x6')];this[_0xbfa2('0x7')]=_0x2e8f3b[_0xbfa2('0x7')];this['type']=_0x2e8f3b[_0xbfa2('0x8')];this['campaigntype']=_0x2e8f3b[_0xbfa2('0x8')]===_0xbfa2('0x9')?_0xbfa2('0xa'):_0x2e8f3b[_0xbfa2('0x8')];this[_0xbfa2('0xb')]=_0x2e8f3b[_0xbfa2('0xb')];this[_0xbfa2('0xc')]=_0x2e8f3b[_0xbfa2('0xc')];this[_0xbfa2('0xd')]=_0x2e8f3b['countnoanswerretry'];this['countglobal']=_0x2e8f3b['countbusyretry']+_0x2e8f3b[_0xbfa2('0xc')]+_0x2e8f3b[_0xbfa2('0xd')]+_0x2e8f3b[_0xbfa2('0xe')]+_0x2e8f3b[_0xbfa2('0xf')]+_0x2e8f3b[_0xbfa2('0x10')]+_0x2e8f3b[_0xbfa2('0x11')]+_0x2e8f3b['countagentrejectretry'];this[_0xbfa2('0xe')]=_0x2e8f3b[_0xbfa2('0xe')];this[_0xbfa2('0xf')]=_0x2e8f3b[_0xbfa2('0xf')];this[_0xbfa2('0x10')]=_0x2e8f3b['countabandonedretry'];this[_0xbfa2('0x11')]=_0x2e8f3b['countmachineretry'];this['countagentrejectretry']=_0x2e8f3b[_0xbfa2('0x12')];this['queue']=_0x2e8f3b['queue'];this[_0xbfa2('0x13')]=_0x2e8f3b[_0xbfa2('0x13')];this['calleridnum']=_0x2e8f3b[_0xbfa2('0x14')];this[_0xbfa2('0x15')]=_0x2e8f3b[_0xbfa2('0x15')];this[_0xbfa2('0x16')]=_0x2e8f3b[_0xbfa2('0x16')];this[_0xbfa2('0x17')]=_0x2e8f3b[_0xbfa2('0x16')];this['ringtime']=_0x2e8f3b[_0xbfa2('0x18')]||0x0;this[_0xbfa2('0x19')]=_0x2e8f3b[_0xbfa2('0x19')]||0x0;this['talktime']=_0x2e8f3b[_0xbfa2('0x1a')]||0x0;this[_0xbfa2('0x1b')]=_0x2e8f3b['callback'];this[_0xbfa2('0x1c')]=_0x2e8f3b['callbackuniqueid'];this['callbackat']=_0x2e8f3b[_0xbfa2('0x1d')];this[_0xbfa2('0x1e')]=_0x2e8f3b[_0xbfa2('0x1e')];this[_0xbfa2('0x1f')]=_0x2e8f3b['ContactId'];this['ListId']=_0x2e8f3b[_0xbfa2('0x20')];this[_0xbfa2('0x21')]=_0x2e8f3b['UserId'];this[_0xbfa2('0x22')]=_0x2e8f3b['VoiceQueueId'];this[_0xbfa2('0x23')]=_0x2e8f3b['CampaignId'];this[_0xbfa2('0x24')]=_0x2e8f3b[_0xbfa2('0x24')]||'';this[_0xbfa2('0x25')]=_0x2e8f3b[_0xbfa2('0x25')]||'';}module[_0xbfa2('0x26')]=Final; \ No newline at end of file +var _0x9009=['countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound'];(function(_0x56f274,_0x5c8379){var _0x10ddda=function(_0x44f1ab){while(--_0x44f1ab){_0x56f274['push'](_0x56f274['shift']());}};_0x10ddda(++_0x5c8379);}(_0x9009,0x1d4));var _0x9900=function(_0x50ebf5,_0x18b102){_0x50ebf5=_0x50ebf5-0x0;var _0x26986e=_0x9009[_0x50ebf5];return _0x26986e;};'use strict';var util=require(_0x9900('0x0'));var _=require('lodash');var moment=require(_0x9900('0x1'));function getSeconds(_0x2770ea,_0x5d0a60){var _0x12d637=moment(_0x2770ea)[_0x9900('0x2')](0x0);var _0x1f7ed9=moment(_0x5d0a60)[_0x9900('0x2')](0x0);return _0x12d637['diff'](_0x1f7ed9,_0x9900('0x3'));}function Final(_0x273e50){this['uniqueid']=_0x273e50['uniqueid'];this[_0x9900('0x4')]=_0x273e50[_0x9900('0x4')];this['type']=_0x273e50[_0x9900('0x5')];this[_0x9900('0x6')]=_0x273e50[_0x9900('0x5')]===_0x9900('0x7')?'queue':_0x273e50[_0x9900('0x5')];this[_0x9900('0x8')]=_0x273e50[_0x9900('0x8')];this[_0x9900('0x9')]=_0x273e50[_0x9900('0x9')];this['countnoanswerretry']=_0x273e50['countnoanswerretry'];this[_0x9900('0xa')]=_0x273e50[_0x9900('0x8')]+_0x273e50['countcongestionretry']+_0x273e50['countnoanswerretry']+_0x273e50[_0x9900('0xb')]+_0x273e50['countdropretry']+_0x273e50[_0x9900('0xc')]+_0x273e50[_0x9900('0xd')]+_0x273e50[_0x9900('0xe')];this[_0x9900('0xb')]=_0x273e50[_0x9900('0xb')];this[_0x9900('0xf')]=_0x273e50[_0x9900('0xf')];this[_0x9900('0xc')]=_0x273e50[_0x9900('0xc')];this[_0x9900('0xd')]=_0x273e50[_0x9900('0xd')];this[_0x9900('0xe')]=_0x273e50[_0x9900('0xe')];this[_0x9900('0x10')]=_0x273e50[_0x9900('0x10')];this[_0x9900('0x11')]=_0x273e50[_0x9900('0x11')];this['calleridnum']=_0x273e50['calleridnum'];this[_0x9900('0x12')]=_0x273e50[_0x9900('0x12')];this[_0x9900('0x13')]=_0x273e50[_0x9900('0x13')];this['endtime']=_0x273e50[_0x9900('0x13')];this['ringtime']=_0x273e50['ringtime']||0x0;this[_0x9900('0x14')]=_0x273e50['holdtime']||0x0;this[_0x9900('0x15')]=_0x273e50['talktime']||0x0;this['callback']=_0x273e50[_0x9900('0x16')];this[_0x9900('0x17')]=_0x273e50[_0x9900('0x17')];this[_0x9900('0x18')]=_0x273e50['callbackat'];this[_0x9900('0x19')]=_0x273e50[_0x9900('0x19')];this[_0x9900('0x1a')]=_0x273e50[_0x9900('0x1a')];this[_0x9900('0x1b')]=_0x273e50['ListId'];this[_0x9900('0x1c')]=_0x273e50[_0x9900('0x1c')];this['VoiceQueueId']=_0x273e50[_0x9900('0x1d')];this[_0x9900('0x1e')]=_0x273e50['CampaignId'];this['originatecalleridnum']=_0x273e50[_0x9900('0x1f')]||'';this[_0x9900('0x20')]=_0x273e50['originatecalleridname']||'';}module[_0x9900('0x21')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 10ae370..dad1d7f 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd29d=['ListId','UserId','VoiceQueueId','CampaignId','exports','util','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x22d114,_0x2d249b){var _0x17c386=function(_0x398906){while(--_0x398906){_0x22d114['push'](_0x22d114['shift']());}};_0x17c386(++_0x2d249b);}(_0xd29d,0x1a3));var _0xdd29=function(_0x426bda,_0x31174a){_0x426bda=_0x426bda-0x0;var _0x3e143e=_0xd29d[_0x426bda];return _0x3e143e;};'use strict';var util=require(_0xdd29('0x0'));var _=require('lodash');var moment=require(_0xdd29('0x1'));function getSeconds(_0x327317,_0x1d8999){var _0x3076f4=moment(_0x327317)[_0xdd29('0x2')](0x0);var _0xbdcd34=moment(_0x1d8999)[_0xdd29('0x2')](0x0);return _0x3076f4[_0xdd29('0x3')](_0xbdcd34,'seconds');}function Hangup(_0xea61e,_0x5a2985){this[_0xdd29('0x4')]=0x4;this[_0xdd29('0x5')]=_0xdd29('0x6');this['scheduledat']=_0xea61e[_0xdd29('0x7')];this[_0xdd29('0x8')]=_0xea61e[_0xdd29('0x8')];this['campaigntype']=_0xea61e[_0xdd29('0x8')]===_0xdd29('0x9')?_0xdd29('0xa'):_0xea61e[_0xdd29('0x8')];this[_0xdd29('0xb')]=_0xea61e['countbusyretry'];this[_0xdd29('0xc')]=_0xea61e[_0xdd29('0xc')];this[_0xdd29('0xd')]=_0xea61e[_0xdd29('0xd')];this[_0xdd29('0xe')]=_0xea61e[_0xdd29('0xb')]+_0xea61e[_0xdd29('0xc')]+_0xea61e[_0xdd29('0xd')]+_0xea61e['countnosuchnumberretry']+_0xea61e['countdropretry']+_0xea61e['countabandonedretry']+_0xea61e[_0xdd29('0xf')]+_0xea61e[_0xdd29('0x10')];this[_0xdd29('0x11')]=_0xea61e[_0xdd29('0x11')];this[_0xdd29('0x12')]=_0xea61e[_0xdd29('0x12')];this[_0xdd29('0x13')]=_0xea61e[_0xdd29('0x13')];this['countmachineretry']=_0xea61e[_0xdd29('0xf')];this[_0xdd29('0x10')]=_0xea61e[_0xdd29('0x10')];this[_0xdd29('0x14')]=_0x5a2985[_0xdd29('0x14')];this[_0xdd29('0x15')]=_0xea61e[_0xdd29('0x16')];this['calleridnum']=_0xea61e[_0xdd29('0x17')];this[_0xdd29('0x18')]=_0xea61e[_0xdd29('0x18')];this[_0xdd29('0x19')]=_0xea61e['responsetime'];this[_0xdd29('0x1a')]=moment()[_0xdd29('0x1b')](_0xdd29('0x1c'));this[_0xdd29('0x1d')]=getSeconds(_0xea61e[_0xdd29('0x19')],_0xea61e[_0xdd29('0x18')]);this[_0xdd29('0x1e')]=0x0;this[_0xdd29('0x1f')]=getSeconds(this[_0xdd29('0x1a')],_0xea61e[_0xdd29('0x19')]);this[_0xdd29('0xa')]=_0xea61e[_0xdd29('0xa')];this[_0xdd29('0x20')]=_0xdd29('0x21');this[_0xdd29('0x22')]=_0x5a2985[_0xdd29('0x23')];this[_0xdd29('0x24')]=_0xea61e[_0xdd29('0x24')];this[_0xdd29('0x25')]=_0xea61e['callbackuniqueid'];this['callbackat']=_0xea61e[_0xdd29('0x26')];this[_0xdd29('0x27')]=_0xea61e['recallme'];this[_0xdd29('0x28')]=_0xea61e[_0xdd29('0x28')];this[_0xdd29('0x29')]=_0xea61e[_0xdd29('0x29')];this[_0xdd29('0x2a')]=_0xea61e[_0xdd29('0x2a')];this[_0xdd29('0x2b')]=_0xea61e[_0xdd29('0x2b')];this[_0xdd29('0x2c')]=_0xea61e[_0xdd29('0x2c')];}module[_0xdd29('0x2d')]=Hangup; \ No newline at end of file +var _0x27fa=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','holdtime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','seconds','statedesc','Answer','scheduledat','type','outbound','queue'];(function(_0x34c201,_0x3439f6){var _0x3e3d98=function(_0x2156b1){while(--_0x2156b1){_0x34c201['push'](_0x34c201['shift']());}};_0x3e3d98(++_0x3439f6);}(_0x27fa,0xc2));var _0xa27f=function(_0x260e06,_0xf5d231){_0x260e06=_0x260e06-0x0;var _0x65e2aa=_0x27fa[_0x260e06];return _0x65e2aa;};'use strict';var util=require(_0xa27f('0x0'));var _=require(_0xa27f('0x1'));var moment=require(_0xa27f('0x2'));function getSeconds(_0x4c067f,_0x5716bd){var _0x4398b3=moment(_0x4c067f)[_0xa27f('0x3')](0x0);var _0x49eb71=moment(_0x5716bd)[_0xa27f('0x3')](0x0);return _0x4398b3['diff'](_0x49eb71,_0xa27f('0x4'));}function Hangup(_0x10e73a,_0x5919c3){this['state']=0x4;this[_0xa27f('0x5')]=_0xa27f('0x6');this[_0xa27f('0x7')]=_0x10e73a['scheduledat'];this[_0xa27f('0x8')]=_0x10e73a[_0xa27f('0x8')];this['campaigntype']=_0x10e73a['type']===_0xa27f('0x9')?_0xa27f('0xa'):_0x10e73a['type'];this['countbusyretry']=_0x10e73a[_0xa27f('0xb')];this[_0xa27f('0xc')]=_0x10e73a[_0xa27f('0xc')];this[_0xa27f('0xd')]=_0x10e73a['countnoanswerretry'];this[_0xa27f('0xe')]=_0x10e73a[_0xa27f('0xb')]+_0x10e73a['countcongestionretry']+_0x10e73a[_0xa27f('0xd')]+_0x10e73a[_0xa27f('0xf')]+_0x10e73a['countdropretry']+_0x10e73a[_0xa27f('0x10')]+_0x10e73a[_0xa27f('0x11')]+_0x10e73a[_0xa27f('0x12')];this['countnosuchnumberretry']=_0x10e73a[_0xa27f('0xf')];this[_0xa27f('0x13')]=_0x10e73a[_0xa27f('0x13')];this[_0xa27f('0x10')]=_0x10e73a[_0xa27f('0x10')];this[_0xa27f('0x11')]=_0x10e73a['countmachineretry'];this[_0xa27f('0x12')]=_0x10e73a[_0xa27f('0x12')];this[_0xa27f('0x14')]=_0x5919c3[_0xa27f('0x14')];this[_0xa27f('0x15')]=_0x10e73a['name'];this[_0xa27f('0x16')]=_0x10e73a[_0xa27f('0x17')];this[_0xa27f('0x18')]=_0x10e73a['starttime'];this[_0xa27f('0x19')]=_0x10e73a[_0xa27f('0x19')];this[_0xa27f('0x1a')]=moment()['format'](_0xa27f('0x1b'));this['ringtime']=getSeconds(_0x10e73a['responsetime'],_0x10e73a[_0xa27f('0x18')]);this[_0xa27f('0x1c')]=0x0;this['talktime']=getSeconds(this[_0xa27f('0x1a')],_0x10e73a[_0xa27f('0x19')]);this[_0xa27f('0xa')]=_0x10e73a['queue'];this['membername']=_0xa27f('0x1d');this[_0xa27f('0x1e')]=_0x5919c3[_0xa27f('0x1f')];this[_0xa27f('0x20')]=_0x10e73a[_0xa27f('0x20')];this[_0xa27f('0x21')]=_0x10e73a[_0xa27f('0x21')];this[_0xa27f('0x22')]=_0x10e73a['callbackat'];this[_0xa27f('0x23')]=_0x10e73a[_0xa27f('0x23')];this['ContactId']=_0x10e73a[_0xa27f('0x24')];this[_0xa27f('0x25')]=_0x10e73a[_0xa27f('0x25')];this[_0xa27f('0x26')]=_0x10e73a[_0xa27f('0x26')];this['VoiceQueueId']=_0x10e73a[_0xa27f('0x27')];this[_0xa27f('0x28')]=_0x10e73a[_0xa27f('0x28')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 8a5de35..396cfe3 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6107=['endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname','name','number','responsetime'];(function(_0x28fbe3,_0x4ac6f8){var _0x45db6a=function(_0x296ecb){while(--_0x296ecb){_0x28fbe3['push'](_0x28fbe3['shift']());}};_0x45db6a(++_0x4ac6f8);}(_0x6107,0x12f));var _0x7610=function(_0x342642,_0x3c65ca){_0x342642=_0x342642-0x0;var _0x22c2ed=_0x6107[_0x342642];return _0x22c2ed;};'use strict';var util=require(_0x7610('0x0'));var _=require(_0x7610('0x1'));var moment=require(_0x7610('0x2'));function getSeconds(_0x5f4318,_0x40647f){var _0x4c9575=moment(_0x5f4318)['milliseconds'](0x0);var _0x8c00a4=moment(_0x40647f)[_0x7610('0x3')](0x0);return _0x4c9575[_0x7610('0x4')](_0x8c00a4,_0x7610('0x5'));}function History(_0x3648f6){this[_0x7610('0x6')]=_0x3648f6[_0x7610('0x6')];this[_0x7610('0x7')]=_0x3648f6[_0x7610('0x7')]||undefined;this[_0x7610('0x8')]=_0x3648f6[_0x7610('0x8')];this[_0x7610('0x9')]=_0x3648f6[_0x7610('0x8')]===_0x7610('0xa')?_0x7610('0xb'):_0x3648f6[_0x7610('0x8')];this[_0x7610('0xc')]=_0x3648f6[_0x7610('0xc')];this['countcongestionretry']=_0x3648f6['countcongestionretry'];this['countnoanswerretry']=_0x3648f6[_0x7610('0xd')];this[_0x7610('0xe')]=_0x3648f6[_0x7610('0xc')]+_0x3648f6[_0x7610('0xf')]+_0x3648f6['countnoanswerretry']+_0x3648f6['countnosuchnumberretry']+_0x3648f6['countdropretry']+_0x3648f6[_0x7610('0x10')]+_0x3648f6[_0x7610('0x11')]+_0x3648f6[_0x7610('0x12')];this[_0x7610('0x13')]=_0x3648f6[_0x7610('0x13')];this[_0x7610('0x14')]=_0x3648f6['countdropretry'];this[_0x7610('0x10')]=_0x3648f6['countabandonedretry'];this[_0x7610('0x11')]=_0x3648f6[_0x7610('0x11')];this[_0x7610('0x12')]=_0x3648f6[_0x7610('0x12')];this[_0x7610('0xb')]=_0x3648f6[_0x7610('0xb')];this[_0x7610('0x15')]=_0x3648f6[_0x7610('0x16')];this['calleridnum']=_0x3648f6[_0x7610('0x17')];this['starttime']=_0x3648f6['starttime'];this[_0x7610('0x18')]=_0x3648f6[_0x7610('0x18')];this[_0x7610('0x19')]=_0x3648f6[_0x7610('0x18')];this[_0x7610('0x1a')]=getSeconds(_0x3648f6[_0x7610('0x18')],_0x3648f6['starttime']);this[_0x7610('0x1b')]=0x0;this[_0x7610('0x1c')]=0x0;this[_0x7610('0x1d')]=_0x3648f6[_0x7610('0x1d')];this[_0x7610('0x1e')]=_0x3648f6['callbackuniqueid'];this[_0x7610('0x1f')]=_0x3648f6[_0x7610('0x1f')];this[_0x7610('0x20')]=_0x3648f6[_0x7610('0x20')];this[_0x7610('0x21')]=_0x3648f6[_0x7610('0x21')];this[_0x7610('0x22')]=_0x3648f6[_0x7610('0x22')];this[_0x7610('0x23')]=_0x3648f6[_0x7610('0x23')];this[_0x7610('0x24')]=_0x3648f6[_0x7610('0x24')];this[_0x7610('0x25')]=_0x3648f6[_0x7610('0x25')];this[_0x7610('0x26')]=_0x3648f6[_0x7610('0x26')]||'';this['originatecalleridname']=_0x3648f6[_0x7610('0x27')]||'';}module[_0x7610('0x28')]=History; \ No newline at end of file +var _0x610a=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x19311a,_0x2d2679){var _0x42617c=function(_0x43227d){while(--_0x43227d){_0x19311a['push'](_0x19311a['shift']());}};_0x42617c(++_0x2d2679);}(_0x610a,0x109));var _0xa610=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x610a[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xa610('0x0'));var _=require(_0xa610('0x1'));var moment=require('moment');function getSeconds(_0x1912ce,_0x2e1523){var _0x243454=moment(_0x1912ce)[_0xa610('0x2')](0x0);var _0x131c00=moment(_0x2e1523)[_0xa610('0x2')](0x0);return _0x243454['diff'](_0x131c00,'seconds');}function History(_0xae3c33){this[_0xa610('0x3')]=_0xae3c33[_0xa610('0x3')];this[_0xa610('0x4')]=_0xae3c33[_0xa610('0x4')]||undefined;this[_0xa610('0x5')]=_0xae3c33[_0xa610('0x5')];this[_0xa610('0x6')]=_0xae3c33[_0xa610('0x5')]==='outbound'?_0xa610('0x7'):_0xae3c33['type'];this[_0xa610('0x8')]=_0xae3c33[_0xa610('0x8')];this[_0xa610('0x9')]=_0xae3c33['countcongestionretry'];this[_0xa610('0xa')]=_0xae3c33['countnoanswerretry'];this['countglobal']=_0xae3c33[_0xa610('0x8')]+_0xae3c33[_0xa610('0x9')]+_0xae3c33[_0xa610('0xa')]+_0xae3c33[_0xa610('0xb')]+_0xae3c33[_0xa610('0xc')]+_0xae3c33[_0xa610('0xd')]+_0xae3c33[_0xa610('0xe')]+_0xae3c33[_0xa610('0xf')];this[_0xa610('0xb')]=_0xae3c33[_0xa610('0xb')];this[_0xa610('0xc')]=_0xae3c33[_0xa610('0xc')];this['countabandonedretry']=_0xae3c33[_0xa610('0xd')];this[_0xa610('0xe')]=_0xae3c33[_0xa610('0xe')];this[_0xa610('0xf')]=_0xae3c33[_0xa610('0xf')];this[_0xa610('0x7')]=_0xae3c33[_0xa610('0x7')];this['calleridname']=_0xae3c33[_0xa610('0x10')];this[_0xa610('0x11')]=_0xae3c33[_0xa610('0x12')];this[_0xa610('0x13')]=_0xae3c33[_0xa610('0x13')];this[_0xa610('0x14')]=_0xae3c33['responsetime'];this[_0xa610('0x15')]=_0xae3c33[_0xa610('0x14')];this[_0xa610('0x16')]=getSeconds(_0xae3c33['responsetime'],_0xae3c33[_0xa610('0x13')]);this[_0xa610('0x17')]=0x0;this[_0xa610('0x18')]=0x0;this['callback']=_0xae3c33[_0xa610('0x19')];this[_0xa610('0x1a')]=_0xae3c33[_0xa610('0x1a')];this[_0xa610('0x1b')]=_0xae3c33[_0xa610('0x1b')];this[_0xa610('0x1c')]=_0xae3c33[_0xa610('0x1c')];this[_0xa610('0x1d')]=_0xae3c33[_0xa610('0x1d')];this[_0xa610('0x1e')]=_0xae3c33[_0xa610('0x1e')];this[_0xa610('0x1f')]=_0xae3c33[_0xa610('0x1f')];this['VoiceQueueId']=_0xae3c33[_0xa610('0x20')];this['CampaignId']=_0xae3c33[_0xa610('0x21')];this['originatecalleridnum']=_0xae3c33[_0xa610('0x22')]||'';this[_0xa610('0x23')]=_0xae3c33['originatecalleridname']||'';}module[_0xa610('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index e103069..f886ce4 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 _0xaf1d=['XMD-CAMPAIGNID','createdAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','responsetime','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','outboundBusyCallsDay','Busy','busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','talking','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','busyFactor','[CatchErlangB]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','reachable','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncQueueSummary','syncHangup','newexten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','\x20INTERVAL_IS_NULL','Interval','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','seconds','type','outbound','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','info','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','diff','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22\x22\x20<>','error','inspect','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','RESCHEDULED_CONTACTS','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','pTalking','available','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','undefined','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','then','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','statedesc','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','countmachineretry','countglobal','emit','[syncAgentComplete][createHistory][0]','countbusyretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countcongestionretry','countnoanswerretry','countabandonedretry','countagentrejectretry','add','[rescheduleContact][Machine]','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','countdropretry','dialDropMaxRetry','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','strategy','actionid','locked','paused','stateinterface','push','pick','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Intervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','predictive','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','[syncQueueSummary]','dialTimezone','[syncCampaigns]','pow','replace','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','ACTIVE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDMaximumWordLength'];(function(_0x196cc6,_0x3d68ee){var _0x4b82b1=function(_0x540d29){while(--_0x540d29){_0x196cc6['push'](_0x196cc6['shift']());}};_0x4b82b1(++_0x3d68ee);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x332666,_0x202a56){_0x332666=_0x332666-0x0;var _0x17b41a=_0xaf1d[_0x332666];return _0x17b41a;};'use strict';var util=require(_0xdaf1('0x0'));var _=require(_0xdaf1('0x1'));var BPromise=require(_0xdaf1('0x2'));var uuid=require(_0xdaf1('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0xdaf1('0x4'));var Redis=require(_0xdaf1('0x5'));var ut=require('../preview/util/util');var config=require(_0xdaf1('0x6'));var logger=require(_0xdaf1('0x7'))(_0xdaf1('0x8'));var loggerBooked=require(_0xdaf1('0x7'))(_0xdaf1('0x9'));var loggerPredictive=require(_0xdaf1('0x7'))('predictive');var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0xdaf1('0x7'))('syncQueueSummary');var ami=require('../ami');config[_0xdaf1('0xa')]=_[_0xdaf1('0xb')](config[_0xdaf1('0xa')],{'host':_0xdaf1('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdaf1('0xa')]));var cmHopper=require(_0xdaf1('0xd'));var cmHopperHistory=require(_0xdaf1('0xe'));var cmHopperBlack=require(_0xdaf1('0xf'));var voiceQueueRt=require(_0xdaf1('0x10'));var Action=require('./action');var History=require(_0xdaf1('0x11'));var Final=require(_0xdaf1('0x12'));var AgentComplete=require(_0xdaf1('0x13'));var QueueCallerAbandon=require(_0xdaf1('0x14'));var Hangup=require(_0xdaf1('0x15'));var ipAgi=process[_0xdaf1('0x16')][_0xdaf1('0x17')]||_0xdaf1('0x18');var strategy={'rrmemory':_0xdaf1('0x19'),'roundrobin':_0xdaf1('0x1a')};var Sequence=function(){};Sequence[_0xdaf1('0x1b')][_0xdaf1('0x1c')]=function(_0x225590){this['tail']=this[_0xdaf1('0x1d')]?this[_0xdaf1('0x1d')]['finally'](_0x225590):_0x225590();};function Dialer(_0x179264,_0x54c363){this[_0xdaf1('0x1e')]=new Sequence();this[_0xdaf1('0x1f')]=_0x54c363;this[_0xdaf1('0x20')]=_0x179264['voiceQueues'];this[_0xdaf1('0x21')]=_0x179264['campaigns'];this['agents']=_0x179264[_0xdaf1('0x22')];this[_0xdaf1('0x23')]=_0x179264[_0xdaf1('0x23')];this[_0xdaf1('0x24')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0xdaf1('0x25')]={};this[_0xdaf1('0x26')]={};this[_0xdaf1('0x27')]={};this['optionPredictive']={};this[_0xdaf1('0x28')]={};this[_0xdaf1('0x29')]={};this[_0xdaf1('0x2a')]={};this[_0xdaf1('0x2b')]={};this[_0xdaf1('0x2c')]={};ami['on'](_0xdaf1('0x2d'),this[_0xdaf1('0x2e')][_0xdaf1('0x2f')](this));ami['on'](_0xdaf1('0x30'),this[_0xdaf1('0x31')]['bind'](this));ami['on'](_0xdaf1('0x32'),this[_0xdaf1('0x33')][_0xdaf1('0x2f')](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on']('custom:queuesummary',this[_0xdaf1('0x34')][_0xdaf1('0x2f')](this));ami['on']('hangup',this[_0xdaf1('0x35')][_0xdaf1('0x2f')](this));ami['on'](_0xdaf1('0x36'),this['syncNewExten'][_0xdaf1('0x2f')](this));ami['on'](_0xdaf1('0x37'),this['syncVarSet'][_0xdaf1('0x2f')](this));ami['on'](_0xdaf1('0x38'),this[_0xdaf1('0x39')][_0xdaf1('0x2f')](this));ami['on'](_0xdaf1('0x3a'),this[_0xdaf1('0x3b')]['bind'](this));this[_0xdaf1('0x3c')]();this[_0xdaf1('0x3d')]();}function isNotNull(_0x49a2d5){return _0x49a2d5!==null&&!_['isUndefined'](_0x49a2d5);}function checkIsLoggedIn(_0x3aba8e,_0x31cf7d){return function(){if(_0x31cf7d<=0x0){_0x3aba8e[_0xdaf1('0x3e')]='AGENTS_NOT_LOGGED';throw _0x3aba8e[_0xdaf1('0x3f')]+_0xdaf1('0x40');}};}function isActive(_0xa3f4a9){return _0xa3f4a9;}function checkIsActive(_0x415a28,_0x476317){return function(){if(!isActive(_0x476317)){_0x415a28['message']=_0xdaf1('0x41');throw _0x415a28[_0xdaf1('0x3f')]+_0xdaf1('0x42');}};}function checkInterval(_0x568ca2){return function(){if(!isNotNull(_0x568ca2['Interval'])){_0x568ca2[_0xdaf1('0x3e')]='INTERVAL_IS_NULL';throw _0x568ca2[_0xdaf1('0x3f')]+_0xdaf1('0x43');}if(!isNotNull(_0x568ca2[_0xdaf1('0x44')]['Intervals'])){_0x568ca2[_0xdaf1('0x3e')]=_0xdaf1('0x45');throw _0x568ca2['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xdaf1('0x46')](_0x568ca2[_0xdaf1('0x44')]['Intervals']))){_0x568ca2[_0xdaf1('0x3e')]=_0xdaf1('0x45');throw _0x568ca2[_0xdaf1('0x3f')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x41f54e,_0x10138c,_0x213c85){return{'action':_0x41f54e,'response':_0x10138c,'message':_0x213c85,'stack':_0x213c85};}function myreject(_0x118e31){return function(_0x4d804d){return _0x118e31(msgResponse(_0xdaf1('0x47'),_0xdaf1('0x48'),JSON[_0xdaf1('0x49')](_0x4d804d)));};}function getSeconds(_0x7d6d33,_0x45463f){var _0x58429d=moment(_0x7d6d33)[_0xdaf1('0x4a')](0x0);var _0x20dee8=moment(_0x45463f)[_0xdaf1('0x4a')](0x0);return _0x58429d['diff'](_0x20dee8,_0xdaf1('0x4b'));}function emit(_0x48d244,_0x38f534,_0x25c67f){io['to'](_0x48d244)['emit'](_0x38f534,_0x25c67f);}function emitVoiceQueueSummary(_0x11041f){if(_0x11041f[_0xdaf1('0x4c')]===_0xdaf1('0x4d')){var _0x2e7414={'id':_0x11041f['id'],'name':_0x11041f[_0xdaf1('0x3f')],'strategy':_0x11041f['strategy'],'answered':_0x11041f[_0xdaf1('0x4e')],'available':_0x11041f['available'],'loggedIn':_0x11041f[_0xdaf1('0x4f')],'pTalking':_0x11041f['pTalking'],'sumBillable':_0x11041f[_0xdaf1('0x50')],'sumDuration':_0x11041f[_0xdaf1('0x51')],'sumHoldTime':_0x11041f[_0xdaf1('0x52')]||0x0,'talking':_0x11041f['talking'],'total':_0x11041f[_0xdaf1('0x53')],'type':_0x11041f[_0xdaf1('0x4c')],'unmanaged':_0x11041f[_0xdaf1('0x54')],'abandoned':_0x11041f[_0xdaf1('0x55')],'waiting':_0x11041f[_0xdaf1('0x56')],'loggedInDb':_0x11041f[_0xdaf1('0x57')],'dialActive':_0x11041f[_0xdaf1('0x58')],'dialMethod':_0x11041f[_0xdaf1('0x59')],'dialOriginateCallerIdName':_0x11041f[_0xdaf1('0x5a')],'dialOriginateCallerIdNumber':_0x11041f[_0xdaf1('0x5b')],'dialOriginateTimeout':_0x11041f[_0xdaf1('0x5c')],'dialPrefix':_0x11041f['dialPrefix'],'outboundAnswerAgiCallsDay':_0x11041f['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x11041f['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x11041f[_0xdaf1('0x5d')],'outboundBusyCallsDay':_0x11041f['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x11041f['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x11041f[_0xdaf1('0x5e')],'outboundDropCallsDayCallersExit':_0x11041f[_0xdaf1('0x5f')],'outboundDropCallsDayTimeout':_0x11041f[_0xdaf1('0x60')],'outboundNoAnswerCallsDay':_0x11041f['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x11041f['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x11041f[_0xdaf1('0x61')],'outboundReCallsDay':_0x11041f[_0xdaf1('0x62')],'outboundRejectCallsDay':_0x11041f[_0xdaf1('0x63')],'outboundUnknownCallsDay':_0x11041f['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x11041f[_0xdaf1('0x64')],'predictiveIntervalAvgHoldtime':_0x11041f['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x11041f[_0xdaf1('0x65')],'predictiveIntervalDroppedCallsCallersExit':_0x11041f[_0xdaf1('0x66')],'predictiveIntervalDroppedCallsTimeout':_0x11041f[_0xdaf1('0x67')],'predictiveIntervalErlangCalls':_0x11041f[_0xdaf1('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x11041f[_0xdaf1('0x69')],'predictiveIntervalHitRate':_0x11041f[_0xdaf1('0x6a')],'predictiveIntervalMultiplicativeFactor':_0x11041f[_0xdaf1('0x6b')],'predictiveIntervalPauses':_0x11041f[_0xdaf1('0x6c')],'predictiveIntervalAvailable':_0x11041f[_0xdaf1('0x6d')],'predictiveIntervalTotalCalls':_0x11041f[_0xdaf1('0x6e')],'message':_0x11041f[_0xdaf1('0x3e')],'originated':_0x11041f[_0xdaf1('0x6f')],'erlangCalls':_0x11041f[_0xdaf1('0x70')],'erlangCallToSecond':_0x11041f['erlangCallToSecond'],'erlangAbandonmentRate':_0x11041f[_0xdaf1('0x71')],'erlangBusyFactor':_0x11041f[_0xdaf1('0x72')],'startPredictive':_0x11041f[_0xdaf1('0x28')],'startProgressive':_0x11041f[_0xdaf1('0x29')]};if(_0x11041f[_0xdaf1('0x73')]){_0x2e7414[_0xdaf1('0x73')]={'id':_0x11041f[_0xdaf1('0x73')]['id'],'name':_0x11041f['Trunk'][_0xdaf1('0x3f')],'active':_0x11041f[_0xdaf1('0x73')][_0xdaf1('0x74')],'callerid':_0x11041f['Trunk'][_0xdaf1('0x75')]};}if(_0x11041f[_0xdaf1('0x44')]){_0x2e7414['Interval']={'id':_0x11041f[_0xdaf1('0x44')]['id'],'name':_0x11041f['Interval'][_0xdaf1('0x3f')]};}var _0x570e74=md5(JSON[_0xdaf1('0x49')](_0x2e7414));if(_0x11041f['md5']!==_0x570e74){_0x11041f[_0xdaf1('0x4')]=_0x570e74;emit(util[_0xdaf1('0x76')](_0xdaf1('0x77'),_0x2e7414[_0xdaf1('0x3f')]),_0xdaf1('0x78'),_0x2e7414);}}}function emitCampaignSummary(_0x9a1c97){if(_0x9a1c97['type']===_0xdaf1('0x79')){emit(util[_0xdaf1('0x76')](_0xdaf1('0x7a'),_0x9a1c97[_0xdaf1('0x3f')]),_0xdaf1('0x7b'),_0x9a1c97);}}function checkGetDataPredictive(_0x352a33){if(isNotNull(_0x352a33)&&!_[_0xdaf1('0x46')](_0x352a33)){loggerPredictive['info'](_0xdaf1('0x7c'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x352a33[_0xdaf1('0x6e')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x352a33[_0xdaf1('0x64')]);loggerPredictive['info'](_0xdaf1('0x7d'),_0x352a33[_0xdaf1('0x67')]);loggerPredictive[_0xdaf1('0x7e')](_0xdaf1('0x7f'),_0x352a33[_0xdaf1('0x66')]);loggerPredictive[_0xdaf1('0x7e')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x352a33[_0xdaf1('0x80')]);loggerPredictive[_0xdaf1('0x7e')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x352a33[_0xdaf1('0x65')]);loggerPredictive[_0xdaf1('0x7e')]('---------------------------');if(_0x352a33[_0xdaf1('0x6e')]>0x0){if(!_['isUndefined'](_0x352a33[_0xdaf1('0x65')])&&_0x352a33[_0xdaf1('0x65')]>0x0){return!![];}loggerPredictive[_0xdaf1('0x7e')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xdaf1('0x81')](_0x352a33['predictiveIntervalAvgHoldtime'])&&_0x352a33[_0xdaf1('0x80')]>0x0){return!![];}loggerPredictive[_0xdaf1('0x7e')](_0xdaf1('0x82'));}else{loggerPredictive['info'](_0xdaf1('0x83'));}}else{loggerPredictive['info'](_0xdaf1('0x84'));}return![];}function mergeDataErlangB(_0x45bc76){return function(_0x581a75){loggerPredictive[_0xdaf1('0x7e')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xdaf1('0x7e')](_0xdaf1('0x85'),_0x581a75['erlangCalls']);loggerPredictive[_0xdaf1('0x7e')](_0xdaf1('0x86'),_0x581a75[_0xdaf1('0x87')]);loggerPredictive['info'](_0xdaf1('0x88'),_0x581a75[_0xdaf1('0x71')]);loggerPredictive['info'](_0xdaf1('0x89'),_0x581a75['erlangBusyFactor']);loggerPredictive[_0xdaf1('0x7e')](_0xdaf1('0x88'),_0x581a75[_0xdaf1('0x71')]);loggerPredictive[_0xdaf1('0x7e')](_0xdaf1('0x8a'));_[_0xdaf1('0x8b')](_0x45bc76,_0x581a75);};}function getDiff(_0xadc6dd){var _0x49fab9=moment()['milliseconds'](0x0);var _0xc8afdb=moment(_0xadc6dd)[_0xdaf1('0x4a')](0x0);return _0x49fab9[_0xdaf1('0x8c')](_0xc8afdb,_0xdaf1('0x4b'));}function ifInterval(_0x24344b,_0x539881){if(_[_0xdaf1('0x81')](_0x539881)){return![];}return getDiff(_0x539881)<_0x24344b*0x3c;}function freeVariablesPredictive(_0x3383ea){if(isNotNull(_0x3383ea)){if(!_['isUndefined'](_0x3383ea['startProgressive'])){_0x3383ea[_0xdaf1('0x29')]=undefined;loggerPredictive[_0xdaf1('0x7e')](_0x3383ea[_0xdaf1('0x3f')],_0xdaf1('0x8d'));}if(!_['isUndefined'](_0x3383ea[_0xdaf1('0x28')])){_0x3383ea[_0xdaf1('0x28')]=undefined;loggerPredictive[_0xdaf1('0x7e')](_0x3383ea['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xdaf1('0x81')](_0x3383ea[_0xdaf1('0x8e')])){clearInterval(_0x3383ea['handlePredictive']);_0x3383ea[_0xdaf1('0x8e')]=undefined;loggerPredictive[_0xdaf1('0x7e')](_0x3383ea[_0xdaf1('0x3f')],_0xdaf1('0x8f'));}}}function erlangb(_0x13809e,_0x577ad8){if(_0x577ad8===0x0){return 0x0;}var _0x74811a=0x1;for(var _0x964daf=0x1;_0x964daf<=_0x577ad8;_0x964daf+=0x1){_0x74811a=0x1+_0x74811a*_0x964daf/_0x13809e;}return 0x1/_0x74811a;}function isVoiceQueueOutbound(_0x562dfe){return _0x562dfe===_0xdaf1('0x4d');}function isNotPreview(_0xf7c9d0){return _0xf7c9d0!==_0xdaf1('0x1f');}function isCampaignIvr(_0x1ef709){return _0x1ef709===_0xdaf1('0x79');}function getCallerId(_0x5cf7c3,_0x7cacc2,_0x47022e){if(!_['isUndefined'](_0x47022e)&&typeof _0x47022e===_0xdaf1('0x90')&&!_['isEmpty'](_0x47022e)){if(!_['isUndefined'](_0x7cacc2)&&typeof _0x7cacc2===_0xdaf1('0x90')&&!_[_0xdaf1('0x46')](_0x7cacc2)){return util['format']('\x22%s\x22\x20<%s>',_0x7cacc2,_0x47022e);}return util[_0xdaf1('0x76')]('\x22%s\x22\x20<%s>',_0x47022e,_0x47022e);}if(!_[_0xdaf1('0x81')](_0x5cf7c3)&&typeof _0x5cf7c3===_0xdaf1('0x90')&&!_['isEmpty'](_0x5cf7c3)){return _0x5cf7c3;}return _0xdaf1('0x91');}function loggerCatchQueueSummary(_0x30bc55,_0x172392){return function(_0x2b02dc){freeVariablesPredictive(_0x172392);emitVoiceQueueSummary(_0x172392);emitCampaignSummary(_0x172392);loggerSyncQueueSummary[_0xdaf1('0x92')](_0x30bc55,util[_0xdaf1('0x93')](_0x2b02dc,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x57fb64,_0x10f8fa){return function(_0x42c60c){loggerPredictive[_0xdaf1('0x92')](_0x10f8fa['name'],_0x57fb64);loggerPredictive[_0xdaf1('0x92')](_0x42c60c[_0xdaf1('0x94')]);freeVariablesPredictive(_0x10f8fa);};}function loggerCatch(_0x2ee662){return function(_0x7574aa){logger[_0xdaf1('0x92')](_0x2ee662,util[_0xdaf1('0x93')](_0x7574aa,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x33b645){return _0x33b645&&!_[_0xdaf1('0x81')](_0x33b645)&&_0x33b645[_0xdaf1('0x95')]>0x0;}function decremetOriginate(_0x3bf113){if(!_[_0xdaf1('0x81')](_0x3bf113)&&_0x3bf113!==null){if(typeof _0x3bf113[_0xdaf1('0x6f')]!=='undefined'){if(_0x3bf113[_0xdaf1('0x6f')]>0x0){_0x3bf113[_0xdaf1('0x6f')]-=0x1;}else{logger[_0xdaf1('0x92')](_0xdaf1('0x96'));}}}else{logger['error']('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x30057a,_0x2ea45b,_0x4f1314){if(_0x2ea45b>_0x4f1314){for(var _0x240330=0x0;_0x240330<_0x2ea45b-_0x4f1314;_0x240330+=0x1){decremetOriginate(_0x30057a);}}}function loggerGetContactDialer(_0xba84ec,_0x1d15c0,_0x32a9cd){return function(_0x46c709){checkContactLowerLimitOriginate(_0x1d15c0,_0x32a9cd,0x0);logger['error'](_0xba84ec,util[_0xdaf1('0x93')](_0x46c709,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5b3699){return function(_0x38338a){if(isNotNull(_0x38338a)&&isNotNull(_0x38338a[0x0])){if(_0x38338a[0x0]['contactsRescheduled']>0x0){_0x5b3699[_0xdaf1('0x3e')]=_0xdaf1('0x97');logger[_0xdaf1('0x7e')]('[getContactDialer2][ReScheduled]'+_0x5b3699[_0xdaf1('0x3f')],_0x38338a[0x0][_0xdaf1('0x98')],_0xdaf1('0x99'));}else{_0x5b3699[_0xdaf1('0x3e')]=_0xdaf1('0x9a');logger[_0xdaf1('0x7e')]('[getContactDialer2][Empty]'+_0x5b3699[_0xdaf1('0x3f')]);}}};}function notSendMessagesQueue(_0x4a5e3e){if(_0x4a5e3e['sendMessageOneNotActive']){freeVariablesPredictive(_0x4a5e3e);if(_0x4a5e3e[_0xdaf1('0x6f')]===0x0&&_0x4a5e3e['talking']===0x0&&_0x4a5e3e['waiting']===0x0&&(_0x4a5e3e[_0xdaf1('0x9b')]||0x0)===0x0){_0x4a5e3e['sendMessageOneNotActive']=![];_0x4a5e3e[_0xdaf1('0x9c')]=0x0;_0x4a5e3e[_0xdaf1('0x3e')]=_0xdaf1('0x41');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x4a5e3e[_0xdaf1('0x3f')],_0xdaf1('0x9d'));}else{_0x4a5e3e[_0xdaf1('0x3e')]=_0xdaf1('0x9e');loggerSyncQueueSummary['error'](_0xdaf1('0x9f'),_0x4a5e3e[_0xdaf1('0x3f')],'is\x20disactive');}emitVoiceQueueSummary(_0x4a5e3e);}}function notSendMessagesCampaign(_0x2582af){if(_0x2582af[_0xdaf1('0xa0')]){if(_0x2582af[_0xdaf1('0x6f')]===0x0){_0x2582af[_0xdaf1('0xa0')]=![];_0x2582af[_0xdaf1('0x3e')]=_0xdaf1('0x41');loggerSyncQueueSummary['error'](_0xdaf1('0xa1'),_0x2582af['name'],_0xdaf1('0x9d'));}else{_0x2582af[_0xdaf1('0x3e')]=_0xdaf1('0x9e');loggerSyncQueueSummary[_0xdaf1('0x92')](_0xdaf1('0xa1'),_0x2582af[_0xdaf1('0x3f')],'is\x20disactive');}emitCampaignSummary(_0x2582af);}}function createObjHistory(_0x171d15,_0x4588ef,_0x18b675,_0x4ba0d3,_0x1ffb74){_0x171d15[_0xdaf1('0x3e')]=_0x18b675;var _0x3138d7=new Action(_0x171d15,_0x4588ef);var _0x5a0a57=new History(_0x3138d7);_0x5a0a57[_0xdaf1('0xa2')]=_0x4ba0d3;_0x5a0a57['statedesc']=_0x1ffb74;_0x5a0a57[_0xdaf1('0xa3')]=_0x3138d7[_0xdaf1('0xa4')];return _0x5a0a57;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x35cd20=this;setInterval(function(){_0x35cd20[_0xdaf1('0xa5')](_0x35cd20[_0xdaf1('0x27')],_0xdaf1('0xa6'));_0x35cd20[_0xdaf1('0xa5')](_0x35cd20['actions'],_0xdaf1('0xa7'));},0x32c8);};Dialer[_0xdaf1('0x1b')][_0xdaf1('0xa5')]=function(_0x74510b,_0x85788e){var _0x37f7e1=this;for(var _0x1b586a in _0x74510b){if(typeof _0x74510b[_0x1b586a]!==_0xdaf1('0xa8')){this[_0xdaf1('0x1e')][_0xdaf1('0x1c')](function(){if(!_[_0xdaf1('0xa9')](_0x74510b[_0x1b586a])){return ami[_0xdaf1('0xaa')]({'action':_0xdaf1('0xab'),'channel':_0x74510b[_0x1b586a][_0xdaf1('0xac')]})[_0xdaf1('0xad')](function(_0x1c6d05){if(_0x1c6d05['message']===_0xdaf1('0xae')){setTimeout(function(){if(_0x74510b[_0x1b586a]&&_0x74510b[_0x1b586a][_0xdaf1('0x4c')]!==_0xdaf1('0x79')){_0x37f7e1[_0xdaf1('0xaf')](_0x37f7e1[_0xdaf1('0x20')][_0x74510b[_0x1b586a][_0xdaf1('0xb0')]]);logger[_0xdaf1('0x92')](_0xdaf1('0xb1'),_0x85788e,_0x1b586a,_0x74510b[_0x1b586a][_0xdaf1('0xb0')]);delete _0x74510b[_0x1b586a];}if(_0x74510b[_0x1b586a]&&_0x74510b[_0x1b586a][_0xdaf1('0x4c')]===_0xdaf1('0x79')){_0x37f7e1['updateOriginated'](_0x37f7e1[_0xdaf1('0x21')][_0x74510b[_0x1b586a]['queue']]);logger[_0xdaf1('0x92')]('[Dialer][checkChannel][ivr]',_0x85788e,_0x1b586a,_0x74510b[_0x1b586a][_0xdaf1('0xb0')]);delete _0x74510b[_0x1b586a];}},0x2328);}});}});}}};Dialer['prototype'][_0xdaf1('0xb2')]=function(_0x59b02d){return BPromise['resolve']()[_0xdaf1('0xb3')](cmHopper[_0xdaf1('0xb2')](_0x59b02d))[_0xdaf1('0xad')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xdaf1('0x1b')][_0xdaf1('0xb4')]=function(_0x296e11){return BPromise[_0xdaf1('0xb5')]()[_0xdaf1('0xb3')](cmHopperBlack[_0xdaf1('0xb4')](_0x296e11))[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0xb6')));};Dialer['prototype'][_0xdaf1('0xb7')]=function(_0x5a7ade){return BPromise[_0xdaf1('0xb5')]()[_0xdaf1('0xb3')](cmHopperBlack[_0xdaf1('0xb7')](_0x5a7ade))[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0xb8')));};Dialer[_0xdaf1('0x1b')][_0xdaf1('0xb9')]=function(_0x259e5f){return BPromise['resolve']()['then'](cmHopperHistory['avgHandleTime'](_0x259e5f))[_0xdaf1('0xad')](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype'][_0xdaf1('0xba')]=function(_0x4f4f74){return BPromise[_0xdaf1('0xb5')]()['then'](cmHopper['rescheduleContact'](_0x4f4f74))[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0xbb')));};Dialer[_0xdaf1('0x1b')][_0xdaf1('0xbc')]=function(_0x3bfffc,_0x704bb,_0x52040b){return BPromise['resolve']()[_0xdaf1('0xb3')](cmHopper[_0xdaf1('0xbc')](_0x3bfffc,_0x704bb,_0x52040b))[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0xbd')));};Dialer[_0xdaf1('0x1b')][_0xdaf1('0xbe')]=function(_0x14d771,_0x17e4c6,_0x2ba66d,_0x15b8c6,_0x17ff46){return BPromise['resolve']()[_0xdaf1('0xb3')](cmHopper[_0xdaf1('0xbe')](_0x14d771,_0x17e4c6,_0x2ba66d,_0x15b8c6))['catch'](function(_0x8b6944){_0x17ff46[_0xdaf1('0xbf')]-=_0x2ba66d;_0x17ff46[_0xdaf1('0xbf')]=_0x17ff46[_0xdaf1('0xbf')]>0x0?_0x17ff46[_0xdaf1('0xbf')]:0x0;loggerCatch(_0xdaf1('0xc0'))(_0x8b6944);});};Dialer['prototype'][_0xdaf1('0xc1')]=function(_0xe3acdd,_0x56664a,_0x39419d,_0x10e4ec){return BPromise[_0xdaf1('0xb5')]()[_0xdaf1('0xb3')](cmHopper['getContactDialerIvr'](_0xe3acdd,_0x56664a,_0x39419d))[_0xdaf1('0xad')](function(_0x347805){_0x10e4ec['temp']-=_0x56664a;_0x10e4ec[_0xdaf1('0xbf')]=_0x10e4ec['temp']>0x0?_0x10e4ec[_0xdaf1('0xbf')]:0x0;loggerCatch(_0xdaf1('0xc2'))(_0x347805);});};Dialer[_0xdaf1('0x1b')][_0xdaf1('0xc3')]=function(_0x55770f){return BPromise[_0xdaf1('0xb5')]()[_0xdaf1('0xb3')](voiceQueueRt['getVoiceQueueRtPauses'](_0x55770f))[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0xc4')));};Dialer['prototype']['moveContactManagedDialer']=function(_0x3d1d9f){return BPromise[_0xdaf1('0xb5')]()[_0xdaf1('0xb3')](cmHopper[_0xdaf1('0xc5')](_0x3d1d9f))[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0xc6')));};Dialer[_0xdaf1('0x1b')][_0xdaf1('0xc7')]=function(_0x4d7a5d){return BPromise[_0xdaf1('0xb5')]()[_0xdaf1('0xb3')](cmHopperHistory['createHistory'](_0x4d7a5d))[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0xc8')));};Dialer['prototype'][_0xdaf1('0xaf')]=function(_0x500cb4){if(!_['isUndefined'](_0x500cb4)&&_0x500cb4!==null){if(typeof _0x500cb4[_0xdaf1('0x6f')]!==_0xdaf1('0xa8')){if(_0x500cb4[_0xdaf1('0x6f')]>0x0){_0x500cb4['originated']-=0x1;}else{logger[_0xdaf1('0x92')](_0xdaf1('0xc9'));}}}else{logger[_0xdaf1('0x92')](_0xdaf1('0xca'));}};Dialer['prototype'][_0xdaf1('0xcb')]=function(_0x9b0ca2,_0x2971fe){var _0xae3465=this;return function(_0x37f244){_0xae3465['updateOriginated'](_0x2971fe);logger[_0xdaf1('0x92')](_0x9b0ca2,util['inspect'](_0x37f244,{'showHidden':![],'depth':null}));};};Dialer[_0xdaf1('0x1b')]['emptyContact']=function(_0x466f0a,_0x14eaad,_0x179f53){var _0x35e53c={'state':0x19,'statedesc':_0xdaf1('0xcc')};this[_0xdaf1('0xaf')](_0x14eaad);this[_0xdaf1('0xcd')](_[_0xdaf1('0x8b')](_0x35e53c,_['pick'](_0x179f53,[_0xdaf1('0xce'),_0xdaf1('0xcf'),_0xdaf1('0xd0'),_0xdaf1('0xd1'),_0xdaf1('0xd2')])),_0xdaf1('0xd3'),'[emptyContact]');logger['error'](_0x466f0a);};Dialer['prototype'][_0xdaf1('0xd4')]=function(_0x1ad2de){return _0x1ad2de===_0xdaf1('0xd5');};Dialer['prototype'][_0xdaf1('0xd6')]=function(_0x293a0f){return!_[_0xdaf1('0x81')](_0x293a0f)&&_0x293a0f&&!_[_0xdaf1('0x81')](_0x293a0f[_0xdaf1('0x3f')])&&!_['isUndefined'](_0x293a0f[_0xdaf1('0x74')])&&_0x293a0f[_0xdaf1('0x74')]&&(this[_0xdaf1('0x23')][util['format'](_0xdaf1('0xd7'),_0x293a0f[_0xdaf1('0x3f')])][_0xdaf1('0xab')]==='reachable'||this[_0xdaf1('0x23')][util[_0xdaf1('0x76')](_0xdaf1('0xd7'),_0x293a0f[_0xdaf1('0x3f')])]['status']===_0xdaf1('0xd8'));};Dialer[_0xdaf1('0x1b')][_0xdaf1('0xcd')]=function(_0x151847,_0x25fb13,_0x1cfd0f){this[_0xdaf1('0xc7')](_0x151847)['catch'](loggerCatch(_0x25fb13));this['moveContactManagedDialer'](_0x151847)[_0xdaf1('0xad')](loggerCatch(_0x1cfd0f));};Dialer[_0xdaf1('0x1b')][_0xdaf1('0xd9')]=function(_0x1db3c6){var _0xd86d5=this[_0xdaf1('0x27')][_0x1db3c6[_0xdaf1('0xda')]];var _0x1e0969;if(!_['isNil'](_0x1db3c6)&&!_['isNil'](_0x1db3c6[_0xdaf1('0xdb')])&&!_[_0xdaf1('0xa9')](_0x1db3c6[_0xdaf1('0xdb')][_0xdaf1('0xdc')])&&_0x1db3c6[_0xdaf1('0xdd')]===_0xdaf1('0xde')&&_0xd86d5){if(_0xd86d5['type']!==_0xdaf1('0x79')&&this[_0xdaf1('0x20')][_0xd86d5[_0xdaf1('0xb0')]][_0xdaf1('0xdf')]&&_0x1db3c6['value']===_0xdaf1('0xe0')){delete this['uniqueId'][_0x1db3c6[_0xdaf1('0xda')]];this[_0xdaf1('0xaf')](this['voiceQueues'][_0xd86d5[_0xdaf1('0xb0')]]);this[_0xdaf1('0x20')][_0xd86d5[_0xdaf1('0xb0')]][_0xdaf1('0xe1')]+=0x1;this[_0xdaf1('0x20')][_0xd86d5[_0xdaf1('0xb0')]][_0xdaf1('0xe2')]+=0x1;_0x1e0969=new Hangup(_0xd86d5,_0x1db3c6);_0x1e0969[_0xdaf1('0xa2')]=0x12;_0x1e0969[_0xdaf1('0xe3')]=_0xdaf1('0xe4');_0x1e0969[_0xdaf1('0xe5')]=_0xdaf1('0xe6');ami['emit'](_0xdaf1('0xe7'),ut[_0xdaf1('0xe8')](_0x1e0969,_0xdaf1('0xe9')));this[_0xdaf1('0xcd')](_0x1e0969,_0xdaf1('0xea'),_0xdaf1('0xeb'));}if(_0xd86d5[_0xdaf1('0x4c')]!==_0xdaf1('0x79')&&this[_0xdaf1('0x20')][_0xd86d5[_0xdaf1('0xb0')]][_0xdaf1('0xdf')]&&_0x1db3c6[_0xdaf1('0xec')]===_0xdaf1('0xed')){var _0x1d9585=this;return new BPromise(function(_0x4ba653,_0x5a07a1){delete _0x1d9585[_0xdaf1('0x27')][_0x1db3c6['uniqueid']];_0x1d9585[_0xdaf1('0xaf')](_0x1d9585[_0xdaf1('0x20')][_0xd86d5[_0xdaf1('0xb0')]]);_0x1d9585[_0xdaf1('0x20')][_0xd86d5['queue']][_0xdaf1('0xe1')]+=0x1;_0x1d9585['voiceQueues'][_0xd86d5[_0xdaf1('0xb0')]][_0xdaf1('0xe2')]+=0x1;var _0x91cee4=_0x1d9585[_0xdaf1('0x20')][_0xd86d5[_0xdaf1('0xb0')]];var _0x5eb5b0=new Hangup(_0xd86d5,_0x1db3c6);_0x5eb5b0[_0xdaf1('0xa2')]=0x13;_0x5eb5b0[_0xdaf1('0xe3')]=_0xdaf1('0xee');_0x5eb5b0[_0xdaf1('0xe5')]=_0xdaf1('0xe6');_0x5eb5b0[_0xdaf1('0xef')]+=0x1;_0x5eb5b0[_0xdaf1('0xf0')]+=0x1;_0x5eb5b0['amd']=!![];ami[_0xdaf1('0xf1')](_0xdaf1('0xe7'),ut[_0xdaf1('0xe8')](_0x5eb5b0,'amd'));_0x1d9585['createHistory'](_0x5eb5b0)[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0xf2')));if(_0x5eb5b0[_0xdaf1('0xf3')]+_0x5eb5b0['countcongestionretry']+_0x5eb5b0['countnoanswerretry']+_0x5eb5b0[_0xdaf1('0xf4')]+_0x5eb5b0['countdropretry']+_0x5eb5b0['countabandonedretry']+_0x5eb5b0[_0xdaf1('0xef')]+_0x5eb5b0['countagentrejectretry']>=_0x91cee4[_0xdaf1('0xf5')]){_0x1d9585[_0xdaf1('0xf6')](_0x5eb5b0,_0x4ba653,_0x5a07a1,_0xdaf1('0xf7'));}else{if(_0x5eb5b0['countmachineretry']>=_0x91cee4[_0xdaf1('0xf8')]){_0x1d9585[_0xdaf1('0xf9')](_0x5eb5b0,_0x4ba653,_0x5a07a1,_0xdaf1('0xfa'));}else{_0x1d9585[_0xdaf1('0xba')]({'active':![],'countmachineretry':_0x5eb5b0[_0xdaf1('0xef')],'scheduledat':moment()['add'](_0x91cee4[_0xdaf1('0xfb')],_0xdaf1('0xfc'))[_0xdaf1('0x76')](_0xdaf1('0xfd')),'ContactId':_0x5eb5b0[_0xdaf1('0xce')],'ListId':_0x5eb5b0[_0xdaf1('0xcf')],'VoiceQueueId':_0x5eb5b0[_0xdaf1('0xd1')]||undefined,'CampaignId':_0x5eb5b0[_0xdaf1('0xd2')]||undefined})[_0xdaf1('0xad')](loggerCatch('[rescheduleContact][Machine]'));_0x4ba653({'reschedule':0x1});}}});}if(_0xd86d5[_0xdaf1('0x4c')]===_0xdaf1('0x79')&&this[_0xdaf1('0x21')][_0xd86d5[_0xdaf1('0xb0')]][_0xdaf1('0xdf')]&&_0x1db3c6[_0xdaf1('0xec')]===_0xdaf1('0xe0')){delete this[_0xdaf1('0x27')][_0x1db3c6[_0xdaf1('0xda')]];this['updateOriginated'](this[_0xdaf1('0x21')][_0xd86d5[_0xdaf1('0xb0')]]);_0x1e0969=new Hangup(_0xd86d5,_0x1db3c6);_0x1e0969['state']=0x12;_0x1e0969[_0xdaf1('0xe3')]=_0xdaf1('0xe4');_0x1e0969[_0xdaf1('0xe5')]='AMD';ami['emit']('custom:amd',ut[_0xdaf1('0xe8')](_0x1e0969,'amd'));this[_0xdaf1('0xcd')](_0x1e0969,_0xdaf1('0xfe'),_0xdaf1('0xff'));}if(_0xd86d5[_0xdaf1('0x4c')]===_0xdaf1('0x79')&&this[_0xdaf1('0x21')][_0xd86d5[_0xdaf1('0xb0')]]['dialAMDActive']&&_0x1db3c6[_0xdaf1('0xec')]==='MACHINE'){var _0x1d9585=this;return new BPromise(function(_0x1b8d47,_0x1c0ba0){delete _0x1d9585['uniqueId'][_0x1db3c6['uniqueid']];_0x1d9585[_0xdaf1('0xaf')](_0x1d9585['campaigns'][_0xd86d5[_0xdaf1('0xb0')]]);_0x1d9585['campaigns'][_0xd86d5['queue']][_0xdaf1('0xe1')]+=0x1;_0x1d9585[_0xdaf1('0x21')][_0xd86d5[_0xdaf1('0xb0')]][_0xdaf1('0xe2')]+=0x1;var _0xa7b2de=_0x1d9585['campaigns'][_0xd86d5[_0xdaf1('0xb0')]];var _0x1cb803=new Hangup(_0xd86d5,_0x1db3c6);_0x1cb803[_0xdaf1('0xa2')]=0x13;_0x1cb803[_0xdaf1('0xe3')]=_0xdaf1('0xee');_0x1cb803['membername']=_0xdaf1('0xe6');_0x1cb803['countmachineretry']+=0x1;_0x1cb803[_0xdaf1('0xf0')]+=0x1;_0x1cb803[_0xdaf1('0xe9')]=!![];ami[_0xdaf1('0xf1')](_0xdaf1('0xe7'),ut[_0xdaf1('0xe8')](_0x1cb803,_0xdaf1('0xe9')));_0x1d9585[_0xdaf1('0xc7')](_0x1cb803)[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0xf2')));if(_0x1cb803['countbusyretry']+_0x1cb803[_0xdaf1('0x100')]+_0x1cb803[_0xdaf1('0x101')]+_0x1cb803[_0xdaf1('0xf4')]+_0x1cb803['countdropretry']+_0x1cb803[_0xdaf1('0x102')]+_0x1cb803[_0xdaf1('0xef')]+_0x1cb803[_0xdaf1('0x103')]>=_0xa7b2de[_0xdaf1('0xf5')]){_0x1d9585[_0xdaf1('0xf6')](_0x1cb803,_0x1b8d47,_0x1c0ba0,_0xdaf1('0xf7'));}else{if(_0x1cb803[_0xdaf1('0xef')]>=_0xa7b2de[_0xdaf1('0xf8')]){_0x1d9585[_0xdaf1('0xf9')](_0x1cb803,_0x1b8d47,_0x1c0ba0,'reason\x2019\x20machine....');}else{_0x1d9585[_0xdaf1('0xba')]({'active':![],'countmachineretry':_0x1cb803[_0xdaf1('0xef')],'scheduledat':moment()[_0xdaf1('0x104')](_0xa7b2de['dialMachineRetryFrequency'],'minutes')[_0xdaf1('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1cb803['ContactId'],'ListId':_0x1cb803['ListId'],'VoiceQueueId':_0x1cb803[_0xdaf1('0xd1')]||undefined,'CampaignId':_0x1cb803[_0xdaf1('0xd2')]||undefined})[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x105')));_0x1b8d47({'reschedule':0x1});}}});}}};Dialer[_0xdaf1('0x1b')][_0xdaf1('0x35')]=function(_0x3f7308){var _0x5a1e19=this[_0xdaf1('0x27')][_0x3f7308['uniqueid']];var _0x201e97=this;var _0x5cc01d;if(_0x5a1e19&&_0x5a1e19[_0xdaf1('0x4c')]===_0xdaf1('0x79')){delete this[_0xdaf1('0x27')][_0x3f7308[_0xdaf1('0xda')]];this[_0xdaf1('0xaf')](this[_0xdaf1('0x21')][_0x5a1e19['queue']]);this[_0xdaf1('0x21')][_0x5a1e19[_0xdaf1('0xb0')]]['ivrAnswerCallsDay']+=0x1;_0x5cc01d=new Hangup(_0x5a1e19,_0x3f7308);this[_0xdaf1('0xc7')](_0x5cc01d)['catch'](loggerCatch(_0xdaf1('0x106')));this[_0xdaf1('0xc5')](_0x5cc01d)['catch'](loggerCatch(_0xdaf1('0x107')));}if(_0x5a1e19&&_0x5a1e19[_0xdaf1('0x4c')]!==_0xdaf1('0x79')&&isNotNull(this[_0xdaf1('0x20')][_0x5a1e19[_0xdaf1('0xb0')]]['dialQueueProject'])){delete this[_0xdaf1('0x27')][_0x3f7308[_0xdaf1('0xda')]];this[_0xdaf1('0xaf')](this[_0xdaf1('0x20')][_0x5a1e19['queue']]);this[_0xdaf1('0x20')][_0x5a1e19['queue']]['outboundAnswerCallsDay']+=0x1;this[_0xdaf1('0x20')][_0x5a1e19[_0xdaf1('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;_0x5cc01d=new Hangup(_0x5a1e19,_0x3f7308);_0x5cc01d[_0xdaf1('0xa2')]=0x10;_0x5cc01d[_0xdaf1('0xe3')]=_0xdaf1('0x108');_0x5cc01d[_0xdaf1('0xe5')]=_0xdaf1('0x109');this[_0xdaf1('0xc7')](_0x5cc01d)[_0xdaf1('0xad')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x5cc01d)[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x107')));}if(_0x5a1e19&&_0x5a1e19[_0xdaf1('0x4c')]!==_0xdaf1('0x79')&&!isNotNull(this[_0xdaf1('0x20')][_0x5a1e19[_0xdaf1('0xb0')]][_0xdaf1('0x10a')])){delete this['uniqueId'][_0x3f7308[_0xdaf1('0xda')]];this['updateOriginated'](this[_0xdaf1('0x20')][_0x5a1e19[_0xdaf1('0xb0')]]);this[_0xdaf1('0x20')][_0x5a1e19[_0xdaf1('0xb0')]]['outboundUnknownCallsDay']+=0x1;_0x5cc01d=new Hangup(_0x5a1e19,_0x3f7308);_0x5cc01d['state']=0xc;_0x5cc01d[_0xdaf1('0xe3')]=_0x3f7308['cause-txt'];_0x5cc01d[_0xdaf1('0xe5')]=_0xdaf1('0x10b');this[_0xdaf1('0xc7')](_0x5cc01d)[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x106')));this[_0xdaf1('0xc5')](_0x5cc01d)[_0xdaf1('0xad')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xdaf1('0x1b')]['syncAgentComplete']=function(_0x35f5a9){var _0x3a35fa=this['uniqueId'][_0x35f5a9[_0xdaf1('0xda')]];var _0x1206ed=this;if(this['voiceQueues'][_0x35f5a9[_0xdaf1('0xb0')]]){if(_0x3a35fa&&_0x3a35fa[_0xdaf1('0x4c')]!==_0xdaf1('0x79')){delete this[_0xdaf1('0x27')][_0x35f5a9['uniqueid']];this[_0xdaf1('0x20')][_0x35f5a9[_0xdaf1('0xb0')]]['outboundAnswerCallsDay']+=0x1;var _0x23ddde=new AgentComplete(_0x3a35fa,_0x35f5a9);if(_0x35f5a9[_0xdaf1('0x10c')]==='agent'){_0x23ddde[_0xdaf1('0x10d')]=this[_0xdaf1('0x20')][_0x35f5a9[_0xdaf1('0xb0')]][_0xdaf1('0x10e')]&&this[_0xdaf1('0x20')][_0x35f5a9[_0xdaf1('0xb0')]][_0xdaf1('0x10f')]?moment()[_0xdaf1('0x76')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xdaf1('0xc7')](_0x23ddde)[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x110')));this['moveContactManagedDialer'](_0x23ddde)[_0xdaf1('0xad')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0xdaf1('0x2e')]=function(_0x220078){if(this[_0xdaf1('0x20')][_0x220078[_0xdaf1('0xb0')]]){if(this[_0xdaf1('0x27')][_0x220078[_0xdaf1('0xda')]]&&this['uniqueId'][_0x220078[_0xdaf1('0xda')]][_0xdaf1('0x4c')]!==_0xdaf1('0x79')){this[_0xdaf1('0xaf')](this[_0xdaf1('0x20')][_0x220078[_0xdaf1('0xb0')]]);this[_0xdaf1('0x27')][_0x220078[_0xdaf1('0xda')]][_0xdaf1('0x111')]=moment()[_0xdaf1('0x76')](_0xdaf1('0xfd'));}}};Dialer['prototype'][_0xdaf1('0x112')]=function(_0x2b5b20){this['createHistory'](_0x2b5b20)[_0xdaf1('0xad')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xdaf1('0xc5')](_0x2b5b20)[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x113')));};Dialer[_0xdaf1('0x1b')][_0xdaf1('0x31')]=function(_0x5127a7){var _0x4b58a7=this[_0xdaf1('0x27')][_0x5127a7['uniqueid']];var _0x4757f2=this;if(this[_0xdaf1('0x20')][_0x5127a7['queue']]){if(_0x4b58a7&&_0x4b58a7[_0xdaf1('0x4c')]!==_0xdaf1('0x79')){delete this[_0xdaf1('0x27')][_0x5127a7[_0xdaf1('0xda')]];this[_0xdaf1('0xaf')](this[_0xdaf1('0x20')][_0x5127a7['queue']]);_0x4b58a7[_0xdaf1('0x114')]=moment()[_0xdaf1('0x76')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3089ab=new QueueCallerAbandon(_0x4b58a7,_0x5127a7);if(getSeconds(_0x4b58a7[_0xdaf1('0x114')],_0x4b58a7['responsetime'])>=_0x4b58a7[_0xdaf1('0x115')]){this['voiceQueues'][_0x5127a7[_0xdaf1('0xb0')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xdaf1('0x20')][_0x5127a7[_0xdaf1('0xb0')]][_0xdaf1('0x60')]+=0x1;this[_0xdaf1('0x20')][_0x5127a7[_0xdaf1('0xb0')]][_0xdaf1('0x69')]+=0x1;_0x3089ab[_0xdaf1('0xa2')]=0xa;_0x3089ab[_0xdaf1('0xe3')]='Drop';_0x3089ab['dropreason']='TIMEOUT';_0x3089ab[_0xdaf1('0x10d')]=this[_0xdaf1('0x20')][_0x5127a7[_0xdaf1('0xb0')]][_0xdaf1('0x10e')]?moment()['format'](_0xdaf1('0xfd')):undefined;_0x3089ab[_0xdaf1('0x116')]+=0x1;_0x3089ab[_0xdaf1('0xf0')]+=0x1;if(_0x3089ab[_0xdaf1('0x116')]>=this[_0xdaf1('0x20')][_0x5127a7[_0xdaf1('0xb0')]][_0xdaf1('0x117')]){this[_0xdaf1('0x112')](_0x3089ab);}else{this[_0xdaf1('0xba')]({'active':![],'countdropretry':_0x3089ab[_0xdaf1('0x116')],'scheduledat':moment()[_0xdaf1('0x104')](this[_0xdaf1('0x20')][_0x5127a7['queue']]['dialDropRetryFrequency'],_0xdaf1('0xfc'))[_0xdaf1('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4b58a7[_0xdaf1('0xce')],'ListId':_0x4b58a7[_0xdaf1('0xcf')],'VoiceQueueId':_0x4b58a7[_0xdaf1('0xd1')]||undefined,'CampaignId':_0x4b58a7[_0xdaf1('0xd2')]||undefined})[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x118')));var _0x5b57da=new History(_0x3089ab);_0x5b57da[_0xdaf1('0xa2')]=0xa;_0x5b57da[_0xdaf1('0xe3')]=_0xdaf1('0x119');_0x5b57da['starttime']=moment()['format'](_0xdaf1('0xfd'));_0x5b57da[_0xdaf1('0xa3')]=_0x5b57da['starttime'];_0x5b57da[_0xdaf1('0x11a')]=_0x3089ab['calleridname'];_0x5b57da['calleridnum']=_0x3089ab[_0xdaf1('0x11b')];this[_0xdaf1('0xc7')](_0x5b57da)[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x11c')));}}else{this['voiceQueues'][_0x5127a7['queue']][_0xdaf1('0x66')]+=0x1;this[_0xdaf1('0x20')][_0x5127a7[_0xdaf1('0xb0')]]['outboundDropCallsDayCallersExit']+=0x1;_0x3089ab[_0xdaf1('0xa2')]=0xb;_0x3089ab[_0xdaf1('0xe3')]=_0xdaf1('0x11d');_0x3089ab[_0xdaf1('0x11e')]=_0xdaf1('0x11f');_0x3089ab[_0xdaf1('0x102')]+=0x1;_0x3089ab['countglobal']+=0x1;if(_0x3089ab['countabandonedretry']>=this['voiceQueues'][_0x5127a7[_0xdaf1('0xb0')]][_0xdaf1('0x120')]){this[_0xdaf1('0x112')](_0x3089ab);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x3089ab[_0xdaf1('0x102')],'scheduledat':moment()[_0xdaf1('0x104')](this[_0xdaf1('0x20')][_0x5127a7[_0xdaf1('0xb0')]][_0xdaf1('0x121')],_0xdaf1('0xfc'))[_0xdaf1('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4b58a7[_0xdaf1('0xce')],'ListId':_0x4b58a7[_0xdaf1('0xcf')],'VoiceQueueId':_0x4b58a7['VoiceQueueId']||undefined,'CampaignId':_0x4b58a7[_0xdaf1('0xd2')]||undefined})[_0xdaf1('0xad')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x5b57da=new History(_0x3089ab);_0x5b57da[_0xdaf1('0xa2')]=0xb;_0x5b57da['statedesc']='Abandoned';_0x5b57da[_0xdaf1('0xa4')]=moment()[_0xdaf1('0x76')]('YYYY-MM-DD\x20HH:mm:ss');_0x5b57da[_0xdaf1('0xa3')]=_0x5b57da[_0xdaf1('0xa4')];_0x5b57da[_0xdaf1('0x11a')]=_0x3089ab[_0xdaf1('0x11a')];_0x5b57da['calleridnum']=_0x3089ab[_0xdaf1('0x11b')];this['createHistory'](_0x5b57da)['catch'](loggerCatch(_0xdaf1('0x122')));}}}}};Dialer['prototype']['syncNewExten']=function(_0x2881b2){if(this[_0xdaf1('0x25')][_0x2881b2[_0xdaf1('0xda')]]){this[_0xdaf1('0x25')][_0x2881b2[_0xdaf1('0xda')]][_0xdaf1('0xac')]=_0x2881b2[_0xdaf1('0xac')];}if(this['uniqueId'][_0x2881b2['uniqueid']]){this[_0xdaf1('0x27')][_0x2881b2['uniqueid']]['channel']=_0x2881b2['channel'];}};Dialer[_0xdaf1('0x1b')]['syncQueueMember']=function(_0x3e6339){if(strategy[this[_0xdaf1('0x20')][this[_0xdaf1('0x25')][_0x3e6339['actionid']][_0xdaf1('0xb0')]][_0xdaf1('0x123')]]===_0xdaf1('0x1a')){if(this[_0xdaf1('0x25')][_0x3e6339[_0xdaf1('0x124')]]&&_[_0xdaf1('0xa9')](this[_0xdaf1('0x25')][_0x3e6339[_0xdaf1('0x124')]][_0xdaf1('0x125')])&&_0x3e6339[_0xdaf1('0xab')]==='1'&&_0x3e6339[_0xdaf1('0x126')]==='0'){if(this[_0xdaf1('0x22')][_0x3e6339[_0xdaf1('0x127')]]){if(!this[_0xdaf1('0x22')][_0x3e6339[_0xdaf1('0x127')]][_0xdaf1('0x125')]){this['agents'][_0x3e6339[_0xdaf1('0x127')]][_0xdaf1('0x125')]=!![];this[_0xdaf1('0x25')][_0x3e6339['actionid']]['locked']=!![];this['actions'][_0x3e6339[_0xdaf1('0x124')]][_0xdaf1('0x127')]=_0x3e6339['stateinterface'];}}}}else if((strategy[this[_0xdaf1('0x20')][this[_0xdaf1('0x25')][_0x3e6339[_0xdaf1('0x124')]][_0xdaf1('0xb0')]][_0xdaf1('0x123')]]||'rrmemory')==='rrmemory'){if(this['actions'][_0x3e6339['actionid']]){if(this['agents'][_0x3e6339['stateinterface']]){this['actions'][_0x3e6339[_0xdaf1('0x124')]][_0xdaf1('0x127')]=_0x3e6339[_0xdaf1('0x127')];if(_[_0xdaf1('0xa9')](this[_0xdaf1('0x2b')][this[_0xdaf1('0x25')][_0x3e6339['actionid']][_0xdaf1('0xb0')]])){this['queueBooked'][this[_0xdaf1('0x25')][_0x3e6339[_0xdaf1('0x124')]][_0xdaf1('0xb0')]]=[];}this[_0xdaf1('0x2b')][this[_0xdaf1('0x25')][_0x3e6339['actionid']]['queue']][_0xdaf1('0x128')](_['merge'](_[_0xdaf1('0x129')](this[_0xdaf1('0x25')][_0x3e6339[_0xdaf1('0x124')]],[_0xdaf1('0x12a'),'stateinterface']),{'status':_0x3e6339[_0xdaf1('0xab')],'paused':_0x3e6339[_0xdaf1('0x126')]}));}}}};function unlockQueueStatus(_0x54fecc,_0x1492b9){setTimeout(function(){if(_[_0xdaf1('0x81')](_0x54fecc[_0xdaf1('0x12b')])){loggerBooked[_0xdaf1('0x92')](_0xdaf1('0x12c'),_0x1492b9);}_0x54fecc[_0xdaf1('0x12b')]=!![];loggerBooked['info'](_0xdaf1('0x12d'),_0x1492b9,JSON[_0xdaf1('0x49')](_[_0xdaf1('0x129')](_0x54fecc,[_0xdaf1('0x3f'),_0xdaf1('0x12b')])));},0x1f3);}Dialer[_0xdaf1('0x1b')]['syncQueueStatusComplete']=function(_0x3a4b22){var _0x37e0ca=this;var _0x376704=_0x37e0ca['voiceQueues'][_0x37e0ca[_0xdaf1('0x25')][_0x3a4b22[_0xdaf1('0x124')]][_0xdaf1('0xb0')]];if(strategy[this[_0xdaf1('0x20')][this[_0xdaf1('0x25')][_0x3a4b22[_0xdaf1('0x124')]]['queue']][_0xdaf1('0x123')]]===_0xdaf1('0x1a')){if(this[_0xdaf1('0x25')][_0x3a4b22[_0xdaf1('0x124')]]&&this[_0xdaf1('0x25')][_0x3a4b22['actionid']][_0xdaf1('0x127')]){this[_0xdaf1('0x1f')][_0xdaf1('0x12e')](this[_0xdaf1('0x25')][_0x3a4b22[_0xdaf1('0x124')]][_0xdaf1('0x12a')],this[_0xdaf1('0x25')][_0x3a4b22[_0xdaf1('0x124')]][_0xdaf1('0x127')])['catch'](function(_0x54bdd5){logger[_0xdaf1('0x92')](_0xdaf1('0x12f'),util['inspect'](_0x54bdd5,{'showHidden':![],'depth':null}));})[_0xdaf1('0x130')](function(){_0x37e0ca[_0xdaf1('0xaf')](_0x37e0ca[_0xdaf1('0x20')][_0x37e0ca['actions'][_0x3a4b22[_0xdaf1('0x124')]][_0xdaf1('0xb0')]]);_0x37e0ca[_0xdaf1('0x22')][_0x37e0ca['actions'][_0x3a4b22[_0xdaf1('0x124')]][_0xdaf1('0x127')]][_0xdaf1('0x125')]=![];delete _0x37e0ca[_0xdaf1('0x25')][_0x3a4b22[_0xdaf1('0x124')]];unlockQueueStatus(_0x376704);});}else{this[_0xdaf1('0xaf')](this[_0xdaf1('0x20')][this[_0xdaf1('0x25')][_0x3a4b22[_0xdaf1('0x124')]][_0xdaf1('0xb0')]]);this[_0xdaf1('0xba')]({'active':![],'ContactId':this[_0xdaf1('0x25')][_0x3a4b22['actionid']][_0xdaf1('0xce')],'ListId':this[_0xdaf1('0x25')][_0x3a4b22[_0xdaf1('0x124')]][_0xdaf1('0xcf')],'VoiceQueueId':this[_0xdaf1('0x25')][_0x3a4b22['actionid']][_0xdaf1('0xd1')]||undefined,'CampaignId':this[_0xdaf1('0x25')][_0x3a4b22['actionid']][_0xdaf1('0xd2')]||undefined})[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x131')));delete this['actions'][_0x3a4b22[_0xdaf1('0x124')]];unlockQueueStatus(_0x376704);}}else if((strategy[this[_0xdaf1('0x20')][this[_0xdaf1('0x25')][_0x3a4b22[_0xdaf1('0x124')]][_0xdaf1('0xb0')]][_0xdaf1('0x123')]]||_0xdaf1('0x19'))==='rrmemory'){var _0x420e27;if(this['actions'][_0x3a4b22[_0xdaf1('0x124')]]&&!_[_0xdaf1('0x46')](this[_0xdaf1('0x2b')][this['actions'][_0x3a4b22[_0xdaf1('0x124')]][_0xdaf1('0xb0')]])){if(this[_0xdaf1('0x2c')][_0x37e0ca[_0xdaf1('0x25')][_0x3a4b22['actionid']]['queue']]){this['queueBookedRR'][_0x37e0ca['actions'][_0x3a4b22[_0xdaf1('0x124')]][_0xdaf1('0xb0')]]=this[_0xdaf1('0x2c')][this[_0xdaf1('0x25')][_0x3a4b22[_0xdaf1('0x124')]]['queue']]?this['queueBookedRR'][this[_0xdaf1('0x25')][_0x3a4b22[_0xdaf1('0x124')]]['queue']]:this[_0xdaf1('0x2b')][this[_0xdaf1('0x25')][_0x3a4b22['actionid']][_0xdaf1('0xb0')]]?this[_0xdaf1('0x2b')][this[_0xdaf1('0x25')][_0x3a4b22[_0xdaf1('0x124')]]['queue']][_0xdaf1('0x132')]||0x0:0x0;}this[_0xdaf1('0x2b')][this['actions'][_0x3a4b22[_0xdaf1('0x124')]][_0xdaf1('0xb0')]][_0xdaf1('0x132')]=this[_0xdaf1('0x2c')][this[_0xdaf1('0x25')][_0x3a4b22[_0xdaf1('0x124')]][_0xdaf1('0xb0')]];for(var _0x143389=0x0;_0x143389=0x0;})['catch'](myreject(_0x436f00)));}}else{_0x44cad7[_0xdaf1('0x128')](ami[_0xdaf1('0xaa')]({'action':_0xdaf1('0x148'),'command':util[_0xdaf1('0x76')](_0xdaf1('0x149'),_0x552915,!_['isUndefined'](config[_0xdaf1('0x145')][_0x1f84e3])?_0x1f84e3:'')})[_0xdaf1('0xb3')](function(_0x595af8){return _0x595af8[_0xdaf1('0x14b')][_0xdaf1('0x14c')](_0xdaf1('0x14d'))>=0x0;})[_0xdaf1('0xad')](myreject(_0x436f00)));}BPromise['all'](_0x44cad7)[_0xdaf1('0xb3')](function(_0x2fafd5){var _0x9bbf27=_[_0xdaf1('0x14e')](_0x2fafd5);if(_0x9bbf27){return _0x4c61bb(_0x9bbf27);}else{_0x427782['message']=_0x13dc94?_0xdaf1('0x14f'):'INTERVAL_IS_OVERTIME';return _0x436f00(msgResponse(_0xdaf1('0x150'),'Failure',_0xdaf1('0x151')+_0x13dc94+'\x20'+_0x3eef14+_0xdaf1('0x152')+util[_0xdaf1('0x93')](_0x552915,{'showHidden':![],'depth':null})+_0xdaf1('0x153')+_0x1f84e3));}})['catch'](function(_0x419047){return _0x436f00(msgResponse(_0xdaf1('0x13f'),_0xdaf1('0x142'),JSON[_0xdaf1('0x49')](_0x419047)));});});};Dialer[_0xdaf1('0x1b')][_0xdaf1('0x154')]=function(_0x22e037){var _0x2e8e42=this;return function(){switch(_0x22e037[_0xdaf1('0x59')]){case _0xdaf1('0x155'):freeVariablesPredictive(_0x22e037);_0x2e8e42[_0xdaf1('0x156')](_0x22e037,0x1);break;case'power':freeVariablesPredictive(_0x22e037);_0x2e8e42[_0xdaf1('0x156')](_0x22e037,_0x22e037[_0xdaf1('0x157')]);break;case _0xdaf1('0x158'):_0x2e8e42[_0xdaf1('0x158')](_0x22e037);break;case _0xdaf1('0x9'):freeVariablesPredictive(_0x22e037);_0x2e8e42[_0xdaf1('0x156')](_0x22e037,0x1);break;default:freeVariablesPredictive(_0x22e037);logger[_0xdaf1('0x92')]('Queue',_0x22e037[_0xdaf1('0x3f')],_0xdaf1('0x159'));}};};Dialer[_0xdaf1('0x1b')][_0xdaf1('0x15a')]=function(_0x427666){var _0x1ebb7d=this;return function(){_0x1ebb7d[_0xdaf1('0x15b')](_0x427666);};};Dialer[_0xdaf1('0x1b')]['syncQueueSummary']=function(_0x69f558){var _0x391e3c=this;if(isNotPreview(_0x69f558[_0xdaf1('0x59')])){if(isVoiceQueueOutbound(_0x69f558['type'])&&isActive(_0x69f558['dialActive'])){_0x69f558[_0xdaf1('0xa0')]=!![];BPromise[_0xdaf1('0xb5')]()[_0xdaf1('0xb3')](checkIsLoggedIn(_0x69f558,_0x69f558[_0xdaf1('0x4f')]))[_0xdaf1('0xb3')](checkIsActive(_0x69f558,_0x69f558['dialActive']))[_0xdaf1('0xb3')](checkInterval(_0x69f558))[_0xdaf1('0xb3')](_0x391e3c[_0xdaf1('0x13c')](_0x69f558))['then'](_0x391e3c[_0xdaf1('0x13e')](_0x69f558[_0xdaf1('0x15c')],_0x69f558['dialTimezone'],_0x69f558[_0xdaf1('0x3f')],_0x69f558))['then'](_0x391e3c[_0xdaf1('0x140')](_0x69f558[_0xdaf1('0x44')],_0x69f558['dialTimezone'],_0x69f558[_0xdaf1('0x3f')],_0x69f558))['then'](_0x391e3c['checkDialMethod'](_0x69f558))[_0xdaf1('0xad')](loggerCatchQueueSummary(_0xdaf1('0x15d'),_0x69f558));}else{notSendMessagesQueue(_0x69f558);}}else{freeVariablesPredictive(_0x69f558);}};Dialer[_0xdaf1('0x1b')][_0xdaf1('0x13b')]=function(){var _0x4aeb9c=this;var _0x21a499;for(var _0x19a779 in this[_0xdaf1('0x21')]){if(typeof this[_0xdaf1('0x21')][_0x19a779]!==_0xdaf1('0xa8')){_0x21a499=this[_0xdaf1('0x21')][_0x19a779];if(isCampaignIvr(_0x21a499[_0xdaf1('0x4c')])&&isActive(_0x21a499[_0xdaf1('0x74')])){_0x21a499[_0xdaf1('0xa0')]=!![];BPromise[_0xdaf1('0xb5')]()[_0xdaf1('0xb3')](checkIsActive(_0x21a499,_0x21a499['active']))[_0xdaf1('0xb3')](checkInterval(_0x21a499))[_0xdaf1('0xb3')](_0x4aeb9c['checkIsTrunkReachable'](_0x21a499))[_0xdaf1('0xb3')](_0x4aeb9c[_0xdaf1('0x13e')](_0x21a499[_0xdaf1('0x15c')],_0x21a499[_0xdaf1('0x15e')],_0x21a499['name'],_0x21a499))[_0xdaf1('0xb3')](_0x4aeb9c[_0xdaf1('0x140')](_0x21a499['Interval'],_0x21a499['dialTimezone'],_0x21a499[_0xdaf1('0x3f')],_0x21a499))['then'](_0x4aeb9c[_0xdaf1('0x15a')](_0x21a499))[_0xdaf1('0xad')](loggerCatchQueueSummary(_0xdaf1('0x15f'),_0x21a499));}else{notSendMessagesCampaign(_0x21a499);}}}};function getCallerIdRandom(_0x33ea56,_0x2004ce){var _0x5c124d;var _0x1dba3d;var _0x314e5b;if(_0x2004ce<=0x0){_0x2004ce=0x1;}_0x5c124d=new RegExp('\x5cw{0,'+_0x2004ce+'}$');_0x1dba3d=Math['pow'](0xa,_0x2004ce-0x1);_0x314e5b=Math[_0xdaf1('0x160')](0xa,_0x2004ce)-0x1;return util['format']('%s',_[_0xdaf1('0x161')](_0x33ea56,_0x5c124d,_['random'](_0x1dba3d,_0x314e5b)));}function extractCalleridName(_0x4a6f30){var _0x3ec945=_0x4a6f30[_0xdaf1('0x162')](/"(.*?)"/);return _0x3ec945?_0x3ec945[0x1]:_0x4a6f30;}function extractCalleridNumber(_0x12c052){var _0x1834ad=_0x12c052[_0xdaf1('0x162')](/<(.*?)>/);return _0x1834ad?_0x1834ad[0x1]:_0x12c052;}Dialer[_0xdaf1('0x1b')][_0xdaf1('0x163')]=function(_0x3fb85b,_0x3d945c){var _0x4b2693=this;var _0x137856=uuid['v4']();this[_0xdaf1('0x25')][_0x137856]=new Action(_0x3fb85b,_0x3d945c,_0x137856);return new BPromise(function(_0x765f5d,_0x16efc8){if(_[_0xdaf1('0x81')](_0x3fb85b)&&typeof _0x3fb85b!==_0xdaf1('0x164')){return _0x16efc8(msgResponse('originate','Failure',_0xdaf1('0x165')));}if(_[_0xdaf1('0x81')](_0x3d945c[_0xdaf1('0x166')][_0xdaf1('0x167')])||_0x3d945c[_0xdaf1('0x166')]['phone']===null){return _0x16efc8(msgResponse(_0xdaf1('0x168'),'Failure','contact\x20is\x20undefine'));}var _0x4d734b={'XMD-CALLERID':_0x4b2693[_0xdaf1('0x25')][_0x137856][_0xdaf1('0x169')](),'XMD-AGI':_0x3fb85b[_0xdaf1('0x10a')]?util['format'](_0xdaf1('0x16a'),ipAgi,_0x3fb85b[_0xdaf1('0x10a')]):_0xdaf1('0x16b'),'XMD-AGIAFTER':_0x3fb85b[_0xdaf1('0x10e')]?util[_0xdaf1('0x76')](_0xdaf1('0x16a'),ipAgi,_0x3fb85b[_0xdaf1('0x10e')]):'NONE','XMD-QUEUE':_0x3fb85b[_0xdaf1('0x4c')]===_0xdaf1('0x4d')?util[_0xdaf1('0x76')]('\x22%s,%s%s,,,%s\x22',_0x3fb85b[_0xdaf1('0x3f')],_0x3fb85b['dialQueueOptions']||'',_0x3fb85b['dialAgiAfterHangupAgent']?'c':'',_0x3fb85b[_0xdaf1('0x115')]||0x3):_0xdaf1('0x16b'),'XMD-CONTACTID':_0x3d945c['ContactId'],'XMD-CDRTYPE':_0xdaf1('0x8'),'CALLERID(all)':_0x4b2693[_0xdaf1('0x25')][_0x137856]['getCaller'](),'XMD-AMD':_0x3fb85b[_0xdaf1('0xdf')]?_0xdaf1('0x16c'):_0xdaf1('0x16b'),'XMD-DESTINATION':_0xdaf1('0xde')};if(_0x3fb85b[_0xdaf1('0xdf')]){_0x4d734b['XMD-AMDINITIALSILENCE']=_0x3fb85b['dialAMDInitialSilence']||0x9c4;_0x4d734b[_0xdaf1('0x16d')]=_0x3fb85b[_0xdaf1('0x16e')]||0x5dc;_0x4d734b[_0xdaf1('0x16f')]=_0x3fb85b[_0xdaf1('0x170')]||0x320;_0x4d734b[_0xdaf1('0x171')]=_0x3fb85b[_0xdaf1('0x172')]||0x1388;_0x4d734b[_0xdaf1('0x173')]=_0x3fb85b[_0xdaf1('0x174')]||0x64;_0x4d734b[_0xdaf1('0x175')]=_0x3fb85b[_0xdaf1('0x176')]||0x32;_0x4d734b[_0xdaf1('0x177')]=_0x3fb85b[_0xdaf1('0x178')]||0x3;_0x4d734b[_0xdaf1('0x179')]=_0x3fb85b['dialAMDSilenceThreshold']||0x100;_0x4d734b['XMD-AMDMAXIMUMWORDLENGTH']=_0x3fb85b[_0xdaf1('0x17a')]||0x1388;}if(_0x3fb85b[_0xdaf1('0x4c')]===_0xdaf1('0x4d')){_0x4d734b['XMD-VOICEQUEUEID']=_0x3d945c[_0xdaf1('0xd1')];}else{_0x4d734b[_0xdaf1('0x17b')]=_0x3d945c[_0xdaf1('0xd2')];}for(var _0x5985d8 in _0x3d945c['Contact']){if(typeof _0x3d945c[_0xdaf1('0x166')][_0x5985d8]!=='undefined'){if(isNotNull(_0x3d945c[_0xdaf1('0x166')][_0x5985d8])&&_0x5985d8!=='id'&&_0x5985d8!=='tags'&&_0x5985d8!==_0xdaf1('0x17c')&&_0x5985d8!=='updatedAt'){_0x4d734b[util[_0xdaf1('0x76')](_0xdaf1('0x17d'),_0xdaf1('0x17e'),_[_0xdaf1('0x17f')](_0x5985d8))]=_0x3d945c['Contact'][_0x5985d8];}}}var _0xcb6a0f=_0x4b2693[_0xdaf1('0xd6')](_0x3fb85b[_0xdaf1('0x73')])?getCallerId(_0x3fb85b[_0xdaf1('0x73')][_0xdaf1('0x75')],_0x3fb85b[_0xdaf1('0x5a')],_0x3fb85b[_0xdaf1('0x180')]>0x0?getCallerIdRandom(_0x3fb85b['dialOriginateCallerIdNumber'],_0x3fb85b[_0xdaf1('0x180')]):_0x3fb85b[_0xdaf1('0x5b')]):getCallerId(_['isNil'](_0x3fb85b[_0xdaf1('0x181')])?_0x3fb85b['Trunk'][_0xdaf1('0x75')]:_0x3fb85b[_0xdaf1('0x181')]['callerid'],_0x3fb85b[_0xdaf1('0x5a')],_0x3fb85b['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3fb85b[_0xdaf1('0x5b')],_0x3fb85b[_0xdaf1('0x180')]):_0x3fb85b[_0xdaf1('0x5b')]);if(_0xcb6a0f){_0x4d734b[_0xdaf1('0x182')]=_0x4b2693['actions'][_0x137856][_0xdaf1('0x183')]=extractCalleridName(_0xcb6a0f);_0x4d734b[_0xdaf1('0x184')]=_0x4b2693[_0xdaf1('0x25')][_0x137856][_0xdaf1('0x185')]=extractCalleridNumber(_0xcb6a0f);}return ami['Action']({'actionid':_0x137856,'action':_0xdaf1('0x168'),'channel':_0x4b2693[_0xdaf1('0xd6')](_0x3fb85b['Trunk'])?util[_0xdaf1('0x76')](_0xdaf1('0x186'),_0x3fb85b[_0xdaf1('0x73')][_0xdaf1('0x3f')],isNotNull(_0x3fb85b[_0xdaf1('0x187')])?_0x3fb85b['dialPrefix']['trim']()||'':'',_0x3fb85b[_0xdaf1('0x188')]>0x0?_0x3d945c[_0xdaf1('0x166')]['phone'][_0xdaf1('0x189')](_0x3fb85b[_0xdaf1('0x188')]):_0x3d945c['Contact'][_0xdaf1('0x167')]):util[_0xdaf1('0x76')](_0xdaf1('0x186'),_['isNil'](_0x3fb85b[_0xdaf1('0x181')])?_0x3fb85b[_0xdaf1('0x73')][_0xdaf1('0x3f')]:_0x3fb85b[_0xdaf1('0x181')]['name'],isNotNull(_0x3fb85b[_0xdaf1('0x187')])?_0x3fb85b[_0xdaf1('0x187')][_0xdaf1('0x18a')]()||'':'',_0x3fb85b[_0xdaf1('0x188')]>0x0?_0x3d945c['Contact'][_0xdaf1('0x167')][_0xdaf1('0x189')](_0x3fb85b[_0xdaf1('0x188')]):_0x3d945c[_0xdaf1('0x166')][_0xdaf1('0x167')]),'callerid':_0xcb6a0f,'Exten':_0xdaf1('0xde'),'Context':_0xdaf1('0x18b'),'Priority':'1','variable':_0x4d734b,'timeout':(_0x3fb85b[_0xdaf1('0x5c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x137856})[_0xdaf1('0xb3')](function(_0x3459a9){return _0x765f5d(_0x3459a9);})[_0xdaf1('0xad')](function(_0xcef816){_0x3fb85b[_0xdaf1('0x61')]+=0x1;var _0x4e8d8b=new History(_0x4b2693[_0xdaf1('0x25')][_0x137856]);logger[_0xdaf1('0x92')](util[_0xdaf1('0x76')](_0xdaf1('0x18c'),JSON[_0xdaf1('0x49')](_0xcef816)));_0x4e8d8b[_0xdaf1('0xa2')]=0xe;_0x4e8d8b[_0xdaf1('0xe3')]=_0xdaf1('0x18d');_0x4e8d8b[_0xdaf1('0xa4')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4e8d8b[_0xdaf1('0xa3')]=_0x4e8d8b[_0xdaf1('0xa4')];_0x4b2693[_0xdaf1('0xc7')](_0x4e8d8b)[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x18e')));_0x4b2693[_0xdaf1('0xc5')](_0x4e8d8b)[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x18e')))['finally'](function(){delete _0x4b2693['actions'][_0x137856];return _0x16efc8(msgResponse(_0xdaf1('0x168'),_0xdaf1('0x48'),_0xdaf1('0x18f')));});});});};Dialer['prototype'][_0xdaf1('0x33')]=function(_0x3a464c){var _0x149e2e=this[_0xdaf1('0x25')][_0x3a464c['actionid']];if(_0x149e2e){delete this[_0xdaf1('0x25')][_0x3a464c[_0xdaf1('0x124')]];_0x149e2e[_0xdaf1('0x190')]=moment()['format'](_0xdaf1('0xfd'));var _0x12c92d=_0x149e2e[_0xdaf1('0x4c')]===_0xdaf1('0x79')?this[_0xdaf1('0x21')][_0x149e2e[_0xdaf1('0xb0')]]:this[_0xdaf1('0x20')][_0x149e2e['getQueue']()];if(!this[_0xdaf1('0xd4')](_0x3a464c[_0xdaf1('0x191')])){this[_0xdaf1('0xaf')](_0x12c92d);return this[_0xdaf1('0x192')](_0x149e2e,_0x12c92d,_0x3a464c)[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x193')));}this['uniqueId'][_0x3a464c[_0xdaf1('0xda')]]=_0x149e2e;}};Dialer['prototype']['checkRetriveMax']=function(_0x4fb701,_0x4c2a2d,_0x12a2c9){var _0x29ccec=new History(_0x4c2a2d);if(_0x29ccec[_0xdaf1('0xf3')]+_0x29ccec[_0xdaf1('0x100')]+_0x29ccec[_0xdaf1('0x101')]+_0x29ccec[_0xdaf1('0xf4')]+_0x29ccec[_0xdaf1('0x116')]+_0x29ccec[_0xdaf1('0x102')]+_0x29ccec[_0xdaf1('0xef')]+_0x29ccec[_0xdaf1('0x103')]>=_0x12a2c9[_0xdaf1('0xf5')]-0x1){return!![];}switch(_0x4fb701){case 0x3:if(_0x29ccec[_0xdaf1('0x101')]>=_0x12a2c9[_0xdaf1('0x194')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x29ccec[_0xdaf1('0x101')]+=0x1,'scheduledat':moment()[_0xdaf1('0x104')](_0x12a2c9['dialNoAnswerRetryFrequency'],_0xdaf1('0xfc'))[_0xdaf1('0x76')](_0xdaf1('0xfd')),'ContactId':_0x29ccec['ContactId'],'ListId':_0x29ccec['ListId'],'VoiceQueueId':_0x29ccec['VoiceQueueId']||undefined,'CampaignId':_0x29ccec[_0xdaf1('0xd2')]||undefined})[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x195')));break;case 0x5:if(_0x29ccec[_0xdaf1('0xf3')]>=_0x12a2c9['dialBusyMaxRetry']-0x1){return!![];}this[_0xdaf1('0xba')]({'active':![],'countbusyretry':_0x29ccec[_0xdaf1('0xf3')]+=0x1,'scheduledat':moment()[_0xdaf1('0x104')](_0x12a2c9[_0xdaf1('0x196')],_0xdaf1('0xfc'))[_0xdaf1('0x76')](_0xdaf1('0xfd')),'ContactId':_0x29ccec[_0xdaf1('0xce')],'ListId':_0x29ccec[_0xdaf1('0xcf')],'VoiceQueueId':_0x29ccec[_0xdaf1('0xd1')]||undefined,'CampaignId':_0x29ccec[_0xdaf1('0xd2')]||undefined})[_0xdaf1('0xad')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x29ccec[_0xdaf1('0x100')]>=_0x12a2c9['dialCongestionMaxRetry']-0x1){return!![];}this[_0xdaf1('0xba')]({'active':![],'countcongestionretry':_0x29ccec[_0xdaf1('0x100')]+=0x1,'scheduledat':moment()[_0xdaf1('0x104')](_0x12a2c9['dialCongestionRetryFrequency'],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x29ccec[_0xdaf1('0xce')],'ListId':_0x29ccec[_0xdaf1('0xcf')],'VoiceQueueId':_0x29ccec[_0xdaf1('0xd1')]||undefined,'CampaignId':_0x29ccec[_0xdaf1('0xd2')]||undefined})['catch'](loggerCatch(_0xdaf1('0x197')));break;case 0x0:if(_0x29ccec[_0xdaf1('0xf4')]>=_0x12a2c9[_0xdaf1('0x198')]-0x1){return!![];}else{this[_0xdaf1('0xba')]({'active':![],'countnosuchnumberretry':_0x29ccec[_0xdaf1('0xf4')]+=0x1,'scheduledat':moment()[_0xdaf1('0x104')](_0x12a2c9[_0xdaf1('0x199')],_0xdaf1('0xfc'))[_0xdaf1('0x76')](_0xdaf1('0xfd')),'ContactId':_0x29ccec[_0xdaf1('0xce')],'ListId':_0x29ccec[_0xdaf1('0xcf')],'VoiceQueueId':_0x29ccec[_0xdaf1('0xd1')]||undefined,'CampaignId':_0x29ccec[_0xdaf1('0xd2')]||undefined})[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x19a')));}break;case 0xa:if(_0x29ccec[_0xdaf1('0x116')]>=_0x12a2c9[_0xdaf1('0x117')]-0x1){return!![];}this[_0xdaf1('0xba')]({'active':![],'countdropretry':_0x29ccec[_0xdaf1('0x116')]+=0x1,'scheduledat':moment()[_0xdaf1('0x104')](_0x12a2c9[_0xdaf1('0x19b')],'minutes')['format'](_0xdaf1('0xfd')),'ContactId':_0x29ccec['ContactId'],'ListId':_0x29ccec[_0xdaf1('0xcf')],'VoiceQueueId':_0x29ccec[_0xdaf1('0xd1')]||undefined,'CampaignId':_0x29ccec['CampaignId']||undefined})['catch'](loggerCatch(_0xdaf1('0x118')));break;case 0xb:if(_0x29ccec['countabandonedretry']>=_0x12a2c9['dialAbandonedMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x29ccec[_0xdaf1('0x102')]+=0x1,'scheduledat':moment()[_0xdaf1('0x104')](_0x12a2c9[_0xdaf1('0x121')],'minutes')[_0xdaf1('0x76')](_0xdaf1('0xfd')),'ContactId':_0x29ccec[_0xdaf1('0xce')],'ListId':_0x29ccec[_0xdaf1('0xcf')],'VoiceQueueId':_0x29ccec[_0xdaf1('0xd1')]||undefined,'CampaignId':_0x29ccec['CampaignId']||undefined})['catch'](loggerCatch(_0xdaf1('0x19c')));break;case 0x13:if(_0x29ccec['countmachineretry']>=_0x12a2c9[_0xdaf1('0xf8')]-0x1){return!![];}this[_0xdaf1('0xba')]({'active':![],'countmachineretry':_0x29ccec['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x12a2c9['dialMachineRetryFrequency'],'minutes')[_0xdaf1('0x76')](_0xdaf1('0xfd')),'ContactId':_0x29ccec[_0xdaf1('0xce')],'ListId':_0x29ccec['ListId'],'VoiceQueueId':_0x29ccec['VoiceQueueId']||undefined,'CampaignId':_0x29ccec[_0xdaf1('0xd2')]||undefined})[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x105')));break;case 0x14:if(_0x29ccec['countagentrejectretry']>=_0x12a2c9[_0xdaf1('0x19d')]-0x1){return!![];}this[_0xdaf1('0xba')]({'active':![],'countagentrejectretry':_0x29ccec['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xdaf1('0x104')](_0x12a2c9[_0xdaf1('0x19e')],_0xdaf1('0xfc'))[_0xdaf1('0x76')](_0xdaf1('0xfd')),'ContactId':_0x29ccec['ContactId'],'ListId':_0x29ccec['ListId'],'VoiceQueueId':_0x29ccec[_0xdaf1('0xd1')]||undefined,'CampaignId':_0x29ccec[_0xdaf1('0xd2')]||undefined})['catch'](loggerCatch(_0xdaf1('0x19f')));break;default:return!![];}};Dialer[_0xdaf1('0x1b')][_0xdaf1('0x192')]=function(_0x2d18d1,_0x51774d,_0x53e004){var _0x34eeff=this;var _0x228189=new History(_0x2d18d1);return new BPromise(function(_0xffd37a,_0x4be1f6){if(_[_0xdaf1('0x81')](_0x51774d)&&typeof _0x51774d!==_0xdaf1('0x164')){return _0x4be1f6(msgResponse(_0xdaf1('0x1a0'),_0xdaf1('0x142'),_0xdaf1('0x1a1')));}if(_[_0xdaf1('0x81')](_0x53e004)&&typeof _0x53e004!==_0xdaf1('0x164')){return _0x4be1f6(msgResponse(_0xdaf1('0x1a0'),_0xdaf1('0x142'),_0xdaf1('0x1a2')));}switch(_0x53e004[_0xdaf1('0x10c')]){case'0':_0x51774d[_0xdaf1('0x1a3')]+=0x1;_0x228189['state']=0x0;_0x228189[_0xdaf1('0xe3')]=_0xdaf1('0x1a4');_0x228189[_0xdaf1('0xf4')]+=0x1;_0x228189[_0xdaf1('0xf0')]+=0x1;ami[_0xdaf1('0xf1')](_0xdaf1('0x1a5'),ut['buildObj'](_0x2d18d1,'nosuchnumber'));_0x34eeff[_0xdaf1('0xc7')](_0x228189)[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0xf2')));if(_0x34eeff[_0xdaf1('0x1a6')](0x0,_0x2d18d1,_0x51774d)){if(_0x228189[_0xdaf1('0xf4')]>=_0x51774d['dialNoSuchNumberMaxRetry']){_0x34eeff['createStateFinal'](_0x228189,_0xffd37a,_0x4be1f6,_0xdaf1('0x1a7'));}else{_0x34eeff[_0xdaf1('0xf6')](_0x228189,_0xffd37a,_0x4be1f6,_0xdaf1('0x1a7'));}}break;case'3':_0x51774d['outboundNoAnswerCallsDay']+=0x1;_0x228189[_0xdaf1('0xa2')]=0x3;_0x228189[_0xdaf1('0xe3')]=_0xdaf1('0x1a8');_0x228189[_0xdaf1('0x101')]+=0x1;_0x228189[_0xdaf1('0xf0')]+=0x1;ami['emit'](_0xdaf1('0x1a9'),ut[_0xdaf1('0xe8')](_0x2d18d1,_0xdaf1('0x1aa')));_0x34eeff['createHistory'](_0x228189)[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x1ab')));if(_0x34eeff[_0xdaf1('0x1a6')](0x3,_0x2d18d1,_0x51774d)){if(_0x228189['countnoanswerretry']>=_0x51774d[_0xdaf1('0x194')]){_0x34eeff[_0xdaf1('0xf9')](_0x228189,_0xffd37a,_0x4be1f6,'reason\x203\x20ringing\x20no\x20answer');}else{_0x34eeff[_0xdaf1('0xf6')](_0x228189,_0xffd37a,_0x4be1f6,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x51774d[_0xdaf1('0x1ac')]+=0x1;_0x228189[_0xdaf1('0xa2')]=0x5;_0x228189[_0xdaf1('0xe3')]=_0xdaf1('0x1ad');_0x228189[_0xdaf1('0xf3')]+=0x1;_0x228189['countglobal']+=0x1;ami[_0xdaf1('0xf1')]('custom:agentbusy',ut[_0xdaf1('0xe8')](_0x2d18d1,_0xdaf1('0x1ae')));_0x34eeff['createHistory'](_0x228189)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x34eeff[_0xdaf1('0x1a6')](0x5,_0x2d18d1,_0x51774d)){if(_0x228189[_0xdaf1('0xf3')]>=_0x51774d['dialBusyMaxRetry']){_0x34eeff['createStateFinal'](_0x228189,_0xffd37a,_0x4be1f6,'reason\x205\x20busy');}else{_0x34eeff[_0xdaf1('0xf6')](_0x228189,_0xffd37a,_0x4be1f6,'reason\x205\x20busy');}}break;case'8':_0x51774d[_0xdaf1('0x1af')]+=0x1;_0x228189['state']=0x8;_0x228189[_0xdaf1('0xe3')]=_0xdaf1('0x1b0');_0x228189[_0xdaf1('0x100')]+=0x1;_0x228189[_0xdaf1('0xf0')]+=0x1;ami[_0xdaf1('0xf1')](_0xdaf1('0x1b1'),ut['buildObj'](_0x2d18d1,_0xdaf1('0x1b2')));_0x34eeff[_0xdaf1('0xc7')](_0x228189)[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x1b3')));if(_0x34eeff[_0xdaf1('0x1a6')](0x8,_0x2d18d1,_0x51774d)){if(_0x228189[_0xdaf1('0x100')]>=_0x51774d[_0xdaf1('0x1b4')]){_0x34eeff['createStateFinal'](_0x228189,_0xffd37a,_0x4be1f6,_0xdaf1('0x1b5'));}else{_0x34eeff['stateGlobal'](_0x228189,_0xffd37a,_0x4be1f6,_0xdaf1('0x1b5'));}}break;case'11':_0x51774d[_0xdaf1('0x1b6')]+=0x1;_0x228189[_0xdaf1('0xa2')]=0xb;_0x228189[_0xdaf1('0xe3')]=_0xdaf1('0x11d');_0x228189[_0xdaf1('0x102')]+=0x1;_0x228189['countglobal']+=0x1;_0x34eeff[_0xdaf1('0xc7')](_0x228189)[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x122')));if(_0x34eeff[_0xdaf1('0x1a6')](0xb,_0x2d18d1,_0x51774d)){if(_0x228189[_0xdaf1('0x102')]>=_0x51774d[_0xdaf1('0x120')]){_0x34eeff[_0xdaf1('0xf9')](_0x228189,_0xffd37a,_0x4be1f6,_0xdaf1('0x1b7'));}else{_0x34eeff['stateGlobal'](_0x228189,_0xffd37a,_0x4be1f6,'reason\x2011\x20abandoned');}}break;case'20':_0x51774d['outboundRejectCallsDay']+=0x1;_0x228189[_0xdaf1('0xa2')]=0x14;_0x228189['statedesc']=_0xdaf1('0x1b8');_0x228189[_0xdaf1('0x103')]+=0x1;_0x228189[_0xdaf1('0xf0')]+=0x1;ami['emit'](_0xdaf1('0x1b9'),ut[_0xdaf1('0xe8')](_0x2d18d1,_0xdaf1('0x1ba')));_0x34eeff[_0xdaf1('0xc7')](_0x228189)[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x1bb')));if(_0x34eeff['checkRetriveMax'](0x14,_0x2d18d1,_0x51774d)){if(_0x228189[_0xdaf1('0x103')]>=_0x51774d['dialAgentRejectMaxRetry']){_0x34eeff[_0xdaf1('0xf9')](_0x228189,_0xffd37a,_0x4be1f6,_0xdaf1('0x1bc'));}else{_0x34eeff[_0xdaf1('0xf6')](_0x228189,_0xffd37a,_0x4be1f6,_0xdaf1('0x1bc'));}}break;default:_0x51774d[_0xdaf1('0x1bd')]+=0x1;_0x228189[_0xdaf1('0xa2')]=0xc;_0x228189[_0xdaf1('0xe3')]=_0x53e004['reason'];_0x34eeff[_0xdaf1('0xc7')](_0x228189)['catch'](loggerCatch(_0xdaf1('0x1be')));if(_0x34eeff[_0xdaf1('0x1a6')](_0x53e004[_0xdaf1('0x10c')],_0x2d18d1,_0x51774d)){if(_0x228189[_0xdaf1('0xf3')]+_0x228189[_0xdaf1('0x100')]+_0x228189['countnoanswerretry']+_0x228189[_0xdaf1('0xf4')]+_0x228189[_0xdaf1('0x116')]+_0x228189[_0xdaf1('0x102')]+_0x228189['countmachineretry']+_0x228189[_0xdaf1('0x103')]>=_0x51774d[_0xdaf1('0xf5')]){_0x34eeff[_0xdaf1('0xf6')](_0x228189,_0xffd37a,_0x4be1f6,_0x53e004['reason']);}else{_0x34eeff[_0xdaf1('0xf9')](_0x228189,_0xffd37a,_0x4be1f6,_0x53e004[_0xdaf1('0x10c')]);}}}});};Dialer[_0xdaf1('0x1b')][_0xdaf1('0xf6')]=function(_0x5217f0,_0x38af68,_0x382105,_0x4d7d59){var _0x4c7532=new Final(_0x5217f0);_0x4c7532['state']=0xf;_0x4c7532['statedesc']=_0xdaf1('0x1bf');this[_0xdaf1('0xf9')](_0x4c7532,_0x38af68,_0x382105,_0x4d7d59);};Dialer[_0xdaf1('0x1b')][_0xdaf1('0xf9')]=function(_0x205bf9,_0x141936,_0x44e9a2,_0x3e0f20){this[_0xdaf1('0xc5')](_0x205bf9)[_0xdaf1('0xb3')](function(){return _0x141936(msgResponse(_0xdaf1('0x1a0'),_0xdaf1('0xd5'),_0x3e0f20));})[_0xdaf1('0xad')](function(){return _0x44e9a2(msgResponse(_0xdaf1('0x1c0'),_0xdaf1('0x142'),_0xdaf1('0x1c1')));});};Dialer['prototype'][_0xdaf1('0x158')]=function(_0x232963){var _0x168262=_0x232963[_0xdaf1('0x1c2')]/0x64;var _0x2df294=_0x232963[_0xdaf1('0x60')]/(_0x232963[_0xdaf1('0x60')]+_0x232963[_0xdaf1('0xe1')]);var _0x14a935=Math['round'](_0x232963[_0xdaf1('0x6d')]*(_0x232963[_0xdaf1('0x1c3')]/0x64));var _0x15e8d9=Math[_0xdaf1('0x1c4')](_0x232963['predictiveIntervalAvailable']*(_0x232963[_0xdaf1('0x1c5')]/0x64));var _0x252c9d=_0x232963[_0xdaf1('0x9c')]+_0x232963[_0xdaf1('0x1c6')];var _0x1af342=Math[_0xdaf1('0x1c7')](_0x232963['erlangCalls']*_0x232963[_0xdaf1('0x71')]*_0x232963[_0xdaf1('0x6a')]*_0x232963[_0xdaf1('0x6b')]);if(_[_0xdaf1('0x81')](_0x232963[_0xdaf1('0x29')])){if(!_[_0xdaf1('0x81')](_0x232963[_0xdaf1('0x28')])){_0x232963['startPredictive']=undefined;loggerPredictive[_0xdaf1('0x92')](_0xdaf1('0x1c8'),_0xdaf1('0x1c9'));}if(!_['isUndefined'](_0x232963['handlePredictive'])){loggerPredictive[_0xdaf1('0x92')](_0xdaf1('0x1c8'),_0xdaf1('0x1ca'));clearInterval(_0x232963[_0xdaf1('0x8e')]);_0x232963[_0xdaf1('0x8e')]=undefined;}_0x232963[_0xdaf1('0x29')]=moment()[_0xdaf1('0x76')](_0xdaf1('0xfd'));loggerPredictive[_0xdaf1('0x7e')](_0x232963['name'],_0xdaf1('0x1cb'),_0x232963['startProgressive']);this[_0xdaf1('0x156')](_0x232963,0x1);}else if(ifInterval(_0x232963[_0xdaf1('0x1cc')],_0x232963[_0xdaf1('0x29')])){this[_0xdaf1('0x156')](_0x232963,0x1);loggerPredictiveCalls[_0xdaf1('0x7e')](_0xdaf1('0x1cd'),_0x232963[_0xdaf1('0x29')],_0x232963[_0xdaf1('0x3f')]);_0x232963[_0xdaf1('0x70')]=0x0;_0x232963[_0xdaf1('0x69')]=0x0;}else if(_0x168262<_0x2df294&&_0x232963['dialPredictiveOptimization']===_0xdaf1('0x1ce')){freeVariablesPredictive(_0x232963);loggerPredictive['info'](_0xdaf1('0x1cf'),_0xdaf1('0x1d0'),_0x2df294,_0xdaf1('0x29'),_0x232963['name']);}else if(_0x1af342<_0x232963[_0xdaf1('0x69')]&&_0x232963[_0xdaf1('0x1d1')]==='dropRate'){freeVariablesPredictive(_0x232963);loggerPredictive[_0xdaf1('0x7e')](_0xdaf1('0x1d2'),'Max\x20Drop\x20',_0x1af342,'Drop\x20in\x20this\x20interval',_0x232963['predictiveIntervalErlangCallsDroppedCalls'],_0xdaf1('0x29'),_0x232963[_0xdaf1('0x3f')]);}else if(!ifInterval(_0x232963['dialPredictiveInterval'],_0x232963[_0xdaf1('0x29')])&&_[_0xdaf1('0x81')](_0x232963[_0xdaf1('0x28')])&&!_[_0xdaf1('0x81')](_0x232963[_0xdaf1('0x29')])){_0x232963[_0xdaf1('0x28')]=moment()[_0xdaf1('0x76')](_0xdaf1('0xfd'));loggerPredictive['info'](_0x232963['name'],'started\x20in\x20predictive\x20at',_0x232963[_0xdaf1('0x28')]);this[_0xdaf1('0xb9')](_0x232963[_0xdaf1('0x1cc')])[_0xdaf1('0xb3')](this[_0xdaf1('0x1d3')](_0x232963))[_0xdaf1('0xb3')](mergeDataErlangB(_0x232963))['then'](this[_0xdaf1('0x1d4')](_0x232963))['catch'](loggerCatchPredictive(_0xdaf1('0x1d5'),_0x232963));}else if(!ifInterval(_0x232963[_0xdaf1('0x1cc')],_0x232963['startPredictive'])){_0x232963[_0xdaf1('0x69')]=0x0;_0x232963[_0xdaf1('0x28')]=moment()[_0xdaf1('0x76')](_0xdaf1('0xfd'));loggerPredictive[_0xdaf1('0x7e')](_0x232963[_0xdaf1('0x3f')],'recalculate\x20predictive\x20at',_0x232963[_0xdaf1('0x28')]);clearInterval(_0x232963[_0xdaf1('0x8e')]);_0x232963[_0xdaf1('0x8e')]=undefined;this[_0xdaf1('0xb9')](_0x232963[_0xdaf1('0x1cc')])['then'](this[_0xdaf1('0x1d3')](_0x232963))[_0xdaf1('0xb3')](mergeDataErlangB(_0x232963))[_0xdaf1('0xb3')](this['startMethodPredictive'](_0x232963))[_0xdaf1('0xad')](loggerCatchPredictive(_0xdaf1('0x1d6'),_0x232963));}else if(_0x232963['predictiveIntervalAvailable']&&_0x252c9d<_0x232963['predictiveIntervalAvailable']-_0x15e8d9){freeVariablesPredictive(_0x232963);loggerPredictive[_0xdaf1('0x7e')](_0x232963[_0xdaf1('0x3f')],_0xdaf1('0x1d7'),_0x252c9d,_0xdaf1('0x1d8'),_0x232963[_0xdaf1('0x6d')],'-',_0x15e8d9,'=',_0x232963[_0xdaf1('0x6d')]-_0x15e8d9,')');}else if(_0x232963['predictiveIntervalAvailable']&&_0x252c9d>_0x232963['predictiveIntervalAvailable']+_0x14a935){freeVariablesPredictive(_0x232963);loggerPredictive['info'](_0x232963[_0xdaf1('0x3f')],_0xdaf1('0x1d7'),_0x252c9d,_0xdaf1('0x1d9'),_0x232963['predictiveIntervalAvailable'],'+',_0x14a935,'=',_0x232963[_0xdaf1('0x6d')]+_0x14a935,')');}};Dialer[_0xdaf1('0x1b')][_0xdaf1('0x1d3')]=function(_0x289bda){var _0x4a520c=this;return function(_0x27d430){return new BPromise(function(_0x44508c,_0x4fc624){_['merge'](_0x289bda,_0x27d430[0x0]);if(checkGetDataPredictive(_0x27d430[0x0])){var _0x4f2440=_0x289bda[_0xdaf1('0x6d')]=_0x289bda[_0xdaf1('0x1c6')]+_0x289bda[_0xdaf1('0x9c')];var _0x45566c=_0x289bda[_0xdaf1('0x1cc')]*0x3c;var _0xe0beb4=_0x27d430[0x0][_0xdaf1('0x65')]+_0x27d430[0x0]['predictiveIntervalAvgHoldtime'];var _0x1aa70e=(_0x27d430[0x0]['predictiveIntervalAnsweredCalls']+_0x27d430[0x0][_0xdaf1('0x67')]+_0x27d430[0x0][_0xdaf1('0x66')])/_0x27d430[0x0][_0xdaf1('0x6e')];_0x289bda[_0xdaf1('0x6a')]=_0x1aa70e>0x0?_0x1aa70e:0x1;switch(_0x289bda[_0xdaf1('0x1d1')]){case _0xdaf1('0x1ce'):var _0x40091e=_0x289bda[_0xdaf1('0x1c2')]/0x64;return _0x4a520c[_0xdaf1('0x1da')](_0x4f2440,_0x45566c,_0xe0beb4,_0x1aa70e,_0x40091e)['then'](function(_0x2d470f){return _0x44508c(_0x2d470f);});case'agentBusyFactor':var _0x37687f=_0x289bda[_0xdaf1('0x1c2')]/0x64;return _0x4a520c['busyFactor'](_0x4f2440,_0x45566c,_0xe0beb4,_0x1aa70e,_0x37687f)[_0xdaf1('0xb3')](function(_0x4ca9dd){return _0x44508c(_0x4ca9dd);});default:return _0x4fc624(msgResponse(_0xdaf1('0x1db'),_0xdaf1('0x142'),_0xdaf1('0x1dc')));}}else{return _0x4fc624(msgResponse(_0xdaf1('0x1db'),'Failure',_0xdaf1('0x1dd')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x25225d){var _0x269f97=this;return function(_0x3bdc74){return new BPromise(function(_0xefbeec,_0x2185d5){_[_0xdaf1('0x8b')](_0x25225d,_0x3bdc74[0x0]);if(checkGetDataPredictive(_0x3bdc74[0x0])){loggerPredictive[_0xdaf1('0x7e')](JSON[_0xdaf1('0x49')](_0x3bdc74[0x0]));if(_0x25225d[_0xdaf1('0x1d1')]===_0xdaf1('0x1ce')){return _0x269f97[_0xdaf1('0xc3')](_0x25225d['id'])['then'](function(_0x1f002d){var _0x536af3=_0x25225d[_0xdaf1('0x4f')]-_0x1f002d[0x0][_0xdaf1('0x1de')];var _0x453542=_0x25225d[_0xdaf1('0x1cc')]*0x3c;var _0x3612a6=_0x3bdc74[0x0][_0xdaf1('0x65')]+_0x3bdc74[0x0]['predictiveIntervalAvgHoldtime'];var _0xdbac0=(_0x3bdc74[0x0][_0xdaf1('0x64')]+_0x3bdc74[0x0][_0xdaf1('0x67')]+_0x3bdc74[0x0][_0xdaf1('0x66')])/_0x3bdc74[0x0][_0xdaf1('0x6e')];var _0x1d1b5e=_0x25225d[_0xdaf1('0x1c2')]/0x64;_0x25225d[_0xdaf1('0x6c')]=_0x1f002d[0x0]['outboundQueuePauses']||0x0;_0x25225d[_0xdaf1('0x6a')]=_0xdbac0>0x0?_0xdbac0:0x1;return _0x269f97[_0xdaf1('0x1da')](_0x536af3,_0x453542,_0x3612a6,_0xdbac0,_0x1d1b5e);})[_0xdaf1('0xb3')](function(_0x563f47){return _0xefbeec(_0x563f47);})[_0xdaf1('0xad')](function(_0x1c6b80){return _0x2185d5(msgResponse('[CatchErlangB]',_0xdaf1('0x142'),JSON[_0xdaf1('0x49')](_0x1c6b80)));});}if(_0x25225d[_0xdaf1('0x1d1')]==='agentBusyFactor'){return _0x269f97[_0xdaf1('0xc3')](_0x25225d['id'])[_0xdaf1('0xb3')](function(_0x830d86){var _0x2acb65=_0x25225d[_0xdaf1('0x4f')]-_0x830d86[0x0]['outboundQueuePauses'];var _0x3b8253=_0x25225d[_0xdaf1('0x1cc')]*0x3c;var _0x4c6263=_0x3bdc74[0x0][_0xdaf1('0x65')]+_0x3bdc74[0x0][_0xdaf1('0x80')];var _0x157bec=(_0x3bdc74[0x0][_0xdaf1('0x64')]+_0x3bdc74[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3bdc74[0x0][_0xdaf1('0x66')])/_0x3bdc74[0x0][_0xdaf1('0x6e')];var _0x13f04e=_0x25225d[_0xdaf1('0x1c2')]/0x64;_0x25225d[_0xdaf1('0x6c')]=_0x830d86[0x0][_0xdaf1('0x1de')]||0x0;_0x25225d['predictiveIntervalHitRate']=_0x157bec>0x0?_0x157bec:0x1;return _0x269f97[_0xdaf1('0x1df')](_0x2acb65,_0x3b8253,_0x4c6263,_0x157bec,_0x13f04e);})['then'](function(_0x1b8f17){return _0xefbeec(_0x1b8f17);})[_0xdaf1('0xad')](function(_0x9e4f7a){return _0x2185d5(msgResponse(_0xdaf1('0x1e0'),_0xdaf1('0x142'),JSON[_0xdaf1('0x49')](_0x9e4f7a)));});}}else{return _0x2185d5(msgResponse(_0xdaf1('0x1db'),_0xdaf1('0x142'),_0xdaf1('0x1dd')));}});};};Dialer[_0xdaf1('0x1b')][_0xdaf1('0x1d4')]=function(_0x11a20b){var _0x218996=this;return function(){var _0x3d3ca4=0x0;var _0x2e0431=Math[_0xdaf1('0x1c7')](_0x11a20b['erlangCallToSecond']*0x3e8);if(_0x2e0431>0x0){_0x2e0431=_0x2e0431<0x64?0x64:_0x2e0431;loggerPredictive[_0xdaf1('0x7e')](_0x11a20b[_0xdaf1('0x3f')],'one\x20call\x20every:',_0x2e0431,_0xdaf1('0x4a'));_0x11a20b['handlePredictive']=setInterval(function(){_0x218996[_0xdaf1('0x8e')](_0x11a20b);loggerPredictiveCalls['info']('[handlePredictive]',_0x3d3ca4+=0x1);},_0x2e0431);}else{loggerPredictive[_0xdaf1('0x7e')](_0x11a20b[_0xdaf1('0x3f')],_0xdaf1('0x1e1'));}};};Dialer['prototype'][_0xdaf1('0x1e2')]=function(_0x129eee,_0x56dde3){var _0x5c1fbe=this;return function(_0x18d3a8){if(_[_0xdaf1('0x46')](_0x18d3a8)){if(_['isNil'](_0x56dde3[_0xdaf1('0xd0')])||!_0x56dde3[_0xdaf1('0x1e3')]){if(_0x129eee[_0xdaf1('0x59')]===_0xdaf1('0x9')){_0x129eee[_0xdaf1('0x12b')]=_[_0xdaf1('0x81')](_0x129eee[_0xdaf1('0x12b')])?!![]:_0x129eee[_0xdaf1('0x12b')];var _0x4ce298=uuid['v4']();_0x5c1fbe['actions'][_0x4ce298]=new Action(_0x129eee,_0x56dde3,_0x4ce298);loggerBooked[_0xdaf1('0x7e')](_0xdaf1('0x1e4'),_0x4ce298,_0xdaf1('0x1e5'),JSON[_0xdaf1('0x49')](_0x129eee[_0xdaf1('0x12b')]),_0xdaf1('0x1e6'),_0x129eee[_0xdaf1('0x3f')]);if(_0x129eee[_0xdaf1('0x12b')]){_0x129eee[_0xdaf1('0x12b')]=![];_0x5c1fbe['queueBooked'][_0x5c1fbe['actions'][_0x4ce298][_0xdaf1('0xb0')]]=[];ami['Action']({'actionid':_0x4ce298,'action':'queuestatus','queue':_0x129eee[_0xdaf1('0x3f')]})[_0xdaf1('0xad')](function(){_0x5c1fbe[_0xdaf1('0xaf')](_0x129eee);_0x5c1fbe[_0xdaf1('0xba')]({'active':![],'ContactId':_0x5c1fbe[_0xdaf1('0x25')][_0x4ce298]['ContactId'],'ListId':_0x5c1fbe[_0xdaf1('0x25')][_0x4ce298]['ListId'],'VoiceQueueId':_0x5c1fbe[_0xdaf1('0x25')][_0x4ce298][_0xdaf1('0xd1')]||undefined,'CampaignId':_0x5c1fbe['actions'][_0x4ce298][_0xdaf1('0xd2')]||undefined})['catch'](loggerCatch(_0xdaf1('0x1e7')));delete _0x5c1fbe[_0xdaf1('0x25')][_0x4ce298];});}else{loggerBooked[_0xdaf1('0x7e')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x129eee[_0xdaf1('0x12b')]),'Queue:\x20',_0x129eee[_0xdaf1('0x3f')]);_0x5c1fbe[_0xdaf1('0xaf')](_0x129eee);_0x5c1fbe[_0xdaf1('0xba')]({'active':![],'ContactId':_0x5c1fbe[_0xdaf1('0x25')][_0x4ce298]['ContactId'],'ListId':_0x5c1fbe['actions'][_0x4ce298][_0xdaf1('0xcf')],'VoiceQueueId':_0x5c1fbe[_0xdaf1('0x25')][_0x4ce298][_0xdaf1('0xd1')]||undefined,'CampaignId':_0x5c1fbe[_0xdaf1('0x25')][_0x4ce298][_0xdaf1('0xd2')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x5c1fbe[_0xdaf1('0x25')][_0x4ce298];}}else{return _0x5c1fbe[_0xdaf1('0x163')](_0x129eee,_0x56dde3);}}else{if(getDiff(_0x56dde3[_0xdaf1('0x1e8')])<_0x129eee[_0xdaf1('0x1e9')]*0x3c){if(_0x56dde3['Agent']&&!_0x56dde3[_0xdaf1('0x1ea')][_0xdaf1('0x1eb')]){_0x5c1fbe[_0xdaf1('0x1f')][_0xdaf1('0x12e')](_0x56dde3['id'])[_0xdaf1('0x130')](function(){_0x5c1fbe['updateOriginated'](_0x129eee);});}else{_0x5c1fbe[_0xdaf1('0xbc')]({'active':![]},_0x56dde3['id'],0x1)[_0xdaf1('0x130')](function(){_0x5c1fbe[_0xdaf1('0xaf')](_0x129eee);});}}else{_0x129eee['outboundReCallsDay']+=0x1;_0x5c1fbe['updateOriginated'](_0x129eee);if(_0x129eee[_0xdaf1('0x1ec')]){_0x5c1fbe[_0xdaf1('0xba')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x56dde3[_0xdaf1('0xce')],'ListId':_0x56dde3[_0xdaf1('0xcf')],'VoiceQueueId':_0x56dde3[_0xdaf1('0xd1')]||undefined,'CampaignId':_0x56dde3[_0xdaf1('0xd2')]||undefined})[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x1ed')));_0x5c1fbe[_0xdaf1('0xc7')](createObjHistory(_0x129eee,_0x56dde3,_0xdaf1('0x1ee'),0x17,_0xdaf1('0x1ef')))[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x1f0')));}else{_0x5c1fbe['saveInDb'](createObjHistory(_0x129eee,_0x56dde3,_0xdaf1('0x1f1'),0x16,_0xdaf1('0x1f2')),_0xdaf1('0x1f3'),_0xdaf1('0x1f4'));}}}}else{_0x129eee['outboundBlacklistCallsDay']+=0x1;_0x5c1fbe[_0xdaf1('0xcd')](createObjHistory(_0x129eee,_0x56dde3,_0xdaf1('0x1f5'),0xd,_0xdaf1('0x1f6')),'[Originate][historyBlacklist]',_0xdaf1('0x1f7'));throw'inBlackList';}};};Dialer[_0xdaf1('0x1b')][_0xdaf1('0x15b')]=function(_0x40281a){var _0x3c1736=this;var _0x50a4ba=_0x40281a[_0xdaf1('0x1f8')]-_0x40281a[_0xdaf1('0x6f')]-_0x40281a['temp'];emitCampaignSummary(_0x40281a);if(_0x50a4ba>0x0){if(_0x50a4ba>this[_0xdaf1('0x24')]){_0x50a4ba=this[_0xdaf1('0x24')];}_0x40281a[_0xdaf1('0xbf')]+=_0x50a4ba;this[_0xdaf1('0xc1')](_0x40281a['id'],_0x50a4ba,_0x40281a[_0xdaf1('0x1f9')],_0x40281a)[_0xdaf1('0xb3')](function(_0x1b1af6){_0x40281a['temp']-=_0x50a4ba;_0x40281a[_0xdaf1('0xbf')]=_0x40281a[_0xdaf1('0xbf')]>0x0?_0x40281a[_0xdaf1('0xbf')]:0x0;if(!checkContactEmpty(_0x1b1af6)){_0x40281a['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xdaf1('0x7e')](_0xdaf1('0x1fa')+_0x40281a[_0xdaf1('0x3f')]);}else{_0x40281a['originated']+=_0x1b1af6['length'];_0x40281a['message']=_0xdaf1('0x1fb');for(var _0x31c55d=0x0;_0x31c55d<_0x1b1af6['length'];_0x31c55d+=0x1){_0x40281a[_0xdaf1('0x1fc')]+=0x1;if(_[_0xdaf1('0xa9')](_0x1b1af6[_0x31c55d])||_[_0xdaf1('0xa9')](_0x1b1af6[_0x31c55d][_0xdaf1('0x166')])||_[_0xdaf1('0xa9')](_0x1b1af6[_0x31c55d][_0xdaf1('0x166')][_0xdaf1('0x167')])){_0x3c1736[_0xdaf1('0x1fd')](_0xdaf1('0x1fe'),_0x40281a,_0x1b1af6[_0x31c55d]);}else{_0x3c1736[_0xdaf1('0xb7')](_[_0xdaf1('0x129')](_0x1b1af6[_0x31c55d],[_0xdaf1('0xd2'),_0xdaf1('0x1ff')]))[_0xdaf1('0xb3')](_0x3c1736[_0xdaf1('0x1e2')](_0x40281a,_0x1b1af6[_0x31c55d]))[_0xdaf1('0xad')](_0x3c1736[_0xdaf1('0xcb')](_0xdaf1('0x200'),_0x40281a));}}}})[_0xdaf1('0xad')](loggerGetContactDialer(_0xdaf1('0x201'),_0x40281a,_0x50a4ba));}};Dialer[_0xdaf1('0x1b')][_0xdaf1('0x156')]=function(_0x22fc9d,_0x251607){var _0x476257=this;var _0x13a82f=[];var _0x109189=_0x251607>=0x1?_0x251607:0x1;if(_0x22fc9d[_0xdaf1('0x59')]===_0xdaf1('0x9')){_0x109189=0x1;}var _0x1f498d=Math['floor'](_0x22fc9d['available']*_0x109189)-_0x22fc9d[_0xdaf1('0x6f')]-_0x22fc9d[_0xdaf1('0xbf')];emitVoiceQueueSummary(_0x22fc9d);if(_0x22fc9d[_0xdaf1('0x202')]>0x0){var _0xed8f0a=_0x22fc9d[_0xdaf1('0x202')]-_0x22fc9d['originated']-_0x22fc9d[_0xdaf1('0x1c6')]-_0x22fc9d['temp']-_0x22fc9d[_0xdaf1('0x9b')];if(_0x1f498d>_0xed8f0a){_0x1f498d=_0xed8f0a;}}if(_0x1f498d>0x0){if(_0x22fc9d['dialMethod']===_0xdaf1('0x9')){_0x1f498d=0x1;}if(_0x1f498d>this[_0xdaf1('0x24')]){_0x1f498d=this[_0xdaf1('0x24')];}_0x22fc9d[_0xdaf1('0xbf')]+=_0x1f498d;for(var _0x16faef in this[_0xdaf1('0x22')]){if(typeof this[_0xdaf1('0x22')][_0x16faef]!=='undefined'){if(this['agents'][_0x16faef][_0xdaf1('0xa2')]==='not_inuse'&&this[_0xdaf1('0x22')][_0x16faef][_0xdaf1('0xab')]===_0xdaf1('0x203')){_0x13a82f[_0xdaf1('0x128')](this[_0xdaf1('0x22')][_0x16faef]['id']);}}}this[_0xdaf1('0xbe')](_0x22fc9d['id'],_0x13a82f,_0x1f498d,_0x22fc9d[_0xdaf1('0x1f9')],_0x22fc9d)[_0xdaf1('0xb3')](function(_0x1cdae4){_0x22fc9d[_0xdaf1('0xbf')]-=_0x1f498d;_0x22fc9d[_0xdaf1('0xbf')]=_0x22fc9d[_0xdaf1('0xbf')]>0x0?_0x22fc9d[_0xdaf1('0xbf')]:0x0;if(!checkContactEmpty(_0x1cdae4)){_0x476257[_0xdaf1('0xb2')](_0x22fc9d)['then'](sendMessageReschedule(_0x22fc9d))[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x204')));}else{_0x22fc9d['originated']+=_0x1cdae4[_0xdaf1('0x95')];_0x22fc9d[_0xdaf1('0x3e')]=_0x22fc9d[_0xdaf1('0x59')]===_0xdaf1('0x9')?_0xdaf1('0x16c'):_0xdaf1('0x1fb');for(var _0x21d147=0x0;_0x21d147<_0x1cdae4['length'];_0x21d147+=0x1){if(_[_0xdaf1('0xa9')](_0x1cdae4[_0x21d147])||_[_0xdaf1('0xa9')](_0x1cdae4[_0x21d147]['Contact'])||_['isNil'](_0x1cdae4[_0x21d147][_0xdaf1('0x166')][_0xdaf1('0x167')])){_0x476257[_0xdaf1('0x1fd')](_0xdaf1('0x1fe'),_0x22fc9d,_0x1cdae4[_0x21d147]);}else{_0x476257[_0xdaf1('0xb4')](_[_0xdaf1('0x129')](_0x1cdae4[_0x21d147],[_0xdaf1('0xd1'),_0xdaf1('0x1ff')]))['then'](_0x476257[_0xdaf1('0x1e2')](_0x22fc9d,_0x1cdae4[_0x21d147]))['catch'](_0x476257[_0xdaf1('0xcb')](_0xdaf1('0x1fe'),_0x22fc9d));}}}})['catch'](loggerGetContactDialer(_0xdaf1('0x205'),_0x22fc9d,_0x1f498d));}};Dialer['prototype']['handlePredictive']=function(_0x40b5d3){if(_0x40b5d3[_0xdaf1('0x202')]>0x0){var _0x54e1ea=_0x40b5d3['dialLimitQueue']-_0x40b5d3['originated']-_0x40b5d3[_0xdaf1('0x1c6')];if(_0x54e1ea>0x0){this[_0xdaf1('0x206')](_0x40b5d3);}else{loggerPredictiveCalls[_0xdaf1('0x7e')](_0xdaf1('0x207'));}}else{this[_0xdaf1('0x206')](_0x40b5d3);}};Dialer[_0xdaf1('0x1b')][_0xdaf1('0x206')]=function(_0x97c1e0){var _0x18c4ff=this;var _0x310870=[];_0x97c1e0[_0xdaf1('0x6f')]+=0x1;for(var _0x177bfd in this['agents']){if(typeof this['agents'][_0x177bfd]!==_0xdaf1('0xa8')){if(this['agents'][_0x177bfd]['state']===_0xdaf1('0x208')&&this[_0xdaf1('0x22')][_0x177bfd][_0xdaf1('0xab')]===_0xdaf1('0x203')){_0x310870[_0xdaf1('0x128')](this[_0xdaf1('0x22')][_0x177bfd]['id']);}}}this[_0xdaf1('0xbe')](_0x97c1e0['id'],_0x310870,0x1,_0x97c1e0['dialOrderByScheduledAt'],_0x97c1e0)['then'](function(_0x5baed8){if(!checkContactEmpty(_0x5baed8)){checkContactLowerLimitOriginate(_0x97c1e0,0x1,0x0);_0x18c4ff[_0xdaf1('0xb2')](_0x97c1e0)['then'](sendMessageReschedule(_0x97c1e0))[_0xdaf1('0xad')](loggerCatch(_0xdaf1('0x204')));}else{_0x97c1e0[_0xdaf1('0x3e')]='RUNNING';if(_[_0xdaf1('0xa9')](_0x5baed8[0x0])||_[_0xdaf1('0xa9')](_0x5baed8[0x0][_0xdaf1('0x166')])||_[_0xdaf1('0xa9')](_0x5baed8[0x0][_0xdaf1('0x166')][_0xdaf1('0x167')])){_0x18c4ff['emptyContact'](_0xdaf1('0x1fe'),_0x97c1e0,_0x5baed8[0x0]);}else{_0x18c4ff[_0xdaf1('0xb4')](_[_0xdaf1('0x129')](_0x5baed8[0x0],[_0xdaf1('0xd1'),_0xdaf1('0x1ff')]))[_0xdaf1('0xb3')](_0x18c4ff[_0xdaf1('0x1e2')](_0x97c1e0,_0x5baed8[0x0]))[_0xdaf1('0xad')](_0x18c4ff[_0xdaf1('0xcb')](_0xdaf1('0x209'),_0x97c1e0));}}})[_0xdaf1('0xad')](loggerGetContactDialer(_0xdaf1('0x20a'),_0x97c1e0,0x1));emitVoiceQueueSummary(_0x97c1e0);};Dialer[_0xdaf1('0x1b')][_0xdaf1('0x1da')]=function(_0x4106cf,_0x92c902,_0x625773,_0x429935,_0xd32bc0,_0x58972e){loggerPredictive['info'](_0xdaf1('0x20b'));loggerPredictive[_0xdaf1('0x7e')](_0xdaf1('0x20c'),_0x4106cf);loggerPredictive[_0xdaf1('0x7e')](_0xdaf1('0x20d'),_0x92c902);loggerPredictive[_0xdaf1('0x7e')](_0xdaf1('0x20e'),_0x625773);loggerPredictive['info'](_0xdaf1('0x20f'),_0x429935);loggerPredictive[_0xdaf1('0x7e')](_0xdaf1('0x210'),_0xd32bc0);loggerPredictive[_0xdaf1('0x7e')]('---------------------------');return new BPromise(function(_0x2aa7d3,_0x36f3f7){if(_0x4106cf<=0x0||isNaN(_0x4106cf)){return _0x36f3f7(msgResponse(_0xdaf1('0x211'),_0xdaf1('0x48'),'m\x20=\x20'+_0x4106cf));}if(_0x625773<=0x0||isNaN(_0x625773)){return _0x36f3f7(msgResponse(_0xdaf1('0x211'),_0xdaf1('0x48'),_0xdaf1('0x212')+_0x625773));}if(_0x429935<=0x0||isNaN(_0x429935)){return _0x36f3f7(msgResponse(_0xdaf1('0x211'),_0xdaf1('0x48'),_0xdaf1('0x213')+_0x429935));}if(_0x92c902<=0x0||isNaN(_0x92c902)){return _0x36f3f7(msgResponse(_0xdaf1('0x211'),_0xdaf1('0x48'),_0xdaf1('0x214')+_0x92c902));}if(_0xd32bc0<=0x0||isNaN(_0xd32bc0)){return _0x36f3f7(msgResponse(_0xdaf1('0x211'),'Error',_0xdaf1('0x215')+_0xd32bc0));}_0x58972e=_0x58972e||0x0;var _0x289fc0=0x1/_0x625773;var _0x330e42=0x0;var _0x4e82d2=0x0;var _0x3b543d=0x0;var _0x64622a=0x0;for(var _0x57bc4c=0x0;_0x3b543d<_0xd32bc0;_0x57bc4c+=0x1){_0x4e82d2=_0x57bc4c/_0x92c902;_0x330e42=(_0x429935*_0x4e82d2+_0x58972e)/_0x289fc0;_0x3b543d=erlangb(_0x330e42,_0x4106cf);_0x64622a=_0x330e42/_0x4106cf*(0x1-erlangb(_0x330e42,_0x4106cf));}return _0x2aa7d3({'erlangCalls':_0x57bc4c,'erlangCallToSecond':_0x92c902/_0x57bc4c,'erlangAbandonmentRate':_0x3b543d,'erlangBusyFactor':_0x64622a});});};Dialer[_0xdaf1('0x1b')][_0xdaf1('0x1df')]=function(_0x3b14b2,_0x2e1a23,_0x17ca46,_0x2f6e06,_0x3e01f6,_0x41cf62){loggerPredictive[_0xdaf1('0x7e')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xdaf1('0x7e')](_0xdaf1('0x20c'),_0x3b14b2);loggerPredictive[_0xdaf1('0x7e')](_0xdaf1('0x20d'),_0x2e1a23);loggerPredictive[_0xdaf1('0x7e')]('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',_0x17ca46);loggerPredictive[_0xdaf1('0x7e')](_0xdaf1('0x20f'),_0x2f6e06);loggerPredictive[_0xdaf1('0x7e')](_0xdaf1('0x216'),_0x3e01f6);loggerPredictive[_0xdaf1('0x7e')]('---------------------------');return new BPromise(function(_0x3527cc,_0x30b964){if(_0x3b14b2<=0x0||isNaN(_0x3b14b2)){return _0x30b964(msgResponse(_0xdaf1('0x217'),_0xdaf1('0x48'),'m\x20=\x20'+_0x3b14b2));}if(_0x17ca46<=0x0||isNaN(_0x17ca46)){return _0x30b964(msgResponse(_0xdaf1('0x217'),_0xdaf1('0x48'),_0xdaf1('0x212')+_0x17ca46));}if(_0x2f6e06<=0x0||isNaN(_0x2f6e06)){return _0x30b964(msgResponse(_0xdaf1('0x217'),_0xdaf1('0x48'),_0xdaf1('0x213')+_0x2f6e06));}if(_0x2e1a23<=0x0||isNaN(_0x2e1a23)){return _0x30b964(msgResponse('[busyFactor]',_0xdaf1('0x48'),_0xdaf1('0x214')+_0x2e1a23));}if(_0x3e01f6<=0x0||isNaN(_0x3e01f6)){return _0x30b964(msgResponse('[busyFactor]','Error',_0xdaf1('0x218')+_0x3e01f6));}_0x41cf62=_0x41cf62||0x0;var _0x21d3dc=0x1/_0x17ca46;var _0x4e405a=0x0;var _0x2bafb7=0x0;var _0x2c6126=0x0;var _0x166a87=0x0;for(var _0xe34d3f=0x0;_0x166a87<_0x3e01f6;_0xe34d3f+=0x1){_0x2bafb7=_0xe34d3f/_0x2e1a23;_0x4e405a=(_0x2f6e06*_0x2bafb7+_0x41cf62)/_0x21d3dc;_0x2c6126=erlangb(_0x4e405a,_0x3b14b2);_0x166a87=_0x4e405a/_0x3b14b2*(0x1-erlangb(_0x4e405a,_0x3b14b2));}return _0x3527cc({'erlangCalls':_0xe34d3f,'erlangCallToSecond':_0x2e1a23/_0xe34d3f,'erlangAbandonmentRate':_0x2c6126,'erlangBusyFactor':_0x166a87});});};module[_0xdaf1('0x219')]=Dialer; \ No newline at end of file +var _0x99e9=['dialTimezone','[syncQueueSummary]','checkIsTrunkReachable','dialGlobalInterval','\x5cw{0,','pow','replace','random','match','actionOriginate','Contact','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','outboundOriginateFailureCallsDay','[originate][error]','Error','originate\x20action\x20Error','responsetime','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','object','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','dialCongestionMaxRetry','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','reason','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','dialLimitQueue','ACTIVE','[getContactDialer2]','tryOriginatePredictive','not_inuse','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','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','lodash','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','dialer','booked','../../../config/logger','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','prototype','tail','finally','sequence','preview','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','syncQueueCallerAbandon','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','stringify','diff','type','outbound','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalMultiplicativeFactor','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','md5','voice:queue:%s','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Agent\x20Busy\x20Factor:\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','milliseconds','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','stack','inspect','length','error','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','state','statedesc','endtime','clearZombieChannels','[uniqueid]','[actions]','undefined','enqueue','isNil','Action','channel','No\x20such\x20channel','voiceQueues','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','loggerHandler','emptyContact','saveInDb','merge','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','active','status','reachable','SIP/%s','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','value','HangupInAMD','membername','AMD','emit','custom:amd','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr]','buildObj','dialGlobalMaxRetry','YYYY-MM-DD\x20HH:mm:ss','ContactId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','Unknow','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','dropreason','TIMEOUT','dialQueueProject2','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','Abandoned','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','paused','stateinterface','locked','push','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','pick','run','idHopper','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','Failure','timezones','TIMEZONE_UNKNOW','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','loggedIn'];(function(_0x31b40c,_0xfb8063){var _0x368041=function(_0xbbd32){while(--_0xbbd32){_0x31b40c['push'](_0x31b40c['shift']());}};_0x368041(++_0xfb8063);}(_0x99e9,0xb4));var _0x999e=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0x99e9[_0x38c632];return _0x12737e;};'use strict';var util=require('util');var _=require(_0x999e('0x0'));var BPromise=require(_0x999e('0x1'));var uuid=require(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x999e('0x4'));var ut=require(_0x999e('0x5'));var config=require(_0x999e('0x6'));var logger=require('../../../config/logger')(_0x999e('0x7'));var loggerBooked=require('../../../config/logger')(_0x999e('0x8'));var loggerPredictive=require(_0x999e('0x9'))(_0x999e('0xa'));var loggerPredictiveCalls=require(_0x999e('0x9'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x999e('0x9'))(_0x999e('0xb'));var ami=require(_0x999e('0xc'));config[_0x999e('0xd')]=_[_0x999e('0xe')](config[_0x999e('0xd')],{'host':_0x999e('0xf'),'port':0x18eb});var io=require(_0x999e('0x10'))(new Redis(config[_0x999e('0xd')]));var cmHopper=require(_0x999e('0x11'));var cmHopperHistory=require(_0x999e('0x12'));var cmHopperBlack=require(_0x999e('0x13'));var voiceQueueRt=require(_0x999e('0x14'));var Action=require(_0x999e('0x15'));var History=require(_0x999e('0x16'));var Final=require(_0x999e('0x17'));var AgentComplete=require(_0x999e('0x18'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x999e('0x19'));var ipAgi=process['env'][_0x999e('0x1a')]||_0x999e('0x1b');var strategy={'rrmemory':_0x999e('0x1c'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x999e('0x1d')]['enqueue']=function(_0xa44e4c){this['tail']=this['tail']?this[_0x999e('0x1e')][_0x999e('0x1f')](_0xa44e4c):_0xa44e4c();};function Dialer(_0x2dd5f4,_0x289e0e){this[_0x999e('0x20')]=new Sequence();this[_0x999e('0x21')]=_0x289e0e;this['voiceQueues']=_0x2dd5f4['voiceQueues'];this['campaigns']=_0x2dd5f4[_0x999e('0x22')];this[_0x999e('0x23')]=_0x2dd5f4[_0x999e('0x23')];this[_0x999e('0x24')]=_0x2dd5f4[_0x999e('0x24')];this[_0x999e('0x25')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x999e('0x26')]={};this[_0x999e('0x27')]={};this[_0x999e('0x28')]={};this['optionPredictive']={};this[_0x999e('0x29')]={};this[_0x999e('0x2a')]={};this[_0x999e('0x2b')]={};this[_0x999e('0x2c')]={};this[_0x999e('0x2d')]={};ami['on'](_0x999e('0x2e'),this[_0x999e('0x2f')]['bind'](this));ami['on']('queuecallerabandon',this[_0x999e('0x30')][_0x999e('0x31')](this));ami['on']('originateresponse',this[_0x999e('0x32')][_0x999e('0x31')](this));ami['on'](_0x999e('0x33'),this[_0x999e('0x34')][_0x999e('0x31')](this));ami['on'](_0x999e('0x35'),this['syncQueueSummary'][_0x999e('0x31')](this));ami['on'](_0x999e('0x36'),this[_0x999e('0x37')][_0x999e('0x31')](this));ami['on'](_0x999e('0x38'),this[_0x999e('0x39')][_0x999e('0x31')](this));ami['on']('varset',this[_0x999e('0x3a')]['bind'](this));ami['on']('queuemember',this[_0x999e('0x3b')][_0x999e('0x31')](this));ami['on'](_0x999e('0x3c'),this['syncQueueStatusComplete'][_0x999e('0x31')](this));this[_0x999e('0x3d')]();this[_0x999e('0x3e')]();}function isNotNull(_0x4339bf){return _0x4339bf!==null&&!_[_0x999e('0x3f')](_0x4339bf);}function checkIsLoggedIn(_0x327079,_0x82e067){return function(){if(_0x82e067<=0x0){_0x327079[_0x999e('0x40')]=_0x999e('0x41');throw _0x327079[_0x999e('0x42')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x1c8feb){return _0x1c8feb;}function checkIsActive(_0x1cd206,_0x371613){return function(){if(!isActive(_0x371613)){_0x1cd206['message']=_0x999e('0x43');throw _0x1cd206['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x28a228){return function(){if(!isNotNull(_0x28a228[_0x999e('0x44')])){_0x28a228['message']='INTERVAL_IS_NULL';throw _0x28a228[_0x999e('0x42')]+_0x999e('0x45');}if(!isNotNull(_0x28a228[_0x999e('0x44')][_0x999e('0x46')])){_0x28a228['message']=_0x999e('0x47');throw _0x28a228[_0x999e('0x42')]+_0x999e('0x45');}if(!isNotNull(_[_0x999e('0x48')](_0x28a228['Interval']['Intervals']))){_0x28a228[_0x999e('0x40')]='INTERVAL_IS_NULL';throw _0x28a228[_0x999e('0x42')]+_0x999e('0x45');}};}function msgResponse(_0x69e059,_0x14c9e0,_0x5ad3f1){return{'action':_0x69e059,'response':_0x14c9e0,'message':_0x5ad3f1,'stack':_0x5ad3f1};}function myreject(_0xebda67){return function(_0x28df26){return _0xebda67(msgResponse('[ifTime][Action]','Error',JSON[_0x999e('0x49')](_0x28df26)));};}function getSeconds(_0x4aa98c,_0xa0c150){var _0x5dac45=moment(_0x4aa98c)['milliseconds'](0x0);var _0x504ac1=moment(_0xa0c150)['milliseconds'](0x0);return _0x5dac45[_0x999e('0x4a')](_0x504ac1,'seconds');}function emit(_0x1be117,_0x5240a7,_0x4cfa34){io['to'](_0x1be117)['emit'](_0x5240a7,_0x4cfa34);}function emitVoiceQueueSummary(_0x2f7d79){if(_0x2f7d79[_0x999e('0x4b')]===_0x999e('0x4c')){var _0xe3c089={'id':_0x2f7d79['id'],'name':_0x2f7d79[_0x999e('0x42')],'strategy':_0x2f7d79[_0x999e('0x4d')],'answered':_0x2f7d79[_0x999e('0x4e')],'available':_0x2f7d79[_0x999e('0x4f')],'loggedIn':_0x2f7d79['loggedIn'],'pTalking':_0x2f7d79[_0x999e('0x50')],'sumBillable':_0x2f7d79[_0x999e('0x51')],'sumDuration':_0x2f7d79[_0x999e('0x52')],'sumHoldTime':_0x2f7d79[_0x999e('0x53')]||0x0,'talking':_0x2f7d79['talking'],'total':_0x2f7d79[_0x999e('0x54')],'type':_0x2f7d79['type'],'unmanaged':_0x2f7d79[_0x999e('0x55')],'abandoned':_0x2f7d79[_0x999e('0x56')],'waiting':_0x2f7d79[_0x999e('0x57')],'loggedInDb':_0x2f7d79[_0x999e('0x58')],'dialActive':_0x2f7d79['dialActive'],'dialMethod':_0x2f7d79[_0x999e('0x59')],'dialOriginateCallerIdName':_0x2f7d79[_0x999e('0x5a')],'dialOriginateCallerIdNumber':_0x2f7d79[_0x999e('0x5b')],'dialOriginateTimeout':_0x2f7d79['dialOriginateTimeout'],'dialPrefix':_0x2f7d79['dialPrefix'],'outboundAnswerAgiCallsDay':_0x2f7d79[_0x999e('0x5c')],'outboundAnswerCallsDay':_0x2f7d79[_0x999e('0x5d')],'outboundBlacklistCallsDay':_0x2f7d79[_0x999e('0x5e')],'outboundBusyCallsDay':_0x2f7d79[_0x999e('0x5f')],'outboundCongestionCallsDay':_0x2f7d79[_0x999e('0x60')],'outboundDropCallsDayACS':_0x2f7d79[_0x999e('0x61')],'outboundDropCallsDayCallersExit':_0x2f7d79[_0x999e('0x62')],'outboundDropCallsDayTimeout':_0x2f7d79[_0x999e('0x63')],'outboundNoAnswerCallsDay':_0x2f7d79[_0x999e('0x64')],'outboundNoSuchCallsDay':_0x2f7d79[_0x999e('0x65')],'outboundOriginateFailureCallsDay':_0x2f7d79['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x2f7d79['outboundReCallsDay'],'outboundRejectCallsDay':_0x2f7d79[_0x999e('0x66')],'outboundUnknownCallsDay':_0x2f7d79[_0x999e('0x67')],'predictiveIntervalAnsweredCalls':_0x2f7d79[_0x999e('0x68')],'predictiveIntervalAvgHoldtime':_0x2f7d79[_0x999e('0x69')],'predictiveIntervalAvgTalktime':_0x2f7d79[_0x999e('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x2f7d79[_0x999e('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x2f7d79['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x2f7d79[_0x999e('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x2f7d79['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x2f7d79['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x2f7d79[_0x999e('0x6d')],'predictiveIntervalPauses':_0x2f7d79['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x2f7d79['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x2f7d79['predictiveIntervalTotalCalls'],'message':_0x2f7d79['message'],'originated':_0x2f7d79[_0x999e('0x6e')],'erlangCalls':_0x2f7d79[_0x999e('0x6f')],'erlangCallToSecond':_0x2f7d79['erlangCallToSecond'],'erlangAbandonmentRate':_0x2f7d79[_0x999e('0x70')],'erlangBusyFactor':_0x2f7d79[_0x999e('0x71')],'startPredictive':_0x2f7d79[_0x999e('0x29')],'startProgressive':_0x2f7d79['startProgressive']};if(_0x2f7d79['Trunk']){_0xe3c089[_0x999e('0x72')]={'id':_0x2f7d79[_0x999e('0x72')]['id'],'name':_0x2f7d79[_0x999e('0x72')]['name'],'active':_0x2f7d79['Trunk']['active'],'callerid':_0x2f7d79['Trunk'][_0x999e('0x73')]};}if(_0x2f7d79['Interval']){_0xe3c089['Interval']={'id':_0x2f7d79[_0x999e('0x44')]['id'],'name':_0x2f7d79[_0x999e('0x44')]['name']};}var _0xa50dc6=md5(JSON[_0x999e('0x49')](_0xe3c089));if(_0x2f7d79['md5']!==_0xa50dc6){_0x2f7d79[_0x999e('0x74')]=_0xa50dc6;emit(util['format'](_0x999e('0x75'),_0xe3c089[_0x999e('0x42')]),'voice_queue:save',_0xe3c089);}}}function emitCampaignSummary(_0x210f1e){if(_0x210f1e[_0x999e('0x4b')]==='ivr'){emit(util['format'](_0x999e('0x76'),_0x210f1e['name']),'campaign:save',_0x210f1e);}}function checkGetDataPredictive(_0x4de2e8){if(isNotNull(_0x4de2e8)&&!_[_0x999e('0x48')](_0x4de2e8)){loggerPredictive[_0x999e('0x77')](_0x999e('0x78'));loggerPredictive[_0x999e('0x77')](_0x999e('0x79'),_0x4de2e8[_0x999e('0x7a')]);loggerPredictive['info'](_0x999e('0x7b'),_0x4de2e8[_0x999e('0x68')]);loggerPredictive['info'](_0x999e('0x7c'),_0x4de2e8[_0x999e('0x7d')]);loggerPredictive[_0x999e('0x77')](_0x999e('0x7e'),_0x4de2e8[_0x999e('0x6b')]);loggerPredictive[_0x999e('0x77')](_0x999e('0x7f'),_0x4de2e8[_0x999e('0x69')]);loggerPredictive[_0x999e('0x77')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4de2e8[_0x999e('0x6a')]);loggerPredictive[_0x999e('0x77')](_0x999e('0x80'));if(_0x4de2e8[_0x999e('0x7a')]>0x0){if(!_['isUndefined'](_0x4de2e8[_0x999e('0x6a')])&&_0x4de2e8[_0x999e('0x6a')]>0x0){return!![];}loggerPredictive[_0x999e('0x77')](_0x999e('0x81'));if(!_[_0x999e('0x3f')](_0x4de2e8[_0x999e('0x69')])&&_0x4de2e8[_0x999e('0x69')]>0x0){return!![];}loggerPredictive[_0x999e('0x77')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x999e('0x82'));}}else{loggerPredictive[_0x999e('0x77')](_0x999e('0x83'));}return![];}function mergeDataErlangB(_0xefd231){return function(_0x18ff7a){loggerPredictive[_0x999e('0x77')](_0x999e('0x84'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x18ff7a[_0x999e('0x6f')]);loggerPredictive[_0x999e('0x77')](_0x999e('0x85'),_0x18ff7a[_0x999e('0x86')]);loggerPredictive[_0x999e('0x77')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x18ff7a[_0x999e('0x70')]);loggerPredictive[_0x999e('0x77')](_0x999e('0x87'),_0x18ff7a[_0x999e('0x71')]);loggerPredictive[_0x999e('0x77')](_0x999e('0x88'),_0x18ff7a[_0x999e('0x70')]);loggerPredictive['info'](_0x999e('0x80'));_['merge'](_0xefd231,_0x18ff7a);};}function getDiff(_0xe35369){var _0x43217e=moment()[_0x999e('0x89')](0x0);var _0x25f6a6=moment(_0xe35369)[_0x999e('0x89')](0x0);return _0x43217e[_0x999e('0x4a')](_0x25f6a6,'seconds');}function ifInterval(_0x43bd68,_0x1a6ade){if(_[_0x999e('0x3f')](_0x1a6ade)){return![];}return getDiff(_0x1a6ade)<_0x43bd68*0x3c;}function freeVariablesPredictive(_0xe39e00){if(isNotNull(_0xe39e00)){if(!_[_0x999e('0x3f')](_0xe39e00[_0x999e('0x2a')])){_0xe39e00[_0x999e('0x2a')]=undefined;loggerPredictive[_0x999e('0x77')](_0xe39e00[_0x999e('0x42')],_0x999e('0x8a'));}if(!_[_0x999e('0x3f')](_0xe39e00[_0x999e('0x29')])){_0xe39e00[_0x999e('0x29')]=undefined;loggerPredictive[_0x999e('0x77')](_0xe39e00[_0x999e('0x42')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x999e('0x3f')](_0xe39e00[_0x999e('0x8b')])){clearInterval(_0xe39e00[_0x999e('0x8b')]);_0xe39e00[_0x999e('0x8b')]=undefined;loggerPredictive['info'](_0xe39e00['name'],_0x999e('0x8c'));}}}function erlangb(_0x2d398f,_0x67267d){if(_0x67267d===0x0){return 0x0;}var _0x33abdc=0x1;for(var _0x1c9b64=0x1;_0x1c9b64<=_0x67267d;_0x1c9b64+=0x1){_0x33abdc=0x1+_0x33abdc*_0x1c9b64/_0x2d398f;}return 0x1/_0x33abdc;}function isVoiceQueueOutbound(_0x19d934){return _0x19d934===_0x999e('0x4c');}function isNotPreview(_0x3e75a3){return _0x3e75a3!==_0x999e('0x21');}function isCampaignIvr(_0x5d4f50){return _0x5d4f50===_0x999e('0x8d');}function getCallerId(_0x47c693,_0x184b3e,_0x21a04a){if(!_['isUndefined'](_0x21a04a)&&typeof _0x21a04a===_0x999e('0x8e')&&!_[_0x999e('0x48')](_0x21a04a)){if(!_[_0x999e('0x3f')](_0x184b3e)&&typeof _0x184b3e===_0x999e('0x8e')&&!_[_0x999e('0x48')](_0x184b3e)){return util['format'](_0x999e('0x8f'),_0x184b3e,_0x21a04a);}return util[_0x999e('0x90')]('\x22%s\x22\x20<%s>',_0x21a04a,_0x21a04a);}if(!_['isUndefined'](_0x47c693)&&typeof _0x47c693==='string'&&!_[_0x999e('0x48')](_0x47c693)){return _0x47c693;}return _0x999e('0x91');}function loggerCatchQueueSummary(_0x3432fd,_0x378f60){return function(_0x8d988f){freeVariablesPredictive(_0x378f60);emitVoiceQueueSummary(_0x378f60);emitCampaignSummary(_0x378f60);loggerSyncQueueSummary['error'](_0x3432fd,util['inspect'](_0x8d988f,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4e229e,_0x49293d){return function(_0x513580){loggerPredictive['error'](_0x49293d[_0x999e('0x42')],_0x4e229e);loggerPredictive['error'](_0x513580[_0x999e('0x92')]);freeVariablesPredictive(_0x49293d);};}function loggerCatch(_0x3131c7){return function(_0xb5ac06){logger['error'](_0x3131c7,util[_0x999e('0x93')](_0xb5ac06,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3c2bce){return _0x3c2bce&&!_[_0x999e('0x3f')](_0x3c2bce)&&_0x3c2bce[_0x999e('0x94')]>0x0;}function decremetOriginate(_0x3f0baa){if(!_[_0x999e('0x3f')](_0x3f0baa)&&_0x3f0baa!==null){if(typeof _0x3f0baa[_0x999e('0x6e')]!=='undefined'){if(_0x3f0baa[_0x999e('0x6e')]>0x0){_0x3f0baa[_0x999e('0x6e')]-=0x1;}else{logger[_0x999e('0x95')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x999e('0x95')](_0x999e('0x96'));}}function checkContactLowerLimitOriginate(_0x4bffc5,_0x2f893b,_0x67c96d){if(_0x2f893b>_0x67c96d){for(var _0x3a404d=0x0;_0x3a404d<_0x2f893b-_0x67c96d;_0x3a404d+=0x1){decremetOriginate(_0x4bffc5);}}}function loggerGetContactDialer(_0x1f0dc3,_0xc02339,_0xd85ed7){return function(_0x42f36f){checkContactLowerLimitOriginate(_0xc02339,_0xd85ed7,0x0);logger[_0x999e('0x95')](_0x1f0dc3,util[_0x999e('0x93')](_0x42f36f,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x58fb9e){return function(_0xe27738){if(isNotNull(_0xe27738)&&isNotNull(_0xe27738[0x0])){if(_0xe27738[0x0][_0x999e('0x97')]>0x0){_0x58fb9e[_0x999e('0x40')]='RESCHEDULED_CONTACTS';logger[_0x999e('0x77')]('[getContactDialer2][ReScheduled]'+_0x58fb9e[_0x999e('0x42')],_0xe27738[0x0][_0x999e('0x97')],_0x999e('0x98'));}else{_0x58fb9e['message']=_0x999e('0x99');logger[_0x999e('0x77')](_0x999e('0x9a')+_0x58fb9e[_0x999e('0x42')]);}}};}function notSendMessagesQueue(_0x436bc5){if(_0x436bc5[_0x999e('0x9b')]){freeVariablesPredictive(_0x436bc5);if(_0x436bc5['originated']===0x0&&_0x436bc5[_0x999e('0x9c')]===0x0&&_0x436bc5['waiting']===0x0&&(_0x436bc5[_0x999e('0x50')]||0x0)===0x0){_0x436bc5['sendMessageOneNotActive']=![];_0x436bc5['available']=0x0;_0x436bc5[_0x999e('0x40')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x999e('0x95')](_0x999e('0x9d'),_0x436bc5['name'],_0x999e('0x9e'));}else{_0x436bc5[_0x999e('0x40')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x999e('0x95')](_0x999e('0x9d'),_0x436bc5[_0x999e('0x42')],_0x999e('0x9f'));}emitVoiceQueueSummary(_0x436bc5);}}function notSendMessagesCampaign(_0x382c65){if(_0x382c65[_0x999e('0x9b')]){if(_0x382c65[_0x999e('0x6e')]===0x0){_0x382c65[_0x999e('0x9b')]=![];_0x382c65['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x999e('0x95')](_0x999e('0xa0'),_0x382c65[_0x999e('0x42')],_0x999e('0x9e'));}else{_0x382c65[_0x999e('0x40')]=_0x999e('0xa1');loggerSyncQueueSummary['error'](_0x999e('0xa0'),_0x382c65[_0x999e('0x42')],'is\x20disactive');}emitCampaignSummary(_0x382c65);}}function createObjHistory(_0x2405f5,_0x404391,_0x40d407,_0x54742b,_0x389520){_0x2405f5[_0x999e('0x40')]=_0x40d407;var _0x328c2d=new Action(_0x2405f5,_0x404391);var _0x47eac1=new History(_0x328c2d);_0x47eac1[_0x999e('0xa2')]=_0x54742b;_0x47eac1[_0x999e('0xa3')]=_0x389520;_0x47eac1[_0x999e('0xa4')]=_0x328c2d['starttime'];return _0x47eac1;}Dialer['prototype'][_0x999e('0x3e')]=function(){var _0x47e5ce=this;setInterval(function(){_0x47e5ce[_0x999e('0xa5')](_0x47e5ce[_0x999e('0x28')],_0x999e('0xa6'));_0x47e5ce[_0x999e('0xa5')](_0x47e5ce[_0x999e('0x26')],_0x999e('0xa7'));},0x32c8);};Dialer[_0x999e('0x1d')]['clearZombieChannels']=function(_0x11e5d3,_0x540a9e){var _0x5a65c8=this;for(var _0x3dc18c in _0x11e5d3){if(typeof _0x11e5d3[_0x3dc18c]!==_0x999e('0xa8')){this[_0x999e('0x20')][_0x999e('0xa9')](function(){if(!_[_0x999e('0xaa')](_0x11e5d3[_0x3dc18c])){return ami[_0x999e('0xab')]({'action':'status','channel':_0x11e5d3[_0x3dc18c][_0x999e('0xac')]})['catch'](function(_0x302161){if(_0x302161[_0x999e('0x40')]===_0x999e('0xad')){setTimeout(function(){if(_0x11e5d3[_0x3dc18c]&&_0x11e5d3[_0x3dc18c]['type']!==_0x999e('0x8d')){_0x5a65c8['updateOriginated'](_0x5a65c8[_0x999e('0xae')][_0x11e5d3[_0x3dc18c][_0x999e('0xaf')]]);logger[_0x999e('0x95')](_0x999e('0xb0'),_0x540a9e,_0x3dc18c,_0x11e5d3[_0x3dc18c][_0x999e('0xaf')]);delete _0x11e5d3[_0x3dc18c];}if(_0x11e5d3[_0x3dc18c]&&_0x11e5d3[_0x3dc18c]['type']==='ivr'){_0x5a65c8[_0x999e('0xb1')](_0x5a65c8[_0x999e('0x22')][_0x11e5d3[_0x3dc18c][_0x999e('0xaf')]]);logger[_0x999e('0x95')](_0x999e('0xb2'),_0x540a9e,_0x3dc18c,_0x11e5d3[_0x3dc18c][_0x999e('0xaf')]);delete _0x11e5d3[_0x3dc18c];}},0x2328);}});}});}}};Dialer[_0x999e('0x1d')][_0x999e('0xb3')]=function(_0x4e502b){return BPromise[_0x999e('0xb4')]()[_0x999e('0xb5')](cmHopper[_0x999e('0xb3')](_0x4e502b))[_0x999e('0xb6')](loggerCatch(_0x999e('0xb7')));};Dialer[_0x999e('0x1d')][_0x999e('0xb8')]=function(_0x16d552){return BPromise['resolve']()[_0x999e('0xb5')](cmHopperBlack[_0x999e('0xb8')](_0x16d552))[_0x999e('0xb6')](loggerCatch(_0x999e('0xb9')));};Dialer[_0x999e('0x1d')][_0x999e('0xba')]=function(_0x203da5){return BPromise[_0x999e('0xb4')]()['then'](cmHopperBlack[_0x999e('0xba')](_0x203da5))[_0x999e('0xb6')](loggerCatch(_0x999e('0xbb')));};Dialer['prototype'][_0x999e('0xbc')]=function(_0x3edea2){return BPromise[_0x999e('0xb4')]()[_0x999e('0xb5')](cmHopperHistory[_0x999e('0xbd')](_0x3edea2))[_0x999e('0xb6')](loggerCatch(_0x999e('0xbe')));};Dialer[_0x999e('0x1d')][_0x999e('0xbf')]=function(_0x4ee1d4){return BPromise[_0x999e('0xb4')]()[_0x999e('0xb5')](cmHopper[_0x999e('0xbf')](_0x4ee1d4))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x999e('0x1d')][_0x999e('0xc0')]=function(_0x421f60,_0x544755,_0x3c93e4){return BPromise[_0x999e('0xb4')]()[_0x999e('0xb5')](cmHopper['unlockContact'](_0x421f60,_0x544755,_0x3c93e4))[_0x999e('0xb6')](loggerCatch(_0x999e('0xc1')));};Dialer['prototype'][_0x999e('0xc2')]=function(_0x5ac17e,_0x4cbe1d,_0xddffa3,_0x7026bb,_0x1ee576){return BPromise[_0x999e('0xb4')]()['then'](cmHopper[_0x999e('0xc2')](_0x5ac17e,_0x4cbe1d,_0xddffa3,_0x7026bb))[_0x999e('0xb6')](function(_0x76015d){_0x1ee576[_0x999e('0xc3')]-=_0xddffa3;_0x1ee576[_0x999e('0xc3')]=_0x1ee576['temp']>0x0?_0x1ee576[_0x999e('0xc3')]:0x0;loggerCatch(_0x999e('0xc4'))(_0x76015d);});};Dialer[_0x999e('0x1d')]['getContactDialerIvr']=function(_0x1916bc,_0x2c9720,_0x32c3ba,_0x3e7d2f){return BPromise[_0x999e('0xb4')]()[_0x999e('0xb5')](cmHopper[_0x999e('0xc5')](_0x1916bc,_0x2c9720,_0x32c3ba))[_0x999e('0xb6')](function(_0x57683c){_0x3e7d2f[_0x999e('0xc3')]-=_0x2c9720;_0x3e7d2f[_0x999e('0xc3')]=_0x3e7d2f[_0x999e('0xc3')]>0x0?_0x3e7d2f[_0x999e('0xc3')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x57683c);});};Dialer[_0x999e('0x1d')][_0x999e('0xc6')]=function(_0xada3ee){return BPromise[_0x999e('0xb4')]()[_0x999e('0xb5')](voiceQueueRt['getVoiceQueueRtPauses'](_0xada3ee))[_0x999e('0xb6')](loggerCatch(_0x999e('0xc7')));};Dialer[_0x999e('0x1d')][_0x999e('0xc8')]=function(_0x35a4e6){return BPromise[_0x999e('0xb4')]()['then'](cmHopper['moveContactManagedDialer'](_0x35a4e6))[_0x999e('0xb6')](loggerCatch(_0x999e('0xc9')));};Dialer['prototype'][_0x999e('0xca')]=function(_0x346afc){return BPromise['resolve']()[_0x999e('0xb5')](cmHopperHistory[_0x999e('0xca')](_0x346afc))[_0x999e('0xb6')](loggerCatch(_0x999e('0xcb')));};Dialer[_0x999e('0x1d')]['updateOriginated']=function(_0x21aeed){if(!_[_0x999e('0x3f')](_0x21aeed)&&_0x21aeed!==null){if(typeof _0x21aeed[_0x999e('0x6e')]!==_0x999e('0xa8')){if(_0x21aeed[_0x999e('0x6e')]>0x0){_0x21aeed[_0x999e('0x6e')]-=0x1;}else{logger[_0x999e('0x95')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x999e('0x95')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x999e('0x1d')][_0x999e('0xcc')]=function(_0x2c9520,_0x2bcab1){var _0x230486=this;return function(_0x2e3c17){_0x230486[_0x999e('0xb1')](_0x2bcab1);logger[_0x999e('0x95')](_0x2c9520,util[_0x999e('0x93')](_0x2e3c17,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x999e('0xcd')]=function(_0x4a0c88,_0x3699f6,_0x4a804c){var _0x3881ea={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x3699f6);this[_0x999e('0xce')](_[_0x999e('0xcf')](_0x3881ea,_['pick'](_0x4a804c,['ContactId',_0x999e('0xd0'),_0x999e('0xd1'),_0x999e('0xd2'),_0x999e('0xd3')])),_0x999e('0xd4'),'[emptyContact]');logger[_0x999e('0x95')](_0x4a0c88);};Dialer['prototype'][_0x999e('0xd5')]=function(_0x6664f7){return _0x6664f7===_0x999e('0xd6');};Dialer[_0x999e('0x1d')]['isTrunkReachable']=function(_0x121a36){return!_[_0x999e('0x3f')](_0x121a36)&&_0x121a36&&!_[_0x999e('0x3f')](_0x121a36[_0x999e('0x42')])&&!_[_0x999e('0x3f')](_0x121a36[_0x999e('0xd7')])&&_0x121a36[_0x999e('0xd7')]&&(this[_0x999e('0x24')][util[_0x999e('0x90')]('SIP/%s',_0x121a36[_0x999e('0x42')])][_0x999e('0xd8')]===_0x999e('0xd9')||this[_0x999e('0x24')][util[_0x999e('0x90')](_0x999e('0xda'),_0x121a36[_0x999e('0x42')])][_0x999e('0xd8')]==='unmonitored');};Dialer[_0x999e('0x1d')]['saveInDb']=function(_0x2edf92,_0x1b54f8,_0x56f1b3){this[_0x999e('0xca')](_0x2edf92)[_0x999e('0xb6')](loggerCatch(_0x1b54f8));this[_0x999e('0xc8')](_0x2edf92)[_0x999e('0xb6')](loggerCatch(_0x56f1b3));};Dialer[_0x999e('0x1d')]['syncVarSet']=function(_0x307a0d){var _0x52e6b0=this['uniqueId'][_0x307a0d[_0x999e('0xdb')]];var _0x16b8f4;if(!_[_0x999e('0xaa')](_0x307a0d)&&!_['isNil'](_0x307a0d[_0x999e('0xdc')])&&!_[_0x999e('0xaa')](_0x307a0d[_0x999e('0xdc')][_0x999e('0xdd')])&&_0x307a0d[_0x999e('0xde')]===_0x999e('0xdf')&&_0x52e6b0){if(_0x52e6b0[_0x999e('0x4b')]!=='ivr'&&this[_0x999e('0xae')][_0x52e6b0[_0x999e('0xaf')]]['dialAMDActive']&&_0x307a0d[_0x999e('0xe0')]==='HANGUP'){delete this[_0x999e('0x28')][_0x307a0d[_0x999e('0xdb')]];this['updateOriginated'](this['voiceQueues'][_0x52e6b0['queue']]);this['voiceQueues'][_0x52e6b0['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x999e('0xae')][_0x52e6b0[_0x999e('0xaf')]][_0x999e('0x5c')]+=0x1;_0x16b8f4=new Hangup(_0x52e6b0,_0x307a0d);_0x16b8f4[_0x999e('0xa2')]=0x12;_0x16b8f4[_0x999e('0xa3')]=_0x999e('0xe1');_0x16b8f4[_0x999e('0xe2')]=_0x999e('0xe3');ami[_0x999e('0xe4')](_0x999e('0xe5'),ut['buildObj'](_0x16b8f4,_0x999e('0xe6')));this[_0x999e('0xce')](_0x16b8f4,_0x999e('0xe7'),_0x999e('0xe8'));}if(_0x52e6b0[_0x999e('0x4b')]!==_0x999e('0x8d')&&this[_0x999e('0xae')][_0x52e6b0[_0x999e('0xaf')]][_0x999e('0xe9')]&&_0x307a0d[_0x999e('0xe0')]===_0x999e('0xea')){var _0x4e943f=this;return new BPromise(function(_0x246330,_0x3082d0){delete _0x4e943f[_0x999e('0x28')][_0x307a0d[_0x999e('0xdb')]];_0x4e943f['updateOriginated'](_0x4e943f[_0x999e('0xae')][_0x52e6b0['queue']]);_0x4e943f['voiceQueues'][_0x52e6b0[_0x999e('0xaf')]]['outboundAnswerCallsDay']+=0x1;_0x4e943f[_0x999e('0xae')][_0x52e6b0['queue']][_0x999e('0x5c')]+=0x1;var _0x5237a2=_0x4e943f[_0x999e('0xae')][_0x52e6b0['queue']];var _0x1f426f=new Hangup(_0x52e6b0,_0x307a0d);_0x1f426f[_0x999e('0xa2')]=0x13;_0x1f426f['statedesc']='Machine';_0x1f426f['membername']=_0x999e('0xe3');_0x1f426f[_0x999e('0xeb')]+=0x1;_0x1f426f[_0x999e('0xec')]+=0x1;_0x1f426f['amd']=!![];ami['emit'](_0x999e('0xe5'),ut['buildObj'](_0x1f426f,_0x999e('0xe6')));_0x4e943f[_0x999e('0xca')](_0x1f426f)[_0x999e('0xb6')](loggerCatch(_0x999e('0xed')));if(_0x1f426f[_0x999e('0xee')]+_0x1f426f[_0x999e('0xef')]+_0x1f426f[_0x999e('0xf0')]+_0x1f426f[_0x999e('0xf1')]+_0x1f426f[_0x999e('0xf2')]+_0x1f426f[_0x999e('0xf3')]+_0x1f426f['countmachineretry']+_0x1f426f[_0x999e('0xf4')]>=_0x5237a2['dialGlobalMaxRetry']){_0x4e943f[_0x999e('0xf5')](_0x1f426f,_0x246330,_0x3082d0,_0x999e('0xf6'));}else{if(_0x1f426f['countmachineretry']>=_0x5237a2[_0x999e('0xf7')]){_0x4e943f[_0x999e('0xf8')](_0x1f426f,_0x246330,_0x3082d0,_0x999e('0xf9'));}else{_0x4e943f[_0x999e('0xbf')]({'active':![],'countmachineretry':_0x1f426f['countmachineretry'],'scheduledat':moment()[_0x999e('0xfa')](_0x5237a2[_0x999e('0xfb')],_0x999e('0xfc'))[_0x999e('0x90')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1f426f['ContactId'],'ListId':_0x1f426f[_0x999e('0xd0')],'VoiceQueueId':_0x1f426f[_0x999e('0xd2')]||undefined,'CampaignId':_0x1f426f[_0x999e('0xd3')]||undefined})[_0x999e('0xb6')](loggerCatch(_0x999e('0xfd')));_0x246330({'reschedule':0x1});}}});}if(_0x52e6b0[_0x999e('0x4b')]==='ivr'&&this[_0x999e('0x22')][_0x52e6b0[_0x999e('0xaf')]]['dialAMDActive']&&_0x307a0d['value']===_0x999e('0xfe')){delete this[_0x999e('0x28')][_0x307a0d[_0x999e('0xdb')]];this['updateOriginated'](this[_0x999e('0x22')][_0x52e6b0[_0x999e('0xaf')]]);_0x16b8f4=new Hangup(_0x52e6b0,_0x307a0d);_0x16b8f4[_0x999e('0xa2')]=0x12;_0x16b8f4[_0x999e('0xa3')]='HangupInAMD';_0x16b8f4[_0x999e('0xe2')]=_0x999e('0xe3');ami[_0x999e('0xe4')]('custom:amd',ut['buildObj'](_0x16b8f4,'amd'));this[_0x999e('0xce')](_0x16b8f4,'[syncHangupInAMDIvr][createHistory]',_0x999e('0xff'));}if(_0x52e6b0[_0x999e('0x4b')]===_0x999e('0x8d')&&this[_0x999e('0x22')][_0x52e6b0[_0x999e('0xaf')]][_0x999e('0xe9')]&&_0x307a0d[_0x999e('0xe0')]===_0x999e('0xea')){var _0x4e943f=this;return new BPromise(function(_0x54c72a,_0x16a067){delete _0x4e943f[_0x999e('0x28')][_0x307a0d['uniqueid']];_0x4e943f[_0x999e('0xb1')](_0x4e943f['campaigns'][_0x52e6b0['queue']]);_0x4e943f[_0x999e('0x22')][_0x52e6b0[_0x999e('0xaf')]][_0x999e('0x5d')]+=0x1;_0x4e943f[_0x999e('0x22')][_0x52e6b0[_0x999e('0xaf')]][_0x999e('0x5c')]+=0x1;var _0x9adcb0=_0x4e943f[_0x999e('0x22')][_0x52e6b0[_0x999e('0xaf')]];var _0x4537ed=new Hangup(_0x52e6b0,_0x307a0d);_0x4537ed[_0x999e('0xa2')]=0x13;_0x4537ed['statedesc']='Machine';_0x4537ed[_0x999e('0xe2')]=_0x999e('0xe3');_0x4537ed['countmachineretry']+=0x1;_0x4537ed[_0x999e('0xec')]+=0x1;_0x4537ed['amd']=!![];ami[_0x999e('0xe4')](_0x999e('0xe5'),ut[_0x999e('0x100')](_0x4537ed,'amd'));_0x4e943f[_0x999e('0xca')](_0x4537ed)[_0x999e('0xb6')](loggerCatch(_0x999e('0xed')));if(_0x4537ed[_0x999e('0xee')]+_0x4537ed[_0x999e('0xef')]+_0x4537ed['countnoanswerretry']+_0x4537ed['countnosuchnumberretry']+_0x4537ed[_0x999e('0xf2')]+_0x4537ed[_0x999e('0xf3')]+_0x4537ed[_0x999e('0xeb')]+_0x4537ed[_0x999e('0xf4')]>=_0x9adcb0[_0x999e('0x101')]){_0x4e943f[_0x999e('0xf5')](_0x4537ed,_0x54c72a,_0x16a067,_0x999e('0xf6'));}else{if(_0x4537ed[_0x999e('0xeb')]>=_0x9adcb0['dialMachineMaxRetry']){_0x4e943f[_0x999e('0xf8')](_0x4537ed,_0x54c72a,_0x16a067,_0x999e('0xf9'));}else{_0x4e943f[_0x999e('0xbf')]({'active':![],'countmachineretry':_0x4537ed[_0x999e('0xeb')],'scheduledat':moment()[_0x999e('0xfa')](_0x9adcb0[_0x999e('0xfb')],'minutes')['format'](_0x999e('0x102')),'ContactId':_0x4537ed[_0x999e('0x103')],'ListId':_0x4537ed[_0x999e('0xd0')],'VoiceQueueId':_0x4537ed[_0x999e('0xd2')]||undefined,'CampaignId':_0x4537ed[_0x999e('0xd3')]||undefined})[_0x999e('0xb6')](loggerCatch(_0x999e('0xfd')));_0x54c72a({'reschedule':0x1});}}});}}};Dialer[_0x999e('0x1d')][_0x999e('0x37')]=function(_0x211c7d){var _0x1e4d3c=this[_0x999e('0x28')][_0x211c7d[_0x999e('0xdb')]];var _0x4a2fbb=this;var _0x990fe3;if(_0x1e4d3c&&_0x1e4d3c[_0x999e('0x4b')]==='ivr'){delete this[_0x999e('0x28')][_0x211c7d[_0x999e('0xdb')]];this[_0x999e('0xb1')](this[_0x999e('0x22')][_0x1e4d3c[_0x999e('0xaf')]]);this[_0x999e('0x22')][_0x1e4d3c[_0x999e('0xaf')]][_0x999e('0x104')]+=0x1;_0x990fe3=new Hangup(_0x1e4d3c,_0x211c7d);this['createHistory'](_0x990fe3)[_0x999e('0xb6')](loggerCatch(_0x999e('0x105')));this['moveContactManagedDialer'](_0x990fe3)[_0x999e('0xb6')](loggerCatch(_0x999e('0x106')));}if(_0x1e4d3c&&_0x1e4d3c[_0x999e('0x4b')]!==_0x999e('0x8d')&&isNotNull(this['voiceQueues'][_0x1e4d3c['queue']][_0x999e('0x107')])){delete this[_0x999e('0x28')][_0x211c7d[_0x999e('0xdb')]];this[_0x999e('0xb1')](this['voiceQueues'][_0x1e4d3c['queue']]);this[_0x999e('0xae')][_0x1e4d3c['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x999e('0xae')][_0x1e4d3c['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x990fe3=new Hangup(_0x1e4d3c,_0x211c7d);_0x990fe3[_0x999e('0xa2')]=0x10;_0x990fe3['statedesc']=_0x999e('0x108');_0x990fe3[_0x999e('0xe2')]=_0x999e('0x109');this[_0x999e('0xca')](_0x990fe3)[_0x999e('0xb6')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x999e('0xc8')](_0x990fe3)['catch'](loggerCatch(_0x999e('0x106')));}if(_0x1e4d3c&&_0x1e4d3c[_0x999e('0x4b')]!==_0x999e('0x8d')&&!isNotNull(this[_0x999e('0xae')][_0x1e4d3c[_0x999e('0xaf')]][_0x999e('0x107')])){delete this['uniqueId'][_0x211c7d[_0x999e('0xdb')]];this[_0x999e('0xb1')](this[_0x999e('0xae')][_0x1e4d3c[_0x999e('0xaf')]]);this[_0x999e('0xae')][_0x1e4d3c[_0x999e('0xaf')]]['outboundUnknownCallsDay']+=0x1;_0x990fe3=new Hangup(_0x1e4d3c,_0x211c7d);_0x990fe3[_0x999e('0xa2')]=0xc;_0x990fe3[_0x999e('0xa3')]=_0x211c7d['cause-txt'];_0x990fe3[_0x999e('0xe2')]=_0x999e('0x10a');this[_0x999e('0xca')](_0x990fe3)['catch'](loggerCatch(_0x999e('0x105')));this[_0x999e('0xc8')](_0x990fe3)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x999e('0x1d')]['syncAgentComplete']=function(_0x33bcf6){var _0x98f099=this[_0x999e('0x28')][_0x33bcf6[_0x999e('0xdb')]];var _0x2b62a7=this;if(this['voiceQueues'][_0x33bcf6['queue']]){if(_0x98f099&&_0x98f099[_0x999e('0x4b')]!==_0x999e('0x8d')){delete this['uniqueId'][_0x33bcf6[_0x999e('0xdb')]];this[_0x999e('0xae')][_0x33bcf6['queue']][_0x999e('0x5d')]+=0x1;var _0x4cf199=new AgentComplete(_0x98f099,_0x33bcf6);if(_0x33bcf6['reason']==='agent'){_0x4cf199[_0x999e('0x10b')]=this[_0x999e('0xae')][_0x33bcf6['queue']]['dialQueueProject2']&&this['voiceQueues'][_0x33bcf6[_0x999e('0xaf')]]['dialAgiAfterHangupAgent']?moment()[_0x999e('0x90')](_0x999e('0x102')):undefined;}this[_0x999e('0xca')](_0x4cf199)[_0x999e('0xb6')](loggerCatch(_0x999e('0x10c')));this[_0x999e('0xc8')](_0x4cf199)[_0x999e('0xb6')](loggerCatch(_0x999e('0x10d')));}}};Dialer['prototype']['syncAgentConnect']=function(_0x1b555d){if(this[_0x999e('0xae')][_0x1b555d[_0x999e('0xaf')]]){if(this[_0x999e('0x28')][_0x1b555d['uniqueid']]&&this['uniqueId'][_0x1b555d[_0x999e('0xdb')]][_0x999e('0x4b')]!==_0x999e('0x8d')){this[_0x999e('0xb1')](this[_0x999e('0xae')][_0x1b555d['queue']]);this[_0x999e('0x28')][_0x1b555d[_0x999e('0xdb')]][_0x999e('0x10e')]=moment()['format'](_0x999e('0x102'));}}};Dialer[_0x999e('0x1d')]['queueCallerAbandonCreateState']=function(_0x483dbf){this[_0x999e('0xca')](_0x483dbf)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x999e('0xc8')](_0x483dbf)[_0x999e('0xb6')](loggerCatch(_0x999e('0x10f')));};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x530dfa){var _0x5406b9=this['uniqueId'][_0x530dfa[_0x999e('0xdb')]];var _0x3b4217=this;if(this[_0x999e('0xae')][_0x530dfa['queue']]){if(_0x5406b9&&_0x5406b9[_0x999e('0x4b')]!==_0x999e('0x8d')){delete this[_0x999e('0x28')][_0x530dfa['uniqueid']];this[_0x999e('0xb1')](this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]]);_0x5406b9[_0x999e('0x110')]=moment()[_0x999e('0x90')](_0x999e('0x102'));var _0x588651=new QueueCallerAbandon(_0x5406b9,_0x530dfa);if(getSeconds(_0x5406b9[_0x999e('0x110')],_0x5406b9['responsetime'])>=_0x5406b9[_0x999e('0x111')]){this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]][_0x999e('0x7d')]+=0x1;this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x588651[_0x999e('0xa2')]=0xa;_0x588651['statedesc']='Drop';_0x588651[_0x999e('0x112')]=_0x999e('0x113');_0x588651[_0x999e('0x10b')]=this['voiceQueues'][_0x530dfa['queue']][_0x999e('0x114')]?moment()[_0x999e('0x90')](_0x999e('0x102')):undefined;_0x588651[_0x999e('0xf2')]+=0x1;_0x588651[_0x999e('0xec')]+=0x1;if(_0x588651['countdropretry']>=this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]][_0x999e('0x115')]){this[_0x999e('0x116')](_0x588651);}else{this[_0x999e('0xbf')]({'active':![],'countdropretry':_0x588651['countdropretry'],'scheduledat':moment()[_0x999e('0xfa')](this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]][_0x999e('0x117')],'minutes')[_0x999e('0x90')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5406b9[_0x999e('0x103')],'ListId':_0x5406b9[_0x999e('0xd0')],'VoiceQueueId':_0x5406b9['VoiceQueueId']||undefined,'CampaignId':_0x5406b9['CampaignId']||undefined})[_0x999e('0xb6')](loggerCatch(_0x999e('0x118')));var _0x352660=new History(_0x588651);_0x352660[_0x999e('0xa2')]=0xa;_0x352660[_0x999e('0xa3')]='Drop';_0x352660[_0x999e('0x119')]=moment()[_0x999e('0x90')](_0x999e('0x102'));_0x352660['endtime']=_0x352660[_0x999e('0x119')];_0x352660['calleridname']=_0x588651[_0x999e('0x11a')];_0x352660[_0x999e('0x11b')]=_0x588651[_0x999e('0x11b')];this[_0x999e('0xca')](_0x352660)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]][_0x999e('0x6b')]+=0x1;this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]][_0x999e('0x62')]+=0x1;_0x588651[_0x999e('0xa2')]=0xb;_0x588651['statedesc']=_0x999e('0x11c');_0x588651['dropreason']='CALLEREXIT';_0x588651[_0x999e('0xf3')]+=0x1;_0x588651[_0x999e('0xec')]+=0x1;if(_0x588651[_0x999e('0xf3')]>=this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]]['dialAbandonedMaxRetry']){this[_0x999e('0x116')](_0x588651);}else{this[_0x999e('0xbf')]({'active':![],'countabandonedretry':_0x588651[_0x999e('0xf3')],'scheduledat':moment()[_0x999e('0xfa')](this['voiceQueues'][_0x530dfa[_0x999e('0xaf')]][_0x999e('0x11d')],_0x999e('0xfc'))['format'](_0x999e('0x102')),'ContactId':_0x5406b9[_0x999e('0x103')],'ListId':_0x5406b9[_0x999e('0xd0')],'VoiceQueueId':_0x5406b9[_0x999e('0xd2')]||undefined,'CampaignId':_0x5406b9['CampaignId']||undefined})[_0x999e('0xb6')](loggerCatch(_0x999e('0x11e')));var _0x352660=new History(_0x588651);_0x352660[_0x999e('0xa2')]=0xb;_0x352660[_0x999e('0xa3')]=_0x999e('0x11c');_0x352660[_0x999e('0x119')]=moment()[_0x999e('0x90')]('YYYY-MM-DD\x20HH:mm:ss');_0x352660[_0x999e('0xa4')]=_0x352660['starttime'];_0x352660['calleridname']=_0x588651[_0x999e('0x11a')];_0x352660[_0x999e('0x11b')]=_0x588651[_0x999e('0x11b')];this[_0x999e('0xca')](_0x352660)['catch'](loggerCatch(_0x999e('0x11f')));}}}}};Dialer[_0x999e('0x1d')]['syncNewExten']=function(_0x114b6d){if(this[_0x999e('0x26')][_0x114b6d[_0x999e('0xdb')]]){this[_0x999e('0x26')][_0x114b6d[_0x999e('0xdb')]]['channel']=_0x114b6d[_0x999e('0xac')];}if(this['uniqueId'][_0x114b6d[_0x999e('0xdb')]]){this[_0x999e('0x28')][_0x114b6d[_0x999e('0xdb')]][_0x999e('0xac')]=_0x114b6d[_0x999e('0xac')];}};Dialer[_0x999e('0x1d')][_0x999e('0x3b')]=function(_0x260265){if(strategy[this['voiceQueues'][this[_0x999e('0x26')][_0x260265[_0x999e('0x120')]]['queue']][_0x999e('0x4d')]]==='roundrobin'){if(this[_0x999e('0x26')][_0x260265['actionid']]&&_['isNil'](this[_0x999e('0x26')][_0x260265[_0x999e('0x120')]]['locked'])&&_0x260265[_0x999e('0xd8')]==='1'&&_0x260265[_0x999e('0x121')]==='0'){if(this[_0x999e('0x23')][_0x260265[_0x999e('0x122')]]){if(!this[_0x999e('0x23')][_0x260265[_0x999e('0x122')]][_0x999e('0x123')]){this[_0x999e('0x23')][_0x260265['stateinterface']][_0x999e('0x123')]=!![];this[_0x999e('0x26')][_0x260265['actionid']]['locked']=!![];this[_0x999e('0x26')][_0x260265['actionid']][_0x999e('0x122')]=_0x260265[_0x999e('0x122')];}}}}else if((strategy[this[_0x999e('0xae')][this[_0x999e('0x26')][_0x260265['actionid']]['queue']][_0x999e('0x4d')]]||_0x999e('0x1c'))===_0x999e('0x1c')){if(this[_0x999e('0x26')][_0x260265[_0x999e('0x120')]]){if(this[_0x999e('0x23')][_0x260265[_0x999e('0x122')]]){this[_0x999e('0x26')][_0x260265['actionid']][_0x999e('0x122')]=_0x260265[_0x999e('0x122')];if(_['isNil'](this[_0x999e('0x2c')][this[_0x999e('0x26')][_0x260265['actionid']][_0x999e('0xaf')]])){this[_0x999e('0x2c')][this[_0x999e('0x26')][_0x260265[_0x999e('0x120')]]['queue']]=[];}this[_0x999e('0x2c')][this['actions'][_0x260265[_0x999e('0x120')]][_0x999e('0xaf')]][_0x999e('0x124')](_['merge'](_['pick'](this[_0x999e('0x26')][_0x260265[_0x999e('0x120')]],['idHopper',_0x999e('0x122')]),{'status':_0x260265[_0x999e('0xd8')],'paused':_0x260265[_0x999e('0x121')]}));}}}};function unlockQueueStatus(_0x159958,_0x4cd151){setTimeout(function(){if(_[_0x999e('0x3f')](_0x159958['queueStatusComplete'])){loggerBooked[_0x999e('0x95')](_0x999e('0x125'),_0x4cd151);}_0x159958[_0x999e('0x126')]=!![];loggerBooked[_0x999e('0x77')](_0x999e('0x127'),_0x4cd151,JSON[_0x999e('0x49')](_[_0x999e('0x128')](_0x159958,[_0x999e('0x42'),_0x999e('0x126')])));},0x1f3);}Dialer['prototype']['syncQueueStatusComplete']=function(_0x5f18f4){var _0x4f6673=this;var _0x55772c=_0x4f6673[_0x999e('0xae')][_0x4f6673[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]];if(strategy[this['voiceQueues'][this['actions'][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]][_0x999e('0x4d')]]==='roundrobin'){if(this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]]&&this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0x122')]){this[_0x999e('0x21')][_0x999e('0x129')](this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0x12a')],this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0x122')])[_0x999e('0xb6')](function(_0x552331){logger[_0x999e('0x95')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x999e('0x93')](_0x552331,{'showHidden':![],'depth':null}));})[_0x999e('0x1f')](function(){_0x4f6673[_0x999e('0xb1')](_0x4f6673['voiceQueues'][_0x4f6673[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]]);_0x4f6673[_0x999e('0x23')][_0x4f6673[_0x999e('0x26')][_0x5f18f4['actionid']][_0x999e('0x122')]][_0x999e('0x123')]=![];delete _0x4f6673[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]];unlockQueueStatus(_0x55772c);});}else{this[_0x999e('0xb1')](this[_0x999e('0xae')][this[_0x999e('0x26')][_0x5f18f4['actionid']][_0x999e('0xaf')]]);this[_0x999e('0xbf')]({'active':![],'ContactId':this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0x103')],'ListId':this[_0x999e('0x26')][_0x5f18f4['actionid']]['ListId'],'VoiceQueueId':this[_0x999e('0x26')][_0x5f18f4['actionid']][_0x999e('0xd2')]||undefined,'CampaignId':this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xd3')]||undefined})['catch'](loggerCatch(_0x999e('0x12b')));delete this['actions'][_0x5f18f4[_0x999e('0x120')]];unlockQueueStatus(_0x55772c);}}else if((strategy[this[_0x999e('0xae')][this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]][_0x999e('0x4d')]]||_0x999e('0x1c'))===_0x999e('0x1c')){var _0x28a7d5;if(this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]]&&!_[_0x999e('0x48')](this[_0x999e('0x2c')][this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]]['queue']])){if(this['queueBookedRR'][_0x4f6673['actions'][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]]){this[_0x999e('0x2d')][_0x4f6673[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]]['queue']]=this[_0x999e('0x2d')][this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]]?this[_0x999e('0x2d')][this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]]:this[_0x999e('0x2c')][this[_0x999e('0x26')][_0x5f18f4['actionid']][_0x999e('0xaf')]]?this[_0x999e('0x2c')][this['actions'][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]][_0x999e('0x12c')]||0x0:0x0;}this[_0x999e('0x2c')][this['actions'][_0x5f18f4['actionid']][_0x999e('0xaf')]]['_rr']=this['queueBookedRR'][this['actions'][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]];for(var _0x1df955=0x0;_0x1df955=0x0;})[_0x999e('0xb6')](myreject(_0x1055c8)));}}else{_0x53bef5[_0x999e('0x124')](ami[_0x999e('0xab')]({'action':'command','command':util['format'](_0x999e('0x144'),_0x54e401,!_[_0x999e('0x3f')](config['timezones'][_0x504de6])?_0x504de6:'')})[_0x999e('0xb5')](function(_0x4b8bec){return _0x4b8bec['content'][_0x999e('0x147')](_0x999e('0x148'))>=0x0;})['catch'](myreject(_0x1055c8)));}BPromise[_0x999e('0x149')](_0x53bef5)[_0x999e('0xb5')](function(_0x75af7e){var _0xdc3dc1=_['some'](_0x75af7e);if(_0xdc3dc1){return _0x1aeaf1(_0xdc3dc1);}else{_0xddfbad['message']=_0x4baf36?_0x999e('0x14a'):_0x999e('0x14b');return _0x1055c8(msgResponse(_0x999e('0x14c'),_0x999e('0x13f'),_0x999e('0x14d')+_0x4baf36+'\x20'+_0x612199+'\x20Interval\x20is\x20overtime:\x20'+util[_0x999e('0x93')](_0x54e401,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x504de6));}})[_0x999e('0xb6')](function(_0x345961){return _0x1055c8(msgResponse(_0x999e('0x13c'),_0x999e('0x13f'),JSON['stringify'](_0x345961)));});});};Dialer[_0x999e('0x1d')][_0x999e('0x14e')]=function(_0xf44fc5){var _0xf402b4=this;return function(){switch(_0xf44fc5[_0x999e('0x59')]){case _0x999e('0x14f'):freeVariablesPredictive(_0xf44fc5);_0xf402b4[_0x999e('0x150')](_0xf44fc5,0x1);break;case _0x999e('0x151'):freeVariablesPredictive(_0xf44fc5);_0xf402b4['handlePower'](_0xf44fc5,_0xf44fc5[_0x999e('0x152')]);break;case'predictive':_0xf402b4[_0x999e('0xa')](_0xf44fc5);break;case _0x999e('0x8'):freeVariablesPredictive(_0xf44fc5);_0xf402b4[_0x999e('0x150')](_0xf44fc5,0x1);break;default:freeVariablesPredictive(_0xf44fc5);logger['error'](_0x999e('0x153'),_0xf44fc5[_0x999e('0x42')],_0x999e('0x154'));}};};Dialer['prototype'][_0x999e('0x155')]=function(_0x45098e){var _0x3ca17e=this;return function(){_0x3ca17e[_0x999e('0x156')](_0x45098e);};};Dialer['prototype'][_0x999e('0xb')]=function(_0x1007d3){var _0x343888=this;if(isNotPreview(_0x1007d3['dialMethod'])){if(isVoiceQueueOutbound(_0x1007d3[_0x999e('0x4b')])&&isActive(_0x1007d3[_0x999e('0x157')])){_0x1007d3[_0x999e('0x9b')]=!![];BPromise[_0x999e('0xb4')]()['then'](checkIsLoggedIn(_0x1007d3,_0x1007d3[_0x999e('0x158')]))['then'](checkIsActive(_0x1007d3,_0x1007d3['dialActive']))[_0x999e('0xb5')](checkInterval(_0x1007d3))[_0x999e('0xb5')](_0x343888['checkIsTrunkReachable'](_0x1007d3))[_0x999e('0xb5')](_0x343888[_0x999e('0x13b')](_0x1007d3['dialGlobalInterval'],_0x1007d3[_0x999e('0x159')],_0x1007d3[_0x999e('0x42')],_0x1007d3))[_0x999e('0xb5')](_0x343888['checkIfTimeIntervals'](_0x1007d3[_0x999e('0x44')],_0x1007d3[_0x999e('0x159')],_0x1007d3[_0x999e('0x42')],_0x1007d3))[_0x999e('0xb5')](_0x343888['checkDialMethod'](_0x1007d3))[_0x999e('0xb6')](loggerCatchQueueSummary(_0x999e('0x15a'),_0x1007d3));}else{notSendMessagesQueue(_0x1007d3);}}else{freeVariablesPredictive(_0x1007d3);}};Dialer[_0x999e('0x1d')][_0x999e('0x137')]=function(){var _0x5254be=this;var _0x470289;for(var _0x3a2e35 in this[_0x999e('0x22')]){if(typeof this['campaigns'][_0x3a2e35]!==_0x999e('0xa8')){_0x470289=this[_0x999e('0x22')][_0x3a2e35];if(isCampaignIvr(_0x470289[_0x999e('0x4b')])&&isActive(_0x470289['active'])){_0x470289[_0x999e('0x9b')]=!![];BPromise[_0x999e('0xb4')]()[_0x999e('0xb5')](checkIsActive(_0x470289,_0x470289[_0x999e('0xd7')]))['then'](checkInterval(_0x470289))[_0x999e('0xb5')](_0x5254be[_0x999e('0x15b')](_0x470289))[_0x999e('0xb5')](_0x5254be[_0x999e('0x13b')](_0x470289[_0x999e('0x15c')],_0x470289[_0x999e('0x159')],_0x470289['name'],_0x470289))[_0x999e('0xb5')](_0x5254be[_0x999e('0x13d')](_0x470289[_0x999e('0x44')],_0x470289['dialTimezone'],_0x470289[_0x999e('0x42')],_0x470289))[_0x999e('0xb5')](_0x5254be[_0x999e('0x155')](_0x470289))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x470289));}else{notSendMessagesCampaign(_0x470289);}}}};function getCallerIdRandom(_0x1ab0a4,_0x854fa8){var _0xc823fa;var _0x1ead8a;var _0x34feb4;if(_0x854fa8<=0x0){_0x854fa8=0x1;}_0xc823fa=new RegExp(_0x999e('0x15d')+_0x854fa8+'}$');_0x1ead8a=Math[_0x999e('0x15e')](0xa,_0x854fa8-0x1);_0x34feb4=Math[_0x999e('0x15e')](0xa,_0x854fa8)-0x1;return util[_0x999e('0x90')]('%s',_[_0x999e('0x15f')](_0x1ab0a4,_0xc823fa,_[_0x999e('0x160')](_0x1ead8a,_0x34feb4)));}function extractCalleridName(_0x500708){var _0x1033bb=_0x500708[_0x999e('0x161')](/"(.*?)"/);return _0x1033bb?_0x1033bb[0x1]:_0x500708;}function extractCalleridNumber(_0x251c20){var _0xa725cb=_0x251c20[_0x999e('0x161')](/<(.*?)>/);return _0xa725cb?_0xa725cb[0x1]:_0x251c20;}Dialer[_0x999e('0x1d')][_0x999e('0x162')]=function(_0x40593d,_0x51a2a6){var _0x478edf=this;var _0x5973ad=uuid['v4']();this['actions'][_0x5973ad]=new Action(_0x40593d,_0x51a2a6,_0x5973ad);return new BPromise(function(_0x57b2ba,_0x346c03){if(_[_0x999e('0x3f')](_0x40593d)&&typeof _0x40593d!=='object'){return _0x346c03(msgResponse('originate','Failure','voiceQueue\x20is\x20undefine'));}if(_[_0x999e('0x3f')](_0x51a2a6['Contact']['phone'])||_0x51a2a6[_0x999e('0x163')][_0x999e('0x164')]===null){return _0x346c03(msgResponse(_0x999e('0x165'),_0x999e('0x13f'),'contact\x20is\x20undefine'));}var _0x9184f={'XMD-CALLERID':_0x478edf['actions'][_0x5973ad][_0x999e('0x166')](),'XMD-AGI':_0x40593d[_0x999e('0x107')]?util[_0x999e('0x90')](_0x999e('0x167'),ipAgi,_0x40593d[_0x999e('0x107')]):_0x999e('0x168'),'XMD-AGIAFTER':_0x40593d['dialQueueProject2']?util[_0x999e('0x90')](_0x999e('0x167'),ipAgi,_0x40593d[_0x999e('0x114')]):'NONE','XMD-QUEUE':_0x40593d[_0x999e('0x4b')]==='outbound'?util['format']('\x22%s,%s%s,,,%s\x22',_0x40593d[_0x999e('0x42')],_0x40593d[_0x999e('0x169')]||'',_0x40593d[_0x999e('0x16a')]?'c':'',_0x40593d[_0x999e('0x111')]||0x3):_0x999e('0x168'),'XMD-CONTACTID':_0x51a2a6[_0x999e('0x103')],'XMD-CDRTYPE':_0x999e('0x7'),'CALLERID(all)':_0x478edf[_0x999e('0x26')][_0x5973ad][_0x999e('0x166')](),'XMD-AMD':_0x40593d[_0x999e('0xe9')]?'ACTIVE':_0x999e('0x168'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x40593d[_0x999e('0xe9')]){_0x9184f[_0x999e('0x16b')]=_0x40593d[_0x999e('0x16c')]||0x9c4;_0x9184f['XMD-AMDGREETING']=_0x40593d[_0x999e('0x16d')]||0x5dc;_0x9184f['XMD-AMDAFTERGREETINGSILENCE']=_0x40593d[_0x999e('0x16e')]||0x320;_0x9184f[_0x999e('0x16f')]=_0x40593d['dialAMDTotalAnalysisTime']||0x1388;_0x9184f[_0x999e('0x170')]=_0x40593d[_0x999e('0x171')]||0x64;_0x9184f['XMD-AMDBETWEENWORDSSILENCE']=_0x40593d[_0x999e('0x172')]||0x32;_0x9184f[_0x999e('0x173')]=_0x40593d[_0x999e('0x174')]||0x3;_0x9184f[_0x999e('0x175')]=_0x40593d[_0x999e('0x176')]||0x100;_0x9184f[_0x999e('0x177')]=_0x40593d[_0x999e('0x178')]||0x1388;}if(_0x40593d[_0x999e('0x4b')]===_0x999e('0x4c')){_0x9184f[_0x999e('0x179')]=_0x51a2a6[_0x999e('0xd2')];}else{_0x9184f[_0x999e('0x17a')]=_0x51a2a6[_0x999e('0xd3')];}for(var _0xdb2c7b in _0x51a2a6['Contact']){if(typeof _0x51a2a6[_0x999e('0x163')][_0xdb2c7b]!=='undefined'){if(isNotNull(_0x51a2a6[_0x999e('0x163')][_0xdb2c7b])&&_0xdb2c7b!=='id'&&_0xdb2c7b!==_0x999e('0x17b')&&_0xdb2c7b!=='createdAt'&&_0xdb2c7b!==_0x999e('0x17c')){_0x9184f[util[_0x999e('0x90')](_0x999e('0x17d'),_0x999e('0x17e'),_['toUpper'](_0xdb2c7b))]=_0x51a2a6[_0x999e('0x163')][_0xdb2c7b];}}}var _0x27f0fc=_0x478edf[_0x999e('0x138')](_0x40593d[_0x999e('0x72')])?getCallerId(_0x40593d[_0x999e('0x72')][_0x999e('0x73')],_0x40593d['dialOriginateCallerIdName'],_0x40593d[_0x999e('0x17f')]>0x0?getCallerIdRandom(_0x40593d['dialOriginateCallerIdNumber'],_0x40593d[_0x999e('0x17f')]):_0x40593d[_0x999e('0x5b')]):getCallerId(_[_0x999e('0xaa')](_0x40593d[_0x999e('0x139')])?_0x40593d['Trunk'][_0x999e('0x73')]:_0x40593d[_0x999e('0x139')]['callerid'],_0x40593d[_0x999e('0x5a')],_0x40593d[_0x999e('0x17f')]>0x0?getCallerIdRandom(_0x40593d[_0x999e('0x5b')],_0x40593d[_0x999e('0x17f')]):_0x40593d[_0x999e('0x5b')]);if(_0x27f0fc){_0x9184f[_0x999e('0x180')]=_0x478edf[_0x999e('0x26')][_0x5973ad][_0x999e('0x181')]=extractCalleridName(_0x27f0fc);_0x9184f['XMD-ORIGINATECALLERIDNUM']=_0x478edf[_0x999e('0x26')][_0x5973ad][_0x999e('0x182')]=extractCalleridNumber(_0x27f0fc);}return ami[_0x999e('0xab')]({'actionid':_0x5973ad,'action':_0x999e('0x165'),'channel':_0x478edf[_0x999e('0x138')](_0x40593d[_0x999e('0x72')])?util[_0x999e('0x90')](_0x999e('0x183'),_0x40593d['Trunk'][_0x999e('0x42')],isNotNull(_0x40593d[_0x999e('0x184')])?_0x40593d[_0x999e('0x184')][_0x999e('0x185')]()||'':'',_0x40593d['dialCutDigit']>0x0?_0x51a2a6[_0x999e('0x163')]['phone'][_0x999e('0x186')](_0x40593d[_0x999e('0x187')]):_0x51a2a6[_0x999e('0x163')][_0x999e('0x164')]):util[_0x999e('0x90')](_0x999e('0x183'),_[_0x999e('0xaa')](_0x40593d[_0x999e('0x139')])?_0x40593d[_0x999e('0x72')]['name']:_0x40593d[_0x999e('0x139')][_0x999e('0x42')],isNotNull(_0x40593d['dialPrefix'])?_0x40593d['dialPrefix']['trim']()||'':'',_0x40593d[_0x999e('0x187')]>0x0?_0x51a2a6[_0x999e('0x163')][_0x999e('0x164')][_0x999e('0x186')](_0x40593d[_0x999e('0x187')]):_0x51a2a6[_0x999e('0x163')][_0x999e('0x164')]),'callerid':_0x27f0fc,'Exten':_0x999e('0xdf'),'Context':'from-sip','Priority':'1','variable':_0x9184f,'timeout':(_0x40593d['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5973ad})['then'](function(_0x456f2a){return _0x57b2ba(_0x456f2a);})[_0x999e('0xb6')](function(_0x26a083){_0x40593d[_0x999e('0x188')]+=0x1;var _0x39fd24=new History(_0x478edf[_0x999e('0x26')][_0x5973ad]);logger[_0x999e('0x95')](util[_0x999e('0x90')]('[originateError]:\x20%s',JSON[_0x999e('0x49')](_0x26a083)));_0x39fd24[_0x999e('0xa2')]=0xe;_0x39fd24[_0x999e('0xa3')]='OriginateError';_0x39fd24[_0x999e('0x119')]=moment()[_0x999e('0x90')]('YYYY-MM-DD\x20HH:mm:ss');_0x39fd24[_0x999e('0xa4')]=_0x39fd24[_0x999e('0x119')];_0x478edf[_0x999e('0xca')](_0x39fd24)['catch'](loggerCatch(_0x999e('0x189')));_0x478edf['moveContactManagedDialer'](_0x39fd24)['catch'](loggerCatch(_0x999e('0x189')))[_0x999e('0x1f')](function(){delete _0x478edf[_0x999e('0x26')][_0x5973ad];return _0x346c03(msgResponse(_0x999e('0x165'),_0x999e('0x18a'),_0x999e('0x18b')));});});});};Dialer[_0x999e('0x1d')][_0x999e('0x32')]=function(_0x2029c1){var _0x4bc8fa=this[_0x999e('0x26')][_0x2029c1[_0x999e('0x120')]];if(_0x4bc8fa){delete this['actions'][_0x2029c1['actionid']];_0x4bc8fa[_0x999e('0x18c')]=moment()[_0x999e('0x90')](_0x999e('0x102'));var _0x6c93d2=_0x4bc8fa[_0x999e('0x4b')]===_0x999e('0x8d')?this['campaigns'][_0x4bc8fa[_0x999e('0xaf')]]:this['voiceQueues'][_0x4bc8fa['getQueue']()];if(!this['isSuccess'](_0x2029c1['response'])){this[_0x999e('0xb1')](_0x6c93d2);return this['callProgressDetecting'](_0x4bc8fa,_0x6c93d2,_0x2029c1)[_0x999e('0xb6')](loggerCatch(_0x999e('0x18d')));}this[_0x999e('0x28')][_0x2029c1['uniqueid']]=_0x4bc8fa;}};Dialer['prototype'][_0x999e('0x18e')]=function(_0x440e1b,_0x1ca49c,_0x110f6b){var _0x19204d=new History(_0x1ca49c);if(_0x19204d[_0x999e('0xee')]+_0x19204d[_0x999e('0xef')]+_0x19204d[_0x999e('0xf0')]+_0x19204d[_0x999e('0xf1')]+_0x19204d[_0x999e('0xf2')]+_0x19204d['countabandonedretry']+_0x19204d['countmachineretry']+_0x19204d[_0x999e('0xf4')]>=_0x110f6b[_0x999e('0x101')]-0x1){return!![];}switch(_0x440e1b){case 0x3:if(_0x19204d[_0x999e('0xf0')]>=_0x110f6b[_0x999e('0x18f')]-0x1){return!![];}this[_0x999e('0xbf')]({'active':![],'countnoanswerretry':_0x19204d['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x110f6b['dialNoAnswerRetryFrequency'],'minutes')[_0x999e('0x90')](_0x999e('0x102')),'ContactId':_0x19204d[_0x999e('0x103')],'ListId':_0x19204d['ListId'],'VoiceQueueId':_0x19204d[_0x999e('0xd2')]||undefined,'CampaignId':_0x19204d[_0x999e('0xd3')]||undefined})['catch'](loggerCatch(_0x999e('0x190')));break;case 0x5:if(_0x19204d['countbusyretry']>=_0x110f6b[_0x999e('0x191')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x19204d['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x110f6b['dialBusyRetryFrequency'],'minutes')['format'](_0x999e('0x102')),'ContactId':_0x19204d[_0x999e('0x103')],'ListId':_0x19204d[_0x999e('0xd0')],'VoiceQueueId':_0x19204d['VoiceQueueId']||undefined,'CampaignId':_0x19204d[_0x999e('0xd3')]||undefined})['catch'](loggerCatch(_0x999e('0x192')));break;case 0x8:if(_0x19204d[_0x999e('0xef')]>=_0x110f6b['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x19204d[_0x999e('0xef')]+=0x1,'scheduledat':moment()[_0x999e('0xfa')](_0x110f6b[_0x999e('0x193')],_0x999e('0xfc'))[_0x999e('0x90')](_0x999e('0x102')),'ContactId':_0x19204d['ContactId'],'ListId':_0x19204d[_0x999e('0xd0')],'VoiceQueueId':_0x19204d[_0x999e('0xd2')]||undefined,'CampaignId':_0x19204d['CampaignId']||undefined})['catch'](loggerCatch(_0x999e('0x194')));break;case 0x0:if(_0x19204d[_0x999e('0xf1')]>=_0x110f6b[_0x999e('0x195')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x19204d['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x999e('0xfa')](_0x110f6b[_0x999e('0x196')],_0x999e('0xfc'))[_0x999e('0x90')](_0x999e('0x102')),'ContactId':_0x19204d['ContactId'],'ListId':_0x19204d[_0x999e('0xd0')],'VoiceQueueId':_0x19204d['VoiceQueueId']||undefined,'CampaignId':_0x19204d['CampaignId']||undefined})['catch'](loggerCatch(_0x999e('0x197')));}break;case 0xa:if(_0x19204d[_0x999e('0xf2')]>=_0x110f6b[_0x999e('0x115')]-0x1){return!![];}this[_0x999e('0xbf')]({'active':![],'countdropretry':_0x19204d[_0x999e('0xf2')]+=0x1,'scheduledat':moment()['add'](_0x110f6b['dialDropRetryFrequency'],'minutes')[_0x999e('0x90')](_0x999e('0x102')),'ContactId':_0x19204d['ContactId'],'ListId':_0x19204d[_0x999e('0xd0')],'VoiceQueueId':_0x19204d[_0x999e('0xd2')]||undefined,'CampaignId':_0x19204d[_0x999e('0xd3')]||undefined})[_0x999e('0xb6')](loggerCatch(_0x999e('0x118')));break;case 0xb:if(_0x19204d[_0x999e('0xf3')]>=_0x110f6b[_0x999e('0x198')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x19204d['countabandonedretry']+=0x1,'scheduledat':moment()[_0x999e('0xfa')](_0x110f6b[_0x999e('0x11d')],_0x999e('0xfc'))['format'](_0x999e('0x102')),'ContactId':_0x19204d[_0x999e('0x103')],'ListId':_0x19204d[_0x999e('0xd0')],'VoiceQueueId':_0x19204d[_0x999e('0xd2')]||undefined,'CampaignId':_0x19204d['CampaignId']||undefined})[_0x999e('0xb6')](loggerCatch(_0x999e('0x11e')));break;case 0x13:if(_0x19204d[_0x999e('0xeb')]>=_0x110f6b[_0x999e('0xf7')]-0x1){return!![];}this[_0x999e('0xbf')]({'active':![],'countmachineretry':_0x19204d[_0x999e('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x110f6b[_0x999e('0xfb')],_0x999e('0xfc'))['format'](_0x999e('0x102')),'ContactId':_0x19204d[_0x999e('0x103')],'ListId':_0x19204d[_0x999e('0xd0')],'VoiceQueueId':_0x19204d[_0x999e('0xd2')]||undefined,'CampaignId':_0x19204d[_0x999e('0xd3')]||undefined})['catch'](loggerCatch(_0x999e('0xfd')));break;case 0x14:if(_0x19204d[_0x999e('0xf4')]>=_0x110f6b['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x999e('0xbf')]({'active':![],'countagentrejectretry':_0x19204d[_0x999e('0xf4')]+=0x1,'scheduledat':moment()[_0x999e('0xfa')](_0x110f6b[_0x999e('0x199')],'minutes')[_0x999e('0x90')](_0x999e('0x102')),'ContactId':_0x19204d[_0x999e('0x103')],'ListId':_0x19204d[_0x999e('0xd0')],'VoiceQueueId':_0x19204d['VoiceQueueId']||undefined,'CampaignId':_0x19204d[_0x999e('0xd3')]||undefined})[_0x999e('0xb6')](loggerCatch(_0x999e('0x19a')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x28fd86,_0x1e7f74,_0x1c46e5){var _0x53be45=this;var _0x44b897=new History(_0x28fd86);return new BPromise(function(_0x1e6b8c,_0x32900b){if(_[_0x999e('0x3f')](_0x1e7f74)&&typeof _0x1e7f74!=='object'){return _0x32900b(msgResponse(_0x999e('0x19b'),_0x999e('0x13f'),_0x999e('0x19c')));}if(_[_0x999e('0x3f')](_0x1c46e5)&&typeof _0x1c46e5!==_0x999e('0x19d')){return _0x32900b(msgResponse('[callProgressDetecting]',_0x999e('0x13f'),_0x999e('0x19e')));}switch(_0x1c46e5['reason']){case'0':_0x1e7f74[_0x999e('0x65')]+=0x1;_0x44b897[_0x999e('0xa2')]=0x0;_0x44b897[_0x999e('0xa3')]='NoSuchNumber';_0x44b897[_0x999e('0xf1')]+=0x1;_0x44b897[_0x999e('0xec')]+=0x1;ami[_0x999e('0xe4')](_0x999e('0x19f'),ut[_0x999e('0x100')](_0x28fd86,_0x999e('0x1a0')));_0x53be45[_0x999e('0xca')](_0x44b897)['catch'](loggerCatch(_0x999e('0xed')));if(_0x53be45['checkRetriveMax'](0x0,_0x28fd86,_0x1e7f74)){if(_0x44b897['countnosuchnumberretry']>=_0x1e7f74['dialNoSuchNumberMaxRetry']){_0x53be45['createStateFinal'](_0x44b897,_0x1e6b8c,_0x32900b,'reason\x200\x20no\x20such\x20number....');}else{_0x53be45['stateGlobal'](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1a1'));}}break;case'3':_0x1e7f74[_0x999e('0x64')]+=0x1;_0x44b897['state']=0x3;_0x44b897[_0x999e('0xa3')]='NoAnswer';_0x44b897[_0x999e('0xf0')]+=0x1;_0x44b897['countglobal']+=0x1;ami[_0x999e('0xe4')](_0x999e('0x1a2'),ut['buildObj'](_0x28fd86,'noanswer'));_0x53be45[_0x999e('0xca')](_0x44b897)[_0x999e('0xb6')](loggerCatch(_0x999e('0x1a3')));if(_0x53be45[_0x999e('0x18e')](0x3,_0x28fd86,_0x1e7f74)){if(_0x44b897['countnoanswerretry']>=_0x1e7f74[_0x999e('0x18f')]){_0x53be45[_0x999e('0xf8')](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1a4'));}else{_0x53be45[_0x999e('0xf5')](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1a4'));}}break;case'5':_0x1e7f74[_0x999e('0x5f')]+=0x1;_0x44b897[_0x999e('0xa2')]=0x5;_0x44b897['statedesc']=_0x999e('0x1a5');_0x44b897[_0x999e('0xee')]+=0x1;_0x44b897['countglobal']+=0x1;ami[_0x999e('0xe4')]('custom:agentbusy',ut['buildObj'](_0x28fd86,_0x999e('0x1a6')));_0x53be45[_0x999e('0xca')](_0x44b897)[_0x999e('0xb6')](loggerCatch(_0x999e('0x1a7')));if(_0x53be45[_0x999e('0x18e')](0x5,_0x28fd86,_0x1e7f74)){if(_0x44b897[_0x999e('0xee')]>=_0x1e7f74['dialBusyMaxRetry']){_0x53be45[_0x999e('0xf8')](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1a8'));}else{_0x53be45[_0x999e('0xf5')](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1a8'));}}break;case'8':_0x1e7f74[_0x999e('0x60')]+=0x1;_0x44b897['state']=0x8;_0x44b897[_0x999e('0xa3')]='Congestion';_0x44b897['countcongestionretry']+=0x1;_0x44b897[_0x999e('0xec')]+=0x1;ami[_0x999e('0xe4')](_0x999e('0x1a9'),ut[_0x999e('0x100')](_0x28fd86,'congestion'));_0x53be45[_0x999e('0xca')](_0x44b897)[_0x999e('0xb6')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x53be45[_0x999e('0x18e')](0x8,_0x28fd86,_0x1e7f74)){if(_0x44b897[_0x999e('0xef')]>=_0x1e7f74[_0x999e('0x1aa')]){_0x53be45[_0x999e('0xf8')](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1ab'));}else{_0x53be45[_0x999e('0xf5')](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1ab'));}}break;case'11':_0x1e7f74['outboundAbandonedCallsDay']+=0x1;_0x44b897[_0x999e('0xa2')]=0xb;_0x44b897[_0x999e('0xa3')]='Abandoned';_0x44b897[_0x999e('0xf3')]+=0x1;_0x44b897['countglobal']+=0x1;_0x53be45[_0x999e('0xca')](_0x44b897)['catch'](loggerCatch(_0x999e('0x11f')));if(_0x53be45['checkRetriveMax'](0xb,_0x28fd86,_0x1e7f74)){if(_0x44b897['countabandonedretry']>=_0x1e7f74[_0x999e('0x198')]){_0x53be45[_0x999e('0xf8')](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1ac'));}else{_0x53be45[_0x999e('0xf5')](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1ac'));}}break;case'20':_0x1e7f74[_0x999e('0x66')]+=0x1;_0x44b897[_0x999e('0xa2')]=0x14;_0x44b897[_0x999e('0xa3')]=_0x999e('0x1ad');_0x44b897[_0x999e('0xf4')]+=0x1;_0x44b897[_0x999e('0xec')]+=0x1;ami['emit']('custom:agentreject',ut['buildObj'](_0x28fd86,_0x999e('0x1ae')));_0x53be45[_0x999e('0xca')](_0x44b897)['catch'](loggerCatch(_0x999e('0x1af')));if(_0x53be45['checkRetriveMax'](0x14,_0x28fd86,_0x1e7f74)){if(_0x44b897['countagentrejectretry']>=_0x1e7f74[_0x999e('0x1b0')]){_0x53be45[_0x999e('0xf8')](_0x44b897,_0x1e6b8c,_0x32900b,'reason\x2020\x20agentreject');}else{_0x53be45['stateGlobal'](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1b1'));}}break;default:_0x1e7f74[_0x999e('0x67')]+=0x1;_0x44b897[_0x999e('0xa2')]=0xc;_0x44b897[_0x999e('0xa3')]=_0x1c46e5[_0x999e('0x1b2')];_0x53be45[_0x999e('0xca')](_0x44b897)[_0x999e('0xb6')](loggerCatch(_0x999e('0x1b3')));if(_0x53be45[_0x999e('0x18e')](_0x1c46e5[_0x999e('0x1b2')],_0x28fd86,_0x1e7f74)){if(_0x44b897[_0x999e('0xee')]+_0x44b897[_0x999e('0xef')]+_0x44b897[_0x999e('0xf0')]+_0x44b897['countnosuchnumberretry']+_0x44b897[_0x999e('0xf2')]+_0x44b897[_0x999e('0xf3')]+_0x44b897[_0x999e('0xeb')]+_0x44b897[_0x999e('0xf4')]>=_0x1e7f74['dialGlobalMaxRetry']){_0x53be45[_0x999e('0xf5')](_0x44b897,_0x1e6b8c,_0x32900b,_0x1c46e5['reason']);}else{_0x53be45[_0x999e('0xf8')](_0x44b897,_0x1e6b8c,_0x32900b,_0x1c46e5[_0x999e('0x1b2')]);}}}});};Dialer[_0x999e('0x1d')][_0x999e('0xf5')]=function(_0xd56a5c,_0x1e3f51,_0x55ba5b,_0x4d82ae){var _0x47707f=new Final(_0xd56a5c);_0x47707f[_0x999e('0xa2')]=0xf;_0x47707f['statedesc']=_0x999e('0x1b4');this[_0x999e('0xf8')](_0x47707f,_0x1e3f51,_0x55ba5b,_0x4d82ae);};Dialer['prototype'][_0x999e('0xf8')]=function(_0x2e401d,_0x6bb222,_0x29b14a,_0x3c9505){this['moveContactManagedDialer'](_0x2e401d)[_0x999e('0xb5')](function(){return _0x6bb222(msgResponse(_0x999e('0x19b'),_0x999e('0xd6'),_0x3c9505));})[_0x999e('0xb6')](function(){return _0x29b14a(msgResponse(_0x999e('0x1b5'),_0x999e('0x13f'),_0x999e('0x1b6')));});};Dialer[_0x999e('0x1d')][_0x999e('0xa')]=function(_0x5bf558){var _0x39ed50=_0x5bf558[_0x999e('0x1b7')]/0x64;var _0x1500c6=_0x5bf558[_0x999e('0x63')]/(_0x5bf558[_0x999e('0x63')]+_0x5bf558[_0x999e('0x5d')]);var _0x270e47=Math[_0x999e('0x1b8')](_0x5bf558[_0x999e('0x1b9')]*(_0x5bf558[_0x999e('0x1ba')]/0x64));var _0xd36faf=Math[_0x999e('0x1b8')](_0x5bf558[_0x999e('0x1b9')]*(_0x5bf558[_0x999e('0x1bb')]/0x64));var _0x35a1bc=_0x5bf558[_0x999e('0x4f')]+_0x5bf558[_0x999e('0x9c')];var _0x2b2e63=Math[_0x999e('0x1bc')](_0x5bf558[_0x999e('0x6f')]*_0x5bf558['erlangAbandonmentRate']*_0x5bf558[_0x999e('0x1bd')]*_0x5bf558[_0x999e('0x6d')]);if(_['isUndefined'](_0x5bf558['startProgressive'])){if(!_['isUndefined'](_0x5bf558[_0x999e('0x29')])){_0x5bf558['startPredictive']=undefined;loggerPredictive[_0x999e('0x95')](_0x999e('0x1be'),_0x999e('0x1bf'));}if(!_[_0x999e('0x3f')](_0x5bf558['handlePredictive'])){loggerPredictive[_0x999e('0x95')]('[startMethodPredictive][StartProgressive]',_0x999e('0x1c0'));clearInterval(_0x5bf558[_0x999e('0x8b')]);_0x5bf558[_0x999e('0x8b')]=undefined;}_0x5bf558['startProgressive']=moment()[_0x999e('0x90')](_0x999e('0x102'));loggerPredictive[_0x999e('0x77')](_0x5bf558[_0x999e('0x42')],_0x999e('0x1c1'),_0x5bf558[_0x999e('0x2a')]);this[_0x999e('0x150')](_0x5bf558,0x1);}else if(ifInterval(_0x5bf558[_0x999e('0x1c2')],_0x5bf558[_0x999e('0x2a')])){this[_0x999e('0x150')](_0x5bf558,0x1);loggerPredictiveCalls['info'](_0x999e('0x1c3'),_0x5bf558[_0x999e('0x2a')],_0x5bf558['name']);_0x5bf558['erlangCalls']=0x0;_0x5bf558[_0x999e('0x1c4')]=0x0;}else if(_0x39ed50<_0x1500c6&&_0x5bf558[_0x999e('0x1c5')]===_0x999e('0x1c6')){freeVariablesPredictive(_0x5bf558);loggerPredictive[_0x999e('0x77')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x999e('0x1c7'),_0x1500c6,'startProgressive',_0x5bf558[_0x999e('0x42')]);}else if(_0x2b2e63<_0x5bf558[_0x999e('0x1c4')]&&_0x5bf558['dialPredictiveOptimization']===_0x999e('0x1c6')){freeVariablesPredictive(_0x5bf558);loggerPredictive['info'](_0x999e('0x1c8'),'Max\x20Drop\x20',_0x2b2e63,'Drop\x20in\x20this\x20interval',_0x5bf558['predictiveIntervalErlangCallsDroppedCalls'],_0x999e('0x2a'),_0x5bf558[_0x999e('0x42')]);}else if(!ifInterval(_0x5bf558[_0x999e('0x1c2')],_0x5bf558['startProgressive'])&&_['isUndefined'](_0x5bf558[_0x999e('0x29')])&&!_[_0x999e('0x3f')](_0x5bf558[_0x999e('0x2a')])){_0x5bf558[_0x999e('0x29')]=moment()[_0x999e('0x90')](_0x999e('0x102'));loggerPredictive[_0x999e('0x77')](_0x5bf558['name'],_0x999e('0x1c9'),_0x5bf558[_0x999e('0x29')]);this['averageHandleTime'](_0x5bf558['dialPredictiveInterval'])[_0x999e('0xb5')](this[_0x999e('0x1ca')](_0x5bf558))[_0x999e('0xb5')](mergeDataErlangB(_0x5bf558))[_0x999e('0xb5')](this['startMethodPredictive'](_0x5bf558))[_0x999e('0xb6')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x5bf558));}else if(!ifInterval(_0x5bf558[_0x999e('0x1c2')],_0x5bf558['startPredictive'])){_0x5bf558['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x5bf558['startPredictive']=moment()[_0x999e('0x90')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x999e('0x77')](_0x5bf558['name'],'recalculate\x20predictive\x20at',_0x5bf558[_0x999e('0x29')]);clearInterval(_0x5bf558[_0x999e('0x8b')]);_0x5bf558[_0x999e('0x8b')]=undefined;this['averageHandleTime'](_0x5bf558['dialPredictiveInterval'])['then'](this[_0x999e('0x1ca')](_0x5bf558))[_0x999e('0xb5')](mergeDataErlangB(_0x5bf558))[_0x999e('0xb5')](this[_0x999e('0x1cb')](_0x5bf558))[_0x999e('0xb6')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x5bf558));}else if(_0x5bf558[_0x999e('0x1b9')]&&_0x35a1bc<_0x5bf558[_0x999e('0x1b9')]-_0xd36faf){freeVariablesPredictive(_0x5bf558);loggerPredictive[_0x999e('0x77')](_0x5bf558[_0x999e('0x42')],_0x999e('0x1cc'),_0x35a1bc,_0x999e('0x1cd'),_0x5bf558[_0x999e('0x1b9')],'-',_0xd36faf,'=',_0x5bf558[_0x999e('0x1b9')]-_0xd36faf,')');}else if(_0x5bf558[_0x999e('0x1b9')]&&_0x35a1bc>_0x5bf558[_0x999e('0x1b9')]+_0x270e47){freeVariablesPredictive(_0x5bf558);loggerPredictive[_0x999e('0x77')](_0x5bf558[_0x999e('0x42')],_0x999e('0x1cc'),_0x35a1bc,')\x20are\x20more\x20than\x20threshold\x20(',_0x5bf558['predictiveIntervalAvailable'],'+',_0x270e47,'=',_0x5bf558['predictiveIntervalAvailable']+_0x270e47,')');}};Dialer[_0x999e('0x1d')][_0x999e('0x1ca')]=function(_0x1cb962){var _0x1f7ee9=this;return function(_0x3e166e){return new BPromise(function(_0x1abc31,_0x448a79){_[_0x999e('0xcf')](_0x1cb962,_0x3e166e[0x0]);if(checkGetDataPredictive(_0x3e166e[0x0])){var _0x3e3e12=_0x1cb962[_0x999e('0x1b9')]=_0x1cb962[_0x999e('0x9c')]+_0x1cb962[_0x999e('0x4f')];var _0x31f375=_0x1cb962['dialPredictiveInterval']*0x3c;var _0x167eeb=_0x3e166e[0x0][_0x999e('0x6a')]+_0x3e166e[0x0][_0x999e('0x69')];var _0x3e97ce=(_0x3e166e[0x0][_0x999e('0x68')]+_0x3e166e[0x0][_0x999e('0x7d')]+_0x3e166e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3e166e[0x0][_0x999e('0x7a')];_0x1cb962[_0x999e('0x1bd')]=_0x3e97ce>0x0?_0x3e97ce:0x1;switch(_0x1cb962[_0x999e('0x1c5')]){case _0x999e('0x1c6'):var _0x3b502f=_0x1cb962['dialPredictiveOptimizationPercentage']/0x64;return _0x1f7ee9[_0x999e('0x1ce')](_0x3e3e12,_0x31f375,_0x167eeb,_0x3e97ce,_0x3b502f)[_0x999e('0xb5')](function(_0x4328ec){return _0x1abc31(_0x4328ec);});case _0x999e('0x1cf'):var _0x49c278=_0x1cb962[_0x999e('0x1b7')]/0x64;return _0x1f7ee9[_0x999e('0x1d0')](_0x3e3e12,_0x31f375,_0x167eeb,_0x3e97ce,_0x49c278)[_0x999e('0xb5')](function(_0x9fc693){return _0x1abc31(_0x9fc693);});default:return _0x448a79(msgResponse(_0x999e('0x1d1'),_0x999e('0x13f'),_0x999e('0x1d2')));}}else{return _0x448a79(msgResponse(_0x999e('0x1d1'),'Failure',_0x999e('0x1d3')));}});};};Dialer['prototype'][_0x999e('0x1d4')]=function(_0xe5c22b){var _0xc79b3=this;return function(_0x33ccc5){return new BPromise(function(_0x5875ab,_0x364d5a){_['merge'](_0xe5c22b,_0x33ccc5[0x0]);if(checkGetDataPredictive(_0x33ccc5[0x0])){loggerPredictive[_0x999e('0x77')](JSON['stringify'](_0x33ccc5[0x0]));if(_0xe5c22b[_0x999e('0x1c5')]===_0x999e('0x1c6')){return _0xc79b3[_0x999e('0xc6')](_0xe5c22b['id'])[_0x999e('0xb5')](function(_0x38b372){var _0x1989e3=_0xe5c22b['loggedIn']-_0x38b372[0x0][_0x999e('0x1d5')];var _0x5d11fd=_0xe5c22b['dialPredictiveInterval']*0x3c;var _0x5e156b=_0x33ccc5[0x0][_0x999e('0x6a')]+_0x33ccc5[0x0][_0x999e('0x69')];var _0x574625=(_0x33ccc5[0x0][_0x999e('0x68')]+_0x33ccc5[0x0][_0x999e('0x7d')]+_0x33ccc5[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x33ccc5[0x0][_0x999e('0x7a')];var _0x31ce71=_0xe5c22b[_0x999e('0x1b7')]/0x64;_0xe5c22b[_0x999e('0x1d6')]=_0x38b372[0x0][_0x999e('0x1d5')]||0x0;_0xe5c22b[_0x999e('0x1bd')]=_0x574625>0x0?_0x574625:0x1;return _0xc79b3[_0x999e('0x1ce')](_0x1989e3,_0x5d11fd,_0x5e156b,_0x574625,_0x31ce71);})[_0x999e('0xb5')](function(_0x116da7){return _0x5875ab(_0x116da7);})[_0x999e('0xb6')](function(_0x11e71c){return _0x364d5a(msgResponse(_0x999e('0x1d7'),_0x999e('0x13f'),JSON[_0x999e('0x49')](_0x11e71c)));});}if(_0xe5c22b[_0x999e('0x1c5')]===_0x999e('0x1cf')){return _0xc79b3[_0x999e('0xc6')](_0xe5c22b['id'])[_0x999e('0xb5')](function(_0x482190){var _0x4442cf=_0xe5c22b['loggedIn']-_0x482190[0x0][_0x999e('0x1d5')];var _0x8431aa=_0xe5c22b[_0x999e('0x1c2')]*0x3c;var _0x41d0bd=_0x33ccc5[0x0][_0x999e('0x6a')]+_0x33ccc5[0x0][_0x999e('0x69')];var _0x3fbdb5=(_0x33ccc5[0x0][_0x999e('0x68')]+_0x33ccc5[0x0][_0x999e('0x7d')]+_0x33ccc5[0x0][_0x999e('0x6b')])/_0x33ccc5[0x0][_0x999e('0x7a')];var _0x5a17f1=_0xe5c22b[_0x999e('0x1b7')]/0x64;_0xe5c22b[_0x999e('0x1d6')]=_0x482190[0x0][_0x999e('0x1d5')]||0x0;_0xe5c22b[_0x999e('0x1bd')]=_0x3fbdb5>0x0?_0x3fbdb5:0x1;return _0xc79b3[_0x999e('0x1d0')](_0x4442cf,_0x8431aa,_0x41d0bd,_0x3fbdb5,_0x5a17f1);})[_0x999e('0xb5')](function(_0x17fb01){return _0x5875ab(_0x17fb01);})[_0x999e('0xb6')](function(_0x4072ae){return _0x364d5a(msgResponse(_0x999e('0x1d7'),_0x999e('0x13f'),JSON[_0x999e('0x49')](_0x4072ae)));});}}else{return _0x364d5a(msgResponse(_0x999e('0x1d1'),'Failure',_0x999e('0x1d3')));}});};};Dialer[_0x999e('0x1d')][_0x999e('0x1cb')]=function(_0x412609){var _0x53bd63=this;return function(){var _0x1ffc5e=0x0;var _0x3269b9=Math[_0x999e('0x1bc')](_0x412609[_0x999e('0x86')]*0x3e8);if(_0x3269b9>0x0){_0x3269b9=_0x3269b9<0x64?0x64:_0x3269b9;loggerPredictive[_0x999e('0x77')](_0x412609[_0x999e('0x42')],_0x999e('0x1d8'),_0x3269b9,_0x999e('0x89'));_0x412609['handlePredictive']=setInterval(function(){_0x53bd63[_0x999e('0x8b')](_0x412609);loggerPredictiveCalls[_0x999e('0x77')](_0x999e('0x1d9'),_0x1ffc5e+=0x1);},_0x3269b9);}else{loggerPredictive[_0x999e('0x77')](_0x412609[_0x999e('0x42')],_0x999e('0x1da'));}};};Dialer[_0x999e('0x1d')]['checkContactBlack']=function(_0x25ea92,_0x325ab3){var _0x4e7602=this;return function(_0x54569b){if(_[_0x999e('0x48')](_0x54569b)){if(_[_0x999e('0xaa')](_0x325ab3[_0x999e('0xd1')])||!_0x325ab3[_0x999e('0x1db')]){if(_0x25ea92['dialMethod']===_0x999e('0x8')){_0x25ea92[_0x999e('0x126')]=_[_0x999e('0x3f')](_0x25ea92[_0x999e('0x126')])?!![]:_0x25ea92['queueStatusComplete'];var _0x1ac2d2=uuid['v4']();_0x4e7602[_0x999e('0x26')][_0x1ac2d2]=new Action(_0x25ea92,_0x325ab3,_0x1ac2d2);loggerBooked[_0x999e('0x77')](_0x999e('0x1dc'),_0x1ac2d2,_0x999e('0x1dd'),JSON[_0x999e('0x49')](_0x25ea92['queueStatusComplete']),_0x999e('0x1de'),_0x25ea92['name']);if(_0x25ea92[_0x999e('0x126')]){_0x25ea92[_0x999e('0x126')]=![];_0x4e7602['queueBooked'][_0x4e7602[_0x999e('0x26')][_0x1ac2d2][_0x999e('0xaf')]]=[];ami['Action']({'actionid':_0x1ac2d2,'action':'queuestatus','queue':_0x25ea92[_0x999e('0x42')]})[_0x999e('0xb6')](function(){_0x4e7602[_0x999e('0xb1')](_0x25ea92);_0x4e7602['rescheduleContact']({'active':![],'ContactId':_0x4e7602[_0x999e('0x26')][_0x1ac2d2][_0x999e('0x103')],'ListId':_0x4e7602[_0x999e('0x26')][_0x1ac2d2]['ListId'],'VoiceQueueId':_0x4e7602['actions'][_0x1ac2d2]['VoiceQueueId']||undefined,'CampaignId':_0x4e7602[_0x999e('0x26')][_0x1ac2d2]['CampaignId']||undefined})[_0x999e('0xb6')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4e7602[_0x999e('0x26')][_0x1ac2d2];});}else{loggerBooked[_0x999e('0x77')](_0x999e('0x1df'),JSON[_0x999e('0x49')](_0x25ea92[_0x999e('0x126')]),'Queue:\x20',_0x25ea92['name']);_0x4e7602[_0x999e('0xb1')](_0x25ea92);_0x4e7602[_0x999e('0xbf')]({'active':![],'ContactId':_0x4e7602[_0x999e('0x26')][_0x1ac2d2][_0x999e('0x103')],'ListId':_0x4e7602[_0x999e('0x26')][_0x1ac2d2][_0x999e('0xd0')],'VoiceQueueId':_0x4e7602[_0x999e('0x26')][_0x1ac2d2][_0x999e('0xd2')]||undefined,'CampaignId':_0x4e7602[_0x999e('0x26')][_0x1ac2d2][_0x999e('0xd3')]||undefined})[_0x999e('0xb6')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4e7602[_0x999e('0x26')][_0x1ac2d2];}}else{return _0x4e7602[_0x999e('0x162')](_0x25ea92,_0x325ab3);}}else{if(getDiff(_0x325ab3['scheduledat'])<_0x25ea92[_0x999e('0x1e0')]*0x3c){if(_0x325ab3['Agent']&&!_0x325ab3[_0x999e('0x1e1')][_0x999e('0x1e2')]){_0x4e7602[_0x999e('0x21')][_0x999e('0x129')](_0x325ab3['id'])[_0x999e('0x1f')](function(){_0x4e7602[_0x999e('0xb1')](_0x25ea92);});}else{_0x4e7602[_0x999e('0xc0')]({'active':![]},_0x325ab3['id'],0x1)['finally'](function(){_0x4e7602[_0x999e('0xb1')](_0x25ea92);});}}else{_0x25ea92['outboundReCallsDay']+=0x1;_0x4e7602['updateOriginated'](_0x25ea92);if(_0x25ea92[_0x999e('0x1e3')]){_0x4e7602['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x325ab3[_0x999e('0x103')],'ListId':_0x325ab3[_0x999e('0xd0')],'VoiceQueueId':_0x325ab3[_0x999e('0xd2')]||undefined,'CampaignId':_0x325ab3[_0x999e('0xd3')]||undefined})[_0x999e('0xb6')](loggerCatch(_0x999e('0x1e4')));_0x4e7602[_0x999e('0xca')](createObjHistory(_0x25ea92,_0x325ab3,'RECALLINQUEUE',0x17,_0x999e('0x1e5')))[_0x999e('0xb6')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x4e7602[_0x999e('0xce')](createObjHistory(_0x25ea92,_0x325ab3,_0x999e('0x1e6'),0x16,'RecallFailedTimeout'),_0x999e('0x1e7'),_0x999e('0x1e8'));}}}}else{_0x25ea92[_0x999e('0x5e')]+=0x1;_0x4e7602[_0x999e('0xce')](createObjHistory(_0x25ea92,_0x325ab3,_0x999e('0x1e9'),0xd,_0x999e('0x1ea')),'[Originate][historyBlacklist]',_0x999e('0x1eb'));throw _0x999e('0x1ec');}};};Dialer[_0x999e('0x1d')][_0x999e('0x156')]=function(_0x50987f){var _0x3c0009=this;var _0x2cec45=_0x50987f[_0x999e('0x1ed')]-_0x50987f[_0x999e('0x6e')]-_0x50987f[_0x999e('0xc3')];emitCampaignSummary(_0x50987f);if(_0x2cec45>0x0){if(_0x2cec45>this[_0x999e('0x25')]){_0x2cec45=this['maxNumberOriginate'];}_0x50987f[_0x999e('0xc3')]+=_0x2cec45;this[_0x999e('0xc5')](_0x50987f['id'],_0x2cec45,_0x50987f['dialOrderByScheduledAt'],_0x50987f)[_0x999e('0xb5')](function(_0x5eb555){_0x50987f[_0x999e('0xc3')]-=_0x2cec45;_0x50987f[_0x999e('0xc3')]=_0x50987f[_0x999e('0xc3')]>0x0?_0x50987f[_0x999e('0xc3')]:0x0;if(!checkContactEmpty(_0x5eb555)){_0x50987f['message']='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x999e('0x1ee')+_0x50987f['name']);}else{_0x50987f['originated']+=_0x5eb555[_0x999e('0x94')];_0x50987f[_0x999e('0x40')]=_0x999e('0x1ef');for(var _0x1fd074=0x0;_0x1fd074<_0x5eb555['length'];_0x1fd074+=0x1){_0x50987f[_0x999e('0x1f0')]+=0x1;if(_[_0x999e('0xaa')](_0x5eb555[_0x1fd074])||_['isNil'](_0x5eb555[_0x1fd074][_0x999e('0x163')])||_[_0x999e('0xaa')](_0x5eb555[_0x1fd074][_0x999e('0x163')][_0x999e('0x164')])){_0x3c0009['emptyContact'](_0x999e('0x1f1'),_0x50987f,_0x5eb555[_0x1fd074]);}else{_0x3c0009[_0x999e('0xba')](_[_0x999e('0x128')](_0x5eb555[_0x1fd074],[_0x999e('0xd3'),_0x999e('0x1f2')]))[_0x999e('0xb5')](_0x3c0009[_0x999e('0x1f3')](_0x50987f,_0x5eb555[_0x1fd074]))[_0x999e('0xb6')](_0x3c0009['loggerHandler'](_0x999e('0x1f4'),_0x50987f));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x50987f,_0x2cec45));}};Dialer[_0x999e('0x1d')][_0x999e('0x150')]=function(_0x5ccd78,_0x145e94){var _0x36bd8d=this;var _0x2f5632=[];var _0x18a556=_0x145e94>=0x1?_0x145e94:0x1;if(_0x5ccd78[_0x999e('0x59')]===_0x999e('0x8')){_0x18a556=0x1;}var _0x3d2fa6=Math['floor'](_0x5ccd78[_0x999e('0x4f')]*_0x18a556)-_0x5ccd78[_0x999e('0x6e')]-_0x5ccd78[_0x999e('0xc3')];emitVoiceQueueSummary(_0x5ccd78);if(_0x5ccd78[_0x999e('0x1f5')]>0x0){var _0x57d318=_0x5ccd78['dialLimitQueue']-_0x5ccd78[_0x999e('0x6e')]-_0x5ccd78[_0x999e('0x9c')]-_0x5ccd78['temp']-_0x5ccd78[_0x999e('0x50')];if(_0x3d2fa6>_0x57d318){_0x3d2fa6=_0x57d318;}}if(_0x3d2fa6>0x0){if(_0x5ccd78[_0x999e('0x59')]===_0x999e('0x8')){_0x3d2fa6=0x1;}if(_0x3d2fa6>this['maxNumberOriginate']){_0x3d2fa6=this[_0x999e('0x25')];}_0x5ccd78[_0x999e('0xc3')]+=_0x3d2fa6;for(var _0x50eaa0 in this[_0x999e('0x23')]){if(typeof this['agents'][_0x50eaa0]!==_0x999e('0xa8')){if(this['agents'][_0x50eaa0]['state']==='not_inuse'&&this[_0x999e('0x23')][_0x50eaa0][_0x999e('0xd8')]===_0x999e('0xd9')){_0x2f5632[_0x999e('0x124')](this['agents'][_0x50eaa0]['id']);}}}this[_0x999e('0xc2')](_0x5ccd78['id'],_0x2f5632,_0x3d2fa6,_0x5ccd78['dialOrderByScheduledAt'],_0x5ccd78)[_0x999e('0xb5')](function(_0x13e3cb){_0x5ccd78[_0x999e('0xc3')]-=_0x3d2fa6;_0x5ccd78[_0x999e('0xc3')]=_0x5ccd78[_0x999e('0xc3')]>0x0?_0x5ccd78[_0x999e('0xc3')]:0x0;if(!checkContactEmpty(_0x13e3cb)){_0x36bd8d[_0x999e('0xb3')](_0x5ccd78)[_0x999e('0xb5')](sendMessageReschedule(_0x5ccd78))['catch'](loggerCatch(_0x999e('0xb7')));}else{_0x5ccd78['originated']+=_0x13e3cb[_0x999e('0x94')];_0x5ccd78[_0x999e('0x40')]=_0x5ccd78[_0x999e('0x59')]===_0x999e('0x8')?_0x999e('0x1f6'):'RUNNING';for(var _0x241fb0=0x0;_0x241fb0<_0x13e3cb['length'];_0x241fb0+=0x1){if(_[_0x999e('0xaa')](_0x13e3cb[_0x241fb0])||_[_0x999e('0xaa')](_0x13e3cb[_0x241fb0][_0x999e('0x163')])||_['isNil'](_0x13e3cb[_0x241fb0]['Contact'][_0x999e('0x164')])){_0x36bd8d['emptyContact'](_0x999e('0x1f1'),_0x5ccd78,_0x13e3cb[_0x241fb0]);}else{_0x36bd8d[_0x999e('0xb8')](_['pick'](_0x13e3cb[_0x241fb0],['VoiceQueueId',_0x999e('0x1f2')]))[_0x999e('0xb5')](_0x36bd8d[_0x999e('0x1f3')](_0x5ccd78,_0x13e3cb[_0x241fb0]))[_0x999e('0xb6')](_0x36bd8d[_0x999e('0xcc')](_0x999e('0x1f1'),_0x5ccd78));}}}})[_0x999e('0xb6')](loggerGetContactDialer(_0x999e('0x1f7'),_0x5ccd78,_0x3d2fa6));}};Dialer['prototype'][_0x999e('0x8b')]=function(_0x33f8c6){if(_0x33f8c6[_0x999e('0x1f5')]>0x0){var _0x1527cb=_0x33f8c6[_0x999e('0x1f5')]-_0x33f8c6[_0x999e('0x6e')]-_0x33f8c6[_0x999e('0x9c')];if(_0x1527cb>0x0){this['tryOriginatePredictive'](_0x33f8c6);}else{loggerPredictiveCalls[_0x999e('0x77')]('[handlePredictive][limitChannel]');}}else{this[_0x999e('0x1f8')](_0x33f8c6);}};Dialer[_0x999e('0x1d')]['tryOriginatePredictive']=function(_0x277ec0){var _0x579f9e=this;var _0x1adbec=[];_0x277ec0['originated']+=0x1;for(var _0x189b52 in this[_0x999e('0x23')]){if(typeof this[_0x999e('0x23')][_0x189b52]!=='undefined'){if(this[_0x999e('0x23')][_0x189b52]['state']===_0x999e('0x1f9')&&this[_0x999e('0x23')][_0x189b52][_0x999e('0xd8')]===_0x999e('0xd9')){_0x1adbec[_0x999e('0x124')](this[_0x999e('0x23')][_0x189b52]['id']);}}}this['getContactDialer'](_0x277ec0['id'],_0x1adbec,0x1,_0x277ec0[_0x999e('0x1fa')],_0x277ec0)['then'](function(_0x4beb11){if(!checkContactEmpty(_0x4beb11)){checkContactLowerLimitOriginate(_0x277ec0,0x1,0x0);_0x579f9e[_0x999e('0xb3')](_0x277ec0)['then'](sendMessageReschedule(_0x277ec0))[_0x999e('0xb6')](loggerCatch(_0x999e('0xb7')));}else{_0x277ec0[_0x999e('0x40')]=_0x999e('0x1ef');if(_[_0x999e('0xaa')](_0x4beb11[0x0])||_[_0x999e('0xaa')](_0x4beb11[0x0][_0x999e('0x163')])||_['isNil'](_0x4beb11[0x0][_0x999e('0x163')]['phone'])){_0x579f9e[_0x999e('0xcd')](_0x999e('0x1f1'),_0x277ec0,_0x4beb11[0x0]);}else{_0x579f9e[_0x999e('0xb8')](_[_0x999e('0x128')](_0x4beb11[0x0],[_0x999e('0xd2'),_0x999e('0x1f2')]))[_0x999e('0xb5')](_0x579f9e[_0x999e('0x1f3')](_0x277ec0,_0x4beb11[0x0]))[_0x999e('0xb6')](_0x579f9e[_0x999e('0xcc')](_0x999e('0x1fb'),_0x277ec0));}}})[_0x999e('0xb6')](loggerGetContactDialer(_0x999e('0x1fc'),_0x277ec0,0x1));emitVoiceQueueSummary(_0x277ec0);};Dialer[_0x999e('0x1d')][_0x999e('0x1ce')]=function(_0x32b2fa,_0x121b54,_0x411c05,_0x445a7a,_0x1e9ca3,_0x3437c9){loggerPredictive[_0x999e('0x77')](_0x999e('0x1fd'));loggerPredictive['info'](_0x999e('0x1fe'),_0x32b2fa);loggerPredictive[_0x999e('0x77')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x121b54);loggerPredictive[_0x999e('0x77')](_0x999e('0x1ff'),_0x411c05);loggerPredictive[_0x999e('0x77')](_0x999e('0x200'),_0x445a7a);loggerPredictive[_0x999e('0x77')](_0x999e('0x201'),_0x1e9ca3);loggerPredictive[_0x999e('0x77')](_0x999e('0x80'));return new BPromise(function(_0x3f6455,_0xe25df9){if(_0x32b2fa<=0x0||isNaN(_0x32b2fa)){return _0xe25df9(msgResponse(_0x999e('0x202'),_0x999e('0x18a'),_0x999e('0x203')+_0x32b2fa));}if(_0x411c05<=0x0||isNaN(_0x411c05)){return _0xe25df9(msgResponse('[abandonmentRate]',_0x999e('0x18a'),'Ts\x20=\x20'+_0x411c05));}if(_0x445a7a<=0x0||isNaN(_0x445a7a)){return _0xe25df9(msgResponse(_0x999e('0x202'),_0x999e('0x18a'),_0x999e('0x204')+_0x445a7a));}if(_0x121b54<=0x0||isNaN(_0x121b54)){return _0xe25df9(msgResponse(_0x999e('0x202'),_0x999e('0x18a'),_0x999e('0x205')+_0x121b54));}if(_0x1e9ca3<=0x0||isNaN(_0x1e9ca3)){return _0xe25df9(msgResponse('[abandonmentRate]',_0x999e('0x18a'),_0x999e('0x206')+_0x1e9ca3));}_0x3437c9=_0x3437c9||0x0;var _0x2ef926=0x1/_0x411c05;var _0xe5a9fe=0x0;var _0x335381=0x0;var _0x38addb=0x0;var _0xaabacb=0x0;for(var _0x173992=0x0;_0x38addb<_0x1e9ca3;_0x173992+=0x1){_0x335381=_0x173992/_0x121b54;_0xe5a9fe=(_0x445a7a*_0x335381+_0x3437c9)/_0x2ef926;_0x38addb=erlangb(_0xe5a9fe,_0x32b2fa);_0xaabacb=_0xe5a9fe/_0x32b2fa*(0x1-erlangb(_0xe5a9fe,_0x32b2fa));}return _0x3f6455({'erlangCalls':_0x173992,'erlangCallToSecond':_0x121b54/_0x173992,'erlangAbandonmentRate':_0x38addb,'erlangBusyFactor':_0xaabacb});});};Dialer[_0x999e('0x1d')]['busyFactor']=function(_0x5148d7,_0x2ac75c,_0x5ea386,_0x570871,_0x5c95c2,_0x4f447d){loggerPredictive[_0x999e('0x77')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x999e('0x77')](_0x999e('0x1fe'),_0x5148d7);loggerPredictive[_0x999e('0x77')](_0x999e('0x207'),_0x2ac75c);loggerPredictive[_0x999e('0x77')](_0x999e('0x1ff'),_0x5ea386);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x570871);loggerPredictive[_0x999e('0x77')](_0x999e('0x208'),_0x5c95c2);loggerPredictive[_0x999e('0x77')](_0x999e('0x80'));return new BPromise(function(_0x1840cc,_0x3f4824){if(_0x5148d7<=0x0||isNaN(_0x5148d7)){return _0x3f4824(msgResponse(_0x999e('0x209'),_0x999e('0x18a'),_0x999e('0x203')+_0x5148d7));}if(_0x5ea386<=0x0||isNaN(_0x5ea386)){return _0x3f4824(msgResponse('[busyFactor]','Error',_0x999e('0x20a')+_0x5ea386));}if(_0x570871<=0x0||isNaN(_0x570871)){return _0x3f4824(msgResponse(_0x999e('0x209'),'Error',_0x999e('0x204')+_0x570871));}if(_0x2ac75c<=0x0||isNaN(_0x2ac75c)){return _0x3f4824(msgResponse(_0x999e('0x209'),_0x999e('0x18a'),_0x999e('0x205')+_0x2ac75c));}if(_0x5c95c2<=0x0||isNaN(_0x5c95c2)){return _0x3f4824(msgResponse(_0x999e('0x209'),_0x999e('0x18a'),_0x999e('0x20b')+_0x5c95c2));}_0x4f447d=_0x4f447d||0x0;var _0x4dba33=0x1/_0x5ea386;var _0x1af5d1=0x0;var _0xc50561=0x0;var _0x1bb1b0=0x0;var _0x40a3f0=0x0;for(var _0x126dc1=0x0;_0x40a3f0<_0x5c95c2;_0x126dc1+=0x1){_0xc50561=_0x126dc1/_0x2ac75c;_0x1af5d1=(_0x570871*_0xc50561+_0x4f447d)/_0x4dba33;_0x1bb1b0=erlangb(_0x1af5d1,_0x5148d7);_0x40a3f0=_0x1af5d1/_0x5148d7*(0x1-erlangb(_0x1af5d1,_0x5148d7));}return _0x1840cc({'erlangCalls':_0x126dc1,'erlangCallToSecond':_0x2ac75c/_0x126dc1,'erlangAbandonmentRate':_0x1bb1b0,'erlangBusyFactor':_0x40a3f0});});};module[_0x999e('0x20c')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 4e44001..4b0b6ae 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc63b=['name','calleridnum','starttime','responsetime','droptime','endtime','ringtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xc63b,0x1ba));var _0xbc63=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xc63b[_0x5834bc];return _0x3e183a;};'use strict';var util=require(_0xbc63('0x0'));var _=require(_0xbc63('0x1'));var moment=require(_0xbc63('0x2'));function getSeconds(_0x5d8584,_0x5b7f14){var _0x27ec4e=moment(_0x5d8584)[_0xbc63('0x3')](0x0);var _0x385873=moment(_0x5b7f14)[_0xbc63('0x3')](0x0);return _0x27ec4e[_0xbc63('0x4')](_0x385873,_0xbc63('0x5'));}function QueueCallerAbandon(_0x320ad8,_0x3406cd){this['scheduledat']=_0x320ad8['scheduledat'];this[_0xbc63('0x6')]=_0x320ad8[_0xbc63('0x6')];this[_0xbc63('0x7')]=_0x320ad8[_0xbc63('0x6')]===_0xbc63('0x8')?_0xbc63('0x9'):_0x320ad8[_0xbc63('0x6')];this[_0xbc63('0xa')]=_0x320ad8[_0xbc63('0xa')];this[_0xbc63('0xb')]=_0x320ad8['countcongestionretry'];this['countnoanswerretry']=_0x320ad8[_0xbc63('0xc')];this[_0xbc63('0xd')]=_0x320ad8[_0xbc63('0xa')]+_0x320ad8[_0xbc63('0xb')]+_0x320ad8[_0xbc63('0xc')]+_0x320ad8['countnosuchnumberretry']+_0x320ad8[_0xbc63('0xe')]+_0x320ad8[_0xbc63('0xf')]+_0x320ad8[_0xbc63('0x10')]+_0x320ad8[_0xbc63('0x11')];this[_0xbc63('0x12')]=_0x320ad8[_0xbc63('0x12')];this[_0xbc63('0xe')]=_0x320ad8[_0xbc63('0xe')];this[_0xbc63('0xf')]=_0x320ad8['countabandonedretry'];this[_0xbc63('0x10')]=_0x320ad8[_0xbc63('0x10')];this[_0xbc63('0x11')]=_0x320ad8[_0xbc63('0x11')];this[_0xbc63('0x13')]=_0x3406cd[_0xbc63('0x13')];this['calleridname']=_0x320ad8[_0xbc63('0x14')];this[_0xbc63('0x15')]=_0x320ad8['number'];this['starttime']=_0x320ad8[_0xbc63('0x16')];this[_0xbc63('0x17')]=_0x320ad8[_0xbc63('0x17')];this[_0xbc63('0x18')]=_0x320ad8[_0xbc63('0x18')];this[_0xbc63('0x19')]=this[_0xbc63('0x18')];this[_0xbc63('0x1a')]=getSeconds(_0x320ad8['responsetime'],_0x320ad8[_0xbc63('0x16')]);this['holdtime']=getSeconds(this[_0xbc63('0x18')],_0x320ad8[_0xbc63('0x17')]);this[_0xbc63('0x1b')]=0x0;this[_0xbc63('0x9')]=_0x3406cd[_0xbc63('0x9')];this['membername']=_0x3406cd[_0xbc63('0x1c')];this[_0xbc63('0x1d')]=_0x3406cd[_0xbc63('0x1d')];this['callback']=_0x320ad8[_0xbc63('0x1e')];this[_0xbc63('0x1f')]=_0x320ad8[_0xbc63('0x1f')];this[_0xbc63('0x20')]=_0x320ad8[_0xbc63('0x20')];this[_0xbc63('0x21')]=_0x320ad8['recallme'];this[_0xbc63('0x22')]=_0x320ad8[_0xbc63('0x22')];this[_0xbc63('0x23')]=_0x320ad8[_0xbc63('0x23')];this[_0xbc63('0x24')]=_0x320ad8[_0xbc63('0x24')];this[_0xbc63('0x25')]=_0x320ad8['VoiceQueueId'];this[_0xbc63('0x26')]=_0x320ad8['CampaignId'];this[_0xbc63('0x27')]=_0x320ad8[_0xbc63('0x27')]||'';this[_0xbc63('0x28')]=_0x320ad8[_0xbc63('0x28')]||'';}module[_0xbc63('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x2a0d=['starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum'];(function(_0x198fa1,_0x10d13e){var _0x34bb64=function(_0xea330b){while(--_0xea330b){_0x198fa1['push'](_0x198fa1['shift']());}};_0x34bb64(++_0x10d13e);}(_0x2a0d,0x1c4));var _0xd2a0=function(_0x2e6b63,_0x1a9190){_0x2e6b63=_0x2e6b63-0x0;var _0x38604f=_0x2a0d[_0x2e6b63];return _0x38604f;};'use strict';var util=require(_0xd2a0('0x0'));var _=require(_0xd2a0('0x1'));var moment=require(_0xd2a0('0x2'));function getSeconds(_0x136dad,_0x58f108){var _0x13df61=moment(_0x136dad)[_0xd2a0('0x3')](0x0);var _0x1f3baa=moment(_0x58f108)[_0xd2a0('0x3')](0x0);return _0x13df61['diff'](_0x1f3baa,_0xd2a0('0x4'));}function QueueCallerAbandon(_0x46b3c1,_0x1d1873){this[_0xd2a0('0x5')]=_0x46b3c1[_0xd2a0('0x5')];this[_0xd2a0('0x6')]=_0x46b3c1[_0xd2a0('0x6')];this[_0xd2a0('0x7')]=_0x46b3c1[_0xd2a0('0x6')]==='outbound'?'queue':_0x46b3c1['type'];this[_0xd2a0('0x8')]=_0x46b3c1[_0xd2a0('0x8')];this['countcongestionretry']=_0x46b3c1[_0xd2a0('0x9')];this[_0xd2a0('0xa')]=_0x46b3c1[_0xd2a0('0xa')];this[_0xd2a0('0xb')]=_0x46b3c1['countbusyretry']+_0x46b3c1[_0xd2a0('0x9')]+_0x46b3c1[_0xd2a0('0xa')]+_0x46b3c1[_0xd2a0('0xc')]+_0x46b3c1[_0xd2a0('0xd')]+_0x46b3c1['countabandonedretry']+_0x46b3c1[_0xd2a0('0xe')]+_0x46b3c1[_0xd2a0('0xf')];this[_0xd2a0('0xc')]=_0x46b3c1[_0xd2a0('0xc')];this[_0xd2a0('0xd')]=_0x46b3c1[_0xd2a0('0xd')];this[_0xd2a0('0x10')]=_0x46b3c1[_0xd2a0('0x10')];this[_0xd2a0('0xe')]=_0x46b3c1[_0xd2a0('0xe')];this['countagentrejectretry']=_0x46b3c1[_0xd2a0('0xf')];this[_0xd2a0('0x11')]=_0x1d1873['uniqueid'];this[_0xd2a0('0x12')]=_0x46b3c1[_0xd2a0('0x13')];this[_0xd2a0('0x14')]=_0x46b3c1['number'];this[_0xd2a0('0x15')]=_0x46b3c1[_0xd2a0('0x15')];this[_0xd2a0('0x16')]=_0x46b3c1['responsetime'];this[_0xd2a0('0x17')]=_0x46b3c1[_0xd2a0('0x17')];this[_0xd2a0('0x18')]=this[_0xd2a0('0x17')];this[_0xd2a0('0x19')]=getSeconds(_0x46b3c1[_0xd2a0('0x16')],_0x46b3c1[_0xd2a0('0x15')]);this[_0xd2a0('0x1a')]=getSeconds(this[_0xd2a0('0x17')],_0x46b3c1[_0xd2a0('0x16')]);this[_0xd2a0('0x1b')]=0x0;this[_0xd2a0('0x1c')]=_0x1d1873[_0xd2a0('0x1c')];this['membername']=_0x1d1873[_0xd2a0('0x1d')];this[_0xd2a0('0x1e')]=_0x1d1873[_0xd2a0('0x1e')];this[_0xd2a0('0x1f')]=_0x46b3c1[_0xd2a0('0x1f')];this['callbackuniqueid']=_0x46b3c1[_0xd2a0('0x20')];this[_0xd2a0('0x21')]=_0x46b3c1[_0xd2a0('0x21')];this[_0xd2a0('0x22')]=_0x46b3c1[_0xd2a0('0x22')];this['ContactId']=_0x46b3c1[_0xd2a0('0x23')];this[_0xd2a0('0x24')]=_0x46b3c1[_0xd2a0('0x24')];this[_0xd2a0('0x25')]=_0x46b3c1[_0xd2a0('0x25')];this['VoiceQueueId']=_0x46b3c1[_0xd2a0('0x26')];this['CampaignId']=_0x46b3c1[_0xd2a0('0x27')];this['originatecalleridnum']=_0x46b3c1[_0xd2a0('0x28')]||'';this[_0xd2a0('0x29')]=_0x46b3c1['originatecalleridname']||'';}module[_0xd2a0('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 0f5796d..ffeb6b4 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(_0x1917f4,_0x164409){var _0x52b8ff=function(_0x2fc47c){while(--_0x2fc47c){_0x1917f4['push'](_0x1917f4['shift']());}};_0x52b8ff(++_0x164409);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0xc4171b,_0x1da910){var _0x413e12=function(_0x21c77b){while(--_0x21c77b){_0xc4171b['push'](_0xc4171b['shift']());}};_0x413e12(++_0x1da910);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 99dcfb7..41275e9 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 _0xedbc=['SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20failed','checkAfterSend','isValid','Trunk\x20Reachable','format','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','isTrunkReachable','isNil','active','SIP/%s','reachable','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','util','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','bind','newstate','syncNewState','newexten','syncNewExten','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channel','uniqueid','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','merge','response','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]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20'];(function(_0x5e24ec,_0x41e787){var _0x342220=function(_0x15cca9){while(--_0x15cca9){_0x5e24ec['push'](_0x5e24ec['shift']());}};_0x342220(++_0x41e787);}(_0xedbc,0x8d));var _0xcedb=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xedbc[_0x25e7cb];return _0x375d92;};'use strict';var util=require(_0xcedb('0x0'));var _=require('lodash');var BPromise=require(_0xcedb('0x1'));var uuid=require('uuid');var moment=require(_0xcedb('0x2'));var path=require(_0xcedb('0x3'));var tiff2pdf=require(_0xcedb('0x4'));var gs=require(_0xcedb('0x5'));var logger=require(_0xcedb('0x6'))(_0xcedb('0x7'));var ami=require(_0xcedb('0x8'));var rpcDb=require(_0xcedb('0x9'));var Channel=require('./channel');var ut=require(_0xcedb('0xa'));var Action=require(_0xcedb('0xb'));var faxAccount=require(_0xcedb('0xc'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0xf946bc){this[_0xcedb('0xd')]={};this['faxAccounts']=_0xf946bc[_0xcedb('0xe')];this[_0xcedb('0xf')]=_0xf946bc[_0xcedb('0xf')];this[_0xcedb('0x10')]={};ami['on'](_0xcedb('0x11'),this[_0xcedb('0x12')]['bind'](this));ami['on'](_0xcedb('0x13'),this['syncVarSet'][_0xcedb('0x14')](this));ami['on'](_0xcedb('0x15'),this[_0xcedb('0x16')][_0xcedb('0x14')](this));ami['on'](_0xcedb('0x17'),this[_0xcedb('0x18')][_0xcedb('0x14')](this));ami['on']('faxstatus',this['syncFaxStatus'][_0xcedb('0x14')](this));ami['on'](_0xcedb('0x19'),this[_0xcedb('0x1a')]['bind'](this));ami['on'](_0xcedb('0x1b'),this[_0xcedb('0x1c')][_0xcedb('0x14')](this));ami['on']('originateresponse',this[_0xcedb('0x1d')][_0xcedb('0x14')](this));}Fax[_0xcedb('0x1e')][_0xcedb('0x12')]=function(_0x595519){if(_0x595519[_0xcedb('0x1f')]===_0xcedb('0x20')){for(var _0x5ea9f5 in this['faxAccounts']){if(this[_0xcedb('0xe')][_0xcedb('0x21')](_0x5ea9f5)){if(_0x595519[_0xcedb('0x22')]===this[_0xcedb('0xe')][_0x5ea9f5][_0xcedb('0x23')]){this[_0xcedb('0xd')][_0x595519['uniqueid']]={};this['channels'][_0x595519['uniqueid']][_0xcedb('0x24')]=_0x595519[_0xcedb('0x24')];this[_0xcedb('0xd')][_0x595519[_0xcedb('0x25')]]['id']=this[_0xcedb('0xe')][_0x5ea9f5]['id'];this[_0xcedb('0xd')][_0x595519['uniqueid']][_0xcedb('0x26')]=this['faxAccounts'][_0x5ea9f5][_0xcedb('0x26')];logger[_0xcedb('0x27')](_0x595519['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0xcedb('0x10')][_0x595519['uniqueid']]){this[_0xcedb('0xd')][_0x595519['uniqueid']]={};this[_0xcedb('0xd')][_0x595519[_0xcedb('0x25')]][_0xcedb('0x24')]=_0x595519['channel'];logger[_0xcedb('0x27')](_0x595519[_0xcedb('0x25')],_0xcedb('0x28'));}};Fax[_0xcedb('0x1e')][_0xcedb('0x29')]=function(_0x4bd0e6){if(this[_0xcedb('0xd')][_0x4bd0e6['uniqueid']]){for(var _0x369358 in _0x4bd0e6[_0xcedb('0x2a')]){if(_0x4bd0e6['variable'][_0xcedb('0x21')](_0x369358)){this[_0xcedb('0xd')][_0x4bd0e6['uniqueid']][_0x369358]=_0x4bd0e6[_0xcedb('0x2b')];}}}};Fax[_0xcedb('0x1e')][_0xcedb('0x16')]=function(_0x20b11f){if(this['channels'][_0x20b11f[_0xcedb('0x25')]]){this['channels'][_0x20b11f['uniqueid']][_0xcedb('0x2c')]=_0x20b11f[_0xcedb('0x2c')];this['channels'][_0x20b11f[_0xcedb('0x25')]][_0xcedb('0x2d')]=_0x20b11f['channelstatedesc'];}};Fax[_0xcedb('0x1e')][_0xcedb('0x18')]=function(_0x36cd05){if(this[_0xcedb('0xd')][_0x36cd05[_0xcedb('0x25')]]){for(var _0x2c8574 in _0x36cd05[_0xcedb('0x2a')]){if(_0x36cd05[_0xcedb('0x2a')][_0xcedb('0x21')](_0x2c8574)){this[_0xcedb('0xd')][_0x36cd05[_0xcedb('0x25')]][_0x2c8574]=_0x36cd05[_0xcedb('0x2b')];}}}};Fax[_0xcedb('0x1e')][_0xcedb('0x2e')]=function(_0x59e882){if(this['channels'][_0x59e882['uniqueid']]){this[_0xcedb('0xd')][_0x59e882[_0xcedb('0x25')]][_0xcedb('0x2f')]=_0x59e882[_0xcedb('0x2f')];this[_0xcedb('0xd')][_0x59e882[_0xcedb('0x25')]][_0xcedb('0x30')]=_0x59e882[_0xcedb('0x30')];this[_0xcedb('0xd')][_0x59e882[_0xcedb('0x25')]][_0xcedb('0x23')]=_0x59e882[_0xcedb('0x23')];this[_0xcedb('0xd')][_0x59e882[_0xcedb('0x25')]][_0xcedb('0x31')]=_0x59e882[_0xcedb('0x31')];logger[_0xcedb('0x27')](_0x59e882['uniqueid'],_0xcedb('0x32'));}};Fax['prototype'][_0xcedb('0x1a')]=function(_0x1c049e){var _0xf1fe4=this;if(this[_0xcedb('0xd')][_0x1c049e['uniqueid']]){var _0x2d0996=this[_0xcedb('0xd')][_0x1c049e[_0xcedb('0x25')]]['id'];this[_0xcedb('0xd')][_0x1c049e['uniqueid']][_0xcedb('0x33')]=_0x1c049e[_0xcedb('0x33')];this[_0xcedb('0xd')][_0x1c049e[_0xcedb('0x25')]][_0xcedb('0x34')]=_0x1c049e['pagestransferred'];this[_0xcedb('0xd')][_0x1c049e[_0xcedb('0x25')]]['localstationid']=_0x1c049e[_0xcedb('0x23')];this['channels'][_0x1c049e[_0xcedb('0x25')]][_0xcedb('0x35')]=_0x1c049e[_0xcedb('0x35')];this[_0xcedb('0xd')][_0x1c049e[_0xcedb('0x25')]]['transferrate']=_0x1c049e[_0xcedb('0x36')];this[_0xcedb('0xd')][_0x1c049e[_0xcedb('0x25')]][_0xcedb('0x31')]=_0x1c049e[_0xcedb('0x31')];this[_0xcedb('0xd')][_0x1c049e['uniqueid']]['calleridnum']=_0x1c049e[_0xcedb('0x37')];if(this['channels'][_0x1c049e[_0xcedb('0x25')]][_0xcedb('0x34')]>0x0){tiff2pdf(_0x1c049e[_0xcedb('0x31')],'/var/opt/motion2/server/files/attachments/',function(_0x3bf38a){logger[_0xcedb('0x27')](_0x1c049e[_0xcedb('0x25')],'\x20result\x20conversion\x20file\x20',_0x3bf38a[_0xcedb('0x38')]);attachment[_0xcedb('0x39')]({'name':path[_0xcedb('0x3a')](_0x1c049e[_0xcedb('0x31')])[_0xcedb('0x26')],'basename':path[_0xcedb('0x3a')](_0x1c049e[_0xcedb('0x31')])['name']+_0xcedb('0x3b'),'type':_0xcedb('0x3c')})[_0xcedb('0x3d')](function(_0x1360c5){faxAccount[_0xcedb('0x3e')](_0x2d0996,{'from':_0x1c049e[_0xcedb('0x37')],'mapKey':'fax','body':path['parse'](_0x1c049e[_0xcedb('0x31')])['name']+_0xcedb('0x3b'),'AttachmentId':_0x1360c5['id']})[_0xcedb('0x3f')](function(_0x5ba9e7){logger[_0xcedb('0x40')](_0x1c049e[_0xcedb('0x25')],_0xcedb('0x41'),JSON['stringify'](_0x5ba9e7));});})[_0xcedb('0x3f')](function(_0x6278ea){logger[_0xcedb('0x40')](_0x1c049e[_0xcedb('0x25')],_0xcedb('0x42'),JSON[_0xcedb('0x43')](_0x6278ea));});});}logger[_0xcedb('0x27')](_0x1c049e[_0xcedb('0x25')],_0xcedb('0x42'));}};Fax[_0xcedb('0x1e')][_0xcedb('0x1d')]=function(_0xb12565){if(this[_0xcedb('0x10')][_0xb12565[_0xcedb('0x25')]]){_[_0xcedb('0x44')](this[_0xcedb('0xd')][_0xb12565[_0xcedb('0x25')]],_['pick'](_0xb12565,[_0xcedb('0x45'),'reason']));}};function updateStatus(_0x295e96){if(_0x295e96[_0xcedb('0x46')]){faxMessage[_0xcedb('0x47')](_0x295e96['AttachmentId'],{'failMessage':_0xcedb('0x48')})[_0xcedb('0x3d')](function(_0x4654a4){ut[_0xcedb('0x49')](_0xcedb('0x4a'),_0x4654a4);})[_0xcedb('0x3f')](function(_0x5cbc95){ut[_0xcedb('0x49')](_0xcedb('0x4b'),_0x5cbc95);});}else{ut[_0xcedb('0x49')](_0xcedb('0x4c'));}}Fax[_0xcedb('0x1e')][_0xcedb('0x4d')]=function(_0x506dfd,_0x100ca6,_0x36a7b0){var _0x204bd1=this;var _0x3a3192={};if(_0x100ca6){_0x3a3192={'read':_0x100ca6};}else{_0x3a3192={'failMessage':_0x36a7b0};}if(this[_0xcedb('0x10')][_0x506dfd][_0xcedb('0x46')]){faxMessage[_0xcedb('0x47')](this[_0xcedb('0x10')][_0x506dfd]['AttachmentId'],_0x3a3192)[_0xcedb('0x3d')](function(_0x32f645){ut[_0xcedb('0x49')](_0xcedb('0x4e'),_0x32f645);})['catch'](function(_0x35191c){ut[_0xcedb('0x49')](_0xcedb('0x4f'),_0x35191c);})[_0xcedb('0x50')](function(){delete _0x204bd1[_0xcedb('0xd')][_0x506dfd];delete _0x204bd1[_0xcedb('0x10')][_0x506dfd];});}else{ut[_0xcedb('0x49')](_0xcedb('0x51'));delete this[_0xcedb('0xd')][_0x506dfd];delete this[_0xcedb('0x10')][_0x506dfd];}};Fax[_0xcedb('0x1e')][_0xcedb('0x1c')]=function(_0x59bc74){var _0x36d7a9=this;if(this[_0xcedb('0xd')][_0x59bc74[_0xcedb('0x25')]]){if(this[_0xcedb('0x10')][_0x59bc74['uniqueid']]){this[_0xcedb('0xd')][_0x59bc74[_0xcedb('0x25')]]['id']=this[_0xcedb('0x10')][_0x59bc74[_0xcedb('0x25')]]['id'];this[_0xcedb('0xd')][_0x59bc74['uniqueid']][_0xcedb('0x26')]=this[_0xcedb('0x10')][_0x59bc74[_0xcedb('0x25')]]['name'];}logger[_0xcedb('0x27')](_0x59bc74[_0xcedb('0x25')],this[_0xcedb('0x10')][_0x59bc74[_0xcedb('0x25')]]?_0xcedb('0x52'):_0xcedb('0x53'),JSON[_0xcedb('0x43')](this[_0xcedb('0xd')][_0x59bc74[_0xcedb('0x25')]]));if(this['actions'][_0x59bc74[_0xcedb('0x25')]]){if(this[_0xcedb('0xd')][_0x59bc74[_0xcedb('0x25')]][_0xcedb('0x54')]>0x0&&this[_0xcedb('0xd')][_0x59bc74[_0xcedb('0x25')]]['faxstatus']==='SUCCESS'){this[_0xcedb('0x4d')](_0x59bc74[_0xcedb('0x25')],!![]);}else{this['updateStatus'](_0x59bc74[_0xcedb('0x25')],![],this[_0xcedb('0xd')][_0x59bc74[_0xcedb('0x25')]][_0xcedb('0x55')]?_0xcedb('0x56')+this[_0xcedb('0xd')][_0x59bc74['uniqueid']]['faxstatusstring']:_0xcedb('0x57'));}}}};Fax['prototype'][_0xcedb('0x58')]=function(_0x3df0df){var _0x316b61=this;return new BPromise(function(_0x314323,_0x11435f){_0x316b61[_0xcedb('0x59')](_0x3df0df,_0x316b61[_0xcedb('0xe')][_0x3df0df[_0xcedb('0x5a')]])['then'](function(_0x3cca29){ut[_0xcedb('0x49')](_0xcedb('0x5b'),_0x3cca29);_0x314323(ut[_0xcedb('0x38')]('Fax\x20received'));})[_0xcedb('0x3f')](function(_0x545cbe){ut[_0xcedb('0x49')]('[Fax][execOriginate][failure]',_0x545cbe);updateStatus(_0x3df0df);_0x11435f(ut['message'](_0xcedb('0x5c')));});});};Fax[_0xcedb('0x1e')][_0xcedb('0x5d')]=function(_0x59d75d){var _0x19f3ee=this;return new BPromise(function(_0x76c9bf,_0x466e1e){var _0x21665e=_0x19f3ee['checkTrunk'](_0x19f3ee[_0xcedb('0xe')][_0x59d75d[_0xcedb('0x5a')]]['Trunk'],_0x59d75d);if(_0x21665e[_0xcedb('0x5e')]){_0x76c9bf(ut[_0xcedb('0x38')](_0xcedb('0x5f')));}else{_0x466e1e(ut[_0xcedb('0x38')](_0x21665e['message']));}});};function originate(_0x5099a7,_0x4dcb2f,_0x3b352d){return new BPromise(function(_0x54ad6d,_0x45c35f){if(_0x3b352d){var _0x44650a=util[_0xcedb('0x60')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xcedb('0x3a')](_0x5099a7[_0xcedb('0x3')])[_0xcedb('0x26')],_0x5099a7[_0xcedb('0x3')]);gs[_0xcedb('0x61')](_0x44650a)['then'](function(){_0x5099a7[_0xcedb('0x3')]=util['format'](_0xcedb('0x62'),path[_0xcedb('0x3a')](_0x5099a7[_0xcedb('0x3')])['dir'],path[_0xcedb('0x3a')](_0x5099a7[_0xcedb('0x3')])['name']);_0x4dcb2f[_0xcedb('0x63')]=_0x5099a7['path'];ut['logger'](_0xcedb('0x64'),'');ami[_0xcedb('0x65')](ut['variablesAction'](_0x5099a7,_0x4dcb2f))['then'](function(_0x2e15c4){_0x54ad6d(_0x2e15c4);})[_0xcedb('0x3f')](function(_0x173650){_0x45c35f(_0x173650);});})[_0xcedb('0x3f')](function(_0x19024a){_0x45c35f(_0x19024a);});}else{ami[_0xcedb('0x65')](ut['variablesAction'](_0x5099a7,_0x4dcb2f))[_0xcedb('0x3d')](function(_0x26b754){_0x54ad6d(_0x26b754);})[_0xcedb('0x3f')](function(_0xf8990f){_0x45c35f(_0xf8990f);});}});}Fax[_0xcedb('0x1e')]['execOriginate']=function(_0x544fa1,_0x3a7d11){var _0x65c4de=this;return new BPromise(function(_0x373c0a,_0x480097){var _0x4748ab=uuid['v4']();var _0x265ed6=ut['addVariables'](_0x544fa1,_0x3a7d11);_0x65c4de[_0xcedb('0x10')][_0x4748ab]=new Action(_0x4748ab,_0x3a7d11,_0x544fa1);var _0x303182=_0x65c4de[_0xcedb('0x10')][_0x4748ab];if(path[_0xcedb('0x3a')](_0x544fa1['path'])['ext']===_0xcedb('0x3b')){originate(_0x303182,_0x265ed6,!![])[_0xcedb('0x3d')](function(_0x4ce745){_0x373c0a(_0x4ce745);})[_0xcedb('0x3f')](function(_0x1d4458){_0x480097(_0x1d4458);});}else{originate(_0x303182,_0x265ed6,![])[_0xcedb('0x3d')](function(_0x4e920f){_0x373c0a(_0x4e920f);})[_0xcedb('0x3f')](function(_0x65abae){_0x480097(_0x65abae);});}});};Fax['prototype'][_0xcedb('0x66')]=function(_0x485d41){return!_[_0xcedb('0x67')](_0x485d41)&&!_[_0xcedb('0x67')](_0x485d41[_0xcedb('0x26')])&&!_[_0xcedb('0x67')](_0x485d41['active'])&&_0x485d41[_0xcedb('0x68')]&&!_[_0xcedb('0x67')](this['trunks'][util[_0xcedb('0x60')](_0xcedb('0x69'),_0x485d41['name'])])&&!_['isNil'](this[_0xcedb('0xf')][util['format'](_0xcedb('0x69'),_0x485d41[_0xcedb('0x26')])]['status'])&&(this[_0xcedb('0xf')][util['format'](_0xcedb('0x69'),_0x485d41[_0xcedb('0x26')])][_0xcedb('0x30')]===_0xcedb('0x6a')||this[_0xcedb('0xf')][util[_0xcedb('0x60')](_0xcedb('0x69'),_0x485d41[_0xcedb('0x26')])][_0xcedb('0x30')]==='unmonitored');};Fax[_0xcedb('0x1e')][_0xcedb('0x6b')]=function(_0x29f46d,_0x79eb0a){if(!this[_0xcedb('0x66')](_0x29f46d)){ut['logger'](_0xcedb('0x6c'),_[_0xcedb('0x67')](_0x29f46d)?'':_0x29f46d['name']+_0xcedb('0x6d'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xcedb('0x67')](_0x79eb0a[_0xcedb('0x7')])){ut['logger'](_0xcedb('0x6e'),JSON[_0xcedb('0x43')](_0x79eb0a));return{'isValid':![],'message':_0xcedb('0x6f')};}if(_[_0xcedb('0x67')](_0x79eb0a['path'])){ut[_0xcedb('0x49')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xcedb('0x43')](_0x79eb0a));return{'isValid':![],'message':_0xcedb('0x70')};}return{'isValid':!![],'message':_0xcedb('0x71')};};module['exports']=Fax; \ No newline at end of file +var _0xc403=['variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','newexten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','syncNewExten','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','fax','catch','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','actions','merge','response','reason','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action'];(function(_0x48f27a,_0x35d997){var _0x5f5de8=function(_0xe3bf3a){while(--_0xe3bf3a){_0x48f27a['push'](_0x48f27a['shift']());}};_0x5f5de8(++_0x35d997);}(_0xc403,0xf1));var _0x3c40=function(_0x10c5a8,_0x2f9bc5){_0x10c5a8=_0x10c5a8-0x0;var _0x5ba6e3=_0xc403[_0x10c5a8];return _0x5ba6e3;};'use strict';var util=require(_0x3c40('0x0'));var _=require(_0x3c40('0x1'));var BPromise=require('bluebird');var uuid=require(_0x3c40('0x2'));var moment=require(_0x3c40('0x3'));var path=require(_0x3c40('0x4'));var tiff2pdf=require(_0x3c40('0x5'));var gs=require(_0x3c40('0x6'));var logger=require('../../../config/logger')('fax');var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x3c40('0x7'));var ut=require(_0x3c40('0x8'));var Action=require('./action');var faxAccount=require(_0x3c40('0x9'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x3c40('0xa'));function Fax(_0x4c5d10){this[_0x3c40('0xb')]={};this[_0x3c40('0xc')]=_0x4c5d10[_0x3c40('0xc')];this[_0x3c40('0xd')]=_0x4c5d10[_0x3c40('0xd')];this['actions']={};ami['on'](_0x3c40('0xe'),this[_0x3c40('0xf')]['bind'](this));ami['on'](_0x3c40('0x10'),this[_0x3c40('0x11')][_0x3c40('0x12')](this));ami['on'](_0x3c40('0x13'),this['syncNewState'][_0x3c40('0x12')](this));ami['on'](_0x3c40('0x14'),this['syncNewExten'][_0x3c40('0x12')](this));ami['on'](_0x3c40('0x15'),this[_0x3c40('0x16')][_0x3c40('0x12')](this));ami['on'](_0x3c40('0x17'),this['syncReceiveFax'][_0x3c40('0x12')](this));ami['on'](_0x3c40('0x18'),this[_0x3c40('0x19')][_0x3c40('0x12')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x3c40('0x12')](this));}Fax[_0x3c40('0x1a')][_0x3c40('0xf')]=function(_0x25e946){if(_0x25e946[_0x3c40('0x1b')]===_0x3c40('0x1c')){for(var _0x2b7fb0 in this[_0x3c40('0xc')]){if(this['faxAccounts'][_0x3c40('0x1d')](_0x2b7fb0)){if(_0x25e946[_0x3c40('0x1e')]===this[_0x3c40('0xc')][_0x2b7fb0]['localstationid']){this[_0x3c40('0xb')][_0x25e946[_0x3c40('0x1f')]]={};this['channels'][_0x25e946['uniqueid']][_0x3c40('0x20')]=_0x25e946[_0x3c40('0x20')];this['channels'][_0x25e946[_0x3c40('0x1f')]]['id']=this['faxAccounts'][_0x2b7fb0]['id'];this['channels'][_0x25e946['uniqueid']][_0x3c40('0x21')]=this['faxAccounts'][_0x2b7fb0]['name'];logger[_0x3c40('0x22')](_0x25e946[_0x3c40('0x1f')],_0x3c40('0x23'));}}}}if(this['actions'][_0x25e946['uniqueid']]){this[_0x3c40('0xb')][_0x25e946[_0x3c40('0x1f')]]={};this[_0x3c40('0xb')][_0x25e946[_0x3c40('0x1f')]][_0x3c40('0x20')]=_0x25e946['channel'];logger[_0x3c40('0x22')](_0x25e946[_0x3c40('0x1f')],_0x3c40('0x23'));}};Fax[_0x3c40('0x1a')][_0x3c40('0x11')]=function(_0x590f52){if(this['channels'][_0x590f52[_0x3c40('0x1f')]]){for(var _0x227bfd in _0x590f52[_0x3c40('0x24')]){if(_0x590f52['variable'][_0x3c40('0x1d')](_0x227bfd)){this[_0x3c40('0xb')][_0x590f52[_0x3c40('0x1f')]][_0x227bfd]=_0x590f52['value'];}}}};Fax[_0x3c40('0x1a')]['syncNewState']=function(_0x3f22f5){if(this[_0x3c40('0xb')][_0x3f22f5[_0x3c40('0x1f')]]){this[_0x3c40('0xb')][_0x3f22f5[_0x3c40('0x1f')]][_0x3c40('0x25')]=_0x3f22f5['channelstate'];this[_0x3c40('0xb')][_0x3f22f5[_0x3c40('0x1f')]]['channelstatedesc']=_0x3f22f5[_0x3c40('0x26')];}};Fax[_0x3c40('0x1a')][_0x3c40('0x27')]=function(_0x47c3dd){if(this[_0x3c40('0xb')][_0x47c3dd[_0x3c40('0x1f')]]){for(var _0x41b066 in _0x47c3dd[_0x3c40('0x24')]){if(_0x47c3dd[_0x3c40('0x24')]['hasOwnProperty'](_0x41b066)){this[_0x3c40('0xb')][_0x47c3dd[_0x3c40('0x1f')]][_0x41b066]=_0x47c3dd[_0x3c40('0x28')];}}}};Fax[_0x3c40('0x1a')][_0x3c40('0x16')]=function(_0x2832d4){if(this[_0x3c40('0xb')][_0x2832d4[_0x3c40('0x1f')]]){this[_0x3c40('0xb')][_0x2832d4[_0x3c40('0x1f')]][_0x3c40('0x29')]=_0x2832d4[_0x3c40('0x29')];this[_0x3c40('0xb')][_0x2832d4['uniqueid']][_0x3c40('0x2a')]=_0x2832d4[_0x3c40('0x2a')];this[_0x3c40('0xb')][_0x2832d4['uniqueid']][_0x3c40('0x2b')]=_0x2832d4[_0x3c40('0x2b')];this[_0x3c40('0xb')][_0x2832d4[_0x3c40('0x1f')]]['filename']=_0x2832d4[_0x3c40('0x2c')];logger[_0x3c40('0x22')](_0x2832d4['uniqueid'],_0x3c40('0x2d'));}};Fax[_0x3c40('0x1a')]['syncReceiveFax']=function(_0x147528){var _0x38fe39=this;if(this[_0x3c40('0xb')][_0x147528[_0x3c40('0x1f')]]){var _0x5a03cf=this['channels'][_0x147528['uniqueid']]['id'];this[_0x3c40('0xb')][_0x147528['uniqueid']]['remotestationid']=_0x147528['remotestationid'];this[_0x3c40('0xb')][_0x147528[_0x3c40('0x1f')]][_0x3c40('0x2e')]=_0x147528[_0x3c40('0x2e')];this['channels'][_0x147528['uniqueid']]['localstationid']=_0x147528[_0x3c40('0x2b')];this[_0x3c40('0xb')][_0x147528[_0x3c40('0x1f')]][_0x3c40('0x2f')]=_0x147528[_0x3c40('0x2f')];this[_0x3c40('0xb')][_0x147528['uniqueid']][_0x3c40('0x30')]=_0x147528[_0x3c40('0x30')];this[_0x3c40('0xb')][_0x147528[_0x3c40('0x1f')]][_0x3c40('0x2c')]=_0x147528['filename'];this[_0x3c40('0xb')][_0x147528[_0x3c40('0x1f')]][_0x3c40('0x31')]=_0x147528[_0x3c40('0x31')];if(this['channels'][_0x147528[_0x3c40('0x1f')]][_0x3c40('0x2e')]>0x0){tiff2pdf(_0x147528[_0x3c40('0x2c')],'/var/opt/motion2/server/files/attachments/',function(_0x5a9f3c){logger['info'](_0x147528['uniqueid'],_0x3c40('0x32'),_0x5a9f3c[_0x3c40('0x33')]);attachment[_0x3c40('0x34')]({'name':path[_0x3c40('0x35')](_0x147528[_0x3c40('0x2c')])[_0x3c40('0x21')],'basename':path['parse'](_0x147528['filename'])[_0x3c40('0x21')]+_0x3c40('0x36'),'type':'application/pdf'})[_0x3c40('0x37')](function(_0x4c4534){faxAccount[_0x3c40('0x38')](_0x5a03cf,{'from':_0x147528[_0x3c40('0x31')],'mapKey':_0x3c40('0x39'),'body':path['parse'](_0x147528[_0x3c40('0x2c')])[_0x3c40('0x21')]+_0x3c40('0x36'),'AttachmentId':_0x4c4534['id']})[_0x3c40('0x3a')](function(_0x3cad82){logger['error'](_0x147528['uniqueid'],_0x3c40('0x3b'),JSON[_0x3c40('0x3c')](_0x3cad82));});})['catch'](function(_0x109fe2){logger['error'](_0x147528[_0x3c40('0x1f')],_0x3c40('0x3d'),JSON[_0x3c40('0x3c')](_0x109fe2));});});}logger[_0x3c40('0x22')](_0x147528['uniqueid'],_0x3c40('0x3d'));}};Fax['prototype'][_0x3c40('0x3e')]=function(_0x197953){if(this[_0x3c40('0x3f')][_0x197953[_0x3c40('0x1f')]]){_[_0x3c40('0x40')](this['channels'][_0x197953[_0x3c40('0x1f')]],_['pick'](_0x197953,[_0x3c40('0x41'),_0x3c40('0x42')]));}};function updateStatus(_0xd85136){if(_0xd85136[_0x3c40('0x43')]){faxMessage['update'](_0xd85136[_0x3c40('0x43')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x3c40('0x37')](function(_0x291fa9){ut[_0x3c40('0x44')](_0x3c40('0x45'),_0x291fa9);})[_0x3c40('0x3a')](function(_0x585d8c){ut[_0x3c40('0x44')]('[Fax][Message][Error][NoUpdate1]',_0x585d8c);});}else{ut[_0x3c40('0x44')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x3c40('0x1a')]['updateStatus']=function(_0x540ee0,_0x59b559,_0x36083d){var _0x3e4693=this;var _0x585c6c={};if(_0x59b559){_0x585c6c={'read':_0x59b559};}else{_0x585c6c={'failMessage':_0x36083d};}if(this['actions'][_0x540ee0][_0x3c40('0x43')]){faxMessage['update'](this[_0x3c40('0x3f')][_0x540ee0][_0x3c40('0x43')],_0x585c6c)['then'](function(_0xe86510){ut[_0x3c40('0x44')](_0x3c40('0x46'),_0xe86510);})[_0x3c40('0x3a')](function(_0x94a391){ut[_0x3c40('0x44')](_0x3c40('0x47'),_0x94a391);})[_0x3c40('0x48')](function(){delete _0x3e4693[_0x3c40('0xb')][_0x540ee0];delete _0x3e4693[_0x3c40('0x3f')][_0x540ee0];});}else{ut[_0x3c40('0x44')](_0x3c40('0x49'));delete this[_0x3c40('0xb')][_0x540ee0];delete this[_0x3c40('0x3f')][_0x540ee0];}};Fax[_0x3c40('0x1a')]['syncHangup']=function(_0xe8c7aa){var _0x31de2b=this;if(this[_0x3c40('0xb')][_0xe8c7aa[_0x3c40('0x1f')]]){if(this['actions'][_0xe8c7aa['uniqueid']]){this[_0x3c40('0xb')][_0xe8c7aa[_0x3c40('0x1f')]]['id']=this[_0x3c40('0x3f')][_0xe8c7aa['uniqueid']]['id'];this[_0x3c40('0xb')][_0xe8c7aa[_0x3c40('0x1f')]][_0x3c40('0x21')]=this[_0x3c40('0x3f')][_0xe8c7aa[_0x3c40('0x1f')]]['name'];}logger[_0x3c40('0x22')](_0xe8c7aa[_0x3c40('0x1f')],this['actions'][_0xe8c7aa[_0x3c40('0x1f')]]?_0x3c40('0x4a'):'\x20hangup\x20faxRiceive\x20',JSON[_0x3c40('0x3c')](this[_0x3c40('0xb')][_0xe8c7aa['uniqueid']]));if(this[_0x3c40('0x3f')][_0xe8c7aa['uniqueid']]){if(this[_0x3c40('0xb')][_0xe8c7aa[_0x3c40('0x1f')]][_0x3c40('0x4b')]>0x0&&this[_0x3c40('0xb')][_0xe8c7aa[_0x3c40('0x1f')]][_0x3c40('0x15')]===_0x3c40('0x4c')){this[_0x3c40('0x4d')](_0xe8c7aa[_0x3c40('0x1f')],!![]);}else{this[_0x3c40('0x4d')](_0xe8c7aa[_0x3c40('0x1f')],![],this[_0x3c40('0xb')][_0xe8c7aa[_0x3c40('0x1f')]][_0x3c40('0x4e')]?_0x3c40('0x4f')+this[_0x3c40('0xb')][_0xe8c7aa['uniqueid']][_0x3c40('0x4e')]:'SENDING\x20FAILED');}}}};Fax[_0x3c40('0x1a')][_0x3c40('0x50')]=function(_0x397ed3){var _0x34325b=this;return new BPromise(function(_0x22784f,_0x12abdd){_0x34325b[_0x3c40('0x51')](_0x397ed3,_0x34325b['faxAccounts'][_0x397ed3[_0x3c40('0x52')]])[_0x3c40('0x37')](function(_0x53b540){ut[_0x3c40('0x44')]('[Fax][execOriginate][success]',_0x53b540);_0x22784f(ut['message'](_0x3c40('0x53')));})['catch'](function(_0x498ea9){ut[_0x3c40('0x44')](_0x3c40('0x54'),_0x498ea9);updateStatus(_0x397ed3);_0x12abdd(ut[_0x3c40('0x33')](_0x3c40('0x55')));});});};Fax[_0x3c40('0x1a')][_0x3c40('0x56')]=function(_0x41b901){var _0x39dabe=this;return new BPromise(function(_0x3c3287,_0x4b9f84){var _0x2fcf82=_0x39dabe[_0x3c40('0x57')](_0x39dabe[_0x3c40('0xc')][_0x41b901[_0x3c40('0x52')]][_0x3c40('0x58')],_0x41b901);if(_0x2fcf82[_0x3c40('0x59')]){_0x3c3287(ut[_0x3c40('0x33')](_0x3c40('0x5a')));}else{_0x4b9f84(ut[_0x3c40('0x33')](_0x2fcf82[_0x3c40('0x33')]));}});};function originate(_0x5d480d,_0x2f578a,_0x3da0d3){return new BPromise(function(_0x3dab44,_0x2ea03f){if(_0x3da0d3){var _0x346824=util[_0x3c40('0x5b')](_0x3c40('0x5c'),path[_0x3c40('0x35')](_0x5d480d[_0x3c40('0x4')])[_0x3c40('0x21')],_0x5d480d[_0x3c40('0x4')]);gs[_0x3c40('0x5d')](_0x346824)[_0x3c40('0x37')](function(){_0x5d480d[_0x3c40('0x4')]=util['format']('%s/%s.tif',path['parse'](_0x5d480d[_0x3c40('0x4')])[_0x3c40('0x5e')],path[_0x3c40('0x35')](_0x5d480d[_0x3c40('0x4')])[_0x3c40('0x21')]);_0x2f578a[_0x3c40('0x5f')]=_0x5d480d[_0x3c40('0x4')];ut[_0x3c40('0x44')](_0x3c40('0x60'),'');ami[_0x3c40('0x61')](ut[_0x3c40('0x62')](_0x5d480d,_0x2f578a))[_0x3c40('0x37')](function(_0x533585){_0x3dab44(_0x533585);})[_0x3c40('0x3a')](function(_0x1b5b29){_0x2ea03f(_0x1b5b29);});})[_0x3c40('0x3a')](function(_0x5f43af){_0x2ea03f(_0x5f43af);});}else{ami['Action'](ut[_0x3c40('0x62')](_0x5d480d,_0x2f578a))[_0x3c40('0x37')](function(_0x556f54){_0x3dab44(_0x556f54);})[_0x3c40('0x3a')](function(_0xf79a93){_0x2ea03f(_0xf79a93);});}});}Fax['prototype'][_0x3c40('0x51')]=function(_0x4c32cd,_0x542f97){var _0x1bc986=this;return new BPromise(function(_0x4272e9,_0x2caa00){var _0x18a646=uuid['v4']();var _0x2133a0=ut['addVariables'](_0x4c32cd,_0x542f97);_0x1bc986[_0x3c40('0x3f')][_0x18a646]=new Action(_0x18a646,_0x542f97,_0x4c32cd);var _0x2d7711=_0x1bc986[_0x3c40('0x3f')][_0x18a646];if(path[_0x3c40('0x35')](_0x4c32cd[_0x3c40('0x4')])[_0x3c40('0x63')]==='.pdf'){originate(_0x2d7711,_0x2133a0,!![])[_0x3c40('0x37')](function(_0x4ea68a){_0x4272e9(_0x4ea68a);})[_0x3c40('0x3a')](function(_0x5f1b3c){_0x2caa00(_0x5f1b3c);});}else{originate(_0x2d7711,_0x2133a0,![])[_0x3c40('0x37')](function(_0x1e01d6){_0x4272e9(_0x1e01d6);})[_0x3c40('0x3a')](function(_0x26f02b){_0x2caa00(_0x26f02b);});}});};Fax[_0x3c40('0x1a')][_0x3c40('0x64')]=function(_0x16bea7){return!_[_0x3c40('0x65')](_0x16bea7)&&!_[_0x3c40('0x65')](_0x16bea7[_0x3c40('0x21')])&&!_['isNil'](_0x16bea7[_0x3c40('0x66')])&&_0x16bea7[_0x3c40('0x66')]&&!_[_0x3c40('0x65')](this[_0x3c40('0xd')][util[_0x3c40('0x5b')](_0x3c40('0x67'),_0x16bea7['name'])])&&!_[_0x3c40('0x65')](this['trunks'][util[_0x3c40('0x5b')](_0x3c40('0x67'),_0x16bea7[_0x3c40('0x21')])]['status'])&&(this[_0x3c40('0xd')][util['format'](_0x3c40('0x67'),_0x16bea7['name'])][_0x3c40('0x2a')]===_0x3c40('0x68')||this[_0x3c40('0xd')][util[_0x3c40('0x5b')](_0x3c40('0x67'),_0x16bea7[_0x3c40('0x21')])][_0x3c40('0x2a')]===_0x3c40('0x69'));};Fax[_0x3c40('0x1a')][_0x3c40('0x57')]=function(_0x3b0f89,_0x830426){if(!this[_0x3c40('0x64')](_0x3b0f89)){ut[_0x3c40('0x44')](_0x3c40('0x6a'),_[_0x3c40('0x65')](_0x3b0f89)?'':_0x3b0f89[_0x3c40('0x21')]+_0x3c40('0x6b'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x3c40('0x65')](_0x830426[_0x3c40('0x39')])){ut[_0x3c40('0x44')](_0x3c40('0x6c'),JSON[_0x3c40('0x3c')](_0x830426));return{'isValid':![],'message':_0x3c40('0x6d')};}if(_[_0x3c40('0x65')](_0x830426[_0x3c40('0x4')])){ut['logger'](_0x3c40('0x6e'),JSON[_0x3c40('0x3c')](_0x830426));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x3c40('0x6f')};};module[_0x3c40('0x70')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 5fdbbcf..831807b 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 _0xf22c=['lodash','../rpc/faxAccount','error','inspect','notify','resolve','catch','util','bluebird','../../../config/logger','preview'];(function(_0x20fdc1,_0xde1296){var _0x25397c=function(_0x814b51){while(--_0x814b51){_0x20fdc1['push'](_0x20fdc1['shift']());}};_0x25397c(++_0xde1296);}(_0xf22c,0x1bf));var _0xcf22=function(_0x1691d0,_0x230713){_0x1691d0=_0x1691d0-0x0;var _0x2c612f=_0xf22c[_0x1691d0];return _0x2c612f;};'use strict';var util=require(_0xcf22('0x0'));var BPromise=require(_0xcf22('0x1'));var logger=require(_0xcf22('0x2'))(_0xcf22('0x3'));var _=require(_0xcf22('0x4'));var faxAccount=require(_0xcf22('0x5'));function loggerCatch(_0x2491c4){return function(_0x42ffb7){logger[_0xcf22('0x6')](_0x2491c4,util[_0xcf22('0x7')](_0x42ffb7,{'showHidden':![],'depth':null}));};}exports[_0xcf22('0x8')]=function(_0x4eb0bb,_0x114c67){return BPromise[_0xcf22('0x9')]()['then'](faxAccount[_0xcf22('0x8')](_0x4eb0bb,_0x114c67))[_0xcf22('0xa')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x792f=['bluebird','../../../config/logger','preview','../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20','util'];(function(_0x1230b8,_0xa80c1f){var _0x149e66=function(_0x2ee33b){while(--_0x2ee33b){_0x1230b8['push'](_0x1230b8['shift']());}};_0x149e66(++_0xa80c1f);}(_0x792f,0x173));var _0xf792=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0x792f[_0x564821];return _0x2b604d;};'use strict';var util=require(_0xf792('0x0'));var BPromise=require(_0xf792('0x1'));var logger=require(_0xf792('0x2'))(_0xf792('0x3'));var _=require('lodash');var faxAccount=require(_0xf792('0x4'));function loggerCatch(_0x568f86){return function(_0x26b4f5){logger[_0xf792('0x5')](_0x568f86,util[_0xf792('0x6')](_0x26b4f5,{'showHidden':![],'depth':null}));};}exports[_0xf792('0x7')]=function(_0x425775,_0x2528b9){return BPromise[_0xf792('0x8')]()[_0xf792('0x9')](faxAccount['notify'](_0x425775,_0x2528b9))[_0xf792('0xa')](loggerCatch(_0xf792('0xb')));}; \ 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 20eb9d2..7bb799f 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 _0xf379=['exec','info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird','child_process'];(function(_0x53d172,_0x46611b){var _0x1bd0a2=function(_0x19fb52){while(--_0x19fb52){_0x53d172['push'](_0x53d172['shift']());}};_0x1bd0a2(++_0x46611b);}(_0xf379,0x7a));var _0x9f37=function(_0x23086c,_0x1ab355){_0x23086c=_0x23086c-0x0;var _0xf319bb=_0xf379[_0x23086c];return _0xf319bb;};'use strict';var util=require('util');var logger=require(_0x9f37('0x0'))(_0x9f37('0x1'));var BPromise=require(_0x9f37('0x2'));var exec=require(_0x9f37('0x3'))[_0x9f37('0x4')];exports['execute']=function(_0x4a16fb){return new BPromise(function(_0x392008,_0x2d528d){exec(_0x4a16fb,function(_0x2c6ac8,_0x2a1cfb,_0x5c611f){logger[_0x9f37('0x5')](_0x9f37('0x6'),_0x2a1cfb);if(_0x2c6ac8){logger['info'](_0x9f37('0x6'),_0x9f37('0x7'),util[_0x9f37('0x8')](_0x2c6ac8,{'showHidden':![],'depth':null}),_0x2a1cfb,_0x5c611f);_0x2d528d(_0x2c6ac8);}_0x392008(_0x2a1cfb);});});}; \ No newline at end of file +var _0xd181=['fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x41e2a5,_0x4ee5eb){var _0x59449f=function(_0x3ee967){while(--_0x3ee967){_0x41e2a5['push'](_0x41e2a5['shift']());}};_0x59449f(++_0x4ee5eb);}(_0xd181,0x1ab));var _0x1d18=function(_0x1a2551,_0x393aa8){_0x1a2551=_0x1a2551-0x0;var _0x5b5b60=_0xd181[_0x1a2551];return _0x5b5b60;};'use strict';var util=require(_0x1d18('0x0'));var logger=require(_0x1d18('0x1'))(_0x1d18('0x2'));var BPromise=require(_0x1d18('0x3'));var exec=require(_0x1d18('0x4'))[_0x1d18('0x5')];exports[_0x1d18('0x6')]=function(_0x1df8c0){return new BPromise(function(_0xef07f3,_0x1b13ae){exec(_0x1df8c0,function(_0x72229e,_0x432532,_0x54f4e){logger[_0x1d18('0x7')](_0x1d18('0x8'),_0x432532);if(_0x72229e){logger[_0x1d18('0x7')](_0x1d18('0x8'),_0x1d18('0x9'),util[_0x1d18('0xa')](_0x72229e,{'showHidden':![],'depth':null}),_0x432532,_0x54f4e);_0x1b13ae(_0x72229e);}_0xef07f3(_0x432532);});});}; \ 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 e6b1a93..da08783 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 _0x9364=['\x22%s\x22\x20<%s>','headerinfo','util','fax','message','logger','info','inspect','addVariables','ecm','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel'];(function(_0x1e76ab,_0x3b6bf3){var _0x19f801=function(_0x4b66ab){while(--_0x4b66ab){_0x1e76ab['push'](_0x1e76ab['shift']());}};_0x19f801(++_0x3b6bf3);}(_0x9364,0x1e5));var _0x4936=function(_0x273604,_0x5b53c4){_0x273604=_0x273604-0x0;var _0xe7a4ed=_0x9364[_0x273604];return _0xe7a4ed;};'use strict';var util=require(_0x4936('0x0'));var _=require('lodash');var moment=require('moment');var logger=require('../../../../config/logger')(_0x4936('0x1'));exports[_0x4936('0x2')]=function(_0x3a1493){return{'message':_0x3a1493};};exports[_0x4936('0x3')]=function(_0x49e268,_0x4d6e90){logger[_0x4936('0x4')](_0x49e268,util[_0x4936('0x5')](_0x4d6e90,{'showHidden':![],'depth':null}));};exports[_0x4936('0x6')]=function(_0x1ad21b,_0x54bc12){var _0x5ce0bc={'XMF-ECM':_0x54bc12[_0x4936('0x7')],'XMF-HEADERINFO':_0x54bc12['headerinfo'],'XMF-MINRATE':_0x54bc12['minrate'],'XMF-MAXRATE':_0x54bc12[_0x4936('0x8')],'XMF-MODEM':util[_0x4936('0x9')](_0x4936('0xa'),_0x54bc12[_0x4936('0xb')]),'XMF-GATEWAY':_0x54bc12[_0x4936('0xc')],'XMF-FAXDETECT':_0x54bc12[_0x4936('0xd')],'XMF-T38TIMEOUT':_0x54bc12[_0x4936('0xe')],'XMF-LOCALSTATIONID':_0x54bc12[_0x4936('0xf')],'XMF-PATH':_0x1ad21b[_0x4936('0x10')]};return _0x5ce0bc;};exports[_0x4936('0x11')]=function(_0x152b8e,_0x804e89){return{'actionid':_0x152b8e[_0x4936('0x12')],'action':_0x4936('0x13'),'channel':_0x152b8e[_0x4936('0x14')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x4936('0x9')](_0x4936('0x15'),_0x152b8e[_0x4936('0x16')]?_0x152b8e[_0x4936('0x16')]:'',_0x152b8e[_0x4936('0xf')]),'variable':_0x804e89,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x152b8e[_0x4936('0x12')]};}; \ No newline at end of file +var _0x5681=['path','uniqueid','originate','channel','\x22%s\x22\x20<%s>','lodash','../../../../config/logger','logger','info','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid'];(function(_0x591f2c,_0x4a1ce7){var _0xbd8d=function(_0x52e657){while(--_0x52e657){_0x591f2c['push'](_0x591f2c['shift']());}};_0xbd8d(++_0x4a1ce7);}(_0x5681,0xe1));var _0x1568=function(_0x52a9b3,_0x4b1a25){_0x52a9b3=_0x52a9b3-0x0;var _0x1c1a69=_0x5681[_0x52a9b3];return _0x1c1a69;};'use strict';var util=require('util');var _=require(_0x1568('0x0'));var moment=require('moment');var logger=require(_0x1568('0x1'))('fax');exports['message']=function(_0x2989c5){return{'message':_0x2989c5};};exports[_0x1568('0x2')]=function(_0x4853c6,_0x208f2e){logger[_0x1568('0x3')](_0x4853c6,util['inspect'](_0x208f2e,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x354992,_0x50590c){var _0x30da5c={'XMF-ECM':_0x50590c[_0x1568('0x4')],'XMF-HEADERINFO':_0x50590c[_0x1568('0x5')],'XMF-MINRATE':_0x50590c[_0x1568('0x6')],'XMF-MAXRATE':_0x50590c[_0x1568('0x7')],'XMF-MODEM':util[_0x1568('0x8')](_0x1568('0x9'),_0x50590c[_0x1568('0xa')]),'XMF-GATEWAY':_0x50590c[_0x1568('0xb')],'XMF-FAXDETECT':_0x50590c[_0x1568('0xc')],'XMF-T38TIMEOUT':_0x50590c[_0x1568('0xd')],'XMF-LOCALSTATIONID':_0x50590c[_0x1568('0xe')],'XMF-PATH':_0x354992[_0x1568('0xf')]};return _0x30da5c;};exports['variablesAction']=function(_0x10ffe9,_0x49ba8b){return{'actionid':_0x10ffe9[_0x1568('0x10')],'action':_0x1568('0x11'),'channel':_0x10ffe9[_0x1568('0x12')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x1568('0x8')](_0x1568('0x13'),_0x10ffe9['headerinfo']?_0x10ffe9[_0x1568('0x5')]:'',_0x10ffe9['localstationid']),'variable':_0x49ba8b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x10ffe9[_0x1568('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index a7d2564..0f516e6 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 _0x6fd7=['getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','moment','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts'];(function(_0x21d191,_0x198aa3){var _0x2a5aee=function(_0x203d9d){while(--_0x203d9d){_0x21d191['push'](_0x21d191['shift']());}};_0x2a5aee(++_0x198aa3);}(_0x6fd7,0x114));var _0x76fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fd7[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require(_0x76fd('0x0'));var server=require('./server');var Realtime=require(_0x76fd('0x1'));var Report=require(_0x76fd('0x2'));var Acw=require(_0x76fd('0x3'));var Trigger=require(_0x76fd('0x4'));var Dialer=require('./dialer');var Preview=require(_0x76fd('0x5'));var Fax=require(_0x76fd('0x6'));var user=require(_0x76fd('0x7'));var voiceQueue=require(_0x76fd('0x8'));var voiceQueueReport=require(_0x76fd('0x9'));var voiceCallReport=require(_0x76fd('0xa'));var trunk=require(_0x76fd('0xb'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0x76fd('0xc'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x76fd('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x76fd('0xe'));var sugarcrm=require(_0x76fd('0xf'));var freshdesk=require(_0x76fd('0x10'));var desk=require(_0x76fd('0x11'));var zoho=require(_0x76fd('0x12'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x76fd('0x13'));var servicenow=require(_0x76fd('0x14'));var dynamics365=require(_0x76fd('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x76fd('0x16')](_0x76fd('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x76fd('0x16')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x76fd('0x18')]()[_0x76fd('0x19')](user[_0x76fd('0x1a')]())[_0x76fd('0x19')](realtime[_0x76fd('0x1b')]())[_0x76fd('0x19')](user[_0x76fd('0x1c')]())[_0x76fd('0x19')](realtime[_0x76fd('0x1d')]())[_0x76fd('0x19')](trunk[_0x76fd('0x1e')]())['then'](realtime[_0x76fd('0x1f')]())['then'](voiceQueue['getVoiceQueues']())[_0x76fd('0x19')](realtime[_0x76fd('0x20')]())['then'](trigger['getTriggers']())['then'](realtime[_0x76fd('0x21')]())[_0x76fd('0x19')](template[_0x76fd('0x22')]())[_0x76fd('0x19')](realtime[_0x76fd('0x23')]())['then'](zendesk[_0x76fd('0x24')]())[_0x76fd('0x19')](realtime[_0x76fd('0x25')]())[_0x76fd('0x19')](salesforce[_0x76fd('0x26')]())[_0x76fd('0x19')](realtime['initSalesforceAccounts']())[_0x76fd('0x19')](sugarcrm[_0x76fd('0x27')]())[_0x76fd('0x19')](realtime[_0x76fd('0x28')]())[_0x76fd('0x19')](freshdesk[_0x76fd('0x29')]())[_0x76fd('0x19')](realtime['initFreshdeskAccounts']())[_0x76fd('0x19')](desk['getDeskAccounts']())[_0x76fd('0x19')](realtime[_0x76fd('0x2a')]())[_0x76fd('0x19')](zoho[_0x76fd('0x2b')]())[_0x76fd('0x19')](realtime[_0x76fd('0x2c')]())[_0x76fd('0x19')](vtiger['getVtigerAccounts']())[_0x76fd('0x19')](realtime['initVtigerAccounts']())[_0x76fd('0x19')](freshsales[_0x76fd('0x2d')]())[_0x76fd('0x19')](realtime[_0x76fd('0x2e')]())['then'](servicenow['getServicenowAccounts']())[_0x76fd('0x19')](realtime[_0x76fd('0x2f')]())[_0x76fd('0x19')](dynamics365['getDynamics365Accounts']())[_0x76fd('0x19')](realtime[_0x76fd('0x30')]())[_0x76fd('0x19')](campaign[_0x76fd('0x31')]())[_0x76fd('0x19')](realtime[_0x76fd('0x32')]())['then'](voiceExtension[_0x76fd('0x33')]())[_0x76fd('0x19')](realtime[_0x76fd('0x34')]())['then'](faxAccount['getFaxAccounts']())[_0x76fd('0x19')](realtime[_0x76fd('0x35')]())[_0x76fd('0x19')](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport[_0x76fd('0x36')]())[_0x76fd('0x19')](realtime[_0x76fd('0x37')]())[_0x76fd('0x19')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x76fd('0x19')](realtime[_0x76fd('0x38')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x76fd('0x19')](realtime[_0x76fd('0x39')]())[_0x76fd('0x19')](voiceCallReport[_0x76fd('0x3a')]())[_0x76fd('0x19')](realtime[_0x76fd('0x3b')]())['then'](function(_0x1d6271){})[_0x76fd('0x3c')](function(_0x1f494f){console[_0x76fd('0x3d')](_0x1f494f);});}function main(){return server[_0x76fd('0x3e')](realtime,preview,fax)[_0x76fd('0x19')](function(_0x317782){return initRealtime();})[_0x76fd('0x19')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x76fd('0x3c')](function(_0x52a50a){console['log'](_0x52a50a);});}main(); \ No newline at end of file +var _0x103b=['initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','log','listen','sync','bluebird','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','getAgents','initAgents','then','getTrunks','initVoiceQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x103b,0x121));var _0xb103=function(_0x282aad,_0x404241){_0x282aad=_0x282aad-0x0;var _0x590f8d=_0x103b[_0x282aad];return _0x590f8d;};'use strict';var BPromise=require(_0xb103('0x0'));var util=require('util');var moment=require(_0xb103('0x1'));var server=require(_0xb103('0x2'));var Realtime=require(_0xb103('0x3'));var Report=require(_0xb103('0x4'));var Acw=require(_0xb103('0x5'));var Trigger=require(_0xb103('0x6'));var Dialer=require(_0xb103('0x7'));var Preview=require(_0xb103('0x8'));var Fax=require(_0xb103('0x9'));var user=require(_0xb103('0xa'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xb103('0xb'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0xb103('0xc'));var cmHopperHistory=require(_0xb103('0xd'));var campaign=require(_0xb103('0xe'));var voiceExtension=require(_0xb103('0xf'));var faxAccount=require(_0xb103('0x10'));var zendesk=require(_0xb103('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xb103('0x12'));var freshdesk=require(_0xb103('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xb103('0x14'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xb103('0x15'));var servicenow=require(_0xb103('0x16'));var dynamics365=require(_0xb103('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xb103('0x18')](_0xb103('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xb103('0x18')](_0xb103('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user[_0xb103('0x1a')]())['then'](realtime[_0xb103('0x1b')]())[_0xb103('0x1c')](user['getTelephones']())[_0xb103('0x1c')](realtime['initTelephones']())[_0xb103('0x1c')](trunk[_0xb103('0x1d')]())[_0xb103('0x1c')](realtime['initTrunks']())[_0xb103('0x1c')](voiceQueue['getVoiceQueues']())[_0xb103('0x1c')](realtime[_0xb103('0x1e')]())[_0xb103('0x1c')](trigger['getTriggers']())['then'](realtime[_0xb103('0x1f')]())[_0xb103('0x1c')](template[_0xb103('0x20')]())['then'](realtime[_0xb103('0x21')]())[_0xb103('0x1c')](zendesk[_0xb103('0x22')]())['then'](realtime[_0xb103('0x23')]())[_0xb103('0x1c')](salesforce[_0xb103('0x24')]())['then'](realtime['initSalesforceAccounts']())[_0xb103('0x1c')](sugarcrm[_0xb103('0x25')]())[_0xb103('0x1c')](realtime[_0xb103('0x26')]())[_0xb103('0x1c')](freshdesk[_0xb103('0x27')]())[_0xb103('0x1c')](realtime['initFreshdeskAccounts']())['then'](desk[_0xb103('0x28')]())[_0xb103('0x1c')](realtime[_0xb103('0x29')]())[_0xb103('0x1c')](zoho[_0xb103('0x2a')]())[_0xb103('0x1c')](realtime[_0xb103('0x2b')]())['then'](vtiger[_0xb103('0x2c')]())[_0xb103('0x1c')](realtime[_0xb103('0x2d')]())[_0xb103('0x1c')](freshsales['getFreshsalesAccounts']())[_0xb103('0x1c')](realtime[_0xb103('0x2e')]())[_0xb103('0x1c')](servicenow['getServicenowAccounts']())[_0xb103('0x1c')](realtime['initServicenowAccounts']())[_0xb103('0x1c')](dynamics365[_0xb103('0x2f')]())[_0xb103('0x1c')](realtime[_0xb103('0x30')]())[_0xb103('0x1c')](campaign[_0xb103('0x31')]())[_0xb103('0x1c')](realtime[_0xb103('0x32')]())['then'](voiceExtension[_0xb103('0x33')]())[_0xb103('0x1c')](realtime[_0xb103('0x34')]())[_0xb103('0x1c')](faxAccount[_0xb103('0x35')]())['then'](realtime[_0xb103('0x36')]())[_0xb103('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0xb103('0x37')]()[_0xb103('0x1c')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0xb103('0x38')]())[_0xb103('0x1c')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xb103('0x1c')](realtime['initVoiceQueueHopperHistory']())[_0xb103('0x1c')](cmHopperHistory[_0xb103('0x39')]())['then'](realtime[_0xb103('0x3a')]())[_0xb103('0x1c')](voiceCallReport['getVoiceCallReports']())[_0xb103('0x1c')](realtime[_0xb103('0x3b')]())[_0xb103('0x1c')](function(_0x2c7f4e){})[_0xb103('0x3c')](function(_0x304e6a){console[_0xb103('0x3d')](_0x304e6a);});}function main(){return server[_0xb103('0x3e')](realtime,preview,fax)['then'](function(_0x3f0540){return initRealtime();})[_0xb103('0x1c')](function(){return initParams();})['then'](function(){report[_0xb103('0x3f')]();setInterval(initRealtime,0x1388);})[_0xb103('0x3c')](function(_0x14060d){console[_0xb103('0x3d')](_0x14060d);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 355a4d2..f69f0b1 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 _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x2b3c36,_0x2692e1){var _0x1c1840=function(_0x559719){while(--_0x559719){_0x2b3c36['push'](_0x2b3c36['shift']());}};_0x1c1840(++_0x2692e1);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file +var _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x514c5e,_0x8c0875){var _0x34c3e6=function(_0x3d78d2){while(--_0x3d78d2){_0x514c5e['push'](_0x514c5e['shift']());}};_0x34c3e6(++_0x8c0875);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 5497d02..46b8078 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 _0x6808=['active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive'];(function(_0x2e6c75,_0x1bdbb7){var _0x13a9ea=function(_0x6ad297){while(--_0x6ad297){_0x2e6c75['push'](_0x2e6c75['shift']());}};_0x13a9ea(++_0x1bdbb7);}(_0x6808,0x19f));var _0x8680=function(_0x5aab88,_0x25fac7){_0x5aab88=_0x5aab88-0x0;var _0x56addc=_0x6808[_0x5aab88];return _0x56addc;};'use strict';function Campaign(_0x537b3c){this['id']=_0x537b3c['id']||0x0;this[_0x8680('0x0')]=_0x537b3c[_0x8680('0x0')]||'';this[_0x8680('0x1')]=_0x537b3c[_0x8680('0x1')]||_0x8680('0x2');this[_0x8680('0x3')]=0x0;this['temp']=0x0;this[_0x8680('0x4')]=0x0;this[_0x8680('0x5')]=0x0;this[_0x8680('0x6')]='';this[_0x8680('0x7')]=!![];this[_0x8680('0x8')]=_0x537b3c[_0x8680('0x8')];this[_0x8680('0x9')]=_0x537b3c[_0x8680('0x9')];this[_0x8680('0xa')]=_0x537b3c['dialTimezone']||null;this['dialGlobalInterval']=_0x537b3c[_0x8680('0xb')]?_0x537b3c[_0x8680('0xb')]:null;this[_0x8680('0xc')]=_0x537b3c[_0x8680('0xc')];this[_0x8680('0xd')]=_0x537b3c[_0x8680('0xd')];this[_0x8680('0xe')]=_0x537b3c[_0x8680('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x537b3c['dialCongestionMaxRetry'];this[_0x8680('0xf')]=_0x537b3c[_0x8680('0xf')];this[_0x8680('0x10')]=_0x537b3c['dialBusyMaxRetry'];this[_0x8680('0x11')]=_0x537b3c[_0x8680('0x11')];this[_0x8680('0x12')]=_0x537b3c['dialNoAnswerMaxRetry'];this[_0x8680('0x13')]=_0x537b3c[_0x8680('0x13')];this[_0x8680('0x14')]=_0x537b3c[_0x8680('0x14')];this[_0x8680('0x15')]=_0x537b3c[_0x8680('0x15')]||0x3;this[_0x8680('0x16')]=_0x537b3c[_0x8680('0x16')]||0x96;this['dialDropMaxRetry']=_0x537b3c['dialDropMaxRetry']||0x3;this[_0x8680('0x17')]=_0x537b3c[_0x8680('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x537b3c['dialAbandonedMaxRetry']||0x3;this[_0x8680('0x18')]=_0x537b3c[_0x8680('0x18')]||0x96;this['dialMachineMaxRetry']=_0x537b3c[_0x8680('0x19')]||0x3;this[_0x8680('0x1a')]=_0x537b3c[_0x8680('0x1a')]||0x96;this[_0x8680('0x1b')]=_0x537b3c[_0x8680('0x1b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x537b3c[_0x8680('0x1c')]||0x96;this[_0x8680('0x1d')]=_0x537b3c['dialOrderByScheduledAt']||'DESC';this['dialPrefix']=_0x537b3c[_0x8680('0x1e')]||undefined;this[_0x8680('0x1f')]=_0x537b3c[_0x8680('0x1f')]||undefined;this[_0x8680('0x20')]=_0x537b3c[_0x8680('0x20')]||undefined;this[_0x8680('0x21')]=_0x537b3c[_0x8680('0x21')]?_0x537b3c[_0x8680('0x21')]:undefined;this[_0x8680('0x22')]=_0x537b3c[_0x8680('0x22')]?_0x537b3c[_0x8680('0x22')]:undefined;this['Interval']=_0x537b3c['Interval']?_0x537b3c[_0x8680('0x23')]:undefined;this[_0x8680('0x24')]=_0x537b3c[_0x8680('0x24')]?_0x537b3c['SquareProject']:undefined;this[_0x8680('0x25')]=_0x537b3c['SquareProject']?_0x537b3c[_0x8680('0x24')][_0x8680('0x0')]:undefined;this[_0x8680('0x26')]=_0x537b3c['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x537b3c['dialAMDInitialSilence'];this[_0x8680('0x27')]=_0x537b3c[_0x8680('0x27')];this[_0x8680('0x28')]=_0x537b3c['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x537b3c[_0x8680('0x29')];this['dialAMDMinWordLength']=_0x537b3c[_0x8680('0x2a')];this['dialAMDBetweenWordsSilence']=_0x537b3c[_0x8680('0x2b')];this[_0x8680('0x2c')]=_0x537b3c[_0x8680('0x2c')];this[_0x8680('0x2d')]=_0x537b3c[_0x8680('0x2d')];this[_0x8680('0x2e')]=_0x537b3c[_0x8680('0x2e')];}module['exports']=Campaign; \ No newline at end of file +var _0xf88a=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x1ae975,_0x70b40e){var _0x2576ca=function(_0x1b4e97){while(--_0x1b4e97){_0x1ae975['push'](_0x1ae975['shift']());}};_0x2576ca(++_0x70b40e);}(_0xf88a,0x1ee));var _0xaf88=function(_0x2fb6e9,_0x171e19){_0x2fb6e9=_0x2fb6e9-0x0;var _0x2cd8a4=_0xf88a[_0x2fb6e9];return _0x2cd8a4;};'use strict';function Campaign(_0x4b596a){this['id']=_0x4b596a['id']||0x0;this[_0xaf88('0x0')]=_0x4b596a['name']||'';this[_0xaf88('0x1')]=_0x4b596a[_0xaf88('0x1')]||_0xaf88('0x2');this[_0xaf88('0x3')]=0x0;this['temp']=0x0;this[_0xaf88('0x4')]=0x0;this[_0xaf88('0x5')]=0x0;this['message']='';this[_0xaf88('0x6')]=!![];this[_0xaf88('0x7')]=_0x4b596a[_0xaf88('0x7')];this[_0xaf88('0x8')]=_0x4b596a['limitCalls'];this['dialTimezone']=_0x4b596a['dialTimezone']||null;this[_0xaf88('0x9')]=_0x4b596a[_0xaf88('0x9')]?_0x4b596a[_0xaf88('0x9')]:null;this['dialOriginateCallerIdName']=_0x4b596a['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x4b596a[_0xaf88('0xa')];this[_0xaf88('0xb')]=_0x4b596a[_0xaf88('0xb')]||0x1e;this['dialCongestionMaxRetry']=_0x4b596a['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x4b596a[_0xaf88('0xc')];this['dialBusyMaxRetry']=_0x4b596a[_0xaf88('0xd')];this[_0xaf88('0xe')]=_0x4b596a[_0xaf88('0xe')];this[_0xaf88('0xf')]=_0x4b596a[_0xaf88('0xf')];this[_0xaf88('0x10')]=_0x4b596a[_0xaf88('0x10')];this[_0xaf88('0x11')]=_0x4b596a['dialGlobalMaxRetry'];this[_0xaf88('0x12')]=_0x4b596a['dialNoSuchNumberMaxRetry']||0x3;this[_0xaf88('0x13')]=_0x4b596a['dialNoSuchNumberRetryFrequency']||0x96;this[_0xaf88('0x14')]=_0x4b596a[_0xaf88('0x14')]||0x3;this['dialDropRetryFrequency']=_0x4b596a[_0xaf88('0x15')]||0x96;this['dialAbandonedMaxRetry']=_0x4b596a[_0xaf88('0x16')]||0x3;this[_0xaf88('0x17')]=_0x4b596a[_0xaf88('0x17')]||0x96;this[_0xaf88('0x18')]=_0x4b596a[_0xaf88('0x18')]||0x3;this[_0xaf88('0x19')]=_0x4b596a[_0xaf88('0x19')]||0x96;this['dialAgentRejectMaxRetry']=_0x4b596a[_0xaf88('0x1a')]||0x3;this[_0xaf88('0x1b')]=_0x4b596a['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x4b596a[_0xaf88('0x1c')]||_0xaf88('0x1d');this['dialPrefix']=_0x4b596a[_0xaf88('0x1e')]||undefined;this[_0xaf88('0x1f')]=_0x4b596a[_0xaf88('0x1f')]||undefined;this['dialCutDigit']=_0x4b596a['dialCutDigit']||undefined;this[_0xaf88('0x20')]=_0x4b596a[_0xaf88('0x20')]?_0x4b596a[_0xaf88('0x20')]:undefined;this[_0xaf88('0x21')]=_0x4b596a[_0xaf88('0x21')]?_0x4b596a['Trunk']:undefined;this[_0xaf88('0x22')]=_0x4b596a[_0xaf88('0x22')]?_0x4b596a[_0xaf88('0x22')]:undefined;this[_0xaf88('0x23')]=_0x4b596a[_0xaf88('0x23')]?_0x4b596a[_0xaf88('0x23')]:undefined;this[_0xaf88('0x24')]=_0x4b596a[_0xaf88('0x23')]?_0x4b596a['SquareProject']['name']:undefined;this[_0xaf88('0x25')]=_0x4b596a[_0xaf88('0x25')]||![];this[_0xaf88('0x26')]=_0x4b596a[_0xaf88('0x26')];this[_0xaf88('0x27')]=_0x4b596a['dialAMDGreeting'];this[_0xaf88('0x28')]=_0x4b596a[_0xaf88('0x28')];this[_0xaf88('0x29')]=_0x4b596a[_0xaf88('0x29')];this['dialAMDMinWordLength']=_0x4b596a[_0xaf88('0x2a')];this['dialAMDBetweenWordsSilence']=_0x4b596a['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x4b596a[_0xaf88('0x2b')];this[_0xaf88('0x2c')]=_0x4b596a['dialAMDSilenceThreshold'];this[_0xaf88('0x2d')]=_0x4b596a['dialAMDMaximumWordLength'];}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 e75ca39..ccb05f0 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 _0xadb5=['answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','queue','monitors','transfercalleridnum','transferType','exports','channel','calleridnum','calleridname','connectedlinenum','accountcode','context','uniqueid','exten','answered'];(function(_0x2ace72,_0x814809){var _0x33d102=function(_0x505fd1){while(--_0x505fd1){_0x2ace72['push'](_0x2ace72['shift']());}};_0x33d102(++_0x814809);}(_0xadb5,0xad));var _0x5adb=function(_0x22dc16,_0x586dc2){_0x22dc16=_0x22dc16-0x0;var _0x223411=_0xadb5[_0x22dc16];return _0x223411;};'use strict';function Channel(){this['starttime']=null;this[_0x5adb('0x0')]='';this['destinationchannel']='';this[_0x5adb('0x1')]=0x0;this[_0x5adb('0x2')]='';this[_0x5adb('0x3')]=undefined;this['connectedlinename']=undefined;this[_0x5adb('0x4')]=0x0;this[_0x5adb('0x5')]='';this[_0x5adb('0x6')]=0x0;this['linkedid']=0x0;this[_0x5adb('0x7')]=0x0;this[_0x5adb('0x8')]=![];this[_0x5adb('0x9')]=null;this[_0x5adb('0xa')]=null;this[_0x5adb('0xb')]=![];this[_0x5adb('0xc')]=![];this[_0x5adb('0xd')]='';this[_0x5adb('0xe')]='';this[_0x5adb('0xf')]=0x0;this[_0x5adb('0x10')]=0x0;this[_0x5adb('0x11')]=0x0;this[_0x5adb('0x12')]=null;this[_0x5adb('0x13')]=null;this[_0x5adb('0x14')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0x5adb('0x15')]=null;this[_0x5adb('0x16')]=[];this[_0x5adb('0x17')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x5adb('0x18')]=undefined;this['mohtime']=0x0;}module[_0x5adb('0x19')]=Channel; \ No newline at end of file +var _0x3cd0=['lastapplication','duration','billableseconds','holdtime','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','mohtime','exports','starttime','calleridnum','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','endtime','unmanaged'];(function(_0x158ed1,_0x2f7146){var _0x4375f6=function(_0x14afdc){while(--_0x14afdc){_0x158ed1['push'](_0x158ed1['shift']());}};_0x4375f6(++_0x2f7146);}(_0x3cd0,0x8a));var _0x03cd=function(_0x6dfbaa,_0x31eede){_0x6dfbaa=_0x6dfbaa-0x0;var _0xfbe02=_0x3cd0[_0x6dfbaa];return _0xfbe02;};'use strict';function Channel(){this[_0x03cd('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x03cd('0x1')]=0x0;this['calleridname']='';this[_0x03cd('0x2')]=undefined;this[_0x03cd('0x3')]=undefined;this[_0x03cd('0x4')]=0x0;this[_0x03cd('0x5')]='';this[_0x03cd('0x6')]=0x0;this['linkedid']=0x0;this[_0x03cd('0x7')]=0x0;this[_0x03cd('0x8')]=![];this[_0x03cd('0x9')]=null;this[_0x03cd('0xa')]=null;this[_0x03cd('0xb')]=![];this['abandoned']=![];this[_0x03cd('0xc')]='';this['lastdata']='';this[_0x03cd('0xd')]=0x0;this[_0x03cd('0xe')]=0x0;this[_0x03cd('0xf')]=0x0;this[_0x03cd('0x10')]=null;this['tag']=null;this[_0x03cd('0x11')]=null;this[_0x03cd('0x12')]=![];this[_0x03cd('0x13')]=null;this[_0x03cd('0x14')]=null;this[_0x03cd('0x15')]=[];this[_0x03cd('0x16')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x03cd('0x17')]=0x0;}module[_0x03cd('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index d38246f..53d80bd 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 _0x2f76=['token','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0xb32a2e,_0x522d3c){var _0x402a35=function(_0x2f9d97){while(--_0x2f9d97){_0xb32a2e['push'](_0xb32a2e['shift']());}};_0x402a35(++_0x522d3c);}(_0x2f76,0x12f));var _0x62f7=function(_0x542d95,_0x49d6af){_0x542d95=_0x542d95-0x0;var _0x2969c1=_0x2f76[_0x542d95];return _0x2969c1;};'use strict';function DeskAccount(_0x19d2fb){this['id']=_0x19d2fb['id']||0x0;this[_0x62f7('0x0')]=_0x19d2fb[_0x62f7('0x0')]||'';this[_0x62f7('0x1')]=_0x19d2fb[_0x62f7('0x1')]||'';this[_0x62f7('0x2')]=_0x19d2fb[_0x62f7('0x2')]||'';this['authType']=_0x19d2fb[_0x62f7('0x3')]||'';this[_0x62f7('0x4')]=_0x19d2fb['password']||'';this['consumerKey']=_0x19d2fb[_0x62f7('0x5')]||'';this['consumerSecret']=_0x19d2fb[_0x62f7('0x6')]||'';this[_0x62f7('0x7')]=_0x19d2fb[_0x62f7('0x7')]||'';this['tokenSecret']=_0x19d2fb['tokenSecret']||'';this['type']=_0x19d2fb['type']||'';this['serverUrl']=_0x19d2fb[_0x62f7('0x8')]||'';this[_0x62f7('0x9')]=_0x19d2fb[_0x62f7('0x9')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x3118=['serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x28f1de,_0x355054){var _0x5b5dad=function(_0x399b72){while(--_0x399b72){_0x28f1de['push'](_0x28f1de['shift']());}};_0x5b5dad(++_0x355054);}(_0x3118,0xe7));var _0x8311=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x3118[_0x525c7b];return _0x27b33e;};'use strict';function DeskAccount(_0x106447){this['id']=_0x106447['id']||0x0;this['name']=_0x106447[_0x8311('0x0')]||'';this['username']=_0x106447['username']||'';this[_0x8311('0x1')]=_0x106447[_0x8311('0x1')]||'';this[_0x8311('0x2')]=_0x106447[_0x8311('0x2')]||'';this[_0x8311('0x3')]=_0x106447[_0x8311('0x3')]||'';this['consumerKey']=_0x106447[_0x8311('0x4')]||'';this[_0x8311('0x5')]=_0x106447[_0x8311('0x5')]||'';this[_0x8311('0x6')]=_0x106447[_0x8311('0x6')]||'';this['tokenSecret']=_0x106447[_0x8311('0x7')]||'';this[_0x8311('0x8')]=_0x106447[_0x8311('0x8')]||'';this[_0x8311('0x9')]=_0x106447['serverUrl']||'';this[_0x8311('0xa')]=_0x106447[_0x8311('0xa')]||{};}module[_0x8311('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index cd269e6..ef6fcaf 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 _0x4024=['serverUrl','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x4d7d5c,_0x1a456d){var _0x2c0910=function(_0x11b008){while(--_0x11b008){_0x4d7d5c['push'](_0x4d7d5c['shift']());}};_0x2c0910(++_0x1a456d);}(_0x4024,0x89));var _0x4402=function(_0x5537f3,_0x2b5f40){_0x5537f3=_0x5537f3-0x0;var _0x288b7d=_0x4024[_0x5537f3];return _0x288b7d;};'use strict';function Dynamics365Account(_0x122890){this['id']=_0x122890['id']||0x0;this[_0x4402('0x0')]=_0x122890['name']||'';this[_0x4402('0x1')]=_0x122890[_0x4402('0x1')]||'';this['password']=_0x122890[_0x4402('0x2')]||'';this['remoteUri']=_0x122890[_0x4402('0x3')]||'';this[_0x4402('0x4')]=_0x122890['tenantId']||'';this['clientId']=_0x122890[_0x4402('0x5')]||'';this[_0x4402('0x6')]=_0x122890[_0x4402('0x6')]||{};this['serverUrl']=_0x122890[_0x4402('0x7')]||'';this['Configurations']=_0x122890['Configurations']||{};}module[_0x4402('0x8')]=Dynamics365Account; \ No newline at end of file +var _0xe605=['clientSecret','serverUrl','name','username','password','remoteUri','tenantId','clientId'];(function(_0x5dafd0,_0x3bcbb6){var _0x364354=function(_0x5da31c){while(--_0x5da31c){_0x5dafd0['push'](_0x5dafd0['shift']());}};_0x364354(++_0x3bcbb6);}(_0xe605,0x92));var _0x5e60=function(_0x30eb04,_0x24706d){_0x30eb04=_0x30eb04-0x0;var _0x14e2b4=_0xe605[_0x30eb04];return _0x14e2b4;};'use strict';function Dynamics365Account(_0x4cf32c){this['id']=_0x4cf32c['id']||0x0;this[_0x5e60('0x0')]=_0x4cf32c['name']||'';this[_0x5e60('0x1')]=_0x4cf32c[_0x5e60('0x1')]||'';this[_0x5e60('0x2')]=_0x4cf32c[_0x5e60('0x2')]||'';this[_0x5e60('0x3')]=_0x4cf32c[_0x5e60('0x3')]||'';this[_0x5e60('0x4')]=_0x4cf32c[_0x5e60('0x4')]||'';this[_0x5e60('0x5')]=_0x4cf32c[_0x5e60('0x5')]||'';this[_0x5e60('0x6')]=_0x4cf32c[_0x5e60('0x6')]||{};this['serverUrl']=_0x4cf32c[_0x5e60('0x7')]||'';this['Configurations']=_0x4cf32c['Configurations']||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 61bccd6..8571cb5 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 _0x708c=['localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk','ListId','exports','name','description','ecm','headerinfo'];(function(_0x5caf77,_0x44bd89){var _0xa4056d=function(_0x4d41db){while(--_0x4d41db){_0x5caf77['push'](_0x5caf77['shift']());}};_0xa4056d(++_0x44bd89);}(_0x708c,0x65));var _0xc708=function(_0x3485f1,_0x5f13f1){_0x3485f1=_0x3485f1-0x0;var _0x546e32=_0x708c[_0x3485f1];return _0x546e32;};'use strict';function FaxAccount(_0x516b7a){this['id']=_0x516b7a['id']||0x0;this[_0xc708('0x0')]=_0x516b7a[_0xc708('0x0')]||'';this['description']=_0x516b7a[_0xc708('0x1')];this['ecm']=_0x516b7a[_0xc708('0x2')];this[_0xc708('0x3')]=_0x516b7a[_0xc708('0x3')];this[_0xc708('0x4')]=_0x516b7a['localstationid'];this[_0xc708('0x5')]=_0x516b7a[_0xc708('0x5')]||0x960;this[_0xc708('0x6')]=_0x516b7a[_0xc708('0x6')]||0x3840;this['modem']=_0x516b7a[_0xc708('0x7')]||'v17,v27,v29';this['gateway']=_0x516b7a[_0xc708('0x8')]||'no';this['faxdetect']=_0x516b7a[_0xc708('0x9')]||'no';this[_0xc708('0xa')]=_0x516b7a[_0xc708('0xa')]||0x1388;this[_0xc708('0xb')]=_0x516b7a[_0xc708('0xb')]||'SIP';this[_0xc708('0xc')]=_0x516b7a[_0xc708('0xc')]?_0x516b7a[_0xc708('0xc')]:undefined;this[_0xc708('0xd')]=_0x516b7a[_0xc708('0xd')];this['key']=_0x516b7a['key'];}module[_0xc708('0xe')]=FaxAccount; \ No newline at end of file +var _0x86f6=['minrate','maxrate','modem','gateway','faxdetect','tech','Trunk','ListId','exports','name','description','ecm','headerinfo','localstationid'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x86f6,0x191));var _0x686f=function(_0x1a0d1f,_0x2c8975){_0x1a0d1f=_0x1a0d1f-0x0;var _0x1dedcf=_0x86f6[_0x1a0d1f];return _0x1dedcf;};'use strict';function FaxAccount(_0x4d0bc7){this['id']=_0x4d0bc7['id']||0x0;this[_0x686f('0x0')]=_0x4d0bc7[_0x686f('0x0')]||'';this[_0x686f('0x1')]=_0x4d0bc7[_0x686f('0x1')];this[_0x686f('0x2')]=_0x4d0bc7[_0x686f('0x2')];this[_0x686f('0x3')]=_0x4d0bc7[_0x686f('0x3')];this['localstationid']=_0x4d0bc7[_0x686f('0x4')];this[_0x686f('0x5')]=_0x4d0bc7[_0x686f('0x5')]||0x960;this[_0x686f('0x6')]=_0x4d0bc7[_0x686f('0x6')]||0x3840;this[_0x686f('0x7')]=_0x4d0bc7[_0x686f('0x7')]||'v17,v27,v29';this[_0x686f('0x8')]=_0x4d0bc7['gateway']||'no';this[_0x686f('0x9')]=_0x4d0bc7[_0x686f('0x9')]||'no';this['t38timeout']=_0x4d0bc7['t38timeout']||0x1388;this[_0x686f('0xa')]=_0x4d0bc7['tech']||'SIP';this[_0x686f('0xb')]=_0x4d0bc7[_0x686f('0xb')]?_0x4d0bc7['Trunk']:undefined;this[_0x686f('0xc')]=_0x4d0bc7[_0x686f('0xc')];this['key']=_0x4d0bc7['key'];}module[_0x686f('0xd')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 028ca40..d2a3efa 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 _0x20cd=['serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x1eead3,_0x18f32b){var _0x12a236=function(_0x575747){while(--_0x575747){_0x1eead3['push'](_0x1eead3['shift']());}};_0x12a236(++_0x18f32b);}(_0x20cd,0x1e3));var _0xd20c=function(_0x377d82,_0x27cada){_0x377d82=_0x377d82-0x0;var _0x230e5f=_0x20cd[_0x377d82];return _0x230e5f;};'use strict';function FreshdeskAccount(_0x504848){this['id']=_0x504848['id']||0x0;this[_0xd20c('0x0')]=_0x504848['name']||'';this[_0xd20c('0x1')]=_0x504848['username']||'';this['apiKey']=_0x504848['token']||'';this[_0xd20c('0x2')]=_0x504848['remoteUri']||'';this[_0xd20c('0x3')]=_0x504848[_0xd20c('0x3')]||'';this[_0xd20c('0x4')]=_0x504848[_0xd20c('0x4')]||{};}module[_0xd20c('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0xbd63=['token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x408ff6,_0x1a3a34){var _0x4e0e65=function(_0x218b12){while(--_0x218b12){_0x408ff6['push'](_0x408ff6['shift']());}};_0x4e0e65(++_0x1a3a34);}(_0xbd63,0x12b));var _0x3bd6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbd63[_0x321bb2];return _0x9c12ed;};'use strict';function FreshdeskAccount(_0xc4f62c){this['id']=_0xc4f62c['id']||0x0;this[_0x3bd6('0x0')]=_0xc4f62c[_0x3bd6('0x0')]||'';this[_0x3bd6('0x1')]=_0xc4f62c[_0x3bd6('0x1')]||'';this['apiKey']=_0xc4f62c[_0x3bd6('0x2')]||'';this[_0x3bd6('0x3')]=_0xc4f62c[_0x3bd6('0x3')]||'';this[_0x3bd6('0x4')]=_0xc4f62c[_0x3bd6('0x4')]||'';this[_0x3bd6('0x5')]=_0xc4f62c[_0x3bd6('0x5')]||{};}module[_0x3bd6('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 00463af..4b848c6 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 _0x9f02=['apiKey','token','remoteUri','serverUrl','Configurations','exports','username'];(function(_0x1b9011,_0x14f5f8){var _0x4f0edd=function(_0x321f22){while(--_0x321f22){_0x1b9011['push'](_0x1b9011['shift']());}};_0x4f0edd(++_0x14f5f8);}(_0x9f02,0x68));var _0x29f0=function(_0x31cdb8,_0x313f35){_0x31cdb8=_0x31cdb8-0x0;var _0x6b9a2a=_0x9f02[_0x31cdb8];return _0x6b9a2a;};'use strict';function FreshsalesAccount(_0x47add1){this['id']=_0x47add1['id']||0x0;this['name']=_0x47add1['name']||'';this['username']=_0x47add1[_0x29f0('0x0')]||'';this[_0x29f0('0x1')]=_0x47add1[_0x29f0('0x2')]||'';this[_0x29f0('0x3')]=_0x47add1[_0x29f0('0x3')]||'';this['serverUrl']=_0x47add1[_0x29f0('0x4')]||'';this['Configurations']=_0x47add1[_0x29f0('0x5')]||{};}module[_0x29f0('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x5c91=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x3192a5,_0x3e2705){var _0x2973f7=function(_0x3b8d0c){while(--_0x3b8d0c){_0x3192a5['push'](_0x3192a5['shift']());}};_0x2973f7(++_0x3e2705);}(_0x5c91,0x1e9));var _0x15c9=function(_0x470ca7,_0x1289b4){_0x470ca7=_0x470ca7-0x0;var _0x3b4f87=_0x5c91[_0x470ca7];return _0x3b4f87;};'use strict';function FreshsalesAccount(_0x4ea911){this['id']=_0x4ea911['id']||0x0;this[_0x15c9('0x0')]=_0x4ea911[_0x15c9('0x0')]||'';this['username']=_0x4ea911[_0x15c9('0x1')]||'';this[_0x15c9('0x2')]=_0x4ea911[_0x15c9('0x3')]||'';this[_0x15c9('0x4')]=_0x4ea911[_0x15c9('0x4')]||'';this[_0x15c9('0x5')]=_0x4ea911['serverUrl']||'';this[_0x15c9('0x6')]=_0x4ea911[_0x15c9('0x6')]||{};}module[_0x15c9('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 0f616fc..81f71c9 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 _0xe89f=['connectedlinename','context','priority','lastAssignedTo','motionChannel','voice','mohtime','variables','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','position','count','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum'];(function(_0x20cc29,_0x30a46d){var _0x28d513=function(_0x179b06){while(--_0x179b06){_0x20cc29['push'](_0x20cc29['shift']());}};_0x28d513(++_0x30a46d);}(_0xe89f,0xb8));var _0xfe89=function(_0x16b175,_0x45e586){_0x16b175=_0x16b175-0x0;var _0x379444=_0xe89f[_0x16b175];return _0x379444;};'use strict';function QueueReport(){this[_0xfe89('0x0')]=_0xfe89('0x1');this[_0xfe89('0x2')]='';this[_0xfe89('0x3')]='';this['calleridname']='';this[_0xfe89('0x4')]='';this[_0xfe89('0x5')]=null;this['queuecallerleaveAt']=null;this[_0xfe89('0x6')]=0x1;this[_0xfe89('0x7')]=0x1;this['queuecallerabandon']=![];this[_0xfe89('0x8')]=null;this['queuecallercomplete']=![];this[_0xfe89('0x9')]=null;this[_0xfe89('0xa')]=![];this['queuecallerexitAt']=null;this[_0xfe89('0xb')]=0x1;this[_0xfe89('0xc')]='';this[_0xfe89('0xd')]='';this[_0xfe89('0xe')]='';this['accountcode']='';this[_0xfe89('0xf')]='';this['exten']='';this[_0xfe89('0x10')]='';this['holdtime']=0x0;this['assigned']=![];this[_0xfe89('0x11')]='';this[_0xfe89('0x12')]=_0xfe89('0x13');this[_0xfe89('0x14')]=0x0;this[_0xfe89('0x15')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xcc58=['exports','inbound','uniqueid','calleridnum','calleridname','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','lastAssignedTo','variables'];(function(_0x34fbfd,_0x4bbaaf){var _0x133463=function(_0x1c0043){while(--_0x1c0043){_0x34fbfd['push'](_0x34fbfd['shift']());}};_0x133463(++_0x4bbaaf);}(_0xcc58,0x151));var _0x8cc5=function(_0x1eef38,_0x17853b){_0x1eef38=_0x1eef38-0x0;var _0xbe10e1=_0xcc58[_0x1eef38];return _0xbe10e1;};'use strict';function QueueReport(){this['type']=_0x8cc5('0x0');this[_0x8cc5('0x1')]='';this[_0x8cc5('0x2')]='';this[_0x8cc5('0x3')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x8cc5('0x4')]=null;this[_0x8cc5('0x5')]=0x1;this[_0x8cc5('0x6')]=0x1;this[_0x8cc5('0x7')]=![];this[_0x8cc5('0x8')]=null;this[_0x8cc5('0x9')]=![];this[_0x8cc5('0xa')]=null;this[_0x8cc5('0xb')]=![];this['queuecallerexitAt']=null;this[_0x8cc5('0xc')]=0x1;this[_0x8cc5('0xd')]='';this[_0x8cc5('0xe')]='';this[_0x8cc5('0xf')]='';this[_0x8cc5('0x10')]='';this[_0x8cc5('0x11')]='';this['exten']='';this['priority']='';this['holdtime']=0x0;this['assigned']=![];this[_0x8cc5('0x12')]='';this['motionChannel']='voice';this['mohtime']=0x0;this[_0x8cc5('0x13')]={};}module[_0x8cc5('0x14')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 1410972..34f3a05 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 _0xbedb=['Configurations','exports','name','username','password','clientId','clientSecret','securityToken','type','serverUrl'];(function(_0x736043,_0x484e23){var _0x3773a3=function(_0x210264){while(--_0x210264){_0x736043['push'](_0x736043['shift']());}};_0x3773a3(++_0x484e23);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';function SalesforceAccount(_0x58691a){this['id']=_0x58691a['id']||0x0;this['name']=_0x58691a[_0xbbed('0x0')]||'';this[_0xbbed('0x1')]=_0x58691a[_0xbbed('0x1')]||'';this['remoteUri']=_0x58691a['remoteUri']||'';this[_0xbbed('0x2')]=_0x58691a[_0xbbed('0x2')]||'';this[_0xbbed('0x3')]=_0x58691a[_0xbbed('0x3')]||'';this[_0xbbed('0x4')]=_0x58691a[_0xbbed('0x4')]||'';this[_0xbbed('0x5')]=_0x58691a[_0xbbed('0x5')]||'';this[_0xbbed('0x6')]=_0x58691a[_0xbbed('0x6')]||'integrationTab';this[_0xbbed('0x7')]=_0x58691a['serverUrl']||'';this['Configurations']=_0x58691a[_0xbbed('0x8')]||{};}module[_0xbbed('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x5c0f=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x54b17b,_0xcac443){var _0x587335=function(_0x5e716b){while(--_0x5e716b){_0x54b17b['push'](_0x54b17b['shift']());}};_0x587335(++_0xcac443);}(_0x5c0f,0x160));var _0xf5c0=function(_0x2269f9,_0x1567a1){_0x2269f9=_0x2269f9-0x0;var _0x1ff782=_0x5c0f[_0x2269f9];return _0x1ff782;};'use strict';function SalesforceAccount(_0x40b136){this['id']=_0x40b136['id']||0x0;this['name']=_0x40b136[_0xf5c0('0x0')]||'';this[_0xf5c0('0x1')]=_0x40b136[_0xf5c0('0x1')]||'';this[_0xf5c0('0x2')]=_0x40b136[_0xf5c0('0x2')]||'';this[_0xf5c0('0x3')]=_0x40b136['password']||'';this[_0xf5c0('0x4')]=_0x40b136[_0xf5c0('0x4')]||'';this['clientSecret']=_0x40b136[_0xf5c0('0x5')]||'';this['securityToken']=_0x40b136[_0xf5c0('0x6')]||'';this[_0xf5c0('0x7')]=_0x40b136[_0xf5c0('0x7')]||_0xf5c0('0x8');this['serverUrl']=_0x40b136[_0xf5c0('0x9')]||'';this['Configurations']=_0x40b136[_0xf5c0('0xa')]||{};}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 3d25101..8e35344 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 _0x5a52=['name','username','password','remoteUri','serverUrl','exports'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0x5a52,0x180));var _0x25a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a52[_0x3dd15e];return _0x231fd0;};'use strict';function ServicenowAccount(_0x14f5cd){this['id']=_0x14f5cd['id']||0x0;this['name']=_0x14f5cd[_0x25a5('0x0')]||'';this[_0x25a5('0x1')]=_0x14f5cd[_0x25a5('0x1')]||'';this[_0x25a5('0x2')]=_0x14f5cd['password']||'';this['remoteUri']=_0x14f5cd[_0x25a5('0x3')]||'';this[_0x25a5('0x4')]=_0x14f5cd[_0x25a5('0x4')]||'';this['Configurations']=_0x14f5cd['Configurations']||{};}module[_0x25a5('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x1612=['name','username','password','remoteUri'];(function(_0x222d72,_0x2155e6){var _0x3036af=function(_0xbb6fa8){while(--_0xbb6fa8){_0x222d72['push'](_0x222d72['shift']());}};_0x3036af(++_0x2155e6);}(_0x1612,0xf0));var _0x2161=function(_0x8eb090,_0x49ed8c){_0x8eb090=_0x8eb090-0x0;var _0xe565d9=_0x1612[_0x8eb090];return _0xe565d9;};'use strict';function ServicenowAccount(_0x1f586b){this['id']=_0x1f586b['id']||0x0;this[_0x2161('0x0')]=_0x1f586b[_0x2161('0x0')]||'';this[_0x2161('0x1')]=_0x1f586b['username']||'';this[_0x2161('0x2')]=_0x1f586b[_0x2161('0x2')]||'';this[_0x2161('0x3')]=_0x1f586b[_0x2161('0x3')]||'';this['serverUrl']=_0x1f586b['serverUrl']||'';this['Configurations']=_0x1f586b['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index c83cf72..b34f7b8 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 _0x7454=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x3e401a,_0x57bfc2){var _0x52a424=function(_0x4d94f0){while(--_0x4d94f0){_0x3e401a['push'](_0x3e401a['shift']());}};_0x52a424(++_0x57bfc2);}(_0x7454,0xb9));var _0x4745=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0x7454[_0x31e5cb];return _0x4170df;};'use strict';function SugarcrmAccount(_0x4a21ea){this['id']=_0x4a21ea['id']||0x0;this[_0x4745('0x0')]=_0x4a21ea[_0x4745('0x0')]||'';this[_0x4745('0x1')]=_0x4a21ea[_0x4745('0x1')]||'';this[_0x4745('0x2')]=_0x4a21ea[_0x4745('0x2')]||'';this[_0x4745('0x3')]=_0x4a21ea[_0x4745('0x3')]||'';this[_0x4745('0x4')]=_0x4a21ea[_0x4745('0x4')]||'';this[_0x4745('0x5')]=_0x4a21ea[_0x4745('0x5')]||{};}module[_0x4745('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xe754=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x394862,_0x17c8cf){var _0x46ec78=function(_0x2e1d78){while(--_0x2e1d78){_0x394862['push'](_0x394862['shift']());}};_0x46ec78(++_0x17c8cf);}(_0xe754,0x12e));var _0x4e75=function(_0x3ff84f,_0x221886){_0x3ff84f=_0x3ff84f-0x0;var _0x5bcbab=_0xe754[_0x3ff84f];return _0x5bcbab;};'use strict';function SugarcrmAccount(_0x5bccbd){this['id']=_0x5bccbd['id']||0x0;this[_0x4e75('0x0')]=_0x5bccbd[_0x4e75('0x0')]||'';this[_0x4e75('0x1')]=_0x5bccbd[_0x4e75('0x1')]||'';this[_0x4e75('0x2')]=_0x5bccbd[_0x4e75('0x2')]||'';this[_0x4e75('0x3')]=_0x5bccbd[_0x4e75('0x3')]||'';this[_0x4e75('0x4')]=_0x5bccbd[_0x4e75('0x4')]||'';this[_0x4e75('0x5')]=_0x5bccbd['Configurations']||{};}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 fea583f..049be2f 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 _0x38c9=['stateTime','address','exports','name','accountcode','state','unknown'];(function(_0x2a012c,_0x48a55a){var _0x42774f=function(_0x598096){while(--_0x598096){_0x2a012c['push'](_0x2a012c['shift']());}};_0x42774f(++_0x48a55a);}(_0x38c9,0x199));var _0x938c=function(_0x2906e6,_0x5ccd59){_0x2906e6=_0x2906e6-0x0;var _0x12517a=_0x38c9[_0x2906e6];return _0x12517a;};'use strict';function Telephone(_0x3f469d){this['id']=_0x3f469d['id']||0x0;this[_0x938c('0x0')]=_0x3f469d[_0x938c('0x0')]||'';this['accountcode']=_0x3f469d[_0x938c('0x1')]||'';this[_0x938c('0x2')]=_0x938c('0x3');this[_0x938c('0x4')]=0x0;this['status']=_0x938c('0x3');this[_0x938c('0x5')]='';}module[_0x938c('0x6')]=Telephone; \ No newline at end of file +var _0x7f91=['status','address','exports','name','state','unknown'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0x7f91,0x93));var _0x17f9=function(_0x137aa6,_0xc9ad62){_0x137aa6=_0x137aa6-0x0;var _0x24cb82=_0x7f91[_0x137aa6];return _0x24cb82;};'use strict';function Telephone(_0x4ce790){this['id']=_0x4ce790['id']||0x0;this['name']=_0x4ce790[_0x17f9('0x0')]||'';this['accountcode']=_0x4ce790['accountcode']||'';this[_0x17f9('0x1')]=_0x17f9('0x2');this['stateTime']=0x0;this[_0x17f9('0x3')]=_0x17f9('0x2');this[_0x17f9('0x4')]='';}module[_0x17f9('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 773adcc..ff90ba6 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x31c07c,_0x3a6179){var _0x5b8bea=function(_0x33739c){while(--_0x33739c){_0x31c07c['push'](_0x31c07c['shift']());}};_0x5b8bea(++_0x3a6179);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x1a79e6,_0x19e227){var _0x585fa0=function(_0x1a7cb9){while(--_0x1a7cb9){_0x1a79e6['push'](_0x1a79e6['shift']());}};_0x585fa0(++_0x19e227);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 9ca4091..20638ec 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 _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x3496d3,_0x287c1c){var _0x136b10=function(_0xc9aa27){while(--_0xc9aa27){_0x3496d3['push'](_0x3496d3['shift']());}};_0x136b10(++_0x287c1c);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x45239,_0x4eee7f){_0x45239=_0x45239-0x0;var _0xe2a62b=_0x9ffd[_0x45239];return _0xe2a62b;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file +var _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x390859,_0x3621a6){var _0x2d63b7=function(_0x4b8eed){while(--_0x4b8eed){_0x390859['push'](_0x390859['shift']());}};_0x2d63b7(++_0x3621a6);}(_0x757a,0xde));var _0xa757=function(_0x231f21,_0xa05cee){_0x231f21=_0x231f21-0x0;var _0xc617eb=_0x757a[_0x231f21];return _0xc617eb;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index ce182a6..b59fc35 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 _0x5439=['domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x5439,0x67));var _0x9543=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5439[_0x20a584];return _0x4b41a8;};'use strict';function Trunk(_0x452cdd){this['id']=_0x452cdd['id']||0x0;this[_0x9543('0x0')]=_0x452cdd[_0x9543('0x0')]||![];this[_0x9543('0x1')]=_0x452cdd[_0x9543('0x1')]||'';this[_0x9543('0x2')]=_0x9543('0x3');this[_0x9543('0x4')]=0x0;this[_0x9543('0x5')]=_0x9543('0x3');this[_0x9543('0x6')]=_0x452cdd[_0x9543('0x6')]&&_0x452cdd['registry'][_0x9543('0x7')](':')?_0x452cdd[_0x9543('0x6')][_0x9543('0x8')](':')[0x0]:'';this[_0x9543('0x9')]='';this[_0x9543('0xa')]='';this[_0x9543('0xb')]='';this[_0x9543('0xc')]='';this[_0x9543('0xd')]='';this[_0x9543('0xe')]=_0x9543('0x3');this[_0x9543('0xf')]='';this[_0x9543('0x10')]='';this[_0x9543('0x11')]=_0x452cdd[_0x9543('0x11')]||'';}module[_0x9543('0x12')]=Trunk; \ No newline at end of file +var _0xdcb0=['status','registry','split','host','port','domain','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime'];(function(_0x3aa5cf,_0x4879b3){var _0x22854a=function(_0x3e8a49){while(--_0x3e8a49){_0x3aa5cf['push'](_0x3aa5cf['shift']());}};_0x22854a(++_0x4879b3);}(_0xdcb0,0x1ab));var _0x0dcb=function(_0x51a56e,_0x5d6ee9){_0x51a56e=_0x51a56e-0x0;var _0x5a8685=_0xdcb0[_0x51a56e];return _0x5a8685;};'use strict';function Trunk(_0x227da8){this['id']=_0x227da8['id']||0x0;this[_0x0dcb('0x0')]=_0x227da8[_0x0dcb('0x0')]||![];this[_0x0dcb('0x1')]=_0x227da8[_0x0dcb('0x1')]||'';this[_0x0dcb('0x2')]=_0x0dcb('0x3');this[_0x0dcb('0x4')]=0x0;this[_0x0dcb('0x5')]='unknown';this[_0x0dcb('0x6')]=_0x227da8[_0x0dcb('0x6')]&&_0x227da8[_0x0dcb('0x6')]['indexOf'](':')?_0x227da8[_0x0dcb('0x6')][_0x0dcb('0x7')](':')[0x0]:'';this[_0x0dcb('0x8')]='';this[_0x0dcb('0x9')]='';this[_0x0dcb('0xa')]='';this['domainport']='';this['refresh']='';this[_0x0dcb('0xb')]=_0x0dcb('0x3');this[_0x0dcb('0xc')]='';this[_0x0dcb('0xd')]='';this[_0x0dcb('0xe')]=_0x227da8['defaultuser']||'';}module[_0x0dcb('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index eac1b37..b19df51 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 _0x8d79=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x6f5598,_0xabeb74){var _0x1e1325=function(_0x1da246){while(--_0x1da246){_0x6f5598['push'](_0x6f5598['shift']());}};_0x1e1325(++_0xabeb74);}(_0x8d79,0xa6));var _0x98d7=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x8d79[_0x1969a7];return _0x3d665f;};'use strict';function voiceExtension(_0x646630){this['id']=_0x646630['id']||0x0;this['exten']=_0x646630[_0x98d7('0x0')]||'';this[_0x98d7('0x1')]=_0x646630[_0x98d7('0x1')]||_0x98d7('0x2');this[_0x98d7('0x3')]=_0x646630['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x6a95=['mandatoryDisposition','exports','exten','none'];(function(_0x59a648,_0x465ddd){var _0x1d686d=function(_0x2552f7){while(--_0x2552f7){_0x59a648['push'](_0x59a648['shift']());}};_0x1d686d(++_0x465ddd);}(_0x6a95,0xa6));var _0x56a9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6a95[_0x501510];return _0x1e6ee5;};'use strict';function voiceExtension(_0x3ac3ce){this['id']=_0x3ac3ce['id']||0x0;this[_0x56a9('0x0')]=_0x3ac3ce[_0x56a9('0x0')]||'';this['recordingFormat']=_0x3ac3ce['recordingFormat']||_0x56a9('0x1');this[_0x56a9('0x2')]=_0x3ac3ce[_0x56a9('0x2')]||![];}module[_0x56a9('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 283c3ba..de5c02d 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 _0x2a84=['dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','onhold','wav49','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','acw','acwTimeout','autopause','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a84,0x94));var _0x42a8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2a84[_0x2dafbe];return _0x58a45a;};'use strict';var statusDesc=[_0x42a8('0x0'),_0x42a8('0x1'),_0x42a8('0x2'),_0x42a8('0x3'),_0x42a8('0x4'),_0x42a8('0x5'),_0x42a8('0x6'),'ringinuse',_0x42a8('0x7')];var monitorFormat={'wav':'wav','wav49':_0x42a8('0x8'),'gsm':'gsm'};var strategy={'rrmemory':'rrmemory','roundrobin':_0x42a8('0x9')};function VoiceQueue(_0x313499){this['id']=_0x313499['id']||0x0;this[_0x42a8('0xa')]=_0x313499['name']||'';this['monitor_format']=_0x313499[_0x42a8('0xb')]||'';this[_0x42a8('0xc')]=_0x313499['type']||_0x42a8('0xd');this[_0x42a8('0xe')]=0x0;this[_0x42a8('0xf')]=0x0;this[_0x42a8('0x10')]=0x0;this['answered']=0x0;this[_0x42a8('0x11')]=0x0;this[_0x42a8('0x12')]=0x0;this[_0x42a8('0x13')]=0x0;this['unmanaged']=0x0;this[_0x42a8('0x14')]=0x0;this[_0x42a8('0x15')]=0x0;this['available']=0x0;this[_0x42a8('0x16')]=_0x313499[_0x42a8('0x16')]||![];this[_0x42a8('0x17')]=_0x313499[_0x42a8('0x17')]||0xa;this[_0x42a8('0x18')]=_0x313499[_0x42a8('0x18')]||'no';this['sendMessageOneNotActive']=!![];this[_0x42a8('0x19')]='';this['originated']=0x0;this[_0x42a8('0x1a')]=0x0;this[_0x42a8('0x1b')]=_0x313499[_0x42a8('0x1b')]||null;this[_0x42a8('0x1c')]=_0x313499[_0x42a8('0x1c')]?_0x313499['dialGlobalInterval']:null;this[_0x42a8('0x1d')]=_0x313499[_0x42a8('0x1d')];this[_0x42a8('0x1e')]=_0x313499[_0x42a8('0x1e')]||_0x42a8('0x1f');this[_0x42a8('0x20')]=_0x313499[_0x42a8('0x20')]||0x0;this[_0x42a8('0x21')]=_0x313499[_0x42a8('0x21')]||0x0;this['dialPowerLevel']=_0x313499[_0x42a8('0x22')]||0x1;this[_0x42a8('0x23')]=_0x313499[_0x42a8('0x23')]||_0x42a8('0x24');this[_0x42a8('0x25')]=_0x313499[_0x42a8('0x25')]||0.03;this['dialPredictiveInterval']=_0x313499['dialPredictiveInterval']||0x258;this[_0x42a8('0x26')]=_0x313499[_0x42a8('0x26')]||_0x42a8('0x27');this[_0x42a8('0x28')]=_0x313499[_0x42a8('0x28')]||'anonymous';this[_0x42a8('0x29')]=_0x313499[_0x42a8('0x29')]||0x1e;this[_0x42a8('0x2a')]=_0x313499[_0x42a8('0x2a')]||'tTxX';this['dialQueueTimeout']=_0x313499[_0x42a8('0x2b')]||0x3;this[_0x42a8('0x2c')]=_0x313499[_0x42a8('0x2c')]||undefined;this[_0x42a8('0x2d')]=_0x313499[_0x42a8('0x2d')]||0x3;this['dialCongestionRetryFrequency']=_0x313499[_0x42a8('0x2e')]||0x96;this[_0x42a8('0x2f')]=_0x313499['dialBusyMaxRetry']||0x3;this[_0x42a8('0x30')]=_0x313499[_0x42a8('0x30')]||0x96;this[_0x42a8('0x31')]=_0x313499[_0x42a8('0x31')]||0x3;this['dialNoAnswerRetryFrequency']=_0x313499[_0x42a8('0x32')]||0x96;this[_0x42a8('0x33')]=_0x313499[_0x42a8('0x33')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x313499[_0x42a8('0x34')]||0x96;this[_0x42a8('0x35')]=_0x313499[_0x42a8('0x35')]||0x3;this[_0x42a8('0x36')]=_0x313499['dialDropRetryFrequency']||0x96;this[_0x42a8('0x37')]=_0x313499[_0x42a8('0x37')]||0x3;this[_0x42a8('0x38')]=_0x313499[_0x42a8('0x38')]||0x96;this[_0x42a8('0x39')]=_0x313499[_0x42a8('0x39')]||0x3;this[_0x42a8('0x3a')]=_0x313499[_0x42a8('0x3a')]||0x96;this[_0x42a8('0x3b')]=_0x313499[_0x42a8('0x3b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x313499[_0x42a8('0x3c')]||0x96;this['dialGlobalMaxRetry']=_0x313499[_0x42a8('0x3d')]||0x4;this['Trunk']=_0x313499['Trunk']?_0x313499[_0x42a8('0x3e')]:undefined;this[_0x42a8('0x3f')]=_0x313499[_0x42a8('0x3f')]?_0x313499[_0x42a8('0x3f')]:undefined;this['dialPrefix']=_0x313499['dialPrefix']||undefined;this[_0x42a8('0x40')]=_0x313499[_0x42a8('0x40')]?_0x313499[_0x42a8('0x40')]:undefined;this[_0x42a8('0x41')]=_0x313499['dialOrderByScheduledAt']||_0x42a8('0x42');this['dialRandomLastDigitCallerIdNumber']=_0x313499[_0x42a8('0x43')]||undefined;this[_0x42a8('0x44')]=_0x313499[_0x42a8('0x44')]||undefined;this[_0x42a8('0x45')]=strategy[_0x313499['strategy']]||_0x42a8('0x46');this['queueStatusComplete']=!![];this[_0x42a8('0x47')]=_0x313499[_0x42a8('0x47')]||![];this[_0x42a8('0x48')]=_0x313499['dialAMDInitialSilence'];this[_0x42a8('0x49')]=_0x313499['dialAMDGreeting'];this[_0x42a8('0x4a')]=_0x313499[_0x42a8('0x4a')];this[_0x42a8('0x4b')]=_0x313499[_0x42a8('0x4b')];this[_0x42a8('0x4c')]=_0x313499['dialAMDMinWordLength'];this[_0x42a8('0x4d')]=_0x313499[_0x42a8('0x4d')];this[_0x42a8('0x4e')]=_0x313499[_0x42a8('0x4e')];this[_0x42a8('0x4f')]=_0x313499[_0x42a8('0x4f')];this['dialAMDMaximumWordLength']=_0x313499[_0x42a8('0x50')];this[_0x42a8('0x51')]=0x0;this[_0x42a8('0x52')]=0x0;this['timeout']=_0x313499[_0x42a8('0x53')];this[_0x42a8('0x54')]=0x0;this[_0x42a8('0x55')]=0x0;this[_0x42a8('0x56')]=0x0;this[_0x42a8('0x57')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x42a8('0x58')]=0x0;this[_0x42a8('0x59')]=0x0;this[_0x42a8('0x5a')]=0x0;this[_0x42a8('0x5b')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x42a8('0x5c')]=0x0;this[_0x42a8('0x5d')]=0x0;this['startProgressive']=undefined;this[_0x42a8('0x5e')]=undefined;this[_0x42a8('0x5f')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x42a8('0x60')]=0x0;this[_0x42a8('0x61')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x42a8('0x62')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x42a8('0x63')]=0x0;this[_0x42a8('0x64')]=0x0;this[_0x42a8('0x65')]=_0x313499['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x42a8('0x66')]=_0x313499['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x42a8('0x67')]=0x1;this[_0x42a8('0x68')]=0x0;this['erlangCallToSecond']=0x0;this[_0x42a8('0x69')]=0x0;this[_0x42a8('0x6a')]=0x0;this['dialRecallMeTimeout']=_0x313499[_0x42a8('0x6b')]||0x1e;this[_0x42a8('0x6c')]=_0x313499[_0x42a8('0x6c')]||![];this[_0x42a8('0x6d')]=_0x313499[_0x42a8('0x6d')]||undefined;this[_0x42a8('0x6e')]=_0x313499['dialAgiAfterHangupClient']||![];this[_0x42a8('0x6f')]=_0x313499[_0x42a8('0x6f')]||![];this[_0x42a8('0xb')]=monitorFormat[_0x313499[_0x42a8('0xb')]]?monitorFormat[_0x313499[_0x42a8('0xb')]]:undefined;this[_0x42a8('0x70')]=_0x313499['mandatoryDisposition']||![];this[_0x42a8('0x71')]=_0x313499[_0x42a8('0x71')]?_0x313499[_0x42a8('0x71')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x0773=['startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalHitRate','erlangCalls','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid','unavailable','ringinuse','onhold','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout'];(function(_0x1846d4,_0x1b1691){var _0x3ddd44=function(_0x4ec5c3){while(--_0x4ec5c3){_0x1846d4['push'](_0x1846d4['shift']());}};_0x3ddd44(++_0x1b1691);}(_0x0773,0xf6));var _0x3077=function(_0x4cd7d0,_0x691df4){_0x4cd7d0=_0x4cd7d0-0x0;var _0x110940=_0x0773[_0x4cd7d0];return _0x110940;};'use strict';var statusDesc=[_0x3077('0x0'),_0x3077('0x1'),'inuse',_0x3077('0x2'),_0x3077('0x3'),_0x3077('0x4'),'ringing',_0x3077('0x5'),_0x3077('0x6')];var monitorFormat={'wav':'wav','wav49':_0x3077('0x7'),'gsm':_0x3077('0x8')};var strategy={'rrmemory':_0x3077('0x9'),'roundrobin':_0x3077('0xa')};function VoiceQueue(_0x5379f4){this['id']=_0x5379f4['id']||0x0;this[_0x3077('0xb')]=_0x5379f4[_0x3077('0xb')]||'';this[_0x3077('0xc')]=_0x5379f4[_0x3077('0xc')]||'';this[_0x3077('0xd')]=_0x5379f4[_0x3077('0xd')]||'inbound';this['waiting']=0x0;this[_0x3077('0xe')]=0x0;this[_0x3077('0xf')]=0x0;this[_0x3077('0x10')]=0x0;this[_0x3077('0x11')]=0x0;this[_0x3077('0x12')]=0x0;this[_0x3077('0x13')]=0x0;this[_0x3077('0x14')]=0x0;this[_0x3077('0x15')]=0x0;this[_0x3077('0x16')]=0x0;this[_0x3077('0x17')]=0x0;this[_0x3077('0x18')]=_0x5379f4['acw']||![];this[_0x3077('0x19')]=_0x5379f4['acwTimeout']||0xa;this[_0x3077('0x1a')]=_0x5379f4[_0x3077('0x1a')]||'no';this[_0x3077('0x1b')]=!![];this[_0x3077('0x1c')]='';this['originated']=0x0;this[_0x3077('0x1d')]=0x0;this[_0x3077('0x1e')]=_0x5379f4[_0x3077('0x1e')]||null;this[_0x3077('0x1f')]=_0x5379f4[_0x3077('0x1f')]?_0x5379f4[_0x3077('0x1f')]:null;this[_0x3077('0x20')]=_0x5379f4[_0x3077('0x20')];this[_0x3077('0x21')]=_0x5379f4['dialMethod']||_0x3077('0x22');this[_0x3077('0x23')]=_0x5379f4[_0x3077('0x23')]||0x0;this[_0x3077('0x24')]=_0x5379f4[_0x3077('0x24')]||0x0;this[_0x3077('0x25')]=_0x5379f4[_0x3077('0x25')]||0x1;this[_0x3077('0x26')]=_0x5379f4[_0x3077('0x26')]||_0x3077('0x27');this[_0x3077('0x28')]=_0x5379f4['dialPredictiveOptimizationPercentage']||0.03;this[_0x3077('0x29')]=_0x5379f4[_0x3077('0x29')]||0x258;this[_0x3077('0x2a')]=_0x5379f4[_0x3077('0x2a')]||_0x3077('0x2b');this[_0x3077('0x2c')]=_0x5379f4[_0x3077('0x2c')]||_0x3077('0x2b');this[_0x3077('0x2d')]=_0x5379f4[_0x3077('0x2d')]||0x1e;this[_0x3077('0x2e')]=_0x5379f4['dialQueueOptions']||_0x3077('0x2f');this[_0x3077('0x30')]=_0x5379f4[_0x3077('0x30')]||0x3;this['dialQueueProject']=_0x5379f4['dialQueueProject']||undefined;this[_0x3077('0x31')]=_0x5379f4[_0x3077('0x31')]||0x3;this[_0x3077('0x32')]=_0x5379f4[_0x3077('0x32')]||0x96;this[_0x3077('0x33')]=_0x5379f4[_0x3077('0x33')]||0x3;this[_0x3077('0x34')]=_0x5379f4['dialBusyRetryFrequency']||0x96;this[_0x3077('0x35')]=_0x5379f4[_0x3077('0x35')]||0x3;this[_0x3077('0x36')]=_0x5379f4[_0x3077('0x36')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x5379f4[_0x3077('0x37')]||0x3;this[_0x3077('0x38')]=_0x5379f4[_0x3077('0x38')]||0x96;this[_0x3077('0x39')]=_0x5379f4['dialDropMaxRetry']||0x3;this[_0x3077('0x3a')]=_0x5379f4[_0x3077('0x3a')]||0x96;this[_0x3077('0x3b')]=_0x5379f4['dialAbandonedMaxRetry']||0x3;this[_0x3077('0x3c')]=_0x5379f4[_0x3077('0x3c')]||0x96;this['dialMachineMaxRetry']=_0x5379f4['dialMachineMaxRetry']||0x3;this[_0x3077('0x3d')]=_0x5379f4['dialMachineRetryFrequency']||0x96;this[_0x3077('0x3e')]=_0x5379f4[_0x3077('0x3e')]||0x3;this[_0x3077('0x3f')]=_0x5379f4[_0x3077('0x3f')]||0x96;this[_0x3077('0x40')]=_0x5379f4['dialGlobalMaxRetry']||0x4;this[_0x3077('0x41')]=_0x5379f4[_0x3077('0x41')]?_0x5379f4[_0x3077('0x41')]:undefined;this[_0x3077('0x42')]=_0x5379f4[_0x3077('0x42')]?_0x5379f4[_0x3077('0x42')]:undefined;this['dialPrefix']=_0x5379f4[_0x3077('0x43')]||undefined;this[_0x3077('0x44')]=_0x5379f4[_0x3077('0x44')]?_0x5379f4[_0x3077('0x44')]:undefined;this[_0x3077('0x45')]=_0x5379f4['dialOrderByScheduledAt']||_0x3077('0x46');this['dialRandomLastDigitCallerIdNumber']=_0x5379f4[_0x3077('0x47')]||undefined;this[_0x3077('0x48')]=_0x5379f4[_0x3077('0x48')]||undefined;this[_0x3077('0x49')]=strategy[_0x5379f4[_0x3077('0x49')]]||'rrmemory';this['queueStatusComplete']=!![];this[_0x3077('0x4a')]=_0x5379f4[_0x3077('0x4a')]||![];this['dialAMDInitialSilence']=_0x5379f4['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x5379f4[_0x3077('0x4b')];this['dialAMDAfterGreetingSilence']=_0x5379f4['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x5379f4[_0x3077('0x4c')];this['dialAMDMinWordLength']=_0x5379f4[_0x3077('0x4d')];this[_0x3077('0x4e')]=_0x5379f4['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x5379f4[_0x3077('0x4f')];this['dialAMDSilenceThreshold']=_0x5379f4[_0x3077('0x50')];this[_0x3077('0x51')]=_0x5379f4['dialAMDMaximumWordLength'];this[_0x3077('0x52')]=0x0;this['pTalking']=0x0;this[_0x3077('0x53')]=_0x5379f4['timeout'];this[_0x3077('0x54')]=0x0;this[_0x3077('0x55')]=0x0;this[_0x3077('0x56')]=0x0;this[_0x3077('0x57')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x3077('0x58')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x3077('0x59')]=0x0;this[_0x3077('0x5a')]=0x0;this[_0x3077('0x5b')]=0x0;this[_0x3077('0x5c')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0x3077('0x5d')]=undefined;this[_0x3077('0x5e')]=undefined;this[_0x3077('0x5f')]=1.05;this[_0x3077('0x60')]=0x0;this[_0x3077('0x61')]=0x0;this[_0x3077('0x62')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x3077('0x63')]=0x0;this[_0x3077('0x64')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x3077('0x65')]=_0x5379f4[_0x3077('0x66')]||0x14;this['predictiveIntervalMinThreshold']=_0x5379f4[_0x3077('0x66')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x3077('0x67')]=0x1;this[_0x3077('0x68')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0x3077('0x69')]=_0x5379f4[_0x3077('0x69')]||0x1e;this[_0x3077('0x6a')]=_0x5379f4[_0x3077('0x6a')]||![];this[_0x3077('0x6b')]=_0x5379f4[_0x3077('0x6b')]||undefined;this[_0x3077('0x6c')]=_0x5379f4['dialAgiAfterHangupClient']||![];this[_0x3077('0x6d')]=_0x5379f4[_0x3077('0x6d')]||![];this['monitor_format']=monitorFormat[_0x5379f4['monitor_format']]?monitorFormat[_0x5379f4['monitor_format']]:undefined;this[_0x3077('0x6e')]=_0x5379f4[_0x3077('0x6e')]||![];this['mandatoryDispositionPause']=_0x5379f4['mandatoryDispositionPause']?_0x5379f4[_0x3077('0x6f')]:undefined;}module[_0x3077('0x70')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 131fda7..022a9df 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 _0xb9ab=['Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x547bf3,_0x28a455){var _0x3ed719=function(_0x45d713){while(--_0x45d713){_0x547bf3['push'](_0x547bf3['shift']());}};_0x3ed719(++_0x28a455);}(_0xb9ab,0x1d0));var _0xbb9a=function(_0x72ca5a,_0x5b0b19){_0x72ca5a=_0x72ca5a-0x0;var _0x5228b=_0xb9ab[_0x72ca5a];return _0x5228b;};'use strict';function VtigerAccount(_0x32a77a){this['id']=_0x32a77a['id']||0x0;this[_0xbb9a('0x0')]=_0x32a77a[_0xbb9a('0x0')]||'';this[_0xbb9a('0x1')]=_0x32a77a[_0xbb9a('0x1')]||'';this[_0xbb9a('0x2')]=_0x32a77a['accessKey']||'';this[_0xbb9a('0x3')]=_0x32a77a[_0xbb9a('0x3')]||'';this['serverUrl']=_0x32a77a['serverUrl']||'';this[_0xbb9a('0x4')]=_0x32a77a[_0xbb9a('0x4')]||{};}module[_0xbb9a('0x5')]=VtigerAccount; \ No newline at end of file +var _0x1dc0=['name','username','accessKey','remoteUri','Configurations','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x1dc0,0x1ce));var _0x01dc=function(_0xbac795,_0x47d2a0){_0xbac795=_0xbac795-0x0;var _0x36a889=_0x1dc0[_0xbac795];return _0x36a889;};'use strict';function VtigerAccount(_0x493081){this['id']=_0x493081['id']||0x0;this[_0x01dc('0x0')]=_0x493081[_0x01dc('0x0')]||'';this[_0x01dc('0x1')]=_0x493081[_0x01dc('0x1')]||'';this['accessKey']=_0x493081[_0x01dc('0x2')]||'';this[_0x01dc('0x3')]=_0x493081[_0x01dc('0x3')]||'';this['serverUrl']=_0x493081['serverUrl']||'';this[_0x01dc('0x4')]=_0x493081[_0x01dc('0x4')]||{};}module[_0x01dc('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 55e4fe8..9747a89 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 _0x9c08=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x7971e6,_0x40ced5){var _0x593258=function(_0x288b9f){while(--_0x288b9f){_0x7971e6['push'](_0x7971e6['shift']());}};_0x593258(++_0x40ced5);}(_0x9c08,0x1a7));var _0x89c0=function(_0x137fdf,_0x4bd2bc){_0x137fdf=_0x137fdf-0x0;var _0x2cd3db=_0x9c08[_0x137fdf];return _0x2cd3db;};'use strict';function ZendeskAccount(_0x13c6e7){this['id']=_0x13c6e7['id']||0x0;this[_0x89c0('0x0')]=_0x13c6e7[_0x89c0('0x0')]||'';this[_0x89c0('0x1')]=_0x13c6e7['username']||'';this[_0x89c0('0x2')]=_0x13c6e7[_0x89c0('0x2')]||'';this[_0x89c0('0x3')]=_0x13c6e7[_0x89c0('0x3')]||'';this[_0x89c0('0x4')]=_0x13c6e7[_0x89c0('0x4')]||'';this[_0x89c0('0x5')]=_0x13c6e7[_0x89c0('0x5')]||'';this[_0x89c0('0x6')]=_0x13c6e7['type']||'integrationTab';this[_0x89c0('0x7')]=_0x13c6e7[_0x89c0('0x7')]||'';this[_0x89c0('0x8')]=_0x13c6e7[_0x89c0('0x8')]||{};}module[_0x89c0('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xaaed=['type','serverUrl','exports','name','username','password','token','remoteUri','authType'];(function(_0x3b472b,_0x54c476){var _0x390af0=function(_0x389222){while(--_0x389222){_0x3b472b['push'](_0x3b472b['shift']());}};_0x390af0(++_0x54c476);}(_0xaaed,0x186));var _0xdaae=function(_0x999760,_0x514784){_0x999760=_0x999760-0x0;var _0x248f3a=_0xaaed[_0x999760];return _0x248f3a;};'use strict';function ZendeskAccount(_0x1061b9){this['id']=_0x1061b9['id']||0x0;this[_0xdaae('0x0')]=_0x1061b9[_0xdaae('0x0')]||'';this[_0xdaae('0x1')]=_0x1061b9[_0xdaae('0x1')]||'';this[_0xdaae('0x2')]=_0x1061b9[_0xdaae('0x2')]||'';this['token']=_0x1061b9[_0xdaae('0x3')]||'';this[_0xdaae('0x4')]=_0x1061b9[_0xdaae('0x4')]||'';this['authType']=_0x1061b9[_0xdaae('0x5')]||'';this[_0xdaae('0x6')]=_0x1061b9[_0xdaae('0x6')]||'integrationTab';this[_0xdaae('0x7')]=_0x1061b9[_0xdaae('0x7')]||'';this['Configurations']=_0x1061b9['Configurations']||{};}module[_0xdaae('0x8')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index a81344a..6bfa48b 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 _0x282c=['description','host','zone','clientId','serverUrl','code','refreshToken','exports','name'];(function(_0x26e8f3,_0x49abd6){var _0x1e7207=function(_0x473813){while(--_0x473813){_0x26e8f3['push'](_0x26e8f3['shift']());}};_0x1e7207(++_0x49abd6);}(_0x282c,0xa1));var _0xc282=function(_0x4d54bd,_0x4a137b){_0x4d54bd=_0x4d54bd-0x0;var _0x4326a6=_0x282c[_0x4d54bd];return _0x4326a6;};'use strict';function ZohoAccount(_0x3de8d9){this['id']=_0x3de8d9['id']||0x0;this[_0xc282('0x0')]=_0x3de8d9['name']||'';this[_0xc282('0x1')]=_0x3de8d9['description']||'';this[_0xc282('0x2')]=_0x3de8d9['host']||'';this[_0xc282('0x3')]=_0x3de8d9[_0xc282('0x3')]||'';this[_0xc282('0x4')]=_0x3de8d9[_0xc282('0x4')]||'';this['clientSecret']=_0x3de8d9['clientSecret']||'';this[_0xc282('0x5')]=_0x3de8d9[_0xc282('0x5')]||'';this[_0xc282('0x6')]=_0x3de8d9[_0xc282('0x6')]||'';this[_0xc282('0x7')]=_0x3de8d9[_0xc282('0x7')]||'';this['Configurations']=_0x3de8d9['Configurations']||{};}module[_0xc282('0x8')]=ZohoAccount; \ No newline at end of file +var _0xc5ef=['code','refreshToken','Configurations','exports','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x5da27f,_0x504b76){var _0x54a3fb=function(_0x3b65a8){while(--_0x3b65a8){_0x5da27f['push'](_0x5da27f['shift']());}};_0x54a3fb(++_0x504b76);}(_0xc5ef,0xae));var _0xfc5e=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xc5ef[_0x725b8e];return _0x43ac45;};'use strict';function ZohoAccount(_0x3ce2ed){this['id']=_0x3ce2ed['id']||0x0;this['name']=_0x3ce2ed['name']||'';this[_0xfc5e('0x0')]=_0x3ce2ed[_0xfc5e('0x0')]||'';this[_0xfc5e('0x1')]=_0x3ce2ed[_0xfc5e('0x1')]||'';this[_0xfc5e('0x2')]=_0x3ce2ed['zone']||'';this[_0xfc5e('0x3')]=_0x3ce2ed[_0xfc5e('0x3')]||'';this[_0xfc5e('0x4')]=_0x3ce2ed['clientSecret']||'';this[_0xfc5e('0x5')]=_0x3ce2ed[_0xfc5e('0x5')]||'';this['code']=_0x3ce2ed[_0xfc5e('0x6')]||'';this[_0xfc5e('0x7')]=_0x3ce2ed[_0xfc5e('0x7')]||'';this[_0xfc5e('0x8')]=_0x3ce2ed[_0xfc5e('0x8')]||{};}module[_0xfc5e('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 56f2a59..66387b9 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 _0x2cec=['ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','lodash','moment','isNil','string','uniqueid','idContact','queue','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callbackuniqueid','callbackat','recallme'];(function(_0x13b4bd,_0x5705d4){var _0x122b15=function(_0xf0b447){while(--_0xf0b447){_0x13b4bd['push'](_0x13b4bd['shift']());}};_0x122b15(++_0x5705d4);}(_0x2cec,0xbb));var _0xc2ce=function(_0x5e15e5,_0x1142d0){_0x5e15e5=_0x5e15e5-0x0;var _0x101038=_0x2cec[_0x5e15e5];return _0x101038;};'use strict';var util=require('util');var _=require(_0xc2ce('0x0'));var moment=require(_0xc2ce('0x1'));function checkNameSurname(_0x255dcb,_0x2cf24f,_0x233d6e){var _0x30a72e='';if(!_[_0xc2ce('0x2')](_0x2cf24f)&&_0xc2ce('0x3')===typeof _0x2cf24f){_0x30a72e+=_0x2cf24f;}if(!_['isNil'](_0x233d6e)&&_0xc2ce('0x3')===typeof _0x233d6e){_0x30a72e+='\x20'+_0x233d6e;}if(_0x30a72e!==''){return _0x30a72e;}return _0x255dcb;}function Action(_0xcbcfc0,_0x363b55,_0x1eaf0f,_0x2d9f14,_0x3945d6){this[_0xc2ce('0x4')]=_0x1eaf0f||undefined;this[_0xc2ce('0x5')]=_0xcbcfc0['id'];this[_0xc2ce('0x6')]=_0x363b55['name'];this['type']=_0x363b55['type'];this[_0xc2ce('0x7')]=_0xc2ce('0x6');this[_0xc2ce('0x8')]=![];this[_0xc2ce('0x9')]=_['isNil'](_0xcbcfc0[_0xc2ce('0xa')])?undefined:_0xcbcfc0[_0xc2ce('0xa')]['name'];this['channelAgent']=this['membername']?util[_0xc2ce('0xb')](_0xc2ce('0xc'),this[_0xc2ce('0x9')]):_0x2d9f14||undefined;this[_0xc2ce('0xd')]=checkNameSurname(_0xcbcfc0[_0xc2ce('0xe')][_0xc2ce('0xf')],_0xcbcfc0['Contact'][_0xc2ce('0x10')],_0xcbcfc0['Contact'][_0xc2ce('0x11')]);this[_0xc2ce('0x12')]=_0xcbcfc0[_0xc2ce('0x12')]||![];this[_0xc2ce('0x13')]=_0xcbcfc0['Contact'][_0xc2ce('0xf')];this[_0xc2ce('0x14')]=_0xcbcfc0[_0xc2ce('0x14')];this[_0xc2ce('0x15')]=_0xcbcfc0[_0xc2ce('0x15')]||0x0;this[_0xc2ce('0x16')]=_0xcbcfc0[_0xc2ce('0x16')]||0x0;this[_0xc2ce('0x17')]=_0xcbcfc0['countnoanswerretry']||0x0;this[_0xc2ce('0x18')]=(_0xcbcfc0[_0xc2ce('0x15')]||0x0)+(_0xcbcfc0[_0xc2ce('0x16')]||0x0)+(_0xcbcfc0['countnoanswerretry']||0x0)+(_0xcbcfc0[_0xc2ce('0x19')]||0x0)+(_0xcbcfc0[_0xc2ce('0x1a')]||0x0)+(_0xcbcfc0[_0xc2ce('0x1b')]||0x0)+(_0xcbcfc0[_0xc2ce('0x1c')]||0x0)+(_0xcbcfc0[_0xc2ce('0x1d')]||0x0);this[_0xc2ce('0x19')]=_0xcbcfc0[_0xc2ce('0x19')]||0x0;this['countdropretry']=_0xcbcfc0['countdropretry']||0x0;this[_0xc2ce('0x1b')]=_0xcbcfc0[_0xc2ce('0x1b')]||0x0;this[_0xc2ce('0x1c')]=_0xcbcfc0[_0xc2ce('0x1c')]||0x0;this[_0xc2ce('0x1d')]=_0xcbcfc0[_0xc2ce('0x1d')]||0x0;this['callback']=_0xcbcfc0['callback'];this[_0xc2ce('0x1e')]=_0xcbcfc0[_0xc2ce('0x1e')];this[_0xc2ce('0x1f')]=_0xcbcfc0[_0xc2ce('0x1f')];this['recallme']=_0xcbcfc0[_0xc2ce('0x20')];this[_0xc2ce('0x21')]=_0xcbcfc0[_0xc2ce('0x21')];this[_0xc2ce('0x22')]=_0xcbcfc0['ListId'];this[_0xc2ce('0x23')]=_[_0xc2ce('0x2')](_0xcbcfc0['Agent'])?_0xcbcfc0[_0xc2ce('0x23')]:_0xcbcfc0[_0xc2ce('0xa')]['id'];this['VoiceQueueId']=_0xcbcfc0[_0xc2ce('0x24')];this[_0xc2ce('0x25')]='';this[_0xc2ce('0x26')]='';}Action[_0xc2ce('0x27')][_0xc2ce('0x28')]=function(){return util[_0xc2ce('0xb')](_0xc2ce('0x29'),this[_0xc2ce('0xd')],this[_0xc2ce('0x2a')]);};module[_0xc2ce('0x2b')]=Action; \ No newline at end of file +var _0xf9bd=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','originatecalleridname','prototype','getCaller','number','exports','lodash','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','isNil','Agent','channelAgent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x3b7a55,_0x3b92a6){var _0x3df701=function(_0x2d8409){while(--_0x2d8409){_0x3b7a55['push'](_0x3b7a55['shift']());}};_0x3df701(++_0x3b92a6);}(_0xf9bd,0x8b));var _0xdf9b=function(_0x5d35a2,_0x15cd89){_0x5d35a2=_0x5d35a2-0x0;var _0x356af8=_0xf9bd[_0x5d35a2];return _0x356af8;};'use strict';var util=require('util');var _=require(_0xdf9b('0x0'));var moment=require('moment');function checkNameSurname(_0x130ae7,_0x1bce73,_0x3bbbce){var _0x1d0687='';if(!_['isNil'](_0x1bce73)&&_0xdf9b('0x1')===typeof _0x1bce73){_0x1d0687+=_0x1bce73;}if(!_['isNil'](_0x3bbbce)&&_0xdf9b('0x1')===typeof _0x3bbbce){_0x1d0687+='\x20'+_0x3bbbce;}if(_0x1d0687!==''){return _0x1d0687;}return _0x130ae7;}function Action(_0x5908db,_0x236051,_0x239fe0,_0x2c6561,_0x4afa92){this['uniqueid']=_0x239fe0||undefined;this[_0xdf9b('0x2')]=_0x5908db['id'];this[_0xdf9b('0x3')]=_0x236051[_0xdf9b('0x4')];this[_0xdf9b('0x5')]=_0x236051[_0xdf9b('0x5')];this[_0xdf9b('0x6')]='queue';this[_0xdf9b('0x7')]=![];this[_0xdf9b('0x8')]=_[_0xdf9b('0x9')](_0x5908db[_0xdf9b('0xa')])?undefined:_0x5908db[_0xdf9b('0xa')][_0xdf9b('0x4')];this[_0xdf9b('0xb')]=this['membername']?util[_0xdf9b('0xc')](_0xdf9b('0xd'),this[_0xdf9b('0x8')]):_0x2c6561||undefined;this[_0xdf9b('0xe')]=checkNameSurname(_0x5908db[_0xdf9b('0xf')]['phone'],_0x5908db[_0xdf9b('0xf')]['firstName'],_0x5908db['Contact'][_0xdf9b('0x10')]);this[_0xdf9b('0x11')]=_0x5908db[_0xdf9b('0x11')]||![];this[_0xdf9b('0x12')]=_0x5908db[_0xdf9b('0xf')][_0xdf9b('0x13')];this[_0xdf9b('0x14')]=_0x5908db[_0xdf9b('0x14')];this[_0xdf9b('0x15')]=_0x5908db['countbusyretry']||0x0;this[_0xdf9b('0x16')]=_0x5908db['countcongestionretry']||0x0;this[_0xdf9b('0x17')]=_0x5908db[_0xdf9b('0x17')]||0x0;this[_0xdf9b('0x18')]=(_0x5908db[_0xdf9b('0x15')]||0x0)+(_0x5908db[_0xdf9b('0x16')]||0x0)+(_0x5908db['countnoanswerretry']||0x0)+(_0x5908db[_0xdf9b('0x19')]||0x0)+(_0x5908db[_0xdf9b('0x1a')]||0x0)+(_0x5908db[_0xdf9b('0x1b')]||0x0)+(_0x5908db[_0xdf9b('0x1c')]||0x0)+(_0x5908db[_0xdf9b('0x1d')]||0x0);this[_0xdf9b('0x19')]=_0x5908db[_0xdf9b('0x19')]||0x0;this[_0xdf9b('0x1a')]=_0x5908db['countdropretry']||0x0;this[_0xdf9b('0x1b')]=_0x5908db['countabandonedretry']||0x0;this[_0xdf9b('0x1c')]=_0x5908db['countmachineretry']||0x0;this[_0xdf9b('0x1d')]=_0x5908db[_0xdf9b('0x1d')]||0x0;this[_0xdf9b('0x1e')]=_0x5908db[_0xdf9b('0x1e')];this[_0xdf9b('0x1f')]=_0x5908db[_0xdf9b('0x1f')];this[_0xdf9b('0x20')]=_0x5908db[_0xdf9b('0x20')];this['recallme']=_0x5908db[_0xdf9b('0x21')];this['ContactId']=_0x5908db[_0xdf9b('0x22')];this['ListId']=_0x5908db['ListId'];this[_0xdf9b('0x23')]=_[_0xdf9b('0x9')](_0x5908db[_0xdf9b('0xa')])?_0x5908db['UserId']:_0x5908db['Agent']['id'];this['VoiceQueueId']=_0x5908db['VoiceQueueId'];this['originatecalleridnum']='';this[_0xdf9b('0x24')]='';}Action[_0xdf9b('0x25')][_0xdf9b('0x26')]=function(){return util[_0xdf9b('0xc')]('\x22%s\x22\x20<%s>',this[_0xdf9b('0xe')],this[_0xdf9b('0x27')]);};module[_0xdf9b('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 9587387..7573331 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 _0x9ac9=['dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','channelAgent','destconnectedlinenum','calleridnum','user:%s','user:agentconnect','accountcode','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','custom:agentringnoanswer','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfererlinkedid','exports','util','bluebird','moment','md5','ioredis','../../../config/environment','preview','../../../config/logger','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','outbound','strategy','answered','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','name','callerid','Interval','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','available','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','dialMethod','clearZombieChannels','hasOwnProperty','setMessage','recallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','originated:\x20','queue','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','getContactRecallMe','agentReadyId','agents','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','catch','starttime','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','createCustomerHistory','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','callProgressDetectingCustomer','totalGlobal','NoSuchNumber','buildObj','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','YYYY-MM-DD\x20HH:mm:ss','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countglobal','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NOANSWER','countnoanswerretry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','[Preview][execCall][failure]','logBlacklist','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','pick','unlock','unlockContact','disableContact','getContactPreview','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','trim','phone','substring','dialCutDigit','getCallerId','dialOriginateCallerIdName'];(function(_0x54b788,_0x5d984b){var _0x56a207=function(_0x21cd01){while(--_0x21cd01){_0x54b788['push'](_0x54b788['shift']());}};_0x56a207(++_0x5d984b);}(_0x9ac9,0x190));var _0x99ac=function(_0x3e67f6,_0x8920a3){_0x3e67f6=_0x3e67f6-0x0;var _0x4380ad=_0x9ac9[_0x3e67f6];return _0x4380ad;};'use strict';var util=require(_0x99ac('0x0'));var _=require('lodash');var BPromise=require(_0x99ac('0x1'));var uuid=require('uuid');var moment=require(_0x99ac('0x2'));var md5=require(_0x99ac('0x3'));var Redis=require(_0x99ac('0x4'));var config=require(_0x99ac('0x5'));var logger=require('../../../config/logger')(_0x99ac('0x6'));var loggerAction=require(_0x99ac('0x7'))('actionPreview');var ami=require(_0x99ac('0x8'));var rpcDb=require(_0x99ac('0x9'));var Action=require(_0x99ac('0xa'));var ut=require(_0x99ac('0xb'));config[_0x99ac('0xc')]=_[_0x99ac('0xd')](config[_0x99ac('0xc')],{'host':_0x99ac('0xe'),'port':0x18eb});var io=require(_0x99ac('0xf'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x99ac('0x10')][_0x99ac('0x11')]=function(_0x2ec6c9){this['tail']=this[_0x99ac('0x12')]?this[_0x99ac('0x12')][_0x99ac('0x13')](_0x2ec6c9):_0x2ec6c9();};function Preview(_0x55c42c){this['sequence']=new Sequence();this[_0x99ac('0x14')]=_0x55c42c[_0x99ac('0x15')];this[_0x99ac('0x16')]=_0x55c42c[_0x99ac('0x16')];this[_0x99ac('0x17')]={};this['agents']=_0x55c42c['agents'];this[_0x99ac('0x18')]=0x0;ami['on'](_0x99ac('0x19'),this[_0x99ac('0x1a')][_0x99ac('0x1b')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0x99ac('0x1c'),this[_0x99ac('0x1d')]['bind'](this));ami['on'](_0x99ac('0x1e'),this[_0x99ac('0x1f')]['bind'](this));ami['on'](_0x99ac('0x20'),this[_0x99ac('0x21')][_0x99ac('0x1b')](this));ami['on'](_0x99ac('0x22'),this[_0x99ac('0x23')][_0x99ac('0x1b')](this));ami['on'](_0x99ac('0x24'),this[_0x99ac('0x25')][_0x99ac('0x1b')](this));ami['on'](_0x99ac('0x26'),this[_0x99ac('0x27')][_0x99ac('0x1b')](this));this[_0x99ac('0x28')](this[_0x99ac('0x14')]);}function emit(_0x3b60d3,_0x352537,_0x3bcd52){io['to'](_0x3b60d3)[_0x99ac('0x29')](_0x352537,_0x3bcd52);}function emitCampaignPreview(_0x115e81){if(_0x115e81['type']===_0x99ac('0x2a')){var _0x336e7a={'id':_0x115e81['id'],'name':_0x115e81['name'],'strategy':_0x115e81[_0x99ac('0x2b')],'answered':_0x115e81[_0x99ac('0x2c')],'available':_0x115e81['available'],'loggedIn':_0x115e81['loggedIn'],'pTalking':_0x115e81[_0x99ac('0x2d')],'sumBillable':_0x115e81[_0x99ac('0x2e')],'sumDuration':_0x115e81[_0x99ac('0x2f')],'sumHoldTime':_0x115e81[_0x99ac('0x30')]||0x0,'talking':_0x115e81[_0x99ac('0x31')],'total':_0x115e81[_0x99ac('0x32')],'type':_0x115e81[_0x99ac('0x33')],'unmanaged':_0x115e81[_0x99ac('0x34')],'abandoned':_0x115e81[_0x99ac('0x35')],'waiting':_0x115e81[_0x99ac('0x36')],'loggedInDb':_0x115e81['loggedInDb'],'dialActive':_0x115e81[_0x99ac('0x37')],'dialMethod':_0x115e81['dialMethod'],'dialOriginateCallerIdName':_0x115e81['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x115e81[_0x99ac('0x38')],'dialOriginateTimeout':_0x115e81[_0x99ac('0x39')],'dialPrefix':_0x115e81[_0x99ac('0x3a')],'outboundAnswerAgiCallsDay':_0x115e81[_0x99ac('0x3b')],'outboundAnswerCallsDay':_0x115e81[_0x99ac('0x3c')],'outboundBlacklistCallsDay':_0x115e81[_0x99ac('0x3d')],'outboundBusyCallsDay':_0x115e81[_0x99ac('0x3e')],'outboundCongestionCallsDay':_0x115e81[_0x99ac('0x3f')],'outboundDropCallsDayACS':_0x115e81[_0x99ac('0x40')],'outboundDropCallsDayCallersExit':_0x115e81['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x115e81[_0x99ac('0x41')],'outboundNoAnswerCallsDay':_0x115e81[_0x99ac('0x42')],'outboundNoSuchCallsDay':_0x115e81[_0x99ac('0x43')],'outboundOriginateFailureCallsDay':_0x115e81[_0x99ac('0x44')],'outboundReCallsDay':_0x115e81[_0x99ac('0x45')],'outboundRejectCallsDay':_0x115e81[_0x99ac('0x46')],'outboundUnknownCallsDay':_0x115e81[_0x99ac('0x47')],'outboundAbandonedCallsDay':_0x115e81[_0x99ac('0x48')],'predictiveIntervalAnsweredCalls':_0x115e81[_0x99ac('0x49')],'predictiveIntervalAvgHoldtime':_0x115e81[_0x99ac('0x4a')],'predictiveIntervalAvgTalktime':_0x115e81[_0x99ac('0x4b')],'predictiveIntervalDroppedCallsCallersExit':_0x115e81[_0x99ac('0x4c')],'predictiveIntervalDroppedCallsTimeout':_0x115e81['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x115e81[_0x99ac('0x4d')],'predictiveIntervalErlangCallsDroppedCalls':_0x115e81[_0x99ac('0x4e')],'predictiveIntervalHitRate':_0x115e81[_0x99ac('0x4f')],'predictiveIntervalMultiplicativeFactor':_0x115e81[_0x99ac('0x50')],'predictiveIntervalPauses':_0x115e81['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x115e81[_0x99ac('0x51')],'predictiveIntervalTotalCalls':_0x115e81[_0x99ac('0x52')],'message':_0x115e81['message'],'originated':_0x115e81[_0x99ac('0x53')],'erlangCalls':_0x115e81[_0x99ac('0x54')],'erlangCallToSecond':_0x115e81[_0x99ac('0x55')],'erlangAbandonmentRate':_0x115e81[_0x99ac('0x56')],'erlangBusyFactor':_0x115e81[_0x99ac('0x57')],'startPredictive':_0x115e81[_0x99ac('0x58')],'startProgressive':_0x115e81['startProgressive']};if(_0x115e81[_0x99ac('0x59')]){_0x336e7a[_0x99ac('0x59')]={'id':_0x115e81[_0x99ac('0x59')]['id'],'name':_0x115e81[_0x99ac('0x59')][_0x99ac('0x5a')],'active':_0x115e81['Trunk']['active'],'callerid':_0x115e81['Trunk'][_0x99ac('0x5b')]};}if(_0x115e81[_0x99ac('0x5c')]){_0x336e7a[_0x99ac('0x5c')]={'id':_0x115e81[_0x99ac('0x5c')]['id'],'name':_0x115e81[_0x99ac('0x5c')][_0x99ac('0x5a')]};}var _0x43796d=md5(JSON['stringify'](_0x336e7a));if(_0x115e81[_0x99ac('0x3')]!==_0x43796d){_0x115e81[_0x99ac('0x3')]=_0x43796d;emit(util[_0x99ac('0x5d')](_0x99ac('0x5e'),_0x336e7a['name']),_0x99ac('0x5f'),_0x336e7a);}}}function emitVoiceQueueChannelRemove(_0x30fd78){logger[_0x99ac('0x60')](_0x99ac('0x61'),JSON[_0x99ac('0x62')](_0x30fd78));emit(util[_0x99ac('0x5d')](_0x99ac('0x5e'),_0x30fd78[_0x99ac('0x5a')]),_0x99ac('0x63'),_0x30fd78);io[_0x99ac('0x29')](_0x99ac('0x64'),_0x30fd78);}function notSendMessagesQueue(_0x172438){if(_0x172438['sendMessageOneNotActive']){if(_0x172438[_0x99ac('0x53')]===0x0&&_0x172438[_0x99ac('0x2d')]===0x0){_0x172438[_0x99ac('0x65')]=![];_0x172438[_0x99ac('0x66')]=0x0;_0x172438['paused']=0x0;_0x172438[_0x99ac('0x67')]=_0x99ac('0x68');ut[_0x99ac('0x69')](_0x99ac('0x6a'),_0x172438[_0x99ac('0x5a')]+_0x99ac('0x6b'));}else{_0x172438[_0x99ac('0x67')]='IS_DISACTIVED';ut[_0x99ac('0x69')](_0x99ac('0x6a'),_0x172438[_0x99ac('0x5a')]+_0x99ac('0x6c'));}emitCampaignPreview(_0x172438);}}Preview[_0x99ac('0x10')][_0x99ac('0x28')]=function(){var _0x2e911d=this;setInterval(function(){_0x2e911d['syncCampaigns']();},0x7cf);};Preview[_0x99ac('0x10')][_0x99ac('0x6d')]=function(){var _0x297a99=this[_0x99ac('0x14')];this['clockClearZombieChannels']+=0x1;for(var _0x19924d in _0x297a99){if(_0x297a99['hasOwnProperty'](_0x19924d)&&(_0x297a99[_0x19924d][_0x99ac('0x6e')]==='preview'||_0x297a99[_0x19924d][_0x99ac('0x6e')]==='booked')&&_0x297a99[_0x19924d]['type']===_0x99ac('0x2a')){if(this['clockClearZombieChannels']>0x7){this[_0x99ac('0x18')]=0x0;this[_0x99ac('0x6f')]();}}if(_0x297a99[_0x99ac('0x70')](_0x19924d)&&_0x297a99[_0x19924d][_0x99ac('0x6e')]===_0x99ac('0x6')&&_0x297a99[_0x19924d]['type']==='outbound'){if(_0x297a99[_0x19924d][_0x99ac('0x37')]){this[_0x99ac('0x71')](_0x297a99[_0x19924d]);this[_0x99ac('0x72')](_0x297a99[_0x19924d]);}else{notSendMessagesQueue(_0x297a99[_0x19924d]);}}}};Preview[_0x99ac('0x10')][_0x99ac('0x73')]=function(_0x47db89){var _0x4132d7=this;this[_0x99ac('0x74')][_0x99ac('0x11')](function(){if(!_[_0x99ac('0x75')](_0x4132d7[_0x99ac('0x17')][_0x47db89])){loggerAction[_0x99ac('0x60')](_0x99ac('0x76'),_0x47db89,'Queue',_0x4132d7[_0x99ac('0x17')][_0x47db89]['queue'],_0x99ac('0x77'),JSON[_0x99ac('0x62')](_0x4132d7[_0x99ac('0x14')][_0x4132d7['actions'][_0x47db89][_0x99ac('0x78')]][_0x99ac('0x53')]),_0x99ac('0x79'),JSON[_0x99ac('0x62')](_0x4132d7['campaignsPreview'][_0x4132d7[_0x99ac('0x17')][_0x47db89][_0x99ac('0x78')]][_0x99ac('0x2d')]),JSON[_0x99ac('0x62')](_0x4132d7[_0x99ac('0x17')][_0x47db89][_0x99ac('0x7a')]),JSON[_0x99ac('0x62')](_['pick'](_0x4132d7[_0x99ac('0x17')][_0x47db89],[_0x99ac('0x7b'),_0x99ac('0x7c'),_0x99ac('0x7d'),_0x99ac('0x7e')])));return ami[_0x99ac('0x7f')]({'action':'status','channel':_0x4132d7[_0x99ac('0x17')][_0x47db89][_0x99ac('0x80')]})['catch'](function(_0x50344){if(_0x50344[_0x99ac('0x67')]===_0x99ac('0x81')){setTimeout(function(){if(_0x4132d7[_0x99ac('0x17')][_0x47db89]){ut[_0x99ac('0x82')](_0x4132d7[_0x99ac('0x14')][_0x4132d7[_0x99ac('0x17')][_0x47db89][_0x99ac('0x78')]],_0x99ac('0x83'));if(_0x4132d7[_0x99ac('0x17')][_0x47db89]['dialAnswer']===!![]){ut[_0x99ac('0x84')](_0x4132d7[_0x99ac('0x14')][_0x4132d7['actions'][_0x47db89][_0x99ac('0x78')]],_0x99ac('0x83'));ut[_0x99ac('0x85')](_0x99ac('0x86')+_0x47db89,_0x4132d7['actions'][_0x47db89][_0x99ac('0x78')]);}ut['loggerError'](_0x99ac('0x87')+_0x47db89,_0x4132d7['actions'][_0x47db89][_0x99ac('0x78')]);delete _0x4132d7['actions'][_0x47db89];}},0x2328);}});}});};Preview['prototype'][_0x99ac('0x6f')]=function(){var _0xe1ed53=this;loggerAction[_0x99ac('0x60')]('[action]',_[_0x99ac('0x88')](this[_0x99ac('0x17')]));for(var _0x479bf5 in this[_0x99ac('0x17')]){if(_0xe1ed53[_0x99ac('0x17')]['hasOwnProperty'](_0x479bf5)){_0xe1ed53[_0x99ac('0x73')](_0x479bf5);}}};Preview[_0x99ac('0x10')][_0x99ac('0x72')]=function(_0x5e20f8){var _0x16eeff=this;rpcDb[_0x99ac('0x89')](_0x5e20f8['id'],ut[_0x99ac('0x8a')](this[_0x99ac('0x8b')]))[_0x99ac('0x8c')](function(_0x441cff){if(!_['isNil'](_0x441cff)){for(var _0xb515f3=0x0;_0xb515f3<_0x441cff[_0x99ac('0x8d')];_0xb515f3+=0x1){if(ut['getDiff'](_0x441cff[_0xb515f3][_0x99ac('0x8e')])<_0x5e20f8[_0x99ac('0x8f')]*0x3c){if(_0x441cff[_0xb515f3][_0x99ac('0x90')]&&!_0x441cff[_0xb515f3][_0x99ac('0x90')][_0x99ac('0x91')]){_0x16eeff[_0x99ac('0x92')](_0x441cff[_0xb515f3]['id'])['then'](ut[_0x99ac('0x93')](_0x99ac('0x94')))[_0x99ac('0x95')](ut['logger2'](_0x99ac('0x94')));}else{rpcDb['disableContact'](_0x441cff[_0xb515f3]['id']);}}else{var _0x5861ce=new Action(_0x441cff[_0xb515f3],_0x5e20f8);_0x5861ce[_0x99ac('0x96')]=moment()[_0x99ac('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e20f8['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x5861ce,0x17,_0x99ac('0x97'));if(_0x5e20f8[_0x99ac('0x98')]){rpcDb[_0x99ac('0x99')](ut[_0x99ac('0x9a')](_0x441cff[_0xb515f3]));rpcDb['createCustomerHistory'](_0x5861ce,_0x99ac('0x9b'));}else{ut[_0x99ac('0x9c')](_0x5861ce,0x16,_0x99ac('0x9d'));rpcDb[_0x99ac('0x9e')](_0x5861ce,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x5861ce,'[HistoryRecallClose]');}}}}})[_0x99ac('0x95')](ut['logger2'](_0x99ac('0x9f')));};Preview[_0x99ac('0x10')][_0x99ac('0x71')]=function(_0x4334c7){_0x4334c7[_0x99ac('0x65')]=!![];if(ut['IsNotLoggedIn'](_0x4334c7['loggedIn'])){_0x4334c7[_0x99ac('0x67')]=_0x99ac('0xa0');}else if(!ut[_0x99ac('0xa1')](_0x4334c7[_0x99ac('0x37')])){_0x4334c7['message']=_0x99ac('0x68');}else if(!this['isTrunkReachable'](_0x4334c7['Trunk'])){if(!this[_0x99ac('0xa2')](_0x4334c7[_0x99ac('0xa3')])){_0x4334c7[_0x99ac('0x67')]='TRUNK_IS_NOT_REACHABLE';}else{_0x4334c7['message']='ACTIVE';}}else{_0x4334c7[_0x99ac('0x67')]='ACTIVE';}emitCampaignPreview(_0x4334c7);};Preview[_0x99ac('0x10')][_0x99ac('0xa4')]=function(_0x51e2a5,_0x570917,_0xedcb85){var _0x1fc202=this;var _0x3a3585=this[_0x99ac('0x17')][_0x570917];var _0x241c3f=this[_0x99ac('0x14')][_0x3a3585['queue']];var _0x4fc5c3;if(_0x241c3f){switch(_0xedcb85){case'1':_0x241c3f[_0x99ac('0x43')]+=0x1;_0x3a3585['countnosuchnumberretry']+=0x1;_0x3a3585['countglobal']=ut[_0x99ac('0xa5')](_0x3a3585);ut[_0x99ac('0x9c')](_0x3a3585,0x0,_0x99ac('0xa6'));ami[_0x99ac('0x29')]('custom:agentnosuchnumber',ut[_0x99ac('0xa7')](_0x3a3585,'nosuchnumber'));rpcDb[_0x99ac('0x9e')](_0x3a3585,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x99ac('0xa5')](_0x3a3585)>=_0x241c3f[_0x99ac('0xa8')]){_0x4fc5c3=ut[_0x99ac('0xa9')](_0x3a3585,0xf,_0x99ac('0xaa'));rpcDb[_0x99ac('0xab')](_0x4fc5c3,_0x99ac('0xac'));}else{if(_0x3a3585[_0x99ac('0xad')]>=_0x241c3f[_0x99ac('0xae')]){rpcDb[_0x99ac('0xab')](_0x3a3585,_0x99ac('0xac'));}else{rpcDb[_0x99ac('0xaf')](ut[_0x99ac('0xb0')](_0x3a3585,_0x99ac('0xad'),_0x241c3f[_0x99ac('0xb1')]),_0x3a3585[_0x99ac('0xb2')],_0x3a3585['activeContact']);}}delete this[_0x99ac('0x17')][_0x51e2a5[_0x99ac('0xb3')]];break;case'ANSWER':var _0x3e2ff5=moment()['format'](_0x99ac('0xb4'));_0x3a3585['responsetime']=_0x3e2ff5;_0x3a3585[_0x99ac('0xb5')]=_0x3e2ff5;_0x3a3585[_0x99ac('0x7a')]=!![];_0x241c3f[_0x99ac('0x2d')]+=0x1;logger['info'](_0x99ac('0xb6'),_0x3a3585[_0x99ac('0xb7')],_0x99ac('0xb8'),_0x241c3f[_0x99ac('0x5a')],_0x99ac('0x79'),_0x241c3f[_0x99ac('0x2d')]);ami['emit'](_0x99ac('0xb9'),ut[_0x99ac('0xa7')](_0x3a3585,_0x99ac('0xba'),this['campaignsPreview'][_0x3a3585[_0x99ac('0x78')]]));if(_0x241c3f[_0x99ac('0xbb')]){ami[_0x99ac('0x29')](_0x99ac('0xbc'),ut[_0x99ac('0xbd')](_0x3a3585));}break;case'16':ami[_0x99ac('0x29')]('custom:agentcomplete',ut[_0x99ac('0xa7')](_0x3a3585,_0x99ac('0xbe'),this[_0x99ac('0x14')][_0x3a3585[_0x99ac('0x78')]]));emitVoiceQueueChannelRemove(ut[_0x99ac('0xa7')](_0x3a3585,_0x99ac('0xbe')));_0x241c3f[_0x99ac('0x3c')]+=0x1;_0x241c3f[_0x99ac('0x32')]+=0x1;_0x241c3f[_0x99ac('0x2c')]+=0x1;ut[_0x99ac('0x84')](_0x241c3f,_0x99ac('0xbf'));_0x3a3585['countglobal']=ut[_0x99ac('0xa5')](_0x3a3585);ut[_0x99ac('0x9c')](_0x3a3585,0x4,_0x99ac('0xc0'));rpcDb[_0x99ac('0x9e')](_0x3a3585,_0x99ac('0xc1'));rpcDb[_0x99ac('0xab')](_0x3a3585,_0x99ac('0xc2'));rpcDb[_0x99ac('0xc3')](_0x3a3585);_0x241c3f['sumDuration']+=_0x3a3585['talktime'];_0x241c3f[_0x99ac('0x2e')]+=_0x3a3585[_0x99ac('0xc4')];logger[_0x99ac('0x60')](_0x99ac('0xc5'),_0x3a3585[_0x99ac('0xb7')],_0x99ac('0xb8'),_0x241c3f[_0x99ac('0x5a')],_0x99ac('0x79'),_0x241c3f[_0x99ac('0x2d')]);delete this[_0x99ac('0x17')][_0x51e2a5[_0x99ac('0xb3')]];break;case _0x99ac('0xc6'):_0x241c3f['outboundBusyCallsDay']+=0x1;_0x3a3585['countbusyretry']+=0x1;_0x3a3585[_0x99ac('0xc7')]=ut[_0x99ac('0xa5')](_0x3a3585);ut[_0x99ac('0x9c')](_0x3a3585,0x5,_0x99ac('0xc8'));ami[_0x99ac('0x29')](_0x99ac('0xc9'),ut[_0x99ac('0xa7')](_0x3a3585,_0x99ac('0xca')));rpcDb[_0x99ac('0x9e')](_0x3a3585,_0x99ac('0xcb'));if(ut['totalGlobal'](_0x3a3585)>=_0x241c3f['dialGlobalMaxRetry']){_0x4fc5c3=ut[_0x99ac('0xa9')](_0x3a3585,0xf,_0x99ac('0xaa'));rpcDb[_0x99ac('0xab')](_0x4fc5c3,_0x99ac('0xcc'));}else{if(_0x3a3585[_0x99ac('0xcd')]>=_0x241c3f[_0x99ac('0xce')]){rpcDb[_0x99ac('0xab')](_0x3a3585,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x99ac('0xaf')](ut[_0x99ac('0xb0')](_0x3a3585,'countbusyretry',_0x241c3f[_0x99ac('0xcf')]),_0x3a3585[_0x99ac('0xb2')],_0x3a3585[_0x99ac('0xd0')]);}}break;case _0x99ac('0xd1'):_0x241c3f[_0x99ac('0x42')]+=0x1;_0x3a3585[_0x99ac('0xd2')]+=0x1;_0x3a3585[_0x99ac('0xc7')]=ut[_0x99ac('0xa5')](_0x3a3585);ut['logCustomer'](_0x3a3585,0x3,'NoAnswer');ami[_0x99ac('0x29')]('custom:agentnoanswer',ut[_0x99ac('0xa7')](_0x3a3585,'noanswer'));rpcDb[_0x99ac('0x9e')](_0x3a3585,_0x99ac('0xd3'));if(ut[_0x99ac('0xa5')](_0x3a3585)>=_0x241c3f[_0x99ac('0xa8')]){_0x4fc5c3=ut[_0x99ac('0xa9')](_0x3a3585,0xf,_0x99ac('0xaa'));rpcDb['createCustomerFinal'](_0x4fc5c3,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x3a3585[_0x99ac('0xd2')]>=_0x241c3f[_0x99ac('0xd4')]){rpcDb[_0x99ac('0xab')](_0x3a3585,_0x99ac('0xd3'));}else{rpcDb['rescheduleContact'](ut[_0x99ac('0xb0')](_0x3a3585,_0x99ac('0xd2'),_0x241c3f[_0x99ac('0xd5')]),_0x3a3585[_0x99ac('0xb2')],_0x3a3585[_0x99ac('0xd0')]);}}break;case _0x99ac('0xd6'):_0x241c3f[_0x99ac('0x3f')]+=0x1;_0x3a3585['countcongestionretry']+=0x1;_0x3a3585[_0x99ac('0xc7')]=ut[_0x99ac('0xa5')](_0x3a3585);ut['logCustomer'](_0x3a3585,0x8,_0x99ac('0xd7'));ami['emit'](_0x99ac('0xd8'),ut[_0x99ac('0xa7')](_0x3a3585,_0x99ac('0xd9')));rpcDb[_0x99ac('0x9e')](_0x3a3585,_0x99ac('0xda'));if(ut[_0x99ac('0xa5')](_0x3a3585)>=_0x241c3f[_0x99ac('0xa8')]){_0x4fc5c3=ut[_0x99ac('0xa9')](_0x3a3585,0xf,_0x99ac('0xaa'));rpcDb[_0x99ac('0xab')](_0x4fc5c3,_0x99ac('0xdb'));}else{if(_0x3a3585[_0x99ac('0xdc')]>=_0x241c3f[_0x99ac('0xdd')]){rpcDb[_0x99ac('0xab')](_0x3a3585,_0x99ac('0xda'));}else{rpcDb[_0x99ac('0xaf')](ut[_0x99ac('0xb0')](_0x3a3585,_0x99ac('0xdc'),_0x241c3f['dialBusyRetryFrequency']),_0x3a3585[_0x99ac('0xb2')],_0x3a3585[_0x99ac('0xd0')]);}}break;case'CANCEL':_0x241c3f[_0x99ac('0x46')]+=0x1;_0x3a3585[_0x99ac('0xde')]+=0x1;_0x3a3585[_0x99ac('0xc7')]=ut[_0x99ac('0xa5')](_0x3a3585);ut[_0x99ac('0x9c')](_0x3a3585,0x14,_0x99ac('0xdf'));ami[_0x99ac('0x29')](_0x99ac('0xe0'),ut[_0x99ac('0xa7')](_0x3a3585,_0x99ac('0xe1')));rpcDb[_0x99ac('0x9e')](_0x3a3585,_0x99ac('0xe2'));if(ut[_0x99ac('0xa5')](_0x3a3585)>=_0x241c3f[_0x99ac('0xa8')]){_0x4fc5c3=ut[_0x99ac('0xa9')](_0x3a3585,0x14,_0x99ac('0xdf'));rpcDb['createCustomerFinal'](_0x4fc5c3,_0x99ac('0xe3'));}else{if(_0x3a3585['countagentrejectretry']>=_0x241c3f[_0x99ac('0xe4')]){rpcDb['createCustomerFinal'](_0x3a3585,_0x99ac('0xe3'));}else{rpcDb[_0x99ac('0xaf')](ut['scheduledAt'](_0x3a3585,_0x99ac('0xde'),_0x241c3f['dialAgentRejectRetryFrequency']),_0x3a3585[_0x99ac('0xb2')],_0x3a3585[_0x99ac('0xd0')]);}}break;case _0x99ac('0xe5'):_0x241c3f['outboundAbandonedCallsDay']+=0x1;_0x3a3585[_0x99ac('0xe6')]+=0x1;_0x3a3585[_0x99ac('0xc7')]=ut[_0x99ac('0xa5')](_0x3a3585);ut[_0x99ac('0x9c')](_0x3a3585,0xb,_0x99ac('0xe7'));rpcDb[_0x99ac('0x9e')](_0x3a3585,_0x99ac('0xe8'));if(ut[_0x99ac('0xa5')](_0x3a3585)>=_0x241c3f['dialGlobalMaxRetry']){_0x4fc5c3=ut['cloneAction'](_0x3a3585,0xf,_0x99ac('0xaa'));rpcDb[_0x99ac('0xab')](_0x4fc5c3,_0x99ac('0xe8'));}else{if(_0x3a3585['countabandonedetry']>=_0x241c3f[_0x99ac('0xe9')]){rpcDb[_0x99ac('0xab')](_0x3a3585,_0x99ac('0xe8'));}else{rpcDb[_0x99ac('0xaf')](ut['scheduledAt'](_0x3a3585,_0x99ac('0xe6'),_0x241c3f['dialAbandonedRetryFrequency']),_0x3a3585[_0x99ac('0xb2')],_0x3a3585[_0x99ac('0xd0')]);}}break;case'18':_0x241c3f[_0x99ac('0x47')]+=0x1;_0x3a3585[_0x99ac('0xea')]+=0x1;_0x3a3585[_0x99ac('0xc7')]=ut[_0x99ac('0xa5')](_0x3a3585);ut[_0x99ac('0x9c')](_0x3a3585,0x12,_0x51e2a5[_0x99ac('0xeb')]||_0x51e2a5[_0x99ac('0xec')]);ami[_0x99ac('0x29')](_0x99ac('0xed'),ut[_0x99ac('0xa7')](_0x3a3585,_0x99ac('0xee')));rpcDb['createCustomerHistory'](_0x3a3585,_0x99ac('0xef'));if(ut[_0x99ac('0xa5')](_0x3a3585)>=_0x241c3f[_0x99ac('0xa8')]){_0x4fc5c3=ut[_0x99ac('0xa9')](_0x3a3585,0xf,_0x99ac('0xaa'));rpcDb[_0x99ac('0xab')](_0x4fc5c3,_0x99ac('0xef'));}else{rpcDb[_0x99ac('0xab')](_0x3a3585,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x99ac('0x17')][_0x51e2a5[_0x99ac('0xb3')]];break;case'19':_0x241c3f[_0x99ac('0x47')]+=0x1;_0x3a3585[_0x99ac('0xc7')]=ut[_0x99ac('0xa5')](_0x3a3585);ut['logCustomer'](_0x3a3585,0x13,_0x51e2a5[_0x99ac('0xeb')]||_0x51e2a5[_0x99ac('0xec')]);ami[_0x99ac('0x29')](_0x99ac('0xed'),ut[_0x99ac('0xa7')](_0x3a3585,_0x99ac('0xee')));rpcDb[_0x99ac('0x9e')](_0x3a3585,_0x99ac('0xf0'));if(ut[_0x99ac('0xa5')](_0x3a3585)>=_0x241c3f['dialGlobalMaxRetry']){_0x4fc5c3=ut[_0x99ac('0xa9')](_0x3a3585,0xf,_0x99ac('0xaa'));rpcDb[_0x99ac('0xab')](_0x4fc5c3,'[callProgressDetectingCustomer][machine]');}else{rpcDb['createCustomerFinal'](_0x3a3585,_0x99ac('0xf0'));}delete this[_0x99ac('0x17')][_0x51e2a5[_0x99ac('0xb3')]];break;default:if(_0x3a3585[_0x99ac('0x7a')]){ut[_0x99ac('0x84')](_0x241c3f,_0x99ac('0xf1'));ut[_0x99ac('0x85')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x241c3f['name'],_0x51e2a5);}_0x241c3f[_0x99ac('0x47')]+=0x1;_0x3a3585[_0x99ac('0xc7')]=ut[_0x99ac('0xa5')](_0x3a3585);ut['logCustomer'](_0x3a3585,0xc,_0x51e2a5[_0x99ac('0xeb')]||_0x51e2a5['dialstatus']);rpcDb[_0x99ac('0x9e')](_0x3a3585,_0x99ac('0xf2'));if(ut['totalGlobal'](_0x3a3585)>=_0x241c3f[_0x99ac('0xa8')]){_0x4fc5c3=ut[_0x99ac('0xa9')](_0x3a3585,0xf,_0x99ac('0xaa'));rpcDb[_0x99ac('0xab')](_0x4fc5c3,_0x99ac('0xf3'));}else{rpcDb[_0x99ac('0xab')](_0x3a3585,_0x99ac('0xf3'));}delete this['actions'][_0x51e2a5[_0x99ac('0xb3')]];}if(!(_0x3a3585['dialAnswer']&&_0xedcb85==='16')){ut['updateOriginated'](_0x241c3f,_0x99ac('0xf4'));logger['info'](_0x99ac('0xf5'),_0x3a3585[_0x99ac('0xb7')],_0x99ac('0xb8'),_0x241c3f['name'],_0x99ac('0x77'),_0x241c3f['originated']);}if(_0xedcb85!==_0x99ac('0xf6')){delete this['actions'][_0x51e2a5[_0x99ac('0xb3')]];delete this[_0x99ac('0x17')][_0x51e2a5[_0x99ac('0xf7')]];}}};Preview[_0x99ac('0x10')][_0x99ac('0xf8')]=function(_0x2f26e7,_0x3c2f61,_0x3a3632){if(_[_0x99ac('0xf9')](_0x3c2f61)&&_0x99ac('0xfa')!==typeof _0x3c2f61){return;}if(_[_0x99ac('0xf9')](_0x3a3632)&&_0x99ac('0xfa')!==typeof _0x3a3632){return;}switch(_0x3a3632[_0x99ac('0xfb')]){case'0':ut[_0x99ac('0xfc')](_0x2f26e7,0x0,_0x99ac('0xa6'));rpcDb[_0x99ac('0xfd')](_0x2f26e7,_0x99ac('0xfe'));break;case'3':ut[_0x99ac('0xfc')](_0x2f26e7,0x3,_0x99ac('0xff'));rpcDb['createAgentHistory'](_0x2f26e7,_0x99ac('0x100'));break;case'5':ut[_0x99ac('0xfc')](_0x2f26e7,0x5,_0x99ac('0xc8'));rpcDb[_0x99ac('0xfd')](_0x2f26e7,_0x99ac('0x101'));break;case'8':ut[_0x99ac('0xfc')](_0x2f26e7,0x8,_0x99ac('0xd7'));rpcDb[_0x99ac('0xfd')](_0x2f26e7,_0x99ac('0x102'));break;case'22':ut[_0x99ac('0xfc')](_0x2f26e7,0x16,_0x99ac('0x103'));rpcDb['createAgentHistory'](_0x2f26e7,_0x99ac('0x104'));break;default:ut[_0x99ac('0xfc')](_0x2f26e7,0xc,_0x3a3632[_0x99ac('0xfb')]);rpcDb[_0x99ac('0xfd')](_0x2f26e7,_0x99ac('0x102'));}ut[_0x99ac('0x82')](_0x3c2f61,_0x99ac('0x105'));logger[_0x99ac('0x60')]('[originated][decrement][callProgressDetectingAgent]',_0x2f26e7[_0x99ac('0xb7')],_0x99ac('0xb8'),_0x3c2f61[_0x99ac('0x5a')],_0x99ac('0x77'),_0x3c2f61[_0x99ac('0x53')]);delete this[_0x99ac('0x17')][_0x2f26e7[_0x99ac('0xb7')]];};Preview[_0x99ac('0x10')][_0x99ac('0x106')]=function(_0x463cf8,_0x983dff,_0x391de,_0x56de37,_0x442017){var _0x107c51=this;return new BPromise(function(_0x437f18,_0x3c24cc){if(_[_0x99ac('0x75')](_0x983dff)||_['isNil'](_0x983dff[_0x99ac('0x107')])||_[_0x99ac('0x75')](_0x983dff['Contact']['phone'])||_['isNil'](_0x983dff[_0x99ac('0x7d')])){_0x3c24cc(ut[_0x99ac('0x67')](_0x99ac('0x108'),_0x56de37,_0x442017));return;}var _0x10462b=uuid['v4']();var _0xbac02c=_0x107c51['campaignsPreview'][_0x983dff[_0x99ac('0x109')][_0x99ac('0x5a')]];var _0x1e0b38=_0x391de?_0x107c51['agents'][_0x391de]['id']:undefined;_0x107c51[_0x99ac('0x17')][_0x10462b]=new Action(_0x983dff,_0xbac02c,_0x10462b,_0x391de,_0x1e0b38);var _0x31dc18=_0x107c51['actions'][_0x10462b];_0x31dc18['unlockAgent']=_0x56de37;_0x31dc18[_0x99ac('0xd0')]=_0x442017;_0x31dc18[_0x99ac('0x10a')]=_0x391de;if(_[_0x99ac('0x10b')](_0x463cf8)){_0x107c51['execCall'](_0x31dc18,_0xbac02c,_0x983dff,_0x391de)[_0x99ac('0x8c')](function(_0x358adc){logger[_0x99ac('0x60')](_0x99ac('0x10c'),_0x99ac('0x10d')+_0x31dc18[_0x99ac('0x78')]+_0x99ac('0x10e')+_0x31dc18[_0x99ac('0x10f')],JSON[_0x99ac('0x62')](_0x358adc));ami[_0x99ac('0x29')](_0x99ac('0x110'),ut[_0x99ac('0xa7')](_0x31dc18,'called',_0x107c51['campaignsPreview'][_0x31dc18[_0x99ac('0x78')]]));_0x437f18(ut['message']('Calling'));})[_0x99ac('0x95')](function(_0x257396){ut[_0x99ac('0x69')](_0x99ac('0x111'),_0x257396);_0x3c24cc(ut[_0x99ac('0x67')]('Call\x20failed',_0x56de37,_0x442017));});}else{_0xbac02c[_0x99ac('0x3d')]+=0x1;ut[_0x99ac('0x112')](_0x31dc18);rpcDb[_0x99ac('0x113')](_0x31dc18,'[Blacklist][error]');delete _0x107c51[_0x99ac('0x17')][_0x10462b];_0x3c24cc(ut[_0x99ac('0x67')](_0x99ac('0x114'),_0x56de37,_0x442017));}});};Preview[_0x99ac('0x10')][_0x99ac('0xa2')]=function(_0x239e5f){return!_[_0x99ac('0x75')](_0x239e5f)&&!_['isNil'](_0x239e5f[_0x99ac('0x5a')])&&!_['isNil'](_0x239e5f[_0x99ac('0x115')])&&_0x239e5f[_0x99ac('0x115')]&&!_[_0x99ac('0x75')](this['trunks'][util[_0x99ac('0x5d')](_0x99ac('0x116'),_0x239e5f['name'])])&&!_[_0x99ac('0x75')](this[_0x99ac('0x16')][util['format'](_0x99ac('0x116'),_0x239e5f[_0x99ac('0x5a')])][_0x99ac('0x117')])&&(this[_0x99ac('0x16')][util[_0x99ac('0x5d')](_0x99ac('0x116'),_0x239e5f[_0x99ac('0x5a')])][_0x99ac('0x117')]===_0x99ac('0x118')||this[_0x99ac('0x16')][util[_0x99ac('0x5d')](_0x99ac('0x116'),_0x239e5f['name'])]['status']===_0x99ac('0x119'));};Preview[_0x99ac('0x10')]['run']=function(_0xd90df6,_0x43a6d1){var _0x2a41e1=this;return new BPromise(function(_0x500259,_0x897c2b){_0x2a41e1[_0x99ac('0x11a')](_0xd90df6,_0x43a6d1)['then'](function(_0x2e8232){_0x500259(_[_0x99ac('0x11b')](_0x2e8232,[_0x99ac('0x67')]));})[_0x99ac('0x95')](function(_0x4b4df8){if(_0x4b4df8[_0x99ac('0x11c')]){rpcDb[_0x99ac('0x11d')](_0xd90df6);}if(_0x4b4df8[_0x99ac('0x115')]){rpcDb[_0x99ac('0x11e')](_0xd90df6);}_0x897c2b(_['pick'](_0x4b4df8,['message']));});});};Preview[_0x99ac('0x10')][_0x99ac('0x11a')]=function(_0x55ffdd,_0x6ef19a){var _0x3781be=this;return new BPromise(function(_0x1a516c,_0x540b4a){var _0x5770a2,_0x19a67c;rpcDb[_0x99ac('0x11f')](_0x55ffdd)[_0x99ac('0x8c')](function(_0x45a851){if(!_[_0x99ac('0x75')](_0x45a851[0x0])){_0x19a67c=_0x45a851[0x0]['recallme']?![]:!![];_0x5770a2=_0x45a851[0x0]['recallme']?!![]:![];_0x5770a2=_0x6ef19a?!![]:_0x5770a2;}var _0x1c2df0=_0x3781be[_0x99ac('0x120')](_0x45a851);if(_0x1c2df0[_0x99ac('0x121')]){rpcDb[_0x99ac('0x122')](_[_0x99ac('0x11b')](_0x45a851[0x0],[_0x99ac('0x7d'),_0x99ac('0x123')]))[_0x99ac('0x8c')](function(_0x5d104b){_0x3781be[_0x99ac('0x106')](_0x5d104b,_0x45a851[0x0],_0x6ef19a,_0x19a67c,_0x5770a2)['then'](function(_0x490843){_0x1a516c(_0x490843);})[_0x99ac('0x95')](function(_0x1c6a91){_0x540b4a(_0x1c6a91);});})['catch'](function(_0x1842cd){ut['logger'](_0x99ac('0x124'),_0x1842cd);_0x540b4a(ut['message'](_0x99ac('0x125'),_0x19a67c,_0x5770a2));});}else{_0x540b4a(ut[_0x99ac('0x67')](_0x1c2df0[_0x99ac('0x67')],_0x19a67c,_0x5770a2));}})[_0x99ac('0x95')](function(_0x14cef6){ut['logger'](_0x99ac('0x126'),_0x14cef6);_0x540b4a(ut[_0x99ac('0x67')](_0x99ac('0x125'),![],!![]));});});};Preview['prototype'][_0x99ac('0x120')]=function(_0xf0035e){if(_['isNil'](_0xf0035e)||_['isEmpty'](_0xf0035e)||!_['isNil'](_0xf0035e[0x0]['Agent'])&&_[_0x99ac('0x75')](_0xf0035e[0x0]['Agent'][_0x99ac('0x5a')])){ut[_0x99ac('0x69')](_0x99ac('0x127'),_0xf0035e);return{'isValid':![],'message':_0x99ac('0x128')};}var _0x132422=this[_0x99ac('0x14')][_0xf0035e[0x0][_0x99ac('0x109')][_0x99ac('0x5a')]];_0x132422['message']=_0x99ac('0x129');if(_['isNil'](_0x132422)){ut[_0x99ac('0x69')](_0x99ac('0x12a'),_0x132422);return{'isValid':![],'message':_0x99ac('0x12b')};}if(!this[_0x99ac('0xa2')](_0x132422['Trunk'])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x99ac('0x12c')+_0x132422[_0x99ac('0x5a')]+_0x99ac('0x12d'));if(!this[_0x99ac('0xa2')](_0x132422['TrunkBackup'])){ut['logger'](_0x99ac('0x12e'),_0x132422['name']+_0x99ac('0x12f'));return{'isValid':![],'message':_0x99ac('0x130')};}}if(!ut['isActive'](_0x132422[_0x99ac('0x37')])){ut[_0x99ac('0x69')](_0x99ac('0x131'),_0x132422[_0x99ac('0x5a')]+_0x99ac('0x132'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x132422[_0x99ac('0x5a')]+_0x99ac('0x132')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x99ac('0x10')]['execCall']=function(_0x5a099e,_0x20b806,_0x1e96f5,_0x5ee678){var _0x481177=this;return new BPromise(function(_0x5ec891,_0x45c7d3){var _0x9fa0ed=_0x5a099e[_0x99ac('0xb7')];var _0x4972fd=_0x481177['isTrunkReachable'](_0x20b806[_0x99ac('0x59')])?util[_0x99ac('0x5d')](_0x99ac('0x133'),_0x20b806['Trunk'][_0x99ac('0x5a')],_['isNil'](_0x20b806['dialPrefix'])?'':_0x20b806[_0x99ac('0x3a')][_0x99ac('0x134')]()||'',_0x20b806['dialCutDigit']>0x0?_0x1e96f5[_0x99ac('0x107')][_0x99ac('0x135')][_0x99ac('0x136')](_0x20b806['dialCutDigit']):_0x1e96f5[_0x99ac('0x107')][_0x99ac('0x135')]):util['format'](_0x99ac('0x133'),_[_0x99ac('0x75')](_0x20b806[_0x99ac('0xa3')])?_0x20b806['Trunk']['name']:_0x20b806[_0x99ac('0xa3')][_0x99ac('0x5a')],_[_0x99ac('0x75')](_0x20b806[_0x99ac('0x3a')])?'':_0x20b806[_0x99ac('0x3a')]['trim']()||'',_0x20b806[_0x99ac('0x137')]>0x0?_0x1e96f5['Contact'][_0x99ac('0x135')][_0x99ac('0x136')](_0x20b806[_0x99ac('0x137')]):_0x1e96f5[_0x99ac('0x107')][_0x99ac('0x135')]);var _0xdd9fb9=_0x481177['isTrunkReachable'](_0x20b806[_0x99ac('0x59')])?ut[_0x99ac('0x138')](_0x20b806[_0x99ac('0x59')]['callerid'],_0x20b806[_0x99ac('0x139')],_0x20b806[_0x99ac('0x13a')]>0x0?ut[_0x99ac('0x13b')](_0x20b806['dialOriginateCallerIdNumber'],_0x20b806[_0x99ac('0x13a')]):_0x20b806[_0x99ac('0x38')]):ut[_0x99ac('0x138')](_['isNil'](_0x20b806[_0x99ac('0xa3')])?_0x20b806[_0x99ac('0x59')]['callerid']:_0x20b806[_0x99ac('0xa3')][_0x99ac('0x5b')],_0x20b806[_0x99ac('0x139')],_0x20b806['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x99ac('0x13b')](_0x20b806['dialOriginateCallerIdNumber'],_0x20b806[_0x99ac('0x13a')]):_0x20b806['dialOriginateCallerIdNumber']);if(_0xdd9fb9){_0x5a099e[_0x99ac('0x13c')]=ut[_0x99ac('0x13d')](_0xdd9fb9);_0x5a099e['originatecalleridnum']=ut[_0x99ac('0x13e')](_0xdd9fb9);}var _0x2e100e=ut[_0x99ac('0x13f')](_0x20b806,_0x1e96f5,_0x4972fd,_0xdd9fb9,_0x9fa0ed,_0x5a099e);_[_0x99ac('0x140')](_0x5a099e,ut[_0x99ac('0x141')](_0x2e100e));_0x5a099e['starttime']=moment()[_0x99ac('0x5d')](_0x99ac('0xb4'));ami[_0x99ac('0x7f')](ut[_0x99ac('0x142')](_0x5a099e,_0x20b806,_0x2e100e,_0x5a099e['activeContact'],_0x5ee678))[_0x99ac('0x8c')](function(_0x342ca1){var _0x4f7b75=_0x5a099e[_0x99ac('0x143')];if(!_[_0x99ac('0x75')](_0x4f7b75)){if(!_[_0x99ac('0x75')](_0x481177[_0x99ac('0x8b')][_0x4f7b75])){_0x481177[_0x99ac('0x8b')][_0x4f7b75][_0x99ac('0x144')]=_0x5a099e[_0x99ac('0x145')];emit(util[_0x99ac('0x5d')](_0x99ac('0x146'),_0x481177[_0x99ac('0x8b')][_0x4f7b75]['name']),_0x99ac('0x147'),{'destaccountcode':_0x481177[_0x99ac('0x8b')][_0x4f7b75][_0x99ac('0x148')],'destconnectedlinenum':_0x5a099e['calleridnum']});}}_0x20b806[_0x99ac('0x53')]+=0x1;logger[_0x99ac('0x60')]('[originated][increment]',_0x9fa0ed,_0x99ac('0xb8'),_0x20b806['name'],_0x99ac('0x77'),_0x20b806['originated']);_0x5ec891(_0x342ca1);})[_0x99ac('0x95')](function(_0x54a10a){ut[_0x99ac('0xfc')](_0x5a099e,0xe,_0x99ac('0x149'));rpcDb[_0x99ac('0xfd')](_0x5a099e,_0x99ac('0x14a'));_0x45c7d3(_0x54a10a);});});};Preview['prototype'][_0x99ac('0x21')]=function(_0x3f4674){if(this['actions'][_0x3f4674[_0x99ac('0xb3')]]){this[_0x99ac('0x17')][_0x3f4674['linkedid']][_0x99ac('0x80')]=_0x3f4674[_0x99ac('0x80')];}};Preview[_0x99ac('0x10')][_0x99ac('0x1a')]=function(_0x2c1789){var _0x4fd897=this;var _0x170bfe=this[_0x99ac('0x17')][_0x2c1789[_0x99ac('0x14b')]];if(_0x170bfe){if(_0x170bfe[_0x99ac('0x10a')]&&this[_0x99ac('0x8b')][_0x170bfe[_0x99ac('0x10a')]]){ut[_0x99ac('0x14c')](_0x170bfe,this['agents'][_0x170bfe['lookAgent']]['name'],this[_0x99ac('0x8b')][_0x170bfe[_0x99ac('0x10a')]]['id']);}var _0x2866d7=_[_0x99ac('0x14d')](_0x170bfe);_0x2866d7[_0x99ac('0x14e')]=moment()[_0x99ac('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2a6723=_0x4fd897[_0x99ac('0x14')][_0x170bfe['queue']];if(ut['isFailure'](_0x2c1789[_0x99ac('0x14f')])){if(_0x170bfe['unlockAgent']){rpcDb[_0x99ac('0x11d')](_0x170bfe['idContact']);}if(_0x170bfe[_0x99ac('0xd0')]){rpcDb[_0x99ac('0x11e')](_0x170bfe['idContact']);}ami[_0x99ac('0x29')](_0x99ac('0x150'),ut[_0x99ac('0xa7')](_0x170bfe,'rejected',this[_0x99ac('0x14')][_0x170bfe[_0x99ac('0x78')]]));this[_0x99ac('0xf8')](_0x2866d7,_0x2a6723,_0x2c1789);}else{_0x170bfe[_0x99ac('0x96')]=moment()[_0x99ac('0x5d')](_0x99ac('0xb4'));ut[_0x99ac('0xfc')](_0x2866d7,0x4,_0x99ac('0xc0'));rpcDb[_0x99ac('0xfd')](_0x2866d7,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x99ac('0x10')][_0x99ac('0x151')]=function(_0x120789){var _0x4a8035=this;var _0x1e82a9=this['actions'][_0x120789['linkedid']];var _0x16642c;if(_0x1e82a9){_0x16642c=this['campaignsPreview'][_0x1e82a9[_0x99ac('0x78')]];logger[_0x99ac('0x60')](_0x99ac('0x152'),_0x120789[_0x99ac('0xb3')],_0x99ac('0xb8'),_0x16642c['name'],_0x99ac('0x79'),_0x16642c[_0x99ac('0x2d')]);}if(this[_0x99ac('0x17')][_0x120789[_0x99ac('0xb3')]]&&_0x120789[_0x99ac('0xb3')]!==_0x120789[_0x99ac('0xb7')]){if(_0x120789[_0x99ac('0x153')]==='16'&&this[_0x99ac('0x17')][_0x120789[_0x99ac('0xb3')]]['dialAnswer']){this[_0x99ac('0xa4')](_0x120789,_0x120789['linkedid'],_0x120789[_0x99ac('0x153')]);}else if(this[_0x99ac('0x17')][_0x120789['linkedid']][_0x99ac('0x7a')]){logger[_0x99ac('0x60')](_0x99ac('0x154'),_0x120789['linkedid'],_0x120789[_0x99ac('0x153')],_0x99ac('0xb8'),_0x16642c[_0x99ac('0x5a')],_0x99ac('0x79'),_0x16642c[_0x99ac('0x2d')]);this['callProgressDetectingCustomer'](_0x120789,_0x120789[_0x99ac('0xb3')],_0x120789[_0x99ac('0x153')]);}}else if(_0x1e82a9&&_[_0x99ac('0x75')](_0x1e82a9[_0x99ac('0x155')])&&_0x16642c[_0x99ac('0x156')]&&_0x120789['linkedid']===_0x120789['uniqueid']&&_[_0x99ac('0x75')](_0x120789[_0x99ac('0xfb')])&&_0x120789[_0x99ac('0x153')]==='16'&&_0x120789[_0x99ac('0x157')]==='6'&&_['isUndefined'](_0x1e82a9['transfer'])){if(_0x1e82a9[_0x99ac('0xb2')]){rpcDb[_0x99ac('0x11d')](_0x1e82a9[_0x99ac('0x10f')]);}if(_0x1e82a9[_0x99ac('0xd0')]){rpcDb['disableContact'](_0x1e82a9[_0x99ac('0x10f')]);}_0x120789[_0x99ac('0xfb')]='22';this[_0x99ac('0xf8')](_0x1e82a9,_0x16642c,_0x120789);}else if(_0x1e82a9&&_0x1e82a9[_0x99ac('0x158')]){if(_0x120789[_0x99ac('0x153')]==='16'&&this[_0x99ac('0x17')][_0x120789[_0x99ac('0xb3')]]['dialAnswer']){logger[_0x99ac('0x60')](_0x99ac('0x159'),_0x120789[_0x99ac('0xb3')],_0x120789['cause'],_0x99ac('0xb8'),_0x16642c['name'],_0x99ac('0x79'),_0x16642c['pTalking']);this[_0x99ac('0xa4')](_0x120789,_0x120789[_0x99ac('0xb3')],_0x120789[_0x99ac('0x153')]);}else if(this[_0x99ac('0x17')][_0x120789['linkedid']]['dialAnswer']){logger[_0x99ac('0x60')]('[syncHangup][talking][cause]',_0x120789[_0x99ac('0xb3')],_0x120789['cause'],_0x99ac('0xb8'),_0x16642c[_0x99ac('0x5a')],'pTalking:\x20',_0x16642c[_0x99ac('0x2d')]);this[_0x99ac('0xa4')](_0x120789,_0x120789[_0x99ac('0xb3')],_0x120789[_0x99ac('0x153')]);}}};Preview[_0x99ac('0x10')][_0x99ac('0x1f')]=function(_0x1e2354){if(this[_0x99ac('0x17')][_0x1e2354[_0x99ac('0xf7')]]&&_0x1e2354[_0x99ac('0xf7')]!==_0x1e2354[_0x99ac('0x15a')]){this[_0x99ac('0xa4')](_0x1e2354,_0x1e2354[_0x99ac('0xf7')],_0x1e2354['dialstatus']);}};Preview['prototype'][_0x99ac('0x1d')]=function(_0x1fa2cd){if(this[_0x99ac('0x17')][_0x1fa2cd['linkedid']]&&_0x1fa2cd[_0x99ac('0xb3')]!==_0x1fa2cd['uniqueid']&&!this[_0x99ac('0x17')][_0x1fa2cd[_0x99ac('0xb3')]][_0x99ac('0x7a')]){if(_0x1fa2cd['cause']==='1'){this[_0x99ac('0xa4')](_0x1fa2cd,_0x1fa2cd[_0x99ac('0xb3')],_0x1fa2cd[_0x99ac('0x153')]);}}};Preview['prototype'][_0x99ac('0x15b')]=function(_0x555595,_0x131200,_0x3ee48d){if(this[_0x99ac('0x17')][_0x555595]){if(_['isNil'](this[_0x99ac('0x17')][_0x555595][_0x99ac('0x15c')])){this['actions'][_0x555595]['variables']={};}this['actions'][_0x555595][_0x99ac('0x15c')][_0x131200]=_0x3ee48d;}};Preview[_0x99ac('0x10')][_0x99ac('0x23')]=function(_0x279e00){try{if(!_[_0x99ac('0x75')](_0x279e00)){if(ut[_0x99ac('0x15d')](_[_0x99ac('0x15e')](_0x279e00[_0x99ac('0x15f')])[0x0])){this[_0x99ac('0x15b')](_0x279e00[_0x99ac('0xb7')],_[_0x99ac('0x15e')](_0x279e00[_0x99ac('0x15f')])[0x0],_0x279e00[_0x99ac('0x160')]);}}}catch(_0x55d9c5){logger[_0x99ac('0x161')](_0x99ac('0x162'),util['inspect'](_0x55d9c5,{'showHidden':![],'depth':null}));}};Preview[_0x99ac('0x10')][_0x99ac('0x25')]=function(_0x5d634f){if(_0x5d634f){if(this[_0x99ac('0x17')][_0x5d634f['transfertargetlinkedid']]){this[_0x99ac('0x17')][_0x5d634f['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0x99ac('0x10')]['syncBlindTransfer']=function(_0x15b99e){if(_0x15b99e){if(this[_0x99ac('0x17')][_0x15b99e[_0x99ac('0x163')]]){this[_0x99ac('0x17')][_0x15b99e[_0x99ac('0x163')]][_0x99ac('0x158')]=!![];}}};module[_0x99ac('0x164')]=Preview; \ No newline at end of file +var _0x7c6f=['totalGlobal','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','linkedid','outboundBusyCallsDay','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','countcongestionretry','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','createAgentHistory','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','called','Calling','[Preview][execCall][failure]','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','isTrunkReachable','trunks','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','Agent','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','substring','dialCutDigit','trim','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','Action','variablesAction','channelAgent','destconnectedlinenum','user:agentconnect','accountcode','calleridnum','[originated][increment]','OriginateError','actionid','logLookAgent','lookAgent','isFailure','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','addVariable','variables','filterKey','keys','variable','[syncVarSet][Preview]','inspect','syncAttendedTransfer','syncBlindTransfer','transfererlinkedid','util','uuid','md5','../../../config/logger','actionPreview','../ami','./action','redis','defaults','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncDialEnd','newexten','syncNewExten','syncVarSet','attendedtransfer','blindtransfer','loopCampaigns','emit','outbound','name','answered','available','pTalking','sumDuration','talking','total','type','abandoned','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','originated','sendMessageOneNotActive','paused','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','hasOwnProperty','preview','booked','clearZombieChannels','dialMethod','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','createCustomerFinal','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0x7c6f,0x1f2));var _0xf7c6=function(_0x4192b2,_0x2595a4){_0x4192b2=_0x4192b2-0x0;var _0x5387e9=_0x7c6f[_0x4192b2];return _0x5387e9;};'use strict';var util=require(_0xf7c6('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0xf7c6('0x1'));var moment=require('moment');var md5=require(_0xf7c6('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xf7c6('0x3'))('preview');var loggerAction=require(_0xf7c6('0x3'))(_0xf7c6('0x4'));var ami=require(_0xf7c6('0x5'));var rpcDb=require('./rpcDb');var Action=require(_0xf7c6('0x6'));var ut=require('./util/util');config[_0xf7c6('0x7')]=_[_0xf7c6('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf7c6('0x9'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xf7c6('0xa')][_0xf7c6('0xb')]=function(_0x121c58){this[_0xf7c6('0xc')]=this[_0xf7c6('0xc')]?this['tail'][_0xf7c6('0xd')](_0x121c58):_0x121c58();};function Preview(_0x1e3538){this[_0xf7c6('0xe')]=new Sequence();this[_0xf7c6('0xf')]=_0x1e3538['voiceQueues'];this['trunks']=_0x1e3538['trunks'];this[_0xf7c6('0x10')]={};this['agents']=_0x1e3538[_0xf7c6('0x11')];this[_0xf7c6('0x12')]=0x0;ami['on'](_0xf7c6('0x13'),this[_0xf7c6('0x14')][_0xf7c6('0x15')](this));ami['on'](_0xf7c6('0x16'),this[_0xf7c6('0x17')][_0xf7c6('0x15')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xf7c6('0x15')](this));ami['on']('dialend',this[_0xf7c6('0x18')][_0xf7c6('0x15')](this));ami['on'](_0xf7c6('0x19'),this[_0xf7c6('0x1a')][_0xf7c6('0x15')](this));ami['on']('varset',this[_0xf7c6('0x1b')]['bind'](this));ami['on'](_0xf7c6('0x1c'),this['syncAttendedTransfer'][_0xf7c6('0x15')](this));ami['on'](_0xf7c6('0x1d'),this['syncBlindTransfer'][_0xf7c6('0x15')](this));this[_0xf7c6('0x1e')](this[_0xf7c6('0xf')]);}function emit(_0x1cda22,_0x161ee7,_0x18a69d){io['to'](_0x1cda22)[_0xf7c6('0x1f')](_0x161ee7,_0x18a69d);}function emitCampaignPreview(_0x2fd04a){if(_0x2fd04a['type']===_0xf7c6('0x20')){var _0x4cd4f4={'id':_0x2fd04a['id'],'name':_0x2fd04a[_0xf7c6('0x21')],'strategy':_0x2fd04a['strategy'],'answered':_0x2fd04a[_0xf7c6('0x22')],'available':_0x2fd04a[_0xf7c6('0x23')],'loggedIn':_0x2fd04a['loggedIn'],'pTalking':_0x2fd04a[_0xf7c6('0x24')],'sumBillable':_0x2fd04a['sumBillable'],'sumDuration':_0x2fd04a[_0xf7c6('0x25')],'sumHoldTime':_0x2fd04a['sumHoldTime']||0x0,'talking':_0x2fd04a[_0xf7c6('0x26')],'total':_0x2fd04a[_0xf7c6('0x27')],'type':_0x2fd04a[_0xf7c6('0x28')],'unmanaged':_0x2fd04a['unmanaged'],'abandoned':_0x2fd04a[_0xf7c6('0x29')],'waiting':_0x2fd04a['waiting'],'loggedInDb':_0x2fd04a['loggedInDb'],'dialActive':_0x2fd04a[_0xf7c6('0x2a')],'dialMethod':_0x2fd04a['dialMethod'],'dialOriginateCallerIdName':_0x2fd04a['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x2fd04a[_0xf7c6('0x2b')],'dialOriginateTimeout':_0x2fd04a[_0xf7c6('0x2c')],'dialPrefix':_0x2fd04a[_0xf7c6('0x2d')],'outboundAnswerAgiCallsDay':_0x2fd04a[_0xf7c6('0x2e')],'outboundAnswerCallsDay':_0x2fd04a[_0xf7c6('0x2f')],'outboundBlacklistCallsDay':_0x2fd04a[_0xf7c6('0x30')],'outboundBusyCallsDay':_0x2fd04a['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x2fd04a[_0xf7c6('0x31')],'outboundDropCallsDayACS':_0x2fd04a[_0xf7c6('0x32')],'outboundDropCallsDayCallersExit':_0x2fd04a[_0xf7c6('0x33')],'outboundDropCallsDayTimeout':_0x2fd04a['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x2fd04a[_0xf7c6('0x34')],'outboundNoSuchCallsDay':_0x2fd04a[_0xf7c6('0x35')],'outboundOriginateFailureCallsDay':_0x2fd04a[_0xf7c6('0x36')],'outboundReCallsDay':_0x2fd04a[_0xf7c6('0x37')],'outboundRejectCallsDay':_0x2fd04a['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x2fd04a[_0xf7c6('0x38')],'outboundAbandonedCallsDay':_0x2fd04a[_0xf7c6('0x39')],'predictiveIntervalAnsweredCalls':_0x2fd04a['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x2fd04a[_0xf7c6('0x3a')],'predictiveIntervalAvgTalktime':_0x2fd04a[_0xf7c6('0x3b')],'predictiveIntervalDroppedCallsCallersExit':_0x2fd04a[_0xf7c6('0x3c')],'predictiveIntervalDroppedCallsTimeout':_0x2fd04a[_0xf7c6('0x3d')],'predictiveIntervalErlangCalls':_0x2fd04a[_0xf7c6('0x3e')],'predictiveIntervalErlangCallsDroppedCalls':_0x2fd04a[_0xf7c6('0x3f')],'predictiveIntervalHitRate':_0x2fd04a[_0xf7c6('0x40')],'predictiveIntervalMultiplicativeFactor':_0x2fd04a[_0xf7c6('0x41')],'predictiveIntervalPauses':_0x2fd04a[_0xf7c6('0x42')],'predictiveIntervalAvailable':_0x2fd04a[_0xf7c6('0x43')],'predictiveIntervalTotalCalls':_0x2fd04a[_0xf7c6('0x44')],'message':_0x2fd04a[_0xf7c6('0x45')],'originated':_0x2fd04a['originated'],'erlangCalls':_0x2fd04a[_0xf7c6('0x46')],'erlangCallToSecond':_0x2fd04a[_0xf7c6('0x47')],'erlangAbandonmentRate':_0x2fd04a[_0xf7c6('0x48')],'erlangBusyFactor':_0x2fd04a['erlangBusyFactor'],'startPredictive':_0x2fd04a[_0xf7c6('0x49')],'startProgressive':_0x2fd04a[_0xf7c6('0x4a')]};if(_0x2fd04a[_0xf7c6('0x4b')]){_0x4cd4f4[_0xf7c6('0x4b')]={'id':_0x2fd04a[_0xf7c6('0x4b')]['id'],'name':_0x2fd04a[_0xf7c6('0x4b')]['name'],'active':_0x2fd04a[_0xf7c6('0x4b')][_0xf7c6('0x4c')],'callerid':_0x2fd04a[_0xf7c6('0x4b')][_0xf7c6('0x4d')]};}if(_0x2fd04a['Interval']){_0x4cd4f4[_0xf7c6('0x4e')]={'id':_0x2fd04a[_0xf7c6('0x4e')]['id'],'name':_0x2fd04a[_0xf7c6('0x4e')][_0xf7c6('0x21')]};}var _0x2b98b2=md5(JSON[_0xf7c6('0x4f')](_0x4cd4f4));if(_0x2fd04a['md5']!==_0x2b98b2){_0x2fd04a[_0xf7c6('0x2')]=_0x2b98b2;emit(util[_0xf7c6('0x50')](_0xf7c6('0x51'),_0x4cd4f4['name']),_0xf7c6('0x52'),_0x4cd4f4);}}}function emitVoiceQueueChannelRemove(_0x3e4da3){logger[_0xf7c6('0x53')](_0xf7c6('0x54'),JSON[_0xf7c6('0x4f')](_0x3e4da3));emit(util['format'](_0xf7c6('0x51'),_0x3e4da3['name']),_0xf7c6('0x55'),_0x3e4da3);io[_0xf7c6('0x1f')](_0xf7c6('0x56'),_0x3e4da3);}function notSendMessagesQueue(_0x11be6f){if(_0x11be6f['sendMessageOneNotActive']){if(_0x11be6f[_0xf7c6('0x57')]===0x0&&_0x11be6f[_0xf7c6('0x24')]===0x0){_0x11be6f[_0xf7c6('0x58')]=![];_0x11be6f['available']=0x0;_0x11be6f[_0xf7c6('0x59')]=0x0;_0x11be6f['message']='NOT_ACTIVE';ut[_0xf7c6('0x5a')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x11be6f[_0xf7c6('0x21')]+_0xf7c6('0x5b'));}else{_0x11be6f['message']=_0xf7c6('0x5c');ut[_0xf7c6('0x5a')](_0xf7c6('0x5d'),_0x11be6f[_0xf7c6('0x21')]+_0xf7c6('0x5e'));}emitCampaignPreview(_0x11be6f);}}Preview[_0xf7c6('0xa')][_0xf7c6('0x1e')]=function(){var _0x4edb4f=this;setInterval(function(){_0x4edb4f[_0xf7c6('0x5f')]();},0x7cf);};Preview[_0xf7c6('0xa')][_0xf7c6('0x5f')]=function(){var _0x523af9=this['campaignsPreview'];this[_0xf7c6('0x12')]+=0x1;for(var _0x3c7542 in _0x523af9){if(_0x523af9[_0xf7c6('0x60')](_0x3c7542)&&(_0x523af9[_0x3c7542]['dialMethod']===_0xf7c6('0x61')||_0x523af9[_0x3c7542]['dialMethod']===_0xf7c6('0x62'))&&_0x523af9[_0x3c7542][_0xf7c6('0x28')]===_0xf7c6('0x20')){if(this[_0xf7c6('0x12')]>0x7){this[_0xf7c6('0x12')]=0x0;this[_0xf7c6('0x63')]();}}if(_0x523af9[_0xf7c6('0x60')](_0x3c7542)&&_0x523af9[_0x3c7542][_0xf7c6('0x64')]===_0xf7c6('0x61')&&_0x523af9[_0x3c7542]['type']==='outbound'){if(_0x523af9[_0x3c7542][_0xf7c6('0x2a')]){this[_0xf7c6('0x65')](_0x523af9[_0x3c7542]);this[_0xf7c6('0x66')](_0x523af9[_0x3c7542]);}else{notSendMessagesQueue(_0x523af9[_0x3c7542]);}}}};Preview[_0xf7c6('0xa')][_0xf7c6('0x67')]=function(_0x379746){var _0x13a43c=this;this[_0xf7c6('0xe')]['enqueue'](function(){if(!_[_0xf7c6('0x68')](_0x13a43c[_0xf7c6('0x10')][_0x379746])){loggerAction[_0xf7c6('0x53')](_0xf7c6('0x69'),_0x379746,_0xf7c6('0x6a'),_0x13a43c[_0xf7c6('0x10')][_0x379746][_0xf7c6('0x6b')],_0xf7c6('0x6c'),JSON['stringify'](_0x13a43c[_0xf7c6('0xf')][_0x13a43c[_0xf7c6('0x10')][_0x379746][_0xf7c6('0x6b')]][_0xf7c6('0x57')]),_0xf7c6('0x6d'),JSON['stringify'](_0x13a43c[_0xf7c6('0xf')][_0x13a43c['actions'][_0x379746][_0xf7c6('0x6b')]][_0xf7c6('0x24')]),JSON['stringify'](_0x13a43c[_0xf7c6('0x10')][_0x379746][_0xf7c6('0x6e')]),JSON['stringify'](_[_0xf7c6('0x6f')](_0x13a43c[_0xf7c6('0x10')][_0x379746],[_0xf7c6('0x70'),'UserId',_0xf7c6('0x71'),_0xf7c6('0x72')])));return ami['Action']({'action':_0xf7c6('0x73'),'channel':_0x13a43c[_0xf7c6('0x10')][_0x379746][_0xf7c6('0x74')]})[_0xf7c6('0x75')](function(_0x2dc9b2){if(_0x2dc9b2[_0xf7c6('0x45')]===_0xf7c6('0x76')){setTimeout(function(){if(_0x13a43c[_0xf7c6('0x10')][_0x379746]){ut[_0xf7c6('0x77')](_0x13a43c['campaignsPreview'][_0x13a43c['actions'][_0x379746][_0xf7c6('0x6b')]],_0xf7c6('0x78'));if(_0x13a43c[_0xf7c6('0x10')][_0x379746][_0xf7c6('0x6e')]===!![]){ut[_0xf7c6('0x79')](_0x13a43c['campaignsPreview'][_0x13a43c[_0xf7c6('0x10')][_0x379746][_0xf7c6('0x6b')]],_0xf7c6('0x78'));ut[_0xf7c6('0x7a')](_0xf7c6('0x7b')+_0x379746,_0x13a43c['actions'][_0x379746][_0xf7c6('0x6b')]);}ut[_0xf7c6('0x7a')](_0xf7c6('0x7c')+_0x379746,_0x13a43c[_0xf7c6('0x10')][_0x379746][_0xf7c6('0x6b')]);delete _0x13a43c[_0xf7c6('0x10')][_0x379746];}},0x2328);}});}});};Preview[_0xf7c6('0xa')][_0xf7c6('0x63')]=function(){var _0x3cfd65=this;loggerAction[_0xf7c6('0x53')](_0xf7c6('0x7d'),_[_0xf7c6('0x7e')](this[_0xf7c6('0x10')]));for(var _0x32c5be in this[_0xf7c6('0x10')]){if(_0x3cfd65['actions']['hasOwnProperty'](_0x32c5be)){_0x3cfd65['clearZombieChannel'](_0x32c5be);}}};Preview[_0xf7c6('0xa')][_0xf7c6('0x66')]=function(_0x5a17fd){var _0x2615d2=this;rpcDb[_0xf7c6('0x7f')](_0x5a17fd['id'],ut[_0xf7c6('0x80')](this[_0xf7c6('0x11')]))[_0xf7c6('0x81')](function(_0x24f2ff){if(!_[_0xf7c6('0x68')](_0x24f2ff)){for(var _0x2f5fa7=0x0;_0x2f5fa7<_0x24f2ff['length'];_0x2f5fa7+=0x1){if(ut[_0xf7c6('0x82')](_0x24f2ff[_0x2f5fa7][_0xf7c6('0x83')])<_0x5a17fd[_0xf7c6('0x84')]*0x3c){if(_0x24f2ff[_0x2f5fa7]['Agent']&&!_0x24f2ff[_0x2f5fa7]['Agent'][_0xf7c6('0x85')]){_0x2615d2['run'](_0x24f2ff[_0x2f5fa7]['id'])[_0xf7c6('0x81')](ut[_0xf7c6('0x86')](_0xf7c6('0x87')))[_0xf7c6('0x75')](ut[_0xf7c6('0x86')](_0xf7c6('0x87')));}else{rpcDb[_0xf7c6('0x88')](_0x24f2ff[_0x2f5fa7]['id']);}}else{var _0x4e3034=new Action(_0x24f2ff[_0x2f5fa7],_0x5a17fd);_0x4e3034[_0xf7c6('0x89')]=moment()['format'](_0xf7c6('0x8a'));_0x5a17fd[_0xf7c6('0x37')]+=0x1;ut[_0xf7c6('0x8b')](_0x4e3034,0x17,_0xf7c6('0x8c'));if(_0x5a17fd[_0xf7c6('0x8d')]){rpcDb[_0xf7c6('0x8e')](ut['createBody'](_0x24f2ff[_0x2f5fa7]));rpcDb['createCustomerHistory'](_0x4e3034,_0xf7c6('0x8f'));}else{ut[_0xf7c6('0x8b')](_0x4e3034,0x16,_0xf7c6('0x90'));rpcDb[_0xf7c6('0x91')](_0x4e3034,'[HistoryRecallClose]');rpcDb[_0xf7c6('0x92')](_0x4e3034,'[HistoryRecallClose]');}}}}})['catch'](ut[_0xf7c6('0x86')]('[getContactRecallMe]'));};Preview[_0xf7c6('0xa')][_0xf7c6('0x65')]=function(_0x549000){_0x549000[_0xf7c6('0x58')]=!![];if(ut[_0xf7c6('0x93')](_0x549000[_0xf7c6('0x94')])){_0x549000[_0xf7c6('0x45')]=_0xf7c6('0x95');}else if(!ut[_0xf7c6('0x96')](_0x549000['dialActive'])){_0x549000[_0xf7c6('0x45')]='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x549000[_0xf7c6('0x4b')])){if(!this['isTrunkReachable'](_0x549000[_0xf7c6('0x97')])){_0x549000['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x549000['message']=_0xf7c6('0x98');}}else{_0x549000[_0xf7c6('0x45')]=_0xf7c6('0x98');}emitCampaignPreview(_0x549000);};Preview[_0xf7c6('0xa')]['callProgressDetectingCustomer']=function(_0x2aa53e,_0x46d208,_0x225108){var _0x53d258=this;var _0x47b362=this[_0xf7c6('0x10')][_0x46d208];var _0x3ba111=this[_0xf7c6('0xf')][_0x47b362[_0xf7c6('0x6b')]];var _0x4aace1;if(_0x3ba111){switch(_0x225108){case'1':_0x3ba111[_0xf7c6('0x35')]+=0x1;_0x47b362[_0xf7c6('0x99')]+=0x1;_0x47b362[_0xf7c6('0x9a')]=ut['totalGlobal'](_0x47b362);ut[_0xf7c6('0x8b')](_0x47b362,0x0,_0xf7c6('0x9b'));ami['emit'](_0xf7c6('0x9c'),ut[_0xf7c6('0x9d')](_0x47b362,_0xf7c6('0x9e')));rpcDb[_0xf7c6('0x91')](_0x47b362,_0xf7c6('0x9f'));if(ut['totalGlobal'](_0x47b362)>=_0x3ba111[_0xf7c6('0xa0')]){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0xf,_0xf7c6('0xa2'));rpcDb[_0xf7c6('0x92')](_0x4aace1,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x47b362[_0xf7c6('0x99')]>=_0x3ba111[_0xf7c6('0xa3')]){rpcDb['createCustomerFinal'](_0x47b362,_0xf7c6('0xa4'));}else{rpcDb[_0xf7c6('0xa5')](ut[_0xf7c6('0xa6')](_0x47b362,_0xf7c6('0x99'),_0x3ba111[_0xf7c6('0xa7')]),_0x47b362['unlockAgent'],_0x47b362['activeContact']);}}delete this['actions'][_0x2aa53e['linkedid']];break;case'ANSWER':var _0x36201a=moment()[_0xf7c6('0x50')](_0xf7c6('0x8a'));_0x47b362[_0xf7c6('0xa8')]=_0x36201a;_0x47b362[_0xf7c6('0xa9')]=_0x36201a;_0x47b362[_0xf7c6('0x6e')]=!![];_0x3ba111[_0xf7c6('0x24')]+=0x1;logger[_0xf7c6('0x53')](_0xf7c6('0xaa'),_0x47b362[_0xf7c6('0xab')],'\x20Queue',_0x3ba111[_0xf7c6('0x21')],'pTalking:\x20',_0x3ba111['pTalking']);ami['emit'](_0xf7c6('0xac'),ut['buildObj'](_0x47b362,_0xf7c6('0xad'),this[_0xf7c6('0xf')][_0x47b362['queue']]));if(_0x3ba111[_0xf7c6('0xae')]){ami['emit'](_0xf7c6('0xaf'),ut['buildAcw'](_0x47b362));}break;case'16':ami[_0xf7c6('0x1f')](_0xf7c6('0xb0'),ut[_0xf7c6('0x9d')](_0x47b362,_0xf7c6('0xb1'),this[_0xf7c6('0xf')][_0x47b362[_0xf7c6('0x6b')]]));emitVoiceQueueChannelRemove(ut[_0xf7c6('0x9d')](_0x47b362,_0xf7c6('0xb1')));_0x3ba111[_0xf7c6('0x2f')]+=0x1;_0x3ba111['total']+=0x1;_0x3ba111['answered']+=0x1;ut[_0xf7c6('0x79')](_0x3ba111,'[16]');_0x47b362[_0xf7c6('0x9a')]=ut[_0xf7c6('0xb2')](_0x47b362);ut['logCustomer'](_0x47b362,0x4,'Answer');rpcDb['createCustomerHistory'](_0x47b362,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xf7c6('0x92')](_0x47b362,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x47b362);_0x3ba111[_0xf7c6('0x25')]+=_0x47b362[_0xf7c6('0xb3')];_0x3ba111[_0xf7c6('0xb4')]+=_0x47b362[_0xf7c6('0xb3')];logger['info'](_0xf7c6('0xb5'),_0x47b362[_0xf7c6('0xab')],_0xf7c6('0xb6'),_0x3ba111['name'],'pTalking:\x20',_0x3ba111['pTalking']);delete this[_0xf7c6('0x10')][_0x2aa53e[_0xf7c6('0xb7')]];break;case'BUSY':_0x3ba111[_0xf7c6('0xb8')]+=0x1;_0x47b362['countbusyretry']+=0x1;_0x47b362[_0xf7c6('0x9a')]=ut[_0xf7c6('0xb2')](_0x47b362);ut[_0xf7c6('0x8b')](_0x47b362,0x5,_0xf7c6('0xb9'));ami['emit'](_0xf7c6('0xba'),ut['buildObj'](_0x47b362,'busy'));rpcDb[_0xf7c6('0x91')](_0x47b362,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xf7c6('0xb2')](_0x47b362)>=_0x3ba111[_0xf7c6('0xa0')]){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0xf,_0xf7c6('0xa2'));rpcDb[_0xf7c6('0x92')](_0x4aace1,_0xf7c6('0xbb'));}else{if(_0x47b362[_0xf7c6('0xbc')]>=_0x3ba111[_0xf7c6('0xbd')]){rpcDb['createCustomerFinal'](_0x47b362,_0xf7c6('0xbe'));}else{rpcDb[_0xf7c6('0xa5')](ut[_0xf7c6('0xa6')](_0x47b362,_0xf7c6('0xbc'),_0x3ba111[_0xf7c6('0xbf')]),_0x47b362[_0xf7c6('0xc0')],_0x47b362[_0xf7c6('0xc1')]);}}break;case _0xf7c6('0xc2'):_0x3ba111[_0xf7c6('0x34')]+=0x1;_0x47b362['countnoanswerretry']+=0x1;_0x47b362[_0xf7c6('0x9a')]=ut[_0xf7c6('0xb2')](_0x47b362);ut[_0xf7c6('0x8b')](_0x47b362,0x3,'NoAnswer');ami[_0xf7c6('0x1f')](_0xf7c6('0xc3'),ut[_0xf7c6('0x9d')](_0x47b362,_0xf7c6('0xc4')));rpcDb['createCustomerHistory'](_0x47b362,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x47b362)>=_0x3ba111[_0xf7c6('0xa0')]){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0xf,_0xf7c6('0xa2'));rpcDb['createCustomerFinal'](_0x4aace1,_0xf7c6('0xc5'));}else{if(_0x47b362[_0xf7c6('0xc6')]>=_0x3ba111[_0xf7c6('0xc7')]){rpcDb[_0xf7c6('0x92')](_0x47b362,_0xf7c6('0xc8'));}else{rpcDb[_0xf7c6('0xa5')](ut['scheduledAt'](_0x47b362,_0xf7c6('0xc6'),_0x3ba111[_0xf7c6('0xc9')]),_0x47b362[_0xf7c6('0xc0')],_0x47b362[_0xf7c6('0xc1')]);}}break;case _0xf7c6('0xca'):_0x3ba111[_0xf7c6('0x31')]+=0x1;_0x47b362['countcongestionretry']+=0x1;_0x47b362[_0xf7c6('0x9a')]=ut['totalGlobal'](_0x47b362);ut[_0xf7c6('0x8b')](_0x47b362,0x8,_0xf7c6('0xcb'));ami['emit'](_0xf7c6('0xcc'),ut[_0xf7c6('0x9d')](_0x47b362,_0xf7c6('0xcd')));rpcDb['createCustomerHistory'](_0x47b362,_0xf7c6('0xce'));if(ut[_0xf7c6('0xb2')](_0x47b362)>=_0x3ba111[_0xf7c6('0xa0')]){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0xf,_0xf7c6('0xa2'));rpcDb[_0xf7c6('0x92')](_0x4aace1,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x47b362[_0xf7c6('0xcf')]>=_0x3ba111[_0xf7c6('0xd0')]){rpcDb['createCustomerFinal'](_0x47b362,_0xf7c6('0xce'));}else{rpcDb[_0xf7c6('0xa5')](ut['scheduledAt'](_0x47b362,_0xf7c6('0xcf'),_0x3ba111[_0xf7c6('0xbf')]),_0x47b362['unlockAgent'],_0x47b362[_0xf7c6('0xc1')]);}}break;case _0xf7c6('0xd1'):_0x3ba111['outboundRejectCallsDay']+=0x1;_0x47b362[_0xf7c6('0xd2')]+=0x1;_0x47b362['countglobal']=ut['totalGlobal'](_0x47b362);ut[_0xf7c6('0x8b')](_0x47b362,0x14,_0xf7c6('0xd3'));ami[_0xf7c6('0x1f')](_0xf7c6('0xd4'),ut[_0xf7c6('0x9d')](_0x47b362,_0xf7c6('0xd5')));rpcDb[_0xf7c6('0x91')](_0x47b362,_0xf7c6('0xd6'));if(ut['totalGlobal'](_0x47b362)>=_0x3ba111[_0xf7c6('0xa0')]){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0x14,_0xf7c6('0xd3'));rpcDb[_0xf7c6('0x92')](_0x4aace1,_0xf7c6('0xd7'));}else{if(_0x47b362[_0xf7c6('0xd2')]>=_0x3ba111[_0xf7c6('0xd8')]){rpcDb['createCustomerFinal'](_0x47b362,_0xf7c6('0xd7'));}else{rpcDb[_0xf7c6('0xa5')](ut[_0xf7c6('0xa6')](_0x47b362,_0xf7c6('0xd2'),_0x3ba111['dialAgentRejectRetryFrequency']),_0x47b362[_0xf7c6('0xc0')],_0x47b362[_0xf7c6('0xc1')]);}}break;case _0xf7c6('0xd9'):_0x3ba111['outboundAbandonedCallsDay']+=0x1;_0x47b362[_0xf7c6('0xda')]+=0x1;_0x47b362['countglobal']=ut[_0xf7c6('0xb2')](_0x47b362);ut['logCustomer'](_0x47b362,0xb,_0xf7c6('0xdb'));rpcDb[_0xf7c6('0x91')](_0x47b362,_0xf7c6('0xdc'));if(ut[_0xf7c6('0xb2')](_0x47b362)>=_0x3ba111['dialGlobalMaxRetry']){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0xf,'Global');rpcDb[_0xf7c6('0x92')](_0x4aace1,_0xf7c6('0xdc'));}else{if(_0x47b362['countabandonedetry']>=_0x3ba111[_0xf7c6('0xdd')]){rpcDb[_0xf7c6('0x92')](_0x47b362,_0xf7c6('0xdc'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x47b362,_0xf7c6('0xda'),_0x3ba111['dialAbandonedRetryFrequency']),_0x47b362[_0xf7c6('0xc0')],_0x47b362[_0xf7c6('0xc1')]);}}break;case'18':_0x3ba111['outboundUnknownCallsDay']+=0x1;_0x47b362[_0xf7c6('0xde')]+=0x1;_0x47b362['countglobal']=ut[_0xf7c6('0xb2')](_0x47b362);ut[_0xf7c6('0x8b')](_0x47b362,0x12,_0x2aa53e['cause-txt']||_0x2aa53e[_0xf7c6('0xdf')]);ami['emit'](_0xf7c6('0xe0'),ut[_0xf7c6('0x9d')](_0x47b362,_0xf7c6('0xe1')));rpcDb[_0xf7c6('0x91')](_0x47b362,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0xf7c6('0xb2')](_0x47b362)>=_0x3ba111[_0xf7c6('0xa0')]){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0xf,'Global');rpcDb[_0xf7c6('0x92')](_0x4aace1,_0xf7c6('0xe2'));}else{rpcDb[_0xf7c6('0x92')](_0x47b362,_0xf7c6('0xe2'));}delete this['actions'][_0x2aa53e['linkedid']];break;case'19':_0x3ba111[_0xf7c6('0x38')]+=0x1;_0x47b362[_0xf7c6('0x9a')]=ut['totalGlobal'](_0x47b362);ut[_0xf7c6('0x8b')](_0x47b362,0x13,_0x2aa53e[_0xf7c6('0xe3')]||_0x2aa53e[_0xf7c6('0xdf')]);ami[_0xf7c6('0x1f')]('custom:amd',ut[_0xf7c6('0x9d')](_0x47b362,_0xf7c6('0xe1')));rpcDb[_0xf7c6('0x91')](_0x47b362,'[callProgressDetectingCustomer][machine]');if(ut['totalGlobal'](_0x47b362)>=_0x3ba111[_0xf7c6('0xa0')]){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0xf,_0xf7c6('0xa2'));rpcDb['createCustomerFinal'](_0x4aace1,_0xf7c6('0xe4'));}else{rpcDb[_0xf7c6('0x92')](_0x47b362,_0xf7c6('0xe4'));}delete this[_0xf7c6('0x10')][_0x2aa53e[_0xf7c6('0xb7')]];break;default:if(_0x47b362[_0xf7c6('0x6e')]){ut[_0xf7c6('0x79')](_0x3ba111,_0xf7c6('0xe5'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x3ba111[_0xf7c6('0x21')],_0x2aa53e);}_0x3ba111[_0xf7c6('0x38')]+=0x1;_0x47b362[_0xf7c6('0x9a')]=ut[_0xf7c6('0xb2')](_0x47b362);ut['logCustomer'](_0x47b362,0xc,_0x2aa53e[_0xf7c6('0xe3')]||_0x2aa53e['dialstatus']);rpcDb[_0xf7c6('0x91')](_0x47b362,_0xf7c6('0xe6'));if(ut['totalGlobal'](_0x47b362)>=_0x3ba111[_0xf7c6('0xa0')]){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0xf,'Global');rpcDb[_0xf7c6('0x92')](_0x4aace1,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xf7c6('0x92')](_0x47b362,_0xf7c6('0xe7'));}delete this[_0xf7c6('0x10')][_0x2aa53e[_0xf7c6('0xb7')]];}if(!(_0x47b362[_0xf7c6('0x6e')]&&_0x225108==='16')){ut[_0xf7c6('0x77')](_0x3ba111,'[callProgressDetectingCustomer]');logger[_0xf7c6('0x53')](_0xf7c6('0xe8'),_0x47b362['uniqueid'],'\x20Queue',_0x3ba111[_0xf7c6('0x21')],_0xf7c6('0x6c'),_0x3ba111[_0xf7c6('0x57')]);}if(_0x225108!==_0xf7c6('0xe9')){delete this['actions'][_0x2aa53e['linkedid']];delete this[_0xf7c6('0x10')][_0x2aa53e[_0xf7c6('0xea')]];}}};Preview['prototype'][_0xf7c6('0xeb')]=function(_0x4b05d5,_0x7fcd28,_0x562394){if(_[_0xf7c6('0xec')](_0x7fcd28)&&'object'!==typeof _0x7fcd28){return;}if(_[_0xf7c6('0xec')](_0x562394)&&'object'!==typeof _0x562394){return;}switch(_0x562394['reason']){case'0':ut[_0xf7c6('0xed')](_0x4b05d5,0x0,_0xf7c6('0x9b'));rpcDb['createAgentHistory'](_0x4b05d5,_0xf7c6('0xee'));break;case'3':ut[_0xf7c6('0xed')](_0x4b05d5,0x3,_0xf7c6('0xef'));rpcDb['createAgentHistory'](_0x4b05d5,_0xf7c6('0xf0'));break;case'5':ut[_0xf7c6('0xed')](_0x4b05d5,0x5,'Busy');rpcDb['createAgentHistory'](_0x4b05d5,_0xf7c6('0xf1'));break;case'8':ut['logAgent'](_0x4b05d5,0x8,'Congestion');rpcDb[_0xf7c6('0xf2')](_0x4b05d5,_0xf7c6('0xf3'));break;case'22':ut[_0xf7c6('0xed')](_0x4b05d5,0x16,_0xf7c6('0xf4'));rpcDb[_0xf7c6('0xf2')](_0x4b05d5,_0xf7c6('0xf5'));break;default:ut['logAgent'](_0x4b05d5,0xc,_0x562394[_0xf7c6('0xf6')]);rpcDb[_0xf7c6('0xf2')](_0x4b05d5,_0xf7c6('0xf3'));}ut[_0xf7c6('0x77')](_0x7fcd28,'[callProgressDetectingAgent]');logger['info'](_0xf7c6('0xf7'),_0x4b05d5[_0xf7c6('0xab')],_0xf7c6('0xb6'),_0x7fcd28[_0xf7c6('0x21')],'originated:\x20',_0x7fcd28[_0xf7c6('0x57')]);delete this[_0xf7c6('0x10')][_0x4b05d5[_0xf7c6('0xab')]];};Preview[_0xf7c6('0xa')][_0xf7c6('0xf8')]=function(_0x43c042,_0x2ca750,_0x129855,_0x168f62,_0x5d8f0c){var _0x2d3be1=this;return new BPromise(function(_0x7f10fd,_0x198c8c){if(_['isNil'](_0x2ca750)||_[_0xf7c6('0x68')](_0x2ca750[_0xf7c6('0xf9')])||_['isNil'](_0x2ca750[_0xf7c6('0xf9')][_0xf7c6('0xfa')])||_[_0xf7c6('0x68')](_0x2ca750[_0xf7c6('0x71')])){_0x198c8c(ut[_0xf7c6('0x45')](_0xf7c6('0xfb'),_0x168f62,_0x5d8f0c));return;}var _0x494abe=uuid['v4']();var _0x40ecf9=_0x2d3be1[_0xf7c6('0xf')][_0x2ca750[_0xf7c6('0x6a')][_0xf7c6('0x21')]];var _0x11c7be=_0x129855?_0x2d3be1[_0xf7c6('0x11')][_0x129855]['id']:undefined;_0x2d3be1[_0xf7c6('0x10')][_0x494abe]=new Action(_0x2ca750,_0x40ecf9,_0x494abe,_0x129855,_0x11c7be);var _0x2b75e0=_0x2d3be1[_0xf7c6('0x10')][_0x494abe];_0x2b75e0[_0xf7c6('0xc0')]=_0x168f62;_0x2b75e0[_0xf7c6('0xc1')]=_0x5d8f0c;_0x2b75e0['lookAgent']=_0x129855;if(_[_0xf7c6('0xfc')](_0x43c042)){_0x2d3be1[_0xf7c6('0xfd')](_0x2b75e0,_0x40ecf9,_0x2ca750,_0x129855)[_0xf7c6('0x81')](function(_0x4dd708){logger[_0xf7c6('0x53')](_0xf7c6('0xfe'),_0xf7c6('0xff')+_0x2b75e0[_0xf7c6('0x6b')]+_0xf7c6('0x100')+_0x2b75e0[_0xf7c6('0x101')],JSON[_0xf7c6('0x4f')](_0x4dd708));ami['emit']('custom:agentcalled',ut[_0xf7c6('0x9d')](_0x2b75e0,_0xf7c6('0x102'),_0x2d3be1[_0xf7c6('0xf')][_0x2b75e0[_0xf7c6('0x6b')]]));_0x7f10fd(ut[_0xf7c6('0x45')](_0xf7c6('0x103')));})[_0xf7c6('0x75')](function(_0x109bfd){ut[_0xf7c6('0x5a')](_0xf7c6('0x104'),_0x109bfd);_0x198c8c(ut['message']('Call\x20failed',_0x168f62,_0x5d8f0c));});}else{_0x40ecf9[_0xf7c6('0x30')]+=0x1;ut['logBlacklist'](_0x2b75e0);rpcDb[_0xf7c6('0x105')](_0x2b75e0,_0xf7c6('0x106'));delete _0x2d3be1[_0xf7c6('0x10')][_0x494abe];_0x198c8c(ut[_0xf7c6('0x45')](_0xf7c6('0x107'),_0x168f62,_0x5d8f0c));}});};Preview[_0xf7c6('0xa')][_0xf7c6('0x108')]=function(_0x84adb5){return!_[_0xf7c6('0x68')](_0x84adb5)&&!_['isNil'](_0x84adb5['name'])&&!_[_0xf7c6('0x68')](_0x84adb5[_0xf7c6('0x4c')])&&_0x84adb5[_0xf7c6('0x4c')]&&!_[_0xf7c6('0x68')](this[_0xf7c6('0x109')][util[_0xf7c6('0x50')](_0xf7c6('0x10a'),_0x84adb5[_0xf7c6('0x21')])])&&!_['isNil'](this[_0xf7c6('0x109')][util[_0xf7c6('0x50')](_0xf7c6('0x10a'),_0x84adb5[_0xf7c6('0x21')])][_0xf7c6('0x73')])&&(this[_0xf7c6('0x109')][util['format'](_0xf7c6('0x10a'),_0x84adb5[_0xf7c6('0x21')])][_0xf7c6('0x73')]===_0xf7c6('0x10b')||this[_0xf7c6('0x109')][util['format'](_0xf7c6('0x10a'),_0x84adb5[_0xf7c6('0x21')])][_0xf7c6('0x73')]===_0xf7c6('0x10c'));};Preview[_0xf7c6('0xa')]['run']=function(_0x39db15,_0x2a7e15){var _0x9ab03c=this;return new BPromise(function(_0x2d511f,_0x22ab0e){_0x9ab03c[_0xf7c6('0x10d')](_0x39db15,_0x2a7e15)[_0xf7c6('0x81')](function(_0x163015){_0x2d511f(_[_0xf7c6('0x6f')](_0x163015,[_0xf7c6('0x45')]));})['catch'](function(_0x246428){if(_0x246428[_0xf7c6('0x10e')]){rpcDb[_0xf7c6('0x10f')](_0x39db15);}if(_0x246428[_0xf7c6('0x4c')]){rpcDb[_0xf7c6('0x88')](_0x39db15);}_0x22ab0e(_[_0xf7c6('0x6f')](_0x246428,['message']));});});};Preview[_0xf7c6('0xa')][_0xf7c6('0x10d')]=function(_0x1f990d,_0x3284cd){var _0xeb2424=this;return new BPromise(function(_0x40c1b,_0x5b439f){var _0x22bb21,_0x594eef;rpcDb[_0xf7c6('0x110')](_0x1f990d)['then'](function(_0x2ec359){if(!_['isNil'](_0x2ec359[0x0])){_0x594eef=_0x2ec359[0x0][_0xf7c6('0x111')]?![]:!![];_0x22bb21=_0x2ec359[0x0]['recallme']?!![]:![];_0x22bb21=_0x3284cd?!![]:_0x22bb21;}var _0xbc2efd=_0xeb2424[_0xf7c6('0x112')](_0x2ec359);if(_0xbc2efd[_0xf7c6('0x113')]){rpcDb[_0xf7c6('0x114')](_[_0xf7c6('0x6f')](_0x2ec359[0x0],[_0xf7c6('0x71'),_0xf7c6('0x115')]))[_0xf7c6('0x81')](function(_0x446bd8){_0xeb2424[_0xf7c6('0xf8')](_0x446bd8,_0x2ec359[0x0],_0x3284cd,_0x594eef,_0x22bb21)['then'](function(_0x10be31){_0x40c1b(_0x10be31);})['catch'](function(_0x6317ed){_0x5b439f(_0x6317ed);});})[_0xf7c6('0x75')](function(_0x49569a){ut[_0xf7c6('0x5a')](_0xf7c6('0x116'),_0x49569a);_0x5b439f(ut[_0xf7c6('0x45')](_0xf7c6('0x117'),_0x594eef,_0x22bb21));});}else{_0x5b439f(ut[_0xf7c6('0x45')](_0xbc2efd['message'],_0x594eef,_0x22bb21));}})[_0xf7c6('0x75')](function(_0x21fab0){ut[_0xf7c6('0x5a')]('[Preview][getContactPreview]',_0x21fab0);_0x5b439f(ut[_0xf7c6('0x45')](_0xf7c6('0x117'),![],!![]));});});};Preview[_0xf7c6('0xa')][_0xf7c6('0x112')]=function(_0xdb77a1){if(_['isNil'](_0xdb77a1)||_[_0xf7c6('0xfc')](_0xdb77a1)||!_[_0xf7c6('0x68')](_0xdb77a1[0x0][_0xf7c6('0x118')])&&_[_0xf7c6('0x68')](_0xdb77a1[0x0][_0xf7c6('0x118')]['name'])){ut[_0xf7c6('0x5a')]('[Preview][validateContact][Empty\x20Contact]',_0xdb77a1);return{'isValid':![],'message':_0xf7c6('0x119')};}var _0x2913e7=this[_0xf7c6('0xf')][_0xdb77a1[0x0][_0xf7c6('0x6a')][_0xf7c6('0x21')]];_0x2913e7['message']='ACTIVE';if(_[_0xf7c6('0x68')](_0x2913e7)){ut['logger'](_0xf7c6('0x11a'),_0x2913e7);return{'isValid':![],'message':_0xf7c6('0x11b')};}if(!this['isTrunkReachable'](_0x2913e7[_0xf7c6('0x4b')])){ut['logger'](_0xf7c6('0x11c'),_0xf7c6('0x11d')+_0x2913e7[_0xf7c6('0x21')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xf7c6('0x108')](_0x2913e7[_0xf7c6('0x97')])){ut[_0xf7c6('0x5a')](_0xf7c6('0x11c'),_0x2913e7[_0xf7c6('0x21')]+_0xf7c6('0x11e'));return{'isValid':![],'message':_0xf7c6('0x11f')};}}if(!ut[_0xf7c6('0x96')](_0x2913e7[_0xf7c6('0x2a')])){ut[_0xf7c6('0x5a')](_0xf7c6('0x120'),_0x2913e7[_0xf7c6('0x21')]+_0xf7c6('0x121'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x2913e7[_0xf7c6('0x21')]+_0xf7c6('0x121')};}return{'isValid':!![],'message':_0xf7c6('0x122')};};Preview[_0xf7c6('0xa')][_0xf7c6('0xfd')]=function(_0x256843,_0x8eae55,_0x5a01a0,_0x1d495f){var _0x27e6e8=this;return new BPromise(function(_0x115983,_0x519986){var _0x3ef847=_0x256843[_0xf7c6('0xab')];var _0x3b3f05=_0x27e6e8['isTrunkReachable'](_0x8eae55[_0xf7c6('0x4b')])?util[_0xf7c6('0x50')](_0xf7c6('0x123'),_0x8eae55[_0xf7c6('0x4b')][_0xf7c6('0x21')],_[_0xf7c6('0x68')](_0x8eae55['dialPrefix'])?'':_0x8eae55['dialPrefix']['trim']()||'',_0x8eae55['dialCutDigit']>0x0?_0x5a01a0[_0xf7c6('0xf9')][_0xf7c6('0xfa')][_0xf7c6('0x124')](_0x8eae55[_0xf7c6('0x125')]):_0x5a01a0['Contact']['phone']):util[_0xf7c6('0x50')](_0xf7c6('0x123'),_[_0xf7c6('0x68')](_0x8eae55['TrunkBackup'])?_0x8eae55[_0xf7c6('0x4b')][_0xf7c6('0x21')]:_0x8eae55[_0xf7c6('0x97')]['name'],_[_0xf7c6('0x68')](_0x8eae55[_0xf7c6('0x2d')])?'':_0x8eae55[_0xf7c6('0x2d')][_0xf7c6('0x126')]()||'',_0x8eae55[_0xf7c6('0x125')]>0x0?_0x5a01a0[_0xf7c6('0xf9')]['phone']['substring'](_0x8eae55[_0xf7c6('0x125')]):_0x5a01a0[_0xf7c6('0xf9')]['phone']);var _0xc3cb79=_0x27e6e8['isTrunkReachable'](_0x8eae55[_0xf7c6('0x4b')])?ut[_0xf7c6('0x127')](_0x8eae55[_0xf7c6('0x4b')][_0xf7c6('0x4d')],_0x8eae55[_0xf7c6('0x128')],_0x8eae55[_0xf7c6('0x129')]>0x0?ut[_0xf7c6('0x12a')](_0x8eae55[_0xf7c6('0x2b')],_0x8eae55[_0xf7c6('0x129')]):_0x8eae55[_0xf7c6('0x2b')]):ut[_0xf7c6('0x127')](_[_0xf7c6('0x68')](_0x8eae55[_0xf7c6('0x97')])?_0x8eae55['Trunk'][_0xf7c6('0x4d')]:_0x8eae55[_0xf7c6('0x97')][_0xf7c6('0x4d')],_0x8eae55['dialOriginateCallerIdName'],_0x8eae55[_0xf7c6('0x129')]>0x0?ut[_0xf7c6('0x12a')](_0x8eae55[_0xf7c6('0x2b')],_0x8eae55[_0xf7c6('0x129')]):_0x8eae55[_0xf7c6('0x2b')]);if(_0xc3cb79){_0x256843[_0xf7c6('0x12b')]=ut[_0xf7c6('0x12c')](_0xc3cb79);_0x256843[_0xf7c6('0x12d')]=ut[_0xf7c6('0x12e')](_0xc3cb79);}var _0x22472f=ut['addVariables'](_0x8eae55,_0x5a01a0,_0x3b3f05,_0xc3cb79,_0x3ef847,_0x256843);_['merge'](_0x256843,ut['toLowerVariables'](_0x22472f));_0x256843['starttime']=moment()['format'](_0xf7c6('0x8a'));ami[_0xf7c6('0x12f')](ut[_0xf7c6('0x130')](_0x256843,_0x8eae55,_0x22472f,_0x256843[_0xf7c6('0xc1')],_0x1d495f))[_0xf7c6('0x81')](function(_0x1009d6){var _0x4e7343=_0x256843[_0xf7c6('0x131')];if(!_[_0xf7c6('0x68')](_0x4e7343)){if(!_['isNil'](_0x27e6e8[_0xf7c6('0x11')][_0x4e7343])){_0x27e6e8[_0xf7c6('0x11')][_0x4e7343][_0xf7c6('0x132')]=_0x256843['calleridnum'];emit(util[_0xf7c6('0x50')]('user:%s',_0x27e6e8[_0xf7c6('0x11')][_0x4e7343][_0xf7c6('0x21')]),_0xf7c6('0x133'),{'destaccountcode':_0x27e6e8[_0xf7c6('0x11')][_0x4e7343][_0xf7c6('0x134')],'destconnectedlinenum':_0x256843[_0xf7c6('0x135')]});}}_0x8eae55[_0xf7c6('0x57')]+=0x1;logger[_0xf7c6('0x53')](_0xf7c6('0x136'),_0x3ef847,_0xf7c6('0xb6'),_0x8eae55[_0xf7c6('0x21')],_0xf7c6('0x6c'),_0x8eae55[_0xf7c6('0x57')]);_0x115983(_0x1009d6);})[_0xf7c6('0x75')](function(_0x337dab){ut[_0xf7c6('0xed')](_0x256843,0xe,_0xf7c6('0x137'));rpcDb[_0xf7c6('0xf2')](_0x256843,'[originateFailure][logOriginateFailure]');_0x519986(_0x337dab);});});};Preview[_0xf7c6('0xa')][_0xf7c6('0x1a')]=function(_0x2f3f90){if(this[_0xf7c6('0x10')][_0x2f3f90[_0xf7c6('0xb7')]]){this[_0xf7c6('0x10')][_0x2f3f90[_0xf7c6('0xb7')]][_0xf7c6('0x74')]=_0x2f3f90['channel'];}};Preview['prototype'][_0xf7c6('0x14')]=function(_0x326d14){var _0x2f4d51=this;var _0x5093b1=this[_0xf7c6('0x10')][_0x326d14[_0xf7c6('0x138')]];if(_0x5093b1){if(_0x5093b1['lookAgent']&&this[_0xf7c6('0x11')][_0x5093b1['lookAgent']]){ut[_0xf7c6('0x139')](_0x5093b1,this[_0xf7c6('0x11')][_0x5093b1[_0xf7c6('0x13a')]][_0xf7c6('0x21')],this['agents'][_0x5093b1['lookAgent']]['id']);}var _0x35e12b=_['clone'](_0x5093b1);_0x35e12b[_0xf7c6('0xa8')]=moment()[_0xf7c6('0x50')]('YYYY-MM-DD\x20HH:mm:ss');var _0x39daeb=_0x2f4d51[_0xf7c6('0xf')][_0x5093b1[_0xf7c6('0x6b')]];if(ut[_0xf7c6('0x13b')](_0x326d14['response'])){if(_0x5093b1[_0xf7c6('0xc0')]){rpcDb[_0xf7c6('0x10f')](_0x5093b1['idContact']);}if(_0x5093b1[_0xf7c6('0xc1')]){rpcDb[_0xf7c6('0x88')](_0x5093b1[_0xf7c6('0x101')]);}ami[_0xf7c6('0x1f')]('custom:agentringnoanswer',ut[_0xf7c6('0x9d')](_0x5093b1,_0xf7c6('0x13c'),this[_0xf7c6('0xf')][_0x5093b1[_0xf7c6('0x6b')]]));this[_0xf7c6('0xeb')](_0x35e12b,_0x39daeb,_0x326d14);}else{_0x5093b1[_0xf7c6('0x89')]=moment()[_0xf7c6('0x50')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xf7c6('0xed')](_0x35e12b,0x4,_0xf7c6('0x13d'));rpcDb[_0xf7c6('0xf2')](_0x35e12b,_0xf7c6('0x13e'));}}};Preview['prototype'][_0xf7c6('0x17')]=function(_0x4f871d){var _0x465e41=this;var _0x14f031=this[_0xf7c6('0x10')][_0x4f871d[_0xf7c6('0xb7')]];var _0x1715e1;if(_0x14f031){_0x1715e1=this[_0xf7c6('0xf')][_0x14f031['queue']];logger[_0xf7c6('0x53')](_0xf7c6('0x13f'),_0x4f871d[_0xf7c6('0xb7')],_0xf7c6('0xb6'),_0x1715e1[_0xf7c6('0x21')],_0xf7c6('0x6d'),_0x1715e1['pTalking']);}if(this[_0xf7c6('0x10')][_0x4f871d[_0xf7c6('0xb7')]]&&_0x4f871d[_0xf7c6('0xb7')]!==_0x4f871d[_0xf7c6('0xab')]){if(_0x4f871d[_0xf7c6('0x140')]==='16'&&this[_0xf7c6('0x10')][_0x4f871d['linkedid']]['dialAnswer']){this[_0xf7c6('0x141')](_0x4f871d,_0x4f871d[_0xf7c6('0xb7')],_0x4f871d[_0xf7c6('0x140')]);}else if(this[_0xf7c6('0x10')][_0x4f871d[_0xf7c6('0xb7')]][_0xf7c6('0x6e')]){logger[_0xf7c6('0x53')]('[syncHangup][talking][cause]',_0x4f871d[_0xf7c6('0xb7')],_0x4f871d[_0xf7c6('0x140')],_0xf7c6('0xb6'),_0x1715e1[_0xf7c6('0x21')],'pTalking:\x20',_0x1715e1[_0xf7c6('0x24')]);this[_0xf7c6('0x141')](_0x4f871d,_0x4f871d[_0xf7c6('0xb7')],_0x4f871d[_0xf7c6('0x140')]);}}else if(_0x14f031&&_[_0xf7c6('0x68')](_0x14f031[_0xf7c6('0x142')])&&_0x1715e1[_0xf7c6('0x143')]&&_0x4f871d['linkedid']===_0x4f871d[_0xf7c6('0xab')]&&_[_0xf7c6('0x68')](_0x4f871d[_0xf7c6('0xf6')])&&_0x4f871d[_0xf7c6('0x140')]==='16'&&_0x4f871d[_0xf7c6('0x144')]==='6'&&_['isUndefined'](_0x14f031[_0xf7c6('0x145')])){if(_0x14f031[_0xf7c6('0xc0')]){rpcDb[_0xf7c6('0x10f')](_0x14f031[_0xf7c6('0x101')]);}if(_0x14f031[_0xf7c6('0xc1')]){rpcDb[_0xf7c6('0x88')](_0x14f031[_0xf7c6('0x101')]);}_0x4f871d[_0xf7c6('0xf6')]='22';this[_0xf7c6('0xeb')](_0x14f031,_0x1715e1,_0x4f871d);}else if(_0x14f031&&_0x14f031[_0xf7c6('0x145')]){if(_0x4f871d[_0xf7c6('0x140')]==='16'&&this[_0xf7c6('0x10')][_0x4f871d[_0xf7c6('0xb7')]][_0xf7c6('0x6e')]){logger[_0xf7c6('0x53')](_0xf7c6('0x146'),_0x4f871d[_0xf7c6('0xb7')],_0x4f871d['cause'],'\x20Queue',_0x1715e1[_0xf7c6('0x21')],'pTalking:\x20',_0x1715e1[_0xf7c6('0x24')]);this['callProgressDetectingCustomer'](_0x4f871d,_0x4f871d[_0xf7c6('0xb7')],_0x4f871d[_0xf7c6('0x140')]);}else if(this['actions'][_0x4f871d[_0xf7c6('0xb7')]]['dialAnswer']){logger[_0xf7c6('0x53')](_0xf7c6('0x147'),_0x4f871d[_0xf7c6('0xb7')],_0x4f871d['cause'],_0xf7c6('0xb6'),_0x1715e1['name'],_0xf7c6('0x6d'),_0x1715e1['pTalking']);this[_0xf7c6('0x141')](_0x4f871d,_0x4f871d[_0xf7c6('0xb7')],_0x4f871d['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x59c403){if(this[_0xf7c6('0x10')][_0x59c403['destlinkedid']]&&_0x59c403[_0xf7c6('0xea')]!==_0x59c403['destuniqueid']){this['callProgressDetectingCustomer'](_0x59c403,_0x59c403[_0xf7c6('0xea')],_0x59c403[_0xf7c6('0xdf')]);}};Preview[_0xf7c6('0xa')]['syncHangupRequest']=function(_0x34fc94){if(this['actions'][_0x34fc94[_0xf7c6('0xb7')]]&&_0x34fc94[_0xf7c6('0xb7')]!==_0x34fc94[_0xf7c6('0xab')]&&!this[_0xf7c6('0x10')][_0x34fc94['linkedid']][_0xf7c6('0x6e')]){if(_0x34fc94[_0xf7c6('0x140')]==='1'){this['callProgressDetectingCustomer'](_0x34fc94,_0x34fc94[_0xf7c6('0xb7')],_0x34fc94[_0xf7c6('0x140')]);}}};Preview['prototype'][_0xf7c6('0x148')]=function(_0x49c3df,_0x27ad9c,_0x3f2cf2){if(this[_0xf7c6('0x10')][_0x49c3df]){if(_[_0xf7c6('0x68')](this[_0xf7c6('0x10')][_0x49c3df]['variables'])){this[_0xf7c6('0x10')][_0x49c3df][_0xf7c6('0x149')]={};}this[_0xf7c6('0x10')][_0x49c3df]['variables'][_0x27ad9c]=_0x3f2cf2;}};Preview['prototype'][_0xf7c6('0x1b')]=function(_0x5be953){try{if(!_[_0xf7c6('0x68')](_0x5be953)){if(ut[_0xf7c6('0x14a')](_[_0xf7c6('0x14b')](_0x5be953['variable'])[0x0])){this['addVariable'](_0x5be953[_0xf7c6('0xab')],_[_0xf7c6('0x14b')](_0x5be953[_0xf7c6('0x14c')])[0x0],_0x5be953['value']);}}}catch(_0x21d0db){logger['error'](_0xf7c6('0x14d'),util[_0xf7c6('0x14e')](_0x21d0db,{'showHidden':![],'depth':null}));}};Preview[_0xf7c6('0xa')][_0xf7c6('0x14f')]=function(_0x2182fa){if(_0x2182fa){if(this[_0xf7c6('0x10')][_0x2182fa['transfertargetlinkedid']]){this[_0xf7c6('0x10')][_0x2182fa['transfertargetlinkedid']][_0xf7c6('0x145')]=!![];}}};Preview[_0xf7c6('0xa')][_0xf7c6('0x150')]=function(_0x438e1b){if(_0x438e1b){if(this[_0xf7c6('0x10')][_0x438e1b[_0xf7c6('0x151')]]){this[_0xf7c6('0x10')][_0x438e1b[_0xf7c6('0x151')]][_0xf7c6('0x145')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 7ca18fa..9e34240 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 _0x9dbd=['../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','context','exten','xcally-motion-preview','holdtime','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview'];(function(_0x63f829,_0x3b98dc){var _0x112526=function(_0x8c8ae3){while(--_0x8c8ae3){_0x63f829['push'](_0x63f829['shift']());}};_0x112526(++_0x3b98dc);}(_0x9dbd,0xe1));var _0xd9db=function(_0x1b2e9c,_0x23a6af){_0x1b2e9c=_0x1b2e9c-0x0;var _0x2ee604=_0x9dbd[_0x1b2e9c];return _0x2ee604;};'use strict';var util=require('util');var BPromise=require(_0xd9db('0x0'));var logger=require(_0xd9db('0x1'))(_0xd9db('0x2'));var _=require('lodash');var cmHopper=require(_0xd9db('0x3'));var cmHopperFinal=require(_0xd9db('0x4'));var cmHopperHistory=require(_0xd9db('0x5'));var cmHopperBlack=require(_0xd9db('0x6'));var voiceQueueRt=require(_0xd9db('0x7'));var agentReportPreview=require(_0xd9db('0x8'));var voiceQueueReport=require(_0xd9db('0x9'));function loggerCatch(_0x13c917){return function(_0x284b07){logger[_0xd9db('0xa')](_0x13c917,util[_0xd9db('0xb')](_0x284b07,{'showHidden':![],'depth':null}));};}function create(_0x30cb13){return BPromise[_0xd9db('0xc')]()['then'](cmHopperHistory[_0xd9db('0xd')](_0x30cb13))[_0xd9db('0xe')](loggerCatch(_0xd9db('0xf')));}function createAgent(_0x217b45){return BPromise['resolve']()[_0xd9db('0x10')](agentReportPreview[_0xd9db('0xd')](_0x217b45))['catch'](loggerCatch(_0xd9db('0xf')));}function moveContact(_0x497df1){return BPromise[_0xd9db('0xc')]()['then'](cmHopper[_0xd9db('0x11')](_0x497df1,!![]))[_0xd9db('0xe')](loggerCatch(_0xd9db('0x12')));}exports[_0xd9db('0x13')]=function(_0x430c06){return BPromise['resolve']()[_0xd9db('0x10')](cmHopperBlack[_0xd9db('0x13')](_0x430c06))[_0xd9db('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xd9db('0x14')]=function(_0x5a2f30){return BPromise['resolve']()[_0xd9db('0x10')](cmHopper[_0xd9db('0x14')](_0x5a2f30))[_0xd9db('0xe')](loggerCatch(_0xd9db('0x15')));};exports[_0xd9db('0xd')]=function(_0x2c93e9,_0x1e4fff){create(_0x2c93e9)[_0xd9db('0xe')](loggerCatch(_0x1e4fff));moveContact(_0x2c93e9)[_0xd9db('0xe')](loggerCatch(_0x1e4fff));};exports[_0xd9db('0x16')]=function(_0x28c38d,_0x3a94ad){createAgent(_0x28c38d)[_0xd9db('0xe')](loggerCatch(_0x3a94ad));};exports[_0xd9db('0x17')]=function(_0x58892c,_0x58a60d){create(_0x58892c)[_0xd9db('0xe')](loggerCatch(_0x58a60d));};exports[_0xd9db('0x18')]=function(_0x36ad39,_0x4de01c){moveContact(_0x36ad39)['catch'](loggerCatch(_0x4de01c));};exports[_0xd9db('0x19')]=function(_0x244903,_0x25e0ef,_0xd8efa1){if(_0x25e0ef){_0x244903['UserId']=null;}if(_0xd8efa1){_0x244903[_0xd9db('0x1a')]=![];}return BPromise[_0xd9db('0xc')]()[_0xd9db('0x10')](cmHopper[_0xd9db('0x19')](_0x244903))[_0xd9db('0xe')](loggerCatch(_0xd9db('0x1b')));};exports[_0xd9db('0x1c')]=function(_0x2c5dc8){return BPromise[_0xd9db('0xc')]()['then'](cmHopper[_0xd9db('0x1c')](_0x2c5dc8))['catch'](loggerCatch(_0xd9db('0x1d')));};exports['unlockContact']=function(_0x241d9d){return BPromise[_0xd9db('0xc')]()['then'](cmHopper[_0xd9db('0x1e')]({'UserId':null},_0x241d9d,0x1))['catch'](loggerCatch(_0xd9db('0x1f')));};exports[_0xd9db('0x20')]=function(_0x691a07){return BPromise['resolve']()[_0xd9db('0x10')](cmHopper['unlockContact']({'active':![]},_0x691a07,0x1))['catch'](loggerCatch(_0xd9db('0x21')));};exports['crateCustomerReportQueue']=function(_0x3afc43){var _0xb91ad0={};_0xb91ad0[_0xd9db('0x22')]=_0x3afc43['type'];_0xb91ad0[_0xd9db('0x23')]=_0x3afc43['uniqueid'];_0xb91ad0[_0xd9db('0x24')]=_0x3afc43[_0xd9db('0x24')];_0xb91ad0[_0xd9db('0x25')]=_0x3afc43[_0xd9db('0x25')];_0xb91ad0[_0xd9db('0x26')]=_0x3afc43['queue'];_0xb91ad0['queuecallerjoinAt']=_0x3afc43[_0xd9db('0x27')];_0xb91ad0[_0xd9db('0x28')]=_0x3afc43[_0xd9db('0x27')];_0xb91ad0[_0xd9db('0x29')]=0x1;_0xb91ad0[_0xd9db('0x2a')]=_0x3afc43['endtime'];_0xb91ad0[_0xd9db('0x2b')]=_0x3afc43['membername'];_0xb91ad0[_0xd9db('0x2c')]='from-sip';_0xb91ad0[_0xd9db('0x2d')]=_0xd9db('0x2e');_0xb91ad0[_0xd9db('0x2f')]=0x0;_0xb91ad0['assigned']=0x1;_0xb91ad0[_0xd9db('0x30')]=_0x3afc43[_0xd9db('0x31')];_0xb91ad0[_0xd9db('0x32')]=_0xd9db('0x33');return BPromise[_0xd9db('0xc')]()[_0xd9db('0x10')](voiceQueueReport[_0xd9db('0x34')](_0xb91ad0))[_0xd9db('0xe')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xd9db('0x35')]=function(_0x12495e,_0x2787ad){return BPromise['resolve']()['then'](cmHopper[_0xd9db('0x35')](_0x12495e,_0x2787ad))[_0xd9db('0xe')](loggerCatch(_0xd9db('0x36')));};exports[_0xd9db('0x37')]=function(_0x55f78c){return BPromise[_0xd9db('0xc')]()[_0xd9db('0x10')](cmHopper[_0xd9db('0x19')](_0x55f78c,!![],!![]))[_0xd9db('0xe')](loggerCatch(_0xd9db('0x38')));}; \ No newline at end of file +var _0xdbd5=['[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','catch','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','assigned','queuecallerexitreason','create'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xdbd5,0x123));var _0x5dbd=function(_0xb0fe92,_0x147e42){_0xb0fe92=_0xb0fe92-0x0;var _0x41787f=_0xdbd5[_0xb0fe92];return _0x41787f;};'use strict';var util=require(_0x5dbd('0x0'));var BPromise=require('bluebird');var logger=require(_0x5dbd('0x1'))(_0x5dbd('0x2'));var _=require(_0x5dbd('0x3'));var cmHopper=require(_0x5dbd('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x5dbd('0x5'));var cmHopperBlack=require(_0x5dbd('0x6'));var voiceQueueRt=require(_0x5dbd('0x7'));var agentReportPreview=require(_0x5dbd('0x8'));var voiceQueueReport=require(_0x5dbd('0x9'));function loggerCatch(_0x4b384e){return function(_0x7388a0){logger[_0x5dbd('0xa')](_0x4b384e,util[_0x5dbd('0xb')](_0x7388a0,{'showHidden':![],'depth':null}));};}function create(_0x2082c2){return BPromise[_0x5dbd('0xc')]()[_0x5dbd('0xd')](cmHopperHistory['createHistory'](_0x2082c2))[_0x5dbd('0xe')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x4015f8){return BPromise[_0x5dbd('0xc')]()[_0x5dbd('0xd')](agentReportPreview[_0x5dbd('0xf')](_0x4015f8))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5160aa){return BPromise['resolve']()[_0x5dbd('0xd')](cmHopper[_0x5dbd('0x10')](_0x5160aa,!![]))['catch'](loggerCatch(_0x5dbd('0x11')));}exports[_0x5dbd('0x12')]=function(_0x221aab){return BPromise['resolve']()[_0x5dbd('0xd')](cmHopperBlack[_0x5dbd('0x12')](_0x221aab))[_0x5dbd('0xe')](loggerCatch(_0x5dbd('0x13')));};exports[_0x5dbd('0x14')]=function(_0x1158d2){return BPromise[_0x5dbd('0xc')]()[_0x5dbd('0xd')](cmHopper['getContactPreview'](_0x1158d2))[_0x5dbd('0xe')](loggerCatch(_0x5dbd('0x15')));};exports['createHistory']=function(_0x44e41a,_0x10c188){create(_0x44e41a)['catch'](loggerCatch(_0x10c188));moveContact(_0x44e41a)['catch'](loggerCatch(_0x10c188));};exports[_0x5dbd('0x16')]=function(_0x49262d,_0x328b58){createAgent(_0x49262d)[_0x5dbd('0xe')](loggerCatch(_0x328b58));};exports[_0x5dbd('0x17')]=function(_0x43ca42,_0x344898){create(_0x43ca42)[_0x5dbd('0xe')](loggerCatch(_0x344898));};exports[_0x5dbd('0x18')]=function(_0x35e961,_0x8a3c96){moveContact(_0x35e961)['catch'](loggerCatch(_0x8a3c96));};exports['rescheduleContact']=function(_0x592db1,_0x38997e,_0x23a8f4){if(_0x38997e){_0x592db1[_0x5dbd('0x19')]=null;}if(_0x23a8f4){_0x592db1[_0x5dbd('0x1a')]=![];}return BPromise['resolve']()[_0x5dbd('0xd')](cmHopper['rescheduleContact'](_0x592db1))[_0x5dbd('0xe')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x5dbd('0x1b')]=function(_0x17ffca){return BPromise[_0x5dbd('0xc')]()['then'](cmHopper['countReScheduled'](_0x17ffca))[_0x5dbd('0xe')](loggerCatch(_0x5dbd('0x1c')));};exports[_0x5dbd('0x1d')]=function(_0x65cf17){return BPromise[_0x5dbd('0xc')]()[_0x5dbd('0xd')](cmHopper['unlockContact']({'UserId':null},_0x65cf17,0x1))[_0x5dbd('0xe')](loggerCatch(_0x5dbd('0x1e')));};exports['disableContact']=function(_0x360da0){return BPromise[_0x5dbd('0xc')]()['then'](cmHopper[_0x5dbd('0x1d')]({'active':![]},_0x360da0,0x1))[_0x5dbd('0xe')](loggerCatch(_0x5dbd('0x1f')));};exports[_0x5dbd('0x20')]=function(_0x3eea53){var _0x26be25={};_0x26be25[_0x5dbd('0x21')]=_0x3eea53[_0x5dbd('0x21')];_0x26be25[_0x5dbd('0x22')]=_0x3eea53[_0x5dbd('0x22')];_0x26be25[_0x5dbd('0x23')]=_0x3eea53[_0x5dbd('0x23')];_0x26be25[_0x5dbd('0x24')]=_0x3eea53[_0x5dbd('0x24')];_0x26be25[_0x5dbd('0x25')]=_0x3eea53[_0x5dbd('0x25')];_0x26be25['queuecallerjoinAt']=_0x3eea53[_0x5dbd('0x26')];_0x26be25[_0x5dbd('0x27')]=_0x3eea53[_0x5dbd('0x26')];_0x26be25[_0x5dbd('0x28')]=0x1;_0x26be25[_0x5dbd('0x29')]=_0x3eea53[_0x5dbd('0x2a')];_0x26be25[_0x5dbd('0x2b')]=_0x3eea53[_0x5dbd('0x2c')];_0x26be25[_0x5dbd('0x2d')]=_0x5dbd('0x2e');_0x26be25['exten']=_0x5dbd('0x2f');_0x26be25['holdtime']=0x0;_0x26be25[_0x5dbd('0x30')]=0x1;_0x26be25['lastAssignedTo']=_0x3eea53[_0x5dbd('0x2c')];_0x26be25[_0x5dbd('0x31')]='COMPLETED';return BPromise[_0x5dbd('0xc')]()[_0x5dbd('0xd')](voiceQueueReport[_0x5dbd('0x32')](_0x26be25))[_0x5dbd('0xe')](loggerCatch(_0x5dbd('0x33')));};exports['getContactRecallMe']=function(_0x1d0790,_0x28d89a){return BPromise[_0x5dbd('0xc')]()[_0x5dbd('0xd')](cmHopper[_0x5dbd('0x34')](_0x1d0790,_0x28d89a))[_0x5dbd('0xe')](loggerCatch(_0x5dbd('0x35')));};exports[_0x5dbd('0x36')]=function(_0x5d29fe){return BPromise[_0x5dbd('0xc')]()[_0x5dbd('0xd')](cmHopper[_0x5dbd('0x37')](_0x5d29fe,!![],!![]))[_0x5dbd('0xe')](loggerCatch(_0x5dbd('0x38')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index c6ddfc0..d9cd05f 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 _0xc64b=['recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','loggerCatch','error','inspect','logger','logger2','info','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','monitor_format','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','%s%s','XMD-','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','interface','motionChannel','voice','mandatoryDisposition','buildAcw','queue','agentReadyId','not_inuse','status','reachable','push','getDiff','filterKey','idContact','type','campaigntype','dialAnswer','membername','countglobal','callback','callbackuniqueid'];(function(_0x3621da,_0x1486c2){var _0x41a3f4=function(_0x506943){while(--_0x506943){_0x3621da['push'](_0x3621da['shift']());}};_0x41a3f4(++_0x1486c2);}(_0xc64b,0x13e));var _0xbc64=function(_0x361805,_0x39bf7b){_0x361805=_0x361805-0x0;var _0x2066b0=_0xc64b[_0x361805];return _0x2066b0;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');var logger=require(_0xbc64('0x0'))(_0xbc64('0x1'));var ipAgi=process[_0xbc64('0x2')][_0xbc64('0x3')]||'127.0.0.1';function getSeconds(_0x3d1dc5,_0x36458e){var _0x5b7c7f=moment(_0x3d1dc5)['milliseconds'](0x0);var _0x15c96a=moment(_0x36458e)[_0xbc64('0x4')](0x0);return _0x5b7c7f[_0xbc64('0x5')](_0x15c96a,'seconds');}exports[_0xbc64('0x6')]=function(_0x4cf326){return function(_0x50d33e){logger[_0xbc64('0x7')](_0x4cf326,util[_0xbc64('0x8')](_0x50d33e,{'showHidden':![],'depth':null}));};};exports[_0xbc64('0x9')]=function(_0x471ef2,_0x1739e7){logger['info'](_0x471ef2,util[_0xbc64('0x8')](_0x1739e7,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x5d5538,_0x58113b){logger[_0xbc64('0x7')](_0x5d5538,util[_0xbc64('0x8')](_0x58113b,{'showHidden':![],'depth':null}));};exports[_0xbc64('0xa')]=function(_0x2552ab){return function(_0x4923d9){logger[_0xbc64('0xb')](_0x2552ab,util[_0xbc64('0x8')](_0x4923d9,{'showHidden':![],'depth':null}));};};exports[_0xbc64('0xc')]=function(_0x5b0719,_0x3e65b0,_0x1568c7){return{'message':_0x5b0719,'unlock':_0x3e65b0,'active':_0x1568c7};};exports[_0xbc64('0xd')]=function(_0x259d29,_0x4a4b4e,_0x34c872){if(!_[_0xbc64('0xe')](_0x34c872)&&_0xbc64('0xf')===typeof _0x34c872&&!_[_0xbc64('0x10')](_0x34c872)){if(!_['isUndefined'](_0x4a4b4e)&&'string'===typeof _0x4a4b4e&&!_[_0xbc64('0x10')](_0x4a4b4e)){return util[_0xbc64('0x11')](_0xbc64('0x12'),_0x4a4b4e,_0x34c872);}return util[_0xbc64('0x11')](_0xbc64('0x12'),_0x34c872,_0x34c872);}if(!_[_0xbc64('0xe')](_0x259d29)&&_0xbc64('0xf')===typeof _0x259d29&&!_[_0xbc64('0x10')](_0x259d29)){return _0x259d29;}return _0xbc64('0x13');};exports['isActive']=function(_0x3af52f){if(_['isNil'](_0x3af52f)){return![];}return _0x3af52f;};exports[_0xbc64('0x14')]=function(_0xbfa376,_0x15ef49,_0x5056b1,_0x1ed138,_0x16fc12,_0x3cdd0e){var _0x1f9ea1={'XMD-QUEUE':_0x15ef49['Queue']?_0x15ef49[_0xbc64('0x15')][_0xbc64('0x16')]:'','XMD-CALLERID':_0x1ed138,'XMD-CALLERID-PREVIEW':_0x3cdd0e?util[_0xbc64('0x11')](_0xbc64('0x12'),_0x3cdd0e[_0xbc64('0x17')],_0x3cdd0e[_0xbc64('0x18')]):_0x1ed138,'XMD-DIALID':_0x16fc12,'XMD-CONTACTID':_0x15ef49[_0xbc64('0x19')],'XMD-CDRTYPE':_0xbc64('0x1a'),'CALLERID(all)':_0x1ed138,'XMD-VOICEQUEUEID':_0x15ef49['VoiceQueueId'],'XMD-DIALCHANNEL':_0x5056b1,'XMD-DIALTIMEOUT':_0xbfa376[_0xbc64('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0xbc64('0x11')]('\x22rtTxX%s%s\x22',_0xbfa376[_0xbc64('0x1c')]?'g':'',_[_0xbc64('0x10')](_0xbfa376['monitor_format'])?'':_0xbc64('0x1d')),'XMD-DIALURL':_0xbfa376[_0xbc64('0x1e')]||'','XMD-AGI':_0xbfa376[_0xbc64('0x1f')]?util[_0xbc64('0x11')](_0xbc64('0x20'),ipAgi,_0xbfa376[_0xbc64('0x1f')]):_0xbc64('0x21'),'XMD-AGIAFTER':_0xbfa376[_0xbc64('0x1c')]?util[_0xbc64('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0xbfa376[_0xbc64('0x1c')]):_0xbc64('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x3cdd0e?_0x3cdd0e['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x3cdd0e?_0x3cdd0e[_0xbc64('0x22')]:'','XMD-DESTINATION':_0xbc64('0x23')};if(!_['isEmpty'](_0xbfa376['monitor_format'])){_0x1f9ea1[util[_0xbc64('0x11')]('%s',_0xbc64('0x24'))]=_0xbfa376[_0xbc64('0x25')];_0x1f9ea1[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x16fc12;}if(_0x15ef49&&_0x15ef49[_0xbc64('0x26')]){for(var _0x2bd790 in _0x15ef49[_0xbc64('0x26')]){if(_0x15ef49[_0xbc64('0x26')][_0xbc64('0x27')](_0x2bd790)){if(!_[_0xbc64('0x28')](_0x15ef49[_0xbc64('0x26')][_0x2bd790])&&_0x2bd790!=='id'&&_0x2bd790!==_0xbc64('0x29')&&_0x2bd790!==_0xbc64('0x2a')&&_0x2bd790!==_0xbc64('0x2b')){_0x1f9ea1[util[_0xbc64('0x11')](_0xbc64('0x2c'),_0xbc64('0x2d'),_['toUpper'](_0x2bd790))]=_0x15ef49['Contact'][_0x2bd790];}}}}return _0x1f9ea1;};exports['toLowerVariables']=function(_0x5b6a1c){var _0x2d74c6={};for(var _0x5af75b in _0x5b6a1c){if(_0x5b6a1c[_0xbc64('0x27')](_0x5af75b)){_0x2d74c6[util[_0xbc64('0x11')]('%s',_[_0xbc64('0x2e')](_0x5af75b))]=_0x5b6a1c[_0x5af75b];}}return{'variables':_0x2d74c6};};exports[_0xbc64('0x2f')]=function(_0x6b6002,_0x13bf2f){if(!_[_0xbc64('0x28')](_0x6b6002)){if(_0x6b6002[_0xbc64('0x27')]('originated')){if(_0x6b6002[_0xbc64('0x30')]>0x0){_0x6b6002[_0xbc64('0x30')]-=0x1;}else{logger[_0xbc64('0x7')](_0xbc64('0x31'),_0x13bf2f);}}}else{logger[_0xbc64('0x7')](_0xbc64('0x32'),_0x13bf2f);}};exports[_0xbc64('0x33')]=function(_0x186ff7){var _0x147f34=moment()['format'](_0xbc64('0x34'));_0x186ff7[_0xbc64('0x35')]=0xd;_0x186ff7[_0xbc64('0x36')]=_0xbc64('0x37');_0x186ff7[_0xbc64('0x38')]=_0x147f34;_0x186ff7[_0xbc64('0x39')]=_0x147f34;_0x186ff7[_0xbc64('0x3a')]=_0x147f34;};exports[_0xbc64('0x3b')]=function(_0x2604d4,_0x3df9d4,_0x547099){var _0x539ae1=moment()[_0xbc64('0x11')](_0xbc64('0x34'));_0x2604d4['state']=_0x3df9d4;_0x2604d4['statedesc']=_0x547099;_0x2604d4[_0xbc64('0x39')]=_0x539ae1;_0x2604d4[_0xbc64('0x3c')]=getSeconds(_0x2604d4['responsetime'],_0x2604d4[_0xbc64('0x38')]);};exports[_0xbc64('0x3d')]=function(_0x2b650e,_0x2e0a22,_0x163916){_0x2b650e['membername']=_0x2e0a22;_0x2b650e[_0xbc64('0x3e')]=_0x163916;};exports[_0xbc64('0x3f')]=function(_0x4cf6fc,_0x52d74c,_0x2ac0d0){var _0x3c7aad=moment()[_0xbc64('0x11')](_0xbc64('0x34'));_0x4cf6fc[_0xbc64('0x35')]=_0x52d74c;_0x4cf6fc['statedesc']=_0x2ac0d0;_0x4cf6fc[_0xbc64('0x39')]=_0x4cf6fc[_0xbc64('0x39')]?_0x4cf6fc['responsetime']:_0x3c7aad;_0x4cf6fc[_0xbc64('0x3a')]=_0x4cf6fc['endtime']?_0x4cf6fc[_0xbc64('0x3a')]:_0x3c7aad;_0x4cf6fc[_0xbc64('0x3c')]=getSeconds(_0x4cf6fc[_0xbc64('0x39')]||0x0,_0x4cf6fc[_0xbc64('0x38')]||0x0);_0x4cf6fc[_0xbc64('0x40')]=_0x4cf6fc[_0xbc64('0x41')]?getSeconds(_0x4cf6fc[_0xbc64('0x3a')],_0x4cf6fc['answertime']):0x0;};exports[_0xbc64('0x42')]=function(_0x564983){return _0x564983===_0xbc64('0x43');};exports[_0xbc64('0x44')]=function(_0x234130,_0x4c8000,_0x5cdfa1,_0x146a0c,_0x4d5e38){var _0x98b6fd=_0x146a0c?'RECALL':_0x234130['calleridname'];_0x98b6fd=_0x4d5e38?_0xbc64('0x45'):_0x98b6fd;return{'actionid':_0x234130[_0xbc64('0x46')],'action':_0xbc64('0x47'),'channel':_0x234130[_0xbc64('0x48')],'callerid':util[_0xbc64('0x11')](_0xbc64('0x12'),_0x98b6fd,_0x234130[_0xbc64('0x18')]),'Exten':_0xbc64('0x23'),'Context':_0xbc64('0x49'),'Priority':'1','variable':_0x5cdfa1,'timeout':(_0x4c8000[_0xbc64('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x234130[_0xbc64('0x46')]};};exports['totalGlobal']=function(_0x4236ad){return _0x4236ad[_0xbc64('0x4b')]+_0x4236ad[_0xbc64('0x4c')]+_0x4236ad[_0xbc64('0x4d')]+_0x4236ad['countagentrejectretry']+_0x4236ad[_0xbc64('0x4e')];};exports[_0xbc64('0x4f')]=function(_0x5cb244){var _0x4a44d0=_[_0xbc64('0x50')](_0x5cb244);_0x4a44d0[_0xbc64('0x35')]=0xf;_0x4a44d0[_0xbc64('0x36')]=_0xbc64('0x51');return _0x4a44d0;};exports[_0xbc64('0x52')]=function(_0x314d85,_0x1fe843,_0x4a81ba){var _0x127fca={};_0x127fca[_0x1fe843]=_0x314d85[_0x1fe843];_0x127fca[_0xbc64('0x53')]=![];_0x127fca[_0xbc64('0x54')]=moment()[_0xbc64('0x55')](_0x4a81ba,'minutes')['format'](_0xbc64('0x34'));_0x127fca[_0xbc64('0x19')]=_0x314d85[_0xbc64('0x19')];_0x127fca[_0xbc64('0x56')]=_0x314d85['ListId'];_0x127fca['VoiceQueueId']=_0x314d85[_0xbc64('0x57')]||undefined;return _0x127fca;};exports['decrementTalkink']=function(_0x205b7f,_0xdf9112){if(!_['isNil'](_0x205b7f)){if(_0x205b7f[_0xbc64('0x58')]>0x0){_0x205b7f[_0xbc64('0x58')]-=0x1;}else{logger[_0xbc64('0x7')](_0xdf9112,_0xbc64('0x59'));}}else{logger['error'](_0xdf9112,_0xbc64('0x5a'));}};exports['IsNotLoggedIn']=function(_0xf679a9){if(_0xf679a9<=0x0){return!![];}return![];};exports[_0xbc64('0x5b')]=function(_0x22f95c,_0x5b4cfa,_0x4069ec){_0x22f95c[_0xbc64('0x5c')]=_0x5b4cfa;_0x22f95c[_0xbc64('0x16')]=_0x22f95c['queue'];_0x22f95c[_0xbc64('0x5d')]=_0x22f95c[_0xbc64('0x48')];_0x22f95c[_0xbc64('0x5e')]=_0xbc64('0x5f');if(_0x4069ec){_0x22f95c[_0xbc64('0x60')]=_0x4069ec['mandatoryDisposition'];}return _0x22f95c;};exports[_0xbc64('0x61')]=function(_0x2c4279){var _0x4aa0e4={};_0x4aa0e4[_0xbc64('0x62')]=_0x2c4279[_0xbc64('0x62')];_0x4aa0e4[_0xbc64('0x5d')]=_0x2c4279['channelAgent'];_0x4aa0e4[_0xbc64('0x46')]=_0x2c4279[_0xbc64('0x46')];return _0x4aa0e4;};exports[_0xbc64('0x63')]=function(_0x2235eb){var _0x1647c8=[];for(var _0x54ae10 in _0x2235eb){if(_0x2235eb[_0xbc64('0x27')](_0x54ae10)){if(!_['isNil'](_0x2235eb[_0x54ae10])&&_0x2235eb[_0x54ae10][_0xbc64('0x35')]===_0xbc64('0x64')&&_0x2235eb[_0x54ae10][_0xbc64('0x65')]===_0xbc64('0x66')){_0x1647c8[_0xbc64('0x67')](_0x2235eb[_0x54ae10]['id']);}}}return _0x1647c8;};exports[_0xbc64('0x68')]=function(_0x5a3e14){var _0x49d661=moment()['milliseconds'](0x0);var _0x192e39=moment(_0x5a3e14)[_0xbc64('0x4')](0x0);return _0x49d661[_0xbc64('0x5')](_0x192e39,'seconds');};exports['createBody']=function(_0x2bf44a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2bf44a[_0xbc64('0x19')],'ListId':_0x2bf44a[_0xbc64('0x56')],'VoiceQueueId':_0x2bf44a[_0xbc64('0x57')]||undefined,'CampaignId':_0x2bf44a['CampaignId']||undefined};};exports[_0xbc64('0x69')]=function(_0x538cbd){if(_0x538cbd===_0xbc64('0x46')||_0x538cbd===_0xbc64('0x6a')||_0x538cbd===_0xbc64('0x62')||_0x538cbd===_0xbc64('0x6b')||_0x538cbd===_0xbc64('0x6c')||_0x538cbd===_0xbc64('0x6d')||_0x538cbd===_0xbc64('0x6e')||_0x538cbd===_0xbc64('0x48')||_0x538cbd===_0xbc64('0x17')||_0x538cbd===_0xbc64('0x53')||_0x538cbd==='calleridnum'||_0x538cbd==='scheduledat'||_0x538cbd===_0xbc64('0x4b')||_0x538cbd===_0xbc64('0x4c')||_0x538cbd===_0xbc64('0x4d')||_0x538cbd===_0xbc64('0x6f')||_0x538cbd===_0xbc64('0x70')||_0x538cbd===_0xbc64('0x71')||_0x538cbd==='callbackat'||_0x538cbd===_0xbc64('0x72')||_0x538cbd===_0xbc64('0x19')||_0x538cbd==='ListId'||_0x538cbd===_0xbc64('0x3e')||_0x538cbd==='VoiceQueueId'||_0x538cbd===_0xbc64('0x73')||_0x538cbd===_0xbc64('0x74')||_0x538cbd===_0xbc64('0x75')||_0x538cbd===_0xbc64('0x76')||_0x538cbd===_0xbc64('0x77')||_0x538cbd==='xmd-dialurl'||_0x538cbd===_0xbc64('0x78')||_0x538cbd===_0xbc64('0x79')||_0x538cbd===_0xbc64('0x7a')||_0x538cbd===_0xbc64('0x7b')||_0x538cbd===_0xbc64('0x7c')||_0x538cbd===_0xbc64('0x7d')||_0x538cbd===_0xbc64('0x7e')||_0x538cbd==='xmd-agiafter'||_0x538cbd===_0xbc64('0x7f')||_0x538cbd===_0xbc64('0x80')||_0x538cbd==='rtpaudioqosbridged'||_0x538cbd===_0xbc64('0x81')||_0x538cbd===_0xbc64('0x82')||_0x538cbd==='rtpaudioqosloss'||_0x538cbd==='rtpaudioqoslossbridged'||_0x538cbd==='rtpaudioqosrtt'||_0x538cbd===_0xbc64('0x83')||_0x538cbd==='rtpaudioqos'||_0x538cbd===_0xbc64('0x84')||_0x538cbd==='rtpaudioqosjitter'||_0x538cbd==='rtpaudioqosjitterbridged'||_0x538cbd===_0xbc64('0x85')||_0x538cbd===_0xbc64('0x86')||_0x538cbd===_0xbc64('0x87')||_0x538cbd===_0xbc64('0x83')||_0x538cbd===_0xbc64('0x88')||_0x538cbd===_0xbc64('0x89')||_0x538cbd===_0xbc64('0x35')||_0x538cbd===_0xbc64('0x36')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x3eb61b,_0x4dc166){var _0x1b213b,_0x3789f1,_0x1e93d7;if(_0x4dc166<=0x0){_0x4dc166=0x1;}_0x1b213b=new RegExp(_0xbc64('0x8a')+_0x4dc166+'}$');_0x3789f1=Math[_0xbc64('0x8b')](0xa,_0x4dc166-0x1);_0x1e93d7=Math['pow'](0xa,_0x4dc166)-0x1;return util[_0xbc64('0x11')]('%s',_[_0xbc64('0x8c')](_0x3eb61b,_0x1b213b,_['random'](_0x3789f1,_0x1e93d7)));};exports[_0xbc64('0x8d')]=function(_0x44ac86){var _0x4acc6e=_0x44ac86[_0xbc64('0x8e')](/"(.*?)"/);return _0x4acc6e?_0x4acc6e[0x1]:_0x44ac86;};exports[_0xbc64('0x8f')]=function(_0x25399d){var _0x457ac3=_0x25399d['match'](/<(.*?)>/);return _0x457ac3?_0x457ac3[0x1]:_0x25399d;}; \ No newline at end of file +var _0x1baa=['Blacklist','starttime','responsetime','endtime','logAgent','logLookAgent','membername','UserId','logCustomer','ringtime','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','Global','scheduledAt','active','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','motionChannel','voice','mandatoryDisposition','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countbusyretry','countglobal','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','preview','env','127.0.0.1','milliseconds','diff','seconds','loggerCatch','inspect','info','error','logger2','getCallerId','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x1baa,0x181));var _0xa1ba=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1baa[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0xa1ba('0x0'));var _=require(_0xa1ba('0x1'));var moment=require(_0xa1ba('0x2'));var logger=require('../../../../config/logger')(_0xa1ba('0x3'));var ipAgi=process[_0xa1ba('0x4')]['XCALLY_IP_AGI']||_0xa1ba('0x5');function getSeconds(_0x1929e1,_0x2bf40f){var _0x46cf44=moment(_0x1929e1)[_0xa1ba('0x6')](0x0);var _0x4ede17=moment(_0x2bf40f)[_0xa1ba('0x6')](0x0);return _0x46cf44[_0xa1ba('0x7')](_0x4ede17,_0xa1ba('0x8'));}exports[_0xa1ba('0x9')]=function(_0x2c982f){return function(_0x1708b0){logger['error'](_0x2c982f,util[_0xa1ba('0xa')](_0x1708b0,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5cfc07,_0xf3d69){logger[_0xa1ba('0xb')](_0x5cfc07,util[_0xa1ba('0xa')](_0xf3d69,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x4853aa,_0x5dd138){logger[_0xa1ba('0xc')](_0x4853aa,util[_0xa1ba('0xa')](_0x5dd138,{'showHidden':![],'depth':null}));};exports[_0xa1ba('0xd')]=function(_0x2cd629){return function(_0x3ca75c){logger[_0xa1ba('0xb')](_0x2cd629,util[_0xa1ba('0xa')](_0x3ca75c,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x2ec6f1,_0x7bd6b7,_0x3b68c0){return{'message':_0x2ec6f1,'unlock':_0x7bd6b7,'active':_0x3b68c0};};exports[_0xa1ba('0xe')]=function(_0x1d50e1,_0x363be1,_0x38baa){if(!_[_0xa1ba('0xf')](_0x38baa)&&'string'===typeof _0x38baa&&!_[_0xa1ba('0x10')](_0x38baa)){if(!_[_0xa1ba('0xf')](_0x363be1)&&'string'===typeof _0x363be1&&!_['isEmpty'](_0x363be1)){return util[_0xa1ba('0x11')](_0xa1ba('0x12'),_0x363be1,_0x38baa);}return util['format'](_0xa1ba('0x12'),_0x38baa,_0x38baa);}if(!_[_0xa1ba('0xf')](_0x1d50e1)&&_0xa1ba('0x13')===typeof _0x1d50e1&&!_[_0xa1ba('0x10')](_0x1d50e1)){return _0x1d50e1;}return _0xa1ba('0x14');};exports[_0xa1ba('0x15')]=function(_0x33a46e){if(_[_0xa1ba('0x16')](_0x33a46e)){return![];}return _0x33a46e;};exports[_0xa1ba('0x17')]=function(_0x745568,_0x514b4c,_0x26985a,_0x504107,_0x29940f,_0x4f6697){var _0xbc0640={'XMD-QUEUE':_0x514b4c['Queue']?_0x514b4c[_0xa1ba('0x18')]['name']:'','XMD-CALLERID':_0x504107,'XMD-CALLERID-PREVIEW':_0x4f6697?util['format'](_0xa1ba('0x12'),_0x4f6697[_0xa1ba('0x19')],_0x4f6697[_0xa1ba('0x1a')]):_0x504107,'XMD-DIALID':_0x29940f,'XMD-CONTACTID':_0x514b4c[_0xa1ba('0x1b')],'XMD-CDRTYPE':_0xa1ba('0x1c'),'CALLERID(all)':_0x504107,'XMD-VOICEQUEUEID':_0x514b4c[_0xa1ba('0x1d')],'XMD-DIALCHANNEL':_0x26985a,'XMD-DIALTIMEOUT':_0x745568[_0xa1ba('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xa1ba('0x11')](_0xa1ba('0x1f'),_0x745568[_0xa1ba('0x20')]?'g':'',_[_0xa1ba('0x10')](_0x745568[_0xa1ba('0x21')])?'':_0xa1ba('0x22')),'XMD-DIALURL':_0x745568[_0xa1ba('0x23')]||'','XMD-AGI':_0x745568[_0xa1ba('0x24')]?util[_0xa1ba('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x745568[_0xa1ba('0x24')]):_0xa1ba('0x25'),'XMD-AGIAFTER':_0x745568[_0xa1ba('0x20')]?util[_0xa1ba('0x11')](_0xa1ba('0x26'),ipAgi,_0x745568[_0xa1ba('0x20')]):_0xa1ba('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x4f6697?_0x4f6697[_0xa1ba('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x4f6697?_0x4f6697[_0xa1ba('0x28')]:'','XMD-DESTINATION':_0xa1ba('0x29')};if(!_[_0xa1ba('0x10')](_0x745568[_0xa1ba('0x21')])){_0xbc0640[util[_0xa1ba('0x11')]('%s',_0xa1ba('0x2a'))]=_0x745568[_0xa1ba('0x21')];_0xbc0640[util[_0xa1ba('0x11')]('%s',_0xa1ba('0x2b'))]=_0x29940f;}if(_0x514b4c&&_0x514b4c[_0xa1ba('0x2c')]){for(var _0x5f1d5a in _0x514b4c[_0xa1ba('0x2c')]){if(_0x514b4c[_0xa1ba('0x2c')][_0xa1ba('0x2d')](_0x5f1d5a)){if(!_['isNil'](_0x514b4c['Contact'][_0x5f1d5a])&&_0x5f1d5a!=='id'&&_0x5f1d5a!==_0xa1ba('0x2e')&&_0x5f1d5a!==_0xa1ba('0x2f')&&_0x5f1d5a!==_0xa1ba('0x30')){_0xbc0640[util['format'](_0xa1ba('0x31'),_0xa1ba('0x32'),_[_0xa1ba('0x33')](_0x5f1d5a))]=_0x514b4c[_0xa1ba('0x2c')][_0x5f1d5a];}}}}return _0xbc0640;};exports[_0xa1ba('0x34')]=function(_0x11c114){var _0x353d43={};for(var _0x34e0d1 in _0x11c114){if(_0x11c114[_0xa1ba('0x2d')](_0x34e0d1)){_0x353d43[util[_0xa1ba('0x11')]('%s',_[_0xa1ba('0x35')](_0x34e0d1))]=_0x11c114[_0x34e0d1];}}return{'variables':_0x353d43};};exports[_0xa1ba('0x36')]=function(_0xc00560,_0x45566f){if(!_[_0xa1ba('0x16')](_0xc00560)){if(_0xc00560[_0xa1ba('0x2d')](_0xa1ba('0x37'))){if(_0xc00560[_0xa1ba('0x37')]>0x0){_0xc00560['originated']-=0x1;}else{logger[_0xa1ba('0xc')](_0xa1ba('0x38'),_0x45566f);}}}else{logger['error'](_0xa1ba('0x39'),_0x45566f);}};exports[_0xa1ba('0x3a')]=function(_0x41650c){var _0x35ceb9=moment()[_0xa1ba('0x11')](_0xa1ba('0x3b'));_0x41650c[_0xa1ba('0x3c')]=0xd;_0x41650c[_0xa1ba('0x3d')]=_0xa1ba('0x3e');_0x41650c[_0xa1ba('0x3f')]=_0x35ceb9;_0x41650c[_0xa1ba('0x40')]=_0x35ceb9;_0x41650c[_0xa1ba('0x41')]=_0x35ceb9;};exports[_0xa1ba('0x42')]=function(_0x117b56,_0x4b215e,_0x170aba){var _0x56aad3=moment()[_0xa1ba('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x117b56[_0xa1ba('0x3c')]=_0x4b215e;_0x117b56[_0xa1ba('0x3d')]=_0x170aba;_0x117b56['responsetime']=_0x56aad3;_0x117b56['ringtime']=getSeconds(_0x117b56[_0xa1ba('0x40')],_0x117b56[_0xa1ba('0x3f')]);};exports[_0xa1ba('0x43')]=function(_0x4a27e8,_0x4cc15b,_0x2de840){_0x4a27e8[_0xa1ba('0x44')]=_0x4cc15b;_0x4a27e8[_0xa1ba('0x45')]=_0x2de840;};exports[_0xa1ba('0x46')]=function(_0x22f76c,_0x450ada,_0x2bbcbc){var _0x5d8b95=moment()[_0xa1ba('0x11')](_0xa1ba('0x3b'));_0x22f76c[_0xa1ba('0x3c')]=_0x450ada;_0x22f76c['statedesc']=_0x2bbcbc;_0x22f76c[_0xa1ba('0x40')]=_0x22f76c['responsetime']?_0x22f76c[_0xa1ba('0x40')]:_0x5d8b95;_0x22f76c['endtime']=_0x22f76c['endtime']?_0x22f76c[_0xa1ba('0x41')]:_0x5d8b95;_0x22f76c[_0xa1ba('0x47')]=getSeconds(_0x22f76c[_0xa1ba('0x40')]||0x0,_0x22f76c[_0xa1ba('0x3f')]||0x0);_0x22f76c[_0xa1ba('0x48')]=_0x22f76c[_0xa1ba('0x49')]?getSeconds(_0x22f76c[_0xa1ba('0x41')],_0x22f76c[_0xa1ba('0x49')]):0x0;};exports[_0xa1ba('0x4a')]=function(_0x213a15){return _0x213a15===_0xa1ba('0x4b');};exports['variablesAction']=function(_0x343808,_0x772f15,_0x493504,_0x5b362c,_0x56fb90){var _0x46cf7b=_0x5b362c?_0xa1ba('0x4c'):_0x343808[_0xa1ba('0x19')];_0x46cf7b=_0x56fb90?_0xa1ba('0x4d'):_0x46cf7b;return{'actionid':_0x343808[_0xa1ba('0x4e')],'action':_0xa1ba('0x4f'),'channel':_0x343808[_0xa1ba('0x50')],'callerid':util[_0xa1ba('0x11')](_0xa1ba('0x12'),_0x46cf7b,_0x343808['calleridnum']),'Exten':_0xa1ba('0x29'),'Context':_0xa1ba('0x51'),'Priority':'1','variable':_0x493504,'timeout':(_0x772f15[_0xa1ba('0x52')]||0x1e)*0x3e8,'async':!![],'channelid':_0x343808[_0xa1ba('0x4e')]};};exports['totalGlobal']=function(_0x3d96cb){return _0x3d96cb['countbusyretry']+_0x3d96cb[_0xa1ba('0x53')]+_0x3d96cb[_0xa1ba('0x54')]+_0x3d96cb[_0xa1ba('0x55')]+_0x3d96cb['countnosuchnumberretry'];};exports[_0xa1ba('0x56')]=function(_0x20dd65){var _0x161a97=_['clone'](_0x20dd65);_0x161a97[_0xa1ba('0x3c')]=0xf;_0x161a97[_0xa1ba('0x3d')]=_0xa1ba('0x57');return _0x161a97;};exports[_0xa1ba('0x58')]=function(_0x3957ca,_0x4969e6,_0x5b2069){var _0x42946c={};_0x42946c[_0x4969e6]=_0x3957ca[_0x4969e6];_0x42946c[_0xa1ba('0x59')]=![];_0x42946c[_0xa1ba('0x5a')]=moment()[_0xa1ba('0x5b')](_0x5b2069,_0xa1ba('0x5c'))[_0xa1ba('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x42946c[_0xa1ba('0x1b')]=_0x3957ca['ContactId'];_0x42946c[_0xa1ba('0x5d')]=_0x3957ca[_0xa1ba('0x5d')];_0x42946c['VoiceQueueId']=_0x3957ca[_0xa1ba('0x1d')]||undefined;return _0x42946c;};exports['decrementTalkink']=function(_0x559057,_0x3a1157){if(!_[_0xa1ba('0x16')](_0x559057)){if(_0x559057[_0xa1ba('0x5e')]>0x0){_0x559057[_0xa1ba('0x5e')]-=0x1;}else{logger[_0xa1ba('0xc')](_0x3a1157,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xa1ba('0xc')](_0x3a1157,_0xa1ba('0x5f'));}};exports[_0xa1ba('0x60')]=function(_0x1508fb){if(_0x1508fb<=0x0){return!![];}return![];};exports[_0xa1ba('0x61')]=function(_0x2fd84c,_0x24c5e2,_0x16e945){_0x2fd84c[_0xa1ba('0x62')]=_0x24c5e2;_0x2fd84c[_0xa1ba('0x63')]=_0x2fd84c[_0xa1ba('0x64')];_0x2fd84c['interface']=_0x2fd84c[_0xa1ba('0x50')];_0x2fd84c[_0xa1ba('0x65')]=_0xa1ba('0x66');if(_0x16e945){_0x2fd84c[_0xa1ba('0x67')]=_0x16e945['mandatoryDisposition'];}return _0x2fd84c;};exports['buildAcw']=function(_0x4b2dbf){var _0x6a1db2={};_0x6a1db2[_0xa1ba('0x64')]=_0x4b2dbf[_0xa1ba('0x64')];_0x6a1db2[_0xa1ba('0x68')]=_0x4b2dbf['channelAgent'];_0x6a1db2[_0xa1ba('0x4e')]=_0x4b2dbf[_0xa1ba('0x4e')];return _0x6a1db2;};exports[_0xa1ba('0x69')]=function(_0x2629ba){var _0x3aea47=[];for(var _0xbc437d in _0x2629ba){if(_0x2629ba[_0xa1ba('0x2d')](_0xbc437d)){if(!_[_0xa1ba('0x16')](_0x2629ba[_0xbc437d])&&_0x2629ba[_0xbc437d]['state']===_0xa1ba('0x6a')&&_0x2629ba[_0xbc437d][_0xa1ba('0x6b')]===_0xa1ba('0x6c')){_0x3aea47[_0xa1ba('0x6d')](_0x2629ba[_0xbc437d]['id']);}}}return _0x3aea47;};exports[_0xa1ba('0x6e')]=function(_0x4ebabb){var _0x31a395=moment()[_0xa1ba('0x6')](0x0);var _0x5b0389=moment(_0x4ebabb)[_0xa1ba('0x6')](0x0);return _0x31a395[_0xa1ba('0x7')](_0x5b0389,_0xa1ba('0x8'));};exports[_0xa1ba('0x6f')]=function(_0x2cd545){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2cd545[_0xa1ba('0x1b')],'ListId':_0x2cd545[_0xa1ba('0x5d')],'VoiceQueueId':_0x2cd545[_0xa1ba('0x1d')]||undefined,'CampaignId':_0x2cd545[_0xa1ba('0x70')]||undefined};};exports[_0xa1ba('0x71')]=function(_0x58abbe){if(_0x58abbe===_0xa1ba('0x4e')||_0x58abbe===_0xa1ba('0x72')||_0x58abbe===_0xa1ba('0x64')||_0x58abbe===_0xa1ba('0x73')||_0x58abbe===_0xa1ba('0x74')||_0x58abbe===_0xa1ba('0x75')||_0x58abbe===_0xa1ba('0x44')||_0x58abbe===_0xa1ba('0x50')||_0x58abbe===_0xa1ba('0x19')||_0x58abbe===_0xa1ba('0x59')||_0x58abbe===_0xa1ba('0x1a')||_0x58abbe===_0xa1ba('0x5a')||_0x58abbe===_0xa1ba('0x76')||_0x58abbe===_0xa1ba('0x53')||_0x58abbe==='countnoanswerretry'||_0x58abbe===_0xa1ba('0x77')||_0x58abbe==='callback'||_0x58abbe===_0xa1ba('0x78')||_0x58abbe===_0xa1ba('0x79')||_0x58abbe===_0xa1ba('0x7a')||_0x58abbe===_0xa1ba('0x1b')||_0x58abbe===_0xa1ba('0x5d')||_0x58abbe===_0xa1ba('0x45')||_0x58abbe===_0xa1ba('0x1d')||_0x58abbe==='sipcallid'||_0x58abbe===_0xa1ba('0x7b')||_0x58abbe===_0xa1ba('0x7c')||_0x58abbe===_0xa1ba('0x7d')||_0x58abbe==='xmd-listid'||_0x58abbe===_0xa1ba('0x7e')||_0x58abbe===_0xa1ba('0x7f')||_0x58abbe===_0xa1ba('0x80')||_0x58abbe===_0xa1ba('0x81')||_0x58abbe==='xmd-dialchannel'||_0x58abbe===_0xa1ba('0x82')||_0x58abbe===_0xa1ba('0x83')||_0x58abbe===_0xa1ba('0x84')||_0x58abbe==='xmd-agiafter'||_0x58abbe==='xmd-agi'||_0x58abbe==='rtpaudioqos'||_0x58abbe===_0xa1ba('0x85')||_0x58abbe===_0xa1ba('0x86')||_0x58abbe==='rtpaudioqosjitterbridged'||_0x58abbe==='rtpaudioqosloss'||_0x58abbe==='rtpaudioqoslossbridged'||_0x58abbe===_0xa1ba('0x87')||_0x58abbe===_0xa1ba('0x88')||_0x58abbe===_0xa1ba('0x89')||_0x58abbe===_0xa1ba('0x85')||_0x58abbe==='rtpaudioqosjitter'||_0x58abbe===_0xa1ba('0x8a')||_0x58abbe===_0xa1ba('0x8b')||_0x58abbe===_0xa1ba('0x8c')||_0x58abbe==='rtpaudioqosrtt'||_0x58abbe===_0xa1ba('0x88')||_0x58abbe===_0xa1ba('0x8d')||_0x58abbe===_0xa1ba('0x8e')||_0x58abbe==='state'||_0x58abbe==='statedesc'){return![];}return!![];};exports[_0xa1ba('0x8f')]=function(_0x249f5b,_0x3611a7){var _0x3ac1c5,_0x58fd2c,_0x387361;if(_0x3611a7<=0x0){_0x3611a7=0x1;}_0x3ac1c5=new RegExp('\x5cw{0,'+_0x3611a7+'}$');_0x58fd2c=Math['pow'](0xa,_0x3611a7-0x1);_0x387361=Math[_0xa1ba('0x90')](0xa,_0x3611a7)-0x1;return util[_0xa1ba('0x11')]('%s',_[_0xa1ba('0x91')](_0x249f5b,_0x3ac1c5,_['random'](_0x58fd2c,_0x387361)));};exports[_0xa1ba('0x92')]=function(_0x385b5e){var _0x1216d6=_0x385b5e[_0xa1ba('0x93')](/"(.*?)"/);return _0x1216d6?_0x1216d6[0x1]:_0x385b5e;};exports[_0xa1ba('0x94')]=function(_0x3541d7){var _0x5b0278=_0x3541d7[_0xa1ba('0x93')](/<(.*?)>/);return _0x5b0278?_0x5b0278[0x1]:_0x3541d7;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 34625fd..07063bc 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 _0x531f=['voicequeuechannelredirect','queueadd','string','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x531f,0x65));var _0xf531=function(_0x11eb1f,_0x826f0b){_0x11eb1f=_0x11eb1f-0x0;var _0x2121e9=_0x531f[_0x11eb1f];return _0x2121e9;};'use strict';exports[_0xf531('0x0')]={'queue':{'type':_0xf531('0x1'),'required':!![]},'interface':{'type':_0xf531('0x1'),'required':!![]},'membername':{'type':_0xf531('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xf531('0x2'),'required':![]}};exports[_0xf531('0x3')]={'queue':{'type':_0xf531('0x1'),'required':!![]},'interface':{'type':_0xf531('0x1'),'required':!![]}};exports[_0xf531('0x4')]={'interface':{'type':_0xf531('0x1'),'required':!![]},'paused':{'type':_0xf531('0x2')},'reason':{'type':_0xf531('0x1'),'required':![]}};exports[_0xf531('0x5')]={'module':{'type':_0xf531('0x1'),'required':![]}};exports[_0xf531('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf531('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xf531('0x1')},'format':{'type':_0xf531('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xf531('0x8')]={'uniqueid':{'type':_0xf531('0x1'),'required':!![]}};exports[_0xf531('0x9')]={'uniqueid':{'type':_0xf531('0x1'),'required':!![]},'exten':{'type':_0xf531('0x1'),'required':!![]},'context':{'type':_0xf531('0x1')}}; \ No newline at end of file +var _0x5e57=['queueremove','reload','voicechannel','voicequeuechannelhangup','queueadd','string','number'];(function(_0x50d2a0,_0x13168b){var _0x11fe24=function(_0x1d67c4){while(--_0x1d67c4){_0x50d2a0['push'](_0x50d2a0['shift']());}};_0x11fe24(++_0x13168b);}(_0x5e57,0x1bd));var _0x75e5=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5e57[_0x42cae2];return _0x5f256f;};'use strict';exports[_0x75e5('0x0')]={'queue':{'type':_0x75e5('0x1'),'required':!![]},'interface':{'type':_0x75e5('0x1'),'required':!![]},'membername':{'type':_0x75e5('0x1'),'required':!![]},'penalty':{'type':_0x75e5('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x75e5('0x3')]={'queue':{'type':_0x75e5('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0x75e5('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x75e5('0x1'),'required':![]}};exports[_0x75e5('0x4')]={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x75e5('0x1'),'required':!![]}};exports[_0x75e5('0x5')]={'uniqueid':{'type':_0x75e5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x75e5('0x1')},'mixmonitorid':{'type':_0x75e5('0x1')}};exports[_0x75e5('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x75e5('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 3bdc897..24cd5b0 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 _0x5b3f=['../model/salesforceAccount','../model/sugarcrmAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','agents','telephones','trunks','voiceQueues','campaigns','templates','outbound','channels','timers','settings','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','interface','format','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isNil','SIP/%s','name','isUndefined','initTelephones','initVoiceQueues','initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initVtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','total','queuecallercomplete','duration','disposition','ANSWERED','answered','billableseconds','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount'];(function(_0x543c3c,_0x321cbb){var _0xf836c0=function(_0x1911ca){while(--_0x1911ca){_0x543c3c['push'](_0x543c3c['shift']());}};_0xf836c0(++_0x321cbb);}(_0x5b3f,0x12c));var _0xf5b3=function(_0x275212,_0x5ad8ea){_0x275212=_0x275212-0x0;var _0x202258=_0x5b3f[_0x275212];return _0x202258;};'use strict';var BPromise=require(_0xf5b3('0x0'));var util=require(_0xf5b3('0x1'));var _=require(_0xf5b3('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xf5b3('0x3'));var Trigger=require(_0xf5b3('0x4'));var Template=require(_0xf5b3('0x5'));var Campaign=require(_0xf5b3('0x6'));var VoiceExtension=require(_0xf5b3('0x7'));var ZendeskAccount=require(_0xf5b3('0x8'));var SalesforceAccount=require(_0xf5b3('0x9'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xf5b3('0xa'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xf5b3('0xb'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xf5b3('0xc'));var Dynamics365Account=require(_0xf5b3('0xd'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xf5b3('0xe')]={};this[_0xf5b3('0xf')]={};this[_0xf5b3('0x10')]={};this[_0xf5b3('0x11')]={};this['triggers']={};this[_0xf5b3('0x12')]={};this[_0xf5b3('0x13')]={};this[_0xf5b3('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5b3('0x15')]={};this['queueChannels']={};this['outboundChannels']={};this[_0xf5b3('0x16')]={};this[_0xf5b3('0x17')]={};this['zendeskAccounts']={};this[_0xf5b3('0x18')]={};this[_0xf5b3('0x19')]={};this[_0xf5b3('0x1a')]={};this[_0xf5b3('0x1b')]={};this[_0xf5b3('0x1c')]={};this[_0xf5b3('0x1d')]={};this[_0xf5b3('0x1e')]={};this[_0xf5b3('0x1f')]={};this[_0xf5b3('0x20')]={};this[_0xf5b3('0x21')]={};};function freeIsNotKey(_0x2f19e6,_0x263106,_0x48c9bc){var _0x5946fd=_[_0xf5b3('0x22')](_0x2f19e6,function(_0x232f4a,_0x3d4ca2){return _0x232f4a[_0x48c9bc];});for(var _0x2c4419 in _0x263106){if(_0x263106[_0xf5b3('0x23')](_0x2c4419)){if(!_0x5946fd[_0x2c4419]){delete _0x263106[_0x2c4419];}}}}function freeIsNotKeySip(_0xa72392,_0x39b675){var _0x2e7269=_['mapKeys'](_0xa72392,function(_0x2e005f,_0x1b7d99){return util['format']('SIP/%s',_0x2e005f['name']);});for(var _0x3fd73c in _0x39b675){if(_0x39b675[_0xf5b3('0x23')](_0x3fd73c)){if(!_0x2e7269[_0x3fd73c]){delete _0x39b675[_0x3fd73c];}}}}function freeIsNotKeyAgent(_0x4e5474,_0x534000){var _0x58803c=_['mapKeys'](_0x4e5474,function(_0x3c2f22,_0x455ea7){var _0x25dc8c=_['isNil'](_0x3c2f22[_0xf5b3('0x24')])?util[_0xf5b3('0x25')]('SIP/%s',_0x3c2f22['name']):_0x3c2f22[_0xf5b3('0x24')];return _0x25dc8c;});for(var _0x4c6d85 in _0x534000){if(_0x534000[_0xf5b3('0x23')](_0x4c6d85)){if(!_0x58803c[_0x4c6d85]){delete _0x534000[_0x4c6d85];}}}}function clearVoiceCallReports(_0x10dc05){_0x10dc05['total']=0x0;_0x10dc05['answered']=0x0;_0x10dc05[_0xf5b3('0x26')]=0x0;_0x10dc05[_0xf5b3('0x27')]=0x0;_0x10dc05[_0xf5b3('0x28')]=0x0;}function clearCampaigns(_0x12a106){if(!_[_0xf5b3('0x29')](_0x12a106)){for(var _0x75e981 in _0x12a106){if(_0x12a106[_0xf5b3('0x23')](_0x75e981)){_0x12a106[_0x75e981]['ivrTotalCallsDays']=0x0;_0x12a106[_0x75e981][_0xf5b3('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x4f3887){if(!_['isEmpty'](_0x4f3887)){for(var _0x2533ac in _0x4f3887){if(_0x4f3887[_0xf5b3('0x23')](_0x2533ac)){_0x4f3887[_0x2533ac]['total']=0x0;_0x4f3887[_0x2533ac]['answered']=0x0;_0x4f3887[_0x2533ac][_0xf5b3('0x2b')]=0x0;_0x4f3887[_0x2533ac][_0xf5b3('0x2c')]=0x0;_0x4f3887[_0x2533ac][_0xf5b3('0x26')]=0x0;_0x4f3887[_0x2533ac]['sumDuration']=0x0;_0x4f3887[_0x2533ac]['sumBillable']=0x0;_0x4f3887[_0x2533ac][_0xf5b3('0x2d')]=0x0;_0x4f3887[_0x2533ac][_0xf5b3('0x2e')]=0x0;_0x4f3887[_0x2533ac]['outboundBusyCallsDay']=0x0;_0x4f3887[_0x2533ac][_0xf5b3('0x2f')]=0x0;_0x4f3887[_0x2533ac]['outboundNoSuchCallsDay']=0x0;_0x4f3887[_0x2533ac]['outboundUnknownCallsDay']=0x0;_0x4f3887[_0x2533ac][_0xf5b3('0x30')]=0x0;_0x4f3887[_0x2533ac][_0xf5b3('0x31')]=0x0;_0x4f3887[_0x2533ac][_0xf5b3('0x32')]=0x0;_0x4f3887[_0x2533ac][_0xf5b3('0x33')]=0x0;_0x4f3887[_0x2533ac][_0xf5b3('0x34')]=0x0;_0x4f3887[_0x2533ac][_0xf5b3('0x35')]=0x0;_0x4f3887[_0x2533ac][_0xf5b3('0x2d')]=0x0;_0x4f3887[_0x2533ac][_0xf5b3('0x36')]=0x0;_0x4f3887[_0x2533ac][_0xf5b3('0x37')]=!![];}}}}Realtime[_0xf5b3('0x38')][_0xf5b3('0x39')]=function(_0x5312f4,_0x4a33b9){for(var _0x2dab78 in _0x4a33b9){if(_0x5312f4[_0xf5b3('0x23')](_0x2dab78)){_0x5312f4[_0x2dab78]=_0x4a33b9[_0x2dab78];}}};Realtime[_0xf5b3('0x38')]['initAgents']=function(){var _0x282eb0=this;return function(_0x26d822){if(_0x26d822){freeIsNotKeyAgent(_0x26d822,_0x282eb0['agents']);for(var _0x3cfa11=0x0,_0x96a92a={},_0x6e5474={};_0x3cfa11<_0x26d822[_0xf5b3('0x3a')];_0x3cfa11+=0x1){_0x96a92a=_0x26d822[_0x3cfa11];var _0x28fc9a=_[_0xf5b3('0x3b')](_0x96a92a[_0xf5b3('0x24')])?util[_0xf5b3('0x25')](_0xf5b3('0x3c'),_0x96a92a[_0xf5b3('0x3d')]):_0x96a92a[_0xf5b3('0x24')];if(_[_0xf5b3('0x3e')](_0x282eb0[_0xf5b3('0xe')][_0x28fc9a])){_0x282eb0['agents'][_0x28fc9a]=new Agent(_0x96a92a);}else{_0x282eb0['mergeFromDatabase'](_0x282eb0[_0xf5b3('0xe')][_0x28fc9a],_0x96a92a);}}}return _0x282eb0['agents'];};};Realtime[_0xf5b3('0x38')][_0xf5b3('0x3f')]=function(){var _0xb53a56=this;return function(_0x461475){if(_0x461475){freeIsNotKeySip(_0x461475,_0xb53a56['telephones']);for(var _0x134606=0x0,_0x41660a={},_0x52fd09={};_0x134606<_0x461475[_0xf5b3('0x3a')];_0x134606+=0x1){_0x41660a=_0x461475[_0x134606];if(_[_0xf5b3('0x3e')](_0xb53a56['telephones'][util[_0xf5b3('0x25')](_0xf5b3('0x3c'),_0x41660a[_0xf5b3('0x3d')])])){_0xb53a56[_0xf5b3('0xf')][util[_0xf5b3('0x25')](_0xf5b3('0x3c'),_0x41660a[_0xf5b3('0x3d')])]=new Telephone(_0x41660a);}else{_0xb53a56['mergeFromDatabase'](_0xb53a56[_0xf5b3('0xf')][util['format'](_0xf5b3('0x3c'),_0x41660a[_0xf5b3('0x3d')])],_0x41660a);}}}return _0xb53a56['telephones'];};};Realtime[_0xf5b3('0x38')]['initTrunks']=function(){var _0x16ab50=this;return function(_0x16b943){if(_0x16b943){freeIsNotKeySip(_0x16b943,_0x16ab50[_0xf5b3('0x10')]);for(var _0x1f6f23=0x0,_0x4e6577={},_0x1922ed={};_0x1f6f23<_0x16b943[_0xf5b3('0x3a')];_0x1f6f23+=0x1){_0x4e6577=_0x16b943[_0x1f6f23];if(_[_0xf5b3('0x3e')](_0x16ab50['trunks'][util[_0xf5b3('0x25')](_0xf5b3('0x3c'),_0x4e6577[_0xf5b3('0x3d')])])){_0x16ab50[_0xf5b3('0x10')][util[_0xf5b3('0x25')](_0xf5b3('0x3c'),_0x4e6577['name'])]=new Trunk(_0x4e6577);}else{_0x16ab50[_0xf5b3('0x39')](_0x16ab50[_0xf5b3('0x10')][util[_0xf5b3('0x25')](_0xf5b3('0x3c'),_0x4e6577[_0xf5b3('0x3d')])],_0x4e6577);}}}return _0x16ab50['trunks'];};};Realtime[_0xf5b3('0x38')][_0xf5b3('0x40')]=function(){var _0x576fbb=this;return function(_0x1fcb1e){if(_0x1fcb1e){freeIsNotKey(_0x1fcb1e,_0x576fbb[_0xf5b3('0x11')],_0xf5b3('0x3d'));for(var _0x3be0a2=0x0,_0x221a3a={},_0x43a055={};_0x3be0a2<_0x1fcb1e[_0xf5b3('0x3a')];_0x3be0a2+=0x1){_0x221a3a=_0x1fcb1e[_0x3be0a2];if(_[_0xf5b3('0x3e')](_0x576fbb['voiceQueues'][_0x221a3a[_0xf5b3('0x3d')]])){_0x576fbb[_0xf5b3('0x11')][_0x221a3a[_0xf5b3('0x3d')]]=new VoiceQueue(_0x221a3a);}else{_0x576fbb[_0xf5b3('0x39')](_0x576fbb[_0xf5b3('0x11')][_0x221a3a['name']],_0x221a3a);}}}return _0x576fbb[_0xf5b3('0x11')];};};Realtime[_0xf5b3('0x38')][_0xf5b3('0x41')]=function(){var _0x47b3d3=this;return function(_0x54e51f){if(_0x54e51f){freeIsNotKey(_0x54e51f,_0x47b3d3[_0xf5b3('0x42')],'id');for(var _0x5be6e5=0x0,_0x423689={},_0x57d309={};_0x5be6e5<_0x54e51f[_0xf5b3('0x3a')];_0x5be6e5+=0x1){_0x423689=_0x54e51f[_0x5be6e5];if(_[_0xf5b3('0x3e')](_0x47b3d3['triggers'][_0x423689['id']])){_0x47b3d3['triggers'][_0x423689['id']]=new Trigger(_0x423689);}else{_0x47b3d3[_0xf5b3('0x39')](_0x47b3d3[_0xf5b3('0x42')][_0x423689['id']],_0x423689);}}}return _0x47b3d3['triggers'];};};Realtime[_0xf5b3('0x38')][_0xf5b3('0x43')]=function(){var _0xdcf7f6=this;return function(_0x52da42){if(_0x52da42){freeIsNotKey(_0x52da42,_0xdcf7f6['templates'],'id');for(var _0x794c29=0x0,_0x233e1e={},_0x53b00d={};_0x794c29<_0x52da42[_0xf5b3('0x3a')];_0x794c29+=0x1){_0x233e1e=_0x52da42[_0x794c29];if(_['isUndefined'](_0xdcf7f6[_0xf5b3('0x13')][_0x233e1e['id']])){_0xdcf7f6[_0xf5b3('0x13')][_0x233e1e['id']]=new Template(_0x233e1e);}else{_0xdcf7f6[_0xf5b3('0x39')](_0xdcf7f6[_0xf5b3('0x13')][_0x233e1e['id']],_0x233e1e);}}}return _0xdcf7f6[_0xf5b3('0x13')];};};Realtime[_0xf5b3('0x38')][_0xf5b3('0x44')]=function(){var _0x341622=this;return function(_0x320102){if(_0x320102){freeIsNotKey(_0x320102,_0x341622['zendeskAccounts'],'id');for(var _0x2b2874=0x0,_0x7010b0={},_0x25e629={};_0x2b2874<_0x320102[_0xf5b3('0x3a')];_0x2b2874+=0x1){_0x7010b0=_0x320102[_0x2b2874];if(_[_0xf5b3('0x3e')](_0x341622['zendeskAccounts'][_0x7010b0['id']])){_0x341622[_0xf5b3('0x45')][_0x7010b0['id']]=new ZendeskAccount(_0x7010b0);}else{_0x341622[_0xf5b3('0x39')](_0x341622['zendeskAccounts'][_0x7010b0['id']],_0x7010b0);}}}return _0x341622[_0xf5b3('0x45')];};};Realtime[_0xf5b3('0x38')][_0xf5b3('0x46')]=function(){var _0x5ce756=this;return function(_0x44d376){if(_0x44d376){freeIsNotKey(_0x44d376,_0x5ce756[_0xf5b3('0x18')],'id');for(var _0x36f1e4=0x0,_0x27ce97={},_0x7311db={};_0x36f1e4<_0x44d376[_0xf5b3('0x3a')];_0x36f1e4+=0x1){_0x27ce97=_0x44d376[_0x36f1e4];if(_[_0xf5b3('0x3e')](_0x5ce756['salesforceAccounts'][_0x27ce97['id']])){_0x5ce756[_0xf5b3('0x18')][_0x27ce97['id']]=new SalesforceAccount(_0x27ce97);}else{_0x5ce756[_0xf5b3('0x39')](_0x5ce756[_0xf5b3('0x18')][_0x27ce97['id']],_0x27ce97);}}}return _0x5ce756[_0xf5b3('0x18')];};};Realtime[_0xf5b3('0x38')][_0xf5b3('0x47')]=function(){var _0xef9cb7=this;return function(_0x1101d5){if(_0x1101d5){freeIsNotKey(_0x1101d5,_0xef9cb7[_0xf5b3('0x1a')],'id');for(var _0x4e653d=0x0,_0x322326={},_0x1dd3b0={};_0x4e653d<_0x1101d5[_0xf5b3('0x3a')];_0x4e653d+=0x1){_0x322326=_0x1101d5[_0x4e653d];if(_[_0xf5b3('0x3e')](_0xef9cb7['freshdeskAccounts'][_0x322326['id']])){_0xef9cb7['freshdeskAccounts'][_0x322326['id']]=new FreshdeskAccount(_0x322326);}else{_0xef9cb7[_0xf5b3('0x39')](_0xef9cb7[_0xf5b3('0x1a')][_0x322326['id']],_0x322326);}}}return _0xef9cb7[_0xf5b3('0x1a')];};};Realtime[_0xf5b3('0x38')]['initZohoAccounts']=function(){var _0x5926c6=this;return function(_0x52cd11){if(_0x52cd11){freeIsNotKey(_0x52cd11,_0x5926c6['zohoAccounts'],'id');for(var _0x1ac189=0x0,_0x1fb74a={},_0x59336f={};_0x1ac189<_0x52cd11[_0xf5b3('0x3a')];_0x1ac189+=0x1){_0x1fb74a=_0x52cd11[_0x1ac189];if(_[_0xf5b3('0x3e')](_0x5926c6['zohoAccounts'][_0x1fb74a['id']])){_0x5926c6[_0xf5b3('0x1b')][_0x1fb74a['id']]=new ZohoAccount(_0x1fb74a);}else{_0x5926c6[_0xf5b3('0x39')](_0x5926c6[_0xf5b3('0x1b')][_0x1fb74a['id']],_0x1fb74a);}}}return _0x5926c6[_0xf5b3('0x1b')];};};Realtime[_0xf5b3('0x38')]['initDeskAccounts']=function(){var _0x5266bb=this;return function(_0x5b4bdf){if(_0x5b4bdf){freeIsNotKey(_0x5b4bdf,_0x5266bb[_0xf5b3('0x1c')],'id');for(var _0xa45916=0x0,_0x2b4276={},_0x14c527={};_0xa45916<_0x5b4bdf[_0xf5b3('0x3a')];_0xa45916+=0x1){_0x2b4276=_0x5b4bdf[_0xa45916];if(_[_0xf5b3('0x3e')](_0x5266bb['deskAccounts'][_0x2b4276['id']])){_0x5266bb[_0xf5b3('0x1c')][_0x2b4276['id']]=new DeskAccount(_0x2b4276);}else{_0x5266bb['mergeFromDatabase'](_0x5266bb['deskAccounts'][_0x2b4276['id']],_0x2b4276);}}}return _0x5266bb[_0xf5b3('0x1c')];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x3073e0=this;return function(_0x5650a0){if(_0x5650a0){freeIsNotKey(_0x5650a0,_0x3073e0['sugarcrmAccounts'],'id');for(var _0x6835e5=0x0,_0x1b51ca={},_0x23f121={};_0x6835e5<_0x5650a0[_0xf5b3('0x3a')];_0x6835e5+=0x1){_0x1b51ca=_0x5650a0[_0x6835e5];if(_[_0xf5b3('0x3e')](_0x3073e0[_0xf5b3('0x19')][_0x1b51ca['id']])){_0x3073e0[_0xf5b3('0x19')][_0x1b51ca['id']]=new SugarcrmAccount(_0x1b51ca);}else{_0x3073e0['mergeFromDatabase'](_0x3073e0[_0xf5b3('0x19')][_0x1b51ca['id']],_0x1b51ca);}}}return _0x3073e0['sugarcrmAccounts'];};};Realtime[_0xf5b3('0x38')][_0xf5b3('0x48')]=function(){var _0x149a4f=this;return function(_0x42d8df){if(_0x42d8df){freeIsNotKey(_0x42d8df,_0x149a4f[_0xf5b3('0x1d')],'id');for(var _0x2c058e=0x0,_0x257297={},_0x444057={};_0x2c058e<_0x42d8df[_0xf5b3('0x3a')];_0x2c058e+=0x1){_0x257297=_0x42d8df[_0x2c058e];if(_[_0xf5b3('0x3e')](_0x149a4f[_0xf5b3('0x1d')][_0x257297['id']])){_0x149a4f[_0xf5b3('0x1d')][_0x257297['id']]=new VtigerAccount(_0x257297);}else{_0x149a4f[_0xf5b3('0x39')](_0x149a4f['vtigerAccounts'][_0x257297['id']],_0x257297);}}}return _0x149a4f['vtigerAccounts'];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0xe1f38a=this;return function(_0x17c45c){if(_0x17c45c){freeIsNotKey(_0x17c45c,_0xe1f38a['servicenowAccounts'],'id');for(var _0x32fc89=0x0,_0x3295da={},_0xf33155={};_0x32fc89<_0x17c45c[_0xf5b3('0x3a')];_0x32fc89+=0x1){_0x3295da=_0x17c45c[_0x32fc89];if(_[_0xf5b3('0x3e')](_0xe1f38a[_0xf5b3('0x1e')][_0x3295da['id']])){_0xe1f38a['servicenowAccounts'][_0x3295da['id']]=new ServicenowAccount(_0x3295da);}else{_0xe1f38a[_0xf5b3('0x39')](_0xe1f38a[_0xf5b3('0x1e')][_0x3295da['id']],_0x3295da);}}}return _0xe1f38a['servicenowAccounts'];};};Realtime[_0xf5b3('0x38')][_0xf5b3('0x49')]=function(){var _0x2d30c3=this;return function(_0x430ca3){if(_0x430ca3){freeIsNotKey(_0x430ca3,_0x2d30c3[_0xf5b3('0x1f')],'id');for(var _0x41bcba=0x0,_0x236d30={},_0xb95d73={};_0x41bcba<_0x430ca3[_0xf5b3('0x3a')];_0x41bcba+=0x1){_0x236d30=_0x430ca3[_0x41bcba];if(_['isUndefined'](_0x2d30c3[_0xf5b3('0x1f')][_0x236d30['id']])){_0x2d30c3[_0xf5b3('0x1f')][_0x236d30['id']]=new Dynamics365Account(_0x236d30);}else{_0x2d30c3[_0xf5b3('0x39')](_0x2d30c3['dynamics365Accounts'][_0x236d30['id']],_0x236d30);}}}return _0x2d30c3[_0xf5b3('0x1f')];};};Realtime['prototype'][_0xf5b3('0x4a')]=function(){var _0x50f3b2=this;return function(_0x428db1){if(_0x428db1){freeIsNotKey(_0x428db1,_0x50f3b2['freshsalesAccounts'],'id');for(var _0x3106b6=0x0,_0x19a1f4={},_0x137fda={};_0x3106b6<_0x428db1[_0xf5b3('0x3a')];_0x3106b6+=0x1){_0x19a1f4=_0x428db1[_0x3106b6];if(_['isUndefined'](_0x50f3b2['freshsalesAccounts'][_0x19a1f4['id']])){_0x50f3b2['freshsalesAccounts'][_0x19a1f4['id']]=new FreshsalesAccount(_0x19a1f4);}else{_0x50f3b2['mergeFromDatabase'](_0x50f3b2[_0xf5b3('0x20')][_0x19a1f4['id']],_0x19a1f4);}}}return _0x50f3b2[_0xf5b3('0x20')];};};Realtime[_0xf5b3('0x38')][_0xf5b3('0x4b')]=function(){var _0xf721ac=this;return function(_0x57857e){for(var _0x1319b6=0x0;_0x1319b6<_0x57857e[_0xf5b3('0x3a')];_0x1319b6+=0x1){_[_0xf5b3('0x4c')](_0xf721ac[_0xf5b3('0x11')][_0x57857e[_0x1319b6]['name']],_0x57857e[_0x1319b6]);}return _0xf721ac[_0xf5b3('0x11')];};};Realtime[_0xf5b3('0x38')][_0xf5b3('0x4d')]=function(){var _0x40613f=this;return function(_0x4b103a){clearVoiceQueues(_0x40613f['voiceQueues']);if(_0x4b103a){_0x4b103a=_[_0xf5b3('0x4e')](_0x4b103a,_0xf5b3('0x4f'));for(var _0x3182ba in _0x4b103a){if(_0x4b103a[_0xf5b3('0x23')](_0x3182ba)){var _0x3d00cd={};for(var _0x4ec054=0x0;_0x4ec054<_0x4b103a[_0x3182ba][_0xf5b3('0x3a')];_0x4ec054+=0x1){var _0x267aa9=_0x4b103a[_0x3182ba][_0x4ec054][_0xf5b3('0x50')];if(_0x40613f['voiceQueues'][_0x267aa9]){if(_0x4b103a[_0x3182ba][_0x4ec054][_0xf5b3('0x51')]){_0x40613f['voiceQueues'][_0x267aa9][_0xf5b3('0x2b')]+=0x1;}if(_0x4b103a[_0x3182ba][_0x4ec054][_0xf5b3('0x52')]){_0x40613f[_0xf5b3('0x11')][_0x267aa9][_0xf5b3('0x2c')]+=0x1;}_0x40613f[_0xf5b3('0x11')][_0x267aa9][_0xf5b3('0x26')]+=moment(_0x4b103a[_0x3182ba][_0x4ec054][_0xf5b3('0x53')])[_0xf5b3('0x54')](moment(_0x4b103a[_0x3182ba][_0x4ec054][_0xf5b3('0x55')]),_0xf5b3('0x56'))||0x0;if(_0x4ec054===_0x4b103a[_0x3182ba][_0xf5b3('0x3a')]-0x1){_0x40613f[_0xf5b3('0x11')][_0x267aa9]['sumDuration']+=moment(_0x4b103a[_0x3182ba][_0x4ec054][_0xf5b3('0x57')]||_0x4b103a[_0x3182ba][_0x4ec054][_0xf5b3('0x58')]||_0x4b103a[_0x3182ba][_0x4ec054][_0xf5b3('0x59')])[_0xf5b3('0x54')](moment(_0x4b103a[_0x3182ba][_0x4ec054][_0xf5b3('0x55')]),_0xf5b3('0x56'))||0x0;_0x40613f[_0xf5b3('0x11')][_0x267aa9][_0xf5b3('0x5a')]+=0x1;if(_0x4b103a[_0x3182ba][_0x4ec054][_0xf5b3('0x5b')]){_0x40613f[_0xf5b3('0x11')][_0x267aa9]['answered']+=0x1;_0x40613f[_0xf5b3('0x11')][_0x267aa9][_0xf5b3('0x28')]+=moment(_0x4b103a[_0x3182ba][_0x4ec054][_0xf5b3('0x57')])[_0xf5b3('0x54')](moment(_0x4b103a[_0x3182ba][_0x4ec054]['queuecallerleaveAt']),_0xf5b3('0x56'))||0x0;}}else{_0x40613f[_0xf5b3('0x11')][_0x267aa9][_0xf5b3('0x27')]+=_0x40613f['voiceQueues'][_0x267aa9]['sumHoldTime']||0x0;}}}}}}return _0x40613f[_0xf5b3('0x11')];};};Realtime[_0xf5b3('0x38')]['initVoiceCallReports']=function(){var _0xd96d50=this;return function(_0x40e2e3){clearVoiceCallReports(_0xd96d50[_0xf5b3('0x14')]);if(_0x40e2e3){for(var _0x8b178e=0x0;_0x8b178e<_0x40e2e3[_0xf5b3('0x3a')];_0x8b178e+=0x1){_0xd96d50['outbound'][_0xf5b3('0x5a')]+=0x1;_0xd96d50['outbound'][_0xf5b3('0x27')]+=_0x40e2e3[_0x8b178e][_0xf5b3('0x5c')];if(_0x40e2e3[_0x8b178e][_0xf5b3('0x5d')]===_0xf5b3('0x5e')){_0xd96d50[_0xf5b3('0x14')][_0xf5b3('0x5f')]+=0x1;_0xd96d50[_0xf5b3('0x14')][_0xf5b3('0x26')]+=_0x40e2e3[_0x8b178e][_0xf5b3('0x5c')]-_0x40e2e3[_0x8b178e][_0xf5b3('0x60')]||0x0;_0xd96d50[_0xf5b3('0x14')][_0xf5b3('0x28')]+=_0x40e2e3[_0x8b178e][_0xf5b3('0x60')];}}}return _0xd96d50[_0xf5b3('0x14')];};};Realtime[_0xf5b3('0x38')]['initCampaigns']=function(){var _0x51a38b=this;return function(_0x47c048){if(_0x47c048){freeIsNotKey(_0x47c048,_0x51a38b['campaigns'],'name');for(var _0x1b4d6f=0x0,_0x59f7b7={};_0x1b4d6f<_0x47c048[_0xf5b3('0x3a')];_0x1b4d6f+=0x1){_0x59f7b7=_0x47c048[_0x1b4d6f];if(_['isUndefined'](_0x51a38b[_0xf5b3('0x12')][_0x59f7b7[_0xf5b3('0x3d')]])){_0x51a38b[_0xf5b3('0x12')][_0x59f7b7[_0xf5b3('0x3d')]]=new Campaign(_0x59f7b7);}else{_0x51a38b[_0xf5b3('0x39')](_0x51a38b['campaigns'][_0x59f7b7[_0xf5b3('0x3d')]],_0x59f7b7);_0x51a38b['campaigns'][_0x59f7b7[_0xf5b3('0x3d')]]['dialQueueProject']=_0x59f7b7[_0xf5b3('0x61')]?_0x59f7b7[_0xf5b3('0x61')][_0xf5b3('0x3d')]:undefined;}}}return _0x51a38b[_0xf5b3('0x12')];};};Realtime[_0xf5b3('0x38')][_0xf5b3('0x62')]=function(){var _0x24a1b1=this;return function(_0x54428c){if(_0x54428c){freeIsNotKey(_0x54428c,_0x24a1b1['voiceExtensions'],'id');for(var _0xb7472e=0x0,_0x2c65e9={};_0xb7472e<_0x54428c[_0xf5b3('0x3a')];_0xb7472e+=0x1){_0x2c65e9=_0x54428c[_0xb7472e];if(_[_0xf5b3('0x3e')](_0x24a1b1[_0xf5b3('0x63')][_0x2c65e9['id']])){_0x24a1b1['voiceExtensions'][_0x2c65e9['id']]=new VoiceExtension(_0x2c65e9);}else{_0x24a1b1[_0xf5b3('0x39')](_0x24a1b1[_0xf5b3('0x63')][_0x2c65e9['id']],_0x2c65e9);}}}return _0x24a1b1[_0xf5b3('0x63')];};};Realtime[_0xf5b3('0x38')][_0xf5b3('0x64')]=function(){var _0x5f49d8=this;return function(_0x1f4c27){clearCampaigns(_0x5f49d8['campaigns']);for(var _0x29e7eb=0x0;_0x29e7eb<_0x1f4c27[_0xf5b3('0x3a')];_0x29e7eb+=0x1){_[_0xf5b3('0x4c')](_0x5f49d8['campaigns'][_0x1f4c27[_0x29e7eb][_0xf5b3('0x3d')]],_0x1f4c27[_0x29e7eb]);}return _0x5f49d8[_0xf5b3('0x12')];};};Realtime['prototype'][_0xf5b3('0x65')]=function(){var _0x14d6da=this;return function(_0x5c5fc6){if(_0x5c5fc6){freeIsNotKey(_0x5c5fc6,_0x14d6da[_0xf5b3('0x21')],'id');for(var _0x5a1856=0x0,_0x568840={},_0x55cdf6={};_0x5a1856<_0x5c5fc6[_0xf5b3('0x3a')];_0x5a1856+=0x1){_0x568840=_0x5c5fc6[_0x5a1856];if(_[_0xf5b3('0x3e')](_0x14d6da['faxAccounts'][_0x568840['id']])){_0x14d6da['faxAccounts'][_0x568840['id']]=new FaxAccount(_0x568840);}else{_0x14d6da['mergeFromDatabase'](_0x14d6da[_0xf5b3('0x21')][_0x568840['id']],_0x568840);}}}return _0x14d6da[_0xf5b3('0x21')];};};module[_0xf5b3('0x66')]=Realtime; \ No newline at end of file +var _0x9be7=['initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','trunks','voiceQueues','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','hasOwnProperty','isNil','interface','name','total','answered','sumHoldTime','sumDuration','sumBillable','ivrAnswerCallsDay','isEmpty','unmanaged','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','queueStatusComplete','agents','prototype','telephones','isUndefined','mergeFromDatabase','initTrunks','initTriggers','triggers','length','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0x9be7,0x1d0));var _0x79be=function(_0x2a558d,_0x2df0ff){_0x2a558d=_0x2a558d-0x0;var _0xa7bc9c=_0x9be7[_0x2a558d];return _0xa7bc9c;};'use strict';var BPromise=require(_0x79be('0x0'));var util=require(_0x79be('0x1'));var _=require(_0x79be('0x2'));var moment=require(_0x79be('0x3'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0x79be('0x4'));var VoiceQueue=require(_0x79be('0x5'));var Trigger=require(_0x79be('0x6'));var Template=require(_0x79be('0x7'));var Campaign=require(_0x79be('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x79be('0x9'));var SalesforceAccount=require(_0x79be('0xa'));var FreshdeskAccount=require(_0x79be('0xb'));var SugarcrmAccount=require(_0x79be('0xc'));var ZohoAccount=require(_0x79be('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x79be('0xe'));var ServicenowAccount=require(_0x79be('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x79be('0x10'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0x79be('0x11')]={};this[_0x79be('0x12')]={};this['triggers']={};this[_0x79be('0x13')]={};this['templates']={};this[_0x79be('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x79be('0x15')]={};this[_0x79be('0x16')]={};this[_0x79be('0x17')]={};this[_0x79be('0x18')]={};this[_0x79be('0x19')]={};this['settings']={};this[_0x79be('0x1a')]={};this[_0x79be('0x1b')]={};this[_0x79be('0x1c')]={};this[_0x79be('0x1d')]={};this[_0x79be('0x1e')]={};this[_0x79be('0x1f')]={};this['vtigerAccounts']={};this[_0x79be('0x20')]={};this[_0x79be('0x21')]={};this[_0x79be('0x22')]={};this[_0x79be('0x23')]={};};function freeIsNotKey(_0x148f1c,_0x2df46f,_0x2da9e1){var _0x480449=_['mapKeys'](_0x148f1c,function(_0x12fbf1,_0x167990){return _0x12fbf1[_0x2da9e1];});for(var _0x18e354 in _0x2df46f){if(_0x2df46f['hasOwnProperty'](_0x18e354)){if(!_0x480449[_0x18e354]){delete _0x2df46f[_0x18e354];}}}}function freeIsNotKeySip(_0x50a8a6,_0x27b4e0){var _0x2ad180=_[_0x79be('0x24')](_0x50a8a6,function(_0x2a4eea,_0x207198){return util[_0x79be('0x25')](_0x79be('0x26'),_0x2a4eea['name']);});for(var _0x4d4eed in _0x27b4e0){if(_0x27b4e0[_0x79be('0x27')](_0x4d4eed)){if(!_0x2ad180[_0x4d4eed]){delete _0x27b4e0[_0x4d4eed];}}}}function freeIsNotKeyAgent(_0x560f8c,_0x14b85a){var _0x3cf4e8=_[_0x79be('0x24')](_0x560f8c,function(_0x21dd8c,_0x471b9c){var _0x3b1cd7=_[_0x79be('0x28')](_0x21dd8c[_0x79be('0x29')])?util['format']('SIP/%s',_0x21dd8c[_0x79be('0x2a')]):_0x21dd8c[_0x79be('0x29')];return _0x3b1cd7;});for(var _0x2efaf5 in _0x14b85a){if(_0x14b85a[_0x79be('0x27')](_0x2efaf5)){if(!_0x3cf4e8[_0x2efaf5]){delete _0x14b85a[_0x2efaf5];}}}}function clearVoiceCallReports(_0x41b2e8){_0x41b2e8[_0x79be('0x2b')]=0x0;_0x41b2e8[_0x79be('0x2c')]=0x0;_0x41b2e8[_0x79be('0x2d')]=0x0;_0x41b2e8[_0x79be('0x2e')]=0x0;_0x41b2e8[_0x79be('0x2f')]=0x0;}function clearCampaigns(_0x9c2da8){if(!_['isEmpty'](_0x9c2da8)){for(var _0x62c51a in _0x9c2da8){if(_0x9c2da8[_0x79be('0x27')](_0x62c51a)){_0x9c2da8[_0x62c51a]['ivrTotalCallsDays']=0x0;_0x9c2da8[_0x62c51a][_0x79be('0x30')]=0x0;}}}}function clearVoiceQueues(_0x5ca0b1){if(!_[_0x79be('0x31')](_0x5ca0b1)){for(var _0x458439 in _0x5ca0b1){if(_0x5ca0b1['hasOwnProperty'](_0x458439)){_0x5ca0b1[_0x458439][_0x79be('0x2b')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x2c')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x32')]=0x0;_0x5ca0b1[_0x458439]['abandoned']=0x0;_0x5ca0b1[_0x458439][_0x79be('0x2d')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x2e')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x2f')]=0x0;_0x5ca0b1[_0x458439]['outboundAnswerAgiCallsDay']=0x0;_0x5ca0b1[_0x458439][_0x79be('0x33')]=0x0;_0x5ca0b1[_0x458439]['outboundBusyCallsDay']=0x0;_0x5ca0b1[_0x458439][_0x79be('0x34')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x35')]=0x0;_0x5ca0b1[_0x458439]['outboundUnknownCallsDay']=0x0;_0x5ca0b1[_0x458439][_0x79be('0x36')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x37')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x38')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x39')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x3a')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x3b')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x3c')]=0x0;_0x5ca0b1[_0x458439]['outboundAnswerCallsDay']=0x0;_0x5ca0b1[_0x458439][_0x79be('0x3d')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x162e82,_0x26f5ce){for(var _0x2acb0c in _0x26f5ce){if(_0x162e82[_0x79be('0x27')](_0x2acb0c)){_0x162e82[_0x2acb0c]=_0x26f5ce[_0x2acb0c];}}};Realtime['prototype']['initAgents']=function(){var _0x50d318=this;return function(_0x222afc){if(_0x222afc){freeIsNotKeyAgent(_0x222afc,_0x50d318[_0x79be('0x3e')]);for(var _0x1003e1=0x0,_0xbe0d20={},_0x2018e6={};_0x1003e1<_0x222afc['length'];_0x1003e1+=0x1){_0xbe0d20=_0x222afc[_0x1003e1];var _0x2b7ef4=_[_0x79be('0x28')](_0xbe0d20['interface'])?util[_0x79be('0x25')](_0x79be('0x26'),_0xbe0d20[_0x79be('0x2a')]):_0xbe0d20[_0x79be('0x29')];if(_['isUndefined'](_0x50d318['agents'][_0x2b7ef4])){_0x50d318[_0x79be('0x3e')][_0x2b7ef4]=new Agent(_0xbe0d20);}else{_0x50d318['mergeFromDatabase'](_0x50d318['agents'][_0x2b7ef4],_0xbe0d20);}}}return _0x50d318[_0x79be('0x3e')];};};Realtime[_0x79be('0x3f')]['initTelephones']=function(){var _0x594b9a=this;return function(_0xcf4f58){if(_0xcf4f58){freeIsNotKeySip(_0xcf4f58,_0x594b9a[_0x79be('0x40')]);for(var _0x44247e=0x0,_0x31b32={},_0x14d260={};_0x44247e<_0xcf4f58['length'];_0x44247e+=0x1){_0x31b32=_0xcf4f58[_0x44247e];if(_[_0x79be('0x41')](_0x594b9a[_0x79be('0x40')][util[_0x79be('0x25')]('SIP/%s',_0x31b32['name'])])){_0x594b9a[_0x79be('0x40')][util['format'](_0x79be('0x26'),_0x31b32[_0x79be('0x2a')])]=new Telephone(_0x31b32);}else{_0x594b9a[_0x79be('0x42')](_0x594b9a['telephones'][util[_0x79be('0x25')](_0x79be('0x26'),_0x31b32[_0x79be('0x2a')])],_0x31b32);}}}return _0x594b9a['telephones'];};};Realtime[_0x79be('0x3f')][_0x79be('0x43')]=function(){var _0xa8ff59=this;return function(_0x250f3e){if(_0x250f3e){freeIsNotKeySip(_0x250f3e,_0xa8ff59[_0x79be('0x11')]);for(var _0x107d4a=0x0,_0x384e38={},_0x2c4b35={};_0x107d4a<_0x250f3e['length'];_0x107d4a+=0x1){_0x384e38=_0x250f3e[_0x107d4a];if(_['isUndefined'](_0xa8ff59[_0x79be('0x11')][util[_0x79be('0x25')](_0x79be('0x26'),_0x384e38['name'])])){_0xa8ff59[_0x79be('0x11')][util[_0x79be('0x25')]('SIP/%s',_0x384e38[_0x79be('0x2a')])]=new Trunk(_0x384e38);}else{_0xa8ff59['mergeFromDatabase'](_0xa8ff59[_0x79be('0x11')][util[_0x79be('0x25')](_0x79be('0x26'),_0x384e38[_0x79be('0x2a')])],_0x384e38);}}}return _0xa8ff59[_0x79be('0x11')];};};Realtime[_0x79be('0x3f')]['initVoiceQueues']=function(){var _0x45e3d9=this;return function(_0x2886cd){if(_0x2886cd){freeIsNotKey(_0x2886cd,_0x45e3d9['voiceQueues'],'name');for(var _0x12615f=0x0,_0xd0329a={},_0x1e758e={};_0x12615f<_0x2886cd['length'];_0x12615f+=0x1){_0xd0329a=_0x2886cd[_0x12615f];if(_[_0x79be('0x41')](_0x45e3d9[_0x79be('0x12')][_0xd0329a['name']])){_0x45e3d9[_0x79be('0x12')][_0xd0329a['name']]=new VoiceQueue(_0xd0329a);}else{_0x45e3d9[_0x79be('0x42')](_0x45e3d9[_0x79be('0x12')][_0xd0329a[_0x79be('0x2a')]],_0xd0329a);}}}return _0x45e3d9[_0x79be('0x12')];};};Realtime[_0x79be('0x3f')][_0x79be('0x44')]=function(){var _0x1eb65f=this;return function(_0x2eebf4){if(_0x2eebf4){freeIsNotKey(_0x2eebf4,_0x1eb65f[_0x79be('0x45')],'id');for(var _0x1ca178=0x0,_0x3bbf0f={},_0x56660f={};_0x1ca178<_0x2eebf4[_0x79be('0x46')];_0x1ca178+=0x1){_0x3bbf0f=_0x2eebf4[_0x1ca178];if(_[_0x79be('0x41')](_0x1eb65f[_0x79be('0x45')][_0x3bbf0f['id']])){_0x1eb65f[_0x79be('0x45')][_0x3bbf0f['id']]=new Trigger(_0x3bbf0f);}else{_0x1eb65f[_0x79be('0x42')](_0x1eb65f['triggers'][_0x3bbf0f['id']],_0x3bbf0f);}}}return _0x1eb65f[_0x79be('0x45')];};};Realtime[_0x79be('0x3f')][_0x79be('0x47')]=function(){var _0x42b0ef=this;return function(_0x28b244){if(_0x28b244){freeIsNotKey(_0x28b244,_0x42b0ef[_0x79be('0x48')],'id');for(var _0x58fa7d=0x0,_0x484db6={},_0x8bfe8d={};_0x58fa7d<_0x28b244[_0x79be('0x46')];_0x58fa7d+=0x1){_0x484db6=_0x28b244[_0x58fa7d];if(_['isUndefined'](_0x42b0ef['templates'][_0x484db6['id']])){_0x42b0ef[_0x79be('0x48')][_0x484db6['id']]=new Template(_0x484db6);}else{_0x42b0ef[_0x79be('0x42')](_0x42b0ef['templates'][_0x484db6['id']],_0x484db6);}}}return _0x42b0ef[_0x79be('0x48')];};};Realtime['prototype'][_0x79be('0x49')]=function(){var _0x2209d6=this;return function(_0xc02dfd){if(_0xc02dfd){freeIsNotKey(_0xc02dfd,_0x2209d6[_0x79be('0x1a')],'id');for(var _0x547990=0x0,_0x3ba4ec={},_0xae2975={};_0x547990<_0xc02dfd[_0x79be('0x46')];_0x547990+=0x1){_0x3ba4ec=_0xc02dfd[_0x547990];if(_['isUndefined'](_0x2209d6[_0x79be('0x1a')][_0x3ba4ec['id']])){_0x2209d6[_0x79be('0x1a')][_0x3ba4ec['id']]=new ZendeskAccount(_0x3ba4ec);}else{_0x2209d6['mergeFromDatabase'](_0x2209d6[_0x79be('0x1a')][_0x3ba4ec['id']],_0x3ba4ec);}}}return _0x2209d6[_0x79be('0x1a')];};};Realtime[_0x79be('0x3f')][_0x79be('0x4a')]=function(){var _0x5cfba5=this;return function(_0x1e5f2c){if(_0x1e5f2c){freeIsNotKey(_0x1e5f2c,_0x5cfba5['salesforceAccounts'],'id');for(var _0x1bcb56=0x0,_0x449b03={},_0x117276={};_0x1bcb56<_0x1e5f2c[_0x79be('0x46')];_0x1bcb56+=0x1){_0x449b03=_0x1e5f2c[_0x1bcb56];if(_[_0x79be('0x41')](_0x5cfba5[_0x79be('0x1b')][_0x449b03['id']])){_0x5cfba5[_0x79be('0x1b')][_0x449b03['id']]=new SalesforceAccount(_0x449b03);}else{_0x5cfba5[_0x79be('0x42')](_0x5cfba5['salesforceAccounts'][_0x449b03['id']],_0x449b03);}}}return _0x5cfba5[_0x79be('0x1b')];};};Realtime[_0x79be('0x3f')][_0x79be('0x4b')]=function(){var _0x4cc6b3=this;return function(_0x46b189){if(_0x46b189){freeIsNotKey(_0x46b189,_0x4cc6b3[_0x79be('0x1d')],'id');for(var _0x5a3e59=0x0,_0x464375={},_0x179253={};_0x5a3e59<_0x46b189[_0x79be('0x46')];_0x5a3e59+=0x1){_0x464375=_0x46b189[_0x5a3e59];if(_[_0x79be('0x41')](_0x4cc6b3[_0x79be('0x1d')][_0x464375['id']])){_0x4cc6b3[_0x79be('0x1d')][_0x464375['id']]=new FreshdeskAccount(_0x464375);}else{_0x4cc6b3[_0x79be('0x42')](_0x4cc6b3[_0x79be('0x1d')][_0x464375['id']],_0x464375);}}}return _0x4cc6b3[_0x79be('0x1d')];};};Realtime['prototype'][_0x79be('0x4c')]=function(){var _0x344830=this;return function(_0xa6d21e){if(_0xa6d21e){freeIsNotKey(_0xa6d21e,_0x344830[_0x79be('0x1e')],'id');for(var _0xbd2df9=0x0,_0x194c3b={},_0x570404={};_0xbd2df9<_0xa6d21e[_0x79be('0x46')];_0xbd2df9+=0x1){_0x194c3b=_0xa6d21e[_0xbd2df9];if(_[_0x79be('0x41')](_0x344830['zohoAccounts'][_0x194c3b['id']])){_0x344830[_0x79be('0x1e')][_0x194c3b['id']]=new ZohoAccount(_0x194c3b);}else{_0x344830['mergeFromDatabase'](_0x344830['zohoAccounts'][_0x194c3b['id']],_0x194c3b);}}}return _0x344830[_0x79be('0x1e')];};};Realtime[_0x79be('0x3f')][_0x79be('0x4d')]=function(){var _0x434106=this;return function(_0x47b235){if(_0x47b235){freeIsNotKey(_0x47b235,_0x434106[_0x79be('0x1f')],'id');for(var _0x343506=0x0,_0x15464e={},_0x1b5ee8={};_0x343506<_0x47b235['length'];_0x343506+=0x1){_0x15464e=_0x47b235[_0x343506];if(_[_0x79be('0x41')](_0x434106['deskAccounts'][_0x15464e['id']])){_0x434106[_0x79be('0x1f')][_0x15464e['id']]=new DeskAccount(_0x15464e);}else{_0x434106['mergeFromDatabase'](_0x434106[_0x79be('0x1f')][_0x15464e['id']],_0x15464e);}}}return _0x434106[_0x79be('0x1f')];};};Realtime[_0x79be('0x3f')][_0x79be('0x4e')]=function(){var _0x4f8719=this;return function(_0x2e6c07){if(_0x2e6c07){freeIsNotKey(_0x2e6c07,_0x4f8719[_0x79be('0x1c')],'id');for(var _0x286894=0x0,_0x54193f={},_0x3febea={};_0x286894<_0x2e6c07['length'];_0x286894+=0x1){_0x54193f=_0x2e6c07[_0x286894];if(_[_0x79be('0x41')](_0x4f8719[_0x79be('0x1c')][_0x54193f['id']])){_0x4f8719[_0x79be('0x1c')][_0x54193f['id']]=new SugarcrmAccount(_0x54193f);}else{_0x4f8719['mergeFromDatabase'](_0x4f8719[_0x79be('0x1c')][_0x54193f['id']],_0x54193f);}}}return _0x4f8719[_0x79be('0x1c')];};};Realtime['prototype'][_0x79be('0x4f')]=function(){var _0x2a4378=this;return function(_0x5bc5e0){if(_0x5bc5e0){freeIsNotKey(_0x5bc5e0,_0x2a4378[_0x79be('0x50')],'id');for(var _0x25c6f6=0x0,_0x35303c={},_0x38943b={};_0x25c6f6<_0x5bc5e0[_0x79be('0x46')];_0x25c6f6+=0x1){_0x35303c=_0x5bc5e0[_0x25c6f6];if(_[_0x79be('0x41')](_0x2a4378[_0x79be('0x50')][_0x35303c['id']])){_0x2a4378[_0x79be('0x50')][_0x35303c['id']]=new VtigerAccount(_0x35303c);}else{_0x2a4378['mergeFromDatabase'](_0x2a4378[_0x79be('0x50')][_0x35303c['id']],_0x35303c);}}}return _0x2a4378[_0x79be('0x50')];};};Realtime[_0x79be('0x3f')]['initServicenowAccounts']=function(){var _0x25219a=this;return function(_0x49d9d8){if(_0x49d9d8){freeIsNotKey(_0x49d9d8,_0x25219a[_0x79be('0x20')],'id');for(var _0x28e0b9=0x0,_0x415007={},_0x5def30={};_0x28e0b9<_0x49d9d8[_0x79be('0x46')];_0x28e0b9+=0x1){_0x415007=_0x49d9d8[_0x28e0b9];if(_[_0x79be('0x41')](_0x25219a[_0x79be('0x20')][_0x415007['id']])){_0x25219a['servicenowAccounts'][_0x415007['id']]=new ServicenowAccount(_0x415007);}else{_0x25219a['mergeFromDatabase'](_0x25219a[_0x79be('0x20')][_0x415007['id']],_0x415007);}}}return _0x25219a['servicenowAccounts'];};};Realtime[_0x79be('0x3f')]['initDynamics365Accounts']=function(){var _0x47d5bd=this;return function(_0xbb469e){if(_0xbb469e){freeIsNotKey(_0xbb469e,_0x47d5bd[_0x79be('0x21')],'id');for(var _0x4a6d09=0x0,_0x25bb48={},_0x25775c={};_0x4a6d09<_0xbb469e[_0x79be('0x46')];_0x4a6d09+=0x1){_0x25bb48=_0xbb469e[_0x4a6d09];if(_[_0x79be('0x41')](_0x47d5bd[_0x79be('0x21')][_0x25bb48['id']])){_0x47d5bd[_0x79be('0x21')][_0x25bb48['id']]=new Dynamics365Account(_0x25bb48);}else{_0x47d5bd[_0x79be('0x42')](_0x47d5bd[_0x79be('0x21')][_0x25bb48['id']],_0x25bb48);}}}return _0x47d5bd[_0x79be('0x21')];};};Realtime[_0x79be('0x3f')][_0x79be('0x51')]=function(){var _0x235237=this;return function(_0x34815b){if(_0x34815b){freeIsNotKey(_0x34815b,_0x235237[_0x79be('0x22')],'id');for(var _0x486181=0x0,_0x437a32={},_0x51309a={};_0x486181<_0x34815b[_0x79be('0x46')];_0x486181+=0x1){_0x437a32=_0x34815b[_0x486181];if(_[_0x79be('0x41')](_0x235237['freshsalesAccounts'][_0x437a32['id']])){_0x235237['freshsalesAccounts'][_0x437a32['id']]=new FreshsalesAccount(_0x437a32);}else{_0x235237[_0x79be('0x42')](_0x235237[_0x79be('0x22')][_0x437a32['id']],_0x437a32);}}}return _0x235237['freshsalesAccounts'];};};Realtime[_0x79be('0x3f')][_0x79be('0x52')]=function(){var _0x484ae9=this;return function(_0x5bde23){for(var _0x46cd45=0x0;_0x46cd45<_0x5bde23[_0x79be('0x46')];_0x46cd45+=0x1){_[_0x79be('0x53')](_0x484ae9[_0x79be('0x12')][_0x5bde23[_0x46cd45]['name']],_0x5bde23[_0x46cd45]);}return _0x484ae9[_0x79be('0x12')];};};Realtime['prototype'][_0x79be('0x54')]=function(){var _0x49cc50=this;return function(_0x17f922){clearVoiceQueues(_0x49cc50[_0x79be('0x12')]);if(_0x17f922){_0x17f922=_['groupBy'](_0x17f922,_0x79be('0x55'));for(var _0xe6a0c6 in _0x17f922){if(_0x17f922['hasOwnProperty'](_0xe6a0c6)){var _0x151623={};for(var _0x2bbc00=0x0;_0x2bbc00<_0x17f922[_0xe6a0c6]['length'];_0x2bbc00+=0x1){var _0x5c115c=_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x56')];if(_0x49cc50[_0x79be('0x12')][_0x5c115c]){if(_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x57')]){_0x49cc50[_0x79be('0x12')][_0x5c115c][_0x79be('0x32')]+=0x1;}if(_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x58')]){_0x49cc50[_0x79be('0x12')][_0x5c115c][_0x79be('0x59')]+=0x1;}_0x49cc50['voiceQueues'][_0x5c115c][_0x79be('0x2d')]+=moment(_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x5a')])[_0x79be('0x5b')](moment(_0x17f922[_0xe6a0c6][_0x2bbc00]['queuecallerjoinAt']),_0x79be('0x5c'))||0x0;if(_0x2bbc00===_0x17f922[_0xe6a0c6][_0x79be('0x46')]-0x1){_0x49cc50[_0x79be('0x12')][_0x5c115c]['sumDuration']+=moment(_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x5d')]||_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x5e')]||_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x5f')])[_0x79be('0x5b')](moment(_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x60')]),_0x79be('0x5c'))||0x0;_0x49cc50[_0x79be('0x12')][_0x5c115c][_0x79be('0x2b')]+=0x1;if(_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x61')]){_0x49cc50['voiceQueues'][_0x5c115c][_0x79be('0x2c')]+=0x1;_0x49cc50[_0x79be('0x12')][_0x5c115c][_0x79be('0x2f')]+=moment(_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x5d')])[_0x79be('0x5b')](moment(_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x5a')]),_0x79be('0x5c'))||0x0;}}else{_0x49cc50['voiceQueues'][_0x5c115c][_0x79be('0x2e')]+=_0x49cc50[_0x79be('0x12')][_0x5c115c][_0x79be('0x2d')]||0x0;}}}}}}return _0x49cc50['voiceQueues'];};};Realtime['prototype'][_0x79be('0x62')]=function(){var _0x19622e=this;return function(_0x189b0e){clearVoiceCallReports(_0x19622e[_0x79be('0x14')]);if(_0x189b0e){for(var _0x571ed0=0x0;_0x571ed0<_0x189b0e[_0x79be('0x46')];_0x571ed0+=0x1){_0x19622e[_0x79be('0x14')][_0x79be('0x2b')]+=0x1;_0x19622e[_0x79be('0x14')][_0x79be('0x2e')]+=_0x189b0e[_0x571ed0][_0x79be('0x63')];if(_0x189b0e[_0x571ed0]['disposition']===_0x79be('0x64')){_0x19622e[_0x79be('0x14')][_0x79be('0x2c')]+=0x1;_0x19622e['outbound']['sumHoldTime']+=_0x189b0e[_0x571ed0][_0x79be('0x63')]-_0x189b0e[_0x571ed0]['billableseconds']||0x0;_0x19622e[_0x79be('0x14')][_0x79be('0x2f')]+=_0x189b0e[_0x571ed0][_0x79be('0x65')];}}}return _0x19622e[_0x79be('0x14')];};};Realtime[_0x79be('0x3f')][_0x79be('0x66')]=function(){var _0x35b775=this;return function(_0x1d960d){if(_0x1d960d){freeIsNotKey(_0x1d960d,_0x35b775[_0x79be('0x13')],_0x79be('0x2a'));for(var _0x276e44=0x0,_0x189f72={};_0x276e44<_0x1d960d[_0x79be('0x46')];_0x276e44+=0x1){_0x189f72=_0x1d960d[_0x276e44];if(_[_0x79be('0x41')](_0x35b775[_0x79be('0x13')][_0x189f72[_0x79be('0x2a')]])){_0x35b775[_0x79be('0x13')][_0x189f72[_0x79be('0x2a')]]=new Campaign(_0x189f72);}else{_0x35b775['mergeFromDatabase'](_0x35b775[_0x79be('0x13')][_0x189f72[_0x79be('0x2a')]],_0x189f72);_0x35b775[_0x79be('0x13')][_0x189f72['name']][_0x79be('0x67')]=_0x189f72[_0x79be('0x68')]?_0x189f72['SquareProject'][_0x79be('0x2a')]:undefined;}}}return _0x35b775['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x2c48b6=this;return function(_0x11ceb0){if(_0x11ceb0){freeIsNotKey(_0x11ceb0,_0x2c48b6[_0x79be('0x15')],'id');for(var _0x1e6926=0x0,_0x3f7884={};_0x1e6926<_0x11ceb0[_0x79be('0x46')];_0x1e6926+=0x1){_0x3f7884=_0x11ceb0[_0x1e6926];if(_[_0x79be('0x41')](_0x2c48b6[_0x79be('0x15')][_0x3f7884['id']])){_0x2c48b6['voiceExtensions'][_0x3f7884['id']]=new VoiceExtension(_0x3f7884);}else{_0x2c48b6[_0x79be('0x42')](_0x2c48b6[_0x79be('0x15')][_0x3f7884['id']],_0x3f7884);}}}return _0x2c48b6[_0x79be('0x15')];};};Realtime['prototype'][_0x79be('0x69')]=function(){var _0x50ca32=this;return function(_0x438037){clearCampaigns(_0x50ca32[_0x79be('0x13')]);for(var _0x236899=0x0;_0x236899<_0x438037[_0x79be('0x46')];_0x236899+=0x1){_[_0x79be('0x53')](_0x50ca32[_0x79be('0x13')][_0x438037[_0x236899][_0x79be('0x2a')]],_0x438037[_0x236899]);}return _0x50ca32[_0x79be('0x13')];};};Realtime[_0x79be('0x3f')][_0x79be('0x6a')]=function(){var _0x85c33a=this;return function(_0x52ffaa){if(_0x52ffaa){freeIsNotKey(_0x52ffaa,_0x85c33a[_0x79be('0x23')],'id');for(var _0x4b6b65=0x0,_0x4422b8={},_0x2cb689={};_0x4b6b65<_0x52ffaa[_0x79be('0x46')];_0x4b6b65+=0x1){_0x4422b8=_0x52ffaa[_0x4b6b65];if(_[_0x79be('0x41')](_0x85c33a[_0x79be('0x23')][_0x4422b8['id']])){_0x85c33a[_0x79be('0x23')][_0x4422b8['id']]=new FaxAccount(_0x4422b8);}else{_0x85c33a[_0x79be('0x42')](_0x85c33a[_0x79be('0x23')][_0x4422b8['id']],_0x4422b8);}}}return _0x85c33a[_0x79be('0x23')];};};module[_0x79be('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index b30e934..1fd5314 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 _0xa510=['voiceQueueReport','length','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','type','dialer','lastapplication','queue','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','channel','calleridnum','disposition','connectedlinenum','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','filename','createdAt','originatecalleridnum','xcally-motion-dialer','isArray','Local','substring','mobile','indexOf','lastIndexOf','SIP/%s','membername','transfererlinkedid','exports','moment','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./userReport','agents','sync','realtime','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','telephones','interface','format','prototype'];(function(_0x146421,_0x4183b5){var _0x31ebed=function(_0x3d34ed){while(--_0x3d34ed){_0x146421['push'](_0x146421['shift']());}};_0x31ebed(++_0x4183b5);}(_0xa510,0x80));var _0x0a51=function(_0x4c521e,_0x32f726){_0x4c521e=_0x4c521e-0x0;var _0xabff8c=_0xa510[_0x4c521e];return _0xabff8c;};'use strict';var _=require('lodash');var moment=require(_0x0a51('0x0'));var util=require('util');var config=require(_0x0a51('0x1'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x0a51('0x2'));var RpcVoiceCallReport=require(_0x0a51('0x3'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x0a51('0x4'));var RpcVoiceQueueReport=require(_0x0a51('0x5'));var RpcVoiceRecording=require(_0x0a51('0x6'));var RpcVoiceTransferReport=require(_0x0a51('0x7'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x0a51('0x8'));var VoiceAgentReport=require(_0x0a51('0x9'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x0a51('0xa'));function Report(_0x484db5){this['realtime']=_0x484db5;this['agents']=_0x484db5[_0x0a51('0xb')];this['telephones']=_0x484db5['telephones'];}Report['prototype'][_0x0a51('0xc')]=function(_0x5b2fd7){var _0x320527=new VoiceQueueReport(this[_0x0a51('0xd')]);var _0x1a9b78=new VoiceAgentReport(this['realtime']);var _0x244068=new VoiceDialReport(this['realtime']);var _0x642f55=new VoiceCallReport(this[_0x0a51('0xd')]);var _0xc170e9=new UserReport(this[_0x0a51('0xd')]);if(config[_0x0a51('0xe')]&&config[_0x0a51('0xe')][_0x0a51('0xf')]){ami['on'](_0x0a51('0x10'),this['voiceQueueReport'][_0x0a51('0x11')](this));ami['on'](_0x0a51('0x12'),this[_0x0a51('0x13')][_0x0a51('0x11')](this));ami['on'](_0x0a51('0x14'),this[_0x0a51('0x15')][_0x0a51('0x11')](this));ami['on'](_0x0a51('0x16'),this[_0x0a51('0x17')][_0x0a51('0x11')](this));ami['on'](_0x0a51('0x18'),this[_0x0a51('0x19')]['bind'](this));ami['on'](_0x0a51('0x1a'),this[_0x0a51('0x1b')][_0x0a51('0x11')](this));}};Report['prototype'][_0x0a51('0x1c')]=function(_0x38d5b6){var _0x21f65e;_0x21f65e=_[_0x0a51('0x1d')](this[_0x0a51('0xb')],function(_0x45bd72){return _0x45bd72[_0x0a51('0x1e')]==_0x38d5b6||_0x45bd72[_0x0a51('0x1f')]==_0x38d5b6;});if(_['isNil'](_0x21f65e)){var _0x9ca9a9=_[_0x0a51('0x1d')](this[_0x0a51('0x20')],function(_0x4dc102){return _0x4dc102[_0x0a51('0x1e')]==_0x38d5b6||_0x4dc102[_0x0a51('0x1f')]==_0x38d5b6;});if(_0x9ca9a9){_0x21f65e=_[_0x0a51('0x1d')](this[_0x0a51('0xb')],function(_0x42c042){return _0x42c042[_0x0a51('0x21')]==util[_0x0a51('0x22')]('SIP/%s',_0x9ca9a9[_0x0a51('0x1f')]);});}}return _0x21f65e;};Report[_0x0a51('0x23')][_0x0a51('0x24')]=function(_0x2f2b0c){for(var _0x2e462f=0x0;_0x2e462f<_0x2f2b0c[_0x0a51('0x25')];_0x2e462f+=0x1){var _0x50cb33=this[_0x0a51('0x1c')](_0x2f2b0c[_0x2e462f]['connectedlinenum']);if(_0x50cb33){_0x2f2b0c[_0x2e462f]['accountcode']=_0x50cb33[_0x0a51('0x1e')];_0x2f2b0c[_0x2e462f][_0x0a51('0x26')]=!![];_0x2f2b0c[_0x2e462f][_0x0a51('0x27')]=_0x50cb33['name'];_0x2f2b0c[_0x2e462f]['interface']=_['isNil'](_0x50cb33[_0x0a51('0x21')])?util[_0x0a51('0x22')]('SIP/%s',_0x50cb33[_0x0a51('0x1f')]):_0x50cb33[_0x0a51('0x21')];if(_0x2f2b0c[_0x2e462f][_0x0a51('0x28')]){_0x2f2b0c[_0x2e462f]['queuecallercompleteAt']=moment()['format'](_0x0a51('0x29'));}if(_0x2f2b0c[_0x2e462f][_0x0a51('0x2a')]){_0x2f2b0c[_0x2e462f][_0x0a51('0x2b')]=moment()[_0x0a51('0x22')](_0x0a51('0x29'));}RpcMemberReport[_0x0a51('0x24')](_0x2f2b0c[_0x2e462f]);}RpcVoiceQueueReport[_0x0a51('0x2c')](_0x2f2b0c[_0x2e462f]);}};function extractCalleridNumber(_0x4130f7){var _0x1f04f1=_0x4130f7[_0x0a51('0x2d')](/<(.*?)>/);return _0x1f04f1?_0x1f04f1[0x1]:_0x4130f7;}Report['prototype'][_0x0a51('0x13')]=function(_0x3d51d0){_0x3d51d0[_0x0a51('0x2e')]=_0x3d51d0[_0x0a51('0x2e')]||_0x3d51d0[_0x0a51('0x2f')];if(_0x3d51d0[_0x0a51('0x30')]==_0x0a51('0x31')){_0x3d51d0[_0x0a51('0x32')]=_0x0a51('0x33');_0x3d51d0['lastdata']=_0x3d51d0[_0x0a51('0x33')];if(_0x3d51d0['context']==_0x0a51('0x34')){_0x3d51d0['accountcode']='';_0x3d51d0[_0x0a51('0x2e')]=extractCalleridNumber(_0x3d51d0[_0x0a51('0x35')]);}else if(_0x3d51d0['context']==_0x0a51('0x36')){if(_0x3d51d0[_0x0a51('0x2e')]==_0x0a51('0x37')){_0x3d51d0[_0x0a51('0x2e')]=extractCalleridNumber(_0x3d51d0[_0x0a51('0x38')]);_0x3d51d0['calleridnum']=_0x3d51d0['originatecalleridnum'];_0x3d51d0['destinationchannel']=[_0x3d51d0[_0x0a51('0x39')],_0x3d51d0[_0x0a51('0x39')]=_0x3d51d0['destinationchannel']][0x0];_0x3d51d0[_0x0a51('0x35')]=_0x3d51d0[_0x0a51('0x38')];}else{_0x3d51d0['destination']=_0x3d51d0[_0x0a51('0x3a')];_0x3d51d0[_0x0a51('0x3a')]=_0x3d51d0['originatecalleridnum'];if(_0x3d51d0[_0x0a51('0x3b')]=='ANSWERED'){_0x3d51d0['accountcode']=_0x3d51d0[_0x0a51('0x3c')];}else{_0x3d51d0[_0x0a51('0x1e')]='';}}}}else{_0x3d51d0[_0x0a51('0x35')]=util[_0x0a51('0x22')]('\x22%s\x22\x20<%s>',_0x3d51d0['calleridname'],_0x3d51d0[_0x0a51('0x3a')]);}if(RpcVoiceTransferReport[_0x0a51('0x3d')][_0x3d51d0[_0x0a51('0x3e')]]){var _0x27f17f=RpcVoiceTransferReport['transfers'][_0x3d51d0[_0x0a51('0x3e')]];_0x27f17f[_0x0a51('0x3f')]=_0x3d51d0[_0x0a51('0x40')];RpcVoiceTransferReport['blindTransfer'](_0x27f17f);delete RpcVoiceTransferReport[_0x0a51('0x3d')][_0x3d51d0[_0x0a51('0x3e')]];}RpcVoiceCallReport['create'](_0x3d51d0);if(_0x3d51d0[_0x0a51('0x41')]){for(var _0x97a103=0x0;_0x97a103<_0x3d51d0[_0x0a51('0x42')][_0x0a51('0x25')];_0x97a103+=0x1){_0x3d51d0[_0x0a51('0x43')]=_0x3d51d0[_0x0a51('0x42')][_0x97a103][_0x0a51('0x44')];_0x3d51d0[_0x0a51('0x45')]=_0x3d51d0[_0x0a51('0x42')][_0x97a103][_0x0a51('0x45')];if(_0x3d51d0[_0x0a51('0x2f')]==_0x0a51('0x37')){_0x3d51d0[_0x0a51('0x3a')]=_0x3d51d0[_0x0a51('0x3c')];_0x3d51d0['calleridname']=_0x3d51d0['connectedlinename'];_0x3d51d0[_0x0a51('0x3c')]=_0x3d51d0[_0x0a51('0x1e')];_0x3d51d0['connectedlinename']=_0x3d51d0['membername'];_0x3d51d0[_0x0a51('0x2f')]=_0x3d51d0[_0x0a51('0x46')];}else if(_0x3d51d0[_0x0a51('0x2f')]==_0x0a51('0x47')){_0x3d51d0[_0x0a51('0x3a')]=_0x3d51d0['destination'];_0x3d51d0[_0x0a51('0x2f')]=_0x3d51d0['originatecalleridnum'];}RpcVoiceRecording['create'](_0x3d51d0);}}};Report[_0x0a51('0x23')]['voiceAgentReport']=function(_0x5688b2){if(_[_0x0a51('0x48')](_0x5688b2)){_0x5688b2['forEach'](function(_0x41761a){RpcVoiceAgentReport[_0x0a51('0x2c')](_0x41761a);});}else{RpcVoiceAgentReport[_0x0a51('0x2c')](_0x5688b2);}};Report[_0x0a51('0x23')]['voiceDialReport']=function(_0x2dd683){RpcVoiceDialReport[_0x0a51('0x2c')](_0x2dd683);var _0x5b8b93;var _0x58cba7;var _0x6ca1b0=_0x2dd683[_0x0a51('0x39')];if(_['startsWith'](_0x6ca1b0,_0x0a51('0x49'))){_0x58cba7=_0x6ca1b0[_0x0a51('0x4a')](_0x6ca1b0['indexOf']('/')+0x1,_0x6ca1b0['indexOf']('@'));_0x5b8b93=_['find'](this['agents'],function(_0x4d673a){return _0x4d673a[_0x0a51('0x4b')]==_0x58cba7||_0x4d673a['phone']==_0x58cba7||_0x4d673a[_0x0a51('0x1e')]==_0x58cba7;});}else{_0x58cba7=_0x6ca1b0['substring'](_0x6ca1b0[_0x0a51('0x4c')]('/')+0x1,_0x6ca1b0[_0x0a51('0x4d')]('-'));_0x5b8b93=this[_0x0a51('0x1c')](_0x58cba7);}if(_0x5b8b93){_0x2dd683[_0x0a51('0x21')]=_['isNil'](_0x5b8b93[_0x0a51('0x21')])?util['format'](_0x0a51('0x4e'),_0x5b8b93['name']):_0x5b8b93[_0x0a51('0x21')];_0x2dd683[_0x0a51('0x4f')]=_0x5b8b93[_0x0a51('0x1f')];_0x2dd683['accountcode']=_0x5b8b93[_0x0a51('0x1e')];RpcMemberReport[_0x0a51('0x17')](_0x2dd683);}};Report[_0x0a51('0x23')][_0x0a51('0x19')]=function(_0x204199){RpcVoiceTransferReport['transfers'][_0x204199[_0x0a51('0x50')]]=_0x204199;};Report['prototype'][_0x0a51('0x1b')]=function(_0x2bc96f){RpcVoiceTransferReport[_0x0a51('0x1b')](_0x2bc96f);};module[_0x0a51('0x51')]=Report; \ No newline at end of file +var _0xcce1=['transfererlinkedid','exports','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','find','format','SIP/%s','voiceQueueReport','length','connectedlinenum','assigned','lastAssignedTo','interface','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','type','dialer','lastapplication','queue','lastdata','context','destination','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','uniqueid','blindTransfer','monitor','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile'];(function(_0x4329c5,_0x4bfad6){var _0x285b58=function(_0x4616bc){while(--_0x4616bc){_0x4329c5['push'](_0x4329c5['shift']());}};_0x285b58(++_0x4bfad6);}(_0xcce1,0x107));var _0x1cce=function(_0x3a4203,_0xa6ff2e){_0x3a4203=_0x3a4203-0x0;var _0x1a5661=_0xcce1[_0x3a4203];return _0x1a5661;};'use strict';var _=require(_0x1cce('0x0'));var moment=require(_0x1cce('0x1'));var util=require(_0x1cce('0x2'));var config=require('../../../config/environment');var ami=require(_0x1cce('0x3'));var RpcVoiceAgentReport=require(_0x1cce('0x4'));var RpcVoiceCallReport=require(_0x1cce('0x5'));var RpcVoiceDialReport=require(_0x1cce('0x6'));var RpcMemberReport=require(_0x1cce('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x1cce('0x8'));var RpcVoiceTransferReport=require(_0x1cce('0x9'));var VoiceQueueReport=require(_0x1cce('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x1cce('0xb'));var VoiceDialReport=require(_0x1cce('0xc'));var UserReport=require('./userReport');function Report(_0x3d30cb){this[_0x1cce('0xd')]=_0x3d30cb;this['agents']=_0x3d30cb[_0x1cce('0xe')];this[_0x1cce('0xf')]=_0x3d30cb['telephones'];}Report[_0x1cce('0x10')][_0x1cce('0x11')]=function(_0x452280){var _0x721db9=new VoiceQueueReport(this['realtime']);var _0x453d43=new VoiceAgentReport(this[_0x1cce('0xd')]);var _0x9232bb=new VoiceDialReport(this['realtime']);var _0x27578=new VoiceCallReport(this[_0x1cce('0xd')]);var _0x275127=new UserReport(this[_0x1cce('0xd')]);if(config['xdr']&&config[_0x1cce('0x12')][_0x1cce('0x13')]){ami['on'](_0x1cce('0x14'),this['voiceQueueReport'][_0x1cce('0x15')](this));ami['on'](_0x1cce('0x16'),this[_0x1cce('0x17')]['bind'](this));ami['on'](_0x1cce('0x18'),this[_0x1cce('0x19')]['bind'](this));ami['on']('custom:voiceDialReport',this[_0x1cce('0x1a')][_0x1cce('0x15')](this));ami['on'](_0x1cce('0x1b'),this['blindTransfer']['bind'](this));ami['on'](_0x1cce('0x1c'),this[_0x1cce('0x1d')]['bind'](this));}};Report[_0x1cce('0x10')][_0x1cce('0x1e')]=function(_0x5b2171){var _0xfe62ec;_0xfe62ec=_['find'](this[_0x1cce('0xe')],function(_0x24c09b){return _0x24c09b[_0x1cce('0x1f')]==_0x5b2171||_0x24c09b[_0x1cce('0x20')]==_0x5b2171;});if(_['isNil'](_0xfe62ec)){var _0x45a2cf=_[_0x1cce('0x21')](this[_0x1cce('0xf')],function(_0x29c508){return _0x29c508[_0x1cce('0x1f')]==_0x5b2171||_0x29c508['name']==_0x5b2171;});if(_0x45a2cf){_0xfe62ec=_[_0x1cce('0x21')](this['agents'],function(_0xd32bdf){return _0xd32bdf['interface']==util[_0x1cce('0x22')](_0x1cce('0x23'),_0x45a2cf[_0x1cce('0x20')]);});}}return _0xfe62ec;};Report[_0x1cce('0x10')][_0x1cce('0x24')]=function(_0x29e485){for(var _0x1a3b9a=0x0;_0x1a3b9a<_0x29e485[_0x1cce('0x25')];_0x1a3b9a+=0x1){var _0x288a93=this[_0x1cce('0x1e')](_0x29e485[_0x1a3b9a][_0x1cce('0x26')]);if(_0x288a93){_0x29e485[_0x1a3b9a][_0x1cce('0x1f')]=_0x288a93[_0x1cce('0x1f')];_0x29e485[_0x1a3b9a][_0x1cce('0x27')]=!![];_0x29e485[_0x1a3b9a][_0x1cce('0x28')]=_0x288a93['name'];_0x29e485[_0x1a3b9a][_0x1cce('0x29')]=_[_0x1cce('0x2a')](_0x288a93[_0x1cce('0x29')])?util['format'](_0x1cce('0x23'),_0x288a93[_0x1cce('0x20')]):_0x288a93[_0x1cce('0x29')];if(_0x29e485[_0x1a3b9a][_0x1cce('0x2b')]){_0x29e485[_0x1a3b9a][_0x1cce('0x2c')]=moment()['format'](_0x1cce('0x2d'));}if(_0x29e485[_0x1a3b9a][_0x1cce('0x2e')]){_0x29e485[_0x1a3b9a]['queuecallerexitAt']=moment()[_0x1cce('0x22')](_0x1cce('0x2d'));}RpcMemberReport[_0x1cce('0x24')](_0x29e485[_0x1a3b9a]);}RpcVoiceQueueReport[_0x1cce('0x2f')](_0x29e485[_0x1a3b9a]);}};function extractCalleridNumber(_0x1fdca5){var _0x47712e=_0x1fdca5[_0x1cce('0x30')](/<(.*?)>/);return _0x47712e?_0x47712e[0x1]:_0x1fdca5;}Report[_0x1cce('0x10')][_0x1cce('0x17')]=function(_0x30c025){_0x30c025['destination']=_0x30c025['destination']||_0x30c025['exten'];if(_0x30c025[_0x1cce('0x31')]==_0x1cce('0x32')){_0x30c025[_0x1cce('0x33')]=_0x1cce('0x34');_0x30c025[_0x1cce('0x35')]=_0x30c025[_0x1cce('0x34')];if(_0x30c025[_0x1cce('0x36')]=='from-voip-provider'){_0x30c025[_0x1cce('0x1f')]='';_0x30c025[_0x1cce('0x37')]=extractCalleridNumber(_0x30c025[_0x1cce('0x38')]);}else if(_0x30c025[_0x1cce('0x36')]==_0x1cce('0x39')){if(_0x30c025[_0x1cce('0x37')]==_0x1cce('0x3a')){_0x30c025[_0x1cce('0x37')]=extractCalleridNumber(_0x30c025[_0x1cce('0x3b')]);_0x30c025[_0x1cce('0x3c')]=_0x30c025[_0x1cce('0x3d')];_0x30c025[_0x1cce('0x3e')]=[_0x30c025['channel'],_0x30c025['channel']=_0x30c025[_0x1cce('0x3e')]][0x0];_0x30c025[_0x1cce('0x38')]=_0x30c025[_0x1cce('0x3b')];}else{_0x30c025['destination']=_0x30c025[_0x1cce('0x3c')];_0x30c025[_0x1cce('0x3c')]=_0x30c025[_0x1cce('0x3d')];if(_0x30c025['disposition']=='ANSWERED'){_0x30c025['accountcode']=_0x30c025[_0x1cce('0x26')];}else{_0x30c025[_0x1cce('0x1f')]='';}}}}else{_0x30c025[_0x1cce('0x38')]=util[_0x1cce('0x22')](_0x1cce('0x3f'),_0x30c025[_0x1cce('0x40')],_0x30c025[_0x1cce('0x3c')]);}if(RpcVoiceTransferReport['transfers'][_0x30c025[_0x1cce('0x41')]]){var _0x38ddc4=RpcVoiceTransferReport[_0x1cce('0x42')][_0x30c025[_0x1cce('0x41')]];_0x38ddc4['transfereelinkedid']=_0x30c025[_0x1cce('0x43')];RpcVoiceTransferReport[_0x1cce('0x44')](_0x38ddc4);delete RpcVoiceTransferReport[_0x1cce('0x42')][_0x30c025[_0x1cce('0x41')]];}RpcVoiceCallReport['create'](_0x30c025);if(_0x30c025[_0x1cce('0x45')]){for(var _0x21954f=0x0;_0x21954f<_0x30c025[_0x1cce('0x46')][_0x1cce('0x25')];_0x21954f+=0x1){_0x30c025[_0x1cce('0x47')]=_0x30c025[_0x1cce('0x46')][_0x21954f][_0x1cce('0x48')];_0x30c025[_0x1cce('0x49')]=_0x30c025['monitors'][_0x21954f]['createdAt'];if(_0x30c025[_0x1cce('0x4a')]==_0x1cce('0x3a')){_0x30c025[_0x1cce('0x3c')]=_0x30c025[_0x1cce('0x26')];_0x30c025['calleridname']=_0x30c025['connectedlinename'];_0x30c025[_0x1cce('0x26')]=_0x30c025[_0x1cce('0x1f')];_0x30c025[_0x1cce('0x4b')]=_0x30c025[_0x1cce('0x4c')];_0x30c025[_0x1cce('0x4a')]=_0x30c025[_0x1cce('0x3d')];}else if(_0x30c025[_0x1cce('0x4a')]==_0x1cce('0x4d')){_0x30c025[_0x1cce('0x3c')]=_0x30c025[_0x1cce('0x37')];_0x30c025['exten']=_0x30c025[_0x1cce('0x3d')];}RpcVoiceRecording[_0x1cce('0x2f')](_0x30c025);}}};Report[_0x1cce('0x10')][_0x1cce('0x19')]=function(_0x26eb21){if(_[_0x1cce('0x4e')](_0x26eb21)){_0x26eb21[_0x1cce('0x4f')](function(_0x2be2c4){RpcVoiceAgentReport[_0x1cce('0x2f')](_0x2be2c4);});}else{RpcVoiceAgentReport['create'](_0x26eb21);}};Report[_0x1cce('0x10')][_0x1cce('0x1a')]=function(_0x1e9807){RpcVoiceDialReport[_0x1cce('0x2f')](_0x1e9807);var _0x231a19;var _0xdd0af0;var _0x5919e8=_0x1e9807['channel'];if(_[_0x1cce('0x50')](_0x5919e8,_0x1cce('0x51'))){_0xdd0af0=_0x5919e8[_0x1cce('0x52')](_0x5919e8[_0x1cce('0x53')]('/')+0x1,_0x5919e8[_0x1cce('0x53')]('@'));_0x231a19=_[_0x1cce('0x21')](this[_0x1cce('0xe')],function(_0x265f49){return _0x265f49[_0x1cce('0x54')]==_0xdd0af0||_0x265f49['phone']==_0xdd0af0||_0x265f49['accountcode']==_0xdd0af0;});}else{_0xdd0af0=_0x5919e8['substring'](_0x5919e8[_0x1cce('0x53')]('/')+0x1,_0x5919e8['lastIndexOf']('-'));_0x231a19=this[_0x1cce('0x1e')](_0xdd0af0);}if(_0x231a19){_0x1e9807['interface']=_[_0x1cce('0x2a')](_0x231a19[_0x1cce('0x29')])?util['format'](_0x1cce('0x23'),_0x231a19[_0x1cce('0x20')]):_0x231a19[_0x1cce('0x29')];_0x1e9807['membername']=_0x231a19[_0x1cce('0x20')];_0x1e9807[_0x1cce('0x1f')]=_0x231a19[_0x1cce('0x1f')];RpcMemberReport[_0x1cce('0x1a')](_0x1e9807);}};Report[_0x1cce('0x10')][_0x1cce('0x44')]=function(_0x47fe25){RpcVoiceTransferReport[_0x1cce('0x42')][_0x47fe25[_0x1cce('0x55')]]=_0x47fe25;};Report[_0x1cce('0x10')]['attendedTransfer']=function(_0x2e6475){RpcVoiceTransferReport['attendedTransfer'](_0x2e6475);};module[_0x1cce('0x56')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index c6b2b8b..9cb6451 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb01c=['Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','registry','bind','devicestatechange','syncDeviceState','peerstatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','inspect','[userReport][devicestatelist]','actionSipPeerStatus','error','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','debug','[userReport][registry]','find','username','stateRegistry','state','merge','omit','actionid','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','stateTime','telephone:save','startsWith'];(function(_0x546dd4,_0xb507d5){var _0x1210d2=function(_0x5412c7){while(--_0x5412c7){_0x546dd4['push'](_0x546dd4['shift']());}};_0x1210d2(++_0xb507d5);}(_0xb01c,0x9f));var _0xcb01=function(_0x7e4a2c,_0x148d61){_0x7e4a2c=_0x7e4a2c-0x0;var _0x532155=_0xb01c[_0x7e4a2c];return _0x532155;};'use strict';var _=require(_0xcb01('0x0'));var moment=require(_0xcb01('0x1'));var util=require(_0xcb01('0x2'));var Redis=require(_0xcb01('0x3'));var BPromise=require('bluebird');var config=require(_0xcb01('0x4'));var logger=require(_0xcb01('0x5'))(_0xcb01('0x6'));var ami=require(_0xcb01('0x7'));config['redis']=_[_0xcb01('0x8')](config[_0xcb01('0x9')],{'host':_0xcb01('0xa'),'port':0x18eb});var io=require(_0xcb01('0xb'))(new Redis(config['redis']));function UserReport(_0x4b5abd){this[_0xcb01('0xc')]=_0x4b5abd['trunks'];this[_0xcb01('0xd')]=_0x4b5abd[_0xcb01('0xd')];this[_0xcb01('0xe')]=_0x4b5abd['telephones'];ami['on']('registryentry',this[_0xcb01('0xf')]['bind'](this));ami['on'](_0xcb01('0x10'),this[_0xcb01('0xf')][_0xcb01('0x11')](this));ami['on'](_0xcb01('0x12'),this[_0xcb01('0x13')]['bind'](this));ami['on'](_0xcb01('0x14'),this['syncPeerStatus'][_0xcb01('0x11')](this));return this[_0xcb01('0x15')]();}function showSipRegistrations(){Promise[_0xcb01('0x16')]()[_0xcb01('0x17')](ami[_0xcb01('0x18')]())[_0xcb01('0x19')](function(_0x186e18){logger['error']('[userReport][sipshowregistry]',util[_0xcb01('0x1a')](_0x186e18,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xcb01('0x16')]()['then'](ami['actionDeviceStateList']())[_0xcb01('0x19')](function(_0x1283e9){logger['error'](_0xcb01('0x1b'),util[_0xcb01('0x1a')](_0x1283e9,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0xcb01('0x17')](ami[_0xcb01('0x1c')]())[_0xcb01('0x19')](function(_0x2898e7){logger[_0xcb01('0x1d')]('[userReport][sippeerstatus]',util[_0xcb01('0x1a')](_0x2898e7,{'showHidden':![],'depth':null}));});}UserReport[_0xcb01('0x1e')][_0xcb01('0x15')]=function(){setInterval(function(){BPromise['resolve']()['then'](showSipRegistrations())[_0xcb01('0x17')](listDeviceStates())[_0xcb01('0x17')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0xcb01('0x1f')]=function(_0x3d6819){return _0x3d6819!==null&&!_[_0xcb01('0x20')](_0x3d6819);};UserReport['prototype']['emit']=function(_0x1ab441,_0x906e9f,_0x24494e){io['to'](_0x1ab441)[_0xcb01('0x21')](_0x906e9f,_0x24494e);};UserReport[_0xcb01('0x1e')]['syncRegistry']=function(_0x24c55){try{if(this[_0xcb01('0x1f')](_0x24c55)){logger[_0xcb01('0x22')](_0xcb01('0x23'),_0x24c55['username'],_0x24c55['state']);logger[_0xcb01('0x24')](_0xcb01('0x25'),util[_0xcb01('0x1a')](_0x24c55,{'showHidden':![],'depth':null}));var _0x5e1f40=_[_0xcb01('0x26')](this[_0xcb01('0xc')],{'defaultuser':_0x24c55[_0xcb01('0x27')]});if(_0x5e1f40){_0x24c55[_0xcb01('0x28')]=_0x24c55[_0xcb01('0x29')];_[_0xcb01('0x2a')](_0x5e1f40,_[_0xcb01('0x2b')](_0x24c55,['event',_0xcb01('0x2c'),_0xcb01('0x27'),'state']));logger[_0xcb01('0x24')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0xcb01('0x1a')](_0x5e1f40,{'showHidden':![],'depth':null}));this[_0xcb01('0x21')](util[_0xcb01('0x2d')](_0xcb01('0x2e'),_0x5e1f40[_0xcb01('0x2f')]),_0xcb01('0x30'),_0x5e1f40);}}}catch(_0x1f76b7){logger[_0xcb01('0x1d')](_0xcb01('0x25'),util['inspect'](_0x1f76b7,{'showHidden':![],'depth':null}));}};UserReport[_0xcb01('0x1e')][_0xcb01('0x13')]=function(_0x413f2b){try{if(this[_0xcb01('0x1f')](_0x413f2b)){logger[_0xcb01('0x22')](_0xcb01('0x31'),_0x413f2b[_0xcb01('0x32')],_0x413f2b['state']);logger['debug'](_0xcb01('0x33'),util[_0xcb01('0x1a')](_0x413f2b,{'showHidden':![],'depth':null}));if(this[_0xcb01('0xd')][_0x413f2b[_0xcb01('0x32')]]){if(!this['agents'][_0x413f2b[_0xcb01('0x32')]][_0xcb01('0x34')]||_0x413f2b[_0xcb01('0x29')][_0xcb01('0x35')]()=='inuse'){this[_0xcb01('0xd')][_0x413f2b['device']]['local']=![];if(this['agents'][_0x413f2b[_0xcb01('0x32')]]['state']!==_0x413f2b[_0xcb01('0x29')][_0xcb01('0x35')]()){this[_0xcb01('0xd')][_0x413f2b[_0xcb01('0x32')]][_0xcb01('0x36')]=_['toNumber'](moment()[_0xcb01('0x2d')]('x'));}this['agents'][_0x413f2b['device']][_0xcb01('0x29')]=_0x413f2b[_0xcb01('0x29')][_0xcb01('0x35')]();this[_0xcb01('0xd')][_0x413f2b[_0xcb01('0x32')]]['updateStatusRealtime'](_0x413f2b);}}else if(this['telephones'][_0x413f2b[_0xcb01('0x32')]]){if(this[_0xcb01('0xe')][_0x413f2b['device']][_0xcb01('0x29')]!==_0x413f2b[_0xcb01('0x29')][_0xcb01('0x35')]()){this[_0xcb01('0xe')][_0x413f2b['device']][_0xcb01('0x36')]=_['toNumber'](moment()[_0xcb01('0x2d')]('x'));}this[_0xcb01('0xe')][_0x413f2b[_0xcb01('0x32')]][_0xcb01('0x29')]=_0x413f2b[_0xcb01('0x29')][_0xcb01('0x35')]();logger[_0xcb01('0x24')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0xcb01('0x1a')](this[_0xcb01('0xe')][_0x413f2b[_0xcb01('0x32')]],{'showHidden':![],'depth':null}));this[_0xcb01('0x21')](util['format']('telephone:%s',this[_0xcb01('0xe')][_0x413f2b[_0xcb01('0x32')]][_0xcb01('0x2f')]),_0xcb01('0x37'),this['telephones'][_0x413f2b[_0xcb01('0x32')]]);}else if(this[_0xcb01('0xc')][_0x413f2b[_0xcb01('0x32')]]){if(this[_0xcb01('0xc')][_0x413f2b[_0xcb01('0x32')]]['state']!==_0x413f2b['state'][_0xcb01('0x35')]()){this[_0xcb01('0xc')][_0x413f2b[_0xcb01('0x32')]][_0xcb01('0x36')]=_['toNumber'](moment()['format']('x'));}this[_0xcb01('0xc')][_0x413f2b[_0xcb01('0x32')]]['state']=_0x413f2b[_0xcb01('0x29')][_0xcb01('0x35')]();logger[_0xcb01('0x24')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util['inspect'](this[_0xcb01('0xc')][_0x413f2b['device']],{'showHidden':![],'depth':null}));this[_0xcb01('0x21')](util[_0xcb01('0x2d')](_0xcb01('0x2e'),this[_0xcb01('0xc')][_0x413f2b['device']][_0xcb01('0x2f')]),'trunk:save',this['trunks'][_0x413f2b[_0xcb01('0x32')]]);}else if(_[_0xcb01('0x38')](_0x413f2b['device'],_0xcb01('0x39'))){var _0x5b31e3=_0x413f2b[_0xcb01('0x32')];var _0x108d14=_0x5b31e3[_0xcb01('0x3a')](_0x5b31e3[_0xcb01('0x3b')]('/')+0x1,_0x5b31e3[_0xcb01('0x3b')]('@'));var _0x45c362=_['find'](this[_0xcb01('0xd')],function(_0x1c0b93){return _0x1c0b93[_0xcb01('0x3c')]==_0x108d14||_0x1c0b93[_0xcb01('0x3d')]==_0x108d14||_0x1c0b93[_0xcb01('0x3e')]==_0x108d14;});if(_0x45c362){if(_0x45c362[_0xcb01('0x29')]!==_0x413f2b[_0xcb01('0x29')][_0xcb01('0x35')]()){_0x45c362['stateTime']=_['toNumber'](moment()[_0xcb01('0x2d')]('x'));}_0x45c362[_0xcb01('0x29')]=_0x413f2b['state'][_0xcb01('0x35')]();_0x45c362[_0xcb01('0x34')]=!![];_0x45c362[_0xcb01('0x3f')](_0x413f2b);}}}}catch(_0x5e0202){logger[_0xcb01('0x1d')](_0xcb01('0x33'),util['inspect'](_0x5e0202,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xcb01('0x40')]=function(_0x39c9a5){try{if(this[_0xcb01('0x1f')](_0x39c9a5)&&this[_0xcb01('0x1f')](_0x39c9a5[_0xcb01('0x14')])){logger[_0xcb01('0x22')](_0xcb01('0x41'),_0x39c9a5['peer'],_0x39c9a5[_0xcb01('0x42')],_0x39c9a5[_0xcb01('0x14')]);logger[_0xcb01('0x24')](_0xcb01('0x43'),util['inspect'](_0x39c9a5,{'showHidden':![],'depth':null}));if(this[_0xcb01('0xd')][_0x39c9a5[_0xcb01('0x44')]]){if(!this[_0xcb01('0xd')][_0x39c9a5[_0xcb01('0x44')]][_0xcb01('0x34')]||_0x39c9a5[_0xcb01('0x14')][_0xcb01('0x35')]()=='registered'){this[_0xcb01('0xd')][_0x39c9a5['peer']]['local']=![];this[_0xcb01('0xd')][_0x39c9a5['peer']][_0xcb01('0x45')]=_0x39c9a5['peerstatus'][_0xcb01('0x35')]();this['agents'][_0x39c9a5[_0xcb01('0x44')]][_0xcb01('0x42')]=_0x39c9a5[_0xcb01('0x42')];this['agents'][_0x39c9a5[_0xcb01('0x44')]][_0xcb01('0x3f')](_0x39c9a5);}}else if(this['telephones'][_0x39c9a5[_0xcb01('0x44')]]){this['telephones'][_0x39c9a5['peer']][_0xcb01('0x45')]=_0x39c9a5[_0xcb01('0x14')][_0xcb01('0x35')]();this[_0xcb01('0xe')][_0x39c9a5[_0xcb01('0x44')]][_0xcb01('0x42')]=_0x39c9a5[_0xcb01('0x42')];logger[_0xcb01('0x24')](_0xcb01('0x46'),util['inspect'](this[_0xcb01('0xe')][_0x39c9a5['peer']],{'showHidden':![],'depth':null}));this[_0xcb01('0x21')](util[_0xcb01('0x2d')]('telephone:%s',this[_0xcb01('0xe')][_0x39c9a5[_0xcb01('0x44')]]['name']),_0xcb01('0x37'),this[_0xcb01('0xe')][_0x39c9a5['peer']]);}else if(this[_0xcb01('0xc')][_0x39c9a5[_0xcb01('0x44')]]){this[_0xcb01('0xc')][_0x39c9a5[_0xcb01('0x44')]][_0xcb01('0x45')]=_0x39c9a5[_0xcb01('0x14')][_0xcb01('0x35')]();this['trunks'][_0x39c9a5['peer']][_0xcb01('0x42')]=_0x39c9a5[_0xcb01('0x42')];logger[_0xcb01('0x24')](_0xcb01('0x47'),util['inspect'](this[_0xcb01('0xc')][_0x39c9a5[_0xcb01('0x44')]],{'showHidden':![],'depth':null}));this[_0xcb01('0x21')](util[_0xcb01('0x2d')](_0xcb01('0x2e'),this[_0xcb01('0xc')][_0x39c9a5['peer']][_0xcb01('0x2f')]),'trunk:save',this[_0xcb01('0xc')][_0x39c9a5['peer']]);}}}catch(_0x36159f){logger[_0xcb01('0x1d')]('[userReport][peerstatus]',util[_0xcb01('0x1a')](_0x36159f,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0xecbd=['trunk:%s','name','trunk:save','debug','device','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','startsWith','Local','substring','indexOf','mobile','phone','accountcode','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','util','bluebird','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','then','actionDeviceStateList','[userReport][devicestatelist]','resolve','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isUndefined','emit','isNotNull','info','username','[userReport][registry]','find','state','merge','omit','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format'];(function(_0x8f581c,_0xfbd8c){var _0x2c0c22=function(_0x23e343){while(--_0x23e343){_0x8f581c['push'](_0x8f581c['shift']());}};_0x2c0c22(++_0xfbd8c);}(_0xecbd,0x66));var _0xdecb=function(_0x40d8cb,_0x3ae045){_0x40d8cb=_0x40d8cb-0x0;var _0x252853=_0xecbd[_0x40d8cb];return _0x252853;};'use strict';var _=require(_0xdecb('0x0'));var moment=require(_0xdecb('0x1'));var util=require(_0xdecb('0x2'));var Redis=require('ioredis');var BPromise=require(_0xdecb('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require(_0xdecb('0x4'));config['redis']=_[_0xdecb('0x5')](config[_0xdecb('0x6')],{'host':_0xdecb('0x7'),'port':0x18eb});var io=require(_0xdecb('0x8'))(new Redis(config['redis']));function UserReport(_0x4652ee){this[_0xdecb('0x9')]=_0x4652ee[_0xdecb('0x9')];this[_0xdecb('0xa')]=_0x4652ee[_0xdecb('0xa')];this[_0xdecb('0xb')]=_0x4652ee[_0xdecb('0xb')];ami['on'](_0xdecb('0xc'),this[_0xdecb('0xd')][_0xdecb('0xe')](this));ami['on'](_0xdecb('0xf'),this[_0xdecb('0xd')]['bind'](this));ami['on'](_0xdecb('0x10'),this[_0xdecb('0x11')][_0xdecb('0xe')](this));ami['on'](_0xdecb('0x12'),this[_0xdecb('0x13')][_0xdecb('0xe')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()['then'](ami[_0xdecb('0x14')]())[_0xdecb('0x15')](function(_0x5ead02){logger[_0xdecb('0x16')](_0xdecb('0x17'),util[_0xdecb('0x18')](_0x5ead02,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xdecb('0x19')](ami[_0xdecb('0x1a')]())['catch'](function(_0x355ed6){logger[_0xdecb('0x16')](_0xdecb('0x1b'),util['inspect'](_0x355ed6,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xdecb('0x1c')]()[_0xdecb('0x19')](ami[_0xdecb('0x1d')]())[_0xdecb('0x15')](function(_0x45a556){logger[_0xdecb('0x16')](_0xdecb('0x1e'),util[_0xdecb('0x18')](_0x45a556,{'showHidden':![],'depth':null}));});}UserReport[_0xdecb('0x1f')][_0xdecb('0x20')]=function(){setInterval(function(){BPromise['resolve']()[_0xdecb('0x19')](showSipRegistrations())['then'](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0xdecb('0x1f')]['isNotNull']=function(_0x223066){return _0x223066!==null&&!_[_0xdecb('0x21')](_0x223066);};UserReport[_0xdecb('0x1f')][_0xdecb('0x22')]=function(_0x58540e,_0x39bf7d,_0x738e4c){io['to'](_0x58540e)[_0xdecb('0x22')](_0x39bf7d,_0x738e4c);};UserReport['prototype'][_0xdecb('0xd')]=function(_0xb70701){try{if(this[_0xdecb('0x23')](_0xb70701)){logger[_0xdecb('0x24')]('[userReport][registry]\x20registry:%s\x20state:%s',_0xb70701[_0xdecb('0x25')],_0xb70701['state']);logger['debug'](_0xdecb('0x26'),util['inspect'](_0xb70701,{'showHidden':![],'depth':null}));var _0x3bdcb3=_[_0xdecb('0x27')](this[_0xdecb('0x9')],{'defaultuser':_0xb70701[_0xdecb('0x25')]});if(_0x3bdcb3){_0xb70701['stateRegistry']=_0xb70701[_0xdecb('0x28')];_[_0xdecb('0x29')](_0x3bdcb3,_[_0xdecb('0x2a')](_0xb70701,['event',_0xdecb('0x2b'),_0xdecb('0x25'),_0xdecb('0x28')]));logger['debug'](_0xdecb('0x2c'),util['inspect'](_0x3bdcb3,{'showHidden':![],'depth':null}));this[_0xdecb('0x22')](util[_0xdecb('0x2d')](_0xdecb('0x2e'),_0x3bdcb3[_0xdecb('0x2f')]),_0xdecb('0x30'),_0x3bdcb3);}}}catch(_0x110795){logger[_0xdecb('0x16')](_0xdecb('0x26'),util[_0xdecb('0x18')](_0x110795,{'showHidden':![],'depth':null}));}};UserReport[_0xdecb('0x1f')][_0xdecb('0x11')]=function(_0x5d083d){try{if(this['isNotNull'](_0x5d083d)){logger[_0xdecb('0x24')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x5d083d['device'],_0x5d083d['state']);logger[_0xdecb('0x31')]('[userReport][devicestatechange]',util[_0xdecb('0x18')](_0x5d083d,{'showHidden':![],'depth':null}));if(this[_0xdecb('0xa')][_0x5d083d['device']]){if(!this['agents'][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x33')]||_0x5d083d[_0xdecb('0x28')][_0xdecb('0x34')]()=='inuse'){this[_0xdecb('0xa')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x33')]=![];if(this[_0xdecb('0xa')][_0x5d083d['device']][_0xdecb('0x28')]!==_0x5d083d[_0xdecb('0x28')][_0xdecb('0x34')]()){this[_0xdecb('0xa')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x35')]=_[_0xdecb('0x36')](moment()['format']('x'));}this['agents'][_0x5d083d[_0xdecb('0x32')]]['state']=_0x5d083d[_0xdecb('0x28')][_0xdecb('0x34')]();this[_0xdecb('0xa')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x37')](_0x5d083d);}}else if(this[_0xdecb('0xb')][_0x5d083d['device']]){if(this[_0xdecb('0xb')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x28')]!==_0x5d083d[_0xdecb('0x28')][_0xdecb('0x34')]()){this[_0xdecb('0xb')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x35')]=_[_0xdecb('0x36')](moment()[_0xdecb('0x2d')]('x'));}this[_0xdecb('0xb')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x28')]=_0x5d083d[_0xdecb('0x28')][_0xdecb('0x34')]();logger[_0xdecb('0x31')](_0xdecb('0x38'),util[_0xdecb('0x18')](this[_0xdecb('0xb')][_0x5d083d[_0xdecb('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xdecb('0x39'),this[_0xdecb('0xb')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x2f')]),_0xdecb('0x3a'),this[_0xdecb('0xb')][_0x5d083d['device']]);}else if(this['trunks'][_0x5d083d[_0xdecb('0x32')]]){if(this[_0xdecb('0x9')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x28')]!==_0x5d083d[_0xdecb('0x28')][_0xdecb('0x34')]()){this[_0xdecb('0x9')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x35')]=_[_0xdecb('0x36')](moment()[_0xdecb('0x2d')]('x'));}this['trunks'][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x28')]=_0x5d083d[_0xdecb('0x28')][_0xdecb('0x34')]();logger[_0xdecb('0x31')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xdecb('0x18')](this[_0xdecb('0x9')][_0x5d083d[_0xdecb('0x32')]],{'showHidden':![],'depth':null}));this[_0xdecb('0x22')](util['format'](_0xdecb('0x2e'),this[_0xdecb('0x9')][_0x5d083d['device']][_0xdecb('0x2f')]),_0xdecb('0x30'),this['trunks'][_0x5d083d[_0xdecb('0x32')]]);}else if(_[_0xdecb('0x3b')](_0x5d083d[_0xdecb('0x32')],_0xdecb('0x3c'))){var _0x59cf13=_0x5d083d[_0xdecb('0x32')];var _0x3b062c=_0x59cf13[_0xdecb('0x3d')](_0x59cf13[_0xdecb('0x3e')]('/')+0x1,_0x59cf13['indexOf']('@'));var _0x76b75e=_[_0xdecb('0x27')](this[_0xdecb('0xa')],function(_0xd9f1ff){return _0xd9f1ff[_0xdecb('0x3f')]==_0x3b062c||_0xd9f1ff[_0xdecb('0x40')]==_0x3b062c||_0xd9f1ff[_0xdecb('0x41')]==_0x3b062c;});if(_0x76b75e){if(_0x76b75e['state']!==_0x5d083d['state'][_0xdecb('0x34')]()){_0x76b75e[_0xdecb('0x35')]=_[_0xdecb('0x36')](moment()[_0xdecb('0x2d')]('x'));}_0x76b75e[_0xdecb('0x28')]=_0x5d083d[_0xdecb('0x28')][_0xdecb('0x34')]();_0x76b75e['local']=!![];_0x76b75e['updateStatusRealtime'](_0x5d083d);}}}}catch(_0x51616b){logger[_0xdecb('0x16')](_0xdecb('0x42'),util['inspect'](_0x51616b,{'showHidden':![],'depth':null}));}};UserReport[_0xdecb('0x1f')][_0xdecb('0x13')]=function(_0x3b546a){try{if(this[_0xdecb('0x23')](_0x3b546a)&&this[_0xdecb('0x23')](_0x3b546a['peerstatus'])){logger['info'](_0xdecb('0x43'),_0x3b546a[_0xdecb('0x44')],_0x3b546a[_0xdecb('0x45')],_0x3b546a[_0xdecb('0x12')]);logger[_0xdecb('0x31')](_0xdecb('0x46'),util[_0xdecb('0x18')](_0x3b546a,{'showHidden':![],'depth':null}));if(this['agents'][_0x3b546a[_0xdecb('0x44')]]){if(!this[_0xdecb('0xa')][_0x3b546a[_0xdecb('0x44')]]['local']||_0x3b546a['peerstatus']['toLowerCase']()=='registered'){this['agents'][_0x3b546a['peer']][_0xdecb('0x33')]=![];this[_0xdecb('0xa')][_0x3b546a[_0xdecb('0x44')]][_0xdecb('0x47')]=_0x3b546a[_0xdecb('0x12')]['toLowerCase']();this['agents'][_0x3b546a[_0xdecb('0x44')]][_0xdecb('0x45')]=_0x3b546a[_0xdecb('0x45')];this[_0xdecb('0xa')][_0x3b546a['peer']][_0xdecb('0x37')](_0x3b546a);}}else if(this['telephones'][_0x3b546a[_0xdecb('0x44')]]){this[_0xdecb('0xb')][_0x3b546a[_0xdecb('0x44')]][_0xdecb('0x47')]=_0x3b546a[_0xdecb('0x12')][_0xdecb('0x34')]();this[_0xdecb('0xb')][_0x3b546a['peer']][_0xdecb('0x45')]=_0x3b546a[_0xdecb('0x45')];logger[_0xdecb('0x31')](_0xdecb('0x48'),util[_0xdecb('0x18')](this[_0xdecb('0xb')][_0x3b546a[_0xdecb('0x44')]],{'showHidden':![],'depth':null}));this[_0xdecb('0x22')](util['format']('telephone:%s',this[_0xdecb('0xb')][_0x3b546a[_0xdecb('0x44')]]['name']),_0xdecb('0x3a'),this[_0xdecb('0xb')][_0x3b546a[_0xdecb('0x44')]]);}else if(this['trunks'][_0x3b546a[_0xdecb('0x44')]]){this['trunks'][_0x3b546a[_0xdecb('0x44')]]['status']=_0x3b546a[_0xdecb('0x12')][_0xdecb('0x34')]();this['trunks'][_0x3b546a[_0xdecb('0x44')]]['address']=_0x3b546a['address'];logger[_0xdecb('0x31')](_0xdecb('0x49'),util[_0xdecb('0x18')](this[_0xdecb('0x9')][_0x3b546a[_0xdecb('0x44')]],{'showHidden':![],'depth':null}));this[_0xdecb('0x22')](util[_0xdecb('0x2d')](_0xdecb('0x2e'),this[_0xdecb('0x9')][_0x3b546a['peer']][_0xdecb('0x2f')]),_0xdecb('0x30'),this[_0xdecb('0x9')][_0x3b546a[_0xdecb('0x44')]]);}}}catch(_0x38d60d){logger['error']('[userReport][peerstatus]',util['inspect'](_0x38d60d,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index ea11c9d..bb89255 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8658=['sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','ioredis','../../../config/environment','../ami','redis','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncHangup','musiconholdstart','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','inbound','merge','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','user:called','error','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','routealias','interface','pick','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','reason','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','omit','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','user:%s','[%s][voiceAgentReport][agentcomplete]','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt'];(function(_0x3ff96d,_0x4746c8){var _0x3f3331=function(_0x2fe88c){while(--_0x2fe88c){_0x3ff96d['push'](_0x3ff96d['shift']());}};_0x3f3331(++_0x4746c8);}(_0x8658,0x1d3));var _0x8865=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x8658[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x8865('0x0'));var moment=require(_0x8865('0x1'));var util=require(_0x8865('0x2'));var Redis=require(_0x8865('0x3'));var config=require(_0x8865('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0x8865('0x5'));config['redis']=_['defaults'](config[_0x8865('0x6')],{'host':_0x8865('0x7'),'port':0x18eb});var io=require(_0x8865('0x8'))(new Redis(config[_0x8865('0x6')]));function VoiceAgentReport(_0x3fd0f4){this[_0x8865('0x9')]={};this[_0x8865('0xa')]=_0x3fd0f4['channels'];this[_0x8865('0xb')]=_0x3fd0f4['voiceQueues'];this[_0x8865('0xc')]=_0x3fd0f4['agents'];this[_0x8865('0xd')]={};ami['on'](_0x8865('0xe'),this['syncAgentCalled'][_0x8865('0xf')](this));ami['on'](_0x8865('0x10'),this['syncAgentConnect']['bind'](this));ami['on'](_0x8865('0x11'),this[_0x8865('0x12')][_0x8865('0xf')](this));ami['on'](_0x8865('0x13'),this['syncQueueCallerAbandon'][_0x8865('0xf')](this));ami['on'](_0x8865('0x14'),this[_0x8865('0x15')][_0x8865('0xf')](this));ami['on'](_0x8865('0x16'),this['syncVarSet'][_0x8865('0xf')](this));ami['on']('hangup',this[_0x8865('0x17')][_0x8865('0xf')](this));ami['on'](_0x8865('0x18'),this['syncMusicOnHoldStart'][_0x8865('0xf')](this));ami['on']('musiconholdstop',this[_0x8865('0x19')][_0x8865('0xf')](this));ami['on']('attendedtransfer',this[_0x8865('0x1a')][_0x8865('0xf')](this));ami['on'](_0x8865('0x1b'),this['syncBlindTransfer'][_0x8865('0xf')](this));}VoiceAgentReport[_0x8865('0x1c')][_0x8865('0x1d')]=function(_0x44fddf,_0x3d80b9,_0x24b431){io['to'](_0x44fddf)[_0x8865('0x1d')](_0x3d80b9,_0x24b431);};VoiceAgentReport[_0x8865('0x1c')][_0x8865('0x1e')]=function(_0x3e9898){return _0x3e9898!==null&&!_[_0x8865('0x1f')](_0x3e9898);};VoiceAgentReport['prototype'][_0x8865('0x20')]=function(_0x232e21){try{if(this['isNotNull'](_0x232e21)){logger[_0x8865('0x21')](_0x8865('0x22'),_0x232e21['uniqueid'],_0x232e21[_0x8865('0x23')],_0x232e21['destuniqueid']);logger[_0x8865('0x24')](_0x8865('0x25'),_0x232e21[_0x8865('0x26')],util[_0x8865('0x27')](_0x232e21,{'showHidden':![],'depth':null}));if(_[_0x8865('0x1f')](this[_0x8865('0x9')][_0x232e21[_0x8865('0x26')]])){this['channels'][_0x232e21['uniqueid']]={};}if(_[_0x8865('0x1f')](this[_0x8865('0x9')][_0x232e21[_0x8865('0x26')]][_0x232e21['destuniqueid']])){this['channels'][_0x232e21['uniqueid']][_0x232e21[_0x8865('0x28')]]={'agentcalledAt':moment()[_0x8865('0x29')](_0x8865('0x2a')),'lastevent':'called','mandatoryDisposition':this[_0x8865('0xb')][_0x232e21[_0x8865('0x2b')]]?this[_0x8865('0xb')][_0x232e21[_0x8865('0x2b')]][_0x8865('0x2c')]||![]:![],'type':this[_0x8865('0xb')][_0x232e21[_0x8865('0x2b')]]?this[_0x8865('0xb')][_0x232e21[_0x8865('0x2b')]]['type']||_0x8865('0x2d'):'inbound','variables':this[_0x8865('0xd')][_0x232e21[_0x8865('0x26')]],'motionChannel':'voice'};}_[_0x8865('0x2e')](this[_0x8865('0x9')][_0x232e21['uniqueid']][_0x232e21['destuniqueid']],_['omit'](_0x232e21,['event',_0x8865('0x2f')]));logger['debug'](_0x8865('0x30'),_0x232e21['uniqueid'],util['inspect'](this[_0x8865('0x9')][_0x232e21['uniqueid']][_0x232e21[_0x8865('0x28')]],{'showHidden':![],'depth':null}));ami[_0x8865('0x1d')](_0x8865('0x31'),this[_0x8865('0x9')][_0x232e21[_0x8865('0x26')]][_0x232e21['destuniqueid']]);logger[_0x8865('0x24')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x232e21[_0x8865('0x26')],util[_0x8865('0x27')](this[_0x8865('0x9')][_0x232e21['uniqueid']][_0x232e21['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x8865('0x1d')](util[_0x8865('0x29')]('user:%s',_0x232e21[_0x8865('0x23')]),_0x8865('0x32'),this[_0x8865('0x9')][_0x232e21['uniqueid']][_0x232e21[_0x8865('0x28')]]);}}catch(_0x165d22){logger[_0x8865('0x33')]('[%s][voiceAgentReport][agentcalled]',_0x232e21['uniqueid'],util['inspect'](_0x165d22,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8865('0x1c')][_0x8865('0x34')]=function(_0x2d63aa){try{if(this[_0x8865('0x1e')](_0x2d63aa)){if(this['channels'][_0x2d63aa[_0x8865('0x26')]]){logger[_0x8865('0x24')](_0x8865('0x35'),_0x2d63aa[_0x8865('0x26')],util['inspect'](_0x2d63aa,{'showHidden':![],'depth':null}));for(var _0x58fa4a in this['channels'][_0x2d63aa['uniqueid']]){if(this[_0x8865('0x9')][_0x2d63aa['uniqueid']][_0x8865('0x36')](_0x58fa4a)){if(_0x2d63aa[_0x8865('0x28')]===_0x58fa4a){logger[_0x8865('0x21')](_0x8865('0x37'),_0x2d63aa[_0x8865('0x26')],_0x2d63aa[_0x8865('0x23')],_0x2d63aa[_0x8865('0x28')]);this[_0x8865('0x9')][_0x2d63aa[_0x8865('0x26')]][_0x58fa4a][_0x8865('0x38')]=moment()['format'](_0x8865('0x2a'));this[_0x8865('0x9')][_0x2d63aa[_0x8865('0x26')]][_0x58fa4a]['connectedlinename']=_0x2d63aa['connectedlinename'];this[_0x8865('0x9')][_0x2d63aa['uniqueid']][_0x58fa4a][_0x8865('0x39')]=_0x2d63aa[_0x8865('0x39')];this[_0x8865('0x9')][_0x2d63aa['uniqueid']][_0x58fa4a][_0x8865('0x3a')]=_0x2d63aa[_0x8865('0x3a')];this[_0x8865('0x9')][_0x2d63aa[_0x8865('0x26')]][_0x58fa4a][_0x8865('0x3b')]=_0x2d63aa[_0x8865('0x3b')];this['channels'][_0x2d63aa[_0x8865('0x26')]][_0x58fa4a][_0x8865('0x3c')]=_0x2d63aa[_0x8865('0x3c')];this['channels'][_0x2d63aa['uniqueid']][_0x58fa4a][_0x8865('0x3d')]='connect';if(this['voiceChannels'][this['channels'][_0x2d63aa[_0x8865('0x26')]][_0x58fa4a][_0x8865('0x26')]]){var _0x1fb81d=this[_0x8865('0xa')][this[_0x8865('0x9')][_0x2d63aa[_0x8865('0x26')]][_0x58fa4a][_0x8865('0x26')]]['routealias'];this[_0x8865('0x9')][_0x2d63aa[_0x8865('0x26')]][_0x58fa4a][_0x8865('0x3e')]=_0x1fb81d;_0x2d63aa[_0x8865('0x3e')]=_0x1fb81d;}_[_0x8865('0x2e')](this[_0x8865('0xc')][_0x2d63aa[_0x8865('0x3f')]],_[_0x8865('0x40')](_0x2d63aa,[_0x8865('0x2b'),'destconnectedlinenum',_0x8865('0x3e')]));logger[_0x8865('0x24')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x2d63aa[_0x8865('0x26')],util[_0x8865('0x27')](this[_0x8865('0x9')][_0x2d63aa['uniqueid']][_0x2d63aa['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x8865('0x1d')](_0x8865('0x41'),this[_0x8865('0x9')][_0x2d63aa['uniqueid']][_0x2d63aa[_0x8865('0x28')]]);logger[_0x8865('0x24')](_0x8865('0x42'),_0x2d63aa[_0x8865('0x26')],util['inspect'](this[_0x8865('0x9')][_0x2d63aa[_0x8865('0x26')]][_0x2d63aa[_0x8865('0x28')]],{'showHidden':![],'depth':null}));this[_0x8865('0x1d')](util[_0x8865('0x29')]('user:%s',_0x2d63aa[_0x8865('0x23')]),'user:agentconnect',this[_0x8865('0x9')][_0x2d63aa[_0x8865('0x26')]][_0x2d63aa[_0x8865('0x28')]]);}else if(!this[_0x8865('0x9')][_0x2d63aa['uniqueid']][_0x58fa4a][_0x8865('0x11')]&&!this['channels'][_0x2d63aa[_0x8865('0x26')]][_0x58fa4a][_0x8865('0x14')]){logger[_0x8865('0x21')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x2d63aa['uniqueid'],this[_0x8865('0x9')][_0x2d63aa[_0x8865('0x26')]][_0x58fa4a][_0x8865('0x23')],_0x58fa4a);this[_0x8865('0x9')][_0x2d63aa[_0x8865('0x26')]][_0x58fa4a][_0x8865('0x11')]=!![];this[_0x8865('0x9')][_0x2d63aa[_0x8865('0x26')]][_0x58fa4a]['agentringnoanswerAt']=moment()['format'](_0x8865('0x2a'));this[_0x8865('0x9')][_0x2d63aa[_0x8865('0x26')]][_0x58fa4a][_0x8865('0x43')]=_0x2d63aa[_0x8865('0x28')];this[_0x8865('0x9')][_0x2d63aa[_0x8865('0x26')]][_0x58fa4a][_0x8865('0x44')]=_0x2d63aa[_0x8865('0x23')];this[_0x8865('0x9')][_0x2d63aa[_0x8865('0x26')]][_0x58fa4a][_0x8865('0x3d')]=_0x8865('0x45');this[_0x8865('0x9')][_0x2d63aa['uniqueid']][_0x58fa4a]['reason']='answered_elsewhere';logger[_0x8865('0x24')](_0x8865('0x46'),_0x2d63aa[_0x8865('0x26')],util[_0x8865('0x27')](this[_0x8865('0x9')][_0x2d63aa[_0x8865('0x26')]][_0x58fa4a],{'showHidden':![],'depth':null}));ami['emit'](_0x8865('0x47'),this[_0x8865('0x9')][_0x2d63aa['uniqueid']][_0x58fa4a]);}}}}}}catch(_0x122d29){logger['error']('[%s][voiceAgentReport][agentconnect]',_0x2d63aa['uniqueid'],util[_0x8865('0x27')](_0x122d29,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8865('0x12')]=function(_0x105d27){try{if(this[_0x8865('0x1e')](_0x105d27)){logger[_0x8865('0x24')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x105d27[_0x8865('0x26')],util[_0x8865('0x27')](_0x105d27,{'showHidden':![],'depth':null}));if(this[_0x8865('0x9')][_0x105d27[_0x8865('0x26')]]&&this[_0x8865('0x9')][_0x105d27['uniqueid']][_0x105d27[_0x8865('0x28')]]){logger[_0x8865('0x21')](_0x8865('0x48'),_0x105d27['uniqueid'],_0x105d27[_0x8865('0x23')],_0x105d27[_0x8865('0x28')]);this[_0x8865('0x9')][_0x105d27[_0x8865('0x26')]][_0x105d27[_0x8865('0x28')]][_0x8865('0x11')]=!![];this[_0x8865('0x9')][_0x105d27[_0x8865('0x26')]][_0x105d27[_0x8865('0x28')]]['agentringnoanswerAt']=moment()[_0x8865('0x29')](_0x8865('0x2a'));this['channels'][_0x105d27[_0x8865('0x26')]][_0x105d27[_0x8865('0x28')]][_0x8865('0x3d')]=_0x8865('0x49');this['channels'][_0x105d27[_0x8865('0x26')]][_0x105d27[_0x8865('0x28')]][_0x8865('0x4a')]=_0x8865('0x49');logger[_0x8865('0x24')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x105d27[_0x8865('0x26')],util[_0x8865('0x27')](this[_0x8865('0x9')][_0x105d27['uniqueid']][_0x105d27['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x8865('0x1d')](_0x8865('0x4b'),this[_0x8865('0x9')][_0x105d27[_0x8865('0x26')]][_0x105d27[_0x8865('0x28')]]);}}}catch(_0x57bfa7){logger['error'](_0x8865('0x4c'),_0x105d27['uniqueid'],util[_0x8865('0x27')](_0x57bfa7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8865('0x1c')][_0x8865('0x4d')]=function(_0x54619f){try{if(this['isNotNull'](_0x54619f)){logger['debug'](_0x8865('0x4e'),_0x54619f[_0x8865('0x26')],util['inspect'](_0x54619f,{'showHidden':![],'depth':null}));if(this[_0x8865('0x9')][_0x54619f[_0x8865('0x26')]]){for(var _0x223b29 in this[_0x8865('0x9')][_0x54619f[_0x8865('0x26')]]){if(this[_0x8865('0x9')][_0x54619f[_0x8865('0x26')]][_0x8865('0x36')](_0x223b29)&&!this[_0x8865('0x9')][_0x54619f[_0x8865('0x26')]][_0x223b29][_0x8865('0x11')]&&!this[_0x8865('0x9')][_0x54619f[_0x8865('0x26')]][_0x223b29][_0x8865('0x14')]){logger[_0x8865('0x21')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x54619f['uniqueid'],this['channels'][_0x54619f[_0x8865('0x26')]][_0x223b29]['membername'],_0x223b29);this['channels'][_0x54619f[_0x8865('0x26')]][_0x223b29][_0x8865('0x11')]=!![];this[_0x8865('0x9')][_0x54619f['uniqueid']][_0x223b29]['agentringnoanswerAt']=moment()[_0x8865('0x29')](_0x8865('0x2a'));this[_0x8865('0x9')][_0x54619f['uniqueid']][_0x223b29][_0x8865('0x3d')]=_0x8865('0x4f');this[_0x8865('0x9')][_0x54619f[_0x8865('0x26')]][_0x223b29][_0x8865('0x4a')]=_0x8865('0x4f');logger['debug']('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x54619f['uniqueid'],util[_0x8865('0x27')](this[_0x8865('0x9')][_0x54619f[_0x8865('0x26')]][_0x223b29],{'showHidden':![],'depth':null}));ami[_0x8865('0x1d')]('custom:agentqueuecallerabandon',this['channels'][_0x54619f[_0x8865('0x26')]][_0x223b29]);}}}}}catch(_0x547dae){logger['error'](_0x8865('0x50'),_0x54619f['uniqueid'],util[_0x8865('0x27')](_0x547dae,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8865('0x1c')][_0x8865('0x15')]=function(_0x451ca6){try{if(this[_0x8865('0x1e')](_0x451ca6)){logger[_0x8865('0x24')](_0x8865('0x51'),_0x451ca6[_0x8865('0x26')],util['inspect'](_0x451ca6,{'showHidden':![],'depth':null}));if(this[_0x8865('0x9')][_0x451ca6[_0x8865('0x26')]]){for(var _0x521936 in this['channels'][_0x451ca6[_0x8865('0x26')]]){if(this[_0x8865('0x9')][_0x451ca6[_0x8865('0x26')]]['hasOwnProperty'](_0x521936)){if(this['channels'][_0x451ca6[_0x8865('0x26')]][_0x521936][_0x8865('0x38')]&&!this[_0x8865('0x9')][_0x451ca6['uniqueid']][_0x521936][_0x8865('0x14')]){logger[_0x8865('0x21')](_0x8865('0x52'),_0x451ca6[_0x8865('0x26')],this[_0x8865('0x9')][_0x451ca6['uniqueid']][_0x521936][_0x8865('0x23')],_0x521936);this[_0x8865('0x9')][_0x451ca6[_0x8865('0x26')]][_0x521936][_0x8865('0x14')]=!![];this['channels'][_0x451ca6[_0x8865('0x26')]][_0x521936]['agentcompleteAt']=moment()[_0x8865('0x29')](_0x8865('0x2a'));this[_0x8865('0x9')][_0x451ca6[_0x8865('0x26')]][_0x521936][_0x8865('0x3d')]=_0x8865('0x53');this['channels'][_0x451ca6[_0x8865('0x26')]][_0x521936][_0x8865('0x4a')]=_0x451ca6[_0x8865('0x4a')]==_0x8865('0x54')?_0x8865('0x55'):_0x451ca6['reason'];this[_0x8865('0x9')][_0x451ca6[_0x8865('0x26')]][_0x521936][_0x8865('0x56')]=_0x451ca6[_0x8865('0x56')];if(this[_0x8865('0xb')][_0x451ca6[_0x8865('0x2b')]]&&this[_0x8865('0xb')][_0x451ca6['queue']][_0x8865('0x57')]){this[_0x8865('0x9')][_0x451ca6['uniqueid']][_0x521936][_0x8865('0x58')]=this[_0x8865('0xb')][_0x451ca6[_0x8865('0x2b')]][_0x8865('0x59')];this['channels'][_0x451ca6[_0x8865('0x26')]][_0x521936][_0x8865('0x5a')]=!![];}this[_0x8865('0xc')][_0x451ca6['interface']]=_[_0x8865('0x5b')](this[_0x8865('0xc')][_0x451ca6[_0x8865('0x3f')]],['queue',_0x8865('0x5c')]);logger[_0x8865('0x24')](_0x8865('0x5d'),_0x451ca6[_0x8865('0x26')],util['inspect'](this[_0x8865('0x9')][_0x451ca6[_0x8865('0x26')]][_0x521936],{'showHidden':![],'depth':null}));ami[_0x8865('0x1d')]('custom:agentcomplete',this[_0x8865('0x9')][_0x451ca6[_0x8865('0x26')]][_0x521936]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x451ca6[_0x8865('0x26')],util[_0x8865('0x27')](this[_0x8865('0x9')][_0x451ca6[_0x8865('0x26')]][_0x521936],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x8865('0x5e'),_0x451ca6['membername']),'user:agentcomplete',this[_0x8865('0x9')][_0x451ca6['uniqueid']][_0x521936]);}}}}}}catch(_0x4f4bfc){logger[_0x8865('0x33')](_0x8865('0x5f'),_0x451ca6[_0x8865('0x26')],util['inspect'](_0x4f4bfc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8865('0x1c')]['syncVarSet']=function(_0x461f9c){try{if(this[_0x8865('0x1e')](_0x461f9c)){logger[_0x8865('0x24')]('[%s][voiceAgentReport][varset]\x20event:',_0x461f9c['uniqueid'],util[_0x8865('0x27')](_0x461f9c,{'showHidden':![],'depth':null}));this[_0x8865('0x60')](_0x461f9c[_0x8865('0x26')],_[_0x8865('0x61')](_0x461f9c[_0x8865('0x62')])[0x0],_0x461f9c[_0x8865('0x63')]);if(this[_0x8865('0x9')][_0x461f9c[_0x8865('0x26')]]){for(var _0x2a8ac3 in this[_0x8865('0x9')][_0x461f9c[_0x8865('0x26')]]){if(this[_0x8865('0x9')][_0x461f9c[_0x8865('0x26')]][_0x8865('0x36')](_0x2a8ac3)){logger['info'](_0x8865('0x64'),_0x461f9c['uniqueid'],_0x2a8ac3,_[_0x8865('0x61')](_0x461f9c[_0x8865('0x62')])[0x0],_0x461f9c[_0x8865('0x63')]);if(_[_0x8865('0x1f')](this[_0x8865('0x9')][_0x461f9c[_0x8865('0x26')]][_0x2a8ac3][_0x8865('0xd')])){this['channels'][_0x461f9c[_0x8865('0x26')]][_0x2a8ac3]['variables']={};}this[_0x8865('0x9')][_0x461f9c['uniqueid']][_0x2a8ac3][_0x8865('0xd')]=this[_0x8865('0xd')][_0x461f9c['uniqueid']];}}}}}catch(_0x35cb23){logger[_0x8865('0x33')](_0x8865('0x65'),_0x461f9c[_0x8865('0x26')],util['inspect'](_0x35cb23,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8865('0x1c')][_0x8865('0x60')]=function(_0x25de28,_0x3ee73b,_0x4f3386){var _0x526a1e=[_0x8865('0x66'),_0x8865('0x67'),_0x8865('0x68'),_0x8865('0x69'),_0x8865('0x6a'),_0x8865('0x6b'),_0x8865('0x6c'),'rtpaudioqosrttbridged',_0x8865('0x6d'),_0x8865('0x6e'),_0x8865('0x6f'),'bridgepvtcallid',_0x8865('0x70'),_0x8865('0x71'),_0x8865('0x72'),'memberlastcall','membername',_0x8865('0x73'),_0x8865('0x74')];if(!_[_0x8865('0x75')](_0x3ee73b)&&!_[_0x8865('0x76')](_0x526a1e,_0x3ee73b)){if(_[_0x8865('0x1f')](this['variables'][_0x25de28])){this[_0x8865('0xd')][_0x25de28]={};}this['variables'][_0x25de28][_0x3ee73b]=_0x4f3386;}};VoiceAgentReport[_0x8865('0x1c')][_0x8865('0x17')]=function(_0x1429e1){try{if(this[_0x8865('0x1e')](_0x1429e1)){logger[_0x8865('0x24')](_0x8865('0x77'),_0x1429e1[_0x8865('0x26')],util[_0x8865('0x27')](_0x1429e1,{'showHidden':![],'depth':null}));if(this['channels'][_0x1429e1[_0x8865('0x26')]]){for(var _0xe4b68c in this[_0x8865('0x9')][_0x1429e1[_0x8865('0x26')]]){if(this[_0x8865('0x9')][_0x1429e1[_0x8865('0x26')]]['hasOwnProperty'](_0xe4b68c)){if(this['channels'][_0x1429e1[_0x8865('0x26')]][_0xe4b68c]['reason']=='transfer'&&this[_0x8865('0x9')][_0x1429e1[_0x8865('0x26')]][_0xe4b68c][_0x8865('0x14')]){logger[_0x8865('0x21')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x1429e1[_0x8865('0x26')],_0xe4b68c);this[_0x8865('0x9')][_0x1429e1[_0x8865('0x26')]][_0xe4b68c][_0x8865('0x78')]=moment()[_0x8865('0x29')](_0x8865('0x2a'));}}}logger[_0x8865('0x24')](_0x8865('0x79'),_0x1429e1['uniqueid'],util['inspect'](_[_0x8865('0x7a')](this['channels'][_0x1429e1[_0x8865('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x8865('0x1d')](_0x8865('0x7b'),_[_0x8865('0x7a')](this[_0x8865('0x9')][_0x1429e1[_0x8865('0x26')]]));delete this[_0x8865('0x9')][_0x1429e1[_0x8865('0x26')]];}if(this[_0x8865('0xd')][_0x1429e1[_0x8865('0x26')]]){delete this['variables'][_0x1429e1[_0x8865('0x26')]];}}}catch(_0x47dc83){logger[_0x8865('0x33')](_0x8865('0x7c'),_0x1429e1[_0x8865('0x26')],util[_0x8865('0x27')](_0x47dc83,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8865('0x1c')][_0x8865('0x1a')]=function(_0x21b7b1){try{if(this[_0x8865('0x1e')](_0x21b7b1)){logger[_0x8865('0x24')](_0x8865('0x7d'),_0x21b7b1['uniqueid'],util[_0x8865('0x27')](_0x21b7b1,{'showHidden':![],'depth':null}));if(this[_0x8865('0x9')][_0x21b7b1[_0x8865('0x7e')]]){for(var _0x3d09ec in this[_0x8865('0x9')][_0x21b7b1[_0x8865('0x7e')]]){if(this[_0x8865('0x9')][_0x21b7b1[_0x8865('0x7e')]][_0x8865('0x36')](_0x3d09ec)){if(_0x21b7b1['origtransfereruniqueid']===_0x3d09ec){logger['info'](_0x8865('0x7f'),_0x21b7b1[_0x8865('0x26')],this[_0x8865('0x9')][_0x21b7b1['transfereeuniqueid']][_0x3d09ec][_0x8865('0x23')],_0x3d09ec);var _0x1506a1=moment();this[_0x8865('0x9')][_0x21b7b1[_0x8865('0x7e')]][_0x3d09ec]['agentcomplete']=!![];this[_0x8865('0x9')][_0x21b7b1[_0x8865('0x7e')]][_0x3d09ec][_0x8865('0x78')]=moment()[_0x8865('0x29')](_0x8865('0x2a'));this[_0x8865('0x9')][_0x21b7b1['transfereeuniqueid']][_0x3d09ec][_0x8865('0x3d')]=_0x8865('0x53');this[_0x8865('0x9')][_0x21b7b1['transfereeuniqueid']][_0x3d09ec][_0x8865('0x4a')]=_0x8865('0x54');this[_0x8865('0x9')][_0x21b7b1[_0x8865('0x7e')]][_0x3d09ec][_0x8865('0x56')]=_0x1506a1[_0x8865('0x80')](this[_0x8865('0x9')][_0x21b7b1[_0x8865('0x7e')]][_0x3d09ec][_0x8865('0x38')],_0x8865('0x81'));}}}}if(this[_0x8865('0x9')][_0x21b7b1[_0x8865('0x82')]]){var _0x297d75=this[_0x8865('0x9')][_0x21b7b1[_0x8865('0x82')]];this[_0x8865('0x9')][_0x21b7b1[_0x8865('0x82')]]=this[_0x8865('0x9')][_0x21b7b1[_0x8865('0x7e')]];this[_0x8865('0x9')][_0x21b7b1[_0x8865('0x7e')]]=_0x297d75;}}}catch(_0x25640f){logger[_0x8865('0x33')](_0x8865('0x83'),_0x21b7b1[_0x8865('0x26')],util['inspect'](_0x25640f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8865('0x1c')][_0x8865('0x84')]=function(_0x5ad66c){try{if(this['isNotNull'](_0x5ad66c)){logger[_0x8865('0x24')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x5ad66c[_0x8865('0x26')],util[_0x8865('0x27')](_0x5ad66c,{'showHidden':![],'depth':null}));if(this[_0x8865('0x9')][_0x5ad66c[_0x8865('0x7e')]]){for(var _0x102f18 in this[_0x8865('0x9')][_0x5ad66c[_0x8865('0x7e')]]){if(this[_0x8865('0x9')][_0x5ad66c[_0x8865('0x7e')]][_0x8865('0x36')](_0x102f18)){if(_0x5ad66c[_0x8865('0x85')]===_0x102f18){logger['info'](_0x8865('0x86'),_0x5ad66c[_0x8865('0x26')],this[_0x8865('0x9')][_0x5ad66c[_0x8865('0x7e')]][_0x102f18]['membername'],_0x102f18);var _0x22346e=moment();this[_0x8865('0x9')][_0x5ad66c[_0x8865('0x7e')]][_0x102f18][_0x8865('0x14')]=!![];this[_0x8865('0x9')][_0x5ad66c['transfereeuniqueid']][_0x102f18][_0x8865('0x78')]=_0x22346e;this[_0x8865('0x9')][_0x5ad66c[_0x8865('0x7e')]][_0x102f18][_0x8865('0x3d')]=_0x8865('0x53');this['channels'][_0x5ad66c[_0x8865('0x7e')]][_0x102f18][_0x8865('0x4a')]=_0x8865('0x54');this['channels'][_0x5ad66c[_0x8865('0x7e')]][_0x102f18]['talktime']=_0x22346e[_0x8865('0x80')](this[_0x8865('0x9')][_0x5ad66c[_0x8865('0x7e')]][_0x102f18][_0x8865('0x38')],'seconds');}}}}}}catch(_0x19c546){logger[_0x8865('0x33')](_0x8865('0x87'),_0x5ad66c[_0x8865('0x26')],util['inspect'](_0x19c546,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0xf93bc4){var _0x56d7f1='';try{if(this[_0x8865('0x1e')](_0xf93bc4)){logger[_0x8865('0x24')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0xf93bc4['uniqueid'],util['inspect'](_0xf93bc4,{'showHidden':![],'depth':null}));if(_0xf93bc4[_0x8865('0x88')]){_0x56d7f1=_0xf93bc4[_0x8865('0x88')]['substring'](0x0,_0xf93bc4[_0x8865('0x88')][_0x8865('0x89')]('-'));if(this[_0x8865('0xc')][_0x56d7f1]){logger[_0x8865('0x21')](_0x8865('0x8a'),_0xf93bc4['uniqueid'],_0x56d7f1);this[_0x8865('0xc')][_0x56d7f1][_0x8865('0x8b')]=!![];}}}}catch(_0xb7289b){logger['error'](_0x8865('0x8c'),_0xf93bc4[_0x8865('0x26')],util[_0x8865('0x27')](_0xb7289b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8865('0x1c')][_0x8865('0x19')]=function(_0x32917d){var _0x521f51='';try{if(this[_0x8865('0x1e')](_0x32917d)){logger[_0x8865('0x24')](_0x8865('0x8d'),_0x32917d[_0x8865('0x26')],util[_0x8865('0x27')](_0x32917d,{'showHidden':![],'depth':null}));if(_0x32917d[_0x8865('0x88')]){_0x521f51=_0x32917d[_0x8865('0x88')]['substring'](0x0,_0x32917d[_0x8865('0x88')][_0x8865('0x89')]('-'));if(this['agents'][_0x521f51]){logger[_0x8865('0x21')](_0x8865('0x8e'),_0x32917d[_0x8865('0x26')],_0x521f51);this[_0x8865('0xc')][_0x521f51][_0x8865('0x8b')]=![];}}}}catch(_0x5bf5ba){logger['error'](_0x8865('0x8f'),_0x32917d[_0x8865('0x26')],util[_0x8865('0x27')](_0x5bf5ba,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x3c3e=['syncQueueCallerAbandon','agentcomplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','inbound','voice','merge','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','user:%s','user:called','error','isNotNull','[%s][voiceAgentReport][agentconnect]\x20event:','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','routealias','interface','pick','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswer','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','lastevent','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','hasOwnProperty','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','voiceChannels','voiceQueues','agents','variables','syncAgentCalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3c3e,0x86));var _0xe3c3=function(_0x4fda14,_0x6ab4cb){_0x4fda14=_0x4fda14-0x0;var _0x570673=_0x3c3e[_0x4fda14];return _0x570673;};'use strict';var _=require(_0xe3c3('0x0'));var moment=require(_0xe3c3('0x1'));var util=require(_0xe3c3('0x2'));var Redis=require('ioredis');var config=require(_0xe3c3('0x3'));var logger=require('../../../config/logger')(_0xe3c3('0x4'));var ami=require(_0xe3c3('0x5'));config[_0xe3c3('0x6')]=_[_0xe3c3('0x7')](config[_0xe3c3('0x6')],{'host':_0xe3c3('0x8'),'port':0x18eb});var io=require(_0xe3c3('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x2edc07){this['channels']={};this[_0xe3c3('0xa')]=_0x2edc07['channels'];this['voiceQueues']=_0x2edc07[_0xe3c3('0xb')];this['agents']=_0x2edc07[_0xe3c3('0xc')];this[_0xe3c3('0xd')]={};ami['on']('agentcalled',this[_0xe3c3('0xe')][_0xe3c3('0xf')](this));ami['on'](_0xe3c3('0x10'),this[_0xe3c3('0x11')][_0xe3c3('0xf')](this));ami['on']('agentringnoanswer',this[_0xe3c3('0x12')]['bind'](this));ami['on'](_0xe3c3('0x13'),this[_0xe3c3('0x14')][_0xe3c3('0xf')](this));ami['on'](_0xe3c3('0x15'),this['syncAgentComplete']['bind'](this));ami['on'](_0xe3c3('0x16'),this[_0xe3c3('0x17')][_0xe3c3('0xf')](this));ami['on'](_0xe3c3('0x18'),this[_0xe3c3('0x19')][_0xe3c3('0xf')](this));ami['on'](_0xe3c3('0x1a'),this[_0xe3c3('0x1b')]['bind'](this));ami['on'](_0xe3c3('0x1c'),this[_0xe3c3('0x1d')][_0xe3c3('0xf')](this));ami['on'](_0xe3c3('0x1e'),this[_0xe3c3('0x1f')][_0xe3c3('0xf')](this));ami['on'](_0xe3c3('0x20'),this[_0xe3c3('0x21')][_0xe3c3('0xf')](this));}VoiceAgentReport[_0xe3c3('0x22')]['emit']=function(_0x1d013c,_0x5813b5,_0xab72f8){io['to'](_0x1d013c)[_0xe3c3('0x23')](_0x5813b5,_0xab72f8);};VoiceAgentReport['prototype']['isNotNull']=function(_0x117dcc){return _0x117dcc!==null&&!_[_0xe3c3('0x24')](_0x117dcc);};VoiceAgentReport[_0xe3c3('0x22')]['syncAgentCalled']=function(_0x29fe7f){try{if(this['isNotNull'](_0x29fe7f)){logger['info'](_0xe3c3('0x25'),_0x29fe7f[_0xe3c3('0x26')],_0x29fe7f[_0xe3c3('0x27')],_0x29fe7f[_0xe3c3('0x28')]);logger[_0xe3c3('0x29')](_0xe3c3('0x2a'),_0x29fe7f[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x29fe7f,{'showHidden':![],'depth':null}));if(_[_0xe3c3('0x24')](this[_0xe3c3('0x2c')][_0x29fe7f[_0xe3c3('0x26')]])){this[_0xe3c3('0x2c')][_0x29fe7f[_0xe3c3('0x26')]]={};}if(_[_0xe3c3('0x24')](this[_0xe3c3('0x2c')][_0x29fe7f[_0xe3c3('0x26')]][_0x29fe7f['destuniqueid']])){this[_0xe3c3('0x2c')][_0x29fe7f['uniqueid']][_0x29fe7f[_0xe3c3('0x28')]]={'agentcalledAt':moment()[_0xe3c3('0x2d')](_0xe3c3('0x2e')),'lastevent':_0xe3c3('0x2f'),'mandatoryDisposition':this[_0xe3c3('0xb')][_0x29fe7f[_0xe3c3('0x30')]]?this[_0xe3c3('0xb')][_0x29fe7f['queue']][_0xe3c3('0x31')]||![]:![],'type':this[_0xe3c3('0xb')][_0x29fe7f[_0xe3c3('0x30')]]?this[_0xe3c3('0xb')][_0x29fe7f[_0xe3c3('0x30')]]['type']||_0xe3c3('0x32'):_0xe3c3('0x32'),'variables':this['variables'][_0x29fe7f[_0xe3c3('0x26')]],'motionChannel':_0xe3c3('0x33')};}_[_0xe3c3('0x34')](this['channels'][_0x29fe7f[_0xe3c3('0x26')]][_0x29fe7f[_0xe3c3('0x28')]],_[_0xe3c3('0x35')](_0x29fe7f,['event',_0xe3c3('0x36')]));logger[_0xe3c3('0x29')](_0xe3c3('0x37'),_0x29fe7f[_0xe3c3('0x26')],util['inspect'](this[_0xe3c3('0x2c')][_0x29fe7f[_0xe3c3('0x26')]][_0x29fe7f[_0xe3c3('0x28')]],{'showHidden':![],'depth':null}));ami[_0xe3c3('0x23')]('custom:agentcalled',this[_0xe3c3('0x2c')][_0x29fe7f[_0xe3c3('0x26')]][_0x29fe7f[_0xe3c3('0x28')]]);logger[_0xe3c3('0x29')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x29fe7f[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](this['channels'][_0x29fe7f[_0xe3c3('0x26')]][_0x29fe7f[_0xe3c3('0x28')]],{'showHidden':![],'depth':null}));this[_0xe3c3('0x23')](util['format'](_0xe3c3('0x38'),_0x29fe7f['membername']),_0xe3c3('0x39'),this[_0xe3c3('0x2c')][_0x29fe7f[_0xe3c3('0x26')]][_0x29fe7f['destuniqueid']]);}}catch(_0x19c537){logger[_0xe3c3('0x3a')]('[%s][voiceAgentReport][agentcalled]',_0x29fe7f[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x19c537,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe3c3('0x22')]['syncAgentConnect']=function(_0x22651d){try{if(this[_0xe3c3('0x3b')](_0x22651d)){if(this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]]){logger[_0xe3c3('0x29')](_0xe3c3('0x3c'),_0x22651d['uniqueid'],util['inspect'](_0x22651d,{'showHidden':![],'depth':null}));for(var _0x4997fc in this['channels'][_0x22651d[_0xe3c3('0x26')]]){if(this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]]['hasOwnProperty'](_0x4997fc)){if(_0x22651d[_0xe3c3('0x28')]===_0x4997fc){logger[_0xe3c3('0x3d')](_0xe3c3('0x3e'),_0x22651d[_0xe3c3('0x26')],_0x22651d[_0xe3c3('0x27')],_0x22651d[_0xe3c3('0x28')]);this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x3f')]=moment()[_0xe3c3('0x2d')](_0xe3c3('0x2e'));this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x40')]=_0x22651d[_0xe3c3('0x40')];this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x41')]=_0x22651d[_0xe3c3('0x41')];this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x42')]=_0x22651d[_0xe3c3('0x42')];this[_0xe3c3('0x2c')][_0x22651d['uniqueid']][_0x4997fc][_0xe3c3('0x43')]=_0x22651d['destchannelstatedesc'];this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc]['holdtime']=_0x22651d[_0xe3c3('0x44')];this['channels'][_0x22651d[_0xe3c3('0x26')]][_0x4997fc]['lastevent']=_0xe3c3('0x45');if(this[_0xe3c3('0xa')][this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x26')]]){var _0x1e2fbc=this[_0xe3c3('0xa')][this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x26')]][_0xe3c3('0x46')];this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x46')]=_0x1e2fbc;_0x22651d[_0xe3c3('0x46')]=_0x1e2fbc;}_[_0xe3c3('0x34')](this[_0xe3c3('0xc')][_0x22651d[_0xe3c3('0x47')]],_[_0xe3c3('0x48')](_0x22651d,['queue','destconnectedlinenum',_0xe3c3('0x46')]));logger[_0xe3c3('0x29')](_0xe3c3('0x49'),_0x22651d[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x22651d['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xe3c3('0x23')]('custom:agentconnect',this['channels'][_0x22651d[_0xe3c3('0x26')]][_0x22651d[_0xe3c3('0x28')]]);logger[_0xe3c3('0x29')](_0xe3c3('0x4a'),_0x22651d[_0xe3c3('0x26')],util['inspect'](this['channels'][_0x22651d[_0xe3c3('0x26')]][_0x22651d[_0xe3c3('0x28')]],{'showHidden':![],'depth':null}));this[_0xe3c3('0x23')](util['format'](_0xe3c3('0x38'),_0x22651d[_0xe3c3('0x27')]),_0xe3c3('0x4b'),this[_0xe3c3('0x2c')][_0x22651d['uniqueid']][_0x22651d[_0xe3c3('0x28')]]);}else if(!this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc]['agentringnoanswer']&&!this['channels'][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x15')]){logger['info'](_0xe3c3('0x4c'),_0x22651d['uniqueid'],this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x27')],_0x4997fc);this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x4d')]=!![];this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc]['agentringnoanswerAt']=moment()[_0xe3c3('0x2d')](_0xe3c3('0x2e'));this['channels'][_0x22651d[_0xe3c3('0x26')]][_0x4997fc]['answeredelsewheredestinationuniqueid']=_0x22651d[_0xe3c3('0x28')];this['channels'][_0x22651d[_0xe3c3('0x26')]][_0x4997fc]['answeredelsewheremembername']=_0x22651d[_0xe3c3('0x27')];this['channels'][_0x22651d['uniqueid']][_0x4997fc]['lastevent']=_0xe3c3('0x4e');this[_0xe3c3('0x2c')][_0x22651d['uniqueid']][_0x4997fc][_0xe3c3('0x4f')]=_0xe3c3('0x4e');logger[_0xe3c3('0x29')](_0xe3c3('0x50'),_0x22651d[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](this['channels'][_0x22651d['uniqueid']][_0x4997fc],{'showHidden':![],'depth':null}));ami[_0xe3c3('0x23')](_0xe3c3('0x51'),this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc]);}}}}}}catch(_0x4d51c4){logger[_0xe3c3('0x3a')](_0xe3c3('0x52'),_0x22651d[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x4d51c4,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe3c3('0x12')]=function(_0x19b793){try{if(this['isNotNull'](_0x19b793)){logger[_0xe3c3('0x29')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x19b793[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x19b793,{'showHidden':![],'depth':null}));if(this['channels'][_0x19b793[_0xe3c3('0x26')]]&&this[_0xe3c3('0x2c')][_0x19b793[_0xe3c3('0x26')]][_0x19b793['destuniqueid']]){logger[_0xe3c3('0x3d')](_0xe3c3('0x53'),_0x19b793[_0xe3c3('0x26')],_0x19b793[_0xe3c3('0x27')],_0x19b793[_0xe3c3('0x28')]);this['channels'][_0x19b793['uniqueid']][_0x19b793[_0xe3c3('0x28')]]['agentringnoanswer']=!![];this['channels'][_0x19b793[_0xe3c3('0x26')]][_0x19b793[_0xe3c3('0x28')]][_0xe3c3('0x54')]=moment()[_0xe3c3('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe3c3('0x2c')][_0x19b793[_0xe3c3('0x26')]][_0x19b793[_0xe3c3('0x28')]][_0xe3c3('0x55')]=_0xe3c3('0x56');this[_0xe3c3('0x2c')][_0x19b793[_0xe3c3('0x26')]][_0x19b793[_0xe3c3('0x28')]]['reason']='rejected';logger[_0xe3c3('0x29')](_0xe3c3('0x57'),_0x19b793[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](this['channels'][_0x19b793[_0xe3c3('0x26')]][_0x19b793[_0xe3c3('0x28')]],{'showHidden':![],'depth':null}));ami['emit'](_0xe3c3('0x58'),this[_0xe3c3('0x2c')][_0x19b793[_0xe3c3('0x26')]][_0x19b793[_0xe3c3('0x28')]]);}}}catch(_0x111495){logger[_0xe3c3('0x3a')]('[%s][voiceAgentReport][agentringnoanswer]',_0x19b793[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x111495,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe3c3('0x22')][_0xe3c3('0x14')]=function(_0x24a228){try{if(this[_0xe3c3('0x3b')](_0x24a228)){logger[_0xe3c3('0x29')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x24a228['uniqueid'],util[_0xe3c3('0x2b')](_0x24a228,{'showHidden':![],'depth':null}));if(this[_0xe3c3('0x2c')][_0x24a228['uniqueid']]){for(var _0x1fb140 in this[_0xe3c3('0x2c')][_0x24a228[_0xe3c3('0x26')]]){if(this[_0xe3c3('0x2c')][_0x24a228['uniqueid']][_0xe3c3('0x59')](_0x1fb140)&&!this['channels'][_0x24a228[_0xe3c3('0x26')]][_0x1fb140][_0xe3c3('0x4d')]&&!this[_0xe3c3('0x2c')][_0x24a228['uniqueid']][_0x1fb140][_0xe3c3('0x15')]){logger[_0xe3c3('0x3d')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x24a228['uniqueid'],this[_0xe3c3('0x2c')][_0x24a228[_0xe3c3('0x26')]][_0x1fb140][_0xe3c3('0x27')],_0x1fb140);this['channels'][_0x24a228['uniqueid']][_0x1fb140][_0xe3c3('0x4d')]=!![];this[_0xe3c3('0x2c')][_0x24a228[_0xe3c3('0x26')]][_0x1fb140]['agentringnoanswerAt']=moment()[_0xe3c3('0x2d')](_0xe3c3('0x2e'));this[_0xe3c3('0x2c')][_0x24a228[_0xe3c3('0x26')]][_0x1fb140][_0xe3c3('0x55')]=_0xe3c3('0x5a');this['channels'][_0x24a228[_0xe3c3('0x26')]][_0x1fb140][_0xe3c3('0x4f')]='abandoned';logger['debug'](_0xe3c3('0x5b'),_0x24a228[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](this[_0xe3c3('0x2c')][_0x24a228[_0xe3c3('0x26')]][_0x1fb140],{'showHidden':![],'depth':null}));ami[_0xe3c3('0x23')](_0xe3c3('0x5c'),this[_0xe3c3('0x2c')][_0x24a228['uniqueid']][_0x1fb140]);}}}}}catch(_0x1b6774){logger[_0xe3c3('0x3a')](_0xe3c3('0x5d'),_0x24a228['uniqueid'],util[_0xe3c3('0x2b')](_0x1b6774,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe3c3('0x5e')]=function(_0x4dd5c6){try{if(this[_0xe3c3('0x3b')](_0x4dd5c6)){logger[_0xe3c3('0x29')](_0xe3c3('0x5f'),_0x4dd5c6[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x4dd5c6,{'showHidden':![],'depth':null}));if(this[_0xe3c3('0x2c')][_0x4dd5c6[_0xe3c3('0x26')]]){for(var _0x2a5822 in this[_0xe3c3('0x2c')][_0x4dd5c6['uniqueid']]){if(this[_0xe3c3('0x2c')][_0x4dd5c6[_0xe3c3('0x26')]]['hasOwnProperty'](_0x2a5822)){if(this['channels'][_0x4dd5c6['uniqueid']][_0x2a5822][_0xe3c3('0x3f')]&&!this['channels'][_0x4dd5c6['uniqueid']][_0x2a5822][_0xe3c3('0x15')]){logger[_0xe3c3('0x3d')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4dd5c6[_0xe3c3('0x26')],this[_0xe3c3('0x2c')][_0x4dd5c6['uniqueid']][_0x2a5822][_0xe3c3('0x27')],_0x2a5822);this[_0xe3c3('0x2c')][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822][_0xe3c3('0x15')]=!![];this[_0xe3c3('0x2c')][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822][_0xe3c3('0x60')]=moment()[_0xe3c3('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe3c3('0x2c')][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822][_0xe3c3('0x55')]=_0xe3c3('0x61');this[_0xe3c3('0x2c')][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822][_0xe3c3('0x4f')]=_0x4dd5c6[_0xe3c3('0x4f')]==_0xe3c3('0x62')?_0xe3c3('0x63'):_0x4dd5c6[_0xe3c3('0x4f')];this['channels'][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822][_0xe3c3('0x64')]=_0x4dd5c6['talktime'];if(this[_0xe3c3('0xb')][_0x4dd5c6['queue']]&&this['voiceQueues'][_0x4dd5c6[_0xe3c3('0x30')]][_0xe3c3('0x65')]){this['channels'][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822][_0xe3c3('0x66')]=this['voiceQueues'][_0x4dd5c6[_0xe3c3('0x30')]][_0xe3c3('0x67')];this['channels'][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822][_0xe3c3('0x68')]=!![];}this[_0xe3c3('0xc')][_0x4dd5c6[_0xe3c3('0x47')]]=_[_0xe3c3('0x35')](this['agents'][_0x4dd5c6[_0xe3c3('0x47')]],[_0xe3c3('0x30'),'destconnectedlinenum']);logger[_0xe3c3('0x29')](_0xe3c3('0x69'),_0x4dd5c6[_0xe3c3('0x26')],util['inspect'](this['channels'][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822],{'showHidden':![],'depth':null}));ami[_0xe3c3('0x23')]('custom:agentcomplete',this[_0xe3c3('0x2c')][_0x4dd5c6['uniqueid']][_0x2a5822]);logger['debug'](_0xe3c3('0x6a'),_0x4dd5c6[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](this[_0xe3c3('0x2c')][_0x4dd5c6['uniqueid']][_0x2a5822],{'showHidden':![],'depth':null}));this[_0xe3c3('0x23')](util[_0xe3c3('0x2d')](_0xe3c3('0x38'),_0x4dd5c6[_0xe3c3('0x27')]),_0xe3c3('0x6b'),this[_0xe3c3('0x2c')][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822]);}}}}}}catch(_0x13f327){logger[_0xe3c3('0x3a')]('[%s][voiceAgentReport][agentcomplete]',_0x4dd5c6[_0xe3c3('0x26')],util['inspect'](_0x13f327,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe3c3('0x22')][_0xe3c3('0x17')]=function(_0x18826c){try{if(this[_0xe3c3('0x3b')](_0x18826c)){logger[_0xe3c3('0x29')](_0xe3c3('0x6c'),_0x18826c['uniqueid'],util[_0xe3c3('0x2b')](_0x18826c,{'showHidden':![],'depth':null}));this[_0xe3c3('0x6d')](_0x18826c[_0xe3c3('0x26')],_[_0xe3c3('0x6e')](_0x18826c['variable'])[0x0],_0x18826c[_0xe3c3('0x6f')]);if(this[_0xe3c3('0x2c')][_0x18826c[_0xe3c3('0x26')]]){for(var _0x2c8eee in this[_0xe3c3('0x2c')][_0x18826c[_0xe3c3('0x26')]]){if(this[_0xe3c3('0x2c')][_0x18826c[_0xe3c3('0x26')]][_0xe3c3('0x59')](_0x2c8eee)){logger[_0xe3c3('0x3d')](_0xe3c3('0x70'),_0x18826c['uniqueid'],_0x2c8eee,_['keys'](_0x18826c[_0xe3c3('0x71')])[0x0],_0x18826c[_0xe3c3('0x6f')]);if(_[_0xe3c3('0x24')](this[_0xe3c3('0x2c')][_0x18826c[_0xe3c3('0x26')]][_0x2c8eee][_0xe3c3('0xd')])){this[_0xe3c3('0x2c')][_0x18826c[_0xe3c3('0x26')]][_0x2c8eee]['variables']={};}this['channels'][_0x18826c[_0xe3c3('0x26')]][_0x2c8eee]['variables']=this[_0xe3c3('0xd')][_0x18826c[_0xe3c3('0x26')]];}}}}}catch(_0x3d326c){logger['error']('[%s][voiceAgentReport][varset]',_0x18826c['uniqueid'],util[_0xe3c3('0x2b')](_0x3d326c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe3c3('0x22')][_0xe3c3('0x6d')]=function(_0x40e922,_0xd2dd01,_0x1b468f){var _0xd8c0f7=[_0xe3c3('0x72'),_0xe3c3('0x73'),_0xe3c3('0x74'),'rtpaudioqosjitterbridged',_0xe3c3('0x75'),_0xe3c3('0x76'),_0xe3c3('0x77'),_0xe3c3('0x78'),_0xe3c3('0x79'),_0xe3c3('0x7a'),_0xe3c3('0x7b'),_0xe3c3('0x7c'),_0xe3c3('0x7d'),_0xe3c3('0x7e'),_0xe3c3('0x7f'),'memberlastcall',_0xe3c3('0x27'),_0xe3c3('0x80'),_0xe3c3('0x81')];if(!_['isNil'](_0xd2dd01)&&!_[_0xe3c3('0x82')](_0xd8c0f7,_0xd2dd01)){if(_[_0xe3c3('0x24')](this[_0xe3c3('0xd')][_0x40e922])){this[_0xe3c3('0xd')][_0x40e922]={};}this[_0xe3c3('0xd')][_0x40e922][_0xd2dd01]=_0x1b468f;}};VoiceAgentReport[_0xe3c3('0x22')][_0xe3c3('0x19')]=function(_0x5964db){try{if(this[_0xe3c3('0x3b')](_0x5964db)){logger[_0xe3c3('0x29')](_0xe3c3('0x83'),_0x5964db[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x5964db,{'showHidden':![],'depth':null}));if(this[_0xe3c3('0x2c')][_0x5964db[_0xe3c3('0x26')]]){for(var _0x3f4a3c in this[_0xe3c3('0x2c')][_0x5964db[_0xe3c3('0x26')]]){if(this[_0xe3c3('0x2c')][_0x5964db[_0xe3c3('0x26')]][_0xe3c3('0x59')](_0x3f4a3c)){if(this[_0xe3c3('0x2c')][_0x5964db[_0xe3c3('0x26')]][_0x3f4a3c][_0xe3c3('0x4f')]==_0xe3c3('0x62')&&this['channels'][_0x5964db[_0xe3c3('0x26')]][_0x3f4a3c][_0xe3c3('0x15')]){logger[_0xe3c3('0x3d')](_0xe3c3('0x84'),_0x5964db['uniqueid'],_0x3f4a3c);this[_0xe3c3('0x2c')][_0x5964db[_0xe3c3('0x26')]][_0x3f4a3c][_0xe3c3('0x60')]=moment()['format'](_0xe3c3('0x2e'));}}}logger['debug']('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x5964db[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_[_0xe3c3('0x85')](this['channels'][_0x5964db[_0xe3c3('0x26')]]),{'showHidden':![],'depth':null}));ami['emit'](_0xe3c3('0x86'),_[_0xe3c3('0x85')](this[_0xe3c3('0x2c')][_0x5964db[_0xe3c3('0x26')]]));delete this['channels'][_0x5964db[_0xe3c3('0x26')]];}if(this[_0xe3c3('0xd')][_0x5964db['uniqueid']]){delete this['variables'][_0x5964db[_0xe3c3('0x26')]];}}}catch(_0x35d8b6){logger[_0xe3c3('0x3a')](_0xe3c3('0x87'),_0x5964db[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x35d8b6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe3c3('0x22')][_0xe3c3('0x1f')]=function(_0x1e170f){try{if(this[_0xe3c3('0x3b')](_0x1e170f)){logger[_0xe3c3('0x29')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x1e170f[_0xe3c3('0x26')],util['inspect'](_0x1e170f,{'showHidden':![],'depth':null}));if(this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]]){for(var _0x39936e in this['channels'][_0x1e170f[_0xe3c3('0x88')]]){if(this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]][_0xe3c3('0x59')](_0x39936e)){if(_0x1e170f[_0xe3c3('0x89')]===_0x39936e){logger[_0xe3c3('0x3d')](_0xe3c3('0x8a'),_0x1e170f[_0xe3c3('0x26')],this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]][_0x39936e][_0xe3c3('0x27')],_0x39936e);var _0x361326=moment();this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]][_0x39936e][_0xe3c3('0x15')]=!![];this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]][_0x39936e][_0xe3c3('0x60')]=moment()[_0xe3c3('0x2d')](_0xe3c3('0x2e'));this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]][_0x39936e]['lastevent']=_0xe3c3('0x61');this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]][_0x39936e][_0xe3c3('0x4f')]='transfer';this['channels'][_0x1e170f[_0xe3c3('0x88')]][_0x39936e]['talktime']=_0x361326[_0xe3c3('0x8b')](this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]][_0x39936e][_0xe3c3('0x3f')],'seconds');}}}}if(this[_0xe3c3('0x2c')][_0x1e170f['secondtransfereruniqueid']]){var _0x6bb35=this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x8c')]];this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x8c')]]=this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]];this[_0xe3c3('0x2c')][_0x1e170f['transfereeuniqueid']]=_0x6bb35;}}}catch(_0x2f1913){logger[_0xe3c3('0x3a')]('[%s][voiceAgentReport][attendedtransfer]',_0x1e170f[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x2f1913,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe3c3('0x21')]=function(_0x3efd1d){try{if(this['isNotNull'](_0x3efd1d)){logger['debug']('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x3efd1d[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x3efd1d,{'showHidden':![],'depth':null}));if(this['channels'][_0x3efd1d[_0xe3c3('0x88')]]){for(var _0x1a87c3 in this[_0xe3c3('0x2c')][_0x3efd1d[_0xe3c3('0x88')]]){if(this[_0xe3c3('0x2c')][_0x3efd1d[_0xe3c3('0x88')]][_0xe3c3('0x59')](_0x1a87c3)){if(_0x3efd1d[_0xe3c3('0x8d')]===_0x1a87c3){logger['info'](_0xe3c3('0x8e'),_0x3efd1d[_0xe3c3('0x26')],this[_0xe3c3('0x2c')][_0x3efd1d[_0xe3c3('0x88')]][_0x1a87c3]['membername'],_0x1a87c3);var _0x185461=moment();this[_0xe3c3('0x2c')][_0x3efd1d[_0xe3c3('0x88')]][_0x1a87c3][_0xe3c3('0x15')]=!![];this['channels'][_0x3efd1d[_0xe3c3('0x88')]][_0x1a87c3]['agentcompleteAt']=_0x185461;this[_0xe3c3('0x2c')][_0x3efd1d[_0xe3c3('0x88')]][_0x1a87c3][_0xe3c3('0x55')]=_0xe3c3('0x61');this[_0xe3c3('0x2c')][_0x3efd1d['transfereeuniqueid']][_0x1a87c3][_0xe3c3('0x4f')]='transfer';this[_0xe3c3('0x2c')][_0x3efd1d[_0xe3c3('0x88')]][_0x1a87c3]['talktime']=_0x185461[_0xe3c3('0x8b')](this[_0xe3c3('0x2c')][_0x3efd1d['transfereeuniqueid']][_0x1a87c3]['agentconnectAt'],_0xe3c3('0x8f'));}}}}}}catch(_0xd567a9){logger['error'](_0xe3c3('0x90'),_0x3efd1d[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0xd567a9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe3c3('0x22')][_0xe3c3('0x1b')]=function(_0x52ec4d){var _0x11e853='';try{if(this[_0xe3c3('0x3b')](_0x52ec4d)){logger[_0xe3c3('0x29')](_0xe3c3('0x91'),_0x52ec4d[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x52ec4d,{'showHidden':![],'depth':null}));if(_0x52ec4d[_0xe3c3('0x92')]){_0x11e853=_0x52ec4d[_0xe3c3('0x92')][_0xe3c3('0x93')](0x0,_0x52ec4d[_0xe3c3('0x92')][_0xe3c3('0x94')]('-'));if(this[_0xe3c3('0xc')][_0x11e853]){logger[_0xe3c3('0x3d')](_0xe3c3('0x95'),_0x52ec4d['uniqueid'],_0x11e853);this[_0xe3c3('0xc')][_0x11e853][_0xe3c3('0x96')]=!![];}}}}catch(_0x27e34c){logger[_0xe3c3('0x3a')](_0xe3c3('0x97'),_0x52ec4d[_0xe3c3('0x26')],util['inspect'](_0x27e34c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe3c3('0x22')]['syncMusicOnHoldStop']=function(_0x28cfff){var _0x56812e='';try{if(this[_0xe3c3('0x3b')](_0x28cfff)){logger[_0xe3c3('0x29')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x28cfff[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x28cfff,{'showHidden':![],'depth':null}));if(_0x28cfff['channel']){_0x56812e=_0x28cfff[_0xe3c3('0x92')]['substring'](0x0,_0x28cfff[_0xe3c3('0x92')][_0xe3c3('0x94')]('-'));if(this[_0xe3c3('0xc')][_0x56812e]){logger[_0xe3c3('0x3d')](_0xe3c3('0x98'),_0x28cfff['uniqueid'],_0x56812e);this['agents'][_0x56812e][_0xe3c3('0x96')]=![];}}}}catch(_0x384917){logger['error'](_0xe3c3('0x99'),_0x28cfff[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x384917,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 263a26b..e926af6 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 _0x0b46=['dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','defaults','redis','socket.io-emitter','channels','blindTransfers','coreshowchannel','syncNewExten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','prototype','emit','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','isUndefined','merge','pick','context','channel','split','exten','xcally-motion-preview','agents','connectedlinenum','format','name','user:agentconnect','error','isNotNull','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','keys','from-sip','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','applicationdata','appdata','CDR(routeAlias)','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','includes','application','lastdata','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','linkedid','[%s][voiceCallReport][newstate]\x20event:','answertime','diff','connectedlinename','calleridname','destinationchannel','UserId','membername','destconnectedlinenum','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','.WAV','monitorFilename','find','monitors','isNil','push','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','answered','billableseconds','omit','user:agentcomplete','resolve','then','transferType','undefined','stopRecordingOnTransfer','Action','StopMixMonitor','catch','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransferercalleridnum','origtransfereruniqueid','origtransfererlinkedid','type','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','bluebird','lodash','moment','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','set','queue','agi'];(function(_0x214b49,_0x1abc06){var _0x394cec=function(_0x5d5952){while(--_0x5d5952){_0x214b49['push'](_0x214b49['shift']());}};_0x394cec(++_0x1abc06);}(_0x0b46,0x188));var _0x60b4=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0x0b46[_0x502953];return _0x2fa32d;};'use strict';var BPromise=require(_0x60b4('0x0'));var _=require(_0x60b4('0x1'));var moment=require(_0x60b4('0x2'));var util=require('util');var path=require(_0x60b4('0x3'));var Redis=require(_0x60b4('0x4'));var config=require(_0x60b4('0x5'));var logger=require(_0x60b4('0x6'))(_0x60b4('0x7'));var ami=require(_0x60b4('0x8'));var Channel=require(_0x60b4('0x9'));var RpcSetting=require(_0x60b4('0xa'));var statusDesc=[_0x60b4('0xb'),_0x60b4('0xc'),_0x60b4('0xd'),_0x60b4('0xe'),_0x60b4('0xf'),_0x60b4('0x10'),_0x60b4('0x11'),_0x60b4('0x12'),'onhold'];var applications=[_0x60b4('0x13'),_0x60b4('0x14'),_0x60b4('0x15'),_0x60b4('0x16'),_0x60b4('0x17'),_0x60b4('0x18')];var dispositions=[_0x60b4('0x19'),_0x60b4('0x1a'),_0x60b4('0x1a'),'NO\x20ANSWER',_0x60b4('0x19'),_0x60b4('0x19'),_0x60b4('0x1b'),'BUSY',_0x60b4('0x1a'),_0x60b4('0x1a'),_0x60b4('0x1a')];var actions={};config['redis']=_[_0x60b4('0x1c')](config[_0x60b4('0x1d')],{'host':'localhost','port':0x18eb});var io=require(_0x60b4('0x1e'))(new Redis(config['redis']));function VoiceCallReport(_0x338ab2){this[_0x60b4('0x1f')]=_0x338ab2[_0x60b4('0x1f')];this['agents']=_0x338ab2['agents'];this[_0x60b4('0x20')]={};ami['on'](_0x60b4('0x21'),this[_0x60b4('0x22')][_0x60b4('0x23')](this));ami['on']('newexten',this[_0x60b4('0x22')][_0x60b4('0x23')](this));ami['on'](_0x60b4('0x24'),this[_0x60b4('0x25')][_0x60b4('0x23')](this));ami['on'](_0x60b4('0x26'),this[_0x60b4('0x27')][_0x60b4('0x23')](this));ami['on'](_0x60b4('0x28'),this['syncVarSet'][_0x60b4('0x23')](this));ami['on']('hangup',this[_0x60b4('0x29')]['bind'](this));ami['on'](_0x60b4('0x2a'),this[_0x60b4('0x2b')][_0x60b4('0x23')](this));ami['on'](_0x60b4('0x2c'),this[_0x60b4('0x2d')][_0x60b4('0x23')](this));ami['on'](_0x60b4('0x2e'),this[_0x60b4('0x2f')][_0x60b4('0x23')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x60b4('0x23')](this));ami['on'](_0x60b4('0x30'),this[_0x60b4('0x31')][_0x60b4('0x23')](this));try{logger[_0x60b4('0x32')](_0x60b4('0x33'));ami[_0x60b4('0x34')]();}catch(_0x1715d9){logger['error'](_0x60b4('0x35'),util[_0x60b4('0x36')](_0x1715d9,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x60b4('0x37')]['isNotNull']=function(_0x3e7ef0){return _0x3e7ef0!==null&&!_['isUndefined'](_0x3e7ef0);};VoiceCallReport[_0x60b4('0x37')][_0x60b4('0x38')]=function(_0x589996,_0x287068,_0x3daf8d){io['to'](_0x589996)['emit'](_0x287068,_0x3daf8d);};VoiceCallReport[_0x60b4('0x37')][_0x60b4('0x2b')]=function(_0x3bf162){try{if(this['isNotNull'](_0x3bf162)){logger[_0x60b4('0x32')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x3bf162['uniqueid'],_0x3bf162['calleridname'],_0x3bf162[_0x60b4('0x39')]);logger[_0x60b4('0x3a')](_0x60b4('0x3b'),_0x3bf162[_0x60b4('0x3c')],util['inspect'](_0x3bf162,{'showHidden':![],'depth':null}));if(_0x3bf162[_0x60b4('0x3c')]===_0x3bf162['linkedid']){if(!_[_0x60b4('0x3d')](this[_0x60b4('0x1f')][_0x3bf162[_0x60b4('0x3c')]])){_[_0x60b4('0x3e')](this[_0x60b4('0x1f')][_0x3bf162[_0x60b4('0x3c')]],_[_0x60b4('0x3f')](_0x3bf162,_['keys'](this[_0x60b4('0x1f')][_0x3bf162['uniqueid']])));}}if(_0x3bf162[_0x60b4('0x40')]==='from-sip'){if(this['agents'][_0x3bf162[_0x60b4('0x41')][_0x60b4('0x42')]('-')[0x0]]){if(_0x3bf162[_0x60b4('0x43')]==_0x60b4('0x44')){this[_0x60b4('0x45')][_0x3bf162[_0x60b4('0x41')]['split']('-')[0x0]]['destconnectedlinenum']=_0x3bf162[_0x60b4('0x46')];this[_0x60b4('0x38')](util[_0x60b4('0x47')]('user:%s',this['agents'][_0x3bf162[_0x60b4('0x41')][_0x60b4('0x42')]('-')[0x0]][_0x60b4('0x48')]),_0x60b4('0x49'),{'destaccountcode':this[_0x60b4('0x45')][_0x3bf162[_0x60b4('0x41')][_0x60b4('0x42')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x3bf162[_0x60b4('0x46')]});}}}}}catch(_0x1d0957){logger[_0x60b4('0x4a')]('[%s][voiceCallReport][newcallerid]',_0x3bf162[_0x60b4('0x3c')],util[_0x60b4('0x36')](_0x1d0957,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x60b4('0x37')][_0x60b4('0x25')]=function(_0x1983da){try{if(this[_0x60b4('0x4b')](_0x1983da)){logger[_0x60b4('0x3a')](_0x60b4('0x4c'),_0x1983da[_0x60b4('0x3c')],util[_0x60b4('0x36')](_0x1983da,{'showHidden':![],'depth':null}));if(_0x1983da[_0x60b4('0x3c')]===_0x1983da['linkedid']&&_0x1983da[_0x60b4('0x41')]!=_0x60b4('0x4d')){if(_[_0x60b4('0x3d')](this[_0x60b4('0x1f')][_0x1983da[_0x60b4('0x3c')]])){logger[_0x60b4('0x32')](_0x60b4('0x4e'),_0x1983da[_0x60b4('0x3c')],_0x1983da[_0x60b4('0x40')],_0x1983da[_0x60b4('0x43')]);this[_0x60b4('0x1f')][_0x1983da['uniqueid']]=new Channel();this[_0x60b4('0x1f')][_0x1983da[_0x60b4('0x3c')]]['starttime']=moment()[_0x60b4('0x47')](_0x60b4('0x4f'));this[_0x60b4('0x1f')][_0x1983da[_0x60b4('0x3c')]][_0x60b4('0x50')]=dispositions[_['toNumber'](_0x1983da[_0x60b4('0x51')])];_['merge'](this['channels'][_0x1983da[_0x60b4('0x3c')]],_[_0x60b4('0x3f')](_0x1983da,_[_0x60b4('0x52')](this[_0x60b4('0x1f')][_0x1983da[_0x60b4('0x3c')]])));if(_0x1983da[_0x60b4('0x40')]===_0x60b4('0x53')){if(this[_0x60b4('0x45')][_0x1983da[_0x60b4('0x41')][_0x60b4('0x42')]('-')[0x0]]){if(_['isUndefined'](this['agents'][_0x1983da[_0x60b4('0x41')][_0x60b4('0x42')]('-')[0x0]]['destconnectedlinenum'])){this[_0x60b4('0x45')][_0x1983da[_0x60b4('0x41')][_0x60b4('0x42')]('-')[0x0]]['destconnectedlinenum']=_0x1983da['exten'];logger['debug'](_0x60b4('0x54'),_0x1983da[_0x60b4('0x3c')],util['inspect']({'destaccountcode':this[_0x60b4('0x45')][_0x1983da['channel']['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x1983da['exten']},{'showHidden':![],'depth':null}));this[_0x60b4('0x38')](util[_0x60b4('0x47')](_0x60b4('0x55'),this[_0x60b4('0x45')][_0x1983da['channel'][_0x60b4('0x42')]('-')[0x0]][_0x60b4('0x48')]),_0x60b4('0x49'),{'destaccountcode':this['agents'][_0x1983da[_0x60b4('0x41')][_0x60b4('0x42')]('-')[0x0]][_0x60b4('0x56')],'destconnectedlinenum':_0x1983da[_0x60b4('0x43')]});}}}}}}}catch(_0x152721){logger['error'](_0x60b4('0x57'),_0x1983da[_0x60b4('0x3c')],util[_0x60b4('0x36')](_0x152721,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x60b4('0x22')]=function(_0x16bcbb){try{if(this['isNotNull'](_0x16bcbb)){logger[_0x60b4('0x3a')](_0x60b4('0x58'),_0x16bcbb['uniqueid'],util[_0x60b4('0x36')](_0x16bcbb,{'showHidden':![],'depth':null}));if(_0x16bcbb[_0x60b4('0x3c')]===_0x16bcbb['linkedid']&&_0x16bcbb['exten']!='h'&&_0x16bcbb[_0x60b4('0x41')]!=_0x60b4('0x4d')){_0x16bcbb['application']=_0x16bcbb['application']['toLowerCase']();_0x16bcbb[_0x60b4('0x59')]=_0x16bcbb[_0x60b4('0x5a')]&&_0x16bcbb[_0x60b4('0x5a')]['startsWith'](_0x60b4('0x5b'))?_0x16bcbb[_0x60b4('0x5a')]:(_0x16bcbb[_0x60b4('0x5a')]||_0x16bcbb['applicationdata'])[_0x60b4('0x5c')]();logger[_0x60b4('0x32')](_0x60b4('0x5d'),_0x16bcbb['uniqueid'],_0x16bcbb['application'],_0x16bcbb[_0x60b4('0x59')]);if(_[_0x60b4('0x3d')](this['channels'][_0x16bcbb['uniqueid']])){this[_0x60b4('0x1f')][_0x16bcbb[_0x60b4('0x3c')]]=new Channel();this[_0x60b4('0x1f')][_0x16bcbb[_0x60b4('0x3c')]][_0x60b4('0x5e')]=_0x16bcbb[_0x60b4('0x5f')]?moment()[_0x60b4('0x60')](moment[_0x60b4('0x5f')](_0x16bcbb[_0x60b4('0x5f')])[_0x60b4('0x61')](),_0x60b4('0x61'))['format'](_0x60b4('0x4f')):moment()[_0x60b4('0x47')](_0x60b4('0x4f'));this[_0x60b4('0x1f')][_0x16bcbb[_0x60b4('0x3c')]][_0x60b4('0x50')]=_0x60b4('0x19');}_[_0x60b4('0x3e')](this[_0x60b4('0x1f')][_0x16bcbb[_0x60b4('0x3c')]],_[_0x60b4('0x3f')](_0x16bcbb,_[_0x60b4('0x52')](this[_0x60b4('0x1f')][_0x16bcbb[_0x60b4('0x3c')]])));if(_[_0x60b4('0x62')](applications,_0x16bcbb['application'])){this['channels'][_0x16bcbb[_0x60b4('0x3c')]]['lastapplication']=_0x16bcbb[_0x60b4('0x63')];this[_0x60b4('0x1f')][_0x16bcbb[_0x60b4('0x3c')]][_0x60b4('0x64')]=_0x16bcbb[_0x60b4('0x59')];if(_0x16bcbb[_0x60b4('0x63')]===_0x60b4('0x13')&&_['startsWith'](_0x16bcbb['applicationdata'][_0x60b4('0x5c')](),_0x60b4('0x65'))){var _0x637894=_0x16bcbb['applicationdata']['split']('=');var _0x3e5830=_0x637894[0x0][_0x60b4('0x5c')]()[_0x60b4('0x66')](/cdr\((.*)\)/);if(_0x3e5830){this[_0x60b4('0x1f')][_0x16bcbb[_0x60b4('0x3c')]][_0x3e5830[0x1]]=_0x637894[0x1];}}else if(_0x16bcbb[_0x60b4('0x63')]===_0x60b4('0x14')){this[_0x60b4('0x1f')][_0x16bcbb[_0x60b4('0x3c')]][_0x60b4('0x14')]=_0x16bcbb[_0x60b4('0x59')]['split'](',')[0x0];}}}}}catch(_0x22b9f0){logger['error'](_0x60b4('0x67'),_0x16bcbb[_0x60b4('0x3c')],util[_0x60b4('0x36')](_0x22b9f0,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x60b4('0x27')]=function(_0xf55748){try{if(this['isNotNull'](_0xf55748)){logger[_0x60b4('0x32')](_0x60b4('0x68'),_0xf55748['uniqueid'],_0xf55748[_0x60b4('0x69')],_0xf55748['calleridname'],_0xf55748[_0x60b4('0x39')]);logger[_0x60b4('0x3a')](_0x60b4('0x6a'),_0xf55748[_0x60b4('0x3c')],util[_0x60b4('0x36')](_0xf55748,{'showHidden':![],'depth':null}));if(_0xf55748['uniqueid']!==_0xf55748[_0x60b4('0x69')]){if(this['channels'][_0xf55748[_0x60b4('0x69')]]){if(_0xf55748['channelstate']==='6'){if(!this[_0x60b4('0x1f')][_0xf55748[_0x60b4('0x69')]]['answered']){var _0x4da0a0=moment();this[_0x60b4('0x1f')][_0xf55748['linkedid']]['answered']=!![];this[_0x60b4('0x1f')][_0xf55748[_0x60b4('0x69')]][_0x60b4('0x6b')]=_0x4da0a0['format'](_0x60b4('0x4f'));if(this[_0x60b4('0x1f')][_0xf55748[_0x60b4('0x69')]][_0x60b4('0x5e')]){this[_0x60b4('0x1f')][_0xf55748[_0x60b4('0x69')]]['holdtime']=_0x4da0a0[_0x60b4('0x6c')](this[_0x60b4('0x1f')][_0xf55748[_0x60b4('0x69')]]['starttime'],_0x60b4('0x61'));}}this[_0x60b4('0x1f')][_0xf55748[_0x60b4('0x69')]]['linkedid']=_0xf55748[_0x60b4('0x3c')];if(_0xf55748['calleridnum']!=='xcally-motion-preview'){this[_0x60b4('0x1f')][_0xf55748[_0x60b4('0x69')]][_0x60b4('0x46')]=_0xf55748['calleridnum'];}this[_0x60b4('0x1f')][_0xf55748['linkedid']][_0x60b4('0x6d')]=_0xf55748[_0x60b4('0x6e')];this['channels'][_0xf55748[_0x60b4('0x69')]][_0x60b4('0x6f')]=_0xf55748[_0x60b4('0x41')];this[_0x60b4('0x1f')][_0xf55748[_0x60b4('0x69')]][_0x60b4('0x50')]=dispositions[_['toNumber'](_0xf55748['channelstate'])];if(this[_0x60b4('0x45')][_0xf55748[_0x60b4('0x41')]['split']('-')[0x0]]){this[_0x60b4('0x1f')][_0xf55748['linkedid']][_0x60b4('0x70')]=this['agents'][_0xf55748[_0x60b4('0x41')]['split']('-')[0x0]]['id'];this[_0x60b4('0x1f')][_0xf55748[_0x60b4('0x69')]]['membername']=this[_0x60b4('0x45')][_0xf55748[_0x60b4('0x41')]['split']('-')[0x0]][_0x60b4('0x48')];}}}}else{if(this[_0x60b4('0x1f')][_0xf55748['uniqueid']]){if(_0xf55748[_0x60b4('0x51')]==='6'){if(this[_0x60b4('0x45')][_0xf55748[_0x60b4('0x41')][_0x60b4('0x42')]('-')[0x0]]){this['channels'][_0xf55748[_0x60b4('0x3c')]][_0x60b4('0x70')]=this[_0x60b4('0x45')][_0xf55748['channel'][_0x60b4('0x42')]('-')[0x0]]['id'];this[_0x60b4('0x1f')][_0xf55748[_0x60b4('0x3c')]][_0x60b4('0x71')]=this[_0x60b4('0x45')][_0xf55748['channel'][_0x60b4('0x42')]('-')[0x0]][_0x60b4('0x48')];}}}}if(_0xf55748[_0x60b4('0x51')]==='6'&&_0xf55748[_0x60b4('0x40')]==='from-sip'){if(this[_0x60b4('0x45')][_0xf55748['channel'][_0x60b4('0x42')]('-')[0x0]]){this[_0x60b4('0x45')][_0xf55748['channel'][_0x60b4('0x42')]('-')[0x0]][_0x60b4('0x72')]=_0xf55748[_0x60b4('0x43')];var _0x4cc573;if(this[_0x60b4('0x1f')][_0xf55748[_0x60b4('0x3c')]])_0x4cc573=this[_0x60b4('0x1f')][_0xf55748[_0x60b4('0x3c')]]['routealias'];else if(this['channels'][_0xf55748[_0x60b4('0x69')]])_0x4cc573=this['channels'][_0xf55748[_0x60b4('0x69')]][_0x60b4('0x73')];logger['debug'](_0x60b4('0x74'),_0xf55748[_0x60b4('0x3c')],util[_0x60b4('0x36')]({'destaccountcode':this[_0x60b4('0x45')][_0xf55748['channel']['split']('-')[0x0]][_0x60b4('0x56')],'destconnectedlinenum':_0xf55748[_0x60b4('0x43')],'routealias':_0x4cc573},{'showHidden':![],'depth':null}));this[_0x60b4('0x38')](util['format'](_0x60b4('0x55'),this[_0x60b4('0x45')][_0xf55748[_0x60b4('0x41')][_0x60b4('0x42')]('-')[0x0]][_0x60b4('0x48')]),'user:agentconnect',{'destaccountcode':this[_0x60b4('0x45')][_0xf55748['channel']['split']('-')[0x0]][_0x60b4('0x56')],'destconnectedlinenum':_0xf55748[_0x60b4('0x43')],'routealias':_0x4cc573});}}}}catch(_0x510aac){logger[_0x60b4('0x4a')](_0x60b4('0x75'),_0xf55748[_0x60b4('0x3c')],util[_0x60b4('0x36')](_0x510aac,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x60b4('0x76')]=function(_0x336f09,_0x7a9abd){try{if(this[_0x60b4('0x1f')][_0x336f09]){logger['info'](_0x60b4('0x77'),_0x336f09,_0x7a9abd);this[_0x60b4('0x1f')][_0x336f09][_0x60b4('0x78')]=!![];if(_[_0x60b4('0x79')](_0x7a9abd,'.wav49')){_0x7a9abd=_0x7a9abd['replace'](_0x60b4('0x7a'),_0x60b4('0x7b'));}this[_0x60b4('0x1f')][_0x336f09][_0x60b4('0x7c')]=_0x7a9abd;var _0x29b34c=_[_0x60b4('0x7d')](this[_0x60b4('0x1f')][_0x336f09][_0x60b4('0x7e')],{'filename':_0x7a9abd});if(_[_0x60b4('0x7f')](_0x29b34c)){this[_0x60b4('0x1f')][_0x336f09][_0x60b4('0x7e')][_0x60b4('0x80')]({'filename':_0x7a9abd,'createdAt':moment()[_0x60b4('0x47')](_0x60b4('0x4f')),'mixmonitorid':'','status':'rec'});}}}catch(_0x52e836){logger[_0x60b4('0x4a')]('[%s][voiceCallReport][mixMonitorFilename]',_0x336f09,util[_0x60b4('0x36')](_0x52e836,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x60b4('0x37')][_0x60b4('0x81')]=function(_0x50b097){try{if(this['isNotNull'](_0x50b097)){logger[_0x60b4('0x3a')](_0x60b4('0x82'),_0x50b097[_0x60b4('0x3c')],util[_0x60b4('0x36')](_0x50b097,{'showHidden':![],'depth':null}));if(this['channels'][_0x50b097[_0x60b4('0x3c')]]&&_0x50b097[_0x60b4('0x41')]!=_0x60b4('0x4d')){if(this[_0x60b4('0x4b')](_0x50b097[_0x60b4('0x83')])){if(this['isNotNull'](_0x50b097[_0x60b4('0x83')][_0x60b4('0x84')])){logger[_0x60b4('0x32')](_0x60b4('0x85'),_0x50b097[_0x60b4('0x3c')],_0x50b097[_0x60b4('0x86')]);this[_0x60b4('0x76')](_0x50b097[_0x60b4('0x3c')],_0x50b097['value']);}else if(this['isNotNull'](_0x50b097[_0x60b4('0x83')][_0x60b4('0x87')])){logger[_0x60b4('0x32')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x50b097[_0x60b4('0x3c')],_0x50b097[_0x60b4('0x86')]);this['channels'][_0x50b097[_0x60b4('0x3c')]][_0x60b4('0x39')]=_0x50b097[_0x60b4('0x86')];}else if(this[_0x60b4('0x4b')](_0x50b097[_0x60b4('0x83')]['xmd-callerid'])){logger[_0x60b4('0x32')](_0x60b4('0x88'),_0x50b097['uniqueid'],_0x50b097['value']);this[_0x60b4('0x1f')][_0x50b097[_0x60b4('0x3c')]][_0x60b4('0x89')]=_0x50b097[_0x60b4('0x86')];}else if(this['isNotNull'](_0x50b097[_0x60b4('0x83')]['xmd-cdrtype'])){logger['info'](_0x60b4('0x8a'),_0x50b097[_0x60b4('0x3c')],_0x50b097[_0x60b4('0x86')]);this[_0x60b4('0x1f')][_0x50b097['uniqueid']]['type']=_0x50b097[_0x60b4('0x86')];}else if(this['isNotNull'](_0x50b097[_0x60b4('0x83')][_0x60b4('0x8b')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x50b097[_0x60b4('0x3c')],_0x50b097['value']['split'](',')[0x0]);this[_0x60b4('0x1f')][_0x50b097['uniqueid']][_0x60b4('0x14')]=_0x50b097[_0x60b4('0x86')][_0x60b4('0x42')](',')[0x0];}else if(this['isNotNull'](_0x50b097[_0x60b4('0x83')][_0x60b4('0x8c')])){logger[_0x60b4('0x32')](_0x60b4('0x8d'),_0x50b097['uniqueid'],_0x50b097['value']);this[_0x60b4('0x1f')][_0x50b097[_0x60b4('0x3c')]][_0x60b4('0x8e')]=_0x50b097[_0x60b4('0x86')];}else if(this[_0x60b4('0x4b')](_0x50b097[_0x60b4('0x83')][_0x60b4('0x8f')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x50b097['uniqueid'],_0x50b097[_0x60b4('0x86')]);this[_0x60b4('0x1f')][_0x50b097[_0x60b4('0x3c')]][_0x60b4('0x90')]=_0x50b097[_0x60b4('0x86')];}else if(this[_0x60b4('0x4b')](_0x50b097[_0x60b4('0x83')][_0x60b4('0x91')])){logger[_0x60b4('0x32')](_0x60b4('0x92'),_0x50b097[_0x60b4('0x3c')],_0x50b097[_0x60b4('0x86')]);this[_0x60b4('0x1f')][_0x50b097[_0x60b4('0x3c')]][_0x60b4('0x93')]=_0x50b097[_0x60b4('0x86')];}else if(this[_0x60b4('0x4b')](_0x50b097[_0x60b4('0x83')][_0x60b4('0x94')])){logger[_0x60b4('0x32')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x50b097['uniqueid'],_0x50b097[_0x60b4('0x86')]);this[_0x60b4('0x1f')][_0x50b097[_0x60b4('0x3c')]]['queue']=_0x50b097[_0x60b4('0x86')];}else if(this['isNotNull'](_0x50b097[_0x60b4('0x83')][_0x60b4('0x95')])){logger['info'](_0x60b4('0x96'),_0x50b097['uniqueid'],_0x50b097['value']);this[_0x60b4('0x1f')][_0x50b097[_0x60b4('0x3c')]][_0x60b4('0x97')]=_0x50b097[_0x60b4('0x86')];}}}else if(this['isNotNull'](_0x50b097[_0x60b4('0x83')]['mixmonitor_filename'])){if(_0x50b097[_0x60b4('0x86')]){var _0x281432=path[_0x60b4('0x98')](_0x50b097[_0x60b4('0x86')])[_0x60b4('0x48')];logger[_0x60b4('0x32')](_0x60b4('0x85'),_0x281432,_0x50b097[_0x60b4('0x86')]);this[_0x60b4('0x76')](_0x281432,_0x50b097[_0x60b4('0x86')]);}}else if(this[_0x60b4('0x1f')][_0x50b097[_0x60b4('0x69')]]){if(this[_0x60b4('0x4b')](_0x50b097[_0x60b4('0x83')])){if(this[_0x60b4('0x4b')](_0x50b097[_0x60b4('0x83')][_0x60b4('0x95')])){logger[_0x60b4('0x32')](_0x60b4('0x96'),_0x50b097[_0x60b4('0x69')],_0x50b097[_0x60b4('0x86')]);this['channels'][_0x50b097['linkedid']][_0x60b4('0x99')]=_0x50b097[_0x60b4('0x86')];}}}}}catch(_0x53df13){logger['error'](_0x60b4('0x9a'),_0x50b097[_0x60b4('0x3c')],util[_0x60b4('0x36')](_0x53df13,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x60b4('0x37')][_0x60b4('0x29')]=function(_0x243bff){try{if(this[_0x60b4('0x4b')](_0x243bff)){logger['debug'](_0x60b4('0x9b'),_0x243bff[_0x60b4('0x3c')],util[_0x60b4('0x36')](_0x243bff,{'showHidden':![],'depth':null}));if(this['channels'][_0x243bff[_0x60b4('0x3c')]]){logger[_0x60b4('0x32')](_0x60b4('0x9c'),_0x243bff[_0x60b4('0x3c')],_0x243bff[_0x60b4('0x9d')]);var _0x2ae816=moment();this[_0x60b4('0x1f')][_0x243bff[_0x60b4('0x3c')]][_0x60b4('0x9e')]=_0x2ae816[_0x60b4('0x47')](_0x60b4('0x4f'));this[_0x60b4('0x1f')][_0x243bff['uniqueid']][_0x60b4('0x5f')]=_0x2ae816[_0x60b4('0x6c')](this[_0x60b4('0x1f')][_0x243bff['uniqueid']]['starttime'],_0x60b4('0x61'));if(this[_0x60b4('0x1f')][_0x243bff['uniqueid']][_0x60b4('0x9f')]){this['channels'][_0x243bff[_0x60b4('0x3c')]][_0x60b4('0xa0')]=_0x2ae816[_0x60b4('0x6c')](this[_0x60b4('0x1f')][_0x243bff['uniqueid']][_0x60b4('0x6b')],_0x60b4('0x61'));this[_0x60b4('0x1f')][_0x243bff[_0x60b4('0x3c')]]['holdtime']=this[_0x60b4('0x1f')][_0x243bff[_0x60b4('0x3c')]]['duration']-this[_0x60b4('0x1f')][_0x243bff[_0x60b4('0x3c')]][_0x60b4('0xa0')];}if(_0x243bff['context']===_0x60b4('0x53')){if(this['agents'][_0x243bff['channel']['split']('-')[0x0]]){this[_0x60b4('0x45')][_0x243bff[_0x60b4('0x41')]['split']('-')[0x0]]=_[_0x60b4('0xa1')](this[_0x60b4('0x45')][_0x243bff[_0x60b4('0x41')]['split']('-')[0x0]],['destconnectedlinenum']);logger[_0x60b4('0x3a')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x243bff['uniqueid'],util[_0x60b4('0x36')]({'id':this[_0x60b4('0x45')][_0x243bff[_0x60b4('0x41')][_0x60b4('0x42')]('-')[0x0]]['id'],'destaccountcode':this[_0x60b4('0x45')][_0x243bff[_0x60b4('0x41')][_0x60b4('0x42')]('-')[0x0]][_0x60b4('0x56')]},{'showHidden':![],'depth':null}));this[_0x60b4('0x38')](util[_0x60b4('0x47')](_0x60b4('0x55'),this[_0x60b4('0x45')][_0x243bff[_0x60b4('0x41')]['split']('-')[0x0]][_0x60b4('0x48')]),_0x60b4('0xa2'),{'id':this[_0x60b4('0x45')][_0x243bff[_0x60b4('0x41')][_0x60b4('0x42')]('-')[0x0]]['id'],'destaccountcode':this[_0x60b4('0x45')][_0x243bff['channel'][_0x60b4('0x42')]('-')[0x0]][_0x60b4('0x56')]});}}var _0x46a008=this;Promise[_0x60b4('0xa3')]()[_0x60b4('0xa4')](function(){var _0x495160=_0x46a008[_0x60b4('0x1f')][_0x243bff[_0x60b4('0x3c')]];if(typeof _0x495160[_0x60b4('0xa5')]===_0x60b4('0xa6'))return;if(_['isEmpty'](_0x495160[_0x60b4('0x7e')]))return;return RpcSetting['getSettings']()[_0x60b4('0xa4')](function(_0x656c8){if(!_0x656c8[_0x60b4('0xa7')])return;return Promise[_0x60b4('0xa3')]()[_0x60b4('0xa4')](function(){return ami[_0x60b4('0xa8')]({'action':_0x60b4('0xa9'),'channel':_0x495160[_0x60b4('0x41')]})['catch'](function(){});})[_0x60b4('0xa4')](function(){return ami['Action']({'action':'StopMixMonitor','channel':_0x495160[_0x60b4('0x6f')]})[_0x60b4('0xaa')](function(){})['finally'](function(){var _0x30477e=_0x46a008[_0x60b4('0x45')][_0x495160[_0x60b4('0x6f')][_0x60b4('0x42')]('-')[0x0]];if(!_0x30477e)return;io[_0x60b4('0x38')]('webbar:stopmonitors',{'agentId':_0x30477e['id'],'uniqueid':_0x495160['uniqueid']});});});});})['then'](function(){if(_0x243bff[_0x60b4('0xab')]===_0x60b4('0xac')){_0x46a008[_0x60b4('0x20')][_0x243bff[_0x60b4('0x3c')]]=_0x46a008['channels'][_0x243bff[_0x60b4('0x3c')]];}else{if(_0x46a008['channels'][_0x243bff[_0x60b4('0x3c')]]['type']===_0x60b4('0xad')&&_0x46a008['blindTransfers'][_0x243bff[_0x60b4('0x3c')]]){_0x46a008[_0x60b4('0x1f')][_0x243bff['uniqueid']][_0x60b4('0x3c')]=[_0x46a008[_0x60b4('0x1f')][_0x243bff[_0x60b4('0x3c')]][_0x60b4('0x69')],_0x46a008[_0x60b4('0x1f')][_0x243bff['uniqueid']][_0x60b4('0x69')]=_0x46a008['channels'][_0x243bff[_0x60b4('0x3c')]][_0x60b4('0x3c')]][0x0];delete _0x46a008[_0x60b4('0x20')][_0x243bff[_0x60b4('0x3c')]];}}logger[_0x60b4('0x3a')](_0x60b4('0xae'),_0x243bff[_0x60b4('0x3c')],util[_0x60b4('0x36')](_0x46a008[_0x60b4('0x1f')][_0x243bff['uniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceCallReport',_0x46a008[_0x60b4('0x1f')][_0x243bff[_0x60b4('0x3c')]]);delete _0x46a008[_0x60b4('0x1f')][_0x243bff['uniqueid']];});}}}catch(_0x67ffc4){logger[_0x60b4('0x4a')]('[%s][voiceCallReport][hangup]',_0x243bff['uniqueid'],util['inspect'](_0x67ffc4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x60b4('0x37')]['syncAttendedTransfer']=function(_0x4cf16f){try{if(this[_0x60b4('0x4b')](_0x4cf16f)){logger[_0x60b4('0x32')](_0x60b4('0xaf'),_0x4cf16f[_0x60b4('0x3c')],_0x4cf16f['origtransferercalleridnum'],_0x4cf16f[_0x60b4('0xb0')]);logger[_0x60b4('0x3a')](_0x60b4('0xb1'),_0x4cf16f['uniqueid'],util[_0x60b4('0x36')](_0x4cf16f,{'showHidden':![],'depth':null}));if(this[_0x60b4('0x1f')][_0x4cf16f[_0x60b4('0xb2')]]){this[_0x60b4('0x1f')][_0x4cf16f[_0x60b4('0xb2')]][_0x60b4('0xb3')]=_0x4cf16f['origtransferercalleridnum'];this[_0x60b4('0x1f')][_0x4cf16f['transfereeuniqueid']][_0x60b4('0xb4')]=_0x4cf16f[_0x60b4('0xb0')];if(this[_0x60b4('0x1f')][_0x4cf16f[_0x60b4('0xb5')]]){var _0x1356c7=this[_0x60b4('0x1f')][_0x4cf16f['secondtransfereruniqueid']];this[_0x60b4('0x1f')][_0x4cf16f[_0x60b4('0xb5')]]=this[_0x60b4('0x1f')][_0x4cf16f[_0x60b4('0xb2')]];this[_0x60b4('0x1f')][_0x4cf16f['transfereeuniqueid']]=_0x1356c7;}}else if(this['channels'][_0x4cf16f[_0x60b4('0xb6')]]){this['channels'][_0x4cf16f['transfertargetuniqueid']][_0x60b4('0xb3')]=_0x4cf16f[_0x60b4('0xb7')];this[_0x60b4('0x1f')][_0x4cf16f[_0x60b4('0xb6')]][_0x60b4('0xb4')]=_0x4cf16f[_0x60b4('0xb0')];if(this[_0x60b4('0x1f')][_0x4cf16f[_0x60b4('0xb8')]]){var _0x1356c7=this[_0x60b4('0x1f')][_0x4cf16f[_0x60b4('0xb8')]];this[_0x60b4('0x1f')][_0x4cf16f[_0x60b4('0xb8')]]=this[_0x60b4('0x1f')][_0x4cf16f[_0x60b4('0xb6')]];this[_0x60b4('0x1f')][_0x4cf16f[_0x60b4('0xb6')]]=_0x1356c7;}}if((this[_0x60b4('0x1f')][_0x4cf16f['origtransfereruniqueid']]||this[_0x60b4('0x1f')][_0x4cf16f['origtransfererlinkedid']])&&this[_0x60b4('0x1f')][_0x4cf16f['secondtransfereruniqueid']]){var _0x491700=_['some']([this[_0x60b4('0x1f')][_0x4cf16f[_0x60b4('0xb8')]],this['channels'][_0x4cf16f[_0x60b4('0xb9')]],this[_0x60b4('0x1f')][_0x4cf16f[_0x60b4('0xb5')]]],function(_0x58a899){return _0x58a899&&_0x58a899[_0x60b4('0xba')]===_0x60b4('0xad')&&_0x58a899[_0x60b4('0xbb')];});if(_0x491700){if(this[_0x60b4('0x1f')][_0x4cf16f['origtransfereruniqueid']])this['channels'][_0x4cf16f[_0x60b4('0xb8')]][_0x60b4('0xa5')]='ATTENDED';if(this[_0x60b4('0x1f')][_0x4cf16f[_0x60b4('0xb9')]])this[_0x60b4('0x1f')][_0x4cf16f[_0x60b4('0xb9')]][_0x60b4('0xa5')]=_0x60b4('0xbc');this[_0x60b4('0x1f')][_0x4cf16f[_0x60b4('0xb5')]][_0x60b4('0xa5')]=_0x60b4('0xbc');}}}}catch(_0x11fd86){logger['error'](_0x60b4('0xbd'),_0x4cf16f['uniqueid'],util[_0x60b4('0x36')](_0x11fd86,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x60b4('0x37')][_0x60b4('0x2f')]=function(_0x21ee3f){try{if(this[_0x60b4('0x4b')](_0x21ee3f)){logger[_0x60b4('0x32')](_0x60b4('0xbe'),_0x21ee3f[_0x60b4('0x3c')],_0x21ee3f[_0x60b4('0xbf')],_0x21ee3f[_0x60b4('0xc0')]);logger['debug'](_0x60b4('0xc1'),_0x21ee3f[_0x60b4('0x3c')],util[_0x60b4('0x36')](_0x21ee3f,{'showHidden':![],'depth':null}));if(this['channels'][_0x21ee3f[_0x60b4('0xb2')]]){this[_0x60b4('0x1f')][_0x21ee3f[_0x60b4('0xb2')]][_0x60b4('0xb3')]=_0x21ee3f['transfereecalleridnum'];this[_0x60b4('0x1f')][_0x21ee3f['transfereeuniqueid']][_0x60b4('0xb4')]=_0x21ee3f[_0x60b4('0xc0')];this['channels'][_0x21ee3f['transfereeuniqueid']][_0x60b4('0xa5')]=_0x60b4('0xc2');this[_0x60b4('0x29')]({'event':_0x60b4('0xac'),'uniqueid':_0x21ee3f[_0x60b4('0xb2')],'context':_0x21ee3f[_0x60b4('0x40')],'channel':_0x21ee3f[_0x60b4('0xc3')]});}else{this['channels'][_0x21ee3f[_0x60b4('0xc4')]]['transferType']=_0x60b4('0xc2');}}}catch(_0x563f94){logger[_0x60b4('0x4a')]('[%s][voiceCallReport][blindtransfer]',_0x21ee3f[_0x60b4('0x3c')],util[_0x60b4('0x36')](_0x563f94,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x60b4('0x37')][_0x60b4('0xc5')]=function(_0x1954ad){try{if(this['isNotNull'](_0x1954ad)){logger[_0x60b4('0x3a')](_0x60b4('0xc6'),_0x1954ad['uniqueid'],util[_0x60b4('0x36')](_0x1954ad,{'showHidden':![],'depth':null}));if(this[_0x60b4('0x1f')][_0x1954ad[_0x60b4('0x3c')]]){if(!_[_0x60b4('0x7f')](this[_0x60b4('0x1f')][_0x1954ad['uniqueid']][_0x60b4('0x6b')])){this[_0x60b4('0x1f')][_0x1954ad['uniqueid']][_0x60b4('0xc7')]=moment()[_0x60b4('0x47')]('YYYY-MM-DD\x20HH:mm:ss');logger['info'](_0x60b4('0xc8'),_0x1954ad[_0x60b4('0x3c')],this[_0x60b4('0x1f')][_0x1954ad[_0x60b4('0x3c')]][_0x60b4('0xc7')]);}}}}catch(_0xce9fc8){logger['error'](_0x60b4('0xc9'),_0x1954ad[_0x60b4('0x3c')],util[_0x60b4('0x36')](_0xce9fc8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x60b4('0x37')]['syncMusicOnHoldStop']=function(_0x459a90){try{if(this[_0x60b4('0x4b')](_0x459a90)){logger[_0x60b4('0x3a')](_0x60b4('0xca'),_0x459a90[_0x60b4('0x3c')],util['inspect'](_0x459a90,{'showHidden':![],'depth':null}));if(this[_0x60b4('0x1f')][_0x459a90['uniqueid']]){if(!_[_0x60b4('0x7f')](this['channels'][_0x459a90[_0x60b4('0x3c')]][_0x60b4('0xc7')])){this[_0x60b4('0x1f')][_0x459a90['uniqueid']][_0x60b4('0xcb')]+=moment()[_0x60b4('0xcc')](0x0)[_0x60b4('0x6c')](this['channels'][_0x459a90[_0x60b4('0x3c')]][_0x60b4('0xc7')],_0x60b4('0x61'));logger[_0x60b4('0x32')](_0x60b4('0xcd'),_0x459a90['uniqueid'],this[_0x60b4('0x1f')][_0x459a90[_0x60b4('0x3c')]][_0x60b4('0xcb')]);delete this[_0x60b4('0x1f')][_0x459a90[_0x60b4('0x3c')]][_0x60b4('0xc7')];}}}}catch(_0x22227b){logger[_0x60b4('0x4a')]('[%s][voiceCallReport][musiconholdstop]',_0x459a90[_0x60b4('0x3c')],util[_0x60b4('0x36')](_0x22227b,{'showHidden':![],'depth':null}));}};module[_0x60b4('0xce')]=VoiceCallReport; \ No newline at end of file +var _0xebe7=['syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','UserId','routealias','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','replace','.wav49','.WAV','monitorFilename','find','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\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','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','endtime','billableseconds','omit','user:agentcomplete','resolve','transferType','undefined','isEmpty','getSettings','then','stopRecordingOnTransfer','Action','StopMixMonitor','event','BlindTransfer','type','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','some','outbound','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','moment','util','path','ioredis','../../../config/environment','../../../config/logger','../ami','../model/channel','../rpc/setting','unknown','inuse','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','varset','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','merge','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','isUndefined','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','disposition','toNumber','channelstate','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','emit','[%s][voiceCallReport][newchannel]','linkedid','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','pick','lastdata','cdr(','match','[%s][voiceCallReport][newexten]'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0xebe7,0x66));var _0x7ebe=function(_0x3a31a0,_0x5d7bd){_0x3a31a0=_0x3a31a0-0x0;var _0x590926=_0xebe7[_0x3a31a0];return _0x590926;};'use strict';var BPromise=require(_0x7ebe('0x0'));var _=require('lodash');var moment=require(_0x7ebe('0x1'));var util=require(_0x7ebe('0x2'));var path=require(_0x7ebe('0x3'));var Redis=require(_0x7ebe('0x4'));var config=require(_0x7ebe('0x5'));var logger=require(_0x7ebe('0x6'))('ami');var ami=require(_0x7ebe('0x7'));var Channel=require(_0x7ebe('0x8'));var RpcSetting=require(_0x7ebe('0x9'));var statusDesc=[_0x7ebe('0xa'),'not_inuse',_0x7ebe('0xb'),'busy',_0x7ebe('0xc'),_0x7ebe('0xd'),_0x7ebe('0xe'),_0x7ebe('0xf'),_0x7ebe('0x10')];var applications=[_0x7ebe('0x11'),_0x7ebe('0x12'),_0x7ebe('0x13'),'dial','playback',_0x7ebe('0x14')];var dispositions=[_0x7ebe('0x15'),'FAILED','FAILED',_0x7ebe('0x15'),_0x7ebe('0x15'),_0x7ebe('0x15'),_0x7ebe('0x16'),_0x7ebe('0x17'),_0x7ebe('0x18'),_0x7ebe('0x18'),_0x7ebe('0x18')];var actions={};config[_0x7ebe('0x19')]=_[_0x7ebe('0x1a')](config[_0x7ebe('0x19')],{'host':'localhost','port':0x18eb});var io=require(_0x7ebe('0x1b'))(new Redis(config[_0x7ebe('0x19')]));function VoiceCallReport(_0x12d3ad){this[_0x7ebe('0x1c')]=_0x12d3ad['channels'];this[_0x7ebe('0x1d')]=_0x12d3ad[_0x7ebe('0x1d')];this[_0x7ebe('0x1e')]={};ami['on']('coreshowchannel',this[_0x7ebe('0x1f')][_0x7ebe('0x20')](this));ami['on'](_0x7ebe('0x21'),this[_0x7ebe('0x1f')]['bind'](this));ami['on'](_0x7ebe('0x22'),this[_0x7ebe('0x23')][_0x7ebe('0x20')](this));ami['on'](_0x7ebe('0x24'),this['syncNewState'][_0x7ebe('0x20')](this));ami['on'](_0x7ebe('0x25'),this['syncVarSet'][_0x7ebe('0x20')](this));ami['on'](_0x7ebe('0x26'),this[_0x7ebe('0x27')][_0x7ebe('0x20')](this));ami['on'](_0x7ebe('0x28'),this[_0x7ebe('0x29')][_0x7ebe('0x20')](this));ami['on'](_0x7ebe('0x2a'),this[_0x7ebe('0x2b')]['bind'](this));ami['on'](_0x7ebe('0x2c'),this[_0x7ebe('0x2d')][_0x7ebe('0x20')](this));ami['on'](_0x7ebe('0x2e'),this[_0x7ebe('0x2f')][_0x7ebe('0x20')](this));ami['on']('musiconholdstop',this[_0x7ebe('0x30')][_0x7ebe('0x20')](this));try{logger[_0x7ebe('0x31')](_0x7ebe('0x32'));ami['actionCoreShowChannels']();}catch(_0x549ed8){logger[_0x7ebe('0x33')](_0x7ebe('0x34'),util[_0x7ebe('0x35')](_0x549ed8,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x7ebe('0x36')]['isNotNull']=function(_0xc978ad){return _0xc978ad!==null&&!_['isUndefined'](_0xc978ad);};VoiceCallReport[_0x7ebe('0x36')]['emit']=function(_0x337f89,_0x2f95db,_0x88c9fc){io['to'](_0x337f89)['emit'](_0x2f95db,_0x88c9fc);};VoiceCallReport[_0x7ebe('0x36')][_0x7ebe('0x29')]=function(_0x3f3d15){try{if(this[_0x7ebe('0x37')](_0x3f3d15)){logger[_0x7ebe('0x31')](_0x7ebe('0x38'),_0x3f3d15[_0x7ebe('0x39')],_0x3f3d15[_0x7ebe('0x3a')],_0x3f3d15['calleridnum']);logger[_0x7ebe('0x3b')](_0x7ebe('0x3c'),_0x3f3d15['uniqueid'],util[_0x7ebe('0x35')](_0x3f3d15,{'showHidden':![],'depth':null}));if(_0x3f3d15['uniqueid']===_0x3f3d15['linkedid']){if(!_['isUndefined'](this[_0x7ebe('0x1c')][_0x3f3d15[_0x7ebe('0x39')]])){_[_0x7ebe('0x3d')](this[_0x7ebe('0x1c')][_0x3f3d15[_0x7ebe('0x39')]],_['pick'](_0x3f3d15,_[_0x7ebe('0x3e')](this[_0x7ebe('0x1c')][_0x3f3d15['uniqueid']])));}}if(_0x3f3d15[_0x7ebe('0x3f')]===_0x7ebe('0x40')){if(this[_0x7ebe('0x1d')][_0x3f3d15[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]]){if(_0x3f3d15[_0x7ebe('0x43')]==_0x7ebe('0x44')){this['agents'][_0x3f3d15[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x45')]=_0x3f3d15[_0x7ebe('0x46')];this['emit'](util[_0x7ebe('0x47')](_0x7ebe('0x48'),this['agents'][_0x3f3d15[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x49')]),_0x7ebe('0x4a'),{'destaccountcode':this['agents'][_0x3f3d15[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x3f3d15[_0x7ebe('0x46')]});}}}}}catch(_0x38057){logger['error'](_0x7ebe('0x4b'),_0x3f3d15[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x38057,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')]['syncNewChannel']=function(_0x43a549){try{if(this[_0x7ebe('0x37')](_0x43a549)){logger[_0x7ebe('0x3b')](_0x7ebe('0x4c'),_0x43a549['uniqueid'],util[_0x7ebe('0x35')](_0x43a549,{'showHidden':![],'depth':null}));if(_0x43a549[_0x7ebe('0x39')]===_0x43a549['linkedid']&&_0x43a549[_0x7ebe('0x41')]!=_0x7ebe('0x4d')){if(_[_0x7ebe('0x4e')](this[_0x7ebe('0x1c')][_0x43a549[_0x7ebe('0x39')]])){logger[_0x7ebe('0x31')](_0x7ebe('0x4f'),_0x43a549[_0x7ebe('0x39')],_0x43a549[_0x7ebe('0x3f')],_0x43a549[_0x7ebe('0x43')]);this[_0x7ebe('0x1c')][_0x43a549[_0x7ebe('0x39')]]=new Channel();this[_0x7ebe('0x1c')][_0x43a549['uniqueid']]['starttime']=moment()[_0x7ebe('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7ebe('0x1c')][_0x43a549[_0x7ebe('0x39')]][_0x7ebe('0x50')]=dispositions[_[_0x7ebe('0x51')](_0x43a549[_0x7ebe('0x52')])];_[_0x7ebe('0x3d')](this[_0x7ebe('0x1c')][_0x43a549[_0x7ebe('0x39')]],_['pick'](_0x43a549,_[_0x7ebe('0x3e')](this['channels'][_0x43a549[_0x7ebe('0x39')]])));if(_0x43a549[_0x7ebe('0x3f')]===_0x7ebe('0x40')){if(this[_0x7ebe('0x1d')][_0x43a549[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]]){if(_[_0x7ebe('0x4e')](this[_0x7ebe('0x1d')][_0x43a549[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x45')])){this[_0x7ebe('0x1d')][_0x43a549[_0x7ebe('0x41')]['split']('-')[0x0]][_0x7ebe('0x45')]=_0x43a549[_0x7ebe('0x43')];logger['debug'](_0x7ebe('0x53'),_0x43a549[_0x7ebe('0x39')],util[_0x7ebe('0x35')]({'destaccountcode':this[_0x7ebe('0x1d')][_0x43a549[_0x7ebe('0x41')]['split']('-')[0x0]][_0x7ebe('0x54')],'destconnectedlinenum':_0x43a549[_0x7ebe('0x43')]},{'showHidden':![],'depth':null}));this[_0x7ebe('0x55')](util[_0x7ebe('0x47')]('user:%s',this[_0x7ebe('0x1d')][_0x43a549['channel']['split']('-')[0x0]][_0x7ebe('0x49')]),_0x7ebe('0x4a'),{'destaccountcode':this['agents'][_0x43a549[_0x7ebe('0x41')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x43a549['exten']});}}}}}}}catch(_0x14ef22){logger['error'](_0x7ebe('0x56'),_0x43a549[_0x7ebe('0x39')],util['inspect'](_0x14ef22,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')][_0x7ebe('0x1f')]=function(_0xa0f085){try{if(this[_0x7ebe('0x37')](_0xa0f085)){logger[_0x7ebe('0x3b')]('[%s][voiceCallReport][newexten]\x20event:',_0xa0f085['uniqueid'],util[_0x7ebe('0x35')](_0xa0f085,{'showHidden':![],'depth':null}));if(_0xa0f085[_0x7ebe('0x39')]===_0xa0f085[_0x7ebe('0x57')]&&_0xa0f085[_0x7ebe('0x43')]!='h'&&_0xa0f085[_0x7ebe('0x41')]!=_0x7ebe('0x4d')){_0xa0f085[_0x7ebe('0x58')]=_0xa0f085[_0x7ebe('0x58')][_0x7ebe('0x59')]();_0xa0f085[_0x7ebe('0x5a')]=_0xa0f085['appdata']&&_0xa0f085[_0x7ebe('0x5b')][_0x7ebe('0x5c')](_0x7ebe('0x5d'))?_0xa0f085[_0x7ebe('0x5b')]:(_0xa0f085[_0x7ebe('0x5b')]||_0xa0f085[_0x7ebe('0x5a')])[_0x7ebe('0x59')]();logger['info'](_0x7ebe('0x5e'),_0xa0f085['uniqueid'],_0xa0f085[_0x7ebe('0x58')],_0xa0f085['applicationdata']);if(_[_0x7ebe('0x4e')](this['channels'][_0xa0f085[_0x7ebe('0x39')]])){this[_0x7ebe('0x1c')][_0xa0f085[_0x7ebe('0x39')]]=new Channel();this[_0x7ebe('0x1c')][_0xa0f085['uniqueid']][_0x7ebe('0x5f')]=_0xa0f085['duration']?moment()['subtract'](moment[_0x7ebe('0x60')](_0xa0f085[_0x7ebe('0x60')])[_0x7ebe('0x61')](),_0x7ebe('0x61'))[_0x7ebe('0x47')](_0x7ebe('0x62')):moment()[_0x7ebe('0x47')](_0x7ebe('0x62'));this[_0x7ebe('0x1c')][_0xa0f085[_0x7ebe('0x39')]][_0x7ebe('0x50')]=_0x7ebe('0x15');}_[_0x7ebe('0x3d')](this[_0x7ebe('0x1c')][_0xa0f085['uniqueid']],_[_0x7ebe('0x63')](_0xa0f085,_[_0x7ebe('0x3e')](this['channels'][_0xa0f085[_0x7ebe('0x39')]])));if(_['includes'](applications,_0xa0f085[_0x7ebe('0x58')])){this[_0x7ebe('0x1c')][_0xa0f085[_0x7ebe('0x39')]]['lastapplication']=_0xa0f085[_0x7ebe('0x58')];this[_0x7ebe('0x1c')][_0xa0f085[_0x7ebe('0x39')]][_0x7ebe('0x64')]=_0xa0f085[_0x7ebe('0x5a')];if(_0xa0f085[_0x7ebe('0x58')]==='set'&&_[_0x7ebe('0x5c')](_0xa0f085['applicationdata'][_0x7ebe('0x59')](),_0x7ebe('0x65'))){var _0x59d9ec=_0xa0f085['applicationdata'][_0x7ebe('0x42')]('=');var _0x11768e=_0x59d9ec[0x0]['toLowerCase']()[_0x7ebe('0x66')](/cdr\((.*)\)/);if(_0x11768e){this[_0x7ebe('0x1c')][_0xa0f085[_0x7ebe('0x39')]][_0x11768e[0x1]]=_0x59d9ec[0x1];}}else if(_0xa0f085[_0x7ebe('0x58')]===_0x7ebe('0x12')){this[_0x7ebe('0x1c')][_0xa0f085[_0x7ebe('0x39')]][_0x7ebe('0x12')]=_0xa0f085[_0x7ebe('0x5a')][_0x7ebe('0x42')](',')[0x0];}}}}}catch(_0x25bb7f){logger[_0x7ebe('0x33')](_0x7ebe('0x67'),_0xa0f085[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x25bb7f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x7ebe('0x68')]=function(_0x402838){try{if(this[_0x7ebe('0x37')](_0x402838)){logger[_0x7ebe('0x31')](_0x7ebe('0x69'),_0x402838[_0x7ebe('0x39')],_0x402838[_0x7ebe('0x57')],_0x402838[_0x7ebe('0x3a')],_0x402838[_0x7ebe('0x6a')]);logger[_0x7ebe('0x3b')](_0x7ebe('0x6b'),_0x402838[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x402838,{'showHidden':![],'depth':null}));if(_0x402838[_0x7ebe('0x39')]!==_0x402838[_0x7ebe('0x57')]){if(this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]]){if(_0x402838[_0x7ebe('0x52')]==='6'){if(!this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]][_0x7ebe('0x6c')]){var _0x162e2e=moment();this['channels'][_0x402838[_0x7ebe('0x57')]]['answered']=!![];this['channels'][_0x402838['linkedid']][_0x7ebe('0x6d')]=_0x162e2e[_0x7ebe('0x47')](_0x7ebe('0x62'));if(this[_0x7ebe('0x1c')][_0x402838['linkedid']][_0x7ebe('0x5f')]){this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]][_0x7ebe('0x6e')]=_0x162e2e[_0x7ebe('0x6f')](this[_0x7ebe('0x1c')][_0x402838['linkedid']][_0x7ebe('0x5f')],_0x7ebe('0x61'));}}this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]]['linkedid']=_0x402838[_0x7ebe('0x39')];if(_0x402838[_0x7ebe('0x6a')]!==_0x7ebe('0x44')){this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]][_0x7ebe('0x46')]=_0x402838[_0x7ebe('0x6a')];}this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]][_0x7ebe('0x70')]=_0x402838[_0x7ebe('0x3a')];this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]][_0x7ebe('0x71')]=_0x402838[_0x7ebe('0x41')];this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]][_0x7ebe('0x50')]=dispositions[_['toNumber'](_0x402838[_0x7ebe('0x52')])];if(this['agents'][_0x402838[_0x7ebe('0x41')]['split']('-')[0x0]]){this[_0x7ebe('0x1c')][_0x402838['linkedid']][_0x7ebe('0x72')]=this['agents'][_0x402838[_0x7ebe('0x41')]['split']('-')[0x0]]['id'];this[_0x7ebe('0x1c')][_0x402838['linkedid']]['membername']=this[_0x7ebe('0x1d')][_0x402838['channel']['split']('-')[0x0]][_0x7ebe('0x49')];}}}}else{if(this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x39')]]){if(_0x402838[_0x7ebe('0x52')]==='6'){if(this[_0x7ebe('0x1d')][_0x402838['channel'][_0x7ebe('0x42')]('-')[0x0]]){this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x39')]][_0x7ebe('0x72')]=this['agents'][_0x402838[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]]['id'];this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x39')]]['membername']=this[_0x7ebe('0x1d')][_0x402838[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x49')];}}}}if(_0x402838[_0x7ebe('0x52')]==='6'&&_0x402838[_0x7ebe('0x3f')]===_0x7ebe('0x40')){if(this[_0x7ebe('0x1d')][_0x402838[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]]){this[_0x7ebe('0x1d')][_0x402838[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x45')]=_0x402838[_0x7ebe('0x43')];var _0x4df87d;if(this['channels'][_0x402838[_0x7ebe('0x39')]])_0x4df87d=this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x39')]][_0x7ebe('0x73')];else if(this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]])_0x4df87d=this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]][_0x7ebe('0x73')];logger[_0x7ebe('0x3b')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x402838[_0x7ebe('0x39')],util[_0x7ebe('0x35')]({'destaccountcode':this[_0x7ebe('0x1d')][_0x402838[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x54')],'destconnectedlinenum':_0x402838[_0x7ebe('0x43')],'routealias':_0x4df87d},{'showHidden':![],'depth':null}));this[_0x7ebe('0x55')](util[_0x7ebe('0x47')](_0x7ebe('0x48'),this[_0x7ebe('0x1d')][_0x402838[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x49')]),_0x7ebe('0x4a'),{'destaccountcode':this[_0x7ebe('0x1d')][_0x402838['channel']['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x402838[_0x7ebe('0x43')],'routealias':_0x4df87d});}}}}catch(_0x4aa062){logger[_0x7ebe('0x33')]('[%s][voiceCallReport][newstate]',_0x402838[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x4aa062,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')][_0x7ebe('0x74')]=function(_0x40c50c,_0x1b3361){try{if(this[_0x7ebe('0x1c')][_0x40c50c]){logger[_0x7ebe('0x31')](_0x7ebe('0x75'),_0x40c50c,_0x1b3361);this['channels'][_0x40c50c]['monitor']=!![];if(_['endsWith'](_0x1b3361,'.wav49')){_0x1b3361=_0x1b3361[_0x7ebe('0x76')](_0x7ebe('0x77'),_0x7ebe('0x78'));}this[_0x7ebe('0x1c')][_0x40c50c][_0x7ebe('0x79')]=_0x1b3361;var _0x357b3b=_[_0x7ebe('0x7a')](this[_0x7ebe('0x1c')][_0x40c50c][_0x7ebe('0x7b')],{'filename':_0x1b3361});if(_[_0x7ebe('0x7c')](_0x357b3b)){this[_0x7ebe('0x1c')][_0x40c50c]['monitors'][_0x7ebe('0x7d')]({'filename':_0x1b3361,'createdAt':moment()[_0x7ebe('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x7ebe('0x7e')});}}}catch(_0xb301bb){logger['error'](_0x7ebe('0x7f'),_0x40c50c,util['inspect'](_0xb301bb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')][_0x7ebe('0x80')]=function(_0x5b658c){try{if(this[_0x7ebe('0x37')](_0x5b658c)){logger[_0x7ebe('0x3b')]('[%s][voiceCallReport][varset]\x20event:',_0x5b658c[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x5b658c,{'showHidden':![],'depth':null}));if(this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x39')]]&&_0x5b658c['channel']!=_0x7ebe('0x4d')){if(this['isNotNull'](_0x5b658c[_0x7ebe('0x81')])){if(this[_0x7ebe('0x37')](_0x5b658c[_0x7ebe('0x81')]['mixmonitor_filename'])){logger[_0x7ebe('0x31')](_0x7ebe('0x82'),_0x5b658c[_0x7ebe('0x39')],_0x5b658c['value']);this[_0x7ebe('0x74')](_0x5b658c[_0x7ebe('0x39')],_0x5b658c[_0x7ebe('0x83')]);}else if(this[_0x7ebe('0x37')](_0x5b658c[_0x7ebe('0x81')]['xmd-phone'])){logger['info'](_0x7ebe('0x84'),_0x5b658c[_0x7ebe('0x39')],_0x5b658c['value']);this[_0x7ebe('0x1c')][_0x5b658c['uniqueid']][_0x7ebe('0x6a')]=_0x5b658c[_0x7ebe('0x83')];}else if(this['isNotNull'](_0x5b658c[_0x7ebe('0x81')][_0x7ebe('0x85')])){logger[_0x7ebe('0x31')](_0x7ebe('0x86'),_0x5b658c[_0x7ebe('0x39')],_0x5b658c[_0x7ebe('0x83')]);this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x39')]][_0x7ebe('0x87')]=_0x5b658c[_0x7ebe('0x83')];}else if(this[_0x7ebe('0x37')](_0x5b658c['variable']['xmd-cdrtype'])){logger[_0x7ebe('0x31')](_0x7ebe('0x88'),_0x5b658c[_0x7ebe('0x39')],_0x5b658c['value']);this[_0x7ebe('0x1c')][_0x5b658c['uniqueid']]['type']=_0x5b658c['value'];}else if(this[_0x7ebe('0x37')](_0x5b658c[_0x7ebe('0x81')]['xmd-queue'])){logger[_0x7ebe('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x5b658c[_0x7ebe('0x39')],_0x5b658c[_0x7ebe('0x83')][_0x7ebe('0x42')](',')[0x0]);this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x39')]]['queue']=_0x5b658c[_0x7ebe('0x83')][_0x7ebe('0x42')](',')[0x0];}else if(this[_0x7ebe('0x37')](_0x5b658c[_0x7ebe('0x81')][_0x7ebe('0x89')])){logger[_0x7ebe('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5b658c[_0x7ebe('0x39')],_0x5b658c[_0x7ebe('0x83')]);this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x39')]][_0x7ebe('0x8a')]=_0x5b658c[_0x7ebe('0x83')];}else if(this['isNotNull'](_0x5b658c[_0x7ebe('0x81')][_0x7ebe('0x8b')])){logger[_0x7ebe('0x31')](_0x7ebe('0x8c'),_0x5b658c[_0x7ebe('0x39')],_0x5b658c['value']);this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x39')]][_0x7ebe('0x8d')]=_0x5b658c[_0x7ebe('0x83')];}else if(this['isNotNull'](_0x5b658c[_0x7ebe('0x81')][_0x7ebe('0x8e')])){logger[_0x7ebe('0x31')](_0x7ebe('0x8f'),_0x5b658c[_0x7ebe('0x39')],_0x5b658c[_0x7ebe('0x83')]);this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x39')]][_0x7ebe('0x90')]=_0x5b658c['value'];}else if(this[_0x7ebe('0x37')](_0x5b658c['variable'][_0x7ebe('0x91')])){logger[_0x7ebe('0x31')](_0x7ebe('0x92'),_0x5b658c[_0x7ebe('0x39')],_0x5b658c[_0x7ebe('0x83')]);this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x39')]][_0x7ebe('0x12')]=_0x5b658c[_0x7ebe('0x83')];}else if(this[_0x7ebe('0x37')](_0x5b658c[_0x7ebe('0x81')][_0x7ebe('0x93')])){logger['info'](_0x7ebe('0x94'),_0x5b658c['uniqueid'],_0x5b658c[_0x7ebe('0x83')]);this['channels'][_0x5b658c['uniqueid']][_0x7ebe('0x95')]=_0x5b658c[_0x7ebe('0x83')];}}}else if(this['isNotNull'](_0x5b658c[_0x7ebe('0x81')][_0x7ebe('0x96')])){if(_0x5b658c[_0x7ebe('0x83')]){var _0x4430c0=path[_0x7ebe('0x97')](_0x5b658c[_0x7ebe('0x83')])[_0x7ebe('0x49')];logger[_0x7ebe('0x31')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x4430c0,_0x5b658c[_0x7ebe('0x83')]);this[_0x7ebe('0x74')](_0x4430c0,_0x5b658c[_0x7ebe('0x83')]);}}else if(this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x57')]]){if(this[_0x7ebe('0x37')](_0x5b658c[_0x7ebe('0x81')])){if(this[_0x7ebe('0x37')](_0x5b658c[_0x7ebe('0x81')][_0x7ebe('0x93')])){logger[_0x7ebe('0x31')](_0x7ebe('0x94'),_0x5b658c[_0x7ebe('0x57')],_0x5b658c[_0x7ebe('0x83')]);this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x57')]][_0x7ebe('0x98')]=_0x5b658c[_0x7ebe('0x83')];}}}}}catch(_0x13bef9){logger['error'](_0x7ebe('0x99'),_0x5b658c[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x13bef9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')]['syncHangup']=function(_0x3f95cf){try{if(this[_0x7ebe('0x37')](_0x3f95cf)){logger[_0x7ebe('0x3b')](_0x7ebe('0x9a'),_0x3f95cf[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x3f95cf,{'showHidden':![],'depth':null}));if(this[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']]){logger['info']('[%s][voiceCallReport][hangup]\x20reason:%s',_0x3f95cf[_0x7ebe('0x39')],_0x3f95cf['cause-txt']);var _0x22910a=moment();this[_0x7ebe('0x1c')][_0x3f95cf[_0x7ebe('0x39')]][_0x7ebe('0x9b')]=_0x22910a['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']][_0x7ebe('0x60')]=_0x22910a[_0x7ebe('0x6f')](this[_0x7ebe('0x1c')][_0x3f95cf[_0x7ebe('0x39')]][_0x7ebe('0x5f')],_0x7ebe('0x61'));if(this[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']][_0x7ebe('0x6c')]){this[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']][_0x7ebe('0x9c')]=_0x22910a[_0x7ebe('0x6f')](this[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']]['answertime'],_0x7ebe('0x61'));this[_0x7ebe('0x1c')][_0x3f95cf[_0x7ebe('0x39')]][_0x7ebe('0x6e')]=this[_0x7ebe('0x1c')][_0x3f95cf[_0x7ebe('0x39')]][_0x7ebe('0x60')]-this[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']][_0x7ebe('0x9c')];}if(_0x3f95cf['context']===_0x7ebe('0x40')){if(this['agents'][_0x3f95cf[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]]){this[_0x7ebe('0x1d')][_0x3f95cf[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]]=_[_0x7ebe('0x9d')](this[_0x7ebe('0x1d')][_0x3f95cf[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]],['destconnectedlinenum']);logger[_0x7ebe('0x3b')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x3f95cf[_0x7ebe('0x39')],util[_0x7ebe('0x35')]({'id':this['agents'][_0x3f95cf[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x3f95cf[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x54')]},{'showHidden':![],'depth':null}));this[_0x7ebe('0x55')](util['format'](_0x7ebe('0x48'),this[_0x7ebe('0x1d')][_0x3f95cf[_0x7ebe('0x41')]['split']('-')[0x0]]['name']),_0x7ebe('0x9e'),{'id':this['agents'][_0x3f95cf['channel'][_0x7ebe('0x42')]('-')[0x0]]['id'],'destaccountcode':this[_0x7ebe('0x1d')][_0x3f95cf[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x54')]});}}var _0x3335b5=this;Promise[_0x7ebe('0x9f')]()['then'](function(){var _0x50693c=_0x3335b5[_0x7ebe('0x1c')][_0x3f95cf[_0x7ebe('0x39')]];if(typeof _0x50693c[_0x7ebe('0xa0')]===_0x7ebe('0xa1'))return;if(_[_0x7ebe('0xa2')](_0x50693c['monitors']))return;return RpcSetting[_0x7ebe('0xa3')]()[_0x7ebe('0xa4')](function(_0x582a37){if(!_0x582a37[_0x7ebe('0xa5')])return;return Promise[_0x7ebe('0x9f')]()[_0x7ebe('0xa4')](function(){return ami[_0x7ebe('0xa6')]({'action':'StopMixMonitor','channel':_0x50693c[_0x7ebe('0x41')]})['catch'](function(){});})[_0x7ebe('0xa4')](function(){return ami['Action']({'action':_0x7ebe('0xa7'),'channel':_0x50693c[_0x7ebe('0x71')]})['catch'](function(){})['finally'](function(){var _0x200fbe=_0x3335b5['agents'][_0x50693c[_0x7ebe('0x71')][_0x7ebe('0x42')]('-')[0x0]];if(!_0x200fbe)return;io[_0x7ebe('0x55')]('webbar:stopmonitors',{'agentId':_0x200fbe['id'],'uniqueid':_0x50693c[_0x7ebe('0x39')]});});});});})[_0x7ebe('0xa4')](function(){if(_0x3f95cf[_0x7ebe('0xa8')]===_0x7ebe('0xa9')){_0x3335b5['blindTransfers'][_0x3f95cf[_0x7ebe('0x39')]]=_0x3335b5['channels'][_0x3f95cf['uniqueid']];}else{if(_0x3335b5[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']][_0x7ebe('0xaa')]==='outbound'&&_0x3335b5[_0x7ebe('0x1e')][_0x3f95cf['uniqueid']]){_0x3335b5[_0x7ebe('0x1c')][_0x3f95cf[_0x7ebe('0x39')]]['uniqueid']=[_0x3335b5['channels'][_0x3f95cf[_0x7ebe('0x39')]][_0x7ebe('0x57')],_0x3335b5[_0x7ebe('0x1c')][_0x3f95cf[_0x7ebe('0x39')]][_0x7ebe('0x57')]=_0x3335b5[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']][_0x7ebe('0x39')]][0x0];delete _0x3335b5[_0x7ebe('0x1e')][_0x3f95cf[_0x7ebe('0x39')]];}}logger[_0x7ebe('0x3b')](_0x7ebe('0xab'),_0x3f95cf[_0x7ebe('0x39')],util['inspect'](_0x3335b5['channels'][_0x3f95cf[_0x7ebe('0x39')]],{'showHidden':![],'depth':null}));ami[_0x7ebe('0x55')](_0x7ebe('0xac'),_0x3335b5[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']]);delete _0x3335b5[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']];});}}}catch(_0x3b9b8f){logger[_0x7ebe('0x33')](_0x7ebe('0xad'),_0x3f95cf[_0x7ebe('0x39')],util['inspect'](_0x3b9b8f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')][_0x7ebe('0x2b')]=function(_0x37c929){try{if(this[_0x7ebe('0x37')](_0x37c929)){logger[_0x7ebe('0x31')](_0x7ebe('0xae'),_0x37c929['uniqueid'],_0x37c929[_0x7ebe('0xaf')],_0x37c929[_0x7ebe('0xb0')]);logger['debug'](_0x7ebe('0xb1'),_0x37c929[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x37c929,{'showHidden':![],'depth':null}));if(this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb2')]]){this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb2')]][_0x7ebe('0xb3')]=_0x37c929[_0x7ebe('0xaf')];this[_0x7ebe('0x1c')][_0x37c929['transfereeuniqueid']]['transferconnectedlinenum']=_0x37c929[_0x7ebe('0xb0')];if(this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb4')]]){var _0x1d5ca8=this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb4')]];this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb4')]]=this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb2')]];this[_0x7ebe('0x1c')][_0x37c929['transfereeuniqueid']]=_0x1d5ca8;}}else if(this['channels'][_0x37c929[_0x7ebe('0xb5')]]){this['channels'][_0x37c929['transfertargetuniqueid']][_0x7ebe('0xb3')]=_0x37c929['origtransferercalleridnum'];this['channels'][_0x37c929[_0x7ebe('0xb5')]][_0x7ebe('0xb6')]=_0x37c929[_0x7ebe('0xb0')];if(this[_0x7ebe('0x1c')][_0x37c929['origtransfereruniqueid']]){var _0x1d5ca8=this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb7')]];this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb7')]]=this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb5')]];this['channels'][_0x37c929[_0x7ebe('0xb5')]]=_0x1d5ca8;}}if((this[_0x7ebe('0x1c')][_0x37c929['origtransfereruniqueid']]||this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb8')]])&&this['channels'][_0x37c929[_0x7ebe('0xb4')]]){var _0x2bb114=_[_0x7ebe('0xb9')]([this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb7')]],this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb8')]],this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb4')]]],function(_0x27e295){return _0x27e295&&_0x27e295[_0x7ebe('0xaa')]===_0x7ebe('0xba')&&_0x27e295[_0x7ebe('0xbb')];});if(_0x2bb114){if(this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb7')]])this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb7')]][_0x7ebe('0xa0')]=_0x7ebe('0xbc');if(this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb8')]])this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb8')]][_0x7ebe('0xa0')]='ATTENDED';this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb4')]][_0x7ebe('0xa0')]=_0x7ebe('0xbc');}}}}catch(_0x362f9d){logger[_0x7ebe('0x33')](_0x7ebe('0xbd'),_0x37c929['uniqueid'],util[_0x7ebe('0x35')](_0x362f9d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')][_0x7ebe('0x2d')]=function(_0x56a352){try{if(this[_0x7ebe('0x37')](_0x56a352)){logger[_0x7ebe('0x31')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x56a352['uniqueid'],_0x56a352[_0x7ebe('0xbe')],_0x56a352['extension']);logger[_0x7ebe('0x3b')](_0x7ebe('0xbf'),_0x56a352[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x56a352,{'showHidden':![],'depth':null}));if(this['channels'][_0x56a352[_0x7ebe('0xb2')]]){this[_0x7ebe('0x1c')][_0x56a352[_0x7ebe('0xb2')]][_0x7ebe('0xb3')]=_0x56a352[_0x7ebe('0xbe')];this[_0x7ebe('0x1c')][_0x56a352[_0x7ebe('0xb2')]][_0x7ebe('0xb6')]=_0x56a352[_0x7ebe('0xc0')];this['channels'][_0x56a352[_0x7ebe('0xb2')]]['transferType']=_0x7ebe('0xc1');this[_0x7ebe('0x27')]({'event':_0x7ebe('0xa9'),'uniqueid':_0x56a352[_0x7ebe('0xb2')],'context':_0x56a352['context'],'channel':_0x56a352[_0x7ebe('0xc2')]});}else{this[_0x7ebe('0x1c')][_0x56a352[_0x7ebe('0xc3')]]['transferType']=_0x7ebe('0xc1');}}}catch(_0x405429){logger[_0x7ebe('0x33')](_0x7ebe('0xc4'),_0x56a352[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x405429,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')][_0x7ebe('0x2f')]=function(_0x20ffd8){try{if(this['isNotNull'](_0x20ffd8)){logger[_0x7ebe('0x3b')](_0x7ebe('0xc5'),_0x20ffd8['uniqueid'],util[_0x7ebe('0x35')](_0x20ffd8,{'showHidden':![],'depth':null}));if(this[_0x7ebe('0x1c')][_0x20ffd8[_0x7ebe('0x39')]]){if(!_[_0x7ebe('0x7c')](this[_0x7ebe('0x1c')][_0x20ffd8['uniqueid']][_0x7ebe('0x6d')])){this[_0x7ebe('0x1c')][_0x20ffd8[_0x7ebe('0x39')]][_0x7ebe('0xc6')]=moment()[_0x7ebe('0x47')](_0x7ebe('0x62'));logger['info'](_0x7ebe('0xc7'),_0x20ffd8['uniqueid'],this['channels'][_0x20ffd8['uniqueid']][_0x7ebe('0xc6')]);}}}}catch(_0x57438c){logger[_0x7ebe('0x33')]('[%s][voiceCallReport][musiconholdstart]',_0x20ffd8[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x57438c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')]['syncMusicOnHoldStop']=function(_0x35a0b5){try{if(this[_0x7ebe('0x37')](_0x35a0b5)){logger['debug'](_0x7ebe('0xc8'),_0x35a0b5[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x35a0b5,{'showHidden':![],'depth':null}));if(this[_0x7ebe('0x1c')][_0x35a0b5[_0x7ebe('0x39')]]){if(!_[_0x7ebe('0x7c')](this['channels'][_0x35a0b5[_0x7ebe('0x39')]][_0x7ebe('0xc6')])){this[_0x7ebe('0x1c')][_0x35a0b5[_0x7ebe('0x39')]]['mohtime']+=moment()[_0x7ebe('0xc9')](0x0)[_0x7ebe('0x6f')](this[_0x7ebe('0x1c')][_0x35a0b5['uniqueid']][_0x7ebe('0xc6')],_0x7ebe('0x61'));logger[_0x7ebe('0x31')](_0x7ebe('0xca'),_0x35a0b5[_0x7ebe('0x39')],this[_0x7ebe('0x1c')][_0x35a0b5[_0x7ebe('0x39')]][_0x7ebe('0xcb')]);delete this['channels'][_0x35a0b5[_0x7ebe('0x39')]][_0x7ebe('0xc6')];}}}}catch(_0x124b3b){logger[_0x7ebe('0x33')](_0x7ebe('0xcc'),_0x35a0b5['uniqueid'],util['inspect'](_0x124b3b,{'showHidden':![],'depth':null}));}};module[_0x7ebe('0xcd')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 56a0344..f621efd 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 _0x0d1a=['stringify','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','lodash','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','dialbegin','dialend','syncDialEnd','bind','varset','syncVarSet','newexten','syncNewExten','syncHangup','isNotNull','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','substring','channel','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','variables','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','isUndefined','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','complete','total','holdtime','seconds','billableseconds','sumBillable','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save'];(function(_0x16f391,_0x2205c0){var _0x1339b8=function(_0x25b655){while(--_0x25b655){_0x16f391['push'](_0x16f391['shift']());}};_0x1339b8(++_0x2205c0);}(_0x0d1a,0x86));var _0xa0d1=function(_0x8e40b9,_0x6c484c){_0x8e40b9=_0x8e40b9-0x0;var _0x5183fb=_0x0d1a[_0x8e40b9];return _0x5183fb;};'use strict';var _=require(_0xa0d1('0x0'));var moment=require('moment');var util=require(_0xa0d1('0x1'));var Redis=require('ioredis');var config=require(_0xa0d1('0x2'));var logger=require(_0xa0d1('0x3'))(_0xa0d1('0x4'));var ami=require(_0xa0d1('0x5'));config[_0xa0d1('0x6')]=_[_0xa0d1('0x7')](config[_0xa0d1('0x6')],{'host':_0xa0d1('0x8'),'port':0x18eb});var io=require(_0xa0d1('0x9'))(new Redis(config[_0xa0d1('0x6')]));function VoiceDialReport(_0x6b8cdf){this[_0xa0d1('0xa')]=_0x6b8cdf[_0xa0d1('0xb')];this[_0xa0d1('0xc')]=_0x6b8cdf[_0xa0d1('0xc')];this[_0xa0d1('0xd')]={};this['variables']={};ami['on'](_0xa0d1('0xe'),this['syncDialBegin']['bind'](this));ami['on'](_0xa0d1('0xf'),this[_0xa0d1('0x10')][_0xa0d1('0x11')](this));ami['on'](_0xa0d1('0x12'),this[_0xa0d1('0x13')][_0xa0d1('0x11')](this));ami['on'](_0xa0d1('0x14'),this[_0xa0d1('0x15')][_0xa0d1('0x11')](this));ami['on']('hangup',this[_0xa0d1('0x16')][_0xa0d1('0x11')](this));}VoiceDialReport['prototype'][_0xa0d1('0x17')]=function(_0x4e2528){return _0x4e2528!==null&&!_['isUndefined'](_0x4e2528);};VoiceDialReport[_0xa0d1('0x18')]['emit']=function(_0x4cb5eb,_0xd16287,_0x221151){io['to'](_0x4cb5eb)[_0xa0d1('0x19')](_0xd16287,_0x221151);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x1d38f3){try{if(this['isNotNull'](_0x1d38f3)){logger[_0xa0d1('0x1a')](_0xa0d1('0x1b'),_0x1d38f3[_0xa0d1('0x1c')],util[_0xa0d1('0x1d')](_0x1d38f3,{'showHidden':![],'depth':null}));if(this['channels'][_0x1d38f3['uniqueid']]){_[_0xa0d1('0x1e')](this[_0xa0d1('0xa')][_0x1d38f3['uniqueid']],{'starttime':moment()[_0xa0d1('0x1f')](_0xa0d1('0x20')),'lastevent':'called','interface':_0x1d38f3['channel'][_0xa0d1('0x21')](0x0,_0x1d38f3[_0xa0d1('0x22')][_0xa0d1('0x23')]('-')),'membername':_0x1d38f3[_0xa0d1('0x22')][_0xa0d1('0x21')](_0x1d38f3['channel'][_0xa0d1('0x23')]('/')+0x1,_0x1d38f3[_0xa0d1('0x22')][_0xa0d1('0x23')]('-'))},_[_0xa0d1('0x24')](_0x1d38f3,[_0xa0d1('0x25'),_0xa0d1('0x26')]));logger[_0xa0d1('0x27')](_0xa0d1('0x28'),_0x1d38f3['uniqueid'],this[_0xa0d1('0xa')][_0x1d38f3[_0xa0d1('0x1c')]][_0xa0d1('0x29')],this[_0xa0d1('0xa')][_0x1d38f3[_0xa0d1('0x1c')]][_0xa0d1('0x2a')]);logger[_0xa0d1('0x1a')](_0xa0d1('0x2b'),_0x1d38f3[_0xa0d1('0x1c')],util[_0xa0d1('0x1d')](this[_0xa0d1('0xa')][_0x1d38f3[_0xa0d1('0x1c')]],{'showHidden':![],'depth':null}));if(this[_0xa0d1('0xd')][_0x1d38f3['uniqueid']])_['merge'](this[_0xa0d1('0xa')][_0x1d38f3[_0xa0d1('0x1c')]],this[_0xa0d1('0xd')][_0x1d38f3[_0xa0d1('0x1c')]]);this[_0xa0d1('0x19')](_0xa0d1('0x2c'),'voice_outbound_channel:save',this['channels'][_0x1d38f3[_0xa0d1('0x1c')]]);logger[_0xa0d1('0x1a')](_0xa0d1('0x2d'),_0x1d38f3[_0xa0d1('0x1c')],util[_0xa0d1('0x1d')](this[_0xa0d1('0xa')][_0x1d38f3[_0xa0d1('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xa0d1('0x19')](_0xa0d1('0x2e'),this[_0xa0d1('0xa')][_0x1d38f3['uniqueid']]);}}}catch(_0x2b1753){logger[_0xa0d1('0x2f')]('[%s][voiceDialReport][dialbegin]',_0x1d38f3[_0xa0d1('0x1c')],util[_0xa0d1('0x1d')](_0x2b1753,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa0d1('0x18')]['syncDialEnd']=function(_0x20a3f9){try{if(this['isNotNull'](_0x20a3f9)){logger['debug'](_0xa0d1('0x30'),_0x20a3f9[_0xa0d1('0x1c')],util[_0xa0d1('0x1d')](_0x20a3f9,{'showHidden':![],'depth':null}));if(this[_0xa0d1('0xa')][_0x20a3f9[_0xa0d1('0x1c')]]){this[_0xa0d1('0xa')][_0x20a3f9[_0xa0d1('0x1c')]][_0xa0d1('0x31')]=_0x20a3f9[_0xa0d1('0x31')];if(_0x20a3f9[_0xa0d1('0x31')]===_0xa0d1('0x32')){this['channels'][_0x20a3f9[_0xa0d1('0x1c')]][_0xa0d1('0x33')]=_0x20a3f9[_0xa0d1('0x33')];this['channels'][_0x20a3f9[_0xa0d1('0x1c')]]['connectedlinename']=_0x20a3f9[_0xa0d1('0x34')];this['channels'][_0x20a3f9[_0xa0d1('0x1c')]][_0xa0d1('0x35')]=moment()[_0xa0d1('0x1f')](_0xa0d1('0x20'));this['channels'][_0x20a3f9['uniqueid']][_0xa0d1('0x36')]=_0xa0d1('0x37');logger[_0xa0d1('0x27')](_0xa0d1('0x38'),_0x20a3f9[_0xa0d1('0x1c')],_0x20a3f9['channel'][_0xa0d1('0x21')](_0x20a3f9[_0xa0d1('0x22')]['lastIndexOf']('/')+0x1,_0x20a3f9[_0xa0d1('0x22')][_0xa0d1('0x23')]('-')));logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x20a3f9['uniqueid'],util[_0xa0d1('0x1d')](this[_0xa0d1('0xa')][_0x20a3f9[_0xa0d1('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xa0d1('0x19')]('custom:dialconnect',this[_0xa0d1('0xa')][_0x20a3f9[_0xa0d1('0x1c')]]);}logger[_0xa0d1('0x1a')](_0xa0d1('0x39'),_0x20a3f9['uniqueid'],util[_0xa0d1('0x1d')](this[_0xa0d1('0xa')][_0x20a3f9[_0xa0d1('0x1c')]],{'showHidden':![],'depth':null}));this[_0xa0d1('0x19')](_0xa0d1('0x2c'),_0xa0d1('0x3a'),this[_0xa0d1('0xa')][_0x20a3f9[_0xa0d1('0x1c')]]);}}}catch(_0x4e163a){logger['error'](_0xa0d1('0x3b'),_0x20a3f9[_0xa0d1('0x1c')],util[_0xa0d1('0x1d')](_0x4e163a,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xa0d1('0x13')]=function(_0x567f3f){try{if(this[_0xa0d1('0x17')](_0x567f3f)){logger['debug'](_0xa0d1('0x3c'),_0x567f3f[_0xa0d1('0x1c')],util[_0xa0d1('0x1d')](_0x567f3f,{'showHidden':![],'depth':null}));this[_0xa0d1('0x3d')](_0x567f3f[_0xa0d1('0x1c')],_[_0xa0d1('0x3e')](_0x567f3f[_0xa0d1('0x3f')])[0x0],_0x567f3f[_0xa0d1('0x40')]);if(this[_0xa0d1('0x17')](_0x567f3f['variable'])&&this[_0xa0d1('0x17')](_0x567f3f[_0xa0d1('0x3f')][_0xa0d1('0x41')])){if(_['isUndefined'](this[_0xa0d1('0xa')][_0x567f3f[_0xa0d1('0x1c')]])){this[_0xa0d1('0xa')][_0x567f3f['uniqueid']]={'routeId':_0x567f3f[_0xa0d1('0x40')],'variables':this[_0xa0d1('0x42')][_0x567f3f[_0xa0d1('0x1c')]],'motionChannel':'voice'};logger[_0xa0d1('0x27')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x567f3f['uniqueid'],_0x567f3f[_0xa0d1('0x3f')][_0xa0d1('0x41')],_['keys'](_0x567f3f['variable'])[0x0],_0x567f3f[_0xa0d1('0x40')]);logger['debug'](_0xa0d1('0x43'),_0x567f3f[_0xa0d1('0x1c')],util[_0xa0d1('0x1d')](this[_0xa0d1('0xa')][_0x567f3f[_0xa0d1('0x1c')]],{'showHidden':![],'depth':null}));this[_0xa0d1('0x19')]('voice:outbound',_0xa0d1('0x3a'),this[_0xa0d1('0xa')][_0x567f3f[_0xa0d1('0x1c')]]);}}}}catch(_0x55ac27){logger[_0xa0d1('0x2f')]('[%s][voiceDialReport][varset]',_0x567f3f['uniqueid'],util[_0xa0d1('0x1d')](_0x55ac27,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x1fc666,_0x4f6c2b,_0x1b0ab8){var _0x5f10ac=['rtpaudioqos',_0xa0d1('0x44'),_0xa0d1('0x45'),_0xa0d1('0x46'),_0xa0d1('0x47'),_0xa0d1('0x48'),_0xa0d1('0x49'),_0xa0d1('0x4a'),_0xa0d1('0x4b'),'sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic',_0xa0d1('0x4c'),_0xa0d1('0x4d'),_0xa0d1('0x29'),_0xa0d1('0x4e'),_0xa0d1('0x4f')];if(!_[_0xa0d1('0x50')](_0x4f6c2b)&&!_[_0xa0d1('0x51')](_0x5f10ac,_0x4f6c2b)){if(_[_0xa0d1('0x52')](this[_0xa0d1('0x42')][_0x1fc666])){this[_0xa0d1('0x42')][_0x1fc666]={};}this[_0xa0d1('0x42')][_0x1fc666][_0x4f6c2b]=_0x1b0ab8;}};VoiceDialReport[_0xa0d1('0x18')]['syncHangup']=function(_0x5f36aa){try{if(this[_0xa0d1('0x17')](_0x5f36aa)){logger[_0xa0d1('0x1a')](_0xa0d1('0x53'),_0x5f36aa[_0xa0d1('0x1c')],util['inspect'](_0x5f36aa,{'showHidden':![],'depth':null}));if(this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]]){logger[_0xa0d1('0x27')](_0xa0d1('0x54'),_0x5f36aa[_0xa0d1('0x1c')],_0x5f36aa[_0xa0d1('0x55')]);this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]][_0xa0d1('0x56')]=moment()[_0xa0d1('0x1f')](_0xa0d1('0x20'));this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]][_0xa0d1('0x57')]=moment(this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]]['endtime'])[_0xa0d1('0x58')](this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]][_0xa0d1('0x59')],'seconds');this['channels'][_0x5f36aa[_0xa0d1('0x1c')]]['lastevent']=_0xa0d1('0x5a');this[_0xa0d1('0xc')][_0xa0d1('0x5b')]+=0x1;if(this['channels'][_0x5f36aa['uniqueid']][_0xa0d1('0x35')]){this['outbound']['answered']+=0x1;this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]][_0xa0d1('0x5c')]=moment(this['channels'][_0x5f36aa[_0xa0d1('0x1c')]][_0xa0d1('0x35')])[_0xa0d1('0x58')](this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]][_0xa0d1('0x59')],_0xa0d1('0x5d'));this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]][_0xa0d1('0x5e')]=moment(this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]]['endtime'])[_0xa0d1('0x58')](this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]][_0xa0d1('0x35')],_0xa0d1('0x5d'));this[_0xa0d1('0xc')]['sumHoldTime']+=this[_0xa0d1('0xa')][_0x5f36aa['uniqueid']][_0xa0d1('0x5c')]||0x0;this['outbound'][_0xa0d1('0x5f')]+=this['channels'][_0x5f36aa[_0xa0d1('0x1c')]][_0xa0d1('0x5e')];}this[_0xa0d1('0xc')]['sumDuration']+=this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]]['duration'];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x5f36aa['uniqueid'],util[_0xa0d1('0x1d')](this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xa0d1('0x19')](_0xa0d1('0x60'),this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]]);logger['debug'](_0xa0d1('0x61'),_0x5f36aa[_0xa0d1('0x1c')],util[_0xa0d1('0x1d')](this['channels'][_0x5f36aa[_0xa0d1('0x1c')]],{'showHidden':![],'depth':null}));ami['emit'](_0xa0d1('0x62'),this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x5f36aa[_0xa0d1('0x1c')],util[_0xa0d1('0x1d')](this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]],{'showHidden':![],'depth':null}));this[_0xa0d1('0x19')](_0xa0d1('0x2c'),_0xa0d1('0x63'),this[_0xa0d1('0xc')]);logger[_0xa0d1('0x27')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0xa0d1('0x64')](this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]]));logger[_0xa0d1('0x1a')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x5f36aa[_0xa0d1('0x1c')],util['inspect'](this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]],{'showHidden':![],'depth':null}));this[_0xa0d1('0x19')](_0xa0d1('0x2c'),'voice_outbound_channel:remove',this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]]);delete this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x1c')]];}else if(this[_0xa0d1('0xa')][_0x5f36aa[_0xa0d1('0x65')]]){this['channels'][_0x5f36aa['linkedid']]['uniqueid']=this['channels'][_0x5f36aa[_0xa0d1('0x65')]][_0xa0d1('0x66')];}if(this[_0xa0d1('0x42')][_0x5f36aa[_0xa0d1('0x1c')]]){delete this['variables'][_0x5f36aa[_0xa0d1('0x1c')]];}}}catch(_0x57c2f2){logger['error'](_0xa0d1('0x67'),_0x5f36aa[_0xa0d1('0x1c')],util[_0xa0d1('0x1d')](_0x57c2f2,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xa0d1('0x15')]=function(_0x2b5be8){try{if(this[_0xa0d1('0x17')](_0x2b5be8)){logger[_0xa0d1('0x1a')](_0xa0d1('0x68'),_0x2b5be8[_0xa0d1('0x1c')],util[_0xa0d1('0x1d')](_0x2b5be8,{'showHidden':![],'depth':null}));if(_0x2b5be8[_0xa0d1('0x69')][_0xa0d1('0x6a')]()===_0xa0d1('0x6b')){_0x2b5be8[_0xa0d1('0x6c')]=(_0x2b5be8[_0xa0d1('0x6d')]||_0x2b5be8['applicationdata'])['toLowerCase']();if(_[_0xa0d1('0x6e')](_0x2b5be8['applicationdata'],_0xa0d1('0x6f'))){if(_[_0xa0d1('0x52')](this[_0xa0d1('0xd')][_0x2b5be8[_0xa0d1('0x1c')]]))this[_0xa0d1('0xd')][_0x2b5be8[_0xa0d1('0x1c')]]={};logger['info'](_0xa0d1('0x70'),_0x2b5be8[_0xa0d1('0x1c')],_0x2b5be8['application'],_0x2b5be8[_0xa0d1('0x6c')]);var _0x54ae22=_0x2b5be8['applicationdata'][_0xa0d1('0x71')]('=');var _0x570c7f=_0x54ae22[0x0][_0xa0d1('0x72')](/cdr\((.*)\)/);if(_0x570c7f)this[_0xa0d1('0xd')][_0x2b5be8[_0xa0d1('0x1c')]][_0x570c7f[0x1]]=_0x54ae22[0x1];}}}}catch(_0xdb2225){logger[_0xa0d1('0x2f')](_0xa0d1('0x73'),_0x2b5be8[_0xa0d1('0x1c')],util[_0xa0d1('0x1d')](_0xdb2225,{'showHidden':![],'depth':null}));}};module[_0xa0d1('0x74')]=VoiceDialReport; \ No newline at end of file +var _0x3e58=['connect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','YYYY-MM-DD\x20HH:mm:ss','duration','seconds','complete','answered','holdtime','starttime','billableseconds','diff','sumHoldTime','sumBillable','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','voice_outbound:save','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','newexten','syncNewExten','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','inspect','uniqueid','merge','format','called','substring','lastIndexOf','channel','omit','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x3e58,0x1a0));var _0x83e5=function(_0x3778d8,_0x5ce417){_0x3778d8=_0x3778d8-0x0;var _0x45a1b3=_0x3e58[_0x3778d8];return _0x45a1b3;};'use strict';var _=require('lodash');var moment=require(_0x83e5('0x0'));var util=require(_0x83e5('0x1'));var Redis=require(_0x83e5('0x2'));var config=require(_0x83e5('0x3'));var logger=require(_0x83e5('0x4'))(_0x83e5('0x5'));var ami=require('../ami');config[_0x83e5('0x6')]=_[_0x83e5('0x7')](config[_0x83e5('0x6')],{'host':_0x83e5('0x8'),'port':0x18eb});var io=require(_0x83e5('0x9'))(new Redis(config[_0x83e5('0x6')]));function VoiceDialReport(_0x47eb54){this[_0x83e5('0xa')]=_0x47eb54[_0x83e5('0xb')];this['outbound']=_0x47eb54[_0x83e5('0xc')];this[_0x83e5('0xd')]={};this[_0x83e5('0xe')]={};ami['on']('dialbegin',this[_0x83e5('0xf')][_0x83e5('0x10')](this));ami['on']('dialend',this[_0x83e5('0x11')]['bind'](this));ami['on'](_0x83e5('0x12'),this[_0x83e5('0x13')][_0x83e5('0x10')](this));ami['on'](_0x83e5('0x14'),this[_0x83e5('0x15')]['bind'](this));ami['on'](_0x83e5('0x16'),this[_0x83e5('0x17')][_0x83e5('0x10')](this));}VoiceDialReport[_0x83e5('0x18')][_0x83e5('0x19')]=function(_0xe7dd7){return _0xe7dd7!==null&&!_[_0x83e5('0x1a')](_0xe7dd7);};VoiceDialReport[_0x83e5('0x18')]['emit']=function(_0x2879aa,_0x37deed,_0x3d2ae6){io['to'](_0x2879aa)[_0x83e5('0x1b')](_0x37deed,_0x3d2ae6);};VoiceDialReport['prototype'][_0x83e5('0xf')]=function(_0x3ae14e){try{if(this[_0x83e5('0x19')](_0x3ae14e)){logger[_0x83e5('0x1c')](_0x83e5('0x1d'),_0x3ae14e['uniqueid'],util[_0x83e5('0x1e')](_0x3ae14e,{'showHidden':![],'depth':null}));if(this[_0x83e5('0xa')][_0x3ae14e[_0x83e5('0x1f')]]){_[_0x83e5('0x20')](this[_0x83e5('0xa')][_0x3ae14e[_0x83e5('0x1f')]],{'starttime':moment()[_0x83e5('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x83e5('0x22'),'interface':_0x3ae14e['channel'][_0x83e5('0x23')](0x0,_0x3ae14e['channel'][_0x83e5('0x24')]('-')),'membername':_0x3ae14e[_0x83e5('0x25')][_0x83e5('0x23')](_0x3ae14e[_0x83e5('0x25')][_0x83e5('0x24')]('/')+0x1,_0x3ae14e['channel'][_0x83e5('0x24')]('-'))},_[_0x83e5('0x26')](_0x3ae14e,['event',_0x83e5('0x27')]));logger[_0x83e5('0x28')](_0x83e5('0x29'),_0x3ae14e[_0x83e5('0x1f')],this[_0x83e5('0xa')][_0x3ae14e['uniqueid']][_0x83e5('0x2a')],this['channels'][_0x3ae14e[_0x83e5('0x1f')]][_0x83e5('0x2b')]);logger[_0x83e5('0x1c')](_0x83e5('0x2c'),_0x3ae14e[_0x83e5('0x1f')],util['inspect'](this[_0x83e5('0xa')][_0x3ae14e[_0x83e5('0x1f')]],{'showHidden':![],'depth':null}));if(this[_0x83e5('0xd')][_0x3ae14e[_0x83e5('0x1f')]])_[_0x83e5('0x20')](this[_0x83e5('0xa')][_0x3ae14e['uniqueid']],this[_0x83e5('0xd')][_0x3ae14e['uniqueid']]);this[_0x83e5('0x1b')](_0x83e5('0x2d'),_0x83e5('0x2e'),this['channels'][_0x3ae14e[_0x83e5('0x1f')]]);logger['debug'](_0x83e5('0x2f'),_0x3ae14e['uniqueid'],util[_0x83e5('0x1e')](this[_0x83e5('0xa')][_0x3ae14e[_0x83e5('0x1f')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialbegin',this[_0x83e5('0xa')][_0x3ae14e[_0x83e5('0x1f')]]);}}}catch(_0x37b865){logger[_0x83e5('0x30')](_0x83e5('0x31'),_0x3ae14e[_0x83e5('0x1f')],util[_0x83e5('0x1e')](_0x37b865,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x83e5('0x11')]=function(_0x545142){try{if(this[_0x83e5('0x19')](_0x545142)){logger['debug']('[%s][voiceDialReport][dialend]\x20event:',_0x545142['uniqueid'],util[_0x83e5('0x1e')](_0x545142,{'showHidden':![],'depth':null}));if(this[_0x83e5('0xa')][_0x545142['uniqueid']]){this['channels'][_0x545142[_0x83e5('0x1f')]]['dialstatus']=_0x545142[_0x83e5('0x32')];if(_0x545142[_0x83e5('0x32')]===_0x83e5('0x33')){this[_0x83e5('0xa')][_0x545142[_0x83e5('0x1f')]][_0x83e5('0x34')]=_0x545142[_0x83e5('0x34')];this[_0x83e5('0xa')][_0x545142[_0x83e5('0x1f')]][_0x83e5('0x35')]=_0x545142[_0x83e5('0x35')];this[_0x83e5('0xa')][_0x545142[_0x83e5('0x1f')]][_0x83e5('0x36')]=moment()[_0x83e5('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x545142[_0x83e5('0x1f')]][_0x83e5('0x37')]=_0x83e5('0x38');logger[_0x83e5('0x28')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x545142['uniqueid'],_0x545142[_0x83e5('0x25')][_0x83e5('0x23')](_0x545142['channel'][_0x83e5('0x24')]('/')+0x1,_0x545142[_0x83e5('0x25')]['lastIndexOf']('-')));logger[_0x83e5('0x1c')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x545142[_0x83e5('0x1f')],util['inspect'](this['channels'][_0x545142[_0x83e5('0x1f')]],{'showHidden':![],'depth':null}));ami[_0x83e5('0x1b')]('custom:dialconnect',this[_0x83e5('0xa')][_0x545142[_0x83e5('0x1f')]]);}logger[_0x83e5('0x1c')](_0x83e5('0x39'),_0x545142['uniqueid'],util[_0x83e5('0x1e')](this[_0x83e5('0xa')][_0x545142[_0x83e5('0x1f')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x83e5('0x2e'),this[_0x83e5('0xa')][_0x545142['uniqueid']]);}}}catch(_0x144add){logger[_0x83e5('0x30')]('[%s][voiceDialReport][dialend]',_0x545142[_0x83e5('0x1f')],util['inspect'](_0x144add,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x83e5('0x13')]=function(_0x5328b0){try{if(this['isNotNull'](_0x5328b0)){logger['debug'](_0x83e5('0x3a'),_0x5328b0[_0x83e5('0x1f')],util['inspect'](_0x5328b0,{'showHidden':![],'depth':null}));this[_0x83e5('0x3b')](_0x5328b0[_0x83e5('0x1f')],_[_0x83e5('0x3c')](_0x5328b0[_0x83e5('0x3d')])[0x0],_0x5328b0[_0x83e5('0x3e')]);if(this['isNotNull'](_0x5328b0['variable'])&&this['isNotNull'](_0x5328b0[_0x83e5('0x3d')][_0x83e5('0x3f')])){if(_[_0x83e5('0x1a')](this['channels'][_0x5328b0[_0x83e5('0x1f')]])){this[_0x83e5('0xa')][_0x5328b0['uniqueid']]={'routeId':_0x5328b0[_0x83e5('0x3e')],'variables':this[_0x83e5('0xe')][_0x5328b0[_0x83e5('0x1f')]],'motionChannel':_0x83e5('0x40')};logger[_0x83e5('0x28')](_0x83e5('0x41'),_0x5328b0[_0x83e5('0x1f')],_0x5328b0[_0x83e5('0x3d')][_0x83e5('0x3f')],_['keys'](_0x5328b0[_0x83e5('0x3d')])[0x0],_0x5328b0[_0x83e5('0x3e')]);logger[_0x83e5('0x1c')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x5328b0[_0x83e5('0x1f')],util[_0x83e5('0x1e')](this['channels'][_0x5328b0[_0x83e5('0x1f')]],{'showHidden':![],'depth':null}));this[_0x83e5('0x1b')](_0x83e5('0x2d'),_0x83e5('0x2e'),this[_0x83e5('0xa')][_0x5328b0['uniqueid']]);}}}}catch(_0x30db94){logger['error']('[%s][voiceDialReport][varset]',_0x5328b0[_0x83e5('0x1f')],util['inspect'](_0x30db94,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x83e5('0x18')][_0x83e5('0x3b')]=function(_0x12e419,_0x30f7ee,_0x339ff4){var _0xef5d15=['rtpaudioqos',_0x83e5('0x42'),_0x83e5('0x43'),_0x83e5('0x44'),'rtpaudioqosloss',_0x83e5('0x45'),_0x83e5('0x46'),_0x83e5('0x47'),_0x83e5('0x48'),_0x83e5('0x49'),'bridgepeer',_0x83e5('0x4a'),_0x83e5('0x4b'),_0x83e5('0x4c'),_0x83e5('0x4d'),_0x83e5('0x4e'),_0x83e5('0x2a'),_0x83e5('0x4f'),_0x83e5('0x50')];if(!_['isNil'](_0x30f7ee)&&!_['includes'](_0xef5d15,_0x30f7ee)){if(_['isUndefined'](this[_0x83e5('0xe')][_0x12e419])){this[_0x83e5('0xe')][_0x12e419]={};}this[_0x83e5('0xe')][_0x12e419][_0x30f7ee]=_0x339ff4;}};VoiceDialReport['prototype'][_0x83e5('0x17')]=function(_0x9271a1){try{if(this[_0x83e5('0x19')](_0x9271a1)){logger[_0x83e5('0x1c')](_0x83e5('0x51'),_0x9271a1[_0x83e5('0x1f')],util['inspect'](_0x9271a1,{'showHidden':![],'depth':null}));if(this[_0x83e5('0xa')][_0x9271a1['uniqueid']]){logger[_0x83e5('0x28')](_0x83e5('0x52'),_0x9271a1['uniqueid'],_0x9271a1[_0x83e5('0x53')]);this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x54')]=moment()[_0x83e5('0x21')](_0x83e5('0x55'));this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x56')]=moment(this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x54')])['diff'](this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]]['starttime'],_0x83e5('0x57'));this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]]['lastevent']=_0x83e5('0x58');this[_0x83e5('0xc')]['total']+=0x1;if(this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x36')]){this['outbound'][_0x83e5('0x59')]+=0x1;this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x5a')]=moment(this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]]['answertime'])['diff'](this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x5b')],'seconds');this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x5c')]=moment(this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x54')])[_0x83e5('0x5d')](this[_0x83e5('0xa')][_0x9271a1['uniqueid']][_0x83e5('0x36')],_0x83e5('0x57'));this[_0x83e5('0xc')][_0x83e5('0x5e')]+=this[_0x83e5('0xa')][_0x9271a1['uniqueid']][_0x83e5('0x5a')]||0x0;this[_0x83e5('0xc')][_0x83e5('0x5f')]+=this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x5c')];}this[_0x83e5('0xc')]['sumDuration']+=this[_0x83e5('0xa')][_0x9271a1['uniqueid']][_0x83e5('0x56')];logger[_0x83e5('0x1c')](_0x83e5('0x60'),_0x9271a1[_0x83e5('0x1f')],util[_0x83e5('0x1e')](this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]],{'showHidden':![],'depth':null}));ami[_0x83e5('0x1b')](_0x83e5('0x61'),this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]]);logger[_0x83e5('0x1c')](_0x83e5('0x62'),_0x9271a1[_0x83e5('0x1f')],util['inspect'](this[_0x83e5('0xa')][_0x9271a1['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x83e5('0x1b')]('custom:dialend',this[_0x83e5('0xa')][_0x9271a1['uniqueid']]);logger[_0x83e5('0x1c')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x9271a1[_0x83e5('0x1f')],util[_0x83e5('0x1e')](this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x83e5('0x63'),this['outbound']);logger[_0x83e5('0x28')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x83e5('0x64')](this['channels'][_0x9271a1['uniqueid']]));logger[_0x83e5('0x1c')](_0x83e5('0x65'),_0x9271a1[_0x83e5('0x1f')],util['inspect'](this['channels'][_0x9271a1[_0x83e5('0x1f')]],{'showHidden':![],'depth':null}));this[_0x83e5('0x1b')](_0x83e5('0x2d'),_0x83e5('0x66'),this['channels'][_0x9271a1['uniqueid']]);delete this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]];}else if(this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x67')]]){this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x67')]]['uniqueid']=this['channels'][_0x9271a1[_0x83e5('0x67')]][_0x83e5('0x68')];}if(this[_0x83e5('0xe')][_0x9271a1[_0x83e5('0x1f')]]){delete this[_0x83e5('0xe')][_0x9271a1[_0x83e5('0x1f')]];}}}catch(_0x2082e8){logger[_0x83e5('0x30')](_0x83e5('0x69'),_0x9271a1[_0x83e5('0x1f')],util['inspect'](_0x2082e8,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncNewExten']=function(_0x56f950){try{if(this[_0x83e5('0x19')](_0x56f950)){logger['debug'](_0x83e5('0x6a'),_0x56f950[_0x83e5('0x1f')],util[_0x83e5('0x1e')](_0x56f950,{'showHidden':![],'depth':null}));if(_0x56f950[_0x83e5('0x6b')][_0x83e5('0x6c')]()===_0x83e5('0x6d')){_0x56f950[_0x83e5('0x6e')]=(_0x56f950[_0x83e5('0x6f')]||_0x56f950[_0x83e5('0x6e')])[_0x83e5('0x6c')]();if(_[_0x83e5('0x70')](_0x56f950['applicationdata'],'cdr(')){if(_[_0x83e5('0x1a')](this[_0x83e5('0xd')][_0x56f950[_0x83e5('0x1f')]]))this[_0x83e5('0xd')][_0x56f950['uniqueid']]={};logger[_0x83e5('0x28')](_0x83e5('0x71'),_0x56f950[_0x83e5('0x1f')],_0x56f950[_0x83e5('0x6b')],_0x56f950[_0x83e5('0x6e')]);var _0x180827=_0x56f950[_0x83e5('0x6e')][_0x83e5('0x72')]('=');var _0x30a0e4=_0x180827[0x0][_0x83e5('0x73')](/cdr\((.*)\)/);if(_0x30a0e4)this['applications'][_0x56f950['uniqueid']][_0x30a0e4[0x1]]=_0x180827[0x1];}}}}catch(_0x408e64){logger['error'](_0x83e5('0x74'),_0x56f950[_0x83e5('0x1f')],util[_0x83e5('0x1e')](_0x408e64,{'showHidden':![],'depth':null}));}};module[_0x83e5('0x75')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 77fa737..f65aeed 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 _0x3750=['pTalking','waiting','queueStatusComplete','isNil','status','channel','catch','[%s][voiceQueueReport][checkChannel]','inspect','error','variables','[%s][voiceQueueReport][checkVariables]','syncFullyBooted','[FullyBooted]\x20clear\x20realtime','clearQueueReport','clearqueuereport','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','voice_queue_channel:save','voice_queue_presence:save','emitVoiceQueueChannelRemove','debug','name','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','strategy','available','sumBillable','sumHoldTime','total','type','unmanaged','Trunk','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','loopQueueShow','queues','[voiceQueueReport][queues]','Action','then','syncQueueSummary','[voiceQueueReport][queuesummary]\x20event:','queue','[voiceQueueReport][queuesummary]\x20name:%s','callers','toNumber','loggedIn','loggedin','custom:queuesummary','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummarycomplete]\x20event:','inbound','queuecallerjoinAt','position','count','routealias','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','[%s][voiceQueueReport][queuecallerjoin]','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','lastAssignedTo','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','syncAgentComplete','assigned','membername','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','toLowerCase','local/','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','linkedid','COMPLETEDBY','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','agentcomplete','[%s][voiceQueueReport][agentcomplete]','[%s][voiceQueueReport][varset]','addVariable','variable','value','queuestatus','CONTINUE','TIMEOUT','lastevent','queuecallerexit','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceQueueReport][hangup]','length','diff','sumDuration','milliseconds','seconds','answered','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','switch','[%s][voiceQueueReport][attendedtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','syncMusicOnHoldStop','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','exports','lodash','moment','util','md5','ioredis','../../../config/logger','ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','queuesummary','bind','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentconnect','varset','syncVarSet','syncHangup','newexten','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','talking'];(function(_0x3d1eea,_0x49a0cf){var _0x2eeb2d=function(_0x13d030){while(--_0x13d030){_0x3d1eea['push'](_0x3d1eea['shift']());}};_0x2eeb2d(++_0x49a0cf);}(_0x3750,0xbb));var _0x0375=function(_0x2860ab,_0x27440f){_0x2860ab=_0x2860ab-0x0;var _0x3037c4=_0x3750[_0x2860ab];return _0x3037c4;};'use strict';var _=require(_0x0375('0x0'));var moment=require(_0x0375('0x1'));var util=require(_0x0375('0x2'));var md5=require(_0x0375('0x3'));var Redis=require(_0x0375('0x4'));var config=require('../../../config/environment');var logger=require(_0x0375('0x5'))(_0x0375('0x6'));var ami=require('../ami');var QueueReport=require(_0x0375('0x7'));config[_0x0375('0x8')]=_[_0x0375('0x9')](config[_0x0375('0x8')],{'host':_0x0375('0xa'),'port':0x18eb});var io=require(_0x0375('0xb'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x0375('0xc')][_0x0375('0xd')]=function(_0x698f18){this[_0x0375('0xe')]=this[_0x0375('0xe')]?this[_0x0375('0xe')]['finally'](_0x698f18):_0x698f18();};function VoiceQueueReport(_0x7d6563){this[_0x0375('0xf')]=new Sequence();this[_0x0375('0x10')]={};this[_0x0375('0x11')]=_0x7d6563[_0x0375('0x11')];this[_0x0375('0x12')]=_0x7d6563[_0x0375('0x13')];this[_0x0375('0x14')]=_0x7d6563[_0x0375('0x14')];this[_0x0375('0x15')]=!![];this[_0x0375('0x16')]=_0x7d6563[_0x0375('0x16')];this['variables']={};ami['on'](_0x0375('0x17'),this['syncQueueSummary'][_0x0375('0x18')](this));ami['on']('queuesummarycomplete',this[_0x0375('0x19')]['bind'](this));ami['on'](_0x0375('0x1a'),this[_0x0375('0x1b')][_0x0375('0x18')](this));ami['on'](_0x0375('0x1c'),this[_0x0375('0x1d')][_0x0375('0x18')](this));ami['on'](_0x0375('0x1e'),this[_0x0375('0x1f')][_0x0375('0x18')](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on'](_0x0375('0x20'),this['syncAgentConnect']['bind'](this));ami['on'](_0x0375('0x21'),this[_0x0375('0x22')][_0x0375('0x18')](this));ami['on']('hangup',this[_0x0375('0x23')][_0x0375('0x18')](this));ami['on']('fullybooted',this['syncFullyBooted']['bind'](this));ami['on'](_0x0375('0x24'),this['syncNewExten'][_0x0375('0x18')](this));ami['on'](_0x0375('0x25'),this[_0x0375('0x26')][_0x0375('0x18')](this));ami['on'](_0x0375('0x27'),this['syncMusicOnHoldStop'][_0x0375('0x18')](this));ami['on'](_0x0375('0x28'),this[_0x0375('0x29')]['bind'](this));ami['on'](_0x0375('0x2a'),this[_0x0375('0x2b')][_0x0375('0x18')](this));this[_0x0375('0x2c')]();this['loopQueueShow']();}function clearChannels(_0x25127c){if(!_[_0x0375('0x2d')](_0x25127c)){for(var _0x5b6880 in _0x25127c){if(_0x25127c['hasOwnProperty'](_0x5b6880)){delete _0x25127c[_0x5b6880];}}}}function clearCampaigns(_0x5d34d2){if(!_['isEmpty'](_0x5d34d2)){for(var _0x248567 in _0x5d34d2){if(_0x5d34d2[_0x0375('0x2e')](_0x248567)){_0x5d34d2[_0x248567][_0x0375('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x527204){if(!_[_0x0375('0x2d')](_0x527204)){for(var _0x56b316 in _0x527204){if(_0x527204[_0x0375('0x2e')](_0x56b316)){_0x527204[_0x56b316][_0x0375('0x2f')]=0x0;_0x527204[_0x56b316][_0x0375('0x30')]=0x0;_0x527204[_0x56b316][_0x0375('0x31')]=0x0;_0x527204[_0x56b316][_0x0375('0x32')]=0x0;_0x527204[_0x56b316][_0x0375('0x33')]=!![];}}}}function clearAgentBooked(_0x2716ad){if(!_['isEmpty'](_0x2716ad)){for(var _0x1871b9 in _0x2716ad){if(_0x2716ad[_0x0375('0x2e')](_0x1871b9)){_0x2716ad[_0x1871b9]['unlockRR']=!![];}}}}VoiceQueueReport[_0x0375('0xc')]['clearZombieChannels']=function(){var _0x2ddeb6=this;for(var _0x129416 in this['channels']){if(this[_0x0375('0x12')][_0x0375('0x2e')](_0x129416)&&!this['channels'][_0x129416]['switch']){this[_0x0375('0xf')][_0x0375('0xd')](function(){if(!_[_0x0375('0x34')](_0x2ddeb6['channels'][_0x129416])){return ami['Action']({'action':_0x0375('0x35'),'channel':_0x2ddeb6[_0x0375('0x12')][_0x129416][_0x0375('0x36')]})[_0x0375('0x37')](function(_0x91dcd3){if(_0x91dcd3['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x2ddeb6['channels'][_0x129416]){delete _0x2ddeb6['channels'][_0x129416];logger['error'](_0x0375('0x38'),_0x129416,util[_0x0375('0x39')](_0x91dcd3,{'showHidden':![],'depth':null}));}if(_0x2ddeb6[_0x0375('0x10')][_0x129416]){delete _0x2ddeb6[_0x0375('0x10')][_0x129416];logger[_0x0375('0x3a')]('[%s][voiceQueueReport][checkQueueReport]',_0x129416,util[_0x0375('0x39')](_0x91dcd3,{'showHidden':![],'depth':null}));}if(_0x2ddeb6[_0x0375('0x3b')][_0x129416]){delete _0x2ddeb6['variables'][_0x129416];logger[_0x0375('0x3a')](_0x0375('0x3c'),_0x129416,util[_0x0375('0x39')](_0x91dcd3,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x0375('0xc')][_0x0375('0x3d')]=function(){logger[_0x0375('0x3a')](_0x0375('0x3e'));clearChannels(this[_0x0375('0x12')]);this['clearQueueReport'](this[_0x0375('0x10')]);clearAgentBooked(this[_0x0375('0x11')]);clearVoiceQueues(this[_0x0375('0x14')]);clearCampaigns(this[_0x0375('0x16')]);};VoiceQueueReport[_0x0375('0xc')][_0x0375('0x3f')]=function(_0x586e11){var _0x2536a0=this;if(!_['isEmpty'](_0x586e11)){for(var _0x5d0093 in _0x586e11){if(_0x586e11[_0x0375('0x2e')](_0x5d0093)){_0x2536a0['emitVoiceQueueChannelRemove'](_0x586e11[_0x5d0093],_0x0375('0x40'));delete _0x586e11[_0x5d0093];}}}};VoiceQueueReport['prototype'][_0x0375('0x41')]=function(_0xa7f67,_0x55b4ca,_0x49490b){io['to'](_0xa7f67)[_0x0375('0x41')](_0x55b4ca,_0x49490b);};VoiceQueueReport[_0x0375('0xc')][_0x0375('0x42')]=function(_0x963231,_0xc6a86c){logger['debug'](_0x0375('0x43')+_0xc6a86c+_0x0375('0x44'),_0x963231[_0x0375('0x45')],util[_0x0375('0x39')](_0x963231,{'showHidden':![],'depth':null}));this[_0x0375('0x41')](util[_0x0375('0x46')](_0x0375('0x47'),_0x963231['name']),_0x0375('0x48'),_0x963231);io[_0x0375('0x41')](_0x0375('0x49'),_0x963231);};VoiceQueueReport['prototype'][_0x0375('0x4a')]=function(_0x5844fd,_0x42dfc5){logger[_0x0375('0x4b')](_0x0375('0x43')+_0x42dfc5+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x5844fd[_0x0375('0x45')],util[_0x0375('0x39')](_0x5844fd,{'showHidden':![],'depth':null}));this[_0x0375('0x41')](util['format'](_0x0375('0x47'),_0x5844fd[_0x0375('0x4c')]),_0x0375('0x4d'),_0x5844fd);io['emit'](_0x0375('0x4e'),_0x5844fd);};VoiceQueueReport['prototype'][_0x0375('0x4f')]=function(_0x1793a3,_0x4bc102){if(_0x1793a3['type']==='inbound'){var _0x89c8b1={'id':_0x1793a3['id'],'name':_0x1793a3[_0x0375('0x4c')],'strategy':_0x1793a3[_0x0375('0x50')],'answered':_0x1793a3['answered'],'available':_0x1793a3[_0x0375('0x51')],'loggedIn':_0x1793a3['loggedIn'],'pTalking':_0x1793a3['pTalking'],'sumBillable':_0x1793a3[_0x0375('0x52')],'sumDuration':_0x1793a3['sumDuration'],'sumHoldTime':_0x1793a3[_0x0375('0x53')]||0x0,'talking':_0x1793a3[_0x0375('0x30')],'total':_0x1793a3[_0x0375('0x54')],'type':_0x1793a3[_0x0375('0x55')],'unmanaged':_0x1793a3[_0x0375('0x56')],'abandoned':_0x1793a3['abandoned'],'waiting':_0x1793a3[_0x0375('0x32')]};if(_0x1793a3[_0x0375('0x57')]){_0x89c8b1[_0x0375('0x57')]={'id':_0x1793a3['Trunk']['id'],'name':_0x1793a3[_0x0375('0x57')][_0x0375('0x4c')],'active':_0x1793a3[_0x0375('0x57')]['active'],'callerid':_0x1793a3['Trunk'][_0x0375('0x58')]};}if(_0x1793a3[_0x0375('0x59')]){_0x89c8b1[_0x0375('0x59')]={'id':_0x1793a3[_0x0375('0x59')]['id'],'name':_0x1793a3[_0x0375('0x59')][_0x0375('0x4c')]};}var _0x436ea7=md5(JSON[_0x0375('0x5a')](_0x89c8b1));if(_0x1793a3[_0x0375('0x3')]!==_0x436ea7){_0x1793a3['md5']=_0x436ea7;logger[_0x0375('0x4b')](_0x0375('0x5b')+_0x4bc102+_0x0375('0x5c'),util[_0x0375('0x39')](_0x89c8b1,{'showHidden':![],'depth':null}));this[_0x0375('0x41')](util[_0x0375('0x46')](_0x0375('0x47'),_0x89c8b1['name']),_0x0375('0x5d'),_0x89c8b1);}}};VoiceQueueReport['prototype'][_0x0375('0x5e')]=function(_0x287ca6){return _0x287ca6!==null&&!_[_0x0375('0x5f')](_0x287ca6);};VoiceQueueReport[_0x0375('0xc')][_0x0375('0x60')]=function(){var _0x229c83=this;setInterval(function(){_0x229c83['clearZombieChannels']();ami['Action']({'action':_0x0375('0x61')})[_0x0375('0x37')](function(_0x39f75c){logger[_0x0375('0x3a')](_0x0375('0x62'),util[_0x0375('0x39')](_0x39f75c,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x0375('0xc')]['loopQueueSummary']=function(){var _0x108e46=this;setInterval(function(){if(_0x108e46[_0x0375('0x15')]){return ami[_0x0375('0x63')]({'action':_0x0375('0x17')})[_0x0375('0x64')](function(_0x2084d0){_0x108e46[_0x0375('0x15')]=![];})[_0x0375('0x37')](function(_0x146d68){logger[_0x0375('0x3a')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x146d68,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x0375('0x65')]=function(_0xfbbd28){try{if(this[_0x0375('0x5e')](_0xfbbd28)&&this['isNotNull'](_0xfbbd28['queue'])){logger[_0x0375('0x4b')](_0x0375('0x66'),util[_0x0375('0x39')](_0xfbbd28,{'showHidden':![],'depth':null}));if(this[_0x0375('0x14')][_0xfbbd28[_0x0375('0x67')]]){logger['info'](_0x0375('0x68'),_0xfbbd28[_0x0375('0x67')]);var _0x49714e=_['countBy'](this['channels'],_0x0375('0x67'))[_0xfbbd28[_0x0375('0x67')]]||0x0;var _0x377551=_0x49714e-_0xfbbd28[_0x0375('0x69')];if(this[_0x0375('0x14')][_0xfbbd28['queue']][_0x0375('0x32')]!==_[_0x0375('0x6a')](_0xfbbd28['callers'])||this[_0x0375('0x14')][_0xfbbd28['queue']][_0x0375('0x6b')]!==_[_0x0375('0x6a')](_0xfbbd28[_0x0375('0x6c')])||this[_0x0375('0x14')][_0xfbbd28['queue']][_0x0375('0x51')]!==_[_0x0375('0x6a')](_0xfbbd28[_0x0375('0x51')])||this['voiceQueues'][_0xfbbd28[_0x0375('0x67')]]['talking']!==_0x377551){this[_0x0375('0x14')][_0xfbbd28[_0x0375('0x67')]][_0x0375('0x32')]=_[_0x0375('0x6a')](_0xfbbd28[_0x0375('0x69')]);this['voiceQueues'][_0xfbbd28['queue']][_0x0375('0x6b')]=_[_0x0375('0x6a')](_0xfbbd28[_0x0375('0x6c')]);this[_0x0375('0x14')][_0xfbbd28[_0x0375('0x67')]][_0x0375('0x51')]=_[_0x0375('0x6a')](_0xfbbd28['available']);this[_0x0375('0x14')][_0xfbbd28['queue']]['talking']=_0x377551>0x0?_0x377551:0x0;this[_0x0375('0x14')][_0xfbbd28[_0x0375('0x67')]][_0x0375('0x30')]=this['voiceQueues'][_0xfbbd28['queue']][_0x0375('0x30')]>_[_0x0375('0x6a')](_0xfbbd28[_0x0375('0x6c')])?_['toNumber'](_0xfbbd28[_0x0375('0x6c')]):this['voiceQueues'][_0xfbbd28[_0x0375('0x67')]][_0x0375('0x30')];this[_0x0375('0x4f')](this[_0x0375('0x14')][_0xfbbd28[_0x0375('0x67')]],'queuesummary');}logger[_0x0375('0x4b')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x0375('0x39')](this[_0x0375('0x14')][_0xfbbd28[_0x0375('0x67')]],{'showHidden':![],'depth':null}));ami[_0x0375('0x41')](_0x0375('0x6d'),this[_0x0375('0x14')][_0xfbbd28[_0x0375('0x67')]]);}}}catch(_0x2b66b4){logger[_0x0375('0x3a')](_0x0375('0x6e'),util[_0x0375('0x39')](_0x2b66b4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0375('0xc')]['syncQueueSummaryComplete']=function(_0x5116c6){logger[_0x0375('0x4b')](_0x0375('0x6f'),util[_0x0375('0x39')](_0x5116c6,{'showHidden':![],'depth':null}));this[_0x0375('0x15')]=!![];};VoiceQueueReport['prototype'][_0x0375('0x1b')]=function(_0x576d09){try{if(this[_0x0375('0x5e')](_0x576d09)){logger[_0x0375('0x4b')]('[%s][voiceQueueReport][queuecallerjoin]',_0x576d09[_0x0375('0x45')],util[_0x0375('0x39')](_0x576d09,{'showHidden':![],'depth':null}));if(_[_0x0375('0x5f')](this[_0x0375('0x10')][_0x576d09['uniqueid']]))this[_0x0375('0x10')][_0x576d09[_0x0375('0x45')]]=[];if(_[_0x0375('0x5f')](this[_0x0375('0x12')][_0x576d09[_0x0375('0x45')]]))this[_0x0375('0x12')][_0x576d09[_0x0375('0x45')]]={};var _0x203036=new QueueReport();_0x203036[_0x0375('0x4c')]=_0x576d09['queue'];_0x203036[_0x0375('0x55')]=this[_0x0375('0x14')][_0x203036[_0x0375('0x4c')]]&&this['voiceQueues'][_0x203036[_0x0375('0x4c')]][_0x0375('0x55')]?this[_0x0375('0x14')][_0x203036[_0x0375('0x4c')]]['type']||'inbound':_0x0375('0x70');_0x203036[_0x0375('0x67')]=_0x576d09[_0x0375('0x67')];_0x203036[_0x0375('0x71')]=moment()[_0x0375('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x203036[_0x0375('0x72')]=_0x576d09[_0x0375('0x72')];_0x203036[_0x0375('0x73')]=_0x576d09[_0x0375('0x73')];_0x203036[_0x0375('0x45')]=_0x576d09['uniqueid'];_0x203036[_0x0375('0x74')]=this[_0x0375('0x12')][_0x576d09[_0x0375('0x45')]]['routealias'];logger[_0x0375('0x75')](_0x0375('0x76'),_0x203036[_0x0375('0x4c')],_0x203036['type']);_[_0x0375('0x77')](_0x203036,_[_0x0375('0x78')](_0x576d09,_[_0x0375('0x79')](_0x203036)));this[_0x0375('0x10')][_0x576d09[_0x0375('0x45')]][_0x0375('0x7a')](_0x203036);this['channels'][_0x576d09[_0x0375('0x45')]]=_0x203036;this[_0x0375('0x42')](_0x203036,_0x0375('0x1a'));}}catch(_0x5989e6){logger[_0x0375('0x3a')](_0x0375('0x7b'),_0x576d09['uniqueid'],util[_0x0375('0x39')](_0x5989e6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0375('0xc')][_0x0375('0x1d')]=function(_0x41a905){try{if(this[_0x0375('0x5e')](_0x41a905)){logger[_0x0375('0x4b')](_0x0375('0x7c'),_0x41a905[_0x0375('0x45')],util[_0x0375('0x39')](_0x41a905,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x41a905[_0x0375('0x45')]]){var _0x4b4e0d=_[_0x0375('0x7d')](this[_0x0375('0x10')][_0x41a905['uniqueid']]);_0x4b4e0d[_0x0375('0x7e')]=![];_0x4b4e0d[_0x0375('0x7f')]=null;_0x4b4e0d[_0x0375('0x80')]=_0x41a905[_0x0375('0x80')];_0x4b4e0d[_0x0375('0x81')]=_0x41a905[_0x0375('0x81')];_0x4b4e0d['queuecallerabandon']=!![];_0x4b4e0d[_0x0375('0x82')]=moment()[_0x0375('0x46')](_0x0375('0x83'));_0x4b4e0d[_0x0375('0x84')]='ABANDONED';_0x4b4e0d[_0x0375('0x85')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x4b4e0d[_0x0375('0x4c')],_0x4b4e0d[_0x0375('0x55')]);this[_0x0375('0x12')][_0x41a905[_0x0375('0x45')]]=_0x4b4e0d;this[_0x0375('0x4a')](_0x4b4e0d,_0x0375('0x1c'));}}}catch(_0x16de24){logger[_0x0375('0x3a')](_0x0375('0x7c'),_0x41a905[_0x0375('0x45')],util[_0x0375('0x39')](_0x16de24,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x4157d){try{if(this[_0x0375('0x5e')](_0x4157d)){logger['debug'](_0x0375('0x86'),_0x4157d[_0x0375('0x45')],util[_0x0375('0x39')](_0x4157d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4157d[_0x0375('0x45')]]){var _0x32b564=_['last'](this[_0x0375('0x10')][_0x4157d[_0x0375('0x45')]]);_0x32b564[_0x0375('0x87')]=moment()[_0x0375('0x46')](_0x0375('0x83'));_0x32b564['connectedlinenum']=_0x4157d[_0x0375('0x88')];_0x32b564[_0x0375('0x89')]=_0x4157d[_0x0375('0x89')];logger[_0x0375('0x75')](_0x0375('0x8a'),_0x32b564[_0x0375('0x4c')],_0x32b564[_0x0375('0x55')],_0x4157d[_0x0375('0x88')],_0x4157d[_0x0375('0x89')]);this[_0x0375('0x12')][_0x4157d['uniqueid']]=_0x32b564;this['emitVoiceQueueChannelSave'](_0x32b564,_0x0375('0x1e'));}}}catch(_0x245090){logger[_0x0375('0x3a')](_0x0375('0x86'),_0x4157d[_0x0375('0x45')],util[_0x0375('0x39')](_0x245090,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0375('0xc')]['syncAgentConnect']=function(_0x434494){try{if(this[_0x0375('0x5e')](_0x434494)){logger[_0x0375('0x4b')](_0x0375('0x8b'),_0x434494['uniqueid'],util[_0x0375('0x39')](_0x434494,{'showHidden':![],'depth':null}));if(this[_0x0375('0x10')][_0x434494[_0x0375('0x45')]]){var _0x31d2e7=_[_0x0375('0x7d')](this[_0x0375('0x10')][_0x434494[_0x0375('0x45')]]);_0x31d2e7[_0x0375('0x7e')]=!![];_0x31d2e7[_0x0375('0x84')]='COMPLETEDBYAGENT';logger[_0x0375('0x75')](_0x0375('0x8c'),_0x31d2e7['name'],_0x31d2e7[_0x0375('0x55')]);}}}catch(_0x6afd){logger['error'](_0x0375('0x8b'),_0x434494['uniqueid'],util[_0x0375('0x39')](_0x6afd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0375('0xc')][_0x0375('0x8d')]=function(_0x23b248){try{if(this['isNotNull'](_0x23b248)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x23b248[_0x0375('0x45')],util[_0x0375('0x39')](_0x23b248,{'showHidden':![],'depth':null}));if(this[_0x0375('0x10')][_0x23b248[_0x0375('0x45')]]){var _0x2bf1c7=_['last'](this[_0x0375('0x10')][_0x23b248['uniqueid']]);_0x2bf1c7[_0x0375('0x1c')]=![];_0x2bf1c7[_0x0375('0x82')]=null;_0x2bf1c7[_0x0375('0x8e')]=!![];_0x2bf1c7['lastAssignedTo']=_0x23b248[_0x0375('0x8f')];_0x2bf1c7[_0x0375('0x80')]=_0x23b248[_0x0375('0x80')];_0x2bf1c7[_0x0375('0x7e')]=!![];_0x2bf1c7['queuecallerexit']=![];_0x2bf1c7[_0x0375('0x90')]=null;if(!_0x2bf1c7[_0x0375('0x91')]){if(_0x23b248[_0x0375('0x92')]=='transfer'){_0x2bf1c7['queuecallerexitreason']=_0x0375('0x93');logger[_0x0375('0x75')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x2bf1c7[_0x0375('0x4c')],_0x2bf1c7[_0x0375('0x55')]);}else{if(_[_0x0375('0x94')](_0x23b248['channel'][_0x0375('0x95')](),_0x0375('0x96'))){if(this[_0x0375('0x10')][_0x23b248['linkedid']]){var _0x316e80=_[_0x0375('0x7d')](this[_0x0375('0x10')][_0x23b248['linkedid']]);_0x316e80['queuecallercomplete']=![];_0x316e80['queuecallerexit']=!![];_0x316e80[_0x0375('0x90')]=moment(_0x2bf1c7[_0x0375('0x71')])['add'](_0x23b248[_0x0375('0x80')],'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x316e80[_0x0375('0x84')]='FORWARDTRANSFER';_0x316e80[_0x0375('0x91')]=!![];_0x316e80[_0x0375('0x97')]=_0x0375('0x98');_0x316e80[_0x0375('0x99')]=_0x23b248[_0x0375('0x9a')];_0x316e80[_0x0375('0x9b')]=_0x23b248[_0x0375('0x45')];logger[_0x0375('0x75')](_0x0375('0x9c'),_0x316e80['name'],_0x316e80[_0x0375('0x55')]);var _0x1efaff=this[_0x0375('0x10')][_0x23b248[_0x0375('0x9d')]];this[_0x0375('0x10')][_0x23b248[_0x0375('0x9d')]]=this[_0x0375('0x10')][_0x23b248[_0x0375('0x45')]];this[_0x0375('0x10')][_0x23b248[_0x0375('0x45')]]=_0x1efaff;}}else{_0x2bf1c7[_0x0375('0x84')]=_0x0375('0x9e')+_0x23b248[_0x0375('0x92')]['toUpperCase']();logger[_0x0375('0x75')](_0x0375('0x9f'),_0x2bf1c7[_0x0375('0x4c')],_0x2bf1c7['type'],_0x2bf1c7[_0x0375('0x84')]);}}}this[_0x0375('0x12')][_0x23b248[_0x0375('0x45')]]=_0x2bf1c7;this[_0x0375('0x4a')](_0x2bf1c7,_0x0375('0xa0'));}}}catch(_0x374a48){logger['error'](_0x0375('0xa1'),_0x23b248[_0x0375('0x45')],util[_0x0375('0x39')](_0x374a48,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0375('0x22')]=function(_0x207e49){try{if(this[_0x0375('0x5e')](_0x207e49)){logger[_0x0375('0x4b')](_0x0375('0xa2'),_0x207e49[_0x0375('0x45')],util[_0x0375('0x39')](_0x207e49,{'showHidden':![],'depth':null}));this[_0x0375('0xa3')](_0x207e49['uniqueid'],_[_0x0375('0x79')](_0x207e49[_0x0375('0xa4')])[0x0],_0x207e49[_0x0375('0xa5')]);if(this[_0x0375('0x10')][_0x207e49[_0x0375('0x45')]]){var _0x4c112f=_[_0x0375('0x7d')](this['queueReports'][_0x207e49[_0x0375('0x45')]]);if(_0x4c112f){if(this['isNotNull'](_0x207e49['variable'])&&this[_0x0375('0x5e')](_0x207e49[_0x0375('0xa4')][_0x0375('0xa6')])){switch(_0x207e49[_0x0375('0xa5')]){case _0x0375('0xa7'):_0x4c112f['queuecallerexit']=![];_0x4c112f[_0x0375('0x90')]=null;break;case _0x0375('0xa8'):_0x4c112f[_0x0375('0xa9')]='timeout';_0x4c112f[_0x0375('0xaa')]=!![];_0x4c112f[_0x0375('0x90')]=moment()[_0x0375('0x46')](_0x0375('0x83'));_0x4c112f[_0x0375('0x87')]=moment()[_0x0375('0x46')](_0x0375('0x83'));logger[_0x0375('0x4b')](_0x0375('0xab'),_0x207e49['uniqueid'],util[_0x0375('0x39')](_0x4c112f,{'showHidden':![],'depth':null}));ami[_0x0375('0x41')]('custom:timeout',_0x4c112f);break;default:_0x4c112f['queuecallerexit']=!![];_0x4c112f[_0x0375('0x90')]=moment()[_0x0375('0x46')](_0x0375('0x83'));_0x4c112f[_0x0375('0x87')]=moment()[_0x0375('0x46')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4c112f[_0x0375('0x1c')]=![];_0x4c112f[_0x0375('0x82')]=null;_0x4c112f[_0x0375('0x84')]=_0x207e49['value'];this[_0x0375('0x12')][_0x207e49[_0x0375('0x45')]]=_0x4c112f;this[_0x0375('0x4a')](_0x4c112f,_0x0375('0x21'));}else if(this['isNotNull'](_0x207e49[_0x0375('0xa4')])&&this[_0x0375('0x5e')](_0x207e49[_0x0375('0xa4')]['queueposition'])){if(!_0x4c112f[_0x0375('0x1c')]){_0x4c112f[_0x0375('0xaa')]=!![];_0x4c112f[_0x0375('0x90')]=moment()[_0x0375('0x46')](_0x0375('0x83'));_0x4c112f['queuecallerexitreason']='EXITWITHKEY';_0x4c112f[_0x0375('0x87')]=moment()['format'](_0x0375('0x83'));this[_0x0375('0x12')][_0x207e49[_0x0375('0x45')]]=_0x4c112f;}}logger[_0x0375('0x75')](_0x0375('0xac'),_0x207e49[_0x0375('0x45')],_0x4c112f[_0x0375('0x4c')],_0x4c112f[_0x0375('0x55')],_[_0x0375('0x79')](_0x207e49[_0x0375('0xa4')])[0x0],_0x207e49[_0x0375('0xa5')]);_0x4c112f[_0x0375('0x3b')]=this[_0x0375('0x3b')][_0x207e49['uniqueid']];}}}}catch(_0x4c5cc5){logger[_0x0375('0x3a')](_0x0375('0xa2'),_0x207e49[_0x0375('0x45')],util[_0x0375('0x39')](_0x4c5cc5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0375('0xc')]['addVariable']=function(_0x110e5b,_0x2bc22c,_0x485d7c){var _0x170462=[_0x0375('0xad'),_0x0375('0xae'),_0x0375('0xaf'),_0x0375('0xb0'),'rtpaudioqosloss',_0x0375('0xb1'),_0x0375('0xb2'),_0x0375('0xb3'),_0x0375('0xb4'),'sipuri','bridgepeer',_0x0375('0xb5'),_0x0375('0xb6'),'memberdynamic',_0x0375('0xb7'),_0x0375('0xb8'),_0x0375('0x8f'),_0x0375('0xb9'),_0x0375('0xba')];if(!_[_0x0375('0x34')](_0x2bc22c)&&!_[_0x0375('0xbb')](_0x170462,_0x2bc22c)){if(_[_0x0375('0x5f')](this[_0x0375('0x3b')][_0x110e5b])){this[_0x0375('0x3b')][_0x110e5b]={};}this['variables'][_0x110e5b][_0x2bc22c]=_0x485d7c;}};VoiceQueueReport['prototype'][_0x0375('0x23')]=function(_0x2fd517){try{if(this[_0x0375('0x5e')](_0x2fd517)){logger[_0x0375('0x4b')](_0x0375('0xbc'),_0x2fd517[_0x0375('0x45')],util[_0x0375('0x39')](_0x2fd517,{'showHidden':![],'depth':null}));if(this[_0x0375('0x10')][_0x2fd517[_0x0375('0x45')]]){for(var _0x95c6ca=0x0,_0x1e6039={};_0x95c6ca0x0?_0x44cae9:0x0;this[_0xcffd('0x6c')][_0xc624b8[_0xcffd('0x6a')]][_0xcffd('0x32')]=this[_0xcffd('0x6c')][_0xc624b8[_0xcffd('0x6a')]][_0xcffd('0x32')]>_[_0xcffd('0x6f')](_0xc624b8[_0xcffd('0x71')])?_[_0xcffd('0x6f')](_0xc624b8[_0xcffd('0x71')]):this['voiceQueues'][_0xc624b8['queue']][_0xcffd('0x32')];this[_0xcffd('0x52')](this[_0xcffd('0x6c')][_0xc624b8[_0xcffd('0x6a')]],_0xcffd('0x15'));}logger['debug'](_0xcffd('0x73'),util['inspect'](this[_0xcffd('0x6c')][_0xc624b8[_0xcffd('0x6a')]],{'showHidden':![],'depth':null}));ami[_0xcffd('0x46')](_0xcffd('0x74'),this[_0xcffd('0x6c')][_0xc624b8[_0xcffd('0x6a')]]);}}}catch(_0x4228a2){logger[_0xcffd('0x3a')](_0xcffd('0x67'),util[_0xcffd('0x3e')](_0x4228a2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcffd('0xb')]['syncQueueSummaryComplete']=function(_0x11fe1f){logger[_0xcffd('0x47')](_0xcffd('0x75'),util[_0xcffd('0x3e')](_0x11fe1f,{'showHidden':![],'depth':null}));this[_0xcffd('0x13')]=!![];};VoiceQueueReport[_0xcffd('0xb')]['syncQueueCallerJoin']=function(_0x30bc18){try{if(this['isNotNull'](_0x30bc18)){logger['debug'](_0xcffd('0x76'),_0x30bc18[_0xcffd('0x50')],util[_0xcffd('0x3e')](_0x30bc18,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xcffd('0x3c')][_0x30bc18[_0xcffd('0x50')]]))this[_0xcffd('0x3c')][_0x30bc18['uniqueid']]=[];if(_[_0xcffd('0x77')](this[_0xcffd('0x11')][_0x30bc18[_0xcffd('0x50')]]))this[_0xcffd('0x11')][_0x30bc18[_0xcffd('0x50')]]={};var _0x27decd=new QueueReport();_0x27decd[_0xcffd('0x4c')]=_0x30bc18[_0xcffd('0x6a')];_0x27decd[_0xcffd('0x53')]=this[_0xcffd('0x6c')][_0x27decd[_0xcffd('0x4c')]]&&this[_0xcffd('0x6c')][_0x27decd[_0xcffd('0x4c')]][_0xcffd('0x53')]?this['voiceQueues'][_0x27decd[_0xcffd('0x4c')]][_0xcffd('0x53')]||_0xcffd('0x54'):'inbound';_0x27decd[_0xcffd('0x6a')]=_0x30bc18[_0xcffd('0x6a')];_0x27decd[_0xcffd('0x78')]=moment()[_0xcffd('0x4a')](_0xcffd('0x79'));_0x27decd['position']=_0x30bc18[_0xcffd('0x7a')];_0x27decd[_0xcffd('0x7b')]=_0x30bc18[_0xcffd('0x7b')];_0x27decd['uniqueid']=_0x30bc18[_0xcffd('0x50')];_0x27decd[_0xcffd('0x7c')]=this[_0xcffd('0x11')][_0x30bc18['uniqueid']][_0xcffd('0x7c')];logger[_0xcffd('0x7d')](_0xcffd('0x7e'),_0x27decd['name'],_0x27decd[_0xcffd('0x53')]);_['merge'](_0x27decd,_[_0xcffd('0x7f')](_0x30bc18,_[_0xcffd('0x80')](_0x27decd)));this['queueReports'][_0x30bc18[_0xcffd('0x50')]][_0xcffd('0x81')](_0x27decd);this[_0xcffd('0x11')][_0x30bc18[_0xcffd('0x50')]]=_0x27decd;this[_0xcffd('0x82')](_0x27decd,_0xcffd('0x18'));}}catch(_0x2b83d8){logger[_0xcffd('0x3a')](_0xcffd('0x76'),_0x30bc18[_0xcffd('0x50')],util[_0xcffd('0x3e')](_0x2b83d8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcffd('0xb')]['syncQueueCallerAbandon']=function(_0x462618){try{if(this[_0xcffd('0x69')](_0x462618)){logger[_0xcffd('0x47')](_0xcffd('0x83'),_0x462618[_0xcffd('0x50')],util[_0xcffd('0x3e')](_0x462618,{'showHidden':![],'depth':null}));if(this[_0xcffd('0x3c')][_0x462618[_0xcffd('0x50')]]){var _0x54151c=_['last'](this['queueReports'][_0x462618['uniqueid']]);_0x54151c[_0xcffd('0x84')]=![];_0x54151c[_0xcffd('0x85')]=null;_0x54151c['holdtime']=_0x462618['holdtime'];_0x54151c[_0xcffd('0x86')]=_0x462618[_0xcffd('0x86')];_0x54151c[_0xcffd('0x1b')]=!![];_0x54151c[_0xcffd('0x87')]=moment()[_0xcffd('0x4a')](_0xcffd('0x79'));_0x54151c['queuecallerexitreason']='ABANDONED';_0x54151c[_0xcffd('0x88')]=null;logger[_0xcffd('0x7d')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x54151c[_0xcffd('0x4c')],_0x54151c[_0xcffd('0x53')]);this['channels'][_0x462618[_0xcffd('0x50')]]=_0x54151c;this[_0xcffd('0x45')](_0x54151c,'queuecallerabandon');}}}catch(_0x2fd946){logger[_0xcffd('0x3a')](_0xcffd('0x83'),_0x462618[_0xcffd('0x50')],util['inspect'](_0x2fd946,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcffd('0xb')][_0xcffd('0x1d')]=function(_0x901e31){try{if(this[_0xcffd('0x69')](_0x901e31)){logger[_0xcffd('0x47')](_0xcffd('0x89'),_0x901e31['uniqueid'],util[_0xcffd('0x3e')](_0x901e31,{'showHidden':![],'depth':null}));if(this[_0xcffd('0x3c')][_0x901e31[_0xcffd('0x50')]]){var _0x511eb3=_[_0xcffd('0x8a')](this[_0xcffd('0x3c')][_0x901e31[_0xcffd('0x50')]]);_0x511eb3[_0xcffd('0x8b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x511eb3[_0xcffd('0x8c')]=_0x901e31[_0xcffd('0x8c')];_0x511eb3[_0xcffd('0x8d')]=_0x901e31['connectedlinename'];logger[_0xcffd('0x7d')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x511eb3['name'],_0x511eb3[_0xcffd('0x53')],_0x901e31[_0xcffd('0x8c')],_0x901e31[_0xcffd('0x8d')]);this['channels'][_0x901e31['uniqueid']]=_0x511eb3;this[_0xcffd('0x82')](_0x511eb3,_0xcffd('0x1c'));}}}catch(_0x34c684){logger[_0xcffd('0x3a')](_0xcffd('0x89'),_0x901e31['uniqueid'],util[_0xcffd('0x3e')](_0x34c684,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcffd('0xb')][_0xcffd('0x8e')]=function(_0x38f667){try{if(this[_0xcffd('0x69')](_0x38f667)){logger['debug'](_0xcffd('0x8f'),_0x38f667[_0xcffd('0x50')],util['inspect'](_0x38f667,{'showHidden':![],'depth':null}));if(this[_0xcffd('0x3c')][_0x38f667[_0xcffd('0x50')]]){var _0x1d81ea=_[_0xcffd('0x8a')](this[_0xcffd('0x3c')][_0x38f667[_0xcffd('0x50')]]);_0x1d81ea[_0xcffd('0x84')]=!![];_0x1d81ea[_0xcffd('0x90')]=_0xcffd('0x91');logger['info'](_0xcffd('0x92'),_0x1d81ea['name'],_0x1d81ea[_0xcffd('0x53')]);}}}catch(_0x4d73a1){logger[_0xcffd('0x3a')](_0xcffd('0x8f'),_0x38f667[_0xcffd('0x50')],util[_0xcffd('0x3e')](_0x4d73a1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcffd('0xb')][_0xcffd('0x1f')]=function(_0x4f8384){try{if(this[_0xcffd('0x69')](_0x4f8384)){logger['debug'](_0xcffd('0x93'),_0x4f8384[_0xcffd('0x50')],util[_0xcffd('0x3e')](_0x4f8384,{'showHidden':![],'depth':null}));if(this[_0xcffd('0x3c')][_0x4f8384[_0xcffd('0x50')]]){var _0x4b9145=_['last'](this[_0xcffd('0x3c')][_0x4f8384[_0xcffd('0x50')]]);_0x4b9145[_0xcffd('0x1b')]=![];_0x4b9145[_0xcffd('0x87')]=null;_0x4b9145[_0xcffd('0x94')]=!![];_0x4b9145[_0xcffd('0x88')]=_0x4f8384[_0xcffd('0x95')];_0x4b9145[_0xcffd('0x96')]=_0x4f8384[_0xcffd('0x96')];_0x4b9145[_0xcffd('0x84')]=!![];_0x4b9145[_0xcffd('0x97')]=![];_0x4b9145[_0xcffd('0x98')]=null;if(!_0x4b9145[_0xcffd('0x99')]){if(_0x4f8384[_0xcffd('0x9a')]==_0xcffd('0x99')){_0x4b9145[_0xcffd('0x90')]=_0xcffd('0x9b');logger[_0xcffd('0x7d')](_0xcffd('0x9c'),_0x4b9145['name'],_0x4b9145[_0xcffd('0x53')]);}else{if(_['startsWith'](_0x4f8384[_0xcffd('0x9d')][_0xcffd('0x9e')](),_0xcffd('0x9f'))){if(this[_0xcffd('0x3c')][_0x4f8384['linkedid']]){var _0x298646=_[_0xcffd('0x8a')](this['queueReports'][_0x4f8384[_0xcffd('0xa0')]]);_0x298646['queuecallercomplete']=![];_0x298646[_0xcffd('0x97')]=!![];_0x298646[_0xcffd('0x98')]=moment(_0x4b9145['queuecallerjoinAt'])['add'](_0x4f8384['holdtime'],_0xcffd('0xa1'))[_0xcffd('0x4a')](_0xcffd('0x79'));_0x298646[_0xcffd('0x90')]=_0xcffd('0xa2');_0x298646[_0xcffd('0x99')]=!![];_0x298646['transfertype']=_0xcffd('0xa3');_0x298646[_0xcffd('0xa4')]=_0x4f8384[_0xcffd('0xa5')];_0x298646[_0xcffd('0xa6')]=_0x4f8384[_0xcffd('0x50')];logger[_0xcffd('0x7d')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x298646[_0xcffd('0x4c')],_0x298646[_0xcffd('0x53')]);var _0x3e7552=this[_0xcffd('0x3c')][_0x4f8384[_0xcffd('0xa0')]];this[_0xcffd('0x3c')][_0x4f8384[_0xcffd('0xa0')]]=this['queueReports'][_0x4f8384[_0xcffd('0x50')]];this[_0xcffd('0x3c')][_0x4f8384[_0xcffd('0x50')]]=_0x3e7552;}}else{_0x4b9145['queuecallerexitreason']='COMPLETEDBY'+_0x4f8384[_0xcffd('0x9a')][_0xcffd('0xa7')]();logger[_0xcffd('0x7d')](_0xcffd('0xa8'),_0x4b9145['name'],_0x4b9145['type'],_0x4b9145[_0xcffd('0x90')]);}}}this['channels'][_0x4f8384[_0xcffd('0x50')]]=_0x4b9145;this[_0xcffd('0x45')](_0x4b9145,'agentcomplete');}}}catch(_0x47d1ef){logger[_0xcffd('0x3a')]('[%s][voiceQueueReport][agentcomplete]',_0x4f8384['uniqueid'],util[_0xcffd('0x3e')](_0x47d1ef,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xcffd('0x22')]=function(_0x237794){try{if(this['isNotNull'](_0x237794)){logger[_0xcffd('0x47')](_0xcffd('0xa9'),_0x237794[_0xcffd('0x50')],util['inspect'](_0x237794,{'showHidden':![],'depth':null}));this[_0xcffd('0xaa')](_0x237794[_0xcffd('0x50')],_[_0xcffd('0x80')](_0x237794[_0xcffd('0xab')])[0x0],_0x237794[_0xcffd('0xac')]);if(this[_0xcffd('0x3c')][_0x237794[_0xcffd('0x50')]]){var _0x2e9455=_[_0xcffd('0x8a')](this[_0xcffd('0x3c')][_0x237794[_0xcffd('0x50')]]);if(_0x2e9455){if(this[_0xcffd('0x69')](_0x237794[_0xcffd('0xab')])&&this[_0xcffd('0x69')](_0x237794[_0xcffd('0xab')][_0xcffd('0xad')])){switch(_0x237794[_0xcffd('0xac')]){case _0xcffd('0xae'):_0x2e9455[_0xcffd('0x97')]=![];_0x2e9455[_0xcffd('0x98')]=null;break;case _0xcffd('0xaf'):_0x2e9455[_0xcffd('0xb0')]=_0xcffd('0xb1');_0x2e9455[_0xcffd('0x97')]=!![];_0x2e9455[_0xcffd('0x98')]=moment()['format'](_0xcffd('0x79'));_0x2e9455['queuecallerleaveAt']=moment()['format'](_0xcffd('0x79'));logger[_0xcffd('0x47')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x237794[_0xcffd('0x50')],util[_0xcffd('0x3e')](_0x2e9455,{'showHidden':![],'depth':null}));ami[_0xcffd('0x46')](_0xcffd('0xb2'),_0x2e9455);break;default:_0x2e9455[_0xcffd('0x97')]=!![];_0x2e9455[_0xcffd('0x98')]=moment()[_0xcffd('0x4a')](_0xcffd('0x79'));_0x2e9455['queuecallerleaveAt']=moment()[_0xcffd('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2e9455['queuecallerabandon']=![];_0x2e9455[_0xcffd('0x87')]=null;_0x2e9455[_0xcffd('0x90')]=_0x237794[_0xcffd('0xac')];this[_0xcffd('0x11')][_0x237794[_0xcffd('0x50')]]=_0x2e9455;this['emitVoiceQueueChannelRemove'](_0x2e9455,_0xcffd('0x21'));}else if(this[_0xcffd('0x69')](_0x237794[_0xcffd('0xab')])&&this['isNotNull'](_0x237794[_0xcffd('0xab')]['queueposition'])){if(!_0x2e9455['queuecallerabandon']){_0x2e9455['queuecallerexit']=!![];_0x2e9455[_0xcffd('0x98')]=moment()[_0xcffd('0x4a')](_0xcffd('0x79'));_0x2e9455[_0xcffd('0x90')]='EXITWITHKEY';_0x2e9455[_0xcffd('0x8b')]=moment()['format'](_0xcffd('0x79'));this[_0xcffd('0x11')][_0x237794[_0xcffd('0x50')]]=_0x2e9455;}}logger[_0xcffd('0x7d')](_0xcffd('0xb3'),_0x237794[_0xcffd('0x50')],_0x2e9455[_0xcffd('0x4c')],_0x2e9455[_0xcffd('0x53')],_[_0xcffd('0x80')](_0x237794[_0xcffd('0xab')])[0x0],_0x237794['value']);_0x2e9455['variables']=this[_0xcffd('0x3f')][_0x237794[_0xcffd('0x50')]];}}}}catch(_0x2dd264){logger[_0xcffd('0x3a')]('[%s][voiceQueueReport][varset]',_0x237794['uniqueid'],util[_0xcffd('0x3e')](_0x2dd264,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xcffd('0xaa')]=function(_0x39e92b,_0x9d0037,_0x58add7){var _0x41d69f=[_0xcffd('0xb4'),_0xcffd('0xb5'),'rtpaudioqosjitter',_0xcffd('0xb6'),'rtpaudioqosloss',_0xcffd('0xb7'),'rtpaudioqosrtt',_0xcffd('0xb8'),_0xcffd('0xb9'),_0xcffd('0xba'),_0xcffd('0xbb'),_0xcffd('0xbc'),_0xcffd('0xbd'),'memberdynamic',_0xcffd('0xbe'),'memberlastcall',_0xcffd('0x95'),_0xcffd('0xbf'),'memberrealtime'];if(!_[_0xcffd('0xc0')](_0x9d0037)&&!_[_0xcffd('0xc1')](_0x41d69f,_0x9d0037)){if(_['isUndefined'](this['variables'][_0x39e92b])){this[_0xcffd('0x3f')][_0x39e92b]={};}this[_0xcffd('0x3f')][_0x39e92b][_0x9d0037]=_0x58add7;}};VoiceQueueReport[_0xcffd('0xb')][_0xcffd('0x24')]=function(_0x252e1f){try{if(this[_0xcffd('0x69')](_0x252e1f)){logger['debug'](_0xcffd('0xc2'),_0x252e1f['uniqueid'],util['inspect'](_0x252e1f,{'showHidden':![],'depth':null}));if(this[_0xcffd('0x3c')][_0x252e1f[_0xcffd('0x50')]]){for(var _0x407073=0x0,_0x29f824={};_0x407073=0x0?moment(_0xa7564c['endtime'])['diff'](_0xa7564c[_0x1776('0x1a')],_0x1776('0xf')):null,'data1':_0x1776('0x1c'),'data2':_0xa7564c[_0x1776('0x14')],'data3':_0xa7564c['exten'],'data4':_0xa7564c[_0x1776('0x1d')]||null,'role':_0x1776('0x13'),'internal':_0xa7564c[_0x1776('0x14')]?_[_0x1776('0x15')](_0xa7564c[_0x1776('0x14')]):undefined,'uniqueid':_0xa7564c[_0x1776('0x16')]},'log':_0x1776('0x8')});}; \ No newline at end of file +var _0x772b=['lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','interface','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','agent','toNumber','accountcode','voiceDialReport','membername','starttime','endtime','diff','outbound','uniqueid','moment'];(function(_0x44cdac,_0x51990c){var _0x46fa34=function(_0x5ef1b6){while(--_0x5ef1b6){_0x44cdac['push'](_0x44cdac['shift']());}};_0x46fa34(++_0x51990c);}(_0x772b,0x7b));var _0xb772=function(_0x5e0b3a,_0xeb507e){_0x5e0b3a=_0x5e0b3a-0x0;var _0x4dc13b=_0x772b[_0x5e0b3a];return _0x4dc13b;};'use strict';var moment=require(_0xb772('0x0'));var _=require(_0xb772('0x1'));var util=require(_0xb772('0x2'));var client=require(_0xb772('0x3'));exports[_0xb772('0x4')]=function(_0x2f05b0){var _0x4845cf=_0x2f05b0[_0xb772('0x5')]||_0x2f05b0[_0xb772('0x6')];return client[_0xb772('0x7')](_0xb772('0x8'),{'body':{'channel':_0xb772('0x9'),'membername':_0x2f05b0['lastAssignedTo'],'interface':_[_0xb772('0xa')](_0x2f05b0[_0xb772('0xb')])?util['format'](_0xb772('0xc'),_0x2f05b0[_0xb772('0xd')]):_0x2f05b0[_0xb772('0xb')],'type':_0xb772('0xe'),'enterAt':_0x2f05b0[_0xb772('0xf')],'exitAt':_0x4845cf,'duration':moment(_0x4845cf)['diff'](_0x2f05b0['queuecallerleaveAt'],_0xb772('0x10')),'data1':_0xb772('0x11'),'data2':_0x2f05b0[_0xb772('0x12')],'data3':_0x2f05b0[_0xb772('0x13')],'data4':null,'data5':_0x2f05b0[_0xb772('0x14')],'role':_0xb772('0x15'),'internal':_0x2f05b0['accountcode']?_[_0xb772('0x16')](_0x2f05b0[_0xb772('0x17')]):undefined,'uniqueid':_0x2f05b0['uniqueid']},'log':_0xb772('0x8')});};exports[_0xb772('0x18')]=function(_0x17d216){return client[_0xb772('0x7')](_0xb772('0x8'),{'body':{'channel':_0xb772('0x9'),'membername':_0x17d216[_0xb772('0x19')],'interface':_0x17d216[_0xb772('0xb')],'type':_0xb772('0xe'),'enterAt':_0x17d216[_0xb772('0x1a')],'exitAt':_0x17d216[_0xb772('0x1b')],'duration':moment(_0x17d216['endtime'])[_0xb772('0x1c')](_0x17d216[_0xb772('0x1a')],_0xb772('0x10'))>=0x0?moment(_0x17d216[_0xb772('0x1b')])[_0xb772('0x1c')](_0x17d216[_0xb772('0x1a')],_0xb772('0x10')):null,'data1':_0xb772('0x1d'),'data2':_0x17d216[_0xb772('0x17')],'data3':_0x17d216[_0xb772('0x13')],'data4':_0x17d216['dialstring']||null,'role':_0xb772('0x15'),'internal':_0x17d216[_0xb772('0x17')]?_['toNumber'](_0x17d216['accountcode']):undefined,'uniqueid':_0x17d216[_0xb772('0x1e')]},'log':_0xb772('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 666cdcb..7c7d7d5 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 _0x9189=['Request','ShowSetting','stopRecordingOnTransfer','GetSettings'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9189,0x1b0));var _0x9918=function(_0x2d1873,_0x2bb8bc){_0x2d1873=_0x2d1873-0x0;var _0x3422d4=_0x9189[_0x2d1873];return _0x3422d4;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x9918('0x0')](_0x9918('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9918('0x2')]},'log':_0x9918('0x3')});}; \ No newline at end of file +var _0x96d9=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','GetSettings'];(function(_0x4eacf4,_0x55df78){var _0x15213e=function(_0x5d2420){while(--_0x5d2420){_0x4eacf4['push'](_0x4eacf4['shift']());}};_0x15213e(++_0x55df78);}(_0x96d9,0xea));var _0x996d=function(_0x4b6527,_0x2f9238){_0x4b6527=_0x4b6527-0x0;var _0x303f1b=_0x96d9[_0x4b6527];return _0x303f1b;};'use strict';var client=require(_0x996d('0x0'));exports[_0x996d('0x1')]=function(){return client[_0x996d('0x2')](_0x996d('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x996d('0x4')]},'log':_0x996d('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index bdfefbf..6f03bb0 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 _0x4959=['name','html','GetTemplate','Request'];(function(_0x44ecf8,_0x36df68){var _0x15c0f3=function(_0x5689ae){while(--_0x5689ae){_0x44ecf8['push'](_0x44ecf8['shift']());}};_0x15c0f3(++_0x36df68);}(_0x4959,0x9b));var _0x9495=function(_0xaae6b7,_0x844cf0){_0xaae6b7=_0xaae6b7-0x0;var _0x2b3b20=_0x4959[_0xaae6b7];return _0x2b3b20;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x3e0066){return function(_0x14df5f){return client[_0x9495('0x0')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x9495('0x1'),_0x9495('0x2')]},'log':_0x9495('0x3')});};}; \ No newline at end of file +var _0x7e37=['GetTemplate','name','html','../client','getTemplates'];(function(_0x54fc8f,_0x59a85c){var _0x363efc=function(_0x57e401){while(--_0x57e401){_0x54fc8f['push'](_0x54fc8f['shift']());}};_0x363efc(++_0x59a85c);}(_0x7e37,0xf3));var _0x77e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e37[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x77e3('0x0'));exports[_0x77e3('0x1')]=function(_0x17bba7){return function(_0x5686e0){return client['Request'](_0x77e3('0x2'),{'options':{'raw':!![],'attributes':['id',_0x77e3('0x3'),_0x77e3('0x4')]},'log':_0x77e3('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index ca31404..8d26899 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 _0x505c=['data2','data3','data4','data7','../client','getTriggers','Request','GetTrigger','channel','status','Condition','field','operator','AnyConditions','Action','Actions','action'];(function(_0x4acabb,_0x30d568){var _0x2cc31f=function(_0x1d2f0d){while(--_0x1d2f0d){_0x4acabb['push'](_0x4acabb['shift']());}};_0x2cc31f(++_0x30d568);}(_0x505c,0x114));var _0xc505=function(_0x3cb465,_0x36d920){_0x3cb465=_0x3cb465-0x0;var _0x4e197b=_0x505c[_0x3cb465];return _0x4e197b;};'use strict';var client=require(_0xc505('0x0'));exports[_0xc505('0x1')]=function(_0x20563a){return function(_0x350eb9){return client[_0xc505('0x2')](_0xc505('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xc505('0x4'),_0xc505('0x5')],'include':[{'model':_0xc505('0x6'),'as':'AllConditions','attributes':['id',_0xc505('0x7'),_0xc505('0x8'),'value']},{'model':'Condition','as':_0xc505('0x9'),'attributes':['id',_0xc505('0x7'),_0xc505('0x8'),'value']},{'model':_0xc505('0xa'),'as':_0xc505('0xb'),'attributes':['id',_0xc505('0xc'),'data1',_0xc505('0xd'),_0xc505('0xe'),_0xc505('0xf'),'data5','data6',_0xc505('0x10')]}]},'log':_0xc505('0x3')});};}; \ No newline at end of file +var _0x09df=['channel','status','Condition','AllConditions','field','value','AnyConditions','operator','Action','data1','data2','data3','data4','data6','data7','getTriggers','Request','GetTrigger','name'];(function(_0x2c276b,_0x34e779){var _0x5e7d60=function(_0x363375){while(--_0x363375){_0x2c276b['push'](_0x2c276b['shift']());}};_0x5e7d60(++_0x34e779);}(_0x09df,0x119));var _0xf09d=function(_0x7dbd65,_0x18da49){_0x7dbd65=_0x7dbd65-0x0;var _0x33d551=_0x09df[_0x7dbd65];return _0x33d551;};'use strict';var client=require('../client');exports[_0xf09d('0x0')]=function(_0x27a85a){return function(_0xc8876){return client[_0xf09d('0x1')](_0xf09d('0x2'),{'options':{'raw':![],'attributes':['id',_0xf09d('0x3'),_0xf09d('0x4'),_0xf09d('0x5')],'include':[{'model':_0xf09d('0x6'),'as':_0xf09d('0x7'),'attributes':['id',_0xf09d('0x8'),'operator',_0xf09d('0x9')]},{'model':_0xf09d('0x6'),'as':_0xf09d('0xa'),'attributes':['id','field',_0xf09d('0xb'),_0xf09d('0x9')]},{'model':_0xf09d('0xc'),'as':'Actions','attributes':['id','action',_0xf09d('0xd'),_0xf09d('0xe'),_0xf09d('0xf'),_0xf09d('0x10'),'data5',_0xf09d('0x11'),_0xf09d('0x12')]}]},'log':_0xf09d('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index aef34d1..a765372 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 _0x3e03=['registry','GetTrunk','../client','getTrunks'];(function(_0x3b8d16,_0x32879c){var _0x19db8f=function(_0xc023a0){while(--_0xc023a0){_0x3b8d16['push'](_0x3b8d16['shift']());}};_0x19db8f(++_0x32879c);}(_0x3e03,0xc2));var _0x33e0=function(_0x19cb1a,_0x4ce1b2){_0x19cb1a=_0x19cb1a-0x0;var _0x399650=_0x3e03[_0x19cb1a];return _0x399650;};'use strict';var client=require(_0x33e0('0x0'));exports[_0x33e0('0x1')]=function(_0x5e56aa){return function(_0x5d80b9){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x33e0('0x2'),'defaultuser']},'log':_0x33e0('0x3')});};}; \ No newline at end of file +var _0x77a4=['defaultuser','../client','getTrunks','GetTrunk'];(function(_0x7314be,_0x5046a6){var _0x2adde1=function(_0x30d2a9){while(--_0x30d2a9){_0x7314be['push'](_0x7314be['shift']());}};_0x2adde1(++_0x5046a6);}(_0x77a4,0x155));var _0x477a=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x77a4[_0x44b3bd];return _0x1efc4a;};'use strict';var client=require(_0x477a('0x0'));exports[_0x477a('0x1')]=function(_0x14d0de){return function(_0x4a5c3f){return client['Request'](_0x477a('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0x477a('0x3')]},'log':_0x477a('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index d7b5f1f..335b2c3 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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x1df24e,_0x477f54){var _0xdb3cf1=function(_0x6ab20f){while(--_0x6ab20f){_0x1df24e['push'](_0x1df24e['shift']());}};_0xdb3cf1(++_0x477f54);}(_0xedd9,0xfc));var _0x9edd=function(_0x3be690,_0x40beaa){_0x3be690=_0x3be690-0x0;var _0x346339=_0xedd9[_0x3be690];return _0x346339;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x1f01e9,_0x47e086){var _0x265f36=function(_0x2f7910){while(--_0x2f7910){_0x1f01e9['push'](_0x1f01e9['shift']());}};_0x265f36(++_0x47e086);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xcb91[_0x50a0c2];return _0x5ebadd;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 935acdb..6fbf123 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 _0xc041=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','Request'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xc041,0x1e7));var _0x1c04=function(_0x52c8e8,_0x5ee20d){_0x52c8e8=_0x52c8e8-0x0;var _0x31bb1a=_0xc041[_0x52c8e8];return _0x31bb1a;};'use strict';var client=require('../client');exports['create']=function(_0x267d5f){return client[_0x1c04('0x0')](_0x1c04('0x1'),{'body':_0x267d5f,'log':_0x1c04('0x1')});};exports[_0x1c04('0x2')]=function(_0x41c518,_0x59df7a,_0x524860){return client[_0x1c04('0x0')](_0x1c04('0x3'),{'body':_0x41c518,'options':{'where':{'uniqueid':_0x59df7a,'interface':_0x524860,'agentcomplete':!![]}},'log':_0x1c04('0x3')});}; \ No newline at end of file +var _0x13b9=['UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport','update'];(function(_0x353643,_0x568495){var _0x394b32=function(_0x3924ae){while(--_0x3924ae){_0x353643['push'](_0x353643['shift']());}};_0x394b32(++_0x568495);}(_0x13b9,0x114));var _0x913b=function(_0xdddbb,_0x2734bf){_0xdddbb=_0xdddbb-0x0;var _0x41d7a1=_0x13b9[_0xdddbb];return _0x41d7a1;};'use strict';var client=require(_0x913b('0x0'));exports['create']=function(_0x2e26ed){return client[_0x913b('0x1')](_0x913b('0x2'),{'body':_0x2e26ed,'log':'CreateVoiceAgentReport'});};exports[_0x913b('0x3')]=function(_0xd96fbb,_0x4fa044,_0x307b46){return client[_0x913b('0x1')](_0x913b('0x4'),{'body':_0xd96fbb,'options':{'where':{'uniqueid':_0x4fa044,'interface':_0x307b46,'agentcomplete':!![]}},'log':_0x913b('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 9111944..ef5becc 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 _0x9b70=['context','CreateVoiceCallReport','GetVoiceCallReport','outbound','startOf','endOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','create','Request','merge','calleridnum'];(function(_0x3ab9ac,_0x5ea603){var _0x534628=function(_0x2817cc){while(--_0x2817cc){_0x3ab9ac['push'](_0x3ab9ac['shift']());}};_0x534628(++_0x5ea603);}(_0x9b70,0xa1));var _0x09b7=function(_0x290fd8,_0x33829d){_0x290fd8=_0x290fd8-0x0;var _0x1daa07=_0x9b70[_0x290fd8];return _0x1daa07;};'use strict';var moment=require(_0x09b7('0x0'));var util=require(_0x09b7('0x1'));var _=require(_0x09b7('0x2'));var client=require('../client');exports[_0x09b7('0x3')]=function(_0x4bc722){return client[_0x09b7('0x4')]('CreateVoiceCallReport',{'body':_[_0x09b7('0x5')](_0x4bc722,{'source':_0x4bc722[_0x09b7('0x6')],'destinationcontext':_0x4bc722[_0x09b7('0x7')],'callerid':_0x4bc722['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0x09b7('0x8')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x09b7('0x4')](_0x09b7('0x9'),{'options':{'where':{'type':[_0x09b7('0xa')],'createdAt':{'$between':[moment()[_0x09b7('0xb')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x09b7('0xc')](_0x09b7('0xd'))[_0x09b7('0xe')](_0x09b7('0xf'))]}},'attributes':[_0x09b7('0x10'),_0x09b7('0x11'),_0x09b7('0x12'),_0x09b7('0x13')]},'log':_0x09b7('0x14')});};}; \ No newline at end of file +var _0xbce0=['lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','moment','util'];(function(_0x1136a2,_0x10298c){var _0x54bae5=function(_0x52b85b){while(--_0x52b85b){_0x1136a2['push'](_0x1136a2['shift']());}};_0x54bae5(++_0x10298c);}(_0xbce0,0x76));var _0x0bce=function(_0x37660f,_0x5e460d){_0x37660f=_0x37660f-0x0;var _0xb7c4be=_0xbce0[_0x37660f];return _0xb7c4be;};'use strict';var moment=require(_0x0bce('0x0'));var util=require(_0x0bce('0x1'));var _=require(_0x0bce('0x2'));var client=require(_0x0bce('0x3'));exports[_0x0bce('0x4')]=function(_0x22298b){return client[_0x0bce('0x5')](_0x0bce('0x6'),{'body':_[_0x0bce('0x7')](_0x22298b,{'source':_0x22298b[_0x0bce('0x8')],'destinationcontext':_0x22298b[_0x0bce('0x9')],'callerid':_0x22298b['callerid'],'amaflags':_0x0bce('0xa')}),'log':_0x0bce('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x0bce('0x5')](_0x0bce('0xb'),{'options':{'where':{'type':[_0x0bce('0xc')],'createdAt':{'$between':[moment()['startOf'](_0x0bce('0xd'))[_0x0bce('0xe')](_0x0bce('0xf')),moment()[_0x0bce('0x10')]('day')['format'](_0x0bce('0xf'))]}},'attributes':['type',_0x0bce('0x11'),_0x0bce('0x12'),_0x0bce('0x13')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a5375b2..764c4cf 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 _0xe19b=['Request','CreateVoiceDialReport','../client','create'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xe19b,0x1aa));var _0xbe19=function(_0x1767c6,_0x35cdb2){_0x1767c6=_0x1767c6-0x0;var _0x17ef50=_0xe19b[_0x1767c6];return _0x17ef50;};'use strict';var client=require(_0xbe19('0x0'));exports[_0xbe19('0x1')]=function(_0x26bec9){return client[_0xbe19('0x2')](_0xbe19('0x3'),{'body':_0x26bec9,'log':_0xbe19('0x3')});}; \ No newline at end of file +var _0xc862=['create','Request','CreateVoiceDialReport','../client'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xc862,0xe7));var _0x2c86=function(_0x44b958,_0x594efd){_0x44b958=_0x44b958-0x0;var _0x89dd7e=_0xc862[_0x44b958];return _0x89dd7e;};'use strict';var client=require(_0x2c86('0x0'));exports[_0x2c86('0x1')]=function(_0x5c759f){return client[_0x2c86('0x2')](_0x2c86('0x3'),{'body':_0x5c759f,'log':_0x2c86('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ce256af..869424e 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 _0x0eaa=['recordingFormat','../client','getVoiceExtensions','exten'];(function(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x1126aa,_0x3ac6db){_0x1126aa=_0x1126aa-0x0;var _0x5e2bd9=_0x0eaa[_0x1126aa];return _0x5e2bd9;};'use strict';var client=require(_0xa0ea('0x0'));exports[_0xa0ea('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xa0ea('0x2'),_0xa0ea('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xa75b=['exten','recordingFormat','getVoiceExtensions','../client','GetVoiceExtension'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa75b,0x170));var _0xba75=function(_0x51842d,_0x29c7fd){_0x51842d=_0x51842d-0x0;var _0x2015de=_0xa75b[_0x51842d];return _0x2015de;};'use strict';var client=require(_0xba75('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0xba75('0x1'),{'options':{'raw':!![],'attributes':['id',_0xba75('0x2'),_0xba75('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xba75('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 5cded47..a8f9f92 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 _0x4f64=['dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','../client','getVoiceQueues','Request','name','acw','autopause','monitor_format','dialActive','dialMethod','dialLimitQueue','dialPowerLevel'];(function(_0x530e75,_0x361b9a){var _0x31ca59=function(_0x44c08e){while(--_0x44c08e){_0x530e75['push'](_0x530e75['shift']());}};_0x31ca59(++_0x361b9a);}(_0x4f64,0x151));var _0x44f6=function(_0x229bbf,_0x3100ea){_0x229bbf=_0x229bbf-0x0;var _0x2a5441=_0x4f64[_0x229bbf];return _0x2a5441;};'use strict';var client=require(_0x44f6('0x0'));exports[_0x44f6('0x1')]=function(){return function(){return client[_0x44f6('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x44f6('0x3'),_0x44f6('0x4'),'acwTimeout',_0x44f6('0x5'),_0x44f6('0x6'),'type',_0x44f6('0x7'),_0x44f6('0x8'),'dialLimitChannel',_0x44f6('0x9'),_0x44f6('0xa'),_0x44f6('0xb'),'dialPredictiveOptimizationPercentage',_0x44f6('0xc'),_0x44f6('0xd'),_0x44f6('0xe'),'dialOriginateTimeout',_0x44f6('0xf'),_0x44f6('0x10'),'dialQueueProject',_0x44f6('0x11'),'dialCongestionRetryFrequency',_0x44f6('0x12'),_0x44f6('0x13'),_0x44f6('0x14'),_0x44f6('0x15'),_0x44f6('0x16'),'dialTimezone',_0x44f6('0x17'),_0x44f6('0x18'),_0x44f6('0x19'),_0x44f6('0x1a'),'dialAMDInitialSilence',_0x44f6('0x1b'),'dialAMDAfterGreetingSilence',_0x44f6('0x1c'),_0x44f6('0x1d'),_0x44f6('0x1e'),_0x44f6('0x1f'),_0x44f6('0x20'),_0x44f6('0x21'),_0x44f6('0x22'),_0x44f6('0x23'),_0x44f6('0x24'),_0x44f6('0x25'),_0x44f6('0x26'),_0x44f6('0x27'),'dialQueueProject2',_0x44f6('0x6'),'strategy',_0x44f6('0x28'),'dialCutDigit',_0x44f6('0x29'),_0x44f6('0x2a'),_0x44f6('0x2b'),'dialDropRetryFrequency','dialAbandonedMaxRetry',_0x44f6('0x2c'),_0x44f6('0x2d'),_0x44f6('0x2e'),_0x44f6('0x2f'),'dialAgentRejectRetryFrequency',_0x44f6('0x30'),_0x44f6('0x31'),_0x44f6('0x32')],'include':[{'model':'Trunk','as':_0x44f6('0x33'),'attributes':['id',_0x44f6('0x3'),_0x44f6('0x34'),_0x44f6('0x35')]},{'model':_0x44f6('0x36'),'as':_0x44f6('0x37'),'attributes':['id','name']},{'model':'Trunk','as':_0x44f6('0x38'),'attributes':['id','name','callerid',_0x44f6('0x35')]},{'model':_0x44f6('0x39'),'as':_0x44f6('0x39'),'attributes':['id',_0x44f6('0x3')],'include':[{'model':_0x44f6('0x39'),'as':'Intervals','attributes':['id',_0x44f6('0x3'),'interval']}]}]},'log':_0x44f6('0x1')});};}; \ No newline at end of file +var _0x9b70=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x9b70,0x1cc));var _0x09b7=function(_0x40c62b,_0x2c2efe){_0x40c62b=_0x40c62b-0x0;var _0x568cf0=_0x9b70[_0x40c62b];return _0x568cf0;};'use strict';var client=require(_0x09b7('0x0'));exports[_0x09b7('0x1')]=function(){return function(){return client[_0x09b7('0x2')](_0x09b7('0x3'),{'options':{'raw':![],'attributes':['id',_0x09b7('0x4'),_0x09b7('0x5'),_0x09b7('0x6'),_0x09b7('0x7'),_0x09b7('0x8'),'type',_0x09b7('0x9'),_0x09b7('0xa'),_0x09b7('0xb'),_0x09b7('0xc'),_0x09b7('0xd'),_0x09b7('0xe'),_0x09b7('0xf'),_0x09b7('0x10'),_0x09b7('0x11'),_0x09b7('0x12'),_0x09b7('0x13'),'dialQueueOptions','dialQueueTimeout','dialQueueProject',_0x09b7('0x14'),_0x09b7('0x15'),'dialBusyMaxRetry',_0x09b7('0x16'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval',_0x09b7('0x17'),_0x09b7('0x18'),_0x09b7('0x19'),_0x09b7('0x1a'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0x09b7('0x1b'),'dialAMDMinWordLength',_0x09b7('0x1c'),_0x09b7('0x1d'),_0x09b7('0x1e'),_0x09b7('0x1f'),_0x09b7('0x20'),'dialRecallMeTimeout','dialRecallInQueue',_0x09b7('0x21'),_0x09b7('0x22'),'dialAgiAfterHangupClient',_0x09b7('0x23'),'monitor_format',_0x09b7('0x24'),'dialRandomLastDigitCallerIdNumber',_0x09b7('0x25'),_0x09b7('0x26'),_0x09b7('0x27'),_0x09b7('0x28'),_0x09b7('0x29'),_0x09b7('0x2a'),_0x09b7('0x2b'),_0x09b7('0x2c'),_0x09b7('0x2d'),'dialAgentRejectMaxRetry',_0x09b7('0x2e'),_0x09b7('0x2f'),_0x09b7('0x30'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x09b7('0x31'),'as':_0x09b7('0x31'),'attributes':['id',_0x09b7('0x4'),'callerid',_0x09b7('0x32')]},{'model':_0x09b7('0x33'),'as':'mandatoryDispositionPause','attributes':['id',_0x09b7('0x4')]},{'model':_0x09b7('0x31'),'as':_0x09b7('0x34'),'attributes':['id',_0x09b7('0x4'),'callerid','active']},{'model':_0x09b7('0x35'),'as':'Interval','attributes':['id',_0x09b7('0x4')],'include':[{'model':_0x09b7('0x35'),'as':_0x09b7('0x36'),'attributes':['id',_0x09b7('0x4'),_0x09b7('0x37')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 26ab32f..335fc98 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(_0x50360c,_0x5b8cec){var _0x541e49=function(_0x27c0be){while(--_0x27c0be){_0x50360c['push'](_0x50360c['shift']());}};_0x541e49(++_0x5b8cec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x369dcd,_0xbbbcbb){var _0x81072=function(_0x475df9){while(--_0x475df9){_0x369dcd['push'](_0x369dcd['shift']());}};_0x81072(++_0xbbbcbb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 c3000fc..accdd3c 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 _0x3717=['getVoiceQueueRtPauses','Request','../client'];(function(_0x44e06d,_0x51d67b){var _0x5d9b10=function(_0x20db56){while(--_0x20db56){_0x44e06d['push'](_0x44e06d['shift']());}};_0x5d9b10(++_0x51d67b);}(_0x3717,0x122));var _0x7371=function(_0xa22583,_0x564cdd){_0xa22583=_0xa22583-0x0;var _0x3e2d07=_0x3717[_0xa22583];return _0x3e2d07;};'use strict';var client=require(_0x7371('0x0'));exports[_0x7371('0x1')]=function(_0x4f89a9){return function(){return client[_0x7371('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x4f89a9,'paused':!![]},'raw':!![]},'log':_0x7371('0x1')});};}; \ No newline at end of file +var _0x5e34=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0x299520,_0x5b1aab){var _0x3d0267=function(_0x181430){while(--_0x181430){_0x299520['push'](_0x299520['shift']());}};_0x3d0267(++_0x5b1aab);}(_0x5e34,0x83));var _0x45e3=function(_0x4a92ad,_0x39f2f7){_0x4a92ad=_0x4a92ad-0x0;var _0x1639e2=_0x5e34[_0x4a92ad];return _0x1639e2;};'use strict';var client=require(_0x45e3('0x0'));exports[_0x45e3('0x1')]=function(_0x45aee9){return function(){return client['Request'](_0x45e3('0x2'),{'options':{'where':{'VoiceQueueId':_0x45aee9,'paused':!![]},'raw':!![]},'log':_0x45e3('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 131edb3..0a8f9d4 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(_0x499e19,_0x58e0dd){var _0x9b0b2f=function(_0x4aa3ac){while(--_0x4aa3ac){_0x499e19['push'](_0x499e19['shift']());}};_0x9b0b2f(++_0x58e0dd);}(_0x7a54,0x106));var _0x47a5=function(_0x4a68ca,_0x4199f5){_0x4a68ca=_0x4a68ca-0x0;var _0x527ddf=_0x7a54[_0x4a68ca];return _0x527ddf;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x2e6c89,_0x53f61a){var _0x5ae0d8=function(_0x53c487){while(--_0x53c487){_0x2e6c89['push'](_0x2e6c89['shift']());}};_0x5ae0d8(++_0x53f61a);}(_0x7a54,0x106));var _0x47a5=function(_0x22aba0,_0x398c6b){_0x22aba0=_0x22aba0-0x0;var _0x5d9c96=_0x7a54[_0x22aba0];return _0x5d9c96;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index b8e7b8b..216ff89 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 _0x1949=['secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','origtransfererexten','attended','transfers','Request','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','CreateVoiceTransferReport','attendedTransfer','result','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x95f8e1,_0x486532){var _0x3cc549=function(_0x329690){while(--_0x329690){_0x95f8e1['push'](_0x95f8e1['shift']());}};_0x3cc549(++_0x486532);}(_0x1949,0x11d));var _0x9194=function(_0x160b71,_0x11f156){_0x160b71=_0x160b71-0x0;var _0x54c642=_0x1949[_0x160b71];return _0x54c642;};'use strict';var client=require('../client');exports[_0x9194('0x0')]={};exports['blindTransfer']=function(_0x5ae401){return client[_0x9194('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x5ae401['result'],'transfererchannel':_0x5ae401[_0x9194('0x2')],'transferercalleridnum':_0x5ae401[_0x9194('0x3')],'transferercalleridname':_0x5ae401[_0x9194('0x4')],'transfererconnectedlinenum':_0x5ae401[_0x9194('0x5')],'transfererconnectedlinename':_0x5ae401['transfererconnectedlinename'],'transfereraccountcode':_0x5ae401[_0x9194('0x6')],'transferercontext':_0x5ae401[_0x9194('0x7')],'transfererexten':_0x5ae401[_0x9194('0x8')],'transfererlinkedid':_0x5ae401[_0x9194('0x9')],'transfereechannel':_0x5ae401[_0x9194('0xa')],'transfereecalleridnum':_0x5ae401[_0x9194('0xb')],'transfereecalleridname':_0x5ae401[_0x9194('0xc')],'transfereeconnectedlinenum':_0x5ae401['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x5ae401[_0x9194('0xd')],'transfereeaccountcode':_0x5ae401['transfereeaccountcode'],'transfereecontext':_0x5ae401[_0x9194('0xe')],'transfereeexten':_0x5ae401[_0x9194('0xf')],'transfereelinkedid':_0x5ae401[_0x9194('0x10')],'isexternal':_0x5ae401[_0x9194('0x11')],'context':_0x5ae401[_0x9194('0x12')],'extension':_0x5ae401[_0x9194('0x13')],'type':'blind'},'log':_0x9194('0x14')});};exports[_0x9194('0x15')]=function(_0x1ffc77){return client[_0x9194('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x1ffc77[_0x9194('0x16')],'transfererchannel':_0x1ffc77['origtransfererchannel'],'transferercalleridnum':_0x1ffc77[_0x9194('0x17')],'transferercalleridname':_0x1ffc77[_0x9194('0x18')],'transfererconnectedlinenum':_0x1ffc77[_0x9194('0x19')],'transfererconnectedlinename':_0x1ffc77[_0x9194('0x1a')],'transfereraccountcode':_0x1ffc77['origtransfereraccountcode'],'transferercontext':_0x1ffc77[_0x9194('0x1b')],'transfererexten':_0x1ffc77[_0x9194('0x1c')],'transfererlinkedid':_0x1ffc77[_0x9194('0x1d')],'transfereechannel':_0x1ffc77[_0x9194('0x1e')],'transfereecalleridnum':_0x1ffc77[_0x9194('0x1f')],'transfereecalleridname':_0x1ffc77[_0x9194('0x20')],'transfereeconnectedlinenum':_0x1ffc77[_0x9194('0x21')],'transfereeconnectedlinename':_0x1ffc77[_0x9194('0x22')],'transfereeaccountcode':_0x1ffc77[_0x9194('0x23')],'transfereecontext':_0x1ffc77['transfertargetcontext'],'transfereeexten':_0x1ffc77[_0x9194('0x24')],'transfereelinkedid':_0x1ffc77['transfertargetlinkedid'],'isexternal':_0x1ffc77[_0x9194('0x11')],'context':_0x1ffc77['origtransferercontext'],'extension':_0x1ffc77[_0x9194('0x25')],'type':_0x9194('0x26')},'log':_0x9194('0x14')});}; \ No newline at end of file +var _0xe84d=['transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','extension','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','result'];(function(_0x3dd8dd,_0x369f8e){var _0x33e300=function(_0xf1a7db){while(--_0xf1a7db){_0x3dd8dd['push'](_0x3dd8dd['shift']());}};_0x33e300(++_0x369f8e);}(_0xe84d,0x1f3));var _0xde84=function(_0x29d5d5,_0x27c4e2){_0x29d5d5=_0x29d5d5-0x0;var _0x26c550=_0xe84d[_0x29d5d5];return _0x26c550;};'use strict';var client=require(_0xde84('0x0'));exports[_0xde84('0x1')]={};exports[_0xde84('0x2')]=function(_0x35c705){return client[_0xde84('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x35c705[_0xde84('0x4')],'transfererchannel':_0x35c705['transfererchannel'],'transferercalleridnum':_0x35c705[_0xde84('0x5')],'transferercalleridname':_0x35c705[_0xde84('0x6')],'transfererconnectedlinenum':_0x35c705[_0xde84('0x7')],'transfererconnectedlinename':_0x35c705[_0xde84('0x8')],'transfereraccountcode':_0x35c705['transfereraccountcode'],'transferercontext':_0x35c705['transferercontext'],'transfererexten':_0x35c705[_0xde84('0x9')],'transfererlinkedid':_0x35c705[_0xde84('0xa')],'transfereechannel':_0x35c705[_0xde84('0xb')],'transfereecalleridnum':_0x35c705[_0xde84('0xc')],'transfereecalleridname':_0x35c705[_0xde84('0xd')],'transfereeconnectedlinenum':_0x35c705[_0xde84('0xe')],'transfereeconnectedlinename':_0x35c705[_0xde84('0xf')],'transfereeaccountcode':_0x35c705[_0xde84('0x10')],'transfereecontext':_0x35c705['transfereecontext'],'transfereeexten':_0x35c705[_0xde84('0x11')],'transfereelinkedid':_0x35c705[_0xde84('0x12')],'isexternal':_0x35c705['isexternal'],'context':_0x35c705['context'],'extension':_0x35c705[_0xde84('0x13')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x3ad497){return client[_0xde84('0x3')](_0xde84('0x14'),{'body':{'result':_0x3ad497[_0xde84('0x4')],'transfererchannel':_0x3ad497[_0xde84('0x15')],'transferercalleridnum':_0x3ad497[_0xde84('0x16')],'transferercalleridname':_0x3ad497['origtransferercalleridname'],'transfererconnectedlinenum':_0x3ad497[_0xde84('0x17')],'transfererconnectedlinename':_0x3ad497[_0xde84('0x18')],'transfereraccountcode':_0x3ad497[_0xde84('0x19')],'transferercontext':_0x3ad497[_0xde84('0x1a')],'transfererexten':_0x3ad497[_0xde84('0x1b')],'transfererlinkedid':_0x3ad497['origtransfererlinkedid'],'transfereechannel':_0x3ad497['transfertargetchannel'],'transfereecalleridnum':_0x3ad497['transfertargetcalleridnum'],'transfereecalleridname':_0x3ad497[_0xde84('0x1c')],'transfereeconnectedlinenum':_0x3ad497['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3ad497['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3ad497[_0xde84('0x1d')],'transfereecontext':_0x3ad497[_0xde84('0x1e')],'transfereeexten':_0x3ad497[_0xde84('0x1f')],'transfereelinkedid':_0x3ad497[_0xde84('0x20')],'isexternal':_0x3ad497['isexternal'],'context':_0x3ad497[_0xde84('0x21')],'extension':_0x3ad497[_0xde84('0x22')],'type':_0xde84('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 62f1107..3e5309d 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 _0x5d17=['http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','moment','../../../config/environment','../ami','listen','SIP','timers','updateAcw','agents','updateStatusRealtime','pause','asterisk','username','ami\x20disconnected','pick','keys','module','action','Reload','Action','then','message','catch','isConnected','error','join','Command','content','voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','length','find','values','channels','voicechannel','validate','uniqueid','channel','format','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','map','Hangup','Redirect','context','telephones','trunks','outboundChannels','outbound','campaigns','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','server'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x5d17,0x114));var _0x75d1=function(_0x1f5974,_0x11540c){_0x1f5974=_0x1f5974-0x0;var _0x5cb353=_0x5d17[_0x1f5974];return _0x5cb353;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var config=require(_0x75d1('0x4'));var properties=require('../properties');var ami=require(_0x75d1('0x5'));exports[_0x75d1('0x6')]=function(_0x387e35,_0x32bd45,_0x56ac0a){return new BPromise(function(_0x458681,_0x116a51){var _0x5c957a={'QueuePause':function(_0x1ee61b){return new Promise(function(_0x3a9d5e,_0x105607){var _0xf9f8e=util['format']('%s/%s',_0x75d1('0x7'),_0x1ee61b['name']);if(_0x387e35['timers']&&_0x387e35[_0x75d1('0x8')][_0xf9f8e]&&_0x387e35[_0x75d1('0x8')][_0xf9f8e]['timer']){_0x387e35[_0x75d1('0x8')][_0xf9f8e][_0x75d1('0x9')]();}if(_0x387e35[_0x75d1('0xa')][_0xf9f8e]){_0x387e35[_0x75d1('0xa')][_0xf9f8e][_0x75d1('0xb')]({'statePause':_0x1ee61b[_0x75d1('0xc')]?!![]:![]});}_0x3a9d5e({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x19e825){var _0x2d3bfc=this;return new Promise(function(_0x3af408,_0x314a71){if(ami['isConnected']()==![]){return _0x314a71(_0x2d3bfc['error'](0x1f4,[config['asterisk']['ip'],config[_0x75d1('0xd')][_0x75d1('0xe')],_0x75d1('0xf')]['join']('\x20')));}_0x19e825=_[_0x75d1('0x10')](_0x19e825,_[_0x75d1('0x11')](properties[_0x75d1('0x12')]));_0x19e825[_0x75d1('0x13')]=_0x75d1('0x14');return ami[_0x75d1('0x15')](_0x19e825)[_0x75d1('0x16')](function(_0x59dead){_0x3af408({'code':0xc8,'message':_0x59dead[_0x75d1('0x17')]});})[_0x75d1('0x18')](function(_0x2c2a6d){_0x314a71(_0x2d3bfc['error'](0x1f5,_0x2c2a6d['message']));});});},'Command':function(_0xc6b282){var _0x42b7ac=this;return new Promise(function(_0x56730d,_0x31eb88){if(ami[_0x75d1('0x19')]()==![]){return _0x31eb88(_0x42b7ac[_0x75d1('0x1a')](0x1f4,[config[_0x75d1('0xd')]['ip'],config[_0x75d1('0xd')][_0x75d1('0xe')],'ami\x20disconnected'][_0x75d1('0x1b')]('\x20')));}_0xc6b282=_[_0x75d1('0x10')](_0xc6b282,'command');_0xc6b282[_0x75d1('0x13')]=_0x75d1('0x1c');return ami['Action'](_0xc6b282)[_0x75d1('0x16')](function(_0x5e70ec){_0x56730d({'code':0xc8,'message':_0x5e70ec[_0x75d1('0x1d')]});})[_0x75d1('0x18')](function(_0x345cf5){_0x31eb88(_0x42b7ac['error'](0x1f5,_0x345cf5['message']));});});},'VoiceQueues':function(_0x4590ac){return new Promise(function(_0x45b18f,_0x315ce5){var _0x18184b=[];for(var _0x51d043 in _0x387e35[_0x75d1('0x1e')]){if(_0x387e35[_0x75d1('0x1e')][_0x75d1('0x1f')](_0x51d043)){var _0x51138e=_0x387e35['voiceQueues'][_0x51d043];var _0x57efd6={'id':_0x51138e['id'],'name':_0x51138e[_0x75d1('0x20')],'strategy':_0x51138e[_0x75d1('0x21')],'answered':_0x51138e[_0x75d1('0x22')],'available':_0x51138e[_0x75d1('0x23')],'loggedIn':_0x51138e[_0x75d1('0x24')],'pTalking':_0x51138e['pTalking'],'sumBillable':_0x51138e['sumBillable'],'sumDuration':_0x51138e[_0x75d1('0x25')],'sumHoldTime':_0x51138e[_0x75d1('0x26')]||0x0,'talking':_0x51138e['talking'],'total':_0x51138e[_0x75d1('0x27')],'type':_0x51138e['type'],'unmanaged':_0x51138e[_0x75d1('0x28')],'abandoned':_0x51138e[_0x75d1('0x29')],'waiting':_0x51138e[_0x75d1('0x2a')],'loggedInDb':_0x51138e[_0x75d1('0x2b')]};if(_0x51138e[_0x75d1('0x2c')]==='outbound'){_0x57efd6[_0x75d1('0x2d')]=_0x51138e[_0x75d1('0x2d')];_0x57efd6[_0x75d1('0x2e')]=_0x51138e[_0x75d1('0x2e')];_0x57efd6['dialOriginateCallerIdName']=_0x51138e[_0x75d1('0x2f')];_0x57efd6['dialOriginateCallerIdNumber']=_0x51138e[_0x75d1('0x30')];_0x57efd6[_0x75d1('0x31')]=_0x51138e['dialOriginateTimeout'];_0x57efd6[_0x75d1('0x32')]=_0x51138e[_0x75d1('0x32')];_0x57efd6[_0x75d1('0x33')]=_0x51138e[_0x75d1('0x33')];_0x57efd6[_0x75d1('0x34')]=_0x51138e['outboundAnswerAgiCallsDay'];_0x57efd6[_0x75d1('0x35')]=_0x51138e[_0x75d1('0x35')];_0x57efd6[_0x75d1('0x36')]=_0x51138e[_0x75d1('0x36')];_0x57efd6['outboundBusyCallsDay']=_0x51138e['outboundBusyCallsDay'];_0x57efd6['outboundCongestionCallsDay']=_0x51138e[_0x75d1('0x37')];_0x57efd6[_0x75d1('0x38')]=_0x51138e[_0x75d1('0x38')];_0x57efd6[_0x75d1('0x39')]=_0x51138e[_0x75d1('0x39')];_0x57efd6[_0x75d1('0x3a')]=_0x51138e[_0x75d1('0x3a')];_0x57efd6[_0x75d1('0x3b')]=_0x51138e[_0x75d1('0x3b')];_0x57efd6['outboundNoSuchCallsDay']=_0x51138e[_0x75d1('0x3c')];_0x57efd6[_0x75d1('0x3d')]=_0x51138e[_0x75d1('0x3d')];_0x57efd6[_0x75d1('0x3e')]=_0x51138e[_0x75d1('0x3e')];_0x57efd6['outboundRejectCallsDay']=_0x51138e['outboundRejectCallsDay'];_0x57efd6['outboundUnknownCallsDay']=_0x51138e[_0x75d1('0x3f')];_0x57efd6[_0x75d1('0x40')]=_0x51138e[_0x75d1('0x40')];_0x57efd6[_0x75d1('0x41')]=_0x51138e[_0x75d1('0x41')];_0x57efd6[_0x75d1('0x42')]=_0x51138e['predictiveIntervalAvgTalktime'];_0x57efd6['predictiveIntervalDroppedCallsCallersExit']=_0x51138e['predictiveIntervalDroppedCallsCallersExit'];_0x57efd6[_0x75d1('0x43')]=_0x51138e['predictiveIntervalDroppedCallsTimeout'];_0x57efd6['predictiveIntervalErlangCalls']=_0x51138e[_0x75d1('0x44')];_0x57efd6[_0x75d1('0x45')]=_0x51138e[_0x75d1('0x45')];_0x57efd6[_0x75d1('0x46')]=_0x51138e['predictiveIntervalHitRate'];_0x57efd6[_0x75d1('0x47')]=_0x51138e[_0x75d1('0x47')];_0x57efd6[_0x75d1('0x48')]=_0x51138e[_0x75d1('0x48')];_0x57efd6[_0x75d1('0x49')]=_0x51138e[_0x75d1('0x49')];_0x57efd6[_0x75d1('0x4a')]=_0x51138e[_0x75d1('0x4a')];_0x57efd6[_0x75d1('0x17')]=_0x51138e[_0x75d1('0x17')];_0x57efd6[_0x75d1('0x4b')]=_0x51138e[_0x75d1('0x4b')];_0x57efd6[_0x75d1('0x4c')]=_0x51138e[_0x75d1('0x4c')];_0x57efd6[_0x75d1('0x4d')]=_0x51138e[_0x75d1('0x4d')];_0x57efd6[_0x75d1('0x4e')]=_0x51138e[_0x75d1('0x4e')];_0x57efd6[_0x75d1('0x4f')]=_0x51138e[_0x75d1('0x4f')];_0x57efd6[_0x75d1('0x50')]=_0x51138e[_0x75d1('0x50')];_0x57efd6['startProgressive']=_0x51138e['startProgressive'];}if(_0x51138e[_0x75d1('0x51')]){_0x57efd6[_0x75d1('0x51')]={'id':_0x51138e[_0x75d1('0x51')]['id'],'name':_0x51138e[_0x75d1('0x51')]['name'],'active':_0x51138e[_0x75d1('0x51')][_0x75d1('0x52')],'callerid':_0x51138e[_0x75d1('0x51')][_0x75d1('0x53')]};}if(_0x51138e['Interval']){_0x57efd6[_0x75d1('0x54')]={'id':_0x51138e[_0x75d1('0x54')]['id'],'name':_0x51138e[_0x75d1('0x54')][_0x75d1('0x20')]};}_0x18184b['push'](_0x57efd6);}}_0x45b18f({'count':_0x18184b[_0x75d1('0x55')],'rows':_0x18184b});});},'UpdateVoiceQueue':function(_0x5159a8){return new Promise(function(_0x130dd3,_0x1d063d){var _0x9bc1ed=_[_0x75d1('0x56')](_0x387e35[_0x75d1('0x1e')],{'id':parseInt(_0x5159a8['id'])});var _0x2137e1=_['omit'](_0x5159a8,['id']);if(_0x9bc1ed){for(var _0x366e5b in _0x2137e1){if(typeof _0x2137e1[_0x366e5b]!=='undefined'&&typeof _0x9bc1ed[_0x366e5b]!=='undefined'){_0x9bc1ed[_0x366e5b]=_0x2137e1[_0x366e5b];}}_0x130dd3(_0x9bc1ed);}else{_0x1d063d();}});},'VoiceChannels':function(_0xbbefd3){return new Promise(function(_0x125c9d,_0x4760cf){var _0x12bd67=_[_0x75d1('0x57')](_0x387e35[_0x75d1('0x58')]);_0x125c9d({'count':_0x12bd67[_0x75d1('0x55')],'rows':_0x12bd67});});},'VoiceChannelMixMonitor':function(_0x5b7b7c){var _0x5d7ebf=this;return new Promise(function(_0x1edc9d,_0x8ce3d2){if(ami['isConnected']()==![]){return _0x8ce3d2(_0x5d7ebf[_0x75d1('0x1a')](0x1f4,[config[_0x75d1('0xd')]['ip'],config[_0x75d1('0xd')]['username'],_0x75d1('0xf')][_0x75d1('0x1b')]('\x20')));}var _0x47504d=schema(properties[_0x75d1('0x59')])[_0x75d1('0x5a')](_0x5b7b7c);if(_0x47504d[_0x75d1('0x55')]>0x0){return _0x8ce3d2(_0x5d7ebf[_0x75d1('0x1a')](0x1f4,_['map'](_0x47504d,_0x75d1('0x17'))[_0x75d1('0x1b')](',\x20')));}var _0x16b3c0=_[_0x75d1('0x56')](_0x387e35[_0x75d1('0x58')],{'uniqueid':_0x5b7b7c[_0x75d1('0x5b')]});if(_0x16b3c0&&_0x16b3c0[_0x75d1('0x5c')]){var _0x595ec7=util[_0x75d1('0x5d')](_0x75d1('0x5e'),_0x5b7b7c[_0x75d1('0x5f')]||_0x5b7b7c['uniqueid'],_0x5b7b7c[_0x75d1('0x5d')]||_0x75d1('0x60'));return ami[_0x75d1('0x15')]({'action':_0x75d1('0x61'),'channel':_0x16b3c0[_0x75d1('0x5c')],'file':_0x595ec7,'options':_0x75d1('0x62')})['then'](function(_0x407bb3){var _0x327387=_[_0x75d1('0x56')](_0x16b3c0[_0x75d1('0x63')],{'filename':_0x75d1('0x64')+_0x595ec7[_0x75d1('0x65')]()});if(_[_0x75d1('0x66')](_0x327387)){_0x16b3c0[_0x75d1('0x63')][_0x75d1('0x67')]({'filename':_0x75d1('0x64')+_0x595ec7[_0x75d1('0x65')](),'createdAt':moment()[_0x75d1('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x407bb3['mixmonitorid'],'status':_0x75d1('0x68')});}else{_0x327387['mixmonitorid']=_0x407bb3[_0x75d1('0x69')];_0x327387[_0x75d1('0x6a')]='rec';}_0x1edc9d({'code':0xc8,'message':[_0x5b7b7c[_0x75d1('0x5b')],_0x75d1('0x6b'),_0x407bb3[_0x75d1('0x69')]][_0x75d1('0x1b')]('\x20'),'mixmonitorid':_0x407bb3[_0x75d1('0x69')]});})[_0x75d1('0x18')](function(_0x3388f0){_0x8ce3d2(_0x5d7ebf['error'](0x1f5,[_0x5b7b7c[_0x75d1('0x5b')],_0x3388f0[_0x75d1('0x17')][_0x75d1('0x65')]()][_0x75d1('0x1b')]('\x20')));});}else{return _0x8ce3d2(_0x5d7ebf[_0x75d1('0x1a')](0x1f5,_0x75d1('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x41f98f){var _0x3b30fb=this;return new Promise(function(_0x22c75a,_0x349134){if(ami['isConnected']()==![]){return _0x349134(_0x3b30fb['error'](0x1f4,[config[_0x75d1('0xd')]['ip'],config[_0x75d1('0xd')][_0x75d1('0xe')],'ami\x20disconnected'][_0x75d1('0x1b')]('\x20')));}var _0x586acb=schema(properties[_0x75d1('0x59')])[_0x75d1('0x5a')](_0x41f98f);if(_0x586acb[_0x75d1('0x55')]>0x0){return _0x349134(_0x3b30fb[_0x75d1('0x1a')](0x1f4,_['map'](_0x586acb,_0x75d1('0x17'))['join'](',\x20')));}var _0x4b1943=_[_0x75d1('0x56')](_0x387e35[_0x75d1('0x58')],{'uniqueid':_0x41f98f[_0x75d1('0x5b')]});if(_0x4b1943){return BPromise[_0x75d1('0x6d')]()['then'](function(){if(_0x4b1943['channel']){return ami[_0x75d1('0x15')]({'action':_0x75d1('0x6e'),'channel':_0x4b1943[_0x75d1('0x5c')],'mixmonitorid':_0x41f98f[_0x75d1('0x69')]})[_0x75d1('0x18')](function(_0x5bcd3a){});}})[_0x75d1('0x16')](function(){if(_0x4b1943[_0x75d1('0x6f')]){return ami[_0x75d1('0x15')]({'action':_0x75d1('0x6e'),'channel':_0x4b1943[_0x75d1('0x6f')],'mixmonitorid':_0x41f98f[_0x75d1('0x69')]})[_0x75d1('0x18')](function(_0x1092fb){});}})[_0x75d1('0x16')](function(_0x9e30a5){var _0xff1c9d=_['find'](_0x4b1943[_0x75d1('0x63')],{'mixmonitorid':_0x41f98f[_0x75d1('0x69')]});if(_0xff1c9d){_0xff1c9d[_0x75d1('0x6a')]=_0x75d1('0x70');}})[_0x75d1('0x16')](function(){var _0x174fde=util[_0x75d1('0x5d')]('%s.%s',_0x41f98f['filename']||_0x41f98f[_0x75d1('0x5b')],_0x41f98f[_0x75d1('0x5d')]||_0x75d1('0x60'));var _0x13ddbb=_[_0x75d1('0x56')](_0x4b1943['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x174fde[_0x75d1('0x65')]()});if(_0x13ddbb){_0x13ddbb[_0x75d1('0x6a')]='stop';}})[_0x75d1('0x16')](function(){_0x22c75a({'code':0xc8,'message':[_0x41f98f[_0x75d1('0x5b')],_0x75d1('0x71')][_0x75d1('0x1b')]('\x20')});})[_0x75d1('0x18')](function(_0x2cfa15){_0x349134(_0x3b30fb['error'](0x1f5,[_0x41f98f['uniqueid'],_0x2cfa15[_0x75d1('0x17')][_0x75d1('0x65')]()]['join']('\x20')));});}else{return _0x349134(_0x3b30fb[_0x75d1('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x37098c){return new Promise(function(_0x2730f6,_0x30fd13){var _0x4a049e=_[_0x75d1('0x57')](_0x387e35[_0x75d1('0x72')]);_0x2730f6({'count':_0x4a049e[_0x75d1('0x55')],'rows':_0x4a049e});});},'VoiceQueuesChannel':function(_0x1baaca){var _0x4553ff=this;return new Promise(function(_0x50d202,_0x5482db){var _0x3785fd=schema(properties['voicequeuechannel'])[_0x75d1('0x5a')](_0x1baaca);if(_0x3785fd[_0x75d1('0x55')]>0x0){return _0x5482db(_0x4553ff[_0x75d1('0x1a')](0x1f4,_['map'](_0x3785fd,'message')[_0x75d1('0x1b')](',\x20')));}var _0x486977=_[_0x75d1('0x56')](_0x387e35[_0x75d1('0x72')],{'uniqueid':_0x1baaca[_0x75d1('0x5b')]});if(_0x486977){_0x50d202(_0x486977);}else{return _0x5482db(_0x4553ff['error'](0x1f5,_0x75d1('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x353bec){var _0x644ced=this;return new Promise(function(_0x41981f,_0x3e2334){if(ami[_0x75d1('0x19')]()==![]){return _0x3e2334(_0x644ced[_0x75d1('0x1a')](0x1f4,[config[_0x75d1('0xd')]['ip'],config[_0x75d1('0xd')][_0x75d1('0xe')],_0x75d1('0xf')][_0x75d1('0x1b')]('\x20')));}var _0x17eaa5=schema(properties[_0x75d1('0x73')])['validate'](_0x353bec);if(_0x17eaa5['length']>0x0){return _0x3e2334(_0x644ced[_0x75d1('0x1a')](0x1f4,_[_0x75d1('0x74')](_0x17eaa5,'message')[_0x75d1('0x1b')](',\x20')));}var _0x59ec25=_['find'](_0x387e35['queueChannels'],{'uniqueid':_0x353bec[_0x75d1('0x5b')]});if(_0x59ec25&&_0x59ec25[_0x75d1('0x5c')]){return ami[_0x75d1('0x15')]({'action':_0x75d1('0x75'),'channel':_0x59ec25[_0x75d1('0x5c')]})['then'](function(_0x16770a){_0x41981f({'code':0xc8,'message':[_0x353bec[_0x75d1('0x5b')],_0x16770a[_0x75d1('0x17')][_0x75d1('0x65')]()][_0x75d1('0x1b')]('\x20')});})['catch'](function(_0x1113a8){_0x3e2334(_0x644ced['error'](0x1f5,[_0x353bec[_0x75d1('0x5b')],_0x1113a8[_0x75d1('0x17')][_0x75d1('0x65')]()]['join']('\x20')));});}else{return _0x3e2334(_0x644ced['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x7846f2){var _0x71f8f9=this;return new Promise(function(_0x39d9db,_0x22caf3){if(ami[_0x75d1('0x19')]()==![]){return _0x22caf3(_0x71f8f9[_0x75d1('0x1a')](0x1f4,[config['asterisk']['ip'],config[_0x75d1('0xd')][_0x75d1('0xe')],'ami\x20disconnected'][_0x75d1('0x1b')]('\x20')));}var _0x5c16be=schema(properties['voicequeuechannelredirect'])['validate'](_0x7846f2);if(_0x5c16be[_0x75d1('0x55')]>0x0){return _0x22caf3(_0x71f8f9['error'](0x1f4,_['map'](_0x5c16be,_0x75d1('0x17'))['join'](',\x20')));}var _0x451828=_[_0x75d1('0x56')](_0x387e35[_0x75d1('0x72')],{'uniqueid':_0x7846f2[_0x75d1('0x5b')]});if(_0x451828&&_0x451828[_0x75d1('0x5c')]){return ami[_0x75d1('0x15')]({'action':_0x75d1('0x76'),'channel':_0x451828[_0x75d1('0x5c')],'exten':_0x7846f2['exten'],'context':_0x7846f2[_0x75d1('0x77')]||_0x451828['context'],'priority':0x1})[_0x75d1('0x16')](function(_0x3bc88b){_0x39d9db({'code':0xc8,'message':[_0x7846f2[_0x75d1('0x5b')],_0x3bc88b['message'][_0x75d1('0x65')]()][_0x75d1('0x1b')]('\x20')});})[_0x75d1('0x18')](function(_0x13ff2f){_0x22caf3(_0x71f8f9[_0x75d1('0x1a')](0x1f5,[_0x7846f2[_0x75d1('0x5b')],_0x13ff2f[_0x75d1('0x17')]['toLowerCase']()][_0x75d1('0x1b')]('\x20')));});}else{return _0x22caf3(_0x71f8f9[_0x75d1('0x1a')](0x1f5,_0x75d1('0x6c')));}});},'Agents':function(_0x2f166c){return new Promise(function(_0x44143e,_0x4c204d){var _0x4814d8=_[_0x75d1('0x57')](_0x387e35['agents']);_0x44143e({'count':_0x4814d8[_0x75d1('0x55')],'rows':_0x4814d8});});},'Telephones':function(_0x406d5c){return new Promise(function(_0x2187b8,_0x3cc03d){var _0x498137=_['values'](_0x387e35[_0x75d1('0x78')]);_0x2187b8({'count':_0x498137[_0x75d1('0x55')],'rows':_0x498137});});},'Trunks':function(_0x2cf6e0){return new Promise(function(_0x26ab88,_0x35e630){var _0x4bc6a7=_[_0x75d1('0x57')](_0x387e35[_0x75d1('0x79')]);_0x26ab88({'count':_0x4bc6a7['length'],'rows':_0x4bc6a7});});},'OutboundChannels':function(_0x16895a){return new Promise(function(_0xda0e31,_0xa906a6){var _0x2bd440=_[_0x75d1('0x57')](_0x387e35[_0x75d1('0x7a')]);_0xda0e31({'count':_0x2bd440['length'],'rows':_0x2bd440});});},'Outbound':function(_0x145b7f){return new Promise(function(_0x1b026e,_0x39084f){_0x1b026e(_0x387e35[_0x75d1('0x7b')]);});},'Campaigns':function(_0x41a561){return new Promise(function(_0x348a5c,_0x488828){var _0x30214e=_['values'](_0x387e35[_0x75d1('0x7c')]);_0x348a5c({'count':_0x30214e[_0x75d1('0x55')],'rows':_0x30214e});});},'VoiceQueuesPreview':function(_0x184704){var _0x15ac7b=this;return new Promise(function(_0x243ac4,_0x338675){_0x32bd45['run'](_0x184704['id'])[_0x75d1('0x16')](function(_0x8a5c20){_0x243ac4({'code':0xc8,'message':_0x8a5c20[_0x75d1('0x17')]});})['catch'](function(_0x2010da){_0x338675(_0x15ac7b[_0x75d1('0x1a')](0x1f4,_0x2010da['message']));});});},'EventManager':function(_0x5767f4){var _0xbd3b74=this;return new Promise(function(_0x45837a,_0x342038){if(!_0x5767f4[_0x75d1('0x7d')]){return _0x342038(_0xbd3b74[_0x75d1('0x1a')](0x1f4,_0x75d1('0x7e')));}ami[_0x75d1('0x7f')](_0x75d1('0x80')+_0x5767f4['event'],_0x5767f4[_0x75d1('0x17')]);_0x45837a({'code':0xc8,'message':_0x5767f4});});},'FaxAccounts':function(_0x3af2a9){return new Promise(function(_0x4f140b,_0x42e578){var _0x2e9cf1=_['values'](_0x387e35['faxAccounts']);_0x4f140b({'count':_0x2e9cf1[_0x75d1('0x55')],'rows':_0x2e9cf1});});},'SendFax':function(_0x44a017){var _0x4d8e5d=this;return new Promise(function(_0x1f3a7e,_0x533eb0){_0x56ac0a[_0x75d1('0x81')](_0x44a017)['then'](function(_0x45a782){_0x1f3a7e({'code':0xc8,'message':_0x45a782[_0x75d1('0x17')]});})[_0x75d1('0x18')](function(_0x2ed257){_0x533eb0(_0x4d8e5d[_0x75d1('0x1a')](0x1f4,_0x2ed257[_0x75d1('0x17')]));});});},'CheckAfterSend':function(_0x2e4e88){var _0x205e82=this;return new Promise(function(_0x425b3b,_0x709c95){_0x56ac0a[_0x75d1('0x82')](_0x2e4e88)[_0x75d1('0x16')](function(_0x22c444){_0x425b3b({'code':0xc8,'message':_0x22c444[_0x75d1('0x17')]});})[_0x75d1('0x18')](function(_0x8a857){_0x709c95(_0x205e82[_0x75d1('0x1a')](0x1f4,_0x8a857['message']));});});}};var _0x348d74=jayson[_0x75d1('0x83')](_0x5c957a)[_0x75d1('0x84')]();_0x348d74['on'](_0x75d1('0x1a'),function(_0x644bb7){return _0x116a51(_0x644bb7);});_0x348d74[_0x75d1('0x6')](0x232a,_0x75d1('0x85'),function(){console['log'](_0x75d1('0x86'),0x232a);return _0x458681(_0x75d1('0x87')+0x232a);});});}; \ No newline at end of file +var _0xc7a3=['startPredictive','startProgressive','Trunk','Interval','push','length','omit','undefined','values','channels','ami\x20disconnected','map','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','toLowerCase','monitors','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','voicechannel','resolve','StopMixMonitor','destinationchannel','find','stop','/var/spool/asterisk/monitor/','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','trunks','campaigns','run','event','emit','custom:','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','listen','format','%s/%s','name','timers','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','pick','keys','module','Reload','then','message','catch','join','command','Command','Action','content','voiceQueues','hasOwnProperty','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x2efd55,_0x360ac1){_0x2efd55=_0x2efd55-0x0;var _0x5f2405=_0xc7a3[_0x2efd55];return _0x5f2405;};'use strict';var _=require('lodash');var util=require(_0x3c7a('0x0'));var jayson=require(_0x3c7a('0x1'));var schema=require(_0x3c7a('0x2'));var BPromise=require(_0x3c7a('0x3'));var moment=require(_0x3c7a('0x4'));var config=require(_0x3c7a('0x5'));var properties=require('../properties');var ami=require(_0x3c7a('0x6'));exports[_0x3c7a('0x7')]=function(_0x5b06db,_0x9c6b1a,_0x2051ce){return new BPromise(function(_0x2736c1,_0x48e820){var _0x115c8a={'QueuePause':function(_0x4f0608){return new Promise(function(_0x20d36c,_0x5a6fbf){var _0xf7733d=util[_0x3c7a('0x8')](_0x3c7a('0x9'),'SIP',_0x4f0608[_0x3c7a('0xa')]);if(_0x5b06db[_0x3c7a('0xb')]&&_0x5b06db['timers'][_0xf7733d]&&_0x5b06db[_0x3c7a('0xb')][_0xf7733d]['timer']){_0x5b06db[_0x3c7a('0xb')][_0xf7733d]['updateAcw']();}if(_0x5b06db[_0x3c7a('0xc')][_0xf7733d]){_0x5b06db[_0x3c7a('0xc')][_0xf7733d][_0x3c7a('0xd')]({'statePause':_0x4f0608[_0x3c7a('0xe')]?!![]:![]});}_0x20d36c({'code':0xc8,'message':_0x3c7a('0xf')});});},'Reload':function(_0x53e5d7){var _0x321e1b=this;return new Promise(function(_0xc61ff3,_0x4103db){if(ami[_0x3c7a('0x10')]()==![]){return _0x4103db(_0x321e1b[_0x3c7a('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x3c7a('0x12')][_0x3c7a('0x13')],'ami\x20disconnected']['join']('\x20')));}_0x53e5d7=_[_0x3c7a('0x14')](_0x53e5d7,_[_0x3c7a('0x15')](properties[_0x3c7a('0x16')]));_0x53e5d7['action']=_0x3c7a('0x17');return ami['Action'](_0x53e5d7)[_0x3c7a('0x18')](function(_0x22e7a5){_0xc61ff3({'code':0xc8,'message':_0x22e7a5[_0x3c7a('0x19')]});})[_0x3c7a('0x1a')](function(_0x3cb5bf){_0x4103db(_0x321e1b[_0x3c7a('0x11')](0x1f5,_0x3cb5bf['message']));});});},'Command':function(_0x1a11ef){var _0x2db9df=this;return new Promise(function(_0x3f0024,_0xbe7a8f){if(ami[_0x3c7a('0x10')]()==![]){return _0xbe7a8f(_0x2db9df[_0x3c7a('0x11')](0x1f4,[config[_0x3c7a('0x12')]['ip'],config[_0x3c7a('0x12')][_0x3c7a('0x13')],'ami\x20disconnected'][_0x3c7a('0x1b')]('\x20')));}_0x1a11ef=_['pick'](_0x1a11ef,_0x3c7a('0x1c'));_0x1a11ef['action']=_0x3c7a('0x1d');return ami[_0x3c7a('0x1e')](_0x1a11ef)[_0x3c7a('0x18')](function(_0x7dbe38){_0x3f0024({'code':0xc8,'message':_0x7dbe38[_0x3c7a('0x1f')]});})[_0x3c7a('0x1a')](function(_0x8251d4){_0xbe7a8f(_0x2db9df[_0x3c7a('0x11')](0x1f5,_0x8251d4[_0x3c7a('0x19')]));});});},'VoiceQueues':function(_0x42bcbe){return new Promise(function(_0x2cc413,_0x317fbd){var _0x56539f=[];for(var _0x3984a1 in _0x5b06db[_0x3c7a('0x20')]){if(_0x5b06db[_0x3c7a('0x20')][_0x3c7a('0x21')](_0x3984a1)){var _0x9b910c=_0x5b06db[_0x3c7a('0x20')][_0x3984a1];var _0x2c000f={'id':_0x9b910c['id'],'name':_0x9b910c[_0x3c7a('0xa')],'strategy':_0x9b910c['strategy'],'answered':_0x9b910c[_0x3c7a('0x22')],'available':_0x9b910c[_0x3c7a('0x23')],'loggedIn':_0x9b910c[_0x3c7a('0x24')],'pTalking':_0x9b910c[_0x3c7a('0x25')],'sumBillable':_0x9b910c[_0x3c7a('0x26')],'sumDuration':_0x9b910c[_0x3c7a('0x27')],'sumHoldTime':_0x9b910c[_0x3c7a('0x28')]||0x0,'talking':_0x9b910c[_0x3c7a('0x29')],'total':_0x9b910c[_0x3c7a('0x2a')],'type':_0x9b910c[_0x3c7a('0x2b')],'unmanaged':_0x9b910c[_0x3c7a('0x2c')],'abandoned':_0x9b910c[_0x3c7a('0x2d')],'waiting':_0x9b910c[_0x3c7a('0x2e')],'loggedInDb':_0x9b910c[_0x3c7a('0x2f')]};if(_0x9b910c[_0x3c7a('0x2b')]===_0x3c7a('0x30')){_0x2c000f[_0x3c7a('0x31')]=_0x9b910c[_0x3c7a('0x31')];_0x2c000f[_0x3c7a('0x32')]=_0x9b910c[_0x3c7a('0x32')];_0x2c000f[_0x3c7a('0x33')]=_0x9b910c[_0x3c7a('0x33')];_0x2c000f['dialOriginateCallerIdNumber']=_0x9b910c['dialOriginateCallerIdNumber'];_0x2c000f['dialOriginateTimeout']=_0x9b910c['dialOriginateTimeout'];_0x2c000f[_0x3c7a('0x34')]=_0x9b910c[_0x3c7a('0x34')];_0x2c000f[_0x3c7a('0x35')]=_0x9b910c[_0x3c7a('0x35')];_0x2c000f[_0x3c7a('0x36')]=_0x9b910c[_0x3c7a('0x36')];_0x2c000f[_0x3c7a('0x37')]=_0x9b910c[_0x3c7a('0x37')];_0x2c000f[_0x3c7a('0x38')]=_0x9b910c[_0x3c7a('0x38')];_0x2c000f[_0x3c7a('0x39')]=_0x9b910c[_0x3c7a('0x39')];_0x2c000f[_0x3c7a('0x3a')]=_0x9b910c[_0x3c7a('0x3a')];_0x2c000f['outboundDropCallsDayACS']=_0x9b910c[_0x3c7a('0x3b')];_0x2c000f[_0x3c7a('0x3c')]=_0x9b910c['outboundDropCallsDayCallersExit'];_0x2c000f[_0x3c7a('0x3d')]=_0x9b910c['outboundDropCallsDayTimeout'];_0x2c000f[_0x3c7a('0x3e')]=_0x9b910c[_0x3c7a('0x3e')];_0x2c000f['outboundNoSuchCallsDay']=_0x9b910c[_0x3c7a('0x3f')];_0x2c000f[_0x3c7a('0x40')]=_0x9b910c[_0x3c7a('0x40')];_0x2c000f[_0x3c7a('0x41')]=_0x9b910c[_0x3c7a('0x41')];_0x2c000f[_0x3c7a('0x42')]=_0x9b910c[_0x3c7a('0x42')];_0x2c000f[_0x3c7a('0x43')]=_0x9b910c[_0x3c7a('0x43')];_0x2c000f[_0x3c7a('0x44')]=_0x9b910c['predictiveIntervalAnsweredCalls'];_0x2c000f[_0x3c7a('0x45')]=_0x9b910c[_0x3c7a('0x45')];_0x2c000f[_0x3c7a('0x46')]=_0x9b910c[_0x3c7a('0x46')];_0x2c000f[_0x3c7a('0x47')]=_0x9b910c[_0x3c7a('0x47')];_0x2c000f[_0x3c7a('0x48')]=_0x9b910c[_0x3c7a('0x48')];_0x2c000f['predictiveIntervalErlangCalls']=_0x9b910c[_0x3c7a('0x49')];_0x2c000f[_0x3c7a('0x4a')]=_0x9b910c['predictiveIntervalErlangCallsDroppedCalls'];_0x2c000f[_0x3c7a('0x4b')]=_0x9b910c['predictiveIntervalHitRate'];_0x2c000f['predictiveIntervalMultiplicativeFactor']=_0x9b910c['predictiveIntervalMultiplicativeFactor'];_0x2c000f['predictiveIntervalPauses']=_0x9b910c[_0x3c7a('0x4c')];_0x2c000f[_0x3c7a('0x4d')]=_0x9b910c[_0x3c7a('0x4d')];_0x2c000f['predictiveIntervalTotalCalls']=_0x9b910c[_0x3c7a('0x4e')];_0x2c000f[_0x3c7a('0x19')]=_0x9b910c['message'];_0x2c000f['originated']=_0x9b910c['originated'];_0x2c000f[_0x3c7a('0x4f')]=_0x9b910c[_0x3c7a('0x4f')];_0x2c000f[_0x3c7a('0x50')]=_0x9b910c[_0x3c7a('0x50')];_0x2c000f[_0x3c7a('0x51')]=_0x9b910c[_0x3c7a('0x51')];_0x2c000f[_0x3c7a('0x52')]=_0x9b910c[_0x3c7a('0x52')];_0x2c000f[_0x3c7a('0x53')]=_0x9b910c[_0x3c7a('0x53')];_0x2c000f[_0x3c7a('0x54')]=_0x9b910c[_0x3c7a('0x54')];}if(_0x9b910c[_0x3c7a('0x55')]){_0x2c000f[_0x3c7a('0x55')]={'id':_0x9b910c[_0x3c7a('0x55')]['id'],'name':_0x9b910c['Trunk'][_0x3c7a('0xa')],'active':_0x9b910c[_0x3c7a('0x55')]['active'],'callerid':_0x9b910c['Trunk']['callerid']};}if(_0x9b910c[_0x3c7a('0x56')]){_0x2c000f[_0x3c7a('0x56')]={'id':_0x9b910c[_0x3c7a('0x56')]['id'],'name':_0x9b910c[_0x3c7a('0x56')][_0x3c7a('0xa')]};}_0x56539f[_0x3c7a('0x57')](_0x2c000f);}}_0x2cc413({'count':_0x56539f[_0x3c7a('0x58')],'rows':_0x56539f});});},'UpdateVoiceQueue':function(_0x3701c5){return new Promise(function(_0x1f70c4,_0x261cfc){var _0x446791=_['find'](_0x5b06db['voiceQueues'],{'id':parseInt(_0x3701c5['id'])});var _0x5bf455=_[_0x3c7a('0x59')](_0x3701c5,['id']);if(_0x446791){for(var _0x323a4d in _0x5bf455){if(typeof _0x5bf455[_0x323a4d]!==_0x3c7a('0x5a')&&typeof _0x446791[_0x323a4d]!==_0x3c7a('0x5a')){_0x446791[_0x323a4d]=_0x5bf455[_0x323a4d];}}_0x1f70c4(_0x446791);}else{_0x261cfc();}});},'VoiceChannels':function(_0x229862){return new Promise(function(_0x5d8062,_0xd67159){var _0x12b69a=_[_0x3c7a('0x5b')](_0x5b06db[_0x3c7a('0x5c')]);_0x5d8062({'count':_0x12b69a[_0x3c7a('0x58')],'rows':_0x12b69a});});},'VoiceChannelMixMonitor':function(_0x1e3cc7){var _0x330572=this;return new Promise(function(_0x5362ec,_0x519831){if(ami[_0x3c7a('0x10')]()==![]){return _0x519831(_0x330572[_0x3c7a('0x11')](0x1f4,[config[_0x3c7a('0x12')]['ip'],config[_0x3c7a('0x12')][_0x3c7a('0x13')],_0x3c7a('0x5d')]['join']('\x20')));}var _0x22fbd0=schema(properties['voicechannel'])['validate'](_0x1e3cc7);if(_0x22fbd0[_0x3c7a('0x58')]>0x0){return _0x519831(_0x330572[_0x3c7a('0x11')](0x1f4,_[_0x3c7a('0x5e')](_0x22fbd0,'message')['join'](',\x20')));}var _0x4ba11a=_['find'](_0x5b06db[_0x3c7a('0x5c')],{'uniqueid':_0x1e3cc7[_0x3c7a('0x5f')]});if(_0x4ba11a&&_0x4ba11a[_0x3c7a('0x60')]){var _0x1a26ed=util[_0x3c7a('0x8')](_0x3c7a('0x61'),_0x1e3cc7[_0x3c7a('0x62')]||_0x1e3cc7[_0x3c7a('0x5f')],_0x1e3cc7[_0x3c7a('0x8')]||_0x3c7a('0x63'));return ami[_0x3c7a('0x1e')]({'action':_0x3c7a('0x64'),'channel':_0x4ba11a[_0x3c7a('0x60')],'file':_0x1a26ed,'options':_0x3c7a('0x65')})[_0x3c7a('0x18')](function(_0x5eb534){var _0x565335=_['find'](_0x4ba11a['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x1a26ed[_0x3c7a('0x66')]()});if(_['isNil'](_0x565335)){_0x4ba11a[_0x3c7a('0x67')][_0x3c7a('0x57')]({'filename':'/var/spool/asterisk/monitor/'+_0x1a26ed[_0x3c7a('0x66')](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x5eb534[_0x3c7a('0x68')],'status':_0x3c7a('0x69')});}else{_0x565335[_0x3c7a('0x68')]=_0x5eb534['mixmonitorid'];_0x565335[_0x3c7a('0x6a')]='rec';}_0x5362ec({'code':0xc8,'message':[_0x1e3cc7[_0x3c7a('0x5f')],'MixMonitor\x20Success',_0x5eb534[_0x3c7a('0x68')]][_0x3c7a('0x1b')]('\x20'),'mixmonitorid':_0x5eb534['mixmonitorid']});})[_0x3c7a('0x1a')](function(_0x16ef19){_0x519831(_0x330572[_0x3c7a('0x11')](0x1f5,[_0x1e3cc7[_0x3c7a('0x5f')],_0x16ef19[_0x3c7a('0x19')][_0x3c7a('0x66')]()][_0x3c7a('0x1b')]('\x20')));});}else{return _0x519831(_0x330572['error'](0x1f5,_0x3c7a('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x1db008){var _0x5adbca=this;return new Promise(function(_0x2eeea4,_0x5d8d5d){if(ami[_0x3c7a('0x10')]()==![]){return _0x5d8d5d(_0x5adbca[_0x3c7a('0x11')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x3c7a('0x13')],_0x3c7a('0x5d')]['join']('\x20')));}var _0x3a3341=schema(properties[_0x3c7a('0x6c')])[_0x3c7a('0x2')](_0x1db008);if(_0x3a3341[_0x3c7a('0x58')]>0x0){return _0x5d8d5d(_0x5adbca['error'](0x1f4,_[_0x3c7a('0x5e')](_0x3a3341,'message')[_0x3c7a('0x1b')](',\x20')));}var _0x11c49f=_['find'](_0x5b06db['channels'],{'uniqueid':_0x1db008['uniqueid']});if(_0x11c49f){return BPromise[_0x3c7a('0x6d')]()[_0x3c7a('0x18')](function(){if(_0x11c49f[_0x3c7a('0x60')]){return ami[_0x3c7a('0x1e')]({'action':_0x3c7a('0x6e'),'channel':_0x11c49f[_0x3c7a('0x60')],'mixmonitorid':_0x1db008[_0x3c7a('0x68')]})['catch'](function(_0x115390){});}})[_0x3c7a('0x18')](function(){if(_0x11c49f['destinationchannel']){return ami['Action']({'action':_0x3c7a('0x6e'),'channel':_0x11c49f[_0x3c7a('0x6f')],'mixmonitorid':_0x1db008[_0x3c7a('0x68')]})['catch'](function(_0x3c7fb5){});}})[_0x3c7a('0x18')](function(_0x1ab8d9){var _0xd2170a=_[_0x3c7a('0x70')](_0x11c49f[_0x3c7a('0x67')],{'mixmonitorid':_0x1db008[_0x3c7a('0x68')]});if(_0xd2170a){_0xd2170a[_0x3c7a('0x6a')]=_0x3c7a('0x71');}})[_0x3c7a('0x18')](function(){var _0x5c36df=util[_0x3c7a('0x8')](_0x3c7a('0x61'),_0x1db008[_0x3c7a('0x62')]||_0x1db008['uniqueid'],_0x1db008[_0x3c7a('0x8')]||'wav');var _0x44829d=_['find'](_0x11c49f['monitors'],{'filename':_0x3c7a('0x72')+_0x5c36df[_0x3c7a('0x66')]()});if(_0x44829d){_0x44829d[_0x3c7a('0x6a')]='stop';}})[_0x3c7a('0x18')](function(){_0x2eeea4({'code':0xc8,'message':[_0x1db008[_0x3c7a('0x5f')],'StopMixMonitor\x20Success'][_0x3c7a('0x1b')]('\x20')});})[_0x3c7a('0x1a')](function(_0x2e6fe9){_0x5d8d5d(_0x5adbca['error'](0x1f5,[_0x1db008[_0x3c7a('0x5f')],_0x2e6fe9[_0x3c7a('0x19')][_0x3c7a('0x66')]()][_0x3c7a('0x1b')]('\x20')));});}else{return _0x5d8d5d(_0x5adbca[_0x3c7a('0x11')](0x1f5,_0x3c7a('0x6b')));}});},'VoiceQueuesChannels':function(_0x53a92a){return new Promise(function(_0x215fad,_0x1ced2f){var _0xb12efb=_['values'](_0x5b06db[_0x3c7a('0x73')]);_0x215fad({'count':_0xb12efb[_0x3c7a('0x58')],'rows':_0xb12efb});});},'VoiceQueuesChannel':function(_0x50b0e5){var _0x56bc3f=this;return new Promise(function(_0x3a2728,_0x55307f){var _0x3a0151=schema(properties[_0x3c7a('0x74')])[_0x3c7a('0x2')](_0x50b0e5);if(_0x3a0151['length']>0x0){return _0x55307f(_0x56bc3f[_0x3c7a('0x11')](0x1f4,_[_0x3c7a('0x5e')](_0x3a0151,_0x3c7a('0x19'))[_0x3c7a('0x1b')](',\x20')));}var _0x3e976b=_[_0x3c7a('0x70')](_0x5b06db[_0x3c7a('0x73')],{'uniqueid':_0x50b0e5[_0x3c7a('0x5f')]});if(_0x3e976b){_0x3a2728(_0x3e976b);}else{return _0x55307f(_0x56bc3f[_0x3c7a('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x2646db){var _0x205938=this;return new Promise(function(_0x589289,_0xd7d5d7){if(ami[_0x3c7a('0x10')]()==![]){return _0xd7d5d7(_0x205938[_0x3c7a('0x11')](0x1f4,[config[_0x3c7a('0x12')]['ip'],config['asterisk'][_0x3c7a('0x13')],'ami\x20disconnected']['join']('\x20')));}var _0x5d4f9f=schema(properties[_0x3c7a('0x75')])['validate'](_0x2646db);if(_0x5d4f9f[_0x3c7a('0x58')]>0x0){return _0xd7d5d7(_0x205938[_0x3c7a('0x11')](0x1f4,_[_0x3c7a('0x5e')](_0x5d4f9f,_0x3c7a('0x19'))[_0x3c7a('0x1b')](',\x20')));}var _0x3a0774=_[_0x3c7a('0x70')](_0x5b06db['queueChannels'],{'uniqueid':_0x2646db[_0x3c7a('0x5f')]});if(_0x3a0774&&_0x3a0774[_0x3c7a('0x60')]){return ami[_0x3c7a('0x1e')]({'action':_0x3c7a('0x76'),'channel':_0x3a0774['channel']})[_0x3c7a('0x18')](function(_0x177ca7){_0x589289({'code':0xc8,'message':[_0x2646db['uniqueid'],_0x177ca7[_0x3c7a('0x19')]['toLowerCase']()][_0x3c7a('0x1b')]('\x20')});})[_0x3c7a('0x1a')](function(_0x335694){_0xd7d5d7(_0x205938[_0x3c7a('0x11')](0x1f5,[_0x2646db[_0x3c7a('0x5f')],_0x335694[_0x3c7a('0x19')][_0x3c7a('0x66')]()][_0x3c7a('0x1b')]('\x20')));});}else{return _0xd7d5d7(_0x205938['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x23722c){var _0x4cdf9d=this;return new Promise(function(_0x44aad1,_0x33b91d){if(ami[_0x3c7a('0x10')]()==![]){return _0x33b91d(_0x4cdf9d[_0x3c7a('0x11')](0x1f4,[config[_0x3c7a('0x12')]['ip'],config[_0x3c7a('0x12')]['username'],'ami\x20disconnected'][_0x3c7a('0x1b')]('\x20')));}var _0x2b6c5f=schema(properties[_0x3c7a('0x77')])[_0x3c7a('0x2')](_0x23722c);if(_0x2b6c5f['length']>0x0){return _0x33b91d(_0x4cdf9d[_0x3c7a('0x11')](0x1f4,_['map'](_0x2b6c5f,'message')[_0x3c7a('0x1b')](',\x20')));}var _0x38ba3e=_[_0x3c7a('0x70')](_0x5b06db[_0x3c7a('0x73')],{'uniqueid':_0x23722c[_0x3c7a('0x5f')]});if(_0x38ba3e&&_0x38ba3e['channel']){return ami[_0x3c7a('0x1e')]({'action':_0x3c7a('0x78'),'channel':_0x38ba3e[_0x3c7a('0x60')],'exten':_0x23722c['exten'],'context':_0x23722c[_0x3c7a('0x79')]||_0x38ba3e[_0x3c7a('0x79')],'priority':0x1})['then'](function(_0x10b2fc){_0x44aad1({'code':0xc8,'message':[_0x23722c[_0x3c7a('0x5f')],_0x10b2fc[_0x3c7a('0x19')]['toLowerCase']()][_0x3c7a('0x1b')]('\x20')});})[_0x3c7a('0x1a')](function(_0x57f9b7){_0x33b91d(_0x4cdf9d[_0x3c7a('0x11')](0x1f5,[_0x23722c['uniqueid'],_0x57f9b7[_0x3c7a('0x19')][_0x3c7a('0x66')]()][_0x3c7a('0x1b')]('\x20')));});}else{return _0x33b91d(_0x4cdf9d[_0x3c7a('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x1d5b57){return new Promise(function(_0x29d45c,_0x3a1991){var _0x24c0a1=_[_0x3c7a('0x5b')](_0x5b06db[_0x3c7a('0xc')]);_0x29d45c({'count':_0x24c0a1[_0x3c7a('0x58')],'rows':_0x24c0a1});});},'Telephones':function(_0x3afc6b){return new Promise(function(_0xecd1f7,_0x4e0757){var _0x523f40=_[_0x3c7a('0x5b')](_0x5b06db['telephones']);_0xecd1f7({'count':_0x523f40['length'],'rows':_0x523f40});});},'Trunks':function(_0x1a9f26){return new Promise(function(_0x1354fd,_0x2acdc7){var _0x472d00=_[_0x3c7a('0x5b')](_0x5b06db[_0x3c7a('0x7a')]);_0x1354fd({'count':_0x472d00[_0x3c7a('0x58')],'rows':_0x472d00});});},'OutboundChannels':function(_0x54122c){return new Promise(function(_0x158c30,_0x423077){var _0x4ea13a=_[_0x3c7a('0x5b')](_0x5b06db['outboundChannels']);_0x158c30({'count':_0x4ea13a[_0x3c7a('0x58')],'rows':_0x4ea13a});});},'Outbound':function(_0x5ad537){return new Promise(function(_0x4b3074,_0x403f19){_0x4b3074(_0x5b06db[_0x3c7a('0x30')]);});},'Campaigns':function(_0x4268bf){return new Promise(function(_0x4593e2,_0x2efa30){var _0xada250=_[_0x3c7a('0x5b')](_0x5b06db[_0x3c7a('0x7b')]);_0x4593e2({'count':_0xada250[_0x3c7a('0x58')],'rows':_0xada250});});},'VoiceQueuesPreview':function(_0x577dc0){var _0x55fb9b=this;return new Promise(function(_0x22b0e2,_0x101d5e){_0x9c6b1a[_0x3c7a('0x7c')](_0x577dc0['id'])[_0x3c7a('0x18')](function(_0x298f3b){_0x22b0e2({'code':0xc8,'message':_0x298f3b[_0x3c7a('0x19')]});})[_0x3c7a('0x1a')](function(_0x13c3e1){_0x101d5e(_0x55fb9b['error'](0x1f4,_0x13c3e1[_0x3c7a('0x19')]));});});},'EventManager':function(_0x56ec85){var _0x7c618f=this;return new Promise(function(_0x36419c,_0x554f87){if(!_0x56ec85[_0x3c7a('0x7d')]){return _0x554f87(_0x7c618f[_0x3c7a('0x11')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x3c7a('0x7e')](_0x3c7a('0x7f')+_0x56ec85[_0x3c7a('0x7d')],_0x56ec85['message']);_0x36419c({'code':0xc8,'message':_0x56ec85});});},'FaxAccounts':function(_0x369e4a){return new Promise(function(_0x4f5b7f,_0x1846c8){var _0x34ba52=_[_0x3c7a('0x5b')](_0x5b06db[_0x3c7a('0x80')]);_0x4f5b7f({'count':_0x34ba52[_0x3c7a('0x58')],'rows':_0x34ba52});});},'SendFax':function(_0x1e5f89){var _0x37178b=this;return new Promise(function(_0x19fe75,_0x43496a){_0x2051ce[_0x3c7a('0x81')](_0x1e5f89)[_0x3c7a('0x18')](function(_0x50b5a5){_0x19fe75({'code':0xc8,'message':_0x50b5a5[_0x3c7a('0x19')]});})[_0x3c7a('0x1a')](function(_0x202508){_0x43496a(_0x37178b['error'](0x1f4,_0x202508['message']));});});},'CheckAfterSend':function(_0x4ed6ee){var _0x382022=this;return new Promise(function(_0x501c18,_0x369429){_0x2051ce[_0x3c7a('0x82')](_0x4ed6ee)['then'](function(_0x5266c7){_0x501c18({'code':0xc8,'message':_0x5266c7['message']});})[_0x3c7a('0x1a')](function(_0x53a5b7){_0x369429(_0x382022[_0x3c7a('0x11')](0x1f4,_0x53a5b7[_0x3c7a('0x19')]));});});}};var _0x13f2d0=jayson[_0x3c7a('0x83')](_0x115c8a)['http']();_0x13f2d0['on'](_0x3c7a('0x11'),function(_0x386355){return _0x48e820(_0x386355);});_0x13f2d0[_0x3c7a('0x7')](0x232a,_0x3c7a('0x84'),function(){console[_0x3c7a('0x85')](_0x3c7a('0x86'),0x232a);return _0x2736c1(_0x3c7a('0x87')+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 5179b39..cff738d 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 _0x2c60=['Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','firstName','format','user:%s','name','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','stringify','exec','data1','data2','data3','split','phone','routeId','calleridnum','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','getContacts','then','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','destcalleridnum','calleridname',''];(function(_0x5f0d16,_0x13eb7a){var _0x15bba4=function(_0x2c877a){while(--_0x2c877a){_0x5f0d16['push'](_0x5f0d16['shift']());}};_0x15bba4(++_0x13eb7a);}(_0x2c60,0xe8));var _0x02c6=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x2c60[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0x02c6('0x0'));var BPromise=require(_0x02c6('0x1'));var Redis=require(_0x02c6('0x2'));var util=require(_0x02c6('0x3'));var config=require(_0x02c6('0x4'));var logger=require(_0x02c6('0x5'))(_0x02c6('0x6'));var cmContactRpc=require(_0x02c6('0x7'));config[_0x02c6('0x8')]=_['defaults'](config[_0x02c6('0x8')],{'host':_0x02c6('0x9'),'port':0x18eb});var io=require(_0x02c6('0xa'))(new Redis(config[_0x02c6('0x8')]));function emit(_0x5c128c,_0x13719b,_0x343a4c,_0x44b48f,_0x45cb9b){logger['info']('[CM][%s][%s]',_0x5c128c,_0x13719b['id'],_0x343a4c,_0x44b48f,JSON[_0x02c6('0xb')](_0x45cb9b));io['to'](_0x343a4c)['emit'](_0x44b48f,_0x45cb9b);}exports[_0x02c6('0xc')]=function(_0x3c51a5,_0x1c2b71,_0x4f81b5,_0x5af255){var _0x5618eb,_0x43ec7d;var _0x2cd8c2={};var _0x11f078=Number(_0x4f81b5[_0x02c6('0xd')]);var _0x2d8735=_0x4f81b5[_0x02c6('0xe')]?Boolean(Number(_0x4f81b5['data2'])):![];var _0x2f548b;if(_0x5af255['xmd-contactid']){_0x2cd8c2['id']=_0x5af255['xmd-contactid'];}if(!_0x2cd8c2['id']){_0x2cd8c2['ListId']=_0x11f078;_0x2f548b=_0x4f81b5[_0x02c6('0xf')]&&_0x4f81b5[_0x02c6('0xf')]!=='0'?_0x4f81b5[_0x02c6('0xf')][_0x02c6('0x10')](','):[_0x02c6('0x11')];_0x2cd8c2['$or']=_['map'](_0x2f548b,function(_0x284b4){var _0x3e1f54={};_0x3e1f54[_0x284b4]=_0x5af255[_0x02c6('0x12')]?_0x5af255['destcalleridnum']:_0x5af255[_0x02c6('0x13')];return _0x3e1f54;});}var _0x18f22e=['id','firstName',_0x02c6('0x14'),_0x02c6('0x11'),_0x02c6('0x15'),_0x02c6('0x16'),'ListId',_0x02c6('0x17'),_0x02c6('0x18'),_0x02c6('0x19')];var _0x3e38b5=_['union'](_0x18f22e,_0x2f548b);BPromise[_0x02c6('0x1a')]()['then'](cmContactRpc[_0x02c6('0x1b')]({'attributes':_0x3e38b5,'where':_0x2cd8c2}))[_0x02c6('0x1c')](function(_0xf8682e){_0x43ec7d=_0xf8682e;if(!_[_0x02c6('0x1d')](_0x43ec7d)){if(_0x43ec7d[_0x02c6('0x1e')]===0x1){_0x5618eb=_0x43ec7d[0x0];logger[_0x02c6('0x1f')](_0x02c6('0x20'),_0x5af255[_0x02c6('0x21')],_0x1c2b71['id'],_0x5618eb['id']);}else{logger[_0x02c6('0x1f')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x5af255[_0x02c6('0x21')],_0x1c2b71['id'],_[_0x02c6('0x22')](_0x43ec7d,'id')[_0x02c6('0x23')](','));}return;}else{logger[_0x02c6('0x1f')](_0x02c6('0x24'),_0x5af255[_0x02c6('0x21')],_0x1c2b71['id']);var _0x110495={'ListId':_0x11f078};var _0xc6125b=_0x4f81b5[_0x02c6('0x25')]&&_0x4f81b5[_0x02c6('0x25')]!=='0'?_0x4f81b5[_0x02c6('0x25')]:_0x02c6('0x11');if(_0x2d8735){logger[_0x02c6('0x1f')](_0x02c6('0x26'),_0x5af255[_0x02c6('0x21')],_0x1c2b71['id']);_0x110495[_0xc6125b]=_[_0x02c6('0x27')](_0x5af255[_0x02c6('0x12')])?_0x5af255[_0x02c6('0x13')]:_0x5af255[_0x02c6('0x28')];if(_[_0x02c6('0x27')](_0x5af255[_0x02c6('0x12')])){_0x110495['firstName']=_0x5af255[_0x02c6('0x29')]&&_0x5af255[_0x02c6('0x29')]!==_0x02c6('0x2a')?_0x5af255['calleridname']:_0x02c6('0x2b');}else{_0x110495['firstName']=_0x5af255['destcalleridname']&&_0x5af255[_0x02c6('0x2c')]!==_0x02c6('0x2a')?_0x5af255[_0x02c6('0x2c')]:_0x02c6('0x2b');}return BPromise['resolve']()[_0x02c6('0x1c')](cmContactRpc[_0x02c6('0x2d')](_0x110495))[_0x02c6('0x1c')](function(_0x484e59){_0x5618eb=_0x484e59;_0x43ec7d[_0x02c6('0x2e')](_0x484e59);if(_0x5618eb){logger[_0x02c6('0x1f')](_0x02c6('0x2f'),_0x5af255[_0x02c6('0x21')],_0x1c2b71['id'],_0x5618eb['id']);}return;});}else{logger[_0x02c6('0x1f')](_0x02c6('0x30'),_0x5af255[_0x02c6('0x21')],_0x1c2b71['id']);_0x110495[_0xc6125b]=_[_0x02c6('0x27')](_0x5af255['routeId'])?_0x5af255[_0x02c6('0x13')]:_0x5af255[_0x02c6('0x28')];if(_[_0x02c6('0x27')](_0x5af255[_0x02c6('0x12')])){_0x110495[_0x02c6('0x31')]=_0x5af255[_0x02c6('0x29')]&&_0x5af255[_0x02c6('0x29')]!==_0x02c6('0x2a')?_0x5af255[_0x02c6('0x29')]:_0x02c6('0x2b');}else{_0x110495[_0x02c6('0x31')]=_0x5af255[_0x02c6('0x2c')]&&_0x5af255[_0x02c6('0x2c')]!==_0x02c6('0x2a')?_0x5af255['destcalleridname']:_0x02c6('0x2b');}_0x5618eb=_0x110495;_0x43ec7d[_0x02c6('0x2e')](_0x110495);return;}}})[_0x02c6('0x1c')](function(){if(_0x3c51a5){emit(_0x5af255[_0x02c6('0x21')],_0x1c2b71,util[_0x02c6('0x32')](_0x02c6('0x33'),_0x3c51a5[_0x02c6('0x34')]),util[_0x02c6('0x32')]('trigger:%s',_0x4f81b5['action'][_0x02c6('0x35')]()),{'evt':_[_0x02c6('0x36')](_0x5af255,{'autoCreate':_0x2d8735}),'contact':_0x5618eb===undefined?{}:_0x5618eb,'contacts':_0x43ec7d[_0x02c6('0x1e')]===0x0?undefined:_0x43ec7d});}});}; \ No newline at end of file +var _0xddd8=['createdAt','updatedAt','then','getContacts','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','calleridnum','Unknown','user:%s','name','format','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','map','routeId','firstName','mobile','fax'];(function(_0x4ae263,_0x618f5a){var _0x41a5e5=function(_0x5a094d){while(--_0x5a094d){_0x4ae263['push'](_0x4ae263['shift']());}};_0x41a5e5(++_0x618f5a);}(_0xddd8,0x12a));var _0x8ddd=function(_0x2198d7,_0x5eb7df){_0x2198d7=_0x2198d7-0x0;var _0x43b02e=_0xddd8[_0x2198d7];return _0x43b02e;};'use strict';var _=require(_0x8ddd('0x0'));var BPromise=require(_0x8ddd('0x1'));var Redis=require(_0x8ddd('0x2'));var util=require(_0x8ddd('0x3'));var config=require(_0x8ddd('0x4'));var logger=require(_0x8ddd('0x5'))(_0x8ddd('0x6'));var cmContactRpc=require(_0x8ddd('0x7'));config[_0x8ddd('0x8')]=_['defaults'](config['redis'],{'host':_0x8ddd('0x9'),'port':0x18eb});var io=require(_0x8ddd('0xa'))(new Redis(config['redis']));function emit(_0x1086c5,_0x2affc8,_0x513ce3,_0x3a6feb,_0x1d1eb9){logger['info'](_0x8ddd('0xb'),_0x1086c5,_0x2affc8['id'],_0x513ce3,_0x3a6feb,JSON[_0x8ddd('0xc')](_0x1d1eb9));io['to'](_0x513ce3)[_0x8ddd('0xd')](_0x3a6feb,_0x1d1eb9);}exports[_0x8ddd('0xe')]=function(_0x48faa8,_0x9a7b86,_0x2c0682,_0x59c7cd){var _0x13a77d,_0x17e4b4;var _0x20b7ab={};var _0x51a5cc=Number(_0x2c0682[_0x8ddd('0xf')]);var _0x5a9ba0=_0x2c0682[_0x8ddd('0x10')]?Boolean(Number(_0x2c0682['data2'])):![];var _0x1ffd69;if(_0x59c7cd[_0x8ddd('0x11')]){_0x20b7ab['id']=_0x59c7cd[_0x8ddd('0x11')];}if(!_0x20b7ab['id']){_0x20b7ab[_0x8ddd('0x12')]=_0x51a5cc;_0x1ffd69=_0x2c0682[_0x8ddd('0x13')]&&_0x2c0682[_0x8ddd('0x13')]!=='0'?_0x2c0682[_0x8ddd('0x13')][_0x8ddd('0x14')](','):['phone'];_0x20b7ab['$or']=_[_0x8ddd('0x15')](_0x1ffd69,function(_0x5e099e){var _0x2d8359={};_0x2d8359[_0x5e099e]=_0x59c7cd[_0x8ddd('0x16')]?_0x59c7cd['destcalleridnum']:_0x59c7cd['calleridnum'];return _0x2d8359;});}var _0x1ec3b7=['id',_0x8ddd('0x17'),'lastName','phone',_0x8ddd('0x18'),_0x8ddd('0x19'),_0x8ddd('0x12'),_0x8ddd('0x1a'),'scheduledAt',_0x8ddd('0x1b')];var _0x419bf3=_['union'](_0x1ec3b7,_0x1ffd69);BPromise['resolve']()[_0x8ddd('0x1c')](cmContactRpc[_0x8ddd('0x1d')]({'attributes':_0x419bf3,'where':_0x20b7ab}))[_0x8ddd('0x1c')](function(_0x181b6c){_0x17e4b4=_0x181b6c;if(!_['isEmpty'](_0x17e4b4)){if(_0x17e4b4[_0x8ddd('0x1e')]===0x1){_0x13a77d=_0x17e4b4[0x0];logger[_0x8ddd('0x1f')](_0x8ddd('0x20'),_0x59c7cd[_0x8ddd('0x21')],_0x9a7b86['id'],_0x13a77d['id']);}else{logger[_0x8ddd('0x1f')](_0x8ddd('0x22'),_0x59c7cd[_0x8ddd('0x21')],_0x9a7b86['id'],_[_0x8ddd('0x15')](_0x17e4b4,'id')[_0x8ddd('0x23')](','));}return;}else{logger[_0x8ddd('0x1f')](_0x8ddd('0x24'),_0x59c7cd['uniqueid'],_0x9a7b86['id']);var _0x31d12b={'ListId':_0x51a5cc};var _0x167dc3=_0x2c0682[_0x8ddd('0x25')]&&_0x2c0682[_0x8ddd('0x25')]!=='0'?_0x2c0682['data4']:_0x8ddd('0x26');if(_0x5a9ba0){logger[_0x8ddd('0x1f')](_0x8ddd('0x27'),_0x59c7cd[_0x8ddd('0x21')],_0x9a7b86['id']);_0x31d12b[_0x167dc3]=_[_0x8ddd('0x28')](_0x59c7cd[_0x8ddd('0x16')])?_0x59c7cd['calleridnum']:_0x59c7cd['destcalleridnum'];if(_[_0x8ddd('0x28')](_0x59c7cd[_0x8ddd('0x16')])){_0x31d12b['firstName']=_0x59c7cd[_0x8ddd('0x29')]&&_0x59c7cd[_0x8ddd('0x29')]!==_0x8ddd('0x2a')?_0x59c7cd[_0x8ddd('0x29')]:'Unknown';}else{_0x31d12b[_0x8ddd('0x17')]=_0x59c7cd['destcalleridname']&&_0x59c7cd[_0x8ddd('0x2b')]!==_0x8ddd('0x2a')?_0x59c7cd['destcalleridname']:'Unknown';}return BPromise['resolve']()['then'](cmContactRpc[_0x8ddd('0x2c')](_0x31d12b))[_0x8ddd('0x1c')](function(_0x788491){_0x13a77d=_0x788491;_0x17e4b4[_0x8ddd('0x2d')](_0x788491);if(_0x13a77d){logger[_0x8ddd('0x1f')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x59c7cd[_0x8ddd('0x21')],_0x9a7b86['id'],_0x13a77d['id']);}return;});}else{logger[_0x8ddd('0x1f')](_0x8ddd('0x2e'),_0x59c7cd[_0x8ddd('0x21')],_0x9a7b86['id']);_0x31d12b[_0x167dc3]=_[_0x8ddd('0x28')](_0x59c7cd[_0x8ddd('0x16')])?_0x59c7cd[_0x8ddd('0x2f')]:_0x59c7cd['destcalleridnum'];if(_[_0x8ddd('0x28')](_0x59c7cd[_0x8ddd('0x16')])){_0x31d12b[_0x8ddd('0x17')]=_0x59c7cd[_0x8ddd('0x29')]&&_0x59c7cd[_0x8ddd('0x29')]!==''?_0x59c7cd[_0x8ddd('0x29')]:_0x8ddd('0x30');}else{_0x31d12b[_0x8ddd('0x17')]=_0x59c7cd[_0x8ddd('0x2b')]&&_0x59c7cd[_0x8ddd('0x2b')]!==_0x8ddd('0x2a')?_0x59c7cd[_0x8ddd('0x2b')]:_0x8ddd('0x30');}_0x13a77d=_0x31d12b;_0x17e4b4[_0x8ddd('0x2d')](_0x31d12b);return;}}})[_0x8ddd('0x1c')](function(){if(_0x48faa8){emit(_0x59c7cd[_0x8ddd('0x21')],_0x9a7b86,util['format'](_0x8ddd('0x31'),_0x48faa8[_0x8ddd('0x32')]),util[_0x8ddd('0x33')]('trigger:%s',_0x2c0682['action'][_0x8ddd('0x34')]()),{'evt':_[_0x8ddd('0x35')](_0x59c7cd,{'autoCreate':_0x5a9ba0}),'contact':_0x13a77d===undefined?{}:_0x13a77d,'contacts':_0x17e4b4[_0x8ddd('0x1e')]===0x0?undefined:_0x17e4b4});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 0476fe0..2ec95e3 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 _0x4a2b=['data1','TemplateId','data2','uri','isNil','data3','data4','uriLocation','windowWidth','data5','800','windowHeight','data6','600','format','user:%s','name','jscripty','trigger:%s','exec','integration','queue','routeId','urlforward','script','buildUri','parse','render','replace','channel','AllConditions','AnyConditions','checkConditions','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','event','agent','membername','lastevent','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','bind','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','motionChannel','undefined','checkTriggers','interface','hasOwnProperty','checkTrigger','merge','Actions','length','action','toLowerCase','contactmanager','motionbar','browser'];(function(_0x28fbbf,_0x11f896){var _0x543af6=function(_0x27fa74){while(--_0x27fa74){_0x28fbbf['push'](_0x28fbbf['shift']());}};_0x543af6(++_0x11f896);}(_0x4a2b,0x181));var _0xb4a2=function(_0x24c2eb,_0x361b49){_0x24c2eb=_0x24c2eb-0x0;var _0x582aee=_0x4a2b[_0x24c2eb];return _0x582aee;};'use strict';var util=require(_0xb4a2('0x0'));var _=require(_0xb4a2('0x1'));var url=require(_0xb4a2('0x2'));var Mustache=require(_0xb4a2('0x3'));var Redis=require(_0xb4a2('0x4'));var urlforward=require(_0xb4a2('0x5'));var integration=require(_0xb4a2('0x6'));var cmContact=require(_0xb4a2('0x7'));var script=require('./script');var config=require(_0xb4a2('0x8'));var logger=require(_0xb4a2('0x9'))(_0xb4a2('0xa'));var ami=require('../ami');config[_0xb4a2('0xb')]=_['defaults'](config[_0xb4a2('0xb')],{'host':_0xb4a2('0xc'),'port':0x18eb});var io=require(_0xb4a2('0xd'))(new Redis(config[_0xb4a2('0xb')]));var operators={'equals':function(_0x334d90,_0x1ff38c){return _0x334d90==_0x1ff38c;},'not_equals':function(_0x1ff2b4,_0x1ff91c){return _0x1ff2b4!=_0x1ff91c;}};var barAndWebActions=[_0xb4a2('0xe'),_0xb4a2('0x2'),_0xb4a2('0xf')];function Trigger(_0x2ee846){this['triggers']=_0x2ee846[_0xb4a2('0x10')];this[_0xb4a2('0x11')]=_0x2ee846['agents'];this[_0xb4a2('0x12')]=_0x2ee846['voiceQueues'];this[_0xb4a2('0x13')]=_0x2ee846[_0xb4a2('0x13')];this[_0xb4a2('0x14')]=_0x2ee846[_0xb4a2('0x14')];this[_0xb4a2('0x15')]=_0x2ee846[_0xb4a2('0x15')];this[_0xb4a2('0x16')]=_0x2ee846[_0xb4a2('0x16')];this[_0xb4a2('0x17')]=_0x2ee846[_0xb4a2('0x17')];this[_0xb4a2('0x18')]=_0x2ee846[_0xb4a2('0x18')];this['zohoAccounts']=_0x2ee846[_0xb4a2('0x19')];this['deskAccounts']=_0x2ee846[_0xb4a2('0x1a')];this['vtigerAccounts']=_0x2ee846[_0xb4a2('0x1b')];this[_0xb4a2('0x1c')]=_0x2ee846[_0xb4a2('0x1c')];this[_0xb4a2('0x1d')]=_0x2ee846[_0xb4a2('0x1d')];this[_0xb4a2('0x1e')]=_0x2ee846[_0xb4a2('0x1e')];this[_0xb4a2('0x1f')]={'zendesk':this[_0xb4a2('0x15')],'salesforce':this[_0xb4a2('0x17')],'freshdesk':this[_0xb4a2('0x16')],'sugarcrm':this[_0xb4a2('0x18')],'zoho':this[_0xb4a2('0x19')],'desk':this[_0xb4a2('0x1a')],'vtiger':this[_0xb4a2('0x1b')],'dynamics365':this[_0xb4a2('0x1d')],'freshsales':this[_0xb4a2('0x1e')],'servicenow':this[_0xb4a2('0x1c')]};ami['on']('custom:agentcalled',this['syncCustomEvent']['bind'](this));ami['on'](_0xb4a2('0x20'),this[_0xb4a2('0x21')]['bind'](this));ami['on'](_0xb4a2('0x22'),this['syncCustomEvent'][_0xb4a2('0x23')](this));ami['on']('custom:agentcomplete',this[_0xb4a2('0x21')][_0xb4a2('0x23')](this));ami['on']('custom:agentnosuchnumber',this[_0xb4a2('0x21')]['bind'](this));ami['on'](_0xb4a2('0x24'),this[_0xb4a2('0x21')]['bind'](this));ami['on'](_0xb4a2('0x25'),this[_0xb4a2('0x21')][_0xb4a2('0x23')](this));ami['on'](_0xb4a2('0x26'),this[_0xb4a2('0x21')]['bind'](this));ami['on'](_0xb4a2('0x27'),this[_0xb4a2('0x21')][_0xb4a2('0x23')](this));ami['on'](_0xb4a2('0x28'),this[_0xb4a2('0x21')]['bind'](this));ami['on'](_0xb4a2('0x29'),this[_0xb4a2('0x21')][_0xb4a2('0x23')](this));ami['on']('custom:timeout',this[_0xb4a2('0x21')][_0xb4a2('0x23')](this));ami['on']('custom:dialbegin',this[_0xb4a2('0x2a')][_0xb4a2('0x23')](this));ami['on']('custom:dialconnect',this[_0xb4a2('0x2a')]['bind'](this));ami['on'](_0xb4a2('0x2b'),this['syncAgentDial'][_0xb4a2('0x23')](this));ami['on'](_0xb4a2('0x2c'),this['syncCustomEvent'][_0xb4a2('0x23')](this));ami['on'](_0xb4a2('0x2d'),this[_0xb4a2('0x21')][_0xb4a2('0x23')](this));ami['on'](_0xb4a2('0x2e'),this[_0xb4a2('0x21')][_0xb4a2('0x23')](this));ami['on'](_0xb4a2('0x2f'),this[_0xb4a2('0x21')][_0xb4a2('0x23')](this));ami['on'](_0xb4a2('0x30'),this[_0xb4a2('0x21')][_0xb4a2('0x23')](this));ami['on'](_0xb4a2('0x31'),this[_0xb4a2('0x21')]['bind'](this));}Trigger[_0xb4a2('0x32')][_0xb4a2('0x33')]=function(_0x132acb,_0x238f6c,_0x93358e){logger[_0xb4a2('0x34')](_0x132acb,_0x238f6c,JSON['stringify'](_0x93358e));io['to'](_0x132acb)[_0xb4a2('0x33')](_0x238f6c,_0x93358e);};Trigger[_0xb4a2('0x32')][_0xb4a2('0x21')]=function(_0x49154f){var _0x263be5=_['clone'](_0x49154f);if(typeof _0x263be5[_0xb4a2('0x35')]===_0xb4a2('0x36')){_0x263be5[_0xb4a2('0x35')]='voice';}this[_0xb4a2('0x37')](_0x263be5);};Trigger[_0xb4a2('0x32')][_0xb4a2('0x2a')]=function(_0x10ee51){if(this[_0xb4a2('0x11')][_0x10ee51[_0xb4a2('0x38')]]){this[_0xb4a2('0x21')](_0x10ee51);}};Trigger['prototype']['checkTriggers']=function(_0x25d760){var _0x2761a5;for(var _0x277c6e in this[_0xb4a2('0x10')]){if(this[_0xb4a2('0x10')][_0xb4a2('0x39')](_0x277c6e)){if(this[_0xb4a2('0x10')][_0x277c6e]['status']){_0x2761a5=this[_0xb4a2('0x3a')](this[_0xb4a2('0x10')][_0x277c6e],_0x25d760);if(_0x2761a5){_[_0xb4a2('0x3b')](_0x25d760,_0x25d760['variables']);for(var _0x19f7ba=0x0,_0x23ca36,_0x554b82,_0x42ebd8;_0x19f7ba0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe14b,0x93));var _0xbe14=function(_0x270e02,_0x1e613c){_0x270e02=_0x270e02-0x0;var _0x4237d6=_0xe14b[_0x270e02];return _0x4237d6;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index c9b951a..bec910b 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 _0xb6b3=['none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','util','./util','ioredis','../../../../config/logger','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','userId','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','headers','lastIndexOf','enduserId','outbound','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','nameField','customField','idField','substring','indexOf','content','incident','incidents','getString','Subjects','Fields','ticketType','4.0','phonecall','phonecalls','Descriptions','callDirection','queue','/contacts(','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat'];(function(_0x5e6ae8,_0x49436f){var _0x41d39c=function(_0x1f3658){while(--_0x1f3658){_0x5e6ae8['push'](_0x5e6ae8['shift']());}};_0x41d39c(++_0x49436f);}(_0xb6b3,0x76));var _0x3b6b=function(_0x5a8f8d,_0x166dbd){_0x5a8f8d=_0x5a8f8d-0x0;var _0x43a406=_0xb6b3[_0x5a8f8d];return _0x43a406;};'use strict';var _=require(_0x3b6b('0x0'));var BPromise=require(_0x3b6b('0x1'));var rp=require(_0x3b6b('0x2'));var util=require(_0x3b6b('0x3'));var intUtil=require(_0x3b6b('0x4'));var md5=require('md5');var Redis=require(_0x3b6b('0x5'));var logger=require(_0x3b6b('0x6'))('dynamics365');var config=require(_0x3b6b('0x7'));config['redis']=_[_0x3b6b('0x8')](config[_0x3b6b('0x9')],{'host':_0x3b6b('0xa'),'port':0x18eb});var io=require(_0x3b6b('0xb'))(new Redis(config[_0x3b6b('0x9')]));function getAuthToken(_0x5e6ac0,_0x12b161,_0x3c13c6){var _0x3405da={'method':_0x3b6b('0xc'),'uri':_0x12b161,'form':{'client_id':_0x5e6ac0[_0x3b6b('0xd')],'resource':_0x5e6ac0[_0x3b6b('0xe')],'username':_0x5e6ac0['username'],'password':_0x5e6ac0[_0x3b6b('0xf')],'grant_type':_0x3b6b('0xf'),'client_secret':_0x5e6ac0[_0x3b6b('0x10')]},'json':!![]};return rp(_0x3405da)['then'](function(_0xf48f4c){return _0xf48f4c[_0x3b6b('0x11')];})[_0x3b6b('0x12')](function(_0x2aeabd){logger[_0x3b6b('0x13')]('['+[_0x3c13c6[_0x3b6b('0x14')]()]+_0x3b6b('0x15'));return _0x2aeabd[_0x3b6b('0x16')];});}function getUser(_0x572944,_0x111fae,_0x4c6c43,_0x54f713,_0xc76268,_0x475962){return new BPromise(function(_0x1992b8,_0x530b2d){return getAuthToken(_0x111fae,_0x54f713,_0x475962)[_0x3b6b('0x17')](function(_0x229815){var _0x2e676f={'method':_0x3b6b('0x18'),'uri':_0xc76268+_0x3b6b('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x229815,'OData-Version':'4.0'},'json':!![]};return rp(_0x2e676f);})[_0x3b6b('0x17')](function(_0x544475){var _0x21bda6=_0x544475[_0x3b6b('0x1a')];var _0x38f333=![];var _0x9e93ac=null;if(!_[_0x3b6b('0x1b')](_0x4c6c43)){if(intUtil[_0x3b6b('0x1c')](_0x4c6c43[_0x3b6b('0x1d')])){_0x572944['userEmail']=_0x4c6c43['email'];for(_0x9e93ac=0x0;_0x9e93ac<_0x21bda6[_0x3b6b('0x1e')];_0x9e93ac++){if(_0x21bda6[_0x9e93ac][_0x3b6b('0x1f')]===_0x4c6c43[_0x3b6b('0x1d')]&&!_0x21bda6[_0x9e93ac][_0x3b6b('0x20')]){_0x38f333=!![];logger['info']('['+[_0x475962[_0x3b6b('0x14')]()]+_0x3b6b('0x21')+_0x21bda6[_0x9e93ac]['systemuserid']+'!');_0x572944['userId']=_0x21bda6[_0x9e93ac][_0x3b6b('0x22')];}}}}if(!_0x38f333){logger[_0x3b6b('0x23')]('['+[_0x475962[_0x3b6b('0x14')]()]+_0x3b6b('0x24'));_0x572944[_0x3b6b('0x25')]=_0x111fae[_0x3b6b('0x26')];for(_0x9e93ac=0x0;_0x9e93ac<_0x21bda6[_0x3b6b('0x1e')];_0x9e93ac++){if(_0x21bda6[_0x9e93ac][_0x3b6b('0x1f')]===_0x111fae[_0x3b6b('0x26')]){_0x572944[_0x3b6b('0x27')]=_0x21bda6[_0x9e93ac][_0x3b6b('0x22')];}}}_0x1992b8(_0x572944);})[_0x3b6b('0x12')](function(_0x266470){_0x530b2d(_0x266470['message']);});});}function createEndUser(_0x202926,_0x2be771,_0x2c6479,_0x3355ad,_0x2b9908,_0x86e1e){return new BPromise(function(_0x5e4fa7,_0x3a091c){return getAuthToken(_0x2be771,_0x2c6479,_0x86e1e)['then'](function(_0x13b5b1){var _0x7b2169=_0x86e1e[_0x3b6b('0x28')]()==='outbound'?_0x2b9908[_0x3b6b('0x29')]:_0x2b9908[_0x3b6b('0x2a')];var _0x476e8d={'method':_0x3b6b('0xc'),'uri':_0x3355ad+_0x3b6b('0x2b'),'body':{'telephone1':_0x7b2169,'fullname':_0x7b2169,'firstname':_0x7b2169,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3b6b('0x2c')+_0x202926[_0x3b6b('0x27')]+')'},'headers':{'Authorization':_0x3b6b('0x2d')+_0x13b5b1,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x476e8d);})['then'](function(_0x1e9396){var _0x54b7eb=_0x1e9396[_0x3b6b('0x2e')]['odata-entityid'];var _0x22bc0f=_0x54b7eb['substring'](_0x54b7eb[_0x3b6b('0x2f')]('(')+0x1,_0x54b7eb[_0x3b6b('0x2f')](')'));_0x202926[_0x3b6b('0x30')]=_0x22bc0f;_0x5e4fa7(_0x202926);})[_0x3b6b('0x12')](function(_0x1acd59){_0x3a091c(_0x1acd59[_0x3b6b('0x16')]);});});}function getEndUser(_0x4c2205,_0x246698,_0x2232d1,_0x4aec42,_0x342f61,_0x1f0240){return new BPromise(function(_0x1342a0,_0x33aa2d){var _0x31aca7=_0x1f0240[_0x3b6b('0x28')]()===_0x3b6b('0x31')?_0x342f61[_0x3b6b('0x29')]:_0x342f61['calleridnum'];return getAuthToken(_0x246698,_0x2232d1,_0x1f0240)[_0x3b6b('0x17')](function(_0x2e7efd){var _0x3a8442={'method':_0x3b6b('0x18'),'uri':_0x4aec42+_0x3b6b('0x32')+_0x31aca7[_0x3b6b('0x33')]('+',_0x3b6b('0x34'))+'\x27','headers':{'Authorization':_0x3b6b('0x2d')+_0x2e7efd,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3a8442);})[_0x3b6b('0x17')](function(_0x992d90){var _0x127b7c=null;if(_0x992d90){var _0x5a3c72=_0x992d90['value'];var _0x5ba693=![];for(_0x127b7c=0x0;_0x127b7c<_0x5a3c72[_0x3b6b('0x1e')];_0x127b7c++){if(_0x5a3c72[_0x127b7c]['telephone1']===_0x31aca7){_0x5ba693=!![];_0x4c2205[_0x3b6b('0x30')]=_0x5a3c72[_0x127b7c][_0x3b6b('0x35')];}}if(_0x5ba693){_0x1342a0(_0x4c2205);}else{return createEndUser(_0x4c2205,_0x246698,_0x2232d1,_0x4aec42,_0x342f61,_0x1f0240)[_0x3b6b('0x17')](function(_0x2a38dc){logger['info']('['+[_0x1f0240[_0x3b6b('0x14')]()]+_0x3b6b('0x36'),_0x2a38dc[_0x3b6b('0x30')]);_0x1342a0(_0x2a38dc);});}}else{return createEndUser(_0x4c2205,_0x246698,_0x2232d1,_0x4aec42,_0x342f61,_0x1f0240)[_0x3b6b('0x17')](function(_0x4806bf){logger[_0x3b6b('0x23')]('['+[_0x1f0240[_0x3b6b('0x14')]()]+_0x3b6b('0x37'),_0x4806bf[_0x3b6b('0x30')]);_0x1342a0(_0x4806bf);});}});});}function getCustomFields(_0xc02e63,_0x318483,_0x3876b7){var _0x9daeda={};if(_0xc02e63[_0x3b6b('0x1e')]>0x0){_[_0x3b6b('0x38')](_0xc02e63,function(_0x541f6b){if(_[_0x3b6b('0x39')]([_0x3b6b('0x3a'),_0x3b6b('0x3b')],_0x541f6b[_0x3b6b('0x3c')])&&_0x541f6b[_0x3b6b('0x3d')]&&!_0x541f6b[_0x3b6b('0x3e')]){var _0x49f4fb=_0x541f6b[_0x3b6b('0x3f')][_0x3b6b('0x28')]();var _0x9f2d76=_0x49f4fb[_0x3b6b('0x40')](0x0,_0x49f4fb['indexOf']('_'));var _0x843b3a=_0x49f4fb[_0x3b6b('0x40')](_0x49f4fb[_0x3b6b('0x41')]('_')+0x1);if(_0x9f2d76===_0x3876b7){_0x9daeda[_0x843b3a]=_0x541f6b[_0x3b6b('0x42')];}}});}return _0x9daeda;}function getTicket(_0x31d1aa,_0xa8d033,_0x3f784b,_0x15dae1,_0x126ce5,_0x24d8ef,_0x2e680e){return new BPromise(function(_0x47525c,_0x62b9e7){var _0xb6c1d3;return getAuthToken(_0xa8d033,_0x3f784b,_0x2e680e)['then'](function(_0x3f0c0f){if(_0x24d8ef['ticketType']===_0x3b6b('0x43')){_0xb6c1d3={'method':_0x3b6b('0xc'),'uri':_0x15dae1+_0x3b6b('0x44'),'body':Object['assign']({},{'title':intUtil[_0x3b6b('0x45')](_0x24d8ef[_0x3b6b('0x46')],_0x126ce5,'\x20'),'description':intUtil[_0x3b6b('0x45')](_0x24d8ef['Descriptions'],_0x126ce5,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x31d1aa[_0x3b6b('0x30')]+')','ownerid@odata.bind':_0x3b6b('0x2c')+_0x31d1aa[_0x3b6b('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x24d8ef[_0x3b6b('0x47')],_0x126ce5,_0x24d8ef[_0x3b6b('0x48')])),'headers':{'Authorization':_0x3b6b('0x2d')+_0x3f0c0f,'OData-Version':_0x3b6b('0x49')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x24d8ef[_0x3b6b('0x48')]===_0x3b6b('0x4a')){_0xb6c1d3={'method':_0x3b6b('0xc'),'uri':_0x15dae1+_0x3b6b('0x4b'),'body':Object['assign']({},{'subject':intUtil[_0x3b6b('0x45')](_0x24d8ef[_0x3b6b('0x46')],_0x126ce5,'\x20'),'phonenumber':String(_0x126ce5[_0x3b6b('0x2a')]),'description':intUtil['getString'](_0x24d8ef[_0x3b6b('0x4c')],_0x126ce5,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x31d1aa[_0x3b6b('0x30')]+')','ownerid@odata.bind':_0x3b6b('0x2c')+_0x31d1aa[_0x3b6b('0x27')]+')','directioncode':_0x31d1aa[_0x3b6b('0x4d')]===_0x3b6b('0x4e')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x3b6b('0x2c')+_0x31d1aa[_0x3b6b('0x27')]+')','participationtypemask':_0x31d1aa[_0x3b6b('0x4d')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x3b6b('0x4f')+_0x31d1aa[_0x3b6b('0x30')]+')','participationtypemask':_0x31d1aa[_0x3b6b('0x4d')]===_0x3b6b('0x4e')?0x1:0x2}]},getCustomFields(_0x24d8ef[_0x3b6b('0x47')],_0x126ce5,_0x24d8ef[_0x3b6b('0x48')])),'headers':{'Authorization':_0x3b6b('0x2d')+_0x3f0c0f,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xb6c1d3);})[_0x3b6b('0x17')](function(_0x57cd0d){var _0x425d99=_0x57cd0d[_0x3b6b('0x2e')][_0x3b6b('0x50')];var _0x2dff7e=_0x425d99[_0x3b6b('0x40')](_0x425d99[_0x3b6b('0x2f')]('(')+0x1,_0x425d99[_0x3b6b('0x2f')](')'));_0x31d1aa[_0x3b6b('0x51')]=_0x2dff7e;_0x47525c(_0x31d1aa);})[_0x3b6b('0x12')](function(_0x135968){_0x62b9e7(_0x135968[_0x3b6b('0x16')]);});});}function emit(_0x374390,_0x110d4a,_0x3b55b5,_0x181f11){var _0x4c35e5={'uri':util[_0x3b6b('0x52')](_0x3b6b('0x53'),_0x374390,_0x3b55b5,_0x181f11)};io['to'](util[_0x3b6b('0x52')]('user:%s',_0x110d4a))[_0x3b6b('0x54')]('trigger:browser:url',_0x4c35e5);}exports['cs']=function(_0x45f1c6,_0x375ce5,_0x20b204,_0x41dd2d,_0x146f10,_0x1fdbd8,_0x4741a2,_0xb7a6f9){var _0x3f6b55={};_0x1fdbd8[_0x3b6b('0xe')]=intUtil[_0x3b6b('0x55')](_0x1fdbd8['remoteUri']);_0x1fdbd8[_0x3b6b('0x56')]=intUtil['stripTrailingSlash'](_0x1fdbd8['serverUrl']);_0x3f6b55[_0x3b6b('0x4d')]=_0xb7a6f9===_0x3b6b('0x4e')||_0xb7a6f9==='unmanaged'?_0x3b6b('0x4e'):_0x3b6b('0x31');var _0x104f63=util[_0x3b6b('0x52')](_0x3b6b('0x57'),_0x1fdbd8[_0x3b6b('0xe')]);var _0x57f6d2=util[_0x3b6b('0x52')](_0x3b6b('0x58'),_0x1fdbd8[_0x3b6b('0x59')]);var _0x51eff5=util[_0x3b6b('0x52')](_0x3b6b('0x5a'),_0x1fdbd8[_0x3b6b('0x56')],_0x375ce5[_0x3b6b('0x5b')],md5(_0x375ce5[_0x3b6b('0x5b')]));if(_0x146f10&&_0x146f10[_0x3b6b('0x5c')]){logger[_0x3b6b('0x23')]('[QUEUE]',_0x3b6b('0x5d'));_0x375ce5[_0x3b6b('0x5e')]=_0x51eff5;}else if(_0x4741a2&&_0x4741a2[_0x3b6b('0x5f')]&&_0x4741a2[_0x3b6b('0x5f')]!==_0x3b6b('0x60')){logger[_0x3b6b('0x23')](_0x3b6b('0x61'),_0x3b6b('0x5d'));_0x375ce5[_0x3b6b('0x5e')]=_0x51eff5;}else{_0x375ce5[_0x3b6b('0x5e')]='';}return getUser(_0x3f6b55,_0x1fdbd8,_0x41dd2d,_0x57f6d2,_0x104f63,_0xb7a6f9)[_0x3b6b('0x17')](function(_0x4b2683){logger[_0x3b6b('0x23')]('['+_0xb7a6f9[_0x3b6b('0x14')]()+_0x3b6b('0x62'),_0x4b2683[_0x3b6b('0x27')]);logger['info']('['+_0xb7a6f9['toUpperCase']()+_0x3b6b('0x63'),_0x4b2683['userEmail']);return getEndUser(_0x4b2683,_0x1fdbd8,_0x57f6d2,_0x104f63,_0x375ce5,_0xb7a6f9);})[_0x3b6b('0x17')](function(_0xd15c5b){logger['info']('['+_0xb7a6f9[_0x3b6b('0x14')]()+_0x3b6b('0x64'),_0xd15c5b[_0x3b6b('0x30')]);logger[_0x3b6b('0x23')]('['+_0xb7a6f9[_0x3b6b('0x14')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x375ce5[_0x3b6b('0x2a')]);return getTicket(_0xd15c5b,_0x1fdbd8,_0x57f6d2,_0x104f63,_0x375ce5,_0x20b204,_0xb7a6f9);})[_0x3b6b('0x17')](function(_0x34b34a){logger['info'](util[_0x3b6b('0x52')]('['+_0xb7a6f9['toUpperCase']()+_0x3b6b('0x65'),_0x20b204[_0x3b6b('0x48')],_0x34b34a['ticketId']));logger['info'](util[_0x3b6b('0x52')]('['+_0xb7a6f9[_0x3b6b('0x14')]()+_0x3b6b('0x66'),_0xb7a6f9));if(_0xb7a6f9!==_0x3b6b('0x67')){logger[_0x3b6b('0x23')]('['+_0xb7a6f9['toUpperCase']()+']',_0x3b6b('0x68'));emit(_0x1fdbd8['remoteUri'],_0x41dd2d[_0x3b6b('0x69')],_0x20b204[_0x3b6b('0x48')],_0x34b34a['ticketId']);}})['catch'](function(_0x4a4896){logger['error']('['+_0xb7a6f9[_0x3b6b('0x14')]()+_0x3b6b('0x6a'),util['inspect'](_0x4a4896,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd46b=['util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','username','password','clientSecret','catch','error',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','length','isdisabled','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','internalemailaddress','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','value','toUpperCase',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','nameField','customField','idField','indexOf','content','incidents','assign','getString','Descriptions','/contacts(','Fields','ticketType','phonecall','phonecalls','Subjects','callDirection','queue','format','user:%s','emit','trigger:browser:url','remoteUri','serverUrl','stripTrailingSlash','unmanaged','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0xd46b,0x12c));var _0xbd46=function(_0x10c778,_0x58ef9e){_0x10c778=_0x10c778-0x0;var _0x4e9fb2=_0xd46b[_0x10c778];return _0x4e9fb2;};'use strict';var _=require(_0xbd46('0x0'));var BPromise=require(_0xbd46('0x1'));var rp=require(_0xbd46('0x2'));var util=require(_0xbd46('0x3'));var intUtil=require(_0xbd46('0x4'));var md5=require('md5');var Redis=require(_0xbd46('0x5'));var logger=require(_0xbd46('0x6'))(_0xbd46('0x7'));var config=require(_0xbd46('0x8'));config[_0xbd46('0x9')]=_[_0xbd46('0xa')](config[_0xbd46('0x9')],{'host':_0xbd46('0xb'),'port':0x18eb});var io=require(_0xbd46('0xc'))(new Redis(config[_0xbd46('0x9')]));function getAuthToken(_0x15b7c0,_0x1a6e35,_0x36d235){var _0x411c19={'method':_0xbd46('0xd'),'uri':_0x1a6e35,'form':{'client_id':_0x15b7c0[_0xbd46('0xe')],'resource':_0x15b7c0['remoteUri'],'username':_0x15b7c0[_0xbd46('0xf')],'password':_0x15b7c0[_0xbd46('0x10')],'grant_type':'password','client_secret':_0x15b7c0[_0xbd46('0x11')]},'json':!![]};return rp(_0x411c19)['then'](function(_0x5ae9a2){return _0x5ae9a2['access_token'];})[_0xbd46('0x12')](function(_0x26c74e){logger[_0xbd46('0x13')]('['+[_0x36d235['toUpperCase']()]+_0xbd46('0x14'));return _0x26c74e[_0xbd46('0x15')];});}function getUser(_0x9c2d6b,_0x51c8a3,_0x44362c,_0x3af8a6,_0x38a8dd,_0x341033){return new BPromise(function(_0x5e0b66,_0x20d128){return getAuthToken(_0x51c8a3,_0x3af8a6,_0x341033)[_0xbd46('0x16')](function(_0x36dfeb){var _0x3fa5bc={'method':_0xbd46('0x17'),'uri':_0x38a8dd+_0xbd46('0x18'),'headers':{'Authorization':_0xbd46('0x19')+_0x36dfeb,'OData-Version':_0xbd46('0x1a')},'json':!![]};return rp(_0x3fa5bc);})[_0xbd46('0x16')](function(_0x51270f){var _0x2f738f=_0x51270f['value'];var _0x1f892a=![];var _0x5dfac1=null;if(!_[_0xbd46('0x1b')](_0x44362c)){if(intUtil[_0xbd46('0x1c')](_0x44362c[_0xbd46('0x1d')])){_0x9c2d6b['userEmail']=_0x44362c[_0xbd46('0x1d')];for(_0x5dfac1=0x0;_0x5dfac1<_0x2f738f[_0xbd46('0x1e')];_0x5dfac1++){if(_0x2f738f[_0x5dfac1]['internalemailaddress']===_0x44362c[_0xbd46('0x1d')]&&!_0x2f738f[_0x5dfac1][_0xbd46('0x1f')]){_0x1f892a=!![];logger[_0xbd46('0x20')]('['+[_0x341033['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x2f738f[_0x5dfac1][_0xbd46('0x21')]+'!');_0x9c2d6b['userId']=_0x2f738f[_0x5dfac1][_0xbd46('0x21')];}}}}if(!_0x1f892a){logger[_0xbd46('0x20')]('['+[_0x341033['toUpperCase']()]+_0xbd46('0x22'));_0x9c2d6b[_0xbd46('0x23')]=_0x51c8a3[_0xbd46('0xf')];for(_0x5dfac1=0x0;_0x5dfac1<_0x2f738f[_0xbd46('0x1e')];_0x5dfac1++){if(_0x2f738f[_0x5dfac1][_0xbd46('0x24')]===_0x51c8a3[_0xbd46('0xf')]){_0x9c2d6b[_0xbd46('0x25')]=_0x2f738f[_0x5dfac1]['systemuserid'];}}}_0x5e0b66(_0x9c2d6b);})[_0xbd46('0x12')](function(_0x1c5275){_0x20d128(_0x1c5275['message']);});});}function createEndUser(_0x5f29cb,_0x27a87c,_0x26557b,_0x1dfae5,_0xbed40,_0x1e8ead){return new BPromise(function(_0x4b1109,_0x67ba3c){return getAuthToken(_0x27a87c,_0x26557b,_0x1e8ead)[_0xbd46('0x16')](function(_0x48d03a){var _0x489315=_0x1e8ead[_0xbd46('0x26')]()===_0xbd46('0x27')?_0xbed40[_0xbd46('0x28')]:_0xbed40[_0xbd46('0x29')];var _0x1ac434={'method':_0xbd46('0xd'),'uri':_0x1dfae5+_0xbd46('0x2a'),'body':{'telephone1':_0x489315,'fullname':_0x489315,'firstname':_0x489315,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xbd46('0x2b')+_0x5f29cb['userId']+')'},'headers':{'Authorization':_0xbd46('0x19')+_0x48d03a,'OData-Version':_0xbd46('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1ac434);})[_0xbd46('0x16')](function(_0x464893){var _0x44ac76=_0x464893['headers'][_0xbd46('0x2c')];var _0x37ec63=_0x44ac76[_0xbd46('0x2d')](_0x44ac76[_0xbd46('0x2e')]('(')+0x1,_0x44ac76[_0xbd46('0x2e')](')'));_0x5f29cb[_0xbd46('0x2f')]=_0x37ec63;_0x4b1109(_0x5f29cb);})['catch'](function(_0x58928f){_0x67ba3c(_0x58928f['message']);});});}function getEndUser(_0x519347,_0xbb8cb1,_0x106204,_0x1aded9,_0x14719b,_0x360d4e){return new BPromise(function(_0x1fe131,_0x395234){var _0x5d3832=_0x360d4e[_0xbd46('0x26')]()==='outbound'?_0x14719b[_0xbd46('0x28')]:_0x14719b[_0xbd46('0x29')];return getAuthToken(_0xbb8cb1,_0x106204,_0x360d4e)['then'](function(_0x158ec3){var _0x94b888={'method':_0xbd46('0x17'),'uri':_0x1aded9+_0xbd46('0x30')+_0x5d3832[_0xbd46('0x31')]('+',_0xbd46('0x32'))+'\x27','headers':{'Authorization':_0xbd46('0x19')+_0x158ec3,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x94b888);})[_0xbd46('0x16')](function(_0x1af97e){var _0x2042c4=null;if(_0x1af97e){var _0x4441ec=_0x1af97e[_0xbd46('0x33')];var _0x5e93fe=![];for(_0x2042c4=0x0;_0x2042c4<_0x4441ec['length'];_0x2042c4++){if(_0x4441ec[_0x2042c4]['telephone1']===_0x5d3832){_0x5e93fe=!![];_0x519347['enduserId']=_0x4441ec[_0x2042c4]['contactid'];}}if(_0x5e93fe){_0x1fe131(_0x519347);}else{return createEndUser(_0x519347,_0xbb8cb1,_0x106204,_0x1aded9,_0x14719b,_0x360d4e)[_0xbd46('0x16')](function(_0xafe377){logger[_0xbd46('0x20')]('['+[_0x360d4e[_0xbd46('0x34')]()]+_0xbd46('0x35'),_0xafe377[_0xbd46('0x2f')]);_0x1fe131(_0xafe377);});}}else{return createEndUser(_0x519347,_0xbb8cb1,_0x106204,_0x1aded9,_0x14719b,_0x360d4e)['then'](function(_0x1c7506){logger[_0xbd46('0x20')]('['+[_0x360d4e[_0xbd46('0x34')]()]+_0xbd46('0x36'),_0x1c7506[_0xbd46('0x2f')]);_0x1fe131(_0x1c7506);});}});});}function getCustomFields(_0x2e7298,_0x20d951,_0x324075){var _0x9abcdf={};if(_0x2e7298[_0xbd46('0x1e')]>0x0){_[_0xbd46('0x37')](_0x2e7298,function(_0x50d9db){if(_[_0xbd46('0x38')]([_0xbd46('0x39'),_0xbd46('0x3a')],_0x50d9db['type'])&&_0x50d9db[_0xbd46('0x3b')]&&!_0x50d9db[_0xbd46('0x3c')]){var _0x423960=_0x50d9db[_0xbd46('0x3d')]['toLowerCase']();var _0x1201e5=_0x423960[_0xbd46('0x2d')](0x0,_0x423960['indexOf']('_'));var _0x579deb=_0x423960[_0xbd46('0x2d')](_0x423960[_0xbd46('0x3e')]('_')+0x1);if(_0x1201e5===_0x324075){_0x9abcdf[_0x579deb]=_0x50d9db[_0xbd46('0x3f')];}}});}return _0x9abcdf;}function getTicket(_0xd38dae,_0xc91a6d,_0x5ce52a,_0x54789e,_0x199dce,_0x2316d0,_0xd1ee85){return new BPromise(function(_0x31583a,_0x2c1e1b){var _0x43f549;return getAuthToken(_0xc91a6d,_0x5ce52a,_0xd1ee85)[_0xbd46('0x16')](function(_0xc70973){if(_0x2316d0['ticketType']==='incident'){_0x43f549={'method':'POST','uri':_0x54789e+_0xbd46('0x40'),'body':Object[_0xbd46('0x41')]({},{'title':intUtil[_0xbd46('0x42')](_0x2316d0['Subjects'],_0x199dce,'\x20'),'description':intUtil[_0xbd46('0x42')](_0x2316d0[_0xbd46('0x43')],_0x199dce,'\x0a'),'customerid_contact@odata.bind':_0xbd46('0x44')+_0xd38dae['enduserId']+')','ownerid@odata.bind':_0xbd46('0x2b')+_0xd38dae[_0xbd46('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x2316d0[_0xbd46('0x45')],_0x199dce,_0x2316d0['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0xc70973,'OData-Version':_0xbd46('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2316d0[_0xbd46('0x46')]===_0xbd46('0x47')){_0x43f549={'method':_0xbd46('0xd'),'uri':_0x54789e+_0xbd46('0x48'),'body':Object[_0xbd46('0x41')]({},{'subject':intUtil[_0xbd46('0x42')](_0x2316d0[_0xbd46('0x49')],_0x199dce,'\x20'),'phonenumber':String(_0x199dce[_0xbd46('0x29')]),'description':intUtil[_0xbd46('0x42')](_0x2316d0['Descriptions'],_0x199dce,'\x0a'),'regardingobjectid_contact@odata.bind':_0xbd46('0x44')+_0xd38dae['enduserId']+')','ownerid@odata.bind':_0xbd46('0x2b')+_0xd38dae[_0xbd46('0x25')]+')','directioncode':_0xd38dae[_0xbd46('0x4a')]===_0xbd46('0x4b')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xbd46('0x2b')+_0xd38dae['userId']+')','participationtypemask':_0xd38dae['callDirection']===_0xbd46('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0xbd46('0x44')+_0xd38dae[_0xbd46('0x2f')]+')','participationtypemask':_0xd38dae['callDirection']==='queue'?0x1:0x2}]},getCustomFields(_0x2316d0['Fields'],_0x199dce,_0x2316d0[_0xbd46('0x46')])),'headers':{'Authorization':_0xbd46('0x19')+_0xc70973,'OData-Version':_0xbd46('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x43f549);})['then'](function(_0x26eef1){var _0x21bac0=_0x26eef1['headers']['odata-entityid'];var _0x5c4284=_0x21bac0[_0xbd46('0x2d')](_0x21bac0[_0xbd46('0x2e')]('(')+0x1,_0x21bac0[_0xbd46('0x2e')](')'));_0xd38dae['ticketId']=_0x5c4284;_0x31583a(_0xd38dae);})[_0xbd46('0x12')](function(_0xeac7a3){_0x2c1e1b(_0xeac7a3[_0xbd46('0x15')]);});});}function emit(_0x1d9764,_0x203c09,_0x12fc3c,_0x40ef25){var _0x18f3e5={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x1d9764,_0x12fc3c,_0x40ef25)};io['to'](util[_0xbd46('0x4c')](_0xbd46('0x4d'),_0x203c09))[_0xbd46('0x4e')](_0xbd46('0x4f'),_0x18f3e5);}exports['cs']=function(_0xdb038,_0x5b77e1,_0xbdd509,_0x401be3,_0x3e8a35,_0x2f628b,_0x5e13af,_0x3d2a3b){var _0x1ddccf={};_0x2f628b['remoteUri']=intUtil['stripTrailingSlash'](_0x2f628b[_0xbd46('0x50')]);_0x2f628b[_0xbd46('0x51')]=intUtil[_0xbd46('0x52')](_0x2f628b['serverUrl']);_0x1ddccf[_0xbd46('0x4a')]=_0x3d2a3b==='queue'||_0x3d2a3b===_0xbd46('0x53')?_0xbd46('0x4b'):_0xbd46('0x27');var _0x33ff69=util['format']('%s/api/data/v9.0/',_0x2f628b[_0xbd46('0x50')]);var _0x3c1bda=util[_0xbd46('0x4c')]('https://login.microsoftonline.com/%s/oauth2/token',_0x2f628b[_0xbd46('0x54')]);var _0x5da1ea=util[_0xbd46('0x4c')](_0xbd46('0x55'),_0x2f628b[_0xbd46('0x51')],_0x5b77e1[_0xbd46('0x56')],md5(_0x5b77e1[_0xbd46('0x56')]));if(_0x3e8a35&&_0x3e8a35[_0xbd46('0x57')]){logger[_0xbd46('0x20')](_0xbd46('0x58'),_0xbd46('0x59'));_0x5b77e1[_0xbd46('0x5a')]=_0x5da1ea;}else if(_0x5e13af&&_0x5e13af[_0xbd46('0x5b')]&&_0x5e13af[_0xbd46('0x5b')]!==_0xbd46('0x5c')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5b77e1[_0xbd46('0x5a')]=_0x5da1ea;}else{_0x5b77e1[_0xbd46('0x5a')]='';}return getUser(_0x1ddccf,_0x2f628b,_0x401be3,_0x3c1bda,_0x33ff69,_0x3d2a3b)[_0xbd46('0x16')](function(_0x16f83f){logger[_0xbd46('0x20')]('['+_0x3d2a3b[_0xbd46('0x34')]()+_0xbd46('0x5d'),_0x16f83f[_0xbd46('0x25')]);logger[_0xbd46('0x20')]('['+_0x3d2a3b[_0xbd46('0x34')]()+_0xbd46('0x5e'),_0x16f83f[_0xbd46('0x23')]);return getEndUser(_0x16f83f,_0x2f628b,_0x3c1bda,_0x33ff69,_0x5b77e1,_0x3d2a3b);})['then'](function(_0x426366){logger['info']('['+_0x3d2a3b[_0xbd46('0x34')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x426366[_0xbd46('0x2f')]);logger[_0xbd46('0x20')]('['+_0x3d2a3b['toUpperCase']()+_0xbd46('0x5f'),_0x5b77e1['calleridnum']);return getTicket(_0x426366,_0x2f628b,_0x3c1bda,_0x33ff69,_0x5b77e1,_0xbdd509,_0x3d2a3b);})[_0xbd46('0x16')](function(_0x55d662){logger[_0xbd46('0x20')](util[_0xbd46('0x4c')]('['+_0x3d2a3b['toUpperCase']()+_0xbd46('0x60'),_0xbdd509[_0xbd46('0x46')],_0x55d662[_0xbd46('0x61')]));logger[_0xbd46('0x20')](util['format']('['+_0x3d2a3b[_0xbd46('0x34')]()+']\x20Call\x20direction:\x20%s',_0x3d2a3b));if(_0x3d2a3b!==_0xbd46('0x53')){logger[_0xbd46('0x20')]('['+_0x3d2a3b[_0xbd46('0x34')]()+']',_0xbd46('0x62'));emit(_0x2f628b[_0xbd46('0x50')],_0x401be3['name'],_0xbdd509[_0xbd46('0x46')],_0x55d662[_0xbd46('0x61')]);}})[_0xbd46('0x12')](function(_0x4be236){logger[_0xbd46('0x13')]('['+_0x3d2a3b['toUpperCase']()+_0xbd46('0x63'),util[_0xbd46('0x64')](_0x4be236,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index f1c9637..db1a440 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 _0x5b40=['error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','%s/helpdesk/tickets/%d','unmanaged','toUpperCase','catch','lastevent','lodash','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','toString','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url'];(function(_0xdd5679,_0x1e7c2e){var _0x35a4b6=function(_0x417b83){while(--_0x417b83){_0xdd5679['push'](_0xdd5679['shift']());}};_0x35a4b6(++_0x1e7c2e);}(_0x5b40,0x6d));var _0x05b4=function(_0x2ead55,_0x4d9c40){_0x2ead55=_0x2ead55-0x0;var _0x243d45=_0x5b40[_0x2ead55];return _0x243d45;};'use strict';var _=require(_0x05b4('0x0'));var rp=require('request-promise');var md5=require(_0x05b4('0x1'));var util=require(_0x05b4('0x2'));var Redis=require(_0x05b4('0x3'));var intUtil=require(_0x05b4('0x4'));var config=require(_0x05b4('0x5'));var logger=require('../../../../config/logger')(_0x05b4('0x6'));config[_0x05b4('0x7')]=_['defaults'](config[_0x05b4('0x7')],{'host':_0x05b4('0x8'),'port':0x18eb});var io=require(_0x05b4('0x9'))(new Redis(config['redis']));var headers={'Content-Type':_0x05b4('0xa'),'Accept':_0x05b4('0xa')};function emit(_0x2a2757,_0x5ded34,_0x12033b){io['to'](_0x2a2757)[_0x05b4('0xb')](_0x5ded34,_0x12033b);}function getTicket(_0x1a1c26,_0x580ea7,_0x5f2753,_0x106995,_0x4b9f20){logger[_0x05b4('0xc')](_0x05b4('0xd'));var _0x5b7d39=_['merge']({'responder_id':_0x580ea7['id'],'requester_id':_0x5f2753['id'],'name':util['format'](_0x05b4('0xe'),_0x4b9f20[_0x05b4('0xf')]),'phone':_0x4b9f20[_0x05b4('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x05b4('0x11')](_0x106995[_0x05b4('0x12')],_0x4b9f20,'\x20'),'description':intUtil[_0x05b4('0x11')](_0x106995[_0x05b4('0x13')],_0x4b9f20,_0x05b4('0x14')),'tags':getTags(_0x106995[_0x05b4('0x15')],_0x05b4('0x16'))},getCustomFields(_0x106995[_0x05b4('0x17')],_0x4b9f20));_0x5b7d39[_0x05b4('0x18')]=_[_0x05b4('0x19')](_[_0x05b4('0x1a')](_0x5b7d39[_0x05b4('0x18')],'id'),_0x05b4('0x1b'));return request({'uri':util[_0x05b4('0x1c')](_0x05b4('0x1d'),_0x1a1c26[_0x05b4('0x1e')]),'method':_0x05b4('0x1f'),'body':_0x5b7d39})[_0x05b4('0x20')](function(_0x55afbd){logger[_0x05b4('0xc')](_0x05b4('0x21'));return _0x55afbd;});}function getUser(_0x5d1a32,_0x16d10e){if(intUtil[_0x05b4('0x22')](_0x16d10e)){return request({'uri':util['format'](_0x05b4('0x23'),_0x5d1a32[_0x05b4('0x1e')]),'qs':{'email':_0x16d10e}})['then'](function(_0x439a70){if(_0x439a70[_0x05b4('0x24')]){logger[_0x05b4('0xc')](_0x05b4('0x25'));return _[_0x05b4('0x26')](_0x439a70,function(_0x2b37d7){return _0x2b37d7[_0x05b4('0x27')][_0x05b4('0x28')]===_0x16d10e;});}else{logger[_0x05b4('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x05b4('0x1c')](_0x05b4('0x29'),_0x5d1a32['remoteUri'])})[_0x05b4('0x20')](function(_0x537483){logger[_0x05b4('0xc')]('Admin\x20account\x20selected.');return _0x537483;});}});}else{logger[_0x05b4('0xc')](_0x05b4('0x2a'));return request({'uri':util['format'](_0x05b4('0x29'),_0x5d1a32[_0x05b4('0x1e')])})[_0x05b4('0x20')](function(_0x17b1df){logger[_0x05b4('0xc')](_0x05b4('0x2b'));return _0x17b1df;});}}function getEndUser(_0xe70512,_0x4c10a4,_0x3e8eec){logger[_0x05b4('0xc')](_0x05b4('0x2c'),_0x3e8eec);return request({'uri':util[_0x05b4('0x1c')](_0x05b4('0x2d'),_0xe70512[_0x05b4('0x1e')]),'qs':{'phone':_0x3e8eec}})[_0x05b4('0x20')](function(_0x5b0808){if(_0x5b0808[_0x05b4('0x24')]){logger['info'](_0x05b4('0x2e'));return _[_0x05b4('0x26')](_0x5b0808,{'phone':_0x3e8eec});}else{logger[_0x05b4('0xc')](_0x05b4('0x2f'));return request({'uri':util[_0x05b4('0x1c')]('%s/api/v2/contacts',_0xe70512[_0x05b4('0x1e')]),'method':'POST','body':{'name':_0x4c10a4,'phone':_0x3e8eec}})[_0x05b4('0x20')](function(_0x3f2191){logger[_0x05b4('0xc')](_0x05b4('0x30'));return _0x3f2191;});}});}function getAuth(_0x4298b6){return util[_0x05b4('0x1c')](_0x05b4('0x31'),new Buffer(_0x4298b6[_0x05b4('0x32')]+':X')['toString'](_0x05b4('0x33')));}function request(_0x697a1){logger[_0x05b4('0x34')](_0x05b4('0x35'),JSON[_0x05b4('0x36')](_0x697a1));return rp(_['defaults'](_0x697a1,{'method':_0x05b4('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x3022da,_0x4c413d){var _0x131a09=[];if(_0x3022da&&_0x3022da[_0x05b4('0x24')]>0x0){_0x131a09=_[_0x05b4('0x38')](_0x3022da,_0x4c413d);}return _0x131a09;}function getCustomFields(_0x3cbe24,_0x59397f){var _0x1c7c04=[];var _0x21b397={'custom_fields':[]};if(_0x3cbe24[_0x05b4('0x24')]>0x0){_[_0x05b4('0x39')](_0x3cbe24,function(_0x59fb23){if(_[_0x05b4('0x3a')]([_0x05b4('0x3b'),_0x05b4('0x3c')],_0x59fb23[_0x05b4('0x3d')])&&_0x59fb23[_0x05b4('0x3e')]&&!_0x59fb23[_0x05b4('0x3f')]){_0x21b397[_0x59fb23['nameField'][_0x05b4('0x40')]()]=_0x59fb23['content'][_0x05b4('0x41')]();}else if(_[_0x05b4('0x3a')](['string',_0x05b4('0x3c')],_0x59fb23['type'])&&_0x59fb23[_0x05b4('0x42')]&&_0x59fb23[_0x05b4('0x3f')]){_0x21b397['custom_fields'][_0x05b4('0x43')]({'id':_0x59fb23[_0x05b4('0x42')],'value':_0x59fb23['content'][_0x05b4('0x41')]()});}else if(_0x59fb23['type']===_0x05b4('0x44')&&_0x59fb23[_0x05b4('0x45')]&&_0x59fb23['idField']&&_0x59fb23[_0x05b4('0x3f')]){_0x59397f[_0x59fb23[_0x05b4('0x45')]]&&_0x21b397[_0x05b4('0x18')][_0x05b4('0x43')]({'id':_0x59fb23[_0x05b4('0x42')],'value':_0x59397f[_0x59fb23[_0x05b4('0x45')]][_0x05b4('0x41')]()});}else if(_0x59fb23[_0x05b4('0x3d')]===_0x05b4('0x46')&&_0x59fb23[_0x05b4('0x47')]&&_0x59fb23[_0x05b4('0x47')][_0x05b4('0x16')]&&_0x59fb23['idField']&&_0x59fb23['customField']){_0x59397f[_0x59fb23['Variable'][_0x05b4('0x16')][_0x05b4('0x40')]()]&&_0x21b397['custom_fields'][_0x05b4('0x43')]({'id':_0x59fb23[_0x05b4('0x42')],'value':_0x59397f[_0x59fb23['Variable'][_0x05b4('0x16')]['toLowerCase']()][_0x05b4('0x41')]()});}});}return _0x21b397;}exports[_0x05b4('0x48')]=function(_0x386d73,_0x409c85,_0x382850,_0x49ae6a,_0x1c8ab5,_0x42d5fc){var _0xb18847,_0x180a13;_0x42d5fc[_0x05b4('0x1e')]=intUtil[_0x05b4('0x49')](_0x42d5fc[_0x05b4('0x1e')]);_0x42d5fc[_0x05b4('0x4a')]=intUtil[_0x05b4('0x49')](_0x42d5fc[_0x05b4('0x4a')]);if(_0x1c8ab5&&_0x1c8ab5[_0x05b4('0x4b')]){logger[_0x05b4('0xc')](_0x05b4('0x4c'),_0x05b4('0x4d'));_0x409c85[_0x05b4('0x4e')]=util[_0x05b4('0x1c')](_0x05b4('0x4f'),_0x42d5fc['serverUrl'],_0x409c85[_0x05b4('0x50')],md5(_0x409c85[_0x05b4('0x50')]));}else{_0x409c85['recordingURL']='';}headers[_0x05b4('0x51')]=getAuth(_0x42d5fc);return getUser(_0x42d5fc,_0x49ae6a[_0x05b4('0x28')])[_0x05b4('0x20')](function(_0x51fb1b){_0xb18847=_0x51fb1b;logger[_0x05b4('0xc')](_0x05b4('0x52'),_0xb18847['id']);return getEndUser(_0x42d5fc,_0x409c85[_0x05b4('0xf')],_0x409c85[_0x05b4('0x10')]);})[_0x05b4('0x20')](function(_0x5ef0d1){_0x180a13=_0x5ef0d1;logger['info'](_0x05b4('0x53'),_0x180a13['id']);return getTicket(_0x42d5fc,_0xb18847,_0x180a13,_0x382850,_0x409c85);})['then'](function(_0x40a9f1){if(_0x40a9f1&&_0x40a9f1['id']){logger[_0x05b4('0xc')](_0x05b4('0x21'));logger[_0x05b4('0xc')](_0x05b4('0x54'),_0x40a9f1['id']);logger[_0x05b4('0xc')](_0x05b4('0x4c'),_0x05b4('0x55'));emit(util[_0x05b4('0x1c')]('user:%s',_0x49ae6a[_0x05b4('0x16')]),_0x05b4('0x56'),{'uri':util[_0x05b4('0x1c')]('%s/helpdesk/tickets/%d',_0x42d5fc[_0x05b4('0x1e')],_0x40a9f1['id'])});}})['catch'](function(_0x1b0a9a){logger[_0x05b4('0x57')](_0x05b4('0x4c'),JSON[_0x05b4('0x36')](_0x1b0a9a));});};exports[_0x05b4('0x58')]=function(_0x34c86a,_0x4ccf5b,_0x271211,_0x2b3586,_0x2a500c,_0x497b1f,_0x4c85dc){var _0x1109fc,_0x3c704a;_0x497b1f[_0x05b4('0x1e')]=intUtil['stripTrailingSlash'](_0x497b1f[_0x05b4('0x1e')]);_0x497b1f['serverUrl']=intUtil['stripTrailingSlash'](_0x497b1f['serverUrl']);if(_0x4c85dc&&_0x4c85dc[_0x05b4('0x59')]&&_0x4c85dc[_0x05b4('0x59')]!==_0x05b4('0x5a')){logger[_0x05b4('0xc')](_0x05b4('0x5b'),_0x05b4('0x4d'));_0x4ccf5b[_0x05b4('0x4e')]=util[_0x05b4('0x1c')](_0x05b4('0x4f'),_0x497b1f['serverUrl'],_0x4ccf5b['uniqueid'],md5(_0x4ccf5b['uniqueid']));}headers['Authorization']=getAuth(_0x497b1f);return getUser(_0x497b1f,_0x2b3586[_0x05b4('0x28')])['then'](function(_0x38842b){_0x1109fc=_0x38842b;logger[_0x05b4('0xc')](_0x05b4('0x52'),_0x1109fc['id']);return getEndUser(_0x497b1f,_0x4ccf5b[_0x05b4('0x5c')],_0x4ccf5b['destcalleridnum']);})[_0x05b4('0x20')](function(_0x293e3a){_0x3c704a=_0x293e3a;logger['info'](_0x05b4('0x53'),_0x3c704a['id']);return getTicket(_0x497b1f,_0x1109fc,_0x3c704a,_0x271211,_0x4ccf5b);})[_0x05b4('0x20')](function(_0x160a9d){if(_0x160a9d&&_0x160a9d['id']){logger[_0x05b4('0xc')](_0x05b4('0x21'));logger[_0x05b4('0xc')](_0x05b4('0x54'),_0x160a9d['id']);logger[_0x05b4('0xc')](_0x05b4('0x5b'),_0x05b4('0x55'));emit(util[_0x05b4('0x1c')]('user:%s',_0x2b3586['name']),_0x05b4('0x56'),{'uri':util[_0x05b4('0x1c')](_0x05b4('0x5d'),_0x497b1f[_0x05b4('0x1e')],_0x160a9d['id'])});}})['catch'](function(_0x4f3a21){logger['error']('[OUTBOUND]',JSON[_0x05b4('0x36')](_0x4f3a21));});};exports[_0x05b4('0x5e')]=function(_0x23d0b7,_0x150514,_0xb0b8de,_0x3a8d9d,_0x282655,_0x419c28){var _0x184f32,_0x2beda5;_0x419c28[_0x05b4('0x1e')]=intUtil[_0x05b4('0x49')](_0x419c28[_0x05b4('0x1e')]);_0x419c28[_0x05b4('0x4a')]=intUtil['stripTrailingSlash'](_0x419c28[_0x05b4('0x4a')]);if(_0x282655&&_0x282655[_0x05b4('0x4b')]){logger['info']('['+_0x150514['lastevent'][_0x05b4('0x5f')]()+']',_0x05b4('0x4d'));_0x150514[_0x05b4('0x4e')]=util[_0x05b4('0x1c')](_0x05b4('0x4f'),_0x419c28[_0x05b4('0x4a')],_0x150514['uniqueid'],md5(_0x150514[_0x05b4('0x50')]));}else{_0x150514[_0x05b4('0x4e')]='';}headers[_0x05b4('0x51')]=getAuth(_0x419c28);return getUser(_0x419c28,'')[_0x05b4('0x20')](function(_0x1126c1){_0x184f32=_0x1126c1;logger['info'](_0x05b4('0x52'),_0x184f32['id']);return getEndUser(_0x419c28,_0x150514[_0x05b4('0xf')],_0x150514[_0x05b4('0x10')]);})[_0x05b4('0x20')](function(_0x3149d2){_0x2beda5=_0x3149d2;logger[_0x05b4('0xc')](_0x05b4('0x53'),_0x2beda5['id']);return getTicket(_0x419c28,_0x184f32,_0x2beda5,_0xb0b8de,_0x150514);})[_0x05b4('0x20')](function(_0x253aa2){if(_0x253aa2){logger['info'](_0x05b4('0x21'));logger[_0x05b4('0xc')](_0x05b4('0x54'),_0x253aa2['id']);}})[_0x05b4('0x60')](function(_0x4714e6){logger[_0x05b4('0x57')]('['+_0x150514[_0x05b4('0x61')]['toUpperCase']()+']',JSON['stringify'](_0x4714e6));});}; \ No newline at end of file +var _0x3588=['find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','apiKey','base64','debug','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','push','toString','variable','customField','variableName','Variable','queue','serverUrl','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Authorization','The\x20Enduser\x20ID\x20is:','stringify','unmanaged','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','toUpperCase','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','Subjects','getString','Descriptions','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Enduser\x20found!'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x3588,0x1ea));var _0x8358=function(_0x13fcd2,_0x4765b5){_0x13fcd2=_0x13fcd2-0x0;var _0x205d2a=_0x3588[_0x13fcd2];return _0x205d2a;};'use strict';var _=require('lodash');var rp=require(_0x8358('0x0'));var md5=require('md5');var util=require(_0x8358('0x1'));var Redis=require(_0x8358('0x2'));var intUtil=require(_0x8358('0x3'));var config=require(_0x8358('0x4'));var logger=require(_0x8358('0x5'))(_0x8358('0x6'));config[_0x8358('0x7')]=_[_0x8358('0x8')](config[_0x8358('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8358('0x7')]));var headers={'Content-Type':_0x8358('0x9'),'Accept':_0x8358('0x9')};function emit(_0x5899c0,_0x5aa39c,_0x59cd12){io['to'](_0x5899c0)['emit'](_0x5aa39c,_0x59cd12);}function getTicket(_0x54314a,_0x412bb9,_0x1072b3,_0x385952,_0x121ec6){logger[_0x8358('0xa')](_0x8358('0xb'));var _0x13a6c9=_[_0x8358('0xc')]({'responder_id':_0x412bb9['id'],'requester_id':_0x1072b3['id'],'name':util[_0x8358('0xd')](_0x8358('0xe'),_0x121ec6['calleridname']),'phone':_0x121ec6[_0x8358('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x385952[_0x8358('0x10')],_0x121ec6,'\x20'),'description':intUtil[_0x8358('0x11')](_0x385952[_0x8358('0x12')],_0x121ec6,'
'),'tags':getTags(_0x385952['Tags'],_0x8358('0x13'))},getCustomFields(_0x385952[_0x8358('0x14')],_0x121ec6));_0x13a6c9[_0x8358('0x15')]=_['mapValues'](_[_0x8358('0x16')](_0x13a6c9[_0x8358('0x15')],'id'),_0x8358('0x17'));return request({'uri':util[_0x8358('0xd')](_0x8358('0x18'),_0x54314a[_0x8358('0x19')]),'method':_0x8358('0x1a'),'body':_0x13a6c9})[_0x8358('0x1b')](function(_0x531dec){logger[_0x8358('0xa')](_0x8358('0x1c'));return _0x531dec;});}function getUser(_0x5d24e7,_0x298077){if(intUtil[_0x8358('0x1d')](_0x298077)){return request({'uri':util[_0x8358('0xd')]('%s/api/v2/agents',_0x5d24e7[_0x8358('0x19')]),'qs':{'email':_0x298077}})[_0x8358('0x1b')](function(_0x2da5bb){if(_0x2da5bb[_0x8358('0x1e')]){logger[_0x8358('0xa')]('Agent\x20found!');return _['find'](_0x2da5bb,function(_0x3ce30d){return _0x3ce30d[_0x8358('0x1f')][_0x8358('0x20')]===_0x298077;});}else{logger[_0x8358('0xa')](_0x8358('0x21'));return request({'uri':util[_0x8358('0xd')](_0x8358('0x22'),_0x5d24e7[_0x8358('0x19')])})[_0x8358('0x1b')](function(_0xd8f924){logger[_0x8358('0xa')]('Admin\x20account\x20selected.');return _0xd8f924;});}});}else{logger[_0x8358('0xa')](_0x8358('0x23'));return request({'uri':util[_0x8358('0xd')](_0x8358('0x22'),_0x5d24e7['remoteUri'])})['then'](function(_0x66e31b){logger[_0x8358('0xa')](_0x8358('0x24'));return _0x66e31b;});}}function getEndUser(_0x3a4da7,_0x162c5e,_0x30424b){logger[_0x8358('0xa')]('Searching\x20enduser\x20with\x20phone',_0x30424b);return request({'uri':util[_0x8358('0xd')]('%s/api/v2/contacts',_0x3a4da7[_0x8358('0x19')]),'qs':{'phone':_0x30424b}})['then'](function(_0x29203f){if(_0x29203f[_0x8358('0x1e')]){logger['info'](_0x8358('0x25'));return _[_0x8358('0x26')](_0x29203f,{'phone':_0x30424b});}else{logger['info'](_0x8358('0x27'));return request({'uri':util['format'](_0x8358('0x28'),_0x3a4da7[_0x8358('0x19')]),'method':_0x8358('0x1a'),'body':{'name':_0x162c5e,'phone':_0x30424b}})[_0x8358('0x1b')](function(_0x14a3e6){logger[_0x8358('0xa')](_0x8358('0x29'));return _0x14a3e6;});}});}function getAuth(_0x4bba60){return util['format']('Basic\x20%s',new Buffer(_0x4bba60[_0x8358('0x2a')]+':X')['toString'](_0x8358('0x2b')));}function request(_0x7e0730){logger[_0x8358('0x2c')]('[HTTP]',JSON['stringify'](_0x7e0730));return rp(_[_0x8358('0x8')](_0x7e0730,{'method':_0x8358('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x29f9b1,_0xb25f09){var _0x8e1a6e=[];if(_0x29f9b1&&_0x29f9b1['length']>0x0){_0x8e1a6e=_[_0x8358('0x2e')](_0x29f9b1,_0xb25f09);}return _0x8e1a6e;}function getCustomFields(_0x16b8d3,_0x1db710){var _0x16c186=[];var _0xeb9e26={'custom_fields':[]};if(_0x16b8d3[_0x8358('0x1e')]>0x0){_[_0x8358('0x2f')](_0x16b8d3,function(_0x4b17ab){if(_[_0x8358('0x30')]([_0x8358('0x31'),_0x8358('0x32')],_0x4b17ab[_0x8358('0x33')])&&_0x4b17ab['nameField']&&!_0x4b17ab['customField']){_0xeb9e26[_0x4b17ab[_0x8358('0x34')][_0x8358('0x35')]()]=_0x4b17ab[_0x8358('0x36')]['toString']();}else if(_[_0x8358('0x30')]([_0x8358('0x31'),'picklist'],_0x4b17ab['type'])&&_0x4b17ab[_0x8358('0x37')]&&_0x4b17ab['customField']){_0xeb9e26['custom_fields'][_0x8358('0x38')]({'id':_0x4b17ab[_0x8358('0x37')],'value':_0x4b17ab[_0x8358('0x36')][_0x8358('0x39')]()});}else if(_0x4b17ab[_0x8358('0x33')]===_0x8358('0x3a')&&_0x4b17ab['variableName']&&_0x4b17ab[_0x8358('0x37')]&&_0x4b17ab[_0x8358('0x3b')]){_0x1db710[_0x4b17ab['variableName']]&&_0xeb9e26[_0x8358('0x15')][_0x8358('0x38')]({'id':_0x4b17ab['idField'],'value':_0x1db710[_0x4b17ab[_0x8358('0x3c')]][_0x8358('0x39')]()});}else if(_0x4b17ab[_0x8358('0x33')]==='customVariable'&&_0x4b17ab[_0x8358('0x3d')]&&_0x4b17ab['Variable']['name']&&_0x4b17ab[_0x8358('0x37')]&&_0x4b17ab['customField']){_0x1db710[_0x4b17ab[_0x8358('0x3d')][_0x8358('0x13')][_0x8358('0x35')]()]&&_0xeb9e26[_0x8358('0x15')]['push']({'id':_0x4b17ab[_0x8358('0x37')],'value':_0x1db710[_0x4b17ab[_0x8358('0x3d')][_0x8358('0x13')][_0x8358('0x35')]()]['toString']()});}});}return _0xeb9e26;}exports[_0x8358('0x3e')]=function(_0x17796a,_0x5a1394,_0xdfa842,_0x8e17d0,_0x4751c5,_0x35631f){var _0x3f4671,_0x2e083d;_0x35631f[_0x8358('0x19')]=intUtil['stripTrailingSlash'](_0x35631f[_0x8358('0x19')]);_0x35631f['serverUrl']=intUtil['stripTrailingSlash'](_0x35631f[_0x8358('0x3f')]);if(_0x4751c5&&_0x4751c5['monitor_format']){logger[_0x8358('0xa')](_0x8358('0x40'),'Recording\x20is\x20enabled!');_0x5a1394[_0x8358('0x41')]=util[_0x8358('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35631f[_0x8358('0x3f')],_0x5a1394[_0x8358('0x42')],md5(_0x5a1394[_0x8358('0x42')]));}else{_0x5a1394['recordingURL']='';}headers['Authorization']=getAuth(_0x35631f);return getUser(_0x35631f,_0x8e17d0[_0x8358('0x20')])[_0x8358('0x1b')](function(_0x1487ff){_0x3f4671=_0x1487ff;logger[_0x8358('0xa')](_0x8358('0x43'),_0x3f4671['id']);return getEndUser(_0x35631f,_0x5a1394[_0x8358('0x44')],_0x5a1394[_0x8358('0xf')]);})[_0x8358('0x1b')](function(_0x49645e){_0x2e083d=_0x49645e;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2e083d['id']);return getTicket(_0x35631f,_0x3f4671,_0x2e083d,_0xdfa842,_0x5a1394);})['then'](function(_0x196e3c){if(_0x196e3c&&_0x196e3c['id']){logger[_0x8358('0xa')](_0x8358('0x1c'));logger['info'](_0x8358('0x45'),_0x196e3c['id']);logger[_0x8358('0xa')](_0x8358('0x40'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8358('0xd')](_0x8358('0x46'),_0x8e17d0[_0x8358('0x13')]),_0x8358('0x47'),{'uri':util['format'](_0x8358('0x48'),_0x35631f['remoteUri'],_0x196e3c['id'])});}})[_0x8358('0x49')](function(_0x407587){logger[_0x8358('0x4a')](_0x8358('0x40'),JSON['stringify'](_0x407587));});};exports[_0x8358('0x4b')]=function(_0x19d071,_0x278f92,_0x438bed,_0x50f1c0,_0x296474,_0x1351b5,_0x512281){var _0x41c831,_0x7b1b1b;_0x1351b5['remoteUri']=intUtil[_0x8358('0x4c')](_0x1351b5[_0x8358('0x19')]);_0x1351b5[_0x8358('0x3f')]=intUtil[_0x8358('0x4c')](_0x1351b5[_0x8358('0x3f')]);if(_0x512281&&_0x512281[_0x8358('0x4d')]&&_0x512281[_0x8358('0x4d')]!==_0x8358('0x4e')){logger['info'](_0x8358('0x4f'),'Recording\x20is\x20enabled!');_0x278f92[_0x8358('0x41')]=util[_0x8358('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1351b5[_0x8358('0x3f')],_0x278f92['uniqueid'],md5(_0x278f92[_0x8358('0x42')]));}headers[_0x8358('0x50')]=getAuth(_0x1351b5);return getUser(_0x1351b5,_0x50f1c0[_0x8358('0x20')])['then'](function(_0x3eb9a1){_0x41c831=_0x3eb9a1;logger[_0x8358('0xa')](_0x8358('0x43'),_0x41c831['id']);return getEndUser(_0x1351b5,_0x278f92['destcalleridname'],_0x278f92['destcalleridnum']);})[_0x8358('0x1b')](function(_0x168752){_0x7b1b1b=_0x168752;logger[_0x8358('0xa')](_0x8358('0x51'),_0x7b1b1b['id']);return getTicket(_0x1351b5,_0x41c831,_0x7b1b1b,_0x438bed,_0x278f92);})[_0x8358('0x1b')](function(_0x23a50a){if(_0x23a50a&&_0x23a50a['id']){logger[_0x8358('0xa')](_0x8358('0x1c'));logger[_0x8358('0xa')]('The\x20Ticket\x20ID\x20is:',_0x23a50a['id']);logger[_0x8358('0xa')](_0x8358('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8358('0xd')](_0x8358('0x46'),_0x50f1c0[_0x8358('0x13')]),'trigger:browser:url',{'uri':util['format'](_0x8358('0x48'),_0x1351b5[_0x8358('0x19')],_0x23a50a['id'])});}})[_0x8358('0x49')](function(_0x4173a1){logger['error'](_0x8358('0x4f'),JSON[_0x8358('0x52')](_0x4173a1));});};exports[_0x8358('0x53')]=function(_0x2040e1,_0x5badc3,_0x4a7432,_0x226d7f,_0x9926bd,_0xea4714){var _0x3c5866,_0x254108;_0xea4714[_0x8358('0x19')]=intUtil['stripTrailingSlash'](_0xea4714['remoteUri']);_0xea4714[_0x8358('0x3f')]=intUtil[_0x8358('0x4c')](_0xea4714[_0x8358('0x3f')]);if(_0x9926bd&&_0x9926bd[_0x8358('0x54')]){logger[_0x8358('0xa')]('['+_0x5badc3['lastevent']['toUpperCase']()+']',_0x8358('0x55'));_0x5badc3['recordingURL']=util[_0x8358('0xd')](_0x8358('0x56'),_0xea4714[_0x8358('0x3f')],_0x5badc3[_0x8358('0x42')],md5(_0x5badc3[_0x8358('0x42')]));}else{_0x5badc3['recordingURL']='';}headers['Authorization']=getAuth(_0xea4714);return getUser(_0xea4714,'')['then'](function(_0x35f919){_0x3c5866=_0x35f919;logger[_0x8358('0xa')](_0x8358('0x43'),_0x3c5866['id']);return getEndUser(_0xea4714,_0x5badc3[_0x8358('0x44')],_0x5badc3['calleridnum']);})['then'](function(_0x260842){_0x254108=_0x260842;logger[_0x8358('0xa')]('The\x20Enduser\x20ID\x20is:',_0x254108['id']);return getTicket(_0xea4714,_0x3c5866,_0x254108,_0x4a7432,_0x5badc3);})[_0x8358('0x1b')](function(_0x28f56d){if(_0x28f56d){logger[_0x8358('0xa')](_0x8358('0x1c'));logger[_0x8358('0xa')](_0x8358('0x45'),_0x28f56d['id']);}})['catch'](function(_0x5a4ad9){logger['error']('['+_0x5badc3['lastevent'][_0x8358('0x57')]()+']',JSON['stringify'](_0x5a4ad9));});}; \ 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 a33cd09..ee032e4 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 _0x55e3=['email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','Getting\x20user\x20list','then','Getting\x20user\x20with\x20email','userEmail','agentEmail','userId','User\x20found:','Admin\x20selected','catch','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','message','Creating\x20new\x20task','POST','getString','Subjects','Contact','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','serverUrl','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','name','inspect','lodash','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','GET','Getting\x20admin\x20information','users','length'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x55e3,0xdd));var _0x355e=function(_0x602f31,_0x37b83d){_0x602f31=_0x602f31-0x0;var _0x597805=_0x55e3[_0x602f31];return _0x597805;};'use strict';var _=require(_0x355e('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var moment=require(_0x355e('0x1'));var Promise=require(_0x355e('0x2'));var Redis=require(_0x355e('0x3'));var intUtil=require('./util');var config=require(_0x355e('0x4'));var logger=require(_0x355e('0x5'))('freshsales');config[_0x355e('0x6')]=_['defaults'](config[_0x355e('0x6')],{'host':_0x355e('0x7'),'port':0x18eb});var io=require(_0x355e('0x8'))(new Redis(config[_0x355e('0x6')]));function getAdminId(_0x122997,_0x4a6f7e,_0x9b1247,_0x240f43){return new Promise(function(_0x3b2565,_0x1fae16){var _0x23d24f=![];var _0x4f381b={'method':_0x355e('0x9'),'uri':_0x240f43+'/api/selector/owners','json':!![]};_0x4f381b['headers']=_0x9b1247;logger['info'](_0x355e('0xa'));return rp(_0x4f381b)['then'](function(_0x4eab49){if(_0x4eab49){var _0x348981=_0x4eab49[_0x355e('0xb')];var _0x3cf577=null;for(_0x3cf577=0x0;_0x3cf577<_0x348981[_0x355e('0xc')];_0x3cf577++){if(_0x348981[_0x3cf577][_0x355e('0xd')]===_0x122997[_0x355e('0xe')]){_0x122997[_0x355e('0xf')]=_0x348981[_0x3cf577]['id'];_0x23d24f=!![];}}if(_0x23d24f){logger[_0x355e('0x10')](_0x355e('0x11'),_0x122997[_0x355e('0xf')]);_0x3b2565(_0x122997);}else{_0x1fae16({'statusCode':0x194,'message':_0x355e('0x12')});}}else{_0x1fae16({'statusCode':0x194,'message':_0x355e('0x12')});}})['catch'](function(_0x42e0da){logger[_0x355e('0x13')]('['+[_0x4a6f7e[_0x355e('0x14')]()]+']',_0x42e0da['message']);_0x1fae16(_0x42e0da);});});}function getUser(_0x2506ea,_0x4187e3,_0x2df146){return function(_0xcb3183){return new Promise(function(_0x2a1aca,_0x54c747){var _0x1f27a3={'method':_0x355e('0x9'),'uri':_0x2df146+'/api/selector/owners','json':!![]};_0x1f27a3['headers']=_0x4187e3;logger['info'](_0x355e('0x15'));return rp(_0x1f27a3)[_0x355e('0x16')](function(_0x52802b){if(_0x52802b){var _0x17f8b8=_0x52802b[_0x355e('0xb')];var _0x362c57=![];var _0x1f61c8=null;if(_0xcb3183['agentEmail']!==null){logger[_0x355e('0x10')](_0x355e('0x17'),_0xcb3183['agentEmail']);_0xcb3183[_0x355e('0x18')]=_0xcb3183[_0x355e('0x19')];for(_0x1f61c8=0x0;_0x1f61c8<_0x17f8b8['length'];_0x1f61c8++){if(_0x17f8b8[_0x1f61c8][_0x355e('0xd')]===_0xcb3183[_0x355e('0x19')]){_0x362c57=!![];_0xcb3183[_0x355e('0x1a')]=_0x17f8b8[_0x1f61c8]['id'];logger['info'](_0x355e('0x1b'),_0xcb3183[_0x355e('0x1a')]);}}}if(!_0x362c57){logger[_0x355e('0x10')](_0x355e('0x1c'));_0xcb3183['userEmail']=_0xcb3183[_0x355e('0xe')];_0xcb3183['userId']=_0xcb3183['adminId'];_0x362c57=!![];}if(_0x362c57){_0x2a1aca(_0xcb3183);}else{_0x54c747({'statusCode':0x194,'message':_0x355e('0x12')});}}else{_0x54c747({'statusCode':0x194,'message':_0x355e('0x12')});}})[_0x355e('0x1d')](function(_0x2cf901){logger[_0x355e('0x13')]('['+[_0x2506ea[_0x355e('0x14')]()]+']',_0x2cf901['message']);_0x54c747(_0x2cf901);});});};}function searchContact(_0x5e6939,_0x4dc2ae,_0x4f8643,_0x44e684){return new Promise(function(_0x3290d8,_0x13e019){var _0x2ad069={'method':_0x355e('0x9'),'headers':_0x4dc2ae,'uri':_0x5e6939+_0x355e('0x1e')+_0x44e684+_0x355e('0x1f')+_0x4f8643+_0x355e('0x20'),'json':!![]};rp(_0x2ad069)[_0x355e('0x16')](function(_0x3d98c4){var _0x2812fc=_[_0x355e('0x21')](_0x3d98c4[_0x355e('0x22')][_0x355e('0x22')],[_0x4f8643,_0x44e684]);_0x3290d8(_0x2812fc);})[_0x355e('0x1d')](function(_0x4bc3fe){_0x13e019(_0x4bc3fe);});});}function getEndUser(_0x315ab4,_0x1c5a7a,_0x31ec17){return function(_0x52c89b){return new Promise(function(_0x4e3597,_0xc2ec5a){logger[_0x355e('0x10')](util[_0x355e('0x23')](_0x355e('0x24'),_0x52c89b[_0x355e('0x25')]));searchContact(_0x31ec17,_0x1c5a7a,_0x355e('0x26'),_0x52c89b[_0x355e('0x25')])[_0x355e('0x16')](function(_0x3320f9){if(_0x3320f9){_0x52c89b[_0x355e('0x27')]=_0x3320f9['id'];logger[_0x355e('0x10')]('Contact\x20found\x20mobile_number:',_0x52c89b['endUserId']);return _0x4e3597(_0x52c89b);}searchContact(_0x31ec17,_0x1c5a7a,'work_number',_0x52c89b[_0x355e('0x25')])[_0x355e('0x16')](function(_0x1f8eb0){if(_0x1f8eb0){_0x52c89b[_0x355e('0x27')]=_0x1f8eb0['id'];logger[_0x355e('0x10')]('Contact\x20found\x20work_number:',_0x52c89b[_0x355e('0x27')]);return _0x4e3597(_0x52c89b);}createEndUser(_0x52c89b,_0x315ab4,_0x1c5a7a,_0x31ec17)[_0x355e('0x16')](function(_0x33a670){logger[_0x355e('0x10')](_0x355e('0x28'),_0x33a670[_0x355e('0x27')]);return _0x4e3597(_0x33a670);});});})['catch'](function(_0x3ff84d){_0xc2ec5a(_0x3ff84d);});});};}function createEndUser(_0x1efbec,_0x1dbebf,_0x4422a8,_0x137096){return new Promise(function(_0x2dfd35,_0x660cc){var _0x15774f=moment();var _0x1f782e={'method':'POST','uri':_0x137096+_0x355e('0x29'),'body':{'contact':{'last_name':_0x1efbec[_0x355e('0x25')],'work_number':_0x1efbec[_0x355e('0x25')],'mobile_number':_0x1efbec[_0x355e('0x25')],'owner_id':_0x1efbec['userId'],'created_at':_0x15774f['format'](_0x355e('0x2a'))}},'json':!![]};_0x1f782e[_0x355e('0x2b')]=_0x4422a8;logger['info'](_0x355e('0x2c'));return rp(_0x1f782e)['then'](function(_0x41f75e){_0x1efbec[_0x355e('0x27')]=_0x41f75e[_0x355e('0x2d')]['id'];_0x2dfd35(_0x1efbec);})[_0x355e('0x1d')](function(_0x4022c1){logger['error']('['+[_0x1dbebf[_0x355e('0x14')]()]+']',_0x4022c1['message']);_0x660cc(_0x4022c1[_0x355e('0x2e')]);});});}function getTicket(_0x537a40,_0x1d66cc,_0xc37098,_0xe2a777,_0x83fe12){return function(_0xda6588){logger['info'](_0x355e('0x2f'));return new Promise(function(_0x3468a7,_0x16befb){var _0x4782e1=moment();var _0x3d22b8={'method':_0x355e('0x30'),'uri':_0xc37098+'/api/tasks','body':{'title':intUtil[_0x355e('0x31')](_0xe2a777[_0x355e('0x32')],_0x83fe12,'\x20'),'description':intUtil[_0x355e('0x31')](_0xe2a777['Descriptions'],_0x83fe12,'\x0a'),'owner_id':_0xda6588['userId'],'creater_id':_0xda6588[_0x355e('0xf')],'targetable_id':_0xda6588['endUserId'],'targetable_type':_0x355e('0x33'),'created_at':_0x4782e1['format'](_0x355e('0x2a')),'due_date':_0x4782e1['add'](0x1e,'m')[_0x355e('0x23')](_0x355e('0x2a'))},'json':!![]};_0x3d22b8[_0x355e('0x2b')]=_0x1d66cc;return rp(_0x3d22b8)[_0x355e('0x16')](function(_0x136f39){_0xda6588[_0x355e('0x34')]=_0x136f39[_0x355e('0x35')]['id'];logger['info'](_0x355e('0x36'),_0xda6588[_0x355e('0x34')]);_0x3468a7(_0xda6588);})[_0x355e('0x1d')](function(_0xbba0be){logger[_0x355e('0x13')]('['+[_0x537a40[_0x355e('0x14')]()]+']',_0xbba0be['message']);_0x16befb(_0xbba0be[_0x355e('0x2e')]);});});};}function emit(_0x2f02d6,_0x331a60,_0x38a6a3){var _0x254509={'uri':_0x2f02d6+_0x355e('0x37')+_0x38a6a3};io['to'](util[_0x355e('0x23')](_0x355e('0x38'),_0x331a60))[_0x355e('0x39')]('trigger:browser:url',_0x254509);}exports['cs']=function(_0x4f4f0e,_0x9636f8,_0x262d7e,_0x240c52,_0xb5d707,_0x440902,_0x1a2bd7,_0x19d9d2){var _0x4d8b1b={};var _0x4f6888={'Authorization':_0x355e('0x3a')+_0x440902[_0x355e('0x3b')]};_0x440902[_0x355e('0x3c')]=intUtil['stripTrailingSlash'](_0x440902[_0x355e('0x3c')]);_0x440902['serverUrl']=intUtil['stripTrailingSlash'](_0x440902[_0x355e('0x3d')]);var _0xb19921=_0x440902[_0x355e('0x3c')];_0x4d8b1b[_0x355e('0xe')]=_0x440902['username'];_0x4d8b1b[_0x355e('0x25')]=_0x19d9d2[_0x355e('0x3e')]()==='outbound'?_0x9636f8[_0x355e('0x3f')]:_0x9636f8[_0x355e('0x40')];_0x4d8b1b[_0x355e('0x41')]=_0x19d9d2===_0x355e('0x42')||_0x19d9d2===_0x355e('0x43')?_0x355e('0x42'):'outbound';if(_0x240c52){_0x4d8b1b[_0x355e('0x19')]=_0x240c52['email'];}var _0x281303=util[_0x355e('0x23')](_0x355e('0x44'),_0x440902[_0x355e('0x3d')],_0x9636f8[_0x355e('0x45')],md5(_0x9636f8[_0x355e('0x45')]));if(_0xb5d707&&_0xb5d707['monitor_format']){logger[_0x355e('0x10')](_0x355e('0x46'),_0x355e('0x47'));_0x9636f8[_0x355e('0x48')]=_0x281303;}else if(_0x1a2bd7&&_0x1a2bd7[_0x355e('0x49')]&&_0x1a2bd7[_0x355e('0x49')]!==_0x355e('0x4a')){logger[_0x355e('0x10')]('[OUTBOUND]',_0x355e('0x47'));_0x9636f8[_0x355e('0x48')]=_0x281303;}else{_0x9636f8['recordingURL']='';}return getAdminId(_0x4d8b1b,_0x19d9d2,_0x4f6888,_0xb19921)[_0x355e('0x16')](getUser(_0x19d9d2,_0x4f6888,_0xb19921))[_0x355e('0x16')](getEndUser(_0x19d9d2,_0x4f6888,_0xb19921))[_0x355e('0x16')](getTicket(_0x19d9d2,_0x4f6888,_0xb19921,_0x262d7e,_0x9636f8))['then'](function(_0x2cc93b){logger['info'](util[_0x355e('0x23')](_0x355e('0x4b'),_0x2cc93b[_0x355e('0x34')]));if(_0x19d9d2!==_0x355e('0x43')){logger[_0x355e('0x10')]('['+[_0x19d9d2['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0xb19921,_0x240c52[_0x355e('0x4c')],_0x2cc93b[_0x355e('0x27')]);}})[_0x355e('0x1d')](function(_0xfb6c5f){logger[_0x355e('0x13')]('['+[_0x19d9d2[_0x355e('0x14')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x355e('0x4d')](_0xfb6c5f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2d29=['Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','/api/lookup?q=','&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:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','user:%s','emit','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','util','moment','bluebird','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0x2d29,0x8e));var _0x92d2=function(_0x592da3,_0x4bc81d){_0x592da3=_0x592da3-0x0;var _0x5dd68e=_0x2d29[_0x592da3];return _0x5dd68e;};'use strict';var _=require(_0x92d2('0x0'));var rp=require(_0x92d2('0x1'));var md5=require('md5');var util=require(_0x92d2('0x2'));var moment=require(_0x92d2('0x3'));var Promise=require(_0x92d2('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x92d2('0x5'));config[_0x92d2('0x6')]=_[_0x92d2('0x7')](config[_0x92d2('0x6')],{'host':_0x92d2('0x8'),'port':0x18eb});var io=require(_0x92d2('0x9'))(new Redis(config[_0x92d2('0x6')]));function getAdminId(_0x495b22,_0x416335,_0x32a57a,_0x2322fa){return new Promise(function(_0x50bbce,_0x819063){var _0x14c78c=![];var _0x520386={'method':_0x92d2('0xa'),'uri':_0x2322fa+_0x92d2('0xb'),'json':!![]};_0x520386[_0x92d2('0xc')]=_0x32a57a;logger[_0x92d2('0xd')](_0x92d2('0xe'));return rp(_0x520386)[_0x92d2('0xf')](function(_0x403e68){if(_0x403e68){var _0x32f20e=_0x403e68[_0x92d2('0x10')];var _0x214a46=null;for(_0x214a46=0x0;_0x214a46<_0x32f20e['length'];_0x214a46++){if(_0x32f20e[_0x214a46][_0x92d2('0x11')]===_0x495b22[_0x92d2('0x12')]){_0x495b22[_0x92d2('0x13')]=_0x32f20e[_0x214a46]['id'];_0x14c78c=!![];}}if(_0x14c78c){logger[_0x92d2('0xd')](_0x92d2('0x14'),_0x495b22['adminId']);_0x50bbce(_0x495b22);}else{_0x819063({'statusCode':0x194,'message':_0x92d2('0x15')});}}else{_0x819063({'statusCode':0x194,'message':_0x92d2('0x15')});}})[_0x92d2('0x16')](function(_0x5aa088){logger[_0x92d2('0x17')]('['+[_0x416335[_0x92d2('0x18')]()]+']',_0x5aa088[_0x92d2('0x19')]);_0x819063(_0x5aa088);});});}function getUser(_0x19187a,_0x29ac3a,_0xfc2544){return function(_0x378335){return new Promise(function(_0x15fbbd,_0x17028f){var _0x419917={'method':_0x92d2('0xa'),'uri':_0xfc2544+'/api/selector/owners','json':!![]};_0x419917[_0x92d2('0xc')]=_0x29ac3a;logger[_0x92d2('0xd')](_0x92d2('0x1a'));return rp(_0x419917)[_0x92d2('0xf')](function(_0x2d35da){if(_0x2d35da){var _0x3bc5cb=_0x2d35da[_0x92d2('0x10')];var _0x329891=![];var _0x2a74ed=null;if(_0x378335[_0x92d2('0x1b')]!==null){logger[_0x92d2('0xd')](_0x92d2('0x1c'),_0x378335[_0x92d2('0x1b')]);_0x378335[_0x92d2('0x1d')]=_0x378335['agentEmail'];for(_0x2a74ed=0x0;_0x2a74ed<_0x3bc5cb['length'];_0x2a74ed++){if(_0x3bc5cb[_0x2a74ed][_0x92d2('0x11')]===_0x378335[_0x92d2('0x1b')]){_0x329891=!![];_0x378335['userId']=_0x3bc5cb[_0x2a74ed]['id'];logger[_0x92d2('0xd')](_0x92d2('0x1e'),_0x378335['userId']);}}}if(!_0x329891){logger[_0x92d2('0xd')]('Admin\x20selected');_0x378335['userEmail']=_0x378335['adminEmail'];_0x378335[_0x92d2('0x1f')]=_0x378335[_0x92d2('0x13')];_0x329891=!![];}if(_0x329891){_0x15fbbd(_0x378335);}else{_0x17028f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x17028f({'statusCode':0x194,'message':_0x92d2('0x15')});}})[_0x92d2('0x16')](function(_0x36eeef){logger['error']('['+[_0x19187a[_0x92d2('0x18')]()]+']',_0x36eeef['message']);_0x17028f(_0x36eeef);});});};}function searchContact(_0x958375,_0x270d0d,_0x1a84b6,_0x38be2f){return new Promise(function(_0x3270e0,_0x548bf9){var _0x5eb892={'method':'GET','headers':_0x270d0d,'uri':_0x958375+_0x92d2('0x20')+_0x38be2f+_0x92d2('0x21')+_0x1a84b6+_0x92d2('0x22'),'json':!![]};rp(_0x5eb892)[_0x92d2('0xf')](function(_0x51ed15){var _0x590728=_[_0x92d2('0x23')](_0x51ed15[_0x92d2('0x24')][_0x92d2('0x24')],[_0x1a84b6,_0x38be2f]);_0x3270e0(_0x590728);})[_0x92d2('0x16')](function(_0xf9e9e4){_0x548bf9(_0xf9e9e4);});});}function getEndUser(_0x1b140e,_0x1fafdc,_0x10af91){return function(_0x118ee4){return new Promise(function(_0x83f7ae,_0x575ded){logger[_0x92d2('0xd')](util[_0x92d2('0x25')](_0x92d2('0x26'),_0x118ee4[_0x92d2('0x27')]));searchContact(_0x10af91,_0x1fafdc,_0x92d2('0x28'),_0x118ee4['contactNumber'])[_0x92d2('0xf')](function(_0x1c598e){if(_0x1c598e){_0x118ee4[_0x92d2('0x29')]=_0x1c598e['id'];logger['info'](_0x92d2('0x2a'),_0x118ee4[_0x92d2('0x29')]);return _0x83f7ae(_0x118ee4);}searchContact(_0x10af91,_0x1fafdc,_0x92d2('0x2b'),_0x118ee4[_0x92d2('0x27')])['then'](function(_0x585235){if(_0x585235){_0x118ee4[_0x92d2('0x29')]=_0x585235['id'];logger[_0x92d2('0xd')](_0x92d2('0x2c'),_0x118ee4[_0x92d2('0x29')]);return _0x83f7ae(_0x118ee4);}createEndUser(_0x118ee4,_0x1b140e,_0x1fafdc,_0x10af91)[_0x92d2('0xf')](function(_0x57eab7){logger['info'](_0x92d2('0x2d'),_0x57eab7[_0x92d2('0x29')]);return _0x83f7ae(_0x57eab7);});});})['catch'](function(_0x25cb76){_0x575ded(_0x25cb76);});});};}function createEndUser(_0xf56f06,_0x287c51,_0x411179,_0x411cc5){return new Promise(function(_0x2264dc,_0x157716){var _0x5d8068=moment();var _0x480250={'method':_0x92d2('0x2e'),'uri':_0x411cc5+_0x92d2('0x2f'),'body':{'contact':{'last_name':_0xf56f06[_0x92d2('0x27')],'work_number':_0xf56f06[_0x92d2('0x27')],'mobile_number':_0xf56f06[_0x92d2('0x27')],'owner_id':_0xf56f06['userId'],'created_at':_0x5d8068[_0x92d2('0x25')](_0x92d2('0x30'))}},'json':!![]};_0x480250[_0x92d2('0xc')]=_0x411179;logger['info'](_0x92d2('0x31'));return rp(_0x480250)[_0x92d2('0xf')](function(_0x3db47e){_0xf56f06[_0x92d2('0x29')]=_0x3db47e[_0x92d2('0x32')]['id'];_0x2264dc(_0xf56f06);})[_0x92d2('0x16')](function(_0x5d55c8){logger['error']('['+[_0x287c51[_0x92d2('0x18')]()]+']',_0x5d55c8[_0x92d2('0x19')]);_0x157716(_0x5d55c8[_0x92d2('0x19')]);});});}function getTicket(_0x1f0861,_0x1a76ec,_0x21f040,_0xf22d98,_0x4d6fee){return function(_0x30f4dc){logger[_0x92d2('0xd')](_0x92d2('0x33'));return new Promise(function(_0xbf415e,_0x57ec94){var _0x2972e9=moment();var _0x329c46={'method':'POST','uri':_0x21f040+_0x92d2('0x34'),'body':{'title':intUtil[_0x92d2('0x35')](_0xf22d98[_0x92d2('0x36')],_0x4d6fee,'\x20'),'description':intUtil[_0x92d2('0x35')](_0xf22d98[_0x92d2('0x37')],_0x4d6fee,'\x0a'),'owner_id':_0x30f4dc[_0x92d2('0x1f')],'creater_id':_0x30f4dc[_0x92d2('0x13')],'targetable_id':_0x30f4dc[_0x92d2('0x29')],'targetable_type':_0x92d2('0x38'),'created_at':_0x2972e9[_0x92d2('0x25')](_0x92d2('0x30')),'due_date':_0x2972e9[_0x92d2('0x39')](0x1e,'m')[_0x92d2('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x329c46['headers']=_0x1a76ec;return rp(_0x329c46)[_0x92d2('0xf')](function(_0x12d502){_0x30f4dc[_0x92d2('0x3a')]=_0x12d502['task']['id'];logger['info']('Task\x20created:',_0x30f4dc[_0x92d2('0x3a')]);_0xbf415e(_0x30f4dc);})[_0x92d2('0x16')](function(_0x56b69e){logger['error']('['+[_0x1f0861[_0x92d2('0x18')]()]+']',_0x56b69e[_0x92d2('0x19')]);_0x57ec94(_0x56b69e[_0x92d2('0x19')]);});});};}function emit(_0xc20dc7,_0x39c13c,_0x517186){var _0x5d20b3={'uri':_0xc20dc7+'/contacts/'+_0x517186};io['to'](util['format'](_0x92d2('0x3b'),_0x39c13c))[_0x92d2('0x3c')]('trigger:browser:url',_0x5d20b3);}exports['cs']=function(_0x5b94c6,_0x50ca9b,_0x4a3a1,_0x571b2f,_0x29021e,_0x30040c,_0x3ad986,_0x53cbde){var _0x5727ad={};var _0x6a0c67={'Authorization':'Token\x20token='+_0x30040c['apiKey']};_0x30040c[_0x92d2('0x3d')]=intUtil[_0x92d2('0x3e')](_0x30040c[_0x92d2('0x3d')]);_0x30040c[_0x92d2('0x3f')]=intUtil[_0x92d2('0x3e')](_0x30040c[_0x92d2('0x3f')]);var _0x27d6c4=_0x30040c['remoteUri'];_0x5727ad[_0x92d2('0x12')]=_0x30040c[_0x92d2('0x40')];_0x5727ad[_0x92d2('0x27')]=_0x53cbde[_0x92d2('0x41')]()==='outbound'?_0x50ca9b[_0x92d2('0x42')]:_0x50ca9b[_0x92d2('0x43')];_0x5727ad[_0x92d2('0x44')]=_0x53cbde===_0x92d2('0x45')||_0x53cbde===_0x92d2('0x46')?_0x92d2('0x45'):'outbound';if(_0x571b2f){_0x5727ad[_0x92d2('0x1b')]=_0x571b2f[_0x92d2('0x11')];}var _0x2c1d25=util[_0x92d2('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x30040c['serverUrl'],_0x50ca9b[_0x92d2('0x47')],md5(_0x50ca9b[_0x92d2('0x47')]));if(_0x29021e&&_0x29021e['monitor_format']){logger[_0x92d2('0xd')](_0x92d2('0x48'),'Recording\x20is\x20enabled!');_0x50ca9b[_0x92d2('0x49')]=_0x2c1d25;}else if(_0x3ad986&&_0x3ad986[_0x92d2('0x4a')]&&_0x3ad986['recordingFormat']!==_0x92d2('0x4b')){logger['info'](_0x92d2('0x4c'),_0x92d2('0x4d'));_0x50ca9b[_0x92d2('0x49')]=_0x2c1d25;}else{_0x50ca9b[_0x92d2('0x49')]='';}return getAdminId(_0x5727ad,_0x53cbde,_0x6a0c67,_0x27d6c4)[_0x92d2('0xf')](getUser(_0x53cbde,_0x6a0c67,_0x27d6c4))[_0x92d2('0xf')](getEndUser(_0x53cbde,_0x6a0c67,_0x27d6c4))['then'](getTicket(_0x53cbde,_0x6a0c67,_0x27d6c4,_0x4a3a1,_0x50ca9b))[_0x92d2('0xf')](function(_0x5eb95a){logger[_0x92d2('0xd')](util[_0x92d2('0x25')](_0x92d2('0x4e'),_0x5eb95a[_0x92d2('0x3a')]));if(_0x53cbde!==_0x92d2('0x46')){logger['info']('['+[_0x53cbde[_0x92d2('0x18')]()]+']',_0x92d2('0x4f'));emit(_0x27d6c4,_0x571b2f['name'],_0x5eb95a[_0x92d2('0x29')]);}})[_0x92d2('0x16')](function(_0x4fd1cf){logger[_0x92d2('0x17')]('['+[_0x53cbde[_0x92d2('0x18')]()]+_0x92d2('0x50'),util['inspect'](_0x4fd1cf,{'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 1a53170..d53aac5 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 _0x7ac9=['%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','includes','data1','toLowerCase','find','data3','routeId','outbound','log','unmanaged','zendesk','freshsales','unknown\x20integration','../../../../config/logger','error','[EXEC]','format'];(function(_0xb8473a,_0x16c1cc){var _0x2e5c33=function(_0x4e9d90){while(--_0x4e9d90){_0xb8473a['push'](_0xb8473a['shift']());}};_0x2e5c33(++_0x16c1cc);}(_0x7ac9,0x10b));var _0x97ac=function(_0x3cb969,_0x443017){_0x3cb969=_0x3cb969-0x0;var _0x55631f=_0x7ac9[_0x3cb969];return _0x55631f;};'use strict';var _=require(_0x97ac('0x0'));var util=require(_0x97ac('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x97ac('0x2'));var sugarcrm=require(_0x97ac('0x3'));var freshdesk=require(_0x97ac('0x4'));var zoho=require(_0x97ac('0x5'));var desk=require(_0x97ac('0x6'));var vtiger=require(_0x97ac('0x7'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=['zendesk',_0x97ac('0x8'),'sugarcrm',_0x97ac('0x9'),_0x97ac('0xa'),_0x97ac('0xb'),_0x97ac('0xc'),_0x97ac('0xd'),'freshsales','servicenow'];exports['exec']=function(_0xaf4593,_0x3494b2,_0x108706,_0x3f18d2,_0x36e962,_0x57fa8f){if(_0x108706){if(_[_0x97ac('0xe')](integrations,_0xaf4593[_0x97ac('0xf')]['toLowerCase']())){try{var _0x3b572e=null;var _0x1cbb45='';var _0x5effcc=_0x108706[_0xaf4593[_0x97ac('0xf')][_0x97ac('0x10')]()];if(_0x5effcc){var _0x98bc34=_0x5effcc[_0xaf4593['data2']];if(_0x98bc34){var _0x102d3f=_[_0x97ac('0x11')](_0x98bc34['Configurations'],{'id':parseInt(_0xaf4593[_0x97ac('0x12')],0xa)});if(_0x102d3f){if(_0x3f18d2){if(_0x36e962&&_0x3494b2['queue']){_0x1cbb45='queue';}else if(_0x3494b2[_0x97ac('0x13')]){_0x1cbb45=_0x97ac('0x14');}else{console[_0x97ac('0x15')]('EVENT\x20UNKNOWN',_0x3494b2);}}else{_0x1cbb45=_0x97ac('0x16');}switch(_0xaf4593['data1'][_0x97ac('0x10')]()){case _0x97ac('0x17'):zendesk[_0x1cbb45](_0xaf4593,_0x3494b2,_0x102d3f,_0x3f18d2,_0x36e962,_0x98bc34,_0x57fa8f);break;case'salesforce':salesforce[_0x1cbb45](_0xaf4593,_0x3494b2,_0x102d3f,_0x3f18d2,_0x36e962,_0x98bc34,_0x57fa8f);break;case'sugarcrm':sugarcrm[_0x1cbb45](_0xaf4593,_0x3494b2,_0x102d3f,_0x3f18d2,_0x36e962,_0x98bc34,_0x57fa8f);break;case _0x97ac('0x9'):freshdesk[_0x1cbb45](_0xaf4593,_0x3494b2,_0x102d3f,_0x3f18d2,_0x36e962,_0x98bc34,_0x57fa8f);break;case _0x97ac('0xa'):zoho[_0x1cbb45](_0xaf4593,_0x3494b2,_0x102d3f,_0x3f18d2,_0x36e962,_0x98bc34,_0x57fa8f);break;case _0x97ac('0xb'):desk[_0x1cbb45](_0xaf4593,_0x3494b2,_0x102d3f,_0x3f18d2,_0x36e962,_0x98bc34,_0x57fa8f);break;case _0x97ac('0xc'):vtiger[_0x1cbb45](_0xaf4593,_0x3494b2,_0x102d3f,_0x3f18d2,_0x36e962,_0x98bc34,_0x57fa8f);break;case _0x97ac('0x18'):freshsales['cs'](_0xaf4593,_0x3494b2,_0x102d3f,_0x3f18d2,_0x36e962,_0x98bc34,_0x57fa8f,_0x1cbb45);break;case'servicenow':servicenow['cs'](_0xaf4593,_0x3494b2,_0x102d3f,_0x3f18d2,_0x36e962,_0x98bc34,_0x57fa8f,_0x1cbb45);break;case _0x97ac('0xd'):dynamics365['cs'](_0xaf4593,_0x3494b2,_0x102d3f,_0x3f18d2,_0x36e962,_0x98bc34,_0x57fa8f,_0x1cbb45);break;default:console[_0x97ac('0x15')](_0x97ac('0x19'));}}else{_0x3b572e=require(_0x97ac('0x1a'))(_0xaf4593[_0x97ac('0xf')][_0x97ac('0x10')]());_0x3b572e[_0x97ac('0x1b')](_0x97ac('0x1c'),util[_0x97ac('0x1d')](_0x97ac('0x1e'),_0xaf4593['data1']['toLowerCase'](),_0xaf4593[_0x97ac('0x12')]));}}else{_0x3b572e=require(_0x97ac('0x1a'))(_0xaf4593[_0x97ac('0xf')][_0x97ac('0x10')]());_0x3b572e[_0x97ac('0x1b')](_0x97ac('0x1c'),util[_0x97ac('0x1d')](_0x97ac('0x1f'),_0xaf4593['data1'][_0x97ac('0x10')](),_0xaf4593[_0x97ac('0x20')]));}}else{}}catch(_0x478796){console['error'](_0x478796);}}}}; \ No newline at end of file +var _0xecab=['vtiger','dynamics365','servicenow','exec','includes','toLowerCase','data2','find','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','data1','zendesk','freshsales','log','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','../../../../config/logger','lodash','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk'];(function(_0x657e67,_0x518f58){var _0x29e86d=function(_0x3afc81){while(--_0x3afc81){_0x657e67['push'](_0x657e67['shift']());}};_0x29e86d(++_0x518f58);}(_0xecab,0x114));var _0xbeca=function(_0x4bc0fc,_0x57c1b2){_0x4bc0fc=_0x4bc0fc-0x0;var _0x19b0c7=_0xecab[_0x4bc0fc];return _0x19b0c7;};'use strict';var _=require(_0xbeca('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0xbeca('0x1'));var freshdesk=require(_0xbeca('0x2'));var zoho=require('./zoho');var desk=require(_0xbeca('0x3'));var vtiger=require(_0xbeca('0x4'));var servicenow=require(_0xbeca('0x5'));var dynamics365=require('./dynamics365');var freshsales=require(_0xbeca('0x6'));var integrations=['zendesk',_0xbeca('0x7'),_0xbeca('0x8'),_0xbeca('0x9'),_0xbeca('0xa'),_0xbeca('0xb'),_0xbeca('0xc'),_0xbeca('0xd'),'freshsales',_0xbeca('0xe')];exports[_0xbeca('0xf')]=function(_0x75ca7e,_0x477395,_0x456de7,_0x4abe0d,_0xdf7a6c,_0x37f96b){if(_0x456de7){if(_[_0xbeca('0x10')](integrations,_0x75ca7e['data1'][_0xbeca('0x11')]())){try{var _0x1b1d6f=null;var _0x1f861a='';var _0x7fee3f=_0x456de7[_0x75ca7e['data1']['toLowerCase']()];if(_0x7fee3f){var _0x395ff5=_0x7fee3f[_0x75ca7e[_0xbeca('0x12')]];if(_0x395ff5){var _0x170ac9=_[_0xbeca('0x13')](_0x395ff5['Configurations'],{'id':parseInt(_0x75ca7e['data3'],0xa)});if(_0x170ac9){if(_0x4abe0d){if(_0xdf7a6c&&_0x477395[_0xbeca('0x14')]){_0x1f861a=_0xbeca('0x14');}else if(_0x477395[_0xbeca('0x15')]){_0x1f861a=_0xbeca('0x16');}else{console['log'](_0xbeca('0x17'),_0x477395);}}else{_0x1f861a=_0xbeca('0x18');}switch(_0x75ca7e[_0xbeca('0x19')][_0xbeca('0x11')]()){case _0xbeca('0x1a'):zendesk[_0x1f861a](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b);break;case _0xbeca('0x7'):salesforce[_0x1f861a](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b);break;case _0xbeca('0x8'):sugarcrm[_0x1f861a](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b);break;case _0xbeca('0x9'):freshdesk[_0x1f861a](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b);break;case _0xbeca('0xa'):zoho[_0x1f861a](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b);break;case _0xbeca('0xb'):desk[_0x1f861a](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b);break;case _0xbeca('0xc'):vtiger[_0x1f861a](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b);break;case _0xbeca('0x1b'):freshsales['cs'](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b,_0x1f861a);break;case _0xbeca('0xe'):servicenow['cs'](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b,_0x1f861a);break;case _0xbeca('0xd'):dynamics365['cs'](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b,_0x1f861a);break;default:console[_0xbeca('0x1c')](_0xbeca('0x1d'));}}else{_0x1b1d6f=require('../../../../config/logger')(_0x75ca7e[_0xbeca('0x19')][_0xbeca('0x11')]());_0x1b1d6f[_0xbeca('0x1e')](_0xbeca('0x1f'),util[_0xbeca('0x20')](_0xbeca('0x21'),_0x75ca7e[_0xbeca('0x19')][_0xbeca('0x11')](),_0x75ca7e[_0xbeca('0x22')]));}}else{_0x1b1d6f=require(_0xbeca('0x23'))(_0x75ca7e[_0xbeca('0x19')][_0xbeca('0x11')]());_0x1b1d6f[_0xbeca('0x1e')](_0xbeca('0x1f'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x75ca7e[_0xbeca('0x19')][_0xbeca('0x11')](),_0x75ca7e[_0xbeca('0x12')]));}}else{}}catch(_0x553bdf){console[_0xbeca('0x1e')](_0x553bdf);}}}}; \ 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 d18b465..841be68 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 _0x3320=['Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','merge','$or','Contact','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','additionalSearchContact','Lead','first','Phone','attributes','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','LastName','','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.','lodash','request-promise','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','Case','contact','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','execute','then','length','find','Email','Agent\x20%s\x20found.','resolve','Name'];(function(_0x22747a,_0xd39909){var _0xdf79eb=function(_0x2786b3){while(--_0x2786b3){_0x22747a['push'](_0x22747a['shift']());}};_0xdf79eb(++_0xd39909);}(_0x3320,0x164));var _0x0332=function(_0x2cf7d0,_0xc6a1a6){_0x2cf7d0=_0x2cf7d0-0x0;var _0x54597e=_0x3320[_0x2cf7d0];return _0x54597e;};'use strict';var _=require(_0x0332('0x0'));var rp=require(_0x0332('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0x0332('0x2'));var util=require('util');var Redis=require(_0x0332('0x3'));var intUtil=require(_0x0332('0x4'));var config=require(_0x0332('0x5'));var logger=require(_0x0332('0x6'))('salesforce');config[_0x0332('0x7')]=_[_0x0332('0x8')](config[_0x0332('0x7')],{'host':_0x0332('0x9'),'port':0x18eb});var io=require(_0x0332('0xa'))(new Redis(config[_0x0332('0x7')]));function emit(_0x2e33cf,_0x1bf676,_0x5aeb0d){io['to'](_0x2e33cf)[_0x0332('0xb')](_0x1bf676,_0x5aeb0d);}function getTicket(_0x49515d,_0x4ae4b5,_0x4e389a,_0x3d66f3,_0x5d2987,_0x52f5b1,_0x401258,_0x4d610d){var _0xa29fa0=Object[_0x0332('0xc')]({},{'OwnerId':_0x4ae4b5['id'],'Subject':intUtil[_0x0332('0xd')](_0x3d66f3[_0x0332('0xe')],_0x5d2987,'\x20'),'Description':intUtil[_0x0332('0xd')](_0x3d66f3[_0x0332('0xf')],_0x5d2987,'\x0a')},getCustomFields(_0x52f5b1,_0x5d2987));if(_0x4e389a){if(_0x3d66f3[_0x0332('0x10')]===_0x0332('0x11')){_0xa29fa0[_0x0332('0x12')]=moment[_0x0332('0x13')]();_0xa29fa0[_0x0332('0x14')]=![];_0xa29fa0[_0x0332('0x15')]=![];if(_0x4e389a[_0x0332('0x16')]==='contact'||_0x4e389a[_0x0332('0x16')]===_0x0332('0x17')){_0xa29fa0[_0x0332('0x18')]=_0x4e389a['id'];}else if(_0x4e389a[_0x0332('0x16')]===_0x0332('0x19')){_0xa29fa0[_0x0332('0x1a')]=_0x4e389a['id'];}}else if(_0x3d66f3['ticketType']===_0x0332('0x1b')){if(_0x4e389a['endUserType']===_0x0332('0x1c')){_0xa29fa0[_0x0332('0x1d')]=_0x4e389a['id'];}else if(_0x4e389a[_0x0332('0x16')]===_0x0332('0x19')){_0xa29fa0[_0x0332('0x1e')]=_0x4e389a['id'];}else if(_0x4e389a['endUserType']===_0x0332('0x17')&&_0x3d66f3[_0x0332('0x1f')]){_0xa29fa0[_0x3d66f3[_0x0332('0x1f')]]=_0x4e389a['id'];}else{logger[_0x0332('0x20')](_0x0332('0x21'));}}}return _0x401258[_0x0332('0x22')](_0x3d66f3[_0x0332('0x10')])[_0x0332('0x23')](_0xa29fa0);}function getUser(_0x374e02,_0x43c6c0,_0x4ab2ba){if(!_[_0x0332('0x24')](_0x43c6c0)&&intUtil['validateEmail'](_0x43c6c0)){var _0x5c211d={'Email':_0x43c6c0};var _0x48de64={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4ab2ba[_0x0332('0x22')](_0x0332('0x25'))['find'](_0x5c211d,_0x48de64)[_0x0332('0x26')]()[_0x0332('0x27')](function(_0x2477e9){if(_0x2477e9[_0x0332('0x28')]){var _0x18d68c=_[_0x0332('0x29')](_0x2477e9,function(_0x34edc9){return _0x34edc9[_0x0332('0x2a')]===_0x43c6c0;});if(_0x18d68c){logger[_0x0332('0x20')](_0x0332('0x2b'),_0x43c6c0);return BPromise[_0x0332('0x2c')]({'id':_0x18d68c['Id'],'name':_0x18d68c[_0x0332('0x2d')]});}}else{logger[_0x0332('0x20')](_0x0332('0x2e'),_0x43c6c0);return _0x4ab2ba[_0x0332('0x2f')]()[_0x0332('0x27')](function(_0x1cdb85){return BPromise[_0x0332('0x2c')]({'id':_0x1cdb85[_0x0332('0x30')],'name':_0x1cdb85[_0x0332('0x31')]});});}});}else{logger[_0x0332('0x20')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x43c6c0);return _0x4ab2ba['identity']()['then'](function(_0x37b488){return BPromise['resolve']({'id':_0x37b488[_0x0332('0x30')],'name':_0x37b488[_0x0332('0x31')]});});}}function getEndUser(_0x563e23,_0x490264,_0x2a6207,_0x21fdb5,_0x1fa8c8){var _0x1bb343={'$or':{'Phone':_0x21fdb5}};var _0x5219a2={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x0332('0x2c')]()[_0x0332('0x27')](function(){logger[_0x0332('0x20')](_0x0332('0x32'),_0x21fdb5,_0x490264[_0x0332('0x33')]);switch(_0x490264[_0x0332('0x33')]){case _0x0332('0x34'):var _0x46842f=_[_0x0332('0x35')](_0x1bb343);if(_0x490264['additionalSearchContact']){var _0x41986e={};_0x41986e[_0x490264['additionalSearchContact']]=_0x21fdb5;_[_0x0332('0x36')](_0x46842f[_0x0332('0x37')],_0x41986e);}return _0x1fa8c8[_0x0332('0x22')](_0x0332('0x38'))['find'](_0x46842f,_0x5219a2)[_0x0332('0x26')]()[_0x0332('0x27')](function(_0x33ba71){if(_0x33ba71&&_0x33ba71['length']){return _0x33ba71;}else{var _0x156c11=_[_0x0332('0x35')](_0x1bb343);if(_0x490264[_0x0332('0x39')]){var _0x3af886={};_0x3af886[_0x490264['additionalSearchLead']]=_0x21fdb5;_['merge'](_0x156c11[_0x0332('0x37')],_0x3af886);}return _0x1fa8c8[_0x0332('0x22')]('Lead')[_0x0332('0x29')](_0x156c11,_0x5219a2);}});case _0x0332('0x3a'):var _0x392050=_[_0x0332('0x35')](_0x1bb343);if(_0x490264['additionalSearchAccount']){var _0x41986e={};_0x41986e[_0x490264[_0x0332('0x3b')]]=_0x21fdb5;_[_0x0332('0x36')](_0x392050[_0x0332('0x37')],_0x41986e);}return _0x1fa8c8[_0x0332('0x22')](_0x0332('0x3c'))[_0x0332('0x29')](_0x392050,_0x5219a2)[_0x0332('0x26')]()['then'](function(_0x23d34a){if(_0x23d34a&&_0x23d34a['length']){return _0x23d34a;}else{var _0x23a656=_[_0x0332('0x35')](_0x1bb343);if(_0x490264[_0x0332('0x3d')]){var _0xcf8e3d={};_0xcf8e3d[_0x490264[_0x0332('0x3d')]]=_0x21fdb5;_[_0x0332('0x36')](_0x23a656['$or'],_0xcf8e3d);}return _0x1fa8c8['sobject'](_0x0332('0x38'))[_0x0332('0x29')](_0x23a656,_0x5219a2)[_0x0332('0x27')](function(_0x17f4b5){if(_0x17f4b5&&_0x17f4b5['length']){return _0x17f4b5;}else{var _0x2c7e5c=_['cloneDeep'](_0x1bb343);if(_0x490264['additionalSearchLead']){var _0x37aa33={};_0x37aa33[_0x490264['additionalSearchLead']]=_0x21fdb5;_[_0x0332('0x36')](_0x2c7e5c[_0x0332('0x37')],_0x37aa33);}return _0x1fa8c8[_0x0332('0x22')](_0x0332('0x3e'))['find'](_0x2c7e5c,_0x5219a2);}});}});case _0x0332('0x1c'):var _0x46842f=_[_0x0332('0x35')](_0x1bb343);if(_0x490264['additionalSearchContact']){var _0x41986e={};_0x41986e[_0x490264['additionalSearchContact']]=_0x21fdb5;_['merge'](_0x46842f[_0x0332('0x37')],_0x41986e);}return _0x1fa8c8['sobject']('Contact')[_0x0332('0x29')](_0x46842f,_0x5219a2)[_0x0332('0x26')]();case _0x0332('0x17'):var _0x508fab=_['cloneDeep'](_0x1bb343);if(_0x490264[_0x0332('0x39')]){var _0x41986e={};_0x41986e[_0x490264[_0x0332('0x39')]]=_0x21fdb5;_['merge'](_0x508fab[_0x0332('0x37')],_0x41986e);}return _0x1fa8c8[_0x0332('0x22')](_0x0332('0x3e'))[_0x0332('0x29')](_0x508fab,_0x5219a2);case'account':var _0x392050=_[_0x0332('0x35')](_0x1bb343);if(_0x490264[_0x0332('0x3b')]){var _0x41986e={};_0x41986e[_0x490264[_0x0332('0x3b')]]=_0x21fdb5;_[_0x0332('0x36')](_0x392050[_0x0332('0x37')],_0x41986e);}return _0x1fa8c8['sobject'](_0x0332('0x3c'))[_0x0332('0x29')](_0x392050,_0x5219a2);default:return null;}})[_0x0332('0x27')](function(_0x246b6a){if(_0x246b6a&&_0x246b6a['length']){var _0x19107e=_[_0x0332('0x3f')](_0x246b6a);if(_0x19107e){return BPromise[_0x0332('0x2c')]({'id':_0x19107e['Id'],'name':_0x19107e['Name'],'phone':_0x19107e[_0x0332('0x40')],'endUserType':_0x19107e[_0x0332('0x41')][_0x0332('0x42')][_0x0332('0x43')]()});}}})[_0x0332('0x27')](function(_0x5e1d47){if(_0x5e1d47){logger['info'](_0x0332('0x44'),_0x5e1d47[_0x0332('0x16')],_0x21fdb5);return BPromise[_0x0332('0x2c')](_0x5e1d47);}else{logger[_0x0332('0x20')](_0x0332('0x45'),_0x21fdb5);var _0x17736e={'Phone':_0x21fdb5};if(_0x490264[_0x0332('0x46')]){if(_0x490264[_0x0332('0x46')]==='contact'){logger['info'](_0x0332('0x47'),_0x21fdb5,_0x490264['moduleCreate']);_0x17736e['LastName']=_0x2a6207!==''?_0x2a6207:util[_0x0332('0x48')]('Caller\x20-\x20%s',_0x21fdb5);}else if(_0x490264[_0x0332('0x46')]===_0x0332('0x17')){logger[_0x0332('0x20')](_0x0332('0x47'),_0x21fdb5,_0x490264['moduleCreate']);_0x17736e[_0x0332('0x49')]=_0x2a6207!==_0x0332('0x4a')?_0x2a6207:util['format'](_0x0332('0x4b'),_0x21fdb5);_0x17736e[_0x0332('0x4c')]=_0x0332('0x4d');}else if(_0x490264['moduleCreate']==='account'){logger['info'](_0x0332('0x47'),_0x21fdb5,_0x490264[_0x0332('0x46')]);_0x17736e[_0x0332('0x2d')]=_0x2a6207!==_0x0332('0x4a')?_0x2a6207:util[_0x0332('0x48')](_0x0332('0x4b'),_0x21fdb5);}else{return null;}}return _0x1fa8c8[_0x0332('0x22')](_[_0x0332('0x4e')](_0x490264[_0x0332('0x46')]))[_0x0332('0x23')](_0x17736e)[_0x0332('0x27')](function(_0x5892ee){return BPromise[_0x0332('0x2c')]({'id':_0x5892ee['id'],'endUserType':_0x490264[_0x0332('0x46')]});});}});}function getCustomFields(_0x4bfc4d,_0x39ed6d){var _0x2a49d6={};if(_0x4bfc4d['length']>0x0){_[_0x0332('0x4f')](_0x4bfc4d,function(_0x54d776){if(_[_0x0332('0x50')]([_0x0332('0x51'),_0x0332('0x52')],_0x54d776['type'])&&_0x54d776['idField']){_0x2a49d6[_0x54d776[_0x0332('0x53')]]=_0x54d776[_0x0332('0x54')][_0x0332('0x55')]();}else if(_0x54d776[_0x0332('0x42')]===_0x0332('0x56')&&_0x54d776['variableName']&&_0x54d776[_0x0332('0x53')]){_0x39ed6d[_0x54d776[_0x0332('0x57')]]&&(_0x2a49d6[_0x54d776['idField']]=_0x39ed6d[_0x54d776['variableName']][_0x0332('0x55')]());}else if(_0x54d776[_0x0332('0x42')]===_0x0332('0x58')&&_0x54d776['Variable']&&_0x54d776[_0x0332('0x59')][_0x0332('0x5a')]&&_0x54d776['idField']){_0x39ed6d[_0x54d776['Variable'][_0x0332('0x5a')][_0x0332('0x43')]()]&&(_0x2a49d6[_0x54d776['idField']]=_0x39ed6d[_0x54d776[_0x0332('0x59')][_0x0332('0x5a')][_0x0332('0x43')]()][_0x0332('0x55')]());}});}return _0x2a49d6;}function getConnection(_0x4c8c60){var _0x213ddd=_0x4c8c60['password'][_0x0332('0x5b')](_0x4c8c60[_0x0332('0x5c')]);var _0x2ed284=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4c8c60[_0x0332('0x5d')]||_0x0332('0x5e'),'clientId':_0x4c8c60['clientId'],'clientSecret':_0x4c8c60[_0x0332('0x5f')]}});return _0x2ed284[_0x0332('0x60')](_0x4c8c60[_0x0332('0x61')],_0x213ddd)[_0x0332('0x27')](function(){logger[_0x0332('0x20')](_0x0332('0x62'));return _0x2ed284;});}exports[_0x0332('0x63')]=function(_0x5afd73,_0x535dcf,_0x8060f4,_0x37275e,_0x4a6aa5,_0x32031a){var _0x644cca,_0x7c272e,_0x574e76,_0xbbb60b;_0x32031a['serverUrl']=intUtil[_0x0332('0x64')](_0x32031a[_0x0332('0x65')]);_0x32031a[_0x0332('0x5d')]=intUtil[_0x0332('0x64')](_0x32031a[_0x0332('0x5d')]);if(_0x4a6aa5&&_0x4a6aa5[_0x0332('0x66')]){logger[_0x0332('0x20')](_0x0332('0x67'),_0x0332('0x68'));_0x535dcf[_0x0332('0x69')]=util[_0x0332('0x48')](_0x0332('0x6a'),_0x32031a['serverUrl'],_0x535dcf[_0x0332('0x6b')],md5(_0x535dcf[_0x0332('0x6b')]));}else{_0x535dcf[_0x0332('0x69')]='';}return getConnection(_0x32031a)[_0x0332('0x27')](function(_0x19cb1a){_0xbbb60b=_0x19cb1a;return getUser(_0x32031a,_0x37275e[_0x0332('0x6c')],_0xbbb60b);})[_0x0332('0x27')](function(_0x4136ac){_0x644cca=_0x4136ac;return getEndUser(_0x32031a,_0x8060f4,_0x535dcf['calleridname'],_0x535dcf['calleridnum'],_0xbbb60b);})[_0x0332('0x27')](function(_0x5a0d15){_0x7c272e=_0x5a0d15;return getTicket(_0x32031a,_0x644cca,_0x7c272e,_0x8060f4,_0x535dcf,_0x8060f4['Fields'],_0xbbb60b,_0x0332('0x63'));})[_0x0332('0x27')](function(_0x31a4c7){_0x574e76=_0x31a4c7;logger['info'](_0x0332('0x6d'),_0x574e76['id']);logger[_0x0332('0x20')](_0x0332('0x6e'),_0x574e76['id'],_0x37275e[_0x0332('0x5a')],_0x32031a['type']);switch(_0x32031a['type']){case'integrationTab':emit(util['format'](_0x0332('0x6f'),_0x37275e[_0x0332('0x5a')]),_0x0332('0x70'),{'recordId':_0x574e76['id']});break;case _0x0332('0x71'):emit(util[_0x0332('0x48')]('user:%s',_0x37275e['name']),_0x0332('0x72'),{'uri':util[_0x0332('0x48')](_0x0332('0x73'),_0xbbb60b[_0x0332('0x74')],_0x574e76['id'])});break;default:logger['error'](_0x0332('0x75'));}})[_0x0332('0x76')](function(_0x1d60a5){logger[_0x0332('0x77')](_0x0332('0x67'),_0x1d60a5);});};exports[_0x0332('0x78')]=function(_0x427be4,_0xb0c0da,_0x1d605e,_0x175c6e,_0x58be80,_0x2bd7c0,_0x4cc17b){var _0x27039a,_0x17fe8b,_0x2b15db,_0x4711c0;_0x2bd7c0[_0x0332('0x65')]=intUtil['stripTrailingSlash'](_0x2bd7c0[_0x0332('0x65')]);_0x2bd7c0[_0x0332('0x5d')]=intUtil['stripTrailingSlash'](_0x2bd7c0[_0x0332('0x5d')]);if(_0x4cc17b&&_0x4cc17b[_0x0332('0x79')]&&_0x4cc17b['recordingFormat']!=='none'){logger[_0x0332('0x20')]('[OUTBOUND]',_0x0332('0x68'));_0xb0c0da[_0x0332('0x69')]=util[_0x0332('0x48')](_0x0332('0x6a'),_0x2bd7c0[_0x0332('0x65')],_0xb0c0da[_0x0332('0x6b')],md5(_0xb0c0da[_0x0332('0x6b')]));}return getConnection(_0x2bd7c0)['then'](function(_0x4ff170){_0x4711c0=_0x4ff170;return getUser(_0x2bd7c0,_0x175c6e['email'],_0x4711c0);})[_0x0332('0x27')](function(_0x595e50){_0x27039a=_0x595e50;return getEndUser(_0x2bd7c0,_0x1d605e,_0xb0c0da[_0x0332('0x7a')],_0xb0c0da[_0x0332('0x7b')],_0x4711c0);})[_0x0332('0x27')](function(_0x4b66a7){_0x17fe8b=_0x4b66a7;return getTicket(_0x2bd7c0,_0x27039a,_0x17fe8b,_0x1d605e,_0xb0c0da,_0x1d605e[_0x0332('0x7c')],_0x4711c0,_0x0332('0x78'));})[_0x0332('0x27')](function(_0x46b20f){_0x2b15db=_0x46b20f;logger[_0x0332('0x20')](_0x0332('0x7d'),_0x2b15db['id']);logger['info'](_0x0332('0x7e'),_0x2b15db['id'],_0x175c6e[_0x0332('0x5a')],_0x2bd7c0[_0x0332('0x42')]);switch(_0x2bd7c0[_0x0332('0x42')]){case'integrationTab':emit(util[_0x0332('0x48')](_0x0332('0x6f'),_0x175c6e[_0x0332('0x5a')]),_0x0332('0x70'),{'recordId':_0x2b15db['id']});break;case _0x0332('0x71'):emit(util[_0x0332('0x48')](_0x0332('0x6f'),_0x175c6e[_0x0332('0x5a')]),'trigger:browser:url',{'uri':util[_0x0332('0x48')](_0x0332('0x73'),_0x4711c0[_0x0332('0x74')],_0x2b15db['id'])});break;default:logger[_0x0332('0x77')](_0x0332('0x7f'),_0x0332('0x80'));}})['catch'](function(_0x50ca0c){logger[_0x0332('0x77')](_0x0332('0x7f'),_0x50ca0c);});};exports[_0x0332('0x81')]=function(_0x55dc2d,_0xf03a04,_0x4794cf,_0x155e9c,_0x3a4328,_0x3cecb7){var _0x577f43,_0x2a377b,_0x5ab1ba,_0x2fb969;_0x3cecb7['serverUrl']=intUtil[_0x0332('0x64')](_0x3cecb7[_0x0332('0x65')]);_0x3cecb7[_0x0332('0x5d')]=intUtil[_0x0332('0x64')](_0x3cecb7[_0x0332('0x5d')]);if(_0x3a4328&&_0x3a4328[_0x0332('0x66')]){logger[_0x0332('0x20')]('['+_0xf03a04[_0x0332('0x82')][_0x0332('0x83')]()+']',_0x0332('0x68'));_0xf03a04[_0x0332('0x69')]=util[_0x0332('0x48')](_0x0332('0x6a'),_0x3cecb7[_0x0332('0x65')],_0xf03a04[_0x0332('0x6b')],md5(_0xf03a04[_0x0332('0x6b')]));}else{_0xf03a04[_0x0332('0x69')]='';}return getConnection(_0x3cecb7)['then'](function(_0x46872f){_0x2fb969=_0x46872f;if(!_[_0x0332('0x24')](_0x155e9c)){return getUser(_0x3cecb7,_0x155e9c['name'],_0x2fb969);}else{return getUser(_0x3cecb7,null,_0x2fb969);}})[_0x0332('0x27')](function(_0x512509){_0x577f43=_0x512509;return getEndUser(_0x3cecb7,_0x4794cf,_0xf03a04[_0x0332('0x84')],_0xf03a04['calleridnum'],_0x2fb969);})[_0x0332('0x27')](function(_0x1c3d75){_0x2a377b=_0x1c3d75;return getTicket(_0x3cecb7,_0x577f43,_0x2a377b,_0x4794cf,_0xf03a04,_0x4794cf['Fields'],_0x2fb969);})[_0x0332('0x27')](function(_0xbfc6a5){_0x5ab1ba=_0xbfc6a5;logger['info']('['+_0xf03a04[_0x0332('0x82')][_0x0332('0x83')]()+_0x0332('0x85'),_0x5ab1ba['id']);logger[_0x0332('0x20')]('['+_0xf03a04[_0x0332('0x82')][_0x0332('0x83')]()+']\x20Integration\x20account\x20type\x20%s.',_0x3cecb7['type']);})[_0x0332('0x76')](function(_0x326d15){logger[_0x0332('0x77')]('['+_0xf03a04['lastevent'][_0x0332('0x83')]()+']',_0x326d15);});}; \ No newline at end of file +var _0x53ef=['newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','destcalleridname','destcalleridnum','Fields','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','endUserType','contact','account','WhatId','Case','ContactId','AccountId','lead','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','length','find','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','cloneDeep','additionalSearchContact','$or','execute','additionalSearchLead','merge','Lead','account_contact_lead','Account','Contact','additionalSearchAccount','first','Phone','attributes','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','Caller\x20-\x20%s','','Company','No\x20Company','upperFirst','forEach','includes','string','type','idField','content','toString','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x53ef,0x8f));var _0xf53e=function(_0x3f6b1b,_0x58d3d6){_0x3f6b1b=_0x3f6b1b-0x0;var _0x4a3d2b=_0x53ef[_0x3f6b1b];return _0x4a3d2b;};'use strict';var _=require(_0xf53e('0x0'));var rp=require(_0xf53e('0x1'));var moment=require(_0xf53e('0x2'));var BPromise=require(_0xf53e('0x3'));var md5=require('md5');var jsforce=require(_0xf53e('0x4'));var util=require(_0xf53e('0x5'));var Redis=require(_0xf53e('0x6'));var intUtil=require(_0xf53e('0x7'));var config=require(_0xf53e('0x8'));var logger=require(_0xf53e('0x9'))('salesforce');config[_0xf53e('0xa')]=_['defaults'](config[_0xf53e('0xa')],{'host':_0xf53e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf53e('0xa')]));function emit(_0x223637,_0x1a3d81,_0x1f438a){io['to'](_0x223637)[_0xf53e('0xc')](_0x1a3d81,_0x1f438a);}function getTicket(_0x192448,_0x6d8851,_0x206dd7,_0x4ad8f4,_0x101ac8,_0x4fb00f,_0x2e6fee,_0x642dbd){var _0x514138=Object[_0xf53e('0xd')]({},{'OwnerId':_0x6d8851['id'],'Subject':intUtil[_0xf53e('0xe')](_0x4ad8f4[_0xf53e('0xf')],_0x101ac8,'\x20'),'Description':intUtil['getString'](_0x4ad8f4[_0xf53e('0x10')],_0x101ac8,'\x0a')},getCustomFields(_0x4fb00f,_0x101ac8));if(_0x206dd7){if(_0x4ad8f4[_0xf53e('0x11')]===_0xf53e('0x12')){_0x514138[_0xf53e('0x13')]=moment[_0xf53e('0x14')]();_0x514138[_0xf53e('0x15')]=![];_0x514138['IsRecurrence']=![];if(_0x206dd7[_0xf53e('0x16')]===_0xf53e('0x17')||_0x206dd7[_0xf53e('0x16')]==='lead'){_0x514138['WhoId']=_0x206dd7['id'];}else if(_0x206dd7[_0xf53e('0x16')]===_0xf53e('0x18')){_0x514138[_0xf53e('0x19')]=_0x206dd7['id'];}}else if(_0x4ad8f4[_0xf53e('0x11')]===_0xf53e('0x1a')){if(_0x206dd7['endUserType']===_0xf53e('0x17')){_0x514138[_0xf53e('0x1b')]=_0x206dd7['id'];}else if(_0x206dd7[_0xf53e('0x16')]===_0xf53e('0x18')){_0x514138[_0xf53e('0x1c')]=_0x206dd7['id'];}else if(_0x206dd7['endUserType']===_0xf53e('0x1d')&&_0x4ad8f4['leadId']){_0x514138[_0x4ad8f4['leadId']]=_0x206dd7['id'];}else{logger[_0xf53e('0x1e')](_0xf53e('0x1f'));}}}return _0x2e6fee[_0xf53e('0x20')](_0x4ad8f4[_0xf53e('0x11')])[_0xf53e('0x21')](_0x514138);}function getUser(_0x5b6fc3,_0x14e0cd,_0x4ba348){if(!_[_0xf53e('0x22')](_0x14e0cd)&&intUtil[_0xf53e('0x23')](_0x14e0cd)){var _0x4c6ebb={'Email':_0x14e0cd};var _0x19c847={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4ba348['sobject'](_0xf53e('0x24'))['find'](_0x4c6ebb,_0x19c847)['execute']()['then'](function(_0xa9e366){if(_0xa9e366[_0xf53e('0x25')]){var _0x4d7a7b=_[_0xf53e('0x26')](_0xa9e366,function(_0x27f26a){return _0x27f26a[_0xf53e('0x27')]===_0x14e0cd;});if(_0x4d7a7b){logger['info'](_0xf53e('0x28'),_0x14e0cd);return BPromise['resolve']({'id':_0x4d7a7b['Id'],'name':_0x4d7a7b[_0xf53e('0x29')]});}}else{logger[_0xf53e('0x1e')](_0xf53e('0x2a'),_0x14e0cd);return _0x4ba348[_0xf53e('0x2b')]()[_0xf53e('0x2c')](function(_0x68dbb7){return BPromise[_0xf53e('0x2d')]({'id':_0x68dbb7[_0xf53e('0x2e')],'name':_0x68dbb7[_0xf53e('0x2f')]});});}});}else{logger[_0xf53e('0x1e')](_0xf53e('0x2a'),_0x14e0cd);return _0x4ba348[_0xf53e('0x2b')]()['then'](function(_0x59f6f7){return BPromise[_0xf53e('0x2d')]({'id':_0x59f6f7[_0xf53e('0x2e')],'name':_0x59f6f7[_0xf53e('0x2f')]});});}}function getEndUser(_0x7bdc5d,_0x44f87e,_0x1dba04,_0x20a1af,_0x3874e8){var _0x3efc24={'$or':{'Phone':_0x20a1af}};var _0x207eb9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xf53e('0x2d')]()[_0xf53e('0x2c')](function(){logger[_0xf53e('0x1e')](_0xf53e('0x30'),_0x20a1af,_0x44f87e['moduleSearch']);switch(_0x44f87e['moduleSearch']){case'contact_lead':var _0x3710c8=_[_0xf53e('0x31')](_0x3efc24);if(_0x44f87e[_0xf53e('0x32')]){var _0x4af4c6={};_0x4af4c6[_0x44f87e['additionalSearchContact']]=_0x20a1af;_['merge'](_0x3710c8[_0xf53e('0x33')],_0x4af4c6);}return _0x3874e8['sobject']('Contact')['find'](_0x3710c8,_0x207eb9)[_0xf53e('0x34')]()[_0xf53e('0x2c')](function(_0x2f19a5){if(_0x2f19a5&&_0x2f19a5['length']){return _0x2f19a5;}else{var _0x517365=_[_0xf53e('0x31')](_0x3efc24);if(_0x44f87e[_0xf53e('0x35')]){var _0x3d88da={};_0x3d88da[_0x44f87e['additionalSearchLead']]=_0x20a1af;_[_0xf53e('0x36')](_0x517365[_0xf53e('0x33')],_0x3d88da);}return _0x3874e8[_0xf53e('0x20')](_0xf53e('0x37'))[_0xf53e('0x26')](_0x517365,_0x207eb9);}});case _0xf53e('0x38'):var _0x391339=_[_0xf53e('0x31')](_0x3efc24);if(_0x44f87e['additionalSearchAccount']){var _0x4af4c6={};_0x4af4c6[_0x44f87e['additionalSearchAccount']]=_0x20a1af;_[_0xf53e('0x36')](_0x391339[_0xf53e('0x33')],_0x4af4c6);}return _0x3874e8[_0xf53e('0x20')](_0xf53e('0x39'))[_0xf53e('0x26')](_0x391339,_0x207eb9)['execute']()[_0xf53e('0x2c')](function(_0x18f1bd){if(_0x18f1bd&&_0x18f1bd[_0xf53e('0x25')]){return _0x18f1bd;}else{var _0x39b475=_[_0xf53e('0x31')](_0x3efc24);if(_0x44f87e[_0xf53e('0x32')]){var _0x4eff46={};_0x4eff46[_0x44f87e[_0xf53e('0x32')]]=_0x20a1af;_[_0xf53e('0x36')](_0x39b475[_0xf53e('0x33')],_0x4eff46);}return _0x3874e8[_0xf53e('0x20')]('Contact')['find'](_0x39b475,_0x207eb9)[_0xf53e('0x2c')](function(_0x35f548){if(_0x35f548&&_0x35f548['length']){return _0x35f548;}else{var _0x563c9d=_['cloneDeep'](_0x3efc24);if(_0x44f87e['additionalSearchLead']){var _0x15fcb9={};_0x15fcb9[_0x44f87e[_0xf53e('0x35')]]=_0x20a1af;_[_0xf53e('0x36')](_0x563c9d[_0xf53e('0x33')],_0x15fcb9);}return _0x3874e8['sobject'](_0xf53e('0x37'))[_0xf53e('0x26')](_0x563c9d,_0x207eb9);}});}});case _0xf53e('0x17'):var _0x3710c8=_['cloneDeep'](_0x3efc24);if(_0x44f87e[_0xf53e('0x32')]){var _0x4af4c6={};_0x4af4c6[_0x44f87e[_0xf53e('0x32')]]=_0x20a1af;_[_0xf53e('0x36')](_0x3710c8['$or'],_0x4af4c6);}return _0x3874e8[_0xf53e('0x20')](_0xf53e('0x3a'))['find'](_0x3710c8,_0x207eb9)[_0xf53e('0x34')]();case'lead':var _0x38392f=_[_0xf53e('0x31')](_0x3efc24);if(_0x44f87e[_0xf53e('0x35')]){var _0x4af4c6={};_0x4af4c6[_0x44f87e['additionalSearchLead']]=_0x20a1af;_[_0xf53e('0x36')](_0x38392f['$or'],_0x4af4c6);}return _0x3874e8[_0xf53e('0x20')](_0xf53e('0x37'))['find'](_0x38392f,_0x207eb9);case _0xf53e('0x18'):var _0x391339=_[_0xf53e('0x31')](_0x3efc24);if(_0x44f87e[_0xf53e('0x3b')]){var _0x4af4c6={};_0x4af4c6[_0x44f87e[_0xf53e('0x3b')]]=_0x20a1af;_[_0xf53e('0x36')](_0x391339['$or'],_0x4af4c6);}return _0x3874e8[_0xf53e('0x20')]('Account')[_0xf53e('0x26')](_0x391339,_0x207eb9);default:return null;}})[_0xf53e('0x2c')](function(_0x45074f){if(_0x45074f&&_0x45074f[_0xf53e('0x25')]){var _0x3ae521=_[_0xf53e('0x3c')](_0x45074f);if(_0x3ae521){return BPromise[_0xf53e('0x2d')]({'id':_0x3ae521['Id'],'name':_0x3ae521['Name'],'phone':_0x3ae521[_0xf53e('0x3d')],'endUserType':_0x3ae521[_0xf53e('0x3e')]['type'][_0xf53e('0x3f')]()});}}})['then'](function(_0x13cee6){if(_0x13cee6){logger[_0xf53e('0x1e')](_0xf53e('0x40'),_0x13cee6[_0xf53e('0x16')],_0x20a1af);return BPromise[_0xf53e('0x2d')](_0x13cee6);}else{logger[_0xf53e('0x1e')](_0xf53e('0x41'),_0x20a1af);var _0x332c54={'Phone':_0x20a1af};if(_0x44f87e['moduleCreate']){if(_0x44f87e[_0xf53e('0x42')]===_0xf53e('0x17')){logger[_0xf53e('0x1e')](_0xf53e('0x43'),_0x20a1af,_0x44f87e[_0xf53e('0x42')]);_0x332c54['LastName']=_0x1dba04!==''?_0x1dba04:util[_0xf53e('0x44')](_0xf53e('0x45'),_0x20a1af);}else if(_0x44f87e[_0xf53e('0x42')]===_0xf53e('0x1d')){logger[_0xf53e('0x1e')](_0xf53e('0x43'),_0x20a1af,_0x44f87e[_0xf53e('0x42')]);_0x332c54['LastName']=_0x1dba04!==_0xf53e('0x46')?_0x1dba04:util[_0xf53e('0x44')]('Caller\x20-\x20%s',_0x20a1af);_0x332c54[_0xf53e('0x47')]=_0xf53e('0x48');}else if(_0x44f87e[_0xf53e('0x42')]===_0xf53e('0x18')){logger[_0xf53e('0x1e')](_0xf53e('0x43'),_0x20a1af,_0x44f87e[_0xf53e('0x42')]);_0x332c54[_0xf53e('0x29')]=_0x1dba04!==''?_0x1dba04:util['format']('Caller\x20-\x20%s',_0x20a1af);}else{return null;}}return _0x3874e8[_0xf53e('0x20')](_[_0xf53e('0x49')](_0x44f87e[_0xf53e('0x42')]))['create'](_0x332c54)[_0xf53e('0x2c')](function(_0xc0b4a2){return BPromise[_0xf53e('0x2d')]({'id':_0xc0b4a2['id'],'endUserType':_0x44f87e[_0xf53e('0x42')]});});}});}function getCustomFields(_0x4ebe5c,_0xd94b27){var _0x15a84a={};if(_0x4ebe5c['length']>0x0){_[_0xf53e('0x4a')](_0x4ebe5c,function(_0x14dcfd){if(_[_0xf53e('0x4b')]([_0xf53e('0x4c'),'picklist'],_0x14dcfd[_0xf53e('0x4d')])&&_0x14dcfd[_0xf53e('0x4e')]){_0x15a84a[_0x14dcfd['idField']]=_0x14dcfd[_0xf53e('0x4f')][_0xf53e('0x50')]();}else if(_0x14dcfd[_0xf53e('0x4d')]==='variable'&&_0x14dcfd[_0xf53e('0x51')]&&_0x14dcfd[_0xf53e('0x4e')]){_0xd94b27[_0x14dcfd[_0xf53e('0x51')]]&&(_0x15a84a[_0x14dcfd[_0xf53e('0x4e')]]=_0xd94b27[_0x14dcfd[_0xf53e('0x51')]][_0xf53e('0x50')]());}else if(_0x14dcfd[_0xf53e('0x4d')]===_0xf53e('0x52')&&_0x14dcfd[_0xf53e('0x53')]&&_0x14dcfd[_0xf53e('0x53')][_0xf53e('0x54')]&&_0x14dcfd['idField']){_0xd94b27[_0x14dcfd[_0xf53e('0x53')][_0xf53e('0x54')][_0xf53e('0x3f')]()]&&(_0x15a84a[_0x14dcfd['idField']]=_0xd94b27[_0x14dcfd[_0xf53e('0x53')][_0xf53e('0x54')]['toLowerCase']()][_0xf53e('0x50')]());}});}return _0x15a84a;}function getConnection(_0x120c6b){var _0x489059=_0x120c6b[_0xf53e('0x55')][_0xf53e('0x56')](_0x120c6b[_0xf53e('0x57')]);var _0x389e28=new jsforce['Connection']({'oauth2':{'loginUrl':_0x120c6b[_0xf53e('0x58')]||_0xf53e('0x59'),'clientId':_0x120c6b[_0xf53e('0x5a')],'clientSecret':_0x120c6b[_0xf53e('0x5b')]}});return _0x389e28['login'](_0x120c6b[_0xf53e('0x5c')],_0x489059)[_0xf53e('0x2c')](function(){logger[_0xf53e('0x1e')](_0xf53e('0x5d'));return _0x389e28;});}exports[_0xf53e('0x5e')]=function(_0x5676f7,_0x217d2e,_0x40926f,_0x419e63,_0x5da00c,_0x2af26a){var _0x8325af,_0x37f0ba,_0x16d1ba,_0x1e42fe;_0x2af26a[_0xf53e('0x5f')]=intUtil[_0xf53e('0x60')](_0x2af26a[_0xf53e('0x5f')]);_0x2af26a[_0xf53e('0x58')]=intUtil[_0xf53e('0x60')](_0x2af26a[_0xf53e('0x58')]);if(_0x5da00c&&_0x5da00c['monitor_format']){logger[_0xf53e('0x1e')](_0xf53e('0x61'),_0xf53e('0x62'));_0x217d2e[_0xf53e('0x63')]=util['format'](_0xf53e('0x64'),_0x2af26a[_0xf53e('0x5f')],_0x217d2e[_0xf53e('0x65')],md5(_0x217d2e['uniqueid']));}else{_0x217d2e[_0xf53e('0x63')]='';}return getConnection(_0x2af26a)[_0xf53e('0x2c')](function(_0x567532){_0x1e42fe=_0x567532;return getUser(_0x2af26a,_0x419e63[_0xf53e('0x66')],_0x1e42fe);})[_0xf53e('0x2c')](function(_0x3d687e){_0x8325af=_0x3d687e;return getEndUser(_0x2af26a,_0x40926f,_0x217d2e[_0xf53e('0x67')],_0x217d2e[_0xf53e('0x68')],_0x1e42fe);})['then'](function(_0x1f222c){_0x37f0ba=_0x1f222c;return getTicket(_0x2af26a,_0x8325af,_0x37f0ba,_0x40926f,_0x217d2e,_0x40926f['Fields'],_0x1e42fe,_0xf53e('0x5e'));})['then'](function(_0x491b21){_0x16d1ba=_0x491b21;logger[_0xf53e('0x1e')](_0xf53e('0x69'),_0x16d1ba['id']);logger[_0xf53e('0x1e')](_0xf53e('0x6a'),_0x16d1ba['id'],_0x419e63[_0xf53e('0x54')],_0x2af26a[_0xf53e('0x4d')]);switch(_0x2af26a['type']){case _0xf53e('0x6b'):emit(util[_0xf53e('0x44')]('user:%s',_0x419e63['name']),_0xf53e('0x6c'),{'recordId':_0x16d1ba['id']});break;case _0xf53e('0x6d'):emit(util[_0xf53e('0x44')](_0xf53e('0x6e'),_0x419e63[_0xf53e('0x54')]),_0xf53e('0x6f'),{'uri':util[_0xf53e('0x44')](_0xf53e('0x70'),_0x1e42fe[_0xf53e('0x71')],_0x16d1ba['id'])});break;default:logger[_0xf53e('0x72')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xf53e('0x73')](function(_0x20bd3e){logger[_0xf53e('0x72')](_0xf53e('0x61'),_0x20bd3e);});};exports[_0xf53e('0x74')]=function(_0x2ddc28,_0x28b5c3,_0xb4a1b6,_0x229925,_0x14e359,_0xb4e3fe,_0x46c408){var _0x2b8424,_0x48629f,_0x576a43,_0x3f0125;_0xb4e3fe[_0xf53e('0x5f')]=intUtil[_0xf53e('0x60')](_0xb4e3fe[_0xf53e('0x5f')]);_0xb4e3fe[_0xf53e('0x58')]=intUtil[_0xf53e('0x60')](_0xb4e3fe[_0xf53e('0x58')]);if(_0x46c408&&_0x46c408[_0xf53e('0x75')]&&_0x46c408[_0xf53e('0x75')]!=='none'){logger[_0xf53e('0x1e')]('[OUTBOUND]',_0xf53e('0x62'));_0x28b5c3['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xb4e3fe[_0xf53e('0x5f')],_0x28b5c3[_0xf53e('0x65')],md5(_0x28b5c3[_0xf53e('0x65')]));}return getConnection(_0xb4e3fe)['then'](function(_0x2dccf2){_0x3f0125=_0x2dccf2;return getUser(_0xb4e3fe,_0x229925[_0xf53e('0x66')],_0x3f0125);})[_0xf53e('0x2c')](function(_0x2067d6){_0x2b8424=_0x2067d6;return getEndUser(_0xb4e3fe,_0xb4a1b6,_0x28b5c3[_0xf53e('0x76')],_0x28b5c3[_0xf53e('0x77')],_0x3f0125);})[_0xf53e('0x2c')](function(_0x954463){_0x48629f=_0x954463;return getTicket(_0xb4e3fe,_0x2b8424,_0x48629f,_0xb4a1b6,_0x28b5c3,_0xb4a1b6[_0xf53e('0x78')],_0x3f0125,_0xf53e('0x74'));})[_0xf53e('0x2c')](function(_0xba2854){_0x576a43=_0xba2854;logger[_0xf53e('0x1e')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x576a43['id']);logger[_0xf53e('0x1e')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x576a43['id'],_0x229925[_0xf53e('0x54')],_0xb4e3fe[_0xf53e('0x4d')]);switch(_0xb4e3fe[_0xf53e('0x4d')]){case _0xf53e('0x6b'):emit(util[_0xf53e('0x44')](_0xf53e('0x6e'),_0x229925[_0xf53e('0x54')]),'trigger:salesforce:display',{'recordId':_0x576a43['id']});break;case _0xf53e('0x6d'):emit(util[_0xf53e('0x44')](_0xf53e('0x6e'),_0x229925[_0xf53e('0x54')]),'trigger:browser:url',{'uri':util[_0xf53e('0x44')](_0xf53e('0x70'),_0x3f0125[_0xf53e('0x71')],_0x576a43['id'])});break;default:logger['error'](_0xf53e('0x79'),_0xf53e('0x7a'));}})[_0xf53e('0x73')](function(_0x582c43){logger[_0xf53e('0x72')](_0xf53e('0x79'),_0x582c43);});};exports[_0xf53e('0x7b')]=function(_0x199d9e,_0x321a95,_0x26041c,_0x2d1997,_0x31207b,_0x3c6b11){var _0x13fa1a,_0x1cabca,_0x2acff7,_0xd3232f;_0x3c6b11[_0xf53e('0x5f')]=intUtil['stripTrailingSlash'](_0x3c6b11['serverUrl']);_0x3c6b11[_0xf53e('0x58')]=intUtil[_0xf53e('0x60')](_0x3c6b11['remoteUri']);if(_0x31207b&&_0x31207b['monitor_format']){logger[_0xf53e('0x1e')]('['+_0x321a95[_0xf53e('0x7c')][_0xf53e('0x7d')]()+']',_0xf53e('0x62'));_0x321a95[_0xf53e('0x63')]=util[_0xf53e('0x44')](_0xf53e('0x64'),_0x3c6b11[_0xf53e('0x5f')],_0x321a95[_0xf53e('0x65')],md5(_0x321a95[_0xf53e('0x65')]));}else{_0x321a95[_0xf53e('0x63')]='';}return getConnection(_0x3c6b11)[_0xf53e('0x2c')](function(_0xb32c8b){_0xd3232f=_0xb32c8b;if(!_[_0xf53e('0x22')](_0x2d1997)){return getUser(_0x3c6b11,_0x2d1997[_0xf53e('0x54')],_0xd3232f);}else{return getUser(_0x3c6b11,null,_0xd3232f);}})[_0xf53e('0x2c')](function(_0x5aade2){_0x13fa1a=_0x5aade2;return getEndUser(_0x3c6b11,_0x26041c,_0x321a95[_0xf53e('0x67')],_0x321a95['calleridnum'],_0xd3232f);})[_0xf53e('0x2c')](function(_0x8ca0ee){_0x1cabca=_0x8ca0ee;return getTicket(_0x3c6b11,_0x13fa1a,_0x1cabca,_0x26041c,_0x321a95,_0x26041c['Fields'],_0xd3232f);})['then'](function(_0x606501){_0x2acff7=_0x606501;logger[_0xf53e('0x1e')]('['+_0x321a95[_0xf53e('0x7c')][_0xf53e('0x7d')]()+']\x20Ticket\x20%s\x20created.',_0x2acff7['id']);logger[_0xf53e('0x1e')]('['+_0x321a95[_0xf53e('0x7c')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x3c6b11[_0xf53e('0x4d')]);})['catch'](function(_0xad3a8c){logger[_0xf53e('0x72')]('['+_0x321a95['lastevent'][_0xf53e('0x7d')]()+']',_0xad3a8c);});}; \ 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 0b82cf7..a8d6e41 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 _0x8310=['%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','inspect','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','info','toUpperCase','error','message','],\x20getUser\x20input\x20crm','validateEmail','GET','userEmail','],\x20getUser\x20entity','active','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','sys_id','catch','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','toLowerCase','toString','content','type','variable','idField','customVariable','Variable','name','outbound','incident','assign','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0x8310,0xee));var _0x0831=function(_0xa72cf,_0x24a05c){_0xa72cf=_0xa72cf-0x0;var _0x263735=_0x8310[_0xa72cf];return _0x263735;};'use strict';var _=require(_0x0831('0x0'));var Promise=require('bluebird');var rp=require(_0x0831('0x1'));var util=require('util');var md5=require(_0x0831('0x2'));var Redis=require(_0x0831('0x3'));var intUtil=require(_0x0831('0x4'));var config=require(_0x0831('0x5'));var logger=require(_0x0831('0x6'))('servicenow');config['redis']=_['defaults'](config[_0x0831('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x0831('0x8'))(new Redis(config[_0x0831('0x7')]));function getAdminUser(_0x57d3e3,_0xa888d3,_0x21eba6,_0x3276a9,_0x3068d7,_0x180318){return new Promise(function(_0xe06a02,_0x59abd5){var _0x17d200={'method':'GET','uri':_0x3276a9+_0x0831('0x9')+'&'+_0x3068d7+'&'+_0x180318,'auth':_0xa888d3,'json':!![]};return rp(_0x17d200)[_0x0831('0xa')](function(_0xc4b179){if(_0xc4b179['result'][_0x0831('0xb')]>0x0){_0x21eba6[_0x0831('0xc')]=_0xc4b179[_0x0831('0xd')][0x0]['sys_id'];}logger[_0x0831('0xe')]('['+[_0x57d3e3[_0x0831('0xf')]()]+'],\x20getAdminUser\x20crm',_0x21eba6);_0xe06a02(_0x21eba6);})['catch'](function(_0x2c7711){logger[_0x0831('0x10')]('['+[_0x57d3e3[_0x0831('0xf')]()]+']',_0x2c7711[_0x0831('0x11')]);_0x59abd5(_0x2c7711[_0x0831('0x11')]);});});}function getUser(_0x467f1a,_0x4018f8,_0x4976f0,_0x517f91,_0x4d87ae){return function(_0x159c24){logger[_0x0831('0xe')]('['+[_0x467f1a[_0x0831('0xf')]()]+_0x0831('0x12'),_0x159c24);return new Promise(function(_0x345bf5,_0x1a4bbe){if(intUtil[_0x0831('0x13')](_0x159c24['userEmail'])){var _0xd43933={'method':_0x0831('0x14'),'uri':_0x4976f0+'sys_user?sysparm_query=email%3D'+_0x159c24[_0x0831('0x15')]+'&'+_0x517f91+'&'+_0x4d87ae,'auth':_0x4018f8,'json':!![]};logger[_0x0831('0xe')]('['+[_0x467f1a['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0xd43933);return rp(_0xd43933)[_0x0831('0xa')](function(_0x2a559d){logger[_0x0831('0xe')]('['+[_0x467f1a[_0x0831('0xf')]()]+_0x0831('0x16'),_0x2a559d);if(_0x2a559d[_0x0831('0xd')][_0x0831('0xb')]>0x0&&String(_0x2a559d[_0x0831('0xd')][0x0][_0x0831('0x17')])==='true'){_0x159c24['userId']=_0x2a559d[_0x0831('0xd')][0x0]['sys_id'];}else{_0x159c24[_0x0831('0x18')]=_0x159c24[_0x0831('0xc')];_0x159c24['userEmail']=_0x159c24[_0x0831('0x19')];}logger[_0x0831('0xe')]('['+[_0x467f1a[_0x0831('0xf')]()]+_0x0831('0x1a'),_0x159c24);_0x345bf5(_0x159c24);})['catch'](function(_0x2bc771){logger['error']('['+[_0x467f1a['toUpperCase']()]+']',_0x2bc771[_0x0831('0x11')]);_0x1a4bbe(_0x2bc771['message']);});}else{logger[_0x0831('0xe')]('['+[_0x467f1a[_0x0831('0xf')]()]+_0x0831('0x1b'));_0x159c24[_0x0831('0x18')]=_0x159c24[_0x0831('0xc')];_0x159c24[_0x0831('0x15')]=_0x159c24[_0x0831('0x19')];_0x345bf5(_0x159c24);}});};}function createEndUser(_0x1ab439,_0x1bed65,_0x33664c,_0x16de37,_0xf94f3f){logger[_0x0831('0xe')]('['+[_0x1ab439[_0x0831('0xf')]()]+_0x0831('0x1c'),_0x33664c);return new Promise(function(_0x3beaa1,_0x16400c){var _0x474097={'method':_0x0831('0x1d'),'uri':_0x16de37+_0x0831('0x1e')+_0xf94f3f,'body':{'user_name':_0x33664c[_0x0831('0x1f')],'roles':_0x0831('0x20'),'first_name':_0x33664c[_0x0831('0x1f')],'active':_0x0831('0x21'),'date_format':_0x0831('0x22'),'phone':_0x33664c['endUserNumber']},'auth':_0x1bed65,'json':!![]};return rp(_0x474097)[_0x0831('0xa')](function(_0x171adc){logger[_0x0831('0xe')]('['+[_0x1ab439[_0x0831('0xf')]()]+_0x0831('0x23'),_0x171adc[_0x0831('0xd')]);_0x33664c[_0x0831('0x24')]=_0x171adc[_0x0831('0xd')][_0x0831('0x25')];_0x3beaa1(_0x33664c);})[_0x0831('0x26')](function(_0x5178c4){logger[_0x0831('0x10')]('['+[_0x1ab439[_0x0831('0xf')]()]+']',_0x5178c4[_0x0831('0x11')]);_0x16400c(_0x5178c4[_0x0831('0x11')]);});});}function getEndUser(_0x291125,_0x5743b3,_0x5cbe4f,_0x518935,_0xaa47a3){return function(_0x176149){logger[_0x0831('0xe')]('['+[_0x291125['toUpperCase']()]+_0x0831('0x27'),_0x176149);return new Promise(function(_0x1f64d0,_0x1d5fda){var _0x3f0cae={'method':_0x0831('0x14'),'uri':_0x5cbe4f+_0x0831('0x28')+_0x176149[_0x0831('0x1f')]+'&'+_0x518935+'&'+_0xaa47a3,'auth':_0x5743b3,'json':!![]};return rp(_0x3f0cae)[_0x0831('0xa')](function(_0x3b12ad){if(_0x3b12ad[_0x0831('0xd')][_0x0831('0xb')]>0x0){_0x176149[_0x0831('0x24')]=_0x3b12ad[_0x0831('0xd')][0x0][_0x0831('0x25')];logger[_0x0831('0xe')]('['+[_0x291125[_0x0831('0xf')]()]+_0x0831('0x29'),_0x176149);_0x1f64d0(_0x176149);}else{return createEndUser(_0x291125,_0x5743b3,_0x176149,_0x5cbe4f,_0x518935)[_0x0831('0xa')](function(_0x256ed2){logger[_0x0831('0xe')]('['+[_0x291125[_0x0831('0xf')]()]+_0x0831('0x2a'),_0x256ed2);_0x1f64d0(_0x256ed2);});}})[_0x0831('0x26')](function(_0x167267){logger[_0x0831('0x10')]('['+[_0x291125['toUpperCase']()]+']',_0x167267[_0x0831('0x11')]);_0x1d5fda(_0x167267['message']);});});};}function getCustomFields(_0x26507d,_0x166c05){var _0x1af01d={};if(_0x26507d[_0x0831('0xb')]>0x0){_['forEach'](_0x26507d,function(_0x1c679b){if(_[_0x0831('0x2b')]([_0x0831('0x2c'),_0x0831('0x2d')],_0x1c679b['type'])&&_0x1c679b['nameField']&&!_0x1c679b['customField']){_0x1af01d[_0x1c679b['nameField'][_0x0831('0x2e')]()]=_0x1c679b['content'][_0x0831('0x2f')]();}else if(_[_0x0831('0x2b')]([_0x0831('0x2c'),_0x0831('0x2d')],_0x1c679b['type'])&&_0x1c679b['idField']&&_0x1c679b['customField']){_0x1af01d[_0x1c679b['idField'][_0x0831('0x2e')]()]=_0x1c679b[_0x0831('0x30')][_0x0831('0x2f')]();}else if(_0x1c679b[_0x0831('0x31')]===_0x0831('0x32')&&_0x1c679b['variableName']&&_0x1c679b[_0x0831('0x33')]&&_0x1c679b['customField']){_0x1af01d[_0x1c679b[_0x0831('0x33')][_0x0831('0x2e')]()]=_0x166c05[_0x1c679b['variableName']]['toString']();}else if(_0x1c679b['type']===_0x0831('0x34')&&_0x1c679b[_0x0831('0x35')]&&_0x1c679b[_0x0831('0x35')][_0x0831('0x36')]&&_0x1c679b[_0x0831('0x33')]&&_0x1c679b['customField']){_0x1af01d[_0x1c679b[_0x0831('0x33')][_0x0831('0x2e')]()]=_0x166c05[_0x1c679b[_0x0831('0x35')][_0x0831('0x36')][_0x0831('0x2e')]()][_0x0831('0x2f')]();}});}return _0x1af01d;}function getTicket(_0x271406,_0x58b2d1,_0xf2665d,_0x309660,_0x596097,_0x382b6a){return function(_0x3958fb){logger[_0x0831('0xe')]('['+[_0x271406['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0x3958fb);return new Promise(function(_0x3e25e2,_0x3a690d){var _0x34d522=_0x271406['toLowerCase']()===_0x0831('0x37')?_0x3958fb[_0x0831('0x18')]:_0x3958fb['endUserId'];var _0x549ca7={'method':_0x0831('0x1d'),'uri':_0xf2665d+_0x0831('0x38')+'?'+_0x382b6a,'body':Object[_0x0831('0x39')]({},{'active':_0x0831('0x21'),'caller_id':_0x34d522,'assigned_to':_0x3958fb[_0x0831('0x18')],'short_description':intUtil['getString'](_0x309660['Subjects'],_0x596097,'\x20'),'description':intUtil['getString'](_0x309660['Descriptions'],_0x596097,'\x0a')},getCustomFields(_0x309660[_0x0831('0x3a')],_0x596097)),'auth':_0x58b2d1,'json':!![]};return rp(_0x549ca7)['then'](function(_0x4d3c87){logger['info']('['+[_0x271406[_0x0831('0xf')]()]+_0x0831('0x3b'),_0x4d3c87[_0x0831('0xd')]);_0x3958fb[_0x0831('0x3c')]=_0x4d3c87['result'][_0x0831('0x25')];_0x3958fb[_0x0831('0x3d')]=_0x4d3c87['result'][_0x0831('0x3e')];logger['info']('['+[_0x271406[_0x0831('0xf')]()]+_0x0831('0x3f'),_0x3958fb);_0x3e25e2(_0x3958fb);})[_0x0831('0x26')](function(_0x506de){logger['error']('['+[_0x271406[_0x0831('0xf')]()]+']',_0x506de[_0x0831('0x11')]);_0x3a690d(_0x506de[_0x0831('0x11')]);});});};}function createRemoteTag(_0x2bf8c7,_0x3976e1,_0x4dc111,_0x33490e){return new Promise(function(_0x39d3de,_0x3036aa){var _0x50377a={'method':_0x0831('0x1d'),'uri':_0x4dc111+'label'+'?'+_0x33490e,'body':{'short_description':_0x2bf8c7,'global':!![],'active':!![],'name':_0x2bf8c7},'auth':_0x3976e1,'json':!![]};return rp(_0x50377a)['then'](function(_0xeb37f0){var _0xc081ac=_0xeb37f0[_0x0831('0xd')]['sys_id'];_0x39d3de(_0xc081ac);});});}function getRemoteTag(_0x1f6b8c,_0x441b94,_0xa13c5a,_0xfd31fd,_0x2f66e1){return new Promise(function(_0x56df63,_0x2aef40){var _0x305c34={'method':'GET','uri':_0xa13c5a+'label'+_0x0831('0x40')+_0x1f6b8c+'&'+_0xfd31fd,'auth':_0x441b94,'json':!![]};return rp(_0x305c34)[_0x0831('0xa')](function(_0x20496f){if(_0x20496f[_0x0831('0xd')]['length']>0x0){var _0x1f2d7b=_0x20496f[_0x0831('0xd')][0x0][_0x0831('0x25')];_0x56df63(_0x1f2d7b);}else{return createRemoteTag(_0x1f6b8c,_0x441b94,_0xa13c5a,_0xfd31fd)[_0x0831('0xa')](function(_0x50dfcc){_0x56df63(_0x50dfcc);});}});});}function assignTagToIncident(_0x2e2e08,_0x2f4bea,_0x1f07ef,_0x570df0,_0x5977b1){return new Promise(function(_0x5df3a0,_0xb84f16){var _0x7e2b02={'method':_0x0831('0x1d'),'uri':_0x1f07ef+_0x0831('0x41')+'?'+_0x5977b1,'body':{'label':_0x2e2e08,'table':'incident','id_type':_0x0831('0x42'),'table_key':_0x570df0[_0x0831('0x3c')],'title':'Incident\x20-\x20'+_0x570df0[_0x0831('0x3d')],'id_display':_0x570df0['ticketNumber']},'auth':_0x2f4bea,'json':!![]};return rp(_0x7e2b02)[_0x0831('0xa')](function(_0x32dfb6){_0x5df3a0();})[_0x0831('0x26')](function(){_0x5df3a0();});});}function manageTags(_0x54d5d7,_0xdd2a3,_0x19ccd4,_0x1e987e,_0x10d9b2,_0x34dc9e,_0x3fbaa1){return new Promise(function(_0x5843b1,_0x6a988e){var _0x422992=[];_0xdd2a3[_0x0831('0x43')](function(_0x4ada48){_0x422992[_0x0831('0x44')](getRemoteTag(_0x4ada48,_0x19ccd4,_0x1e987e,_0x34dc9e,_0x3fbaa1));});return Promise[_0x0831('0x45')](_0x422992)[_0x0831('0xa')](function(_0x4e9f9f){if(_0x4e9f9f[_0x0831('0xb')]){logger[_0x0831('0xe')]('['+[_0x54d5d7[_0x0831('0xf')]()]+_0x0831('0x46'),_0x4e9f9f);var _0x3fb8b2=[];_0x4e9f9f[_0x0831('0x43')](function(_0x4a0352){_0x3fb8b2[_0x0831('0x44')](assignTagToIncident(_0x4a0352,_0x19ccd4,_0x1e987e,_0x10d9b2,_0x34dc9e));});return Promise[_0x0831('0x45')](_0x3fb8b2)[_0x0831('0xa')](function(){_0x5843b1();})['catch'](function(){_0x5843b1();});}else{_0x5843b1();}});});}function getTags(_0x9f6a50,_0x55b2dc,_0x2abd41,_0x586850,_0x54f96c,_0x2fe9c5){return function(_0x55ae0f){return new Promise(function(_0x5c0e6d,_0x47c0cc){var _0x17964a=[];var _0x13a34c=_0x586850[_0x0831('0x47')];if(_0x13a34c&&_0x13a34c['length']>0x0){_0x17964a=_[_0x0831('0x48')](_0x13a34c,_0x0831('0x36'));}if(_0x17964a[_0x0831('0xb')]>0x0){return manageTags(_0x9f6a50,_0x17964a,_0x55b2dc,_0x2abd41,_0x55ae0f,_0x54f96c,_0x2fe9c5)[_0x0831('0xa')](function(){_0x5c0e6d(_0x55ae0f);});}else{_0x5c0e6d(_0x55ae0f);}});};}function emit(_0x1fc41f,_0x4b7da6,_0x2e4399){var _0x5c506f='%26sysparm_record_target%3Dincident'+_0x0831('0x49')+_0x0831('0x4a')+_0x0831('0x4b');var _0xf242b5={'uri':_0x1fc41f+_0x0831('0x4c')+_0x2e4399+_0x5c506f};io['to'](util[_0x0831('0x4d')](_0x0831('0x4e'),_0x4b7da6))[_0x0831('0x4f')]('trigger:browser:url',_0xf242b5);}exports['cs']=function(_0x519795,_0x204b34,_0x52805b,_0x432601,_0x4cb341,_0x45567f,_0x1c0811,_0x476cc3){var _0x54a21a={};var _0x2f99bc={'user':_0x45567f['username'],'pass':_0x45567f[_0x0831('0x50')]};var _0x403244=_0x0831('0x51');var _0xeec6fd=_0x0831('0x52');_0x45567f['remoteUri']=intUtil[_0x0831('0x53')](_0x45567f[_0x0831('0x54')]);_0x45567f[_0x0831('0x55')]=intUtil[_0x0831('0x53')](_0x45567f[_0x0831('0x55')]);var _0x207a8c=util['format'](_0x0831('0x56'),_0x45567f[_0x0831('0x54')]);_0x54a21a['userEmail']=!_['isNil'](_0x432601)?_0x432601[_0x0831('0x57')]:null;_0x54a21a[_0x0831('0x19')]=_0x45567f[_0x0831('0x57')];_0x54a21a[_0x0831('0x1f')]=_0x476cc3['toLowerCase']()===_0x0831('0x37')?_0x204b34[_0x0831('0x58')]:_0x204b34[_0x0831('0x59')];_0x54a21a[_0x0831('0x5a')]=_0x476cc3==='queue'||_0x476cc3===_0x0831('0x5b')?_0x0831('0x5c'):_0x0831('0x37');var _0xc7c6b6=util[_0x0831('0x4d')](_0x0831('0x5d'),_0x45567f[_0x0831('0x55')],_0x204b34[_0x0831('0x5e')],md5(_0x204b34['uniqueid']));if(_0x4cb341&&_0x4cb341[_0x0831('0x5f')]){logger[_0x0831('0xe')](_0x0831('0x60'),_0x0831('0x61'));_0x204b34[_0x0831('0x62')]=_0xc7c6b6;}else if(_0x1c0811&&_0x1c0811['recordingFormat']&&_0x1c0811['recordingFormat']!==_0x0831('0x63')){logger[_0x0831('0xe')](_0x0831('0x64'),'Recording\x20is\x20enabled!');_0x204b34[_0x0831('0x62')]=_0xc7c6b6;}else{_0x204b34[_0x0831('0x62')]='';}return getAdminUser(_0x476cc3,_0x2f99bc,_0x54a21a,_0x207a8c,_0xeec6fd,_0x403244)[_0x0831('0xa')](getUser(_0x476cc3,_0x2f99bc,_0x207a8c,_0xeec6fd,_0x403244))[_0x0831('0xa')](getEndUser(_0x476cc3,_0x2f99bc,_0x207a8c,_0xeec6fd,_0x403244))[_0x0831('0xa')](getTicket(_0x476cc3,_0x2f99bc,_0x207a8c,_0x52805b,_0x204b34,_0xeec6fd))['then'](function(_0x328812){logger[_0x0831('0xe')](util[_0x0831('0x4d')](_0x0831('0x65'),_0x328812[_0x0831('0x3c')]));logger[_0x0831('0xe')](util[_0x0831('0x4d')](_0x0831('0x66'),_0x476cc3));if(_0x476cc3!==_0x0831('0x5b')){logger['info']('['+[_0x476cc3[_0x0831('0xf')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x45567f[_0x0831('0x54')],_0x432601[_0x0831('0x36')],_0x328812[_0x0831('0x3c')]);}})[_0x0831('0x26')](function(_0x4546ff){logger[_0x0831('0x10')]('['+[_0x476cc3[_0x0831('0xf')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x0831('0x67')](_0x4546ff,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x48c3=['content','variable','variableName','toString','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','POST','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','calleridnum','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','servicenow','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','length','result','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','userId','adminId','userEmail','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','picklist','type','nameField','customField','includes','idField','toLowerCase'];(function(_0x564a84,_0x5c25a2){var _0x376607=function(_0x24ff63){while(--_0x24ff63){_0x564a84['push'](_0x564a84['shift']());}};_0x376607(++_0x5c25a2);}(_0x48c3,0xac));var _0x348c=function(_0x1b0c4d,_0x349c1e){_0x1b0c4d=_0x1b0c4d-0x0;var _0x2af477=_0x48c3[_0x1b0c4d];return _0x2af477;};'use strict';var _=require('lodash');var Promise=require(_0x348c('0x0'));var rp=require(_0x348c('0x1'));var util=require(_0x348c('0x2'));var md5=require('md5');var Redis=require(_0x348c('0x3'));var intUtil=require(_0x348c('0x4'));var config=require(_0x348c('0x5'));var logger=require('../../../../config/logger')(_0x348c('0x6'));config[_0x348c('0x7')]=_['defaults'](config[_0x348c('0x7')],{'host':_0x348c('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x6fa659,_0x5767ea,_0x26d7b0,_0x5b831e,_0x3c9597,_0x36c649){return new Promise(function(_0x4f5053,_0x356e3c){var _0x5037c2={'method':_0x348c('0x9'),'uri':_0x5b831e+_0x348c('0xa')+'&'+_0x3c9597+'&'+_0x36c649,'auth':_0x5767ea,'json':!![]};return rp(_0x5037c2)['then'](function(_0x3c1889){if(_0x3c1889['result'][_0x348c('0xb')]>0x0){_0x26d7b0['adminId']=_0x3c1889[_0x348c('0xc')][0x0][_0x348c('0xd')];}logger['info']('['+[_0x6fa659[_0x348c('0xe')]()]+_0x348c('0xf'),_0x26d7b0);_0x4f5053(_0x26d7b0);})[_0x348c('0x10')](function(_0x15efa6){logger[_0x348c('0x11')]('['+[_0x6fa659[_0x348c('0xe')]()]+']',_0x15efa6[_0x348c('0x12')]);_0x356e3c(_0x15efa6['message']);});});}function getUser(_0x22b1a9,_0x56ac22,_0x1b29ca,_0xd55f38,_0x8bd4fb){return function(_0x482e93){logger[_0x348c('0x13')]('['+[_0x22b1a9[_0x348c('0xe')]()]+_0x348c('0x14'),_0x482e93);return new Promise(function(_0x1f302b,_0x195cfc){if(intUtil[_0x348c('0x15')](_0x482e93['userEmail'])){var _0x2d05dc={'method':'GET','uri':_0x1b29ca+_0x348c('0x16')+_0x482e93['userEmail']+'&'+_0xd55f38+'&'+_0x8bd4fb,'auth':_0x56ac22,'json':!![]};logger[_0x348c('0x13')]('['+[_0x22b1a9['toUpperCase']()]+_0x348c('0x17'),_0x2d05dc);return rp(_0x2d05dc)[_0x348c('0x18')](function(_0x7b5b6b){logger['info']('['+[_0x22b1a9[_0x348c('0xe')]()]+_0x348c('0x19'),_0x7b5b6b);if(_0x7b5b6b[_0x348c('0xc')][_0x348c('0xb')]>0x0&&String(_0x7b5b6b['result'][0x0][_0x348c('0x1a')])==='true'){_0x482e93[_0x348c('0x1b')]=_0x7b5b6b[_0x348c('0xc')][0x0][_0x348c('0xd')];}else{_0x482e93[_0x348c('0x1b')]=_0x482e93[_0x348c('0x1c')];_0x482e93[_0x348c('0x1d')]=_0x482e93[_0x348c('0x1e')];}logger[_0x348c('0x13')]('['+[_0x22b1a9[_0x348c('0xe')]()]+'],\x20getUser\x20crm',_0x482e93);_0x1f302b(_0x482e93);})[_0x348c('0x10')](function(_0x344a26){logger['error']('['+[_0x22b1a9[_0x348c('0xe')]()]+']',_0x344a26[_0x348c('0x12')]);_0x195cfc(_0x344a26[_0x348c('0x12')]);});}else{logger[_0x348c('0x13')]('['+[_0x22b1a9[_0x348c('0xe')]()]+_0x348c('0x1f'));_0x482e93['userId']=_0x482e93[_0x348c('0x1c')];_0x482e93[_0x348c('0x1d')]=_0x482e93[_0x348c('0x1e')];_0x1f302b(_0x482e93);}});};}function createEndUser(_0x38e663,_0x40ca6b,_0x34bfef,_0x1df4e2,_0x1b5d4d){logger[_0x348c('0x13')]('['+[_0x38e663['toUpperCase']()]+_0x348c('0x20'),_0x34bfef);return new Promise(function(_0x54eb18,_0x4decb2){var _0x58a713={'method':'POST','uri':_0x1df4e2+_0x348c('0x21')+_0x1b5d4d,'body':{'user_name':_0x34bfef[_0x348c('0x22')],'roles':'user','first_name':_0x34bfef[_0x348c('0x22')],'active':_0x348c('0x23'),'date_format':_0x348c('0x24'),'phone':_0x34bfef['endUserNumber']},'auth':_0x40ca6b,'json':!![]};return rp(_0x58a713)[_0x348c('0x18')](function(_0x3560e5){logger[_0x348c('0x13')]('['+[_0x38e663[_0x348c('0xe')]()]+_0x348c('0x25'),_0x3560e5[_0x348c('0xc')]);_0x34bfef[_0x348c('0x26')]=_0x3560e5['result']['sys_id'];_0x54eb18(_0x34bfef);})[_0x348c('0x10')](function(_0x537ad7){logger[_0x348c('0x11')]('['+[_0x38e663['toUpperCase']()]+']',_0x537ad7[_0x348c('0x12')]);_0x4decb2(_0x537ad7[_0x348c('0x12')]);});});}function getEndUser(_0x172b0c,_0x1f362c,_0x2176dc,_0x4e2bf6,_0x48bf9d){return function(_0x4e82d3){logger[_0x348c('0x13')]('['+[_0x172b0c[_0x348c('0xe')]()]+_0x348c('0x27'),_0x4e82d3);return new Promise(function(_0x187c4a,_0x1ca48b){var _0xa93115={'method':_0x348c('0x9'),'uri':_0x2176dc+'sys_user?sysparm_query=phone%3D'+_0x4e82d3[_0x348c('0x22')]+'&'+_0x4e2bf6+'&'+_0x48bf9d,'auth':_0x1f362c,'json':!![]};return rp(_0xa93115)[_0x348c('0x18')](function(_0x3c4999){if(_0x3c4999[_0x348c('0xc')][_0x348c('0xb')]>0x0){_0x4e82d3[_0x348c('0x26')]=_0x3c4999[_0x348c('0xc')][0x0][_0x348c('0xd')];logger[_0x348c('0x13')]('['+[_0x172b0c[_0x348c('0xe')]()]+_0x348c('0x28'),_0x4e82d3);_0x187c4a(_0x4e82d3);}else{return createEndUser(_0x172b0c,_0x1f362c,_0x4e82d3,_0x2176dc,_0x4e2bf6)[_0x348c('0x18')](function(_0x1726d3){logger[_0x348c('0x13')]('['+[_0x172b0c[_0x348c('0xe')]()]+_0x348c('0x29'),_0x1726d3);_0x187c4a(_0x1726d3);});}})['catch'](function(_0x2e42ef){logger[_0x348c('0x11')]('['+[_0x172b0c[_0x348c('0xe')]()]+']',_0x2e42ef[_0x348c('0x12')]);_0x1ca48b(_0x2e42ef[_0x348c('0x12')]);});});};}function getCustomFields(_0x1ff097,_0x4a9033){var _0x1ba86a={};if(_0x1ff097[_0x348c('0xb')]>0x0){_[_0x348c('0x2a')](_0x1ff097,function(_0x456755){if(_['includes'](['string',_0x348c('0x2b')],_0x456755[_0x348c('0x2c')])&&_0x456755[_0x348c('0x2d')]&&!_0x456755[_0x348c('0x2e')]){_0x1ba86a[_0x456755[_0x348c('0x2d')]['toLowerCase']()]=_0x456755['content']['toString']();}else if(_[_0x348c('0x2f')](['string','picklist'],_0x456755[_0x348c('0x2c')])&&_0x456755['idField']&&_0x456755[_0x348c('0x2e')]){_0x1ba86a[_0x456755[_0x348c('0x30')][_0x348c('0x31')]()]=_0x456755[_0x348c('0x32')]['toString']();}else if(_0x456755['type']===_0x348c('0x33')&&_0x456755[_0x348c('0x34')]&&_0x456755['idField']&&_0x456755['customField']){_0x1ba86a[_0x456755[_0x348c('0x30')][_0x348c('0x31')]()]=_0x4a9033[_0x456755[_0x348c('0x34')]][_0x348c('0x35')]();}else if(_0x456755[_0x348c('0x2c')]===_0x348c('0x36')&&_0x456755[_0x348c('0x37')]&&_0x456755[_0x348c('0x37')][_0x348c('0x38')]&&_0x456755['idField']&&_0x456755[_0x348c('0x2e')]){_0x1ba86a[_0x456755[_0x348c('0x30')][_0x348c('0x31')]()]=_0x4a9033[_0x456755[_0x348c('0x37')][_0x348c('0x38')][_0x348c('0x31')]()]['toString']();}});}return _0x1ba86a;}function getTicket(_0x32e35f,_0x31dfeb,_0x4ccaa8,_0x3bb7e5,_0x4cd7b8,_0xac6418){return function(_0x17b949){logger[_0x348c('0x13')]('['+[_0x32e35f['toUpperCase']()]+_0x348c('0x39'),_0x17b949);return new Promise(function(_0x5adfd4,_0x455c84){var _0x3da848=_0x32e35f[_0x348c('0x31')]()===_0x348c('0x3a')?_0x17b949[_0x348c('0x1b')]:_0x17b949[_0x348c('0x26')];var _0xe4645f={'method':'POST','uri':_0x4ccaa8+_0x348c('0x3b')+'?'+_0xac6418,'body':Object[_0x348c('0x3c')]({},{'active':_0x348c('0x23'),'caller_id':_0x3da848,'assigned_to':_0x17b949[_0x348c('0x1b')],'short_description':intUtil[_0x348c('0x3d')](_0x3bb7e5['Subjects'],_0x4cd7b8,'\x20'),'description':intUtil[_0x348c('0x3d')](_0x3bb7e5[_0x348c('0x3e')],_0x4cd7b8,'\x0a')},getCustomFields(_0x3bb7e5[_0x348c('0x3f')],_0x4cd7b8)),'auth':_0x31dfeb,'json':!![]};return rp(_0xe4645f)[_0x348c('0x18')](function(_0x206383){logger[_0x348c('0x13')]('['+[_0x32e35f[_0x348c('0xe')]()]+_0x348c('0x40'),_0x206383[_0x348c('0xc')]);_0x17b949[_0x348c('0x41')]=_0x206383[_0x348c('0xc')][_0x348c('0xd')];_0x17b949[_0x348c('0x42')]=_0x206383[_0x348c('0xc')][_0x348c('0x43')];logger[_0x348c('0x13')]('['+[_0x32e35f[_0x348c('0xe')]()]+_0x348c('0x44'),_0x17b949);_0x5adfd4(_0x17b949);})[_0x348c('0x10')](function(_0xae7336){logger[_0x348c('0x11')]('['+[_0x32e35f[_0x348c('0xe')]()]+']',_0xae7336[_0x348c('0x12')]);_0x455c84(_0xae7336[_0x348c('0x12')]);});});};}function createRemoteTag(_0x2a7e3a,_0x4725ae,_0x2d9883,_0x5910b9){return new Promise(function(_0x24c25d,_0x401f60){var _0x57bbc2={'method':_0x348c('0x45'),'uri':_0x2d9883+_0x348c('0x46')+'?'+_0x5910b9,'body':{'short_description':_0x2a7e3a,'global':!![],'active':!![],'name':_0x2a7e3a},'auth':_0x4725ae,'json':!![]};return rp(_0x57bbc2)[_0x348c('0x18')](function(_0xa9b544){var _0x56e4e2=_0xa9b544[_0x348c('0xc')][_0x348c('0xd')];_0x24c25d(_0x56e4e2);});});}function getRemoteTag(_0x20dcd9,_0x5b697b,_0x5da581,_0x5623d8,_0x3e890b){return new Promise(function(_0x451254,_0x3cd2f0){var _0x537d96={'method':'GET','uri':_0x5da581+_0x348c('0x46')+_0x348c('0x47')+_0x20dcd9+'&'+_0x5623d8,'auth':_0x5b697b,'json':!![]};return rp(_0x537d96)[_0x348c('0x18')](function(_0x2c4ce1){if(_0x2c4ce1[_0x348c('0xc')][_0x348c('0xb')]>0x0){var _0x3aeded=_0x2c4ce1[_0x348c('0xc')][0x0][_0x348c('0xd')];_0x451254(_0x3aeded);}else{return createRemoteTag(_0x20dcd9,_0x5b697b,_0x5da581,_0x5623d8)['then'](function(_0x1b1f17){_0x451254(_0x1b1f17);});}});});}function assignTagToIncident(_0x1803e6,_0x5a33d6,_0x542eb8,_0x239b18,_0x34d742){return new Promise(function(_0x56e154,_0x482340){var _0x118888={'method':_0x348c('0x45'),'uri':_0x542eb8+_0x348c('0x48')+'?'+_0x34d742,'body':{'label':_0x1803e6,'table':_0x348c('0x3b'),'id_type':_0x348c('0x49'),'table_key':_0x239b18[_0x348c('0x41')],'title':_0x348c('0x4a')+_0x239b18[_0x348c('0x42')],'id_display':_0x239b18[_0x348c('0x42')]},'auth':_0x5a33d6,'json':!![]};return rp(_0x118888)[_0x348c('0x18')](function(_0x52d16e){_0x56e154();})[_0x348c('0x10')](function(){_0x56e154();});});}function manageTags(_0xd2a669,_0x22f90c,_0x5e7662,_0x4c02a4,_0x3aa89c,_0x2d35ea,_0x56d7ce){return new Promise(function(_0x592b2e,_0x4add06){var _0x62cada=[];_0x22f90c[_0x348c('0x2a')](function(_0xb69dd7){_0x62cada[_0x348c('0x4b')](getRemoteTag(_0xb69dd7,_0x5e7662,_0x4c02a4,_0x2d35ea,_0x56d7ce));});return Promise[_0x348c('0x4c')](_0x62cada)[_0x348c('0x18')](function(_0x57c8a0){if(_0x57c8a0[_0x348c('0xb')]){logger[_0x348c('0x13')]('['+[_0xd2a669[_0x348c('0xe')]()]+_0x348c('0x4d'),_0x57c8a0);var _0x2f3f15=[];_0x57c8a0[_0x348c('0x2a')](function(_0x1d303a){_0x2f3f15[_0x348c('0x4b')](assignTagToIncident(_0x1d303a,_0x5e7662,_0x4c02a4,_0x3aa89c,_0x2d35ea));});return Promise['all'](_0x2f3f15)['then'](function(){_0x592b2e();})[_0x348c('0x10')](function(){_0x592b2e();});}else{_0x592b2e();}});});}function getTags(_0x11b85b,_0x353658,_0x13c9ac,_0x172282,_0x37958f,_0x41b4f0){return function(_0x2defcf){return new Promise(function(_0x2edb8b,_0x2c2dd3){var _0x5b72ea=[];var _0x53c263=_0x172282[_0x348c('0x4e')];if(_0x53c263&&_0x53c263[_0x348c('0xb')]>0x0){_0x5b72ea=_[_0x348c('0x4f')](_0x53c263,_0x348c('0x38'));}if(_0x5b72ea[_0x348c('0xb')]>0x0){return manageTags(_0x11b85b,_0x5b72ea,_0x353658,_0x13c9ac,_0x2defcf,_0x37958f,_0x41b4f0)['then'](function(){_0x2edb8b(_0x2defcf);});}else{_0x2edb8b(_0x2defcf);}});};}function emit(_0x1046a0,_0x5ef321,_0x42eb51){var _0x12bd18=_0x348c('0x50')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x348c('0x51')+_0x348c('0x52');var _0x26ea4b={'uri':_0x1046a0+_0x348c('0x53')+_0x42eb51+_0x12bd18};io['to'](util['format']('user:%s',_0x5ef321))[_0x348c('0x54')](_0x348c('0x55'),_0x26ea4b);}exports['cs']=function(_0x1489e3,_0x30cd16,_0x18b9ed,_0x144b0e,_0x565c1d,_0x5e3080,_0x1ba942,_0x39ce2f){var _0x420dca={};var _0xbab031={'user':_0x5e3080[_0x348c('0x56')],'pass':_0x5e3080[_0x348c('0x57')]};var _0x1ea484=_0x348c('0x58');var _0x36c14=_0x348c('0x59');_0x5e3080[_0x348c('0x5a')]=intUtil[_0x348c('0x5b')](_0x5e3080[_0x348c('0x5a')]);_0x5e3080[_0x348c('0x5c')]=intUtil[_0x348c('0x5b')](_0x5e3080['serverUrl']);var _0x1fa2dd=util[_0x348c('0x5d')](_0x348c('0x5e'),_0x5e3080[_0x348c('0x5a')]);_0x420dca[_0x348c('0x1d')]=!_[_0x348c('0x5f')](_0x144b0e)?_0x144b0e['email']:null;_0x420dca['adminEmail']=_0x5e3080[_0x348c('0x60')];_0x420dca[_0x348c('0x22')]=_0x39ce2f[_0x348c('0x31')]()===_0x348c('0x3a')?_0x30cd16['destcalleridnum']:_0x30cd16[_0x348c('0x61')];_0x420dca['callDirection']=_0x39ce2f==='queue'||_0x39ce2f===_0x348c('0x62')?_0x348c('0x63'):_0x348c('0x3a');var _0x1f74e1=util[_0x348c('0x5d')](_0x348c('0x64'),_0x5e3080[_0x348c('0x5c')],_0x30cd16['uniqueid'],md5(_0x30cd16[_0x348c('0x65')]));if(_0x565c1d&&_0x565c1d[_0x348c('0x66')]){logger[_0x348c('0x13')](_0x348c('0x67'),_0x348c('0x68'));_0x30cd16[_0x348c('0x69')]=_0x1f74e1;}else if(_0x1ba942&&_0x1ba942[_0x348c('0x6a')]&&_0x1ba942[_0x348c('0x6a')]!==_0x348c('0x6b')){logger[_0x348c('0x13')](_0x348c('0x6c'),_0x348c('0x68'));_0x30cd16[_0x348c('0x69')]=_0x1f74e1;}else{_0x30cd16[_0x348c('0x69')]='';}return getAdminUser(_0x39ce2f,_0xbab031,_0x420dca,_0x1fa2dd,_0x36c14,_0x1ea484)[_0x348c('0x18')](getUser(_0x39ce2f,_0xbab031,_0x1fa2dd,_0x36c14,_0x1ea484))[_0x348c('0x18')](getEndUser(_0x39ce2f,_0xbab031,_0x1fa2dd,_0x36c14,_0x1ea484))[_0x348c('0x18')](getTicket(_0x39ce2f,_0xbab031,_0x1fa2dd,_0x18b9ed,_0x30cd16,_0x36c14))[_0x348c('0x18')](function(_0x1b60c8){logger[_0x348c('0x13')](util[_0x348c('0x5d')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1b60c8['ticketId']));logger[_0x348c('0x13')](util[_0x348c('0x5d')](_0x348c('0x6d'),_0x39ce2f));if(_0x39ce2f!==_0x348c('0x62')){logger[_0x348c('0x13')]('['+[_0x39ce2f[_0x348c('0xe')]()]+']',_0x348c('0x6e'));emit(_0x5e3080['remoteUri'],_0x144b0e[_0x348c('0x38')],_0x1b60c8[_0x348c('0x41')]);}})[_0x348c('0x10')](function(_0x2b479f){logger[_0x348c('0x11')]('['+[_0x39ce2f[_0x348c('0xe')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x2b479f,{'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 75d290a..0a6ecce 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 _0xcf15=['calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','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','[QUEUE]','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','Fields','Outbound','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','isNil','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','Subjects','assigned_user_id','created_by','description','getString','toISOString','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','value','name_value_list','name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','map','forEach','type','string','nameField','customField','content','push','variable','customVariable','Variable','toLowerCase','login','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid'];(function(_0x47ca08,_0x3c48da){var _0x17636f=function(_0x402068){while(--_0x402068){_0x47ca08['push'](_0x47ca08['shift']());}};_0x17636f(++_0x3c48da);}(_0xcf15,0x92));var _0x5cf1=function(_0x4ae5d3,_0x3f65fe){_0x4ae5d3=_0x4ae5d3-0x0;var _0x38bb02=_0xcf15[_0x4ae5d3];return _0x38bb02;};'use strict';var _=require(_0x5cf1('0x0'));var rp=require(_0x5cf1('0x1'));var BPromise=require(_0x5cf1('0x2'));var md5=require(_0x5cf1('0x3'));var util=require(_0x5cf1('0x4'));var Redis=require(_0x5cf1('0x5'));var intUtil=require(_0x5cf1('0x6'));var config=require(_0x5cf1('0x7'));var logger=require(_0x5cf1('0x8'))(_0x5cf1('0x9'));config[_0x5cf1('0xa')]=_[_0x5cf1('0xb')](config[_0x5cf1('0xa')],{'host':_0x5cf1('0xc'),'port':0x18eb});var io=require(_0x5cf1('0xd'))(new Redis(config[_0x5cf1('0xa')]));var def={'method':_0x5cf1('0xe'),'json':!![]};function emit(_0x43de7b,_0x13bf5a,_0xa10e3e){io['to'](_0x43de7b)[_0x5cf1('0xf')](_0x13bf5a,_0xa10e3e);}function getTicket(_0x53667d,_0x371a4e,_0xe80c3b,_0x2d0b1c,_0x6dc4ef,_0x3e6a1a,_0x212e2d,_0xd7256d){logger[_0x5cf1('0x10')](_0x5cf1('0x11'));var _0x2fd95d=new Date();var _0x2fdf73=[{'name':'name','value':intUtil['getString'](_0x2d0b1c[_0x5cf1('0x12')],_0x6dc4ef,'\x20')},{'name':_0x5cf1('0x13'),'value':_0x371a4e['id']},{'name':_0x5cf1('0x14'),'value':_0x371a4e['id']},{'name':_0x5cf1('0x15'),'value':intUtil[_0x5cf1('0x16')](_0x2d0b1c['Descriptions'],_0x6dc4ef,'\x0a')},{'name':'date_start','value':_0x2fd95d[_0x5cf1('0x17')]()['slice'](0x0,0x13)[_0x5cf1('0x18')]('T','\x20')},{'name':_0x5cf1('0x19'),'value':'0'},{'name':_0x5cf1('0x1a'),'value':'15'},{'name':_0x5cf1('0x1b'),'value':_0xe80c3b['id']},{'name':'parent_type','value':_0x5cf1('0x1c')},{'name':_0x5cf1('0x1d'),'value':_0xe80c3b['name']},{'name':_0x5cf1('0x1e'),'value':_0xd7256d}];if(_0x3e6a1a[_0x5cf1('0x1f')]){_['forEach'](_0x3e6a1a,function(_0x4e3629){if(_0x6dc4ef[_0x4e3629[_0x5cf1('0x20')]]){_0x2fdf73['push']({'name':_0x4e3629[_0x5cf1('0x21')],'value':_0x6dc4ef[_0x4e3629[_0x5cf1('0x20')]]});}});}return request({'form':{'method':_0x5cf1('0x22'),'input_type':_0x5cf1('0x23'),'response_type':_0x5cf1('0x23'),'rest_data':JSON[_0x5cf1('0x24')]({'session':_0x212e2d['id'],'module_name':_0x5cf1('0x25'),'name_value_list':_0x2fdf73})}});}function getAuth(_0x4506bc){return util[_0x5cf1('0x26')](_0x5cf1('0x27'),new Buffer(_0x4506bc[_0x5cf1('0x28')]+':X')[_0x5cf1('0x29')](_0x5cf1('0x2a')));}function getServerInfo(_0x27f714){return request({'form':{'method':_0x5cf1('0x2b'),'input_type':_0x5cf1('0x23'),'response_type':'JSON','rest_data':JSON[_0x5cf1('0x24')]({'session':_0x27f714['id']})}});}function getUser(_0x3ea7e2,_0x3eefa0,_0x16ae2d){if(!_['isNil'](_0x3eefa0)){logger['info']('Getting\x20agent\x20with\x20name',_0x3eefa0);return request({'form':{'method':_0x5cf1('0x2c'),'input_type':_0x5cf1('0x23'),'response_type':_0x5cf1('0x23'),'rest_data':JSON[_0x5cf1('0x24')]({'session':_0x16ae2d['id'],'module_name':_0x5cf1('0x2d'),'query':util['format'](_0x5cf1('0x2e'),_0x3eefa0),'order_by':'','offset':'0','select_fields':['id','name',_0x5cf1('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5cf1('0x30')](function(_0x1df869){if(_0x1df869['entry_list'][_0x5cf1('0x1f')]){var _0x1af422=_[_0x5cf1('0x31')](_0x1df869[_0x5cf1('0x32')],function(_0x1b8888){return _0x1b8888['name_value_list'][_0x5cf1('0x2f')][_0x5cf1('0x33')]===_0x3eefa0;});if(_0x1af422){logger['info']('Agent\x20found!');return BPromise['resolve']({'id':_0x1af422[_0x5cf1('0x34')]['id'][_0x5cf1('0x33')],'name':_0x1af422[_0x5cf1('0x34')][_0x5cf1('0x35')]['value']});}}logger[_0x5cf1('0x10')](_0x5cf1('0x36'));return BPromise[_0x5cf1('0x37')]({'id':_0x16ae2d['name_value_list']['user_id']['value'],'name':_0x16ae2d[_0x5cf1('0x34')][_0x5cf1('0x2f')][_0x5cf1('0x33')]});});}else{logger[_0x5cf1('0x10')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x5cf1('0x37')]({'id':_0x16ae2d[_0x5cf1('0x34')]['user_id'][_0x5cf1('0x33')],'name':_0x16ae2d[_0x5cf1('0x34')][_0x5cf1('0x2f')][_0x5cf1('0x33')]});}}function getEndUser(_0x21b196,_0x3763d2,_0x3ccea2,_0x220e94){logger[_0x5cf1('0x10')]('Searching\x20enduser\x20with\x20phone',_0x3ccea2);return request({'form':{'method':_0x5cf1('0x2c'),'input_type':_0x5cf1('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x220e94['id'],'module_name':'Contacts','query':util[_0x5cf1('0x26')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x3ccea2),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5cf1('0x30')](function(_0xd14629){if(_0xd14629[_0x5cf1('0x32')][_0x5cf1('0x1f')]){var _0xd2d120=_[_0x5cf1('0x31')](_0xd14629[_0x5cf1('0x32')],function(_0x2b29e4){return _0x2b29e4[_0x5cf1('0x34')][_0x5cf1('0x38')][_0x5cf1('0x33')]===_0x3ccea2;});if(_0xd2d120){logger[_0x5cf1('0x10')]('Enduser\x20found!');return BPromise[_0x5cf1('0x37')]({'id':_0xd2d120[_0x5cf1('0x34')]['id'][_0x5cf1('0x33')],'name':_0xd2d120[_0x5cf1('0x34')][_0x5cf1('0x35')][_0x5cf1('0x33')],'phone':_0xd2d120['name_value_list'][_0x5cf1('0x38')]['value']});}}else{logger[_0x5cf1('0x10')](_0x5cf1('0x39'));return request({'form':{'method':_0x5cf1('0x22'),'input_type':'JSON','response_type':_0x5cf1('0x23'),'rest_data':JSON[_0x5cf1('0x24')]({'session':_0x220e94['id'],'module_name':_0x5cf1('0x1c'),'name_value_list':[{'name':'first_name','value':_0x3763d2!==''?_0x3763d2:util[_0x5cf1('0x26')](_0x5cf1('0x3a'),_0x3ccea2)},{'name':'phone_home','value':_0x3ccea2}]})}})[_0x5cf1('0x30')](function(_0x31a5fc){logger[_0x5cf1('0x10')](_0x5cf1('0x3b'));return BPromise[_0x5cf1('0x37')]({'id':_0x31a5fc['id'],'name':_0x31a5fc[_0x5cf1('0x32')][_0x5cf1('0x3c')]['value'],'phone':_0x31a5fc[_0x5cf1('0x32')]['phone_home'][_0x5cf1('0x33')]});});}});}function request(_0x47369f){logger[_0x5cf1('0x3d')](_0x5cf1('0x3e'),JSON[_0x5cf1('0x24')](_0x47369f));return rp(_['merge'](def,_0x47369f));}function getTags(_0x5a0e46,_0x5f5ae1){var _0x79dd2b=[];if(_0x5a0e46&&_0x5a0e46[_0x5cf1('0x1f')]>0x0){_0x79dd2b=_[_0x5cf1('0x3f')](_0x5a0e46,_0x5f5ae1);}return _0x79dd2b;}function getCustomFields(_0x57791d,_0x408634){var _0x1b4550=[];var _0x5e0135={'custom_fields':[]};if(_0x57791d['length']>0x0){_[_0x5cf1('0x40')](_0x57791d,function(_0x17f308){if(_0x17f308[_0x5cf1('0x41')]===_0x5cf1('0x42')&&_0x17f308[_0x5cf1('0x43')]&&!_0x17f308[_0x5cf1('0x44')]){_0x5e0135[_0x17f308[_0x5cf1('0x43')]['toLowerCase']()]=_0x17f308[_0x5cf1('0x45')][_0x5cf1('0x29')]();}else if(_0x17f308[_0x5cf1('0x41')]===_0x5cf1('0x42')&&_0x17f308[_0x5cf1('0x21')]&&_0x17f308[_0x5cf1('0x44')]){_0x5e0135['custom_fields'][_0x5cf1('0x46')]({'id':_0x17f308[_0x5cf1('0x21')],'value':_0x17f308[_0x5cf1('0x45')][_0x5cf1('0x29')]()});}else if(_0x17f308[_0x5cf1('0x41')]===_0x5cf1('0x47')&&_0x17f308['variableName']&&_0x17f308[_0x5cf1('0x21')]&&_0x17f308['customField']){_0x408634[_0x17f308[_0x5cf1('0x20')]]&&_0x5e0135['custom_fields']['push']({'id':_0x17f308[_0x5cf1('0x21')],'value':_0x408634[_0x17f308[_0x5cf1('0x20')]]['toString']()});}else if(_0x17f308[_0x5cf1('0x41')]===_0x5cf1('0x48')&&_0x17f308['Variable']&&_0x17f308[_0x5cf1('0x49')]['name']&&_0x17f308[_0x5cf1('0x21')]&&_0x17f308[_0x5cf1('0x44')]){_0x408634[_0x17f308[_0x5cf1('0x49')][_0x5cf1('0x35')]['toLowerCase']()]&&_0x5e0135['custom_fields']['push']({'id':_0x17f308['idField'],'value':_0x408634[_0x17f308[_0x5cf1('0x49')][_0x5cf1('0x35')][_0x5cf1('0x4a')]()][_0x5cf1('0x29')]()});}});}return _0x5e0135;}function getConnection(_0x1daaef){return request({'method':_0x5cf1('0xe'),'form':{'method':_0x5cf1('0x4b'),'input_type':_0x5cf1('0x23'),'response_type':'JSON','rest_data':JSON[_0x5cf1('0x24')]({'user_auth':{'user_name':_0x1daaef['username'],'password':_0x1daaef['password'],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x5cf1('0x30')](function(_0x4a3463){var _0x2d802e=_0x4a3463;if(_0x2d802e['id']){def[_0x5cf1('0x4c')]=_0x2d802e['id'];return BPromise['resolve'](_0x2d802e);}else{throw new Error(util[_0x5cf1('0x26')](_0x5cf1('0x4d'),_0x1daaef['id']));}});}function setRelationship(_0x4d3e36,_0xedff64,_0x5df5f3,_0x219ea7){return request({'form':{'method':_0x5cf1('0x4e'),'input_type':_0x5cf1('0x23'),'response_type':_0x5cf1('0x23'),'rest_data':JSON[_0x5cf1('0x24')]({'session':_0x4d3e36['id'],'module_name':_0x5cf1('0x25'),'module_id':_0x5df5f3['id'],'link_field_name':_0x219ea7,'related_ids':[_0xedff64['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x25e4c3,_0x33e251,_0x5b3d03,_0x1716ca,_0x52b6d2,_0x2ced43){var _0x2245d1,_0x19ebd3,_0x39d710,_0x3ddf5c;_0x2ced43[_0x5cf1('0x4f')]=intUtil[_0x5cf1('0x50')](_0x2ced43[_0x5cf1('0x4f')]);_0x2ced43[_0x5cf1('0x51')]=intUtil[_0x5cf1('0x50')](_0x2ced43[_0x5cf1('0x51')]);def[_0x5cf1('0x52')]=util['format'](_0x5cf1('0x53'),_0x2ced43[_0x5cf1('0x4f')]);if(_0x52b6d2&&_0x52b6d2[_0x5cf1('0x54')]){logger[_0x5cf1('0x10')]('[QUEUE]',_0x5cf1('0x55'));_0x33e251[_0x5cf1('0x56')]=util[_0x5cf1('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ced43[_0x5cf1('0x51')],_0x33e251[_0x5cf1('0x57')],md5(_0x33e251[_0x5cf1('0x57')]));}else{_0x33e251[_0x5cf1('0x56')]='';}return getConnection(_0x2ced43)[_0x5cf1('0x30')](function(_0x6bccca){_0x3ddf5c=_0x6bccca;return getUser(_0x2ced43,_0x1716ca[_0x5cf1('0x35')],_0x3ddf5c);})[_0x5cf1('0x30')](function(_0x4d9308){_0x2245d1=_0x4d9308;logger[_0x5cf1('0x10')]('The\x20User\x20ID\x20is:',_0x2245d1['id']);return getEndUser(_0x2ced43,_0x33e251[_0x5cf1('0x58')],_0x33e251[_0x5cf1('0x59')],_0x3ddf5c);})[_0x5cf1('0x30')](function(_0x32ba0d){_0x19ebd3=_0x32ba0d;logger['info'](_0x5cf1('0x5a'),_0x19ebd3['id']);return getTicket(_0x2ced43,_0x2245d1,_0x19ebd3,_0x5b3d03,_0x33e251,_0x5b3d03['Fields'],_0x3ddf5c,_0x5cf1('0x5b'));})[_0x5cf1('0x30')](function(_0x5b05d5){_0x39d710=_0x5b05d5;logger[_0x5cf1('0x10')](_0x5cf1('0x5c'));logger['info'](_0x5cf1('0x5d'),_0x39d710['id']);return setRelationship(_0x3ddf5c,_0x2245d1,_0x39d710,_0x5cf1('0x5e'));})['then'](function(){return setRelationship(_0x3ddf5c,_0x19ebd3,_0x39d710,_0x5cf1('0x5f'));})[_0x5cf1('0x30')](function(){return getServerInfo(_0x3ddf5c);})['then'](function(_0x2c7627){var _0x631ce7=parseInt(_0x2c7627[_0x5cf1('0x60')][_0x5cf1('0x61')](0x0));var _0xb60416=util[_0x5cf1('0x26')](_0x5cf1('0x62'),_0x2ced43[_0x5cf1('0x4f')],_0x39d710['id']);if(_0x631ce7>0x6){_0xb60416=util[_0x5cf1('0x26')](_0x5cf1('0x63'),_0x2ced43[_0x5cf1('0x4f')],_0x39d710['id']);}logger['info'](_0x5cf1('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5cf1('0x26')](_0x5cf1('0x65'),_0x1716ca[_0x5cf1('0x35')]),_0x5cf1('0x66'),{'uri':_0xb60416});})[_0x5cf1('0x67')](function(_0x71a85a){logger[_0x5cf1('0x68')](_0x5cf1('0x64'),JSON[_0x5cf1('0x24')](_0x71a85a));});};exports[_0x5cf1('0x69')]=function(_0x4854c7,_0x3bc33d,_0x3bbcb1,_0xb43041,_0x282ff9,_0x22fc35,_0x4da512){var _0x2a2f26,_0x162c3a,_0x423b90,_0x153db9;_0x22fc35['remoteUri']=intUtil['stripTrailingSlash'](_0x22fc35[_0x5cf1('0x4f')]);_0x22fc35['serverUrl']=intUtil['stripTrailingSlash'](_0x22fc35['serverUrl']);def[_0x5cf1('0x52')]=util['format'](_0x5cf1('0x53'),_0x22fc35[_0x5cf1('0x4f')]);if(_0x4da512&&_0x4da512[_0x5cf1('0x6a')]&&_0x4da512['recordingFormat']!==_0x5cf1('0x6b')){logger[_0x5cf1('0x10')](_0x5cf1('0x6c'),_0x5cf1('0x55'));_0x3bc33d['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x22fc35[_0x5cf1('0x51')],_0x3bc33d[_0x5cf1('0x57')],md5(_0x3bc33d[_0x5cf1('0x57')]));}return getConnection(_0x22fc35)['then'](function(_0x16eb9f){_0x153db9=_0x16eb9f;return getUser(_0x22fc35,_0xb43041[_0x5cf1('0x35')],_0x153db9);})[_0x5cf1('0x30')](function(_0x3b5eb0){_0x2a2f26=_0x3b5eb0;logger['info'](_0x5cf1('0x6d'),_0x2a2f26['id']);return getEndUser(_0x22fc35,_0x3bc33d['destcalleridname'],_0x3bc33d['destcalleridnum'],_0x153db9);})[_0x5cf1('0x30')](function(_0x26d593){_0x162c3a=_0x26d593;logger['info'](_0x5cf1('0x5a'),_0x162c3a['id']);return getTicket(_0x22fc35,_0x2a2f26,_0x162c3a,_0x3bbcb1,_0x3bc33d,_0x3bbcb1[_0x5cf1('0x6e')],_0x153db9,_0x5cf1('0x6f'));})[_0x5cf1('0x30')](function(_0x2faaf7){_0x423b90=_0x2faaf7;logger[_0x5cf1('0x10')](_0x5cf1('0x5c'));logger[_0x5cf1('0x10')](_0x5cf1('0x5d'),_0x423b90['id']);return setRelationship(_0x153db9,_0x2a2f26,_0x423b90,_0x5cf1('0x5e'));})[_0x5cf1('0x30')](function(){return setRelationship(_0x153db9,_0x162c3a,_0x423b90,_0x5cf1('0x5f'));})[_0x5cf1('0x30')](function(){return getServerInfo(_0x153db9);})[_0x5cf1('0x30')](function(_0x2a6119){var _0x2455de=parseInt(_0x2a6119['version'][_0x5cf1('0x61')](0x0));var _0x305dcf=util[_0x5cf1('0x26')](_0x5cf1('0x62'),_0x22fc35[_0x5cf1('0x4f')],_0x423b90['id']);if(_0x2455de>0x6){_0x305dcf=util[_0x5cf1('0x26')](_0x5cf1('0x63'),_0x22fc35[_0x5cf1('0x4f')],_0x423b90['id']);}logger[_0x5cf1('0x10')](_0x5cf1('0x6c'),_0x5cf1('0x70'));emit(util[_0x5cf1('0x26')](_0x5cf1('0x65'),_0xb43041[_0x5cf1('0x35')]),_0x5cf1('0x66'),{'uri':_0x305dcf});})['catch'](function(_0x13b0d7){logger[_0x5cf1('0x68')]('[OUTBOUND]',JSON[_0x5cf1('0x24')](_0x13b0d7));});};exports['unmanaged']=function(_0x4651ca,_0x31d46c,_0x516fce,_0x3c3fa2,_0x217eb2,_0x5886a8){var _0x4f2104,_0x314855,_0x4ca7c8,_0x358e4c;_0x5886a8[_0x5cf1('0x4f')]=intUtil[_0x5cf1('0x50')](_0x5886a8[_0x5cf1('0x4f')]);_0x5886a8['serverUrl']=intUtil[_0x5cf1('0x50')](_0x5886a8['serverUrl']);def[_0x5cf1('0x52')]=util[_0x5cf1('0x26')](_0x5cf1('0x53'),_0x5886a8[_0x5cf1('0x4f')]);if(_0x217eb2&&_0x217eb2['monitor_format']){logger[_0x5cf1('0x10')]('['+_0x31d46c[_0x5cf1('0x71')][_0x5cf1('0x72')]()+']',_0x5cf1('0x55'));_0x31d46c[_0x5cf1('0x56')]=util['format'](_0x5cf1('0x73'),_0x5886a8[_0x5cf1('0x51')],_0x31d46c[_0x5cf1('0x57')],md5(_0x31d46c['uniqueid']));}else{_0x31d46c[_0x5cf1('0x56')]='';}return getConnection(_0x5886a8)[_0x5cf1('0x30')](function(_0x35a40e){_0x358e4c=_0x35a40e;if(!_[_0x5cf1('0x74')](_0x3c3fa2)){return getUser(_0x5886a8,_0x3c3fa2['name'],_0x358e4c);}else{return getUser(_0x5886a8,null,_0x358e4c);}})[_0x5cf1('0x30')](function(_0x5c3840){_0x4f2104=_0x5c3840;logger[_0x5cf1('0x10')](_0x5cf1('0x6d'),_0x4f2104['id']);return getEndUser(_0x5886a8,_0x31d46c[_0x5cf1('0x58')],_0x31d46c[_0x5cf1('0x59')],_0x358e4c);})[_0x5cf1('0x30')](function(_0x5248aa){_0x314855=_0x5248aa;logger[_0x5cf1('0x10')]('The\x20Enduser\x20ID\x20is:',_0x314855['id']);return getTicket(_0x5886a8,_0x4f2104,_0x314855,_0x516fce,_0x31d46c,_0x516fce[_0x5cf1('0x6e')],_0x358e4c,'Inbound');})['then'](function(_0x58f150){_0x4ca7c8=_0x58f150;logger[_0x5cf1('0x10')](_0x5cf1('0x5c'));logger['info'](_0x5cf1('0x5d'),_0x4ca7c8['id']);return setRelationship(_0x358e4c,_0x4f2104,_0x4ca7c8,'users');})[_0x5cf1('0x30')](function(){return setRelationship(_0x358e4c,_0x314855,_0x4ca7c8,_0x5cf1('0x5f'));})[_0x5cf1('0x30')](function(){return getServerInfo(_0x358e4c);})[_0x5cf1('0x67')](function(_0x4f775b){logger[_0x5cf1('0x68')]('['+_0x31d46c['lastevent']['toUpperCase']()+']',JSON[_0x5cf1('0x24')](_0x4f775b));});}; \ No newline at end of file +var _0x04c0=['outbound','stripTrailingSlash','uri','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','error','unmanaged','lastevent','Recording\x20is\x20enabled!','calleridname','toUpperCase','request-promise','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','duration_minutes','parent_id','Contacts','direction','forEach','variableName','idField','JSON','stringify','Calls','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','user_name','then','entry_list','length','find','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20found!','Caller\x20-\x20%s','first_name','debug','[HTTP]','merge','map','type','string','nameField','custom_fields','push','content','variable','Variable','toLowerCase','POST','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','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...','user:%s','catch'];(function(_0x845fcc,_0x518cfb){var _0x3a0e79=function(_0x240732){while(--_0x240732){_0x845fcc['push'](_0x845fcc['shift']());}};_0x3a0e79(++_0x518cfb);}(_0x04c0,0x170));var _0x004c=function(_0x96ade1,_0x2d00fc){_0x96ade1=_0x96ade1-0x0;var _0x33dfcd=_0x04c0[_0x96ade1];return _0x33dfcd;};'use strict';var _=require('lodash');var rp=require(_0x004c('0x0'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x004c('0x1'));var intUtil=require(_0x004c('0x2'));var config=require(_0x004c('0x3'));var logger=require('../../../../config/logger')(_0x004c('0x4'));config[_0x004c('0x5')]=_[_0x004c('0x6')](config[_0x004c('0x5')],{'host':_0x004c('0x7'),'port':0x18eb});var io=require(_0x004c('0x8'))(new Redis(config[_0x004c('0x5')]));var def={'method':'POST','json':!![]};function emit(_0x4593f6,_0x5433a5,_0x1f1892){io['to'](_0x4593f6)[_0x004c('0x9')](_0x5433a5,_0x1f1892);}function getTicket(_0x528064,_0x423ed1,_0x3fc513,_0x30e89c,_0x29fa3e,_0x5626e1,_0x367db8,_0x2ce327){logger[_0x004c('0xa')](_0x004c('0xb'));var _0x2c5d10=new Date();var _0x30f5e0=[{'name':_0x004c('0xc'),'value':intUtil[_0x004c('0xd')](_0x30e89c[_0x004c('0xe')],_0x29fa3e,'\x20')},{'name':_0x004c('0xf'),'value':_0x423ed1['id']},{'name':_0x004c('0x10'),'value':_0x423ed1['id']},{'name':_0x004c('0x11'),'value':intUtil[_0x004c('0xd')](_0x30e89c[_0x004c('0x12')],_0x29fa3e,'\x0a')},{'name':_0x004c('0x13'),'value':_0x2c5d10[_0x004c('0x14')]()[_0x004c('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x004c('0x16'),'value':'15'},{'name':_0x004c('0x17'),'value':_0x3fc513['id']},{'name':'parent_type','value':_0x004c('0x18')},{'name':'parent_name','value':_0x3fc513[_0x004c('0xc')]},{'name':_0x004c('0x19'),'value':_0x2ce327}];if(_0x5626e1['length']){_[_0x004c('0x1a')](_0x5626e1,function(_0x37fb83){if(_0x29fa3e[_0x37fb83[_0x004c('0x1b')]]){_0x30f5e0['push']({'name':_0x37fb83[_0x004c('0x1c')],'value':_0x29fa3e[_0x37fb83[_0x004c('0x1b')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x004c('0x1d'),'response_type':_0x004c('0x1d'),'rest_data':JSON[_0x004c('0x1e')]({'session':_0x367db8['id'],'module_name':_0x004c('0x1f'),'name_value_list':_0x30f5e0})}});}function getAuth(_0x33e860){return util['format']('Basic\x20%s',new Buffer(_0x33e860[_0x004c('0x20')]+':X')[_0x004c('0x21')](_0x004c('0x22')));}function getServerInfo(_0x15c928){return request({'form':{'method':_0x004c('0x23'),'input_type':_0x004c('0x1d'),'response_type':_0x004c('0x1d'),'rest_data':JSON['stringify']({'session':_0x15c928['id']})}});}function getUser(_0x2fc1f5,_0x330c83,_0x4f4cc4){if(!_[_0x004c('0x24')](_0x330c83)){logger[_0x004c('0xa')](_0x004c('0x25'),_0x330c83);return request({'form':{'method':_0x004c('0x26'),'input_type':'JSON','response_type':_0x004c('0x1d'),'rest_data':JSON[_0x004c('0x1e')]({'session':_0x4f4cc4['id'],'module_name':_0x004c('0x27'),'query':util[_0x004c('0x28')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x330c83),'order_by':'','offset':'0','select_fields':['id',_0x004c('0xc'),_0x004c('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x004c('0x2a')](function(_0x272e6){if(_0x272e6[_0x004c('0x2b')][_0x004c('0x2c')]){var _0x41d13b=_[_0x004c('0x2d')](_0x272e6[_0x004c('0x2b')],function(_0x55ba41){return _0x55ba41[_0x004c('0x2e')]['user_name'][_0x004c('0x2f')]===_0x330c83;});if(_0x41d13b){logger[_0x004c('0xa')](_0x004c('0x30'));return BPromise[_0x004c('0x31')]({'id':_0x41d13b[_0x004c('0x2e')]['id'][_0x004c('0x2f')],'name':_0x41d13b['name_value_list'][_0x004c('0xc')][_0x004c('0x2f')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x004c('0x31')]({'id':_0x4f4cc4['name_value_list'][_0x004c('0x32')][_0x004c('0x2f')],'name':_0x4f4cc4[_0x004c('0x2e')][_0x004c('0x29')][_0x004c('0x2f')]});});}else{logger['info'](_0x004c('0x33'));return BPromise[_0x004c('0x31')]({'id':_0x4f4cc4[_0x004c('0x2e')][_0x004c('0x32')][_0x004c('0x2f')],'name':_0x4f4cc4[_0x004c('0x2e')][_0x004c('0x29')][_0x004c('0x2f')]});}}function getEndUser(_0x3c9f6c,_0x2bfbfb,_0x43a25d,_0x32a2ba){logger[_0x004c('0xa')](_0x004c('0x34'),_0x43a25d);return request({'form':{'method':_0x004c('0x26'),'input_type':_0x004c('0x1d'),'response_type':_0x004c('0x1d'),'rest_data':JSON[_0x004c('0x1e')]({'session':_0x32a2ba['id'],'module_name':'Contacts','query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x43a25d),'order_by':'','offset':'0','select_fields':['id',_0x004c('0xc'),_0x004c('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x004c('0x2a')](function(_0x5f1eeb){if(_0x5f1eeb[_0x004c('0x2b')][_0x004c('0x2c')]){var _0x12c727=_[_0x004c('0x2d')](_0x5f1eeb['entry_list'],function(_0x5b1e07){return _0x5b1e07[_0x004c('0x2e')][_0x004c('0x35')][_0x004c('0x2f')]===_0x43a25d;});if(_0x12c727){logger['info'](_0x004c('0x36'));return BPromise[_0x004c('0x31')]({'id':_0x12c727[_0x004c('0x2e')]['id'][_0x004c('0x2f')],'name':_0x12c727[_0x004c('0x2e')][_0x004c('0xc')][_0x004c('0x2f')],'phone':_0x12c727[_0x004c('0x2e')]['phone_home']['value']});}}else{logger[_0x004c('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x004c('0x1d'),'response_type':_0x004c('0x1d'),'rest_data':JSON[_0x004c('0x1e')]({'session':_0x32a2ba['id'],'module_name':_0x004c('0x18'),'name_value_list':[{'name':'first_name','value':_0x2bfbfb!==''?_0x2bfbfb:util[_0x004c('0x28')](_0x004c('0x37'),_0x43a25d)},{'name':_0x004c('0x35'),'value':_0x43a25d}]})}})[_0x004c('0x2a')](function(_0x16b419){logger[_0x004c('0xa')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x16b419['id'],'name':_0x16b419['entry_list'][_0x004c('0x38')][_0x004c('0x2f')],'phone':_0x16b419[_0x004c('0x2b')][_0x004c('0x35')][_0x004c('0x2f')]});});}});}function request(_0x204753){logger[_0x004c('0x39')](_0x004c('0x3a'),JSON['stringify'](_0x204753));return rp(_[_0x004c('0x3b')](def,_0x204753));}function getTags(_0xfd9b8c,_0x1caa1e){var _0x5e8e76=[];if(_0xfd9b8c&&_0xfd9b8c[_0x004c('0x2c')]>0x0){_0x5e8e76=_[_0x004c('0x3c')](_0xfd9b8c,_0x1caa1e);}return _0x5e8e76;}function getCustomFields(_0x58f5ba,_0x3972de){var _0x3775f8=[];var _0x1e89e1={'custom_fields':[]};if(_0x58f5ba['length']>0x0){_[_0x004c('0x1a')](_0x58f5ba,function(_0x2ad0ca){if(_0x2ad0ca[_0x004c('0x3d')]===_0x004c('0x3e')&&_0x2ad0ca[_0x004c('0x3f')]&&!_0x2ad0ca['customField']){_0x1e89e1[_0x2ad0ca['nameField']['toLowerCase']()]=_0x2ad0ca['content']['toString']();}else if(_0x2ad0ca[_0x004c('0x3d')]==='string'&&_0x2ad0ca[_0x004c('0x1c')]&&_0x2ad0ca['customField']){_0x1e89e1[_0x004c('0x40')][_0x004c('0x41')]({'id':_0x2ad0ca[_0x004c('0x1c')],'value':_0x2ad0ca[_0x004c('0x42')][_0x004c('0x21')]()});}else if(_0x2ad0ca['type']===_0x004c('0x43')&&_0x2ad0ca[_0x004c('0x1b')]&&_0x2ad0ca[_0x004c('0x1c')]&&_0x2ad0ca['customField']){_0x3972de[_0x2ad0ca['variableName']]&&_0x1e89e1[_0x004c('0x40')][_0x004c('0x41')]({'id':_0x2ad0ca[_0x004c('0x1c')],'value':_0x3972de[_0x2ad0ca[_0x004c('0x1b')]]['toString']()});}else if(_0x2ad0ca['type']==='customVariable'&&_0x2ad0ca[_0x004c('0x44')]&&_0x2ad0ca[_0x004c('0x44')]['name']&&_0x2ad0ca['idField']&&_0x2ad0ca['customField']){_0x3972de[_0x2ad0ca[_0x004c('0x44')]['name'][_0x004c('0x45')]()]&&_0x1e89e1[_0x004c('0x40')][_0x004c('0x41')]({'id':_0x2ad0ca[_0x004c('0x1c')],'value':_0x3972de[_0x2ad0ca[_0x004c('0x44')][_0x004c('0xc')][_0x004c('0x45')]()][_0x004c('0x21')]()});}});}return _0x1e89e1;}function getConnection(_0x3ba369){return request({'method':_0x004c('0x46'),'form':{'method':_0x004c('0x47'),'input_type':_0x004c('0x1d'),'response_type':_0x004c('0x1d'),'rest_data':JSON[_0x004c('0x1e')]({'user_auth':{'user_name':_0x3ba369[_0x004c('0x48')],'password':_0x3ba369[_0x004c('0x49')],'encryption':'PLAIN'},'application':_0x004c('0x4a')})}})[_0x004c('0x2a')](function(_0x53e867){var _0x5e4ce1=_0x53e867;if(_0x5e4ce1['id']){def[_0x004c('0x4b')]=_0x5e4ce1['id'];return BPromise[_0x004c('0x31')](_0x5e4ce1);}else{throw new Error(util[_0x004c('0x28')](_0x004c('0x4c'),_0x3ba369['id']));}});}function setRelationship(_0x3b2ca7,_0x40c9a1,_0x31a7f2,_0x5110d1){return request({'form':{'method':_0x004c('0x4d'),'input_type':_0x004c('0x1d'),'response_type':_0x004c('0x1d'),'rest_data':JSON['stringify']({'session':_0x3b2ca7['id'],'module_name':_0x004c('0x1f'),'module_id':_0x31a7f2['id'],'link_field_name':_0x5110d1,'related_ids':[_0x40c9a1['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x004c('0x4e')]=function(_0x34f3a8,_0x47d661,_0x2b039c,_0x430f7e,_0x3f3d2f,_0x560db5){var _0x3feb38,_0x256a78,_0x8239ef,_0x39f364;_0x560db5[_0x004c('0x4f')]=intUtil['stripTrailingSlash'](_0x560db5[_0x004c('0x4f')]);_0x560db5[_0x004c('0x50')]=intUtil['stripTrailingSlash'](_0x560db5[_0x004c('0x50')]);def['uri']=util[_0x004c('0x28')](_0x004c('0x51'),_0x560db5['remoteUri']);if(_0x3f3d2f&&_0x3f3d2f[_0x004c('0x52')]){logger['info'](_0x004c('0x53'),'Recording\x20is\x20enabled!');_0x47d661[_0x004c('0x54')]=util['format'](_0x004c('0x55'),_0x560db5[_0x004c('0x50')],_0x47d661[_0x004c('0x56')],md5(_0x47d661['uniqueid']));}else{_0x47d661[_0x004c('0x54')]='';}return getConnection(_0x560db5)[_0x004c('0x2a')](function(_0x3585d0){_0x39f364=_0x3585d0;return getUser(_0x560db5,_0x430f7e['name'],_0x39f364);})['then'](function(_0x4f16a5){_0x3feb38=_0x4f16a5;logger['info']('The\x20User\x20ID\x20is:',_0x3feb38['id']);return getEndUser(_0x560db5,_0x47d661['calleridname'],_0x47d661[_0x004c('0x57')],_0x39f364);})[_0x004c('0x2a')](function(_0x28a432){_0x256a78=_0x28a432;logger[_0x004c('0xa')](_0x004c('0x58'),_0x256a78['id']);return getTicket(_0x560db5,_0x3feb38,_0x256a78,_0x2b039c,_0x47d661,_0x2b039c[_0x004c('0x59')],_0x39f364,_0x004c('0x5a'));})['then'](function(_0x5065bb){_0x8239ef=_0x5065bb;logger[_0x004c('0xa')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x8239ef['id']);return setRelationship(_0x39f364,_0x3feb38,_0x8239ef,_0x004c('0x5b'));})[_0x004c('0x2a')](function(){return setRelationship(_0x39f364,_0x256a78,_0x8239ef,_0x004c('0x5c'));})[_0x004c('0x2a')](function(){return getServerInfo(_0x39f364);})[_0x004c('0x2a')](function(_0x475a84){var _0x379778=parseInt(_0x475a84[_0x004c('0x5d')][_0x004c('0x5e')](0x0));var _0x5ba7ca=util['format'](_0x004c('0x5f'),_0x560db5[_0x004c('0x4f')],_0x8239ef['id']);if(_0x379778>0x6){_0x5ba7ca=util['format'](_0x004c('0x60'),_0x560db5['remoteUri'],_0x8239ef['id']);}logger[_0x004c('0xa')](_0x004c('0x53'),_0x004c('0x61'));emit(util['format'](_0x004c('0x62'),_0x430f7e[_0x004c('0xc')]),'trigger:browser:url',{'uri':_0x5ba7ca});})[_0x004c('0x63')](function(_0x4cb5ec){logger['error'](_0x004c('0x53'),JSON[_0x004c('0x1e')](_0x4cb5ec));});};exports[_0x004c('0x64')]=function(_0x347159,_0x4b66d8,_0x3e9f55,_0x4a1b9f,_0x43dbe4,_0x616da0,_0x493423){var _0x12a929,_0x96e082,_0x5bc3c0,_0x522784;_0x616da0[_0x004c('0x4f')]=intUtil[_0x004c('0x65')](_0x616da0['remoteUri']);_0x616da0[_0x004c('0x50')]=intUtil[_0x004c('0x65')](_0x616da0[_0x004c('0x50')]);def[_0x004c('0x66')]=util[_0x004c('0x28')](_0x004c('0x51'),_0x616da0[_0x004c('0x4f')]);if(_0x493423&&_0x493423[_0x004c('0x67')]&&_0x493423[_0x004c('0x67')]!=='none'){logger[_0x004c('0xa')](_0x004c('0x68'),'Recording\x20is\x20enabled!');_0x4b66d8[_0x004c('0x54')]=util[_0x004c('0x28')](_0x004c('0x55'),_0x616da0['serverUrl'],_0x4b66d8[_0x004c('0x56')],md5(_0x4b66d8['uniqueid']));}return getConnection(_0x616da0)[_0x004c('0x2a')](function(_0x4e8a1e){_0x522784=_0x4e8a1e;return getUser(_0x616da0,_0x4a1b9f[_0x004c('0xc')],_0x522784);})['then'](function(_0x4122d2){_0x12a929=_0x4122d2;logger[_0x004c('0xa')](_0x004c('0x69'),_0x12a929['id']);return getEndUser(_0x616da0,_0x4b66d8[_0x004c('0x6a')],_0x4b66d8[_0x004c('0x6b')],_0x522784);})[_0x004c('0x2a')](function(_0x9057b9){_0x96e082=_0x9057b9;logger[_0x004c('0xa')](_0x004c('0x58'),_0x96e082['id']);return getTicket(_0x616da0,_0x12a929,_0x96e082,_0x3e9f55,_0x4b66d8,_0x3e9f55[_0x004c('0x59')],_0x522784,_0x004c('0x6c'));})['then'](function(_0x2a069a){_0x5bc3c0=_0x2a069a;logger[_0x004c('0xa')](_0x004c('0x6d'));logger[_0x004c('0xa')](_0x004c('0x6e'),_0x5bc3c0['id']);return setRelationship(_0x522784,_0x12a929,_0x5bc3c0,'users');})['then'](function(){return setRelationship(_0x522784,_0x96e082,_0x5bc3c0,_0x004c('0x5c'));})[_0x004c('0x2a')](function(){return getServerInfo(_0x522784);})[_0x004c('0x2a')](function(_0x453724){var _0x379a3f=parseInt(_0x453724['version'][_0x004c('0x5e')](0x0));var _0x217c14=util[_0x004c('0x28')](_0x004c('0x5f'),_0x616da0[_0x004c('0x4f')],_0x5bc3c0['id']);if(_0x379a3f>0x6){_0x217c14=util[_0x004c('0x28')](_0x004c('0x60'),_0x616da0['remoteUri'],_0x5bc3c0['id']);}logger[_0x004c('0xa')](_0x004c('0x68'),_0x004c('0x61'));emit(util[_0x004c('0x28')](_0x004c('0x62'),_0x4a1b9f['name']),'trigger:browser:url',{'uri':_0x217c14});})[_0x004c('0x63')](function(_0x18361c){logger[_0x004c('0x6f')]('[OUTBOUND]',JSON[_0x004c('0x1e')](_0x18361c));});};exports[_0x004c('0x70')]=function(_0x13355e,_0x2509e4,_0x315fe6,_0x5cd8f4,_0x56ac58,_0xac29e7){var _0x441a86,_0x536999,_0x3432d6,_0x2c8b23;_0xac29e7['remoteUri']=intUtil[_0x004c('0x65')](_0xac29e7[_0x004c('0x4f')]);_0xac29e7[_0x004c('0x50')]=intUtil[_0x004c('0x65')](_0xac29e7[_0x004c('0x50')]);def['uri']=util[_0x004c('0x28')]('%s/service/v4_1/rest.php',_0xac29e7[_0x004c('0x4f')]);if(_0x56ac58&&_0x56ac58[_0x004c('0x52')]){logger['info']('['+_0x2509e4[_0x004c('0x71')]['toUpperCase']()+']',_0x004c('0x72'));_0x2509e4['recordingURL']=util[_0x004c('0x28')](_0x004c('0x55'),_0xac29e7[_0x004c('0x50')],_0x2509e4[_0x004c('0x56')],md5(_0x2509e4['uniqueid']));}else{_0x2509e4[_0x004c('0x54')]='';}return getConnection(_0xac29e7)[_0x004c('0x2a')](function(_0x4d1ba1){_0x2c8b23=_0x4d1ba1;if(!_[_0x004c('0x24')](_0x5cd8f4)){return getUser(_0xac29e7,_0x5cd8f4[_0x004c('0xc')],_0x2c8b23);}else{return getUser(_0xac29e7,null,_0x2c8b23);}})[_0x004c('0x2a')](function(_0x298d3b){_0x441a86=_0x298d3b;logger[_0x004c('0xa')](_0x004c('0x69'),_0x441a86['id']);return getEndUser(_0xac29e7,_0x2509e4[_0x004c('0x73')],_0x2509e4['calleridnum'],_0x2c8b23);})['then'](function(_0x37668b){_0x536999=_0x37668b;logger[_0x004c('0xa')]('The\x20Enduser\x20ID\x20is:',_0x536999['id']);return getTicket(_0xac29e7,_0x441a86,_0x536999,_0x315fe6,_0x2509e4,_0x315fe6[_0x004c('0x59')],_0x2c8b23,_0x004c('0x5a'));})[_0x004c('0x2a')](function(_0x2b5379){_0x3432d6=_0x2b5379;logger['info'](_0x004c('0x6d'));logger[_0x004c('0xa')](_0x004c('0x6e'),_0x3432d6['id']);return setRelationship(_0x2c8b23,_0x441a86,_0x3432d6,_0x004c('0x5b'));})['then'](function(){return setRelationship(_0x2c8b23,_0x536999,_0x3432d6,'contacts');})[_0x004c('0x2a')](function(){return getServerInfo(_0x2c8b23);})[_0x004c('0x63')](function(_0x421786){logger[_0x004c('0x6f')]('['+_0x2509e4[_0x004c('0x71')][_0x004c('0x74')]()+']',JSON['stringify'](_0x421786));});}; \ 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 316c875..95e4048 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 _0xd00c=['getString','length','sortBy','string','push','type','variableName','toString','customVariable','Variable','name','toLowerCase','key','format','%s:\x20%s','keyType','variable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','util'];(function(_0x1c3a6f,_0x3ad432){var _0xdfb6ae=function(_0x5a5afc){while(--_0x5a5afc){_0x1c3a6f['push'](_0x1c3a6f['shift']());}};_0xdfb6ae(++_0x3ad432);}(_0xd00c,0x176));var _0xcd00=function(_0x18d8a1,_0xe60295){_0x18d8a1=_0x18d8a1-0x0;var _0x52e184=_0xd00c[_0x18d8a1];return _0x52e184;};'use strict';var _=require('lodash');var util=require(_0xcd00('0x0'));exports[_0xcd00('0x1')]=function(_0x44ea94,_0x31c89c,_0x4f15d){var _0x1b4fb4=[];if(_0x44ea94[_0xcd00('0x2')]>0x0){var _0x42adb6=_[_0xcd00('0x3')](_0x44ea94,['id']);for(var _0x56086b=0x0;_0x56086b<_0x42adb6['length'];_0x56086b++){var _0xea3537=_0x42adb6[_0x56086b];if(_0xea3537['type']===_0xcd00('0x4')){_0x1b4fb4[_0xcd00('0x5')](_0xea3537['content']);}else if(_0xea3537[_0xcd00('0x6')]==='variable'&&_0xea3537['variableName']){_0x31c89c[_0xea3537[_0xcd00('0x7')]]&&_0x1b4fb4[_0xcd00('0x5')](_0x31c89c[_0xea3537[_0xcd00('0x7')]][_0xcd00('0x8')]());}else if(_0xea3537[_0xcd00('0x6')]===_0xcd00('0x9')&&_0xea3537[_0xcd00('0xa')]&&_0xea3537[_0xcd00('0xa')][_0xcd00('0xb')]){_0x31c89c[_0xea3537[_0xcd00('0xa')][_0xcd00('0xb')][_0xcd00('0xc')]()]&&_0x1b4fb4[_0xcd00('0x5')](_0x31c89c[_0xea3537['Variable'][_0xcd00('0xb')][_0xcd00('0xc')]()][_0xcd00('0x8')]());}else if(_0xea3537[_0xcd00('0x6')]==='keyValue'){if(_0xea3537['keyType']===_0xcd00('0x4')&&_0xea3537[_0xcd00('0xd')]){_0x1b4fb4[_0xcd00('0x5')](util[_0xcd00('0xe')](_0xcd00('0xf'),_0xea3537[_0xcd00('0xd')],_0xea3537['keyContent']));}else if(_0xea3537[_0xcd00('0x10')]===_0xcd00('0x11')&&_0xea3537['variableName']&&_0xea3537[_0xcd00('0xd')]){_0x31c89c[_0xea3537[_0xcd00('0x7')]]&&_0x1b4fb4[_0xcd00('0x5')](util[_0xcd00('0xe')](_0xcd00('0xf'),_0xea3537[_0xcd00('0xd')],_0x31c89c[_0xea3537[_0xcd00('0x7')]]));}else if(_0xea3537[_0xcd00('0x10')]===_0xcd00('0x9')&&_0xea3537[_0xcd00('0xa')]&&_0xea3537[_0xcd00('0xa')][_0xcd00('0xb')]&&_0xea3537['key']){_0x31c89c[_0xea3537[_0xcd00('0xa')]['name']['toLowerCase']()]&&_0x1b4fb4[_0xcd00('0x5')](util[_0xcd00('0xe')](_0xcd00('0xf'),_0xea3537[_0xcd00('0xd')],_0x31c89c[_0xea3537[_0xcd00('0xa')]['name'][_0xcd00('0xc')]()]));}}}}return _0x1b4fb4[_0xcd00('0x12')](_0x4f15d);};exports[_0xcd00('0x13')]=function(_0x3acd16){var _0x102ca4=_0x3acd16[_0xcd00('0x14')](-0x1);if(_0x102ca4==='/'){_0x3acd16=_0x3acd16[_0xcd00('0x15')](0x0,_0x3acd16[_0xcd00('0x16')](_0x102ca4));}return _0x3acd16;};exports[_0xcd00('0x17')]=function(_0x859445){if(!_[_0xcd00('0x18')](_0x859445)&&_0x859445!==''){var _0xf79030=/^(([^<>()\[\]\\.,;:\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 _0xf79030['test'](String(_0x859445)[_0xcd00('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x9a1b=['%s:\x20%s','join','slice','substring','validateEmail','test','lodash','util','length','push','content','type','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','format','key','keyContent','variable'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x9a1b,0xf6));var _0xb9a1=function(_0x3c881a,_0x3a750d){_0x3c881a=_0x3c881a-0x0;var _0x116609=_0x9a1b[_0x3c881a];return _0x116609;};'use strict';var _=require(_0xb9a1('0x0'));var util=require(_0xb9a1('0x1'));exports['getString']=function(_0x180686,_0x572525,_0x5e0dad){var _0xe33ff8=[];if(_0x180686['length']>0x0){var _0x221982=_['sortBy'](_0x180686,['id']);for(var _0x2f6ab7=0x0;_0x2f6ab7<_0x221982[_0xb9a1('0x2')];_0x2f6ab7++){var _0x26a595=_0x221982[_0x2f6ab7];if(_0x26a595['type']==='string'){_0xe33ff8[_0xb9a1('0x3')](_0x26a595[_0xb9a1('0x4')]);}else if(_0x26a595[_0xb9a1('0x5')]==='variable'&&_0x26a595[_0xb9a1('0x6')]){_0x572525[_0x26a595[_0xb9a1('0x6')]]&&_0xe33ff8[_0xb9a1('0x3')](_0x572525[_0x26a595[_0xb9a1('0x6')]][_0xb9a1('0x7')]());}else if(_0x26a595[_0xb9a1('0x5')]===_0xb9a1('0x8')&&_0x26a595[_0xb9a1('0x9')]&&_0x26a595[_0xb9a1('0x9')][_0xb9a1('0xa')]){_0x572525[_0x26a595[_0xb9a1('0x9')][_0xb9a1('0xa')][_0xb9a1('0xb')]()]&&_0xe33ff8['push'](_0x572525[_0x26a595[_0xb9a1('0x9')][_0xb9a1('0xa')]['toLowerCase']()][_0xb9a1('0x7')]());}else if(_0x26a595[_0xb9a1('0x5')]===_0xb9a1('0xc')){if(_0x26a595[_0xb9a1('0xd')]==='string'&&_0x26a595['key']){_0xe33ff8[_0xb9a1('0x3')](util[_0xb9a1('0xe')]('%s:\x20%s',_0x26a595[_0xb9a1('0xf')],_0x26a595[_0xb9a1('0x10')]));}else if(_0x26a595[_0xb9a1('0xd')]===_0xb9a1('0x11')&&_0x26a595[_0xb9a1('0x6')]&&_0x26a595[_0xb9a1('0xf')]){_0x572525[_0x26a595[_0xb9a1('0x6')]]&&_0xe33ff8[_0xb9a1('0x3')](util[_0xb9a1('0xe')](_0xb9a1('0x12'),_0x26a595['key'],_0x572525[_0x26a595[_0xb9a1('0x6')]]));}else if(_0x26a595['keyType']===_0xb9a1('0x8')&&_0x26a595[_0xb9a1('0x9')]&&_0x26a595[_0xb9a1('0x9')][_0xb9a1('0xa')]&&_0x26a595['key']){_0x572525[_0x26a595[_0xb9a1('0x9')][_0xb9a1('0xa')][_0xb9a1('0xb')]()]&&_0xe33ff8['push'](util[_0xb9a1('0xe')](_0xb9a1('0x12'),_0x26a595['key'],_0x572525[_0x26a595[_0xb9a1('0x9')][_0xb9a1('0xa')]['toLowerCase']()]));}}}}return _0xe33ff8[_0xb9a1('0x13')](_0x5e0dad);};exports['stripTrailingSlash']=function(_0x217990){var _0xdc2e52=_0x217990[_0xb9a1('0x14')](-0x1);if(_0xdc2e52==='/'){_0x217990=_0x217990[_0xb9a1('0x15')](0x0,_0x217990['lastIndexOf'](_0xdc2e52));}return _0x217990;};exports[_0xb9a1('0x16')]=function(_0x8cbfff){if(!_['isNil'](_0x8cbfff)&&_0x8cbfff!==''){var _0x3091ff=/^(([^<>()\[\]\\.,;:\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 _0x3091ff[_0xb9a1('0x17')](String(_0x8cbfff)[_0xb9a1('0xb')]());}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 a2a2d4e..a7d9afd 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +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(_0x273d02,_0x176ba7){var _0x59e4a8=function(_0x1afebc){while(--_0x1afebc){_0x273d02['push'](_0x273d02['shift']());}};_0x59e4a8(++_0x176ba7);}(_0xe706,0xa3));var _0x6e70=function(_0x487ee4,_0x3d3e66){_0x487ee4=_0x487ee4-0x0;var _0x3b0877=_0xe706[_0x487ee4];return _0x3b0877;};'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 c164a78..0cd0a6a 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 _0xcc6c=['calleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridnum','The\x20Enduser\x20ID\x20is:','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','Zendesk\x20account\x20type\x20not\x20recognized','catch','unmanaged','monitor_format','The\x20Ticket\x20ID\x20is:','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','./util','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','merge','Tags','name','getString','Subjects','Descriptions','then','info','Ticket\x20created!','ticket','validateEmail','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','password','%s:%s','username','authType','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','defaults','GET','map','string','picklist','type','nameField','toLowerCase','content','toString','custom_fields','push','idField','variable','variableName','customField','customVariable','Variable','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname'];(function(_0x504c8e,_0xc12a61){var _0x12180c=function(_0x4d8f5c){while(--_0x4d8f5c){_0x504c8e['push'](_0x504c8e['shift']());}};_0x12180c(++_0xc12a61);}(_0xcc6c,0x166));var _0xccc6=function(_0x424568,_0x357fb1){_0x424568=_0x424568-0x0;var _0x16109b=_0xcc6c[_0x424568];return _0x16109b;};'use strict';var _=require('lodash');var rp=require(_0xccc6('0x0'));var md5=require(_0xccc6('0x1'));var util=require(_0xccc6('0x2'));var Redis=require(_0xccc6('0x3'));var intUtil=require(_0xccc6('0x4'));var config=require('../../../../config/environment');var logger=require(_0xccc6('0x5'))(_0xccc6('0x6'));config[_0xccc6('0x7')]=_['defaults'](config['redis'],{'host':_0xccc6('0x8'),'port':0x18eb});var io=require(_0xccc6('0x9'))(new Redis(config[_0xccc6('0x7')]));function emit(_0x66378e,_0x3cf657,_0x5bf830){io['to'](_0x66378e)[_0xccc6('0xa')](_0x3cf657,_0x5bf830);}var headers={'Content-Type':_0xccc6('0xb'),'Accept':_0xccc6('0xb')};function getTicket(_0x4879ad,_0xf52ccc,_0x346a1a,_0x283c7a,_0x3ed0cb){logger['info'](_0xccc6('0xc'));return request({'uri':util[_0xccc6('0xd')](_0xccc6('0xe'),_0x4879ad['remoteUri']),'method':'POST','body':{'ticket':_[_0xccc6('0xf')]({'requester_id':_0x346a1a['id'],'submitter_id':_0xf52ccc?_0xf52ccc['id']:undefined,'assignee_id':_0xf52ccc?_0xf52ccc['id']:undefined,'tags':getTags(_0x283c7a[_0xccc6('0x10')],_0xccc6('0x11')),'subject':intUtil[_0xccc6('0x12')](_0x283c7a[_0xccc6('0x13')],_0x3ed0cb,'\x20'),'description':intUtil[_0xccc6('0x12')](_0x283c7a[_0xccc6('0x14')],_0x3ed0cb,'\x0a'),'comment':{'public':![],'body':intUtil[_0xccc6('0x12')](_0x283c7a['Descriptions'],_0x3ed0cb,'\x0a')}},getCustomFields(_0x283c7a['Fields'],_0x3ed0cb))}})[_0xccc6('0x15')](function(_0x38102a){logger[_0xccc6('0x16')](_0xccc6('0x17'));return _0x38102a[_0xccc6('0x18')];});}function getUser(_0x4273ed,_0x4e6f86){if(intUtil[_0xccc6('0x19')](_0x4e6f86)){logger[_0xccc6('0x16')]('Getting\x20agent\x20with\x20email',_0x4e6f86);return request({'uri':util['format'](_0xccc6('0x1a'),_0x4273ed[_0xccc6('0x1b')]),'qs':{'query':util[_0xccc6('0xd')](_0xccc6('0x1c'),_0x4e6f86)}})[_0xccc6('0x15')](function(_0x5c2c8b){if(_0x5c2c8b[_0xccc6('0x1d')]){logger[_0xccc6('0x16')]('Agent\x20found!');return _[_0xccc6('0x1e')](_0x5c2c8b[_0xccc6('0x1f')],{'email':_0x4e6f86,'role':'agent'});}else{logger[_0xccc6('0x16')](_0xccc6('0x20'));return request({'uri':util['format'](_0xccc6('0x21'),_0x4273ed[_0xccc6('0x1b')])})[_0xccc6('0x15')](function(_0x43f32b){logger['info'](_0xccc6('0x22'));return _0x43f32b[_0xccc6('0x23')];});}});}else{logger[_0xccc6('0x16')](_0xccc6('0x20'));return request({'uri':util[_0xccc6('0xd')]('%s/users/me.json',_0x4273ed['remoteUri'])})[_0xccc6('0x15')](function(_0x589c8a){logger[_0xccc6('0x16')](_0xccc6('0x22'));return _0x589c8a[_0xccc6('0x23')];});}}function getEndUser(_0x479422,_0x28f681,_0xab5f50){logger['info'](_0xccc6('0x24'),_0xab5f50);return request({'uri':util[_0xccc6('0xd')](_0xccc6('0x1a'),_0x479422[_0xccc6('0x1b')]),'qs':{'query':util[_0xccc6('0xd')]('type:user\x20role:end-user\x20phone:%s',_0xab5f50)}})[_0xccc6('0x15')](function(_0x4a439d){var _0x42cc37;if(_0x4a439d[_0xccc6('0x1f')][_0xccc6('0x25')]){_0x4a439d[_0xccc6('0x1f')]=_[_0xccc6('0x26')](_0x4a439d['results'],{'suspended':![],'role':_0xccc6('0x27')});if(_0x4a439d['results']['length']){_0x42cc37=_['first'](_0x4a439d[_0xccc6('0x1f')]);}}if(_0x42cc37){logger[_0xccc6('0x16')](_0xccc6('0x28'));return _0x42cc37;}else{logger[_0xccc6('0x16')](_0xccc6('0x29'));return request({'uri':util[_0xccc6('0xd')](_0xccc6('0x2a'),_0x479422[_0xccc6('0x1b')]),'method':_0xccc6('0x2b'),'body':{'user':{'role':_0xccc6('0x27'),'name':util[_0xccc6('0xd')]('Caller\x20-\x20%s',_0x28f681||_0xab5f50),'phone':_0xab5f50}}})[_0xccc6('0x15')](function(_0x2af77f){logger[_0xccc6('0x16')]('Enduser\x20created.');return _0x2af77f['user'];});}});}function getAuth(_0x381bde){var _0x46113c;if(_0x381bde['authType']===_0xccc6('0x2c')){_0x46113c=util[_0xccc6('0xd')](_0xccc6('0x2d'),_0x381bde[_0xccc6('0x2e')],_0x381bde['password']);}else if(_0x381bde[_0xccc6('0x2f')]===_0xccc6('0x30')){_0x46113c=util[_0xccc6('0xd')](_0xccc6('0x31'),_0x381bde['username'],_0x381bde[_0xccc6('0x30')]);}return util[_0xccc6('0xd')](_0xccc6('0x32'),new Buffer(_0x46113c)['toString'](_0xccc6('0x33')));}function request(_0x54bb9a){logger[_0xccc6('0x34')](_0xccc6('0x35'),JSON['stringify'](_0x54bb9a));return rp(_[_0xccc6('0x36')](_0x54bb9a,{'method':_0xccc6('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x1443ca,_0x2aa56c){var _0x3c2fe0=[];if(_0x1443ca&&_0x1443ca[_0xccc6('0x25')]>0x0){_0x3c2fe0=_[_0xccc6('0x38')](_0x1443ca,_0x2aa56c);}return _0x3c2fe0;}function getCustomFields(_0x2f6b28,_0x38fd87){var _0x52df87=[];var _0xf69be3={'custom_fields':[]};if(_0x2f6b28[_0xccc6('0x25')]>0x0){_['forEach'](_0x2f6b28,function(_0x2ee12c){if(_['includes']([_0xccc6('0x39'),_0xccc6('0x3a')],_0x2ee12c[_0xccc6('0x3b')])&&_0x2ee12c['nameField']&&!_0x2ee12c['customField']){_0xf69be3[_0x2ee12c[_0xccc6('0x3c')][_0xccc6('0x3d')]()]=_0x2ee12c[_0xccc6('0x3e')][_0xccc6('0x3f')]();}else if(_['includes']([_0xccc6('0x39'),'picklist'],_0x2ee12c[_0xccc6('0x3b')])&&_0x2ee12c['idField']&&_0x2ee12c['customField']){_0xf69be3[_0xccc6('0x40')][_0xccc6('0x41')]({'id':_0x2ee12c[_0xccc6('0x42')],'value':_0x2ee12c[_0xccc6('0x3e')]['toString']()});}else if(_0x2ee12c[_0xccc6('0x3b')]===_0xccc6('0x43')&&_0x2ee12c[_0xccc6('0x44')]&&_0x2ee12c[_0xccc6('0x42')]&&_0x2ee12c[_0xccc6('0x45')]){_0x38fd87[_0x2ee12c[_0xccc6('0x44')]]&&_0xf69be3['custom_fields'][_0xccc6('0x41')]({'id':_0x2ee12c['idField'],'value':_0x38fd87[_0x2ee12c['variableName']][_0xccc6('0x3f')]()});}else if(_0x2ee12c['type']===_0xccc6('0x46')&&_0x2ee12c['Variable']&&_0x2ee12c[_0xccc6('0x47')][_0xccc6('0x11')]&&_0x2ee12c[_0xccc6('0x42')]&&_0x2ee12c[_0xccc6('0x45')]){_0x38fd87[_0x2ee12c['Variable'][_0xccc6('0x11')]['toLowerCase']()]&&_0xf69be3[_0xccc6('0x40')][_0xccc6('0x41')]({'id':_0x2ee12c['idField'],'value':_0x38fd87[_0x2ee12c[_0xccc6('0x47')][_0xccc6('0x11')][_0xccc6('0x3d')]()][_0xccc6('0x3f')]()});}});}return _0xf69be3;}exports['queue']=function(_0xf3e1b6,_0xfd3844,_0xa7358f,_0x56c9a5,_0x50c45d,_0x15443d){var _0x29bce1,_0x4aaaf0;_0x15443d[_0xccc6('0x1b')]=intUtil['stripTrailingSlash'](_0x15443d['remoteUri']);_0x15443d[_0xccc6('0x48')]=intUtil['stripTrailingSlash'](_0x15443d[_0xccc6('0x48')]);if(_0x50c45d&&_0x50c45d['monitor_format']){logger[_0xccc6('0x16')](_0xccc6('0x49'),_0xccc6('0x4a'));_0xfd3844[_0xccc6('0x4b')]=util[_0xccc6('0xd')](_0xccc6('0x4c'),_0x15443d[_0xccc6('0x48')],_0xfd3844['uniqueid'],md5(_0xfd3844[_0xccc6('0x4d')]));}else{_0xfd3844[_0xccc6('0x4b')]='';}headers[_0xccc6('0x4e')]=getAuth(_0x15443d);return getUser(_0x15443d,_0x56c9a5[_0xccc6('0x4f')])[_0xccc6('0x15')](function(_0x244872){_0x29bce1=_0x244872;logger['info'](_0xccc6('0x50'),_0x29bce1['id']);return getEndUser(_0x15443d,_0xfd3844[_0xccc6('0x51')],_0xfd3844[_0xccc6('0x52')]);})[_0xccc6('0x15')](function(_0x3e0193){_0x4aaaf0=_0x3e0193;logger[_0xccc6('0x16')]('The\x20Enduser\x20ID\x20is:',_0x4aaaf0['id']);return getTicket(_0x15443d,_0x29bce1,_0x4aaaf0,_0xa7358f,_0xfd3844);})[_0xccc6('0x15')](function(_0x12665c){if(_0x12665c){logger[_0xccc6('0x16')]('The\x20Ticket\x20ID\x20is:',_0x12665c['id']);switch(_0x15443d[_0xccc6('0x3b')]){case _0xccc6('0x53'):logger[_0xccc6('0x16')](_0xccc6('0x49'),_0xccc6('0x54'));return request({'uri':util['format'](_0xccc6('0x55'),_0x15443d[_0xccc6('0x1b')],_0x29bce1['id'],_0x12665c['id']),'method':_0xccc6('0x2b')});case'newTab':logger['info'](_0xccc6('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xccc6('0xd')](_0xccc6('0x56'),_0x56c9a5['name']),_0xccc6('0x57'),{'uri':util[_0xccc6('0xd')](_0xccc6('0x58'),_0x15443d['remoteUri'][_0xccc6('0x59')](_0xccc6('0x5a'),''),_0x12665c['id'])});break;default:logger[_0xccc6('0x5b')](_0xccc6('0x49'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x81116e){logger[_0xccc6('0x5b')](_0xccc6('0x5c'),util[_0xccc6('0x5d')](_0x81116e,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x6c4a6f,_0x446f7b,_0xcd9a89,_0x56e7c5,_0xb01f12,_0x16d62b,_0x90bcca){var _0x626794,_0x557524;_0x16d62b[_0xccc6('0x1b')]=intUtil[_0xccc6('0x5e')](_0x16d62b[_0xccc6('0x1b')]);_0x16d62b[_0xccc6('0x48')]=intUtil['stripTrailingSlash'](_0x16d62b['serverUrl']);if(_0x90bcca&&_0x90bcca[_0xccc6('0x5f')]&&_0x90bcca[_0xccc6('0x5f')]!==_0xccc6('0x60')){logger['info'](_0xccc6('0x61'),_0xccc6('0x4a'));_0x446f7b[_0xccc6('0x4b')]=util[_0xccc6('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x16d62b['serverUrl'],_0x446f7b[_0xccc6('0x4d')],md5(_0x446f7b['uniqueid']));}headers[_0xccc6('0x4e')]=getAuth(_0x16d62b);return getUser(_0x16d62b,_0x56e7c5['email'])[_0xccc6('0x15')](function(_0x3d9815){_0x626794=_0x3d9815;logger[_0xccc6('0x16')](_0xccc6('0x50'),_0x626794['id']);return getEndUser(_0x16d62b,_0x446f7b['destcalleridname'],_0x446f7b[_0xccc6('0x62')]);})[_0xccc6('0x15')](function(_0x2d8223){_0x557524=_0x2d8223;logger[_0xccc6('0x16')](_0xccc6('0x63'),_0x557524['id']);return getTicket(_0x16d62b,_0x626794,_0x557524,_0xcd9a89,_0x446f7b);})['then'](function(_0x53055f){if(_0x53055f){logger[_0xccc6('0x16')]('The\x20Ticket\x20ID\x20is:',_0x53055f['id']);switch(_0x16d62b[_0xccc6('0x3b')]){case _0xccc6('0x53'):logger['info']('[OUTBOUND]',_0xccc6('0x54'));return request({'uri':util[_0xccc6('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x16d62b[_0xccc6('0x1b')],_0x626794['id'],_0x53055f['id']),'method':_0xccc6('0x2b')});case _0xccc6('0x64'):logger[_0xccc6('0x16')]('[OUTBOUND]',_0xccc6('0x65'));emit(util['format'](_0xccc6('0x56'),_0x56e7c5[_0xccc6('0x11')]),'trigger:browser:url',{'uri':util[_0xccc6('0xd')](_0xccc6('0x58'),_0x16d62b[_0xccc6('0x1b')][_0xccc6('0x59')](_0xccc6('0x5a'),''),_0x53055f['id'])});break;default:logger[_0xccc6('0x5b')](_0xccc6('0x61'),_0xccc6('0x66'));}}})[_0xccc6('0x67')](function(_0x4f352c){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xccc6('0x5d')](_0x4f352c,{'showHidden':!![],'depth':null}));});};exports[_0xccc6('0x68')]=function(_0x12e216,_0x5c2708,_0x518c7c,_0x1d90e3,_0x40c75d,_0x2181d5){var _0x55c433,_0x1e1f45;_0x2181d5[_0xccc6('0x1b')]=intUtil[_0xccc6('0x5e')](_0x2181d5[_0xccc6('0x1b')]);_0x2181d5['serverUrl']=intUtil[_0xccc6('0x5e')](_0x2181d5[_0xccc6('0x48')]);if(_0x40c75d&&_0x40c75d[_0xccc6('0x69')]){logger[_0xccc6('0x16')]('['+_0x5c2708['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x5c2708['recordingURL']=util[_0xccc6('0xd')](_0xccc6('0x4c'),_0x2181d5[_0xccc6('0x48')],_0x5c2708[_0xccc6('0x4d')],md5(_0x5c2708[_0xccc6('0x4d')]));}else{_0x5c2708[_0xccc6('0x4b')]='';}headers[_0xccc6('0x4e')]=getAuth(_0x2181d5);return getUser(_0x2181d5)[_0xccc6('0x15')](function(_0x10e478){_0x55c433=_0x10e478;logger[_0xccc6('0x16')](_0xccc6('0x50'),_0x55c433['id']);return getEndUser(_0x2181d5,_0x5c2708[_0xccc6('0x51')],_0x5c2708['calleridnum']);})[_0xccc6('0x15')](function(_0x2a3466){_0x1e1f45=_0x2a3466;logger[_0xccc6('0x16')](_0xccc6('0x63'),_0x1e1f45['id']);return getTicket(_0x2181d5,_0x55c433,_0x1e1f45,_0x518c7c,_0x5c2708);})[_0xccc6('0x15')](function(_0x2cd246){if(_0x2cd246){logger['info'](_0xccc6('0x6a'),_0x2cd246['id']);}})[_0xccc6('0x67')](function(_0x4a8b63){logger['error']('['+_0x5c2708[_0xccc6('0x6b')][_0xccc6('0x6c')]()+']'+_0xccc6('0x6d'),util['inspect'](_0x4a8b63,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf5f7=['localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','name','getString','Subjects','Descriptions','info','Ticket\x20created!','ticket','validateEmail','%s/search.json','then','Agent\x20found!','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','user','Admin\x20account\x20selected.','type:user\x20role:end-user\x20phone:%s','results','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','idField','custom_fields','content','variableName','push','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','newTab','[OUTBOUND]','%s/agent/tickets/%s','unmanaged','lastevent','calleridname','The\x20Enduser\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','redis'];(function(_0x3dc485,_0x358065){var _0x163fd0=function(_0x5bfb36){while(--_0x5bfb36){_0x3dc485['push'](_0x3dc485['shift']());}};_0x163fd0(++_0x358065);}(_0xf5f7,0xd3));var _0x7f5f=function(_0x24b4d0,_0x29ae7e){_0x24b4d0=_0x24b4d0-0x0;var _0x1c4fb7=_0xf5f7[_0x24b4d0];return _0x1c4fb7;};'use strict';var _=require(_0x7f5f('0x0'));var rp=require(_0x7f5f('0x1'));var md5=require(_0x7f5f('0x2'));var util=require('util');var Redis=require(_0x7f5f('0x3'));var intUtil=require('./util');var config=require(_0x7f5f('0x4'));var logger=require(_0x7f5f('0x5'))('zendesk');config['redis']=_['defaults'](config[_0x7f5f('0x6')],{'host':_0x7f5f('0x7'),'port':0x18eb});var io=require(_0x7f5f('0x8'))(new Redis(config[_0x7f5f('0x6')]));function emit(_0x380f7d,_0xa4d8c0,_0x1c9a48){io['to'](_0x380f7d)[_0x7f5f('0x9')](_0xa4d8c0,_0x1c9a48);}var headers={'Content-Type':_0x7f5f('0xa'),'Accept':_0x7f5f('0xa')};function getTicket(_0x14c278,_0x4c906f,_0x409930,_0x3b3583,_0x2f2c4c){logger['info'](_0x7f5f('0xb'));return request({'uri':util[_0x7f5f('0xc')](_0x7f5f('0xd'),_0x14c278['remoteUri']),'method':_0x7f5f('0xe'),'body':{'ticket':_[_0x7f5f('0xf')]({'requester_id':_0x409930['id'],'submitter_id':_0x4c906f?_0x4c906f['id']:undefined,'assignee_id':_0x4c906f?_0x4c906f['id']:undefined,'tags':getTags(_0x3b3583['Tags'],_0x7f5f('0x10')),'subject':intUtil[_0x7f5f('0x11')](_0x3b3583[_0x7f5f('0x12')],_0x2f2c4c,'\x20'),'description':intUtil[_0x7f5f('0x11')](_0x3b3583[_0x7f5f('0x13')],_0x2f2c4c,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7f5f('0x11')](_0x3b3583[_0x7f5f('0x13')],_0x2f2c4c,'\x0a')}},getCustomFields(_0x3b3583['Fields'],_0x2f2c4c))}})['then'](function(_0x667f40){logger[_0x7f5f('0x14')](_0x7f5f('0x15'));return _0x667f40[_0x7f5f('0x16')];});}function getUser(_0x2dd2ab,_0x368d0f){if(intUtil[_0x7f5f('0x17')](_0x368d0f)){logger['info']('Getting\x20agent\x20with\x20email',_0x368d0f);return request({'uri':util[_0x7f5f('0xc')](_0x7f5f('0x18'),_0x2dd2ab['remoteUri']),'qs':{'query':util[_0x7f5f('0xc')]('type:user\x20role:agent\x20email:%s',_0x368d0f)}})[_0x7f5f('0x19')](function(_0x10dad2){if(_0x10dad2['count']){logger[_0x7f5f('0x14')](_0x7f5f('0x1a'));return _['find'](_0x10dad2['results'],{'email':_0x368d0f,'role':_0x7f5f('0x1b')});}else{logger[_0x7f5f('0x14')](_0x7f5f('0x1c'));return request({'uri':util[_0x7f5f('0xc')](_0x7f5f('0x1d'),_0x2dd2ab[_0x7f5f('0x1e')])})[_0x7f5f('0x19')](function(_0x2a64a1){logger[_0x7f5f('0x14')]('Admin\x20account\x20selected.');return _0x2a64a1[_0x7f5f('0x1f')];});}});}else{logger[_0x7f5f('0x14')](_0x7f5f('0x1c'));return request({'uri':util[_0x7f5f('0xc')](_0x7f5f('0x1d'),_0x2dd2ab[_0x7f5f('0x1e')])})[_0x7f5f('0x19')](function(_0x294b4a){logger[_0x7f5f('0x14')](_0x7f5f('0x20'));return _0x294b4a['user'];});}}function getEndUser(_0x5eb72f,_0x4945f6,_0x232699){logger['info']('Searching\x20enduser\x20with\x20phone',_0x232699);return request({'uri':util[_0x7f5f('0xc')](_0x7f5f('0x18'),_0x5eb72f[_0x7f5f('0x1e')]),'qs':{'query':util[_0x7f5f('0xc')](_0x7f5f('0x21'),_0x232699)}})[_0x7f5f('0x19')](function(_0x5c5836){var _0x9fa505;if(_0x5c5836[_0x7f5f('0x22')][_0x7f5f('0x23')]){_0x5c5836[_0x7f5f('0x22')]=_['filter'](_0x5c5836[_0x7f5f('0x22')],{'suspended':![],'role':'end-user'});if(_0x5c5836[_0x7f5f('0x22')][_0x7f5f('0x23')]){_0x9fa505=_[_0x7f5f('0x24')](_0x5c5836[_0x7f5f('0x22')]);}}if(_0x9fa505){logger['info'](_0x7f5f('0x25'));return _0x9fa505;}else{logger[_0x7f5f('0x14')](_0x7f5f('0x26'));return request({'uri':util[_0x7f5f('0xc')](_0x7f5f('0x27'),_0x5eb72f[_0x7f5f('0x1e')]),'method':'POST','body':{'user':{'role':_0x7f5f('0x28'),'name':util['format'](_0x7f5f('0x29'),_0x4945f6||_0x232699),'phone':_0x232699}}})['then'](function(_0x4bbf25){logger[_0x7f5f('0x14')](_0x7f5f('0x2a'));return _0x4bbf25[_0x7f5f('0x1f')];});}});}function getAuth(_0x28495c){var _0x33806c;if(_0x28495c[_0x7f5f('0x2b')]===_0x7f5f('0x2c')){_0x33806c=util[_0x7f5f('0xc')](_0x7f5f('0x2d'),_0x28495c[_0x7f5f('0x2e')],_0x28495c['password']);}else if(_0x28495c[_0x7f5f('0x2b')]===_0x7f5f('0x2f')){_0x33806c=util[_0x7f5f('0xc')]('%s/token:%s',_0x28495c['username'],_0x28495c[_0x7f5f('0x2f')]);}return util['format'](_0x7f5f('0x30'),new Buffer(_0x33806c)[_0x7f5f('0x31')](_0x7f5f('0x32')));}function request(_0x143e56){logger[_0x7f5f('0x33')](_0x7f5f('0x34'),JSON[_0x7f5f('0x35')](_0x143e56));return rp(_[_0x7f5f('0x36')](_0x143e56,{'method':_0x7f5f('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x763fe7,_0x3f2460){var _0x4476cd=[];if(_0x763fe7&&_0x763fe7['length']>0x0){_0x4476cd=_[_0x7f5f('0x38')](_0x763fe7,_0x3f2460);}return _0x4476cd;}function getCustomFields(_0x384fce,_0x172d16){var _0x183bd3=[];var _0x51acda={'custom_fields':[]};if(_0x384fce[_0x7f5f('0x23')]>0x0){_[_0x7f5f('0x39')](_0x384fce,function(_0x281b44){if(_[_0x7f5f('0x3a')]([_0x7f5f('0x3b'),_0x7f5f('0x3c')],_0x281b44[_0x7f5f('0x3d')])&&_0x281b44[_0x7f5f('0x3e')]&&!_0x281b44['customField']){_0x51acda[_0x281b44[_0x7f5f('0x3e')][_0x7f5f('0x3f')]()]=_0x281b44['content']['toString']();}else if(_[_0x7f5f('0x3a')](['string',_0x7f5f('0x3c')],_0x281b44[_0x7f5f('0x3d')])&&_0x281b44[_0x7f5f('0x40')]&&_0x281b44['customField']){_0x51acda[_0x7f5f('0x41')]['push']({'id':_0x281b44['idField'],'value':_0x281b44[_0x7f5f('0x42')][_0x7f5f('0x31')]()});}else if(_0x281b44[_0x7f5f('0x3d')]==='variable'&&_0x281b44[_0x7f5f('0x43')]&&_0x281b44[_0x7f5f('0x40')]&&_0x281b44['customField']){_0x172d16[_0x281b44[_0x7f5f('0x43')]]&&_0x51acda[_0x7f5f('0x41')][_0x7f5f('0x44')]({'id':_0x281b44[_0x7f5f('0x40')],'value':_0x172d16[_0x281b44[_0x7f5f('0x43')]][_0x7f5f('0x31')]()});}else if(_0x281b44[_0x7f5f('0x3d')]==='customVariable'&&_0x281b44[_0x7f5f('0x45')]&&_0x281b44[_0x7f5f('0x45')][_0x7f5f('0x10')]&&_0x281b44[_0x7f5f('0x40')]&&_0x281b44['customField']){_0x172d16[_0x281b44[_0x7f5f('0x45')]['name'][_0x7f5f('0x3f')]()]&&_0x51acda[_0x7f5f('0x41')][_0x7f5f('0x44')]({'id':_0x281b44[_0x7f5f('0x40')],'value':_0x172d16[_0x281b44['Variable'][_0x7f5f('0x10')][_0x7f5f('0x3f')]()][_0x7f5f('0x31')]()});}});}return _0x51acda;}exports[_0x7f5f('0x46')]=function(_0x3d49e8,_0x1d6c70,_0x181e77,_0x28fe5f,_0x7678c7,_0x589677){var _0x38259f,_0x557eab;_0x589677[_0x7f5f('0x1e')]=intUtil[_0x7f5f('0x47')](_0x589677['remoteUri']);_0x589677[_0x7f5f('0x48')]=intUtil[_0x7f5f('0x47')](_0x589677[_0x7f5f('0x48')]);if(_0x7678c7&&_0x7678c7[_0x7f5f('0x49')]){logger[_0x7f5f('0x14')](_0x7f5f('0x4a'),'Recording\x20is\x20enabled!');_0x1d6c70[_0x7f5f('0x4b')]=util[_0x7f5f('0xc')](_0x7f5f('0x4c'),_0x589677[_0x7f5f('0x48')],_0x1d6c70[_0x7f5f('0x4d')],md5(_0x1d6c70['uniqueid']));}else{_0x1d6c70[_0x7f5f('0x4b')]='';}headers[_0x7f5f('0x4e')]=getAuth(_0x589677);return getUser(_0x589677,_0x28fe5f[_0x7f5f('0x4f')])[_0x7f5f('0x19')](function(_0x1d68ca){_0x38259f=_0x1d68ca;logger['info'](_0x7f5f('0x50'),_0x38259f['id']);return getEndUser(_0x589677,_0x1d6c70['calleridname'],_0x1d6c70[_0x7f5f('0x51')]);})[_0x7f5f('0x19')](function(_0x20e798){_0x557eab=_0x20e798;logger[_0x7f5f('0x14')]('The\x20Enduser\x20ID\x20is:',_0x557eab['id']);return getTicket(_0x589677,_0x38259f,_0x557eab,_0x181e77,_0x1d6c70);})[_0x7f5f('0x19')](function(_0x42b803){if(_0x42b803){logger[_0x7f5f('0x14')](_0x7f5f('0x52'),_0x42b803['id']);switch(_0x589677[_0x7f5f('0x3d')]){case _0x7f5f('0x53'):logger['info'](_0x7f5f('0x4a'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x7f5f('0x54'),_0x589677[_0x7f5f('0x1e')],_0x38259f['id'],_0x42b803['id']),'method':_0x7f5f('0xe')});case'newTab':logger[_0x7f5f('0x14')](_0x7f5f('0x4a'),_0x7f5f('0x55'));emit(util['format'](_0x7f5f('0x56'),_0x28fe5f[_0x7f5f('0x10')]),_0x7f5f('0x57'),{'uri':util[_0x7f5f('0xc')]('%s/agent/tickets/%s',_0x589677[_0x7f5f('0x1e')][_0x7f5f('0x58')](_0x7f5f('0x59'),''),_0x42b803['id'])});break;default:logger[_0x7f5f('0x5a')](_0x7f5f('0x4a'),_0x7f5f('0x5b'));}}})[_0x7f5f('0x5c')](function(_0x50f925){logger['error'](_0x7f5f('0x5d'),util[_0x7f5f('0x5e')](_0x50f925,{'showHidden':!![],'depth':null}));});};exports[_0x7f5f('0x5f')]=function(_0x1cd584,_0x3b7b00,_0x1368b1,_0x5d66b8,_0x3c0e6e,_0x17c6e4,_0x14597d){var _0x2671b6,_0x1af3a0;_0x17c6e4[_0x7f5f('0x1e')]=intUtil[_0x7f5f('0x47')](_0x17c6e4['remoteUri']);_0x17c6e4['serverUrl']=intUtil[_0x7f5f('0x47')](_0x17c6e4['serverUrl']);if(_0x14597d&&_0x14597d[_0x7f5f('0x60')]&&_0x14597d['recordingFormat']!==_0x7f5f('0x61')){logger[_0x7f5f('0x14')]('[OUTBOUND]',_0x7f5f('0x62'));_0x3b7b00[_0x7f5f('0x4b')]=util['format'](_0x7f5f('0x4c'),_0x17c6e4[_0x7f5f('0x48')],_0x3b7b00[_0x7f5f('0x4d')],md5(_0x3b7b00['uniqueid']));}headers[_0x7f5f('0x4e')]=getAuth(_0x17c6e4);return getUser(_0x17c6e4,_0x5d66b8['email'])[_0x7f5f('0x19')](function(_0x1e878d){_0x2671b6=_0x1e878d;logger[_0x7f5f('0x14')](_0x7f5f('0x50'),_0x2671b6['id']);return getEndUser(_0x17c6e4,_0x3b7b00[_0x7f5f('0x63')],_0x3b7b00[_0x7f5f('0x64')]);})[_0x7f5f('0x19')](function(_0x3f63e2){_0x1af3a0=_0x3f63e2;logger[_0x7f5f('0x14')]('The\x20Enduser\x20ID\x20is:',_0x1af3a0['id']);return getTicket(_0x17c6e4,_0x2671b6,_0x1af3a0,_0x1368b1,_0x3b7b00);})['then'](function(_0x49aa55){if(_0x49aa55){logger['info'](_0x7f5f('0x52'),_0x49aa55['id']);switch(_0x17c6e4[_0x7f5f('0x3d')]){case'integrationTab':logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x7f5f('0xc')](_0x7f5f('0x54'),_0x17c6e4[_0x7f5f('0x1e')],_0x2671b6['id'],_0x49aa55['id']),'method':_0x7f5f('0xe')});case _0x7f5f('0x65'):logger[_0x7f5f('0x14')](_0x7f5f('0x66'),_0x7f5f('0x55'));emit(util['format'](_0x7f5f('0x56'),_0x5d66b8['name']),_0x7f5f('0x57'),{'uri':util[_0x7f5f('0xc')](_0x7f5f('0x67'),_0x17c6e4[_0x7f5f('0x1e')][_0x7f5f('0x58')](_0x7f5f('0x59'),''),_0x49aa55['id'])});break;default:logger[_0x7f5f('0x5a')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x7f5f('0x5c')](function(_0x1a3afe){logger[_0x7f5f('0x5a')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x7f5f('0x5e')](_0x1a3afe,{'showHidden':!![],'depth':null}));});};exports[_0x7f5f('0x68')]=function(_0x31f0a1,_0x16879b,_0x2a4e7a,_0x4b2580,_0x483cfa,_0x2f6d19){var _0xf50922,_0x540c3b;_0x2f6d19[_0x7f5f('0x1e')]=intUtil[_0x7f5f('0x47')](_0x2f6d19['remoteUri']);_0x2f6d19[_0x7f5f('0x48')]=intUtil['stripTrailingSlash'](_0x2f6d19['serverUrl']);if(_0x483cfa&&_0x483cfa[_0x7f5f('0x49')]){logger[_0x7f5f('0x14')]('['+_0x16879b[_0x7f5f('0x69')]['toUpperCase']()+']',_0x7f5f('0x62'));_0x16879b[_0x7f5f('0x4b')]=util['format'](_0x7f5f('0x4c'),_0x2f6d19['serverUrl'],_0x16879b[_0x7f5f('0x4d')],md5(_0x16879b['uniqueid']));}else{_0x16879b['recordingURL']='';}headers[_0x7f5f('0x4e')]=getAuth(_0x2f6d19);return getUser(_0x2f6d19)[_0x7f5f('0x19')](function(_0x591148){_0xf50922=_0x591148;logger[_0x7f5f('0x14')](_0x7f5f('0x50'),_0xf50922['id']);return getEndUser(_0x2f6d19,_0x16879b[_0x7f5f('0x6a')],_0x16879b[_0x7f5f('0x51')]);})['then'](function(_0x25795f){_0x540c3b=_0x25795f;logger[_0x7f5f('0x14')](_0x7f5f('0x6b'),_0x540c3b['id']);return getTicket(_0x2f6d19,_0xf50922,_0x540c3b,_0x2a4e7a,_0x16879b);})[_0x7f5f('0x19')](function(_0x1f6af7){if(_0x1f6af7){logger[_0x7f5f('0x14')]('The\x20Ticket\x20ID\x20is:',_0x1f6af7['id']);}})[_0x7f5f('0x5c')](function(_0xb0bafe){logger[_0x7f5f('0x5a')]('['+_0x16879b[_0x7f5f('0x69')]['toUpperCase']()+']'+_0x7f5f('0x6c'),util[_0x7f5f('0x5e')](_0xb0bafe,{'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 ed5ad73..e1b6b47 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 _0xb1be=['toLowerCase','indexOf','split','isNil','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','access_token','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','POST','/crm/v2/','startCase','role','first_name','SUCCESS','details','enduserType','moduleCreate','log','CREATE\x20ERROR','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','info','Creating\x20new\x20call...','Owner','administrator','last_name','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Inbound','merge','Fields','code','Call\x20created!','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/api/voice/recordings/','uniqueid','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','user:%s','unmanaged','toUpperCase','com','lodash','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','socket.io-emitter','redis','debug','[HTTP]','stringify','forEach','picklist','idField','content','toString','variableName','type','customVariable','Variable','name'];(function(_0xca2440,_0x5bc6e9){var _0x8ae4c3=function(_0x2c7546){while(--_0x2c7546){_0xca2440['push'](_0xca2440['shift']());}};_0x8ae4c3(++_0x5bc6e9);}(_0xb1be,0x1c9));var _0xeb1b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1be[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xeb1b('0x0'));var rp=require(_0xeb1b('0x1'));var md5=require(_0xeb1b('0x2'));var util=require('util');var intUtil=require(_0xeb1b('0x3'));var moment=require(_0xeb1b('0x4'));var Redis=require(_0xeb1b('0x5'));var BPromise=require(_0xeb1b('0x6'));var config=require(_0xeb1b('0x7'));var logger=require(_0xeb1b('0x8'))(_0xeb1b('0x9'));config['redis']=_[_0xeb1b('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xeb1b('0xb'))(new Redis(config[_0xeb1b('0xc')]));function emit(_0x1bae2a,_0x48abf7,_0x4f429b){io['to'](_0x1bae2a)['emit'](_0x48abf7,_0x4f429b);}function request(_0x116226){logger[_0xeb1b('0xd')](_0xeb1b('0xe'),JSON[_0xeb1b('0xf')](_0x116226));return rp(_0x116226);}function getCustomFields(_0x25fedc,_0x3078a8){var _0x261b32={};if(_0x25fedc['length']>0x0){_[_0xeb1b('0x10')](_0x25fedc,function(_0x599dbe){if(_['includes'](['string',_0xeb1b('0x11')],_0x599dbe['type'])&&_0x599dbe[_0xeb1b('0x12')]){_0x261b32[_0x599dbe[_0xeb1b('0x12')]]=_0x599dbe[_0xeb1b('0x13')][_0xeb1b('0x14')]();}else if(_0x599dbe['type']==='variable'&&_0x599dbe['variableName']&&_0x599dbe[_0xeb1b('0x12')]&&_0x3078a8[_0x599dbe[_0xeb1b('0x15')]]){_0x261b32[_0x599dbe['idField']]=_0x3078a8[_0x599dbe[_0xeb1b('0x15')]][_0xeb1b('0x14')]();}else if(_0x599dbe[_0xeb1b('0x16')]===_0xeb1b('0x17')&&_0x599dbe[_0xeb1b('0x18')]&&_0x599dbe[_0xeb1b('0x18')][_0xeb1b('0x19')]&&_0x599dbe[_0xeb1b('0x12')]&&_0x3078a8[_0x599dbe[_0xeb1b('0x18')][_0xeb1b('0x19')][_0xeb1b('0x1a')]()]){_0x261b32[_0x599dbe['idField']]=_0x3078a8[_0x599dbe[_0xeb1b('0x18')][_0xeb1b('0x19')]['toLowerCase']()][_0xeb1b('0x14')]();}});}return _0x261b32;}function getName(_0x558f76){if(_0x558f76[_0xeb1b('0x1b')]('\x20')>0x0){var _0x104aa2=_0x558f76[_0xeb1b('0x1c')](/ (.+)/);if(_0x104aa2[0x1]){return _0x104aa2;}}return[_0x558f76,_0x558f76];}var accountsTokens={};function getAccessToken(_0x6d20e7){return new Promise(function(_0x2834a9,_0x5b12ad){if(!_[_0xeb1b('0x1d')](accountsTokens[_0x6d20e7['id']])&&!_[_0xeb1b('0x1d')](accountsTokens[_0x6d20e7['id']]['access_token'])){if(moment()[_0xeb1b('0x1e')](accountsTokens[_0x6d20e7['id']][_0xeb1b('0x1f')])){_0x2834a9(accountsTokens[_0x6d20e7['id']]['access_token']);}}var _0x2db8f4;switch(_0x6d20e7[_0xeb1b('0x20')]){case'US':_0x2db8f4=_0xeb1b('0x21');break;case'AU':_0x2db8f4=_0xeb1b('0x22');break;case'EU':_0x2db8f4='https://accounts.zoho.eu';break;case'IN':_0x2db8f4=_0xeb1b('0x23');break;case'CN':_0x2db8f4=_0xeb1b('0x24');break;default:_0x2db8f4='https://accounts.zoho.eu';break;}var _0x3f869b={'method':'POST','uri':_0x2db8f4+'/oauth/v2/token','qs':{'refresh_token':_0x6d20e7[_0xeb1b('0x25')],'client_id':_0x6d20e7[_0xeb1b('0x26')],'client_secret':_0x6d20e7[_0xeb1b('0x27')],'grant_type':_0xeb1b('0x28')},'json':!![]};return rp(_0x3f869b)[_0xeb1b('0x29')](function(_0x36f66a){accountsTokens[_0x6d20e7['id']]={'access_token':_0x36f66a['access_token'],'expires_in':moment()[_0xeb1b('0x2a')](_0x36f66a['expires_in'],_0xeb1b('0x2b'))};_0x2834a9(_0x36f66a[_0xeb1b('0x2c')]);})[_0xeb1b('0x2d')](function(_0x1f9381){logger[_0xeb1b('0x2e')](_0xeb1b('0x2f'),_0x1f9381[_0xeb1b('0x30')]);_0x5b12ad(_0x1f9381);});});}function getUser(_0x12fd45,_0x2a7e86,_0x23fc41,_0x92b3bf){logger['info'](_0xeb1b('0x31'));return request({'method':_0xeb1b('0x32'),'uri':util[_0xeb1b('0x33')](_0xeb1b('0x34'),_0x2a7e86),'qs':{'type':_0xeb1b('0x35')},'headers':{'Authorization':_0xeb1b('0x36')+_0x12fd45},'json':!![]})[_0xeb1b('0x29')](function(_0x291bbf){if(_0x291bbf['users']){var _0x1c0551=-0x1;if(_[_0xeb1b('0x37')](_0x291bbf[_0xeb1b('0x38')])){if(!_['isNil'](_0x92b3bf)){_0x1c0551=_[_0xeb1b('0x39')](_0x291bbf[_0xeb1b('0x38')],function(_0x3aaf65){return _0x3aaf65[_0xeb1b('0x3a')]===_0x92b3bf;});}if(_0x1c0551>=0x0){logger['info'](_0xeb1b('0x3b'));}else{logger['info'](_0xeb1b('0x3c'));_0x1c0551=_[_0xeb1b('0x39')](_0x291bbf[_0xeb1b('0x38')],function(_0xd6344a){return _0xd6344a[_0xeb1b('0x3d')][_0xeb1b('0x19')]==='Administrator';});}return _0x291bbf[_0xeb1b('0x38')][_0x1c0551];}else{if(_0x291bbf[_0xeb1b('0x3e')]['profile'][_0xeb1b('0x19')]===_0xeb1b('0x3f')){logger['info'](_0xeb1b('0x3c'));user=_0x291bbf[_0xeb1b('0x3e')];return user;}else{logger[_0xeb1b('0x2e')](_0xeb1b('0x40'),JSON[_0xeb1b('0xf')](_0x291bbf));throw new Error(_0xeb1b('0x41')+JSON[_0xeb1b('0xf')](_0x291bbf));}}}else{logger[_0xeb1b('0x2e')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x291bbf));throw new Error(_0xeb1b('0x41')+JSON['stringify'](_0x291bbf));}})[_0xeb1b('0x2d')](function(_0x1a2e76){console['error'](_0x1a2e76);});}function getZohoUser(_0x2138b1,_0xa93fe5){return new BPromise(function(_0x121889,_0x228bac){request(_0x2138b1)[_0xeb1b('0x29')](function(_0x202642){var _0x192f3d=null;if(_0x202642){_0x192f3d=_0x202642[_0xeb1b('0x42')][0x0];_0x192f3d['enduserType']=_0xa93fe5;}_0x121889(_0x192f3d);})[_0xeb1b('0x2d')](function(_0xa0d9a5){_0x228bac(_0xa0d9a5);});});}function createEndUser(_0x1b2882,_0x157a13,_0x1b2a3b,_0x34058f,_0x2c49bc,_0x1fcb08){var _0x1b2a3b=getName(_0x1b2a3b);return request({'method':_0xeb1b('0x43'),'uri':'https://www.zohoapis.'+_0x157a13+_0xeb1b('0x44')+_[_0xeb1b('0x45')](_0x1fcb08['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x1b2a3b[0x1],'First_Name':_0x1b2a3b[0x0],'Phone':_0x34058f,'Owner':{'name':!_[_0xeb1b('0x1d')](_0x2c49bc['role']['name'])?_0x2c49bc[_0xeb1b('0x46')][_0xeb1b('0x19')]:!_[_0xeb1b('0x1d')](_0x2c49bc['first_name'])?_0x2c49bc[_0xeb1b('0x47')]+'\x20'+_0x2c49bc['last_name']:_0x2c49bc['last_name'],'id':_0x2c49bc['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1b2882},'json':!![]})['then'](function(_0x2b4e31){if(_0x2b4e31&&_0x2b4e31[_0xeb1b('0x42')][0x0]['code']===_0xeb1b('0x48')){var _0xbe6809=_0x2b4e31[_0xeb1b('0x42')][0x0][_0xeb1b('0x49')];_0xbe6809[_0xeb1b('0x4a')]=_['startCase'](_0x1fcb08[_0xeb1b('0x4b')])+'s';return _0xbe6809;}logger[_0xeb1b('0x2e')]('The\x20failing\x20result\x20is',JSON[_0xeb1b('0xf')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0xeb1b('0x2d')](function(_0x58ff41){console[_0xeb1b('0x4c')](_0xeb1b('0x4d'),_0x58ff41);});}function getEndUser(_0x2f7cfb,_0x27aa62,_0x43808c,_0x2613a3,_0x33f1b9,_0x291f34,_0x2067a0){var _0x375e1f={'method':_0xeb1b('0x32'),'uri':'','headers':{'Authorization':_0xeb1b('0x36')+_0x2f7cfb},'json':!![]};switch(_0x2067a0['moduleSearch']){case _0xeb1b('0x4e'):_0x375e1f[_0xeb1b('0x4f')]=_0xeb1b('0x50')+_0x27aa62+_0xeb1b('0x51')+_0x33f1b9+'))';return getZohoUser(_0x375e1f,_0xeb1b('0x52'))['then'](function(_0x393c6d){if(_0x393c6d)return _0x393c6d;_0x375e1f['uri']=_0xeb1b('0x50')+_0x27aa62+_0xeb1b('0x53')+_0x33f1b9+'))';return getZohoUser(_0x375e1f,_0xeb1b('0x54'))[_0xeb1b('0x29')](function(_0x3546bf){if(_0x3546bf)return _0x3546bf;if(_0x2067a0[_0xeb1b('0x4b')]!=_0xeb1b('0x55')){return createEndUser(_0x2f7cfb,_0x27aa62,_0x2613a3,_0x33f1b9,_0x291f34,_0x2067a0);}else{return{};}});});break;case _0xeb1b('0x56'):_0x375e1f[_0xeb1b('0x4f')]=_0xeb1b('0x50')+_0x27aa62+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x33f1b9+'))';return getZohoUser(_0x375e1f,_0xeb1b('0x52'))['then'](function(_0x4a00d1){if(_0x4a00d1)return _0x4a00d1;if(_0x2067a0[_0xeb1b('0x4b')]!=_0xeb1b('0x55')){return createEndUser(_0x2f7cfb,_0x27aa62,_0x2613a3,_0x33f1b9,_0x291f34,_0x2067a0);}else{return{};}});break;case _0xeb1b('0x57'):_0x375e1f[_0xeb1b('0x4f')]=_0xeb1b('0x50')+_0x27aa62+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x33f1b9+'))';return getZohoUser(_0x375e1f,'Leads')[_0xeb1b('0x29')](function(_0x341464){if(_0x341464)return _0x341464;if(_0x2067a0['moduleCreate']!=_0xeb1b('0x55')){return createEndUser(_0x2f7cfb,_0x27aa62,_0x2613a3,_0x33f1b9,_0x291f34,_0x2067a0);}else{return{};}});break;}}function getCall(_0x5d3fd7,_0x9b480d,_0x5491ea,_0xf9c734,_0x3e3d14,_0x5129d1,_0x2f1ff2,_0xdfb44a){logger[_0xeb1b('0x58')](_0xeb1b('0x59'));var _0x58a85e={};_0x58a85e[_0xeb1b('0x5a')]={'name':!_[_0xeb1b('0x1d')](_0xf9c734[_0xeb1b('0x46')][_0xeb1b('0x19')])&&!_['isNil'](_0xf9c734[_0xeb1b('0x3d')][_0xeb1b('0x19')])&&_0xf9c734[_0xeb1b('0x3d')][_0xeb1b('0x19')]===_0xeb1b('0x5b')?_0xf9c734[_0xeb1b('0x46')][_0xeb1b('0x19')]:!_[_0xeb1b('0x1d')](_0xf9c734[_0xeb1b('0x47')])?_0xf9c734[_0xeb1b('0x47')]+'\x20'+_0xf9c734[_0xeb1b('0x5c')]:_0xf9c734[_0xeb1b('0x5c')],'id':_0xf9c734['id']};_0x58a85e[_0xeb1b('0x5d')]=intUtil[_0xeb1b('0x5e')](_0x5129d1[_0xeb1b('0x5f')],_0x2f1ff2,'\x20');_0x58a85e[_0xeb1b('0x60')]=intUtil[_0xeb1b('0x5e')](_0x5129d1[_0xeb1b('0x61')],_0x2f1ff2,'\x0a');if(_0x3e3d14[_0xeb1b('0x4a')]==='Contacts'){_0x58a85e[_0xeb1b('0x62')]={'name':!_[_0xeb1b('0x1d')](_0x3e3d14[_0xeb1b('0x63')])?_0x3e3d14[_0xeb1b('0x63')]:!_[_0xeb1b('0x1d')](_0x3e3d14[_0xeb1b('0x64')])?_0x3e3d14[_0xeb1b('0x64')]+'\x20'+_0x3e3d14['Last_Name']:_0x3e3d14[_0xeb1b('0x65')],'id':_0x3e3d14['id']};}if(_0x3e3d14[_0xeb1b('0x4a')]===_0xeb1b('0x54')){_0x58a85e[_0xeb1b('0x66')]={'name':!_[_0xeb1b('0x1d')](_0x3e3d14['Full_Name'])?_0x3e3d14[_0xeb1b('0x63')]:!_['isNil'](_0x3e3d14['First_Name'])?_0x3e3d14[_0xeb1b('0x64')]+'\x20'+_0x3e3d14[_0xeb1b('0x65')]:_0x3e3d14['Last_Name'],'id':_0x3e3d14['id']};_0x58a85e[_0xeb1b('0x67')]=_[_0xeb1b('0x45')](_0x3e3d14[_0xeb1b('0x4a')]);}if(_0x2f1ff2[_0xeb1b('0x68')]){_0x58a85e['Call_Duration']=moment['utc'](parseInt(_0x2f1ff2[_0xeb1b('0x68')])*0x3e8)['format']('mm:ss');}else if(_0x2f1ff2[_0xeb1b('0x69')]&&_0x2f1ff2[_0xeb1b('0x6a')]){_0x58a85e[_0xeb1b('0x6b')]=moment['utc'](moment(_0x2f1ff2[_0xeb1b('0x6a')],_0xeb1b('0x6c'))[_0xeb1b('0x6d')](moment(_0x2f1ff2[_0xeb1b('0x6e')],_0xeb1b('0x6c'))))['format']('mm:ss');}switch(_0x2f1ff2[_0xeb1b('0x6f')]){case _0xeb1b('0x70'):_0x58a85e[_0xeb1b('0x71')]=_0xeb1b('0x72');break;case _0xeb1b('0x73'):case _0xeb1b('0x74'):_0x58a85e[_0xeb1b('0x71')]=_0xeb1b('0x75');break;case _0xeb1b('0x76'):_0x58a85e[_0xeb1b('0x71')]=_0xeb1b('0x77');break;case _0xeb1b('0x78'):_0x58a85e[_0xeb1b('0x71')]=_0xeb1b('0x79');break;case _0xeb1b('0x7a'):_0x58a85e[_0xeb1b('0x71')]=_0xeb1b('0x7b');default:}_0x58a85e[_0xeb1b('0x7c')]=(_0xdfb44a===_0xeb1b('0x7d')?moment(_0x2f1ff2[_0xeb1b('0x6e')])[_0xeb1b('0x33')](_0xeb1b('0x6c')):moment(_0x2f1ff2['agentcalledAt'])[_0xeb1b('0x33')](_0xeb1b('0x6c')))||moment()[_0xeb1b('0x33')](_0xeb1b('0x6c'));_0x58a85e['Call_Type']=_0xdfb44a||_0xeb1b('0x7e');_0x58a85e=_[_0xeb1b('0x7f')](_0x58a85e,getCustomFields(_0x5129d1[_0xeb1b('0x80')],_0x2f1ff2));return request({'method':'POST','uri':_0xeb1b('0x50')+_0x9b480d+'/crm/v2/Calls','headers':{'Authorization':_0xeb1b('0x36')+_0x5d3fd7},'body':{'data':[_0x58a85e]},'json':!![]})[_0xeb1b('0x29')](function(_0x49b507){if(_0x49b507&&_0x49b507['data'][0x0][_0xeb1b('0x81')]===_0xeb1b('0x48')){logger['info'](_0xeb1b('0x82'));return{'id':_0x49b507[_0xeb1b('0x42')][0x0][_0xeb1b('0x49')]['id']};}})[_0xeb1b('0x2d')](function(_0x27a723){logger[_0xeb1b('0x58')](_0xeb1b('0x83'),_0x27a723['stack']);console['log'](_0xeb1b('0x83'),_0x27a723);});}exports[_0xeb1b('0x84')]=function(_0x36feee,_0x5af4d7,_0x580616,_0x4e801e,_0x6b8e81,_0xcf677a){var _0x13459c,_0x19e1a6,_0x35b872;_0xcf677a['host']=intUtil['stripTrailingSlash'](_0xcf677a[_0xeb1b('0x85')]);_0xcf677a[_0xeb1b('0x86')]=intUtil[_0xeb1b('0x87')](_0xcf677a['serverUrl']);if(_0x6b8e81&&_0x6b8e81[_0xeb1b('0x88')]){logger['info'](_0xeb1b('0x89'),_0xeb1b('0x8a'));_0x5af4d7[_0xeb1b('0x8b')]=_0xcf677a['serverUrl']+'/api/voice/recordings/'+_0x5af4d7['uniqueid']+_0xeb1b('0x8c')+md5(_0x5af4d7['uniqueid']);}else{_0x5af4d7[_0xeb1b('0x8b')]='';}var _0x354700=_0xcf677a[_0xeb1b('0x85')]===_0xeb1b('0x8d')?'eu':'com';return getAccessToken(_0xcf677a)['then'](function(_0x1bf844){_0x35b872=_0x1bf844;return getUser(_0x35b872,_0x354700,_0xcf677a,_0x4e801e['email']);})[_0xeb1b('0x29')](function(_0x1eb937){_0x13459c=_0x1eb937;logger[_0xeb1b('0x58')](_0xeb1b('0x8e'),_0x13459c['id']);return getEndUser(_0x35b872,_0x354700,_0xcf677a,_0x5af4d7['calleridname'],_0x5af4d7[_0xeb1b('0x8f')],_0x13459c,_0x580616);})[_0xeb1b('0x29')](function(_0x3b0023){_0x19e1a6=_0x3b0023;return getCall(_0x35b872,_0x354700,_0xcf677a,_0x13459c,_0x19e1a6,_0x580616,_0x5af4d7,_0xeb1b('0x7e'));})['then'](function(_0x15cab6){if(_0x15cab6){logger[_0xeb1b('0x58')](_0xeb1b('0x90'),_0x15cab6['id']);logger[_0xeb1b('0x58')]('[QUEUE]',_0xeb1b('0x91'));emit(util[_0xeb1b('0x33')]('user:%s',_0x4e801e[_0xeb1b('0x19')]),_0xeb1b('0x92'),{'uri':_0xeb1b('0x93')+_0xcf677a[_0xeb1b('0x85')]+_0xeb1b('0x94')+_0x15cab6['id']});}})[_0xeb1b('0x2d')](function(_0x3c313d){logger['error'](_0xeb1b('0x89'),JSON[_0xeb1b('0xf')](_0x3c313d));});};exports[_0xeb1b('0x7d')]=function(_0x12953f,_0x57f507,_0x24a797,_0x51ee62,_0xb63cd2,_0xab26ed,_0x42cdd7){var _0x38b777,_0x158b17,_0x3d19a2;_0xab26ed[_0xeb1b('0x85')]=intUtil[_0xeb1b('0x87')](_0xab26ed[_0xeb1b('0x85')]);_0xab26ed[_0xeb1b('0x86')]=intUtil[_0xeb1b('0x87')](_0xab26ed[_0xeb1b('0x86')]);if(_0x42cdd7&&_0x42cdd7[_0xeb1b('0x95')]&&_0x42cdd7[_0xeb1b('0x95')]!==_0xeb1b('0x96')){logger[_0xeb1b('0x58')]('[OUTBOUND]',_0xeb1b('0x8a'));_0x57f507[_0xeb1b('0x8b')]=_0xab26ed[_0xeb1b('0x86')]+_0xeb1b('0x97')+_0x57f507[_0xeb1b('0x98')]+_0xeb1b('0x8c')+md5(_0x57f507['uniqueid']);}var _0x42a564=_0xab26ed[_0xeb1b('0x85')]==='zoho.eu'?'eu':'com';return getAccessToken(_0xab26ed)[_0xeb1b('0x29')](function(_0x5217af){_0x3d19a2=_0x5217af;return getUser(_0x3d19a2,_0x42a564,_0xab26ed,_0x51ee62[_0xeb1b('0x3a')]);})['then'](function(_0x22bbf0){_0x38b777=_0x22bbf0;logger['info'](_0xeb1b('0x8e'),_0x38b777['id']);return getEndUser(_0x3d19a2,_0x42a564,_0xab26ed,_0x57f507[_0xeb1b('0x99')],_0x57f507[_0xeb1b('0x9a')],_0x38b777,_0x24a797);})[_0xeb1b('0x29')](function(_0x4c6321){_0x158b17=_0x4c6321;return getCall(_0x3d19a2,_0x42a564,_0xab26ed,_0x38b777,_0x158b17,_0x24a797,_0x57f507,_0xeb1b('0x9b'));})[_0xeb1b('0x29')](function(_0x5f1758){if(_0x5f1758){logger['info'](_0xeb1b('0x90'),_0x5f1758['id']);logger[_0xeb1b('0x58')](_0xeb1b('0x9c'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xeb1b('0x33')](_0xeb1b('0x9d'),_0x51ee62['name']),_0xeb1b('0x92'),{'uri':_0xeb1b('0x93')+_0xab26ed[_0xeb1b('0x85')]+_0xeb1b('0x94')+_0x5f1758['id']});}})[_0xeb1b('0x2d')](function(_0x583283){logger[_0xeb1b('0x2e')](_0xeb1b('0x9c'),JSON['stringify'](_0x583283));});};exports[_0xeb1b('0x9e')]=function(_0x5c88df,_0x39825c,_0xd2280f,_0xf78cf0,_0x2117f5,_0x37d194){var _0x327cde,_0x3267c6,_0x4ce3f3;_0x37d194[_0xeb1b('0x85')]=intUtil['stripTrailingSlash'](_0x37d194[_0xeb1b('0x85')]);_0x37d194[_0xeb1b('0x86')]=intUtil[_0xeb1b('0x87')](_0x37d194[_0xeb1b('0x86')]);if(_0x2117f5&&_0x2117f5[_0xeb1b('0x88')]){logger[_0xeb1b('0x58')]('['+_0x39825c[_0xeb1b('0x6f')][_0xeb1b('0x9f')]()+']',_0xeb1b('0x8a'));_0x39825c[_0xeb1b('0x8b')]=_0x37d194[_0xeb1b('0x86')]+'/api/voice/recordings/'+_0x39825c[_0xeb1b('0x98')]+_0xeb1b('0x8c')+md5(_0x39825c[_0xeb1b('0x98')]);}else{_0x39825c[_0xeb1b('0x8b')]='';}var _0x53f6c9=_0x37d194[_0xeb1b('0x85')]==='zoho.eu'?'eu':_0xeb1b('0xa0');return getAccessToken(_0x37d194)['then'](function(_0x3a1cfb){_0x4ce3f3=_0x3a1cfb;return getUser(_0x4ce3f3,_0x53f6c9,_0x37d194);})[_0xeb1b('0x29')](function(_0x2d5e4f){_0x327cde=_0x2d5e4f;logger[_0xeb1b('0x58')]('The\x20User\x20ID\x20is:',_0x327cde['id']);return getEndUser(_0x4ce3f3,_0x53f6c9,_0x37d194,_0x39825c['calleridname'],_0x39825c[_0xeb1b('0x8f')],_0x327cde,_0xd2280f);})[_0xeb1b('0x29')](function(_0x3b8791){_0x3267c6=_0x3b8791;return getCall(_0x4ce3f3,_0x53f6c9,_0x37d194,_0x327cde,_0x3267c6,_0xd2280f,_0x39825c,'Inbound');})[_0xeb1b('0x29')](function(_0x3ffb26){if(_0x3ffb26){logger[_0xeb1b('0x58')](_0xeb1b('0x90'),_0x3ffb26['id']);}})['catch'](function(_0xe0e07e){logger[_0xeb1b('0x2e')]('['+_0x39825c[_0xeb1b('0x6f')][_0xeb1b('0x9f')]()+']',JSON[_0xeb1b('0xf')](_0xe0e07e));});}; \ No newline at end of file +var _0x29fc=['stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','Outbound','user:%s','unmanaged','toUpperCase','request-promise','util','ioredis','../../../../config/environment','zoho','defaults','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','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','clientId','clientSecret','refresh_token','then','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Agent\x20found!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','nothing','Contacts','lead','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','connect','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','stack','err','queue'];(function(_0x20d9ff,_0x1bcc4b){var _0x1f78aa=function(_0x4ab48e){while(--_0x4ab48e){_0x20d9ff['push'](_0x20d9ff['shift']());}};_0x1f78aa(++_0x1bcc4b);}(_0x29fc,0xb0));var _0xc29f=function(_0x247b5f,_0x2f8c6d){_0x247b5f=_0x247b5f-0x0;var _0x5bc28e=_0x29fc[_0x247b5f];return _0x5bc28e;};'use strict';var _=require('lodash');var rp=require(_0xc29f('0x0'));var md5=require('md5');var util=require(_0xc29f('0x1'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0xc29f('0x2'));var BPromise=require('bluebird');var config=require(_0xc29f('0x3'));var logger=require('../../../../config/logger')(_0xc29f('0x4'));config['redis']=_[_0xc29f('0x5')](config['redis'],{'host':_0xc29f('0x6'),'port':0x18eb});var io=require(_0xc29f('0x7'))(new Redis(config['redis']));function emit(_0x58a5a2,_0x25b854,_0x279063){io['to'](_0x58a5a2)['emit'](_0x25b854,_0x279063);}function request(_0x5e0618){logger[_0xc29f('0x8')](_0xc29f('0x9'),JSON[_0xc29f('0xa')](_0x5e0618));return rp(_0x5e0618);}function getCustomFields(_0xbc7980,_0x54bd28){var _0x3974e9={};if(_0xbc7980[_0xc29f('0xb')]>0x0){_[_0xc29f('0xc')](_0xbc7980,function(_0x6ab648){if(_[_0xc29f('0xd')]([_0xc29f('0xe'),_0xc29f('0xf')],_0x6ab648['type'])&&_0x6ab648[_0xc29f('0x10')]){_0x3974e9[_0x6ab648[_0xc29f('0x10')]]=_0x6ab648[_0xc29f('0x11')]['toString']();}else if(_0x6ab648[_0xc29f('0x12')]===_0xc29f('0x13')&&_0x6ab648['variableName']&&_0x6ab648['idField']&&_0x54bd28[_0x6ab648['variableName']]){_0x3974e9[_0x6ab648[_0xc29f('0x10')]]=_0x54bd28[_0x6ab648[_0xc29f('0x14')]][_0xc29f('0x15')]();}else if(_0x6ab648[_0xc29f('0x12')]===_0xc29f('0x16')&&_0x6ab648[_0xc29f('0x17')]&&_0x6ab648[_0xc29f('0x17')]['name']&&_0x6ab648[_0xc29f('0x10')]&&_0x54bd28[_0x6ab648['Variable'][_0xc29f('0x18')][_0xc29f('0x19')]()]){_0x3974e9[_0x6ab648['idField']]=_0x54bd28[_0x6ab648[_0xc29f('0x17')][_0xc29f('0x18')][_0xc29f('0x19')]()]['toString']();}});}return _0x3974e9;}function getName(_0x1c44a4){if(_0x1c44a4[_0xc29f('0x1a')]('\x20')>0x0){var _0x4d4b27=_0x1c44a4['split'](/ (.+)/);if(_0x4d4b27[0x1]){return _0x4d4b27;}}return[_0x1c44a4,_0x1c44a4];}var accountsTokens={};function getAccessToken(_0x3da9d6){return new Promise(function(_0x5a3002,_0x57e913){if(!_[_0xc29f('0x1b')](accountsTokens[_0x3da9d6['id']])&&!_[_0xc29f('0x1b')](accountsTokens[_0x3da9d6['id']][_0xc29f('0x1c')])){if(moment()['isBefore'](accountsTokens[_0x3da9d6['id']]['expires_in'])){_0x5a3002(accountsTokens[_0x3da9d6['id']][_0xc29f('0x1c')]);}}var _0x77a2a;switch(_0x3da9d6[_0xc29f('0x1d')]){case'US':_0x77a2a=_0xc29f('0x1e');break;case'AU':_0x77a2a=_0xc29f('0x1f');break;case'EU':_0x77a2a=_0xc29f('0x20');break;case'IN':_0x77a2a=_0xc29f('0x21');break;case'CN':_0x77a2a=_0xc29f('0x22');break;default:_0x77a2a=_0xc29f('0x20');break;}var _0x35bc22={'method':_0xc29f('0x23'),'uri':_0x77a2a+_0xc29f('0x24'),'qs':{'refresh_token':_0x3da9d6['refreshToken'],'client_id':_0x3da9d6[_0xc29f('0x25')],'client_secret':_0x3da9d6[_0xc29f('0x26')],'grant_type':_0xc29f('0x27')},'json':!![]};return rp(_0x35bc22)[_0xc29f('0x28')](function(_0x152461){accountsTokens[_0x3da9d6['id']]={'access_token':_0x152461['access_token'],'expires_in':moment()['add'](_0x152461[_0xc29f('0x29')],_0xc29f('0x2a'))};_0x5a3002(_0x152461[_0xc29f('0x1c')]);})[_0xc29f('0x2b')](function(_0x3f30a7){logger[_0xc29f('0x2c')](_0xc29f('0x2d'),_0x3f30a7['stack']);_0x57e913(_0x3f30a7);});});}function getUser(_0x4b4a78,_0x27daf5,_0x15ff56,_0x425628){logger[_0xc29f('0x2e')](_0xc29f('0x2f'));return request({'method':_0xc29f('0x30'),'uri':util[_0xc29f('0x31')]('https://www.zohoapis.%s/crm/v2/users',_0x27daf5),'qs':{'type':_0xc29f('0x32')},'headers':{'Authorization':_0xc29f('0x33')+_0x4b4a78},'json':!![]})[_0xc29f('0x28')](function(_0xbf4638){if(_0xbf4638['users']){var _0x2bbd32=-0x1;if(_[_0xc29f('0x34')](_0xbf4638[_0xc29f('0x35')])){if(!_[_0xc29f('0x1b')](_0x425628)){_0x2bbd32=_[_0xc29f('0x36')](_0xbf4638[_0xc29f('0x35')],function(_0x4a187d){return _0x4a187d[_0xc29f('0x37')]===_0x425628;});}if(_0x2bbd32>=0x0){logger[_0xc29f('0x2e')](_0xc29f('0x38'));}else{logger[_0xc29f('0x2e')]('Using\x20the\x20admin\x20account!');_0x2bbd32=_['findIndex'](_0xbf4638[_0xc29f('0x35')],function(_0x162ca2){return _0x162ca2[_0xc29f('0x39')][_0xc29f('0x18')]===_0xc29f('0x3a');});}return _0xbf4638[_0xc29f('0x35')][_0x2bbd32];}else{if(_0xbf4638['user'][_0xc29f('0x39')][_0xc29f('0x18')]==='Administrator'){logger[_0xc29f('0x2e')]('Using\x20the\x20admin\x20account!');user=_0xbf4638[_0xc29f('0x3b')];return user;}else{logger[_0xc29f('0x2c')](_0xc29f('0x3c'),JSON[_0xc29f('0xa')](_0xbf4638));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xc29f('0xa')](_0xbf4638));}}}else{logger['error'](_0xc29f('0x3c'),JSON['stringify'](_0xbf4638));throw new Error(_0xc29f('0x3d')+JSON[_0xc29f('0xa')](_0xbf4638));}})[_0xc29f('0x2b')](function(_0x5887cb){console[_0xc29f('0x2c')](_0x5887cb);});}function getZohoUser(_0xa06c24,_0x59e4c8){return new BPromise(function(_0x3709bb,_0x5e21d4){request(_0xa06c24)[_0xc29f('0x28')](function(_0x1ce91c){var _0x44c35f=null;if(_0x1ce91c){_0x44c35f=_0x1ce91c[_0xc29f('0x3e')][0x0];_0x44c35f[_0xc29f('0x3f')]=_0x59e4c8;}_0x3709bb(_0x44c35f);})[_0xc29f('0x2b')](function(_0x56ec29){_0x5e21d4(_0x56ec29);});});}function createEndUser(_0x2688d6,_0x3d00e5,_0x11198b,_0x2305ed,_0x36f5ef,_0x11614c){var _0x11198b=getName(_0x11198b);return request({'method':_0xc29f('0x23'),'uri':_0xc29f('0x40')+_0x3d00e5+_0xc29f('0x41')+_[_0xc29f('0x42')](_0x11614c[_0xc29f('0x43')])+'s','body':{'data':[{'Last_Name':_0x11198b[0x1],'First_Name':_0x11198b[0x0],'Phone':_0x2305ed,'Owner':{'name':!_[_0xc29f('0x1b')](_0x36f5ef[_0xc29f('0x44')]['name'])?_0x36f5ef[_0xc29f('0x44')][_0xc29f('0x18')]:!_[_0xc29f('0x1b')](_0x36f5ef['first_name'])?_0x36f5ef[_0xc29f('0x45')]+'\x20'+_0x36f5ef[_0xc29f('0x46')]:_0x36f5ef[_0xc29f('0x46')],'id':_0x36f5ef['id']}}]},'headers':{'Authorization':_0xc29f('0x33')+_0x2688d6},'json':!![]})['then'](function(_0x151102){if(_0x151102&&_0x151102['data'][0x0][_0xc29f('0x47')]===_0xc29f('0x48')){var _0x2ef0d8=_0x151102[_0xc29f('0x3e')][0x0][_0xc29f('0x49')];_0x2ef0d8[_0xc29f('0x3f')]=_[_0xc29f('0x42')](_0x11614c['moduleCreate'])+'s';return _0x2ef0d8;}logger['error'](_0xc29f('0x3c'),JSON[_0xc29f('0xa')](data));throw new Error(_0xc29f('0x4a')+JSON['stringify'](data));})['catch'](function(_0x5d99a0){console['log'](_0xc29f('0x4b'),_0x5d99a0);});}function getEndUser(_0x1a6d86,_0x184c7a,_0x541121,_0x535bcf,_0x4f5dbc,_0x1fb55d,_0x3eaa78){var _0x1ec70a={'method':_0xc29f('0x30'),'uri':'','headers':{'Authorization':_0xc29f('0x33')+_0x1a6d86},'json':!![]};switch(_0x3eaa78['moduleSearch']){case _0xc29f('0x4c'):_0x1ec70a[_0xc29f('0x4d')]=_0xc29f('0x40')+_0x184c7a+_0xc29f('0x4e')+_0x4f5dbc+'))';return getZohoUser(_0x1ec70a,'Contacts')[_0xc29f('0x28')](function(_0x5f1ad2){if(_0x5f1ad2)return _0x5f1ad2;_0x1ec70a['uri']=_0xc29f('0x40')+_0x184c7a+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4f5dbc+'))';return getZohoUser(_0x1ec70a,_0xc29f('0x4f'))[_0xc29f('0x28')](function(_0x29060d){if(_0x29060d)return _0x29060d;if(_0x3eaa78[_0xc29f('0x43')]!=_0xc29f('0x50')){return createEndUser(_0x1a6d86,_0x184c7a,_0x535bcf,_0x4f5dbc,_0x1fb55d,_0x3eaa78);}else{return{};}});});break;case'contact':_0x1ec70a[_0xc29f('0x4d')]=_0xc29f('0x40')+_0x184c7a+_0xc29f('0x4e')+_0x4f5dbc+'))';return getZohoUser(_0x1ec70a,_0xc29f('0x51'))[_0xc29f('0x28')](function(_0x5c01ea){if(_0x5c01ea)return _0x5c01ea;if(_0x3eaa78[_0xc29f('0x43')]!=_0xc29f('0x50')){return createEndUser(_0x1a6d86,_0x184c7a,_0x535bcf,_0x4f5dbc,_0x1fb55d,_0x3eaa78);}else{return{};}});break;case _0xc29f('0x52'):_0x1ec70a[_0xc29f('0x4d')]=_0xc29f('0x40')+_0x184c7a+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4f5dbc+'))';return getZohoUser(_0x1ec70a,_0xc29f('0x4f'))[_0xc29f('0x28')](function(_0x219cd6){if(_0x219cd6)return _0x219cd6;if(_0x3eaa78[_0xc29f('0x43')]!=_0xc29f('0x50')){return createEndUser(_0x1a6d86,_0x184c7a,_0x535bcf,_0x4f5dbc,_0x1fb55d,_0x3eaa78);}else{return{};}});break;}}function getCall(_0x2d6253,_0x2ed2bd,_0x52b716,_0x763d24,_0x2d08ee,_0x484b01,_0x5d6b44,_0x34c88f){logger[_0xc29f('0x2e')]('Creating\x20new\x20call...');var _0x4a4d45={};_0x4a4d45['Owner']={'name':!_[_0xc29f('0x1b')](_0x763d24[_0xc29f('0x44')][_0xc29f('0x18')])&&!_[_0xc29f('0x1b')](_0x763d24[_0xc29f('0x39')][_0xc29f('0x18')])&&_0x763d24['profile'][_0xc29f('0x18')]===_0xc29f('0x53')?_0x763d24[_0xc29f('0x44')][_0xc29f('0x18')]:!_[_0xc29f('0x1b')](_0x763d24[_0xc29f('0x45')])?_0x763d24[_0xc29f('0x45')]+'\x20'+_0x763d24['last_name']:_0x763d24[_0xc29f('0x46')],'id':_0x763d24['id']};_0x4a4d45[_0xc29f('0x54')]=intUtil[_0xc29f('0x55')](_0x484b01[_0xc29f('0x56')],_0x5d6b44,'\x20');_0x4a4d45['Description']=intUtil['getString'](_0x484b01[_0xc29f('0x57')],_0x5d6b44,'\x0a');if(_0x2d08ee['enduserType']==='Contacts'){_0x4a4d45[_0xc29f('0x58')]={'name':!_[_0xc29f('0x1b')](_0x2d08ee[_0xc29f('0x59')])?_0x2d08ee[_0xc29f('0x59')]:!_['isNil'](_0x2d08ee[_0xc29f('0x5a')])?_0x2d08ee[_0xc29f('0x5a')]+'\x20'+_0x2d08ee[_0xc29f('0x5b')]:_0x2d08ee[_0xc29f('0x5b')],'id':_0x2d08ee['id']};}if(_0x2d08ee[_0xc29f('0x3f')]==='Leads'){_0x4a4d45[_0xc29f('0x5c')]={'name':!_[_0xc29f('0x1b')](_0x2d08ee[_0xc29f('0x59')])?_0x2d08ee[_0xc29f('0x59')]:!_[_0xc29f('0x1b')](_0x2d08ee[_0xc29f('0x5a')])?_0x2d08ee[_0xc29f('0x5a')]+'\x20'+_0x2d08ee[_0xc29f('0x5b')]:_0x2d08ee[_0xc29f('0x5b')],'id':_0x2d08ee['id']};_0x4a4d45[_0xc29f('0x5d')]=_[_0xc29f('0x42')](_0x2d08ee['enduserType']);}if(_0x5d6b44[_0xc29f('0x5e')]){_0x4a4d45['Call_Duration']=moment[_0xc29f('0x5f')](parseInt(_0x5d6b44[_0xc29f('0x5e')])*0x3e8)[_0xc29f('0x31')]('mm:ss');}else if(_0x5d6b44['answertime']&&_0x5d6b44[_0xc29f('0x60')]){_0x4a4d45[_0xc29f('0x61')]=moment['utc'](moment(_0x5d6b44['endtime'],_0xc29f('0x62'))[_0xc29f('0x63')](moment(_0x5d6b44[_0xc29f('0x64')],_0xc29f('0x62'))))['format'](_0xc29f('0x65'));}switch(_0x5d6b44[_0xc29f('0x66')]){case _0xc29f('0x67'):_0x4a4d45[_0xc29f('0x68')]='Called';break;case'complete':case _0xc29f('0x69'):_0x4a4d45['Call_Result']='Answered';break;case _0xc29f('0x6a'):_0x4a4d45['Call_Result']=_0xc29f('0x6b');break;case _0xc29f('0x6c'):_0x4a4d45[_0xc29f('0x68')]=_0xc29f('0x6d');break;case'timeout':_0x4a4d45[_0xc29f('0x68')]=_0xc29f('0x6e');default:}_0x4a4d45[_0xc29f('0x6f')]=(_0x34c88f===_0xc29f('0x70')?moment(_0x5d6b44[_0xc29f('0x64')])[_0xc29f('0x31')](_0xc29f('0x62')):moment(_0x5d6b44[_0xc29f('0x71')])[_0xc29f('0x31')](_0xc29f('0x62')))||moment()[_0xc29f('0x31')]('YYYY-MM-DDTHH:mm:ss');_0x4a4d45[_0xc29f('0x72')]=_0x34c88f||'Inbound';_0x4a4d45=_[_0xc29f('0x73')](_0x4a4d45,getCustomFields(_0x484b01[_0xc29f('0x74')],_0x5d6b44));return request({'method':_0xc29f('0x23'),'uri':_0xc29f('0x40')+_0x2ed2bd+_0xc29f('0x75'),'headers':{'Authorization':_0xc29f('0x33')+_0x2d6253},'body':{'data':[_0x4a4d45]},'json':!![]})[_0xc29f('0x28')](function(_0x4d4c72){if(_0x4d4c72&&_0x4d4c72['data'][0x0][_0xc29f('0x47')]===_0xc29f('0x48')){logger[_0xc29f('0x2e')](_0xc29f('0x76'));return{'id':_0x4d4c72[_0xc29f('0x3e')][0x0]['details']['id']};}})[_0xc29f('0x2b')](function(_0xf71ab3){logger[_0xc29f('0x2e')]('err',_0xf71ab3[_0xc29f('0x77')]);console['log'](_0xc29f('0x78'),_0xf71ab3);});}exports[_0xc29f('0x79')]=function(_0x50a69a,_0xaf95a3,_0x56f6a9,_0x3373ac,_0x47e73e,_0x2500b0){var _0x19e539,_0x5e6ae9,_0x661346;_0x2500b0['host']=intUtil[_0xc29f('0x7a')](_0x2500b0[_0xc29f('0x7b')]);_0x2500b0[_0xc29f('0x7c')]=intUtil[_0xc29f('0x7a')](_0x2500b0['serverUrl']);if(_0x47e73e&&_0x47e73e[_0xc29f('0x7d')]){logger[_0xc29f('0x2e')](_0xc29f('0x7e'),'Recording\x20is\x20enabled!');_0xaf95a3[_0xc29f('0x7f')]=_0x2500b0[_0xc29f('0x7c')]+_0xc29f('0x80')+_0xaf95a3[_0xc29f('0x81')]+_0xc29f('0x82')+md5(_0xaf95a3[_0xc29f('0x81')]);}else{_0xaf95a3[_0xc29f('0x7f')]='';}var _0x581356=_0x2500b0[_0xc29f('0x7b')]===_0xc29f('0x83')?'eu':_0xc29f('0x84');return getAccessToken(_0x2500b0)[_0xc29f('0x28')](function(_0x4121d7){_0x661346=_0x4121d7;return getUser(_0x661346,_0x581356,_0x2500b0,_0x3373ac[_0xc29f('0x37')]);})['then'](function(_0x193981){_0x19e539=_0x193981;logger['info']('The\x20User\x20ID\x20is:',_0x19e539['id']);return getEndUser(_0x661346,_0x581356,_0x2500b0,_0xaf95a3[_0xc29f('0x85')],_0xaf95a3['calleridnum'],_0x19e539,_0x56f6a9);})['then'](function(_0x1071b5){_0x5e6ae9=_0x1071b5;return getCall(_0x661346,_0x581356,_0x2500b0,_0x19e539,_0x5e6ae9,_0x56f6a9,_0xaf95a3,_0xc29f('0x86'));})[_0xc29f('0x28')](function(_0x4c127e){if(_0x4c127e){logger[_0xc29f('0x2e')](_0xc29f('0x87'),_0x4c127e['id']);logger[_0xc29f('0x2e')](_0xc29f('0x7e'),_0xc29f('0x88'));emit(util[_0xc29f('0x31')]('user:%s',_0x3373ac[_0xc29f('0x18')]),_0xc29f('0x89'),{'uri':_0xc29f('0x8a')+_0x2500b0['host']+_0xc29f('0x8b')+_0x4c127e['id']});}})[_0xc29f('0x2b')](function(_0x416f2a){logger['error'](_0xc29f('0x7e'),JSON[_0xc29f('0xa')](_0x416f2a));});};exports[_0xc29f('0x70')]=function(_0x37abbb,_0x3ee159,_0x5d1121,_0x280bed,_0x4415ad,_0x5dacee,_0x56ac87){var _0x9bcabe,_0x4cd6ac,_0x1040a9;_0x5dacee['host']=intUtil[_0xc29f('0x7a')](_0x5dacee[_0xc29f('0x7b')]);_0x5dacee[_0xc29f('0x7c')]=intUtil['stripTrailingSlash'](_0x5dacee[_0xc29f('0x7c')]);if(_0x56ac87&&_0x56ac87[_0xc29f('0x8c')]&&_0x56ac87[_0xc29f('0x8c')]!==_0xc29f('0x8d')){logger[_0xc29f('0x2e')](_0xc29f('0x8e'),_0xc29f('0x8f'));_0x3ee159[_0xc29f('0x7f')]=_0x5dacee[_0xc29f('0x7c')]+_0xc29f('0x80')+_0x3ee159['uniqueid']+_0xc29f('0x82')+md5(_0x3ee159['uniqueid']);}var _0x39550e=_0x5dacee[_0xc29f('0x7b')]===_0xc29f('0x83')?'eu':_0xc29f('0x84');return getAccessToken(_0x5dacee)[_0xc29f('0x28')](function(_0x33c990){_0x1040a9=_0x33c990;return getUser(_0x1040a9,_0x39550e,_0x5dacee,_0x280bed[_0xc29f('0x37')]);})[_0xc29f('0x28')](function(_0x44bb41){_0x9bcabe=_0x44bb41;logger[_0xc29f('0x2e')]('The\x20User\x20ID\x20is:',_0x9bcabe['id']);return getEndUser(_0x1040a9,_0x39550e,_0x5dacee,_0x3ee159[_0xc29f('0x90')],_0x3ee159['destcalleridnum'],_0x9bcabe,_0x5d1121);})[_0xc29f('0x28')](function(_0x59b31b){_0x4cd6ac=_0x59b31b;return getCall(_0x1040a9,_0x39550e,_0x5dacee,_0x9bcabe,_0x4cd6ac,_0x5d1121,_0x3ee159,_0xc29f('0x91'));})[_0xc29f('0x28')](function(_0x11c4d4){if(_0x11c4d4){logger[_0xc29f('0x2e')](_0xc29f('0x87'),_0x11c4d4['id']);logger[_0xc29f('0x2e')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xc29f('0x92'),_0x280bed[_0xc29f('0x18')]),'trigger:browser:url',{'uri':_0xc29f('0x8a')+_0x5dacee['host']+_0xc29f('0x8b')+_0x11c4d4['id']});}})[_0xc29f('0x2b')](function(_0x3f9854){logger[_0xc29f('0x2c')](_0xc29f('0x8e'),JSON['stringify'](_0x3f9854));});};exports[_0xc29f('0x93')]=function(_0x3104f5,_0x34cf3d,_0x6a43d3,_0x36b455,_0x378641,_0x46a7be){var _0x11cc18,_0xb2d44e,_0x2b533a;_0x46a7be[_0xc29f('0x7b')]=intUtil[_0xc29f('0x7a')](_0x46a7be[_0xc29f('0x7b')]);_0x46a7be['serverUrl']=intUtil[_0xc29f('0x7a')](_0x46a7be[_0xc29f('0x7c')]);if(_0x378641&&_0x378641[_0xc29f('0x7d')]){logger[_0xc29f('0x2e')]('['+_0x34cf3d[_0xc29f('0x66')][_0xc29f('0x94')]()+']','Recording\x20is\x20enabled!');_0x34cf3d[_0xc29f('0x7f')]=_0x46a7be[_0xc29f('0x7c')]+'/api/voice/recordings/'+_0x34cf3d[_0xc29f('0x81')]+_0xc29f('0x82')+md5(_0x34cf3d[_0xc29f('0x81')]);}else{_0x34cf3d[_0xc29f('0x7f')]='';}var _0x1ff480=_0x46a7be[_0xc29f('0x7b')]===_0xc29f('0x83')?'eu':_0xc29f('0x84');return getAccessToken(_0x46a7be)[_0xc29f('0x28')](function(_0x472e07){_0x2b533a=_0x472e07;return getUser(_0x2b533a,_0x1ff480,_0x46a7be);})[_0xc29f('0x28')](function(_0x34d16f){_0x11cc18=_0x34d16f;logger[_0xc29f('0x2e')]('The\x20User\x20ID\x20is:',_0x11cc18['id']);return getEndUser(_0x2b533a,_0x1ff480,_0x46a7be,_0x34cf3d[_0xc29f('0x85')],_0x34cf3d['calleridnum'],_0x11cc18,_0x6a43d3);})['then'](function(_0x4512d1){_0xb2d44e=_0x4512d1;return getCall(_0x2b533a,_0x1ff480,_0x46a7be,_0x11cc18,_0xb2d44e,_0x6a43d3,_0x34cf3d,_0xc29f('0x86'));})[_0xc29f('0x28')](function(_0x4aa040){if(_0x4aa040){logger[_0xc29f('0x2e')](_0xc29f('0x87'),_0x4aa040['id']);}})[_0xc29f('0x2b')](function(_0x1edb3d){logger[_0xc29f('0x2c')]('['+_0x34cf3d[_0xc29f('0x66')]['toUpperCase']()+']',JSON['stringify'](_0x1edb3d));});}; \ 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 713e70d..5189190 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 _0x6040=['trigger','data2','Script','data3','render','exec','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger'];(function(_0x2ef7f9,_0x5c0cf7){var _0x3dc4b2=function(_0x2f6821){while(--_0x2f6821){_0x2ef7f9['push'](_0x2ef7f9['shift']());}};_0x3dc4b2(++_0x5c0cf7);}(_0x6040,0xfb));var _0x0604=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0x6040[_0x56740a];return _0x257144;};'use strict';var util=require(_0x0604('0x0'));var sh=require(_0x0604('0x1'));var Mustache=require(_0x0604('0x2'));var logger=require(_0x0604('0x3'))(_0x0604('0x4'));exports['exec']=function(_0xaccd68,_0x4be47b){var _0x2363ee=_0xaccd68[_0x0604('0x5')]?_0xaccd68[_0x0604('0x5')]:_0x0604('0x6');var _0x32c9e6=_0xaccd68[_0x0604('0x7')]?Mustache[_0x0604('0x8')](_0xaccd68['data3'],_0x4be47b):_0x4be47b;sh[_0x0604('0x9')](_0x32c9e6,function(_0x1fe164,_0x3ae84d,_0x5c5a20){if(_0x1fe164!==0x0){logger[_0x0604('0xa')](util['format'](_0x0604('0xb'),_0x2363ee,_0x32c9e6,_0x1fe164,_0x5c5a20));}else{logger[_0x0604('0xc')](util[_0x0604('0xd')](_0x0604('0xe'),_0x2363ee,_0x32c9e6,_0x3ae84d));}});}; \ No newline at end of file +var _0x7296=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0x328f43,_0x22767a){var _0x220f8c=function(_0x551505){while(--_0x551505){_0x328f43['push'](_0x328f43['shift']());}};_0x220f8c(++_0x22767a);}(_0x7296,0x1cf));var _0x6729=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x7296[_0xf48cce];return _0x2a5c38;};'use strict';var util=require(_0x6729('0x0'));var sh=require(_0x6729('0x1'));var Mustache=require(_0x6729('0x2'));var logger=require(_0x6729('0x3'))(_0x6729('0x4'));exports[_0x6729('0x5')]=function(_0x21ce1d,_0x30cc10){var _0x5e63cd=_0x21ce1d[_0x6729('0x6')]?_0x21ce1d[_0x6729('0x6')]:_0x6729('0x7');var _0x28f3d4=_0x21ce1d[_0x6729('0x8')]?Mustache['render'](_0x21ce1d['data3'],_0x30cc10):_0x30cc10;sh[_0x6729('0x5')](_0x28f3d4,function(_0x509d51,_0x37212f,_0x33eab9){if(_0x509d51!==0x0){logger[_0x6729('0x9')](util[_0x6729('0xa')](_0x6729('0xb'),_0x5e63cd,_0x28f3d4,_0x509d51,_0x33eab9));}else{logger[_0x6729('0xc')](util['format'](_0x6729('0xd'),_0x5e63cd,_0x28f3d4,_0x37212f));}});}; \ 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 2e37e69..53ed6cb 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 _0x6364=['object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','format','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','../../../../config/logger','trigger','exec','data1','toUpperCase','data2','number','data5','headers','data6','parse','render','error','DELETE','POST','PUT','data7','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20'];(function(_0x150c65,_0x303f38){var _0x4ca489=function(_0x2c2e26){while(--_0x2c2e26){_0x150c65['push'](_0x150c65['shift']());}};_0x4ca489(++_0x303f38);}(_0x6364,0x1c7));var _0x4636=function(_0x36c5ec,_0x2d54f3){_0x36c5ec=_0x36c5ec-0x0;var _0xad75fe=_0x6364[_0x36c5ec];return _0xad75fe;};'use strict';var rp=require(_0x4636('0x0'));var util=require(_0x4636('0x1'));var _=require('lodash');var Mustache=require('mustache');var logger=require(_0x4636('0x2'))(_0x4636('0x3'));exports[_0x4636('0x4')]=function(_0x3f0940,_0x1cb25c){var _0x406616,_0x2285c5;var _0x4f08c={'method':_0x3f0940[_0x4636('0x5')][_0x4636('0x6')](),'uri':Mustache['render'](_0x3f0940[_0x4636('0x7')],_0x1cb25c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3f0940['data5'])===_0x4636('0x8')&&parseInt(_0x3f0940[_0x4636('0x9')])>=0x1&&parseInt(_0x3f0940[_0x4636('0x9')])<=0xa?parseInt(_0x3f0940[_0x4636('0x9')])*0x3e8:0x5*0x3e8};try{_0x4f08c[_0x4636('0xa')]=_0x3f0940[_0x4636('0xb')]?JSON[_0x4636('0xc')](Mustache[_0x4636('0xd')](_0x3f0940[_0x4636('0xb')],_0x1cb25c)):{};}catch(_0x215041){logger[_0x4636('0xe')](_0x215041['stack']);}switch(_0x3f0940[_0x4636('0x5')][_0x4636('0x6')]()){case'GET':case _0x4636('0xf'):_0x406616=null;_0x4f08c['qs']=_0x1cb25c;break;case _0x4636('0x10'):case _0x4636('0x11'):if(_0x3f0940[_0x4636('0x12')]){try{_0x406616=JSON[_0x4636('0xc')](Mustache['render'](_0x3f0940[_0x4636('0x12')],_0x1cb25c));_0x4f08c[_0x4636('0x13')]=_0x406616;}catch(_0x16f6dd){logger[_0x4636('0xe')](_0x16f6dd['stack']);logger[_0x4636('0xe')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x406616=_0x1cb25c;_0x4f08c['body']=_0x406616;}break;}logger[_0x4636('0x14')](util['format'](_0x4636('0x15'),_0x3f0940[_0x4636('0x5')],_0x3f0940['data2'],JSON[_0x4636('0x16')](_0x4f08c)));rp(_0x4f08c)[_0x4636('0x17')](function(_0x540fa7){_0x406616=!_['isNil'](_0x406616)?_0x4636('0x18')+_0x406616:'';_0x2285c5=typeof _0x540fa7[_0x4636('0x13')]===_0x4636('0x19')?JSON[_0x4636('0x16')](_0x540fa7[_0x4636('0x13')]):_0x540fa7[_0x4636('0x13')];logger[_0x4636('0x14')](util['format'](_0x4636('0x1a'),_0x3f0940[_0x4636('0x5')],_0x3f0940[_0x4636('0x7')],_0x540fa7[_0x4636('0x1b')],_0x2285c5));})[_0x4636('0x1c')](function(_0x49b72a){logger[_0x4636('0xe')](util[_0x4636('0x1d')](_0x4636('0x1e'),_0x3f0940['data1'],_0x3f0940[_0x4636('0x7')],_0x49b72a[_0x4636('0x1b')],_0x49b72a['name'],_0x49b72a[_0x4636('0x1f')]));});}; \ No newline at end of file +var _0x5509=['number','headers','data6','parse','stack','POST','PUT','data7','body','error','format','data2','stringify','isNil',',\x20request\x20body:\x20','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data5'];(function(_0x50c6fa,_0x2cc909){var _0x43e6e7=function(_0x28408c){while(--_0x28408c){_0x50c6fa['push'](_0x50c6fa['shift']());}};_0x43e6e7(++_0x2cc909);}(_0x5509,0x1d3));var _0x9550=function(_0x19545a,_0x48debb){_0x19545a=_0x19545a-0x0;var _0xee3687=_0x5509[_0x19545a];return _0xee3687;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x9550('0x0'));var Mustache=require(_0x9550('0x1'));var logger=require(_0x9550('0x2'))(_0x9550('0x3'));exports[_0x9550('0x4')]=function(_0x3e1fa6,_0x5b8898){var _0x2c08e6,_0x217e92;var _0x46e325={'method':_0x3e1fa6[_0x9550('0x5')][_0x9550('0x6')](),'uri':Mustache[_0x9550('0x7')](_0x3e1fa6['data2'],_0x5b8898),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3e1fa6[_0x9550('0x8')])===_0x9550('0x9')&&parseInt(_0x3e1fa6[_0x9550('0x8')])>=0x1&&parseInt(_0x3e1fa6['data5'])<=0xa?parseInt(_0x3e1fa6['data5'])*0x3e8:0x5*0x3e8};try{_0x46e325[_0x9550('0xa')]=_0x3e1fa6[_0x9550('0xb')]?JSON[_0x9550('0xc')](Mustache[_0x9550('0x7')](_0x3e1fa6['data6'],_0x5b8898)):{};}catch(_0x19aebd){logger['error'](_0x19aebd[_0x9550('0xd')]);}switch(_0x3e1fa6[_0x9550('0x5')][_0x9550('0x6')]()){case'GET':case'DELETE':_0x2c08e6=null;_0x46e325['qs']=_0x5b8898;break;case _0x9550('0xe'):case _0x9550('0xf'):if(_0x3e1fa6['data7']){try{_0x2c08e6=JSON[_0x9550('0xc')](Mustache[_0x9550('0x7')](_0x3e1fa6[_0x9550('0x10')],_0x5b8898));_0x46e325[_0x9550('0x11')]=_0x2c08e6;}catch(_0x1af31b){logger['error'](_0x1af31b['stack']);logger[_0x9550('0x12')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2c08e6=_0x5b8898;_0x46e325['body']=_0x2c08e6;}break;}logger['info'](util[_0x9550('0x13')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x3e1fa6[_0x9550('0x5')],_0x3e1fa6[_0x9550('0x14')],JSON[_0x9550('0x15')](_0x46e325)));rp(_0x46e325)['then'](function(_0x526913){_0x2c08e6=!_[_0x9550('0x16')](_0x2c08e6)?_0x9550('0x17')+_0x2c08e6:'';_0x217e92=typeof _0x526913['body']==='object'?JSON[_0x9550('0x15')](_0x526913[_0x9550('0x11')]):_0x526913[_0x9550('0x11')];logger[_0x9550('0x18')](util[_0x9550('0x13')](_0x9550('0x19'),_0x3e1fa6[_0x9550('0x5')],_0x3e1fa6[_0x9550('0x14')],_0x526913['statusCode'],_0x217e92));})['catch'](function(_0x33abb6){logger[_0x9550('0x12')](util[_0x9550('0x13')](_0x9550('0x1a'),_0x3e1fa6[_0x9550('0x5')],_0x3e1fa6[_0x9550('0x14')],_0x33abb6['statusCode'],_0x33abb6['name'],_0x33abb6[_0x9550('0x1b')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 1c03a0f..da2a677 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 _0xb217=['routing','client','http','Request','debug','rpc','error','message','result','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x25c1c9,_0x587422){var _0x2fa62f=function(_0x2c5f5b){while(--_0x2c5f5b){_0x25c1c9['push'](_0x25c1c9['shift']());}};_0x2fa62f(++_0x587422);}(_0xb217,0xe7));var _0x7b21=function(_0x4482d5,_0x2d770d){_0x4482d5=_0x4482d5-0x0;var _0x9252dc=_0xb217[_0x4482d5];return _0x9252dc;};'use strict';var jayson=require(_0x7b21('0x0'));var BPromise=require(_0x7b21('0x1'));var logger=require(_0x7b21('0x2'))(_0x7b21('0x3'));var client=jayson[_0x7b21('0x4')][_0x7b21('0x5')]({'port':0x2329});client[_0x7b21('0x6')]=function(_0x5c5296,_0x32fa6f){return new BPromise(function(_0x498982,_0x5d781b){return client['request'](_0x5c5296,_0x32fa6f)['then'](function(_0x21bf77){logger[_0x7b21('0x7')](_0x7b21('0x8'),_0x7b21('0x3'),_0x5c5296,_0x32fa6f,_0x21bf77);if(_0x21bf77[_0x7b21('0x9')]){logger['error'](_0x7b21('0x8'),_0x7b21('0x3'),_0x5c5296,_0x21bf77[_0x7b21('0x9')][_0x7b21('0xa')],_0x32fa6f);return _0x5d781b(_0x21bf77[_0x7b21('0x9')][_0x7b21('0xa')]);}else{return _0x498982(_0x21bf77[_0x7b21('0xb')]);}})['catch'](function(_0x3956a9){logger[_0x7b21('0x9')](_0x7b21('0x8'),'routing',_0x5c5296,_0x3956a9,_0x32fa6f);return _0x5d781b(_0x3956a9);});});};module[_0x7b21('0xc')]=client; \ No newline at end of file +var _0xdf83=['debug','rpc','routing','error','message','result','catch','jayson/promise','bluebird','../../config/logger','client'];(function(_0xb91441,_0x285e27){var _0x5cb8ac=function(_0x328739){while(--_0x328739){_0xb91441['push'](_0xb91441['shift']());}};_0x5cb8ac(++_0x285e27);}(_0xdf83,0x1ca));var _0x3df8=function(_0x7f4e44,_0x5b88e9){_0x7f4e44=_0x7f4e44-0x0;var _0x4235c8=_0xdf83[_0x7f4e44];return _0x4235c8;};'use strict';var jayson=require(_0x3df8('0x0'));var BPromise=require(_0x3df8('0x1'));var logger=require(_0x3df8('0x2'))('routing');var client=jayson[_0x3df8('0x3')]['http']({'port':0x2329});client['Request']=function(_0x2aa414,_0xa0c0c5){return new BPromise(function(_0x3dd15b,_0x554010){return client['request'](_0x2aa414,_0xa0c0c5)['then'](function(_0x540094){logger[_0x3df8('0x4')](_0x3df8('0x5'),_0x3df8('0x6'),_0x2aa414,_0xa0c0c5,_0x540094);if(_0x540094[_0x3df8('0x7')]){logger[_0x3df8('0x7')](_0x3df8('0x5'),'routing',_0x2aa414,_0x540094[_0x3df8('0x7')][_0x3df8('0x8')],_0xa0c0c5);return _0x554010(_0x540094[_0x3df8('0x7')]['message']);}else{return _0x3dd15b(_0x540094[_0x3df8('0x9')]);}})[_0x3df8('0xa')](function(_0xabc7d2){logger[_0x3df8('0x7')](_0x3df8('0x5'),_0x3df8('0x6'),_0x2aa414,_0xabc7d2,_0xa0c0c5);return _0x554010(_0xabc7d2);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index c92f970..1daf605 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 _0xa006=['loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','resolve','getMailAccounts','then','initMailAccounts','refresh','listen','getSettings'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0xa006,0x17a));var _0x6a00=function(_0xf7e131,_0x5893ab){_0xf7e131=_0xf7e131-0x0;var _0x23ac2d=_0xa006[_0xf7e131];return _0x23ac2d;};'use strict';var BPromise=require(_0x6a00('0x0'));var server=require(_0x6a00('0x1'));var Realtime=require(_0x6a00('0x2'));var EmailChannel=require(_0x6a00('0x3'));var mailAccount=require(_0x6a00('0x4'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x6a00('0x5')]()['then'](mailAccount[_0x6a00('0x6')]())[_0x6a00('0x7')](realtime[_0x6a00('0x8')]())[_0x6a00('0x7')](function(){email[_0x6a00('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x6a00('0xa')](realtime,email)[_0x6a00('0x7')](function(){return initRealtime();})[_0x6a00('0x7')](function(){return setting[_0x6a00('0xb')]();})['then'](function(_0x35d6ab){return setInterval(initRealtime,_0x35d6ab[_0x6a00('0xc')]*0x3e8);})[_0x6a00('0xd')](function(_0x514d0c){console[_0x6a00('0xe')](_0x514d0c);});}main(); \ No newline at end of file +var _0x8976=['./rpc/setting','then','getMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','log','bluebird','./realtime','./lib/email'];(function(_0x3d84e9,_0x74d483){var _0x11a630=function(_0x4b72d8){while(--_0x4b72d8){_0x3d84e9['push'](_0x3d84e9['shift']());}};_0x11a630(++_0x74d483);}(_0x8976,0x1e9));var _0x6897=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8976[_0x2641f9];return _0x585741;};'use strict';var BPromise=require(_0x6897('0x0'));var server=require('./server');var Realtime=require(_0x6897('0x1'));var EmailChannel=require(_0x6897('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x6897('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0x6897('0x4')](mailAccount[_0x6897('0x5')]())[_0x6897('0x4')](realtime['initMailAccounts']())[_0x6897('0x4')](function(){email[_0x6897('0x6')](realtime[_0x6897('0x7')]);return realtime;});}function main(){return server[_0x6897('0x8')](realtime,email)[_0x6897('0x4')](function(){return initRealtime();})[_0x6897('0x4')](function(){return setting[_0x6897('0x9')]();})[_0x6897('0x4')](function(_0x562fa3){return setInterval(initRealtime,_0x562fa3[_0x6897('0xa')]*0x3e8);})['catch'](function(_0x2c2930){console[_0x6897('0xb')](_0x2c2930);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index cdef35f..c267ec0 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 _0x7883=['firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','Smtp','verify','verified','exports','lodash','bluebird','md5','../../../config/logger','email','defaults','localhost','socket.io-emitter','redis','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','key','active','Imap','status','messageStatus','total','stringify','mailAccount:update','prototype','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s'];(function(_0x16d721,_0x2fd182){var _0x2f0f7f=function(_0x418495){while(--_0x418495){_0x16d721['push'](_0x16d721['shift']());}};_0x2f0f7f(++_0x2fd182);}(_0x7883,0x1a4));var _0x3788=function(_0x39f3ee,_0x527f05){_0x39f3ee=_0x39f3ee-0x0;var _0x2b3c00=_0x7883[_0x39f3ee];return _0x2b3c00;};'use strict';var _=require(_0x3788('0x0'));var moment=require('moment');var BPromise=require(_0x3788('0x1'));var md5=require(_0x3788('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x3788('0x3'))(_0x3788('0x4'));config['redis']=_[_0x3788('0x5')](config['redis'],{'host':_0x3788('0x6'),'port':0x18eb});var io=require(_0x3788('0x7'))(new Redis(config[_0x3788('0x8')]));var EmailImap=require(_0x3788('0x9'));var EmailSmtp=require(_0x3788('0xa'));var mailAccount=require(_0x3788('0xb'));var md5Accounts={};function EmailChannel(_0xadb10){logger[_0x3788('0xc')](_0x3788('0xd'));this[_0x3788('0xe')]=_0xadb10['mailAccounts'];this[_0x3788('0xf')]={};this[_0x3788('0x10')]=new EmailSmtp();}EmailChannel['prototype'][_0x3788('0x11')]=function(_0x4752fb){var _0x5ea03a=this[_0x3788('0xe')][_0x4752fb];var _0x3037c8={'id':_0x5ea03a['id'],'name':_0x5ea03a[_0x3788('0x12')],'key':_0x5ea03a[_0x3788('0x13')],'active':_0x5ea03a[_0x3788('0x14')],'Imap':{'status':_0x5ea03a[_0x3788('0x15')][_0x3788('0x16')],'messageStatus':_0x5ea03a[_0x3788('0x15')][_0x3788('0x17')],'total':_0x5ea03a['Imap'][_0x3788('0x18')]}};if(_['isNil'](md5Accounts[_0x4752fb])){md5Accounts[_0x4752fb]={};}var _0x5de2a2=md5(JSON[_0x3788('0x19')](_0x3037c8));if(md5Accounts[_0x4752fb][_0x3788('0x2')]!==_0x5de2a2){md5Accounts[_0x4752fb][_0x3788('0x2')]=_0x5de2a2;io[_0x3788('0x11')](_0x3788('0x1a'),_0x3037c8);}};EmailChannel[_0x3788('0x1b')]['refresh']=function(_0x11fcd4){for(var _0x387ca4 in _0x11fcd4){if(_0x11fcd4['hasOwnProperty'](_0x387ca4)){if(_0x11fcd4[_0x387ca4][_0x3788('0x15')]&&_0x11fcd4[_0x387ca4][_0x3788('0x14')]){var _0x4987da=_0x11fcd4[_0x387ca4]['Imap'];if(!this[_0x3788('0xf')][_0x3788('0x1c')](_0x4987da['id'])){this['imapAccounts'][_0x4987da['id']]=new EmailImap(_0x4987da,_0x11fcd4[_0x387ca4]['email']);this[_0x3788('0xf')][_0x4987da['id']]['on'](_0x3788('0x1d'),this[_0x3788('0x1e')][_0x3788('0x1f')](this,_0x387ca4));this[_0x3788('0xf')][_0x4987da['id']]['on']('email',this[_0x3788('0x20')][_0x3788('0x1f')](this,_0x387ca4));this[_0x3788('0xf')][_0x4987da['id']]['on'](_0x3788('0x21'),this[_0x3788('0x22')][_0x3788('0x1f')](this,_0x387ca4));this[_0x3788('0xf')][_0x4987da['id']]['on'](_0x3788('0x23'),this['handleImapError'][_0x3788('0x1f')](this,_0x387ca4));}}else{if(_['isNil'](this['mailAccounts'][_0x387ca4][_0x3788('0x15')])){this[_0x3788('0xe')][_0x387ca4]['Imap']={};}this['mailAccounts'][_0x387ca4][_0x3788('0x15')][_0x3788('0x16')]='disabled';this[_0x3788('0xe')][_0x387ca4]['Imap'][_0x3788('0x17')]='';this[_0x3788('0x11')](_0x387ca4);}}}};EmailChannel[_0x3788('0x1b')][_0x3788('0x1e')]=function(_0x1116e3,_0x38b566){if(this[_0x3788('0xe')][_0x1116e3]){this[_0x3788('0xe')][_0x1116e3]['Imap'][_0x3788('0x16')]=_0x3788('0x24');this[_0x3788('0xe')][_0x1116e3][_0x3788('0x15')]['messageStatus']=_0x38b566[_0x3788('0x12')];if(_0x38b566[_0x3788('0x25')]){this[_0x3788('0xe')][_0x1116e3]['Imap'][_0x3788('0x18')]=_0x38b566[_0x3788('0x25')]['total'];}return this[_0x3788('0x11')](_0x1116e3);}};EmailChannel[_0x3788('0x1b')][_0x3788('0x20')]=function(_0xe2e931,_0x430a90){logger[_0x3788('0xc')](_0x3788('0x26'),_0x430a90[_0x3788('0x27')],_0x430a90[_0x3788('0x28')],_0x430a90[_0x3788('0x29')],_0xe2e931);if(this['mailAccounts'][_0xe2e931]){return mailAccount[_0x3788('0x2a')](_0xe2e931,_0x430a90)[_0x3788('0x2b')](function(_0x52e9e1){if(_0x52e9e1){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0x3788('0x2c')](function(_0x2ef5d2){logger[_0x3788('0x23')](_0x3788('0x2d'),JSON[_0x3788('0x19')](_0x2ef5d2));});}};EmailChannel['prototype'][_0x3788('0x22')]=function(_0x30c58d){if(this[_0x3788('0xe')][_0x30c58d]&&this[_0x3788('0xe')][_0x30c58d][_0x3788('0x15')]){if(this['imapAccounts'][this[_0x3788('0xe')][_0x30c58d][_0x3788('0x15')]['id']]){delete this[_0x3788('0xf')][this[_0x3788('0xe')][_0x30c58d][_0x3788('0x15')]['id']];}this[_0x3788('0xe')][_0x30c58d]['Imap']['lastSync']=moment();this[_0x3788('0x11')](_0x30c58d);}};EmailChannel['prototype']['handleImapError']=function(_0x468028,_0xc1bdde){if(this[_0x3788('0xe')][_0x468028]){this[_0x3788('0xe')][_0x468028][_0x3788('0x15')]['status']=_0x3788('0x23');this[_0x3788('0xe')][_0x468028][_0x3788('0x15')]['messageStatus']=_0xc1bdde;return this[_0x3788('0x11')](_0x468028);}};EmailChannel[_0x3788('0x1b')][_0x3788('0x2e')]=function(_0x851d75,_0x174519){return this[_0x3788('0x10')]['send'](_0x851d75,_0x174519);};EmailChannel[_0x3788('0x1b')]['verifySmtp']=function(_0x4d7194){var _0xa76c6=this;if(this[_0x3788('0xe')][_0x4d7194['id']]){if(_['isNil'](this[_0x3788('0xe')][_0x4d7194['id']][_0x3788('0x2f')])){this[_0x3788('0xe')][_0x4d7194['id']][_0x3788('0x2f')]={};}this[_0x3788('0xe')][_0x4d7194['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x10ce25,_0x437e25){return _0xa76c6[_0x3788('0x10')][_0x3788('0x30')](_0x4d7194)['then'](function(_0x2c47b4){_0xa76c6[_0x3788('0xe')][_0x4d7194['id']][_0x3788('0x2f')][_0x3788('0x16')]=_0x3788('0x31');_0xa76c6[_0x3788('0xe')][_0x4d7194['id']][_0x3788('0x2f')][_0x3788('0x17')]='';_0xa76c6[_0x3788('0x11')](_0x4d7194['id']);_0x10ce25(_0x2c47b4);})[_0x3788('0x2c')](function(_0x1958db){_0xa76c6[_0x3788('0xe')][_0x4d7194['id']][_0x3788('0x2f')][_0x3788('0x16')]='error';_0xa76c6['mailAccounts'][_0x4d7194['id']][_0x3788('0x2f')][_0x3788('0x17')]=_0x1958db;_0xa76c6[_0x3788('0x11')](_0x4d7194['id']);_0x437e25(_0x1958db);});});}return this[_0x3788('0x10')]['verify'](_0x4d7194);};module[_0x3788('0x32')]=EmailChannel; \ No newline at end of file +var _0x83c8=['../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','emit','key','active','Imap','total','md5','mailAccount:update','prototype','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','status','disabled','messageStatus','connected','name','messages','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','handleImapError','send','verifySmtp','isNil','Smtp','verify','verified','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./smtp'];(function(_0x21bf49,_0x15eeef){var _0x365754=function(_0x55e337){while(--_0x55e337){_0x21bf49['push'](_0x21bf49['shift']());}};_0x365754(++_0x15eeef);}(_0x83c8,0x1e4));var _0x883c=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0x83c8[_0x1f7839];return _0x36b42e;};'use strict';var _=require(_0x883c('0x0'));var moment=require(_0x883c('0x1'));var BPromise=require(_0x883c('0x2'));var md5=require('md5');var Redis=require(_0x883c('0x3'));var config=require(_0x883c('0x4'));var logger=require(_0x883c('0x5'))(_0x883c('0x6'));config[_0x883c('0x7')]=_['defaults'](config[_0x883c('0x7')],{'host':_0x883c('0x8'),'port':0x18eb});var io=require(_0x883c('0x9'))(new Redis(config[_0x883c('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x883c('0xa'));var mailAccount=require(_0x883c('0xb'));var md5Accounts={};function EmailChannel(_0x6d9392){logger[_0x883c('0xc')]('start\x20email\x20channel');this[_0x883c('0xd')]=_0x6d9392['mailAccounts'];this[_0x883c('0xe')]={};this[_0x883c('0xf')]=new EmailSmtp();}EmailChannel['prototype'][_0x883c('0x10')]=function(_0x2acac9){var _0x4b5520=this[_0x883c('0xd')][_0x2acac9];var _0x4b895a={'id':_0x4b5520['id'],'name':_0x4b5520['name'],'key':_0x4b5520[_0x883c('0x11')],'active':_0x4b5520[_0x883c('0x12')],'Imap':{'status':_0x4b5520[_0x883c('0x13')]['status'],'messageStatus':_0x4b5520[_0x883c('0x13')]['messageStatus'],'total':_0x4b5520['Imap'][_0x883c('0x14')]}};if(_['isNil'](md5Accounts[_0x2acac9])){md5Accounts[_0x2acac9]={};}var _0x33ec3e=md5(JSON['stringify'](_0x4b895a));if(md5Accounts[_0x2acac9]['md5']!==_0x33ec3e){md5Accounts[_0x2acac9][_0x883c('0x15')]=_0x33ec3e;io['emit'](_0x883c('0x16'),_0x4b895a);}};EmailChannel[_0x883c('0x17')]['refresh']=function(_0x2ab2ac){for(var _0x4ae51a in _0x2ab2ac){if(_0x2ab2ac['hasOwnProperty'](_0x4ae51a)){if(_0x2ab2ac[_0x4ae51a]['Imap']&&_0x2ab2ac[_0x4ae51a][_0x883c('0x12')]){var _0x3b3461=_0x2ab2ac[_0x4ae51a][_0x883c('0x13')];if(!this[_0x883c('0xe')][_0x883c('0x18')](_0x3b3461['id'])){this[_0x883c('0xe')][_0x3b3461['id']]=new EmailImap(_0x3b3461,_0x2ab2ac[_0x4ae51a]['email']);this[_0x883c('0xe')][_0x3b3461['id']]['on'](_0x883c('0x19'),this[_0x883c('0x1a')][_0x883c('0x1b')](this,_0x4ae51a));this[_0x883c('0xe')][_0x3b3461['id']]['on'](_0x883c('0x6'),this[_0x883c('0x1c')]['bind'](this,_0x4ae51a));this[_0x883c('0xe')][_0x3b3461['id']]['on'](_0x883c('0x1d'),this[_0x883c('0x1e')][_0x883c('0x1b')](this,_0x4ae51a));this['imapAccounts'][_0x3b3461['id']]['on'](_0x883c('0x1f'),this['handleImapError']['bind'](this,_0x4ae51a));}}else{if(_['isNil'](this['mailAccounts'][_0x4ae51a][_0x883c('0x13')])){this[_0x883c('0xd')][_0x4ae51a][_0x883c('0x13')]={};}this[_0x883c('0xd')][_0x4ae51a]['Imap'][_0x883c('0x20')]=_0x883c('0x21');this[_0x883c('0xd')][_0x4ae51a][_0x883c('0x13')][_0x883c('0x22')]='';this['emit'](_0x4ae51a);}}}};EmailChannel['prototype'][_0x883c('0x1a')]=function(_0x425d0d,_0x508df0){if(this[_0x883c('0xd')][_0x425d0d]){this['mailAccounts'][_0x425d0d]['Imap'][_0x883c('0x20')]=_0x883c('0x23');this['mailAccounts'][_0x425d0d][_0x883c('0x13')][_0x883c('0x22')]=_0x508df0[_0x883c('0x24')];if(_0x508df0[_0x883c('0x25')]){this[_0x883c('0xd')][_0x425d0d]['Imap'][_0x883c('0x14')]=_0x508df0[_0x883c('0x25')][_0x883c('0x14')];}return this[_0x883c('0x10')](_0x425d0d);}};EmailChannel[_0x883c('0x17')][_0x883c('0x1c')]=function(_0x4100b0,_0x348047){logger[_0x883c('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x348047[_0x883c('0x26')],_0x348047[_0x883c('0x27')],_0x348047['from'],_0x4100b0);if(this['mailAccounts'][_0x4100b0]){return mailAccount[_0x883c('0x28')](_0x4100b0,_0x348047)[_0x883c('0x29')](function(_0x2486b2){if(_0x2486b2){logger[_0x883c('0xc')](_0x883c('0x2a'));}})[_0x883c('0x2b')](function(_0x305983){logger['error'](_0x883c('0x2c'),JSON[_0x883c('0x2d')](_0x305983));});}};EmailChannel[_0x883c('0x17')]['handleImapEnd']=function(_0x40e23f){if(this['mailAccounts'][_0x40e23f]&&this['mailAccounts'][_0x40e23f][_0x883c('0x13')]){if(this[_0x883c('0xe')][this['mailAccounts'][_0x40e23f][_0x883c('0x13')]['id']]){delete this[_0x883c('0xe')][this[_0x883c('0xd')][_0x40e23f]['Imap']['id']];}this[_0x883c('0xd')][_0x40e23f][_0x883c('0x13')][_0x883c('0x2e')]=moment();this['emit'](_0x40e23f);}};EmailChannel['prototype'][_0x883c('0x2f')]=function(_0x165720,_0x15baae){if(this['mailAccounts'][_0x165720]){this['mailAccounts'][_0x165720][_0x883c('0x13')][_0x883c('0x20')]=_0x883c('0x1f');this['mailAccounts'][_0x165720][_0x883c('0x13')][_0x883c('0x22')]=_0x15baae;return this[_0x883c('0x10')](_0x165720);}};EmailChannel[_0x883c('0x17')]['sendMail']=function(_0x3e282f,_0x543060){return this[_0x883c('0xf')][_0x883c('0x30')](_0x3e282f,_0x543060);};EmailChannel['prototype'][_0x883c('0x31')]=function(_0x6c8062){var _0x968e59=this;if(this['mailAccounts'][_0x6c8062['id']]){if(_[_0x883c('0x32')](this[_0x883c('0xd')][_0x6c8062['id']][_0x883c('0x33')])){this[_0x883c('0xd')][_0x6c8062['id']][_0x883c('0x33')]={};}this[_0x883c('0xd')][_0x6c8062['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x40eedc,_0x4c230c){return _0x968e59['smtp'][_0x883c('0x34')](_0x6c8062)['then'](function(_0x1aa63f){_0x968e59[_0x883c('0xd')][_0x6c8062['id']][_0x883c('0x33')][_0x883c('0x20')]=_0x883c('0x35');_0x968e59[_0x883c('0xd')][_0x6c8062['id']][_0x883c('0x33')]['messageStatus']='';_0x968e59[_0x883c('0x10')](_0x6c8062['id']);_0x40eedc(_0x1aa63f);})['catch'](function(_0xc86160){_0x968e59[_0x883c('0xd')][_0x6c8062['id']]['Smtp'][_0x883c('0x20')]=_0x883c('0x1f');_0x968e59[_0x883c('0xd')][_0x6c8062['id']][_0x883c('0x33')][_0x883c('0x22')]=_0xc86160;_0x968e59[_0x883c('0x10')](_0x6c8062['id']);_0x4c230c(_0xc86160);});});}return this['smtp'][_0x883c('0x34')](_0x6c8062);};module[_0x883c('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 3161464..9ed5125 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 _0x8319=['Iconv','events','EventEmitter','./utils','email','INBOX','account','getAccount','once','bind','end','handleEnd','imap','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','handleReady','openBox','handleOpenBox','emit','box','handleCloseBox','readUnseen','length','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','path','util','lodash','randomstring','mailparser'];(function(_0x3838da,_0x5a4a68){var _0x58be90=function(_0x24e224){while(--_0x24e224){_0x3838da['push'](_0x3838da['shift']());}};_0x58be90(++_0x5a4a68);}(_0x8319,0xac));var _0x9831=function(_0x1449dc,_0x1c7e45){_0x1449dc=_0x1449dc-0x0;var _0x31602a=_0x8319[_0x1449dc];return _0x31602a;};'use strict';var fs=require('fs');var path=require(_0x9831('0x0'));var util=require(_0x9831('0x1'));var Imap=require('imap');var _=require(_0x9831('0x2'));var rs=require(_0x9831('0x3'));var simpleParser=require(_0x9831('0x4'))['simpleParser'];var Iconv=require('iconv')[_0x9831('0x5')];var EventEmitter=require(_0x9831('0x6'))[_0x9831('0x7')];var utils=require(_0x9831('0x8'));var logger=require('../../../config/logger')(_0x9831('0x9'));function EmailImap(_0x3f42f4,_0x428885){this['mailbox']=_0x9831('0xa');this[_0x9831('0xb')]=this[_0x9831('0xc')](_0x3f42f4,_0x428885);this['imap']=new Imap(this['account']);this['imap'][_0x9831('0xd')]('ready',this['handleReady'][_0x9831('0xe')](this));this['imap'][_0x9831('0xd')](_0x9831('0xf'),this[_0x9831('0x10')][_0x9831('0xe')](this));this[_0x9831('0x11')]['on'](_0x9831('0x12'),this[_0x9831('0x13')][_0x9831('0xe')](this));this[_0x9831('0x11')][_0x9831('0x14')]();}util[_0x9831('0x15')](EmailImap,EventEmitter);EmailImap[_0x9831('0x16')][_0x9831('0xc')]=function(_0x817bc,_0x5ecd19){var _0x27e159={'connTimeout':_0x817bc[_0x9831('0x17')]?_0x817bc['connTimeout']*0x3e8:0x2710,'authTimeout':_0x817bc[_0x9831('0x18')]?_0x817bc['authTimeout']*0x3e8:0x1388};if(_[_0x9831('0x19')](_0x817bc[_0x9831('0x1a')])){if(_0x817bc['authentication']){_0x27e159[_0x9831('0x1b')]=_0x817bc['user'];_0x27e159[_0x9831('0x1c')]=_0x817bc[_0x9831('0x1c')];}_0x27e159['host']=_0x817bc[_0x9831('0x1d')];_0x27e159[_0x9831('0x1e')]=_0x817bc[_0x9831('0x1e')]||0x3e1;if(_0x817bc[_0x9831('0x1f')]){_0x27e159[_0x9831('0x1f')]=!![];}else{_0x27e159[_0x9831('0x1f')]=![];_0x27e159[_0x9831('0x20')]=_0x9831('0x21');}}else{_0x27e159['user']=_0x817bc[_0x9831('0x1b')];_0x27e159['password']=_0x817bc[_0x9831('0x1c')];_0x27e159['host']=utils[_0x9831('0x22')](_0x817bc[_0x9831('0x1a')]);_0x27e159['port']=0x3e1;_0x27e159[_0x9831('0x1f')]=!![];}_0x27e159['email']=_0x5ecd19||_0x817bc['user']||_0x9831('0x23');return _0x27e159;};EmailImap['prototype'][_0x9831('0x24')]=function(){this[_0x9831('0x11')][_0x9831('0x25')](this['mailbox'],![],this[_0x9831('0x26')]['bind'](this));};EmailImap[_0x9831('0x16')][_0x9831('0x26')]=function(_0x41a250,_0x4f94ad){if(_0x41a250){this[_0x9831('0x13')](_0x41a250,!![]);}else{this[_0x9831('0x27')](_0x9831('0x28'),_0x4f94ad);this['readUnseen']();}};EmailImap[_0x9831('0x16')][_0x9831('0x29')]=function(_0x38fb40){if(_0x38fb40){this['handleError'](_0x38fb40,!![]);}else{this[_0x9831('0x11')][_0x9831('0xf')]();}};EmailImap['prototype'][_0x9831('0x2a')]=function(){this[_0x9831('0x11')]['search'](['UNSEEN'],this['handleReadUnseen'][_0x9831('0xe')](this));};EmailImap[_0x9831('0x16')]['handleReadUnseen']=function(_0x1bfe67,_0xed4ab9){if(_0x1bfe67){this[_0x9831('0x13')](_0x1bfe67,!![]);}else{if(_0xed4ab9[_0x9831('0x2b')]){try{var _0x5148a8=this[_0x9831('0x11')][_0x9831('0x2c')](_0xed4ab9,{'bodies':'','markSeen':!![]});_0x5148a8['on'](_0x9831('0x2d'),this['handleFetchMessage'][_0x9831('0xe')](this));_0x5148a8['once'](_0x9831('0x12'),this[_0x9831('0x2e')][_0x9831('0xe')](this));_0x5148a8[_0x9831('0xd')](_0x9831('0xf'),this[_0x9831('0x2f')][_0x9831('0xe')](this));}catch(_0x52109f){logger[_0x9831('0x12')](_0x52109f);}}else{this['imap'][_0x9831('0x30')](!![],this[_0x9831('0x29')]['bind'](this));}}};EmailImap[_0x9831('0x16')][_0x9831('0x31')]=function(_0x1ba910,_0x326c20){_0x1ba910['on']('body',this[_0x9831('0x32')]['bind'](this));_0x1ba910['once']('attributes',this[_0x9831('0x33')][_0x9831('0xe')](this));_0x1ba910[_0x9831('0xd')](_0x9831('0xf'),this[_0x9831('0x34')][_0x9831('0xe')](this));};EmailImap[_0x9831('0x16')]['handleMessageBody']=function(_0x3958f5,_0x222cfb){simpleParser(_0x3958f5,{'Iconv':Iconv},this[_0x9831('0x35')][_0x9831('0xe')](this));};EmailImap[_0x9831('0x16')][_0x9831('0x33')]=function(_0xf3b591){};EmailImap[_0x9831('0x16')][_0x9831('0x34')]=function(){};EmailImap[_0x9831('0x16')]['handleSimpleParser']=function(_0x2d2202,_0x14ff99){if(_0x2d2202){logger[_0x9831('0x12')](_0x2d2202);}else{var _0x5a585a=this;utils[_0x9831('0x36')](this[_0x9831('0xb')],_0x14ff99,function(_0x36b113){_0x5a585a[_0x9831('0x27')]('email',_0x36b113);});}};EmailImap[_0x9831('0x16')][_0x9831('0x2f')]=function(){this['imap'][_0x9831('0x30')](!![],this[_0x9831('0x29')][_0x9831('0xe')](this));};EmailImap[_0x9831('0x16')][_0x9831('0x2e')]=function(_0xf28c7b){this[_0x9831('0x13')](_0xf28c7b);this[_0x9831('0x11')]['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x9831('0x16')]['handleEnd']=function(){this['emit'](_0x9831('0xf'));};EmailImap['prototype']['handleError']=function(_0x525bd2,_0x356570){logger[_0x9831('0x12')]('handleError',this[_0x9831('0xb')][_0x9831('0x9')],JSON[_0x9831('0x37')](_0x525bd2));var _0x3dfacf='';if(_0x525bd2){if(_0x525bd2[_0x9831('0x38')]){_0x3dfacf=_0x525bd2[_0x9831('0x38')];}else{for(var _0x24f163 in _0x525bd2){if(_0x525bd2[_0x9831('0x39')](_0x24f163)){_0x3dfacf+=_[_0x9831('0x3a')](_0x24f163)+':\x20'+_0x525bd2[_0x24f163]+'\x0a';}}}}if(_0x356570){this['imap'][_0x9831('0xf')]();}else{this['emit'](_0x9831('0x12'),_0x3dfacf);this[_0x9831('0x27')](_0x9831('0xf'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x6a27=['required','getHost','email','anonymous@xcally.com','openBox','handleOpenBox','box','readUnseen','handleCloseBox','handleError','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchEnd','closeBox','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','lodash','randomstring','mailparser','iconv','Iconv','events','./utils','../../../config/logger','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','user','password','host','port','tls'];(function(_0x31158d,_0x1b8db6){var _0x536df7=function(_0x3c0c5f){while(--_0x3c0c5f){_0x31158d['push'](_0x31158d['shift']());}};_0x536df7(++_0x1b8db6);}(_0x6a27,0x152));var _0x76a2=function(_0x42a9cb,_0x8966ee){_0x42a9cb=_0x42a9cb-0x0;var _0x5efe3a=_0x6a27[_0x42a9cb];return _0x5efe3a;};'use strict';var fs=require('fs');var path=require(_0x76a2('0x0'));var util=require(_0x76a2('0x1'));var Imap=require(_0x76a2('0x2'));var _=require(_0x76a2('0x3'));var rs=require(_0x76a2('0x4'));var simpleParser=require(_0x76a2('0x5'))['simpleParser'];var Iconv=require(_0x76a2('0x6'))[_0x76a2('0x7')];var EventEmitter=require(_0x76a2('0x8'))['EventEmitter'];var utils=require(_0x76a2('0x9'));var logger=require(_0x76a2('0xa'))('email');function EmailImap(_0x44753c,_0x34225c){this[_0x76a2('0xb')]=_0x76a2('0xc');this[_0x76a2('0xd')]=this[_0x76a2('0xe')](_0x44753c,_0x34225c);this['imap']=new Imap(this[_0x76a2('0xd')]);this[_0x76a2('0x2')][_0x76a2('0xf')](_0x76a2('0x10'),this[_0x76a2('0x11')][_0x76a2('0x12')](this));this[_0x76a2('0x2')][_0x76a2('0xf')](_0x76a2('0x13'),this[_0x76a2('0x14')][_0x76a2('0x12')](this));this[_0x76a2('0x2')]['on'](_0x76a2('0x15'),this['handleError'][_0x76a2('0x12')](this));this['imap'][_0x76a2('0x16')]();}util[_0x76a2('0x17')](EmailImap,EventEmitter);EmailImap[_0x76a2('0x18')][_0x76a2('0xe')]=function(_0x5d73bd,_0x5a1ebb){var _0x38dced={'connTimeout':_0x5d73bd['connTimeout']?_0x5d73bd[_0x76a2('0x19')]*0x3e8:0x2710,'authTimeout':_0x5d73bd[_0x76a2('0x1a')]?_0x5d73bd[_0x76a2('0x1a')]*0x3e8:0x1388};if(_[_0x76a2('0x1b')](_0x5d73bd[_0x76a2('0x1c')])){if(_0x5d73bd['authentication']){_0x38dced[_0x76a2('0x1d')]=_0x5d73bd[_0x76a2('0x1d')];_0x38dced[_0x76a2('0x1e')]=_0x5d73bd[_0x76a2('0x1e')];}_0x38dced[_0x76a2('0x1f')]=_0x5d73bd[_0x76a2('0x1f')];_0x38dced['port']=_0x5d73bd[_0x76a2('0x20')]||0x3e1;if(_0x5d73bd[_0x76a2('0x21')]){_0x38dced[_0x76a2('0x21')]=!![];}else{_0x38dced['tls']=![];_0x38dced['autotls']=_0x76a2('0x22');}}else{_0x38dced[_0x76a2('0x1d')]=_0x5d73bd['user'];_0x38dced[_0x76a2('0x1e')]=_0x5d73bd['password'];_0x38dced[_0x76a2('0x1f')]=utils[_0x76a2('0x23')](_0x5d73bd[_0x76a2('0x1c')]);_0x38dced[_0x76a2('0x20')]=0x3e1;_0x38dced[_0x76a2('0x21')]=!![];}_0x38dced[_0x76a2('0x24')]=_0x5a1ebb||_0x5d73bd['user']||_0x76a2('0x25');return _0x38dced;};EmailImap[_0x76a2('0x18')][_0x76a2('0x11')]=function(){this[_0x76a2('0x2')][_0x76a2('0x26')](this[_0x76a2('0xb')],![],this[_0x76a2('0x27')][_0x76a2('0x12')](this));};EmailImap[_0x76a2('0x18')]['handleOpenBox']=function(_0x2f6af4,_0x135a6a){if(_0x2f6af4){this['handleError'](_0x2f6af4,!![]);}else{this['emit'](_0x76a2('0x28'),_0x135a6a);this[_0x76a2('0x29')]();}};EmailImap[_0x76a2('0x18')][_0x76a2('0x2a')]=function(_0x36911e){if(_0x36911e){this[_0x76a2('0x2b')](_0x36911e,!![]);}else{this[_0x76a2('0x2')]['end']();}};EmailImap['prototype'][_0x76a2('0x29')]=function(){this[_0x76a2('0x2')]['search']([_0x76a2('0x2c')],this[_0x76a2('0x2d')][_0x76a2('0x12')](this));};EmailImap[_0x76a2('0x18')][_0x76a2('0x2d')]=function(_0x3b35bf,_0x2ab023){if(_0x3b35bf){this[_0x76a2('0x2b')](_0x3b35bf,!![]);}else{if(_0x2ab023[_0x76a2('0x2e')]){try{var _0x4c4e8d=this[_0x76a2('0x2')][_0x76a2('0x2f')](_0x2ab023,{'bodies':'','markSeen':!![]});_0x4c4e8d['on']('message',this[_0x76a2('0x30')][_0x76a2('0x12')](this));_0x4c4e8d[_0x76a2('0xf')](_0x76a2('0x15'),this['handleFetchError'][_0x76a2('0x12')](this));_0x4c4e8d[_0x76a2('0xf')](_0x76a2('0x13'),this[_0x76a2('0x31')]['bind'](this));}catch(_0x3b46c1){logger['error'](_0x3b46c1);}}else{this[_0x76a2('0x2')][_0x76a2('0x32')](!![],this[_0x76a2('0x2a')][_0x76a2('0x12')](this));}}};EmailImap['prototype'][_0x76a2('0x30')]=function(_0x2b838a,_0x224c1a){_0x2b838a['on']('body',this[_0x76a2('0x33')][_0x76a2('0x12')](this));_0x2b838a['once']('attributes',this[_0x76a2('0x34')][_0x76a2('0x12')](this));_0x2b838a[_0x76a2('0xf')](_0x76a2('0x13'),this[_0x76a2('0x35')][_0x76a2('0x12')](this));};EmailImap['prototype'][_0x76a2('0x33')]=function(_0x489aea,_0x4b19c4){simpleParser(_0x489aea,{'Iconv':Iconv},this[_0x76a2('0x36')]['bind'](this));};EmailImap[_0x76a2('0x18')][_0x76a2('0x34')]=function(_0x27c6ec){};EmailImap[_0x76a2('0x18')][_0x76a2('0x35')]=function(){};EmailImap[_0x76a2('0x18')][_0x76a2('0x36')]=function(_0x3cefb3,_0x4dcbe6){if(_0x3cefb3){logger[_0x76a2('0x15')](_0x3cefb3);}else{var _0x121e26=this;utils[_0x76a2('0x37')](this[_0x76a2('0xd')],_0x4dcbe6,function(_0x2c2d37){_0x121e26[_0x76a2('0x38')](_0x76a2('0x24'),_0x2c2d37);});}};EmailImap[_0x76a2('0x18')][_0x76a2('0x31')]=function(){this[_0x76a2('0x2')]['closeBox'](!![],this[_0x76a2('0x2a')]['bind'](this));};EmailImap[_0x76a2('0x18')]['handleFetchError']=function(_0x3a9d5e){this[_0x76a2('0x2b')](_0x3a9d5e);this[_0x76a2('0x2')][_0x76a2('0x32')](!![],this['handleCloseBox'][_0x76a2('0x12')](this));};EmailImap[_0x76a2('0x18')][_0x76a2('0x14')]=function(){this[_0x76a2('0x38')](_0x76a2('0x13'));};EmailImap[_0x76a2('0x18')][_0x76a2('0x2b')]=function(_0x53c314,_0x4d8ed6){logger[_0x76a2('0x15')]('handleError',this[_0x76a2('0xd')][_0x76a2('0x24')],JSON[_0x76a2('0x39')](_0x53c314));var _0x5ccecd='';if(_0x53c314){if(_0x53c314['textCode']){_0x5ccecd=_0x53c314[_0x76a2('0x3a')];}else{for(var _0x4ad4d1 in _0x53c314){if(_0x53c314[_0x76a2('0x3b')](_0x4ad4d1)){_0x5ccecd+=_[_0x76a2('0x3c')](_0x4ad4d1)+':\x20'+_0x53c314[_0x4ad4d1]+'\x0a';}}}}if(_0x4d8ed6){this[_0x76a2('0x2')][_0x76a2('0x13')]();}else{this[_0x76a2('0x38')](_0x76a2('0x15'),_0x5ccecd);this[_0x76a2('0x38')](_0x76a2('0x13'));}};module[_0x76a2('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index cdeeb5d..26541ef 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 _0x8c6d=['nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile','sendMail','verify','toString','Not\x20verifired','exports'];(function(_0x4b31da,_0x4a61cf){var _0x15f102=function(_0x15ee2b){while(--_0x15ee2b){_0x4b31da['push'](_0x4b31da['shift']());}};_0x15f102(++_0x4a61cf);}(_0x8c6d,0xc6));var _0xd8c6=function(_0x59cdf7,_0xc220d7){_0x59cdf7=_0x59cdf7-0x0;var _0x22a2ea=_0x8c6d[_0x59cdf7];return _0x22a2ea;};'use strict';var nodemailer=require(_0xd8c6('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xd8c6('0x1'));function EmailSmtp(){}EmailSmtp[_0xd8c6('0x2')][_0xd8c6('0x3')]=function(_0xb63460,_0x3627fb){return new BPromise(function(_0xa6cb08,_0x11e197){var _0x2e1598=nodemailer[_0xd8c6('0x4')](_0xb63460);_0x2e1598['use'](_0xd8c6('0x5'),inlineBase64());_0x2e1598[_0xd8c6('0x6')](_0x3627fb,function(_0x4b32b1,_0x4695e8){if(_0x4b32b1){_0x11e197(_0x4b32b1['toString']());}else{_0xa6cb08(_0x4695e8);}});});};EmailSmtp[_0xd8c6('0x2')][_0xd8c6('0x7')]=function(_0x1f3830){return new BPromise(function(_0x94f054,_0x218177){var _0x3aa46b=nodemailer[_0xd8c6('0x4')](_0x1f3830);_0x3aa46b[_0xd8c6('0x7')](function(_0x151e01,_0x48bae4){if(_0x151e01){_0x218177(_0x151e01[_0xd8c6('0x8')]());}else{if(_0x48bae4){_0x94f054(_0x48bae4);}else{_0x218177(_0xd8c6('0x9'));}}});});};module[_0xd8c6('0xa')]=EmailSmtp; \ No newline at end of file +var _0xe51c=['nodemailer-plugin-inline-base64','prototype','send','createTransport','use','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','bluebird'];(function(_0x2c645b,_0x37bce6){var _0x109b76=function(_0x2b3e84){while(--_0x2b3e84){_0x2c645b['push'](_0x2c645b['shift']());}};_0x109b76(++_0x37bce6);}(_0xe51c,0xfa));var _0xce51=function(_0x305ad3,_0x244a36){_0x305ad3=_0x305ad3-0x0;var _0x3df215=_0xe51c[_0x305ad3];return _0x3df215;};'use strict';var nodemailer=require(_0xce51('0x0'));var BPromise=require(_0xce51('0x1'));var inlineBase64=require(_0xce51('0x2'));function EmailSmtp(){}EmailSmtp[_0xce51('0x3')][_0xce51('0x4')]=function(_0x389342,_0x383f43){return new BPromise(function(_0x3fe714,_0x3ed440){var _0x240c8b=nodemailer[_0xce51('0x5')](_0x389342);_0x240c8b[_0xce51('0x6')]('compile',inlineBase64());_0x240c8b[_0xce51('0x7')](_0x383f43,function(_0x3057d2,_0x12b3fb){if(_0x3057d2){_0x3ed440(_0x3057d2[_0xce51('0x8')]());}else{_0x3fe714(_0x12b3fb);}});});};EmailSmtp[_0xce51('0x3')][_0xce51('0x9')]=function(_0xb7dca4){return new BPromise(function(_0x219ee7,_0x96f29){var _0x89d7d6=nodemailer[_0xce51('0x5')](_0xb7dca4);_0x89d7d6[_0xce51('0x9')](function(_0x5becff,_0xdd426e){if(_0x5becff){_0x96f29(_0x5becff[_0xce51('0x8')]());}else{if(_0xdd426e){_0x219ee7(_0xdd426e);}else{_0x96f29(_0xce51('0xa'));}}});});};module[_0xce51('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 99786db..0bef075 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 _0x8fcd=['Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','push','Title','Data','gmail','yahoo','hotmail','imap-mail.outlook.com','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','email','../../../config/environment','head','value','anonymous','@xcally.com','name','substring','split','slice','join','Anonymous','length','pop','address','isEmpty','generate','html','replace','attachments','forEach','filename','_SRC','body','textAsHtml','message','originTo','originCc','includes','bcc','attach','type','attachment','attachment-','%s-%s','root','server/files/attachments/','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','indexOf','isAutoreply','parser','from','subject','messageId','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef'];(function(_0x224d4c,_0x26e3a8){var _0x153b37=function(_0x45ed64){while(--_0x45ed64){_0x224d4c['push'](_0x224d4c['shift']());}};_0x153b37(++_0x26e3a8);}(_0x8fcd,0xa1));var _0xd8fc=function(_0x532574,_0x2ce799){_0x532574=_0x532574-0x0;var _0x2b4cbe=_0x8fcd[_0x532574];return _0x2b4cbe;};'use strict';var _=require(_0xd8fc('0x0'));var moment=require(_0xd8fc('0x1'));var random=require(_0xd8fc('0x2'));var fs=require('fs');var path=require(_0xd8fc('0x3'));var util=require(_0xd8fc('0x4'));var tnef=require('node-tnef');var logger=require('../../../config/logger')(_0xd8fc('0x5'));var config=require(_0xd8fc('0x6'));function getAddress(_0x41aaf1){var _0x2d5000=_[_0xd8fc('0x7')](_0x41aaf1[_0xd8fc('0x8')]);return _0x2d5000&&_0x2d5000['address']?_0x2d5000['address']:_0xd8fc('0x9')+random['generate'](0x6)+_0xd8fc('0xa');}function getFirstName(_0x1519e5){var _0x102bb8=_[_0xd8fc('0x7')](_0x1519e5['value']);if(_0x102bb8&&_0x102bb8['name']){if(_0x102bb8[_0xd8fc('0xb')]==_0x102bb8['address']){return _0x102bb8['name'][_0xd8fc('0xc')](0x0,_0x102bb8[_0xd8fc('0xb')]['indexOf']('@'));}var _0x4f3823=_0x102bb8[_0xd8fc('0xb')][_0xd8fc('0xd')](/\s+/);return _0x4f3823['length']>0x1?_0x4f3823[_0xd8fc('0xe')](0x0,-0x1)[_0xd8fc('0xf')]('\x20'):_0x102bb8[_0xd8fc('0xb')];}return _0xd8fc('0x10');}function getLastName(_0xcfeaa){var _0x5c20f1=_[_0xd8fc('0x7')](_0xcfeaa['value']);if(_0x5c20f1&&_0x5c20f1[_0xd8fc('0xb')]){var _0x231ea3=_0x5c20f1[_0xd8fc('0xb')]['split'](/\s+/);return _0x231ea3[_0xd8fc('0x11')]>0x1?_0x231ea3[_0xd8fc('0x12')]():'';}return'';}function getMails(_0x57838b,_0x49c450){var _0x234cfd='';for(var _0x234b4d=0x0;_0x234b4d<_0x49c450[_0xd8fc('0x8')]['length'];_0x234b4d+=0x1){if(_0x49c450[_0xd8fc('0x8')][_0x234b4d][_0xd8fc('0x13')]!==_0x57838b){if(!_[_0xd8fc('0x14')](_0x234cfd)){_0x234cfd+=',';}_0x234cfd+=_0x49c450[_0xd8fc('0x8')][_0x234b4d][_0xd8fc('0xb')]||_0x49c450[_0xd8fc('0x8')][_0x234b4d][_0xd8fc('0x13')]||'';_0x234cfd+='\x20<';_0x234cfd+=_0x49c450[_0xd8fc('0x8')][_0x234b4d][_0xd8fc('0x13')]?_0x49c450['value'][_0x234b4d][_0xd8fc('0x13')]:_0xd8fc('0x9')+random[_0xd8fc('0x15')](0x6)+_0xd8fc('0xa');_0x234cfd+='>';}}return _0x234cfd;}function parseEmail(_0x24ae45,_0xd24b3f,_0x4fec5c){if(_0xd24b3f[_0xd8fc('0x16')]){var _0x3f0196=/)<[^<]*)*<\/script>/gi;while(_0x3f0196['test'](_0xd24b3f[_0xd8fc('0x16')])){_0xd24b3f['html']=_0xd24b3f[_0xd8fc('0x16')][_0xd8fc('0x17')](_0x3f0196,'');}if(_0xd24b3f['html']['includes']('{_0xc0202b['push'](_0x25d8ae[_0xd8fc('0x1a')]);});var _0x45ac21=/]+>/g;var _0x54f1a5=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x270204=_0xd24b3f['html'][_0xd8fc('0x17')](_0x54f1a5,_0xd8fc('0x1b'));var _0x454a77=_0x270204[_0xd8fc('0x17')](_0x45ac21,'_IMG');for(let _0x9d29b4=0x0;_0x9d29b4<_0xc0202b['length'];_0x9d29b4++){var _0x1f4577=_0x454a77[_0xd8fc('0x17')]('_IMG','\x20[Attachment:\x20'+_0xc0202b[_0x9d29b4]+'\x20]');_0x454a77=_0x1f4577;}_0xd24b3f[_0xd8fc('0x16')]=_0x454a77;}_0x4fec5c[_0xd8fc('0x1c')]=_0xd24b3f[_0xd8fc('0x16')];}else{_0x4fec5c[_0xd8fc('0x1c')]=_0xd24b3f[_0xd8fc('0x1d')];}if(_0x4fec5c[_0xd8fc('0x1c')]){_0x4fec5c[_0xd8fc('0x1c')]=_0x4fec5c[_0xd8fc('0x1c')][_0xd8fc('0x17')](/0x0){var _0x3ba4fb=[_0xd8fc('0x2c'),_0xd8fc('0x2d'),'Precedence:\x20auto_reply'];for(var _0x5a153a=0x0;_0x5a153a<_0xd24b3f['headerLines'][_0xd8fc('0x11')];_0x5a153a++){var _0x360ef7=_[_0xd8fc('0x2e')](_0x3ba4fb,_0xd24b3f[_0xd8fc('0x2b')][_0x5a153a]['line']);if(_0x360ef7>=0x0){_0x4fec5c[_0xd8fc('0x2f')]=!![];}}}return _0x4fec5c;}exports[_0xd8fc('0x30')]=function(_0xaaa4b2,_0x126ff4,_0x20e66a){var _0x29cea4={'from':getAddress(_0x126ff4[_0xd8fc('0x31')]),'firstName':getFirstName(_0x126ff4['from']),'lastName':getLastName(_0x126ff4[_0xd8fc('0x31')]),'mapKey':_0xd8fc('0x5'),'message':{'from':getMails(_0xaaa4b2['email'],_0x126ff4[_0xd8fc('0x31')]),'to':_0xaaa4b2[_0xd8fc('0x5')],'cc':'','subject':_0x126ff4[_0xd8fc('0x32')]||'','messageId':_0x126ff4[_0xd8fc('0x33')],'inReplyTo':_0x126ff4[_0xd8fc('0x34')],'sentAt':moment(_0x126ff4[_0xd8fc('0x35')])[_0xd8fc('0x36')](_0xd8fc('0x37')),'attach':![],'attachments':[]}};if(!_0x126ff4[_0xd8fc('0x16')]&&!_0x126ff4[_0xd8fc('0x1d')]){var _0x3e1392=_[_0xd8fc('0x38')](_0x126ff4[_0xd8fc('0x18')],{'contentType':_0xd8fc('0x39')});if(_0x3e1392['length']){logger['info'](util['format'](_0xd8fc('0x3a'),_0x126ff4[_0xd8fc('0x33')]));tnef[_0xd8fc('0x3b')](_[_0xd8fc('0x3c')](_0x3e1392)['content'],function(_0x1495b1,_0x10f735){if(_0x10f735){_0x126ff4[_0xd8fc('0x16')]=_0x10f735[_0xd8fc('0x3d')]||_0xd8fc('0x3e');if(_0x10f735[_0xd8fc('0x3f')]){for(var _0xc12ace=0x0;_0xc12ace<_0x10f735['Attachments']['length'];_0xc12ace++){var _0x54eb6b=_0x10f735[_0xd8fc('0x3f')][_0xc12ace];_0x29cea4[_0xd8fc('0x1e')][_0xd8fc('0x18')][_0xd8fc('0x40')]({'filename':_0x54eb6b[_0xd8fc('0x41')],'content':Buffer[_0xd8fc('0x31')](_0x54eb6b[_0xd8fc('0x42')])});}}}_0x20e66a(parseEmail(_0xaaa4b2,_0x126ff4,_0x29cea4));});}else{_0x126ff4[_0xd8fc('0x16')]=_0xd8fc('0x3e');_0x20e66a(parseEmail(_0xaaa4b2,_0x126ff4,_0x29cea4));}}else{_0x20e66a(parseEmail(_0xaaa4b2,_0x126ff4,_0x29cea4));}};exports['getHost']=function(_0x4a2c1b){switch(_0x4a2c1b){case _0xd8fc('0x43'):return'imap.gmail.com';case _0xd8fc('0x44'):return'imap.mail.yahoo.com';case _0xd8fc('0x45'):return _0xd8fc('0x46');case'outlook365':return _0xd8fc('0x47');}return _0xd8fc('0x48');}; \ No newline at end of file +var _0x7d8a=['line','isAutoreply','from','date','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','format','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','Attachments','Title','imap.gmail.com','yahoo','imap.mail.yahoo.com','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','indexOf','length','slice','join','Anonymous','split','pop','isEmpty','html','test','includes','attachments','forEach','push','filename','replace','_IMG','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x51eb9e[_0xa7d8('0x12')](0x0,-0x1)[_0xa7d8('0x13')]('\x20'):_0xb1602['name'];}return _0xa7d8('0x14');}function getLastName(_0x137919){var _0x5c8151=_['head'](_0x137919['value']);if(_0x5c8151&&_0x5c8151[_0xa7d8('0xf')]){var _0x1121d=_0x5c8151[_0xa7d8('0xf')][_0xa7d8('0x15')](/\s+/);return _0x1121d[_0xa7d8('0x11')]>0x1?_0x1121d[_0xa7d8('0x16')]():'';}return'';}function getMails(_0x2bbaf4,_0x21bc56){var _0x42e957='';for(var _0xfc0284=0x0;_0xfc0284<_0x21bc56[_0xa7d8('0xa')][_0xa7d8('0x11')];_0xfc0284+=0x1){if(_0x21bc56[_0xa7d8('0xa')][_0xfc0284]['address']!==_0x2bbaf4){if(!_[_0xa7d8('0x17')](_0x42e957)){_0x42e957+=',';}_0x42e957+=_0x21bc56[_0xa7d8('0xa')][_0xfc0284]['name']||_0x21bc56[_0xa7d8('0xa')][_0xfc0284][_0xa7d8('0xb')]||'';_0x42e957+='\x20<';_0x42e957+=_0x21bc56[_0xa7d8('0xa')][_0xfc0284][_0xa7d8('0xb')]?_0x21bc56['value'][_0xfc0284][_0xa7d8('0xb')]:'anonymous'+random[_0xa7d8('0xd')](0x6)+_0xa7d8('0xe');_0x42e957+='>';}}return _0x42e957;}function parseEmail(_0x559771,_0x381fca,_0x108a6d){if(_0x381fca[_0xa7d8('0x18')]){var _0x426a20=/)<[^<]*)*<\/script>/gi;while(_0x426a20[_0xa7d8('0x19')](_0x381fca['html'])){_0x381fca[_0xa7d8('0x18')]=_0x381fca[_0xa7d8('0x18')]['replace'](_0x426a20,'');}if(_0x381fca[_0xa7d8('0x18')][_0xa7d8('0x1a')]('{_0xd09e17[_0xa7d8('0x1d')](_0x22a1f2[_0xa7d8('0x1e')]);});var _0x2d3f0d=/]+>/g;var _0x5392a1=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2aed5b=_0x381fca['html'][_0xa7d8('0x1f')](_0x5392a1,'_SRC');var _0x53c475=_0x2aed5b['replace'](_0x2d3f0d,'_IMG');for(let _0x45b800=0x0;_0x45b800<_0xd09e17[_0xa7d8('0x11')];_0x45b800++){var _0x5ae36c=_0x53c475[_0xa7d8('0x1f')](_0xa7d8('0x20'),_0xa7d8('0x21')+_0xd09e17[_0x45b800]+'\x20]');_0x53c475=_0x5ae36c;}_0x381fca[_0xa7d8('0x18')]=_0x53c475;}_0x108a6d[_0xa7d8('0x22')]=_0x381fca[_0xa7d8('0x18')];}else{_0x108a6d['body']=_0x381fca[_0xa7d8('0x23')];}if(_0x108a6d[_0xa7d8('0x22')]){_0x108a6d['body']=_0x108a6d['body'][_0xa7d8('0x1f')](/0x0){var _0x2d8699=[_0xa7d8('0x32'),_0xa7d8('0x33'),_0xa7d8('0x34')];for(var _0x13e9f2=0x0;_0x13e9f2<_0x381fca[_0xa7d8('0x31')][_0xa7d8('0x11')];_0x13e9f2++){var _0x2ef2be=_[_0xa7d8('0x10')](_0x2d8699,_0x381fca[_0xa7d8('0x31')][_0x13e9f2][_0xa7d8('0x35')]);if(_0x2ef2be>=0x0){_0x108a6d[_0xa7d8('0x36')]=!![];}}}return _0x108a6d;}exports['parser']=function(_0x506efa,_0x1e8896,_0x2c7dd6){var _0xc8f95a={'from':getAddress(_0x1e8896[_0xa7d8('0x37')]),'firstName':getFirstName(_0x1e8896[_0xa7d8('0x37')]),'lastName':getLastName(_0x1e8896['from']),'mapKey':_0xa7d8('0x7'),'message':{'from':getMails(_0x506efa[_0xa7d8('0x7')],_0x1e8896[_0xa7d8('0x37')]),'to':_0x506efa[_0xa7d8('0x7')],'cc':'','subject':_0x1e8896['subject']||'','messageId':_0x1e8896['messageId'],'inReplyTo':_0x1e8896['inReplyTo'],'sentAt':moment(_0x1e8896[_0xa7d8('0x38')])['format'](_0xa7d8('0x39')),'attach':![],'attachments':[]}};if(!_0x1e8896[_0xa7d8('0x18')]&&!_0x1e8896[_0xa7d8('0x23')]){var _0x48763c=_['filter'](_0x1e8896[_0xa7d8('0x1b')],{'contentType':_0xa7d8('0x3a')});if(_0x48763c[_0xa7d8('0x11')]){logger[_0xa7d8('0x3b')](util[_0xa7d8('0x3c')](_0xa7d8('0x3d'),_0x1e8896[_0xa7d8('0x3e')]));tnef[_0xa7d8('0x3f')](_[_0xa7d8('0x40')](_0x48763c)[_0xa7d8('0x30')],function(_0x141f47,_0x430297){if(_0x430297){_0x1e8896['html']=_0x430297[_0xa7d8('0x41')]||'

Empty\x20message

';if(_0x430297[_0xa7d8('0x42')]){for(var _0x5666e6=0x0;_0x5666e6<_0x430297[_0xa7d8('0x42')][_0xa7d8('0x11')];_0x5666e6++){var _0x284dbc=_0x430297[_0xa7d8('0x42')][_0x5666e6];_0xc8f95a[_0xa7d8('0x25')][_0xa7d8('0x1b')]['push']({'filename':_0x284dbc[_0xa7d8('0x43')],'content':Buffer[_0xa7d8('0x37')](_0x284dbc['Data'])});}}}_0x2c7dd6(parseEmail(_0x506efa,_0x1e8896,_0xc8f95a));});}else{_0x1e8896['html']='

Empty\x20message

';_0x2c7dd6(parseEmail(_0x506efa,_0x1e8896,_0xc8f95a));}}else{_0x2c7dd6(parseEmail(_0x506efa,_0x1e8896,_0xc8f95a));}};exports['getHost']=function(_0x3e089c){switch(_0x3e089c){case'gmail':return _0xa7d8('0x44');case _0xa7d8('0x45'):return _0xa7d8('0x46');case'hotmail':return'imap-mail.outlook.com';case'outlook365':return _0xa7d8('0x47');}return _0xa7d8('0x48');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 8cc869c..3a0999e 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 _0xb12a=['name','Service','key','SERV','active','Imap','Smtp','exports'];(function(_0x4254e7,_0x4fc342){var _0x5e0844=function(_0x3a92c7){while(--_0x3a92c7){_0x4254e7['push'](_0x4254e7['shift']());}};_0x5e0844(++_0x4fc342);}(_0xb12a,0x148));var _0xab12=function(_0x5c464b,_0x3c85aa){_0x5c464b=_0x5c464b-0x0;var _0x7cb711=_0xb12a[_0x5c464b];return _0x7cb711;};'use strict';var _=require('lodash');function MailAccount(_0x28ac5d){this['id']=_0x28ac5d['id']||0x0;this[_0xab12('0x0')]=_0x28ac5d[_0xab12('0x0')]||_0xab12('0x1');this['key']=_0x28ac5d[_0xab12('0x2')]||_0xab12('0x3');this['active']=_0x28ac5d[_0xab12('0x4')]||![];this[_0xab12('0x5')]=_0x28ac5d['Imap']||[];this[_0xab12('0x6')]=_0x28ac5d[_0xab12('0x6')]||[];}module[_0xab12('0x7')]=MailAccount; \ No newline at end of file +var _0xb5dd=['exports','lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x4403b3,_0x4b73ae){var _0x281a6e=function(_0x20afa2){while(--_0x20afa2){_0x4403b3['push'](_0x4403b3['shift']());}};_0x281a6e(++_0x4b73ae);}(_0xb5dd,0xd9));var _0xdb5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb5dd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdb5d('0x0'));function MailAccount(_0x2cf077){this['id']=_0x2cf077['id']||0x0;this[_0xdb5d('0x1')]=_0x2cf077[_0xdb5d('0x1')]||_0xdb5d('0x2');this['key']=_0x2cf077[_0xdb5d('0x3')]||_0xdb5d('0x4');this[_0xdb5d('0x5')]=_0x2cf077['active']||![];this[_0xdb5d('0x6')]=_0x2cf077[_0xdb5d('0x6')]||[];this[_0xdb5d('0x7')]=_0x2cf077[_0xdb5d('0x7')]||[];}module[_0xdb5d('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 490faa1..95a70d4 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 _0xd199=['mailAccounts','mapKeys','prototype','hasOwnProperty','initMailAccounts','length','isUndefined','merge'];(function(_0x401609,_0x5eb61d){var _0x35fd57=function(_0x5dcddd){while(--_0x5dcddd){_0x401609['push'](_0x401609['shift']());}};_0x35fd57(++_0x5eb61d);}(_0xd199,0xe8));var _0x9d19=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd199[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x9d19('0x0')]={};};function freeIsNotKey(_0x420bdb,_0x8a9dab,_0x1b343d){var _0x4f29c5=_[_0x9d19('0x1')](_0x420bdb,function(_0x53e4c5,_0x4ce6cb){return _0x53e4c5[_0x1b343d];});for(var _0x3d894d in _0x8a9dab){if(_0x8a9dab['hasOwnProperty'](_0x3d894d)){if(!_0x4f29c5[_0x3d894d]){delete _0x8a9dab[_0x3d894d];}}}}Realtime[_0x9d19('0x2')]['mergeFromDatabase']=function(_0x3d174f,_0x568403){for(var _0x167a0f in _0x568403){if(_0x3d174f[_0x9d19('0x3')](_0x167a0f)){_0x3d174f[_0x167a0f]=_0x568403[_0x167a0f];}}};Realtime[_0x9d19('0x2')][_0x9d19('0x4')]=function(){var _0x32991c=this;return function(_0x28d402){if(_0x28d402){freeIsNotKey(_0x28d402,_0x32991c[_0x9d19('0x0')],'id');for(var _0x327d82=0x0,_0x3bc2a4={},_0x355d17={};_0x327d82<_0x28d402[_0x9d19('0x5')];_0x327d82+=0x1){_0x3bc2a4=_0x28d402[_0x327d82];if(_[_0x9d19('0x6')](_0x32991c[_0x9d19('0x0')][_0x3bc2a4['id']])){_0x32991c[_0x9d19('0x0')][_0x3bc2a4['id']]=new MailAccount(_0x3bc2a4);}else{_[_0x9d19('0x7')](_0x32991c[_0x9d19('0x0')][_0x3bc2a4['id']],_0x3bc2a4);}}}return _0x32991c[_0x9d19('0x0')];};};module['exports']=Realtime; \ No newline at end of file +var _0x54e2=['hasOwnProperty','prototype','initMailAccounts','length','merge','exports','lodash','mailAccounts','mapKeys'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x54e2,0x180));var _0x254e=function(_0x3b04a9,_0x203337){_0x3b04a9=_0x3b04a9-0x0;var _0x47ef88=_0x54e2[_0x3b04a9];return _0x47ef88;};'use strict';var _=require(_0x254e('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x254e('0x1')]={};};function freeIsNotKey(_0x3c1534,_0x2c576b,_0x45bf41){var _0xdae4=_[_0x254e('0x2')](_0x3c1534,function(_0x419047,_0x5e90d6){return _0x419047[_0x45bf41];});for(var _0x38ea6c in _0x2c576b){if(_0x2c576b[_0x254e('0x3')](_0x38ea6c)){if(!_0xdae4[_0x38ea6c]){delete _0x2c576b[_0x38ea6c];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x100115,_0x1ae2a1){for(var _0x2d22cc in _0x1ae2a1){if(_0x100115[_0x254e('0x3')](_0x2d22cc)){_0x100115[_0x2d22cc]=_0x1ae2a1[_0x2d22cc];}}};Realtime[_0x254e('0x4')][_0x254e('0x5')]=function(){var _0x158a34=this;return function(_0x329e00){if(_0x329e00){freeIsNotKey(_0x329e00,_0x158a34[_0x254e('0x1')],'id');for(var _0x3b7dfd=0x0,_0x25f1f4={},_0x5c18b3={};_0x3b7dfd<_0x329e00[_0x254e('0x6')];_0x3b7dfd+=0x1){_0x25f1f4=_0x329e00[_0x3b7dfd];if(_['isUndefined'](_0x158a34[_0x254e('0x1')][_0x25f1f4['id']])){_0x158a34[_0x254e('0x1')][_0x25f1f4['id']]=new MailAccount(_0x25f1f4);}else{_[_0x254e('0x7')](_0x158a34[_0x254e('0x1')][_0x25f1f4['id']],_0x25f1f4);}}}return _0x158a34['mailAccounts'];};};module[_0x254e('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 cc8bcb6..9e9b4dd 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 _0x1a0a=['NotifyMailAccount','../client','Request','GetMailAccount','service','email','key','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount','notify'];(function(_0x5d0a06,_0x2f8043){var _0x2350ca=function(_0xcda60d){while(--_0xcda60d){_0x5d0a06['push'](_0x5d0a06['shift']());}};_0x2350ca(++_0x2f8043);}(_0x1a0a,0x196));var _0xa1a0=function(_0x13fcaf,_0x416c69){_0x13fcaf=_0x13fcaf-0x0;var _0x4fa631=_0x1a0a[_0x13fcaf];return _0x4fa631;};'use strict';var client=require(_0xa1a0('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xa1a0('0x1')](_0xa1a0('0x2'),{'options':{'attributes':['id','name',_0xa1a0('0x3'),_0xa1a0('0x4'),'active',_0xa1a0('0x5'),_0xa1a0('0x6'),_0xa1a0('0x7')],'raw':![],'include':[{'model':_0xa1a0('0x8'),'as':_0xa1a0('0x9')},{'model':_0xa1a0('0xa'),'as':_0xa1a0('0xb')}]},'log':_0xa1a0('0xc')});};};exports[_0xa1a0('0xd')]=function(_0x25e581,_0x1cb54f){return client['Request'](_0xa1a0('0xe'),{'account':{'id':_0x25e581},'body':_0x1cb54f,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x1537=['MailServerOut','Smtp','getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name','service','email','active','ListId','MailServerIn'];(function(_0x55fbc1,_0x169019){var _0x17e813=function(_0x1c7a54){while(--_0x1c7a54){_0x55fbc1['push'](_0x55fbc1['shift']());}};_0x17e813(++_0x169019);}(_0x1537,0x132));var _0x7153=function(_0x54416f,_0xd5dc73){_0x54416f=_0x54416f-0x0;var _0x4792b3=_0x1537[_0x54416f];return _0x4792b3;};'use strict';var client=require(_0x7153('0x0'));exports[_0x7153('0x1')]=function(){return function(){return client['Request'](_0x7153('0x2'),{'options':{'attributes':['id',_0x7153('0x3'),_0x7153('0x4'),_0x7153('0x5'),_0x7153('0x6'),'key',_0x7153('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0x7153('0x8'),'as':'Imap'},{'model':_0x7153('0x9'),'as':_0x7153('0xa')}]},'log':_0x7153('0xb')});};};exports[_0x7153('0xc')]=function(_0x399c45,_0x2baa85){return client[_0x7153('0xd')]('NotifyMailAccount',{'account':{'id':_0x399c45},'body':_0x2baa85,'log':_0x7153('0xe')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 369399b..6988801 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 _0x373a=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x4299a3,_0x3395bd){var _0x3072cf=function(_0x37ce46){while(--_0x37ce46){_0x4299a3['push'](_0x4299a3['shift']());}};_0x3072cf(++_0x3395bd);}(_0x373a,0x1db));var _0xa373=function(_0x42998b,_0x742f22){_0x42998b=_0x42998b-0x0;var _0x3005f5=_0x373a[_0x42998b];return _0x3005f5;};'use strict';var client=require(_0xa373('0x0'));exports[_0xa373('0x1')]=function(){return client[_0xa373('0x2')](_0xa373('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa373('0x4')]},'log':_0xa373('0x5')});}; \ No newline at end of file +var _0xd72c=['loginMailFrequency','GetSettings','Request','ShowSetting'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd72c,0x1e6));var _0xcd72=function(_0x4f22d0,_0x348a25){_0x4f22d0=_0x4f22d0-0x0;var _0x32324d=_0xd72c[_0x4f22d0];return _0x32324d;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xcd72('0x0')](_0xcd72('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xcd72('0x2')]},'log':_0xcd72('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index c79ddec..ddbe29f 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(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 162bd56..7a6a77e 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 _0x3e60=['exports','lodash','http','express','sticky-session','../../config/environment','createServer','port','polling','defaults','redis','localhost','adapter','default','../../config/socketio','../../config/express','../../routes','log','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x4de003,_0x1677e9){var _0x2875b9=function(_0x686fda){while(--_0x686fda){_0x4de003['push'](_0x4de003['shift']());}};_0x2875b9(++_0x1677e9);}(_0x3e60,0xe5));var _0x03e6=function(_0x3b9d5f,_0x2e9039){_0x3b9d5f=_0x3b9d5f-0x0;var _0x39924e=_0x3e60[_0x3b9d5f];return _0x39924e;};'use strict';var _=require(_0x03e6('0x0'));var http=require(_0x03e6('0x1'));var express=require(_0x03e6('0x2'));var sticky=require(_0x03e6('0x3'));var Redis=require('ioredis');var config=require(_0x03e6('0x4'));var app=express();var server=http[_0x03e6('0x5')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0x03e6('0x6')])){var socketio=require('socket.io')(server,{'transports':['websocket',_0x03e6('0x7')]});config['redis']=_[_0x03e6('0x8')](config[_0x03e6('0x9')],{'host':_0x03e6('0xa'),'port':0x18eb});socketio[_0x03e6('0xb')](require('socket.io-redis')({'pubClient':new Redis(config[_0x03e6('0x9')]),'subClient':new Redis(config[_0x03e6('0x9')])}));require('../../config/triggers')[_0x03e6('0xc')]();require(_0x03e6('0xd'))[_0x03e6('0xc')](socketio);require(_0x03e6('0xe'))[_0x03e6('0xc')](app);require(_0x03e6('0xf'))[_0x03e6('0xc')](app);}else{server['once']('listening',function(){console[_0x03e6('0x10')](_0x03e6('0x11'),config[_0x03e6('0x6')]);});}exports=module[_0x03e6('0x12')]=app; \ No newline at end of file +var _0xd440=['adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','timeout','listen','port','websocket','redis','localhost'];(function(_0x258559,_0x3756b7){var _0x5d3d25=function(_0x16f97e){while(--_0x16f97e){_0x258559['push'](_0x258559['shift']());}};_0x5d3d25(++_0x3756b7);}(_0xd440,0xba));var _0x0d44=function(_0xd9706e,_0x272e1c){_0xd9706e=_0xd9706e-0x0;var _0x54c7b7=_0xd440[_0xd9706e];return _0x54c7b7;};'use strict';var _=require(_0x0d44('0x0'));var http=require(_0x0d44('0x1'));var express=require(_0x0d44('0x2'));var sticky=require(_0x0d44('0x3'));var Redis=require(_0x0d44('0x4'));var config=require(_0x0d44('0x5'));var app=express();var server=http['createServer'](app);server[_0x0d44('0x6')]=0xdbba0;if(sticky[_0x0d44('0x7')](server,config[_0x0d44('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0x0d44('0x9'),'polling']});config[_0x0d44('0xa')]=_['defaults'](config[_0x0d44('0xa')],{'host':_0x0d44('0xb'),'port':0x18eb});socketio[_0x0d44('0xc')](require(_0x0d44('0xd'))({'pubClient':new Redis(config[_0x0d44('0xa')]),'subClient':new Redis(config['redis'])}));require(_0x0d44('0xe'))['default']();require(_0x0d44('0xf'))[_0x0d44('0x10')](socketio);require('../../config/express')['default'](app);require('../../routes')[_0x0d44('0x10')](app);}else{server[_0x0d44('0x11')](_0x0d44('0x12'),function(){console[_0x0d44('0x13')](_0x0d44('0x14'),config[_0x0d44('0x8')]);});}exports=module[_0x0d44('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 891db70..7d4235c 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 _0x84ed=['catch','exports','jayson/promise','routing','client','Request','then','debug','error','rpc','result'];(function(_0x9c1308,_0x2eb458){var _0x329056=function(_0x3ac952){while(--_0x3ac952){_0x9c1308['push'](_0x9c1308['shift']());}};_0x329056(++_0x2eb458);}(_0x84ed,0x12b));var _0xd84e=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x84ed[_0x465028];return _0xb783d4;};'use strict';var jayson=require(_0xd84e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0xd84e('0x1'));var client=jayson[_0xd84e('0x2')]['http']({'port':0x2329});client[_0xd84e('0x3')]=function(_0x50aac6,_0x5d2027){return new BPromise(function(_0x493d99,_0x15b460){return client['request'](_0x50aac6,_0x5d2027)[_0xd84e('0x4')](function(_0x1c49fe){logger[_0xd84e('0x5')]('rpc',_0xd84e('0x1'),_0x50aac6,_0x5d2027,_0x1c49fe);if(_0x1c49fe[_0xd84e('0x6')]){logger['error'](_0xd84e('0x7'),_0xd84e('0x1'),_0x50aac6,_0x1c49fe['error']['message'],_0x5d2027);return _0x15b460(_0x1c49fe['error']['message']);}else{return _0x493d99(_0x1c49fe[_0xd84e('0x8')]);}})[_0xd84e('0x9')](function(_0x40eab1){logger[_0xd84e('0x6')](_0xd84e('0x7'),'routing',_0x50aac6,_0x40eab1,_0x5d2027);return _0x15b460(_0x40eab1);});});};module[_0xd84e('0xa')]=client; \ No newline at end of file +var _0x3fc9=['rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','Request','request','then','debug'];(function(_0x3a6a48,_0x21d59b){var _0x2e5386=function(_0x3f8ebc){while(--_0x3f8ebc){_0x3a6a48['push'](_0x3a6a48['shift']());}};_0x2e5386(++_0x21d59b);}(_0x3fc9,0x12c));var _0x93fc=function(_0x3feccc,_0x5534c7){_0x3feccc=_0x3feccc-0x0;var _0x2c13b5=_0x3fc9[_0x3feccc];return _0x2c13b5;};'use strict';var jayson=require(_0x93fc('0x0'));var BPromise=require(_0x93fc('0x1'));var logger=require(_0x93fc('0x2'))(_0x93fc('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x93fc('0x4')]=function(_0x33d283,_0x37610e){return new BPromise(function(_0x824469,_0x4572f7){return client[_0x93fc('0x5')](_0x33d283,_0x37610e)[_0x93fc('0x6')](function(_0x14deb1){logger[_0x93fc('0x7')]('rpc',_0x93fc('0x3'),_0x33d283,_0x37610e,_0x14deb1);if(_0x14deb1['error']){logger['error'](_0x93fc('0x8'),_0x93fc('0x3'),_0x33d283,_0x14deb1[_0x93fc('0x9')][_0x93fc('0xa')],_0x37610e);return _0x4572f7(_0x14deb1[_0x93fc('0x9')][_0x93fc('0xa')]);}else{return _0x824469(_0x14deb1[_0x93fc('0xb')]);}})[_0x93fc('0xc')](function(_0x3f66ca){logger[_0x93fc('0x9')]('rpc',_0x93fc('0x3'),_0x33d283,_0x3f66ca,_0x37610e);return _0x4572f7(_0x3f66ca);});});};module[_0x93fc('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 3df9c07..9f7050d 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 _0xbe3d=['getSmsQueues','initSmsQueues','initFaxQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','initAgents','then','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues'];(function(_0x3fc980,_0x355d23){var _0x419f1c=function(_0x2a02a8){while(--_0x2a02a8){_0x3fc980['push'](_0x3fc980['shift']());}};_0x419f1c(++_0x355d23);}(_0xbe3d,0xee));var _0xdbe3=function(_0x17887e,_0x94c87){_0x17887e=_0x17887e-0x0;var _0x1b0752=_0xbe3d[_0x17887e];return _0x1b0752;};'use strict';var BPromise=require(_0xdbe3('0x0'));var server=require(_0xdbe3('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0xdbe3('0x2'));var openchannelQueue=require(_0xdbe3('0x3'));var chatQueue=require(_0xdbe3('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xdbe3('0x5'));var faxQueue=require(_0xdbe3('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xdbe3('0x7')]()['then'](user['getAgents']())['then'](realtime[_0xdbe3('0x8')]())['then'](interval['getIntervals']())[_0xdbe3('0x9')](realtime[_0xdbe3('0xa')]())[_0xdbe3('0x9')](openchannelQueue[_0xdbe3('0xb')]())[_0xdbe3('0x9')](realtime[_0xdbe3('0xc')]())[_0xdbe3('0x9')](chatQueue['getChatQueues']())[_0xdbe3('0x9')](realtime[_0xdbe3('0xd')]())[_0xdbe3('0x9')](smsQueue[_0xdbe3('0xe')]())[_0xdbe3('0x9')](realtime[_0xdbe3('0xf')]())[_0xdbe3('0x9')](mailQueue['getMailQueues']())[_0xdbe3('0x9')](realtime['initMailQueues']())[_0xdbe3('0x9')](faxQueue['getFaxQueues']())[_0xdbe3('0x9')](realtime[_0xdbe3('0x10')]())['then'](whatsappQueue['getWhatsappQueues']())[_0xdbe3('0x9')](realtime[_0xdbe3('0x11')]())[_0xdbe3('0x9')](function(){return realtime;});}function main(){return server[_0xdbe3('0x12')](realtime)['then'](function(_0x302833){return initRealtime();})[_0xdbe3('0x9')](function(_0x225a1f){return setInterval(initRealtime,0x1388);})[_0xdbe3('0x13')](function(_0x45f08e){console[_0xdbe3('0x14')](_0x45f08e);});}main(); \ No newline at end of file +var _0xbc51=['initWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','getAgents','initAgents','then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues'];(function(_0x1fb197,_0x2a09f8){var _0x254c10=function(_0x5cd3f8){while(--_0x5cd3f8){_0x1fb197['push'](_0x1fb197['shift']());}};_0x254c10(++_0x2a09f8);}(_0xbc51,0x117));var _0x1bc5=function(_0x4c2f30,_0xa91340){_0x4c2f30=_0x4c2f30-0x0;var _0xb8854d=_0xbc51[_0x4c2f30];return _0xb8854d;};'use strict';var BPromise=require('bluebird');var server=require(_0x1bc5('0x0'));var Realtime=require(_0x1bc5('0x1'));var user=require(_0x1bc5('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x1bc5('0x3'));var chatQueue=require(_0x1bc5('0x4'));var smsQueue=require(_0x1bc5('0x5'));var mailQueue=require(_0x1bc5('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user[_0x1bc5('0x7')]())['then'](realtime[_0x1bc5('0x8')]())[_0x1bc5('0x9')](interval[_0x1bc5('0xa')]())[_0x1bc5('0x9')](realtime[_0x1bc5('0xb')]())[_0x1bc5('0x9')](openchannelQueue[_0x1bc5('0xc')]())['then'](realtime[_0x1bc5('0xd')]())[_0x1bc5('0x9')](chatQueue['getChatQueues']())[_0x1bc5('0x9')](realtime[_0x1bc5('0xe')]())['then'](smsQueue[_0x1bc5('0xf')]())[_0x1bc5('0x9')](realtime['initSmsQueues']())['then'](mailQueue[_0x1bc5('0x10')]())['then'](realtime[_0x1bc5('0x11')]())[_0x1bc5('0x9')](faxQueue[_0x1bc5('0x12')]())['then'](realtime[_0x1bc5('0x13')]())[_0x1bc5('0x9')](whatsappQueue[_0x1bc5('0x14')]())[_0x1bc5('0x9')](realtime[_0x1bc5('0x15')]())[_0x1bc5('0x9')](function(){return realtime;});}function main(){return server[_0x1bc5('0x16')](realtime)[_0x1bc5('0x9')](function(_0x4646a2){return initRealtime();})[_0x1bc5('0x9')](function(_0x1c1446){return setInterval(initRealtime,0x1388);})[_0x1bc5('0x17')](function(_0x46d503){console[_0x1bc5('0x18')](_0x46d503);});}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 4fcaf80..91e5bb4 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x9cbfe0,_0x56aada){var _0x1f1534=function(_0x422947){while(--_0x422947){_0x9cbfe0['push'](_0x9cbfe0['shift']());}};_0x1f1534(++_0x56aada);}(_0x326f,0xd1));var _0xf326=function(_0x2590f9,_0x772d91){_0x2590f9=_0x2590f9-0x0;var _0x43b1d8=_0x326f[_0x2590f9];return _0x43b1d8;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _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(_0x2d0012,_0x86a59a){var _0x221577=function(_0x3406e9){while(--_0x3406e9){_0x2d0012['push'](_0x2d0012['shift']());}};_0x221577(++_0x86a59a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc4aa[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 4d4ce62..d852f1a 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 _0x333c=['message','result','catch','SendMail','bluebird','jayson/promise','client','request','error'];(function(_0x2ca0a1,_0x59d9e7){var _0x406969=function(_0x57dc8e){while(--_0x57dc8e){_0x2ca0a1['push'](_0x2ca0a1['shift']());}};_0x406969(++_0x59d9e7);}(_0x333c,0xca));var _0xc333=function(_0x581a91,_0x33d649){_0x581a91=_0x581a91-0x0;var _0x3e8d40=_0x333c[_0x581a91];return _0x3e8d40;};'use strict';var BPromise=require(_0xc333('0x0'));var jayson=require(_0xc333('0x1'));var client=jayson[_0xc333('0x2')]['http']({'port':0x232b});function request(_0x1240af,_0x10ad80){return new BPromise(function(_0x1802cc,_0x2b1871){return client[_0xc333('0x3')](_0x1240af,_0x10ad80)['then'](function(_0x4eab42){if(_0x4eab42[_0xc333('0x4')]){return _0x2b1871(_0x4eab42[_0xc333('0x4')][_0xc333('0x5')]);}else{return _0x1802cc(_0x4eab42[_0xc333('0x6')]);}})[_0xc333('0x7')](function(_0xfe317){return _0x2b1871(_0xfe317);});});}exports['sendMailMessage']=function(_0x379533,_0x28fe8f){return request(_0xc333('0x8'),{'account':_0x379533,'message':_0x28fe8f});}; \ No newline at end of file +var _0x8e57=['bluebird','jayson/promise','request','then','error','message','result','sendMailMessage','SendMail'];(function(_0x18ac3f,_0x386630){var _0x4c6563=function(_0xcc161f){while(--_0xcc161f){_0x18ac3f['push'](_0x18ac3f['shift']());}};_0x4c6563(++_0x386630);}(_0x8e57,0x6c));var _0x78e5=function(_0x125ab5,_0x3bd65b){_0x125ab5=_0x125ab5-0x0;var _0x4a34f6=_0x8e57[_0x125ab5];return _0x4a34f6;};'use strict';var BPromise=require(_0x78e5('0x0'));var jayson=require(_0x78e5('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x5ad184,_0x14f84f){return new BPromise(function(_0x19276d,_0x4b12ad){return client[_0x78e5('0x2')](_0x5ad184,_0x14f84f)[_0x78e5('0x3')](function(_0x44d906){if(_0x44d906[_0x78e5('0x4')]){return _0x4b12ad(_0x44d906[_0x78e5('0x4')][_0x78e5('0x5')]);}else{return _0x19276d(_0x44d906[_0x78e5('0x6')]);}})['catch'](function(_0x2be9d0){return _0x4b12ad(_0x2be9d0);});});}exports[_0x78e5('0x7')]=function(_0x2fd251,_0x27b5e4){return request(_0x78e5('0x8'),{'account':_0x2fd251,'message':_0x27b5e4});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index c0aa9f9..00e510c 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 _0x8c0c=['unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','Capacity','maxcapacity','idle','mail','chat','openchannel','fax','whatsapp','length','Status','StatusTime','format','chatStatus','faxStatus','faxStatusTime','smsCurrentCapacity','stringify','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause'];(function(_0x16ff13,_0x574da6){var _0x167afd=function(_0x183173){while(--_0x183173){_0x16ff13['push'](_0x16ff13['shift']());}};_0x167afd(++_0x574da6);}(_0x8c0c,0x11b));var _0xc8c0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8c0c[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xc8c0('0x0'));var moment=require(_0xc8c0('0x1'));var md5=require(_0xc8c0('0x2'));var Redis=require(_0xc8c0('0x3'));var config=require(_0xc8c0('0x4'));config[_0xc8c0('0x5')]=_[_0xc8c0('0x6')](config[_0xc8c0('0x5')],{'host':_0xc8c0('0x7'),'port':0x18eb});var io=require(_0xc8c0('0x8'))(new Redis(config['redis']));function Agent(_0x1fcbbb){this['id']=_0x1fcbbb['id']||0x0;this[_0xc8c0('0x9')]=_0x1fcbbb[_0xc8c0('0x9')]||'';this[_0xc8c0('0xa')]=_0x1fcbbb[_0xc8c0('0xa')]||!![];this[_0xc8c0('0xb')]=_0x1fcbbb['voicePause']||![];this['chatPause']=_0x1fcbbb[_0xc8c0('0xc')]||![];this[_0xc8c0('0xd')]=_0x1fcbbb[_0xc8c0('0xd')]||![];this[_0xc8c0('0xe')]=_0x1fcbbb[_0xc8c0('0xe')]||![];this[_0xc8c0('0xf')]=_0x1fcbbb['smsPause']||![];this[_0xc8c0('0x10')]=_0x1fcbbb[_0xc8c0('0x10')]||![];this['chatStatus']=_0xc8c0('0x11');this[_0xc8c0('0x12')]=0x0;this['chatCapacity']=_0x1fcbbb[_0xc8c0('0x13')]||0x0;this[_0xc8c0('0x14')]=0x0;this[_0xc8c0('0x15')]='unknown';this[_0xc8c0('0x16')]=0x0;this[_0xc8c0('0x17')]=_0x1fcbbb['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0xc8c0('0x11');this['faxStatusTime']=0x0;this[_0xc8c0('0x18')]=_0x1fcbbb['faxCapacity']||0x0;this[_0xc8c0('0x19')]=0x0;this[_0xc8c0('0x1a')]=_0xc8c0('0x11');this[_0xc8c0('0x1b')]=0x0;this[_0xc8c0('0x1c')]=_0x1fcbbb['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0xc8c0('0x1d')]='unknown';this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x1fcbbb[_0xc8c0('0x1e')]||0x0;this[_0xc8c0('0x1f')]=0x0;this[_0xc8c0('0x20')]=_0xc8c0('0x11');this[_0xc8c0('0x21')]=0x0;this['openchannelCapacity']=_0x1fcbbb[_0xc8c0('0x22')]||0x0;this[_0xc8c0('0x23')]=0x0;this[_0xc8c0('0x24')]=![];this[_0xc8c0('0x25')]=undefined;this['md5']='';this[_0xc8c0('0x26')]();}Agent[_0xc8c0('0x27')][_0xc8c0('0x28')]=function(_0x4253b4){if(this[_0x4253b4+'CurrentCapacity']>0x0){if(this[_0x4253b4+'Capacity']>0x0&&this[_0x4253b4+'CurrentCapacity']>=this[_0x4253b4+_0xc8c0('0x29')]){return _0xc8c0('0x2a');}else{return'working';}}else{return _0xc8c0('0x2b');}};Agent['prototype']['updateRealtime']=function(){var _0x42bc7d=[_0xc8c0('0x2c'),_0xc8c0('0x2d'),_0xc8c0('0x2e'),_0xc8c0('0x2f'),'sms',_0xc8c0('0x30')];for(var _0x1e4473=0x0;_0x1e4473<_0x42bc7d[_0xc8c0('0x31')];_0x1e4473+=0x1){var _0x1cb764=this[_0xc8c0('0x28')](_0x42bc7d[_0x1e4473]);if(this[_0x42bc7d[_0x1e4473]+_0xc8c0('0x32')]!==_0x1cb764){this[_0x42bc7d[_0x1e4473]+_0xc8c0('0x33')]=_['toNumber'](moment()[_0xc8c0('0x34')]('x'));}this[_0x42bc7d[_0x1e4473]+_0xc8c0('0x32')]=_0x1cb764;}var _0x637cd0={'id':this['id'],'name':this[_0xc8c0('0x9')],'online':this[_0xc8c0('0xa')],'voicePause':this[_0xc8c0('0xb')],'chatPause':this[_0xc8c0('0xc')],'mailPause':this[_0xc8c0('0xd')],'smsPause':this[_0xc8c0('0xf')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xc8c0('0x35')],'chatStatusTime':this[_0xc8c0('0x12')],'chatCapacity':this[_0xc8c0('0x13')],'chatCurrentCapacity':this[_0xc8c0('0x14')],'mailStatus':this[_0xc8c0('0x15')],'mailStatusTime':this[_0xc8c0('0x16')],'mailCapacity':this[_0xc8c0('0x17')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xc8c0('0x36')],'faxStatusTime':this[_0xc8c0('0x37')],'faxCapacity':this[_0xc8c0('0x18')],'faxCurrentCapacity':this[_0xc8c0('0x19')],'smsStatus':this[_0xc8c0('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xc8c0('0x1c')],'smsCurrentCapacity':this[_0xc8c0('0x38')],'whatsappStatus':this[_0xc8c0('0x1d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xc8c0('0x20')],'openchannelStatusTime':this[_0xc8c0('0x21')],'openchannelCapacity':this[_0xc8c0('0x22')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xc8c0('0x24')],'busyQueue':this[_0xc8c0('0x25')]};var _0x2c2898=md5(JSON[_0xc8c0('0x39')](_0x637cd0));if(this[_0xc8c0('0x2')]!==_0x2c2898){this[_0xc8c0('0x2')]=_0x2c2898;io['emit'](_0xc8c0('0x3a'),_0x637cd0);}};module[_0xc8c0('0x3b')]=Agent; \ No newline at end of file +var _0x0490=['whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busy','busyQueue','md5','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','whatsapp','length','getChannelStatus','StatusTime','format','Status','mailStatus','smsStatusTime','openchannelStatusTime','openchannelCurrentCapacity','stringify','emit','user:save','moment','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus'];(function(_0x2f2e22,_0x155b32){var _0x18589d=function(_0x4ffa20){while(--_0x4ffa20){_0x2f2e22['push'](_0x2f2e22['shift']());}};_0x18589d(++_0x155b32);}(_0x0490,0x147));var _0x0049=function(_0xa50975,_0x50bff1){_0xa50975=_0xa50975-0x0;var _0x4779c9=_0x0490[_0xa50975];return _0x4779c9;};'use strict';var _=require('lodash');var moment=require(_0x0049('0x0'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x0049('0x1')](config[_0x0049('0x2')],{'host':_0x0049('0x3'),'port':0x18eb});var io=require(_0x0049('0x4'))(new Redis(config[_0x0049('0x2')]));function Agent(_0x4a59b9){this['id']=_0x4a59b9['id']||0x0;this[_0x0049('0x5')]=_0x4a59b9[_0x0049('0x5')]||'';this[_0x0049('0x6')]=_0x4a59b9['online']||!![];this[_0x0049('0x7')]=_0x4a59b9[_0x0049('0x7')]||![];this[_0x0049('0x8')]=_0x4a59b9['chatPause']||![];this[_0x0049('0x9')]=_0x4a59b9[_0x0049('0x9')]||![];this[_0x0049('0xa')]=_0x4a59b9[_0x0049('0xa')]||![];this[_0x0049('0xb')]=_0x4a59b9[_0x0049('0xb')]||![];this[_0x0049('0xc')]=_0x4a59b9[_0x0049('0xc')]||![];this[_0x0049('0xd')]='unknown';this[_0x0049('0xe')]=0x0;this[_0x0049('0xf')]=_0x4a59b9[_0x0049('0xf')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0x0049('0x10');this[_0x0049('0x11')]=0x0;this[_0x0049('0x12')]=_0x4a59b9[_0x0049('0x12')]||0x0;this[_0x0049('0x13')]=0x0;this['faxStatus']=_0x0049('0x10');this[_0x0049('0x14')]=0x0;this['faxCapacity']=_0x4a59b9[_0x0049('0x15')]||0x0;this[_0x0049('0x16')]=0x0;this[_0x0049('0x17')]=_0x0049('0x10');this['smsStatusTime']=0x0;this['smsCapacity']=_0x4a59b9[_0x0049('0x18')]||0x0;this[_0x0049('0x19')]=0x0;this[_0x0049('0x1a')]=_0x0049('0x10');this[_0x0049('0x1b')]=0x0;this[_0x0049('0x1c')]=_0x4a59b9[_0x0049('0x1c')]||0x0;this[_0x0049('0x1d')]=0x0;this[_0x0049('0x1e')]=_0x0049('0x10');this['openchannelStatusTime']=0x0;this[_0x0049('0x1f')]=_0x4a59b9[_0x0049('0x1f')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x0049('0x20')]=![];this[_0x0049('0x21')]=undefined;this[_0x0049('0x22')]='';this[_0x0049('0x23')]();}Agent[_0x0049('0x24')]['getChannelStatus']=function(_0x26a9fb){if(this[_0x26a9fb+_0x0049('0x25')]>0x0){if(this[_0x26a9fb+'Capacity']>0x0&&this[_0x26a9fb+_0x0049('0x25')]>=this[_0x26a9fb+_0x0049('0x26')]){return _0x0049('0x27');}else{return _0x0049('0x28');}}else{return _0x0049('0x29');}};Agent[_0x0049('0x24')][_0x0049('0x23')]=function(){var _0x457bb3=[_0x0049('0x2a'),_0x0049('0x2b'),_0x0049('0x2c'),_0x0049('0x2d'),'sms',_0x0049('0x2e')];for(var _0x2813d2=0x0;_0x2813d2<_0x457bb3[_0x0049('0x2f')];_0x2813d2+=0x1){var _0x118bc0=this[_0x0049('0x30')](_0x457bb3[_0x2813d2]);if(this[_0x457bb3[_0x2813d2]+'Status']!==_0x118bc0){this[_0x457bb3[_0x2813d2]+_0x0049('0x31')]=_['toNumber'](moment()[_0x0049('0x32')]('x'));}this[_0x457bb3[_0x2813d2]+_0x0049('0x33')]=_0x118bc0;}var _0x450698={'id':this['id'],'name':this[_0x0049('0x5')],'online':this['online'],'voicePause':this[_0x0049('0x7')],'chatPause':this[_0x0049('0x8')],'mailPause':this[_0x0049('0x9')],'smsPause':this[_0x0049('0xb')],'faxPause':this[_0x0049('0xa')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x0049('0xd')],'chatStatusTime':this[_0x0049('0xe')],'chatCapacity':this[_0x0049('0xf')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x0049('0x34')],'mailStatusTime':this[_0x0049('0x11')],'mailCapacity':this[_0x0049('0x12')],'mailCurrentCapacity':this[_0x0049('0x13')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x0049('0x14')],'faxCapacity':this[_0x0049('0x15')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x0049('0x17')],'smsStatusTime':this[_0x0049('0x35')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x0049('0x19')],'whatsappStatus':this[_0x0049('0x1a')],'whatsappStatusTime':this[_0x0049('0x1b')],'whatsappCapacity':this[_0x0049('0x1c')],'whatsappCurrentCapacity':this[_0x0049('0x1d')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x0049('0x36')],'openchannelCapacity':this[_0x0049('0x1f')],'openchannelCurrentCapacity':this[_0x0049('0x37')],'busy':this[_0x0049('0x20')],'busyQueue':this[_0x0049('0x21')]};var _0x5bdc33=md5(JSON[_0x0049('0x38')](_0x450698));if(this['md5']!==_0x5bdc33){this[_0x0049('0x22')]=_0x5bdc33;io[_0x0049('0x39')](_0x0049('0x3a'),_0x450698);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index a00a1c1..4eac524 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 _0x6cdf=['exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','waiting','stringify','format','chat_queue:save'];(function(_0x3f0a3c,_0x5f4c63){var _0x5e8f6e=function(_0x1a3b9a){while(--_0x1a3b9a){_0x3f0a3c['push'](_0x3f0a3c['shift']());}};_0x5e8f6e(++_0x5f4c63);}(_0x6cdf,0x17a));var _0xf6cd=function(_0x367759,_0x3ccdb9){_0x367759=_0x367759-0x0;var _0x3c8b9f=_0x6cdf[_0x367759];return _0x3c8b9f;};'use strict';var _=require(_0xf6cd('0x0'));var md5=require(_0xf6cd('0x1'));var util=require(_0xf6cd('0x2'));var Redis=require(_0xf6cd('0x3'));var config=require(_0xf6cd('0x4'));config[_0xf6cd('0x5')]=_[_0xf6cd('0x6')](config[_0xf6cd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xf6cd('0x7'))(new Redis(config[_0xf6cd('0x5')]));function ChatQueue(_0x237eac){this['id']=_0x237eac['id']||0x0;this['name']=_0x237eac[_0xf6cd('0x8')]||'';this['timeout']=_0x237eac[_0xf6cd('0x9')]||0xa;this['strategy']=_0x237eac[_0xf6cd('0xa')]||_0xf6cd('0xb');this[_0xf6cd('0xc')]=_0x237eac[_0xf6cd('0xc')];this[_0xf6cd('0xd')]={};this['waiting']=0x0;this['md5']='';this[_0xf6cd('0xe')]();this[_0xf6cd('0xf')]();}ChatQueue[_0xf6cd('0x10')][_0xf6cd('0xe')]=function(){var _0x3b9fef=this[_0xf6cd('0xd')][_0xf6cd('0x11')];this[_0xf6cd('0xd')]=_[_0xf6cd('0x12')](this[_0xf6cd('0xc')],'id');this['mapAgentsId'][_0xf6cd('0x11')]=_0x3b9fef;};ChatQueue[_0xf6cd('0x10')][_0xf6cd('0xf')]=function(){this[_0xf6cd('0x13')]=0x0;this[_0xf6cd('0x14')]=0x0;for(var _0x2128c4=0x0;_0x2128c4=0x0?this['available']:0x0;var _0x4cd455={'id':this['id'],'available':this[_0xf6cd('0x17')],'loggedIn':this[_0xf6cd('0x13')],'name':this['name'],'paused':this[_0xf6cd('0x14')],'waiting':this[_0xf6cd('0x18')]};var _0x1a6481=md5(JSON[_0xf6cd('0x19')](_0x4cd455));if(this['md5']!==_0x1a6481){this[_0xf6cd('0x1')]=_0x1a6481;io['to'](util[_0xf6cd('0x1a')]('chat:queue:%s',_0x4cd455[_0xf6cd('0x8')]))['emit'](_0xf6cd('0x1b'),_0x4cd455);}};module[_0xf6cd('0x1c')]=ChatQueue; \ No newline at end of file +var _0xda09=['length','online','loggedIn','available','format','chat:queue:%s','emit','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xda09,0xf0));var _0x9da0=function(_0x43d663,_0x483e9d){_0x43d663=_0x43d663-0x0;var _0x54f3d5=_0xda09[_0x43d663];return _0x54f3d5;};'use strict';var _=require(_0x9da0('0x0'));var md5=require(_0x9da0('0x1'));var util=require(_0x9da0('0x2'));var Redis=require(_0x9da0('0x3'));var config=require(_0x9da0('0x4'));config['redis']=_['defaults'](config[_0x9da0('0x5')],{'host':_0x9da0('0x6'),'port':0x18eb});var io=require(_0x9da0('0x7'))(new Redis(config[_0x9da0('0x5')]));function ChatQueue(_0x1a7215){this['id']=_0x1a7215['id']||0x0;this[_0x9da0('0x8')]=_0x1a7215[_0x9da0('0x8')]||'';this[_0x9da0('0x9')]=_0x1a7215['timeout']||0xa;this[_0x9da0('0xa')]=_0x1a7215[_0x9da0('0xa')]||_0x9da0('0xb');this[_0x9da0('0xc')]=_0x1a7215[_0x9da0('0xc')];this[_0x9da0('0xd')]={};this[_0x9da0('0xe')]=0x0;this[_0x9da0('0x1')]='';this[_0x9da0('0xf')]();this[_0x9da0('0x10')]();}ChatQueue[_0x9da0('0x11')][_0x9da0('0xf')]=function(){var _0x39b999=this[_0x9da0('0xd')][_0x9da0('0x12')];this[_0x9da0('0xd')]=_[_0x9da0('0x13')](this['Agents'],'id');this[_0x9da0('0xd')][_0x9da0('0x12')]=_0x39b999;};ChatQueue[_0x9da0('0x11')][_0x9da0('0x10')]=function(){this['loggedIn']=0x0;this[_0x9da0('0x14')]=0x0;for(var _0x5ccac2=0x0;_0x5ccac2=0x0?this[_0x9da0('0x18')]:0x0;var _0x3f071a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9da0('0x17')],'name':this[_0x9da0('0x8')],'paused':this['paused'],'waiting':this[_0x9da0('0xe')]};var _0x2928c6=md5(JSON['stringify'](_0x3f071a));if(this['md5']!==_0x2928c6){this[_0x9da0('0x1')]=_0x2928c6;io['to'](util[_0x9da0('0x19')](_0x9da0('0x1a'),_0x3f071a[_0x9da0('0x8')]))[_0x9da0('0x1b')](_0x9da0('0x1c'),_0x3f071a);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index d417ffb..440aa4a 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 _0x5d41=['waiting','updateRouting','updateRealtime','prototype','_rr','map','length','online','loggedIn','available','paused','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x5bc9af,_0x5770e8){var _0x3ff2ab=function(_0x5b0b10){while(--_0x5b0b10){_0x5bc9af['push'](_0x5bc9af['shift']());}};_0x3ff2ab(++_0x5770e8);}(_0x5d41,0x185));var _0x15d4=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x5d41[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x15d4('0x0'));var md5=require(_0x15d4('0x1'));var util=require('util');var Redis=require(_0x15d4('0x2'));var config=require(_0x15d4('0x3'));config['redis']=_[_0x15d4('0x4')](config[_0x15d4('0x5')],{'host':_0x15d4('0x6'),'port':0x18eb});var io=require(_0x15d4('0x7'))(new Redis(config[_0x15d4('0x5')]));function FaxQueue(_0x10ba69){this['id']=_0x10ba69['id']||0x0;this[_0x15d4('0x8')]=_0x10ba69[_0x15d4('0x8')]||'';this[_0x15d4('0x9')]=_0x10ba69[_0x15d4('0x9')]||0xa;this[_0x15d4('0xa')]=_0x10ba69['strategy']||_0x15d4('0xb');this[_0x15d4('0xc')]=_0x10ba69[_0x15d4('0xc')];this[_0x15d4('0xd')]={};this[_0x15d4('0xe')]=0x0;this[_0x15d4('0x1')]='';this[_0x15d4('0xf')]();this[_0x15d4('0x10')]();}FaxQueue[_0x15d4('0x11')][_0x15d4('0xf')]=function(){var _0x4cebd9=this['mapAgentsId'][_0x15d4('0x12')];this['mapAgentsId']=_[_0x15d4('0x13')](this[_0x15d4('0xc')],'id');this['mapAgentsId'][_0x15d4('0x12')]=_0x4cebd9;};FaxQueue[_0x15d4('0x11')][_0x15d4('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x46616e=0x0;_0x46616e=0x0?this[_0x15d4('0x17')]:0x0;var _0x59f197={'id':this['id'],'available':this[_0x15d4('0x17')],'loggedIn':this[_0x15d4('0x16')],'name':this[_0x15d4('0x8')],'paused':this[_0x15d4('0x18')],'waiting':this[_0x15d4('0xe')]};var _0x5bae90=md5(JSON[_0x15d4('0x19')](_0x59f197));if(this[_0x15d4('0x1')]!==_0x5bae90){this['md5']=_0x5bae90;io['to'](util[_0x15d4('0x1a')](_0x15d4('0x1b'),_0x59f197['name']))[_0x15d4('0x1c')](_0x15d4('0x1d'),_0x59f197);}};module[_0x15d4('0x1e')]=FaxQueue; \ No newline at end of file +var _0x53a8=['ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused','length','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x53a8,0x76));var _0x853a=function(_0x2bac85,_0x11f5d4){_0x2bac85=_0x2bac85-0x0;var _0x112b88=_0x53a8[_0x2bac85];return _0x112b88;};'use strict';var _=require(_0x853a('0x0'));var md5=require(_0x853a('0x1'));var util=require('util');var Redis=require(_0x853a('0x2'));var config=require(_0x853a('0x3'));config[_0x853a('0x4')]=_[_0x853a('0x5')](config[_0x853a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x853a('0x6'))(new Redis(config[_0x853a('0x4')]));function FaxQueue(_0x489c32){this['id']=_0x489c32['id']||0x0;this[_0x853a('0x7')]=_0x489c32['name']||'';this[_0x853a('0x8')]=_0x489c32[_0x853a('0x8')]||0xa;this['strategy']=_0x489c32[_0x853a('0x9')]||_0x853a('0xa');this[_0x853a('0xb')]=_0x489c32[_0x853a('0xb')];this['mapAgentsId']={};this[_0x853a('0xc')]=0x0;this['md5']='';this[_0x853a('0xd')]();this[_0x853a('0xe')]();}FaxQueue[_0x853a('0xf')][_0x853a('0xd')]=function(){var _0x3a487a=this['mapAgentsId'][_0x853a('0x10')];this[_0x853a('0x11')]=_[_0x853a('0x12')](this[_0x853a('0xb')],'id');this[_0x853a('0x11')][_0x853a('0x10')]=_0x3a487a;};FaxQueue[_0x853a('0xf')][_0x853a('0xe')]=function(){this[_0x853a('0x13')]=0x0;this[_0x853a('0x14')]=0x0;for(var _0x10c42b=0x0;_0x10c42b=0x0?this[_0x853a('0x17')]:0x0;var _0x3a9ae8={'id':this['id'],'available':this[_0x853a('0x17')],'loggedIn':this[_0x853a('0x13')],'name':this[_0x853a('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x54ca95=md5(JSON[_0x853a('0x18')](_0x3a9ae8));if(this[_0x853a('0x1')]!==_0x54ca95){this['md5']=_0x54ca95;io['to'](util[_0x853a('0x19')](_0x853a('0x1a'),_0x3a9ae8[_0x853a('0x7')]))[_0x853a('0x1b')](_0x853a('0x1c'),_0x3a9ae8);}};module[_0x853a('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 1606692..ebffe80 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 _0xf180=['exports','name','Intervals'];(function(_0x453e5b,_0x5f56a3){var _0x53343a=function(_0x511b09){while(--_0x511b09){_0x453e5b['push'](_0x453e5b['shift']());}};_0x53343a(++_0x5f56a3);}(_0xf180,0xa6));var _0x0f18=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xf180[_0x31e29a];return _0x32d892;};'use strict';function Interval(_0x277363){this['id']=_0x277363['id']||0x0;this[_0x0f18('0x0')]=_0x277363[_0x0f18('0x0')]||'';this['Intervals']=_0x277363[_0x0f18('0x1')]||{};}module[_0x0f18('0x2')]=Interval; \ No newline at end of file +var _0x4ec3=['name','Intervals'];(function(_0x18733b,_0x189b90){var _0x429157=function(_0xafc0df){while(--_0xafc0df){_0x18733b['push'](_0x18733b['shift']());}};_0x429157(++_0x189b90);}(_0x4ec3,0xd0));var _0x34ec=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0x4ec3[_0x21bfab];return _0x4db318;};'use strict';function Interval(_0x348977){this['id']=_0x348977['id']||0x0;this[_0x34ec('0x0')]=_0x348977[_0x34ec('0x0')]||'';this['Intervals']=_0x348977[_0x34ec('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 82089cc..1358e52 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 _0x0ae8=['updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','ioredis','../../../config/environment','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5'];(function(_0x42f468,_0x43cb24){var _0x43a0d2=function(_0x57eb47){while(--_0x57eb47){_0x42f468['push'](_0x42f468['shift']());}};_0x43a0d2(++_0x43cb24);}(_0x0ae8,0x128));var _0x80ae=function(_0x332db5,_0x2f27ae){_0x332db5=_0x332db5-0x0;var _0x502c77=_0x0ae8[_0x332db5];return _0x502c77;};'use strict';var _=require(_0x80ae('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x80ae('0x1'));var config=require(_0x80ae('0x2'));config[_0x80ae('0x3')]=_['defaults'](config[_0x80ae('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x80ae('0x3')]));function MailQueue(_0x1d57ff){this['id']=_0x1d57ff['id']||0x0;this[_0x80ae('0x4')]=_0x1d57ff[_0x80ae('0x4')]||'';this[_0x80ae('0x5')]=_0x1d57ff[_0x80ae('0x5')]||0xa;this['strategy']=_0x1d57ff[_0x80ae('0x6')]||_0x80ae('0x7');this[_0x80ae('0x8')]=_0x1d57ff[_0x80ae('0x8')];this[_0x80ae('0x9')]={};this[_0x80ae('0xa')]=0x0;this[_0x80ae('0xb')]='';this[_0x80ae('0xc')]();this['updateRealtime']();}MailQueue[_0x80ae('0xd')][_0x80ae('0xc')]=function(){var _0x389b6a=this[_0x80ae('0x9')][_0x80ae('0xe')];this[_0x80ae('0x9')]=_[_0x80ae('0xf')](this[_0x80ae('0x8')],'id');this[_0x80ae('0x9')][_0x80ae('0xe')]=_0x389b6a;};MailQueue[_0x80ae('0xd')][_0x80ae('0x10')]=function(){this[_0x80ae('0x11')]=0x0;this[_0x80ae('0x12')]=0x0;for(var _0x12ab6e=0x0;_0x12ab6e=0x0?this[_0x80ae('0x15')]:0x0;var _0x4169bc={'id':this['id'],'available':this[_0x80ae('0x15')],'loggedIn':this[_0x80ae('0x11')],'name':this[_0x80ae('0x4')],'paused':this[_0x80ae('0x12')],'waiting':this[_0x80ae('0xa')]};var _0x1f59a2=md5(JSON[_0x80ae('0x16')](_0x4169bc));if(this['md5']!==_0x1f59a2){this[_0x80ae('0xb')]=_0x1f59a2;io['to'](util[_0x80ae('0x17')](_0x80ae('0x18'),_0x4169bc[_0x80ae('0x4')]))[_0x80ae('0x19')](_0x80ae('0x1a'),_0x4169bc);}};module[_0x80ae('0x1b')]=MailQueue; \ No newline at end of file +var _0xb9e5=['paused','available','format','mail:queue:%s','exports','lodash','util','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','_rr','mapAgentsId','prototype','loggedIn','length','online','mailPause'];(function(_0xea343d,_0x311197){var _0x2c6e9c=function(_0x454bd6){while(--_0x454bd6){_0xea343d['push'](_0xea343d['shift']());}};_0x2c6e9c(++_0x311197);}(_0xb9e5,0x18b));var _0x5b9e=function(_0x56feee,_0x4d26c7){_0x56feee=_0x56feee-0x0;var _0x554d3e=_0xb9e5[_0x56feee];return _0x554d3e;};'use strict';var _=require(_0x5b9e('0x0'));var md5=require('md5');var util=require(_0x5b9e('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x5b9e('0x2')],{'host':_0x5b9e('0x3'),'port':0x18eb});var io=require(_0x5b9e('0x4'))(new Redis(config[_0x5b9e('0x2')]));function MailQueue(_0x4d32f1){this['id']=_0x4d32f1['id']||0x0;this['name']=_0x4d32f1[_0x5b9e('0x5')]||'';this['timeout']=_0x4d32f1[_0x5b9e('0x6')]||0xa;this[_0x5b9e('0x7')]=_0x4d32f1[_0x5b9e('0x7')]||_0x5b9e('0x8');this[_0x5b9e('0x9')]=_0x4d32f1['Agents'];this['mapAgentsId']={};this[_0x5b9e('0xa')]=0x0;this[_0x5b9e('0xb')]='';this[_0x5b9e('0xc')]();this[_0x5b9e('0xd')]();}MailQueue['prototype']['updateRouting']=function(){var _0x4890f8=this['mapAgentsId'][_0x5b9e('0xe')];this[_0x5b9e('0xf')]=_['map'](this[_0x5b9e('0x9')],'id');this[_0x5b9e('0xf')][_0x5b9e('0xe')]=_0x4890f8;};MailQueue[_0x5b9e('0x10')][_0x5b9e('0xd')]=function(){this[_0x5b9e('0x11')]=0x0;this['paused']=0x0;for(var _0x5cb1ac=0x0;_0x5cb1ac=0x0?this[_0x5b9e('0x16')]:0x0;var _0x22dbed={'id':this['id'],'available':this[_0x5b9e('0x16')],'loggedIn':this[_0x5b9e('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x5b9e('0xa')]};var _0x558df1=md5(JSON['stringify'](_0x22dbed));if(this[_0x5b9e('0xb')]!==_0x558df1){this[_0x5b9e('0xb')]=_0x558df1;io['to'](util[_0x5b9e('0x17')](_0x5b9e('0x18'),_0x22dbed[_0x5b9e('0x5')]))['emit']('mail_queue:save',_0x22dbed);}};module[_0x5b9e('0x19')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index e8ba2de..824f49f 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 _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x1bae8f,_0x426d31){var _0x591da3=function(_0x2facc8){while(--_0x2facc8){_0x1bae8f['push'](_0x1bae8f['shift']());}};_0x591da3(++_0x426d31);}(_0x5fc3,0xa8));var _0x35fc=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0x5fc3[_0x39ffd1];return _0x31267e;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file +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(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 3d19a7e..62f943d 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 _0xb2ff=['smsPause','available','sms:queue:%s','sms_queue:save','exports','lodash','md5','ioredis','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','loggedIn','paused','length','online'];(function(_0x1d35cc,_0x70375c){var _0x55f9d7=function(_0x35d1f4){while(--_0x35d1f4){_0x1d35cc['push'](_0x1d35cc['shift']());}};_0x55f9d7(++_0x70375c);}(_0xb2ff,0x123));var _0xfb2f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb2ff[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xfb2f('0x0'));var md5=require(_0xfb2f('0x1'));var util=require('util');var Redis=require(_0xfb2f('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xfb2f('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xfb2f('0x4'))(new Redis(config[_0xfb2f('0x3')]));function SmsQueue(_0x3c5835){this['id']=_0x3c5835['id']||0x0;this[_0xfb2f('0x5')]=_0x3c5835['name']||'';this['timeout']=_0x3c5835[_0xfb2f('0x6')]||0xa;this['strategy']=_0x3c5835[_0xfb2f('0x7')]||_0xfb2f('0x8');this[_0xfb2f('0x9')]=_0x3c5835[_0xfb2f('0x9')];this['mapAgentsId']={};this[_0xfb2f('0xa')]=0x0;this['md5']='';this[_0xfb2f('0xb')]();this['updateRealtime']();}SmsQueue[_0xfb2f('0xc')][_0xfb2f('0xb')]=function(){var _0x31ffea=this[_0xfb2f('0xd')][_0xfb2f('0xe')];this['mapAgentsId']=_[_0xfb2f('0xf')](this[_0xfb2f('0x9')],'id');this[_0xfb2f('0xd')][_0xfb2f('0xe')]=_0x31ffea;};SmsQueue[_0xfb2f('0xc')][_0xfb2f('0x10')]=function(){this[_0xfb2f('0x11')]=0x0;this[_0xfb2f('0x12')]=0x0;for(var _0x5f3893=0x0;_0x5f3893=0x0?this[_0xfb2f('0x16')]:0x0;var _0x239a88={'id':this['id'],'available':this['available'],'loggedIn':this[_0xfb2f('0x11')],'name':this[_0xfb2f('0x5')],'paused':this[_0xfb2f('0x12')],'waiting':this[_0xfb2f('0xa')]};var _0x448216=md5(JSON['stringify'](_0x239a88));if(this['md5']!==_0x448216){this[_0xfb2f('0x1')]=_0x448216;io['to'](util['format'](_0xfb2f('0x17'),_0x239a88['name']))['emit'](_0xfb2f('0x18'),_0x239a88);}};module[_0xfb2f('0x19')]=SmsQueue; \ No newline at end of file +var _0x12c9=['localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRealtime','updateRouting','_rr','map','prototype','loggedIn','online','smsPause','paused','available','waiting','stringify','format','sms:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis'];(function(_0x1c6838,_0x5d6e29){var _0x29dca3=function(_0x239c33){while(--_0x239c33){_0x1c6838['push'](_0x1c6838['shift']());}};_0x29dca3(++_0x5d6e29);}(_0x12c9,0x1c9));var _0x912c=function(_0x9e9dec,_0x54b3d4){_0x9e9dec=_0x9e9dec-0x0;var _0x253d9b=_0x12c9[_0x9e9dec];return _0x253d9b;};'use strict';var _=require(_0x912c('0x0'));var md5=require(_0x912c('0x1'));var util=require(_0x912c('0x2'));var Redis=require(_0x912c('0x3'));var config=require(_0x912c('0x4'));config['redis']=_[_0x912c('0x5')](config[_0x912c('0x6')],{'host':_0x912c('0x7'),'port':0x18eb});var io=require(_0x912c('0x8'))(new Redis(config[_0x912c('0x6')]));function SmsQueue(_0x505262){this['id']=_0x505262['id']||0x0;this['name']=_0x505262[_0x912c('0x9')]||'';this[_0x912c('0xa')]=_0x505262[_0x912c('0xa')]||0xa;this[_0x912c('0xb')]=_0x505262[_0x912c('0xb')]||'beepall';this[_0x912c('0xc')]=_0x505262['Agents'];this[_0x912c('0xd')]={};this['waiting']=0x0;this[_0x912c('0x1')]='';this['updateRouting']();this[_0x912c('0xe')]();}SmsQueue['prototype'][_0x912c('0xf')]=function(){var _0x4f16b0=this['mapAgentsId'][_0x912c('0x10')];this['mapAgentsId']=_[_0x912c('0x11')](this[_0x912c('0xc')],'id');this[_0x912c('0xd')][_0x912c('0x10')]=_0x4f16b0;};SmsQueue[_0x912c('0x12')]['updateRealtime']=function(){this[_0x912c('0x13')]=0x0;this['paused']=0x0;for(var _0x28cdb4=0x0;_0x28cdb4=0x0?this[_0x912c('0x17')]:0x0;var _0x32fb2e={'id':this['id'],'available':this[_0x912c('0x17')],'loggedIn':this[_0x912c('0x13')],'name':this[_0x912c('0x9')],'paused':this[_0x912c('0x16')],'waiting':this[_0x912c('0x18')]};var _0x272010=md5(JSON[_0x912c('0x19')](_0x32fb2e));if(this['md5']!==_0x272010){this['md5']=_0x272010;io['to'](util[_0x912c('0x1a')](_0x912c('0x1b'),_0x32fb2e['name']))['emit']('sms_queue:save',_0x32fb2e);}};module[_0x912c('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index e413b1f..0d58b7d 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 _0x20df=['lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRealtime','updateRouting','_rr','map','loggedIn','paused','online','whatsappPause','available','waiting','whatsapp:queue:%s','emit'];(function(_0x1c0052,_0xf87cfa){var _0x5e98d5=function(_0x20e716){while(--_0x20e716){_0x1c0052['push'](_0x1c0052['shift']());}};_0x5e98d5(++_0xf87cfa);}(_0x20df,0xcf));var _0xf20d=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x20df[_0x37ffea];return _0x2e2615;};'use strict';var _=require(_0xf20d('0x0'));var md5=require(_0xf20d('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xf20d('0x2'));config['redis']=_['defaults'](config[_0xf20d('0x3')],{'host':_0xf20d('0x4'),'port':0x18eb});var io=require(_0xf20d('0x5'))(new Redis(config[_0xf20d('0x3')]));function WhatsappQueue(_0x8eebb9){this['id']=_0x8eebb9['id']||0x0;this['name']=_0x8eebb9[_0xf20d('0x6')]||'';this[_0xf20d('0x7')]=_0x8eebb9[_0xf20d('0x7')]||0xa;this[_0xf20d('0x8')]=_0x8eebb9['strategy']||'beepall';this[_0xf20d('0x9')]=_0x8eebb9[_0xf20d('0x9')];this[_0xf20d('0xa')]={};this['waiting']=0x0;this[_0xf20d('0x1')]='';this['updateRouting']();this[_0xf20d('0xb')]();}WhatsappQueue['prototype'][_0xf20d('0xc')]=function(){var _0x52403c=this['mapAgentsId'][_0xf20d('0xd')];this[_0xf20d('0xa')]=_[_0xf20d('0xe')](this['Agents'],'id');this[_0xf20d('0xa')][_0xf20d('0xd')]=_0x52403c;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0xf20d('0xf')]=0x0;this[_0xf20d('0x10')]=0x0;for(var _0x118e42=0x0;_0x118e42=0x0?this['available']:0x0;var _0x4ca9d3={'id':this['id'],'available':this[_0xf20d('0x13')],'loggedIn':this[_0xf20d('0xf')],'name':this[_0xf20d('0x6')],'paused':this[_0xf20d('0x10')],'waiting':this[_0xf20d('0x14')]};var _0x137d93=md5(JSON['stringify'](_0x4ca9d3));if(this[_0xf20d('0x1')]!==_0x137d93){this[_0xf20d('0x1')]=_0x137d93;io['to'](util['format'](_0xf20d('0x15'),_0x4ca9d3[_0xf20d('0x6')]))[_0xf20d('0x16')]('whatsapp_queue:save',_0x4ca9d3);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x0209=['prototype','_rr','map','paused','online','loggedIn','whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x18f242,_0xd717b6){var _0x3b429f=function(_0x2b6283){while(--_0x2b6283){_0x18f242['push'](_0x18f242['shift']());}};_0x3b429f(++_0xd717b6);}(_0x0209,0x1dd));var _0x9020=function(_0x466701,_0x39a5d4){_0x466701=_0x466701-0x0;var _0x1e0e89=_0x0209[_0x466701];return _0x1e0e89;};'use strict';var _=require(_0x9020('0x0'));var md5=require(_0x9020('0x1'));var util=require(_0x9020('0x2'));var Redis=require('ioredis');var config=require(_0x9020('0x3'));config[_0x9020('0x4')]=_[_0x9020('0x5')](config[_0x9020('0x4')],{'host':_0x9020('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9020('0x4')]));function WhatsappQueue(_0x27af98){this['id']=_0x27af98['id']||0x0;this['name']=_0x27af98[_0x9020('0x7')]||'';this[_0x9020('0x8')]=_0x27af98[_0x9020('0x8')]||0xa;this[_0x9020('0x9')]=_0x27af98[_0x9020('0x9')]||_0x9020('0xa');this[_0x9020('0xb')]=_0x27af98[_0x9020('0xb')];this[_0x9020('0xc')]={};this[_0x9020('0xd')]=0x0;this['md5']='';this[_0x9020('0xe')]();this[_0x9020('0xf')]();}WhatsappQueue[_0x9020('0x10')][_0x9020('0xe')]=function(){var _0x7ac92c=this['mapAgentsId'][_0x9020('0x11')];this[_0x9020('0xc')]=_[_0x9020('0x12')](this[_0x9020('0xb')],'id');this[_0x9020('0xc')][_0x9020('0x11')]=_0x7ac92c;};WhatsappQueue[_0x9020('0x10')][_0x9020('0xf')]=function(){this['loggedIn']=0x0;this[_0x9020('0x13')]=0x0;for(var _0x5c6ac7=0x0;_0x5c6ac7=0x0?this[_0x9020('0x17')]:0x0;var _0x3b107a={'id':this['id'],'available':this[_0x9020('0x17')],'loggedIn':this[_0x9020('0x15')],'name':this[_0x9020('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x1c428a=md5(JSON[_0x9020('0x18')](_0x3b107a));if(this[_0x9020('0x1')]!==_0x1c428a){this[_0x9020('0x1')]=_0x1c428a;io['to'](util['format'](_0x9020('0x19'),_0x3b107a[_0x9020('0x7')]))[_0x9020('0x1a')](_0x9020('0x1b'),_0x3b107a);}};module[_0x9020('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 63f163b..21d7f02 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(_0x370d13,_0x48bcc9){var _0x1f8548=function(_0x1c08bc){while(--_0x1c08bc){_0x370d13['push'](_0x370d13['shift']());}};_0x1f8548(++_0x48bcc9);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d0d1b,_0x44b391){_0x5d0d1b=_0x5d0d1b-0x0;var _0x196810=_0xb10b[_0x5d0d1b];return _0x196810;};'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 _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(_0x38b76b,_0x1327c0){var _0x44cb63=function(_0x5c95d7){while(--_0x5c95d7){_0x38b76b['push'](_0x38b76b['shift']());}};_0x44cb63(++_0x1327c0);}(_0xb10b,0x12a));var _0xbb10=function(_0x14474a,_0x5be492){_0x14474a=_0x14474a-0x0;var _0x1f8b71=_0xb10b[_0x14474a];return _0x1f8b71;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 9c8ffa9..69c4ca3 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 _0x084b=['updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','update','Request','UpdateChatInteraction'];(function(_0x5a4805,_0x25413b){var _0x492346=function(_0x1a7fa3){while(--_0x1a7fa3){_0x5a4805['push'](_0x5a4805['shift']());}};_0x492346(++_0x25413b);}(_0x084b,0x11c));var _0xb084=function(_0x1a4cfc,_0x53a1af){_0x1a4cfc=_0x1a4cfc-0x0;var _0x1bb003=_0x084b[_0x1a4cfc];return _0x1bb003;};'use strict';var client=require('../client');exports[_0xb084('0x0')]=function(_0x152faa,_0x23a716){return client[_0xb084('0x1')](_0xb084('0x2'),{'body':_0x23a716,'options':{'where':{'id':_0x152faa}},'log':_0xb084('0x3')});};exports[_0xb084('0x4')]=function(_0x136c32,_0x510df2){return client['Request'](_0xb084('0x5'),{'body':_0x510df2,'options':{'where':{'id':_0x136c32}},'log':_0xb084('0x6')});}; \ No newline at end of file +var _0xe2d5=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe2d5,0xcb));var _0x5e2d=function(_0x5d1e69,_0x509003){_0x5d1e69=_0x5d1e69-0x0;var _0x582d72=_0xe2d5[_0x5d1e69];return _0x582d72;};'use strict';var client=require(_0x5e2d('0x0'));exports[_0x5e2d('0x1')]=function(_0xdbd63e,_0x3d9a24){return client[_0x5e2d('0x2')](_0x5e2d('0x3'),{'body':_0x3d9a24,'options':{'where':{'id':_0xdbd63e}},'log':_0x5e2d('0x4')});};exports[_0x5e2d('0x5')]=function(_0x531dd4,_0x43ff8c){return client[_0x5e2d('0x2')](_0x5e2d('0x6'),{'body':_0x43ff8c,'options':{'where':{'id':_0x531dd4}},'log':_0x5e2d('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 41fb4b2..c31e499 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 _0x64d6=['Request','createChatMessage','../client','create'];(function(_0x4ad0f7,_0x1920b0){var _0x30f5c8=function(_0x2aa6b6){while(--_0x2aa6b6){_0x4ad0f7['push'](_0x4ad0f7['shift']());}};_0x30f5c8(++_0x1920b0);}(_0x64d6,0x156));var _0x664d=function(_0x1676ea,_0x13a57f){_0x1676ea=_0x1676ea-0x0;var _0x390c97=_0x64d6[_0x1676ea];return _0x390c97;};'use strict';var client=require(_0x664d('0x0'));exports[_0x664d('0x1')]=function(_0x17ce9f){return client[_0x664d('0x2')]('CreateChatMessage',{'body':_0x17ce9f,'log':_0x664d('0x3')});}; \ No newline at end of file +var _0x1fc2=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x8e73a6,_0x1bcb3b){var _0x257d5c=function(_0x53015d){while(--_0x53015d){_0x8e73a6['push'](_0x8e73a6['shift']());}};_0x257d5c(++_0x1bcb3b);}(_0x1fc2,0xc4));var _0x21fc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1fc2[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x21fc('0x0'));exports[_0x21fc('0x1')]=function(_0x1ab80e){return client[_0x21fc('0x2')](_0x21fc('0x3'),{'body':_0x1ab80e,'log':_0x21fc('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index de5a61e..a7b4684 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 _0x6fc4=['online','chatPause','../client','getChatQueues','name','Agents'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x6fc4,0x1a0));var _0x46fc=function(_0x7f5123,_0x3062c5){_0x7f5123=_0x7f5123-0x0;var _0x10a02a=_0x6fc4[_0x7f5123];return _0x10a02a;};'use strict';var client=require(_0x46fc('0x0'));exports[_0x46fc('0x1')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x46fc('0x2'),'timeout','strategy'],'include':[{'model':'User','as':_0x46fc('0x3'),'attributes':['id',_0x46fc('0x2'),_0x46fc('0x4'),_0x46fc('0x5')]}]},'log':_0x46fc('0x1')});};}; \ No newline at end of file +var _0x35d0=['getChatQueues','GetChatQueue','name','timeout','strategy','User','Agents','online','chatPause','../client'];(function(_0x20d618,_0x53f866){var _0x9c7225=function(_0x5892f1){while(--_0x5892f1){_0x20d618['push'](_0x20d618['shift']());}};_0x9c7225(++_0x53f866);}(_0x35d0,0xf9));var _0x035d=function(_0x57cbfb,_0x2de760){_0x57cbfb=_0x57cbfb-0x0;var _0x4cb933=_0x35d0[_0x57cbfb];return _0x4cb933;};'use strict';var client=require(_0x035d('0x0'));exports[_0x035d('0x1')]=function(){return function(){return client['Request'](_0x035d('0x2'),{'options':{'raw':![],'attributes':['id',_0x035d('0x3'),_0x035d('0x4'),_0x035d('0x5')],'include':[{'model':_0x035d('0x6'),'as':_0x035d('0x7'),'attributes':['id','name',_0x035d('0x8'),_0x035d('0x9')]}]},'log':_0x035d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 237ac0c..f0403f9 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 _0x80ce=['update','UpdateChatQueueReport','Request','CreateChatQueueReport'];(function(_0x4cf81e,_0x1671b8){var _0x5a4c53=function(_0x5dcf5c){while(--_0x5dcf5c){_0x4cf81e['push'](_0x4cf81e['shift']());}};_0x5a4c53(++_0x1671b8);}(_0x80ce,0xae));var _0xe80c=function(_0x594074,_0x40940e){_0x594074=_0x594074-0x0;var _0xc73d0c=_0x80ce[_0x594074];return _0xc73d0c;};'use strict';var client=require('../client');exports['create']=function(_0x53cd80){return client[_0xe80c('0x0')](_0xe80c('0x1'),{'body':_0x53cd80,'log':'CreateChatQueueReport'});};exports[_0xe80c('0x2')]=function(_0x3efe49,_0x4372b2){return client['Request']('UpdateChatQueueReport',{'body':_0x4372b2,'options':{'where':{'uniqueid':_0x3efe49},'order':[['id','DESC']],'limit':0x1},'log':_0xe80c('0x3')});}; \ No newline at end of file +var _0x8e63=['update','Request','UpdateChatQueueReport','DESC','create','CreateChatQueueReport'];(function(_0x235ece,_0x457036){var _0x3fc816=function(_0xc8ba0e){while(--_0xc8ba0e){_0x235ece['push'](_0x235ece['shift']());}};_0x3fc816(++_0x457036);}(_0x8e63,0x7c));var _0x38e6=function(_0x59ad5f,_0x3117b4){_0x59ad5f=_0x59ad5f-0x0;var _0x25fa93=_0x8e63[_0x59ad5f];return _0x25fa93;};'use strict';var client=require('../client');exports[_0x38e6('0x0')]=function(_0x5221a4){return client['Request'](_0x38e6('0x1'),{'body':_0x5221a4,'log':_0x38e6('0x1')});};exports[_0x38e6('0x2')]=function(_0x5e5a71,_0x4c85e7){return client[_0x38e6('0x3')](_0x38e6('0x4'),{'body':_0x4c85e7,'options':{'where':{'uniqueid':_0x5e5a71},'order':[['id',_0x38e6('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index a2e6771..9ebcd8e 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(_0x5b7711,_0x4bd810){var _0x16e558=function(_0x43992d){while(--_0x43992d){_0x5b7711['push'](_0x5b7711['shift']());}};_0x16e558(++_0x4bd810);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x82c763,_0x2534f0){var _0x435d71=function(_0x47acd0){while(--_0x47acd0){_0x82c763['push'](_0x82c763['shift']());}};_0x435d71(++_0x2534f0);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index f3af714..62325c8 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 _0xe24e=['CreateFaxMessage','createFaxMessage','../client'];(function(_0x3a07c1,_0x34d57f){var _0x2bbe15=function(_0x5a02fb){while(--_0x5a02fb){_0x3a07c1['push'](_0x3a07c1['shift']());}};_0x2bbe15(++_0x34d57f);}(_0xe24e,0x1f4));var _0xee24=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0xe24e[_0x1344d6];return _0xf45b24;};'use strict';var client=require(_0xee24('0x0'));exports['create']=function(_0x144822){return client['Request'](_0xee24('0x1'),{'body':_0x144822,'log':_0xee24('0x2')});}; \ No newline at end of file +var _0x52d4=['createFaxMessage','../client','create'];(function(_0x6d7060,_0x119c08){var _0x195046=function(_0x3a4923){while(--_0x3a4923){_0x6d7060['push'](_0x6d7060['shift']());}};_0x195046(++_0x119c08);}(_0x52d4,0x1a8));var _0x452d=function(_0x513119,_0x425e6f){_0x513119=_0x513119-0x0;var _0x587511=_0x52d4[_0x513119];return _0x587511;};'use strict';var client=require(_0x452d('0x0'));exports[_0x452d('0x1')]=function(_0x33aa80){return client['Request']('CreateFaxMessage',{'body':_0x33aa80,'log':_0x452d('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 675bd36..e0b6a7c 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 _0x2104=['strategy','User','Agents','online','getFaxQueues','Request','name','timeout'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x2104,0x65));var _0x4210=function(_0x187279,_0x26d152){_0x187279=_0x187279-0x0;var _0x3da59d=_0x2104[_0x187279];return _0x3da59d;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x4210('0x0')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x4210('0x1'),_0x4210('0x2'),_0x4210('0x3')],'include':[{'model':_0x4210('0x4'),'as':_0x4210('0x5'),'attributes':['id',_0x4210('0x1'),_0x4210('0x6'),'faxPause']}]},'log':_0x4210('0x7')});};}; \ No newline at end of file +var _0x9e1b=['strategy','User','Agents','online','faxPause','../client','getFaxQueues','GetFaxQueue','name'];(function(_0x5e3721,_0x3e50b1){var _0x345ff2=function(_0x146a32){while(--_0x146a32){_0x5e3721['push'](_0x5e3721['shift']());}};_0x345ff2(++_0x3e50b1);}(_0x9e1b,0x19a));var _0xb9e1=function(_0x245712,_0x4e1f6a){_0x245712=_0x245712-0x0;var _0x227cf9=_0x9e1b[_0x245712];return _0x227cf9;};'use strict';var client=require(_0xb9e1('0x0'));exports[_0xb9e1('0x1')]=function(){return function(){return client['Request'](_0xb9e1('0x2'),{'options':{'raw':![],'attributes':['id',_0xb9e1('0x3'),'timeout',_0xb9e1('0x4')],'include':[{'model':_0xb9e1('0x5'),'as':_0xb9e1('0x6'),'attributes':['id',_0xb9e1('0x3'),_0xb9e1('0x7'),_0xb9e1('0x8')]}]},'log':_0xb9e1('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 44c3fc9..a9e2d93 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 _0x2a05=['create','Request','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport'];(function(_0x52d9dc,_0x1bbe3c){var _0xbc4b1a=function(_0x597618){while(--_0x597618){_0x52d9dc['push'](_0x52d9dc['shift']());}};_0xbc4b1a(++_0x1bbe3c);}(_0x2a05,0x7e));var _0x52a0=function(_0x24ecb2,_0x503ac1){_0x24ecb2=_0x24ecb2-0x0;var _0x160f8f=_0x2a05[_0x24ecb2];return _0x160f8f;};'use strict';var client=require('../client');exports[_0x52a0('0x0')]=function(_0x5a5b3c){return client[_0x52a0('0x1')](_0x52a0('0x2'),{'body':_0x5a5b3c,'log':_0x52a0('0x2')});};exports[_0x52a0('0x3')]=function(_0x10822a,_0x31d3c1){return client[_0x52a0('0x1')]('UpdateFaxQueueReport',{'body':_0x31d3c1,'options':{'where':{'uniqueid':_0x10822a},'order':[['id',_0x52a0('0x4')]],'limit':0x1},'log':_0x52a0('0x5')});}; \ No newline at end of file +var _0xf9dd=['CreateFaxQueueReport','update','Request','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x40a1e2,_0x19e376){var _0x1f5d36=function(_0x30aad5){while(--_0x30aad5){_0x40a1e2['push'](_0x40a1e2['shift']());}};_0x1f5d36(++_0x19e376);}(_0xf9dd,0x6e));var _0xdf9d=function(_0x404dfb,_0x4ec49e){_0x404dfb=_0x404dfb-0x0;var _0x43b2ba=_0xf9dd[_0x404dfb];return _0x43b2ba;};'use strict';var client=require(_0xdf9d('0x0'));exports[_0xdf9d('0x1')]=function(_0x521f8c){return client['Request'](_0xdf9d('0x2'),{'body':_0x521f8c,'log':_0xdf9d('0x2')});};exports[_0xdf9d('0x3')]=function(_0x1da175,_0x141e34){return client[_0xdf9d('0x4')](_0xdf9d('0x5'),{'body':_0x141e34,'options':{'where':{'uniqueid':_0x1da175},'order':[['id',_0xdf9d('0x6')]],'limit':0x1},'log':_0xdf9d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 82ddc6a..99dd154 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 _0x0448=['Request','GetInterval','name','Interval','Intervals','../client','getIntervals'];(function(_0x3a81f9,_0xa6a0e6){var _0x220e23=function(_0x22f720){while(--_0x22f720){_0x3a81f9['push'](_0x3a81f9['shift']());}};_0x220e23(++_0xa6a0e6);}(_0x0448,0x91));var _0x8044=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0x0448[_0x1fcaf1];return _0x55f464;};'use strict';var client=require(_0x8044('0x0'));exports[_0x8044('0x1')]=function(){return function(){return client[_0x8044('0x2')](_0x8044('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8044('0x4')],'include':[{'model':_0x8044('0x5'),'as':_0x8044('0x6'),'attributes':['id',_0x8044('0x4'),'interval']}]},'log':_0x8044('0x1')});};}; \ No newline at end of file +var _0x6388=['getIntervals','Request','GetInterval','Interval','Intervals','interval'];(function(_0x5d19ad,_0x383799){var _0x8408d3=function(_0x5e3bc7){while(--_0x5e3bc7){_0x5d19ad['push'](_0x5d19ad['shift']());}};_0x8408d3(++_0x383799);}(_0x6388,0x1ce));var _0x8638=function(_0xdd96a1,_0x5c0080){_0xdd96a1=_0xdd96a1-0x0;var _0x2f0dc7=_0x6388[_0xdd96a1];return _0x2f0dc7;};'use strict';var client=require('../client');exports[_0x8638('0x0')]=function(){return function(){return client[_0x8638('0x1')](_0x8638('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x8638('0x3'),'as':_0x8638('0x4'),'attributes':['id','name',_0x8638('0x5')]}]},'log':_0x8638('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index e9d76f2..f615678 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 _0xb016=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags'];(function(_0x5b0779,_0x40d92a){var _0x2d8671=function(_0x5cd62d){while(--_0x5cd62d){_0x5b0779['push'](_0x5b0779['shift']());}};_0x2d8671(++_0x40d92a);}(_0xb016,0x159));var _0x6b01=function(_0x29ec5a,_0x18838f){_0x29ec5a=_0x29ec5a-0x0;var _0x36eb0b=_0xb016[_0x29ec5a];return _0x36eb0b;};'use strict';var client=require(_0x6b01('0x0'));exports[_0x6b01('0x1')]=function(_0x513ed6,_0x57ecae){return client[_0x6b01('0x2')]('UpdateMailInteraction',{'body':_0x57ecae,'options':{'where':{'id':_0x513ed6}},'log':_0x6b01('0x3')});};exports[_0x6b01('0x4')]=function(_0x161b59,_0x3b9de1){return client['Request'](_0x6b01('0x5'),{'body':_0x3b9de1,'options':{'where':{'id':_0x161b59}},'log':_0x6b01('0x6')});}; \ No newline at end of file +var _0x28f2=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x3f1420,_0x57bc12){var _0x31e09e=function(_0x9139e4){while(--_0x9139e4){_0x3f1420['push'](_0x3f1420['shift']());}};_0x31e09e(++_0x57bc12);}(_0x28f2,0x193));var _0x228f=function(_0x36524e,_0x807c3c){_0x36524e=_0x36524e-0x0;var _0x51a070=_0x28f2[_0x36524e];return _0x51a070;};'use strict';var client=require(_0x228f('0x0'));exports[_0x228f('0x1')]=function(_0x108337,_0x2e5e0b){return client[_0x228f('0x2')]('UpdateMailInteraction',{'body':_0x2e5e0b,'options':{'where':{'id':_0x108337}},'log':_0x228f('0x3')});};exports[_0x228f('0x4')]=function(_0x79ed5f,_0x4303c3){return client[_0x228f('0x2')](_0x228f('0x5'),{'body':_0x4303c3,'options':{'where':{'id':_0x79ed5f}},'log':_0x228f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index cab8451..3d11668 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 _0x95e7=['create'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x95e7,0x91));var _0x795e=function(_0x3d8647,_0x47643d){_0x3d8647=_0x3d8647-0x0;var _0x22d4b0=_0x95e7[_0x3d8647];return _0x22d4b0;};'use strict';var client=require('../client');exports[_0x795e('0x0')]=function(_0x499755){return client['Request']('CreateMailMessage',{'body':_0x499755,'log':'createMailMessage'});}; \ No newline at end of file +var _0x5be7=['../client','create','CreateMailMessage','createMailMessage'];(function(_0x3a7368,_0x185789){var _0x1aa883=function(_0x41b7b6){while(--_0x41b7b6){_0x3a7368['push'](_0x3a7368['shift']());}};_0x1aa883(++_0x185789);}(_0x5be7,0x94));var _0x75be=function(_0x1d4fe4,_0x5d7f8c){_0x1d4fe4=_0x1d4fe4-0x0;var _0x2adb27=_0x5be7[_0x1d4fe4];return _0x2adb27;};'use strict';var client=require(_0x75be('0x0'));exports[_0x75be('0x1')]=function(_0x5f0200){return client['Request'](_0x75be('0x2'),{'body':_0x5f0200,'log':_0x75be('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 8fd99f6..33a880d 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 _0xb19f=['name','User','Agents','getMailQueues','../client','Request'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xb19f,0x1f0));var _0xfb19=function(_0xc56c3,_0x3f6ba2){_0xc56c3=_0xc56c3-0x0;var _0x6fabbb=_0xb19f[_0xc56c3];return _0x6fabbb;};'use strict';var client=require(_0xfb19('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xfb19('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xfb19('0x2'),'timeout','strategy'],'include':[{'model':_0xfb19('0x3'),'as':_0xfb19('0x4'),'attributes':['id',_0xfb19('0x2'),'online','mailPause']}]},'log':_0xfb19('0x5')});};}; \ No newline at end of file +var _0x183e=['mailPause','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','online'];(function(_0x2e1ddd,_0x15a251){var _0x4655b7=function(_0x31eb8b){while(--_0x31eb8b){_0x2e1ddd['push'](_0x2e1ddd['shift']());}};_0x4655b7(++_0x15a251);}(_0x183e,0x17e));var _0xe183=function(_0x184f37,_0x4f6ba7){_0x184f37=_0x184f37-0x0;var _0x5d1931=_0x183e[_0x184f37];return _0x5d1931;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0xe183('0x0')](_0xe183('0x1'),{'options':{'raw':![],'attributes':['id',_0xe183('0x2'),_0xe183('0x3'),_0xe183('0x4')],'include':[{'model':_0xe183('0x5'),'as':_0xe183('0x6'),'attributes':['id','name',_0xe183('0x7'),_0xe183('0x8')]}]},'log':_0xe183('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 0ff3ac6..0888480 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 _0xc4d2=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','Request'];(function(_0x215db4,_0x1426f9){var _0x54a48d=function(_0xdc43a9){while(--_0xdc43a9){_0x215db4['push'](_0x215db4['shift']());}};_0x54a48d(++_0x1426f9);}(_0xc4d2,0x160));var _0x2c4d=function(_0x2a48bb,_0x59a67d){_0x2a48bb=_0x2a48bb-0x0;var _0x186cc2=_0xc4d2[_0x2a48bb];return _0x186cc2;};'use strict';var client=require(_0x2c4d('0x0'));exports['create']=function(_0x4b07fc){return client[_0x2c4d('0x1')](_0x2c4d('0x2'),{'body':_0x4b07fc,'log':_0x2c4d('0x2')});};exports[_0x2c4d('0x3')]=function(_0x464059,_0x5945b5){return client[_0x2c4d('0x1')](_0x2c4d('0x4'),{'body':_0x5945b5,'options':{'where':{'uniqueid':_0x464059},'order':[['id',_0x2c4d('0x5')]],'limit':0x1},'log':_0x2c4d('0x4')});}; \ No newline at end of file +var _0xfcd3=['create','Request','UpdateMailQueueReport','DESC'];(function(_0x395667,_0x45593a){var _0x5cdb8f=function(_0x2be0fd){while(--_0x2be0fd){_0x395667['push'](_0x395667['shift']());}};_0x5cdb8f(++_0x45593a);}(_0xfcd3,0xdc));var _0x3fcd=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0xfcd3[_0x305c31];return _0x17f39f;};'use strict';var client=require('../client');exports[_0x3fcd('0x0')]=function(_0x332214){return client[_0x3fcd('0x1')]('CreateMailQueueReport',{'body':_0x332214,'log':'CreateMailQueueReport'});};exports['update']=function(_0x51059d,_0x39aefd){return client[_0x3fcd('0x1')](_0x3fcd('0x2'),{'body':_0x39aefd,'options':{'where':{'uniqueid':_0x51059d},'order':[['id',_0x3fcd('0x3')]],'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 eaeb422..161bd55 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 _0x8fb9=['updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','UpdateOpenchannelInteraction'];(function(_0x474dcb,_0x26cc1f){var _0x5b7075=function(_0x48ca7d){while(--_0x48ca7d){_0x474dcb['push'](_0x474dcb['shift']());}};_0x5b7075(++_0x26cc1f);}(_0x8fb9,0x155));var _0x98fb=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0x8fb9[_0x587fb5];return _0x551105;};'use strict';var client=require('../client');exports[_0x98fb('0x0')]=function(_0x1a7410,_0x393519){return client['Request'](_0x98fb('0x1'),{'body':_0x393519,'options':{'where':{'id':_0x1a7410}},'log':_0x98fb('0x2')});};exports[_0x98fb('0x3')]=function(_0x5195a8,_0x5d4fe0){return client[_0x98fb('0x4')](_0x98fb('0x5'),{'body':_0x5d4fe0,'options':{'where':{'id':_0x5195a8}},'log':_0x98fb('0x6')});}; \ No newline at end of file +var _0x6604=['update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x2457b1,_0x34c892){var _0x5491e4=function(_0x163fa5){while(--_0x163fa5){_0x2457b1['push'](_0x2457b1['shift']());}};_0x5491e4(++_0x34c892);}(_0x6604,0x156));var _0x4660=function(_0x36b635,_0x68a7f){_0x36b635=_0x36b635-0x0;var _0x11385b=_0x6604[_0x36b635];return _0x11385b;};'use strict';var client=require(_0x4660('0x0'));exports[_0x4660('0x1')]=function(_0x22468f,_0x750d4a){return client['Request'](_0x4660('0x2'),{'body':_0x750d4a,'options':{'where':{'id':_0x22468f}},'log':_0x4660('0x3')});};exports[_0x4660('0x4')]=function(_0x4c17c4,_0x504755){return client['Request'](_0x4660('0x5'),{'body':_0x504755,'options':{'where':{'id':_0x4c17c4}},'log':_0x4660('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 397e476..315c083 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 _0xbae9=['Request','createOpenchannelMessage','create'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xbae9,0x185));var _0x9bae=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0xbae9[_0x86b219];return _0x1f320c;};'use strict';var client=require('../client');exports[_0x9bae('0x0')]=function(_0x3a55ed){return client[_0x9bae('0x1')]('CreateOpenchannelMessage',{'body':_0x3a55ed,'log':_0x9bae('0x2')});}; \ No newline at end of file +var _0xf7f6=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x193fef,_0x230d9f){var _0x4eb704=function(_0x5787c4){while(--_0x5787c4){_0x193fef['push'](_0x193fef['shift']());}};_0x4eb704(++_0x230d9f);}(_0xf7f6,0x95));var _0x6f7f=function(_0xa93c7f,_0x4e4f5c){_0xa93c7f=_0xa93c7f-0x0;var _0x2fe7d3=_0xf7f6[_0xa93c7f];return _0x2fe7d3;};'use strict';var client=require(_0x6f7f('0x0'));exports[_0x6f7f('0x1')]=function(_0x4894f9){return client[_0x6f7f('0x2')](_0x6f7f('0x3'),{'body':_0x4894f9,'log':_0x6f7f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 97dd493..95b0ce6 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 _0x5a21=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause'];(function(_0x122fc9,_0x2ff0ad){var _0xb37972=function(_0x143abe){while(--_0x143abe){_0x122fc9['push'](_0x122fc9['shift']());}};_0xb37972(++_0x2ff0ad);}(_0x5a21,0x13f));var _0x15a2=function(_0x36e557,_0x582535){_0x36e557=_0x36e557-0x0;var _0x4072f7=_0x5a21[_0x36e557];return _0x4072f7;};'use strict';var client=require(_0x15a2('0x0'));exports[_0x15a2('0x1')]=function(){return function(){return client[_0x15a2('0x2')](_0x15a2('0x3'),{'options':{'raw':![],'attributes':['id',_0x15a2('0x4'),_0x15a2('0x5'),_0x15a2('0x6')],'include':[{'model':_0x15a2('0x7'),'as':_0x15a2('0x8'),'attributes':['id','name',_0x15a2('0x9'),_0x15a2('0xa')]}]},'log':_0x15a2('0x1')});};}; \ No newline at end of file +var _0x1a5b=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','User','Agents','online','openchannelPause','../client'];(function(_0xe67abb,_0x45528b){var _0x4f8889=function(_0x1e8a04){while(--_0x1e8a04){_0xe67abb['push'](_0xe67abb['shift']());}};_0x4f8889(++_0x45528b);}(_0x1a5b,0x153));var _0xb1a5=function(_0xd5268f,_0x423434){_0xd5268f=_0xd5268f-0x0;var _0x2e65f8=_0x1a5b[_0xd5268f];return _0x2e65f8;};'use strict';var client=require(_0xb1a5('0x0'));exports[_0xb1a5('0x1')]=function(){return function(){return client[_0xb1a5('0x2')](_0xb1a5('0x3'),{'options':{'raw':![],'attributes':['id',_0xb1a5('0x4'),'timeout',_0xb1a5('0x5')],'include':[{'model':_0xb1a5('0x6'),'as':_0xb1a5('0x7'),'attributes':['id',_0xb1a5('0x4'),_0xb1a5('0x8'),_0xb1a5('0x9')]}]},'log':_0xb1a5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 6b2599b..183ad20 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 _0x8b6b=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','Request'];(function(_0x982aae,_0x467e10){var _0x2fc7da=function(_0xc81696){while(--_0xc81696){_0x982aae['push'](_0x982aae['shift']());}};_0x2fc7da(++_0x467e10);}(_0x8b6b,0x8e));var _0xb8b6=function(_0x5d5a28,_0x2de1d7){_0x5d5a28=_0x5d5a28-0x0;var _0x214122=_0x8b6b[_0x5d5a28];return _0x214122;};'use strict';var client=require(_0xb8b6('0x0'));exports['create']=function(_0x16ebd4){return client[_0xb8b6('0x1')](_0xb8b6('0x2'),{'body':_0x16ebd4,'log':_0xb8b6('0x2')});};exports[_0xb8b6('0x3')]=function(_0x99fe67,_0x576a01){return client[_0xb8b6('0x1')](_0xb8b6('0x4'),{'body':_0x576a01,'options':{'where':{'uniqueid':_0x99fe67},'order':[['id',_0xb8b6('0x5')]],'limit':0x1},'log':_0xb8b6('0x4')});}; \ No newline at end of file +var _0x7dc5=['create','CreateOpenchannelQueueReport','update','Request','DESC','UpdateOpenchannelQueueReport','../client'];(function(_0x4f46f1,_0x2a39b9){var _0x5e146b=function(_0x5aed22){while(--_0x5aed22){_0x4f46f1['push'](_0x4f46f1['shift']());}};_0x5e146b(++_0x2a39b9);}(_0x7dc5,0x13a));var _0x57dc=function(_0x5bccd3,_0x4e2b7b){_0x5bccd3=_0x5bccd3-0x0;var _0x322dbc=_0x7dc5[_0x5bccd3];return _0x322dbc;};'use strict';var client=require(_0x57dc('0x0'));exports[_0x57dc('0x1')]=function(_0x41f4e5){return client['Request'](_0x57dc('0x2'),{'body':_0x41f4e5,'log':_0x57dc('0x2')});};exports[_0x57dc('0x3')]=function(_0x268af0,_0x1aa2c8){return client[_0x57dc('0x4')]('UpdateOpenchannelQueueReport',{'body':_0x1aa2c8,'options':{'where':{'uniqueid':_0x268af0},'order':[['id',_0x57dc('0x5')]],'limit':0x1},'log':_0x57dc('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 1f0b42f..fd4edc3 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 _0x4553=['AddTagsToSmsInteraction','addTagsToSmsInteraction','update','updateSmsInteraction','addTags','Request'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0x4553,0x1be));var _0x3455=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x4553[_0x5d80de];return _0x1c7556;};'use strict';var client=require('../client');exports[_0x3455('0x0')]=function(_0x20c464,_0x157be7){return client['Request']('UpdateSmsInteraction',{'body':_0x157be7,'options':{'where':{'id':_0x20c464}},'log':_0x3455('0x1')});};exports[_0x3455('0x2')]=function(_0x13ca79,_0x477ed8){return client[_0x3455('0x3')](_0x3455('0x4'),{'body':_0x477ed8,'options':{'where':{'id':_0x13ca79}},'log':_0x3455('0x5')});}; \ No newline at end of file +var _0x4b47=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','Request'];(function(_0x1ab379,_0xec9685){var _0x575b2a=function(_0x396a3b){while(--_0x396a3b){_0x1ab379['push'](_0x1ab379['shift']());}};_0x575b2a(++_0xec9685);}(_0x4b47,0x1b4));var _0x74b4=function(_0x20c199,_0x3b2930){_0x20c199=_0x20c199-0x0;var _0x2df087=_0x4b47[_0x20c199];return _0x2df087;};'use strict';var client=require(_0x74b4('0x0'));exports['update']=function(_0xf50408,_0x2542ff){return client[_0x74b4('0x1')](_0x74b4('0x2'),{'body':_0x2542ff,'options':{'where':{'id':_0xf50408}},'log':_0x74b4('0x3')});};exports[_0x74b4('0x4')]=function(_0x565f6b,_0x4ed4fe){return client[_0x74b4('0x1')](_0x74b4('0x5'),{'body':_0x4ed4fe,'options':{'where':{'id':_0x565f6b}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index e34bcbd..422f19d 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 _0x685d=['../client','Request','CreateSmsMessage'];(function(_0x2ef82e,_0x4a0938){var _0x5c990a=function(_0x176048){while(--_0x176048){_0x2ef82e['push'](_0x2ef82e['shift']());}};_0x5c990a(++_0x4a0938);}(_0x685d,0x117));var _0xd685=function(_0x5d372c,_0x5b4553){_0x5d372c=_0x5d372c-0x0;var _0x27124d=_0x685d[_0x5d372c];return _0x27124d;};'use strict';var client=require(_0xd685('0x0'));exports['create']=function(_0xb353b){return client[_0xd685('0x1')](_0xd685('0x2'),{'body':_0xb353b,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x318d=['../client','Request','createSmsMessage'];(function(_0x44671c,_0x571fad){var _0x17b588=function(_0x27fb57){while(--_0x27fb57){_0x44671c['push'](_0x44671c['shift']());}};_0x17b588(++_0x571fad);}(_0x318d,0xff));var _0xd318=function(_0x2b89f4,_0x1c8ba5){_0x2b89f4=_0x2b89f4-0x0;var _0x264891=_0x318d[_0x2b89f4];return _0x264891;};'use strict';var client=require(_0xd318('0x0'));exports['create']=function(_0x1c8843){return client[_0xd318('0x1')]('CreateSmsMessage',{'body':_0x1c8843,'log':_0xd318('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 63c64e4..b42a545 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x42bb2f,_0x1abf5d){var _0x358d1b=function(_0xb3713a){while(--_0xb3713a){_0x42bb2f['push'](_0x42bb2f['shift']());}};_0x358d1b(++_0x1abf5d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x5d5bcb,_0x25e2ea){var _0x4ea5eb=function(_0x36782b){while(--_0x36782b){_0x5d5bcb['push'](_0x5d5bcb['shift']());}};_0x4ea5eb(++_0x25e2ea);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 9f68b2c..6464744 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(_0x493c7a,_0x30ea93){var _0x1ad499=function(_0x5c8318){while(--_0x5c8318){_0x493c7a['push'](_0x493c7a['shift']());}};_0x1ad499(++_0x30ea93);}(_0x008c,0x188));var _0xc008=function(_0x207f67,_0x172ffa){_0x207f67=_0x207f67-0x0;var _0x4d6724=_0x008c[_0x207f67];return _0x4d6724;};'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 _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x3e9645,_0x2399cb){var _0x332da7=function(_0x295cf8){while(--_0x295cf8){_0x3e9645['push'](_0x3e9645['shift']());}};_0x332da7(++_0x2399cb);}(_0x55ca,0x126));var _0xa55c=function(_0x263cfa,_0x443531){_0x263cfa=_0x263cfa-0x0;var _0x14b8ec=_0x55ca[_0x263cfa];return _0x14b8ec;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 19774ff..34e5acb 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(_0x209e71,_0x4b1dcc){var _0x11a614=function(_0xcb00e7){while(--_0xcb00e7){_0x209e71['push'](_0x209e71['shift']());}};_0x11a614(++_0x4b1dcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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(_0x3a104e,_0x32ad1b){var _0x413098=function(_0x29cd2d){while(--_0x29cd2d){_0x3a104e['push'](_0x3a104e['shift']());}};_0x413098(++_0x32ad1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 7036d1b..02edf79 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 _0x9e69=['AddTagsToWhatsappInteraction','update','Request','updateWhatsappInteraction','addTags'];(function(_0x234921,_0x1b9462){var _0x6f380c=function(_0x304c02){while(--_0x304c02){_0x234921['push'](_0x234921['shift']());}};_0x6f380c(++_0x1b9462);}(_0x9e69,0x150));var _0x99e6=function(_0xde9286,_0x522d87){_0xde9286=_0xde9286-0x0;var _0xfa35c5=_0x9e69[_0xde9286];return _0xfa35c5;};'use strict';var client=require('../client');exports[_0x99e6('0x0')]=function(_0xab6035,_0x10387b){return client[_0x99e6('0x1')]('UpdateWhatsappInteraction',{'body':_0x10387b,'options':{'where':{'id':_0xab6035}},'log':_0x99e6('0x2')});};exports[_0x99e6('0x3')]=function(_0x5f3985,_0x8a6c5c){return client[_0x99e6('0x1')](_0x99e6('0x4'),{'body':_0x8a6c5c,'options':{'where':{'id':_0x5f3985}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x677a=['UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request'];(function(_0xe8a0e6,_0x55ab62){var _0x9ccc53=function(_0x2772ef){while(--_0x2772ef){_0xe8a0e6['push'](_0xe8a0e6['shift']());}};_0x9ccc53(++_0x55ab62);}(_0x677a,0xd6));var _0xa677=function(_0x5da5ea,_0x24b96c){_0x5da5ea=_0x5da5ea-0x0;var _0x741d54=_0x677a[_0x5da5ea];return _0x741d54;};'use strict';var client=require(_0xa677('0x0'));exports['update']=function(_0x3896be,_0x1a14cf){return client[_0xa677('0x1')](_0xa677('0x2'),{'body':_0x1a14cf,'options':{'where':{'id':_0x3896be}},'log':_0xa677('0x3')});};exports['addTags']=function(_0x1ca988,_0x2e46f8){return client[_0xa677('0x1')](_0xa677('0x4'),{'body':_0x2e46f8,'options':{'where':{'id':_0x1ca988}},'log':_0xa677('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 137384f..ec65031 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 _0x868e=['CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x4a1c8d,_0x30fed2){var _0x336713=function(_0x431931){while(--_0x431931){_0x4a1c8d['push'](_0x4a1c8d['shift']());}};_0x336713(++_0x30fed2);}(_0x868e,0x10d));var _0xe868=function(_0x5d7005,_0x41f35a){_0x5d7005=_0x5d7005-0x0;var _0x31ed20=_0x868e[_0x5d7005];return _0x31ed20;};'use strict';var client=require('../client');exports[_0xe868('0x0')]=function(_0x484269){return client['Request'](_0xe868('0x1'),{'body':_0x484269,'log':_0xe868('0x2')});}; \ No newline at end of file +var _0xfae9=['CreateWhatsappMessage'];(function(_0x27bd2c,_0x24bd98){var _0x3784ea=function(_0x4ca802){while(--_0x4ca802){_0x27bd2c['push'](_0x27bd2c['shift']());}};_0x3784ea(++_0x24bd98);}(_0xfae9,0x121));var _0x9fae=function(_0x4bbb86,_0x385744){_0x4bbb86=_0x4bbb86-0x0;var _0x2cf22b=_0xfae9[_0x4bbb86];return _0x2cf22b;};'use strict';var client=require('../client');exports['create']=function(_0x212354){return client['Request'](_0x9fae('0x0'),{'body':_0x212354,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 992c9be..7ce612c 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 _0x721d=['whatsappPause','../client','getWhatsappQueues','Request','name','timeout','User','Agents','online'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x721d,0x121));var _0xd721=function(_0x147e9f,_0x57b3cb){_0x147e9f=_0x147e9f-0x0;var _0x321585=_0x721d[_0x147e9f];return _0x321585;};'use strict';var client=require(_0xd721('0x0'));exports[_0xd721('0x1')]=function(){return function(){return client[_0xd721('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xd721('0x3'),_0xd721('0x4'),'strategy'],'include':[{'model':_0xd721('0x5'),'as':_0xd721('0x6'),'attributes':['id','name',_0xd721('0x7'),_0xd721('0x8')]}]},'log':_0xd721('0x1')});};}; \ No newline at end of file +var _0x7923=['Agents','online','whatsappPause','getWhatsappQueues','GetWhatsappQueue','name','strategy','User'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7923,0x18b));var _0x3792=function(_0x344c66,_0x4ad0ac){_0x344c66=_0x344c66-0x0;var _0x2d9bfb=_0x7923[_0x344c66];return _0x2d9bfb;};'use strict';var client=require('../client');exports[_0x3792('0x0')]=function(){return function(){return client['Request'](_0x3792('0x1'),{'options':{'raw':![],'attributes':['id',_0x3792('0x2'),'timeout',_0x3792('0x3')],'include':[{'model':_0x3792('0x4'),'as':_0x3792('0x5'),'attributes':['id','name',_0x3792('0x6'),_0x3792('0x7')]}]},'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 4c51b15..a1d97b4 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 _0x7c39=['CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x4825d9,_0x34e8aa){var _0x523d93=function(_0x46f5a0){while(--_0x46f5a0){_0x4825d9['push'](_0x4825d9['shift']());}};_0x523d93(++_0x34e8aa);}(_0x7c39,0x1ef));var _0x97c3=function(_0x2d90df,_0x53b2b1){_0x2d90df=_0x2d90df-0x0;var _0x43bf36=_0x7c39[_0x2d90df];return _0x43bf36;};'use strict';var client=require(_0x97c3('0x0'));exports[_0x97c3('0x1')]=function(_0x47a7e1){return client['Request'](_0x97c3('0x2'),{'body':_0x47a7e1,'log':'CreateWhatsappQueueReport'});};exports[_0x97c3('0x3')]=function(_0x210c08,_0x57e33b){return client[_0x97c3('0x4')](_0x97c3('0x5'),{'body':_0x57e33b,'options':{'where':{'uniqueid':_0x210c08},'order':[['id',_0x97c3('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x424c=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0xc101a1,_0x41077f){var _0x1042e1=function(_0x52672e){while(--_0x52672e){_0xc101a1['push'](_0xc101a1['shift']());}};_0x1042e1(++_0x41077f);}(_0x424c,0x8a));var _0xc424=function(_0x3d45ea,_0x16f9ec){_0x3d45ea=_0x3d45ea-0x0;var _0x13fc7f=_0x424c[_0x3d45ea];return _0x13fc7f;};'use strict';var client=require(_0xc424('0x0'));exports[_0xc424('0x1')]=function(_0x2e4f48){return client[_0xc424('0x2')](_0xc424('0x3'),{'body':_0x2e4f48,'log':_0xc424('0x3')});};exports[_0xc424('0x4')]=function(_0x468d8d,_0x5935fe){return client[_0xc424('0x2')]('UpdateWhatsappQueueReport',{'body':_0x5935fe,'options':{'where':{'uniqueid':_0x468d8d},'order':[['id','DESC']],'limit':0x1},'log':_0xc424('0x5')});}; \ 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 cfa7ff0..664fae6 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 _0x3409=['consequence','length','[%s][AGENT]\x20%s','map','message','stop','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name'];(function(_0x9311bd,_0x14aa6c){var _0x49870d=function(_0x4d41c9){while(--_0x4d41c9){_0x9311bd['push'](_0x9311bd['shift']());}};_0x49870d(++_0x14aa6c);}(_0x3409,0xcc));var _0x9340=function(_0x241f9e,_0x2a8cce){_0x241f9e=_0x241f9e-0x0;var _0x1b66bf=_0x3409[_0x241f9e];return _0x1b66bf;};'use strict';var schema=require(_0x9340('0x0'));var _=require(_0x9340('0x1'));var util=require(_0x9340('0x2'));var seqqueue=require(_0x9340('0x3'));var logger=require(_0x9340('0x4'))(_0x9340('0x5'));var strategy=require(_0x9340('0x6'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x9340('0x7')},'timeout':{'type':'number','message':_0x9340('0x8')}});function writeLog(_0x51122b,_0x5746f7,_0x2ffe24){return logger[_0x9340('0x9')](util['format'](_0x9340('0xa'),_0x51122b,_0x5746f7[_0x9340('0xb')],_0x2ffe24));}function handleFindAgent(_0x373610){return function(_0x501ba8){return _0x501ba8[_0x9340('0xb')]['toLowerCase']()===_0x373610['toLowerCase']();};}exports[_0x9340('0xc')]=function(_0x329864,_0x8f05ad,_0x13bafc,_0xff4e14){return function(_0x19c1cf){try{var _0x1c6708={'name':_0x8f05ad[0x0],'timeout':_0x8f05ad[0x1]};var _0xccd24c=queue[_0x9340('0x0')](_0x1c6708,{'typecast':!![]});if(_0xccd24c[_0x9340('0xd')]){logger['error'](_0x9340('0xe'),_0x329864,_[_0x9340('0xf')](_0xccd24c,_0x9340('0x10'))['join'](',\x20'));_0x19c1cf[_0x9340('0x11')]();}else{var _0x586851=_['find'](_0x13bafc[_0x9340('0x12')],handleFindAgent(_0x1c6708[_0x9340('0xb')]));if(_0x586851){var _0x5b77f6=(_0x1c6708[_0x9340('0x13')]||0xa)*0x3e8;var _0x17ee32,_0x394a8f;var _0x553f1d=seqqueue[_0x9340('0x14')](_0x5b77f6);_0x553f1d['id']=_0x329864;_0x553f1d[_0x9340('0x15')]=_0x5b77f6;_0x553f1d[_0x9340('0x16')]=_0xff4e14['channel'];writeLog(_0x329864,_0x586851,util['format'](_0x9340('0x17'),_0x5b77f6));_0x13bafc[_0x9340('0x18')][_0x329864]['on'](_0x9340('0x19'),function(){logger[_0x9340('0x9')](_0x9340('0x1a'),_0x329864);clearTimeout(_0x394a8f);_0x394a8f=undefined;_0x553f1d['close']();if(_0x13bafc[_0x9340('0x18')][_0x329864]){delete _0x13bafc[_0x9340('0x18')][_0x329864];}_0x19c1cf[_0x9340('0x11')]();});_0x13bafc[_0x9340('0x18')][_0x329864]['on'](_0x9340('0x1b'),function(){if(_0x13bafc['rules'][_0x329864]){delete _0x13bafc[_0x9340('0x18')][_0x329864];}});_0x394a8f=setTimeout(function(){logger[_0x9340('0x9')](_0x9340('0x1c'),_0x329864);clearTimeout(_0x394a8f);_0x553f1d[_0x9340('0x1d')]();_0x19c1cf[_0x9340('0x1e')]();},_0x5b77f6);strategy[_0x9340('0x1f')](_0x553f1d,_0x586851,_0x13bafc,_0xff4e14);}else{logger['error'](_0x9340('0x20'),_0x329864,_0x1c6708[_0x9340('0xb')]);_0x19c1cf[_0x9340('0x11')]();}}}catch(_0x40d319){console[_0x9340('0x21')](_0x40d319);logger['error'](_0x9340('0x22'),_0x329864,_0x40d319[_0x9340('0x23')]);_0x19c1cf[_0x9340('0x11')]();}};}; \ No newline at end of file +var _0x1ab4=['../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','map','message','stop','find','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue'];(function(_0x5483eb,_0x102101){var _0x1c071d=function(_0x5c3f23){while(--_0x5c3f23){_0x5483eb['push'](_0x5483eb['shift']());}};_0x1c071d(++_0x102101);}(_0x1ab4,0xbc));var _0x41ab=function(_0x443e0c,_0x51ca0e){_0x443e0c=_0x443e0c-0x0;var _0x963c7e=_0x1ab4[_0x443e0c];return _0x963c7e;};'use strict';var schema=require(_0x41ab('0x0'));var _=require(_0x41ab('0x1'));var util=require(_0x41ab('0x2'));var seqqueue=require(_0x41ab('0x3'));var logger=require(_0x41ab('0x4'))(_0x41ab('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x41ab('0x6'),'required':!![],'message':_0x41ab('0x7')},'timeout':{'type':'number','message':_0x41ab('0x8')}});function writeLog(_0x59662f,_0x1f265a,_0x2ab961){return logger[_0x41ab('0x9')](util[_0x41ab('0xa')](_0x41ab('0xb'),_0x59662f,_0x1f265a[_0x41ab('0xc')],_0x2ab961));}function handleFindAgent(_0x10d289){return function(_0x31c973){return _0x31c973['name'][_0x41ab('0xd')]()===_0x10d289[_0x41ab('0xd')]();};}exports['consequence']=function(_0x195b64,_0x4e46c3,_0x463059,_0x3b00d0){return function(_0x16c672){try{var _0x4580bf={'name':_0x4e46c3[0x0],'timeout':_0x4e46c3[0x1]};var _0x3cd7e8=queue['validate'](_0x4580bf,{'typecast':!![]});if(_0x3cd7e8[_0x41ab('0xe')]){logger[_0x41ab('0xf')]('[%s][AGENT]\x20%s',_0x195b64,_[_0x41ab('0x10')](_0x3cd7e8,_0x41ab('0x11'))['join'](',\x20'));_0x16c672[_0x41ab('0x12')]();}else{var _0x63045d=_[_0x41ab('0x13')](_0x463059['agents'],handleFindAgent(_0x4580bf[_0x41ab('0xc')]));if(_0x63045d){var _0x2f8703=(_0x4580bf['timeout']||0xa)*0x3e8;var _0x33019e,_0xaabef4;var _0x504458=seqqueue['createQueue'](_0x2f8703);_0x504458['id']=_0x195b64;_0x504458['atimeout']=_0x2f8703;_0x504458[_0x41ab('0x14')]=_0x3b00d0[_0x41ab('0x14')];writeLog(_0x195b64,_0x63045d,util[_0x41ab('0xa')](_0x41ab('0x15'),_0x2f8703));_0x463059[_0x41ab('0x16')][_0x195b64]['on']('end',function(){logger[_0x41ab('0x9')](_0x41ab('0x17'),_0x195b64);clearTimeout(_0xaabef4);_0xaabef4=undefined;_0x504458[_0x41ab('0x18')]();if(_0x463059[_0x41ab('0x16')][_0x195b64]){delete _0x463059[_0x41ab('0x16')][_0x195b64];}_0x16c672[_0x41ab('0x12')]();});_0x463059[_0x41ab('0x16')][_0x195b64]['on'](_0x41ab('0x19'),function(){if(_0x463059[_0x41ab('0x16')][_0x195b64]){delete _0x463059['rules'][_0x195b64];}});_0xaabef4=setTimeout(function(){logger[_0x41ab('0x9')](_0x41ab('0x1a'),_0x195b64);clearTimeout(_0xaabef4);_0x504458[_0x41ab('0x18')]();_0x16c672[_0x41ab('0x1b')]();},_0x2f8703);strategy[_0x41ab('0x1c')](_0x504458,_0x63045d,_0x463059,_0x3b00d0);}else{logger['error'](_0x41ab('0x1d'),_0x195b64,_0x4580bf['name']);_0x16c672[_0x41ab('0x12')]();}}}catch(_0x48fbab){console[_0x41ab('0x1e')](_0x48fbab);logger[_0x41ab('0xf')](_0x41ab('0x1f'),_0x195b64,_0x48fbab['stack']);_0x16c672[_0x41ab('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index db680dc..1fb50c9 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 _0xdfb3=['YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','chat','ChatWebsiteId','account','upperFirst','created','isEmpty','body','getMustacheRender','Message','create','then','info','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','providerName','amazonlex','providerResponse','stringify','dialogState','Failed','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format'];(function(_0x372cfa,_0x54510d){var _0x3edd1c=function(_0x554061){while(--_0x554061){_0x372cfa['push'](_0x372cfa['shift']());}};_0x3edd1c(++_0x54510d);}(_0xdfb3,0x147));var _0x3dfb=function(_0x3ab399,_0x460019){_0x3ab399=_0x3ab399-0x0;var _0x6f3f1f=_0xdfb3[_0x3ab399];return _0x6f3f1f;};'use strict';var _=require('lodash');var moment=require(_0x3dfb('0x0'));var AWS=require(_0x3dfb('0x1'));var utils=require(_0x3dfb('0x2'));var logger=require(_0x3dfb('0x3'))(_0x3dfb('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x3dfb('0x5')),'mailMessage':require(_0x3dfb('0x6')),'smsMessage':require(_0x3dfb('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x3dfb('0x8')]=function(_0x46f868,_0x1007ee){return function(_0x3a2fa3){try{if(!_[_0x3dfb('0x9')](this[_0x3dfb('0xa')][_0x3dfb('0xb')])){logger['info'](_0x3dfb('0xc'),_0x46f868,_0x3dfb('0xd'));return _0x3a2fa3[_0x3dfb('0xe')]();}var _0x130f20={'ContactId':this['contact']['id'],'sentAt':moment()[_0x3dfb('0xf')](_0x3dfb('0x10')),'direction':_0x3dfb('0x11')};if(this['channel']===_0x3dfb('0x12')||this[_0x3dfb('0x13')]==='whatsapp'){_0x130f20['phone']=this[_0x3dfb('0xa')][_0x3dfb('0x14')];}var _0x2a4f92=this[_0x3dfb('0x13')];if(_0x2a4f92===_0x3dfb('0x15')){_0x130f20[_0x3dfb('0x16')]=this[_0x3dfb('0x17')]['id'];}else{_0x130f20[_['upperFirst'](_0x2a4f92)+'AccountId']=this['account']['id'];}_0x130f20[_[_0x3dfb('0x18')](_0x2a4f92)+'InteractionId']=this[_0x3dfb('0xa')]['id'];if(this[_0x3dfb('0xa')][_0x3dfb('0x19')]){var _0x136f50=_0x1007ee[0x4];if(!_[_0x3dfb('0x1a')](_0x136f50)){_0x130f20[_0x3dfb('0x1b')]=utils[_0x3dfb('0x1c')](_0x136f50,this);return rpc[_0x2a4f92+_0x3dfb('0x1d')][_0x3dfb('0x1e')](_0x130f20)[_0x3dfb('0x1f')](function(_0x297f13){logger[_0x3dfb('0x20')]('[%s][AMAZONLEX]\x20%s',_0x46f868,_0x130f20[_0x3dfb('0x1b')]);})[_0x3dfb('0x21')](function(_0x280a90){logger[_0x3dfb('0x22')]('[%s][AMAZONLEX]\x20%s',_0x46f868,JSON['stringify'](_0x280a90));})[_0x3dfb('0x23')](function(){logger[_0x3dfb('0x20')](_0x3dfb('0x24'),_0x46f868);_0x3a2fa3['stop']();});}else{logger[_0x3dfb('0x20')](_0x3dfb('0x25'),_0x46f868);_0x3a2fa3[_0x3dfb('0x26')]();}}else{var _0xb01baa=this;var _0x268112=new AWS[(_0x3dfb('0x27'))]({'accessKeyId':_0x1007ee[0x0],'secretAccessKey':_0x1007ee[0x1],'region':_0x1007ee[0x2]});var _0x51085f={'botAlias':_0x3dfb('0x28'),'botName':_0x1007ee[0x3],'inputText':this[_0x3dfb('0x29')][_0x3dfb('0x1b')],'userId':this['channel']+':'+this[_0x3dfb('0xa')]['id'][_0x3dfb('0x2a')]()};_0x268112['postText'](_0x51085f,function(_0x3a656b,_0x62e20d){if(_0x3a656b){logger['error']('[%s][AMAZONLEX]\x20%s',_0x46f868,_0x3a656b['message']);_0x3a2fa3[_0x3dfb('0xe')]();}else if(_0x62e20d&&_0x62e20d[_0x3dfb('0x29')]){_0xb01baa[_0x3dfb('0x1b')]['amazonlex']=_0x62e20d;_0x130f20[_0x3dfb('0x1b')]=_0x62e20d[_0x3dfb('0x29')];_0x130f20[_0x3dfb('0x2b')]=_0x3dfb('0x2c');_0x130f20[_0x3dfb('0x2d')]=JSON[_0x3dfb('0x2e')](_0x62e20d);return rpc[_0x2a4f92+'Message'][_0x3dfb('0x1e')](_0x130f20)[_0x3dfb('0x1f')](function(_0x1f6ee7){logger['info'](_0x3dfb('0xc'),_0x46f868,_0x130f20[_0x3dfb('0x1b')]);if(_0x62e20d[_0x3dfb('0x2f')]==_0x3dfb('0x30')){_0x3a2fa3[_0x3dfb('0xe')]();}else{_0x3a2fa3[_0x3dfb('0x26')]();}})[_0x3dfb('0x21')](function(_0x3bcb40){logger[_0x3dfb('0x22')]('[%s][AMAZONLEX]\x20%s',_0x46f868,JSON[_0x3dfb('0x2e')](_0x3bcb40));_0x3a2fa3[_0x3dfb('0xe')]();});}else{_0x3a2fa3[_0x3dfb('0xe')]();}});}}catch(_0x28d534){logger[_0x3dfb('0x22')](_0x3dfb('0xc'),_0x46f868,JSON[_0x3dfb('0x2e')](_0x28d534));_0x3a2fa3['stop']();}};}; \ No newline at end of file +var _0x19c5=['stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','postText','message','amazonlex','providerName','providerResponse','stringify','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','isEmpty','body','getMustacheRender','Message','create','then','catch','error','finally'];(function(_0x1e8124,_0x35dd90){var _0x10d852=function(_0x4137e4){while(--_0x4137e4){_0x1e8124['push'](_0x1e8124['shift']());}};_0x10d852(++_0x35dd90);}(_0x19c5,0x14a));var _0x519c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x19c5[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x519c('0x0'));var moment=require(_0x519c('0x1'));var AWS=require(_0x519c('0x2'));var utils=require(_0x519c('0x3'));var logger=require(_0x519c('0x4'))(_0x519c('0x5'));var rpc={'chatMessage':require(_0x519c('0x6')),'openchannelMessage':require(_0x519c('0x7')),'mailMessage':require(_0x519c('0x8')),'smsMessage':require(_0x519c('0x9')),'faxMessage':require(_0x519c('0xa')),'whatsappMessage':require(_0x519c('0xb'))};exports['consequence']=function(_0x1bab7d,_0x308995){return function(_0x5dfee6){try{if(!_[_0x519c('0xc')](this[_0x519c('0xd')][_0x519c('0xe')])){logger[_0x519c('0xf')](_0x519c('0x10'),_0x1bab7d,_0x519c('0x11'));return _0x5dfee6[_0x519c('0x12')]();}var _0xb6357f={'ContactId':this[_0x519c('0x13')]['id'],'sentAt':moment()[_0x519c('0x14')](_0x519c('0x15')),'direction':'out'};if(this[_0x519c('0x16')]===_0x519c('0x17')||this['channel']===_0x519c('0x18')){_0xb6357f[_0x519c('0x19')]=this['interaction'][_0x519c('0x19')];}var _0x462ed4=this['channel'];if(_0x462ed4===_0x519c('0x1a')){_0xb6357f[_0x519c('0x1b')]=this[_0x519c('0x1c')]['id'];}else{_0xb6357f[_['upperFirst'](_0x462ed4)+_0x519c('0x1d')]=this['account']['id'];}_0xb6357f[_[_0x519c('0x1e')](_0x462ed4)+_0x519c('0x1f')]=this[_0x519c('0xd')]['id'];if(this['interaction']['created']){var _0x2c0dcf=_0x308995[0x4];if(!_[_0x519c('0x20')](_0x2c0dcf)){_0xb6357f[_0x519c('0x21')]=utils[_0x519c('0x22')](_0x2c0dcf,this);return rpc[_0x462ed4+_0x519c('0x23')][_0x519c('0x24')](_0xb6357f)[_0x519c('0x25')](function(_0x59faa8){logger[_0x519c('0xf')](_0x519c('0x10'),_0x1bab7d,_0xb6357f[_0x519c('0x21')]);})[_0x519c('0x26')](function(_0x265199){logger[_0x519c('0x27')]('[%s][AMAZONLEX]\x20%s',_0x1bab7d,JSON['stringify'](_0x265199));})[_0x519c('0x28')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1bab7d);_0x5dfee6[_0x519c('0x29')]();});}else{logger[_0x519c('0xf')](_0x519c('0x2a'),_0x1bab7d);_0x5dfee6[_0x519c('0x29')]();}}else{var _0x33608e=this;var _0x2dd2ba=new AWS[(_0x519c('0x2b'))]({'accessKeyId':_0x308995[0x0],'secretAccessKey':_0x308995[0x1],'region':_0x308995[0x2]});var _0x3da8a0={'botAlias':_0x519c('0x2c'),'botName':_0x308995[0x3],'inputText':this['message']['body'],'userId':this[_0x519c('0x16')]+':'+this[_0x519c('0xd')]['id'][_0x519c('0x2d')]()};_0x2dd2ba[_0x519c('0x2e')](_0x3da8a0,function(_0x606456,_0x520d29){if(_0x606456){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1bab7d,_0x606456[_0x519c('0x2f')]);_0x5dfee6[_0x519c('0x12')]();}else if(_0x520d29&&_0x520d29[_0x519c('0x2f')]){_0x33608e[_0x519c('0x21')][_0x519c('0x30')]=_0x520d29;_0xb6357f[_0x519c('0x21')]=_0x520d29['message'];_0xb6357f[_0x519c('0x31')]=_0x519c('0x30');_0xb6357f[_0x519c('0x32')]=JSON[_0x519c('0x33')](_0x520d29);return rpc[_0x462ed4+_0x519c('0x23')][_0x519c('0x24')](_0xb6357f)[_0x519c('0x25')](function(_0x3fa5c5){logger[_0x519c('0xf')](_0x519c('0x10'),_0x1bab7d,_0xb6357f[_0x519c('0x21')]);if(_0x520d29['dialogState']==_0x519c('0x34')){_0x5dfee6[_0x519c('0x12')]();}else{_0x5dfee6['stop']();}})[_0x519c('0x26')](function(_0x22624a){logger['error'](_0x519c('0x10'),_0x1bab7d,JSON[_0x519c('0x33')](_0x22624a));_0x5dfee6[_0x519c('0x12')]();});}else{_0x5dfee6['next']();}});}}catch(_0x4521d8){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1bab7d,JSON[_0x519c('0x33')](_0x4521d8));_0x5dfee6[_0x519c('0x29')]();}};}; \ 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 607f1bd..bd4c329 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 _0x45cd=['[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','Message','Smtp','service','host','port','secure','authentication','auth','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','channel','mail','body','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted'];(function(_0x4c1ad8,_0x55e28d){var _0x2c617b=function(_0x5f80df){while(--_0x5f80df){_0x4c1ad8['push'](_0x4c1ad8['shift']());}};_0x2c617b(++_0x55e28d);}(_0x45cd,0x1c8));var _0xd45c=function(_0x24ec0b,_0x1a41d2){_0x24ec0b=_0x24ec0b-0x0;var _0x484d93=_0x45cd[_0x24ec0b];return _0x484d93;};'use strict';var _=require(_0xd45c('0x0'));var moment=require(_0xd45c('0x1'));var utils=require('./utils');var logger=require(_0xd45c('0x2'))(_0xd45c('0x3'));var rpc={'chatMessage':require(_0xd45c('0x4')),'openchannelMessage':require(_0xd45c('0x5')),'mailMessage':require(_0xd45c('0x6')),'smsMessage':require(_0xd45c('0x7')),'faxMessage':require(_0xd45c('0x8')),'whatsappMessage':require(_0xd45c('0x9')),'chatInteraction':require(_0xd45c('0xa')),'openchannelInteraction':require(_0xd45c('0xb')),'mailInteraction':require(_0xd45c('0xc')),'smsInteraction':require(_0xd45c('0xd')),'faxInteraction':require(_0xd45c('0xe')),'whatsappInteraction':require(_0xd45c('0xf'))};var mailRpc=require('../../mailRpc');exports[_0xd45c('0x10')]=function(_0x3c9ca5,_0x539a98,_0x44c76a,_0x322c98){return function(_0x23f92e){try{var _0x233bf8=this[_0xd45c('0x11')];if(_0x233bf8===_0xd45c('0x12')&&_0x322c98[_0xd45c('0x13')][_0xd45c('0x14')]){logger[_0xd45c('0x15')]('[%s][AUTOREPLY]\x20%s',_0x3c9ca5,_0xd45c('0x16'));return _0x23f92e[_0xd45c('0x17')]();}if(_0x539a98[0x0]==='1'&&(_[_0xd45c('0x18')](this[_0xd45c('0x19')][_0xd45c('0x1a')])||!this[_0xd45c('0x19')][_0xd45c('0x1a')])){logger[_0xd45c('0x15')](_0xd45c('0x1b'),_0x3c9ca5,_0xd45c('0x1c'));return _0x23f92e[_0xd45c('0x17')]();}if(_0x539a98[0x0]==='2'&&this[_0xd45c('0x19')][_0xd45c('0x1d')]){logger[_0xd45c('0x15')](_0xd45c('0x1e'),_0x3c9ca5,_0xd45c('0x1f'));return _0x23f92e[_0xd45c('0x17')]();}var _0x4de351={'ContactId':this[_0xd45c('0x20')]['id'],'sentAt':moment()[_0xd45c('0x21')](_0xd45c('0x22')),'direction':'out'};if(this[_0xd45c('0x11')]===_0xd45c('0x12')){_0x4de351[_0xd45c('0x13')]=utils[_0xd45c('0x23')](_0x539a98[0x2],this);}else{_0x4de351['body']=utils[_0xd45c('0x23')](_0x539a98[0x1],this);}if(this['message']){_0x4de351['to']=this[_0xd45c('0x24')]['from']||'';if(this['channel']===_0xd45c('0x12')&&_0x539a98[0x1]==='1'){_0x4de351['cc']=this[_0xd45c('0x24')]['cc']||'';}_0x4de351[_0xd45c('0x25')]=this[_0xd45c('0x24')]['to']||'';_0x4de351['phone']=this[_0xd45c('0x24')][_0xd45c('0x26')]||'';_0x4de351[_0xd45c('0x27')]=!![];if(this[_0xd45c('0x24')][_0xd45c('0x28')]){_0x4de351[_0xd45c('0x28')]='';_0x4de351[_0xd45c('0x28')]+=_['startsWith'](this[_0xd45c('0x24')][_0xd45c('0x28')],_0xd45c('0x29'))?'':_0xd45c('0x2a');_0x4de351[_0xd45c('0x28')]+=this['message'][_0xd45c('0x28')];}}if(this[_0xd45c('0x11')]===_0xd45c('0x2b')){_0x4de351[_0xd45c('0x2c')]=this['account']['id'];}else{_0x4de351[_[_0xd45c('0x2d')](this[_0xd45c('0x11')])+_0xd45c('0x2e')]=this[_0xd45c('0x2f')]['id'];}_0x4de351[_['upperFirst'](this[_0xd45c('0x11')])+'InteractionId']=this[_0xd45c('0x19')]['id'];var _0x5eda36=this['interaction'];if(rpc[this['channel']+_0xd45c('0x30')]){if(this[_0xd45c('0x11')]===_0xd45c('0x12')){var _0x4587ed={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0xd45c('0x31')]['service']){_0x4587ed['service']=this[_0xd45c('0x2f')][_0xd45c('0x31')][_0xd45c('0x32')];}else{_0x4587ed[_0xd45c('0x33')]=this[_0xd45c('0x2f')]['Smtp'][_0xd45c('0x33')];_0x4587ed['port']=this[_0xd45c('0x2f')][_0xd45c('0x31')][_0xd45c('0x34')];_0x4587ed[_0xd45c('0x35')]=this[_0xd45c('0x2f')][_0xd45c('0x31')]['secure'];}if(this['account'][_0xd45c('0x31')][_0xd45c('0x36')]){_0x4587ed[_0xd45c('0x37')]={'user':this[_0xd45c('0x2f')][_0xd45c('0x31')]['user'],'pass':this[_0xd45c('0x2f')][_0xd45c('0x31')]['pass']};}_0x4de351['inReplyTo']=this[_0xd45c('0x24')][_0xd45c('0x38')];_0x4de351[_0xd45c('0x39')]=_0xd45c('0x3a')+_[_0xd45c('0x3b')](_0x4de351[_0xd45c('0x13')],_0xd45c('0x3c'),_0xd45c('0x3d'))+_0xd45c('0x3e');_0x4de351[_0xd45c('0x3f')]={'Auto-Submitted':_0xd45c('0x40'),'X-Auto-Response-Suppress':_0xd45c('0x41'),'Precedence':_0xd45c('0x42')};return mailRpc[_0xd45c('0x43')](_0x4587ed,_0x4de351)[_0xd45c('0x44')](function(_0x49ac77){logger[_0xd45c('0x15')](_0xd45c('0x45'),_0x3c9ca5);_0x4de351[_0xd45c('0x38')]=_0x49ac77[_0xd45c('0x24')][_0xd45c('0x38')];return rpc[_0x233bf8+_0xd45c('0x30')][_0xd45c('0x46')](_0x4de351);})['then'](function(_0x516853){logger[_0xd45c('0x15')](_0xd45c('0x1b'),_0x3c9ca5,JSON['stringify'](_0x516853));})[_0xd45c('0x47')](function(_0x442920){logger[_0xd45c('0x48')](_0xd45c('0x49'),_0x3c9ca5,JSON[_0xd45c('0x4a')](_0x442920));})[_0xd45c('0x4b')](function(){Promise[_0xd45c('0x4c')]()[_0xd45c('0x44')](function(){if(_0x539a98[0x0]!=='2'||_0x5eda36[_0xd45c('0x1d')])return;return rpc[_0x233bf8+_0xd45c('0x4d')][_0xd45c('0x4e')](_0x5eda36['id'],{'autoreplyExecuted':!![]})['then'](function(_0x3bb0a2){logger[_0xd45c('0x15')](_0xd45c('0x1e'),_0x3c9ca5,JSON[_0xd45c('0x4a')](_0x3bb0a2));})['catch'](function(_0x39c1b7){logger[_0xd45c('0x48')](_0xd45c('0x4f'),_0x3c9ca5,JSON[_0xd45c('0x4a')](_0x39c1b7));});})[_0xd45c('0x44')](function(){_0x23f92e[_0xd45c('0x17')]();});});}else{return rpc[this[_0xd45c('0x11')]+_0xd45c('0x30')][_0xd45c('0x46')](_0x4de351)[_0xd45c('0x44')](function(_0x149029){logger[_0xd45c('0x15')](_0xd45c('0x1b'),_0x3c9ca5,_0x4de351['body']);})[_0xd45c('0x47')](function(_0x14d08c){logger[_0xd45c('0x48')]('[%s][AUTOREPLY]\x20%s',_0x3c9ca5,JSON[_0xd45c('0x4a')](_0x14d08c));})[_0xd45c('0x4b')](function(){Promise['resolve']()['then'](function(){if(_0x539a98[0x0]!=='2'||_0x5eda36[_0xd45c('0x1d')])return;return rpc[_0x233bf8+_0xd45c('0x4d')]['update'](_0x5eda36['id'],{'autoreplyExecuted':!![]})['then'](function(_0x28d32c){logger[_0xd45c('0x15')](_0xd45c('0x1e'),_0x3c9ca5,JSON[_0xd45c('0x4a')](_0x28d32c));})[_0xd45c('0x47')](function(_0x220300){logger[_0xd45c('0x48')](_0xd45c('0x4f'),_0x3c9ca5,JSON[_0xd45c('0x4a')](_0x220300));});})[_0xd45c('0x44')](function(){_0x23f92e['next']();});});}}}catch(_0x1b27f6){logger['error'](_0xd45c('0x1b'),_0x3c9ca5,JSON[_0xd45c('0x4a')](_0x1b27f6));_0x23f92e[_0xd45c('0x50')]();}};}; \ No newline at end of file +var _0xce9c=['../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','interaction','created','info','Autoreply\x20already\x20sent','next','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','out','channel','getMustacheRender','message','mail','phone','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','Message','service','host','port','Smtp','secure','authentication','auth','user','pass','inReplyTo','messageId','html','','replace','','headers','sendMailMessage','then','create','stringify','catch','error','finally','autoreplyExecuted','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xce9c,0xc3));var _0xcce9=function(_0x5a78ec,_0x160e3f){_0x5a78ec=_0x5a78ec-0x0;var _0x3bba26=_0xce9c[_0x5a78ec];return _0x3bba26;};'use strict';var _=require(_0xcce9('0x0'));var moment=require('moment');var utils=require(_0xcce9('0x1'));var logger=require('../../../../config/logger')(_0xcce9('0x2'));var rpc={'chatMessage':require(_0xcce9('0x3')),'openchannelMessage':require(_0xcce9('0x4')),'mailMessage':require(_0xcce9('0x5')),'smsMessage':require(_0xcce9('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xcce9('0x7')),'mailInteraction':require(_0xcce9('0x8')),'smsInteraction':require(_0xcce9('0x9')),'faxInteraction':require(_0xcce9('0xa')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0xcce9('0xb'));exports['consequence']=function(_0x5e2a7a,_0x34f7e8,_0x238676,_0x5b367a){return function(_0x794cd5){try{var _0x53e72c=this['channel'];if(_0x53e72c==='mail'&&_0x5b367a[_0xcce9('0xc')][_0xcce9('0xd')]){logger['info'](_0xcce9('0xe'),_0x5e2a7a,_0xcce9('0xf'));return _0x794cd5['next']();}if(_0x34f7e8[0x0]==='1'&&(_['isNil'](this[_0xcce9('0x10')][_0xcce9('0x11')])||!this[_0xcce9('0x10')][_0xcce9('0x11')])){logger[_0xcce9('0x12')]('[%s][AUTOREPLY]\x20%s',_0x5e2a7a,_0xcce9('0x13'));return _0x794cd5[_0xcce9('0x14')]();}if(_0x34f7e8[0x0]==='2'&&this[_0xcce9('0x10')]['autoreplyExecuted']){logger[_0xcce9('0x12')](_0xcce9('0x15'),_0x5e2a7a,'One\x20Time\x20already\x20sent');return _0x794cd5[_0xcce9('0x14')]();}var _0x3d7815={'ContactId':this[_0xcce9('0x16')]['id'],'sentAt':moment()[_0xcce9('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xcce9('0x18')};if(this[_0xcce9('0x19')]==='mail'){_0x3d7815[_0xcce9('0xc')]=utils[_0xcce9('0x1a')](_0x34f7e8[0x2],this);}else{_0x3d7815['body']=utils[_0xcce9('0x1a')](_0x34f7e8[0x1],this);}if(this[_0xcce9('0x1b')]){_0x3d7815['to']=this['message']['from']||'';if(this['channel']===_0xcce9('0x1c')&&_0x34f7e8[0x1]==='1'){_0x3d7815['cc']=this[_0xcce9('0x1b')]['cc']||'';}_0x3d7815['from']=this['message']['to']||'';_0x3d7815[_0xcce9('0x1d')]=this[_0xcce9('0x1b')][_0xcce9('0x1d')]||'';_0x3d7815['read']=!![];if(this[_0xcce9('0x1b')][_0xcce9('0x1e')]){_0x3d7815[_0xcce9('0x1e')]='';_0x3d7815[_0xcce9('0x1e')]+=_[_0xcce9('0x1f')](this['message'][_0xcce9('0x1e')],_0xcce9('0x20'))?'':_0xcce9('0x21');_0x3d7815[_0xcce9('0x1e')]+=this[_0xcce9('0x1b')]['subject'];}}if(this[_0xcce9('0x19')]==='chat'){_0x3d7815[_0xcce9('0x22')]=this[_0xcce9('0x23')]['id'];}else{_0x3d7815[_[_0xcce9('0x24')](this[_0xcce9('0x19')])+_0xcce9('0x25')]=this[_0xcce9('0x23')]['id'];}_0x3d7815[_[_0xcce9('0x24')](this[_0xcce9('0x19')])+'InteractionId']=this[_0xcce9('0x10')]['id'];var _0x204fcd=this[_0xcce9('0x10')];if(rpc[this[_0xcce9('0x19')]+_0xcce9('0x26')]){if(this['channel']==='mail'){var _0x51b724={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp'][_0xcce9('0x27')]){_0x51b724[_0xcce9('0x27')]=this[_0xcce9('0x23')]['Smtp'][_0xcce9('0x27')];}else{_0x51b724[_0xcce9('0x28')]=this[_0xcce9('0x23')]['Smtp'][_0xcce9('0x28')];_0x51b724[_0xcce9('0x29')]=this[_0xcce9('0x23')][_0xcce9('0x2a')][_0xcce9('0x29')];_0x51b724[_0xcce9('0x2b')]=this[_0xcce9('0x23')]['Smtp'][_0xcce9('0x2b')];}if(this[_0xcce9('0x23')][_0xcce9('0x2a')][_0xcce9('0x2c')]){_0x51b724[_0xcce9('0x2d')]={'user':this['account'][_0xcce9('0x2a')][_0xcce9('0x2e')],'pass':this[_0xcce9('0x23')]['Smtp'][_0xcce9('0x2f')]};}_0x3d7815[_0xcce9('0x30')]=this[_0xcce9('0x1b')][_0xcce9('0x31')];_0x3d7815[_0xcce9('0x32')]=_0xcce9('0x33')+_[_0xcce9('0x34')](_0x3d7815[_0xcce9('0xc')],']+(>|$)/g,''),'priorityTrue':_0x5afa8e[0x1],'priorityFalse':_0x5afa8e[0x2]};var _0x28b98e=gotoif['validate'](_0xcde4ae,{'typecast':!![]});if(_0x28b98e['length']){logger[_0x7dfe('0xa')](_0x7dfe('0xb'),_0x4eb600,_[_0x7dfe('0xc')](_0x28b98e,_0x7dfe('0xd'))[_0x7dfe('0xe')](',\x20'));_0x5f1dff['stop']();}else{try{var _0x2cda96=eval('('+_0xcde4ae['condition']+')');var _0x225f8b=_0x2cda96?_0xcde4ae[_0x7dfe('0xf')]:_0xcde4ae[_0x7dfe('0x10')];logger[_0x7dfe('0x11')](_0x7dfe('0x12'),_0x4eb600,_0xcde4ae[_0x7dfe('0x13')],_0x2cda96,_0x225f8b||'next');if(_0x225f8b){var _0x9ae701=_[_0x7dfe('0x14')](_0x5f1dff[_0x7dfe('0x15')](),{'p':_0x225f8b});if(_0x9ae701>=0x0){logger[_0x7dfe('0x11')](_0x7dfe('0x16'),_0x4eb600,_0x225f8b||_0x7dfe('0x17'),_0x9ae701);_0x5f1dff[_0x7dfe('0x17')](_0x9ae701);}else{logger[_0x7dfe('0x11')](_0x7dfe('0x18'),_0x4eb600,_0x225f8b||_0x7dfe('0x17'));_0x5f1dff[_0x7dfe('0x19')]();}}else{_0x5f1dff[_0x7dfe('0x17')]();}}catch(_0x587d82){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x4eb600,_0x587d82[_0x7dfe('0xd')]);_0x5f1dff[_0x7dfe('0x19')]();}}}catch(_0x4f6c12){logger[_0x7dfe('0xa')](_0x7dfe('0xb'),_0x4eb600,JSON[_0x7dfe('0x1a')](_0x4f6c12));_0x5f1dff[_0x7dfe('0x19')]();}};}; \ No newline at end of file +var _0x0800=['map','join','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','message','stringify','validate','lodash','html-to-text','./utils','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x0800,0xa9));var _0x0080=function(_0x1d21bb,_0x66aa27){_0x1d21bb=_0x1d21bb-0x0;var _0x34cb4e=_0x0800[_0x1d21bb];return _0x34cb4e;};'use strict';var schema=require(_0x0080('0x0'));var _=require(_0x0080('0x1'));var htmlToText=require(_0x0080('0x2'));var utils=require(_0x0080('0x3'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0x0080('0x4'),'required':!![],'message':_0x0080('0x5')},'priorityTrue':{'type':_0x0080('0x6'),'message':_0x0080('0x7')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x240e20,_0x2d7e24){return function(_0x4b7508){try{var _0x24bfc7={'condition':htmlToText['fromString'](utils[_0x0080('0x8')](_0x2d7e24[0x0],this),{'wordwrap':![]})[_0x0080('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2d7e24[0x1],'priorityFalse':_0x2d7e24[0x2]};var _0x2b86a0=gotoif[_0x0080('0x0')](_0x24bfc7,{'typecast':!![]});if(_0x2b86a0[_0x0080('0xa')]){logger[_0x0080('0xb')](_0x0080('0xc'),_0x240e20,_[_0x0080('0xd')](_0x2b86a0,'message')[_0x0080('0xe')](',\x20'));_0x4b7508[_0x0080('0xf')]();}else{try{var _0x144cbc=eval('('+_0x24bfc7[_0x0080('0x10')]+')');var _0x4479dc=_0x144cbc?_0x24bfc7[_0x0080('0x11')]:_0x24bfc7[_0x0080('0x12')];logger['info'](_0x0080('0x13'),_0x240e20,_0x24bfc7[_0x0080('0x10')],_0x144cbc,_0x4479dc||_0x0080('0x14'));if(_0x4479dc){var _0x57623d=_['findIndex'](_0x4b7508[_0x0080('0x15')](),{'p':_0x4479dc});if(_0x57623d>=0x0){logger[_0x0080('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x240e20,_0x4479dc||'next',_0x57623d);_0x4b7508[_0x0080('0x14')](_0x57623d);}else{logger['info'](_0x0080('0x17'),_0x240e20,_0x4479dc||_0x0080('0x14'));_0x4b7508[_0x0080('0xf')]();}}else{_0x4b7508[_0x0080('0x14')]();}}catch(_0x375d6a){logger[_0x0080('0xb')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x240e20,_0x375d6a[_0x0080('0x18')]);_0x4b7508[_0x0080('0xf')]();}}}catch(_0x4ae5f1){logger[_0x0080('0xb')]('[%s][GOTOIF]\x20%s',_0x240e20,JSON[_0x0080('0x19')](_0x4ae5f1));_0x4b7508[_0x0080('0xf')]();}};}; \ 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 1c32090..72b34af 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 _0x6edd=['[%s][GOTOP]\x20priority\x20%s','priority','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','validate','lodash','../../../../config/logger','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message','join','stop'];(function(_0x3a8dc1,_0x2f03b8){var _0x4b3595=function(_0x1c19e7){while(--_0x1c19e7){_0x3a8dc1['push'](_0x3a8dc1['shift']());}};_0x4b3595(++_0x2f03b8);}(_0x6edd,0x1d5));var _0xd6ed=function(_0x3f2c00,_0x17d9fd){_0x3f2c00=_0x3f2c00-0x0;var _0x1f9bee=_0x6edd[_0x3f2c00];return _0x1f9bee;};'use strict';var schema=require(_0xd6ed('0x0'));var _=require(_0xd6ed('0x1'));var logger=require(_0xd6ed('0x2'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xd6ed('0x3')}});exports[_0xd6ed('0x4')]=function(_0xcc993e,_0x55fc92){return function(_0x4ba443){try{var _0x4c672b={'priority':_0x55fc92[0x0]};var _0x226330=gotop[_0xd6ed('0x0')](_0x4c672b,{'typecast':!![]});if(_0x226330[_0xd6ed('0x5')]){logger[_0xd6ed('0x6')](_0xd6ed('0x7'),_0xcc993e,_['map'](_0x226330,_0xd6ed('0x8'))[_0xd6ed('0x9')](',\x20'));_0x4ba443[_0xd6ed('0xa')]();}else{logger['info'](_0xd6ed('0xb'),_0xcc993e,_0x4c672b[_0xd6ed('0xc')]);if(_0x4c672b[_0xd6ed('0xc')]){var _0x2370bc=_['findIndex'](_0x4ba443['rules'](),{'p':_0x4c672b[_0xd6ed('0xc')]});if(_0x2370bc>=0x0){logger[_0xd6ed('0xd')](_0xd6ed('0xe'),_0xcc993e,_0x4c672b[_0xd6ed('0xc')]||_0xd6ed('0xf'),_0x2370bc);_0x4ba443[_0xd6ed('0xf')](_0x2370bc);}else{logger[_0xd6ed('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0xcc993e,_0x4c672b[_0xd6ed('0xc')]||_0xd6ed('0xf'));_0x4ba443[_0xd6ed('0xa')]();}}else{_0x4ba443['next']();}}}catch(_0x152cbb){logger['error'](_0xd6ed('0x7'),_0xcc993e,JSON['stringify'](_0x152cbb));_0x4ba443['stop']();}};}; \ No newline at end of file +var _0xccb5=['priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message','join','stop','info'];(function(_0x5e11e0,_0x496f6c){var _0x32964e=function(_0x292a9a){while(--_0x292a9a){_0x5e11e0['push'](_0x5e11e0['shift']());}};_0x32964e(++_0x496f6c);}(_0xccb5,0xe9));var _0x5ccb=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xccb5[_0x397e5f];return _0x5302b8;};'use strict';var schema=require(_0x5ccb('0x0'));var _=require(_0x5ccb('0x1'));var logger=require(_0x5ccb('0x2'))(_0x5ccb('0x3'));var gotop=schema({'priority':{'type':_0x5ccb('0x4'),'required':!![],'message':_0x5ccb('0x5')}});exports[_0x5ccb('0x6')]=function(_0x3eb07,_0x43134b){return function(_0x478dd6){try{var _0xddad33={'priority':_0x43134b[0x0]};var _0x5caa7f=gotop[_0x5ccb('0x0')](_0xddad33,{'typecast':!![]});if(_0x5caa7f[_0x5ccb('0x7')]){logger[_0x5ccb('0x8')](_0x5ccb('0x9'),_0x3eb07,_['map'](_0x5caa7f,_0x5ccb('0xa'))[_0x5ccb('0xb')](',\x20'));_0x478dd6[_0x5ccb('0xc')]();}else{logger[_0x5ccb('0xd')]('[%s][GOTOP]\x20priority\x20%s',_0x3eb07,_0xddad33[_0x5ccb('0xe')]);if(_0xddad33[_0x5ccb('0xe')]){var _0x293dd5=_[_0x5ccb('0xf')](_0x478dd6[_0x5ccb('0x10')](),{'p':_0xddad33[_0x5ccb('0xe')]});if(_0x293dd5>=0x0){logger[_0x5ccb('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3eb07,_0xddad33[_0x5ccb('0xe')]||'next',_0x293dd5);_0x478dd6[_0x5ccb('0x11')](_0x293dd5);}else{logger[_0x5ccb('0xd')](_0x5ccb('0x12'),_0x3eb07,_0xddad33['priority']||_0x5ccb('0x11'));_0x478dd6[_0x5ccb('0xc')]();}}else{_0x478dd6[_0x5ccb('0x11')]();}}}catch(_0x4947ca){logger[_0x5ccb('0x8')](_0x5ccb('0x9'),_0x3eb07,JSON['stringify'](_0x4947ca));_0x478dd6[_0x5ccb('0xc')]();}};}; \ 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 23b6b95..e0ae89f 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 _0xf042=['../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','stringify','stop','error','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xf042,0xfe));var _0x2f04=function(_0x11f5d7,_0x272353){_0x11f5d7=_0x11f5d7-0x0;var _0x575692=_0xf042[_0x11f5d7];return _0x575692;};'use strict';var _=require(_0x2f04('0x0'));var utils=require(_0x2f04('0x1'));var logger=require(_0x2f04('0x2'))('routing');var rpc={'chatMessage':require(_0x2f04('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x2f04('0x4')),'smsMessage':require(_0x2f04('0x5')),'faxMessage':require(_0x2f04('0x6')),'whatsappMessage':require(_0x2f04('0x7'))};exports[_0x2f04('0x8')]=function(_0x492a1c,_0x9a49e8){return function(_0xa2d6c6){try{var _0xe8c454={'body':utils['getMustacheRender'](_0x9a49e8[0x0],this),'ContactId':this[_0x2f04('0x9')]['id']};if(this[_0x2f04('0xa')]===_0x2f04('0xb')){_0xe8c454[_0x2f04('0xc')]=this[_0x2f04('0xd')]['id'];}else{_0xe8c454[_[_0x2f04('0xe')](this[_0x2f04('0xa')])+'AccountId']=this[_0x2f04('0xd')]['id'];}_0xe8c454[_[_0x2f04('0xe')](this['channel'])+_0x2f04('0xf')]=this['interaction']['id'];if(rpc[this[_0x2f04('0xa')]+_0x2f04('0x10')]){return rpc[this[_0x2f04('0xa')]+'Message'][_0x2f04('0x11')](_0xe8c454)[_0x2f04('0x12')](function(_0x7fd344){logger[_0x2f04('0x13')](_0x2f04('0x14'),_0x492a1c,_0xe8c454['body']);_0xa2d6c6[_0x2f04('0x15')]();})[_0x2f04('0x16')](function(_0x41e525){logger['error'](_0x2f04('0x14'),_0x492a1c,JSON[_0x2f04('0x17')](_0x41e525));_0xa2d6c6[_0x2f04('0x18')]();});}}catch(_0x38cb1a){logger[_0x2f04('0x19')](_0x2f04('0x14'),_0x492a1c,JSON[_0x2f04('0x17')](_0x38cb1a));_0xa2d6c6[_0x2f04('0x18')]();}};}; \ No newline at end of file +var _0xdb8d=['AccountId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','error','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','getMustacheRender','chat','account','upperFirst','channel'];(function(_0x5d6e1b,_0x406561){var _0x2a9bbf=function(_0x5de0c6){while(--_0x5de0c6){_0x5d6e1b['push'](_0x5d6e1b['shift']());}};_0x2a9bbf(++_0x406561);}(_0xdb8d,0x136));var _0xddb8=function(_0xab5f15,_0x5c1860){_0xab5f15=_0xab5f15-0x0;var _0x56290a=_0xdb8d[_0xab5f15];return _0x56290a;};'use strict';var _=require(_0xddb8('0x0'));var utils=require(_0xddb8('0x1'));var logger=require(_0xddb8('0x2'))(_0xddb8('0x3'));var rpc={'chatMessage':require(_0xddb8('0x4')),'openchannelMessage':require(_0xddb8('0x5')),'mailMessage':require(_0xddb8('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xddb8('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xddb8('0x8')]=function(_0x53bc58,_0x1c6e71){return function(_0x42e0f9){try{var _0x520d02={'body':utils[_0xddb8('0x9')](_0x1c6e71[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0xddb8('0xa')){_0x520d02['ChatWebsiteId']=this[_0xddb8('0xb')]['id'];}else{_0x520d02[_[_0xddb8('0xc')](this[_0xddb8('0xd')])+_0xddb8('0xe')]=this[_0xddb8('0xb')]['id'];}_0x520d02[_['upperFirst'](this['channel'])+'InteractionId']=this[_0xddb8('0xf')]['id'];if(rpc[this['channel']+_0xddb8('0x10')]){return rpc[this[_0xddb8('0xd')]+_0xddb8('0x10')][_0xddb8('0x11')](_0x520d02)[_0xddb8('0x12')](function(_0x10cb5d){logger[_0xddb8('0x13')](_0xddb8('0x14'),_0x53bc58,_0x520d02[_0xddb8('0x15')]);_0x42e0f9[_0xddb8('0x16')]();})[_0xddb8('0x17')](function(_0x1d328c){logger['error'](_0xddb8('0x14'),_0x53bc58,JSON[_0xddb8('0x18')](_0x1d328c));_0x42e0f9[_0xddb8('0x19')]();});}}catch(_0x14bf86){logger[_0xddb8('0x1a')](_0xddb8('0x14'),_0x53bc58,JSON['stringify'](_0x14bf86));_0x42e0f9[_0xddb8('0x19')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index fb6f179..3756b0e 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 _0x1d25=['routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d25,0x174));var _0x51d2=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0x1d25[_0x3a8dc1];return _0x4b3595;};'use strict';var utils=require(_0x51d2('0x0'));var logger=require(_0x51d2('0x1'))(_0x51d2('0x2'));exports[_0x51d2('0x3')]=function(_0x8be2ea,_0x359966){return function(_0x25dde2){try{logger[_0x51d2('0x4')](_0x51d2('0x5'),_0x8be2ea,utils[_0x51d2('0x6')](_0x359966[0x0],this));_0x25dde2[_0x51d2('0x7')]();}catch(_0x1b1ee2){logger[_0x51d2('0x8')](_0x51d2('0x5'),_0x8be2ea,JSON[_0x51d2('0x9')](_0x1b1ee2));_0x25dde2[_0x51d2('0xa')]();}};}; \ No newline at end of file +var _0x41db=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','./utils','../../../../config/logger','info'];(function(_0x718f1f,_0x2e2338){var _0x48b289=function(_0x524e31){while(--_0x524e31){_0x718f1f['push'](_0x718f1f['shift']());}};_0x48b289(++_0x2e2338);}(_0x41db,0x13d));var _0xb41d=function(_0x21dff6,_0x443d2b){_0x21dff6=_0x21dff6-0x0;var _0x338ce8=_0x41db[_0x21dff6];return _0x338ce8;};'use strict';var utils=require(_0xb41d('0x0'));var logger=require(_0xb41d('0x1'))('routing');exports['consequence']=function(_0x5a4ff4,_0x4de64d){return function(_0x23bd8f){try{logger[_0xb41d('0x2')](_0xb41d('0x3'),_0x5a4ff4,utils[_0xb41d('0x4')](_0x4de64d[0x0],this));_0x23bd8f[_0xb41d('0x5')]();}catch(_0x16332c){logger[_0xb41d('0x6')]('[%s][NOOP]\x20%s',_0x5a4ff4,JSON[_0xb41d('0x7')](_0x16332c));_0x23bd8f['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index c9ec1ef..aae3fb8 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 _0x9507=['error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','find','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','moment','ioredis','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch'];(function(_0x31469c,_0x1739e4){var _0x334df2=function(_0x1eae39){while(--_0x1eae39){_0x31469c['push'](_0x31469c['shift']());}};_0x334df2(++_0x1739e4);}(_0x9507,0x1a7));var _0x7950=function(_0x476c6f,_0x24a5ec){_0x476c6f=_0x476c6f-0x0;var _0x5d5744=_0x9507[_0x476c6f];return _0x5d5744;};'use strict';var schema=require(_0x7950('0x0'));var _=require(_0x7950('0x1'));var util=require(_0x7950('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x7950('0x3'));var Redis=require(_0x7950('0x4'));var config=require('../../../../config/environment');var logger=require(_0x7950('0x5'))(_0x7950('0x6'));var strategy=require(_0x7950('0x7'));config[_0x7950('0x8')]=_[_0x7950('0x9')](config['redis'],{'host':_0x7950('0xa'),'port':0x18eb});var io=require(_0x7950('0xb'))(new Redis(config[_0x7950('0x8')]));var attributes=['id',_0x7950('0xc'),_0x7950('0xd'),_0x7950('0xe'),_0x7950('0xf'),_0x7950('0x10')];function emit(_0x31608b,_0x235021,_0x564880){io['to'](_0x31608b)[_0x7950('0x11')](_0x235021,_0x564880);}function emitChannelQueueInteraction(_0x5aca12,_0x2201e0,_0x14636a,_0xa20ea9,_0x39b633,_0x533164,_0x324131,_0x1a304c){var _0x5e27f0=_[_0x7950('0x12')](_0x14636a);_0x5e27f0[_0x7950('0xc')]=_0x1a304c;_0x5e27f0[_0x7950('0xe')]=_0x2201e0;_0x5e27f0[_0x7950('0xd')]=_0xa20ea9;_0x5e27f0['id']=_0x39b633;if(_0x533164){_0x324131[util[_0x7950('0x13')](_0x7950('0x14'),_0x5aca12)][_0x39b633]=_[_0x7950('0x15')](_0x5e27f0,attributes);}else{delete _0x324131[util[_0x7950('0x13')](_0x7950('0x14'),_0x5aca12)][_0x39b633];}emit(util['format'](_0x7950('0x16'),_0x5aca12,_0x2201e0),util['format'](_0x7950('0x17'),_0x5aca12,_0x533164?_0x7950('0x18'):_0x7950('0x19')),_[_0x7950('0x15')](_0x5e27f0,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7950('0x1a')),'chatQueueReport':require(_0x7950('0x1b')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x7950('0x1c')),'whatsappQueueReport':require(_0x7950('0x1d'))};var queue=schema({'name':{'type':_0x7950('0x1e'),'required':!![],'message':_0x7950('0x1f')},'timeout':{'type':_0x7950('0x20'),'message':_0x7950('0x21')}});function startRouting(_0x4cbd0b,_0x361a6c,_0xfcfc33,_0x25a2a8){if(_0x4cbd0b&&_0x361a6c&&_0xfcfc33){_0x361a6c[_0x7950('0x22')]+=0x1;var _0x1d5b86={'uniqueid':_0x4cbd0b,'from':_0xfcfc33[_0x7950('0x23')]?_0xfcfc33['body']['from']:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xfcfc33[_0x7950('0x24')]?_0xfcfc33[_0x7950('0x24')]['id']:null,'ListId':_0xfcfc33[_0x7950('0x25')]?_0xfcfc33[_0x7950('0x25')]['id']:null};_0x1d5b86[_[_0x7950('0x26')](_0xfcfc33['channel'])+'QueueId']=_0x361a6c['id']||null;_0x1d5b86[_[_0x7950('0x26')](_0xfcfc33[_0x7950('0x27')])+_0x7950('0x28')]=_0xfcfc33[_0x7950('0x29')]?_0xfcfc33[_0x7950('0x29')]['id']:null;_0x1d5b86[_[_0x7950('0x26')](_0xfcfc33['channel'])+_0x7950('0x2a')]=_0xfcfc33[_0x7950('0x2b')]?_0xfcfc33[_0x7950('0x2b')]['id']:null;_0x1d5b86[_[_0x7950('0x26')](_0xfcfc33[_0x7950('0x27')])+(_0xfcfc33[_0x7950('0x27')]!==_0x7950('0x2c')?'AccountId':_0x7950('0x2d'))]=_0xfcfc33[_0x7950('0xd')]?_0xfcfc33[_0x7950('0xd')]['id']:null;logger[_0x7950('0x2e')](util['format'](_0x7950('0x2f'),_0x4cbd0b,_0x361a6c['name']));emitChannelQueueInteraction(_0xfcfc33['channel'],_0x361a6c[_0x7950('0x30')],_0x1d5b86,_0xfcfc33[_0x7950('0xd')]['name'],_0xfcfc33['message']['id'],!![],_0x25a2a8,_0x361a6c['id']);if(rpc[_0xfcfc33['channel']+'QueueReport']){return rpc[_0xfcfc33[_0x7950('0x27')]+'QueueReport'][_0x7950('0x31')](_0x1d5b86)[_0x7950('0x32')](function(_0x2f6edf){logger[_0x7950('0x33')](_0x7950('0x34'));});}}}function stopRouting(_0x521f3d,_0x3eef8e,_0x46e0bf,_0x356200){if(_0x521f3d&&_0x3eef8e){_0x3eef8e[_0x7950('0x22')]-=0x1;var _0x5b6f44={'leaveAt':moment()[_0x7950('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x7950('0x13')](_0x7950('0x35')),'reason':_0x7950('0x36')};logger[_0x7950('0x2e')](util[_0x7950('0x13')](_0x7950('0x37'),_0x521f3d,_0x3eef8e[_0x7950('0x30')]));emitChannelQueueInteraction(_0x46e0bf[_0x7950('0x27')],_0x3eef8e[_0x7950('0x30')],_0x46e0bf[_0x7950('0x23')],_0x46e0bf[_0x7950('0xd')][_0x7950('0x30')],_0x46e0bf['message']['id'],![],_0x356200,_0x3eef8e['id']);if(rpc[_0x46e0bf['channel']+_0x7950('0x38')]){return rpc[_0x46e0bf[_0x7950('0x27')]+_0x7950('0x38')][_0x7950('0x39')](_0x521f3d,_0x5b6f44)[_0x7950('0x32')](function(_0x2cd750){logger[_0x7950('0x33')](_0x7950('0x3a'));});}}}function endRouting(_0x40665b,_0x4d7dda,_0x5d1f71,_0x1b305b){if(_0x40665b&&_0x4d7dda){_0x4d7dda['waiting']-=0x1;var _0x22b36d={'leaveAt':moment()[_0x7950('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x7950('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x7950('0x3b')};logger[_0x7950('0x2e')](util[_0x7950('0x13')](_0x7950('0x3c'),_0x40665b,_0x4d7dda[_0x7950('0x30')]));emitChannelQueueInteraction(_0x5d1f71['channel'],_0x4d7dda[_0x7950('0x30')],_0x5d1f71[_0x7950('0x23')],_0x5d1f71['account'][_0x7950('0x30')],_0x5d1f71[_0x7950('0x2b')]['id'],![],_0x1b305b);if(rpc[_0x5d1f71[_0x7950('0x27')]+_0x7950('0x38')]){return rpc[_0x5d1f71[_0x7950('0x27')]+_0x7950('0x38')][_0x7950('0x39')](_0x40665b,_0x22b36d)[_0x7950('0x32')](function(_0x4cdf5d){logger['error']('update\x20queue\x20report');});}}}function handleFindQueue(_0x464309){return function(_0x3f1280){return _0x3f1280['name'][_0x7950('0x3d')]()===_0x464309[_0x7950('0x3d')]();};}exports[_0x7950('0x3e')]=function(_0x56a202,_0x29917d,_0x4fc80a,_0x5578f2){return function(_0x517479){try{var _0x169b42={'name':_0x29917d[0x0],'timeout':_0x29917d[0x1]};var _0x534bd5=queue[_0x7950('0x0')](_0x169b42,{'typecast':!![]});if(_0x534bd5[_0x7950('0x3f')]){logger[_0x7950('0x33')](_0x7950('0x40'),_0x56a202,_['map'](_0x534bd5,'message')[_0x7950('0x41')](',\x20'));_0x517479[_0x7950('0x42')]();}else{var _0x28d24e=_[_0x7950('0x43')](_0x4fc80a[_0x5578f2[_0x7950('0x27')]+'Queues'],handleFindQueue(_0x169b42[_0x7950('0x30')]));if(_0x28d24e){startRouting(_0x56a202,_0x28d24e,_0x5578f2,_0x4fc80a);var _0x2a35c7=(_0x28d24e[_0x7950('0x3b')]||0xa)*0x3e8;var _0x223e97=(_0x169b42[_0x7950('0x3b')]||0x14)*0x3e8;var _0x378cc7,_0x30bb2d;if(_0x2a35c7>_0x223e97){_0x223e97=_0x2a35c7;}var _0x676f72=seqqueue['createQueue'](_0x2a35c7);_0x676f72['id']=_0x56a202;_0x676f72[_0x7950('0x44')]=_0x2a35c7;_0x676f72['qtimeout']=_0x223e97;_0x676f72[_0x7950('0x27')]=_0x5578f2[_0x7950('0x27')];_0x4fc80a[_0x7950('0x45')][_0x56a202]['on'](_0x7950('0x46'),function(){logger[_0x7950('0x2e')](_0x7950('0x47'),_0x56a202);stopRouting(_0x56a202,_0x28d24e,_0x5578f2,_0x4fc80a);clearTimeout(_0x378cc7);_0x378cc7=undefined;_0x676f72[_0x7950('0x48')](!![]);if(_0x4fc80a[_0x7950('0x45')][_0x56a202]){delete _0x4fc80a[_0x7950('0x45')][_0x56a202];}_0x517479['stop']();});_0x4fc80a[_0x7950('0x45')][_0x56a202]['on']('complete',function(){if(_0x4fc80a['rules'][_0x56a202]){delete _0x4fc80a[_0x7950('0x45')][_0x56a202];}});_0x378cc7=setTimeout(function(){logger[_0x7950('0x2e')](_0x7950('0x49'),_0x56a202);endRouting(_0x56a202,_0x28d24e,_0x5578f2,_0x4fc80a);clearTimeout(_0x378cc7);_0x676f72[_0x7950('0x48')](!![]);_0x517479['next']();},_0x223e97);switch(_0x28d24e['strategy']){case _0x7950('0x4a'):strategy[_0x7950('0x4a')](_0x676f72,_0x28d24e,_0x4fc80a,_0x5578f2);break;default:strategy[_0x7950('0x4b')](_0x676f72,_0x28d24e,_0x4fc80a,_0x5578f2);}}else{logger[_0x7950('0x33')](_0x7950('0x4c'),_0x56a202,_0x169b42[_0x7950('0x30')]);_0x517479[_0x7950('0x42')]();}}}catch(_0x36fd5d){console[_0x7950('0x4d')](_0x36fd5d);logger[_0x7950('0x33')](_0x7950('0x40'),_0x56a202,_0x36fd5d[_0x7950('0x4e')]);_0x517479['stop']();}};}; \ No newline at end of file +var _0x923c=['info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','accepted','update','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','Queues','atimeout','qtimeout','rules','end','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','ioredis','../../../../config/environment','routing','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','account','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','WebsiteId'];(function(_0x5480fd,_0x46600d){var _0x2ec312=function(_0x32797c){while(--_0x32797c){_0x5480fd['push'](_0x5480fd['shift']());}};_0x2ec312(++_0x46600d);}(_0x923c,0x157));var _0xc923=function(_0x4585ca,_0x3a8e79){_0x4585ca=_0x4585ca-0x0;var _0x254f99=_0x923c[_0x4585ca];return _0x254f99;};'use strict';var schema=require(_0xc923('0x0'));var _=require(_0xc923('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0xc923('0x2'));var config=require(_0xc923('0x3'));var logger=require('../../../../config/logger')(_0xc923('0x4'));var strategy=require('./strategy');config[_0xc923('0x5')]=_['defaults'](config[_0xc923('0x5')],{'host':_0xc923('0x6'),'port':0x18eb});var io=require(_0xc923('0x7'))(new Redis(config['redis']));var attributes=['id',_0xc923('0x8'),'account',_0xc923('0x9'),_0xc923('0xa'),_0xc923('0xb')];function emit(_0x4bbd6c,_0x53c703,_0x2d5b2d){io['to'](_0x4bbd6c)[_0xc923('0xc')](_0x53c703,_0x2d5b2d);}function emitChannelQueueInteraction(_0x1697ee,_0x50b800,_0x1e87b8,_0x4a447,_0x1cd366,_0x54d021,_0x191c32,_0x6e93){var _0x3e286f=_[_0xc923('0xd')](_0x1e87b8);_0x3e286f[_0xc923('0x8')]=_0x6e93;_0x3e286f[_0xc923('0x9')]=_0x50b800;_0x3e286f[_0xc923('0xe')]=_0x4a447;_0x3e286f['id']=_0x1cd366;if(_0x54d021){_0x191c32[util[_0xc923('0xf')](_0xc923('0x10'),_0x1697ee)][_0x1cd366]=_[_0xc923('0x11')](_0x3e286f,attributes);}else{delete _0x191c32[util[_0xc923('0xf')](_0xc923('0x10'),_0x1697ee)][_0x1cd366];}emit(util['format']('%s:queue:%s',_0x1697ee,_0x50b800),util[_0xc923('0xf')](_0xc923('0x12'),_0x1697ee,_0x54d021?_0xc923('0x13'):'remove'),_[_0xc923('0x11')](_0x3e286f,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xc923('0x14')),'chatQueueReport':require(_0xc923('0x15')),'smsQueueReport':require(_0xc923('0x16')),'faxQueueReport':require(_0xc923('0x17')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xc923('0x18'),'required':!![],'message':_0xc923('0x19')},'timeout':{'type':_0xc923('0x1a'),'message':_0xc923('0x1b')}});function startRouting(_0x45b2c7,_0x4de949,_0x7d98dc,_0x588570){if(_0x45b2c7&&_0x4de949&&_0x7d98dc){_0x4de949[_0xc923('0x1c')]+=0x1;var _0x1ffb3b={'uniqueid':_0x45b2c7,'from':_0x7d98dc[_0xc923('0x1d')]?_0x7d98dc[_0xc923('0x1d')][_0xc923('0xa')]:'','joinAt':moment()[_0xc923('0xf')](_0xc923('0x1e')),'ContactId':_0x7d98dc[_0xc923('0x1f')]?_0x7d98dc[_0xc923('0x1f')]['id']:null,'ListId':_0x7d98dc[_0xc923('0x20')]?_0x7d98dc[_0xc923('0x20')]['id']:null};_0x1ffb3b[_[_0xc923('0x21')](_0x7d98dc[_0xc923('0x22')])+_0xc923('0x23')]=_0x4de949['id']||null;_0x1ffb3b[_['upperFirst'](_0x7d98dc['channel'])+'InteractionId']=_0x7d98dc[_0xc923('0x24')]?_0x7d98dc['interaction']['id']:null;_0x1ffb3b[_[_0xc923('0x21')](_0x7d98dc['channel'])+_0xc923('0x25')]=_0x7d98dc[_0xc923('0x26')]?_0x7d98dc[_0xc923('0x26')]['id']:null;_0x1ffb3b[_['upperFirst'](_0x7d98dc['channel'])+(_0x7d98dc['channel']!==_0xc923('0x27')?_0xc923('0x28'):_0xc923('0x29'))]=_0x7d98dc[_0xc923('0xe')]?_0x7d98dc[_0xc923('0xe')]['id']:null;logger[_0xc923('0x2a')](util[_0xc923('0xf')](_0xc923('0x2b'),_0x45b2c7,_0x4de949[_0xc923('0x2c')]));emitChannelQueueInteraction(_0x7d98dc['channel'],_0x4de949[_0xc923('0x2c')],_0x1ffb3b,_0x7d98dc[_0xc923('0xe')]['name'],_0x7d98dc[_0xc923('0x26')]['id'],!![],_0x588570,_0x4de949['id']);if(rpc[_0x7d98dc[_0xc923('0x22')]+_0xc923('0x2d')]){return rpc[_0x7d98dc[_0xc923('0x22')]+'QueueReport'][_0xc923('0x2e')](_0x1ffb3b)[_0xc923('0x2f')](function(_0x12bb28){logger['error'](_0xc923('0x30'));});}}}function stopRouting(_0x1e920f,_0x4c122f,_0x50a0f5,_0x20907f){if(_0x1e920f&&_0x4c122f){_0x4c122f[_0xc923('0x1c')]-=0x1;var _0x5806c3={'leaveAt':moment()[_0xc923('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xc923('0xf')](_0xc923('0x1e')),'reason':_0xc923('0x31')};logger[_0xc923('0x2a')](util[_0xc923('0xf')]('[%s][STOP:QUEUE][NAME:%s]',_0x1e920f,_0x4c122f[_0xc923('0x2c')]));emitChannelQueueInteraction(_0x50a0f5[_0xc923('0x22')],_0x4c122f['name'],_0x50a0f5[_0xc923('0x1d')],_0x50a0f5['account'][_0xc923('0x2c')],_0x50a0f5['message']['id'],![],_0x20907f,_0x4c122f['id']);if(rpc[_0x50a0f5[_0xc923('0x22')]+_0xc923('0x2d')]){return rpc[_0x50a0f5[_0xc923('0x22')]+'QueueReport'][_0xc923('0x32')](_0x1e920f,_0x5806c3)[_0xc923('0x2f')](function(_0x179dbb){logger[_0xc923('0x33')](_0xc923('0x34'));});}}}function endRouting(_0x2ff617,_0x4b00fc,_0x5d1cb8,_0x3c5909){if(_0x2ff617&&_0x4b00fc){_0x4b00fc[_0xc923('0x1c')]-=0x1;var _0x4af6f6={'leaveAt':moment()['format'](_0xc923('0x1e')),'exitAt':moment()[_0xc923('0xf')](_0xc923('0x1e')),'reason':_0xc923('0x35')};logger[_0xc923('0x2a')](util['format'](_0xc923('0x36'),_0x2ff617,_0x4b00fc['name']));emitChannelQueueInteraction(_0x5d1cb8[_0xc923('0x22')],_0x4b00fc[_0xc923('0x2c')],_0x5d1cb8[_0xc923('0x1d')],_0x5d1cb8[_0xc923('0xe')][_0xc923('0x2c')],_0x5d1cb8[_0xc923('0x26')]['id'],![],_0x3c5909);if(rpc[_0x5d1cb8[_0xc923('0x22')]+_0xc923('0x2d')]){return rpc[_0x5d1cb8[_0xc923('0x22')]+_0xc923('0x2d')][_0xc923('0x32')](_0x2ff617,_0x4af6f6)[_0xc923('0x2f')](function(_0x59f985){logger[_0xc923('0x33')](_0xc923('0x34'));});}}}function handleFindQueue(_0x1a2c3d){return function(_0x5d2114){return _0x5d2114['name'][_0xc923('0x37')]()===_0x1a2c3d[_0xc923('0x37')]();};}exports[_0xc923('0x38')]=function(_0x308272,_0x327252,_0x7b0eb1,_0x25fbf5){return function(_0x41a848){try{var _0x55b1d7={'name':_0x327252[0x0],'timeout':_0x327252[0x1]};var _0x50aa87=queue[_0xc923('0x0')](_0x55b1d7,{'typecast':!![]});if(_0x50aa87[_0xc923('0x39')]){logger[_0xc923('0x33')](_0xc923('0x3a'),_0x308272,_[_0xc923('0x3b')](_0x50aa87,_0xc923('0x26'))[_0xc923('0x3c')](',\x20'));_0x41a848['stop']();}else{var _0x4a8763=_[_0xc923('0x3d')](_0x7b0eb1[_0x25fbf5[_0xc923('0x22')]+_0xc923('0x3e')],handleFindQueue(_0x55b1d7[_0xc923('0x2c')]));if(_0x4a8763){startRouting(_0x308272,_0x4a8763,_0x25fbf5,_0x7b0eb1);var _0xdd0f36=(_0x4a8763[_0xc923('0x35')]||0xa)*0x3e8;var _0x21723e=(_0x55b1d7['timeout']||0x14)*0x3e8;var _0x55ddf8,_0xa8913f;if(_0xdd0f36>_0x21723e){_0x21723e=_0xdd0f36;}var _0x25866b=seqqueue['createQueue'](_0xdd0f36);_0x25866b['id']=_0x308272;_0x25866b[_0xc923('0x3f')]=_0xdd0f36;_0x25866b[_0xc923('0x40')]=_0x21723e;_0x25866b[_0xc923('0x22')]=_0x25fbf5[_0xc923('0x22')];_0x7b0eb1[_0xc923('0x41')][_0x308272]['on'](_0xc923('0x42'),function(){logger[_0xc923('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x308272);stopRouting(_0x308272,_0x4a8763,_0x25fbf5,_0x7b0eb1);clearTimeout(_0x55ddf8);_0x55ddf8=undefined;_0x25866b[_0xc923('0x43')](!![]);if(_0x7b0eb1[_0xc923('0x41')][_0x308272]){delete _0x7b0eb1['rules'][_0x308272];}_0x41a848[_0xc923('0x44')]();});_0x7b0eb1[_0xc923('0x41')][_0x308272]['on'](_0xc923('0x45'),function(){if(_0x7b0eb1[_0xc923('0x41')][_0x308272]){delete _0x7b0eb1['rules'][_0x308272];}});_0x55ddf8=setTimeout(function(){logger[_0xc923('0x2a')](_0xc923('0x46'),_0x308272);endRouting(_0x308272,_0x4a8763,_0x25fbf5,_0x7b0eb1);clearTimeout(_0x55ddf8);_0x25866b[_0xc923('0x43')](!![]);_0x41a848[_0xc923('0x47')]();},_0x21723e);switch(_0x4a8763[_0xc923('0x48')]){case'rrmemory':strategy['rrmemory'](_0x25866b,_0x4a8763,_0x7b0eb1,_0x25fbf5);break;default:strategy[_0xc923('0x49')](_0x25866b,_0x4a8763,_0x7b0eb1,_0x25fbf5);}}else{logger['error'](_0xc923('0x4a'),_0x308272,_0x55b1d7['name']);_0x41a848[_0xc923('0x44')]();}}}catch(_0x2fc157){console[_0xc923('0x4b')](_0x2fc157);logger[_0xc923('0x33')](_0xc923('0x3a'),_0x308272,_0x2fc157[_0xc923('0x4c')]);_0x41a848[_0xc923('0x44')]();}};}; \ 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 9a8c8fe..b60c58a 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 _0xfda8=['forcedOwnership','isAgentAvailable','channel','busy','busyQueue','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','writeLog','STOP','TIMEOUT','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x1414b3,_0x477031){var _0x5761ab=function(_0x4017cd){while(--_0x4017cd){_0x1414b3['push'](_0x1414b3['shift']());}};_0x5761ab(++_0x477031);}(_0xfda8,0x82));var _0x8fda=function(_0x245a49,_0x3c025e){_0x245a49=_0x245a49-0x0;var _0x1a4ccd=_0xfda8[_0x245a49];return _0x1a4ccd;};'use strict';var _=require('lodash');var uuid=require(_0x8fda('0x0'));var util=require(_0x8fda('0x1'));var logger=require(_0x8fda('0x2'))(_0x8fda('0x3'));var Agent=function(_0x5b67d2,_0xee00e,_0x17afde,_0x4e49ab){this[_0x8fda('0x4')]=uuid['v4']();this[_0x8fda('0x5')]=_0x5b67d2;this[_0x8fda('0x6')]=_0xee00e;this[_0x8fda('0x7')]=_0x17afde;this['routing']=_0x4e49ab;this[_0x8fda('0x5')][_0x8fda('0x8')](this[_0x8fda('0x9')][_0x8fda('0xa')](this),this[_0x8fda('0xb')][_0x8fda('0xa')](this));this[_0x8fda('0x5')]['on'](_0x8fda('0xc'),this[_0x8fda('0xb')][_0x8fda('0xa')](this));this[_0x8fda('0x5')]['on'](_0x8fda('0xd'),this[_0x8fda('0xe')][_0x8fda('0xa')](this));};Agent[_0x8fda('0xf')][_0x8fda('0x8')]=function(){this[_0x8fda('0x5')][_0x8fda('0x8')](this[_0x8fda('0x9')][_0x8fda('0xa')](this),this[_0x8fda('0xb')][_0x8fda('0xa')](this));};Agent[_0x8fda('0xf')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent['prototype']['handleRun']=function(_0x1f07c8){logger[_0x8fda('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x8fda('0x5')]['id'],this[_0x8fda('0x6')]['id']);if(_[_0x8fda('0x11')](this[_0x8fda('0x7')][_0x8fda('0x12')][this[_0x8fda('0x6')]['id']])){logger[_0x8fda('0x10')](_0x8fda('0x13'),this[_0x8fda('0x5')]['id'],this[_0x8fda('0x6')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this['routing'][_0x8fda('0x14')]||util[_0x8fda('0x15')](this[_0x8fda('0x5')]['id'],this[_0x8fda('0x7')][_0x8fda('0x12')][this[_0x8fda('0x6')]['id']],this[_0x8fda('0x5')][_0x8fda('0x16')],![])){this['realtime'][_0x8fda('0x12')][this[_0x8fda('0x6')]['id']][_0x8fda('0x17')]=!![];this['realtime'][_0x8fda('0x12')][this[_0x8fda('0x6')]['id']][_0x8fda('0x18')]=undefined;util['showNotification'](this[_0x8fda('0x4')],this[_0x8fda('0x5')]['id'],this[_0x8fda('0x7')][_0x8fda('0x12')][this[_0x8fda('0x6')]['id']],null,this[_0x8fda('0x3')]);util['writeLog'](this[_0x8fda('0x5')]['id'],this['realtime'][_0x8fda('0x12')][this[_0x8fda('0x6')]['id']],'RINGING'+(this['routing'][_0x8fda('0x14')]?':FORCED':''));}else{logger['info'](_0x8fda('0x19'),this[_0x8fda('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x8fda('0x8')][_0x8fda('0xa')](this),0x3e8);}}};Agent['prototype'][_0x8fda('0xb')]=function(_0x5f1afa){if(_[_0x8fda('0x11')](this[_0x8fda('0x7')][_0x8fda('0x12')][this[_0x8fda('0x6')]['id']])){return logger[_0x8fda('0x10')](_0x8fda('0x13'),this[_0x8fda('0x5')]['id'],this[_0x8fda('0x6')]['id']);}else{logger['info'](_0x8fda('0x1a'),this[_0x8fda('0x5')]['id'],this['agent']['id']);util['hideNotification'](this[_0x8fda('0x4')],this[_0x8fda('0x5')]['id'],this[_0x8fda('0x7')]['agents'][this[_0x8fda('0x6')]['id']],null,this[_0x8fda('0x3')]);this[_0x8fda('0x7')][_0x8fda('0x12')][this['agent']['id']][_0x8fda('0x17')]=![];this[_0x8fda('0x7')]['agents'][this[_0x8fda('0x6')]['id']][_0x8fda('0x18')]=undefined;util[_0x8fda('0x1b')](this[_0x8fda('0x5')]['id'],this[_0x8fda('0x7')]['agents'][this[_0x8fda('0x6')]['id']],_0x5f1afa?_0x8fda('0x1c'):_0x8fda('0x1d'));}if(!_0x5f1afa){setTimeout(this[_0x8fda('0x8')][_0x8fda('0xa')](this),0x3e8);}};function agent(_0x2d6275,_0x33666d,_0x178450,_0x18cbfe){return new Agent(_0x2d6275,_0x33666d,_0x178450,_0x18cbfe);}module['exports']=agent; \ No newline at end of file +var _0x5efb=['prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','handleTimeout','bind','drained','handleDrained'];(function(_0x3ad2e5,_0x94d414){var _0xc4e565=function(_0x2c96e3){while(--_0x2c96e3){_0x3ad2e5['push'](_0x3ad2e5['shift']());}};_0xc4e565(++_0x94d414);}(_0x5efb,0xd9));var _0xb5ef=function(_0x170a07,_0x4917dc){_0x170a07=_0x170a07-0x0;var _0x4525f7=_0x5efb[_0x170a07];return _0x4525f7;};'use strict';var _=require(_0xb5ef('0x0'));var uuid=require(_0xb5ef('0x1'));var util=require('./util');var logger=require(_0xb5ef('0x2'))(_0xb5ef('0x3'));var Agent=function(_0x4b78b8,_0x2cb873,_0x39d43b,_0x3956d1){this[_0xb5ef('0x4')]=uuid['v4']();this[_0xb5ef('0x5')]=_0x4b78b8;this[_0xb5ef('0x6')]=_0x2cb873;this[_0xb5ef('0x7')]=_0x39d43b;this['routing']=_0x3956d1;this[_0xb5ef('0x5')][_0xb5ef('0x8')](this[_0xb5ef('0x9')]['bind'](this),this[_0xb5ef('0xa')][_0xb5ef('0xb')](this));this[_0xb5ef('0x5')]['on']('timeout',this['handleTimeout'][_0xb5ef('0xb')](this));this[_0xb5ef('0x5')]['on'](_0xb5ef('0xc'),this[_0xb5ef('0xd')][_0xb5ef('0xb')](this));};Agent[_0xb5ef('0xe')][_0xb5ef('0x8')]=function(){this['squeue'][_0xb5ef('0x8')](this[_0xb5ef('0x9')][_0xb5ef('0xb')](this),this['handleTimeout'][_0xb5ef('0xb')](this));};Agent[_0xb5ef('0xe')][_0xb5ef('0xd')]=function(){this[_0xb5ef('0xa')](!![]);};Agent[_0xb5ef('0xe')][_0xb5ef('0x9')]=function(_0x17d01a){logger[_0xb5ef('0xf')](_0xb5ef('0x10'),this[_0xb5ef('0x5')]['id'],this[_0xb5ef('0x6')]['id']);if(_['isNil'](this[_0xb5ef('0x7')][_0xb5ef('0x11')][this['agent']['id']])){logger[_0xb5ef('0xf')](_0xb5ef('0x12'),this[_0xb5ef('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xb5ef('0x8')][_0xb5ef('0xb')](this),0x3e8);}else{if(this[_0xb5ef('0x3')][_0xb5ef('0x13')]||util[_0xb5ef('0x14')](this[_0xb5ef('0x5')]['id'],this[_0xb5ef('0x7')][_0xb5ef('0x11')][this[_0xb5ef('0x6')]['id']],this[_0xb5ef('0x5')][_0xb5ef('0x15')],![])){this[_0xb5ef('0x7')][_0xb5ef('0x11')][this[_0xb5ef('0x6')]['id']][_0xb5ef('0x16')]=!![];this[_0xb5ef('0x7')][_0xb5ef('0x11')][this[_0xb5ef('0x6')]['id']][_0xb5ef('0x17')]=undefined;util[_0xb5ef('0x18')](this['notificationId'],this[_0xb5ef('0x5')]['id'],this[_0xb5ef('0x7')][_0xb5ef('0x11')][this['agent']['id']],null,this[_0xb5ef('0x3')]);util[_0xb5ef('0x19')](this['squeue']['id'],this[_0xb5ef('0x7')][_0xb5ef('0x11')][this[_0xb5ef('0x6')]['id']],_0xb5ef('0x1a')+(this[_0xb5ef('0x3')][_0xb5ef('0x13')]?_0xb5ef('0x1b'):''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xb5ef('0x5')]['id'],this[_0xb5ef('0x6')]['id']);setTimeout(this[_0xb5ef('0x8')][_0xb5ef('0xb')](this),0x3e8);}}};Agent[_0xb5ef('0xe')][_0xb5ef('0xa')]=function(_0x1f6209){if(_[_0xb5ef('0x1c')](this[_0xb5ef('0x7')][_0xb5ef('0x11')][this[_0xb5ef('0x6')]['id']])){return logger[_0xb5ef('0xf')](_0xb5ef('0x12'),this['squeue']['id'],this['agent']['id']);}else{logger['info'](_0xb5ef('0x1d'),this['squeue']['id'],this[_0xb5ef('0x6')]['id']);util[_0xb5ef('0x1e')](this[_0xb5ef('0x4')],this[_0xb5ef('0x5')]['id'],this[_0xb5ef('0x7')]['agents'][this[_0xb5ef('0x6')]['id']],null,this[_0xb5ef('0x3')]);this[_0xb5ef('0x7')][_0xb5ef('0x11')][this[_0xb5ef('0x6')]['id']][_0xb5ef('0x16')]=![];this[_0xb5ef('0x7')][_0xb5ef('0x11')][this[_0xb5ef('0x6')]['id']]['busyQueue']=undefined;util[_0xb5ef('0x19')](this['squeue']['id'],this['realtime'][_0xb5ef('0x11')][this[_0xb5ef('0x6')]['id']],_0x1f6209?_0xb5ef('0x1f'):_0xb5ef('0x20'));}if(!_0x1f6209){setTimeout(this[_0xb5ef('0x8')][_0xb5ef('0xb')](this),0x3e8);}};function agent(_0x2aef19,_0x4aa0ac,_0x4d6eeb,_0x43b06c){return new Agent(_0x2aef19,_0x4aa0ac,_0x4d6eeb,_0x43b06c);}module['exports']=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 e8e68d1..64ac493 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 _0x4989=['[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','writeLog','TIMEOUT','lodash','../../../../../config/logger','routing','notificationId','queue','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','isNil','Agents','length','agents','info','RINGING','busy','busyQueue','name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY'];(function(_0x45a85e,_0x292dd7){var _0x4c85b7=function(_0x10059f){while(--_0x10059f){_0x45a85e['push'](_0x45a85e['shift']());}};_0x4c85b7(++_0x292dd7);}(_0x4989,0x79));var _0x9498=function(_0x86c6cb,_0x30bb53){_0x86c6cb=_0x86c6cb-0x0;var _0x1b1592=_0x4989[_0x86c6cb];return _0x1b1592;};'use strict';var _=require(_0x9498('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0x9498('0x1'))(_0x9498('0x2'));var Beepall=function(_0x409e1c,_0x2dca11,_0x5953c0,_0x55fabb){this[_0x9498('0x3')]=uuid['v4']();this['squeue']=_0x409e1c;this[_0x9498('0x4')]=_0x2dca11;this[_0x9498('0x5')]=_0x5953c0;this['routing']=_0x55fabb;this[_0x9498('0x6')][_0x9498('0x7')](this[_0x9498('0x8')][_0x9498('0x9')](this),this[_0x9498('0xa')][_0x9498('0x9')](this));this[_0x9498('0x6')]['on'](_0x9498('0xb'),this[_0x9498('0xa')][_0x9498('0x9')](this));this[_0x9498('0x6')]['on']('drained',this[_0x9498('0xc')][_0x9498('0x9')](this));};Beepall[_0x9498('0xd')]['push']=function(){this[_0x9498('0x6')][_0x9498('0x7')](this['handleRun']['bind'](this),this['handleTimeout'][_0x9498('0x9')](this));};Beepall[_0x9498('0xd')][_0x9498('0xc')]=function(_0xf84308){this[_0x9498('0xa')](!![]);};Beepall[_0x9498('0xd')]['handleRun']=function(_0x3c2b7a){var _0x285b90=!![];if(!_[_0x9498('0xe')](this[_0x9498('0x4')])&&!_[_0x9498('0xe')](this[_0x9498('0x4')][_0x9498('0xf')])&&this[_0x9498('0x4')][_0x9498('0xf')][_0x9498('0x10')]>0x0){for(var _0x2cfa99=0x0,_0x1685a8;_0x2cfa990x0){for(var _0x489343=0x0,_0x460ac3;_0x4893430x0&&_0x59af4b[_0x11290c+_0x6a45('0x24')]>=_0x59af4b[_0x11290c+_0x6a45('0x23')]){writeLog(_0x3faae5,_0x59af4b,_0x11290c[_0x6a45('0x25')]()+_0x6a45('0x26'));return![];}}return!![];};exports[_0x6a45('0x27')]=function(_0x526062,_0x2b8cc8,_0x308003,_0x4770cc,_0x1ccff0){return sendNotification(!![],_0x526062,_0x2b8cc8,_0x308003,_0x4770cc,_0x1ccff0);};exports[_0x6a45('0x28')]=function(_0x227b6f,_0x3fac9b,_0x313c13,_0x54286d,_0x14adb5){return sendNotification(![],_0x227b6f,_0x3fac9b,_0x313c13,_0x54286d,_0x14adb5);};exports[_0x6a45('0x29')]=writeLog; \ No newline at end of file +var _0xe3da=['writeLog','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','error','save','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification'];(function(_0xaa88bc,_0x5bcbf2){var _0x4fa2ec=function(_0x452f6b){while(--_0x452f6b){_0xaa88bc['push'](_0xaa88bc['shift']());}};_0x4fa2ec(++_0x5bcbf2);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var utils=require(_0xae3d('0x2'));var Mustache=require(_0xae3d('0x3'));var Redis=require(_0xae3d('0x4'));var config=require(_0xae3d('0x5'));var logger=require(_0xae3d('0x6'))(_0xae3d('0x7'));config[_0xae3d('0x8')]=_[_0xae3d('0x9')](config[_0xae3d('0x8')],{'host':_0xae3d('0xa'),'port':0x18eb});var io=require(_0xae3d('0xb'))(new Redis(config[_0xae3d('0x8')]));function emit(_0x476579,_0x33c089,_0x583b98){io['to'](_0x476579)[_0xae3d('0xc')](_0x33c089,_0x583b98);}function sendNotification(_0x3d6650,_0x5544fa,_0x577070,_0x459592,_0x157a3e,_0x420e28){io['to'](util[_0xae3d('0xd')](_0xae3d('0xe'),_0x459592[_0xae3d('0xf')]))['emit'](_0xae3d('0x10'),_0x459592);var _0x49fe58=_0x420e28||{};var _0xc7bd1c=_0x577070[_0xae3d('0x11')]('.');var _0x7770eb={'uniqueid':_0x5544fa,'channel':_0xc7bd1c[0x0],'id':_0xc7bd1c[0x1],'title':_0xc7bd1c[0x0]+_0xae3d('0x12'),'interactionId':_0xc7bd1c[0x2],'queue':_0x157a3e?_0x157a3e['name']:null,'sound':_0x49fe58[_0xae3d('0x13')][_0xae3d('0x14')],'shake':_0x49fe58[_0xae3d('0x13')][_0xae3d('0x15')]};try{if(!_0x49fe58[_0xae3d('0x16')]){_0x49fe58[_0xae3d('0x16')]={};}if(_0x157a3e){_0x49fe58[_0xae3d('0x16')]['queue']=_0x157a3e;}else if(_0x49fe58[_0xae3d('0x16')][_0xae3d('0x17')]){delete _0x49fe58[_0xae3d('0x16')][_0xae3d('0x17')];}_0x7770eb[_0xae3d('0x18')]=utils[_0xae3d('0x19')](_0x49fe58['account'][_0xae3d('0x1a')],_0x49fe58);}catch(_0x33449a){_0x7770eb[_0xae3d('0x18')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xae3d('0x1b')](util[_0xae3d('0xd')]('[%s][QUEUE]\x20%s',_0x5544fa,_0x33449a['message']));}io['to'](util[_0xae3d('0xd')](_0xae3d('0xe'),_0x459592[_0xae3d('0xf')]))[_0xae3d('0xc')](util[_0xae3d('0xd')]('notification:%s',_0x3d6650?_0xae3d('0x1c'):'remove'),_0x7770eb);}function writeLog(_0x4a09c2,_0x2d138f,_0x1415e8){return logger[_0xae3d('0x1d')](util[_0xae3d('0xd')](_0xae3d('0x1e'),_0x4a09c2,_0x2d138f[_0xae3d('0xf')],_0x1415e8));}exports[_0xae3d('0x1f')]=function(_0x3224ff,_0x11ecf7,_0x300be8,_0x9bf34a){if(_0x11ecf7[_0xae3d('0x20')]){writeLog(_0x3224ff,_0x11ecf7,_0xae3d('0x21'));return![];}if(!_0x11ecf7[_0xae3d('0x22')]){writeLog(_0x3224ff,_0x11ecf7,_0xae3d('0x23'));return![];}if(_0x11ecf7[_0x300be8+_0xae3d('0x24')]){writeLog(_0x3224ff,_0x11ecf7,_0xae3d('0x25'));return![];}if(_0x9bf34a&&_0x11ecf7[_0xae3d('0x26')](_0x300be8+_0xae3d('0x27'))&&_0x11ecf7['hasOwnProperty'](_0x300be8+_0xae3d('0x28'))){if(_0x11ecf7[_0x300be8+_0xae3d('0x27')]>0x0&&_0x11ecf7[_0x300be8+_0xae3d('0x28')]>=_0x11ecf7[_0x300be8+_0xae3d('0x27')]){writeLog(_0x3224ff,_0x11ecf7,_0x300be8[_0xae3d('0x29')]()+_0xae3d('0x2a'));return![];}}return!![];};exports[_0xae3d('0x2b')]=function(_0x54c1e1,_0x57864e,_0x12e3a5,_0x1281aa,_0x3a5840){return sendNotification(!![],_0x54c1e1,_0x57864e,_0x12e3a5,_0x1281aa,_0x3a5840);};exports[_0xae3d('0x2c')]=function(_0xb69ec9,_0x561371,_0x1d1483,_0x3a2434,_0x5a39c5){return sendNotification(![],_0xb69ec9,_0x561371,_0x1d1483,_0x3a2434,_0x5a39c5);};exports[_0xae3d('0x2d')]=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 8566adf..f7959e5 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 _0x52b8=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','stringify','validate','lodash','./utils','../../../../config/logger','routing','string'];(function(_0x12ba5e,_0x58e966){var _0x1310b3=function(_0x775e90){while(--_0x775e90){_0x12ba5e['push'](_0x12ba5e['shift']());}};_0x1310b3(++_0x58e966);}(_0x52b8,0xb2));var _0x852b=function(_0x53e8fc,_0x284c96){_0x53e8fc=_0x53e8fc-0x0;var _0x3bf6cc=_0x52b8[_0x53e8fc];return _0x3bf6cc;};'use strict';var schema=require(_0x852b('0x0'));var sh=require('shelljs');var _=require(_0x852b('0x1'));var utils=require(_0x852b('0x2'));var logger=require(_0x852b('0x3'))(_0x852b('0x4'));var system=schema({'command':{'type':_0x852b('0x5'),'required':!![],'message':_0x852b('0x6')}});exports['consequence']=function(_0x2d5ea3,_0x3cbe2c){return function(_0x345515){try{var _0x19c518={'command':_0x3cbe2c[0x0]};var _0x5480d4=system[_0x852b('0x0')](_0x19c518,{'typecast':!![]});if(_0x5480d4['length']){logger[_0x852b('0x7')](_0x852b('0x8'),_0x2d5ea3,_[_0x852b('0x9')](_0x5480d4,_0x852b('0xa'))['join'](',\x20'));logger[_0x852b('0xb')](_0x852b('0xc'),_0x2d5ea3);_0x345515[_0x852b('0xd')]();}else{var _0x2aa3a5=this;var _0x4ee5a3=utils[_0x852b('0xe')](_0x3cbe2c[0x0],this);logger[_0x852b('0xb')](_0x852b('0xf'),_0x2d5ea3,_0x4ee5a3);sh[_0x852b('0x10')](_['trim'](_0x4ee5a3),function(_0x3ad0d0,_0x2a3b5d){logger['info'](_0x852b('0x11'),_0x2d5ea3,_0x3ad0d0);if(_0x3ad0d0==0x0){var _0x1f9473=_0x2a3b5d[_0x852b('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x852b('0x13')](_0x3cbe2c[0x1])||_['isEmpty'](_0x3cbe2c[0x1])){logger[_0x852b('0xb')](_0x852b('0x14'),_0x2d5ea3);_0x2aa3a5[_0x852b('0x15')][_0x3cbe2c[0x1]]=_0x1f9473;}else{logger[_0x852b('0xb')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x2d5ea3,_0x3cbe2c[0x1],_0x1f9473);_0x2aa3a5[_0x852b('0x15')][_0x3cbe2c[0x1]]=_0x1f9473;}}_0x345515[_0x852b('0xd')]();});}}catch(_0x2938f1){logger[_0x852b('0x7')](_0x852b('0x8'),_0x2d5ea3,_['isObject'](_0x2938f1)?JSON[_0x852b('0x16')](_0x2938f1):_0x2938f1);logger[_0x852b('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2d5ea3);_0x345515['next']();}};}; \ No newline at end of file +var _0x68a5=['[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0x1418b6,_0x2b905e){var _0x1072dc=function(_0x2fd915){while(--_0x2fd915){_0x1418b6['push'](_0x1418b6['shift']());}};_0x1072dc(++_0x2b905e);}(_0x68a5,0x67));var _0x568a=function(_0x1aaf62,_0x49f3b1){_0x1aaf62=_0x1aaf62-0x0;var _0x2e5fd2=_0x68a5[_0x1aaf62];return _0x2e5fd2;};'use strict';var schema=require(_0x568a('0x0'));var sh=require(_0x568a('0x1'));var _=require(_0x568a('0x2'));var utils=require(_0x568a('0x3'));var logger=require(_0x568a('0x4'))('routing');var system=schema({'command':{'type':_0x568a('0x5'),'required':!![],'message':_0x568a('0x6')}});exports['consequence']=function(_0x551c4b,_0x265a36){return function(_0x28a0c8){try{var _0x9d91df={'command':_0x265a36[0x0]};var _0x5d6e11=system[_0x568a('0x0')](_0x9d91df,{'typecast':!![]});if(_0x5d6e11[_0x568a('0x7')]){logger[_0x568a('0x8')]('[%s][SYSTEM]\x20%s',_0x551c4b,_[_0x568a('0x9')](_0x5d6e11,_0x568a('0xa'))[_0x568a('0xb')](',\x20'));logger[_0x568a('0xc')](_0x568a('0xd'),_0x551c4b);_0x28a0c8[_0x568a('0xe')]();}else{var _0x1a2c33=this;var _0x3cdc94=utils['getMustacheRender'](_0x265a36[0x0],this);logger[_0x568a('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x551c4b,_0x3cdc94);sh['exec'](_[_0x568a('0xf')](_0x3cdc94),function(_0x5be685,_0xf4546f){logger['info'](_0x568a('0x10'),_0x551c4b,_0x5be685);if(_0x5be685==0x0){var _0x4fdc2c=_0xf4546f['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x568a('0x11')](_0x265a36[0x1])||_[_0x568a('0x12')](_0x265a36[0x1])){logger[_0x568a('0xc')](_0x568a('0x13'),_0x551c4b);_0x1a2c33[_0x568a('0x14')][_0x265a36[0x1]]=_0x4fdc2c;}else{logger['info'](_0x568a('0x15'),_0x551c4b,_0x265a36[0x1],_0x4fdc2c);_0x1a2c33[_0x568a('0x14')][_0x265a36[0x1]]=_0x4fdc2c;}}_0x28a0c8['next']();});}}catch(_0x3019ae){logger[_0x568a('0x8')](_0x568a('0x16'),_0x551c4b,_[_0x568a('0x17')](_0x3019ae)?JSON[_0x568a('0x18')](_0x3019ae):_0x3019ae);logger[_0x568a('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x551c4b);_0x28a0c8[_0x568a('0xe')]();}};}; \ 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 9cf7a79..1089153 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 _0x2728=['../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','length','[%s][TAG]\x20%s','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','catch','stringify','finally','error','isObject','validate','lodash','../../rpc/chatInteraction'];(function(_0xd4ccfd,_0x3be6f0){var _0x325dd1=function(_0x235043){while(--_0x235043){_0xd4ccfd['push'](_0xd4ccfd['shift']());}};_0x325dd1(++_0x3be6f0);}(_0x2728,0x99));var _0x8272=function(_0x7adc9f,_0xd98ac9){_0x7adc9f=_0x7adc9f-0x0;var _0x8d4c7a=_0x2728[_0x7adc9f];return _0x8d4c7a;};'use strict';var schema=require(_0x8272('0x0'));var _=require(_0x8272('0x1'));var rpc={'chatInteraction':require(_0x8272('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x8272('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x8272('0x4')),'whatsappInteraction':require(_0x8272('0x5'))};var logger=require(_0x8272('0x6'))(_0x8272('0x7'));var tag=schema({'tag':{'type':_0x8272('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x8272('0x9')]=function(_0x2a926e,_0x5d7050,_0x1c66a2,_0x240d60){return function(_0x189ef4){try{var _0x39fd4a={'tag':_0x5d7050[0x0]};var _0x3cbc90=tag[_0x8272('0x0')](_0x39fd4a,{'typecast':!![]});if(_0x3cbc90[_0x8272('0xa')]){logger['error'](_0x8272('0xb'),_0x2a926e,_['map'](_0x3cbc90,_0x8272('0xc'))['join'](',\x20'));logger[_0x8272('0xd')](_0x8272('0xe'),_0x2a926e);_0x189ef4[_0x8272('0xf')]();}else{var _0x50f357={'ids':[_0x5d7050[0x0]]};if(rpc[_0x240d60[_0x8272('0x10')]+_0x8272('0x11')]){rpc[_0x240d60[_0x8272('0x10')]+_0x8272('0x11')][_0x8272('0x12')](_0x240d60[_0x8272('0x13')]['id'],_0x50f357)[_0x8272('0x14')](function(_0x1387b4){logger[_0x8272('0xd')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x2a926e,_0x5d7050[0x1],_0x240d60[_0x8272('0x10')],_0x240d60[_0x8272('0x13')]['id']);})[_0x8272('0x15')](function(_0x910743){logger['error']('[%s][TAG]\x20%s',_0x2a926e,JSON[_0x8272('0x16')](_0x910743));logger[_0x8272('0xd')](_0x8272('0xe'),_0x2a926e);})[_0x8272('0x17')](function(){_0x189ef4[_0x8272('0xf')]();});}}}catch(_0xaf1575){logger[_0x8272('0x18')](_0x8272('0xb'),_0x2a926e,_[_0x8272('0x19')](_0xaf1575)?JSON[_0x8272('0x16')](_0xaf1575):_0xaf1575);logger[_0x8272('0xd')](_0x8272('0xe'),_0x2a926e);_0x189ef4[_0x8272('0xf')]();}};}; \ No newline at end of file +var _0xca07=['error','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','catch','stringify','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x2fb2d7,_0x748a6){var _0x23ab8b=function(_0x2a0658){while(--_0x2a0658){_0x2fb2d7['push'](_0x2fb2d7['shift']());}};_0x23ab8b(++_0x748a6);}(_0xca07,0x69));var _0x7ca0=function(_0x49621c,_0xa7e906){_0x49621c=_0x49621c-0x0;var _0x38e8a8=_0xca07[_0x49621c];return _0x38e8a8;};'use strict';var schema=require(_0x7ca0('0x0'));var _=require(_0x7ca0('0x1'));var rpc={'chatInteraction':require(_0x7ca0('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x7ca0('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x7ca0('0x4')),'whatsappInteraction':require(_0x7ca0('0x5'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0x7ca0('0x6'),'required':!![],'message':_0x7ca0('0x7')}});exports[_0x7ca0('0x8')]=function(_0x3b58ee,_0x237c40,_0x4aed8f,_0x1e4e4e){return function(_0xa604a8){try{var _0x26506e={'tag':_0x237c40[0x0]};var _0x1cdc89=tag['validate'](_0x26506e,{'typecast':!![]});if(_0x1cdc89[_0x7ca0('0x9')]){logger[_0x7ca0('0xa')](_0x7ca0('0xb'),_0x3b58ee,_[_0x7ca0('0xc')](_0x1cdc89,'message')['join'](',\x20'));logger[_0x7ca0('0xd')](_0x7ca0('0xe'),_0x3b58ee);_0xa604a8[_0x7ca0('0xf')]();}else{var _0x14a381={'ids':[_0x237c40[0x0]]};if(rpc[_0x1e4e4e[_0x7ca0('0x10')]+_0x7ca0('0x11')]){rpc[_0x1e4e4e[_0x7ca0('0x10')]+_0x7ca0('0x11')][_0x7ca0('0x12')](_0x1e4e4e[_0x7ca0('0x13')]['id'],_0x14a381)['then'](function(_0xedb7d3){logger[_0x7ca0('0xd')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x3b58ee,_0x237c40[0x1],_0x1e4e4e[_0x7ca0('0x10')],_0x1e4e4e[_0x7ca0('0x13')]['id']);})[_0x7ca0('0x14')](function(_0x388de0){logger[_0x7ca0('0xa')](_0x7ca0('0xb'),_0x3b58ee,JSON[_0x7ca0('0x15')](_0x388de0));logger[_0x7ca0('0xd')](_0x7ca0('0xe'),_0x3b58ee);})[_0x7ca0('0x16')](function(){_0xa604a8[_0x7ca0('0xf')]();});}}}catch(_0x23bd8e){logger['error'](_0x7ca0('0xb'),_0x3b58ee,_['isObject'](_0x23bd8e)?JSON[_0x7ca0('0x15')](_0x23bd8e):_0x23bd8e);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3b58ee);_0xa604a8[_0x7ca0('0xf')]();}};}; \ 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 5f1a91d..5307051 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 _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x402e3f,_0x1350ff){var _0x328ba7=function(_0xda1af8){while(--_0xda1af8){_0x402e3f['push'](_0x402e3f['shift']());}};_0x328ba7(++_0x1350ff);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0xf6eb2c,_0x4d4c17){var _0x48ba8f=function(_0x3b331c){while(--_0x3b331c){_0xf6eb2c['push'](_0xf6eb2c['shift']());}};_0x48ba8f(++_0x4d4c17);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 389339c..ba4c46b 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 _0xff7d=['applications','isArray','length','join','app','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','./interval','condition','intervals','consequence','priority','info','Push\x20new\x20rule','error','.js','execute','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','UserId','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','mailQueues','available','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction'];(function(_0xddeac9,_0x2ebf8c){var _0x65fa72=function(_0x795e4f){while(--_0x795e4f){_0xddeac9['push'](_0xddeac9['shift']());}};_0x65fa72(++_0x2ebf8c);}(_0xff7d,0xf9));var _0xdff7=function(_0x55994f,_0x486545){_0x55994f=_0x55994f-0x0;var _0x8e3aa5=_0xff7d[_0x55994f];return _0x8e3aa5;};'use strict';var _=require(_0xdff7('0x0'));var util=require('util');var path=require(_0xdff7('0x1'));var fs=require('fs');var jayson=require(_0xdff7('0x2'));var BPromise=require(_0xdff7('0x3'));var uuid=require(_0xdff7('0x4'));var config=require(_0xdff7('0x5'));var logger=require(_0xdff7('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0xdff7('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xdff7('0x8')),'smsQueueReport':require(_0xdff7('0x9')),'faxQueueReport':require(_0xdff7('0xa')),'whatsappQueueReport':require(_0xdff7('0xb'))};var RuleEngine=require(_0xdff7('0xc'));function getId(_0x225dfd,_0x253e5c,_0x228bc9){return util[_0xdff7('0xd')]('%s.%s.%s',_0x225dfd,_0x253e5c||0x0,_0x228bc9||0x0);}function getIntervals(_0x54a6d4,_0xf8ad0){var _0x421436=[];if(!_[_0xdff7('0xe')](_0xf8ad0[_0xdff7('0xf')])&&!_[_0xdff7('0xe')](_0x54a6d4[_0xf8ad0[_0xdff7('0xf')]])&&!_[_0xdff7('0xe')](_0x54a6d4[_0xf8ad0[_0xdff7('0xf')]][_0xdff7('0x10')])){_0x421436=_[_0xdff7('0x11')](_0x54a6d4[_0xf8ad0[_0xdff7('0xf')]]['Intervals'],_0xdff7('0x12'));}else if(!_['isNil'](_0xf8ad0[_0xdff7('0x12')])){_0x421436=[_0xf8ad0[_0xdff7('0x12')]];}return _0x421436;}exports[_0xdff7('0x13')]=function(_0x278843){_0x278843[_0xdff7('0x14')]={};return new BPromise(function(_0x46d993,_0x1aaa56){var _0x39a675={'Start':function(_0x463538){var _0x173b5a=this;return new Promise(function(_0xfe72bf,_0x308ffa){if(_0x463538){try{var _0x47cf53=[];var _0x33115a=getId(_0x463538[_0xdff7('0x15')],_0x463538[_0xdff7('0x16')]?_0x463538[_0xdff7('0x16')]['id']:0x0,_0x463538[_0xdff7('0x17')]?_0x463538[_0xdff7('0x17')]['id']:0x0);if(_0x463538[_0xdff7('0x18')]&&_[_0xdff7('0x19')](_0x463538[_0xdff7('0x18')])&&_0x463538[_0xdff7('0x18')][_0xdff7('0x1a')]){for(var _0x4ec75a=0x0;_0x4ec75a<_0x463538[_0xdff7('0x18')][_0xdff7('0x1a')];_0x4ec75a+=0x1){var _0x5ec93a=_0x463538['applications'][_0x4ec75a];if(fs['existsSync'](path[_0xdff7('0x1b')](__dirname,_0xdff7('0x18'),_0x5ec93a[_0xdff7('0x1c')]+'.js'))){var _0x37db69=[];switch(_0x5ec93a[_0xdff7('0x1c')][_0xdff7('0x1d')]()){case _0xdff7('0x1e'):var _0x3e5dcc=_0x5ec93a[_0xdff7('0x1f')][_0xdff7('0x20')](',');if(_0x463538['channel']===_0xdff7('0x21')){_0x37db69[_0xdff7('0x22')](_0x3e5dcc[0x0]);_0x37db69[_0xdff7('0x22')](_0x3e5dcc[0x1]);_0x37db69['push'](_0x3e5dcc[_0xdff7('0x23')](0x2,_0x3e5dcc[_0xdff7('0x1a')])[_0xdff7('0x1b')](','));}else{_0x37db69[_0xdff7('0x22')](_0x3e5dcc[0x0]);_0x37db69[_0xdff7('0x22')](_0x3e5dcc[_0xdff7('0x23')](0x1,_0x3e5dcc[_0xdff7('0x1a')])[_0xdff7('0x1b')](','));}break;case _0xdff7('0x24'):var _0x4a8255=_0x5ec93a[_0xdff7('0x1f')]['split'](',');_0x37db69['push'](_0x4a8255[0x0]);_0x37db69[_0xdff7('0x22')](_0x4a8255[0x1]);_0x37db69['push'](_0x4a8255[_0xdff7('0x23')](0x2,_0x4a8255[_0xdff7('0x1a')])[_0xdff7('0x1b')](','));break;case _0xdff7('0x25'):var _0x54933f=_0x5ec93a[_0xdff7('0x1f')][_0xdff7('0x20')](',');_0x37db69[_0xdff7('0x22')](_0x54933f[0x0]);_0x37db69['push'](_0x54933f[0x1]);_0x37db69['push'](_0x54933f[0x2]);_0x37db69[_0xdff7('0x22')](_0x54933f[0x3]);_0x37db69[_0xdff7('0x22')](_0x54933f['slice'](0x4,_0x54933f[_0xdff7('0x1a')])['join'](','));break;case _0xdff7('0x26'):var _0x15ee1d=_0x5ec93a[_0xdff7('0x1f')][_0xdff7('0x20')](',');_0x37db69[_0xdff7('0x22')](_0x15ee1d[0x0]);_0x37db69['push'](_0x15ee1d[0x1]);_0x37db69[_0xdff7('0x22')](_0x15ee1d[0x2]);_0x37db69[_0xdff7('0x22')](_0x15ee1d[0x3]);_0x37db69['push'](_0x15ee1d[_0xdff7('0x23')](0x4,_0x15ee1d[_0xdff7('0x1a')])[_0xdff7('0x1b')](','));break;case _0xdff7('0x16'):_0x37db69[_0xdff7('0x22')](_0x5ec93a[_0xdff7('0x1f')]);break;case'tag':_0x37db69[_0xdff7('0x22')](_0x5ec93a[_0xdff7('0x27')]);_0x37db69[_0xdff7('0x22')](_0x5ec93a[_0xdff7('0x1f')]);break;default:_0x37db69=_[_0xdff7('0xe')](_0x5ec93a[_0xdff7('0x1f')])?[]:_0x5ec93a[_0xdff7('0x1f')][_0xdff7('0x20')](',');}var _0x1be0be={'id':util[_0xdff7('0xd')]('%s:%s:%s',_0x33115a,_0x5ec93a['id'],_0x5ec93a[_0xdff7('0x1c')]),'condition':require(_0xdff7('0x28'))[_0xdff7('0x29')](_0x33115a,getIntervals(_0x278843[_0xdff7('0x2a')],_0x5ec93a),_0x278843),'consequence':require('./applications/'+_0x5ec93a[_0xdff7('0x1c')])[_0xdff7('0x2b')](_0x33115a,_0x37db69,_0x278843,_0x463538),'p':_0x5ec93a[_0xdff7('0x2c')]||0x0};logger[_0xdff7('0x2d')](_0xdff7('0x2e'),_0x1be0be['id'],'on\x20interval',getIntervals(_0x278843['intervals'],_0x5ec93a)['join']('\x20|\x20'));_0x47cf53['push'](_0x1be0be);}else{logger[_0xdff7('0x2f')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xdff7('0x1b')](__dirname,'applications',_0x5ec93a[_0xdff7('0x1c')]+_0xdff7('0x30')));}}_0x278843[_0xdff7('0x14')][_0x33115a]=new RuleEngine(_0x47cf53);_0x278843[_0xdff7('0x14')][_0x33115a][_0xdff7('0x31')](_0x463538,function(_0x2dc323){logger[_0xdff7('0x2d')]('Applications\x20executed',JSON['stringify'](_0x2dc323[_0xdff7('0x32')]));if(_0x278843['rules'][_0x33115a]){_0x278843['rules'][_0x33115a][_0xdff7('0x33')](_0xdff7('0x34'));}});return _0xfe72bf({'code':0xc8,'message':_0x463538});}else{logger[_0xdff7('0x2d')](_0xdff7('0x35'));return _0xfe72bf({'code':0xc8,'message':_0x463538});}}catch(_0xc30038){logger[_0xdff7('0x2f')](_0xc30038[_0xdff7('0x36')]);return _0x308ffa(_0x173b5a[_0xdff7('0x2f')](0x1f4,_0xc30038));}}return _0x308ffa(_0xdff7('0x37'));});},'AcceptMessage':function(_0x4e5844){var _0x48323b=this;return new Promise(function(_0x194e68,_0x193c4c){if(_0x4e5844[_0xdff7('0x38')]&&_0x4e5844[_0xdff7('0x38')]['id']){if(_0x278843[_0xdff7('0x39')][_0x4e5844['agent']['id']]){_0x278843[_0xdff7('0x39')][_0x4e5844[_0xdff7('0x38')]['id']][_0xdff7('0x3a')]=![];_0x278843[_0xdff7('0x39')][_0x4e5844[_0xdff7('0x38')]['id']][_0xdff7('0x3b')]=undefined;}}if(_0x4e5844['message']&&_0x4e5844[_0xdff7('0x16')]['id']){try{var _0x2dd561=getId(_0x4e5844[_0xdff7('0x15')],_0x4e5844[_0xdff7('0x16')]?_0x4e5844[_0xdff7('0x16')]['id']:0x0,_0x4e5844[_0xdff7('0x17')]?_0x4e5844[_0xdff7('0x17')]['id']:0x0);if(_0x278843[_0xdff7('0x14')][_0x2dd561]){_0x278843[_0xdff7('0x14')][_0x2dd561][_0xdff7('0x33')]('end');if(rpc[_0x4e5844[_0xdff7('0x15')]+_0xdff7('0x3c')]){rpc[_0x4e5844['channel']+_0xdff7('0x3c')][_0xdff7('0x3d')](_0x2dd561,{'UserId':_0x4e5844[_0xdff7('0x16')][_0xdff7('0x3e')]})['catch'](function(_0x4ec0f5){logger[_0xdff7('0x2f')]('error\x20update\x20queue\x20report');});}}return _0x194e68({'code':0xc8,'message':_0x4e5844});}catch(_0x249525){logger['error'](_0x249525['stack']);return _0x193c4c(_0x48323b[_0xdff7('0x2f')](0x1f4,_0x249525));}}logger[_0xdff7('0x2f')](_0xdff7('0x3f'));return _0x193c4c(_0x48323b[_0xdff7('0x2f')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x6f168a){var _0x4f110f=this;return new Promise(function(_0x1c0e95,_0x1617d9){if(_0x6f168a[_0xdff7('0x38')]&&_0x6f168a[_0xdff7('0x38')]['id']){try{if(_0x278843[_0xdff7('0x39')][_0x6f168a[_0xdff7('0x38')]['id']]){_0x278843[_0xdff7('0x39')][_0x6f168a[_0xdff7('0x38')]['id']][_0xdff7('0x3a')]=![];_0x278843[_0xdff7('0x39')][_0x6f168a[_0xdff7('0x38')]['id']][_0xdff7('0x3b')]=undefined;}return _0x1c0e95({'code':0xc8,'message':_0x6f168a});}catch(_0xe93ec){logger['error'](_0xe93ec[_0xdff7('0x36')]);return _0x1617d9(_0x4f110f[_0xdff7('0x2f')](0x1f4,_0xe93ec));}}logger[_0xdff7('0x2f')](_0xdff7('0x3f'));return _0x1617d9(_0x4f110f[_0xdff7('0x2f')](0x1f4,_0xdff7('0x3f')));});},'AbandonInteraction':function(_0x4d0f43){var _0x18eb88=this;return new Promise(function(_0x1a2a7b,_0xe2e7d5){if(_0x4d0f43[_0xdff7('0x15')]&&_0x4d0f43[_0xdff7('0x17')]&&_0x4d0f43[_0xdff7('0x17')]['id']){try{var _0x24e8e1=getId(_0x4d0f43[_0xdff7('0x15')],_0x4d0f43[_0xdff7('0x16')]?_0x4d0f43[_0xdff7('0x16')]['id']:0x0,_0x4d0f43[_0xdff7('0x17')]?_0x4d0f43[_0xdff7('0x17')]['id']:0x0);if(_0x278843[_0xdff7('0x14')][_0x24e8e1]){_0x278843[_0xdff7('0x14')][_0x24e8e1][_0xdff7('0x33')](_0xdff7('0x40'));}return _0x1a2a7b({'code':0xc8,'message':_0x4d0f43});}catch(_0xae423a){logger[_0xdff7('0x2f')](_0xae423a[_0xdff7('0x36')]);return _0xe2e7d5(_0x18eb88[_0xdff7('0x2f')](0x1f4,_0xae423a));}}logger['error'](_0xdff7('0x3f'));return _0xe2e7d5(_0x18eb88[_0xdff7('0x2f')](0x1f4,_0xdff7('0x3f')));});},'AgentCapacity':function(_0x38be5e){var _0x3a1ebe=this;return new Promise(function(_0x1ba7c3,_0x2202d1){if(_0x278843[_0xdff7('0x39')][_0xdff7('0x41')](_0x38be5e['id'])){for(var _0x4a24c0 in _0x38be5e[_0xdff7('0x42')]){if(_0x38be5e[_0xdff7('0x42')][_0xdff7('0x41')](_0x4a24c0)){if(_0x278843['agents'][_0x38be5e['id']][_0xdff7('0x41')](_0x4a24c0+_0xdff7('0x43'))){_0x278843[_0xdff7('0x39')][_0x38be5e['id']][_0x4a24c0+_0xdff7('0x43')]=parseInt(_0x38be5e[_0xdff7('0x42')][_0x4a24c0],0xa);}}}_0x278843[_0xdff7('0x39')][_0x38be5e['id']][_0xdff7('0x44')]();return _0x1ba7c3({'code':0xc8,'message':_0x278843[_0xdff7('0x39')][_0x38be5e['id']]});}else{return _0x2202d1(_0x3a1ebe[_0xdff7('0x2f')](0x1f4,_0xdff7('0x45')));}});},'Agents':function(_0x512151){return new Promise(function(_0x8f91b8,_0x381b14){var _0x3ee9ae=_[_0xdff7('0x46')](_0x278843[_0xdff7('0x39')]);_0x8f91b8({'count':_0x3ee9ae[_0xdff7('0x1a')],'rows':_0x3ee9ae});});},'ChatQueues':function(_0x1bf080){return new Promise(function(_0x950ecf,_0x36dbe0){var _0x2e1269=[];for(var _0x2e5a36 in _0x278843[_0xdff7('0x47')]){if(_0x278843[_0xdff7('0x47')]['hasOwnProperty'](_0x2e5a36)){var _0x249880=_0x278843[_0xdff7('0x47')][_0x2e5a36];var _0x36c5e2={'id':_0x249880['id'],'available':_0x249880['available'],'loggedIn':_0x249880[_0xdff7('0x48')],'name':_0x249880[_0xdff7('0x49')],'paused':_0x249880[_0xdff7('0x4a')],'waiting':_0x249880['waiting']};_0x2e1269[_0xdff7('0x22')](_0x36c5e2);}}_0x950ecf({'count':_0x2e1269[_0xdff7('0x1a')],'rows':_0x2e1269});});},'MailQueues':function(_0x5a9fc4){return new Promise(function(_0x40707a,_0x346b2d){var _0x5239f0=[];for(var _0x573b0f in _0x278843[_0xdff7('0x4b')]){if(_0x278843[_0xdff7('0x4b')][_0xdff7('0x41')](_0x573b0f)){var _0x11fa44=_0x278843[_0xdff7('0x4b')][_0x573b0f];var _0x1f036b={'id':_0x11fa44['id'],'available':_0x11fa44[_0xdff7('0x4c')],'loggedIn':_0x11fa44['loggedIn'],'name':_0x11fa44[_0xdff7('0x49')],'paused':_0x11fa44[_0xdff7('0x4a')],'waiting':_0x11fa44[_0xdff7('0x4d')]};_0x5239f0[_0xdff7('0x22')](_0x1f036b);}}_0x40707a({'count':_0x5239f0[_0xdff7('0x1a')],'rows':_0x5239f0});});},'OpenchannelQueues':function(_0x45618f){return new Promise(function(_0x9fa300,_0x1f0b1a){var _0x5bfac7=[];for(var _0x29d1c0 in _0x278843[_0xdff7('0x4e')]){if(_0x278843[_0xdff7('0x4e')][_0xdff7('0x41')](_0x29d1c0)){var _0x255538=_0x278843[_0xdff7('0x4e')][_0x29d1c0];var _0x3ca598={'id':_0x255538['id'],'available':_0x255538[_0xdff7('0x4c')],'loggedIn':_0x255538['loggedIn'],'name':_0x255538[_0xdff7('0x49')],'paused':_0x255538[_0xdff7('0x4a')],'waiting':_0x255538[_0xdff7('0x4d')]};_0x5bfac7['push'](_0x3ca598);}}_0x9fa300({'count':_0x5bfac7['length'],'rows':_0x5bfac7});});},'SmsQueues':function(_0x551306){return new Promise(function(_0x42a989,_0x36506c){var _0x469481=[];for(var _0x2d75ce in _0x278843[_0xdff7('0x4f')]){if(_0x278843['smsQueues'][_0xdff7('0x41')](_0x2d75ce)){var _0x3f2cd8=_0x278843[_0xdff7('0x4f')][_0x2d75ce];var _0x151b5b={'id':_0x3f2cd8['id'],'available':_0x3f2cd8[_0xdff7('0x4c')],'loggedIn':_0x3f2cd8[_0xdff7('0x48')],'name':_0x3f2cd8[_0xdff7('0x49')],'paused':_0x3f2cd8[_0xdff7('0x4a')],'waiting':_0x3f2cd8[_0xdff7('0x4d')]};_0x469481[_0xdff7('0x22')](_0x151b5b);}}_0x42a989({'count':_0x469481['length'],'rows':_0x469481});});},'FaxQueues':function(_0x3f5be0){return new Promise(function(_0x1fb6f7,_0x29230a){var _0x2986cc=[];for(var _0x150197 in _0x278843[_0xdff7('0x50')]){if(_0x278843[_0xdff7('0x50')][_0xdff7('0x41')](_0x150197)){var _0x47f4c0=_0x278843['faxQueues'][_0x150197];var _0x1ead19={'id':_0x47f4c0['id'],'available':_0x47f4c0[_0xdff7('0x4c')],'loggedIn':_0x47f4c0['loggedIn'],'name':_0x47f4c0[_0xdff7('0x49')],'paused':_0x47f4c0['paused'],'waiting':_0x47f4c0[_0xdff7('0x4d')]};_0x2986cc[_0xdff7('0x22')](_0x1ead19);}}_0x1fb6f7({'count':_0x2986cc[_0xdff7('0x1a')],'rows':_0x2986cc});});},'WhatsappQueues':function(_0x3f9867){return new Promise(function(_0x462280,_0x382276){var _0x125f13=[];for(var _0x46f552 in _0x278843[_0xdff7('0x51')]){if(_0x278843[_0xdff7('0x51')][_0xdff7('0x41')](_0x46f552)){var _0x2d012a=_0x278843[_0xdff7('0x51')][_0x46f552];var _0x2479f1={'id':_0x2d012a['id'],'available':_0x2d012a[_0xdff7('0x4c')],'loggedIn':_0x2d012a[_0xdff7('0x48')],'name':_0x2d012a[_0xdff7('0x49')],'paused':_0x2d012a[_0xdff7('0x4a')],'waiting':_0x2d012a['waiting']};_0x125f13[_0xdff7('0x22')](_0x2479f1);}}_0x462280({'count':_0x125f13[_0xdff7('0x1a')],'rows':_0x125f13});});},'ChatQueuesWaitingInteractions':function(_0x4e2404){return new Promise(function(_0x18d235,_0x2184eb){var _0x38fe97=_[_0xdff7('0x46')](_0x278843[_0xdff7('0x52')]);_0x18d235({'count':_0x38fe97[_0xdff7('0x1a')],'rows':_0x38fe97});});},'MailQueuesWaitingInteractions':function(_0x22fa4a){return new Promise(function(_0x1b1226,_0x236c18){var _0x426297=_[_0xdff7('0x46')](_0x278843[_0xdff7('0x53')]);_0x1b1226({'count':_0x426297['length'],'rows':_0x426297});});},'OpenchannelQueuesWaitingInteractions':function(_0x1bfe57){return new Promise(function(_0x442864,_0x4e6cff){var _0x4eb975=_[_0xdff7('0x46')](_0x278843[_0xdff7('0x54')]);_0x442864({'count':_0x4eb975[_0xdff7('0x1a')],'rows':_0x4eb975});});},'SmsQueuesWaitingInteractions':function(_0x15e34b){return new Promise(function(_0x5ed927,_0x17db85){var _0x388c92=_[_0xdff7('0x46')](_0x278843[_0xdff7('0x55')]);_0x5ed927({'count':_0x388c92[_0xdff7('0x1a')],'rows':_0x388c92});});},'FaxQueuesWaitingInteractions':function(_0x1256c2){return new Promise(function(_0x4c4881,_0x3a793a){var _0x62ba60=_['values'](_0x278843['faxQueuesWaitingInteractions']);_0x4c4881({'count':_0x62ba60[_0xdff7('0x1a')],'rows':_0x62ba60});});},'WhatsappQueuesWaitingInteractions':function(_0x32dc6c){return new Promise(function(_0x41753a,_0x2593a7){var _0x2d1164=_['values'](_0x278843[_0xdff7('0x56')]);_0x41753a({'count':_0x2d1164[_0xdff7('0x1a')],'rows':_0x2d1164});});}};var _0x589b8e=jayson['server'](_0x39a675)['http']();_0x589b8e['on'](_0xdff7('0x2f'),function(_0x22b136){logger[_0xdff7('0x2f')](JSON['stringify'](_0x22b136));return _0x1aaa56(_0x22b136);});_0x589b8e[_0xdff7('0x13')](0x232c,_0xdff7('0x57'),function(){console[_0xdff7('0x58')](_0xdff7('0x59'),0x232c);return _0x46d993(_0xdff7('0x5a')+0x232c);});});}; \ No newline at end of file +var _0x9058=['openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','applications','isArray','length','existsSync','join','.js','app','toLowerCase','appdata','split','channel','mail','push','slice','dialogflowv2','tag','TagId','condition','consequence','info','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','emit','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','stack','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues'];(function(_0x1cada6,_0x3667b3){var _0x485132=function(_0x3a6ba2){while(--_0x3a6ba2){_0x1cada6['push'](_0x1cada6['shift']());}};_0x485132(++_0x3667b3);}(_0x9058,0x17e));var _0x8905=function(_0x52ce74,_0xfcf94){_0x52ce74=_0x52ce74-0x0;var _0x27edc7=_0x9058[_0x52ce74];return _0x27edc7;};'use strict';var _=require(_0x8905('0x0'));var util=require('util');var path=require(_0x8905('0x1'));var fs=require('fs');var jayson=require(_0x8905('0x2'));var BPromise=require(_0x8905('0x3'));var uuid=require(_0x8905('0x4'));var config=require(_0x8905('0x5'));var logger=require(_0x8905('0x6'))(_0x8905('0x7'));var rpc={'openchannelQueueReport':require(_0x8905('0x8')),'mailQueueReport':require(_0x8905('0x9')),'chatQueueReport':require(_0x8905('0xa')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x8905('0xb')),'whatsappQueueReport':require(_0x8905('0xc'))};var RuleEngine=require(_0x8905('0xd'));function getId(_0x583e56,_0x3ef49a,_0x30c5bb){return util['format'](_0x8905('0xe'),_0x583e56,_0x3ef49a||0x0,_0x30c5bb||0x0);}function getIntervals(_0xff16a3,_0x547ab3){var _0x5ce40f=[];if(!_[_0x8905('0xf')](_0x547ab3[_0x8905('0x10')])&&!_[_0x8905('0xf')](_0xff16a3[_0x547ab3['IntervalId']])&&!_[_0x8905('0xf')](_0xff16a3[_0x547ab3[_0x8905('0x10')]][_0x8905('0x11')])){_0x5ce40f=_[_0x8905('0x12')](_0xff16a3[_0x547ab3['IntervalId']]['Intervals'],_0x8905('0x13'));}else if(!_[_0x8905('0xf')](_0x547ab3['interval'])){_0x5ce40f=[_0x547ab3[_0x8905('0x13')]];}return _0x5ce40f;}exports[_0x8905('0x14')]=function(_0xfe719f){_0xfe719f[_0x8905('0x15')]={};return new BPromise(function(_0x1e243d,_0xa3ec98){var _0x51dc0c={'Start':function(_0x484fa5){var _0x3258ca=this;return new Promise(function(_0x5cf577,_0x6c3af1){if(_0x484fa5){try{var _0x1359af=[];var _0x274c35=getId(_0x484fa5['channel'],_0x484fa5[_0x8905('0x16')]?_0x484fa5[_0x8905('0x16')]['id']:0x0,_0x484fa5[_0x8905('0x17')]?_0x484fa5[_0x8905('0x17')]['id']:0x0);if(_0x484fa5[_0x8905('0x18')]&&_[_0x8905('0x19')](_0x484fa5[_0x8905('0x18')])&&_0x484fa5[_0x8905('0x18')][_0x8905('0x1a')]){for(var _0x1ffd57=0x0;_0x1ffd57<_0x484fa5['applications']['length'];_0x1ffd57+=0x1){var _0x508654=_0x484fa5[_0x8905('0x18')][_0x1ffd57];if(fs[_0x8905('0x1b')](path[_0x8905('0x1c')](__dirname,_0x8905('0x18'),_0x508654['app']+_0x8905('0x1d')))){var _0x344f04=[];switch(_0x508654[_0x8905('0x1e')][_0x8905('0x1f')]()){case'autoreply':var _0x58a88f=_0x508654[_0x8905('0x20')][_0x8905('0x21')](',');if(_0x484fa5[_0x8905('0x22')]===_0x8905('0x23')){_0x344f04[_0x8905('0x24')](_0x58a88f[0x0]);_0x344f04[_0x8905('0x24')](_0x58a88f[0x1]);_0x344f04[_0x8905('0x24')](_0x58a88f[_0x8905('0x25')](0x2,_0x58a88f[_0x8905('0x1a')])[_0x8905('0x1c')](','));}else{_0x344f04['push'](_0x58a88f[0x0]);_0x344f04[_0x8905('0x24')](_0x58a88f[_0x8905('0x25')](0x1,_0x58a88f[_0x8905('0x1a')])[_0x8905('0x1c')](','));}break;case'dialogflow':var _0x4f6603=_0x508654[_0x8905('0x20')][_0x8905('0x21')](',');_0x344f04[_0x8905('0x24')](_0x4f6603[0x0]);_0x344f04[_0x8905('0x24')](_0x4f6603[0x1]);_0x344f04[_0x8905('0x24')](_0x4f6603['slice'](0x2,_0x4f6603[_0x8905('0x1a')])[_0x8905('0x1c')](','));break;case _0x8905('0x26'):var _0x2138f0=_0x508654[_0x8905('0x20')]['split'](',');_0x344f04[_0x8905('0x24')](_0x2138f0[0x0]);_0x344f04[_0x8905('0x24')](_0x2138f0[0x1]);_0x344f04[_0x8905('0x24')](_0x2138f0[0x2]);_0x344f04[_0x8905('0x24')](_0x2138f0[0x3]);_0x344f04[_0x8905('0x24')](_0x2138f0[_0x8905('0x25')](0x4,_0x2138f0[_0x8905('0x1a')])[_0x8905('0x1c')](','));break;case'amazonlex':var _0xc6086d=_0x508654[_0x8905('0x20')][_0x8905('0x21')](',');_0x344f04['push'](_0xc6086d[0x0]);_0x344f04['push'](_0xc6086d[0x1]);_0x344f04[_0x8905('0x24')](_0xc6086d[0x2]);_0x344f04[_0x8905('0x24')](_0xc6086d[0x3]);_0x344f04['push'](_0xc6086d[_0x8905('0x25')](0x4,_0xc6086d[_0x8905('0x1a')])[_0x8905('0x1c')](','));break;case _0x8905('0x16'):_0x344f04[_0x8905('0x24')](_0x508654[_0x8905('0x20')]);break;case _0x8905('0x27'):_0x344f04[_0x8905('0x24')](_0x508654[_0x8905('0x28')]);_0x344f04['push'](_0x508654['appdata']);break;default:_0x344f04=_[_0x8905('0xf')](_0x508654['appdata'])?[]:_0x508654[_0x8905('0x20')][_0x8905('0x21')](',');}var _0x5a41df={'id':util['format']('%s:%s:%s',_0x274c35,_0x508654['id'],_0x508654[_0x8905('0x1e')]),'condition':require('./interval')[_0x8905('0x29')](_0x274c35,getIntervals(_0xfe719f['intervals'],_0x508654),_0xfe719f),'consequence':require('./applications/'+_0x508654[_0x8905('0x1e')])[_0x8905('0x2a')](_0x274c35,_0x344f04,_0xfe719f,_0x484fa5),'p':_0x508654['priority']||0x0};logger[_0x8905('0x2b')]('Push\x20new\x20rule',_0x5a41df['id'],_0x8905('0x2c'),getIntervals(_0xfe719f[_0x8905('0x2d')],_0x508654)['join'](_0x8905('0x2e')));_0x1359af[_0x8905('0x24')](_0x5a41df);}else{logger[_0x8905('0x2f')](_0x8905('0x30'),path['join'](__dirname,_0x8905('0x18'),_0x508654['app']+'.js'));}}_0xfe719f['rules'][_0x274c35]=new RuleEngine(_0x1359af);_0xfe719f[_0x8905('0x15')][_0x274c35][_0x8905('0x31')](_0x484fa5,function(_0x51c6d6){logger[_0x8905('0x2b')](_0x8905('0x32'),JSON['stringify'](_0x51c6d6['matchPath']));if(_0xfe719f[_0x8905('0x15')][_0x274c35]){_0xfe719f[_0x8905('0x15')][_0x274c35][_0x8905('0x33')](_0x8905('0x34'));}});return _0x5cf577({'code':0xc8,'message':_0x484fa5});}else{logger[_0x8905('0x2b')](_0x8905('0x35'));return _0x5cf577({'code':0xc8,'message':_0x484fa5});}}catch(_0x3f2b43){logger[_0x8905('0x2f')](_0x3f2b43['stack']);return _0x6c3af1(_0x3258ca[_0x8905('0x2f')](0x1f4,_0x3f2b43));}}return _0x6c3af1(_0x8905('0x36'));});},'AcceptMessage':function(_0xe61f95){var _0x21db37=this;return new Promise(function(_0x3e51e0,_0x2a4063){if(_0xe61f95['agent']&&_0xe61f95[_0x8905('0x37')]['id']){if(_0xfe719f[_0x8905('0x38')][_0xe61f95[_0x8905('0x37')]['id']]){_0xfe719f[_0x8905('0x38')][_0xe61f95[_0x8905('0x37')]['id']][_0x8905('0x39')]=![];_0xfe719f[_0x8905('0x38')][_0xe61f95['agent']['id']][_0x8905('0x3a')]=undefined;}}if(_0xe61f95['message']&&_0xe61f95[_0x8905('0x16')]['id']){try{var _0x390567=getId(_0xe61f95[_0x8905('0x22')],_0xe61f95[_0x8905('0x16')]?_0xe61f95[_0x8905('0x16')]['id']:0x0,_0xe61f95[_0x8905('0x17')]?_0xe61f95[_0x8905('0x17')]['id']:0x0);if(_0xfe719f[_0x8905('0x15')][_0x390567]){_0xfe719f[_0x8905('0x15')][_0x390567][_0x8905('0x33')](_0x8905('0x3b'));if(rpc[_0xe61f95[_0x8905('0x22')]+_0x8905('0x3c')]){rpc[_0xe61f95['channel']+_0x8905('0x3c')]['update'](_0x390567,{'UserId':_0xe61f95[_0x8905('0x16')][_0x8905('0x3d')]})[_0x8905('0x3e')](function(_0x3429ff){logger[_0x8905('0x2f')](_0x8905('0x3f'));});}}return _0x3e51e0({'code':0xc8,'message':_0xe61f95});}catch(_0x5c3cba){logger[_0x8905('0x2f')](_0x5c3cba['stack']);return _0x2a4063(_0x21db37['error'](0x1f4,_0x5c3cba));}}logger[_0x8905('0x2f')](_0x8905('0x40'));return _0x2a4063(_0x21db37['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x46fd5b){var _0x41615d=this;return new Promise(function(_0x2b8650,_0x52dcf1){if(_0x46fd5b[_0x8905('0x37')]&&_0x46fd5b[_0x8905('0x37')]['id']){try{if(_0xfe719f[_0x8905('0x38')][_0x46fd5b['agent']['id']]){_0xfe719f[_0x8905('0x38')][_0x46fd5b['agent']['id']][_0x8905('0x39')]=![];_0xfe719f[_0x8905('0x38')][_0x46fd5b[_0x8905('0x37')]['id']][_0x8905('0x3a')]=undefined;}return _0x2b8650({'code':0xc8,'message':_0x46fd5b});}catch(_0xef0cd5){logger[_0x8905('0x2f')](_0xef0cd5[_0x8905('0x41')]);return _0x52dcf1(_0x41615d['error'](0x1f4,_0xef0cd5));}}logger['error'](_0x8905('0x40'));return _0x52dcf1(_0x41615d[_0x8905('0x2f')](0x1f4,_0x8905('0x40')));});},'AbandonInteraction':function(_0x3c047e){var _0x167fb7=this;return new Promise(function(_0x51fede,_0x2c5a2d){if(_0x3c047e[_0x8905('0x22')]&&_0x3c047e[_0x8905('0x17')]&&_0x3c047e[_0x8905('0x17')]['id']){try{var _0x47eb60=getId(_0x3c047e[_0x8905('0x22')],_0x3c047e[_0x8905('0x16')]?_0x3c047e[_0x8905('0x16')]['id']:0x0,_0x3c047e['interaction']?_0x3c047e['interaction']['id']:0x0);if(_0xfe719f[_0x8905('0x15')][_0x47eb60]){_0xfe719f[_0x8905('0x15')][_0x47eb60][_0x8905('0x33')](_0x8905('0x3b'));}return _0x51fede({'code':0xc8,'message':_0x3c047e});}catch(_0x27b313){logger['error'](_0x27b313[_0x8905('0x41')]);return _0x2c5a2d(_0x167fb7['error'](0x1f4,_0x27b313));}}logger['error'](_0x8905('0x40'));return _0x2c5a2d(_0x167fb7[_0x8905('0x2f')](0x1f4,_0x8905('0x40')));});},'AgentCapacity':function(_0x2d9da1){var _0x5276cd=this;return new Promise(function(_0x4dd044,_0x4f4ba0){if(_0xfe719f['agents'][_0x8905('0x42')](_0x2d9da1['id'])){for(var _0x4d0eb0 in _0x2d9da1[_0x8905('0x43')]){if(_0x2d9da1[_0x8905('0x43')][_0x8905('0x42')](_0x4d0eb0)){if(_0xfe719f[_0x8905('0x38')][_0x2d9da1['id']][_0x8905('0x42')](_0x4d0eb0+_0x8905('0x44'))){_0xfe719f[_0x8905('0x38')][_0x2d9da1['id']][_0x4d0eb0+_0x8905('0x44')]=parseInt(_0x2d9da1['capacity'][_0x4d0eb0],0xa);}}}_0xfe719f[_0x8905('0x38')][_0x2d9da1['id']][_0x8905('0x45')]();return _0x4dd044({'code':0xc8,'message':_0xfe719f['agents'][_0x2d9da1['id']]});}else{return _0x4f4ba0(_0x5276cd[_0x8905('0x2f')](0x1f4,_0x8905('0x46')));}});},'Agents':function(_0x149d12){return new Promise(function(_0x58d769,_0x2c08dd){var _0x58f5a1=_[_0x8905('0x47')](_0xfe719f[_0x8905('0x38')]);_0x58d769({'count':_0x58f5a1[_0x8905('0x1a')],'rows':_0x58f5a1});});},'ChatQueues':function(_0x35efb7){return new Promise(function(_0x153ba8,_0x445c4a){var _0x1d9a30=[];for(var _0x18ccb5 in _0xfe719f[_0x8905('0x48')]){if(_0xfe719f[_0x8905('0x48')][_0x8905('0x42')](_0x18ccb5)){var _0x4e2ddd=_0xfe719f['chatQueues'][_0x18ccb5];var _0x1f3e98={'id':_0x4e2ddd['id'],'available':_0x4e2ddd[_0x8905('0x49')],'loggedIn':_0x4e2ddd[_0x8905('0x4a')],'name':_0x4e2ddd['name'],'paused':_0x4e2ddd[_0x8905('0x4b')],'waiting':_0x4e2ddd[_0x8905('0x4c')]};_0x1d9a30[_0x8905('0x24')](_0x1f3e98);}}_0x153ba8({'count':_0x1d9a30[_0x8905('0x1a')],'rows':_0x1d9a30});});},'MailQueues':function(_0x37346a){return new Promise(function(_0xb67818,_0x21dfe3){var _0x5af991=[];for(var _0x420436 in _0xfe719f[_0x8905('0x4d')]){if(_0xfe719f['mailQueues'][_0x8905('0x42')](_0x420436)){var _0x4188f0=_0xfe719f[_0x8905('0x4d')][_0x420436];var _0x57cbbf={'id':_0x4188f0['id'],'available':_0x4188f0['available'],'loggedIn':_0x4188f0[_0x8905('0x4a')],'name':_0x4188f0[_0x8905('0x4e')],'paused':_0x4188f0['paused'],'waiting':_0x4188f0[_0x8905('0x4c')]};_0x5af991[_0x8905('0x24')](_0x57cbbf);}}_0xb67818({'count':_0x5af991[_0x8905('0x1a')],'rows':_0x5af991});});},'OpenchannelQueues':function(_0x503a6d){return new Promise(function(_0xa66f3b,_0x412357){var _0x110de6=[];for(var _0x500bc8 in _0xfe719f[_0x8905('0x4f')]){if(_0xfe719f[_0x8905('0x4f')]['hasOwnProperty'](_0x500bc8)){var _0x1dbe37=_0xfe719f[_0x8905('0x4f')][_0x500bc8];var _0x54e51e={'id':_0x1dbe37['id'],'available':_0x1dbe37[_0x8905('0x49')],'loggedIn':_0x1dbe37['loggedIn'],'name':_0x1dbe37[_0x8905('0x4e')],'paused':_0x1dbe37[_0x8905('0x4b')],'waiting':_0x1dbe37['waiting']};_0x110de6[_0x8905('0x24')](_0x54e51e);}}_0xa66f3b({'count':_0x110de6[_0x8905('0x1a')],'rows':_0x110de6});});},'SmsQueues':function(_0x3c17ca){return new Promise(function(_0x402486,_0x18720a){var _0x26e12f=[];for(var _0xf2b310 in _0xfe719f['smsQueues']){if(_0xfe719f[_0x8905('0x50')][_0x8905('0x42')](_0xf2b310)){var _0x2ed4fd=_0xfe719f[_0x8905('0x50')][_0xf2b310];var _0x200cbd={'id':_0x2ed4fd['id'],'available':_0x2ed4fd[_0x8905('0x49')],'loggedIn':_0x2ed4fd['loggedIn'],'name':_0x2ed4fd[_0x8905('0x4e')],'paused':_0x2ed4fd[_0x8905('0x4b')],'waiting':_0x2ed4fd['waiting']};_0x26e12f['push'](_0x200cbd);}}_0x402486({'count':_0x26e12f[_0x8905('0x1a')],'rows':_0x26e12f});});},'FaxQueues':function(_0x5b6b6f){return new Promise(function(_0x33560b,_0x189e6a){var _0x42ef2b=[];for(var _0x37b82a in _0xfe719f['faxQueues']){if(_0xfe719f[_0x8905('0x51')][_0x8905('0x42')](_0x37b82a)){var _0x4d98a3=_0xfe719f['faxQueues'][_0x37b82a];var _0x572334={'id':_0x4d98a3['id'],'available':_0x4d98a3[_0x8905('0x49')],'loggedIn':_0x4d98a3[_0x8905('0x4a')],'name':_0x4d98a3[_0x8905('0x4e')],'paused':_0x4d98a3[_0x8905('0x4b')],'waiting':_0x4d98a3[_0x8905('0x4c')]};_0x42ef2b[_0x8905('0x24')](_0x572334);}}_0x33560b({'count':_0x42ef2b['length'],'rows':_0x42ef2b});});},'WhatsappQueues':function(_0x4736d1){return new Promise(function(_0x2ebc39,_0x48b839){var _0x3e9004=[];for(var _0xdccce1 in _0xfe719f[_0x8905('0x52')]){if(_0xfe719f[_0x8905('0x52')]['hasOwnProperty'](_0xdccce1)){var _0x384ece=_0xfe719f[_0x8905('0x52')][_0xdccce1];var _0x2fcc45={'id':_0x384ece['id'],'available':_0x384ece['available'],'loggedIn':_0x384ece[_0x8905('0x4a')],'name':_0x384ece['name'],'paused':_0x384ece['paused'],'waiting':_0x384ece[_0x8905('0x4c')]};_0x3e9004[_0x8905('0x24')](_0x2fcc45);}}_0x2ebc39({'count':_0x3e9004[_0x8905('0x1a')],'rows':_0x3e9004});});},'ChatQueuesWaitingInteractions':function(_0x211d01){return new Promise(function(_0x369f71,_0x52aee1){var _0x5c716b=_[_0x8905('0x47')](_0xfe719f['chatQueuesWaitingInteractions']);_0x369f71({'count':_0x5c716b['length'],'rows':_0x5c716b});});},'MailQueuesWaitingInteractions':function(_0x35d817){return new Promise(function(_0x1e1321,_0x4c2028){var _0x59250b=_[_0x8905('0x47')](_0xfe719f['mailQueuesWaitingInteractions']);_0x1e1321({'count':_0x59250b[_0x8905('0x1a')],'rows':_0x59250b});});},'OpenchannelQueuesWaitingInteractions':function(_0x5bfd8d){return new Promise(function(_0x313097,_0x2f2937){var _0x4d92c1=_['values'](_0xfe719f[_0x8905('0x53')]);_0x313097({'count':_0x4d92c1[_0x8905('0x1a')],'rows':_0x4d92c1});});},'SmsQueuesWaitingInteractions':function(_0x7798a7){return new Promise(function(_0x58fd0d,_0x1d834d){var _0x2c926b=_[_0x8905('0x47')](_0xfe719f[_0x8905('0x54')]);_0x58fd0d({'count':_0x2c926b[_0x8905('0x1a')],'rows':_0x2c926b});});},'FaxQueuesWaitingInteractions':function(_0x213504){return new Promise(function(_0x1fb33b,_0x39f591){var _0x2d55bc=_['values'](_0xfe719f[_0x8905('0x55')]);_0x1fb33b({'count':_0x2d55bc[_0x8905('0x1a')],'rows':_0x2d55bc});});},'WhatsappQueuesWaitingInteractions':function(_0x1d12d9){return new Promise(function(_0x2bfe68,_0x487dff){var _0x5c48b6=_[_0x8905('0x47')](_0xfe719f[_0x8905('0x56')]);_0x2bfe68({'count':_0x5c48b6[_0x8905('0x1a')],'rows':_0x5c48b6});});}};var _0x228f01=jayson[_0x8905('0x57')](_0x51dc0c)['http']();_0x228f01['on'](_0x8905('0x2f'),function(_0x457005){logger['error'](JSON[_0x8905('0x58')](_0x457005));return _0xa3ec98(_0x457005);});_0x228f01['listen'](0x232c,_0x8905('0x59'),function(){console[_0x8905('0x5a')](_0x8905('0x5b'),0x232c);return _0x1e243d(_0x8905('0x5c')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 3c78208..d5c7fd5 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 _0x376b=['[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','http','request','then','error','message','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','format','iftime\x20%s','true','[%s][INTERVAL]\x20%s','some'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x376b,0xcc));var _0xb376=function(_0x5bb360,_0x1bfd48){_0x5bb360=_0x5bb360-0x0;var _0x35a66d=_0x376b[_0x5bb360];return _0x35a66d;};'use strict';var util=require(_0xb376('0x0'));var BPromise=require(_0xb376('0x1'));var jayson=require(_0xb376('0x2'));var _=require(_0xb376('0x3'));var logger=require('../../../config/logger')('routing');var client=jayson['client'][_0xb376('0x4')]({'port':0x232a});function request(_0x10e6e1,_0x3f7f51){return new BPromise(function(_0x1b866f,_0x365d84){return client[_0xb376('0x5')](_0x10e6e1,_0x3f7f51)[_0xb376('0x6')](function(_0x1b499f){if(_0x1b499f['error']){return _0x365d84(_0x1b499f[_0xb376('0x7')][_0xb376('0x8')]);}else{return _0x1b866f(_0x1b499f[_0xb376('0x9')]);}})[_0xb376('0xa')](function(_0x33b40f){return _0x365d84(_0x33b40f);});});}exports[_0xb376('0xb')]=function(_0x3b3167,_0x1df214,_0x178541){return function(_0x2a0c20){if(_0x178541[_0xb376('0xc')]&&!_0x178541['rules'][_0x3b3167]){logger['info'](_0xb376('0xd'),_0x3b3167);return _0x2a0c20[_0xb376('0xe')]();}var _0x4ba15f=[];for(var _0x4e244e=0x0;_0x4e244e<_0x1df214['length'];_0x4e244e+=0x1){_0x4ba15f[_0xb376('0xf')](request('Command',{'command':util[_0xb376('0x10')](_0xb376('0x11'),_0x1df214[_0x4e244e])})['then'](function(_0xacf714){return _0xacf714&&_0xacf714[_0xb376('0x8')]&&_0xacf714[_0xb376('0x8')]['indexOf'](_0xb376('0x12'))>=0x0?!![]:![];})['catch'](function(_0x3931a2){logger[_0xb376('0x7')](_0xb376('0x13'),_0x3b3167,_0x1df214[_0x4e244e]);}));}BPromise['all'](_0x4ba15f)[_0xb376('0x6')](function(_0x50ea7a){var _0x3a58e6=_[_0xb376('0x14')](_0x50ea7a);logger['info'](_0xb376('0x15'),_0x3b3167,_0x1df214[_0xb376('0x16')](_0xb376('0x17')),_0x3a58e6);_0x2a0c20['when'](_0x3a58e6);})[_0xb376('0xa')](function(_0x3236ea){console['log'](_0x3236ea);logger[_0xb376('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x3b3167,_0x1df214[_0xb376('0x16')](_0xb376('0x17')),_0x3236ea[_0xb376('0x18')]);_0x2a0c20['stop']();});};}; \ No newline at end of file +var _0x237c=['when','log','join','\x20|\x20','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','iftime\x20%s','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0x237c,0x109));var _0xc237=function(_0x31c319,_0x23bcd6){_0x31c319=_0x31c319-0x0;var _0x5bb85b=_0x237c[_0x31c319];return _0x5bb85b;};'use strict';var util=require(_0xc237('0x0'));var BPromise=require(_0xc237('0x1'));var jayson=require(_0xc237('0x2'));var _=require(_0xc237('0x3'));var logger=require(_0xc237('0x4'))(_0xc237('0x5'));var client=jayson[_0xc237('0x6')][_0xc237('0x7')]({'port':0x232a});function request(_0x38d70d,_0x57ecf1){return new BPromise(function(_0x25dd49,_0x33b7b1){return client[_0xc237('0x8')](_0x38d70d,_0x57ecf1)[_0xc237('0x9')](function(_0x42cce1){if(_0x42cce1[_0xc237('0xa')]){return _0x33b7b1(_0x42cce1['error'][_0xc237('0xb')]);}else{return _0x25dd49(_0x42cce1[_0xc237('0xc')]);}})[_0xc237('0xd')](function(_0x28fcf9){return _0x33b7b1(_0x28fcf9);});});}exports[_0xc237('0xe')]=function(_0x28cacc,_0x44e3da,_0x4f4212){return function(_0x16e1a0){if(_0x4f4212[_0xc237('0xf')]&&!_0x4f4212['rules'][_0x28cacc]){logger[_0xc237('0x10')](_0xc237('0x11'),_0x28cacc);return _0x16e1a0['stop']();}var _0x15326d=[];for(var _0x4edd58=0x0;_0x4edd58<_0x44e3da[_0xc237('0x12')];_0x4edd58+=0x1){_0x15326d[_0xc237('0x13')](request('Command',{'command':util['format'](_0xc237('0x14'),_0x44e3da[_0x4edd58])})[_0xc237('0x9')](function(_0x7bc7f3){return _0x7bc7f3&&_0x7bc7f3['message']&&_0x7bc7f3[_0xc237('0xb')]['indexOf'](_0xc237('0x15'))>=0x0?!![]:![];})['catch'](function(_0x1e59ae){logger['error'](_0xc237('0x16'),_0x28cacc,_0x44e3da[_0x4edd58]);}));}BPromise[_0xc237('0x17')](_0x15326d)[_0xc237('0x9')](function(_0x26320f){var _0x5dfb2c=_['some'](_0x26320f);logger[_0xc237('0x10')](_0xc237('0x18'),_0x28cacc,_0x44e3da['join']('\x20|\x20'),_0x5dfb2c);_0x16e1a0[_0xc237('0x19')](_0x5dfb2c);})[_0xc237('0xd')](function(_0x59c4cb){console[_0xc237('0x1a')](_0x59c4cb);logger[_0xc237('0xa')](_0xc237('0x18'),_0x28cacc,_0x44e3da[_0xc237('0x1b')](_0xc237('0x1c')),_0x59c4cb['stack']);_0x16e1a0['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 0a87b5d..07b252f 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 _0xb9a7=['connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete','[%s][agents][blindtransfer]','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','transfereeuniqueid','calleridname','agententerreason','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','splice','agentcompleteAt','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','util','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','agentacw','agentcomplete','acwtime','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','format','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','ringtime','talktime','queuecallerabandon','forIn','includes','agentringnoanswerAt','abandoned','holdtime','[%s][agents][queuecallerabandon]','agentconnect','agentconnectAt','connectedlinename'];(function(_0x4ab19e,_0x425483){var _0x3fe3c6=function(_0x31926e){while(--_0x31926e){_0x4ab19e['push'](_0x4ab19e['shift']());}};_0x3fe3c6(++_0x425483);}(_0xb9a7,0x112));var _0x7b9a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xb9a7[_0x1e4360];return _0x31e6b4;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x563857,_0x5f1a52){utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x2'),_0x563857[_0x7b9a('0x3')],_0x563857[_0x7b9a('0x4')],_0x563857[_0x7b9a('0x5')],_0x563857[_0x7b9a('0x6')],_0x563857[_0x7b9a('0x7')],_0x563857[_0x7b9a('0x8')],_0x563857[_0x7b9a('0x9')],_0x563857[_0x7b9a('0xa')]));if(_0x563857[_0x7b9a('0x5')]){utils['getVoiceQueueByName'](_0x563857[_0x7b9a('0x5')])[_0x7b9a('0xb')](function(_0x56a199){if(_0x56a199){_0x563857['type']=_0x56a199['type'];_0x563857[_0x7b9a('0xc')]=_0x563857[_0x7b9a('0xd')]?_0x56a199['acw']:![];_0x563857[_0x7b9a('0xe')]=_0x563857['agentacw']?_0x56a199[_0x7b9a('0xf')]:0x0;}utils['request'](_0x7b9a('0x10'),_0x563857);});}else{utils[_0x7b9a('0x11')](_0x7b9a('0x10'),_0x563857);}if(_0x5f1a52){delete transfers[_0x563857['uniqueid']];}else{delete agents[_0x563857[_0x7b9a('0x12')]];}}exports[_0x7b9a('0x13')]=function(_0x5e3875){try{utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')]('[%s][agents][agentcalled]',_0x5e3875[_0x7b9a('0x3')]),_0x5e3875);agents[_0x5e3875[_0x7b9a('0x12')]]=_0x5e3875;agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0x16')]=utils[_0x7b9a('0x17')]();agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x18');agents[_0x5e3875[_0x7b9a('0x12')]]['connectedlinenum']=null;agents[_0x5e3875[_0x7b9a('0x12')]]['connectedlinename']=null;utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x19'),_0x5e3875[_0x7b9a('0x3')],agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0x6')],_0x5e3875[_0x7b9a('0x12')]));}catch(_0x283cc3){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x1b'),_0x5e3875[_0x7b9a('0x3')]),_0x283cc3);}};exports[_0x7b9a('0x1c')]=function(_0x58aed7){try{if(!_[_0x7b9a('0x1d')](agents[_0x58aed7['destuniqueid']])){utils[_0x7b9a('0x14')](util['format'](_0x7b9a('0x1e'),_0x58aed7[_0x7b9a('0x3')]),_0x58aed7);utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x1f'),_0x58aed7[_0x7b9a('0x3')],agents[_0x58aed7['destuniqueid']][_0x7b9a('0x6')],_0x58aed7[_0x7b9a('0x12')]));agents[_0x58aed7[_0x7b9a('0x12')]][_0x7b9a('0x1c')]=!![];agents[_0x58aed7[_0x7b9a('0x12')]]['agentringnoanswerAt']=utils[_0x7b9a('0x17')]();agents[_0x58aed7[_0x7b9a('0x12')]]['lastevent']=_0x7b9a('0x20');agents[_0x58aed7['destuniqueid']][_0x7b9a('0x21')]=_0x7b9a('0x20');agents[_0x58aed7['destuniqueid']]['holdtime']=_0x58aed7[_0x7b9a('0x22')]?parseInt(_0x58aed7['ringtime'])/0x3e8:0x0;agents[_0x58aed7['destuniqueid']][_0x7b9a('0x23')]=0x0;unanswered['push'](_0x58aed7['destuniqueid']);}}catch(_0x3847b4){utils['error'](util[_0x7b9a('0x15')](_0x7b9a('0x1e'),_0x58aed7['uniqueid']),_0x3847b4);}};exports[_0x7b9a('0x24')]=function(_0x2e6144){try{_[_0x7b9a('0x25')](agents,function(_0x5b64d7,_0x45ccf5){if(_0x5b64d7[_0x7b9a('0x3')]==_0x2e6144[_0x7b9a('0x3')]&&!_[_0x7b9a('0x26')](unanswered,_0x5b64d7[_0x7b9a('0x12')])){utils[_0x7b9a('0x14')](util['format']('[%s][agents][queuecallerabandon]',_0x2e6144[_0x7b9a('0x3')]),_0x2e6144);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2e6144[_0x7b9a('0x3')],_0x5b64d7[_0x7b9a('0x6')],_0x5b64d7['destuniqueid']));_0x5b64d7['agentringnoanswer']=!![];_0x5b64d7[_0x7b9a('0x27')]=utils[_0x7b9a('0x17')]();_0x5b64d7['lastevent']=_0x7b9a('0x28');_0x5b64d7[_0x7b9a('0x21')]=_0x7b9a('0x28');_0x5b64d7[_0x7b9a('0x29')]=_0x2e6144[_0x7b9a('0x29')];_0x5b64d7['talktime']=0x0;writeDB(_0x5b64d7);}});}catch(_0x46bcd0){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x2a'),_0x2e6144[_0x7b9a('0x3')]),_0x46bcd0);}};exports[_0x7b9a('0x2b')]=function(_0x5f1da4){try{if(agents[_0x5f1da4['destuniqueid']]){utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')]('[%s][agents][agentconnect]',_0x5f1da4[_0x7b9a('0x3')]),_0x5f1da4);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x5f1da4[_0x7b9a('0x3')],agents[_0x5f1da4[_0x7b9a('0x12')]]['membername'],_0x5f1da4['destuniqueid']));agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x2c')]=utils[_0x7b9a('0x17')]();agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x9')]=_0x5f1da4[_0x7b9a('0x9')];agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x2d')]=_0x5f1da4['connectedlinename'];agents[_0x5f1da4[_0x7b9a('0x12')]]['holdtime']=_0x5f1da4[_0x7b9a('0x22')];agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x2e');_[_0x7b9a('0x25')](agents,function(_0x89951b,_0x5e504f){if(_0x89951b[_0x7b9a('0x12')]!=_0x5f1da4[_0x7b9a('0x12')]&&_0x89951b[_0x7b9a('0x3')]==_0x5f1da4[_0x7b9a('0x3')]){_0x89951b['talktime']=0x0;_0x89951b[_0x7b9a('0x29')]=_0x5f1da4[_0x7b9a('0x22')];_0x89951b[_0x7b9a('0x1c')]=!![];_0x89951b[_0x7b9a('0x27')]=utils['now']();_0x89951b[_0x7b9a('0xa')]='answered_elsewhere';_0x89951b[_0x7b9a('0x21')]=_0x7b9a('0x2f');_0x89951b[_0x7b9a('0x30')]=_0x5f1da4[_0x7b9a('0x12')];_0x89951b[_0x7b9a('0x31')]=_0x5f1da4[_0x7b9a('0x6')];writeDB(_0x89951b);}});}}catch(_0x56e274){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x32'),_0x5f1da4['uniqueid']),_0x56e274);}};exports['agentcomplete']=function(_0x3724fe){try{if(!_[_0x7b9a('0x1d')](agents[_0x3724fe[_0x7b9a('0x12')]])){utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')](_0x7b9a('0x33'),_0x3724fe['uniqueid']),_0x3724fe);utils['info'](util['format'](_0x7b9a('0x34'),_0x3724fe[_0x7b9a('0x3')],agents[_0x3724fe['destuniqueid']][_0x7b9a('0x6')],_0x3724fe[_0x7b9a('0x12')]));agents[_0x3724fe[_0x7b9a('0x12')]]['agentcomplete']=!![];agents[_0x3724fe[_0x7b9a('0x12')]]['agentcompleteAt']=utils[_0x7b9a('0x17')]();agents[_0x3724fe[_0x7b9a('0x12')]][_0x7b9a('0x23')]=utils[_0x7b9a('0x35')](agents[_0x3724fe[_0x7b9a('0x12')]]['agentcompleteAt'],agents[_0x3724fe[_0x7b9a('0x12')]]['agentconnectAt']);agents[_0x3724fe[_0x7b9a('0x12')]]['reason']=_0x3724fe['reason'];agents[_0x3724fe[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x36');writeDB(agents[_0x3724fe[_0x7b9a('0x12')]]);}}catch(_0x1cbd5a){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x33'),_0x3724fe[_0x7b9a('0x3')]),_0x1cbd5a);}};exports['blindtransfer']=function(_0x1d7957){try{if(!_[_0x7b9a('0x1d')](agents[_0x1d7957['transfereruniqueid']])){utils['debug'](util['format'](_0x7b9a('0x37'),_0x1d7957[_0x7b9a('0x3')]),_0x1d7957);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x1d7957[_0x7b9a('0x3')],agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x6')],agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3')]));agents[_0x1d7957['transfereruniqueid']][_0x7b9a('0x39')]=!![];agents[_0x1d7957['transfereruniqueid']][_0x7b9a('0x3a')]=_0x7b9a('0x3b');agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3c')]=_0x1d7957['extension'];agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3d')]=agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3')];}}catch(_0x2b0db5){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')]('[%s][agents][blindtransfer]',_0x1d7957['uniqueid']),_0x2b0db5);}};exports['attendedtransfer']=function(_0x12c5bf){try{utils[_0x7b9a('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x12c5bf['origtransfereruniqueid']),_0x12c5bf);if(_0x12c5bf['origtransfereruniqueid']==_0x12c5bf[_0x7b9a('0x3e')]){if(!_[_0x7b9a('0x1d')](agents[_0x12c5bf[_0x7b9a('0x3f')]])){utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x40'),_0x12c5bf[_0x7b9a('0x41')],agents[_0x12c5bf[_0x7b9a('0x3f')]]['membername']));agents[_0x12c5bf[_0x7b9a('0x3f')]]['transfer']=!![];agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x3a')]=_0x7b9a('0x42');agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x3c')]=_0x12c5bf['origtransfererexten'];agents[_0x12c5bf[_0x7b9a('0x3f')]]['transferuniqueid']=_0x12c5bf[_0x7b9a('0x41')];}if(_0x12c5bf[_0x7b9a('0x43')]&&agents[_0x12c5bf[_0x7b9a('0x43')]]){agents[_0x12c5bf['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x12c5bf['transfereeuniqueid']]=_['clone'](agents[_0x12c5bf[_0x7b9a('0x43')]]);transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x8')]=agents[_0x12c5bf['secondtransfereruniqueid']][_0x7b9a('0x8')];transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x44')]=agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x44')];transfers[_0x12c5bf['transfereeuniqueid']][_0x7b9a('0x16')]=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf[_0x7b9a('0x43')]]['agentconnectAt']=utils['now']();transfers[_0x12c5bf['transfereeuniqueid']][_0x7b9a('0x29')]=0x0;transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x45')]=0x2;}}else if(_0x12c5bf['secondtransfereruniqueid']==_0x12c5bf[_0x7b9a('0x46')]){if(!_[_0x7b9a('0x1d')](agents[_0x12c5bf['origtransfereruniqueid']])){utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x40'),_0x12c5bf['origtransfereruniqueid'],agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x6')]));agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x39')]=!![];agents[_0x12c5bf['origtransfereruniqueid']][_0x7b9a('0x3a')]=_0x7b9a('0x42');agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x3c')]=_0x12c5bf['secondtransfererexten'];agents[_0x12c5bf[_0x7b9a('0x41')]]['transferuniqueid']=_0x12c5bf[_0x7b9a('0x3f')];}if(_0x12c5bf['transfertargetuniqueid']&&agents[_0x12c5bf[_0x7b9a('0x47')]]){agents[_0x12c5bf['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x12c5bf['transfertargetuniqueid']]=_['clone'](agents[_0x12c5bf[_0x7b9a('0x47')]]);transfers[_0x12c5bf[_0x7b9a('0x47')]][_0x7b9a('0x8')]=agents[_0x12c5bf[_0x7b9a('0x41')]]['calleridnum'];transfers[_0x12c5bf[_0x7b9a('0x47')]]['calleridname']=agents[_0x12c5bf['origtransfereruniqueid']][_0x7b9a('0x44')];transfers[_0x12c5bf['transfertargetuniqueid']]['agentcalledAt']=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf[_0x7b9a('0x47')]]['agentconnectAt']=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf['transfertargetuniqueid']][_0x7b9a('0x29')]=0x0;transfers[_0x12c5bf[_0x7b9a('0x47')]][_0x7b9a('0x45')]=0x2;}}}catch(_0x5118b3){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0x12c5bf[_0x7b9a('0x41')]),_0x5118b3);}};exports[_0x7b9a('0x48')]=function(_0x3fd697){try{utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')](_0x7b9a('0x49'),_0x3fd697[_0x7b9a('0x3')]),_0x3fd697);if(agents[_0x3fd697['uniqueid']]&&agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]==='timeout'){if(_0x3fd697[_0x7b9a('0x4a')]==='21'){agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]='rejected';agents[_0x3fd697['uniqueid']][_0x7b9a('0xa')]=_0x7b9a('0x4b');}utils['info'](util[_0x7b9a('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3fd697[_0x7b9a('0x3')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x6')],agents[_0x3fd697['uniqueid']][_0x7b9a('0x21')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]));writeDB(agents[_0x3fd697[_0x7b9a('0x3')]]);var _0x2090ef=unanswered['indexOf'](_0x3fd697['uniqueid']);if(_0x2090ef>-0x1){unanswered[_0x7b9a('0x4c')](_0x2090ef,0x1);}}if(transfers[_0x3fd697[_0x7b9a('0x3')]]){transfers[_0x3fd697['uniqueid']][_0x7b9a('0xd')]=!![];transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')]=utils['now']();transfers[_0x3fd697['uniqueid']][_0x7b9a('0x23')]=utils[_0x7b9a('0x35')](transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')],transfers[_0x3fd697['uniqueid']][_0x7b9a('0x2c')]);transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]='agent';transfers[_0x3fd697['uniqueid']][_0x7b9a('0xa')]=_0x7b9a('0x36');utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3fd697[_0x7b9a('0x3')],transfers[_0x3fd697[_0x7b9a('0x3')]]['membername'],transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')],transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]));writeDB(transfers[_0x3fd697[_0x7b9a('0x3')]],!![]);}if(agents[_0x3fd697[_0x7b9a('0x3')]]&&agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x2c')]){agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xd')]=!![];agents[_0x3fd697[_0x7b9a('0x3')]]['agentcompleteAt']=utils['now']();agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x23')]=utils['diffTime'](agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')],agents[_0x3fd697['uniqueid']][_0x7b9a('0x2c')]);agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]=agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x39')]?_0x7b9a('0x39'):_0x7b9a('0x4e');agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]='complete';utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x4f'),_0x3fd697[_0x7b9a('0x3')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x6')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')],agents[_0x3fd697['uniqueid']][_0x7b9a('0xa')]));writeDB(agents[_0x3fd697[_0x7b9a('0x3')]]);}}catch(_0x3022e0){utils['error'](util[_0x7b9a('0x15')](_0x7b9a('0x49'),_0x3fd697[_0x7b9a('0x3')]),_0x3022e0);}}; \ No newline at end of file +var _0x0713=['cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','./utils','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','destuniqueid','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','forIn','includes','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','[%s][agents][agentcomplete]','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]'];(function(_0x1aea01,_0x738e1a){var _0x3ead21=function(_0x3a39fb){while(--_0x3a39fb){_0x1aea01['push'](_0x1aea01['shift']());}};_0x3ead21(++_0x738e1a);}(_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 utils=require(_0x3071('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2afa91,_0x27405a){utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2afa91[_0x3071('0x3')],_0x2afa91[_0x3071('0x4')],_0x2afa91[_0x3071('0x5')],_0x2afa91[_0x3071('0x6')],_0x2afa91[_0x3071('0x7')],_0x2afa91[_0x3071('0x8')],_0x2afa91[_0x3071('0x9')],_0x2afa91[_0x3071('0xa')]));if(_0x2afa91[_0x3071('0x5')]){utils[_0x3071('0xb')](_0x2afa91[_0x3071('0x5')])[_0x3071('0xc')](function(_0x1a868e){if(_0x1a868e){_0x2afa91['type']=_0x1a868e[_0x3071('0xd')];_0x2afa91[_0x3071('0xe')]=_0x2afa91[_0x3071('0xf')]?_0x1a868e[_0x3071('0x10')]:![];_0x2afa91[_0x3071('0x11')]=_0x2afa91['agentacw']?_0x1a868e[_0x3071('0x12')]:0x0;}utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);});}else{utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);}if(_0x27405a){delete transfers[_0x2afa91['uniqueid']];}else{delete agents[_0x2afa91['destuniqueid']];}}exports[_0x3071('0x15')]=function(_0x5dc13b){try{utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][agentcalled]',_0x5dc13b[_0x3071('0x3')]),_0x5dc13b);agents[_0x5dc13b['destuniqueid']]=_0x5dc13b;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x18')]=utils[_0x3071('0x19')]();agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x1a');agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x9')]=null;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x1b')]=null;utils['info'](util[_0x3071('0x2')](_0x3071('0x1c'),_0x5dc13b[_0x3071('0x3')],agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x6')],_0x5dc13b[_0x3071('0x17')]));}catch(_0x105bbb){utils[_0x3071('0x1d')](util['format'](_0x3071('0x1e'),_0x5dc13b[_0x3071('0x3')]),_0x105bbb);}};exports[_0x3071('0x1f')]=function(_0x56c267){try{if(!_[_0x3071('0x20')](agents[_0x56c267['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x56c267);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x22'),_0x56c267[_0x3071('0x3')],agents[_0x56c267['destuniqueid']]['membername'],_0x56c267[_0x3071('0x17')]));agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x1f')]=!![];agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x23')]=utils[_0x3071('0x19')]();agents[_0x56c267[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x24');agents[_0x56c267['destuniqueid']][_0x3071('0x25')]=_0x3071('0x24');agents[_0x56c267[_0x3071('0x17')]]['holdtime']=_0x56c267[_0x3071('0x26')]?parseInt(_0x56c267[_0x3071('0x26')])/0x3e8:0x0;agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x27')]=0x0;unanswered[_0x3071('0x28')](_0x56c267[_0x3071('0x17')]);}}catch(_0x177b5f){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x177b5f);}};exports['queuecallerabandon']=function(_0x4f1484){try{_[_0x3071('0x29')](agents,function(_0x149e0d,_0x6ddf96){if(_0x149e0d[_0x3071('0x3')]==_0x4f1484[_0x3071('0x3')]&&!_[_0x3071('0x2a')](unanswered,_0x149e0d[_0x3071('0x17')])){utils[_0x3071('0x16')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484['uniqueid']),_0x4f1484);utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4f1484[_0x3071('0x3')],_0x149e0d[_0x3071('0x6')],_0x149e0d[_0x3071('0x17')]));_0x149e0d[_0x3071('0x1f')]=!![];_0x149e0d['agentringnoanswerAt']=utils[_0x3071('0x19')]();_0x149e0d[_0x3071('0xa')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x25')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x2c')]=_0x4f1484[_0x3071('0x2c')];_0x149e0d[_0x3071('0x27')]=0x0;writeDB(_0x149e0d);}});}catch(_0x596cc3){utils[_0x3071('0x1d')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484[_0x3071('0x3')]),_0x596cc3);}};exports[_0x3071('0x2d')]=function(_0x54d9c3){try{if(agents[_0x54d9c3[_0x3071('0x17')]]){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x54d9c3);utils[_0x3071('0x1')](util['format'](_0x3071('0x2f'),_0x54d9c3[_0x3071('0x3')],agents[_0x54d9c3['destuniqueid']][_0x3071('0x6')],_0x54d9c3['destuniqueid']));agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0x30')]=utils['now']();agents[_0x54d9c3['destuniqueid']][_0x3071('0x9')]=_0x54d9c3[_0x3071('0x9')];agents[_0x54d9c3[_0x3071('0x17')]]['connectedlinename']=_0x54d9c3[_0x3071('0x1b')];agents[_0x54d9c3['destuniqueid']][_0x3071('0x2c')]=_0x54d9c3['ringtime'];agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x31');_[_0x3071('0x29')](agents,function(_0x30ab68,_0x593c9c){if(_0x30ab68['destuniqueid']!=_0x54d9c3[_0x3071('0x17')]&&_0x30ab68[_0x3071('0x3')]==_0x54d9c3[_0x3071('0x3')]){_0x30ab68[_0x3071('0x27')]=0x0;_0x30ab68['holdtime']=_0x54d9c3[_0x3071('0x26')];_0x30ab68[_0x3071('0x1f')]=!![];_0x30ab68[_0x3071('0x23')]=utils[_0x3071('0x19')]();_0x30ab68[_0x3071('0xa')]=_0x3071('0x32');_0x30ab68['reason']=_0x3071('0x32');_0x30ab68['answeredelsewheredestinationuniqueid']=_0x54d9c3['destuniqueid'];_0x30ab68['answeredelsewheremembername']=_0x54d9c3['membername'];writeDB(_0x30ab68);}});}}catch(_0x2992e6){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x2992e6);}};exports[_0x3071('0xf')]=function(_0xa711b5){try{if(!_[_0x3071('0x20')](agents[_0xa711b5['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x33'),_0xa711b5[_0x3071('0x3')]),_0xa711b5);utils[_0x3071('0x1')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xa711b5[_0x3071('0x3')],agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x6')],_0xa711b5[_0x3071('0x17')]));agents[_0xa711b5[_0x3071('0x17')]]['agentcomplete']=!![];agents[_0xa711b5[_0x3071('0x17')]]['agentcompleteAt']=utils[_0x3071('0x19')]();agents[_0xa711b5['destuniqueid']]['talktime']=utils[_0x3071('0x34')](agents[_0xa711b5['destuniqueid']][_0x3071('0x35')],agents[_0xa711b5['destuniqueid']][_0x3071('0x30')]);agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x25')]=_0xa711b5[_0x3071('0x25')];agents[_0xa711b5['destuniqueid']][_0x3071('0xa')]='complete';writeDB(agents[_0xa711b5[_0x3071('0x17')]]);}}catch(_0x4b6bbb){utils[_0x3071('0x1d')](util[_0x3071('0x2')]('[%s][agents][agentcomplete]',_0xa711b5[_0x3071('0x3')]),_0x4b6bbb);}};exports[_0x3071('0x36')]=function(_0x224a70){try{if(!_[_0x3071('0x20')](agents[_0x224a70[_0x3071('0x37')]])){utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x224a70);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x38'),_0x224a70['uniqueid'],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x6')],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')]));agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x39')]=!![];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3a')]=_0x3071('0x3b');agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3c')]=_0x224a70[_0x3071('0x3d')];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3e')]=agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')];}}catch(_0x596cdd){utils['error'](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x596cdd);}};exports[_0x3071('0x3f')]=function(_0x15c6f8){try{utils['debug'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x15c6f8);if(_0x15c6f8['origtransfereruniqueid']==_0x15c6f8[_0x3071('0x41')]){if(!_[_0x3071('0x20')](agents[_0x15c6f8[_0x3071('0x42')]])){utils[_0x3071('0x1')](util['format'](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x42')]]['transfer']=!![];agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3a')]=_0x3071('0x45');agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x46')];agents[_0x15c6f8[_0x3071('0x42')]]['transferuniqueid']=_0x15c6f8['origtransfereruniqueid'];}if(_0x15c6f8[_0x3071('0x47')]&&agents[_0x15c6f8['transfereeuniqueid']]){agents[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x1;transfers[_0x15c6f8['transfereeuniqueid']]=_[_0x3071('0x49')](agents[_0x15c6f8[_0x3071('0x47')]]);transfers[_0x15c6f8['transfereeuniqueid']][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x8')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x4a')]=agents[_0x15c6f8['secondtransfereruniqueid']][_0x3071('0x4a')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x18')]=utils['now']();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x2;}}else if(_0x15c6f8[_0x3071('0x42')]==_0x15c6f8[_0x3071('0x4b')]){if(!_['isNil'](agents[_0x15c6f8[_0x3071('0x44')]])){utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x39')]=!![];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3a')]='ATTENDED';agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x4c')];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3e')]=_0x15c6f8[_0x3071('0x42')];}if(_0x15c6f8[_0x3071('0x4d')]&&agents[_0x15c6f8[_0x3071('0x4d')]]){agents[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x48')]=0x1;transfers[_0x15c6f8[_0x3071('0x4d')]]=_['clone'](agents[_0x15c6f8['transfertargetuniqueid']]);transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x8')];transfers[_0x15c6f8['transfertargetuniqueid']]['calleridname']=agents[_0x15c6f8[_0x3071('0x44')]]['calleridname'];transfers[_0x15c6f8['transfertargetuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x48')]=0x2;}}}catch(_0x19a03d){utils['error'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x19a03d);}};exports[_0x3071('0x4e')]=function(_0x29ee70){try{utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70[_0x3071('0x3')]),_0x29ee70);if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']]['reason']===_0x3071('0x24')){if(_0x29ee70[_0x3071('0x50')]==='21'){agents[_0x29ee70[_0x3071('0x3')]]['reason']='rejected';agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x51');}utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]]['membername'],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);var _0x2fbac7=unanswered[_0x3071('0x53')](_0x29ee70[_0x3071('0x3')]);if(_0x2fbac7>-0x1){unanswered[_0x3071('0x54')](_0x2fbac7,0x1);}}if(transfers[_0x29ee70[_0x3071('0x3')]]){transfers[_0x29ee70['uniqueid']][_0x3071('0xf')]=!![];transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils['now']();transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](transfers[_0x29ee70['uniqueid']]['agentcompleteAt'],transfers[_0x29ee70[_0x3071('0x3')]]['agentconnectAt']);transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')]=_0x3071('0x55');transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x56');utils[_0x3071('0x1')](util['format'](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(transfers[_0x29ee70['uniqueid']],!![]);}if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']][_0x3071('0x30')]){agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xf')]=!![];agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils[_0x3071('0x19')]();agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](agents[_0x29ee70[_0x3071('0x3')]]['agentcompleteAt'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x30')]);agents[_0x29ee70['uniqueid']][_0x3071('0x25')]=agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x39')]?_0x3071('0x39'):_0x3071('0x55');agents[_0x29ee70['uniqueid']]['lastevent']=_0x3071('0x56');utils['info'](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);}}catch(_0x291bb9){utils['error'](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70['uniqueid']),_0x291bb9);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 15086d6..aeb9781 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 _0x2df0=['noop','gotoif','application','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','lastevent','getUserByInternal','accountcode','then','request','CreateVoiceCallReport','newchannel','debug','linkedid','channel','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','now','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','set','toLowerCase','substring','lastIndexOf','includes'];(function(_0xdaf2cc,_0x21434b){var _0x1c5e61=function(_0x23a186){while(--_0x23a186){_0xdaf2cc['push'](_0xdaf2cc['shift']());}};_0x1c5e61(++_0x21434b);}(_0x2df0,0xcf));var _0x02df=function(_0x45a19a,_0x406fea){_0x45a19a=_0x45a19a-0x0;var _0x1bae6a=_0x2df0[_0x45a19a];return _0x1bae6a;};'use strict';var _=require(_0x02df('0x0'));var util=require(_0x02df('0x1'));var utils=require(_0x02df('0x2'));var transfers=require(_0x02df('0x3'));var dispositions=[_0x02df('0x4'),_0x02df('0x5'),'FAILED',_0x02df('0x4'),_0x02df('0x4'),_0x02df('0x4'),_0x02df('0x6'),_0x02df('0x7'),_0x02df('0x5'),_0x02df('0x5'),'FAILED'];var channels={};function writeDB(_0x2591ff){var _0x2c38d3;if(transfers[_0x02df('0x8')][_0x2591ff[_0x02df('0x9')]]){_0x2c38d3=_0x2591ff[_0x02df('0x9')];_0x2591ff[_0x02df('0x9')]=transfers[_0x02df('0x8')][_0x2591ff[_0x02df('0x9')]][_0x02df('0xa')];}utils[_0x02df('0xb')](util[_0x02df('0xc')](_0x02df('0xd'),_0x2591ff[_0x02df('0x9')],_0x2591ff['channel'],_0x2591ff[_0x02df('0xe')],_0x2591ff[_0x02df('0xf')],_0x2591ff[_0x02df('0x10')],_0x2591ff[_0x02df('0x11')],_0x2591ff['connectedlinenum'],_0x2591ff[_0x02df('0x12')]));if(_0x2591ff['accountcode']){utils[_0x02df('0x13')](_0x2591ff[_0x02df('0x14')])[_0x02df('0x15')](function(_0x1856e1){if(_0x1856e1){_0x2591ff['UserId']=_0x1856e1['id'];}utils[_0x02df('0x16')]('CreateVoiceCallReport',_0x2591ff);});}else{utils['request'](_0x02df('0x17'),_0x2591ff);}if(channels[_0x2591ff[_0x02df('0x9')]]){delete channels[_0x2591ff[_0x02df('0x9')]];}else if(_0x2c38d3&&channels[_0x2c38d3]){delete transfers[_0x02df('0x8')][_0x2c38d3];delete channels[_0x2c38d3];}}exports[_0x02df('0x18')]=function(_0x3cc850){try{utils[_0x02df('0x19')](util[_0x02df('0xc')]('[%s][calls][newchannel]',_0x3cc850[_0x02df('0x9')]),_0x3cc850);if(_0x3cc850[_0x02df('0x9')]==_0x3cc850[_0x02df('0x1a')]&&_0x3cc850[_0x02df('0x1b')]!='OutgoingSpoolFailed'){utils[_0x02df('0xb')](util[_0x02df('0xc')](_0x02df('0x1c'),_0x3cc850[_0x02df('0x9')],_0x3cc850[_0x02df('0x1d')],_0x3cc850['exten']));channels[_0x3cc850[_0x02df('0x9')]]={'uniqueid':_0x3cc850[_0x02df('0x9')],'accountcode':_0x3cc850['accountcode'],'source':_0x3cc850[_0x02df('0x11')],'destination':_0x3cc850['exten'],'destinationcontext':_0x3cc850['context'],'channel':_0x3cc850['channel'],'starttime':utils[_0x02df('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x02df('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x33dd51){utils['error'](util['format']('[%s][calls][newchannel]',_0x3cc850[_0x02df('0x9')]),_0x33dd51);}};exports['newstate']=function(_0x43826b){try{utils[_0x02df('0x19')](util[_0x02df('0xc')](_0x02df('0x1f'),_0x43826b[_0x02df('0x9')]),_0x43826b);if(!_[_0x02df('0x20')](channels[_0x43826b[_0x02df('0x9')]])&&_0x43826b[_0x02df('0x21')]==0x6){utils[_0x02df('0xb')](util[_0x02df('0xc')](_0x02df('0x22'),_0x43826b[_0x02df('0x9')],_0x43826b[_0x02df('0x1d')],_0x43826b[_0x02df('0x1b')]));if(_[_0x02df('0x20')](channels[_0x43826b[_0x02df('0x9')]][_0x02df('0x23')])){channels[_0x43826b[_0x02df('0x9')]][_0x02df('0x23')]=utils[_0x02df('0x1e')]();}}else if(!_[_0x02df('0x20')](channels[_0x43826b['linkedid']])&&_0x43826b['channelstate']==0x6&&_0x43826b[_0x02df('0x1d')]!=_0x02df('0x24')){utils[_0x02df('0xb')](util['format'](_0x02df('0x25'),_0x43826b['uniqueid'],_0x43826b['linkedid'],_0x43826b[_0x02df('0x1d')],_0x43826b[_0x02df('0x1b')]));channels[_0x43826b[_0x02df('0x1a')]][_0x02df('0x14')]=_0x43826b['accountcode'];channels[_0x43826b[_0x02df('0x1a')]][_0x02df('0x26')]=_0x43826b[_0x02df('0x1b')];if(_[_0x02df('0x20')](channels[_0x43826b[_0x02df('0x1a')]][_0x02df('0x27')])){channels[_0x43826b[_0x02df('0x1a')]][_0x02df('0x27')]=utils[_0x02df('0x1e')]();}channels[_0x43826b['linkedid']]['disposition']=dispositions[_[_0x02df('0x28')](_0x43826b[_0x02df('0x21')])]||'ANSWERED';}}catch(_0x5e23d8){utils[_0x02df('0x29')](util[_0x02df('0xc')](_0x02df('0x1f'),_0x43826b['uniqueid']),_0x5e23d8);}};exports[_0x02df('0x2a')]=function(_0x77ed00){try{if(!_[_0x02df('0x20')](channels[_0x77ed00[_0x02df('0x9')]])){utils[_0x02df('0x19')](util[_0x02df('0xc')](_0x02df('0x2b'),_0x77ed00[_0x02df('0x9')]),_0x77ed00);if(_['isNil'](channels[_0x77ed00[_0x02df('0x9')]][_0x02df('0x2c')])){channels[_0x77ed00[_0x02df('0x9')]]['callerid']=_0x77ed00[_0x02df('0x2d')]+'\x20<'+_0x77ed00['calleridnum']+'>';}utils['info'](util['format'](_0x02df('0x2e'),_0x77ed00[_0x02df('0x9')],channels[_0x77ed00[_0x02df('0x9')]][_0x02df('0x2c')],_0x77ed00[_0x02df('0x2f')]));channels[_0x77ed00[_0x02df('0x9')]]['endtime']=utils[_0x02df('0x1e')]();channels[_0x77ed00[_0x02df('0x9')]]['duration']=utils[_0x02df('0x30')](channels[_0x77ed00[_0x02df('0x9')]][_0x02df('0x31')],channels[_0x77ed00['uniqueid']][_0x02df('0x32')]);channels[_0x77ed00[_0x02df('0x9')]][_0x02df('0x33')]=channels[_0x77ed00[_0x02df('0x9')]][_0x02df('0x27')]?utils['diffTime'](channels[_0x77ed00['uniqueid']][_0x02df('0x31')],channels[_0x77ed00[_0x02df('0x9')]][_0x02df('0x27')]):0x0;writeDB(channels[_0x77ed00[_0x02df('0x9')]]);}}catch(_0x7fd9){utils[_0x02df('0x29')](util[_0x02df('0xc')](_0x02df('0x2b'),_0x77ed00[_0x02df('0x9')]),_0x7fd9);}};exports[_0x02df('0x34')]=function(_0x1c822a){try{if(!_[_0x02df('0x20')](channels[_0x1c822a[_0x02df('0x35')]])){utils[_0x02df('0x19')](util[_0x02df('0xc')](_0x02df('0x36'),_0x1c822a[_0x02df('0x37')]),_0x1c822a);if(channels[_0x1c822a[_0x02df('0x35')]][_0x02df('0x1b')]==_0x1c822a[_0x02df('0x38')]){utils[_0x02df('0xb')](util[_0x02df('0xc')](_0x02df('0x39'),_0x1c822a[_0x02df('0x37')],_0x1c822a[_0x02df('0x35')],_0x1c822a[_0x02df('0x3a')]));channels[_0x1c822a['localtwolinkedid']][_0x02df('0x26')]=_0x1c822a[_0x02df('0x3a')];channels[_0x1c822a[_0x02df('0x35')]][_0x02df('0x3b')]=_0x02df('0x3c');}else if(channels[_0x1c822a[_0x02df('0x35')]][_0x02df('0x1b')]=_0x1c822a[_0x02df('0x3d')]){utils[_0x02df('0xb')](util['format'](_0x02df('0x39'),_0x1c822a[_0x02df('0x37')],_0x1c822a['localtwolinkedid'],_0x1c822a['origtransfererchannel']));channels[_0x1c822a[_0x02df('0x35')]]['destinationchannel']=_0x1c822a['origtransfererchannel'];channels[_0x1c822a[_0x02df('0x35')]][_0x02df('0x3b')]=_0x02df('0x3c');}}}catch(_0x190941){utils[_0x02df('0x29')](util[_0x02df('0xc')](_0x02df('0x36'),_0x1c822a[_0x02df('0x37')]),_0x190941);}};exports['musiconholdstart']=function(_0x10cf27){try{if(!_[_0x02df('0x20')](channels[_0x10cf27[_0x02df('0x9')]])){utils[_0x02df('0x19')](util[_0x02df('0xc')](_0x02df('0x3e'),_0x10cf27['uniqueid']),_0x10cf27);channels[_0x10cf27['uniqueid']][_0x02df('0x3f')]=utils[_0x02df('0x1e')]();utils[_0x02df('0xb')](util[_0x02df('0xc')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x10cf27[_0x02df('0x9')],channels[_0x10cf27[_0x02df('0x9')]][_0x02df('0x3f')]));}}catch(_0x520aec){utils['error'](util[_0x02df('0xc')]('[%s][calls][musiconholdstart]',_0x10cf27[_0x02df('0x9')]),_0x520aec);}};exports[_0x02df('0x40')]=function(_0x57ac9a){try{if(!_['isNil'](channels[_0x57ac9a[_0x02df('0x9')]])){utils[_0x02df('0x19')](util['format'](_0x02df('0x41'),_0x57ac9a[_0x02df('0x9')]),_0x57ac9a);if(!_['isNil'](channels[_0x57ac9a[_0x02df('0x9')]][_0x02df('0x3f')])){channels[_0x57ac9a[_0x02df('0x9')]][_0x02df('0x42')]+=utils[_0x02df('0x30')](utils[_0x02df('0x1e')](),channels[_0x57ac9a[_0x02df('0x9')]][_0x02df('0x3f')]);utils[_0x02df('0xb')](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x57ac9a[_0x02df('0x9')],channels[_0x57ac9a[_0x02df('0x9')]]['mohtime']));delete channels[_0x57ac9a['uniqueid']]['musiconholdstartAt'];}}}catch(_0x7dff56){utils[_0x02df('0x29')](util[_0x02df('0xc')](_0x02df('0x41'),_0x57ac9a[_0x02df('0x9')]),_0x7dff56);}};exports[_0x02df('0x43')]=function(_0x206522){try{if(!_[_0x02df('0x20')](channels[_0x206522[_0x02df('0x9')]])){utils[_0x02df('0x19')](util[_0x02df('0xc')](_0x02df('0x44'),_0x206522[_0x02df('0x9')]),_0x206522);if(!_[_0x02df('0x20')](_0x206522[_0x02df('0x45')]['xmd-originatecalleridnum'])){utils[_0x02df('0xb')](util[_0x02df('0xc')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x206522[_0x02df('0x9')],_0x206522[_0x02df('0x46')]));channels[_0x206522['uniqueid']][_0x02df('0x47')]=_0x206522[_0x02df('0x46')];}if(!_[_0x02df('0x20')](_0x206522['variable'][_0x02df('0x48')])){utils[_0x02df('0xb')](util[_0x02df('0xc')](_0x02df('0x49'),_0x206522[_0x02df('0x9')],_0x206522['value']));channels[_0x206522['uniqueid']]['destination']=_0x206522[_0x02df('0x46')];channels[_0x206522[_0x02df('0x9')]][_0x02df('0x2c')]='\x22'+_0x206522[_0x02df('0x46')]+'\x22\x20<'+_0x206522[_0x02df('0x46')]+'>';}if(!_[_0x02df('0x20')](_0x206522[_0x02df('0x45')][_0x02df('0x4a')])||!_[_0x02df('0x20')](_0x206522[_0x02df('0x45')][_0x02df('0x4b')])){utils[_0x02df('0xb')](util[_0x02df('0xc')](_0x02df('0x4c'),_0x206522[_0x02df('0x9')],!_[_0x02df('0x20')](_0x206522[_0x02df('0x45')][_0x02df('0x4a')])?'xmd-callerid-preview':_0x02df('0x4b'),_0x206522[_0x02df('0x46')]));channels[_0x206522[_0x02df('0x9')]][_0x02df('0x2c')]=_0x206522[_0x02df('0x46')];}if(!_[_0x02df('0x20')](_0x206522[_0x02df('0x45')]['xmd-queue'])||!_[_0x02df('0x20')](_0x206522['variable'][_0x02df('0x4d')])){utils[_0x02df('0xb')](util[_0x02df('0xc')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x206522['uniqueid'],!_[_0x02df('0x20')](_0x206522[_0x02df('0x45')][_0x02df('0x4e')])?_0x02df('0x4e'):_0x02df('0x4d'),_0x206522['value']));channels[_0x206522['uniqueid']][_0x02df('0x4f')]=_0x02df('0x50');channels[_0x206522[_0x02df('0x9')]][_0x02df('0x51')]=_0x206522['value'];channels[_0x206522['uniqueid']]['queue']=!![];}if(!_['isNil'](_0x206522[_0x02df('0x45')]['xmd-contactid'])){utils[_0x02df('0xb')](util[_0x02df('0xc')](_0x02df('0x52'),_0x206522[_0x02df('0x9')],_0x206522[_0x02df('0x46')]));channels[_0x206522[_0x02df('0x9')]][_0x02df('0x53')]=_0x206522[_0x02df('0x46')];}if(!_['isNil'](_0x206522[_0x02df('0x45')][_0x02df('0x54')])){utils['info'](util[_0x02df('0xc')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x206522['uniqueid'],_0x206522[_0x02df('0x46')]));channels[_0x206522[_0x02df('0x9')]][_0x02df('0x55')]=_0x206522[_0x02df('0x46')];}if(!_[_0x02df('0x20')](_0x206522[_0x02df('0x45')]['outboundrouteid'])){utils[_0x02df('0xb')](util[_0x02df('0xc')](_0x02df('0x56'),_0x206522[_0x02df('0x9')],_0x206522['value']));channels[_0x206522['uniqueid']][_0x02df('0x57')]=_0x206522[_0x02df('0x46')];}if(!_['isNil'](_0x206522['variable'][_0x02df('0x58')])){utils[_0x02df('0xb')](util[_0x02df('0xc')](_0x02df('0x59'),_0x206522[_0x02df('0x9')],_0x206522[_0x02df('0x46')]));channels[_0x206522['uniqueid']][_0x02df('0x58')]=_0x206522[_0x02df('0x46')];}}}catch(_0x95708){utils[_0x02df('0x29')](util[_0x02df('0xc')](_0x02df('0x44'),_0x206522['uniqueid']),_0x95708);}};exports[_0x02df('0x5a')]=function(_0x56c98c){try{if(!_[_0x02df('0x20')](channels[_0x56c98c['uniqueid']])){utils[_0x02df('0x19')](util['format'](_0x02df('0x5b'),_0x56c98c[_0x02df('0x9')]),_0x56c98c);utils['info'](util[_0x02df('0xc')](_0x02df('0x5c'),_0x56c98c[_0x02df('0x9')],_0x56c98c['application'],_0x56c98c[_0x02df('0x5d')]));if(_0x56c98c['application']['toLowerCase']()==_0x02df('0x5e')&&_['startsWith'](_0x56c98c[_0x02df('0x5d')][_0x02df('0x5f')](),'cdr')){var _0x2791b9=_0x56c98c[_0x02df('0x5d')]['split']('=');var _0x472154=_0x2791b9[0x0][_0x02df('0x60')](_0x2791b9[0x0][_0x02df('0x61')]('(')+0x1,_0x2791b9[0x0][_0x02df('0x61')](')'));var _0x279818=_0x2791b9[0x1];channels[_0x56c98c[_0x02df('0x9')]][_0x472154]=_0x279818;}if(!_[_0x02df('0x62')](['hangup',_0x02df('0x63'),'execif',_0x02df('0x5e'),_0x02df('0x64')],_0x56c98c[_0x02df('0x65')][_0x02df('0x5f')]())){channels[_0x56c98c['uniqueid']][_0x02df('0x4f')]=_0x56c98c['application'];channels[_0x56c98c[_0x02df('0x9')]]['lastdata']=_0x56c98c['appdata'];}}}catch(_0x2e95e5){utils[_0x02df('0x29')](util['format']('[%s][calls][newexten]',_0x56c98c[_0x02df('0x9')]),_0x2e95e5);}}; \ No newline at end of file +var _0xe4e0=['appdata','cdr','split','lastIndexOf','includes','noop','execif','gotoif','lodash','./utils','./transfers.controller','NO\x20ANSWER','BUSY','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','channel','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','disposition','toNumber','ANSWERED','hangup','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','answertime','error','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','destinationchannel','musiconholdstart','debug','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith'];(function(_0x34bff6,_0x36f01d){var _0x2704ee=function(_0x2fea17){while(--_0x2fea17){_0x34bff6['push'](_0x34bff6['shift']());}};_0x2704ee(++_0x36f01d);}(_0xe4e0,0x79));var _0x0e4e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe4e0[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x0e4e('0x0'));var util=require('util');var utils=require(_0x0e4e('0x1'));var transfers=require(_0x0e4e('0x2'));var dispositions=[_0x0e4e('0x3'),'FAILED','FAILED',_0x0e4e('0x3'),_0x0e4e('0x3'),_0x0e4e('0x3'),'ANSWERED',_0x0e4e('0x4'),_0x0e4e('0x5'),_0x0e4e('0x5'),'FAILED'];var channels={};function writeDB(_0x25d354){var _0x41cdf7;if(transfers[_0x0e4e('0x6')][_0x25d354[_0x0e4e('0x7')]]){_0x41cdf7=_0x25d354['uniqueid'];_0x25d354[_0x0e4e('0x7')]=transfers[_0x0e4e('0x6')][_0x25d354['uniqueid']][_0x0e4e('0x8')];}utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x25d354['uniqueid'],_0x25d354[_0x0e4e('0xb')],_0x25d354[_0x0e4e('0xc')],_0x25d354['membername'],_0x25d354[_0x0e4e('0xd')],_0x25d354[_0x0e4e('0xe')],_0x25d354[_0x0e4e('0xf')],_0x25d354[_0x0e4e('0x10')]));if(_0x25d354[_0x0e4e('0x11')]){utils[_0x0e4e('0x12')](_0x25d354[_0x0e4e('0x11')])[_0x0e4e('0x13')](function(_0x535692){if(_0x535692){_0x25d354['UserId']=_0x535692['id'];}utils[_0x0e4e('0x14')](_0x0e4e('0x15'),_0x25d354);});}else{utils['request']('CreateVoiceCallReport',_0x25d354);}if(channels[_0x25d354[_0x0e4e('0x7')]]){delete channels[_0x25d354[_0x0e4e('0x7')]];}else if(_0x41cdf7&&channels[_0x41cdf7]){delete transfers[_0x0e4e('0x6')][_0x41cdf7];delete channels[_0x41cdf7];}}exports[_0x0e4e('0x16')]=function(_0x42c94d){try{utils['debug'](util[_0x0e4e('0xa')](_0x0e4e('0x17'),_0x42c94d[_0x0e4e('0x7')]),_0x42c94d);if(_0x42c94d[_0x0e4e('0x7')]==_0x42c94d[_0x0e4e('0x18')]&&_0x42c94d[_0x0e4e('0xb')]!=_0x0e4e('0x19')){utils['info'](util['format'](_0x0e4e('0x1a'),_0x42c94d['uniqueid'],_0x42c94d['context'],_0x42c94d[_0x0e4e('0x1b')]));channels[_0x42c94d[_0x0e4e('0x7')]]={'uniqueid':_0x42c94d[_0x0e4e('0x7')],'accountcode':_0x42c94d[_0x0e4e('0x11')],'source':_0x42c94d['calleridnum'],'destination':_0x42c94d[_0x0e4e('0x1b')],'destinationcontext':_0x42c94d[_0x0e4e('0x1c')],'channel':_0x42c94d[_0x0e4e('0xb')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x0e4e('0x3'),'amaflags':_0x0e4e('0x1d')};}}catch(_0x3d540c){utils['error'](util[_0x0e4e('0xa')](_0x0e4e('0x17'),_0x42c94d[_0x0e4e('0x7')]),_0x3d540c);}};exports[_0x0e4e('0x1e')]=function(_0x5dc3b3){try{utils['debug'](util[_0x0e4e('0xa')](_0x0e4e('0x1f'),_0x5dc3b3['uniqueid']),_0x5dc3b3);if(!_[_0x0e4e('0x20')](channels[_0x5dc3b3[_0x0e4e('0x7')]])&&_0x5dc3b3[_0x0e4e('0x21')]==0x6){utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')](_0x0e4e('0x22'),_0x5dc3b3[_0x0e4e('0x7')],_0x5dc3b3['context'],_0x5dc3b3[_0x0e4e('0xb')]));if(_[_0x0e4e('0x20')](channels[_0x5dc3b3['uniqueid']]['systemanswertime'])){channels[_0x5dc3b3[_0x0e4e('0x7')]][_0x0e4e('0x23')]=utils[_0x0e4e('0x24')]();}}else if(!_['isNil'](channels[_0x5dc3b3[_0x0e4e('0x18')]])&&_0x5dc3b3[_0x0e4e('0x21')]==0x6&&_0x5dc3b3[_0x0e4e('0x1c')]!=_0x0e4e('0x25')){utils['info'](util[_0x0e4e('0xa')](_0x0e4e('0x26'),_0x5dc3b3['uniqueid'],_0x5dc3b3[_0x0e4e('0x18')],_0x5dc3b3[_0x0e4e('0x1c')],_0x5dc3b3[_0x0e4e('0xb')]));channels[_0x5dc3b3[_0x0e4e('0x18')]][_0x0e4e('0x11')]=_0x5dc3b3['accountcode'];channels[_0x5dc3b3[_0x0e4e('0x18')]]['destinationchannel']=_0x5dc3b3[_0x0e4e('0xb')];if(_[_0x0e4e('0x20')](channels[_0x5dc3b3[_0x0e4e('0x18')]]['answertime'])){channels[_0x5dc3b3['linkedid']]['answertime']=utils[_0x0e4e('0x24')]();}channels[_0x5dc3b3[_0x0e4e('0x18')]][_0x0e4e('0x27')]=dispositions[_[_0x0e4e('0x28')](_0x5dc3b3[_0x0e4e('0x21')])]||_0x0e4e('0x29');}}catch(_0x4d7aeb){utils['error'](util[_0x0e4e('0xa')]('[%s][calls][newstate]',_0x5dc3b3[_0x0e4e('0x7')]),_0x4d7aeb);}};exports[_0x0e4e('0x2a')]=function(_0x3f1509){try{if(!_[_0x0e4e('0x20')](channels[_0x3f1509[_0x0e4e('0x7')]])){utils['debug'](util[_0x0e4e('0xa')]('[%s][calls][hangup]',_0x3f1509[_0x0e4e('0x7')]),_0x3f1509);if(_[_0x0e4e('0x20')](channels[_0x3f1509[_0x0e4e('0x7')]][_0x0e4e('0x2b')])){channels[_0x3f1509[_0x0e4e('0x7')]][_0x0e4e('0x2b')]=_0x3f1509[_0x0e4e('0x2c')]+'\x20<'+_0x3f1509[_0x0e4e('0xe')]+'>';}utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x3f1509[_0x0e4e('0x7')],channels[_0x3f1509['uniqueid']][_0x0e4e('0x2b')],_0x3f1509[_0x0e4e('0x2d')]));channels[_0x3f1509[_0x0e4e('0x7')]][_0x0e4e('0x2e')]=utils[_0x0e4e('0x24')]();channels[_0x3f1509[_0x0e4e('0x7')]][_0x0e4e('0x2f')]=utils[_0x0e4e('0x30')](channels[_0x3f1509[_0x0e4e('0x7')]][_0x0e4e('0x2e')],channels[_0x3f1509['uniqueid']][_0x0e4e('0x31')]);channels[_0x3f1509['uniqueid']]['billableseconds']=channels[_0x3f1509['uniqueid']][_0x0e4e('0x32')]?utils[_0x0e4e('0x30')](channels[_0x3f1509['uniqueid']][_0x0e4e('0x2e')],channels[_0x3f1509[_0x0e4e('0x7')]][_0x0e4e('0x32')]):0x0;writeDB(channels[_0x3f1509[_0x0e4e('0x7')]]);}}catch(_0x6a89fd){utils[_0x0e4e('0x33')](util[_0x0e4e('0xa')](_0x0e4e('0x34'),_0x3f1509[_0x0e4e('0x7')]),_0x6a89fd);}};exports[_0x0e4e('0x35')]=function(_0x2b0590){try{if(!_['isNil'](channels[_0x2b0590[_0x0e4e('0x36')]])){utils['debug'](util['format'](_0x0e4e('0x37'),_0x2b0590[_0x0e4e('0x38')]),_0x2b0590);if(channels[_0x2b0590[_0x0e4e('0x36')]][_0x0e4e('0xb')]==_0x2b0590['transfereechannel']){utils[_0x0e4e('0x9')](util['format'](_0x0e4e('0x39'),_0x2b0590[_0x0e4e('0x38')],_0x2b0590[_0x0e4e('0x36')],_0x2b0590[_0x0e4e('0x3a')]));channels[_0x2b0590[_0x0e4e('0x36')]]['destinationchannel']=_0x2b0590[_0x0e4e('0x3a')];channels[_0x2b0590[_0x0e4e('0x36')]][_0x0e4e('0x3b')]=_0x0e4e('0x3c');}else if(channels[_0x2b0590[_0x0e4e('0x36')]][_0x0e4e('0xb')]=_0x2b0590[_0x0e4e('0x3d')]){utils['info'](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x2b0590[_0x0e4e('0x38')],_0x2b0590[_0x0e4e('0x36')],_0x2b0590[_0x0e4e('0x3e')]));channels[_0x2b0590[_0x0e4e('0x36')]][_0x0e4e('0x3f')]=_0x2b0590[_0x0e4e('0x3e')];channels[_0x2b0590[_0x0e4e('0x36')]][_0x0e4e('0x3b')]=_0x0e4e('0x3c');}}}catch(_0x507ca2){utils[_0x0e4e('0x33')](util['format'](_0x0e4e('0x37'),_0x2b0590[_0x0e4e('0x38')]),_0x507ca2);}};exports[_0x0e4e('0x40')]=function(_0x2ebc24){try{if(!_['isNil'](channels[_0x2ebc24[_0x0e4e('0x7')]])){utils[_0x0e4e('0x41')](util[_0x0e4e('0xa')](_0x0e4e('0x42'),_0x2ebc24[_0x0e4e('0x7')]),_0x2ebc24);channels[_0x2ebc24[_0x0e4e('0x7')]][_0x0e4e('0x43')]=utils[_0x0e4e('0x24')]();utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')](_0x0e4e('0x44'),_0x2ebc24[_0x0e4e('0x7')],channels[_0x2ebc24[_0x0e4e('0x7')]][_0x0e4e('0x43')]));}}catch(_0xcb343f){utils['error'](util[_0x0e4e('0xa')](_0x0e4e('0x42'),_0x2ebc24['uniqueid']),_0xcb343f);}};exports[_0x0e4e('0x45')]=function(_0x7f42f8){try{if(!_['isNil'](channels[_0x7f42f8['uniqueid']])){utils['debug'](util['format'](_0x0e4e('0x46'),_0x7f42f8['uniqueid']),_0x7f42f8);if(!_['isNil'](channels[_0x7f42f8[_0x0e4e('0x7')]]['musiconholdstartAt'])){channels[_0x7f42f8[_0x0e4e('0x7')]][_0x0e4e('0x47')]+=utils[_0x0e4e('0x30')](utils['now'](),channels[_0x7f42f8[_0x0e4e('0x7')]][_0x0e4e('0x43')]);utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x7f42f8[_0x0e4e('0x7')],channels[_0x7f42f8['uniqueid']][_0x0e4e('0x47')]));delete channels[_0x7f42f8[_0x0e4e('0x7')]][_0x0e4e('0x43')];}}}catch(_0x1c112e){utils[_0x0e4e('0x33')](util['format'](_0x0e4e('0x46'),_0x7f42f8[_0x0e4e('0x7')]),_0x1c112e);}};exports['varset']=function(_0x27f95d){try{if(!_[_0x0e4e('0x20')](channels[_0x27f95d[_0x0e4e('0x7')]])){utils['debug'](util[_0x0e4e('0xa')]('[%s][calls][varset]',_0x27f95d[_0x0e4e('0x7')]),_0x27f95d);if(!_[_0x0e4e('0x20')](_0x27f95d['variable'][_0x0e4e('0x48')])){utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')](_0x0e4e('0x49'),_0x27f95d[_0x0e4e('0x7')],_0x27f95d[_0x0e4e('0x4a')]));channels[_0x27f95d['uniqueid']][_0x0e4e('0x4b')]=_0x27f95d[_0x0e4e('0x4a')];}if(!_['isNil'](_0x27f95d[_0x0e4e('0x4c')]['xmd-phone'])){utils['info'](util[_0x0e4e('0xa')](_0x0e4e('0x4d'),_0x27f95d[_0x0e4e('0x7')],_0x27f95d[_0x0e4e('0x4a')]));channels[_0x27f95d['uniqueid']][_0x0e4e('0x4e')]=_0x27f95d[_0x0e4e('0x4a')];channels[_0x27f95d[_0x0e4e('0x7')]]['callerid']='\x22'+_0x27f95d[_0x0e4e('0x4a')]+_0x0e4e('0x4f')+_0x27f95d[_0x0e4e('0x4a')]+'>';}if(!_[_0x0e4e('0x20')](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x50')])||!_['isNil'](_0x27f95d[_0x0e4e('0x4c')]['xmd-callerid'])){utils[_0x0e4e('0x9')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x27f95d[_0x0e4e('0x7')],!_[_0x0e4e('0x20')](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x50')])?_0x0e4e('0x50'):_0x0e4e('0x51'),_0x27f95d[_0x0e4e('0x4a')]));channels[_0x27f95d[_0x0e4e('0x7')]][_0x0e4e('0x2b')]=_0x27f95d['value'];}if(!_['isNil'](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x52')])||!_['isNil'](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x53')])){utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')](_0x0e4e('0x54'),_0x27f95d[_0x0e4e('0x7')],!_[_0x0e4e('0x20')](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x52')])?_0x0e4e('0x52'):_0x0e4e('0x53'),_0x27f95d[_0x0e4e('0x4a')]));channels[_0x27f95d[_0x0e4e('0x7')]][_0x0e4e('0x55')]=_0x0e4e('0x56');channels[_0x27f95d['uniqueid']][_0x0e4e('0x57')]=_0x27f95d[_0x0e4e('0x4a')];channels[_0x27f95d[_0x0e4e('0x7')]][_0x0e4e('0xc')]=!![];}if(!_[_0x0e4e('0x20')](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x58')])){utils['info'](util[_0x0e4e('0xa')](_0x0e4e('0x59'),_0x27f95d[_0x0e4e('0x7')],_0x27f95d[_0x0e4e('0x4a')]));channels[_0x27f95d[_0x0e4e('0x7')]]['ContactId']=_0x27f95d[_0x0e4e('0x4a')];}if(!_[_0x0e4e('0x20')](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x5a')])){utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')](_0x0e4e('0x5b'),_0x27f95d[_0x0e4e('0x7')],_0x27f95d['value']));channels[_0x27f95d[_0x0e4e('0x7')]][_0x0e4e('0x5c')]=_0x27f95d[_0x0e4e('0x4a')];}if(!_['isNil'](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x5d')])){utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')](_0x0e4e('0x5e'),_0x27f95d[_0x0e4e('0x7')],_0x27f95d['value']));channels[_0x27f95d[_0x0e4e('0x7')]][_0x0e4e('0x5f')]=_0x27f95d[_0x0e4e('0x4a')];}if(!_[_0x0e4e('0x20')](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x60')])){utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')](_0x0e4e('0x61'),_0x27f95d[_0x0e4e('0x7')],_0x27f95d['value']));channels[_0x27f95d[_0x0e4e('0x7')]][_0x0e4e('0x60')]=_0x27f95d[_0x0e4e('0x4a')];}}}catch(_0x5548b0){utils[_0x0e4e('0x33')](util[_0x0e4e('0xa')]('[%s][calls][varset]',_0x27f95d[_0x0e4e('0x7')]),_0x5548b0);}};exports[_0x0e4e('0x62')]=function(_0x31270b){try{if(!_[_0x0e4e('0x20')](channels[_0x31270b['uniqueid']])){utils[_0x0e4e('0x41')](util[_0x0e4e('0xa')](_0x0e4e('0x63'),_0x31270b[_0x0e4e('0x7')]),_0x31270b);utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')](_0x0e4e('0x64'),_0x31270b[_0x0e4e('0x7')],_0x31270b[_0x0e4e('0x65')],_0x31270b['appdata']));if(_0x31270b['application'][_0x0e4e('0x66')]()==_0x0e4e('0x67')&&_[_0x0e4e('0x68')](_0x31270b[_0x0e4e('0x69')][_0x0e4e('0x66')](),_0x0e4e('0x6a'))){var _0x522293=_0x31270b[_0x0e4e('0x69')][_0x0e4e('0x6b')]('=');var _0xe20207=_0x522293[0x0]['substring'](_0x522293[0x0][_0x0e4e('0x6c')]('(')+0x1,_0x522293[0x0][_0x0e4e('0x6c')](')'));var _0x1eba73=_0x522293[0x1];channels[_0x31270b[_0x0e4e('0x7')]][_0xe20207]=_0x1eba73;}if(!_[_0x0e4e('0x6d')]([_0x0e4e('0x2a'),_0x0e4e('0x6e'),_0x0e4e('0x6f'),_0x0e4e('0x67'),_0x0e4e('0x70')],_0x31270b['application'][_0x0e4e('0x66')]())){channels[_0x31270b[_0x0e4e('0x7')]][_0x0e4e('0x55')]=_0x31270b['application'];channels[_0x31270b[_0x0e4e('0x7')]][_0x0e4e('0x57')]=_0x31270b[_0x0e4e('0x69')];}}}catch(_0x10512b){utils['error'](util['format'](_0x0e4e('0x63'),_0x31270b[_0x0e4e('0x7')]),_0x10512b);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 8928c38..31152f1 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 _0xac16=['connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent','./utils'];(function(_0x135519,_0x5b15e0){var _0x35ca15=function(_0x535ec4){while(--_0x535ec4){_0x135519['push'](_0x135519['shift']());}};_0x35ca15(++_0x5b15e0);}(_0xac16,0x9b));var _0x6ac1=function(_0xc02ec6,_0x1b5624){_0xc02ec6=_0xc02ec6-0x0;var _0x763503=_0xac16[_0xc02ec6];return _0x763503;};'use strict';var utils=require(_0x6ac1('0x0'));exports[_0x6ac1('0x1')]=function(){utils[_0x6ac1('0x2')](_0x6ac1('0x3'));};exports[_0x6ac1('0x4')]=function(){utils[_0x6ac1('0x2')](_0x6ac1('0x5'));};exports[_0x6ac1('0x6')]=function(){utils[_0x6ac1('0x2')](_0x6ac1('0x7'));};exports[_0x6ac1('0x8')]=function(_0x29486b){utils[_0x6ac1('0x8')]('[core]\x20error',_0x29486b);};exports[_0x6ac1('0x9')]=function(){utils[_0x6ac1('0x2')](_0x6ac1('0xa'));};exports[_0x6ac1('0xb')]=function(_0xb7b3bb){}; \ No newline at end of file +var _0xde02=['[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x493bda,_0x3f74d9){var _0x19e839=function(_0x166f67){while(--_0x166f67){_0x493bda['push'](_0x493bda['shift']());}};_0x19e839(++_0x3f74d9);}(_0xde02,0xd5));var _0x2de0=function(_0x1877de,_0x38d29b){_0x1877de=_0x1877de-0x0;var _0x32b37d=_0xde02[_0x1877de];return _0x32b37d;};'use strict';var utils=require(_0x2de0('0x0'));exports[_0x2de0('0x1')]=function(){utils[_0x2de0('0x2')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0x2de0('0x2')](_0x2de0('0x3'));};exports[_0x2de0('0x4')]=function(){utils['info'](_0x2de0('0x5'));};exports[_0x2de0('0x6')]=function(_0x34f414){utils[_0x2de0('0x6')](_0x2de0('0x7'),_0x34f414);};exports[_0x2de0('0x8')]=function(){utils[_0x2de0('0x2')](_0x2de0('0x9'));};exports[_0x2de0('0xa')]=function(_0x3eee21){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 04e3f9e..f70b781 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 _0x2a0b=['holdtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','set','startsWith','toLowerCase','cdr(routeid)','split','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','duration','diffTime','endtime'];(function(_0x31b138,_0x14a43a){var _0xb8ee67=function(_0x58f495){while(--_0x58f495){_0x31b138['push'](_0x31b138['shift']());}};_0xb8ee67(++_0x14a43a);}(_0x2a0b,0x16e));var _0xb2a0=function(_0x4cc590,_0x5d2536){_0x4cc590=_0x4cc590-0x0;var _0x8ca0fd=_0x2a0b[_0x4cc590];return _0x8ca0fd;};'use strict';var _=require(_0xb2a0('0x0'));var util=require(_0xb2a0('0x1'));var utils=require(_0xb2a0('0x2'));var dials={};function writeDB(_0x3d57b6){utils[_0xb2a0('0x3')](util[_0xb2a0('0x4')](_0xb2a0('0x5'),_0x3d57b6[_0xb2a0('0x6')],_0x3d57b6[_0xb2a0('0x7')],_0x3d57b6[_0xb2a0('0x8')],_0x3d57b6['calleridnum'],_0x3d57b6[_0xb2a0('0x9')],_0x3d57b6[_0xb2a0('0xa')]));utils[_0xb2a0('0xb')](_0xb2a0('0xc'),_0x3d57b6);delete dials[_0x3d57b6['uniqueid']];}exports[_0xb2a0('0xd')]=function(_0xaa102e){try{utils[_0xb2a0('0xe')](util[_0xb2a0('0x4')](_0xb2a0('0xf'),_0xaa102e[_0xb2a0('0x6')]),_0xaa102e);utils[_0xb2a0('0x3')](util[_0xb2a0('0x4')](_0xb2a0('0x10'),_0xaa102e[_0xb2a0('0x6')],_0xaa102e['application'],_0xaa102e[_0xb2a0('0x11')]));if(_0xaa102e['application']['toLowerCase']()==_0xb2a0('0x12')&&_[_0xb2a0('0x13')](_0xaa102e[_0xb2a0('0x11')][_0xb2a0('0x14')](),_0xb2a0('0x15'))){var _0x3c9e34=_0xaa102e[_0xb2a0('0x11')][_0xb2a0('0x16')]('=');dials[_0xaa102e['uniqueid']]={'routeId':_0x3c9e34[0x1]};}}catch(_0x556b7b){utils['error'](util['format']('[%s][dials][newexten]',_0xaa102e[_0xb2a0('0x6')]),_0x556b7b);}};exports[_0xb2a0('0x17')]=function(_0x40953b){try{utils[_0xb2a0('0xe')](util[_0xb2a0('0x4')](_0xb2a0('0x18'),_0x40953b[_0xb2a0('0x6')]),_0x40953b);if(!_[_0xb2a0('0x19')](_0x40953b[_0xb2a0('0x1a')]['outboundrouteid'])){utils[_0xb2a0('0x3')](util[_0xb2a0('0x4')](_0xb2a0('0x1b'),_0x40953b[_0xb2a0('0x6')],_0x40953b[_0xb2a0('0x1c')]));dials[_0x40953b['uniqueid']]={'routeId':_0x40953b['value']};}}catch(_0x2b0574){utils[_0xb2a0('0x1d')](util[_0xb2a0('0x4')](_0xb2a0('0x18'),_0x40953b[_0xb2a0('0x6')]),_0x2b0574);}};exports['dialbegin']=function(_0x46d6df){try{if(!_[_0xb2a0('0x19')](dials[_0x46d6df['uniqueid']])){utils[_0xb2a0('0xe')](util[_0xb2a0('0x4')](_0xb2a0('0x1e'),_0x46d6df[_0xb2a0('0x6')]),_0x46d6df);dials[_0x46d6df[_0xb2a0('0x6')]]=_[_0xb2a0('0x1f')](dials[_0x46d6df[_0xb2a0('0x6')]],_0x46d6df);dials[_0x46d6df['uniqueid']]['starttime']=utils[_0xb2a0('0x20')]();dials[_0x46d6df[_0xb2a0('0x6')]][_0xb2a0('0x21')]=_0xb2a0('0x22');utils[_0xb2a0('0x3')](util[_0xb2a0('0x4')](_0xb2a0('0x23'),_0x46d6df[_0xb2a0('0x6')],dials[_0x46d6df[_0xb2a0('0x6')]][_0xb2a0('0x24')]));}}catch(_0x534cb1){utils[_0xb2a0('0x1d')](util['format'](_0xb2a0('0x1e'),_0x46d6df[_0xb2a0('0x6')]),_0x534cb1);}};exports[_0xb2a0('0x25')]=function(_0x292b85){try{if(!_['isNil'](dials[_0x292b85[_0xb2a0('0x6')]])){utils['debug'](util[_0xb2a0('0x4')](_0xb2a0('0x26'),_0x292b85[_0xb2a0('0x6')]),_0x292b85);dials[_0x292b85[_0xb2a0('0x6')]]['dialstatus']=_0x292b85[_0xb2a0('0xa')];if(_0x292b85['dialstatus']=='ANSWER'){dials[_0x292b85['uniqueid']]=_[_0xb2a0('0x1f')](dials[_0x292b85['uniqueid']],_0x292b85);dials[_0x292b85[_0xb2a0('0x6')]]['answertime']=utils[_0xb2a0('0x20')]();dials[_0x292b85['uniqueid']]['lastevent']=_0xb2a0('0x27');utils[_0xb2a0('0x3')](util[_0xb2a0('0x4')](_0xb2a0('0x28'),_0x292b85[_0xb2a0('0x6')],_0x292b85[_0xb2a0('0xa')],dials[_0x292b85[_0xb2a0('0x6')]][_0xb2a0('0x29')]));}else{utils['info'](util[_0xb2a0('0x4')](_0xb2a0('0x2a'),_0x292b85[_0xb2a0('0x6')],_0x292b85[_0xb2a0('0xa')]));}}}catch(_0x152a51){utils[_0xb2a0('0x1d')](util['format'](_0xb2a0('0x26'),_0x292b85[_0xb2a0('0x6')]),_0x152a51);}};exports[_0xb2a0('0x2b')]=function(_0xa1c409){try{if(!_[_0xb2a0('0x19')](dials[_0xa1c409['uniqueid']])){utils[_0xb2a0('0xe')](util[_0xb2a0('0x4')](_0xb2a0('0x2c'),_0xa1c409[_0xb2a0('0x6')]),_0xa1c409);utils[_0xb2a0('0x3')](util[_0xb2a0('0x4')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0xa1c409[_0xb2a0('0x6')],_0xa1c409['calleridnum'],_0xa1c409[_0xb2a0('0x2d')],_0xa1c409[_0xb2a0('0x2e')]));dials[_0xa1c409[_0xb2a0('0x6')]]=_[_0xb2a0('0x1f')](dials[_0xa1c409[_0xb2a0('0x6')]],{'endtime':utils[_0xb2a0('0x20')](),'lastevent':'complete'});dials[_0xa1c409[_0xb2a0('0x6')]][_0xb2a0('0x2f')]=utils[_0xb2a0('0x30')](dials[_0xa1c409[_0xb2a0('0x6')]][_0xb2a0('0x31')],dials[_0xa1c409['uniqueid']][_0xb2a0('0x24')]);dials[_0xa1c409[_0xb2a0('0x6')]][_0xb2a0('0x32')]=utils[_0xb2a0('0x30')](dials[_0xa1c409[_0xb2a0('0x6')]][_0xb2a0('0x29')]||dials[_0xa1c409[_0xb2a0('0x6')]][_0xb2a0('0x31')],dials[_0xa1c409[_0xb2a0('0x6')]]['starttime']);dials[_0xa1c409['uniqueid']][_0xb2a0('0x33')]=dials[_0xa1c409['uniqueid']]['answertime']?utils[_0xb2a0('0x30')](dials[_0xa1c409['uniqueid']][_0xb2a0('0x31')],dials[_0xa1c409['uniqueid']][_0xb2a0('0x29')]):0x0;writeDB(dials[_0xa1c409[_0xb2a0('0x6')]]);}}catch(_0x3472cc){utils['error'](util[_0xb2a0('0x4')](_0xb2a0('0x2c'),_0xa1c409[_0xb2a0('0x6')]),_0x3472cc);}}; \ No newline at end of file +var _0x8149=['[%s][dials][hangup]','cause-txt','duration','endtime','holdtime','diffTime','billableseconds','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','application','appdata','toLowerCase','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s'];(function(_0x1be0f3,_0x34ee94){var _0x5e331b=function(_0x2627dd){while(--_0x2627dd){_0x1be0f3['push'](_0x1be0f3['shift']());}};_0x5e331b(++_0x34ee94);}(_0x8149,0x17f));var _0x9814=function(_0x4048c2,_0x4abba8){_0x4048c2=_0x4048c2-0x0;var _0x1b58ee=_0x8149[_0x4048c2];return _0x1b58ee;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x9814('0x0'));var dials={};function writeDB(_0x4bbd8c){utils[_0x9814('0x1')](util[_0x9814('0x2')](_0x9814('0x3'),_0x4bbd8c[_0x9814('0x4')],_0x4bbd8c[_0x9814('0x5')],_0x4bbd8c[_0x9814('0x6')],_0x4bbd8c[_0x9814('0x7')],_0x4bbd8c[_0x9814('0x8')],_0x4bbd8c['dialstatus']));utils[_0x9814('0x9')](_0x9814('0xa'),_0x4bbd8c);delete dials[_0x4bbd8c[_0x9814('0x4')]];}exports[_0x9814('0xb')]=function(_0x184be8){try{utils[_0x9814('0xc')](util['format'](_0x9814('0xd'),_0x184be8['uniqueid']),_0x184be8);utils['info'](util[_0x9814('0x2')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x184be8['uniqueid'],_0x184be8[_0x9814('0xe')],_0x184be8['appdata']));if(_0x184be8[_0x9814('0xe')]['toLowerCase']()=='set'&&_['startsWith'](_0x184be8[_0x9814('0xf')][_0x9814('0x10')](),_0x9814('0x11'))){var _0x1abb30=_0x184be8[_0x9814('0xf')][_0x9814('0x12')]('=');dials[_0x184be8[_0x9814('0x4')]]={'routeId':_0x1abb30[0x1]};}}catch(_0x5193c3){utils[_0x9814('0x13')](util['format'](_0x9814('0xd'),_0x184be8['uniqueid']),_0x5193c3);}};exports[_0x9814('0x14')]=function(_0x3b8079){try{utils[_0x9814('0xc')](util[_0x9814('0x2')](_0x9814('0x15'),_0x3b8079[_0x9814('0x4')]),_0x3b8079);if(!_[_0x9814('0x16')](_0x3b8079[_0x9814('0x17')]['outboundrouteid'])){utils[_0x9814('0x1')](util[_0x9814('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x3b8079['uniqueid'],_0x3b8079['value']));dials[_0x3b8079[_0x9814('0x4')]]={'routeId':_0x3b8079[_0x9814('0x18')]};}}catch(_0x4993a9){utils['error'](util[_0x9814('0x2')](_0x9814('0x15'),_0x3b8079[_0x9814('0x4')]),_0x4993a9);}};exports[_0x9814('0x19')]=function(_0x181ee2){try{if(!_['isNil'](dials[_0x181ee2[_0x9814('0x4')]])){utils[_0x9814('0xc')](util['format'](_0x9814('0x1a'),_0x181ee2[_0x9814('0x4')]),_0x181ee2);dials[_0x181ee2[_0x9814('0x4')]]=_[_0x9814('0x1b')](dials[_0x181ee2[_0x9814('0x4')]],_0x181ee2);dials[_0x181ee2['uniqueid']][_0x9814('0x1c')]=utils[_0x9814('0x1d')]();dials[_0x181ee2[_0x9814('0x4')]][_0x9814('0x1e')]=_0x9814('0x1f');utils[_0x9814('0x1')](util[_0x9814('0x2')](_0x9814('0x20'),_0x181ee2[_0x9814('0x4')],dials[_0x181ee2['uniqueid']][_0x9814('0x1c')]));}}catch(_0xa9d909){utils[_0x9814('0x13')](util[_0x9814('0x2')]('[%s][dials][dialbegin]',_0x181ee2[_0x9814('0x4')]),_0xa9d909);}};exports[_0x9814('0x21')]=function(_0xa61fb0){try{if(!_[_0x9814('0x16')](dials[_0xa61fb0['uniqueid']])){utils['debug'](util['format'](_0x9814('0x22'),_0xa61fb0['uniqueid']),_0xa61fb0);dials[_0xa61fb0[_0x9814('0x4')]][_0x9814('0x23')]=_0xa61fb0[_0x9814('0x23')];if(_0xa61fb0[_0x9814('0x23')]==_0x9814('0x24')){dials[_0xa61fb0[_0x9814('0x4')]]=_[_0x9814('0x1b')](dials[_0xa61fb0[_0x9814('0x4')]],_0xa61fb0);dials[_0xa61fb0[_0x9814('0x4')]][_0x9814('0x25')]=utils[_0x9814('0x1d')]();dials[_0xa61fb0['uniqueid']][_0x9814('0x1e')]='connect';utils[_0x9814('0x1')](util['format'](_0x9814('0x26'),_0xa61fb0['uniqueid'],_0xa61fb0['dialstatus'],dials[_0xa61fb0['uniqueid']][_0x9814('0x25')]));}else{utils[_0x9814('0x1')](util['format'](_0x9814('0x27'),_0xa61fb0[_0x9814('0x4')],_0xa61fb0['dialstatus']));}}}catch(_0x4da12c){utils[_0x9814('0x13')](util['format'](_0x9814('0x22'),_0xa61fb0[_0x9814('0x4')]),_0x4da12c);}};exports['hangup']=function(_0x57dbea){try{if(!_[_0x9814('0x16')](dials[_0x57dbea[_0x9814('0x4')]])){utils[_0x9814('0xc')](util['format'](_0x9814('0x28'),_0x57dbea[_0x9814('0x4')]),_0x57dbea);utils[_0x9814('0x1')](util[_0x9814('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x57dbea[_0x9814('0x4')],_0x57dbea['calleridnum'],_0x57dbea['calleridname'],_0x57dbea[_0x9814('0x29')]));dials[_0x57dbea[_0x9814('0x4')]]=_[_0x9814('0x1b')](dials[_0x57dbea[_0x9814('0x4')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x57dbea[_0x9814('0x4')]][_0x9814('0x2a')]=utils['diffTime'](dials[_0x57dbea[_0x9814('0x4')]][_0x9814('0x2b')],dials[_0x57dbea[_0x9814('0x4')]][_0x9814('0x1c')]);dials[_0x57dbea['uniqueid']][_0x9814('0x2c')]=utils[_0x9814('0x2d')](dials[_0x57dbea[_0x9814('0x4')]][_0x9814('0x25')]||dials[_0x57dbea['uniqueid']]['endtime'],dials[_0x57dbea[_0x9814('0x4')]]['starttime']);dials[_0x57dbea[_0x9814('0x4')]][_0x9814('0x2e')]=dials[_0x57dbea[_0x9814('0x4')]][_0x9814('0x25')]?utils[_0x9814('0x2d')](dials[_0x57dbea[_0x9814('0x4')]][_0x9814('0x2b')],dials[_0x57dbea[_0x9814('0x4')]][_0x9814('0x25')]):0x0;writeDB(dials[_0x57dbea[_0x9814('0x4')]]);}}catch(_0x543f25){utils[_0x9814('0x13')](util[_0x9814('0x2')](_0x9814('0x28'),_0x57dbea[_0x9814('0x4')]),_0x543f25);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 914c119..4d9f8b8 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 _0x9e6e=['[%s][index][agentcalled]','[%s][index][agentringnoanswer]','agentringnoanswer','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','port','asterisk','password','keepConnected','disabled','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','agentcalled','uniqueid'];(function(_0x3b1cd9,_0x4f73cb){var _0x45af1e=function(_0x1fa717){while(--_0x1fa717){_0x3b1cd9['push'](_0x3b1cd9['shift']());}};_0x45af1e(++_0x4f73cb);}(_0x9e6e,0x1b2));var _0xe9e6=function(_0xacb435,_0x220f20){_0xacb435=_0xacb435-0x0;var _0x32b976=_0x9e6e[_0xacb435];return _0x32b976;};var AsteriskManager=require(_0xe9e6('0x0'));var config=require(_0xe9e6('0x1'));var utils=require(_0xe9e6('0x2'));var util=require('util');var ami=new AsteriskManager(config['asterisk'][_0xe9e6('0x3')],config[_0xe9e6('0x4')]['ip'],config['asterisk']['username'],config[_0xe9e6('0x4')][_0xe9e6('0x5')],!![]);ami[_0xe9e6('0x6')]();if(config['xdr']&&config['xdr'][_0xe9e6('0x7')]){utils['info'](_0xe9e6('0x8'));}else{var agents=require(_0xe9e6('0x9'));var calls=require(_0xe9e6('0xa'));var queues=require('./queues.controller');var recordings=require(_0xe9e6('0xb'));var members=require('./members.controller');var dials=require(_0xe9e6('0xc'));var transfers=require(_0xe9e6('0xd'));var core=require(_0xe9e6('0xe'));ami['on'](_0xe9e6('0xf'),core['connect']);ami['on'](_0xe9e6('0x10'),core[_0xe9e6('0x10')]);ami['on'](_0xe9e6('0x11'),core[_0xe9e6('0x11')]);ami['on']('error',core[_0xe9e6('0x12')]);ami['on'](_0xe9e6('0x13'),core[_0xe9e6('0x13')]);ami['on'](_0xe9e6('0x14'),core[_0xe9e6('0x14')]);ami['on'](_0xe9e6('0x15'),function(_0x6c882e){try{utils[_0xe9e6('0x16')](util[_0xe9e6('0x17')]('[%s][index][devicestatechange]',_0x6c882e[_0xe9e6('0x18')]),_0x6c882e);members[_0xe9e6('0x15')](_0x6c882e);}catch(_0x631c98){utils[_0xe9e6('0x12')](util[_0xe9e6('0x17')](_0xe9e6('0x19'),_0x6c882e[_0xe9e6('0x18')]),_0x631c98);}});ami['on'](_0xe9e6('0x1a'),function(_0x7e1dc4){try{utils['debug'](util[_0xe9e6('0x17')]('[%s][index][agentcalled]',_0x7e1dc4[_0xe9e6('0x1b')]),_0x7e1dc4);agents[_0xe9e6('0x1a')](_0x7e1dc4);}catch(_0x16bb02){utils[_0xe9e6('0x12')](util[_0xe9e6('0x17')](_0xe9e6('0x1c'),_0x7e1dc4['uniqueid']),_0x16bb02);}});ami['on']('agentringnoanswer',function(_0x31361e){try{utils['debug'](util[_0xe9e6('0x17')](_0xe9e6('0x1d'),_0x31361e[_0xe9e6('0x1b')]),_0x31361e);agents[_0xe9e6('0x1e')](_0x31361e);}catch(_0x307453){utils[_0xe9e6('0x12')](util[_0xe9e6('0x17')](_0xe9e6('0x1d'),_0x31361e['uniqueid']),_0x307453);}});ami['on']('agentconnect',function(_0x13ee3d){try{utils[_0xe9e6('0x16')](util[_0xe9e6('0x17')](_0xe9e6('0x1f'),_0x13ee3d[_0xe9e6('0x1b')]),_0x13ee3d);agents[_0xe9e6('0x20')](_0x13ee3d);queues[_0xe9e6('0x20')](_0x13ee3d);}catch(_0x5cfbd3){utils['error'](util['format'](_0xe9e6('0x1f'),_0x13ee3d['uniqueid']),_0x5cfbd3);}});ami['on'](_0xe9e6('0x21'),function(_0x640ee6){try{utils[_0xe9e6('0x16')](util[_0xe9e6('0x17')](_0xe9e6('0x22'),_0x640ee6['uniqueid']),_0x640ee6);agents[_0xe9e6('0x21')](_0x640ee6);queues['agentcomplete'](_0x640ee6);members[_0xe9e6('0x21')](_0x640ee6);}catch(_0x2fb590){utils['error'](util['format'](_0xe9e6('0x22'),_0x640ee6[_0xe9e6('0x1b')]),_0x2fb590);}});ami['on'](_0xe9e6('0x23'),function(_0x2ac119){try{utils[_0xe9e6('0x16')](util['format'](_0xe9e6('0x24'),_0x2ac119[_0xe9e6('0x1b')]),_0x2ac119);agents[_0xe9e6('0x23')](_0x2ac119);queues['queuecallerabandon'](_0x2ac119);}catch(_0x52d5ec){utils[_0xe9e6('0x12')](util[_0xe9e6('0x17')](_0xe9e6('0x24'),_0x2ac119[_0xe9e6('0x1b')]),_0x52d5ec);}});ami['on']('queuecallerjoin',function(_0x45214c){try{utils[_0xe9e6('0x16')](util[_0xe9e6('0x17')](_0xe9e6('0x25'),_0x45214c[_0xe9e6('0x1b')]),_0x45214c);queues[_0xe9e6('0x26')](_0x45214c);recordings[_0xe9e6('0x26')](_0x45214c);}catch(_0x1a4d5b){utils[_0xe9e6('0x12')](util[_0xe9e6('0x17')]('[%s][index][queuecallerjoin]',_0x45214c[_0xe9e6('0x1b')]),_0x1a4d5b);}});ami['on'](_0xe9e6('0x27'),function(_0x4160f0){try{utils[_0xe9e6('0x16')](util[_0xe9e6('0x17')](_0xe9e6('0x28'),_0x4160f0[_0xe9e6('0x1b')]),_0x4160f0);queues[_0xe9e6('0x27')](_0x4160f0);}catch(_0x34c64a){utils[_0xe9e6('0x12')](util[_0xe9e6('0x17')](_0xe9e6('0x28'),_0x4160f0[_0xe9e6('0x1b')]),_0x34c64a);}});ami['on'](_0xe9e6('0x29'),function(_0x9d1ab6){try{utils[_0xe9e6('0x16')](util[_0xe9e6('0x17')](_0xe9e6('0x2a'),_0x9d1ab6[_0xe9e6('0x1b')]),_0x9d1ab6);queues[_0xe9e6('0x29')](_0x9d1ab6);calls[_0xe9e6('0x29')](_0x9d1ab6);}catch(_0xd47c10){utils[_0xe9e6('0x12')](util[_0xe9e6('0x17')]('[%s][index][musiconholdstart]',_0x9d1ab6[_0xe9e6('0x1b')]),_0xd47c10);}});ami['on'](_0xe9e6('0x2b'),function(_0xe2d192){try{utils[_0xe9e6('0x16')](util[_0xe9e6('0x17')](_0xe9e6('0x2c'),_0xe2d192[_0xe9e6('0x1b')]),_0xe2d192);queues[_0xe9e6('0x2b')](_0xe2d192);calls[_0xe9e6('0x2b')](_0xe2d192);}catch(_0x21e7b6){utils[_0xe9e6('0x12')](util[_0xe9e6('0x17')]('[%s][index][musiconholdstop]',_0xe2d192['uniqueid']),_0x21e7b6);}});ami['on']('newstate',function(_0x2cd11c){try{utils[_0xe9e6('0x16')](util[_0xe9e6('0x17')](_0xe9e6('0x2d'),_0x2cd11c['uniqueid']),_0x2cd11c);calls[_0xe9e6('0x2e')](_0x2cd11c);recordings[_0xe9e6('0x2e')](_0x2cd11c);}catch(_0x4258ce){utils[_0xe9e6('0x12')](util['format']('[%s][index][newstate]',_0x2cd11c['uniqueid']),_0x4258ce);}});ami['on'](_0xe9e6('0x2f'),function(_0x1dbf75){try{utils['debug'](util[_0xe9e6('0x17')](_0xe9e6('0x30'),_0x1dbf75[_0xe9e6('0x1b')]),_0x1dbf75);calls[_0xe9e6('0x2f')](_0x1dbf75);recordings[_0xe9e6('0x2f')](_0x1dbf75);dials[_0xe9e6('0x2f')](_0x1dbf75);agents[_0xe9e6('0x2f')](_0x1dbf75);queues['hangup'](_0x1dbf75);}catch(_0x1cbbca){utils[_0xe9e6('0x12')](util['format'](_0xe9e6('0x30'),_0x1dbf75[_0xe9e6('0x1b')]),_0x1cbbca);}});ami['on'](_0xe9e6('0x31'),function(_0x549229){try{utils['debug'](util['format']('[%s][index][cdr]',_0x549229[_0xe9e6('0x1b')]),_0x549229);members[_0xe9e6('0x31')](_0x549229);}catch(_0x3beebe){utils['error'](util['format'](_0xe9e6('0x32'),_0x549229['uniqueid']),_0x3beebe);}});ami['on'](_0xe9e6('0x33'),function(_0x3cfc23){try{utils[_0xe9e6('0x16')](util['format']('[%s][index][blindtransfer]',_0x3cfc23[_0xe9e6('0x1b')]),_0x3cfc23);queues[_0xe9e6('0x33')](_0x3cfc23);agents[_0xe9e6('0x33')](_0x3cfc23);transfers[_0xe9e6('0x33')](_0x3cfc23);}catch(_0x2f398b){utils[_0xe9e6('0x12')](util[_0xe9e6('0x17')](_0xe9e6('0x34'),_0x3cfc23[_0xe9e6('0x1b')]),_0x2f398b);}});ami['on']('attendedtransfer',function(_0x3a6db3){try{utils[_0xe9e6('0x16')](util[_0xe9e6('0x17')](_0xe9e6('0x35'),_0x3a6db3[_0xe9e6('0x36')]),_0x3a6db3);queues[_0xe9e6('0x37')](_0x3a6db3);transfers[_0xe9e6('0x37')](_0x3a6db3);agents[_0xe9e6('0x37')](_0x3a6db3);calls['attendedtransfer'](_0x3a6db3);}catch(_0x25c3fa){utils[_0xe9e6('0x12')](util['format'](_0xe9e6('0x35'),_0x3a6db3['origtransfereruniqueid']),_0x25c3fa);}});ami['on']('varset',function(_0x5cd6ff){try{utils[_0xe9e6('0x16')](util['format']('[%s][index][varset]',_0x5cd6ff[_0xe9e6('0x1b')]),_0x5cd6ff);queues['varset'](_0x5cd6ff);recordings[_0xe9e6('0x38')](_0x5cd6ff);calls[_0xe9e6('0x38')](_0x5cd6ff);dials[_0xe9e6('0x38')](_0x5cd6ff);}catch(_0x213304){utils[_0xe9e6('0x12')](util[_0xe9e6('0x17')](_0xe9e6('0x39'),_0x5cd6ff[_0xe9e6('0x1b')]),_0x213304);}});ami['on']('newexten',function(_0x57842d){try{utils[_0xe9e6('0x16')](util[_0xe9e6('0x17')](_0xe9e6('0x3a'),_0x57842d['uniqueid']),_0x57842d);calls[_0xe9e6('0x3b')](_0x57842d);recordings[_0xe9e6('0x3b')](_0x57842d);dials[_0xe9e6('0x3b')](_0x57842d);}catch(_0x50103d){utils[_0xe9e6('0x12')](util['format']('[%s][index][newexten]',_0x57842d['uniqueid']),_0x50103d);}});ami['on'](_0xe9e6('0x3c'),function(_0xc49bd0){try{utils[_0xe9e6('0x16')](util['format']('[%s][index][newchannel]',_0xc49bd0[_0xe9e6('0x1b')]),_0xc49bd0);calls[_0xe9e6('0x3c')](_0xc49bd0);recordings[_0xe9e6('0x3c')](_0xc49bd0);}catch(_0x1a4c7a){utils[_0xe9e6('0x12')](util['format'](_0xe9e6('0x3d'),_0xc49bd0[_0xe9e6('0x1b')]),_0x1a4c7a);}});ami['on'](_0xe9e6('0x3e'),function(_0x5ef33a){try{utils[_0xe9e6('0x16')](util[_0xe9e6('0x17')](_0xe9e6('0x3f'),_0x5ef33a[_0xe9e6('0x1b')]),_0x5ef33a);dials[_0xe9e6('0x3e')](_0x5ef33a);}catch(_0x33bdc5){utils[_0xe9e6('0x12')](util[_0xe9e6('0x17')](_0xe9e6('0x40'),_0x5ef33a['uniqueid']),_0x33bdc5);}});ami['on']('dialend',function(_0x528cbd){try{utils['debug'](util[_0xe9e6('0x17')](_0xe9e6('0x41'),_0x528cbd[_0xe9e6('0x1b')]),_0x528cbd);dials['dialend'](_0x528cbd);}catch(_0xcbea86){utils[_0xe9e6('0x12')](util[_0xe9e6('0x17')](_0xe9e6('0x41'),_0x528cbd[_0xe9e6('0x1b')]),_0xcbea86);}});} \ No newline at end of file +var _0xde4b=['./core.controller','connect','shutdown','fullybooted','error','close','managerevent','[%s][index][devicestatechange]','device','devicestatechange','format','agentcalled','[%s][index][agentcalled]','agentringnoanswer','debug','[%s][index][agentringnoanswer]','uniqueid','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','asterisk','port','username','password','keepConnected','xdr','disabled','XDR\x20DISABLED','./queues.controller','./recordings.controller','./members.controller','./transfers.controller'];(function(_0x83285d,_0x21123b){var _0x21d926=function(_0x59802a){while(--_0x59802a){_0x83285d['push'](_0x83285d['shift']());}};_0x21d926(++_0x21123b);}(_0xde4b,0x189));var _0xbde4=function(_0xaa2b0d,_0x3a95b5){_0xaa2b0d=_0xaa2b0d-0x0;var _0x304ce5=_0xde4b[_0xaa2b0d];return _0x304ce5;};var AsteriskManager=require(_0xbde4('0x0'));var config=require(_0xbde4('0x1'));var utils=require(_0xbde4('0x2'));var util=require('util');var ami=new AsteriskManager(config[_0xbde4('0x3')][_0xbde4('0x4')],config['asterisk']['ip'],config[_0xbde4('0x3')][_0xbde4('0x5')],config['asterisk'][_0xbde4('0x6')],!![]);ami[_0xbde4('0x7')]();if(config[_0xbde4('0x8')]&&config[_0xbde4('0x8')][_0xbde4('0x9')]){utils['info'](_0xbde4('0xa'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0xbde4('0xb'));var recordings=require(_0xbde4('0xc'));var members=require(_0xbde4('0xd'));var dials=require('./dials.controller');var transfers=require(_0xbde4('0xe'));var core=require(_0xbde4('0xf'));ami['on']('connect',core[_0xbde4('0x10')]);ami['on'](_0xbde4('0x11'),core[_0xbde4('0x11')]);ami['on'](_0xbde4('0x12'),core[_0xbde4('0x12')]);ami['on']('error',core[_0xbde4('0x13')]);ami['on']('close',core[_0xbde4('0x14')]);ami['on'](_0xbde4('0x15'),core[_0xbde4('0x15')]);ami['on']('devicestatechange',function(_0x5164bf){try{utils['debug'](util['format'](_0xbde4('0x16'),_0x5164bf[_0xbde4('0x17')]),_0x5164bf);members[_0xbde4('0x18')](_0x5164bf);}catch(_0x498dad){utils[_0xbde4('0x13')](util[_0xbde4('0x19')]('[%s][index][devicestatechange]',_0x5164bf['device']),_0x498dad);}});ami['on'](_0xbde4('0x1a'),function(_0x3786fa){try{utils['debug'](util[_0xbde4('0x19')](_0xbde4('0x1b'),_0x3786fa['uniqueid']),_0x3786fa);agents[_0xbde4('0x1a')](_0x3786fa);}catch(_0x1989b5){utils[_0xbde4('0x13')](util[_0xbde4('0x19')](_0xbde4('0x1b'),_0x3786fa['uniqueid']),_0x1989b5);}});ami['on'](_0xbde4('0x1c'),function(_0x2e60a6){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x1e'),_0x2e60a6['uniqueid']),_0x2e60a6);agents[_0xbde4('0x1c')](_0x2e60a6);}catch(_0x42a3c1){utils[_0xbde4('0x13')](util[_0xbde4('0x19')](_0xbde4('0x1e'),_0x2e60a6[_0xbde4('0x1f')]),_0x42a3c1);}});ami['on'](_0xbde4('0x20'),function(_0x25656c){try{utils['debug'](util[_0xbde4('0x19')](_0xbde4('0x21'),_0x25656c[_0xbde4('0x1f')]),_0x25656c);agents['agentconnect'](_0x25656c);queues[_0xbde4('0x20')](_0x25656c);}catch(_0x1de6ac){utils[_0xbde4('0x13')](util[_0xbde4('0x19')]('[%s][index][agentconnect]',_0x25656c[_0xbde4('0x1f')]),_0x1de6ac);}});ami['on'](_0xbde4('0x22'),function(_0x1940a1){try{utils['debug'](util[_0xbde4('0x19')]('[%s][index][agentcomplete]',_0x1940a1[_0xbde4('0x1f')]),_0x1940a1);agents[_0xbde4('0x22')](_0x1940a1);queues['agentcomplete'](_0x1940a1);members[_0xbde4('0x22')](_0x1940a1);}catch(_0x20210a){utils[_0xbde4('0x13')](util[_0xbde4('0x19')](_0xbde4('0x23'),_0x1940a1['uniqueid']),_0x20210a);}});ami['on'](_0xbde4('0x24'),function(_0x182110){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x25'),_0x182110['uniqueid']),_0x182110);agents['queuecallerabandon'](_0x182110);queues[_0xbde4('0x24')](_0x182110);}catch(_0x24aee9){utils[_0xbde4('0x13')](util['format'](_0xbde4('0x25'),_0x182110['uniqueid']),_0x24aee9);}});ami['on'](_0xbde4('0x26'),function(_0x2b0386){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x27'),_0x2b0386[_0xbde4('0x1f')]),_0x2b0386);queues[_0xbde4('0x26')](_0x2b0386);recordings['queuecallerjoin'](_0x2b0386);}catch(_0x385088){utils['error'](util['format'](_0xbde4('0x27'),_0x2b0386[_0xbde4('0x1f')]),_0x385088);}});ami['on'](_0xbde4('0x28'),function(_0x10d0ca){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x29'),_0x10d0ca[_0xbde4('0x1f')]),_0x10d0ca);queues[_0xbde4('0x28')](_0x10d0ca);}catch(_0x1a0c81){utils[_0xbde4('0x13')](util[_0xbde4('0x19')]('[%s][index][queuecallerleave]',_0x10d0ca[_0xbde4('0x1f')]),_0x1a0c81);}});ami['on'](_0xbde4('0x2a'),function(_0x5f191b){try{utils['debug'](util[_0xbde4('0x19')](_0xbde4('0x2b'),_0x5f191b[_0xbde4('0x1f')]),_0x5f191b);queues[_0xbde4('0x2a')](_0x5f191b);calls[_0xbde4('0x2a')](_0x5f191b);}catch(_0x214ac3){utils[_0xbde4('0x13')](util[_0xbde4('0x19')]('[%s][index][musiconholdstart]',_0x5f191b[_0xbde4('0x1f')]),_0x214ac3);}});ami['on'](_0xbde4('0x2c'),function(_0x130cf3){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x2d'),_0x130cf3[_0xbde4('0x1f')]),_0x130cf3);queues[_0xbde4('0x2c')](_0x130cf3);calls[_0xbde4('0x2c')](_0x130cf3);}catch(_0x226924){utils[_0xbde4('0x13')](util[_0xbde4('0x19')](_0xbde4('0x2d'),_0x130cf3[_0xbde4('0x1f')]),_0x226924);}});ami['on'](_0xbde4('0x2e'),function(_0x5d9e83){try{utils[_0xbde4('0x1d')](util['format'](_0xbde4('0x2f'),_0x5d9e83[_0xbde4('0x1f')]),_0x5d9e83);calls[_0xbde4('0x2e')](_0x5d9e83);recordings[_0xbde4('0x2e')](_0x5d9e83);}catch(_0x23c047){utils[_0xbde4('0x13')](util[_0xbde4('0x19')](_0xbde4('0x2f'),_0x5d9e83[_0xbde4('0x1f')]),_0x23c047);}});ami['on'](_0xbde4('0x30'),function(_0x5bdc10){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x31'),_0x5bdc10['uniqueid']),_0x5bdc10);calls[_0xbde4('0x30')](_0x5bdc10);recordings['hangup'](_0x5bdc10);dials['hangup'](_0x5bdc10);agents[_0xbde4('0x30')](_0x5bdc10);queues[_0xbde4('0x30')](_0x5bdc10);}catch(_0x19919d){utils[_0xbde4('0x13')](util['format'](_0xbde4('0x31'),_0x5bdc10[_0xbde4('0x1f')]),_0x19919d);}});ami['on'](_0xbde4('0x32'),function(_0x277a52){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x33'),_0x277a52['uniqueid']),_0x277a52);members[_0xbde4('0x32')](_0x277a52);}catch(_0x5948bf){utils[_0xbde4('0x13')](util['format'](_0xbde4('0x33'),_0x277a52[_0xbde4('0x1f')]),_0x5948bf);}});ami['on'](_0xbde4('0x34'),function(_0x238088){try{utils['debug'](util[_0xbde4('0x19')](_0xbde4('0x35'),_0x238088[_0xbde4('0x1f')]),_0x238088);queues[_0xbde4('0x34')](_0x238088);agents[_0xbde4('0x34')](_0x238088);transfers[_0xbde4('0x34')](_0x238088);}catch(_0x7dda37){utils[_0xbde4('0x13')](util[_0xbde4('0x19')](_0xbde4('0x35'),_0x238088[_0xbde4('0x1f')]),_0x7dda37);}});ami['on'](_0xbde4('0x36'),function(_0x2b2d0b){try{utils['debug'](util['format'](_0xbde4('0x37'),_0x2b2d0b[_0xbde4('0x38')]),_0x2b2d0b);queues[_0xbde4('0x36')](_0x2b2d0b);transfers[_0xbde4('0x36')](_0x2b2d0b);agents['attendedtransfer'](_0x2b2d0b);calls[_0xbde4('0x36')](_0x2b2d0b);}catch(_0xe30307){utils['error'](util['format'](_0xbde4('0x37'),_0x2b2d0b[_0xbde4('0x38')]),_0xe30307);}});ami['on'](_0xbde4('0x39'),function(_0xab968c){try{utils[_0xbde4('0x1d')](util['format'](_0xbde4('0x3a'),_0xab968c['uniqueid']),_0xab968c);queues['varset'](_0xab968c);recordings['varset'](_0xab968c);calls['varset'](_0xab968c);dials[_0xbde4('0x39')](_0xab968c);}catch(_0xda68d8){utils['error'](util['format'](_0xbde4('0x3a'),_0xab968c[_0xbde4('0x1f')]),_0xda68d8);}});ami['on'](_0xbde4('0x3b'),function(_0x5025d1){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x3c'),_0x5025d1['uniqueid']),_0x5025d1);calls[_0xbde4('0x3b')](_0x5025d1);recordings[_0xbde4('0x3b')](_0x5025d1);dials[_0xbde4('0x3b')](_0x5025d1);}catch(_0x1c6cae){utils[_0xbde4('0x13')](util['format'](_0xbde4('0x3c'),_0x5025d1[_0xbde4('0x1f')]),_0x1c6cae);}});ami['on'](_0xbde4('0x3d'),function(_0x299b0c){try{utils[_0xbde4('0x1d')](util['format'](_0xbde4('0x3e'),_0x299b0c['uniqueid']),_0x299b0c);calls[_0xbde4('0x3d')](_0x299b0c);recordings[_0xbde4('0x3d')](_0x299b0c);}catch(_0x196dda){utils[_0xbde4('0x13')](util[_0xbde4('0x19')]('[%s][index][newchannel]',_0x299b0c['uniqueid']),_0x196dda);}});ami['on'](_0xbde4('0x3f'),function(_0x4c630a){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x40'),_0x4c630a[_0xbde4('0x1f')]),_0x4c630a);dials[_0xbde4('0x3f')](_0x4c630a);}catch(_0x4d7adf){utils[_0xbde4('0x13')](util[_0xbde4('0x19')](_0xbde4('0x41'),_0x4c630a[_0xbde4('0x1f')]),_0x4d7adf);}});ami['on'](_0xbde4('0x42'),function(_0x8db5f0){try{utils[_0xbde4('0x1d')](util['format'](_0xbde4('0x43'),_0x8db5f0[_0xbde4('0x1f')]),_0x8db5f0);dials[_0xbde4('0x42')](_0x8db5f0);}catch(_0x524971){utils[_0xbde4('0x13')](util[_0xbde4('0x19')](_0xbde4('0x43'),_0x8db5f0[_0xbde4('0x1f')]),_0x524971);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 05d2a1f..7361849 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 _0x9512=['NOT_INUSE','isNil','now','duration','exitAt','enterAt','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','assign','data1','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','destination','lodash','util','./utils','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','data2','type','interface','getUserByInterface','then','membername','name','internal','request','getUserByName','split','CreateMemberReport','error','[%s][members][writeDB]','uniqueid','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','agent'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0x9512,0x14b));var _0x2951=function(_0x3f2647,_0x4447ac){_0x3f2647=_0x3f2647-0x0;var _0xbd8415=_0x9512[_0x3f2647];return _0xbd8415;};'use strict';var _=require(_0x2951('0x0'));var util=require(_0x2951('0x1'));var utils=require(_0x2951('0x2'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x3861c8){utils[_0x2951('0x3')](util[_0x2951('0x4')](_0x2951('0x5'),_0x3861c8['uniqueid'],_0x3861c8['interface'],_0x3861c8[_0x2951('0x6')],_0x3861c8[_0x2951('0x7')],_0x3861c8['membername'],_0x3861c8[_0x2951('0x8')]));if(_0x3861c8[_0x2951('0x9')]){utils[_0x2951('0xa')](_0x3861c8[_0x2951('0x9')])[_0x2951('0xb')](function(_0x4f8311){if(_0x4f8311){_0x3861c8[_0x2951('0xc')]=_0x4f8311[_0x2951('0xd')];_0x3861c8[_0x2951('0xe')]=_0x4f8311[_0x2951('0xe')];utils[_0x2951('0xf')]('CreateMemberReport',_0x3861c8);}else{utils[_0x2951('0x10')](_0x3861c8[_0x2951('0x9')][_0x2951('0x11')]('/')[0x1])[_0x2951('0xb')](function(_0x34cb8b){if(_0x34cb8b){_0x3861c8[_0x2951('0xc')]=_0x34cb8b[_0x2951('0xd')];_0x3861c8[_0x2951('0xe')]=_0x34cb8b[_0x2951('0xe')];utils[_0x2951('0xf')](_0x2951('0x12'),_0x3861c8);}});}})['catch'](function(_0x4dfd8b){utils[_0x2951('0x13')](util[_0x2951('0x4')](_0x2951('0x14'),_0x3861c8[_0x2951('0x15')]),_0x4dfd8b);});}delete members[_0x3861c8[_0x2951('0x9')]];}function startsWith(_0x3c6c38,_0x5be2fe){return _['some'](_0x3c6c38,function(_0xe2d9e7){return _[_0x2951('0x16')](_0x5be2fe,_0xe2d9e7);});}exports[_0x2951('0x17')]=function(_0x628353){try{utils['debug'](util[_0x2951('0x4')](_0x2951('0x18'),members[_0x628353[_0x2951('0x19')]]?members[_0x628353[_0x2951('0x19')]]['uniqueid']:_0x628353[_0x2951('0x19')]),_0x628353);utils[_0x2951('0x3')](util[_0x2951('0x4')](_0x2951('0x1a'),members[_0x628353[_0x2951('0x19')]]?members[_0x628353[_0x2951('0x19')]][_0x2951('0x15')]:_0x628353[_0x2951('0x19')],_0x628353[_0x2951('0x1b')],_0x628353[_0x2951('0x19')]));switch(_0x628353[_0x2951('0x1b')]){case _0x2951('0x1c'):case _0x2951('0x1d'):if(!startsWith(exclude,_0x628353['device'])){members[_0x628353['device']]={'channel':_0x2951('0x1e'),'interface':_0x628353[_0x2951('0x19')],'type':_0x2951('0x1f'),'enterAt':utils['now'](),'role':_0x2951('0x20')};}break;case _0x2951('0x21'):if(!_[_0x2951('0x22')](members[_0x628353[_0x2951('0x19')]])){members[_0x628353['device']]['exitAt']=utils[_0x2951('0x23')]();members[_0x628353['device']][_0x2951('0x24')]=utils['diffTime'](members[_0x628353[_0x2951('0x19')]][_0x2951('0x25')],members[_0x628353['device']][_0x2951('0x26')]);if(members[_0x628353[_0x2951('0x19')]][_0x2951('0x15')]){writeDB(members[_0x628353[_0x2951('0x19')]]);}}break;default:break;}}catch(_0x5ae28f){utils[_0x2951('0x13')](util[_0x2951('0x4')]('[%s][members][devicestatechange]',members[_0x628353[_0x2951('0x19')]]?members[_0x628353[_0x2951('0x19')]]['uniqueid']:_0x628353[_0x2951('0x19')]),_0x5ae28f);}};exports['agentcomplete']=function(_0x448142){try{if(!_[_0x2951('0x22')](members[_0x448142[_0x2951('0x9')]])){utils[_0x2951('0x27')](util[_0x2951('0x4')](_0x2951('0x28'),_0x448142[_0x2951('0x15')]),_0x448142);utils[_0x2951('0x3')](util[_0x2951('0x4')](_0x2951('0x29'),_0x448142[_0x2951('0x15')],_0x448142[_0x2951('0x9')],_0x448142[_0x2951('0x2a')]));members[_0x448142[_0x2951('0x9')]]=_['assign'](members[_0x448142[_0x2951('0x9')]],{'data4':_0x448142[_0x2951('0x2a')],'uniqueid':_0x448142[_0x2951('0x15')]});}}catch(_0x836622){utils[_0x2951('0x13')](util[_0x2951('0x4')](_0x2951('0x28'),_0x448142[_0x2951('0x15')]),_0x836622);}};exports[_0x2951('0x2b')]=function(_0x554ab4){try{utils[_0x2951('0x27')](util[_0x2951('0x4')](_0x2951('0x2c'),_0x554ab4[_0x2951('0x15')]),_0x554ab4);if(_0x554ab4['channel']){var _0x3e1312=_0x554ab4[_0x2951('0x6')][_0x2951('0x11')]('-')[0x0];if(!_['isNil'](members[_0x3e1312])){members[_0x3e1312]=_[_0x2951('0x2d')](members[_0x3e1312],{'data1':members[_0x3e1312][_0x2951('0x2e')]||_0x554ab4[_0x2951('0x8')],'data2':members[_0x3e1312][_0x2951('0x7')]||_0x554ab4[_0x2951('0x2f')],'data3':members[_0x3e1312][_0x2951('0x30')]||_0x554ab4['destination'],'uniqueid':members[_0x3e1312][_0x2951('0x15')]||_0x554ab4[_0x2951('0x15')]});utils[_0x2951('0x3')](util[_0x2951('0x4')](_0x2951('0x31'),_0x554ab4[_0x2951('0x15')],members[_0x3e1312][_0x2951('0x2e')],members[_0x3e1312][_0x2951('0x7')],members[_0x3e1312][_0x2951('0x30')]));if(members[_0x3e1312][_0x2951('0x25')]){writeDB(members[_0x3e1312]);}}}if(_0x554ab4['destinationchannel']){var _0x3612d0=_0x554ab4[_0x2951('0x32')][_0x2951('0x11')]('-')[0x0];if(!_[_0x2951('0x22')](members[_0x3612d0])){members[_0x3612d0]=_['assign'](members[_0x3612d0],{'data1':members[_0x3612d0][_0x2951('0x2e')]||_0x554ab4['type'],'data2':members[_0x3612d0][_0x2951('0x7')]||_0x554ab4[_0x2951('0x2f')],'data3':members[_0x3612d0][_0x2951('0x30')]||_0x554ab4[_0x2951('0x33')],'uniqueid':members[_0x3612d0][_0x2951('0x15')]||_0x554ab4[_0x2951('0x15')]});utils[_0x2951('0x3')](util[_0x2951('0x4')](_0x2951('0x31'),_0x554ab4[_0x2951('0x15')],members[_0x3612d0][_0x2951('0x2e')],members[_0x3612d0][_0x2951('0x7')],members[_0x3612d0][_0x2951('0x30')]));if(members[_0x3612d0][_0x2951('0x25')]){writeDB(members[_0x3612d0]);}}}}catch(_0x1da648){utils['error'](util[_0x2951('0x4')](_0x2951('0x2c'),_0x554ab4['uniqueid']),_0x1da648);}}; \ No newline at end of file +var _0x1fe2=['isNil','exitAt','duration','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data3','destination','data1','destinationchannel','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','name','getUserByName','split','internal','request','CreateMemberReport','error','[%s][members][writeDB]','uniqueid','devicestatechange','debug','[%s][members][devicestatechange]','device','state','BUSY','voice','TALKING','now','NOT_INUSE'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x1fe2,0x72));var _0x21fe=function(_0x4d9253,_0x24c0e9){_0x4d9253=_0x4d9253-0x0;var _0x529cc5=_0x1fe2[_0x4d9253];return _0x529cc5;};'use strict';var _=require(_0x21fe('0x0'));var util=require(_0x21fe('0x1'));var utils=require(_0x21fe('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x21fe('0x3')];function writeDB(_0x315b11){utils[_0x21fe('0x4')](util[_0x21fe('0x5')](_0x21fe('0x6'),_0x315b11['uniqueid'],_0x315b11[_0x21fe('0x7')],_0x315b11[_0x21fe('0x8')],_0x315b11[_0x21fe('0x9')],_0x315b11[_0x21fe('0xa')],_0x315b11[_0x21fe('0xb')]));if(_0x315b11['interface']){utils[_0x21fe('0xc')](_0x315b11[_0x21fe('0x7')])[_0x21fe('0xd')](function(_0x1d8720){if(_0x1d8720){_0x315b11['membername']=_0x1d8720[_0x21fe('0xe')];_0x315b11['internal']=_0x1d8720['internal'];utils['request']('CreateMemberReport',_0x315b11);}else{utils[_0x21fe('0xf')](_0x315b11[_0x21fe('0x7')][_0x21fe('0x10')]('/')[0x1])['then'](function(_0x27d5ab){if(_0x27d5ab){_0x315b11[_0x21fe('0xa')]=_0x27d5ab[_0x21fe('0xe')];_0x315b11['internal']=_0x27d5ab[_0x21fe('0x11')];utils[_0x21fe('0x12')](_0x21fe('0x13'),_0x315b11);}});}})['catch'](function(_0x3d63a4){utils[_0x21fe('0x14')](util[_0x21fe('0x5')](_0x21fe('0x15'),_0x315b11[_0x21fe('0x16')]),_0x3d63a4);});}delete members[_0x315b11[_0x21fe('0x7')]];}function startsWith(_0x1fa00c,_0x38d9ab){return _['some'](_0x1fa00c,function(_0x15f42c){return _['startsWith'](_0x38d9ab,_0x15f42c);});}exports[_0x21fe('0x17')]=function(_0x3fa079){try{utils[_0x21fe('0x18')](util[_0x21fe('0x5')](_0x21fe('0x19'),members[_0x3fa079[_0x21fe('0x1a')]]?members[_0x3fa079[_0x21fe('0x1a')]][_0x21fe('0x16')]:_0x3fa079[_0x21fe('0x1a')]),_0x3fa079);utils['info'](util[_0x21fe('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x3fa079[_0x21fe('0x1a')]]?members[_0x3fa079[_0x21fe('0x1a')]][_0x21fe('0x16')]:_0x3fa079[_0x21fe('0x1a')],_0x3fa079[_0x21fe('0x1b')],_0x3fa079[_0x21fe('0x1a')]));switch(_0x3fa079[_0x21fe('0x1b')]){case'INUSE':case _0x21fe('0x1c'):if(!startsWith(exclude,_0x3fa079[_0x21fe('0x1a')])){members[_0x3fa079[_0x21fe('0x1a')]]={'channel':_0x21fe('0x1d'),'interface':_0x3fa079[_0x21fe('0x1a')],'type':_0x21fe('0x1e'),'enterAt':utils[_0x21fe('0x1f')](),'role':'agent'};}break;case _0x21fe('0x20'):if(!_[_0x21fe('0x21')](members[_0x3fa079[_0x21fe('0x1a')]])){members[_0x3fa079[_0x21fe('0x1a')]][_0x21fe('0x22')]=utils[_0x21fe('0x1f')]();members[_0x3fa079[_0x21fe('0x1a')]][_0x21fe('0x23')]=utils[_0x21fe('0x24')](members[_0x3fa079[_0x21fe('0x1a')]][_0x21fe('0x22')],members[_0x3fa079[_0x21fe('0x1a')]][_0x21fe('0x25')]);if(members[_0x3fa079[_0x21fe('0x1a')]][_0x21fe('0x16')]){writeDB(members[_0x3fa079['device']]);}}break;default:break;}}catch(_0x33372f){utils[_0x21fe('0x14')](util['format']('[%s][members][devicestatechange]',members[_0x3fa079[_0x21fe('0x1a')]]?members[_0x3fa079[_0x21fe('0x1a')]]['uniqueid']:_0x3fa079[_0x21fe('0x1a')]),_0x33372f);}};exports['agentcomplete']=function(_0x5acd67){try{if(!_[_0x21fe('0x21')](members[_0x5acd67['interface']])){utils[_0x21fe('0x18')](util[_0x21fe('0x5')](_0x21fe('0x26'),_0x5acd67[_0x21fe('0x16')]),_0x5acd67);utils[_0x21fe('0x4')](util[_0x21fe('0x5')](_0x21fe('0x27'),_0x5acd67[_0x21fe('0x16')],_0x5acd67[_0x21fe('0x7')],_0x5acd67[_0x21fe('0x28')]));members[_0x5acd67[_0x21fe('0x7')]]=_[_0x21fe('0x29')](members[_0x5acd67[_0x21fe('0x7')]],{'data4':_0x5acd67['queue'],'uniqueid':_0x5acd67[_0x21fe('0x16')]});}}catch(_0x5ac779){utils[_0x21fe('0x14')](util[_0x21fe('0x5')](_0x21fe('0x26'),_0x5acd67[_0x21fe('0x16')]),_0x5ac779);}};exports['cdr']=function(_0x42781d){try{utils[_0x21fe('0x18')](util[_0x21fe('0x5')](_0x21fe('0x2a'),_0x42781d[_0x21fe('0x16')]),_0x42781d);if(_0x42781d[_0x21fe('0x8')]){var _0x3090ab=_0x42781d['channel'][_0x21fe('0x10')]('-')[0x0];if(!_[_0x21fe('0x21')](members[_0x3090ab])){members[_0x3090ab]=_['assign'](members[_0x3090ab],{'data1':members[_0x3090ab]['data1']||_0x42781d[_0x21fe('0xb')],'data2':members[_0x3090ab][_0x21fe('0x9')]||_0x42781d['source'],'data3':members[_0x3090ab][_0x21fe('0x2b')]||_0x42781d[_0x21fe('0x2c')],'uniqueid':members[_0x3090ab][_0x21fe('0x16')]||_0x42781d[_0x21fe('0x16')]});utils[_0x21fe('0x4')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x42781d[_0x21fe('0x16')],members[_0x3090ab][_0x21fe('0x2d')],members[_0x3090ab][_0x21fe('0x9')],members[_0x3090ab][_0x21fe('0x2b')]));if(members[_0x3090ab][_0x21fe('0x22')]){writeDB(members[_0x3090ab]);}}}if(_0x42781d['destinationchannel']){var _0x209556=_0x42781d[_0x21fe('0x2e')][_0x21fe('0x10')]('-')[0x0];if(!_[_0x21fe('0x21')](members[_0x209556])){members[_0x209556]=_['assign'](members[_0x209556],{'data1':members[_0x209556][_0x21fe('0x2d')]||_0x42781d[_0x21fe('0xb')],'data2':members[_0x209556]['data2']||_0x42781d[_0x21fe('0x2f')],'data3':members[_0x209556][_0x21fe('0x2b')]||_0x42781d[_0x21fe('0x2c')],'uniqueid':members[_0x209556][_0x21fe('0x16')]||_0x42781d[_0x21fe('0x16')]});utils[_0x21fe('0x4')](util['format'](_0x21fe('0x30'),_0x42781d[_0x21fe('0x16')],members[_0x209556]['data1'],members[_0x209556][_0x21fe('0x9')],members[_0x209556][_0x21fe('0x2b')]));if(members[_0x209556][_0x21fe('0x22')]){writeDB(members[_0x209556]);}}}}catch(_0x3c43b6){utils[_0x21fe('0x14')](util[_0x21fe('0x5')](_0x21fe('0x2a'),_0x42781d[_0x21fe('0x16')]),_0x3c43b6);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index ed2b264..7d8487a 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 _0xdda9=['request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','[%s][queues][queuecallerjoin]','hangup','isNil','debug','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','lastAssignedTo','agentcomplete','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfertype','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','transfereelinkedid','calleridnum','calleridname','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','queuecallerexitreason','getVoiceQueueByName','then','type'];(function(_0x24ec16,_0x4b2bcf){var _0x425b24=function(_0x547277){while(--_0x547277){_0x24ec16['push'](_0x24ec16['shift']());}};_0x425b24(++_0x4b2bcf);}(_0xdda9,0x1f3));var _0x9dda=function(_0x1af4d9,_0xecb5){_0x1af4d9=_0x1af4d9-0x0;var _0xc36bed=_0xdda9[_0x1af4d9];return _0xc36bed;};'use strict';var _=require(_0x9dda('0x0'));var util=require(_0x9dda('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x3e1b36){utils[_0x9dda('0x2')](util[_0x9dda('0x3')](_0x9dda('0x4'),_0x3e1b36[_0x9dda('0x5')],_0x3e1b36['channel'],_0x3e1b36[_0x9dda('0x6')],_0x3e1b36['lastAssignedTo'],_0x3e1b36['calleridnum'],_0x3e1b36['accountcode'],_0x3e1b36[_0x9dda('0x7')]));if(_0x3e1b36[_0x9dda('0x6')]){utils[_0x9dda('0x8')](_0x3e1b36['queue'])[_0x9dda('0x9')](function(_0x56854b){if(_0x56854b){_0x3e1b36['type']=_0x56854b[_0x9dda('0xa')];}utils[_0x9dda('0xb')](_0x9dda('0xc'),_0x3e1b36);});}else{utils['request'](_0x9dda('0xc'),_0x3e1b36);}if(_0x3e1b36[_0x9dda('0xd')]){delete queues[_0x3e1b36[_0x9dda('0xd')]];}else{delete queues[_0x3e1b36[_0x9dda('0x5')]];}}exports[_0x9dda('0xe')]=function(_0x534d2d){try{utils['debug'](util[_0x9dda('0x3')]('[%s][queues][queuecallerjoin]',_0x534d2d[_0x9dda('0x5')]),_0x534d2d);utils[_0x9dda('0x2')](util[_0x9dda('0x3')](_0x9dda('0xf'),_0x534d2d[_0x9dda('0x5')],_0x534d2d[_0x9dda('0x6')],_0x534d2d['position']));queues[_0x534d2d[_0x9dda('0x5')]]=_[_0x9dda('0x10')](_0x534d2d,{'originalposition':_0x534d2d[_0x9dda('0x11')],'queuecallerjoinAt':utils[_0x9dda('0x12')](),'mohtime':0x0});}catch(_0x1d71fd){utils['error'](util['format'](_0x9dda('0x13'),_0x534d2d[_0x9dda('0x5')]),_0x1d71fd);}};exports[_0x9dda('0x14')]=function(_0x83a779){try{if(!_[_0x9dda('0x15')](queues[_0x83a779[_0x9dda('0x5')]])){utils[_0x9dda('0x16')](util[_0x9dda('0x3')]('[%s][queues][hangup]',_0x83a779['uniqueid']),_0x83a779);if(queues[_0x83a779['uniqueid']][_0x9dda('0x17')]){if(!queues[_0x83a779['uniqueid']][_0x9dda('0x18')]&&!queues[_0x83a779['uniqueid']][_0x9dda('0x19')]){queues[_0x83a779[_0x9dda('0x5')]]['queuecallercomplete']=!![];queues[_0x83a779[_0x9dda('0x5')]][_0x9dda('0x1a')]=utils[_0x9dda('0x12')]();queues[_0x83a779['uniqueid']][_0x9dda('0x7')]=_0x9dda('0x1b');}utils[_0x9dda('0x2')](util['format'](_0x9dda('0x1c'),_0x83a779[_0x9dda('0x5')],queues[_0x83a779[_0x9dda('0x5')]]['name'],queues[_0x83a779[_0x9dda('0x5')]][_0x9dda('0x7')]));writeDB(queues[_0x83a779['uniqueid']]);}else if(queues[_0x83a779['uniqueid']][_0x9dda('0xd')]){utils[_0x9dda('0x2')](util[_0x9dda('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x83a779[_0x9dda('0x5')],queues[_0x83a779['uniqueid']][_0x9dda('0x1d')],queues[_0x83a779['uniqueid']]['transfereduniqueid']));queues[queues[_0x83a779['uniqueid']][_0x9dda('0xd')]]=queues[_0x83a779[_0x9dda('0x5')]];queues[queues[_0x83a779[_0x9dda('0x5')]][_0x9dda('0xd')]][_0x9dda('0x1e')]=0x2;delete queues[_0x83a779[_0x9dda('0x5')]];}}}catch(_0xe01a3a){utils['error'](util[_0x9dda('0x3')]('[%s][queues][hangup]',_0x83a779['uniqueid']),_0xe01a3a);}};exports[_0x9dda('0x1f')]=function(_0x11eff9){try{utils[_0x9dda('0x16')](util['format'](_0x9dda('0x20'),_0x11eff9[_0x9dda('0x5')]),_0x11eff9);if(!_[_0x9dda('0x15')](_0x11eff9[_0x9dda('0x21')][_0x9dda('0x22')])&&_0x11eff9[_0x9dda('0x23')][_0x9dda('0x24')]()!==_0x9dda('0x25')){if(!_[_0x9dda('0x15')](queues[_0x11eff9[_0x9dda('0x5')]])){queues[_0x11eff9['uniqueid']][_0x9dda('0x18')]=![];queues[_0x11eff9[_0x9dda('0x5')]]['queuecallerabandonAt']=null;queues[_0x11eff9[_0x9dda('0x5')]][_0x9dda('0x19')]=!![];queues[_0x11eff9[_0x9dda('0x5')]][_0x9dda('0x26')]=utils[_0x9dda('0x12')]();queues[_0x11eff9[_0x9dda('0x5')]][_0x9dda('0x7')]=_0x11eff9[_0x9dda('0x23')]['toUpperCase']();utils[_0x9dda('0x2')](util[_0x9dda('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x11eff9[_0x9dda('0x5')],queues[_0x11eff9['uniqueid']][_0x9dda('0x1d')],_0x11eff9[_0x9dda('0x23')],queues[_0x11eff9[_0x9dda('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x11eff9[_0x9dda('0x5')]]);}}else if(!_['isNil'](_0x11eff9['variable'][_0x9dda('0x27')])){if(!_[_0x9dda('0x15')](queues[_0x11eff9[_0x9dda('0x5')]])&&!queues[_0x11eff9[_0x9dda('0x5')]][_0x9dda('0x18')]){queues[_0x11eff9[_0x9dda('0x5')]][_0x9dda('0x18')]=![];queues[_0x11eff9[_0x9dda('0x5')]][_0x9dda('0x28')]=null;queues[_0x11eff9[_0x9dda('0x5')]][_0x9dda('0x19')]=!![];queues[_0x11eff9['uniqueid']][_0x9dda('0x26')]=utils[_0x9dda('0x12')]();queues[_0x11eff9[_0x9dda('0x5')]][_0x9dda('0x7')]=_0x9dda('0x29');utils['info'](util[_0x9dda('0x3')](_0x9dda('0x2a'),_0x11eff9['uniqueid'],queues[_0x11eff9[_0x9dda('0x5')]][_0x9dda('0x1d')],_0x11eff9['value'],queues[_0x11eff9[_0x9dda('0x5')]]['queuecallerexitreason']));}}}catch(_0x3638e0){utils[_0x9dda('0x2b')](util[_0x9dda('0x3')]('[%s][queues][varset]',_0x11eff9[_0x9dda('0x5')]),_0x3638e0);}};exports[_0x9dda('0x18')]=function(_0x5b63fa){try{if(!_[_0x9dda('0x15')](queues[_0x5b63fa[_0x9dda('0x5')]])){utils[_0x9dda('0x16')](util[_0x9dda('0x3')](_0x9dda('0x2c'),_0x5b63fa[_0x9dda('0x5')]),_0x5b63fa);queues[_0x5b63fa[_0x9dda('0x5')]][_0x9dda('0x19')]=![];queues[_0x5b63fa['uniqueid']][_0x9dda('0x26')]=null;queues[_0x5b63fa['uniqueid']][_0x9dda('0x18')]=!![];queues[_0x5b63fa[_0x9dda('0x5')]][_0x9dda('0x28')]=utils[_0x9dda('0x12')]();queues[_0x5b63fa[_0x9dda('0x5')]][_0x9dda('0x7')]=_0x9dda('0x2d');utils[_0x9dda('0x2')](util[_0x9dda('0x3')](_0x9dda('0x2e'),_0x5b63fa[_0x9dda('0x5')],queues[_0x5b63fa[_0x9dda('0x5')]][_0x9dda('0x1d')],queues[_0x5b63fa[_0x9dda('0x5')]][_0x9dda('0x7')]));}}catch(_0x336882){utils[_0x9dda('0x2b')](util[_0x9dda('0x3')](_0x9dda('0x2c'),_0x5b63fa[_0x9dda('0x5')]),_0x336882);}};exports[_0x9dda('0x2f')]=function(_0x18df9e){try{if(!_[_0x9dda('0x15')](queues[_0x18df9e['uniqueid']])){utils['debug'](util[_0x9dda('0x3')](_0x9dda('0x30'),_0x18df9e[_0x9dda('0x5')]),_0x18df9e);utils[_0x9dda('0x2')](util[_0x9dda('0x3')](_0x9dda('0x31'),_0x18df9e[_0x9dda('0x5')],queues[_0x18df9e['uniqueid']][_0x9dda('0x1d')],_0x18df9e[_0x9dda('0x32')],_0x18df9e['connectedlinename']));queues[_0x18df9e[_0x9dda('0x5')]]['queuecallerleave']=!![];queues[_0x18df9e[_0x9dda('0x5')]]['queuecallerleaveAt']=utils['now']();queues[_0x18df9e['uniqueid']]['holdtime']=utils[_0x9dda('0x33')](queues[_0x18df9e[_0x9dda('0x5')]][_0x9dda('0x17')],queues[_0x18df9e['uniqueid']][_0x9dda('0x34')]);queues[_0x18df9e[_0x9dda('0x5')]][_0x9dda('0x11')]=_0x18df9e[_0x9dda('0x11')];queues[_0x18df9e[_0x9dda('0x5')]][_0x9dda('0x35')]=_0x18df9e[_0x9dda('0x35')];queues[_0x18df9e[_0x9dda('0x5')]][_0x9dda('0x32')]=_0x18df9e[_0x9dda('0x32')];queues[_0x18df9e[_0x9dda('0x5')]][_0x9dda('0x36')]=_0x18df9e[_0x9dda('0x36')];}}catch(_0x1490b4){utils[_0x9dda('0x2b')](util[_0x9dda('0x3')]('[%s][queues][queuecallerleave]',_0x18df9e['uniqueid']),_0x1490b4);}};exports[_0x9dda('0x37')]=function(_0x5efef4){try{if(!_[_0x9dda('0x15')](queues[_0x5efef4[_0x9dda('0x5')]])){utils[_0x9dda('0x16')](util[_0x9dda('0x3')](_0x9dda('0x38'),_0x5efef4['uniqueid']),_0x5efef4);utils[_0x9dda('0x2')](util[_0x9dda('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5efef4[_0x9dda('0x5')],queues[_0x5efef4[_0x9dda('0x5')]][_0x9dda('0x1d')],_0x5efef4[_0x9dda('0x39')],_0x5efef4[_0x9dda('0x3a')]));queues[_0x5efef4[_0x9dda('0x5')]][_0x9dda('0x18')]=![];queues[_0x5efef4[_0x9dda('0x5')]][_0x9dda('0x18')]=![];queues[_0x5efef4[_0x9dda('0x5')]][_0x9dda('0x28')]=null;queues[_0x5efef4['uniqueid']][_0x9dda('0x19')]=![];queues[_0x5efef4[_0x9dda('0x5')]][_0x9dda('0x7')]=null;queues[_0x5efef4['uniqueid']][_0x9dda('0x26')]=null;queues[_0x5efef4[_0x9dda('0x5')]][_0x9dda('0x3b')]=!![];queues[_0x5efef4[_0x9dda('0x5')]]['accountcode']=_0x5efef4[_0x9dda('0x3a')];queues[_0x5efef4[_0x9dda('0x5')]][_0x9dda('0x3c')]=_0x5efef4[_0x9dda('0x39')];}}catch(_0x432934){utils[_0x9dda('0x2b')](util[_0x9dda('0x3')](_0x9dda('0x38'),_0x5efef4[_0x9dda('0x5')]),_0x432934);}};exports[_0x9dda('0x3d')]=function(_0x655aa4){try{if(!_[_0x9dda('0x15')](queues[_0x655aa4['uniqueid']])){if(queues[_0x655aa4['uniqueid']][_0x9dda('0x17')]){utils[_0x9dda('0x16')](util[_0x9dda('0x3')]('[%s][queues][agentcomplete]',_0x655aa4[_0x9dda('0x5')]),_0x655aa4);queues[_0x655aa4['uniqueid']][_0x9dda('0x18')]=![];queues[_0x655aa4['uniqueid']]['queuecallerabandon']=![];queues[_0x655aa4[_0x9dda('0x5')]][_0x9dda('0x28')]=null;queues[_0x655aa4[_0x9dda('0x5')]][_0x9dda('0x19')]=![];queues[_0x655aa4['uniqueid']][_0x9dda('0x26')]=null;queues[_0x655aa4[_0x9dda('0x5')]][_0x9dda('0x3b')]=!![];queues[_0x655aa4['uniqueid']][_0x9dda('0x3c')]=_0x655aa4[_0x9dda('0x39')];queues[_0x655aa4[_0x9dda('0x5')]][_0x9dda('0x3e')]=!![];queues[_0x655aa4[_0x9dda('0x5')]][_0x9dda('0x1a')]=utils[_0x9dda('0x12')]();if(_0x655aa4[_0x9dda('0x3f')]==_0x9dda('0x40')){if(!queues[_0x655aa4[_0x9dda('0x5')]][_0x9dda('0x40')]){queues[_0x655aa4[_0x9dda('0x5')]][_0x9dda('0x7')]=_0x9dda('0x41');}}else{queues[_0x655aa4[_0x9dda('0x5')]]['queuecallerexitreason']=_0x9dda('0x42')+_0x655aa4[_0x9dda('0x3f')][_0x9dda('0x24')]();}utils[_0x9dda('0x2')](util['format'](_0x9dda('0x43'),_0x655aa4[_0x9dda('0x5')],queues[_0x655aa4[_0x9dda('0x5')]][_0x9dda('0x1d')],_0x655aa4[_0x9dda('0x39')],queues[_0x655aa4[_0x9dda('0x5')]][_0x9dda('0x7')]));writeDB(queues[_0x655aa4[_0x9dda('0x5')]]);}}}catch(_0x6c5678){utils['error'](util[_0x9dda('0x3')]('[%s][queues][agentcomplete]',_0x655aa4[_0x9dda('0x5')]),_0x6c5678);}};exports['blindtransfer']=function(_0x49a566){try{if(!_['isNil'](queues[_0x49a566[_0x9dda('0x44')]])){utils[_0x9dda('0x16')](util[_0x9dda('0x3')]('[%s][queues][blindtransfer]',_0x49a566[_0x9dda('0x5')]),_0x49a566);queues[_0x49a566[_0x9dda('0x44')]][_0x9dda('0x40')]=!![];queues[_0x49a566[_0x9dda('0x44')]][_0x9dda('0x45')]='BLIND';queues[_0x49a566[_0x9dda('0x44')]][_0x9dda('0x46')]=_0x49a566[_0x9dda('0x47')];queues[_0x49a566[_0x9dda('0x44')]]['transferuniqueid']=_0x49a566[_0x9dda('0x44')];queues[_0x49a566['transfereeuniqueid']]['queuecallerexitreason']=_0x9dda('0x48');utils[_0x9dda('0x2')](util[_0x9dda('0x3')](_0x9dda('0x49'),_0x49a566[_0x9dda('0x5')],queues[_0x49a566[_0x9dda('0x44')]][_0x9dda('0x1d')],_0x49a566[_0x9dda('0x44')],_0x49a566[_0x9dda('0x47')]));}}catch(_0x23a381){utils[_0x9dda('0x2b')](util[_0x9dda('0x3')](_0x9dda('0x4a'),_0x49a566[_0x9dda('0x5')]),_0x23a381);}};exports[_0x9dda('0x4b')]=function(_0x199e05){try{utils['debug'](util[_0x9dda('0x3')](_0x9dda('0x4c'),_0x199e05['origtransfereruniqueid']),_0x199e05);if(_0x199e05[_0x9dda('0x4d')]==_0x199e05[_0x9dda('0x4e')]){if(!_[_0x9dda('0x15')](queues[_0x199e05[_0x9dda('0x4f')]])){utils[_0x9dda('0x2')](util[_0x9dda('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x199e05[_0x9dda('0x4d')],queues[_0x199e05[_0x9dda('0x4f')]][_0x9dda('0x1d')],_0x199e05[_0x9dda('0x50')]));queues[_0x199e05[_0x9dda('0x4f')]]['transfer']=!![];queues[_0x199e05[_0x9dda('0x4f')]][_0x9dda('0x45')]=_0x9dda('0x51');queues[_0x199e05[_0x9dda('0x4f')]][_0x9dda('0x46')]=_0x199e05[_0x9dda('0x50')];queues[_0x199e05[_0x9dda('0x4f')]][_0x9dda('0x52')]=_0x199e05['origtransfereruniqueid'];queues[_0x199e05['secondtransfererlinkedid']][_0x9dda('0x7')]='ATTENDEDTRANSFER';}if(!_[_0x9dda('0x15')](queues[_0x199e05[_0x9dda('0x4e')]])){if(_0x199e05[_0x9dda('0x53')]&&queues[_0x199e05[_0x9dda('0x53')]]){queues[_0x199e05[_0x9dda('0x53')]][_0x9dda('0x1e')]=0x1;queues[_0x199e05[_0x9dda('0x44')]]=_['clone'](queues[_0x199e05[_0x9dda('0x53')]]);queues[_0x199e05[_0x9dda('0x44')]]['transfereduniqueid']=_0x199e05['transfertargetuniqueid'];queues[_0x199e05[_0x9dda('0x44')]][_0x9dda('0x1e')]=0x2;queues[_0x199e05['transfereeuniqueid']][_0x9dda('0x54')]=queues[_0x199e05['secondtransfererlinkedid']][_0x9dda('0x54')];queues[_0x199e05[_0x9dda('0x44')]][_0x9dda('0x55')]=queues[_0x199e05[_0x9dda('0x4f')]][_0x9dda('0x55')];queues[_0x199e05[_0x9dda('0x44')]][_0x9dda('0x34')]=utils[_0x9dda('0x12')]();queues[_0x199e05[_0x9dda('0x44')]][_0x9dda('0x17')]=utils[_0x9dda('0x12')]();queues[_0x199e05[_0x9dda('0x44')]][_0x9dda('0x56')]=0x0;queues[_0x199e05[_0x9dda('0x44')]]['mohtime']=0x0;utils[_0x9dda('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x199e05['origtransfereruniqueid'],queues[_0x199e05[_0x9dda('0x44')]][_0x9dda('0x1d')],queues[_0x199e05['transfereeuniqueid']][_0x9dda('0x54')],queues[_0x199e05[_0x9dda('0x44')]][_0x9dda('0x55')]));}else{utils[_0x9dda('0x2')](util['format'](_0x9dda('0x57'),_0x199e05[_0x9dda('0x4d')],queues[_0x199e05[_0x9dda('0x4e')]][_0x9dda('0x1d')],_0x199e05['secondtransfererlinkedid']));queues[_0x199e05['origtransfererlinkedid']]['transfereduniqueid']=_0x199e05['secondtransfererlinkedid'];}}}else if(_0x199e05[_0x9dda('0x58')]==_0x199e05[_0x9dda('0x4f')]){if(!_[_0x9dda('0x15')](queues[_0x199e05[_0x9dda('0x4e')]])){utils[_0x9dda('0x2')](util[_0x9dda('0x3')](_0x9dda('0x59'),_0x199e05[_0x9dda('0x4d')],queues[_0x199e05[_0x9dda('0x4e')]][_0x9dda('0x1d')],_0x199e05['secondtransfereruniqueid'],_0x199e05['secondtransfererexten']));queues[_0x199e05['origtransfererlinkedid']][_0x9dda('0x40')]=!![];queues[_0x199e05[_0x9dda('0x4e')]]['transfertype']=_0x9dda('0x51');queues[_0x199e05['origtransfererlinkedid']][_0x9dda('0x46')]=_0x199e05[_0x9dda('0x5a')];queues[_0x199e05[_0x9dda('0x4e')]][_0x9dda('0x52')]=_0x199e05[_0x9dda('0x58')];queues[_0x199e05[_0x9dda('0x4e')]][_0x9dda('0x7')]=_0x9dda('0x5b');}if(!_[_0x9dda('0x15')](queues[_0x199e05[_0x9dda('0x4f')]])){if(_0x199e05[_0x9dda('0x5c')]&&queues[_0x199e05[_0x9dda('0x5c')]]){queues[_0x199e05['transfertargetlinkedid']][_0x9dda('0x1e')]=0x1;queues[_0x199e05['transfertargetuniqueid']]=_['clone'](queues[_0x199e05['transfertargetlinkedid']]);queues[_0x199e05[_0x9dda('0x5d')]][_0x9dda('0xd')]=_0x199e05[_0x9dda('0x5d')];queues[_0x199e05[_0x9dda('0x5d')]][_0x9dda('0x1e')]=0x2;queues[_0x199e05['transfertargetuniqueid']]['calleridnum']=queues[_0x199e05[_0x9dda('0x4e')]]['calleridnum'];queues[_0x199e05[_0x9dda('0x5d')]][_0x9dda('0x55')]=queues[_0x199e05[_0x9dda('0x4e')]][_0x9dda('0x55')];queues[_0x199e05[_0x9dda('0x5d')]]['queuecallerjoinAt']=utils[_0x9dda('0x12')]();queues[_0x199e05['transfertargetuniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x199e05[_0x9dda('0x5d')]][_0x9dda('0x56')]=0x0;queues[_0x199e05[_0x9dda('0x5d')]][_0x9dda('0x5e')]=0x0;utils['info'](util[_0x9dda('0x3')](_0x9dda('0x5f'),_0x199e05[_0x9dda('0x4d')],queues[_0x199e05['transfertargetuniqueid']][_0x9dda('0x1d')],queues[_0x199e05[_0x9dda('0x5d')]]['transfereduniqueid'],queues[_0x199e05['transfertargetuniqueid']]['calleridnum'],queues[_0x199e05[_0x9dda('0x5d')]][_0x9dda('0x55')]));}else{utils[_0x9dda('0x2')](util['format'](_0x9dda('0x57'),_0x199e05[_0x9dda('0x4d')],queues[_0x199e05[_0x9dda('0x4f')]][_0x9dda('0x1d')],_0x199e05[_0x9dda('0x4e')]));queues[_0x199e05[_0x9dda('0x4f')]]['transfereduniqueid']=_0x199e05[_0x9dda('0x4e')];}}}}catch(_0xc0cf3a){utils['error'](util[_0x9dda('0x3')](_0x9dda('0x4c'),_0x199e05[_0x9dda('0x4d')]),_0xc0cf3a);}};exports['musiconholdstart']=function(_0x70b92c){try{if(!_[_0x9dda('0x15')](queues[_0x70b92c['uniqueid']])){utils[_0x9dda('0x16')](util[_0x9dda('0x3')](_0x9dda('0x60'),_0x70b92c[_0x9dda('0x5')]),_0x70b92c);queues[_0x70b92c['uniqueid']][_0x9dda('0x61')]=utils[_0x9dda('0x12')]();utils[_0x9dda('0x2')](util[_0x9dda('0x3')](_0x9dda('0x62'),_0x70b92c['uniqueid'],queues[_0x70b92c['uniqueid']]['name'],queues[_0x70b92c[_0x9dda('0x5')]][_0x9dda('0x61')]));}}catch(_0x125851){utils[_0x9dda('0x2b')](util[_0x9dda('0x3')](_0x9dda('0x60'),_0x70b92c[_0x9dda('0x5')]),_0x125851);}};exports[_0x9dda('0x63')]=function(_0xf771f4){try{if(!_[_0x9dda('0x15')](queues[_0xf771f4[_0x9dda('0x5')]])){if(!_['isNil'](queues[_0xf771f4[_0x9dda('0x5')]][_0x9dda('0x61')])){utils[_0x9dda('0x16')](util['format'](_0x9dda('0x64'),_0xf771f4[_0x9dda('0x5')]),_0xf771f4);queues[_0xf771f4[_0x9dda('0x5')]][_0x9dda('0x5e')]+=utils[_0x9dda('0x33')](utils[_0x9dda('0x12')](),queues[_0xf771f4[_0x9dda('0x5')]][_0x9dda('0x61')]);utils[_0x9dda('0x2')](util[_0x9dda('0x3')](_0x9dda('0x65'),_0xf771f4[_0x9dda('0x5')],queues[_0xf771f4['uniqueid']][_0x9dda('0x1d')],queues[_0xf771f4['uniqueid']][_0x9dda('0x5e')]));delete queues[_0xf771f4[_0x9dda('0x5')]][_0x9dda('0x61')];}}}catch(_0x118d29){utils[_0x9dda('0x2b')](util['format'](_0x9dda('0x64'),_0xf771f4['uniqueid']),_0x118d29);}}; \ No newline at end of file +var _0xe647=['position','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','now','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','ABANDONED','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','agentcomplete','assigned','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','origtransfererlinkedid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s'];(function(_0x599361,_0x402973){var _0x5370d1=function(_0x34ba6b){while(--_0x34ba6b){_0x599361['push'](_0x599361['shift']());}};_0x5370d1(++_0x402973);}(_0xe647,0xc2));var _0x7e64=function(_0x4414fb,_0x4d5b34){_0x4414fb=_0x4414fb-0x0;var _0x3f7335=_0xe647[_0x4414fb];return _0x3f7335;};'use strict';var _=require(_0x7e64('0x0'));var util=require(_0x7e64('0x1'));var utils=require(_0x7e64('0x2'));var queues={};function writeDB(_0x43cd25){utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x5'),_0x43cd25[_0x7e64('0x6')],_0x43cd25[_0x7e64('0x7')],_0x43cd25[_0x7e64('0x8')],_0x43cd25['lastAssignedTo'],_0x43cd25[_0x7e64('0x9')],_0x43cd25[_0x7e64('0xa')],_0x43cd25[_0x7e64('0xb')]));if(_0x43cd25[_0x7e64('0x8')]){utils[_0x7e64('0xc')](_0x43cd25[_0x7e64('0x8')])['then'](function(_0x288097){if(_0x288097){_0x43cd25[_0x7e64('0xd')]=_0x288097[_0x7e64('0xd')];}utils['request']('CreateVoiceQueueReport',_0x43cd25);});}else{utils[_0x7e64('0xe')]('CreateVoiceQueueReport',_0x43cd25);}if(_0x43cd25['transfereduniqueid']){delete queues[_0x43cd25[_0x7e64('0xf')]];}else{delete queues[_0x43cd25[_0x7e64('0x6')]];}}exports[_0x7e64('0x10')]=function(_0x497354){try{utils[_0x7e64('0x11')](util[_0x7e64('0x4')](_0x7e64('0x12'),_0x497354[_0x7e64('0x6')]),_0x497354);utils[_0x7e64('0x3')](util['format'](_0x7e64('0x13'),_0x497354[_0x7e64('0x6')],_0x497354[_0x7e64('0x8')],_0x497354[_0x7e64('0x14')]));queues[_0x497354[_0x7e64('0x6')]]=_['assign'](_0x497354,{'originalposition':_0x497354[_0x7e64('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x3bdb94){utils[_0x7e64('0x15')](util[_0x7e64('0x4')](_0x7e64('0x12'),_0x497354[_0x7e64('0x6')]),_0x3bdb94);}};exports[_0x7e64('0x16')]=function(_0x3caf77){try{if(!_[_0x7e64('0x17')](queues[_0x3caf77['uniqueid']])){utils[_0x7e64('0x11')](util[_0x7e64('0x4')](_0x7e64('0x18'),_0x3caf77[_0x7e64('0x6')]),_0x3caf77);if(queues[_0x3caf77['uniqueid']][_0x7e64('0x19')]){if(!queues[_0x3caf77[_0x7e64('0x6')]][_0x7e64('0x1a')]&&!queues[_0x3caf77['uniqueid']][_0x7e64('0x1b')]){queues[_0x3caf77['uniqueid']][_0x7e64('0x1c')]=!![];queues[_0x3caf77['uniqueid']][_0x7e64('0x1d')]=utils['now']();queues[_0x3caf77[_0x7e64('0x6')]][_0x7e64('0xb')]=_0x7e64('0x1e');}utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x1f'),_0x3caf77[_0x7e64('0x6')],queues[_0x3caf77['uniqueid']][_0x7e64('0x20')],queues[_0x3caf77[_0x7e64('0x6')]][_0x7e64('0xb')]));writeDB(queues[_0x3caf77[_0x7e64('0x6')]]);}else if(queues[_0x3caf77['uniqueid']]['transfereduniqueid']){utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x21'),_0x3caf77[_0x7e64('0x6')],queues[_0x3caf77['uniqueid']][_0x7e64('0x20')],queues[_0x3caf77[_0x7e64('0x6')]][_0x7e64('0xf')]));queues[queues[_0x3caf77[_0x7e64('0x6')]][_0x7e64('0xf')]]=queues[_0x3caf77['uniqueid']];queues[queues[_0x3caf77[_0x7e64('0x6')]]['transfereduniqueid']][_0x7e64('0x22')]=0x2;delete queues[_0x3caf77['uniqueid']];}}}catch(_0x1137e9){utils[_0x7e64('0x15')](util[_0x7e64('0x4')](_0x7e64('0x18'),_0x3caf77[_0x7e64('0x6')]),_0x1137e9);}};exports[_0x7e64('0x23')]=function(_0x370425){try{utils[_0x7e64('0x11')](util[_0x7e64('0x4')](_0x7e64('0x24'),_0x370425['uniqueid']),_0x370425);if(!_[_0x7e64('0x17')](_0x370425[_0x7e64('0x25')][_0x7e64('0x26')])&&_0x370425[_0x7e64('0x27')][_0x7e64('0x28')]()!==_0x7e64('0x29')){if(!_[_0x7e64('0x17')](queues[_0x370425[_0x7e64('0x6')]])){queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0x1a')]=![];queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0x2a')]=null;queues[_0x370425['uniqueid']]['queuecallerexit']=!![];queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0x2b')]=utils[_0x7e64('0x2c')]();queues[_0x370425['uniqueid']][_0x7e64('0xb')]=_0x370425[_0x7e64('0x27')]['toUpperCase']();utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x2d'),_0x370425['uniqueid'],queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0x20')],_0x370425['value'],queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0xb')]));writeDB(queues[_0x370425[_0x7e64('0x6')]]);}}else if(!_[_0x7e64('0x17')](_0x370425[_0x7e64('0x25')][_0x7e64('0x2e')])){if(!_['isNil'](queues[_0x370425[_0x7e64('0x6')]])&&!queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0x1a')]){queues[_0x370425['uniqueid']][_0x7e64('0x1a')]=![];queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0x2a')]=null;queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0x1b')]=!![];queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0x2b')]=utils[_0x7e64('0x2c')]();queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0xb')]=_0x7e64('0x2f');utils[_0x7e64('0x3')](util[_0x7e64('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x370425[_0x7e64('0x6')],queues[_0x370425['uniqueid']][_0x7e64('0x20')],_0x370425[_0x7e64('0x27')],queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0xb')]));}}}catch(_0x2e17ec){utils[_0x7e64('0x15')](util[_0x7e64('0x4')](_0x7e64('0x24'),_0x370425['uniqueid']),_0x2e17ec);}};exports[_0x7e64('0x1a')]=function(_0x424755){try{if(!_[_0x7e64('0x17')](queues[_0x424755['uniqueid']])){utils[_0x7e64('0x11')](util['format']('[%s][queues][queuecallerabandon]',_0x424755[_0x7e64('0x6')]),_0x424755);queues[_0x424755[_0x7e64('0x6')]][_0x7e64('0x1b')]=![];queues[_0x424755[_0x7e64('0x6')]][_0x7e64('0x2b')]=null;queues[_0x424755['uniqueid']][_0x7e64('0x1a')]=!![];queues[_0x424755[_0x7e64('0x6')]][_0x7e64('0x2a')]=utils['now']();queues[_0x424755[_0x7e64('0x6')]][_0x7e64('0xb')]=_0x7e64('0x30');utils['info'](util[_0x7e64('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x424755[_0x7e64('0x6')],queues[_0x424755[_0x7e64('0x6')]]['name'],queues[_0x424755['uniqueid']][_0x7e64('0xb')]));}}catch(_0x2bc173){utils['error'](util['format'](_0x7e64('0x31'),_0x424755[_0x7e64('0x6')]),_0x2bc173);}};exports['queuecallerleave']=function(_0x10bf7d){try{if(!_[_0x7e64('0x17')](queues[_0x10bf7d[_0x7e64('0x6')]])){utils[_0x7e64('0x11')](util[_0x7e64('0x4')](_0x7e64('0x32'),_0x10bf7d[_0x7e64('0x6')]),_0x10bf7d);utils['info'](util[_0x7e64('0x4')](_0x7e64('0x33'),_0x10bf7d[_0x7e64('0x6')],queues[_0x10bf7d[_0x7e64('0x6')]]['name'],_0x10bf7d[_0x7e64('0x34')],_0x10bf7d[_0x7e64('0x35')]));queues[_0x10bf7d[_0x7e64('0x6')]][_0x7e64('0x36')]=!![];queues[_0x10bf7d[_0x7e64('0x6')]]['queuecallerleaveAt']=utils[_0x7e64('0x2c')]();queues[_0x10bf7d['uniqueid']][_0x7e64('0x37')]=utils['diffTime'](queues[_0x10bf7d[_0x7e64('0x6')]]['queuecallerleaveAt'],queues[_0x10bf7d['uniqueid']][_0x7e64('0x38')]);queues[_0x10bf7d[_0x7e64('0x6')]][_0x7e64('0x14')]=_0x10bf7d[_0x7e64('0x14')];queues[_0x10bf7d[_0x7e64('0x6')]][_0x7e64('0x39')]=_0x10bf7d[_0x7e64('0x39')];queues[_0x10bf7d[_0x7e64('0x6')]]['connectedlinenum']=_0x10bf7d[_0x7e64('0x34')];queues[_0x10bf7d['uniqueid']][_0x7e64('0x35')]=_0x10bf7d['connectedlinename'];}}catch(_0x30b1b8){utils[_0x7e64('0x15')](util[_0x7e64('0x4')](_0x7e64('0x32'),_0x10bf7d[_0x7e64('0x6')]),_0x30b1b8);}};exports[_0x7e64('0x3a')]=function(_0x50dec5){try{if(!_[_0x7e64('0x17')](queues[_0x50dec5[_0x7e64('0x6')]])){utils[_0x7e64('0x11')](util[_0x7e64('0x4')](_0x7e64('0x3b'),_0x50dec5[_0x7e64('0x6')]),_0x50dec5);utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x3c'),_0x50dec5[_0x7e64('0x6')],queues[_0x50dec5[_0x7e64('0x6')]][_0x7e64('0x20')],_0x50dec5[_0x7e64('0x3d')],_0x50dec5[_0x7e64('0x3e')]));queues[_0x50dec5[_0x7e64('0x6')]][_0x7e64('0x1a')]=![];queues[_0x50dec5['uniqueid']][_0x7e64('0x1a')]=![];queues[_0x50dec5['uniqueid']]['queuecallerabandonAt']=null;queues[_0x50dec5['uniqueid']][_0x7e64('0x1b')]=![];queues[_0x50dec5[_0x7e64('0x6')]][_0x7e64('0xb')]=null;queues[_0x50dec5[_0x7e64('0x6')]]['queuecallerexitAt']=null;queues[_0x50dec5[_0x7e64('0x6')]]['assigned']=!![];queues[_0x50dec5[_0x7e64('0x6')]]['accountcode']=_0x50dec5[_0x7e64('0x3e')];queues[_0x50dec5[_0x7e64('0x6')]][_0x7e64('0x3f')]=_0x50dec5[_0x7e64('0x3d')];}}catch(_0x4d4661){utils[_0x7e64('0x15')](util[_0x7e64('0x4')](_0x7e64('0x3b'),_0x50dec5[_0x7e64('0x6')]),_0x4d4661);}};exports[_0x7e64('0x40')]=function(_0x58b13b){try{if(!_['isNil'](queues[_0x58b13b['uniqueid']])){if(queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0x19')]){utils[_0x7e64('0x11')](util[_0x7e64('0x4')]('[%s][queues][agentcomplete]',_0x58b13b[_0x7e64('0x6')]),_0x58b13b);queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0x1a')]=![];queues[_0x58b13b['uniqueid']][_0x7e64('0x1a')]=![];queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0x2a')]=null;queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0x1b')]=![];queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0x2b')]=null;queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0x41')]=!![];queues[_0x58b13b['uniqueid']][_0x7e64('0x3f')]=_0x58b13b[_0x7e64('0x3d')];queues[_0x58b13b[_0x7e64('0x6')]]['queuecallercomplete']=!![];queues[_0x58b13b['uniqueid']]['queuecallercompleteAt']=utils['now']();if(_0x58b13b['reason']==_0x7e64('0x42')){if(!queues[_0x58b13b[_0x7e64('0x6')]]['transfer']){queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0xb')]=_0x7e64('0x43');}}else{queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0xb')]=_0x7e64('0x44')+_0x58b13b[_0x7e64('0x45')][_0x7e64('0x28')]();}utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x46'),_0x58b13b[_0x7e64('0x6')],queues[_0x58b13b['uniqueid']][_0x7e64('0x20')],_0x58b13b[_0x7e64('0x3d')],queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0xb')]));writeDB(queues[_0x58b13b[_0x7e64('0x6')]]);}}}catch(_0xfbcfd4){utils['error'](util['format'](_0x7e64('0x47'),_0x58b13b[_0x7e64('0x6')]),_0xfbcfd4);}};exports[_0x7e64('0x48')]=function(_0x33983b){try{if(!_['isNil'](queues[_0x33983b['transfereeuniqueid']])){utils[_0x7e64('0x11')](util['format'](_0x7e64('0x49'),_0x33983b[_0x7e64('0x6')]),_0x33983b);queues[_0x33983b['transfereeuniqueid']][_0x7e64('0x42')]=!![];queues[_0x33983b[_0x7e64('0x4a')]][_0x7e64('0x4b')]=_0x7e64('0x4c');queues[_0x33983b[_0x7e64('0x4a')]][_0x7e64('0x4d')]=_0x33983b[_0x7e64('0x4e')];queues[_0x33983b['transfereeuniqueid']]['transferuniqueid']=_0x33983b[_0x7e64('0x4a')];queues[_0x33983b[_0x7e64('0x4a')]]['queuecallerexitreason']=_0x7e64('0x4f');utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x50'),_0x33983b[_0x7e64('0x6')],queues[_0x33983b[_0x7e64('0x4a')]][_0x7e64('0x20')],_0x33983b[_0x7e64('0x4a')],_0x33983b[_0x7e64('0x4e')]));}}catch(_0x3d430c){utils[_0x7e64('0x15')](util[_0x7e64('0x4')](_0x7e64('0x49'),_0x33983b[_0x7e64('0x6')]),_0x3d430c);}};exports[_0x7e64('0x51')]=function(_0x4179f4){try{utils['debug'](util[_0x7e64('0x4')]('[%s][queues][attendedtransfer]',_0x4179f4[_0x7e64('0x52')]),_0x4179f4);if(_0x4179f4[_0x7e64('0x52')]==_0x4179f4['origtransfererlinkedid']){if(!_[_0x7e64('0x17')](queues[_0x4179f4[_0x7e64('0x53')]])){utils[_0x7e64('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4179f4[_0x7e64('0x52')],queues[_0x4179f4[_0x7e64('0x53')]][_0x7e64('0x20')],_0x4179f4[_0x7e64('0x54')]));queues[_0x4179f4[_0x7e64('0x53')]][_0x7e64('0x42')]=!![];queues[_0x4179f4[_0x7e64('0x53')]]['transfertype']=_0x7e64('0x55');queues[_0x4179f4[_0x7e64('0x53')]][_0x7e64('0x4d')]=_0x4179f4[_0x7e64('0x54')];queues[_0x4179f4[_0x7e64('0x53')]][_0x7e64('0x56')]=_0x4179f4['origtransfereruniqueid'];queues[_0x4179f4[_0x7e64('0x53')]]['queuecallerexitreason']=_0x7e64('0x57');}if(!_[_0x7e64('0x17')](queues[_0x4179f4['origtransfererlinkedid']])){if(_0x4179f4[_0x7e64('0x58')]&&queues[_0x4179f4[_0x7e64('0x58')]]){queues[_0x4179f4[_0x7e64('0x58')]][_0x7e64('0x22')]=0x1;queues[_0x4179f4['transfereeuniqueid']]=_['clone'](queues[_0x4179f4['transfereelinkedid']]);queues[_0x4179f4['transfereeuniqueid']][_0x7e64('0xf')]=_0x4179f4['transfertargetuniqueid'];queues[_0x4179f4[_0x7e64('0x4a')]][_0x7e64('0x22')]=0x2;queues[_0x4179f4[_0x7e64('0x4a')]]['calleridnum']=queues[_0x4179f4[_0x7e64('0x53')]][_0x7e64('0x9')];queues[_0x4179f4['transfereeuniqueid']]['calleridname']=queues[_0x4179f4['secondtransfererlinkedid']][_0x7e64('0x59')];queues[_0x4179f4[_0x7e64('0x4a')]][_0x7e64('0x38')]=utils['now']();queues[_0x4179f4[_0x7e64('0x4a')]][_0x7e64('0x19')]=utils[_0x7e64('0x2c')]();queues[_0x4179f4[_0x7e64('0x4a')]][_0x7e64('0x37')]=0x0;queues[_0x4179f4[_0x7e64('0x4a')]][_0x7e64('0x5a')]=0x0;utils['info'](util[_0x7e64('0x4')](_0x7e64('0x5b'),_0x4179f4[_0x7e64('0x52')],queues[_0x4179f4[_0x7e64('0x4a')]]['name'],queues[_0x4179f4['transfereeuniqueid']][_0x7e64('0x9')],queues[_0x4179f4['transfereeuniqueid']][_0x7e64('0x59')]));}else{utils['info'](util[_0x7e64('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x4179f4[_0x7e64('0x52')],queues[_0x4179f4[_0x7e64('0x5c')]][_0x7e64('0x20')],_0x4179f4[_0x7e64('0x53')]));queues[_0x4179f4[_0x7e64('0x5c')]][_0x7e64('0xf')]=_0x4179f4['secondtransfererlinkedid'];}}}else if(_0x4179f4[_0x7e64('0x5d')]==_0x4179f4['secondtransfererlinkedid']){if(!_[_0x7e64('0x17')](queues[_0x4179f4[_0x7e64('0x5c')]])){utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x5e'),_0x4179f4[_0x7e64('0x52')],queues[_0x4179f4['origtransfererlinkedid']][_0x7e64('0x20')],_0x4179f4[_0x7e64('0x5d')],_0x4179f4[_0x7e64('0x5f')]));queues[_0x4179f4[_0x7e64('0x5c')]][_0x7e64('0x42')]=!![];queues[_0x4179f4[_0x7e64('0x5c')]][_0x7e64('0x4b')]=_0x7e64('0x55');queues[_0x4179f4[_0x7e64('0x5c')]][_0x7e64('0x4d')]=_0x4179f4[_0x7e64('0x5f')];queues[_0x4179f4['origtransfererlinkedid']][_0x7e64('0x56')]=_0x4179f4[_0x7e64('0x5d')];queues[_0x4179f4[_0x7e64('0x5c')]][_0x7e64('0xb')]=_0x7e64('0x57');}if(!_[_0x7e64('0x17')](queues[_0x4179f4['secondtransfererlinkedid']])){if(_0x4179f4['transfertargetlinkedid']&&queues[_0x4179f4['transfertargetlinkedid']]){queues[_0x4179f4[_0x7e64('0x60')]][_0x7e64('0x22')]=0x1;queues[_0x4179f4[_0x7e64('0x61')]]=_[_0x7e64('0x62')](queues[_0x4179f4['transfertargetlinkedid']]);queues[_0x4179f4[_0x7e64('0x61')]][_0x7e64('0xf')]=_0x4179f4[_0x7e64('0x61')];queues[_0x4179f4[_0x7e64('0x61')]][_0x7e64('0x22')]=0x2;queues[_0x4179f4['transfertargetuniqueid']]['calleridnum']=queues[_0x4179f4['origtransfererlinkedid']]['calleridnum'];queues[_0x4179f4[_0x7e64('0x61')]][_0x7e64('0x59')]=queues[_0x4179f4[_0x7e64('0x5c')]][_0x7e64('0x59')];queues[_0x4179f4[_0x7e64('0x61')]][_0x7e64('0x38')]=utils[_0x7e64('0x2c')]();queues[_0x4179f4['transfertargetuniqueid']][_0x7e64('0x19')]=utils[_0x7e64('0x2c')]();queues[_0x4179f4[_0x7e64('0x61')]][_0x7e64('0x37')]=0x0;queues[_0x4179f4['transfertargetuniqueid']][_0x7e64('0x5a')]=0x0;utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x63'),_0x4179f4['origtransfereruniqueid'],queues[_0x4179f4[_0x7e64('0x61')]][_0x7e64('0x20')],queues[_0x4179f4[_0x7e64('0x61')]]['transfereduniqueid'],queues[_0x4179f4[_0x7e64('0x61')]][_0x7e64('0x9')],queues[_0x4179f4[_0x7e64('0x61')]][_0x7e64('0x59')]));}else{utils['info'](util[_0x7e64('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x4179f4[_0x7e64('0x52')],queues[_0x4179f4['secondtransfererlinkedid']][_0x7e64('0x20')],_0x4179f4[_0x7e64('0x5c')]));queues[_0x4179f4[_0x7e64('0x53')]][_0x7e64('0xf')]=_0x4179f4[_0x7e64('0x5c')];}}}}catch(_0x3ce4e5){utils[_0x7e64('0x15')](util['format'](_0x7e64('0x64'),_0x4179f4[_0x7e64('0x52')]),_0x3ce4e5);}};exports['musiconholdstart']=function(_0x41a2e8){try{if(!_[_0x7e64('0x17')](queues[_0x41a2e8['uniqueid']])){utils['debug'](util[_0x7e64('0x4')](_0x7e64('0x65'),_0x41a2e8[_0x7e64('0x6')]),_0x41a2e8);queues[_0x41a2e8[_0x7e64('0x6')]][_0x7e64('0x66')]=utils[_0x7e64('0x2c')]();utils[_0x7e64('0x3')](util['format'](_0x7e64('0x67'),_0x41a2e8[_0x7e64('0x6')],queues[_0x41a2e8[_0x7e64('0x6')]][_0x7e64('0x20')],queues[_0x41a2e8[_0x7e64('0x6')]]['musiconholdstartAt']));}}catch(_0x4e52fe){utils[_0x7e64('0x15')](util[_0x7e64('0x4')](_0x7e64('0x65'),_0x41a2e8[_0x7e64('0x6')]),_0x4e52fe);}};exports[_0x7e64('0x68')]=function(_0x21f19a){try{if(!_[_0x7e64('0x17')](queues[_0x21f19a[_0x7e64('0x6')]])){if(!_[_0x7e64('0x17')](queues[_0x21f19a[_0x7e64('0x6')]][_0x7e64('0x66')])){utils['debug'](util['format']('[%s][queues][musiconholdstop]',_0x21f19a['uniqueid']),_0x21f19a);queues[_0x21f19a['uniqueid']][_0x7e64('0x5a')]+=utils['diffTime'](utils[_0x7e64('0x2c')](),queues[_0x21f19a[_0x7e64('0x6')]][_0x7e64('0x66')]);utils['info'](util[_0x7e64('0x4')](_0x7e64('0x69'),_0x21f19a[_0x7e64('0x6')],queues[_0x21f19a[_0x7e64('0x6')]][_0x7e64('0x20')],queues[_0x21f19a[_0x7e64('0x6')]][_0x7e64('0x5a')]));delete queues[_0x21f19a[_0x7e64('0x6')]]['musiconholdstartAt'];}}}catch(_0x28c2a3){utils[_0x7e64('0x15')](util[_0x7e64('0x4')](_0x7e64('0x6a'),_0x21f19a[_0x7e64('0x6')]),_0x28c2a3);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 928a554..51bd169 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 _0xce14=['info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','name','UserId','CreateVoiceRecording','request','debug','format','[%s][recordings][newchannel]','linkedid','context','exten','channel','error','newstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','isNil','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util'];(function(_0x13649c,_0x5a9f73){var _0x5e3c15=function(_0x3c4c65){while(--_0x3c4c65){_0x13649c['push'](_0x13649c['shift']());}};_0x5e3c15(++_0x5a9f73);}(_0xce14,0x17f));var _0x4ce1=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xce14[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x4ce1('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x35a72f){utils[_0x4ce1('0x1')](util['format'](_0x4ce1('0x2'),_0x35a72f[_0x4ce1('0x3')]));if(_0x35a72f[_0x4ce1('0x4')]){utils[_0x4ce1('0x5')](_0x35a72f[_0x4ce1('0x4')])['then'](function(_0x10aaa0){if(_0x10aaa0){_0x35a72f[_0x4ce1('0x6')]=_0x10aaa0[_0x4ce1('0x7')];_0x35a72f[_0x4ce1('0x8')]=_0x10aaa0['id'];}utils['request'](_0x4ce1('0x9'),_0x35a72f);});}else{utils[_0x4ce1('0xa')](_0x4ce1('0x9'),_0x35a72f);}}exports['newchannel']=function(_0x1b5bd8){try{utils[_0x4ce1('0xb')](util[_0x4ce1('0xc')](_0x4ce1('0xd'),_0x1b5bd8['uniqueid']),_0x1b5bd8);if(_0x1b5bd8[_0x4ce1('0x3')]==_0x1b5bd8[_0x4ce1('0xe')]){utils[_0x4ce1('0x1')](util[_0x4ce1('0xc')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x1b5bd8[_0x4ce1('0x3')],_0x1b5bd8[_0x4ce1('0xf')],_0x1b5bd8[_0x4ce1('0x10')]));recordings[_0x1b5bd8[_0x4ce1('0x3')]]={'uniqueid':_0x1b5bd8[_0x4ce1('0x3')],'accountcode':_0x1b5bd8[_0x4ce1('0x4')],'exten':_0x1b5bd8[_0x4ce1('0x10')],'context':_0x1b5bd8[_0x4ce1('0xf')],'channel':_0x1b5bd8[_0x4ce1('0x11')],'monitors':[]};}}catch(_0x15407b){utils[_0x4ce1('0x12')](util['format'](_0x4ce1('0xd'),_0x1b5bd8['uniqueid']),_0x15407b);}};exports[_0x4ce1('0x13')]=function(_0x1bfd82){try{utils[_0x4ce1('0xb')](util[_0x4ce1('0xc')]('[%s][recordings][newstate]',_0x1bfd82[_0x4ce1('0x3')]),_0x1bfd82);if(!_['isNil'](recordings[_0x1bfd82['uniqueid']])&&_0x1bfd82['channelstate']==0x6){utils[_0x4ce1('0x1')](util[_0x4ce1('0xc')](_0x4ce1('0x14'),_0x1bfd82[_0x4ce1('0x3')],_0x1bfd82['context'],_0x1bfd82[_0x4ce1('0x11')]));}else if(!_['isNil'](recordings[_0x1bfd82['linkedid']])&&_0x1bfd82[_0x4ce1('0x15')]==0x6&&_0x1bfd82[_0x4ce1('0xf')]!=_0x4ce1('0x16')){utils[_0x4ce1('0x1')](util[_0x4ce1('0xc')](_0x4ce1('0x17'),_0x1bfd82[_0x4ce1('0x3')],_0x1bfd82[_0x4ce1('0xe')],_0x1bfd82['context'],_0x1bfd82[_0x4ce1('0x11')]));recordings[_0x1bfd82[_0x4ce1('0xe')]]['accountcode']=_0x1bfd82[_0x4ce1('0x4')];}}catch(_0x39eafa){utils['error'](util[_0x4ce1('0xc')](_0x4ce1('0x18'),_0x1bfd82['uniqueid']),_0x39eafa);}};exports['varset']=function(_0x555b05){try{if(!_[_0x4ce1('0x19')](_0x555b05['variable'])&&!_[_0x4ce1('0x19')](_0x555b05[_0x4ce1('0x1a')]['mixmonitor_filename'])){utils[_0x4ce1('0xb')](util[_0x4ce1('0xc')](_0x4ce1('0x1b'),_0x555b05[_0x4ce1('0x3')]),_0x555b05);utils[_0x4ce1('0x1')](util[_0x4ce1('0xc')](_0x4ce1('0x1c'),_0x555b05[_0x4ce1('0x3')],_0x555b05[_0x4ce1('0x1a')],_0x555b05[_0x4ce1('0x1d')]));if(_[_0x4ce1('0x1e')](_0x555b05[_0x4ce1('0x1d')],_0x4ce1('0x1f'))){_0x555b05[_0x4ce1('0x1d')]=_0x555b05[_0x4ce1('0x1d')][_0x4ce1('0x20')](_0x4ce1('0x1f'),_0x4ce1('0x21'));}if(recordings[_0x555b05['linkedid']]){var _0x2a9bc3=_[_0x4ce1('0x22')](recordings[_0x555b05[_0x4ce1('0xe')]][_0x4ce1('0x23')],{'value':_0x555b05[_0x4ce1('0x1d')]});if(_[_0x4ce1('0x19')](_0x2a9bc3)){recordings[_0x555b05['linkedid']][_0x4ce1('0x23')][_0x4ce1('0x24')]({'value':_0x555b05[_0x4ce1('0x1d')]});}}}}catch(_0x523d7f){utils['error'](util[_0x4ce1('0xc')](_0x4ce1('0x1b'),_0x555b05[_0x4ce1('0x3')]),_0x523d7f);}};exports[_0x4ce1('0x25')]=function(_0x10fe0f){try{if(!_[_0x4ce1('0x19')](recordings[_0x10fe0f['uniqueid']])){utils['debug'](util[_0x4ce1('0xc')](_0x4ce1('0x26'),_0x10fe0f['uniqueid']),_0x10fe0f);utils[_0x4ce1('0x1')](util[_0x4ce1('0xc')](_0x4ce1('0x27'),_0x10fe0f[_0x4ce1('0x3')],_0x10fe0f[_0x4ce1('0x28')],_0x10fe0f[_0x4ce1('0x29')],_0x10fe0f[_0x4ce1('0x2a')]));recordings[_0x10fe0f[_0x4ce1('0x3')]][_0x4ce1('0x28')]=_0x10fe0f[_0x4ce1('0x28')];recordings[_0x10fe0f[_0x4ce1('0x3')]]['calleridname']=_0x10fe0f[_0x4ce1('0x29')];recordings[_0x10fe0f[_0x4ce1('0x3')]][_0x4ce1('0x2b')]=_0x10fe0f['connectedlinenum'];recordings[_0x10fe0f['uniqueid']][_0x4ce1('0x2c')]=_0x10fe0f['connectedlinename'];if(recordings[_0x10fe0f[_0x4ce1('0x3')]][_0x4ce1('0x2d')]==_0x4ce1('0x2e')&&recordings[_0x10fe0f[_0x4ce1('0x3')]][_0x4ce1('0x4')]){recordings[_0x10fe0f[_0x4ce1('0x3')]][_0x4ce1('0x2b')]=recordings[_0x10fe0f['uniqueid']]['accountcode'];recordings[_0x10fe0f[_0x4ce1('0x3')]][_0x4ce1('0x2c')]='';}recordings[_0x10fe0f[_0x4ce1('0x3')]][_0x4ce1('0x23')][_0x4ce1('0x2f')](function(_0x137a39){var _0x5b082e=_[_0x4ce1('0x30')](recordings[_0x10fe0f[_0x4ce1('0x3')]]);_0x5b082e[_0x4ce1('0x1d')]=_0x137a39[_0x4ce1('0x1d')];writeDB(_0x5b082e);});delete recordings[_0x10fe0f[_0x4ce1('0x3')]];}}catch(_0x5b742f){utils[_0x4ce1('0x12')](util[_0x4ce1('0xc')](_0x4ce1('0x26'),_0x10fe0f[_0x4ce1('0x3')]),_0x5b742f);}};exports[_0x4ce1('0x31')]=function(_0x45866a){try{if(!_[_0x4ce1('0x19')](recordings[_0x45866a[_0x4ce1('0x3')]])){utils['debug'](util[_0x4ce1('0xc')](_0x4ce1('0x32'),_0x45866a[_0x4ce1('0x3')]),_0x45866a);utils[_0x4ce1('0x1')](util[_0x4ce1('0xc')](_0x4ce1('0x33'),_0x45866a[_0x4ce1('0x3')],_0x45866a[_0x4ce1('0x34')],_0x45866a['appdata']));if(_0x45866a[_0x4ce1('0x34')][_0x4ce1('0x35')]()==_0x4ce1('0x36')&&_[_0x4ce1('0x37')](_0x45866a[_0x4ce1('0x38')][_0x4ce1('0x35')](),_0x4ce1('0x39'))){var _0x3f1520=_0x45866a[_0x4ce1('0x38')]['split']('=');var _0x9d604c=_0x3f1520[0x0][_0x4ce1('0x3a')](_0x3f1520[0x0][_0x4ce1('0x3b')]('(')+0x1,_0x3f1520[0x0]['lastIndexOf'](')'));var _0x2c9585=_0x3f1520[0x1];recordings[_0x45866a[_0x4ce1('0x3')]][_0x9d604c]=_0x2c9585;}}}catch(_0x1e6240){utils[_0x4ce1('0x12')](util['format'](_0x4ce1('0x32'),_0x45866a[_0x4ce1('0x3')]),_0x1e6240);}};exports[_0x4ce1('0x3c')]=function(_0x9c86a9){try{if(!_['isNil'](recordings[_0x9c86a9['uniqueid']])){utils[_0x4ce1('0xb')](util['format'](_0x4ce1('0x3d'),_0x9c86a9[_0x4ce1('0x3')]),_0x9c86a9);utils[_0x4ce1('0x1')](util[_0x4ce1('0xc')](_0x4ce1('0x3e'),_0x9c86a9[_0x4ce1('0x3')],_0x9c86a9[_0x4ce1('0x3f')]));recordings[_0x9c86a9[_0x4ce1('0x3')]][_0x4ce1('0x3f')]=_0x9c86a9['queue'];}}catch(_0x4473b8){utils['error'](util[_0x4ce1('0xc')](_0x4ce1('0x3d'),_0x9c86a9['uniqueid']),_0x4473b8);}}; \ No newline at end of file +var _0x3cde=['[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','debug','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','format','[%s][recordings][writeDB]','getUserByInternal','accountcode','then','membername','name','UserId','CreateVoiceRecording','request','[%s][recordings][newchannel]','uniqueid','linkedid','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3cde,0x1b8));var _0xe3cd=function(_0x4854a9,_0x1f24bb){_0x4854a9=_0x4854a9-0x0;var _0x584bfd=_0x3cde[_0x4854a9];return _0x584bfd;};'use strict';var _=require(_0xe3cd('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x21a133){utils['info'](util[_0xe3cd('0x1')](_0xe3cd('0x2'),_0x21a133['uniqueid']));if(_0x21a133['accountcode']){utils[_0xe3cd('0x3')](_0x21a133[_0xe3cd('0x4')])[_0xe3cd('0x5')](function(_0x355272){if(_0x355272){_0x21a133[_0xe3cd('0x6')]=_0x355272[_0xe3cd('0x7')];_0x21a133[_0xe3cd('0x8')]=_0x355272['id'];}utils['request'](_0xe3cd('0x9'),_0x21a133);});}else{utils[_0xe3cd('0xa')](_0xe3cd('0x9'),_0x21a133);}}exports['newchannel']=function(_0x565358){try{utils['debug'](util['format'](_0xe3cd('0xb'),_0x565358[_0xe3cd('0xc')]),_0x565358);if(_0x565358['uniqueid']==_0x565358[_0xe3cd('0xd')]){utils[_0xe3cd('0xe')](util[_0xe3cd('0x1')](_0xe3cd('0xf'),_0x565358[_0xe3cd('0xc')],_0x565358[_0xe3cd('0x10')],_0x565358[_0xe3cd('0x11')]));recordings[_0x565358[_0xe3cd('0xc')]]={'uniqueid':_0x565358[_0xe3cd('0xc')],'accountcode':_0x565358[_0xe3cd('0x4')],'exten':_0x565358[_0xe3cd('0x11')],'context':_0x565358['context'],'channel':_0x565358['channel'],'monitors':[]};}}catch(_0x35b341){utils[_0xe3cd('0x12')](util[_0xe3cd('0x1')](_0xe3cd('0xb'),_0x565358[_0xe3cd('0xc')]),_0x35b341);}};exports['newstate']=function(_0x318e59){try{utils['debug'](util[_0xe3cd('0x1')]('[%s][recordings][newstate]',_0x318e59[_0xe3cd('0xc')]),_0x318e59);if(!_[_0xe3cd('0x13')](recordings[_0x318e59[_0xe3cd('0xc')]])&&_0x318e59[_0xe3cd('0x14')]==0x6){utils[_0xe3cd('0xe')](util[_0xe3cd('0x1')](_0xe3cd('0x15'),_0x318e59[_0xe3cd('0xc')],_0x318e59[_0xe3cd('0x10')],_0x318e59[_0xe3cd('0x16')]));}else if(!_[_0xe3cd('0x13')](recordings[_0x318e59[_0xe3cd('0xd')]])&&_0x318e59[_0xe3cd('0x14')]==0x6&&_0x318e59[_0xe3cd('0x10')]!=_0xe3cd('0x17')){utils[_0xe3cd('0xe')](util['format'](_0xe3cd('0x18'),_0x318e59[_0xe3cd('0xc')],_0x318e59[_0xe3cd('0xd')],_0x318e59[_0xe3cd('0x10')],_0x318e59[_0xe3cd('0x16')]));recordings[_0x318e59[_0xe3cd('0xd')]]['accountcode']=_0x318e59[_0xe3cd('0x4')];}}catch(_0x34edbf){utils[_0xe3cd('0x12')](util[_0xe3cd('0x1')]('[%s][recordings][newstate]',_0x318e59[_0xe3cd('0xc')]),_0x34edbf);}};exports[_0xe3cd('0x19')]=function(_0x1dec3a){try{if(!_['isNil'](_0x1dec3a[_0xe3cd('0x1a')])&&!_['isNil'](_0x1dec3a[_0xe3cd('0x1a')][_0xe3cd('0x1b')])){utils[_0xe3cd('0x1c')](util[_0xe3cd('0x1')](_0xe3cd('0x1d'),_0x1dec3a[_0xe3cd('0xc')]),_0x1dec3a);utils['info'](util['format'](_0xe3cd('0x1e'),_0x1dec3a[_0xe3cd('0xc')],_0x1dec3a[_0xe3cd('0x1a')],_0x1dec3a[_0xe3cd('0x1f')]));if(_[_0xe3cd('0x20')](_0x1dec3a[_0xe3cd('0x1f')],_0xe3cd('0x21'))){_0x1dec3a[_0xe3cd('0x1f')]=_0x1dec3a[_0xe3cd('0x1f')][_0xe3cd('0x22')](_0xe3cd('0x21'),_0xe3cd('0x23'));}if(recordings[_0x1dec3a[_0xe3cd('0xd')]]){var _0xd6e74c=_[_0xe3cd('0x24')](recordings[_0x1dec3a['linkedid']][_0xe3cd('0x25')],{'value':_0x1dec3a[_0xe3cd('0x1f')]});if(_[_0xe3cd('0x13')](_0xd6e74c)){recordings[_0x1dec3a[_0xe3cd('0xd')]][_0xe3cd('0x25')][_0xe3cd('0x26')]({'value':_0x1dec3a[_0xe3cd('0x1f')]});}}}}catch(_0x14d705){utils[_0xe3cd('0x12')](util[_0xe3cd('0x1')](_0xe3cd('0x1d'),_0x1dec3a['uniqueid']),_0x14d705);}};exports[_0xe3cd('0x27')]=function(_0x4dcfb2){try{if(!_[_0xe3cd('0x13')](recordings[_0x4dcfb2['uniqueid']])){utils[_0xe3cd('0x1c')](util[_0xe3cd('0x1')]('[%s][recordings][hangup]',_0x4dcfb2['uniqueid']),_0x4dcfb2);utils[_0xe3cd('0xe')](util[_0xe3cd('0x1')](_0xe3cd('0x28'),_0x4dcfb2[_0xe3cd('0xc')],_0x4dcfb2[_0xe3cd('0x29')],_0x4dcfb2['calleridname'],_0x4dcfb2[_0xe3cd('0x2a')]));recordings[_0x4dcfb2['uniqueid']][_0xe3cd('0x29')]=_0x4dcfb2[_0xe3cd('0x29')];recordings[_0x4dcfb2[_0xe3cd('0xc')]][_0xe3cd('0x2b')]=_0x4dcfb2[_0xe3cd('0x2b')];recordings[_0x4dcfb2[_0xe3cd('0xc')]][_0xe3cd('0x2c')]=_0x4dcfb2[_0xe3cd('0x2c')];recordings[_0x4dcfb2[_0xe3cd('0xc')]][_0xe3cd('0x2d')]=_0x4dcfb2['connectedlinename'];if(recordings[_0x4dcfb2[_0xe3cd('0xc')]]['type']==_0xe3cd('0x2e')&&recordings[_0x4dcfb2[_0xe3cd('0xc')]][_0xe3cd('0x4')]){recordings[_0x4dcfb2['uniqueid']][_0xe3cd('0x2c')]=recordings[_0x4dcfb2[_0xe3cd('0xc')]]['accountcode'];recordings[_0x4dcfb2[_0xe3cd('0xc')]]['connectedlinename']='';}recordings[_0x4dcfb2[_0xe3cd('0xc')]]['monitors'][_0xe3cd('0x2f')](function(_0x8f025d){var _0x4a8a40=_[_0xe3cd('0x30')](recordings[_0x4dcfb2[_0xe3cd('0xc')]]);_0x4a8a40[_0xe3cd('0x1f')]=_0x8f025d[_0xe3cd('0x1f')];writeDB(_0x4a8a40);});delete recordings[_0x4dcfb2['uniqueid']];}}catch(_0x51bc59){utils[_0xe3cd('0x12')](util[_0xe3cd('0x1')](_0xe3cd('0x31'),_0x4dcfb2['uniqueid']),_0x51bc59);}};exports[_0xe3cd('0x32')]=function(_0x1a20be){try{if(!_['isNil'](recordings[_0x1a20be['uniqueid']])){utils[_0xe3cd('0x1c')](util[_0xe3cd('0x1')](_0xe3cd('0x33'),_0x1a20be[_0xe3cd('0xc')]),_0x1a20be);utils['info'](util[_0xe3cd('0x1')](_0xe3cd('0x34'),_0x1a20be['uniqueid'],_0x1a20be[_0xe3cd('0x35')],_0x1a20be[_0xe3cd('0x36')]));if(_0x1a20be['application'][_0xe3cd('0x37')]()==_0xe3cd('0x38')&&_[_0xe3cd('0x39')](_0x1a20be[_0xe3cd('0x36')]['toLowerCase'](),_0xe3cd('0x3a'))){var _0x109cf8=_0x1a20be[_0xe3cd('0x36')][_0xe3cd('0x3b')]('=');var _0xbf3737=_0x109cf8[0x0][_0xe3cd('0x3c')](_0x109cf8[0x0]['lastIndexOf']('(')+0x1,_0x109cf8[0x0][_0xe3cd('0x3d')](')'));var _0x3e65cc=_0x109cf8[0x1];recordings[_0x1a20be[_0xe3cd('0xc')]][_0xbf3737]=_0x3e65cc;}}}catch(_0x1dd266){utils['error'](util['format'](_0xe3cd('0x33'),_0x1a20be['uniqueid']),_0x1dd266);}};exports['queuecallerjoin']=function(_0x501a5c){try{if(!_[_0xe3cd('0x13')](recordings[_0x501a5c[_0xe3cd('0xc')]])){utils[_0xe3cd('0x1c')](util[_0xe3cd('0x1')](_0xe3cd('0x3e'),_0x501a5c[_0xe3cd('0xc')]),_0x501a5c);utils['info'](util['format'](_0xe3cd('0x3f'),_0x501a5c[_0xe3cd('0xc')],_0x501a5c[_0xe3cd('0x40')]));recordings[_0x501a5c[_0xe3cd('0xc')]][_0xe3cd('0x40')]=_0x501a5c['queue'];}}catch(_0x4363f6){utils[_0xe3cd('0x12')](util[_0xe3cd('0x1')](_0xe3cd('0x3e'),_0x501a5c[_0xe3cd('0xc')]),_0x4363f6);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index ba6e30b..2924d02 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 _0x622b=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','error','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','format','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','secondtransfererconnectedlinenum'];(function(_0x458ff3,_0x267038){var _0x1235a9=function(_0x210863){while(--_0x210863){_0x458ff3['push'](_0x458ff3['shift']());}};_0x1235a9(++_0x267038);}(_0x622b,0x13c));var _0xb622=function(_0x1ef547,_0x31bfdb){_0x1ef547=_0x1ef547-0x0;var _0x1d697b=_0x622b[_0x1ef547];return _0x1d697b;};'use strict';var _=require(_0xb622('0x0'));var util=require(_0xb622('0x1'));var utils=require(_0xb622('0x2'));function writeDB(_0x3b39bd){utils[_0xb622('0x3')](util['format'](_0xb622('0x4'),_0x3b39bd[_0xb622('0x5')]==='attended'?_0x3b39bd[_0xb622('0x6')]:_0x3b39bd['uniqueid'],_0x3b39bd[_0xb622('0x5')]));utils[_0xb622('0x7')](_0xb622('0x8'),_0x3b39bd);}exports[_0xb622('0x9')]={};exports[_0xb622('0xa')]=function(_0x780559){try{utils[_0xb622('0xb')](util[_0xb622('0xc')]('[%s][transfers][blindtransfer]',_0x780559[_0xb622('0xd')]),_0x780559);utils[_0xb622('0x3')](util[_0xb622('0xc')](_0xb622('0xe'),_0x780559[_0xb622('0xd')],_0x780559['transferercalleridnum'],_0x780559[_0xb622('0xf')],_0x780559[_0xb622('0x10')],_0x780559[_0xb622('0x11')]));_0x780559[_0xb622('0x5')]=_0xb622('0x12');exports[_0xb622('0x9')][_0x780559[_0xb622('0x13')]]=_0x780559;writeDB(_0x780559);}catch(_0xcfda4e){utils['error'](util[_0xb622('0xc')](_0xb622('0x14'),_0x780559[_0xb622('0xd')]),_0xcfda4e);}};exports[_0xb622('0x15')]=function(_0x5c37c7){try{utils['debug'](util[_0xb622('0xc')]('[%s][transfers][attendedtransfer]',_0x5c37c7['origtransfereruniqueid']),_0x5c37c7);utils[_0xb622('0x3')](util[_0xb622('0xc')](_0xb622('0x16'),_0x5c37c7[_0xb622('0x6')],_0x5c37c7[_0xb622('0x17')],_0x5c37c7[_0xb622('0x18')],_0x5c37c7['transfertargetcalleridnum'],_0x5c37c7[_0xb622('0x19')]));_0x5c37c7=_[_0xb622('0x1a')](_0x5c37c7,{'transfererchannel':_0x5c37c7['origtransfererchannel'],'transferercalleridnum':_0x5c37c7[_0xb622('0x17')],'transferercalleridname':_0x5c37c7['origtransferercalleridname'],'transfererconnectedlinenum':_0x5c37c7[_0xb622('0x1b')],'transfererconnectedlinename':_0x5c37c7['secondtransfererconnectedlinename'],'transfereraccountcode':_0x5c37c7[_0xb622('0x1c')],'transferercontext':_0x5c37c7[_0xb622('0x1d')],'transfererexten':_0x5c37c7[_0xb622('0x1e')],'transfererlinkedid':_0x5c37c7['origtransfererlinkedid'],'context':_0x5c37c7[_0xb622('0x1f')],'extension':_0x5c37c7[_0xb622('0x20')],'type':_0xb622('0x21')});if(_[_0xb622('0x22')](_0x5c37c7[_0xb622('0x23')])){_0x5c37c7=_[_0xb622('0x1a')](_0x5c37c7,{'transfereechannel':_0x5c37c7[_0xb622('0x24')],'transfereecalleridnum':_0x5c37c7['transfertargetcalleridnum'],'transfereecalleridname':_0x5c37c7[_0xb622('0x19')],'transfereeconnectedlinenum':_0x5c37c7['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5c37c7[_0xb622('0x25')],'transfereeaccountcode':_0x5c37c7[_0xb622('0x26')],'transfereecontext':_0x5c37c7['transfertargetcontext'],'transfereeexten':_0x5c37c7[_0xb622('0x27')],'transfereelinkedid':_0x5c37c7[_0xb622('0x28')]});}writeDB(_0x5c37c7);}catch(_0x47e8d2){utils[_0xb622('0x29')](util[_0xb622('0xc')](_0xb622('0x2a'),_0x5c37c7[_0xb622('0x6')]),_0x47e8d2);}}; \ No newline at end of file +var _0x9e68=['assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blinds','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum'];(function(_0x241046,_0x4eba99){var _0x4a502c=function(_0x2ffa81){while(--_0x2ffa81){_0x241046['push'](_0x241046['shift']());}};_0x4a502c(++_0x4eba99);}(_0x9e68,0x19f));var _0x89e6=function(_0x53f205,_0xa378e2){_0x53f205=_0x53f205-0x0;var _0x19c74e=_0x9e68[_0x53f205];return _0x19c74e;};'use strict';var _=require('lodash');var util=require(_0x89e6('0x0'));var utils=require('./utils');function writeDB(_0x170146){utils[_0x89e6('0x1')](util[_0x89e6('0x2')](_0x89e6('0x3'),_0x170146[_0x89e6('0x4')]===_0x89e6('0x5')?_0x170146[_0x89e6('0x6')]:_0x170146[_0x89e6('0x7')],_0x170146['type']));utils[_0x89e6('0x8')]('CreateVoiceTransferReport',_0x170146);}exports['blinds']={};exports[_0x89e6('0x9')]=function(_0x54a2e8){try{utils[_0x89e6('0xa')](util[_0x89e6('0x2')](_0x89e6('0xb'),_0x54a2e8[_0x89e6('0x7')]),_0x54a2e8);utils[_0x89e6('0x1')](util[_0x89e6('0x2')](_0x89e6('0xc'),_0x54a2e8['uniqueid'],_0x54a2e8[_0x89e6('0xd')],_0x54a2e8[_0x89e6('0xe')],_0x54a2e8[_0x89e6('0xf')],_0x54a2e8['transfereecalleridname']));_0x54a2e8[_0x89e6('0x4')]='blind';exports[_0x89e6('0x10')][_0x54a2e8[_0x89e6('0x11')]]=_0x54a2e8;writeDB(_0x54a2e8);}catch(_0x562bfe){utils[_0x89e6('0x12')](util[_0x89e6('0x2')](_0x89e6('0xb'),_0x54a2e8[_0x89e6('0x7')]),_0x562bfe);}};exports[_0x89e6('0x13')]=function(_0x521954){try{utils['debug'](util[_0x89e6('0x2')](_0x89e6('0x14'),_0x521954[_0x89e6('0x6')]),_0x521954);utils[_0x89e6('0x1')](util[_0x89e6('0x2')](_0x89e6('0x15'),_0x521954[_0x89e6('0x6')],_0x521954[_0x89e6('0x16')],_0x521954[_0x89e6('0x17')],_0x521954[_0x89e6('0x18')],_0x521954['transfertargetcalleridname']));_0x521954=_[_0x89e6('0x19')](_0x521954,{'transfererchannel':_0x521954[_0x89e6('0x1a')],'transferercalleridnum':_0x521954[_0x89e6('0x16')],'transferercalleridname':_0x521954[_0x89e6('0x17')],'transfererconnectedlinenum':_0x521954[_0x89e6('0x1b')],'transfererconnectedlinename':_0x521954['secondtransfererconnectedlinename'],'transfereraccountcode':_0x521954['origtransfereraccountcode'],'transferercontext':_0x521954['secondtransferercontext'],'transfererexten':_0x521954[_0x89e6('0x1c')],'transfererlinkedid':_0x521954[_0x89e6('0x1d')],'context':_0x521954[_0x89e6('0x1e')],'extension':_0x521954[_0x89e6('0x1f')],'type':_0x89e6('0x5')});if(_[_0x89e6('0x20')](_0x521954[_0x89e6('0x21')])){_0x521954=_[_0x89e6('0x19')](_0x521954,{'transfereechannel':_0x521954[_0x89e6('0x22')],'transfereecalleridnum':_0x521954[_0x89e6('0x18')],'transfereecalleridname':_0x521954[_0x89e6('0x23')],'transfereeconnectedlinenum':_0x521954[_0x89e6('0x24')],'transfereeconnectedlinename':_0x521954[_0x89e6('0x25')],'transfereeaccountcode':_0x521954['transfertargetaccountcode'],'transfereecontext':_0x521954[_0x89e6('0x26')],'transfereeexten':_0x521954['transfertargetexten'],'transfereelinkedid':_0x521954[_0x89e6('0x27')]});}writeDB(_0x521954);}catch(_0x232ae5){utils[_0x89e6('0x12')](util['format']('[%s][transfers][attendedtransfer]',_0x521954[_0x89e6('0x6')]),_0x232ae5);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index e9ba4e5..69e6f92 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 _0x46e8=['getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','length','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','info','inspect','debug','error','request','then','catch','internal','name','interface','stringify','result'];(function(_0x47123a,_0x49937a){var _0x540502=function(_0x3fdb56){while(--_0x3fdb56){_0x47123a['push'](_0x47123a['shift']());}};_0x540502(++_0x49937a);}(_0x46e8,0x1c5));var _0x846e=function(_0x1b3b12,_0x587b2d){_0x1b3b12=_0x1b3b12-0x0;var _0x58d5fe=_0x46e8[_0x1b3b12];return _0x58d5fe;};'use strict';var BPromise=require(_0x846e('0x0'));var jayson=require(_0x846e('0x1'));var moment=require(_0x846e('0x2'));var util=require(_0x846e('0x3'));var client=jayson[_0x846e('0x4')]['http']({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0x846e('0x5')]=function(_0xc97937,_0x2f504f){logger[_0x846e('0x5')](_0xc97937,_0x2f504f?util[_0x846e('0x6')](_0x2f504f,{'showHidden':![],'depth':null}):'');};exports[_0x846e('0x7')]=function(_0x273985,_0x40ef64){logger['debug'](_0x273985,_0x40ef64?util[_0x846e('0x6')](_0x40ef64,{'showHidden':![],'depth':null}):'');};exports[_0x846e('0x8')]=function(_0x42da61,_0x187c6c){logger['error'](_0x42da61,_0x187c6c?util[_0x846e('0x6')](_0x187c6c,{'showHidden':![],'depth':null}):'');};exports[_0x846e('0x9')]=function(_0x32c472,_0x1e1cb1){return client[_0x846e('0x9')](_0x32c472,{'body':_0x1e1cb1})[_0x846e('0xa')](function(_0x3d201d){logger[_0x846e('0x7')]('[utils][request]\x20name:%s',_0x32c472,_0x3d201d?util[_0x846e('0x6')](_0x3d201d,{'showHidden':![],'depth':null}):'');})[_0x846e('0xb')](function(_0xa9d6e0){logger['error']('[utils][request]\x20name:%s',_0x32c472,_0xa9d6e0?util[_0x846e('0x6')](_0xa9d6e0,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2cc373){return client[_0x846e('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x846e('0xc'),_0x846e('0xd'),_0x846e('0xe')],'where':_0x2cc373,'limit':0x1}})['then'](function(_0x3870f4){logger[_0x846e('0x7')]('[utils][getUser]\x20where:%s',JSON[_0x846e('0xf')](_0x2cc373),_0x3870f4?util[_0x846e('0x6')](_0x3870f4,{'showHidden':![],'depth':null}):'');return _0x3870f4[_0x846e('0x10')]['length']?_0x3870f4[_0x846e('0x10')][0x0]:null;});}exports[_0x846e('0x11')]=function(_0x489987){return new BPromise(function(_0x371e04,_0x483fa3){if(_0x489987){return getUser({'internal':_0x489987})[_0x846e('0xa')](function(_0x4656f9){logger[_0x846e('0x5')](_0x846e('0x12'),_0x489987,_0x4656f9?_0x846e('0x13'):_0x846e('0x14'));return _0x371e04(_0x4656f9);})[_0x846e('0xb')](function(_0x5f2857){logger[_0x846e('0x8')](_0x846e('0x15'),_0x5f2857?util[_0x846e('0x6')](_0x5f2857,{'showHidden':![],'depth':null}):'');return _0x371e04(null);});}return _0x371e04(null);});};exports[_0x846e('0x16')]=function(_0x15f988){return new BPromise(function(_0x1e112f,_0x4b8c9c){if(_0x15f988){return getUser({'interface':_0x15f988})[_0x846e('0xa')](function(_0x478ec9){logger['info'](_0x846e('0x17'),_0x15f988,_0x478ec9?_0x846e('0x13'):_0x846e('0x14'));return _0x1e112f(_0x478ec9);})[_0x846e('0xb')](function(_0x3e1c5f){logger[_0x846e('0x8')](_0x846e('0x18'),_0x3e1c5f?util['inspect'](_0x3e1c5f,{'showHidden':![],'depth':null}):'');return _0x1e112f(null);});}return _0x1e112f(null);});};exports['getUserByName']=function(_0x5b191b){return new BPromise(function(_0x70e3ee,_0x4331b9){if(_0x5b191b){return getUser({'name':_0x5b191b})['then'](function(_0x43104a){logger[_0x846e('0x5')](_0x846e('0x19'),_0x5b191b,_0x43104a?_0x846e('0x13'):_0x846e('0x14'));return _0x70e3ee(_0x43104a);})['catch'](function(_0x1279cb){logger[_0x846e('0x8')](_0x846e('0x1a'),_0x1279cb?util[_0x846e('0x6')](_0x1279cb,{'showHidden':![],'depth':null}):'');return _0x70e3ee(null);});}return _0x70e3ee(null);});};exports[_0x846e('0x1b')]=function(_0x3776f5){return new BPromise(function(_0x3faf0c,_0x215dfc){if(_0x3776f5){return client[_0x846e('0x9')](_0x846e('0x1c'),{'options':{'raw':!![],'attributes':['id',_0x846e('0xd'),_0x846e('0x1d'),_0x846e('0x1e'),_0x846e('0x1f')],'where':{'name':_0x3776f5},'limit':0x1}})[_0x846e('0xa')](function(_0x17b554){logger[_0x846e('0x7')](_0x846e('0x20'),_0x3776f5,_0x17b554?util[_0x846e('0x6')](_0x17b554,{'showHidden':![],'depth':null}):'');logger[_0x846e('0x5')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x3776f5,_0x17b554?'found':'notfound');return _0x3faf0c(_0x17b554['result'][_0x846e('0x21')]?_0x17b554[_0x846e('0x10')][0x0]:null);})[_0x846e('0xb')](function(_0x39e54f){logger[_0x846e('0x8')](_0x846e('0x22'),_0x39e54f?util[_0x846e('0x6')](_0x39e54f,{'showHidden':![],'depth':null}):'');return _0x3faf0c(null);});}return _0x3faf0c(null);});};exports[_0x846e('0x23')]=function(_0x3b8daf,_0x3ae310){return moment(_0x3b8daf)[_0x846e('0x24')](_0x3ae310,_0x846e('0x25'))[_0x846e('0x26')](_0x846e('0x27'));};exports[_0x846e('0x28')]=function(_0x13c63d,_0x3bab73){return moment(_0x13c63d)[_0x846e('0x29')](_0x3bab73,_0x846e('0x25'))[_0x846e('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x846e('0x2a')]=function(_0x1187d7,_0x1c6d6c){return moment(_0x1187d7)[_0x846e('0x2b')](moment(_0x1c6d6c),_0x846e('0x25'));};exports[_0x846e('0x2c')]=function(_0x554c47,_0x246ac0){return parseInt(_0x554c47,0xa)+parseInt(_0x246ac0,0xa);};exports['now']=function(){return moment()[_0x846e('0x26')](_0x846e('0x27'));};exports[_0x846e('0x2d')]=function(_0x23c475,_0x54aa2f){if(_0x54aa2f){return moment(_0x23c475)['isAfter'](_0x54aa2f);}return!![];};exports[_0x846e('0x2e')]=function(_0xa8afe1,_0x26b0b1){if(_0x26b0b1){return moment(_0xa8afe1)[_0x846e('0x2e')](_0x26b0b1);}else if(_0xa8afe1){return!![];}return![];}; \ No newline at end of file +var _0x3627=['getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','internal','interface','[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]'];(function(_0xd674c2,_0x5aab8f){var _0x56ca35=function(_0x5a6a25){while(--_0x5a6a25){_0xd674c2['push'](_0xd674c2['shift']());}};_0x56ca35(++_0x5aab8f);}(_0x3627,0x170));var _0x7362=function(_0x4c2dca,_0x389823){_0x4c2dca=_0x4c2dca-0x0;var _0x58230f=_0x3627[_0x4c2dca];return _0x58230f;};'use strict';var BPromise=require(_0x7362('0x0'));var jayson=require('jayson/promise');var moment=require(_0x7362('0x1'));var util=require(_0x7362('0x2'));var client=jayson[_0x7362('0x3')][_0x7362('0x4')]({'port':0x2329});var logger=require(_0x7362('0x5'))('xdr');exports['info']=function(_0x4a4d7a,_0xc45a8e){logger[_0x7362('0x6')](_0x4a4d7a,_0xc45a8e?util[_0x7362('0x7')](_0xc45a8e,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0xd47322,_0x268b53){logger[_0x7362('0x8')](_0xd47322,_0x268b53?util[_0x7362('0x7')](_0x268b53,{'showHidden':![],'depth':null}):'');};exports[_0x7362('0x9')]=function(_0x41e9e7,_0x2c7b2a){logger[_0x7362('0x9')](_0x41e9e7,_0x2c7b2a?util[_0x7362('0x7')](_0x2c7b2a,{'showHidden':![],'depth':null}):'');};exports[_0x7362('0xa')]=function(_0x4ffca4,_0x4b8f30){return client[_0x7362('0xa')](_0x4ffca4,{'body':_0x4b8f30})[_0x7362('0xb')](function(_0x44e10f){logger[_0x7362('0x8')](_0x7362('0xc'),_0x4ffca4,_0x44e10f?util[_0x7362('0x7')](_0x44e10f,{'showHidden':![],'depth':null}):'');})[_0x7362('0xd')](function(_0x1da49b){logger[_0x7362('0x9')](_0x7362('0xc'),_0x4ffca4,_0x1da49b?util[_0x7362('0x7')](_0x1da49b,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3707d9){return client[_0x7362('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x7362('0xe'),'name',_0x7362('0xf')],'where':_0x3707d9,'limit':0x1}})[_0x7362('0xb')](function(_0x5b3553){logger[_0x7362('0x8')](_0x7362('0x10'),JSON[_0x7362('0x11')](_0x3707d9),_0x5b3553?util[_0x7362('0x7')](_0x5b3553,{'showHidden':![],'depth':null}):'');return _0x5b3553[_0x7362('0x12')][_0x7362('0x13')]?_0x5b3553[_0x7362('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x4e6d68){return new BPromise(function(_0x35fdb7,_0x37f218){if(_0x4e6d68){return getUser({'internal':_0x4e6d68})[_0x7362('0xb')](function(_0xeafcb8){logger[_0x7362('0x6')](_0x7362('0x14'),_0x4e6d68,_0xeafcb8?_0x7362('0x15'):_0x7362('0x16'));return _0x35fdb7(_0xeafcb8);})[_0x7362('0xd')](function(_0x3865c0){logger[_0x7362('0x9')](_0x7362('0x17'),_0x3865c0?util['inspect'](_0x3865c0,{'showHidden':![],'depth':null}):'');return _0x35fdb7(null);});}return _0x35fdb7(null);});};exports[_0x7362('0x18')]=function(_0x347ca4){return new BPromise(function(_0x42a6f0,_0x151c68){if(_0x347ca4){return getUser({'interface':_0x347ca4})[_0x7362('0xb')](function(_0x50253c){logger[_0x7362('0x6')](_0x7362('0x19'),_0x347ca4,_0x50253c?'found':_0x7362('0x16'));return _0x42a6f0(_0x50253c);})[_0x7362('0xd')](function(_0x55bfcf){logger[_0x7362('0x9')]('[utils][getUserByInterface]',_0x55bfcf?util[_0x7362('0x7')](_0x55bfcf,{'showHidden':![],'depth':null}):'');return _0x42a6f0(null);});}return _0x42a6f0(null);});};exports[_0x7362('0x1a')]=function(_0x23fa53){return new BPromise(function(_0x56076b,_0x2dba1b){if(_0x23fa53){return getUser({'name':_0x23fa53})[_0x7362('0xb')](function(_0x4e0675){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x23fa53,_0x4e0675?'found':_0x7362('0x16'));return _0x56076b(_0x4e0675);})[_0x7362('0xd')](function(_0x5b87b2){logger['error'](_0x7362('0x1b'),_0x5b87b2?util[_0x7362('0x7')](_0x5b87b2,{'showHidden':![],'depth':null}):'');return _0x56076b(null);});}return _0x56076b(null);});};exports[_0x7362('0x1c')]=function(_0x92c37d){return new BPromise(function(_0x4640f7,_0x1c8c37){if(_0x92c37d){return client[_0x7362('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x7362('0x1d'),_0x7362('0x1e'),'acwTimeout'],'where':{'name':_0x92c37d},'limit':0x1}})[_0x7362('0xb')](function(_0x593a9a){logger[_0x7362('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x92c37d,_0x593a9a?util[_0x7362('0x7')](_0x593a9a,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x92c37d,_0x593a9a?'found':_0x7362('0x16'));return _0x4640f7(_0x593a9a[_0x7362('0x12')]['length']?_0x593a9a[_0x7362('0x12')][0x0]:null);})[_0x7362('0xd')](function(_0x1e95aa){logger[_0x7362('0x9')](_0x7362('0x1f'),_0x1e95aa?util[_0x7362('0x7')](_0x1e95aa,{'showHidden':![],'depth':null}):'');return _0x4640f7(null);});}return _0x4640f7(null);});};exports[_0x7362('0x20')]=function(_0x335ebb,_0x5db624){return moment(_0x335ebb)[_0x7362('0x21')](_0x5db624,_0x7362('0x22'))[_0x7362('0x23')](_0x7362('0x24'));};exports[_0x7362('0x25')]=function(_0x5e41e3,_0x20c3cd){return moment(_0x5e41e3)[_0x7362('0x26')](_0x20c3cd,_0x7362('0x22'))[_0x7362('0x23')](_0x7362('0x24'));};exports['diffTime']=function(_0x514ace,_0x351041){return moment(_0x514ace)[_0x7362('0x27')](moment(_0x351041),_0x7362('0x22'));};exports[_0x7362('0x28')]=function(_0x1a2368,_0x69a967){return parseInt(_0x1a2368,0xa)+parseInt(_0x69a967,0xa);};exports[_0x7362('0x29')]=function(){return moment()['format'](_0x7362('0x24'));};exports[_0x7362('0x2a')]=function(_0xd47e26,_0x3d85c1){if(_0x3d85c1){return moment(_0xd47e26)[_0x7362('0x2a')](_0x3d85c1);}return!![];};exports[_0x7362('0x2b')]=function(_0x49c5bd,_0x149f7b){if(_0x149f7b){return moment(_0x49c5bd)[_0x7362('0x2b')](_0x149f7b);}else if(_0x49c5bd){return!![];}return![];}; \ No newline at end of file